From cf8107fbbe225acb882d4a28314f26e236faab5c Mon Sep 17 00:00:00 2001 From: Vadim <1125014+zolotokrylin@users.noreply.github.com> Date: Mon, 17 Oct 2022 19:25:00 +0800 Subject: [PATCH 0001/1974] init --- projects/clearpool/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/clearpool/index.js b/projects/clearpool/index.js index 7e70b4388c5..cc61a3cf5ec 100644 --- a/projects/clearpool/index.js +++ b/projects/clearpool/index.js @@ -105,6 +105,7 @@ module.exports = { ethereum: { tvl: ethereumTVL, borrowed: ethereumBorrowed, + staked: ethereumStaked, }, polygon: { tvl: polygonTvl, From 8c177c7fe3aee47e600ef74c0657ccee37d57eb5 Mon Sep 17 00:00:00 2001 From: Vadim <1125014+zolotokrylin@users.noreply.github.com> Date: Mon, 17 Oct 2022 19:25:23 +0800 Subject: [PATCH 0002/1974] revert --- projects/clearpool/index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/projects/clearpool/index.js b/projects/clearpool/index.js index cc61a3cf5ec..7e70b4388c5 100644 --- a/projects/clearpool/index.js +++ b/projects/clearpool/index.js @@ -105,7 +105,6 @@ module.exports = { ethereum: { tvl: ethereumTVL, borrowed: ethereumBorrowed, - staked: ethereumStaked, }, polygon: { tvl: polygonTvl, From 3f7decec877127c4c8007ec6644b9185fb5db2cf Mon Sep 17 00:00:00 2001 From: Vadim <1125014+zolotokrylin@users.noreply.github.com> Date: Mon, 17 Oct 2022 19:26:32 +0800 Subject: [PATCH 0003/1974] init --- projects/clearpool/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/clearpool/index.js b/projects/clearpool/index.js index 7e70b4388c5..cc61a3cf5ec 100644 --- a/projects/clearpool/index.js +++ b/projects/clearpool/index.js @@ -105,6 +105,7 @@ module.exports = { ethereum: { tvl: ethereumTVL, borrowed: ethereumBorrowed, + staked: ethereumStaked, }, polygon: { tvl: polygonTvl, From 62df106f447fa05c676e2baaf8c95f3e74c10093 Mon Sep 17 00:00:00 2001 From: Oleg Korzhanov Date: Tue, 18 Oct 2022 00:23:57 +0400 Subject: [PATCH 0004/1974] not yet tested --- projects/clearpool/index.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/projects/clearpool/index.js b/projects/clearpool/index.js index cc61a3cf5ec..10e7a8e170f 100644 --- a/projects/clearpool/index.js +++ b/projects/clearpool/index.js @@ -7,6 +7,8 @@ const PoolFactory = "0xde204e5a060ba5d3b63c7a4099712959114c2d48"; const START_BLOCK = 14443222; const polygonPoolURL = 'https://api-v3.clearpool.finance/137/pools' + + const ethereumTVL = async (timestamp, block, chainBlocks) => { const balances = {}; const Logs = ( @@ -60,6 +62,18 @@ const ethereumBorrowed = async (timestamp, block, chainBlocks) => { return totalBorrowed; }; +const ethereumStaked = async (timestamp, block, chainBlocks) => { + + const data = await get( + 'https://clearpool.finance/api/kpi' + ); + const { staking } = Promise.resolve(data); + return staking.tvl; + + +}; + + const polygonTvl = async (timestamp, _, { polygon: block }) => { const balances = {}; From f88fc35957bb2d67227c04fb84ce954425fedd9c Mon Sep 17 00:00:00 2001 From: Vadim <1125014+zolotokrylin@users.noreply.github.com> Date: Tue, 18 Oct 2022 11:20:44 +0800 Subject: [PATCH 0005/1974] fix export key --- projects/clearpool/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/clearpool/index.js b/projects/clearpool/index.js index 10e7a8e170f..9020baf861d 100644 --- a/projects/clearpool/index.js +++ b/projects/clearpool/index.js @@ -119,7 +119,7 @@ module.exports = { ethereum: { tvl: ethereumTVL, borrowed: ethereumBorrowed, - staked: ethereumStaked, + staking: ethereumStaked, }, polygon: { tvl: polygonTvl, From f7c51e854cddd91a191ee693af9dcfaae0d689d1 Mon Sep 17 00:00:00 2001 From: Oleg Korzhanov Date: Tue, 18 Oct 2022 14:01:06 +0400 Subject: [PATCH 0006/1974] working endpoint --- projects/clearpool/index.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/projects/clearpool/index.js b/projects/clearpool/index.js index 9020baf861d..7fa80ea2b1e 100644 --- a/projects/clearpool/index.js +++ b/projects/clearpool/index.js @@ -62,15 +62,12 @@ const ethereumBorrowed = async (timestamp, block, chainBlocks) => { return totalBorrowed; }; -const ethereumStaked = async (timestamp, block, chainBlocks) => { - - const data = await get( +const ethereumStaked = async () => { + const kpi = await get( 'https://clearpool.finance/api/kpi' ); - const { staking } = Promise.resolve(data); - return staking.tvl; - - + let tvl = parseFloat(kpi?.staking.tvl); + return tvl }; @@ -114,6 +111,7 @@ const polygonBorrowed = async (timestamp, _, { polygon: block }) => { return totalBorrowed; }; +// node test.js projects/clearpool/index.js module.exports = { timetravel: false, ethereum: { From b825b6d6ab96322d8e0d7206070b95e5b366d4dc Mon Sep 17 00:00:00 2001 From: Vadim <1125014+zolotokrylin@users.noreply.github.com> Date: Tue, 18 Oct 2022 19:34:49 +0800 Subject: [PATCH 0007/1974] Update index.js --- projects/clearpool/index.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/projects/clearpool/index.js b/projects/clearpool/index.js index 7fa80ea2b1e..33a06825b70 100644 --- a/projects/clearpool/index.js +++ b/projects/clearpool/index.js @@ -7,8 +7,6 @@ const PoolFactory = "0xde204e5a060ba5d3b63c7a4099712959114c2d48"; const START_BLOCK = 14443222; const polygonPoolURL = 'https://api-v3.clearpool.finance/137/pools' - - const ethereumTVL = async (timestamp, block, chainBlocks) => { const balances = {}; const Logs = ( From 7159f239c9cbc359a704c4a488b15993aaefe427 Mon Sep 17 00:00:00 2001 From: Vadim <1125014+zolotokrylin@users.noreply.github.com> Date: Tue, 18 Oct 2022 19:56:11 +0800 Subject: [PATCH 0008/1974] Update index.js --- projects/clearpool/index.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/projects/clearpool/index.js b/projects/clearpool/index.js index 33a06825b70..2956aa1d05f 100644 --- a/projects/clearpool/index.js +++ b/projects/clearpool/index.js @@ -68,8 +68,6 @@ const ethereumStaked = async () => { return tvl }; - - const polygonTvl = async (timestamp, _, { polygon: block }) => { const balances = {}; const chain = 'polygon' From 0e058255e64d831ab2274e48413c9679cbcd2acd Mon Sep 17 00:00:00 2001 From: Vadim <1125014+zolotokrylin@users.noreply.github.com> Date: Tue, 18 Oct 2022 20:08:14 +0800 Subject: [PATCH 0009/1974] try with staking helper --- projects/clearpool/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/projects/clearpool/index.js b/projects/clearpool/index.js index 2956aa1d05f..4839aca5bf7 100644 --- a/projects/clearpool/index.js +++ b/projects/clearpool/index.js @@ -2,6 +2,7 @@ const sdk = require("@defillama/sdk"); const { sumTokens } = require("../helper/unwrapLPs"); const abi = require("./abi.json"); const { get } = require('../helper/http') +const { staking } = require('./helper/staking') const PoolFactory = "0xde204e5a060ba5d3b63c7a4099712959114c2d48"; const START_BLOCK = 14443222; @@ -113,7 +114,8 @@ module.exports = { ethereum: { tvl: ethereumTVL, borrowed: ethereumBorrowed, - staking: ethereumStaked, + // staking: ethereumStaked, + staking: staking('0x629E39da1Db5654fe59cAE31d48CAEBB8dC2A9c6', '0x66761fa41377003622aee3c7675fc7b5c1c2fac5'), }, polygon: { tvl: polygonTvl, From ae0a0b61251f739dcd9c7c804732eb08a61beb79 Mon Sep 17 00:00:00 2001 From: Vadim <1125014+zolotokrylin@users.noreply.github.com> Date: Tue, 18 Oct 2022 20:10:25 +0800 Subject: [PATCH 0010/1974] fix tvl? --- projects/clearpool/index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/projects/clearpool/index.js b/projects/clearpool/index.js index 4839aca5bf7..659d508a303 100644 --- a/projects/clearpool/index.js +++ b/projects/clearpool/index.js @@ -114,7 +114,6 @@ module.exports = { ethereum: { tvl: ethereumTVL, borrowed: ethereumBorrowed, - // staking: ethereumStaked, staking: staking('0x629E39da1Db5654fe59cAE31d48CAEBB8dC2A9c6', '0x66761fa41377003622aee3c7675fc7b5c1c2fac5'), }, polygon: { From ceb14d461028be7518d53a91987c35a343497be0 Mon Sep 17 00:00:00 2001 From: Vadim <1125014+zolotokrylin@users.noreply.github.com> Date: Tue, 18 Oct 2022 20:13:17 +0800 Subject: [PATCH 0011/1974] try --- projects/clearpool/index.js | 8 -------- 1 file changed, 8 deletions(-) diff --git a/projects/clearpool/index.js b/projects/clearpool/index.js index 659d508a303..b4c0be21a7d 100644 --- a/projects/clearpool/index.js +++ b/projects/clearpool/index.js @@ -61,14 +61,6 @@ const ethereumBorrowed = async (timestamp, block, chainBlocks) => { return totalBorrowed; }; -const ethereumStaked = async () => { - const kpi = await get( - 'https://clearpool.finance/api/kpi' - ); - let tvl = parseFloat(kpi?.staking.tvl); - return tvl -}; - const polygonTvl = async (timestamp, _, { polygon: block }) => { const balances = {}; const chain = 'polygon' From e5a49272b212281c20005dcbefb04c8fc8ab1c4f Mon Sep 17 00:00:00 2001 From: Vadim <1125014+zolotokrylin@users.noreply.github.com> Date: Tue, 18 Oct 2022 20:22:57 +0800 Subject: [PATCH 0012/1974] check --- projects/clearpool/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/clearpool/index.js b/projects/clearpool/index.js index b4c0be21a7d..af579b2f83e 100644 --- a/projects/clearpool/index.js +++ b/projects/clearpool/index.js @@ -2,7 +2,7 @@ const sdk = require("@defillama/sdk"); const { sumTokens } = require("../helper/unwrapLPs"); const abi = require("./abi.json"); const { get } = require('../helper/http') -const { staking } = require('./helper/staking') +// const { staking } = require('./helper/staking') const PoolFactory = "0xde204e5a060ba5d3b63c7a4099712959114c2d48"; const START_BLOCK = 14443222; @@ -106,7 +106,7 @@ module.exports = { ethereum: { tvl: ethereumTVL, borrowed: ethereumBorrowed, - staking: staking('0x629E39da1Db5654fe59cAE31d48CAEBB8dC2A9c6', '0x66761fa41377003622aee3c7675fc7b5c1c2fac5'), + // staking: staking('0x629E39da1Db5654fe59cAE31d48CAEBB8dC2A9c6', '0x66761fa41377003622aee3c7675fc7b5c1c2fac5'), }, polygon: { tvl: polygonTvl, From 7cd598503a076328e2d3e7779b1f894228f172ac Mon Sep 17 00:00:00 2001 From: Vadim <1125014+zolotokrylin@users.noreply.github.com> Date: Tue, 18 Oct 2022 20:32:00 +0800 Subject: [PATCH 0013/1974] revert --- projects/clearpool/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/clearpool/index.js b/projects/clearpool/index.js index af579b2f83e..b4c0be21a7d 100644 --- a/projects/clearpool/index.js +++ b/projects/clearpool/index.js @@ -2,7 +2,7 @@ const sdk = require("@defillama/sdk"); const { sumTokens } = require("../helper/unwrapLPs"); const abi = require("./abi.json"); const { get } = require('../helper/http') -// const { staking } = require('./helper/staking') +const { staking } = require('./helper/staking') const PoolFactory = "0xde204e5a060ba5d3b63c7a4099712959114c2d48"; const START_BLOCK = 14443222; @@ -106,7 +106,7 @@ module.exports = { ethereum: { tvl: ethereumTVL, borrowed: ethereumBorrowed, - // staking: staking('0x629E39da1Db5654fe59cAE31d48CAEBB8dC2A9c6', '0x66761fa41377003622aee3c7675fc7b5c1c2fac5'), + staking: staking('0x629E39da1Db5654fe59cAE31d48CAEBB8dC2A9c6', '0x66761fa41377003622aee3c7675fc7b5c1c2fac5'), }, polygon: { tvl: polygonTvl, From a9977a5f0ce5298d23059231e8e8e901140de764 Mon Sep 17 00:00:00 2001 From: Vadim <1125014+zolotokrylin@users.noreply.github.com> Date: Tue, 18 Oct 2022 20:33:21 +0800 Subject: [PATCH 0014/1974] fix --- projects/clearpool/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/clearpool/index.js b/projects/clearpool/index.js index b4c0be21a7d..3f9c40520fb 100644 --- a/projects/clearpool/index.js +++ b/projects/clearpool/index.js @@ -106,7 +106,7 @@ module.exports = { ethereum: { tvl: ethereumTVL, borrowed: ethereumBorrowed, - staking: staking('0x629E39da1Db5654fe59cAE31d48CAEBB8dC2A9c6', '0x66761fa41377003622aee3c7675fc7b5c1c2fac5'), + staking: stakings('0x629E39da1Db5654fe59cAE31d48CAEBB8dC2A9c6', '0x66761fa41377003622aee3c7675fc7b5c1c2fac5'), }, polygon: { tvl: polygonTvl, From d114ab0c757ba0f4f251ccf35ba21967b4154a16 Mon Sep 17 00:00:00 2001 From: Vadim <1125014+zolotokrylin@users.noreply.github.com> Date: Tue, 18 Oct 2022 20:38:12 +0800 Subject: [PATCH 0015/1974] try --- projects/clearpool/index.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/projects/clearpool/index.js b/projects/clearpool/index.js index 3f9c40520fb..ba02ca0115a 100644 --- a/projects/clearpool/index.js +++ b/projects/clearpool/index.js @@ -100,13 +100,20 @@ const polygonBorrowed = async (timestamp, _, { polygon: block }) => { return totalBorrowed; }; + +const singleStakingContracts = [ + "0x629E39da1Db5654fe59cAE31d48CAEBB8dC2A9c6", +]; + +const CPOOL = "0x66761fa41377003622aee3c7675fc7b5c1c2fac5"; + // node test.js projects/clearpool/index.js module.exports = { timetravel: false, ethereum: { tvl: ethereumTVL, borrowed: ethereumBorrowed, - staking: stakings('0x629E39da1Db5654fe59cAE31d48CAEBB8dC2A9c6', '0x66761fa41377003622aee3c7675fc7b5c1c2fac5'), + staking: stakings(singleStakingContracts, CPOOL), }, polygon: { tvl: polygonTvl, From d47b8cf94adbd6c82c5f06dfea6945d9002c0395 Mon Sep 17 00:00:00 2001 From: Oleg Korzhanov Date: Sun, 4 Dec 2022 17:23:54 +0400 Subject: [PATCH 0016/1974] init From 146c038c13c7c8004d7ec492a29b19a766ffe412 Mon Sep 17 00:00:00 2001 From: Oleg Korzhanov Date: Mon, 5 Dec 2022 17:17:15 +0400 Subject: [PATCH 0017/1974] notes --- projects/clearpool/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/clearpool/index.js b/projects/clearpool/index.js index ba02ca0115a..c0d3e41820a 100644 --- a/projects/clearpool/index.js +++ b/projects/clearpool/index.js @@ -1,3 +1,6 @@ +// npm i -f +// node test.js projects/clearpool/index.js + const sdk = require("@defillama/sdk"); const { sumTokens } = require("../helper/unwrapLPs"); const abi = require("./abi.json"); From 4c09954bfda8ae4ace751dfc951ad509cf766e65 Mon Sep 17 00:00:00 2001 From: Oleg Korzhanov Date: Mon, 5 Dec 2022 17:17:40 +0400 Subject: [PATCH 0018/1974] fix stakings bug --- projects/clearpool/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/clearpool/index.js b/projects/clearpool/index.js index c0d3e41820a..c4fa060ce15 100644 --- a/projects/clearpool/index.js +++ b/projects/clearpool/index.js @@ -5,7 +5,7 @@ const sdk = require("@defillama/sdk"); const { sumTokens } = require("../helper/unwrapLPs"); const abi = require("./abi.json"); const { get } = require('../helper/http') -const { staking } = require('./helper/staking') +const { stakings } = require('../helper/staking') const PoolFactory = "0xde204e5a060ba5d3b63c7a4099712959114c2d48"; const START_BLOCK = 14443222; From 95d683ccabbacf0915ee83ca790f9417202a1ece Mon Sep 17 00:00:00 2001 From: Oleg Korzhanov Date: Mon, 5 Dec 2022 17:18:18 +0400 Subject: [PATCH 0019/1974] fix endpoint --- projects/clearpool/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/clearpool/index.js b/projects/clearpool/index.js index c4fa060ce15..aa2ed13b66b 100644 --- a/projects/clearpool/index.js +++ b/projects/clearpool/index.js @@ -9,7 +9,7 @@ const { stakings } = require('../helper/staking') const PoolFactory = "0xde204e5a060ba5d3b63c7a4099712959114c2d48"; const START_BLOCK = 14443222; -const polygonPoolURL = 'https://api-v3.clearpool.finance/137/pools' +const polygonPoolURL = 'http://app.clearpool.finance/api/pools' const ethereumTVL = async (timestamp, block, chainBlocks) => { const balances = {}; From 5c67d547aa2f9e1c18cd99f101419fb3febafaff Mon Sep 17 00:00:00 2001 From: Oleg Korzhanov Date: Mon, 5 Dec 2022 17:21:00 +0400 Subject: [PATCH 0020/1974] fixing data retrieval --- projects/clearpool/index.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/projects/clearpool/index.js b/projects/clearpool/index.js index aa2ed13b66b..abc09474b73 100644 --- a/projects/clearpool/index.js +++ b/projects/clearpool/index.js @@ -67,11 +67,13 @@ const ethereumBorrowed = async (timestamp, block, chainBlocks) => { const polygonTvl = async (timestamp, _, { polygon: block }) => { const balances = {}; const chain = 'polygon' - const poolData = await get(polygonPoolURL) + const poolAllData = await get(polygonPoolURL) + const poolData = poolAllData["137"] + const tokensAndOwners = []; for (let i = 0; i < poolData.length; i++) { const pool = poolData[i].address; - const token = poolData[i].currency.address; + const token = poolData[i].currencyAddress; tokensAndOwners.push([token, pool]); } await sumTokens(balances, tokensAndOwners, block, chain); @@ -80,7 +82,8 @@ const polygonTvl = async (timestamp, _, { polygon: block }) => { const polygonBorrowed = async (timestamp, _, { polygon: block }) => { const chain = 'polygon' - const poolData = await get(polygonPoolURL) + const poolAllData = await get(polygonPoolURL) + const poolData = poolAllData["137"] const totalBorrowed = {}; const pools = [] @@ -88,7 +91,7 @@ const polygonBorrowed = async (timestamp, _, { polygon: block }) => { for (let i = 0; i < poolData.length; i++) { const pool = poolData[i].address; - const token = poolData[i].currency.address; + const token = poolData[i].currencyAddress; pools.push(pool) tokens.push(token) } @@ -110,7 +113,6 @@ const singleStakingContracts = [ const CPOOL = "0x66761fa41377003622aee3c7675fc7b5c1c2fac5"; -// node test.js projects/clearpool/index.js module.exports = { timetravel: false, ethereum: { From 22bd5718dba62f9a88f36fb305944c69c019c594 Mon Sep 17 00:00:00 2001 From: Oleg Korzhanov Date: Mon, 5 Dec 2022 20:10:00 +0400 Subject: [PATCH 0021/1974] fix url --- projects/clearpool/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/clearpool/index.js b/projects/clearpool/index.js index abc09474b73..36ecf403c3f 100644 --- a/projects/clearpool/index.js +++ b/projects/clearpool/index.js @@ -9,7 +9,7 @@ const { stakings } = require('../helper/staking') const PoolFactory = "0xde204e5a060ba5d3b63c7a4099712959114c2d48"; const START_BLOCK = 14443222; -const polygonPoolURL = 'http://app.clearpool.finance/api/pools' +const polygonPoolURL = 'https://app.clearpool.finance/api/pools' const ethereumTVL = async (timestamp, block, chainBlocks) => { const balances = {}; From 57ab0441bfde314c65539518c1ee26b3318b7991 Mon Sep 17 00:00:00 2001 From: twenty Date: Thu, 9 Feb 2023 19:20:02 +0800 Subject: [PATCH 0022/1974] Add asdCRV Tvl --- projects/concentrator/abis/AladdinSdCRV.json | 4 ++++ projects/concentrator/index.js | 21 +++++++++++++++++--- 2 files changed, 22 insertions(+), 3 deletions(-) create mode 100644 projects/concentrator/abis/AladdinSdCRV.json diff --git a/projects/concentrator/abis/AladdinSdCRV.json b/projects/concentrator/abis/AladdinSdCRV.json new file mode 100644 index 00000000000..43111bca20d --- /dev/null +++ b/projects/concentrator/abis/AladdinSdCRV.json @@ -0,0 +1,4 @@ +{ + "totalAssets": "uint256:totalAssets", + "totalSupply": "uint256:totalSupply" +} \ No newline at end of file diff --git a/projects/concentrator/index.js b/projects/concentrator/index.js index bf82936016b..bd5e17e4a38 100644 --- a/projects/concentrator/index.js +++ b/projects/concentrator/index.js @@ -6,6 +6,7 @@ const AladdinConvexVaultABI = require('./abis/AladdinConvexVault.json') const AladdinCRVABI = require('./abis/AladdinCRV.json') const AladdinAFXSABI = require('./abis/AladdinAFXS.json') const AladdinCVXABI = require('./abis/AladdinCVX.json') +const AladdinSdCRVABI = require('./abis/AladdinSdCRV.json') const { farmConfig, vaultConfig: configPools, afrxETHConfig } = require('./config.js'); @@ -14,7 +15,8 @@ const concentratorAcrv = '0x2b95A1Dcc3D405535f9ed33c219ab38E8d7e0884'; const concentratorAFXS = '0xDAF03D70Fe637b91bA6E521A32E1Fb39256d3EC9'; const concentratorAFrxETH = "0xb15Ad6113264094Fd9BF2238729410A07EBE5ABa"; const cvxcrvAddress = '0x62b9c7356a2dc64a1969e19c23e4f579f9810aa7'; -const abcCVXAddress = '0xDEC800C2b17c9673570FDF54450dc1bd79c8E359'; +const concentratorAbcCVXAddress = '0xDEC800C2b17c9673570FDF54450dc1bd79c8E359'; +const concentratorAsdCRVAddress = "0x43E54C2E7b3e294De3A155785F52AB49d87B9922" const concentratorNewVault = '0x3Cf54F3A1969be9916DAD548f3C084331C4450b5'; const concentratorAfxsVault = '0xD6E3BB7b1D6Fa75A71d48CFB10096d59ABbf99E1'; @@ -23,6 +25,8 @@ const usdtAddress = "0xdac17f958d2ee523a2206206994597c13d831ec7"; const aladdinBalancerLPGauge = '0x33e411ebE366D72d058F3eF22F1D0Cf8077fDaB0'; const clevCVXAddress = "0xf05e58fCeA29ab4dA01A495140B349F8410Ba904" const clevCVXCVXAddress = "0xF9078Fb962A7D13F55d40d49C8AA6472aBD1A5a6" +const sdCRVAddress = '0xD1b5651E55D4CeeD36251c61c50C889B36F6abB5' + const chain = 'ethereum'; async function getBalancerLpTvl(balances, block) { const ctrLpTotalSupply = (await sdk.api.abi.call({ @@ -53,6 +57,7 @@ async function tvl(timestamp, block, _, { api }) { getAFXSInfo(balances, block), getAfrxETHInfo(balances, block), getAbcCVXInfo(balances, block), + getAsdCRVInfo(balances, block), getVaultInfo('old', balances, block), getVaultInfo('New', balances, block), getVaultInfo('afxs', balances, block), @@ -126,18 +131,28 @@ async function getAfrxETHInfo(balances, block) { async function getAbcCVXInfo(balances, block) { const totalClevCVXAmount = (await sdk.api.abi.call({ - target: abcCVXAddress, + target: concentratorAbcCVXAddress, block, abi: AladdinCVXABI.totalDebtToken, })).output; const totalCurveLpTokenAmount = (await sdk.api.abi.call({ - target: abcCVXAddress, + target: concentratorAbcCVXAddress, block, abi: AladdinCVXABI.totalCurveLpToken, })).output; sdk.util.sumSingleBalance(balances, clevCVXAddress, totalClevCVXAmount, chain) sdk.util.sumSingleBalance(balances, clevCVXCVXAddress, totalCurveLpTokenAmount, chain) } + +async function getAsdCRVInfo(balances, block) { + const asdCRVTotalUnderlying = (await sdk.api.abi.call({ + target: concentratorAsdCRVAddress, + block, + abi: AladdinSdCRVABI.totalAssets, + })).output; + sdk.util.sumSingleBalance(balances, sdCRVAddress, asdCRVTotalUnderlying, chain) +} + module.exports = { doublecounted: true, ethereum: { From f4fbb6cf8b07b8481fffc43cf7d17f573e2e9299 Mon Sep 17 00:00:00 2001 From: saehrimnir Date: Mon, 8 May 2023 15:39:24 +0300 Subject: [PATCH 0023/1974] fix swop.fi TVL --- projects/swop/index.js | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/projects/swop/index.js b/projects/swop/index.js index a036c598e58..e97e99921c6 100644 --- a/projects/swop/index.js +++ b/projects/swop/index.js @@ -1,5 +1,17 @@ -const { wavesExport } = require('../helper/chain/wavesAdapter') +const { get } = require("../helper/http"); +const { toUSDTBalances } = require("../helper/balances"); -const endpoint = "/swop" +const swopfiBackendEndpoint = "https://backend.swop.fi"; -module.exports = wavesExport("/swop", item => item.totalLocked / 1e6) \ No newline at end of file +const getSwopFiTVL = async () => { + const poolsStats = await get(`${swopfiBackendEndpoint}/pools`); + return toUSDTBalances(poolsStats.overall.liquidity); +} + +module.exports = { + timetravel: false, // Waves blockchain, + methodology: "Counts the tokens locked on AMM pools", + waves: { + tvl: getSwopFiTVL, + } +}; From 5ad1083255e8340ce9636967404cc030db8d72d5 Mon Sep 17 00:00:00 2001 From: buchaoqun Date: Wed, 10 May 2023 17:22:33 +0800 Subject: [PATCH 0024/1974] solv-protocal update v2 add v3 --- package-lock.json | 14684 +++++++++++++++++++++--------- package.json | 1 + projects/solv-protocol/abi.json | 123 + projects/solv-protocol/index.js | 179 +- 4 files changed, 10434 insertions(+), 4553 deletions(-) create mode 100644 projects/solv-protocol/abi.json diff --git a/package-lock.json b/package-lock.json index 85c849c00ab..75b459f4bf5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -24,6 +24,7 @@ "borsh": "^0.7.0", "dotenv": "^8.6.0", "ethers": "^5.6.5", + "graphql": "^16.6.0", "graphql-request": "^4.0.0", "hi-base32": "^0.5.1", "js-sha512": "^0.8.0", @@ -39,2427 +40,6151 @@ "ts-node": "^10.8.1" } }, - "node_modules/@babel/code-frame": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.18.6.tgz", - "integrity": "sha512-TDCmlK5eOvH+eH7cdAFlNXeVJqWIQ7gW9tY1GJIpUtFb6CmjVyq2VM3u71bOyR8CRihcCgMUYoDNyLXao3+70Q==", - "peer": true, + "node_modules/@aws-crypto/crc32": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@aws-crypto/crc32/-/crc32-3.0.0.tgz", + "integrity": "sha512-IzSgsrxUcsrejQbPVilIKy16kAT52EwB6zSaI+M3xxIhKh5+aldEyvI+z6erM7TCLB2BJsFrtHjp6/4/sr+3dA==", + "license": "Apache-2.0", "dependencies": { - "@babel/highlight": "^7.18.6" + "@aws-crypto/util": "^3.0.0", + "@aws-sdk/types": "^3.222.0", + "tslib": "^1.11.1" + } + }, + "node_modules/@aws-crypto/crc32/node_modules/tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", + "license": "0BSD" + }, + "node_modules/@aws-crypto/crc32c": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@aws-crypto/crc32c/-/crc32c-3.0.0.tgz", + "integrity": "sha512-ENNPPManmnVJ4BTXlOjAgD7URidbAznURqD0KvfREyc4o20DPYdEldU1f5cQ7Jbj0CJJSPaMIk/9ZshdB3210w==", + "license": "Apache-2.0", + "dependencies": { + "@aws-crypto/util": "^3.0.0", + "@aws-sdk/types": "^3.222.0", + "tslib": "^1.11.1" + } + }, + "node_modules/@aws-crypto/crc32c/node_modules/tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", + "license": "0BSD" + }, + "node_modules/@aws-crypto/ie11-detection": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@aws-crypto/ie11-detection/-/ie11-detection-3.0.0.tgz", + "integrity": "sha512-341lBBkiY1DfDNKai/wXM3aujNBkXR7tq1URPQDL9wi3AUbI80NR74uF1TXHMm7po1AcnFk8iu2S2IeU/+/A+Q==", + "license": "Apache-2.0", + "dependencies": { + "tslib": "^1.11.1" + } + }, + "node_modules/@aws-crypto/ie11-detection/node_modules/tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", + "license": "0BSD" + }, + "node_modules/@aws-crypto/sha1-browser": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@aws-crypto/sha1-browser/-/sha1-browser-3.0.0.tgz", + "integrity": "sha512-NJth5c997GLHs6nOYTzFKTbYdMNA6/1XlKVgnZoaZcQ7z7UJlOgj2JdbHE8tiYLS3fzXNCguct77SPGat2raSw==", + "license": "Apache-2.0", + "dependencies": { + "@aws-crypto/ie11-detection": "^3.0.0", + "@aws-crypto/supports-web-crypto": "^3.0.0", + "@aws-crypto/util": "^3.0.0", + "@aws-sdk/types": "^3.222.0", + "@aws-sdk/util-locate-window": "^3.0.0", + "@aws-sdk/util-utf8-browser": "^3.0.0", + "tslib": "^1.11.1" + } + }, + "node_modules/@aws-crypto/sha1-browser/node_modules/tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", + "license": "0BSD" + }, + "node_modules/@aws-crypto/sha256-browser": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@aws-crypto/sha256-browser/-/sha256-browser-3.0.0.tgz", + "integrity": "sha512-8VLmW2B+gjFbU5uMeqtQM6Nj0/F1bro80xQXCW6CQBWgosFWXTx77aeOF5CAIAmbOK64SdMBJdNr6J41yP5mvQ==", + "license": "Apache-2.0", + "dependencies": { + "@aws-crypto/ie11-detection": "^3.0.0", + "@aws-crypto/sha256-js": "^3.0.0", + "@aws-crypto/supports-web-crypto": "^3.0.0", + "@aws-crypto/util": "^3.0.0", + "@aws-sdk/types": "^3.222.0", + "@aws-sdk/util-locate-window": "^3.0.0", + "@aws-sdk/util-utf8-browser": "^3.0.0", + "tslib": "^1.11.1" + } + }, + "node_modules/@aws-crypto/sha256-browser/node_modules/tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", + "license": "0BSD" + }, + "node_modules/@aws-crypto/sha256-js": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@aws-crypto/sha256-js/-/sha256-js-3.0.0.tgz", + "integrity": "sha512-PnNN7os0+yd1XvXAy23CFOmTbMaDxgxXtTKHybrJ39Y8kGzBATgBFibWJKH6BhytLI/Zyszs87xCOBNyBig6vQ==", + "license": "Apache-2.0", + "dependencies": { + "@aws-crypto/util": "^3.0.0", + "@aws-sdk/types": "^3.222.0", + "tslib": "^1.11.1" + } + }, + "node_modules/@aws-crypto/sha256-js/node_modules/tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", + "license": "0BSD" + }, + "node_modules/@aws-crypto/supports-web-crypto": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@aws-crypto/supports-web-crypto/-/supports-web-crypto-3.0.0.tgz", + "integrity": "sha512-06hBdMwUAb2WFTuGG73LSC0wfPu93xWwo5vL2et9eymgmu3Id5vFAHBbajVWiGhPO37qcsdCap/FqXvJGJWPIg==", + "license": "Apache-2.0", + "dependencies": { + "tslib": "^1.11.1" + } + }, + "node_modules/@aws-crypto/supports-web-crypto/node_modules/tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", + "license": "0BSD" + }, + "node_modules/@aws-crypto/util": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@aws-crypto/util/-/util-3.0.0.tgz", + "integrity": "sha512-2OJlpeJpCR48CC8r+uKVChzs9Iungj9wkZrl8Z041DWEWvyIHILYKCPNzJghKsivj+S3mLo6BVc7mBNzdxA46w==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/types": "^3.222.0", + "@aws-sdk/util-utf8-browser": "^3.0.0", + "tslib": "^1.11.1" + } + }, + "node_modules/@aws-crypto/util/node_modules/tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", + "license": "0BSD" + }, + "node_modules/@aws-sdk/abort-controller": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/abort-controller/-/abort-controller-3.310.0.tgz", + "integrity": "sha512-v1zrRQxDLA1MdPim159Vx/CPHqsB4uybSxRi1CnfHO5ZjHryx3a5htW2gdGAykVCul40+yJXvfpufMrELVxH+g==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/types": "3.310.0", + "tslib": "^2.5.0" }, "engines": { - "node": ">=6.9.0" + "node": ">=14.0.0" } }, - "node_modules/@babel/helper-validator-identifier": { - "version": "7.19.1", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.19.1.tgz", - "integrity": "sha512-awrNfaMtnHUr653GgGEs++LlAvW6w+DcPrOliSMXWCKo597CwL5Acf/wWdNkf/tfEQE3mjkeD1YOVZOUV/od1w==", - "peer": true, + "node_modules/@aws-sdk/chunked-blob-reader": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/chunked-blob-reader/-/chunked-blob-reader-3.310.0.tgz", + "integrity": "sha512-CrJS3exo4mWaLnWxfCH+w88Ou0IcAZSIkk4QbmxiHl/5Dq705OLoxf4385MVyExpqpeVJYOYQ2WaD8i/pQZ2fg==", + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.5.0" + } + }, + "node_modules/@aws-sdk/client-s3": { + "version": "3.328.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-s3/-/client-s3-3.328.0.tgz", + "integrity": "sha512-jYHukdhiICj8aiCg3DqjIeKkZs1xOmwXta/kjCbHQlaF17Rl43VLI3nT4rzXB6ixtqUW3I7Wvx61F9S+EOVl3A==", + "license": "Apache-2.0", + "dependencies": { + "@aws-crypto/sha1-browser": "3.0.0", + "@aws-crypto/sha256-browser": "3.0.0", + "@aws-crypto/sha256-js": "3.0.0", + "@aws-sdk/client-sts": "3.328.0", + "@aws-sdk/config-resolver": "3.310.0", + "@aws-sdk/credential-provider-node": "3.328.0", + "@aws-sdk/eventstream-serde-browser": "3.310.0", + "@aws-sdk/eventstream-serde-config-resolver": "3.310.0", + "@aws-sdk/eventstream-serde-node": "3.310.0", + "@aws-sdk/fetch-http-handler": "3.310.0", + "@aws-sdk/hash-blob-browser": "3.310.0", + "@aws-sdk/hash-node": "3.310.0", + "@aws-sdk/hash-stream-node": "3.310.0", + "@aws-sdk/invalid-dependency": "3.310.0", + "@aws-sdk/md5-js": "3.310.0", + "@aws-sdk/middleware-bucket-endpoint": "3.310.0", + "@aws-sdk/middleware-content-length": "3.325.0", + "@aws-sdk/middleware-endpoint": "3.325.0", + "@aws-sdk/middleware-expect-continue": "3.325.0", + "@aws-sdk/middleware-flexible-checksums": "3.326.0", + "@aws-sdk/middleware-host-header": "3.325.0", + "@aws-sdk/middleware-location-constraint": "3.325.0", + "@aws-sdk/middleware-logger": "3.325.0", + "@aws-sdk/middleware-recursion-detection": "3.325.0", + "@aws-sdk/middleware-retry": "3.327.0", + "@aws-sdk/middleware-sdk-s3": "3.326.0", + "@aws-sdk/middleware-serde": "3.325.0", + "@aws-sdk/middleware-signing": "3.325.0", + "@aws-sdk/middleware-ssec": "3.325.0", + "@aws-sdk/middleware-stack": "3.325.0", + "@aws-sdk/middleware-user-agent": "3.327.0", + "@aws-sdk/node-config-provider": "3.310.0", + "@aws-sdk/node-http-handler": "3.328.0", + "@aws-sdk/protocol-http": "3.310.0", + "@aws-sdk/signature-v4-multi-region": "3.310.0", + "@aws-sdk/smithy-client": "3.325.0", + "@aws-sdk/types": "3.310.0", + "@aws-sdk/url-parser": "3.310.0", + "@aws-sdk/util-base64": "3.310.0", + "@aws-sdk/util-body-length-browser": "3.310.0", + "@aws-sdk/util-body-length-node": "3.310.0", + "@aws-sdk/util-defaults-mode-browser": "3.325.0", + "@aws-sdk/util-defaults-mode-node": "3.325.0", + "@aws-sdk/util-endpoints": "3.327.0", + "@aws-sdk/util-retry": "3.327.0", + "@aws-sdk/util-stream-browser": "3.310.0", + "@aws-sdk/util-stream-node": "3.328.0", + "@aws-sdk/util-user-agent-browser": "3.310.0", + "@aws-sdk/util-user-agent-node": "3.310.0", + "@aws-sdk/util-utf8": "3.310.0", + "@aws-sdk/util-waiter": "3.310.0", + "@aws-sdk/xml-builder": "3.310.0", + "fast-xml-parser": "4.1.2", + "tslib": "^2.5.0" + }, "engines": { - "node": ">=6.9.0" + "node": ">=14.0.0" } }, - "node_modules/@babel/highlight": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.18.6.tgz", - "integrity": "sha512-u7stbOuYjaPezCuLj29hNW1v64M2Md2qupEKP1fHc7WdOA3DgLh37suiSrZYY7haUB7iBeQZ9P1uiRF359do3g==", - "peer": true, - "dependencies": { - "@babel/helper-validator-identifier": "^7.18.6", - "chalk": "^2.0.0", - "js-tokens": "^4.0.0" + "node_modules/@aws-sdk/client-sso": { + "version": "3.328.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-sso/-/client-sso-3.328.0.tgz", + "integrity": "sha512-IneVwc4j3bCXwCdNAALQ8VVrfFTFAb2f3FxerHv4DLx8OlMTvZiraDDJisfO+cXLl2WCJOJAzpAJTgrPA50LCg==", + "license": "Apache-2.0", + "dependencies": { + "@aws-crypto/sha256-browser": "3.0.0", + "@aws-crypto/sha256-js": "3.0.0", + "@aws-sdk/config-resolver": "3.310.0", + "@aws-sdk/fetch-http-handler": "3.310.0", + "@aws-sdk/hash-node": "3.310.0", + "@aws-sdk/invalid-dependency": "3.310.0", + "@aws-sdk/middleware-content-length": "3.325.0", + "@aws-sdk/middleware-endpoint": "3.325.0", + "@aws-sdk/middleware-host-header": "3.325.0", + "@aws-sdk/middleware-logger": "3.325.0", + "@aws-sdk/middleware-recursion-detection": "3.325.0", + "@aws-sdk/middleware-retry": "3.327.0", + "@aws-sdk/middleware-serde": "3.325.0", + "@aws-sdk/middleware-stack": "3.325.0", + "@aws-sdk/middleware-user-agent": "3.327.0", + "@aws-sdk/node-config-provider": "3.310.0", + "@aws-sdk/node-http-handler": "3.328.0", + "@aws-sdk/protocol-http": "3.310.0", + "@aws-sdk/smithy-client": "3.325.0", + "@aws-sdk/types": "3.310.0", + "@aws-sdk/url-parser": "3.310.0", + "@aws-sdk/util-base64": "3.310.0", + "@aws-sdk/util-body-length-browser": "3.310.0", + "@aws-sdk/util-body-length-node": "3.310.0", + "@aws-sdk/util-defaults-mode-browser": "3.325.0", + "@aws-sdk/util-defaults-mode-node": "3.325.0", + "@aws-sdk/util-endpoints": "3.327.0", + "@aws-sdk/util-retry": "3.327.0", + "@aws-sdk/util-user-agent-browser": "3.310.0", + "@aws-sdk/util-user-agent-node": "3.310.0", + "@aws-sdk/util-utf8": "3.310.0", + "tslib": "^2.5.0" }, "engines": { - "node": ">=6.9.0" + "node": ">=14.0.0" } }, - "node_modules/@babel/highlight/node_modules/ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "peer": true, - "dependencies": { - "color-convert": "^1.9.0" + "node_modules/@aws-sdk/client-sso-oidc": { + "version": "3.328.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-sso-oidc/-/client-sso-oidc-3.328.0.tgz", + "integrity": "sha512-2T6Snri7ovx9+q/iw/wZ1YHzz/SsxPuJOhgbJipCFW9f1IEPBIEKVZtywcKYzE1nYjyc6YanAqQMn6U2SPhW4A==", + "license": "Apache-2.0", + "dependencies": { + "@aws-crypto/sha256-browser": "3.0.0", + "@aws-crypto/sha256-js": "3.0.0", + "@aws-sdk/config-resolver": "3.310.0", + "@aws-sdk/fetch-http-handler": "3.310.0", + "@aws-sdk/hash-node": "3.310.0", + "@aws-sdk/invalid-dependency": "3.310.0", + "@aws-sdk/middleware-content-length": "3.325.0", + "@aws-sdk/middleware-endpoint": "3.325.0", + "@aws-sdk/middleware-host-header": "3.325.0", + "@aws-sdk/middleware-logger": "3.325.0", + "@aws-sdk/middleware-recursion-detection": "3.325.0", + "@aws-sdk/middleware-retry": "3.327.0", + "@aws-sdk/middleware-serde": "3.325.0", + "@aws-sdk/middleware-stack": "3.325.0", + "@aws-sdk/middleware-user-agent": "3.327.0", + "@aws-sdk/node-config-provider": "3.310.0", + "@aws-sdk/node-http-handler": "3.328.0", + "@aws-sdk/protocol-http": "3.310.0", + "@aws-sdk/smithy-client": "3.325.0", + "@aws-sdk/types": "3.310.0", + "@aws-sdk/url-parser": "3.310.0", + "@aws-sdk/util-base64": "3.310.0", + "@aws-sdk/util-body-length-browser": "3.310.0", + "@aws-sdk/util-body-length-node": "3.310.0", + "@aws-sdk/util-defaults-mode-browser": "3.325.0", + "@aws-sdk/util-defaults-mode-node": "3.325.0", + "@aws-sdk/util-endpoints": "3.327.0", + "@aws-sdk/util-retry": "3.327.0", + "@aws-sdk/util-user-agent-browser": "3.310.0", + "@aws-sdk/util-user-agent-node": "3.310.0", + "@aws-sdk/util-utf8": "3.310.0", + "tslib": "^2.5.0" }, "engines": { - "node": ">=4" + "node": ">=14.0.0" } }, - "node_modules/@babel/highlight/node_modules/chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "peer": true, + "node_modules/@aws-sdk/client-sts": { + "version": "3.328.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-sts/-/client-sts-3.328.0.tgz", + "integrity": "sha512-Eedz24H7zLuTjJoCtNQEGOKbIlhibqyasFFwWsds6ds24hRF4fVrCKLwZWENZwawtJjjEdRESQe4dwpV5lWqtw==", + "license": "Apache-2.0", + "dependencies": { + "@aws-crypto/sha256-browser": "3.0.0", + "@aws-crypto/sha256-js": "3.0.0", + "@aws-sdk/config-resolver": "3.310.0", + "@aws-sdk/credential-provider-node": "3.328.0", + "@aws-sdk/fetch-http-handler": "3.310.0", + "@aws-sdk/hash-node": "3.310.0", + "@aws-sdk/invalid-dependency": "3.310.0", + "@aws-sdk/middleware-content-length": "3.325.0", + "@aws-sdk/middleware-endpoint": "3.325.0", + "@aws-sdk/middleware-host-header": "3.325.0", + "@aws-sdk/middleware-logger": "3.325.0", + "@aws-sdk/middleware-recursion-detection": "3.325.0", + "@aws-sdk/middleware-retry": "3.327.0", + "@aws-sdk/middleware-sdk-sts": "3.326.0", + "@aws-sdk/middleware-serde": "3.325.0", + "@aws-sdk/middleware-signing": "3.325.0", + "@aws-sdk/middleware-stack": "3.325.0", + "@aws-sdk/middleware-user-agent": "3.327.0", + "@aws-sdk/node-config-provider": "3.310.0", + "@aws-sdk/node-http-handler": "3.328.0", + "@aws-sdk/protocol-http": "3.310.0", + "@aws-sdk/smithy-client": "3.325.0", + "@aws-sdk/types": "3.310.0", + "@aws-sdk/url-parser": "3.310.0", + "@aws-sdk/util-base64": "3.310.0", + "@aws-sdk/util-body-length-browser": "3.310.0", + "@aws-sdk/util-body-length-node": "3.310.0", + "@aws-sdk/util-defaults-mode-browser": "3.325.0", + "@aws-sdk/util-defaults-mode-node": "3.325.0", + "@aws-sdk/util-endpoints": "3.327.0", + "@aws-sdk/util-retry": "3.327.0", + "@aws-sdk/util-user-agent-browser": "3.310.0", + "@aws-sdk/util-user-agent-node": "3.310.0", + "@aws-sdk/util-utf8": "3.310.0", + "fast-xml-parser": "4.1.2", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@aws-sdk/config-resolver": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/config-resolver/-/config-resolver-3.310.0.tgz", + "integrity": "sha512-8vsT+/50lOqfDxka9m/rRt6oxv1WuGZoP8oPMk0Dt+TxXMbAzf4+rejBgiB96wshI1k3gLokYRjSQZn+dDtT8g==", + "license": "Apache-2.0", "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" + "@aws-sdk/types": "3.310.0", + "@aws-sdk/util-config-provider": "3.310.0", + "@aws-sdk/util-middleware": "3.310.0", + "tslib": "^2.5.0" }, "engines": { - "node": ">=4" + "node": ">=14.0.0" } }, - "node_modules/@babel/highlight/node_modules/color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "peer": true, + "node_modules/@aws-sdk/credential-provider-env": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-env/-/credential-provider-env-3.310.0.tgz", + "integrity": "sha512-vvIPQpI16fj95xwS7M3D48F7QhZJBnnCgB5lR+b7So+vsG9ibm1mZRVGzVpdxCvgyOhHFbvrby9aalNJmmIP1A==", + "license": "Apache-2.0", "dependencies": { - "color-name": "1.1.3" + "@aws-sdk/property-provider": "3.310.0", + "@aws-sdk/types": "3.310.0", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" } }, - "node_modules/@babel/highlight/node_modules/color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", - "peer": true + "node_modules/@aws-sdk/credential-provider-imds": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-imds/-/credential-provider-imds-3.310.0.tgz", + "integrity": "sha512-baxK7Zp6dai5AGW01FIW27xS2KAaPUmKLIXv5SvFYsUgXXvNW55im4uG3b+2gA0F7V+hXvVBH08OEqmwW6we5w==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/node-config-provider": "3.310.0", + "@aws-sdk/property-provider": "3.310.0", + "@aws-sdk/types": "3.310.0", + "@aws-sdk/url-parser": "3.310.0", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } }, - "node_modules/@babel/highlight/node_modules/escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", - "peer": true, + "node_modules/@aws-sdk/credential-provider-ini": { + "version": "3.328.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-ini/-/credential-provider-ini-3.328.0.tgz", + "integrity": "sha512-tOHzfWQUaQif1IciWs57MFM7bFc+693pnEhFCgT3wjzwjKGkq1QsNzfRlOp1QP4Glw6qV+kAAemEZj8mGth8Bg==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/credential-provider-env": "3.310.0", + "@aws-sdk/credential-provider-imds": "3.310.0", + "@aws-sdk/credential-provider-process": "3.310.0", + "@aws-sdk/credential-provider-sso": "3.328.0", + "@aws-sdk/credential-provider-web-identity": "3.310.0", + "@aws-sdk/property-provider": "3.310.0", + "@aws-sdk/shared-ini-file-loader": "3.310.0", + "@aws-sdk/types": "3.310.0", + "tslib": "^2.5.0" + }, "engines": { - "node": ">=0.8.0" + "node": ">=14.0.0" } }, - "node_modules/@babel/highlight/node_modules/has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", - "peer": true, + "node_modules/@aws-sdk/credential-provider-node": { + "version": "3.328.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-node/-/credential-provider-node-3.328.0.tgz", + "integrity": "sha512-/omjTxrC8Vv6OPAK+66KNnjVmMZWyEQnQp8e8Y+RZvsuVaeQNJT5UQKSqrYtmqTX2T+yqJY7eVpx5CXBCGjc2g==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/credential-provider-env": "3.310.0", + "@aws-sdk/credential-provider-imds": "3.310.0", + "@aws-sdk/credential-provider-ini": "3.328.0", + "@aws-sdk/credential-provider-process": "3.310.0", + "@aws-sdk/credential-provider-sso": "3.328.0", + "@aws-sdk/credential-provider-web-identity": "3.310.0", + "@aws-sdk/property-provider": "3.310.0", + "@aws-sdk/shared-ini-file-loader": "3.310.0", + "@aws-sdk/types": "3.310.0", + "tslib": "^2.5.0" + }, "engines": { - "node": ">=4" + "node": ">=14.0.0" } }, - "node_modules/@babel/highlight/node_modules/supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "peer": true, + "node_modules/@aws-sdk/credential-provider-process": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-process/-/credential-provider-process-3.310.0.tgz", + "integrity": "sha512-h73sg6GPMUWC+3zMCbA1nZ2O03nNJt7G96JdmnantiXBwHpRKWW8nBTLzx5uhXn6hTuTaoQRP/P+oxQJKYdMmA==", + "license": "Apache-2.0", "dependencies": { - "has-flag": "^3.0.0" + "@aws-sdk/property-provider": "3.310.0", + "@aws-sdk/shared-ini-file-loader": "3.310.0", + "@aws-sdk/types": "3.310.0", + "tslib": "^2.5.0" }, "engines": { - "node": ">=4" + "node": ">=14.0.0" } }, - "node_modules/@babel/runtime": { - "version": "7.20.7", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.20.7.tgz", - "integrity": "sha512-UF0tvkUtxwAgZ5W/KrkHf0Rn0fdnLDU9ScxBrEVNUprE/MzirjK4MJUX1/BVDv00Sv8cljtukVK1aky++X1SjQ==", + "node_modules/@aws-sdk/credential-provider-sso": { + "version": "3.328.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-sso/-/credential-provider-sso-3.328.0.tgz", + "integrity": "sha512-6lSfA3AcoqNt+OYJoBimWmPmqUYVCHkE0Y+4HFN7JaXCyUknsO9/71P5zo/pp8Q7/yxP/aRyzjael82G5thj0A==", + "license": "Apache-2.0", "dependencies": { - "regenerator-runtime": "^0.13.11" + "@aws-sdk/client-sso": "3.328.0", + "@aws-sdk/property-provider": "3.310.0", + "@aws-sdk/shared-ini-file-loader": "3.310.0", + "@aws-sdk/token-providers": "3.328.0", + "@aws-sdk/types": "3.310.0", + "tslib": "^2.5.0" }, "engines": { - "node": ">=6.9.0" + "node": ">=14.0.0" } }, - "node_modules/@cspotcode/source-map-support": { - "version": "0.8.1", - "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", - "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", - "dev": true, + "node_modules/@aws-sdk/credential-provider-web-identity": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-web-identity/-/credential-provider-web-identity-3.310.0.tgz", + "integrity": "sha512-H4SzuZXILNhK6/IR1uVvsUDZvzc051hem7GLyYghBCu8mU+tq28YhKE8MfSroi6eL2e5Vujloij1OM2EQQkPkw==", + "license": "Apache-2.0", "dependencies": { - "@jridgewell/trace-mapping": "0.3.9" + "@aws-sdk/property-provider": "3.310.0", + "@aws-sdk/types": "3.310.0", + "tslib": "^2.5.0" }, "engines": { - "node": ">=12" + "node": ">=14.0.0" } }, - "node_modules/@defillama/sdk": { - "version": "4.0.10", - "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.10.tgz", - "integrity": "sha512-d+xTcUvuar3WVSmouJdsVGkGjZc44/tW/REQCjSKn0wplB0ugEjGWdZ/LbbxpCbqRiifwkp2IoFrf1DpNVjuyQ==", + "node_modules/@aws-sdk/eventstream-codec": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/eventstream-codec/-/eventstream-codec-3.310.0.tgz", + "integrity": "sha512-clIeSgWbZbxwtsxZ/yoedNM0/kJFSIjjHPikuDGhxhqc+vP6TN3oYyVMFrYwFaTFhk2+S5wZcWYMw8Op1pWo+A==", + "license": "Apache-2.0", "dependencies": { - "@supercharge/promise-pool": "^2.1.0", - "ethers": "^5.4.5", - "node-fetch": "^2.6.7" + "@aws-crypto/crc32": "3.0.0", + "@aws-sdk/types": "3.310.0", + "@aws-sdk/util-hex-encoding": "3.310.0", + "tslib": "^2.5.0" } }, - "node_modules/@eslint/eslintrc": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.4.1.tgz", - "integrity": "sha512-XXrH9Uarn0stsyldqDYq8r++mROmWRI1xKMXa640Bb//SY1+ECYX6VzT6Lcx5frD0V30XieqJ0oX9I2Xj5aoMA==", - "dev": true, + "node_modules/@aws-sdk/eventstream-serde-browser": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/eventstream-serde-browser/-/eventstream-serde-browser-3.310.0.tgz", + "integrity": "sha512-3S6ziuQVALgEyz0TANGtYDVeG8ArK4Y05mcgrs8qUTmsvlDIXX37cR/DvmVbNB76M4IrsZeSAIajL9644CywkA==", + "license": "Apache-2.0", "dependencies": { - "ajv": "^6.12.4", - "debug": "^4.3.2", - "espree": "^9.4.0", - "globals": "^13.19.0", - "ignore": "^5.2.0", - "import-fresh": "^3.2.1", - "js-yaml": "^4.1.0", - "minimatch": "^3.1.2", - "strip-json-comments": "^3.1.1" + "@aws-sdk/eventstream-serde-universal": "3.310.0", + "@aws-sdk/types": "3.310.0", + "tslib": "^2.5.0" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": ">=14.0.0" + } + }, + "node_modules/@aws-sdk/eventstream-serde-config-resolver": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/eventstream-serde-config-resolver/-/eventstream-serde-config-resolver-3.310.0.tgz", + "integrity": "sha512-8s1Qdn9STj+sV75nUp9yt0W6fHS4BZ2jTm4Z/1Pcbvh2Gqs0WjH5n2StS+pDW5Y9J/HSGBl0ogmUr5lC5bXFHg==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/types": "3.310.0", + "tslib": "^2.5.0" }, - "funding": { - "url": "https://opencollective.com/eslint" + "engines": { + "node": ">=14.0.0" } }, - "node_modules/@ethersproject/abi": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/abi/-/abi-5.7.0.tgz", - "integrity": "sha512-351ktp42TiRcYB3H1OP8yajPeAQstMW/yCFokj/AthP9bLHzQFPlOrxOcwYEDkUAICmOHljvN4K39OMTMUa9RA==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], + "node_modules/@aws-sdk/eventstream-serde-node": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/eventstream-serde-node/-/eventstream-serde-node-3.310.0.tgz", + "integrity": "sha512-kSnRomCgW43K9TmQYuwN9+AoYPnhyOKroanUMyZEzJk7rpCPMj4OzaUpXfDYOvznFNYn7NLaH6nHLJAr0VPlJA==", + "license": "Apache-2.0", "dependencies": { - "@ethersproject/address": "^5.7.0", - "@ethersproject/bignumber": "^5.7.0", - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/constants": "^5.7.0", - "@ethersproject/hash": "^5.7.0", - "@ethersproject/keccak256": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/properties": "^5.7.0", - "@ethersproject/strings": "^5.7.0" + "@aws-sdk/eventstream-serde-universal": "3.310.0", + "@aws-sdk/types": "3.310.0", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" } }, - "node_modules/@ethersproject/abstract-provider": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/abstract-provider/-/abstract-provider-5.7.0.tgz", - "integrity": "sha512-R41c9UkchKCpAqStMYUpdunjo3pkEvZC3FAwZn5S5MGbXoMQOHIdHItezTETxAO5bevtMApSyEhn9+CHcDsWBw==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], + "node_modules/@aws-sdk/eventstream-serde-universal": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/eventstream-serde-universal/-/eventstream-serde-universal-3.310.0.tgz", + "integrity": "sha512-Qyjt5k/waV5cDukpgT824ISZAz5U0pwzLz5ztR409u85AGNkF/9n7MS+LSyBUBSb0WJ5pUeSD47WBk+nLq9Nhw==", + "license": "Apache-2.0", "dependencies": { - "@ethersproject/bignumber": "^5.7.0", - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/networks": "^5.7.0", - "@ethersproject/properties": "^5.7.0", - "@ethersproject/transactions": "^5.7.0", - "@ethersproject/web": "^5.7.0" + "@aws-sdk/eventstream-codec": "3.310.0", + "@aws-sdk/types": "3.310.0", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" } }, - "node_modules/@ethersproject/abstract-signer": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/abstract-signer/-/abstract-signer-5.7.0.tgz", - "integrity": "sha512-a16V8bq1/Cz+TGCkE2OPMTOUDLS3grCpdjoJCYNnVBbdYEMSgKrU0+B90s8b6H+ByYTBZN7a3g76jdIJi7UfKQ==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], + "node_modules/@aws-sdk/fetch-http-handler": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/fetch-http-handler/-/fetch-http-handler-3.310.0.tgz", + "integrity": "sha512-Bi9vIwzdkw1zMcvi/zGzlWS9KfIEnAq4NNhsnCxbQ4OoIRU9wvU+WGZdBBhxg0ZxZmpp1j1aZhU53lLjA07MHw==", + "license": "Apache-2.0", "dependencies": { - "@ethersproject/abstract-provider": "^5.7.0", - "@ethersproject/bignumber": "^5.7.0", - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/properties": "^5.7.0" + "@aws-sdk/protocol-http": "3.310.0", + "@aws-sdk/querystring-builder": "3.310.0", + "@aws-sdk/types": "3.310.0", + "@aws-sdk/util-base64": "3.310.0", + "tslib": "^2.5.0" } }, - "node_modules/@ethersproject/address": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/address/-/address-5.7.0.tgz", - "integrity": "sha512-9wYhYt7aghVGo758POM5nqcOMaE168Q6aRLJZwUmiqSrAungkG74gSSeKEIR7ukixesdRZGPgVqme6vmxs1fkA==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], + "node_modules/@aws-sdk/hash-blob-browser": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/hash-blob-browser/-/hash-blob-browser-3.310.0.tgz", + "integrity": "sha512-OoR8p0cbypToysLT0v3o2oyjy6+DKrY7GNCAzHOHJK9xmqXCt+DsjKoPeiY7o1sWX2aN6Plmvubj/zWxMKEn/A==", + "license": "Apache-2.0", "dependencies": { - "@ethersproject/bignumber": "^5.7.0", - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/keccak256": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/rlp": "^5.7.0" + "@aws-sdk/chunked-blob-reader": "3.310.0", + "@aws-sdk/types": "3.310.0", + "tslib": "^2.5.0" } }, - "node_modules/@ethersproject/base64": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/base64/-/base64-5.7.0.tgz", - "integrity": "sha512-Dr8tcHt2mEbsZr/mwTPIQAf3Ai0Bks/7gTw9dSqk1mQvhW3XvRlmDJr/4n+wg1JmCl16NZue17CDh8xb/vZ0sQ==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], + "node_modules/@aws-sdk/hash-node": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/hash-node/-/hash-node-3.310.0.tgz", + "integrity": "sha512-NvE2fhRc8GRwCXBfDehxVAWCmVwVMILliAKVPAEr4yz2CkYs0tqU51S48x23dtna07H4qHtgpeNqVTthcIQOEQ==", + "license": "Apache-2.0", "dependencies": { - "@ethersproject/bytes": "^5.7.0" + "@aws-sdk/types": "3.310.0", + "@aws-sdk/util-buffer-from": "3.310.0", + "@aws-sdk/util-utf8": "3.310.0", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" } }, - "node_modules/@ethersproject/basex": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/basex/-/basex-5.7.0.tgz", - "integrity": "sha512-ywlh43GwZLv2Voc2gQVTKBoVQ1mti3d8HK5aMxsfu/nRDnMmNqaSJ3r3n85HBByT8OpoY96SXM1FogC533T4zw==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], + "node_modules/@aws-sdk/hash-stream-node": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/hash-stream-node/-/hash-stream-node-3.310.0.tgz", + "integrity": "sha512-ZoXdybNgvMz1Hl6k/e32xVL3jmG5p2IEk5mTtLfFEuskTJ74Z+VMYKkkF1whyy7KQfH83H+TQGnsGtlRCchQKw==", + "license": "Apache-2.0", "dependencies": { - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/properties": "^5.7.0" + "@aws-sdk/types": "3.310.0", + "@aws-sdk/util-utf8": "3.310.0", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" } }, - "node_modules/@ethersproject/bignumber": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/bignumber/-/bignumber-5.7.0.tgz", - "integrity": "sha512-n1CAdIHRWjSucQO3MC1zPSVgV/6dy/fjL9pMrPP9peL+QxEg9wOsVqwD4+818B6LUEtaXzVHQiuivzRoxPxUGw==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], + "node_modules/@aws-sdk/invalid-dependency": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/invalid-dependency/-/invalid-dependency-3.310.0.tgz", + "integrity": "sha512-1s5RG5rSPXoa/aZ/Kqr5U/7lqpx+Ry81GprQ2bxWqJvWQIJ0IRUwo5pk8XFxbKVr/2a+4lZT/c3OGoBOM1yRRA==", + "license": "Apache-2.0", "dependencies": { - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "bn.js": "^5.2.1" + "@aws-sdk/types": "3.310.0", + "tslib": "^2.5.0" } }, - "node_modules/@ethersproject/bytes": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/bytes/-/bytes-5.7.0.tgz", - "integrity": "sha512-nsbxwgFXWh9NyYWo+U8atvmMsSdKJprTcICAkvbBffT75qDocbuggBU0SJiVK2MuTrp0q+xvLkTnGMPK1+uA9A==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], + "node_modules/@aws-sdk/is-array-buffer": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/is-array-buffer/-/is-array-buffer-3.310.0.tgz", + "integrity": "sha512-urnbcCR+h9NWUnmOtet/s4ghvzsidFmspfhYaHAmSRdy9yDjdjBJMFjjsn85A1ODUktztm+cVncXjQ38WCMjMQ==", + "license": "Apache-2.0", "dependencies": { - "@ethersproject/logger": "^5.7.0" + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" } }, - "node_modules/@ethersproject/constants": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/constants/-/constants-5.7.0.tgz", - "integrity": "sha512-DHI+y5dBNvkpYUMiRQyxRBYBefZkJfo70VUkUAsRjcPs47muV9evftfZ0PJVCXYbAiCgght0DtcF9srFQmIgWA==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], + "node_modules/@aws-sdk/md5-js": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/md5-js/-/md5-js-3.310.0.tgz", + "integrity": "sha512-x5sRBUrEfLWAS1EhwbbDQ7cXq6uvBxh3qR2XAsnGvFFceTeAadk7cVogWxlk3PC+OCeeym7c3/6Bv2HQ2f1YyQ==", + "license": "Apache-2.0", "dependencies": { - "@ethersproject/bignumber": "^5.7.0" + "@aws-sdk/types": "3.310.0", + "@aws-sdk/util-utf8": "3.310.0", + "tslib": "^2.5.0" } }, - "node_modules/@ethersproject/contracts": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/contracts/-/contracts-5.7.0.tgz", - "integrity": "sha512-5GJbzEU3X+d33CdfPhcyS+z8MzsTrBGk/sc+G+59+tPa9yFkl6HQ9D6L0QMgNTA9q8dT0XKxxkyp883XsQvbbg==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], + "node_modules/@aws-sdk/middleware-bucket-endpoint": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-bucket-endpoint/-/middleware-bucket-endpoint-3.310.0.tgz", + "integrity": "sha512-uJJfHI7v4AgbJZRLtyI8ap2QRWkBokGc3iyUoQ+dVNT3/CE2ZCu694A6W+H0dRqg79dIE+f9CRNdtLGa/Ehhvg==", + "license": "Apache-2.0", "dependencies": { - "@ethersproject/abi": "^5.7.0", - "@ethersproject/abstract-provider": "^5.7.0", - "@ethersproject/abstract-signer": "^5.7.0", - "@ethersproject/address": "^5.7.0", - "@ethersproject/bignumber": "^5.7.0", - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/constants": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/properties": "^5.7.0", - "@ethersproject/transactions": "^5.7.0" + "@aws-sdk/protocol-http": "3.310.0", + "@aws-sdk/types": "3.310.0", + "@aws-sdk/util-arn-parser": "3.310.0", + "@aws-sdk/util-config-provider": "3.310.0", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" } }, - "node_modules/@ethersproject/hash": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/hash/-/hash-5.7.0.tgz", - "integrity": "sha512-qX5WrQfnah1EFnO5zJv1v46a8HW0+E5xuBBDTwMFZLuVTx0tbU2kkx15NqdjxecrLGatQN9FGQKpb1FKdHCt+g==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], + "node_modules/@aws-sdk/middleware-content-length": { + "version": "3.325.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-content-length/-/middleware-content-length-3.325.0.tgz", + "integrity": "sha512-t38VBKCpNqSKqSu0OfWMJs7cwaRHFGQxIF9lV8JMCM/2lyUpN4JcfuzSTK+MFN2eDZEHp5DiNg8w07GXXusRYg==", + "license": "Apache-2.0", "dependencies": { - "@ethersproject/abstract-signer": "^5.7.0", - "@ethersproject/address": "^5.7.0", - "@ethersproject/base64": "^5.7.0", - "@ethersproject/bignumber": "^5.7.0", - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/keccak256": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/properties": "^5.7.0", - "@ethersproject/strings": "^5.7.0" + "@aws-sdk/protocol-http": "3.310.0", + "@aws-sdk/types": "3.310.0", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" } }, - "node_modules/@ethersproject/hdnode": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/hdnode/-/hdnode-5.7.0.tgz", - "integrity": "sha512-OmyYo9EENBPPf4ERhR7oj6uAtUAhYGqOnIS+jE5pTXvdKBS99ikzq1E7Iv0ZQZ5V36Lqx1qZLeak0Ra16qpeOg==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], + "node_modules/@aws-sdk/middleware-endpoint": { + "version": "3.325.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-endpoint/-/middleware-endpoint-3.325.0.tgz", + "integrity": "sha512-3CavuOHCKiWUnCtzrUFbhbEP26qIgzzRs5C3vpOJhDUhugBubIWgPGGRLpbnIro+P4XJPwM3pMziNzhKVuSDlQ==", + "license": "Apache-2.0", "dependencies": { - "@ethersproject/abstract-signer": "^5.7.0", - "@ethersproject/basex": "^5.7.0", - "@ethersproject/bignumber": "^5.7.0", - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/pbkdf2": "^5.7.0", - "@ethersproject/properties": "^5.7.0", - "@ethersproject/sha2": "^5.7.0", - "@ethersproject/signing-key": "^5.7.0", - "@ethersproject/strings": "^5.7.0", - "@ethersproject/transactions": "^5.7.0", - "@ethersproject/wordlists": "^5.7.0" + "@aws-sdk/middleware-serde": "3.325.0", + "@aws-sdk/types": "3.310.0", + "@aws-sdk/url-parser": "3.310.0", + "@aws-sdk/util-middleware": "3.310.0", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" } }, - "node_modules/@ethersproject/json-wallets": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/json-wallets/-/json-wallets-5.7.0.tgz", - "integrity": "sha512-8oee5Xgu6+RKgJTkvEMl2wDgSPSAQ9MB/3JYjFV9jlKvcYHUXZC+cQp0njgmxdHkYWn8s6/IqIZYm0YWCjO/0g==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], + "node_modules/@aws-sdk/middleware-expect-continue": { + "version": "3.325.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-expect-continue/-/middleware-expect-continue-3.325.0.tgz", + "integrity": "sha512-Hj4D+zeet4gdUpSiMeHZfIzcnXkZI2krGyUw4U1psPzCqOp7WP5307g+1NWXOlVu3H3tF5r3rEgthQOQj2zNfA==", + "license": "Apache-2.0", "dependencies": { - "@ethersproject/abstract-signer": "^5.7.0", - "@ethersproject/address": "^5.7.0", - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/hdnode": "^5.7.0", - "@ethersproject/keccak256": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/pbkdf2": "^5.7.0", - "@ethersproject/properties": "^5.7.0", - "@ethersproject/random": "^5.7.0", - "@ethersproject/strings": "^5.7.0", - "@ethersproject/transactions": "^5.7.0", - "aes-js": "3.0.0", - "scrypt-js": "3.0.1" + "@aws-sdk/protocol-http": "3.310.0", + "@aws-sdk/types": "3.310.0", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" } }, - "node_modules/@ethersproject/keccak256": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/keccak256/-/keccak256-5.7.0.tgz", - "integrity": "sha512-2UcPboeL/iW+pSg6vZ6ydF8tCnv3Iu/8tUmLLzWWGzxWKFFqOBQFLo6uLUv6BDrLgCDfN28RJ/wtByx+jZ4KBg==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], + "node_modules/@aws-sdk/middleware-flexible-checksums": { + "version": "3.326.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-flexible-checksums/-/middleware-flexible-checksums-3.326.0.tgz", + "integrity": "sha512-MtcvSU+wKu4/a/trIJmb4Tfb682U9uP5YYA5aXzdhxOxG11wj86uBIeQrdbUxhtTXMgmvwn1193dvTi91EUEaQ==", + "license": "Apache-2.0", "dependencies": { - "@ethersproject/bytes": "^5.7.0", - "js-sha3": "0.8.0" + "@aws-crypto/crc32": "3.0.0", + "@aws-crypto/crc32c": "3.0.0", + "@aws-sdk/is-array-buffer": "3.310.0", + "@aws-sdk/protocol-http": "3.310.0", + "@aws-sdk/types": "3.310.0", + "@aws-sdk/util-utf8": "3.310.0", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" } }, - "node_modules/@ethersproject/logger": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/logger/-/logger-5.7.0.tgz", - "integrity": "sha512-0odtFdXu/XHtjQXJYA3u9G0G8btm0ND5Cu8M7i5vhEcE8/HmF4Lbdqanwyv4uQTr2tx6b7fQRmgLrsnpQlmnig==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ] + "node_modules/@aws-sdk/middleware-host-header": { + "version": "3.325.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-host-header/-/middleware-host-header-3.325.0.tgz", + "integrity": "sha512-IN28gsxcRy4J+FxxCHvzb2NORBx8uMA+h9QYS4BBZfpKVYIZh+mudHgYcdNHWlKXmlTGjhWBNWTeByhzuSKAiA==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/protocol-http": "3.310.0", + "@aws-sdk/types": "3.310.0", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } }, - "node_modules/@ethersproject/networks": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/@ethersproject/networks/-/networks-5.7.1.tgz", - "integrity": "sha512-n/MufjFYv3yFcUyfhnXotyDlNdFb7onmkSy8aQERi2PjNcnWQ66xXxa3XlS8nCcA8aJKJjIIMNJTC7tu80GwpQ==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], + "node_modules/@aws-sdk/middleware-location-constraint": { + "version": "3.325.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-location-constraint/-/middleware-location-constraint-3.325.0.tgz", + "integrity": "sha512-T2OrpXXY9I1nHvIGSlQD6qj1FDG3WDFSu65+Bh4pMl+zVh0IqIEajiK++TfrdQl+sJxRGQd/euoeXXL4JYw9JA==", + "license": "Apache-2.0", "dependencies": { - "@ethersproject/logger": "^5.7.0" + "@aws-sdk/types": "3.310.0", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" } }, - "node_modules/@ethersproject/pbkdf2": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/pbkdf2/-/pbkdf2-5.7.0.tgz", - "integrity": "sha512-oR/dBRZR6GTyaofd86DehG72hY6NpAjhabkhxgr3X2FpJtJuodEl2auADWBZfhDHgVCbu3/H/Ocq2uC6dpNjjw==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], + "node_modules/@aws-sdk/middleware-logger": { + "version": "3.325.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-logger/-/middleware-logger-3.325.0.tgz", + "integrity": "sha512-S8rWgTpN2b/+UDDm+yZMFM6rw1zwO8KT0GAIQbAhB96shyD5eKen/UfihCTB7YMvbD2piebymwJTvxv6bn1VqQ==", + "license": "Apache-2.0", "dependencies": { - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/sha2": "^5.7.0" + "@aws-sdk/types": "3.310.0", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" } }, - "node_modules/@ethersproject/properties": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/properties/-/properties-5.7.0.tgz", - "integrity": "sha512-J87jy8suntrAkIZtecpxEPxY//szqr1mlBaYlQ0r4RCaiD2hjheqF9s1LVE8vVuJCXisjIP+JgtK/Do54ej4Sw==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], + "node_modules/@aws-sdk/middleware-recursion-detection": { + "version": "3.325.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-recursion-detection/-/middleware-recursion-detection-3.325.0.tgz", + "integrity": "sha512-2l1ABF7KePsoKz8KaNvD2uxo1zHqkFHK4PL/wW/FbcwOcE08f0R7qX++st/bPpVjXX/j/5vWTnNNgJOIOrZhyw==", + "license": "Apache-2.0", "dependencies": { - "@ethersproject/logger": "^5.7.0" + "@aws-sdk/protocol-http": "3.310.0", + "@aws-sdk/types": "3.310.0", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" } }, - "node_modules/@ethersproject/providers": { - "version": "5.7.2", - "resolved": "https://registry.npmjs.org/@ethersproject/providers/-/providers-5.7.2.tgz", - "integrity": "sha512-g34EWZ1WWAVgr4aptGlVBF8mhl3VWjv+8hoAnzStu8Ah22VHBsuGzP17eb6xDVRzw895G4W7vvx60lFFur/1Rg==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], + "node_modules/@aws-sdk/middleware-retry": { + "version": "3.327.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-retry/-/middleware-retry-3.327.0.tgz", + "integrity": "sha512-LCG+oRIPc4XJ+DYqkSCgggavxWi4+hP3Rw40vHdHMNvJpCiUJMwVJ+dULEywEP/WZvr4AEkWiRrHmJVpSLeZ+Q==", + "license": "Apache-2.0", "dependencies": { - "@ethersproject/abstract-provider": "^5.7.0", - "@ethersproject/abstract-signer": "^5.7.0", - "@ethersproject/address": "^5.7.0", - "@ethersproject/base64": "^5.7.0", - "@ethersproject/basex": "^5.7.0", - "@ethersproject/bignumber": "^5.7.0", - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/constants": "^5.7.0", - "@ethersproject/hash": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/networks": "^5.7.0", - "@ethersproject/properties": "^5.7.0", - "@ethersproject/random": "^5.7.0", - "@ethersproject/rlp": "^5.7.0", - "@ethersproject/sha2": "^5.7.0", - "@ethersproject/strings": "^5.7.0", - "@ethersproject/transactions": "^5.7.0", - "@ethersproject/web": "^5.7.0", - "bech32": "1.1.4", - "ws": "7.4.6" + "@aws-sdk/protocol-http": "3.310.0", + "@aws-sdk/service-error-classification": "3.327.0", + "@aws-sdk/types": "3.310.0", + "@aws-sdk/util-middleware": "3.310.0", + "@aws-sdk/util-retry": "3.327.0", + "tslib": "^2.5.0", + "uuid": "^8.3.2" + }, + "engines": { + "node": ">=14.0.0" } }, - "node_modules/@ethersproject/random": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/random/-/random-5.7.0.tgz", - "integrity": "sha512-19WjScqRA8IIeWclFme75VMXSBvi4e6InrUNuaR4s5pTF2qNhcGdCUwdxUVGtDDqC00sDLCO93jPQoDUH4HVmQ==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], + "node_modules/@aws-sdk/middleware-sdk-s3": { + "version": "3.326.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-sdk-s3/-/middleware-sdk-s3-3.326.0.tgz", + "integrity": "sha512-IyonHEiDMn0fdYWxA/TAnNj8M/xG5EJWvoOKcakl891f+JPaWeRsV2oE1fIjqM/waM3jqNXLDTrm06QfAYmgBQ==", + "license": "Apache-2.0", "dependencies": { - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/logger": "^5.7.0" + "@aws-sdk/protocol-http": "3.310.0", + "@aws-sdk/types": "3.310.0", + "@aws-sdk/util-arn-parser": "3.310.0", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" } }, - "node_modules/@ethersproject/rlp": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/rlp/-/rlp-5.7.0.tgz", - "integrity": "sha512-rBxzX2vK8mVF7b0Tol44t5Tb8gomOHkj5guL+HhzQ1yBh/ydjGnpw6at+X6Iw0Kp3OzzzkcKp8N9r0W4kYSs9w==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], + "node_modules/@aws-sdk/middleware-sdk-sts": { + "version": "3.326.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-sdk-sts/-/middleware-sdk-sts-3.326.0.tgz", + "integrity": "sha512-suOkuXxyAfOH0hznK63ZU10EoytKX5YPs9amO416VbgYFtuIeliCmntYfnl1jUvutp0fctGGpEGE9OnoYI+fhw==", + "license": "Apache-2.0", "dependencies": { - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/logger": "^5.7.0" + "@aws-sdk/middleware-signing": "3.325.0", + "@aws-sdk/types": "3.310.0", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" } }, - "node_modules/@ethersproject/sha2": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/sha2/-/sha2-5.7.0.tgz", - "integrity": "sha512-gKlH42riwb3KYp0reLsFTokByAKoJdgFCwI+CCiX/k+Jm2mbNs6oOaCjYQSlI1+XBVejwH2KrmCbMAT/GnRDQw==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], + "node_modules/@aws-sdk/middleware-serde": { + "version": "3.325.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-serde/-/middleware-serde-3.325.0.tgz", + "integrity": "sha512-QAZYaFfAw1a06Vg39JiYIq0kSJ6EuUPOiKfK/Goj0cBv78lrXWuKdf04UF3U8Rqk/4mamnsTqUSwf4NoKkF0hw==", + "license": "Apache-2.0", "dependencies": { - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "hash.js": "1.1.7" + "@aws-sdk/types": "3.310.0", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" } }, - "node_modules/@ethersproject/signing-key": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/signing-key/-/signing-key-5.7.0.tgz", - "integrity": "sha512-MZdy2nL3wO0u7gkB4nA/pEf8lu1TlFswPNmy8AiYkfKTdO6eXBJyUdmHO/ehm/htHw9K/qF8ujnTyUAD+Ry54Q==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], + "node_modules/@aws-sdk/middleware-signing": { + "version": "3.325.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-signing/-/middleware-signing-3.325.0.tgz", + "integrity": "sha512-SOwPwaCE3vSCGwFzkIlnOUSkeCUzKTyIQnFVjlQkqGuMxMX/iDaQQGaX+HUbuGIuULCEQqjZH4dLKZcor8eVZw==", + "license": "Apache-2.0", "dependencies": { - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/properties": "^5.7.0", - "bn.js": "^5.2.1", - "elliptic": "6.5.4", - "hash.js": "1.1.7" + "@aws-sdk/property-provider": "3.310.0", + "@aws-sdk/protocol-http": "3.310.0", + "@aws-sdk/signature-v4": "3.310.0", + "@aws-sdk/types": "3.310.0", + "@aws-sdk/util-middleware": "3.310.0", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" } }, - "node_modules/@ethersproject/solidity": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/solidity/-/solidity-5.7.0.tgz", - "integrity": "sha512-HmabMd2Dt/raavyaGukF4XxizWKhKQ24DoLtdNbBmNKUOPqwjsKQSdV9GQtj9CBEea9DlzETlVER1gYeXXBGaA==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], + "node_modules/@aws-sdk/middleware-ssec": { + "version": "3.325.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-ssec/-/middleware-ssec-3.325.0.tgz", + "integrity": "sha512-hxmvvWVfVrbfUw8pDEPlsR6Sb+IUdhq0cOJc7SL5XO9ddRXJ5DjT2Z2ao9FB424hJgAcOrqIO5ECjdIRs+O4FQ==", + "license": "Apache-2.0", "dependencies": { - "@ethersproject/bignumber": "^5.7.0", - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/keccak256": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/sha2": "^5.7.0", - "@ethersproject/strings": "^5.7.0" + "@aws-sdk/types": "3.310.0", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" } }, - "node_modules/@ethersproject/strings": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/strings/-/strings-5.7.0.tgz", - "integrity": "sha512-/9nu+lj0YswRNSH0NXYqrh8775XNyEdUQAuf3f+SmOrnVewcJ5SBNAjF7lpgehKi4abvNNXyf+HX86czCdJ8Mg==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], + "node_modules/@aws-sdk/middleware-stack": { + "version": "3.325.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-stack/-/middleware-stack-3.325.0.tgz", + "integrity": "sha512-cZWehA4grGvX1IKlY9atJgD0bq3ew7YRJgY7GA6DSgsU7GrZ61Qvi+H7IuGx5AdeAwaTnbnTGN4qCaA2EfxNhA==", + "license": "Apache-2.0", "dependencies": { - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/constants": "^5.7.0", - "@ethersproject/logger": "^5.7.0" + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" } }, - "node_modules/@ethersproject/transactions": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/transactions/-/transactions-5.7.0.tgz", - "integrity": "sha512-kmcNicCp1lp8qanMTC3RIikGgoJ80ztTyvtsFvCYpSCfkjhD0jZ2LOrnbcuxuToLIUYYf+4XwD1rP+B/erDIhQ==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], + "node_modules/@aws-sdk/middleware-user-agent": { + "version": "3.327.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-user-agent/-/middleware-user-agent-3.327.0.tgz", + "integrity": "sha512-4rDSNY1xhlqfRcY97CQKcgs6AOe4ovtiRdCAjg2InnLOZHRVFoHhOIDxWNK2W1K2Pl65z4EGH6RXmB1t0srJHA==", + "license": "Apache-2.0", "dependencies": { - "@ethersproject/address": "^5.7.0", - "@ethersproject/bignumber": "^5.7.0", - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/constants": "^5.7.0", - "@ethersproject/keccak256": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/properties": "^5.7.0", - "@ethersproject/rlp": "^5.7.0", - "@ethersproject/signing-key": "^5.7.0" + "@aws-sdk/protocol-http": "3.310.0", + "@aws-sdk/types": "3.310.0", + "@aws-sdk/util-endpoints": "3.327.0", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" } }, - "node_modules/@ethersproject/units": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/units/-/units-5.7.0.tgz", - "integrity": "sha512-pD3xLMy3SJu9kG5xDGI7+xhTEmGXlEqXU4OfNapmfnxLVY4EMSSRp7j1k7eezutBPH7RBN/7QPnwR7hzNlEFeg==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], + "node_modules/@aws-sdk/node-config-provider": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/node-config-provider/-/node-config-provider-3.310.0.tgz", + "integrity": "sha512-T/Pp6htc6hq/Cq+MLNDSyiwWCMVF6GqbBbXKVlO5L8rdHx4sq9xPdoPveZhGWrxvkanjA6eCwUp6E0riBOSVng==", + "license": "Apache-2.0", "dependencies": { - "@ethersproject/bignumber": "^5.7.0", - "@ethersproject/constants": "^5.7.0", - "@ethersproject/logger": "^5.7.0" - } - }, - "node_modules/@ethersproject/wallet": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/wallet/-/wallet-5.7.0.tgz", - "integrity": "sha512-MhmXlJXEJFBFVKrDLB4ZdDzxcBxQ3rLyCkhNqVu3CDYvR97E+8r01UgrI+TI99Le+aYm/in/0vp86guJuM7FCA==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/abstract-provider": "^5.7.0", - "@ethersproject/abstract-signer": "^5.7.0", - "@ethersproject/address": "^5.7.0", - "@ethersproject/bignumber": "^5.7.0", - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/hash": "^5.7.0", - "@ethersproject/hdnode": "^5.7.0", - "@ethersproject/json-wallets": "^5.7.0", - "@ethersproject/keccak256": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/properties": "^5.7.0", - "@ethersproject/random": "^5.7.0", - "@ethersproject/signing-key": "^5.7.0", - "@ethersproject/transactions": "^5.7.0", - "@ethersproject/wordlists": "^5.7.0" + "@aws-sdk/property-provider": "3.310.0", + "@aws-sdk/shared-ini-file-loader": "3.310.0", + "@aws-sdk/types": "3.310.0", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" } }, - "node_modules/@ethersproject/web": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/@ethersproject/web/-/web-5.7.1.tgz", - "integrity": "sha512-Gueu8lSvyjBWL4cYsWsjh6MtMwM0+H4HvqFPZfB6dV8ctbP9zFAO73VG1cMWae0FLPCtz0peKPpZY8/ugJJX2w==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], + "node_modules/@aws-sdk/node-http-handler": { + "version": "3.328.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/node-http-handler/-/node-http-handler-3.328.0.tgz", + "integrity": "sha512-zxXdNfdSGi6w/1bopllxAYAufCGDNG2eLenR3Tjj/UVBGrvS4ME5NGInu6u4LirTdkSqYlZkqKMyfiZ6XxGfdQ==", + "license": "Apache-2.0", "dependencies": { - "@ethersproject/base64": "^5.7.0", - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/properties": "^5.7.0", - "@ethersproject/strings": "^5.7.0" + "@aws-sdk/abort-controller": "3.310.0", + "@aws-sdk/protocol-http": "3.310.0", + "@aws-sdk/querystring-builder": "3.310.0", + "@aws-sdk/types": "3.310.0", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" } }, - "node_modules/@ethersproject/wordlists": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/wordlists/-/wordlists-5.7.0.tgz", - "integrity": "sha512-S2TFNJNfHWVHNE6cNDjbVlZ6MgE17MIxMbMg2zv3wn+3XSJGosL1m9ZVv3GXCf/2ymSsQ+hRI5IzoMJTG6aoVA==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], + "node_modules/@aws-sdk/property-provider": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/property-provider/-/property-provider-3.310.0.tgz", + "integrity": "sha512-3lxDb0akV6BBzmFe4nLPaoliQbAifyWJhuvuDOu7e8NzouvpQXs0275w9LePhhcgjKAEVXUIse05ZW2DLbxo/g==", + "license": "Apache-2.0", "dependencies": { - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/hash": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/properties": "^5.7.0", - "@ethersproject/strings": "^5.7.0" + "@aws-sdk/types": "3.310.0", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" } }, - "node_modules/@hover-labs/kolibri-js": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/@hover-labs/kolibri-js/-/kolibri-js-4.1.3.tgz", - "integrity": "sha512-ZmW4x+7XptaQnE5nw3AJU7L5AHxHE/E0Qy0rWKjd23MM/V6vd2CODbR9UC0Rh1dVmWioprj0KbTEqg499OM7ow==", + "node_modules/@aws-sdk/protocol-http": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/protocol-http/-/protocol-http-3.310.0.tgz", + "integrity": "sha512-fgZ1aw/irQtnrsR58pS8ThKOWo57Py3xX6giRvwSgZDEcxHfVzuQjy9yPuV++v04fdmdtgpbGf8WfvAAJ11yXQ==", + "license": "Apache-2.0", "dependencies": { - "@taquito/signer": "^12.0.2", - "@taquito/taquito": "^12.0.2", - "@temple-wallet/dapp": "^5.0.2", - "axios": "^0.21.0", - "bignumber.js": "^9.0.1", - "blakejs": "^1.1.1", - "bs58check": "^2.1.2", - "decimal.js": "^10.3.1", - "lodash": "^4.17.21" + "@aws-sdk/types": "3.310.0", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" } }, - "node_modules/@hover-labs/kolibri-js/node_modules/@taquito/http-utils": { - "version": "12.1.1", - "resolved": "https://registry.npmjs.org/@taquito/http-utils/-/http-utils-12.1.1.tgz", - "integrity": "sha512-Zlp/eTRVjFs0XEIiAhgxkh6s9npF4dO+e/Sm2XWsDmNPoGI2jdXNH0L+NiKJIOkYcu0CXlcgriTeEaYnbeTvcA==", + "node_modules/@aws-sdk/querystring-builder": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/querystring-builder/-/querystring-builder-3.310.0.tgz", + "integrity": "sha512-ZHH8GV/80+pWGo7DzsvwvXR5xVxUHXUvPJPFAkhr6nCf78igdoF8gR10ScFoEKbtEapoNTaZlKHPXxpD8aPG7A==", + "license": "Apache-2.0", "dependencies": { - "axios": "^0.26.0" + "@aws-sdk/types": "3.310.0", + "@aws-sdk/util-uri-escape": "3.310.0", + "tslib": "^2.5.0" }, "engines": { - "node": ">=6.0.0" + "node": ">=14.0.0" } }, - "node_modules/@hover-labs/kolibri-js/node_modules/@taquito/http-utils/node_modules/axios": { - "version": "0.26.1", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.26.1.tgz", - "integrity": "sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA==", + "node_modules/@aws-sdk/querystring-parser": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/querystring-parser/-/querystring-parser-3.310.0.tgz", + "integrity": "sha512-YkIznoP6lsiIUHinx++/lbb3tlMURGGqMpo0Pnn32zYzGrJXA6eC3D0as2EcMjo55onTfuLcIiX4qzXes2MYOA==", + "license": "Apache-2.0", "dependencies": { - "follow-redirects": "^1.14.8" + "@aws-sdk/types": "3.310.0", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" } }, - "node_modules/@hover-labs/kolibri-js/node_modules/@taquito/michel-codec": { - "version": "12.1.1", - "resolved": "https://registry.npmjs.org/@taquito/michel-codec/-/michel-codec-12.1.1.tgz", - "integrity": "sha512-BAig8YyLyRW5kxV/r0S191W+SvYuiTRJpgSp5IsgCDLAOh+d4/xq6IgU3PuGJgokQDstZdTbjpkrgRCnufR8lw==", + "node_modules/@aws-sdk/service-error-classification": { + "version": "3.327.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/service-error-classification/-/service-error-classification-3.327.0.tgz", + "integrity": "sha512-bCWnw+uH3gI6yPxLi4a4WV71P1KlJU7Z4+iMBY1Gt4+ZsaPAJX9pAbuQcFhFH++4xTk/QaVMzSvD0uQ+u0B/NQ==", + "license": "Apache-2.0", "engines": { - "node": ">=6.0.0" + "node": ">=14.0.0" } }, - "node_modules/@hover-labs/kolibri-js/node_modules/@taquito/michelson-encoder": { - "version": "12.1.1", - "resolved": "https://registry.npmjs.org/@taquito/michelson-encoder/-/michelson-encoder-12.1.1.tgz", - "integrity": "sha512-mWcA1DHHlFj7UswJpEmml853x9e0IYHyeiKZYAo7DtizHz0jiUWtptCuEWiPQ4fMOreFbYZ6KVYenoVfQVNrqA==", + "node_modules/@aws-sdk/shared-ini-file-loader": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/shared-ini-file-loader/-/shared-ini-file-loader-3.310.0.tgz", + "integrity": "sha512-N0q9pG0xSjQwc690YQND5bofm+4nfUviQ/Ppgan2kU6aU0WUq8KwgHJBto/YEEI+VlrME30jZJnxtOvcZJc2XA==", + "license": "Apache-2.0", "dependencies": { - "@taquito/rpc": "^12.1.1", - "@taquito/utils": "^12.1.1", - "bignumber.js": "^9.0.2", - "fast-json-stable-stringify": "^2.1.0" + "@aws-sdk/types": "3.310.0", + "tslib": "^2.5.0" }, "engines": { - "node": ">=6.0.0" + "node": ">=14.0.0" } }, - "node_modules/@hover-labs/kolibri-js/node_modules/@taquito/rpc": { - "version": "12.1.1", - "resolved": "https://registry.npmjs.org/@taquito/rpc/-/rpc-12.1.1.tgz", - "integrity": "sha512-CgAF9kdmKLa/UbmiqApDtncCQGiG7kEOIYis8IIa0JUT9JD1H8WBbSNF/oNh4e0soWUK9BL2qU369RFnxIW+iA==", + "node_modules/@aws-sdk/signature-v4": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/signature-v4/-/signature-v4-3.310.0.tgz", + "integrity": "sha512-1M60P1ZBNAjCFv9sYW29OF6okktaeibWyW3lMXqzoHF70lHBZh+838iUchznXUA5FLabfn4jBFWMRxlAXJUY2Q==", + "license": "Apache-2.0", "dependencies": { - "@taquito/http-utils": "^12.1.1", - "@taquito/utils": "^12.1.1", - "bignumber.js": "^9.0.2" + "@aws-sdk/is-array-buffer": "3.310.0", + "@aws-sdk/types": "3.310.0", + "@aws-sdk/util-hex-encoding": "3.310.0", + "@aws-sdk/util-middleware": "3.310.0", + "@aws-sdk/util-uri-escape": "3.310.0", + "@aws-sdk/util-utf8": "3.310.0", + "tslib": "^2.5.0" }, "engines": { - "node": ">=6.0.0" + "node": ">=14.0.0" } }, - "node_modules/@hover-labs/kolibri-js/node_modules/@taquito/taquito": { - "version": "12.1.1", - "resolved": "https://registry.npmjs.org/@taquito/taquito/-/taquito-12.1.1.tgz", - "integrity": "sha512-HvbtClQ7isrDd17X/LEKkPzzeVYA8EMUem3qrkl9qvDO6FpJx/QLbUpYfT2PC0pLUkSrzdLGzmESHAOZhcksaw==", - "hasInstallScript": true, + "node_modules/@aws-sdk/signature-v4-multi-region": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/signature-v4-multi-region/-/signature-v4-multi-region-3.310.0.tgz", + "integrity": "sha512-q8W+RIomTS/q85Ntgks/CoDElwqkC9+4OCicee5YznNHjQ4gtNWhUkYIyIRWRmXa/qx/AUreW9DM8FAecCOdng==", + "license": "Apache-2.0", "dependencies": { - "@taquito/http-utils": "^12.1.1", - "@taquito/local-forging": "^12.1.1", - "@taquito/michel-codec": "^12.1.1", - "@taquito/michelson-encoder": "^12.1.1", - "@taquito/rpc": "^12.1.1", - "@taquito/utils": "^12.1.1", - "bignumber.js": "^9.0.2", - "rxjs": "^6.6.3" + "@aws-sdk/protocol-http": "3.310.0", + "@aws-sdk/signature-v4": "3.310.0", + "@aws-sdk/types": "3.310.0", + "tslib": "^2.5.0" }, "engines": { - "node": ">=6.0.0" + "node": ">=14.0.0" + }, + "peerDependencies": { + "@aws-sdk/signature-v4-crt": "^3.118.0" + }, + "peerDependenciesMeta": { + "@aws-sdk/signature-v4-crt": { + "optional": true + } } }, - "node_modules/@hover-labs/kolibri-js/node_modules/axios": { - "version": "0.21.4", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.4.tgz", - "integrity": "sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==", + "node_modules/@aws-sdk/smithy-client": { + "version": "3.325.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/smithy-client/-/smithy-client-3.325.0.tgz", + "integrity": "sha512-sqDFuhjxd8+Q9qI8MmXe/g1/FgoViwetv14K+bpHK7pGlOIvDyT7TboDNClfgqSLdgTDCEaoC3JRSi9Y5RgbmA==", + "license": "Apache-2.0", "dependencies": { - "follow-redirects": "^1.14.0" + "@aws-sdk/middleware-stack": "3.325.0", + "@aws-sdk/types": "3.310.0", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" } }, - "node_modules/@humanwhocodes/config-array": { - "version": "0.11.8", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.8.tgz", - "integrity": "sha512-UybHIJzJnR5Qc/MsD9Kr+RpO2h+/P1GhOwdiLPXK5TWk5sgTdu88bTD9UP+CKbPPh5Rni1u0GjAdYQLemG8g+g==", - "dev": true, + "node_modules/@aws-sdk/token-providers": { + "version": "3.328.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/token-providers/-/token-providers-3.328.0.tgz", + "integrity": "sha512-AWrRwa0RqSiz9CT3QKuMYuZsRXaeKCp8kMsx1CgrG5VUaag+NhDBBMYVbxgb0SyoqbsGC+wDUXtSCZctrE7Z3Q==", + "license": "Apache-2.0", "dependencies": { - "@humanwhocodes/object-schema": "^1.2.1", - "debug": "^4.1.1", - "minimatch": "^3.0.5" + "@aws-sdk/client-sso-oidc": "3.328.0", + "@aws-sdk/property-provider": "3.310.0", + "@aws-sdk/shared-ini-file-loader": "3.310.0", + "@aws-sdk/types": "3.310.0", + "tslib": "^2.5.0" }, "engines": { - "node": ">=10.10.0" + "node": ">=14.0.0" } }, - "node_modules/@humanwhocodes/module-importer": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", - "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", - "dev": true, - "engines": { - "node": ">=12.22" + "node_modules/@aws-sdk/types": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/types/-/types-3.310.0.tgz", + "integrity": "sha512-j8eamQJ7YcIhw7fneUfs8LYl3t01k4uHi4ZDmNRgtbmbmTTG3FZc2MotStZnp3nZB6vLiPF1o5aoJxWVvkzS6A==", + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.5.0" }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/nzakas" + "engines": { + "node": ">=14.0.0" } }, - "node_modules/@humanwhocodes/object-schema": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", - "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", - "dev": true + "node_modules/@aws-sdk/url-parser": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/url-parser/-/url-parser-3.310.0.tgz", + "integrity": "sha512-mCLnCaSB9rQvAgx33u0DujLvr4d5yEm/W5r789GblwwQnlNXedVu50QRizMLTpltYWyAUoXjJgQnJHmJMaKXhw==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/querystring-parser": "3.310.0", + "@aws-sdk/types": "3.310.0", + "tslib": "^2.5.0" + } }, - "node_modules/@jest/types": { - "version": "26.6.2", - "resolved": "https://registry.npmjs.org/@jest/types/-/types-26.6.2.tgz", - "integrity": "sha512-fC6QCp7Sc5sX6g8Tvbmj4XUTbyrik0akgRy03yjXbQaBWWNWGE7SGtJk98m0N8nzegD/7SggrUlivxo5ax4KWQ==", - "peer": true, + "node_modules/@aws-sdk/util-arn-parser": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-arn-parser/-/util-arn-parser-3.310.0.tgz", + "integrity": "sha512-jL8509owp/xB9+Or0pvn3Fe+b94qfklc2yPowZZIFAkFcCSIdkIglz18cPDWnYAcy9JGewpMS1COXKIUhZkJsA==", + "license": "Apache-2.0", "dependencies": { - "@types/istanbul-lib-coverage": "^2.0.0", - "@types/istanbul-reports": "^3.0.0", - "@types/node": "*", - "@types/yargs": "^15.0.0", - "chalk": "^4.0.0" + "tslib": "^2.5.0" }, "engines": { - "node": ">= 10.14.2" + "node": ">=14.0.0" } }, - "node_modules/@jridgewell/resolve-uri": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz", - "integrity": "sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==", - "dev": true, + "node_modules/@aws-sdk/util-base64": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-base64/-/util-base64-3.310.0.tgz", + "integrity": "sha512-v3+HBKQvqgdzcbL+pFswlx5HQsd9L6ZTlyPVL2LS9nNXnCcR3XgGz9jRskikRUuUvUXtkSG1J88GAOnJ/apTPg==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/util-buffer-from": "3.310.0", + "tslib": "^2.5.0" + }, "engines": { - "node": ">=6.0.0" + "node": ">=14.0.0" } }, - "node_modules/@jridgewell/sourcemap-codec": { - "version": "1.4.14", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz", - "integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==", - "dev": true - }, - "node_modules/@jridgewell/trace-mapping": { - "version": "0.3.9", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", - "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", - "dev": true, + "node_modules/@aws-sdk/util-body-length-browser": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-body-length-browser/-/util-body-length-browser-3.310.0.tgz", + "integrity": "sha512-sxsC3lPBGfpHtNTUoGXMQXLwjmR0zVpx0rSvzTPAuoVILVsp5AU/w5FphNPxD5OVIjNbZv9KsKTuvNTiZjDp9g==", + "license": "Apache-2.0", "dependencies": { - "@jridgewell/resolve-uri": "^3.0.3", - "@jridgewell/sourcemap-codec": "^1.4.10" + "tslib": "^2.5.0" } }, - "node_modules/@marinade.finance/marinade-ts-sdk": { - "version": "3.1.4", - "resolved": "https://registry.npmjs.org/@marinade.finance/marinade-ts-sdk/-/marinade-ts-sdk-3.1.4.tgz", - "integrity": "sha512-gnjgQyBHev9nUROlirazTHved9nUzs3WEHqu50yYceYZucKAXvFltE2YgOywGNTfrLI/MMsWIQLmurwDFdbDnA==", + "node_modules/@aws-sdk/util-body-length-node": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-body-length-node/-/util-body-length-node-3.310.0.tgz", + "integrity": "sha512-2tqGXdyKhyA6w4zz7UPoS8Ip+7sayOg9BwHNidiGm2ikbDxm1YrCfYXvCBdwaJxa4hJfRVz+aL9e+d3GqPI9pQ==", + "license": "Apache-2.0", "dependencies": { - "@project-serum/anchor": "^0.18.2", - "@solana/spl-token": "^0.1.8", - "bignumber.js": "^9.1.0", - "borsh": "^0.6.0", - "bs58": "^5.0.0" + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" } }, - "node_modules/@marinade.finance/marinade-ts-sdk/node_modules/@project-serum/anchor": { - "version": "0.18.2", - "resolved": "https://registry.npmjs.org/@project-serum/anchor/-/anchor-0.18.2.tgz", - "integrity": "sha512-uyjiN/3Ipp+4hrZRm/hG18HzGLZyvP790LXrCsGO3IWxSl28YRhiGEpKnZycfMW94R7nxdUoE3wY67V+ZHSQBQ==", + "node_modules/@aws-sdk/util-buffer-from": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-buffer-from/-/util-buffer-from-3.310.0.tgz", + "integrity": "sha512-i6LVeXFtGih5Zs8enLrt+ExXY92QV25jtEnTKHsmlFqFAuL3VBeod6boeMXkN2p9lbSVVQ1sAOOYZOHYbYkntw==", + "license": "Apache-2.0", "dependencies": { - "@project-serum/borsh": "^0.2.2", - "@solana/web3.js": "^1.17.0", - "base64-js": "^1.5.1", - "bn.js": "^5.1.2", - "bs58": "^4.0.1", - "buffer-layout": "^1.2.0", - "camelcase": "^5.3.1", - "crypto-hash": "^1.3.0", - "eventemitter3": "^4.0.7", - "find": "^0.3.0", - "js-sha256": "^0.9.0", - "pako": "^2.0.3", - "snake-case": "^3.0.4", - "toml": "^3.0.0" + "@aws-sdk/is-array-buffer": "3.310.0", + "tslib": "^2.5.0" }, "engines": { - "node": ">=11" + "node": ">=14.0.0" } }, - "node_modules/@marinade.finance/marinade-ts-sdk/node_modules/@project-serum/anchor/node_modules/bs58": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/bs58/-/bs58-4.0.1.tgz", - "integrity": "sha512-Ok3Wdf5vOIlBrgCvTq96gBkJw+JUEzdBgyaza5HLtPm7yTHkjRy8+JzNyHF7BHa0bNWOQIp3m5YF0nnFcOIKLw==", + "node_modules/@aws-sdk/util-config-provider": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-config-provider/-/util-config-provider-3.310.0.tgz", + "integrity": "sha512-xIBaYo8dwiojCw8vnUcIL4Z5tyfb1v3yjqyJKJWV/dqKUFOOS0U591plmXbM+M/QkXyML3ypon1f8+BoaDExrg==", + "license": "Apache-2.0", "dependencies": { - "base-x": "^3.0.2" + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" } }, - "node_modules/@marinade.finance/marinade-ts-sdk/node_modules/borsh": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/borsh/-/borsh-0.6.0.tgz", - "integrity": "sha512-sl5k89ViqsThXQpYa9XDtz1sBl3l1lI313cFUY1HKr+wvMILnb+58xpkqTNrYbelh99dY7K8usxoCusQmqix9Q==", + "node_modules/@aws-sdk/util-defaults-mode-browser": { + "version": "3.325.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-defaults-mode-browser/-/util-defaults-mode-browser-3.325.0.tgz", + "integrity": "sha512-gcowpXTo8E8N3jxD2KW+csiicJ7HPkhWnpL925xgwe0oq091OpATsKFrBOL18h72VfRWf4FAsR9lVwxSQ78zSA==", + "license": "Apache-2.0", "dependencies": { - "bn.js": "^5.2.0", - "bs58": "^4.0.0", - "text-encoding-utf-8": "^1.0.2" + "@aws-sdk/property-provider": "3.310.0", + "@aws-sdk/types": "3.310.0", + "bowser": "^2.11.0", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">= 10.0.0" } }, - "node_modules/@marinade.finance/marinade-ts-sdk/node_modules/borsh/node_modules/bs58": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/bs58/-/bs58-4.0.1.tgz", - "integrity": "sha512-Ok3Wdf5vOIlBrgCvTq96gBkJw+JUEzdBgyaza5HLtPm7yTHkjRy8+JzNyHF7BHa0bNWOQIp3m5YF0nnFcOIKLw==", + "node_modules/@aws-sdk/util-defaults-mode-node": { + "version": "3.325.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-defaults-mode-node/-/util-defaults-mode-node-3.325.0.tgz", + "integrity": "sha512-/5uoOrgNxoUxv3AwsdXjMA3f6KJA6fi69otA0RiINjilCdcbOxq5GI11AFEyRio/+e+imriX4+UYjsguUR+f4g==", + "license": "Apache-2.0", "dependencies": { - "base-x": "^3.0.2" + "@aws-sdk/config-resolver": "3.310.0", + "@aws-sdk/credential-provider-imds": "3.310.0", + "@aws-sdk/node-config-provider": "3.310.0", + "@aws-sdk/property-provider": "3.310.0", + "@aws-sdk/types": "3.310.0", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">= 10.0.0" } }, - "node_modules/@marinade.finance/marinade-ts-sdk/node_modules/bs58": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/bs58/-/bs58-5.0.0.tgz", - "integrity": "sha512-r+ihvQJvahgYT50JD05dyJNKlmmSlMoOGwn1lCcEzanPglg7TxYjioQUYehQ9mAR/+hOSd2jRc/Z2y5UxBymvQ==", + "node_modules/@aws-sdk/util-endpoints": { + "version": "3.327.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-endpoints/-/util-endpoints-3.327.0.tgz", + "integrity": "sha512-2+2jTfBzhXsfpOci61gzaoBUVdGhFWja7k5cLAfOaRROkK+m+Zv532+m3cCQZjBXJ6pJ952MbiAroRSjFq0/SQ==", + "license": "Apache-2.0", "dependencies": { - "base-x": "^4.0.0" + "@aws-sdk/types": "3.310.0", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" } }, - "node_modules/@marinade.finance/marinade-ts-sdk/node_modules/bs58/node_modules/base-x": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/base-x/-/base-x-4.0.0.tgz", - "integrity": "sha512-FuwxlW4H5kh37X/oW59pwTzzTKRzfrrQwhmyspRM7swOEZcHtDZSCt45U6oKgtuFE+WYPblePMVIPR4RZrh/hw==" - }, - "node_modules/@mithraic-labs/psy-american": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/@mithraic-labs/psy-american/-/psy-american-0.2.3.tgz", - "integrity": "sha512-NsDfb9QNuLKNqRnq8rWAoD2Y3ouAEsAPFfwP28SmDVfkugvj03nvQtjotFLlH2TsE31YonG+gauhpeeGKZyyuw==", + "node_modules/@aws-sdk/util-hex-encoding": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-hex-encoding/-/util-hex-encoding-3.310.0.tgz", + "integrity": "sha512-sVN7mcCCDSJ67pI1ZMtk84SKGqyix6/0A1Ab163YKn+lFBQRMKexleZzpYzNGxYzmQS6VanP/cfU7NiLQOaSfA==", + "license": "Apache-2.0", "dependencies": { - "@project-serum/anchor": "^0.24.2", - "@project-serum/serum": "^0.13.60", - "@solana/spl-token": "^0.1.8", - "@solana/web3.js": "^1.28.0" + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" } }, - "node_modules/@mithraic-labs/psy-american/node_modules/@project-serum/anchor": { - "version": "0.24.2", - "resolved": "https://registry.npmjs.org/@project-serum/anchor/-/anchor-0.24.2.tgz", - "integrity": "sha512-0/718g8/DnEuwAidUwh5wLYphUYXhUbiClkuRNhvNoa+1Y8a4g2tJyxoae+emV+PG/Gikd/QUBNMkIcimiIRTA==", + "node_modules/@aws-sdk/util-locate-window": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-locate-window/-/util-locate-window-3.310.0.tgz", + "integrity": "sha512-qo2t/vBTnoXpjKxlsC2e1gBrRm80M3bId27r0BRB2VniSSe7bL1mmzM+/HFtujm0iAxtPM+aLEflLJlJeDPg0w==", + "license": "Apache-2.0", "dependencies": { - "@project-serum/borsh": "^0.2.5", - "@solana/web3.js": "^1.36.0", - "base64-js": "^1.5.1", - "bn.js": "^5.1.2", - "bs58": "^4.0.1", - "buffer-layout": "^1.2.2", - "camelcase": "^5.3.1", - "cross-fetch": "^3.1.5", - "crypto-hash": "^1.3.0", - "eventemitter3": "^4.0.7", - "js-sha256": "^0.9.0", - "pako": "^2.0.3", - "snake-case": "^3.0.4", - "toml": "^3.0.0" + "tslib": "^2.5.0" }, "engines": { - "node": ">=11" + "node": ">=14.0.0" } }, - "node_modules/@noble/ed25519": { - "version": "1.7.1", - "resolved": "https://registry.npmjs.org/@noble/ed25519/-/ed25519-1.7.1.tgz", - "integrity": "sha512-Rk4SkJFaXZiznFyC/t77Q0NKS4FL7TLJJsVG2V2oiEq3kJVeTdxysEe/yRWSpnWMe808XRDJ+VFh5pt/FN5plw==", - "funding": [ - { - "type": "individual", - "url": "https://paulmillr.com/funding/" - } - ] - }, - "node_modules/@noble/hashes": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.1.5.tgz", - "integrity": "sha512-LTMZiiLc+V4v1Yi16TD6aX2gmtKszNye0pQgbaLqkvhIqP7nVsSaJsWloGQjJfJ8offaoP5GtX3yY5swbcJxxQ==", - "funding": [ - { - "type": "individual", - "url": "https://paulmillr.com/funding/" - } - ] - }, - "node_modules/@noble/secp256k1": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/@noble/secp256k1/-/secp256k1-1.7.0.tgz", - "integrity": "sha512-kbacwGSsH/CTout0ZnZWxnW1B+jH/7r/WAAKLBtrRJ/+CUH7lgmQzl3GTrQua3SGKWNSDsS6lmjnDpIJ5Dxyaw==", - "funding": [ - { - "type": "individual", - "url": "https://paulmillr.com/funding/" - } - ] - }, - "node_modules/@nodelib/fs.scandir": { - "version": "2.1.5", - "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", - "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", - "dev": true, + "node_modules/@aws-sdk/util-middleware": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-middleware/-/util-middleware-3.310.0.tgz", + "integrity": "sha512-FTSUKL/eRb9X6uEZClrTe27QFXUNNp7fxYrPndZwk1hlaOP5ix+MIHBcI7pIiiY/JPfOUmPyZOu+HetlFXjWog==", + "license": "Apache-2.0", "dependencies": { - "@nodelib/fs.stat": "2.0.5", - "run-parallel": "^1.1.9" + "tslib": "^2.5.0" }, "engines": { - "node": ">= 8" + "node": ">=14.0.0" } }, - "node_modules/@nodelib/fs.stat": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", - "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", - "dev": true, + "node_modules/@aws-sdk/util-retry": { + "version": "3.327.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-retry/-/util-retry-3.327.0.tgz", + "integrity": "sha512-y15NLGTAT2vaLzA8klJ6Bo8NGjVAa3/njqc4iCbta/3GqKpQU0zbvw3Y5aWyHp8BhV4DSUTp088jWjaoZlSqgw==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/service-error-classification": "3.327.0", + "tslib": "^2.5.0" + }, "engines": { - "node": ">= 8" + "node": ">= 14.0.0" } }, - "node_modules/@nodelib/fs.walk": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", - "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", - "dev": true, + "node_modules/@aws-sdk/util-stream-browser": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-stream-browser/-/util-stream-browser-3.310.0.tgz", + "integrity": "sha512-bysXZHwFwvbqOTCScCdCnoLk1K3GCo0HRIYEZuL7O7MHrQmfaYRXcaft/p22+GUv9VeFXS/eJJZ5r4u32az94w==", + "license": "Apache-2.0", "dependencies": { - "@nodelib/fs.scandir": "2.1.5", - "fastq": "^1.6.0" + "@aws-sdk/fetch-http-handler": "3.310.0", + "@aws-sdk/types": "3.310.0", + "@aws-sdk/util-base64": "3.310.0", + "@aws-sdk/util-hex-encoding": "3.310.0", + "@aws-sdk/util-utf8": "3.310.0", + "tslib": "^2.5.0" + } + }, + "node_modules/@aws-sdk/util-stream-node": { + "version": "3.328.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-stream-node/-/util-stream-node-3.328.0.tgz", + "integrity": "sha512-9h8oji5OTmatXMfPIasAapL59QDO7TR0J/B5Y3ERwGxy2U373LEy8Uvs+mbPIIQV1ztCLwHWDxKQoTUj4hLxoQ==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/node-http-handler": "3.328.0", + "@aws-sdk/types": "3.310.0", + "@aws-sdk/util-buffer-from": "3.310.0", + "tslib": "^2.5.0" }, "engines": { - "node": ">= 8" + "node": ">=14.0.0" } }, - "node_modules/@project-serum/anchor": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/@project-serum/anchor/-/anchor-0.25.0.tgz", - "integrity": "sha512-E6A5Y/ijqpfMJ5psJvbw0kVTzLZFUcOFgs6eSM2M2iWE1lVRF18T6hWZVNl6zqZsoz98jgnNHtVGJMs+ds9A7A==", + "node_modules/@aws-sdk/util-uri-escape": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-uri-escape/-/util-uri-escape-3.310.0.tgz", + "integrity": "sha512-drzt+aB2qo2LgtDoiy/3sVG8w63cgLkqFIa2NFlGpUgHFWTXkqtbgf4L5QdjRGKWhmZsnqkbtL7vkSWEcYDJ4Q==", + "license": "Apache-2.0", "dependencies": { - "@project-serum/borsh": "^0.2.5", - "@solana/web3.js": "^1.36.0", - "base64-js": "^1.5.1", - "bn.js": "^5.1.2", - "bs58": "^4.0.1", - "buffer-layout": "^1.2.2", - "camelcase": "^5.3.1", - "cross-fetch": "^3.1.5", - "crypto-hash": "^1.3.0", - "eventemitter3": "^4.0.7", - "js-sha256": "^0.9.0", - "pako": "^2.0.3", - "snake-case": "^3.0.4", - "superstruct": "^0.15.4", - "toml": "^3.0.0" + "tslib": "^2.5.0" }, "engines": { - "node": ">=11" + "node": ">=14.0.0" } }, - "node_modules/@project-serum/borsh": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/@project-serum/borsh/-/borsh-0.2.5.tgz", - "integrity": "sha512-UmeUkUoKdQ7rhx6Leve1SssMR/Ghv8qrEiyywyxSWg7ooV7StdpPBhciiy5eB3T0qU1BXvdRNC8TdrkxK7WC5Q==", + "node_modules/@aws-sdk/util-user-agent-browser": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-user-agent-browser/-/util-user-agent-browser-3.310.0.tgz", + "integrity": "sha512-yU/4QnHHuQ5z3vsUqMQVfYLbZGYwpYblPiuZx4Zo9+x0PBkNjYMqctdDcrpoH9Z2xZiDN16AmQGK1tix117ZKw==", + "license": "Apache-2.0", "dependencies": { - "bn.js": "^5.1.2", - "buffer-layout": "^1.2.0" + "@aws-sdk/types": "3.310.0", + "bowser": "^2.11.0", + "tslib": "^2.5.0" + } + }, + "node_modules/@aws-sdk/util-user-agent-node": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-user-agent-node/-/util-user-agent-node-3.310.0.tgz", + "integrity": "sha512-Ra3pEl+Gn2BpeE7KiDGpi4zj7WJXZA5GXnGo3mjbi9+Y3zrbuhJAbdZO3mO/o7xDgMC6ph4xCTbaSGzU6b6EDg==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/node-config-provider": "3.310.0", + "@aws-sdk/types": "3.310.0", + "tslib": "^2.5.0" }, "engines": { - "node": ">=10" + "node": ">=14.0.0" }, "peerDependencies": { - "@solana/web3.js": "^1.2.0" + "aws-crt": ">=1.0.0" + }, + "peerDependenciesMeta": { + "aws-crt": { + "optional": true + } } }, - "node_modules/@project-serum/serum": { - "version": "0.13.65", - "resolved": "https://registry.npmjs.org/@project-serum/serum/-/serum-0.13.65.tgz", - "integrity": "sha512-BHRqsTqPSfFB5p+MgI2pjvMBAQtO8ibTK2fYY96boIFkCI3TTwXDt2gUmspeChKO2pqHr5aKevmexzAcXxrSRA==", + "node_modules/@aws-sdk/util-utf8": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-utf8/-/util-utf8-3.310.0.tgz", + "integrity": "sha512-DnLfFT8uCO22uOJc0pt0DsSNau1GTisngBCDw8jQuWT5CqogMJu4b/uXmwEqfj8B3GX6Xsz8zOd6JpRlPftQoA==", + "license": "Apache-2.0", "dependencies": { - "@project-serum/anchor": "^0.11.1", - "@solana/spl-token": "^0.1.6", - "@solana/web3.js": "^1.21.0", - "bn.js": "^5.1.2", - "buffer-layout": "^1.2.0" + "@aws-sdk/util-buffer-from": "3.310.0", + "tslib": "^2.5.0" }, "engines": { - "node": ">=10" + "node": ">=14.0.0" } }, - "node_modules/@project-serum/serum/node_modules/@project-serum/anchor": { - "version": "0.11.1", - "resolved": "https://registry.npmjs.org/@project-serum/anchor/-/anchor-0.11.1.tgz", - "integrity": "sha512-oIdm4vTJkUy6GmE6JgqDAuQPKI7XM4TPJkjtoIzp69RZe0iAD9JP2XHx7lV1jLdYXeYHqDXfBt3zcq7W91K6PA==", + "node_modules/@aws-sdk/util-utf8-browser": { + "version": "3.259.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-utf8-browser/-/util-utf8-browser-3.259.0.tgz", + "integrity": "sha512-UvFa/vR+e19XookZF8RzFZBrw2EUkQWxiBW0yYQAhvk3C+QVGl0H3ouca8LDBlBfQKXwmW3huo/59H8rwb1wJw==", + "license": "Apache-2.0", "dependencies": { - "@project-serum/borsh": "^0.2.2", - "@solana/web3.js": "^1.17.0", - "base64-js": "^1.5.1", - "bn.js": "^5.1.2", - "bs58": "^4.0.1", - "buffer-layout": "^1.2.0", - "camelcase": "^5.3.1", - "crypto-hash": "^1.3.0", - "eventemitter3": "^4.0.7", - "find": "^0.3.0", - "js-sha256": "^0.9.0", - "pako": "^2.0.3", - "snake-case": "^3.0.4", - "toml": "^3.0.0" - }, - "engines": { - "node": ">=11" + "tslib": "^2.3.1" } }, - "node_modules/@pythnetwork/client": { - "version": "2.8.0", - "resolved": "https://registry.npmjs.org/@pythnetwork/client/-/client-2.8.0.tgz", - "integrity": "sha512-YqqZSDDsEApC/F4H5ejcl8OCr7gsWv0noTK8YABT8pCtFRTQxXBP0r2S8KQMaIw1x97Mue/jkYybdMeFQzPjCw==", + "node_modules/@aws-sdk/util-waiter": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-waiter/-/util-waiter-3.310.0.tgz", + "integrity": "sha512-AV5j3guH/Y4REu+Qh3eXQU9igljHuU4XjX2sADAgf54C0kkhcCCkkiuzk3IsX089nyJCqIcj5idbjdvpnH88Vw==", + "license": "Apache-2.0", "dependencies": { - "buffer": "^6.0.1" + "@aws-sdk/abort-controller": "3.310.0", + "@aws-sdk/types": "3.310.0", + "tslib": "^2.5.0" }, - "peerDependencies": { - "@solana/web3.js": "^1.30.2" + "engines": { + "node": ">=14.0.0" } }, - "node_modules/@scure/base": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.1.tgz", - "integrity": "sha512-ZxOhsSyxYwLJj3pLZCefNitxsj093tb2vq90mp2txoYeBqbcjDjqFhyM8eUjq/uFm6zJ+mUuqxlS2FkuSY1MTA==", - "funding": [ - { - "type": "individual", - "url": "https://paulmillr.com/funding/" - } - ] - }, - "node_modules/@scure/bip32": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.1.0.tgz", - "integrity": "sha512-ftTW3kKX54YXLCxH6BB7oEEoJfoE2pIgw7MINKAs5PsS6nqKPuKk1haTF/EuHmYqG330t5GSrdmtRuHaY1a62Q==", - "funding": [ - { - "type": "individual", - "url": "https://paulmillr.com/funding/" - } - ], + "node_modules/@aws-sdk/xml-builder": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/xml-builder/-/xml-builder-3.310.0.tgz", + "integrity": "sha512-TqELu4mOuSIKQCqj63fGVs86Yh+vBx5nHRpWKNUNhB2nPTpfbziTs5c1X358be3peVWA4wPxW7Nt53KIg1tnNw==", + "license": "Apache-2.0", "dependencies": { - "@noble/hashes": "~1.1.1", - "@noble/secp256k1": "~1.6.0", - "@scure/base": "~1.1.0" + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" } }, - "node_modules/@scure/bip32/node_modules/@noble/secp256k1": { - "version": "1.6.3", - "resolved": "https://registry.npmjs.org/@noble/secp256k1/-/secp256k1-1.6.3.tgz", - "integrity": "sha512-T04e4iTurVy7I8Sw4+c5OSN9/RkPlo1uKxAomtxQNLq8j1uPAqnsqG1bqvY3Jv7c13gyr6dui0zmh/I3+f/JaQ==", - "funding": [ - { - "type": "individual", - "url": "https://paulmillr.com/funding/" - } - ] - }, - "node_modules/@scure/bip39": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.1.0.tgz", - "integrity": "sha512-pwrPOS16VeTKg98dYXQyIjJEcWfz7/1YJIwxUEPFfQPtc86Ym/1sVgQ2RLoD43AazMk2l/unK4ITySSpW2+82w==", - "funding": [ - { - "type": "individual", - "url": "https://paulmillr.com/funding/" - } - ], + "node_modules/@babel/code-frame": { + "version": "7.21.4", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.21.4.tgz", + "integrity": "sha512-LYvhNKfwWSPpocw8GI7gpK2nq3HSDuEPC/uSYaALSJu9xjsalaaYFOq0Pwt5KmVqwEbZlDu81aLXwBOmD/Fv9g==", + "peer": true, "dependencies": { - "@noble/hashes": "~1.1.1", - "@scure/base": "~1.1.0" + "@babel/highlight": "^7.18.6" + }, + "engines": { + "node": ">=6.9.0" } }, - "node_modules/@solana/buffer-layout": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/@solana/buffer-layout/-/buffer-layout-4.0.1.tgz", - "integrity": "sha512-E1ImOIAD1tBZFRdjeM4/pzTiTApC0AOBGwyAMS4fwIodCWArzJ3DWdoh8cKxeFM2fElkxBh2Aqts1BPC373rHA==", - "dependencies": { - "buffer": "~6.0.3" - }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.19.1", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.19.1.tgz", + "integrity": "sha512-awrNfaMtnHUr653GgGEs++LlAvW6w+DcPrOliSMXWCKo597CwL5Acf/wWdNkf/tfEQE3mjkeD1YOVZOUV/od1w==", + "peer": true, "engines": { - "node": ">=5.10" + "node": ">=6.9.0" } }, - "node_modules/@solana/buffer-layout/node_modules/buffer": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", - "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], + "node_modules/@babel/highlight": { + "version": "7.18.6", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.18.6.tgz", + "integrity": "sha512-u7stbOuYjaPezCuLj29hNW1v64M2Md2qupEKP1fHc7WdOA3DgLh37suiSrZYY7haUB7iBeQZ9P1uiRF359do3g==", + "peer": true, "dependencies": { - "base64-js": "^1.3.1", - "ieee754": "^1.2.1" + "@babel/helper-validator-identifier": "^7.18.6", + "chalk": "^2.0.0", + "js-tokens": "^4.0.0" + }, + "engines": { + "node": ">=6.9.0" } }, - "node_modules/@solana/buffer-layout/node_modules/ieee754": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", - "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] + "node_modules/@babel/highlight/node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "peer": true, + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } }, - "node_modules/@solana/spl-token": { - "version": "0.1.8", - "resolved": "https://registry.npmjs.org/@solana/spl-token/-/spl-token-0.1.8.tgz", - "integrity": "sha512-LZmYCKcPQDtJgecvWOgT/cnoIQPWjdH+QVyzPcFvyDUiT0DiRjZaam4aqNUyvchLFhzgunv3d9xOoyE34ofdoQ==", + "node_modules/@babel/highlight/node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "peer": true, "dependencies": { - "@babel/runtime": "^7.10.5", - "@solana/web3.js": "^1.21.0", - "bn.js": "^5.1.0", - "buffer": "6.0.3", - "buffer-layout": "^1.2.0", - "dotenv": "10.0.0" + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" }, "engines": { - "node": ">= 10" + "node": ">=4" } }, - "node_modules/@solana/spl-token/node_modules/buffer": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", - "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], + "node_modules/@babel/highlight/node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "peer": true, "dependencies": { - "base64-js": "^1.3.1", - "ieee754": "^1.2.1" + "color-name": "1.1.3" } }, - "node_modules/@solana/spl-token/node_modules/dotenv": { - "version": "10.0.0", - "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-10.0.0.tgz", - "integrity": "sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q==", + "node_modules/@babel/highlight/node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "peer": true + }, + "node_modules/@babel/highlight/node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "peer": true, "engines": { - "node": ">=10" + "node": ">=0.8.0" } }, - "node_modules/@solana/spl-token/node_modules/ieee754": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", - "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] + "node_modules/@babel/highlight/node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "peer": true, + "engines": { + "node": ">=4" + } }, - "node_modules/@solana/web3.js": { - "version": "1.72.0", - "resolved": "https://registry.npmjs.org/@solana/web3.js/-/web3.js-1.72.0.tgz", - "integrity": "sha512-xMoCk0y/GpiQhHbRjMcrd5NpmkwhAA0c01id7lrr6nhNdz6Uc/CywPdBeZw3Qz6BVZ/qlUoerpKPWeiXqMUjwA==", + "node_modules/@babel/highlight/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "peer": true, "dependencies": { - "@babel/runtime": "^7.12.5", - "@noble/ed25519": "^1.7.0", - "@noble/hashes": "^1.1.2", - "@noble/secp256k1": "^1.6.3", - "@solana/buffer-layout": "^4.0.0", - "agentkeepalive": "^4.2.1", - "bigint-buffer": "^1.1.5", - "bn.js": "^5.0.0", - "borsh": "^0.7.0", - "bs58": "^4.0.1", - "buffer": "6.0.1", - "fast-stable-stringify": "^1.0.0", - "jayson": "^3.4.4", - "node-fetch": "2", - "rpc-websockets": "^7.5.0", - "superstruct": "^0.14.2" + "has-flag": "^3.0.0" }, "engines": { - "node": ">=12.20.0" + "node": ">=4" } }, - "node_modules/@solana/web3.js/node_modules/superstruct": { - "version": "0.14.2", - "resolved": "https://registry.npmjs.org/superstruct/-/superstruct-0.14.2.tgz", - "integrity": "sha512-nPewA6m9mR3d6k7WkZ8N8zpTWfenFH3q9pA2PkuiZxINr9DKB2+40wEQf0ixn8VaGuJ78AB6iWOtStI+/4FKZQ==" - }, - "node_modules/@solendprotocol/solend-sdk": { - "version": "0.6.9", - "resolved": "https://registry.npmjs.org/@solendprotocol/solend-sdk/-/solend-sdk-0.6.9.tgz", - "integrity": "sha512-KToDqIDsn11hdNY3M/Lew5spSF2ML2S8q5H21pwjVxFW1BV01Mgm0Y1sD6pLnQ9epQUAqxtbGj1oUETs6bqFMQ==", + "node_modules/@babel/runtime": { + "version": "7.21.5", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.21.5.tgz", + "integrity": "sha512-8jI69toZqqcsnqGGqwGS4Qb1VwLOEp4hz+CXPywcvjs60u3B4Pom/U/7rm4W8tMOYEB+E9wgD0mW1l3r8qlI9Q==", + "license": "MIT", "dependencies": { - "@marinade.finance/marinade-ts-sdk": "^3.1.1", - "@mithraic-labs/psy-american": "^0.2.1", - "@project-serum/anchor": "^0.24.2", - "@pythnetwork/client": "^2.5.1", - "@solana/buffer-layout": "^4.0.0", - "@solana/spl-token": "^0.1.8", - "@solana/web3.js": "^1.66.2", - "axios": "^0.24.0", - "bignumber.js": "^9.0.2", - "bn.js": "^5.2.0", - "buffer": "^6.0.3", - "buffer-layout": "^1.2.0", - "hot-shots": "^9.3.0", - "isomorphic-fetch": "^3.0.0", - "jsbi": "^4.3.0", - "typedoc-plugin-cname": "^1.0.1" + "regenerator-runtime": "^0.13.11" + }, + "engines": { + "node": ">=6.9.0" } }, - "node_modules/@solendprotocol/solend-sdk/node_modules/@project-serum/anchor": { - "version": "0.24.2", - "resolved": "https://registry.npmjs.org/@project-serum/anchor/-/anchor-0.24.2.tgz", - "integrity": "sha512-0/718g8/DnEuwAidUwh5wLYphUYXhUbiClkuRNhvNoa+1Y8a4g2tJyxoae+emV+PG/Gikd/QUBNMkIcimiIRTA==", + "node_modules/@bundlr-network/client": { + "version": "0.7.17", + "resolved": "https://registry.npmjs.org/@bundlr-network/client/-/client-0.7.17.tgz", + "integrity": "sha512-1qTDrwgmgeh0pO24JbeGt2W8GlpWYkVnQ8AhEZ02Lm00J7RALSyma3C5pNlKuvAQBczL1r9KhLr9KHK1og3J0g==", + "license": "Apache-2.0", "dependencies": { - "@project-serum/borsh": "^0.2.5", + "@solana/wallet-adapter-base": "^0.9.2", "@solana/web3.js": "^1.36.0", + "@supercharge/promise-pool": "^2.1.0", + "algosdk": "^1.13.1", + "arbundles": "^0.6.20", + "arweave": "^1.11.4", + "async-retry": "^1.3.3", + "axios": "^0.25.0", + "base64url": "^3.0.1", + "bignumber.js": "^9.0.1", + "bs58": "^4.0.1", + "commander": "^8.2.0", + "csv": "^6.0.5", + "ethers": "^5.5.1", + "inquirer": "^8.2.0", + "js-sha256": "^0.9.0", + "mime-types": "^2.1.34", + "near-api-js": "^0.44.2", + "near-seed-phrase": "^0.2.0" + }, + "bin": { + "bundlr": "build/node/cli.js" + } + }, + "node_modules/@bundlr-network/client/node_modules/axios": { + "version": "0.25.0", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.25.0.tgz", + "integrity": "sha512-cD8FOb0tRH3uuEe6+evtAbgJtfxr7ly3fQjYcMcuPlgkwVS9xboaVIpcDV+cYQe+yGykgwZCs1pzjntcGa6l5g==", + "license": "MIT", + "dependencies": { + "follow-redirects": "^1.14.7" + } + }, + "node_modules/@bundlr-network/client/node_modules/commander": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-8.3.0.tgz", + "integrity": "sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==", + "license": "MIT", + "engines": { + "node": ">= 12" + } + }, + "node_modules/@coral-xyz/anchor": { + "version": "0.26.0", + "resolved": "https://registry.npmjs.org/@coral-xyz/anchor/-/anchor-0.26.0.tgz", + "integrity": "sha512-PxRl+wu5YyptWiR9F2MBHOLLibm87Z4IMUBPreX+DYBtPM+xggvcPi0KAN7+kIL4IrIhXI8ma5V0MCXxSN1pHg==", + "license": "(MIT OR Apache-2.0)", + "dependencies": { + "@coral-xyz/borsh": "^0.26.0", + "@solana/web3.js": "^1.68.0", "base64-js": "^1.5.1", "bn.js": "^5.1.2", "bs58": "^4.0.1", "buffer-layout": "^1.2.2", - "camelcase": "^5.3.1", + "camelcase": "^6.3.0", "cross-fetch": "^3.1.5", "crypto-hash": "^1.3.0", "eventemitter3": "^4.0.7", "js-sha256": "^0.9.0", "pako": "^2.0.3", "snake-case": "^3.0.4", + "superstruct": "^0.15.4", "toml": "^3.0.0" }, "engines": { "node": ">=11" } }, - "node_modules/@solendprotocol/solend-sdk/node_modules/axios": { - "version": "0.24.0", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.24.0.tgz", - "integrity": "sha512-Q6cWsys88HoPgAaFAVUb0WpPk0O8iTeisR9IMqy9G8AbO4NlpVknrnQS03zzF9PGAWgO3cgletO3VjV/P7VztA==", + "node_modules/@coral-xyz/anchor/node_modules/camelcase": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", + "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@coral-xyz/borsh": { + "version": "0.26.0", + "resolved": "https://registry.npmjs.org/@coral-xyz/borsh/-/borsh-0.26.0.tgz", + "integrity": "sha512-uCZ0xus0CszQPHYfWAqKS5swS1UxvePu83oOF+TWpUkedsNlg6p2p4azxZNSSqwXb9uXMFgxhuMBX9r3Xoi0vQ==", + "license": "Apache-2.0", "dependencies": { - "follow-redirects": "^1.14.4" + "bn.js": "^5.1.2", + "buffer-layout": "^1.2.0" + }, + "engines": { + "node": ">=10" + }, + "peerDependencies": { + "@solana/web3.js": "^1.68.0" } }, - "node_modules/@solendprotocol/solend-sdk/node_modules/buffer": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", - "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], + "node_modules/@cspotcode/source-map-support": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", + "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", + "dev": true, + "license": "MIT", "dependencies": { - "base64-js": "^1.3.1", - "ieee754": "^1.2.1" + "@jridgewell/trace-mapping": "0.3.9" + }, + "engines": { + "node": ">=12" } }, - "node_modules/@solendprotocol/solend-sdk/node_modules/ieee754": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", - "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "node_modules/@defillama/sdk": { + "version": "4.0.12", + "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.12.tgz", + "integrity": "sha512-UeuMkrbz9zS2ze4Q5w2gohUapvRc3NupSVgBAr2SMv1p7W7omgQ6AIuvzcw3Q4sv/T/JhP9wWUPMK56VzIN74g==", + "dependencies": { + "@supercharge/promise-pool": "^2.1.0", + "ethers": "^5.4.5", + "node-fetch": "^2.6.7" + } + }, + "node_modules/@eslint-community/eslint-utils": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", + "integrity": "sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==", + "dev": true, + "license": "MIT", + "dependencies": { + "eslint-visitor-keys": "^3.3.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" + } + }, + "node_modules/@eslint-community/regexpp": { + "version": "4.5.1", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.5.1.tgz", + "integrity": "sha512-Z5ba73P98O1KUYCCJTUeVpja9RcGoMdncZ6T49FCUl2lN38JtCJ+3WgIDBv0AuY4WChU5PmtJmOCTlN6FZTFKQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.0.0 || ^14.0.0 || >=16.0.0" + } + }, + "node_modules/@eslint/eslintrc": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.0.3.tgz", + "integrity": "sha512-+5gy6OQfk+xx3q0d6jGZZC3f3KzAkXc/IanVxd1is/VIIziRqqt3ongQz0FiTUXqTk0c7aDB3OaFuKnuSoJicQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ajv": "^6.12.4", + "debug": "^4.3.2", + "espree": "^9.5.2", + "globals": "^13.19.0", + "ignore": "^5.2.0", + "import-fresh": "^3.2.1", + "js-yaml": "^4.1.0", + "minimatch": "^3.1.2", + "strip-json-comments": "^3.1.1" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@eslint/js": { + "version": "8.40.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.40.0.tgz", + "integrity": "sha512-ElyB54bJIhXQYVKjDSvCkPO1iU1tSAeVQJbllWJq1XQSmmA4dgFk8CbiBGpiOPxleE48vDogxCtmMYku4HSVLA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, + "node_modules/@ethersproject/abi": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/abi/-/abi-5.7.0.tgz", + "integrity": "sha512-351ktp42TiRcYB3H1OP8yajPeAQstMW/yCFokj/AthP9bLHzQFPlOrxOcwYEDkUAICmOHljvN4K39OMTMUa9RA==", "funding": [ { - "type": "github", - "url": "https://github.com/sponsors/feross" + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" }, { - "type": "patreon", - "url": "https://www.patreon.com/feross" + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", + "dependencies": { + "@ethersproject/address": "^5.7.0", + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/constants": "^5.7.0", + "@ethersproject/hash": "^5.7.0", + "@ethersproject/keccak256": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/strings": "^5.7.0" + } + }, + "node_modules/@ethersproject/abstract-provider": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/abstract-provider/-/abstract-provider-5.7.0.tgz", + "integrity": "sha512-R41c9UkchKCpAqStMYUpdunjo3pkEvZC3FAwZn5S5MGbXoMQOHIdHItezTETxAO5bevtMApSyEhn9+CHcDsWBw==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" }, { - "type": "consulting", - "url": "https://feross.org/support" + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" } - ] + ], + "license": "MIT", + "dependencies": { + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/networks": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/transactions": "^5.7.0", + "@ethersproject/web": "^5.7.0" + } }, - "node_modules/@solendprotocol/solend-sdk/node_modules/typedoc": { - "version": "0.20.37", - "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.20.37.tgz", - "integrity": "sha512-9+qDhdc4X00qTNOtii6QX2z7ndAeWVOso7w3MPSoSJdXlVhpwPfm1yEp4ooKuWA9fiQILR8FKkyjmeqa13hBbw==", - "peer": true, + "node_modules/@ethersproject/abstract-signer": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/abstract-signer/-/abstract-signer-5.7.0.tgz", + "integrity": "sha512-a16V8bq1/Cz+TGCkE2OPMTOUDLS3grCpdjoJCYNnVBbdYEMSgKrU0+B90s8b6H+ByYTBZN7a3g76jdIJi7UfKQ==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", "dependencies": { - "colors": "^1.4.0", - "fs-extra": "^9.1.0", - "handlebars": "^4.7.7", - "lodash": "^4.17.21", - "lunr": "^2.3.9", - "marked": "~2.0.3", - "minimatch": "^3.0.0", - "progress": "^2.0.3", - "shelljs": "^0.8.4", - "shiki": "^0.9.3", - "typedoc-default-themes": "^0.12.10" - }, - "bin": { - "typedoc": "bin/typedoc" - }, + "@ethersproject/abstract-provider": "^5.7.0", + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0" + } + }, + "node_modules/@ethersproject/address": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/address/-/address-5.7.0.tgz", + "integrity": "sha512-9wYhYt7aghVGo758POM5nqcOMaE168Q6aRLJZwUmiqSrAungkG74gSSeKEIR7ukixesdRZGPgVqme6vmxs1fkA==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", + "dependencies": { + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/keccak256": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/rlp": "^5.7.0" + } + }, + "node_modules/@ethersproject/base64": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/base64/-/base64-5.7.0.tgz", + "integrity": "sha512-Dr8tcHt2mEbsZr/mwTPIQAf3Ai0Bks/7gTw9dSqk1mQvhW3XvRlmDJr/4n+wg1JmCl16NZue17CDh8xb/vZ0sQ==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", + "dependencies": { + "@ethersproject/bytes": "^5.7.0" + } + }, + "node_modules/@ethersproject/basex": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/basex/-/basex-5.7.0.tgz", + "integrity": "sha512-ywlh43GwZLv2Voc2gQVTKBoVQ1mti3d8HK5aMxsfu/nRDnMmNqaSJ3r3n85HBByT8OpoY96SXM1FogC533T4zw==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", + "dependencies": { + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/properties": "^5.7.0" + } + }, + "node_modules/@ethersproject/bignumber": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/bignumber/-/bignumber-5.7.0.tgz", + "integrity": "sha512-n1CAdIHRWjSucQO3MC1zPSVgV/6dy/fjL9pMrPP9peL+QxEg9wOsVqwD4+818B6LUEtaXzVHQiuivzRoxPxUGw==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", + "dependencies": { + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "bn.js": "^5.2.1" + } + }, + "node_modules/@ethersproject/bytes": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/bytes/-/bytes-5.7.0.tgz", + "integrity": "sha512-nsbxwgFXWh9NyYWo+U8atvmMsSdKJprTcICAkvbBffT75qDocbuggBU0SJiVK2MuTrp0q+xvLkTnGMPK1+uA9A==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", + "dependencies": { + "@ethersproject/logger": "^5.7.0" + } + }, + "node_modules/@ethersproject/constants": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/constants/-/constants-5.7.0.tgz", + "integrity": "sha512-DHI+y5dBNvkpYUMiRQyxRBYBefZkJfo70VUkUAsRjcPs47muV9evftfZ0PJVCXYbAiCgght0DtcF9srFQmIgWA==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", + "dependencies": { + "@ethersproject/bignumber": "^5.7.0" + } + }, + "node_modules/@ethersproject/contracts": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/contracts/-/contracts-5.7.0.tgz", + "integrity": "sha512-5GJbzEU3X+d33CdfPhcyS+z8MzsTrBGk/sc+G+59+tPa9yFkl6HQ9D6L0QMgNTA9q8dT0XKxxkyp883XsQvbbg==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", + "dependencies": { + "@ethersproject/abi": "^5.7.0", + "@ethersproject/abstract-provider": "^5.7.0", + "@ethersproject/abstract-signer": "^5.7.0", + "@ethersproject/address": "^5.7.0", + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/constants": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/transactions": "^5.7.0" + } + }, + "node_modules/@ethersproject/hash": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/hash/-/hash-5.7.0.tgz", + "integrity": "sha512-qX5WrQfnah1EFnO5zJv1v46a8HW0+E5xuBBDTwMFZLuVTx0tbU2kkx15NqdjxecrLGatQN9FGQKpb1FKdHCt+g==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", + "dependencies": { + "@ethersproject/abstract-signer": "^5.7.0", + "@ethersproject/address": "^5.7.0", + "@ethersproject/base64": "^5.7.0", + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/keccak256": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/strings": "^5.7.0" + } + }, + "node_modules/@ethersproject/hdnode": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/hdnode/-/hdnode-5.7.0.tgz", + "integrity": "sha512-OmyYo9EENBPPf4ERhR7oj6uAtUAhYGqOnIS+jE5pTXvdKBS99ikzq1E7Iv0ZQZ5V36Lqx1qZLeak0Ra16qpeOg==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", + "dependencies": { + "@ethersproject/abstract-signer": "^5.7.0", + "@ethersproject/basex": "^5.7.0", + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/pbkdf2": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/sha2": "^5.7.0", + "@ethersproject/signing-key": "^5.7.0", + "@ethersproject/strings": "^5.7.0", + "@ethersproject/transactions": "^5.7.0", + "@ethersproject/wordlists": "^5.7.0" + } + }, + "node_modules/@ethersproject/json-wallets": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/json-wallets/-/json-wallets-5.7.0.tgz", + "integrity": "sha512-8oee5Xgu6+RKgJTkvEMl2wDgSPSAQ9MB/3JYjFV9jlKvcYHUXZC+cQp0njgmxdHkYWn8s6/IqIZYm0YWCjO/0g==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", + "dependencies": { + "@ethersproject/abstract-signer": "^5.7.0", + "@ethersproject/address": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/hdnode": "^5.7.0", + "@ethersproject/keccak256": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/pbkdf2": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/random": "^5.7.0", + "@ethersproject/strings": "^5.7.0", + "@ethersproject/transactions": "^5.7.0", + "aes-js": "3.0.0", + "scrypt-js": "3.0.1" + } + }, + "node_modules/@ethersproject/keccak256": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/keccak256/-/keccak256-5.7.0.tgz", + "integrity": "sha512-2UcPboeL/iW+pSg6vZ6ydF8tCnv3Iu/8tUmLLzWWGzxWKFFqOBQFLo6uLUv6BDrLgCDfN28RJ/wtByx+jZ4KBg==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", + "dependencies": { + "@ethersproject/bytes": "^5.7.0", + "js-sha3": "0.8.0" + } + }, + "node_modules/@ethersproject/logger": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/logger/-/logger-5.7.0.tgz", + "integrity": "sha512-0odtFdXu/XHtjQXJYA3u9G0G8btm0ND5Cu8M7i5vhEcE8/HmF4Lbdqanwyv4uQTr2tx6b7fQRmgLrsnpQlmnig==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT" + }, + "node_modules/@ethersproject/networks": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/@ethersproject/networks/-/networks-5.7.1.tgz", + "integrity": "sha512-n/MufjFYv3yFcUyfhnXotyDlNdFb7onmkSy8aQERi2PjNcnWQ66xXxa3XlS8nCcA8aJKJjIIMNJTC7tu80GwpQ==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", + "dependencies": { + "@ethersproject/logger": "^5.7.0" + } + }, + "node_modules/@ethersproject/pbkdf2": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/pbkdf2/-/pbkdf2-5.7.0.tgz", + "integrity": "sha512-oR/dBRZR6GTyaofd86DehG72hY6NpAjhabkhxgr3X2FpJtJuodEl2auADWBZfhDHgVCbu3/H/Ocq2uC6dpNjjw==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", + "dependencies": { + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/sha2": "^5.7.0" + } + }, + "node_modules/@ethersproject/properties": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/properties/-/properties-5.7.0.tgz", + "integrity": "sha512-J87jy8suntrAkIZtecpxEPxY//szqr1mlBaYlQ0r4RCaiD2hjheqF9s1LVE8vVuJCXisjIP+JgtK/Do54ej4Sw==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", + "dependencies": { + "@ethersproject/logger": "^5.7.0" + } + }, + "node_modules/@ethersproject/providers": { + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/@ethersproject/providers/-/providers-5.7.2.tgz", + "integrity": "sha512-g34EWZ1WWAVgr4aptGlVBF8mhl3VWjv+8hoAnzStu8Ah22VHBsuGzP17eb6xDVRzw895G4W7vvx60lFFur/1Rg==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", + "dependencies": { + "@ethersproject/abstract-provider": "^5.7.0", + "@ethersproject/abstract-signer": "^5.7.0", + "@ethersproject/address": "^5.7.0", + "@ethersproject/base64": "^5.7.0", + "@ethersproject/basex": "^5.7.0", + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/constants": "^5.7.0", + "@ethersproject/hash": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/networks": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/random": "^5.7.0", + "@ethersproject/rlp": "^5.7.0", + "@ethersproject/sha2": "^5.7.0", + "@ethersproject/strings": "^5.7.0", + "@ethersproject/transactions": "^5.7.0", + "@ethersproject/web": "^5.7.0", + "bech32": "1.1.4", + "ws": "7.4.6" + } + }, + "node_modules/@ethersproject/providers/node_modules/ws": { + "version": "7.4.6", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.4.6.tgz", + "integrity": "sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A==", + "license": "MIT", + "engines": { + "node": ">=8.3.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": "^5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/@ethersproject/random": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/random/-/random-5.7.0.tgz", + "integrity": "sha512-19WjScqRA8IIeWclFme75VMXSBvi4e6InrUNuaR4s5pTF2qNhcGdCUwdxUVGtDDqC00sDLCO93jPQoDUH4HVmQ==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", + "dependencies": { + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0" + } + }, + "node_modules/@ethersproject/rlp": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/rlp/-/rlp-5.7.0.tgz", + "integrity": "sha512-rBxzX2vK8mVF7b0Tol44t5Tb8gomOHkj5guL+HhzQ1yBh/ydjGnpw6at+X6Iw0Kp3OzzzkcKp8N9r0W4kYSs9w==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", + "dependencies": { + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0" + } + }, + "node_modules/@ethersproject/sha2": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/sha2/-/sha2-5.7.0.tgz", + "integrity": "sha512-gKlH42riwb3KYp0reLsFTokByAKoJdgFCwI+CCiX/k+Jm2mbNs6oOaCjYQSlI1+XBVejwH2KrmCbMAT/GnRDQw==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", + "dependencies": { + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "hash.js": "1.1.7" + } + }, + "node_modules/@ethersproject/signing-key": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/signing-key/-/signing-key-5.7.0.tgz", + "integrity": "sha512-MZdy2nL3wO0u7gkB4nA/pEf8lu1TlFswPNmy8AiYkfKTdO6eXBJyUdmHO/ehm/htHw9K/qF8ujnTyUAD+Ry54Q==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", + "dependencies": { + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "bn.js": "^5.2.1", + "elliptic": "6.5.4", + "hash.js": "1.1.7" + } + }, + "node_modules/@ethersproject/solidity": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/solidity/-/solidity-5.7.0.tgz", + "integrity": "sha512-HmabMd2Dt/raavyaGukF4XxizWKhKQ24DoLtdNbBmNKUOPqwjsKQSdV9GQtj9CBEea9DlzETlVER1gYeXXBGaA==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", + "dependencies": { + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/keccak256": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/sha2": "^5.7.0", + "@ethersproject/strings": "^5.7.0" + } + }, + "node_modules/@ethersproject/strings": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/strings/-/strings-5.7.0.tgz", + "integrity": "sha512-/9nu+lj0YswRNSH0NXYqrh8775XNyEdUQAuf3f+SmOrnVewcJ5SBNAjF7lpgehKi4abvNNXyf+HX86czCdJ8Mg==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", + "dependencies": { + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/constants": "^5.7.0", + "@ethersproject/logger": "^5.7.0" + } + }, + "node_modules/@ethersproject/transactions": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/transactions/-/transactions-5.7.0.tgz", + "integrity": "sha512-kmcNicCp1lp8qanMTC3RIikGgoJ80ztTyvtsFvCYpSCfkjhD0jZ2LOrnbcuxuToLIUYYf+4XwD1rP+B/erDIhQ==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", + "dependencies": { + "@ethersproject/address": "^5.7.0", + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/constants": "^5.7.0", + "@ethersproject/keccak256": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/rlp": "^5.7.0", + "@ethersproject/signing-key": "^5.7.0" + } + }, + "node_modules/@ethersproject/units": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/units/-/units-5.7.0.tgz", + "integrity": "sha512-pD3xLMy3SJu9kG5xDGI7+xhTEmGXlEqXU4OfNapmfnxLVY4EMSSRp7j1k7eezutBPH7RBN/7QPnwR7hzNlEFeg==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", + "dependencies": { + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/constants": "^5.7.0", + "@ethersproject/logger": "^5.7.0" + } + }, + "node_modules/@ethersproject/wallet": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/wallet/-/wallet-5.7.0.tgz", + "integrity": "sha512-MhmXlJXEJFBFVKrDLB4ZdDzxcBxQ3rLyCkhNqVu3CDYvR97E+8r01UgrI+TI99Le+aYm/in/0vp86guJuM7FCA==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", + "dependencies": { + "@ethersproject/abstract-provider": "^5.7.0", + "@ethersproject/abstract-signer": "^5.7.0", + "@ethersproject/address": "^5.7.0", + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/hash": "^5.7.0", + "@ethersproject/hdnode": "^5.7.0", + "@ethersproject/json-wallets": "^5.7.0", + "@ethersproject/keccak256": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/random": "^5.7.0", + "@ethersproject/signing-key": "^5.7.0", + "@ethersproject/transactions": "^5.7.0", + "@ethersproject/wordlists": "^5.7.0" + } + }, + "node_modules/@ethersproject/web": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/@ethersproject/web/-/web-5.7.1.tgz", + "integrity": "sha512-Gueu8lSvyjBWL4cYsWsjh6MtMwM0+H4HvqFPZfB6dV8ctbP9zFAO73VG1cMWae0FLPCtz0peKPpZY8/ugJJX2w==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", + "dependencies": { + "@ethersproject/base64": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/strings": "^5.7.0" + } + }, + "node_modules/@ethersproject/wordlists": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/wordlists/-/wordlists-5.7.0.tgz", + "integrity": "sha512-S2TFNJNfHWVHNE6cNDjbVlZ6MgE17MIxMbMg2zv3wn+3XSJGosL1m9ZVv3GXCf/2ymSsQ+hRI5IzoMJTG6aoVA==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", + "dependencies": { + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/hash": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/strings": "^5.7.0" + } + }, + "node_modules/@hapi/hoek": { + "version": "9.3.0", + "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.3.0.tgz", + "integrity": "sha512-/c6rf4UJlmHlC9b5BaNvzAcFv7HZ2QHaV0D4/HNlBdvFnvQq8RI4kYdhyPCl7Xj+oWvTWQ8ujhqS53LIgAe6KQ==", + "license": "BSD-3-Clause" + }, + "node_modules/@hapi/topo": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/@hapi/topo/-/topo-5.1.0.tgz", + "integrity": "sha512-foQZKJig7Ob0BMAYBfcJk8d77QtOe7Wo4ox7ff1lQYoNNAb6jwcY1ncdoy2e9wQZzvNy7ODZCYJkK8kzmcAnAg==", + "license": "BSD-3-Clause", + "dependencies": { + "@hapi/hoek": "^9.0.0" + } + }, + "node_modules/@hover-labs/kolibri-js": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/@hover-labs/kolibri-js/-/kolibri-js-4.1.3.tgz", + "integrity": "sha512-ZmW4x+7XptaQnE5nw3AJU7L5AHxHE/E0Qy0rWKjd23MM/V6vd2CODbR9UC0Rh1dVmWioprj0KbTEqg499OM7ow==", + "license": "MIT", + "dependencies": { + "@taquito/signer": "^12.0.2", + "@taquito/taquito": "^12.0.2", + "@temple-wallet/dapp": "^5.0.2", + "axios": "^0.21.0", + "bignumber.js": "^9.0.1", + "blakejs": "^1.1.1", + "bs58check": "^2.1.2", + "decimal.js": "^10.3.1", + "lodash": "^4.17.21" + } + }, + "node_modules/@hover-labs/kolibri-js/node_modules/@taquito/http-utils": { + "version": "12.1.1", + "resolved": "https://registry.npmjs.org/@taquito/http-utils/-/http-utils-12.1.1.tgz", + "integrity": "sha512-Zlp/eTRVjFs0XEIiAhgxkh6s9npF4dO+e/Sm2XWsDmNPoGI2jdXNH0L+NiKJIOkYcu0CXlcgriTeEaYnbeTvcA==", + "dependencies": { + "axios": "^0.26.0" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@hover-labs/kolibri-js/node_modules/@taquito/http-utils/node_modules/axios": { + "version": "0.26.1", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.26.1.tgz", + "integrity": "sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA==", + "dependencies": { + "follow-redirects": "^1.14.8" + } + }, + "node_modules/@hover-labs/kolibri-js/node_modules/@taquito/michel-codec": { + "version": "12.1.1", + "resolved": "https://registry.npmjs.org/@taquito/michel-codec/-/michel-codec-12.1.1.tgz", + "integrity": "sha512-BAig8YyLyRW5kxV/r0S191W+SvYuiTRJpgSp5IsgCDLAOh+d4/xq6IgU3PuGJgokQDstZdTbjpkrgRCnufR8lw==", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@hover-labs/kolibri-js/node_modules/@taquito/michelson-encoder": { + "version": "12.1.1", + "resolved": "https://registry.npmjs.org/@taquito/michelson-encoder/-/michelson-encoder-12.1.1.tgz", + "integrity": "sha512-mWcA1DHHlFj7UswJpEmml853x9e0IYHyeiKZYAo7DtizHz0jiUWtptCuEWiPQ4fMOreFbYZ6KVYenoVfQVNrqA==", + "dependencies": { + "@taquito/rpc": "^12.1.1", + "@taquito/utils": "^12.1.1", + "bignumber.js": "^9.0.2", + "fast-json-stable-stringify": "^2.1.0" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@hover-labs/kolibri-js/node_modules/@taquito/rpc": { + "version": "12.1.1", + "resolved": "https://registry.npmjs.org/@taquito/rpc/-/rpc-12.1.1.tgz", + "integrity": "sha512-CgAF9kdmKLa/UbmiqApDtncCQGiG7kEOIYis8IIa0JUT9JD1H8WBbSNF/oNh4e0soWUK9BL2qU369RFnxIW+iA==", + "dependencies": { + "@taquito/http-utils": "^12.1.1", + "@taquito/utils": "^12.1.1", + "bignumber.js": "^9.0.2" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@hover-labs/kolibri-js/node_modules/@taquito/taquito": { + "version": "12.1.1", + "resolved": "https://registry.npmjs.org/@taquito/taquito/-/taquito-12.1.1.tgz", + "integrity": "sha512-HvbtClQ7isrDd17X/LEKkPzzeVYA8EMUem3qrkl9qvDO6FpJx/QLbUpYfT2PC0pLUkSrzdLGzmESHAOZhcksaw==", + "hasInstallScript": true, + "dependencies": { + "@taquito/http-utils": "^12.1.1", + "@taquito/local-forging": "^12.1.1", + "@taquito/michel-codec": "^12.1.1", + "@taquito/michelson-encoder": "^12.1.1", + "@taquito/rpc": "^12.1.1", + "@taquito/utils": "^12.1.1", + "bignumber.js": "^9.0.2", + "rxjs": "^6.6.3" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@hover-labs/kolibri-js/node_modules/axios": { + "version": "0.21.4", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.4.tgz", + "integrity": "sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==", + "license": "MIT", + "dependencies": { + "follow-redirects": "^1.14.0" + } + }, + "node_modules/@hover-labs/kolibri-js/node_modules/rxjs": { + "version": "6.6.7", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.7.tgz", + "integrity": "sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ==", + "dependencies": { + "tslib": "^1.9.0" + }, + "engines": { + "npm": ">=2.0.0" + } + }, + "node_modules/@hover-labs/kolibri-js/node_modules/tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" + }, + "node_modules/@humanwhocodes/config-array": { + "version": "0.11.8", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.8.tgz", + "integrity": "sha512-UybHIJzJnR5Qc/MsD9Kr+RpO2h+/P1GhOwdiLPXK5TWk5sgTdu88bTD9UP+CKbPPh5Rni1u0GjAdYQLemG8g+g==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@humanwhocodes/object-schema": "^1.2.1", + "debug": "^4.1.1", + "minimatch": "^3.0.5" + }, + "engines": { + "node": ">=10.10.0" + } + }, + "node_modules/@humanwhocodes/module-importer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", + "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=12.22" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@humanwhocodes/object-schema": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", + "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", + "dev": true, + "license": "BSD-3-Clause" + }, + "node_modules/@jest/types": { + "version": "26.6.2", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-26.6.2.tgz", + "integrity": "sha512-fC6QCp7Sc5sX6g8Tvbmj4XUTbyrik0akgRy03yjXbQaBWWNWGE7SGtJk98m0N8nzegD/7SggrUlivxo5ax4KWQ==", + "peer": true, + "dependencies": { + "@types/istanbul-lib-coverage": "^2.0.0", + "@types/istanbul-reports": "^3.0.0", + "@types/node": "*", + "@types/yargs": "^15.0.0", + "chalk": "^4.0.0" + }, + "engines": { + "node": ">= 10.14.2" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz", + "integrity": "sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.4.15", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", + "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==", + "dev": true, + "license": "MIT" + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", + "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/resolve-uri": "^3.0.3", + "@jridgewell/sourcemap-codec": "^1.4.10" + } + }, + "node_modules/@marinade.finance/marinade-ts-sdk": { + "version": "3.1.4", + "resolved": "https://registry.npmjs.org/@marinade.finance/marinade-ts-sdk/-/marinade-ts-sdk-3.1.4.tgz", + "integrity": "sha512-gnjgQyBHev9nUROlirazTHved9nUzs3WEHqu50yYceYZucKAXvFltE2YgOywGNTfrLI/MMsWIQLmurwDFdbDnA==", + "license": "ISC", + "dependencies": { + "@project-serum/anchor": "^0.18.2", + "@solana/spl-token": "^0.1.8", + "bignumber.js": "^9.1.0", + "borsh": "^0.6.0", + "bs58": "^5.0.0" + } + }, + "node_modules/@marinade.finance/marinade-ts-sdk/node_modules/@project-serum/anchor": { + "version": "0.18.2", + "resolved": "https://registry.npmjs.org/@project-serum/anchor/-/anchor-0.18.2.tgz", + "integrity": "sha512-uyjiN/3Ipp+4hrZRm/hG18HzGLZyvP790LXrCsGO3IWxSl28YRhiGEpKnZycfMW94R7nxdUoE3wY67V+ZHSQBQ==", + "license": "(MIT OR Apache-2.0)", + "dependencies": { + "@project-serum/borsh": "^0.2.2", + "@solana/web3.js": "^1.17.0", + "base64-js": "^1.5.1", + "bn.js": "^5.1.2", + "bs58": "^4.0.1", + "buffer-layout": "^1.2.0", + "camelcase": "^5.3.1", + "crypto-hash": "^1.3.0", + "eventemitter3": "^4.0.7", + "find": "^0.3.0", + "js-sha256": "^0.9.0", + "pako": "^2.0.3", + "snake-case": "^3.0.4", + "toml": "^3.0.0" + }, + "engines": { + "node": ">=11" + } + }, + "node_modules/@marinade.finance/marinade-ts-sdk/node_modules/@project-serum/anchor/node_modules/base-x": { + "version": "3.0.9", + "resolved": "https://registry.npmjs.org/base-x/-/base-x-3.0.9.tgz", + "integrity": "sha512-H7JU6iBHTal1gp56aKoaa//YUxEaAOUiydvrV/pILqIHXTtqxSkATOnDA2u+jZ/61sD+L/412+7kzXRtWukhpQ==", + "license": "MIT", + "dependencies": { + "safe-buffer": "^5.0.1" + } + }, + "node_modules/@marinade.finance/marinade-ts-sdk/node_modules/@project-serum/anchor/node_modules/bs58": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/bs58/-/bs58-4.0.1.tgz", + "integrity": "sha512-Ok3Wdf5vOIlBrgCvTq96gBkJw+JUEzdBgyaza5HLtPm7yTHkjRy8+JzNyHF7BHa0bNWOQIp3m5YF0nnFcOIKLw==", + "license": "MIT", + "dependencies": { + "base-x": "^3.0.2" + } + }, + "node_modules/@marinade.finance/marinade-ts-sdk/node_modules/base-x": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/base-x/-/base-x-4.0.0.tgz", + "integrity": "sha512-FuwxlW4H5kh37X/oW59pwTzzTKRzfrrQwhmyspRM7swOEZcHtDZSCt45U6oKgtuFE+WYPblePMVIPR4RZrh/hw==", + "license": "MIT" + }, + "node_modules/@marinade.finance/marinade-ts-sdk/node_modules/borsh": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/borsh/-/borsh-0.6.0.tgz", + "integrity": "sha512-sl5k89ViqsThXQpYa9XDtz1sBl3l1lI313cFUY1HKr+wvMILnb+58xpkqTNrYbelh99dY7K8usxoCusQmqix9Q==", + "license": "Apache-2.0", + "dependencies": { + "bn.js": "^5.2.0", + "bs58": "^4.0.0", + "text-encoding-utf-8": "^1.0.2" + } + }, + "node_modules/@marinade.finance/marinade-ts-sdk/node_modules/borsh/node_modules/base-x": { + "version": "3.0.9", + "resolved": "https://registry.npmjs.org/base-x/-/base-x-3.0.9.tgz", + "integrity": "sha512-H7JU6iBHTal1gp56aKoaa//YUxEaAOUiydvrV/pILqIHXTtqxSkATOnDA2u+jZ/61sD+L/412+7kzXRtWukhpQ==", + "license": "MIT", + "dependencies": { + "safe-buffer": "^5.0.1" + } + }, + "node_modules/@marinade.finance/marinade-ts-sdk/node_modules/borsh/node_modules/bs58": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/bs58/-/bs58-4.0.1.tgz", + "integrity": "sha512-Ok3Wdf5vOIlBrgCvTq96gBkJw+JUEzdBgyaza5HLtPm7yTHkjRy8+JzNyHF7BHa0bNWOQIp3m5YF0nnFcOIKLw==", + "license": "MIT", + "dependencies": { + "base-x": "^3.0.2" + } + }, + "node_modules/@marinade.finance/marinade-ts-sdk/node_modules/bs58": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/bs58/-/bs58-5.0.0.tgz", + "integrity": "sha512-r+ihvQJvahgYT50JD05dyJNKlmmSlMoOGwn1lCcEzanPglg7TxYjioQUYehQ9mAR/+hOSd2jRc/Z2y5UxBymvQ==", + "license": "MIT", + "dependencies": { + "base-x": "^4.0.0" + } + }, + "node_modules/@metaplex-foundation/beet": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/@metaplex-foundation/beet/-/beet-0.7.1.tgz", + "integrity": "sha512-hNCEnS2WyCiYyko82rwuISsBY3KYpe828ubsd2ckeqZr7tl0WVLivGkoyA/qdiaaHEBGdGl71OpfWa2rqL3DiA==", + "license": "Apache-2.0", + "dependencies": { + "ansicolors": "^0.3.2", + "bn.js": "^5.2.0", + "debug": "^4.3.3" + } + }, + "node_modules/@metaplex-foundation/beet-solana": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/@metaplex-foundation/beet-solana/-/beet-solana-0.3.1.tgz", + "integrity": "sha512-tgyEl6dvtLln8XX81JyBvWjIiEcjTkUwZbrM5dIobTmoqMuGewSyk9CClno8qsMsFdB5T3jC91Rjeqmu/6xk2g==", + "license": "Apache-2.0", + "dependencies": { + "@metaplex-foundation/beet": ">=0.1.0", + "@solana/web3.js": "^1.56.2", + "bs58": "^5.0.0", + "debug": "^4.3.4" + } + }, + "node_modules/@metaplex-foundation/beet-solana/node_modules/base-x": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/base-x/-/base-x-4.0.0.tgz", + "integrity": "sha512-FuwxlW4H5kh37X/oW59pwTzzTKRzfrrQwhmyspRM7swOEZcHtDZSCt45U6oKgtuFE+WYPblePMVIPR4RZrh/hw==", + "license": "MIT" + }, + "node_modules/@metaplex-foundation/beet-solana/node_modules/bs58": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/bs58/-/bs58-5.0.0.tgz", + "integrity": "sha512-r+ihvQJvahgYT50JD05dyJNKlmmSlMoOGwn1lCcEzanPglg7TxYjioQUYehQ9mAR/+hOSd2jRc/Z2y5UxBymvQ==", + "license": "MIT", + "dependencies": { + "base-x": "^4.0.0" + } + }, + "node_modules/@metaplex-foundation/cusper": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/@metaplex-foundation/cusper/-/cusper-0.0.2.tgz", + "integrity": "sha512-S9RulC2fFCFOQraz61bij+5YCHhSO9llJegK8c8Y6731fSi6snUSQJdCUqYS8AIgR0TKbQvdvgSyIIdbDFZbBA==", + "license": "Apache-2.0" + }, + "node_modules/@metaplex-foundation/js": { + "version": "0.11.7", + "resolved": "https://registry.npmjs.org/@metaplex-foundation/js/-/js-0.11.7.tgz", + "integrity": "sha512-zL3Ac++8lUOoKjjhDArdNSimvVYcOqg4uhxfBVRKLV6H8q6E/sOepXuzYSLXxzYWdvapYWEPKFdEDFluYzk7DA==", + "license": "MIT", + "dependencies": { + "@aws-sdk/client-s3": "^3.54.1", + "@bundlr-network/client": "^0.7.14", + "@metaplex-foundation/beet": "^0.2.0", + "@metaplex-foundation/beet-solana": "^0.1.1", + "@metaplex-foundation/mpl-auction-house": "^2.0.0", + "@metaplex-foundation/mpl-candy-machine": "^4.2.0", + "@metaplex-foundation/mpl-token-metadata": "^2.1.2", + "@solana/spl-token": "^0.2.0", + "@solana/web3.js": "^1.44.0", + "abort-controller": "^3.0.0", + "bignumber.js": "^9.0.2", + "bn.js": "^5.2.0", + "bs58": "^5.0.0", + "buffer": "^6.0.3", + "cross-fetch": "^3.1.5", + "debug": "^4.3.4", + "eventemitter3": "^4.0.7", + "lodash.clonedeep": "^4.5.0", + "mime": "^3.0.0", + "tweetnacl": "^1.0.3" + }, + "engines": { + "node": "^14.0 || >=16.0" + } + }, + "node_modules/@metaplex-foundation/js/node_modules/@metaplex-foundation/beet": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/@metaplex-foundation/beet/-/beet-0.2.0.tgz", + "integrity": "sha512-H570hkJxmx/FxET1OggPPLkPL7psYQa71rNI9NJjYRM8WXdrEvmI/IRIEUW2KR6RqwWWN3FvlRHnKoQUV/lQtA==", + "license": "Apache-2.0", + "dependencies": { + "ansicolors": "^0.3.2", + "bn.js": "^5.2.0", + "debug": "^4.3.3" + } + }, + "node_modules/@metaplex-foundation/js/node_modules/@metaplex-foundation/beet-solana": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/@metaplex-foundation/beet-solana/-/beet-solana-0.1.1.tgz", + "integrity": "sha512-QV2DbxjaJWLkMvn12OC09g+r7a6R0uNwf8msYuOUSw4cG7amXzvFb7s0bh4IxY3Rk8/0ma0PfKi/FEdC7Hi4Pg==", + "license": "Apache-2.0", + "dependencies": { + "@metaplex-foundation/beet": ">=0.1.0", + "@solana/web3.js": "^1.31.0" + } + }, + "node_modules/@metaplex-foundation/js/node_modules/@metaplex-foundation/beet-solana/node_modules/@metaplex-foundation/beet": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/@metaplex-foundation/beet/-/beet-0.7.1.tgz", + "integrity": "sha512-hNCEnS2WyCiYyko82rwuISsBY3KYpe828ubsd2ckeqZr7tl0WVLivGkoyA/qdiaaHEBGdGl71OpfWa2rqL3DiA==", + "license": "Apache-2.0", + "dependencies": { + "ansicolors": "^0.3.2", + "bn.js": "^5.2.0", + "debug": "^4.3.3" + } + }, + "node_modules/@metaplex-foundation/js/node_modules/@solana/spl-token": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/@solana/spl-token/-/spl-token-0.2.0.tgz", + "integrity": "sha512-RWcn31OXtdqIxmkzQfB2R+WpsJOVS6rKuvpxJFjvik2LyODd+WN58ZP3Rpjpro03fscGAkzlFuP3r42doRJgyQ==", + "license": "Apache-2.0", + "dependencies": { + "@solana/buffer-layout": "^4.0.0", + "@solana/buffer-layout-utils": "^0.2.0", + "@solana/web3.js": "^1.32.0", + "start-server-and-test": "^1.14.0" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/@metaplex-foundation/js/node_modules/base-x": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/base-x/-/base-x-4.0.0.tgz", + "integrity": "sha512-FuwxlW4H5kh37X/oW59pwTzzTKRzfrrQwhmyspRM7swOEZcHtDZSCt45U6oKgtuFE+WYPblePMVIPR4RZrh/hw==", + "license": "MIT" + }, + "node_modules/@metaplex-foundation/js/node_modules/bs58": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/bs58/-/bs58-5.0.0.tgz", + "integrity": "sha512-r+ihvQJvahgYT50JD05dyJNKlmmSlMoOGwn1lCcEzanPglg7TxYjioQUYehQ9mAR/+hOSd2jRc/Z2y5UxBymvQ==", + "license": "MIT", + "dependencies": { + "base-x": "^4.0.0" + } + }, + "node_modules/@metaplex-foundation/mpl-auction-house": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/@metaplex-foundation/mpl-auction-house/-/mpl-auction-house-2.5.1.tgz", + "integrity": "sha512-O+IAdYVaoOvgACB8pm+1lF5BNEjl0COkqny2Ho8KQZwka6aC/vHbZ239yRwAMtJhf5992BPFdT4oifjyE0O+Mw==", + "license": "Apache-2.0", + "dependencies": { + "@metaplex-foundation/beet": "^0.6.1", + "@metaplex-foundation/beet-solana": "^0.3.1", + "@metaplex-foundation/cusper": "^0.0.2", + "@solana/spl-token": "^0.3.5", + "@solana/web3.js": "^1.56.2", + "bn.js": "^5.2.0" + } + }, + "node_modules/@metaplex-foundation/mpl-auction-house/node_modules/@metaplex-foundation/beet": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/@metaplex-foundation/beet/-/beet-0.6.1.tgz", + "integrity": "sha512-OYgnijLFzw0cdUlRKH5POp0unQECPOW9muJ2X3QIVyak5G6I6l/rKo72sICgPLIFKdmsi2jmnkuLY7wp14iXdw==", + "license": "Apache-2.0", + "dependencies": { + "ansicolors": "^0.3.2", + "bn.js": "^5.2.0", + "debug": "^4.3.3" + } + }, + "node_modules/@metaplex-foundation/mpl-auction-house/node_modules/@solana/spl-token": { + "version": "0.3.7", + "resolved": "https://registry.npmjs.org/@solana/spl-token/-/spl-token-0.3.7.tgz", + "integrity": "sha512-bKGxWTtIw6VDdCBngjtsGlKGLSmiu/8ghSt/IOYJV24BsymRbgq7r12GToeetpxmPaZYLddKwAz7+EwprLfkfg==", + "license": "Apache-2.0", + "dependencies": { + "@solana/buffer-layout": "^4.0.0", + "@solana/buffer-layout-utils": "^0.2.0", + "buffer": "^6.0.3" + }, + "engines": { + "node": ">=16" + }, + "peerDependencies": { + "@solana/web3.js": "^1.47.4" + } + }, + "node_modules/@metaplex-foundation/mpl-candy-machine": { + "version": "4.7.1", + "resolved": "https://registry.npmjs.org/@metaplex-foundation/mpl-candy-machine/-/mpl-candy-machine-4.7.1.tgz", + "integrity": "sha512-tBNRAfBE/rYy9pe2aJD4gTFw+pgQ11o3AJjoYGB4+05ow0VjJMSt6kQGzHm2LRPgdLY4diKAq8qHvgsbV5ikNQ==", + "license": "Apache-2.0", + "dependencies": { + "@metaplex-foundation/beet": "^0.4.0", + "@metaplex-foundation/beet-solana": "^0.3.0", + "@metaplex-foundation/cusper": "^0.0.2", + "@metaplex-foundation/mpl-core": "^0.6.1", + "@solana/web3.js": "^1.35.1" + } + }, + "node_modules/@metaplex-foundation/mpl-candy-machine/node_modules/@metaplex-foundation/beet": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/@metaplex-foundation/beet/-/beet-0.4.0.tgz", + "integrity": "sha512-2OAKJnLatCc3mBXNL0QmWVQKAWK2C7XDfepgL0p/9+8oSx4bmRAFHFqptl1A/C0U5O3dxGwKfmKluW161OVGcA==", + "license": "Apache-2.0", + "dependencies": { + "ansicolors": "^0.3.2", + "bn.js": "^5.2.0", + "debug": "^4.3.3" + } + }, + "node_modules/@metaplex-foundation/mpl-core": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/@metaplex-foundation/mpl-core/-/mpl-core-0.6.1.tgz", + "integrity": "sha512-6R4HkfAqU2EUakNbVLcCmka0YuQTLGTbHJ62ig765+NRWuB2HNGUQ1HfHcRsGnyxhlCvwKK79JE01XUjFE+dzw==", + "license": "MIT", + "dependencies": { + "@solana/web3.js": "^1.35.1", + "bs58": "^4.0.1" + } + }, + "node_modules/@metaplex-foundation/mpl-token-metadata": { + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/@metaplex-foundation/mpl-token-metadata/-/mpl-token-metadata-2.11.0.tgz", + "integrity": "sha512-pwuufw3QuSk0Z/oOmB7gpnlxiIR0bc5RVHLEpwOJ5/4KHEq7PIFxVsNcwDFzLoZJWTcQdvwZTy0d1J/qJMoxxg==", + "license": "MIT", + "dependencies": { + "@metaplex-foundation/beet": "^0.7.1", + "@metaplex-foundation/beet-solana": "^0.4.0", + "@metaplex-foundation/cusper": "^0.0.2", + "@solana/spl-token": "^0.3.6", + "@solana/web3.js": "^1.66.2", + "bn.js": "^5.2.0", + "debug": "^4.3.4" + } + }, + "node_modules/@metaplex-foundation/mpl-token-metadata/node_modules/@metaplex-foundation/beet-solana": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/@metaplex-foundation/beet-solana/-/beet-solana-0.4.0.tgz", + "integrity": "sha512-B1L94N3ZGMo53b0uOSoznbuM5GBNJ8LwSeznxBxJ+OThvfHQ4B5oMUqb+0zdLRfkKGS7Q6tpHK9P+QK0j3w2cQ==", + "license": "Apache-2.0", + "dependencies": { + "@metaplex-foundation/beet": ">=0.1.0", + "@solana/web3.js": "^1.56.2", + "bs58": "^5.0.0", + "debug": "^4.3.4" + } + }, + "node_modules/@metaplex-foundation/mpl-token-metadata/node_modules/@solana/spl-token": { + "version": "0.3.7", + "resolved": "https://registry.npmjs.org/@solana/spl-token/-/spl-token-0.3.7.tgz", + "integrity": "sha512-bKGxWTtIw6VDdCBngjtsGlKGLSmiu/8ghSt/IOYJV24BsymRbgq7r12GToeetpxmPaZYLddKwAz7+EwprLfkfg==", + "license": "Apache-2.0", + "dependencies": { + "@solana/buffer-layout": "^4.0.0", + "@solana/buffer-layout-utils": "^0.2.0", + "buffer": "^6.0.3" + }, + "engines": { + "node": ">=16" + }, + "peerDependencies": { + "@solana/web3.js": "^1.47.4" + } + }, + "node_modules/@metaplex-foundation/mpl-token-metadata/node_modules/base-x": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/base-x/-/base-x-4.0.0.tgz", + "integrity": "sha512-FuwxlW4H5kh37X/oW59pwTzzTKRzfrrQwhmyspRM7swOEZcHtDZSCt45U6oKgtuFE+WYPblePMVIPR4RZrh/hw==", + "license": "MIT" + }, + "node_modules/@metaplex-foundation/mpl-token-metadata/node_modules/bs58": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/bs58/-/bs58-5.0.0.tgz", + "integrity": "sha512-r+ihvQJvahgYT50JD05dyJNKlmmSlMoOGwn1lCcEzanPglg7TxYjioQUYehQ9mAR/+hOSd2jRc/Z2y5UxBymvQ==", + "license": "MIT", + "dependencies": { + "base-x": "^4.0.0" + } + }, + "node_modules/@mithraic-labs/psy-american": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/@mithraic-labs/psy-american/-/psy-american-0.2.3.tgz", + "integrity": "sha512-NsDfb9QNuLKNqRnq8rWAoD2Y3ouAEsAPFfwP28SmDVfkugvj03nvQtjotFLlH2TsE31YonG+gauhpeeGKZyyuw==", + "license": "MIT", + "dependencies": { + "@project-serum/anchor": "^0.24.2", + "@project-serum/serum": "^0.13.60", + "@solana/spl-token": "^0.1.8", + "@solana/web3.js": "^1.28.0" + } + }, + "node_modules/@mithraic-labs/psy-american/node_modules/@project-serum/anchor": { + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@project-serum/anchor/-/anchor-0.24.2.tgz", + "integrity": "sha512-0/718g8/DnEuwAidUwh5wLYphUYXhUbiClkuRNhvNoa+1Y8a4g2tJyxoae+emV+PG/Gikd/QUBNMkIcimiIRTA==", + "license": "(MIT OR Apache-2.0)", + "dependencies": { + "@project-serum/borsh": "^0.2.5", + "@solana/web3.js": "^1.36.0", + "base64-js": "^1.5.1", + "bn.js": "^5.1.2", + "bs58": "^4.0.1", + "buffer-layout": "^1.2.2", + "camelcase": "^5.3.1", + "cross-fetch": "^3.1.5", + "crypto-hash": "^1.3.0", + "eventemitter3": "^4.0.7", + "js-sha256": "^0.9.0", + "pako": "^2.0.3", + "snake-case": "^3.0.4", + "toml": "^3.0.0" + }, + "engines": { + "node": ">=11" + } + }, + "node_modules/@noble/ed25519": { + "version": "1.7.3", + "resolved": "https://registry.npmjs.org/@noble/ed25519/-/ed25519-1.7.3.tgz", + "integrity": "sha512-iR8GBkDt0Q3GyaVcIu7mSsVIqnFbkbRzGLWlvhwunacoLwt4J3swfKhfaM6rN6WY+TBGoYT1GtT1mIh2/jGbRQ==", + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ], + "license": "MIT" + }, + "node_modules/@noble/hashes": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.2.0.tgz", + "integrity": "sha512-FZfhjEDbT5GRswV3C6uvLPHMiVD6lQBmpoX5+eSiPaMTXte/IKqI5dykDxzZB/WBeK/CDuQRBWarPdi3FNY2zQ==", + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ], + "license": "MIT" + }, + "node_modules/@noble/secp256k1": { + "version": "1.7.1", + "resolved": "https://registry.npmjs.org/@noble/secp256k1/-/secp256k1-1.7.1.tgz", + "integrity": "sha512-hOUk6AyBFmqVrv7k5WAw/LpszxVbj9gGN4JRkIX52fdFAj1UA61KXmZDvqVEm+pOyec3+fIeZB02LYa/pWOArw==", + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ], + "license": "MIT" + }, + "node_modules/@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@project-serum/anchor": { + "version": "0.25.0", + "resolved": "https://registry.npmjs.org/@project-serum/anchor/-/anchor-0.25.0.tgz", + "integrity": "sha512-E6A5Y/ijqpfMJ5psJvbw0kVTzLZFUcOFgs6eSM2M2iWE1lVRF18T6hWZVNl6zqZsoz98jgnNHtVGJMs+ds9A7A==", + "license": "(MIT OR Apache-2.0)", + "dependencies": { + "@project-serum/borsh": "^0.2.5", + "@solana/web3.js": "^1.36.0", + "base64-js": "^1.5.1", + "bn.js": "^5.1.2", + "bs58": "^4.0.1", + "buffer-layout": "^1.2.2", + "camelcase": "^5.3.1", + "cross-fetch": "^3.1.5", + "crypto-hash": "^1.3.0", + "eventemitter3": "^4.0.7", + "js-sha256": "^0.9.0", + "pako": "^2.0.3", + "snake-case": "^3.0.4", + "superstruct": "^0.15.4", + "toml": "^3.0.0" + }, + "engines": { + "node": ">=11" + } + }, + "node_modules/@project-serum/borsh": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/@project-serum/borsh/-/borsh-0.2.5.tgz", + "integrity": "sha512-UmeUkUoKdQ7rhx6Leve1SssMR/Ghv8qrEiyywyxSWg7ooV7StdpPBhciiy5eB3T0qU1BXvdRNC8TdrkxK7WC5Q==", + "license": "Apache-2.0", + "dependencies": { + "bn.js": "^5.1.2", + "buffer-layout": "^1.2.0" + }, + "engines": { + "node": ">=10" + }, + "peerDependencies": { + "@solana/web3.js": "^1.2.0" + } + }, + "node_modules/@project-serum/serum": { + "version": "0.13.65", + "resolved": "https://registry.npmjs.org/@project-serum/serum/-/serum-0.13.65.tgz", + "integrity": "sha512-BHRqsTqPSfFB5p+MgI2pjvMBAQtO8ibTK2fYY96boIFkCI3TTwXDt2gUmspeChKO2pqHr5aKevmexzAcXxrSRA==", + "license": "MIT", + "dependencies": { + "@project-serum/anchor": "^0.11.1", + "@solana/spl-token": "^0.1.6", + "@solana/web3.js": "^1.21.0", + "bn.js": "^5.1.2", + "buffer-layout": "^1.2.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@project-serum/serum/node_modules/@project-serum/anchor": { + "version": "0.11.1", + "resolved": "https://registry.npmjs.org/@project-serum/anchor/-/anchor-0.11.1.tgz", + "integrity": "sha512-oIdm4vTJkUy6GmE6JgqDAuQPKI7XM4TPJkjtoIzp69RZe0iAD9JP2XHx7lV1jLdYXeYHqDXfBt3zcq7W91K6PA==", + "license": "(MIT OR Apache-2.0)", + "dependencies": { + "@project-serum/borsh": "^0.2.2", + "@solana/web3.js": "^1.17.0", + "base64-js": "^1.5.1", + "bn.js": "^5.1.2", + "bs58": "^4.0.1", + "buffer-layout": "^1.2.0", + "camelcase": "^5.3.1", + "crypto-hash": "^1.3.0", + "eventemitter3": "^4.0.7", + "find": "^0.3.0", + "js-sha256": "^0.9.0", + "pako": "^2.0.3", + "snake-case": "^3.0.4", + "toml": "^3.0.0" + }, + "engines": { + "node": ">=11" + } + }, + "node_modules/@pythnetwork/client": { + "version": "2.17.0", + "resolved": "https://registry.npmjs.org/@pythnetwork/client/-/client-2.17.0.tgz", + "integrity": "sha512-hv285vehmLH6N762Z4jqvPTM+hCYnXQaUp6DMgLUpDHvE0mTbwW9PvlxYoUJZGtyeCDkgn9HrTWXPtnaXTRr+Q==", + "license": "Apache-2.0", + "dependencies": { + "@coral-xyz/anchor": "^0.26.0", + "@coral-xyz/borsh": "^0.26.0", + "buffer": "^6.0.1" + }, + "peerDependencies": { + "@solana/web3.js": "^1.30.2" + } + }, + "node_modules/@randlabs/communication-bridge": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@randlabs/communication-bridge/-/communication-bridge-1.0.1.tgz", + "integrity": "sha512-CzS0U8IFfXNK7QaJFE4pjbxDGfPjbXBEsEaCn9FN15F+ouSAEUQkva3Gl66hrkBZOGexKFEWMwUHIDKpZ2hfVg==", + "license": "Apache-2.0" + }, + "node_modules/@randlabs/myalgo-connect": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/@randlabs/myalgo-connect/-/myalgo-connect-1.4.2.tgz", + "integrity": "sha512-K9hEyUi7G8tqOp7kWIALJLVbGCByhilcy6123WfcorxWwiE1sbQupPyIU5f3YdQK6wMjBsyTWiLW52ZBMp7sXA==", + "license": "Apache-2.0", + "dependencies": { + "@randlabs/communication-bridge": "1.0.1" + } + }, + "node_modules/@scure/base": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.1.tgz", + "integrity": "sha512-ZxOhsSyxYwLJj3pLZCefNitxsj093tb2vq90mp2txoYeBqbcjDjqFhyM8eUjq/uFm6zJ+mUuqxlS2FkuSY1MTA==", + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ], + "license": "MIT" + }, + "node_modules/@scure/bip32": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.1.5.tgz", + "integrity": "sha512-XyNh1rB0SkEqd3tXcXMi+Xe1fvg+kUIcoRIEujP1Jgv7DqW2r9lg3Ah0NkFaCs9sTkQAQA8kw7xiRXzENi9Rtw==", + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ], + "license": "MIT", + "dependencies": { + "@noble/hashes": "~1.2.0", + "@noble/secp256k1": "~1.7.0", + "@scure/base": "~1.1.0" + } + }, + "node_modules/@scure/bip39": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.1.1.tgz", + "integrity": "sha512-t+wDck2rVkh65Hmv280fYdVdY25J9YeEUIgn2LG1WM6gxFkGzcksoDiUkWVpVp3Oex9xGC68JU2dSbUfwZ2jPg==", + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ], + "license": "MIT", + "dependencies": { + "@noble/hashes": "~1.2.0", + "@scure/base": "~1.1.0" + } + }, + "node_modules/@sideway/address": { + "version": "4.1.4", + "resolved": "https://registry.npmjs.org/@sideway/address/-/address-4.1.4.tgz", + "integrity": "sha512-7vwq+rOHVWjyXxVlR76Agnvhy8I9rpzjosTESvmhNeXOXdZZB15Fl+TI9x1SiHZH5Jv2wTGduSxFDIaq0m3DUw==", + "license": "BSD-3-Clause", + "dependencies": { + "@hapi/hoek": "^9.0.0" + } + }, + "node_modules/@sideway/formula": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@sideway/formula/-/formula-3.0.1.tgz", + "integrity": "sha512-/poHZJJVjx3L+zVD6g9KgHfYnb443oi7wLu/XKojDviHy6HOEOA6z1Trk5aR1dGcmPenJEgb2sK2I80LeS3MIg==", + "license": "BSD-3-Clause" + }, + "node_modules/@sideway/pinpoint": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@sideway/pinpoint/-/pinpoint-2.0.0.tgz", + "integrity": "sha512-RNiOoTPkptFtSVzQevY/yWtZwf/RxyVnPy/OcA9HBM3MlGDnBEYL5B41H0MTn0Uec8Hi+2qUtTfG2WWZBmMejQ==", + "license": "BSD-3-Clause" + }, + "node_modules/@solana/buffer-layout": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@solana/buffer-layout/-/buffer-layout-4.0.1.tgz", + "integrity": "sha512-E1ImOIAD1tBZFRdjeM4/pzTiTApC0AOBGwyAMS4fwIodCWArzJ3DWdoh8cKxeFM2fElkxBh2Aqts1BPC373rHA==", + "license": "MIT", + "dependencies": { + "buffer": "~6.0.3" + }, + "engines": { + "node": ">=5.10" + } + }, + "node_modules/@solana/buffer-layout-utils": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/@solana/buffer-layout-utils/-/buffer-layout-utils-0.2.0.tgz", + "integrity": "sha512-szG4sxgJGktbuZYDg2FfNmkMi0DYQoVjN2h7ta1W1hPrwzarcFLBq9UpX1UjNXsNpT9dn+chgprtWGioUAr4/g==", + "license": "Apache-2.0", + "dependencies": { + "@solana/buffer-layout": "^4.0.0", + "@solana/web3.js": "^1.32.0", + "bigint-buffer": "^1.1.5", + "bignumber.js": "^9.0.1" + }, + "engines": { + "node": ">= 10" + } + }, + "node_modules/@solana/spl-token": { + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/@solana/spl-token/-/spl-token-0.1.8.tgz", + "integrity": "sha512-LZmYCKcPQDtJgecvWOgT/cnoIQPWjdH+QVyzPcFvyDUiT0DiRjZaam4aqNUyvchLFhzgunv3d9xOoyE34ofdoQ==", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.10.5", + "@solana/web3.js": "^1.21.0", + "bn.js": "^5.1.0", + "buffer": "6.0.3", + "buffer-layout": "^1.2.0", + "dotenv": "10.0.0" + }, + "engines": { + "node": ">= 10" + } + }, + "node_modules/@solana/spl-token/node_modules/dotenv": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-10.0.0.tgz", + "integrity": "sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q==", + "license": "BSD-2-Clause", + "engines": { + "node": ">=10" + } + }, + "node_modules/@solana/wallet-adapter-base": { + "version": "0.9.22", + "resolved": "https://registry.npmjs.org/@solana/wallet-adapter-base/-/wallet-adapter-base-0.9.22.tgz", + "integrity": "sha512-xbLEZPGSJFvgTeldG9D55evhl7QK/3e/F7vhvcA97mEt1eieTgeKMnGlmmjs3yivI3/gtZNZeSk1XZLnhKcQvw==", + "license": "Apache-2.0", + "dependencies": { + "@solana/wallet-standard-features": "^1.0.1", + "@wallet-standard/base": "^1.0.1", + "@wallet-standard/features": "^1.0.3", + "eventemitter3": "^4.0.7" + }, + "engines": { + "node": ">=16" + }, + "peerDependencies": { + "@solana/web3.js": "^1.58.0" + } + }, + "node_modules/@solana/wallet-standard-features": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@solana/wallet-standard-features/-/wallet-standard-features-1.0.1.tgz", + "integrity": "sha512-SUfx7KtBJ55XIj0qAhhVcC1I6MklAXqWFEz9hDHW+6YcJIyvfix/EilBhaBik1FJ2JT0zukpOfFv8zpuAbFRbw==", + "license": "Apache-2.0", + "dependencies": { + "@wallet-standard/base": "^1.0.1", + "@wallet-standard/features": "^1.0.3" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/@solana/web3.js": { + "version": "1.75.0", + "resolved": "https://registry.npmjs.org/@solana/web3.js/-/web3.js-1.75.0.tgz", + "integrity": "sha512-rHQgdo1EWfb+nPUpHe4O7i8qJPELHKNR5PAZRK+a7XxiykqOfbaAlPt5boDWAGPnYbSv0ziWZv5mq9DlFaQCxg==", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.12.5", + "@noble/ed25519": "^1.7.0", + "@noble/hashes": "^1.1.2", + "@noble/secp256k1": "^1.6.3", + "@solana/buffer-layout": "^4.0.0", + "agentkeepalive": "^4.2.1", + "bigint-buffer": "^1.1.5", + "bn.js": "^5.0.0", + "borsh": "^0.7.0", + "bs58": "^4.0.1", + "buffer": "6.0.3", + "fast-stable-stringify": "^1.0.0", + "jayson": "^3.4.4", + "node-fetch": "^2.6.7", + "rpc-websockets": "^7.5.1", + "superstruct": "^0.14.2" + } + }, + "node_modules/@solana/web3.js/node_modules/@noble/hashes": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.0.tgz", + "integrity": "sha512-ilHEACi9DwqJB0pw7kv+Apvh50jiiSyR/cQ3y4W7lOR5mhvn/50FLUfsnfJz0BDZtl/RR16kXvptiv6q1msYZg==", + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ], + "license": "MIT" + }, + "node_modules/@solana/web3.js/node_modules/superstruct": { + "version": "0.14.2", + "resolved": "https://registry.npmjs.org/superstruct/-/superstruct-0.14.2.tgz", + "integrity": "sha512-nPewA6m9mR3d6k7WkZ8N8zpTWfenFH3q9pA2PkuiZxINr9DKB2+40wEQf0ixn8VaGuJ78AB6iWOtStI+/4FKZQ==", + "license": "MIT" + }, + "node_modules/@solendprotocol/solend-sdk": { + "version": "0.6.16", + "resolved": "https://registry.npmjs.org/@solendprotocol/solend-sdk/-/solend-sdk-0.6.16.tgz", + "integrity": "sha512-clv3zQfFzxZ9HWblg0/tsXwWkjZoAtdTmcPqusWHt5DSt0XyiRznZicvM5aENeFsdjCjgXljbB/NMrba+Nry/w==", + "license": "MIT", + "dependencies": { + "@marinade.finance/marinade-ts-sdk": "^3.1.1", + "@mithraic-labs/psy-american": "^0.2.1", + "@project-serum/anchor": "^0.24.2", + "@pythnetwork/client": "^2.5.1", + "@solana/buffer-layout": "^4.0.0", + "@solana/spl-token": "^0.3.6", + "@solana/web3.js": "^1.66.2", + "@solflare-wallet/utl-sdk": "^1.4.0", + "@types/bn.js": "^5.1.1", + "axios": "^0.24.0", + "bignumber.js": "^9.0.2", + "bn.js": "^5.2.0", + "buffer": "^6.0.3", + "buffer-layout": "^1.2.0", + "fzstd": "^0.1.0", + "hot-shots": "^9.3.0", + "isomorphic-fetch": "^3.0.0", + "jsbi": "^4.3.0", + "typedoc-plugin-cname": "^1.0.1" + } + }, + "node_modules/@solendprotocol/solend-sdk/node_modules/@project-serum/anchor": { + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@project-serum/anchor/-/anchor-0.24.2.tgz", + "integrity": "sha512-0/718g8/DnEuwAidUwh5wLYphUYXhUbiClkuRNhvNoa+1Y8a4g2tJyxoae+emV+PG/Gikd/QUBNMkIcimiIRTA==", + "license": "(MIT OR Apache-2.0)", + "dependencies": { + "@project-serum/borsh": "^0.2.5", + "@solana/web3.js": "^1.36.0", + "base64-js": "^1.5.1", + "bn.js": "^5.1.2", + "bs58": "^4.0.1", + "buffer-layout": "^1.2.2", + "camelcase": "^5.3.1", + "cross-fetch": "^3.1.5", + "crypto-hash": "^1.3.0", + "eventemitter3": "^4.0.7", + "js-sha256": "^0.9.0", + "pako": "^2.0.3", + "snake-case": "^3.0.4", + "toml": "^3.0.0" + }, + "engines": { + "node": ">=11" + } + }, + "node_modules/@solendprotocol/solend-sdk/node_modules/@solana/spl-token": { + "version": "0.3.7", + "resolved": "https://registry.npmjs.org/@solana/spl-token/-/spl-token-0.3.7.tgz", + "integrity": "sha512-bKGxWTtIw6VDdCBngjtsGlKGLSmiu/8ghSt/IOYJV24BsymRbgq7r12GToeetpxmPaZYLddKwAz7+EwprLfkfg==", + "license": "Apache-2.0", + "dependencies": { + "@solana/buffer-layout": "^4.0.0", + "@solana/buffer-layout-utils": "^0.2.0", + "buffer": "^6.0.3" + }, + "engines": { + "node": ">=16" + }, + "peerDependencies": { + "@solana/web3.js": "^1.47.4" + } + }, + "node_modules/@solendprotocol/solend-sdk/node_modules/axios": { + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.24.0.tgz", + "integrity": "sha512-Q6cWsys88HoPgAaFAVUb0WpPk0O8iTeisR9IMqy9G8AbO4NlpVknrnQS03zzF9PGAWgO3cgletO3VjV/P7VztA==", + "license": "MIT", + "dependencies": { + "follow-redirects": "^1.14.4" + } + }, + "node_modules/@solflare-wallet/utl-sdk": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@solflare-wallet/utl-sdk/-/utl-sdk-1.4.0.tgz", + "integrity": "sha512-0E3s+fXs5XMGBNrXGB4XSH4+sPgLanbBEVyz227KJyxSIgiRdQMcM2Yv/KdnMHNmhYoR/aPpH6TH115SIJqM0A==", + "license": "ISC", + "dependencies": { + "@metaplex-foundation/js": "0.11.7", + "axios": "^0.27.2", + "eventemitter3": "^5.0.0", + "lodash": "^4.17.21" + }, + "peerDependencies": { + "@solana/web3.js": "*" + } + }, + "node_modules/@solflare-wallet/utl-sdk/node_modules/eventemitter3": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.1.tgz", + "integrity": "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==", + "license": "MIT" + }, + "node_modules/@stablelib/binary": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@stablelib/binary/-/binary-1.0.1.tgz", + "integrity": "sha512-ClJWvmL6UBM/wjkvv/7m5VP3GMr9t0osr4yVgLZsLCOz4hGN9gIAFEqnJ0TsSMAN+n840nf2cHZnA5/KFqHC7Q==", + "license": "MIT", + "dependencies": { + "@stablelib/int": "^1.0.1" + } + }, + "node_modules/@stablelib/blake2b": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@stablelib/blake2b/-/blake2b-1.0.1.tgz", + "integrity": "sha512-B3KyKoBAjkIFeH7romcF96i+pVFYk7K2SBQ1pZvaxV+epSBXJ+n0C66esUhyz6FF+5FbdQVm77C5fzGFcEZpKA==", + "license": "MIT", + "dependencies": { + "@stablelib/binary": "^1.0.1", + "@stablelib/hash": "^1.0.1", + "@stablelib/wipe": "^1.0.1" + } + }, + "node_modules/@stablelib/bytes": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@stablelib/bytes/-/bytes-1.0.1.tgz", + "integrity": "sha512-Kre4Y4kdwuqL8BR2E9hV/R5sOrUj6NanZaZis0V6lX5yzqC3hBuVSDXUIBqQv/sCpmuWRiHLwqiT1pqqjuBXoQ==", + "license": "MIT" + }, + "node_modules/@stablelib/constant-time": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@stablelib/constant-time/-/constant-time-1.0.1.tgz", + "integrity": "sha512-tNOs3uD0vSJcK6z1fvef4Y+buN7DXhzHDPqRLSXUel1UfqMB1PWNsnnAezrKfEwTLpN0cGH2p9NNjs6IqeD0eg==", + "license": "MIT" + }, + "node_modules/@stablelib/ed25519": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@stablelib/ed25519/-/ed25519-1.0.3.tgz", + "integrity": "sha512-puIMWaX9QlRsbhxfDc5i+mNPMY+0TmQEskunY1rZEBPi1acBCVQAhnsk/1Hk50DGPtVsZtAWQg4NHGlVaO9Hqg==", + "license": "MIT", + "dependencies": { + "@stablelib/random": "^1.0.2", + "@stablelib/sha512": "^1.0.1", + "@stablelib/wipe": "^1.0.1" + } + }, + "node_modules/@stablelib/hash": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@stablelib/hash/-/hash-1.0.1.tgz", + "integrity": "sha512-eTPJc/stDkdtOcrNMZ6mcMK1e6yBbqRBaNW55XA1jU8w/7QdnCF0CmMmOD1m7VSkBR44PWrMHU2l6r8YEQHMgg==", + "license": "MIT" + }, + "node_modules/@stablelib/int": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@stablelib/int/-/int-1.0.1.tgz", + "integrity": "sha512-byr69X/sDtDiIjIV6m4roLVWnNNlRGzsvxw+agj8CIEazqWGOQp2dTYgQhtyVXV9wpO6WyXRQUzLV/JRNumT2w==", + "license": "MIT" + }, + "node_modules/@stablelib/keyagreement": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@stablelib/keyagreement/-/keyagreement-1.0.1.tgz", + "integrity": "sha512-VKL6xBwgJnI6l1jKrBAfn265cspaWBPAPEc62VBQrWHLqVgNRE09gQ/AnOEyKUWrrqfD+xSQ3u42gJjLDdMDQg==", + "license": "MIT", + "dependencies": { + "@stablelib/bytes": "^1.0.1" + } + }, + "node_modules/@stablelib/nacl": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@stablelib/nacl/-/nacl-1.0.4.tgz", + "integrity": "sha512-PJ2U/MrkXSKUM8C4qFs87WeCNxri7KQwR8Cdwm9q2sweGuAtTvOJGuW0F3N+zn+ySLPJA98SYWSSpogMJ1gCmw==", + "license": "MIT", + "dependencies": { + "@stablelib/poly1305": "^1.0.1", + "@stablelib/random": "^1.0.2", + "@stablelib/wipe": "^1.0.1", + "@stablelib/x25519": "^1.0.3", + "@stablelib/xsalsa20": "^1.0.2" + } + }, + "node_modules/@stablelib/poly1305": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@stablelib/poly1305/-/poly1305-1.0.1.tgz", + "integrity": "sha512-1HlG3oTSuQDOhSnLwJRKeTRSAdFNVB/1djy2ZbS35rBSJ/PFqx9cf9qatinWghC2UbfOYD8AcrtbUQl8WoxabA==", + "license": "MIT", + "dependencies": { + "@stablelib/constant-time": "^1.0.1", + "@stablelib/wipe": "^1.0.1" + } + }, + "node_modules/@stablelib/random": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@stablelib/random/-/random-1.0.2.tgz", + "integrity": "sha512-rIsE83Xpb7clHPVRlBj8qNe5L8ISQOzjghYQm/dZ7VaM2KHYwMW5adjQjrzTZCchFnNCNhkwtnOBa9HTMJCI8w==", + "license": "MIT", + "dependencies": { + "@stablelib/binary": "^1.0.1", + "@stablelib/wipe": "^1.0.1" + } + }, + "node_modules/@stablelib/salsa20": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@stablelib/salsa20/-/salsa20-1.0.2.tgz", + "integrity": "sha512-nfjKzw0KTKrrKBasEP+j7UP4I8Xudom8lVZIBCp0kQNARXq72IlSic0oabg2FC1NU68L4RdHrNJDd8bFwrphYA==", + "license": "MIT", + "dependencies": { + "@stablelib/binary": "^1.0.1", + "@stablelib/constant-time": "^1.0.1", + "@stablelib/wipe": "^1.0.1" + } + }, + "node_modules/@stablelib/sha512": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@stablelib/sha512/-/sha512-1.0.1.tgz", + "integrity": "sha512-13gl/iawHV9zvDKciLo1fQ8Bgn2Pvf7OV6amaRVKiq3pjQ3UmEpXxWiAfV8tYjUpeZroBxtyrwtdooQT/i3hzw==", + "license": "MIT", + "dependencies": { + "@stablelib/binary": "^1.0.1", + "@stablelib/hash": "^1.0.1", + "@stablelib/wipe": "^1.0.1" + } + }, + "node_modules/@stablelib/wipe": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@stablelib/wipe/-/wipe-1.0.1.tgz", + "integrity": "sha512-WfqfX/eXGiAd3RJe4VU2snh/ZPwtSjLG4ynQ/vYzvghTh7dHFcI1wl+nrkWG6lGhukOxOsUHfv8dUXr58D0ayg==", + "license": "MIT" + }, + "node_modules/@stablelib/x25519": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@stablelib/x25519/-/x25519-1.0.3.tgz", + "integrity": "sha512-KnTbKmUhPhHavzobclVJQG5kuivH+qDLpe84iRqX3CLrKp881cF160JvXJ+hjn1aMyCwYOKeIZefIH/P5cJoRw==", + "license": "MIT", + "dependencies": { + "@stablelib/keyagreement": "^1.0.1", + "@stablelib/random": "^1.0.2", + "@stablelib/wipe": "^1.0.1" + } + }, + "node_modules/@stablelib/xsalsa20": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@stablelib/xsalsa20/-/xsalsa20-1.0.2.tgz", + "integrity": "sha512-7XdBGbcNgBShmuhDXv1G1WPVCkjZdkb1oPMzSidO7Fve0MHntH6TjFkj5bfLI+aRE+61weO076vYpP/jmaAYog==", + "license": "MIT", + "dependencies": { + "@stablelib/binary": "^1.0.1", + "@stablelib/salsa20": "^1.0.2", + "@stablelib/wipe": "^1.0.1" + } + }, + "node_modules/@supercharge/promise-pool": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/@supercharge/promise-pool/-/promise-pool-2.4.0.tgz", + "integrity": "sha512-O9CMipBlq5OObdt1uKJGIzm9cdjpPWfj+a+Zw9EgWKxaMNHKC7EU7X9taj3H0EGQNLOSq2jAcOa3EzxlfHsD6w==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/@taquito/http-utils": { + "version": "10.2.1", + "resolved": "https://registry.npmjs.org/@taquito/http-utils/-/http-utils-10.2.1.tgz", + "integrity": "sha512-RZmGxJFllTHC5LuxrPcVQoH/MpDvQehLjE1czSmL2Dz1VZlzI4Q6Ie+pG5nHQODRPqE8ABi/2aHAGGYMQWqKZg==", + "peer": true, + "dependencies": { + "xhr2-cookies": "^1.1.0" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@taquito/local-forging": { + "version": "12.1.1", + "resolved": "https://registry.npmjs.org/@taquito/local-forging/-/local-forging-12.1.1.tgz", + "integrity": "sha512-SUA1YYRIpEGsTy5OfUIgIem0k/QsAzGjDCvf/wl5XV/fVBkP/+GN7uvYoqgJblCmsgtsMBhJFtXgs+D6bjGexg==", + "dependencies": { + "@taquito/utils": "^12.1.1", + "bignumber.js": "^9.0.2" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@taquito/michel-codec": { + "version": "10.2.1", + "resolved": "https://registry.npmjs.org/@taquito/michel-codec/-/michel-codec-10.2.1.tgz", + "integrity": "sha512-VSHELyuiwso1qCpAEZkH7JdDlZdHxTjyvZcBsfnfpbdpCrAUpCB48P4NZOnvZ58SYt9VS1bNAa5GRvQyOnNvMQ==", + "peer": true, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@taquito/michelson-encoder": { + "version": "10.2.1", + "resolved": "https://registry.npmjs.org/@taquito/michelson-encoder/-/michelson-encoder-10.2.1.tgz", + "integrity": "sha512-HYCtDGCWtyCgOQjmxYLYw5ftejG0FUfAW1FzZWIW6w2ars1TInSbLNeVRZs+EmbD3L8wOaxaOlgdsMoDnGqM/g==", + "peer": true, + "dependencies": { + "@taquito/rpc": "^10.2.1", + "@taquito/utils": "^10.2.1", + "bignumber.js": "^9.0.1", + "fast-json-stable-stringify": "^2.1.0" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@taquito/michelson-encoder/node_modules/@taquito/utils": { + "version": "10.2.1", + "resolved": "https://registry.npmjs.org/@taquito/utils/-/utils-10.2.1.tgz", + "integrity": "sha512-oW/D9irojwjorIV/0yO32Gyr+zSnITkVkOwVmnxge6DYHWC7aqPbdwiDwc4/GewKXNngBDqDEjEEPhkp0ZnvJw==", + "peer": true, + "dependencies": { + "blakejs": "^1.1.0", + "bs58check": "^2.1.2", + "buffer": "^6.0.3" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@taquito/rpc": { + "version": "10.2.1", + "resolved": "https://registry.npmjs.org/@taquito/rpc/-/rpc-10.2.1.tgz", + "integrity": "sha512-Vg80sGLICkEKGls+7YEd0uFpsp8dwx2kNeGgCbpNROIs0S6Slsd0UfDlaZGlllWeUAKr5r6baexYrTKFuWs/UA==", + "peer": true, + "dependencies": { + "@taquito/http-utils": "^10.2.1", + "bignumber.js": "^9.0.1", + "lodash": "^4.17.21" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@taquito/signer": { + "version": "12.1.1", + "resolved": "https://registry.npmjs.org/@taquito/signer/-/signer-12.1.1.tgz", + "integrity": "sha512-TONxIbLs7bgmB3TTzcTOYzL8pFLZFBujHDHjB5QHJY5DT+lpByjYZHk2Frqjcy3NDvENVLU6uXeCeba2LK8kwA==", + "license": "MIT", + "dependencies": { + "@stablelib/blake2b": "^1.0.1", + "@stablelib/ed25519": "^1.0.2", + "@stablelib/nacl": "^1.0.3", + "@taquito/taquito": "^12.1.1", + "@taquito/utils": "^12.1.1", + "elliptic": "^6.5.4", + "pbkdf2": "^3.1.2", + "typedarray-to-buffer": "^4.0.0" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@taquito/signer/node_modules/@taquito/http-utils": { + "version": "12.1.1", + "resolved": "https://registry.npmjs.org/@taquito/http-utils/-/http-utils-12.1.1.tgz", + "integrity": "sha512-Zlp/eTRVjFs0XEIiAhgxkh6s9npF4dO+e/Sm2XWsDmNPoGI2jdXNH0L+NiKJIOkYcu0CXlcgriTeEaYnbeTvcA==", + "dependencies": { + "axios": "^0.26.0" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@taquito/signer/node_modules/@taquito/michel-codec": { + "version": "12.1.1", + "resolved": "https://registry.npmjs.org/@taquito/michel-codec/-/michel-codec-12.1.1.tgz", + "integrity": "sha512-BAig8YyLyRW5kxV/r0S191W+SvYuiTRJpgSp5IsgCDLAOh+d4/xq6IgU3PuGJgokQDstZdTbjpkrgRCnufR8lw==", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@taquito/signer/node_modules/@taquito/michelson-encoder": { + "version": "12.1.1", + "resolved": "https://registry.npmjs.org/@taquito/michelson-encoder/-/michelson-encoder-12.1.1.tgz", + "integrity": "sha512-mWcA1DHHlFj7UswJpEmml853x9e0IYHyeiKZYAo7DtizHz0jiUWtptCuEWiPQ4fMOreFbYZ6KVYenoVfQVNrqA==", + "dependencies": { + "@taquito/rpc": "^12.1.1", + "@taquito/utils": "^12.1.1", + "bignumber.js": "^9.0.2", + "fast-json-stable-stringify": "^2.1.0" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@taquito/signer/node_modules/@taquito/rpc": { + "version": "12.1.1", + "resolved": "https://registry.npmjs.org/@taquito/rpc/-/rpc-12.1.1.tgz", + "integrity": "sha512-CgAF9kdmKLa/UbmiqApDtncCQGiG7kEOIYis8IIa0JUT9JD1H8WBbSNF/oNh4e0soWUK9BL2qU369RFnxIW+iA==", + "dependencies": { + "@taquito/http-utils": "^12.1.1", + "@taquito/utils": "^12.1.1", + "bignumber.js": "^9.0.2" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@taquito/signer/node_modules/@taquito/taquito": { + "version": "12.1.1", + "resolved": "https://registry.npmjs.org/@taquito/taquito/-/taquito-12.1.1.tgz", + "integrity": "sha512-HvbtClQ7isrDd17X/LEKkPzzeVYA8EMUem3qrkl9qvDO6FpJx/QLbUpYfT2PC0pLUkSrzdLGzmESHAOZhcksaw==", + "hasInstallScript": true, + "dependencies": { + "@taquito/http-utils": "^12.1.1", + "@taquito/local-forging": "^12.1.1", + "@taquito/michel-codec": "^12.1.1", + "@taquito/michelson-encoder": "^12.1.1", + "@taquito/rpc": "^12.1.1", + "@taquito/utils": "^12.1.1", + "bignumber.js": "^9.0.2", + "rxjs": "^6.6.3" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@taquito/signer/node_modules/axios": { + "version": "0.26.1", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.26.1.tgz", + "integrity": "sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA==", + "dependencies": { + "follow-redirects": "^1.14.8" + } + }, + "node_modules/@taquito/signer/node_modules/rxjs": { + "version": "6.6.7", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.7.tgz", + "integrity": "sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ==", + "dependencies": { + "tslib": "^1.9.0" + }, + "engines": { + "npm": ">=2.0.0" + } + }, + "node_modules/@taquito/signer/node_modules/tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" + }, + "node_modules/@taquito/taquito": { + "version": "10.2.1", + "resolved": "https://registry.npmjs.org/@taquito/taquito/-/taquito-10.2.1.tgz", + "integrity": "sha512-ay61aKhFQPnYGu5d9jqEvaZE0EzE6tO9MD+5vOu6/NFVThBd7ysOQS1PB0VprL9SupM1NVDFnEJ8GtE8SYgk8g==", + "hasInstallScript": true, + "peer": true, + "dependencies": { + "@taquito/http-utils": "^10.2.1", + "@taquito/michel-codec": "^10.2.1", + "@taquito/michelson-encoder": "^10.2.1", + "@taquito/rpc": "^10.2.1", + "@taquito/utils": "^10.2.1", + "bignumber.js": "^9.0.1", + "rx-sandbox": "^1.0.4", + "rxjs": "^6.6.3" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@taquito/taquito/node_modules/@taquito/utils": { + "version": "10.2.1", + "resolved": "https://registry.npmjs.org/@taquito/utils/-/utils-10.2.1.tgz", + "integrity": "sha512-oW/D9irojwjorIV/0yO32Gyr+zSnITkVkOwVmnxge6DYHWC7aqPbdwiDwc4/GewKXNngBDqDEjEEPhkp0ZnvJw==", + "peer": true, + "dependencies": { + "blakejs": "^1.1.0", + "bs58check": "^2.1.2", + "buffer": "^6.0.3" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@taquito/taquito/node_modules/rx-sandbox": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/rx-sandbox/-/rx-sandbox-1.0.4.tgz", + "integrity": "sha512-+/9MHDYNoF9ca/2RR+L2LloXXeQyIR3k/wjK03IicrxxlbkhmKF4ejPiWeafMWDg7otF+pnX5NE/8v/rX6ICJA==", + "peer": true, + "dependencies": { + "expect": "^26.6.1", + "jest-matcher-utils": "^26.6.1" + }, + "engines": { + "node": ">=4.2.4", + "npm": ">=3.0.0" + }, + "peerDependencies": { + "rxjs": "6.x" + } + }, + "node_modules/@taquito/taquito/node_modules/rxjs": { + "version": "6.6.7", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.7.tgz", + "integrity": "sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ==", + "license": "Apache-2.0", + "peer": true, + "dependencies": { + "tslib": "^1.9.0" + }, + "engines": { + "npm": ">=2.0.0" + } + }, + "node_modules/@taquito/taquito/node_modules/tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", + "license": "0BSD", + "peer": true + }, + "node_modules/@taquito/utils": { + "version": "12.1.1", + "resolved": "https://registry.npmjs.org/@taquito/utils/-/utils-12.1.1.tgz", + "integrity": "sha512-GxNSBrA02vwhy56ayWB49VZficB+j2oyhPdlsRb2CguephmyEYnlUaNV27ILa6dPDW+zv6+QWQj6GyqLBRpIlA==", + "license": "MIT", + "dependencies": { + "@stablelib/blake2b": "^1.0.1", + "@stablelib/ed25519": "^1.0.2", + "@types/bs58check": "^2.1.0", + "blakejs": "^1.1.1", + "bs58check": "^2.1.2", + "buffer": "^6.0.3", + "elliptic": "^6.5.4", + "typedarray-to-buffer": "^4.0.0" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@temple-wallet/dapp": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/@temple-wallet/dapp/-/dapp-5.0.2.tgz", + "integrity": "sha512-IIeHTowHXOp7/JnttfzMyCJjFWwhqOauDN7S2vU0GzHkpT5gH6FBXqB3kvZUyPfoxY0PXuXg+HKh++qABx+g9A==", + "license": "MIT", + "dependencies": { + "nanoid": "^3.1.25" + }, + "peerDependencies": { + "@taquito/taquito": "^10.0.0" + } + }, + "node_modules/@tsconfig/node10": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz", + "integrity": "sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@tsconfig/node12": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", + "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==", + "dev": true, + "license": "MIT" + }, + "node_modules/@tsconfig/node14": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", + "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==", + "dev": true, + "license": "MIT" + }, + "node_modules/@tsconfig/node16": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.3.tgz", + "integrity": "sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/async-retry": { + "version": "1.4.5", + "resolved": "https://registry.npmjs.org/@types/async-retry/-/async-retry-1.4.5.tgz", + "integrity": "sha512-YrdjSD+yQv7h6d5Ip+PMxh3H6ZxKyQk0Ts+PvaNRInxneG9PFVZjFg77ILAN+N6qYf7g4giSJ1l+ZjQ1zeegvA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/retry": "*" + } + }, + "node_modules/@types/bn.js": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/@types/bn.js/-/bn.js-5.1.1.tgz", + "integrity": "sha512-qNrYbZqMx0uJAfKnKclPh+dTwK33KfLHYqtyODwd5HnXOjnkhc4qgn3BrK6RWyGZm5+sIFE7Q7Vz6QQtJB7w7g==", + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/bs58check": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@types/bs58check/-/bs58check-2.1.0.tgz", + "integrity": "sha512-OxsysnJQh82vy9DRbOcw9m2j/WiyqZLn0YBhKxdQ+aCwoHj+tWzyCgpwAkr79IfDXZKxc6h7k89T9pwS78CqTQ==", + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/connect": { + "version": "3.4.35", + "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.35.tgz", + "integrity": "sha512-cdeYyv4KWoEgpBISTxWvqYsVy444DOqehiF3fM3ne10AmJ62RSyNkUnxMJXHQWRQQX2eR94m5y1IZyDwBjV9FQ==", + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/istanbul-lib-coverage": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz", + "integrity": "sha512-z/QT1XN4K4KYuslS23k62yDIDLwLFkzxOuMplDtObz0+y7VqJCaO2o+SPwHCvLFZh7xazvvoor2tA/hPz9ee7g==", + "peer": true + }, + "node_modules/@types/istanbul-lib-report": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz", + "integrity": "sha512-plGgXAPfVKFoYfa9NpYDAkseG+g6Jr294RqeqcqDixSbU34MZVJRi/P+7Y8GDpzkEwLaGZZOpKIEmeVZNtKsrg==", + "peer": true, + "dependencies": { + "@types/istanbul-lib-coverage": "*" + } + }, + "node_modules/@types/istanbul-reports": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-3.0.1.tgz", + "integrity": "sha512-c3mAZEuK0lvBp8tmuL74XRKn1+y2dcwOUpH7x4WrF6gk1GIgiluDRgMYQtw2OFcBvAJWlt6ASU3tSqxp0Uu0Aw==", + "peer": true, + "dependencies": { + "@types/istanbul-lib-report": "*" + } + }, + "node_modules/@types/node": { + "version": "20.1.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.1.0.tgz", + "integrity": "sha512-O+z53uwx64xY7D6roOi4+jApDGFg0qn6WHcxe5QeqjMaTezBO/mxdfFXIVAVVyNWKx84OmPB3L8kbVYOTeN34A==", + "license": "MIT" + }, + "node_modules/@types/retry": { + "version": "0.12.2", + "resolved": "https://registry.npmjs.org/@types/retry/-/retry-0.12.2.tgz", + "integrity": "sha512-XISRgDJ2Tc5q4TRqvgJtzsRkFYNJzZrhTdtMoGVBttwzzQJkPnS3WWTFc7kuDRoPtPakl+T+OfdEUjYJj7Jbow==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/stack-utils": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.1.tgz", + "integrity": "sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw==", + "peer": true + }, + "node_modules/@types/ws": { + "version": "7.4.7", + "resolved": "https://registry.npmjs.org/@types/ws/-/ws-7.4.7.tgz", + "integrity": "sha512-JQbbmxZTZehdc2iszGKs5oC3NFnjeay7mtAWrdt7qNtAVK0g19muApzAy4bm9byz79xa2ZnO/BOBC2R8RC5Lww==", + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/yargs": { + "version": "15.0.15", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-15.0.15.tgz", + "integrity": "sha512-IziEYMU9XoVj8hWg7k+UJrXALkGFjWJhn5QFEv9q4p+v40oZhSuC135M38st8XPjICL7Ey4TV64ferBGUoJhBg==", + "peer": true, + "dependencies": { + "@types/yargs-parser": "*" + } + }, + "node_modules/@types/yargs-parser": { + "version": "21.0.0", + "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.0.tgz", + "integrity": "sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA==", + "peer": true + }, + "node_modules/@wallet-standard/base": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@wallet-standard/base/-/base-1.0.1.tgz", + "integrity": "sha512-1To3ekMfzhYxe0Yhkpri+Fedq0SYcfrOfJi3vbLjMwF2qiKPjTGLwZkf2C9ftdQmxES+hmxhBzTwF4KgcOwf8w==", + "license": "Apache-2.0", + "engines": { + "node": ">=16" + } + }, + "node_modules/@wallet-standard/features": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@wallet-standard/features/-/features-1.0.3.tgz", + "integrity": "sha512-m8475I6W5LTatTZuUz5JJNK42wFRgkJTB0I9tkruMwfqBF2UN2eomkYNVf9RbrsROelCRzSFmugqjKZBFaubsA==", + "license": "Apache-2.0", + "dependencies": { + "@wallet-standard/base": "^1.0.1" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/abort-controller": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", + "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", + "license": "MIT", + "dependencies": { + "event-target-shim": "^5.0.0" + }, + "engines": { + "node": ">=6.5" + } + }, + "node_modules/acorn": { + "version": "8.8.2", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz", + "integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==", + "dev": true, + "license": "MIT", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-jsx": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, + "node_modules/acorn-walk": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", + "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/aes-js": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-3.0.0.tgz", + "integrity": "sha512-H7wUZRn8WpTq9jocdxQ2c8x2sKo9ZVmzfRE13GiNJXfp7NcKYEdvl3vspKjXox6RIG2VtaRe4JFvxG4rqp2Zuw==", + "license": "MIT" + }, + "node_modules/agentkeepalive": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.3.0.tgz", + "integrity": "sha512-7Epl1Blf4Sy37j4v9f9FjICCh4+KAQOyXgHEwlyBiAQLbhKdq/i2QQU3amQalS/wPhdPzDXPL5DMR5bkn+YeWg==", + "license": "MIT", + "dependencies": { + "debug": "^4.1.0", + "depd": "^2.0.0", + "humanize-ms": "^1.2.1" + }, + "engines": { + "node": ">= 8.0.0" + } + }, + "node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/algo-msgpack-with-bigint": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/algo-msgpack-with-bigint/-/algo-msgpack-with-bigint-2.1.1.tgz", + "integrity": "sha512-F1tGh056XczEaEAqu7s+hlZUDWwOBT70Eq0lfMpBP2YguSQVyxRbprLq5rELXKQOyOaixTWYhMeMQMzP0U5FoQ==", + "license": "ISC", + "engines": { + "node": ">= 10" + } + }, + "node_modules/algosdk": { + "version": "1.24.1", + "resolved": "https://registry.npmjs.org/algosdk/-/algosdk-1.24.1.tgz", + "integrity": "sha512-9moZxdqeJ6GdE4N6fA/GlUP4LrbLZMYcYkt141J4Ss68OfEgH9qW0wBuZ3ZOKEx/xjc5bg7mLP2Gjg7nwrkmww==", + "license": "MIT", + "dependencies": { + "algo-msgpack-with-bigint": "^2.1.1", + "buffer": "^6.0.2", + "cross-fetch": "^3.1.5", + "hi-base32": "^0.5.1", + "js-sha256": "^0.9.0", + "js-sha3": "^0.8.0", + "js-sha512": "^0.8.0", + "json-bigint": "^1.0.0", + "tweetnacl": "^1.0.3", + "vlq": "^2.0.4" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/ansi-escapes": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", + "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==", + "license": "MIT", + "dependencies": { + "type-fest": "^0.21.3" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ansi-escapes/node_modules/type-fest": { + "version": "0.21.3", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", + "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", + "license": "(MIT OR CC0-1.0)", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/ansicolors": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/ansicolors/-/ansicolors-0.3.2.tgz", + "integrity": "sha512-QXu7BPrP29VllRxH8GwB7x5iX5qWKAAMLqKQGWTeLWVlNHNOpVMJ91dsxQAIWXpjuW5wqvxu3Jd/nRjrJ+0pqg==", + "license": "MIT" + }, + "node_modules/arbundles": { + "version": "0.6.22", + "resolved": "https://registry.npmjs.org/arbundles/-/arbundles-0.6.22.tgz", + "integrity": "sha512-QlSavBHk59mNqgQ6ScxlqaBJlDbSmSrK/uTcF3HojLAZ/4aufTkVTBjl1hSfZ/ZN45oIPgJC05R8SmVARF+8VA==", + "license": "Apache-2.0", + "dependencies": { + "@noble/ed25519": "^1.6.1", + "@randlabs/myalgo-connect": "^1.1.2", + "@solana/wallet-adapter-base": "^0.9.2", + "algosdk": "^1.13.1", + "arweave": "^1.11.4", + "arweave-stream-tx": "^1.1.0", + "avsc": "https://github.com/Bundlr-Network/avsc#csp-fixes", + "axios": "^0.21.3", + "base64url": "^3.0.1", + "bs58": "^4.0.1", + "ethers": "^5.5.1", + "keccak": "^3.0.2", + "multistream": "^4.1.0", + "process": "^0.11.10", + "secp256k1": "^4.0.2", + "tmp-promise": "^3.0.2" + } + }, + "node_modules/arbundles/node_modules/axios": { + "version": "0.21.4", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.4.tgz", + "integrity": "sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==", + "license": "MIT", + "dependencies": { + "follow-redirects": "^1.14.0" + } + }, + "node_modules/arconnect": { + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/arconnect/-/arconnect-0.4.2.tgz", + "integrity": "sha512-Jkpd4QL3TVqnd3U683gzXmZUVqBUy17DdJDuL/3D9rkysLgX6ymJ2e+sR+xyZF5Rh42CBqDXWNMmCjBXeP7Gbw==", + "license": "MIT", + "dependencies": { + "arweave": "^1.10.13" + } + }, + "node_modules/arg": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", + "dev": true, + "license": "MIT" + }, + "node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true, + "license": "Python-2.0" + }, + "node_modules/arweave": { + "version": "1.13.7", + "resolved": "https://registry.npmjs.org/arweave/-/arweave-1.13.7.tgz", + "integrity": "sha512-Hv+x2bSI6UyBHpuVbUDMMpMje1ETfpJWj52kKfz44O0IqDRi/LukOkkDUptup1p6OT6KP1/DdpnUnsNHoskFeA==", + "license": "MIT", + "dependencies": { + "arconnect": "^0.4.2", + "asn1.js": "^5.4.1", + "base64-js": "^1.5.1", + "bignumber.js": "^9.0.2" + }, + "engines": { + "node": ">=16.15.0" + } + }, + "node_modules/arweave-stream-tx": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/arweave-stream-tx/-/arweave-stream-tx-1.2.2.tgz", + "integrity": "sha512-bNt9rj0hbAEzoUZEF2s6WJbIz8nasZlZpxIw03Xm8fzb9gRiiZlZGW3lxQLjfc9Z0VRUWDzwtqoYeEoB/JDToQ==", + "dependencies": { + "exponential-backoff": "^3.1.0" + }, + "peerDependencies": { + "arweave": "^1.10.0" + } + }, + "node_modules/asn1.js": { + "version": "5.4.1", + "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-5.4.1.tgz", + "integrity": "sha512-+I//4cYPccV8LdmBLiX8CYvf9Sp3vQsrqu2QNXRcrbiWvcx/UdlFiqUJJzxRQxgsZmvhXhn4cSKeSmoFjVdupA==", + "license": "MIT", + "dependencies": { + "bn.js": "^4.0.0", + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0", + "safer-buffer": "^2.1.0" + } + }, + "node_modules/asn1.js/node_modules/bn.js": { + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", + "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==", + "license": "MIT" + }, + "node_modules/async-retry": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/async-retry/-/async-retry-1.3.3.tgz", + "integrity": "sha512-wfr/jstw9xNi/0teMHrRW7dsz3Lt5ARhYNZ2ewpadnhaIp5mbALhOAP+EAdsC7t4Z6wqsDVv9+W6gm1Dk9mEyw==", + "license": "MIT", + "dependencies": { + "retry": "0.13.1" + } + }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", + "license": "MIT" + }, + "node_modules/at-least-node": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz", + "integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==", + "peer": true, + "engines": { + "node": ">= 4.0.0" + } + }, + "node_modules/available-typed-arrays": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz", + "integrity": "sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/avsc": { + "version": "5.4.7", + "resolved": "git+ssh://git@github.com/Bundlr-Network/avsc.git#a730cc8018b79e114b6a3381bbb57760a24c6cef", + "license": "MIT", + "engines": { + "node": ">=0.11" + } + }, + "node_modules/aws-sdk": { + "version": "2.1373.0", + "resolved": "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.1373.0.tgz", + "integrity": "sha512-3/P79VU2VVeiof25bn8TSepEhWCRhwuQGYoEWX/2pApQRJAY+w/3JFVKHjbAe3NYEEBNeiAE6PQ9DqWz5Pp+Lw==", + "license": "Apache-2.0", + "dependencies": { + "buffer": "4.9.2", + "events": "1.1.1", + "ieee754": "1.1.13", + "jmespath": "0.16.0", + "querystring": "0.2.0", + "sax": "1.2.1", + "url": "0.10.3", + "util": "^0.12.4", + "uuid": "8.0.0", + "xml2js": "0.5.0" + }, + "engines": { + "node": ">= 10.0.0" + } + }, + "node_modules/aws-sdk/node_modules/buffer": { + "version": "4.9.2", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-4.9.2.tgz", + "integrity": "sha512-xq+q3SRMOxGivLhBNaUdC64hDTQwejJ+H0T/NB1XMtTVEwNTrfFF3gAxiyW0Bu/xWEGhjVKgUcMhCrUy2+uCWg==", + "license": "MIT", + "dependencies": { + "base64-js": "^1.0.2", + "ieee754": "^1.1.4", + "isarray": "^1.0.0" + } + }, + "node_modules/aws-sdk/node_modules/buffer/node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "BSD-3-Clause" + }, + "node_modules/aws-sdk/node_modules/ieee754": { + "version": "1.1.13", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.13.tgz", + "integrity": "sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg==", + "license": "BSD-3-Clause" + }, + "node_modules/aws-sdk/node_modules/uuid": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.0.0.tgz", + "integrity": "sha512-jOXGuXZAWdsTH7eZLtyXMqUb9EcWMGZNbL9YcGBJl4MH4nrxHmZJhEHvyLFrkxo+28uLb/NYRcStH48fnD0Vzw==", + "license": "MIT", + "bin": { + "uuid": "dist/bin/uuid" + } + }, + "node_modules/axios": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.27.2.tgz", + "integrity": "sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==", + "license": "MIT", + "dependencies": { + "follow-redirects": "^1.14.9", + "form-data": "^4.0.0" + } + }, + "node_modules/axios/node_modules/form-data": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "license": "MIT", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "license": "MIT" + }, + "node_modules/base-x": { + "version": "3.0.9", + "resolved": "https://registry.npmjs.org/base-x/-/base-x-3.0.9.tgz", + "integrity": "sha512-H7JU6iBHTal1gp56aKoaa//YUxEaAOUiydvrV/pILqIHXTtqxSkATOnDA2u+jZ/61sD+L/412+7kzXRtWukhpQ==", + "license": "MIT", + "dependencies": { + "safe-buffer": "^5.0.1" + } + }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/base64url": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/base64url/-/base64url-3.0.1.tgz", + "integrity": "sha512-ir1UPr3dkwexU7FdV8qBBbNDRUhMmIekYMFZfi+C/sLNnRESKPl23nB9b2pltqfOQNnGzsDdId90AEtG5tCx4A==", + "license": "MIT", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/bech32": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/bech32/-/bech32-1.1.4.tgz", + "integrity": "sha512-s0IrSOzLlbvX7yp4WBfPITzpAU8sqQcpsmwXDiKwrG4r491vwCO/XpejasRNl0piBMe/DvP4Tz0mIS/X1DPJBQ==", + "license": "MIT" + }, + "node_modules/bigint-buffer": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/bigint-buffer/-/bigint-buffer-1.1.5.tgz", + "integrity": "sha512-trfYco6AoZ+rKhKnxA0hgX0HAbVP/s808/EuDSe2JDzUnCp/xAsli35Orvk67UrTEcwuxZqYZDmfA2RXJgxVvA==", + "hasInstallScript": true, + "license": "Apache-2.0", + "dependencies": { + "bindings": "^1.3.0" + }, + "engines": { + "node": ">= 10.0.0" + } + }, + "node_modules/bignumber.js": { + "version": "9.1.1", + "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.1.1.tgz", + "integrity": "sha512-pHm4LsMJ6lzgNGVfZHjMoO8sdoRhOzOH4MLmY65Jg70bpxCKu5iOHNJyfF6OyvYw7t8Fpf35RuzUyqnQsj8Vig==", + "license": "MIT", + "engines": { + "node": "*" + } + }, + "node_modules/bindings": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", + "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", + "license": "MIT", + "dependencies": { + "file-uri-to-path": "1.0.0" + } + }, + "node_modules/bip39": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/bip39/-/bip39-3.0.2.tgz", + "integrity": "sha512-J4E1r2N0tUylTKt07ibXvhpT2c5pyAFgvuA5q1H9uDy6dEGpjV8jmymh3MTYJDLCNbIVClSB9FbND49I6N24MQ==", + "license": "ISC", + "dependencies": { + "@types/node": "11.11.6", + "create-hash": "^1.1.0", + "pbkdf2": "^3.0.9", + "randombytes": "^2.0.1" + } + }, + "node_modules/bip39-light": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/bip39-light/-/bip39-light-1.0.7.tgz", + "integrity": "sha512-WDTmLRQUsiioBdTs9BmSEmkJza+8xfJmptsNJjxnoq3EydSa/ZBXT6rm66KoT3PJIRYMnhSKNR7S9YL1l7R40Q==", + "license": "ISC", + "dependencies": { + "create-hash": "^1.1.0", + "pbkdf2": "^3.0.9" + } + }, + "node_modules/bip39/node_modules/@types/node": { + "version": "11.11.6", + "resolved": "https://registry.npmjs.org/@types/node/-/node-11.11.6.tgz", + "integrity": "sha512-Exw4yUWMBXM3X+8oqzJNRqZSwUAaS4+7NdvHqQuFi/d+synz++xmX3QIf+BFqneW8N31R8Ky+sikfZUXq07ggQ==", + "license": "MIT" + }, + "node_modules/bl": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", + "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", + "license": "MIT", + "dependencies": { + "buffer": "^5.5.0", + "inherits": "^2.0.4", + "readable-stream": "^3.4.0" + } + }, + "node_modules/bl/node_modules/buffer": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", + "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" + } + }, + "node_modules/blakejs": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/blakejs/-/blakejs-1.2.1.tgz", + "integrity": "sha512-QXUSXI3QVc/gJME0dBpXrag1kbzOqCjCX8/b54ntNyW6sjtoqxqRk3LTmXzaJoh71zMsDCjM+47jS7XiwN/+fQ==", + "license": "MIT" + }, + "node_modules/bluebird": { + "version": "3.7.2", + "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", + "integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==", + "license": "MIT" + }, + "node_modules/bn.js": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", + "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==", + "license": "MIT" + }, + "node_modules/borsh": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/borsh/-/borsh-0.7.0.tgz", + "integrity": "sha512-CLCsZGIBCFnPtkNnieW/a8wmreDmfUtjU2m9yHrzPXIlNbqVs0AQrSatSG6vdNYUqdc83tkQi2eHfF98ubzQLA==", + "license": "Apache-2.0", + "dependencies": { + "bn.js": "^5.2.0", + "bs58": "^4.0.0", + "text-encoding-utf-8": "^1.0.2" + } + }, + "node_modules/bowser": { + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/bowser/-/bowser-2.11.0.tgz", + "integrity": "sha512-AlcaJBi/pqqJBIQ8U9Mcpc9i8Aqxn88Skv5d+xBX006BY5u8N3mGLHa5Lgppa7L/HfwgwLgZ6NYs+Ag6uUmJRA==", + "license": "MIT" + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "peer": true, + "dependencies": { + "fill-range": "^7.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/brorand": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", + "integrity": "sha512-cKV8tMCEpQs4hK/ik71d6LrPOnpkpGBR0wzxqr68g2m/LB2GxVYQroAjMJZRVM1Y4BCjCKc3vAamxSzOY2RP+w==", + "license": "MIT" + }, + "node_modules/bs58": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/bs58/-/bs58-4.0.1.tgz", + "integrity": "sha512-Ok3Wdf5vOIlBrgCvTq96gBkJw+JUEzdBgyaza5HLtPm7yTHkjRy8+JzNyHF7BHa0bNWOQIp3m5YF0nnFcOIKLw==", + "license": "MIT", + "dependencies": { + "base-x": "^3.0.2" + } + }, + "node_modules/bs58check": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/bs58check/-/bs58check-2.1.2.tgz", + "integrity": "sha512-0TS1jicxdU09dwJMNZtVAfzPi6Q6QeN0pM1Fkzrjn+XYHvzMKPU3pHVpva+769iNVSfIYWf7LJ6WR+BuuMf8cA==", + "license": "MIT", + "dependencies": { + "bs58": "^4.0.0", + "create-hash": "^1.1.0", + "safe-buffer": "^5.1.2" + } + }, + "node_modules/buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" + } + }, + "node_modules/buffer-layout": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/buffer-layout/-/buffer-layout-1.2.2.tgz", + "integrity": "sha512-kWSuLN694+KTk8SrYvCqwP2WcgQjoRCiF5b4QDvkkz8EmgD+aWAIceGFKMIAdmF/pH+vpgNV3d3kAKorcdAmWA==", + "license": "MIT", + "engines": { + "node": ">=4.5" + } + }, + "node_modules/bufferutil": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.7.tgz", + "integrity": "sha512-kukuqc39WOHtdxtw4UScxF/WVnMFVSQVKhtx3AjZJzhd0RGZZldcrfSEbVsWWe6KNH253574cq5F+wpv0G9pJw==", + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "dependencies": { + "node-gyp-build": "^4.3.0" + }, + "engines": { + "node": ">=6.14.2" + } + }, + "node_modules/call-bind": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", + "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.1", + "get-intrinsic": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/camelcase": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/capability": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/capability/-/capability-0.2.5.tgz", + "integrity": "sha512-rsJZYVCgXd08sPqwmaIqjAd5SUTfonV0z/gDJ8D6cN8wQphky1kkAYEqQ+hmDxTw7UihvBfjUVUSY+DBEe44jg==", + "license": "MIT" + }, + "node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/chardet": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.7.0.tgz", + "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==", + "license": "MIT" + }, + "node_modules/check-more-types": { + "version": "2.24.0", + "resolved": "https://registry.npmjs.org/check-more-types/-/check-more-types-2.24.0.tgz", + "integrity": "sha512-Pj779qHxV2tuapviy1bSZNEL1maXr13bPYpsvSDB68HlYcYuhlDrmGd63i0JHMCLKzc7rUSNIrpdJlhVlNwrxA==", + "license": "MIT", + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/cipher-base": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz", + "integrity": "sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==", + "license": "MIT", + "dependencies": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "node_modules/cli-cursor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", + "integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==", + "license": "MIT", + "dependencies": { + "restore-cursor": "^3.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/cli-spinners": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.9.0.tgz", + "integrity": "sha512-4/aL9X3Wh0yiMQlE+eeRhWP6vclO3QRtw1JHKIT0FFUs5FjpFmESqtMvYZ0+lbzBw900b95mS0hohy+qn2VK/g==", + "license": "MIT", + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/cli-width": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-3.0.0.tgz", + "integrity": "sha512-FxqpkPPwu1HjuN93Omfm4h8uIanXofW0RxVEW3k5RKx+mJJYSthzNhp32Kzxxy3YAEZ/Dc/EWN1vZRY0+kOhbw==", + "license": "ISC", + "engines": { + "node": ">= 10" + } + }, + "node_modules/clone": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz", + "integrity": "sha512-JQHZ2QMW6l3aH/j6xCqQThY/9OH4D/9ls34cgkUBiEeocRTU04tHfKPBsUK1PqZCUQM7GiA0IIXJSuXHI64Kbg==", + "license": "MIT", + "engines": { + "node": ">=0.8" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "license": "MIT" + }, + "node_modules/colors": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz", + "integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==", + "peer": true, + "engines": { + "node": ">=0.1.90" + } + }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "license": "MIT", + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", + "license": "MIT" + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "license": "MIT" + }, + "node_modules/cookiejar": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/cookiejar/-/cookiejar-2.1.4.tgz", + "integrity": "sha512-LDx6oHrK+PhzLKJU9j5S7/Y3jM/mUHvD/DeI1WQmJn652iPC5Y4TBzC9l+5OMOXlyTTA+SmVUPm0HQUwpD5Jqw==", + "peer": true + }, + "node_modules/create-hash": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", + "integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==", + "license": "MIT", + "dependencies": { + "cipher-base": "^1.0.1", + "inherits": "^2.0.1", + "md5.js": "^1.3.4", + "ripemd160": "^2.0.1", + "sha.js": "^2.4.0" + } + }, + "node_modules/create-hmac": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz", + "integrity": "sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==", + "license": "MIT", + "dependencies": { + "cipher-base": "^1.0.3", + "create-hash": "^1.1.0", + "inherits": "^2.0.1", + "ripemd160": "^2.0.0", + "safe-buffer": "^5.0.1", + "sha.js": "^2.4.8" + } + }, + "node_modules/create-require": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/cross-fetch": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.1.5.tgz", + "integrity": "sha512-lvb1SBsI0Z7GDwmuid+mU3kWVBwTVUbe7S0H52yaaAdQOXq2YktTCZdlAcNKFzE6QtRz0snpw9bNiPeOIkkQvw==", + "license": "MIT", + "dependencies": { + "node-fetch": "2.6.7" + } + }, + "node_modules/cross-fetch/node_modules/node-fetch": { + "version": "2.6.7", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", + "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", + "license": "MIT", + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, + "node_modules/cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "license": "MIT", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/crypto-hash": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/crypto-hash/-/crypto-hash-1.3.0.tgz", + "integrity": "sha512-lyAZ0EMyjDkVvz8WOeVnuCPvKVBXcMv1l5SVqO1yC7PzTwrD/pPje/BIRbWhMoPe436U+Y2nD7f5bFx0kt+Sbg==", + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/csv": { + "version": "6.2.12", + "resolved": "https://registry.npmjs.org/csv/-/csv-6.2.12.tgz", + "integrity": "sha512-Q1+8O4MKIM9U9OqYc2+A6U0ijGrxzs1YqNDUWlqoS98dx9/Kln6dCuazhau8v7Gi5pUEpRcTtlBisy7AFGFr2A==", + "license": "MIT", + "dependencies": { + "csv-generate": "^4.2.6", + "csv-parse": "^5.3.10", + "csv-stringify": "^6.3.4", + "stream-transform": "^3.2.6" + }, + "engines": { + "node": ">= 0.1.90" + } + }, + "node_modules/csv-generate": { + "version": "4.2.6", + "resolved": "https://registry.npmjs.org/csv-generate/-/csv-generate-4.2.6.tgz", + "integrity": "sha512-VtnYqhWLcsUocA346ewFOk+rrqcoT663j11vXzD2uelXq9WguQ3QzDeVD8ISso7hhVtkDSHcWl9psdemeiEHDA==", + "license": "MIT" + }, + "node_modules/csv-parse": { + "version": "5.3.10", + "resolved": "https://registry.npmjs.org/csv-parse/-/csv-parse-5.3.10.tgz", + "integrity": "sha512-cTXY6iy0gN5Ha/cGILeDgQE+nKiKDU2m0DjSRdJhr86BN3cM7oefBsTk2aH0LQeaYtL7Z7HvW+jYoadmdhzeDA==", + "license": "MIT" + }, + "node_modules/csv-stringify": { + "version": "6.3.4", + "resolved": "https://registry.npmjs.org/csv-stringify/-/csv-stringify-6.3.4.tgz", + "integrity": "sha512-/VVkafziBS1WyiQWYQ/krnBW1lJbr0RbanP7mMrFwy9V/sG8Xk6bacMS9IjUN0x3Jpp2iowpz9Lofd/KJIZ1qA==", + "license": "MIT" + }, + "node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "license": "MIT", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/decimal.js": { + "version": "10.4.3", + "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.4.3.tgz", + "integrity": "sha512-VBBaLc1MgL5XpzgIP7ny5Z6Nx3UrRkIViUkPUdtl9aya5amy3De1gsUUSB1g3+3sExYNjCAsAznmukyxCb1GRA==", + "license": "MIT" + }, + "node_modules/deep-is": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/defaults": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.4.tgz", + "integrity": "sha512-eFuaLoy/Rxalv2kr+lqMlUnrDWV+3j4pljOIJgLIhI058IQfWJ7vXhyEIHu+HtC738klGALYxOKDO0bQP3tg8A==", + "license": "MIT", + "dependencies": { + "clone": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/delay": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/delay/-/delay-5.0.0.tgz", + "integrity": "sha512-ReEBKkIfe4ya47wlPYf/gu5ib6yUG0/Aez0JQZQz94kiWtRQvZIQbTiehsnwHvLSWJnQdhVeqYue7Id1dKr0qw==", + "license": "MIT", "engines": { - "node": ">= 10.8.0" + "node": ">=10" }, - "peerDependencies": { - "typescript": "3.9.x || 4.0.x || 4.1.x || 4.2.x" + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/@solendprotocol/solend-sdk/node_modules/typedoc-plugin-cname": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/typedoc-plugin-cname/-/typedoc-plugin-cname-1.0.1.tgz", - "integrity": "sha512-f97SS5RzDCVBa7Frg1VketIMAkEl3OTvBs9wM8lLEkJVWCIG2yXnszglA82on39gFwQ1tyq8tiuxRgb4569GpA==", - "peerDependencies": { - "typedoc": "^0.20.27" + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "license": "MIT", + "engines": { + "node": ">=0.4.0" } }, - "node_modules/@solendprotocol/solend-sdk/node_modules/typescript": { - "version": "4.2.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.2.4.tgz", - "integrity": "sha512-V+evlYHZnQkaz8TRBuxTA92yZBPotr5H+WhQ7bD3hZUndx5tGOa1fuCgeSjxAzM1RiN5IzvadIXTVefuuwZCRg==", - "peer": true, - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, + "node_modules/depd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", + "license": "MIT", "engines": { - "node": ">=4.2.0" + "node": ">= 0.8" } }, - "node_modules/@stablelib/binary": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@stablelib/binary/-/binary-1.0.1.tgz", - "integrity": "sha512-ClJWvmL6UBM/wjkvv/7m5VP3GMr9t0osr4yVgLZsLCOz4hGN9gIAFEqnJ0TsSMAN+n840nf2cHZnA5/KFqHC7Q==", - "dependencies": { - "@stablelib/int": "^1.0.1" + "node_modules/diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.3.1" } }, - "node_modules/@stablelib/blake2b": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@stablelib/blake2b/-/blake2b-1.0.1.tgz", - "integrity": "sha512-B3KyKoBAjkIFeH7romcF96i+pVFYk7K2SBQ1pZvaxV+epSBXJ+n0C66esUhyz6FF+5FbdQVm77C5fzGFcEZpKA==", - "dependencies": { - "@stablelib/binary": "^1.0.1", - "@stablelib/hash": "^1.0.1", - "@stablelib/wipe": "^1.0.1" + "node_modules/diff-sequences": { + "version": "26.6.2", + "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-26.6.2.tgz", + "integrity": "sha512-Mv/TDa3nZ9sbc5soK+OoA74BsS3mL37yixCvUAQkiuA4Wz6YtwP/K47n2rv2ovzHZvoiQeA5FTQOschKkEwB0Q==", + "peer": true, + "engines": { + "node": ">= 10.14.2" } }, - "node_modules/@stablelib/bytes": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@stablelib/bytes/-/bytes-1.0.1.tgz", - "integrity": "sha512-Kre4Y4kdwuqL8BR2E9hV/R5sOrUj6NanZaZis0V6lX5yzqC3hBuVSDXUIBqQv/sCpmuWRiHLwqiT1pqqjuBXoQ==" - }, - "node_modules/@stablelib/constant-time": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@stablelib/constant-time/-/constant-time-1.0.1.tgz", - "integrity": "sha512-tNOs3uD0vSJcK6z1fvef4Y+buN7DXhzHDPqRLSXUel1UfqMB1PWNsnnAezrKfEwTLpN0cGH2p9NNjs6IqeD0eg==" - }, - "node_modules/@stablelib/ed25519": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@stablelib/ed25519/-/ed25519-1.0.3.tgz", - "integrity": "sha512-puIMWaX9QlRsbhxfDc5i+mNPMY+0TmQEskunY1rZEBPi1acBCVQAhnsk/1Hk50DGPtVsZtAWQg4NHGlVaO9Hqg==", + "node_modules/doctrine": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", + "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", + "dev": true, + "license": "Apache-2.0", "dependencies": { - "@stablelib/random": "^1.0.2", - "@stablelib/sha512": "^1.0.1", - "@stablelib/wipe": "^1.0.1" + "esutils": "^2.0.2" + }, + "engines": { + "node": ">=6.0.0" } }, - "node_modules/@stablelib/hash": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@stablelib/hash/-/hash-1.0.1.tgz", - "integrity": "sha512-eTPJc/stDkdtOcrNMZ6mcMK1e6yBbqRBaNW55XA1jU8w/7QdnCF0CmMmOD1m7VSkBR44PWrMHU2l6r8YEQHMgg==" - }, - "node_modules/@stablelib/int": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@stablelib/int/-/int-1.0.1.tgz", - "integrity": "sha512-byr69X/sDtDiIjIV6m4roLVWnNNlRGzsvxw+agj8CIEazqWGOQp2dTYgQhtyVXV9wpO6WyXRQUzLV/JRNumT2w==" - }, - "node_modules/@stablelib/keyagreement": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@stablelib/keyagreement/-/keyagreement-1.0.1.tgz", - "integrity": "sha512-VKL6xBwgJnI6l1jKrBAfn265cspaWBPAPEc62VBQrWHLqVgNRE09gQ/AnOEyKUWrrqfD+xSQ3u42gJjLDdMDQg==", + "node_modules/dot-case": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/dot-case/-/dot-case-3.0.4.tgz", + "integrity": "sha512-Kv5nKlh6yRrdrGvxeJ2e5y2eRUpkUosIW4A2AS38zwSz27zu7ufDwQPi5Jhs3XAlGNetl3bmnGhQsMtkKJnj3w==", + "license": "MIT", "dependencies": { - "@stablelib/bytes": "^1.0.1" + "no-case": "^3.0.4", + "tslib": "^2.0.3" } }, - "node_modules/@stablelib/nacl": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/@stablelib/nacl/-/nacl-1.0.4.tgz", - "integrity": "sha512-PJ2U/MrkXSKUM8C4qFs87WeCNxri7KQwR8Cdwm9q2sweGuAtTvOJGuW0F3N+zn+ySLPJA98SYWSSpogMJ1gCmw==", - "dependencies": { - "@stablelib/poly1305": "^1.0.1", - "@stablelib/random": "^1.0.2", - "@stablelib/wipe": "^1.0.1", - "@stablelib/x25519": "^1.0.3", - "@stablelib/xsalsa20": "^1.0.2" + "node_modules/dotenv": { + "version": "8.6.0", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.6.0.tgz", + "integrity": "sha512-IrPdXQsk2BbzvCBGBOTmmSH5SodmqZNt4ERAZDmW4CT+tL8VtvinqywuANaFu4bOMWki16nqf0e4oC0QIaDr/g==", + "license": "BSD-2-Clause", + "engines": { + "node": ">=10" } }, - "node_modules/@stablelib/poly1305": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@stablelib/poly1305/-/poly1305-1.0.1.tgz", - "integrity": "sha512-1HlG3oTSuQDOhSnLwJRKeTRSAdFNVB/1djy2ZbS35rBSJ/PFqx9cf9qatinWghC2UbfOYD8AcrtbUQl8WoxabA==", - "dependencies": { - "@stablelib/constant-time": "^1.0.1", - "@stablelib/wipe": "^1.0.1" - } + "node_modules/duplexer": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.2.tgz", + "integrity": "sha512-jtD6YG370ZCIi/9GTaJKQxWTZD045+4R4hTk/x1UyoqadyJ9x9CgSi1RlVDQF8U2sxLLSnFkCaMihqljHIWgMg==", + "license": "MIT" }, - "node_modules/@stablelib/random": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@stablelib/random/-/random-1.0.2.tgz", - "integrity": "sha512-rIsE83Xpb7clHPVRlBj8qNe5L8ISQOzjghYQm/dZ7VaM2KHYwMW5adjQjrzTZCchFnNCNhkwtnOBa9HTMJCI8w==", + "node_modules/elliptic": { + "version": "6.5.4", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz", + "integrity": "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==", + "license": "MIT", "dependencies": { - "@stablelib/binary": "^1.0.1", - "@stablelib/wipe": "^1.0.1" + "bn.js": "^4.11.9", + "brorand": "^1.1.0", + "hash.js": "^1.0.0", + "hmac-drbg": "^1.0.1", + "inherits": "^2.0.4", + "minimalistic-assert": "^1.0.1", + "minimalistic-crypto-utils": "^1.0.1" } }, - "node_modules/@stablelib/salsa20": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@stablelib/salsa20/-/salsa20-1.0.2.tgz", - "integrity": "sha512-nfjKzw0KTKrrKBasEP+j7UP4I8Xudom8lVZIBCp0kQNARXq72IlSic0oabg2FC1NU68L4RdHrNJDd8bFwrphYA==", + "node_modules/elliptic/node_modules/bn.js": { + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", + "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==", + "license": "MIT" + }, + "node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "license": "MIT" + }, + "node_modules/error-polyfill": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/error-polyfill/-/error-polyfill-0.1.3.tgz", + "integrity": "sha512-XHJk60ufE+TG/ydwp4lilOog549iiQF2OAPhkk9DdiYWMrltz5yhDz/xnKuenNwP7gy3dsibssO5QpVhkrSzzg==", + "license": "MIT", "dependencies": { - "@stablelib/binary": "^1.0.1", - "@stablelib/constant-time": "^1.0.1", - "@stablelib/wipe": "^1.0.1" + "capability": "^0.2.5", + "o3": "^1.0.3", + "u3": "^0.1.1" } }, - "node_modules/@stablelib/sha512": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@stablelib/sha512/-/sha512-1.0.1.tgz", - "integrity": "sha512-13gl/iawHV9zvDKciLo1fQ8Bgn2Pvf7OV6amaRVKiq3pjQ3UmEpXxWiAfV8tYjUpeZroBxtyrwtdooQT/i3hzw==", + "node_modules/es6-promise": { + "version": "4.2.8", + "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", + "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==", + "license": "MIT" + }, + "node_modules/es6-promisify": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/es6-promisify/-/es6-promisify-5.0.0.tgz", + "integrity": "sha512-C+d6UdsYDk0lMebHNR4S2NybQMMngAOnOwYBQjTOiv0MkoJMP0Myw2mgpDLBcpfCmRLxyFqYhS/CfOENq4SJhQ==", + "license": "MIT", "dependencies": { - "@stablelib/binary": "^1.0.1", - "@stablelib/hash": "^1.0.1", - "@stablelib/wipe": "^1.0.1" + "es6-promise": "^4.0.3" } }, - "node_modules/@stablelib/wipe": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@stablelib/wipe/-/wipe-1.0.1.tgz", - "integrity": "sha512-WfqfX/eXGiAd3RJe4VU2snh/ZPwtSjLG4ynQ/vYzvghTh7dHFcI1wl+nrkWG6lGhukOxOsUHfv8dUXr58D0ayg==" + "node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } }, - "node_modules/@stablelib/x25519": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@stablelib/x25519/-/x25519-1.0.3.tgz", - "integrity": "sha512-KnTbKmUhPhHavzobclVJQG5kuivH+qDLpe84iRqX3CLrKp881cF160JvXJ+hjn1aMyCwYOKeIZefIH/P5cJoRw==", + "node_modules/eslint": { + "version": "8.40.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.40.0.tgz", + "integrity": "sha512-bvR+TsP9EHL3TqNtj9sCNJVAFK3fBN8Q7g5waghxyRsPLIMwL73XSKnZFK0hk/O2ANC+iAoq6PWMQ+IfBAJIiQ==", + "dev": true, + "license": "MIT", "dependencies": { - "@stablelib/keyagreement": "^1.0.1", - "@stablelib/random": "^1.0.2", - "@stablelib/wipe": "^1.0.1" + "@eslint-community/eslint-utils": "^4.2.0", + "@eslint-community/regexpp": "^4.4.0", + "@eslint/eslintrc": "^2.0.3", + "@eslint/js": "8.40.0", + "@humanwhocodes/config-array": "^0.11.8", + "@humanwhocodes/module-importer": "^1.0.1", + "@nodelib/fs.walk": "^1.2.8", + "ajv": "^6.10.0", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.2", + "debug": "^4.3.2", + "doctrine": "^3.0.0", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^7.2.0", + "eslint-visitor-keys": "^3.4.1", + "espree": "^9.5.2", + "esquery": "^1.4.2", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^6.0.1", + "find-up": "^5.0.0", + "glob-parent": "^6.0.2", + "globals": "^13.19.0", + "grapheme-splitter": "^1.0.4", + "ignore": "^5.2.0", + "import-fresh": "^3.0.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "is-path-inside": "^3.0.3", + "js-sdsl": "^4.1.4", + "js-yaml": "^4.1.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.4.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.1.2", + "natural-compare": "^1.4.0", + "optionator": "^0.9.1", + "strip-ansi": "^6.0.1", + "strip-json-comments": "^3.1.0", + "text-table": "^0.2.0" + }, + "bin": { + "eslint": "bin/eslint.js" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" } }, - "node_modules/@stablelib/xsalsa20": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@stablelib/xsalsa20/-/xsalsa20-1.0.2.tgz", - "integrity": "sha512-7XdBGbcNgBShmuhDXv1G1WPVCkjZdkb1oPMzSidO7Fve0MHntH6TjFkj5bfLI+aRE+61weO076vYpP/jmaAYog==", + "node_modules/eslint-scope": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.0.tgz", + "integrity": "sha512-DYj5deGlHBfMt15J7rdtyKNq/Nqlv5KfU4iodrQ019XESsRnwXH9KAE0y3cwtUHDo2ob7CypAnCqefh6vioWRw==", + "dev": true, + "license": "BSD-2-Clause", "dependencies": { - "@stablelib/binary": "^1.0.1", - "@stablelib/salsa20": "^1.0.2", - "@stablelib/wipe": "^1.0.1" + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" } }, - "node_modules/@supercharge/promise-pool": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/@supercharge/promise-pool/-/promise-pool-2.3.2.tgz", - "integrity": "sha512-f5+C7zv+QQivcUO1FH5lXi7GcuJ3CFuJF3Eg06iArhUs5ma0szCLEQwIY4+VQyh7m/RLVZdzvr4E4ZDnLe9MNg==", + "node_modules/eslint-visitor-keys": { + "version": "3.4.1", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.1.tgz", + "integrity": "sha512-pZnmmLwYzf+kWaM/Qgrvpen51upAktaaiI01nsJD/Yr3lMOdNtq0cxkrrg16w64VtisN6okbs7Q8AfGqj4c9fA==", + "dev": true, + "license": "Apache-2.0", "engines": { - "node": ">=8" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" } }, - "node_modules/@taquito/http-utils": { - "version": "10.2.1", - "resolved": "https://registry.npmjs.org/@taquito/http-utils/-/http-utils-10.2.1.tgz", - "integrity": "sha512-RZmGxJFllTHC5LuxrPcVQoH/MpDvQehLjE1czSmL2Dz1VZlzI4Q6Ie+pG5nHQODRPqE8ABi/2aHAGGYMQWqKZg==", - "peer": true, + "node_modules/espree": { + "version": "9.5.2", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.5.2.tgz", + "integrity": "sha512-7OASN1Wma5fum5SrNhFMAMJxOUAbhyfQ8dQ//PJaJbNw0URTPWqIghHWt1MmAANKhHZIYOHruW4Kw4ruUWOdGw==", + "dev": true, + "license": "BSD-2-Clause", "dependencies": { - "xhr2-cookies": "^1.1.0" + "acorn": "^8.8.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^3.4.1" }, "engines": { - "node": ">=6.0.0" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" } }, - "node_modules/@taquito/local-forging": { - "version": "12.1.1", - "resolved": "https://registry.npmjs.org/@taquito/local-forging/-/local-forging-12.1.1.tgz", - "integrity": "sha512-SUA1YYRIpEGsTy5OfUIgIem0k/QsAzGjDCvf/wl5XV/fVBkP/+GN7uvYoqgJblCmsgtsMBhJFtXgs+D6bjGexg==", + "node_modules/esquery": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.5.0.tgz", + "integrity": "sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg==", + "dev": true, + "license": "BSD-3-Clause", "dependencies": { - "@taquito/utils": "^12.1.1", - "bignumber.js": "^9.0.2" + "estraverse": "^5.1.0" }, "engines": { - "node": ">=6.0.0" + "node": ">=0.10" } }, - "node_modules/@taquito/michel-codec": { - "version": "10.2.1", - "resolved": "https://registry.npmjs.org/@taquito/michel-codec/-/michel-codec-10.2.1.tgz", - "integrity": "sha512-VSHELyuiwso1qCpAEZkH7JdDlZdHxTjyvZcBsfnfpbdpCrAUpCB48P4NZOnvZ58SYt9VS1bNAa5GRvQyOnNvMQ==", - "peer": true, + "node_modules/esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "estraverse": "^5.2.0" + }, "engines": { - "node": ">=6.0.0" + "node": ">=4.0" } }, - "node_modules/@taquito/michelson-encoder": { - "version": "10.2.1", - "resolved": "https://registry.npmjs.org/@taquito/michelson-encoder/-/michelson-encoder-10.2.1.tgz", - "integrity": "sha512-HYCtDGCWtyCgOQjmxYLYw5ftejG0FUfAW1FzZWIW6w2ars1TInSbLNeVRZs+EmbD3L8wOaxaOlgdsMoDnGqM/g==", - "peer": true, - "dependencies": { - "@taquito/rpc": "^10.2.1", - "@taquito/utils": "^10.2.1", - "bignumber.js": "^9.0.1", - "fast-json-stable-stringify": "^2.1.0" - }, + "node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "license": "BSD-2-Clause", "engines": { - "node": ">=6.0.0" + "node": ">=4.0" } }, - "node_modules/@taquito/michelson-encoder/node_modules/@taquito/utils": { - "version": "10.2.1", - "resolved": "https://registry.npmjs.org/@taquito/utils/-/utils-10.2.1.tgz", - "integrity": "sha512-oW/D9irojwjorIV/0yO32Gyr+zSnITkVkOwVmnxge6DYHWC7aqPbdwiDwc4/GewKXNngBDqDEjEEPhkp0ZnvJw==", - "peer": true, - "dependencies": { - "blakejs": "^1.1.0", - "bs58check": "^2.1.2", - "buffer": "^6.0.3" - }, + "node_modules/esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true, + "license": "BSD-2-Clause", "engines": { - "node": ">=6.0.0" + "node": ">=0.10.0" } }, - "node_modules/@taquito/michelson-encoder/node_modules/buffer": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", - "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "peer": true, + "node_modules/ethereum-cryptography": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-1.2.0.tgz", + "integrity": "sha512-6yFQC9b5ug6/17CQpCyE3k9eKBMdhyVjzUy1WkiuY/E4vj/SXDBbCw8QEIaXqf0Mf2SnY6RmpDcwlUmBSS0EJw==", + "license": "MIT", "dependencies": { - "base64-js": "^1.3.1", - "ieee754": "^1.2.1" + "@noble/hashes": "1.2.0", + "@noble/secp256k1": "1.7.1", + "@scure/bip32": "1.1.5", + "@scure/bip39": "1.1.1" } }, - "node_modules/@taquito/michelson-encoder/node_modules/ieee754": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", - "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "node_modules/ethers": { + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/ethers/-/ethers-5.7.2.tgz", + "integrity": "sha512-wswUsmWo1aOK8rR7DIKiWSw9DbLWe6x98Jrn8wcTflTVvaXhAMaB5zGAXy0GYQEQp9iO1iSHWVyARQm11zUtyg==", "funding": [ { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" }, { - "type": "consulting", - "url": "https://feross.org/support" + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" } ], - "peer": true + "license": "MIT", + "dependencies": { + "@ethersproject/abi": "5.7.0", + "@ethersproject/abstract-provider": "5.7.0", + "@ethersproject/abstract-signer": "5.7.0", + "@ethersproject/address": "5.7.0", + "@ethersproject/base64": "5.7.0", + "@ethersproject/basex": "5.7.0", + "@ethersproject/bignumber": "5.7.0", + "@ethersproject/bytes": "5.7.0", + "@ethersproject/constants": "5.7.0", + "@ethersproject/contracts": "5.7.0", + "@ethersproject/hash": "5.7.0", + "@ethersproject/hdnode": "5.7.0", + "@ethersproject/json-wallets": "5.7.0", + "@ethersproject/keccak256": "5.7.0", + "@ethersproject/logger": "5.7.0", + "@ethersproject/networks": "5.7.1", + "@ethersproject/pbkdf2": "5.7.0", + "@ethersproject/properties": "5.7.0", + "@ethersproject/providers": "5.7.2", + "@ethersproject/random": "5.7.0", + "@ethersproject/rlp": "5.7.0", + "@ethersproject/sha2": "5.7.0", + "@ethersproject/signing-key": "5.7.0", + "@ethersproject/solidity": "5.7.0", + "@ethersproject/strings": "5.7.0", + "@ethersproject/transactions": "5.7.0", + "@ethersproject/units": "5.7.0", + "@ethersproject/wallet": "5.7.0", + "@ethersproject/web": "5.7.1", + "@ethersproject/wordlists": "5.7.0" + } }, - "node_modules/@taquito/rpc": { - "version": "10.2.1", - "resolved": "https://registry.npmjs.org/@taquito/rpc/-/rpc-10.2.1.tgz", - "integrity": "sha512-Vg80sGLICkEKGls+7YEd0uFpsp8dwx2kNeGgCbpNROIs0S6Slsd0UfDlaZGlllWeUAKr5r6baexYrTKFuWs/UA==", - "peer": true, + "node_modules/event-stream": { + "version": "3.3.4", + "resolved": "https://registry.npmjs.org/event-stream/-/event-stream-3.3.4.tgz", + "integrity": "sha512-QHpkERcGsR0T7Qm3HNJSyXKEEj8AHNxkY3PK8TS2KJvQ7NiSHe3DDpwVKKtoYprL/AreyzFBeIkBIWChAqn60g==", + "license": "MIT", "dependencies": { - "@taquito/http-utils": "^10.2.1", - "bignumber.js": "^9.0.1", - "lodash": "^4.17.21" - }, + "duplexer": "~0.1.1", + "from": "~0", + "map-stream": "~0.1.0", + "pause-stream": "0.0.11", + "split": "0.3", + "stream-combiner": "~0.0.4", + "through": "~2.3.1" + } + }, + "node_modules/event-target-shim": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", + "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==", + "license": "MIT", "engines": { - "node": ">=6.0.0" + "node": ">=6" } }, - "node_modules/@taquito/signer": { - "version": "12.1.1", - "resolved": "https://registry.npmjs.org/@taquito/signer/-/signer-12.1.1.tgz", - "integrity": "sha512-TONxIbLs7bgmB3TTzcTOYzL8pFLZFBujHDHjB5QHJY5DT+lpByjYZHk2Frqjcy3NDvENVLU6uXeCeba2LK8kwA==", - "dependencies": { - "@stablelib/blake2b": "^1.0.1", - "@stablelib/ed25519": "^1.0.2", - "@stablelib/nacl": "^1.0.3", - "@taquito/taquito": "^12.1.1", - "@taquito/utils": "^12.1.1", - "elliptic": "^6.5.4", - "pbkdf2": "^3.1.2", - "typedarray-to-buffer": "^4.0.0" - }, + "node_modules/eventemitter3": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", + "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==", + "license": "MIT" + }, + "node_modules/events": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/events/-/events-1.1.1.tgz", + "integrity": "sha512-kEcvvCBByWXGnZy6JUlgAp2gBIUjfCAV6P6TgT1/aaQKcmuAEC4OZTV1I4EWQLz2gxZw76atuVyvHhTxvi0Flw==", + "license": "MIT", "engines": { - "node": ">=6.0.0" + "node": ">=0.4.x" } }, - "node_modules/@taquito/signer/node_modules/@taquito/http-utils": { - "version": "12.1.1", - "resolved": "https://registry.npmjs.org/@taquito/http-utils/-/http-utils-12.1.1.tgz", - "integrity": "sha512-Zlp/eTRVjFs0XEIiAhgxkh6s9npF4dO+e/Sm2XWsDmNPoGI2jdXNH0L+NiKJIOkYcu0CXlcgriTeEaYnbeTvcA==", + "node_modules/execa": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", + "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", + "license": "MIT", "dependencies": { - "axios": "^0.26.0" + "cross-spawn": "^7.0.3", + "get-stream": "^6.0.0", + "human-signals": "^2.1.0", + "is-stream": "^2.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^4.0.1", + "onetime": "^5.1.2", + "signal-exit": "^3.0.3", + "strip-final-newline": "^2.0.0" }, "engines": { - "node": ">=6.0.0" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sindresorhus/execa?sponsor=1" } }, - "node_modules/@taquito/signer/node_modules/@taquito/michel-codec": { - "version": "12.1.1", - "resolved": "https://registry.npmjs.org/@taquito/michel-codec/-/michel-codec-12.1.1.tgz", - "integrity": "sha512-BAig8YyLyRW5kxV/r0S191W+SvYuiTRJpgSp5IsgCDLAOh+d4/xq6IgU3PuGJgokQDstZdTbjpkrgRCnufR8lw==", + "node_modules/expect": { + "version": "26.6.2", + "resolved": "https://registry.npmjs.org/expect/-/expect-26.6.2.tgz", + "integrity": "sha512-9/hlOBkQl2l/PLHJx6JjoDF6xPKcJEsUlWKb23rKE7KzeDqUZKXKNMW27KIue5JMdBV9HgmoJPcc8HtO85t9IA==", + "peer": true, + "dependencies": { + "@jest/types": "^26.6.2", + "ansi-styles": "^4.0.0", + "jest-get-type": "^26.3.0", + "jest-matcher-utils": "^26.6.2", + "jest-message-util": "^26.6.2", + "jest-regex-util": "^26.0.0" + }, "engines": { - "node": ">=6.0.0" + "node": ">= 10.14.2" } }, - "node_modules/@taquito/signer/node_modules/@taquito/michelson-encoder": { - "version": "12.1.1", - "resolved": "https://registry.npmjs.org/@taquito/michelson-encoder/-/michelson-encoder-12.1.1.tgz", - "integrity": "sha512-mWcA1DHHlFj7UswJpEmml853x9e0IYHyeiKZYAo7DtizHz0jiUWtptCuEWiPQ4fMOreFbYZ6KVYenoVfQVNrqA==", + "node_modules/exponential-backoff": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/exponential-backoff/-/exponential-backoff-3.1.1.tgz", + "integrity": "sha512-dX7e/LHVJ6W3DE1MHWi9S1EYzDESENfLrYohG2G++ovZrYOkm4Knwa0mc1cn84xJOR4KEU0WSchhLbd0UklbHw==", + "license": "Apache-2.0" + }, + "node_modules/external-editor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.1.0.tgz", + "integrity": "sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==", + "license": "MIT", "dependencies": { - "@taquito/rpc": "^12.1.1", - "@taquito/utils": "^12.1.1", - "bignumber.js": "^9.0.2", - "fast-json-stable-stringify": "^2.1.0" + "chardet": "^0.7.0", + "iconv-lite": "^0.4.24", + "tmp": "^0.0.33" }, "engines": { - "node": ">=6.0.0" + "node": ">=4" } }, - "node_modules/@taquito/signer/node_modules/@taquito/rpc": { - "version": "12.1.1", - "resolved": "https://registry.npmjs.org/@taquito/rpc/-/rpc-12.1.1.tgz", - "integrity": "sha512-CgAF9kdmKLa/UbmiqApDtncCQGiG7kEOIYis8IIa0JUT9JD1H8WBbSNF/oNh4e0soWUK9BL2qU369RFnxIW+iA==", - "dependencies": { - "@taquito/http-utils": "^12.1.1", - "@taquito/utils": "^12.1.1", - "bignumber.js": "^9.0.2" + "node_modules/extract-files": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/extract-files/-/extract-files-9.0.0.tgz", + "integrity": "sha512-CvdFfHkC95B4bBBk36hcEmvdR2awOdhhVUYH6S/zrVj3477zven/fJMYg7121h4T1xHZC+tetUpubpAhxwI7hQ==", + "license": "MIT", + "engines": { + "node": "^10.17.0 || ^12.0.0 || >= 13.7.0" }, + "funding": { + "url": "https://github.com/sponsors/jaydenseric" + } + }, + "node_modules/eyes": { + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/eyes/-/eyes-0.1.8.tgz", + "integrity": "sha512-GipyPsXO1anza0AOZdy69Im7hGFCNB7Y/NGjDlZGJ3GJJLtwNSb2vrzYrTYJRrRloVx7pl+bhUaTB8yiccPvFQ==", "engines": { - "node": ">=6.0.0" + "node": "> 0.1.90" } }, - "node_modules/@taquito/signer/node_modules/@taquito/taquito": { - "version": "12.1.1", - "resolved": "https://registry.npmjs.org/@taquito/taquito/-/taquito-12.1.1.tgz", - "integrity": "sha512-HvbtClQ7isrDd17X/LEKkPzzeVYA8EMUem3qrkl9qvDO6FpJx/QLbUpYfT2PC0pLUkSrzdLGzmESHAOZhcksaw==", - "hasInstallScript": true, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "license": "MIT" + }, + "node_modules/fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", + "dev": true, + "license": "MIT" + }, + "node_modules/fast-stable-stringify": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fast-stable-stringify/-/fast-stable-stringify-1.0.0.tgz", + "integrity": "sha512-wpYMUmFu5f00Sm0cj2pfivpmawLZ0NKdviQ4w9zJeR8JVtOpOxHmLaJuj0vxvGqMJQWyP/COUkF75/57OKyRag==", + "license": "MIT" + }, + "node_modules/fast-xml-parser": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-4.1.2.tgz", + "integrity": "sha512-CDYeykkle1LiA/uqQyNwYpFbyF6Axec6YapmpUP+/RHWIoR1zKjocdvNaTsxCxZzQ6v9MLXaSYm9Qq0thv0DHg==", + "license": "MIT", "dependencies": { - "@taquito/http-utils": "^12.1.1", - "@taquito/local-forging": "^12.1.1", - "@taquito/michel-codec": "^12.1.1", - "@taquito/michelson-encoder": "^12.1.1", - "@taquito/rpc": "^12.1.1", - "@taquito/utils": "^12.1.1", - "bignumber.js": "^9.0.2", - "rxjs": "^6.6.3" + "strnum": "^1.0.5" }, - "engines": { - "node": ">=6.0.0" + "bin": { + "fxparser": "src/cli/cli.js" + }, + "funding": { + "type": "paypal", + "url": "https://paypal.me/naturalintelligence" } }, - "node_modules/@taquito/signer/node_modules/axios": { - "version": "0.26.1", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.26.1.tgz", - "integrity": "sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA==", + "node_modules/fastq": { + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.15.0.tgz", + "integrity": "sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==", + "dev": true, + "license": "ISC", "dependencies": { - "follow-redirects": "^1.14.8" + "reusify": "^1.0.4" } }, - "node_modules/@taquito/taquito": { - "version": "10.2.1", - "resolved": "https://registry.npmjs.org/@taquito/taquito/-/taquito-10.2.1.tgz", - "integrity": "sha512-ay61aKhFQPnYGu5d9jqEvaZE0EzE6tO9MD+5vOu6/NFVThBd7ysOQS1PB0VprL9SupM1NVDFnEJ8GtE8SYgk8g==", - "hasInstallScript": true, - "peer": true, + "node_modules/figures": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz", + "integrity": "sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==", + "license": "MIT", "dependencies": { - "@taquito/http-utils": "^10.2.1", - "@taquito/michel-codec": "^10.2.1", - "@taquito/michelson-encoder": "^10.2.1", - "@taquito/rpc": "^10.2.1", - "@taquito/utils": "^10.2.1", - "bignumber.js": "^9.0.1", - "rx-sandbox": "^1.0.4", - "rxjs": "^6.6.3" + "escape-string-regexp": "^1.0.5" }, "engines": { - "node": ">=6.0.0" + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/@taquito/taquito/node_modules/@taquito/utils": { - "version": "10.2.1", - "resolved": "https://registry.npmjs.org/@taquito/utils/-/utils-10.2.1.tgz", - "integrity": "sha512-oW/D9irojwjorIV/0yO32Gyr+zSnITkVkOwVmnxge6DYHWC7aqPbdwiDwc4/GewKXNngBDqDEjEEPhkp0ZnvJw==", - "peer": true, - "dependencies": { - "blakejs": "^1.1.0", - "bs58check": "^2.1.2", - "buffer": "^6.0.3" - }, + "node_modules/figures/node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "license": "MIT", "engines": { - "node": ">=6.0.0" + "node": ">=0.8.0" } }, - "node_modules/@taquito/taquito/node_modules/buffer": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", - "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "peer": true, + "node_modules/file-entry-cache": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", + "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", + "dev": true, + "license": "MIT", "dependencies": { - "base64-js": "^1.3.1", - "ieee754": "^1.2.1" + "flat-cache": "^3.0.4" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" } }, - "node_modules/@taquito/taquito/node_modules/ieee754": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", - "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "peer": true + "node_modules/file-uri-to-path": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", + "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==", + "license": "MIT" }, - "node_modules/@taquito/utils": { - "version": "12.1.1", - "resolved": "https://registry.npmjs.org/@taquito/utils/-/utils-12.1.1.tgz", - "integrity": "sha512-GxNSBrA02vwhy56ayWB49VZficB+j2oyhPdlsRb2CguephmyEYnlUaNV27ILa6dPDW+zv6+QWQj6GyqLBRpIlA==", + "node_modules/fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "peer": true, "dependencies": { - "@stablelib/blake2b": "^1.0.1", - "@stablelib/ed25519": "^1.0.2", - "@types/bs58check": "^2.1.0", - "blakejs": "^1.1.1", - "bs58check": "^2.1.2", - "buffer": "^6.0.3", - "elliptic": "^6.5.4", - "typedarray-to-buffer": "^4.0.0" + "to-regex-range": "^5.0.1" }, "engines": { - "node": ">=6.0.0" + "node": ">=8" } }, - "node_modules/@taquito/utils/node_modules/buffer": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", - "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], + "node_modules/find": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/find/-/find-0.3.0.tgz", + "integrity": "sha512-iSd+O4OEYV/I36Zl8MdYJO0xD82wH528SaCieTVHhclgiYNe9y+yPKSwK+A7/WsmHL1EZ+pYUJBXWTL5qofksw==", + "license": "MIT", "dependencies": { - "base64-js": "^1.3.1", - "ieee754": "^1.2.1" + "traverse-chain": "~0.1.0" } }, - "node_modules/@taquito/utils/node_modules/ieee754": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", - "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, - "node_modules/@temple-wallet/dapp": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/@temple-wallet/dapp/-/dapp-5.0.2.tgz", - "integrity": "sha512-IIeHTowHXOp7/JnttfzMyCJjFWwhqOauDN7S2vU0GzHkpT5gH6FBXqB3kvZUyPfoxY0PXuXg+HKh++qABx+g9A==", + "node_modules/find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "license": "MIT", "dependencies": { - "nanoid": "^3.1.25" + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" }, - "peerDependencies": { - "@taquito/taquito": "^10.0.0" + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/@tsconfig/node10": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz", - "integrity": "sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==", - "dev": true - }, - "node_modules/@tsconfig/node12": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", - "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==", - "dev": true - }, - "node_modules/@tsconfig/node14": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", - "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==", - "dev": true - }, - "node_modules/@tsconfig/node16": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.3.tgz", - "integrity": "sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ==", - "dev": true - }, - "node_modules/@types/async-retry": { - "version": "1.4.5", - "resolved": "https://registry.npmjs.org/@types/async-retry/-/async-retry-1.4.5.tgz", - "integrity": "sha512-YrdjSD+yQv7h6d5Ip+PMxh3H6ZxKyQk0Ts+PvaNRInxneG9PFVZjFg77ILAN+N6qYf7g4giSJ1l+ZjQ1zeegvA==", + "node_modules/flat-cache": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz", + "integrity": "sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==", "dev": true, + "license": "MIT", "dependencies": { - "@types/retry": "*" + "flatted": "^3.1.0", + "rimraf": "^3.0.2" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" } }, - "node_modules/@types/bn.js": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/@types/bn.js/-/bn.js-5.1.1.tgz", - "integrity": "sha512-qNrYbZqMx0uJAfKnKclPh+dTwK33KfLHYqtyODwd5HnXOjnkhc4qgn3BrK6RWyGZm5+sIFE7Q7Vz6QQtJB7w7g==", + "node_modules/flatted": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.7.tgz", + "integrity": "sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==", "dev": true, - "dependencies": { - "@types/node": "*" + "license": "ISC" + }, + "node_modules/follow-redirects": { + "version": "1.15.2", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", + "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "license": "MIT", + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } } }, - "node_modules/@types/bs58check": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/@types/bs58check/-/bs58check-2.1.0.tgz", - "integrity": "sha512-OxsysnJQh82vy9DRbOcw9m2j/WiyqZLn0YBhKxdQ+aCwoHj+tWzyCgpwAkr79IfDXZKxc6h7k89T9pwS78CqTQ==", + "node_modules/for-each": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", + "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", + "license": "MIT", "dependencies": { - "@types/node": "*" + "is-callable": "^1.1.3" } }, - "node_modules/@types/connect": { - "version": "3.4.35", - "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.35.tgz", - "integrity": "sha512-cdeYyv4KWoEgpBISTxWvqYsVy444DOqehiF3fM3ne10AmJ62RSyNkUnxMJXHQWRQQX2eR94m5y1IZyDwBjV9FQ==", + "node_modules/form-data": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.1.tgz", + "integrity": "sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==", + "license": "MIT", "dependencies": { - "@types/node": "*" + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" } }, - "node_modules/@types/istanbul-lib-coverage": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz", - "integrity": "sha512-z/QT1XN4K4KYuslS23k62yDIDLwLFkzxOuMplDtObz0+y7VqJCaO2o+SPwHCvLFZh7xazvvoor2tA/hPz9ee7g==", - "peer": true + "node_modules/from": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/from/-/from-0.1.7.tgz", + "integrity": "sha512-twe20eF1OxVxp/ML/kq2p1uc6KvFK/+vs8WjEbeKmV2He22MKm7YF2ANIt+EOqhJ5L3K/SuuPhk0hWQDjOM23g==", + "license": "MIT" }, - "node_modules/@types/istanbul-lib-report": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz", - "integrity": "sha512-plGgXAPfVKFoYfa9NpYDAkseG+g6Jr294RqeqcqDixSbU34MZVJRi/P+7Y8GDpzkEwLaGZZOpKIEmeVZNtKsrg==", + "node_modules/fs-extra": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", + "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", "peer": true, "dependencies": { - "@types/istanbul-lib-coverage": "*" + "at-least-node": "^1.0.0", + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=10" } }, - "node_modules/@types/istanbul-reports": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-3.0.1.tgz", - "integrity": "sha512-c3mAZEuK0lvBp8tmuL74XRKn1+y2dcwOUpH7x4WrF6gk1GIgiluDRgMYQtw2OFcBvAJWlt6ASU3tSqxp0Uu0Aw==", - "peer": true, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "license": "ISC" + }, + "node_modules/function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "license": "MIT" + }, + "node_modules/fzstd": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/fzstd/-/fzstd-0.1.0.tgz", + "integrity": "sha512-TTvznnpde1rTv/3FOmZMbPCh75gqkJ9dKJdsKmcNiXh4olLJl3eRahHJcGzyPZjuVaytffP02Or4z5avDvqKQA==", + "license": "MIT" + }, + "node_modules/get-intrinsic": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.0.tgz", + "integrity": "sha512-L049y6nFOuom5wGyRc3/gdTLO94dySVKRACj1RmJZBQXlbTMhtNIgkWkUHq+jYmZvKf14EW1EoJnnjbmoHij0Q==", + "license": "MIT", "dependencies": { - "@types/istanbul-lib-report": "*" + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/@types/node": { - "version": "18.11.18", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.18.tgz", - "integrity": "sha512-DHQpWGjyQKSHj3ebjFI/wRKcqQcdR+MoFBygntYOZytCqNfkd2ZC4ARDJ2DQqhjH5p85Nnd3jhUJIXrszFX/JA==" + "node_modules/get-stream": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", + "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } }, - "node_modules/@types/retry": { - "version": "0.12.2", - "resolved": "https://registry.npmjs.org/@types/retry/-/retry-0.12.2.tgz", - "integrity": "sha512-XISRgDJ2Tc5q4TRqvgJtzsRkFYNJzZrhTdtMoGVBttwzzQJkPnS3WWTFc7kuDRoPtPakl+T+OfdEUjYJj7Jbow==", - "dev": true + "node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "license": "ISC", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } }, - "node_modules/@types/stack-utils": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.1.tgz", - "integrity": "sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw==", - "peer": true + "node_modules/glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" + } }, - "node_modules/@types/ws": { - "version": "7.4.7", - "resolved": "https://registry.npmjs.org/@types/ws/-/ws-7.4.7.tgz", - "integrity": "sha512-JQbbmxZTZehdc2iszGKs5oC3NFnjeay7mtAWrdt7qNtAVK0g19muApzAy4bm9byz79xa2ZnO/BOBC2R8RC5Lww==", + "node_modules/globals": { + "version": "13.20.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.20.0.tgz", + "integrity": "sha512-Qg5QtVkCy/kv3FUSlu4ukeZDVf9ee0iXLAUYX13gbR17bnejFTzr4iS9bY7kwCf1NztRNm1t91fjOiyx4CSwPQ==", + "dev": true, + "license": "MIT", "dependencies": { - "@types/node": "*" + "type-fest": "^0.20.2" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/@types/yargs": { - "version": "15.0.15", - "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-15.0.15.tgz", - "integrity": "sha512-IziEYMU9XoVj8hWg7k+UJrXALkGFjWJhn5QFEv9q4p+v40oZhSuC135M38st8XPjICL7Ey4TV64ferBGUoJhBg==", - "peer": true, + "node_modules/gopd": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", + "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", + "license": "MIT", "dependencies": { - "@types/yargs-parser": "*" + "get-intrinsic": "^1.1.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/@types/yargs-parser": { - "version": "21.0.0", - "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.0.tgz", - "integrity": "sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA==", + "node_modules/graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", "peer": true }, - "node_modules/acorn": { - "version": "8.8.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.1.tgz", - "integrity": "sha512-7zFpHzhnqYKrkYdUjF1HI1bzd0VygEGX8lFk4k5zVMqHEoES+P+7TKI+EvLO9WVMJ8eekdO0aDEK044xTXwPPA==", + "node_modules/grapheme-splitter": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz", + "integrity": "sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==", "dev": true, - "bin": { - "acorn": "bin/acorn" - }, + "license": "MIT" + }, + "node_modules/graphql": { + "version": "16.6.0", + "resolved": "https://registry.npmjs.org/graphql/-/graphql-16.6.0.tgz", + "integrity": "sha512-KPIBPDlW7NxrbT/eh4qPXz5FiFdL5UbaA0XUNz2Rp3Z3hqBSkbj0GVjwFDztsWVauZUWsbKHgMg++sk8UX0bkw==", "engines": { - "node": ">=0.4.0" + "node": "^12.22.0 || ^14.16.0 || ^16.0.0 || >=17.0.0" } }, - "node_modules/acorn-jsx": { - "version": "5.3.2", - "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", - "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", - "dev": true, + "node_modules/graphql-request": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/graphql-request/-/graphql-request-4.3.0.tgz", + "integrity": "sha512-2v6hQViJvSsifK606AliqiNiijb1uwWp6Re7o0RTyH+uRTv/u7Uqm2g4Fjq/LgZIzARB38RZEvVBFOQOVdlBow==", + "license": "MIT", + "dependencies": { + "cross-fetch": "^3.1.5", + "extract-files": "^9.0.0", + "form-data": "^3.0.0" + }, "peerDependencies": { - "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" + "graphql": "14 - 16" } }, - "node_modules/acorn-walk": { - "version": "8.2.0", - "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", - "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", - "dev": true, + "node_modules/handlebars": { + "version": "4.7.7", + "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.7.tgz", + "integrity": "sha512-aAcXm5OAfE/8IXkcZvCepKU3VzW1/39Fb5ZuqMtgI/hT8X2YgoMvBY5dLhq/cpOvw7Lk1nK/UF71aLG/ZnVYRA==", + "peer": true, + "dependencies": { + "minimist": "^1.2.5", + "neo-async": "^2.6.0", + "source-map": "^0.6.1", + "wordwrap": "^1.0.0" + }, + "bin": { + "handlebars": "bin/handlebars" + }, "engines": { - "node": ">=0.4.0" + "node": ">=0.4.7" + }, + "optionalDependencies": { + "uglify-js": "^3.1.4" } }, - "node_modules/aes-js": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-3.0.0.tgz", - "integrity": "sha512-H7wUZRn8WpTq9jocdxQ2c8x2sKo9ZVmzfRE13GiNJXfp7NcKYEdvl3vspKjXox6RIG2VtaRe4JFvxG4rqp2Zuw==" - }, - "node_modules/agentkeepalive": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.2.1.tgz", - "integrity": "sha512-Zn4cw2NEqd+9fiSVWMscnjyQ1a8Yfoc5oBajLeo5w+YBHgDUcEBY2hS4YpTz6iN5f/2zQiktcuM6tS8x1p9dpA==", + "node_modules/has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "license": "MIT", "dependencies": { - "debug": "^4.1.0", - "depd": "^1.1.2", - "humanize-ms": "^1.2.1" + "function-bind": "^1.1.1" }, "engines": { - "node": ">= 8.0.0" + "node": ">= 0.4.0" } }, - "node_modules/ajv": { - "version": "6.12.6", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", - "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", - "dev": true, - "dependencies": { - "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "license": "MIT", + "engines": { + "node": ">=8" } }, - "node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "node_modules/has-symbols": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", + "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", + "license": "MIT", "engines": { - "node": ">=8" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "node_modules/has-tostringtag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.0.tgz", + "integrity": "sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==", + "license": "MIT", "dependencies": { - "color-convert": "^2.0.1" + "has-symbols": "^1.0.2" }, "engines": { - "node": ">=8" + "node": ">= 0.4" }, "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/arg": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", - "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", - "dev": true + "node_modules/hash-base": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.1.0.tgz", + "integrity": "sha512-1nmYp/rhMDiE7AYkDw+lLwlAzz0AntGIe51F3RfFfEqyQ3feY2eI/NcwC6umIQVOASPMsWJLJScWKSSvzL9IVA==", + "license": "MIT", + "dependencies": { + "inherits": "^2.0.4", + "readable-stream": "^3.6.0", + "safe-buffer": "^5.2.0" + }, + "engines": { + "node": ">=4" + } }, - "node_modules/argparse": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", - "dev": true + "node_modules/hash.js": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", + "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==", + "license": "MIT", + "dependencies": { + "inherits": "^2.0.3", + "minimalistic-assert": "^1.0.1" + } }, - "node_modules/asynckit": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" + "node_modules/hi-base32": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/hi-base32/-/hi-base32-0.5.1.tgz", + "integrity": "sha512-EmBBpvdYh/4XxsnUybsPag6VikPYnN30td+vQk+GI3qpahVEG9+gTkG0aXVxTjBqQ5T6ijbWIu77O+C5WFWsnA==", + "license": "MIT" }, - "node_modules/at-least-node": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz", - "integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==", - "peer": true, - "engines": { - "node": ">= 4.0.0" + "node_modules/hmac-drbg": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", + "integrity": "sha512-Tti3gMqLdZfhOQY1Mzf/AanLiqh1WTiJgEj26ZuYQ9fbkLomzGchCws4FyrSd4VkpBfiNhaE1On+lOz894jvXg==", + "license": "MIT", + "dependencies": { + "hash.js": "^1.0.3", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.1" } }, - "node_modules/available-typed-arrays": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz", - "integrity": "sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==", + "node_modules/hot-shots": { + "version": "9.3.0", + "resolved": "https://registry.npmjs.org/hot-shots/-/hot-shots-9.3.0.tgz", + "integrity": "sha512-e4tgWptiBvlIMnAX0ORe+dNEt0HznD+T2ckzXDUwCBsU7uWr2mwq5UtoT+Df5r9hD5S/DuP8rTxJUQvqAFSFKA==", + "license": "MIT", "engines": { - "node": ">= 0.4" + "node": ">=6.0.0" }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "optionalDependencies": { + "unix-dgram": "2.x" } }, - "node_modules/aws-sdk": { - "version": "2.1283.0", - "resolved": "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.1283.0.tgz", - "integrity": "sha512-YlxTF0T9X8AcNrOzFPVOPnX1jNtHZjYHRUCfpsVwqdajHDGGruVsVppgBYXEiCRuTQNUhcJTUx0J0uKBhKQZIA==", + "node_modules/http-errors": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.8.1.tgz", + "integrity": "sha512-Kpk9Sm7NmI+RHhnj6OIWDI1d6fIoFAtFt9RLaTMRlg/8w49juAStsrBgp0Dp4OdxdVbRIeKhtCUvoi/RuAhO4g==", + "license": "MIT", "dependencies": { - "buffer": "4.9.2", - "events": "1.1.1", - "ieee754": "1.1.13", - "jmespath": "0.16.0", - "querystring": "0.2.0", - "sax": "1.2.1", - "url": "0.10.3", - "util": "^0.12.4", - "uuid": "8.0.0", - "xml2js": "0.4.19" + "depd": "~1.1.2", + "inherits": "2.0.4", + "setprototypeof": "1.2.0", + "statuses": ">= 1.5.0 < 2", + "toidentifier": "1.0.1" }, "engines": { - "node": ">= 10.0.0" + "node": ">= 0.6" } }, - "node_modules/aws-sdk/node_modules/buffer": { - "version": "4.9.2", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-4.9.2.tgz", - "integrity": "sha512-xq+q3SRMOxGivLhBNaUdC64hDTQwejJ+H0T/NB1XMtTVEwNTrfFF3gAxiyW0Bu/xWEGhjVKgUcMhCrUy2+uCWg==", - "dependencies": { - "base64-js": "^1.0.2", - "ieee754": "^1.1.4", - "isarray": "^1.0.0" + "node_modules/http-errors/node_modules/depd": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", + "integrity": "sha512-7emPTl6Dpo6JRXOXjLRxck+FlLRX5847cLKEn00PLAgc3g2hTZZgr+e4c2v6QpSmLeFP3n5yUo7ft6avBK/5jQ==", + "license": "MIT", + "engines": { + "node": ">= 0.6" } }, - "node_modules/axios": { - "version": "0.27.2", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.27.2.tgz", - "integrity": "sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==", + "node_modules/human-signals": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", + "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", + "license": "Apache-2.0", + "engines": { + "node": ">=10.17.0" + } + }, + "node_modules/humanize-ms": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz", + "integrity": "sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ==", + "license": "MIT", "dependencies": { - "follow-redirects": "^1.14.9", - "form-data": "^4.0.0" + "ms": "^2.0.0" } }, - "node_modules/balanced-match": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" + "node_modules/humanize-ms/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" }, - "node_modules/base-x": { - "version": "3.0.9", - "resolved": "https://registry.npmjs.org/base-x/-/base-x-3.0.9.tgz", - "integrity": "sha512-H7JU6iBHTal1gp56aKoaa//YUxEaAOUiydvrV/pILqIHXTtqxSkATOnDA2u+jZ/61sD+L/412+7kzXRtWukhpQ==", + "node_modules/iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "license": "MIT", "dependencies": { - "safe-buffer": "^5.0.1" + "safer-buffer": ">= 2.1.2 < 3" + }, + "engines": { + "node": ">=0.10.0" } }, - "node_modules/base64-js": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", - "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", "funding": [ { "type": "github", @@ -2473,475 +6198,597 @@ "type": "consulting", "url": "https://feross.org/support" } - ] + ], + "license": "BSD-3-Clause" }, - "node_modules/bech32": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/bech32/-/bech32-1.1.4.tgz", - "integrity": "sha512-s0IrSOzLlbvX7yp4WBfPITzpAU8sqQcpsmwXDiKwrG4r491vwCO/XpejasRNl0piBMe/DvP4Tz0mIS/X1DPJBQ==" + "node_modules/ignore": { + "version": "5.2.4", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.4.tgz", + "integrity": "sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } }, - "node_modules/bigint-buffer": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/bigint-buffer/-/bigint-buffer-1.1.5.tgz", - "integrity": "sha512-trfYco6AoZ+rKhKnxA0hgX0HAbVP/s808/EuDSe2JDzUnCp/xAsli35Orvk67UrTEcwuxZqYZDmfA2RXJgxVvA==", - "hasInstallScript": true, + "node_modules/import-fresh": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", + "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", + "dev": true, + "license": "MIT", "dependencies": { - "bindings": "^1.3.0" + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" }, "engines": { - "node": ">= 10.0.0" + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.8.19" + } + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "license": "ISC", + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "license": "ISC" + }, + "node_modules/inquirer": { + "version": "8.2.5", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-8.2.5.tgz", + "integrity": "sha512-QAgPDQMEgrDssk1XiwwHoOGYF9BAbUcc1+j+FhEvaOt8/cKRqyLn0U5qA6F74fGhTMGxf92pOvPBeh29jQJDTQ==", + "license": "MIT", + "dependencies": { + "ansi-escapes": "^4.2.1", + "chalk": "^4.1.1", + "cli-cursor": "^3.1.0", + "cli-width": "^3.0.0", + "external-editor": "^3.0.3", + "figures": "^3.0.0", + "lodash": "^4.17.21", + "mute-stream": "0.0.8", + "ora": "^5.4.1", + "run-async": "^2.4.0", + "rxjs": "^7.5.5", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0", + "through": "^2.3.6", + "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/interpret": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.4.0.tgz", + "integrity": "sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==", + "peer": true, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/is-arguments": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.1.tgz", + "integrity": "sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA==", + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/bignumber.js": { - "version": "9.1.1", - "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.1.1.tgz", - "integrity": "sha512-pHm4LsMJ6lzgNGVfZHjMoO8sdoRhOzOH4MLmY65Jg70bpxCKu5iOHNJyfF6OyvYw7t8Fpf35RuzUyqnQsj8Vig==", + "node_modules/is-callable": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", + "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==", + "license": "MIT", "engines": { - "node": "*" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/bindings": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", - "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", + "node_modules/is-core-module": { + "version": "2.12.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.12.0.tgz", + "integrity": "sha512-RECHCBCd/viahWmwj6enj19sKbHfJrddi/6cBDsNTKbNq0f7VeaUkBo60BqzvPqo/W54ChS62Z5qyun7cfOMqQ==", + "peer": true, "dependencies": { - "file-uri-to-path": "1.0.0" + "has": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/blakejs": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/blakejs/-/blakejs-1.2.1.tgz", - "integrity": "sha512-QXUSXI3QVc/gJME0dBpXrag1kbzOqCjCX8/b54ntNyW6sjtoqxqRk3LTmXzaJoh71zMsDCjM+47jS7XiwN/+fQ==" - }, - "node_modules/bn.js": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", - "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==" - }, - "node_modules/borsh": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/borsh/-/borsh-0.7.0.tgz", - "integrity": "sha512-CLCsZGIBCFnPtkNnieW/a8wmreDmfUtjU2m9yHrzPXIlNbqVs0AQrSatSG6vdNYUqdc83tkQi2eHfF98ubzQLA==", - "dependencies": { - "bn.js": "^5.2.0", - "bs58": "^4.0.0", - "text-encoding-utf-8": "^1.0.2" + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" } }, - "node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "license": "MIT", + "engines": { + "node": ">=8" } }, - "node_modules/braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", - "peer": true, + "node_modules/is-generator-function": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.10.tgz", + "integrity": "sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A==", + "license": "MIT", "dependencies": { - "fill-range": "^7.0.1" + "has-tostringtag": "^1.0.0" }, "engines": { - "node": ">=8" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/brorand": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", - "integrity": "sha512-cKV8tMCEpQs4hK/ik71d6LrPOnpkpGBR0wzxqr68g2m/LB2GxVYQroAjMJZRVM1Y4BCjCKc3vAamxSzOY2RP+w==" - }, - "node_modules/bs58": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/bs58/-/bs58-4.0.1.tgz", - "integrity": "sha512-Ok3Wdf5vOIlBrgCvTq96gBkJw+JUEzdBgyaza5HLtPm7yTHkjRy8+JzNyHF7BHa0bNWOQIp3m5YF0nnFcOIKLw==", + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "license": "MIT", "dependencies": { - "base-x": "^3.0.2" + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" } }, - "node_modules/bs58check": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/bs58check/-/bs58check-2.1.2.tgz", - "integrity": "sha512-0TS1jicxdU09dwJMNZtVAfzPi6Q6QeN0pM1Fkzrjn+XYHvzMKPU3pHVpva+769iNVSfIYWf7LJ6WR+BuuMf8cA==", - "dependencies": { - "bs58": "^4.0.0", - "create-hash": "^1.1.0", - "safe-buffer": "^5.1.2" + "node_modules/is-interactive": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-interactive/-/is-interactive-1.0.0.tgz", + "integrity": "sha512-2HvIEKRoqS62guEC+qBjpvRubdX910WCMuJTZ+I9yvqKU2/12eSL549HMwtabb4oupdj2sMP50k+XJfB/8JE6w==", + "license": "MIT", + "engines": { + "node": ">=8" } }, - "node_modules/buffer": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.1.tgz", - "integrity": "sha512-rVAXBwEcEoYtxnHSO5iWyhzV/O1WMtkUYWlfdLS7FjU4PnSJJHEfHXi/uHPI5EwltmOA794gN3bm3/pzuctWjQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "dependencies": { - "base64-js": "^1.3.1", - "ieee754": "^1.2.1" + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "peer": true, + "engines": { + "node": ">=0.12.0" } }, - "node_modules/buffer-layout": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/buffer-layout/-/buffer-layout-1.2.2.tgz", - "integrity": "sha512-kWSuLN694+KTk8SrYvCqwP2WcgQjoRCiF5b4QDvkkz8EmgD+aWAIceGFKMIAdmF/pH+vpgNV3d3kAKorcdAmWA==", + "node_modules/is-path-inside": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", + "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", + "dev": true, + "license": "MIT", "engines": { - "node": ">=4.5" + "node": ">=8" } }, - "node_modules/buffer/node_modules/ieee754": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", - "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, - "node_modules/bufferutil": { - "version": "4.0.7", - "resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.7.tgz", - "integrity": "sha512-kukuqc39WOHtdxtw4UScxF/WVnMFVSQVKhtx3AjZJzhd0RGZZldcrfSEbVsWWe6KNH253574cq5F+wpv0G9pJw==", - "hasInstallScript": true, - "optional": true, - "dependencies": { - "node-gyp-build": "^4.3.0" - }, + "node_modules/is-stream": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", + "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", + "license": "MIT", "engines": { - "node": ">=6.14.2" + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/call-bind": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", - "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "node_modules/is-typed-array": { + "version": "1.1.10", + "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.10.tgz", + "integrity": "sha512-PJqgEHiWZvMpaFZ3uTc8kHPM4+4ADTlDniuQL7cU/UDA0Ql7F70yGfHph3cLNe+c9toaigv+DFzTJKhc2CtO6A==", + "license": "MIT", "dependencies": { - "function-bind": "^1.1.1", - "get-intrinsic": "^1.0.2" + "available-typed-arrays": "^1.0.5", + "call-bind": "^1.0.2", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/callsites": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", - "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", - "dev": true, + "node_modules/is-unicode-supported": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", + "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", + "license": "MIT", "engines": { - "node": ">=6" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/camelcase": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", - "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", - "engines": { - "node": ">=6" + "node_modules/isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", + "license": "MIT" + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "license": "ISC" + }, + "node_modules/isomorphic-fetch": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/isomorphic-fetch/-/isomorphic-fetch-3.0.0.tgz", + "integrity": "sha512-qvUtwJ3j6qwsF3jLxkZ72qCgjMysPzDfeV240JHiGZsANBYd+EEuu35v7dfrJ9Up0Ak07D7GGSkGhCHTqg/5wA==", + "license": "MIT", + "dependencies": { + "node-fetch": "^2.6.1", + "whatwg-fetch": "^3.4.1" } }, - "node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "node_modules/isomorphic-ws": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/isomorphic-ws/-/isomorphic-ws-4.0.1.tgz", + "integrity": "sha512-BhBvN2MBpWTaSHdWRb/bwdZJ1WaehQ2L1KngkCkfLUGF0mAWAT1sQUQacEmQ0jXkFw/czDXPNQSL5u2/Krsz1w==", + "license": "MIT", + "peerDependencies": { + "ws": "*" + } + }, + "node_modules/jayson": { + "version": "3.7.0", + "resolved": "https://registry.npmjs.org/jayson/-/jayson-3.7.0.tgz", + "integrity": "sha512-tfy39KJMrrXJ+mFcMpxwBvFDetS8LAID93+rycFglIQM4kl3uNR3W4lBLE/FFhsoUCEox5Dt2adVpDm/XtebbQ==", + "license": "MIT", "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" + "@types/connect": "^3.4.33", + "@types/node": "^12.12.54", + "@types/ws": "^7.4.4", + "commander": "^2.20.3", + "delay": "^5.0.0", + "es6-promisify": "^5.0.0", + "eyes": "^0.1.8", + "isomorphic-ws": "^4.0.1", + "json-stringify-safe": "^5.0.1", + "JSONStream": "^1.3.5", + "lodash": "^4.17.20", + "uuid": "^8.3.2", + "ws": "^7.4.5" }, - "engines": { - "node": ">=10" + "bin": { + "jayson": "bin/jayson.js" }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" + "engines": { + "node": ">=8" } }, - "node_modules/cipher-base": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz", - "integrity": "sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==", - "dependencies": { - "inherits": "^2.0.1", - "safe-buffer": "^5.0.1" - } + "node_modules/jayson/node_modules/@types/node": { + "version": "12.20.55", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.55.tgz", + "integrity": "sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==", + "license": "MIT" }, - "node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "node_modules/jest-diff": { + "version": "26.6.2", + "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-26.6.2.tgz", + "integrity": "sha512-6m+9Z3Gv9wN0WFVasqjCL/06+EFCMTqDEUl/b87HYK2rAPTyfz4ZIuSlPhY51PIQRWx5TaxeF1qmXKe9gfN3sA==", + "peer": true, "dependencies": { - "color-name": "~1.1.4" + "chalk": "^4.0.0", + "diff-sequences": "^26.6.2", + "jest-get-type": "^26.3.0", + "pretty-format": "^26.6.2" }, "engines": { - "node": ">=7.0.0" + "node": ">= 10.14.2" } }, - "node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" - }, - "node_modules/colors": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz", - "integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==", + "node_modules/jest-get-type": { + "version": "26.3.0", + "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-26.3.0.tgz", + "integrity": "sha512-TpfaviN1R2pQWkIihlfEanwOXK0zcxrKEE4MlU6Tn7keoXdN6/3gK/xl0yEh8DOunn5pOVGKf8hB4R9gVh04ig==", "peer": true, "engines": { - "node": ">=0.1.90" + "node": ">= 10.14.2" } }, - "node_modules/combined-stream": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", - "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "node_modules/jest-matcher-utils": { + "version": "26.6.2", + "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-26.6.2.tgz", + "integrity": "sha512-llnc8vQgYcNqDrqRDXWwMr9i7rS5XFiCwvh6DTP7Jqa2mqpcCBBlpCbn+trkG0KNhPu/h8rzyBkriOtBstvWhw==", + "peer": true, "dependencies": { - "delayed-stream": "~1.0.0" + "chalk": "^4.0.0", + "jest-diff": "^26.6.2", + "jest-get-type": "^26.3.0", + "pretty-format": "^26.6.2" }, "engines": { - "node": ">= 0.8" + "node": ">= 10.14.2" } }, - "node_modules/commander": { - "version": "2.20.3", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", - "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==" - }, - "node_modules/concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" - }, - "node_modules/cookiejar": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/cookiejar/-/cookiejar-2.1.4.tgz", - "integrity": "sha512-LDx6oHrK+PhzLKJU9j5S7/Y3jM/mUHvD/DeI1WQmJn652iPC5Y4TBzC9l+5OMOXlyTTA+SmVUPm0HQUwpD5Jqw==", - "peer": true - }, - "node_modules/create-hash": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", - "integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==", + "node_modules/jest-message-util": { + "version": "26.6.2", + "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-26.6.2.tgz", + "integrity": "sha512-rGiLePzQ3AzwUshu2+Rn+UMFk0pHN58sOG+IaJbk5Jxuqo3NYO1U2/MIR4S1sKgsoYSXSzdtSa0TgrmtUwEbmA==", + "peer": true, "dependencies": { - "cipher-base": "^1.0.1", - "inherits": "^2.0.1", - "md5.js": "^1.3.4", - "ripemd160": "^2.0.1", - "sha.js": "^2.4.0" + "@babel/code-frame": "^7.0.0", + "@jest/types": "^26.6.2", + "@types/stack-utils": "^2.0.0", + "chalk": "^4.0.0", + "graceful-fs": "^4.2.4", + "micromatch": "^4.0.2", + "pretty-format": "^26.6.2", + "slash": "^3.0.0", + "stack-utils": "^2.0.2" + }, + "engines": { + "node": ">= 10.14.2" } }, - "node_modules/create-hmac": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz", - "integrity": "sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==", - "dependencies": { - "cipher-base": "^1.0.3", - "create-hash": "^1.1.0", - "inherits": "^2.0.1", - "ripemd160": "^2.0.0", - "safe-buffer": "^5.0.1", - "sha.js": "^2.4.8" + "node_modules/jest-regex-util": { + "version": "26.0.0", + "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-26.0.0.tgz", + "integrity": "sha512-Gv3ZIs/nA48/Zvjrl34bf+oD76JHiGDUxNOVgUjh3j890sblXryjY4rss71fPtD/njchl6PSE2hIhvyWa1eT0A==", + "peer": true, + "engines": { + "node": ">= 10.14.2" } }, - "node_modules/create-require": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", - "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", - "dev": true - }, - "node_modules/cross-fetch": { - "version": "3.1.5", - "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.1.5.tgz", - "integrity": "sha512-lvb1SBsI0Z7GDwmuid+mU3kWVBwTVUbe7S0H52yaaAdQOXq2YktTCZdlAcNKFzE6QtRz0snpw9bNiPeOIkkQvw==", - "dependencies": { - "node-fetch": "2.6.7" + "node_modules/jmespath": { + "version": "0.16.0", + "resolved": "https://registry.npmjs.org/jmespath/-/jmespath-0.16.0.tgz", + "integrity": "sha512-9FzQjJ7MATs1tSpnco1K6ayiYE3figslrXA72G2HQ/n76RzvYlofyi5QM+iX4YRs/pu3yzxlVQSST23+dMDknw==", + "license": "Apache-2.0", + "engines": { + "node": ">= 0.6.0" } }, - "node_modules/cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", - "dev": true, + "node_modules/joi": { + "version": "17.9.2", + "resolved": "https://registry.npmjs.org/joi/-/joi-17.9.2.tgz", + "integrity": "sha512-Itk/r+V4Dx0V3c7RLFdRh12IOjySm2/WGPMubBT92cQvRfYZhPM2W0hZlctjj72iES8jsRCwp7S/cRmWBnJ4nw==", + "license": "BSD-3-Clause", "dependencies": { - "path-key": "^3.1.0", - "shebang-command": "^2.0.0", - "which": "^2.0.1" - }, - "engines": { - "node": ">= 8" + "@hapi/hoek": "^9.0.0", + "@hapi/topo": "^5.0.0", + "@sideway/address": "^4.1.3", + "@sideway/formula": "^3.0.1", + "@sideway/pinpoint": "^2.0.0" } }, - "node_modules/crypto-hash": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/crypto-hash/-/crypto-hash-1.3.0.tgz", - "integrity": "sha512-lyAZ0EMyjDkVvz8WOeVnuCPvKVBXcMv1l5SVqO1yC7PzTwrD/pPje/BIRbWhMoPe436U+Y2nD7f5bFx0kt+Sbg==", - "engines": { - "node": ">=8" - }, + "node_modules/js-sdsl": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/js-sdsl/-/js-sdsl-4.4.0.tgz", + "integrity": "sha512-FfVSdx6pJ41Oa+CF7RDaFmTnCaFhua+SNYQX74riGOpl96x+2jQCqEfQ2bnXu/5DPCqlRuiqyvTJM0Qjz26IVg==", + "dev": true, + "license": "MIT", "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "type": "opencollective", + "url": "https://opencollective.com/js-sdsl" } }, - "node_modules/debug": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", - "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", - "dependencies": { - "ms": "2.1.2" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } + "node_modules/js-sha256": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/js-sha256/-/js-sha256-0.9.0.tgz", + "integrity": "sha512-sga3MHh9sgQN2+pJ9VYZ+1LPwXOxuBJBA5nrR5/ofPfuiJBE2hnjsaN8se8JznOmGLN2p49Pe5U/ttafcs/apA==", + "license": "MIT" }, - "node_modules/decimal.js": { - "version": "10.4.3", - "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.4.3.tgz", - "integrity": "sha512-VBBaLc1MgL5XpzgIP7ny5Z6Nx3UrRkIViUkPUdtl9aya5amy3De1gsUUSB1g3+3sExYNjCAsAznmukyxCb1GRA==" + "node_modules/js-sha3": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz", + "integrity": "sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q==", + "license": "MIT" }, - "node_modules/deep-is": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", - "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", - "dev": true + "node_modules/js-sha512": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/js-sha512/-/js-sha512-0.8.0.tgz", + "integrity": "sha512-PWsmefG6Jkodqt+ePTvBZCSMFgN7Clckjd0O7su3I0+BW2QWUTJNzjktHsztGLhncP2h8mcF9V9Y2Ha59pAViQ==", + "license": "MIT" }, - "node_modules/delay": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/delay/-/delay-5.0.0.tgz", - "integrity": "sha512-ReEBKkIfe4ya47wlPYf/gu5ib6yUG0/Aez0JQZQz94kiWtRQvZIQbTiehsnwHvLSWJnQdhVeqYue7Id1dKr0qw==", - "engines": { - "node": ">=10" + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "peer": true + }, + "node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dev": true, + "license": "MIT", + "dependencies": { + "argparse": "^2.0.1" }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "bin": { + "js-yaml": "bin/js-yaml.js" } }, - "node_modules/delayed-stream": { + "node_modules/jsbi": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/jsbi/-/jsbi-4.3.0.tgz", + "integrity": "sha512-SnZNcinB4RIcnEyZqFPdGPVgrg2AcnykiBy0sHVJQKHYeaLUvi3Exj+iaPpLnFVkDPZIV4U0yvgC9/R4uEAZ9g==", + "license": "Apache-2.0" + }, + "node_modules/json-bigint": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", - "engines": { - "node": ">=0.4.0" + "resolved": "https://registry.npmjs.org/json-bigint/-/json-bigint-1.0.0.tgz", + "integrity": "sha512-SiPv/8VpZuWbvLSMtTDU8hEfrZWg/mH/nV/b4o0CYbSxu1UIQPLdwKOCIyLQX+VIPO5vrLX3i8qtqFyhdPSUSQ==", + "license": "MIT", + "dependencies": { + "bignumber.js": "^9.0.0" } }, - "node_modules/depd": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", - "integrity": "sha512-7emPTl6Dpo6JRXOXjLRxck+FlLRX5847cLKEn00PLAgc3g2hTZZgr+e4c2v6QpSmLeFP3n5yUo7ft6avBK/5jQ==", - "engines": { - "node": ">= 0.6" - } + "node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true, + "license": "MIT" }, - "node_modules/diff": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", - "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "node_modules/json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", "dev": true, - "engines": { - "node": ">=0.3.1" - } + "license": "MIT" }, - "node_modules/diff-sequences": { - "version": "26.6.2", - "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-26.6.2.tgz", - "integrity": "sha512-Mv/TDa3nZ9sbc5soK+OoA74BsS3mL37yixCvUAQkiuA4Wz6YtwP/K47n2rv2ovzHZvoiQeA5FTQOschKkEwB0Q==", + "node_modules/json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==", + "license": "ISC" + }, + "node_modules/jsonc-parser": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.2.0.tgz", + "integrity": "sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w==", + "peer": true + }, + "node_modules/jsonfile": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", + "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", "peer": true, - "engines": { - "node": ">= 10.14.2" + "dependencies": { + "universalify": "^2.0.0" + }, + "optionalDependencies": { + "graceful-fs": "^4.1.6" } }, - "node_modules/doctrine": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", - "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", - "dev": true, + "node_modules/jsonparse": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/jsonparse/-/jsonparse-1.3.1.tgz", + "integrity": "sha512-POQXvpdL69+CluYsillJ7SUhKvytYjW9vG/GKpnf+xP8UWgYEM/RaMzHHofbALDiKbbP1W8UEYmgGl39WkPZsg==", + "engines": [ + "node >= 0.2.0" + ], + "license": "MIT" + }, + "node_modules/JSONStream": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.5.tgz", + "integrity": "sha512-E+iruNOY8VV9s4JEbe1aNEm6MiszPRr/UfcHMz0TQh1BXSxHK+ASV1R6W4HpjBhSeS+54PIsAMCBmwD06LLsqQ==", + "license": "(MIT OR Apache-2.0)", "dependencies": { - "esutils": "^2.0.2" + "jsonparse": "^1.2.0", + "through": ">=2.2.7 <3" + }, + "bin": { + "JSONStream": "bin.js" }, "engines": { - "node": ">=6.0.0" + "node": "*" } }, - "node_modules/dot-case": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/dot-case/-/dot-case-3.0.4.tgz", - "integrity": "sha512-Kv5nKlh6yRrdrGvxeJ2e5y2eRUpkUosIW4A2AS38zwSz27zu7ufDwQPi5Jhs3XAlGNetl3bmnGhQsMtkKJnj3w==", + "node_modules/just-performance": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/just-performance/-/just-performance-4.3.0.tgz", + "integrity": "sha512-L7RjvtJsL0QO8xFs5wEoDDzzJwoiowRw6Rn/GnvldlchS2JQr9wFYPiwZcDfrbbujEKqKN0tvENdbjXdYhDp5Q==", + "license": "MIT" + }, + "node_modules/keccak": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/keccak/-/keccak-3.0.3.tgz", + "integrity": "sha512-JZrLIAJWuZxKbCilMpNz5Vj7Vtb4scDG3dMXLOsbzBmQGyjwE61BbW7bJkfKKCShXiQZt3T6sBgALRtmd+nZaQ==", + "hasInstallScript": true, + "license": "MIT", "dependencies": { - "no-case": "^3.0.4", - "tslib": "^2.0.3" + "node-addon-api": "^2.0.0", + "node-gyp-build": "^4.2.0", + "readable-stream": "^3.6.0" + }, + "engines": { + "node": ">=10.0.0" } }, - "node_modules/dotenv": { - "version": "8.6.0", - "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.6.0.tgz", - "integrity": "sha512-IrPdXQsk2BbzvCBGBOTmmSH5SodmqZNt4ERAZDmW4CT+tL8VtvinqywuANaFu4bOMWki16nqf0e4oC0QIaDr/g==", + "node_modules/lazy-ass": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/lazy-ass/-/lazy-ass-1.6.0.tgz", + "integrity": "sha512-cc8oEVoctTvsFZ/Oje/kGnHbpWHYBe8IAJe4C0QNc3t8uM/0Y8+erSz/7Y1ALuXTEZTMvxXwO6YbX1ey3ujiZw==", + "license": "MIT", "engines": { - "node": ">=10" + "node": "> 0.8" } }, - "node_modules/elliptic": { - "version": "6.5.4", - "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz", - "integrity": "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==", + "node_modules/levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "license": "MIT", "dependencies": { - "bn.js": "^4.11.9", - "brorand": "^1.1.0", - "hash.js": "^1.0.0", - "hmac-drbg": "^1.0.1", - "inherits": "^2.0.4", - "minimalistic-assert": "^1.0.1", - "minimalistic-crypto-utils": "^1.0.1" + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + }, + "engines": { + "node": ">= 0.8.0" } }, - "node_modules/elliptic/node_modules/bn.js": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" - }, - "node_modules/es6-promise": { - "version": "4.2.8", - "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", - "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==" - }, - "node_modules/es6-promisify": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/es6-promisify/-/es6-promisify-5.0.0.tgz", - "integrity": "sha512-C+d6UdsYDk0lMebHNR4S2NybQMMngAOnOwYBQjTOiv0MkoJMP0Myw2mgpDLBcpfCmRLxyFqYhS/CfOENq4SJhQ==", + "node_modules/limiter": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/limiter/-/limiter-2.1.0.tgz", + "integrity": "sha512-361TYz6iay6n+9KvUUImqdLuFigK+K79qrUtBsXhJTLdH4rIt/r1y8r1iozwh8KbZNpujbFTSh74mJ7bwbAMOw==", + "license": "MIT", "dependencies": { - "es6-promise": "^4.0.3" + "just-performance": "4.3.0" } }, - "node_modules/escape-string-regexp": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", - "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "node_modules/locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", "dev": true, + "license": "MIT", + "dependencies": { + "p-locate": "^5.0.0" + }, "engines": { "node": ">=10" }, @@ -2949,2425 +6796,2967 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/eslint": { - "version": "8.32.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.32.0.tgz", - "integrity": "sha512-nETVXpnthqKPFyuY2FNjz/bEd6nbosRgKbkgS/y1C7LJop96gYHWpiguLecMHQ2XCPxn77DS0P+68WzG6vkZSQ==", + "node_modules/lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", + "license": "MIT" + }, + "node_modules/lodash.clonedeep": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz", + "integrity": "sha512-H5ZhCF25riFd9uB5UCkVKo61m3S/xZk1x4wA6yp/L3RFP6Z/eHH1ymQcGLo7J3GMPfm0V/7m1tryHuGVxpqEBQ==", + "license": "MIT" + }, + "node_modules/lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", "dev": true, + "license": "MIT" + }, + "node_modules/log-symbols": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", + "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", + "license": "MIT", "dependencies": { - "@eslint/eslintrc": "^1.4.1", - "@humanwhocodes/config-array": "^0.11.8", - "@humanwhocodes/module-importer": "^1.0.1", - "@nodelib/fs.walk": "^1.2.8", - "ajv": "^6.10.0", - "chalk": "^4.0.0", - "cross-spawn": "^7.0.2", - "debug": "^4.3.2", - "doctrine": "^3.0.0", - "escape-string-regexp": "^4.0.0", - "eslint-scope": "^7.1.1", - "eslint-utils": "^3.0.0", - "eslint-visitor-keys": "^3.3.0", - "espree": "^9.4.0", - "esquery": "^1.4.0", - "esutils": "^2.0.2", - "fast-deep-equal": "^3.1.3", - "file-entry-cache": "^6.0.1", - "find-up": "^5.0.0", - "glob-parent": "^6.0.2", - "globals": "^13.19.0", - "grapheme-splitter": "^1.0.4", - "ignore": "^5.2.0", - "import-fresh": "^3.0.0", - "imurmurhash": "^0.1.4", - "is-glob": "^4.0.0", - "is-path-inside": "^3.0.3", - "js-sdsl": "^4.1.4", - "js-yaml": "^4.1.0", - "json-stable-stringify-without-jsonify": "^1.0.1", - "levn": "^0.4.1", - "lodash.merge": "^4.6.2", - "minimatch": "^3.1.2", - "natural-compare": "^1.4.0", - "optionator": "^0.9.1", - "regexpp": "^3.2.0", - "strip-ansi": "^6.0.1", - "strip-json-comments": "^3.1.0", - "text-table": "^0.2.0" - }, - "bin": { - "eslint": "bin/eslint.js" + "chalk": "^4.1.0", + "is-unicode-supported": "^0.1.0" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": ">=10" }, "funding": { - "url": "https://opencollective.com/eslint" + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/eslint-scope": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.1.1.tgz", - "integrity": "sha512-QKQM/UXpIiHcLqJ5AOyIW7XZmzjkzQXYE54n1++wb0u9V/abW3l9uQnxX8Z5Xd18xyKIMTUAyQ0k1e8pz6LUrw==", - "dev": true, + "node_modules/lower-case": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/lower-case/-/lower-case-2.0.2.tgz", + "integrity": "sha512-7fm3l3NAF9WfN6W3JOmf5drwpVqX78JtoGJ3A6W0a6ZnldM41w2fV5D490psKFTpMds8TJse/eHLFFsNHHjHgg==", + "license": "MIT", "dependencies": { - "esrecurse": "^4.3.0", - "estraverse": "^5.2.0" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "tslib": "^2.0.3" } }, - "node_modules/eslint-utils": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-3.0.0.tgz", - "integrity": "sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==", + "node_modules/lunr": { + "version": "2.3.9", + "resolved": "https://registry.npmjs.org/lunr/-/lunr-2.3.9.tgz", + "integrity": "sha512-zTU3DaZaF3Rt9rhN3uBMGQD3dD2/vFQqnvZCDv4dl5iOzq2IZQqTxu90r4E5J+nP70J3ilqVCrbho2eWaeW8Ow==", + "peer": true + }, + "node_modules/make-error": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", "dev": true, - "dependencies": { - "eslint-visitor-keys": "^2.0.0" + "license": "ISC" + }, + "node_modules/map-stream": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/map-stream/-/map-stream-0.1.0.tgz", + "integrity": "sha512-CkYQrPYZfWnu/DAmVCpTSX/xHpKZ80eKh2lAkyA6AJTef6bW+6JpbQZN5rofum7da+SyN1bi5ctTm+lTfcCW3g==" + }, + "node_modules/marked": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/marked/-/marked-2.0.7.tgz", + "integrity": "sha512-BJXxkuIfJchcXOJWTT2DOL+yFWifFv2yGYOUzvXg8Qz610QKw+sHCvTMYwA+qWGhlA2uivBezChZ/pBy1tWdkQ==", + "peer": true, + "bin": { + "marked": "bin/marked" }, "engines": { - "node": "^10.0.0 || ^12.0.0 || >= 14.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/mysticatea" - }, - "peerDependencies": { - "eslint": ">=5" + "node": ">= 8.16.2" } }, - "node_modules/eslint-utils/node_modules/eslint-visitor-keys": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", - "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", - "dev": true, - "engines": { - "node": ">=10" + "node_modules/md5.js": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz", + "integrity": "sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg==", + "license": "MIT", + "dependencies": { + "hash-base": "^3.0.0", + "inherits": "^2.0.1", + "safe-buffer": "^5.1.2" } }, - "node_modules/eslint-visitor-keys": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz", - "integrity": "sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA==", - "dev": true, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - } + "node_modules/merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", + "license": "MIT" }, - "node_modules/espree": { - "version": "9.4.1", - "resolved": "https://registry.npmjs.org/espree/-/espree-9.4.1.tgz", - "integrity": "sha512-XwctdmTO6SIvCzd9810yyNzIrOrqNYV9Koizx4C/mRhf9uq0o4yHoCEU/670pOxOL/MSraektvSAji79kX90Vg==", - "dev": true, + "node_modules/micromatch": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", + "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", + "peer": true, "dependencies": { - "acorn": "^8.8.0", - "acorn-jsx": "^5.3.2", - "eslint-visitor-keys": "^3.3.0" + "braces": "^3.0.2", + "picomatch": "^2.3.1" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": ">=8.6" + } + }, + "node_modules/mime": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-3.0.0.tgz", + "integrity": "sha512-jSCU7/VB1loIWBZe14aEYHU/+1UMEHoaO7qxCOVJOw9GgH72VAWppxNcjU+x9a2k3GSIBXNKxXQFqRvvZ7vr3A==", + "license": "MIT", + "bin": { + "mime": "cli.js" }, - "funding": { - "url": "https://opencollective.com/eslint" + "engines": { + "node": ">=10.0.0" } }, - "node_modules/esquery": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.4.0.tgz", - "integrity": "sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w==", - "dev": true, - "dependencies": { - "estraverse": "^5.1.0" - }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "license": "MIT", "engines": { - "node": ">=0.10" + "node": ">= 0.6" } }, - "node_modules/esrecurse": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", - "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", - "dev": true, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "license": "MIT", "dependencies": { - "estraverse": "^5.2.0" + "mime-db": "1.52.0" }, "engines": { - "node": ">=4.0" + "node": ">= 0.6" } }, - "node_modules/estraverse": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", - "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", - "dev": true, + "node_modules/mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "license": "MIT", "engines": { - "node": ">=4.0" + "node": ">=6" } }, - "node_modules/esutils": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", - "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", - "dev": true, + "node_modules/minimalistic-assert": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", + "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==", + "license": "ISC" + }, + "node_modules/minimalistic-crypto-utils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", + "integrity": "sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg==", + "license": "MIT" + }, + "node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, "engines": { - "node": ">=0.10.0" + "node": "*" } }, - "node_modules/ethereum-cryptography": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-1.1.2.tgz", - "integrity": "sha512-XDSJlg4BD+hq9N2FjvotwUET9Tfxpxc3kWGE2AqUG5vcbeunnbImVk3cj6e/xT3phdW21mE8R5IugU4fspQDcQ==", - "dependencies": { - "@noble/hashes": "1.1.2", - "@noble/secp256k1": "1.6.3", - "@scure/bip32": "1.1.0", - "@scure/bip39": "1.1.0" + "node_modules/minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/ethereum-cryptography/node_modules/@noble/hashes": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.1.2.tgz", - "integrity": "sha512-KYRCASVTv6aeUi1tsF8/vpyR7zpfs3FUzy2Jqm+MU+LmUKhQ0y2FpfwqkCcxSg2ua4GALJd8k2R76WxwZGbQpA==", - "funding": [ - { - "type": "individual", - "url": "https://paulmillr.com/funding/" - } - ] + "node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "license": "MIT" }, - "node_modules/ethereum-cryptography/node_modules/@noble/secp256k1": { - "version": "1.6.3", - "resolved": "https://registry.npmjs.org/@noble/secp256k1/-/secp256k1-1.6.3.tgz", - "integrity": "sha512-T04e4iTurVy7I8Sw4+c5OSN9/RkPlo1uKxAomtxQNLq8j1uPAqnsqG1bqvY3Jv7c13gyr6dui0zmh/I3+f/JaQ==", + "node_modules/multistream": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/multistream/-/multistream-4.1.0.tgz", + "integrity": "sha512-J1XDiAmmNpRCBfIWJv+n0ymC4ABcf/Pl+5YvC5B/D2f/2+8PtHvCNxMPKiQcZyi922Hq69J2YOpb1pTywfifyw==", "funding": [ { - "type": "individual", - "url": "https://paulmillr.com/funding/" - } - ] - }, - "node_modules/ethers": { - "version": "5.7.2", - "resolved": "https://registry.npmjs.org/ethers/-/ethers-5.7.2.tgz", - "integrity": "sha512-wswUsmWo1aOK8rR7DIKiWSw9DbLWe6x98Jrn8wcTflTVvaXhAMaB5zGAXy0GYQEQp9iO1iSHWVyARQm11zUtyg==", - "funding": [ + "type": "github", + "url": "https://github.com/sponsors/feross" + }, { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + "type": "patreon", + "url": "https://www.patreon.com/feross" }, { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" + "type": "consulting", + "url": "https://feross.org/support" } ], + "license": "MIT", "dependencies": { - "@ethersproject/abi": "5.7.0", - "@ethersproject/abstract-provider": "5.7.0", - "@ethersproject/abstract-signer": "5.7.0", - "@ethersproject/address": "5.7.0", - "@ethersproject/base64": "5.7.0", - "@ethersproject/basex": "5.7.0", - "@ethersproject/bignumber": "5.7.0", - "@ethersproject/bytes": "5.7.0", - "@ethersproject/constants": "5.7.0", - "@ethersproject/contracts": "5.7.0", - "@ethersproject/hash": "5.7.0", - "@ethersproject/hdnode": "5.7.0", - "@ethersproject/json-wallets": "5.7.0", - "@ethersproject/keccak256": "5.7.0", - "@ethersproject/logger": "5.7.0", - "@ethersproject/networks": "5.7.1", - "@ethersproject/pbkdf2": "5.7.0", - "@ethersproject/properties": "5.7.0", - "@ethersproject/providers": "5.7.2", - "@ethersproject/random": "5.7.0", - "@ethersproject/rlp": "5.7.0", - "@ethersproject/sha2": "5.7.0", - "@ethersproject/signing-key": "5.7.0", - "@ethersproject/solidity": "5.7.0", - "@ethersproject/strings": "5.7.0", - "@ethersproject/transactions": "5.7.0", - "@ethersproject/units": "5.7.0", - "@ethersproject/wallet": "5.7.0", - "@ethersproject/web": "5.7.1", - "@ethersproject/wordlists": "5.7.0" + "once": "^1.4.0", + "readable-stream": "^3.6.0" } }, - "node_modules/eventemitter3": { - "version": "4.0.7", - "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", - "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==" - }, - "node_modules/events": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/events/-/events-1.1.1.tgz", - "integrity": "sha512-kEcvvCBByWXGnZy6JUlgAp2gBIUjfCAV6P6TgT1/aaQKcmuAEC4OZTV1I4EWQLz2gxZw76atuVyvHhTxvi0Flw==", - "engines": { - "node": ">=0.4.x" + "node_modules/mustache": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/mustache/-/mustache-4.2.0.tgz", + "integrity": "sha512-71ippSywq5Yb7/tVYyGbkBggbU8H3u5Rz56fH60jGFgr8uHwxs+aSKeqmluIVzM0m0kB7xQjKS6qPfd0b2ZoqQ==", + "license": "MIT", + "bin": { + "mustache": "bin/mustache" } }, - "node_modules/expect": { - "version": "26.6.2", - "resolved": "https://registry.npmjs.org/expect/-/expect-26.6.2.tgz", - "integrity": "sha512-9/hlOBkQl2l/PLHJx6JjoDF6xPKcJEsUlWKb23rKE7KzeDqUZKXKNMW27KIue5JMdBV9HgmoJPcc8HtO85t9IA==", - "peer": true, - "dependencies": { - "@jest/types": "^26.6.2", - "ansi-styles": "^4.0.0", - "jest-get-type": "^26.3.0", - "jest-matcher-utils": "^26.6.2", - "jest-message-util": "^26.6.2", - "jest-regex-util": "^26.0.0" - }, - "engines": { - "node": ">= 10.14.2" - } + "node_modules/mute-stream": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", + "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==", + "license": "ISC" }, - "node_modules/extract-files": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/extract-files/-/extract-files-9.0.0.tgz", - "integrity": "sha512-CvdFfHkC95B4bBBk36hcEmvdR2awOdhhVUYH6S/zrVj3477zven/fJMYg7121h4T1xHZC+tetUpubpAhxwI7hQ==", - "engines": { - "node": "^10.17.0 || ^12.0.0 || >= 13.7.0" - }, - "funding": { - "url": "https://github.com/sponsors/jaydenseric" - } + "node_modules/nan": { + "version": "2.17.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.17.0.tgz", + "integrity": "sha512-2ZTgtl0nJsO0KQCjEpxcIr5D+Yv90plTitZt9JBfQvVJDS5seMl3FOvsh3+9CoYWXf/1l5OaZzzF6nDm4cagaQ==", + "license": "MIT", + "optional": true }, - "node_modules/eyes": { - "version": "0.1.8", - "resolved": "https://registry.npmjs.org/eyes/-/eyes-0.1.8.tgz", - "integrity": "sha512-GipyPsXO1anza0AOZdy69Im7hGFCNB7Y/NGjDlZGJ3GJJLtwNSb2vrzYrTYJRrRloVx7pl+bhUaTB8yiccPvFQ==", + "node_modules/nanoid": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.6.tgz", + "integrity": "sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "bin": { + "nanoid": "bin/nanoid.cjs" + }, "engines": { - "node": "> 0.1.90" + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" } }, - "node_modules/fast-deep-equal": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", - "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", - "dev": true - }, - "node_modules/fast-json-stable-stringify": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", - "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" - }, - "node_modules/fast-levenshtein": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", - "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", - "dev": true - }, - "node_modules/fast-stable-stringify": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fast-stable-stringify/-/fast-stable-stringify-1.0.0.tgz", - "integrity": "sha512-wpYMUmFu5f00Sm0cj2pfivpmawLZ0NKdviQ4w9zJeR8JVtOpOxHmLaJuj0vxvGqMJQWyP/COUkF75/57OKyRag==" - }, - "node_modules/fastq": { - "version": "1.15.0", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.15.0.tgz", - "integrity": "sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==", + "node_modules/natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", "dev": true, - "dependencies": { - "reusify": "^1.0.4" - } + "license": "MIT" }, - "node_modules/file-entry-cache": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", - "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", - "dev": true, + "node_modules/near-api-js": { + "version": "0.44.2", + "resolved": "https://registry.npmjs.org/near-api-js/-/near-api-js-0.44.2.tgz", + "integrity": "sha512-eMnc4V+geggapEUa3nU2p8HSHn/njtloI4P2mceHQWO8vDE1NGpnAw8FuTBrLmXSgIv9m6oocgFc9t3VNf5zwg==", + "license": "(MIT AND Apache-2.0)", "dependencies": { - "flat-cache": "^3.0.4" - }, - "engines": { - "node": "^10.12.0 || >=12.0.0" + "bn.js": "5.2.0", + "borsh": "^0.6.0", + "bs58": "^4.0.0", + "depd": "^2.0.0", + "error-polyfill": "^0.1.3", + "http-errors": "^1.7.2", + "js-sha256": "^0.9.0", + "mustache": "^4.0.0", + "node-fetch": "^2.6.1", + "text-encoding-utf-8": "^1.0.2", + "tweetnacl": "^1.0.1" } }, - "node_modules/file-uri-to-path": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", - "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==" + "node_modules/near-api-js/node_modules/bn.js": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.0.tgz", + "integrity": "sha512-D7iWRBvnZE8ecXiLj/9wbxH7Tk79fAh8IHaTNq1RWRixsS02W+5qS+iE9yq6RYl0asXx5tw0bLhmT5pIfbSquw==", + "license": "MIT" }, - "node_modules/fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", - "peer": true, + "node_modules/near-api-js/node_modules/borsh": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/borsh/-/borsh-0.6.0.tgz", + "integrity": "sha512-sl5k89ViqsThXQpYa9XDtz1sBl3l1lI313cFUY1HKr+wvMILnb+58xpkqTNrYbelh99dY7K8usxoCusQmqix9Q==", + "license": "Apache-2.0", "dependencies": { - "to-regex-range": "^5.0.1" - }, - "engines": { - "node": ">=8" + "bn.js": "^5.2.0", + "bs58": "^4.0.0", + "text-encoding-utf-8": "^1.0.2" } }, - "node_modules/find": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/find/-/find-0.3.0.tgz", - "integrity": "sha512-iSd+O4OEYV/I36Zl8MdYJO0xD82wH528SaCieTVHhclgiYNe9y+yPKSwK+A7/WsmHL1EZ+pYUJBXWTL5qofksw==", + "node_modules/near-api-js/node_modules/borsh/node_modules/bn.js": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", + "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==", + "license": "MIT" + }, + "node_modules/near-hd-key": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/near-hd-key/-/near-hd-key-1.2.1.tgz", + "integrity": "sha512-SIrthcL5Wc0sps+2e1xGj3zceEa68TgNZDLuCx0daxmfTP7sFTB3/mtE2pYhlFsCxWoMn+JfID5E1NlzvvbRJg==", + "license": "MIT", "dependencies": { - "traverse-chain": "~0.1.0" + "bip39": "3.0.2", + "create-hmac": "1.1.7", + "tweetnacl": "1.0.3" } }, - "node_modules/find-up": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", - "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", - "dev": true, + "node_modules/near-seed-phrase": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/near-seed-phrase/-/near-seed-phrase-0.2.0.tgz", + "integrity": "sha512-NpmrnejpY1AdlRpDZ0schJQJtfBaoUheRfiYtQpcq9TkwPgqKZCRULV5L3hHmLc0ep7KRtikbPQ9R2ztN/3cyQ==", + "license": "MIT", "dependencies": { - "locate-path": "^6.0.0", - "path-exists": "^4.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "bip39-light": "^1.0.7", + "bs58": "^4.0.1", + "near-hd-key": "^1.2.1", + "tweetnacl": "^1.0.2" } }, - "node_modules/flat-cache": { + "node_modules/neo-async": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", + "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", + "peer": true + }, + "node_modules/no-case": { "version": "3.0.4", - "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz", - "integrity": "sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==", - "dev": true, + "resolved": "https://registry.npmjs.org/no-case/-/no-case-3.0.4.tgz", + "integrity": "sha512-fgAN3jGAh+RoxUGZHTSOLJIqUc2wmoBwGR4tbpNAKmmovFoWq0OdRkb0VkldReO2a2iBT/OEulG9XSUc10r3zg==", + "license": "MIT", "dependencies": { - "flatted": "^3.1.0", - "rimraf": "^3.0.2" - }, - "engines": { - "node": "^10.12.0 || >=12.0.0" + "lower-case": "^2.0.2", + "tslib": "^2.0.3" } }, - "node_modules/flatted": { - "version": "3.2.7", - "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.7.tgz", - "integrity": "sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==", - "dev": true + "node_modules/node-addon-api": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-2.0.2.tgz", + "integrity": "sha512-Ntyt4AIXyaLIuMHF6IOoTakB3K+RWxwtsHNRxllEoA6vPwP9o4866g6YWDLUdnucilZhmkxiHwHr11gAENw+QA==", + "license": "MIT" }, - "node_modules/follow-redirects": { - "version": "1.15.2", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", - "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==", - "funding": [ - { - "type": "individual", - "url": "https://github.com/sponsors/RubenVerborgh" - } - ], + "node_modules/node-fetch": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.9.tgz", + "integrity": "sha512-DJm/CJkZkRjKKj4Zi4BsKVZh3ValV5IR5s7LVZnW+6YMh0W1BfNA8XSs6DLMGYlId5F3KnA70uu2qepcR08Qqg==", + "license": "MIT", + "dependencies": { + "whatwg-url": "^5.0.0" + }, "engines": { - "node": ">=4.0" + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" }, "peerDependenciesMeta": { - "debug": { + "encoding": { "optional": true } } }, - "node_modules/for-each": { - "version": "0.3.3", - "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", - "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", - "dependencies": { - "is-callable": "^1.1.3" + "node_modules/node-gyp-build": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.6.0.tgz", + "integrity": "sha512-NTZVKn9IylLwUzaKjkas1e4u2DLNcV4rdYagA4PWdPwW87Bi7z+BznyKSRwS/761tV/lzCGXplWsiaMjLqP2zQ==", + "license": "MIT", + "bin": { + "node-gyp-build": "bin.js", + "node-gyp-build-optional": "optional.js", + "node-gyp-build-test": "build-test.js" } }, - "node_modules/form-data": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", - "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "node_modules/npm-run-path": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", + "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", + "license": "MIT", "dependencies": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.8", - "mime-types": "^2.1.12" + "path-key": "^3.0.0" }, "engines": { - "node": ">= 6" + "node": ">=8" } }, - "node_modules/fs-extra": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", - "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", - "peer": true, + "node_modules/o3": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/o3/-/o3-1.0.3.tgz", + "integrity": "sha512-f+4n+vC6s4ysy7YO7O2gslWZBUu8Qj2i2OUJOvjRxQva7jVjYjB29jrr9NCjmxZQR0gzrOcv1RnqoYOeMs5VRQ==", + "license": "MIT", "dependencies": { - "at-least-node": "^1.0.0", - "graceful-fs": "^4.2.0", - "jsonfile": "^6.0.1", - "universalify": "^2.0.0" - }, - "engines": { - "node": ">=10" + "capability": "^0.2.5" } }, - "node_modules/fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" - }, - "node_modules/function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" - }, - "node_modules/get-intrinsic": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.3.tgz", - "integrity": "sha512-QJVz1Tj7MS099PevUG5jvnt9tSkXN8K14dxQlikJuPt4uD9hHAHjLyLBiLR5zELelBdD9QNRAXZzsJx0WaDL9A==", + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "license": "ISC", "dependencies": { - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.3" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "wrappy": "1" } }, - "node_modules/glob": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", - "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "node_modules/onetime": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "license": "MIT", "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" + "mimic-fn": "^2.1.0" }, "engines": { - "node": "*" + "node": ">=6" }, "funding": { - "url": "https://github.com/sponsors/isaacs" + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/glob-parent": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", - "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "node_modules/optionator": { + "version": "0.9.1", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", + "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==", "dev": true, + "license": "MIT", "dependencies": { - "is-glob": "^4.0.3" + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.3" }, "engines": { - "node": ">=10.13.0" + "node": ">= 0.8.0" } }, - "node_modules/globals": { - "version": "13.19.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.19.0.tgz", - "integrity": "sha512-dkQ957uSRWHw7CFXLUtUHQI3g3aWApYhfNR2O6jn/907riyTYKVBmxYVROkBcY614FSSeSJh7Xm7SrUWCxvJMQ==", - "dev": true, + "node_modules/ora": { + "version": "5.4.1", + "resolved": "https://registry.npmjs.org/ora/-/ora-5.4.1.tgz", + "integrity": "sha512-5b6Y85tPxZZ7QytO+BQzysW31HJku27cRIlkbAXaNx+BdcVi+LlRFmVXzeF6a7JCwJpyw5c4b+YSVImQIrBpuQ==", + "license": "MIT", "dependencies": { - "type-fest": "^0.20.2" + "bl": "^4.1.0", + "chalk": "^4.1.0", + "cli-cursor": "^3.1.0", + "cli-spinners": "^2.5.0", + "is-interactive": "^1.0.0", + "is-unicode-supported": "^0.1.0", + "log-symbols": "^4.1.0", + "strip-ansi": "^6.0.0", + "wcwidth": "^1.0.1" }, "engines": { - "node": ">=8" + "node": ">=10" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/gopd": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", - "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", - "dependencies": { - "get-intrinsic": "^1.1.3" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/graceful-fs": { - "version": "4.2.10", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", - "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", - "peer": true - }, - "node_modules/grapheme-splitter": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz", - "integrity": "sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==", - "dev": true - }, - "node_modules/graphql": { - "version": "16.6.0", - "resolved": "https://registry.npmjs.org/graphql/-/graphql-16.6.0.tgz", - "integrity": "sha512-KPIBPDlW7NxrbT/eh4qPXz5FiFdL5UbaA0XUNz2Rp3Z3hqBSkbj0GVjwFDztsWVauZUWsbKHgMg++sk8UX0bkw==", - "peer": true, + "node_modules/os-tmpdir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g==", + "license": "MIT", "engines": { - "node": "^12.22.0 || ^14.16.0 || ^16.0.0 || >=17.0.0" - } - }, - "node_modules/graphql-request": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/graphql-request/-/graphql-request-4.3.0.tgz", - "integrity": "sha512-2v6hQViJvSsifK606AliqiNiijb1uwWp6Re7o0RTyH+uRTv/u7Uqm2g4Fjq/LgZIzARB38RZEvVBFOQOVdlBow==", - "dependencies": { - "cross-fetch": "^3.1.5", - "extract-files": "^9.0.0", - "form-data": "^3.0.0" - }, - "peerDependencies": { - "graphql": "14 - 16" + "node": ">=0.10.0" } }, - "node_modules/graphql-request/node_modules/form-data": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.1.tgz", - "integrity": "sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==", + "node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "license": "MIT", "dependencies": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.8", - "mime-types": "^2.1.12" + "yocto-queue": "^0.1.0" }, "engines": { - "node": ">= 6" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/handlebars": { - "version": "4.7.7", - "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.7.tgz", - "integrity": "sha512-aAcXm5OAfE/8IXkcZvCepKU3VzW1/39Fb5ZuqMtgI/hT8X2YgoMvBY5dLhq/cpOvw7Lk1nK/UF71aLG/ZnVYRA==", - "peer": true, + "node_modules/p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "license": "MIT", "dependencies": { - "minimist": "^1.2.5", - "neo-async": "^2.6.0", - "source-map": "^0.6.1", - "wordwrap": "^1.0.0" - }, - "bin": { - "handlebars": "bin/handlebars" + "p-limit": "^3.0.2" }, "engines": { - "node": ">=0.4.7" + "node": ">=10" }, - "optionalDependencies": { - "uglify-js": "^3.1.4" + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/has": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", - "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "node_modules/pako": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/pako/-/pako-2.1.0.tgz", + "integrity": "sha512-w+eufiZ1WuJYgPXbV/PO3NCMEc3xqylkKHzp8bxp1uW4qaSNQUkwmLLEc3kKsfz8lpV1F8Ht3U1Cm+9Srog2ug==", + "license": "(MIT AND Zlib)" + }, + "node_modules/parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "license": "MIT", "dependencies": { - "function-bind": "^1.1.1" + "callsites": "^3.0.0" }, "engines": { - "node": ">= 0.4.0" + "node": ">=6" } }, - "node_modules/has-flag": { + "node_modules/path-exists": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true, + "license": "MIT", "engines": { "node": ">=8" } }, - "node_modules/has-symbols": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", - "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "license": "MIT", "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "node": ">=0.10.0" } }, - "node_modules/has-tostringtag": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.0.tgz", - "integrity": "sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==", - "dependencies": { - "has-symbols": "^1.0.2" - }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "license": "MIT", "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "node": ">=8" } }, - "node_modules/hash-base": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.1.0.tgz", - "integrity": "sha512-1nmYp/rhMDiE7AYkDw+lLwlAzz0AntGIe51F3RfFfEqyQ3feY2eI/NcwC6umIQVOASPMsWJLJScWKSSvzL9IVA==", - "dependencies": { - "inherits": "^2.0.4", - "readable-stream": "^3.6.0", - "safe-buffer": "^5.2.0" - }, - "engines": { - "node": ">=4" - } + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "peer": true }, - "node_modules/hash.js": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", - "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==", + "node_modules/pause-stream": { + "version": "0.0.11", + "resolved": "https://registry.npmjs.org/pause-stream/-/pause-stream-0.0.11.tgz", + "integrity": "sha512-e3FBlXLmN/D1S+zHzanP4E/4Z60oFAa3O051qt1pxa7DEJWKAyil6upYVXCWadEnuoqa4Pkc9oUx9zsxYeRv8A==", + "license": [ + "MIT", + "Apache2" + ], "dependencies": { - "inherits": "^2.0.3", - "minimalistic-assert": "^1.0.1" + "through": "~2.3" } }, - "node_modules/hi-base32": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/hi-base32/-/hi-base32-0.5.1.tgz", - "integrity": "sha512-EmBBpvdYh/4XxsnUybsPag6VikPYnN30td+vQk+GI3qpahVEG9+gTkG0aXVxTjBqQ5T6ijbWIu77O+C5WFWsnA==" - }, - "node_modules/hmac-drbg": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", - "integrity": "sha512-Tti3gMqLdZfhOQY1Mzf/AanLiqh1WTiJgEj26ZuYQ9fbkLomzGchCws4FyrSd4VkpBfiNhaE1On+lOz894jvXg==", + "node_modules/pbkdf2": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.1.2.tgz", + "integrity": "sha512-iuh7L6jA7JEGu2WxDwtQP1ddOpaJNC4KlDEFfdQajSGgGPNi4OyDc2R7QnbY2bR9QjBVGwgvTdNJZoE7RaxUMA==", + "license": "MIT", "dependencies": { - "hash.js": "^1.0.3", - "minimalistic-assert": "^1.0.0", - "minimalistic-crypto-utils": "^1.0.1" + "create-hash": "^1.1.2", + "create-hmac": "^1.1.4", + "ripemd160": "^2.0.1", + "safe-buffer": "^5.0.1", + "sha.js": "^2.4.8" + }, + "engines": { + "node": ">=0.12" } }, - "node_modules/hot-shots": { - "version": "9.3.0", - "resolved": "https://registry.npmjs.org/hot-shots/-/hot-shots-9.3.0.tgz", - "integrity": "sha512-e4tgWptiBvlIMnAX0ORe+dNEt0HznD+T2ckzXDUwCBsU7uWr2mwq5UtoT+Df5r9hD5S/DuP8rTxJUQvqAFSFKA==", + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "peer": true, "engines": { - "node": ">=6.0.0" + "node": ">=8.6" }, - "optionalDependencies": { - "unix-dgram": "2.x" + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" } }, - "node_modules/humanize-ms": { + "node_modules/prelude-ls": { "version": "1.2.1", - "resolved": "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz", - "integrity": "sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ==", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/pretty-format": { + "version": "26.6.2", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-26.6.2.tgz", + "integrity": "sha512-7AeGuCYNGmycyQbCqd/3PWH4eOoX/OiCa0uphp57NVTeAGdJGaAliecxwBDHYQCIvrW7aDBZCYeNTP/WX69mkg==", + "peer": true, "dependencies": { - "ms": "^2.0.0" + "@jest/types": "^26.6.2", + "ansi-regex": "^5.0.0", + "ansi-styles": "^4.0.0", + "react-is": "^17.0.1" + }, + "engines": { + "node": ">= 10" } }, - "node_modules/ieee754": { - "version": "1.1.13", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.13.tgz", - "integrity": "sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg==" + "node_modules/process": { + "version": "0.11.10", + "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", + "integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==", + "license": "MIT", + "engines": { + "node": ">= 0.6.0" + } }, - "node_modules/ignore": { - "version": "5.2.4", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.4.tgz", - "integrity": "sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==", - "dev": true, + "node_modules/progress": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", + "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", + "peer": true, "engines": { - "node": ">= 4" + "node": ">=0.4.0" } }, - "node_modules/import-fresh": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", - "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", - "dev": true, + "node_modules/ps-tree": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/ps-tree/-/ps-tree-1.2.0.tgz", + "integrity": "sha512-0VnamPPYHl4uaU/nSFeZZpR21QAWRz+sRv4iW9+v/GS/J5U5iZB5BNN6J0RMoOvdx2gWM2+ZFMIm58q24e4UYA==", + "license": "MIT", "dependencies": { - "parent-module": "^1.0.0", - "resolve-from": "^4.0.0" + "event-stream": "=3.3.4" }, - "engines": { - "node": ">=6" + "bin": { + "ps-tree": "bin/ps-tree.js" }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "engines": { + "node": ">= 0.10" } }, - "node_modules/imurmurhash": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", - "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", - "dev": true, + "node_modules/punycode": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz", + "integrity": "sha512-RofWgt/7fL5wP1Y7fxE7/EmTLzQVnB0ycyibJ0OOHIlJqTNzglYFxVwETOcIoJqJmpDXJ9xImDv+Fq34F/d4Dw==", + "license": "MIT" + }, + "node_modules/querystring": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz", + "integrity": "sha512-X/xY82scca2tau62i9mDyU9K+I+djTMUsvwf7xnUX5GLvVzgJybOJf4Y6o9Zx3oJK/LSXg5tTZBjwzqVPaPO2g==", "engines": { - "node": ">=0.8.19" + "node": ">=0.4.x" } }, - "node_modules/inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "node_modules/queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/randombytes": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "license": "MIT", "dependencies": { - "once": "^1.3.0", - "wrappy": "1" + "safe-buffer": "^5.1.0" } }, - "node_modules/inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + "node_modules/react-is": { + "version": "17.0.2", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz", + "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==", + "peer": true }, - "node_modules/interpret": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.4.0.tgz", - "integrity": "sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==", - "peer": true, + "node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "license": "MIT", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, "engines": { - "node": ">= 0.10" + "node": ">= 6" } }, - "node_modules/is-arguments": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.1.tgz", - "integrity": "sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA==", + "node_modules/rechoir": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", + "integrity": "sha512-HFM8rkZ+i3zrV+4LQjwQ0W+ez98pApMGM3HUrN04j3CqzPOzl9nmP15Y8YXNm8QHGv/eacOVEjqhmWpkRV0NAw==", + "peer": true, "dependencies": { - "call-bind": "^1.0.2", - "has-tostringtag": "^1.0.0" + "resolve": "^1.1.6" }, "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "node": ">= 0.10" } }, - "node_modules/is-callable": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", - "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==", - "engines": { - "node": ">= 0.4" + "node_modules/regenerator-runtime": { + "version": "0.13.11", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz", + "integrity": "sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==", + "license": "MIT" + }, + "node_modules/resolve": { + "version": "1.22.2", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.2.tgz", + "integrity": "sha512-Sb+mjNHOULsBv818T40qSPeRiuWLyaGMa5ewydRLFimneixmVy2zdivRl+AF6jaYPC8ERxGDmFSiqui6SfPd+g==", + "peer": true, + "dependencies": { + "is-core-module": "^2.11.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/is-core-module": { - "version": "2.11.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.11.0.tgz", - "integrity": "sha512-RRjxlvLDkD1YJwDbroBHMb+cukurkDWNyHx7D3oNB5x9rb5ogcksMC5wHCadcXoo67gVr/+3GFySh3134zi6rw==", - "peer": true, + "node_modules/resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/restore-cursor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz", + "integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==", + "license": "MIT", "dependencies": { - "has": "^1.0.3" + "onetime": "^5.1.0", + "signal-exit": "^3.0.2" }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "engines": { + "node": ">=8" } }, - "node_modules/is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "node_modules/retry": { + "version": "0.13.1", + "resolved": "https://registry.npmjs.org/retry/-/retry-0.13.1.tgz", + "integrity": "sha512-XQBQ3I8W1Cge0Seh+6gjj03LbmRFWuoszgK9ooCpwYIrhhoO80pfq4cUkU5DkknwfOfFteRwlZ56PYOGYyFWdg==", + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, + "node_modules/reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", "dev": true, + "license": "MIT", "engines": { + "iojs": ">=1.0.0", "node": ">=0.10.0" } }, - "node_modules/is-generator-function": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.10.tgz", - "integrity": "sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A==", + "node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "license": "ISC", "dependencies": { - "has-tostringtag": "^1.0.0" + "glob": "^7.1.3" }, - "engines": { - "node": ">= 0.4" + "bin": { + "rimraf": "bin.js" }, "funding": { - "url": "https://github.com/sponsors/ljharb" + "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/is-glob": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", - "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", - "dev": true, + "node_modules/ripemd160": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.2.tgz", + "integrity": "sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==", + "license": "MIT", "dependencies": { - "is-extglob": "^2.1.1" + "hash-base": "^3.0.0", + "inherits": "^2.0.1" + } + }, + "node_modules/rpc-websockets": { + "version": "7.5.1", + "resolved": "https://registry.npmjs.org/rpc-websockets/-/rpc-websockets-7.5.1.tgz", + "integrity": "sha512-kGFkeTsmd37pHPMaHIgN1LVKXMi0JD782v4Ds9ZKtLlwdTKjn+CxM9A9/gLT2LaOuEcEFGL98h1QWQtlOIdW0w==", + "license": "LGPL-3.0-only", + "dependencies": { + "@babel/runtime": "^7.17.2", + "eventemitter3": "^4.0.7", + "uuid": "^8.3.2", + "ws": "^8.5.0" + }, + "funding": { + "type": "paypal", + "url": "https://paypal.me/kozjak" }, + "optionalDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": "^5.0.2" + } + }, + "node_modules/rpc-websockets/node_modules/ws": { + "version": "8.13.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz", + "integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==", + "license": "MIT", "engines": { - "node": ">=0.10.0" + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } } }, - "node_modules/is-number": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", - "peer": true, + "node_modules/run-async": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.4.1.tgz", + "integrity": "sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ==", + "license": "MIT", "engines": { "node": ">=0.12.0" } }, - "node_modules/is-path-inside": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", - "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", + "node_modules/run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", "dev": true, - "engines": { - "node": ">=8" + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "dependencies": { + "queue-microtask": "^1.2.2" } }, - "node_modules/is-typed-array": { - "version": "1.1.10", - "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.10.tgz", - "integrity": "sha512-PJqgEHiWZvMpaFZ3uTc8kHPM4+4ADTlDniuQL7cU/UDA0Ql7F70yGfHph3cLNe+c9toaigv+DFzTJKhc2CtO6A==", + "node_modules/rxjs": { + "version": "7.8.1", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.1.tgz", + "integrity": "sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg==", + "license": "Apache-2.0", "dependencies": { - "available-typed-arrays": "^1.0.5", - "call-bind": "^1.0.2", - "for-each": "^0.3.3", - "gopd": "^1.0.1", - "has-tostringtag": "^1.0.0" + "tslib": "^2.1.0" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "license": "MIT" + }, + "node_modules/sax": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.1.tgz", + "integrity": "sha512-8I2a3LovHTOpm7NV5yOyO8IHqgVsfK4+UuySrXU8YXkSRX7k6hCV9b3HrkKCr3nMpgj+0bmocaJJWpvp1oc7ZA==", + "license": "ISC" + }, + "node_modules/scrypt-js": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/scrypt-js/-/scrypt-js-3.0.1.tgz", + "integrity": "sha512-cdwTTnqPu0Hyvf5in5asVdZocVDTNRmR7XEcJuIzMjJeSHybHl7vpB66AzwTaIg6CLSbtjcxc8fqcySfnTkccA==", + "license": "MIT" + }, + "node_modules/secp256k1": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/secp256k1/-/secp256k1-4.0.3.tgz", + "integrity": "sha512-NLZVf+ROMxwtEj3Xa562qgv2BK5e2WNmXPiOdVIPLgs6lyTzMvBq0aWTYMI5XCP9jZMVKOcqZLw/Wc4vDkuxhA==", + "hasInstallScript": true, + "license": "MIT", + "dependencies": { + "elliptic": "^6.5.4", + "node-addon-api": "^2.0.0", + "node-gyp-build": "^4.2.0" }, "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "node": ">=10.0.0" } }, - "node_modules/isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==" + "node_modules/setprototypeof": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==", + "license": "ISC" }, - "node_modules/isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", - "dev": true + "node_modules/sha.js": { + "version": "2.4.11", + "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", + "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==", + "license": "(MIT AND BSD-3-Clause)", + "dependencies": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + }, + "bin": { + "sha.js": "bin.js" + } }, - "node_modules/isomorphic-fetch": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/isomorphic-fetch/-/isomorphic-fetch-3.0.0.tgz", - "integrity": "sha512-qvUtwJ3j6qwsF3jLxkZ72qCgjMysPzDfeV240JHiGZsANBYd+EEuu35v7dfrJ9Up0Ak07D7GGSkGhCHTqg/5wA==", + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "license": "MIT", "dependencies": { - "node-fetch": "^2.6.1", - "whatwg-fetch": "^3.4.1" + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" } }, - "node_modules/isomorphic-ws": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/isomorphic-ws/-/isomorphic-ws-4.0.1.tgz", - "integrity": "sha512-BhBvN2MBpWTaSHdWRb/bwdZJ1WaehQ2L1KngkCkfLUGF0mAWAT1sQUQacEmQ0jXkFw/czDXPNQSL5u2/Krsz1w==", - "peerDependencies": { - "ws": "*" + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "license": "MIT", + "engines": { + "node": ">=8" } }, - "node_modules/jayson": { - "version": "3.7.0", - "resolved": "https://registry.npmjs.org/jayson/-/jayson-3.7.0.tgz", - "integrity": "sha512-tfy39KJMrrXJ+mFcMpxwBvFDetS8LAID93+rycFglIQM4kl3uNR3W4lBLE/FFhsoUCEox5Dt2adVpDm/XtebbQ==", + "node_modules/shelljs": { + "version": "0.8.5", + "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.5.tgz", + "integrity": "sha512-TiwcRcrkhHvbrZbnRcFYMLl30Dfov3HKqzp5tO5b4pt6G/SezKcYhmDg15zXVBswHmctSAQKznqNW2LO5tTDow==", + "peer": true, "dependencies": { - "@types/connect": "^3.4.33", - "@types/node": "^12.12.54", - "@types/ws": "^7.4.4", - "commander": "^2.20.3", - "delay": "^5.0.0", - "es6-promisify": "^5.0.0", - "eyes": "^0.1.8", - "isomorphic-ws": "^4.0.1", - "json-stringify-safe": "^5.0.1", - "JSONStream": "^1.3.5", - "lodash": "^4.17.20", - "uuid": "^8.3.2", - "ws": "^7.4.5" + "glob": "^7.0.0", + "interpret": "^1.0.0", + "rechoir": "^0.6.2" }, "bin": { - "jayson": "bin/jayson.js" + "shjs": "bin/shjs" }, "engines": { - "node": ">=8" + "node": ">=4" + } + }, + "node_modules/shiki": { + "version": "0.9.15", + "resolved": "https://registry.npmjs.org/shiki/-/shiki-0.9.15.tgz", + "integrity": "sha512-/Y0z9IzhJ8nD9nbceORCqu6NgT9X6I8Fk8c3SICHI5NbZRLdZYFaB233gwct9sU0vvSypyaL/qaKvzyQGJBZSw==", + "peer": true, + "dependencies": { + "jsonc-parser": "^3.0.0", + "vscode-oniguruma": "^1.6.1", + "vscode-textmate": "5.2.0" } }, - "node_modules/jayson/node_modules/@types/node": { - "version": "12.20.55", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.55.tgz", - "integrity": "sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==" + "node_modules/signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "license": "ISC" }, - "node_modules/jayson/node_modules/uuid": { - "version": "8.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", - "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", - "bin": { - "uuid": "dist/bin/uuid" + "node_modules/slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "peer": true, + "engines": { + "node": ">=8" } }, - "node_modules/jest-diff": { - "version": "26.6.2", - "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-26.6.2.tgz", - "integrity": "sha512-6m+9Z3Gv9wN0WFVasqjCL/06+EFCMTqDEUl/b87HYK2rAPTyfz4ZIuSlPhY51PIQRWx5TaxeF1qmXKe9gfN3sA==", - "peer": true, + "node_modules/snake-case": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/snake-case/-/snake-case-3.0.4.tgz", + "integrity": "sha512-LAOh4z89bGQvl9pFfNF8V146i7o7/CqFPbqzYgP+yYzDIDeS9HaNFtXABamRW+AQzEVODcvE79ljJ+8a9YSdMg==", + "license": "MIT", "dependencies": { - "chalk": "^4.0.0", - "diff-sequences": "^26.6.2", - "jest-get-type": "^26.3.0", - "pretty-format": "^26.6.2" - }, - "engines": { - "node": ">= 10.14.2" + "dot-case": "^3.0.4", + "tslib": "^2.0.3" } }, - "node_modules/jest-get-type": { - "version": "26.3.0", - "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-26.3.0.tgz", - "integrity": "sha512-TpfaviN1R2pQWkIihlfEanwOXK0zcxrKEE4MlU6Tn7keoXdN6/3gK/xl0yEh8DOunn5pOVGKf8hB4R9gVh04ig==", + "node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", "peer": true, "engines": { - "node": ">= 10.14.2" + "node": ">=0.10.0" } }, - "node_modules/jest-matcher-utils": { - "version": "26.6.2", - "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-26.6.2.tgz", - "integrity": "sha512-llnc8vQgYcNqDrqRDXWwMr9i7rS5XFiCwvh6DTP7Jqa2mqpcCBBlpCbn+trkG0KNhPu/h8rzyBkriOtBstvWhw==", - "peer": true, + "node_modules/split": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/split/-/split-0.3.3.tgz", + "integrity": "sha512-wD2AeVmxXRBoX44wAycgjVpMhvbwdI2aZjCkvfNcH1YqHQvJVa1duWc73OyVGJUc05fhFaTZeQ/PYsrmyH0JVA==", + "license": "MIT", "dependencies": { - "chalk": "^4.0.0", - "jest-diff": "^26.6.2", - "jest-get-type": "^26.3.0", - "pretty-format": "^26.6.2" + "through": "2" }, "engines": { - "node": ">= 10.14.2" + "node": "*" } }, - "node_modules/jest-message-util": { - "version": "26.6.2", - "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-26.6.2.tgz", - "integrity": "sha512-rGiLePzQ3AzwUshu2+Rn+UMFk0pHN58sOG+IaJbk5Jxuqo3NYO1U2/MIR4S1sKgsoYSXSzdtSa0TgrmtUwEbmA==", + "node_modules/stack-utils": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.6.tgz", + "integrity": "sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ==", "peer": true, "dependencies": { - "@babel/code-frame": "^7.0.0", - "@jest/types": "^26.6.2", - "@types/stack-utils": "^2.0.0", - "chalk": "^4.0.0", - "graceful-fs": "^4.2.4", - "micromatch": "^4.0.2", - "pretty-format": "^26.6.2", - "slash": "^3.0.0", - "stack-utils": "^2.0.2" + "escape-string-regexp": "^2.0.0" }, "engines": { - "node": ">= 10.14.2" + "node": ">=10" } }, - "node_modules/jest-regex-util": { - "version": "26.0.0", - "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-26.0.0.tgz", - "integrity": "sha512-Gv3ZIs/nA48/Zvjrl34bf+oD76JHiGDUxNOVgUjh3j890sblXryjY4rss71fPtD/njchl6PSE2hIhvyWa1eT0A==", + "node_modules/stack-utils/node_modules/escape-string-regexp": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz", + "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==", "peer": true, "engines": { - "node": ">= 10.14.2" - } - }, - "node_modules/jmespath": { - "version": "0.16.0", - "resolved": "https://registry.npmjs.org/jmespath/-/jmespath-0.16.0.tgz", - "integrity": "sha512-9FzQjJ7MATs1tSpnco1K6ayiYE3figslrXA72G2HQ/n76RzvYlofyi5QM+iX4YRs/pu3yzxlVQSST23+dMDknw==", - "engines": { - "node": ">= 0.6.0" + "node": ">=8" } }, - "node_modules/js-sdsl": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/js-sdsl/-/js-sdsl-4.2.0.tgz", - "integrity": "sha512-dyBIzQBDkCqCu+0upx25Y2jGdbTGxE9fshMsCdK0ViOongpV+n5tXRcZY9v7CaVQ79AGS9KA1KHtojxiM7aXSQ==", - "dev": true, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/js-sdsl" + "node_modules/starknet": { + "version": "4.22.0", + "resolved": "https://registry.npmjs.org/starknet/-/starknet-4.22.0.tgz", + "integrity": "sha512-jC9Taxb6a/ht9zmS1LU/DSLfwJKpgCJnE9AktVksc5SE/+jQMpqxsq6fm7PRiqupjiqRC1DOS8N47cj+KaGv4Q==", + "license": "MIT", + "dependencies": { + "@ethersproject/bytes": "^5.6.1", + "bn.js": "^5.2.1", + "elliptic": "^6.5.4", + "ethereum-cryptography": "^1.0.3", + "hash.js": "^1.1.7", + "isomorphic-fetch": "^3.0.0", + "json-bigint": "^1.0.0", + "minimalistic-assert": "^1.0.1", + "pako": "^2.0.4", + "ts-custom-error": "^3.3.1", + "url-join": "^4.0.1" } }, - "node_modules/js-sha256": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/js-sha256/-/js-sha256-0.9.0.tgz", - "integrity": "sha512-sga3MHh9sgQN2+pJ9VYZ+1LPwXOxuBJBA5nrR5/ofPfuiJBE2hnjsaN8se8JznOmGLN2p49Pe5U/ttafcs/apA==" - }, - "node_modules/js-sha3": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz", - "integrity": "sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q==" - }, - "node_modules/js-sha512": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/js-sha512/-/js-sha512-0.8.0.tgz", - "integrity": "sha512-PWsmefG6Jkodqt+ePTvBZCSMFgN7Clckjd0O7su3I0+BW2QWUTJNzjktHsztGLhncP2h8mcF9V9Y2Ha59pAViQ==" - }, - "node_modules/js-tokens": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", - "peer": true - }, - "node_modules/js-yaml": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", - "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", - "dev": true, + "node_modules/start-server-and-test": { + "version": "1.15.5", + "resolved": "https://registry.npmjs.org/start-server-and-test/-/start-server-and-test-1.15.5.tgz", + "integrity": "sha512-o3EmkX0++GV+qsvIJ/OKWm3w91fD8uS/bPQVPrh/7loaxkpXSuAIHdnmN/P/regQK9eNAK76aBJcHt+OSTk+nA==", + "license": "MIT", "dependencies": { - "argparse": "^2.0.1" + "arg": "^5.0.2", + "bluebird": "3.7.2", + "check-more-types": "2.24.0", + "debug": "4.3.4", + "execa": "5.1.1", + "lazy-ass": "1.6.0", + "ps-tree": "1.2.0", + "wait-on": "7.0.1" }, "bin": { - "js-yaml": "bin/js-yaml.js" + "server-test": "src/bin/start.js", + "start-server-and-test": "src/bin/start.js", + "start-test": "src/bin/start.js" + }, + "engines": { + "node": ">=6" } }, - "node_modules/jsbi": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/jsbi/-/jsbi-4.3.0.tgz", - "integrity": "sha512-SnZNcinB4RIcnEyZqFPdGPVgrg2AcnykiBy0sHVJQKHYeaLUvi3Exj+iaPpLnFVkDPZIV4U0yvgC9/R4uEAZ9g==" + "node_modules/start-server-and-test/node_modules/arg": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/arg/-/arg-5.0.2.tgz", + "integrity": "sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg==", + "license": "MIT" }, - "node_modules/json-bigint": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/json-bigint/-/json-bigint-1.0.0.tgz", - "integrity": "sha512-SiPv/8VpZuWbvLSMtTDU8hEfrZWg/mH/nV/b4o0CYbSxu1UIQPLdwKOCIyLQX+VIPO5vrLX3i8qtqFyhdPSUSQ==", - "dependencies": { - "bignumber.js": "^9.0.0" + "node_modules/statuses": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", + "integrity": "sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA==", + "license": "MIT", + "engines": { + "node": ">= 0.6" } }, - "node_modules/json-schema-traverse": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", - "dev": true - }, - "node_modules/json-stable-stringify-without-jsonify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", - "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", - "dev": true - }, - "node_modules/json-stringify-safe": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", - "integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==" + "node_modules/stream-combiner": { + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/stream-combiner/-/stream-combiner-0.0.4.tgz", + "integrity": "sha512-rT00SPnTVyRsaSz5zgSPma/aHSOic5U1prhYdRy5HS2kTZviFpmDgzilbtsJsxiroqACmayynDN/9VzIbX5DOw==", + "license": "MIT", + "dependencies": { + "duplexer": "~0.1.1" + } }, - "node_modules/jsonc-parser": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.2.0.tgz", - "integrity": "sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w==", - "peer": true + "node_modules/stream-transform": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/stream-transform/-/stream-transform-3.2.6.tgz", + "integrity": "sha512-/pyOvaCQFqYTmrFhmMbnAEVo3SsTx1H39eUVPOtYeAgbEUc+rDo7GoP8LbHJgU83mKtzJe/7Nq/ipaAnUOHgJQ==", + "license": "MIT" }, - "node_modules/jsonfile": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", - "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", - "peer": true, + "node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "license": "MIT", "dependencies": { - "universalify": "^2.0.0" - }, - "optionalDependencies": { - "graceful-fs": "^4.1.6" + "safe-buffer": "~5.2.0" } }, - "node_modules/jsonparse": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/jsonparse/-/jsonparse-1.3.1.tgz", - "integrity": "sha512-POQXvpdL69+CluYsillJ7SUhKvytYjW9vG/GKpnf+xP8UWgYEM/RaMzHHofbALDiKbbP1W8UEYmgGl39WkPZsg==", - "engines": [ - "node >= 0.2.0" - ] - }, - "node_modules/JSONStream": { - "version": "1.3.5", - "resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.5.tgz", - "integrity": "sha512-E+iruNOY8VV9s4JEbe1aNEm6MiszPRr/UfcHMz0TQh1BXSxHK+ASV1R6W4HpjBhSeS+54PIsAMCBmwD06LLsqQ==", + "node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "license": "MIT", "dependencies": { - "jsonparse": "^1.2.0", - "through": ">=2.2.7 <3" - }, - "bin": { - "JSONStream": "bin.js" + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" }, "engines": { - "node": "*" + "node": ">=8" } }, - "node_modules/just-performance": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/just-performance/-/just-performance-4.3.0.tgz", - "integrity": "sha512-L7RjvtJsL0QO8xFs5wEoDDzzJwoiowRw6Rn/GnvldlchS2JQr9wFYPiwZcDfrbbujEKqKN0tvENdbjXdYhDp5Q==" - }, - "node_modules/levn": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", - "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", - "dev": true, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "license": "MIT", "dependencies": { - "prelude-ls": "^1.2.1", - "type-check": "~0.4.0" + "ansi-regex": "^5.0.1" }, "engines": { - "node": ">= 0.8.0" + "node": ">=8" } }, - "node_modules/limiter": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/limiter/-/limiter-2.1.0.tgz", - "integrity": "sha512-361TYz6iay6n+9KvUUImqdLuFigK+K79qrUtBsXhJTLdH4rIt/r1y8r1iozwh8KbZNpujbFTSh74mJ7bwbAMOw==", - "dependencies": { - "just-performance": "4.3.0" + "node_modules/strip-final-newline": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", + "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", + "license": "MIT", + "engines": { + "node": ">=6" } }, - "node_modules/locate-path": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", - "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", - "dev": true, - "dependencies": { - "p-locate": "^5.0.0" - }, + "node_modules/strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true, + "license": "MIT", "engines": { - "node": ">=10" + "node": ">=8" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/lodash": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" + "node_modules/strnum": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/strnum/-/strnum-1.0.5.tgz", + "integrity": "sha512-J8bbNyKKXl5qYcR36TIO8W3mVGVHrmmxsd5PAItGkmyzwJvybiw2IVq5nqd0i4LSNSkB/sx9VHllbfFdr9k1JA==", + "license": "MIT" }, - "node_modules/lodash.merge": { - "version": "4.6.2", - "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", - "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", - "dev": true + "node_modules/superstruct": { + "version": "0.15.5", + "resolved": "https://registry.npmjs.org/superstruct/-/superstruct-0.15.5.tgz", + "integrity": "sha512-4AOeU+P5UuE/4nOUkmcQdW5y7i9ndt1cQd/3iUe+LTz3RxESf/W/5lg4B74HbDMMv8PHnPnGCQFH45kBcrQYoQ==", + "license": "MIT" }, - "node_modules/lower-case": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/lower-case/-/lower-case-2.0.2.tgz", - "integrity": "sha512-7fm3l3NAF9WfN6W3JOmf5drwpVqX78JtoGJ3A6W0a6ZnldM41w2fV5D490psKFTpMds8TJse/eHLFFsNHHjHgg==", + "node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "license": "MIT", "dependencies": { - "tslib": "^2.0.3" + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" } }, - "node_modules/lunr": { - "version": "2.3.9", - "resolved": "https://registry.npmjs.org/lunr/-/lunr-2.3.9.tgz", - "integrity": "sha512-zTU3DaZaF3Rt9rhN3uBMGQD3dD2/vFQqnvZCDv4dl5iOzq2IZQqTxu90r4E5J+nP70J3ilqVCrbho2eWaeW8Ow==", - "peer": true + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "peer": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } }, - "node_modules/make-error": { - "version": "1.3.6", - "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", - "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", - "dev": true + "node_modules/text-encoding-utf-8": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/text-encoding-utf-8/-/text-encoding-utf-8-1.0.2.tgz", + "integrity": "sha512-8bw4MY9WjdsD2aMtO0OzOCY3pXGYNx2d2FfHRVUKkiCPDWjKuOlhLVASS+pD7VkLTVjW268LYJHwsnPFlBpbAg==" }, - "node_modules/marked": { - "version": "2.0.7", - "resolved": "https://registry.npmjs.org/marked/-/marked-2.0.7.tgz", - "integrity": "sha512-BJXxkuIfJchcXOJWTT2DOL+yFWifFv2yGYOUzvXg8Qz610QKw+sHCvTMYwA+qWGhlA2uivBezChZ/pBy1tWdkQ==", - "peer": true, - "bin": { - "marked": "bin/marked" + "node_modules/text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", + "dev": true, + "license": "MIT" + }, + "node_modules/through": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==", + "license": "MIT" + }, + "node_modules/tmp": { + "version": "0.0.33", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", + "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", + "license": "MIT", + "dependencies": { + "os-tmpdir": "~1.0.2" }, "engines": { - "node": ">= 8.16.2" + "node": ">=0.6.0" } }, - "node_modules/md5.js": { - "version": "1.3.5", - "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz", - "integrity": "sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg==", + "node_modules/tmp-promise": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/tmp-promise/-/tmp-promise-3.0.3.tgz", + "integrity": "sha512-RwM7MoPojPxsOBYnyd2hy0bxtIlVrihNs9pj5SUvY8Zz1sQcQG2tG1hSr8PDxfgEB8RNKDhqbIlroIarSNDNsQ==", + "license": "MIT", "dependencies": { - "hash-base": "^3.0.0", - "inherits": "^2.0.1", - "safe-buffer": "^5.1.2" + "tmp": "^0.2.0" } }, - "node_modules/micromatch": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", - "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", + "node_modules/tmp-promise/node_modules/tmp": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.1.tgz", + "integrity": "sha512-76SUhtfqR2Ijn+xllcI5P1oyannHNHByD80W1q447gU3mp9G9PSpGdWmjUOHRDPiHYacIk66W7ubDTuPF3BEtQ==", + "license": "MIT", + "dependencies": { + "rimraf": "^3.0.0" + }, + "engines": { + "node": ">=8.17.0" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", "peer": true, "dependencies": { - "braces": "^3.0.2", - "picomatch": "^2.3.1" + "is-number": "^7.0.0" }, "engines": { - "node": ">=8.6" + "node": ">=8.0" } }, - "node_modules/mime-db": { - "version": "1.52.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", - "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "node_modules/toidentifier": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", + "license": "MIT", "engines": { - "node": ">= 0.6" + "node": ">=0.6" } }, - "node_modules/mime-types": { - "version": "2.1.35", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", - "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "node_modules/toml": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/toml/-/toml-3.0.0.tgz", + "integrity": "sha512-y/mWCZinnvxjTKYhJ+pYxwD0mRLVvOtdS2Awbgxln6iEnt4rk0yBxeSBHkGJcPucRiG0e55mwWp+g/05rsrd6w==", + "license": "MIT" + }, + "node_modules/tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", + "license": "MIT" + }, + "node_modules/traverse-chain": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/traverse-chain/-/traverse-chain-0.1.0.tgz", + "integrity": "sha512-up6Yvai4PYKhpNp5PkYtx50m3KbwQrqDwbuZP/ItyL64YEWHAvH6Md83LFLV/GRSk/BoUVwwgUzX6SOQSbsfAg==", + "license": "MIT" + }, + "node_modules/tron-format-address": { + "version": "0.1.11", + "resolved": "https://registry.npmjs.org/tron-format-address/-/tron-format-address-0.1.11.tgz", + "integrity": "sha512-Jx2i3R1yXrEMQsfc2jueAI71ivnySzdeva6SiSM/pddwj8TK7PVABSP6s/iYcTRI63GxJEgGMmOJXNNKoBmbQw==", + "license": "MIT" + }, + "node_modules/ts-custom-error": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/ts-custom-error/-/ts-custom-error-3.3.1.tgz", + "integrity": "sha512-5OX1tzOjxWEgsr/YEUWSuPrQ00deKLh6D7OTWcvNHm12/7QPyRh8SYpyWvA4IZv8H/+GQWQEh/kwo95Q9OVW1A==", + "license": "MIT", + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/ts-node": { + "version": "10.9.1", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz", + "integrity": "sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==", + "dev": true, + "license": "MIT", "dependencies": { - "mime-db": "1.52.0" + "@cspotcode/source-map-support": "^0.8.0", + "@tsconfig/node10": "^1.0.7", + "@tsconfig/node12": "^1.0.7", + "@tsconfig/node14": "^1.0.0", + "@tsconfig/node16": "^1.0.2", + "acorn": "^8.4.1", + "acorn-walk": "^8.1.1", + "arg": "^4.1.0", + "create-require": "^1.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "v8-compile-cache-lib": "^3.0.1", + "yn": "3.1.1" }, - "engines": { - "node": ">= 0.6" + "bin": { + "ts-node": "dist/bin.js", + "ts-node-cwd": "dist/bin-cwd.js", + "ts-node-esm": "dist/bin-esm.js", + "ts-node-script": "dist/bin-script.js", + "ts-node-transpile-only": "dist/bin-transpile.js", + "ts-script": "dist/bin-script-deprecated.js" + }, + "peerDependencies": { + "@swc/core": ">=1.2.50", + "@swc/wasm": ">=1.2.50", + "@types/node": "*", + "typescript": ">=2.7" + }, + "peerDependenciesMeta": { + "@swc/core": { + "optional": true + }, + "@swc/wasm": { + "optional": true + } } }, - "node_modules/minimalistic-assert": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", - "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==" + "node_modules/tslib": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.5.0.tgz", + "integrity": "sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg==", + "license": "0BSD" }, - "node_modules/minimalistic-crypto-utils": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", - "integrity": "sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg==" + "node_modules/tweetnacl": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-1.0.3.tgz", + "integrity": "sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw==", + "license": "Unlicense" }, - "node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "node_modules/type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "license": "MIT", "dependencies": { - "brace-expansion": "^1.1.7" + "prelude-ls": "^1.2.1" }, "engines": { - "node": "*" + "node": ">= 0.8.0" } }, - "node_modules/minimist": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.7.tgz", - "integrity": "sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g==", - "peer": true, + "node_modules/type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "dev": true, + "license": "(MIT OR CC0-1.0)", + "engines": { + "node": ">=10" + }, "funding": { - "url": "https://github.com/sponsors/ljharb" + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" - }, - "node_modules/nan": { - "version": "2.17.0", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.17.0.tgz", - "integrity": "sha512-2ZTgtl0nJsO0KQCjEpxcIr5D+Yv90plTitZt9JBfQvVJDS5seMl3FOvsh3+9CoYWXf/1l5OaZzzF6nDm4cagaQ==", - "optional": true + "node_modules/typedarray-to-buffer": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-4.0.0.tgz", + "integrity": "sha512-6dOYeZfS3O9RtRD1caom0sMxgK59b27+IwoNy8RDPsmslSGOyU+mpTamlaIW7aNKi90ZQZ9DFaZL3YRoiSCULQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" }, - "node_modules/nanoid": { - "version": "3.3.4", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.4.tgz", - "integrity": "sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw==", + "node_modules/typedoc": { + "version": "0.20.37", + "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.20.37.tgz", + "integrity": "sha512-9+qDhdc4X00qTNOtii6QX2z7ndAeWVOso7w3MPSoSJdXlVhpwPfm1yEp4ooKuWA9fiQILR8FKkyjmeqa13hBbw==", + "peer": true, + "dependencies": { + "colors": "^1.4.0", + "fs-extra": "^9.1.0", + "handlebars": "^4.7.7", + "lodash": "^4.17.21", + "lunr": "^2.3.9", + "marked": "~2.0.3", + "minimatch": "^3.0.0", + "progress": "^2.0.3", + "shelljs": "^0.8.4", + "shiki": "^0.9.3", + "typedoc-default-themes": "^0.12.10" + }, "bin": { - "nanoid": "bin/nanoid.cjs" + "typedoc": "bin/typedoc" }, "engines": { - "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + "node": ">= 10.8.0" + }, + "peerDependencies": { + "typescript": "3.9.x || 4.0.x || 4.1.x || 4.2.x" } }, - "node_modules/natural-compare": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", - "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", - "dev": true - }, - "node_modules/neo-async": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", - "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", - "peer": true + "node_modules/typedoc-default-themes": { + "version": "0.12.10", + "resolved": "https://registry.npmjs.org/typedoc-default-themes/-/typedoc-default-themes-0.12.10.tgz", + "integrity": "sha512-fIS001cAYHkyQPidWXmHuhs8usjP5XVJjWB8oZGqkTowZaz3v7g3KDZeeqE82FBrmkAnIBOY3jgy7lnPnqATbA==", + "peer": true, + "engines": { + "node": ">= 8" + } }, - "node_modules/no-case": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/no-case/-/no-case-3.0.4.tgz", - "integrity": "sha512-fgAN3jGAh+RoxUGZHTSOLJIqUc2wmoBwGR4tbpNAKmmovFoWq0OdRkb0VkldReO2a2iBT/OEulG9XSUc10r3zg==", - "dependencies": { - "lower-case": "^2.0.2", - "tslib": "^2.0.3" + "node_modules/typedoc-plugin-cname": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/typedoc-plugin-cname/-/typedoc-plugin-cname-1.0.1.tgz", + "integrity": "sha512-f97SS5RzDCVBa7Frg1VketIMAkEl3OTvBs9wM8lLEkJVWCIG2yXnszglA82on39gFwQ1tyq8tiuxRgb4569GpA==", + "license": "MIT", + "peerDependencies": { + "typedoc": "^0.20.27" } }, - "node_modules/node-fetch": { - "version": "2.6.7", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", - "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", - "dependencies": { - "whatwg-url": "^5.0.0" + "node_modules/typescript": { + "version": "4.9.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", + "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" }, "engines": { - "node": "4.x || >=6.0.0" - }, - "peerDependencies": { - "encoding": "^0.1.0" - }, - "peerDependenciesMeta": { - "encoding": { - "optional": true - } + "node": ">=4.2.0" } }, - "node_modules/node-gyp-build": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.5.0.tgz", - "integrity": "sha512-2iGbaQBV+ITgCz76ZEjmhUKAKVf7xfY1sRl4UiKQspfZMH2h06SyhNsnSVy50cwkFQDGLyif6m/6uFXHkOZ6rg==", + "node_modules/u3": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/u3/-/u3-0.1.1.tgz", + "integrity": "sha512-+J5D5ir763y+Am/QY6hXNRlwljIeRMZMGs0cT6qqZVVzzT3X3nFPXVyPOFRMOR4kupB0T8JnCdpWdp6Q/iXn3w==", + "license": "MIT" + }, + "node_modules/uglify-js": { + "version": "3.17.4", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.17.4.tgz", + "integrity": "sha512-T9q82TJI9e/C1TAxYvfb16xO120tMVFZrGA3f9/P4424DNu6ypK103y0GPFVa17yotwSyZW5iYXgjYHkGrJW/g==", "optional": true, + "peer": true, "bin": { - "node-gyp-build": "bin.js", - "node-gyp-build-optional": "optional.js", - "node-gyp-build-test": "build-test.js" + "uglifyjs": "bin/uglifyjs" + }, + "engines": { + "node": ">=0.8.0" } }, - "node_modules/once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", - "dependencies": { - "wrappy": "1" + "node_modules/universalify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", + "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==", + "peer": true, + "engines": { + "node": ">= 10.0.0" } }, - "node_modules/optionator": { - "version": "0.9.1", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", - "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==", - "dev": true, + "node_modules/unix-dgram": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/unix-dgram/-/unix-dgram-2.0.6.tgz", + "integrity": "sha512-AURroAsb73BZ6CdAyMrTk/hYKNj3DuYYEuOaB8bYMOHGKupRNScw90Q5C71tWJc3uE7dIeXRyuwN0xLLq3vDTg==", + "license": "ISC", + "optional": true, "dependencies": { - "deep-is": "^0.1.3", - "fast-levenshtein": "^2.0.6", - "levn": "^0.4.1", - "prelude-ls": "^1.2.1", - "type-check": "^0.4.0", - "word-wrap": "^1.2.3" + "bindings": "^1.5.0", + "nan": "^2.16.0" }, "engines": { - "node": ">= 0.8.0" + "node": ">=0.10.48" } }, - "node_modules/p-limit": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", - "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", "dev": true, + "license": "BSD-2-Clause", "dependencies": { - "yocto-queue": "^0.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "punycode": "^2.1.0" } }, - "node_modules/p-locate": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", - "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "node_modules/uri-js/node_modules/punycode": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", + "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==", "dev": true, - "dependencies": { - "p-limit": "^3.0.2" - }, + "license": "MIT", "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": ">=6" } }, - "node_modules/pako": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/pako/-/pako-2.1.0.tgz", - "integrity": "sha512-w+eufiZ1WuJYgPXbV/PO3NCMEc3xqylkKHzp8bxp1uW4qaSNQUkwmLLEc3kKsfz8lpV1F8Ht3U1Cm+9Srog2ug==" + "node_modules/url": { + "version": "0.10.3", + "resolved": "https://registry.npmjs.org/url/-/url-0.10.3.tgz", + "integrity": "sha512-hzSUW2q06EqL1gKM/a+obYHLIO6ct2hwPuviqTTOcfFVc61UbfJ2Q32+uGL/HCPxKqrdGB5QUwIe7UqlDgwsOQ==", + "license": "MIT", + "dependencies": { + "punycode": "1.3.2", + "querystring": "0.2.0" + } }, - "node_modules/parent-module": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", - "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", - "dev": true, + "node_modules/url-join": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/url-join/-/url-join-4.0.1.tgz", + "integrity": "sha512-jk1+QP6ZJqyOiuEI9AEWQfju/nB2Pw466kbA0LEZljHwKeMgd9WrAEgEGxjPDD2+TNbbb37rTyhEfrCXfuKXnA==", + "license": "MIT" + }, + "node_modules/utf-8-validate": { + "version": "5.0.10", + "resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.10.tgz", + "integrity": "sha512-Z6czzLq4u8fPOyx7TU6X3dvUZVvoJmxSQ+IcrlmagKhilxlhZgxPK6C5Jqbkw1IDUmFTM+cz9QDnnLTwDz/2gQ==", + "hasInstallScript": true, + "license": "MIT", + "optional": true, "dependencies": { - "callsites": "^3.0.0" + "node-gyp-build": "^4.3.0" }, "engines": { - "node": ">=6" + "node": ">=6.14.2" } }, - "node_modules/path-exists": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", - "dev": true, - "engines": { - "node": ">=8" + "node_modules/util": { + "version": "0.12.5", + "resolved": "https://registry.npmjs.org/util/-/util-0.12.5.tgz", + "integrity": "sha512-kZf/K6hEIrWHI6XqOFUiiMa+79wE/D8Q+NCNAWclkyg3b4d2k7s0QGepNjiABc+aR3N1PAyHL7p6UcLY6LmrnA==", + "license": "MIT", + "dependencies": { + "inherits": "^2.0.3", + "is-arguments": "^1.0.4", + "is-generator-function": "^1.0.7", + "is-typed-array": "^1.1.3", + "which-typed-array": "^1.1.2" } }, - "node_modules/path-is-absolute": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", - "engines": { - "node": ">=0.10.0" + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", + "license": "MIT" + }, + "node_modules/uuid": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "license": "MIT", + "bin": { + "uuid": "dist/bin/uuid" } }, - "node_modules/path-key": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", - "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "node_modules/v8-compile-cache-lib": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", + "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", "dev": true, + "license": "MIT" + }, + "node_modules/vlq": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/vlq/-/vlq-2.0.4.tgz", + "integrity": "sha512-aodjPa2wPQFkra1G8CzJBTHXhgk3EVSwxSWXNPr1fgdFLUb8kvLV1iEb6rFgasIsjP82HWI6dsb5Io26DDnasA==", + "license": "MIT" + }, + "node_modules/vscode-oniguruma": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/vscode-oniguruma/-/vscode-oniguruma-1.7.0.tgz", + "integrity": "sha512-L9WMGRfrjOhgHSdOYgCt/yRMsXzLDJSL7BPrOZt73gU0iWO4mpqzqQzOz5srxqTvMBaR0XZTSrVWo4j55Rc6cA==", + "peer": true + }, + "node_modules/vscode-textmate": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/vscode-textmate/-/vscode-textmate-5.2.0.tgz", + "integrity": "sha512-Uw5ooOQxRASHgu6C7GVvUxisKXfSgW4oFlO+aa+PAkgmH89O3CXxEEzNRNtHSqtXFTl0nAC1uYj0GMSH27uwtQ==", + "peer": true + }, + "node_modules/wait-on": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/wait-on/-/wait-on-7.0.1.tgz", + "integrity": "sha512-9AnJE9qTjRQOlTZIldAaf/da2eW0eSRSgcqq85mXQja/DW3MriHxkpODDSUEg+Gri/rKEcXUZHe+cevvYItaog==", + "license": "MIT", + "dependencies": { + "axios": "^0.27.2", + "joi": "^17.7.0", + "lodash": "^4.17.21", + "minimist": "^1.2.7", + "rxjs": "^7.8.0" + }, + "bin": { + "wait-on": "bin/wait-on" + }, "engines": { - "node": ">=8" + "node": ">=12.0.0" } }, - "node_modules/path-parse": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", - "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", - "peer": true + "node_modules/wcwidth": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz", + "integrity": "sha512-XHPEwS0q6TaxcvG85+8EYkbiCux2XtWG2mkc47Ng2A77BQu9+DqIOJldST4HgPkuea7dvKSj5VgX3P1d4rW8Tg==", + "license": "MIT", + "dependencies": { + "defaults": "^1.0.3" + } + }, + "node_modules/webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", + "license": "BSD-2-Clause" + }, + "node_modules/whatwg-fetch": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-3.6.2.tgz", + "integrity": "sha512-bJlen0FcuU/0EMLrdbJ7zOnW6ITZLrZMIarMUVmdKtsGvZna8vxKYaexICWPfZ8qwf9fzNq+UEIZrnSaApt6RA==", + "license": "MIT" + }, + "node_modules/whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "license": "MIT", + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } }, - "node_modules/pbkdf2": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.1.2.tgz", - "integrity": "sha512-iuh7L6jA7JEGu2WxDwtQP1ddOpaJNC4KlDEFfdQajSGgGPNi4OyDc2R7QnbY2bR9QjBVGwgvTdNJZoE7RaxUMA==", + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "license": "ISC", "dependencies": { - "create-hash": "^1.1.2", - "create-hmac": "^1.1.4", - "ripemd160": "^2.0.1", - "safe-buffer": "^5.0.1", - "sha.js": "^2.4.8" + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" }, "engines": { - "node": ">=0.12" + "node": ">= 8" } }, - "node_modules/picomatch": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", - "peer": true, + "node_modules/which-typed-array": { + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.9.tgz", + "integrity": "sha512-w9c4xkx6mPidwp7180ckYWfMmvxpjlZuIudNtDf4N/tTAUB8VJbX25qZoAsrtGuYNnGw3pa0AXgbGKRB8/EceA==", + "license": "MIT", + "dependencies": { + "available-typed-arrays": "^1.0.5", + "call-bind": "^1.0.2", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "has-tostringtag": "^1.0.0", + "is-typed-array": "^1.1.10" + }, "engines": { - "node": ">=8.6" + "node": ">= 0.4" }, "funding": { - "url": "https://github.com/sponsors/jonschlinkert" + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/prelude-ls": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", - "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "node_modules/word-wrap": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", + "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", "dev": true, + "license": "MIT", "engines": { - "node": ">= 0.8.0" + "node": ">=0.10.0" } }, - "node_modules/pretty-format": { - "version": "26.6.2", - "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-26.6.2.tgz", - "integrity": "sha512-7AeGuCYNGmycyQbCqd/3PWH4eOoX/OiCa0uphp57NVTeAGdJGaAliecxwBDHYQCIvrW7aDBZCYeNTP/WX69mkg==", - "peer": true, + "node_modules/wordwrap": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", + "integrity": "sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q==", + "peer": true + }, + "node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "license": "MIT", "dependencies": { - "@jest/types": "^26.6.2", - "ansi-regex": "^5.0.0", "ansi-styles": "^4.0.0", - "react-is": "^17.0.1" + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" }, "engines": { - "node": ">= 10" - } - }, - "node_modules/progress": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", - "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", - "peer": true, - "engines": { - "node": ">=0.4.0" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" } }, - "node_modules/punycode": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz", - "integrity": "sha512-RofWgt/7fL5wP1Y7fxE7/EmTLzQVnB0ycyibJ0OOHIlJqTNzglYFxVwETOcIoJqJmpDXJ9xImDv+Fq34F/d4Dw==" + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "license": "ISC" }, - "node_modules/querystring": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz", - "integrity": "sha512-X/xY82scca2tau62i9mDyU9K+I+djTMUsvwf7xnUX5GLvVzgJybOJf4Y6o9Zx3oJK/LSXg5tTZBjwzqVPaPO2g==", - "deprecated": "The querystring API is considered Legacy. new code should use the URLSearchParams API instead.", + "node_modules/ws": { + "version": "7.5.9", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.9.tgz", + "integrity": "sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==", + "license": "MIT", "engines": { - "node": ">=0.4.x" - } - }, - "node_modules/queue-microtask": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", - "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" + "node": ">=8.3.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": "^5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true }, - { - "type": "consulting", - "url": "https://feross.org/support" + "utf-8-validate": { + "optional": true } - ] - }, - "node_modules/react-is": { - "version": "17.0.2", - "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz", - "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==", - "peer": true + } }, - "node_modules/readable-stream": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", - "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "node_modules/xhr2-cookies": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/xhr2-cookies/-/xhr2-cookies-1.1.0.tgz", + "integrity": "sha512-hjXUA6q+jl/bd8ADHcVfFsSPIf+tyLIjuO9TwJC9WI6JP2zKcS7C+p56I9kCLLsaCiNT035iYvEUUzdEFj/8+g==", + "peer": true, "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - }, - "engines": { - "node": ">= 6" + "cookiejar": "^2.1.1" } }, - "node_modules/rechoir": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", - "integrity": "sha512-HFM8rkZ+i3zrV+4LQjwQ0W+ez98pApMGM3HUrN04j3CqzPOzl9nmP15Y8YXNm8QHGv/eacOVEjqhmWpkRV0NAw==", - "peer": true, + "node_modules/xml2js": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.5.0.tgz", + "integrity": "sha512-drPFnkQJik/O+uPKpqSgr22mpuFHqKdbS835iAQrUC73L2F5WkboIRd63ai/2Yg6I1jzifPFKH2NTK+cfglkIA==", + "license": "MIT", "dependencies": { - "resolve": "^1.1.6" + "sax": ">=0.6.0", + "xmlbuilder": "~11.0.0" }, "engines": { - "node": ">= 0.10" + "node": ">=4.0.0" } }, - "node_modules/regenerator-runtime": { - "version": "0.13.11", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz", - "integrity": "sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==" + "node_modules/xml2js/node_modules/sax": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", + "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==", + "license": "ISC" }, - "node_modules/regexpp": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz", - "integrity": "sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==", - "dev": true, + "node_modules/xmlbuilder": { + "version": "11.0.1", + "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-11.0.1.tgz", + "integrity": "sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA==", + "license": "MIT", "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/mysticatea" - } - }, - "node_modules/resolve": { - "version": "1.22.1", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.1.tgz", - "integrity": "sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw==", - "peer": true, - "dependencies": { - "is-core-module": "^2.9.0", - "path-parse": "^1.0.7", - "supports-preserve-symlinks-flag": "^1.0.0" - }, - "bin": { - "resolve": "bin/resolve" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "node": ">=4.0" } }, - "node_modules/resolve-from": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", - "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "node_modules/yn": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", "dev": true, + "license": "MIT", "engines": { - "node": ">=4" + "node": ">=6" } }, - "node_modules/reusify": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", - "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", "dev": true, + "license": "MIT", "engines": { - "iojs": ">=1.0.0", - "node": ">=0.10.0" - } - }, - "node_modules/rimraf": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", - "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", - "dev": true, - "dependencies": { - "glob": "^7.1.3" - }, - "bin": { - "rimraf": "bin.js" + "node": ">=10" }, "funding": { - "url": "https://github.com/sponsors/isaacs" + "url": "https://github.com/sponsors/sindresorhus" } - }, - "node_modules/ripemd160": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.2.tgz", - "integrity": "sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==", + } + }, + "dependencies": { + "@aws-crypto/crc32": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@aws-crypto/crc32/-/crc32-3.0.0.tgz", + "integrity": "sha512-IzSgsrxUcsrejQbPVilIKy16kAT52EwB6zSaI+M3xxIhKh5+aldEyvI+z6erM7TCLB2BJsFrtHjp6/4/sr+3dA==", + "requires": { + "@aws-crypto/util": "^3.0.0", + "@aws-sdk/types": "^3.222.0", + "tslib": "^1.11.1" + }, "dependencies": { - "hash-base": "^3.0.0", - "inherits": "^2.0.1" + "tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" + } } }, - "node_modules/rpc-websockets": { - "version": "7.5.0", - "resolved": "https://registry.npmjs.org/rpc-websockets/-/rpc-websockets-7.5.0.tgz", - "integrity": "sha512-9tIRi1uZGy7YmDjErf1Ax3wtqdSSLIlnmL5OtOzgd5eqPKbsPpwDP5whUDO2LQay3Xp0CcHlcNSGzacNRluBaQ==", - "dependencies": { - "@babel/runtime": "^7.17.2", - "eventemitter3": "^4.0.7", - "uuid": "^8.3.2", - "ws": "^8.5.0" + "@aws-crypto/crc32c": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@aws-crypto/crc32c/-/crc32c-3.0.0.tgz", + "integrity": "sha512-ENNPPManmnVJ4BTXlOjAgD7URidbAznURqD0KvfREyc4o20DPYdEldU1f5cQ7Jbj0CJJSPaMIk/9ZshdB3210w==", + "requires": { + "@aws-crypto/util": "^3.0.0", + "@aws-sdk/types": "^3.222.0", + "tslib": "^1.11.1" }, - "funding": { - "type": "paypal", - "url": "https://paypal.me/kozjak" + "dependencies": { + "tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" + } + } + }, + "@aws-crypto/ie11-detection": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@aws-crypto/ie11-detection/-/ie11-detection-3.0.0.tgz", + "integrity": "sha512-341lBBkiY1DfDNKai/wXM3aujNBkXR7tq1URPQDL9wi3AUbI80NR74uF1TXHMm7po1AcnFk8iu2S2IeU/+/A+Q==", + "requires": { + "tslib": "^1.11.1" }, - "optionalDependencies": { - "bufferutil": "^4.0.1", - "utf-8-validate": "^5.0.2" + "dependencies": { + "tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" + } } }, - "node_modules/rpc-websockets/node_modules/uuid": { - "version": "8.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", - "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", - "bin": { - "uuid": "dist/bin/uuid" + "@aws-crypto/sha1-browser": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@aws-crypto/sha1-browser/-/sha1-browser-3.0.0.tgz", + "integrity": "sha512-NJth5c997GLHs6nOYTzFKTbYdMNA6/1XlKVgnZoaZcQ7z7UJlOgj2JdbHE8tiYLS3fzXNCguct77SPGat2raSw==", + "requires": { + "@aws-crypto/ie11-detection": "^3.0.0", + "@aws-crypto/supports-web-crypto": "^3.0.0", + "@aws-crypto/util": "^3.0.0", + "@aws-sdk/types": "^3.222.0", + "@aws-sdk/util-locate-window": "^3.0.0", + "@aws-sdk/util-utf8-browser": "^3.0.0", + "tslib": "^1.11.1" + }, + "dependencies": { + "tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" + } } }, - "node_modules/rpc-websockets/node_modules/ws": { - "version": "8.11.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.11.0.tgz", - "integrity": "sha512-HPG3wQd9sNQoT9xHyNCXoDUa+Xw/VevmY9FoHyQ+g+rrMn4j6FB4np7Z0OhdTgjx6MgQLK7jwSy1YecU1+4Asg==", - "engines": { - "node": ">=10.0.0" - }, - "peerDependencies": { - "bufferutil": "^4.0.1", - "utf-8-validate": "^5.0.2" + "@aws-crypto/sha256-browser": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@aws-crypto/sha256-browser/-/sha256-browser-3.0.0.tgz", + "integrity": "sha512-8VLmW2B+gjFbU5uMeqtQM6Nj0/F1bro80xQXCW6CQBWgosFWXTx77aeOF5CAIAmbOK64SdMBJdNr6J41yP5mvQ==", + "requires": { + "@aws-crypto/ie11-detection": "^3.0.0", + "@aws-crypto/sha256-js": "^3.0.0", + "@aws-crypto/supports-web-crypto": "^3.0.0", + "@aws-crypto/util": "^3.0.0", + "@aws-sdk/types": "^3.222.0", + "@aws-sdk/util-locate-window": "^3.0.0", + "@aws-sdk/util-utf8-browser": "^3.0.0", + "tslib": "^1.11.1" }, - "peerDependenciesMeta": { - "bufferutil": { - "optional": true - }, - "utf-8-validate": { - "optional": true + "dependencies": { + "tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" } } }, - "node_modules/run-parallel": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", - "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], + "@aws-crypto/sha256-js": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@aws-crypto/sha256-js/-/sha256-js-3.0.0.tgz", + "integrity": "sha512-PnNN7os0+yd1XvXAy23CFOmTbMaDxgxXtTKHybrJ39Y8kGzBATgBFibWJKH6BhytLI/Zyszs87xCOBNyBig6vQ==", + "requires": { + "@aws-crypto/util": "^3.0.0", + "@aws-sdk/types": "^3.222.0", + "tslib": "^1.11.1" + }, "dependencies": { - "queue-microtask": "^1.2.2" + "tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" + } } }, - "node_modules/rx-sandbox": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/rx-sandbox/-/rx-sandbox-1.0.4.tgz", - "integrity": "sha512-+/9MHDYNoF9ca/2RR+L2LloXXeQyIR3k/wjK03IicrxxlbkhmKF4ejPiWeafMWDg7otF+pnX5NE/8v/rX6ICJA==", - "peer": true, - "dependencies": { - "expect": "^26.6.1", - "jest-matcher-utils": "^26.6.1" - }, - "engines": { - "node": ">=4.2.4", - "npm": ">=3.0.0" + "@aws-crypto/supports-web-crypto": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@aws-crypto/supports-web-crypto/-/supports-web-crypto-3.0.0.tgz", + "integrity": "sha512-06hBdMwUAb2WFTuGG73LSC0wfPu93xWwo5vL2et9eymgmu3Id5vFAHBbajVWiGhPO37qcsdCap/FqXvJGJWPIg==", + "requires": { + "tslib": "^1.11.1" }, - "peerDependencies": { - "rxjs": "6.x" + "dependencies": { + "tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" + } } }, - "node_modules/rxjs": { - "version": "6.6.7", - "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.7.tgz", - "integrity": "sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ==", - "dependencies": { - "tslib": "^1.9.0" + "@aws-crypto/util": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@aws-crypto/util/-/util-3.0.0.tgz", + "integrity": "sha512-2OJlpeJpCR48CC8r+uKVChzs9Iungj9wkZrl8Z041DWEWvyIHILYKCPNzJghKsivj+S3mLo6BVc7mBNzdxA46w==", + "requires": { + "@aws-sdk/types": "^3.222.0", + "@aws-sdk/util-utf8-browser": "^3.0.0", + "tslib": "^1.11.1" }, - "engines": { - "npm": ">=2.0.0" + "dependencies": { + "tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" + } } }, - "node_modules/rxjs/node_modules/tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" + "@aws-sdk/abort-controller": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/abort-controller/-/abort-controller-3.310.0.tgz", + "integrity": "sha512-v1zrRQxDLA1MdPim159Vx/CPHqsB4uybSxRi1CnfHO5ZjHryx3a5htW2gdGAykVCul40+yJXvfpufMrELVxH+g==", + "requires": { + "@aws-sdk/types": "3.310.0", + "tslib": "^2.5.0" + } + }, + "@aws-sdk/chunked-blob-reader": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/chunked-blob-reader/-/chunked-blob-reader-3.310.0.tgz", + "integrity": "sha512-CrJS3exo4mWaLnWxfCH+w88Ou0IcAZSIkk4QbmxiHl/5Dq705OLoxf4385MVyExpqpeVJYOYQ2WaD8i/pQZ2fg==", + "requires": { + "tslib": "^2.5.0" + } + }, + "@aws-sdk/client-s3": { + "version": "3.328.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-s3/-/client-s3-3.328.0.tgz", + "integrity": "sha512-jYHukdhiICj8aiCg3DqjIeKkZs1xOmwXta/kjCbHQlaF17Rl43VLI3nT4rzXB6ixtqUW3I7Wvx61F9S+EOVl3A==", + "requires": { + "@aws-crypto/sha1-browser": "3.0.0", + "@aws-crypto/sha256-browser": "3.0.0", + "@aws-crypto/sha256-js": "3.0.0", + "@aws-sdk/client-sts": "3.328.0", + "@aws-sdk/config-resolver": "3.310.0", + "@aws-sdk/credential-provider-node": "3.328.0", + "@aws-sdk/eventstream-serde-browser": "3.310.0", + "@aws-sdk/eventstream-serde-config-resolver": "3.310.0", + "@aws-sdk/eventstream-serde-node": "3.310.0", + "@aws-sdk/fetch-http-handler": "3.310.0", + "@aws-sdk/hash-blob-browser": "3.310.0", + "@aws-sdk/hash-node": "3.310.0", + "@aws-sdk/hash-stream-node": "3.310.0", + "@aws-sdk/invalid-dependency": "3.310.0", + "@aws-sdk/md5-js": "3.310.0", + "@aws-sdk/middleware-bucket-endpoint": "3.310.0", + "@aws-sdk/middleware-content-length": "3.325.0", + "@aws-sdk/middleware-endpoint": "3.325.0", + "@aws-sdk/middleware-expect-continue": "3.325.0", + "@aws-sdk/middleware-flexible-checksums": "3.326.0", + "@aws-sdk/middleware-host-header": "3.325.0", + "@aws-sdk/middleware-location-constraint": "3.325.0", + "@aws-sdk/middleware-logger": "3.325.0", + "@aws-sdk/middleware-recursion-detection": "3.325.0", + "@aws-sdk/middleware-retry": "3.327.0", + "@aws-sdk/middleware-sdk-s3": "3.326.0", + "@aws-sdk/middleware-serde": "3.325.0", + "@aws-sdk/middleware-signing": "3.325.0", + "@aws-sdk/middleware-ssec": "3.325.0", + "@aws-sdk/middleware-stack": "3.325.0", + "@aws-sdk/middleware-user-agent": "3.327.0", + "@aws-sdk/node-config-provider": "3.310.0", + "@aws-sdk/node-http-handler": "3.328.0", + "@aws-sdk/protocol-http": "3.310.0", + "@aws-sdk/signature-v4-multi-region": "3.310.0", + "@aws-sdk/smithy-client": "3.325.0", + "@aws-sdk/types": "3.310.0", + "@aws-sdk/url-parser": "3.310.0", + "@aws-sdk/util-base64": "3.310.0", + "@aws-sdk/util-body-length-browser": "3.310.0", + "@aws-sdk/util-body-length-node": "3.310.0", + "@aws-sdk/util-defaults-mode-browser": "3.325.0", + "@aws-sdk/util-defaults-mode-node": "3.325.0", + "@aws-sdk/util-endpoints": "3.327.0", + "@aws-sdk/util-retry": "3.327.0", + "@aws-sdk/util-stream-browser": "3.310.0", + "@aws-sdk/util-stream-node": "3.328.0", + "@aws-sdk/util-user-agent-browser": "3.310.0", + "@aws-sdk/util-user-agent-node": "3.310.0", + "@aws-sdk/util-utf8": "3.310.0", + "@aws-sdk/util-waiter": "3.310.0", + "@aws-sdk/xml-builder": "3.310.0", + "fast-xml-parser": "4.1.2", + "tslib": "^2.5.0" + } + }, + "@aws-sdk/client-sso": { + "version": "3.328.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-sso/-/client-sso-3.328.0.tgz", + "integrity": "sha512-IneVwc4j3bCXwCdNAALQ8VVrfFTFAb2f3FxerHv4DLx8OlMTvZiraDDJisfO+cXLl2WCJOJAzpAJTgrPA50LCg==", + "requires": { + "@aws-crypto/sha256-browser": "3.0.0", + "@aws-crypto/sha256-js": "3.0.0", + "@aws-sdk/config-resolver": "3.310.0", + "@aws-sdk/fetch-http-handler": "3.310.0", + "@aws-sdk/hash-node": "3.310.0", + "@aws-sdk/invalid-dependency": "3.310.0", + "@aws-sdk/middleware-content-length": "3.325.0", + "@aws-sdk/middleware-endpoint": "3.325.0", + "@aws-sdk/middleware-host-header": "3.325.0", + "@aws-sdk/middleware-logger": "3.325.0", + "@aws-sdk/middleware-recursion-detection": "3.325.0", + "@aws-sdk/middleware-retry": "3.327.0", + "@aws-sdk/middleware-serde": "3.325.0", + "@aws-sdk/middleware-stack": "3.325.0", + "@aws-sdk/middleware-user-agent": "3.327.0", + "@aws-sdk/node-config-provider": "3.310.0", + "@aws-sdk/node-http-handler": "3.328.0", + "@aws-sdk/protocol-http": "3.310.0", + "@aws-sdk/smithy-client": "3.325.0", + "@aws-sdk/types": "3.310.0", + "@aws-sdk/url-parser": "3.310.0", + "@aws-sdk/util-base64": "3.310.0", + "@aws-sdk/util-body-length-browser": "3.310.0", + "@aws-sdk/util-body-length-node": "3.310.0", + "@aws-sdk/util-defaults-mode-browser": "3.325.0", + "@aws-sdk/util-defaults-mode-node": "3.325.0", + "@aws-sdk/util-endpoints": "3.327.0", + "@aws-sdk/util-retry": "3.327.0", + "@aws-sdk/util-user-agent-browser": "3.310.0", + "@aws-sdk/util-user-agent-node": "3.310.0", + "@aws-sdk/util-utf8": "3.310.0", + "tslib": "^2.5.0" + } + }, + "@aws-sdk/client-sso-oidc": { + "version": "3.328.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-sso-oidc/-/client-sso-oidc-3.328.0.tgz", + "integrity": "sha512-2T6Snri7ovx9+q/iw/wZ1YHzz/SsxPuJOhgbJipCFW9f1IEPBIEKVZtywcKYzE1nYjyc6YanAqQMn6U2SPhW4A==", + "requires": { + "@aws-crypto/sha256-browser": "3.0.0", + "@aws-crypto/sha256-js": "3.0.0", + "@aws-sdk/config-resolver": "3.310.0", + "@aws-sdk/fetch-http-handler": "3.310.0", + "@aws-sdk/hash-node": "3.310.0", + "@aws-sdk/invalid-dependency": "3.310.0", + "@aws-sdk/middleware-content-length": "3.325.0", + "@aws-sdk/middleware-endpoint": "3.325.0", + "@aws-sdk/middleware-host-header": "3.325.0", + "@aws-sdk/middleware-logger": "3.325.0", + "@aws-sdk/middleware-recursion-detection": "3.325.0", + "@aws-sdk/middleware-retry": "3.327.0", + "@aws-sdk/middleware-serde": "3.325.0", + "@aws-sdk/middleware-stack": "3.325.0", + "@aws-sdk/middleware-user-agent": "3.327.0", + "@aws-sdk/node-config-provider": "3.310.0", + "@aws-sdk/node-http-handler": "3.328.0", + "@aws-sdk/protocol-http": "3.310.0", + "@aws-sdk/smithy-client": "3.325.0", + "@aws-sdk/types": "3.310.0", + "@aws-sdk/url-parser": "3.310.0", + "@aws-sdk/util-base64": "3.310.0", + "@aws-sdk/util-body-length-browser": "3.310.0", + "@aws-sdk/util-body-length-node": "3.310.0", + "@aws-sdk/util-defaults-mode-browser": "3.325.0", + "@aws-sdk/util-defaults-mode-node": "3.325.0", + "@aws-sdk/util-endpoints": "3.327.0", + "@aws-sdk/util-retry": "3.327.0", + "@aws-sdk/util-user-agent-browser": "3.310.0", + "@aws-sdk/util-user-agent-node": "3.310.0", + "@aws-sdk/util-utf8": "3.310.0", + "tslib": "^2.5.0" + } + }, + "@aws-sdk/client-sts": { + "version": "3.328.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-sts/-/client-sts-3.328.0.tgz", + "integrity": "sha512-Eedz24H7zLuTjJoCtNQEGOKbIlhibqyasFFwWsds6ds24hRF4fVrCKLwZWENZwawtJjjEdRESQe4dwpV5lWqtw==", + "requires": { + "@aws-crypto/sha256-browser": "3.0.0", + "@aws-crypto/sha256-js": "3.0.0", + "@aws-sdk/config-resolver": "3.310.0", + "@aws-sdk/credential-provider-node": "3.328.0", + "@aws-sdk/fetch-http-handler": "3.310.0", + "@aws-sdk/hash-node": "3.310.0", + "@aws-sdk/invalid-dependency": "3.310.0", + "@aws-sdk/middleware-content-length": "3.325.0", + "@aws-sdk/middleware-endpoint": "3.325.0", + "@aws-sdk/middleware-host-header": "3.325.0", + "@aws-sdk/middleware-logger": "3.325.0", + "@aws-sdk/middleware-recursion-detection": "3.325.0", + "@aws-sdk/middleware-retry": "3.327.0", + "@aws-sdk/middleware-sdk-sts": "3.326.0", + "@aws-sdk/middleware-serde": "3.325.0", + "@aws-sdk/middleware-signing": "3.325.0", + "@aws-sdk/middleware-stack": "3.325.0", + "@aws-sdk/middleware-user-agent": "3.327.0", + "@aws-sdk/node-config-provider": "3.310.0", + "@aws-sdk/node-http-handler": "3.328.0", + "@aws-sdk/protocol-http": "3.310.0", + "@aws-sdk/smithy-client": "3.325.0", + "@aws-sdk/types": "3.310.0", + "@aws-sdk/url-parser": "3.310.0", + "@aws-sdk/util-base64": "3.310.0", + "@aws-sdk/util-body-length-browser": "3.310.0", + "@aws-sdk/util-body-length-node": "3.310.0", + "@aws-sdk/util-defaults-mode-browser": "3.325.0", + "@aws-sdk/util-defaults-mode-node": "3.325.0", + "@aws-sdk/util-endpoints": "3.327.0", + "@aws-sdk/util-retry": "3.327.0", + "@aws-sdk/util-user-agent-browser": "3.310.0", + "@aws-sdk/util-user-agent-node": "3.310.0", + "@aws-sdk/util-utf8": "3.310.0", + "fast-xml-parser": "4.1.2", + "tslib": "^2.5.0" + } + }, + "@aws-sdk/config-resolver": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/config-resolver/-/config-resolver-3.310.0.tgz", + "integrity": "sha512-8vsT+/50lOqfDxka9m/rRt6oxv1WuGZoP8oPMk0Dt+TxXMbAzf4+rejBgiB96wshI1k3gLokYRjSQZn+dDtT8g==", + "requires": { + "@aws-sdk/types": "3.310.0", + "@aws-sdk/util-config-provider": "3.310.0", + "@aws-sdk/util-middleware": "3.310.0", + "tslib": "^2.5.0" + } + }, + "@aws-sdk/credential-provider-env": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-env/-/credential-provider-env-3.310.0.tgz", + "integrity": "sha512-vvIPQpI16fj95xwS7M3D48F7QhZJBnnCgB5lR+b7So+vsG9ibm1mZRVGzVpdxCvgyOhHFbvrby9aalNJmmIP1A==", + "requires": { + "@aws-sdk/property-provider": "3.310.0", + "@aws-sdk/types": "3.310.0", + "tslib": "^2.5.0" + } + }, + "@aws-sdk/credential-provider-imds": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-imds/-/credential-provider-imds-3.310.0.tgz", + "integrity": "sha512-baxK7Zp6dai5AGW01FIW27xS2KAaPUmKLIXv5SvFYsUgXXvNW55im4uG3b+2gA0F7V+hXvVBH08OEqmwW6we5w==", + "requires": { + "@aws-sdk/node-config-provider": "3.310.0", + "@aws-sdk/property-provider": "3.310.0", + "@aws-sdk/types": "3.310.0", + "@aws-sdk/url-parser": "3.310.0", + "tslib": "^2.5.0" + } + }, + "@aws-sdk/credential-provider-ini": { + "version": "3.328.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-ini/-/credential-provider-ini-3.328.0.tgz", + "integrity": "sha512-tOHzfWQUaQif1IciWs57MFM7bFc+693pnEhFCgT3wjzwjKGkq1QsNzfRlOp1QP4Glw6qV+kAAemEZj8mGth8Bg==", + "requires": { + "@aws-sdk/credential-provider-env": "3.310.0", + "@aws-sdk/credential-provider-imds": "3.310.0", + "@aws-sdk/credential-provider-process": "3.310.0", + "@aws-sdk/credential-provider-sso": "3.328.0", + "@aws-sdk/credential-provider-web-identity": "3.310.0", + "@aws-sdk/property-provider": "3.310.0", + "@aws-sdk/shared-ini-file-loader": "3.310.0", + "@aws-sdk/types": "3.310.0", + "tslib": "^2.5.0" + } + }, + "@aws-sdk/credential-provider-node": { + "version": "3.328.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-node/-/credential-provider-node-3.328.0.tgz", + "integrity": "sha512-/omjTxrC8Vv6OPAK+66KNnjVmMZWyEQnQp8e8Y+RZvsuVaeQNJT5UQKSqrYtmqTX2T+yqJY7eVpx5CXBCGjc2g==", + "requires": { + "@aws-sdk/credential-provider-env": "3.310.0", + "@aws-sdk/credential-provider-imds": "3.310.0", + "@aws-sdk/credential-provider-ini": "3.328.0", + "@aws-sdk/credential-provider-process": "3.310.0", + "@aws-sdk/credential-provider-sso": "3.328.0", + "@aws-sdk/credential-provider-web-identity": "3.310.0", + "@aws-sdk/property-provider": "3.310.0", + "@aws-sdk/shared-ini-file-loader": "3.310.0", + "@aws-sdk/types": "3.310.0", + "tslib": "^2.5.0" + } + }, + "@aws-sdk/credential-provider-process": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-process/-/credential-provider-process-3.310.0.tgz", + "integrity": "sha512-h73sg6GPMUWC+3zMCbA1nZ2O03nNJt7G96JdmnantiXBwHpRKWW8nBTLzx5uhXn6hTuTaoQRP/P+oxQJKYdMmA==", + "requires": { + "@aws-sdk/property-provider": "3.310.0", + "@aws-sdk/shared-ini-file-loader": "3.310.0", + "@aws-sdk/types": "3.310.0", + "tslib": "^2.5.0" + } + }, + "@aws-sdk/credential-provider-sso": { + "version": "3.328.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-sso/-/credential-provider-sso-3.328.0.tgz", + "integrity": "sha512-6lSfA3AcoqNt+OYJoBimWmPmqUYVCHkE0Y+4HFN7JaXCyUknsO9/71P5zo/pp8Q7/yxP/aRyzjael82G5thj0A==", + "requires": { + "@aws-sdk/client-sso": "3.328.0", + "@aws-sdk/property-provider": "3.310.0", + "@aws-sdk/shared-ini-file-loader": "3.310.0", + "@aws-sdk/token-providers": "3.328.0", + "@aws-sdk/types": "3.310.0", + "tslib": "^2.5.0" + } }, - "node_modules/safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] + "@aws-sdk/credential-provider-web-identity": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-web-identity/-/credential-provider-web-identity-3.310.0.tgz", + "integrity": "sha512-H4SzuZXILNhK6/IR1uVvsUDZvzc051hem7GLyYghBCu8mU+tq28YhKE8MfSroi6eL2e5Vujloij1OM2EQQkPkw==", + "requires": { + "@aws-sdk/property-provider": "3.310.0", + "@aws-sdk/types": "3.310.0", + "tslib": "^2.5.0" + } }, - "node_modules/sax": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.1.tgz", - "integrity": "sha512-8I2a3LovHTOpm7NV5yOyO8IHqgVsfK4+UuySrXU8YXkSRX7k6hCV9b3HrkKCr3nMpgj+0bmocaJJWpvp1oc7ZA==" + "@aws-sdk/eventstream-codec": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/eventstream-codec/-/eventstream-codec-3.310.0.tgz", + "integrity": "sha512-clIeSgWbZbxwtsxZ/yoedNM0/kJFSIjjHPikuDGhxhqc+vP6TN3oYyVMFrYwFaTFhk2+S5wZcWYMw8Op1pWo+A==", + "requires": { + "@aws-crypto/crc32": "3.0.0", + "@aws-sdk/types": "3.310.0", + "@aws-sdk/util-hex-encoding": "3.310.0", + "tslib": "^2.5.0" + } }, - "node_modules/scrypt-js": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/scrypt-js/-/scrypt-js-3.0.1.tgz", - "integrity": "sha512-cdwTTnqPu0Hyvf5in5asVdZocVDTNRmR7XEcJuIzMjJeSHybHl7vpB66AzwTaIg6CLSbtjcxc8fqcySfnTkccA==" + "@aws-sdk/eventstream-serde-browser": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/eventstream-serde-browser/-/eventstream-serde-browser-3.310.0.tgz", + "integrity": "sha512-3S6ziuQVALgEyz0TANGtYDVeG8ArK4Y05mcgrs8qUTmsvlDIXX37cR/DvmVbNB76M4IrsZeSAIajL9644CywkA==", + "requires": { + "@aws-sdk/eventstream-serde-universal": "3.310.0", + "@aws-sdk/types": "3.310.0", + "tslib": "^2.5.0" + } }, - "node_modules/sha.js": { - "version": "2.4.11", - "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", - "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==", - "dependencies": { - "inherits": "^2.0.1", - "safe-buffer": "^5.0.1" - }, - "bin": { - "sha.js": "bin.js" + "@aws-sdk/eventstream-serde-config-resolver": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/eventstream-serde-config-resolver/-/eventstream-serde-config-resolver-3.310.0.tgz", + "integrity": "sha512-8s1Qdn9STj+sV75nUp9yt0W6fHS4BZ2jTm4Z/1Pcbvh2Gqs0WjH5n2StS+pDW5Y9J/HSGBl0ogmUr5lC5bXFHg==", + "requires": { + "@aws-sdk/types": "3.310.0", + "tslib": "^2.5.0" } }, - "node_modules/shebang-command": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", - "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", - "dev": true, - "dependencies": { - "shebang-regex": "^3.0.0" - }, - "engines": { - "node": ">=8" + "@aws-sdk/eventstream-serde-node": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/eventstream-serde-node/-/eventstream-serde-node-3.310.0.tgz", + "integrity": "sha512-kSnRomCgW43K9TmQYuwN9+AoYPnhyOKroanUMyZEzJk7rpCPMj4OzaUpXfDYOvznFNYn7NLaH6nHLJAr0VPlJA==", + "requires": { + "@aws-sdk/eventstream-serde-universal": "3.310.0", + "@aws-sdk/types": "3.310.0", + "tslib": "^2.5.0" } }, - "node_modules/shebang-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", - "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", - "dev": true, - "engines": { - "node": ">=8" + "@aws-sdk/eventstream-serde-universal": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/eventstream-serde-universal/-/eventstream-serde-universal-3.310.0.tgz", + "integrity": "sha512-Qyjt5k/waV5cDukpgT824ISZAz5U0pwzLz5ztR409u85AGNkF/9n7MS+LSyBUBSb0WJ5pUeSD47WBk+nLq9Nhw==", + "requires": { + "@aws-sdk/eventstream-codec": "3.310.0", + "@aws-sdk/types": "3.310.0", + "tslib": "^2.5.0" } }, - "node_modules/shelljs": { - "version": "0.8.5", - "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.5.tgz", - "integrity": "sha512-TiwcRcrkhHvbrZbnRcFYMLl30Dfov3HKqzp5tO5b4pt6G/SezKcYhmDg15zXVBswHmctSAQKznqNW2LO5tTDow==", - "peer": true, - "dependencies": { - "glob": "^7.0.0", - "interpret": "^1.0.0", - "rechoir": "^0.6.2" - }, - "bin": { - "shjs": "bin/shjs" - }, - "engines": { - "node": ">=4" + "@aws-sdk/fetch-http-handler": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/fetch-http-handler/-/fetch-http-handler-3.310.0.tgz", + "integrity": "sha512-Bi9vIwzdkw1zMcvi/zGzlWS9KfIEnAq4NNhsnCxbQ4OoIRU9wvU+WGZdBBhxg0ZxZmpp1j1aZhU53lLjA07MHw==", + "requires": { + "@aws-sdk/protocol-http": "3.310.0", + "@aws-sdk/querystring-builder": "3.310.0", + "@aws-sdk/types": "3.310.0", + "@aws-sdk/util-base64": "3.310.0", + "tslib": "^2.5.0" } }, - "node_modules/shiki": { - "version": "0.9.15", - "resolved": "https://registry.npmjs.org/shiki/-/shiki-0.9.15.tgz", - "integrity": "sha512-/Y0z9IzhJ8nD9nbceORCqu6NgT9X6I8Fk8c3SICHI5NbZRLdZYFaB233gwct9sU0vvSypyaL/qaKvzyQGJBZSw==", - "peer": true, - "dependencies": { - "jsonc-parser": "^3.0.0", - "vscode-oniguruma": "^1.6.1", - "vscode-textmate": "5.2.0" + "@aws-sdk/hash-blob-browser": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/hash-blob-browser/-/hash-blob-browser-3.310.0.tgz", + "integrity": "sha512-OoR8p0cbypToysLT0v3o2oyjy6+DKrY7GNCAzHOHJK9xmqXCt+DsjKoPeiY7o1sWX2aN6Plmvubj/zWxMKEn/A==", + "requires": { + "@aws-sdk/chunked-blob-reader": "3.310.0", + "@aws-sdk/types": "3.310.0", + "tslib": "^2.5.0" } }, - "node_modules/slash": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", - "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", - "peer": true, - "engines": { - "node": ">=8" + "@aws-sdk/hash-node": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/hash-node/-/hash-node-3.310.0.tgz", + "integrity": "sha512-NvE2fhRc8GRwCXBfDehxVAWCmVwVMILliAKVPAEr4yz2CkYs0tqU51S48x23dtna07H4qHtgpeNqVTthcIQOEQ==", + "requires": { + "@aws-sdk/types": "3.310.0", + "@aws-sdk/util-buffer-from": "3.310.0", + "@aws-sdk/util-utf8": "3.310.0", + "tslib": "^2.5.0" } }, - "node_modules/snake-case": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/snake-case/-/snake-case-3.0.4.tgz", - "integrity": "sha512-LAOh4z89bGQvl9pFfNF8V146i7o7/CqFPbqzYgP+yYzDIDeS9HaNFtXABamRW+AQzEVODcvE79ljJ+8a9YSdMg==", - "dependencies": { - "dot-case": "^3.0.4", - "tslib": "^2.0.3" + "@aws-sdk/hash-stream-node": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/hash-stream-node/-/hash-stream-node-3.310.0.tgz", + "integrity": "sha512-ZoXdybNgvMz1Hl6k/e32xVL3jmG5p2IEk5mTtLfFEuskTJ74Z+VMYKkkF1whyy7KQfH83H+TQGnsGtlRCchQKw==", + "requires": { + "@aws-sdk/types": "3.310.0", + "@aws-sdk/util-utf8": "3.310.0", + "tslib": "^2.5.0" } }, - "node_modules/source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "peer": true, - "engines": { - "node": ">=0.10.0" + "@aws-sdk/invalid-dependency": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/invalid-dependency/-/invalid-dependency-3.310.0.tgz", + "integrity": "sha512-1s5RG5rSPXoa/aZ/Kqr5U/7lqpx+Ry81GprQ2bxWqJvWQIJ0IRUwo5pk8XFxbKVr/2a+4lZT/c3OGoBOM1yRRA==", + "requires": { + "@aws-sdk/types": "3.310.0", + "tslib": "^2.5.0" } }, - "node_modules/stack-utils": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.6.tgz", - "integrity": "sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ==", - "peer": true, - "dependencies": { - "escape-string-regexp": "^2.0.0" - }, - "engines": { - "node": ">=10" + "@aws-sdk/is-array-buffer": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/is-array-buffer/-/is-array-buffer-3.310.0.tgz", + "integrity": "sha512-urnbcCR+h9NWUnmOtet/s4ghvzsidFmspfhYaHAmSRdy9yDjdjBJMFjjsn85A1ODUktztm+cVncXjQ38WCMjMQ==", + "requires": { + "tslib": "^2.5.0" } }, - "node_modules/stack-utils/node_modules/escape-string-regexp": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz", - "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==", - "peer": true, - "engines": { - "node": ">=8" + "@aws-sdk/md5-js": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/md5-js/-/md5-js-3.310.0.tgz", + "integrity": "sha512-x5sRBUrEfLWAS1EhwbbDQ7cXq6uvBxh3qR2XAsnGvFFceTeAadk7cVogWxlk3PC+OCeeym7c3/6Bv2HQ2f1YyQ==", + "requires": { + "@aws-sdk/types": "3.310.0", + "@aws-sdk/util-utf8": "3.310.0", + "tslib": "^2.5.0" } }, - "node_modules/starknet": { - "version": "4.17.1", - "resolved": "https://registry.npmjs.org/starknet/-/starknet-4.17.1.tgz", - "integrity": "sha512-xihdf+pWUCdKK30r+fNLfg+5RHHpTNw20gvrucbcPPDnsDr2bjwtFu3UjXOtHnbys6qF8fW3ttMkctRoQ5J6Xg==", - "dependencies": { - "@ethersproject/bytes": "^5.6.1", - "bn.js": "^5.2.1", - "elliptic": "^6.5.4", - "ethereum-cryptography": "^1.0.3", - "hash.js": "^1.1.7", - "isomorphic-fetch": "^3.0.0", - "json-bigint": "^1.0.0", - "minimalistic-assert": "^1.0.1", - "pako": "^2.0.4", - "ts-custom-error": "^3.3.1", - "url-join": "^4.0.1" + "@aws-sdk/middleware-bucket-endpoint": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-bucket-endpoint/-/middleware-bucket-endpoint-3.310.0.tgz", + "integrity": "sha512-uJJfHI7v4AgbJZRLtyI8ap2QRWkBokGc3iyUoQ+dVNT3/CE2ZCu694A6W+H0dRqg79dIE+f9CRNdtLGa/Ehhvg==", + "requires": { + "@aws-sdk/protocol-http": "3.310.0", + "@aws-sdk/types": "3.310.0", + "@aws-sdk/util-arn-parser": "3.310.0", + "@aws-sdk/util-config-provider": "3.310.0", + "tslib": "^2.5.0" } }, - "node_modules/string_decoder": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", - "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", - "dependencies": { - "safe-buffer": "~5.2.0" + "@aws-sdk/middleware-content-length": { + "version": "3.325.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-content-length/-/middleware-content-length-3.325.0.tgz", + "integrity": "sha512-t38VBKCpNqSKqSu0OfWMJs7cwaRHFGQxIF9lV8JMCM/2lyUpN4JcfuzSTK+MFN2eDZEHp5DiNg8w07GXXusRYg==", + "requires": { + "@aws-sdk/protocol-http": "3.310.0", + "@aws-sdk/types": "3.310.0", + "tslib": "^2.5.0" } }, - "node_modules/strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" + "@aws-sdk/middleware-endpoint": { + "version": "3.325.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-endpoint/-/middleware-endpoint-3.325.0.tgz", + "integrity": "sha512-3CavuOHCKiWUnCtzrUFbhbEP26qIgzzRs5C3vpOJhDUhugBubIWgPGGRLpbnIro+P4XJPwM3pMziNzhKVuSDlQ==", + "requires": { + "@aws-sdk/middleware-serde": "3.325.0", + "@aws-sdk/types": "3.310.0", + "@aws-sdk/url-parser": "3.310.0", + "@aws-sdk/util-middleware": "3.310.0", + "tslib": "^2.5.0" } }, - "node_modules/strip-json-comments": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", - "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", - "dev": true, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "@aws-sdk/middleware-expect-continue": { + "version": "3.325.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-expect-continue/-/middleware-expect-continue-3.325.0.tgz", + "integrity": "sha512-Hj4D+zeet4gdUpSiMeHZfIzcnXkZI2krGyUw4U1psPzCqOp7WP5307g+1NWXOlVu3H3tF5r3rEgthQOQj2zNfA==", + "requires": { + "@aws-sdk/protocol-http": "3.310.0", + "@aws-sdk/types": "3.310.0", + "tslib": "^2.5.0" } }, - "node_modules/superstruct": { - "version": "0.15.5", - "resolved": "https://registry.npmjs.org/superstruct/-/superstruct-0.15.5.tgz", - "integrity": "sha512-4AOeU+P5UuE/4nOUkmcQdW5y7i9ndt1cQd/3iUe+LTz3RxESf/W/5lg4B74HbDMMv8PHnPnGCQFH45kBcrQYoQ==" + "@aws-sdk/middleware-flexible-checksums": { + "version": "3.326.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-flexible-checksums/-/middleware-flexible-checksums-3.326.0.tgz", + "integrity": "sha512-MtcvSU+wKu4/a/trIJmb4Tfb682U9uP5YYA5aXzdhxOxG11wj86uBIeQrdbUxhtTXMgmvwn1193dvTi91EUEaQ==", + "requires": { + "@aws-crypto/crc32": "3.0.0", + "@aws-crypto/crc32c": "3.0.0", + "@aws-sdk/is-array-buffer": "3.310.0", + "@aws-sdk/protocol-http": "3.310.0", + "@aws-sdk/types": "3.310.0", + "@aws-sdk/util-utf8": "3.310.0", + "tslib": "^2.5.0" + } }, - "node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" + "@aws-sdk/middleware-host-header": { + "version": "3.325.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-host-header/-/middleware-host-header-3.325.0.tgz", + "integrity": "sha512-IN28gsxcRy4J+FxxCHvzb2NORBx8uMA+h9QYS4BBZfpKVYIZh+mudHgYcdNHWlKXmlTGjhWBNWTeByhzuSKAiA==", + "requires": { + "@aws-sdk/protocol-http": "3.310.0", + "@aws-sdk/types": "3.310.0", + "tslib": "^2.5.0" } }, - "node_modules/supports-preserve-symlinks-flag": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", - "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", - "peer": true, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "@aws-sdk/middleware-location-constraint": { + "version": "3.325.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-location-constraint/-/middleware-location-constraint-3.325.0.tgz", + "integrity": "sha512-T2OrpXXY9I1nHvIGSlQD6qj1FDG3WDFSu65+Bh4pMl+zVh0IqIEajiK++TfrdQl+sJxRGQd/euoeXXL4JYw9JA==", + "requires": { + "@aws-sdk/types": "3.310.0", + "tslib": "^2.5.0" } }, - "node_modules/text-encoding-utf-8": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/text-encoding-utf-8/-/text-encoding-utf-8-1.0.2.tgz", - "integrity": "sha512-8bw4MY9WjdsD2aMtO0OzOCY3pXGYNx2d2FfHRVUKkiCPDWjKuOlhLVASS+pD7VkLTVjW268LYJHwsnPFlBpbAg==" + "@aws-sdk/middleware-logger": { + "version": "3.325.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-logger/-/middleware-logger-3.325.0.tgz", + "integrity": "sha512-S8rWgTpN2b/+UDDm+yZMFM6rw1zwO8KT0GAIQbAhB96shyD5eKen/UfihCTB7YMvbD2piebymwJTvxv6bn1VqQ==", + "requires": { + "@aws-sdk/types": "3.310.0", + "tslib": "^2.5.0" + } }, - "node_modules/text-table": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", - "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", - "dev": true + "@aws-sdk/middleware-recursion-detection": { + "version": "3.325.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-recursion-detection/-/middleware-recursion-detection-3.325.0.tgz", + "integrity": "sha512-2l1ABF7KePsoKz8KaNvD2uxo1zHqkFHK4PL/wW/FbcwOcE08f0R7qX++st/bPpVjXX/j/5vWTnNNgJOIOrZhyw==", + "requires": { + "@aws-sdk/protocol-http": "3.310.0", + "@aws-sdk/types": "3.310.0", + "tslib": "^2.5.0" + } }, - "node_modules/through": { - "version": "2.3.8", - "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", - "integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==" + "@aws-sdk/middleware-retry": { + "version": "3.327.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-retry/-/middleware-retry-3.327.0.tgz", + "integrity": "sha512-LCG+oRIPc4XJ+DYqkSCgggavxWi4+hP3Rw40vHdHMNvJpCiUJMwVJ+dULEywEP/WZvr4AEkWiRrHmJVpSLeZ+Q==", + "requires": { + "@aws-sdk/protocol-http": "3.310.0", + "@aws-sdk/service-error-classification": "3.327.0", + "@aws-sdk/types": "3.310.0", + "@aws-sdk/util-middleware": "3.310.0", + "@aws-sdk/util-retry": "3.327.0", + "tslib": "^2.5.0", + "uuid": "^8.3.2" + } }, - "node_modules/to-regex-range": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", - "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", - "peer": true, - "dependencies": { - "is-number": "^7.0.0" - }, - "engines": { - "node": ">=8.0" + "@aws-sdk/middleware-sdk-s3": { + "version": "3.326.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-sdk-s3/-/middleware-sdk-s3-3.326.0.tgz", + "integrity": "sha512-IyonHEiDMn0fdYWxA/TAnNj8M/xG5EJWvoOKcakl891f+JPaWeRsV2oE1fIjqM/waM3jqNXLDTrm06QfAYmgBQ==", + "requires": { + "@aws-sdk/protocol-http": "3.310.0", + "@aws-sdk/types": "3.310.0", + "@aws-sdk/util-arn-parser": "3.310.0", + "tslib": "^2.5.0" } }, - "node_modules/toml": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/toml/-/toml-3.0.0.tgz", - "integrity": "sha512-y/mWCZinnvxjTKYhJ+pYxwD0mRLVvOtdS2Awbgxln6iEnt4rk0yBxeSBHkGJcPucRiG0e55mwWp+g/05rsrd6w==" + "@aws-sdk/middleware-sdk-sts": { + "version": "3.326.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-sdk-sts/-/middleware-sdk-sts-3.326.0.tgz", + "integrity": "sha512-suOkuXxyAfOH0hznK63ZU10EoytKX5YPs9amO416VbgYFtuIeliCmntYfnl1jUvutp0fctGGpEGE9OnoYI+fhw==", + "requires": { + "@aws-sdk/middleware-signing": "3.325.0", + "@aws-sdk/types": "3.310.0", + "tslib": "^2.5.0" + } }, - "node_modules/tr46": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", - "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" + "@aws-sdk/middleware-serde": { + "version": "3.325.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-serde/-/middleware-serde-3.325.0.tgz", + "integrity": "sha512-QAZYaFfAw1a06Vg39JiYIq0kSJ6EuUPOiKfK/Goj0cBv78lrXWuKdf04UF3U8Rqk/4mamnsTqUSwf4NoKkF0hw==", + "requires": { + "@aws-sdk/types": "3.310.0", + "tslib": "^2.5.0" + } }, - "node_modules/traverse-chain": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/traverse-chain/-/traverse-chain-0.1.0.tgz", - "integrity": "sha512-up6Yvai4PYKhpNp5PkYtx50m3KbwQrqDwbuZP/ItyL64YEWHAvH6Md83LFLV/GRSk/BoUVwwgUzX6SOQSbsfAg==" + "@aws-sdk/middleware-signing": { + "version": "3.325.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-signing/-/middleware-signing-3.325.0.tgz", + "integrity": "sha512-SOwPwaCE3vSCGwFzkIlnOUSkeCUzKTyIQnFVjlQkqGuMxMX/iDaQQGaX+HUbuGIuULCEQqjZH4dLKZcor8eVZw==", + "requires": { + "@aws-sdk/property-provider": "3.310.0", + "@aws-sdk/protocol-http": "3.310.0", + "@aws-sdk/signature-v4": "3.310.0", + "@aws-sdk/types": "3.310.0", + "@aws-sdk/util-middleware": "3.310.0", + "tslib": "^2.5.0" + } }, - "node_modules/tron-format-address": { - "version": "0.1.8", - "resolved": "https://registry.npmjs.org/tron-format-address/-/tron-format-address-0.1.8.tgz", - "integrity": "sha512-oTtzUM43OZhQiv1p2aOVqbnev6mmJHXQrMpS3nn7zVAI/+ffA/aF+Y/vugHtYotckkromRLPEl/SR1HfJjAYQA==" + "@aws-sdk/middleware-ssec": { + "version": "3.325.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-ssec/-/middleware-ssec-3.325.0.tgz", + "integrity": "sha512-hxmvvWVfVrbfUw8pDEPlsR6Sb+IUdhq0cOJc7SL5XO9ddRXJ5DjT2Z2ao9FB424hJgAcOrqIO5ECjdIRs+O4FQ==", + "requires": { + "@aws-sdk/types": "3.310.0", + "tslib": "^2.5.0" + } }, - "node_modules/ts-custom-error": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/ts-custom-error/-/ts-custom-error-3.3.1.tgz", - "integrity": "sha512-5OX1tzOjxWEgsr/YEUWSuPrQ00deKLh6D7OTWcvNHm12/7QPyRh8SYpyWvA4IZv8H/+GQWQEh/kwo95Q9OVW1A==", - "engines": { - "node": ">=14.0.0" + "@aws-sdk/middleware-stack": { + "version": "3.325.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-stack/-/middleware-stack-3.325.0.tgz", + "integrity": "sha512-cZWehA4grGvX1IKlY9atJgD0bq3ew7YRJgY7GA6DSgsU7GrZ61Qvi+H7IuGx5AdeAwaTnbnTGN4qCaA2EfxNhA==", + "requires": { + "tslib": "^2.5.0" } }, - "node_modules/ts-node": { - "version": "10.9.1", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz", - "integrity": "sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==", - "dev": true, - "dependencies": { - "@cspotcode/source-map-support": "^0.8.0", - "@tsconfig/node10": "^1.0.7", - "@tsconfig/node12": "^1.0.7", - "@tsconfig/node14": "^1.0.0", - "@tsconfig/node16": "^1.0.2", - "acorn": "^8.4.1", - "acorn-walk": "^8.1.1", - "arg": "^4.1.0", - "create-require": "^1.1.0", - "diff": "^4.0.1", - "make-error": "^1.1.1", - "v8-compile-cache-lib": "^3.0.1", - "yn": "3.1.1" - }, - "bin": { - "ts-node": "dist/bin.js", - "ts-node-cwd": "dist/bin-cwd.js", - "ts-node-esm": "dist/bin-esm.js", - "ts-node-script": "dist/bin-script.js", - "ts-node-transpile-only": "dist/bin-transpile.js", - "ts-script": "dist/bin-script-deprecated.js" - }, - "peerDependencies": { - "@swc/core": ">=1.2.50", - "@swc/wasm": ">=1.2.50", - "@types/node": "*", - "typescript": ">=2.7" - }, - "peerDependenciesMeta": { - "@swc/core": { - "optional": true - }, - "@swc/wasm": { - "optional": true - } + "@aws-sdk/middleware-user-agent": { + "version": "3.327.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-user-agent/-/middleware-user-agent-3.327.0.tgz", + "integrity": "sha512-4rDSNY1xhlqfRcY97CQKcgs6AOe4ovtiRdCAjg2InnLOZHRVFoHhOIDxWNK2W1K2Pl65z4EGH6RXmB1t0srJHA==", + "requires": { + "@aws-sdk/protocol-http": "3.310.0", + "@aws-sdk/types": "3.310.0", + "@aws-sdk/util-endpoints": "3.327.0", + "tslib": "^2.5.0" } }, - "node_modules/tslib": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.1.tgz", - "integrity": "sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==" + "@aws-sdk/node-config-provider": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/node-config-provider/-/node-config-provider-3.310.0.tgz", + "integrity": "sha512-T/Pp6htc6hq/Cq+MLNDSyiwWCMVF6GqbBbXKVlO5L8rdHx4sq9xPdoPveZhGWrxvkanjA6eCwUp6E0riBOSVng==", + "requires": { + "@aws-sdk/property-provider": "3.310.0", + "@aws-sdk/shared-ini-file-loader": "3.310.0", + "@aws-sdk/types": "3.310.0", + "tslib": "^2.5.0" + } }, - "node_modules/type-check": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", - "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", - "dev": true, - "dependencies": { - "prelude-ls": "^1.2.1" - }, - "engines": { - "node": ">= 0.8.0" + "@aws-sdk/node-http-handler": { + "version": "3.328.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/node-http-handler/-/node-http-handler-3.328.0.tgz", + "integrity": "sha512-zxXdNfdSGi6w/1bopllxAYAufCGDNG2eLenR3Tjj/UVBGrvS4ME5NGInu6u4LirTdkSqYlZkqKMyfiZ6XxGfdQ==", + "requires": { + "@aws-sdk/abort-controller": "3.310.0", + "@aws-sdk/protocol-http": "3.310.0", + "@aws-sdk/querystring-builder": "3.310.0", + "@aws-sdk/types": "3.310.0", + "tslib": "^2.5.0" } }, - "node_modules/type-fest": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", - "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "@aws-sdk/property-provider": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/property-provider/-/property-provider-3.310.0.tgz", + "integrity": "sha512-3lxDb0akV6BBzmFe4nLPaoliQbAifyWJhuvuDOu7e8NzouvpQXs0275w9LePhhcgjKAEVXUIse05ZW2DLbxo/g==", + "requires": { + "@aws-sdk/types": "3.310.0", + "tslib": "^2.5.0" } }, - "node_modules/typedarray-to-buffer": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-4.0.0.tgz", - "integrity": "sha512-6dOYeZfS3O9RtRD1caom0sMxgK59b27+IwoNy8RDPsmslSGOyU+mpTamlaIW7aNKi90ZQZ9DFaZL3YRoiSCULQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] + "@aws-sdk/protocol-http": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/protocol-http/-/protocol-http-3.310.0.tgz", + "integrity": "sha512-fgZ1aw/irQtnrsR58pS8ThKOWo57Py3xX6giRvwSgZDEcxHfVzuQjy9yPuV++v04fdmdtgpbGf8WfvAAJ11yXQ==", + "requires": { + "@aws-sdk/types": "3.310.0", + "tslib": "^2.5.0" + } }, - "node_modules/typedoc-default-themes": { - "version": "0.12.10", - "resolved": "https://registry.npmjs.org/typedoc-default-themes/-/typedoc-default-themes-0.12.10.tgz", - "integrity": "sha512-fIS001cAYHkyQPidWXmHuhs8usjP5XVJjWB8oZGqkTowZaz3v7g3KDZeeqE82FBrmkAnIBOY3jgy7lnPnqATbA==", - "peer": true, - "engines": { - "node": ">= 8" + "@aws-sdk/querystring-builder": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/querystring-builder/-/querystring-builder-3.310.0.tgz", + "integrity": "sha512-ZHH8GV/80+pWGo7DzsvwvXR5xVxUHXUvPJPFAkhr6nCf78igdoF8gR10ScFoEKbtEapoNTaZlKHPXxpD8aPG7A==", + "requires": { + "@aws-sdk/types": "3.310.0", + "@aws-sdk/util-uri-escape": "3.310.0", + "tslib": "^2.5.0" } }, - "node_modules/typescript": { - "version": "4.9.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.4.tgz", - "integrity": "sha512-Uz+dTXYzxXXbsFpM86Wh3dKCxrQqUcVMxwU54orwlJjOpO3ao8L7j5lH+dWfTwgCwIuM9GQ2kvVotzYJMXTBZg==", - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=4.2.0" + "@aws-sdk/querystring-parser": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/querystring-parser/-/querystring-parser-3.310.0.tgz", + "integrity": "sha512-YkIznoP6lsiIUHinx++/lbb3tlMURGGqMpo0Pnn32zYzGrJXA6eC3D0as2EcMjo55onTfuLcIiX4qzXes2MYOA==", + "requires": { + "@aws-sdk/types": "3.310.0", + "tslib": "^2.5.0" } }, - "node_modules/uglify-js": { - "version": "3.17.4", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.17.4.tgz", - "integrity": "sha512-T9q82TJI9e/C1TAxYvfb16xO120tMVFZrGA3f9/P4424DNu6ypK103y0GPFVa17yotwSyZW5iYXgjYHkGrJW/g==", - "optional": true, - "peer": true, - "bin": { - "uglifyjs": "bin/uglifyjs" - }, - "engines": { - "node": ">=0.8.0" + "@aws-sdk/service-error-classification": { + "version": "3.327.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/service-error-classification/-/service-error-classification-3.327.0.tgz", + "integrity": "sha512-bCWnw+uH3gI6yPxLi4a4WV71P1KlJU7Z4+iMBY1Gt4+ZsaPAJX9pAbuQcFhFH++4xTk/QaVMzSvD0uQ+u0B/NQ==" + }, + "@aws-sdk/shared-ini-file-loader": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/shared-ini-file-loader/-/shared-ini-file-loader-3.310.0.tgz", + "integrity": "sha512-N0q9pG0xSjQwc690YQND5bofm+4nfUviQ/Ppgan2kU6aU0WUq8KwgHJBto/YEEI+VlrME30jZJnxtOvcZJc2XA==", + "requires": { + "@aws-sdk/types": "3.310.0", + "tslib": "^2.5.0" } }, - "node_modules/universalify": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", - "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==", - "peer": true, - "engines": { - "node": ">= 10.0.0" + "@aws-sdk/signature-v4": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/signature-v4/-/signature-v4-3.310.0.tgz", + "integrity": "sha512-1M60P1ZBNAjCFv9sYW29OF6okktaeibWyW3lMXqzoHF70lHBZh+838iUchznXUA5FLabfn4jBFWMRxlAXJUY2Q==", + "requires": { + "@aws-sdk/is-array-buffer": "3.310.0", + "@aws-sdk/types": "3.310.0", + "@aws-sdk/util-hex-encoding": "3.310.0", + "@aws-sdk/util-middleware": "3.310.0", + "@aws-sdk/util-uri-escape": "3.310.0", + "@aws-sdk/util-utf8": "3.310.0", + "tslib": "^2.5.0" } }, - "node_modules/unix-dgram": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/unix-dgram/-/unix-dgram-2.0.6.tgz", - "integrity": "sha512-AURroAsb73BZ6CdAyMrTk/hYKNj3DuYYEuOaB8bYMOHGKupRNScw90Q5C71tWJc3uE7dIeXRyuwN0xLLq3vDTg==", - "hasInstallScript": true, - "optional": true, - "dependencies": { - "bindings": "^1.5.0", - "nan": "^2.16.0" - }, - "engines": { - "node": ">=0.10.48" + "@aws-sdk/signature-v4-multi-region": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/signature-v4-multi-region/-/signature-v4-multi-region-3.310.0.tgz", + "integrity": "sha512-q8W+RIomTS/q85Ntgks/CoDElwqkC9+4OCicee5YznNHjQ4gtNWhUkYIyIRWRmXa/qx/AUreW9DM8FAecCOdng==", + "requires": { + "@aws-sdk/protocol-http": "3.310.0", + "@aws-sdk/signature-v4": "3.310.0", + "@aws-sdk/types": "3.310.0", + "tslib": "^2.5.0" } }, - "node_modules/uri-js": { - "version": "4.4.1", - "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", - "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", - "dev": true, - "dependencies": { - "punycode": "^2.1.0" + "@aws-sdk/smithy-client": { + "version": "3.325.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/smithy-client/-/smithy-client-3.325.0.tgz", + "integrity": "sha512-sqDFuhjxd8+Q9qI8MmXe/g1/FgoViwetv14K+bpHK7pGlOIvDyT7TboDNClfgqSLdgTDCEaoC3JRSi9Y5RgbmA==", + "requires": { + "@aws-sdk/middleware-stack": "3.325.0", + "@aws-sdk/types": "3.310.0", + "tslib": "^2.5.0" + } + }, + "@aws-sdk/token-providers": { + "version": "3.328.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/token-providers/-/token-providers-3.328.0.tgz", + "integrity": "sha512-AWrRwa0RqSiz9CT3QKuMYuZsRXaeKCp8kMsx1CgrG5VUaag+NhDBBMYVbxgb0SyoqbsGC+wDUXtSCZctrE7Z3Q==", + "requires": { + "@aws-sdk/client-sso-oidc": "3.328.0", + "@aws-sdk/property-provider": "3.310.0", + "@aws-sdk/shared-ini-file-loader": "3.310.0", + "@aws-sdk/types": "3.310.0", + "tslib": "^2.5.0" } }, - "node_modules/uri-js/node_modules/punycode": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.2.0.tgz", - "integrity": "sha512-LN6QV1IJ9ZhxWTNdktaPClrNfp8xdSAYS0Zk2ddX7XsXZAxckMHPCBcHRo0cTcEIgYPRiGEkmji3Idkh2yFtYw==", - "dev": true, - "engines": { - "node": ">=6" + "@aws-sdk/types": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/types/-/types-3.310.0.tgz", + "integrity": "sha512-j8eamQJ7YcIhw7fneUfs8LYl3t01k4uHi4ZDmNRgtbmbmTTG3FZc2MotStZnp3nZB6vLiPF1o5aoJxWVvkzS6A==", + "requires": { + "tslib": "^2.5.0" } }, - "node_modules/url": { - "version": "0.10.3", - "resolved": "https://registry.npmjs.org/url/-/url-0.10.3.tgz", - "integrity": "sha512-hzSUW2q06EqL1gKM/a+obYHLIO6ct2hwPuviqTTOcfFVc61UbfJ2Q32+uGL/HCPxKqrdGB5QUwIe7UqlDgwsOQ==", - "dependencies": { - "punycode": "1.3.2", - "querystring": "0.2.0" + "@aws-sdk/url-parser": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/url-parser/-/url-parser-3.310.0.tgz", + "integrity": "sha512-mCLnCaSB9rQvAgx33u0DujLvr4d5yEm/W5r789GblwwQnlNXedVu50QRizMLTpltYWyAUoXjJgQnJHmJMaKXhw==", + "requires": { + "@aws-sdk/querystring-parser": "3.310.0", + "@aws-sdk/types": "3.310.0", + "tslib": "^2.5.0" } }, - "node_modules/url-join": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/url-join/-/url-join-4.0.1.tgz", - "integrity": "sha512-jk1+QP6ZJqyOiuEI9AEWQfju/nB2Pw466kbA0LEZljHwKeMgd9WrAEgEGxjPDD2+TNbbb37rTyhEfrCXfuKXnA==" + "@aws-sdk/util-arn-parser": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-arn-parser/-/util-arn-parser-3.310.0.tgz", + "integrity": "sha512-jL8509owp/xB9+Or0pvn3Fe+b94qfklc2yPowZZIFAkFcCSIdkIglz18cPDWnYAcy9JGewpMS1COXKIUhZkJsA==", + "requires": { + "tslib": "^2.5.0" + } }, - "node_modules/utf-8-validate": { - "version": "5.0.10", - "resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.10.tgz", - "integrity": "sha512-Z6czzLq4u8fPOyx7TU6X3dvUZVvoJmxSQ+IcrlmagKhilxlhZgxPK6C5Jqbkw1IDUmFTM+cz9QDnnLTwDz/2gQ==", - "hasInstallScript": true, - "optional": true, - "dependencies": { - "node-gyp-build": "^4.3.0" - }, - "engines": { - "node": ">=6.14.2" + "@aws-sdk/util-base64": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-base64/-/util-base64-3.310.0.tgz", + "integrity": "sha512-v3+HBKQvqgdzcbL+pFswlx5HQsd9L6ZTlyPVL2LS9nNXnCcR3XgGz9jRskikRUuUvUXtkSG1J88GAOnJ/apTPg==", + "requires": { + "@aws-sdk/util-buffer-from": "3.310.0", + "tslib": "^2.5.0" } }, - "node_modules/util": { - "version": "0.12.5", - "resolved": "https://registry.npmjs.org/util/-/util-0.12.5.tgz", - "integrity": "sha512-kZf/K6hEIrWHI6XqOFUiiMa+79wE/D8Q+NCNAWclkyg3b4d2k7s0QGepNjiABc+aR3N1PAyHL7p6UcLY6LmrnA==", - "dependencies": { - "inherits": "^2.0.3", - "is-arguments": "^1.0.4", - "is-generator-function": "^1.0.7", - "is-typed-array": "^1.1.3", - "which-typed-array": "^1.1.2" + "@aws-sdk/util-body-length-browser": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-body-length-browser/-/util-body-length-browser-3.310.0.tgz", + "integrity": "sha512-sxsC3lPBGfpHtNTUoGXMQXLwjmR0zVpx0rSvzTPAuoVILVsp5AU/w5FphNPxD5OVIjNbZv9KsKTuvNTiZjDp9g==", + "requires": { + "tslib": "^2.5.0" } }, - "node_modules/util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" + "@aws-sdk/util-body-length-node": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-body-length-node/-/util-body-length-node-3.310.0.tgz", + "integrity": "sha512-2tqGXdyKhyA6w4zz7UPoS8Ip+7sayOg9BwHNidiGm2ikbDxm1YrCfYXvCBdwaJxa4hJfRVz+aL9e+d3GqPI9pQ==", + "requires": { + "tslib": "^2.5.0" + } }, - "node_modules/uuid": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.0.0.tgz", - "integrity": "sha512-jOXGuXZAWdsTH7eZLtyXMqUb9EcWMGZNbL9YcGBJl4MH4nrxHmZJhEHvyLFrkxo+28uLb/NYRcStH48fnD0Vzw==", - "bin": { - "uuid": "dist/bin/uuid" + "@aws-sdk/util-buffer-from": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-buffer-from/-/util-buffer-from-3.310.0.tgz", + "integrity": "sha512-i6LVeXFtGih5Zs8enLrt+ExXY92QV25jtEnTKHsmlFqFAuL3VBeod6boeMXkN2p9lbSVVQ1sAOOYZOHYbYkntw==", + "requires": { + "@aws-sdk/is-array-buffer": "3.310.0", + "tslib": "^2.5.0" } }, - "node_modules/v8-compile-cache-lib": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", - "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", - "dev": true + "@aws-sdk/util-config-provider": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-config-provider/-/util-config-provider-3.310.0.tgz", + "integrity": "sha512-xIBaYo8dwiojCw8vnUcIL4Z5tyfb1v3yjqyJKJWV/dqKUFOOS0U591plmXbM+M/QkXyML3ypon1f8+BoaDExrg==", + "requires": { + "tslib": "^2.5.0" + } }, - "node_modules/vscode-oniguruma": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/vscode-oniguruma/-/vscode-oniguruma-1.7.0.tgz", - "integrity": "sha512-L9WMGRfrjOhgHSdOYgCt/yRMsXzLDJSL7BPrOZt73gU0iWO4mpqzqQzOz5srxqTvMBaR0XZTSrVWo4j55Rc6cA==", - "peer": true + "@aws-sdk/util-defaults-mode-browser": { + "version": "3.325.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-defaults-mode-browser/-/util-defaults-mode-browser-3.325.0.tgz", + "integrity": "sha512-gcowpXTo8E8N3jxD2KW+csiicJ7HPkhWnpL925xgwe0oq091OpATsKFrBOL18h72VfRWf4FAsR9lVwxSQ78zSA==", + "requires": { + "@aws-sdk/property-provider": "3.310.0", + "@aws-sdk/types": "3.310.0", + "bowser": "^2.11.0", + "tslib": "^2.5.0" + } }, - "node_modules/vscode-textmate": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/vscode-textmate/-/vscode-textmate-5.2.0.tgz", - "integrity": "sha512-Uw5ooOQxRASHgu6C7GVvUxisKXfSgW4oFlO+aa+PAkgmH89O3CXxEEzNRNtHSqtXFTl0nAC1uYj0GMSH27uwtQ==", - "peer": true + "@aws-sdk/util-defaults-mode-node": { + "version": "3.325.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-defaults-mode-node/-/util-defaults-mode-node-3.325.0.tgz", + "integrity": "sha512-/5uoOrgNxoUxv3AwsdXjMA3f6KJA6fi69otA0RiINjilCdcbOxq5GI11AFEyRio/+e+imriX4+UYjsguUR+f4g==", + "requires": { + "@aws-sdk/config-resolver": "3.310.0", + "@aws-sdk/credential-provider-imds": "3.310.0", + "@aws-sdk/node-config-provider": "3.310.0", + "@aws-sdk/property-provider": "3.310.0", + "@aws-sdk/types": "3.310.0", + "tslib": "^2.5.0" + } }, - "node_modules/webidl-conversions": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", - "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" + "@aws-sdk/util-endpoints": { + "version": "3.327.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-endpoints/-/util-endpoints-3.327.0.tgz", + "integrity": "sha512-2+2jTfBzhXsfpOci61gzaoBUVdGhFWja7k5cLAfOaRROkK+m+Zv532+m3cCQZjBXJ6pJ952MbiAroRSjFq0/SQ==", + "requires": { + "@aws-sdk/types": "3.310.0", + "tslib": "^2.5.0" + } }, - "node_modules/whatwg-fetch": { - "version": "3.6.2", - "resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-3.6.2.tgz", - "integrity": "sha512-bJlen0FcuU/0EMLrdbJ7zOnW6ITZLrZMIarMUVmdKtsGvZna8vxKYaexICWPfZ8qwf9fzNq+UEIZrnSaApt6RA==" + "@aws-sdk/util-hex-encoding": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-hex-encoding/-/util-hex-encoding-3.310.0.tgz", + "integrity": "sha512-sVN7mcCCDSJ67pI1ZMtk84SKGqyix6/0A1Ab163YKn+lFBQRMKexleZzpYzNGxYzmQS6VanP/cfU7NiLQOaSfA==", + "requires": { + "tslib": "^2.5.0" + } }, - "node_modules/whatwg-url": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", - "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", - "dependencies": { - "tr46": "~0.0.3", - "webidl-conversions": "^3.0.0" + "@aws-sdk/util-locate-window": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-locate-window/-/util-locate-window-3.310.0.tgz", + "integrity": "sha512-qo2t/vBTnoXpjKxlsC2e1gBrRm80M3bId27r0BRB2VniSSe7bL1mmzM+/HFtujm0iAxtPM+aLEflLJlJeDPg0w==", + "requires": { + "tslib": "^2.5.0" } }, - "node_modules/which": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "dev": true, - "dependencies": { - "isexe": "^2.0.0" - }, - "bin": { - "node-which": "bin/node-which" - }, - "engines": { - "node": ">= 8" + "@aws-sdk/util-middleware": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-middleware/-/util-middleware-3.310.0.tgz", + "integrity": "sha512-FTSUKL/eRb9X6uEZClrTe27QFXUNNp7fxYrPndZwk1hlaOP5ix+MIHBcI7pIiiY/JPfOUmPyZOu+HetlFXjWog==", + "requires": { + "tslib": "^2.5.0" } }, - "node_modules/which-typed-array": { - "version": "1.1.9", - "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.9.tgz", - "integrity": "sha512-w9c4xkx6mPidwp7180ckYWfMmvxpjlZuIudNtDf4N/tTAUB8VJbX25qZoAsrtGuYNnGw3pa0AXgbGKRB8/EceA==", - "dependencies": { - "available-typed-arrays": "^1.0.5", - "call-bind": "^1.0.2", - "for-each": "^0.3.3", - "gopd": "^1.0.1", - "has-tostringtag": "^1.0.0", - "is-typed-array": "^1.1.10" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "@aws-sdk/util-retry": { + "version": "3.327.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-retry/-/util-retry-3.327.0.tgz", + "integrity": "sha512-y15NLGTAT2vaLzA8klJ6Bo8NGjVAa3/njqc4iCbta/3GqKpQU0zbvw3Y5aWyHp8BhV4DSUTp088jWjaoZlSqgw==", + "requires": { + "@aws-sdk/service-error-classification": "3.327.0", + "tslib": "^2.5.0" } }, - "node_modules/word-wrap": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", - "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", - "dev": true, - "engines": { - "node": ">=0.10.0" + "@aws-sdk/util-stream-browser": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-stream-browser/-/util-stream-browser-3.310.0.tgz", + "integrity": "sha512-bysXZHwFwvbqOTCScCdCnoLk1K3GCo0HRIYEZuL7O7MHrQmfaYRXcaft/p22+GUv9VeFXS/eJJZ5r4u32az94w==", + "requires": { + "@aws-sdk/fetch-http-handler": "3.310.0", + "@aws-sdk/types": "3.310.0", + "@aws-sdk/util-base64": "3.310.0", + "@aws-sdk/util-hex-encoding": "3.310.0", + "@aws-sdk/util-utf8": "3.310.0", + "tslib": "^2.5.0" } }, - "node_modules/wordwrap": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", - "integrity": "sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q==", - "peer": true + "@aws-sdk/util-stream-node": { + "version": "3.328.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-stream-node/-/util-stream-node-3.328.0.tgz", + "integrity": "sha512-9h8oji5OTmatXMfPIasAapL59QDO7TR0J/B5Y3ERwGxy2U373LEy8Uvs+mbPIIQV1ztCLwHWDxKQoTUj4hLxoQ==", + "requires": { + "@aws-sdk/node-http-handler": "3.328.0", + "@aws-sdk/types": "3.310.0", + "@aws-sdk/util-buffer-from": "3.310.0", + "tslib": "^2.5.0" + } }, - "node_modules/wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" + "@aws-sdk/util-uri-escape": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-uri-escape/-/util-uri-escape-3.310.0.tgz", + "integrity": "sha512-drzt+aB2qo2LgtDoiy/3sVG8w63cgLkqFIa2NFlGpUgHFWTXkqtbgf4L5QdjRGKWhmZsnqkbtL7vkSWEcYDJ4Q==", + "requires": { + "tslib": "^2.5.0" + } }, - "node_modules/ws": { - "version": "7.4.6", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.4.6.tgz", - "integrity": "sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A==", - "engines": { - "node": ">=8.3.0" - }, - "peerDependencies": { - "bufferutil": "^4.0.1", - "utf-8-validate": "^5.0.2" - }, - "peerDependenciesMeta": { - "bufferutil": { - "optional": true - }, - "utf-8-validate": { - "optional": true - } + "@aws-sdk/util-user-agent-browser": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-user-agent-browser/-/util-user-agent-browser-3.310.0.tgz", + "integrity": "sha512-yU/4QnHHuQ5z3vsUqMQVfYLbZGYwpYblPiuZx4Zo9+x0PBkNjYMqctdDcrpoH9Z2xZiDN16AmQGK1tix117ZKw==", + "requires": { + "@aws-sdk/types": "3.310.0", + "bowser": "^2.11.0", + "tslib": "^2.5.0" } }, - "node_modules/xhr2-cookies": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/xhr2-cookies/-/xhr2-cookies-1.1.0.tgz", - "integrity": "sha512-hjXUA6q+jl/bd8ADHcVfFsSPIf+tyLIjuO9TwJC9WI6JP2zKcS7C+p56I9kCLLsaCiNT035iYvEUUzdEFj/8+g==", - "peer": true, - "dependencies": { - "cookiejar": "^2.1.1" + "@aws-sdk/util-user-agent-node": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-user-agent-node/-/util-user-agent-node-3.310.0.tgz", + "integrity": "sha512-Ra3pEl+Gn2BpeE7KiDGpi4zj7WJXZA5GXnGo3mjbi9+Y3zrbuhJAbdZO3mO/o7xDgMC6ph4xCTbaSGzU6b6EDg==", + "requires": { + "@aws-sdk/node-config-provider": "3.310.0", + "@aws-sdk/types": "3.310.0", + "tslib": "^2.5.0" } }, - "node_modules/xml2js": { - "version": "0.4.19", - "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.19.tgz", - "integrity": "sha512-esZnJZJOiJR9wWKMyuvSE1y6Dq5LCuJanqhxslH2bxM6duahNZ+HMpCLhBQGZkbX6xRf8x1Y2eJlgt2q3qo49Q==", - "dependencies": { - "sax": ">=0.6.0", - "xmlbuilder": "~9.0.1" + "@aws-sdk/util-utf8": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-utf8/-/util-utf8-3.310.0.tgz", + "integrity": "sha512-DnLfFT8uCO22uOJc0pt0DsSNau1GTisngBCDw8jQuWT5CqogMJu4b/uXmwEqfj8B3GX6Xsz8zOd6JpRlPftQoA==", + "requires": { + "@aws-sdk/util-buffer-from": "3.310.0", + "tslib": "^2.5.0" } }, - "node_modules/xmlbuilder": { - "version": "9.0.7", - "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-9.0.7.tgz", - "integrity": "sha512-7YXTQc3P2l9+0rjaUbLwMKRhtmwg1M1eDf6nag7urC7pIPYLD9W/jmzQ4ptRSUbodw5S0jfoGTflLemQibSpeQ==", - "engines": { - "node": ">=4.0" + "@aws-sdk/util-utf8-browser": { + "version": "3.259.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-utf8-browser/-/util-utf8-browser-3.259.0.tgz", + "integrity": "sha512-UvFa/vR+e19XookZF8RzFZBrw2EUkQWxiBW0yYQAhvk3C+QVGl0H3ouca8LDBlBfQKXwmW3huo/59H8rwb1wJw==", + "requires": { + "tslib": "^2.3.1" } }, - "node_modules/yn": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", - "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", - "dev": true, - "engines": { - "node": ">=6" + "@aws-sdk/util-waiter": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-waiter/-/util-waiter-3.310.0.tgz", + "integrity": "sha512-AV5j3guH/Y4REu+Qh3eXQU9igljHuU4XjX2sADAgf54C0kkhcCCkkiuzk3IsX089nyJCqIcj5idbjdvpnH88Vw==", + "requires": { + "@aws-sdk/abort-controller": "3.310.0", + "@aws-sdk/types": "3.310.0", + "tslib": "^2.5.0" } }, - "node_modules/yocto-queue": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", - "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "@aws-sdk/xml-builder": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/xml-builder/-/xml-builder-3.310.0.tgz", + "integrity": "sha512-TqELu4mOuSIKQCqj63fGVs86Yh+vBx5nHRpWKNUNhB2nPTpfbziTs5c1X358be3peVWA4wPxW7Nt53KIg1tnNw==", + "requires": { + "tslib": "^2.5.0" } - } - }, - "dependencies": { + }, "@babel/code-frame": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.18.6.tgz", - "integrity": "sha512-TDCmlK5eOvH+eH7cdAFlNXeVJqWIQ7gW9tY1GJIpUtFb6CmjVyq2VM3u71bOyR8CRihcCgMUYoDNyLXao3+70Q==", + "version": "7.21.4", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.21.4.tgz", + "integrity": "sha512-LYvhNKfwWSPpocw8GI7gpK2nq3HSDuEPC/uSYaALSJu9xjsalaaYFOq0Pwt5KmVqwEbZlDu81aLXwBOmD/Fv9g==", "peer": true, "requires": { "@babel/highlight": "^7.18.6" @@ -5449,13 +9838,92 @@ } }, "@babel/runtime": { - "version": "7.20.7", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.20.7.tgz", - "integrity": "sha512-UF0tvkUtxwAgZ5W/KrkHf0Rn0fdnLDU9ScxBrEVNUprE/MzirjK4MJUX1/BVDv00Sv8cljtukVK1aky++X1SjQ==", + "version": "7.21.5", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.21.5.tgz", + "integrity": "sha512-8jI69toZqqcsnqGGqwGS4Qb1VwLOEp4hz+CXPywcvjs60u3B4Pom/U/7rm4W8tMOYEB+E9wgD0mW1l3r8qlI9Q==", "requires": { "regenerator-runtime": "^0.13.11" } }, + "@bundlr-network/client": { + "version": "0.7.17", + "resolved": "https://registry.npmjs.org/@bundlr-network/client/-/client-0.7.17.tgz", + "integrity": "sha512-1qTDrwgmgeh0pO24JbeGt2W8GlpWYkVnQ8AhEZ02Lm00J7RALSyma3C5pNlKuvAQBczL1r9KhLr9KHK1og3J0g==", + "requires": { + "@solana/wallet-adapter-base": "^0.9.2", + "@solana/web3.js": "^1.36.0", + "@supercharge/promise-pool": "^2.1.0", + "algosdk": "^1.13.1", + "arbundles": "^0.6.20", + "arweave": "^1.11.4", + "async-retry": "^1.3.3", + "axios": "^0.25.0", + "base64url": "^3.0.1", + "bignumber.js": "^9.0.1", + "bs58": "^4.0.1", + "commander": "^8.2.0", + "csv": "^6.0.5", + "ethers": "^5.5.1", + "inquirer": "^8.2.0", + "js-sha256": "^0.9.0", + "mime-types": "^2.1.34", + "near-api-js": "^0.44.2", + "near-seed-phrase": "^0.2.0" + }, + "dependencies": { + "axios": { + "version": "0.25.0", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.25.0.tgz", + "integrity": "sha512-cD8FOb0tRH3uuEe6+evtAbgJtfxr7ly3fQjYcMcuPlgkwVS9xboaVIpcDV+cYQe+yGykgwZCs1pzjntcGa6l5g==", + "requires": { + "follow-redirects": "^1.14.7" + } + }, + "commander": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-8.3.0.tgz", + "integrity": "sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==" + } + } + }, + "@coral-xyz/anchor": { + "version": "0.26.0", + "resolved": "https://registry.npmjs.org/@coral-xyz/anchor/-/anchor-0.26.0.tgz", + "integrity": "sha512-PxRl+wu5YyptWiR9F2MBHOLLibm87Z4IMUBPreX+DYBtPM+xggvcPi0KAN7+kIL4IrIhXI8ma5V0MCXxSN1pHg==", + "requires": { + "@coral-xyz/borsh": "^0.26.0", + "@solana/web3.js": "^1.68.0", + "base64-js": "^1.5.1", + "bn.js": "^5.1.2", + "bs58": "^4.0.1", + "buffer-layout": "^1.2.2", + "camelcase": "^6.3.0", + "cross-fetch": "^3.1.5", + "crypto-hash": "^1.3.0", + "eventemitter3": "^4.0.7", + "js-sha256": "^0.9.0", + "pako": "^2.0.3", + "snake-case": "^3.0.4", + "superstruct": "^0.15.4", + "toml": "^3.0.0" + }, + "dependencies": { + "camelcase": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", + "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==" + } + } + }, + "@coral-xyz/borsh": { + "version": "0.26.0", + "resolved": "https://registry.npmjs.org/@coral-xyz/borsh/-/borsh-0.26.0.tgz", + "integrity": "sha512-uCZ0xus0CszQPHYfWAqKS5swS1UxvePu83oOF+TWpUkedsNlg6p2p4azxZNSSqwXb9uXMFgxhuMBX9r3Xoi0vQ==", + "requires": { + "bn.js": "^5.1.2", + "buffer-layout": "^1.2.0" + } + }, "@cspotcode/source-map-support": { "version": "0.8.1", "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", @@ -5466,24 +9934,39 @@ } }, "@defillama/sdk": { - "version": "4.0.10", - "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.10.tgz", - "integrity": "sha512-d+xTcUvuar3WVSmouJdsVGkGjZc44/tW/REQCjSKn0wplB0ugEjGWdZ/LbbxpCbqRiifwkp2IoFrf1DpNVjuyQ==", + "version": "4.0.12", + "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.12.tgz", + "integrity": "sha512-UeuMkrbz9zS2ze4Q5w2gohUapvRc3NupSVgBAr2SMv1p7W7omgQ6AIuvzcw3Q4sv/T/JhP9wWUPMK56VzIN74g==", "requires": { "@supercharge/promise-pool": "^2.1.0", "ethers": "^5.4.5", "node-fetch": "^2.6.7" } }, + "@eslint-community/eslint-utils": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", + "integrity": "sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==", + "dev": true, + "requires": { + "eslint-visitor-keys": "^3.3.0" + } + }, + "@eslint-community/regexpp": { + "version": "4.5.1", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.5.1.tgz", + "integrity": "sha512-Z5ba73P98O1KUYCCJTUeVpja9RcGoMdncZ6T49FCUl2lN38JtCJ+3WgIDBv0AuY4WChU5PmtJmOCTlN6FZTFKQ==", + "dev": true + }, "@eslint/eslintrc": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.4.1.tgz", - "integrity": "sha512-XXrH9Uarn0stsyldqDYq8r++mROmWRI1xKMXa640Bb//SY1+ECYX6VzT6Lcx5frD0V30XieqJ0oX9I2Xj5aoMA==", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.0.3.tgz", + "integrity": "sha512-+5gy6OQfk+xx3q0d6jGZZC3f3KzAkXc/IanVxd1is/VIIziRqqt3ongQz0FiTUXqTk0c7aDB3OaFuKnuSoJicQ==", "dev": true, "requires": { "ajv": "^6.12.4", "debug": "^4.3.2", - "espree": "^9.4.0", + "espree": "^9.5.2", "globals": "^13.19.0", "ignore": "^5.2.0", "import-fresh": "^3.2.1", @@ -5492,6 +9975,12 @@ "strip-json-comments": "^3.1.1" } }, + "@eslint/js": { + "version": "8.40.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.40.0.tgz", + "integrity": "sha512-ElyB54bJIhXQYVKjDSvCkPO1iU1tSAeVQJbllWJq1XQSmmA4dgFk8CbiBGpiOPxleE48vDogxCtmMYku4HSVLA==", + "dev": true + }, "@ethersproject/abi": { "version": "5.7.0", "resolved": "https://registry.npmjs.org/@ethersproject/abi/-/abi-5.7.0.tgz", @@ -5725,6 +10214,14 @@ "@ethersproject/web": "^5.7.0", "bech32": "1.1.4", "ws": "7.4.6" + }, + "dependencies": { + "ws": { + "version": "7.4.6", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.4.6.tgz", + "integrity": "sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A==", + "requires": {} + } } }, "@ethersproject/random": { @@ -5863,6 +10360,19 @@ "@ethersproject/strings": "^5.7.0" } }, + "@hapi/hoek": { + "version": "9.3.0", + "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.3.0.tgz", + "integrity": "sha512-/c6rf4UJlmHlC9b5BaNvzAcFv7HZ2QHaV0D4/HNlBdvFnvQq8RI4kYdhyPCl7Xj+oWvTWQ8ujhqS53LIgAe6KQ==" + }, + "@hapi/topo": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/@hapi/topo/-/topo-5.1.0.tgz", + "integrity": "sha512-foQZKJig7Ob0BMAYBfcJk8d77QtOe7Wo4ox7ff1lQYoNNAb6jwcY1ncdoy2e9wQZzvNy7ODZCYJkK8kzmcAnAg==", + "requires": { + "@hapi/hoek": "^9.0.0" + } + }, "@hover-labs/kolibri-js": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/@hover-labs/kolibri-js/-/kolibri-js-4.1.3.tgz", @@ -5945,6 +10455,19 @@ "requires": { "follow-redirects": "^1.14.0" } + }, + "rxjs": { + "version": "6.6.7", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.7.tgz", + "integrity": "sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ==", + "requires": { + "tslib": "^1.9.0" + } + }, + "tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" } } }, @@ -5985,15 +10508,15 @@ } }, "@jridgewell/resolve-uri": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz", - "integrity": "sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz", + "integrity": "sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==", "dev": true }, "@jridgewell/sourcemap-codec": { - "version": "1.4.14", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz", - "integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==", + "version": "1.4.15", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", + "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==", "dev": true }, "@jridgewell/trace-mapping": { @@ -6039,6 +10562,14 @@ "toml": "^3.0.0" }, "dependencies": { + "base-x": { + "version": "3.0.9", + "resolved": "https://registry.npmjs.org/base-x/-/base-x-3.0.9.tgz", + "integrity": "sha512-H7JU6iBHTal1gp56aKoaa//YUxEaAOUiydvrV/pILqIHXTtqxSkATOnDA2u+jZ/61sD+L/412+7kzXRtWukhpQ==", + "requires": { + "safe-buffer": "^5.0.1" + } + }, "bs58": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/bs58/-/bs58-4.0.1.tgz", @@ -6049,6 +10580,11 @@ } } }, + "base-x": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/base-x/-/base-x-4.0.0.tgz", + "integrity": "sha512-FuwxlW4H5kh37X/oW59pwTzzTKRzfrrQwhmyspRM7swOEZcHtDZSCt45U6oKgtuFE+WYPblePMVIPR4RZrh/hw==" + }, "borsh": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/borsh/-/borsh-0.6.0.tgz", @@ -6059,6 +10595,14 @@ "text-encoding-utf-8": "^1.0.2" }, "dependencies": { + "base-x": { + "version": "3.0.9", + "resolved": "https://registry.npmjs.org/base-x/-/base-x-3.0.9.tgz", + "integrity": "sha512-H7JU6iBHTal1gp56aKoaa//YUxEaAOUiydvrV/pILqIHXTtqxSkATOnDA2u+jZ/61sD+L/412+7kzXRtWukhpQ==", + "requires": { + "safe-buffer": "^5.0.1" + } + }, "bs58": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/bs58/-/bs58-4.0.1.tgz", @@ -6075,14 +10619,250 @@ "integrity": "sha512-r+ihvQJvahgYT50JD05dyJNKlmmSlMoOGwn1lCcEzanPglg7TxYjioQUYehQ9mAR/+hOSd2jRc/Z2y5UxBymvQ==", "requires": { "base-x": "^4.0.0" + } + } + } + }, + "@metaplex-foundation/beet": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/@metaplex-foundation/beet/-/beet-0.7.1.tgz", + "integrity": "sha512-hNCEnS2WyCiYyko82rwuISsBY3KYpe828ubsd2ckeqZr7tl0WVLivGkoyA/qdiaaHEBGdGl71OpfWa2rqL3DiA==", + "requires": { + "ansicolors": "^0.3.2", + "bn.js": "^5.2.0", + "debug": "^4.3.3" + } + }, + "@metaplex-foundation/beet-solana": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/@metaplex-foundation/beet-solana/-/beet-solana-0.3.1.tgz", + "integrity": "sha512-tgyEl6dvtLln8XX81JyBvWjIiEcjTkUwZbrM5dIobTmoqMuGewSyk9CClno8qsMsFdB5T3jC91Rjeqmu/6xk2g==", + "requires": { + "@metaplex-foundation/beet": ">=0.1.0", + "@solana/web3.js": "^1.56.2", + "bs58": "^5.0.0", + "debug": "^4.3.4" + }, + "dependencies": { + "base-x": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/base-x/-/base-x-4.0.0.tgz", + "integrity": "sha512-FuwxlW4H5kh37X/oW59pwTzzTKRzfrrQwhmyspRM7swOEZcHtDZSCt45U6oKgtuFE+WYPblePMVIPR4RZrh/hw==" + }, + "bs58": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/bs58/-/bs58-5.0.0.tgz", + "integrity": "sha512-r+ihvQJvahgYT50JD05dyJNKlmmSlMoOGwn1lCcEzanPglg7TxYjioQUYehQ9mAR/+hOSd2jRc/Z2y5UxBymvQ==", + "requires": { + "base-x": "^4.0.0" + } + } + } + }, + "@metaplex-foundation/cusper": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/@metaplex-foundation/cusper/-/cusper-0.0.2.tgz", + "integrity": "sha512-S9RulC2fFCFOQraz61bij+5YCHhSO9llJegK8c8Y6731fSi6snUSQJdCUqYS8AIgR0TKbQvdvgSyIIdbDFZbBA==" + }, + "@metaplex-foundation/js": { + "version": "0.11.7", + "resolved": "https://registry.npmjs.org/@metaplex-foundation/js/-/js-0.11.7.tgz", + "integrity": "sha512-zL3Ac++8lUOoKjjhDArdNSimvVYcOqg4uhxfBVRKLV6H8q6E/sOepXuzYSLXxzYWdvapYWEPKFdEDFluYzk7DA==", + "requires": { + "@aws-sdk/client-s3": "^3.54.1", + "@bundlr-network/client": "^0.7.14", + "@metaplex-foundation/beet": "^0.2.0", + "@metaplex-foundation/beet-solana": "^0.1.1", + "@metaplex-foundation/mpl-auction-house": "^2.0.0", + "@metaplex-foundation/mpl-candy-machine": "^4.2.0", + "@metaplex-foundation/mpl-token-metadata": "^2.1.2", + "@solana/spl-token": "^0.2.0", + "@solana/web3.js": "^1.44.0", + "abort-controller": "^3.0.0", + "bignumber.js": "^9.0.2", + "bn.js": "^5.2.0", + "bs58": "^5.0.0", + "buffer": "^6.0.3", + "cross-fetch": "^3.1.5", + "debug": "^4.3.4", + "eventemitter3": "^4.0.7", + "lodash.clonedeep": "^4.5.0", + "mime": "^3.0.0", + "tweetnacl": "^1.0.3" + }, + "dependencies": { + "@metaplex-foundation/beet": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/@metaplex-foundation/beet/-/beet-0.2.0.tgz", + "integrity": "sha512-H570hkJxmx/FxET1OggPPLkPL7psYQa71rNI9NJjYRM8WXdrEvmI/IRIEUW2KR6RqwWWN3FvlRHnKoQUV/lQtA==", + "requires": { + "ansicolors": "^0.3.2", + "bn.js": "^5.2.0", + "debug": "^4.3.3" + } + }, + "@metaplex-foundation/beet-solana": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/@metaplex-foundation/beet-solana/-/beet-solana-0.1.1.tgz", + "integrity": "sha512-QV2DbxjaJWLkMvn12OC09g+r7a6R0uNwf8msYuOUSw4cG7amXzvFb7s0bh4IxY3Rk8/0ma0PfKi/FEdC7Hi4Pg==", + "requires": { + "@metaplex-foundation/beet": ">=0.1.0", + "@solana/web3.js": "^1.31.0" }, "dependencies": { - "base-x": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/base-x/-/base-x-4.0.0.tgz", - "integrity": "sha512-FuwxlW4H5kh37X/oW59pwTzzTKRzfrrQwhmyspRM7swOEZcHtDZSCt45U6oKgtuFE+WYPblePMVIPR4RZrh/hw==" + "@metaplex-foundation/beet": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/@metaplex-foundation/beet/-/beet-0.7.1.tgz", + "integrity": "sha512-hNCEnS2WyCiYyko82rwuISsBY3KYpe828ubsd2ckeqZr7tl0WVLivGkoyA/qdiaaHEBGdGl71OpfWa2rqL3DiA==", + "requires": { + "ansicolors": "^0.3.2", + "bn.js": "^5.2.0", + "debug": "^4.3.3" + } } } + }, + "@solana/spl-token": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/@solana/spl-token/-/spl-token-0.2.0.tgz", + "integrity": "sha512-RWcn31OXtdqIxmkzQfB2R+WpsJOVS6rKuvpxJFjvik2LyODd+WN58ZP3Rpjpro03fscGAkzlFuP3r42doRJgyQ==", + "requires": { + "@solana/buffer-layout": "^4.0.0", + "@solana/buffer-layout-utils": "^0.2.0", + "@solana/web3.js": "^1.32.0", + "start-server-and-test": "^1.14.0" + } + }, + "base-x": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/base-x/-/base-x-4.0.0.tgz", + "integrity": "sha512-FuwxlW4H5kh37X/oW59pwTzzTKRzfrrQwhmyspRM7swOEZcHtDZSCt45U6oKgtuFE+WYPblePMVIPR4RZrh/hw==" + }, + "bs58": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/bs58/-/bs58-5.0.0.tgz", + "integrity": "sha512-r+ihvQJvahgYT50JD05dyJNKlmmSlMoOGwn1lCcEzanPglg7TxYjioQUYehQ9mAR/+hOSd2jRc/Z2y5UxBymvQ==", + "requires": { + "base-x": "^4.0.0" + } + } + } + }, + "@metaplex-foundation/mpl-auction-house": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/@metaplex-foundation/mpl-auction-house/-/mpl-auction-house-2.5.1.tgz", + "integrity": "sha512-O+IAdYVaoOvgACB8pm+1lF5BNEjl0COkqny2Ho8KQZwka6aC/vHbZ239yRwAMtJhf5992BPFdT4oifjyE0O+Mw==", + "requires": { + "@metaplex-foundation/beet": "^0.6.1", + "@metaplex-foundation/beet-solana": "^0.3.1", + "@metaplex-foundation/cusper": "^0.0.2", + "@solana/spl-token": "^0.3.5", + "@solana/web3.js": "^1.56.2", + "bn.js": "^5.2.0" + }, + "dependencies": { + "@metaplex-foundation/beet": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/@metaplex-foundation/beet/-/beet-0.6.1.tgz", + "integrity": "sha512-OYgnijLFzw0cdUlRKH5POp0unQECPOW9muJ2X3QIVyak5G6I6l/rKo72sICgPLIFKdmsi2jmnkuLY7wp14iXdw==", + "requires": { + "ansicolors": "^0.3.2", + "bn.js": "^5.2.0", + "debug": "^4.3.3" + } + }, + "@solana/spl-token": { + "version": "0.3.7", + "resolved": "https://registry.npmjs.org/@solana/spl-token/-/spl-token-0.3.7.tgz", + "integrity": "sha512-bKGxWTtIw6VDdCBngjtsGlKGLSmiu/8ghSt/IOYJV24BsymRbgq7r12GToeetpxmPaZYLddKwAz7+EwprLfkfg==", + "requires": { + "@solana/buffer-layout": "^4.0.0", + "@solana/buffer-layout-utils": "^0.2.0", + "buffer": "^6.0.3" + } + } + } + }, + "@metaplex-foundation/mpl-candy-machine": { + "version": "4.7.1", + "resolved": "https://registry.npmjs.org/@metaplex-foundation/mpl-candy-machine/-/mpl-candy-machine-4.7.1.tgz", + "integrity": "sha512-tBNRAfBE/rYy9pe2aJD4gTFw+pgQ11o3AJjoYGB4+05ow0VjJMSt6kQGzHm2LRPgdLY4diKAq8qHvgsbV5ikNQ==", + "requires": { + "@metaplex-foundation/beet": "^0.4.0", + "@metaplex-foundation/beet-solana": "^0.3.0", + "@metaplex-foundation/cusper": "^0.0.2", + "@metaplex-foundation/mpl-core": "^0.6.1", + "@solana/web3.js": "^1.35.1" + }, + "dependencies": { + "@metaplex-foundation/beet": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/@metaplex-foundation/beet/-/beet-0.4.0.tgz", + "integrity": "sha512-2OAKJnLatCc3mBXNL0QmWVQKAWK2C7XDfepgL0p/9+8oSx4bmRAFHFqptl1A/C0U5O3dxGwKfmKluW161OVGcA==", + "requires": { + "ansicolors": "^0.3.2", + "bn.js": "^5.2.0", + "debug": "^4.3.3" + } + } + } + }, + "@metaplex-foundation/mpl-core": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/@metaplex-foundation/mpl-core/-/mpl-core-0.6.1.tgz", + "integrity": "sha512-6R4HkfAqU2EUakNbVLcCmka0YuQTLGTbHJ62ig765+NRWuB2HNGUQ1HfHcRsGnyxhlCvwKK79JE01XUjFE+dzw==", + "requires": { + "@solana/web3.js": "^1.35.1", + "bs58": "^4.0.1" + } + }, + "@metaplex-foundation/mpl-token-metadata": { + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/@metaplex-foundation/mpl-token-metadata/-/mpl-token-metadata-2.11.0.tgz", + "integrity": "sha512-pwuufw3QuSk0Z/oOmB7gpnlxiIR0bc5RVHLEpwOJ5/4KHEq7PIFxVsNcwDFzLoZJWTcQdvwZTy0d1J/qJMoxxg==", + "requires": { + "@metaplex-foundation/beet": "^0.7.1", + "@metaplex-foundation/beet-solana": "^0.4.0", + "@metaplex-foundation/cusper": "^0.0.2", + "@solana/spl-token": "^0.3.6", + "@solana/web3.js": "^1.66.2", + "bn.js": "^5.2.0", + "debug": "^4.3.4" + }, + "dependencies": { + "@metaplex-foundation/beet-solana": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/@metaplex-foundation/beet-solana/-/beet-solana-0.4.0.tgz", + "integrity": "sha512-B1L94N3ZGMo53b0uOSoznbuM5GBNJ8LwSeznxBxJ+OThvfHQ4B5oMUqb+0zdLRfkKGS7Q6tpHK9P+QK0j3w2cQ==", + "requires": { + "@metaplex-foundation/beet": ">=0.1.0", + "@solana/web3.js": "^1.56.2", + "bs58": "^5.0.0", + "debug": "^4.3.4" + } + }, + "@solana/spl-token": { + "version": "0.3.7", + "resolved": "https://registry.npmjs.org/@solana/spl-token/-/spl-token-0.3.7.tgz", + "integrity": "sha512-bKGxWTtIw6VDdCBngjtsGlKGLSmiu/8ghSt/IOYJV24BsymRbgq7r12GToeetpxmPaZYLddKwAz7+EwprLfkfg==", + "requires": { + "@solana/buffer-layout": "^4.0.0", + "@solana/buffer-layout-utils": "^0.2.0", + "buffer": "^6.0.3" + } + }, + "base-x": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/base-x/-/base-x-4.0.0.tgz", + "integrity": "sha512-FuwxlW4H5kh37X/oW59pwTzzTKRzfrrQwhmyspRM7swOEZcHtDZSCt45U6oKgtuFE+WYPblePMVIPR4RZrh/hw==" + }, + "bs58": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/bs58/-/bs58-5.0.0.tgz", + "integrity": "sha512-r+ihvQJvahgYT50JD05dyJNKlmmSlMoOGwn1lCcEzanPglg7TxYjioQUYehQ9mAR/+hOSd2jRc/Z2y5UxBymvQ==", + "requires": { + "base-x": "^4.0.0" + } } } }, @@ -6121,19 +10901,19 @@ } }, "@noble/ed25519": { - "version": "1.7.1", - "resolved": "https://registry.npmjs.org/@noble/ed25519/-/ed25519-1.7.1.tgz", - "integrity": "sha512-Rk4SkJFaXZiznFyC/t77Q0NKS4FL7TLJJsVG2V2oiEq3kJVeTdxysEe/yRWSpnWMe808XRDJ+VFh5pt/FN5plw==" + "version": "1.7.3", + "resolved": "https://registry.npmjs.org/@noble/ed25519/-/ed25519-1.7.3.tgz", + "integrity": "sha512-iR8GBkDt0Q3GyaVcIu7mSsVIqnFbkbRzGLWlvhwunacoLwt4J3swfKhfaM6rN6WY+TBGoYT1GtT1mIh2/jGbRQ==" }, "@noble/hashes": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.1.5.tgz", - "integrity": "sha512-LTMZiiLc+V4v1Yi16TD6aX2gmtKszNye0pQgbaLqkvhIqP7nVsSaJsWloGQjJfJ8offaoP5GtX3yY5swbcJxxQ==" + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.2.0.tgz", + "integrity": "sha512-FZfhjEDbT5GRswV3C6uvLPHMiVD6lQBmpoX5+eSiPaMTXte/IKqI5dykDxzZB/WBeK/CDuQRBWarPdi3FNY2zQ==" }, "@noble/secp256k1": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/@noble/secp256k1/-/secp256k1-1.7.0.tgz", - "integrity": "sha512-kbacwGSsH/CTout0ZnZWxnW1B+jH/7r/WAAKLBtrRJ/+CUH7lgmQzl3GTrQua3SGKWNSDsS6lmjnDpIJ5Dxyaw==" + "version": "1.7.1", + "resolved": "https://registry.npmjs.org/@noble/secp256k1/-/secp256k1-1.7.1.tgz", + "integrity": "sha512-hOUk6AyBFmqVrv7k5WAw/LpszxVbj9gGN4JRkIX52fdFAj1UA61KXmZDvqVEm+pOyec3+fIeZB02LYa/pWOArw==" }, "@nodelib/fs.scandir": { "version": "2.1.5", @@ -6228,66 +11008,87 @@ } }, "@pythnetwork/client": { - "version": "2.8.0", - "resolved": "https://registry.npmjs.org/@pythnetwork/client/-/client-2.8.0.tgz", - "integrity": "sha512-YqqZSDDsEApC/F4H5ejcl8OCr7gsWv0noTK8YABT8pCtFRTQxXBP0r2S8KQMaIw1x97Mue/jkYybdMeFQzPjCw==", + "version": "2.17.0", + "resolved": "https://registry.npmjs.org/@pythnetwork/client/-/client-2.17.0.tgz", + "integrity": "sha512-hv285vehmLH6N762Z4jqvPTM+hCYnXQaUp6DMgLUpDHvE0mTbwW9PvlxYoUJZGtyeCDkgn9HrTWXPtnaXTRr+Q==", "requires": { + "@coral-xyz/anchor": "^0.26.0", + "@coral-xyz/borsh": "^0.26.0", "buffer": "^6.0.1" } }, + "@randlabs/communication-bridge": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@randlabs/communication-bridge/-/communication-bridge-1.0.1.tgz", + "integrity": "sha512-CzS0U8IFfXNK7QaJFE4pjbxDGfPjbXBEsEaCn9FN15F+ouSAEUQkva3Gl66hrkBZOGexKFEWMwUHIDKpZ2hfVg==" + }, + "@randlabs/myalgo-connect": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/@randlabs/myalgo-connect/-/myalgo-connect-1.4.2.tgz", + "integrity": "sha512-K9hEyUi7G8tqOp7kWIALJLVbGCByhilcy6123WfcorxWwiE1sbQupPyIU5f3YdQK6wMjBsyTWiLW52ZBMp7sXA==", + "requires": { + "@randlabs/communication-bridge": "1.0.1" + } + }, "@scure/base": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.1.tgz", "integrity": "sha512-ZxOhsSyxYwLJj3pLZCefNitxsj093tb2vq90mp2txoYeBqbcjDjqFhyM8eUjq/uFm6zJ+mUuqxlS2FkuSY1MTA==" }, "@scure/bip32": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.1.0.tgz", - "integrity": "sha512-ftTW3kKX54YXLCxH6BB7oEEoJfoE2pIgw7MINKAs5PsS6nqKPuKk1haTF/EuHmYqG330t5GSrdmtRuHaY1a62Q==", + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.1.5.tgz", + "integrity": "sha512-XyNh1rB0SkEqd3tXcXMi+Xe1fvg+kUIcoRIEujP1Jgv7DqW2r9lg3Ah0NkFaCs9sTkQAQA8kw7xiRXzENi9Rtw==", "requires": { - "@noble/hashes": "~1.1.1", - "@noble/secp256k1": "~1.6.0", + "@noble/hashes": "~1.2.0", + "@noble/secp256k1": "~1.7.0", "@scure/base": "~1.1.0" - }, - "dependencies": { - "@noble/secp256k1": { - "version": "1.6.3", - "resolved": "https://registry.npmjs.org/@noble/secp256k1/-/secp256k1-1.6.3.tgz", - "integrity": "sha512-T04e4iTurVy7I8Sw4+c5OSN9/RkPlo1uKxAomtxQNLq8j1uPAqnsqG1bqvY3Jv7c13gyr6dui0zmh/I3+f/JaQ==" - } } }, "@scure/bip39": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.1.0.tgz", - "integrity": "sha512-pwrPOS16VeTKg98dYXQyIjJEcWfz7/1YJIwxUEPFfQPtc86Ym/1sVgQ2RLoD43AazMk2l/unK4ITySSpW2+82w==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.1.1.tgz", + "integrity": "sha512-t+wDck2rVkh65Hmv280fYdVdY25J9YeEUIgn2LG1WM6gxFkGzcksoDiUkWVpVp3Oex9xGC68JU2dSbUfwZ2jPg==", "requires": { - "@noble/hashes": "~1.1.1", + "@noble/hashes": "~1.2.0", "@scure/base": "~1.1.0" } }, + "@sideway/address": { + "version": "4.1.4", + "resolved": "https://registry.npmjs.org/@sideway/address/-/address-4.1.4.tgz", + "integrity": "sha512-7vwq+rOHVWjyXxVlR76Agnvhy8I9rpzjosTESvmhNeXOXdZZB15Fl+TI9x1SiHZH5Jv2wTGduSxFDIaq0m3DUw==", + "requires": { + "@hapi/hoek": "^9.0.0" + } + }, + "@sideway/formula": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@sideway/formula/-/formula-3.0.1.tgz", + "integrity": "sha512-/poHZJJVjx3L+zVD6g9KgHfYnb443oi7wLu/XKojDviHy6HOEOA6z1Trk5aR1dGcmPenJEgb2sK2I80LeS3MIg==" + }, + "@sideway/pinpoint": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@sideway/pinpoint/-/pinpoint-2.0.0.tgz", + "integrity": "sha512-RNiOoTPkptFtSVzQevY/yWtZwf/RxyVnPy/OcA9HBM3MlGDnBEYL5B41H0MTn0Uec8Hi+2qUtTfG2WWZBmMejQ==" + }, "@solana/buffer-layout": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/@solana/buffer-layout/-/buffer-layout-4.0.1.tgz", "integrity": "sha512-E1ImOIAD1tBZFRdjeM4/pzTiTApC0AOBGwyAMS4fwIodCWArzJ3DWdoh8cKxeFM2fElkxBh2Aqts1BPC373rHA==", "requires": { "buffer": "~6.0.3" - }, - "dependencies": { - "buffer": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", - "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", - "requires": { - "base64-js": "^1.3.1", - "ieee754": "^1.2.1" - } - }, - "ieee754": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", - "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==" - } + } + }, + "@solana/buffer-layout-utils": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/@solana/buffer-layout-utils/-/buffer-layout-utils-0.2.0.tgz", + "integrity": "sha512-szG4sxgJGktbuZYDg2FfNmkMi0DYQoVjN2h7ta1W1hPrwzarcFLBq9UpX1UjNXsNpT9dn+chgprtWGioUAr4/g==", + "requires": { + "@solana/buffer-layout": "^4.0.0", + "@solana/web3.js": "^1.32.0", + "bigint-buffer": "^1.1.5", + "bignumber.js": "^9.0.1" } }, "@solana/spl-token": { @@ -6303,31 +11104,37 @@ "dotenv": "10.0.0" }, "dependencies": { - "buffer": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", - "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", - "requires": { - "base64-js": "^1.3.1", - "ieee754": "^1.2.1" - } - }, "dotenv": { "version": "10.0.0", "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-10.0.0.tgz", "integrity": "sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q==" - }, - "ieee754": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", - "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==" } } }, + "@solana/wallet-adapter-base": { + "version": "0.9.22", + "resolved": "https://registry.npmjs.org/@solana/wallet-adapter-base/-/wallet-adapter-base-0.9.22.tgz", + "integrity": "sha512-xbLEZPGSJFvgTeldG9D55evhl7QK/3e/F7vhvcA97mEt1eieTgeKMnGlmmjs3yivI3/gtZNZeSk1XZLnhKcQvw==", + "requires": { + "@solana/wallet-standard-features": "^1.0.1", + "@wallet-standard/base": "^1.0.1", + "@wallet-standard/features": "^1.0.3", + "eventemitter3": "^4.0.7" + } + }, + "@solana/wallet-standard-features": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@solana/wallet-standard-features/-/wallet-standard-features-1.0.1.tgz", + "integrity": "sha512-SUfx7KtBJ55XIj0qAhhVcC1I6MklAXqWFEz9hDHW+6YcJIyvfix/EilBhaBik1FJ2JT0zukpOfFv8zpuAbFRbw==", + "requires": { + "@wallet-standard/base": "^1.0.1", + "@wallet-standard/features": "^1.0.3" + } + }, "@solana/web3.js": { - "version": "1.72.0", - "resolved": "https://registry.npmjs.org/@solana/web3.js/-/web3.js-1.72.0.tgz", - "integrity": "sha512-xMoCk0y/GpiQhHbRjMcrd5NpmkwhAA0c01id7lrr6nhNdz6Uc/CywPdBeZw3Qz6BVZ/qlUoerpKPWeiXqMUjwA==", + "version": "1.75.0", + "resolved": "https://registry.npmjs.org/@solana/web3.js/-/web3.js-1.75.0.tgz", + "integrity": "sha512-rHQgdo1EWfb+nPUpHe4O7i8qJPELHKNR5PAZRK+a7XxiykqOfbaAlPt5boDWAGPnYbSv0ziWZv5mq9DlFaQCxg==", "requires": { "@babel/runtime": "^7.12.5", "@noble/ed25519": "^1.7.0", @@ -6339,14 +11146,19 @@ "bn.js": "^5.0.0", "borsh": "^0.7.0", "bs58": "^4.0.1", - "buffer": "6.0.1", + "buffer": "6.0.3", "fast-stable-stringify": "^1.0.0", "jayson": "^3.4.4", - "node-fetch": "2", - "rpc-websockets": "^7.5.0", + "node-fetch": "^2.6.7", + "rpc-websockets": "^7.5.1", "superstruct": "^0.14.2" }, "dependencies": { + "@noble/hashes": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.0.tgz", + "integrity": "sha512-ilHEACi9DwqJB0pw7kv+Apvh50jiiSyR/cQ3y4W7lOR5mhvn/50FLUfsnfJz0BDZtl/RR16kXvptiv6q1msYZg==" + }, "superstruct": { "version": "0.14.2", "resolved": "https://registry.npmjs.org/superstruct/-/superstruct-0.14.2.tgz", @@ -6355,22 +11167,25 @@ } }, "@solendprotocol/solend-sdk": { - "version": "0.6.9", - "resolved": "https://registry.npmjs.org/@solendprotocol/solend-sdk/-/solend-sdk-0.6.9.tgz", - "integrity": "sha512-KToDqIDsn11hdNY3M/Lew5spSF2ML2S8q5H21pwjVxFW1BV01Mgm0Y1sD6pLnQ9epQUAqxtbGj1oUETs6bqFMQ==", + "version": "0.6.16", + "resolved": "https://registry.npmjs.org/@solendprotocol/solend-sdk/-/solend-sdk-0.6.16.tgz", + "integrity": "sha512-clv3zQfFzxZ9HWblg0/tsXwWkjZoAtdTmcPqusWHt5DSt0XyiRznZicvM5aENeFsdjCjgXljbB/NMrba+Nry/w==", "requires": { "@marinade.finance/marinade-ts-sdk": "^3.1.1", "@mithraic-labs/psy-american": "^0.2.1", "@project-serum/anchor": "^0.24.2", "@pythnetwork/client": "^2.5.1", "@solana/buffer-layout": "^4.0.0", - "@solana/spl-token": "^0.1.8", + "@solana/spl-token": "^0.3.6", "@solana/web3.js": "^1.66.2", + "@solflare-wallet/utl-sdk": "^1.4.0", + "@types/bn.js": "^5.1.1", "axios": "^0.24.0", "bignumber.js": "^9.0.2", "bn.js": "^5.2.0", "buffer": "^6.0.3", "buffer-layout": "^1.2.0", + "fzstd": "^0.1.0", "hot-shots": "^9.3.0", "isomorphic-fetch": "^3.0.0", "jsbi": "^4.3.0", @@ -6398,6 +11213,16 @@ "toml": "^3.0.0" } }, + "@solana/spl-token": { + "version": "0.3.7", + "resolved": "https://registry.npmjs.org/@solana/spl-token/-/spl-token-0.3.7.tgz", + "integrity": "sha512-bKGxWTtIw6VDdCBngjtsGlKGLSmiu/8ghSt/IOYJV24BsymRbgq7r12GToeetpxmPaZYLddKwAz7+EwprLfkfg==", + "requires": { + "@solana/buffer-layout": "^4.0.0", + "@solana/buffer-layout-utils": "^0.2.0", + "buffer": "^6.0.3" + } + }, "axios": { "version": "0.24.0", "resolved": "https://registry.npmjs.org/axios/-/axios-0.24.0.tgz", @@ -6405,51 +11230,24 @@ "requires": { "follow-redirects": "^1.14.4" } - }, - "buffer": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", - "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", - "requires": { - "base64-js": "^1.3.1", - "ieee754": "^1.2.1" - } - }, - "ieee754": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", - "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==" - }, - "typedoc": { - "version": "0.20.37", - "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.20.37.tgz", - "integrity": "sha512-9+qDhdc4X00qTNOtii6QX2z7ndAeWVOso7w3MPSoSJdXlVhpwPfm1yEp4ooKuWA9fiQILR8FKkyjmeqa13hBbw==", - "peer": true, - "requires": { - "colors": "^1.4.0", - "fs-extra": "^9.1.0", - "handlebars": "^4.7.7", - "lodash": "^4.17.21", - "lunr": "^2.3.9", - "marked": "~2.0.3", - "minimatch": "^3.0.0", - "progress": "^2.0.3", - "shelljs": "^0.8.4", - "shiki": "^0.9.3", - "typedoc-default-themes": "^0.12.10" - } - }, - "typedoc-plugin-cname": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/typedoc-plugin-cname/-/typedoc-plugin-cname-1.0.1.tgz", - "integrity": "sha512-f97SS5RzDCVBa7Frg1VketIMAkEl3OTvBs9wM8lLEkJVWCIG2yXnszglA82on39gFwQ1tyq8tiuxRgb4569GpA==", - "requires": {} - }, - "typescript": { - "version": "4.2.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.2.4.tgz", - "integrity": "sha512-V+evlYHZnQkaz8TRBuxTA92yZBPotr5H+WhQ7bD3hZUndx5tGOa1fuCgeSjxAzM1RiN5IzvadIXTVefuuwZCRg==", - "peer": true + } + } + }, + "@solflare-wallet/utl-sdk": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@solflare-wallet/utl-sdk/-/utl-sdk-1.4.0.tgz", + "integrity": "sha512-0E3s+fXs5XMGBNrXGB4XSH4+sPgLanbBEVyz227KJyxSIgiRdQMcM2Yv/KdnMHNmhYoR/aPpH6TH115SIJqM0A==", + "requires": { + "@metaplex-foundation/js": "0.11.7", + "axios": "^0.27.2", + "eventemitter3": "^5.0.0", + "lodash": "^4.17.21" + }, + "dependencies": { + "eventemitter3": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.1.tgz", + "integrity": "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==" } } }, @@ -6585,9 +11383,9 @@ } }, "@supercharge/promise-pool": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/@supercharge/promise-pool/-/promise-pool-2.3.2.tgz", - "integrity": "sha512-f5+C7zv+QQivcUO1FH5lXi7GcuJ3CFuJF3Eg06iArhUs5ma0szCLEQwIY4+VQyh7m/RLVZdzvr4E4ZDnLe9MNg==" + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/@supercharge/promise-pool/-/promise-pool-2.4.0.tgz", + "integrity": "sha512-O9CMipBlq5OObdt1uKJGIzm9cdjpPWfj+a+Zw9EgWKxaMNHKC7EU7X9taj3H0EGQNLOSq2jAcOa3EzxlfHsD6w==" }, "@taquito/http-utils": { "version": "10.2.1", @@ -6635,22 +11433,6 @@ "bs58check": "^2.1.2", "buffer": "^6.0.3" } - }, - "buffer": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", - "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", - "peer": true, - "requires": { - "base64-js": "^1.3.1", - "ieee754": "^1.2.1" - } - }, - "ieee754": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", - "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", - "peer": true } } }, @@ -6736,6 +11518,19 @@ "requires": { "follow-redirects": "^1.14.8" } + }, + "rxjs": { + "version": "6.6.7", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.7.tgz", + "integrity": "sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ==", + "requires": { + "tslib": "^1.9.0" + } + }, + "tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" } } }, @@ -6766,20 +11561,29 @@ "buffer": "^6.0.3" } }, - "buffer": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", - "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "rx-sandbox": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/rx-sandbox/-/rx-sandbox-1.0.4.tgz", + "integrity": "sha512-+/9MHDYNoF9ca/2RR+L2LloXXeQyIR3k/wjK03IicrxxlbkhmKF4ejPiWeafMWDg7otF+pnX5NE/8v/rX6ICJA==", "peer": true, "requires": { - "base64-js": "^1.3.1", - "ieee754": "^1.2.1" + "expect": "^26.6.1", + "jest-matcher-utils": "^26.6.1" } }, - "ieee754": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", - "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "rxjs": { + "version": "6.6.7", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.7.tgz", + "integrity": "sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ==", + "peer": true, + "requires": { + "tslib": "^1.9.0" + } + }, + "tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", "peer": true } } @@ -6797,22 +11601,6 @@ "buffer": "^6.0.3", "elliptic": "^6.5.4", "typedarray-to-buffer": "^4.0.0" - }, - "dependencies": { - "buffer": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", - "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", - "requires": { - "base64-js": "^1.3.1", - "ieee754": "^1.2.1" - } - }, - "ieee754": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", - "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==" - } } }, "@temple-wallet/dapp": { @@ -6860,7 +11648,6 @@ "version": "5.1.1", "resolved": "https://registry.npmjs.org/@types/bn.js/-/bn.js-5.1.1.tgz", "integrity": "sha512-qNrYbZqMx0uJAfKnKclPh+dTwK33KfLHYqtyODwd5HnXOjnkhc4qgn3BrK6RWyGZm5+sIFE7Q7Vz6QQtJB7w7g==", - "dev": true, "requires": { "@types/node": "*" } @@ -6906,9 +11693,9 @@ } }, "@types/node": { - "version": "18.11.18", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.18.tgz", - "integrity": "sha512-DHQpWGjyQKSHj3ebjFI/wRKcqQcdR+MoFBygntYOZytCqNfkd2ZC4ARDJ2DQqhjH5p85Nnd3jhUJIXrszFX/JA==" + "version": "20.1.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.1.0.tgz", + "integrity": "sha512-O+z53uwx64xY7D6roOi4+jApDGFg0qn6WHcxe5QeqjMaTezBO/mxdfFXIVAVVyNWKx84OmPB3L8kbVYOTeN34A==" }, "@types/retry": { "version": "0.12.2", @@ -6945,10 +11732,31 @@ "integrity": "sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA==", "peer": true }, + "@wallet-standard/base": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@wallet-standard/base/-/base-1.0.1.tgz", + "integrity": "sha512-1To3ekMfzhYxe0Yhkpri+Fedq0SYcfrOfJi3vbLjMwF2qiKPjTGLwZkf2C9ftdQmxES+hmxhBzTwF4KgcOwf8w==" + }, + "@wallet-standard/features": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@wallet-standard/features/-/features-1.0.3.tgz", + "integrity": "sha512-m8475I6W5LTatTZuUz5JJNK42wFRgkJTB0I9tkruMwfqBF2UN2eomkYNVf9RbrsROelCRzSFmugqjKZBFaubsA==", + "requires": { + "@wallet-standard/base": "^1.0.1" + } + }, + "abort-controller": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", + "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", + "requires": { + "event-target-shim": "^5.0.0" + } + }, "acorn": { - "version": "8.8.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.1.tgz", - "integrity": "sha512-7zFpHzhnqYKrkYdUjF1HI1bzd0VygEGX8lFk4k5zVMqHEoES+P+7TKI+EvLO9WVMJ8eekdO0aDEK044xTXwPPA==", + "version": "8.8.2", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz", + "integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==", "dev": true }, "acorn-jsx": { @@ -6970,12 +11778,12 @@ "integrity": "sha512-H7wUZRn8WpTq9jocdxQ2c8x2sKo9ZVmzfRE13GiNJXfp7NcKYEdvl3vspKjXox6RIG2VtaRe4JFvxG4rqp2Zuw==" }, "agentkeepalive": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.2.1.tgz", - "integrity": "sha512-Zn4cw2NEqd+9fiSVWMscnjyQ1a8Yfoc5oBajLeo5w+YBHgDUcEBY2hS4YpTz6iN5f/2zQiktcuM6tS8x1p9dpA==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.3.0.tgz", + "integrity": "sha512-7Epl1Blf4Sy37j4v9f9FjICCh4+KAQOyXgHEwlyBiAQLbhKdq/i2QQU3amQalS/wPhdPzDXPL5DMR5bkn+YeWg==", "requires": { "debug": "^4.1.0", - "depd": "^1.1.2", + "depd": "^2.0.0", "humanize-ms": "^1.2.1" } }, @@ -6991,10 +11799,45 @@ "uri-js": "^4.2.2" } }, + "algo-msgpack-with-bigint": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/algo-msgpack-with-bigint/-/algo-msgpack-with-bigint-2.1.1.tgz", + "integrity": "sha512-F1tGh056XczEaEAqu7s+hlZUDWwOBT70Eq0lfMpBP2YguSQVyxRbprLq5rELXKQOyOaixTWYhMeMQMzP0U5FoQ==" + }, + "algosdk": { + "version": "1.24.1", + "resolved": "https://registry.npmjs.org/algosdk/-/algosdk-1.24.1.tgz", + "integrity": "sha512-9moZxdqeJ6GdE4N6fA/GlUP4LrbLZMYcYkt141J4Ss68OfEgH9qW0wBuZ3ZOKEx/xjc5bg7mLP2Gjg7nwrkmww==", + "requires": { + "algo-msgpack-with-bigint": "^2.1.1", + "buffer": "^6.0.2", + "cross-fetch": "^3.1.5", + "hi-base32": "^0.5.1", + "js-sha256": "^0.9.0", + "js-sha3": "^0.8.0", + "js-sha512": "^0.8.0", + "json-bigint": "^1.0.0", + "tweetnacl": "^1.0.3", + "vlq": "^2.0.4" + } + }, + "ansi-escapes": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", + "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==", + "requires": { + "type-fest": "^0.21.3" + }, + "dependencies": { + "type-fest": { + "version": "0.21.3", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", + "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==" + } + } + }, "ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==" + "version": "5.0.1" }, "ansi-styles": { "version": "4.3.0", @@ -7004,6 +11847,52 @@ "color-convert": "^2.0.1" } }, + "ansicolors": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/ansicolors/-/ansicolors-0.3.2.tgz", + "integrity": "sha512-QXu7BPrP29VllRxH8GwB7x5iX5qWKAAMLqKQGWTeLWVlNHNOpVMJ91dsxQAIWXpjuW5wqvxu3Jd/nRjrJ+0pqg==" + }, + "arbundles": { + "version": "0.6.22", + "resolved": "https://registry.npmjs.org/arbundles/-/arbundles-0.6.22.tgz", + "integrity": "sha512-QlSavBHk59mNqgQ6ScxlqaBJlDbSmSrK/uTcF3HojLAZ/4aufTkVTBjl1hSfZ/ZN45oIPgJC05R8SmVARF+8VA==", + "requires": { + "@noble/ed25519": "^1.6.1", + "@randlabs/myalgo-connect": "^1.1.2", + "@solana/wallet-adapter-base": "^0.9.2", + "algosdk": "^1.13.1", + "arweave": "^1.11.4", + "arweave-stream-tx": "^1.1.0", + "avsc": "https://github.com/Bundlr-Network/avsc#csp-fixes", + "axios": "^0.21.3", + "base64url": "^3.0.1", + "bs58": "^4.0.1", + "ethers": "^5.5.1", + "keccak": "^3.0.2", + "multistream": "^4.1.0", + "process": "^0.11.10", + "secp256k1": "^4.0.2", + "tmp-promise": "^3.0.2" + }, + "dependencies": { + "axios": { + "version": "0.21.4", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.4.tgz", + "integrity": "sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==", + "requires": { + "follow-redirects": "^1.14.0" + } + } + } + }, + "arconnect": { + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/arconnect/-/arconnect-0.4.2.tgz", + "integrity": "sha512-Jkpd4QL3TVqnd3U683gzXmZUVqBUy17DdJDuL/3D9rkysLgX6ymJ2e+sR+xyZF5Rh42CBqDXWNMmCjBXeP7Gbw==", + "requires": { + "arweave": "^1.10.13" + } + }, "arg": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", @@ -7016,6 +11905,51 @@ "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", "dev": true }, + "arweave": { + "version": "1.13.7", + "resolved": "https://registry.npmjs.org/arweave/-/arweave-1.13.7.tgz", + "integrity": "sha512-Hv+x2bSI6UyBHpuVbUDMMpMje1ETfpJWj52kKfz44O0IqDRi/LukOkkDUptup1p6OT6KP1/DdpnUnsNHoskFeA==", + "requires": { + "arconnect": "^0.4.2", + "asn1.js": "^5.4.1", + "base64-js": "^1.5.1", + "bignumber.js": "^9.0.2" + } + }, + "arweave-stream-tx": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/arweave-stream-tx/-/arweave-stream-tx-1.2.2.tgz", + "integrity": "sha512-bNt9rj0hbAEzoUZEF2s6WJbIz8nasZlZpxIw03Xm8fzb9gRiiZlZGW3lxQLjfc9Z0VRUWDzwtqoYeEoB/JDToQ==", + "requires": { + "exponential-backoff": "^3.1.0" + } + }, + "asn1.js": { + "version": "5.4.1", + "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-5.4.1.tgz", + "integrity": "sha512-+I//4cYPccV8LdmBLiX8CYvf9Sp3vQsrqu2QNXRcrbiWvcx/UdlFiqUJJzxRQxgsZmvhXhn4cSKeSmoFjVdupA==", + "requires": { + "bn.js": "^4.0.0", + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0", + "safer-buffer": "^2.1.0" + }, + "dependencies": { + "bn.js": { + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", + "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" + } + } + }, + "async-retry": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/async-retry/-/async-retry-1.3.3.tgz", + "integrity": "sha512-wfr/jstw9xNi/0teMHrRW7dsz3Lt5ARhYNZ2ewpadnhaIp5mbALhOAP+EAdsC7t4Z6wqsDVv9+W6gm1Dk9mEyw==", + "requires": { + "retry": "0.13.1" + } + }, "asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", @@ -7032,10 +11966,14 @@ "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz", "integrity": "sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==" }, + "avsc": { + "version": "git+ssh://git@github.com/Bundlr-Network/avsc.git#a730cc8018b79e114b6a3381bbb57760a24c6cef", + "from": "avsc@https://github.com/Bundlr-Network/avsc#csp-fixes" + }, "aws-sdk": { - "version": "2.1283.0", - "resolved": "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.1283.0.tgz", - "integrity": "sha512-YlxTF0T9X8AcNrOzFPVOPnX1jNtHZjYHRUCfpsVwqdajHDGGruVsVppgBYXEiCRuTQNUhcJTUx0J0uKBhKQZIA==", + "version": "2.1373.0", + "resolved": "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.1373.0.tgz", + "integrity": "sha512-3/P79VU2VVeiof25bn8TSepEhWCRhwuQGYoEWX/2pApQRJAY+w/3JFVKHjbAe3NYEEBNeiAE6PQ9DqWz5Pp+Lw==", "requires": { "buffer": "4.9.2", "events": "1.1.1", @@ -7046,7 +11984,7 @@ "url": "0.10.3", "util": "^0.12.4", "uuid": "8.0.0", - "xml2js": "0.4.19" + "xml2js": "0.5.0" }, "dependencies": { "buffer": { @@ -7057,7 +11995,24 @@ "base64-js": "^1.0.2", "ieee754": "^1.1.4", "isarray": "^1.0.0" + }, + "dependencies": { + "ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==" + } } + }, + "ieee754": { + "version": "1.1.13", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.13.tgz", + "integrity": "sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg==" + }, + "uuid": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.0.0.tgz", + "integrity": "sha512-jOXGuXZAWdsTH7eZLtyXMqUb9EcWMGZNbL9YcGBJl4MH4nrxHmZJhEHvyLFrkxo+28uLb/NYRcStH48fnD0Vzw==" } } }, @@ -7068,6 +12023,18 @@ "requires": { "follow-redirects": "^1.14.9", "form-data": "^4.0.0" + }, + "dependencies": { + "form-data": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + } + } } }, "balanced-match": { @@ -7088,6 +12055,11 @@ "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==" }, + "base64url": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/base64url/-/base64url-3.0.1.tgz", + "integrity": "sha512-ir1UPr3dkwexU7FdV8qBBbNDRUhMmIekYMFZfi+C/sLNnRESKPl23nB9b2pltqfOQNnGzsDdId90AEtG5tCx4A==" + }, "bech32": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/bech32/-/bech32-1.1.4.tgz", @@ -7114,11 +12086,64 @@ "file-uri-to-path": "1.0.0" } }, + "bip39": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/bip39/-/bip39-3.0.2.tgz", + "integrity": "sha512-J4E1r2N0tUylTKt07ibXvhpT2c5pyAFgvuA5q1H9uDy6dEGpjV8jmymh3MTYJDLCNbIVClSB9FbND49I6N24MQ==", + "requires": { + "@types/node": "11.11.6", + "create-hash": "^1.1.0", + "pbkdf2": "^3.0.9", + "randombytes": "^2.0.1" + }, + "dependencies": { + "@types/node": { + "version": "11.11.6", + "resolved": "https://registry.npmjs.org/@types/node/-/node-11.11.6.tgz", + "integrity": "sha512-Exw4yUWMBXM3X+8oqzJNRqZSwUAaS4+7NdvHqQuFi/d+synz++xmX3QIf+BFqneW8N31R8Ky+sikfZUXq07ggQ==" + } + } + }, + "bip39-light": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/bip39-light/-/bip39-light-1.0.7.tgz", + "integrity": "sha512-WDTmLRQUsiioBdTs9BmSEmkJza+8xfJmptsNJjxnoq3EydSa/ZBXT6rm66KoT3PJIRYMnhSKNR7S9YL1l7R40Q==", + "requires": { + "create-hash": "^1.1.0", + "pbkdf2": "^3.0.9" + } + }, + "bl": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", + "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", + "requires": { + "buffer": "^5.5.0", + "inherits": "^2.0.4", + "readable-stream": "^3.4.0" + }, + "dependencies": { + "buffer": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", + "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "requires": { + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" + } + } + } + }, "blakejs": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/blakejs/-/blakejs-1.2.1.tgz", "integrity": "sha512-QXUSXI3QVc/gJME0dBpXrag1kbzOqCjCX8/b54ntNyW6sjtoqxqRk3LTmXzaJoh71zMsDCjM+47jS7XiwN/+fQ==" }, + "bluebird": { + "version": "3.7.2", + "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", + "integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==" + }, "bn.js": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", @@ -7134,6 +12159,11 @@ "text-encoding-utf-8": "^1.0.2" } }, + "bowser": { + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/bowser/-/bowser-2.11.0.tgz", + "integrity": "sha512-AlcaJBi/pqqJBIQ8U9Mcpc9i8Aqxn88Skv5d+xBX006BY5u8N3mGLHa5Lgppa7L/HfwgwLgZ6NYs+Ag6uUmJRA==" + }, "brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -7176,19 +12206,12 @@ } }, "buffer": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.1.tgz", - "integrity": "sha512-rVAXBwEcEoYtxnHSO5iWyhzV/O1WMtkUYWlfdLS7FjU4PnSJJHEfHXi/uHPI5EwltmOA794gN3bm3/pzuctWjQ==", + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", "requires": { "base64-js": "^1.3.1", "ieee754": "^1.2.1" - }, - "dependencies": { - "ieee754": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", - "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==" - } } }, "buffer-layout": { @@ -7225,6 +12248,11 @@ "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==" }, + "capability": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/capability/-/capability-0.2.5.tgz", + "integrity": "sha512-rsJZYVCgXd08sPqwmaIqjAd5SUTfonV0z/gDJ8D6cN8wQphky1kkAYEqQ+hmDxTw7UihvBfjUVUSY+DBEe44jg==" + }, "chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -7234,6 +12262,16 @@ "supports-color": "^7.1.0" } }, + "chardet": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.7.0.tgz", + "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==" + }, + "check-more-types": { + "version": "2.24.0", + "resolved": "https://registry.npmjs.org/check-more-types/-/check-more-types-2.24.0.tgz", + "integrity": "sha512-Pj779qHxV2tuapviy1bSZNEL1maXr13bPYpsvSDB68HlYcYuhlDrmGd63i0JHMCLKzc7rUSNIrpdJlhVlNwrxA==" + }, "cipher-base": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz", @@ -7243,6 +12281,29 @@ "safe-buffer": "^5.0.1" } }, + "cli-cursor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", + "integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==", + "requires": { + "restore-cursor": "^3.1.0" + } + }, + "cli-spinners": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.9.0.tgz", + "integrity": "sha512-4/aL9X3Wh0yiMQlE+eeRhWP6vclO3QRtw1JHKIT0FFUs5FjpFmESqtMvYZ0+lbzBw900b95mS0hohy+qn2VK/g==" + }, + "cli-width": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-3.0.0.tgz", + "integrity": "sha512-FxqpkPPwu1HjuN93Omfm4h8uIanXofW0RxVEW3k5RKx+mJJYSthzNhp32Kzxxy3YAEZ/Dc/EWN1vZRY0+kOhbw==" + }, + "clone": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz", + "integrity": "sha512-JQHZ2QMW6l3aH/j6xCqQThY/9OH4D/9ls34cgkUBiEeocRTU04tHfKPBsUK1PqZCUQM7GiA0IIXJSuXHI64Kbg==" + }, "color-convert": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", @@ -7323,13 +12384,22 @@ "integrity": "sha512-lvb1SBsI0Z7GDwmuid+mU3kWVBwTVUbe7S0H52yaaAdQOXq2YktTCZdlAcNKFzE6QtRz0snpw9bNiPeOIkkQvw==", "requires": { "node-fetch": "2.6.7" + }, + "dependencies": { + "node-fetch": { + "version": "2.6.7", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", + "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", + "requires": { + "whatwg-url": "^5.0.0" + } + } } }, "cross-spawn": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", - "dev": true, "requires": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", @@ -7341,6 +12411,32 @@ "resolved": "https://registry.npmjs.org/crypto-hash/-/crypto-hash-1.3.0.tgz", "integrity": "sha512-lyAZ0EMyjDkVvz8WOeVnuCPvKVBXcMv1l5SVqO1yC7PzTwrD/pPje/BIRbWhMoPe436U+Y2nD7f5bFx0kt+Sbg==" }, + "csv": { + "version": "6.2.12", + "resolved": "https://registry.npmjs.org/csv/-/csv-6.2.12.tgz", + "integrity": "sha512-Q1+8O4MKIM9U9OqYc2+A6U0ijGrxzs1YqNDUWlqoS98dx9/Kln6dCuazhau8v7Gi5pUEpRcTtlBisy7AFGFr2A==", + "requires": { + "csv-generate": "^4.2.6", + "csv-parse": "^5.3.10", + "csv-stringify": "^6.3.4", + "stream-transform": "^3.2.6" + } + }, + "csv-generate": { + "version": "4.2.6", + "resolved": "https://registry.npmjs.org/csv-generate/-/csv-generate-4.2.6.tgz", + "integrity": "sha512-VtnYqhWLcsUocA346ewFOk+rrqcoT663j11vXzD2uelXq9WguQ3QzDeVD8ISso7hhVtkDSHcWl9psdemeiEHDA==" + }, + "csv-parse": { + "version": "5.3.10", + "resolved": "https://registry.npmjs.org/csv-parse/-/csv-parse-5.3.10.tgz", + "integrity": "sha512-cTXY6iy0gN5Ha/cGILeDgQE+nKiKDU2m0DjSRdJhr86BN3cM7oefBsTk2aH0LQeaYtL7Z7HvW+jYoadmdhzeDA==" + }, + "csv-stringify": { + "version": "6.3.4", + "resolved": "https://registry.npmjs.org/csv-stringify/-/csv-stringify-6.3.4.tgz", + "integrity": "sha512-/VVkafziBS1WyiQWYQ/krnBW1lJbr0RbanP7mMrFwy9V/sG8Xk6bacMS9IjUN0x3Jpp2iowpz9Lofd/KJIZ1qA==" + }, "debug": { "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", @@ -7360,6 +12456,14 @@ "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", "dev": true }, + "defaults": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.4.tgz", + "integrity": "sha512-eFuaLoy/Rxalv2kr+lqMlUnrDWV+3j4pljOIJgLIhI058IQfWJ7vXhyEIHu+HtC738klGALYxOKDO0bQP3tg8A==", + "requires": { + "clone": "^1.0.2" + } + }, "delay": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/delay/-/delay-5.0.0.tgz", @@ -7371,9 +12475,9 @@ "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==" }, "depd": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", - "integrity": "sha512-7emPTl6Dpo6JRXOXjLRxck+FlLRX5847cLKEn00PLAgc3g2hTZZgr+e4c2v6QpSmLeFP3n5yUo7ft6avBK/5jQ==" + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==" }, "diff": { "version": "4.0.2", @@ -7410,6 +12514,11 @@ "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.6.0.tgz", "integrity": "sha512-IrPdXQsk2BbzvCBGBOTmmSH5SodmqZNt4ERAZDmW4CT+tL8VtvinqywuANaFu4bOMWki16nqf0e4oC0QIaDr/g==" }, + "duplexer": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.2.tgz", + "integrity": "sha512-jtD6YG370ZCIi/9GTaJKQxWTZD045+4R4hTk/x1UyoqadyJ9x9CgSi1RlVDQF8U2sxLLSnFkCaMihqljHIWgMg==" + }, "elliptic": { "version": "6.5.4", "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz", @@ -7431,6 +12540,21 @@ } } }, + "emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" + }, + "error-polyfill": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/error-polyfill/-/error-polyfill-0.1.3.tgz", + "integrity": "sha512-XHJk60ufE+TG/ydwp4lilOog549iiQF2OAPhkk9DdiYWMrltz5yhDz/xnKuenNwP7gy3dsibssO5QpVhkrSzzg==", + "requires": { + "capability": "^0.2.5", + "o3": "^1.0.3", + "u3": "^0.1.1" + } + }, "es6-promise": { "version": "4.2.8", "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", @@ -7451,12 +12575,15 @@ "dev": true }, "eslint": { - "version": "8.32.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.32.0.tgz", - "integrity": "sha512-nETVXpnthqKPFyuY2FNjz/bEd6nbosRgKbkgS/y1C7LJop96gYHWpiguLecMHQ2XCPxn77DS0P+68WzG6vkZSQ==", + "version": "8.40.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.40.0.tgz", + "integrity": "sha512-bvR+TsP9EHL3TqNtj9sCNJVAFK3fBN8Q7g5waghxyRsPLIMwL73XSKnZFK0hk/O2ANC+iAoq6PWMQ+IfBAJIiQ==", "dev": true, "requires": { - "@eslint/eslintrc": "^1.4.1", + "@eslint-community/eslint-utils": "^4.2.0", + "@eslint-community/regexpp": "^4.4.0", + "@eslint/eslintrc": "^2.0.3", + "@eslint/js": "8.40.0", "@humanwhocodes/config-array": "^0.11.8", "@humanwhocodes/module-importer": "^1.0.1", "@nodelib/fs.walk": "^1.2.8", @@ -7466,11 +12593,10 @@ "debug": "^4.3.2", "doctrine": "^3.0.0", "escape-string-regexp": "^4.0.0", - "eslint-scope": "^7.1.1", - "eslint-utils": "^3.0.0", - "eslint-visitor-keys": "^3.3.0", - "espree": "^9.4.0", - "esquery": "^1.4.0", + "eslint-scope": "^7.2.0", + "eslint-visitor-keys": "^3.4.1", + "espree": "^9.5.2", + "esquery": "^1.4.2", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", "file-entry-cache": "^6.0.1", @@ -7491,60 +12617,42 @@ "minimatch": "^3.1.2", "natural-compare": "^1.4.0", "optionator": "^0.9.1", - "regexpp": "^3.2.0", "strip-ansi": "^6.0.1", "strip-json-comments": "^3.1.0", "text-table": "^0.2.0" } }, "eslint-scope": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.1.1.tgz", - "integrity": "sha512-QKQM/UXpIiHcLqJ5AOyIW7XZmzjkzQXYE54n1++wb0u9V/abW3l9uQnxX8Z5Xd18xyKIMTUAyQ0k1e8pz6LUrw==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.0.tgz", + "integrity": "sha512-DYj5deGlHBfMt15J7rdtyKNq/Nqlv5KfU4iodrQ019XESsRnwXH9KAE0y3cwtUHDo2ob7CypAnCqefh6vioWRw==", "dev": true, "requires": { "esrecurse": "^4.3.0", "estraverse": "^5.2.0" } }, - "eslint-utils": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-3.0.0.tgz", - "integrity": "sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==", - "dev": true, - "requires": { - "eslint-visitor-keys": "^2.0.0" - }, - "dependencies": { - "eslint-visitor-keys": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", - "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", - "dev": true - } - } - }, "eslint-visitor-keys": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz", - "integrity": "sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA==", + "version": "3.4.1", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.1.tgz", + "integrity": "sha512-pZnmmLwYzf+kWaM/Qgrvpen51upAktaaiI01nsJD/Yr3lMOdNtq0cxkrrg16w64VtisN6okbs7Q8AfGqj4c9fA==", "dev": true }, "espree": { - "version": "9.4.1", - "resolved": "https://registry.npmjs.org/espree/-/espree-9.4.1.tgz", - "integrity": "sha512-XwctdmTO6SIvCzd9810yyNzIrOrqNYV9Koizx4C/mRhf9uq0o4yHoCEU/670pOxOL/MSraektvSAji79kX90Vg==", + "version": "9.5.2", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.5.2.tgz", + "integrity": "sha512-7OASN1Wma5fum5SrNhFMAMJxOUAbhyfQ8dQ//PJaJbNw0URTPWqIghHWt1MmAANKhHZIYOHruW4Kw4ruUWOdGw==", "dev": true, "requires": { "acorn": "^8.8.0", "acorn-jsx": "^5.3.2", - "eslint-visitor-keys": "^3.3.0" + "eslint-visitor-keys": "^3.4.1" } }, "esquery": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.4.0.tgz", - "integrity": "sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w==", + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.5.0.tgz", + "integrity": "sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg==", "dev": true, "requires": { "estraverse": "^5.1.0" @@ -7572,26 +12680,14 @@ "dev": true }, "ethereum-cryptography": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-1.1.2.tgz", - "integrity": "sha512-XDSJlg4BD+hq9N2FjvotwUET9Tfxpxc3kWGE2AqUG5vcbeunnbImVk3cj6e/xT3phdW21mE8R5IugU4fspQDcQ==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-1.2.0.tgz", + "integrity": "sha512-6yFQC9b5ug6/17CQpCyE3k9eKBMdhyVjzUy1WkiuY/E4vj/SXDBbCw8QEIaXqf0Mf2SnY6RmpDcwlUmBSS0EJw==", "requires": { - "@noble/hashes": "1.1.2", - "@noble/secp256k1": "1.6.3", - "@scure/bip32": "1.1.0", - "@scure/bip39": "1.1.0" - }, - "dependencies": { - "@noble/hashes": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.1.2.tgz", - "integrity": "sha512-KYRCASVTv6aeUi1tsF8/vpyR7zpfs3FUzy2Jqm+MU+LmUKhQ0y2FpfwqkCcxSg2ua4GALJd8k2R76WxwZGbQpA==" - }, - "@noble/secp256k1": { - "version": "1.6.3", - "resolved": "https://registry.npmjs.org/@noble/secp256k1/-/secp256k1-1.6.3.tgz", - "integrity": "sha512-T04e4iTurVy7I8Sw4+c5OSN9/RkPlo1uKxAomtxQNLq8j1uPAqnsqG1bqvY3Jv7c13gyr6dui0zmh/I3+f/JaQ==" - } + "@noble/hashes": "1.2.0", + "@noble/secp256k1": "1.7.1", + "@scure/bip32": "1.1.5", + "@scure/bip39": "1.1.1" } }, "ethers": { @@ -7631,6 +12727,25 @@ "@ethersproject/wordlists": "5.7.0" } }, + "event-stream": { + "version": "3.3.4", + "resolved": "https://registry.npmjs.org/event-stream/-/event-stream-3.3.4.tgz", + "integrity": "sha512-QHpkERcGsR0T7Qm3HNJSyXKEEj8AHNxkY3PK8TS2KJvQ7NiSHe3DDpwVKKtoYprL/AreyzFBeIkBIWChAqn60g==", + "requires": { + "duplexer": "~0.1.1", + "from": "~0", + "map-stream": "~0.1.0", + "pause-stream": "0.0.11", + "split": "0.3", + "stream-combiner": "~0.0.4", + "through": "~2.3.1" + } + }, + "event-target-shim": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", + "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==" + }, "eventemitter3": { "version": "4.0.7", "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", @@ -7641,6 +12756,22 @@ "resolved": "https://registry.npmjs.org/events/-/events-1.1.1.tgz", "integrity": "sha512-kEcvvCBByWXGnZy6JUlgAp2gBIUjfCAV6P6TgT1/aaQKcmuAEC4OZTV1I4EWQLz2gxZw76atuVyvHhTxvi0Flw==" }, + "execa": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", + "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", + "requires": { + "cross-spawn": "^7.0.3", + "get-stream": "^6.0.0", + "human-signals": "^2.1.0", + "is-stream": "^2.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^4.0.1", + "onetime": "^5.1.2", + "signal-exit": "^3.0.3", + "strip-final-newline": "^2.0.0" + } + }, "expect": { "version": "26.6.2", "resolved": "https://registry.npmjs.org/expect/-/expect-26.6.2.tgz", @@ -7655,6 +12786,21 @@ "jest-regex-util": "^26.0.0" } }, + "exponential-backoff": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/exponential-backoff/-/exponential-backoff-3.1.1.tgz", + "integrity": "sha512-dX7e/LHVJ6W3DE1MHWi9S1EYzDESENfLrYohG2G++ovZrYOkm4Knwa0mc1cn84xJOR4KEU0WSchhLbd0UklbHw==" + }, + "external-editor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.1.0.tgz", + "integrity": "sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==", + "requires": { + "chardet": "^0.7.0", + "iconv-lite": "^0.4.24", + "tmp": "^0.0.33" + } + }, "extract-files": { "version": "9.0.0", "resolved": "https://registry.npmjs.org/extract-files/-/extract-files-9.0.0.tgz", @@ -7687,6 +12833,14 @@ "resolved": "https://registry.npmjs.org/fast-stable-stringify/-/fast-stable-stringify-1.0.0.tgz", "integrity": "sha512-wpYMUmFu5f00Sm0cj2pfivpmawLZ0NKdviQ4w9zJeR8JVtOpOxHmLaJuj0vxvGqMJQWyP/COUkF75/57OKyRag==" }, + "fast-xml-parser": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-4.1.2.tgz", + "integrity": "sha512-CDYeykkle1LiA/uqQyNwYpFbyF6Axec6YapmpUP+/RHWIoR1zKjocdvNaTsxCxZzQ6v9MLXaSYm9Qq0thv0DHg==", + "requires": { + "strnum": "^1.0.5" + } + }, "fastq": { "version": "1.15.0", "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.15.0.tgz", @@ -7696,6 +12850,21 @@ "reusify": "^1.0.4" } }, + "figures": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz", + "integrity": "sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==", + "requires": { + "escape-string-regexp": "^1.0.5" + }, + "dependencies": { + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==" + } + } + }, "file-entry-cache": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", @@ -7767,15 +12936,20 @@ } }, "form-data": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", - "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.1.tgz", + "integrity": "sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==", "requires": { "asynckit": "^0.4.0", "combined-stream": "^1.0.8", "mime-types": "^2.1.12" } }, + "from": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/from/-/from-0.1.7.tgz", + "integrity": "sha512-twe20eF1OxVxp/ML/kq2p1uc6KvFK/+vs8WjEbeKmV2He22MKm7YF2ANIt+EOqhJ5L3K/SuuPhk0hWQDjOM23g==" + }, "fs-extra": { "version": "9.1.0", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", @@ -7798,16 +12972,26 @@ "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" }, + "fzstd": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/fzstd/-/fzstd-0.1.0.tgz", + "integrity": "sha512-TTvznnpde1rTv/3FOmZMbPCh75gqkJ9dKJdsKmcNiXh4olLJl3eRahHJcGzyPZjuVaytffP02Or4z5avDvqKQA==" + }, "get-intrinsic": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.3.tgz", - "integrity": "sha512-QJVz1Tj7MS099PevUG5jvnt9tSkXN8K14dxQlikJuPt4uD9hHAHjLyLBiLR5zELelBdD9QNRAXZzsJx0WaDL9A==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.0.tgz", + "integrity": "sha512-L049y6nFOuom5wGyRc3/gdTLO94dySVKRACj1RmJZBQXlbTMhtNIgkWkUHq+jYmZvKf14EW1EoJnnjbmoHij0Q==", "requires": { "function-bind": "^1.1.1", "has": "^1.0.3", "has-symbols": "^1.0.3" } }, + "get-stream": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", + "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==" + }, "glob": { "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", @@ -7831,9 +13015,9 @@ } }, "globals": { - "version": "13.19.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.19.0.tgz", - "integrity": "sha512-dkQ957uSRWHw7CFXLUtUHQI3g3aWApYhfNR2O6jn/907riyTYKVBmxYVROkBcY614FSSeSJh7Xm7SrUWCxvJMQ==", + "version": "13.20.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.20.0.tgz", + "integrity": "sha512-Qg5QtVkCy/kv3FUSlu4ukeZDVf9ee0iXLAUYX13gbR17bnejFTzr4iS9bY7kwCf1NztRNm1t91fjOiyx4CSwPQ==", "dev": true, "requires": { "type-fest": "^0.20.2" @@ -7848,9 +13032,9 @@ } }, "graceful-fs": { - "version": "4.2.10", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", - "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", "peer": true }, "grapheme-splitter": { @@ -7862,8 +13046,7 @@ "graphql": { "version": "16.6.0", "resolved": "https://registry.npmjs.org/graphql/-/graphql-16.6.0.tgz", - "integrity": "sha512-KPIBPDlW7NxrbT/eh4qPXz5FiFdL5UbaA0XUNz2Rp3Z3hqBSkbj0GVjwFDztsWVauZUWsbKHgMg++sk8UX0bkw==", - "peer": true + "integrity": "sha512-KPIBPDlW7NxrbT/eh4qPXz5FiFdL5UbaA0XUNz2Rp3Z3hqBSkbj0GVjwFDztsWVauZUWsbKHgMg++sk8UX0bkw==" }, "graphql-request": { "version": "4.3.0", @@ -7873,18 +13056,6 @@ "cross-fetch": "^3.1.5", "extract-files": "^9.0.0", "form-data": "^3.0.0" - }, - "dependencies": { - "form-data": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.1.tgz", - "integrity": "sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==", - "requires": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.8", - "mime-types": "^2.1.12" - } - } } }, "handlebars": { @@ -7968,18 +13139,57 @@ "unix-dgram": "2.x" } }, + "http-errors": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.8.1.tgz", + "integrity": "sha512-Kpk9Sm7NmI+RHhnj6OIWDI1d6fIoFAtFt9RLaTMRlg/8w49juAStsrBgp0Dp4OdxdVbRIeKhtCUvoi/RuAhO4g==", + "requires": { + "depd": "~1.1.2", + "inherits": "2.0.4", + "setprototypeof": "1.2.0", + "statuses": ">= 1.5.0 < 2", + "toidentifier": "1.0.1" + }, + "dependencies": { + "depd": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", + "integrity": "sha512-7emPTl6Dpo6JRXOXjLRxck+FlLRX5847cLKEn00PLAgc3g2hTZZgr+e4c2v6QpSmLeFP3n5yUo7ft6avBK/5jQ==" + } + } + }, + "human-signals": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", + "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==" + }, "humanize-ms": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz", "integrity": "sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ==", "requires": { "ms": "^2.0.0" + }, + "dependencies": { + "ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" + } + } + }, + "iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "requires": { + "safer-buffer": ">= 2.1.2 < 3" } }, "ieee754": { - "version": "1.1.13", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.13.tgz", - "integrity": "sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg==" + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==" }, "ignore": { "version": "5.2.4", @@ -8017,6 +13227,28 @@ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" }, + "inquirer": { + "version": "8.2.5", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-8.2.5.tgz", + "integrity": "sha512-QAgPDQMEgrDssk1XiwwHoOGYF9BAbUcc1+j+FhEvaOt8/cKRqyLn0U5qA6F74fGhTMGxf92pOvPBeh29jQJDTQ==", + "requires": { + "ansi-escapes": "^4.2.1", + "chalk": "^4.1.1", + "cli-cursor": "^3.1.0", + "cli-width": "^3.0.0", + "external-editor": "^3.0.3", + "figures": "^3.0.0", + "lodash": "^4.17.21", + "mute-stream": "0.0.8", + "ora": "^5.4.1", + "run-async": "^2.4.0", + "rxjs": "^7.5.5", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0", + "through": "^2.3.6", + "wrap-ansi": "^7.0.0" + } + }, "interpret": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.4.0.tgz", @@ -8038,9 +13270,9 @@ "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==" }, "is-core-module": { - "version": "2.11.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.11.0.tgz", - "integrity": "sha512-RRjxlvLDkD1YJwDbroBHMb+cukurkDWNyHx7D3oNB5x9rb5ogcksMC5wHCadcXoo67gVr/+3GFySh3134zi6rw==", + "version": "2.12.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.12.0.tgz", + "integrity": "sha512-RECHCBCd/viahWmwj6enj19sKbHfJrddi/6cBDsNTKbNq0f7VeaUkBo60BqzvPqo/W54ChS62Z5qyun7cfOMqQ==", "peer": true, "requires": { "has": "^1.0.3" @@ -8052,6 +13284,11 @@ "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", "dev": true }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==" + }, "is-generator-function": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.10.tgz", @@ -8069,6 +13306,11 @@ "is-extglob": "^2.1.1" } }, + "is-interactive": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-interactive/-/is-interactive-1.0.0.tgz", + "integrity": "sha512-2HvIEKRoqS62guEC+qBjpvRubdX910WCMuJTZ+I9yvqKU2/12eSL549HMwtabb4oupdj2sMP50k+XJfB/8JE6w==" + }, "is-number": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", @@ -8081,6 +13323,11 @@ "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", "dev": true }, + "is-stream": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", + "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==" + }, "is-typed-array": { "version": "1.1.10", "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.10.tgz", @@ -8093,6 +13340,11 @@ "has-tostringtag": "^1.0.0" } }, + "is-unicode-supported": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", + "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==" + }, "isarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", @@ -8101,8 +13353,7 @@ "isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", - "dev": true + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==" }, "isomorphic-fetch": { "version": "3.0.0", @@ -8143,11 +13394,6 @@ "version": "12.20.55", "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.55.tgz", "integrity": "sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==" - }, - "uuid": { - "version": "8.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", - "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==" } } }, @@ -8209,10 +13455,22 @@ "resolved": "https://registry.npmjs.org/jmespath/-/jmespath-0.16.0.tgz", "integrity": "sha512-9FzQjJ7MATs1tSpnco1K6ayiYE3figslrXA72G2HQ/n76RzvYlofyi5QM+iX4YRs/pu3yzxlVQSST23+dMDknw==" }, + "joi": { + "version": "17.9.2", + "resolved": "https://registry.npmjs.org/joi/-/joi-17.9.2.tgz", + "integrity": "sha512-Itk/r+V4Dx0V3c7RLFdRh12IOjySm2/WGPMubBT92cQvRfYZhPM2W0hZlctjj72iES8jsRCwp7S/cRmWBnJ4nw==", + "requires": { + "@hapi/hoek": "^9.0.0", + "@hapi/topo": "^5.0.0", + "@sideway/address": "^4.1.3", + "@sideway/formula": "^3.0.1", + "@sideway/pinpoint": "^2.0.0" + } + }, "js-sdsl": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/js-sdsl/-/js-sdsl-4.2.0.tgz", - "integrity": "sha512-dyBIzQBDkCqCu+0upx25Y2jGdbTGxE9fshMsCdK0ViOongpV+n5tXRcZY9v7CaVQ79AGS9KA1KHtojxiM7aXSQ==", + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/js-sdsl/-/js-sdsl-4.4.0.tgz", + "integrity": "sha512-FfVSdx6pJ41Oa+CF7RDaFmTnCaFhua+SNYQX74riGOpl96x+2jQCqEfQ2bnXu/5DPCqlRuiqyvTJM0Qjz26IVg==", "dev": true }, "js-sha256": { @@ -8310,6 +13568,21 @@ "resolved": "https://registry.npmjs.org/just-performance/-/just-performance-4.3.0.tgz", "integrity": "sha512-L7RjvtJsL0QO8xFs5wEoDDzzJwoiowRw6Rn/GnvldlchS2JQr9wFYPiwZcDfrbbujEKqKN0tvENdbjXdYhDp5Q==" }, + "keccak": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/keccak/-/keccak-3.0.3.tgz", + "integrity": "sha512-JZrLIAJWuZxKbCilMpNz5Vj7Vtb4scDG3dMXLOsbzBmQGyjwE61BbW7bJkfKKCShXiQZt3T6sBgALRtmd+nZaQ==", + "requires": { + "node-addon-api": "^2.0.0", + "node-gyp-build": "^4.2.0", + "readable-stream": "^3.6.0" + } + }, + "lazy-ass": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/lazy-ass/-/lazy-ass-1.6.0.tgz", + "integrity": "sha512-cc8oEVoctTvsFZ/Oje/kGnHbpWHYBe8IAJe4C0QNc3t8uM/0Y8+erSz/7Y1ALuXTEZTMvxXwO6YbX1ey3ujiZw==" + }, "levn": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", @@ -8342,12 +13615,26 @@ "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" }, + "lodash.clonedeep": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz", + "integrity": "sha512-H5ZhCF25riFd9uB5UCkVKo61m3S/xZk1x4wA6yp/L3RFP6Z/eHH1ymQcGLo7J3GMPfm0V/7m1tryHuGVxpqEBQ==" + }, "lodash.merge": { "version": "4.6.2", "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", "dev": true }, + "log-symbols": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", + "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", + "requires": { + "chalk": "^4.1.0", + "is-unicode-supported": "^0.1.0" + } + }, "lower-case": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/lower-case/-/lower-case-2.0.2.tgz", @@ -8368,6 +13655,11 @@ "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", "dev": true }, + "map-stream": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/map-stream/-/map-stream-0.1.0.tgz", + "integrity": "sha512-CkYQrPYZfWnu/DAmVCpTSX/xHpKZ80eKh2lAkyA6AJTef6bW+6JpbQZN5rofum7da+SyN1bi5ctTm+lTfcCW3g==" + }, "marked": { "version": "2.0.7", "resolved": "https://registry.npmjs.org/marked/-/marked-2.0.7.tgz", @@ -8384,6 +13676,11 @@ "safe-buffer": "^5.1.2" } }, + "merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==" + }, "micromatch": { "version": "4.0.5", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", @@ -8394,6 +13691,11 @@ "picomatch": "^2.3.1" } }, + "mime": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-3.0.0.tgz", + "integrity": "sha512-jSCU7/VB1loIWBZe14aEYHU/+1UMEHoaO7qxCOVJOw9GgH72VAWppxNcjU+x9a2k3GSIBXNKxXQFqRvvZ7vr3A==" + }, "mime-db": { "version": "1.52.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", @@ -8407,6 +13709,11 @@ "mime-db": "1.52.0" } }, + "mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==" + }, "minimalistic-assert": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", @@ -8426,16 +13733,34 @@ } }, "minimist": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.7.tgz", - "integrity": "sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g==", - "peer": true + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==" }, "ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" }, + "multistream": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/multistream/-/multistream-4.1.0.tgz", + "integrity": "sha512-J1XDiAmmNpRCBfIWJv+n0ymC4ABcf/Pl+5YvC5B/D2f/2+8PtHvCNxMPKiQcZyi922Hq69J2YOpb1pTywfifyw==", + "requires": { + "once": "^1.4.0", + "readable-stream": "^3.6.0" + } + }, + "mustache": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/mustache/-/mustache-4.2.0.tgz", + "integrity": "sha512-71ippSywq5Yb7/tVYyGbkBggbU8H3u5Rz56fH60jGFgr8uHwxs+aSKeqmluIVzM0m0kB7xQjKS6qPfd0b2ZoqQ==" + }, + "mute-stream": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", + "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==" + }, "nan": { "version": "2.17.0", "resolved": "https://registry.npmjs.org/nan/-/nan-2.17.0.tgz", @@ -8443,9 +13768,9 @@ "optional": true }, "nanoid": { - "version": "3.3.4", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.4.tgz", - "integrity": "sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw==" + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.6.tgz", + "integrity": "sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==" }, "natural-compare": { "version": "1.4.0", @@ -8453,6 +13778,69 @@ "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", "dev": true }, + "near-api-js": { + "version": "0.44.2", + "resolved": "https://registry.npmjs.org/near-api-js/-/near-api-js-0.44.2.tgz", + "integrity": "sha512-eMnc4V+geggapEUa3nU2p8HSHn/njtloI4P2mceHQWO8vDE1NGpnAw8FuTBrLmXSgIv9m6oocgFc9t3VNf5zwg==", + "requires": { + "bn.js": "5.2.0", + "borsh": "^0.6.0", + "bs58": "^4.0.0", + "depd": "^2.0.0", + "error-polyfill": "^0.1.3", + "http-errors": "^1.7.2", + "js-sha256": "^0.9.0", + "mustache": "^4.0.0", + "node-fetch": "^2.6.1", + "text-encoding-utf-8": "^1.0.2", + "tweetnacl": "^1.0.1" + }, + "dependencies": { + "bn.js": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.0.tgz", + "integrity": "sha512-D7iWRBvnZE8ecXiLj/9wbxH7Tk79fAh8IHaTNq1RWRixsS02W+5qS+iE9yq6RYl0asXx5tw0bLhmT5pIfbSquw==" + }, + "borsh": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/borsh/-/borsh-0.6.0.tgz", + "integrity": "sha512-sl5k89ViqsThXQpYa9XDtz1sBl3l1lI313cFUY1HKr+wvMILnb+58xpkqTNrYbelh99dY7K8usxoCusQmqix9Q==", + "requires": { + "bn.js": "^5.2.0", + "bs58": "^4.0.0", + "text-encoding-utf-8": "^1.0.2" + }, + "dependencies": { + "bn.js": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", + "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==" + } + } + } + } + }, + "near-hd-key": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/near-hd-key/-/near-hd-key-1.2.1.tgz", + "integrity": "sha512-SIrthcL5Wc0sps+2e1xGj3zceEa68TgNZDLuCx0daxmfTP7sFTB3/mtE2pYhlFsCxWoMn+JfID5E1NlzvvbRJg==", + "requires": { + "bip39": "3.0.2", + "create-hmac": "1.1.7", + "tweetnacl": "1.0.3" + } + }, + "near-seed-phrase": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/near-seed-phrase/-/near-seed-phrase-0.2.0.tgz", + "integrity": "sha512-NpmrnejpY1AdlRpDZ0schJQJtfBaoUheRfiYtQpcq9TkwPgqKZCRULV5L3hHmLc0ep7KRtikbPQ9R2ztN/3cyQ==", + "requires": { + "bip39-light": "^1.0.7", + "bs58": "^4.0.1", + "near-hd-key": "^1.2.1", + "tweetnacl": "^1.0.2" + } + }, "neo-async": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", @@ -8468,19 +13856,39 @@ "tslib": "^2.0.3" } }, + "node-addon-api": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-2.0.2.tgz", + "integrity": "sha512-Ntyt4AIXyaLIuMHF6IOoTakB3K+RWxwtsHNRxllEoA6vPwP9o4866g6YWDLUdnucilZhmkxiHwHr11gAENw+QA==" + }, "node-fetch": { - "version": "2.6.7", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", - "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.9.tgz", + "integrity": "sha512-DJm/CJkZkRjKKj4Zi4BsKVZh3ValV5IR5s7LVZnW+6YMh0W1BfNA8XSs6DLMGYlId5F3KnA70uu2qepcR08Qqg==", "requires": { "whatwg-url": "^5.0.0" } }, "node-gyp-build": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.5.0.tgz", - "integrity": "sha512-2iGbaQBV+ITgCz76ZEjmhUKAKVf7xfY1sRl4UiKQspfZMH2h06SyhNsnSVy50cwkFQDGLyif6m/6uFXHkOZ6rg==", - "optional": true + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.6.0.tgz", + "integrity": "sha512-NTZVKn9IylLwUzaKjkas1e4u2DLNcV4rdYagA4PWdPwW87Bi7z+BznyKSRwS/761tV/lzCGXplWsiaMjLqP2zQ==" + }, + "npm-run-path": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", + "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", + "requires": { + "path-key": "^3.0.0" + } + }, + "o3": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/o3/-/o3-1.0.3.tgz", + "integrity": "sha512-f+4n+vC6s4ysy7YO7O2gslWZBUu8Qj2i2OUJOvjRxQva7jVjYjB29jrr9NCjmxZQR0gzrOcv1RnqoYOeMs5VRQ==", + "requires": { + "capability": "^0.2.5" + } }, "once": { "version": "1.4.0", @@ -8490,6 +13898,14 @@ "wrappy": "1" } }, + "onetime": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "requires": { + "mimic-fn": "^2.1.0" + } + }, "optionator": { "version": "0.9.1", "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", @@ -8504,6 +13920,27 @@ "word-wrap": "^1.2.3" } }, + "ora": { + "version": "5.4.1", + "resolved": "https://registry.npmjs.org/ora/-/ora-5.4.1.tgz", + "integrity": "sha512-5b6Y85tPxZZ7QytO+BQzysW31HJku27cRIlkbAXaNx+BdcVi+LlRFmVXzeF6a7JCwJpyw5c4b+YSVImQIrBpuQ==", + "requires": { + "bl": "^4.1.0", + "chalk": "^4.1.0", + "cli-cursor": "^3.1.0", + "cli-spinners": "^2.5.0", + "is-interactive": "^1.0.0", + "is-unicode-supported": "^0.1.0", + "log-symbols": "^4.1.0", + "strip-ansi": "^6.0.0", + "wcwidth": "^1.0.1" + } + }, + "os-tmpdir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g==" + }, "p-limit": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", @@ -8550,8 +13987,7 @@ "path-key": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", - "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", - "dev": true + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==" }, "path-parse": { "version": "1.0.7", @@ -8559,6 +13995,14 @@ "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", "peer": true }, + "pause-stream": { + "version": "0.0.11", + "resolved": "https://registry.npmjs.org/pause-stream/-/pause-stream-0.0.11.tgz", + "integrity": "sha512-e3FBlXLmN/D1S+zHzanP4E/4Z60oFAa3O051qt1pxa7DEJWKAyil6upYVXCWadEnuoqa4Pkc9oUx9zsxYeRv8A==", + "requires": { + "through": "~2.3" + } + }, "pbkdf2": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.1.2.tgz", @@ -8595,12 +14039,25 @@ "react-is": "^17.0.1" } }, + "process": { + "version": "0.11.10", + "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", + "integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==" + }, "progress": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", "peer": true }, + "ps-tree": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/ps-tree/-/ps-tree-1.2.0.tgz", + "integrity": "sha512-0VnamPPYHl4uaU/nSFeZZpR21QAWRz+sRv4iW9+v/GS/J5U5iZB5BNN6J0RMoOvdx2gWM2+ZFMIm58q24e4UYA==", + "requires": { + "event-stream": "=3.3.4" + } + }, "punycode": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz", @@ -8617,6 +14074,14 @@ "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", "dev": true }, + "randombytes": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "requires": { + "safe-buffer": "^5.1.0" + } + }, "react-is": { "version": "17.0.2", "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz", @@ -8624,9 +14089,9 @@ "peer": true }, "readable-stream": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", - "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", "requires": { "inherits": "^2.0.3", "string_decoder": "^1.1.1", @@ -8647,19 +14112,13 @@ "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz", "integrity": "sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==" }, - "regexpp": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz", - "integrity": "sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==", - "dev": true - }, "resolve": { - "version": "1.22.1", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.1.tgz", - "integrity": "sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw==", + "version": "1.22.2", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.2.tgz", + "integrity": "sha512-Sb+mjNHOULsBv818T40qSPeRiuWLyaGMa5ewydRLFimneixmVy2zdivRl+AF6jaYPC8ERxGDmFSiqui6SfPd+g==", "peer": true, "requires": { - "is-core-module": "^2.9.0", + "is-core-module": "^2.11.0", "path-parse": "^1.0.7", "supports-preserve-symlinks-flag": "^1.0.0" } @@ -8670,6 +14129,20 @@ "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", "dev": true }, + "restore-cursor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz", + "integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==", + "requires": { + "onetime": "^5.1.0", + "signal-exit": "^3.0.2" + } + }, + "retry": { + "version": "0.13.1", + "resolved": "https://registry.npmjs.org/retry/-/retry-0.13.1.tgz", + "integrity": "sha512-XQBQ3I8W1Cge0Seh+6gjj03LbmRFWuoszgK9ooCpwYIrhhoO80pfq4cUkU5DkknwfOfFteRwlZ56PYOGYyFWdg==" + }, "reusify": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", @@ -8680,7 +14153,6 @@ "version": "3.0.2", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", - "dev": true, "requires": { "glob": "^7.1.3" } @@ -8695,9 +14167,9 @@ } }, "rpc-websockets": { - "version": "7.5.0", - "resolved": "https://registry.npmjs.org/rpc-websockets/-/rpc-websockets-7.5.0.tgz", - "integrity": "sha512-9tIRi1uZGy7YmDjErf1Ax3wtqdSSLIlnmL5OtOzgd5eqPKbsPpwDP5whUDO2LQay3Xp0CcHlcNSGzacNRluBaQ==", + "version": "7.5.1", + "resolved": "https://registry.npmjs.org/rpc-websockets/-/rpc-websockets-7.5.1.tgz", + "integrity": "sha512-kGFkeTsmd37pHPMaHIgN1LVKXMi0JD782v4Ds9ZKtLlwdTKjn+CxM9A9/gLT2LaOuEcEFGL98h1QWQtlOIdW0w==", "requires": { "@babel/runtime": "^7.17.2", "bufferutil": "^4.0.1", @@ -8707,19 +14179,19 @@ "ws": "^8.5.0" }, "dependencies": { - "uuid": { - "version": "8.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", - "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==" - }, "ws": { - "version": "8.11.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.11.0.tgz", - "integrity": "sha512-HPG3wQd9sNQoT9xHyNCXoDUa+Xw/VevmY9FoHyQ+g+rrMn4j6FB4np7Z0OhdTgjx6MgQLK7jwSy1YecU1+4Asg==", + "version": "8.13.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz", + "integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==", "requires": {} } } }, + "run-async": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.4.1.tgz", + "integrity": "sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ==" + }, "run-parallel": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", @@ -8729,29 +14201,12 @@ "queue-microtask": "^1.2.2" } }, - "rx-sandbox": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/rx-sandbox/-/rx-sandbox-1.0.4.tgz", - "integrity": "sha512-+/9MHDYNoF9ca/2RR+L2LloXXeQyIR3k/wjK03IicrxxlbkhmKF4ejPiWeafMWDg7otF+pnX5NE/8v/rX6ICJA==", - "peer": true, - "requires": { - "expect": "^26.6.1", - "jest-matcher-utils": "^26.6.1" - } - }, "rxjs": { - "version": "6.6.7", - "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.7.tgz", - "integrity": "sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ==", + "version": "7.8.1", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.1.tgz", + "integrity": "sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg==", "requires": { - "tslib": "^1.9.0" - }, - "dependencies": { - "tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" - } + "tslib": "^2.1.0" } }, "safe-buffer": { @@ -8759,6 +14214,11 @@ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, "sax": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.1.tgz", @@ -8769,6 +14229,21 @@ "resolved": "https://registry.npmjs.org/scrypt-js/-/scrypt-js-3.0.1.tgz", "integrity": "sha512-cdwTTnqPu0Hyvf5in5asVdZocVDTNRmR7XEcJuIzMjJeSHybHl7vpB66AzwTaIg6CLSbtjcxc8fqcySfnTkccA==" }, + "secp256k1": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/secp256k1/-/secp256k1-4.0.3.tgz", + "integrity": "sha512-NLZVf+ROMxwtEj3Xa562qgv2BK5e2WNmXPiOdVIPLgs6lyTzMvBq0aWTYMI5XCP9jZMVKOcqZLw/Wc4vDkuxhA==", + "requires": { + "elliptic": "^6.5.4", + "node-addon-api": "^2.0.0", + "node-gyp-build": "^4.2.0" + } + }, + "setprototypeof": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==" + }, "sha.js": { "version": "2.4.11", "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", @@ -8782,7 +14257,6 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", - "dev": true, "requires": { "shebang-regex": "^3.0.0" } @@ -8790,8 +14264,7 @@ "shebang-regex": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", - "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", - "dev": true + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==" }, "shelljs": { "version": "0.8.5", @@ -8815,6 +14288,11 @@ "vscode-textmate": "5.2.0" } }, + "signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==" + }, "slash": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", @@ -8836,6 +14314,14 @@ "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", "peer": true }, + "split": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/split/-/split-0.3.3.tgz", + "integrity": "sha512-wD2AeVmxXRBoX44wAycgjVpMhvbwdI2aZjCkvfNcH1YqHQvJVa1duWc73OyVGJUc05fhFaTZeQ/PYsrmyH0JVA==", + "requires": { + "through": "2" + } + }, "stack-utils": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.6.tgz", @@ -8854,9 +14340,9 @@ } }, "starknet": { - "version": "4.17.1", - "resolved": "https://registry.npmjs.org/starknet/-/starknet-4.17.1.tgz", - "integrity": "sha512-xihdf+pWUCdKK30r+fNLfg+5RHHpTNw20gvrucbcPPDnsDr2bjwtFu3UjXOtHnbys6qF8fW3ttMkctRoQ5J6Xg==", + "version": "4.22.0", + "resolved": "https://registry.npmjs.org/starknet/-/starknet-4.22.0.tgz", + "integrity": "sha512-jC9Taxb6a/ht9zmS1LU/DSLfwJKpgCJnE9AktVksc5SE/+jQMpqxsq6fm7PRiqupjiqRC1DOS8N47cj+KaGv4Q==", "requires": { "@ethersproject/bytes": "^5.6.1", "bn.js": "^5.2.1", @@ -8871,6 +14357,46 @@ "url-join": "^4.0.1" } }, + "start-server-and-test": { + "version": "1.15.5", + "resolved": "https://registry.npmjs.org/start-server-and-test/-/start-server-and-test-1.15.5.tgz", + "integrity": "sha512-o3EmkX0++GV+qsvIJ/OKWm3w91fD8uS/bPQVPrh/7loaxkpXSuAIHdnmN/P/regQK9eNAK76aBJcHt+OSTk+nA==", + "requires": { + "arg": "^5.0.2", + "bluebird": "3.7.2", + "check-more-types": "2.24.0", + "debug": "4.3.4", + "execa": "5.1.1", + "lazy-ass": "1.6.0", + "ps-tree": "1.2.0", + "wait-on": "7.0.1" + }, + "dependencies": { + "arg": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/arg/-/arg-5.0.2.tgz", + "integrity": "sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg==" + } + } + }, + "statuses": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", + "integrity": "sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA==" + }, + "stream-combiner": { + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/stream-combiner/-/stream-combiner-0.0.4.tgz", + "integrity": "sha512-rT00SPnTVyRsaSz5zgSPma/aHSOic5U1prhYdRy5HS2kTZviFpmDgzilbtsJsxiroqACmayynDN/9VzIbX5DOw==", + "requires": { + "duplexer": "~0.1.1" + } + }, + "stream-transform": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/stream-transform/-/stream-transform-3.2.6.tgz", + "integrity": "sha512-/pyOvaCQFqYTmrFhmMbnAEVo3SsTx1H39eUVPOtYeAgbEUc+rDo7GoP8LbHJgU83mKtzJe/7Nq/ipaAnUOHgJQ==" + }, "string_decoder": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", @@ -8879,21 +14405,40 @@ "safe-buffer": "~5.2.0" } }, + "string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + } + }, "strip-ansi": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, "requires": { "ansi-regex": "5.0.1" } }, + "strip-final-newline": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", + "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==" + }, "strip-json-comments": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", "dev": true }, + "strnum": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/strnum/-/strnum-1.0.5.tgz", + "integrity": "sha512-J8bbNyKKXl5qYcR36TIO8W3mVGVHrmmxsd5PAItGkmyzwJvybiw2IVq5nqd0i4LSNSkB/sx9VHllbfFdr9k1JA==" + }, "superstruct": { "version": "0.15.5", "resolved": "https://registry.npmjs.org/superstruct/-/superstruct-0.15.5.tgz", @@ -8929,6 +14474,32 @@ "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", "integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==" }, + "tmp": { + "version": "0.0.33", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", + "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", + "requires": { + "os-tmpdir": "~1.0.2" + } + }, + "tmp-promise": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/tmp-promise/-/tmp-promise-3.0.3.tgz", + "integrity": "sha512-RwM7MoPojPxsOBYnyd2hy0bxtIlVrihNs9pj5SUvY8Zz1sQcQG2tG1hSr8PDxfgEB8RNKDhqbIlroIarSNDNsQ==", + "requires": { + "tmp": "^0.2.0" + }, + "dependencies": { + "tmp": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.1.tgz", + "integrity": "sha512-76SUhtfqR2Ijn+xllcI5P1oyannHNHByD80W1q447gU3mp9G9PSpGdWmjUOHRDPiHYacIk66W7ubDTuPF3BEtQ==", + "requires": { + "rimraf": "^3.0.0" + } + } + } + }, "to-regex-range": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", @@ -8938,6 +14509,11 @@ "is-number": "^7.0.0" } }, + "toidentifier": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==" + }, "toml": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/toml/-/toml-3.0.0.tgz", @@ -8954,9 +14530,9 @@ "integrity": "sha512-up6Yvai4PYKhpNp5PkYtx50m3KbwQrqDwbuZP/ItyL64YEWHAvH6Md83LFLV/GRSk/BoUVwwgUzX6SOQSbsfAg==" }, "tron-format-address": { - "version": "0.1.8", - "resolved": "https://registry.npmjs.org/tron-format-address/-/tron-format-address-0.1.8.tgz", - "integrity": "sha512-oTtzUM43OZhQiv1p2aOVqbnev6mmJHXQrMpS3nn7zVAI/+ffA/aF+Y/vugHtYotckkromRLPEl/SR1HfJjAYQA==" + "version": "0.1.11", + "resolved": "https://registry.npmjs.org/tron-format-address/-/tron-format-address-0.1.11.tgz", + "integrity": "sha512-Jx2i3R1yXrEMQsfc2jueAI71ivnySzdeva6SiSM/pddwj8TK7PVABSP6s/iYcTRI63GxJEgGMmOJXNNKoBmbQw==" }, "ts-custom-error": { "version": "3.3.1", @@ -8985,9 +14561,14 @@ } }, "tslib": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.1.tgz", - "integrity": "sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==" + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.5.0.tgz", + "integrity": "sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg==" + }, + "tweetnacl": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-1.0.3.tgz", + "integrity": "sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw==" }, "type-check": { "version": "0.4.0", @@ -9009,16 +14590,46 @@ "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-4.0.0.tgz", "integrity": "sha512-6dOYeZfS3O9RtRD1caom0sMxgK59b27+IwoNy8RDPsmslSGOyU+mpTamlaIW7aNKi90ZQZ9DFaZL3YRoiSCULQ==" }, + "typedoc": { + "version": "0.20.37", + "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.20.37.tgz", + "integrity": "sha512-9+qDhdc4X00qTNOtii6QX2z7ndAeWVOso7w3MPSoSJdXlVhpwPfm1yEp4ooKuWA9fiQILR8FKkyjmeqa13hBbw==", + "peer": true, + "requires": { + "colors": "^1.4.0", + "fs-extra": "^9.1.0", + "handlebars": "^4.7.7", + "lodash": "^4.17.21", + "lunr": "^2.3.9", + "marked": "~2.0.3", + "minimatch": "^3.0.0", + "progress": "^2.0.3", + "shelljs": "^0.8.4", + "shiki": "^0.9.3", + "typedoc-default-themes": "^0.12.10" + } + }, "typedoc-default-themes": { "version": "0.12.10", "resolved": "https://registry.npmjs.org/typedoc-default-themes/-/typedoc-default-themes-0.12.10.tgz", "integrity": "sha512-fIS001cAYHkyQPidWXmHuhs8usjP5XVJjWB8oZGqkTowZaz3v7g3KDZeeqE82FBrmkAnIBOY3jgy7lnPnqATbA==", "peer": true }, + "typedoc-plugin-cname": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/typedoc-plugin-cname/-/typedoc-plugin-cname-1.0.1.tgz", + "integrity": "sha512-f97SS5RzDCVBa7Frg1VketIMAkEl3OTvBs9wM8lLEkJVWCIG2yXnszglA82on39gFwQ1tyq8tiuxRgb4569GpA==", + "requires": {} + }, "typescript": { - "version": "4.9.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.4.tgz", - "integrity": "sha512-Uz+dTXYzxXXbsFpM86Wh3dKCxrQqUcVMxwU54orwlJjOpO3ao8L7j5lH+dWfTwgCwIuM9GQ2kvVotzYJMXTBZg==" + "version": "4.9.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", + "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==" + }, + "u3": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/u3/-/u3-0.1.1.tgz", + "integrity": "sha512-+J5D5ir763y+Am/QY6hXNRlwljIeRMZMGs0cT6qqZVVzzT3X3nFPXVyPOFRMOR4kupB0T8JnCdpWdp6Q/iXn3w==" }, "uglify-js": { "version": "3.17.4", @@ -9053,9 +14664,9 @@ }, "dependencies": { "punycode": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.2.0.tgz", - "integrity": "sha512-LN6QV1IJ9ZhxWTNdktaPClrNfp8xdSAYS0Zk2ddX7XsXZAxckMHPCBcHRo0cTcEIgYPRiGEkmji3Idkh2yFtYw==", + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", + "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==", "dev": true } } @@ -9101,9 +14712,9 @@ "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" }, "uuid": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.0.0.tgz", - "integrity": "sha512-jOXGuXZAWdsTH7eZLtyXMqUb9EcWMGZNbL9YcGBJl4MH4nrxHmZJhEHvyLFrkxo+28uLb/NYRcStH48fnD0Vzw==" + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==" }, "v8-compile-cache-lib": { "version": "3.0.1", @@ -9111,6 +14722,11 @@ "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", "dev": true }, + "vlq": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/vlq/-/vlq-2.0.4.tgz", + "integrity": "sha512-aodjPa2wPQFkra1G8CzJBTHXhgk3EVSwxSWXNPr1fgdFLUb8kvLV1iEb6rFgasIsjP82HWI6dsb5Io26DDnasA==" + }, "vscode-oniguruma": { "version": "1.7.0", "resolved": "https://registry.npmjs.org/vscode-oniguruma/-/vscode-oniguruma-1.7.0.tgz", @@ -9123,6 +14739,26 @@ "integrity": "sha512-Uw5ooOQxRASHgu6C7GVvUxisKXfSgW4oFlO+aa+PAkgmH89O3CXxEEzNRNtHSqtXFTl0nAC1uYj0GMSH27uwtQ==", "peer": true }, + "wait-on": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/wait-on/-/wait-on-7.0.1.tgz", + "integrity": "sha512-9AnJE9qTjRQOlTZIldAaf/da2eW0eSRSgcqq85mXQja/DW3MriHxkpODDSUEg+Gri/rKEcXUZHe+cevvYItaog==", + "requires": { + "axios": "^0.27.2", + "joi": "^17.7.0", + "lodash": "^4.17.21", + "minimist": "^1.2.7", + "rxjs": "^7.8.0" + } + }, + "wcwidth": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz", + "integrity": "sha512-XHPEwS0q6TaxcvG85+8EYkbiCux2XtWG2mkc47Ng2A77BQu9+DqIOJldST4HgPkuea7dvKSj5VgX3P1d4rW8Tg==", + "requires": { + "defaults": "^1.0.3" + } + }, "webidl-conversions": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", @@ -9146,7 +14782,6 @@ "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "dev": true, "requires": { "isexe": "^2.0.0" } @@ -9176,15 +14811,25 @@ "integrity": "sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q==", "peer": true }, + "wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "requires": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + } + }, "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" }, "ws": { - "version": "7.4.6", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.4.6.tgz", - "integrity": "sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A==", + "version": "7.5.9", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.9.tgz", + "integrity": "sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==", "requires": {} }, "xhr2-cookies": { @@ -9197,18 +14842,25 @@ } }, "xml2js": { - "version": "0.4.19", - "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.19.tgz", - "integrity": "sha512-esZnJZJOiJR9wWKMyuvSE1y6Dq5LCuJanqhxslH2bxM6duahNZ+HMpCLhBQGZkbX6xRf8x1Y2eJlgt2q3qo49Q==", + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.5.0.tgz", + "integrity": "sha512-drPFnkQJik/O+uPKpqSgr22mpuFHqKdbS835iAQrUC73L2F5WkboIRd63ai/2Yg6I1jzifPFKH2NTK+cfglkIA==", "requires": { "sax": ">=0.6.0", - "xmlbuilder": "~9.0.1" + "xmlbuilder": "~11.0.0" + }, + "dependencies": { + "sax": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", + "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==" + } } }, "xmlbuilder": { - "version": "9.0.7", - "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-9.0.7.tgz", - "integrity": "sha512-7YXTQc3P2l9+0rjaUbLwMKRhtmwg1M1eDf6nag7urC7pIPYLD9W/jmzQ4ptRSUbodw5S0jfoGTflLemQibSpeQ==" + "version": "11.0.1", + "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-11.0.1.tgz", + "integrity": "sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA==" }, "yn": { "version": "3.1.1", diff --git a/package.json b/package.json index 2a0cd29dde9..97581fd8064 100644 --- a/package.json +++ b/package.json @@ -29,6 +29,7 @@ "borsh": "^0.7.0", "dotenv": "^8.6.0", "ethers": "^5.6.5", + "graphql": "^16.6.0", "graphql-request": "^4.0.0", "hi-base32": "^0.5.1", "js-sha512": "^0.8.0", diff --git a/projects/solv-protocol/abi.json b/projects/solv-protocol/abi.json new file mode 100644 index 00000000000..30267ceb217 --- /dev/null +++ b/projects/solv-protocol/abi.json @@ -0,0 +1,123 @@ +{ + "concrete": { + "inputs": [], + "name": "concrete", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + "slotTotalValue": { + "inputs": [ + { + "internalType": "uint256", + "name": "slot_", + "type": "uint256" + } + ], + "name": "slotTotalValue", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + "slotBaseInfo": { + "inputs": [ + { + "internalType": "uint256", + "name": "slot_", + "type": "uint256" + } + ], + "name": "slotBaseInfo", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "issuer", + "type": "address" + }, + { + "internalType": "address", + "name": "currency", + "type": "address" + }, + { + "internalType": "uint64", + "name": "valueDate", + "type": "uint64" + }, + { + "internalType": "uint64", + "name": "maturity", + "type": "uint64" + }, + { + "internalType": "uint64", + "name": "createTime", + "type": "uint64" + }, + { + "internalType": "bool", + "name": "transferable", + "type": "bool" + }, + { + "internalType": "bool", + "name": "isValid", + "type": "bool" + } + ], + "internalType": "struct IEarnConcrete.SlotBaseInfo", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + "decimals": { + "constant": true, + "inputs": [], + "name": "decimals", + "outputs": [ + { + "name": "", + "type": "uint8" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + "balanceOf": { + "constant": true, + "inputs": [ + { + "name": "_owner", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "name": "balance", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + } +} \ No newline at end of file diff --git a/projects/solv-protocol/index.js b/projects/solv-protocol/index.js index bb0e6808757..b831f530d2d 100644 --- a/projects/solv-protocol/index.js +++ b/projects/solv-protocol/index.js @@ -1,79 +1,184 @@ -const { sumTokens, } = require('../helper/unwrapLPs') -const { staking } = require('../helper/staking'); -const { getChainTransform } = require("../helper/portedTokens"); -const { getConfig } = require('../helper/cache') +const sdk = require("@defillama/sdk"); +const axios = require('axios') +const { request, gql } = require("graphql-request"); +const { default: BigNumber } = require("bignumber.js"); +const { transformBscAddress, transformPolygonAddress, transformArbitrumAddress, getChainTransform } = require("../helper/portedTokens"); +const abi = require("./abi.json"); // token list const tokenListsApiEndpoint = "https://token-list.solv.finance/vouchers-prod.json" -// Staking Tvls -const solvEthereumTokenAddress = '0x256F2d67e52fE834726D2DDCD8413654F5Eb8b53' -const solvEthereumPoolAddress = '0x7D0C93DcAD6f6B38C81431d7262CF0E48770B81a' -const solvBscTokenAddress = '0xC073c4eD65622A9423b5e5BDe2BFC8B81EBC471c' -const solvBscPoolAddress = '0xE5742912EDb4599779ACC1CE2acB6a06E01f1089' +// The Graph +const graphUrlList = { + ethereum: 'https://api.studio.thegraph.com/query/40045/solv-payable-factory-prod/v0.0.1', + bsc: 'https://api.thegraph.com/subgraphs/name/slov-payable/solv-v3-earn-factory', + arbitrum: 'https://api.studio.thegraph.com/query/40045/solv-payable-factory-arbitrum/v0.0.1', +} const ethereumTVL = async (timestamp, block, chainBlocks) => { - const transform = await getChainTransform('ethereum'); - return tvl(timestamp, block, chainBlocks, "ethereum", 1, transform); + return tvl(timestamp, block, chainBlocks, "ethereum", 1); } const polygonTVL = async (timestamp, block, chainBlocks) => { - const transform = await getChainTransform('polygon'); - return tvl(timestamp, block, chainBlocks, "polygon", 137, transform); + return tvl(timestamp, block, chainBlocks, "polygon", 137); } const arbitrumTVL = async (timestamp, block, chainBlocks) => { - const transform = await getChainTransform('arbitrum'); - return tvl(timestamp, block, chainBlocks, "arbitrum", 42161, transform); + return tvl(timestamp, block, chainBlocks, "arbitrum", 42161); }; const bscTVL = async (timestamp, block, chainBlocks) => { - const transform = await getChainTransform('bsc'); - return tvl(timestamp, block, chainBlocks, "bsc", 56, transform); + return tvl(timestamp, block, chainBlocks, "bsc", 56); }; -async function tvl(timestamp, block, chainBlocks, network, chainId, transform) { +async function tvl(timestamp, block, chainBlocks, network, chainId) { let balances = {}; // Setup the balances object const tokens = await tokenList(chainId); - let tokenPairs = [] - for (let i = 0; i < tokens.length; i++) { - const token = tokens[i]; - tokenPairs.push([ - token.address, - token.pool - ]) + try { + const balanceOfList = ( + await sdk.api.abi.multiCall({ + abi: abi.balanceOf, + calls: tokens.map((index) => ({ + target: index.address, + params: [index.pool] + })), + block, + chain: network, + }) + ).output.map((balanceOf) => balanceOf.output); + for (let i = 0; i < balanceOfList.length; i++) { + sdk.util.sumSingleBalance(balances, `${network}:${tokens[i]["address"]}`, balanceOfList[i]); + } + } catch (error) { + } - await sumTokens(balances, tokenPairs, chainBlocks[network], network, transform) + if (graphUrlList[network]) { + balances = await (graphEarn(balances, timestamp, chainBlocks, network)) + } return balances; } +async function graphEarn(balances, timestamp, chainBlocks, network) { + const block = chainBlocks[network]; + const slots = await getSlot(timestamp, network); + + const concretes = await concrete(slots, block, network); + + const totalValues = ( + await sdk.api.abi.multiCall({ + abi: abi.slotTotalValue, + calls: slots.map((index) => ({ + target: concretes[index.contractAddress], + params: [index.slot] + })), + block, + chain: network, + }) + ).output.map((totalValue) => totalValue.output); + + const baseInfos = ( + await sdk.api.abi.multiCall({ + abi: abi.slotBaseInfo, + calls: slots.map((index) => ({ + target: concretes[index.contractAddress], + params: [index.slot] + })), + block, + chain: network, + }) + ).output.map((baseInfo) => baseInfo.output); + + const decimalList = ( + await sdk.api.abi.multiCall({ + abi: abi.decimals, + calls: baseInfos.map((index) => ({ + target: index[1], + })), + block, + chain: network, + }) + ).output.map((baseInfo) => baseInfo.output); + + for (let i = 0; i < totalValues.length; i++) { + const decimals = decimalList[i]; + const balance = BigNumber(totalValues[i]).div(BigNumber(10).pow(18 - decimals)).toNumber(); + sdk.util.sumSingleBalance(balances, `${network}:${baseInfos[i][1]}`, balance); + } + + return balances +} + async function tokenList(chainId) { let tokens = []; - const allTokens = (await getConfig('solv-protocol', tokenListsApiEndpoint)).tokens; + const allTokens = (await axios.get(tokenListsApiEndpoint)).data.tokens; for (let token of allTokens) { if (chainId == token.chainId) { - if (token.extensions.voucher.underlyingToken && token.extensions.voucher.underlyingToken.symbol != "SOLV") { - tokens.push({ - address: token.extensions.voucher.underlyingToken.address, - pool: token.extensions.voucher.vestingPool - }) + if (token.extensions.voucher.underlyingToken != undefined) { + if (token.extensions.voucher.underlyingToken.symbol != "SOLV" && token.extensions.voucher.underlyingToken.symbol.indexOf("_") == -1) { + tokens.push({ + address: token.extensions.voucher.underlyingToken.address, + pool: token.extensions.voucher.vestingPool + }) + } } } } return tokens; } + +async function concrete(slots, block, chain) { + var slotsList = []; + var only = {}; + for (var i = 0; i < slots.length; i++) { + if (!only[slots[i].contractAddress]) { + slotsList.push(slots[i]); + only[slots[i].contractAddress] = true; + } + } + + const concreteLists = ( + await sdk.api.abi.multiCall({ + calls: slotsList.map((index) => ({ + target: index.contractAddress, + })), + abi: abi.concrete, + chain, + block + }) + ).output.map((concrete) => concrete.output); + + let concretes = {}; + for (var i = 0; i < concreteLists.length; i++) { + concretes[slotsList[i].contractAddress] = concreteLists[i]; + } + + return concretes; +} + + +async function getSlot(timestamp, chain) { + const slotDataQuery = gql` + query BondSlotInfos { + bondSlotInfos(first: 1000, where:{maturity_gt:${timestamp}}) { + contractAddress + slot + } + } +`; + const slots = (await request(graphUrlList[chain], slotDataQuery)).bondSlotInfos; + + return slots; +} // node test.js projects/solv-protocol/index.js module.exports = { ethereum: { - tvl: ethereumTVL, - staking: staking(solvEthereumPoolAddress, solvEthereumTokenAddress) + tvl: ethereumTVL }, bsc: { - tvl: bscTVL, - staking: staking(solvBscPoolAddress, solvBscTokenAddress, "bsc") + tvl: bscTVL }, polygon: { tvl: polygonTVL @@ -81,4 +186,4 @@ module.exports = { arbitrum: { tvl: arbitrumTVL } -} +}; From 6527b08b469a7441b24ebc39bca40df72812e9d7 Mon Sep 17 00:00:00 2001 From: buchaoqun Date: Wed, 10 May 2023 18:20:19 +0800 Subject: [PATCH 0025/1974] try catch error --- projects/solv-protocol/index.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/projects/solv-protocol/index.js b/projects/solv-protocol/index.js index b831f530d2d..055b8637eaf 100644 --- a/projects/solv-protocol/index.js +++ b/projects/solv-protocol/index.js @@ -50,7 +50,9 @@ async function tvl(timestamp, block, chainBlocks, network, chainId) { sdk.util.sumSingleBalance(balances, `${network}:${tokens[i]["address"]}`, balanceOfList[i]); } } catch (error) { - + for (let k = 0; k < tokens.length; k++) { + sdk.util.sumSingleBalance(balances, `${network}:${tokens[k]["address"]}`, 0); + } } if (graphUrlList[network]) { @@ -151,8 +153,8 @@ async function concrete(slots, block, chain) { ).output.map((concrete) => concrete.output); let concretes = {}; - for (var i = 0; i < concreteLists.length; i++) { - concretes[slotsList[i].contractAddress] = concreteLists[i]; + for (var k = 0; k < concreteLists.length; k++) { + concretes[slotsList[k].contractAddress] = concreteLists[k]; } return concretes; From 8ea813573ae9cb7cd8390b80fe07bc3c6f3b55af Mon Sep 17 00:00:00 2001 From: sara-abbasi2 <106956907+sara-abbasi2@users.noreply.github.com> Date: Mon, 22 May 2023 14:42:35 +0200 Subject: [PATCH 0026/1974] Create crowdSwap --- projects/crowdSwap | 1 + 1 file changed, 1 insertion(+) create mode 100644 projects/crowdSwap diff --git a/projects/crowdSwap b/projects/crowdSwap new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/projects/crowdSwap @@ -0,0 +1 @@ + From 65555d0eec0dcbee851bc6e5ba5c3eb082b7fd88 Mon Sep 17 00:00:00 2001 From: sara-abbasi2 <106956907+sara-abbasi2@users.noreply.github.com> Date: Mon, 22 May 2023 15:14:31 +0200 Subject: [PATCH 0027/1974] Delete crowdSwap --- projects/crowdSwap | 1 - 1 file changed, 1 deletion(-) delete mode 100644 projects/crowdSwap diff --git a/projects/crowdSwap b/projects/crowdSwap deleted file mode 100644 index 8b137891791..00000000000 --- a/projects/crowdSwap +++ /dev/null @@ -1 +0,0 @@ - From b350f8fcd3403dae8b8e0c8cacdb84ab7ffb5d83 Mon Sep 17 00:00:00 2001 From: saehrimnir Date: Tue, 23 May 2023 15:07:56 +0300 Subject: [PATCH 0028/1974] add USDT/USDC/BTCB for BSC TVL --- projects/pepe-bridge/index.js | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/projects/pepe-bridge/index.js b/projects/pepe-bridge/index.js index 4a944260f31..ac3183fc9cf 100644 --- a/projects/pepe-bridge/index.js +++ b/projects/pepe-bridge/index.js @@ -3,18 +3,26 @@ const { nullAddress, sumTokensExport, } = require('../helper/unwrapLPs'); const config = { ethereum: [ - [[nullAddress], '0x882260324AD5A87bF5007904B4A8EF87023c856A'], // ETH + [[nullAddress], '0x882260324AD5A87bF5007904B4A8EF87023c856A'], [ [ - ADDRESSES.ethereum.USDT, // USDT - ADDRESSES.ethereum.USDC, // USDC - ADDRESSES.ethereum.WBTC, // WBTC + ADDRESSES.ethereum.USDT, + ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.WBTC, ], '0x0de7b091A21BD439bdB2DfbB63146D9cEa21Ea83' ] ], bsc: [ - [[nullAddress], '0xF1632012f6679Fcf464721433AFAAe9c11ad9e03'] // BNB + [[nullAddress], '0xF1632012f6679Fcf464721433AFAAe9c11ad9e03'], + [ + [ + ADDRESSES.bsc.USDT, + ADDRESSES.bsc.USDC, + ADDRESSES.bsc.BTCB, + ], + '0x8DF12786EC0E34e60D4c52f9052ba4e536e9367a' + ] ] } module.exports = {}; From 6e68dd9b9d03e84672b0e04469684a0c5cd45a01 Mon Sep 17 00:00:00 2001 From: Bruno Wu Date: Thu, 1 Jun 2023 13:25:35 +0100 Subject: [PATCH 0029/1974] Add staking and update hallmarks --- projects/gridex/index.js | 44 +++++++++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 16 deletions(-) diff --git a/projects/gridex/index.js b/projects/gridex/index.js index 4646c9fef40..5e261ccb72e 100644 --- a/projects/gridex/index.js +++ b/projects/gridex/index.js @@ -1,35 +1,47 @@ const { sumTokens2 } = require("../helper/unwrapLPs"); -const { getLogs } = require('../helper/cache/getLogs') +const { getLogs } = require("../helper/cache/getLogs"); +const { stakings } = require("../helper/staking"); + +const stakingContract = ["0x035E9062286FD19460B3E22970ebB5691EED2C25"]; +const GDX = ["0x2F27118E3D2332aFb7d165140Cf1bB127eA6975d"]; module.exports = { methodology: `Counts the tokens locked on order book grid`, hallmarks: [ [1672531200, "GDX Airdrop #1"], - [1672531200, "GDX Airdrop #2"], + [1677628800, "GDX Airdrop #2"], [1678838400, "Maker Rewards Launch"], - [1672531200, "GDX Airdrop #3"], + [1679616000, "GDX Airdrop #3"], + [1682550000, "GDX Airdrop #4"], ], }; const config = { - arbitrum: { factory: '0x32d1F0Dce675902f89D72251DB4AB1d728efa19c', fromBlock: 64404349, }, -} + arbitrum: { + factory: "0x32d1F0Dce675902f89D72251DB4AB1d728efa19c", + fromBlock: 64404349, + }, +}; -Object.keys(config).forEach(chain => { - const { factory, fromBlock, } = config[chain] +Object.keys(config).forEach((chain) => { + const { factory, fromBlock } = config[chain]; module.exports[chain] = { - tvl: async (_, _b, _cb, { api, }) => { + tvl: async (_, _b, _cb, { api }) => { const logs = await getLogs({ api, target: factory, - topics: ['0xfe23981920c53fdfe858f29ee2c426fb8bf164162938c157cdf27bac46fccab7'], - eventAbi: 'event GridCreated (address indexed token0, address indexed token1, int24 indexed resolution, address grid)', + topics: [ + "0xfe23981920c53fdfe858f29ee2c426fb8bf164162938c157cdf27bac46fccab7", + ], + eventAbi: + "event GridCreated (address indexed token0, address indexed token1, int24 indexed resolution, address grid)", onlyArgs: true, fromBlock, - }) + }); - const ownerTokens = logs.map(i => [[i.token0, i.token1], i.grid]) - return sumTokens2({ api, ownerTokens, }) - } - } -}) \ No newline at end of file + const ownerTokens = logs.map((i) => [[i.token0, i.token1], i.grid]); + return sumTokens2({ api, ownerTokens }); + }, + staking: stakings(stakingContract, GDX), + }; +}); From 8220eb2f70b2ab84d652e6314a70ce79d480f418 Mon Sep 17 00:00:00 2001 From: Bruno Wu Date: Thu, 1 Jun 2023 13:32:53 +0100 Subject: [PATCH 0030/1974] Add staking hallmark --- projects/gridex/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/gridex/index.js b/projects/gridex/index.js index 5e261ccb72e..576048cb3da 100644 --- a/projects/gridex/index.js +++ b/projects/gridex/index.js @@ -12,6 +12,7 @@ module.exports = { [1677628800, "GDX Airdrop #2"], [1678838400, "Maker Rewards Launch"], [1679616000, "GDX Airdrop #3"], + [1682294400, "GDX Staking Launch"], [1682550000, "GDX Airdrop #4"], ], }; From 4b0c051a1b6c543e3e3f384af90212e83b09bbf0 Mon Sep 17 00:00:00 2001 From: saehrimnir Date: Tue, 6 Jun 2023 18:43:51 +0300 Subject: [PATCH 0031/1974] add CRV token --- projects/pepe-bridge/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/pepe-bridge/index.js b/projects/pepe-bridge/index.js index ac3183fc9cf..afb92928364 100644 --- a/projects/pepe-bridge/index.js +++ b/projects/pepe-bridge/index.js @@ -9,6 +9,7 @@ const config = { ADDRESSES.ethereum.USDT, ADDRESSES.ethereum.USDC, ADDRESSES.ethereum.WBTC, + ADDRESSES.ethereum.CRV, ], '0x0de7b091A21BD439bdB2DfbB63146D9cEa21Ea83' ] From 68690d6e0aee2fb7ca839c479eb26fbfee8bee60 Mon Sep 17 00:00:00 2001 From: Akshay Gupta Date: Sun, 18 Jun 2023 16:20:15 -0400 Subject: [PATCH 0032/1974] savvy adapter --- projects/savvy/abi.json | 5 +++++ projects/savvy/contracts.json | 3 +++ projects/savvy/index.js | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+) create mode 100644 projects/savvy/abi.json create mode 100644 projects/savvy/contracts.json create mode 100644 projects/savvy/index.js diff --git a/projects/savvy/abi.json b/projects/savvy/abi.json new file mode 100644 index 00000000000..f883f9348f8 --- /dev/null +++ b/projects/savvy/abi.json @@ -0,0 +1,5 @@ +{ + "totalDebt": "function getTotalDebtAmount() external view returns (uint256)", + "totalValueLocked": "function getTotalValueLocked() external view returns (uint256))", + "totalStaked": "function getTotalSVYStakedUSD() external view returns (uint256)" +} \ No newline at end of file diff --git a/projects/savvy/contracts.json b/projects/savvy/contracts.json new file mode 100644 index 00000000000..082428e992e --- /dev/null +++ b/projects/savvy/contracts.json @@ -0,0 +1,3 @@ +{ + "infoAggregator": "0x68D54ff41BA47355b95Bd477Bcf4d5ff4b2c2A59" +} diff --git a/projects/savvy/index.js b/projects/savvy/index.js new file mode 100644 index 00000000000..a9e06b1033e --- /dev/null +++ b/projects/savvy/index.js @@ -0,0 +1,32 @@ +const abi = require("./abi.json"); +const contracts = require("./contracts.json"); + +async function tvl(_, _1, _2, { api }) { + return await api.call({ + abi: abi.totalValueLocked, + target: contracts.infoAggregator + }); +} + +async function staking() { + return await api.call({ + abi: abi.totalStaked, + target: contracts.infoAggregator + }); +} + +async function borrowed() { + return await api.call({ + abi: abi.totalDebt, + target: contracts.infoAggregator + }); +} + +module.exports = { + methodology: 'The calculated TVL is the current USD sum of all user deposits and SVY tokens staked in veSVY.', + arbitrum: { + tvl, + staking, + borrowed + } +} \ No newline at end of file From 2a12dca6d4197d25e251315a4d4a65712d2890b7 Mon Sep 17 00:00:00 2001 From: buchaoqun Date: Mon, 19 Jun 2023 20:33:30 +0800 Subject: [PATCH 0033/1974] new list for solv v3 --- .../abi.json | 0 projects/solv-protocol-v3/index.js | 100 ++++++++++++++++++ projects/solv-protocol/index.js | 81 +------------- 3 files changed, 101 insertions(+), 80 deletions(-) rename projects/{solv-protocol => solv-protocol-v3}/abi.json (100%) create mode 100644 projects/solv-protocol-v3/index.js diff --git a/projects/solv-protocol/abi.json b/projects/solv-protocol-v3/abi.json similarity index 100% rename from projects/solv-protocol/abi.json rename to projects/solv-protocol-v3/abi.json diff --git a/projects/solv-protocol-v3/index.js b/projects/solv-protocol-v3/index.js new file mode 100644 index 00000000000..81ec0c49507 --- /dev/null +++ b/projects/solv-protocol-v3/index.js @@ -0,0 +1,100 @@ +const { default: BigNumber } = require("bignumber.js"); +const abi = require("./abi.json"); +const { cachedGraphQuery } = require("../helper/cache"); + +// The Graph +const graphUrlList = { + ethereum: 'https://api.studio.thegraph.com/query/40045/solv-payable-factory-prod/version/latest', + bsc: 'https://api.thegraph.com/subgraphs/name/slov-payable/solv-v3-earn-factory', + arbitrum: 'https://api.studio.thegraph.com/query/40045/solv-payable-factory-arbitrum/version/latest', +} + +const filterSlot = [ + "24463698369598535545979799361840946803505909684060624549876546521811809090281", + "35721610559268442584760110830641808857798079704888818123868248602816498531758", + "71384167217207433357665203528199852676074195415546219658272700694805764131696", + "94855382073997775269187449187472275689000980913702165029893305070390069014119" +]; + +async function tvl() { + const { api } = arguments[3]; + const network = api.chain; + const slots = await getSlot(api.timestamp, network); + if (slots.length <= 0) { + return; + } + const concretes = await concrete(slots, api); + + const totalValues = await api.multiCall({ + abi: abi.slotTotalValue, + calls: slots.map((index) => ({ + target: concretes[index.contractAddress], + params: [index.slot] + })), + }) + + const baseInfos = await api.multiCall({ + abi: abi.slotBaseInfo, + calls: slots.map((index) => ({ + target: concretes[index.contractAddress], + params: [index.slot] + })), + }) + + const decimalList = await api.multiCall({ + abi: abi.decimals, + calls: baseInfos.map(i => i[1]), + }) + + for (let i = 0; i < totalValues.length; i++) { + const decimals = decimalList[i]; + const balance = BigNumber(totalValues[i]).div(BigNumber(10).pow(18 - decimals)).toNumber(); + api.add(baseInfos[i][1], balance) + } +} + +async function concrete(slots, api) { + var slotsList = []; + var only = {}; + for (var i = 0; i < slots.length; i++) { + if (!only[slots[i].contractAddress]) { + slotsList.push(slots[i]); + only[slots[i].contractAddress] = true; + } + } + + const concreteLists = await api.multiCall({ + calls: slotsList.map((index) => index.contractAddress), + abi: abi.concrete, + }) + + let concretes = {}; + for (var k = 0; k < concreteLists.length; k++) { + concretes[slotsList[k].contractAddress] = concreteLists[k]; + } + + return concretes; +} + + +async function getSlot(timestamp, chain) { + const slotDataQuery = `query BondSlotInfos { + bondSlotInfos(first: 1000, where:{maturity_gt:${timestamp}}) { + contractAddress + slot + } + }`; + const slots = (await cachedGraphQuery(`solv-protocol/graph-data/${chain}`, graphUrlList[chain], slotDataQuery)).bondSlotInfos; + let slotList = []; + for (let i = 0; i < slots.length; i++) { + const bondSlotInfo = slots[i]; + if (filterSlot.indexOf(bondSlotInfo.slot) == -1) { + slotList.push(bondSlotInfo) + } + } + return slotList; +} + +['ethereum', 'bsc', 'arbitrum'].forEach(chain => { + module.exports[chain] = { tvl } +}) \ No newline at end of file diff --git a/projects/solv-protocol/index.js b/projects/solv-protocol/index.js index 5978e4fb1fb..a03f135fecc 100644 --- a/projects/solv-protocol/index.js +++ b/projects/solv-protocol/index.js @@ -1,59 +1,15 @@ -const { default: BigNumber } = require("bignumber.js"); -const abi = require("./abi.json"); -const { getConfig, cachedGraphQuery } = require("../helper/cache"); +const { getConfig } = require("../helper/cache"); const { sumTokens2 } = require("../helper/unwrapLPs"); // token list const tokenListsApiEndpoint = "https://token-list.solv.finance/vouchers-prod.json" -// The Graph -const graphUrlList = { - ethereum: 'https://api.studio.thegraph.com/query/40045/solv-payable-factory-prod/v0.0.1', - bsc: 'https://api.thegraph.com/subgraphs/name/slov-payable/solv-v3-earn-factory', - arbitrum: 'https://api.studio.thegraph.com/query/40045/solv-payable-factory-arbitrum/v0.0.1', -} async function tvl() { const { api } = arguments[3] const chainId = api.getChainId() const tokens = await tokenList(chainId); await sumTokens2({ api, tokensAndOwners: tokens.map(i => [i.address, i.pool]), permitFailure: true }) - await graphEarn(api) -} - -async function graphEarn(api) { - const network = api.chain - if (!graphUrlList[network]) return; - const slots = await getSlot(api.timestamp, network); - - const concretes = await concrete(slots, api); - - const totalValues = await api.multiCall({ - abi: abi.slotTotalValue, - calls: slots.map((index) => ({ - target: concretes[index.contractAddress], - params: [index.slot] - })), - }) - - const baseInfos = await api.multiCall({ - abi: abi.slotBaseInfo, - calls: slots.map((index) => ({ - target: concretes[index.contractAddress], - params: [index.slot] - })), - }) - - const decimalList = await api.multiCall({ - abi: abi.decimals, - calls: baseInfos.map(i => i[1]), - }) - - for (let i = 0; i < totalValues.length; i++) { - const decimals = decimalList[i]; - const balance = BigNumber(totalValues[i]).div(BigNumber(10).pow(18 - decimals)).toNumber(); - api.add(baseInfos[i][1], balance) - } } async function tokenList(chainId) { @@ -75,41 +31,6 @@ async function tokenList(chainId) { return tokens; } -async function concrete(slots, api) { - var slotsList = []; - var only = {}; - for (var i = 0; i < slots.length; i++) { - if (!only[slots[i].contractAddress]) { - slotsList.push(slots[i]); - only[slots[i].contractAddress] = true; - } - } - - const concreteLists = await api.multiCall({ - calls: slotsList.map((index) => index.contractAddress), - abi: abi.concrete, - }) - - let concretes = {}; - for (var k = 0; k < concreteLists.length; k++) { - concretes[slotsList[k].contractAddress] = concreteLists[k]; - } - - return concretes; -} - - -async function getSlot(timestamp, chain) { - const slotDataQuery = `query BondSlotInfos { - bondSlotInfos(first: 1000, where:{maturity_gt:${timestamp}}) { - contractAddress - slot - } - }`; - const slots = (await cachedGraphQuery(`solv-protocol/graph-data/${chain}`, graphUrlList[chain], slotDataQuery)).bondSlotInfos; - return slots; -} - ['ethereum', 'bsc', 'polygon', 'arbitrum'].forEach(chain => { module.exports[chain] = { tvl } }) \ No newline at end of file From 1e445a0293aa7860a74b548aa61ed5b18e859010 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 21 Jun 2023 10:08:38 +0200 Subject: [PATCH 0034/1974] add github details to PR form --- pull_request_template.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pull_request_template.md b/pull_request_template.md index 23483082980..efc392486a3 100644 --- a/pull_request_template.md +++ b/pull_request_template.md @@ -59,3 +59,5 @@ ##### methodology (what is being counted as tvl, how is tvl being calculated): + +##### Github org/user (Optional, if your code is open source, we can track activity): \ No newline at end of file From ddd7a5265e711f06938ad5cf30efd9bcdbbed462 Mon Sep 17 00:00:00 2001 From: Brdd Mnk Date: Wed, 21 Jun 2023 11:19:45 +0300 Subject: [PATCH 0035/1974] add new Sushi strategy and combine MIM + Sushi in arbitrum and add new Aura strategy in ethereum (#6604) * new strategy * add new Sushi strategy and combine MIM + Sushi in arbitrum and add new Aura strategy in ethereum --- projects/parallax/abis/prllxERC20.json | 4 + projects/parallax/contracts.json | 26 ++++ projects/parallax/getPrice.js | 89 ++++++++++++++ projects/parallax/index.js | 162 +++++++++++++++++++++---- 4 files changed, 260 insertions(+), 21 deletions(-) create mode 100644 projects/parallax/abis/prllxERC20.json create mode 100644 projects/parallax/contracts.json create mode 100644 projects/parallax/getPrice.js diff --git a/projects/parallax/abis/prllxERC20.json b/projects/parallax/abis/prllxERC20.json new file mode 100644 index 00000000000..ba0a575e0dc --- /dev/null +++ b/projects/parallax/abis/prllxERC20.json @@ -0,0 +1,4 @@ +{ + "strategyToId": "function strategyToId(address) view returns (uint256)", + "strategies": "function strategies(uint256) view returns (tuple fees, uint256 totalDeposited, uint256 totalStaked, uint256 lastCompoundTimestamp, uint256 cap, uint256 rewardPerBlock, uint256 rewardPerShare, uint256 lastUpdatedBlockNumber, address strategy, uint32 timelock, bool isActive, address rewardToken, uint256 usersCount)" +} \ No newline at end of file diff --git a/projects/parallax/contracts.json b/projects/parallax/contracts.json new file mode 100644 index 00000000000..fe1e98e7e7f --- /dev/null +++ b/projects/parallax/contracts.json @@ -0,0 +1,26 @@ +{ + "eth": { + "parallaxAddress": "0xd8935F1369E1dAc77CD37e664BC13ffdd741B962", + "strategyAddress": "0x9E6121e89dD50B5D02362A9fdb7EC1fAd3D15725", + "lpAddress": "0x5aee1e99fe86960377de9f88689616916d5dcabe", + "feedAddress": "0x5f4ec3df9cbd43714fe2740f5e3616155c5b8419", + "usdc": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" + }, + "arbitrum": { + "mim": { + "parallaxCoreAddress": "0x07F78cC2668F9Bb152c4026E801df68Ed3AB9858", + "strategyAddress": "0xbf81Ba9D10F96ce0bb1206DE5F2d5B363f9796A9", + "parallaxCoreAddressOld": "0x74A819d4925dC9f473F398863666Ac787B48e1d0", + "strategyAddressOld": "0x7b8eFCd93ee71A0480Ad4dB06849B75573168AF4", + "lpAddresss": "0x30dF229cefa463e991e29D42DB0bae2e122B2AC7", + "usdc": "0xff970a61a04b1ca14834a43f5de4533ebddb5cc8" + }, + "sushi": { + "parallaxAddr": "0xDCBEA8b2142Fe5E97BE9545FCFB30af812685Fb6", + "strategyAddrSushi": "0xb53BbF686b600857B209B863c1Bce2C83acef123", + "strategyAddrGMX": "0xF7caD5Ec40b5980Bd741346eAeE019c6E2b5D373", + "parallaxBackendAddr": "0x1724623a721a094f8Ba9d271c9BE8be83e64f74f", + "usdc": "0xff970a61a04b1ca14834a43f5de4533ebddb5cc8" + } + } +} \ No newline at end of file diff --git a/projects/parallax/getPrice.js b/projects/parallax/getPrice.js new file mode 100644 index 00000000000..1c859d4ebb8 --- /dev/null +++ b/projects/parallax/getPrice.js @@ -0,0 +1,89 @@ +const get_virtual_price = "function get_virtual_price() view returns (uint256)"; +const getRate = "function getRate() view returns (uint256)"; +const latestRoundData = + "function latestRoundData() view returns (uint80 roundId,int256 answer,uint256 startedAt,uint256 updatedAt,uint80 answeredInRound)"; +const getPrice = "function getPrice() view returns (uint256 sushi,uint256 gmx)"; +const { default: BigNumber } = require("bignumber.js"); + +const getPriceMIM = async (tokenAddress, api) => { + const priceLpWei = await api.call({ + target: tokenAddress, + abi: get_virtual_price, + }) + + const decimals = await api.call({ + target: tokenAddress, + abi: "erc20:decimals", + }) + + const tokenPrice = new BigNumber(priceLpWei).div(`1e${decimals}`); + + return { + price: tokenPrice, + decimals, + }; +}; + +const getPriceAura = async ( + tokenAddress, + feedAddress, + api +) => { + const decimals = + await api.call({ + target: tokenAddress, + abi: "erc20:decimals", + }) + + const rate = + await api.call({ + target: tokenAddress, + abi: getRate, + }) + + const getLatestRoundData = + await api.call({ + target: feedAddress, + abi: latestRoundData, + }) + + const ethPriceInUSD = parseInt(getLatestRoundData.answer) / 10 ** 8; + const priceETH = new BigNumber(rate).div(`1e${decimals}`); + + const tokenPrice = new BigNumber(priceETH * ethPriceInUSD).div( + `1e${decimals}` + ); + + return { + price: tokenPrice, + decimals, + }; +}; + +const getPriceSushi = async (backendAddress, api) => { + const sushiDecimals = 14, + gmxDecimals = 8; + + const sushiGmxPrice = await api.call({ + target: backendAddress, + abi: getPrice, + }) + + const sushiPrice = new BigNumber(sushiGmxPrice.sushi).div( + `1e${sushiDecimals}` + ); + const gmxPrice = new BigNumber(sushiGmxPrice.gmx).div(`1e${gmxDecimals}`); + + return { + sushiPrice: sushiPrice, + gmxPrice: gmxPrice, + sushiDecimals, + gmxDecimals, + }; +}; + +module.exports = { + getPriceMIM, + getPriceAura, + getPriceSushi, +}; diff --git a/projects/parallax/index.js b/projects/parallax/index.js index 94b445f1305..c5dbe95a58e 100644 --- a/projects/parallax/index.js +++ b/projects/parallax/index.js @@ -1,30 +1,150 @@ -async function tvl(time, _ethBlock, _1, { api }) { - await Promise.all([addMIMStrategy(api)]); +const sdk = require("@defillama/sdk"); +const { default: BigNumber } = require("bignumber.js"); + +const { getPriceMIM, getPriceAura, getPriceSushi } = require("./getPrice"); + +const prllxERC20 = require("./abis/prllxERC20.json"); +const contracts = require("./contracts.json"); + +async function ethTvl(time, _ethBlock, { ethereum: block }, { api }) { + const strategyId = await api.call({ + target: contracts.eth.parallaxAddress, + params: contracts.eth.strategyAddress, + abi: prllxERC20["strategyToId"], + }) + + const strategy = await api.call({ + target: contracts.eth.parallaxAddress, + params: strategyId, + abi: prllxERC20["strategies"], + }) + + const balances = {}; + const { price, decimals } = await getPriceAura(contracts.eth.lpAddress, contracts.eth.feedAddress, api,); + + // const totalStaked = new BigNumber(strategy.totalStaked).div(`1e${decimals}`); + const totalStakedTVL = price + .times(strategy.totalStaked) + .times(1e6) + .toFixed(0); + + sdk.util.sumSingleBalance( + balances, + `ethereum:${contracts.eth.usdc}`, + totalStakedTVL + ); + + return balances; } -async function addMIMStrategy(api) { - const token = "0x30dF229cefa463e991e29D42DB0bae2e122B2AC7"; - const sorbettiere = "0x839de324a1ab773f76a53900d70ac1b913d2b387"; - // const strategy = "0x7b8eFCd93ee71A0480Ad4dB06849B75573168AF4"; - const strategies = [ - "0x7b8eFCd93ee71A0480Ad4dB06849B75573168AF4", - "0xbf81Ba9D10F96ce0bb1206DE5F2d5B363f9796A9", - ]; - for (let iterator = 0; iterator < strategies.length; iterator++) { - const strategy = strategies[iterator]; - const [bal] = await api.call({ - abi: "function userInfo(uint256, address) view returns (uint256,uint256,uint256)", - target: sorbettiere, - params: [0, strategy], - }); - - api.add(token, bal); - } +async function arbitrumTvl(time, _ethBlock, { arbitrum: block }, { api }) { + const balances = {}; + + const strategyId = await api.call({ + target: contracts.arbitrum.mim.parallaxCoreAddress, + params: contracts.arbitrum.mim.strategyAddress, + abi: prllxERC20["strategyToId"], + }) + + const strategy = await api.call({ + target: contracts.arbitrum.mim.parallaxCoreAddress, + params: strategyId, + abi: prllxERC20["strategies"], + }) + + const { price, decimals } = await getPriceMIM(contracts.arbitrum.mim.lpAddresss, api); + + const totalStaked = new BigNumber(strategy.totalStaked).div(`1e${decimals}`); + const totalStakedTVLMIM = price.times(totalStaked).times(1e6).toFixed(0); + + const strategyIdOld = await api.call({ + target: contracts.arbitrum.mim.parallaxCoreAddressOld, + params: contracts.arbitrum.mim.strategyAddressOld, + abi: prllxERC20["strategyToId"], + }) + + const strategyOld = + await api.call({ + target: contracts.arbitrum.mim.parallaxCoreAddressOld, + params: strategyIdOld, + abi: prllxERC20["strategies"], + }) + + const totalStakedOld = new BigNumber(strategyOld.totalStaked).div( + `1e${decimals}` + ); + const totalStakedTVLMIMOld = price + .times(totalStakedOld) + .times(1e6) + .toFixed(0); + + const totalStakedTVLMIMAll = + Number(totalStakedTVLMIM) + Number(totalStakedTVLMIMOld); + + sdk.util.sumSingleBalance( + balances, + `arbitrum:${contracts.arbitrum.mim.usdc}`, + totalStakedTVLMIMAll + ); + + const strategySushiId = + await api.call({ + target: contracts.arbitrum.sushi.parallaxAddr, + params: contracts.arbitrum.sushi.strategyAddrSushi, + abi: prllxERC20["strategyToId"], + }) + + const strategyGmxId = await api.call({ + target: contracts.arbitrum.sushi.parallaxAddr, + params: contracts.arbitrum.sushi.strategyAddrGMX, + abi: prllxERC20["strategyToId"], + }) + + const strategySushi = await api.call({ + target: contracts.arbitrum.sushi.parallaxAddr, + params: strategySushiId, + abi: prllxERC20["strategies"], + }) + + const strategyGmx = await api.call({ + target: contracts.arbitrum.sushi.parallaxAddr, + params: strategyGmxId, + abi: prllxERC20["strategies"], + }) + + const { sushiPrice, gmxPrice, sushiDecimals, gmxDecimals } = await getPriceSushi(contracts.arbitrum.sushi.parallaxBackendAddr, api,); + + const totalStakedSushi = new BigNumber(strategySushi.totalStaked).div(`1e18`); + const totalStakedGmx = new BigNumber(strategyGmx.totalStaked).div(`1e18`); + + const totalStakedTVLSushi = sushiPrice + .times(totalStakedSushi) + .times(1e6) + .toFixed(0); + + const totalStakedTVLGmx = gmxPrice + .times(totalStakedGmx) + .times(1e6) + .toFixed(0); + + const totalStakedTVL = + Number(totalStakedTVLSushi) + Number(totalStakedTVLGmx); + + sdk.util.sumSingleBalance( + balances, + `arbitrum:${contracts.arbitrum.sushi.usdc}`, + totalStakedTVL + ); + + return balances; } module.exports = { methodology: "TVL comes from the Staking Vaults", arbitrum: { - tvl, + tvl: arbitrumTvl, + }, + ethereum: { + tvl: ethTvl, }, }; From 181a9e4020f1963ab02df4abc2907468c780833d Mon Sep 17 00:00:00 2001 From: Full Stack Developer Date: Wed, 21 Jun 2023 16:20:55 +0800 Subject: [PATCH 0036/1974] update vault addresses (#6605) --- projects/equito-finance/index.js | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/projects/equito-finance/index.js b/projects/equito-finance/index.js index 5f2410f4552..5ae93486b55 100644 --- a/projects/equito-finance/index.js +++ b/projects/equito-finance/index.js @@ -2,9 +2,15 @@ const ADDRESSES = require("../helper/coreAssets.json"); const { sumTokensExport } = require("../helper/sumTokens"); // Addresses -const ALGO_VAULT = "XYE5SU66M6JV24REYQJMXUMIWK54X5I6TWYP25RIA3NH7YEEY6UPPWM3RY"; -const ETH_VAULT = "0x274af57Cc969cA96980BA043332D4fb79F496708"; -const BSC_VAULT = "0x9Aa09a1D7ACD6Bb7b4bB5ae4c6F91279E78502a8"; +const ALGO_VAULT1 = + "XYE5SU66M6JV24REYQJMXUMIWK54X5I6TWYP25RIA3NH7YEEY6UPPWM3RY"; +const ETH_VAULT1 = "0x274af57Cc969cA96980BA043332D4fb79F496708"; +const BSC_VAULT1 = "0x9Aa09a1D7ACD6Bb7b4bB5ae4c6F91279E78502a8"; + +const ALGO_VAULT2 = + "56CF35MFZHMCWTVJZLNBTP62UJKFRRKW47GTSOVATZONVEZ6ASSWRWOOHM"; +const ETH_VAULT2 = "0x4d753245f273e119Be944Ae180A17DfE35258e1e"; +const BSC_VAULT2 = "0x7aFeCFABBA462121262D81d764e289aB77966aec"; module.exports = { hallmarks: [ @@ -13,7 +19,17 @@ module.exports = { ], methodology: "TVL counts native tokens locked in EquitoFinance bridge vaults.", - algorand: { tvl: sumTokensExport({ owner: ALGO_VAULT,}) }, - ethereum: { tvl: sumTokensExport({ owner: ETH_VAULT, tokens: [ADDRESSES.null]}) }, - bsc: { tvl: sumTokensExport({ owner: BSC_VAULT, tokens: [ADDRESSES.null]}) }, + algorand: { tvl: sumTokensExport({ owners: [ALGO_VAULT1, ALGO_VAULT2] }) }, + ethereum: { + tvl: sumTokensExport({ + owners: [ETH_VAULT1, ETH_VAULT2], + tokens: [ADDRESSES.null], + }), + }, + bsc: { + tvl: sumTokensExport({ + owners: [BSC_VAULT1, BSC_VAULT2], + tokens: [ADDRESSES.null], + }), + }, }; From 9d04fd4d6a56378a1aac19a12b1b38bd931d42fd Mon Sep 17 00:00:00 2001 From: Strategic Reserve Date: Wed, 21 Jun 2023 01:22:17 -0700 Subject: [PATCH 0037/1974] Update index.js (#6606) Add Stellaswap, Sushiswap, Ramses --- projects/visor/index.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/projects/visor/index.js b/projects/visor/index.js index bd831603b75..bc6d11f0e24 100644 --- a/projects/visor/index.js +++ b/projects/visor/index.js @@ -25,6 +25,7 @@ const HYPE_REGISTRY = { "0x0Ac4C7b794f3D7e7bF1093A4f179bA792CF15055", // Uniswap "0xAeC731F69Fa39aD84c7749E913e3bC227427Adfd", // Quickswap "0xcAC19d43C9558753d7535978A370055614Ce832E", // Retro + "0x97686103B3E7238Ca6c2C439146B30adBd84a593", // Sushiswap ], polygon_zkevm: [ "0xD08B593eb3460B7aa5Ce76fFB0A3c5c938fd89b8", // Quickswap @@ -35,6 +36,9 @@ const HYPE_REGISTRY = { arbitrum: [ "0x66CD859053c458688044d816117D5Bdf42A56813", // Uniswap "0x37595FCaF29E4fBAc0f7C1863E3dF2Fe6e2247e9", // Zyberswap + "0x0f867F14b39a5892A39841a03bA573426DE4b1d0", // Sushiswap + "0x34Ffbd9Db6B9bD8b095A0d156de69a2AD2944666", // Ramses + "0xa216C2b6554A0293f69A1555dd22f4b7e60Fe907", // Camelot ], bsc: [ "0x0b4645179C1b668464Df01362fC6219a7ab3234c", // Uniswap @@ -42,6 +46,7 @@ const HYPE_REGISTRY = { ], moonbeam: [ "0xB7dfC304D9cd88D98A262cE5B6a39Bb9d6611063", // Beamswap + "0x6002D7714e8038f2058e8162b0b86c0b19c31908", // Stellaswap ], celo: [ "0x0F548d7AD1A0CB30D1872b8C18894484d76e1569", // Uniswap From b90ae94ccb0fb90aa745741a73960e6bbc0b45b8 Mon Sep 17 00:00:00 2001 From: Cian <96416801+NatureLab@users.noreply.github.com> Date: Wed, 21 Jun 2023 17:00:23 +0800 Subject: [PATCH 0038/1974] Add optimism data for cian. (#6609) * Add arbitrum data for cian. * Add optimism for cian. --- projects/cian/index.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/projects/cian/index.js b/projects/cian/index.js index 62506014f00..474631f237f 100644 --- a/projects/cian/index.js +++ b/projects/cian/index.js @@ -25,6 +25,13 @@ async function fetchArbitrum() { return toUSDTBalances(value); } +async function fetchOptimism() { + const value = await get("https://data.cian.app/optimism/api/v1/tvl"); + + return toUSDTBalances(value); +} + + module.exports = { misrepresentedTokens: true, doublecounted: true, @@ -41,4 +48,7 @@ module.exports = { arbitrum: { tvl: fetchArbitrum, }, + optimism: { + tvl: fetchOptimism, + }, }; From eb2e3486bdc5c8cfdf0c4ba318e2316c1bcbcf0c Mon Sep 17 00:00:00 2001 From: Brdd Mnk Date: Wed, 21 Jun 2023 13:31:07 +0300 Subject: [PATCH 0039/1974] removed old strategy contracts (#6610) * new strategy * add new Sushi strategy and combine MIM + Sushi in arbitrum and add new Aura strategy in ethereum * code refactor * remove old contracts --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/parallax/index.js | 87 ++++++++++++++++++++------------------ 1 file changed, 47 insertions(+), 40 deletions(-) diff --git a/projects/parallax/index.js b/projects/parallax/index.js index c5dbe95a58e..100250b8a7a 100644 --- a/projects/parallax/index.js +++ b/projects/parallax/index.js @@ -11,16 +11,20 @@ async function ethTvl(time, _ethBlock, { ethereum: block }, { api }) { target: contracts.eth.parallaxAddress, params: contracts.eth.strategyAddress, abi: prllxERC20["strategyToId"], - }) + }); const strategy = await api.call({ target: contracts.eth.parallaxAddress, params: strategyId, abi: prllxERC20["strategies"], - }) + }); const balances = {}; - const { price, decimals } = await getPriceAura(contracts.eth.lpAddress, contracts.eth.feedAddress, api,); + const { price, decimals } = await getPriceAura( + contracts.eth.lpAddress, + contracts.eth.feedAddress, + api + ); // const totalStaked = new BigNumber(strategy.totalStaked).div(`1e${decimals}`); const totalStakedTVL = price @@ -44,75 +48,78 @@ async function arbitrumTvl(time, _ethBlock, { arbitrum: block }, { api }) { target: contracts.arbitrum.mim.parallaxCoreAddress, params: contracts.arbitrum.mim.strategyAddress, abi: prllxERC20["strategyToId"], - }) + }); const strategy = await api.call({ target: contracts.arbitrum.mim.parallaxCoreAddress, params: strategyId, abi: prllxERC20["strategies"], - }) + }); - const { price, decimals } = await getPriceMIM(contracts.arbitrum.mim.lpAddresss, api); + const { price, decimals } = await getPriceMIM( + contracts.arbitrum.mim.lpAddresss, + api + ); const totalStaked = new BigNumber(strategy.totalStaked).div(`1e${decimals}`); const totalStakedTVLMIM = price.times(totalStaked).times(1e6).toFixed(0); - const strategyIdOld = await api.call({ - target: contracts.arbitrum.mim.parallaxCoreAddressOld, - params: contracts.arbitrum.mim.strategyAddressOld, - abi: prllxERC20["strategyToId"], - }) - - const strategyOld = - await api.call({ - target: contracts.arbitrum.mim.parallaxCoreAddressOld, - params: strategyIdOld, - abi: prllxERC20["strategies"], - }) - - const totalStakedOld = new BigNumber(strategyOld.totalStaked).div( - `1e${decimals}` - ); - const totalStakedTVLMIMOld = price - .times(totalStakedOld) - .times(1e6) - .toFixed(0); - - const totalStakedTVLMIMAll = - Number(totalStakedTVLMIM) + Number(totalStakedTVLMIMOld); + // const strategyIdOld = await api.call({ + // target: contracts.arbitrum.mim.parallaxCoreAddressOld, + // params: contracts.arbitrum.mim.strategyAddressOld, + // abi: prllxERC20["strategyToId"], + // }) + // + // const strategyOld = + // await api.call({ + // target: contracts.arbitrum.mim.parallaxCoreAddressOld, + // params: strategyIdOld, + // abi: prllxERC20["strategies"], + // }) + // + // const totalStakedOld = new BigNumber(strategyOld.totalStaked).div( + // `1e${decimals}` + // ); + // const totalStakedTVLMIMOld = price + // .times(totalStakedOld) + // .times(1e6) + // .toFixed(0); + + // const totalStakedTVLMIMAll = + // Number(totalStakedTVLMIM) + Number(totalStakedTVLMIMOld); sdk.util.sumSingleBalance( balances, `arbitrum:${contracts.arbitrum.mim.usdc}`, - totalStakedTVLMIMAll + totalStakedTVLMIM ); - const strategySushiId = - await api.call({ - target: contracts.arbitrum.sushi.parallaxAddr, - params: contracts.arbitrum.sushi.strategyAddrSushi, - abi: prllxERC20["strategyToId"], - }) + const strategySushiId = await api.call({ + target: contracts.arbitrum.sushi.parallaxAddr, + params: contracts.arbitrum.sushi.strategyAddrSushi, + abi: prllxERC20["strategyToId"], + }); const strategyGmxId = await api.call({ target: contracts.arbitrum.sushi.parallaxAddr, params: contracts.arbitrum.sushi.strategyAddrGMX, abi: prllxERC20["strategyToId"], - }) + }); const strategySushi = await api.call({ target: contracts.arbitrum.sushi.parallaxAddr, params: strategySushiId, abi: prllxERC20["strategies"], - }) + }); const strategyGmx = await api.call({ target: contracts.arbitrum.sushi.parallaxAddr, params: strategyGmxId, abi: prllxERC20["strategies"], - }) + }); - const { sushiPrice, gmxPrice, sushiDecimals, gmxDecimals } = await getPriceSushi(contracts.arbitrum.sushi.parallaxBackendAddr, api,); + const { sushiPrice, gmxPrice, sushiDecimals, gmxDecimals } = + await getPriceSushi(contracts.arbitrum.sushi.parallaxBackendAddr, api); const totalStakedSushi = new BigNumber(strategySushi.totalStaked).div(`1e18`); const totalStakedGmx = new BigNumber(strategyGmx.totalStaked).div(`1e18`); From 55ea0814f9ca690e5ec1866f334a2288447da2f7 Mon Sep 17 00:00:00 2001 From: young Date: Wed, 21 Jun 2023 18:32:13 +0800 Subject: [PATCH 0040/1974] =?UTF-8?q?MineFi=EF=BC=9AThe=20TVL=20adapter=20?= =?UTF-8?q?was=20added=20for=20the=20first=20time=20(#6607)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 项目初始化 * 变更tvl合约地址 * 修复测试不通过的问题 --------- Co-authored-by: Young --- projects/MineFi/index.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 projects/MineFi/index.js diff --git a/projects/MineFi/index.js b/projects/MineFi/index.js new file mode 100644 index 00000000000..d853f5d55e0 --- /dev/null +++ b/projects/MineFi/index.js @@ -0,0 +1,24 @@ +const sdk = require('@defillama/sdk'); +const ADDRESSES = require('../helper/coreAssets.json') +const MINEFI_CONTRACT = "0xeCa50369cb0cDBaE173C9c81c1B48212adc4b501"; + +async function tvl(_, _1, _2, { api }) { + + const collateralBalance = await api.call({ + abi: 'function getTvl() external view returns (uint256)', + target: MINEFI_CONTRACT, + }); + + api.add(ADDRESSES.null,collateralBalance) +} + + + +module.exports = { + timetravel: false, + misrepresentedTokens: false, + methodology: 'counts the number of pledge filecoins in the minefi contract', + filecoin: { + tvl + } +}; \ No newline at end of file From 9a9f1b6c2644d811de242cbc432ad561ca115594 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Wed, 21 Jun 2023 17:14:35 +0100 Subject: [PATCH 0041/1974] add hallmark --- projects/gplx/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/gplx/index.js b/projects/gplx/index.js index ea81658a643..1d18f4a4033 100644 --- a/projects/gplx/index.js +++ b/projects/gplx/index.js @@ -1,6 +1,9 @@ const { gmxExports } = require('../helper/gmx') module.exports = { + hallmarks: [ + [1687320000, "Token supply compromise"] + ], pulse:{ tvl: gmxExports({ vault: '0xC2311efFE60b0dC2491148Ff1bd46F08D64ADC98', }) } From c71cfa30545d76a4d1b21b6bfc66d9bfaabe9092 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Wed, 21 Jun 2023 20:17:43 +0100 Subject: [PATCH 0042/1974] add hallmarks --- projects/KyborgExchange/index.js | 3 +++ projects/Zolidly/index.js | 3 +++ projects/avatr/index.js | 3 +++ projects/zks-miner/index.js | 3 +++ 4 files changed, 12 insertions(+) diff --git a/projects/KyborgExchange/index.js b/projects/KyborgExchange/index.js index b1559929ba8..bf26c8fa31c 100644 --- a/projects/KyborgExchange/index.js +++ b/projects/KyborgExchange/index.js @@ -6,6 +6,9 @@ const config = { } module.exports = { + hallmarks: [ + [1684108800, "Rug Pull"] + ], methodology: `Counts the tokens balances of the KyborgHub contract`, }; diff --git a/projects/Zolidly/index.js b/projects/Zolidly/index.js index 5dc73960484..ebb6c6a5586 100644 --- a/projects/Zolidly/index.js +++ b/projects/Zolidly/index.js @@ -2,6 +2,9 @@ const { getUniTVL } = require('../helper/unknownTokens'); module.exports = { misrepresentedTokens: true, + hallmarks: [ + [1684713600, "Rug Pull"] + ], era: { tvl: getUniTVL({ factory: '0x6E1315819908Eaa036405f405c033cC2BfFBFc75', diff --git a/projects/avatr/index.js b/projects/avatr/index.js index 5b0fd50509d..e73fd8cec0b 100644 --- a/projects/avatr/index.js +++ b/projects/avatr/index.js @@ -23,6 +23,9 @@ async function tvl(timestamp, block, chainBlocks, { api }) { } module.exports = { + hallmarks: [ + [1682726400, "Rug Pull"] + ], ethereum: { tvl, }, diff --git a/projects/zks-miner/index.js b/projects/zks-miner/index.js index c69d66fc5c1..9591eaf13e1 100644 --- a/projects/zks-miner/index.js +++ b/projects/zks-miner/index.js @@ -6,6 +6,9 @@ const DIAMOND_MINER = "0x755747467d97619a670e228eBEc8eFE285c37F01"; const GOLD_MINER = "0x340e443C85ecd7eB1E918744D4A35A1e6101bbd4"; module.exports = { + hallmarks: [ + [1682726400, "Rug Pull"] + ], methodology: 'TLV silver, diamond and gold is total amount miner deposit to contract silver, diamond and gold', era: { tvl: sumTokensExport({ owners: [SILVER_MINER, DIAMOND_MINER, GOLD_MINER,], tokens: [nullAddress] }) From d7f00696d57f77de81f04868913721cbdffa49df Mon Sep 17 00:00:00 2001 From: PinjamLabs <125521147+PinjamLabs@users.noreply.github.com> Date: Thu, 22 Jun 2023 05:20:14 +0800 Subject: [PATCH 0043/1974] added pinjam project (#6600) * added pinjam project * pinjam: code refactor --------- Co-authored-by: joseph Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/pinjam/index.js | 57 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 projects/pinjam/index.js diff --git a/projects/pinjam/index.js b/projects/pinjam/index.js new file mode 100644 index 00000000000..c9f719f2867 --- /dev/null +++ b/projects/pinjam/index.js @@ -0,0 +1,57 @@ +const { getLogs, getAddress } = require('../helper/cache/getLogs') +const { staking } = require("../helper/staking"); + +const stakingContract = "0x6413707acd0eF29E54e4f7eE931bb00575868eA4"; +const PINKAV = "0xE5274E38E91b615D8822e8512a29A16FF1B9C4Af"; +const config = { + kava: { lendingPool: "0x11C3D91259b1c2Bd804344355C6A255001F7Ba1e", fromBlock: 5281411, }, +}; + +async function getTokens(api) { + const { lendingPool, fromBlock } = config[api.chain] + const logs = await getLogs({ + api, + target: lendingPool, + topics: ['0x9f8f649e3f624ae845ed20c597f2841f852ba62903a53736c2b36d67869ca919'], + fromBlock, + }) + return logs.map(log => getAddress(log.topics[1])) +} + +async function tvl(_, _b, _cb, { api, }) { + const { lendingPool } = config[api.chain] + const tokens = await getTokens(api) + const bals = await api.multiCall({ abi: abi.getTotalLiquidity, calls: tokens, target: lendingPool }) + const borrows = await api.multiCall({ abi: abi.getTotalDebt, calls: tokens, target: lendingPool }) + api.addTokens(tokens, bals) + api.addTokens(tokens, borrows.map(i => i * -1)) +} + +async function borrowed(_, _b, _cb, { api, }) { + const { lendingPool } = config[api.chain] + const tokens = await getTokens(api) + const bals = await api.multiCall({ abi: abi.getTotalDebt, calls: tokens, target: lendingPool }) + api.addTokens(tokens, bals) +} + +module.exports = { + methodology: + "Counts the total tokens supplied to the lending pool and the total tokens borrowed from the lending pool.", + kava: { + staking: staking(stakingContract, PINKAV), + }, +}; + + +Object.keys(config).forEach(chain => { + module.exports[chain] = { + ...(module.exports[chain] || {}), + tvl, borrowed, + } +}) + +const abi = { + "getSupportedAsset": "function getSupportedAsset(uint256 _index) view returns (address)", + "getTotalDebt": "function getTotalDebt(address _underlyingAsset) view returns (uint256)", + "getTotalLiquidity": "function getTotalLiquidity(address _underlyingAsset) view returns (uint256)", +} From 43a23043724c8a55390eca9fbca7fda37574729e Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Thu, 22 Jun 2023 00:15:26 +0100 Subject: [PATCH 0044/1974] update staking address --- projects/mayfair/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/mayfair/index.js b/projects/mayfair/index.js index 2ba744db36b..57eb0a20889 100644 --- a/projects/mayfair/index.js +++ b/projects/mayfair/index.js @@ -1,7 +1,7 @@ const { staking } = require('../helper/staking'); -const token = "0xF9DF075716B2D9B95616341DC6bC64c85e56645c"; -const masterchef = "0xe401c80962c521E751454Fc1C9ff34014e0b8FFB"; +const token = "0xf9df075716b2d9b95616341dc6bc64c85e56645c"; +const masterchef = "0x5F54638dade598B9c478EcaB330C3E62861d00C1"; module.exports = { arbitrum: { From e1903683a389bb1f680a8477893a16fcb43e6fda Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Thu, 22 Jun 2023 03:28:18 +0100 Subject: [PATCH 0045/1974] add hallmarks --- projects/cemetery/index.js | 3 +++ projects/fdoge/index.js | 3 +++ projects/nightmare/index.js | 3 +++ projects/one-ring/index.js | 3 +++ projects/treehousefinance/index.js | 3 +++ projects/valleyswap/index.js | 7 ++++--- 6 files changed, 19 insertions(+), 3 deletions(-) diff --git a/projects/cemetery/index.js b/projects/cemetery/index.js index 3e5da335250..cf94ed96647 100644 --- a/projects/cemetery/index.js +++ b/projects/cemetery/index.js @@ -19,6 +19,9 @@ async function tvl(timestamp, block, chainBlocks) { module.exports = { methodology: "TVL includes all farms in MasterChef contract", + hallmarks: [ + [1646524800,"Rug Pull"] + ], fantom: { tvl, staking: staking(hauntchef, haunt, "fantom"), diff --git a/projects/fdoge/index.js b/projects/fdoge/index.js index 7003938ba6f..88bb0528be0 100644 --- a/projects/fdoge/index.js +++ b/projects/fdoge/index.js @@ -11,6 +11,9 @@ const pool2LPs = [ module.exports = { deadFrom: 1648765747, + hallmarks: [ + [1645488000, "Rug Pull"] + ], misrepresentedTokens: true, ...tombTvl(token, shares, rewardPool, masonry, pool2LPs, "fantom", undefined, false, pool2LPs[1]) } diff --git a/projects/nightmare/index.js b/projects/nightmare/index.js index 3d477c96ed6..be948559b7f 100644 --- a/projects/nightmare/index.js +++ b/projects/nightmare/index.js @@ -19,6 +19,9 @@ async function tvl(timestamp, block, chainBlocks) { module.exports = { methodology: "TVL includes all farms in MasterChef contract", + hallmarks: [ + [1646179200, "Rug Pull"] + ], fantom: { tvl, staking: staking(fearchef, fear, "fantom"), diff --git a/projects/one-ring/index.js b/projects/one-ring/index.js index f8e671959c3..7742ba6a291 100644 --- a/projects/one-ring/index.js +++ b/projects/one-ring/index.js @@ -59,6 +59,9 @@ async function tvlPolygon(timestamp, block, chainBlocks) { } module.exports = { + hallmarks: [ + [1647907200, "Rug Pull"] + ], fantom: { tvl: tvlFantom, }, diff --git a/projects/treehousefinance/index.js b/projects/treehousefinance/index.js index 538fb4b77c3..86ec1db83e5 100644 --- a/projects/treehousefinance/index.js +++ b/projects/treehousefinance/index.js @@ -6,4 +6,7 @@ const leaf = "0x1777850a0c498D38424CeA45fd324C68f06D0830" module.exports = { ...masterChefExports(chef, "avax", leaf, false), methodology: "TVL includes all farms in MasterChef contract", + hallmarks: [ + [1647043200, "Rug Pull"] + ] } \ No newline at end of file diff --git a/projects/valleyswap/index.js b/projects/valleyswap/index.js index c9c7bc04587..93f82ef8a9b 100644 --- a/projects/valleyswap/index.js +++ b/projects/valleyswap/index.js @@ -3,9 +3,6 @@ const { getUniTVL } = require('../helper/unknownTokens') module.exports = { start: 411656, oasis: { - hallmarks: [ - [1681743600,"Remove Fake USDT"] - ], tvl: getUniTVL({ factory: '0xa25464822b505968eEc9A45C43765228c701d35f', useDefaultCoreAssets: true, @@ -13,4 +10,8 @@ module.exports = { }), }, misrepresentedTokens: true, + hallmarks: [ + [1681743600,"Remove Fake USDT"], + [1654214400, "EvoDefi bridge depeg"] + ], }; From b893280b88b74b2800b41e0113674270a04752cb Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Thu, 22 Jun 2023 03:45:41 +0100 Subject: [PATCH 0046/1974] add new hallmarks --- projects/2doge/index.js | 3 +++ projects/phantom-finance/index.js | 3 +++ 2 files changed, 6 insertions(+) diff --git a/projects/2doge/index.js b/projects/2doge/index.js index 483866161ff..10470022eb7 100644 --- a/projects/2doge/index.js +++ b/projects/2doge/index.js @@ -65,4 +65,7 @@ module.exports = { staking: stakingPricedLP(masonryAddress, tshareTokenAddress, "fantom", "0xB254973e067AF44eB4D506e7117A33C4F3F77783", "fantom"), treasury }, + hallmarks: [ + [1646179200, "Rug Pull"] + ] }; diff --git a/projects/phantom-finance/index.js b/projects/phantom-finance/index.js index fde52454c55..48212740d3b 100644 --- a/projects/phantom-finance/index.js +++ b/projects/phantom-finance/index.js @@ -18,6 +18,9 @@ async function tvl(timestamp, block, chainBlocks) { } module.exports = { + hallmarks: [ + [1646179200, "Rug Pull"] + ], deadFrom: 1648765747, methodology: "TVL includes all farms in MasterChef contract", fantom: { From d66dc2991743e925ee01bd65d43c20b9f5dbc33b Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 22 Jun 2023 09:20:13 +0200 Subject: [PATCH 0047/1974] oz to tory oz --- projects/meld-gold/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/meld-gold/index.js b/projects/meld-gold/index.js index 46aeb04aeb3..0d1058f7c90 100644 --- a/projects/meld-gold/index.js +++ b/projects/meld-gold/index.js @@ -6,8 +6,8 @@ async function tvl() { const api = new sdk.ChainApi({}) let totalMeldMarketCap = 0 - // Gold is priced in oz, silver is priced in oz, but Meld Tokens are both priced in grams - const ozToGrams = 28.349523 + // Gold is priced in tory oz, silver is priced in oz, but Meld Tokens are both priced in grams + const ozToGrams = 31.10347687 // Meld tokens const assetInfo = [ From 00b44055258fbfedc83214bfab93e7a8b5f053c5 Mon Sep 17 00:00:00 2001 From: sypcsnb <61001576+sypcsnb@users.noreply.github.com> Date: Thu, 22 Jun 2023 14:22:20 +0700 Subject: [PATCH 0048/1974] added MegaMoon project (#6612) Co-authored-by: syp.skuberg --- projects/megamoon/index.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 projects/megamoon/index.js diff --git a/projects/megamoon/index.js b/projects/megamoon/index.js new file mode 100644 index 00000000000..98ba7c62d97 --- /dev/null +++ b/projects/megamoon/index.js @@ -0,0 +1,23 @@ +const ADDRESSES = require("../helper/coreAssets.json"); +const { sumTokensExport, nullAddress } = require("../helper/unwrapLPs"); + +const owners = [ + "0xA73dA7954834260d7909c697Eb6022e46A5924DE", + "0xC5d1D50d9517db581DE2Ceb6e5d33B7750b0a04A", + "0x4c00e75A710E92ea915a865379b07caDf3e6C45e", +]; + +const config = { + polygon: { + tokens: [ADDRESSES.polygon.USDT, nullAddress], + }, +}; + +module.exports = {}; + +Object.keys(config).forEach((chain) => { + const { tokens } = config[chain]; + module.exports[chain] = { + tvl: sumTokensExport({ owners, tokens }), + }; +}); From 74d82109532d197a7865fa161bef227d8da76b8c Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 22 Jun 2023 10:50:44 +0200 Subject: [PATCH 0049/1974] enosys bridge: track ethereum --- projects/enosys-bridge/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/enosys-bridge/index.js b/projects/enosys-bridge/index.js index 055ce33044e..2013c011449 100644 --- a/projects/enosys-bridge/index.js +++ b/projects/enosys-bridge/index.js @@ -2,5 +2,6 @@ const { sumTokensExport } = require('../helper/unwrapLPs') const ADDRESSES = require('../helper/coreAssets.json') module.exports = { - xdc: { tvl: sumTokensExport({ owner: '0xd5308a4bb2d7121a26d0bd11257245f0efda2bc4', tokens: [ADDRESSES.xdc.WXDC]})} + xdc: { tvl: sumTokensExport({ owner: '0xd5308a4bb2d7121a26d0bd11257245f0efda2bc4', tokens: [ADDRESSES.xdc.WXDC] }) }, + ethereum: { tvl: sumTokensExport({ owner: '0xb3902647015c17fc3c2f5ca5f5cb68bbf2d9b1e2', tokens: [ADDRESSES.ethereum.USDT] }) }, } \ No newline at end of file From b227220043f930c73b412a756dc14d3a1528b610 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 22 Jun 2023 16:11:52 +0200 Subject: [PATCH 0050/1974] aura: track arbitrum tvl --- projects/aura-finance/index.js | 43 +++++++++++++++++++++++++--------- 1 file changed, 32 insertions(+), 11 deletions(-) diff --git a/projects/aura-finance/index.js b/projects/aura-finance/index.js index 290d243f447..df8f5cd2dc9 100644 --- a/projects/aura-finance/index.js +++ b/projects/aura-finance/index.js @@ -1,7 +1,7 @@ +const { getLogs } = require('../helper/cache/getLogs') const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); const { staking } = require("../helper/staking"); -const BigNumber = require('bignumber.js') const { unwrapBalancerToken } = require('../helper/unwrapLPs') const AURA_BOOSTER = "0x7818A1DA7BD1E64c199029E86Ba244a9798eEE10" @@ -25,24 +25,24 @@ async function tvl(_, block, _1, { api }) { let failedCallIndices = poolIds.map((v, i) => [i, v]).filter(i => !i[1]).map(i => i[0]) let newPoolIds = await api.multiCall({ calls: failedCallIndices.map(i => poolInputs[i]), abi: 'function POOL_ID() view returns (bytes32)', permitFailure: true, }) - newPoolIds.forEach((v, i) => { if (v) poolIds[failedCallIndices[i]] = v }) + newPoolIds.forEach((v, i) => { if (v) poolIds[failedCallIndices[i]] = v }) failedCallIndices = poolIds.map((v, i) => [i, v]).filter(i => !i[1]).map(i => i[0]) const newLpTokens = await api.multiCall({ calls: failedCallIndices.map(i => poolInputs[i]), abi: 'address:lp_token', permitFailure: true, }) - newPoolIds = await api.multiCall({ calls: newLpTokens.map(i => ({ target: i})), abi: abi.getPoolId, permitFailure: true, }) - newPoolIds.forEach((v, i) => { if (v) poolIds[failedCallIndices[i]] = v }) + newPoolIds = await api.multiCall({ calls: newLpTokens.map(i => ({ target: i })), abi: abi.getPoolId, permitFailure: true, }) + newPoolIds.forEach((v, i) => { if (v) poolIds[failedCallIndices[i]] = v }) const poolTokensInfo = await api.multiCall({ calls: poolIds.map(poolId => ({ target: BALANCER_VAULT, params: poolId })), abi: abi.getPoolTokens, }) const balancesinStaking = await api.multiCall({ calls: pools.map(pool => ({ target: pool.token, params: pool.crvRewards })), abi: 'erc20:balanceOf', }) - const totalSupplies = await api.multiCall({ calls: pools.map(pool => pool.lptoken), abi: 'erc20:totalSupply', }) + const totalSupplies = await api.multiCall({ calls: pools.map(pool => pool.lptoken), abi: 'erc20:totalSupply', }) const { output: veBalTotalSupply } = await sdk.api.erc20.totalSupply({ target: addresses.veBal, block }) const { output: veBalance } = await sdk.api.erc20.balanceOf({ target: addresses.veBal, owner: addresses.auraDelegate, block }) const ratio = veBalance / veBalTotalSupply - const ratios = balancesinStaking.map((v, i) => +totalSupplies[i] > 0 ? v / totalSupplies[i]: 0) + const ratios = balancesinStaking.map((v, i) => +totalSupplies[i] > 0 ? v / totalSupplies[i] : 0) const bal = await unwrapBalancerToken({ api, balancerToken: addresses.bal80eth20, owner: addresses.veBal, }) Object.entries(bal).forEach(([token, value]) => { - api.add(token, +value * ratio, { skipChain: true,}) + api.add(token, +value * ratio, { skipChain: true, }) }) for (let [i, info] of poolTokensInfo.entries()) { // // unwrapBalancerToken would be better here, but since crvRewards address holds aura-wrapped tokens, it won't work @@ -53,18 +53,39 @@ async function tvl(_, block, _1, { api }) { // api.add(token, balance * ratio) // }) // } else { - info.tokens.forEach((token, j) => { - api.add(token, info.balances[j] * ratios[i]) - }) + info.tokens.forEach((token, j) => { + api.add(token, info.balances[j] * ratios[i]) + }) // } } } module.exports = { - timetravel: true, methodology: "TVL of Aura Finance consists of the total deposited assets, protocol-controlled value via veBAL and vote-locked AURA (staking)", ethereum: { tvl, staking: staking(addresses.auraLocker, addresses.aura) + }, + arbitrum: { + tvl: async (_, _1, _2, { api }) => { + const logs = await getLogs({ + api, + target: '0x6817149cb753bf529565b4d023d7507ed2ff4bc0', + topics: ['0xaa98436d09d130af48de49867af8b723bbbebb0d737638b5fe8f1bf31bbb71c0'], + eventAbi: 'event GaugeCreated (address indexed gauge)', + onlyArgs: true, + fromBlock: 72942741, + }) + + const voterProxy = '0xc181edc719480bd089b94647c2dc504e2700a2b0' + // const auraBalVault = '0x4EA9317D90b61fc28C418C247ad0CA8939Bbb0e9' + // const asset = await api.call({ abi: 'address:asset', target: auraBalVault }) + // const bal = await api.call({ abi: 'uint256:totalAssets', target: auraBalVault }) + // api.add(asset, bal) + const gauges = logs.map(log => log.gauge) + const tokens = await api.multiCall({ abi: 'address:lp_token', calls: gauges }) + const bals = await api.multiCall({ abi: 'erc20:balanceOf', calls: gauges.map(i => ({ target: i, params: voterProxy })) }) + api.addTokens(tokens, bals) + } } } From 457e1e07f3df7adbab32fcbefd6555e9c70c3750 Mon Sep 17 00:00:00 2001 From: yepp4you Date: Thu, 22 Jun 2023 18:12:50 +0400 Subject: [PATCH 0051/1974] add neopin-liquid-staking adapter --- projects/neopin-liquid-staking/index.js | 32 +++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 projects/neopin-liquid-staking/index.js diff --git a/projects/neopin-liquid-staking/index.js b/projects/neopin-liquid-staking/index.js new file mode 100644 index 00000000000..76b4a8b5856 --- /dev/null +++ b/projects/neopin-liquid-staking/index.js @@ -0,0 +1,32 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const sdk = require('@defillama/sdk'); + +const wethAddress = ADDRESSES.ethereum.WETH; +const wKlayAddress = ADDRESSES.klaytn.WKLAY; + +const npEthContract = '0x841d3B6660663Ed4B0D9b9EDAEe6642e05A4E182'; +const npKlayContract = '0xb0BB95ac3195A266Ab924596Ba32c2a10e245a95'; + +async function getEthTvl(timestamp, ethBlock, chainBlocks) { + const chain = 'ethereum'; + const pooledETH = await sdk.api.abi.call({ chain, block: ethBlock, target: npEthContract, abi: "uint256:getTotalPooledEth" }); + + return { + [`${chain}:0x0000000000000000000000000000000000000000`]: pooledETH.output + }; +} + +async function getKlayTvl(timestamp, ethBlock, chainBlocks) { + const chain = 'klaytn'; + const pooledKlay = await sdk.api.abi.call({ chain, target: npKlayContract, abi: "uint256:getTotalPooledKlay" }); + + return { + [`${chain}:0x0000000000000000000000000000000000000000`]: pooledKlay.output + }; +} + +module.exports = { + methodology: 'Staked are counted as TVL based on the chain that they are staked on and where the liquidity tokens are issued, npETH and npKLAY are counted as Ethereum TVL and Klaytn TVL since ETH and KLAY are staked in each mainnet and the liquidity tokens are also issued on each mainnet network.', + ethereum: { tvl: getEthTvl }, + klaytn: { tvl: getKlayTvl }, +} From ccaf3e596a5d17e07fe06ad060edbc55122175b1 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 22 Jun 2023 19:45:13 +0200 Subject: [PATCH 0052/1974] dolomite: handle custom tokens --- package-lock.json | 14 ++-- projects/dolomite/index.js | 16 ++-- utils/contracts/TestUniQuery.sol | 31 ++++++++ utils/contracts/UniV2TVL.sol | 100 ++++++++++++++++++++++++ utils/package-lock.json | 126 +++++++++++++++++++++++++++++-- utils/package.json | 3 +- utils/scripts/testBatchCall.js | 24 ++++++ utils/scripts/testCompiler.js | 28 +++++++ 8 files changed, 323 insertions(+), 19 deletions(-) create mode 100644 utils/contracts/TestUniQuery.sol create mode 100644 utils/contracts/UniV2TVL.sol create mode 100644 utils/scripts/testBatchCall.js create mode 100644 utils/scripts/testCompiler.js diff --git a/package-lock.json b/package-lock.json index 4837c72947e..6a48860ffb1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -63,9 +63,9 @@ } }, "node_modules/@defillama/sdk": { - "version": "4.0.26", - "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.26.tgz", - "integrity": "sha512-qZ0aZHocHhpWC/Mis/rvc/CCOs1Z+MCbLIVSVfJi/6d4acOzgV5m+oLtxVK1Rz0bsMrPZHdT+kUFkum8EKPodw==", + "version": "4.0.28", + "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.28.tgz", + "integrity": "sha512-0mqCkiy1pOhZgLCQ/RSdHyuPvchoIoOWj0JIRzFnUAV9uEP6Pck/EqYNB4PpoonZqWAqBDM2cGN1/qj/WQUUtw==", "dependencies": { "@supercharge/promise-pool": "^2.1.0", "ethers": "^5.4.5", @@ -4194,9 +4194,9 @@ } }, "@defillama/sdk": { - "version": "4.0.26", - "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.26.tgz", - "integrity": "sha512-qZ0aZHocHhpWC/Mis/rvc/CCOs1Z+MCbLIVSVfJi/6d4acOzgV5m+oLtxVK1Rz0bsMrPZHdT+kUFkum8EKPodw==", + "version": "4.0.28", + "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.28.tgz", + "integrity": "sha512-0mqCkiy1pOhZgLCQ/RSdHyuPvchoIoOWj0JIRzFnUAV9uEP6Pck/EqYNB4PpoonZqWAqBDM2cGN1/qj/WQUUtw==", "requires": { "@supercharge/promise-pool": "^2.1.0", "ethers": "^5.4.5", @@ -6791,7 +6791,7 @@ "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", "dev": true, "requires": { - "ansi-regex": "^5.0.1" + "ansi-regex": "5.0.1" } }, "strip-json-comments": { diff --git a/projects/dolomite/index.js b/projects/dolomite/index.js index f02d934a664..abc38744043 100644 --- a/projects/dolomite/index.js +++ b/projects/dolomite/index.js @@ -3,17 +3,23 @@ const { getMarketTokenAddress, getMarketTotalPar, } = require("./dolomite-margin.json"); -const { sumTokens2 } = require('../helper/unwrapLPs') const dolomiteMargin = "0x6bd780e7fdf01d77e4d475c821f1e7ae05409072"; async function getTokensAndBalances(api, supplyOrBorrow) { const tokens = await api.fetchList({ lengthAbi: getNumMarkets, itemAbi: getMarketTokenAddress, target: dolomiteMargin }) - if (supplyOrBorrow === 'supply') - return sumTokens2({ owner: dolomiteMargin, api, tokens }) + const underlyingTokens = await api.multiCall({ abi: 'address:UNDERLYING_TOKEN', calls: tokens, permitFailure: true, }) + let bals + if (supplyOrBorrow === 'supply') { + bals = await api.multiCall({ abi: 'erc20:balanceOf', calls: tokens.map(i => ({ target: i, params: dolomiteMargin })), }) - const res = await api.fetchList({ lengthAbi: getNumMarkets, itemAbi: getMarketTotalPar, target: dolomiteMargin }) - res.forEach((v, i) => api.addToken(tokens[i], v.borrow)) + } else { + const res = await api.fetchList({ lengthAbi: getNumMarkets, itemAbi: getMarketTotalPar, target: dolomiteMargin }) + bals = res.map(i => i.borrow) + } + tokens.forEach((v, i) => { + api.add(underlyingTokens[i] ?? v, bals[i]) + }) } async function tvl(timestamp, ethereumBlock, blocksToKeys, { api }) { diff --git a/utils/contracts/TestUniQuery.sol b/utils/contracts/TestUniQuery.sol new file mode 100644 index 00000000000..44587597d59 --- /dev/null +++ b/utils/contracts/TestUniQuery.sol @@ -0,0 +1,31 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +interface IUniswapV2Factory { + function allPairsLength() external view returns (uint); + + function allPairs(uint) external view returns (address); +} + +contract TestUniQuery { + constructor(address factory) { + IUniswapV2Factory uniswapFactory = IUniswapV2Factory(factory); + uint pairCount = uniswapFactory.allPairsLength(); + + // encode the return data + bytes memory _data = abi.encode(pairCount); + // force constructor to return data via assembly + assembly { + // abi.encode adds an additional offset (32 bytes) that we need to skip + let _dataStart := add(_data, 32) + // msize() gets the size of active memory in bytes. + // if we subtract msize() from _dataStart, the output will be + // the amount of bytes from _dataStart to the end of memory + // which due to how the data has been laid out in memory, will coincide with + // where our desired data ends. + let _dataEnd := sub(msize(), _dataStart) + // starting from _dataStart, get all the data in memory. + return(_dataStart, _dataEnd) + } + } +} diff --git a/utils/contracts/UniV2TVL.sol b/utils/contracts/UniV2TVL.sol new file mode 100644 index 00000000000..87521b1a96b --- /dev/null +++ b/utils/contracts/UniV2TVL.sol @@ -0,0 +1,100 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +interface IUniswapV2Pair { + function token0() external view returns (address); + + function token1() external view returns (address); + + function getReserves() + external + view + returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast); +} + +interface IUniswapV2Factory { + function allPairsLength() external view returns (uint); + + function allPairs(uint) external view returns (address); +} + +contract UniV2TVL { + struct KeyValuePair { + address key; + uint value; + } + + mapping(address => uint) public tvlMap; + mapping(address => bool) public isBaseToken; + address[] public tokens; + + constructor( + address factory, + address[] memory baseTokens, + bool includeQuoteTokens, + uint startIndex, + uint endIndex + ) { + IUniswapV2Factory uniswapFactory = IUniswapV2Factory(factory); + uint pairCount = uniswapFactory.allPairsLength(); + if (endIndex == 0) endIndex = pairCount; + + // Create a set of base tokens for efficient membership check + for (uint i = startIndex; i < baseTokens.length; i++) { + isBaseToken[baseTokens[i]] = true; + } + + for (uint i = 0; i < pairCount; i++) { + address pairAddress = uniswapFactory.allPairs(i); + IUniswapV2Pair pair = IUniswapV2Pair(pairAddress); + address token0 = pair.token0(); + address token1 = pair.token1(); + uint reserve0; + uint reserve1; + (reserve0, reserve1, ) = pair.getReserves(); + bool isToken0BaseToken = isBaseToken[token0]; + bool isToken1BaseToken = isBaseToken[token1]; + + if ( reserve0 == 0 || reserve1 == 0) continue; + + if (isToken0BaseToken && isToken1BaseToken) { + if (tvlMap[token0] == 0) tokens.push(token0); + if (tvlMap[token1] == 0) tokens.push(token1); + tvlMap[token0] += reserve0; + tvlMap[token1] += reserve1; + } else if (isToken0BaseToken) { + if (tvlMap[token0] == 0) tokens.push(token0); + tvlMap[token0] += reserve0 * 2; + } else if (isToken1BaseToken) { + if (tvlMap[token1] == 0) tokens.push(token1); + tvlMap[token1] += reserve1 * 2; + } else if (includeQuoteTokens) { + if (tvlMap[token0] == 0) tokens.push(token0); + if (tvlMap[token1] == 0) tokens.push(token1); + tvlMap[token0] += reserve0; + tvlMap[token1] += reserve1; + } + } + + KeyValuePair[] memory returnData = new KeyValuePair[](tokens.length); + for (uint i = 0; i < tokens.length; i++) { + returnData[i] = KeyValuePair(tokens[i], tvlMap[tokens[i]]); + } + + // encode the return data + bytes memory _data = abi.encode(returnData); + // force constructor to return data via assembly + assembly { + // abi.encode adds an additional offset (32 bytes) that we need to skip + let _dataStart := add(_data, 32) + // msize() gets the size of active memory in bytes. + // if we subtract msize() from _dataStart, the output will be + // the amount of bytes from _dataStart to the end of memory + // which due to how the data has been laid out in memory, will coincide with + // where our desired data ends. + let _dataEnd := sub(msize(), _dataStart) + // starting from _dataStart, get all the data in memory. + return(_dataStart, _dataEnd) + } + } +} diff --git a/utils/package-lock.json b/utils/package-lock.json index 7747b92ee89..6c664695861 100644 --- a/utils/package-lock.json +++ b/utils/package-lock.json @@ -9,7 +9,8 @@ "version": "0.0.1", "license": "ISC", "dependencies": { - "glob": "^8.0.3" + "glob": "^8.0.3", + "solc": "^0.8.20" }, "devDependencies": { "inquirer": "^8.2.4", @@ -205,6 +206,19 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, + "node_modules/command-exists": { + "version": "1.2.9", + "resolved": "https://registry.npmjs.org/command-exists/-/command-exists-1.2.9.tgz", + "integrity": "sha512-LTQ/SGc+s0Xc0Fu5WaKnR0YiygZkm9eKFvyS+fRsU7/ZWFF8ykFM6Pc9aCVf1+xasOOZpO3BAVgVrKvsqKHV7w==" + }, + "node_modules/commander": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-8.3.0.tgz", + "integrity": "sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==", + "engines": { + "node": ">= 12" + } + }, "node_modules/defaults": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.3.tgz", @@ -258,6 +272,25 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/follow-redirects": { + "version": "1.15.2", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", + "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -701,6 +734,11 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/js-sha3": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz", + "integrity": "sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q==" + }, "node_modules/lodash": { "version": "4.17.21", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", @@ -723,6 +761,14 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/memorystream": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/memorystream/-/memorystream-0.3.1.tgz", + "integrity": "sha512-S3UwM3yj5mtUSEfP41UZmt/0SCoVYUcU1rkXv+BQ5Ig8ndL4sPoJNBUJERafdPb5jjHJGuMgytgKvKIf58XNBw==", + "engines": { + "node": ">= 0.10.0" + } + }, "node_modules/mimic-fn": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", @@ -799,7 +845,6 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", - "dev": true, "engines": { "node": ">=0.10.0" } @@ -875,12 +920,40 @@ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", "dev": true }, + "node_modules/semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "bin": { + "semver": "bin/semver" + } + }, "node_modules/signal-exit": { "version": "3.0.7", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", "dev": true }, + "node_modules/solc": { + "version": "0.8.20", + "resolved": "https://registry.npmjs.org/solc/-/solc-0.8.20.tgz", + "integrity": "sha512-fPRnGspIEqmhu63RFO3pc79sLA7ZmzO0Uy0L5l6hEt2wAsq0o7UV6pXkAp3Mfv9IBhg7Px/oTu3a+y4gs3BWrQ==", + "dependencies": { + "command-exists": "^1.2.8", + "commander": "^8.1.0", + "follow-redirects": "^1.12.1", + "js-sha3": "0.8.0", + "memorystream": "^0.3.1", + "semver": "^5.5.0", + "tmp": "0.0.33" + }, + "bin": { + "solcjs": "solc.js" + }, + "engines": { + "node": ">=10.0.0" + } + }, "node_modules/string_decoder": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", @@ -938,7 +1011,6 @@ "version": "0.0.33", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", - "dev": true, "dependencies": { "os-tmpdir": "~1.0.2" }, @@ -1125,6 +1197,16 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, + "command-exists": { + "version": "1.2.9", + "resolved": "https://registry.npmjs.org/command-exists/-/command-exists-1.2.9.tgz", + "integrity": "sha512-LTQ/SGc+s0Xc0Fu5WaKnR0YiygZkm9eKFvyS+fRsU7/ZWFF8ykFM6Pc9aCVf1+xasOOZpO3BAVgVrKvsqKHV7w==" + }, + "commander": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-8.3.0.tgz", + "integrity": "sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==" + }, "defaults": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.3.tgz", @@ -1166,6 +1248,11 @@ "escape-string-regexp": "^1.0.5" } }, + "follow-redirects": { + "version": "1.15.2", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", + "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==" + }, "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -1505,6 +1592,11 @@ "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", "dev": true }, + "js-sha3": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz", + "integrity": "sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q==" + }, "lodash": { "version": "4.17.21", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", @@ -1521,6 +1613,11 @@ "is-unicode-supported": "^0.1.0" } }, + "memorystream": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/memorystream/-/memorystream-0.3.1.tgz", + "integrity": "sha512-S3UwM3yj5mtUSEfP41UZmt/0SCoVYUcU1rkXv+BQ5Ig8ndL4sPoJNBUJERafdPb5jjHJGuMgytgKvKIf58XNBw==" + }, "mimic-fn": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", @@ -1578,8 +1675,7 @@ "os-tmpdir": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", - "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", - "dev": true + "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=" }, "readable-stream": { "version": "3.6.0", @@ -1629,12 +1725,31 @@ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", "dev": true }, + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==" + }, "signal-exit": { "version": "3.0.7", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", "dev": true }, + "solc": { + "version": "0.8.20", + "resolved": "https://registry.npmjs.org/solc/-/solc-0.8.20.tgz", + "integrity": "sha512-fPRnGspIEqmhu63RFO3pc79sLA7ZmzO0Uy0L5l6hEt2wAsq0o7UV6pXkAp3Mfv9IBhg7Px/oTu3a+y4gs3BWrQ==", + "requires": { + "command-exists": "^1.2.8", + "commander": "^8.1.0", + "follow-redirects": "^1.12.1", + "js-sha3": "0.8.0", + "memorystream": "^0.3.1", + "semver": "^5.5.0", + "tmp": "0.0.33" + } + }, "string_decoder": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", @@ -1683,7 +1798,6 @@ "version": "0.0.33", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", - "dev": true, "requires": { "os-tmpdir": "~1.0.2" } diff --git a/utils/package.json b/utils/package.json index cb2ce215f19..49d6ccc564f 100644 --- a/utils/package.json +++ b/utils/package.json @@ -13,6 +13,7 @@ "inquirer-fuzzy-path": "^2.3.0" }, "dependencies": { - "glob": "^8.0.3" + "glob": "^8.0.3", + "solc": "^0.8.20" } } diff --git a/utils/scripts/testBatchCall.js b/utils/scripts/testBatchCall.js new file mode 100644 index 00000000000..6ae43ae3b2c --- /dev/null +++ b/utils/scripts/testBatchCall.js @@ -0,0 +1,24 @@ +const ethers = require('ethers') +const { getProvider } = require('@defillama/sdk/build/general') +const fs = require('fs') +const coreAssets = require('../../projects/helper/coreAssets.json') + +const bytecode = fs.readFileSync(__dirname + `/../artifacts/UniV2TVL.bytecode`, 'utf8') +// const inputData = ethers.utils.defaultAbiCoder.encode(['address'], ['0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f']); +const inputData = ethers.utils.defaultAbiCoder.encode(['address', 'address[]', 'bool', 'uint256', 'uint256'], ['0x460b2005b3318982feADA99f7ebF13e1D6f6eFfE', Object.values(coreAssets.ethereum), false, 0, 0]); + +// concatenate the bytecode of BatchPoolManagerData with the input data. +// the slice is done to remove the 0x prefix from the input data added by the encoding +const contractCreationCode = bytecode.concat(inputData.slice(2)); + +const provider = getProvider('ethereum') + +async function main() { + const returnedData = await provider.call({ data: '0x' + contractCreationCode }) + console.log(returnedData) + // decode the returned data to get the array of tuples using the same data types as the Data struct in the PoolManager contract + const [decoded] = ethers.utils.defaultAbiCoder.decode(['tuple(address,uint256)[]'], returnedData); + console.log(decoded) +} + +main() \ No newline at end of file diff --git a/utils/scripts/testCompiler.js b/utils/scripts/testCompiler.js new file mode 100644 index 00000000000..eb3dc8df0e3 --- /dev/null +++ b/utils/scripts/testCompiler.js @@ -0,0 +1,28 @@ +const solc = require('solc'); +const fs = require('fs'); + +const contractName = 'UniV2TVL'; +const contractFile = `${contractName}.sol`; +// Solidity contract code +const solidityCode = fs.readFileSync(__dirname+`/../contracts/${contractFile}`, 'utf8'); + +function compileContract(contractCode) { + const input = { + language: 'Solidity', + sources: { + [contractFile]: { + content: contractCode, + }, + }, + settings: { + outputSelection: { '*': { '*': ['*'], }, }, + }, + }; + + const output = JSON.parse(solc.compile(JSON.stringify(input))); + const bytecode = output.contracts[contractFile][contractName].evm.bytecode.object; + fs.writeFileSync(__dirname+`/../artifacts/${contractName}.bytecode`, bytecode) +} + +// Compile the contract and get the bytecode +compileContract(solidityCode) \ No newline at end of file From cb1bf481afd5d1649471bbe7bd7221faa39e8f7f Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 22 Jun 2023 21:58:48 +0200 Subject: [PATCH 0053/1974] add stellaxyz.io --- projects/stellaxyz-io/index.js | 40 ++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 projects/stellaxyz-io/index.js diff --git a/projects/stellaxyz-io/index.js b/projects/stellaxyz-io/index.js new file mode 100644 index 00000000000..915e42eb5e7 --- /dev/null +++ b/projects/stellaxyz-io/index.js @@ -0,0 +1,40 @@ +const { sumTokens2 } = require('../helper/unwrapLPs') +const { getLogs, getAddress } = require('../helper/cache/getLogs'); + +const config = { + arbitrum: { + lendingContracts: [ + '0x3251f402cc06b33e742f08e1adbe0d2e4c1ea2fa', + '0x36569fbc5a9d4c59d71e81d46db24256a09d1ad6', + '0x5ecb93b3ef882bf42fee65541942d50a7dab4b33', + '0x8e57143d14bae132210cfeec58d0c48875f7d415', + '0xab416e57ec74e87295b8a1507745a954b0bb9f02', + ], + factory: '0x573a89fBc6b4a5B11a55DC9814A1018a3A9cD0CA', + fromBlock: 101291920, + } +} + +module.exports = { +}; + +Object.keys(config).forEach(chain => { + const { lendingContracts, factory, fromBlock, } = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const logs = await getLogs({ + api, + target: factory, + topics: ['0x0803371633b57311f58d10924711080d2dae75ab17c5c0c262af3887cfca00bb'], + fromBlock, + }) + + const strategies = logs.map(i => getAddress(i.data.slice(64, 64 * 2 + 2))) + const positionManagers = await api.multiCall({ abi: 'address:positionManager', calls: strategies}) + + const tokens = await api.multiCall({ abi: 'address:depositToken', calls: lendingContracts }) + await sumTokens2({ api, tokensAndOwners2: [tokens, lendingContracts] }) + return sumTokens2({ api, owners: positionManagers, resolveUniV3: true, }) + } + } +}) \ No newline at end of file From c618aa8b75fb269496ebf5608bbc4cfe237222dd Mon Sep 17 00:00:00 2001 From: Full Stack Developer Date: Fri, 23 Jun 2023 03:59:46 +0800 Subject: [PATCH 0054/1974] add new tokens to Ethereum chain (#6613) --- projects/equito-finance/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/projects/equito-finance/index.js b/projects/equito-finance/index.js index 5ae93486b55..25c3c7de99a 100644 --- a/projects/equito-finance/index.js +++ b/projects/equito-finance/index.js @@ -12,6 +12,9 @@ const ALGO_VAULT2 = const ETH_VAULT2 = "0x4d753245f273e119Be944Ae180A17DfE35258e1e"; const BSC_VAULT2 = "0x7aFeCFABBA462121262D81d764e289aB77966aec"; +// Tokens +const ETH_PSYOP = "0xaa07810aE08575921c476Ff088bc949da43e4964"; + module.exports = { hallmarks: [ [1671724719, "Start of bridge"], @@ -23,7 +26,7 @@ module.exports = { ethereum: { tvl: sumTokensExport({ owners: [ETH_VAULT1, ETH_VAULT2], - tokens: [ADDRESSES.null], + tokens: [ADDRESSES.null, ADDRESSES.ethereum.INU, ETH_PSYOP], }), }, bsc: { From cd5660ba7ea611a3b99ae497d109947e8702a0a3 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 22 Jun 2023 22:27:17 +0200 Subject: [PATCH 0055/1974] univ2 sol code bugfix --- utils/contracts/UniV2TVL.sol | 6 +++--- utils/scripts/testBatchCall.js | 30 +++++++++++++++--------------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/utils/contracts/UniV2TVL.sol b/utils/contracts/UniV2TVL.sol index 87521b1a96b..dc46c81a854 100644 --- a/utils/contracts/UniV2TVL.sol +++ b/utils/contracts/UniV2TVL.sol @@ -37,14 +37,14 @@ contract UniV2TVL { ) { IUniswapV2Factory uniswapFactory = IUniswapV2Factory(factory); uint pairCount = uniswapFactory.allPairsLength(); - if (endIndex == 0) endIndex = pairCount; + if (endIndex == 0 || endIndex > pairCount) endIndex = pairCount; // Create a set of base tokens for efficient membership check - for (uint i = startIndex; i < baseTokens.length; i++) { + for (uint i = 0; i < baseTokens.length; i++) { isBaseToken[baseTokens[i]] = true; } - for (uint i = 0; i < pairCount; i++) { + for (uint i = startIndex; i < endIndex; i++) { address pairAddress = uniswapFactory.allPairs(i); IUniswapV2Pair pair = IUniswapV2Pair(pairAddress); address token0 = pair.token0(); diff --git a/utils/scripts/testBatchCall.js b/utils/scripts/testBatchCall.js index 6ae43ae3b2c..b84f0713197 100644 --- a/utils/scripts/testBatchCall.js +++ b/utils/scripts/testBatchCall.js @@ -1,24 +1,24 @@ -const ethers = require('ethers') -const { getProvider } = require('@defillama/sdk/build/general') const fs = require('fs') const coreAssets = require('../../projects/helper/coreAssets.json') +const sdk = require('@defillama/sdk') const bytecode = fs.readFileSync(__dirname + `/../artifacts/UniV2TVL.bytecode`, 'utf8') -// const inputData = ethers.utils.defaultAbiCoder.encode(['address'], ['0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f']); -const inputData = ethers.utils.defaultAbiCoder.encode(['address', 'address[]', 'bool', 'uint256', 'uint256'], ['0x460b2005b3318982feADA99f7ebF13e1D6f6eFfE', Object.values(coreAssets.ethereum), false, 0, 0]); - -// concatenate the bytecode of BatchPoolManagerData with the input data. -// the slice is done to remove the 0x prefix from the input data added by the encoding -const contractCreationCode = bytecode.concat(inputData.slice(2)); - -const provider = getProvider('ethereum') async function main() { - const returnedData = await provider.call({ data: '0x' + contractCreationCode }) - console.log(returnedData) - // decode the returned data to get the array of tuples using the same data types as the Data struct in the PoolManager contract - const [decoded] = ethers.utils.defaultAbiCoder.decode(['tuple(address,uint256)[]'], returnedData); - console.log(decoded) + await getUniTvl('0x460b2005b3318982feADA99f7ebF13e1D6f6eFfE', 'ethereum') + await getUniTvl('0x21cadeb92c8bbfbef98c3098846f0999209c3a97', 'avax') + await getUniTvl('0xAaA04462e35f3e40D798331657cA015169e005d7', 'dogechain') +} + +async function getUniTvl(factory, chain = 'ethereum') { + const api = new sdk.ChainApi({ chain}) + const res = await api.bytecodeCall({ + bytecode, + inputs: [factory, Object.values(coreAssets[chain]), false, 0, 50], + inputTypes: ['address', 'address[]', 'bool', 'uint256', 'uint256'], + outputTypes: ['tuple(address,uint256)[]'] + }) + console.log(chain, factory, res) } main() \ No newline at end of file From fd78237f36d1b4673f06ec5440879505a5b8e582 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 22 Jun 2023 22:58:41 +0200 Subject: [PATCH 0056/1974] refactor ooki --- projects/ooki/index.js | 246 ++++++++--------------------------------- 1 file changed, 44 insertions(+), 202 deletions(-) diff --git a/projects/ooki/index.js b/projects/ooki/index.js index b84a3d3aec2..58f5bd90a52 100644 --- a/projects/ooki/index.js +++ b/projects/ooki/index.js @@ -1,216 +1,58 @@ - -/*================================================== -Modules -==================================================*/ -const BigNumber = require('bignumber.js'); -const sdk = require("@defillama/sdk"); +const { sumTokens2 } = require('../helper/unwrapLPs') const { stakings } = require("../helper/staking"); const abi = require('./abi'); const registry = require('./registry'); -let iTokens = []; - -let iTokensNew = []; - -const tokens = { - ethereum: { - 'bzrx': '0x56d811088235F11C8920698a204A5010a788f4b3', - 'ooki': '0x0De05F6447ab4D22c8827449EE4bA2D5C288379B', - }, - polygon: { - 'bzrx': '0x54cFe73f2c7d0c4b62Ab869B473F5512Dc0944D2', - 'ooki': '0xCd150B1F528F326f5194c012f32Eb30135C7C2c9', - }, - bsc: { - 'ooki': '0xa5a6817ac4c164F27df3254B71fE83904B1C3c3e', - }, - arbitrum: { - 'ooki': '0x400F3ff129Bc9C9d239a567EaF5158f1850c65a4', - }, - optimism: { - } -} - const contracts = { - ethereum: { - 'protocol': '0xD8Ee69652E4e4838f2531732a46d1f7F584F0b7f', - 'registry': '0xf0E474592B455579Fe580D610b846BdBb529C6F7', - }, - polygon: { - 'protocol': '0x059D60a9CEfBc70b9Ea9FFBb9a041581B1dFA6a8', - 'registry': '0x4B234781Af34E9fD756C27a47675cbba19DC8765', - }, - bsc: { - 'protocol': '0xD154eE4982b83a87b0649E5a7DDA1514812aFE1f', - 'registry': '0x1BE70f29D30bB1D325E5D76Ee73109de3e50A57d', - }, - arbitrum: { - 'protocol': '0x37407F3178ffE07a6cF5C847F8f680FEcf319FAB', - 'registry': '0x86003099131d83944d826F8016E09CC678789A30', - }, - optimism: { - 'protocol': '0xAcedbFd5Bc1fb0dDC948579d4195616c05E74Fd1', - 'registry': '0x22a2208EeEDeb1E2156370Fd1c1c081355c68f2B', - } -} - -/*================================================== -Main -==================================================*/ -async function eth(timestamp, block, chainBlocks) { -return getBalances(timestamp, block, chainBlocks, 'ethereum') -} - -async function bsc(timestamp, block, chainBlocks) { -return getBalances(timestamp, block, chainBlocks, 'bsc') -} - -async function polygon(timestamp, block, chainBlocks) { -return getBalances(timestamp, block, chainBlocks, 'polygon') -} - -async function optimism(timestamp, block, chainBlocks) { -return getBalances(timestamp, block, chainBlocks, 'optimism') -} - -async function arbitrum(timestamp, block, chainBlocks) { -return getBalances(timestamp, block, chainBlocks, 'arbitrum') -} - -async function getBalances(timestamp, block, chainBlocks, network) { - let balances = {}; - const balanceOfCalls = []; - const getTokensResult = await sdk.api.abi.call({ - chainBlocks, - target: contracts[network].registry, - params: [0, 200], - chain: network, - abi: registry.getTokens - }); - - getTokensResult.output.forEach((token) =>{ - iTokensNew.push({ - iTokenAddress: token[0], - underlyingAddress: token[1] - }); - - const target = token[1]; - balanceOfCalls.push({ target: target, params: contracts[network].protocol }); - }); - - iTokens = iTokens.concat(iTokensNew); - const iTokenCalls = iTokens.map((iToken) => ({ - target: iToken.iTokenAddress - })); - - const supplyResult = await sdk.api.abi.multiCall({ - chainBlocks, - calls: iTokenCalls, - chain: network, - permitFailure: true, - abi: abi.totalAssetSupply - }); - - const borrowResult = await sdk.api.abi.multiCall({ - chainBlocks, - calls: iTokenCalls, - chain: network, - permitFailure: true, - abi: abi.totalAssetBorrow - }); - - iTokens.forEach((iToken) => { - const supply = supplyResult.output.find((result) => (result.input.target === iToken.iTokenAddress)); - const borrow = borrowResult.output.find((result) => (result.input.target === iToken.iTokenAddress)); - - const totalSupply = (supply && supply.success)?supply.output:0; - const totalBorrow = (borrow && borrow.success)?borrow.output:0; - - if (totalSupply > totalBorrow) { - const token = iToken.underlyingAddress; - balances[token] = BigNumber(totalSupply).minus(totalBorrow).toFixed(); - } - }); - - - //Balances - const balanceOfs = await sdk.api.abi.multiCall({ - chainBlocks, - calls: balanceOfCalls, - chain: network, - abi: abi["balanceOf"], - }); - - for(let i = 0; i{ - balances[remap(key, network)] = balances[key]; - delete balances[key] - }) - - - return balances; + ethereum: { + 'protocol': '0xD8Ee69652E4e4838f2531732a46d1f7F584F0b7f', + 'registry': '0xf0E474592B455579Fe580D610b846BdBb529C6F7', + }, + polygon: { + 'protocol': '0x059D60a9CEfBc70b9Ea9FFBb9a041581B1dFA6a8', + 'registry': '0x4B234781Af34E9fD756C27a47675cbba19DC8765', + }, + bsc: { + 'protocol': '0xD154eE4982b83a87b0649E5a7DDA1514812aFE1f', + 'registry': '0x1BE70f29D30bB1D325E5D76Ee73109de3e50A57d', + }, + arbitrum: { + 'protocol': '0x37407F3178ffE07a6cF5C847F8f680FEcf319FAB', + 'registry': '0x86003099131d83944d826F8016E09CC678789A30', + }, + optimism: { + 'protocol': '0xAcedbFd5Bc1fb0dDC948579d4195616c05E74Fd1', + 'registry': '0x22a2208EeEDeb1E2156370Fd1c1c081355c68f2B', + } +} + +async function getBalances(api, isBorrowed) { + const network = api.chain ?? 'ethereum' + const info = await api.call({ + target: contracts[network].registry, + params: [0, 200], + abi: registry.getTokens + }) + if (!isBorrowed) + return sumTokens2({ api, tokensAndOwners: info.map(i => [i.asset, i.token]) }) + + const borrowedBals = await api.multiCall({ abi: abi.totalAssetBorrow, calls: info.map(i => i.token) }) + api.addTokens(info.map(i => i.asset), borrowedBals) } -function remap(token, network){ - if(token === tokens[network].bzrx){ - token = 'ethereum:'+tokens['ethereum'].bzrx; - } - else{ - token = network+':'+token; - } - return token -} - -/*================================================== -Staking and Treasury -==================================================*/ - let ooki = '0x0De05F6447ab4D22c8827449EE4bA2D5C288379B' let bzrx = '0x56d811088235F11C8920698a204A5010a788f4b3' -const treasuryContract = '0xfedC4dD5247B93feb41e899A09C44cFaBec29Cbc' let stakingContracts = [ - '0xe95Ebce2B02Ee07dEF5Ed6B53289801F7Fc137A4', - '0x16f179f5c344cc29672a58ea327a26f64b941a63' + '0xe95Ebce2B02Ee07dEF5Ed6B53289801F7Fc137A4', + '0x16f179f5c344cc29672a58ea327a26f64b941a63' ] -let TreasureTokens = [ - '0x56d811088235F11C8920698a204A5010a788f4b3', //bzrx - '0x0De05F6447ab4D22c8827449EE4bA2D5C288379B', //ooki - //'vbzrx': '0xB72B31907C1C95F3650b64b2469e08EdACeE5e8F', vesting tokens not counted - '0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490', //pool3 -] - -let ookistaking = stakings(stakingContracts, ooki, 'ethereum') -let bzrxstaking = stakings(stakingContracts, bzrx, 'ethereum') - -module.exports = { - ethereum:{ - tvl: eth, - staking: sdk.util.sumChainTvls([ookistaking,bzrxstaking]), - }, - polygon:{ - tvl: polygon - }, - bsc:{ - tvl: bsc - }, - arbitrum:{ - tvl: arbitrum - }, - optimism:{ - tvl: optimism - }, -}; - +Object.keys(contracts).forEach(chain => { + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => getBalances(api, false), + borrowed: async (_, _b, _cb, { api, }) => getBalances(api, true), + } +}) +module.exports.ethereum.staking = stakings(stakingContracts, [ooki, bzrx]) From 09e5f89d31b01ac04ac592d94bb381509b250b48 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Fri, 23 Jun 2023 07:33:21 +0100 Subject: [PATCH 0057/1974] update fantom tvl --- projects/market.xyz/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/market.xyz/index.js b/projects/market.xyz/index.js index ff1b5f7fea3..c9509632160 100644 --- a/projects/market.xyz/index.js +++ b/projects/market.xyz/index.js @@ -81,7 +81,7 @@ module.exports = { borrowed: polygonBorrowed, }, fantom: { - tvl: fantomTvl, - borrowed: fantomBorrowed, + tvl: () => ({}), + borrowed: () => ({}), }, }; From 9ec41dd8b91b92d47329ede7e66325ee50faed11 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 23 Jun 2023 10:55:35 +0200 Subject: [PATCH 0058/1974] add klayswap v3 --- projects/klayswap-v3/index.js | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 projects/klayswap-v3/index.js diff --git a/projects/klayswap-v3/index.js b/projects/klayswap-v3/index.js new file mode 100644 index 00000000000..91d0d5c3091 --- /dev/null +++ b/projects/klayswap-v3/index.js @@ -0,0 +1,35 @@ +const { sumTokens2 } = require('../helper/unwrapLPs') +const { getLogs } = require('../helper/cache/getLogs') + +async function v3Tvl(_, _b, _cb, { api, }) { + const factory = '0xA15Be7e90df29A4aeaD0C7Fc86f7a9fBe6502Ac9'; + const wklay = '0x19aac5f612f524b754ca7e7c41cbfa2e981a4432'; + const klay = '0x0000000000000000000000000000000000000000'; + + const fromBlock = 124342981; + const eventAbi = 'event PoolCreated(address indexed token0, address indexed token1, uint24 indexed fee, int24 tickSpacing, address pool, uint256 exid)'; + const topics = [ + '0x20a108faf9dc51ca2b459a109d08568e65a9cb87569b6b3a334c275d504ff94f', + ]; + + const logs = await getLogs({ + api, + target: factory, + topics, + fromBlock, + eventAbi, + onlyArgs: true, + }) + + return sumTokens2({ + api, ownerTokens: logs.map(i => { + return [[(i.token0.toLowerCase() == wklay) ? klay : i.token0, i.token1], i.pool] + }), + }) +} + +module.exports = { + klaytn: { + tvl: v3Tvl, + }, +} \ No newline at end of file From eebbd5c53ac3259990223d5d7d3a333e999fcf32 Mon Sep 17 00:00:00 2001 From: Avedith Date: Fri, 23 Jun 2023 19:09:43 +1000 Subject: [PATCH 0059/1974] Update RubyDex Vault (#6617) * Update RubyDex Vault * Remove unneeded code --- projects/rubydex/index.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/projects/rubydex/index.js b/projects/rubydex/index.js index ce5198f8e4b..88d87836625 100644 --- a/projects/rubydex/index.js +++ b/projects/rubydex/index.js @@ -1,11 +1,10 @@ const ADDRESSES = require('../helper/coreAssets.json') const { sumTokensExport } = require('../helper/unwrapLPs'); -const ARBITRUM_USDT = ADDRESSES.arbitrum.USDT; -const VAULT_CONTRACT = '0xa55D96B2EC5c5899fC69886CACfCba65b91bf8B6'; +const VAULT_CONTRACT = '0x4a7c10780afdba628332e31c9e7d1675cfad594c'; module.exports = { methodology: 'counts the number of USDT tokens in the RubyDex Vault contract.', arbitrum: { - tvl: sumTokensExport({ owner: VAULT_CONTRACT, tokens: [ARBITRUM_USDT] }), + tvl: sumTokensExport({ owner: VAULT_CONTRACT, tokens: [ADDRESSES.arbitrum.USDT] }), } -}; \ No newline at end of file +}; From 62a4c3752618e864f7e2ea8741945acecd001f58 Mon Sep 17 00:00:00 2001 From: ajalalniya Date: Fri, 23 Jun 2023 14:54:32 +0200 Subject: [PATCH 0060/1974] Add zksync pools --- projects/crowdswap/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/crowdswap/index.js b/projects/crowdswap/index.js index bb55e3cf05c..9fc900a73cd 100644 --- a/projects/crowdswap/index.js +++ b/projects/crowdswap/index.js @@ -27,6 +27,7 @@ const config = { arbitrum: { factory: '0x9ff74eea1e7f0f8ee437b70d68f7cdc1a1030642', fromBlock: 91681087, }, polygon: { factory: '0xab7dac1daf712693539d770a967a9bc7ba47470c', fromBlock: 37984740, }, bsc: { factory: '0x08f65111cb9b517b10e5c1e63cb2224467e7988a', fromBlock: 25927093, }, + zksync: { factory: '0x049D3809043d137591687170Fc323DBcDFe83283', fromBlock: 2714942, }, } Object.keys(config).forEach(chain => { From 92c71b52ce746e794df7c85bc4fca4b1f5bc3cf8 Mon Sep 17 00:00:00 2001 From: ajalalniya Date: Fri, 23 Jun 2023 15:13:44 +0200 Subject: [PATCH 0061/1974] change zksync to era --- projects/crowdswap/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/crowdswap/index.js b/projects/crowdswap/index.js index 9fc900a73cd..101bca241e5 100644 --- a/projects/crowdswap/index.js +++ b/projects/crowdswap/index.js @@ -27,7 +27,7 @@ const config = { arbitrum: { factory: '0x9ff74eea1e7f0f8ee437b70d68f7cdc1a1030642', fromBlock: 91681087, }, polygon: { factory: '0xab7dac1daf712693539d770a967a9bc7ba47470c', fromBlock: 37984740, }, bsc: { factory: '0x08f65111cb9b517b10e5c1e63cb2224467e7988a', fromBlock: 25927093, }, - zksync: { factory: '0x049D3809043d137591687170Fc323DBcDFe83283', fromBlock: 2714942, }, + era: { factory: '0x049D3809043d137591687170Fc323DBcDFe83283', fromBlock: 2714942, }, } Object.keys(config).forEach(chain => { From 25cea2b972417b6dec05b9ecef1c60dd157c4528 Mon Sep 17 00:00:00 2001 From: TiTi Protocol <82432369+titimoney@users.noreply.github.com> Date: Sat, 24 Jun 2023 01:18:32 +0800 Subject: [PATCH 0062/1974] Add files via upload (#6619) --- projects/titi-finance/index.js | 56 ++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 projects/titi-finance/index.js diff --git a/projects/titi-finance/index.js b/projects/titi-finance/index.js new file mode 100644 index 00000000000..3418ee2270c --- /dev/null +++ b/projects/titi-finance/index.js @@ -0,0 +1,56 @@ +const ADDRESSES = require('../helper/coreAssets.json'); +const { sumTokensAndLPsSharedOwners, sumTokens2 } = require('../helper/unwrapLPs') +const { stakings } = require("../helper/staking"); + +// -------------------------- + +const ethTiTiToken = "0x3bdffA70f4b4E6985eED50453c7C0D4A15dcEc52"; // TiTi Token +const ethTiTiStaking = "0x5390Dbf4958F21BB317C72744c110977F4c03311"; // TiTi Staking + +const eraTiTiToken = "0x4EBfb78C4780C304dff7de518db630b67e3F044b"; // TiTi Token Era +const eraTiTiStaking = "0x1B05972C2e46288201E0432262bd8e925d4fCF94"; // TiTi Staking Era + + +async function ethTvl() { + const balances = {}; + + const ownerAddresses = [ + "0x49a0c2076DE4801bcadFEf78d0FA63cEC0AD1cB4", // MAMMSwapPair + ]; + + const tokenAddresses = [ + [ADDRESSES.ethereum.USDC, false], // USDC + ]; + + await sumTokensAndLPsSharedOwners(balances, tokenAddresses, ownerAddresses); + + return balances; +} + +// zksync era +async function eraTvl(_, _b, _cb, { api }) { + let balances = {}; + + const ownerAddresses = [ + "0xc856175575F6406b59AD6822c3114494990750DC", // MAMMSwapPair + ]; + + const tokenAddresses = [ + ADDRESSES.era.USDC // USDC + ]; + + balances = await sumTokens2({ api, tokens: tokenAddresses, owners: ownerAddresses }); + return balances; +} + +module.exports = { + methodology: `Calculate the reserve-type assets locked in the contract, including the user's stake funds in MarketMakerFund and the reserve of TiUSD issued by the protocol, TiTi-AMMs used to provide liquidity TiUSD is not included`, + ethereum: { + tvl: ethTvl, + // staking: stakings([ethTiTiStaking], [ethTiTiToken], 'ethereum') + }, + era: { + tvl: eraTvl, + // staking: stakings([eraTiTiStaking], eraTiTiToken, "era") + }, +} \ No newline at end of file From 3d78bff42c65d6f5deb302baec426870464b0c8c Mon Sep 17 00:00:00 2001 From: KannagiFinance <131143958+KannagiFinance@users.noreply.github.com> Date: Sat, 24 Jun 2023 01:50:57 +0800 Subject: [PATCH 0063/1974] Modify the TVL calculation method for the USDT vault (#6624) --- projects/kannagi-finance/index.js | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/projects/kannagi-finance/index.js b/projects/kannagi-finance/index.js index a0cda90c0e7..c664bf0ca3c 100644 --- a/projects/kannagi-finance/index.js +++ b/projects/kannagi-finance/index.js @@ -1,9 +1,14 @@ const abi = require("./abi.json"); const {yieldHelper} = require('../helper/yieldHelper'); +const { ethers } = require("ethers"); const KANA_ADDRESS = "0x26aC1D9945f65392B8E4E6b895969b5c01A7B414"; const YIELD_ADDRESS= "0x6E415ba5a37761256D13E84B45f4822c179DEF47"; +const USDT_ADDRESS = "era:0x493257fd37edb34451f62edf8d2a0c418852ba4c"; +const CoinGecko_USDT_ID = "tether"; -module.exports = yieldHelper({ + +function yieldHelperWrapper(){ + const helperReturn = yieldHelper({ project: 'kannagi-finance', chain: 'era', masterchef: YIELD_ADDRESS, @@ -14,3 +19,21 @@ module.exports = yieldHelper({ getReservesABI: abi.reserves, } }) + +const tvlFun = helperReturn.era.tvl; + +const tvlFunWrapper =async function(_, _b, _cb, { api }){ + const tvlBalances = await tvlFun(_, _b, _cb, { api }) + if(tvlBalances[USDT_ADDRESS]!=='0'&&tvlBalances[USDT_ADDRESS]!==undefined){ + let balance = ethers.utils.formatUnits(ethers.BigNumber.from(tvlBalances[USDT_ADDRESS]),6); + tvlBalances[CoinGecko_USDT_ID] = balance; + delete tvlBalances[USDT_ADDRESS]; + } + return tvlBalances; +} +helperReturn.era.tvl = tvlFunWrapper + +return helperReturn; +} + +module.exports = yieldHelperWrapper() From 7b66c2977b368a7ff43d249657e1b47d08398d1c Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Fri, 23 Jun 2023 18:55:29 +0100 Subject: [PATCH 0064/1974] small update --- projects/kannagi-finance/index.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/projects/kannagi-finance/index.js b/projects/kannagi-finance/index.js index c664bf0ca3c..6c8c5f085e9 100644 --- a/projects/kannagi-finance/index.js +++ b/projects/kannagi-finance/index.js @@ -1,10 +1,8 @@ const abi = require("./abi.json"); const {yieldHelper} = require('../helper/yieldHelper'); -const { ethers } = require("ethers"); const KANA_ADDRESS = "0x26aC1D9945f65392B8E4E6b895969b5c01A7B414"; const YIELD_ADDRESS= "0x6E415ba5a37761256D13E84B45f4822c179DEF47"; const USDT_ADDRESS = "era:0x493257fd37edb34451f62edf8d2a0c418852ba4c"; -const CoinGecko_USDT_ID = "tether"; function yieldHelperWrapper(){ @@ -25,8 +23,8 @@ const tvlFun = helperReturn.era.tvl; const tvlFunWrapper =async function(_, _b, _cb, { api }){ const tvlBalances = await tvlFun(_, _b, _cb, { api }) if(tvlBalances[USDT_ADDRESS]!=='0'&&tvlBalances[USDT_ADDRESS]!==undefined){ - let balance = ethers.utils.formatUnits(ethers.BigNumber.from(tvlBalances[USDT_ADDRESS]),6); - tvlBalances[CoinGecko_USDT_ID] = balance; + let balance = (tvlBalances[USDT_ADDRESS])/1e6; + tvlBalances["tether"] = balance; delete tvlBalances[USDT_ADDRESS]; } return tvlBalances; From a23c2e7c600b3095ed2b8dc91a24cea574238fed Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Fri, 23 Jun 2023 21:36:31 +0100 Subject: [PATCH 0065/1974] add more tokens --- projects/treasury/perion.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/projects/treasury/perion.js b/projects/treasury/perion.js index bf25dc5a5f6..fcdda6ac483 100644 --- a/projects/treasury/perion.js +++ b/projects/treasury/perion.js @@ -10,10 +10,12 @@ module.exports = treasuryExports({ tokens: [ nullAddress, ADDRESSES.ethereum.USDC, // USDC + ADDRESSES.ethereum.DAI, '0x60bE1e1fE41c1370ADaF5d8e66f07Cf1C2Df2268', // PERC '0x549020a9Cb845220D66d3E9c6D9F9eF61C981102', // SIDIUS '0x34Be5b8C30eE4fDe069DC878989686aBE9884470', //SENATE ADDRESSES.ethereum.USDT, //USDT + '0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84', //stETH ], owners: treasuryContractsETH, ownTokens: [PERC], From 86a2eba718013e6403ceb8b214e808e1805159ec Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Sat, 24 Jun 2023 03:55:38 +0100 Subject: [PATCH 0066/1974] add hallmarks --- projects/pulsedao/index.js | 3 +++ projects/spadefinance/index.js | 4 +++- projects/zombi/index.js | 3 +++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/projects/pulsedao/index.js b/projects/pulsedao/index.js index 9b0fdbc954e..f05a113ee06 100644 --- a/projects/pulsedao/index.js +++ b/projects/pulsedao/index.js @@ -10,6 +10,9 @@ const lps = [ ] module.exports = { + hallmarks: [ + [1647216000, "Rug Pull"] + ], deadFrom: 1648765747, misrepresentedTokens: true, ...tombTvl(pld, pshare, rewardPool, boardroom, lps, "fantom", undefined, false, lps[1]) diff --git a/projects/spadefinance/index.js b/projects/spadefinance/index.js index 61fb058fdf4..e49d8db310f 100644 --- a/projects/spadefinance/index.js +++ b/projects/spadefinance/index.js @@ -24,6 +24,8 @@ module.exports = { staking: stakingPricedLP(spadechef, spade, "fantom", spadeFtmLP, "fantom"), pool2: pool2Exports(spadechef, [spadeFtmLP, spadeUsdcLP], "fantom"), }, - + hallmarks: [ + [1647734400, "Rug Pull"] + ] } diff --git a/projects/zombi/index.js b/projects/zombi/index.js index a85b2e22970..c8f7f81b8f3 100644 --- a/projects/zombi/index.js +++ b/projects/zombi/index.js @@ -19,5 +19,8 @@ const listedTokenGeneris = [ ] module.exports = { + hallmarks: [ + [1646870400, "Rug Pull"] + ], ...zombiTvl(token, share, rewardPool, rewardPoolGeneris, masonry, pool2LPs, listedTokenGeneris, "fantom", undefined, false, "0xe577DF94b4Ea94399B7438e27EA1Ba81717464A0") } From 6946af1a85b88f331ebfdaca749ded524ca59e3b Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Sat, 24 Jun 2023 19:45:47 +0100 Subject: [PATCH 0067/1974] curve historical --- projects/curve/historical/abis.js | 19 +++ projects/curve/historical/index.js | 253 +++++++++++++++++++++++++++++ 2 files changed, 272 insertions(+) create mode 100644 projects/curve/historical/abis.js create mode 100644 projects/curve/historical/index.js diff --git a/projects/curve/historical/abis.js b/projects/curve/historical/abis.js new file mode 100644 index 00000000000..e77735f7b87 --- /dev/null +++ b/projects/curve/historical/abis.js @@ -0,0 +1,19 @@ + +let abis = {}; + +abis.compoundv1 = [{"name":"TokenExchange","inputs":[{"type":"address","name":"buyer","indexed":true},{"type":"int128","name":"sold_id","indexed":false},{"type":"uint256","name":"tokens_sold","indexed":false},{"type":"int128","name":"bought_id","indexed":false},{"type":"uint256","name":"tokens_bought","indexed":false}],"anonymous":false,"type":"event"},{"name":"TokenExchangeUnderlying","inputs":[{"type":"address","name":"buyer","indexed":true},{"type":"int128","name":"sold_id","indexed":false},{"type":"uint256","name":"tokens_sold","indexed":false},{"type":"int128","name":"bought_id","indexed":false},{"type":"uint256","name":"tokens_bought","indexed":false}],"anonymous":false,"type":"event"},{"name":"AddLiquidity","inputs":[{"type":"address","name":"provider","indexed":true},{"type":"uint256[2]","name":"token_amounts","indexed":false},{"type":"uint256[2]","name":"fees","indexed":false},{"type":"uint256","name":"invariant","indexed":false},{"type":"uint256","name":"token_supply","indexed":false}],"anonymous":false,"type":"event"},{"name":"RemoveLiquidity","inputs":[{"type":"address","name":"provider","indexed":true},{"type":"uint256[2]","name":"token_amounts","indexed":false},{"type":"uint256[2]","name":"fees","indexed":false},{"type":"uint256","name":"token_supply","indexed":false}],"anonymous":false,"type":"event"},{"name":"RemoveLiquidityImbalance","inputs":[{"type":"address","name":"provider","indexed":true},{"type":"uint256[2]","name":"token_amounts","indexed":false},{"type":"uint256[2]","name":"fees","indexed":false},{"type":"uint256","name":"invariant","indexed":false},{"type":"uint256","name":"token_supply","indexed":false}],"anonymous":false,"type":"event"},{"name":"CommitNewAdmin","inputs":[{"type":"uint256","name":"deadline","indexed":true,"unit":"sec"},{"type":"address","name":"admin","indexed":true}],"anonymous":false,"type":"event"},{"name":"NewAdmin","inputs":[{"type":"address","name":"admin","indexed":true}],"anonymous":false,"type":"event"},{"name":"CommitNewParameters","inputs":[{"type":"uint256","name":"deadline","indexed":true,"unit":"sec"},{"type":"uint256","name":"A","indexed":false},{"type":"uint256","name":"fee","indexed":false},{"type":"uint256","name":"admin_fee","indexed":false}],"anonymous":false,"type":"event"},{"name":"NewParameters","inputs":[{"type":"uint256","name":"A","indexed":false},{"type":"uint256","name":"fee","indexed":false},{"type":"uint256","name":"admin_fee","indexed":false}],"anonymous":false,"type":"event"},{"outputs":[],"inputs":[{"type":"address[2]","name":"_coins"},{"type":"address[2]","name":"_underlying_coins"},{"type":"address","name":"_pool_token"},{"type":"uint256","name":"_A"},{"type":"uint256","name":"_fee"}],"constant":false,"payable":false,"type":"constructor"},{"name":"get_virtual_price","outputs":[{"type":"uint256","name":"out"}],"inputs":[],"constant":true,"payable":false,"type":"function","gas":1084167},{"name":"calc_token_amount","outputs":[{"type":"uint256","name":"out"}],"inputs":[{"type":"uint256[2]","name":"amounts"},{"type":"bool","name":"deposit"}],"constant":true,"payable":false,"type":"function","gas":4239939},{"name":"add_liquidity","outputs":[],"inputs":[{"type":"uint256[2]","name":"amounts"},{"type":"uint256","name":"min_mint_amount"}],"constant":false,"payable":false,"type":"function","gas":6479997},{"name":"get_dy","outputs":[{"type":"uint256","name":"out"}],"inputs":[{"type":"int128","name":"i"},{"type":"int128","name":"j"},{"type":"uint256","name":"dx"}],"constant":true,"payable":false,"type":"function","gas":2543681},{"name":"get_dx","outputs":[{"type":"uint256","name":"out"}],"inputs":[{"type":"int128","name":"i"},{"type":"int128","name":"j"},{"type":"uint256","name":"dy"}],"constant":true,"payable":false,"type":"function","gas":2543687},{"name":"get_dy_underlying","outputs":[{"type":"uint256","name":"out"}],"inputs":[{"type":"int128","name":"i"},{"type":"int128","name":"j"},{"type":"uint256","name":"dx"}],"constant":true,"payable":false,"type":"function","gas":2543506},{"name":"get_dx_underlying","outputs":[{"type":"uint256","name":"out"}],"inputs":[{"type":"int128","name":"i"},{"type":"int128","name":"j"},{"type":"uint256","name":"dy"}],"constant":true,"payable":false,"type":"function","gas":2543512},{"name":"exchange","outputs":[],"inputs":[{"type":"int128","name":"i"},{"type":"int128","name":"j"},{"type":"uint256","name":"dx"},{"type":"uint256","name":"min_dy"}],"constant":false,"payable":false,"type":"function","gas":5184573},{"name":"exchange_underlying","outputs":[],"inputs":[{"type":"int128","name":"i"},{"type":"int128","name":"j"},{"type":"uint256","name":"dx"},{"type":"uint256","name":"min_dy"}],"constant":false,"payable":false,"type":"function","gas":5200817},{"name":"remove_liquidity","outputs":[],"inputs":[{"type":"uint256","name":"_amount"},{"type":"uint256[2]","name":"min_amounts"}],"constant":false,"payable":false,"type":"function","gas":153898},{"name":"remove_liquidity_imbalance","outputs":[],"inputs":[{"type":"uint256[2]","name":"amounts"},{"type":"uint256","name":"max_burn_amount"}],"constant":false,"payable":false,"type":"function","gas":6479708},{"name":"commit_new_parameters","outputs":[],"inputs":[{"type":"uint256","name":"amplification"},{"type":"uint256","name":"new_fee"},{"type":"uint256","name":"new_admin_fee"}],"constant":false,"payable":false,"type":"function","gas":146105},{"name":"apply_new_parameters","outputs":[],"inputs":[],"constant":false,"payable":false,"type":"function","gas":133512},{"name":"revert_new_parameters","outputs":[],"inputs":[],"constant":false,"payable":false,"type":"function","gas":21835},{"name":"commit_transfer_ownership","outputs":[],"inputs":[{"type":"address","name":"_owner"}],"constant":false,"payable":false,"type":"function","gas":74512},{"name":"apply_transfer_ownership","outputs":[],"inputs":[],"constant":false,"payable":false,"type":"function","gas":60568},{"name":"revert_transfer_ownership","outputs":[],"inputs":[],"constant":false,"payable":false,"type":"function","gas":21925},{"name":"withdraw_admin_fees","outputs":[],"inputs":[],"constant":false,"payable":false,"type":"function","gas":12831},{"name":"kill_me","outputs":[],"inputs":[],"constant":false,"payable":false,"type":"function","gas":37878},{"name":"unkill_me","outputs":[],"inputs":[],"constant":false,"payable":false,"type":"function","gas":22015},{"name":"coins","outputs":[{"type":"address","name":"out"}],"inputs":[{"type":"int128","name":"arg0"}],"constant":true,"payable":false,"type":"function","gas":2190},{"name":"underlying_coins","outputs":[{"type":"address","name":"out"}],"inputs":[{"type":"int128","name":"arg0"}],"constant":true,"payable":false,"type":"function","gas":2220},{"name":"balances","outputs":[{"type":"uint256","name":"out"}],"inputs":[{"type":"int128","name":"arg0"}],"constant":true,"payable":false,"type":"function","gas":2250},{"name":"A","outputs":[{"type":"uint256","name":"out"}],"inputs":[],"constant":true,"payable":false,"type":"function","gas":2081},{"name":"fee","outputs":[{"type":"uint256","name":"out"}],"inputs":[],"constant":true,"payable":false,"type":"function","gas":2111},{"name":"admin_fee","outputs":[{"type":"uint256","name":"out"}],"inputs":[],"constant":true,"payable":false,"type":"function","gas":2141},{"name":"owner","outputs":[{"type":"address","name":"out"}],"inputs":[],"constant":true,"payable":false,"type":"function","gas":2171},{"name":"admin_actions_deadline","outputs":[{"type":"uint256","unit":"sec","name":"out"}],"inputs":[],"constant":true,"payable":false,"type":"function","gas":2201},{"name":"transfer_ownership_deadline","outputs":[{"type":"uint256","unit":"sec","name":"out"}],"inputs":[],"constant":true,"payable":false,"type":"function","gas":2231},{"name":"future_A","outputs":[{"type":"uint256","name":"out"}],"inputs":[],"constant":true,"payable":false,"type":"function","gas":2261},{"name":"future_fee","outputs":[{"type":"uint256","name":"out"}],"inputs":[],"constant":true,"payable":false,"type":"function","gas":2291},{"name":"future_admin_fee","outputs":[{"type":"uint256","name":"out"}],"inputs":[],"constant":true,"payable":false,"type":"function","gas":2321},{"name":"future_owner","outputs":[{"type":"address","name":"out"}],"inputs":[],"constant":true,"payable":false,"type":"function","gas":2351}]; + +abis.abiNew = [{"name":"TokenExchange","inputs":[{"type":"address","name":"buyer","indexed":true},{"type":"int128","name":"sold_id","indexed":false},{"type":"uint256","name":"tokens_sold","indexed":false},{"type":"int128","name":"bought_id","indexed":false},{"type":"uint256","name":"tokens_bought","indexed":false}],"anonymous":false,"type":"event"},{"name":"TokenExchangeUnderlying","inputs":[{"type":"address","name":"buyer","indexed":true},{"type":"int128","name":"sold_id","indexed":false},{"type":"uint256","name":"tokens_sold","indexed":false},{"type":"int128","name":"bought_id","indexed":false},{"type":"uint256","name":"tokens_bought","indexed":false}],"anonymous":false,"type":"event"},{"name":"AddLiquidity","inputs":[{"type":"address","name":"provider","indexed":true},{"type":"uint256[2]","name":"token_amounts","indexed":false},{"type":"uint256[2]","name":"fees","indexed":false},{"type":"uint256","name":"invariant","indexed":false},{"type":"uint256","name":"token_supply","indexed":false}],"anonymous":false,"type":"event"},{"name":"RemoveLiquidity","inputs":[{"type":"address","name":"provider","indexed":true},{"type":"uint256[2]","name":"token_amounts","indexed":false},{"type":"uint256[2]","name":"fees","indexed":false},{"type":"uint256","name":"token_supply","indexed":false}],"anonymous":false,"type":"event"},{"name":"RemoveLiquidityOne","inputs":[{"type":"address","name":"provider","indexed":true},{"type":"uint256","name":"token_amount","indexed":false},{"type":"uint256","name":"coin_amount","indexed":false},{"type":"uint256","name":"token_supply","indexed":false}],"anonymous":false,"type":"event"},{"name":"RemoveLiquidityImbalance","inputs":[{"type":"address","name":"provider","indexed":true},{"type":"uint256[2]","name":"token_amounts","indexed":false},{"type":"uint256[2]","name":"fees","indexed":false},{"type":"uint256","name":"invariant","indexed":false},{"type":"uint256","name":"token_supply","indexed":false}],"anonymous":false,"type":"event"},{"name":"CommitNewAdmin","inputs":[{"type":"uint256","name":"deadline","indexed":true},{"type":"address","name":"admin","indexed":true}],"anonymous":false,"type":"event"},{"name":"NewAdmin","inputs":[{"type":"address","name":"admin","indexed":true}],"anonymous":false,"type":"event"},{"name":"CommitNewFee","inputs":[{"type":"uint256","name":"deadline","indexed":true},{"type":"uint256","name":"fee","indexed":false},{"type":"uint256","name":"admin_fee","indexed":false}],"anonymous":false,"type":"event"},{"name":"NewFee","inputs":[{"type":"uint256","name":"fee","indexed":false},{"type":"uint256","name":"admin_fee","indexed":false}],"anonymous":false,"type":"event"},{"name":"RampA","inputs":[{"type":"uint256","name":"old_A","indexed":false},{"type":"uint256","name":"new_A","indexed":false},{"type":"uint256","name":"initial_time","indexed":false},{"type":"uint256","name":"future_time","indexed":false}],"anonymous":false,"type":"event"},{"name":"StopRampA","inputs":[{"type":"uint256","name":"A","indexed":false},{"type":"uint256","name":"t","indexed":false}],"anonymous":false,"type":"event"},{"outputs":[],"inputs":[{"type":"address","name":"_owner"},{"type":"address[2]","name":"_coins"},{"type":"address","name":"_pool_token"},{"type":"address","name":"_base_pool"},{"type":"uint256","name":"_A"},{"type":"uint256","name":"_fee"},{"type":"uint256","name":"_admin_fee"}],"stateMutability":"nonpayable","type":"constructor"},{"name":"A","outputs":[{"type":"uint256","name":""}],"inputs":[],"stateMutability":"view","type":"function","gas":5199},{"name":"A_precise","outputs":[{"type":"uint256","name":""}],"inputs":[],"stateMutability":"view","type":"function","gas":5161},{"name":"get_virtual_price","outputs":[{"type":"uint256","name":""}],"inputs":[],"stateMutability":"view","type":"function","gas":992460},{"name":"calc_token_amount","outputs":[{"type":"uint256","name":""}],"inputs":[{"type":"uint256[2]","name":"amounts"},{"type":"bool","name":"is_deposit"}],"stateMutability":"view","type":"function","gas":3938567},{"name":"add_liquidity","outputs":[{"type":"uint256","name":""}],"inputs":[{"type":"uint256[2]","name":"amounts"},{"type":"uint256","name":"min_mint_amount"}],"stateMutability":"nonpayable","type":"function","gas":6136485},{"name":"get_dy","outputs":[{"type":"uint256","name":""}],"inputs":[{"type":"int128","name":"i"},{"type":"int128","name":"j"},{"type":"uint256","name":"dx"}],"stateMutability":"view","type":"function","gas":2390018},{"name":"get_dy_underlying","outputs":[{"type":"uint256","name":""}],"inputs":[{"type":"int128","name":"i"},{"type":"int128","name":"j"},{"type":"uint256","name":"dx"}],"stateMutability":"view","type":"function","gas":2393224},{"name":"exchange","outputs":[{"type":"uint256","name":""}],"inputs":[{"type":"int128","name":"i"},{"type":"int128","name":"j"},{"type":"uint256","name":"dx"},{"type":"uint256","name":"min_dy"}],"stateMutability":"nonpayable","type":"function","gas":2617039},{"name":"exchange_underlying","outputs":[{"type":"uint256","name":""}],"inputs":[{"type":"int128","name":"i"},{"type":"int128","name":"j"},{"type":"uint256","name":"dx"},{"type":"uint256","name":"min_dy"}],"stateMutability":"nonpayable","type":"function","gas":2631854},{"name":"remove_liquidity","outputs":[{"type":"uint256[2]","name":""}],"inputs":[{"type":"uint256","name":"_amount"},{"type":"uint256[2]","name":"min_amounts"}],"stateMutability":"nonpayable","type":"function","gas":163158},{"name":"remove_liquidity_imbalance","outputs":[{"type":"uint256","name":""}],"inputs":[{"type":"uint256[2]","name":"amounts"},{"type":"uint256","name":"max_burn_amount"}],"stateMutability":"nonpayable","type":"function","gas":6136334},{"name":"calc_withdraw_one_coin","outputs":[{"type":"uint256","name":""}],"inputs":[{"type":"uint256","name":"_token_amount"},{"type":"int128","name":"i"}],"stateMutability":"view","type":"function","gas":4389},{"name":"remove_liquidity_one_coin","outputs":[{"type":"uint256","name":""}],"inputs":[{"type":"uint256","name":"_token_amount"},{"type":"int128","name":"i"},{"type":"uint256","name":"_min_amount"}],"stateMutability":"nonpayable","type":"function","gas":3826262},{"name":"ramp_A","outputs":[],"inputs":[{"type":"uint256","name":"_future_A"},{"type":"uint256","name":"_future_time"}],"stateMutability":"nonpayable","type":"function","gas":151894},{"name":"stop_ramp_A","outputs":[],"inputs":[],"stateMutability":"nonpayable","type":"function","gas":148655},{"name":"commit_new_fee","outputs":[],"inputs":[{"type":"uint256","name":"new_fee"},{"type":"uint256","name":"new_admin_fee"}],"stateMutability":"nonpayable","type":"function","gas":110491},{"name":"apply_new_fee","outputs":[],"inputs":[],"stateMutability":"nonpayable","type":"function","gas":97272},{"name":"revert_new_parameters","outputs":[],"inputs":[],"stateMutability":"nonpayable","type":"function","gas":21925},{"name":"commit_transfer_ownership","outputs":[],"inputs":[{"type":"address","name":"_owner"}],"stateMutability":"nonpayable","type":"function","gas":74663},{"name":"apply_transfer_ownership","outputs":[],"inputs":[],"stateMutability":"nonpayable","type":"function","gas":60740},{"name":"revert_transfer_ownership","outputs":[],"inputs":[],"stateMutability":"nonpayable","type":"function","gas":22015},{"name":"admin_balances","outputs":[{"type":"uint256","name":""}],"inputs":[{"type":"uint256","name":"i"}],"stateMutability":"view","type":"function","gas":3511},{"name":"withdraw_admin_fees","outputs":[],"inputs":[],"stateMutability":"nonpayable","type":"function","gas":9232},{"name":"donate_admin_fees","outputs":[],"inputs":[],"stateMutability":"nonpayable","type":"function","gas":74995},{"name":"kill_me","outputs":[],"inputs":[],"stateMutability":"nonpayable","type":"function","gas":38028},{"name":"unkill_me","outputs":[],"inputs":[],"stateMutability":"nonpayable","type":"function","gas":22165},{"name":"coins","outputs":[{"type":"address","name":""}],"inputs":[{"type":"uint256","name":"arg0"}],"stateMutability":"view","type":"function","gas":2250},{"name":"balances","outputs":[{"type":"uint256","name":""}],"inputs":[{"type":"uint256","name":"arg0"}],"stateMutability":"view","type":"function","gas":2280},{"name":"fee","outputs":[{"type":"uint256","name":""}],"inputs":[],"stateMutability":"view","type":"function","gas":2201},{"name":"admin_fee","outputs":[{"type":"uint256","name":""}],"inputs":[],"stateMutability":"view","type":"function","gas":2231},{"name":"owner","outputs":[{"type":"address","name":""}],"inputs":[],"stateMutability":"view","type":"function","gas":2261},{"name":"token","outputs":[{"type":"address","name":""}],"inputs":[],"stateMutability":"view","type":"function","gas":2291},{"name":"base_pool","outputs":[{"type":"address","name":""}],"inputs":[],"stateMutability":"view","type":"function","gas":2321},{"name":"base_virtual_price","outputs":[{"type":"uint256","name":""}],"inputs":[],"stateMutability":"view","type":"function","gas":2351},{"name":"base_cache_updated","outputs":[{"type":"uint256","name":""}],"inputs":[],"stateMutability":"view","type":"function","gas":2381},{"name":"base_coins","outputs":[{"type":"address","name":""}],"inputs":[{"type":"uint256","name":"arg0"}],"stateMutability":"view","type":"function","gas":2520},{"name":"initial_A","outputs":[{"type":"uint256","name":""}],"inputs":[],"stateMutability":"view","type":"function","gas":2441},{"name":"future_A","outputs":[{"type":"uint256","name":""}],"inputs":[],"stateMutability":"view","type":"function","gas":2471},{"name":"initial_A_time","outputs":[{"type":"uint256","name":""}],"inputs":[],"stateMutability":"view","type":"function","gas":2501},{"name":"future_A_time","outputs":[{"type":"uint256","name":""}],"inputs":[],"stateMutability":"view","type":"function","gas":2531},{"name":"admin_actions_deadline","outputs":[{"type":"uint256","name":""}],"inputs":[],"stateMutability":"view","type":"function","gas":2561},{"name":"transfer_ownership_deadline","outputs":[{"type":"uint256","name":""}],"inputs":[],"stateMutability":"view","type":"function","gas":2591},{"name":"future_fee","outputs":[{"type":"uint256","name":""}],"inputs":[],"stateMutability":"view","type":"function","gas":2621},{"name":"future_admin_fee","outputs":[{"type":"uint256","name":""}],"inputs":[],"stateMutability":"view","type":"function","gas":2651},{"name":"future_owner","outputs":[{"type":"address","name":""}],"inputs":[],"stateMutability":"view","type":"function","gas":2681}] + +abis.abisBTC = [{"name":"TokenExchange","inputs":[{"type":"address","name":"buyer","indexed":true},{"type":"int128","name":"sold_id","indexed":false},{"type":"uint256","name":"tokens_sold","indexed":false},{"type":"int128","name":"bought_id","indexed":false},{"type":"uint256","name":"tokens_bought","indexed":false}],"anonymous":false,"type":"event"},{"name":"AddLiquidity","inputs":[{"type":"address","name":"provider","indexed":true},{"type":"uint256[3]","name":"token_amounts","indexed":false},{"type":"uint256[3]","name":"fees","indexed":false},{"type":"uint256","name":"invariant","indexed":false},{"type":"uint256","name":"token_supply","indexed":false}],"anonymous":false,"type":"event"},{"name":"RemoveLiquidity","inputs":[{"type":"address","name":"provider","indexed":true},{"type":"uint256[3]","name":"token_amounts","indexed":false},{"type":"uint256[3]","name":"fees","indexed":false},{"type":"uint256","name":"token_supply","indexed":false}],"anonymous":false,"type":"event"},{"name":"RemoveLiquidityOne","inputs":[{"type":"address","name":"provider","indexed":true},{"type":"uint256","name":"token_amount","indexed":false},{"type":"uint256","name":"coin_amount","indexed":false}],"anonymous":false,"type":"event"},{"name":"RemoveLiquidityImbalance","inputs":[{"type":"address","name":"provider","indexed":true},{"type":"uint256[3]","name":"token_amounts","indexed":false},{"type":"uint256[3]","name":"fees","indexed":false},{"type":"uint256","name":"invariant","indexed":false},{"type":"uint256","name":"token_supply","indexed":false}],"anonymous":false,"type":"event"},{"name":"CommitNewAdmin","inputs":[{"type":"uint256","name":"deadline","indexed":true,"unit":"sec"},{"type":"address","name":"admin","indexed":true}],"anonymous":false,"type":"event"},{"name":"NewAdmin","inputs":[{"type":"address","name":"admin","indexed":true}],"anonymous":false,"type":"event"},{"name":"CommitNewFee","inputs":[{"type":"uint256","name":"deadline","indexed":true,"unit":"sec"},{"type":"uint256","name":"fee","indexed":false},{"type":"uint256","name":"admin_fee","indexed":false}],"anonymous":false,"type":"event"},{"name":"NewFee","inputs":[{"type":"uint256","name":"fee","indexed":false},{"type":"uint256","name":"admin_fee","indexed":false}],"anonymous":false,"type":"event"},{"name":"RampA","inputs":[{"type":"uint256","name":"old_A","indexed":false},{"type":"uint256","name":"new_A","indexed":false},{"type":"uint256","name":"initial_time","indexed":false,"unit":"sec"},{"type":"uint256","name":"future_time","indexed":false,"unit":"sec"}],"anonymous":false,"type":"event"},{"name":"StopRampA","inputs":[{"type":"uint256","name":"A","indexed":false},{"type":"uint256","name":"t","indexed":false,"unit":"sec"}],"anonymous":false,"type":"event"},{"outputs":[],"inputs":[{"type":"address[3]","name":"_coins"},{"type":"address","name":"_pool_token"},{"type":"uint256","name":"_A"},{"type":"uint256","name":"_fee"}],"constant":false,"payable":false,"type":"constructor"},{"name":"A","outputs":[{"type":"uint256","name":""}],"inputs":[],"constant":true,"payable":false,"type":"function","gas":5227},{"name":"get_virtual_price","outputs":[{"type":"uint256","name":""}],"inputs":[],"constant":true,"payable":false,"type":"function","gas":1150488},{"name":"calc_token_amount","outputs":[{"type":"uint256","name":""}],"inputs":[{"type":"uint256[3]","name":"amounts"},{"type":"bool","name":"deposit"}],"constant":true,"payable":false,"type":"function","gas":4526955},{"name":"add_liquidity","outputs":[],"inputs":[{"type":"uint256[3]","name":"amounts"},{"type":"uint256","name":"min_mint_amount"}],"constant":false,"payable":false,"type":"function","gas":6972762},{"name":"get_dy","outputs":[{"type":"uint256","name":""}],"inputs":[{"type":"int128","name":"i"},{"type":"int128","name":"j"},{"type":"uint256","name":"dx"}],"constant":true,"payable":false,"type":"function","gas":2687932},{"name":"get_dy_underlying","outputs":[{"type":"uint256","name":""}],"inputs":[{"type":"int128","name":"i"},{"type":"int128","name":"j"},{"type":"uint256","name":"dx"}],"constant":true,"payable":false,"type":"function","gas":2687745},{"name":"exchange","outputs":[],"inputs":[{"type":"int128","name":"i"},{"type":"int128","name":"j"},{"type":"uint256","name":"dx"},{"type":"uint256","name":"min_dy"}],"constant":false,"payable":false,"type":"function","gas":5499133},{"name":"remove_liquidity","outputs":[],"inputs":[{"type":"uint256","name":"_amount"},{"type":"uint256[3]","name":"min_amounts"}],"constant":false,"payable":false,"type":"function","gas":196975},{"name":"remove_liquidity_imbalance","outputs":[],"inputs":[{"type":"uint256[3]","name":"amounts"},{"type":"uint256","name":"max_burn_amount"}],"constant":false,"payable":false,"type":"function","gas":6972281},{"name":"calc_withdraw_one_coin","outputs":[{"type":"uint256","name":""}],"inputs":[{"type":"uint256","name":"_token_amount"},{"type":"int128","name":"i"}],"constant":true,"payable":false,"type":"function","gas":15405},{"name":"remove_liquidity_one_coin","outputs":[],"inputs":[{"type":"uint256","name":"_token_amount"},{"type":"int128","name":"i"},{"type":"uint256","name":"min_amount"}],"constant":false,"payable":false,"type":"function","gas":4044074},{"name":"ramp_A","outputs":[],"inputs":[{"type":"uint256","name":"_future_A"},{"type":"uint256","unit":"sec","name":"_future_time"}],"constant":false,"payable":false,"type":"function","gas":151937},{"name":"stop_ramp_A","outputs":[],"inputs":[],"constant":false,"payable":false,"type":"function","gas":148697},{"name":"commit_new_fee","outputs":[],"inputs":[{"type":"uint256","name":"new_fee"},{"type":"uint256","name":"new_admin_fee"}],"constant":false,"payable":false,"type":"function","gas":110521},{"name":"apply_new_fee","outputs":[],"inputs":[],"constant":false,"payable":false,"type":"function","gas":97220},{"name":"revert_new_parameters","outputs":[],"inputs":[],"constant":false,"payable":false,"type":"function","gas":21955},{"name":"commit_transfer_ownership","outputs":[],"inputs":[{"type":"address","name":"_owner"}],"constant":false,"payable":false,"type":"function","gas":74632},{"name":"apply_transfer_ownership","outputs":[],"inputs":[],"constant":false,"payable":false,"type":"function","gas":60688},{"name":"revert_transfer_ownership","outputs":[],"inputs":[],"constant":false,"payable":false,"type":"function","gas":22045},{"name":"withdraw_admin_fees","outputs":[],"inputs":[],"constant":false,"payable":false,"type":"function","gas":17565},{"name":"kill_me","outputs":[],"inputs":[],"constant":false,"payable":false,"type":"function","gas":37998},{"name":"unkill_me","outputs":[],"inputs":[],"constant":false,"payable":false,"type":"function","gas":22135},{"name":"coins","outputs":[{"type":"address","name":""}],"inputs":[{"type":"int128","name":"arg0"}],"constant":true,"payable":false,"type":"function","gas":2310},{"name":"balances","outputs":[{"type":"uint256","name":""}],"inputs":[{"type":"int128","name":"arg0"}],"constant":true,"payable":false,"type":"function","gas":2340},{"name":"fee","outputs":[{"type":"uint256","name":""}],"inputs":[],"constant":true,"payable":false,"type":"function","gas":2171},{"name":"admin_fee","outputs":[{"type":"uint256","name":""}],"inputs":[],"constant":true,"payable":false,"type":"function","gas":2201},{"name":"owner","outputs":[{"type":"address","name":""}],"inputs":[],"constant":true,"payable":false,"type":"function","gas":2231},{"name":"initial_A","outputs":[{"type":"uint256","name":""}],"inputs":[],"constant":true,"payable":false,"type":"function","gas":2261},{"name":"future_A","outputs":[{"type":"uint256","name":""}],"inputs":[],"constant":true,"payable":false,"type":"function","gas":2291},{"name":"initial_A_time","outputs":[{"type":"uint256","unit":"sec","name":""}],"inputs":[],"constant":true,"payable":false,"type":"function","gas":2321},{"name":"future_A_time","outputs":[{"type":"uint256","unit":"sec","name":""}],"inputs":[],"constant":true,"payable":false,"type":"function","gas":2351},{"name":"admin_actions_deadline","outputs":[{"type":"uint256","unit":"sec","name":""}],"inputs":[],"constant":true,"payable":false,"type":"function","gas":2381},{"name":"transfer_ownership_deadline","outputs":[{"type":"uint256","unit":"sec","name":""}],"inputs":[],"constant":true,"payable":false,"type":"function","gas":2411},{"name":"future_fee","outputs":[{"type":"uint256","name":""}],"inputs":[],"constant":true,"payable":false,"type":"function","gas":2441},{"name":"future_admin_fee","outputs":[{"type":"uint256","name":""}],"inputs":[],"constant":true,"payable":false,"type":"function","gas":2471},{"name":"future_owner","outputs":[{"type":"address","name":""}],"inputs":[],"constant":true,"payable":false,"type":"function","gas":2501}]; + +abis.cTokens = [{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"spender","type":"address"},{"name":"amount","type":"uint256"}],"name":"approve","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"repayAmount","type":"uint256"}],"name":"repayBorrow","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"reserveFactorMantissa","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"account","type":"address"}],"name":"borrowBalanceCurrent","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"exchangeRateStored","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"src","type":"address"},{"name":"dst","type":"address"},{"name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"borrower","type":"address"},{"name":"repayAmount","type":"uint256"}],"name":"repayBorrowBehalf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"pendingAdmin","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner","type":"address"}],"name":"balanceOfUnderlying","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"getCash","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"newComptroller","type":"address"}],"name":"_setComptroller","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalBorrows","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"comptroller","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"reduceAmount","type":"uint256"}],"name":"_reduceReserves","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"initialExchangeRateMantissa","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"accrualBlockNumber","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"underlying","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"totalBorrowsCurrent","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"redeemAmount","type":"uint256"}],"name":"redeemUnderlying","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalReserves","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"account","type":"address"}],"name":"borrowBalanceStored","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"mintAmount","type":"uint256"}],"name":"mint","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"accrueInterest","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"dst","type":"address"},{"name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"borrowIndex","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"supplyRatePerBlock","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"liquidator","type":"address"},{"name":"borrower","type":"address"},{"name":"seizeTokens","type":"uint256"}],"name":"seize","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"newPendingAdmin","type":"address"}],"name":"_setPendingAdmin","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"exchangeRateCurrent","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"account","type":"address"}],"name":"getAccountSnapshot","outputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"borrowAmount","type":"uint256"}],"name":"borrow","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"redeemTokens","type":"uint256"}],"name":"redeem","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"owner","type":"address"},{"name":"spender","type":"address"}],"name":"allowance","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"_acceptAdmin","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"newInterestRateModel","type":"address"}],"name":"_setInterestRateModel","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"interestRateModel","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"borrower","type":"address"},{"name":"repayAmount","type":"uint256"},{"name":"cTokenCollateral","type":"address"}],"name":"liquidateBorrow","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"admin","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"borrowRatePerBlock","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"newReserveFactorMantissa","type":"uint256"}],"name":"_setReserveFactor","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"isCToken","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"underlying_","type":"address"},{"name":"comptroller_","type":"address"},{"name":"interestRateModel_","type":"address"},{"name":"initialExchangeRateMantissa_","type":"uint256"},{"name":"name_","type":"string"},{"name":"symbol_","type":"string"},{"name":"decimals_","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"name":"interestAccumulated","type":"uint256"},{"indexed":false,"name":"borrowIndex","type":"uint256"},{"indexed":false,"name":"totalBorrows","type":"uint256"}],"name":"AccrueInterest","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"minter","type":"address"},{"indexed":false,"name":"mintAmount","type":"uint256"},{"indexed":false,"name":"mintTokens","type":"uint256"}],"name":"Mint","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"redeemer","type":"address"},{"indexed":false,"name":"redeemAmount","type":"uint256"},{"indexed":false,"name":"redeemTokens","type":"uint256"}],"name":"Redeem","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"borrower","type":"address"},{"indexed":false,"name":"borrowAmount","type":"uint256"},{"indexed":false,"name":"accountBorrows","type":"uint256"},{"indexed":false,"name":"totalBorrows","type":"uint256"}],"name":"Borrow","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"payer","type":"address"},{"indexed":false,"name":"borrower","type":"address"},{"indexed":false,"name":"repayAmount","type":"uint256"},{"indexed":false,"name":"accountBorrows","type":"uint256"},{"indexed":false,"name":"totalBorrows","type":"uint256"}],"name":"RepayBorrow","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"liquidator","type":"address"},{"indexed":false,"name":"borrower","type":"address"},{"indexed":false,"name":"repayAmount","type":"uint256"},{"indexed":false,"name":"cTokenCollateral","type":"address"},{"indexed":false,"name":"seizeTokens","type":"uint256"}],"name":"LiquidateBorrow","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"oldPendingAdmin","type":"address"},{"indexed":false,"name":"newPendingAdmin","type":"address"}],"name":"NewPendingAdmin","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"oldAdmin","type":"address"},{"indexed":false,"name":"newAdmin","type":"address"}],"name":"NewAdmin","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"oldComptroller","type":"address"},{"indexed":false,"name":"newComptroller","type":"address"}],"name":"NewComptroller","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"oldInterestRateModel","type":"address"},{"indexed":false,"name":"newInterestRateModel","type":"address"}],"name":"NewMarketInterestRateModel","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"oldReserveFactorMantissa","type":"uint256"},{"indexed":false,"name":"newReserveFactorMantissa","type":"uint256"}],"name":"NewReserveFactor","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"admin","type":"address"},{"indexed":false,"name":"reduceAmount","type":"uint256"},{"indexed":false,"name":"newTotalReserves","type":"uint256"}],"name":"ReservesReduced","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"error","type":"uint256"},{"indexed":false,"name":"info","type":"uint256"},{"indexed":false,"name":"detail","type":"uint256"}],"name":"Failure","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":true,"name":"spender","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"Approval","type":"event"}]; + + +abis.yTokens = [{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"constant":true,"inputs":[],"name":"aave","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"aaveToken","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"approveToken","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"apr","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"balance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"balanceAave","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"balanceCompound","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"balanceCompoundInToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"balanceDydx","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"balanceFulcrum","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"balanceFulcrumInToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"calcPoolValueInToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"compound","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"dToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"deposit","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"dydx","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"fulcrum","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getAave","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getAaveCore","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getPricePerFullShare","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"isOwner","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"pool","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"provider","outputs":[{"internalType":"enum yTUSD.Lender","name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"rebalance","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"recommend","outputs":[{"internalType":"enum yTUSD.Lender","name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"renounceOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_new_APR","type":"address"}],"name":"set_new_APR","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_new_COMPOUND","type":"address"}],"name":"set_new_COMPOUND","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"_new_DTOKEN","type":"uint256"}],"name":"set_new_DTOKEN","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"supplyAave","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"supplyCompound","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"supplyDydx","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"supplyFulcrum","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"token","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"_shares","type":"uint256"}],"name":"withdraw","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}] + + + +module.exports = { + abis +} \ No newline at end of file diff --git a/projects/curve/historical/index.js b/projects/curve/historical/index.js new file mode 100644 index 00000000000..02c468fd61a --- /dev/null +++ b/projects/curve/historical/index.js @@ -0,0 +1,253 @@ +const { Web3 } = require('web3'); +const BigNumber = require("bignumber.js"); +const axios = require("axios"); +const web3 = new Web3(`https://eth.llamarpc.com`); +const abis = require('./abis.js') +const { toUSDTBalances } = require('../../helper/balances') + + +let swaps = [ + { + 'name': 'tbtc', + 'address': '0xc25099792e9349c7dd09759744ea681c7de2cb66', + 'coins': [0], + 'type': 'btc', + 'abi': abis.abis.abiNew + }, + { + 'name': 'hbtc', + 'address': '0x4CA9b3063Ec5866A4B82E437059D2C43d1be596F', + 'coins': [0], + 'type': 'btc', + 'abi': abis.abis.abiNew + }, + { + 'name': 'sbtc', + 'address': '0x7fC77b5c7614E1533320Ea6DDc2Eb61fa00A9714', + 'coins': [0,1,2], + 'type': 'btc', + 'abi': abis.abis.abisBTC + }, + { + 'name': 'ren', + 'address': '0x93054188d876f558f4a66B2EF1d97d16eDf0895B', + 'coins': [0,1], + 'type': 'btc', + 'abi': abis.abis.abisBTC + }, + { + 'name': 'rsv', + 'address': '0xC18cC39da8b11dA8c3541C598eE022258F9744da', + 'coins': [0], + 'type': 1, + 'abi': abis.abis.abiNew + }, + { + 'name': 'musd', + 'address': '0x8474DdbE98F5aA3179B3B3F5942D724aFcdec9f6', + 'coins': [0], + 'type': 1, + 'abi': abis.abis.abiNew + }, + { + 'name': 'linkusd', + 'address': '0xE7a24EF0C5e95Ffb0f6684b813A78F2a3AD7D171', + 'coins': [0], + 'type': 1, + 'abi': abis.abis.abiNew + }, + { + 'name': 'usdn', + 'address': '0x0f9cb53Ebe405d49A0bbdBD291A65Ff571bC83e1', + 'coins': [0], + 'type': 1, + 'abi': abis.abis.abiNew + }, + { + 'name': 'usdk', + 'address': '0x3E01dD8a5E1fb3481F0F589056b428Fc308AF0Fb', + 'coins': [0], + 'type': 1, + 'abi': abis.abis.abiNew + }, + { + 'name': 'gusd', + 'address': '0x4f062658EaAF2C1ccf8C8e36D6824CDf41167956', + 'coins': [0], + 'type': 1, + 'abi': abis.abis.abiNew + }, + { + 'name': 'compoundv1', + 'address': '0xA2B47E3D5c44877cca798226B7B8118F9BFb7A56', + 'coins': [0,1], + 'type': 'compound', + 'abi': abis.abis.compoundv1 + }, + { + 'name': 'usdtPool', + 'address': '0x52EA46506B9CC5Ef470C5bf89f17Dc28bB35D85C', + 'coins': [0,1,2], + 'type': 'compound', + 'abi': abis.abis.compoundv1 + }, + { + 'name': 'YPool', + 'address': '0x45F783CCE6B7FF23B2ab2D70e416cdb7D6055f51', + 'coins': [0,1,2,3], + 'type': 'yToken', + 'abi': abis.abis.compoundv1 + }, + { + 'name': 'PAX', + 'address': '0x06364f10B501e868329afBc005b3492902d6C763', + 'coins': [0,1,2,3], + 'type': 'yToken', + 'abi': abis.abis.compoundv1 + }, + { + 'name': 'BUSD', + 'address': '0x79a8C46DeA5aDa233ABaFFD40F3A0A2B1e5A4F27', + 'coins': [0,1,2,3], + 'type': 'yToken', + 'abi': abis.abis.compoundv1 + }, + { + 'name': 'sUSD', + 'address': '0xA5407eAE9Ba41422680e2e00537571bcC53efBfD', + 'coins': [0,1,2,3], + 'type': 1, + 'abi': abis.abis.abisBTC + }, + { + 'name': '3Pool', + 'address': '0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7', + 'coins': [0,1,2], + 'type': 1, + 'abi': abis.abis.abiNew + }, + { + 'name': 'DUSD', + 'address': '0x8038C01A0390a8c547446a0b2c18fc9aEFEcc10c', + 'coins': [0], + 'type': 1, + 'abi': abis.abis.abiNew + }, + + + +] + +let coinDecimals = [ + { + '0x8dAEBADE922dF735c38C80C7eBD708Af50815fAa': '18', + '0x0316EB71485b0Ab14103307bf65a021042c6d380': '18', + '0xEB4C2781e4ebA804CE9a9803C67d0893436bB27D': '8', + '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599': '8', + '0xfE18be6b3Bd88A2D2A7f928d00292E7a9963CfC6': '18', + '0x196f4727526eA7FB1e17b2071B3d8eAA38486988': '18', + '0xe2f2a5C287993345a840Db3B0845fbC70f5935a5': '18', + '0x0E2EC54fC0B509F445631Bf4b91AB8168230C752': '18', //linkusd + '0x674C6Ad92Fd080e4004b2312b45f796a192D27a0': '18', //USDN + '0x1c48f86ae57291F7686349F12601910BD8D470bb': '18', //USDK + '0x056Fd409E1d7A124BD7017459dFEa2F387b6d5Cd': '2', //GUSD + '0x39AA39c021dfbaE8faC545936693aC917d5E7563': '8', //cUSD + '0x5d3a536E4D6DbD6114cc1Ead35777bAB948E3643': '8', //cDAI + '0xdAC17F958D2ee523a2206206994597C13D831ec7': '6', //USDT + '0x73a052500105205d34Daf004eAb301916DA8190f': '18', //yTUSD + '0xd6aD7a6750A7593E092a9B218d66C0A814a3436e': '6', ///yUSDC + '0x16de59092dAE5CcF4A1E6439D611fd0653f0Bd01': '18', ///yDAI + '0x83f798e925BcD4017Eb265844FDDAbb448f1707D': '6', ///yUSDT + '0x8E870D67F660D95d5be530380D0eC0bd388289E1': '18', //PAX + '0x9777d7E2b60bB01759D0E2f8be2095df444cb07E': '6', ///ycUSDC + '0x99d1Fa417f94dcD62BfE781a1213c092a47041Bc': '18', ///ycDAI + '0x1bE5d71F2dA660BFdee8012dDc58D024448A0A59': '6', ///ycUSDT + '0x04bC0Ab673d88aE9dbC9DA2380cB6B79C4BCa9aE': '18', //Y2busd + '0x26EA744E5B887E5205727f55dFBE8685e3b21951': '6', ///y2USDC + '0xC2cB1040220768554cf699b0d863A3cd4324ce32': '18', ///y2DAI + '0xE6354ed5bC4b393a5Aad09f21c46E101e692d447': '6', ///y2USDT + '0x57Ab1ec28D129707052df4dF418D58a2D46d5f51': '18', //sUSD + '0x6B175474E89094C44Da98b954EedeAC495271d0F': '18', //DAI + '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48': '6', //USDC + '0x5BC25f649fc4e26069dDF4cF4010F9f706c23831': '18', //dusd + '0x0000000000085d4780B73119b644AE5ecd22b376': '18' + } +] + +async function tvl(timestamp, block) { + var price_feed = await axios.get(`https://coins.llama.fi/prices/historical/${timestamp}/${["bitcoin","cdai","compound-usd-coin"].map(c=>"coingecko:"+c).join(',')}`) + var tvl = 0; + var btcTVL = 0; + await Promise.all( + swaps.map(async item => { + var details = {}; + await Promise.all( + item.coins.map(async i => { + try{ + poolAmount = await calc(item, i, price_feed, block); + if (item.type == 'btc') { + btcTVL += parseFloat(poolAmount); + } else { + tvl += parseFloat(poolAmount ) + } + } catch(e){ + console.log(item.name, i, "failed") + } + }) + ) + }) + ) + + var tvl = (price_feed.data.coins['coingecko:bitcoin'].price * btcTVL) + tvl + return toUSDTBalances(tvl); +} + +async function getVirtualPrice(abi, contract, block) { + var dacontract = new web3.eth.Contract(abi, contract) + dacontract.defaultBlock = block; + var virtualPrice = await dacontract.methods.getPricePerFullShare().call(); + return virtualPrice; +} + + + + + +async function calc(item, i, price_feed, block) { + var dacontract = new web3.eth.Contract(item.abi, item.address) + dacontract.defaultBlock = block + var balances = await dacontract.methods.balances(i).call(); + var coins = await dacontract.methods.coins(i).call(); + + + var poolAmount = await new BigNumber(balances).div(10 ** coinDecimals[0][coins]).toFixed(2); + + + if (item.type == 'compound') { + var multiplier = 1; + if (coins === '0x39AA39c021dfbaE8faC545936693aC917d5E7563') { + multiplier = price_feed.data.coins['coingecko:compound-usd-coin'].price; + } + if (coins === '0x5d3a536E4D6DbD6114cc1Ead35777bAB948E3643') { + multiplier = price_feed.data.coins['coingecko:cdai'].price; + } + poolAmount = poolAmount * multiplier; + } + + if (item.type == 'yToken') { + var multiplier = 1; + if (coins !== '0x8E870D67F660D95d5be530380D0eC0bd388289E1') { // PAX exception + var multiplier = await getVirtualPrice(abis.abis.yTokens, coins, block) + multiplier = await new BigNumber(multiplier).div(10 ** 18).toFixed(4); + } + poolAmount = poolAmount * multiplier; + } + + return poolAmount; +} + + + +module.exports = { + ethereum:{tvl} +} \ No newline at end of file From ec51ee6e674f385480cf1c386e889e716fe74160 Mon Sep 17 00:00:00 2001 From: LuxsFi <132330168+LuxsFi@users.noreply.github.com> Date: Sat, 24 Jun 2023 20:56:12 +0200 Subject: [PATCH 0068/1974] add facades (#6626) Co-authored-by: Thomas F --- projects/luxs.fi/index.js | 76 ++++++++++++++++++++++----------------- 1 file changed, 43 insertions(+), 33 deletions(-) diff --git a/projects/luxs.fi/index.js b/projects/luxs.fi/index.js index 1022b931e7c..4647fc18d66 100755 --- a/projects/luxs.fi/index.js +++ b/projects/luxs.fi/index.js @@ -1,42 +1,52 @@ const sdk = require("@defillama/sdk"); -const vaults = { - 'polygon': ["0xE770038935b8D4B0d98118A682D05ce84E489724", "0x5125b6AB66dBAE17ded9841195b572f8c97592Ee", "0x705Aa351FB6c43547FC7E033732d07a9bfa20B1d"], - 'arbitrum': ["0x997C0a71A6C6Cf8aE329F5730Cc01bfd1a176C9e", "0xC9bec60E78E011aA14555c4A13469bE8a0344633", "0xfE48c97F9AB4E65c567f53156f0988F36d97F9a5", "0x7455DF92B0Cd996906Da495724B4B27e8A4FFb21"], - 'bsc': ["0xE324D24fA26BB73f9C104850D44af99ccB18a612", "0x09104993F206cb53e7ac5dBC70DD974f68F1c407", "0xEDd43c446eA21a80eE388010d6db8EfbE366d604", "0x819f6fBD91D99420794Adefdb1604Bfc3182AC39", "0x0F6484f73eEc82024F8F6866f1fdb17B6D9Ce808"], - 'optimism': ["0x0348Bb2730daC30966Ff15849ca6Ae24a93A59C1", "0x5125b6AB66dBAE17ded9841195b572f8c97592Ee", "0x705Aa351FB6c43547FC7E033732d07a9bfa20B1d", "0xE770038935b8D4B0d98118A682D05ce84E489724", "0xEcc4e5e4BbA01E566dBEdBC4B4B817Abe7811Fa5", "0x4744c5EDc84dF3fEad0F5Dcb03de00370d738711", "0x7455DF92B0Cd996906Da495724B4B27e8A4FFb21", "0x15DDd2Fb8c6e9CcAd1D3753120E59fc3BFf9e324", "0xc5697053614EAb2C35e4f20E410C566D862b2213", "0xF291f7207D224Df1CF9702Ca15a33C77883cfCF8", "0x62301063130F11B8DB8141a667Bc33fFEAfC1408", "0x6573d525A70f564c2d65d80Cd9B216926504B77A"] -} +const facades = { + polygon: "0x0708542D895C2559001Fa9e4Bc49C3343735e6e2", + arbitrum: "0xE75254f298a5145438595Aa9d6D4327fCD14418D", + bsc: "0xD187937762c6fd4d7a58C71fD810CbfE22E64a84", + optimism: "0x285cAee14514f30bB178FB56c985e43A47d68E75", +}; + +async function tvl(_, _b, _cb, { api }) { + const vaults = await api.call({ + abi: " function getVaults() external view returns (address[] memory) ", + target: facades[api.chain], + }); -async function tvl(_, _b, _cb, { api, }) { - const balances = {} - const tokens = await api.multiCall({ - abi: 'address:token', - calls: vaults[api.chain], - }) + const balances = {}; + const tokens = await api.multiCall({ + abi: "address:token", + calls: vaults, + }); - const totalBalance = await api.multiCall({ - abi: 'function totalBalance() public view returns (uint256)', - calls: vaults[api.chain], - }) + const totalBalance = await api.multiCall({ + abi: "function getVaultValueLocked(address _vault) external view returns (uint256)", + calls: vaults.map((address) => ({ + target: facades[api.chain], + params: [address], + })), + chain: api.chain, + }); - tokens.forEach((t, i) => sdk.util.sumSingleBalance(balances, t, totalBalance[i], api.chain)) - return balances + tokens.forEach((t, i) => + sdk.util.sumSingleBalance(balances, t, totalBalance[i], api.chain) + ); + return balances; } module.exports = { - misrepresentedTokens: true, - arbitrum: { - tvl: tvl, - }, - optimism: { - tvl: tvl, - }, - polygon: { - tvl: tvl, - }, - bsc: { - tvl: tvl, - }, - methodology: - "TVL is counted from the LuxsFi vaults contracts" + misrepresentedTokens: true, + arbitrum: { + tvl: tvl, + }, + optimism: { + tvl: tvl, + }, + polygon: { + tvl: tvl, + }, + bsc: { + tvl: tvl, + }, + methodology: "TVL is counted from the LuxsFi vaults contracts", }; \ No newline at end of file From 85c4ff12f2d635b989afce54f503cf780e1dde1e Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Sat, 24 Jun 2023 20:57:25 +0100 Subject: [PATCH 0069/1974] fix syntax --- projects/curve/historical/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/curve/historical/index.js b/projects/curve/historical/index.js index 02c468fd61a..e638eb578f1 100644 --- a/projects/curve/historical/index.js +++ b/projects/curve/historical/index.js @@ -184,7 +184,7 @@ async function tvl(timestamp, block) { await Promise.all( item.coins.map(async i => { try{ - poolAmount = await calc(item, i, price_feed, block); + const poolAmount = await calc(item, i, price_feed, block); if (item.type == 'btc') { btcTVL += parseFloat(poolAmount); } else { @@ -250,4 +250,4 @@ async function calc(item, i, price_feed, block) { module.exports = { ethereum:{tvl} -} \ No newline at end of file +} From c3c8f539bff9a5afaf83a3ca44b9b94d9eaf1c7a Mon Sep 17 00:00:00 2001 From: Junho Yeo Date: Mon, 26 Jun 2023 02:51:22 +0900 Subject: [PATCH 0070/1974] Swapscanner GCKLAY TVL (#6633) --- projects/swapscanner-staking/index.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 projects/swapscanner-staking/index.js diff --git a/projects/swapscanner-staking/index.js b/projects/swapscanner-staking/index.js new file mode 100644 index 00000000000..e0d48b95604 --- /dev/null +++ b/projects/swapscanner-staking/index.js @@ -0,0 +1,24 @@ +const sdk = require("@defillama/sdk"); +const { nullAddress } = require('../helper/unwrapLPs'); +const chain = 'klaytn' + +const SCNR = { + GCKLAY: '0x999999999939ba65abb254339eec0b2a0dac80e9' +} + +module.exports = { + klaytn: { + tvl: async (_, _b, {klaytn:block}) => { + const gcklayBal = await sdk.api2.abi.call({ + target: SCNR.GCKLAY, + abi: 'erc20:totalSupply', + chain, block, + }) + + const balances = {} + sdk.util.sumSingleBalance(balances, nullAddress, gcklayBal, chain) + return balances; + } + }, + timetravel: false, +} From 37a8b215be7c17ef11953b7cdf575f3967c38e94 Mon Sep 17 00:00:00 2001 From: pulsemaxdefi <135190746+pulsemaxdefi@users.noreply.github.com> Date: Sun, 25 Jun 2023 23:38:32 +0530 Subject: [PATCH 0071/1974] pulsemax finance (#6632) * pulsemax finance * Update index.js use tomb helper --------- Co-authored-by: darkcrystl <111988230+tombhio@users.noreply.github.com> Co-authored-by: Real Shaman <85087525+realdealshaman@users.noreply.github.com> --- projects/pulsemaxfinance/index.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 projects/pulsemaxfinance/index.js diff --git a/projects/pulsemaxfinance/index.js b/projects/pulsemaxfinance/index.js new file mode 100644 index 00000000000..40b9adf5320 --- /dev/null +++ b/projects/pulsemaxfinance/index.js @@ -0,0 +1,17 @@ +const { tombTvl } = require("../helper/tomb"); + +const max = "0x368acF537B1A8EfFE4ceEF11054CBcEAF0302086"; +const pshare = "0xbc57572Ba711C8077222142C3374acE7B0c92231"; +const rewardpool = "0xEb8A0191Fa31F7aCEDeDe618246f7f7f907139bA"; +const boardroom = "0x4c5c8fD88Ba0709949e3C5Be3502500112Cd026c"; + +const pool2LPs = [ + "0x32D1D76bA3df143C7258d933dAfB048f137c42BA", // PSHARE-DAI + "0x0edC492E29Ce7bEd4c71f83513E435f5d81cDEF9", // MAX-DAI + "0x99B45b6f0Dd06866C955207c96431cDA2DA1d34b" // MAX-PSHARE +] + +module.exports = { + misrepresentedTokens: true, + ...tombTvl(max, pshare, rewardpool, boardroom, pool2LPs, "pulse", undefined, false, pool2LPs[0]) +} From 04dd6af974ed3e18d03545ad728f8023d1d5ccff Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Sun, 25 Jun 2023 20:30:02 +0100 Subject: [PATCH 0072/1974] fix eralend --- projects/helper/compound.js | 6 +++--- projects/nexon/index.js | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/projects/helper/compound.js b/projects/helper/compound.js index 1f2aa7eee49..fa243b8d283 100644 --- a/projects/helper/compound.js +++ b/projects/helper/compound.js @@ -270,13 +270,13 @@ function getCompoundUsdTvl(comptroller, chain, cether, borrowed, abis = { } } -function compoundExports(comptroller, chain, cether, cetheEquivalent, transformAdressRaw, checkForLPTokens, { blacklistedTokens = [], fetchBalances, abis = {} } = {}) { +function compoundExports(comptroller, chain, cether, cetheEquivalent, transformAdressRaw, checkForLPTokens, { blacklistedTokens = [], fetchBalances, abis = {}, resolveLPs=true } = {}) { if (cether !== undefined && cetheEquivalent === undefined) { throw new Error("You need to define the underlying for native cAsset") } return { - tvl: getCompoundV2Tvl(comptroller, chain, transformAdressRaw, cether, cetheEquivalent, false, checkForLPTokens, { blacklistedTokens, fetchBalances, abis }), - borrowed: getCompoundV2Tvl(comptroller, chain, transformAdressRaw, cether, cetheEquivalent, true, checkForLPTokens, { blacklistedTokens, fetchBalances, abis }) + tvl: getCompoundV2Tvl(comptroller, chain, transformAdressRaw, cether, cetheEquivalent, false, checkForLPTokens, { blacklistedTokens, fetchBalances, abis, resolveLPs }), + borrowed: getCompoundV2Tvl(comptroller, chain, transformAdressRaw, cether, cetheEquivalent, true, checkForLPTokens, { blacklistedTokens, fetchBalances, abis, resolveLPs }) } } diff --git a/projects/nexon/index.js b/projects/nexon/index.js index 35b710caa74..f592935d29a 100644 --- a/projects/nexon/index.js +++ b/projects/nexon/index.js @@ -2,5 +2,7 @@ const { compoundExports } = require('../helper/compound'); const { nullAddress } = require('../helper/tokenMapping'); module.exports = { - era: compoundExports('0x0171cA5b372eb510245F5FA214F5582911934b3D', 'era', '0x1BbD33384869b30A323e15868Ce46013C82B86FB', nullAddress), + era: compoundExports('0x0171cA5b372eb510245F5FA214F5582911934b3D', 'era', '0x1BbD33384869b30A323e15868Ce46013C82B86FB', nullAddress, undefined, undefined, { + resolveLPs: false + }), }; \ No newline at end of file From 97312ad65344f7b820a328ccf6d53213914c1dab Mon Sep 17 00:00:00 2001 From: Brandon Date: Sun, 25 Jun 2023 15:46:06 -0600 Subject: [PATCH 0073/1974] feat: :zap: Include all deployed chains to Steer adapter Added: avax, bnb, metis, evmos, p_zkevm, celo, thundercore binance historical node failing --- projects/steer/index.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/projects/steer/index.js b/projects/steer/index.js index eb77119f491..a936ba4eedb 100644 --- a/projects/steer/index.js +++ b/projects/steer/index.js @@ -3,6 +3,13 @@ const config = { polygon: { registry: '0x24825b3c44742600d3995d1d3760ccee999a7f0b', fromBlock: 41535540, }, arbitrum: { registry: '0x9f5b097AD23e2CF4F34e502A3E41D941678877Dc', fromBlock: 88698956, }, optimism: { registry: '0xC1Ecd10398A6D7036CceE1f50551ff169715081c', fromBlock: 96971465, }, + avax: { registry: '0x9f5b097AD23e2CF4F34e502A3E41D941678877Dc', fromBlock: 30434642, }, + binance: { registry: '0x31e4ee367d4f2685BAfcAb9566e9C87E60D48983', fromBlock: 28461459, }, + evmos: { registry: '0xD90c8970708FfdFC403bdb56636621e3E9CCe921', fromBlock: 13671900, }, + metis: { registry: '0x116Dba5DcE9CcDA828218b7eB46406810632014C', fromBlock: 6067741, }, + polygon_zkevm: { registry: '0x9f5b097AD23e2CF4F34e502A3E41D941678877Dc', fromBlock: 1022413, }, + celo: { registry: '0x116Dba5DcE9CcDA828218b7eB46406810632014C', fromBlock: 19813127, }, + thundercore: { registry: '0xa1Dd21fbd9e1F0BF28d41F18bDC22326e50C02e9', fromBlock: 135181847, }, } module.exports = {}; From 2b0f365c2e69981b9af8171365f7567ab45f95f6 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 26 Jun 2023 07:56:24 +0200 Subject: [PATCH 0074/1974] veldrome v2 --- projects/velodrome/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/projects/velodrome/index.js b/projects/velodrome/index.js index 93fe01c2e28..ff8fe7e895a 100644 --- a/projects/velodrome/index.js +++ b/projects/velodrome/index.js @@ -1,3 +1,4 @@ +const sdk = require('@defillama/sdk') const {uniTvlExport} = require('../helper/calculateUniTvl.js') module.exports = { @@ -6,7 +7,10 @@ module.exports = { timetravel: true, incentivized: true, optimism: { - tvl: uniTvlExport("0x25CbdDb98b35ab1FF77413456B31EC81A6B6B746", "optimism"), + tvl: sdk.util.sumChainTvls([uniTvlExport("0x25CbdDb98b35ab1FF77413456B31EC81A6B6B746"), uniTvlExport("0xF1046053aa5682b4F9a81b5481394DA16BE5FF5a", undefined, undefined, { + allPairsLength: 'uint256:allPoolsLength', + allPairs: 'function allPools(uint256) view returns (address)', + }, { fetchBalances: true,})]), }, hallmarks:[ [1657760400, "First OP grant awarded"], From 0558467291534c555b6d9699c44153a2b0407440 Mon Sep 17 00:00:00 2001 From: Michalis Kargakis Date: Mon, 26 Jun 2023 08:13:07 +0200 Subject: [PATCH 0075/1974] Reuse shared addresses for a bunch of assets (#6625) --- projects/balancer-v1/index.js | 11 +++-- projects/balancer/onchain.js | 5 ++- projects/basis-cash.js | 2 +- projects/bent/constants.js | 2 +- projects/clever/index.js | 5 ++- projects/component/index.js | 2 +- projects/compound-onchain/index.js | 2 +- projects/concentrator/index.js | 4 +- projects/config/hodltree/addresses.js | 6 +-- projects/config/keys.js | 20 ++++----- projects/config/smoothy/abis.js | 2 +- projects/convex/index.js | 2 +- projects/ddex/index.js | 4 +- projects/dydx/index.js | 2 +- projects/fraxfinance/index.js | 2 +- projects/gnosis/index.js | 2 +- projects/helper/coreAssets.json | 4 ++ projects/helper/curvePools.js | 2 +- projects/keep3r/registry.js | 4 +- projects/lyra/index.js | 2 +- projects/maker/abis/makerdao.js | 2 +- projects/maker/index.js | 2 +- projects/ondofinance-v1/index.js | 2 +- projects/pendle/v2.js | 3 +- projects/polynomial-earn/index.js | 11 +++-- projects/polynomial-trade/index.js | 4 +- projects/rari/index.js | 5 +-- projects/ray/index.js | 2 +- projects/redacted/index.js | 2 +- projects/sablier/index.js | 15 +++---- projects/set-protocol/v1.js | 12 +++--- projects/set-protocol/v2.js | 3 -- projects/thales/index.js | 3 +- projects/treasury/aave.js | 58 +++++++++++++-------------- projects/treasury/bancor.js | 4 +- projects/treasury/convex.js | 13 +++--- projects/treasury/gnosis-dao.js | 12 +++--- projects/treasury/idle-dao.js | 24 +++++------ projects/treasury/inverse.js | 20 ++++----- projects/treasury/jpegd.js | 2 +- projects/treasury/mimo-protocol.js | 12 +++--- projects/treasury/paladin-finance.js | 10 ++--- projects/treasury/railgun.js | 54 ++++++++++++------------- projects/treasury/stargate.js | 22 +++++----- projects/treasury/synthetix.js | 16 ++++---- projects/treasury/thellamas.js | 4 +- projects/treasury/yearn.js | 20 +++++---- projects/wonderland/index.js | 19 +++++---- projects/xdai/index.js | 4 +- projects/xtoken/constants.js | 2 +- projects/xtoken/index.js | 6 +-- 51 files changed, 227 insertions(+), 226 deletions(-) diff --git a/projects/balancer-v1/index.js b/projects/balancer-v1/index.js index 308f6d73844..212b039d049 100644 --- a/projects/balancer-v1/index.js +++ b/projects/balancer-v1/index.js @@ -1,9 +1,12 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { v1Tvl } = require('../helper/balancer') -const blacklistedTokens = ["0xC011A72400E58ecD99Ee497CF89E3775d4bd732F", "0x57Ab1E02fEE23774580C119740129eAC7081e9D3", // old synthetix -//self destructed -"0x00f109f744B5C918b13d4e6a834887Eb7d651535", "0x645F7dd67479663EE7a42feFEC2E55A857cb1833", "0x4922a015c4407F87432B179bb209e125432E4a2A", -"0xdA16D6F08F20249376d01a09FEBbAd395a246b2C", "0x9be4f6a2558f88A82b46947e3703528919CE6414", +const blacklistedTokens = [ + "0xC011A72400E58ecD99Ee497CF89E3775d4bd732F", + ADDRESSES.ethereum.sUSD_OLD, + //self destructed + "0x00f109f744B5C918b13d4e6a834887Eb7d651535", "0x645F7dd67479663EE7a42feFEC2E55A857cb1833", "0x4922a015c4407F87432B179bb209e125432E4a2A", + "0xdA16D6F08F20249376d01a09FEBbAd395a246b2C", "0x9be4f6a2558f88A82b46947e3703528919CE6414", ] module.exports = { diff --git a/projects/balancer/onchain.js b/projects/balancer/onchain.js index 0a94f003695..dd04ca028d5 100644 --- a/projects/balancer/onchain.js +++ b/projects/balancer/onchain.js @@ -1,7 +1,10 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { onChainTvl } = require('../helper/balancer') const { eulerTokens } = require('../helper/tokenMapping') -const blacklistedTokens = ["0xC011A72400E58ecD99Ee497CF89E3775d4bd732F", "0x57Ab1E02fEE23774580C119740129eAC7081e9D3", // old synthetix +const blacklistedTokens = [ + "0xC011A72400E58ecD99Ee497CF89E3775d4bd732F", + ADDRESSES.ethereum.sUSD_OLD, //self destructed "0x00f109f744B5C918b13d4e6a834887Eb7d651535", "0x645F7dd67479663EE7a42feFEC2E55A857cb1833", "0x4922a015c4407F87432B179bb209e125432E4a2A", "0xdA16D6F08F20249376d01a09FEBbAd395a246b2C", "0x9be4f6a2558f88A82b46947e3703528919CE6414", "0xa7fd7d83e2d63f093b71c5f3b84c27cff66a7802", diff --git a/projects/basis-cash.js b/projects/basis-cash.js index 4a3addb6ebe..04796ac67a7 100644 --- a/projects/basis-cash.js +++ b/projects/basis-cash.js @@ -4,7 +4,7 @@ const { sumTokens } = require('./helper/unwrapLPs') async function tvl(ts, block) { const toa = [ [ADDRESSES.ethereum.DAI, '0xEBd12620E29Dc6c452dB7B96E1F190F3Ee02BDE8'], - ['0x57ab1ec28d129707052df4df418d58a2d46d5f51', '0xdc42a21e38c3b8028b01a6b00d8dbc648f93305c'], + [ADDRESSES.ethereum.sUSD, '0xdc42a21e38c3b8028b01a6b00d8dbc648f93305c'], [ADDRESSES.ethereum.USDT, '0x2833bdc5B31269D356BDf92d0fD8f3674E877E44'], [ADDRESSES.ethereum.USDC, '0x51882184b7F9BEEd6Db9c617846140DA1d429fD4'], ['0xdf5e0e81dff6faf3a7e52ba697820c5e32d806a8', '0xC462d8ee54953E7d7bF276612b75387Ea114c3bf'], diff --git a/projects/bent/constants.js b/projects/bent/constants.js index adfb12447f2..45fa73b16bb 100644 --- a/projects/bent/constants.js +++ b/projects/bent/constants.js @@ -3,7 +3,7 @@ const addressZero = ADDRESSES.null; const ethAddress = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"; const wethAddress = ADDRESSES.ethereum.WETH; const bentCVXAddress = "0x9E0441E084F5dB0606565737158aa6Ab6B970fE0"; -const CVXAddress = "0x4e3FBD56CD56c3e72c1403e103b45Db9da5B9D2B"; +const CVXAddress = ADDRESSES.ethereum.CVX; const pool2Address = "0xd564b2feec19df8f4d6cb52c0a4386d05a993583"; const sushiLpAddress = "0x5fa4370164a2fabeef159b893299d59ff5dc1e6d"; const bentAddress = "0x01597e397605bf280674bf292623460b4204c375"; diff --git a/projects/clever/index.js b/projects/clever/index.js index c75efacc5db..06279aee253 100644 --- a/projects/clever/index.js +++ b/projects/clever/index.js @@ -1,8 +1,9 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const commonAbi = require("./abis/index.json") const config = require("./config") + const lockCvxAddress = '0x96C68D861aDa016Ed98c30C810879F9df7c64154'; -const cvxAddress = "0x4e3FBD56CD56c3e72c1403e103b45Db9da5B9D2B"; async function pool2(_, _1, _2, { api, balances = {}}) { const gaugeTotalSupplies = await api.multiCall({ @@ -37,7 +38,7 @@ async function tvl(timestamp, block, _, { api }) { }), getClevers(balances, api), ]) - sdk.util.sumSingleBalance(balances, cvxAddress, totalLockedGlobal) + sdk.util.sumSingleBalance(balances, ADDRESSES.ethereum.CVX, totalLockedGlobal) return balances } diff --git a/projects/component/index.js b/projects/component/index.js index d5da73cff36..c4da60879c6 100644 --- a/projects/component/index.js +++ b/projects/component/index.js @@ -30,7 +30,7 @@ const ethPools = [ underlying: [ "0x1456688345527bE1f37E9e627DA0837D6f08C925", ADDRESSES.ethereum.DAI, - "0x57Ab1ec28D129707052df4dF418D58a2D46d5f51" + ADDRESSES.ethereum.sUSD ] } ]; diff --git a/projects/compound-onchain/index.js b/projects/compound-onchain/index.js index b708cb97508..0b340809c7e 100644 --- a/projects/compound-onchain/index.js +++ b/projects/compound-onchain/index.js @@ -57,7 +57,7 @@ const markets = [ cToken: '0xB3319f5D18Bc0D84dD1b4825Dcde5d5f7266d407', }, { - underlying: '0x89d24A6b4CcB1B6fAA2625fE562bDD9a23260359', + underlying: ADDRESSES.ethereum.SAI, symbol: 'SAI', decimals: 18, cToken: '0xF5DCe57282A584D2746FaF1593d3121Fcac444dC', diff --git a/projects/concentrator/index.js b/projects/concentrator/index.js index b386efb7b61..0397ffeee74 100644 --- a/projects/concentrator/index.js +++ b/projects/concentrator/index.js @@ -8,14 +8,14 @@ const AladdinCRVABI = require('./abis/AladdinCRV.json') const AladdinAFXSABI = require('./abis/AladdinAFXS.json') const AladdinCVXABI = require('./abis/AladdinCVX.json') const AladdinSdCRVABI = require('./abis/AladdinSdCRV.json') -const { farmConfig, vaultConfig: configPools, afrxETHConfig } = require('./config.js'); +const { farmConfig } = require('./config.js'); const concentratorVault = '0xc8fF37F7d057dF1BB9Ad681b53Fa4726f268E0e8'; const concentratorAcrv = '0x2b95A1Dcc3D405535f9ed33c219ab38E8d7e0884'; const concentratorAFXS = '0xDAF03D70Fe637b91bA6E521A32E1Fb39256d3EC9'; const concentratorAFrxETH = "0xb15Ad6113264094Fd9BF2238729410A07EBE5ABa"; -const cvxcrvAddress = '0x62b9c7356a2dc64a1969e19c23e4f579f9810aa7'; +const cvxcrvAddress = ADDRESSES.ethereum.cvxCRV; const concentratorAbcCVXAddress = '0xDEC800C2b17c9673570FDF54450dc1bd79c8E359'; const concentratorAsdCRVAddress = "0x43E54C2E7b3e294De3A155785F52AB49d87B9922" diff --git a/projects/config/hodltree/addresses.js b/projects/config/hodltree/addresses.js index c011537046f..a07fe69df67 100644 --- a/projects/config/hodltree/addresses.js +++ b/projects/config/hodltree/addresses.js @@ -56,7 +56,7 @@ const eth = [ address: '0x2e5a08c26cb22109e585784c4f99363bb3e199ab', miscInfo: { tokensIn: [ - '0x57Ab1ec28D129707052df4dF418D58a2D46d5f51', + ADDRESSES.ethereum.sUSD, '0x056Fd409E1d7A124BD7017459dFEa2F387b6d5Cd', ADDRESSES.ethereum.USDC, ADDRESSES.ethereum.DAI, @@ -77,13 +77,13 @@ const eth = [ contractType: em.rp, address: '0xce596bf99d21e46fa91143c03d7a356682b67859', miscInfo: { - token: '0x57Ab1ec28D129707052df4dF418D58a2D46d5f51' + token: ADDRESSES.ethereum.sUSD } }, { contractType: em.vps, address: '0xb7ead8c418f3d03bc22dd538c22600abe7209e72', miscInfo: { - token: '0x57ab1ec28d129707052df4df418d58a2d46d5f51' + token: ADDRESSES.ethereum.sUSD } }, diff --git a/projects/config/keys.js b/projects/config/keys.js index c77990458bb..9d5be2d3bd2 100644 --- a/projects/config/keys.js +++ b/projects/config/keys.js @@ -7,26 +7,26 @@ let keys = [ADDRESSES.ethereum.AAVE]: 'aave', [ADDRESSES.ethereum.USDC]: 'stable', [ADDRESSES.ethereum.TUSD]: 'stable', - [ADDRESSES.ethereum.YFI]: 'yearn-finance', //yfi + [ADDRESSES.ethereum.YFI]: 'yearn-finance', '0x408e41876cccdc0f92210600ef50372656052a38': 'republic-protocol', //ren '0x80fB784B7eD66730e8b1DBd9820aFD29931aab03': 'ethlend', //lend - [ADDRESSES.ethereum.BUSD]: 'stable', //busd - [ADDRESSES.ethereum.USDT]: 'stable', //USDT - [ADDRESSES.ethereum.DAI]: 'stable', //DAI - [ADDRESSES.ethereum.MKR]: 'maker', //makerdao - [ADDRESSES.ethereum.SNX]: 'havven', //SNX + [ADDRESSES.ethereum.BUSD]: 'stable', + [ADDRESSES.ethereum.USDT]: 'stable', + [ADDRESSES.ethereum.DAI]: 'stable', + [ADDRESSES.ethereum.MKR]: 'maker', + [ADDRESSES.ethereum.SNX]: 'havven', '0x0f5d2fb29fb7d3cfee444a200298f468908cc942': 'decentraland', //MANA - [ADDRESSES.ethereum.UNI]: 'uniswap', //uni + [ADDRESSES.ethereum.UNI]: 'uniswap', '0xdd974d5c2e2928dea5f71b9825b8b646686bd200': 'kyber-network', //knc '0xf629cbd94d3791c9250152bd8dfbdf380e2a3b9c': 'enjincoin', //ENJ - [ADDRESSES.ethereum.BAT]: 'basic-attention-token', //BAT - '0x57ab1ec28d129707052df4df418d58a2d46d5f51': 'stable', //susd + [ADDRESSES.ethereum.BAT]: 'basic-attention-token', + [ADDRESSES.ethereum.sUSD]: 'stable', '0xe41d2489571d322189246dafa5ebde1f4699f498': '0x', //0x [ADDRESSES.ethereum.CRV]: 'curve-dao-token', '0xc00e94cb662c3520282e6f5717214004a7f26888': 'compound-governance-token', '0x04fa0d235c4abf4bcf4787af4cf447de572ef828': 'uma', '0xd26114cd6ee289accf82350c8d8487fedb8a0c07': 'omisego', - '0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359': 'sai', + [ADDRESSES.ethereum.SAI]: 'sai', [ADDRESSES.ethereum.WETH]: 'ethereum', '0x5d3a536e4d6dbd6114cc1ead35777bab948e3643': 'cdai', '0xbc396689893d065f41bc2c6ecbee5e0085233447': 'perpetual-protocol', diff --git a/projects/config/smoothy/abis.js b/projects/config/smoothy/abis.js index 747c8dc3e71..408e5a45c20 100644 --- a/projects/config/smoothy/abis.js +++ b/projects/config/smoothy/abis.js @@ -34,7 +34,7 @@ abis.tokens = [ }, { symbol: "sUSD", - address: "0x57ab1ec28d129707052df4df418d58a2d46d5f51", + address: ADDRESSES.ethereum.sUSD, id: 4, decimals: 18, }, diff --git a/projects/convex/index.js b/projects/convex/index.js index 579515f003c..b45440ae196 100644 --- a/projects/convex/index.js +++ b/projects/convex/index.js @@ -5,7 +5,7 @@ const { sumTokensExport } = require('../helper/unwrapLPs') const boosterAddress = "0xF403C135812408BFbE8713b5A23a04b3D48AAE31"; const staker = '0x989aeb4d175e16225e39e87d0d97a3360524ad80' -const cvxAddress = "0x4e3FBD56CD56c3e72c1403e103b45Db9da5B9D2B"; +const cvxAddress = ADDRESSES.ethereum.CVX; const cvxRewardsAddress = "0xCF50b810E57Ac33B91dCF525C6ddd9881B139332"; const crvAddress = ADDRESSES.ethereum.CRV; diff --git a/projects/ddex/index.js b/projects/ddex/index.js index e10a15c6e01..7af4ef51511 100644 --- a/projects/ddex/index.js +++ b/projects/ddex/index.js @@ -1,8 +1,10 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk'); const { nullAddress, sumTokens2 } = require('../helper/unwrapLPs') const { createIncrementArray, getUniqueAddresses } = require('../helper/utils') + const ddexMarginContractAddress = '0x241e82c79452f51fbfc89fac6d912e021db1a3b7' -const SAI = '0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359' +const SAI = ADDRESSES.ethereum.SAI async function tvl(timestamp, block) { const tokens = [] diff --git a/projects/dydx/index.js b/projects/dydx/index.js index 5365f32b3b7..0189c829c5c 100644 --- a/projects/dydx/index.js +++ b/projects/dydx/index.js @@ -10,7 +10,7 @@ const ADDRESSES = require('../helper/coreAssets.json') ]; const tokens = [ - '0x89d24A6b4CcB1B6fAA2625fE562bDD9a23260359', + ADDRESSES.ethereum.SAI, ADDRESSES.ethereum.WETH, ADDRESSES.ethereum.USDC, ADDRESSES.ethereum.DAI diff --git a/projects/fraxfinance/index.js b/projects/fraxfinance/index.js index 66c05dcf667..66c70cc6a50 100644 --- a/projects/fraxfinance/index.js +++ b/projects/fraxfinance/index.js @@ -154,7 +154,7 @@ async function addInvestorAMO(api, balances) { TrueUSD: ADDRESSES.ethereum.TUSD, 'Gelato Network Token': '0x15b7c0c907e4c6b9adaaaabc300c08991d6cea05', 'Staked Aave': '0x4da27a545c0c5b758a6ba100e3a049001de870f5', - 'Convex Token': '0x4e3fbd56cd56c3e72c1403e103b45db9da5b9d2b', + 'Convex Token': ADDRESSES.ethereum.CVX, 'Curve DAO Token': ADDRESSES.ethereum.CRV, 'Bend Token': '0x0d02755a5700414b26ff040e1de35d337df56218', 'Binance USD': ADDRESSES.ethereum.BUSD, diff --git a/projects/gnosis/index.js b/projects/gnosis/index.js index 32171ae7cb9..78cea23f170 100644 --- a/projects/gnosis/index.js +++ b/projects/gnosis/index.js @@ -18,7 +18,7 @@ function addTvl(owner) { ADDRESSES.ethereum.USDC, '0x6810e776880c02933d47db1b9fc05908e5386b96', ADDRESSES.ethereum.YFI, - '0x57ab1ec28d129707052df4df418d58a2d46d5f51', + ADDRESSES.ethereum.sUSD, ADDRESSES.ethereum.UNI, '0xa1d65E8fB6e87b60FECCBc582F7f97804B725521', '0xc00e94cb662c3520282e6f5717214004a7f26888', diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index 03901715f6a..48ab7d08b34 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -17,7 +17,9 @@ "SNX": "0xc011a73ee8576fb46f5e1c5751ca3b9fe0af2a6f", "YFI": "0x0bc529c00c6401aef6d220be8c6ea1667f6ad93e", "DAI": "0x6b175474e89094c44da98b954eedeac495271d0f", + "SAI": "0x89d24A6b4CcB1B6fAA2625fE562bDD9a23260359", "cvxFXS": "0xfeef77d3f69374f66429c91d732a244f074bdf74", + "cvxCRV": "0x62B9c7356A2Dc64a1969e19C23e4f579F9810Aa7", "vlCVX": "0x72a19342e8f1838460ebfccef09f6585e32db86e", "CVX": "0x4e3FBD56CD56c3e72c1403e103b45Db9da5B9D2B", "BNB": "0xb8c77482e45f1f44de1745f52c74426c631bdd52", @@ -33,6 +35,8 @@ "FTM": "0x4e15361fd6b4bb609fa63c81a2be19d873717870", "GNO": "0x6810e776880C02933D47DB1b9fc05908e5386b96", "LUSD": "0x5f98805A4E8be255a32880FDeC7F6728C6568bA0", + "sUSD_OLD": "0x57ab1e02fee23774580c119740129eac7081e9d3", + "sUSD": "0x57Ab1ec28D129707052df4dF418D58a2D46d5f51", "SUSHI": "0x6b3595068778dd592e39a122f4f5a5cf09c90fe2" }, "fantom": { diff --git a/projects/helper/curvePools.js b/projects/helper/curvePools.js index 0c2c5de3cf5..a16a392b6e0 100644 --- a/projects/helper/curvePools.js +++ b/projects/helper/curvePools.js @@ -128,7 +128,7 @@ module.exports = { ADDRESSES.ethereum.USDT, ADDRESSES.ethereum.USDC, ADDRESSES.ethereum.DAI, - '0x57ab1ec28d129707052df4df418d58a2d46d5f51' + ADDRESSES.ethereum.sUSD, ] }, // renBTC Eth diff --git a/projects/keep3r/registry.js b/projects/keep3r/registry.js index 2fb84e5626c..edbe91be213 100644 --- a/projects/keep3r/registry.js +++ b/projects/keep3r/registry.js @@ -21,11 +21,11 @@ exports.registry = { SJPY: "0xF6b1C627e95BFc3c1b4c9B825a032Ff0fBf3e07d", SCHF: "0x0F83287FF768D1c1e17a42F44d644D7F22e8ee1d", MIM: "0x99d8a9c45b2eca8864373a26d1459e3dff1e17f3", - CVX: "0x4e3fbd56cd56c3e72c1403e103b45db9da5b9d2b", + CVX: ADDRESSES.ethereum.CVX, DAI: ADDRESSES.ethereum.DAI, SUSHI: ADDRESSES.ethereum.SUSHI, CRV: ADDRESSES.ethereum.CRV, - CVXCRV: "0x62B9c7356A2Dc64a1969e19C23e4f579F9810Aa7", + CVXCRV: ADDRESSES.ethereum.cvxCRV, SPELL: "0x090185f2135308BaD17527004364eBcC2D37e5F6", WETH: ADDRESSES.ethereum.WETH, LDO: ADDRESSES.ethereum.LIDO, diff --git a/projects/lyra/index.js b/projects/lyra/index.js index 0d219e532c9..954e559f998 100644 --- a/projects/lyra/index.js +++ b/projects/lyra/index.js @@ -62,7 +62,7 @@ const arb_tokens = [ADDRESSES.arbitrum.USDC, ADDRESSES.arbitrum.WETH, const L2toL1Synths = { [ADDRESSES.optimism.sETH]: '0x5e74c9036fb86bd7ecdcb084a0673efc32ea31cb', - [ADDRESSES.optimism.sUSD]: '0x57ab1ec28d129707052df4df418d58a2d46d5f51', + [ADDRESSES.optimism.sUSD]: ADDRESSES.ethereum.sUSD, '0x298b9b95708152ff6968aafd889c6586e9169f1d': '0xfe18be6b3bd88a2d2a7f928d00292e7a9963cfc6', '0xc5db22719a06418028a40a9b5e9a7c02959d0d08': '0xbbc455cb4f1b9e4bfc4b73970d360c8f032efee6' } diff --git a/projects/maker/abis/makerdao.js b/projects/maker/abis/makerdao.js index 0ec1d21e327..18ab2c20ff5 100755 --- a/projects/maker/abis/makerdao.js +++ b/projects/maker/abis/makerdao.js @@ -1,6 +1,6 @@ const ADDRESSES = require('../../helper/coreAssets.json') module.exports = { TUB_ADDRESS: "0x448a5065aebb8e423f0896e6c5d525c040f59af3", - DAI_ADDRESS: "0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359", + DAI_ADDRESS: ADDRESSES.ethereum.SAI, WETH_ADDRESS: ADDRESSES.ethereum.WETH }; \ No newline at end of file diff --git a/projects/maker/index.js b/projects/maker/index.js index c0c9465d36c..2dc14f6257a 100644 --- a/projects/maker/index.js +++ b/projects/maker/index.js @@ -86,7 +86,7 @@ async function tvl(timestamp, block, _, { api }) { } } - toa = toa.filter(i => i[0].toLowerCase() !== '0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359') + toa = toa.filter(i => i[0].toLowerCase() !== ADDRESSES.ethereum.SAI.toLowerCase()) const symbols = await api.multiCall({ abi: 'erc20:symbol', calls: toa.map(t => t[0]) }) const gUNIToa = toa.filter((_, i) => symbols[i] === 'G-UNI') toa = toa.filter((_, i) => symbols[i] !== 'G-UNI') diff --git a/projects/ondofinance-v1/index.js b/projects/ondofinance-v1/index.js index 330a12b39a2..1867f5b2b20 100644 --- a/projects/ondofinance-v1/index.js +++ b/projects/ondofinance-v1/index.js @@ -53,7 +53,7 @@ const data = { "0x67B6D479c7bB412C54e03dCA8E1Bc6740ce6b99C", "0x0cEC1A9154Ff802e7934Fc916Ed7Ca50bDE6844e", "0x04Fa0d235C4abf4BcF4787aF4CF447DE572eF828", - "0x4e3FBD56CD56c3e72c1403e103b45Db9da5B9D2B", + ADDRESSES.ethereum.CVX, "0xff20817765cb7f73d4bde2e66e067e58d11095c2", "0xa3BeD4E1c75D00fa6f4E5E6922DB7261B5E9AcD2", "0x470ebf5f030ed85fc1ed4c2d36b9dd02e77cf1b7", diff --git a/projects/pendle/v2.js b/projects/pendle/v2.js index a6f3a7ae143..e88a1c997ee 100644 --- a/projects/pendle/v2.js +++ b/projects/pendle/v2.js @@ -1,7 +1,8 @@ +const ADDRESSES = require('../helper/coreAssets.json') const contracts = require("./contracts"); const { staking } = require('../helper/staking') const { getLogs } = require('../helper/cache/getLogs') -const steth = "0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84"; +const steth = ADDRESSES.ethereum.STETH; const config = { ethereum: { factory: '0x27b1dacd74688af24a64bd3c9c1b143118740784', fromBlock: 16032059 }, arbitrum: { factory: '0xf5a7de2d276dbda3eef1b62a9e718eff4d29ddc8', fromBlock: 62979673 }, diff --git a/projects/polynomial-earn/index.js b/projects/polynomial-earn/index.js index 8f005cf93d8..45e2e9b9834 100644 --- a/projects/polynomial-earn/index.js +++ b/projects/polynomial-earn/index.js @@ -15,13 +15,12 @@ const polynomial_contracts = [ '0x23CB080dd0ECCdacbEB0BEb2a769215280B5087D' ] -const MAINNET_SUSD = '0x57Ab1ec28D129707052df4dF418D58a2D46d5f51' const MAINNET_SETH = '0x5e74C9036fb86BD7eCdcb084a0673EFc32eA31cb' //Optimism Synths to Mainnet Synths const L2toL1Synths = { [ADDRESSES.optimism.sETH]: MAINNET_SETH, - [ADDRESSES.optimism.sUSD]: MAINNET_SUSD, + [ADDRESSES.optimism.sUSD]: ADDRESSES.ethereum.sUSD, '0x298b9b95708152ff6968aafd889c6586e9169f1d': '0xfe18be6b3bd88a2d2a7f928d00292e7a9963cfc6', '0xc5db22719a06418028a40a9b5e9a7c02959d0d08': '0xbbc455cb4f1b9e4bfc4b73970d360c8f032efee6' } @@ -30,15 +29,15 @@ const contractL1Synths = { // sEth Call Selling '0x53268e841E30278EF0B9597813893fA8e4559510': MAINNET_SETH, // sETH Put Selling - '0xa11451ACD2Fbdf4Ae798F44c4227cAB9517739d7': MAINNET_SUSD, + '0xa11451ACD2Fbdf4Ae798F44c4227cAB9517739d7': ADDRESSES.ethereum.sUSD, // ETH PUT SELLING - '0xb28Df1b71a5b3a638eCeDf484E0545465a45d2Ec': MAINNET_SUSD, + '0xb28Df1b71a5b3a638eCeDf484E0545465a45d2Ec': ADDRESSES.ethereum.sUSD, // ETH CALL SELLING '0x2D46292cbB3C601c6e2c74C32df3A4FCe99b59C7': MAINNET_SETH, // GAMMA - '0x965e460bF5cb38BadA79fB2293c6304C799D0b1c': MAINNET_SUSD, + '0x965e460bF5cb38BadA79fB2293c6304C799D0b1c': ADDRESSES.ethereum.sUSD, //ETH CALL SELLING QUOTE - '0xB7b4270cFD938F4F1C111ac819e7365E8Ce0300a': MAINNET_SUSD + '0xB7b4270cFD938F4F1C111ac819e7365E8Ce0300a': ADDRESSES.ethereum.sUSD } diff --git a/projects/polynomial-trade/index.js b/projects/polynomial-trade/index.js index 2255cdf1fce..0589a8400e3 100644 --- a/projects/polynomial-trade/index.js +++ b/projects/polynomial-trade/index.js @@ -1,5 +1,5 @@ +const ADDRESSES = require('../helper/coreAssets.json') const axios = require('axios') -// const chain = 'optimism' // api const BASE_URL = "https://perps-api-experimental.polynomial.fi/snx-perps/tvl"; @@ -10,7 +10,7 @@ const api = axios.create({ async function tvl (timestamp, ethBlock) { const perpApi = await api.get(); return { - 'ethereum:0x57Ab1ec28D129707052df4dF418D58a2D46d5f51': perpApi.data.tvl * 1e18 + [`ethereum:${ADDRESSES.ethereum.sUSD}`]: perpApi.data.tvl * 1e18 }; } diff --git a/projects/rari/index.js b/projects/rari/index.js index b808992d910..5d8d5cfc694 100644 --- a/projects/rari/index.js +++ b/projects/rari/index.js @@ -30,9 +30,6 @@ const earnStablePoolAddressesIncludingLegacy = [ const fusePoolLensAddress = '0x8dA38681826f4ABBe089643D2B3fE4C6e4730493' const fusePoolDirectoryAddress = '0x835482FE0532f169024d5E9410199369aAD5C77E' const rariGovernanceTokenUniswapDistributorAddress = '0x1FA69a416bCF8572577d3949b742fBB0a9CD98c7' -const sushiETHRGTPairAddress = '0x18a797c7c70c1bf22fdee1c09062aba709cacf04' -const WETHTokenAddress = ADDRESSES.ethereum.WETH -const RGTTokenAddress = '0xD291E7a03283640FDc51b121aC401383A46cC623' const RGTETHSushiLPTokenAddress = '0x18a797c7c70c1bf22fdee1c09062aba709cacf04' const ETHAddress = ADDRESSES.null const bigNumZero = BigNumber('0') @@ -43,7 +40,7 @@ const tokenMapWithKeysAsSymbol = { 'USDT': ADDRESSES.ethereum.USDT, 'TUSD': ADDRESSES.ethereum.TUSD, 'BUSD': ADDRESSES.ethereum.BUSD, - 'SUSD': '0x57ab1ec28d129707052df4df418d58a2d46d5f51', + 'SUSD': ADDRESSES.ethereum.sUSD, 'MUSD': '0xe2f2a5c287993345a840db3b0845fbc70f5935a5' } diff --git a/projects/ray/index.js b/projects/ray/index.js index 2c9f4b208aa..0dffad302ea 100644 --- a/projects/ray/index.js +++ b/projects/ray/index.js @@ -4,7 +4,7 @@ const ADDRESSES = require('../helper/coreAssets.json') const ETH_ADDRESS = ADDRESSES.null; const WETH_ADDRESS = ADDRESSES.ethereum.WETH; -const SAI_ADDRESS = '0x89d24A6b4CcB1B6fAA2625fE562bDD9a23260359'; +const SAI_ADDRESS = ADDRESSES.ethereum.SAI; const DAI_ADDRESS = ADDRESSES.ethereum.DAI; const USDC_ADDRESS = ADDRESSES.ethereum.USDC; diff --git a/projects/redacted/index.js b/projects/redacted/index.js index be235610344..0d5c4440f5b 100644 --- a/projects/redacted/index.js +++ b/projects/redacted/index.js @@ -7,7 +7,7 @@ const treasuries = ["0xa52fd396891e7a74b641a2cb1a6999fcf56b077e", "0x086c98855df const cvxCRVStaking = '0x3Fe65692bfCD0e6CF84cB1E7d24108E434A7587e' const CVX = ADDRESSES.ethereum.CVX -const cvxCRV = '0x62b9c7356a2dc64a1969e19c23e4f579f9810aa7' +const cvxCRV = ADDRESSES.ethereum.cvxCRV const FXS = '0x3432b6a60d23ca0dfca7761b7ab56459d9c964d0' const veFXS = '0xc8418aF6358FFddA74e09Ca9CC3Fe03Ca6aDC5b0' const CRV = ADDRESSES.ethereum.CRV diff --git a/projects/sablier/index.js b/projects/sablier/index.js index 7080a22203c..c9bf052a0d1 100644 --- a/projects/sablier/index.js +++ b/projects/sablier/index.js @@ -1,13 +1,14 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens2, sumTokensExport } = require('../helper/unwrapLPs') const { covalentGetTokens } = require('../helper/http') const { isWhitelistedToken } = require('../helper/streamingHelper') const { getUniqueAddresses } = require('../helper/utils') const blacklistedTokens = [ - '0x57ab1e02fee23774580c119740129eac7081e9d3', // sUSD legacy - '0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359', - '0x9f8f72aa9304c8b593d555f12ef6589cc3a579a2', - '0x57ab1e02fee23774580c119740129eac7081e9d3', + ADDRESSES.ethereum.sUSD_OLD, + // TODO: We shouldn't need to lowercase here + ADDRESSES.ethereum.SAI.toLowerCase(), + ADDRESSES.ethereum.MKR, ] async function getTokens(api, owners, isVesting) { @@ -39,9 +40,9 @@ module.exports = { tvl: sumTokensExport({ owner: '0xDe9dCc27aa1552d591Fc9B9c21881feE43BD8118', tokens: [ - '0x0b7007c13325c48911f73a2dad5fa5dcbf808adc', - '0xc99a6a985ed2cac1ef41640596c5a5f9f4e19ef5', - '0x97a9107c1793bc407d6f527b77e7fff4d812bece', + ADDRESSES.ronin.USDC, + ADDRESSES.ronin.WETH, + ADDRESSES.ronin.AXS, ] }) } diff --git a/projects/set-protocol/v1.js b/projects/set-protocol/v1.js index 4f154b7d34f..8db98ead55d 100644 --- a/projects/set-protocol/v1.js +++ b/projects/set-protocol/v1.js @@ -10,12 +10,12 @@ Settings const cTokenDecimalScale = BigNumber("10").pow(18); const tokens = [ - ADDRESSES.ethereum.WETH, // WETH - ADDRESSES.ethereum.WBTC, // WBTC - ADDRESSES.ethereum.LINK, // LINK - '0x89d24A6b4CcB1B6fAA2625fE562bDD9a23260359', // SAI - ADDRESSES.ethereum.DAI, // DAI - ADDRESSES.ethereum.USDC, // USDC + ADDRESSES.ethereum.WETH, + ADDRESSES.ethereum.WBTC, + ADDRESSES.ethereum.LINK, + ADDRESSES.ethereum.SAI, + ADDRESSES.ethereum.DAI, + ADDRESSES.ethereum.USDC, '0x39AA39c021dfbaE8faC545936693aC917d5E7563', // cUSDC '0x5d3a536e4d6dbd6114cc1ead35777bab948e3643', // cDAI ] diff --git a/projects/set-protocol/v2.js b/projects/set-protocol/v2.js index dd7b39231a8..148e05fa7d8 100644 --- a/projects/set-protocol/v2.js +++ b/projects/set-protocol/v2.js @@ -4,7 +4,6 @@ const BigNumber = require('bignumber.js'); const SUPPLY_SCALE = BigNumber("10").pow(18) const START_BLOCK = 10830496; -const EXTERNAL_POSITION = '1'; const getSets = "address[]:getSets" const getPositions = 'function getPositions() view returns (tuple(address component, address module, int256 unit, uint8 positionState, bytes data)[])'; @@ -48,7 +47,6 @@ module.exports = async function tvl(timestamp, block) { }), })).output; - let uniswapPositions = {}; positionsForSets.forEach(function(positionForSet, i) { const setSupply = BigNumber(supplies[i].output); if(positionForSet.output === null){ @@ -58,7 +56,6 @@ module.exports = async function tvl(timestamp, block) { const componentAddress = position[0]; const positionUnits = BigNumber(position[2]); - const isExternalPosition = position[3] == EXTERNAL_POSITION; balances[componentAddress] = BigNumber(balances[componentAddress] || 0).plus((positionUnits).times(setSupply).div(SUPPLY_SCALE)).toFixed(0); }); }); diff --git a/projects/thales/index.js b/projects/thales/index.js index fd6f5a4a857..01b3cb6a2e3 100644 --- a/projects/thales/index.js +++ b/projects/thales/index.js @@ -5,7 +5,6 @@ const { dodoPool2 } = require('../helper/pool2') const ADDRESSES = require('../helper/coreAssets.json') const ethMarketsManager = "0x5ed98Ebb66A929758C7Fe5Ac60c979aDF0F4040a" -const ETH_SUSD = "0x57ab1ec28d129707052df4df418d58a2d46d5f51" const opMarketsManager = "0xBE086E0A2c588Ad64C8530048cE4356190D6a6F3" const OP_SUSD = ADDRESSES.optimism.sUSD @@ -58,7 +57,7 @@ module.exports = { methodology: "sUSD/USDC locked on markets", ethereum: { tvl: async (_, _1, _2, { api }) => { - return sumTokens2({ api, owners: await getMarkets(api, ethMarketsManager), tokens: [ETH_SUSD] }) + return sumTokens2({ api, owners: await getMarkets(api, ethMarketsManager), tokens: [ADDRESSES.ethereum.sUSD] }) }, pool2: dodoPool2("0x136829c258e31b3ab1975fe7d03d3870c3311651", "0x031816fd297228e4fd537c1789d51509247d0b43"), }, diff --git a/projects/treasury/aave.js b/projects/treasury/aave.js index 44a4a50ef77..1bb6fe0ab22 100644 --- a/projects/treasury/aave.js +++ b/projects/treasury/aave.js @@ -38,54 +38,54 @@ module.exports = treasuryExports({ ethereum: { tokens: [ nullAddress, - ADDRESSES.ethereum.USDC, // USDC + ADDRESSES.ethereum.USDC, '0xBcca60bB61934080951369a648Fb03DF4F96263C', // aUSDC '0xd24946147829DEaA935bE2aD85A3291dbf109c80', // ammUSDC '0x98C23E9d8f34FEFb1B7BD6a91B7FF122F4e16F5c', // aEthUSDC - ADDRESSES.ethereum.DAI, // DAI + ADDRESSES.ethereum.DAI, '0x028171bca77440897b824ca71d1c56cac55b68a3', // aDAI '0x79bE75FFC64DD58e66787E4Eae470c8a1FD08ba4', // ammDAI '0x018008bfb33d285247A21d44E50697654f754e63', // aEthDAI - ADDRESSES.ethereum.USDT, // USDT + ADDRESSES.ethereum.USDT, '0x3ed3b47dd13ec9a98b44e6204a523e766b225811', // aUSDT '0x17a79792Fe6fE5C95dFE95Fe3fCEE3CAf4fE4Cb7', // ammUSDT '0xFFC97d72E13E01096502Cb8Eb52dEe56f74DAD7B', // aAAVE '0xA700b4eB416Be35b2911fd5Dee80678ff64fF6C9', // aEthAAVE - ADDRESSES.ethereum.WBTC, // WBTC + ADDRESSES.ethereum.WBTC, '0x9ff58f4fFB29fA2266Ab25e75e2A8b3503311656', // aWBTC '0x13B2f6928D7204328b0E8E4BCd0379aA06EA21FA', // ammWBTC '0x5Ee5bf7ae06D1Be5997A1A72006FE6C607eC6DE8', // aEthWBTC - ADDRESSES.ethereum.WSTETH, // wstETH + ADDRESSES.ethereum.WSTETH, '0x0B925eD163218f6662a35e0f0371Ac234f9E9371', // aEthwstETH '0xba100000625a3754423978a60c9317c58a424e3D', // BAL - ADDRESSES.ethereum.WETH, // WETH + ADDRESSES.ethereum.WETH, '0x030bA81f1c18d280636F32af80b9AAd02Cf0854e', // aWETH '0xf9Fb4AD91812b704Ba883B11d2B576E890a6730A', // ammWETH '0x4d5F47FA6A74757f35C14fD3a6Ef8E3C9BC514E8', // aEthWETH - ADDRESSES.ethereum.CRV, // CRV + ADDRESSES.ethereum.CRV, '0x8dAE6Cb04688C62d939ed9B68d32Bc62e49970b1', // aCRV - ADDRESSES.ethereum.SNX, // SNX + ADDRESSES.ethereum.SNX, '0x35f6B052C598d933D69A4EEC4D04c73A191fE6c2', // aSNX - ADDRESSES.ethereum.LINK, // LINK + ADDRESSES.ethereum.LINK, '0xa06bC25B5805d5F8d82847D191Cb4Af5A3e873E0', // aLINK '0x5E8C8A7243651DB1384C0dDfDbE39761E8e7E51a', // aEthLINK '0xba100000625a3754423978a60c9317c58a424e3d', // BAL '0x272F97b7a56a387aE942350bBC7Df5700f8a4576', // aBAL - ADDRESSES.ethereum.UNI, // UNI + ADDRESSES.ethereum.UNI, '0xB9D7CB55f463405CDfBe4E90a6D2Df01C2B92BF1', // aUNI - ADDRESSES.ethereum.MKR, // MKR + ADDRESSES.ethereum.MKR, '0xc713e5E149D5D0715DcD1c156a020976e7E56B88', // aMKR - ADDRESSES.ethereum.BUSD, // BUSD + ADDRESSES.ethereum.BUSD, '0xA361718326c15715591c299427c62086F69923D9', // aBUSD '0x853d955acef822db058eb8505911ed77f175b99e', // FRAX '0xd4937682df3C8aEF4FE912A96A74121C0829E664', // aFRAX - '0x57ab1ec28d129707052df4df418d58a2d46d5f51', // sUSD + ADDRESSES.ethereum.sUSD, '0x6C5024Cd4F8A59110119C56f8933403A539555EB', // aSUSD '0x5f98805a4e8be255a32880fdec7f6728c6568ba0', // LUSD '0xce1871f791548600cb59efbefFC9c38719142079', // aLUSD '0x056fd409e1d7a124bd7017459dfea2f387b6d5cd', // GUSD '0xD37EE7e4f452C6638c96536e68090De8cBcdb583', // aGUSD - ADDRESSES.ethereum.TUSD, // TUSD + ADDRESSES.ethereum.TUSD, '0x101cc05f4A51C0319f570d5E146a8C625198e636', // aTUSD '0x8e870d67f660d95d5be530380d0ec0bd388289e1', // USDP '0x2e8F4bdbE3d47d7d7DE490437AeA9915D930F1A3', // aUSDP @@ -95,7 +95,7 @@ module.exports = treasuryExports({ '0x6F634c6135D2EBD550000ac92F494F9CB8183dAe', // aDPI '0xc18360217d8f7ab5e7c516566761ea12ce7f9d72', // ENS '0x9a14e23A58edf4EFDcB360f68cd1b95ce2081a2F', // aENS - ADDRESSES.ethereum.STETH, // stETH + ADDRESSES.ethereum.STETH, '0x1982b2F5814301d4e9a8b0201555376e62F82428', // aSTETH '0xd46ba6d942050d489dbd938a2c909a5d5039a161', // AMPL '0x1E6bb68Acec8fefBD87D192bE09bb274170a0548', // aAMPL @@ -103,9 +103,9 @@ module.exports = treasuryExports({ '0x683923dB55Fead99A79Fa01A27EeC3cB19679cC3', // aFEI '0xa693b19d2931d498c5b318df961919bb4aee87a5', // UST '0xc2e2152647F4C26028482Efaf64b2Aa28779EFC4', // aUST - ADDRESSES.ethereum.BAT, // BAT + ADDRESSES.ethereum.BAT, '0x05Ec93c0365baAeAbF7AefFb0972ea7ECdD39CF1', // aBAT - '0x4e3fbd56cd56c3e72c1403e103b45db9da5b9d2b', // CVX + ADDRESSES.ethereum.CVX, '0x952749E07d7157bb9644A894dFAF3Bad5eF6D918', // aCVX '0xf629cbd94d3791c9250152bd8dfbdf380e2a3b9c', // ENJ '0xaC6Df26a590F08dcC95D5a4705ae8abbc88509Ef', // aENJ @@ -121,7 +121,7 @@ module.exports = treasuryExports({ '0x514cd6756CCBe28772d4Cb81bC3156BA9d1744aa', // aRENFIL '0xe41d2489571d322189246dafa5ebde1f4699f498', // ZRX '0xDf7FF54aAcAcbFf42dfe29DD6144A69b629f8C9e', // aZRX - ADDRESSES.ethereum.YFI, // YFI + ADDRESSES.ethereum.YFI, '0x5165d24277cD063F5ac44Efd447B27025e888f37', // aYFI '0x8798249c2E607446EfB7Ad49eC89dD1865Ff4272', // xSUSHI '0xF256CC7847E919FAc9B808cC216cAc87CCF2f47a', // aXSUSHI @@ -132,21 +132,21 @@ module.exports = treasuryExports({ polygon: { tokens: [ nullAddress, - ADDRESSES.polygon.DAI, // DAI + ADDRESSES.polygon.DAI, '0x27F8D03b3a2196956ED754baDc28D73be8830A6e', // amDAI '0x82E64f49Ed5EC1bC6e43DAD4FC8Af9bb3A2312EE', // aPOLDAI - ADDRESSES.polygon.USDC, // USDC + ADDRESSES.polygon.USDC, '0x1a13F4Ca1d028320A707D99520AbFefca3998b7F', // amUSDC '0x625E7708f30cA75bfd92586e17077590C60eb4cD', // aPolUSDC - ADDRESSES.polygon.USDT, // USDT + ADDRESSES.polygon.USDT, '0x60D55F02A771d515e077c9C2403a1ef324885CeC', // amUSDT '0x6ab707Aca953eDAeFBc4fD23bA73294241490620', // aPolUSDT '0x1d2a0E5EC8E5bBDCA5CB219e649B565d8e5c3360', // amAAVE '0xf329e36C7bF6E5E86ce2150875a84Ce77f477375', // aPolAAVE - ADDRESSES.polygon.WBTC, // WBTC + ADDRESSES.polygon.WBTC, '0x5c2ed810328349100A66B82b78a1791B101C9D61', // amWBTC '0x078f358208685046a11C85e8ad32895DED33A249', // aPolWBTC - ADDRESSES.polygon.WETH_1, // WETH + ADDRESSES.polygon.WETH_1, '0x28424507fefb6f7f8E9D3860F56504E4e5f5f390', // amWETH '0xe50fA9b3c56FfB159cB0FCA61F5c9D750e8128c8', // aPolWETH '0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270', // WMATIC @@ -188,24 +188,24 @@ module.exports = treasuryExports({ }, avax: { tokens: [ - ADDRESSES.avax.DAI, // DAI + ADDRESSES.avax.DAI, '0x47AFa96Cdc9fAb46904A55a6ad4bf6660B53c38a', // avDAI '0x82E64f49Ed5EC1bC6e43DAD4FC8Af9bb3A2312EE', // aAvaDAI - ADDRESSES.avax.USDC_e, // USDC + ADDRESSES.avax.USDC_e, '0x46A51127C3ce23fb7AB1DE06226147F446e4a857', // avUSDC '0x625E7708f30cA75bfd92586e17077590C60eb4cD', // aAvaUSDC - ADDRESSES.avax.USDT_e, // USDT + ADDRESSES.avax.USDT_e, '0x532E6537FEA298397212F09A61e03311686f548e', // avUSDT '0x6ab707Aca953eDAeFBc4fD23bA73294241490620', // aAvaUSDT '0xD45B7c061016102f9FA220502908f2c0f1add1D7', // avAAVE '0xf329e36C7bF6E5E86ce2150875a84Ce77f477375', // aAvaAAVE - ADDRESSES.avax.WAVAX, // WAVAX + ADDRESSES.avax.WAVAX, '0xDFE521292EcE2A4f44242efBcD66Bc594CA9714B', // avWAVAX '0x6d80113e533a2C0fe82EaBD35f1875DcEA89Ea97', // aAvaWAVAX '0x50b7545627a5162f82a992c33b87adc75187b218', // WBTC '0x686bEF2417b6Dc32C50a3cBfbCC3bb60E1e9a15D', // aWBTC '0x078f358208685046a11C85e8ad32895DED33A249', // aAvaWBTC - ADDRESSES.avax.WETH_e, // WETH + ADDRESSES.avax.WETH_e, '0x53f7c5869a859F0AeC3D334ee8B4Cf01E3492f21', // aWETH '0xe50fA9b3c56FfB159cB0FCA61F5c9D750e8128c8', // aAvaWETH '0x5947bb275c521040051d82396192181b413227a3', // LINK @@ -216,7 +216,7 @@ module.exports = treasuryExports({ '0x8Eb270e296023E9D92081fdF967dDd7878724424', // aAvaMAI '0x2b2c81e08f1af8835a78bb2a90ae924ace0ea4be', // sAVAX '0x513c7E3a9c69cA3e22550eF58AC1C0088e918FFf', // aAvaSAVAX - ADDRESSES.avax.BTC_b, // BTC.b + ADDRESSES.avax.BTC_b, '0x8ffDf2DE812095b1D19CB146E4c004587C0A0692', // aAvaBTC.b ], owners: treasuryContractsAvax, diff --git a/projects/treasury/bancor.js b/projects/treasury/bancor.js index 599e0fb0c9b..053db29b9ab 100644 --- a/projects/treasury/bancor.js +++ b/projects/treasury/bancor.js @@ -41,9 +41,9 @@ module.exports = treasuryExports({ '0xb9EF770B6A5e12E45983C5D80545258aA38F3B78', //zcn '0xd26114cd6EE289AccF82350c8d8487fedB8A0C07', //omg '0xaA7a9CA87d3694B5755f213B5D04094b8d0F0A6F', //trac - '0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0', //wsteth + ADDRESSES.ethereum.WSTETH, '0x4C2e59D098DF7b6cBaE0848d66DE2f8A4889b9C3', //fodl - '0x9f8F72aA9304c8B593d555F12eF6589cC3A579A2', //mkr + ADDRESSES.ethereum.MKR, ], owners: [treasury], ownTokens: [BNT, vBNT], diff --git a/projects/treasury/convex.js b/projects/treasury/convex.js index 4ac63b2127f..f7aafb92a09 100644 --- a/projects/treasury/convex.js +++ b/projects/treasury/convex.js @@ -1,28 +1,27 @@ const ADDRESSES = require('../helper/coreAssets.json') const { nullAddress, treasuryExports } = require("../helper/treasury"); + const convexTreasuryVault = "0x1389388d01708118b497f59521f6943Be2541bb7"; -const cvx = "0x4e3FBD56CD56c3e72c1403e103b45Db9da5B9D2B"; -const cvxCrv = "0x62B9c7356A2Dc64a1969e19C23e4f579F9810Aa7"; const treasuryARB = "0x6111abf720051309012fcdbc2910054e41dcff8c" module.exports = treasuryExports({ ethereum: { tokens: [ nullAddress, - ADDRESSES.ethereum.CRV, // CRV - ADDRESSES.ethereum.SNX, // SNX + ADDRESSES.ethereum.CRV, + ADDRESSES.ethereum.SNX, "0x31429d1856aD1377A8A0079410B297e1a9e214c2", // ANGLE - ADDRESSES.ethereum.LIDO, // LDO + ADDRESSES.ethereum.LIDO, "0xdBdb4d16EdA451D0503b854CF79D55697F90c8DF", // ALCX "0x92E187a03B6CD19CB6AF293ba17F2745Fd2357D5", // DUCK - ADDRESSES.ethereum.FTM, // FTM + ADDRESSES.ethereum.FTM, "0x3472A5A71965499acd81997a54BBA8D852C6E53d", // BADGER "0xa3BeD4E1c75D00fa6f4E5E6922DB7261B5E9AcD2", // MTA "0x8207c1FfC5B6804F6024322CcF34F29c3541Ae26", // OGN "0xCdF7028ceAB81fA0C6971208e83fa7872994beE5", // T ], owners: [convexTreasuryVault], - ownTokens: [cvx, cvxCrv], + ownTokens: [ADDRESSES.ethereum.CVX, ADDRESSES.ethereum.cvxCRV], }, arbitrum: { tokens: [ diff --git a/projects/treasury/gnosis-dao.js b/projects/treasury/gnosis-dao.js index e5d95c26a32..6c711c2384a 100644 --- a/projects/treasury/gnosis-dao.js +++ b/projects/treasury/gnosis-dao.js @@ -40,26 +40,26 @@ module.exports = treasuryExports({ ethereum: { tokens: [ nullAddress, - ADDRESSES.ethereum.USDC, //USDC + ADDRESSES.ethereum.USDC, '0x6b175474e89094c44da98b954eedeac495271d0f',//DAI '0x5d3a536E4D6DbD6114cc1Ead35777bAB948E3643',//cDAI '0x39AA39c021dfbaE8faC545936693aC917d5E7563',//cUSDC '0xc944E90C64B2c07662A292be6244BDf05Cda44a7',//GRT - ADDRESSES.ethereum.CRV,//CRV + ADDRESSES.ethereum.CRV, '0xba100000625a3754423978a60c9317c58a424e3D',//BAL - '0x4e3FBD56CD56c3e72c1403e103b45Db9da5B9D2B',//CVX + ADDRESSES.ethereum.CVX, '0xDEf1CA1fb7FBcDC777520aa7f396b4E015F497aB',//COW - ADDRESSES.ethereum.STETH,//stETH + ADDRESSES.ethereum.STETH, '0xE95A203B1a91a908F9B9CE46459d101078c2c3cb',//ankETH '0xC18360217D8F7Ab5e7c516566761Ea12Ce7F9D72',//ENS '0x93ED3FBe21207Ec2E8f2d3c3de6e058Cb73Bc04d',//PNK - ADDRESSES.ethereum.WSTETH,//wstETH + ADDRESSES.ethereum.WSTETH, '0xC0c293ce456fF0ED870ADd98a0828Dd4d2903DBF',//AURA '0x543Ff227F64Aa17eA132Bf9886cAb5DB55DCAddf',//GEN '0x255Aa6DF07540Cb5d3d297f0D0D4D84cb52bc8e6',//RDN '0x6f40d4A6237C257fff2dB00FA0510DeEECd303eb',//INST '0x6243d8CEA23066d098a15582d81a598b4e8391F4',//FLX - ADDRESSES.ethereum.LIDO,//LDO + ADDRESSES.ethereum.LIDO, '0x1982b2F5814301d4e9a8b0201555376e62F82428', "0xd33526068d116ce69f19a9ee46f0bd304f21a51f", "0x543ff227f64aa17ea132bf9886cab5db55dcaddf", diff --git a/projects/treasury/idle-dao.js b/projects/treasury/idle-dao.js index 30734a70cec..def0abe2d99 100644 --- a/projects/treasury/idle-dao.js +++ b/projects/treasury/idle-dao.js @@ -22,19 +22,19 @@ module.exports = treasuryExports({ ethereum: { tokens: [ nullAddress, - ADDRESSES.ethereum.USDC, //USDC + ADDRESSES.ethereum.USDC, "0x4da27a545c0c5B758a6BA100e3a049001de870f5", //stkAAVE - ADDRESSES.ethereum.BNB, //BNB + ADDRESSES.ethereum.BNB, "0xc00e94Cb662C3520282E6f5717214004A7f26888",//comp - "0x57Ab1ec28D129707052df4dF418D58a2D46d5f51",//sUSD + ADDRESSES.ethereum.sUSD, "0x03ab458634910AaD20eF5f1C8ee96F1D6ac54919",//RAI - ADDRESSES.ethereum.SUSHI,//sushi - ADDRESSES.ethereum.MATIC,//matic - ADDRESSES.ethereum.LIDO,//ldo + ADDRESSES.ethereum.SUSHI, + ADDRESSES.ethereum.MATIC, + ADDRESSES.ethereum.LIDO, "0xdBdb4d16EdA451D0503b854CF79D55697F90c8DF",//alcx - ADDRESSES.ethereum.DAI,//dai - ADDRESSES.ethereum.STETH,//steth - ADDRESSES.ethereum.LINK,//link + ADDRESSES.ethereum.DAI, + ADDRESSES.ethereum.STETH, + ADDRESSES.ethereum.LINK, ], owners: [treasury, treasury1, treasury2, treasury3, treasury4, treasury5], ownTokens: [IDLE], @@ -43,10 +43,10 @@ module.exports = treasuryExports({ tokens: [ nullAddress, "0xf28164A485B0B2C90639E47b0f377b4a438a16B1",//dquick - ADDRESSES.polygon.DAI,//dai + ADDRESSES.polygon.DAI, "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270",//wmatic - ADDRESSES.polygon.WETH_1,//weth - ADDRESSES.polygon.USDC,//usdc + ADDRESSES.polygon.WETH_1, + ADDRESSES.polygon.USDC, "0x580A84C73811E1839F75d86d75d88cCa0c241fF4",//QI ], owners: [treasuryPolygon, treasuryPolygon1], diff --git a/projects/treasury/inverse.js b/projects/treasury/inverse.js index 832b3db34df..5f378f36c53 100644 --- a/projects/treasury/inverse.js +++ b/projects/treasury/inverse.js @@ -13,18 +13,18 @@ module.exports = treasuryExports({ ethereum: { tokens: [ nullAddress, - ADDRESSES.ethereum.DAI, // DAI - ADDRESSES.ethereum.USDC, // USDC + ADDRESSES.ethereum.DAI, + ADDRESSES.ethereum.USDC, "0x865377367054516e17014CcdED1e7d814EDC9ce4", // DOLA - ADDRESSES.ethereum.WBTC, // WBTC - ADDRESSES.ethereum.WETH, // WETH - ADDRESSES.ethereum.YFI, // YFI + ADDRESSES.ethereum.WBTC, + ADDRESSES.ethereum.WETH, + ADDRESSES.ethereum.YFI, "0xC0c293ce456fF0ED870ADd98a0828Dd4d2903DBF", // AURA "0xba100000625a3754423978a60c9317c58a424e3D", // BAL "0x73968b9a57c6E53d41345FD57a6E6ae27d6CDB2F", // SDT - ADDRESSES.ethereum.cvxFXS, // cvxFXS - ADDRESSES.ethereum.CRV, // CRV - "0x4e3FBD56CD56c3e72c1403e103b45Db9da5B9D2B", // CVX + ADDRESSES.ethereum.cvxFXS, + ADDRESSES.ethereum.CRV, + ADDRESSES.ethereum.CVX, "0x4C2e59D098DF7b6cBaE0848d66DE2f8A4889b9C3", // FODL "0x5aFE3855358E112B5647B952709E6165e1c1eEEe", // SAFE "0x22915f309EC0182c85cD8331C23bD187fd761360", // DOLA USDC Stable Pool Aura Deposit Vault @@ -50,7 +50,7 @@ module.exports = treasuryExports({ optimism: { tokens: [ nullAddress, - ADDRESSES.optimism.USDC, // USDC + ADDRESSES.optimism.USDC, "0x8aE125E8653821E851F12A49F7765db9a9ce7384", // DOLA ], owners: [opmultisig], @@ -59,7 +59,7 @@ module.exports = treasuryExports({ bsc: { tokens: [ nullAddress, - ADDRESSES.bsc.WBNB, // WBNB + ADDRESSES.bsc.WBNB, "0x2F29Bc0FFAF9bff337b31CBe6CB5Fb3bf12e5840", // DOLA // "0xfBBF371C9B0B994EebFcC977CEf603F7f31c070D", // veTHE ], diff --git a/projects/treasury/jpegd.js b/projects/treasury/jpegd.js index e8b4b458d71..a705859070c 100644 --- a/projects/treasury/jpegd.js +++ b/projects/treasury/jpegd.js @@ -23,7 +23,7 @@ const treasuryTvl = treasuryExports({ ADDRESSES.ethereum.CVX, "0x853d955aCEf822Db058eb8505911ED77F175b99e", // FRAX ADDRESSES.ethereum.LINK, - "0x62B9c7356A2Dc64a1969e19C23e4f579F9810Aa7", // cvxCRV + ADDRESSES.ethereum.cvxCRV, "0x5aFE3855358E112B5647B952709E6165e1c1eEEe", // SAFE "0xC47EBd6c0f68fD5963005D28D0ba533750E5C11B", "0x34eD182D0812D119c92907852D2B429f095A9b07", diff --git a/projects/treasury/mimo-protocol.js b/projects/treasury/mimo-protocol.js index ffa933b1eb6..4d4d4fcdf12 100644 --- a/projects/treasury/mimo-protocol.js +++ b/projects/treasury/mimo-protocol.js @@ -19,11 +19,11 @@ module.exports = treasuryExports({ ethereum: { tokens: [ nullAddress, - ADDRESSES.ethereum.USDT,//USDT - ADDRESSES.ethereum.CRV,//CRV - ADDRESSES.ethereum.USDC,//USDC + ADDRESSES.ethereum.USDT, + ADDRESSES.ethereum.CRV, + ADDRESSES.ethereum.USDC, '0xba100000625a3754423978a60c9317c58a424e3D',//BAL - '0x62B9c7356A2Dc64a1969e19C23e4f579F9810Aa7',//cvxCRV + ADDRESSES.ethereum.cvxCRV, '0x6DEA81C8171D0bA574754EF6F8b412F2Ed88c54D',//LQTY '0x41D5D79431A913C4aE7d69a668ecdfE5fF9DFB68',//INV '0xcAfE001067cDEF266AfB7Eb5A286dCFD277f3dE5',//PSP @@ -39,7 +39,7 @@ module.exports = treasuryExports({ polygon: { tokens: [ nullAddress, - ADDRESSES.polygon.USDC//USDC + ADDRESSES.polygon.USDC ], owners: [treasury, treasury1, treasurypolygon, treasurypolygon1, treasuryfantom, treasuryfantom1], ownTokens: [MIMOpolygon,], @@ -47,7 +47,7 @@ module.exports = treasuryExports({ fantom: { tokens: [ nullAddress, - ADDRESSES.fantom.USDC//USDC + ADDRESSES.fantom.USDC ], owners: [treasury, treasury1, treasurypolygon, treasurypolygon1, treasuryfantom, treasuryfantom1], ownTokens: [MIMOfantom,], diff --git a/projects/treasury/paladin-finance.js b/projects/treasury/paladin-finance.js index 1f22c3cbc2b..7663eb1611a 100644 --- a/projects/treasury/paladin-finance.js +++ b/projects/treasury/paladin-finance.js @@ -12,18 +12,18 @@ module.exports = treasuryExports({ ethereum: { tokens: [ nullAddress, - ADDRESSES.ethereum.USDT,//USDT - ADDRESSES.ethereum.CRV,//CRV - ADDRESSES.ethereum.USDC,//USDC + ADDRESSES.ethereum.USDT, + ADDRESSES.ethereum.CRV, + ADDRESSES.ethereum.USDC, '0xba100000625a3754423978a60c9317c58a424e3D',//BAL - '0x62B9c7356A2Dc64a1969e19C23e4f579F9810Aa7',//cvxCRV + ADDRESSES.ethereum.cvxCRV, '0x6DEA81C8171D0bA574754EF6F8b412F2Ed88c54D',//LQTY '0x41D5D79431A913C4aE7d69a668ecdfE5fF9DFB68',//INV '0xdBdb4d16EdA451D0503b854CF79D55697F90c8DF',//ALCX '0x73968b9a57c6E53d41345FD57a6E6ae27d6CDB2F',//SDT '0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490',//3CRV '0x4104b135DBC9609Fc1A9490E61369036497660c8',//APY - ADDRESSES.ethereum.LIDO,//LDO + ADDRESSES.ethereum.LIDO, ], owners: [treasury, treasury1, ], diff --git a/projects/treasury/railgun.js b/projects/treasury/railgun.js index 179d7a782fe..e4273e2089c 100644 --- a/projects/treasury/railgun.js +++ b/projects/treasury/railgun.js @@ -17,30 +17,30 @@ module.exports = treasuryExports({ tokens: [ // Ethereum Assets nullAddress, - ADDRESSES.ethereum.WETH,//weth + ADDRESSES.ethereum.WETH, "0x295B42684F90c77DA7ea46336001010F2791Ec8c",//xi - ADDRESSES.ethereum.USDC,//usdc - ADDRESSES.ethereum.USDT,//usdt - ADDRESSES.ethereum.DAI,//dai + ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.USDT, + ADDRESSES.ethereum.DAI, "0x3432B6A60D23Ca0dFCa7761B7ab56459D9C964D0",//fxs - ADDRESSES.ethereum.WSTETH,//wsteth - "0x4e3FBD56CD56c3e72c1403e103b45Db9da5B9D2B",//cvx + ADDRESSES.ethereum.WSTETH, + ADDRESSES.ethereum.CVX, "0xEB4C2781e4ebA804CE9a9803C67d0893436bB27D",//renbtc - "0x62B9c7356A2Dc64a1969e19C23e4f579F9810Aa7",//cvxcrv + ADDRESSES.ethereum.cvxCRV, "0x3432B6A60D23Ca0dFCa7761B7ab56459D9C964D0",//wbtc "0x99D8a9C45b2ecA8864373A26D1459e3Dff1e17F3",//mim "0x5f98805A4E8be255a32880FDeC7F6728C6568bA0",//lusd "0x090185f2135308BaD17527004364eBcC2D37e5F6",//spell - ADDRESSES.ethereum.BUSD,//busd + ADDRESSES.ethereum.BUSD, "0x00a8b738E453fFd858a7edf03bcCfe20412f0Eb0",//albt - ADDRESSES.ethereum.SNX,//snx + ADDRESSES.ethereum.SNX, "0x509A38b7a1cC0dcd83Aa9d06214663D9eC7c7F4a",//bst - ADDRESSES.ethereum.INU,//shib - ADDRESSES.ethereum.LINK,//link + ADDRESSES.ethereum.INU, + ADDRESSES.ethereum.LINK, "0x21381e026Ad6d8266244f2A583b35F9E4413FA2a",//form - ADDRESSES.ethereum.TOKE,//toke + ADDRESSES.ethereum.TOKE, "0x767FE9EDC9E0dF98E07454847909b5E959D7ca0E",//ilv - ADDRESSES.ethereum.MKR,//mkr + ADDRESSES.ethereum.MKR, "0xc5fb36dd2fb59d3b98deff88425a3f425ee469ed",//tsuka "0x853d955acef822db058eb8505911ed77f175b99e",//frax "0x2223bF1D7c19EF7C06DAB88938EC7B85952cCd89",//kxa @@ -49,8 +49,8 @@ module.exports = treasuryExports({ "0xf65B5C5104c4faFD4b709d9D60a185eAE063276c",//tru "0x3597bfd533a99c9aa083587b074434e61eb0a258",//dent "0xcc8fa225d80b9c7d42f96e9570156c65d6caaa25",//slp - ADDRESSES.ethereum.UNI,//uni - ADDRESSES.ethereum.MATIC,//matic + ADDRESSES.ethereum.UNI, + ADDRESSES.ethereum.MATIC, "0x9aE380F0272E2162340a5bB646c354271c0F5cFC",//cnc "0x07bac35846e5ed502aa91adf6a9e7aa210f2dcbe",//erowan "0xfb7b4564402e5500db5bb6d63ae671302777c75a",//dext @@ -66,13 +66,13 @@ module.exports = treasuryExports({ tokens: [ // bsc Assets nullAddress, - ADDRESSES.bsc.WBNB,//wbnb - ADDRESSES.bsc.BUSD,//busd + ADDRESSES.bsc.WBNB, + ADDRESSES.bsc.BUSD, "0x1AF3F329e8BE154074D8769D1FFa4eE058B1DBc3",//dai - ADDRESSES.bsc.USDT,//bsc-usd + ADDRESSES.bsc.USDT, "0x39cC67690D0F2d4aCD68d3d9B612a80D780b84c0",//agro "0xbF7c81FFF98BbE61B40Ed186e4AfD6DDd01337fe",//egld - ADDRESSES.bsc.USDC,//usdc + ADDRESSES.bsc.USDC, "0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82",//cake "0xAdBAF88B39D37Dc68775eD1541F1bf83A5A45feB",//coti "0xBfACD29427fF376FF3BC22dfFB29866277cA5Fb4",//pstn @@ -86,12 +86,12 @@ module.exports = treasuryExports({ tokens: [ // polygon Assets nullAddress, - ADDRESSES.polygon.WETH_1,//weth - ADDRESSES.polygon.USDC,//usdc - ADDRESSES.polygon.USDT,//usdt - ADDRESSES.polygon.DAI,//dai + ADDRESSES.polygon.WETH_1, + ADDRESSES.polygon.USDC, + ADDRESSES.polygon.USDT, + ADDRESSES.polygon.DAI, "0x1a3acf6D19267E2d3e7f898f42803e90C9219062",//fxs - ADDRESSES.polygon.WBTC,//wbtc + ADDRESSES.polygon.WBTC, "0xE5417Af564e4bFDA1c483642db72007871397896",//gns "0x2C89bbc92BD86F8075d1DEcc58C7F4E0107f286b",//avax "0x53E0bca35eC356BD5ddDFebbD1Fc0fD03FaBad39",//link @@ -99,13 +99,13 @@ module.exports = treasuryExports({ "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270",//wmatic "0x752d59604d72b6DC44196f4A39A3f07779417407",//methmoon "0x8f006D1e1D9dC6C98996F50a4c810F17a47fBF19",//nsfw - ADDRESSES.fantom.renBTC,//renbtc + ADDRESSES.fantom.renBTC, "0x9c891326Fd8b1a713974f73bb604677E1E63396D",//islami "0x45c32fA6DF82ead1e2EF74d17b76547EDdFaFF89",//frax "0xB0B195aEFA3650A6908f15CdaC7D92F8a5791B0B",//bob "0x580A84C73811E1839F75d86d75d88cCa0c241fF4",//qi "0x980111ae1B84E50222C8843e3A7a038F36Fecd2b",//stack - ADDRESSES.polygon.QUICK,//quick + ADDRESSES.polygon.QUICK, "0x6C0AB120dBd11BA701AFF6748568311668F63FE0",//apw "0xE0339c80fFDE91F3e20494Df88d4206D86024cdF",//elon ], @@ -116,7 +116,7 @@ module.exports = treasuryExports({ tokens: [ // arbitrum assets nullAddress, - ADDRESSES.arbitrum.WETH,//weth + ADDRESSES.arbitrum.WETH, ADDRESSES.arbitrum.WBTC, ADDRESSES.arbitrum.USDT, ADDRESSES.arbitrum.USDC diff --git a/projects/treasury/stargate.js b/projects/treasury/stargate.js index db6cc7ba318..e73deed1268 100644 --- a/projects/treasury/stargate.js +++ b/projects/treasury/stargate.js @@ -14,15 +14,15 @@ module.exports = treasuryExports({ ethereum: { tokens: [ nullAddress, - ADDRESSES.ethereum.USDC, // USDC + ADDRESSES.ethereum.USDC, "0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490", // 3CRV DAI/USDC/USDT "0x73968b9a57c6E53d41345FD57a6E6ae27d6CDB2F", // SDT - "0x62B9c7356A2Dc64a1969e19C23e4f579F9810Aa7", // cvxCRV + ADDRESSES.ethereum.cvxCRV, "0x5aFE3855358E112B5647B952709E6165e1c1eEEe", // SAFE "0xFCc5c47bE19d06BF83eB04298b026F81069ff65b", // yCRV "0x616e8BfA43F920657B3497DBf40D6b1A02D4608d", // auraBAl "0xA13a9247ea42D743238089903570127DdA72fE44", // bb-a-USD - ADDRESSES.ethereum.cvxFXS, // cvxFXS + ADDRESSES.ethereum.cvxFXS, "0x3175Df0976dFA876431C2E9eE6Bc45b65d3473CC", // crvFRAX "0xfA0F307783AC21C39E939ACFF795e27b650F6e68", // S*FRAX "0x0Faf1d2d3CED330824de3B8200fc8dc6E397850d", // S*DAI @@ -50,7 +50,7 @@ module.exports = treasuryExports({ bsc: { tokens: [ nullAddress, - ADDRESSES.bsc.USDT, // BSC_USD + ADDRESSES.bsc.USDT, "0x98a5737749490856b401DB5Dc27F522fC314A4e1", // S*BUSD "0x4e145a589e4c03cBe3d28520e4BF3089834289Df", // S*USDD "0x7BfD7f2498C4796f10b6C611D9db393D3052510C", // S*MAI @@ -66,7 +66,7 @@ module.exports = treasuryExports({ tokens: [ nullAddress, "0x1c272232Df0bb6225dA87f4dEcD9d37c32f63Eea", // S*FRAX - ADDRESSES.avax.USDC, // USDC + ADDRESSES.avax.USDC, "0x8736f92646B2542B3e5F3c63590cA7Fe313e283B", // S*MAI "0x29e38769f23701A2e4A8Ef0492e19dA4604Be62c", // S*USDt "0xEAe5c2F6B25933deB62f754f239111413A0A25ef", // S*USDt @@ -81,7 +81,7 @@ module.exports = treasuryExports({ polygon: { tokens: [ nullAddress, - ADDRESSES.polygon.USDC, // USDC + ADDRESSES.polygon.USDC, "0x1c272232Df0bb6225dA87f4dEcD9d37c32f63Eea", // S*DAI "0x29e38769f23701A2e4A8Ef0492e19dA4604Be62c", // S*USDT "0x8736f92646B2542B3e5F3c63590cA7Fe313e283B", // S*miMATIC @@ -98,7 +98,7 @@ module.exports = treasuryExports({ owners: [arbitrum], tokens: [ nullAddress, - ADDRESSES.arbitrum.USDC, // USDC + ADDRESSES.arbitrum.USDC, "0xaa4BF442F024820B2C28Cd0FD72b82c63e66F56C", // S*FRAX "0xF39B7Be294cB36dE8c510e267B82bb588705d977", // S*MAI "0x915A55e36A01285A14f05dE6e81ED9cE89772f8e", // S*SGETH @@ -114,8 +114,8 @@ module.exports = treasuryExports({ owners: [optimism], tokens: [ nullAddress, - ADDRESSES.optimism.OP, // OP - ADDRESSES.optimism.USDC, // USDC + ADDRESSES.optimism.OP, + ADDRESSES.optimism.USDC, "0x165137624F1f692e69659f944BF69DE02874ee27", // S*DAI "0x368605D9C6243A80903b9e326f1Cddde088B8924", // S*FRAX "0x3533F5e279bDBf550272a199a223dA798D9eff78", // S*LUSD @@ -135,7 +135,7 @@ module.exports = treasuryExports({ owners: [fantom], tokens: [ nullAddress, - ADDRESSES.fantom.USDC, // USDC + ADDRESSES.fantom.USDC, "0x12edeA9cd262006cC3C4E77c90d2CD2DD4b1eb97", // S*USDC ], ownTokens: [ @@ -146,7 +146,7 @@ module.exports = treasuryExports({ metis: { owners: [metis], tokens: [ - ADDRESSES.metis.Metis, // METIS + ADDRESSES.metis.Metis, ], ownTokens: [], }, diff --git a/projects/treasury/synthetix.js b/projects/treasury/synthetix.js index 9fc4e17fc23..59ca84616c6 100644 --- a/projects/treasury/synthetix.js +++ b/projects/treasury/synthetix.js @@ -1,4 +1,4 @@ -const ADDRESSES = require('../helper/coreAssets.json') +const ADDRESSES = require('../helper/coreAssets.json'); const { nullAddress,treasuryExports } = require("../helper/treasury"); const synthetixTreasury = "0x99f4176ee457afedffcb1839c7ab7a030a5e4a92"; @@ -11,13 +11,13 @@ module.exports = treasuryExports({ ethereum: { tokens: [ nullAddress, - ADDRESSES.ethereum.USDC,//USDC - ADDRESSES.ethereum.DAI,//DAI - '0x4e3FBD56CD56c3e72c1403e103b45Db9da5B9D2B',//CVX - ADDRESSES.ethereum.WETH,//WETH - ADDRESSES.ethereum.USDT,//USDT - '0x57Ab1ec28D129707052df4dF418D58a2D46d5f51',//sUSD - ADDRESSES.ethereum.LIDO,//LIDO + ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.DAI, + ADDRESSES.ethereum.CVX, + ADDRESSES.ethereum.WETH, + ADDRESSES.ethereum.USDT, + ADDRESSES.ethereum.sUSD, + ADDRESSES.ethereum.LIDO, '0x31c8EAcBFFdD875c74b94b077895Bd78CF1E64A3',//RAD '0x3C0FFFF15EA30C35d7A85B85c0782D6c94e1d238' ], diff --git a/projects/treasury/thellamas.js b/projects/treasury/thellamas.js index 0599357757b..02ef046b4e2 100644 --- a/projects/treasury/thellamas.js +++ b/projects/treasury/thellamas.js @@ -9,7 +9,7 @@ module.exports = mergeExports([treasuryExports({ ethereum: { tokens: [ nullAddress, - ADDRESSES.ethereum.USDC,//USDC + ADDRESSES.ethereum.USDC, ADDRESSES.ethereum.CVX, ADDRESSES.ethereum.WETH, ADDRESSES.ethereum.CRV, @@ -24,7 +24,7 @@ module.exports = mergeExports([treasuryExports({ }), { ethereum: { tvl: async (_, _1, _2, { api }) => { - const lockedCVXBal = await api.call({ abi: 'erc20:balanceOf', target: '0x72a19342e8F1838460eBFCCEf09F6585e32db86E', params: Treasury }) + const lockedCVXBal = await api.call({ abi: 'erc20:balanceOf', target: ADDRESSES.ethereum.vlCVX, params: Treasury }) api.add(ADDRESSES.ethereum.CVX, lockedCVXBal) await genericUnwrapCvxRewardPool({ api, owner: Treasury, pool: '0x39D78f11b246ea4A1f68573c3A5B64E83Cff2cAe'}) return api.getBalances() diff --git a/projects/treasury/yearn.js b/projects/treasury/yearn.js index 006ffcefcbc..7889fee6fbc 100644 --- a/projects/treasury/yearn.js +++ b/projects/treasury/yearn.js @@ -3,27 +3,25 @@ const { nullAddress,treasuryExports } = require("../helper/treasury"); const yearnTreasury = "0x93a62da5a14c80f265dabc077fcee437b1a0efde"; const yearnTreasury1 = "0xFEB4acf3df3cDEA7399794D0869ef76A6EfAff52"; -const yearnTreasuryarb = "0xb6bc033d34733329971b938fef32fad7e98e56ad" -const YEARN = ADDRESSES.ethereum.YFI; - +const yearnTreasuryarb = "0xb6bc033d34733329971b938fef32fad7e98e56ad"; module.exports = treasuryExports({ ethereum: { tokens: [ nullAddress, - ADDRESSES.ethereum.USDC,//USDC - ADDRESSES.ethereum.DAI,//DAI + ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.DAI, '0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490',//3crv - ADDRESSES.ethereum.WETH,//WETH - ADDRESSES.ethereum.USDT,//USDT - ADDRESSES.ethereum.CRV,//CRV + ADDRESSES.ethereum.WETH, + ADDRESSES.ethereum.USDT, + ADDRESSES.ethereum.CRV, '0xba100000625a3754423978a60c9317c58a424e3D',//BAL '0x31429d1856aD1377A8A0079410B297e1a9e214c2',//ANGLE - '0x57Ab1ec28D129707052df4dF418D58a2D46d5f51',//sUSD - ADDRESSES.ethereum.WBTC,//WBTC + ADDRESSES.ethereum.sUSD, + ADDRESSES.ethereum.WBTC, ], owners: [yearnTreasury,yearnTreasury1], - ownTokens: [YEARN], + ownTokens: [ADDRESSES.ethereum.YFI], fetchTokens: true, }, arbitrum: { diff --git a/projects/wonderland/index.js b/projects/wonderland/index.js index 8f955b6450e..34c6a5dffdf 100644 --- a/projects/wonderland/index.js +++ b/projects/wonderland/index.js @@ -1,7 +1,6 @@ const ADDRESSES = require('../helper/coreAssets.json') const { stakings } = require("../helper/staking"); const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); -const sdk = require("@defillama/sdk"); const TimeStaking = "0x4456B87Af11e87E329AB7d7C7A246ed1aC2168B9"; const RevenueSharingFarm = "0xC172c84587bEa6d593269bFE08632bf2Da2Bc0f6"; @@ -20,8 +19,8 @@ async function avaxTvl(timestamp, ethBlock, chainBlocks) { await sumTokensAndLPsSharedOwners( balances, [ - [ADDRESSES.avax.USDt, false], // USDT - [ADDRESSES.avax.USDC_e, false], // USDC.e + [ADDRESSES.avax.USDt, false], + [ADDRESSES.avax.USDC_e, false], ["0x39fC9e94Caeacb435842FADeDeCB783589F50f5f", false], // KNC ["0x63682bDC5f875e9bF69E201550658492C9763F89", false], // BSGG ["0x0da67235dd5787d67955420c84ca1cecd4e5bb3b", false], //wMEMO @@ -44,15 +43,15 @@ async function ethTvl(timestamp, ethBlock, chainBlocks) { await sumTokensAndLPsSharedOwners( balances, [ - ["0x5f98805A4E8be255a32880FDeC7F6728C6568bA0", false], // LUSD + [ADDRESSES.ethereum.LUSD, false], ["0x3432B6A60D23Ca0dFCa7761B7ab56459D9C964D0", false], // FRAX - ["0x4e3FBD56CD56c3e72c1403e103b45Db9da5B9D2B", false], // CVX - ["0x62B9c7356A2Dc64a1969e19C23e4f579F9810Aa7", false], // cvxCRV + [ADDRESSES.ethereum.CVX, false], + [ADDRESSES.ethereum.cvxCRV, false], ["0x55C08ca52497e2f1534B59E2917BF524D4765257", false], // UwU ["0x69570f3E84f51Ea70b7B68055c8d667e77735a25", false], // BSGG ["0x04906695D6D12CF5459975d7C3C03356E4Ccd460", false], // sOHM ["0x29127fE04ffa4c32AcAC0fFe17280ABD74eAC313", false], // sifu - [ADDRESSES.ethereum.TUSD, false], // TUSD + [ADDRESSES.ethereum.TUSD, false], ["0x66761Fa41377003622aEE3c7675Fc7b5c1C2FaC5", false], // CPOOL ["0xdBdb4d16EdA451D0503b854CF79D55697F90c8DF", false], // ALCX ["0xdB25f211AB05b1c97D595516F45794528a807ad8", false], // EURS @@ -62,9 +61,9 @@ async function ethTvl(timestamp, ethBlock, chainBlocks) { ["0x0C10bF8FcB7Bf5412187A595ab97a3609160b5c6", false], // USDD ["0xAf5191B0De278C7286d6C7CC6ab6BB8A73bA2Cd6", false], // STG ["0x6243d8CEA23066d098a15582d81a598b4e8391F4", false], // FLX - [ADDRESSES.ethereum.SNX, false], // SNX - [ADDRESSES.ethereum.USDT, false], // USDT - [ADDRESSES.ethereum.DAI, false], // DAI + [ADDRESSES.ethereum.SNX, false], + [ADDRESSES.ethereum.USDT, false], + [ADDRESSES.ethereum.DAI, false], ], [Treasury_Eth], ethBlock, diff --git a/projects/xdai/index.js b/projects/xdai/index.js index 8f5032cc3ce..a3cb007350d 100644 --- a/projects/xdai/index.js +++ b/projects/xdai/index.js @@ -3,8 +3,8 @@ const { sumTokens2 } = require('../helper/unwrapLPs') const { covalentGetTokens } = require('../helper/http'); const tokenAddresses = [ - '0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359', // SAI - ADDRESSES.ethereum.DAI, // DAI + ADDRESSES.ethereum.SAI, + ADDRESSES.ethereum.DAI, //'0x06af07097c9eeb7fd685c692751d5C66db49c215' // CHAI "0x5d3a536E4D6DbD6114cc1Ead35777bAB948E3643", // cDAI ]; diff --git a/projects/xtoken/constants.js b/projects/xtoken/constants.js index b2d0ed44ecd..fbfb91c1456 100644 --- a/projects/xtoken/constants.js +++ b/projects/xtoken/constants.js @@ -19,7 +19,7 @@ const xu3lpfAddr = "0x4296d40183356A770Fd8cA3Ba0592f0163BE9CA3"; const xu3lpgAddr = "0x28ce95124FB0d5Febe6Ab258072848f5fe1010eC"; const xu3lphAddr = "0x9ed880b7F75a220C0450E4884521ba8d500eb4bb"; const ethrsi6040Addr = "0x93E01899c10532d76C0E864537a1D26433dBbDdB"; -const sUsdAddr = "0x57ab1e02fee23774580c119740129eac7081e9d3"; +const sUsdAddr = ADDRESSES.ethereum.sUSD_OLD; const xbntaAddr = "0x6949f1118FB09aD2567fF675f96DbB3B6985ACd0"; const alphaAddr = "0xa1faa113cbe53436df28ff0aee54275c13b40975"; const bntAddr = "0x1F573D6Fb3F13d689FF844B4cE37794d79a7FF1C"; diff --git a/projects/xtoken/index.js b/projects/xtoken/index.js index a0cb8604ab7..c73eaf05fa2 100644 --- a/projects/xtoken/index.js +++ b/projects/xtoken/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json'); const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); const terminal = require("./terminal"); @@ -13,7 +14,6 @@ const { xinchbAddr, xkncaAddr, xkncbAddr, - xsnxaAddr, xsnxaAdminAddr, xsnxaTradeAccountingAddr, xu3lpaAddr, @@ -32,8 +32,6 @@ const { inchAddr, usdcAddr, aaveAddr, - usdtAddress, - xtkAddress } = require("./constants"); const BigNumber = require('bignumber.js'); const xu3lps = [ @@ -177,7 +175,7 @@ async function tvl(timestamp, block) { })).output; sdk.util.sumSingleBalance( balances, - "0x57ab1ec28d129707052df4df418d58a2d46d5f51", + ADDRESSES.ethereum.sUSD, xsnxaSusdRaw ); From f0ecaf31f003979400860d762c97421c8459aad0 Mon Sep 17 00:00:00 2001 From: dbvora03 <54694188+dbvora03@users.noreply.github.com> Date: Mon, 26 Jun 2023 01:29:52 -0500 Subject: [PATCH 0076/1974] Use etherfi oracle (#6623) * add ether-fi tvl calculation * fix eslint issues * fix eslint issues * filter out exited validators * replace code with oracle contract * use optimism oracle --- projects/ether-fi/index.js | 129 ++----------------------------------- 1 file changed, 6 insertions(+), 123 deletions(-) diff --git a/projects/ether-fi/index.js b/projects/ether-fi/index.js index 5a272582e62..8c9ec590184 100644 --- a/projects/ether-fi/index.js +++ b/projects/ether-fi/index.js @@ -1,130 +1,13 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const { GraphQLClient, gql } = require('graphql-request') -const sdk = require('@defillama/sdk'); -const axios = require("axios"); - -const config = { - GRAPH_URL: "https://api.studio.thegraph.com/query/41778/etherfi-mainnet/0.0.3", - BEACONCHAIN_URL: "https://beaconcha.in/api/v1/validator", - LP_ADDRESS: '', - PAGINATION_LIMIT: 100, -}; - -const newTVL = async (block, api) => { - - const validators = await queryFromDepositEvent() - - let pubkeyPartitions = [] - let nodeAddresses = [] - // Maps will ensure we will be running in linear time. - // If we reach something like 10000 validators, we dont want to push iterate something 10000^2 times - let validatorMapping = new Map() - let nodeBalanceMapping = new Map() - - let validatorsPerBatch = 100; - - for (const validator of validators) { - - var index = Object.keys(nodeBalanceMapping).length; - - const validatorSubarrayIndex = Math.floor(index / validatorsPerBatch) - if (!pubkeyPartitions[validatorSubarrayIndex]) { - pubkeyPartitions[validatorSubarrayIndex] = []; - } - pubkeyPartitions[validatorSubarrayIndex].push(validator.validatorPubKey) - - // This will let us access validator data in constant time later on - validatorMapping[validator.validatorPubKey] = validator - nodeBalanceMapping[validator.etherfiNode] = validator.validatorPubKey - - nodeAddresses.push(validator.etherfiNode) - } - - // Get Validator Balances - const validatorBalances = await pubkeyPartitions.reduce(async (accumulatorPromise, pubkeySet) => { - const accumulator = await accumulatorPromise; - const response = await axios.post(config.BEACONCHAIN_URL, { - indicesOrPubkey: pubkeySet.join(",") - }); - return accumulator.concat(response.data.data); - }, Promise.resolve([])); - - for (const balance of validatorBalances) { - validatorMapping[balance.pubkey] = { ...validatorMapping[balance.pubkey], validatorBalance: balance.balance * (10**9) }; - } - - // Get etherfiNode contract balances - const {output} = await sdk.api.eth.getBalances({ targets: nodeAddresses, block }) - - for (const balance of output) { - validatorMapping[nodeBalanceMapping[balance.target]] = {...validatorMapping[nodeBalanceMapping[balance.target]], contractBalance: parseInt(balance.balance)} - } - - // Now that we have out mapping, we can calculate it all together - let lpTVL = 0; - let soloStakerTVL = 0; - Object.values(validatorMapping).forEach(async (validator) => { - const beaconBalanceEth = validator.validatorBalance - - if (beaconBalanceEth) { - const balance = beaconBalanceEth + validator.contractBalance - if (validator.TNFTHolder == config.LP_ADDRESS) { - lpTVL += balance - } else { - soloStakerTVL += balance - } - } - }) - - const eapTVL = await api.call({ abi: 'uint256:getContractTVL', target: '0x7623e9DC0DA6FF821ddb9EbABA794054E078f8c4'}) - - return { - soloTVL: soloStakerTVL, - lpTVL, - eapTVL: parseInt(eapTVL) - } -} - -const queryFromDepositEvent = async () => { - - const graphQLClient = new GraphQLClient(config.GRAPH_URL); - const validatorQuery = gql` - query GetValidators($limit: Int!, $offset: Int!) { - validators(limit: $limit, offset: $offset, , where: {and: [{phase_not: CANCELLED}, {phase_not: FULLY_WITHDRAWN}, {phase_not: EXITED}]}) { - etherfiNode - TNFTHolder - validatorPubKey - } - } - `; - - try { - const limit = config.PAGINATION_LIMIT; - let validators = []; - - let offset = 0; - for (;;) { - const res = await graphQLClient.request(validatorQuery, { limit, offset }); - const { validators: batch } = res; - - validators.push(...batch); - offset += limit; - if (batch.length < limit) break; - } - - return validators; - } catch (error) { - console.error('error: queryFromDepositEvent:', error); - } -} +const { nullAddress } = require("../helper/unwrapLPs"); +const sdk = require('@defillama/sdk') module.exports = { - misrepresentedTokens: true, ethereum: { - tvl: async (_, block, _2, { api }) => { - const {soloTVL, lpTVL, eapTVL} = await newTVL(block, api) + tvl: async (timestamp) => { + const api = new sdk.ChainApi({ timestamp, chain: 'optimism' }) + await api.getBlock() return { - ['ethereum:' + ADDRESSES.null]: soloTVL + lpTVL + eapTVL + [nullAddress]: await api.call({ target: '0x6329004E903B7F420245E7aF3f355186f2432466', abi: 'uint256:getTvl'}) } } } From a74207304ce3c1b47f6791fdeb354e9c44eb60bf Mon Sep 17 00:00:00 2001 From: 0xAegir <99401181+0xAegir@users.noreply.github.com> Date: Mon, 26 Jun 2023 07:31:53 +0100 Subject: [PATCH 0077/1974] Add StakedICP protocol (#6627) --- projects/stakedicp/index.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 projects/stakedicp/index.js diff --git a/projects/stakedicp/index.js b/projects/stakedicp/index.js new file mode 100644 index 00000000000..1dd10aa8d1c --- /dev/null +++ b/projects/stakedicp/index.js @@ -0,0 +1,23 @@ +const BigNumber = require("bignumber.js"); +const axios = require('axios'); + +const url = 'https://h6uvl-xiaaa-aaaap-qaawa-cai.ic0.app/tvl'; + +async function tvl(_timestamp, _block) { + const tvl = (await axios.get(url)).data.tvl; + if (tvl === undefined) { + // API didn't return a tvl number to work with + throw new Error("Unknown"); + } + return { + "coingecko:internet-computer": BigNumber(tvl).div(1e8).toFixed(0), + }; +} + +module.exports = { + timetravel: false, + methodology: "TVL counts ICP deposited as collateral to mint stICP", + icp: { + tvl, + }, +}; From 6facb5b2bb003365b4f68037bf5e273e25cee175 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 26 Jun 2023 08:34:11 +0200 Subject: [PATCH 0078/1974] update azuro --- projects/azuro/index.js | 41 ++++++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/projects/azuro/index.js b/projects/azuro/index.js index f822f13bab2..3a7033c73fc 100644 --- a/projects/azuro/index.js +++ b/projects/azuro/index.js @@ -1,25 +1,12 @@ +const { getLogs } = require('../helper/cache/getLogs') const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens2 } = require('../helper/unwrapLPs') const config = { - polygon: { - owners: [ - '0x2a838ab9b037db117576db8d0dcc3b686748ef7c', - '0x7043E4e1c4045424858ECBCED80989FeAfC11B36', - ], - tokens: [ - ADDRESSES.polygon.USDC, - ADDRESSES.polygon.USDT, - ], - }, + polygon: { factory: '0xde3e9a39af548b5daa8365d30a5f6e7a7fa0203d', fromBlock: 38563568, }, + arbitrum: { factory: '0x752735c1a93fe359e7bac65f9981e7796e1039ef', fromBlock: 94336607, }, xdai: { - owners: [ - '0xac004b512c33D029cf23ABf04513f1f380B3FD0a', // v1 - '0x204e7371Ade792c5C006fb52711c50a7efC843ed', // v2 - ], - tokens: [ - ADDRESSES.xdai.WXDAI, // WXDAI - ], + factory: '0x8ea1a7241537f10fa73363fdc6380f3fc8619c03', fromBlock: 26026402, tokensAndOwners: [[ADDRESSES.xdai.WXDAI, '0xac004b512c33D029cf23ABf04513f1f380B3FD0a']], // v1 }, } @@ -32,3 +19,23 @@ module.exports = { polygon: { tvl }, methodology: `TVL is the total amount of WXDAI and USDC held on Liquidity pools’ smart-contracts.` } + +Object.keys(config).forEach(chain => { + const { factory, fromBlock, tokensAndOwners = [] } = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const logs = await getLogs({ + api, + target: factory, + topics: ['0xbf48d8b8335478e764061b936181c0a7b273540bd6284da4d4791758e81fd51c'], + eventAbi: 'event NewPool(address indexed lp, address indexed core, string indexed coreType, address access)', + onlyArgs: true, + fromBlock, + }) + const lps = logs.map(i => i[0]) + const tokens = await api.multiCall({ abi: 'address:token', calls: lps }) + lps.forEach((lp, i) => tokensAndOwners.push([tokens[i], lp])) + return sumTokens2({ api, tokensAndOwners, permitFailure: true }) + } + } +}) \ No newline at end of file From 02ef9ce23b4debe38013b7e80b61eabd64ae3f72 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 26 Jun 2023 09:04:17 +0200 Subject: [PATCH 0079/1974] track hmx --- projects/hmx/index.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 projects/hmx/index.js diff --git a/projects/hmx/index.js b/projects/hmx/index.js new file mode 100644 index 00000000000..4e806763a1e --- /dev/null +++ b/projects/hmx/index.js @@ -0,0 +1,17 @@ +const { sumTokensExport } = require('../helper/unwrapLPs') +const ADDRESSES = require('../helper/coreAssets.json') + +module.exports = { + arbitrum: { + tvl: sumTokensExport({ + owner: '0x56CC5A9c0788e674f17F7555dC8D3e2F1C0313C0', + tokens: [ + ADDRESSES.arbitrum.USDC, + ADDRESSES.arbitrum.WETH, + ADDRESSES.arbitrum.WBTC, + ADDRESSES.arbitrum.USDT, + ADDRESSES.arbitrum.fsGLP, + ] + }) + } +} \ No newline at end of file From f67c90bd15f98e4d6dc3b226b0e05454490bf391 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 26 Jun 2023 09:28:18 +0200 Subject: [PATCH 0080/1974] fix mobox --- projects/mobox.js | 37 ++++--------------------------------- 1 file changed, 4 insertions(+), 33 deletions(-) diff --git a/projects/mobox.js b/projects/mobox.js index 8304980de5d..7a32d426d46 100644 --- a/projects/mobox.js +++ b/projects/mobox.js @@ -1,47 +1,18 @@ -const sdk = require("@defillama/sdk"); -const { unwrapUniswapLPs } = require("./helper/unwrapLPs"); -const abi = require("./pendle/abi.json"); -const { stakings } = require("./helper/staking.js"); - -async function pool2(timestamp, block, chainBlocks) { - const balances = {}; - - const masterChefDeposits = await sdk.api.abi.call({ - target: "0x73feaa1ee314f8c655e354234017be2193c9e24e", - abi: abi.userInfo, - params: [405, "0x9442dad1df11c858a900f55291dc1cf645ff66df"], - block: chainBlocks.bsc, - chain: "bsc", - }); - - await unwrapUniswapLPs( - balances, - [ - { - balance: masterChefDeposits.output.amount, - token: "0x8FA59693458289914dB0097F5F366d771B7a7C3F", - }, - ], - chainBlocks.bsc, - "bsc", - (a) => `bsc:${a}` - ); - - return balances; -} +const { stakings, staking } = require("./helper/staking.js"); +const { pool2 } = require("./helper/pool2.js"); module.exports = { bsc: { tvl: () => ({}), - pool2, + pool2: pool2(['0xdad49e63f97c967955975490a432de3796c699e6','0xa5f8c5dbd5f286960b9d90548680ae5ebff07652'], '0x8FA59693458289914dB0097F5F366d771B7a7C3F'), staking: stakings( [ "0xdad49e63f97c967955975490a432de3796c699e6", "0xf8c1bA88F1E4aeD152F945F1Df2a8fdc36127B5f", "0x3bD6a582698ECCf6822dB08141818A1a8512c68D", + "0x5E7Eb57B163b78e93608E773e0F4a88A55d7C28F", ], "0x3203c9e46ca618c8c1ce5dc67e7e9d75f5da2377", - "bsc" ), }, }; From ac772d180c96803dc20c79139410cf2d2e512cc7 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 26 Jun 2023 10:23:20 +0200 Subject: [PATCH 0081/1974] use token labels --- projects/0vix/index.js | 2 +- projects/allchainbridge/index.js | 2 +- projects/ante/index.js | 2 +- projects/archly-finance/index.js | 2 +- projects/atlantisloans/index.js | 2 +- projects/blackbird-finance/index.js | 2 +- projects/bonqdao/index.js | 2 +- projects/bprotocol/index.js | 4 +- projects/celerbridge/index.js | 4 +- projects/config/hodltree/addresses.js | 2 +- projects/crosschainbridge/index.js | 2 +- projects/curve/historical/index.js | 13 +++-- projects/cyclone/index.js | 2 +- projects/debets/index.js | 2 +- projects/defihalal/index.js | 3 +- projects/dehive/assetsInfo.js | 4 +- projects/diamond-unibot-v2/index.js | 2 +- projects/ethalend/index.js | 3 +- projects/everrise/index.js | 2 +- projects/evolutionland/index.js | 2 +- projects/fiatdao/index.js | 2 +- projects/gnosis/index.js | 2 +- projects/helper/curvePools.js | 2 +- projects/hundredfinance/index.js | 2 +- projects/insurace/index.js | 2 +- projects/izumi-iziswap/index.js | 2 +- projects/kinefinance/index.js | 2 +- projects/klayswap-v3/index.js | 3 +- projects/liquidrium/vaults.js | 4 +- projects/lusd-chickenbonds/index.js | 3 +- projects/macaron/config.js | 2 +- projects/mcs/index.js | 3 +- projects/meanfinance/addresses.js | 2 +- projects/metronome-synth/index.js | 2 +- projects/mimo/index.js | 2 +- projects/monox/index.js | 2 +- projects/multichainMiner.js | 2 +- projects/nord-finance/config.js | 2 +- projects/opyn-gamma/gamma_polygon.js | 2 +- projects/perp88/index.js | 2 +- projects/pine-protocol/index.js | 2 +- projects/pollyfinance/index.js | 3 +- projects/polyroll.js | 2 +- projects/prime-protocol/index.js | 41 ++++++------- projects/relayChain/index.js | 2 +- projects/safedollar/index.js | 2 +- projects/sandclock/index.js | 2 +- projects/sapphiremine.js | 3 +- projects/single/helpers.js | 3 +- projects/solace-finance/config.js | 2 +- projects/stakewise/index.js | 2 +- projects/sun/index.js | 2 +- projects/swivel/index.js | 2 +- projects/synapse/config.js | 2 +- projects/teddy/index.js | 2 +- projects/thetanuts/index.js | 2 +- projects/tigris/index.js | 5 +- projects/tokemak/index.js | 2 +- projects/treasury/aave.js | 6 +- projects/treasury/alchemix.js | 2 +- projects/treasury/badger-dao.js | 2 +- projects/treasury/dxdao.js | 2 +- projects/treasury/equilibre.js | 17 +++--- projects/treasury/gnosis-dao.js | 4 +- projects/treasury/idle-dao.js | 2 +- projects/treasury/index-coop.js | 2 +- projects/treasury/india-covid-relief-fund.js | 2 +- projects/treasury/iq.js | 2 +- projects/treasury/jade-protocol.js | 2 +- projects/treasury/liquity-treasury.js | 2 +- projects/treasury/perion.js | 2 +- projects/treasury/piedao.js | 2 +- projects/treasury/pleasrdao.js | 4 +- projects/treasury/railgun.js | 4 +- projects/treasury/redacted.js | 2 +- projects/treasury/shapeshift.js | 2 +- projects/treasury/silo-finance.js | 2 +- projects/treasury/sphere-finance.js | 6 +- projects/treasury/synapse.js | 61 ++++++++++---------- projects/treasury/tranchess.js | 2 +- projects/treasury/wonderland.js | 2 +- projects/vesync/index.js | 3 +- projects/wasabix/index.js | 2 +- projects/wonderland/index.js | 2 +- projects/woofi.js | 2 +- projects/xdollar-finance/index.js | 2 +- projects/xy-finance/index.js | 6 +- projects/zklend/index.js | 11 ++-- projects/zomma/index.js | 3 +- 89 files changed, 183 insertions(+), 167 deletions(-) diff --git a/projects/0vix/index.js b/projects/0vix/index.js index 11aad6127c3..a7e7b202d31 100644 --- a/projects/0vix/index.js +++ b/projects/0vix/index.js @@ -3,7 +3,7 @@ const {compoundExports} = require('../helper/compound') const master0vix = "0x8849f1a0cB6b5D6076aB150546EddEe193754F1C"; const oMATIC = "0xE554E874c9c60E45F1Debd479389C76230ae25A8"; -const matic = "0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270"; +const matic = ADDRESSES.polygon.WMATIC_2; const chain = "polygon"; module.exports = { diff --git a/projects/allchainbridge/index.js b/projects/allchainbridge/index.js index e44a7836b4e..dfa855d1512 100644 --- a/projects/allchainbridge/index.js +++ b/projects/allchainbridge/index.js @@ -70,7 +70,7 @@ const tokensConf = { MATIC: nullAddress, USDC: ADDRESSES.polygon.USDC, USDT: ADDRESSES.polygon.USDT, - WMATIC: "0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270", + WMATIC: ADDRESSES.polygon.WMATIC_2, }, fantom: { FTM: nullAddress, diff --git a/projects/ante/index.js b/projects/ante/index.js index b043dd292bd..27f4b2a4838 100644 --- a/projects/ante/index.js +++ b/projects/ante/index.js @@ -36,7 +36,7 @@ const CONFIG = { }, ], startBlock: 32245577, - gasToken: '0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270', + gasToken: ADDRESSES.polygon.WMATIC_2, }, bsc: { factories: [ diff --git a/projects/archly-finance/index.js b/projects/archly-finance/index.js index f3b1aab5674..916d76bc291 100644 --- a/projects/archly-finance/index.js +++ b/projects/archly-finance/index.js @@ -82,7 +82,7 @@ module.exports = { owner: ARCHLY_VE_TOKEN_OTHER, tokens: [ARCHLY_ARC_TOKEN_OTHER], lps: ['0x2651D7B53BaF1925D28A3b5A3ef371274e630C4C'], - coreAssets: ['0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270'], + coreAssets: [ADDRESSES.polygon.WMATIC_2], restrictTokenRatio: 100, }) } diff --git a/projects/atlantisloans/index.js b/projects/atlantisloans/index.js index 381da2ace71..e1d5b18169d 100644 --- a/projects/atlantisloans/index.js +++ b/projects/atlantisloans/index.js @@ -31,7 +31,7 @@ module.exports = { polygon: compoundExports(polygonComptroller, "polygon", "0xa65722af4957cef481edb4cb255f804dd36e8adc", - "0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270" + ADDRESSES.polygon.WMATIC_2 ), avax: compoundExports(avaxComptroller, "avax", diff --git a/projects/blackbird-finance/index.js b/projects/blackbird-finance/index.js index 1cbb1b39036..439f241e909 100644 --- a/projects/blackbird-finance/index.js +++ b/projects/blackbird-finance/index.js @@ -11,7 +11,7 @@ const translate = { [ADDRESSES.shiden.ETH]: "avax:" + ADDRESSES.avax.WAVAX, [ADDRESSES.moonriver.USDT]: "fantom:" + ADDRESSES.fantom.WFTM, "0x9b8077c6590b560f1a9d60512648277d29b35a3b": "polygon:0x8a953cfe442c5e8855cc6c61b1293fa648bae472", - [ADDRESSES.kcc.DAI]: "polygon:0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270", + [ADDRESSES.kcc.DAI]: "polygon:" + ADDRESSES.polygon.WMATIC_2, } async function tvl(timestamp, block, chainBlocks) { diff --git a/projects/bonqdao/index.js b/projects/bonqdao/index.js index d23900e6b19..a3633567f4f 100644 --- a/projects/bonqdao/index.js +++ b/projects/bonqdao/index.js @@ -8,7 +8,7 @@ const BNQ = '0x91eFbe97e08D0ffC7d31381c032D05FAd8E25aAA' // BONQ Utility Token const BNQ_STAKING_CONTRACT = '0xb1b72B3579b03dFdCfF3195486277605e55Cf703' const BNQ_BEUR_UNIV3_POOL = '0xA96373C7a591fd21b86E0c9b8E156CC81E6cBb5e' const TOKEN_COLLATERAL = [ - '0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270', // WMATIC + ADDRESSES.polygon.WMATIC_2, // WMATIC ADDRESSES.polygon.USDC, // USDC '0x35b2ece5b1ed6a7a99b83508f8ceeab8661e0632', // WALBT (Wrapped AllianceBlock Token) ADDRESSES.polygon.WETH_1, // WETH diff --git a/projects/bprotocol/index.js b/projects/bprotocol/index.js index 5ada8b21864..ee990af010a 100644 --- a/projects/bprotocol/index.js +++ b/projects/bprotocol/index.js @@ -173,7 +173,7 @@ const ADDRESSES = require('../helper/coreAssets.json') } async function liquityTvl(timestamp, block) { - if (block < lFirstBlock) return { '0x5f98805A4E8be255a32880FDeC7F6728C6568bA0': '0' }; + if (block < lFirstBlock) return { [ADDRESSES.ethereum.LUSD]: '0' }; let totalBalance = new BigNumber(0); @@ -202,7 +202,7 @@ const ADDRESSES = require('../helper/coreAssets.json') } // all balance is lusd - return {'0x5f98805A4E8be255a32880FDeC7F6728C6568bA0' : totalBalance.toString(10)} + return {[ADDRESSES.ethereum.LUSD]: totalBalance.toString(10)} } async function tvlEth(timestamp, block) { diff --git a/projects/celerbridge/index.js b/projects/celerbridge/index.js index a8dab3fa424..d5a39397b18 100644 --- a/projects/celerbridge/index.js +++ b/projects/celerbridge/index.js @@ -451,7 +451,7 @@ const liquidityBridgeTokens = [ }, { // MATIC - polygon: "0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270", + polygon: ADDRESSES.polygon.WMATIC_2, }, { // AAVE @@ -487,7 +487,7 @@ const liquidityBridgeTokens = [ }, { // LUSD - ethereum: "0x5f98805A4E8be255a32880FDeC7F6728C6568bA0", + ethereum: ADDRESSES.ethereum.LUSD, }, { // JONES diff --git a/projects/config/hodltree/addresses.js b/projects/config/hodltree/addresses.js index a07fe69df67..f366254dfaf 100644 --- a/projects/config/hodltree/addresses.js +++ b/projects/config/hodltree/addresses.js @@ -119,7 +119,7 @@ const polygon = [ contractType: lendBorrow.lender, address: '0x2F35d311fd2F0b0dA65FA268B86831279FB4fd98', miscInfo: { - tokenIn: '0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270' + tokenIn: ADDRESSES.polygon.WMATIC_2 } }, { contractType: lendBorrow.borrower, diff --git a/projects/crosschainbridge/index.js b/projects/crosschainbridge/index.js index 07738b66034..e6049c92150 100644 --- a/projects/crosschainbridge/index.js +++ b/projects/crosschainbridge/index.js @@ -96,7 +96,7 @@ const tokens = { USDT: ADDRESSES.polygon.USDT, // Network Tokens WETH: ADDRESSES.polygon.WETH_1, - WMATIC: "0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270", + WMATIC: ADDRESSES.polygon.WMATIC_2, // Further tokens DAF: "0x2f0e07e881363bb1cdff32971b2f8c87ef8ff432", GFX: "0x65ad6a2288b2dd23e466226397c8f5d1794e58fc", diff --git a/projects/curve/historical/index.js b/projects/curve/historical/index.js index e638eb578f1..97d37a198ca 100644 --- a/projects/curve/historical/index.js +++ b/projects/curve/historical/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../../helper/coreAssets.json') const { Web3 } = require('web3'); const BigNumber = require("bignumber.js"); const axios = require("axios"); @@ -143,7 +144,7 @@ let coinDecimals = [ '0x8dAEBADE922dF735c38C80C7eBD708Af50815fAa': '18', '0x0316EB71485b0Ab14103307bf65a021042c6d380': '18', '0xEB4C2781e4ebA804CE9a9803C67d0893436bB27D': '8', - '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599': '8', + [ADDRESSES.ethereum.WBTC]: '8', '0xfE18be6b3Bd88A2D2A7f928d00292E7a9963CfC6': '18', '0x196f4727526eA7FB1e17b2071B3d8eAA38486988': '18', '0xe2f2a5C287993345a840Db3B0845fbC70f5935a5': '18', @@ -153,7 +154,7 @@ let coinDecimals = [ '0x056Fd409E1d7A124BD7017459dFEa2F387b6d5Cd': '2', //GUSD '0x39AA39c021dfbaE8faC545936693aC917d5E7563': '8', //cUSD '0x5d3a536E4D6DbD6114cc1Ead35777bAB948E3643': '8', //cDAI - '0xdAC17F958D2ee523a2206206994597C13D831ec7': '6', //USDT + [ADDRESSES.ethereum.USDT]: '6', //USDT '0x73a052500105205d34Daf004eAb301916DA8190f': '18', //yTUSD '0xd6aD7a6750A7593E092a9B218d66C0A814a3436e': '6', ///yUSDC '0x16de59092dAE5CcF4A1E6439D611fd0653f0Bd01': '18', ///yDAI @@ -166,11 +167,11 @@ let coinDecimals = [ '0x26EA744E5B887E5205727f55dFBE8685e3b21951': '6', ///y2USDC '0xC2cB1040220768554cf699b0d863A3cd4324ce32': '18', ///y2DAI '0xE6354ed5bC4b393a5Aad09f21c46E101e692d447': '6', ///y2USDT - '0x57Ab1ec28D129707052df4dF418D58a2D46d5f51': '18', //sUSD - '0x6B175474E89094C44Da98b954EedeAC495271d0F': '18', //DAI - '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48': '6', //USDC + [ADDRESSES.ethereum.sUSD]: '18', //sUSD + [ADDRESSES.ethereum.DAI]: '18', //DAI + [ADDRESSES.ethereum.USDC]: '6', //USDC '0x5BC25f649fc4e26069dDF4cF4010F9f706c23831': '18', //dusd - '0x0000000000085d4780B73119b644AE5ecd22b376': '18' + [ADDRESSES.ethereum.TUSD]: '18' } ] diff --git a/projects/cyclone/index.js b/projects/cyclone/index.js index 8a8299c5d7a..b2a8f087d46 100644 --- a/projects/cyclone/index.js +++ b/projects/cyclone/index.js @@ -41,7 +41,7 @@ module.exports = { staking: staking(contracts.bsc.staking.address, contracts.bsc.staking.token, "bsc", "cyclone-protocol", 18), }, polygon: { - tvl: tvl("polygon", "polygon:0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270"), + tvl: tvl("polygon", "polygon:" + ADDRESSES.polygon.WMATIC_2), pool2: pool2(contracts.polygon.pool2.address, contracts.polygon.pool2.token,), }, }; diff --git a/projects/debets/index.js b/projects/debets/index.js index f9a9f79d033..197d25b8deb 100644 --- a/projects/debets/index.js +++ b/projects/debets/index.js @@ -7,7 +7,7 @@ const getPoolInfo = const factory_address_polygon = "0xcE214f6a877747495106B5e55533f3e23D290DBd"; const polygon_tokens = Object.values({ - POLYGON_WMATIC: "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270", + POLYGON_WMATIC: ADDRESSES.polygon.WMATIC_2, POLYGON_WETH: ADDRESSES.polygon.WETH_1, POLYGON_WBTC: ADDRESSES.polygon.WBTC, POLYGON_USDC: ADDRESSES.polygon.USDC, diff --git a/projects/defihalal/index.js b/projects/defihalal/index.js index b2a3ee5ca40..a7bd51a86ca 100644 --- a/projects/defihalal/index.js +++ b/projects/defihalal/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const {getLiquityTvl} = require('../helper/liquity') //USDH TOKEN ADDRESS ON POLYGON MAINNET @@ -6,6 +7,6 @@ const USDH_TOKEN_ADDRESS = "0x92B27abe3C96d3B1266f881b3B0886e68645F51F"; module.exports = { methodology: "Deposited Matic and USDH, USDH is not listed on CoinGecko and has been replaced with TUSD", polygon:{ - tvl: getLiquityTvl("0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270", "0xd8a3e8c70091d6231a63e671a6ce8ea44e143d24", "polygon") + tvl: getLiquityTvl(ADDRESSES.polygon.WMATIC_2, "0xd8a3e8c70091d6231a63e671a6ce8ea44e143d24", "polygon") } }; diff --git a/projects/dehive/assetsInfo.js b/projects/dehive/assetsInfo.js index ac39fe5bd6e..c68fa859450 100644 --- a/projects/dehive/assetsInfo.js +++ b/projects/dehive/assetsInfo.js @@ -127,7 +127,7 @@ module.exports = { lpAddress: '0xc4e595acDD7d12feC385E5dA5D43160e8A0bAC0E', // SUSHI-WMATIC-WETH dhvToken: '0x5fCB9de282Af6122ce3518CDe28B7089c9F97b26', underlying: [ - '0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270', // WMATIC + ADDRESSES.polygon.WMATIC_2, // WMATIC ADDRESSES.polygon.WETH_1, // WETH ], poolId: 6 @@ -166,7 +166,7 @@ module.exports = { lpAddress: '0xf69e93771F11AECd8E554aA165C3Fe7fd811530c', // SUSHI-WMATIC-GHST dhvToken: '0x5fCB9de282Af6122ce3518CDe28B7089c9F97b26', underlying: [ - '0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270', // WMATIC + ADDRESSES.polygon.WMATIC_2, // WMATIC '0x385eeac5cb85a38a9a07a70c73e0a3271cfb54a7', // GHST ], poolId: 9 diff --git a/projects/diamond-unibot-v2/index.js b/projects/diamond-unibot-v2/index.js index 4fd9e2ac8c5..8e97c7ad9cf 100644 --- a/projects/diamond-unibot-v2/index.js +++ b/projects/diamond-unibot-v2/index.js @@ -36,7 +36,7 @@ const config = { "0x8610D60f5329B0560c8F0CEb80175F342fe943F3", ], // WETH [ - "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270", + ADDRESSES.polygon.WMATIC_2, "0xEdD1efA76fe59e9106067D824b89B59157C5223C", ], // WMATIC ], diff --git a/projects/ethalend/index.js b/projects/ethalend/index.js index 4005d35e7d2..d3b4da469be 100644 --- a/projects/ethalend/index.js +++ b/projects/ethalend/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk') const abi = require('./abi.json') const { unwrapUniswapLPs } = require('../helper/unwrapLPs') @@ -51,7 +52,7 @@ async function tvl(chain, block, chainId) { const globalData = (await request("https://api.thegraph.com/subgraphs/name/ethalend/etha-v1", globalDataQuery, { block: block - 100 })).globalDatas await Promise.all(globalData.filter(v => v.type === "lending").map(async v => { if (v.address === "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee") { - v.address = "0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270" + v.address = ADDRESSES.polygon.WMATIC_2 } const decimals = await sdk.api.erc20.decimals(v.address, chain) sdk.util.sumSingleBalance(balances, chain + ':' + v.address, BigNumber(v.totalUnderlying).times(10 ** decimals.output).toFixed(0)) diff --git a/projects/everrise/index.js b/projects/everrise/index.js index 3e60d0b497b..9a11a8d5e05 100644 --- a/projects/everrise/index.js +++ b/projects/everrise/index.js @@ -51,7 +51,7 @@ const chainConfig = { }, polygon: { chainId: '137', - WCoin: '0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270', + WCoin: ADDRESSES.polygon.WMATIC_2, lpFactory: '0x5757371414417b8C6CAad45bAeF941aBc7d3Ab32', LPs: [ { diff --git a/projects/evolutionland/index.js b/projects/evolutionland/index.js index 9ba2a663e20..daab37b011c 100644 --- a/projects/evolutionland/index.js +++ b/projects/evolutionland/index.js @@ -10,7 +10,7 @@ const ring = { const weth = { "ethereum": ADDRESSES.ethereum.WETH, "heco": ADDRESSES.heco.WHT, - "polygon": "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270", + "polygon": ADDRESSES.polygon.WMATIC_2, "crab": ADDRESSES.crab.WCRAB, } diff --git a/projects/fiatdao/index.js b/projects/fiatdao/index.js index ba64b4c1129..8c9c9e7e6fd 100644 --- a/projects/fiatdao/index.js +++ b/projects/fiatdao/index.js @@ -19,7 +19,7 @@ const WSOHM = "0xca76543cf381ebbb277be79574059e32108e3e65" const WSOHM_FDT_SLP = "0x2e30e758b3950dd9afed2e21f5ab82156fbdbbba" const FDT_GOHM = "0x75b02b9889536B617d57D08c1Ccb929c523945C1" -const LUSD = '0x5f98805a4e8be255a32880fdec7f6728c6568ba0' +const LUSD = ADDRESSES.ethereum.LUSD const LUSD3CRV = '0xEd279fDD11cA84bEef15AF5D39BB4d4bEE23F0cA' function resolveUnderlier(underlier) { diff --git a/projects/gnosis/index.js b/projects/gnosis/index.js index 78cea23f170..d4faac58b02 100644 --- a/projects/gnosis/index.js +++ b/projects/gnosis/index.js @@ -16,7 +16,7 @@ function addTvl(owner) { ADDRESSES.ethereum.WETH, ADDRESSES.ethereum.DAI, ADDRESSES.ethereum.USDC, - '0x6810e776880c02933d47db1b9fc05908e5386b96', + ADDRESSES.ethereum.GNO, ADDRESSES.ethereum.YFI, ADDRESSES.ethereum.sUSD, ADDRESSES.ethereum.UNI, diff --git a/projects/helper/curvePools.js b/projects/helper/curvePools.js index a16a392b6e0..e4b847a0aad 100644 --- a/projects/helper/curvePools.js +++ b/projects/helper/curvePools.js @@ -143,7 +143,7 @@ module.exports = { '0xed279fdd11ca84beef15af5d39bb4d4bee23f0ca': { swapContract: '0xed279fdd11ca84beef15af5d39bb4d4bee23f0ca', underlyingTokens: [ - '0x5f98805A4E8be255a32880FDeC7F6728C6568bA0', + ADDRESSES.ethereum.LUSD, '0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490' ] }, diff --git a/projects/hundredfinance/index.js b/projects/hundredfinance/index.js index 21a181c84a7..54510aaca7d 100644 --- a/projects/hundredfinance/index.js +++ b/projects/hundredfinance/index.js @@ -71,6 +71,6 @@ module.exports={ harmony:compoundExportsWithAsyncTransform(comptroller, "harmony", "0xbb93C7F378B9b531216f9aD7b5748be189A55807", ADDRESSES.harmony.WONE), moonriver:compoundExportsWithAsyncTransform("0x7d166777bd19a916c2edf5f1fc1ec138b37e7391", "moonriver", "0xd6fcBCcfC375c2C61d7eE2952B329DcEbA2D4e10", "0x98878b06940ae243284ca214f92bb71a2b032b8a"), xdai:compoundExportsWithAsyncTransform("0x6bb6ebCf3aC808E26545d59EA60F27A202cE8586", "xdai", "0x6eDCB931168C9F7C20144f201537c0243b19dCA4", ADDRESSES.xdai.WXDAI), - polygon:compoundExportsWithAsyncTransform("0xedba32185baf7fef9a26ca567bc4a6cbe426e499", "polygon", "0xEbd7f3349AbA8bB15b897e03D6c1a4Ba95B55e31", "0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270"), + polygon:compoundExportsWithAsyncTransform("0xedba32185baf7fef9a26ca567bc4a6cbe426e499", "polygon", "0xEbd7f3349AbA8bB15b897e03D6c1a4Ba95B55e31", ADDRESSES.polygon.WMATIC_2), optimism:compoundExportsWithAsyncTransform("0x5a5755E1916F547D04eF43176d4cbe0de4503d5d", "optimism", "0x1A61A72F5Cf5e857f15ee502210b81f8B3a66263", ADDRESSES.tombchain.FTM), } diff --git a/projects/insurace/index.js b/projects/insurace/index.js index a2c609b084b..cbd0b055ded 100644 --- a/projects/insurace/index.js +++ b/projects/insurace/index.js @@ -111,7 +111,7 @@ async function polygon(timestamp, ethBlock, chainBlocks) { _tvlList.forEach((element) => { let address = element.input.params[0].toLowerCase(); if(address === "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"){ - address = "0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270" + address = ADDRESSES.polygon.WMATIC_2 } let balance = element.output; sdk.util.sumSingleBalance(balances, 'polygon:'+address, balance) diff --git a/projects/izumi-iziswap/index.js b/projects/izumi-iziswap/index.js index 95517556f0b..ccdf428ac89 100644 --- a/projects/izumi-iziswap/index.js +++ b/projects/izumi-iziswap/index.js @@ -60,7 +60,7 @@ const tvl = async (_, _1, _2, { api }) => { }) pools.forEach((output, i) => toa.push([poolMetaData[i].tokenX, output], [poolMetaData[i].tokenY, output],)) - // if (chain === 'era') bTokens.push('0x82af49447d8a07e3bd95bd0d56f35241523fbab1') + // if (chain === 'era') bTokens.push(ADDRESSES.arbitrum.WETH) return sumTokens2({ tokensAndOwners: toa, api, blacklistedTokens: bTokens, permitFailure: true}) } diff --git a/projects/kinefinance/index.js b/projects/kinefinance/index.js index 64bc1097190..de73216bd9b 100644 --- a/projects/kinefinance/index.js +++ b/projects/kinefinance/index.js @@ -161,7 +161,7 @@ async function bscBorrowed(timestamp, block, chainBlocks) { const polygonUnitroller = "0xdff18ac4146d67bf2ccbe98e7db1e4fa32b96881"; const kmatic = "0xf186a66c2bd0509beaafca2a16d6c39ba02425f9"; -const wmatic = "0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270"; +const wmatic = ADDRESSES.polygon.WMATIC_2; const polygonXKine = "0x66a782c9a077f5adc988cc0b5fb1cdcc9d7adeda"; const polygonKine = "0xa9c1740fa56e4c0f6ce5a792fd27095c8b6ccd87"; const polygonkMcd = "0xcd6b46443becad4996a70ee3d8665c0b86a0c54c"; diff --git a/projects/klayswap-v3/index.js b/projects/klayswap-v3/index.js index 91d0d5c3091..df1ef1630f0 100644 --- a/projects/klayswap-v3/index.js +++ b/projects/klayswap-v3/index.js @@ -1,10 +1,11 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens2 } = require('../helper/unwrapLPs') const { getLogs } = require('../helper/cache/getLogs') async function v3Tvl(_, _b, _cb, { api, }) { const factory = '0xA15Be7e90df29A4aeaD0C7Fc86f7a9fBe6502Ac9'; const wklay = '0x19aac5f612f524b754ca7e7c41cbfa2e981a4432'; - const klay = '0x0000000000000000000000000000000000000000'; + const klay = ADDRESSES.null; const fromBlock = 124342981; const eventAbi = 'event PoolCreated(address indexed token0, address indexed token1, uint24 indexed fee, int24 tickSpacing, address pool, uint256 exid)'; diff --git a/projects/liquidrium/vaults.js b/projects/liquidrium/vaults.js index 3d880e6d2e1..b49294e83c3 100644 --- a/projects/liquidrium/vaults.js +++ b/projects/liquidrium/vaults.js @@ -48,7 +48,7 @@ const vaults = [ { name: "matic-usdc", address: "0xB19e59b77E173363FB7Ce674f1279c76ee237c7A", - token1: "0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270", + token1: ADDRESSES.polygon.WMATIC_2, token2: ADDRESSES.polygon.USDC, token1decimal: 18, token2decimal: 6, @@ -59,7 +59,7 @@ const vaults = [ { name: "matic-weth", address: "0x249403E3163aAA88259e0e79A513E999EF8AbEc3", - token1: "0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270", + token1: ADDRESSES.polygon.WMATIC_2, token2: ADDRESSES.polygon.WETH_1, token1decimal: 18, token2decimal: 18, diff --git a/projects/lusd-chickenbonds/index.js b/projects/lusd-chickenbonds/index.js index 9f91ca80c3a..abd8486671f 100644 --- a/projects/lusd-chickenbonds/index.js +++ b/projects/lusd-chickenbonds/index.js @@ -1,8 +1,9 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk'); const BigNumber = require("bignumber.js"); const CHICKEN_BOND_MANAGER_CONTRACT = '0x57619FE9C539f890b19c61812226F9703ce37137'; -const LUSD_ADDRESS = '0x5f98805A4E8be255a32880FDeC7F6728C6568bA0'; +const LUSD_ADDRESS = ADDRESSES.ethereum.LUSD; async function tvl(_, block) { const bucketAmounts = (await sdk.api.abi.call({ diff --git a/projects/macaron/config.js b/projects/macaron/config.js index 2453fd78efa..15ca85d9a0c 100644 --- a/projects/macaron/config.js +++ b/projects/macaron/config.js @@ -951,7 +951,7 @@ const choco_pools_polygon = [ "earningToken": { "symbol": "wMATIC", "address": { - "137": "0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270", + "137": ADDRESSES.polygon.WMATIC_2, "80001": "" }, "decimals": 18, diff --git a/projects/mcs/index.js b/projects/mcs/index.js index a4e94f19b4e..1b41c49d735 100644 --- a/projects/mcs/index.js +++ b/projects/mcs/index.js @@ -1,7 +1,8 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { staking } = require('../helper/staking') const MCS_TOKEN_ADDRESS = '0xDa5aC8F284537d6eaB198801127a9d49b0CbDff5'; -const USDC_TOKEN_ADDRESS = '0xfa9343c3897324496a05fc75abed6bac29f8a40f'; +const USDC_TOKEN_ADDRESS = ADDRESSES.telos.ETH; const STAKING_CONTRACT_ADDRESS = '0x258FC83E130Bc708541c33900bAEDE83242646db'; module.exports = { diff --git a/projects/meanfinance/addresses.js b/projects/meanfinance/addresses.js index 9e3a094f00c..a0992c91f89 100644 --- a/projects/meanfinance/addresses.js +++ b/projects/meanfinance/addresses.js @@ -37,7 +37,7 @@ const TOKENS_IN_LEGACY_VERSIONS = { ], polygon: [ '0x0b3f868e0be5597d5db7feb59e1cadbb0fdda50a', // SUSHI - '0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270', // WMATIC + ADDRESSES.polygon.WMATIC_2, // WMATIC '0x172370d5cd63279efa6d502dab29171933a610af', // CRV ADDRESSES.polygon.WBTC, // WBTC ADDRESSES.polygon.USDC, // USDC diff --git a/projects/metronome-synth/index.js b/projects/metronome-synth/index.js index 52915b81531..9eab11276f8 100644 --- a/projects/metronome-synth/index.js +++ b/projects/metronome-synth/index.js @@ -14,7 +14,7 @@ module.exports = { ADDRESSES.ethereum.WBTC, "0xa8b607Aa09B6A2E306F93e74c282Fb13f6A80452", "0xc14900dFB1Aa54e7674e1eCf9ce02b3b35157ba5", - "0xac3E018457B222d93114458476f3E3416Abbe38F", + ADDRESSES.ethereum.SFRETH, "0x4Dbe3f01aBe271D3E65432c74851625a8c30Aa7B", "0x650CD45DEdb19c33160Acc522aD1a82D9701036a", "0xDD9F61a85fFE73E41eF889817972f0B0AaE6D6Dd" diff --git a/projects/mimo/index.js b/projects/mimo/index.js index 6f772e0c684..20213b249ad 100755 --- a/projects/mimo/index.js +++ b/projects/mimo/index.js @@ -12,7 +12,7 @@ const config = { polygon: { vaultCore: ['0x03175c19cb1d30fa6060331a9ec181e04cac6ab0'], collaterals: [ - '0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270', //wMATIC + ADDRESSES.polygon.WMATIC_2, //wMATIC ADDRESSES.polygon.WETH_1, //wETH ADDRESSES.polygon.WBTC, //wBTC ADDRESSES.polygon.USDC, //USDC diff --git a/projects/monox/index.js b/projects/monox/index.js index 7a949855bc0..c67ebfd3fbd 100644 --- a/projects/monox/index.js +++ b/projects/monox/index.js @@ -23,7 +23,7 @@ async function polygon(timestamp, ethBlock, chainBlocks){ ADDRESSES.polygon.USDT, ADDRESSES.polygon.USDC, ADDRESSES.polygon.WETH_1, - "0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270", + ADDRESSES.polygon.WMATIC_2, ], ["0x3826367A5563eCE9C164eFf9701146d96cC70AD9"], block, "polygon") return balances } diff --git a/projects/multichainMiner.js b/projects/multichainMiner.js index a7e927b00ac..2b58694579d 100644 --- a/projects/multichainMiner.js +++ b/projects/multichainMiner.js @@ -6,7 +6,7 @@ const { getChainTransform, const minedTokens = { 'cake': '0x0e09fabb73bd3ade0a17ecc321fd13a19e81ce82', 'busd': ADDRESSES.bsc.BUSD, - 'matic': '0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270', + 'matic': ADDRESSES.polygon.WMATIC_2, 'ftm': ADDRESSES.fantom.WFTM, 'avax': ADDRESSES.avax.WAVAX, 'usdc': ADDRESSES.polygon.USDC, // polygon diff --git a/projects/nord-finance/config.js b/projects/nord-finance/config.js index 69cb32924cf..970fe08f0fd 100644 --- a/projects/nord-finance/config.js +++ b/projects/nord-finance/config.js @@ -30,7 +30,7 @@ module.exports = { ['0x53e0bca35ec356bd5dddfebbd1fc0fd03fabad39', '0x014fD6Db604b55eF900704ed5c25F9Ef61e8B225'], ['0xb33eaad8d922b1083446dc23f610c2567fb5180f', '0x014fD6Db604b55eF900704ed5c25F9Ef61e8B225'], ['0xd6df932a45c0f255f85145f286ea0b292b21c90b', '0x014fD6Db604b55eF900704ed5c25F9Ef61e8B225'], - ['0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270', '0x014fD6Db604b55eF900704ed5c25F9Ef61e8B225'], + [ADDRESSES.polygon.WMATIC_2, '0x014fD6Db604b55eF900704ed5c25F9Ef61e8B225'], [ADDRESSES.polygon.USDC, '0x014fD6Db604b55eF900704ed5c25F9Ef61e8B225'], ], staking: [ diff --git a/projects/opyn-gamma/gamma_polygon.js b/projects/opyn-gamma/gamma_polygon.js index 5d907440543..8ba14c5fce0 100644 --- a/projects/opyn-gamma/gamma_polygon.js +++ b/projects/opyn-gamma/gamma_polygon.js @@ -1,7 +1,7 @@ const ADDRESSES = require('../helper/coreAssets.json') const marginPool = "0x30ae5debc9edf60a23cd19494492b1ef37afa56d"; const WETH = ADDRESSES.polygon.WETH_1; -const collateralAssets = ['0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270', +const collateralAssets = [ADDRESSES.polygon.WMATIC_2, ADDRESSES.polygon.USDC, ADDRESSES.polygon.WBTC, WETH, ] diff --git a/projects/perp88/index.js b/projects/perp88/index.js index 3e4413ec724..65821a5fd2e 100644 --- a/projects/perp88/index.js +++ b/projects/perp88/index.js @@ -1,7 +1,7 @@ const ADDRESSES = require('../helper/coreAssets.json') const { sumTokensExport } = require('../helper/unwrapLPs') const tokens = { - "WMATIC": "0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270", + "WMATIC": ADDRESSES.polygon.WMATIC_2, "WETH": ADDRESSES.polygon.WETH_1, "WBTC": ADDRESSES.polygon.WBTC, "DAI": ADDRESSES.polygon.DAI, diff --git a/projects/pine-protocol/index.js b/projects/pine-protocol/index.js index 82cffda2faf..31658435ae8 100644 --- a/projects/pine-protocol/index.js +++ b/projects/pine-protocol/index.js @@ -32,7 +32,7 @@ async function borrowed(_, _b, _cb, { api, }) { const config = { ethereum: { factory: '0x19c56cb20e6e9598fc4d22318436f34981e481f9', fromBlock: 16423090, wrapped: ADDRESSES.ethereum.WETH, }, - polygon: { factory: '0x85b609f4724860fead57e16175e66cf1f51bf72d', fromBlock: 40378130, wrapped: '0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270', }, + polygon: { factory: '0x85b609f4724860fead57e16175e66cf1f51bf72d', fromBlock: 40378130, wrapped: ADDRESSES.polygon.WMATIC_2, }, } module.exports = { diff --git a/projects/pollyfinance/index.js b/projects/pollyfinance/index.js index f8332ff107c..a3fb8befb4b 100644 --- a/projects/pollyfinance/index.js +++ b/projects/pollyfinance/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const {sumTokens2} = require("../helper/unwrapLPs"); const polly = "0x4C392822D4bE8494B798cEA17B43d48B2308109C"; @@ -44,7 +45,7 @@ const nDefiUnderLying = [ "0xda537104d6a5edd53c6fbba9a898708e465260b6", "0x95c300e7740D2A88a44124B424bFC1cB2F9c3b89", "0xc81278a52AD0e1485B7C3cDF79079220Ddd68b7D", - "0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270", + ADDRESSES.polygon.WMATIC_2, "0x3066818837c5e6ed6601bd5a91b0762877a6b731", "0xb33eaad8d922b1083446dc23f610c2567fb5180f", "0x3AE490db48d74B1bC626400135d4616377D0109f" diff --git a/projects/polyroll.js b/projects/polyroll.js index ef1040de6b7..3a81dcc7f81 100644 --- a/projects/polyroll.js +++ b/projects/polyroll.js @@ -3,7 +3,7 @@ const { sumTokensAndLPsSharedOwners } = require('./helper/unwrapLPs'); const { transformPolygonAddress } = require('./helper/portedTokens'); const tokens = [ - ['0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270', false], //WMATIC + [ADDRESSES.polygon.WMATIC_2, false], //WMATIC [ADDRESSES.polygon.WETH_1, false], //WETH [ADDRESSES.polygon.USDT, false], //USDT ['0x831753dd7087cac61ab5644b308642cc1c33dc13', false] //QUICK diff --git a/projects/prime-protocol/index.js b/projects/prime-protocol/index.js index e48b424f25b..a5e835dbe32 100644 --- a/projects/prime-protocol/index.js +++ b/projects/prime-protocol/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk'); const { sumTokens2, } = require('../helper/unwrapLPs') @@ -13,7 +14,7 @@ const MASTER_VIEW_CONTRACT = { const MOONBEAM_MARKETS = { GLMR_v146: { pTokenMarketAddress: '0x53d5a47bb874eE688acb479676aD133d47CB9B25', - pTokenUnderlyingAddress: '0x0000000000000000000000000000000000000000', + pTokenUnderlyingAddress: ADDRESSES.null, }, whUSDC_v146: { pTokenMarketAddress: '0x5f8d500ec32dB09aa3115a852f30e9C756867d5A', @@ -21,7 +22,7 @@ const MOONBEAM_MARKETS = { }, xcUSDT_v146: { pTokenMarketAddress: '0x1D5CC7840a05BA39Db0AAd21e14dF1ff09b599ED', - pTokenUnderlyingAddress: '0xFFFFFFfFea09FB06d082fd1275CD48b191cbCD1d', + pTokenUnderlyingAddress: ADDRESSES.moonbeam.xcUSDT, }, xcDOT_v146: { pTokenMarketAddress: '0x8f7F208F38A4362e6Fe6112b720630f93bb608aA', @@ -29,7 +30,7 @@ const MOONBEAM_MARKETS = { }, GLMR_v160: { pTokenMarketAddress: '0xdC427cDB81E1532747BEDeB8077a4AEcDbfB585e', - pTokenUnderlyingAddress: '0x0000000000000000000000000000000000000000', + pTokenUnderlyingAddress: ADDRESSES.null, }, whUSDC_v160: { pTokenMarketAddress: '0x227EEB717a3Ec78025bE51c87b3A7160192613D2', @@ -37,7 +38,7 @@ const MOONBEAM_MARKETS = { }, xcUSDT_v160: { pTokenMarketAddress: '0x8ef25FAC30DeD9A210151C1d27e58F71f2142e2f', - pTokenUnderlyingAddress: '0xFFFFFFfFea09FB06d082fd1275CD48b191cbCD1d', + pTokenUnderlyingAddress: ADDRESSES.moonbeam.xcUSDT, }, xcDOT_v160: { pTokenMarketAddress: '0x525c6B3D27B6b1Fc28bca7dc04964247c1a942B1', @@ -48,73 +49,73 @@ const MOONBEAM_MARKETS = { const AVALANCHE_MARKETS = { ETH_v146: { pTokenMarketAddress: '0x94ebF80b33120a1AbE370E56192db39f4944b6ca', - pTokenUnderlyingAddress: '0x49D5c2BdFfac6CE2BFdB6640F4F80f226bc10bAB', + pTokenUnderlyingAddress: ADDRESSES.avax.WETH_e, }, USDC_v146: { pTokenMarketAddress: '0x6Cce9601CA44a9049A761C22b70D5849662c2C0a', - pTokenUnderlyingAddress: '0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E', + pTokenUnderlyingAddress: ADDRESSES.avax.USDC, }, USDT_v146: { pTokenMarketAddress: '0xe06F55FB6c6C62b74AAD7eb77f00b06920FB176e', - pTokenUnderlyingAddress: '0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7', + pTokenUnderlyingAddress: ADDRESSES.avax.USDt, }, ETH_v160: { pTokenMarketAddress: '0x4Ebba16380fEb2083938c008aEDD4b5EBeA80f72', - pTokenUnderlyingAddress: '0x49D5c2BdFfac6CE2BFdB6640F4F80f226bc10bAB', + pTokenUnderlyingAddress: ADDRESSES.avax.WETH_e, }, USDC_v160: { pTokenMarketAddress: '0x73c5c93E78cB8CA4939307e0D95e032631fB9eEe', - pTokenUnderlyingAddress: '0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E', + pTokenUnderlyingAddress: ADDRESSES.avax.USDC, }, USDT_v160: { pTokenMarketAddress: '0x1BF6752282039ee82C06DE64D094C9E35578A1a0', - pTokenUnderlyingAddress: '0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7', + pTokenUnderlyingAddress: ADDRESSES.avax.USDt, }, }; const ARBITRUM_MARKETS = { ETH_v146: { pTokenMarketAddress: '0x2E9F73aA3F16748C9c1E8243D204d60F87dEC872', - pTokenUnderlyingAddress: '0x0000000000000000000000000000000000000000', + pTokenUnderlyingAddress: ADDRESSES.null, }, USDC_v146: { pTokenMarketAddress: '0x1b0509D8CC044805F54D132ccDa7b4A4ED88261A', - pTokenUnderlyingAddress: '0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8', + pTokenUnderlyingAddress: ADDRESSES.arbitrum.USDC, }, ETH_v160: { pTokenMarketAddress: '0xc01683398fFCc86264ba17bC36977f51A1d25e06', - pTokenUnderlyingAddress: '0x0000000000000000000000000000000000000000', + pTokenUnderlyingAddress: ADDRESSES.null, }, USDC_v160: { pTokenMarketAddress: '0xddC6Df52F9749ED80966Fb6a9D4C87264cC1e6C1', - pTokenUnderlyingAddress: '0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8', + pTokenUnderlyingAddress: ADDRESSES.arbitrum.USDC, }, }; const ETHEREUM_MARKETS = { ETH_v146: { pTokenMarketAddress: '0xD15a15C0b6d79D9E59F4fcC0D17912219f6b470C', - pTokenUnderlyingAddress: '0x0000000000000000000000000000000000000000', + pTokenUnderlyingAddress: ADDRESSES.null, }, USDC_v146: { pTokenMarketAddress: '0x8F0Ba37DAC51a8102b1203C9D9ac26724DC684Ac', - pTokenUnderlyingAddress: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', + pTokenUnderlyingAddress: ADDRESSES.ethereum.USDC, }, USDT_v146: { pTokenMarketAddress: '0x373bb8bE40Ee6f704576CDC815372ff71d6825c5', - pTokenUnderlyingAddress: '0xdAC17F958D2ee523a2206206994597C13D831ec7', + pTokenUnderlyingAddress: ADDRESSES.ethereum.USDT, }, ETH_v160: { pTokenMarketAddress: '0xd833F882ca07F69C4C5a069675B6B65C235325C3', - pTokenUnderlyingAddress: '0x0000000000000000000000000000000000000000', + pTokenUnderlyingAddress: ADDRESSES.null, }, USDC_v160: { pTokenMarketAddress: '0x67CeC45eB8d9f059D4c974a4BdEA357b68Ad80Ef', - pTokenUnderlyingAddress: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', + pTokenUnderlyingAddress: ADDRESSES.ethereum.USDC, }, USDT_v160: { pTokenMarketAddress: '0xDC313B592949E8F4bB91A22c6DC9f7BE11b74Ea7', - pTokenUnderlyingAddress: '0xdAC17F958D2ee523a2206206994597C13D831ec7', + pTokenUnderlyingAddress: ADDRESSES.ethereum.USDT, }, }; diff --git a/projects/relayChain/index.js b/projects/relayChain/index.js index 86e4644e8fd..9ad5a62559f 100644 --- a/projects/relayChain/index.js +++ b/projects/relayChain/index.js @@ -41,7 +41,7 @@ const husdHeco = "0x0298c2b32eaE4da002a15f36fdf7615BEa3DA047"; const miMatic = "0xa3Fa99A148fA48D14Ed51d610c367C61876997F1"; -const wmatic = "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270"; +const wmatic = ADDRESSES.polygon.WMATIC_2; const wethMatic = ADDRESSES.polygon.WETH_1; const wbtcMatic = ADDRESSES.polygon.WBTC; const usdcMatic = ADDRESSES.polygon.USDC; diff --git a/projects/safedollar/index.js b/projects/safedollar/index.js index 22069ad8de1..35820df099f 100644 --- a/projects/safedollar/index.js +++ b/projects/safedollar/index.js @@ -13,7 +13,7 @@ const Contracts = { address: ADDRESSES.polygon.USDC },{ collateralAddress: "0xbd75b2a992ea83abed729e60022c9fe8fe539e54", - address: "0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270" + address: ADDRESSES.polygon.WMATIC_2 }], boardRoom: "0x46C6a9b8E3243FB0dfB069119D5Fc6a75EEc8604", diff --git a/projects/sandclock/index.js b/projects/sandclock/index.js index c319911dd70..d1e20d72102 100644 --- a/projects/sandclock/index.js +++ b/projects/sandclock/index.js @@ -2,7 +2,7 @@ const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk'); const { sumTokens2 } = require('../helper/unwrapLPs') -const LUSD = '0x5f98805A4E8be255a32880FDeC7F6728C6568bA0'; +const LUSD = ADDRESSES.ethereum.LUSD; const WETH = ADDRESSES.ethereum.WETH; const USDC = ADDRESSES.ethereum.USDC; const YEARN_VAULT = '0x4fe4bf4166744bcbc13c19d959722ed4540d3f6a'; diff --git a/projects/sapphiremine.js b/projects/sapphiremine.js index e6d343a9570..b83739ccb73 100644 --- a/projects/sapphiremine.js +++ b/projects/sapphiremine.js @@ -1,6 +1,7 @@ +const ADDRESSES = require('helper/coreAssets.json') const sdk = require("@defillama/sdk"); const target = '0x7146854856E3f373675105556c7D964B329606be'; -const WMATIC = '0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270'; +const WMATIC = ADDRESSES.polygon.WMATIC_2; async function tvl(timestamp, block, chainBlocks) { return { [ `polygon:${WMATIC}` ]: diff --git a/projects/single/helpers.js b/projects/single/helpers.js index 1a4e8c6f2c4..964e69e2267 100644 --- a/projects/single/helpers.js +++ b/projects/single/helpers.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk'); const bn = require('bignumber.js'); const abi = require('../helper/abis/masterchef.json'); @@ -81,7 +82,7 @@ async function getUserCamelotMasterBalances({ balances = {}, masterChefAddress, const nitroPoolAddresses = (await sdk.api.abi.multiCall({ block, calls: nitroPoolAddressesCalls, abi: wCamelotSpNFTAbi.stakedNitroPool, chain, })).output .map(a => a.output) const nitroPoolUserLpBalanceCalls = nitroPoolAddresses - .filter((v) => v !== '0x0000000000000000000000000000000000000000') + .filter((v) => v !== ADDRESSES.null) .map((v, i) => ({ target: v, params: wCamelotSpNFT })); const nitroPoolUserLpBalance = (await sdk.api.abi.multiCall({ block, calls: nitroPoolUserLpBalanceCalls, abi: camelotNitroPoolAbi.userInfo, chain, })).output .map((v, i) => { diff --git a/projects/solace-finance/config.js b/projects/solace-finance/config.js index e37a4cad954..88929964148 100644 --- a/projects/solace-finance/config.js +++ b/projects/solace-finance/config.js @@ -36,7 +36,7 @@ module.exports = { solace: '0x501acE9c35E60f03A2af4d484f49F9B1EFde9f40', tokens: [ { - PoolToken: "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270", + PoolToken: ADDRESSES.polygon.WMATIC_2, TokenTicker: "WMATIC", }, { diff --git a/projects/stakewise/index.js b/projects/stakewise/index.js index bdf505188a4..280a693dacd 100644 --- a/projects/stakewise/index.js +++ b/projects/stakewise/index.js @@ -33,7 +33,7 @@ async function xdaiTvl(timestamp, ethBlock, { xdai: block }) { }) return { - "0x6810e776880c02933d47db1b9fc05908e5386b96": supply.output + [ADDRESSES.ethereum.GNO]: supply.output } } diff --git a/projects/sun/index.js b/projects/sun/index.js index 11c7987933a..916ed60c3b9 100644 --- a/projects/sun/index.js +++ b/projects/sun/index.js @@ -72,7 +72,7 @@ const ownerTokens = pools.map(({ pool, stablecoins }) => { }) const stakingContract = "TXbA1feyCqWAfAQgXvN1ChTg82HpBT8QPb" -const sun = "TSSMHYeV2uE9qYH95DqyoCuNCzEL1NvU3S" +const sun = ADDRESSES.tron.SUN const lpToken = 'TDQaYrhQynYV9aXTYj63nwLAafRffWSEj6' const oldLpStaking = "TGsymdggp98tLKZWGHcGX58TjTcaQr9s4x" diff --git a/projects/swivel/index.js b/projects/swivel/index.js index b925e62ef3f..f5729272dc0 100644 --- a/projects/swivel/index.js +++ b/projects/swivel/index.js @@ -21,7 +21,7 @@ module.exports = { ADDRESSES.ethereum.STETH, // Lido stETH ADDRESSES.ethereum.WSTETH, // Lido wstETH "0x5E8422345238F34275888049021821E8E08CAa1f", // frxETH - "0xac3E018457B222d93114458476f3E3416Abbe38F" // sfrxETH + ADDRESSES.ethereum.SFRETH // sfrxETH ] }) } diff --git a/projects/synapse/config.js b/projects/synapse/config.js index 5c1d1a4ffa9..f568024c5a9 100644 --- a/projects/synapse/config.js +++ b/projects/synapse/config.js @@ -140,7 +140,7 @@ module.exports = { address: '0x8f5bbb2bb8c2ee94639e55d5f41de9b4839c1280', tokens: [ '0xd8cA34fd379d9ca3C6Ee3b3905678320F5b45195', // gOHM - '0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270', // wMATIC + ADDRESSES.polygon.WMATIC_2, // wMATIC ] }, pools: [ diff --git a/projects/teddy/index.js b/projects/teddy/index.js index 5ee6503f973..3f93e997c0e 100644 --- a/projects/teddy/index.js +++ b/projects/teddy/index.js @@ -13,7 +13,7 @@ const stakingPool2Contract = "0x9717Ff7406Be065EA177bA9ab1bE704060Af8370"; const WAVAX_TSD_PGL = "0x67E395B6ACd948931eeE8F52C7c1Fe537E7f1a7a"; const NATIVE_ADDRESS = ADDRESSES.avax.WAVAX; -//const LUSD_TOKEN_ADDRESS = "0x5f98805a4e8be255a32880fdec7f6728c6568ba0"; +//const LUSD_TOKEN_ADDRESS = ADDRESSES.ethereum.LUSD; const TROVE_MANAGER_ADDRESS = "0xd22b04395705144Fd12AfFD854248427A2776194"; diff --git a/projects/thetanuts/index.js b/projects/thetanuts/index.js index 065d97c40d1..e5104acef5d 100644 --- a/projects/thetanuts/index.js +++ b/projects/thetanuts/index.js @@ -96,7 +96,7 @@ const wbnb = ADDRESSES.bsc.WBNB const woo = '0x4691937a7508860F876c9c0a2a617E7d9E945D4B' // Polygon Assets -const wmatic = '0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270' +const wmatic = ADDRESSES.polygon.WMATIC_2 const pousdc = ADDRESSES.polygon.USDC const ust_matic_wormhole = '0xE6469Ba6D2fD6130788E0eA9C0a0515900563b59' diff --git a/projects/tigris/index.js b/projects/tigris/index.js index e11bf12e1d0..3a3764af3c2 100644 --- a/projects/tigris/index.js +++ b/projects/tigris/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { staking } = require("../helper/staking"); const { sumTokens2 } = require("../helper/unwrapLPs"); @@ -7,7 +8,7 @@ const TigrisAddresses = { xTIG: "0x19694Cf64572e6adf643Ae7B13d5b2921215B4E5", // tigUSD and USDT are 1:1 exchangeable via stable vault tigUSD: "0x7E491F53bF807f836E2dd6C4A4FBd193e1913EFd", - USDT: "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9", + USDT: ADDRESSES.arbitrum.USDT, TigStaking: "0x6E8BFBb31A46D0F5502426050Ea28b19F8E761f4", TokenSale: "0x45F52502aF87e7e4E446BA15BDf223A19b47DA98", StableVault: "0xe82fcefbDD034500B5862B4827CAE5c117f6b921", @@ -20,7 +21,7 @@ const TigrisAddresses = { TigStaking: "0xC6c32eD781450228dFadfa49A430d7868B110F44", // tigUSD and DAI are 1:1 exchangeable via stable vault tigUSD: "0x76973Ba2AFF24F87fFE41FDBfD15308dEBB8f7E8", - DAI: "0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063", + DAI: ADDRESSES.polygon.DAI, StableVault: "0x3677415Dc23e49B7780ef46976F418F4a9d5031B", Treasury: "0x4f7046f36B5D5282A94cB448eAdB3cdf9Ff2b051", Lock: "0x638e39D4a927EfE3040F0f6D4d27e4CccD8c996A", diff --git a/projects/tokemak/index.js b/projects/tokemak/index.js index b65892842ef..27abde62188 100644 --- a/projects/tokemak/index.js +++ b/projects/tokemak/index.js @@ -45,7 +45,7 @@ const dai = ADDRESSES.ethereum.DAI; const feiPool = "0x03DccCd17CC36eE61f9004BCfD7a85F58B2D360D"; const fei = "0x956F47F50A910163D8BF957Cf5846D573E7f87CA"; const lusdPool = "0x9eEe9eE0CBD35014e12E1283d9388a40f69797A3"; -const lusd = "0x5f98805A4E8be255a32880FDeC7F6728C6568bA0"; +const lusd = ADDRESSES.ethereum.LUSD; const wormUstPool = "0x482258099De8De2d0bda84215864800EA7e6B03D"; const wormtust = "0xa693b19d2931d498c5b318df961919bb4aee87a5"; const foxPool = "0x808D3E6b23516967ceAE4f17a5F9038383ED5311"; diff --git a/projects/treasury/aave.js b/projects/treasury/aave.js index 1bb6fe0ab22..36884d3c3d0 100644 --- a/projects/treasury/aave.js +++ b/projects/treasury/aave.js @@ -81,7 +81,7 @@ module.exports = treasuryExports({ '0xd4937682df3C8aEF4FE912A96A74121C0829E664', // aFRAX ADDRESSES.ethereum.sUSD, '0x6C5024Cd4F8A59110119C56f8933403A539555EB', // aSUSD - '0x5f98805a4e8be255a32880fdec7f6728c6568ba0', // LUSD + ADDRESSES.ethereum.LUSD, // LUSD '0xce1871f791548600cb59efbefFC9c38719142079', // aLUSD '0x056fd409e1d7a124bd7017459dfea2f387b6d5cd', // GUSD '0xD37EE7e4f452C6638c96536e68090De8cBcdb583', // aGUSD @@ -149,7 +149,7 @@ module.exports = treasuryExports({ ADDRESSES.polygon.WETH_1, '0x28424507fefb6f7f8E9D3860F56504E4e5f5f390', // amWETH '0xe50fA9b3c56FfB159cB0FCA61F5c9D750e8128c8', // aPolWETH - '0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270', // WMATIC + ADDRESSES.polygon.WMATIC_2, // WMATIC '0x8dF3aad3a84da6b69A4DA8aeC3eA40d9091B2Ac4', // amWMATIC '0x6d80113e533a2C0fe82EaBD35f1875DcEA89Ea97', // aPolWMATIC '0x9a71012B13CA4d3D0Cdc72A177DF3ef03b0E76A3', // BAL @@ -174,7 +174,7 @@ module.exports = treasuryExports({ '0x38d693cE1dF5AaDF7bC62595A37D667aD57922e5', // aPolEURS '0xa3fa99a148fa48d14ed51d610c367c61876997f1', // MAI '0xeBe517846d0F36eCEd99C735cbF6131e1fEB775D', // aPolMAI - '0xfa68fb4628dff1028cfec22b4162fccd0d45efb6', // MATICX + ADDRESSES.polygon.MATICX, // MATICX '0x80cA0d8C38d2e2BcbaB66aA1648Bd1C7160500FE', // aPolMATICX '0x3a58a54c066fdc0f2d55fc9c89f0415c92ebf3c4', // stMATIC '0xEA1132120ddcDDA2F119e99Fa7A27a0d036F7Ac9', // aPolSTMATIC diff --git a/projects/treasury/alchemix.js b/projects/treasury/alchemix.js index 0332ea3d9bb..f8bfe2ca187 100644 --- a/projects/treasury/alchemix.js +++ b/projects/treasury/alchemix.js @@ -23,7 +23,7 @@ module.exports = treasuryExports({ ADDRESSES.ethereum.WETH,//WETH ADDRESSES.ethereum.USDT,//USDT "0xf16aEe6a71aF1A9Bc8F56975A4c2705ca7A782Bc", //20WETH-80ALC - "0x5f98805A4E8be255a32880FDeC7F6728C6568bA0", + ADDRESSES.ethereum.LUSD, ADDRESSES.ethereum.CRV, ADDRESSES.ethereum.YFI, "0xa258C4606Ca8206D8aA700cE2143D7db854D168c", diff --git a/projects/treasury/badger-dao.js b/projects/treasury/badger-dao.js index 24be6a83ec4..c1a00ee5dd7 100644 --- a/projects/treasury/badger-dao.js +++ b/projects/treasury/badger-dao.js @@ -36,7 +36,7 @@ module.exports = treasuryExports({ ADDRESSES.ethereum.DAI,//DAI ADDRESSES.ethereum.USDC,//USDC ADDRESSES.ethereum.USDT,//USDT - "0x5f98805A4E8be255a32880FDeC7F6728C6568bA0",//LUSD + ADDRESSES.ethereum.LUSD,//LUSD "0x9ff58f4fFB29fA2266Ab25e75e2A8b3503311656",//aWBTC ADDRESSES.ethereum.WETH,//WETH ADDRESSES.ethereum.RETH,//rETH diff --git a/projects/treasury/dxdao.js b/projects/treasury/dxdao.js index 29c4962a911..6466ec469c3 100644 --- a/projects/treasury/dxdao.js +++ b/projects/treasury/dxdao.js @@ -12,7 +12,7 @@ module.exports = treasuryExports({ ADDRESSES.ethereum.DAI,//dai '0xFe2e637202056d30016725477c5da089Ab0A043A',//seth2 ADDRESSES.ethereum.USDC,//usdc - '0x5f98805A4E8be255a32880FDeC7F6728C6568bA0',//lusd + ADDRESSES.ethereum.LUSD,//lusd ADDRESSES.ethereum.STETH,//steth '0xC18360217D8F7Ab5e7c516566761Ea12Ce7F9D72',//ens ADDRESSES.ethereum.RETH,//reth diff --git a/projects/treasury/equilibre.js b/projects/treasury/equilibre.js index 86e6c21662b..0cf0ff2f1a8 100644 --- a/projects/treasury/equilibre.js +++ b/projects/treasury/equilibre.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { treasuryExports, nullAddress } = require("../helper/treasury"); const VARA = '0xE1da44C0dA55B075aE8E2e4b6986AdC76Ac77d73' @@ -24,22 +25,22 @@ const equilibre = [ const tokens = [ nullAddress, //"0xE1da44C0dA55B075aE8E2e4b6986AdC76Ac77d73", // VARA - "0xfA9343C3897324496A05fC75abeD6bAC29f8A40f", // USDC - "0xc86c7C0eFbd6A49B35E8714C5f59D99De09A225b", // WKAVA - "0x765277EebeCA2e31912C9946eAe1021199B39C61", // DAI - "0xE3F5a90F9cb311505cd691a46596599aA1A0AD7D", // ETH - "0x818ec0A7Fe18Ff94269904fCED6AE3DaE6d6dC0b", // WBTC + ADDRESSES.telos.ETH, // USDC + ADDRESSES.kava.WKAVA, // WKAVA + ADDRESSES.shiden.ETH, // DAI + ADDRESSES.moonriver.USDC, // ETH + ADDRESSES.telos.USDC, // WBTC "0xC19281F22A075E0F10351cd5D6Ea9f0AC63d4327", // BIFI "0x6c2c113c8cA73dB67224EF4D8C8dFCeC61e52a9C", // LQDR "0xb84Df10966a5D7e1ab46D9276F55d57bD336AFC7", // MAI - "0xDb0E1e86B01c4ad25241b1843E407Efc4D615248", // USX + ADDRESSES.kava.USX, // USX "0x739ca6D71365a08f584c8FC4e1029045Fa8ABC4B", // ACS "0xd86C8d4279CCaFbec840c782BcC50D201f277419", // MARE "0x165DBb08de0476271714952C3C1F068693bd60D7", // TAROT "0x74ccbe53f77b08632ce0cb91d3a545bf6b8e0979", // fBOMB "0x9d9682577CA889c882412056669bd936894663fd", // swKAVA "0xABd380327Fe66724FFDa91A87c772FB8D00bE488", // BNB - "0xEB466342C4d449BC9f53A865D5Cb90586f405215", // axlUSDC + ADDRESSES.kava.axlUSDC, // axlUSDC "0xE1E9dB9b4d51A8878f030094F7965edC5eEC7802", // xSHRAP "0x7ae97042a4a0eb4d1eb370c34bfec71042a056b7", // SLM "0x06beE9E7238a331B68D83Df3B5B9B16d5DBa83ff", // axlATOM @@ -56,7 +57,7 @@ const tokens = [ "0x38481Fdc1aF61E6E72E0Ff46F069315A59779C65", // BEAR "0x13db70Ad2f2b7064EbD5B0CAA13Af445a77360f7", // KONK "0xFa4384b298084A0ef13F378853DEDbB33A857B31", // cpVARA - "0xB44a9B6905aF7c801311e8F4E76932ee959c663C", // USDT + ADDRESSES.moonriver.USDT, // USDT "0xde5ed76e7c05ec5e4572cfc88d1acea165109e44", // DEUS "0xD22a58f79e9481D1a88e00c343885A588b34b68B", // DEXI "0xde1e704dae0b4051e80dabb26ab6ad6c12262da0", // DEI diff --git a/projects/treasury/gnosis-dao.js b/projects/treasury/gnosis-dao.js index 6c711c2384a..ff006686465 100644 --- a/projects/treasury/gnosis-dao.js +++ b/projects/treasury/gnosis-dao.js @@ -7,7 +7,7 @@ const treasury = "0x4971DD016127F390a3EF6b956Ff944d0E2e1e462"; const treasury1 = "0x0DA0C3e52C977Ed3cBc641fF02DD271c3ED55aFe"; const treasury2 = "0x849D52316331967b6fF1198e5E32A0eB168D039d"; const treasury3 = "0xBc79855178842FDBA0c353494895DEEf509E26bB"; -const GNO = "0x6810e776880C02933D47DB1b9fc05908e5386b96"; +const GNO = ADDRESSES.ethereum.GNO; async function tvl(_, _b, _cb, { api, }) { const treasury = '0x849d52316331967b6ff1198e5e32a0eb168d039d' @@ -41,7 +41,7 @@ module.exports = treasuryExports({ tokens: [ nullAddress, ADDRESSES.ethereum.USDC, - '0x6b175474e89094c44da98b954eedeac495271d0f',//DAI + ADDRESSES.ethereum.DAI,//DAI '0x5d3a536E4D6DbD6114cc1Ead35777bAB948E3643',//cDAI '0x39AA39c021dfbaE8faC545936693aC917d5E7563',//cUSDC '0xc944E90C64B2c07662A292be6244BDf05Cda44a7',//GRT diff --git a/projects/treasury/idle-dao.js b/projects/treasury/idle-dao.js index def0abe2d99..8c059d3c662 100644 --- a/projects/treasury/idle-dao.js +++ b/projects/treasury/idle-dao.js @@ -44,7 +44,7 @@ module.exports = treasuryExports({ nullAddress, "0xf28164A485B0B2C90639E47b0f377b4a438a16B1",//dquick ADDRESSES.polygon.DAI, - "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270",//wmatic + ADDRESSES.polygon.WMATIC_2,//wmatic ADDRESSES.polygon.WETH_1, ADDRESSES.polygon.USDC, "0x580A84C73811E1839F75d86d75d88cCa0c241fF4",//QI diff --git a/projects/treasury/index-coop.js b/projects/treasury/index-coop.js index add2c0924a3..509a9612606 100644 --- a/projects/treasury/index-coop.js +++ b/projects/treasury/index-coop.js @@ -20,7 +20,7 @@ module.exports = treasuryExports({ '0x056Fd409E1d7A124BD7017459dFEa2F387b6d5Cd', '0xAa6E8127831c9DE45ae56bB1b0d4D4Da6e5665BD', '0x39AA39c021dfbaE8faC545936693aC917d5E7563', - '0x5f98805A4E8be255a32880FDeC7F6728C6568bA0', + ADDRESSES.ethereum.LUSD, ADDRESSES.ethereum.USDT, '0x5d3a536E4D6DbD6114cc1Ead35777bAB948E3643' ], diff --git a/projects/treasury/india-covid-relief-fund.js b/projects/treasury/india-covid-relief-fund.js index b58138f4142..f75c213016c 100644 --- a/projects/treasury/india-covid-relief-fund.js +++ b/projects/treasury/india-covid-relief-fund.js @@ -15,7 +15,7 @@ module.exports = treasuryExports({ ADDRESSES.ethereum.USDT,//usdt ADDRESSES.ethereum.MATIC,//matic ADDRESSES.ethereum.MKR,//mkr - '0x6810e776880C02933D47DB1b9fc05908e5386b96',//gno + ADDRESSES.ethereum.GNO,//gno ADDRESSES.ethereum.DAI,//dai ], owners: [Treasury], diff --git a/projects/treasury/iq.js b/projects/treasury/iq.js index b619f76fdb5..227813ec674 100644 --- a/projects/treasury/iq.js +++ b/projects/treasury/iq.js @@ -8,7 +8,7 @@ module.exports = treasuryExports({ ethereum: { tokens: [ nullAddress, - "0xac3E018457B222d93114458476f3E3416Abbe38F", + ADDRESSES.ethereum.SFRETH, "0x853d955aCEf822Db058eb8505911ED77F175b99e", "0x9D45081706102E7aadDD0973268457527722E274", ADDRESSES.ethereum.WETH, diff --git a/projects/treasury/jade-protocol.js b/projects/treasury/jade-protocol.js index 2059b5be2f8..02568fe90e2 100644 --- a/projects/treasury/jade-protocol.js +++ b/projects/treasury/jade-protocol.js @@ -18,7 +18,7 @@ module.exports = treasuryExports({ nullAddress, ADDRESSES.ethereum.USDC,//USDC ADDRESSES.ethereum.WBTC, // wbtc - '0xac3E018457B222d93114458476f3E3416Abbe38F', // sfrxETH + ADDRESSES.ethereum.SFRETH, // sfrxETH '0x3432B6A60D23Ca0dFCa7761B7ab56459D9C964D0', // FXS ], owners: [treasury, treasury1], diff --git a/projects/treasury/liquity-treasury.js b/projects/treasury/liquity-treasury.js index 3aac71c87ff..65531105d98 100644 --- a/projects/treasury/liquity-treasury.js +++ b/projects/treasury/liquity-treasury.js @@ -19,7 +19,7 @@ module.exports = treasuryExports({ tokens: [ nullAddress, ADDRESSES.ethereum.DAI,//DAI - '0x5f98805A4E8be255a32880FDeC7F6728C6568bA0',//LUSD + ADDRESSES.ethereum.LUSD,//LUSD ADDRESSES.ethereum.USDC,//usdc '0xc944E90C64B2c07662A292be6244BDf05Cda44a7',//grt '0x41545f8b9472D758bB669ed8EaEEEcD7a9C4Ec29',//fort diff --git a/projects/treasury/perion.js b/projects/treasury/perion.js index fcdda6ac483..0096978069c 100644 --- a/projects/treasury/perion.js +++ b/projects/treasury/perion.js @@ -15,7 +15,7 @@ module.exports = treasuryExports({ '0x549020a9Cb845220D66d3E9c6D9F9eF61C981102', // SIDIUS '0x34Be5b8C30eE4fDe069DC878989686aBE9884470', //SENATE ADDRESSES.ethereum.USDT, //USDT - '0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84', //stETH + ADDRESSES.ethereum.STETH, //stETH ], owners: treasuryContractsETH, ownTokens: [PERC], diff --git a/projects/treasury/piedao.js b/projects/treasury/piedao.js index ceb910b8b9f..89e21dd7039 100644 --- a/projects/treasury/piedao.js +++ b/projects/treasury/piedao.js @@ -25,7 +25,7 @@ module.exports = treasuryExports({ '0xa693B19d2931d498c5B318dF961919BB4aee87a5',//UST '0xE80C0cd204D654CEbe8dd64A4857cAb6Be8345a3',//JPEG '0xa3BeD4E1c75D00fa6f4E5E6922DB7261B5E9AcD2',//MTA - '0x6810e776880C02933D47DB1b9fc05908e5386b96',//GNO + ADDRESSES.ethereum.GNO,//GNO '0x01BA67AAC7f75f647D94220Cc98FB30FCc5105Bf',//LYRA '0x03ab458634910AaD20eF5f1C8ee96F1D6ac54919',//RAI '0x3472A5A71965499acd81997a54BBA8D852C6E53d',//BADGER diff --git a/projects/treasury/pleasrdao.js b/projects/treasury/pleasrdao.js index 189f40e8728..7278d0f805b 100644 --- a/projects/treasury/pleasrdao.js +++ b/projects/treasury/pleasrdao.js @@ -14,11 +14,11 @@ module.exports = treasuryExports({ '0xbA6B0dbb2bA8dAA8F5D6817946393Aef8D3A4487',//HSF '0xBf9e72eEb5adB8B558334c8672950B7a379D4266',//CUBT "0xBAac2B4491727D78D2b78815144570b9f2Fe8899", - "0xdAC17F958D2ee523a2206206994597C13D831ec7", + ADDRESSES.ethereum.USDT, "0xc96F20099d96b37D7Ede66fF9E4DE59b9B1065b1", "0x4CD0c43B0D53bc318cc5342b77EB6f124E47f526", "0x1A4b46696b2bB4794Eb3D4c26f1c55F9170fa4C5", - "0x6B175474E89094C44Da98b954EedeAC495271d0F" + ADDRESSES.ethereum.DAI ], owners: [pleasrDaoTreasury, treasury, lp], resolveLP: true, diff --git a/projects/treasury/railgun.js b/projects/treasury/railgun.js index e4273e2089c..e3bb995e496 100644 --- a/projects/treasury/railgun.js +++ b/projects/treasury/railgun.js @@ -29,7 +29,7 @@ module.exports = treasuryExports({ ADDRESSES.ethereum.cvxCRV, "0x3432B6A60D23Ca0dFCa7761B7ab56459D9C964D0",//wbtc "0x99D8a9C45b2ecA8864373A26D1459e3Dff1e17F3",//mim - "0x5f98805A4E8be255a32880FDeC7F6728C6568bA0",//lusd + ADDRESSES.ethereum.LUSD,//lusd "0x090185f2135308BaD17527004364eBcC2D37e5F6",//spell ADDRESSES.ethereum.BUSD, "0x00a8b738E453fFd858a7edf03bcCfe20412f0Eb0",//albt @@ -96,7 +96,7 @@ module.exports = treasuryExports({ "0x2C89bbc92BD86F8075d1DEcc58C7F4E0107f286b",//avax "0x53E0bca35eC356BD5ddDFebbD1Fc0fD03FaBad39",//link "0xfe712251173A2cd5F5bE2B46Bb528328EA3565E1",//mvi - "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270",//wmatic + ADDRESSES.polygon.WMATIC_2,//wmatic "0x752d59604d72b6DC44196f4A39A3f07779417407",//methmoon "0x8f006D1e1D9dC6C98996F50a4c810F17a47fBF19",//nsfw ADDRESSES.fantom.renBTC, diff --git a/projects/treasury/redacted.js b/projects/treasury/redacted.js index 709976e9b11..1e37dbb1583 100644 --- a/projects/treasury/redacted.js +++ b/projects/treasury/redacted.js @@ -21,7 +21,7 @@ module.exports = treasuryExports({ ADDRESSES.ethereum.DAI, "0xaCe78D9BaB82b6B4783120Dba82aa10B040A14D9", "0xBCe0Cf87F513102F22232436CCa2ca49e815C3aC", - "0xd533a949740bb3306d119cc777fa900ba034cd52", + ADDRESSES.ethereum.CRV, ], ownTokens: [BTRF], owners: [treasury, treasury2,treasury3,treasury4], diff --git a/projects/treasury/shapeshift.js b/projects/treasury/shapeshift.js index b5f5c0b3f1f..2ae2fc6b4e0 100644 --- a/projects/treasury/shapeshift.js +++ b/projects/treasury/shapeshift.js @@ -14,7 +14,7 @@ module.exports = treasuryExports({ nullAddress, ADDRESSES.ethereum.USDC,//USDC ADDRESSES.ethereum.DAI,//DAI - '0x5f98805A4E8be255a32880FDeC7F6728C6568bA0',//LUSD + ADDRESSES.ethereum.LUSD,//LUSD ADDRESSES.ethereum.WETH,//WETH ADDRESSES.ethereum.USDT,//USDT '0x6f80310CA7F2C654691D1383149Fa1A57d8AB1f8',//SILO diff --git a/projects/treasury/silo-finance.js b/projects/treasury/silo-finance.js index bb7e4a8b55a..61f3cabaa3f 100644 --- a/projects/treasury/silo-finance.js +++ b/projects/treasury/silo-finance.js @@ -14,7 +14,7 @@ module.exports = treasuryExports({ nullAddress, ADDRESSES.ethereum.USDC,//USDC ADDRESSES.ethereum.DAI,//DAI - '0x5f98805A4E8be255a32880FDeC7F6728C6568bA0',//LUSD + ADDRESSES.ethereum.LUSD,//LUSD ADDRESSES.ethereum.WETH,//WETH ADDRESSES.ethereum.USDT,//USDT ADDRESSES.ethereum.TOKE,//TOKE diff --git a/projects/treasury/sphere-finance.js b/projects/treasury/sphere-finance.js index 2512f548781..90f11a4e5f6 100644 --- a/projects/treasury/sphere-finance.js +++ b/projects/treasury/sphere-finance.js @@ -14,9 +14,9 @@ module.exports = treasuryExports({ polygon: { tokens: [ nullAddress, - "0x0000000000000000000000000000000000001010", + ADDRESSES.polygon.WMATIC_1, "0x236eeC6359fb44CCe8f97E99387aa7F8cd5cdE1f", - "0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619", + ADDRESSES.polygon.WETH_1, ADDRESSES.polygon.WMATIC, ADDRESSES.polygon.USDC @@ -29,7 +29,7 @@ module.exports = treasuryExports({ nullAddress, "0xe80772Eaf6e2E18B651F160Bc9158b2A5caFCA65", "0x52F24a5e03aee338Da5fd9Df68D2b6FAe1178827", - "0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56", + ADDRESSES.bsc.BUSD, "0xF4C8E32EaDEC4BFe97E0F595AdD0f4450a863a11" ], owners: [treasuryBSC], diff --git a/projects/treasury/synapse.js b/projects/treasury/synapse.js index 5efc3a96701..e0be92c3991 100644 --- a/projects/treasury/synapse.js +++ b/projects/treasury/synapse.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { nullAddress, treasuryExports } = require("../helper/treasury"); const arbtreasury = "0x1d9bfc24d9e7eeda4119ceca11eaf4c24e622e62"; @@ -20,7 +21,7 @@ const MainnetTreasury = "0x67F60b0891EBD842Ebe55E4CCcA1098d7Aac1A55" const mainnetSYN = "0x0f2D719407FdBeFF09D87557AbB7232601FD9F29" const mainnetsynethLP = "0x4A86C01d67965f8cB3d0AAA2c655705E64097C31" const MetisTreasury = "0xEAEC50eBe1c2A981ED8be02C36b0863Fae322975" -const metisSYN = "0x67C10C397dD0Ba417329543c1a40eb48AAa7cd00" +const metisSYN = ADDRESSES.metis.SYN //const MoonbeamTreasury = "0xbb227Fcf45F9Dc5deF87208C534EAB1006d8Cc8d" //const MoonriverTreasury = "0x4bA30618fDcb184eC01a9B3CAe258CFc5786E70E" const OptimismTreasury = "0x2431CBdc0792F5485c4cb0a9bEf06C4f21541D52" @@ -32,11 +33,11 @@ module.exports = treasuryExports({ tokens: [ nullAddress, //"0x080F6AEd32Fc474DD5717105Dba5ea57268F46eb",//syn - "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",//weth - "0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1",//dai - "0x2913E812Cf0dcCA30FB28E6Cac3d2DCFF4497688",//nusd - "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9",//tether - "0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8",//usdc + ADDRESSES.arbitrum.WETH,//weth + ADDRESSES.optimism.DAI,//dai + ADDRESSES.arbitrum.nUSD,//nusd + ADDRESSES.arbitrum.USDT,//tether + ADDRESSES.arbitrum.USDC,//usdc ], owners: [arbtreasury, arbtreasury2], ownTokens: [arbSYN] @@ -45,10 +46,10 @@ module.exports = treasuryExports({ tokens: [ nullAddress, //"0x1f1E7c893855525b303f99bDF5c3c05Be09ca251",//syn - "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7",//wavax - "0xd586E7F844cEa2F87f50152665BCbc2C279D8d70",//dai - "0xA7D7079b0FEaD91F3e65f86E8915Cb59c1a4C664",//usdc - "0xc7198437980c041c805A1EDcbA50c1Ce5db95118",//tether + ADDRESSES.avax.WAVAX,//wavax + ADDRESSES.avax.DAI,//dai + ADDRESSES.avax.USDC_e,//usdc + ADDRESSES.avax.USDT_e,//tether ], owners: [avaxTreasury], @@ -57,13 +58,13 @@ module.exports = treasuryExports({ bsc: { tokens: [ nullAddress, - "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d",//usdc - "0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56",//busd - "0x049d68029688eAbF473097a2fC38ef61633A3C7A",//fusdt - "0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c",//btcb + ADDRESSES.bsc.USDC,//usdc + ADDRESSES.bsc.BUSD,//busd + ADDRESSES.fantom.fUSDT,//fusdt + ADDRESSES.bsc.BTCB,//btcb "0x54261774905f3e6E9718f2ABb10ed6555cae308a",//anybtc "0x42F6f551ae042cBe50C739158b4f0CAC0Edb9096",//nrv - "0x55d398326f99059fF775485246999027B3197955",//bsc-usd + ADDRESSES.bsc.USDT,//bsc-usd "0x23396cF899Ca06c4472205fC903bDB4de249D6fC",//ustc ], owners: [bscTreasury] @@ -73,8 +74,8 @@ module.exports = treasuryExports({ nullAddress, //"0xE55e19Fb4F2D85af758950957714292DAC1e25B2",//syn "0x74b23882a30290451A17c44f4F05243b6b58C76d",//eth - "0x04068DA6C83AFCFA0e13ba15A6696662335D5B75",//usdc - "0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83",//wftm + ADDRESSES.fantom.USDC,//usdc + ADDRESSES.fantom.WFTM,//wftm ], owners: [FantomTreasury], ownTokens: [fantomSYN] @@ -89,22 +90,22 @@ module.exports = treasuryExports({ tokens: [ nullAddress, //"0x0f2D719407FdBeFF09D87557AbB7232601FD9F29",//syn - "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",//usdc + ADDRESSES.ethereum.USDC,//usdc "0x0ab87046fBb341D058F17CBC4c1133F25a20a52f",//gohm "0x853d955aCEf822Db058eb8505911ED77F175b99e",//frax - "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",//weth - "0x6B175474E89094C44Da98b954EedeAC495271d0F",//dai - "0xdAC17F958D2ee523a2206206994597C13D831ec7",//tether + ADDRESSES.ethereum.WETH,//weth + ADDRESSES.ethereum.DAI,//dai + ADDRESSES.ethereum.USDT,//tether "0x98585dFc8d9e7D48F0b1aE47ce33332CF4237D96",//newo "0x71Ab77b7dbB4fa7e017BC15090b2163221420282",//high - "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599",//wbtc + ADDRESSES.ethereum.WBTC,//wbtc "0x73968b9a57c6E53d41345FD57a6E6ae27d6CDB2F",//sdt "0xBAac2B4491727D78D2b78815144570b9f2Fe8899",//dog "0x02B5453D92B730F29a86A0D5ef6e930c4Cf8860B",//usdb "0x1a7e4e63778B4f12a199C062f3eFdD288afCBce8",//ageur "0x0642026E7f0B6cCaC5925b4E7Fa61384250e1701",//h2o "0xb753428af26E81097e7fD17f40c88aaA3E04902c",//sfi - "0x514910771AF9Ca656af840dff83E8264EcF986CA",//link + ADDRESSES.ethereum.LINK,//link ], owners: [MainnetTreasury], ownTokens: [mainnetSYN, mainnetsynethLP] @@ -112,9 +113,9 @@ module.exports = treasuryExports({ metis: { tokens: [ nullAddress, - //"0x67C10C397dD0Ba417329543c1a40eb48AAa7cd00",//syn + //ADDRESSES.metis.SYN,//syn "0xFB21B70922B9f6e3C6274BcD6CB1aa8A0fe20B80",//gohm - "0xEA32A96608495e54156Ae48931A7c20f0dcc1a21",//usdc + ADDRESSES.metis.m_USDC,//usdc ], owners: [MetisTreasury], ownTokens: [metisSYN] @@ -122,7 +123,7 @@ module.exports = treasuryExports({ optimism: { tokens: [ nullAddress, - "0x4200000000000000000000000000000000000042",//op + ADDRESSES.optimism.OP,//op "0x809DC529f07651bD43A172e8dB6f4a7a0d771036",//neth ], owners: [OptimismTreasury] @@ -130,10 +131,10 @@ module.exports = treasuryExports({ polygon: { tokens: [ nullAddress, - "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174",//usdc - "0xc2132D05D31c914a87C6611C10748AEb04B58e8F",//usdt - "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270",//wmatic - "0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063",//dai + ADDRESSES.polygon.USDC,//usdc + ADDRESSES.polygon.USDT,//usdt + ADDRESSES.polygon.WMATIC_2,//wmatic + ADDRESSES.polygon.DAI,//dai "0xd8cA34fd379d9ca3C6Ee3b3905678320F5b45195",//gohm //"0xf8F9efC0db77d8881500bb06FF5D6ABc3070E695",//syn ], diff --git a/projects/treasury/tranchess.js b/projects/treasury/tranchess.js index 27319621d40..cd1614fa5ce 100644 --- a/projects/treasury/tranchess.js +++ b/projects/treasury/tranchess.js @@ -26,7 +26,7 @@ module.exports = treasuryExports({ bsc: { tokens: [ nullAddress, - "0x2170Ed0880ac9A755fd29B2688956BD959F933F8", + ADDRESSES.bsc.ETH, ADDRESSES.bsc.USDC, ADDRESSES.bsc.BUSD, ADDRESSES.bsc.BTCB diff --git a/projects/treasury/wonderland.js b/projects/treasury/wonderland.js index c12b0e3f5af..3ddeda97ea0 100644 --- a/projects/treasury/wonderland.js +++ b/projects/treasury/wonderland.js @@ -111,7 +111,7 @@ async function uwuPositions(_, _b, _cb, { api, }) { { target: '0xaac1d67f1c17ec01593d76e831c51a4f458dc160', params: ethWallet }, ] }) - api.add('0x5f98805A4E8be255a32880FDeC7F6728C6568bA0', LUSDBal) + api.add(ADDRESSES.ethereum.LUSD, LUSDBal) api.add('0x3E04863DBa602713Bb5d0edbf7DB7C3A9A2B6027', uwuLPLocked.total) api.add('0xb95bd0793bcc5524af358ffaae3e38c3903c7626', +uDAI - vdDAI) api.add('0x24959f75d7bda1884f1ec9861f644821ce233c7d', +uUSDT - vdUSDT) diff --git a/projects/vesync/index.js b/projects/vesync/index.js index 1ee7507cc49..27e269878ad 100644 --- a/projects/vesync/index.js +++ b/projects/vesync/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { getUniTVL } = require('../helper/unknownTokens'); const GET_AMOUNT_OUT = "function getAmountOut(uint amountIn, address tokenIn, address tokenOut) external view returns (uint amount, bool stable)"; @@ -5,7 +6,7 @@ const GET_AMOUNT_OUT = "function getAmountOut(uint amountIn, address tokenIn, ad const VOTING_ESCROW = "0x1925AB9F9bcdB9E2D2861cc7C4c157645126D9d9"; const VS = "0x5756A28E2aAe01F600FC2C01358395F5C1f8ad3A"; const ROUTER = "0x6C31035D62541ceba2Ac587ea09891d1645D6D07"; -const USDC = "0x3355df6D4c9C3035724Fd0e3914dE96A5a83aaf4"; +const USDC = ADDRESSES.era.USDC; module.exports = { misrepresentedTokens: true, diff --git a/projects/wasabix/index.js b/projects/wasabix/index.js index 6245ab66c2e..0d8ec1e772a 100644 --- a/projects/wasabix/index.js +++ b/projects/wasabix/index.js @@ -26,7 +26,7 @@ const tokens = { }, lusd: { token:'LUSD', - address:'0x5f98805a4e8be255a32880fdec7f6728c6568ba0', + address:ADDRESSES.ethereum.LUSD, decimals:18, correspondingMintableToken: 'waLUSD' }, diff --git a/projects/wonderland/index.js b/projects/wonderland/index.js index 34c6a5dffdf..f988c0317cc 100644 --- a/projects/wonderland/index.js +++ b/projects/wonderland/index.js @@ -55,7 +55,7 @@ async function ethTvl(timestamp, ethBlock, chainBlocks) { ["0x66761Fa41377003622aEE3c7675Fc7b5c1C2FaC5", false], // CPOOL ["0xdBdb4d16EdA451D0503b854CF79D55697F90c8DF", false], // ALCX ["0xdB25f211AB05b1c97D595516F45794528a807ad8", false], // EURS - ["0x6810e776880C02933D47DB1b9fc05908e5386b96", false], // GNO + [ADDRESSES.ethereum.GNO, false], // GNO ["0x41D5D79431A913C4aE7d69a668ecdfE5fF9DFB68", false], // INV ["0xE80C0cd204D654CEbe8dd64A4857cAb6Be8345a3", false], // JPEG ["0x0C10bF8FcB7Bf5412187A595ab97a3609160b5c6", false], // USDD diff --git a/projects/woofi.js b/projects/woofi.js index d6804ef6ea6..70a871385a8 100644 --- a/projects/woofi.js +++ b/projects/woofi.js @@ -25,7 +25,7 @@ const wooPPConfig = { ADDRESSES.avax.USDC, // USDC ], polygon: [ - '0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270', // WMATIC + ADDRESSES.polygon.WMATIC_2, // WMATIC ADDRESSES.polygon.WETH_1, // WETH ADDRESSES.polygon.WBTC, // WBTC '0x1B815d120B3eF02039Ee11dC2d33DE7aA4a8C603', // WOO diff --git a/projects/xdollar-finance/index.js b/projects/xdollar-finance/index.js index e5aba723fb4..ed756af0d47 100644 --- a/projects/xdollar-finance/index.js +++ b/projects/xdollar-finance/index.js @@ -129,7 +129,7 @@ module.exports = { staking: staking('0xc3fbc4056689cfab3f23809aa25004899ff4d75a','0x9eF758aC000a354479e538B8b2f01b917b8e89e7', 'arbitrum'), }, polygon: { - tvl: getLiquityTvl('0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270',"0x68738A47d40C34d890168aB7B612A6f649f395e4", "polygon"), + tvl: getLiquityTvl(ADDRESSES.polygon.WMATIC_2,"0x68738A47d40C34d890168aB7B612A6f649f395e4", "polygon"), staking: staking('0x3509f19581afedeff07c53592bc0ca84e4855475','0x3dc7b06dd0b1f08ef9acbbd2564f8605b4868eea', 'polygon'), }, avax: { diff --git a/projects/xy-finance/index.js b/projects/xy-finance/index.js index 2646ad4a381..82d35b1847f 100644 --- a/projects/xy-finance/index.js +++ b/projects/xy-finance/index.js @@ -231,7 +231,7 @@ const yPoolDepositContract = { }, "USDC": { "contractAddress": "0x3243278E0F93cD6F88FC918E0714baF7169AFaB8", - "tokenAddress": "0xE3F5a90F9cb311505cd691a46596599aA1A0AD7D" + "tokenAddress": ADDRESSES.moonriver.USDC } }, "324": { @@ -241,7 +241,7 @@ const yPoolDepositContract = { }, "USDC": { "contractAddress": "0x75167284361c8D61Be7E4402f4953e2b112233cb", - "tokenAddress": "0x3355df6D4c9C3035724Fd0e3914dE96A5a83aaf4" + "tokenAddress": ADDRESSES.era.USDC } }, "1101": { @@ -251,7 +251,7 @@ const yPoolDepositContract = { }, "USDC": { "contractAddress": "0x1acCfC3a45313f8F862BE7fbe9aB25f20A93d598", - "tokenAddress": "0xA8CE8aee21bC2A48a5EF670afCc9274C7bbbC035" + "tokenAddress": ADDRESSES.polygon_zkevm.USDC } }, } diff --git a/projects/zklend/index.js b/projects/zklend/index.js index 12b7f8e3540..2f62c986dcf 100644 --- a/projects/zklend/index.js +++ b/projects/zklend/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { BigNumber } = require("bignumber.js"); const { multiCall, sumTokens } = require('../helper/chain/starknet') const { marketAbi } = require('./abi'); @@ -11,11 +12,11 @@ const valueToBigNumber = (amount) => { const market = '0x4c0a5193d58f74fbace4b74dcf65481e734ed1714121bdc571da345540efa05' const assets = [ - '0x03fe2b97c1fd336e750087d68b9b867997fd64a2661ff3ca5a7c771641e8e7ac', - '0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7', - '0x053c91253bc9682c04929ca02ed00b3e423f6710d2ee7e0d5ebb06f3ecf368a8', - '0x00da114221cb83fa859dbdb4c44beeaa0bb37c7537ad5ae66fe5e0efd20e6eb3', - '0x068f5c6a61780768455de69077e07e89787839bf8166decfbf92b645209c0fb8' + ADDRESSES.starknet.WBTC, + ADDRESSES.starknet.ETH, + ADDRESSES.starknet.USDC, + ADDRESSES.starknet.DAI, + ADDRESSES.starknet.USDT ] async function tvl(_, _1, _2, { api }) { diff --git a/projects/zomma/index.js b/projects/zomma/index.js index d558009b58f..ee54fb7411d 100644 --- a/projects/zomma/index.js +++ b/projects/zomma/index.js @@ -1,8 +1,9 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokensExport } = require("../helper/sumTokens"); const ZOMMA_CONTRACT_old = "0x709051774c60c0527dbaf880f41425eae036efaf"; const ZOMMA_CONTRACT = "0x7bf1f1c2d8caa200b068747487cb9bf109e529f1"; -const USDC_CONTRACT = "0x3355df6D4c9C3035724Fd0e3914dE96A5a83aaf4"; +const USDC_CONTRACT = ADDRESSES.era.USDC; module.exports = { methodology: "TVL is calculated as the sum of USDC deposited by traders and the liquidity in the Pools.", From 7b1837336090cf3ae2a469151cce155217579b38 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 26 Jun 2023 10:27:20 +0200 Subject: [PATCH 0082/1974] merge hmx and perp88 --- projects/curve/historical/index.js | 8 ++++---- projects/hmx/index.js | 17 ----------------- projects/perp88/index.js | 15 ++++++++++++--- 3 files changed, 16 insertions(+), 24 deletions(-) delete mode 100644 projects/hmx/index.js diff --git a/projects/curve/historical/index.js b/projects/curve/historical/index.js index 97d37a198ca..9444150818d 100644 --- a/projects/curve/historical/index.js +++ b/projects/curve/historical/index.js @@ -199,7 +199,7 @@ async function tvl(timestamp, block) { }) ) - var tvl = (price_feed.data.coins['coingecko:bitcoin'].price * btcTVL) + tvl + tvl = (price_feed.data.coins['coingecko:bitcoin'].price * btcTVL) + tvl return toUSDTBalances(tvl); } @@ -225,7 +225,7 @@ async function calc(item, i, price_feed, block) { if (item.type == 'compound') { - var multiplier = 1; + let multiplier = 1; if (coins === '0x39AA39c021dfbaE8faC545936693aC917d5E7563') { multiplier = price_feed.data.coins['coingecko:compound-usd-coin'].price; } @@ -236,9 +236,9 @@ async function calc(item, i, price_feed, block) { } if (item.type == 'yToken') { - var multiplier = 1; + let multiplier = 1; if (coins !== '0x8E870D67F660D95d5be530380D0eC0bd388289E1') { // PAX exception - var multiplier = await getVirtualPrice(abis.abis.yTokens, coins, block) + multiplier = await getVirtualPrice(abis.abis.yTokens, coins, block) multiplier = await new BigNumber(multiplier).div(10 ** 18).toFixed(4); } poolAmount = poolAmount * multiplier; diff --git a/projects/hmx/index.js b/projects/hmx/index.js deleted file mode 100644 index 4e806763a1e..00000000000 --- a/projects/hmx/index.js +++ /dev/null @@ -1,17 +0,0 @@ -const { sumTokensExport } = require('../helper/unwrapLPs') -const ADDRESSES = require('../helper/coreAssets.json') - -module.exports = { - arbitrum: { - tvl: sumTokensExport({ - owner: '0x56CC5A9c0788e674f17F7555dC8D3e2F1C0313C0', - tokens: [ - ADDRESSES.arbitrum.USDC, - ADDRESSES.arbitrum.WETH, - ADDRESSES.arbitrum.WBTC, - ADDRESSES.arbitrum.USDT, - ADDRESSES.arbitrum.fsGLP, - ] - }) - } -} \ No newline at end of file diff --git a/projects/perp88/index.js b/projects/perp88/index.js index 65821a5fd2e..9eacb8aabd3 100644 --- a/projects/perp88/index.js +++ b/projects/perp88/index.js @@ -11,9 +11,6 @@ const tokens = { const POOL_DIAMOND_CONTRACT = '0xE7D96684A56e60ffBAAe0fC0683879da48daB383'; module.exports = { - timetravel: false, - misrepresentedTokens: false, - methodology: 'Count every tokens under PoolDiamond management.', start: 1668684025, polygon: { tvl: sumTokensExport({ @@ -21,5 +18,17 @@ module.exports = { tokens: Object.values(tokens), chain: 'polygon', }), + }, + arbitrum: { + tvl: sumTokensExport({ + owner: '0x56CC5A9c0788e674f17F7555dC8D3e2F1C0313C0', + tokens: [ + ADDRESSES.arbitrum.USDC, + ADDRESSES.arbitrum.WETH, + ADDRESSES.arbitrum.WBTC, + ADDRESSES.arbitrum.USDT, + ADDRESSES.arbitrum.fsGLP, + ] + }) } } From 0cf4c2e6b6ea85f5f14a818786131f96ce536ddf Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 26 Jun 2023 10:44:35 +0200 Subject: [PATCH 0083/1974] Apollo DAO: add osmosis tvl (#6608) --- projects/apollodao/index.js | 98 +++++++++++++++++++++++++++++++++++-- 1 file changed, 94 insertions(+), 4 deletions(-) diff --git a/projects/apollodao/index.js b/projects/apollodao/index.js index 49a7d2097a2..c24702e1e74 100644 --- a/projects/apollodao/index.js +++ b/projects/apollodao/index.js @@ -1,13 +1,103 @@ // vaults are closed: https://articles.apollo.farm/apollo-dao-will-be-closing-vaults-on-terra-classic/ +const axios = require("axios"); +const { endPoints, queryContract } = require('../helper/chain/cosmos') +const { transformBalances } = require('../helper/portedTokens') + +const chain = 'osmosis' + +const contractAddresses = { + atom_statom: "osmo1a6tcf60pyz8qq2n532dzcs7s7sj8klcmra04tvaqympzcvxqg9esn7xz7l", + atom_osmo: "osmo1g3kmqpp8608szfp0pdag3r6z85npph7wmccat8lgl3mp407kv73qlj7qwp", + usdc_osmo: "osmo1jfmwayj8jqp9tfy4v4eks5c2jpnqdumn8x8xvfllng0wfes770qqp7jl4j", + st_osmo_osmo: "osmo1p4zqs5y2w5srzd2vesznzu5ql8wfq9tpz3e7mf2j3y07nxrtkdes5r5g0t", + wbtc_osmo: "osmo185gqewrlde8vrqw7j8lpad67v8jfrx9u7770k9q87tqqecctp5tq50wt2c", + strd_osmo: "osmo1e3qjfcg9adrauz6jg030ptfy35r6zzplsgaavnn6xrh6686udhfqq7muwy", + evmos_osmo: "osmo1rkv6vcmty4rpypuxp2a6a0y5ze4ztm3y6d6xwy5a7cye85f7reqsm85c5s", + juno_osmo: "osmo1ceku0zks6y43r9l35n7wnv5pf82s6l4k5jhlrhkurakeemey9n4snz3x6z", + weth_osmo: "osmo1r235f4tdkwrsnj3mdm9hf647l754y6g6xsmz0nas5r4vr5tda3qsgtftef", + ist_osmo: "osmo1qajgwrcce9srkq370pa9ew96dyk4hajyyk6rfpuexrktm8862xnst443kp", + ion_osmo: "osmo1869zena97sctemj78sgjmu737p2g94905hsf3hhkrfgummrfz4tsxj2k6r", + cro_osmo: "osmo1gmd2vc4crmv7urlfn3j5avhplfncjf5mg649dkgsu5a0zvd6cgrsn9dq4l", + axl_osmo: "osmo1m9e4cks405tvzlppkw64znr35vkvujvptrdqtgu5q6luk4ccw9qqeuenwd", + dai_osmo: "osmo1lhs6kyuxytu4suua0qf88z5057wzpxs77tyrlgztw2uctcy75hcqf2ajrt", + akt_osmo: "osmo122ryl7pez7yjprtvjckltu2uvjxrq3kqt4nvclax2la7maj6757qg054ga", +}; + +async function tvl() { + let amounts = {} + if (chain != "osmosis") return transformBalances(chain, amounts) + for (const contractName in contractAddresses) { + let contractAddress = contractAddresses[contractName]; + let vaultInfo = await queryContract({ + contract: contractAddress, + chain: 'osmosis', + data: { 'info': {} } + }); + const gammToken = vaultInfo.base_token; + const poolID = gammToken.split('gamm/pool/')[1]; + let totalAssets = await queryContract({ + contract: contractAddress, + chain: 'osmosis', + data: { 'total_assets': {} } + }); + + let poolEndpoint = `${endPoints[chain]}/osmosis/gamm/v1beta1/pools/${poolID}`; + const poolData = (await axios.get(poolEndpoint)).data.pool; + + let amount = calculateTokenAmounts(poolData, totalAssets) + for (const denom in amount) { + if (typeof amounts[denom] === "undefined") { + amounts[denom] = amount[denom]; + } else { + amounts[denom] += amount[denom]; + } + } + } + return transformBalances(chain, amounts) +} + +function calculateTokenAmounts(poolData, gammAmount) { + // Extract the total pool shares. + let totalShares = poolData.total_shares.amount; + + // Initialize an object to hold the amounts of each token. + let tokenAmounts = {}; + + // For each token in the pool... + if (typeof poolData.pool_assets !== "undefined") { + for (let asset of poolData.pool_assets) { + // Extract the token's denom and amount. + let denom = asset.token.denom; + let assetAmount = asset.token.amount; + + // Calculate the amount of this token that corresponds to the given amount of pool shares. + tokenAmounts[denom] = (gammAmount * assetAmount) / totalShares; + } + } else { + for (let asset of poolData.pool_liquidity) { + // Extract the token's denom and amount. + let denom = asset.denom; + let assetAmount = asset.amount; + + // Calculate the amount of this token that corresponds to the given amount of pool shares. + tokenAmounts[denom] = (gammAmount * assetAmount) / totalShares; + } + } + + return tokenAmounts; +} module.exports = { timetravel: false, methodology: "Total TVL on vaults", terra: { - tvl: () => ({}) + tvl: () => 0 + }, + osmosis: { + tvl, }, -}, - module.exports.hallmarks = [ + hallmarks: [ [1651881600, "UST depeg"], [Math.floor(new Date('2022-09-13') / 1e3), 'Stop supporting Terra Classic'], - ] + ], +} From dd352204e1be4f7720531d6577d8eb20da48a85a Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 26 Jun 2023 11:23:24 +0200 Subject: [PATCH 0084/1974] bugfix --- projects/sapphiremine.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/sapphiremine.js b/projects/sapphiremine.js index b83739ccb73..81d620c4b01 100644 --- a/projects/sapphiremine.js +++ b/projects/sapphiremine.js @@ -1,4 +1,4 @@ -const ADDRESSES = require('helper/coreAssets.json') +const ADDRESSES = require('./helper/coreAssets.json') const sdk = require("@defillama/sdk"); const target = '0x7146854856E3f373675105556c7D964B329606be'; const WMATIC = ADDRESSES.polygon.WMATIC_2; From a26a26a2ea9a3ce955ccad252220756b5a79e7ab Mon Sep 17 00:00:00 2001 From: define Date: Mon, 26 Jun 2023 10:53:28 +0100 Subject: [PATCH 0085/1974] add new contract to vela exchange --- projects/vela-exchange/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/vela-exchange/index.js b/projects/vela-exchange/index.js index 1b58d46f33b..9b862c95278 100644 --- a/projects/vela-exchange/index.js +++ b/projects/vela-exchange/index.js @@ -4,7 +4,7 @@ const { staking } = require("../helper/staking") module.exports = { methodology: "Counts USDC deposited to trade and to mint VLP. Staking counts VELA deposited to earn eVELA", arbitrum: { - tvl: staking('0x5957582f020301a2f732ad17a69ab2d8b2741241', ADDRESSES.arbitrum.USDC), + tvl: staking('0xC4ABADE3a15064F9E3596943c699032748b13352', ADDRESSES.arbitrum.USDC), staking: staking('0xfC527781Ae973f8131dC26dDDb2Adb080c1C1F59', '0x088cd8f5eF3652623c22D48b1605DCfE860Cd704'), }, hallmarks: [ From 0c1914e5b26d2ba6b1fa3961cb37a372d21b916b Mon Sep 17 00:00:00 2001 From: Varun Krishna S Date: Mon, 26 Jun 2023 16:38:15 +0530 Subject: [PATCH 0086/1974] feat: add new timeswap option factory address for polygon (#6637) --- projects/timeswap-v2/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/timeswap-v2/index.js b/projects/timeswap-v2/index.js index 342ce064765..82d1ff0f476 100644 --- a/projects/timeswap-v2/index.js +++ b/projects/timeswap-v2/index.js @@ -66,6 +66,7 @@ const config = { polygon: { oldFactory: "0xcAB2E5Ba8b3A8d8Bf8B50F0eec12884D0255fB4A", factory: "0xcf0aca5c5b7e1bF63514D362243b6c50d5761FE8", + newFactory: "0x406d3Dfcbe20b642c2262b29b960822975371502", fromBlock: 39476334, }, ethereum: { From e5f9c7e49e655248c77fcf445ff83dceec452c6e Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 26 Jun 2023 17:15:04 +0530 Subject: [PATCH 0087/1974] Steer 2 (#6642) * feat: :zap: Include all deployed chains to Steer adapter Added: avax, bnb, metis, evmos, p_zkevm, celo, thundercore binance historical node failing * bugfix --------- Co-authored-by: Brandon --- projects/steer/index.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/projects/steer/index.js b/projects/steer/index.js index eb77119f491..968135991bb 100644 --- a/projects/steer/index.js +++ b/projects/steer/index.js @@ -3,6 +3,13 @@ const config = { polygon: { registry: '0x24825b3c44742600d3995d1d3760ccee999a7f0b', fromBlock: 41535540, }, arbitrum: { registry: '0x9f5b097AD23e2CF4F34e502A3E41D941678877Dc', fromBlock: 88698956, }, optimism: { registry: '0xC1Ecd10398A6D7036CceE1f50551ff169715081c', fromBlock: 96971465, }, + avax: { registry: '0x9f5b097AD23e2CF4F34e502A3E41D941678877Dc', fromBlock: 30434642, }, + bsc: { registry: '0x31e4ee367d4f2685BAfcAb9566e9C87E60D48983', fromBlock: 28461459, }, + evmos: { registry: '0xD90c8970708FfdFC403bdb56636621e3E9CCe921', fromBlock: 13671900, }, + metis: { registry: '0x116Dba5DcE9CcDA828218b7eB46406810632014C', fromBlock: 6067741, }, + polygon_zkevm: { registry: '0x9f5b097AD23e2CF4F34e502A3E41D941678877Dc', fromBlock: 1022413, }, + celo: { registry: '0x116Dba5DcE9CcDA828218b7eB46406810632014C', fromBlock: 19813127, }, + thundercore: { registry: '0xa1Dd21fbd9e1F0BF28d41F18bDC22326e50C02e9', fromBlock: 135181847, }, } module.exports = {}; @@ -30,6 +37,7 @@ Object.keys(config).forEach(chain => { api.add(token0, bal.total0) api.add(token1, bal.total1) }) + return api.getBalances() } } }) \ No newline at end of file From 0271e0ab28e3ceafac17f6d8635f15f7506ce3b8 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 26 Jun 2023 14:15:59 +0200 Subject: [PATCH 0088/1974] track voodoo.trade (#6634) --- README.md | 15 +++++++++------ projects/voodoo-trade/index.js | 13 +++++++++++++ pull_request_template.md | 4 ++-- 3 files changed, 24 insertions(+), 8 deletions(-) create mode 100644 projects/voodoo-trade/index.js diff --git a/README.md b/README.md index 2d04c27e878..a4b9dc7340b 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,15 @@ Follow [this guide](https://docs.llama.fi/submit-a-project) to create an adapter Also, don't hesitate to send a message on [our discord](https://discord.defillama.com/) if we're late to merge your PR. -> If you would like to add a `volume` adapter please submit the PR [here](https://github.com/DefiLlama/adapters). +> If you would like to add a `volume` adapter please submit the PR [here](https://github.com/DefiLlama/adapters) +> - If you would like to add a `liquidations` adapter, please refer to [this readme document](https://github.com/DefiLlama/DefiLlama-Adapters/tree/main/liquidations) for details. + +1. Once your adapter has been merged, it takes time to show on the UI. If more than 24 hours have passed, please let us know in Discord. +2. Please enable "Allow edits by maintainers" while putting up the PR. +3. Sorry, We no longer accept fetch adapter for new projects, we prefer the tvl to computed from blockchain data, if you have trouble with creating a the adapter, please hop onto our discord, we are happy to assist you. +4. **For updating listing info** It is a different repo, you can find your listing in this file: https://github.com/DefiLlama/defillama-server/blob/master/defi/src/protocols/data2.ts, you can edit it there and put up a PR +5. Do not edit/push `package-lock.json` file as part of your changes, we use lockfileVersion 2, and most use v1 and using that messes up our CI +6. No need to go to our discord and announce that you've created a PR, we monitor all PRs and will review it asap ## Getting listed @@ -27,11 +35,6 @@ If you want to change RPC providers because you need archive node access or beca ETHEREUM_RPC="..." BSC_RPC="..." POLYGON_RPC="..." -FANTOM_RPC="..." -ARBITRUM_RPC="..." -OPTIMISM_RPC="..." -XDAI_RPC="..." -HARMONY_RPC="..." ``` The name of each rpc is `{CHAIN-NAME}_RPC`, and the name we use for each chain can be found [here](https://github.com/DefiLlama/defillama-sdk/blob/master/src/providers.json) diff --git a/projects/voodoo-trade/index.js b/projects/voodoo-trade/index.js new file mode 100644 index 00000000000..241542fd87f --- /dev/null +++ b/projects/voodoo-trade/index.js @@ -0,0 +1,13 @@ +const { gmxExports } = require("../helper/gmx"); +const { pool2 } = require("../helper/pool2"); + +const vault = "0x40cbDDAED8b0d7Ee3cF347aAb09Bf4a8cFa15F01"; +const lpToken = "0xC42437A6da389D88799A9e706da3EA6628342295"; +const stakedLpTokenTracker = "0xBf47b011C36F29e7C65b6cf34c1d838EA1b67069"; + +module.exports = { + fantom: { + tvl: gmxExports({ vault }), + pool2: pool2(stakedLpTokenTracker, lpToken,), + }, +}; \ No newline at end of file diff --git a/pull_request_template.md b/pull_request_template.md index efc392486a3..4f4ead273d1 100644 --- a/pull_request_template.md +++ b/pull_request_template.md @@ -4,8 +4,8 @@ > - If you would like to add a `liquidations` adapter, please refer to [this readme document](https://github.com/DefiLlama/DefiLlama-Adapters/tree/main/liquidations) for details. 1. Once your adapter has been merged, it takes time to show on the UI. If more than 24 hours have passed, please let us know in Discord. -2. Sorry, We no longer accept fetch adapter for new projects, we prefer the tvl to computed from blockchain data, if you have trouble with creating a the adapter, please hop onto our discord, we are happy to assist you. -3. The protocol is usually listed within 24 hours of merging the PR +2. Please enable "Allow edits by maintainers" while putting up the PR. +3. Sorry, We no longer accept fetch adapter for new projects, we prefer the tvl to computed from blockchain data, if you have trouble with creating a the adapter, please hop onto our discord, we are happy to assist you. 4. Please fill the form below **only if the PR is for listing a new protocol** else it can be ignored/replaced with reason/details about the PR 5. **For updating listing info** It is a different repo, you can find your listing in this file: https://github.com/DefiLlama/defillama-server/blob/master/defi/src/protocols/data2.ts, you can edit it there and put up a PR 6. Do not edit/push `package-lock.json` file as part of your changes, we use lockfileVersion 2, and most use v1 and using that messes up our CI From 270980f3f51e123f5f639d95c5d3b72b0f2b9764 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 26 Jun 2023 14:44:02 +0200 Subject: [PATCH 0089/1974] add hats v2 --- projects/hats-v2/index.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 projects/hats-v2/index.js diff --git a/projects/hats-v2/index.js b/projects/hats-v2/index.js new file mode 100644 index 00000000000..cb1bce34465 --- /dev/null +++ b/projects/hats-v2/index.js @@ -0,0 +1,25 @@ +const { sumTokens2 } = require("../helper/unwrapLPs"); + +const config = { + ethereum: { masterchef: '0xc570c434ba30a2fa5c07e590833246e18aa6b0a3',}, + polygon: { masterchef: '0xa80d0a371f4d37afcc55188233bb4ad463af9e48',}, + bsc: { masterchef: '0xd978eb90eb1b11213e320f4e6e910eb98d8df1e4',}, + arbitrum: { masterchef: '0xa80d0a371f4d37afcc55188233bb4ad463af9e48',}, + optimism: { masterchef: '0xa80d0a371f4d37afcc55188233bb4ad463af9e48',}, +} + +Object.keys(config).forEach(chain => { + const { masterchef } = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const vaults = await api.fetchList({ lengthAbi: 'uint256:getNumberOfVaults', itemAbi: 'function hatVaults(uint256) view returns (address)', target: masterchef}) + const tokens = await api.multiCall({ abi: 'address:asset', calls: vaults}) + const tokensAndOwners = [] + tokens.forEach((token, i) => { + tokensAndOwners.push([token, vaults[i]]) + tokensAndOwners.push([token, masterchef]) + }) + return sumTokens2({ api, tokensAndOwners,}) + } + } +}) \ No newline at end of file From d9f26cc261de7625332d639c290d50396fe32c27 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 26 Jun 2023 19:00:54 +0200 Subject: [PATCH 0090/1974] track themis.exchange --- projects/themis-exchange/index.js | 34 +++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 projects/themis-exchange/index.js diff --git a/projects/themis-exchange/index.js b/projects/themis-exchange/index.js new file mode 100644 index 00000000000..af2385ae500 --- /dev/null +++ b/projects/themis-exchange/index.js @@ -0,0 +1,34 @@ +const { sumTokens2 } = require('../helper/unwrapLPs') + +const config = { + arbitrum: { addressProvider: '0x75F805e2fB248462e7817F0230B36E9Fae0280Fc', }, +} + +Object.keys(config).forEach(chain => { + const { addressProvider } = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const tokens = await api.call({ abi: abi.getReservesList, target: addressProvider }) + const tokenData = await api.multiCall({ abi: abi.getReserveData, target: addressProvider, calls: tokens, }) + return sumTokens2({ api, tokensAndOwners2: [tokens, tokenData.map(i => i.aTokenAddress)], }) + }, + borrowed: async (_, _b, _cb, { api, }) => { + const tokens = await api.call({ abi: abi.getReservesList, target: addressProvider }) + const tokenData = await api.multiCall({ abi: abi.getReserveData, target: addressProvider, calls: tokens, }) + const vDebtSupply = await api.multiCall({ abi: 'erc20:totalSupply', calls: tokenData.map(i => i.variableDebtTokenAddress), }) + const sDebtSupply = await api.multiCall({ abi: 'erc20:totalSupply', calls: tokenData.map(i => i.stableDebtTokenAddress), }) + tokens.forEach((token, i) => { + const variableDebt = vDebtSupply[i] + const stableDebt = sDebtSupply[i] + api.add(token, variableDebt) + api.add(token, stableDebt) + }) + return api.getBalances() + }, + } +}) + +const abi = { + "getReserveData": "function getReserveData(address asset) view returns (tuple(tuple(uint256 data) configuration, uint128 liquidityIndex, uint128 currentLiquidityRate, uint128 variableBorrowIndex, uint128 currentVariableBorrowRate, uint128 currentStableBorrowRate, uint40 lastUpdateTimestamp, uint16 id, address aTokenAddress, address stableDebtTokenAddress, address variableDebtTokenAddress, address interestRateStrategyAddress, uint128 accruedToTreasury, uint128 unbacked, uint128 isolationModeTotalDebt))", + "getReservesList": "address[]:getReservesList", +} \ No newline at end of file From d77b8a59336c4aa90e4ccfbed59bd0bd533287df Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Mon, 26 Jun 2023 18:08:02 +0100 Subject: [PATCH 0091/1974] add new rabbitx updatr --- projects/rabbitx/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/rabbitx/index.js b/projects/rabbitx/index.js index 88cf728584e..9f61b3fff86 100644 --- a/projects/rabbitx/index.js +++ b/projects/rabbitx/index.js @@ -3,6 +3,6 @@ const { sumTokensExport } = require("../helper/unwrapLPs"); module.exports = { ethereum: { - tvl: sumTokensExport({ owner: '0xFc7f884DE22a59c0009C91733196b012Aecb8F41', tokens: [ADDRESSES.ethereum.USDT]}) + tvl: sumTokensExport({ owners: ['0xFc7f884DE22a59c0009C91733196b012Aecb8F41', '0x3b8F6D6970a24A58b52374C539297ae02A3c4Ae4'], tokens: [ADDRESSES.ethereum.USDT]}) } -} \ No newline at end of file +} From 0ed8ec4c0a93a92dc2a2dc0bc5ee72de91454163 Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Mon, 26 Jun 2023 18:15:35 +0100 Subject: [PATCH 0092/1974] patch pendle --- projects/pendle/v2.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/pendle/v2.js b/projects/pendle/v2.js index e88a1c997ee..e8eb41eb24e 100644 --- a/projects/pendle/v2.js +++ b/projects/pendle/v2.js @@ -38,7 +38,7 @@ Object.keys(config).forEach(chain => { ]) data.forEach((v, i) => { let value = supply[i] * (10 ** (v.decimals - decimals[i])) - api.add(v.uAsset, value) + api.add(v.uAsset.toLowerCase(), value) }) let balances = api.getBalances(); const bridged = `arbitrum:${steth}`; From 0bcaee68fabe1cb649df021705175960c42adc4f Mon Sep 17 00:00:00 2001 From: saehrimnir Date: Mon, 26 Jun 2023 20:30:49 +0300 Subject: [PATCH 0093/1974] add polygon MATIC --- projects/pepe-bridge/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/pepe-bridge/index.js b/projects/pepe-bridge/index.js index afb92928364..b4440ebb1a9 100644 --- a/projects/pepe-bridge/index.js +++ b/projects/pepe-bridge/index.js @@ -24,6 +24,9 @@ const config = { ], '0x8DF12786EC0E34e60D4c52f9052ba4e536e9367a' ] + ], + polygon: [ + [[nullAddress], '0xEa3cc73165748AD1Ca76b4d1bA9ebC43fb399018'], ] } module.exports = {}; From d2648e41dc499237e499625b790f62efbba4abe7 Mon Sep 17 00:00:00 2001 From: Michael Silberling <4006780+MSilb7@users.noreply.github.com> Date: Mon, 26 Jun 2023 13:55:21 -0400 Subject: [PATCH 0094/1974] add velo v2 hallmark (#6643) --- projects/velodrome/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/velodrome/index.js b/projects/velodrome/index.js index ff8fe7e895a..fa388d3afb7 100644 --- a/projects/velodrome/index.js +++ b/projects/velodrome/index.js @@ -15,5 +15,6 @@ module.exports = { hallmarks:[ [1657760400, "First OP grant awarded"], [1659618000, "Loss $350k Operational Funds"], + [1687465883, "v2 Migration on OP Mainnet"], // https://twitter.com/VelodromeFi/status/1671979216039202816 ] } From ca42bccfd6898f34a685253f1704e653e667b2b0 Mon Sep 17 00:00:00 2001 From: Rubydex <118339704+Rubydex@users.noreply.github.com> Date: Tue, 27 Jun 2023 01:56:32 +0800 Subject: [PATCH 0095/1974] add bsc chain (#6644) Co-authored-by: robert --- projects/rubydex/index.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/projects/rubydex/index.js b/projects/rubydex/index.js index 88d87836625..bc06531bbe3 100644 --- a/projects/rubydex/index.js +++ b/projects/rubydex/index.js @@ -1,10 +1,14 @@ const ADDRESSES = require('../helper/coreAssets.json') const { sumTokensExport } = require('../helper/unwrapLPs'); -const VAULT_CONTRACT = '0x4a7c10780afdba628332e31c9e7d1675cfad594c'; +const VAULT_ARBITRUM = '0x4a7c10780afdba628332e31c9e7d1675cfad594c'; +const VAULT_BSC = '0xedB6CD4fdd2F465d2234f978276F9Ed2EE02102c'; module.exports = { - methodology: 'counts the number of USDT tokens in the RubyDex Vault contract.', + methodology: 'USDT tokens held by the RubyDex Vault contract.', arbitrum: { - tvl: sumTokensExport({ owner: VAULT_CONTRACT, tokens: [ADDRESSES.arbitrum.USDT] }), + tvl: sumTokensExport({ owner: VAULT_ARBITRUM, tokens: [ADDRESSES.arbitrum.USDT] }), + }, + bsc: { + tvl: sumTokensExport({ owner: VAULT_BSC, tokens: [ADDRESSES.bsc.USDT] }), } }; From 801b06bcb34b73ef4972889a1956d69a80fe7e3d Mon Sep 17 00:00:00 2001 From: litxDevelopment <137286174+litxDevelopment@users.noreply.github.com> Date: Mon, 26 Jun 2023 23:32:42 +0530 Subject: [PATCH 0096/1974] Add litx (#6645) * Add LitxSwap * Update index.js --- projects/litxswap/index.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 projects/litxswap/index.js diff --git a/projects/litxswap/index.js b/projects/litxswap/index.js new file mode 100644 index 00000000000..d3316cc41bb --- /dev/null +++ b/projects/litxswap/index.js @@ -0,0 +1,14 @@ +const { uniV3Export } = require("../helper/uniswapV3"); + +module.exports = uniV3Export({ + pulse: { + factory: "0x24398b6ea5434339934D999E431807B1C157b4Fd", + fromBlock: 17449439, + isAlgebra: true, + }, + bsc: { + factory: "0xaA37Bea711D585478E1c04b04707cCb0f10D762a", + fromBlock: 28719189, + isAlgebra: true, + }, +}); From 060de491ec131484200ff4e0bcdfd4b7ae94b28b Mon Sep 17 00:00:00 2001 From: stupid-boar <6961601+stupid-boar@users.noreply.github.com> Date: Mon, 26 Jun 2023 21:05:16 +0300 Subject: [PATCH 0097/1974] PepeTeam Bridge add MATIC (#6648) * fix swop.fi TVL * add USDT/USDC/BTCB for BSC TVL * add CRV token * add polygon MATIC --- projects/pepe-bridge/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/pepe-bridge/index.js b/projects/pepe-bridge/index.js index afb92928364..b4440ebb1a9 100644 --- a/projects/pepe-bridge/index.js +++ b/projects/pepe-bridge/index.js @@ -24,6 +24,9 @@ const config = { ], '0x8DF12786EC0E34e60D4c52f9052ba4e536e9367a' ] + ], + polygon: [ + [[nullAddress], '0xEa3cc73165748AD1Ca76b4d1bA9ebC43fb399018'], ] } module.exports = {}; From 8658c3473d814a1f7f514343d0a48e3f465b6e39 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 26 Jun 2023 23:38:56 +0530 Subject: [PATCH 0098/1974] Betswirl (#6650) * feat(betswirl): Add Staking contracts TVLs * minor fix --------- Co-authored-by: Romuald --- projects/betswirl/index.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/projects/betswirl/index.js b/projects/betswirl/index.js index a9014f0a787..ec75654a00f 100644 --- a/projects/betswirl/index.js +++ b/projects/betswirl/index.js @@ -1,10 +1,19 @@ +const { staking } = require('../helper/staking') module.exports = { - methodology: - "BetSwirl has no users TVL yet. However, it includes the bankrolls amounts (each tokens amount in the bank allowing players to bet).", - // The first Bank was deployed on Polygon at tx 0x6b99f617946d2f8c23adcd440cd3309d2da750e52d135853f38a0da11cdc3233 - start: 1648344312, // new Date(Date.UTC(2022, 2, 27, 1, 25, 12)).getTime() / 1e3, + methodology: "TVL counts BETS tokens deposited on the Staking contracts.", + start: 1687715559, bsc: { tvl: () => ({}), + staking: staking('0xeb5F6571861EAA6de9F827519B48eFe979d4d913', '0x3e0a7C7dB7bB21bDA290A80c9811DE6d47781671'), + }, + polygon: { + staking: staking('0xa184468972c71209BC31a5eF39b7321d2A839225', '0x9246a5f10a79a5a939b0c2a75a3ad196aafdb43b'), + }, + avax: { + staking: staking('0x31EDcD915e695AdAF782c482b9816613b347AC8c', '0xc763f8570a48c4c00c80b76107cbe744dda67b79'), + }, + arbitrum: { + staking: staking('0xD4BFB259D8785228e5D2c19115D5DB342E2eE064', '0xe26ae3d881f3d5def58d795f611753804e7a6b26'), }, }; From dd04f2a9279d316d6495928a494ac39450e637df Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 27 Jun 2023 01:41:59 +0530 Subject: [PATCH 0099/1974] track https://themis.capital/ (#6649) --- projects/helper/tokenMapping.js | 4 ++++ projects/themis-capital-dex/index.js | 12 ++++++++++++ projects/themis-capital-ohm/index.js | 14 ++++++++++++++ projects/treasury/themis-capital-ohm.js | 12 ++++++++++++ 4 files changed, 42 insertions(+) create mode 100644 projects/themis-capital-dex/index.js create mode 100644 projects/themis-capital-ohm/index.js create mode 100644 projects/treasury/themis-capital-ohm.js diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 5bbfa5fef64..ce4d376c217 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -53,6 +53,10 @@ const fixBalancesTokens = { // }, rpg: { '0x8e8816a1747fddc5f8b45d2e140a425d3788f659': { coingeckoId: "tether", decimals: 18 }, + }, + filecoin: { + '0xce5805cf6c84f71d2897f632e0aa60d2430ccd2a': { coingeckoId: "filecoin", decimals: 18 }, + '0x422849B355039bC58F2780cc4854919fC9cfaF94': { coingeckoId: "tether", decimals: 6 }, } } diff --git a/projects/themis-capital-dex/index.js b/projects/themis-capital-dex/index.js new file mode 100644 index 00000000000..4aa8f785725 --- /dev/null +++ b/projects/themis-capital-dex/index.js @@ -0,0 +1,12 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports = { + misrepresentedTokens: true, + filecoin: { + tvl: getUniTVL({ + factory: '0xe250A89d23F466c14B26BDF60a0DC3b54974FBE9', + useDefaultCoreAssets: true, + fetchBalances: true, + }) + }, +}; \ No newline at end of file diff --git a/projects/themis-capital-ohm/index.js b/projects/themis-capital-ohm/index.js new file mode 100644 index 00000000000..22ed94313ca --- /dev/null +++ b/projects/themis-capital-ohm/index.js @@ -0,0 +1,14 @@ +const { sumTokensExport } = require('../helper/unknownTokens') + +module.exports = { + misrepresentedTokens: true, + filecoin: { + tvl: () => ({}), + staking: sumTokensExport({ + owner: '0xA8a3136111ca0b010C9FD5C2D6d7c71e4982606A', + tokens: ['0x005E02A4A934142d8Dd476F192d0dD9c381b16b4'], + lps: ['0x45680718F6BdB7Ec3A7dF7D61587aC7C3fB49d50'], + useDefaultCoreAssets: true, + }) + }, +}; \ No newline at end of file diff --git a/projects/treasury/themis-capital-ohm.js b/projects/treasury/themis-capital-ohm.js new file mode 100644 index 00000000000..5efc3bdfaa0 --- /dev/null +++ b/projects/treasury/themis-capital-ohm.js @@ -0,0 +1,12 @@ +const { sumTokensExport } = require('../helper/unknownTokens') + +module.exports = { + misrepresentedTokens: true, + filecoin: { + tvl: sumTokensExport({ + owner: '0x0e511806C7AC38cF6d1EeAa9Ee51027e44Dcbf94', + tokens: ['0x422849B355039bC58F2780cc4854919fC9cfaF94', '0x45680718F6BdB7Ec3A7dF7D61587aC7C3fB49d50'], + useDefaultCoreAssets: true, + }) + }, +}; \ No newline at end of file From f1c75ba98afcd06c9630df977525966d8e13372f Mon Sep 17 00:00:00 2001 From: Akshay Gupta Date: Mon, 26 Jun 2023 21:36:55 -0400 Subject: [PATCH 0100/1974] balances not appearing --- projects/savvy/abi.json | 6 +++--- projects/savvy/index.js | 44 ++++++++++++++++++++++++++++------------- 2 files changed, 33 insertions(+), 17 deletions(-) diff --git a/projects/savvy/abi.json b/projects/savvy/abi.json index f883f9348f8..d0febbe47cb 100644 --- a/projects/savvy/abi.json +++ b/projects/savvy/abi.json @@ -1,5 +1,5 @@ { - "totalDebt": "function getTotalDebtAmount() external view returns (uint256)", - "totalValueLocked": "function getTotalValueLocked() external view returns (uint256))", - "totalStaked": "function getTotalSVYStakedUSD() external view returns (uint256)" + "totalDebt": "function getTotalDebtAmount() view returns (int256)", + "totalValueLocked": "function getTotalValueLocked() view returns (uint256)", + "totalStaked": "function getTotalSVYStakedUSD() view returns (uint256)" } \ No newline at end of file diff --git a/projects/savvy/index.js b/projects/savvy/index.js index a9e06b1033e..a96001535eb 100644 --- a/projects/savvy/index.js +++ b/projects/savvy/index.js @@ -1,32 +1,48 @@ +const sdk = require('@defillama/sdk'); const abi = require("./abi.json"); const contracts = require("./contracts.json"); async function tvl(_, _1, _2, { api }) { - return await api.call({ - abi: abi.totalValueLocked, - target: contracts.infoAggregator - }); + let balances = {}; + let balance = (await sdk.api.abi.call({ + abi: abi.totalValueLocked, + chain: "arbitrum", + target: contracts.infoAggregator + }) + ).output; + await sdk.util.sumSingleBalance(balances, `0x43aB8f7d2A8Dd4102cCEA6b438F6d747b1B9F034`, balance, api.chain); + console.log("tvlVal", balances); + return balances; } async function staking() { - return await api.call({ - abi: abi.totalStaked, - target: contracts.infoAggregator - }); + let balances = {}; + let balance = (await sdk.api.abi.call({ + abi: abi.totalStaked, + chain: "arbitrum", + target: contracts.infoAggregator + }) + ).output; + sdk.util.sumSingleBalance(balances, `arbitrum:${contracts.infoAggregator}`, balance); + console.log("stakingVal", balances); + return balances; } async function borrowed() { - return await api.call({ - abi: abi.totalDebt, - target: contracts.infoAggregator - }); + const borrowedVal = (await sdk.api.abi.call({ + abi: abi.totalDebt, + target: contracts.infoAggregator + }) + ).output; + console.log("borrowedVal", borrowedVal); + return Math.min(borrowedVal, 0); } module.exports = { methodology: 'The calculated TVL is the current USD sum of all user deposits and SVY tokens staked in veSVY.', arbitrum: { tvl, - staking, - borrowed + //staking, + //borrowed } } \ No newline at end of file From ae6e88671d0253f9fb4852ed1f6f37e437dcff71 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Tue, 27 Jun 2023 02:39:47 +0100 Subject: [PATCH 0101/1974] fix lint issues --- projects/curve/historical/index.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/projects/curve/historical/index.js b/projects/curve/historical/index.js index 9444150818d..f08307340c1 100644 --- a/projects/curve/historical/index.js +++ b/projects/curve/historical/index.js @@ -175,7 +175,7 @@ let coinDecimals = [ } ] -async function tvl(timestamp, block) { +async function tvlFunc(timestamp, block) { var price_feed = await axios.get(`https://coins.llama.fi/prices/historical/${timestamp}/${["bitcoin","cdai","compound-usd-coin"].map(c=>"coingecko:"+c).join(',')}`) var tvl = 0; var btcTVL = 0; @@ -223,9 +223,9 @@ async function calc(item, i, price_feed, block) { var poolAmount = await new BigNumber(balances).div(10 ** coinDecimals[0][coins]).toFixed(2); - + let multiplier; if (item.type == 'compound') { - let multiplier = 1; + multiplier = 1; if (coins === '0x39AA39c021dfbaE8faC545936693aC917d5E7563') { multiplier = price_feed.data.coins['coingecko:compound-usd-coin'].price; } @@ -236,7 +236,7 @@ async function calc(item, i, price_feed, block) { } if (item.type == 'yToken') { - let multiplier = 1; + multiplier = 1; if (coins !== '0x8E870D67F660D95d5be530380D0eC0bd388289E1') { // PAX exception multiplier = await getVirtualPrice(abis.abis.yTokens, coins, block) multiplier = await new BigNumber(multiplier).div(10 ** 18).toFixed(4); @@ -250,5 +250,5 @@ async function calc(item, i, price_feed, block) { module.exports = { - ethereum:{tvl} + ethereum:{tvlFunc} } From 4f42aa64837b3461f539701efd216683009872a2 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Tue, 27 Jun 2023 03:37:31 +0100 Subject: [PATCH 0102/1974] add hallmark --- projects/astrowar-finance/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/astrowar-finance/index.js b/projects/astrowar-finance/index.js index d658c54c832..c8d4f032ea4 100644 --- a/projects/astrowar-finance/index.js +++ b/projects/astrowar-finance/index.js @@ -14,6 +14,9 @@ async function tvl(timestamp, _block, { harmony: block }) { module.exports = { deadFrom: 1650564340, + hallmarks: [ + [1650412800, "Rug Pull"] + ], harmony: { tvl } From a698d8f96755aedb4547509d48c3437a3fe1872f Mon Sep 17 00:00:00 2001 From: theapesociety <98607857+theapesociety@users.noreply.github.com> Date: Tue, 27 Jun 2023 01:23:15 -0700 Subject: [PATCH 0103/1974] Add Levvy.fi (#6628) * Create index.js * Update index.js * Separate TVL and borrowed * bugfix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/levvy-fi/index.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 projects/levvy-fi/index.js diff --git a/projects/levvy-fi/index.js b/projects/levvy-fi/index.js new file mode 100644 index 00000000000..29c72ff8919 --- /dev/null +++ b/projects/levvy-fi/index.js @@ -0,0 +1,19 @@ +const { post } = require('../helper/http') + +module.exports = { + misrepresentedTokens: true, + cardano: { + tvl: async () => { + const data = await post('https://citizens.theapesociety.io/api/getLevvyData', {}) + return { + cardano: data.adaTVL, + } + }, + borrowed: async () => { + const data = await post('https://citizens.theapesociety.io/api/getLevvyData', {}) + return { + cardano: data.borrowed, + } + } + }, +} From d537527d38d97b2fef53a18a852a6d5f15aefd3a Mon Sep 17 00:00:00 2001 From: PacmanFinance <131015836+PacmanFinance@users.noreply.github.com> Date: Tue, 27 Jun 2023 16:25:30 +0800 Subject: [PATCH 0104/1974] add Pacman project (#6638) * test * add tvl * fix tvl * remove log * code refactor * refactor pacman --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/pacman/index.js | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 projects/pacman/index.js diff --git a/projects/pacman/index.js b/projects/pacman/index.js new file mode 100644 index 00000000000..929caf096f9 --- /dev/null +++ b/projects/pacman/index.js @@ -0,0 +1,32 @@ +const { graphQuery } = require('../helper/http') + +const subgraphUrl = "https://api.thegraph.com/subgraphs/name/pacmanfinance/pacman-arbitrum"; + +const vaultsQuery = ` + query { + vaults { + baseToken { + id + priceByUsd + decimals + } + id + availableAmount + totalDeposit + totalDebt + } + } +`; + +async function tvl(timestamp, ethBlock, chainBlocks, { api }) { + const { vaults } = await graphQuery(subgraphUrl, vaultsQuery) + vaults.forEach(({ baseToken: { id, decimals }, totalDebt, totalDeposit}) => { + api.add(id, (totalDeposit - totalDebt) * ( 10 ** decimals)) + }) +} + +module.exports = { + arbitrum: { + tvl, + } +}; \ No newline at end of file From 466ae72e07a304196a2ec98854b28cb85020fe11 Mon Sep 17 00:00:00 2001 From: Kirin <107048299+0xKirin@users.noreply.github.com> Date: Tue, 27 Jun 2023 15:42:06 +0700 Subject: [PATCH 0105/1974] Correct getting the total of tvl and staking into Templar DAO (#6651) * modify get tvl and staking * minor fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/helper/treasury.js | 2 +- projects/templar/api.js | 2 +- projects/templar/index.js | 39 ++++++++-------------- projects/treasury/templar-dao.js | 55 +++++++++++++++++++++++++++++--- 4 files changed, 66 insertions(+), 32 deletions(-) diff --git a/projects/helper/treasury.js b/projects/helper/treasury.js index 82f912f781f..227afc1df55 100644 --- a/projects/helper/treasury.js +++ b/projects/helper/treasury.js @@ -27,7 +27,7 @@ function treasuryExports(config) { exportObj[chain] = { tvl: sumTokensExport(tvlConfig) } } - if (ownTokens) { + if (ownTokens.length > 0) { const { solOwners, ...otherOptions } = config[chain] const options = { ...otherOptions, owners: [...owners, ...ownTokenOwners], tokens: ownTokens, chain, uniV3WhitelistedTokens: ownTokens} exportObj[chain].ownTokens = sumTokensExport(options) diff --git a/projects/templar/api.js b/projects/templar/api.js index 86cb8cd4803..aa6c1aeb5e7 100644 --- a/projects/templar/api.js +++ b/projects/templar/api.js @@ -2,7 +2,7 @@ const index = require('./index') module.exports = { bsc: { - tvl: () => 0, + tvl: index.bsc.tvl, staking: index.bsc.staking, }, moonriver: { diff --git a/projects/templar/index.js b/projects/templar/index.js index f56fc4d7e22..31a8172a02e 100644 --- a/projects/templar/index.js +++ b/projects/templar/index.js @@ -1,30 +1,24 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const { stakings } = require("../helper/staking"); -const { sumTokensExport, nullAddress, } = require("../helper/unwrapLPs"); +const { sumTokensExport } = require("../helper/unwrapLPs"); -const bscOwner = "0xEA724deA000b5e5206d28f4BC2dAD5f2FA1fe788"; const bscStaking = "0xa1f61Ca61fe8655d2a204B518f6De964145a9324"; const bscStakingV2 = "0xffC7B93b53BC5F4732b414295E989684702D0eb5"; -const bscTreasuryContract = "0xd01e8D805BB310F06411e70Fd50eB58cAe2B4C27"; const bscTokens = { - BUSD: ADDRESSES.bsc.BUSD, - WBNB: ADDRESSES.bsc.WBNB, - MIM: "0xfe19f0b51438fd612f6fd59c1dbb3ea319f433ba", - TM: "0x194d1D62d8d798Fcc81A6435e6d13adF8bcC2966", - DAI: "0x1AF3F329e8BE154074D8769D1FFa4eE058B1DBc3", TEM: "0x19e6BfC1A6e4B042Fb20531244D47E252445df01", - VBUSD: "0x95c78222B3D6e262426483D42CfA53685A67Ab9D", - VBTC: "0x882C173bC7Ff3b7786CA16dfeD3DFFfb9Ee7847B", }; -const ethTokens = { - USDC: ADDRESSES.ethereum.USDC, - USDT: ADDRESSES.ethereum.USDT, -}; -const ethOwner = "0x4Bd973e98585b003c31f4C8b9d6eAC5d3293B1e5" - module.exports = { + bsc: { + staking: sumTokensExport({ + owners: [bscStaking, bscStakingV2], + tokens: [bscTokens.TEM], + }), + tvl: () => 0, + }, + ethereum: { + tvl: () => 0, + staking: () => 0, + }, moonriver: { tvl: () => 0, staking: () => 0, @@ -33,11 +27,4 @@ module.exports = { tvl: () => 0, staking: () => 0, }, - bsc: { - tvl: sumTokensExport({ owners: [bscOwner, bscTreasuryContract,], tokens: [bscTokens.TM, bscTokens.DAI, bscTokens.BUSD, bscTokens.WBNB, bscTokens.VBUSD, bscTokens.VBTC], resolveUniV3: true, }), - staking: stakings([bscStaking, bscStakingV2], bscTokens.TEM, "bsc"), - }, - ethereum: { - tvl: sumTokensExport({ owner: ethOwner, tokens: [ethTokens.USDC, ethTokens.USDT, nullAddress, ADDRESSES.ethereum.WBTC], resolveUniV3: true, }), - }, -} +}; \ No newline at end of file diff --git a/projects/treasury/templar-dao.js b/projects/treasury/templar-dao.js index 208896bcfd3..207bd8b25df 100644 --- a/projects/treasury/templar-dao.js +++ b/projects/treasury/templar-dao.js @@ -1,5 +1,52 @@ -module.exports = require("../templar/index"); +const ADDRESSES = require("../helper/coreAssets.json"); +const { treasuryExports } = require("../helper/treasury"); +const { nullAddress } = require("../helper/unwrapLPs"); -delete module.exports.bsc.staking -delete module.exports.moonriver.staking -delete module.exports.harmony.staking \ No newline at end of file +const bscOwner = "0xEA724deA000b5e5206d28f4BC2dAD5f2FA1fe788"; +const bscTreasuryContract = "0xd01e8D805BB310F06411e70Fd50eB58cAe2B4C27"; + +const bscTokens = { + BUSD: ADDRESSES.bsc.BUSD, + WBNB: ADDRESSES.bsc.WBNB, + MIM: "0xfe19f0b51438fd612f6fd59c1dbb3ea319f433ba", + TM: "0x194d1D62d8d798Fcc81A6435e6d13adF8bcC2966", + DAI: "0x1AF3F329e8BE154074D8769D1FFa4eE058B1DBc3", + TEM: "0x19e6BfC1A6e4B042Fb20531244D47E252445df01", + VBUSD: "0x95c78222B3D6e262426483D42CfA53685A67Ab9D", + VBTC: "0x882C173bC7Ff3b7786CA16dfeD3DFFfb9Ee7847B", +}; + +const LP = "0xEA724deA000b5e5206d28f4BC2dAD5f2FA1fe788"; + +const ethTokens = { + USDC: ADDRESSES.ethereum.USDC, + USDT: ADDRESSES.ethereum.USDT, +}; +const ethOwner = "0x4Bd973e98585b003c31f4C8b9d6eAC5d3293B1e5"; + +module.exports = treasuryExports({ + bsc: { + tokens: [ + nullAddress, + bscTokens.TM, + bscTokens.DAI, + bscTokens.BUSD, + bscTokens.WBNB, + bscTokens.VBUSD, + bscTokens.VBTC, + ], + owners: [bscOwner, bscTreasuryContract], + ownTokens: ['0x19e6BfC1A6e4B042Fb20531244D47E252445df01'], + resolveUniV3: true, + }, + ethereum: { + owner: ethOwner, + tokens: [ + nullAddress, + ethTokens.USDC, + ethTokens.USDT, + ADDRESSES.ethereum.WBTC, + ], + resolveUniV3: true, + }, +}); \ No newline at end of file From 2299094fd063efd620f8092612a68cf8adf85ced Mon Sep 17 00:00:00 2001 From: Rhinestone Cowboy <42247026+AntwuanDixon@users.noreply.github.com> Date: Tue, 27 Jun 2023 18:11:24 +0800 Subject: [PATCH 0106/1974] Add Struct Finance (#6654) * add struct * replace USDC/BTC.b token address declarations with coreAssets import; remove default undefined val from API param * change directory name to struct-finance * change object name to addresses * minor fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/struct-finance/index.js | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 projects/struct-finance/index.js diff --git a/projects/struct-finance/index.js b/projects/struct-finance/index.js new file mode 100644 index 00000000000..891238abff3 --- /dev/null +++ b/projects/struct-finance/index.js @@ -0,0 +1,29 @@ +const ADDRESSES = require('../helper/coreAssets.json'); +const { sumTokens2 } = require("../helper/unwrapLPs"); + +const addresses = { + struct: { + gmxYieldSource: "0x6aE12b0adF9716181c07D19dfe76442AB1b3817b", + gmxFactory: "0x46f8765781ac36e5e8f9937658fa311af9d735d7", + }, + token: { + fsGlp: "0x9e295b5b976a184b14ad8cd72413ad846c299660", + }, +}; + +async function tvl(ts, _, __, { api }) { + const vaults = await api.fetchList({ lengthAbi: 'uint256:totalProducts', itemAbi: "function allProducts(uint256) external view returns (address)", target: addresses.struct.gmxFactory}) + vaults.push(addresses.struct.gmxYieldSource); + + return sumTokens2({ + api, + owners: vaults, + tokens: [ADDRESSES.avax.BTC_b, ADDRESSES.avax.USDC, addresses.token.fsGlp], + }); +} + +module.exports = { + avax: { + tvl, + }, +}; From 4da1d79a5ea656d58649051ad0bc4b957c5d116a Mon Sep 17 00:00:00 2001 From: jameveplus <136568897+jameveplus@users.noreply.github.com> Date: Tue, 27 Jun 2023 17:12:02 +0700 Subject: [PATCH 0107/1974] veplus create new dex (#6655) * veplus create dex * minor fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/veplus/index.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 projects/veplus/index.js diff --git a/projects/veplus/index.js b/projects/veplus/index.js new file mode 100644 index 00000000000..92d2c84362e --- /dev/null +++ b/projects/veplus/index.js @@ -0,0 +1,13 @@ +const { getUniTVL } = require('../helper/unknownTokens.js') + +module.exports = { + misrepresentedTokens: true, + bsc:{ + tvl: getUniTVL({ + useDefaultCoreAssets: true, + hasStablePools: true, + fetchBalances: true, + factory: '0x5Bcd9eE6C31dEf33334b255EE7A767B6EEDcBa4b', + }), + }, +} \ No newline at end of file From 395067cda38494bba3d05866a7ab057e1ff9e8d6 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 27 Jun 2023 12:46:46 +0200 Subject: [PATCH 0108/1974] fluidtokens: split borrowed from tvl --- projects/fluidtokens/index.js | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/projects/fluidtokens/index.js b/projects/fluidtokens/index.js index abb10b2309c..a6ad125cc3a 100644 --- a/projects/fluidtokens/index.js +++ b/projects/fluidtokens/index.js @@ -42,7 +42,23 @@ const tvl_onchain = async () => { }; }; -async function tvl( +async function tvl() { + const dataOffers = await get("https://api.fluidtokens.com/get-available-collection-offers"); + let SC_offers_tvl = 0; + + dataOffers.forEach((i) => { + SC_offers_tvl += parseInt(i.offerData.loanAmnt); + }); + + const repay_tvl = parseInt(await get("https://api.fluidtokens.com/get-total-available-repayments")); + + return { + cardano: (SC_offers_tvl+repay_tvl) / 1e6, + }; +} + + +async function borrowed( ts //timestamp in seconds ) { const data = await get("https://api.fluidtokens.com/get-active-loans"); @@ -84,20 +100,21 @@ async function tvl( SC_offers_tvl += parseInt(i.offerData.loanAmnt); }); - const repay_tvl = parseInt(await get("https://api.fluidtokens.com/get-total-available-repayments")); - return { - cardano: (SC1_tvl + SC2_tvl +SC_offers_tvl+repay_tvl) / 1e6, + cardano: (SC1_tvl + SC2_tvl) / 1e6, }; } + module.exports = { methodology: "Count active loaned out ADA as tvl", timetravel: false, cardano: { tvl, + borrowed, }, hallmarks: [ [Math.floor(new Date("2023-01-01") / 1e3), "Count only active loans"], + [Math.floor(new Date("2023-06-27") / 1e3), "ADA loaned out is counted under borrowed"], ], }; From 8af26295a3a731ca822b82895362724a5d4e3ea3 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 27 Jun 2023 12:53:50 +0200 Subject: [PATCH 0109/1974] litxswap: update factory address bsc --- projects/litxswap/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/litxswap/index.js b/projects/litxswap/index.js index d3316cc41bb..fbe2ba3b8f1 100644 --- a/projects/litxswap/index.js +++ b/projects/litxswap/index.js @@ -7,8 +7,8 @@ module.exports = uniV3Export({ isAlgebra: true, }, bsc: { - factory: "0xaA37Bea711D585478E1c04b04707cCb0f10D762a", - fromBlock: 28719189, + factory: "0xbbc7f5605c9cb341d9c41e46ae6ceb30511bdfcf", + fromBlock: 29291639, isAlgebra: true, }, }); From ac156d5e6d25bbb4d46e5bbb5891a6f8029b9602 Mon Sep 17 00:00:00 2001 From: Pham Anh Minh <93236465+phamminh0811@users.noreply.github.com> Date: Tue, 27 Jun 2023 23:40:04 +0700 Subject: [PATCH 0110/1974] Quasar adapter (#6652) * add tvl for quarsar * revert minh pr * add tvl for quarsar * add quarsar chain and change calculate lock on lpStrategyContracts * update pool contract * fix misspell quasar --- projects/helper/chain/cosmos.js | 1 + projects/helper/chains.json | 1 + projects/quasar/index.js | 105 ++++++++++++++++++++++++++++++++ 3 files changed, 107 insertions(+) create mode 100644 projects/quasar/index.js diff --git a/projects/helper/chain/cosmos.js b/projects/helper/chain/cosmos.js index 6aa2e19c0a3..364f92ba851 100644 --- a/projects/helper/chain/cosmos.js +++ b/projects/helper/chain/cosmos.js @@ -27,6 +27,7 @@ const endPoints = { xpla: "https://dimension-lcd.xpla.dev", kava: "https://api2.kava.io", neutron: "https://rest-kralum.neutron-1.neutron.org", + quasar: "https://quasar-api.polkachu.com", }; const chainSubpaths = { diff --git a/projects/helper/chains.json b/projects/helper/chains.json index 185a09e2ee3..4ebafa22a22 100644 --- a/projects/helper/chains.json +++ b/projects/helper/chains.json @@ -153,6 +153,7 @@ "proton", "pulse", "quicksilver", + "quasar", "reef", "regen", "rei", diff --git a/projects/quasar/index.js b/projects/quasar/index.js new file mode 100644 index 00000000000..649b446cfd8 --- /dev/null +++ b/projects/quasar/index.js @@ -0,0 +1,105 @@ +const axios = require("axios"); +const { endPoints, queryContract } = require('../helper/chain/cosmos') +const { transformBalances } = require('../helper/portedTokens') + +const chain = 'quasar' + +const lpStrategyContracts = { + 1: [ + "quasar14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9sy9numu", + "quasar1l468h9metf7m8duvay5t4fk2gp0xl94h94f3e02mfz4353de2ykqh6rcts", + "quasar1cp8cy5kvaury53frlsaml7ru0es2reln66nfj4v7j3kcfxl4datqsw0aw4", + "quasar1kj8q8g2pmhnagmfepp9jh9g2mda7gzd0m5zdq0s08ulvac8ck4dq9ykfps", + ], + 678: [ + "quasar1suhgf5svhu4usrurvxzlgn54ksxmn8gljarjtxqnapv8kjnp4nrsmslfn4", + "quasar1ma0g752dl0yujasnfs9yrk6uew7d0a2zrgvg62cfnlfftu2y0egqx8e7fv", + ], + 704: [ + "quasar1yyca08xqdgvjz0psg56z67ejh9xms6l436u8y58m82npdqqhmmtqk5tv30", + ], + 803: [ + "quasar1jgn70d6pf7fqtjke0q63luc6tf7kcavdty67gvfpqhwwsx52xmjq7kd34f", + "quasar1t9adyk9g2q0efn3xndunzy4wvdrnegjkpvp382vm2uc7hnvash5qpzmxe4", + ], + 833: [ + "quasar1ery8l6jquynn9a4cz2pff6khg8c68f7urt33l5n9dng2cwzz4c4qxhm6a2", + ], + 904: [ + "quasar1ch4s3kkpsgvykx5vtz2hsca4gz70yks5v55nqcfaj7mgsxjsqypsxqtx2a", + ], + 944: [ + "quasar1xkakethwh43dds3ccmsjals9jt7qsfmedgm9dvm9tpqq8watpv9q0458u6", + "quasar1ch4s3kkpsgvykx5vtz2hsca4gz70yks5v55nqcfaj7mgsxjsqypsxqtx2a", + ], +} + + +async function tvl() { + let amounts = {} + + for (const poolID in lpStrategyContracts){ + let lpContracts = lpStrategyContracts[poolID]; + let poolEndpoint = `${endPoints['osmosis']}/osmosis/gamm/v1beta1/pools/${poolID}`; + const poolData = (await axios.get(poolEndpoint)).data.pool; + + for (const contractAddress of lpContracts) { + let lp_shares = await queryContract({ + contract: contractAddress, + chain: chain, + data: { 'lp_shares': {} } + }); + + let amount = calculateTokenAmounts(poolData, lp_shares['lp_shares']['locked_shares']) + for (const denom in amount) { + if (typeof amounts[denom] === "undefined") { + amounts[denom] = amount[denom]; + } else { + amounts[denom] += amount[denom]; + } + } + } + } + + return transformBalances(chain, amounts) +} + + +function calculateTokenAmounts(poolData, gammAmount) { + // Extract the total pool shares. + let totalShares = poolData.total_shares.amount; + + // Initialize an object to hold the amounts of each token. + let tokenAmounts = {}; + + // For each token in the pool... + if (typeof poolData.pool_assets !== "undefined") { + for (let asset of poolData.pool_assets) { + // Extract the token's denom and amount. + let denom = asset.token.denom; + let assetAmount = asset.token.amount; + + // Calculate the amount of this token that corresponds to the given amount of pool shares. + tokenAmounts[denom] = (gammAmount * assetAmount) / totalShares; + } + } else { + for (let asset of poolData.pool_liquidity) { + // Extract the token's denom and amount. + let denom = asset.denom; + let assetAmount = asset.amount; + + // Calculate the amount of this token that corresponds to the given amount of pool shares. + tokenAmounts[denom] = (gammAmount * assetAmount) / totalShares; + } + } + + return tokenAmounts; +} + +module.exports = { + timetravel: false, + methodology: "Total TVL on vaults", + quasar: { + tvl, + }, +} \ No newline at end of file From c957be93ca3717e3c652879ef4562324874e3594 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 27 Jun 2023 18:50:39 +0200 Subject: [PATCH 0111/1974] quasar: minor fix --- projects/apollodao/index.js | 14 ++++---------- projects/helper/tokenMapping.js | 6 +----- projects/quasar/index.js | 16 ++++++---------- 3 files changed, 11 insertions(+), 25 deletions(-) diff --git a/projects/apollodao/index.js b/projects/apollodao/index.js index c24702e1e74..6ef923eeaba 100644 --- a/projects/apollodao/index.js +++ b/projects/apollodao/index.js @@ -1,7 +1,6 @@ // vaults are closed: https://articles.apollo.farm/apollo-dao-will-be-closing-vaults-on-terra-classic/ const axios = require("axios"); const { endPoints, queryContract } = require('../helper/chain/cosmos') -const { transformBalances } = require('../helper/portedTokens') const chain = 'osmosis' @@ -23,9 +22,8 @@ const contractAddresses = { akt_osmo: "osmo122ryl7pez7yjprtvjckltu2uvjxrq3kqt4nvclax2la7maj6757qg054ga", }; -async function tvl() { - let amounts = {} - if (chain != "osmosis") return transformBalances(chain, amounts) +async function tvl(_, _1, _2, { api }) { + if (api.chain != "osmosis") return {} for (const contractName in contractAddresses) { let contractAddress = contractAddresses[contractName]; let vaultInfo = await queryContract({ @@ -46,14 +44,9 @@ async function tvl() { let amount = calculateTokenAmounts(poolData, totalAssets) for (const denom in amount) { - if (typeof amounts[denom] === "undefined") { - amounts[denom] = amount[denom]; - } else { - amounts[denom] += amount[denom]; - } + api.add(denom, amount[denom]) } } - return transformBalances(chain, amounts) } function calculateTokenAmounts(poolData, gammAmount) { @@ -99,5 +92,6 @@ module.exports = { hallmarks: [ [1651881600, "UST depeg"], [Math.floor(new Date('2022-09-13') / 1e3), 'Stop supporting Terra Classic'], + [Math.floor(new Date('2023-02-16') / 1e3), 'Relaunch on Osmosis '], ], } diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index ce4d376c217..12e31d12a09 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -16,7 +16,7 @@ coreAssets = JSON.parse(JSON.stringify(coreAssets)) // carbon: https://api-insights.carbon.network/info/denom_gecko_map // orbit brige: https://bridge.orbitchain.io/open/v1/api/monitor/rawTokenList -const ibcChains = ['ibc', 'terra', 'terra2', 'crescent', 'osmosis', 'kujira', 'stargaze', 'juno', 'injective', 'cosmos', 'comdex', 'stargaze', 'umee', 'orai', 'persistence', 'fxcore', 'neutron',] +const ibcChains = ['ibc', 'terra', 'terra2', 'crescent', 'osmosis', 'kujira', 'stargaze', 'juno', 'injective', 'cosmos', 'comdex', 'stargaze', 'umee', 'orai', 'persistence', 'fxcore', 'neutron', 'quasar', ] const caseSensitiveChains = [...ibcChains, 'solana', 'tezos', 'ton', 'algorand', 'aptos', 'near', 'bitcoin', 'waves', 'tron', 'litecoin', 'polkadot', 'ripple', 'elrond', 'cardano', 'stacks', 'sui'] const distressedAssts = new Set(Object.values({ @@ -53,10 +53,6 @@ const fixBalancesTokens = { // }, rpg: { '0x8e8816a1747fddc5f8b45d2e140a425d3788f659': { coingeckoId: "tether", decimals: 18 }, - }, - filecoin: { - '0xce5805cf6c84f71d2897f632e0aa60d2430ccd2a': { coingeckoId: "filecoin", decimals: 18 }, - '0x422849B355039bC58F2780cc4854919fC9cfaF94': { coingeckoId: "tether", decimals: 6 }, } } diff --git a/projects/quasar/index.js b/projects/quasar/index.js index 649b446cfd8..bfd5c7a9adf 100644 --- a/projects/quasar/index.js +++ b/projects/quasar/index.js @@ -1,6 +1,6 @@ const axios = require("axios"); const { endPoints, queryContract } = require('../helper/chain/cosmos') -const { transformBalances } = require('../helper/portedTokens') +const sdk = require('@defillama/sdk') const chain = 'quasar' @@ -36,9 +36,9 @@ const lpStrategyContracts = { async function tvl() { - let amounts = {} + const api = new sdk.ChainApi({ chain: 'osmosis' }) - for (const poolID in lpStrategyContracts){ + for (const poolID in lpStrategyContracts) { let lpContracts = lpStrategyContracts[poolID]; let poolEndpoint = `${endPoints['osmosis']}/osmosis/gamm/v1beta1/pools/${poolID}`; const poolData = (await axios.get(poolEndpoint)).data.pool; @@ -49,19 +49,15 @@ async function tvl() { chain: chain, data: { 'lp_shares': {} } }); - + let amount = calculateTokenAmounts(poolData, lp_shares['lp_shares']['locked_shares']) for (const denom in amount) { - if (typeof amounts[denom] === "undefined") { - amounts[denom] = amount[denom]; - } else { - amounts[denom] += amount[denom]; - } + api.add(denom, amount[denom]) } } } - return transformBalances(chain, amounts) + return api.getBalances() } From cefc6d82b244b1691b9740bb2c2a99fbd5b2f3dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vuka=C5=A1in=20Manojlovi=C4=87?= Date: Tue, 27 Jun 2023 18:53:23 +0200 Subject: [PATCH 0112/1974] Add rETH collateral to Raft TVL (#6658) --- projects/raft/index.js | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/projects/raft/index.js b/projects/raft/index.js index f53a5f93365..3f05728ff5d 100644 --- a/projects/raft/index.js +++ b/projects/raft/index.js @@ -1,10 +1,23 @@ -const { sumTokensExport } = require('../helper/unwrapLPs') -const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require("../helper/unwrapLPs"); +const ADDRESSES = require("../helper/coreAssets.json"); -const RAFT_POSITION_MANAGER = '0x5f59b322eb3e16a0c78846195af1f588b77403fc'; +const RAFT_POSITION_MANAGER = "0x5f59b322eb3e16a0c78846195af1f588b77403fc"; +const WRAPPED_RETH = "0xb69e35fb4a157028b92f42655090b984609ae598"; -module.exports = { - ethereum: { - tvl: sumTokensExport({ owner: RAFT_POSITION_MANAGER, tokens: [ADDRESSES.ethereum.WSTETH]}), +function transformAddress(token) { + if (token === WRAPPED_RETH) { + return ADDRESSES.ethereum.RETH; } + + return token; } + +module.exports = { + ethereum: { + tvl: sumTokensExport({ + owner: RAFT_POSITION_MANAGER, + tokens: [ADDRESSES.ethereum.WSTETH, WRAPPED_RETH], + transformAddress: transformAddress, + }), + }, +}; From 0d5ea292d5911518a0686aecbf54a0260e063992 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 27 Jun 2023 20:58:09 +0200 Subject: [PATCH 0113/1974] refactor hats --- projects/hats/index.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/projects/hats/index.js b/projects/hats/index.js index 8502acb7b4e..78e438c6072 100644 --- a/projects/hats/index.js +++ b/projects/hats/index.js @@ -1,5 +1,12 @@ -const { masterChefExports, } = require("../helper/masterchef") +const { sumTokens2 } = require('../helper/unwrapLPs') +const abi = require('../helper/abis/masterchef.json') -const owner = '0x571f39d351513146248AcafA9D0509319A327C4D' // vault address -const token = "0x36f8d0d0573ae92326827c4a82fe4ce4c244cab6" // intentional wrong token TODO: find hats token -module.exports = masterChefExports(owner, "ethereum", token) \ No newline at end of file +const vault = '0x571f39d351513146248AcafA9D0509319A327C4D' // vault address +module.exports = { + ethereum: { + tvl: async (_, _1, _2, { api }) => { + const info = await api.fetchList({ lengthAbi: abi.poolLength, itemAbi: abi.poolInfo, target: vault}) + return sumTokens2({ api, owner: vault, tokens: info.map(i => i.lpToken)}) + } + } +} \ No newline at end of file From 256d98dfcaf3c2628f9e16dc713ccd96d60d574f Mon Sep 17 00:00:00 2001 From: Akshay Gupta Date: Tue, 27 Jun 2023 15:20:36 -0400 Subject: [PATCH 0114/1974] tvl test passed --- projects/savvy/abi.json | 5 ---- projects/savvy/contracts.json | 49 ++++++++++++++++++++++++++++++++++- projects/savvy/index.js | 46 +++++--------------------------- 3 files changed, 55 insertions(+), 45 deletions(-) delete mode 100644 projects/savvy/abi.json diff --git a/projects/savvy/abi.json b/projects/savvy/abi.json deleted file mode 100644 index d0febbe47cb..00000000000 --- a/projects/savvy/abi.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "totalDebt": "function getTotalDebtAmount() view returns (int256)", - "totalValueLocked": "function getTotalValueLocked() view returns (uint256)", - "totalStaked": "function getTotalSVYStakedUSD() view returns (uint256)" -} \ No newline at end of file diff --git a/projects/savvy/contracts.json b/projects/savvy/contracts.json index 082428e992e..25f742df3da 100644 --- a/projects/savvy/contracts.json +++ b/projects/savvy/contracts.json @@ -1,3 +1,50 @@ { - "infoAggregator": "0x68D54ff41BA47355b95Bd477Bcf4d5ff4b2c2A59" + "infoAggregator": "0x68D54ff41BA47355b95Bd477Bcf4d5ff4b2c2A59", + "tokenHolders": { + "VeSVY": "0x9aEEe4656F67034B06D99294062feBA1015430ad", + "SavvyBooster": "0xbf837f2C7894cfF859a01d078d7AAa8c47221a2F", + "SavvyRedlist": "0x0d6554A8c6a7D98D4aa05206DaDdbcb3372b8F7F", + "WrapTokenGateway": "0x882e251c1E010205A9f9b0147F3331B4728BB640", + "SavvyPositionManagerBTC": "0x3204d81C73F8100766C1691A67078b16Ec7c142c", + "SavvyPositionManagerETH": "0x5c4eb1909fB21e39Fc45ee753420AeDeBA07F3EF", + "SavvyPositionManagerUSD": "0x36358A1597DB299033b16fda567010D53c0A4EdA", + "YieldStrategyManagerBTC": "0xdC82E20111767f4a2A76A65BD85E41F7859c7b9f", + "YieldStrategyManagerETH": "0x23627eb1C6692Adf25AD79285FDe2bc6bdf12C82", + "YieldStrategyManagerUSD": "0x09Dde6661fd023cf7c3751555347a5cB8687F806", + "SavvySwapWETH": "0xb5231e17596bEAf436A25B018bd63e5b42e14135", + "SavvySwapBTCb": "0x43be188901F529c11337f28bC1F753a878B2F691", + "SavvySwapWBTC": "0x9A3A3ba687Fcb8AFE6367Eff3A5F5A11F51626DA", + "SavvySwapUSDCe": "0xD9565AB01AA30D7Aa2b982b8b1c740480C1C8497", + "SavvySwapUSDT": "0x0E56d518E5d3F5e6cFCfD46095B6B4024541027b", + "SavvySwapDAI": "0x03fA5a7fA80E5EA464559d21B8843E15b7969c07", + "SavvySageBTC": "0x2fcCd0f67d0722f5EB7c1A404DFF0224544155E3", + "SavvySageETH": "0xCd5156Fdd53fD9A0f5bfc37B212DD9c989C10533", + "SavvySageUSD": "0x78A370c3d5fFF93Da53a2B088a117244c52AF857", + "AaveAdapterUSDC": "0xcA728C2593ac1912457C8060836CC13Bb61f1B08", + "AaveAdapterWBTC": "0x39440D2528ABc6FBd2E539dA28bbC581f9078161", + "AaveAdapterWETH": "0x4056E92C635595e9b9D5F4F85Ba04220cBd0CbB6", + "JonesAdapterUSDC": "0x9394b6B85bEab8cba1e4aA35FbBB5C31c258224A" + }, + "savvyTokens": { + "SVY": "0x43aB8f7d2A8Dd4102cCEA6b438F6d747b1B9F034", + "svBTC": "0xeEE18334c414A47FB886a7317E1885b2Bfb8c2A6", + "svETH": "0xf7728582002ef82908c8242CF552E969BA863Ffa", + "svUSD": "0xF202Ab403Cd7E90197ec0f010ee897E283037706" + }, + "baseTokens": { + "WETH": "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1", + "WBTC": "0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f", + "USDCe": "0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8", + "USDT": "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9", + "DAI": "0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1", + "BTCb": "0x2297aEbD383787A160DD0d9F71508148769342E3" + }, + "yieldTokens": { + "savvyAArbUSDC": "0xCdFF8576683E22621f512fc2E6d347A9D241DAd3", + "savvyAArbWBTC": "0xDD7e69c478288A9596DECc2230A39c7b922413Dd", + "savvyAArbWETH": "0xCaB3886D48bAd0F749ba7e7c7A255b636c64F937", + "jUSDC": "0xe66998533a1992ecE9eA99cDf47686F4fc8458E0" + } + } + diff --git a/projects/savvy/index.js b/projects/savvy/index.js index a96001535eb..4e3a9da94a8 100644 --- a/projects/savvy/index.js +++ b/projects/savvy/index.js @@ -1,48 +1,16 @@ -const sdk = require('@defillama/sdk'); -const abi = require("./abi.json"); const contracts = require("./contracts.json"); +const { sumTokens2 } = require("../helper/unwrapLPs"); -async function tvl(_, _1, _2, { api }) { - let balances = {}; - let balance = (await sdk.api.abi.call({ - abi: abi.totalValueLocked, - chain: "arbitrum", - target: contracts.infoAggregator - }) - ).output; - await sdk.util.sumSingleBalance(balances, `0x43aB8f7d2A8Dd4102cCEA6b438F6d747b1B9F034`, balance, api.chain); - console.log("tvlVal", balances); - return balances; -} - -async function staking() { - let balances = {}; - let balance = (await sdk.api.abi.call({ - abi: abi.totalStaked, - chain: "arbitrum", - target: contracts.infoAggregator - }) - ).output; - sdk.util.sumSingleBalance(balances, `arbitrum:${contracts.infoAggregator}`, balance); - console.log("stakingVal", balances); - return balances; -} - -async function borrowed() { - const borrowedVal = (await sdk.api.abi.call({ - abi: abi.totalDebt, - target: contracts.infoAggregator - }) - ).output; - console.log("borrowedVal", borrowedVal); - return Math.min(borrowedVal, 0); +function tvl(chain) { + return async (timestamp, block, chainBlocks, { api }) => { + const tokens = Object.values(contracts.savvyTokens).concat(Object.values(contracts.baseTokens)).concat(Object.values(contracts.yieldTokens)); + await sumTokens2({ tokens, api, owners: Object.values(contracts.tokenHolders) }) + }; } module.exports = { methodology: 'The calculated TVL is the current USD sum of all user deposits and SVY tokens staked in veSVY.', arbitrum: { - tvl, - //staking, - //borrowed + tvl: tvl("arbitrum") } } \ No newline at end of file From d47ed2b82b47aab503df9e874d6622cd7d9d3aad Mon Sep 17 00:00:00 2001 From: Akshay Gupta Date: Tue, 27 Jun 2023 15:48:12 -0400 Subject: [PATCH 0115/1974] address feedback --- projects/savvy/contracts.json | 4 ---- projects/savvy/index.js | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/projects/savvy/contracts.json b/projects/savvy/contracts.json index 25f742df3da..e834dc267a2 100644 --- a/projects/savvy/contracts.json +++ b/projects/savvy/contracts.json @@ -1,10 +1,6 @@ { "infoAggregator": "0x68D54ff41BA47355b95Bd477Bcf4d5ff4b2c2A59", "tokenHolders": { - "VeSVY": "0x9aEEe4656F67034B06D99294062feBA1015430ad", - "SavvyBooster": "0xbf837f2C7894cfF859a01d078d7AAa8c47221a2F", - "SavvyRedlist": "0x0d6554A8c6a7D98D4aa05206DaDdbcb3372b8F7F", - "WrapTokenGateway": "0x882e251c1E010205A9f9b0147F3331B4728BB640", "SavvyPositionManagerBTC": "0x3204d81C73F8100766C1691A67078b16Ec7c142c", "SavvyPositionManagerETH": "0x5c4eb1909fB21e39Fc45ee753420AeDeBA07F3EF", "SavvyPositionManagerUSD": "0x36358A1597DB299033b16fda567010D53c0A4EdA", diff --git a/projects/savvy/index.js b/projects/savvy/index.js index 4e3a9da94a8..6eacefd137e 100644 --- a/projects/savvy/index.js +++ b/projects/savvy/index.js @@ -3,7 +3,7 @@ const { sumTokens2 } = require("../helper/unwrapLPs"); function tvl(chain) { return async (timestamp, block, chainBlocks, { api }) => { - const tokens = Object.values(contracts.savvyTokens).concat(Object.values(contracts.baseTokens)).concat(Object.values(contracts.yieldTokens)); + const tokens = Object.values(contracts.baseTokens).concat(Object.values(contracts.yieldTokens)); await sumTokens2({ tokens, api, owners: Object.values(contracts.tokenHolders) }) }; } From 2e82ec26660937071266d019e331a2a55be96b9f Mon Sep 17 00:00:00 2001 From: Akshay Gupta Date: Tue, 27 Jun 2023 16:28:38 -0400 Subject: [PATCH 0116/1974] fix aave yield token --- projects/savvy/contracts.json | 12 ++++++------ projects/savvy/index.js | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/projects/savvy/contracts.json b/projects/savvy/contracts.json index e834dc267a2..41cce45ab1c 100644 --- a/projects/savvy/contracts.json +++ b/projects/savvy/contracts.json @@ -16,9 +16,9 @@ "SavvySageBTC": "0x2fcCd0f67d0722f5EB7c1A404DFF0224544155E3", "SavvySageETH": "0xCd5156Fdd53fD9A0f5bfc37B212DD9c989C10533", "SavvySageUSD": "0x78A370c3d5fFF93Da53a2B088a117244c52AF857", - "AaveAdapterUSDC": "0xcA728C2593ac1912457C8060836CC13Bb61f1B08", - "AaveAdapterWBTC": "0x39440D2528ABc6FBd2E539dA28bbC581f9078161", - "AaveAdapterWETH": "0x4056E92C635595e9b9D5F4F85Ba04220cBd0CbB6", + "savvyAArbWBTC": "0xDD7e69c478288A9596DECc2230A39c7b922413Dd", + "savvyAArbWETH": "0xCaB3886D48bAd0F749ba7e7c7A255b636c64F937", + "savvyAArbUSDC": "0xCdFF8576683E22621f512fc2E6d347A9D241DAd3", "JonesAdapterUSDC": "0x9394b6B85bEab8cba1e4aA35FbBB5C31c258224A" }, "savvyTokens": { @@ -36,9 +36,9 @@ "BTCb": "0x2297aEbD383787A160DD0d9F71508148769342E3" }, "yieldTokens": { - "savvyAArbUSDC": "0xCdFF8576683E22621f512fc2E6d347A9D241DAd3", - "savvyAArbWBTC": "0xDD7e69c478288A9596DECc2230A39c7b922413Dd", - "savvyAArbWETH": "0xCaB3886D48bAd0F749ba7e7c7A255b636c64F937", + "aArbWBTC": "0x078f358208685046a11C85e8ad32895DED33A249", + "aArbWETH": "0xe50fA9b3c56FfB159cB0FCA61F5c9D750e8128c8", + "aArbUSDC": "0x625E7708f30cA75bfd92586e17077590C60eb4cD", "jUSDC": "0xe66998533a1992ecE9eA99cDf47686F4fc8458E0" } diff --git a/projects/savvy/index.js b/projects/savvy/index.js index 6eacefd137e..72d6b843be4 100644 --- a/projects/savvy/index.js +++ b/projects/savvy/index.js @@ -9,7 +9,7 @@ function tvl(chain) { } module.exports = { - methodology: 'The calculated TVL is the current USD sum of all user deposits and SVY tokens staked in veSVY.', + methodology: 'The calculated TVL is the current sum of all base tokens and yield tokens in our contracts.', arbitrum: { tvl: tvl("arbitrum") } From a576a0631f7f307f3df75265cfb2c5b76d92bf94 Mon Sep 17 00:00:00 2001 From: Akshay Gupta Date: Wed, 28 Jun 2023 02:04:38 -0400 Subject: [PATCH 0117/1974] savvy adapter (#6578) * savvy adapter * balances not appearing * tvl test passed * address feedback * fix aave yield token --- projects/savvy/contracts.json | 46 +++++++++++++++++++++++++++++++++++ projects/savvy/index.js | 16 ++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 projects/savvy/contracts.json create mode 100644 projects/savvy/index.js diff --git a/projects/savvy/contracts.json b/projects/savvy/contracts.json new file mode 100644 index 00000000000..41cce45ab1c --- /dev/null +++ b/projects/savvy/contracts.json @@ -0,0 +1,46 @@ +{ + "infoAggregator": "0x68D54ff41BA47355b95Bd477Bcf4d5ff4b2c2A59", + "tokenHolders": { + "SavvyPositionManagerBTC": "0x3204d81C73F8100766C1691A67078b16Ec7c142c", + "SavvyPositionManagerETH": "0x5c4eb1909fB21e39Fc45ee753420AeDeBA07F3EF", + "SavvyPositionManagerUSD": "0x36358A1597DB299033b16fda567010D53c0A4EdA", + "YieldStrategyManagerBTC": "0xdC82E20111767f4a2A76A65BD85E41F7859c7b9f", + "YieldStrategyManagerETH": "0x23627eb1C6692Adf25AD79285FDe2bc6bdf12C82", + "YieldStrategyManagerUSD": "0x09Dde6661fd023cf7c3751555347a5cB8687F806", + "SavvySwapWETH": "0xb5231e17596bEAf436A25B018bd63e5b42e14135", + "SavvySwapBTCb": "0x43be188901F529c11337f28bC1F753a878B2F691", + "SavvySwapWBTC": "0x9A3A3ba687Fcb8AFE6367Eff3A5F5A11F51626DA", + "SavvySwapUSDCe": "0xD9565AB01AA30D7Aa2b982b8b1c740480C1C8497", + "SavvySwapUSDT": "0x0E56d518E5d3F5e6cFCfD46095B6B4024541027b", + "SavvySwapDAI": "0x03fA5a7fA80E5EA464559d21B8843E15b7969c07", + "SavvySageBTC": "0x2fcCd0f67d0722f5EB7c1A404DFF0224544155E3", + "SavvySageETH": "0xCd5156Fdd53fD9A0f5bfc37B212DD9c989C10533", + "SavvySageUSD": "0x78A370c3d5fFF93Da53a2B088a117244c52AF857", + "savvyAArbWBTC": "0xDD7e69c478288A9596DECc2230A39c7b922413Dd", + "savvyAArbWETH": "0xCaB3886D48bAd0F749ba7e7c7A255b636c64F937", + "savvyAArbUSDC": "0xCdFF8576683E22621f512fc2E6d347A9D241DAd3", + "JonesAdapterUSDC": "0x9394b6B85bEab8cba1e4aA35FbBB5C31c258224A" + }, + "savvyTokens": { + "SVY": "0x43aB8f7d2A8Dd4102cCEA6b438F6d747b1B9F034", + "svBTC": "0xeEE18334c414A47FB886a7317E1885b2Bfb8c2A6", + "svETH": "0xf7728582002ef82908c8242CF552E969BA863Ffa", + "svUSD": "0xF202Ab403Cd7E90197ec0f010ee897E283037706" + }, + "baseTokens": { + "WETH": "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1", + "WBTC": "0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f", + "USDCe": "0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8", + "USDT": "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9", + "DAI": "0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1", + "BTCb": "0x2297aEbD383787A160DD0d9F71508148769342E3" + }, + "yieldTokens": { + "aArbWBTC": "0x078f358208685046a11C85e8ad32895DED33A249", + "aArbWETH": "0xe50fA9b3c56FfB159cB0FCA61F5c9D750e8128c8", + "aArbUSDC": "0x625E7708f30cA75bfd92586e17077590C60eb4cD", + "jUSDC": "0xe66998533a1992ecE9eA99cDf47686F4fc8458E0" + } + +} + diff --git a/projects/savvy/index.js b/projects/savvy/index.js new file mode 100644 index 00000000000..72d6b843be4 --- /dev/null +++ b/projects/savvy/index.js @@ -0,0 +1,16 @@ +const contracts = require("./contracts.json"); +const { sumTokens2 } = require("../helper/unwrapLPs"); + +function tvl(chain) { + return async (timestamp, block, chainBlocks, { api }) => { + const tokens = Object.values(contracts.baseTokens).concat(Object.values(contracts.yieldTokens)); + await sumTokens2({ tokens, api, owners: Object.values(contracts.tokenHolders) }) + }; +} + +module.exports = { + methodology: 'The calculated TVL is the current sum of all base tokens and yield tokens in our contracts.', + arbitrum: { + tvl: tvl("arbitrum") + } +} \ No newline at end of file From b54edc5472b086af694cc1907ff2ef4709acbaaa Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 28 Jun 2023 09:08:54 +0200 Subject: [PATCH 0118/1974] track phoenix dex on solana --- projects/ellipisis-phoenix/index.js | 26 +++++++++++++ projects/helper/utils/solana/layout.js | 2 + .../utils/solana/layouts/phoenix-dex.js | 37 +++++++++++++++++++ 3 files changed, 65 insertions(+) create mode 100644 projects/ellipisis-phoenix/index.js create mode 100644 projects/helper/utils/solana/layouts/phoenix-dex.js diff --git a/projects/ellipisis-phoenix/index.js b/projects/ellipisis-phoenix/index.js new file mode 100644 index 00000000000..de7fc653afa --- /dev/null +++ b/projects/ellipisis-phoenix/index.js @@ -0,0 +1,26 @@ +const { sumTokens2, getConnection, decodeAccount, } = require('../helper/solana') +const { PublicKey } = require('@solana/web3.js') + +async function tvl() { + const program = new PublicKey('PhoeNiXZ8ByJGLkxNfZRnkUfjvmuYqLR89jjFHGqdXY') + const connection = getConnection(); + const accounts0 = await connection.getProgramAccounts(program, { + filters: [{ + dataSize: 445536 + }] + }) + const accounts1 = await connection.getProgramAccounts(program, { + filters: [{ + dataSize: 1723488 + }] + }) + const accounts = [...accounts0, ...accounts1] + const tokenAccounts = accounts.map(i => decodeAccount('phoenix', i.account)) + .map(i => [i.baseParams.vaultKey, i.quoteParams.vaultKey]).flat() + return sumTokens2({ tokenAccounts, }) +} + +module.exports = { + timetravel: false, + solana: { tvl }, +} diff --git a/projects/helper/utils/solana/layout.js b/projects/helper/utils/solana/layout.js index a9f3da336f3..bf14f62c905 100644 --- a/projects/helper/utils/solana/layout.js +++ b/projects/helper/utils/solana/layout.js @@ -1,6 +1,7 @@ const { PublicKey } = require("@solana/web3.js"); const { parseLido, parseLidoValidatorList } = require('./layouts/lido') +const { parsePhoenix } = require('./layouts/phoenix-dex') const { RAYDIUM_LIQUIDITY_STATE_LAYOUT_CLMM, RAYDIUM_STABLE_STATE_LAYOUT_V1, } = require('./layouts/raydium-layout') const { INVESTIN_FUND_DATA, } = require('./layouts/investin-layout') const { MARKET_STATE_LAYOUT_V3, } = require('./layouts/openbook-layout') @@ -49,6 +50,7 @@ const customDecoders = { raydiumCLMM: defaultParseLayout(RAYDIUM_LIQUIDITY_STATE_LAYOUT_CLMM), raydiumLPStable: defaultParseLayout(RAYDIUM_STABLE_STATE_LAYOUT_V1), fluxbeam: defaultParseLayout(TokenSwapLayout), + phoenix: parsePhoenix, } function decodeAccount(layout, accountInfo) { diff --git a/projects/helper/utils/solana/layouts/phoenix-dex.js b/projects/helper/utils/solana/layouts/phoenix-dex.js new file mode 100644 index 00000000000..9df740147d2 --- /dev/null +++ b/projects/helper/utils/solana/layouts/phoenix-dex.js @@ -0,0 +1,37 @@ +const { + struct, s32, u8, u16, seq, blob, Layout, bits, u32, publicKey, uint64, u64, uint128, u128, +} = require('./layout-base') + +const TOKEN_PARAMS = [ + u32('decimals'), + u32('vaultBump'), + publicKey('mintKey'), + publicKey('vaultKey'), +] + +// https://github.com/Ellipsis-Labs/phoenix-sdk/blob/4663c670bb8951b4cbf5a062c54de5cd638b231c/typescript/phoenix-sdk/src/types/MarketHeader.ts#L35 +const MARKET_STATE_HEADER = struct([ + + u64('discriminant'), + u64('status'), + + struct([ + u64('bidsSize'), + u64('asksSize'), + u64('numSeats'), + ], 'marketSizeParams'), + struct(TOKEN_PARAMS, 'baseParams'), + u64('baseLotSize'), + struct(TOKEN_PARAMS, 'quoteParams'), + u64('quoteLotSize'), +]); + +const parsePhoenix = (account) => { + const { data } = account; + const buffer = Buffer.from(data.slice(0, MARKET_STATE_HEADER.span)); + return MARKET_STATE_HEADER.decode(buffer); +} + +module.exports = { + parsePhoenix, +} \ No newline at end of file From 05e7c44bd87834f7dc3112fbd07c40c6d6b620ea Mon Sep 17 00:00:00 2001 From: define Date: Wed, 28 Jun 2023 10:08:27 +0100 Subject: [PATCH 0119/1974] savvy treasury --- projects/treasury/savvy.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 projects/treasury/savvy.js diff --git a/projects/treasury/savvy.js b/projects/treasury/savvy.js new file mode 100644 index 00000000000..be6fcceb937 --- /dev/null +++ b/projects/treasury/savvy.js @@ -0,0 +1,17 @@ +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0x4f54cab19b61138e3c622a0bd671c687481ec030"; +const SVY = "0x43aB8f7d2A8Dd4102cCEA6b438F6d747b1B9F034" +module.exports = treasuryExports({ + arbitrum: { + tokens: [ + nullAddress, + '0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8', + '0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f', + '0x82aF49447D8a07e3bd95BD0d56f35241523fBab1', + '0xaf88d065e77c8cC2239327C5EDb3A432268e5831' + ], + owners: [treasury,], + ownTokens: [SVY], + }, +}) \ No newline at end of file From 8da95db9e71c9d2cd79703b0fe8c0c8282ff5912 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 28 Jun 2023 14:58:23 +0530 Subject: [PATCH 0120/1974] Kinza (#6670) * add kinza tvl and borrow data based on standard aave helper the address 0x37D7 is PoolAddressesProviderRegistry from aave-V3 * minor fix --------- Co-authored-by: personal <128370392+MuesliW@users.noreply.github.com> --- projects/kinza/index.js | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 projects/kinza/index.js diff --git a/projects/kinza/index.js b/projects/kinza/index.js new file mode 100644 index 00000000000..0315e3b6ec3 --- /dev/null +++ b/projects/kinza/index.js @@ -0,0 +1,9 @@ +const { aaveExports } = require("../helper/aave"); + +module.exports = { + methodology: + "Counts the tokens locked in the contracts to be used as collateral to borrow or to earn yield. Borrowed coins are not counted towards the TVL, so only the coins actually locked in the contracts are counted. There's multiple reasons behind this but one of the main ones is to avoid inflating the TVL through cycled lending", + bsc: { + ...aaveExports('bsc', '0x37D7Eb561E189895E5c8601Cd03EEAB67C269189', undefined, ['0x09ddc4ae826601b0f9671b9edffdf75e7e6f5d61']), + }, +}; From 8cd037db6beb868abbfa21612fa14c9a35475669 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 28 Jun 2023 11:29:37 +0200 Subject: [PATCH 0121/1974] kinza: minor fix --- projects/kinza/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/projects/kinza/index.js b/projects/kinza/index.js index 0315e3b6ec3..d40ac2057c0 100644 --- a/projects/kinza/index.js +++ b/projects/kinza/index.js @@ -4,6 +4,8 @@ module.exports = { methodology: "Counts the tokens locked in the contracts to be used as collateral to borrow or to earn yield. Borrowed coins are not counted towards the TVL, so only the coins actually locked in the contracts are counted. There's multiple reasons behind this but one of the main ones is to avoid inflating the TVL through cycled lending", bsc: { - ...aaveExports('bsc', '0x37D7Eb561E189895E5c8601Cd03EEAB67C269189', undefined, ['0x09ddc4ae826601b0f9671b9edffdf75e7e6f5d61']), + ...aaveExports('bsc', '0x37D7Eb561E189895E5c8601Cd03EEAB67C269189', undefined, ['0x09ddc4ae826601b0f9671b9edffdf75e7e6f5d61'], { + v3: true, + }), }, }; From 71782af9e0eb33497931e983e963435a4103c690 Mon Sep 17 00:00:00 2001 From: define Date: Wed, 28 Jun 2023 10:56:14 +0100 Subject: [PATCH 0122/1974] remove movr and harmony chain from templar --- projects/templar/api.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/projects/templar/api.js b/projects/templar/api.js index aa6c1aeb5e7..cd075bf1b66 100644 --- a/projects/templar/api.js +++ b/projects/templar/api.js @@ -5,6 +5,7 @@ module.exports = { tvl: index.bsc.tvl, staking: index.bsc.staking, }, + /* moonriver: { tvl: () => 0, staking: index.moonriver.staking, @@ -13,4 +14,5 @@ module.exports = { tvl: () => 0, staking: index.harmony.staking, }, + */ } \ No newline at end of file From 5477f67223aa56368c02b2810c282b910aec941e Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 28 Jun 2023 13:13:59 +0200 Subject: [PATCH 0123/1974] add hallmarks --- projects/midas-capital/index.js | 6 ++++++ projects/themis-exchange/index.js | 33 +++++++++++++++++++------------ 2 files changed, 26 insertions(+), 13 deletions(-) diff --git a/projects/midas-capital/index.js b/projects/midas-capital/index.js index e4d2cc09e90..eb015c39e4b 100644 --- a/projects/midas-capital/index.js +++ b/projects/midas-capital/index.js @@ -2,6 +2,12 @@ const sdk = require("@defillama/sdk"); const { compoundExportsWithAsyncTransform } = require("../helper/compound"); +module.exports = { + hallmarks: [ + [Math.floor(new Date('2023-06-17')/1e3), 'Protocol was exploited for $600k'], + ] +} + const pools = { bsc: { pools: [ diff --git a/projects/themis-exchange/index.js b/projects/themis-exchange/index.js index af2385ae500..7200b0660bb 100644 --- a/projects/themis-exchange/index.js +++ b/projects/themis-exchange/index.js @@ -4,6 +4,11 @@ const config = { arbitrum: { addressProvider: '0x75F805e2fB248462e7817F0230B36E9Fae0280Fc', }, } +module.exports = { + hallmarks: [ + [Math.floor(new Date('2023-06-27')/1e3), 'Protocol was exploited and lost $370k'], + ], +}; Object.keys(config).forEach(chain => { const { addressProvider } = config[chain] module.exports[chain] = { @@ -12,22 +17,24 @@ Object.keys(config).forEach(chain => { const tokenData = await api.multiCall({ abi: abi.getReserveData, target: addressProvider, calls: tokens, }) return sumTokens2({ api, tokensAndOwners2: [tokens, tokenData.map(i => i.aTokenAddress)], }) }, - borrowed: async (_, _b, _cb, { api, }) => { - const tokens = await api.call({ abi: abi.getReservesList, target: addressProvider }) - const tokenData = await api.multiCall({ abi: abi.getReserveData, target: addressProvider, calls: tokens, }) - const vDebtSupply = await api.multiCall({ abi: 'erc20:totalSupply', calls: tokenData.map(i => i.variableDebtTokenAddress), }) - const sDebtSupply = await api.multiCall({ abi: 'erc20:totalSupply', calls: tokenData.map(i => i.stableDebtTokenAddress), }) - tokens.forEach((token, i) => { - const variableDebt = vDebtSupply[i] - const stableDebt = sDebtSupply[i] - api.add(token, variableDebt) - api.add(token, stableDebt) - }) - return api.getBalances() - }, + // borrowed, } }) +async function borrowed(_, _b, _cb, { api, }) { + const tokens = await api.call({ abi: abi.getReservesList, target: addressProvider }) + const tokenData = await api.multiCall({ abi: abi.getReserveData, target: addressProvider, calls: tokens, }) + const vDebtSupply = await api.multiCall({ abi: 'erc20:totalSupply', calls: tokenData.map(i => i.variableDebtTokenAddress), }) + const sDebtSupply = await api.multiCall({ abi: 'erc20:totalSupply', calls: tokenData.map(i => i.stableDebtTokenAddress), }) + tokens.forEach((token, i) => { + const variableDebt = vDebtSupply[i] + const stableDebt = sDebtSupply[i] + api.add(token, variableDebt) + api.add(token, stableDebt) + }) + return api.getBalances() +} + const abi = { "getReserveData": "function getReserveData(address asset) view returns (tuple(tuple(uint256 data) configuration, uint128 liquidityIndex, uint128 currentLiquidityRate, uint128 variableBorrowIndex, uint128 currentVariableBorrowRate, uint128 currentStableBorrowRate, uint40 lastUpdateTimestamp, uint16 id, address aTokenAddress, address stableDebtTokenAddress, address variableDebtTokenAddress, address interestRateStrategyAddress, uint128 accruedToTreasury, uint128 unbacked, uint128 isolationModeTotalDebt))", "getReservesList": "address[]:getReservesList", From 48063d67ffed8bb05e4c4037f110b6d8ee63c973 Mon Sep 17 00:00:00 2001 From: 0xjosaphat <120175614+0xjosaphat@users.noreply.github.com> Date: Wed, 28 Jun 2023 13:15:37 +0200 Subject: [PATCH 0124/1974] added new chain polygon_zkevm (#6668) * added new chain polygon_zkevm * added marker for new chain launch on Polygon zkEVM --- projects/swapline/index.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/projects/swapline/index.js b/projects/swapline/index.js index 166dae27e56..a380e758817 100644 --- a/projects/swapline/index.js +++ b/projects/swapline/index.js @@ -3,6 +3,7 @@ const { sumTokens2 } = require('../helper/unwrapLPs') const factories = { fantom: '0x640801a6983c109805E928dc7d9794080C21C88E', optimism: '0xd08C98F6409fCAe3E61f3157B4147B6595E60cf3', + polygon_zkevm: '0x5A5c0C4832828FF878CE3ab4fEc44d21200b1496', } async function tvl(_, _b, _cb, { api, }) { @@ -29,7 +30,8 @@ async function tvl(_, _b, _cb, { api, }) { module.exports = { hallmarks: [ - [1682298000,"Launch on Optimism"] + [1682298000,"Launch on Optimism"], + [1687827600,"Launch on Polygon zkEVM"] ], methodology: 'We count the token balances in in different liquidity book contracts', fantom:{ @@ -38,4 +40,7 @@ module.exports = { optimism:{ tvl, }, + polygon_zkevm:{ + tvl, + }, }; \ No newline at end of file From c9dffb403037a05cf636545692958a15e91121a4 Mon Sep 17 00:00:00 2001 From: happywomwom-wombat <129473631+happywomwom-wombat@users.noreply.github.com> Date: Wed, 28 Jun 2023 19:16:01 +0800 Subject: [PATCH 0125/1974] update fusd-pool (#6667) --- projects/wombat-exchange/config.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/wombat-exchange/config.js b/projects/wombat-exchange/config.js index 35e049480b6..ec1411a7fac 100644 --- a/projects/wombat-exchange/config.js +++ b/projects/wombat-exchange/config.js @@ -42,6 +42,7 @@ module.exports = { jUSDC: "0xc7a6bA5F28993BaDb566007bD2E0CB253c431974", ankrETH: "0xB9bdfE449Da096256Fe7954Ef61A18eE195Db77B", wstETH: "0xe14302040c0A1eb6fB5A4A79EfA46D60029358d9", + fUSD: "0x956454C7BE9318863297309183C79b793D370401", }, }, hallmarks: [ From 781b9e64edd3b32e9ea29ab3981956747a1a6407 Mon Sep 17 00:00:00 2001 From: define Date: Wed, 28 Jun 2023 12:44:42 +0100 Subject: [PATCH 0126/1974] kinza treasury --- projects/treasury/kinza.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 projects/treasury/kinza.js diff --git a/projects/treasury/kinza.js b/projects/treasury/kinza.js new file mode 100644 index 00000000000..ba55a6091e8 --- /dev/null +++ b/projects/treasury/kinza.js @@ -0,0 +1,13 @@ +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0x65FDCD48c4807F67429Bdc731d6964f5553CdB36"; + +module.exports = treasuryExports({ + bsc: { + tokens: [ + nullAddress, + '0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c', + ], + owners: [treasury,], + }, +}) \ No newline at end of file From 90236836be504794a0e96798f89b688e27f22416 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 28 Jun 2023 14:59:37 +0200 Subject: [PATCH 0127/1974] lint fix --- projects/themis-exchange/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/themis-exchange/index.js b/projects/themis-exchange/index.js index 7200b0660bb..f93a5b4685b 100644 --- a/projects/themis-exchange/index.js +++ b/projects/themis-exchange/index.js @@ -22,6 +22,7 @@ Object.keys(config).forEach(chain => { }) async function borrowed(_, _b, _cb, { api, }) { + const { addressProvider } = config[api.chain] const tokens = await api.call({ abi: abi.getReservesList, target: addressProvider }) const tokenData = await api.multiCall({ abi: abi.getReserveData, target: addressProvider, calls: tokens, }) const vDebtSupply = await api.multiCall({ abi: 'erc20:totalSupply', calls: tokenData.map(i => i.variableDebtTokenAddress), }) From eecd26a3e279aee76cb32f62bd74d214b592b37e Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 28 Jun 2023 15:49:05 +0200 Subject: [PATCH 0128/1974] track concordium --- projects/concordex-io/index.js | 15 +++++++++++++++ projects/helper/chains.json | 1 + 2 files changed, 16 insertions(+) create mode 100644 projects/concordex-io/index.js diff --git a/projects/concordex-io/index.js b/projects/concordex-io/index.js new file mode 100644 index 00000000000..8f02673e894 --- /dev/null +++ b/projects/concordex-io/index.js @@ -0,0 +1,15 @@ +const { post } = require('../helper/http') + +async function tvl(_, _b, _cb, { api, }) { + const body = {"jsonrpc":"2.0","method":"liquidity_pools_list","params":{"filter":{"sort":"EFFECTIVE_TVL","page":1,"is_desc":true,"search":"","limit":999}},"id":0} + const { result: { pools }} = await post('https://cdex-liquidity-pool.concordex.io/v1/rpc', body) + return { + tether: pools.reduce((acc, i) => acc + +i.tvl, 0) + } +} + +module.exports = { + misrepresentedTokens: true, + timetravel: false, + concordium: { tvl }, +} \ No newline at end of file diff --git a/projects/helper/chains.json b/projects/helper/chains.json index 4ebafa22a22..204efe1b7d0 100644 --- a/projects/helper/chains.json +++ b/projects/helper/chains.json @@ -30,6 +30,7 @@ "clover", "clv", "comdex", + "concordium", "conflux", "core", "cosmos", From 61aed6047e73efc4f70f62b3c8a928a178b9299d Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 28 Jun 2023 15:53:02 +0200 Subject: [PATCH 0129/1974] fix pancakeswap v3 --- projects/helper/uniswapV3.js | 2 +- projects/pancakeswap-v3/index.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/helper/uniswapV3.js b/projects/helper/uniswapV3.js index c8176af9e94..1075b062b8c 100644 --- a/projects/helper/uniswapV3.js +++ b/projects/helper/uniswapV3.js @@ -31,7 +31,7 @@ function uniV3Export(config) { onlyArgs: true, }) - return sumTokens2({ api, ownerTokens: logs.map(i => [[i.token0, i.token1], i.pool]), blacklistedTokens, }) + return sumTokens2({ api, ownerTokens: logs.map(i => [[i.token0, i.token1], i.pool]), blacklistedTokens, permitFailure: logs.length > 5000 }) } } }) diff --git a/projects/pancakeswap-v3/index.js b/projects/pancakeswap-v3/index.js index ad6cb2748fa..e537c579807 100644 --- a/projects/pancakeswap-v3/index.js +++ b/projects/pancakeswap-v3/index.js @@ -7,6 +7,7 @@ module.exports = uniV3Export({ '0xf8c7f403829cc0f9a37f126a3da41358c232acdf', '0x95e7c70b58790a1cbd377bc403cd7e9be7e0afb1', '0x454f4597582df557c2757403f47d3f3bbb890d43', + '0x121a3fba8456ebce13964363ba35fea00c2aa3d2', ] }, ethereum: { factory: '0x0bfbcf9fa4f9c56b0f40a671ad40e0805a091865', fromBlock: 16950685, }, }) From 3ecfd1bd13e8aabe8e0a505dd4a65a6fad685b7f Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Wed, 28 Jun 2023 15:12:36 +0100 Subject: [PATCH 0130/1974] pcs polygon_zkevm --- projects/pancake-swap/index.js | 3 +++ projects/pancakeswap-v3/index.js | 1 + 2 files changed, 4 insertions(+) diff --git a/projects/pancake-swap/index.js b/projects/pancake-swap/index.js index 1a82c396f60..1ce33bfabd8 100644 --- a/projects/pancake-swap/index.js +++ b/projects/pancake-swap/index.js @@ -82,6 +82,9 @@ module.exports = { staking: stakings(["0x556B9306565093C855AEA9AE92A594704c2Cd59e"], "0x152649ea73beab28c5b49b26eb48f7ead6d4c898", "ethereum"), tvl: getUniTVL({ chain: 'ethereum', factory: '0x1097053Fd2ea711dad45caCcc45EfF7548fCB362', useDefaultCoreAssets: true, }) }, + polygon_zkevm: { + tvl: getUniTVL({ chain: 'polygon_zkevm', factory: '0x02a84c1b3BBD7401a5f7fa98a384EBC70bB5749E', useDefaultCoreAssets: true, }) + }, aptos: dexExport({ account: '0xc7efb4076dbe143cbcd98cfaaa929ecfc8f299203dfff63b95ccb6bfe19850fa', poolStr: 'swap::TokenPairReserve', diff --git a/projects/pancakeswap-v3/index.js b/projects/pancakeswap-v3/index.js index e537c579807..91906c7488b 100644 --- a/projects/pancakeswap-v3/index.js +++ b/projects/pancakeswap-v3/index.js @@ -10,4 +10,5 @@ module.exports = uniV3Export({ '0x121a3fba8456ebce13964363ba35fea00c2aa3d2', ] }, ethereum: { factory: '0x0bfbcf9fa4f9c56b0f40a671ad40e0805a091865', fromBlock: 16950685, }, + polygon_zkevm: { factory: '0x0BFbCF9fa4f9C56B0F40a671Ad40E0805A091865', fromBlock: 750148, }, }) From a3b274890d093fd2f5eef606cb3647d61eaa448b Mon Sep 17 00:00:00 2001 From: ftm1337 <84405345+ftm1337@users.noreply.github.com> Date: Wed, 28 Jun 2023 14:19:25 +0000 Subject: [PATCH 0131/1974] Add TVL Adapter: Equity (#6656) * Add TVL Adapter: Equity Spot * Equity Spot TVL - Using gintoki's method (gmxExports) * TVL Adapter: Equity Using "Equity" as project name for TVL since TVL is not categorizable as Spot or Derivatives. --- projects/equity/index.js | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 projects/equity/index.js diff --git a/projects/equity/index.js b/projects/equity/index.js new file mode 100644 index 00000000000..cf3c77cb8b3 --- /dev/null +++ b/projects/equity/index.js @@ -0,0 +1,8 @@ +// Equity - Central Vaults +const { gmxExports } = require("../helper/gmx"); + +module.exports = { + fantom: { + tvl: gmxExports({ vault: '0x9e4105f9e2284532474f69e65680e440f4c91cb8' }), // Vault 01 + }, +}; From fff8ea6a9c3116a76d37e570a6ed407252fd5142 Mon Sep 17 00:00:00 2001 From: Josh Weintraub Date: Wed, 28 Jun 2023 11:20:45 -0400 Subject: [PATCH 0132/1974] Modify Adapter for Revest Finance (#6661) * tentatively working adapter using multicall * cleaned up and added comments and staking for tokenVaultV2 --- projects/revest/index.js | 212 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 206 insertions(+), 6 deletions(-) diff --git a/projects/revest/index.js b/projects/revest/index.js index 1b788513fcf..0cd88d51138 100644 --- a/projects/revest/index.js +++ b/projects/revest/index.js @@ -1,21 +1,48 @@ const { sumTokens2, } = require("../helper/unwrapLPs") const { covalentGetTokens, } = require("../helper/http") const { getUniqueAddresses } = require('../helper/utils') +const sdk = require("@defillama/sdk"); + +const CutoffABI = "function FNFT_CUTOFF() external view returns (uint256)" +const numFNFTSABI = "function fnftsCreated() external view returns (uint256)" +const getFNFTSupplyABI = "function getSupply(uint256 fnftId) external view returns (uint256)" +const getFNFTConfigABI = "function getFNFT(uint256 fnftId) external view returns (tuple(address asset,,,,,,,) memory)" +const balanceOfABI = "function balanceOf(address account) view returns (uint256)" +const getWalletABI = "function getFNFTAddress(uint256 fnftId) external view returns (address)" + +const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000' const config = { ethereum: { holder: '0xA81bd16Aa6F6B25e66965A2f842e9C806c0AA11F', revest: '0x120a3879da835a5af037bb2d1456bebd6b54d4ba', + tokenVaultV2: '0xD672f1E3411c23Edbb49e8EB6C6b1564b2BF8E17', + fnftHandler: '0xa07E6a51420EcfCB081917f40423D29529705e8a' }, polygon: { holder: '0x3cCc20d960e185E863885913596b54ea666b2fe7', + tokenVaultV2: '0xd2c6eB7527Ab1E188638B86F2c14bbAd5A431d78', + fnftHandler: '0x6c111d0b0c5f6577de586f7df262f15a6741ddb7' }, fantom: { holder: '0x3923E7EdBcb3D0cE78087ac58273E732ffFb82cf', + tokenVaultV2: '0x0ca61c96d1E0bE5F80f4773be367f4bF2025f224', + fnftHandler: '0xA6f5efC3499d41fF1Eca9d325cfe13C913a85F45' }, avax: { holder: '0x955a88c27709a1EEf4ACa0df0712c67B48240919', + fnftHandler: '0xd6E44901Ee92c85D7f019BdaF05cbD779f36Edaa' + }, + optimism: { + tokenVaultV2: '0x490867a64746AC33f721A778dD8C30BBb0074055', + fnftHandler: '0xA002Dc3E3C163732F4F5e6F941C87b61B5Afca74', + holder: '0x490867a64746AC33f721A778dD8C30BBb0074055' }, + arbitrum: { + tokenVaultV2: '0x209F3F7750d4CC52776e3e243717b3A8aDE413eB', + fnftHandler: '0xd90D465631a1718FDB3eA64C39F41290Addf70da', + holder: '0x209F3F7750d4CC52776e3e243717b3A8aDE413eB' + } } module.exports = { @@ -25,22 +52,195 @@ module.exports = { methodology: "We list all tokens in our vault and sum them together", }; - Object.keys(config).forEach(chain => { - const { holder, revest, } = config[chain] + const { holder, revest, tokenVaultV2, fnftHandler} = config[chain] module.exports[chain] = { tvl: async (_, _b, _1, { api }) => { + let balances = {} + const blacklist = [] if (revest) blacklist.push(revest.toLowerCase()) + blacklist.push(ZERO_ADDRESS.toLowerCase()) + + let owners = [] + + if (tokenVaultV2 != null) { + + let info = await api.batchCall([ + { + target: tokenVaultV2, + abi: CutoffABI, + chain: chain + }, + { + target: fnftHandler, + abi: numFNFTSABI, + chain: chain + } + ]) + + let cutoff = Number(info[0]) + let numFNFTS = Number(info[1]) + + //Build the Multicall to get the supply of each FNFT to check for ones that still exist + let fnftSupplyCalls = [] + for(let x = cutoff; x < numFNFTS; x++) { + fnftSupplyCalls.push({ + target: fnftHandler, + params: x, + }) + } + + //Get the supply of each to determine if an FNFT is still alive by supply > 0 + let fnftSupplys = await sdk.api.abi.multiCall({ + calls: fnftSupplyCalls, + abi: getFNFTSupplyABI, + requery: true, + permitFailure: false, + chain: chain + }) + + //If the FNFT still exists, track it's ID + let aliveFNFTCalls = [] + let aliveFNFTS = {} + fnftSupplys.output.forEach(supply => { + if (supply.output != 0) { + + //Track the supply of the FNFT + aliveFNFTS[supply.input.params[0]] = supply.output + + aliveFNFTCalls.push({ + target: tokenVaultV2, + params: supply.input.params[0], + }) + } + }) + + //Get the asset of the FNFT + let fnftConfigs = await sdk.api.abi.multiCall({ + calls: aliveFNFTCalls, + abi: getFNFTConfigABI, + requery: true, + permitFailure: false, + chain: chain + }) + + + //Link each FNFTId to its underlying token + let tokenAddressesPerFNFT = {} + let walletCalls = [] + fnftConfigs.output.forEach(config => { + if (!blacklist.includes(config.output[0].toLowerCase())) { + tokenAddressesPerFNFT[config.input.params[0]] = config.output[0] + + walletCalls.push({ + target: tokenVaultV2, + params: [config.input.params[0]], + }) + } + + }) + + //Get the wallet for each FNFT + let wallets = await sdk.api.abi.multiCall({ + abi: getWalletABI, + calls: walletCalls, + chain: chain, + requery: true, + permitFailure: false, + }) + + //Prepare Calldata to check the balance of each token in each wallet + let balanceOfMultiCalls = [] + wallets.output.forEach(wallet => { + balanceOfMultiCalls.push({ + target: tokenAddressesPerFNFT[wallet.input.params[0]], + params: wallet.output, + }) + }) + + let multiCallBalances = await sdk.api.abi.multiCall({ + abi: balanceOfABI, + calls: balanceOfMultiCalls, + chain: chain, + requery: true, + permitFailure: false, + }) + + //Record balances, increasing stored amount if necessary + multiCallBalances.output.forEach(balance => { + if (balances[balance.input.target] == undefined) { + balances[balance.input.target] = 0 + } + + balances[balance.input.target] = (Number(balances[balance.input.target]) + Number(balance.output)) + + }) + + } + + //Get values in tokenVaultV1 + owners.push(holder); let tokens = await covalentGetTokens(holder, api.chain) tokens = getUniqueAddresses(tokens).filter(t => !blacklist.includes(t)) // filter out staking and LP tokens - return sumTokens2({ api, owner: holder, tokens, }) + let tokenVaultV1Balances = await sumTokens2({ api, owners: owners, tokens, }) + + //For each key in V1 Balances append to regular balances and return + Object.keys(balances).forEach(key => { + if (tokenVaultV1Balances[key] == undefined) { + tokenVaultV1Balances[`${chain}:${key}`] = 0 + } + tokenVaultV1Balances[`${chain}:${key}`] += balances[key] + }) + return tokenVaultV1Balances; }, } if (revest) module.exports[chain].staking = async (_, _b, _1, { api }) => { - return sumTokens2({ api, owner: holder, tokens: [revest] }) - } -}) + //Get the number of FNFTS for the TokenVaultV2 + let info = await api.batchCall([ + { + target: config[chain].tokenVaultV2, + abi: CutoffABI, + chain: chain + }, + { + target: config[chain].fnftHandler, + abi: numFNFTSABI, + chain: chain + } + ]) + + let cutoff = Number(info[0]) + let numFNFTS = Number(info[1]) + //Build Multicall Data + let calls = [] + for(let x = cutoff; x < numFNFTS; x++) { + calls.push({ + target: config[chain].tokenVaultV2, + params: [x] + }) + } + + //Get the wallet address for each FNFT via multicall + let walletMultiCallList = await sdk.api.abi.multiCall({ + abi: getWalletABI, + calls: calls, + chain: chain, + requery: true, + permitFailure: false + }) + let wallets = [] + walletMultiCallList.output.forEach(wallet => { + // console.log(`output: ${JSON.stringify(wallet)}`) + wallets.push(wallet.output) + }) + + wallets.push(holder); + + //Return the balance of revest in every wallet. + return sumTokens2({ api, owners: wallets, tokens: [revest] }) + } +}) \ No newline at end of file From 15afb96f1a33bbf18e28dd591ee7767114fec355 Mon Sep 17 00:00:00 2001 From: riordanp Date: Wed, 28 Jun 2023 20:06:25 +0100 Subject: [PATCH 0133/1974] Update Mango adapter (#6674) --- projects/mango-markets/index.js | 81 ++++++++++++++++----------------- 1 file changed, 39 insertions(+), 42 deletions(-) diff --git a/projects/mango-markets/index.js b/projects/mango-markets/index.js index 85a45f55eb5..4a4f9fbbc12 100644 --- a/projects/mango-markets/index.js +++ b/projects/mango-markets/index.js @@ -1,65 +1,62 @@ -const axios = require('axios') +const axios = require("axios"); +const BigNumber = require("bignumber.js"); -const endpoint = 'https://mango-transaction-log.herokuapp.com/v3/stats/spot_stats_hourly?mango-group=mainnet.1' +const mangoGroupId = "78b8f4cGCwmZ9ysPFMWLaLTkkaYnUjwMJYStWe5RTSSX"; +const statsEndpoint = + "https://api.mngo.cloud/data/v4/token-historical-stats?mango-group=" + + mangoGroupId; +const metadataEndpoint = "https://api.mngo.cloud/data/v4/group-metadata"; // Very inefficient function findClosestToDate(values, date) { - let min = values[0]; + let min = values[values.length - 1]; for (const val of values) { - const valDate = new Date(val.time).getTime() - const minDate = new Date(min.time).getTime() + const valDate = new Date(val.date_hour).getTime(); + const minDate = new Date(min.date_hour).getTime(); if (Math.abs(valDate - date) < Math.abs(minDate - date)) { - min = val + min = val; } } - if(Math.abs(new Date(min.time).getTime()-date) > 24*3600*1000){ + if (Math.abs(new Date(min.date_hour).getTime() - date) > 24 * 3600 * 1000) { return { - totalDeposits: 0, - totalBorrows: 0 - } + total_deposits: 0, + total_borrows: 0, + }; } - return min -} - -const coingeckoIds = { - 'ETH': 'ethereum', - 'BTC': 'bitcoin', - 'SOL': 'solana', - 'SRM': 'serum', - 'USDC': 'usd-coin', - 'USDT': 'tether', - 'MNGO': 'mango-markets', - 'RAY': 'raydium', - 'COPE': 'cope', - 'FTT': 'ftx-token', - 'MSOL': 'msol', - 'BNB': 'binancecoin', - 'AVAX': 'avalanche-wormhole', - 'LUNA': 'terra-luna', - 'GMT': 'stepn', + return min; } - async function tvl(timestamp) { const balances = {}; - const stats = await axios.get(endpoint) - const date = new Date(timestamp * 1000).getTime() - Object.entries(coingeckoIds).map(([mangoId, coingeckoId]) => { - const assetDeposits = stats.data.filter(s => s.name === mangoId) + const stats = await axios.get(statsEndpoint); + const metadata = await axios.get(metadataEndpoint); + + const groupMetadata = metadata.data.groups.find( + (g) => g.publicKey == mangoGroupId + ); + + const date = new Date(timestamp * 1000).getTime(); + groupMetadata.tokens.forEach((token) => { + const assetDeposits = stats.data.filter((s) => s.symbol === token.symbol); if (assetDeposits.length > 0) { - const closestVal = findClosestToDate(assetDeposits, date) - balances[coingeckoId] = closestVal.totalDeposits - closestVal.totalBorrows + const closestVal = findClosestToDate(assetDeposits, date); + const nativeBalance = new BigNumber( + (closestVal.total_deposits * Math.pow(10, token.decimals)).toFixed(0) + ); + balances["solana:" + token.mint] = nativeBalance; } - }) - return balances + }); + + return balances; } module.exports = { + // stats api only returns 30 days of data timetravel: false, solana: { - tvl: () => ({}), + tvl: tvl, }, - hallmarks:[ + hallmarks: [ [1665521360, "Oracle Price Manipulation"], - ], -} + ], +}; From 28a9fcb9fabad146f493581043ad0976ee989e0c Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 29 Jun 2023 00:37:31 +0530 Subject: [PATCH 0134/1974] Revert "Update Mango adapter (#6674)" (#6675) This reverts commit 15afb96f1a33bbf18e28dd591ee7767114fec355. --- projects/mango-markets/index.js | 81 +++++++++++++++++---------------- 1 file changed, 42 insertions(+), 39 deletions(-) diff --git a/projects/mango-markets/index.js b/projects/mango-markets/index.js index 4a4f9fbbc12..85a45f55eb5 100644 --- a/projects/mango-markets/index.js +++ b/projects/mango-markets/index.js @@ -1,62 +1,65 @@ -const axios = require("axios"); -const BigNumber = require("bignumber.js"); +const axios = require('axios') -const mangoGroupId = "78b8f4cGCwmZ9ysPFMWLaLTkkaYnUjwMJYStWe5RTSSX"; -const statsEndpoint = - "https://api.mngo.cloud/data/v4/token-historical-stats?mango-group=" + - mangoGroupId; -const metadataEndpoint = "https://api.mngo.cloud/data/v4/group-metadata"; +const endpoint = 'https://mango-transaction-log.herokuapp.com/v3/stats/spot_stats_hourly?mango-group=mainnet.1' // Very inefficient function findClosestToDate(values, date) { - let min = values[values.length - 1]; + let min = values[0]; for (const val of values) { - const valDate = new Date(val.date_hour).getTime(); - const minDate = new Date(min.date_hour).getTime(); + const valDate = new Date(val.time).getTime() + const minDate = new Date(min.time).getTime() if (Math.abs(valDate - date) < Math.abs(minDate - date)) { - min = val; + min = val } } - if (Math.abs(new Date(min.date_hour).getTime() - date) > 24 * 3600 * 1000) { + if(Math.abs(new Date(min.time).getTime()-date) > 24*3600*1000){ return { - total_deposits: 0, - total_borrows: 0, - }; + totalDeposits: 0, + totalBorrows: 0 + } } - return min; + return min } -async function tvl(timestamp) { - const balances = {}; - const stats = await axios.get(statsEndpoint); - const metadata = await axios.get(metadataEndpoint); +const coingeckoIds = { + 'ETH': 'ethereum', + 'BTC': 'bitcoin', + 'SOL': 'solana', + 'SRM': 'serum', + 'USDC': 'usd-coin', + 'USDT': 'tether', + 'MNGO': 'mango-markets', + 'RAY': 'raydium', + 'COPE': 'cope', + 'FTT': 'ftx-token', + 'MSOL': 'msol', + 'BNB': 'binancecoin', + 'AVAX': 'avalanche-wormhole', + 'LUNA': 'terra-luna', + 'GMT': 'stepn', +} - const groupMetadata = metadata.data.groups.find( - (g) => g.publicKey == mangoGroupId - ); - const date = new Date(timestamp * 1000).getTime(); - groupMetadata.tokens.forEach((token) => { - const assetDeposits = stats.data.filter((s) => s.symbol === token.symbol); +async function tvl(timestamp) { + const balances = {}; + const stats = await axios.get(endpoint) + const date = new Date(timestamp * 1000).getTime() + Object.entries(coingeckoIds).map(([mangoId, coingeckoId]) => { + const assetDeposits = stats.data.filter(s => s.name === mangoId) if (assetDeposits.length > 0) { - const closestVal = findClosestToDate(assetDeposits, date); - const nativeBalance = new BigNumber( - (closestVal.total_deposits * Math.pow(10, token.decimals)).toFixed(0) - ); - balances["solana:" + token.mint] = nativeBalance; + const closestVal = findClosestToDate(assetDeposits, date) + balances[coingeckoId] = closestVal.totalDeposits - closestVal.totalBorrows } - }); - - return balances; + }) + return balances } module.exports = { - // stats api only returns 30 days of data timetravel: false, solana: { - tvl: tvl, + tvl: () => ({}), }, - hallmarks: [ + hallmarks:[ [1665521360, "Oracle Price Manipulation"], - ], -}; + ], +} From 637e3bd49ba88d6c20f6aee05c42b4bbdf3fb625 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 29 Jun 2023 08:28:48 +0200 Subject: [PATCH 0135/1974] refactor flamincome --- projects/flamincome.js | 52 ++++++++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 25 deletions(-) diff --git a/projects/flamincome.js b/projects/flamincome.js index 654a958cfdd..51972264727 100644 --- a/projects/flamincome.js +++ b/projects/flamincome.js @@ -1,32 +1,34 @@ +const { sumTokens2 } = require('./helper/unwrapLPs') + const abis = { balance: "uint256:balance", token: "address:token", } -const sdk = require("@defillama/sdk") - - -async function tvl(ts, block) { - - const contracts = [ - '0x54bE9254ADf8D5c8867a91E44f44c27f0c88e88A', - '0x1a389c381a8242B7acFf0eB989173Cd5d0EFc3e3', - '0x1E9DC5d843731D333544e63B2B2082D21EF78ed3', - ] - const calls = contracts.map(t => ({ target: t })) - const { output: token } = await sdk.api.abi.multiCall({ - block, - calls, - abi: abis.token - }) - const { output: balance } = await sdk.api.abi.multiCall({ - block, - calls, - abi: abis.balance - }) - - const balances = {} - token.forEach((t, i) => sdk.util.sumSingleBalance(balances, t.output, balance[i].output)) - return balances + +const vaults = { + "VaultBaselineUSDT": "0x54bE9254ADf8D5c8867a91E44f44c27f0c88e88A", + "VaultBaselinewBTC": "0x1a389c381a8242B7acFf0eB989173Cd5d0EFc3e3", + "VaultBaselinerenBTC": "0xB0B3442b632175B0b7d9521291c51060722C4e8C", + "VaultBaselinewETH": "0x1E9DC5d843731D333544e63B2B2082D21EF78ed3", + "VaultBaselineTUSD": "0xa322AEa77769666453377CC697fbE4C6390b9942", + "VaultBaselineyCRV": "0x5e7B4de4aC8e319fB2ec4bF9Fa98192346f8C99B", + "VaultBaselinesBTC": "0x681D3261CC6d2A18b59f8B53219b96F06BcEeB69", + "VaultBaselineUSDC": "0x3f7E3d82bdDc28d3Eb04F0d0A51e9Fc82db581f0", + "VaultBaselineyDAI": "0x79A2e8C1120d6B5fBfaBD3f7a39CF8473A635742", + "VaultBaselinecrvBTC": "0x483A47247d5cBd420A9c5d2838Ec89776ba8B56B", + "VaultBaselineDAI": "0x163D457fA8247f1A9279B9fa8eF513de116e4327", + "VaultBaselineUNI-V2[WBTC]": "0x743BC5cc8F52a84fF6e06E47Bc2af5324f5463D6", + "VaultBaselineOKB": "0x272C8dF3E8068952606046c1389fc1e2320FCCfd", + "VaultBaselinecrvRenWBTC": "0x10d0A001EeDC62b2A483EB9DFA0bb021aC61d55b", + "VaultBaselinecrvRenWSBTC": "0x483A47247d5cBd420A9c5d2838Ec89776ba8B56B", +} + +async function tvl(ts, block, _, { api }) { + const contracts =Object.values(vaults) + const tokens = await api.multiCall({ abi: abis.token, calls: contracts}) + const bals = await api.multiCall({ abi: abis.balance, calls: contracts}) + api.addTokens(tokens, bals) + return sumTokens2({ api, resolveLP: true, }) } module.exports = { From 48a4785ccde18d9421aa4a22618a49ccb95bb026 Mon Sep 17 00:00:00 2001 From: define Date: Thu, 29 Jun 2023 11:33:18 +0100 Subject: [PATCH 0136/1974] add bsc chain to marevick --- projects/maverick/index.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/projects/maverick/index.js b/projects/maverick/index.js index e49d4d275ad..c79bd0e4edc 100644 --- a/projects/maverick/index.js +++ b/projects/maverick/index.js @@ -62,4 +62,12 @@ module.exports = maverickTVL({ }, ], }, + bsc: { + factories: [ + { + address: "0x76311728FF86054Ad4Ac52D2E9Ca005BC702f589", + startBlock: 29241050, + }, + ], + }, }); From f43559f006bf32369f12bb00d12ab449fa99d6ea Mon Sep 17 00:00:00 2001 From: Hieu Vu <72878483+hieuvubk@users.noreply.github.com> Date: Thu, 29 Jun 2023 17:48:23 +0700 Subject: [PATCH 0137/1974] IBCX Adapter (#6657) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * add ibcx adapter * fixing * handle stToken which not be listed in coingecko * delete * no need handle stJUNO & stSTARS side * recalculate --------- Co-authored-by: Phạm Anh Minh <1phamminh0811@gmail.com> --- projects/ibcx/index.js | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 projects/ibcx/index.js diff --git a/projects/ibcx/index.js b/projects/ibcx/index.js new file mode 100644 index 00000000000..f56f733457d --- /dev/null +++ b/projects/ibcx/index.js @@ -0,0 +1,42 @@ +const axios = require('axios') + +const contractAddresses = [ + "osmo1yhd9tzp09d833u7ray4pc6wwp72aewtt2xwakszn3lzlf2klnlwscjwhxt", // uibcx + "osmo1fw7wc4x7leyf3keud4zdhdnyaanw0sajudg5sgnr93ydjhzmxk6sx84rxe", + "osmo1xqw2sl9zk8a6pch0csaw78n4swg5ws8t62wc5qta4gnjxfqg6v2qcs243k", // stIBCX + "osmo1fd33mtk06awg0v2hhd6djcjvvzcv90s8u03qujcjnlu87wm65xjs305mr4", + "osmo1w2dqd98hzu4ydku5hhv3f0gc468jdlayrqeqedrjxwrq62m7yekqrgvlyu", + "osmo14klwqgkmackvx2tqa0trtg69dmy0nrg4ntq4gjgw2za4734r5seqjqm4gm", +] + +async function tvl() { + const { api } = arguments[3] + for (const contractAddress of contractAddresses) { + const contractBalances = (await axios.get(`https://lcd.osmosis.zone/cosmos/bank/v1beta1/balances/${contractAddress}`)).data.balances + for (const coin of contractBalances) { + // stUMEE not be listed on coingecko so we convert stUMEE to the corresponding amount of UMEE base on pool stUMEE/UMEE + if (coin.denom == "ibc/02F196DA6FD0917DD5FEA249EE61880F4D941EE9059E7964C5C9B50AF103800F") { + const spotPrice = (await axios.get(`https://lcd.osmosis.zone/osmosis/gamm/v2/pools/1035/prices?base_asset_denom=ibc/67795E528DF67C5606FC20F824EA39A6EF55BA133F4DC79C90A8C47A0901E17C"e_asset_denom=${coin.denom}`)).data.spot_price + coin.denom = "ibc/67795E528DF67C5606FC20F824EA39A6EF55BA133F4DC79C90A8C47A0901E17C" // UMEE + coin.amount = coin.amount * spotPrice + } + // stEVMOS not be listed on coingecko so we convert stEVMOS to the corresponding amount of EVMOS base on pool stEVMOS/EVMOS + if (coin.denom == "ibc/C5579A9595790017C600DD726276D978B9BF314CF82406CE342720A9C7911A01") { + const spotPrice = (await axios.get(`https://lcd.osmosis.zone/osmosis/gamm/v2/pools/922/prices?base_asset_denom=ibc/6AE98883D4D5D5FF9E50D7130F1305DA2FFA0C652D1DD9C123657C6B4EB2DF8A"e_asset_denom=${coin.denom}`)).data.spot_price + coin.denom = "ibc/6AE98883D4D5D5FF9E50D7130F1305DA2FFA0C652D1DD9C123657C6B4EB2DF8A" // EVMOS + coin.amount = coin.amount * spotPrice + } + api.add(coin.denom, coin.amount) + } + + } +} + +module.exports = { + timetravel: false, + misrepresentedTokens: true, + methodology: "Total TVL on vaults", + osmosis: { + tvl, + }, +} \ No newline at end of file From 0f2501efbcade10c261b93866c2dc14a77c78def Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 29 Jun 2023 12:54:46 +0200 Subject: [PATCH 0138/1974] flamincome: minor fix --- projects/flamincome.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/projects/flamincome.js b/projects/flamincome.js index 51972264727..1adbb4a33fc 100644 --- a/projects/flamincome.js +++ b/projects/flamincome.js @@ -8,19 +8,19 @@ const abis = { const vaults = { "VaultBaselineUSDT": "0x54bE9254ADf8D5c8867a91E44f44c27f0c88e88A", "VaultBaselinewBTC": "0x1a389c381a8242B7acFf0eB989173Cd5d0EFc3e3", - "VaultBaselinerenBTC": "0xB0B3442b632175B0b7d9521291c51060722C4e8C", "VaultBaselinewETH": "0x1E9DC5d843731D333544e63B2B2082D21EF78ed3", + "VaultBaselineDAI": "0x163D457fA8247f1A9279B9fa8eF513de116e4327", + "VaultBaselineUNI-V2[WBTC]": "0x743BC5cc8F52a84fF6e06E47Bc2af5324f5463D6", + /* "VaultBaselinerenBTC": "0xB0B3442b632175B0b7d9521291c51060722C4e8C", "VaultBaselineTUSD": "0xa322AEa77769666453377CC697fbE4C6390b9942", "VaultBaselineyCRV": "0x5e7B4de4aC8e319fB2ec4bF9Fa98192346f8C99B", "VaultBaselinesBTC": "0x681D3261CC6d2A18b59f8B53219b96F06BcEeB69", "VaultBaselineUSDC": "0x3f7E3d82bdDc28d3Eb04F0d0A51e9Fc82db581f0", "VaultBaselineyDAI": "0x79A2e8C1120d6B5fBfaBD3f7a39CF8473A635742", "VaultBaselinecrvBTC": "0x483A47247d5cBd420A9c5d2838Ec89776ba8B56B", - "VaultBaselineDAI": "0x163D457fA8247f1A9279B9fa8eF513de116e4327", - "VaultBaselineUNI-V2[WBTC]": "0x743BC5cc8F52a84fF6e06E47Bc2af5324f5463D6", "VaultBaselineOKB": "0x272C8dF3E8068952606046c1389fc1e2320FCCfd", "VaultBaselinecrvRenWBTC": "0x10d0A001EeDC62b2A483EB9DFA0bb021aC61d55b", - "VaultBaselinecrvRenWSBTC": "0x483A47247d5cBd420A9c5d2838Ec89776ba8B56B", + "VaultBaselinecrvRenWSBTC": "0x483A47247d5cBd420A9c5d2838Ec89776ba8B56B", */ } async function tvl(ts, block, _, { api }) { @@ -28,7 +28,6 @@ async function tvl(ts, block, _, { api }) { const tokens = await api.multiCall({ abi: abis.token, calls: contracts}) const bals = await api.multiCall({ abi: abis.balance, calls: contracts}) api.addTokens(tokens, bals) - return sumTokens2({ api, resolveLP: true, }) } module.exports = { From d8dd507935026cd02ffec80074d641fd2e7a5ad0 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 29 Jun 2023 13:18:38 +0200 Subject: [PATCH 0139/1974] fix sushiswap --- projects/sushiswap/api.js | 207 ++++++-------------------------------- 1 file changed, 30 insertions(+), 177 deletions(-) diff --git a/projects/sushiswap/api.js b/projects/sushiswap/api.js index c6c21a57944..2cae99e6343 100644 --- a/projects/sushiswap/api.js +++ b/projects/sushiswap/api.js @@ -2,8 +2,6 @@ const { request, gql } = require("graphql-request"); const { toUSDTBalances } = require('../helper/balances'); const { getBlock } = require('../helper/http') const { getUniTVL } = require("../helper/unknownTokens") -const sdk = require('@defillama/sdk'); -const { getChainTransform } = require("../helper/portedTokens"); const graphUrl = 'https://api.thegraph.com/subgraphs/name/zippoxer/sushiswap-subgraph-fork' const graphQuery = gql` @@ -62,187 +60,42 @@ function getChainTVL(chain) { } const factory = '0xc35DADB65012eC5796536bD9864eD8773aBc74C4' +const tvl = getUniTVL({ + factory, useDefaultCoreAssets: true, blacklist: [ + '0xed0b4b0f0e2c17646682fc98ace09feb99af3ade', // RVRS + '0x00598f74DA03489d4fFDb7Fde54db8E3D3AA9a61', // GSHIB + '0xE38928cd467AD7347465048b3637893124187d02', // GSHIB + '0xc0e39cbac6a5c5cdcdf2c1a1c29cbf5917754943', // GSHIB + ], +}) module.exports = { - telos: { - tvl: getUniTVL({ - factory, - chain: 'telos', - useDefaultCoreAssets: true, - }), - }, - palm: { - tvl: getUniTVL({ - factory, - chain: 'palm', - useDefaultCoreAssets: true, - }), - }, - moonriver: { - tvl: getUniTVL({ - factory, - chain: 'moonriver', - useDefaultCoreAssets: true, - }), - }, - celo: { - tvl: getUniTVL({ - factory, - chain: 'celo', - useDefaultCoreAssets: true, - }), - }, - okexchain: { - tvl: getUniTVL({ - factory, - chain: 'okexchain', - useDefaultCoreAssets: true, - }), - }, - arbitrum: { - tvl: getUniTVL({ - factory, - chain: 'arbitrum', - useDefaultCoreAssets: true, - }), - }, - xdai: { - tvl: getUniTVL({ - factory, - chain: 'xdai', - useDefaultCoreAssets: true, - }) - }, - harmony: { - tvl: getUniTVL({ - factory, - chain: 'harmony', - useDefaultCoreAssets: true, - blacklist: [ - '0xed0b4b0f0e2c17646682fc98ace09feb99af3ade', // RVRS - ], - }) - }, - ethereum: { - tvl: eth, - }, - polygon: { - tvl: getUniTVL({ - factory, - chain: 'polygon', - useDefaultCoreAssets: true, - }), - }, - fantom: { - tvl: getUniTVL({ - factory, - chain: 'fantom', - useDefaultCoreAssets: true, - }), - }, - bsc: { - tvl: getUniTVL({ - factory, - chain: 'bsc', - useDefaultCoreAssets: false, - blacklist: [ - '0x00598f74DA03489d4fFDb7Fde54db8E3D3AA9a61', // GSHIB - '0xE38928cd467AD7347465048b3637893124187d02', // GSHIB - '0xc0e39cbac6a5c5cdcdf2c1a1c29cbf5917754943', // GSHIB - ] - }), - }, - heco: { - tvl: getUniTVL({ - factory, - chain: 'heco', - useDefaultCoreAssets: true, - }), - }, - boba: { - tvl: getUniTVL({ - factory, - chain: 'boba', - useDefaultCoreAssets: true, - }), - }, - boba_avax: { - tvl: getUniTVL({ - factory, - chain: 'boba_avax', - useDefaultCoreAssets: true, - }), - }, - boba_bnb: { - tvl: getUniTVL({ - factory, - chain: 'boba_bnb', - useDefaultCoreAssets: true, - }), - }, - avax: { - tvl: getUniTVL({ - factory, - chain: 'avax', - useDefaultCoreAssets: true, - }), - }, + telos: { tvl, }, + palm: { tvl, }, + moonriver: { tvl, }, + celo: { tvl, }, + okexchain: { tvl, }, + arbitrum: { tvl, }, + xdai: { tvl, }, + harmony: { tvl, }, + ethereum: { tvl: eth, }, + polygon: { tvl, }, + fantom: { tvl, }, + bsc: { tvl, }, + heco: { tvl, }, + boba: { tvl, }, + boba_avax: { tvl, }, + boba_bnb: { tvl, }, + avax: { tvl, }, fuse: { - tvl: getUniTVL({ - factory: '0x43eA90e2b786728520e4f930d2A71a477BF2737C', - chain: 'fuse', - useDefaultCoreAssets: true, - }), - }, - arbitrum_nova: { - tvl: getUniTVL({ - chain: 'arbitrum_nova', - useDefaultCoreAssets: true, - factory, - }) + tvl: getUniTVL({ factory: '0x43eA90e2b786728520e4f930d2A71a477BF2737C', useDefaultCoreAssets: true, }), }, + arbitrum_nova: { tvl, }, //moved kava to trident adapter - //kava: { - // tvl: kavaTridentTvl, - //}, + //kava: { // tvl: kavaTridentTvl, //}, } -module.exports.polygon.tvl = getChainTVL('polygon') +// module.exports.polygon.tvl = getChainTVL('polygon') // module.exports.bsc.tvl = getChainTVL('bsc') -module.exports.fantom.tvl = getChainTVL('fantom') +// module.exports.fantom.tvl = getChainTVL('fantom') // module.exports.harmony.tvl = getChainTVL('harmony') - -async function kavaTridentTvl(ts, _b, cb) { - const chain = 'kava' - const graph = 'https://pvt.graph.kava.io/subgraphs/name/sushiswap/trident-kava' - const query = `query get_tvl($block: Int){ - pairs( - block: { number: $block } - size: 1000 - ){ - id - name - type - reserve0 - reserve1 - token0 { - id - } - token1 { - id - } - } - }` - const block = await getBlock(ts, chain, cb, false) - const { pairs } = await request(graph, query, { - block: block - 100, - }) - // const bentoBox = '0xc35DADB65012eC5796536bD9864eD8773aBc74C4' - const balances = {} - const transform = await getChainTransform(chain) - pairs.forEach(i => { - sdk.util.sumSingleBalance(balances, transform(i.token0.id), i.reserve0) - sdk.util.sumSingleBalance(balances, transform(i.token1.id), i.reserve1) - } ) - return balances -} From 1f1da1dca2d6339810a47164b7af2cba0b9d9157 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 29 Jun 2023 13:23:44 +0200 Subject: [PATCH 0140/1974] revert ferro change: cronos get log issue? --- projects/ferro/index.js | 50 +++++++++++++++++++++++++++++++++++------ 1 file changed, 43 insertions(+), 7 deletions(-) diff --git a/projects/ferro/index.js b/projects/ferro/index.js index 28eb24476d8..79da977152d 100644 --- a/projects/ferro/index.js +++ b/projects/ferro/index.js @@ -1,10 +1,46 @@ -const { saddleExports } = require('../helper/saddle') +const { sumTokens2 } = require('../helper/unwrapLPs') -const config = { - cronos: { - factory: '0xc4106bba1a8752e54940be71f7bd02c38e64f9e3', - fromBlock: 2539442, - } +const SWAP_3FER_ADDR = '0xe8d13664a42B338F009812Fa5A75199A865dA5cD'; +const SWAP_2FER_ADDR = '0xa34C0fE36541fB085677c36B4ff0CCF5fa2B32d6'; +const SWAP_LCRO_WCRO_ADDRESSES = '0x1578C5CF4f8f6064deb167d1eeAD15dF43185afa'; +const chain = 'cronos' + +const tokens = { + // DAI + "0xF2001B145b43032AAF5Ee2884e456CCd805F677D": [ + SWAP_3FER_ADDR, + ], + // USDC + "0xc21223249CA28397B4B6541dfFaEcC539BfF0c59": [ + SWAP_3FER_ADDR, + SWAP_2FER_ADDR, + ], + // USDT + "0x66e428c3f67a68878562e79A0234c1F83c208770": [ + SWAP_3FER_ADDR, + SWAP_2FER_ADDR, + ], + // LCRO + "0x9fae23a2700feecd5b93e43fdbc03c76aa7c08a6": [ + SWAP_LCRO_WCRO_ADDRESSES, + ], + // WCRO + "0x5C7F8A570d578ED84E63fdFA7b1eE72dEae1AE23": [ + SWAP_LCRO_WCRO_ADDRESSES, + ], +}; + +async function tvl(timestamp, ethBlock, {cronos: block}) { + const tokensAndOwners = Object.entries(tokens).map(([token, owners]) => owners.map(owner => [token, owner])).flat() + return sumTokens2({ chain, block, tokensAndOwners }) } -module.exports = saddleExports(config) \ No newline at end of file +module.exports = { + timetravel: true, + misrepresentedTokens: false, + methodology: 'sum of ferro stablecoin pool contracts balance', + start: 1651218360, + cronos: { + tvl, + } +} \ No newline at end of file From f1d21e49ad46c0f8766657944aaa90ada2ca605d Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 29 Jun 2023 18:00:45 +0530 Subject: [PATCH 0141/1974] mango-markets-v4 (#6676) * mango-markets-v4 * mango markets: track borrowed --- projects/hadesswap/index.js | 11 +- projects/mango-markets-v4/idl.json | 361 +++++++++++++++++++++++++++++ projects/mango-markets-v4/index.js | 24 ++ 3 files changed, 389 insertions(+), 7 deletions(-) create mode 100644 projects/mango-markets-v4/idl.json create mode 100644 projects/mango-markets-v4/index.js diff --git a/projects/hadesswap/index.js b/projects/hadesswap/index.js index 9d1c7837635..527578196e4 100644 --- a/projects/hadesswap/index.js +++ b/projects/hadesswap/index.js @@ -1,13 +1,10 @@ -const { getUniTVL } = require('../helper/unknownTokens') - module.exports = { timetravel: false, misrepresentedTokens: true, + hallmarks: [ + [Math.floor(new Date('2023-06-01')/1e3), 'Chain is abandoned'], + ], polis: { - tvl: getUniTVL({ - chain: 'polis', - factory: '0x4523ad2e05c455d0043910c84c83236a6c98b40b', - useDefaultCoreAssets: true, - }) + tvl: () => 0 }, } diff --git a/projects/mango-markets-v4/idl.json b/projects/mango-markets-v4/idl.json new file mode 100644 index 00000000000..c5414b0c9c5 --- /dev/null +++ b/projects/mango-markets-v4/idl.json @@ -0,0 +1,361 @@ +{ + "version": "0.16.0", + "name": "mango_v4", + "instructions": [], + "accounts": [ + { + "name": "Bank", + "type": { + "kind": "struct", + "fields": [ + { + "name": "group", + "type": "publicKey" + }, + { + "name": "name", + "type": { + "array": [ + "u8", + 16 + ] + } + }, + { + "name": "mint", + "type": "publicKey" + }, + { + "name": "vault", + "type": "publicKey" + }, + { + "name": "oracle", + "type": "publicKey" + }, + { + "name": "oracleConfig", + "type": { + "defined": "OracleConfig" + } + }, + { + "name": "stablePriceModel", + "type": { + "defined": "StablePriceModel" + } + }, + { + "name": "depositIndex", + "type": { + "defined": "I80F48" + } + }, + { + "name": "borrowIndex", + "type": { + "defined": "I80F48" + } + }, + { + "name": "indexedDeposits", + "type": { + "defined": "I80F48" + } + }, + { + "name": "indexedBorrows", + "type": { + "defined": "I80F48" + } + }, + { + "name": "indexLastUpdated", + "type": "u64" + }, + { + "name": "bankRateLastUpdated", + "type": "u64" + }, + { + "name": "avgUtilization", + "type": { + "defined": "I80F48" + } + }, + { + "name": "adjustmentFactor", + "type": { + "defined": "I80F48" + } + }, + { + "name": "util0", + "type": { + "defined": "I80F48" + } + }, + { + "name": "rate0", + "type": { + "defined": "I80F48" + } + }, + { + "name": "util1", + "type": { + "defined": "I80F48" + } + }, + { + "name": "rate1", + "type": { + "defined": "I80F48" + } + }, + { + "name": "maxRate", + "type": { + "defined": "I80F48" + } + }, + { + "name": "collectedFeesNative", + "type": { + "defined": "I80F48" + } + }, + { + "name": "loanOriginationFeeRate", + "type": { + "defined": "I80F48" + } + }, + { + "name": "loanFeeRate", + "type": { + "defined": "I80F48" + } + }, + { + "name": "maintAssetWeight", + "type": { + "defined": "I80F48" + } + }, + { + "name": "initAssetWeight", + "type": { + "defined": "I80F48" + } + }, + { + "name": "maintLiabWeight", + "type": { + "defined": "I80F48" + } + }, + { + "name": "initLiabWeight", + "type": { + "defined": "I80F48" + } + }, + { + "name": "liquidationFee", + "type": { + "defined": "I80F48" + } + }, + { + "name": "dust", + "type": { + "defined": "I80F48" + } + }, + { + "name": "flashLoanTokenAccountInitial", + "type": "u64" + }, + { + "name": "flashLoanApprovedAmount", + "type": "u64" + }, + { + "name": "tokenIndex", + "type": "u16" + }, + { + "name": "bump", + "type": "u8" + }, + { + "name": "mintDecimals", + "type": "u8" + }, + { + "name": "bankNum", + "type": "u32" + }, + { + "name": "minVaultToDepositsRatio", + "type": "f64" + }, + { + "name": "netBorrowLimitWindowSizeTs", + "type": "u64" + }, + { + "name": "lastNetBorrowsWindowStartTs", + "type": "u64" + }, + { + "name": "netBorrowLimitPerWindowQuote", + "type": "i64" + }, + { + "name": "netBorrowsInWindow", + "type": "i64" + }, + { + "name": "borrowWeightScaleStartQuote", + "type": "f64" + }, + { + "name": "depositWeightScaleStartQuote", + "type": "f64" + }, + { + "name": "reduceOnly", + "type": "u8" + }, + { + "name": "forceClose", + "type": "u8" + }, + { + "name": "reserved", + "type": { + "array": [ + "u8", + 2118 + ] + } + } + ] + } + } + ], + "types": [ + + { + "name": "OracleConfig", + "type": { + "kind": "struct", + "fields": [ + { + "name": "confFilter", + "type": { + "defined": "I80F48" + } + }, + { + "name": "maxStalenessSlots", + "type": "i64" + }, + { + "name": "reserved", + "type": { + "array": [ + "u8", + 72 + ] + } + } + ] + } + }, + { + "name": "I80F48", + "type": { + "kind": "struct", + "fields": [ + { + "name": "val", + "type": "i128" + } + ] + } + }, + + { + "name": "StablePriceModel", + "type": { + "kind": "struct", + "fields": [ + { + "name": "stablePrice", + "type": "f64" + }, + { + "name": "lastUpdateTimestamp", + "type": "u64" + }, + { + "name": "delayPrices", + "type": { + "array": [ + "f64", + 24 + ] + } + }, + { + "name": "delayAccumulatorPrice", + "type": "f64" + }, + { + "name": "delayAccumulatorTime", + "type": "u32" + }, + { + "name": "delayIntervalSeconds", + "type": "u32" + }, + { + "name": "delayGrowthLimit", + "type": "f32" + }, + { + "name": "stableGrowthLimit", + "type": "f32" + }, + { + "name": "lastDelayIntervalIndex", + "type": "u8" + }, + { + "name": "padding", + "type": { + "array": [ + "u8", + 7 + ] + } + }, + { + "name": "reserved", + "type": { + "array": [ + "u8", + 48 + ] + } + } + ] + } + } + ], + "events": [], + "errors": [] +} \ No newline at end of file diff --git a/projects/mango-markets-v4/index.js b/projects/mango-markets-v4/index.js new file mode 100644 index 00000000000..6a4ecfd061d --- /dev/null +++ b/projects/mango-markets-v4/index.js @@ -0,0 +1,24 @@ +const { Program } = require("@project-serum/anchor"); +const { getProvider, sumTokens2, } = require("../helper/solana"); +const idl = require('./idl.json') + +async function tvl() { + const provider = getProvider() + const program = new Program(idl, '4MangoMjqJ2firMokCjjGgoK8d4MXcrgL7XJaL3w6fVg', provider) + const banks = await program.account.bank.all() + return sumTokens2({ tokenAccounts: banks.map(i => i.account.vault) }) +} +async function borrowed() { + const { api } = arguments[3] + const provider = getProvider() + const program = new Program(idl, '4MangoMjqJ2firMokCjjGgoK8d4MXcrgL7XJaL3w6fVg', provider) + const banks = await program.account.bank.all() + banks.forEach(({ account: i }) => { + api.add(i.mint.toString(), i.indexedBorrows.val.mul(i.borrowIndex.val).toString() / (2**(48 * 2))) + }) +} + +module.exports = { + timetravel: false, + solana: { tvl, borrowed }, +} From 31b0ec67297d3e7053d2d3cae4149901b5754c82 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 29 Jun 2023 14:49:27 +0200 Subject: [PATCH 0142/1974] update rabbitx --- projects/rabbitx/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/rabbitx/index.js b/projects/rabbitx/index.js index 9f61b3fff86..6391347eecd 100644 --- a/projects/rabbitx/index.js +++ b/projects/rabbitx/index.js @@ -3,6 +3,6 @@ const { sumTokensExport } = require("../helper/unwrapLPs"); module.exports = { ethereum: { - tvl: sumTokensExport({ owners: ['0xFc7f884DE22a59c0009C91733196b012Aecb8F41', '0x3b8F6D6970a24A58b52374C539297ae02A3c4Ae4'], tokens: [ADDRESSES.ethereum.USDT]}) + tvl: sumTokensExport({ owners: ['0xFc7f884DE22a59c0009C91733196b012Aecb8F41', '0x3b8F6D6970a24A58b52374C539297ae02A3c4Ae4', '0x7fAb440A0251dA67B316d2c0431E3Ccf4520Cd42',], tokens: [ADDRESSES.ethereum.USDT]}) } } From 85db5b3bc54e9072849dfe130bd84b794da1e3f4 Mon Sep 17 00:00:00 2001 From: define Date: Thu, 29 Jun 2023 14:27:55 +0100 Subject: [PATCH 0143/1974] add arbitrum token to vertex --- projects/vertex/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/vertex/index.js b/projects/vertex/index.js index 4dc863f9465..5c2f9885e48 100644 --- a/projects/vertex/index.js +++ b/projects/vertex/index.js @@ -16,7 +16,7 @@ module.exports = { arbitrum: { tvl: sumTokensExport({ owners: [config.clearinghouse, config.endpoint], - tokens: [ADDRESSES.arbitrum.WBTC, ADDRESSES.arbitrum.WETH, ADDRESSES.arbitrum.USDC], + tokens: [ADDRESSES.arbitrum.WBTC, ADDRESSES.arbitrum.WETH, ADDRESSES.arbitrum.USDC, "0x912ce59144191c1204e64559fe8253a0e49e6548"], }) } } \ No newline at end of file From a13ebf278eb7e07f393724bf92b96db76c103dab Mon Sep 17 00:00:00 2001 From: Key <129726584+KeyFinanceTeam@users.noreply.github.com> Date: Thu, 29 Jun 2023 22:28:29 +0900 Subject: [PATCH 0144/1974] Add key finance (#6620) * Add key finance * Change fromBlock to 2days * Update index.js --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/key/index.js | 89 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 projects/key/index.js diff --git a/projects/key/index.js b/projects/key/index.js new file mode 100644 index 00000000000..b8e2201d51b --- /dev/null +++ b/projects/key/index.js @@ -0,0 +1,89 @@ +const { getLogs } = require('../helper/cache/getLogs') +const { BigNumber, constants } = require('ethers') +const { getBlock } = require('../helper/http') + +const GmxkeyToken = '0xc5369c88440AB1FC842bCc60d3d087Bd459f20e4' +const EsGmxkeyToken = '0x3a924611895F8484194C9a791fceFb6fC07ddb85' +const MpkeyToken = '0x40a03B30D0c4D9e5E71164e041EC28CEe6dD9b36' +const GMXkeyGmxMarket = '0xC2e764eBEa35F079b03522D8C9cf7394De4EE15e' +const EsGMXkeyGmxMarket = '0x48dFF3e21843C2A81a4C5CE55535Ac444B55bDbf' +const MPkeyGmxMarket = '0x09861D732Af36Ee33490A09f24A0a3Cb06e035c1' +const UniswapGmxEthPool = '0x80A9ae39310abf666A87C743d6ebBD0E8C42158E' + +function getMarketPrice(api, fromBlock) { + return async (market, defaultPrice) => { + const logs = await getLogs({ + api, + target: market, + topic: 'TakeOrder(address,uint256,address,address,address,uint256,uint256,uint256,bool,uint256)', + eventAbi: 'event TakeOrder(address indexed account, uint256 indexed orderId, address indexed maker, address token, address currency, uint256 price, uint256 amount, uint256 filled, bool bidAsk, uint256 timestamp)', + onlyArgs: true, + skipCache: true, + fromBlock, + }) + + const targetLogs = logs + .map(({ timestamp, price }) => ({ timestamp, price })) + .sort((a, b) => a.timestamp > b.timestamp ? -1 : 1) + .slice(0, 5) + + const sum = targetLogs.reduce((prev, curr) => { + return prev.add(curr.price) + }, constants.Zero) + + if (sum.eq(constants.Zero)) { + return defaultPrice + } + + return sum.div(targetLogs.length).toNumber() / 10**4 + } +} + +function getTvl(gmxPrice, tokenPrice, totalSupply){ + const tokenSupply = totalSupply / 10**18 + return gmxPrice * tokenPrice * tokenSupply +} + +async function getGmxPrice(slot0) { + const priceSqrt = BigNumber.from(slot0[0]) + const gmxPriceInEth = priceSqrt.pow(2).mul(1000).div(BigNumber.from(2).pow(192)).toNumber() / 1000 + + return 1 / gmxPriceInEth +} + +async function tvl(timestamp, _, chainBlocks, { api }) { + const fromBlock = await getBlock(timestamp - (48 * 60 * 60), 'arbitrum', chainBlocks) + + const slot0 = await api.call({ + abi: 'function slot0() view returns (uint160 sqrtPriceX96, int24 tick, uint16 observationIndex, uint16 observationCardinality, uint16 observationCardinalityNext, uint8 feeProtocol, bool unlocked)', + target: UniswapGmxEthPool, + }) + + const [totalSupplyOfGmxkey, totalSupplyOfEsGmxkey, totalSupplyOfMpkey] = await api.multiCall({ + abi: 'erc20:totalSupply', + calls: [GmxkeyToken, EsGmxkeyToken, MpkeyToken], + }) + + const gmxPrice = await getGmxPrice(slot0) + + const marketPrice = getMarketPrice(api, fromBlock) + + const gmxkeyPrice = await marketPrice(GMXkeyGmxMarket, 0.95) + const gmxkeyTvl = getTvl(gmxPrice, gmxkeyPrice, totalSupplyOfGmxkey) + + const esGmxkeyPrice = await marketPrice(EsGMXkeyGmxMarket, 0.5) + const esGmxkeyTvl = getTvl(gmxPrice, esGmxkeyPrice, totalSupplyOfEsGmxkey) + + const mpkeyPrice = await marketPrice(MPkeyGmxMarket, 0.1) + const mpkeyTvl = getTvl(gmxPrice, mpkeyPrice, totalSupplyOfMpkey) + + return { + ethereum: gmxkeyTvl + esGmxkeyTvl + mpkeyTvl, + } +} + +module.exports = { + arbitrum: { + tvl, + } +} From b91bc0fe40e5014c9570d477e10f8d08dc5bda69 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 29 Jun 2023 17:32:07 +0200 Subject: [PATCH 0145/1974] fix broken adapters --- projects/defiedge/index.js | 11 +++-- projects/demeter/index.js | 2 +- projects/glitter-finance/index.js | 49 ++--------------------- projects/helper/utils.js | 2 +- projects/prism/index.js | 21 +++------- projects/sashimiswap/index.js | 7 ++-- projects/sushiswap-kashi/kashi-lending.js | 27 +++++-------- projects/sushiswap-trident/trident.js | 36 ++++------------- projects/sushiswap/api.js | 38 +++++------------- projects/whitewhale/index.js | 28 +------------ 10 files changed, 49 insertions(+), 172 deletions(-) diff --git a/projects/defiedge/index.js b/projects/defiedge/index.js index c1d16d4143a..af145be08f3 100644 --- a/projects/defiedge/index.js +++ b/projects/defiedge/index.js @@ -1,20 +1,19 @@ -const { GraphQLClient, gql } = require("graphql-request"); +const { graphQuery } = require('../helper/http') var endpoint = "https://api.defiedge.io/graphql"; function tvl(network) { return async (_timestamp, _block, _chainBlocks) => { - var graphQLClient = new GraphQLClient(endpoint); - var query = gql` - query Stats($network: [Network!]) { - stats(network: $network) { + var query = ` + query Stats($network: [Network!] $dex: [Dex!] = [Uniswap, Apeswap, Pancakeswap, Arbidex]) { + stats(network: $network, dex: $dex) { totalValueManaged } } `; - var results = await graphQLClient.request(query, { network: [network] }); + var results = await graphQuery(endpoint, query, { network: [network] }); return { "usd-coin": results.stats.totalValueManaged }; }; diff --git a/projects/demeter/index.js b/projects/demeter/index.js index d9a2c4b99e1..c7adf3de827 100644 --- a/projects/demeter/index.js +++ b/projects/demeter/index.js @@ -1,7 +1,7 @@ const { get } = require('../helper/http') async function fetch() { - let results = await get('https://farming-api.cerestoken.io/get-supply-data'); + let results = await get('https://api.deotoken.com/api/demeter/supply-data'); return results.tvl; } diff --git a/projects/glitter-finance/index.js b/projects/glitter-finance/index.js index f533f7f1106..10fbbb5e50a 100644 --- a/projects/glitter-finance/index.js +++ b/projects/glitter-finance/index.js @@ -1,51 +1,10 @@ - +const ADDRESSES = require('../helper/coreAssets.json') //Solana Helpers -const { - sumTokens2, -} = require("../helper/solana"); - -//Algorand Helpers -const axios = require('axios') -const axiosObj = axios.create({ - baseURL: 'https://algoindexer.algoexplorerapi.io', - timeout: 300000, -}) - +const { sumTokensExport, } = require("../helper/sumTokens") //addresses const SOLANA_VAULT = "7xCU4nvqu3Nz3BBQckKzibp3kBav4xbkuqQ3WM9CBHdJ"; const ALGO_VAULT = "R7VCOR74LCUIFH5WKCCMZOS7ADLSDBQJ42YURFPDT3VGYTVNBNG7AIYTCQ"; -//TVL Calculations: -async function solana_tvl() { - return sumTokens2({ solOwners: [SOLANA_VAULT]}) -} -async function algorand_tvl() { - - const tvlResult = {}; - - //Get algo balance from Algo Vault - const algo_account = await getAlgoBalance(ALGO_VAULT); - var amount_algo = 0; - - //Ensure that the response is valid & set amount - if (algo_account && algo_account.account && algo_account.account.amount) { - amount_algo = algo_account.account.amount / 1000000; //Amount returned in microAlgos - } - - if (!tvlResult["algorand"]) { - tvlResult["algorand"] = Number(amount_algo); - } else { - tvlResult["algorand"] += Number(amount_algo); - } - - return tvlResult; -} - -async function getAlgoBalance(address) { - const response = (await axiosObj.get(`/v2/accounts/${address}`)) - return response.data -} - module.exports = { hallmarks: [ [1661337600, "SPL Vault Migration (V2 Expansion)"], @@ -53,6 +12,6 @@ module.exports = { timetravel: false, methodology: "TVL counts tokens and native assets locked in Glitter-Finance bridge vaults. CoinGecko is used to find the price of tokens in USD.", - solana: { tvl: solana_tvl }, - algorand: { tvl: algorand_tvl}, + solana: { tvl: sumTokensExport({ solOwners: [SOLANA_VAULT], }) }, + algorand: { tvl: sumTokensExport({ owners: [ALGO_VAULT] }) }, }; \ No newline at end of file diff --git a/projects/helper/utils.js b/projects/helper/utils.js index 16b977e7d21..ccb3c9c384a 100644 --- a/projects/helper/utils.js +++ b/projects/helper/utils.js @@ -52,7 +52,7 @@ function isLP(symbol, token, chain) { // console.log(symbol, chain, token) if (!symbol) return false if (token && blacklisted_LPS.includes(token.toLowerCase()) || symbol.includes('HOP-LP-')) return false - if (chain === 'bsc' && ['OLP', 'DLP', 'MLP', 'LP'].includes(symbol)) return false + if (chain === 'bsc' && ['OLP', 'DLP', 'MLP', 'LP', 'Stable-LP'].includes(symbol)) return false if (chain === 'bsc' && ['WLP', 'FstLP', 'BLP',].includes(symbol)) return true if (chain === 'pulse' && ['PLP',].includes(symbol)) return true if (chain === 'avax' && ['ELP', 'EPT', 'CRL', 'YSL', 'BGL', 'PLP'].includes(symbol)) return true diff --git a/projects/prism/index.js b/projects/prism/index.js index a1d0dc23c5a..3e6fef1b274 100644 --- a/projects/prism/index.js +++ b/projects/prism/index.js @@ -1,30 +1,21 @@ -const { fetchURL } = require('../helper/utils') +const { queryContract } = require('../helper/chain/cosmos') async function tvl() { - const res = await fetchURL( - `https://lcd.terra.dev/wasm/contracts/terra1xw3h7jsmxvh6zse74e4099c6gl03fnmxpep76h/store?query_msg=%7B%22state%22%3A%20%7B%7D%7D` - ) + const res = await queryContract({ chain: 'terra2', contract: 'terra188mmw2vsp0yahen3vh2clup543qrttvdzkxl0h9myfuwjj56nausztpegt', data: { state: {}}}) return { - "terra-luna": res.data.result.total_bond_amount / 1e6, + "terra-luna-2": res.total_bond_amount / 1e6, } } -async function staking() { - const staked = await fetchURL( - `https://lcd.terra.dev/wasm/contracts/terra1042wzrwg2uk6jqxjm34ysqquyr9esdgm5qyswz/store?query_msg=%7B%22token_info%22%3A%20%7B%7D%7D` - ) - - return { - "prism-governance-token": Number(staked.data.result.total_supply) / 1e6 - } -} module.exports = { timetravel: false, terra: { + tvl: () => 0, + }, + terra2: { tvl, - staking, }, hallmarks:[ [1651881600, "UST depeg"], diff --git a/projects/sashimiswap/index.js b/projects/sashimiswap/index.js index 600ab661e49..6bc74bbcd7c 100644 --- a/projects/sashimiswap/index.js +++ b/projects/sashimiswap/index.js @@ -50,16 +50,17 @@ module.exports = { timetravel: true, doublecounted: false, ethereum: { - tvl: sdk.util.sumChainTvls([ethTvl,ethMarketsTvl]), + // tvl: sdk.util.sumChainTvls([ethTvl,ethMarketsTvl]), + tvl: sdk.util.sumChainTvls([ethMarketsTvl]), staking: staking("0x6ed306DbA10E6c6B20BBa693892Fac21f3B91977", "0xC28E27870558cF22ADD83540d2126da2e4b464c2"), borrowed: borrowedEth, }, bsc: { - tvl: sdk.util.sumChainTvls([bscTvl, bscMarketsTvl]), + tvl: sdk.util.sumChainTvls([bscMarketsTvl]), borrowed: borrowedBsc, }, heco: { - tvl: sdk.util.sumChainTvls([hecoTvl,hecoMarketsTvl]), + tvl: sdk.util.sumChainTvls([hecoMarketsTvl]), borrowed: borrowedHeco, }, methodology: diff --git a/projects/sushiswap-kashi/kashi-lending.js b/projects/sushiswap-kashi/kashi-lending.js index bff62c3ff67..171a303f19b 100644 --- a/projects/sushiswap-kashi/kashi-lending.js +++ b/projects/sushiswap-kashi/kashi-lending.js @@ -1,8 +1,5 @@ const ADDRESSES = require('../helper/coreAssets.json') -const sdk = require("@defillama/sdk"); -const { request, gql } = require("graphql-request"); -const { getBlock } = require("../helper/http"); -const { getChainTransform } = require("../helper/portedTokens"); +const { blockQuery } = require("../helper/http"); const { BigNumber } = require("ethers"); const graphUrls = { @@ -23,7 +20,7 @@ const bentoboxes = { const toAmountAbi ='function toAmount(address token, uint256 share, bool roundUp) view returns (uint256 amount)' -const kashiQuery = gql` +const kashiQuery = ` query get_pairs($block: Int) { kashiPairs(block: { number: $block }, first: 1000) { id @@ -45,16 +42,12 @@ const kashiQuery = gql` `; function kashiLending(chain, borrowed) { - return async (timestamp, ethBlock, chainBlocks) => { - const balances = {}; + return async (timestamp, ethBlock, chainBlocks, {api}) => { const graphUrl = graphUrls[chain]; - let block = await getBlock(timestamp, chain, chainBlocks) - block = block - 100; //subgraphs can be late by few seconds/minutes - const transform = await getChainTransform(chain); // Query graphql endpoint - const { kashiPairs } = await request(graphUrl, kashiQuery, { - block: block, + const { kashiPairs } = await blockQuery(graphUrl, kashiQuery, { + api }); const calls = [] @@ -88,15 +81,13 @@ function kashiLending(chain, borrowed) { } }) - const { output } = await sdk.api.abi.multiCall({ - calls, chain, block, abi: toAmountAbi, target: bentoboxes[chain], + const output = await api.multiCall({ + calls,abi: toAmountAbi, target: bentoboxes[chain], }) - output.forEach(({ input: { params: [token]}, output: balance, success, }) => { - if(success) sdk.util.sumSingleBalance(balances, transform(token), balance) + output.forEach((balance, idx) => { + api.add(calls[idx].params[0], balance) }) - - return balances; }; } diff --git a/projects/sushiswap-trident/trident.js b/projects/sushiswap-trident/trident.js index 05f934a8e73..268baae7e79 100644 --- a/projects/sushiswap-trident/trident.js +++ b/projects/sushiswap-trident/trident.js @@ -1,6 +1,4 @@ -const sdk = require("@defillama/sdk"); -const { request, gql } = require("graphql-request"); -const { getChainTransform } = require("../helper/portedTokens"); +const { blockQuery } = require('../helper/http') const graphUrls = { polygon: "https://api.thegraph.com/subgraphs/name/sushi-v2/trident-polygon", @@ -17,7 +15,7 @@ const graphUrls = { avax: "https://api.thegraph.com/subgraphs/name/sushi-v2/trident-avalanche", }; -const tridentQueryWithBlock = gql` +const tridentQueryWithBlock = ` query get_tokens($block: Int) { tokens( block: { number: $block } @@ -33,7 +31,7 @@ const tridentQueryWithBlock = gql` } `; -const tridentQuery = gql` +const tridentQuery = ` query get_tokens { tokens( first: 1000 @@ -49,43 +47,23 @@ const tridentQuery = gql` `; function trident(chain) { - return async (timestamp, ethBlock, chainBlocks) => { - const balances = {}; + return async (timestamp, ethBlock, chainBlocks, { api }) => { const graphUrl = graphUrls[chain]; - const block = chainBlocks[chain]; - const transform = await getChainTransform(chain); - // Query graphql endpoint let result; - if (block) { - result = await request(graphUrl, tridentQueryWithBlock, { - block: block - 50, //subgraphs can be late by few seconds/minutes - }); - } else { - result = await request(graphUrl, tridentQuery); - } + result = await blockQuery(graphUrl, tridentQueryWithBlock, { api }); if (chain == "polygon") { //add pools that haven't been migrated to the new router result.tokens.push( - ...(!block - ? await request(graphUrls["polygonOldRouter"], tridentQuery) - : await request( - graphUrls["polygonOldRouter"], - tridentQueryWithBlock, - { - block: block - 50, //subgraphs can be late by few seconds/minutes - } - ) - ).tokens + ...(await blockQuery(graphUrls["polygonOldRouter"], tridentQuery, { api })).tokens ); } result.tokens.forEach((token) => { - sdk.util.sumSingleBalance(balances, transform(token.id), token.liquidity); + api.add(token.id, token.liquidity); }); - return balances; }; } diff --git a/projects/sushiswap/api.js b/projects/sushiswap/api.js index 2cae99e6343..85809d040e4 100644 --- a/projects/sushiswap/api.js +++ b/projects/sushiswap/api.js @@ -1,10 +1,9 @@ -const { request, gql } = require("graphql-request"); const { toUSDTBalances } = require('../helper/balances'); -const { getBlock } = require('../helper/http') +const { blockQuery } = require('../helper/http') const { getUniTVL } = require("../helper/unknownTokens") const graphUrl = 'https://api.thegraph.com/subgraphs/name/zippoxer/sushiswap-subgraph-fork' -const graphQuery = gql` +const graphQuery = ` query get_tvl($block: Int) { uniswapFactory( id: "0xC0AEe478e3658e2610c5F7A4A2E1777cE9e4f2Ac", @@ -15,7 +14,7 @@ query get_tvl($block: Int) { } } `; -const graphQueryPolygon = gql` +const graphQueryPolygon = ` query get_tvl($block: Int) { factory( id: "0xc35dadb65012ec5796536bd9864ed8773abc74c4", @@ -26,33 +25,16 @@ query get_tvl($block: Int) { } `; -async function eth(timestamp, ethBlock, chainBlocks) { - let block = ethBlock - if (block === undefined) { - block = await getBlock(timestamp, 'ethereum', chainBlocks) - } - const { uniswapFactory } = await request( - graphUrl, - graphQuery, - { - block: block - 50, - } - ); +async function eth(timestamp, ethBlock, chainBlocks, { api }) { + const { uniswapFactory } = await blockQuery(graphUrl, graphQuery, { api, }); const usdTvl = Number(uniswapFactory.totalLiquidityUSD) return toUSDTBalances(usdTvl) } -function getChainTVL(chain) { - return async (timestamp, _b, chainBlocks) => { - const block = await getBlock(timestamp, chain, chainBlocks, false) - const { factory } = await request( - 'https://api.thegraph.com/subgraphs/name/sushiswap/exchange-' + chain, - graphQueryPolygon, - { - block: block - 100, - } - ); +function getChainTVL() { + return async (timestamp, _b, chainBlocks, { api }) => { + const { factory } = await blockQuery('https://api.thegraph.com/subgraphs/name/sushiswap/exchange-' + api.chain, graphQueryPolygon, { api, }); const usdTvl = Number(factory.liquidityUSD) return toUSDTBalances(usdTvl) @@ -95,7 +77,7 @@ module.exports = { //kava: { // tvl: kavaTridentTvl, //}, } -// module.exports.polygon.tvl = getChainTVL('polygon') +module.exports.polygon.tvl = getChainTVL('polygon') // module.exports.bsc.tvl = getChainTVL('bsc') -// module.exports.fantom.tvl = getChainTVL('fantom') +module.exports.fantom.tvl = getChainTVL('fantom') // module.exports.harmony.tvl = getChainTVL('harmony') diff --git a/projects/whitewhale/index.js b/projects/whitewhale/index.js index 54e13d7ce93..8fce410596f 100644 --- a/projects/whitewhale/index.js +++ b/projects/whitewhale/index.js @@ -1,35 +1,11 @@ -const { fetchURL } = require('../helper/utils') - -const vaults = [ - "https://lcd.terra.dev/wasm/contracts/terra1ec3r2esp9cqekqqvn0wd6nwrjslnwxm7fh8egy/store?query_msg=%7B%22pool_state%22:%7B%7D%7D" -] +const { sumTokens } = require('../helper/chain/cosmos') async function tvl() { - let pool_state = {} - let tvl = {} - await Promise.all(vaults.map(async vault => { - pool_state = await fetchURL(vault) - tvl = Number(pool_state.data.result.total_value_in_ust) / 1e6 - })) - return { - terrausd: tvl - } -} - -async function staking() { - const staked = await fetchURL( - `https://lcd.terra.dev/wasm/contracts/terra12897djskt9rge8dtmm86w654g7kzckkd698608/store?query_msg=%7B%22balance%22:%7B%22address%22:%22terra1xrk6v2tfjrhjz2dsfecj40ps7ayanjx970gy0j%22%7D%7D` - ) - return { - "white-whale": Number(staked.data.result.balance) / 1e6 - } + return sumTokens({chain: 'terra', owner: 'terra1ec3r2esp9cqekqqvn0wd6nwrjslnwxm7fh8egy'}) } module.exports = { - timetravel: false, - misrepresentedTokens: true, terra: { - staking, tvl }, hallmarks:[ From 4eead276edb677dee38bc45482b2a716e9ce10bb Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 29 Jun 2023 21:39:08 +0200 Subject: [PATCH 0146/1974] add whitewhale dex --- projects/helper/chain/cosmos.js | 1 + projects/helper/chains.json | 1 + projects/helper/coreAssets.json | 3 +++ projects/helper/tokenMapping.js | 2 +- projects/whitewhale-dex/index.js | 24 ++++++++++++++++++++++++ 5 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 projects/whitewhale-dex/index.js diff --git a/projects/helper/chain/cosmos.js b/projects/helper/chain/cosmos.js index 364f92ba851..eeb1f554bf8 100644 --- a/projects/helper/chain/cosmos.js +++ b/projects/helper/chain/cosmos.js @@ -21,6 +21,7 @@ const endPoints = { orai: "https://lcd.orai.io", juno: "https://lcd-juno.cosmostation.io", cronos: "https://lcd-crypto-org.cosmostation.io", + chihuahua: "https://rest.cosmos.directory/chihuahua", injective: "https://lcd-injective.whispernode.com:443", migaloo: "https://migaloo-api.polkachu.com", fxcore: "https://fx-rest.functionx.io", diff --git a/projects/helper/chains.json b/projects/helper/chains.json index 204efe1b7d0..197caed3fdd 100644 --- a/projects/helper/chains.json +++ b/projects/helper/chains.json @@ -27,6 +27,7 @@ "carbon", "cardano", "celo", + "chihuahua", "clover", "clv", "comdex", diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index 48ab7d08b34..44468cc7680 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -1309,6 +1309,9 @@ "xpla": { "XPLA": "axpla" }, + "chihuahua": { + "HUAHUA": "uhuahua" + }, "pulse": { "WPLS": "0xa1077a294dde1b09bb078844df40758a5d0f9a27", "ETH": "0x02dcdd04e3f455d838cd1249292c58f3b79e3c3c", diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 12e31d12a09..4c712f3e809 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -16,7 +16,7 @@ coreAssets = JSON.parse(JSON.stringify(coreAssets)) // carbon: https://api-insights.carbon.network/info/denom_gecko_map // orbit brige: https://bridge.orbitchain.io/open/v1/api/monitor/rawTokenList -const ibcChains = ['ibc', 'terra', 'terra2', 'crescent', 'osmosis', 'kujira', 'stargaze', 'juno', 'injective', 'cosmos', 'comdex', 'stargaze', 'umee', 'orai', 'persistence', 'fxcore', 'neutron', 'quasar', ] +const ibcChains = ['ibc', 'terra', 'terra2', 'crescent', 'osmosis', 'kujira', 'stargaze', 'juno', 'injective', 'cosmos', 'comdex', 'stargaze', 'umee', 'orai', 'persistence', 'fxcore', 'neutron', 'quasar', 'chihuahua', ] const caseSensitiveChains = [...ibcChains, 'solana', 'tezos', 'ton', 'algorand', 'aptos', 'near', 'bitcoin', 'waves', 'tron', 'litecoin', 'polkadot', 'ripple', 'elrond', 'cardano', 'stacks', 'sui'] const distressedAssts = new Set(Object.values({ diff --git a/projects/whitewhale-dex/index.js b/projects/whitewhale-dex/index.js new file mode 100644 index 00000000000..60ad7f57955 --- /dev/null +++ b/projects/whitewhale-dex/index.js @@ -0,0 +1,24 @@ +const { getFactoryTvl } = require('../terraswap/factoryTvl') + +const factory = { + terra2: "terra1f4cr4sr5eulp3f2us8unu6qv8a5rhjltqsg7ujjx6f2mrlqh923sljwhn3", + juno: "juno14m9rd2trjytvxvu4ldmqvru50ffxsafs8kequmfky7jh97uyqrxqs5xrnx", + injective: "inj1x22q8lfhz7qcvtzs0dakhgx2th64l79kfye5lk", + comdex: "comdex1gurgpv8savnfw66lckwzn4zk7fp394lpe667dhu7aw48u40lj6jswv4mft", + chihuahua: "chihuahua1s8ehad3r9wxyk08ls2nmz8mqh4vlfmaxd2nw0crxwh04t4l5je4s8ljv0j", +} + +module.exports = { + timetravel: false, + misrepresentedTokens: true, + methodology: "Liquidity on the DEX", + hallmarks: [ + [1651881600, "UST depeg"], + ] +} + + +Object.keys(factory).forEach(chain => { + const contract = factory[chain] + module.exports[chain] = { tvl: getFactoryTvl(contract) } +}) \ No newline at end of file From cbe594d5a03e4738abe63ec8ea7032bd0d6058fd Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 29 Jun 2023 21:56:56 +0200 Subject: [PATCH 0147/1974] fix defiedge --- projects/defiedge/index.js | 48 +++++++++++++++++++++++--------------- 1 file changed, 29 insertions(+), 19 deletions(-) diff --git a/projects/defiedge/index.js b/projects/defiedge/index.js index af145be08f3..940ad91806a 100644 --- a/projects/defiedge/index.js +++ b/projects/defiedge/index.js @@ -1,31 +1,41 @@ const { graphQuery } = require('../helper/http') -var endpoint = "https://api.defiedge.io/graphql"; - -function tvl(network) { - return async (_timestamp, _block, _chainBlocks) => { - - var query = ` - query Stats($network: [Network!] $dex: [Dex!] = [Uniswap, Apeswap, Pancakeswap, Arbidex]) { - stats(network: $network, dex: $dex) { - totalValueManaged - } +const endpoint = "https://api.defiedge.io/graphql"; +const query = ` + query Stats($network: [Network!] $dex: [Dex!] = [Uniswap, Apeswap, Pancakeswap, Arbidex, Sushiswap]) { + stats(network: $network, dex: $dex) { + totalValueManaged } - `; + } + `; - var results = await graphQuery(endpoint, query, { network: [network] }); +async function tvl() { + const { api } = arguments[3] + let tvl = 0 + const { dexes, network } = config[api.chain] + for (const dex of dexes) { + const results = await graphQuery(endpoint, query, { network: [network], dex: [dex] }) + console.log(results.stats.totalValueManaged, api.chain, dex) + tvl += results.stats.totalValueManaged + } - return { "usd-coin": results.stats.totalValueManaged }; - }; + return { "usd-coin": tvl}; } module.exports = { doublecounted: true, timetravel: false, misrepresentedTokens: true, - ethereum: { tvl: tvl("mainnet") }, - polygon: { tvl: tvl("polygon") }, - arbitrum: { tvl: tvl("arbitrum") }, - optimism: { tvl: tvl("optimism") }, - bsc: {tvl: tvl("bsc")} }; + +const config = { + ethereum: { dexes: ["Uniswap",], network: "mainnet",}, + bsc: { dexes: ["Uniswap", "Apeswap", "Pancakeswap",], network: "bsc",}, + arbitrum: { dexes: ["Uniswap", "Arbidex", "Sushiswap"], network: "arbitrum",}, + optimism: { dexes: ["Uniswap",], network: "optimism",}, + polygon: { dexes: ["Uniswap",], network: "polygon",}, +} + +Object.keys(config).forEach(chain => { + module.exports[chain] = { tvl } +}) \ No newline at end of file From b98e2d8af54073fb9c021e0dad9abb4c0b204bfa Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 30 Jun 2023 01:44:39 +0530 Subject: [PATCH 0148/1974] Exactly (#6680) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * ✨ exactly: treasury integration * code refactor --------- Co-authored-by: itofarina --- projects/treasury/exactly.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 projects/treasury/exactly.js diff --git a/projects/treasury/exactly.js b/projects/treasury/exactly.js new file mode 100644 index 00000000000..05e34a0f5c6 --- /dev/null +++ b/projects/treasury/exactly.js @@ -0,0 +1,26 @@ +const { sumTokens2 } = require('../helper/unwrapLPs') + +/** @type {Record} */ +const config = { + ethereum: { + auditor: "0x310A2694521f75C7B2b64b5937C16CE65C3EFE01", + }, + optimism: { + auditor: "0xaEb62e6F27BC103702E7BC879AE98bceA56f027E", + }, +}; + +Object.entries(config).forEach(([chain, { auditor }]) => { + module.exports[chain] = { + tvl: async (_, __, ___, { api }) => { + const markets = await api.call({ abi: abis.allMarkets, target: auditor, }); + const treasuries = await api.multiCall({ abi: abis.treasury, calls: markets, }) + return sumTokens2({ api, tokens: markets, owners: treasuries, }) + }, + }; +}); + +const abis = { + allMarkets: "function allMarkets() view returns (address[])", + treasury: "function treasury() view returns (address)", +}; From 1a06ab5d68fcac3408f023bd5e5d328159e7e12b Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 29 Jun 2023 22:05:09 +0200 Subject: [PATCH 0149/1974] minor fix --- projects/defiedge/index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/projects/defiedge/index.js b/projects/defiedge/index.js index 940ad91806a..dba0ab92cdd 100644 --- a/projects/defiedge/index.js +++ b/projects/defiedge/index.js @@ -15,7 +15,6 @@ async function tvl() { const { dexes, network } = config[api.chain] for (const dex of dexes) { const results = await graphQuery(endpoint, query, { network: [network], dex: [dex] }) - console.log(results.stats.totalValueManaged, api.chain, dex) tvl += results.stats.totalValueManaged } From f39a6cc98554b73256a070d1dfce93a0d8b0febe Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Fri, 30 Jun 2023 05:39:53 +0100 Subject: [PATCH 0150/1974] add hallmarks --- projects/Solily/index.js | 3 +++ projects/crown-finance/index.js | 3 +++ projects/jupiterswap/index.js | 3 +++ projects/kasavadex/index.js | 3 +++ projects/kavacave/index.js | 3 +++ projects/kefirswap/index.js | 5 ++++- projects/rubyfinance/index.js | 3 +++ projects/surfswap/index.js | 3 +++ 8 files changed, 25 insertions(+), 1 deletion(-) diff --git a/projects/Solily/index.js b/projects/Solily/index.js index 809ae8c77b0..d72e86d38b5 100644 --- a/projects/Solily/index.js +++ b/projects/Solily/index.js @@ -1,6 +1,9 @@ module.exports = { + hallmarks: [ + [1655251200, "Rug Pull"] + ], timetravel: false, solana: { tvl: () => 0, diff --git a/projects/crown-finance/index.js b/projects/crown-finance/index.js index b4000e1f1b3..def99f5ec12 100644 --- a/projects/crown-finance/index.js +++ b/projects/crown-finance/index.js @@ -1,6 +1,9 @@ module.exports = { + hallmarks: [ + [1655582945, "Rug Pull"] + ], deadFrom: 1655582945, // we suspect that the project has rugged cronos: { tvl: () => ({}), diff --git a/projects/jupiterswap/index.js b/projects/jupiterswap/index.js index 70c4c723db1..ae008a54045 100644 --- a/projects/jupiterswap/index.js +++ b/projects/jupiterswap/index.js @@ -1,6 +1,9 @@ const { getUniTVL } = require('../helper/unknownTokens') module.exports = { + hallmarks: [ + [1660521600, "incentives not given"] + ], misrepresentedTokens: true, methodology: "Factory addresses (0xc08BAEA14C14f25bcafe3e3E05550715505eF3dE for kava) is used to find the LP pairs. TVL is equal to the liquidity on the AMM.", kava: { diff --git a/projects/kasavadex/index.js b/projects/kasavadex/index.js index 889b273cf4f..0300bb05d94 100644 --- a/projects/kasavadex/index.js +++ b/projects/kasavadex/index.js @@ -1,6 +1,9 @@ const { getUniTVL } = require('../helper/unknownTokens') module.exports = { + hallmarks: [ + [1660521600, "incentives not given"] + ], misrepresentedTokens: true, methodology: "Factory addresses (0x8F1fD6Ed57B0806FF114135F5b50B5f76e9542F2 for kava) is used to find the LP pairs. TVL is equal to the liquidity on the AMM.", kava: { diff --git a/projects/kavacave/index.js b/projects/kavacave/index.js index 53906d3d03a..87ee3079174 100644 --- a/projects/kavacave/index.js +++ b/projects/kavacave/index.js @@ -76,6 +76,9 @@ async function kavaTvl(timestamp, block, chainBlocks) { } module.exports = { + hallmarks: [ + [1660521600, "incentives not given"] + ], methodology: "Staked LP is counted as TVL.", kava: { diff --git a/projects/kefirswap/index.js b/projects/kefirswap/index.js index a3ab5595527..b2d98d9fae9 100644 --- a/projects/kefirswap/index.js +++ b/projects/kefirswap/index.js @@ -1,4 +1,4 @@ -const ADDRESSES = require('../helper/coreAssets.json') +const ADDRESSES = require('../helper/coreAssets.json') const { getUniTVL } = require('../helper/unknownTokens') // const KEFIR = "0xf5E547C683f5d72D6A463542d3e2cC13C5470D71" @@ -6,6 +6,9 @@ const FACTORY = "0xeEAbe2F15266B19f3aCF743E69105016277756Fb" const WKAVA = ADDRESSES.kava.WKAVA module.exports = { + hallmarks: [ + [1656806400, "Rug Pull"] + ], methodology: "Count TVL as liquidity on the dex", misrepresentedTokens: true, kava: { diff --git a/projects/rubyfinance/index.js b/projects/rubyfinance/index.js index b1cea165c49..f26ba2153f1 100644 --- a/projects/rubyfinance/index.js +++ b/projects/rubyfinance/index.js @@ -89,6 +89,9 @@ async function KavaPool2(timestamp, block, chainBlocks) { } module.exports = { + hallmarks: [ + [1660521600, "incentives not given"] + ], methodology: "Pool2 deposits consist of RUBY/USDC, RUBY/KAVA, RSHARE/KAVA and RUBY/RSHARE LP deposits while the staking TVL consists of the RSHARE tokens locked within the Boardroom contract.", kava: { diff --git a/projects/surfswap/index.js b/projects/surfswap/index.js index 945f956c458..25139599720 100644 --- a/projects/surfswap/index.js +++ b/projects/surfswap/index.js @@ -6,6 +6,9 @@ const dexTVL = getUniTVL({ }) module.exports = { + hallmarks: [ + [1660521600, "incentives not given"] + ], misrepresentedTokens: true, kava: { tvl:dexTVL, From f2f4db238bb79c09d9dc92946bb71dab50e0d58f Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Fri, 30 Jun 2023 06:28:51 +0100 Subject: [PATCH 0151/1974] add hallmarks --- projects/vacusfinance/index.js | 3 +++ projects/velaro/index.js | 3 +++ 2 files changed, 6 insertions(+) diff --git a/projects/vacusfinance/index.js b/projects/vacusfinance/index.js index fda3f91a78b..eec2b7b6b11 100644 --- a/projects/vacusfinance/index.js +++ b/projects/vacusfinance/index.js @@ -85,6 +85,9 @@ async function staking(_, _b, { [chain]: block }) { module.exports = { + hallmarks: [ + [1665187200, "Rug Pull"] + ], misrepresentedTokens: true, avax: { tvl, diff --git a/projects/velaro/index.js b/projects/velaro/index.js index f82eb66d54a..85ccb5db546 100644 --- a/projects/velaro/index.js +++ b/projects/velaro/index.js @@ -2,6 +2,9 @@ const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens2 } = require('../helper/unwrapLPs') const chain = 'velas' module.exports = { + hallmarks: [ + [1668556800, "USDV hack"] + ], velas: { tvl: async (_, _b, { [chain]: block }) => { return sumTokens2({ From 1150efd677b3064c10f5561c59940c487734d33a Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 30 Jun 2023 07:46:59 +0200 Subject: [PATCH 0152/1974] add support for pegasys v3 on rollux --- package-lock.json | 12 ++++++------ projects/helper/chains.json | 1 + projects/pegasys-v3/index.js | 5 +++++ 3 files changed, 12 insertions(+), 6 deletions(-) create mode 100644 projects/pegasys-v3/index.js diff --git a/package-lock.json b/package-lock.json index 6a48860ffb1..56af725e087 100644 --- a/package-lock.json +++ b/package-lock.json @@ -63,9 +63,9 @@ } }, "node_modules/@defillama/sdk": { - "version": "4.0.28", - "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.28.tgz", - "integrity": "sha512-0mqCkiy1pOhZgLCQ/RSdHyuPvchoIoOWj0JIRzFnUAV9uEP6Pck/EqYNB4PpoonZqWAqBDM2cGN1/qj/WQUUtw==", + "version": "4.0.30", + "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.30.tgz", + "integrity": "sha512-2Z5uQhddHSlcAePFw7d6xBK7JjDXDjmJQiOM7E5/IckaDu7AAD1bm5HScBeTKvBItKAdgDvU48nZeMFj7okImA==", "dependencies": { "@supercharge/promise-pool": "^2.1.0", "ethers": "^5.4.5", @@ -4194,9 +4194,9 @@ } }, "@defillama/sdk": { - "version": "4.0.28", - "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.28.tgz", - "integrity": "sha512-0mqCkiy1pOhZgLCQ/RSdHyuPvchoIoOWj0JIRzFnUAV9uEP6Pck/EqYNB4PpoonZqWAqBDM2cGN1/qj/WQUUtw==", + "version": "4.0.30", + "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.30.tgz", + "integrity": "sha512-2Z5uQhddHSlcAePFw7d6xBK7JjDXDjmJQiOM7E5/IckaDu7AAD1bm5HScBeTKvBItKAdgDvU48nZeMFj7okImA==", "requires": { "@supercharge/promise-pool": "^2.1.0", "ethers": "^5.4.5", diff --git a/projects/helper/chains.json b/projects/helper/chains.json index 197caed3fdd..acddf73aea7 100644 --- a/projects/helper/chains.json +++ b/projects/helper/chains.json @@ -161,6 +161,7 @@ "rei", "reichain", "ripple", + "rollux", "ronin", "rsk", "rvn", diff --git a/projects/pegasys-v3/index.js b/projects/pegasys-v3/index.js new file mode 100644 index 00000000000..e474864b7b9 --- /dev/null +++ b/projects/pegasys-v3/index.js @@ -0,0 +1,5 @@ +const { uniV3Export } = require('../helper/uniswapV3') + +module.exports = uniV3Export({ + rollux: { factory: '0xeAa20BEA58979386A7d37BAeb4C1522892c74640', fromBlock: 87430, }, +}) From d333c1e7b5a5310bf23f76c6df1130ed6e14eb87 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 30 Jun 2023 09:14:15 +0200 Subject: [PATCH 0153/1974] lint fix --- projects/kavacave/index.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/projects/kavacave/index.js b/projects/kavacave/index.js index 87ee3079174..fd5cfc7840f 100644 --- a/projects/kavacave/index.js +++ b/projects/kavacave/index.js @@ -6,7 +6,7 @@ const { getFixBalances } = require("../helper/portedTokens"); const masterChef = { - kava:"0xf17BBB9698b50156Ee437E01e22D7C2080184934" + kava: "0xf17BBB9698b50156Ee437E01e22D7C2080184934" }; const abi = { kava: kavaabi, @@ -14,8 +14,8 @@ const abi = { async function getTokensInMasterChef(time, ethBlock, chainBlocks, chain) { const block = chainBlocks[chain]; - - const transformAddress = (addr) => `${chain}:${addr}`; + + const transformAddress = (addr) => `${chain}:${addr}`; // const transformAddress=(addr)=>kavaFixMapping[addr]; const balances = {}; const poolLength = ( @@ -66,7 +66,7 @@ async function getTokensInMasterChef(time, ethBlock, chainBlocks, chain) { await unwrapUniswapLPs(balances, lpPositions, block, chain, transformAddress); // console.log(balances) - const fixbalances=await getFixBalances(chain); + const fixbalances = await getFixBalances(chain); fixbalances(balances); return balances; } @@ -78,7 +78,7 @@ async function kavaTvl(timestamp, block, chainBlocks) { module.exports = { hallmarks: [ [1660521600, "incentives not given"] - ], + ], methodology: "Staked LP is counted as TVL.", kava: { From b18023e03de532f6c16dd049b8042fd507044ece Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 30 Jun 2023 10:27:30 +0200 Subject: [PATCH 0154/1974] wonderly rugged --- projects/wonderly/index.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/projects/wonderly/index.js b/projects/wonderly/index.js index f08be7318f9..7e4c030d206 100644 --- a/projects/wonderly/index.js +++ b/projects/wonderly/index.js @@ -1,4 +1,4 @@ -const ADDRESSES = require('../helper/coreAssets.json') +const ADDRESSES = require('../helper/coreAssets.json') const Abis = require("./abi.json"); const sdk = require("@defillama/sdk"); const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); @@ -158,3 +158,15 @@ module.exports = { staking: calcArbitrumStakingTvl } }; + +module.exports = { + fantom: { + tvl: () => ({}), + }, + arbitrum: { + tvl: () => ({}), + }, + hallmarks: [ + [Math.floor(new Date('2023-02-15')/1e3), 'Project rugged'], + ], +} \ No newline at end of file From 269802f24f6fd2d69de7283228821f45b0c351f8 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 30 Jun 2023 10:34:52 +0200 Subject: [PATCH 0155/1974] track gogopool.com --- projects/gogopool/index.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 projects/gogopool/index.js diff --git a/projects/gogopool/index.js b/projects/gogopool/index.js new file mode 100644 index 00000000000..ea7a4d75d30 --- /dev/null +++ b/projects/gogopool/index.js @@ -0,0 +1,12 @@ +async function tvl(_, _b, _cb, { api, }) { + const ggAVAX = '0xA25EaF2906FA1a3a13EdAc9B9657108Af7B703e3' + const token = await api.call({ abi: 'address:asset', target: ggAVAX }) + const bal= await api.call({ abi: 'uint256:totalAssets', target: ggAVAX }) + api.add(token, bal) +} + +module.exports = { + avax: { + tvl, + } +} \ No newline at end of file From d38d248ba9c85b90e780eb810738c4d971e9a369 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 30 Jun 2023 10:59:11 +0200 Subject: [PATCH 0156/1974] add ozone chain & lobsterswap --- projects/adenafinance/index.js | 2 +- projects/helper/chains.json | 1 + projects/helper/tokenMapping.js | 3 +++ projects/lobsterswap/index.js | 19 +++++++++++++++++++ 4 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 projects/lobsterswap/index.js diff --git a/projects/adenafinance/index.js b/projects/adenafinance/index.js index a8ce5a34a9b..a7080d65794 100644 --- a/projects/adenafinance/index.js +++ b/projects/adenafinance/index.js @@ -3,6 +3,6 @@ const { getUniTVL } = require('../helper/unknownTokens') module.exports = { misrepresentedTokens: true, harmony: { - tvl: getUniTVL({ factory: '0x44485473431fAF6EFA11D346d1057182d2A0A290', chain: 'harmony', useDefaultCoreAssets: true }), + tvl: getUniTVL({ factory: '0x44485473431fAF6EFA11D346d1057182d2A0A290', useDefaultCoreAssets: true }), } } diff --git a/projects/helper/chains.json b/projects/helper/chains.json index acddf73aea7..9c91550f151 100644 --- a/projects/helper/chains.json +++ b/projects/helper/chains.json @@ -141,6 +141,7 @@ "ore", "orai", "osmosis", + "ozone", "palette", "palm", "parallel", diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 4c712f3e809..0d9deac6ebf 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -53,6 +53,9 @@ const fixBalancesTokens = { // }, rpg: { '0x8e8816a1747fddc5f8b45d2e140a425d3788f659': { coingeckoId: "tether", decimals: 18 }, + }, + ozone: { + '0x83048f0bf34feed8ced419455a4320a735a92e9d': { coingeckoId: "ozonechain", decimals: 18 }, } } diff --git a/projects/lobsterswap/index.js b/projects/lobsterswap/index.js new file mode 100644 index 00000000000..59d75516bb4 --- /dev/null +++ b/projects/lobsterswap/index.js @@ -0,0 +1,19 @@ +const { getUniTVL } = require('../helper/unknownTokens') +const ethers = require("ethers") +const { config } = require('@defillama/sdk/build/api'); + +config.setProvider("ozone", new ethers.providers.StaticJsonRpcProvider("https://node1.ozonechain.io", { name: "ozone", chainId: 4000, })) + +module.exports = { + misrepresentedTokens: true, + bsc: { + tvl: getUniTVL({ factory: '0xF936CDe5138282eDC6370F9f5ac70d9a1AFC6F78', useDefaultCoreAssets: true }), + }, + ozone: { + tvl: getUniTVL({ factory: '0xE6E64C926af9ABEc9D819f52c9572AB961CEF6C1', useDefaultCoreAssets: true }), + }, +} + +//https://github.com/lobster-swap +// https://app.lobsterswap.com/ +// https://twitter.com/lobster_swap From 92c15ac59da346532e43934694d0e4097ba993ce Mon Sep 17 00:00:00 2001 From: ZkSwapFinance <126151208+ZkSwapFinance@users.noreply.github.com> Date: Fri, 30 Jun 2023 16:15:13 +0700 Subject: [PATCH 0157/1974] zkSwap Dex on zkSync Era (#6686) * zkswap DEX on zkSync Era * folder name * old folder * new name folder * minor fix --------- Co-authored-by: not found Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/zkSwap-finance/index.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 projects/zkSwap-finance/index.js diff --git a/projects/zkSwap-finance/index.js b/projects/zkSwap-finance/index.js new file mode 100644 index 00000000000..ab2df257970 --- /dev/null +++ b/projects/zkSwap-finance/index.js @@ -0,0 +1,13 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports = { + misrepresentedTokens: true, + era: { + tvl: getUniTVL({ + factory: '0x3a76e377ED58c8731F9DF3A36155942438744Ce3', + useDefaultCoreAssets: true, + fetchBalances: true, + }) + }, + methodology: "TVL is total liquidity of all liquidity pools." +}; From d75b8b013dd7f37d2f377c6e51788f0874012718 Mon Sep 17 00:00:00 2001 From: "adam.xyz" <66784124+adamxyzxyz@users.noreply.github.com> Date: Fri, 30 Jun 2023 06:48:26 -0400 Subject: [PATCH 0158/1974] arbitrum and eth tvl calcs (#6663) * redo eth tvl calc * add arbitrum tvl * update tvl calculation to be more exact, add borrowed * fractral refactor: use sdk v2 --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/fractal-protocol/index.js | 236 ++++++++++++++++++----------- 1 file changed, 147 insertions(+), 89 deletions(-) diff --git a/projects/fractal-protocol/index.js b/projects/fractal-protocol/index.js index fca207358e6..2aa46160e31 100644 --- a/projects/fractal-protocol/index.js +++ b/projects/fractal-protocol/index.js @@ -1,98 +1,156 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const sdk = require('@defillama/sdk') -const { userInfo } = require('../pendle/abi.json') +const { userInfo } = require('../pendle/abi.json'); const { sumTokens2 } = require('../helper/unwrapLPs') -const FRACTAL_VAULT_CONTRACT = '0x3EAa4b3e8967c02cE1304C1EB35e8C5409838DFC'; -const YIELD_RESERVE = '0xbA83B569e99B6afc2f2BfE5124460Be6f36a4a56'; -module.exports = { - misrepresentedTokens: true, - ethereum: { - tvl: async (_, block) => { - const convexStakingWrapper_tUSD = '0x00Ec5E23B203B8aE16d55C7F601d1c67e45D826c' - const franUnifiedFarm_tUSD = '0xb324b2bd8a3dc55b04111e84d5cce0c3771f8889' - const convexStakingWrapper_alUSD = '0x0def0fac24dead04e2f4b49b5fb50b10478e2fa6' - const franUnifiedFarm_alUSD = '0x711d650cd10df656c2c28d375649689f137005fa' - const { output: tUSDBal } = await sdk.api.abi.call({ - target: franUnifiedFarm_tUSD, params: convexStakingWrapper_tUSD, - abi: abis.lockedLiquidityOf, block, - }) - const { output: alUSDBal } = await sdk.api.abi.call({ - target: franUnifiedFarm_alUSD, params: convexStakingWrapper_alUSD, - abi: abis.lockedLiquidityOf, block, - }) - const { output: convexTUSD } = await sdk.api.erc20.balanceOf({ - target: '0x4a744870fd705971c8c00ac510eac2206c93d5bb', owner: '0xFD1D1339Dbc24496D70DBF7912c07aE2EF71bC2d', block, - }) - const balances = { - '0xB30dA2376F63De30b42dC055C93fa474F31330A5': alUSDBal, - '0x33baeDa08b8afACc4d3d07cf31d49FC1F1f3E893': tUSDBal, - '0x10BE382cfAB53e0aBD093D6801B5e95C6Aedb715': convexTUSD, - } - return sumTokens2({ balances, owners: [FRACTAL_VAULT_CONTRACT, YIELD_RESERVE,], tokens: [ADDRESSES.ethereum.USDC], block, }) - }, - borrowed: async (_, block) => { - const loanContract = '0xf0e3020934450152308e4a84a3c4a5801fcb8d29' - const { output: token } = await sdk.api.abi.call({ block, target: loanContract, abi: abis.principalToken }) - const { output: debt } = await sdk.api.abi.call({ block, target: loanContract, abi: abis.getDebt }) - return { - [token]: debt.principalDebtAmount, - } - } - }, - avax: { - tvl: async (_, _b, { avax: block }) => { - const chain = 'avax' - const strategy = '0x9fea225c7953869e68b8228d2c90422d905e5117' - const nUSDLP = '0xCA87BF3ec55372D9540437d7a86a7750B42C02f4' - const nUSDSwap = '0xed2a7edd7413021d440b09d654f3b87712abab66' - const synapseMiniChef = '0x3a01521f8e7f012eb37eaaf1cb9490a5d9e18249' - const { output: { amount } } = await sdk.api.abi.call({ - target: synapseMiniChef, params: [1, strategy], - abi: userInfo, chain, block, - }) - const { output: price } = await sdk.api.abi.call({ - target: nUSDSwap, abi: abis.getVirtualPrice, chain, block, - }) - return { tether: amount * price / 1e36 } - } - }, - polygon: { - tvl: async (_, _b, { polygon: block }) => { - const chain = 'polygon' - const strategy = '0x894cB5e24DDdD9ececb27831647ae869541Af28F' - const nUSDLP = '0x7479e1bc2f2473f9e78c89b4210eb6d55d33b645' - const nUSDSwap = '0x85fcd7dd0a1e1a9fcd5fd886ed522de8221c3ee5' - const synapseMiniChef = '0x7875af1a6878bda1c129a4e2356a3fd040418be5' - const { output: { amount } } = await sdk.api.abi.call({ - target: synapseMiniChef, params: [1, strategy], - abi: userInfo, chain, block, - }) - const { output: price } = await sdk.api.abi.call({ - target: nUSDSwap, abi: abis.getVirtualPrice, chain, block, - }) - return { tether: amount * price / 1e36 } - } - }, - moonriver: { - tvl: async (_, _b, { moonriver: block }) => { - const chain = 'moonriver' - const muSDCToken = '0xd0670aee3698f66e2d4daf071eb9c690d978bfa8' - const { output: mUSDC } = await sdk.api.erc20.balanceOf({ target: muSDCToken, chain, block, owner: '0x3Bc4D91B0dEdC1e8E93B356a7572f51815fe843B' }) - const { output: exchangeRate } = await sdk.api.abi.call({ - target: muSDCToken, abi: abis.exchangeRateStored, chain, block, - }) - return { - tether: mUSDC/1e8 * exchangeRate/1e16 - } - } - }, -} +//Fractal Addresses ETH +const FRACTAL_VAULT_CONTRACT_ETH = '0x3EAa4b3e8967c02cE1304C1EB35e8C5409838DFC'; +const FRACTAL_YIELD_RESERVE_ETH = '0xbA83B569e99B6afc2f2BfE5124460Be6f36a4a56'; + +//Token Addresses ETH +const USDC_ETH = '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48'; + +//Fractal Addreses ARB +const FRACTAL_VAULT_CONTRACT_ARB = '0x80e1a981285181686a3951B05dEd454734892a09' +const FRACTAL_YIELD_RESERVE_ARB = '0x7d7068fB0398906C693DBFc425584FD5b58c4B60' +const FRACTAL_CHRONOS_POOL = '0x468B6e0f89fa727A47d9512021050797B4875D6d' +const FRACTAL_CAMELOT_POOL = '0xf011B036934b58A619D2822d90ecd726126Efdf2' +const FRACTAL_CAMELOT_NITRO_POOL = '0x5d209809d3284309cC34B9D092f88fFc690de6c2' + +//Token Addresses Arb +const USDC_ARB = '0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8' +const USDF_ARB = '0xae48b7C8e096896E32D53F10d0Bf89f82ec7b987' + +//Fractal Addresses All Chains +const FRACTAL_FIREBLOCKS_OWNER = '0x931250786dFd106B1E63C7Fd8f0d854876a45200' + +//Other Addresses +const CHRONOS_GAUGE = '0xDb1759d287d13b409fA80505b623e48cB9cc44Fc' + +//Loans ETH +const ETH_LOANS = [ + '0x60f5A25DfdaBc3BfB3702bCB0142213CEaF1e89a' +] + +//Loans AVAX +const AVAX_LOANS = [ + '0x9297c3B0Eb3DB1Cc72E99cF641CE418a2c3791D9', + '0x1952ae434FA8B5E9c9a1374951e5fd9ae7BD75C7', + '0x9C7629E3bAD32631F3977eF7710415158208E057', + '0x3f2ebE04329B96CBfF6E9911c64fC0c1Fc609d9C', + '0x337dBC3d0C948F8Ef516F6678C3D63d11300Dc10', + '0x595b16Aab6E43664Bf5F2DF0E34fEF1A8e7a2692' +] const abis = { + getTokenPrice: "uint256:getTokenPrice", exchangeRateStored: "uint256:exchangeRateStored", getVirtualPrice: "uint256:getVirtualPrice", principalToken: "address:principalToken", lockedLiquidityOf: "function lockedLiquidityOf(address account) view returns (uint256)", getDebt: "function getDebt() view returns (uint256 interestDebtAmount, uint256 grossDebtAmount, uint256 principalDebtAmount, uint256 interestOwed, uint256 applicableLateFee, uint256 netDebtAmount, uint256 daysSinceFunding, uint256 currentBillingCycle, uint256 minPaymentAmount, uint256 maxPaymentAmount)", -} \ No newline at end of file + userInfo: "function userInfo(address account) view returns (uint256 totalDepositAmount, uint256 rewardDebtToken1, uint256 rewardDebtToken2, uint256 pendingRewardsToken1, uint256 pendingRewardsToken2)" +} + +// Define the function +async function getLoanDebt(loans, api) { + const loanDebts = await api.multiCall({ abi: abis.getDebt, calls: loans }) + loanDebts.map((loanDebt) => api.add(USDC_ETH, loanDebt.principalDebtAmount, { skipChain: true })) +} + +const getEthTvl = async (_, ethBlock, __, { api }) => { + return sumTokens2({ owners: [FRACTAL_YIELD_RESERVE_ETH, FRACTAL_VAULT_CONTRACT_ETH], tokens: [USDC_ETH,], api }) +}; + +const getEthLoans = async (_, ethBlock, __, { api }) => { + return getLoanDebt(ETH_LOANS, api) +} + +const getArbTvl = async (_, _b, { arbitrum: block }, { api }) => { + // const usdfPrice = await api.call({ target: FRACTAL_VAULT_CONTRACT_ARB, abi: abis.getTokenPrice, }) + + const [ + chronosLpBalance, usdcBalanceChronosPool, usdfBalanceChronosPool, usdcBalanceCamelotPool, usdfBalanceCamelotPool, + ] = await api.multiCall({ + abi: 'erc20:balanceOf', calls: [ + { target: CHRONOS_GAUGE, params: FRACTAL_FIREBLOCKS_OWNER }, + { target: USDC_ARB, params: FRACTAL_CHRONOS_POOL }, + { target: USDF_ARB, params: FRACTAL_CHRONOS_POOL }, + { target: USDC_ARB, params: FRACTAL_CAMELOT_POOL }, + { target: USDF_ARB, params: FRACTAL_CAMELOT_POOL }, + ] + }) + + const camelotUserInfo = await api.call({ + target: FRACTAL_CAMELOT_NITRO_POOL, + abi: abis.userInfo, + params: FRACTAL_FIREBLOCKS_OWNER, + }) + + const [ + chronosLpTokenSupply, camelotLpTokenSupply, + ] = await api.multiCall({ + abi: 'erc20:totalSupply', calls: [ + FRACTAL_CHRONOS_POOL, FRACTAL_CAMELOT_POOL, + ] + }) + + api.add(USDC_ARB, usdcBalanceChronosPool * chronosLpBalance / chronosLpTokenSupply) + api.add(USDC_ARB, usdcBalanceCamelotPool * camelotUserInfo.totalDepositAmount / camelotLpTokenSupply) + // api.add(USDF_ARB, usdfBalanceChronosPool * chronosLpBalance / chronosLpTokenSupply) + // api.add(USDF_ARB, usdfBalanceCamelotPool * camelotUserInfo.totalDepositAmount / camelotLpTokenSupply) + + return sumTokens2({ api, tokens: [USDC_ARB], owners: [FRACTAL_YIELD_RESERVE_ARB, FRACTAL_VAULT_CONTRACT_ARB] }) +}; + +const getAvaxTvl = async (_, _b, { avax: block }, { api }) => { + const strategy = '0x9fea225c7953869e68b8228d2c90422d905e5117' + const nUSDLP = '0xCA87BF3ec55372D9540437d7a86a7750B42C02f4' + const nUSDSwap = '0xed2a7edd7413021d440b09d654f3b87712abab66' + const synapseMiniChef = '0x3a01521f8e7f012eb37eaaf1cb9490a5d9e18249' + const { amount } = await api.call({ + target: synapseMiniChef, params: [1, strategy], + abi: userInfo, + }) + const price = await api.call({ + target: nUSDSwap, abi: abis.getVirtualPrice, + }) + const synapseBalance = amount * price / 1e36 + + return { tether: synapseBalance } +} + +const getAvaxLoans = async (_, _b, { avax: block }, { api }) => { + return getLoanDebt(AVAX_LOANS, api) +} + +const getPolygonTvl = async (_, _b, { polygon: block }, { api }) => { + const strategy = '0x894cB5e24DDdD9ececb27831647ae869541Af28F' + const nUSDLP = '0x7479e1bc2f2473f9e78c89b4210eb6d55d33b645' + const nUSDSwap = '0x85fcd7dd0a1e1a9fcd5fd886ed522de8221c3ee5' + const synapseMiniChef = '0x7875af1a6878bda1c129a4e2356a3fd040418be5' + const { amount } = await api.call({ + target: synapseMiniChef, params: [1, strategy], + abi: userInfo, + }) + const price = await api.call({ + target: nUSDSwap, abi: abis.getVirtualPrice, + }) + return { tether: amount * price / 1e36 } +} + + +module.exports = { + ethereum: { + tvl: getEthTvl, + borrowed: getEthLoans + }, + arbitrum: { + tvl: getArbTvl + }, + avax: { + tvl: getAvaxTvl, + borrowed: getAvaxLoans + }, + polygon: { + tvl: getPolygonTvl + } +}; From 2cbe2f0c40848c3cf3d683dfb62d8a5077939ba4 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 30 Jun 2023 14:13:58 +0200 Subject: [PATCH 0159/1974] satori: add era --- projects/satori/index.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/projects/satori/index.js b/projects/satori/index.js index e9ce1ffdaec..e7879e23305 100644 --- a/projects/satori/index.js +++ b/projects/satori/index.js @@ -11,4 +11,13 @@ module.exports = { polygon_zkevm: { tvl: sumTokensExport({ owners: WALLET_ADDR, tokens: [USDT_TOKEN_CONTRACT]}), }, + era: { + tvl: sumTokensExport({ + owners: [ + "0x0842b33529516abe86CA8EA771aC4c84FDd0eeE0", + "0x48756b37Fd643bB40F669804730024F02900C476", + ], + tokens: ["0x3355df6D4c9C3035724Fd0e3914dE96A5a83aaf4"], + }), + }, }; From e89aa272b357a999d6adaeecf773fd144fc3bc2a Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 30 Jun 2023 21:51:49 +0200 Subject: [PATCH 0160/1974] track exit10.fi --- projects/drachma/index.js | 4 ++-- projects/exit10-fi/index.js | 19 +++++++++++++++++ projects/helper/tokenMapping.js | 2 +- projects/velaro/index.js | 36 +++++++++++++++------------------ 4 files changed, 38 insertions(+), 23 deletions(-) create mode 100644 projects/exit10-fi/index.js diff --git a/projects/drachma/index.js b/projects/drachma/index.js index a1b85c27429..a4fa920a2a9 100644 --- a/projects/drachma/index.js +++ b/projects/drachma/index.js @@ -13,11 +13,11 @@ const { tvl: drachmaTvl, borrowed: drachmaBorrowed } = compoundExports( //tvl for drachma app function tvl(chain) { - return async (timestamp, block, chainBlocks) => { + return async (timestamp, block, chainBlocks, { api }) => { const toa = [] toa.push(...contracts[chain].map(c => ([c.token, c.address]))) toa.push(...contracts[chain].map(c => ([contracts.usdc[chain], c.address]))) - return sumTokens2({ chain, tokensAndOwners: toa, block: chainBlocks[chain], resolveLP: true, }) + return sumTokens2({ chain, tokensAndOwners: toa, api, resolveLP: true, }) }; } diff --git a/projects/exit10-fi/index.js b/projects/exit10-fi/index.js new file mode 100644 index 00000000000..c423d159d3a --- /dev/null +++ b/projects/exit10-fi/index.js @@ -0,0 +1,19 @@ +const { sumTokensExport } = require('../helper/unwrapLPs') + +const config = { + ethereum: { + uniV3Holders: ['0xBFD697f71159Ed85eb1A7fE3520Ad8e5d61017fB'], + }, + arbitrum: { + uniV3Holders: ['0x6aC7197B8C41F8C72a82c49fb219be8ec421dbb0'], + }, +} + +module.exports = {}; + +Object.keys(config).forEach(chain => { + const { uniV3Holders } = config[chain] + module.exports[chain] = { + tvl: sumTokensExport({ owners: uniV3Holders, resolveUniV3: true, }) + } +}) \ No newline at end of file diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 0d9deac6ebf..b8ac7ef9957 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -55,7 +55,7 @@ const fixBalancesTokens = { '0x8e8816a1747fddc5f8b45d2e140a425d3788f659': { coingeckoId: "tether", decimals: 18 }, }, ozone: { - '0x83048f0bf34feed8ced419455a4320a735a92e9d': { coingeckoId: "ozonechain", decimals: 18 }, + // '0x83048f0bf34feed8ced419455a4320a735a92e9d': { coingeckoId: "ozonechain", decimals: 18 }, // was mapped to wrong chain } } diff --git a/projects/velaro/index.js b/projects/velaro/index.js index 85ccb5db546..9c9bc2b6a7d 100644 --- a/projects/velaro/index.js +++ b/projects/velaro/index.js @@ -1,27 +1,23 @@ const ADDRESSES = require('../helper/coreAssets.json') -const { sumTokens2 } = require('../helper/unwrapLPs') -const chain = 'velas' +const { sumTokensExport } = require('../helper/unwrapLPs') module.exports = { hallmarks: [ [1668556800, "USDV hack"] ], velas: { - tvl: async (_, _b, { [chain]: block }) => { - return sumTokens2({ - tokensAndOwners: [ - [ADDRESSES.velas.WVLX, '0xbd183a60274289A7c20250a890500D2a37dEf319'], // VLX - ['0xaBf26902Fd7B624e0db40D31171eA9ddDf078351', '0x2Fee5293050FFfC3bd583d59f077e2b4900F57c8'], // WAG - [ADDRESSES.moonriver.ETH, '0x899F26dc6Bc085fb9cB82AAdF25Db8820F272ED4'], // WBTC - ['0x7b714BC5dD176EaA198fe6C07E415a87A40dc858', '0x7171d1E1097d726E5f4BBc8236A8E108E21024e3'], // WAG_VLXVDGT - ['0x72eB7CA07399Ec402c5b7aa6A65752B6A1Dc0C27', '0x1e217990818518Dc37B0fFA2ffE3AA110b02F18c'], // ASTRO - [ADDRESSES.velas._BNB, '0xc0D16c7Cd5Fc18526Dc78Ea530e56129EB979C96'], // BNB - [ADDRESSES.velas.FTM, '0x92C2cA50f74A8Fe36b4DCffB2cc6A274fA61CB34'], // FTM - [ADDRESSES.velas._MATIC, '0xd10f8CD5d56aaa58f59B25C928f372F66899e9B3'], // MATIC - [ADDRESSES.velas.BUSD, '0x4368d9F91C40EA8Ac9F11A4f9289889f56D32Df8'], // BUSD - ], - resolveLP: true, - chain, block - }) - } - }, + tvl: sumTokensExport({ + tokensAndOwners: [ + [ADDRESSES.velas.WVLX, '0xbd183a60274289A7c20250a890500D2a37dEf319'], // VLX + ['0xaBf26902Fd7B624e0db40D31171eA9ddDf078351', '0x2Fee5293050FFfC3bd583d59f077e2b4900F57c8'], // WAG + [ADDRESSES.moonriver.ETH, '0x899F26dc6Bc085fb9cB82AAdF25Db8820F272ED4'], // WBTC + ['0x7b714BC5dD176EaA198fe6C07E415a87A40dc858', '0x7171d1E1097d726E5f4BBc8236A8E108E21024e3'], // WAG_VLXVDGT + ['0x72eB7CA07399Ec402c5b7aa6A65752B6A1Dc0C27', '0x1e217990818518Dc37B0fFA2ffE3AA110b02F18c'], // ASTRO + [ADDRESSES.velas._BNB, '0xc0D16c7Cd5Fc18526Dc78Ea530e56129EB979C96'], // BNB + [ADDRESSES.velas.FTM, '0x92C2cA50f74A8Fe36b4DCffB2cc6A274fA61CB34'], // FTM + [ADDRESSES.velas._MATIC, '0xd10f8CD5d56aaa58f59B25C928f372F66899e9B3'], // MATIC + [ADDRESSES.velas.BUSD, '0x4368d9F91C40EA8Ac9F11A4f9289889f56D32Df8'], // BUSD + ], + resolveLP: true, + }) + } } From 93b3ec395e4f495a09d1a5b587178dcaa63d57e4 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Sat, 1 Jul 2023 02:10:27 +0100 Subject: [PATCH 0161/1974] add hallmarks --- projects/apexswap/index.js | 3 +++ projects/echswap/index.js | 3 +++ projects/inuswap/index.js | 3 +++ projects/klaylend/index.js | 5 ++++- projects/kumu-finance/index.js | 3 +++ projects/minerswap/index.js | 3 +++ projects/ohmw/index.js | 3 +++ projects/stabledoin/index.js | 3 +++ projects/zootopia-finance/index.js | 3 +++ 9 files changed, 28 insertions(+), 1 deletion(-) diff --git a/projects/apexswap/index.js b/projects/apexswap/index.js index f7b34fe421f..cbadf3ab1ed 100644 --- a/projects/apexswap/index.js +++ b/projects/apexswap/index.js @@ -2,6 +2,9 @@ const { getUniTVL } = require('../helper/unknownTokens') module.exports = { misrepresentedTokens: true, + hallmarks: [ + [1665532800, "Rug Pull"] + ], avax: { tvl: getUniTVL({ factory: '0x21cadeb92c8bbfbef98c3098846f0999209c3a97', diff --git a/projects/echswap/index.js b/projects/echswap/index.js index 83a8b908927..d694c736ce3 100644 --- a/projects/echswap/index.js +++ b/projects/echswap/index.js @@ -2,6 +2,9 @@ const { getUniTVL } = require('../helper/unknownTokens') module.exports = { misrepresentedTokens: true, + hallmarks: [ + [1671062400, "Rug Pull"] + ], echelon: { tvl: getUniTVL({ chain: 'echelon', useDefaultCoreAssets: true, factory: '0xaFd37A86044528010d0E70cDc58d0A9B5Eb03206' }) } diff --git a/projects/inuswap/index.js b/projects/inuswap/index.js index 0a20aeec9aa..0d551754788 100644 --- a/projects/inuswap/index.js +++ b/projects/inuswap/index.js @@ -5,6 +5,9 @@ const { const chain = 'dogechain' module.exports = { + hallmarks: [ + [1663200000, "Rug Pull"] + ], dogechain: { tvl: getUniTVL({ chain, diff --git a/projects/klaylend/index.js b/projects/klaylend/index.js index 983265ddeda..e0eb6d0f598 100644 --- a/projects/klaylend/index.js +++ b/projects/klaylend/index.js @@ -9,4 +9,7 @@ module.exports = masterchefExports({ masterchef: contract, nativeToken: kld, useDefaultCoreAssets: true, -}) \ No newline at end of file +}) +module.exports.hallmarks = [ + [1662336000, "Rug Pull"] +] \ No newline at end of file diff --git a/projects/kumu-finance/index.js b/projects/kumu-finance/index.js index 8de174d5761..f2c9a5ed319 100644 --- a/projects/kumu-finance/index.js +++ b/projects/kumu-finance/index.js @@ -41,6 +41,9 @@ async function staking(_, _b, { [chain]: block }) { } module.exports = { + hallmarks: [ + [1662336000, "Rug Pull"] + ], klaytn: { tvl, staking } diff --git a/projects/minerswap/index.js b/projects/minerswap/index.js index e294da30ad3..607a2c39ce5 100644 --- a/projects/minerswap/index.js +++ b/projects/minerswap/index.js @@ -1,3 +1,6 @@ const { uniTvlExport } = require('../helper/unknownTokens') +module.exports.hallmarks=[ + [1668124800, "Rug Pull"] +], module.exports = uniTvlExport('ethpow', '0x91836d77af0a5fda36c5a1f3c11dbc7766de4d03', undefined, undefined, { useDefaultCoreAssets: true, hasStablePools: true, }) diff --git a/projects/ohmw/index.js b/projects/ohmw/index.js index 468da5f5d4f..92a987cc952 100644 --- a/projects/ohmw/index.js +++ b/projects/ohmw/index.js @@ -3,6 +3,9 @@ const { ohmTvl } = require('../helper/ohm') const { getFixBalancesSync } = require('../helper/portedTokens') module.exports= { + hallmarks: [ + [1670457600, "Rug Pull"] + ], ...ohmTvl("0xE0Fe9Af0208ba444F81eDF348F23bd1A91Dc395E", [ ["0x11bbB41B3E8baf7f75773DB7428d5AcEe25FEC75", false], // USDC [ADDRESSES.ethereum.WETH, false], // WETH diff --git a/projects/stabledoin/index.js b/projects/stabledoin/index.js index b0ca812c78b..3b72f821e39 100644 --- a/projects/stabledoin/index.js +++ b/projects/stabledoin/index.js @@ -5,6 +5,9 @@ const factory = "0x7bbAB21475d99C09a92fc4B93Fa2DDa987DbA17c" module.exports = { misrepresentedTokens: true, + hallmarks: [ + [1666656000, "Rug Pull"] + ], dogechain: { tvl: sdk.util.sumChainTvls([ getUniTVL({ chain: 'dogechain', factory, useDefaultCoreAssets: true, }), diff --git a/projects/zootopia-finance/index.js b/projects/zootopia-finance/index.js index 599b5d35115..19ae5d28849 100644 --- a/projects/zootopia-finance/index.js +++ b/projects/zootopia-finance/index.js @@ -15,6 +15,9 @@ async function tvl(timestamp, ethereumBlock, { bsc: block }) { } module.exports = { + hallmarks: [ + [1667174400, "Rug Pull"] + ], bsc: { tvl, }, From d6e262ec60a385e569dcc12eb9d2b8aecfff56a1 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Sat, 1 Jul 2023 04:46:07 +0100 Subject: [PATCH 0162/1974] add hallmarks --- projects/CthulhuFinance/index.js | 3 +++ projects/ZukeSwap/index.js | 3 +++ projects/deridex/index.js | 3 +++ projects/dinosaur-finance/index.js | 3 +++ projects/manifesto/index.js | 3 +++ projects/mosquitos-finance/index.js | 3 +++ projects/palmaswap/index.js | 5 ++++- projects/sohei/index.js | 3 +++ projects/sugarswap/index.js | 5 ++++- projects/syrupfinance/index.js | 3 +++ projects/y2b-finance/index.js | 3 +++ 11 files changed, 35 insertions(+), 2 deletions(-) diff --git a/projects/CthulhuFinance/index.js b/projects/CthulhuFinance/index.js index 4ca6bb58021..7d293df098b 100644 --- a/projects/CthulhuFinance/index.js +++ b/projects/CthulhuFinance/index.js @@ -12,6 +12,9 @@ function vaultTvl(vaults) { } module.exports = { + hallmarks: [ + [1679788800, "Rug Pull"] + ], optimism: { tvl: vaultTvl([ "0xF6a6C4573099E6F6b9D8E1186a2C089B4d0fDf91", diff --git a/projects/ZukeSwap/index.js b/projects/ZukeSwap/index.js index af95e1bd6ff..6d16f07a583 100644 --- a/projects/ZukeSwap/index.js +++ b/projects/ZukeSwap/index.js @@ -1,6 +1,9 @@ const { getUniTVL } = require('../helper/unknownTokens') module.exports = { + hallmarks: [ + [1680307200, "Rug Pull"] + ], misrepresentedTokens: true, loop: { tvl: getUniTVL({ diff --git a/projects/deridex/index.js b/projects/deridex/index.js index 1cd419b751f..20af05f2bd3 100644 --- a/projects/deridex/index.js +++ b/projects/deridex/index.js @@ -24,6 +24,9 @@ async function tvl() { } module.exports = { + hallmarks: [ + [1675900800, "Project shuts down"] + ], timetravel: false, doublecounted: true, misrepresentedTokens: true, diff --git a/projects/dinosaur-finance/index.js b/projects/dinosaur-finance/index.js index 198a1b20b7a..ee0068e0121 100644 --- a/projects/dinosaur-finance/index.js +++ b/projects/dinosaur-finance/index.js @@ -21,6 +21,9 @@ async function tvl(_, _b, _c, { api }) { } module.exports = { + hallmarks: [ + [1675814400, "Rug Pull"] + ], arbitrum: { tvl, } diff --git a/projects/manifesto/index.js b/projects/manifesto/index.js index 7e0052c1490..41468a3c687 100644 --- a/projects/manifesto/index.js +++ b/projects/manifesto/index.js @@ -5,6 +5,9 @@ const lps = [ ] module.exports = { + hallmarks: [ + [1676332800, "Rug Pull"] + ], misrepresentedTokens: true, canto: { tvl: sumTokensExport({ diff --git a/projects/mosquitos-finance/index.js b/projects/mosquitos-finance/index.js index 698f72ac45e..a5c8a930b56 100644 --- a/projects/mosquitos-finance/index.js +++ b/projects/mosquitos-finance/index.js @@ -137,6 +137,9 @@ async function staking() { } module.exports = { + hallmarks: [ + [1678320000, "Rug Pull"] + ], timetravel: false, aptos: { tvl, diff --git a/projects/palmaswap/index.js b/projects/palmaswap/index.js index fbcaf19e97d..6cacfa927a3 100644 --- a/projects/palmaswap/index.js +++ b/projects/palmaswap/index.js @@ -1,4 +1,4 @@ -const ADDRESSES = require('../helper/coreAssets.json') +const ADDRESSES = require('../helper/coreAssets.json') const { getUniTVL, staking } = require('../helper/unknownTokens') const sdk = require('@defillama/sdk') const uniTvl = getUniTVL({ factory: '0xb8b9a4d9beE1fB41b03edfa47640b1dadF49EDd2', useDefaultCoreAssets: true, }) @@ -8,6 +8,9 @@ const weth = ADDRESSES.core.WCORE module.exports = { misrepresentedTokens: true, + hallmarks: [ + [1679356800, "Rug Pull"] + ], core: { tvl: sdk.util.sumChainTvls([uniTvl, staking({ owners: [masterchef], diff --git a/projects/sohei/index.js b/projects/sohei/index.js index 3bb9e33f213..4882d9f1162 100644 --- a/projects/sohei/index.js +++ b/projects/sohei/index.js @@ -5,5 +5,8 @@ const ceth = "0x685d1f1a83ff64e75fe882e7818e4ad9173342ca"; const chain = "arbitrum"; module.exports = { + hallmarks: [ + [1680480000, "Team out of funds announced"] + ], arbitrum: compoundExports('0x9f750cf10034f3d7a18221aec0bddab7fc6f32ba', chain, ceth, nullAddress, undefined, undefined, { blacklistedTokens: ['0x6e002cb9bf8c17409eeb6c593ef6548faddd2985']}), }; \ No newline at end of file diff --git a/projects/sugarswap/index.js b/projects/sugarswap/index.js index 5d565e21ce7..23df7132dc0 100644 --- a/projects/sugarswap/index.js +++ b/projects/sugarswap/index.js @@ -1,4 +1,4 @@ -const ADDRESSES = require('../helper/coreAssets.json') +const ADDRESSES = require('../helper/coreAssets.json') const { getUniTVL, staking } = require('../helper/unknownTokens') const sdk = require('@defillama/sdk') const uniTvl = getUniTVL({ factory: '0x1486397B3C0e6fEB8c483faD2F03E8c404cAEDe7', useDefaultCoreAssets: true }) @@ -7,6 +7,9 @@ const sugar = '0xd3ccBF3867FF0204730173eB4cad3C4B5fd07c69' const weth = ADDRESSES.arbitrum.WETH module.exports = { + hallmarks: [ + [1673827200, "Rug Pull"] + ], misrepresentedTokens: true, arbitrum: { tvl: sdk.util.sumChainTvls([uniTvl, staking({ diff --git a/projects/syrupfinance/index.js b/projects/syrupfinance/index.js index b76635caeb4..d053dd47524 100644 --- a/projects/syrupfinance/index.js +++ b/projects/syrupfinance/index.js @@ -8,6 +8,9 @@ const srxToken = "0xdef49c195099e30e41b2df7dad55e0bbbe60a0c5"; module.exports = { + hallmarks: [ + [1675209600, "Rug Pull"] + ], bsc: { staking: staking(bscStaking, srxToken, "bsc", undefined, undefined), tvl: gmxExports({ vault: bscVault }) diff --git a/projects/y2b-finance/index.js b/projects/y2b-finance/index.js index 3bc97660a31..e90457e14ac 100644 --- a/projects/y2b-finance/index.js +++ b/projects/y2b-finance/index.js @@ -22,6 +22,9 @@ async function tvl(timestamp, _b, chainBlocks, { api }) { module.exports = { + hallmarks: [ + [1673913600, "Rug Pull"] + ], ethereum: { tvl, // staking: sumTokensExport({ owners: [], tokens: ['0xF9C12B27cE5058ab98ce11BD53900f84E18C0650']}) From 13f1bfbcc148ef60b5191f7ebdea1abdb7c0a05e Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Sat, 1 Jul 2023 10:48:24 +0200 Subject: [PATCH 0163/1974] track https://ghastprotocol.com/ --- projects/ghast/index.js | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 projects/ghast/index.js diff --git a/projects/ghast/index.js b/projects/ghast/index.js new file mode 100644 index 00000000000..35abcaeb6d4 --- /dev/null +++ b/projects/ghast/index.js @@ -0,0 +1,29 @@ +const { sumTokens2 } = require('../helper/unwrapLPs') + +const config = { + arbitrum: { + lendingPools: { + BTC: '0x711b36a726486bd910a819eb7930e60a1afcac7b', + USDC: '0xb8bc618e49201B68C1D594aA458aeBFF22B03c35', + WETH: '0x5d99d1d2e9f3a5f3d8f5dd5ce533b3635590c384', + } + } +} + +Object.keys(config).forEach(chain => { + const { lendingPools } = config[chain] + const pools = Object.values(lendingPools) + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const tokens = await api.multiCall({ abi: 'address:TOKEN', calls: pools}) + const gmdTokens = await api.multiCall({ abi: 'address:gmdTOKEN', calls: pools}) + const ownerTokens = pools.map((v, i) => [[tokens[i],gmdTokens[i],], v]) + return sumTokens2({ api, ownerTokens, }) + }, + /* borrowed: async (_, _b, _cb, { api, }) => { + const tokens = await api.multiCall({ abi: 'address:gmdTOKEN', calls: pools}) + const bals = await api.multiCall({ abi: 'uint256:totalBorrows', calls: pools}) + api.addTokens(tokens, bals) + }, */ + } +}) \ No newline at end of file From 3b2ebe4498634c2146b0bd0cddda8adbefaa0240 Mon Sep 17 00:00:00 2001 From: Michael Otis <34221002+michaelotis@users.noreply.github.com> Date: Sat, 1 Jul 2023 04:11:37 -0500 Subject: [PATCH 0164/1974] Update Vela Exchange TVL/Staking metrics (#6689) * Update Vela TVL/Staking * Remove async-retry * Update index.js --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/vela-exchange/index.js | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/projects/vela-exchange/index.js b/projects/vela-exchange/index.js index 9b862c95278..47facb09501 100644 --- a/projects/vela-exchange/index.js +++ b/projects/vela-exchange/index.js @@ -1,13 +1,36 @@ const ADDRESSES = require('../helper/coreAssets.json') const { staking } = require("../helper/staking") +const { graphQuery } = require('../helper/http') + +const VELA = '0x088cd8f5eF3652623c22D48b1605DCfE860Cd704' + +const endpoint = "https://api.thegraph.com/subgraphs/name/velaexchange/vela-exchange-official" +async function staking_() { + const { api } = arguments[3] + + const query = ` + query { + poolInfos(where: { + id: "all" + }) { + pid1 + pid2 + pid3 + } + } + `; + const graphRes = (await graphQuery(endpoint, query)).poolInfos.find(x => true); + api.add(VELA, graphRes?.pid2) + api.add(VELA, graphRes?.pid3) +} module.exports = { - methodology: "Counts USDC deposited to trade and to mint VLP. Staking counts VELA deposited to earn eVELA", + methodology: "Counts USDC deposited to trade and to mint VLP. Staking counts VELA and esVELA deposited to earn esVELA", arbitrum: { tvl: staking('0xC4ABADE3a15064F9E3596943c699032748b13352', ADDRESSES.arbitrum.USDC), - staking: staking('0xfC527781Ae973f8131dC26dDDb2Adb080c1C1F59', '0x088cd8f5eF3652623c22D48b1605DCfE860Cd704'), + staking: staking_ }, hallmarks: [ - [Math.floor(new Date('2023-04-13')/1e3), 'Refunded tokens to VLP holders & traders'], + [Math.floor(new Date('2023-04-13') / 1e3), 'Refunded tokens to VLP holders & traders'], ], -} \ No newline at end of file +} From 6192f112f6a284925e6bc994c8c3b76d8a381653 Mon Sep 17 00:00:00 2001 From: Tigris of Gaul <81036209+tigris-of-gaul@users.noreply.github.com> Date: Sat, 1 Jul 2023 09:13:06 +0000 Subject: [PATCH 0165/1974] Add Tarot factory (#6688) --- projects/tarot/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/tarot/index.js b/projects/tarot/index.js index ba4fb48e0cb..7bdb44c97ed 100644 --- a/projects/tarot/index.js +++ b/projects/tarot/index.js @@ -15,6 +15,7 @@ const config = { '0x1D90fDAc4DD30c3ba38d53f52A884F6e75d0989e', // Tarot Opaline '0xD7cABeF2c1fD77a31c5ba97C724B82d3e25fC83C', // Tarot Velours '0x49DF1fe24cAf1a7dcBB2E2b1793b93b04eDb62bF', // Tarot Jupiter + '0xBA47316035E6C95b31cb55BfB93458Ad41E4Da04', // Tarot Velouté ] }, arbitrum: { From 5b4dcbae9d7774964f35c1e77cfdd2b21ce78a0c Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Sat, 1 Jul 2023 12:26:19 +0200 Subject: [PATCH 0166/1974] use token labels --- projects/ferro/index.js | 5 +++-- projects/fractal-protocol/index.js | 5 +++-- projects/jetprotocol.js | 34 +++++++----------------------- projects/revest/index.js | 3 ++- projects/satori/index.js | 3 ++- projects/treasury/kinza.js | 3 ++- projects/treasury/savvy.js | 7 +++--- 7 files changed, 24 insertions(+), 36 deletions(-) diff --git a/projects/ferro/index.js b/projects/ferro/index.js index 79da977152d..e34a9adb036 100644 --- a/projects/ferro/index.js +++ b/projects/ferro/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens2 } = require('../helper/unwrapLPs') const SWAP_3FER_ADDR = '0xe8d13664a42B338F009812Fa5A75199A865dA5cD'; @@ -11,12 +12,12 @@ const tokens = { SWAP_3FER_ADDR, ], // USDC - "0xc21223249CA28397B4B6541dfFaEcC539BfF0c59": [ + [ADDRESSES.cronos.USDC]: [ SWAP_3FER_ADDR, SWAP_2FER_ADDR, ], // USDT - "0x66e428c3f67a68878562e79A0234c1F83c208770": [ + [ADDRESSES.cronos.USDT]: [ SWAP_3FER_ADDR, SWAP_2FER_ADDR, ], diff --git a/projects/fractal-protocol/index.js b/projects/fractal-protocol/index.js index 2aa46160e31..e3fb14c1ae8 100644 --- a/projects/fractal-protocol/index.js +++ b/projects/fractal-protocol/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { userInfo } = require('../pendle/abi.json'); const { sumTokens2 } = require('../helper/unwrapLPs') @@ -6,7 +7,7 @@ const FRACTAL_VAULT_CONTRACT_ETH = '0x3EAa4b3e8967c02cE1304C1EB35e8C5409838DFC'; const FRACTAL_YIELD_RESERVE_ETH = '0xbA83B569e99B6afc2f2BfE5124460Be6f36a4a56'; //Token Addresses ETH -const USDC_ETH = '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48'; +const USDC_ETH = ADDRESSES.ethereum.USDC; //Fractal Addreses ARB const FRACTAL_VAULT_CONTRACT_ARB = '0x80e1a981285181686a3951B05dEd454734892a09' @@ -16,7 +17,7 @@ const FRACTAL_CAMELOT_POOL = '0xf011B036934b58A619D2822d90ecd726126Efdf2' const FRACTAL_CAMELOT_NITRO_POOL = '0x5d209809d3284309cC34B9D092f88fFc690de6c2' //Token Addresses Arb -const USDC_ARB = '0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8' +const USDC_ARB = ADDRESSES.arbitrum.USDC const USDF_ARB = '0xae48b7C8e096896E32D53F10d0Bf89f82ec7b987' //Fractal Addresses All Chains diff --git a/projects/jetprotocol.js b/projects/jetprotocol.js index ba3af330603..5e778970e1a 100644 --- a/projects/jetprotocol.js +++ b/projects/jetprotocol.js @@ -1,5 +1,5 @@ -const ADDRESSES = require('./helper/coreAssets.json') -const { getTokenBalance } = require("./helper/solana"); +const ADDRESSES = require('helper/coreAssets.json') +const { getTokenBalance, sumTokens2 } = require("./helper/solana"); async function borrowed() { const [usdcAmount, ethAmount, solAmount, btcAmount] = await Promise.all([ @@ -29,30 +29,12 @@ async function borrowed() { } async function tvl() { - const [usdcAmount, ethAmount, solAmount, btcAmount] = await Promise.all([ - getTokenBalance( - ADDRESSES.solana.USDC, - "7gpj9cpzBBW9Ci1yMwWz7iGbQYpm5fZmadNQyrYsqch8" - ), - getTokenBalance( - "2FPyTwcZLUg1MDrwsyoP4D6s1tM7hAkHYRjkNb5w6Pxk", - "7gpj9cpzBBW9Ci1yMwWz7iGbQYpm5fZmadNQyrYsqch8" - ), - getTokenBalance( - ADDRESSES.solana.SOL, - "7gpj9cpzBBW9Ci1yMwWz7iGbQYpm5fZmadNQyrYsqch8" - ), - getTokenBalance( - "9n4nbM75f5Ui33ZbPYXn59EwSgE8CGsHtAeTH5YFeJ9E", - "7gpj9cpzBBW9Ci1yMwWz7iGbQYpm5fZmadNQyrYsqch8" - ), - ]); - return { - bitcoin: btcAmount, - "usd-coin": usdcAmount, - ethereum: ethAmount, - solana: solAmount, - }; + return sumTokens2({ owner: '7gpj9cpzBBW9Ci1yMwWz7iGbQYpm5fZmadNQyrYsqch8', tokens: [ + ADDRESSES.solana.USDC, + '2FPyTwcZLUg1MDrwsyoP4D6s1tM7hAkHYRjkNb5w6Pxk', + ADDRESSES.solana.SOL, + '9n4nbM75f5Ui33ZbPYXn59EwSgE8CGsHtAeTH5YFeJ9E', + ]}); } module.exports = { diff --git a/projects/revest/index.js b/projects/revest/index.js index 0cd88d51138..78e3638a45e 100644 --- a/projects/revest/index.js +++ b/projects/revest/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens2, } = require("../helper/unwrapLPs") const { covalentGetTokens, } = require("../helper/http") const { getUniqueAddresses } = require('../helper/utils') @@ -10,7 +11,7 @@ const getFNFTConfigABI = "function getFNFT(uint256 fnftId) external view returns const balanceOfABI = "function balanceOf(address account) view returns (uint256)" const getWalletABI = "function getFNFTAddress(uint256 fnftId) external view returns (address)" -const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000' +const ZERO_ADDRESS = ADDRESSES.null const config = { ethereum: { diff --git a/projects/satori/index.js b/projects/satori/index.js index e7879e23305..ac5666b2249 100644 --- a/projects/satori/index.js +++ b/projects/satori/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokensExport } = require("../helper/unwrapLPs"); const USDT_TOKEN_CONTRACT = "0x1E4a5963aBFD975d8c9021ce480b42188849D41d"; @@ -17,7 +18,7 @@ module.exports = { "0x0842b33529516abe86CA8EA771aC4c84FDd0eeE0", "0x48756b37Fd643bB40F669804730024F02900C476", ], - tokens: ["0x3355df6D4c9C3035724Fd0e3914dE96A5a83aaf4"], + tokens: [ADDRESSES.era.USDC], }), }, }; diff --git a/projects/treasury/kinza.js b/projects/treasury/kinza.js index ba55a6091e8..bf35c967c77 100644 --- a/projects/treasury/kinza.js +++ b/projects/treasury/kinza.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { nullAddress, treasuryExports } = require("../helper/treasury"); const treasury = "0x65FDCD48c4807F67429Bdc731d6964f5553CdB36"; @@ -6,7 +7,7 @@ module.exports = treasuryExports({ bsc: { tokens: [ nullAddress, - '0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c', + ADDRESSES.bsc.WBNB, ], owners: [treasury,], }, diff --git a/projects/treasury/savvy.js b/projects/treasury/savvy.js index be6fcceb937..4aa3e9e0adf 100644 --- a/projects/treasury/savvy.js +++ b/projects/treasury/savvy.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { nullAddress, treasuryExports } = require("../helper/treasury"); const treasury = "0x4f54cab19b61138e3c622a0bd671c687481ec030"; @@ -6,9 +7,9 @@ module.exports = treasuryExports({ arbitrum: { tokens: [ nullAddress, - '0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8', - '0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f', - '0x82aF49447D8a07e3bd95BD0d56f35241523fBab1', + ADDRESSES.arbitrum.USDC, + ADDRESSES.arbitrum.WBTC, + ADDRESSES.arbitrum.WETH, '0xaf88d065e77c8cC2239327C5EDb3A432268e5831' ], owners: [treasury,], From eac3d4484f45b6844978a56a25f33990f9c85c3a Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Sat, 1 Jul 2023 13:10:46 +0200 Subject: [PATCH 0167/1974] add jet-v2 --- projects/jet-protocol-v2-fixed-term/idl.json | 209 +++++++++++++++++++ projects/jet-protocol-v2-fixed-term/index.js | 19 ++ projects/jetprotocol-v2-margin/index.js | 20 ++ projects/jetprotocol.js | 2 + 4 files changed, 250 insertions(+) create mode 100644 projects/jet-protocol-v2-fixed-term/idl.json create mode 100644 projects/jet-protocol-v2-fixed-term/index.js create mode 100644 projects/jetprotocol-v2-margin/index.js diff --git a/projects/jet-protocol-v2-fixed-term/idl.json b/projects/jet-protocol-v2-fixed-term/idl.json new file mode 100644 index 00000000000..2ef08b5344c --- /dev/null +++ b/projects/jet-protocol-v2-fixed-term/idl.json @@ -0,0 +1,209 @@ +{ + "version": "0.1.0", + "name": "jet_fixed_term", + "constants": [ + { + "name": "MARKET", + "type": "bytes", + "value": "[109, 97, 114, 107, 101, 116]" + }, + { + "name": "TICKET_ACCOUNT", + "type": "bytes", + "value": "[116, 105, 99, 107, 101, 116, 95, 97, 99, 99, 111, 117, 110, 116]" + }, + { + "name": "TICKET_MINT", + "type": "bytes", + "value": "[116, 105, 99, 107, 101, 116, 95, 109, 105, 110, 116]" + }, + { + "name": "CRANK_AUTHORIZATION", + "type": "bytes", + "value": "[99, 114, 97, 110, 107, 95, 97, 117, 116, 104, 111, 114, 105, 122, 97, 116, 105, 111, 110]" + }, + { + "name": "CLAIM_NOTES", + "type": "bytes", + "value": "[99, 108, 97, 105, 109, 95, 110, 111, 116, 101, 115]" + }, + { + "name": "TICKET_COLLATERAL_NOTES", + "type": "bytes", + "value": "[116, 105, 99, 107, 101, 116, 95, 99, 111, 108, 108, 97, 116, 101, 114, 97, 108, 95, 110, 111, 116, 101, 115]" + }, + { + "name": "UNDERLYING_COLLATERAL_NOTES", + "type": "bytes", + "value": "[117, 110, 100, 101, 114, 108, 121, 105, 110, 103, 95, 99, 111, 108, 108, 97, 116, 101, 114, 97, 108, 95, 110, 111, 116, 101, 115]" + }, + { + "name": "EVENT_ADAPTER", + "type": "bytes", + "value": "[101, 118, 101, 110, 116, 95, 97, 100, 97, 112, 116, 101, 114]" + }, + { + "name": "TERM_LOAN", + "type": "bytes", + "value": "[116, 101, 114, 109, 95, 108, 111, 97, 110]" + }, + { + "name": "TERM_DEPOSIT", + "type": "bytes", + "value": "[116, 101, 114, 109, 95, 100, 101, 112, 111, 115, 105, 116]" + }, + { + "name": "USER", + "type": "bytes", + "value": "[117, 115, 101, 114]" + }, + { + "name": "ORDERBOOK_MARKET_STATE", + "type": "bytes", + "value": "[111, 114, 100, 101, 114, 98, 111, 111, 107, 95, 109, 97, 114, 107, 101, 116, 95, 115, 116, 97, 116, 101]" + }, + { + "name": "MARGIN_USER", + "type": "bytes", + "value": "[109, 97, 114, 103, 105, 110, 95, 117, 115, 101, 114]" + }, + { + "name": "UNDERLYING_TOKEN_VAULT", + "type": "bytes", + "value": "[117, 110, 100, 101, 114, 108, 121, 105, 110, 103, 95, 116, 111, 107, 101, 110, 95, 118, 97, 117, 108, 116]" + }, + { + "name": "FEE_VAULT", + "type": "bytes", + "value": "[102, 101, 101, 95, 118, 97, 117, 108, 116]" + } + ], + "instructions": [], + "accounts": [ + { + "name": "Market", + "type": { + "kind": "struct", + "fields": [ + { + "name": "versionTag", + "type": "u64" + }, + { + "name": "airspace", + "type": "publicKey" + }, + { + "name": "orderbookMarketState", + "type": "publicKey" + }, + { + "name": "eventQueue", + "type": "publicKey" + }, + { + "name": "asks", + "type": "publicKey" + }, + { + "name": "bids", + "type": "publicKey" + }, + { + "name": "underlyingTokenMint", + "type": "publicKey" + }, + { + "name": "underlyingTokenVault", + "type": "publicKey" + }, + { + "name": "ticketMint", + "type": "publicKey" + }, + { + "name": "claimsMint", + "type": "publicKey" + }, + { + "name": "ticketCollateralMint", + "type": "publicKey" + }, + { + "name": "underlyingCollateralMint", + "type": "publicKey" + }, + { + "name": "underlyingOracle", + "type": "publicKey" + }, + { + "name": "ticketOracle", + "type": "publicKey" + }, + { + "name": "feeVault", + "type": "publicKey" + }, + { + "name": "feeDestination", + "type": "publicKey" + }, + { + "name": "seed", + "type": { + "array": [ + "u8", + 32 + ] + } + }, + { + "name": "bump", + "type": { + "array": [ + "u8", + 1 + ] + } + }, + { + "name": "orderbookPaused", + "type": "bool" + }, + { + "name": "ticketsPaused", + "type": "bool" + }, + { + "name": "reserved", + "type": { + "array": [ + "u8", + 29 + ] + } + }, + { + "name": "borrowTenor", + "type": "u64" + }, + { + "name": "lendTenor", + "type": "u64" + }, + { + "name": "originationFee", + "type": "u64" + }, + { + "name": "nonce", + "type": "u64" + } + ] + } + } + ], + "types": [], + "errors": [] +} \ No newline at end of file diff --git a/projects/jet-protocol-v2-fixed-term/index.js b/projects/jet-protocol-v2-fixed-term/index.js new file mode 100644 index 00000000000..8ebc7367d52 --- /dev/null +++ b/projects/jet-protocol-v2-fixed-term/index.js @@ -0,0 +1,19 @@ +const { Program } = require("@project-serum/anchor"); +const { getProvider, sumTokens2, } = require("../helper/solana"); +const programId = 'JPTermEg2DwrV39xb1Fs7z1VUxcvdPT7mE7cyGsQ4xt'; +const idl = require('./idl.json') + +async function tvl() { + const provider = getProvider() + const program = new Program(idl, programId, provider) + const accounts = await program.account.market.all() + return sumTokens2({ tokenAccounts: accounts.map(i => i.account.underlyingTokenVault.toString()) }) +} + +module.exports = { + methodology: 'Add all the SOL in the pools, NFT value is not included in tvl', + timetravel: false, + solana: { + tvl, + }, +}; diff --git a/projects/jetprotocol-v2-margin/index.js b/projects/jetprotocol-v2-margin/index.js new file mode 100644 index 00000000000..fd21e9d9b89 --- /dev/null +++ b/projects/jetprotocol-v2-margin/index.js @@ -0,0 +1,20 @@ +const { Program } = require("@project-serum/anchor"); +const { getProvider, sumTokens2, } = require("../helper/solana"); +const programId = 'JPPooLEqRo3NCSx82EdE2VZY5vUaSsgskpZPBHNGVLZ'; + +async function tvl() { + const provider = getProvider() + const program = new Program(idl, programId, provider) + const accounts = await program.account.marginPool.all() + return sumTokens2({ tokenAccounts: accounts.map(i => i.account.vault.toString()), }) +} + +module.exports = { + methodology: 'Add all the SOL in the pools, NFT value is not included in tvl', + timetravel: false, + solana: { + tvl, + }, +}; + +const idl = {"version":"1.0.0","name":"jet_margin_pool","instructions":[],"accounts":[{"name":"MarginPool","type":{"kind":"struct","fields":[{"name":"version","type":"u8"},{"name":"poolBump","type":{"array":["u8",1]}},{"name":"vault","type":"publicKey"},{"name":"feeDestination","type":"publicKey"},{"name":"depositNoteMint","type":"publicKey"},{"name":"loanNoteMint","type":"publicKey"},{"name":"tokenMint","type":"publicKey"},{"name":"tokenPriceOracle","type":"publicKey"},{"name":"address","type":"publicKey"},{"name":"config","type":{"defined":"MarginPoolConfig"}},{"name":"borrowedTokens","type":{"array":["u8",24]}},{"name":"uncollectedFees","type":{"array":["u8",24]}},{"name":"depositTokens","type":"u64"},{"name":"depositNotes","type":"u64"},{"name":"loanNotes","type":"u64"},{"name":"accruedUntil","type":"i64"}]}}],"types":[{"name":"MarginPoolConfig","type":{"kind":"struct","fields":[{"name":"flags","type":"u64"},{"name":"utilizationRate1","type":"u16"},{"name":"utilizationRate2","type":"u16"},{"name":"borrowRate0","type":"u16"},{"name":"borrowRate1","type":"u16"},{"name":"borrowRate2","type":"u16"},{"name":"borrowRate3","type":"u16"},{"name":"managementFeeRate","type":"u16"},{"name":"reserved","type":"u64"}]}}],"events":[],"errors":[]} \ No newline at end of file diff --git a/projects/jetprotocol.js b/projects/jetprotocol.js index 5e778970e1a..a9cac698f46 100644 --- a/projects/jetprotocol.js +++ b/projects/jetprotocol.js @@ -37,6 +37,8 @@ async function tvl() { ]}); } +// JPv1rCqrhagNNmJVM5J1he7msQ5ybtvE1nNuHpDHMNU +// https://docs.jetprotocol.io/jet-protocol/protocol/smart-contracts module.exports = { timetravel: false, solana: { From 068ec65b143e763d22fe99fa19b64aaac3a1cc94 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Sat, 1 Jul 2023 13:42:15 +0200 Subject: [PATCH 0168/1974] fix deltaprime --- projects/deltaprime/mappings/assetToAddressMapping.json | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/deltaprime/mappings/assetToAddressMapping.json b/projects/deltaprime/mappings/assetToAddressMapping.json index b56e79bd9b6..85dd436c435 100644 --- a/projects/deltaprime/mappings/assetToAddressMapping.json +++ b/projects/deltaprime/mappings/assetToAddressMapping.json @@ -38,5 +38,6 @@ "crvUSDBTCETH": "0x1daB6560494B04473A0BE3E7D83CF3Fdf3a51828", "SHLB_AVAX-USDC_B": "0x668530302c6ecc4ebe693ec877b79300ac72527c", "SHLB_BTC.b-AVAX_B": "0x536d7e7423e8fb799549caf574cfa12aae95ffcd", + "GMX": "0x62edc0692bd897d2295872a9ffcac5425011c661", "SHLB_USDT.e-USDt_C": "0x9f44e67ba256c18411bb041375e572e3dd11fa72" } \ No newline at end of file From 004ccfad16dff67ef1bf09f80b4ff9aed15aab82 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Sat, 1 Jul 2023 15:10:56 +0200 Subject: [PATCH 0169/1974] fix broken adapters --- projects/kei-finance/index.js | 5 +++-- projects/phezzan/index.js | 10 +++++++--- projects/tangent/index.js | 1 + 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/projects/kei-finance/index.js b/projects/kei-finance/index.js index 48b623d95bc..6c29579d47a 100644 --- a/projects/kei-finance/index.js +++ b/projects/kei-finance/index.js @@ -25,13 +25,14 @@ const graphQuery = ` module.exports = { ethereum: { tvl: () => 0, - staking: async () => { + staking: () => 0, + /* staking: async () => { const { staking } = await request( config.ethereum.subgraph, graphQuery ) return { [TOKEN_ADDRESS]: BigNumber(staking.totalPrincipal).plus(BigNumber(staking.totalRewards)) }; - }, + }, */ } }; diff --git a/projects/phezzan/index.js b/projects/phezzan/index.js index 667ba038544..ae2fbc0a55a 100644 --- a/projects/phezzan/index.js +++ b/projects/phezzan/index.js @@ -32,10 +32,14 @@ module.exports = { timetravel: false, misrepresentedTokens: true, kava: { - tvl: sumTokensExport({ owners: [Contracts.kava.perpV1Result, Contracts.kava.fundingResult, ], tokens: [Contracts.kava.wkava, Contracts.kava.usdc, nullAddress] }), + tvl: async () => ({}), + // tvl: sumTokensExport({ owners: [Contracts.kava.perpV1Result, Contracts.kava.fundingResult, ], tokens: [Contracts.kava.wkava, Contracts.kava.usdc, nullAddress] }), }, zksync: { - offers, + // offers, tvl: async () => ({}) - } + }, + hallmarks: [ + [Math.floor(new Date('2023-04-23')/1e3), 'Protocol shutdown'], + ], }; diff --git a/projects/tangent/index.js b/projects/tangent/index.js index 8a79817c1f2..aa83668e737 100644 --- a/projects/tangent/index.js +++ b/projects/tangent/index.js @@ -1,6 +1,7 @@ const { default: axios } = require('axios'); async function fetch(){ + return 0 return (await axios.get('https://api.tangent.bar/api/v1/MainStatistics')).data.allTVL From 0c05dc851ac373e1a904deb2be18f82082c019f7 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Sat, 1 Jul 2023 18:36:39 +0200 Subject: [PATCH 0170/1974] bugfix --- projects/jetprotocol.js | 2 +- projects/tangent/index.js | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/projects/jetprotocol.js b/projects/jetprotocol.js index a9cac698f46..cc04fc43e14 100644 --- a/projects/jetprotocol.js +++ b/projects/jetprotocol.js @@ -1,4 +1,4 @@ -const ADDRESSES = require('helper/coreAssets.json') +const ADDRESSES = require('./helper/coreAssets.json') const { getTokenBalance, sumTokens2 } = require("./helper/solana"); async function borrowed() { diff --git a/projects/tangent/index.js b/projects/tangent/index.js index aa83668e737..caba1759064 100644 --- a/projects/tangent/index.js +++ b/projects/tangent/index.js @@ -1,14 +1,10 @@ const { default: axios } = require('axios'); -async function fetch(){ - - return 0 +async function fetch() { return (await axios.get('https://api.tangent.bar/api/v1/MainStatistics')).data.allTVL - - } module.exports = { methodology: "Data is retrieved from the api at https://api.tangent.bar/", timetravel: false, - fetch + fetch: () => 0 } From 08d3a0abb5ed48144afefc89377792399b868ddf Mon Sep 17 00:00:00 2001 From: happywomwom-wombat <129473631+happywomwom-wombat@users.noreply.github.com> Date: Sun, 2 Jul 2023 01:01:31 +0800 Subject: [PATCH 0171/1974] add pendle pool (#6683) --- projects/wombat-exchange/config.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/wombat-exchange/config.js b/projects/wombat-exchange/config.js index ec1411a7fac..697b6cdeb96 100644 --- a/projects/wombat-exchange/config.js +++ b/projects/wombat-exchange/config.js @@ -42,6 +42,7 @@ module.exports = { jUSDC: "0xc7a6bA5F28993BaDb566007bD2E0CB253c431974", ankrETH: "0xB9bdfE449Da096256Fe7954Ef61A18eE195Db77B", wstETH: "0xe14302040c0A1eb6fB5A4A79EfA46D60029358d9", + pendle: "0xe7159f15e7b1d6045506B228A1ed2136dcc56F48", fUSD: "0x956454C7BE9318863297309183C79b793D370401", }, }, From 30d531f8fc400bdcbc05d635a2968590bc09966b Mon Sep 17 00:00:00 2001 From: g1nt0ki Date: Sat, 1 Jul 2023 20:36:33 +0200 Subject: [PATCH 0172/1974] silo: blacklist XAI --- projects/silo/index.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/projects/silo/index.js b/projects/silo/index.js index 6aec66f1a3d..52e684fdffc 100644 --- a/projects/silo/index.js +++ b/projects/silo/index.js @@ -16,7 +16,8 @@ const config = { }, } -const fallbackBlacklist = ["0x6543ee07cf5dd7ad17aeecf22ba75860ef3bbaaa"]; +const XAI = '0xd7c9f0e536dc865ae858b0c0453fe76d13c3beac' +const fallbackBlacklist = ["0x6543ee07cf5dd7ad17aeecf22ba75860ef3bbaaa", ]; async function tvl(_, block, _1, { api }) { const siloArray = await getSilos(api) @@ -26,21 +27,22 @@ async function tvl(_, block, _1, { api }) { }) const toa = assets.map((v, i) => ([v, siloArray[i]])) - return sumTokens2({ api, ownerTokens: toa, }) + return sumTokens2({ api, ownerTokens: toa, blacklistedTokens: [XAI], }) } async function borrowed(_, block, _1, { api }) { - const balances = {} const siloArray = await getSilos(api) const assetStates = await api.multiCall({ abi: getAssetStateAbi, calls: siloArray.map(i => ({ target: i })), }); assetStates.forEach(({ assets, assetsStorage }) => { - assetsStorage.forEach((i, j) => sdk.util.sumSingleBalance(balances, assets[j], i.totalBorrowAmount, api.chain)) + assetsStorage + .forEach((i, j) => { + if (assets[j].toLowerCase() === XAI) return; + return api.add(assets[j], i.totalBorrowAmount) + }) }) - - return balances } let silos = {} From ca9c4be2d510c068a2d6c7c1c47a7b63d7e479cc Mon Sep 17 00:00:00 2001 From: g1nt0ki Date: Sat, 1 Jul 2023 20:55:42 +0200 Subject: [PATCH 0173/1974] silo: fix bug while refill due to cache --- projects/silo/index.js | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/projects/silo/index.js b/projects/silo/index.js index 52e684fdffc..d7089c1a700 100644 --- a/projects/silo/index.js +++ b/projects/silo/index.js @@ -17,7 +17,7 @@ const config = { } const XAI = '0xd7c9f0e536dc865ae858b0c0453fe76d13c3beac' -const fallbackBlacklist = ["0x6543ee07cf5dd7ad17aeecf22ba75860ef3bbaaa", ]; +const fallbackBlacklist = ["0x6543ee07cf5dd7ad17aeecf22ba75860ef3bbaaa",]; async function tvl(_, block, _1, { api }) { const siloArray = await getSilos(api) @@ -45,26 +45,19 @@ async function borrowed(_, block, _1, { api }) { }) } -let silos = {} - async function getSilos(api) { const chain = api.chain const { SILO_FACTORY, START_BLOCK, } = config[chain] - if (!silos[chain]) silos[chain] = _getSilos() - return silos[chain] - - async function _getSilos() { - const logs = ( - await getLogs({ - api, - target: SILO_FACTORY, - fromBlock: START_BLOCK, - topic: 'NewSiloCreated(address,address,uint128)', - }) - ) + const logs = ( + await getLogs({ + api, + target: SILO_FACTORY, + fromBlock: START_BLOCK, + topic: 'NewSiloCreated(address,address,uint128)', + }) + ) - return logs.map((log) => `0x${log.topics[1].substring(26)}`).filter((address) => fallbackBlacklist.indexOf(address.toLowerCase()) === -1); - } + return logs.map((log) => `0x${log.topics[1].substring(26)}`).filter((address) => fallbackBlacklist.indexOf(address.toLowerCase()) === -1); } From 3c7a6f3b670a4313326fe5aff30be1a24f0d8e37 Mon Sep 17 00:00:00 2001 From: EG <37511853+Lefgk@users.noreply.github.com> Date: Sun, 2 Jul 2023 09:07:24 +0100 Subject: [PATCH 0174/1974] soarpls (#6691) * soarpls * minor fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/soarpulse/index.js | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 projects/soarpulse/index.js diff --git a/projects/soarpulse/index.js b/projects/soarpulse/index.js new file mode 100644 index 00000000000..074ad878486 --- /dev/null +++ b/projects/soarpulse/index.js @@ -0,0 +1,9 @@ +const { sumTokensExport, nullAddress } = require("../helper/unwrapLPs"); + +const contract = "0xb29201EBB420b28Bb43052Ad58C23F43d6899F51"; + +module.exports = { + pulse: { + tvl: sumTokensExport({ owner: contract, tokens: [nullAddress]}), + }, +}; \ No newline at end of file From 3e5af782a814d5116986212732f14138c878bd24 Mon Sep 17 00:00:00 2001 From: 0xdapper <94534135+0xdapper@users.noreply.github.com> Date: Sun, 2 Jul 2023 22:40:30 +0530 Subject: [PATCH 0175/1974] umami: add glp v2 vaults (#6692) --- projects/umamifinance/index.js | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/projects/umamifinance/index.js b/projects/umamifinance/index.js index 4931358fc58..c5c87f57c8d 100644 --- a/projects/umamifinance/index.js +++ b/projects/umamifinance/index.js @@ -14,13 +14,21 @@ const glpUSDC = "0x2e2153fd13459eba1f277ab9acd624f045d676ce"; const glpInitBlock = 18703806; const USDC = ADDRESSES.arbitrum.USDC; +const v2Vaults = [ + "0x727eD4eF04bB2a96Ec77e44C1a91dbB01B605e42", + "0xbb84D79159D6bBE1DE148Dc82640CaA677e06126", + "0x6a89FaF99587a12E6bB0351F2fA9006c6Cd12257", + "0xe0A21a475f8DA0ee7FA5af8C1809D8AC5257607d", + "0x37c0705A65948EA5e0Ae1aDd13552BCaD7711A23", +]; + module.exports = { doublecounted: true, timetravel: true, start: 1657027865, // UMAMI deployment block ts arbitrum: { staking: stakings([mUMAMI, OHM_STAKING_sUMAMI], UMAMI, "arbitrum"), - tvl: async (_, _b, { arbitrum: block }) => { + tvl: async (_, _b, { arbitrum: block }, { api }) => { const balances = {}; if (!block || block > glpInitBlock + 10) { @@ -37,6 +45,16 @@ module.exports = { ); } + const assets = await api.multiCall({ abi: 'address:asset', calls: v2Vaults }); + const bals = await api.multiCall({ abi: 'uint256:totalAssets', calls: v2Vaults }); + for (let i = 0; i < assets.length; i++) { + sdk.util.sumSingleBalance( + balances, + `arbitrum:${assets[i]}`, + bals[i] + ); + } + return balances; }, }, From 1aa7f31797700dd8947bf8c6defd5b1c5ca82ac0 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Sun, 2 Jul 2023 19:57:58 +0200 Subject: [PATCH 0176/1974] fix sashimiswap --- projects/sashimiswap/index.js | 194 +++++++++++++++++++++++----------- 1 file changed, 135 insertions(+), 59 deletions(-) diff --git a/projects/sashimiswap/index.js b/projects/sashimiswap/index.js index 6bc74bbcd7c..1285ce96686 100644 --- a/projects/sashimiswap/index.js +++ b/projects/sashimiswap/index.js @@ -1,68 +1,144 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const sdk = require("@defillama/sdk"); -const {uniTvlExport} = require("../helper/calculateUniTvl"); -const { compoundExports } = require("../helper/compound"); +const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') +const { getLogs } = require('../helper/cache/getLogs') const { staking } = require("../helper/staking"); -const factoryETH = "0xF028F723ED1D0fE01cC59973C49298AA95c57472"; -const comprollerETH = "0xB5d53eC97Bed54fe4c2b77f275025c3fc132D770"; -const sIETH = "0xC597F86424EEb6599Ea40f999DBB739e3Aca5d82"; -const WETHEquivalent = ADDRESSES.ethereum.WETH; - -const factoryBSC = "0x1DaeD74ed1dD7C9Dabbe51361ac90A69d851234D"; -const comprollerBSC = "0x88fEf82FDf75E32e4BC0e662d67CfcEF4838F026"; -const sIBNB = "0x6Df484F552115fa7F54bE4A6D7aE2999cadB2324"; -const WBNBEquivalent = ADDRESSES.bsc.WBNB; - -const factoryHECO = "0xC28E27870558cF22ADD83540d2126da2e4b464c2"; -const comprollerHECO = "0x6Cb9d7ecf84b0d3E7704ed91046e16f9D45C00FA"; -const sIHT = "0xf13d3E10DEE31b80887422c89285112Dd00ce0B5"; -const WHTEquivalent = ADDRESSES.heco.WHT; - -const {tvl: ethMarketsTvl, borrowed: borrowedEth} = compoundExports( - comprollerETH, - "ethereum", - sIETH, - WETHEquivalent -) - -const {tvl: bscMarketsTvl, borrowed: borrowedBsc} = compoundExports( - comprollerBSC, - "bsc", - sIBNB, - WBNBEquivalent -) - -const {tvl: hecoMarketsTvl, borrowed: borrowedHeco} = compoundExports( - comprollerHECO, - "heco", - sIHT, - WHTEquivalent -) - -const ethTvl = uniTvlExport(factoryETH, "ethereum"); - -const bscTvl = uniTvlExport(factoryBSC, "bsc"); - -const hecoTvl = uniTvlExport(factoryHECO, "heco"); - module.exports = { - timetravel: true, - doublecounted: false, + methodology: + "We count liquidity on the Farms (LP tokens) threw Factory Contract; and on the lending markets same as compound", +}; + +const config = { ethereum: { - // tvl: sdk.util.sumChainTvls([ethTvl,ethMarketsTvl]), - tvl: sdk.util.sumChainTvls([ethMarketsTvl]), - staking: staking("0x6ed306DbA10E6c6B20BBa693892Fac21f3B91977", "0xC28E27870558cF22ADD83540d2126da2e4b464c2"), - borrowed: borrowedEth, + dexFactory: '0xF028F723ED1D0fE01cC59973C49298AA95c57472', + dexFromBlock: 10943133, + comptroller: '0xB5d53eC97Bed54fe4c2b77f275025c3fc132D770', + // cToken: '0xC597F86424EEb6599Ea40f999DBB739e3Aca5d82', + stakingContracts: ['0x6ed306DbA10E6c6B20BBa693892Fac21f3B91977'], + stakingToken: '0xC28E27870558cF22ADD83540d2126da2e4b464c2', }, bsc: { - tvl: sdk.util.sumChainTvls([bscMarketsTvl]), - borrowed: borrowedBsc, + dexFactory: '0x1DaeD74ed1dD7C9Dabbe51361ac90A69d851234D', + dexFromBlock: 5208518, + comptroller: '0x88fEf82FDf75E32e4BC0e662d67CfcEF4838F026', + // cToken: '0xC597F86424EEb6599Ea40f999DBB739e3Aca5d82', }, heco: { - tvl: sdk.util.sumChainTvls([hecoMarketsTvl]), - borrowed: borrowedHeco, + dexFactory: '0xC28E27870558cF22ADD83540d2126da2e4b464c2', + dexFromBlock: 783990, + comptroller: '0x6Cb9d7ecf84b0d3E7704ed91046e16f9D45C00FA', + // cToken: '0xC597F86424EEb6599Ea40f999DBB739e3Aca5d82', }, - methodology: - "We count liquidity on the Farms (LP tokens) threw Factory Contract; and on the lending markets same as compound", -}; +} + +Object.keys(config).forEach(chain => { + const { stakingContracts, stakingToken, dexFactory, comptroller, dexFromBlock, } = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const ownerTokens = [] + if (comptroller) { + const markets = await api.call({ abi: 'address[]:getAllMarkets', target: comptroller, }) + let uTokens = await api.multiCall({ abi: 'address:underlying', calls: markets, permitFailure: true }) + uTokens = uTokens.map(i => i ?? nullAddress) + ownerTokens.push(...markets.map((m, i) => [[uTokens[i]], m])) + } + if (dexFactory) { + const logs = await getLogs({ + api, + target: dexFactory, + topics: ['0x0d3648bd0f6ba80134a33ba9275ac585d9d315f0ad8355cddefde31afa28d0e9'], + eventAbi: 'event PairCreated (address indexed token0, address indexed token1, address pair, uint256)', + onlyArgs: true, + fromBlock: dexFromBlock, + }) + const routers = await api.multiCall({ abi: 'address:router', calls: logs.map(i => i.pair) }) + routers.forEach((r, i) => ownerTokens.push([[logs[i].token0, logs[i].token1], r])) + } + return sumTokens2({ api, ownerTokens, blacklistedTokens, }) + }, + borrowed: async (_, _b, _cb, { api, }) => { + if (comptroller) { + const markets = await api.call({ abi: 'address[]:getAllMarkets', target: comptroller, }) + let uTokens = await api.multiCall({ abi: 'address:underlying', calls: markets, permitFailure: true }) + uTokens = uTokens.map(i => i ?? nullAddress) + let borrows = await api.multiCall({ abi: 'uint256:totalBorrows', calls: markets }) + api.addTokens(uTokens, borrows) + } + api.getBalances() + }, + } + + if (stakingContracts) { + module.exports[chain].staking = staking(stakingContracts, stakingToken) + } +}) + +const blacklistedTokens = [ + // ethereum + '0x24efe6b87bf1bfe9ea2ccb5a9d0a959c7172b364', + '0x786448439d9401e0a8427acf7ca66a5114eb2368', + '0x32503febaa15d0bcfda2a9d8fe492d14a750e52c', + '0x7756661eea92e4423ae4680f552aa0be0da040f1', + '0x03012a6f9bb5bff61997aee59477a893debd203b', + '0x0c7858badb509262e736748e6041b8d7b0b94dbf', + '0xb904d3f16bf305e99fd785dda1bb13df354c381b', + '0x674dcbde5c622abb3122d6934fcce446b95060dc', + '0x90b4fc25a6bd9a666aa4507148f07198a4abc849', + '0x0aa387225497ccca54fe9de989d3274c1377efe7', + '0x823b35caa9d0c66a5f9ffb6d042fa130f34cb760', + '0x9e844c8a08b6e56c7c89c7428d63599b64f62ea9', + '0x7a77073c1191f2d2fd31a71c758d44f3de0af831', + '0xbacbd121f37557e5ea1d0c4bb67756867866c3fe', + '0xf1b43f4e14650ac8c4bb009d9b56eb77c1ae87cd', + '0x5b8c75d6f91663c515bb12e3cf7c29ade0e1a302', + '0x7578fd876752a5e4999a16fb80cfe30c1056de11', + '0x1ad47ee8074ee1adabd76e97b23b94713de9d175', + '0x9a3eed88730378393e903387087964184b462c71', + '0xdd530cbe1409df4e7e2dfd18931292c81d8c5e17', + '0x6e4e0a7f4dc3068970ecb81fd28cd19d4119125b', + '0x0c662c1e8635aead580714ffa19ab5f008ab7aeb', + '0x30404353bdceebe86e0b6391fe66db1082bc6cb7', + '0xa503ddef9c88b5b566705298f8c8faace130b80b', + '0x002141edcfb5814ad2772e3aecb73a3312f0b60c', + '0xa6ce576e27ee546cb64e280bb2aa18ad438c28cc', + '0xa35ff70c648acd83cf0742b919bce4d1b424dca4', + '0x079308fcea7973da3ae2b45904948a5b51f3cba3', + '0x4ff5b5108f4db6f925cd76a68bb80565fd8053e6', + '0x0df2d534cc6849558a9d237c98be560b5ff502f8', + + // bsc + '0xc28e27870558cf22add83540d2126da2e4b464c2', + '0x4b64a2d17231882e62d7d5d84daa92e6a39e93b4', + '0xd9f2894257a57333e84682f463c01e539af15f3a', + '0x627c99cfc6421224a99b88cec08ba9894253779c', + '0xabc2984de273dd6fc4cfe602d5a9736ab94402be', + '0xd7bfb8faa3c395d475ac97f337f528565b2ea2c6', + '0x216ca859fbc236a32d6464ce17b18591dd72c3d3', + '0x5fbce2d40ea2c5233c2ba399e27a2a21b0d6964c', + '0xa9cb2cb1f0080b2d479e4be62a27969d80b6577c', + '0x2f11f3a4656732c2f9e77c8642ed8a7d42aa2a02', + '0x6047ac230eef705d294ece482f1652235dac6405', + '0xd771dcc836d69f45e8ed604be03a26bdf4be2623', + '0x01876dccb99cd6172f343a874021427afe550472', + '0x176c673a31904dbfff4255f2501567b4ddc73f65', + '0x7213c252e7857b529582dddc770ddb275759d1ec', + + // heco + '0xc2037c1c13dd589e0c14c699dd2498227d2172cc', + '0x03271182cf2b47929978d0e4ca4af0846f66e2de', + '0x891daabf6de7a648c9665928e1097b808c1721e2', + '0xe9c95876f144bbdf5dc33d1a35c26cab0611903f', + '0x389eec1b8795853770874b76b912ec18de796e1b', + '0xeaac96f59e40d38bd970b37879a79a1d28737d8a', + '0x6c606fb47d99d1e66f9b599f8c5602cd4eb44d5a', + '0xae399aea42867fec2cd4a04963a7f0e247a39431', + '0x818bbc9b9d37685f9f4db032d46b52a70d890632', + '0x6ccbc3a5ae94e8a75f9571438a78f3e3aa956655', + '0xc2d36a8c0b1235ddecac2ed519139e9177e67736', + '0x611e93a7718a215bfda3c63f7175d764793272df', + '0x377dca38ff279a73a9075f25d36d00b98515a9a1', + '0x937a48287fdc4b503d608cb988ac35eee75f076f', + '0x3f3aaaa941ad756fc49a4b3241a87a7c04e39a4e', + '0x06068d90e0cbf9b7ccfd21efddb9bceb4c47fd31', + '0xe2a246c36fa86eee290acef79a8dc66b6b7f25ba', + '0x8fc67b8ed339c740a58ebd7aae24ba9d57d8dd25', +] From 44e0519407225072619015e3544e32a860ae871e Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Sun, 2 Jul 2023 22:01:07 +0200 Subject: [PATCH 0177/1974] add hallmark --- projects/sashimiswap/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/sashimiswap/index.js b/projects/sashimiswap/index.js index 1285ce96686..32409899dd7 100644 --- a/projects/sashimiswap/index.js +++ b/projects/sashimiswap/index.js @@ -5,6 +5,9 @@ const { staking } = require("../helper/staking"); module.exports = { methodology: "We count liquidity on the Farms (LP tokens) threw Factory Contract; and on the lending markets same as compound", + hallmarks: [ + [Math.floor(new Date('2021-12-30')/1e3), 'Protocol was hacked for 210K USD'], + ], }; const config = { From a47703496a261d7d637cf6f752a1e62cfe80187e Mon Sep 17 00:00:00 2001 From: define Date: Mon, 3 Jul 2023 09:21:26 +0100 Subject: [PATCH 0178/1974] treasury cryptodickbutts --- projects/treasury/cryptodickbutts.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 projects/treasury/cryptodickbutts.js diff --git a/projects/treasury/cryptodickbutts.js b/projects/treasury/cryptodickbutts.js new file mode 100644 index 00000000000..f45297dcccd --- /dev/null +++ b/projects/treasury/cryptodickbutts.js @@ -0,0 +1,23 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress,treasuryExports } = require("../helper/treasury"); + +const treasury = "0xf14d484b29a8ac040feb489afadb4b972422b4e9"; +const dick = "0x22BDc8Ad19aE84d9327E81FAD4F5973b91fbaA60" + + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.USDT,//TETHER + ADDRESSES.ethereum.USDC,//USDC + "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + "0x6d3D490964205c8bC8DeD39e48e88E8Fde45b41f", + "0x0000000000A39bb272e79075ade125fd351887Ac", + "0x6B175474E89094C44Da98b954EedeAC495271d0F" + ], + owners: [treasury], + ownTokens: [dick], + + }, +}) \ No newline at end of file From 09086ff43b0c0e9cb5155789440cb6a3c6159358 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 3 Jul 2023 11:50:08 +0200 Subject: [PATCH 0179/1974] track biswap v3 --- projects/biswap-v3/index.js | 24 ++++++++++++++++++++++++ projects/helper/sumTokens.js | 6 +++++- 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 projects/biswap-v3/index.js diff --git a/projects/biswap-v3/index.js b/projects/biswap-v3/index.js new file mode 100644 index 00000000000..bed655ce7b6 --- /dev/null +++ b/projects/biswap-v3/index.js @@ -0,0 +1,24 @@ +const { sumTokens2 } = require('../helper/unwrapLPs') +const { getLogs } = require('../helper/cache/getLogs') + +const config = { + bsc: { factory: '0x7c3d53606f9c03e7f54abddffc3868e1c5466863', fromBlock: 29462097 }, +} + +Object.keys(config).forEach(chain => { + const { factory, fromBlock } = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const logs = await getLogs({ + api, + target: factory, + topics: ['0xe857b53ada03b8d88fd7546e77c34d3b68996e6ce330f0edee6e813b7daea099'], + eventAbi: 'event NewPool (address indexed tokenX, address indexed tokenY, uint16 indexed fee, uint24 pointDelta, address pool)', + onlyArgs: true, + fromBlock, + }) + const ownerTokens = logs.map(log => [[log.tokenX, log.tokenY], log.pool]) + return sumTokens2({ api, ownerTokens }) + } + } +}) \ No newline at end of file diff --git a/projects/helper/sumTokens.js b/projects/helper/sumTokens.js index fdfbaab68cf..d8924b58c34 100644 --- a/projects/helper/sumTokens.js +++ b/projects/helper/sumTokens.js @@ -44,7 +44,11 @@ function sumTokensExport(options) { } async function sumTokens(options) { - let { chain, owner, owners = [], tokens = [], tokensAndOwners = [], blacklistedTokens = [], balances = {}, token, } = options + let { chain, owner, owners = [], tokens = [], tokensAndOwners = [], blacklistedTokens = [], balances = {}, token, api } = options + if (api) { + chain = api.chain + block = api.block + } if (token) tokens = [token] if (owner) owners = [owner] From 8f6dbf30939e4e54083fa73c945e0201921cf10c Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 3 Jul 2023 13:28:59 +0200 Subject: [PATCH 0180/1974] bugfix --- projects/helper/sumTokens.js | 1 - 1 file changed, 1 deletion(-) diff --git a/projects/helper/sumTokens.js b/projects/helper/sumTokens.js index d8924b58c34..e9f25224182 100644 --- a/projects/helper/sumTokens.js +++ b/projects/helper/sumTokens.js @@ -47,7 +47,6 @@ async function sumTokens(options) { let { chain, owner, owners = [], tokens = [], tokensAndOwners = [], blacklistedTokens = [], balances = {}, token, api } = options if (api) { chain = api.chain - block = api.block } if (token) tokens = [token] From a41d628a1c4ac19f8baacc32d58ddac6945f2f7d Mon Sep 17 00:00:00 2001 From: DeFi-dev <137463793+WemadeDeFiDev@users.noreply.github.com> Date: Mon, 3 Jul 2023 20:44:20 +0900 Subject: [PATCH 0181/1974] add Konverter porotocol (#6684) * add konverter tvl * add konverter tvl * fix tvl methodology * konverter * Revert "konverter" This reverts commit d140f66649302cfe85fdfd00b357643af005120a. * code refactor --------- Co-authored-by: DannyBae Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/konverter/contracts.json | 31 +++++++++++++++++++++++++++++++ projects/konverter/index.js | 16 ++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 projects/konverter/contracts.json create mode 100644 projects/konverter/index.js diff --git a/projects/konverter/contracts.json b/projects/konverter/contracts.json new file mode 100644 index 00000000000..383135ab3c7 --- /dev/null +++ b/projects/konverter/contracts.json @@ -0,0 +1,31 @@ +{ + "wemix": { + "priceCalculator": "0xdc9cd9f7a3b962857854120dC3a8c75ed8A48b9e", + "stableSwapHelper": "0x164056263dBB527D06B008F263780fC8f1Bd22F5", + "pools": { + "0xa60448B0621335905a65753173D7e6FDFe494Da2": { + "name": "k3Pool", + "isMetaPool": false, + "n_coins": 3, + "poolToken": "0x7D57CeF121AC2371472214d100FF01eC6ddD5fAa", + "underlyingTokens": [ + "0xE3F5a90F9cb311505cd691a46596599aA1A0AD7D", + "0xA649325Aa7C5093d12D6F98EB4378deAe68CE23F", + "0x8E81fCc2d4A3bAa0eE9044E0D7E36F59C9BbA9c1" + ] + }, + "0xDacaD9ddF713496012748D35496c0FB09c8d8c15": { + "name": "wcd-k3Pool", + "isMetaPool": true, + "n_coins": 2, + "poolToken": "0xf7FA632AbeEDAD21E59089c5174C47735903506F", + "underlyingTokens": [ + "0x2ec6Fc5c495aF0C439E17268d595286d5f897dD0", + "0xE3F5a90F9cb311505cd691a46596599aA1A0AD7D", + "0xA649325Aa7C5093d12D6F98EB4378deAe68CE23F", + "0x8E81fCc2d4A3bAa0eE9044E0D7E36F59C9BbA9c1" + ] + } + } + } +} \ No newline at end of file diff --git a/projects/konverter/index.js b/projects/konverter/index.js new file mode 100644 index 00000000000..9641ea22a5b --- /dev/null +++ b/projects/konverter/index.js @@ -0,0 +1,16 @@ +const { sumTokens2 } = require('../helper/unwrapLPs') +const contracts = require("./contracts.json"); + +async function tvl(_, _b, _cb, { api, }) { + const ownerTokens = Object.entries(contracts[api.chain].pools).map(([pool, { underlyingTokens }]) => [underlyingTokens, pool]) + const blacklistedTokens = ownerTokens.map(i => i[1]) + return sumTokens2({ api, ownerTokens, blacklistedTokens }) +} + +module.exports = { + methodology: + "Sum of each liquidity pool's value", + wemix: { + tvl + } +}; From df83a26d9bd41c4030ff9deeecbd16af2f65f747 Mon Sep 17 00:00:00 2001 From: DeFi-dev <137463793+WemadeDeFiDev@users.noreply.github.com> Date: Mon, 3 Jul 2023 20:46:27 +0900 Subject: [PATCH 0182/1974] add kurrency-wemix tvl (#6685) * add kurrency-wemix tvl * code refactor --------- Co-authored-by: DannyBae Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/kurrency/index.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 projects/kurrency/index.js diff --git a/projects/kurrency/index.js b/projects/kurrency/index.js new file mode 100644 index 00000000000..90a91a83c18 --- /dev/null +++ b/projects/kurrency/index.js @@ -0,0 +1,23 @@ +async function tvl(_, _b, _cb, { api, }) { + const cdpManager = '0x1B18d5a2f35B431aACa02B58eE9E4B7FBa9b098d' + const PSM = '0xbdd0b6212505bcD15C38839cf338E40aeCd95b13' + const ids = await api.call({ abi: abi.getCollateralIds, target: cdpManager }) + const psmTokens = await api.call({ abi: abi.getPSMTokens, target: PSM }) + const psmInfos = await api.multiCall({ abi: abi.getPSMTokenInfo, calls: psmTokens, target: PSM }) + const infos = await api.multiCall({ abi: abi.getCollateralInfo, calls: ids, target: cdpManager }) + infos.forEach(info => api.add(info.token, info.balance)) + psmInfos.forEach((info, i) => api.add(psmTokens[i], info.balance)) +} + +module.exports = { + wemix: { + tvl + } +}; + +const abi = { + "getCollateralIds": "uint256[]:getCollateralIds", + "getPSMTokenInfo": "function getPSMTokenInfo(address token) view returns (tuple(uint256 mintLimit, uint256 minReserve, uint256 balance, uint256 mintAmount, uint256 collateralId, address investor) tokenInfo)", + "getPSMTokens": "address[]:getPSMTokens", + "getCollateralInfo": "function getCollateralInfo(uint256 collateralId) view returns (tuple(address token, address investor, uint256 balance, uint256 maxLTV, uint256 liquidationLTV, uint256 debtCeiling, uint256 interestRate, uint256 liquidationBonusRate, uint256 lastUpdateTime, uint256 lastVaultId, tuple(uint256 originalDebt, uint256 debt, uint256 debtShare) debtInfo) collateralInfo)", +} \ No newline at end of file From 33e29894ec1968776956073582b826dd5d96a151 Mon Sep 17 00:00:00 2001 From: Gabriele Di Remigio <63728957+GabrieleDiRemigio@users.noreply.github.com> Date: Mon, 3 Jul 2023 13:51:53 +0200 Subject: [PATCH 0183/1974] Add xALGO adapter (#6696) --- projects/folks-xalgo/index.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 projects/folks-xalgo/index.js diff --git a/projects/folks-xalgo/index.js b/projects/folks-xalgo/index.js new file mode 100644 index 00000000000..b7822c40423 --- /dev/null +++ b/projects/folks-xalgo/index.js @@ -0,0 +1,14 @@ +const { getAssetInfo } = require("../helper/chain/algorand"); + +const xAlgoAssetId = 1134696561; + +module.exports = { + timetravel: false, + algorand: { + tvl: async () => { + const info = await getAssetInfo(xAlgoAssetId); + const total = info.circulatingSupply / 10 ** info.decimals; + return { algorand: total }; + }, + }, +}; From 1ebca66fd17733f8bc6108c6b1620d9aea61202b Mon Sep 17 00:00:00 2001 From: xlsd <136213400+extlsd@users.noreply.github.com> Date: Mon, 3 Jul 2023 19:53:51 +0800 Subject: [PATCH 0184/1974] Update index.js (#6695) update LSD_TOKENS and STAKING_POOL_ADDRESS --- projects/xlsd/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/xlsd/index.js b/projects/xlsd/index.js index 6c194d3d50e..6b2d0f04b4d 100644 --- a/projects/xlsd/index.js +++ b/projects/xlsd/index.js @@ -1,7 +1,7 @@ const { sumTokensExport } = require("../helper/unwrapLPs"); -const LSD_TOKENS = ['0x22aB6bC52CAD84AAe84bD5781258677a6E0cFaB0', '0xce3a75572bc375476438206f6F29f46F8466EcC2', '0xC56dC613C8EF3C57314171d73EAEFE87Aa469186']; -const STAKING_POOL_ADDRESS = ['0x675B74A939fF8b16bA90Af9Cc9e6981a7975401E', '0x7931bfCeeD6FC04D35de75608F2977F3d3a69bc5', '0x77b16981d200dFe89Dd3AD5dc3238967646DDB28']; +const LSD_TOKENS = ['0xf40F19CAFaAA25bF9B52134646c6E325E76E0e93']; +const STAKING_POOL_ADDRESS = ['0x61CeC27ba136347ddA0AEDBe29a9b8219C32fF04']; module.exports = { methodology: "TVL of Staked ETH & LSD tokens in the StakingPool contracts", From a174f84cb7753f189f3f03c25a903ebab134566c Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 3 Jul 2023 15:09:22 +0200 Subject: [PATCH 0185/1974] fix broken adapters --- projects/bubbleswap-v2/index.js | 5 ++++- projects/illuminate-fi/index.js | 9 ++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/projects/bubbleswap-v2/index.js b/projects/bubbleswap-v2/index.js index 832c9ff9cb2..9c46e6795ff 100644 --- a/projects/bubbleswap-v2/index.js +++ b/projects/bubbleswap-v2/index.js @@ -13,10 +13,13 @@ async function fetch(){ } module.exports = { - fetch, + hedera: { + tvl: () => ({}), + }, timetravel: false, methodology: "Data is retrieved from the api at https://api.bubbleswap.io/", hallmarks: [ [1683288000, "V2 Launch"], + [Math.floor(new Date('2023-07-01')/1e3), 'Project shutdown'], ] } \ No newline at end of file diff --git a/projects/illuminate-fi/index.js b/projects/illuminate-fi/index.js index f94d90cd6e3..b541fe96994 100644 --- a/projects/illuminate-fi/index.js +++ b/projects/illuminate-fi/index.js @@ -24,7 +24,14 @@ async function tvl(_, _b, _cb, { api, }) { const principalTokens = await api.multiCall({ abi: 'address:fyToken', calls: pools }) const principalTokenDecimals = await api.multiCall({ abi: 'uint256:decimals', calls: pools }) const oneCalls = principalTokenDecimals.map((v, i) => ({ params: 10 ** v, target: pools[i] })) - const principalTokenPrices = await api.multiCall({ abi: 'function sellFYTokenPreview(uint128) view returns (uint128)', calls: oneCalls }) + let principalTokenPrices = await api.multiCall({ abi: 'function sellFYTokenPreview(uint128) view returns (uint128)', calls: oneCalls, permitFailure: true }) + let i = 0 + for (const pt of principalTokenPrices) { + if (!pt) { + principalTokenPrices[i] = await api.call({ abi: 'function unwrapPreview(uint256) view returns (uint256)', ...oneCalls[i] }) + } + i++ + } const principalTokenSupplies = await api.multiCall({ abi: 'erc20:totalSupply', calls: principalTokens }) principalTokenSupplies.forEach((supply, i) => api.add(baseTokens[i], supply * +principalTokenPrices[i] / 10 ** principalTokenDecimals[i])) From 52c44c1c47a2c2fc262bc9290f8e576c1dbabd12 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 3 Jul 2023 15:18:11 +0200 Subject: [PATCH 0186/1974] kleva: merge lend +farming tvl --- projects/kleva/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/kleva/index.js b/projects/kleva/index.js index 4fd5256c7e1..af03f8240a9 100644 --- a/projects/kleva/index.js +++ b/projects/kleva/index.js @@ -5,6 +5,7 @@ const { userInfos } = require('./FairLaunch') const { getChainTransform, getFixBalances } = require('../helper/portedTokens') const { getTokenPrices } = require('../helper/unknownTokens') +const kExports = require('../kleva-lend') const chain = 'klaytn' // const TOKEN_PRICE_QUERY_URL = "https://api.kltalchemy.com/klay/ksInfo" @@ -59,6 +60,6 @@ async function fetchLiquidity() { } module.exports = { - klaytn: { tvl: fetchLiquidity }, + klaytn: { tvl: sdk.util.sumChainTvls([fetchLiquidity, kExports.klaytn.tvl]) }, doublecounted: true, } \ No newline at end of file From 7b6cabf87850858161e6d59b3df0748696b1295f Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 3 Jul 2023 15:20:26 +0200 Subject: [PATCH 0187/1974] alpaca-fi: merge farm + lend exports --- projects/alpaca-finance/index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/projects/alpaca-finance/index.js b/projects/alpaca-finance/index.js index 034347ce7f6..81ee4eeb265 100644 --- a/projects/alpaca-finance/index.js +++ b/projects/alpaca-finance/index.js @@ -1,6 +1,8 @@ +const sdk = require('@defillama/sdk') const { calLyfTvl } = require("./lyf"); const { calAusdTvl } = require('./ausd'); const { calxALPACAtvl } = require('./xalpaca'); +const aExports = require('../alpaca-finance-lend'); async function bscTvl(timestamp, ethBlock, chainBlocks) { const lyfTvl = await calLyfTvl('bsc', chainBlocks.bsc); @@ -25,11 +27,11 @@ async function ftmStaking(timestamp, ethBlock, chainBlocks) { module.exports = { start: 1602054167, bsc: { - tvl: bscTvl, + tvl: sdk.util.sumChainTvls([bscTvl, aExports.bsc.tvl]), staking: bscStaking, }, fantom: { - tvl: fantomTvl, + tvl: sdk.util.sumChainTvls([fantomTvl, aExports.fantom.tvl]), staking: ftmStaking, } }; From 3b76b9c14145bb9956db6d961347b12d677bff74 Mon Sep 17 00:00:00 2001 From: Define101 <93603962+Define101@users.noreply.github.com> Date: Mon, 3 Jul 2023 16:36:41 +0100 Subject: [PATCH 0188/1974] add 1 more wallet lido (wip) (#6700) * add 1 more wallet lido * minor fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/treasury/lido.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/projects/treasury/lido.js b/projects/treasury/lido.js index 1e57744ca2c..6fa5c3d7d08 100644 --- a/projects/treasury/lido.js +++ b/projects/treasury/lido.js @@ -3,7 +3,10 @@ const { nullAddress, treasuryExports } = require("../helper/treasury"); const LidoTreasury = "0x3e40D73EB977Dc6a537aF587D48316feE66E9C8c"; const LDO = ADDRESSES.ethereum.LIDO; +const treasuryMatic = "0xd65Fa54F8DF43064dfd8dDF223A446fc638800A9" +const treasurySolana = "GQ3QPrB1RHPRr4Reen772WrMZkHcFM4DL5q44x1BBTFm" +const LDOsol = "HZRCwxP2Vq9PCpPXooayhJ2bxTpo5xfpQrwB1svh332p" module.exports = treasuryExports({ ethereum: { @@ -18,7 +21,14 @@ module.exports = treasuryExports({ '0x232FB065D9d24c34708eeDbF03724f2e95ABE768',//SHEESHA '0x0d02755a5700414B26FF040e1dE35D337DF56218' //BEND ], - owners: [LidoTreasury], + owners: [LidoTreasury, treasuryMatic], ownTokens: [LDO], }, + solana: { + tokens: [ + "7dHbWXmci3dT8UFYWYZweBLXgycu7Y3iL6trKn1Y7ARj" + ], + owners: [treasurySolana], + ownTokens: [LDOsol], + }, }) From 73f0bd4bdf2c63902dd068b49e7dac822af22d2b Mon Sep 17 00:00:00 2001 From: Dan Hsu Date: Tue, 4 Jul 2023 04:27:19 +0800 Subject: [PATCH 0189/1974] feature: add bucket-protocol --- projects/bucket-protocol/index.js | 34 +++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 projects/bucket-protocol/index.js diff --git a/projects/bucket-protocol/index.js b/projects/bucket-protocol/index.js new file mode 100644 index 00000000000..d6a90622ede --- /dev/null +++ b/projects/bucket-protocol/index.js @@ -0,0 +1,34 @@ +const sui = require("../helper/chain/sui"); + +const MAINNET_PROTOCOL_ID = + "0x9e3dab13212b27f5434416939db5dec6a319d15b89a84fd074d03ece6350d3df"; +const BUCK = + "0xce7ff77a83ea0cb6fd39bd8748e2ec89a3f41e8efdc3f4eb123e0ca37b184db2::buck::BUCK"; + +async function tvl(_, _1, _2, { api }) { + const protocolFields = await sui.getDynamicFieldObjects({ + parent: MAINNET_PROTOCOL_ID, + }); + + const bucketList = protocolFields.filter((item) => + item.type.includes("Bucket") + ); + + const tankList = protocolFields.filter((item) => item.type.includes("Tank")); + + for (const bucket of bucketList) { + const coin = bucket.type.split("<").pop()?.replace(">", "") ?? ""; + api.add(coin, bucket.fields.collateral_vault); + } + + for (const tank of tankList) { + api.add(BUCK, tank.fields.reserve / 1e9); + } +} + +module.exports = { + timetravel: false, + sui: { + tvl, + }, +}; From b085d6a036e3f0ded8520af85045276feca787ec Mon Sep 17 00:00:00 2001 From: g1nt0ki Date: Mon, 3 Jul 2023 22:59:25 +0200 Subject: [PATCH 0190/1974] bugfix --- projects/helper/sumTokens.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/helper/sumTokens.js b/projects/helper/sumTokens.js index e9f25224182..d79a3295f9a 100644 --- a/projects/helper/sumTokens.js +++ b/projects/helper/sumTokens.js @@ -45,7 +45,7 @@ function sumTokensExport(options) { async function sumTokens(options) { let { chain, owner, owners = [], tokens = [], tokensAndOwners = [], blacklistedTokens = [], balances = {}, token, api } = options - if (api) { + if (api && !specialChains.includes(chain)) { chain = api.chain } From 6a16b93869d476ebcb89429a0251a9717e3ea96e Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Mon, 3 Jul 2023 23:51:36 +0100 Subject: [PATCH 0191/1974] add protectorate --- projects/protectorate/index.js | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 projects/protectorate/index.js diff --git a/projects/protectorate/index.js b/projects/protectorate/index.js new file mode 100644 index 00000000000..1248a900d1b --- /dev/null +++ b/projects/protectorate/index.js @@ -0,0 +1,11 @@ +const { treasuryExports } = require("../helper/treasury"); +const ADDRESSES = require('../helper/coreAssets.json') + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + ADDRESSES.ethereum.WETH, + ], + owners: ["0xaF53431488E871D103baA0280b6360998F0F9926"], + }, +}) \ No newline at end of file From ebce0297915b871de6913acecd581c9cfb877877 Mon Sep 17 00:00:00 2001 From: Dan Hsu Date: Tue, 4 Jul 2023 12:50:05 +0800 Subject: [PATCH 0192/1974] feature: modified buck decimal --- projects/bucket-protocol/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/bucket-protocol/index.js b/projects/bucket-protocol/index.js index d6a90622ede..6a64a7d49ff 100644 --- a/projects/bucket-protocol/index.js +++ b/projects/bucket-protocol/index.js @@ -22,7 +22,7 @@ async function tvl(_, _1, _2, { api }) { } for (const tank of tankList) { - api.add(BUCK, tank.fields.reserve / 1e9); + api.add(BUCK, tank.fields.reserve); } } From 9b82bb5b95463d4df0cc920406e1228ecf6fdbd3 Mon Sep 17 00:00:00 2001 From: Dan Hsu Date: Tue, 4 Jul 2023 13:00:21 +0800 Subject: [PATCH 0193/1974] feature: comment tank tvl --- projects/bucket-protocol/index.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/projects/bucket-protocol/index.js b/projects/bucket-protocol/index.js index 6a64a7d49ff..80f54bb3cb4 100644 --- a/projects/bucket-protocol/index.js +++ b/projects/bucket-protocol/index.js @@ -14,16 +14,18 @@ async function tvl(_, _1, _2, { api }) { item.type.includes("Bucket") ); - const tankList = protocolFields.filter((item) => item.type.includes("Tank")); + //Uncomment it when BUCK listed on CoinGecko + // const tankList = protocolFields.filter((item) => item.type.includes("Tank")); for (const bucket of bucketList) { const coin = bucket.type.split("<").pop()?.replace(">", "") ?? ""; api.add(coin, bucket.fields.collateral_vault); } - for (const tank of tankList) { - api.add(BUCK, tank.fields.reserve); - } + //Uncomment it when BUCK listed on CoinGecko + // for (const tank of tankList) { + // api.add(BUCK, tank.fields.reserve); + // } } module.exports = { From d1ebba73e80adf2ff29f91132708aab13ccd0a59 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Tue, 4 Jul 2023 07:48:36 +0100 Subject: [PATCH 0194/1974] add stUSDT --- projects/stUSDT/index.js | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 projects/stUSDT/index.js diff --git a/projects/stUSDT/index.js b/projects/stUSDT/index.js new file mode 100644 index 00000000000..cd4ac290b68 --- /dev/null +++ b/projects/stUSDT/index.js @@ -0,0 +1,10 @@ +module.exports = { + tron: { + tvl: async (_, _b, _cb, { api, }) => { + const supply = await api.call({ abi: "erc20:totalSupply", target: "TThzxNRLrW2Brp9DcTQU8i4Wd9udCWEdZ3" }) + return { + "0xdac17f958d2ee523a2206206994597c13d831ec7": supply/1e12 + } + } + } +} From dd29836acba4eeff35b83c10a9997daf8fa81020 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 4 Jul 2023 10:03:19 +0200 Subject: [PATCH 0195/1974] blueshift: track polygon --- projects/blueshift/abi.json | 2 +- projects/blueshift/config.json | 22 +++++++-- projects/blueshift/index.js | 82 ++++++++++++---------------------- 3 files changed, 48 insertions(+), 58 deletions(-) diff --git a/projects/blueshift/abi.json b/projects/blueshift/abi.json index 3d03d171490..549cf171455 100644 --- a/projects/blueshift/abi.json +++ b/projects/blueshift/abi.json @@ -1,6 +1,6 @@ { "BlueshiftRegistry": { - "getPortfolios": "function getPortfolios() view returns (tuple(string name, address contractAddress, address baseTokenAddress, address lpTokenAddress, uint256 lpTokenPrice, uint256 totalValue, uint256 tokenCount, tuple(address tokenAddress, uint256 amount, uint256 price, uint256 depositLimit, uint256 withdrawLimit, uint256 depositEMAPrice, uint256 withdrawEMAPrice, uint256 portfolioShare, uint256 targetWeight)[] tokens)[])" + "getPortfolios": "function getPortfolios() view returns (tuple(string[] name, address[] contractAddress, address[] baseTokenAddress, address[] lpTokenAddress, uint256[] lpTokenPrice, uint256[] totalValue, uint256[] tokenCount, uint256[] baseTokenPriceCoefficient, tuple(address[] tokenAddress, uint256[] amount, uint256[] price, uint256[] depositLimit, uint256[] withdrawLimit, uint256[] depositEMAPrice, uint256[] withdrawEMAPrice, uint256[] portfolioShare, uint256[] targetWeight)[] tokens))" }, "BlueshiftEarning": { "getAccDeposit": "uint256:getAccDeposit", diff --git a/projects/blueshift/config.json b/projects/blueshift/config.json index f4c82f253e3..07d9d2bbf8b 100644 --- a/projects/blueshift/config.json +++ b/projects/blueshift/config.json @@ -1,12 +1,28 @@ { "registry": { - "milkomeda": "0x83E384d119adA05195Caca26396B8f56fdDA1c91", - "milkomeda_a1": "0x93e9c79582cAd65627758bbdB067EAB1c79E005c", - "kava": "0xe46e53672B160a67faEdE644d4A339CDeC1f671c" + "milkomeda": "0xb42F2f37Dedf435F4916665d6B4c2cC643A17f14", + "milkomeda_a1": "0xa98C276d262Cc3Bf660189E2eBE74c4B8C18e50a", + "kava": "0x49399653f651A25924b3D8718276b5b4372577b1", + "polygon": "0x2080A319A4B11D097050722b6b65d09F754EdC83" }, "manualPool": { "milkomeda": "0xA4f0e3C80C77b347250B9D3999478E305FF814A4", "milkomeda_a1": "0x589E3Edd93A22FB316cff53eABA6BB958ff601cd", "kava": "0x7A60918Bd5c83Ef7e2ABA87D13e3FD704f6A77E1" + }, + "blueschain": { + "milkomeda": { + "reserve": "0xa2351AEA209ceB0ffeCd77149eC615335d7f513d", + "tokens": [ + "0xAE83571000aF4499798d1e3b0fA0070EB3A3E3F9", + "0x8c008BBA2Dd56b99f4A6aB276bE3a478cB075F0C" + ] + }, + "polygon": { + "reserve": "0x3abd79823C595C0778e51246c491126e77367b20", + "tokens": [ + "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270" + ] + } } } \ No newline at end of file diff --git a/projects/blueshift/index.js b/projects/blueshift/index.js index ddea2d6f762..fd9b3427f85 100644 --- a/projects/blueshift/index.js +++ b/projects/blueshift/index.js @@ -1,66 +1,40 @@ -const sdk = require('@defillama/sdk'); -const { transformBalances } = require('../helper/portedTokens'); +const { sumTokens2 } = require('../helper/unwrapLPs') const abi = require('./abi.json'); -const config = require("./config.json"); - - -async function staking(chain, chainBlocks) { - const balances = {}; - - const value = (await sdk.api.abi.call({ - abi: abi.BlueshiftEarning.getAccDeposit, - chain: chain, - target: config.manualPool[chain], - params: [], - block: chainBlocks[chain], - })).output; - - const tokenAddress = (await sdk.api.abi.call({ - abi: abi.BlueshiftEarning.getToken, - chain: chain, - target: config.manualPool[chain], - params: [], - block: chainBlocks[chain], - })).output; - - sdk.util.sumSingleBalance(balances, tokenAddress, value); - return transformBalances(chain, balances); +const { registry, manualPool, blueschain, } = require("./config.json"); + +async function staking(_, _1, _2, { api }) { + const chain = api.chain + if (!manualPool[chain]) return {} + const value = await api.call({ abi: abi.BlueshiftEarning.getAccDeposit, target: manualPool[chain], }) + const tokenAddress = await api.call({ abi: abi.BlueshiftEarning.getToken, target: manualPool[chain], }) + api.add(tokenAddress, value) + return api.getBalances() } -async function tvl(chain, chainBlocks) { - const balances = {}; +async function tvl(_, _1, _2, { api }) { + const chain = api.chain + const { reserve, tokens } = blueschain[chain] ?? {} - const portfolios = (await sdk.api.abi.call({ - abi: abi.BlueshiftRegistry.getPortfolios, - chain: chain, - target: config.registry[chain], - params: [], - block: chainBlocks[chain], - })).output; + // Blueschain reserves + if (reserve) + await sumTokens2({ api, owner: reserve, tokens, }) - for (let portfolio of portfolios) { - const value = portfolio.totalValue; - sdk.util.sumSingleBalance(balances, portfolio.baseTokenAddress, value); + // Local reserves + if (registry[chain]) { + const portfolios = await api.call({ abi: abi.BlueshiftRegistry.getPortfolios, target: registry[chain], }) + + for (let i = 0; i < portfolios.contractAddress.length; ++i) + api.add(portfolios.baseTokenAddress[i], portfolios.totalValue[i]) } - return transformBalances(chain, balances); + return api.getBalances() } + module.exports = { methodology: 'Accumulates TVL of all Blueshift portfolios calculated in base tokens. Adds TVL of BLUES tokens staked in Blueshift yield pools.', - milkomeda: { - start: 2023331, - staking: (timestamp, block, chainBlocks) => staking('milkomeda', chainBlocks), - tvl: (timestamp, block, chainBlocks) => tvl('milkomeda', chainBlocks) - }, - milkomeda_a1: { - start: 1300, - staking: (timestamp, block, chainBlocks) => staking('milkomeda_a1', chainBlocks), - tvl: (timestamp, block, chainBlocks) => tvl('milkomeda_a1', chainBlocks) - }, - kava: { - start: 2499737, - staking: (timestamp, block, chainBlocks) => staking('kava', chainBlocks), - tvl: (timestamp, block, chainBlocks) => tvl('kava', chainBlocks) - } }; + +Object.keys(registry).forEach(chain => { + module.exports[chain] = { tvl, staking } +}) From c0998e87de51c91ba7fc4c305d70cfaa0b0d2dd3 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 4 Jul 2023 13:37:27 +0530 Subject: [PATCH 0196/1974] Arpa (#6707) * feat: Add arpa-staking * code refactor --------- Co-authored-by: shjie047 --- projects/arpa-staking/index.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 projects/arpa-staking/index.js diff --git a/projects/arpa-staking/index.js b/projects/arpa-staking/index.js new file mode 100644 index 00000000000..e079e77122b --- /dev/null +++ b/projects/arpa-staking/index.js @@ -0,0 +1,16 @@ +const STAKING_CONTRACT = "0xee710f79aa85099e200be4d40cdf1bfb2b467a01"; +const ARPA = "0xBA50933C268F567BDC86E1aC131BE072C6B0b71a"; + +const staking = async (_, _1, _2, { api }) => { + const val = await api.call({ target: STAKING_CONTRACT, abi: 'uint256:getTotalCommunityStakedAmount', }); + api.add(ARPA, val) + return api.getBalances() +}; + +module.exports = { + methodology: "TVL is the total amount of ARPA staked by the community", + ethereum: { + tvl: () => ({}), + staking, + }, +}; From be5a74c7fc4f429e6d1d2a4289de9c6df2391bd7 Mon Sep 17 00:00:00 2001 From: jvalentee Date: Tue, 4 Jul 2023 09:11:30 +0100 Subject: [PATCH 0197/1974] add leNFT tvl adapter (#6702) --- projects/leNFT/index.js | 51 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 projects/leNFT/index.js diff --git a/projects/leNFT/index.js b/projects/leNFT/index.js new file mode 100644 index 00000000000..2309f5b714b --- /dev/null +++ b/projects/leNFT/index.js @@ -0,0 +1,51 @@ +const { getLogs } = require("../helper/cache/getLogs"); +const { sumTokens2 } = require("../helper/unwrapLPs"); + +async function tvl(_, _b, _cb, { api }) { + const tradingPoolFactory = "0x197456A4f5c3B3605033270Bc04Bc599916CaBA0"; + const lendingMarket = "0xFAE8371d6b22F6451A64026785e79Bd7B438306F"; + + // Get the logs of trading pool creation + const tradingPoolFactoryLogs = await getLogs({ + api, + target: tradingPoolFactory, + topics: [ + "0xa1311e5e3c1c2207844ec9211cb2439ea0bce2a76c6ea09d9343f0d0eaddd9f6", + ], + fromBlock: 17605911, + eventAbi: + "event CreateTradingPool(address indexed pool, address indexed nft, address indexed token)", + onlyArgs: true, + }); + var ownerTokens = []; + + // Add trading pools + for (const log of tradingPoolFactoryLogs) { + ownerTokens.push([[log.token, log.nft], log.pool]); + } + + // Get the logs of lending pool creation + const lendingMarketLogs = await getLogs({ + api, + target: lendingMarket, + topics: [ + "0xe981a0f3e894fa2788c75d5d18601ca14c7b544c96311cc7c0a022bcc5900ee8", + ], + fromBlock: 17605911, + eventAbi: + "event CreateLendingPool(address indexed lendingPool, address indexed collection, address indexed asset)", + onlyArgs: true, + }); + + // Add lending pools + for (const log of lendingMarketLogs) { + ownerTokens.push([[log.asset, log.collection], log.lendingPool]); + } + + return sumTokens2({ ownerTokens, api }); +} + +module.exports = { + misrepresentedTokens: false, + ethereum: { tvl }, +}; From c7f051e92cc51415d04835cfa7199d96be4b9b4c Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 4 Jul 2023 10:20:06 +0200 Subject: [PATCH 0198/1974] chainport: track ADA --- projects/chainport/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/projects/chainport/index.js b/projects/chainport/index.js index d095583ded4..80234017114 100644 --- a/projects/chainport/index.js +++ b/projects/chainport/index.js @@ -1,5 +1,5 @@ const ADDRESSES = require('../helper/coreAssets.json'); -const { sumTokensExport, nullAddress } = require("../helper/unwrapLPs"); +const { sumTokensExport, nullAddress } = require("../helper/sumTokens"); //ETH @@ -88,6 +88,9 @@ const config = { ], owners: [vault1ftm, vault2ftm], }, + cardano: { + owners: ['addr1xxcqzje930yw0hykwhf0a89l62dmjwqqpfzdsppf8rhv9rg2czf3yffs8ar450sw50w4xn3pxxwvkz25s4ygh7pjq23ql4slcu'], + } } Object.keys(config).forEach(chain => { From 1dfb9ebc42f5f789c51cf03f7f2d02829079c411 Mon Sep 17 00:00:00 2001 From: Winson Cheng <83229800+0xKMG@users.noreply.github.com> Date: Tue, 4 Jul 2023 16:20:36 +0800 Subject: [PATCH 0199/1974] add tvl for new pool sake and whiskey (#6706) --- projects/vaultka/index.js | 59 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/projects/vaultka/index.js b/projects/vaultka/index.js index 3da29101a32..19f211c55dc 100644 --- a/projects/vaultka/index.js +++ b/projects/vaultka/index.js @@ -11,8 +11,67 @@ module.exports = { calls: vaults, }); + const addresses = { + whiskey: "0x6532eFCC1d617e094957247d188Ae6d54093718A", + whiskeyWater: "0xa100E02e861132C4703ae96D6868664f27Eaa431", + sake: "0x45BeC5Bb0EE87181A7Aa20402C66A6dC4A923758", + sakeWater: "0x6b367F9EB22B2E6074E9548689cddaF9224FC0Ab", + }; + + const contractAbis = { + gainsBalance: "function getGainsBalance() view returns (uint256)", + gTokenPrice: "function gTokenPrice() view returns (uint256)", + wWaterBalance: "function balanceOfDAI() public view returns (uint256)", + vlpBalance: "function getVlpBalance() public view returns (uint256)", + stakedVlpBalance: + "function getStakedVlpBalance() public view returns (uint256)", + vlpPrice: "function getVLPPrice() public view returns (uint256)", + waterUSDCBal: "function balanceOfUSDC() public view returns (uint256)", + }; + + const whiskeyGainsBalance = await api.call({ + abi: contractAbis.gainsBalance, + target: addresses.whiskey, + }); + + const whiskeyGTokenPrice = await api.call({ + abi: contractAbis.gTokenPrice, + target: addresses.whiskey, + }); + + const whiskeyWaterDaiBal = await api.call({ + abi: contractAbis.wWaterBalance, + target: addresses.whiskeyWater, + }); + + const sakeWaterUSDCBal = await api.call({ + abi: contractAbis.waterUSDCBal, + target: addresses.sakeWater, + }); + + const vlpBal = await api.call({ + abi: contractAbis.vlpBalance, + target: addresses.sake, + }); + + const StakedVLPBal = await api.call({ + abi: contractAbis.stakedVlpBalance, + target: addresses.sake, + }); + + const sakeVLPPrice = await api.call({ + abi: contractAbis.vlpPrice, + target: addresses.sake, + }); + return { tether: bals.reduce((a, i) => a + i / 1e6, 0), + dai: + (whiskeyGainsBalance * whiskeyGTokenPrice) / 1e36 + + whiskeyWaterDaiBal / 1e18, + "usd-coin": + ((vlpBal + StakedVLPBal) * sakeVLPPrice) / 1e18 / 1e5 + + sakeWaterUSDCBal / 1e6, }; }, }, From a2586930857edc4919f1cf3dd869074d6bd2c948 Mon Sep 17 00:00:00 2001 From: Raul <42917076+elRaulito@users.noreply.github.com> Date: Tue, 4 Jul 2023 10:32:59 +0200 Subject: [PATCH 0200/1974] Added liquidity pools (#6705) Lending pools have been added, liquidity is locked in the smart contract and can be borrowed --- projects/fluidtokens/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/fluidtokens/index.js b/projects/fluidtokens/index.js index a6ad125cc3a..7ac1e750fae 100644 --- a/projects/fluidtokens/index.js +++ b/projects/fluidtokens/index.js @@ -52,8 +52,9 @@ async function tvl() { const repay_tvl = parseInt(await get("https://api.fluidtokens.com/get-total-available-repayments")); + const pools_tvl= parseInt(await get("https://api.fluidtokens.com/get-total-available-pools")); return { - cardano: (SC_offers_tvl+repay_tvl) / 1e6, + cardano: (SC_offers_tvl+repay_tvl+pools_tvl) / 1e6, }; } From b123422af322e15be26f390dff25522c342a1946 Mon Sep 17 00:00:00 2001 From: devflowx <138456737+devflowx@users.noreply.github.com> Date: Tue, 4 Jul 2023 16:29:37 +0700 Subject: [PATCH 0201/1974] Add FlowX (#6709) --- projects/flowx-finance/index.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 projects/flowx-finance/index.js diff --git a/projects/flowx-finance/index.js b/projects/flowx-finance/index.js new file mode 100644 index 00000000000..03c6d8d5abf --- /dev/null +++ b/projects/flowx-finance/index.js @@ -0,0 +1,28 @@ +const sui = require("../helper/chain/sui"); + +async function suiTVL() { + const { api } = arguments[3]; + + const poolInfo = ( + await sui.getDynamicFieldObjects({ + parent: + "0xd15e209f5a250d6055c264975fee57ec09bf9d6acdda3b5f866f76023d1563e6", + }) + ).map((i) => i.fields.value.fields); + poolInfo.forEach(({ reserve_x, reserve_y }) => { + api.add( + reserve_x.type.replace(">", "").split("<")[1], + reserve_x.fields.balance + ); + api.add( + reserve_y.type.replace(">", "").split("<")[1], + reserve_y.fields.balance + ); + }); +} + +module.exports = { + sui: { + tvl: suiTVL, + }, +}; From a2c87cf1078273e8966db5c3ea0390048636490e Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 4 Jul 2023 15:46:59 +0530 Subject: [PATCH 0202/1974] Titi (#6712) * Add files via upload * code refactor --------- Co-authored-by: TiTi Protocol <82432369+titimoney@users.noreply.github.com> --- projects/helper/cache/sumUnknownTokens.js | 4 +- projects/helper/unknownTokens.js | 4 +- projects/titi-finance/index.js | 77 ++++++++++------------- 3 files changed, 37 insertions(+), 48 deletions(-) diff --git a/projects/helper/cache/sumUnknownTokens.js b/projects/helper/cache/sumUnknownTokens.js index 7a05d1e5848..c7dae15a2fb 100644 --- a/projects/helper/cache/sumUnknownTokens.js +++ b/projects/helper/cache/sumUnknownTokens.js @@ -358,7 +358,7 @@ async function getTokenPrices({ async function sumUnknownTokens({ api, tokensAndOwners = [], balances, coreAssets = [], owner, tokens, chain = 'ethereum', block, restrictTokenRatio, blacklist = [], skipConversion = false, onlyLPs, minLPRatio, - log_coreAssetPrices = [], log_minTokenValue = 1e6, owners = [], lps = [], useDefaultCoreAssets = false, cache = {}, resolveLP = false, + log_coreAssetPrices = [], log_minTokenValue = 1e6, owners = [], lps = [], useDefaultCoreAssets = false, cache = {}, resolveLP = false, abis, }) { if (api) { chain = api.chain ?? chain @@ -377,7 +377,7 @@ async function sumUnknownTokens({ api, tokensAndOwners = [], balances, tokensAndOwners = tokens.map(t => [t, owner]) tokensAndOwners = tokensAndOwners.filter(t => !blacklist.includes(t[0])) await sumTokens2({ api, balances, chain, block, tokensAndOwners, skipFixBalances: true, resolveLP, }) - const { updateBalances, } = await getTokenPrices({ cache, coreAssets, lps: [...tokensAndOwners.map(t => t[0]), ...lps,], chain, block, restrictTokenRatio, blacklist, log_coreAssetPrices, log_minTokenValue, minLPRatio }) + const { updateBalances, } = await getTokenPrices({ cache, coreAssets, lps: [...tokensAndOwners.map(t => t[0]), ...lps,], chain, block, restrictTokenRatio, blacklist, log_coreAssetPrices, log_minTokenValue, minLPRatio, abis, }) await updateBalances(balances, { skipConversion, onlyLPs }) const fixBalances = await getFixBalances(chain) fixBalances(balances) diff --git a/projects/helper/unknownTokens.js b/projects/helper/unknownTokens.js index c7a17dabf2b..8eb44efb5bc 100644 --- a/projects/helper/unknownTokens.js +++ b/projects/helper/unknownTokens.js @@ -93,9 +93,9 @@ function pool2({ stakingContract, lpToken, chain, transformAddress, coreAssets = function sumTokensExport({ tokensAndOwners = [], coreAssets = [], owner, tokens, restrictTokenRatio, blacklist = [], skipConversion = false, onlyLPs, minLPRatio, - log_coreAssetPrices = [], log_minTokenValue = 1e6, owners = [], lps = [], useDefaultCoreAssets = false, + log_coreAssetPrices = [], log_minTokenValue = 1e6, owners = [], lps = [], useDefaultCoreAssets = false, abis, }) { - return (_, _b, _cb, { api }) => sumUnknownTokens({ api, tokensAndOwners, onlyLPs, minLPRatio, coreAssets, owner, tokens, restrictTokenRatio, blacklist, skipConversion, log_coreAssetPrices, log_minTokenValue, owners, lps, useDefaultCoreAssets, }) + return (_, _b, _cb, { api }) => sumUnknownTokens({ api, tokensAndOwners, onlyLPs, minLPRatio, coreAssets, owner, tokens, restrictTokenRatio, blacklist, skipConversion, log_coreAssetPrices, log_minTokenValue, owners, lps, useDefaultCoreAssets, abis, }) } function staking({ tokensAndOwners = [], diff --git a/projects/titi-finance/index.js b/projects/titi-finance/index.js index 3418ee2270c..4642e140c61 100644 --- a/projects/titi-finance/index.js +++ b/projects/titi-finance/index.js @@ -1,8 +1,5 @@ const ADDRESSES = require('../helper/coreAssets.json'); -const { sumTokensAndLPsSharedOwners, sumTokens2 } = require('../helper/unwrapLPs') -const { stakings } = require("../helper/staking"); - -// -------------------------- +const { sumTokensExport } = require('../helper/unknownTokens') const ethTiTiToken = "0x3bdffA70f4b4E6985eED50453c7C0D4A15dcEc52"; // TiTi Token const ethTiTiStaking = "0x5390Dbf4958F21BB317C72744c110977F4c03311"; // TiTi Staking @@ -10,47 +7,39 @@ const ethTiTiStaking = "0x5390Dbf4958F21BB317C72744c110977F4c03311"; // TiTi const eraTiTiToken = "0x4EBfb78C4780C304dff7de518db630b67e3F044b"; // TiTi Token Era const eraTiTiStaking = "0x1B05972C2e46288201E0432262bd8e925d4fCF94"; // TiTi Staking Era +const ethereumLPs = ['0xca4AEf99b3567Dbb631DF0DCd51D446DB7eb63e5'] +const eraLPs = [ + "0x574E2E833A010997840f368edF6542d8950c2788", + "0x228D400F196760432BD8bcE74Fa1e6580aF4BF03", + "0xd4cb4f38de684122Af261ee822Dc1437601e5424", + "0x512f5a62eE69013643f37C12fd8Be391Db7b4550", +] +const lpReservesAbi = 'function getReserves() view returns (uint _reserve0, uint _reserve1)' -async function ethTvl() { - const balances = {}; - - const ownerAddresses = [ +module.exports = { + methodology: `Calculate the reserve-type assets locked in the contract, including the user's stake funds in MarketMakerFund and the reserve of TiUSD issued by the protocol, TiTi-AMMs used to provide liquidity TiUSD is not included`, + ethereum: { + tvl: sumTokensExport({ + owners: [ "0x49a0c2076DE4801bcadFEf78d0FA63cEC0AD1cB4", // MAMMSwapPair - ]; - - const tokenAddresses = [ - [ADDRESSES.ethereum.USDC, false], // USDC - ]; - - await sumTokensAndLPsSharedOwners(balances, tokenAddresses, ownerAddresses); - - return balances; -} - -// zksync era -async function eraTvl(_, _b, _cb, { api }) { - let balances = {}; - - const ownerAddresses = [ + ], tokens: [ADDRESSES.ethereum.USDC] + }), + staking: sumTokensExport({ owner: ethTiTiStaking, tokens: [ethTiTiToken], lps: ethereumLPs, useDefaultCoreAssets: true, restrictTokenRatio: 5000 }), + pool2: sumTokensExport({ owner: '0x9A132b777FE7af6561BAAb60A03302C697fA8F3B', tokens: ['0x830Ce3859F98104DC600efBFAD90A65386B95404'], lps: ethereumLPs, useDefaultCoreAssets: true, restrictTokenRatio: 1000, resolveLp: true, }), + }, + era: { + tvl: sumTokensExport({ + owners: [ "0xc856175575F6406b59AD6822c3114494990750DC", // MAMMSwapPair - ]; - - const tokenAddresses = [ - ADDRESSES.era.USDC // USDC - ]; - - balances = await sumTokens2({ api, tokens: tokenAddresses, owners: ownerAddresses }); - return balances; -} - -module.exports = { - methodology: `Calculate the reserve-type assets locked in the contract, including the user's stake funds in MarketMakerFund and the reserve of TiUSD issued by the protocol, TiTi-AMMs used to provide liquidity TiUSD is not included`, - ethereum: { - tvl: ethTvl, - // staking: stakings([ethTiTiStaking], [ethTiTiToken], 'ethereum') - }, - era: { - tvl: eraTvl, - // staking: stakings([eraTiTiStaking], eraTiTiToken, "era") - }, + ], tokens: [ADDRESSES.era.USDC] + }), + staking: sumTokensExport({ owner: eraTiTiStaking, tokens: [eraTiTiToken], lps: eraLPs, useDefaultCoreAssets: true, restrictTokenRatio: 5000, abis: { getReservesABI: lpReservesAbi } }), + pool2: sumTokensExport({ + owners: [ + "0xA690DC59d6afC12d6789f46fc211DdD27f1C7f7c", + "0x2cbCE1EFC624138326877C386692E889D8C7c834", + "0xDc8440CdC50bEe0936bB49De82e80c2439dCEc42" + ], tokens: eraLPs, lps: eraLPs, useDefaultCoreAssets: true, abis: { getReservesABI: lpReservesAbi }, resolveLp: true, restrictTokenRatio: 1000, + }), + }, } \ No newline at end of file From 42241ae7c575beeaa1e66ace8e2ed6551d579acd Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 4 Jul 2023 15:51:09 +0530 Subject: [PATCH 0203/1974] Florence (#6713) * add(tvl): florence finance * add(tvl): florence finance * fix(tvl): florence finance * code refactor * minor fix --------- Co-authored-by: bbjansen --- projects/florence-finance/index.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 projects/florence-finance/index.js diff --git a/projects/florence-finance/index.js b/projects/florence-finance/index.js new file mode 100644 index 00000000000..87bfbd4f88d --- /dev/null +++ b/projects/florence-finance/index.js @@ -0,0 +1,21 @@ + +const FACTORY_CONTRACT_ETH = "0xD6348E8EacE62Eb3Eb77fBbA8D8c363e375fC455"; +const EURS_CONTRACT_ETH= "0xdb25f211ab05b1c97d595516f45794528a807ad8"; + +async function borrowed(_, _1, _2, { api }) { + // Get all vaults + const vaultIds = await api.call({ + abi: "function getLoanVaultIds() external view returns (string[])", + target: FACTORY_CONTRACT_ETH + }) + const vaultContracts = await api.multiCall({ abi: "function getLoanVault (string loanVaultId) external view returns (address)", target: FACTORY_CONTRACT_ETH, calls: vaultIds }) + const loans = await api.multiCall({ abi: "function loansOutstanding() external view returns (uint256)", calls: vaultContracts}) + // Take the sum of all vault tokens in terms of EURS (1 Loan Vault Token = 1 EURS Statis) on the platform | 18-2 = 16 atomic units (LV-EURS + loans.forEach((val, i) => api.add(EURS_CONTRACT_ETH, val / 1e16)) +} + +module.exports = { + start: 16077400, + methodology: "Data is retrieved on-chain by taking the total sum of all loans outstanding (dominated in EURS Statis) from all platform vaults.", + ethereum: { borrowed, tvl: () => ({}) } +} From 57da0193332f486ad1fb7112358322be5962dd2a Mon Sep 17 00:00:00 2001 From: Igor Onyshchenko Date: Tue, 4 Jul 2023 18:25:50 +0300 Subject: [PATCH 0204/1974] fix(concordex): update concordex values to usd (#6714) --- projects/concordex-io/index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/projects/concordex-io/index.js b/projects/concordex-io/index.js index 8f02673e894..7ae0fc91eeb 100644 --- a/projects/concordex-io/index.js +++ b/projects/concordex-io/index.js @@ -1,10 +1,11 @@ -const { post } = require('../helper/http') +const { post, get } = require('../helper/http') async function tvl(_, _b, _cb, { api, }) { const body = {"jsonrpc":"2.0","method":"liquidity_pools_list","params":{"filter":{"sort":"EFFECTIVE_TVL","page":1,"is_desc":true,"search":"","limit":999}},"id":0} const { result: { pools }} = await post('https://cdex-liquidity-pool.concordex.io/v1/rpc', body) + const { rates } = await get('https://open.er-api.com/v6/latest/EUR'); return { - tether: pools.reduce((acc, i) => acc + +i.tvl, 0) + tether: pools.reduce((acc, i) => acc + +i.tvl, 0) * rates['USD'] } } From 2234712e5ae8005c244490280f86e6eee3901c4b Mon Sep 17 00:00:00 2001 From: EdgarRBL <99257947+EdgarRBL@users.noreply.github.com> Date: Tue, 4 Jul 2023 12:27:27 -0300 Subject: [PATCH 0205/1974] feat: tashi protocol (#6715) --- projects/tashi/index.js | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 projects/tashi/index.js diff --git a/projects/tashi/index.js b/projects/tashi/index.js new file mode 100644 index 00000000000..85239bae3a6 --- /dev/null +++ b/projects/tashi/index.js @@ -0,0 +1,11 @@ +const {compoundExports} = require('../helper/compound') +const ADDRESSES = require('../helper/coreAssets.json') + +module.exports={ + timetravel: true, + doublecounted: false, + methodology: "Same as compound, we just get all the collateral (not borrowed money) on the lending markets", + evmos:{ + ...compoundExports("0x053841Bd1D291380726a007eA834Ecd296923260", "evmos", "0x1cd248D72248A0618932F77093Dc4ceC9757759d", ADDRESSES.evmos.WEVMOS) + } +} From d69a28d312a319b103ff4907452f6e395453a88b Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 4 Jul 2023 17:29:04 +0200 Subject: [PATCH 0206/1974] minor fix --- projects/tashi/index.js | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/projects/tashi/index.js b/projects/tashi/index.js index 85239bae3a6..e08d509c353 100644 --- a/projects/tashi/index.js +++ b/projects/tashi/index.js @@ -1,11 +1,7 @@ -const {compoundExports} = require('../helper/compound') +const { compoundExports } = require('../helper/compound') const ADDRESSES = require('../helper/coreAssets.json') -module.exports={ - timetravel: true, - doublecounted: false, - methodology: "Same as compound, we just get all the collateral (not borrowed money) on the lending markets", - evmos:{ - ...compoundExports("0x053841Bd1D291380726a007eA834Ecd296923260", "evmos", "0x1cd248D72248A0618932F77093Dc4ceC9757759d", ADDRESSES.evmos.WEVMOS) - } +module.exports = { + methodology: "Same as compound, we just get all the collateral (not borrowed money) on the lending markets", + evmos: compoundExports("0x053841Bd1D291380726a007eA834Ecd296923260", "evmos", "0x1cd248D72248A0618932F77093Dc4ceC9757759d", ADDRESSES.null, undefined, undefined, { fetchBalances: true, }) } From 895bd64aedd82258c6b2d77a49885241d7e07f10 Mon Sep 17 00:00:00 2001 From: Kirill Madorin Date: Tue, 4 Jul 2023 17:34:07 +0200 Subject: [PATCH 0207/1974] add CollectifDAO (#6719) --- projects/CollectifDAO/index.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 projects/CollectifDAO/index.js diff --git a/projects/CollectifDAO/index.js b/projects/CollectifDAO/index.js new file mode 100644 index 00000000000..c54761837ef --- /dev/null +++ b/projects/CollectifDAO/index.js @@ -0,0 +1,18 @@ +const { nullAddress } = require("../helper/tokenMapping"); + +const COLLECTIF_LIQUID_STAKING_POOL_CONTRACT = "0xd0437765D1Dc0e2fA14E97d290F135eFdf1a8a9A"; // pool address +const totalAssetsABI = "function totalAssets() public view returns (uint256)"; + +module.exports = { + methodology: + "Collectif DAO is a non-custodial liquid staking protocol on Filecoin. It allows users stake FIL tokens to the pool and get back clFIL token, which is a native yield bearing liquid staking asset on Filecoin. This TVL calculation returns total amount of assets backing clFIL, that includes buffered capital in the pool and pledged capital to the Filecoin Storage Providers (miners)", + filecoin: { + tvl: async (_, _1, _2, { api }) => { + const totalAssets = await api.call({ abi: totalAssetsABI, target: COLLECTIF_LIQUID_STAKING_POOL_CONTRACT }); + + const tvl = totalAssets.toString(); + + api.add(nullAddress, tvl) + }, + }, +}; From f80a4f399e5ffb1823398676257c73ae356aec05 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Tue, 4 Jul 2023 17:38:13 +0100 Subject: [PATCH 0208/1974] add fantom to velocimeter v2 --- projects/velocimeter-v2/index.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/projects/velocimeter-v2/index.js b/projects/velocimeter-v2/index.js index b3b9d2a7ccb..39a4d0fe244 100644 --- a/projects/velocimeter-v2/index.js +++ b/projects/velocimeter-v2/index.js @@ -15,5 +15,12 @@ module.exports = { useDefaultCoreAssets: true, hasStablePools: true, }) + }, + fantom: { + tvl: getUniTVL({ + factory: '0x472f3C3c9608fe0aE8d702f3f8A2d12c410C881A', + useDefaultCoreAssets: true, + hasStablePools: true, + }) } } From 1cf5933a6dddbda35af52e47ef6e56301635b9d1 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 4 Jul 2023 22:26:50 +0530 Subject: [PATCH 0209/1974] Metastreet (#6704) * projects/metastreet-v2: add queries for tvl and total borrowed value * metasteet-v2: change tvl calc * metastreet v2: use subgraph for nft tvl * update endpoint --------- Co-authored-by: wegory --- projects/metastreet-v2/abi.json | 6 ++ projects/metastreet-v2/index.js | 102 ++++++++++++++++++++++++++++++++ 2 files changed, 108 insertions(+) create mode 100644 projects/metastreet-v2/abi.json create mode 100644 projects/metastreet-v2/index.js diff --git a/projects/metastreet-v2/abi.json b/projects/metastreet-v2/abi.json new file mode 100644 index 00000000000..7ecb54a5d21 --- /dev/null +++ b/projects/metastreet-v2/abi.json @@ -0,0 +1,6 @@ +{ + "getPools": "address[]:getPools", + "collateralToken": "address:collateralToken", + "currencyToken": "address:currencyToken", + "liquidityNodes": "function liquidityNodes(uint128 startTick, uint128 endTick) view returns (tuple(uint128 tick, uint128 value, uint128 shares, uint128 available, uint128 pending, uint128 redemptions, uint128 prev, uint128 next)[])" +} \ No newline at end of file diff --git a/projects/metastreet-v2/index.js b/projects/metastreet-v2/index.js new file mode 100644 index 00000000000..d4e1283bb26 --- /dev/null +++ b/projects/metastreet-v2/index.js @@ -0,0 +1,102 @@ +const sdk = require("@defillama/sdk"); +const abi = require("./abi.json"); +const { sumTokens2 } = require('../helper/unwrapLPs') +const { blockQuery } = require('../helper/http') + +const query = ` +query nfts($block: Int) { + loans(where: { or: [{ status: "Active" }, { status: "Liquidated" }] } block: { number: $block }) { + collateralTokenIds + collateralToken { + id + } + pool { + id + } + } +} +` +const endpoint = 'https://api.studio.thegraph.com/query/49216/metastreet-v2-mainnet-devel/version/latest' + +// Constants +const METASTREET_POOL_FACTORY = "0x1c91c822F6C5e117A2abe2B33B0E64b850e67095"; +const MAX_UINT_128 = "0xffffffffffffffffffffffffffffffff" + +// Gets all MetaStreet V2 pools created by PoolFactory and their +// corresponding currency token +async function getAllPoolsAndTokens(block) { + const pools = ( + await sdk.api.abi.call({ + target: METASTREET_POOL_FACTORY, + abi: abi.getPools, + block, + }) + ).output; + + const tokens = ( + await sdk.api.abi.multiCall({ + abi: abi.currencyToken, + calls: pools.map((pool) => ({ + target: pool, + })), + block, + }) + ).output.map((response) => response.output); + + return [pools, tokens]; +} + +// Calculates total borrowed value across all MetaStreet pools +async function getBorrowedValue(values, block, pools, tokens) { + const poolsBorrowedValue = ( + await sdk.api.abi.multiCall({ + abi: abi.liquidityNodes, + calls: pools.map((pool) => ({ + target: pool, + params: [0, MAX_UINT_128], + })), + block, + }) + ).output.map((response) => + response.output.reduce( + (partialSum, node) => partialSum + +node.value - +node.available, + 0 + ) + ); + + // Sum up borrowed value of each pool + for (let i = 0; i < pools.length; i++) { + sdk.util.sumSingleBalance(values, tokens[i], poolsBorrowedValue[i]); + } + + return values; +} + +function getMetaStreetBorrowedValue() { + return async (_, block) => { + const values = {}; + // Get all pools and tokens + const [pools, tokens] = await getAllPoolsAndTokens(block); + await getBorrowedValue(values, block, pools, tokens); + return values; + }; +} + +module.exports = { + ethereum: { + tvl, + borrowed: getMetaStreetBorrowedValue(), + }, + methodology: "TVL is calculated by summing the value of token balances and NFTs across all MetaStreet pools. Total borrowed is calculated by subtracting the tokens available from the total value of all liquidity nodes across all pools.", + start: 17497132, // Block number of PoolFactory creation +}; + +async function tvl(_, _b, _cb, { api, }) { + const pools = await api.call({ target: METASTREET_POOL_FACTORY, abi: abi.getPools, }) + const tokens = await api.multiCall({ abi: abi.currencyToken, calls: pools }) + // const collateralTokens = await api.multiCall({ abi: abi.collateralToken, calls: pools }) + const ownerTokens = pools.map((pool, i) => [[tokens[i]], pool,]) + const { loans } = await blockQuery(endpoint, query, { api, blockCatchupLimit: 600, }) + loans.forEach(loan => api.add(loan.collateralToken.id, loan.collateralTokenIds.length)) + return sumTokens2({ api, ownerTokens, }) +} \ No newline at end of file From e27b0d5964a9411fc546a6596aa4d569b462e2fb Mon Sep 17 00:00:00 2001 From: tstemko <57684389+tstemko@users.noreply.github.com> Date: Tue, 4 Jul 2023 14:05:00 -0400 Subject: [PATCH 0210/1974] Addition of Arbitrum vaults and Polygon Retro vaults to TVL calculation (#6717) * Addition of Arbitrum vaults and Polygon Retro vaults to TVL calculation * ichifarm: code refactor --------- Co-authored-by: Tatyana Stemkovski Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/ichifarm/index.js | 293 +++++++++++-------------------------- 1 file changed, 85 insertions(+), 208 deletions(-) diff --git a/projects/ichifarm/index.js b/projects/ichifarm/index.js index aae4553e782..3245a3e22b9 100644 --- a/projects/ichifarm/index.js +++ b/projects/ichifarm/index.js @@ -1,26 +1,15 @@ +const { getLogs } = require('../helper/cache/getLogs') const ADDRESSES = require('../helper/coreAssets.json') -const sdk = require("@defillama/sdk"); const { stakings } = require("../helper/staking"); -const { transformBalances } = require('../helper/portedTokens') const abi = require("./abi.json"); -const { createIncrementArray } = require('../helper/utils'); -const { sumTokens2, unwrapUniswapV3NFTs } = require('../helper/unwrapLPs'); -const { GraphQLClient, gql } = require('graphql-request'); - +const { sumTokens2, } = require('../helper/unwrapLPs'); const ichiLegacy = "0x903bEF1736CDdf2A537176cf3C64579C3867A881"; const ichi = "0x111111517e4929D3dcbdfa7CCe55d30d4B6BC4d6"; const xIchi = "0x70605a6457B0A8fBf1EEE896911895296eAB467E"; -const tokenFactory = "0xD0092632B9Ac5A7856664eeC1abb6E3403a6A36a"; const farmContract = "0x275dFE03bc036257Cd0a713EE819Dbd4529739c8"; const ichiLending = "0xaFf95ac1b0A78Bd8E4f1a2933E373c66CC89C0Ce"; -const unilps = [ - // SLP - "0x9cD028B1287803250B1e226F0180EB725428d069", - // UNI-V2 lP - "0xd07D430Db20d2D7E0c4C11759256adBCC355B20C" -] const poolWithTokens = [ // BANCOR ["0x4a2F0Ca5E03B2cF81AebD936328CF2085037b63B", ["0x903bEF1736CDdf2A537176cf3C64579C3867A881", "0x1F573D6Fb3F13d689FF844B4cE37794d79a7FF1C"]], @@ -30,206 +19,94 @@ const poolWithTokens = [ ["0x58378f5F8Ca85144ebD8e1E5e2ad95B02D29d2BB", ["0x903bEF1736CDdf2A537176cf3C64579C3867A881", ADDRESSES.ethereum.WETH]] ] -const graphUrl = { - 'ethereum': 'https://api.thegraph.com/subgraphs/name/ichi-org/v1', - 'polygon': 'https://api.thegraph.com/subgraphs/name/ichi-org/polygon-v1' -} - -const graphQuery = gql` -query { - ichiVaults { - id - tokenA - tokenB - } -} -`; - -async function getVaultsByGraph(chain = 'ethereum') { - const graphQLClient = new GraphQLClient(graphUrl[chain]); - - const data = await graphQLClient.request(graphQuery); - - const vaults = []; - data.ichiVaults.forEach( v => vaults.push({address: v.id, tokenA: v.tokenA, tokenB: v.tokenB})); - - return vaults; -} - -async function vaultBalances(block, chain = 'ethereum', oneTokenList){ - const vaults = await getVaultsByGraph(chain) - - const poolsCalls = vaults.map(i => ({ target: i.address })) - - const { output: vaultBalances } = await sdk.api.abi.multiCall({ - abi: abi.getTotalAmounts, - calls: poolsCalls, - chain, block, - }) - - const balances = {} - vaultBalances.forEach((data, i) => { - addBalance(vaults[i].tokenA, data.output.total0) - addBalance(vaults[i].tokenB, data.output.total1) - }) - - return balances; - - function addBalance(token, balance) { - if (oneTokenList.includes(token.toLowerCase())) - return; - sdk.util.sumSingleBalance(balances, token, balance) - } -} - -const oneFactory = { - 'ethereum': '0xD0092632B9Ac5A7856664eeC1abb6E3403a6A36a', - 'polygon': '0x101eB16BdbA37979a771c86e1CAAfbaDbABfc879' -} - -async function oneTokenBalances(block, chain='ethereum') { - - // get list of all oneTokens in system - const { output: oneTokenCount } = await sdk.api.abi.call({ - target: oneFactory[chain], - abi: abi.oneTokenCount, - chain, block, - }) - - const oneTokenParams = createIncrementArray(oneTokenCount).map(i => ({ params: i })) - const { output: oneTokens } = await sdk.api.abi.multiCall({ - target: oneFactory[chain], - abi: abi.oneTokenAtIndex, - calls: oneTokenParams, - chain, block, - }) - - const oneTokenList = oneTokens.map(i => ( i.output.toLowerCase() )) - - // get list of all tokens in the system - const { output: foreignTokenCount } = await sdk.api.abi.call({ - target: oneFactory[chain], - abi: abi.foreignTokenCount, - chain, block, - }) - - const foreignTokenParams = createIncrementArray(foreignTokenCount).map(i => ({ params: i})) - const { output: foreignTokens } = await sdk.api.abi.multiCall({ - target: oneFactory[chain], - abi: abi.foreignTokenAtIndex, - calls: foreignTokenParams, - chain, block, - }) - - const foreignTokenList = foreignTokens.map(i => (i.output)) - - // ICHI is not admited as foreign token to polygon oneToken Factory but it is used to back oneToken treasury - if (chain == 'polygon') { - foreignTokenList.push(ichi) - } - - // get list of all strategies in the system - const { output: moduleCount } = await sdk.api.abi.call({ - target: oneFactory[chain], - abi: abi.moduleCount, - chain, block, - }) - - const strategyParams = createIncrementArray(moduleCount).map(i => ({ params: i})) - const { output: moduleAtIndex } = await sdk.api.abi.multiCall({ - target: oneFactory[chain], - abi: abi.moduleAtIndex, - calls: strategyParams, - chain, block, - }) - - const modulesList = moduleAtIndex.map(i => ( {params: i.output })) - - const { output: moduleDetails } = await sdk.api.abi.multiCall({ - target: oneFactory[chain], - abi: abi.modules, - calls: modulesList, - chain, block, - }) - - const strategiesList = [] - moduleDetails.forEach((data, i) => { - if (data.output.moduleType == 2) { //modeuleType 2 are strategies - strategiesList.push(modulesList[i].params) - } - }) - - // get list of all owners of oneTokens - const ownerCalls = oneTokens.map(i => ( { target: i.output })) - const { output: oneTokenOwners } = await sdk.api.abi.multiCall({ - abi: abi.owner, - calls: ownerCalls, - chain, block, - }) - - const oneTokenOwnersList = oneTokenOwners.map(i => (i.output)) - - // create large list of tokens and owners list; - // owners are all onetokens, strategies, and owners of onetokens - // tokens are all tokens in the system but will exclude onetokens in the strategies - - const toa = [] - - oneTokenList.forEach( oneToken => foreignTokenList.forEach( foreignToken => toa.push([foreignToken, oneToken]))) - strategiesList.forEach( strategy => foreignTokenList.forEach( foreignToken => toa.push([foreignToken, strategy]))) - oneTokenOwnersList.forEach( owner => foreignTokenList.forEach( foreignToken => toa.push([foreignToken, owner]))) - - const balances = await sumTokens2({ tokensAndOwners: toa, block, chain, blacklistedTokens: oneTokenList }) - - const uniV3NFTHolders = [...strategiesList, ...oneTokenOwnersList] - - await unwrapUniswapV3NFTs({ balances, owners: uniV3NFTHolders, chain, block }) - - return { balances, oneTokenList }; -} - -async function tvl(timestamp, block) { - - const { balances, oneTokenList } = await oneTokenBalances(block) - - const vBalances = await vaultBalances(block, undefined, oneTokenList) - - for(var token in vBalances) - sdk.util.sumSingleBalance(balances, token, vBalances[token]) - - return balances -} - -async function polygonTvl(_, _b, { polygon: block }){ - const chain = 'polygon' - - const { balances, oneTokenList } = await oneTokenBalances(block, chain) - - const vBalances = await vaultBalances(block, chain, oneTokenList) - const vBalancesTransformed = await transformBalances(chain,vBalances) - for(var token in vBalancesTransformed) - sdk.util.sumSingleBalance(balances, token, vBalancesTransformed[token]) - - return balances; -} - module.exports = { methodology: "Tokens deposited to mint oneTokens excluding oneTokens , Vault deposits", misrepresentedTokens: true, doublecounted: true, +} // node test.js projects/ichifarm/index.js + +const defaultEvent = 'event ICHIVaultCreated (address indexed sender, address ichiVault, address tokenA, bool allowTokenA, address tokenB, bool allowTokenB, uint24 fee, uint256 count)' +const defaultTopic = '0xde147f43b6837f282eee187234c866cf001806167325f3ea883e36bed0c16a20' + +const config = { ethereum: { - tvl, - pool2: async (_, block) => { - const toa = [ - ['0x9cd028b1287803250b1e226f0180eb725428d069', farmContract], - ['0xd07d430db20d2d7e0c4c11759256adbcc355b20c', farmContract], - ] - poolWithTokens.forEach(([o, tokens]) => tokens.forEach(t => toa.push([t, o]))) - return sumTokens2({ tokensAndOwners: toa, block, resolveLP: true, }) - }, - staking: stakings([xIchi, ichiLending] , ichiLegacy) + vaultConfigs: [ + { factory: '0x5a40DFaF8C1115196A1CDF529F97122030F26112', fromBlock: 13671610, }, + ], + oneFactory: '0xD0092632B9Ac5A7856664eeC1abb6E3403a6A36a', + }, + arbitrum: { + vaultConfigs: [ + { factory: '0xfBf38920cCbCFF7268Ad714ae5F9Fad6dF607065', fromBlock: 102858581, }, + ], }, polygon: { - tvl: polygonTvl + vaultConfigs: [ + { factory: '0x2d2c72c4dc71aa32d64e5142e336741131a73fc0', fromBlock: 25697834, }, + { factory: '0xb2f44D8545315cDd0bAaB4AC7233218b932a5dA7', fromBlock: 44370370, }, // v2-retro + ], + oneFactory: '0x101eB16BdbA37979a771c86e1CAAfbaDbABfc879', + }, +} + +Object.keys(config).forEach(chain => { + const { vaultConfigs = [], oneFactory } = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const blacklistedTokens = [] + if (oneFactory) { + const oneTokens = await api.fetchList({ lengthAbi: abi.oneTokenCount, itemAbi: abi.oneTokenAtIndex, target: oneFactory }) + const oneTokenOwners = await api.multiCall({ abi: abi.owner, calls: oneTokens }) + const foreignTokens = await api.fetchList({ lengthAbi: abi.foreignTokenCount, itemAbi: abi.foreignTokenAtIndex, target: oneFactory }) + const modulesList = await api.fetchList({ lengthAbi: abi.moduleCount, itemAbi: abi.moduleAtIndex, target: oneFactory }) + const moduleDetails = await api.multiCall({ abi: abi.modules, calls: modulesList, target: oneFactory }) + + const strategiesList = [] + moduleDetails.forEach((data, i) => { + if (data.moduleType == 2) { //modeuleType 2 are strategies + strategiesList.push(modulesList[i]) + } + }) + if (api.chain === 'polygon') { + foreignTokens.push(ichi) + } + + blacklistedTokens.push(...oneTokens.map(i => i.toLowerCase())) + await sumTokens2({ api, tokens: foreignTokens, owners: [oneTokens, strategiesList].flat(), blacklistedTokens }) + const uniV3NFTHolders = [...strategiesList, ...oneTokenOwners] + + await sumTokens2({ api, owners: uniV3NFTHolders, resolveUniV3: true, blacklistedTokens, }) + } + + for (const { factory, fromBlock, topic = defaultTopic, eventAbi = defaultEvent } of vaultConfigs) { + const logs = await getLogs({ + api, + target: factory, + topics: [topic], + eventAbi: eventAbi, + onlyArgs: true, + fromBlock, + }) + const vaultBalances = await api.multiCall({ abi: abi.getTotalAmounts, calls: logs.map(l => l.ichiVault) }) + vaultBalances.forEach((b, i) => { + const { tokenA, tokenB } = logs[i] + if (!blacklistedTokens.includes(tokenA.toLowerCase())) api.add(tokenA, b.total0) + if (!blacklistedTokens.includes(tokenB.toLowerCase())) api.add(tokenB, b.total1) + }) + } + + return api.getBalances() + } } -} // node test.js projects/ichifarm/index.js \ No newline at end of file +}) + +module.exports.ethereum.pool2 = async (_, block) => { + const toa = [ + ['0x9cd028b1287803250b1e226f0180eb725428d069', farmContract], + ['0xd07d430db20d2d7e0c4c11759256adbcc355b20c', farmContract], + ] + poolWithTokens.forEach(([o, tokens]) => tokens.forEach(t => toa.push([t, o]))) + return sumTokens2({ tokensAndOwners: toa, block, }) +} + +module.exports.ethereum.staking = stakings([xIchi, ichiLending], ichiLegacy) From 1bfb7b5c798c7a491694882a7b390ed41385c315 Mon Sep 17 00:00:00 2001 From: Deepcryptodive <61325205+Deepcryptodive@users.noreply.github.com> Date: Tue, 4 Jul 2023 19:05:56 +0100 Subject: [PATCH 0211/1974] Add support for GoodGhosting smart contracts v2.0.5 (#6718) Recently, HaloFi (prev. GoodGhosting) added support for Curve finance. This bumped up the smart contract version to v2.0.5. --- projects/good-ghosting/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/good-ghosting/index.js b/projects/good-ghosting/index.js index 8e13b050dc7..0e333c145df 100644 --- a/projects/good-ghosting/index.js +++ b/projects/good-ghosting/index.js @@ -11,7 +11,7 @@ const chainIdMap = { }; const contractVersions = { - v200: ["2.0.0", "2.0.1", "2.0.2", "2.0.3", "2.0.4"], + v200: ["2.0.0", "2.0.1", "2.0.2", "2.0.3", "2.0.4", "2.0.5"], v001: "0.0.1", v002: "0.0.2", v003: "0.0.3", From 993bb1ed648e45f371164126563a89de4bcbf7d2 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Wed, 5 Jul 2023 00:32:02 +0100 Subject: [PATCH 0212/1974] fix gearbox --- projects/gearbox/abi.json | 7 +++ projects/gearbox/events.js | 121 +++++++++++++++++++++++++------------ projects/gearbox/index.js | 8 +-- 3 files changed, 91 insertions(+), 45 deletions(-) diff --git a/projects/gearbox/abi.json b/projects/gearbox/abi.json index a3f550f105d..56d8f3d468c 100644 --- a/projects/gearbox/abi.json +++ b/projects/gearbox/abi.json @@ -22,5 +22,12 @@ "event LiquidateCreditAccount(address indexed borrower, address indexed liquidator, address indexed to, uint256 remainingFunds)", "event TransferAccount(address indexed oldOwner, address indexed newOwner)", "event LiquidateExpiredCreditAccount(address indexed borrower, address indexed liquidator, address indexed to, uint256 remainingFunds)" + ], + "creditManagerV2": [ + "function creditFacade() view returns (address addr)", + "event NewConfigurator(address indexed newConfigurator)" + ], + "creditConfiguratorV2": [ + "event CreditFacadeUpgraded(address indexed newCreditFacade)" ] } \ No newline at end of file diff --git a/projects/gearbox/events.js b/projects/gearbox/events.js index 9697a7519a7..04c7df166cc 100644 --- a/projects/gearbox/events.js +++ b/projects/gearbox/events.js @@ -1,13 +1,52 @@ -const { api, api2, } = require("@defillama/sdk"); +const { api, api2 } = require("@defillama/sdk"); const { providers } = require("@defillama/sdk/build/general"); const { Contract, BigNumber } = require("ethers"); const abi = require("./abi.json"); -const getV2CAs = async (creditFacade, block) => { +const getV2CAs = async (creditManager, block) => { const eventsByDate = []; const accounts = new Set(); + const cm = new Contract( + creditManager, + abi["creditManagerV2"], + providers["ethereum"] + ); + const creditFacade = await cm.creditFacade(); + + const ccAddrs = ( + await cm.queryFilter( + { + address: creditManager, + topics: [cm.interface.getEventTopic("NewConfigurator")], + }, + undefined + ) + ).map((e) => e.args.newConfigurator); + + const cfAddrs = []; + + for (let cca of ccAddrs) { + const cc = new Contract( + cca, + abi["creditConfiguratorV2"], + providers["ethereum"] + ); + + const cfs = ( + await cc.queryFilter( + { + address: cca, + topics: [cc.interface.getEventTopic("CreditFacadeUpgraded")], + }, + undefined + ) + ).map((e) => e.args.newCreditFacade); + + cfAddrs.push(...cfs); + } + const addToEvents = (e, address, operation) => { eventsByDate.push({ time: e.blockNumber * 100000 + e.logIndex, @@ -18,38 +57,38 @@ const getV2CAs = async (creditFacade, block) => { }); }; - const cf = new Contract( - creditFacade, - abi["filtersV2"], - providers["ethereum"] - ); - - const topics = { - OpenCreditAccount: cf.interface.getEventTopic("OpenCreditAccount"), - CloseCreditAccount: cf.interface.getEventTopic("CloseCreditAccount"), - LiquidateCreditAccount: cf.interface.getEventTopic( - "LiquidateCreditAccount" - ), - LiquidateExpiredCreditAccount: cf.interface.getEventTopic( - "LiquidateExpiredCreditAccount" - ), - TransferAccount: cf.interface.getEventTopic("TransferAccount"), - }; - - const logs = ( - await cf.queryFilter( - { - address: creditFacade, - topics: [Object.values(topics)], - }, - undefined, - block - ) - ).map((log) => ({ - ...cf.interface.parseLog(log), - blockNumber: log.blockNumber, - logIndex: log.logIndex, - })); + const logs = []; + + for (let cfAddr of cfAddrs) { + const cf = new Contract(cfAddr, abi["filtersV2"], providers["ethereum"]); + + const topics = { + OpenCreditAccount: cf.interface.getEventTopic("OpenCreditAccount"), + CloseCreditAccount: cf.interface.getEventTopic("CloseCreditAccount"), + LiquidateCreditAccount: cf.interface.getEventTopic( + "LiquidateCreditAccount" + ), + LiquidateExpiredCreditAccount: cf.interface.getEventTopic( + "LiquidateExpiredCreditAccount" + ), + TransferAccount: cf.interface.getEventTopic("TransferAccount"), + }; + const l = ( + await cf.queryFilter( + { + address: cfAddr, + topics: [Object.values(topics)], + }, + undefined + ) + ).map((log) => ({ + ...cf.interface.parseLog(log), + blockNumber: log.blockNumber, + logIndex: log.logIndex, + })); + + logs.push(...l); + } logs.forEach((log) => { switch (log.name) { @@ -99,9 +138,9 @@ const getV2CAs = async (creditFacade, block) => { return totalValue[0] ? totalValue - .map((t) => t.output) - .reduce((a, c) => a.add(BigNumber.from(c)), BigNumber.from("0")) - .toString() + .map((t) => t.output) + .reduce((a, c) => a.add(BigNumber.from(c)), BigNumber.from("0")) + .toString() : "0"; }; @@ -183,10 +222,12 @@ const getV1CAs = async (creditManager, block) => { ).args.creditAccount ); - const totalValue= await api2.abi.multiCall({ + const totalValue = await api2.abi.multiCall({ abi: abi["calcTotalValue"], target: cf, - calls: openCAs.filter(i => i !== '0xaBBd655b3791175113c1f1146D3B369494A2b815'), // filtered out address throwing error + calls: openCAs.filter( + (i) => i !== "0xaBBd655b3791175113c1f1146D3B369494A2b815" + ), // filtered out address throwing error block, }); @@ -195,4 +236,4 @@ const getV1CAs = async (creditManager, block) => { .toString(); }; -module.exports = { getV1CAs, getV2CAs }; +module.exports = { getV1CAs, getV2CAs }; \ No newline at end of file diff --git a/projects/gearbox/index.js b/projects/gearbox/index.js index 0030759a16c..11e8fd95bb5 100644 --- a/projects/gearbox/index.js +++ b/projects/gearbox/index.js @@ -68,7 +68,7 @@ const getV2TVL = async (block) => { // Get all CA Balances const caValues = await Promise.all( - creditManagers.map((cm) => getV2CAs(cm.creditFacade, block)) + creditManagers.map((cm) => getV2CAs(cm.addr, block)) ); return creditManagers.map((cm, i) => ({ @@ -122,12 +122,10 @@ const tvl = async (timestamp, block) => { }; module.exports = { - hallmarks:[ - [1666569600, "LM begins"], - ], + hallmarks: [[1666569600, "LM begins"]], ethereum: { tvl, }, methodology: `Retrieves the tokens in each Gearbox pool (WETH/DAI/WBTC/USDC/wstETH) & value of all Credit Accounts (V1 & V2) denominated in the underlying token.`, misrepresentedTokens: true, -}; +}; \ No newline at end of file From 742e0eefdeed1c8057d6d8aa5f6da0ed56ee49b6 Mon Sep 17 00:00:00 2001 From: 4TT1L4 <2914096+4TT1L4@users.noreply.github.com> Date: Wed, 5 Jul 2023 09:27:50 +0200 Subject: [PATCH 0213/1974] Updated the Genius Yield Adapter: Added GENSX Staking (#6723) --- projects/genius-yield/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/genius-yield/index.js b/projects/genius-yield/index.js index 900c5167e55..acf99924304 100644 --- a/projects/genius-yield/index.js +++ b/projects/genius-yield/index.js @@ -4,13 +4,14 @@ const gens = 'dda5fdb1002f7389b33e036b6afee82a8189becb6cba852e8b79b4fb0014df1047 const nmkr = '5dac8536653edc12f6f5e1045d8164b9f59998d3bdc300fc928434894e4d4b52' const ntx = 'edfd7a1d77bcb8b884c474bdc92a16002d1fb720e454fa6e993444794e5458' const emp = '6c8642400e8437f737eb86df0fc8a8437c760f48592b1ba8f5767e81456d706f7761' +const gensx = 'fbae99b8679369079a7f6f0da14a2cf1c2d6bfd3afdf3a96a64ab67a0014df1047454e5358' const owner = 'addr1w8r99sv75y9tqfdzkzyqdqhedgnef47w4x7y0qnyts8pznq87e4wh' module.exports = { timetravel: false, cardano: { - staking: sumTokensExport({ owner, tokens: [gens, nmkr, ntx, emp]}), + staking: sumTokensExport({ owner, tokens: [gens, nmkr, ntx, emp, gensx]}), tvl: () => ({}) } }; From 55000c8e08ed3dff8d52326c317512082a73f39b Mon Sep 17 00:00:00 2001 From: happywomwom-wombat <129473631+happywomwom-wombat@users.noreply.github.com> Date: Wed, 5 Jul 2023 15:32:44 +0800 Subject: [PATCH 0214/1974] add snbnb address (#6722) --- projects/wombat-exchange/config.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/wombat-exchange/config.js b/projects/wombat-exchange/config.js index 697b6cdeb96..12b5007dfa2 100644 --- a/projects/wombat-exchange/config.js +++ b/projects/wombat-exchange/config.js @@ -24,6 +24,7 @@ module.exports = { smartHAY: "0xa61dccC6c6E34C8Fbf14527386cA35589e9b8C27", wBETH: "0x8b892b6Ea1d0e5B29b719d6Bd6eb9354f1cDE060", ankrETH: "0x1b507b97c89eDE3E40d1b2Ed92972197c6276D35", + SnBNB: "0xF1e604e9A31c3b575f91CF008445B7ce06BF3fef", }, }, arbitrum: { From 58079097dd4b4c30b85d2ebccb3d5a5858b86f80 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 5 Jul 2023 11:08:48 +0200 Subject: [PATCH 0215/1974] track surge --- projects/surge/index.js | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 projects/surge/index.js diff --git a/projects/surge/index.js b/projects/surge/index.js new file mode 100644 index 00000000000..4a4da24f20c --- /dev/null +++ b/projects/surge/index.js @@ -0,0 +1,31 @@ +const { getLogs } = require('../helper/cache/getLogs') +const { sumTokens2 } = require('../helper/unwrapLPs') + +const config = { + arbitrum: { factory: '0xDaD057C49d957c98D20285935B0a87f23907e22C', fromBlock: 107875529, } +} + +Object.keys(config).forEach(chain => { + const { factory, fromBlock, } = config[chain] + const _getLogs = (api) => getLogs({ + api, + target: factory, + topics: ['0xfd4f84c703fbc9ed47d26b2769a6133a02ea690b88125c716c7321699d0115fa'], + eventAbi: 'event PoolDeployed(uint256 poolId, address pool, address indexed collateralToken, address indexed loanToken, uint256 indexed maxCollateralRatioMantissa, uint256 surgeMantissa, uint256 collateralRatioFallDuration, uint256 collateralRatioRecoveryDuration, uint256 minRateMantissa, uint256 surgeRateMantissa, uint256 maxRateMantissa)', + onlyArgs: true, + fromBlock, + }) + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const logs = await _getLogs(api) + const ownerTokens = logs.map(l => [[l.collateralToken, l.loanToken], l.pool]) + return sumTokens2({ api, ownerTokens, }) + }, + borrowed: async (_, _b, _cb, { api, }) => { + const logs = await _getLogs(api) + const borrowed = await api.multiCall({ abi: 'uint256:lastTotalDebt', calls: logs.map(i => i.pool) }) + api.addTokens(logs.map(i => i.loanToken), borrowed) + return api.getBalances() + }, + } +}) \ No newline at end of file From 3eb1448f8926139bb5e6ec79eac6c3d00630ff5f Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 5 Jul 2023 12:59:49 +0200 Subject: [PATCH 0216/1974] fix filecoin issue --- projects/helper/coreAssets.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index 44468cc7680..107a52eb0f3 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -1312,6 +1312,10 @@ "chihuahua": { "HUAHUA": "uhuahua" }, + "filecoin": { + "WFIL": "0xce5805cf6c84f71d2897f632e0aa60d2430ccd2a", + "USDT": "0x422849B355039bC58F2780cc4854919fC9cfaF94" + }, "pulse": { "WPLS": "0xa1077a294dde1b09bb078844df40758a5d0f9a27", "ETH": "0x02dcdd04e3f455d838cd1249292c58f3b79e3c3c", From 9dac74df4d57935ece24b9cb7535fe4dbaa8ae3c Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 5 Jul 2023 13:05:21 +0200 Subject: [PATCH 0217/1974] fixed bifrost staking --- projects/bifrost-staking/index.js | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/projects/bifrost-staking/index.js b/projects/bifrost-staking/index.js index b6e5b35c858..70e47cfb16f 100644 --- a/projects/bifrost-staking/index.js +++ b/projects/bifrost-staking/index.js @@ -8,14 +8,14 @@ module.exports = { tvl: async () => { const { bifrost } = getExports("bifrost-staking", ['bifrost']) const tvl = await bifrost.tvl() - return { 'bifrost-native-coin': tvl['bifrost-native-coin'], polkadot: tvl.polkadot, kusama: tvl.kusama } + return { 'bifrost-native-coin': tvl['bifrost-native-coin'], polkadot: tvl.polkadot, kusama: tvl.kusama, moonbeam: tvl.moonbeam, moonriver: tvl.moonriver, } } }, ethereum: { tvl: async (_, _1, _2, { api }) => { const vETH = await api.call({ target: '0x4bc3263eb5bb2ef7ad9ab6fb68be80e43b43801f', abi: 'uint256:totalSupply' }) const contract_veth1 = await api.call({ target: '0xc3d088842dcf02c13699f936bb83dfbbc6f721ab', abi: 'uint256:totalSupply' }) - const contract_veth1_null_address_balance = await api.call({ target: '0xc3d088842dcf02c13699f936bb83dfbbc6f721ab', abi: 'erc20:balanceOf',params:'0x000000000000000000000000000000000000dEaD' }) + const contract_veth1_null_address_balance = await api.call({ target: '0xc3d088842dcf02c13699f936bb83dfbbc6f721ab', abi: 'erc20:balanceOf', params: '0x000000000000000000000000000000000000dEaD' }) return { [nullAddress]: new BigNumber(vETH).plus(contract_veth1).minus(contract_veth1_null_address_balance).toString(), @@ -29,18 +29,4 @@ module.exports = { return { filecoin } } }, - moonbeam: { - tvl: async () => { - const { bifrost } = getExports("bifrost-staking", ['bifrost']) - const { moonbeam } = await bifrost.tvl() - return { moonbeam } - } - }, - moonriver: { - tvl: async () => { - const { bifrost } = getExports("bifrost-staking", ['bifrost']) - const { moonriver } = await bifrost.tvl() - return { moonriver } - } - } } From fd74af6dff2fb144c9fc0407bcdd7065b14cee01 Mon Sep 17 00:00:00 2001 From: define Date: Wed, 5 Jul 2023 12:44:27 +0100 Subject: [PATCH 0218/1974] Something --- projects/entities/a16z-cold.js | 14 +++++++++ projects/entities/akg-ventures.js | 12 ++++++++ projects/entities/animoca-brands.js | 12 ++++++++ projects/entities/arca.js | 22 ++++++++++++++ projects/entities/axia8-venture.js | 17 +++++++++++ projects/entities/binance-labs.js | 12 ++++++++ projects/entities/block-one.js | 12 ++++++++ projects/entities/blockchain-capital.js | 14 +++++++++ projects/entities/chain-capital.js | 22 ++++++++++++++ projects/entities/coin98-venture.js | 28 ++++++++++++++++++ projects/entities/defiance-capital.js | 32 ++++++++++++++++++++ projects/entities/delphi-digital.js | 22 ++++++++++++++ projects/entities/digital-finance-group.js | 22 ++++++++++++++ projects/entities/dragonfly-capital.js | 18 ++++++++++++ projects/entities/fbg-capital.js | 18 ++++++++++++ projects/entities/fenbushi-capital.js | 18 ++++++++++++ projects/entities/framework-ventures.js | 11 +++++++ projects/entities/genesis-trading.js | 25 ++++++++++++++++ projects/entities/id-capital.js | 34 ++++++++++++++++++++++ projects/entities/jump-capital.js | 25 ++++++++++++++++ projects/entities/mechanism-capital.js | 13 +++++++++ projects/entities/multi-chain-capital.js | 31 ++++++++++++++++++++ projects/entities/ngc-ventures.js | 31 ++++++++++++++++++++ projects/entities/pantera-capital.js | 12 ++++++++ projects/entities/paradigm-capital.js | 15 ++++++++++ projects/entities/plutus-vc.js | 16 ++++++++++ projects/entities/polychain-capital.js | 13 +++++++++ projects/entities/silkroad-fbifunds.js | 14 +++++++++ projects/helper/cex.js | 11 ++++++- 29 files changed, 545 insertions(+), 1 deletion(-) create mode 100644 projects/entities/a16z-cold.js create mode 100644 projects/entities/akg-ventures.js create mode 100644 projects/entities/animoca-brands.js create mode 100644 projects/entities/arca.js create mode 100644 projects/entities/axia8-venture.js create mode 100644 projects/entities/binance-labs.js create mode 100644 projects/entities/block-one.js create mode 100644 projects/entities/blockchain-capital.js create mode 100644 projects/entities/chain-capital.js create mode 100644 projects/entities/coin98-venture.js create mode 100644 projects/entities/defiance-capital.js create mode 100644 projects/entities/delphi-digital.js create mode 100644 projects/entities/digital-finance-group.js create mode 100644 projects/entities/dragonfly-capital.js create mode 100644 projects/entities/fbg-capital.js create mode 100644 projects/entities/fenbushi-capital.js create mode 100644 projects/entities/framework-ventures.js create mode 100644 projects/entities/genesis-trading.js create mode 100644 projects/entities/id-capital.js create mode 100644 projects/entities/jump-capital.js create mode 100644 projects/entities/mechanism-capital.js create mode 100644 projects/entities/multi-chain-capital.js create mode 100644 projects/entities/ngc-ventures.js create mode 100644 projects/entities/pantera-capital.js create mode 100644 projects/entities/paradigm-capital.js create mode 100644 projects/entities/plutus-vc.js create mode 100644 projects/entities/polychain-capital.js create mode 100644 projects/entities/silkroad-fbifunds.js diff --git a/projects/entities/a16z-cold.js b/projects/entities/a16z-cold.js new file mode 100644 index 00000000000..58642a2fb01 --- /dev/null +++ b/projects/entities/a16z-cold.js @@ -0,0 +1,14 @@ +const { cexExports } = require('../helper/cex') + +const config = { + ethereum: { + owners: [ + "0x7D325A9C8F10758188641FE91cFD902499edC782", + "0x2B1Ad6184a6B0fac06bD225ed37C2AbC04415fF4", + "0x05E793cE0C6027323Ac150F6d45C2344d28B6019", //14k MKR staking + "0x0f50D31B3eaefd65236dd3736B863CfFa4c63C4E" + ], + }, +} + +module.exports = cexExports(config) \ No newline at end of file diff --git a/projects/entities/akg-ventures.js b/projects/entities/akg-ventures.js new file mode 100644 index 00000000000..9bee71c5249 --- /dev/null +++ b/projects/entities/akg-ventures.js @@ -0,0 +1,12 @@ +const { cexExports } = require('../helper/cex') + +const config = { + ethereum: { + owners: [ + "0x19a504b1096aE59624105E737B22F5943B1a4846", + + ], + }, +} + +module.exports = cexExports(config) \ No newline at end of file diff --git a/projects/entities/animoca-brands.js b/projects/entities/animoca-brands.js new file mode 100644 index 00000000000..ffce59fb8c4 --- /dev/null +++ b/projects/entities/animoca-brands.js @@ -0,0 +1,12 @@ +const { cexExports } = require('../helper/cex') + +const config = { + ethereum: { + owners: [ + "0xd6AF301A8770659c1Dc880843db4d1aaA01048b4", + "0xE929c67Db94f5b1541FB241eB3E5CbC6468c37e6", //binance deposited account + ], + }, +} + +module.exports = cexExports(config) \ No newline at end of file diff --git a/projects/entities/arca.js b/projects/entities/arca.js new file mode 100644 index 00000000000..3a88c096408 --- /dev/null +++ b/projects/entities/arca.js @@ -0,0 +1,22 @@ +const { cexExports } = require('../helper/cex') + +const config = { + ethereum: { + owners: [ + "0x23A5eFe19Aa966388E132077d733672cf5798C03", //1.6m wANT staking + "0xa66f8Db3B8F1e4c79e52ac89Fec052811F4dbd19", // 20,189.10 GMX staked + "0xe05A884D4653289916D54Ce6aE0967707c519879" + ], + }, + polygon: { + owners: [ + "0xa66f8Db3B8F1e4c79e52ac89Fec052811F4dbd19", + ], + }, + arbitrum: { + owners: [ + "0xa66f8Db3B8F1e4c79e52ac89Fec052811F4dbd19", + ], + }, +} +module.exports = cexExports(config) \ No newline at end of file diff --git a/projects/entities/axia8-venture.js b/projects/entities/axia8-venture.js new file mode 100644 index 00000000000..5bd34c5bece --- /dev/null +++ b/projects/entities/axia8-venture.js @@ -0,0 +1,17 @@ +const { cexExports } = require('../helper/cex') + +const config = { + ethereum: { + owners: [ + "0x717821AAe2A45C5c5c5bcDa7A8662cD3df2385E5", + + ], + }, + bsc: { + owners: [ + "0x717821AAe2A45C5c5c5bcDa7A8662cD3df2385E5", + ], + }, +} + +module.exports = cexExports(config) \ No newline at end of file diff --git a/projects/entities/binance-labs.js b/projects/entities/binance-labs.js new file mode 100644 index 00000000000..24f8d7b6738 --- /dev/null +++ b/projects/entities/binance-labs.js @@ -0,0 +1,12 @@ +const { cexExports } = require('../helper/cex') + +const config = { + ethereum: { + owners: [ + "0xfad531c62757cf18391E48Ee0959ab9ba106deCc", + + ], + }, +} + +module.exports = cexExports(config) \ No newline at end of file diff --git a/projects/entities/block-one.js b/projects/entities/block-one.js new file mode 100644 index 00000000000..f21dc32d1f2 --- /dev/null +++ b/projects/entities/block-one.js @@ -0,0 +1,12 @@ +const { cexExports } = require('../helper/cex') + +const config = { + ethereum: { + owners: [ + "0x24eaeCf1784c3bf9b01E011976E3D7ba917e2219", //binance deposited account + "0x2997A7a817e4b7ff60082b948a49fDAEfc042E4e" + ], + }, +} + +module.exports = cexExports(config) \ No newline at end of file diff --git a/projects/entities/blockchain-capital.js b/projects/entities/blockchain-capital.js new file mode 100644 index 00000000000..b08e4bf1beb --- /dev/null +++ b/projects/entities/blockchain-capital.js @@ -0,0 +1,14 @@ +const { cexExports } = require('../helper/cex') + +const config = { + ethereum: { + owners: [ + "0x598Dbe6738E0AcA4eAbc22feD2Ac737dbd13Fb8F", + "0x3744DA57184575064838BBc87A0FC791F5E39eA2", + "0x702caCafA54B88e9c54449563Fb2e496e85c78b7" + + ], + }, +} + +module.exports = cexExports(config) \ No newline at end of file diff --git a/projects/entities/chain-capital.js b/projects/entities/chain-capital.js new file mode 100644 index 00000000000..b4a544351ce --- /dev/null +++ b/projects/entities/chain-capital.js @@ -0,0 +1,22 @@ +const { cexExports } = require('../helper/cex') + +const config = { + ethereum: { + owners: [ + "0x4cF9faf73714b65B98557c822B6B514dfDa0E339", + "0x2489146cf124A6900bA46c6F76f18eC76d5068b9" + ], + }, + polygon: { + owners: [ + "0x4cF9faf73714b65B98557c822B6B514dfDa0E339", + ], + }, + bsc: { + owners: [ + "0x2489146cf124A6900bA46c6F76f18eC76d5068b9" + ], + }, +} + +module.exports = cexExports(config) \ No newline at end of file diff --git a/projects/entities/coin98-venture.js b/projects/entities/coin98-venture.js new file mode 100644 index 00000000000..c09aff9559b --- /dev/null +++ b/projects/entities/coin98-venture.js @@ -0,0 +1,28 @@ +const { cexExports } = require('../helper/cex') + +const config = { + ethereum: { + owners: [ + "0xFcbf806792f06d9c78E50B3737E1a22cfC36a942", + "0x9413Da1bC1797179e5D019A9420cEEc44680A4bf" + ], + }, + bsc: { + owners: [ + "0x9413Da1bC1797179e5D019A9420cEEc44680A4bf", + '0xFcbf806792f06d9c78E50B3737E1a22cfC36a942' + ], + }, + arbitrum: { + owners: [ + "0x9413Da1bC1797179e5D019A9420cEEc44680A4bf", + ], + }, + polygon: { + owners: [ + "0x9413Da1bC1797179e5D019A9420cEEc44680A4bf", + ], + }, +} + +module.exports = cexExports(config) \ No newline at end of file diff --git a/projects/entities/defiance-capital.js b/projects/entities/defiance-capital.js new file mode 100644 index 00000000000..92043e314d7 --- /dev/null +++ b/projects/entities/defiance-capital.js @@ -0,0 +1,32 @@ +const { cexExports } = require('../helper/cex') + +const config = { + ethereum: { + owners: [ + "0x7E4B4DC22111B84594d9b7707A8DCFFd793D477A", + "0xE97eb050Fa3e677e79E4ebEe7EF9c9c7D026377D", + "0x1E138759baED8a1139376a475Bf7f08053ACA016", + "0xdD709cAE362972cb3B92DCeaD77127f7b8D58202", + "0x9B5ea8C719e29A5bd0959FaF79C9E5c8206d0499" + + ], + }, + arbitrum: { + owners: [ + "0x7E4B4DC22111B84594d9b7707A8DCFFd793D477A", + ], + }, + avax: { + owners: [ + "0x7E4B4DC22111B84594d9b7707A8DCFFd793D477A", + ], + }, + bsc: { + owners: [ + "0x7E4B4DC22111B84594d9b7707A8DCFFd793D477A", + "0xdD709cAE362972cb3B92DCeaD77127f7b8D58202" + ], + }, +} + +module.exports = cexExports(config) \ No newline at end of file diff --git a/projects/entities/delphi-digital.js b/projects/entities/delphi-digital.js new file mode 100644 index 00000000000..3e2938aa339 --- /dev/null +++ b/projects/entities/delphi-digital.js @@ -0,0 +1,22 @@ +const { cexExports } = require('../helper/cex') + +const config = { + ethereum: { + owners: [ + "0x5Ca29DC4845b8cB19CCF335337b774749C7Bb617", + "0x4181805C36ad6B1b2aDb43D0b0615d676ACBF9b4", + ], + }, + bsc: { + owners: [ + "0x4181805C36ad6B1b2aDb43D0b0615d676ACBF9b4" + ], + }, + avax: { + owners: [ + "0x4181805C36ad6B1b2aDb43D0b0615d676ACBF9b4" + ], + }, +} + +module.exports = cexExports(config) \ No newline at end of file diff --git a/projects/entities/digital-finance-group.js b/projects/entities/digital-finance-group.js new file mode 100644 index 00000000000..88a171642b0 --- /dev/null +++ b/projects/entities/digital-finance-group.js @@ -0,0 +1,22 @@ +const { cexExports } = require('../helper/cex') + +const config = { + ethereum: { + owners: [ + "0xEaf3B28A87D498530cDC7f0700E70502CF896D3f", + "0x90FFFbbdf770eFB530d950C24bf56a292CDab3F7", + "0xC71BaF5d8667FfF515246811a4f61350D26A191F", + "0x36822AD3f4dF3E49EB042AFE74e43551d3c3Adba" + ], + }, + bsc: { + owners: [ + "0xEaf3B28A87D498530cDC7f0700E70502CF896D3f", + "0x2C20E739552cd0BEAF523930BAAD7754C426C962", + "0x36822AD3f4dF3E49EB042AFE74e43551d3c3Adba", + "0xC71BaF5d8667FfF515246811a4f61350D26A191F" + ], + }, +} + +module.exports = cexExports(config) \ No newline at end of file diff --git a/projects/entities/dragonfly-capital.js b/projects/entities/dragonfly-capital.js new file mode 100644 index 00000000000..ab3e8939e83 --- /dev/null +++ b/projects/entities/dragonfly-capital.js @@ -0,0 +1,18 @@ +const { cexExports } = require('../helper/cex') + +const config = { + ethereum: { + owners: [ + "0xB953E202C5E51C7C010E80402a63C02f37F14059", //1.9m$ in cega protocol + // "0xe4A2410e158a790463ba1b2c98693061f5A3A9EF", old wallet not sure if related + // "0x30BDC51A48272F96480921ea280448695D2B5d6F", old wallet not sure if related + "0x221E3c87A034E79Dd16d64762a1B20FB71594F46", + "0xF410dC5Ff862BfD36111aD492123280dDB23D495", + // "0xEC4b615C8aBfB491cD4227b165A1e389DB5e8286", old wallet not sure if related + "0xB93994e2efCAed3E88C538F68eC6A2587C3E2ebF", + "0x002A5dc50bbB8d5808e418Aeeb9F060a2Ca17346" + ], + }, +} + +module.exports = cexExports(config) \ No newline at end of file diff --git a/projects/entities/fbg-capital.js b/projects/entities/fbg-capital.js new file mode 100644 index 00000000000..bbeb547dfa0 --- /dev/null +++ b/projects/entities/fbg-capital.js @@ -0,0 +1,18 @@ +const { cexExports } = require('../helper/cex') + +const config = { + ethereum: { + owners: [ + "0xe25397734a184053cF382E5C4e32cA7eF8335F31", + "0x7c04A698855d1ECF9610636a1d7AFf8E03331fa5", + "0xb079F40dd951d842f688275100524c09bEf9b4E2" + ], + }, + avax: { + owners: [ + "0xe25397734a184053cF382E5C4e32cA7eF8335F31" + ], + }, +} + +module.exports = cexExports(config) \ No newline at end of file diff --git a/projects/entities/fenbushi-capital.js b/projects/entities/fenbushi-capital.js new file mode 100644 index 00000000000..cf891120209 --- /dev/null +++ b/projects/entities/fenbushi-capital.js @@ -0,0 +1,18 @@ +const { cexExports } = require('../helper/cex') + +const config = { + ethereum: { + owners: [ + "0xCef1B4Bf8F05F623A2A688b56d9dA679D302EBa7", + "0x5963efF631bf3d28b68388909e2404AA6dB1e7a8" // binance deposited account + + ], + }, + arbitrum: { + owners: [ + "0xCef1B4Bf8F05F623A2A688b56d9dA679D302EBa7" + ], + }, +} + +module.exports = cexExports(config) \ No newline at end of file diff --git a/projects/entities/framework-ventures.js b/projects/entities/framework-ventures.js new file mode 100644 index 00000000000..7f966027618 --- /dev/null +++ b/projects/entities/framework-ventures.js @@ -0,0 +1,11 @@ +const { cexExports } = require('../helper/cex') + +const config = { + ethereum: { + owners: [ + "0x681148725731F213b0187A3CBeF215C291D85a3E", + ], + }, +} + +module.exports = cexExports(config) \ No newline at end of file diff --git a/projects/entities/genesis-trading.js b/projects/entities/genesis-trading.js new file mode 100644 index 00000000000..b81ca876135 --- /dev/null +++ b/projects/entities/genesis-trading.js @@ -0,0 +1,25 @@ +const { cexExports } = require('../helper/cex') + +const config = { + ethereum: { + owners: [ + "0x35b517039f75df2469Af8A329b75DfE215b33790", + "0x16ADa39D140699D9a1934F05DdCf78612f342b3e", + "0x7a59384e2bD2D75fb3e83c486b61921fa517EB27", + "0x2095feFc0cf268E58087A43DBf9733532eD51B25", + "0xF65D8e83396e66340743D852db8eb116BeC0027a", + "0xBF4731191af7029f7D669D3e337a0063D1E008a3", + "0x6d21266DfcF5541BEE9F67c4837AAa72b3BF9303", + "0xd628f7c481c7Dd87F674870BEc5D7A311Fb1D9A2", + "0xaF641E29C4730530d9428A37C5934B00a73624A9", + "0x7DC47f4C227e22DA6C81fCB4c253d1DC18BeC4A3" + ], + }, + avax: { + owners: [ + "0xd628f7c481c7dd87f674870bec5d7a311fb1d9a2", + ], + }, +} + +module.exports = cexExports(config) \ No newline at end of file diff --git a/projects/entities/id-capital.js b/projects/entities/id-capital.js new file mode 100644 index 00000000000..bf2e8dfb902 --- /dev/null +++ b/projects/entities/id-capital.js @@ -0,0 +1,34 @@ +const { cexExports } = require('../helper/cex') + +const config = { + ethereum: { + owners: [ + "0xC3ad72Bf4721fdF448c970f2F8E303c57588B73c", + "0xbFC94A95d4448C802E848C68fdD2FC0fEE4a876E" + ], + }, + polygon: { + owners: [ + "0xC3ad72Bf4721fdF448c970f2F8E303c57588B73c", + "0xbFC94A95d4448C802E848C68fdD2FC0fEE4a876E" + ], + }, + bsc: { + owners: [ + "0xC3ad72Bf4721fdF448c970f2F8E303c57588B73c", + "0xbFC94A95d4448C802E848C68fdD2FC0fEE4a876E" + ], + }, + avax: { + owners: [ + "0xC3ad72Bf4721fdF448c970f2F8E303c57588B73c", + ], + }, + arbitrum: { + owners: [ + "0xC3ad72Bf4721fdF448c970f2F8E303c57588B73c", + ], + }, +} + +module.exports = cexExports(config) \ No newline at end of file diff --git a/projects/entities/jump-capital.js b/projects/entities/jump-capital.js new file mode 100644 index 00000000000..bc480ed7afb --- /dev/null +++ b/projects/entities/jump-capital.js @@ -0,0 +1,25 @@ + +const { cexExports } = require('../helper/cex') + +const config = { + ethereum: { + owners: [ + "0xCB8EFB0c065071E4110932858A84365A80C8feF0" + + ], + }, + avax: { + owners: [ + "0xCB8EFB0c065071E4110932858A84365A80C8feF0" + + ], + }, + bsc: { + owners: [ + "0xCB8EFB0c065071E4110932858A84365A80C8feF0" + + ], + }, +} + +module.exports = cexExports(config) \ No newline at end of file diff --git a/projects/entities/mechanism-capital.js b/projects/entities/mechanism-capital.js new file mode 100644 index 00000000000..032dee922f4 --- /dev/null +++ b/projects/entities/mechanism-capital.js @@ -0,0 +1,13 @@ +const { cexExports } = require('../helper/cex') + +const config = { + ethereum: { + owners: [ + "0x6Af3D183d225725d975C5EaA08D442dd01Aad8fF", + "0x953a50bd2daAa852A4Bc3E58b3AcFb95EA4E82D2", + "0x1366Dcf0f0178802Be85d405BBeA8026EC0876c4" // binance deposited account + ], + }, +} + +module.exports = cexExports(config) \ No newline at end of file diff --git a/projects/entities/multi-chain-capital.js b/projects/entities/multi-chain-capital.js new file mode 100644 index 00000000000..f345ba0ea67 --- /dev/null +++ b/projects/entities/multi-chain-capital.js @@ -0,0 +1,31 @@ +const { cexExports } = require('../helper/cex') + +const config = { + ethereum: { + owners: [ + "0xfbf335f8224a102e22abe78d78cc52dc95e074fa" //2.6m$ on convex + ], + }, + bsc: { + owners: [ + "0xFBf335f8224a102e22abE78D78CC52dc95e074Fa", + ], + }, + fantom: { + owners: [ + "0xFBf335f8224a102e22abE78D78CC52dc95e074Fa", + ], + }, + optimism: { + owners: [ + "0xFBf335f8224a102e22abE78D78CC52dc95e074Fa", + ], + }, + avax: { + owners: [ + "0xFBf335f8224a102e22abE78D78CC52dc95e074Fa", + ], + }, +} + +module.exports = cexExports(config) \ No newline at end of file diff --git a/projects/entities/ngc-ventures.js b/projects/entities/ngc-ventures.js new file mode 100644 index 00000000000..22f732c1cde --- /dev/null +++ b/projects/entities/ngc-ventures.js @@ -0,0 +1,31 @@ +const { cexExports } = require('../helper/cex') + +const config = { + ethereum: { + owners: [ + "0x53F470A909d7CE7f35e62f4470fD440B1eD5D8CD", + ], + }, + arbitrum: { + owners: [ + "0x53F470A909d7CE7f35e62f4470fD440B1eD5D8CD", + ], + }, + bsc: { + owners: [ + "0x53F470A909d7CE7f35e62f4470fD440B1eD5D8CD", + ], + }, + polygon: { + owners: [ + "0x53F470A909d7CE7f35e62f4470fD440B1eD5D8CD", + ], + }, + avax: { + owners: [ + "0x53F470A909d7CE7f35e62f4470fD440B1eD5D8CD", + ], + }, +} + +module.exports = cexExports(config) \ No newline at end of file diff --git a/projects/entities/pantera-capital.js b/projects/entities/pantera-capital.js new file mode 100644 index 00000000000..11a1f6c5146 --- /dev/null +++ b/projects/entities/pantera-capital.js @@ -0,0 +1,12 @@ +const { cexExports } = require('../helper/cex') + +const config = { + ethereum: { + owners: [ + "0x12ca45FEd7998ba0E56f52D678823A508BA9A99E", + "0x5789C571552b4820BfA64eFB6F0CaD80fD2A9Bca" + ], + }, +} + +module.exports = cexExports(config) \ No newline at end of file diff --git a/projects/entities/paradigm-capital.js b/projects/entities/paradigm-capital.js new file mode 100644 index 00000000000..d70a67f182f --- /dev/null +++ b/projects/entities/paradigm-capital.js @@ -0,0 +1,15 @@ +const { cexExports } = require('../helper/cex') + +const config = { + ethereum: { + owners: [ + "0x11577a8a5baf1e25b9a2d89f39670f447d75c3cd", + "0xCA8d6F69D8f32516a109Df68B623452cc9f5E64d", + "0x917B3ACa2142Dd136fa106229990EA4D02763A83", + "0x09F82Ccd6baE2AeBe46bA7dd2cf08d87355ac430", + '0x820fb25352BB0c5E03E07AFc1d86252fFD2F0A18', //LIDO TOKENS + ], + }, +} + +module.exports = cexExports(config) \ No newline at end of file diff --git a/projects/entities/plutus-vc.js b/projects/entities/plutus-vc.js new file mode 100644 index 00000000000..b14fd8ea902 --- /dev/null +++ b/projects/entities/plutus-vc.js @@ -0,0 +1,16 @@ +const { cexExports } = require('../helper/cex') + +const config = { + ethereum: { + owners: [ + "0x3105889390F894F8ee1d3f8f75E2c4dde57735bA" + ], + }, + bsc: { + owners: [ + "0x3105889390F894F8ee1d3f8f75E2c4dde57735bA" + ], + }, +} + +module.exports = cexExports(config) \ No newline at end of file diff --git a/projects/entities/polychain-capital.js b/projects/entities/polychain-capital.js new file mode 100644 index 00000000000..9e513bd9273 --- /dev/null +++ b/projects/entities/polychain-capital.js @@ -0,0 +1,13 @@ +const { cexExports } = require('../helper/cex') + +const config = { + ethereum: { + owners: [ + "0xBcd5000F5c522856E710c5d274bb672B2f2EefBf", + "0x53c286E0AbE87c9e6d4d95ebE62ceaFa4aFCE849" + ], + }, + +} + +module.exports = cexExports(config) \ No newline at end of file diff --git a/projects/entities/silkroad-fbifunds.js b/projects/entities/silkroad-fbifunds.js new file mode 100644 index 00000000000..3adb8f92247 --- /dev/null +++ b/projects/entities/silkroad-fbifunds.js @@ -0,0 +1,14 @@ +const { cexExports } = require('../helper/cex') + +const config = { + bitcoin: { + owners: [ + "bc1qa5wkgaew2dkv56kfvj49j0av5nml45x9ek9hz6", //https://www.reddit.com/r/CryptoCurrency/comments/li1fw7/btc_silkroad_stash_seized_nov_2020_by_the_feds/ + 'bc1qmxjefnuy06v345v6vhwpwt05dztztmx4g3y7wp', + 'bc1qf2yvj48mzkj7uf8lc2a9sa7w983qe256l5c8fs', + 'bc1qe7nk2nlnjewghgw4sgm0r89zkjzsurda7z4rdg' + ], + }, +} + +module.exports = cexExports(config) \ No newline at end of file diff --git a/projects/helper/cex.js b/projects/helper/cex.js index 7a4a5cd8e2c..acc56eec6cb 100644 --- a/projects/helper/cex.js +++ b/projects/helper/cex.js @@ -81,7 +81,15 @@ const defaultTokens = { '0x9d71CE49ab8A0E6D2a1e7BFB89374C9392FD6804',//nvir '0x5b649C07E7Ba0a1C529DEAabEd0b47699919B4a2',//sgt '0x4385328cc4d643ca98dfea734360c0f596c83449', - + '0xbc396689893d065f41bc2c6ecbee5e0085233447', //perp + '0xd7c49cee7e9188cca6ad8ff264c1da2e69d4cf3b', //NXM + '0xaaef88cea01475125522e117bfe45cf32044e238', // GF + '0x949d48eca67b17269629c7194f4b727d4ef9e5d6', // MC + '0xbb0e17ef65f82ab018d8edd776e8dd940327b28b', // AXS + '0x3432b6a60d23ca0dfca7761b7ab56459d9c964d0', // FXS + '0xd417144312dbf50465b1c641d016962017ef6240',// cqt + '0xcb84d72e61e383767c4dfeb2d8ff7f4fb89abc6e', //VEGA + '0xcccd1ba9f7acd6117834e0d28f25645decb1736a', //ecox ], tron: [ nullAddress, @@ -99,6 +107,7 @@ const defaultTokens = { ADDRESSES.polygon.USDC, //USDC ADDRESSES.polygon.DAI, //DAI '0x2AB0e9e4eE70FFf1fB9D67031E44F6410170d00e', //xen + '0x0169ec1f8f639b32eec6d923e24c2a2ff45b9dd6', //ALGB ], algorand: [], solana: [ From f61ed535d72ba217772bda539c4ef3b008e4ab78 Mon Sep 17 00:00:00 2001 From: define Date: Wed, 5 Jul 2023 13:11:43 +0100 Subject: [PATCH 0219/1974] entities test --- test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test.js b/test.js index c2c793a6d88..05bf0f2ce6d 100644 --- a/test.js +++ b/test.js @@ -240,7 +240,7 @@ function checkExportKeys(module, filePath, chains) { ))) process.exit(0) - const blacklistedRootExportKeys = ['tvl', 'staking', 'pool2', 'borrowed', 'treasury', 'offers', 'vesting']; + const blacklistedRootExportKeys = ['tvl', 'staking', 'pool2', 'borrowed', 'treasury', 'offers', 'vesting', 'entities']; const rootexportKeys = Object.keys(module).filter(item => typeof module[item] !== 'object'); const unknownChains = chains.filter(chain => !chainList.includes(chain)); const blacklistedKeysFound = rootexportKeys.filter(key => blacklistedRootExportKeys.includes(key)); From 293ba151897373fc6198b419ad40e441a07ad3da Mon Sep 17 00:00:00 2001 From: define Date: Wed, 5 Jul 2023 13:23:56 +0100 Subject: [PATCH 0220/1974] remove last change --- test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test.js b/test.js index 05bf0f2ce6d..c2c793a6d88 100644 --- a/test.js +++ b/test.js @@ -240,7 +240,7 @@ function checkExportKeys(module, filePath, chains) { ))) process.exit(0) - const blacklistedRootExportKeys = ['tvl', 'staking', 'pool2', 'borrowed', 'treasury', 'offers', 'vesting', 'entities']; + const blacklistedRootExportKeys = ['tvl', 'staking', 'pool2', 'borrowed', 'treasury', 'offers', 'vesting']; const rootexportKeys = Object.keys(module).filter(item => typeof module[item] !== 'object'); const unknownChains = chains.filter(chain => !chainList.includes(chain)); const blacklistedKeysFound = rootexportKeys.filter(key => blacklistedRootExportKeys.includes(key)); From d167aaeb73b0c650b6dacd9263db0c24ec98d643 Mon Sep 17 00:00:00 2001 From: 0xngmi <80541789+0xngmi@users.noreply.github.com> Date: Wed, 5 Jul 2023 13:29:31 +0100 Subject: [PATCH 0221/1974] Update getFileList.js --- .github/workflows/getFileList.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/getFileList.js b/.github/workflows/getFileList.js index 57a58c82c44..8a3070869bc 100644 --- a/.github/workflows/getFileList.js +++ b/.github/workflows/getFileList.js @@ -4,7 +4,7 @@ const fileSet = new Set(); [...MODIFIED, ...ADDED].forEach(file => { const [root, dir] = file.split('/') - if (dir === 'treasury') fileSet.add(file) + if (dir === 'treasury' || dir === 'entities') fileSet.add(file) else if (root === 'projects' && dir !=='helper' && dir !== 'config') fileSet.add(root + '/' + dir) }) @@ -12,4 +12,4 @@ console.log(JSON.stringify([...fileSet])) function parse(data) { return data.replace('[', '').replace(']', '').split(',') -} \ No newline at end of file +} From 5ce1b798f4fdeb94f6d69aa5c2b657e56dd94c4c Mon Sep 17 00:00:00 2001 From: chainupk <121842069+chainupk@users.noreply.github.com> Date: Wed, 5 Jul 2023 23:14:48 +0800 Subject: [PATCH 0222/1974] remove nodedao filecoin and created folder for hashking (#6728) --- projects/hashking/index.js | 13 +++++++++++++ projects/node-dao/index.js | 9 --------- 2 files changed, 13 insertions(+), 9 deletions(-) create mode 100644 projects/hashking/index.js diff --git a/projects/hashking/index.js b/projects/hashking/index.js new file mode 100644 index 00000000000..036bf811bad --- /dev/null +++ b/projects/hashking/index.js @@ -0,0 +1,13 @@ +const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') + +module.exports = { + filecoin: { + tvl: async (_, _1, _2, { api }) => { + const owner = '0xe012f3957226894b1a2a44b3ef5070417a069dc2' + const validators = await api.call({ target: owner, abi: 'function beneficiarys() public view returns (address [] memory)'}) + const bals = await api.multiCall({ abi: 'uint256:totalStakingFil', calls: validators}) + bals.forEach(i => api.add(nullAddress, i)) + return sumTokens2({ api, owners: [owner], tokens: [nullAddress]}) + } + } +} \ No newline at end of file diff --git a/projects/node-dao/index.js b/projects/node-dao/index.js index f898ec432ad..6c70f489ace 100644 --- a/projects/node-dao/index.js +++ b/projects/node-dao/index.js @@ -7,14 +7,5 @@ module.exports = { const totalEth = await api.call({ abi: 'uint256:getTotalEthValue', target: owner }) api.add(nullAddress,totalEth) } - }, - filecoin: { - tvl: async (_, _1, _2, { api }) => { - const owner = '0xe012f3957226894b1a2a44b3ef5070417a069dc2' - const validators = await api.call({ target: owner, abi: 'function beneficiarys() public view returns (address [] memory)'}) - const bals = await api.multiCall({ abi: 'uint256:totalStakingFil', calls: validators}) - bals.forEach(i => api.add(nullAddress, i)) - return sumTokens2({ api, owners: [owner], tokens: [nullAddress]}) - } } } \ No newline at end of file From 6a4a0cba5785efdd25615a6d33af40613dd15e66 Mon Sep 17 00:00:00 2001 From: ChirpFinance <138693488+ChirpFinance@users.noreply.github.com> Date: Wed, 5 Jul 2023 17:22:04 +0100 Subject: [PATCH 0223/1974] Add files via upload (#6729) --- projects/ChirpFinance/index.js | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 projects/ChirpFinance/index.js diff --git a/projects/ChirpFinance/index.js b/projects/ChirpFinance/index.js new file mode 100644 index 00000000000..9b14b8cc4a2 --- /dev/null +++ b/projects/ChirpFinance/index.js @@ -0,0 +1,10 @@ +const { masterchefExports } = require("../helper/unknownTokens"); + +module.exports = masterchefExports({ + chain: "pulse", + masterchef: "0x8d1e3458dA9E8a685732322D435178E790486651", + nativeTokens: ["0xCa66B54a8A4AD9a231DD70d3605D1ff6aE95d427"], + useDefaultCoreAssets: true, + poolInfoABI: "function poolInfo(uint256) view returns (address)", + getToken: (i) => i, +}); From 142bd94be292b3ebf784baab8347bd720a457c9e Mon Sep 17 00:00:00 2001 From: Merlin <39942523+merlincdj@users.noreply.github.com> Date: Thu, 6 Jul 2023 00:23:17 +0800 Subject: [PATCH 0224/1974] chore: WOOFi add Polygon zkEVM (#6727) --- projects/woofi.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/projects/woofi.js b/projects/woofi.js index 70a871385a8..af4d08b2868 100644 --- a/projects/woofi.js +++ b/projects/woofi.js @@ -48,6 +48,10 @@ const wooPPConfig = { ADDRESSES.era.WETH, // WETH ADDRESSES.era.USDC, // USDC ], + polygon_zkevm: [ + ADDRESSES.polygon_zkevm.WETH, + ADDRESSES.polygon_zkevm.USDC, + ], } const chainConfig = { @@ -86,9 +90,14 @@ const chainConfig = { woo: '', stakingContract: '', }, + polygon_zkevm: { + wooPPContract: '0xF5d215d9C84778F85746D15762DaF39B9E83a2d6', + woo: '', + stakingContract: '', + }, } -const noStakingChains = ['optimism', 'era'] +const noStakingChains = ['optimism', 'era', 'polygon_zkevm'] Object.keys(chainConfig).forEach(chain => { const wooPPTokens = wooPPConfig[chain] const { wooPPContract, woo, stakingContract } = chainConfig[chain] From 587ffb52bb990bb3843b7b93765829d65317449c Mon Sep 17 00:00:00 2001 From: aankor <56882964+aankor@users.noreply.github.com> Date: Wed, 5 Jul 2023 18:24:45 +0200 Subject: [PATCH 0225/1974] marinade.finance: remove wSOL/SOL token separation and show 100% in native SOL (#6725) Co-authored-by: aankor --- projects/marinade.js | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/projects/marinade.js b/projects/marinade.js index 34003f7fb9b..ad204fd662b 100644 --- a/projects/marinade.js +++ b/projects/marinade.js @@ -1,4 +1,4 @@ -const { getProvider, sumTokens2, } = require('./helper/solana') +const { getProvider, getSolBalance, } = require("./helper/solana") const { Program, } = require("@project-serum/anchor"); async function tvl() { @@ -6,17 +6,21 @@ async function tvl() { const programId = 'MarBmsSgKXdrN1egZf5sqe1TMai9K1rChYNDJgjq7aD' const idl = await Program.fetchIdl(programId, provider) const program = new Program(idl, programId, provider) - const [{ - account: { - validatorSystem: { totalActiveBalance }, availableReserveBalance - } - }] = await program.account.state.all() - const balances = { - solana: (+totalActiveBalance + +availableReserveBalance)/1e9 + const [ + { + account: { + validatorSystem: { totalActiveBalance }, + availableReserveBalance, + }, + }, + ] = await program.account.state.all() + return { + solana: + (+totalActiveBalance + + +availableReserveBalance + + (await getSolBalance("UefNb6z6yvArqe4cJHTXCqStRsKmWhGxnZzuHbikP5Q"))) / // Liq Pool Sol Leg Pda + 1e9, } - return sumTokens2({ balances, solOwners: [ - 'UefNb6z6yvArqe4cJHTXCqStRsKmWhGxnZzuHbikP5Q', // Liq Pool Sol Leg Pda - ]}) } module.exports = { From b81c690ef66f0882e73913a105ddf544f6bf93a6 Mon Sep 17 00:00:00 2001 From: Aleksei Lushnikov Date: Wed, 5 Jul 2023 17:28:44 +0100 Subject: [PATCH 0226/1974] symbiosis adds WETH tokens and updates USD tokens (#6724) --- projects/helper/coreAssets.json | 3 +++ projects/symbiosis-finance/config.js | 15 +++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index 107a52eb0f3..139d6bbe174 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -182,6 +182,7 @@ "optimism": { "OP": "0x4200000000000000000000000000000000000042", "WETH": "0x121ab82b49b2bc4c7901ca46b8277962b4350204", + "WETH_1": "0x4200000000000000000000000000000000000006", "BitANT": "0x5029c236320b8f15ef0a657054b84d90bfbeded3", "FEI": "0x35d48a789904e9b15705977192e5d95e2af7f1d3", "alUSD": "0xcb8fa9a76b8e203d8c3797bf438d8fb81ea3326a", @@ -223,6 +224,7 @@ "WBTC": "0x2f2a2543b76a4166549f7aab2e75bef0aefc5b0f", "DAI": "0xda10009cbd5d07dd0cecc66161fc93d7c9000da1", "USDC": "0xff970a61a04b1ca14834a43f5de4533ebddb5cc8", + "USDC_CIRCLE": "0xaf88d065e77c8cC2239327C5EDb3A432268e5831", "LINK": "0xf97f4df75117a78c1a5a0dbb814af92458539fb4", "USDT": "0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9", "ARBY": "0x09ad12552ec45f82be90b38dfe7b06332a680864", @@ -965,6 +967,7 @@ "WKAVA": "0xc86c7c0efbd6a49b35e8714c5f59d99de09a225b", "USDC": "0xfa9343c3897324496a05fc75abed6bac29f8a40f", "USDT": "0xb44a9b6905af7c801311e8f4e76932ee959c663c", + "USDt": "0x919C1c267BC06a7039e03fcc2eF738525769109c", "WBTC": "0x818ec0a7fe18ff94269904fced6ae3dae6d6dc0b", "DAI": "0x765277eebeca2e31912c9946eae1021199b39c61", "SUSHI": "0x7c598c96d02398d89fbcb9d41eab3df0c16f227d", diff --git a/projects/symbiosis-finance/config.js b/projects/symbiosis-finance/config.js index f01d992ddbd..c04f4108f17 100644 --- a/projects/symbiosis-finance/config.js +++ b/projects/symbiosis-finance/config.js @@ -5,6 +5,7 @@ module.exports = { name: 'ethereum', tokens: [ ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.WETH, ], holders: [ '0xb80fDAA74dDA763a8A158ba85798d373A5E84d84', // portal v1 @@ -16,6 +17,7 @@ module.exports = { tokens: [ ADDRESSES.bsc.BUSD, ADDRESSES.bsc.USDC, + ADDRESSES.bsc.ETH, ], holders: [ '0xD7F9989bE0d15319d13d6FA5d468211C89F0b147', // portal v1 @@ -27,6 +29,7 @@ module.exports = { name: 'avax', tokens: [ ADDRESSES.avax.USDC_e, + ADDRESSES.avax.USDC, ], holders: [ '0xD7F9989bE0d15319d13d6FA5d468211C89F0b147', // portal v1 @@ -39,6 +42,7 @@ module.exports = { name: 'polygon', tokens: [ ADDRESSES.polygon.USDC, + ADDRESSES.polygon.WETH_1, ], holders: [ '0xD7F9989bE0d15319d13d6FA5d468211C89F0b147', // portal v1 @@ -103,7 +107,8 @@ module.exports = { { name: 'kava', tokens: [ - ADDRESSES.telos.ETH, + ADDRESSES.kava.USDC, + ADDRESSES.kava.USDt, ], holders: [ '0x292fC50e4eB66C3f6514b9E402dBc25961824D62', // portal v2 @@ -113,6 +118,7 @@ module.exports = { name: 'era', tokens: [ ADDRESSES.era.USDC, + ADDRESSES.era.WETH, ], holders: [ '0x39dE19C9fF25693A2311AAD1dc5C790194084A39', // portal v2 @@ -121,7 +127,9 @@ module.exports = { { name: 'arbitrum', tokens: [ - ADDRESSES.arbitrum.USDC, + ADDRESSES.arbitrum.USDC, // USDC.e + ADDRESSES.arbitrum.USDC_CIRCLE, + ADDRESSES.arbitrum.WETH, ], holders: [ '0x01A3c8E513B758EBB011F7AFaf6C37616c9C24d9', // portal v2 @@ -131,6 +139,7 @@ module.exports = { name: 'optimism', tokens: [ ADDRESSES.optimism.USDC, + ADDRESSES.optimism.WETH_1, ], holders: [ '0x292fC50e4eB66C3f6514b9E402dBc25961824D62', // portal v2 @@ -140,6 +149,7 @@ module.exports = { name: 'arbitrum_nova', tokens: [ ADDRESSES.arbitrum_nova.USDC, + ADDRESSES.arbitrum_nova.WETH, ], holders: [ '0x292fC50e4eB66C3f6514b9E402dBc25961824D62', // portal v2 @@ -149,6 +159,7 @@ module.exports = { name: 'polygon_zkevm', tokens: [ ADDRESSES.polygon_zkevm.USDC, + ADDRESSES.polygon_zkevm.WETH, ], holders: [ '0x292fC50e4eB66C3f6514b9E402dBc25961824D62', // portal v2 From a08e47361a53dcb296382fd38985eb4958fae276 Mon Sep 17 00:00:00 2001 From: mummyguy <120447666+mummyguy@users.noreply.github.com> Date: Thu, 6 Jul 2023 00:46:43 +0700 Subject: [PATCH 0227/1974] Add mummy arbitrum (#6730) Co-authored-by: mummyguy --- projects/mummy/index.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/projects/mummy/index.js b/projects/mummy/index.js index ded3ed0acf9..27ee396e719 100644 --- a/projects/mummy/index.js +++ b/projects/mummy/index.js @@ -10,6 +10,10 @@ const fantomMMY = "0x01e77288b38b416F972428d562454fb329350bAc"; const opVault = "0xA6D7D0e650aa40FFa42d845A354c12c2bc0aB15f"; const opStaking = "0x04f23404553fcc388Ec73110A0206Dd2E76a6d95"; const opMMY = "0x47536f17f4ff30e64a96a7555826b8f9e66ec468"; +//Arbitrum +const arbVault = "0x304951d7172bCAdA54ccAC1E4674862b3d5b3d5b"; +const arbStaking = "0x52cC60893d3Bd8508baAB835620CbF9ddfA0A13C"; +const arbMMY = "0xA6D7D0e650aa40FFa42d845A354c12c2bc0aB15f"; module.exports = { hallmarks: [ [1675242000,"sifu 2M deposit"] @@ -21,6 +25,10 @@ module.exports = { optimism: { staking: staking(opStaking, opMMY, "optimism", fantomMMY, 18), tvl: gmxExports({ vault: opVault }) + }, + arbitrum: { + staking: staking(arbStaking, arbMMY, "arbitrum", fantomMMY, 18), + tvl: gmxExports({ vault: arbVault }) } }; From b42152b1c75326220b92f67b262b73157aa14295 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Wed, 5 Jul 2023 18:48:02 +0100 Subject: [PATCH 0228/1974] fix staking --- projects/mummy/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/projects/mummy/index.js b/projects/mummy/index.js index 27ee396e719..d23f05efe33 100644 --- a/projects/mummy/index.js +++ b/projects/mummy/index.js @@ -19,15 +19,15 @@ module.exports = { [1675242000,"sifu 2M deposit"] ], fantom: { - staking: staking(fantomStaking, fantomMMY, "fantom", fantomMMY, 18), + staking: staking(fantomStaking, fantomMMY, "fantom"), tvl: gmxExports({ vault: fantomVault }) }, optimism: { - staking: staking(opStaking, opMMY, "optimism", fantomMMY, 18), + staking: staking(opStaking, opMMY, "optimism"), tvl: gmxExports({ vault: opVault }) }, arbitrum: { - staking: staking(arbStaking, arbMMY, "arbitrum", fantomMMY, 18), + staking: staking(arbStaking, arbMMY, "arbitrum"), tvl: gmxExports({ vault: arbVault }) } From 0265a8f384f0ba9ba73b360262ed6ecb1eb22d38 Mon Sep 17 00:00:00 2001 From: Dan Hsu Date: Thu, 6 Jul 2023 14:52:39 +0800 Subject: [PATCH 0229/1974] feature: remove unused code --- projects/bucket-protocol/index.js | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/projects/bucket-protocol/index.js b/projects/bucket-protocol/index.js index 80f54bb3cb4..ced7ee1722f 100644 --- a/projects/bucket-protocol/index.js +++ b/projects/bucket-protocol/index.js @@ -2,8 +2,6 @@ const sui = require("../helper/chain/sui"); const MAINNET_PROTOCOL_ID = "0x9e3dab13212b27f5434416939db5dec6a319d15b89a84fd074d03ece6350d3df"; -const BUCK = - "0xce7ff77a83ea0cb6fd39bd8748e2ec89a3f41e8efdc3f4eb123e0ca37b184db2::buck::BUCK"; async function tvl(_, _1, _2, { api }) { const protocolFields = await sui.getDynamicFieldObjects({ @@ -14,18 +12,10 @@ async function tvl(_, _1, _2, { api }) { item.type.includes("Bucket") ); - //Uncomment it when BUCK listed on CoinGecko - // const tankList = protocolFields.filter((item) => item.type.includes("Tank")); - for (const bucket of bucketList) { const coin = bucket.type.split("<").pop()?.replace(">", "") ?? ""; api.add(coin, bucket.fields.collateral_vault); } - - //Uncomment it when BUCK listed on CoinGecko - // for (const tank of tankList) { - // api.add(BUCK, tank.fields.reserve); - // } } module.exports = { From 6452911364bfba3a6912b00d64d5a9d16d01f20d Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 6 Jul 2023 09:40:58 +0200 Subject: [PATCH 0230/1974] track pika v4 --- projects/pika.js | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/projects/pika.js b/projects/pika.js index 50d584e44cd..5a404a89f35 100644 --- a/projects/pika.js +++ b/projects/pika.js @@ -1,17 +1,12 @@ const ADDRESSES = require('./helper/coreAssets.json') -const { sumTokens2 } = require('./helper/unwrapLPs') -const chain = 'optimism' - -async function tvl(_, _b, { [ chain]: block }) { - const owners = [ - '0x2FaE8C7Edd26213cA1A88fC57B65352dbe353698', '0xD5A8f233CBdDb40368D55C3320644Fb36e597002', - ] - const tokens = [ADDRESSES.optimism.USDC] - return sumTokens2({ chain, block, owners, tokens, }) -} +const { sumTokensExport } = require('./helper/unwrapLPs') module.exports = { optimism: { - tvl + tvl: sumTokensExport({ owners: [ + '0x2FaE8C7Edd26213cA1A88fC57B65352dbe353698', + '0xD5A8f233CBdDb40368D55C3320644Fb36e597002', + '0x9b86B2Be8eDB2958089E522Fe0eB7dD5935975AB', + ], tokens: [ADDRESSES.optimism.USDC]}) } } \ No newline at end of file From 7197c03a4f547bb01db9a08cc8ac0cc450e59f95 Mon Sep 17 00:00:00 2001 From: Q6Crypto <112528487+Q6Crypto@users.noreply.github.com> Date: Thu, 6 Jul 2023 03:42:03 -0400 Subject: [PATCH 0231/1974] pulserate (#6731) * pulserate * minor fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/helper/utils.js | 2 +- projects/pulserate/index.js | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 projects/pulserate/index.js diff --git a/projects/helper/utils.js b/projects/helper/utils.js index ccb3c9c384a..2e74ecae44b 100644 --- a/projects/helper/utils.js +++ b/projects/helper/utils.js @@ -54,7 +54,7 @@ function isLP(symbol, token, chain) { if (token && blacklisted_LPS.includes(token.toLowerCase()) || symbol.includes('HOP-LP-')) return false if (chain === 'bsc' && ['OLP', 'DLP', 'MLP', 'LP', 'Stable-LP'].includes(symbol)) return false if (chain === 'bsc' && ['WLP', 'FstLP', 'BLP',].includes(symbol)) return true - if (chain === 'pulse' && ['PLP',].includes(symbol)) return true + if (chain === 'pulse' && ['PLP', 'PLT'].includes(symbol)) return true if (chain === 'avax' && ['ELP', 'EPT', 'CRL', 'YSL', 'BGL', 'PLP'].includes(symbol)) return true if (chain === 'ethereum' && ['SSLP'].includes(symbol)) return true if (chain === 'polygon' && ['WLP', 'FLP'].includes(symbol)) return true diff --git a/projects/pulserate/index.js b/projects/pulserate/index.js new file mode 100644 index 00000000000..feca6b1e783 --- /dev/null +++ b/projects/pulserate/index.js @@ -0,0 +1,22 @@ +const { getUniTVL, sumTokensExport } = require("../helper/unknownTokens"); +const PSHARE = "0x11D4109Cd7E5cE596471583E90e20e51d087de33"; +module.exports = { + misrepresentedTokens: true, + methodology: + "Factory address (0xE2332E5297b18a21DcE0E6ac461e821C353A00cA) is used to find the LP pairs. TVL is equal to the liquidity on the AMM. Staking balance is equal to the balance of PSHARE in Boardroom contract", + pulse: { + tvl: getUniTVL({ + factory: "0xE2332E5297b18a21DcE0E6ac461e821C353A00cA", + useDefaultCoreAssets: true, + fetchBalances: true, + }), + staking: sumTokensExport({ + owners: ["0xD7A2F5A72079654E7997C615cC07A1b92D850b32"], + tokens: [PSHARE], + lps: [ + '0x91d3E933B7f2ccBAdf4d5278d826Cb10659a1c55', + ], + useDefaultCoreAssets: true, + }), + }, +}; From 3735c3de4fe0678664eb85d03b2002552935fb2c Mon Sep 17 00:00:00 2001 From: phiatFinance <107194334+phiatDev2@users.noreply.github.com> Date: Thu, 6 Jul 2023 17:42:17 +1000 Subject: [PATCH 0232/1974] add phux (#6732) * add phux * add phux * rm wrong index.js * minor fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/phux/index.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 projects/phux/index.js diff --git a/projects/phux/index.js b/projects/phux/index.js new file mode 100644 index 00000000000..20b7243d9c7 --- /dev/null +++ b/projects/phux/index.js @@ -0,0 +1,16 @@ +const { onChainTvl } = require('../helper/balancer') + +const VAULT_ADDRESS = '0x7F51AC3df6A034273FB09BB29e383FCF655e473c'; + +const config = { + pulse: { fromBlock: 17500116, }, +} + +module.exports = {}; + +Object.keys(config).forEach(chain => { + const { fromBlock } = config[chain] + module.exports[chain] = { + tvl: onChainTvl(VAULT_ADDRESS, fromBlock) + } +}) \ No newline at end of file From 5645736900be797ebd635618b47e21c77159e30b Mon Sep 17 00:00:00 2001 From: Merlin <39942523+merlincdj@users.noreply.github.com> Date: Thu, 6 Jul 2023 15:42:30 +0800 Subject: [PATCH 0233/1974] feat: add WOOFi staking v2 contract (#6733) * chore: WOOFi add Polygon zkEVM * feat: add WOOFi staking v2 contract --- projects/woofi.js | 58 ++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 47 insertions(+), 11 deletions(-) diff --git a/projects/woofi.js b/projects/woofi.js index af4d08b2868..eaecca27c0b 100644 --- a/projects/woofi.js +++ b/projects/woofi.js @@ -1,5 +1,5 @@ const ADDRESSES = require('./helper/coreAssets.json') -const { staking } = require('./helper/staking') +const { staking, stakings } = require('./helper/staking') const wooPPConfig = { fantom: [ @@ -8,6 +8,7 @@ const wooPPConfig = { '0x321162Cd933E2Be498Cd2267a90534A804051b11', // BTC '0x6626c47c00F1D87902fc13EECfaC3ed06D5E8D8a', // WOO ADDRESSES.fantom.USDC, // USDC + ADDRESSES.fantom.fUSDT, ], bsc: [ ADDRESSES.bsc.WBNB, // WBNB @@ -23,6 +24,7 @@ const wooPPConfig = { ADDRESSES.avax.BTC_b, // BTC.b '0xaBC9547B534519fF73921b1FBA6E672b5f58D083', // WOO.e ADDRESSES.avax.USDC, // USDC + ADDRESSES.avax.USDt, ], polygon: [ ADDRESSES.polygon.WMATIC_2, // WMATIC @@ -30,6 +32,7 @@ const wooPPConfig = { ADDRESSES.polygon.WBTC, // WBTC '0x1B815d120B3eF02039Ee11dC2d33DE7aA4a8C603', // WOO ADDRESSES.polygon.USDC, // USDC + ADDRESSES.polygon.USDT, ], arbitrum: [ ADDRESSES.arbitrum.WETH, // WETH @@ -37,13 +40,18 @@ const wooPPConfig = { '0xcAFcD85D8ca7Ad1e1C6F82F651fA15E33AEfD07b', // WOO '0x912CE59144191C1204E64559FE8253a0e49E6548', // ARB ADDRESSES.arbitrum.USDC, // USDC + '0xaf88d065e77c8cC2239327C5EDb3A432268e5831', // native USDC + ADDRESSES.arbitrum.USDT, ], optimism: [ ADDRESSES.tombchain.FTM, // WETH '0x68f180fcCe6836688e9084f035309E29Bf0A2095', // WBTC ADDRESSES.optimism.OP, // OP ADDRESSES.optimism.USDC, // USDC + ADDRESSES.optimism.USDT, + '0x871f2F2ff935FD1eD867842FF2a7bfD051A5E527', // WOO ], + ethereum: [], era: [ ADDRESSES.era.WETH, // WETH ADDRESSES.era.USDC, // USDC @@ -59,54 +67,82 @@ const chainConfig = { wooPPContract: '0x286ab107c5E9083dBed35A2B5fb0242538F4f9bf', woo: '0x6626c47c00f1d87902fc13eecfac3ed06d5e8d8a', stakingContract: '0x2Fe5E5D341cFFa606a5d9DA1B6B646a381B0f7ec', + stakingContractV2: '0x1416E1378682b5Ca53F76656549f7570ad0703d9', }, bsc: { wooPPContract: '0x59dE3B49314Bf5067719364A2Cb43e8525ab93FA', woo: '0x4691937a7508860f876c9c0a2a617e7d9e945d4b', stakingContract: '0x2AEab1a338bCB1758f71BD5aF40637cEE2085076', + stakingContractV2: '0xba91ffD8a2B9F68231eCA6aF51623B3433A89b13', }, avax: { wooPPContract: '0x3b3E4b4741e91aF52d0e9ad8660573E951c88524', woo: '0xabc9547b534519ff73921b1fba6e672b5f58d083', stakingContract: '0xcd1B9810872aeC66d450c761E93638FB9FE09DB0', + stakingContractV2: '0x3Bd96847C40De8b0F20dA32568BD15462C1386E3', }, polygon: { wooPPContract: '0x7081A38158BD050Ae4a86e38E0225Bc281887d7E', woo: '0x1b815d120b3ef02039ee11dc2d33de7aa4a8c603', stakingContract: '0x9BCf8b0B62F220f3900e2dc42dEB85C3f79b405B', + stakingContractV2: '0xba91ffD8a2B9F68231eCA6aF51623B3433A89b13', }, arbitrum: { wooPPContract: '0xeFF23B4bE1091b53205E35f3AfCD9C7182bf3062', woo: '0xcafcd85d8ca7ad1e1c6f82f651fa15e33aefd07b', stakingContract: '0x9321785D257b3f0eF7Ff75436a87141C683DC99d', + stakingContractV2: '0x2CFa72E7f58dc82B990529450Ffa83791db7d8e2', }, optimism: { wooPPContract: '0xd1778F9DF3eee5473A9640f13682e3846f61fEbC', woo: '0x871f2f2ff935fd1ed867842ff2a7bfd051a5e527', - stakingContract: '', + stakingContract: null, + stakingContractV2: '0xba91ffD8a2B9F68231eCA6aF51623B3433A89b13', + }, + ethereum: { + wooPPContract: null, + woo: '0x4691937a7508860F876c9c0a2a617E7d9E945D4B', + stakingContract: null, + stakingContractV2: '0xba91ffD8a2B9F68231eCA6aF51623B3433A89b13', }, era: { wooPPContract: '0x42ED123EB5266A5B8E2B54B2C76180CCF5e72FEe', - woo: '', - stakingContract: '', + woo: null, + stakingContract: null, + stakingContractV2: null, }, polygon_zkevm: { wooPPContract: '0xF5d215d9C84778F85746D15762DaF39B9E83a2d6', - woo: '', - stakingContract: '', + woo: null, + stakingContract: null, + stakingContractV2: null, }, } -const noStakingChains = ['optimism', 'era', 'polygon_zkevm'] Object.keys(chainConfig).forEach(chain => { const wooPPTokens = wooPPConfig[chain] - const { wooPPContract, woo, stakingContract } = chainConfig[chain] + const { wooPPContract, woo, stakingContract, stakingContractV2 } = chainConfig[chain] + + var tvl = 0 + if (wooPPContract != null) { + tvl = staking(wooPPContract, wooPPTokens, chain) + } + + var contracts = [] + if (stakingContract != null) { + contracts.push(stakingContract) + } + if (stakingContractV2 != null) { + contracts.push(stakingContractV2) + } + var stakingAmount = 0 - if (noStakingChains.indexOf(chain) == -1) { - stakingAmount = staking(stakingContract, woo, chain) + if (woo != null) { + stakingAmount = stakings(contracts, woo, chain) } + module.exports[chain] = { staking: stakingAmount, - tvl: staking(wooPPContract, wooPPTokens, chain), + tvl: tvl, } }) From cdb8354d0786479f9bb555d16c3bccd3a040b257 Mon Sep 17 00:00:00 2001 From: HashDAO Finance <125532714+HASHDAO1@users.noreply.github.com> Date: Thu, 6 Jul 2023 15:45:14 +0800 Subject: [PATCH 0234/1974] Add files via upload (#6735) --- projects/hashdaofinance/index.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/projects/hashdaofinance/index.js b/projects/hashdaofinance/index.js index 32f457f92be..62f700b3028 100644 --- a/projects/hashdaofinance/index.js +++ b/projects/hashdaofinance/index.js @@ -4,6 +4,8 @@ const { staking } = require('../helper/staking') const contract = '0x90d11b8de2b30a84cB7e6cf6188581Ec08b1Bf82' const lp = '0x8dC6EFD57A13B7ba3ff7824c9708DB24d3190703' const chef = '0xb557c071BAe7DC3aa2366Cd0FC0477B45Eb696f1' +const vHash = '0x958882fda110febd41536e45034bebff2a815006' +const hash = '0x2e80259c9071b6176205ff5f5eb6f7ec8361b93f' async function tvl(_, _b, _cb, { api, }) { const owners = await api.call({ target: contract, abi: "function getAllPools() public view returns(address[] memory list)" }) @@ -11,9 +13,27 @@ async function tvl(_, _b, _cb, { api, }) { return sumTokens2({ api, ownerTokens: tokens.map((v, i) => [v, owners[i]]) }) } +const op_contract = '0xF96aad4942D8A0394158Fd960003397690fB795D' +const op_lp = '0xb426aE40E43be57215ba7DAA06Cbc5d48eD35Dcf' +const op_chef = '0xEAB4C6C26A1F296E8E0033ffB817D5311C51299d' +const op_vHash = '0x9D66c32E137E618BEE9669Ae096FD59ba925AaA5' +const op_hash = '0x2e80259C9071B6176205FF5F5Eb6F7EC8361b93f' + +async function op_tvl(_, _b, _cb, { api, }) { + const owners = await api.call({ target: op_contract, abi: "function getAllPools() public view returns(address[] memory list)" }) + const tokens = await api.multiCall({ abi: "function getPoolTokens(address _pool) public view returns(address[] memory list)", target: op_contract, calls: owners }) + return sumTokens2({ api, ownerTokens: tokens.map((v, i) => [v, owners[i]]) }) +} + module.exports = { arbitrum: { tvl, pool2: staking(chef, lp), + staking: staking(vHash, hash), + }, + optimism: { + tvl: op_tvl, + pool2: staking(op_chef, op_lp, 'optimism', op_lp), + staking: staking(op_vHash, op_hash), } } From 07164ea405fe7b743afc53fd0ca97e9e1b88bf99 Mon Sep 17 00:00:00 2001 From: Dan Hsu Date: Thu, 6 Jul 2023 15:45:50 +0800 Subject: [PATCH 0235/1974] Create Bucket-Protocol (#6736) * feature: add bucket-protocol * feature: modified buck decimal * feature: comment tank tvl * feature: remove unused code --- projects/bucket-protocol/index.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 projects/bucket-protocol/index.js diff --git a/projects/bucket-protocol/index.js b/projects/bucket-protocol/index.js new file mode 100644 index 00000000000..ced7ee1722f --- /dev/null +++ b/projects/bucket-protocol/index.js @@ -0,0 +1,26 @@ +const sui = require("../helper/chain/sui"); + +const MAINNET_PROTOCOL_ID = + "0x9e3dab13212b27f5434416939db5dec6a319d15b89a84fd074d03ece6350d3df"; + +async function tvl(_, _1, _2, { api }) { + const protocolFields = await sui.getDynamicFieldObjects({ + parent: MAINNET_PROTOCOL_ID, + }); + + const bucketList = protocolFields.filter((item) => + item.type.includes("Bucket") + ); + + for (const bucket of bucketList) { + const coin = bucket.type.split("<").pop()?.replace(">", "") ?? ""; + api.add(coin, bucket.fields.collateral_vault); + } +} + +module.exports = { + timetravel: false, + sui: { + tvl, + }, +}; From 4bd463032c646de849ef80d6439f4708e97b1dbc Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 6 Jul 2023 09:55:02 +0200 Subject: [PATCH 0236/1974] hashdao: code refactor --- projects/hashdaofinance/index.js | 62 ++++++++++++++++---------------- 1 file changed, 30 insertions(+), 32 deletions(-) diff --git a/projects/hashdaofinance/index.js b/projects/hashdaofinance/index.js index 62f700b3028..d41df110b82 100644 --- a/projects/hashdaofinance/index.js +++ b/projects/hashdaofinance/index.js @@ -1,39 +1,37 @@ const { sumTokens2 } = require("../helper/unwrapLPs"); const { staking } = require('../helper/staking') +const { pool2 } = require('../helper/pool2') -const contract = '0x90d11b8de2b30a84cB7e6cf6188581Ec08b1Bf82' -const lp = '0x8dC6EFD57A13B7ba3ff7824c9708DB24d3190703' -const chef = '0xb557c071BAe7DC3aa2366Cd0FC0477B45Eb696f1' -const vHash = '0x958882fda110febd41536e45034bebff2a815006' -const hash = '0x2e80259c9071b6176205ff5f5eb6f7ec8361b93f' - -async function tvl(_, _b, _cb, { api, }) { - const owners = await api.call({ target: contract, abi: "function getAllPools() public view returns(address[] memory list)" }) - const tokens = await api.multiCall({ abi: "function getPoolTokens(address _pool) public view returns(address[] memory list)", target: contract, calls: owners }) - return sumTokens2({ api, ownerTokens: tokens.map((v, i) => [v, owners[i]]) }) -} - -const op_contract = '0xF96aad4942D8A0394158Fd960003397690fB795D' -const op_lp = '0xb426aE40E43be57215ba7DAA06Cbc5d48eD35Dcf' -const op_chef = '0xEAB4C6C26A1F296E8E0033ffB817D5311C51299d' -const op_vHash = '0x9D66c32E137E618BEE9669Ae096FD59ba925AaA5' -const op_hash = '0x2e80259C9071B6176205FF5F5Eb6F7EC8361b93f' - -async function op_tvl(_, _b, _cb, { api, }) { - const owners = await api.call({ target: op_contract, abi: "function getAllPools() public view returns(address[] memory list)" }) - const tokens = await api.multiCall({ abi: "function getPoolTokens(address _pool) public view returns(address[] memory list)", target: op_contract, calls: owners }) - return sumTokens2({ api, ownerTokens: tokens.map((v, i) => [v, owners[i]]) }) -} - -module.exports = { +const config = { arbitrum: { - tvl, - pool2: staking(chef, lp), - staking: staking(vHash, hash), + contract: '0x90d11b8de2b30a84cB7e6cf6188581Ec08b1Bf82', + lp: '0x8dC6EFD57A13B7ba3ff7824c9708DB24d3190703', + chef: '0xb557c071BAe7DC3aa2366Cd0FC0477B45Eb696f1', + vHash: '0x958882fda110febd41536e45034bebff2a815006', + hash: '0x2e80259c9071b6176205ff5f5eb6f7ec8361b93f', }, optimism: { - tvl: op_tvl, - pool2: staking(op_chef, op_lp, 'optimism', op_lp), - staking: staking(op_vHash, op_hash), - } + contract: '0xF96aad4942D8A0394158Fd960003397690fB795D', + lp: '0xb426aE40E43be57215ba7DAA06Cbc5d48eD35Dcf', + chef: '0xEAB4C6C26A1F296E8E0033ffB817D5311C51299d', + vHash: '0x9D66c32E137E618BEE9669Ae096FD59ba925AaA5', + hash: '0x2e80259c9071b6176205ff5f5eb6f7ec8361b93f', + isPool2: true, + }, } + +Object.keys(config).forEach(chain => { + const { contract, lp, chef, hash, vHash, isPool2,} = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const owners = await api.call({ target: contract, abi: "function getAllPools() public view returns(address[] memory list)" }) + const tokens = await api.multiCall({ abi: "function getPoolTokens(address _pool) public view returns(address[] memory list)", target: contract, calls: owners }) + return sumTokens2({ api, ownerTokens: tokens.map((v, i) => [v, owners[i]]), }) + } + } + if (chef && lp) + module.exports[chain].pool2 = isPool2 ? pool2(chef, lp) : staking(chef, lp) + + if (hash && vHash) + module.exports[chain].staking = staking(vHash, hash) +}) \ No newline at end of file From a02f53683bfa9a9ee72092f842248121d21287cb Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Thu, 6 Jul 2023 09:30:18 +0100 Subject: [PATCH 0237/1974] pendle bsc --- projects/pendle/v2.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/pendle/v2.js b/projects/pendle/v2.js index e8eb41eb24e..20d807ab5be 100644 --- a/projects/pendle/v2.js +++ b/projects/pendle/v2.js @@ -6,6 +6,7 @@ const steth = ADDRESSES.ethereum.STETH; const config = { ethereum: { factory: '0x27b1dacd74688af24a64bd3c9c1b143118740784', fromBlock: 16032059 }, arbitrum: { factory: '0xf5a7de2d276dbda3eef1b62a9e718eff4d29ddc8', fromBlock: 62979673 }, + bsc: { factory: '0x2bEa6BfD8fbFF45aA2a893EB3B6d85D10EFcC70E', fromBlock: 29484286 }, } module.exports = {} From 22d383ec7e5bd14a051a68091ba4e76b1cec7e97 Mon Sep 17 00:00:00 2001 From: define Date: Thu, 6 Jul 2023 10:14:49 +0100 Subject: [PATCH 0238/1974] Update Binance Cex wallets --- projects/binance/config.js | 31 ++++++++++++++++++++++--------- projects/helper/coreAssets.json | 3 ++- 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/projects/binance/config.js b/projects/binance/config.js index e96f99f2bee..13a3e18a27a 100644 --- a/projects/binance/config.js +++ b/projects/binance/config.js @@ -338,19 +338,32 @@ const assetList = [ ["ARB", "ARB", "0xb38e8c17e38363af6ebdcb3dae12e0243582891d"], ["ARB", "ETH", "0x28c6c06298d514db089934071355e5743bf21d60"], ["ARB", "ARB", "0xf92402bb795fd7cd08fb83839689db79099c8c9c"], - ["USDC", "ETH", "0xf8d3e5fe8bb885325d98a751a30a1573e887a953"], - ["USDC", "ETH", "0xeae7380dd4cef6fbd1144f49e4d1e6964258a4f4"], - ["USDC", "ETH", "0x95e63f78bd2fd5ea8a0d58182f3d998558881fda"], - ["USDC", "ETH", "0x39e2d89f4b4708077a48d75c5cf2ab059a4b3e48"], - ["USDC", "ETH", "0x558a87a7c8b79ffb66a3d10a4a2de8c73a46707d"], - ["USDC", "ETH", "0xf033bce292bcaaf998ca13755104a4b23c04af5c"], + // ["USDC", "ETH", "0xf8d3e5fe8bb885325d98a751a30a1573e887a953"], removed 06/07/2023 + // ["USDC", "ETH", "0xeae7380dd4cef6fbd1144f49e4d1e6964258a4f4"], removed 06/07/2023 + // ["USDC", "ETH", "0x95e63f78bd2fd5ea8a0d58182f3d998558881fda"], removed 06/07/2023 + // ["USDC", "ETH", "0x39e2d89f4b4708077a48d75c5cf2ab059a4b3e48"], removed 06/07/2023 + // ["USDC", "ETH", "0x558a87a7c8b79ffb66a3d10a4a2de8c73a46707d"], removed 06/07/2023 + // ["USDC", "ETH", "0xf033bce292bcaaf998ca13755104a4b23c04af5c"], removed 06/07/2023 ["LTC", "LTC", "LbmGksLBwtwRXyxeazCZqKiAHX6cWN2AzN"], ["LTC", "LTC", "LhzEoDXHXASi4hSMxrKeVoSGrED9QsBpPq"], ["LTC", "LTC", "MB8nnFMvR5cgvpzQ1QXTDVfUM91BcsLH3k"], - ["USDC", "TRX", "TDjPeMNaRxoNMwENrdtNYmZt1YAfVVjp59"], - ["USDC", "TRX", "TL6VgVKo6natQb6hW5Hy2jcyX5EHgmwXLE"], + // ["USDC", "TRX", "TDjPeMNaRxoNMwENrdtNYmZt1YAfVVjp59"], removed 06/07/2023 + // ["USDC", "TRX", "TL6VgVKo6natQb6hW5Hy2jcyX5EHgmwXLE"], removed 06/07/2023 ["BTC", "BTC", "1Pzaqw98PeRfyHypfqyEgg5yycJRsENrE7"], // new wallet https://twitter.com/binance/status/1670723088802283520 - ["BTC", "BTC", "39884E3j6KZj82FK4vcCrkUvWYL5MQaS3v"] // new wallet that got 3.1b + ["BTC", "BTC", "39884E3j6KZj82FK4vcCrkUvWYL5MQaS3v"], // new wallet that got 3.1b + ["TUSD", "BEP2", "bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz"], + ["TUSD", "BEP20", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["TUSD", "BEP20", "0x8894e0a0c962cb723c1976a4421c95949be2d4e3"], + ["TUSD", "BEP20", "0xe2fc31f816a9b94326492132018c3aecc4a93ae1"], + ["TUSD", "ETH", "0x21a31ee1afc51d94c2efccaa2092ad1028285549"], + ["TUSD", "ETH", "0x28c6c06298d514db089934071355e5743bf21d60"], + ["TUSD", "ETH", "0xdfd5293d8e347dfe59e90efd55b2956a1343963d"], + ["TUSD", "ETH", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["TUSD", "ETH", "0x5a52e96bacdabb82fd05763e25335261b270efcb"], + ["TUSD", "TRX", "TNXoiAJ3dct8Fjg4M9fkLFh9S2v9TXc32G"], + ["TUSD", "TRX", "TV6MuMXfmLbBqPZvBHdwFsDnQeVfnmiuSi"], + ["TUSD", "TRX", "TWd4WrZ9wn84f5x1hZhL4DHvk738ns5jwb"], + ["TUSD", "TRX", "TJCo98saj6WND61g1uuKwJ9GMWMT9WkJFo"], ] function getAddresses(chain) { diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index 139d6bbe174..b9d589ae4ae 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -108,7 +108,8 @@ "YGG": "0x13ab6739368a4e4abf24695bf52959224367391f", "IVN": "0x6a46d878401f46b4c7f665f065e0667580e031ec", "ankrBNB": "0xe85afccdafbe7f2b096f268e31cce3da8da2990a", - "aBNBb": "0xbb1aa6e59e5163d8722a122cd66eba614b59df0d" + "aBNBb": "0xbb1aa6e59e5163d8722a122cd66eba614b59df0d", + "TUSD": "0x40af3827f39d0eacbf4a168f8d4ee67c121d11c9" }, "polygon": { "WMATIC": "0xfd28c7cea3c50a060cb4c0059e453c6d4dd9829d", From 3bac99d007cddcef976fe0f91432e3afbdc5e422 Mon Sep 17 00:00:00 2001 From: define Date: Thu, 6 Jul 2023 11:06:39 +0100 Subject: [PATCH 0239/1974] add op wallets --- projects/binance/config.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/projects/binance/config.js b/projects/binance/config.js index 13a3e18a27a..b063348ad47 100644 --- a/projects/binance/config.js +++ b/projects/binance/config.js @@ -296,6 +296,10 @@ const assetList = [ ["ETH", "OP", "0xF977814e90dA44bFA03b6295A0616a897441aceC"], ["ETH", "OP", "0xacd03d601e5bb1b275bb94076ff46ed9d753435a"], ["BUSD", "OP", "0xacd03d601e5bb1b275bb94076ff46ed9d753435a"], + ["OP", "OP", "0xF977814e90dA44bFA03b6295A0616a897441aceC"], + ["OP", "OP", "0xacd03d601e5bb1b275bb94076ff46ed9d753435a"], + ["USDT", "OP", "0xacd03d601e5bb1b275bb94076ff46ed9d753435a"], + ["USDT", "OP", "0xF977814e90dA44bFA03b6295A0616a897441aceC"], ["XRP", "XRP", "rNU4eAowPuixS5ZCWaRL72UUeKgxcKExpK"], ["XRP", "XRP", "rs8ZPbYqgecRcDzQpJYAMhSxSi5htsjnza"], ["XRP", "XRP", "rBtttd61FExHC68vsZ8dqmS3DfjFEceA1A"], From 6965fbc07ad1e86247ba191658c12bff97400705 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Thu, 6 Jul 2023 11:24:44 +0100 Subject: [PATCH 0240/1974] tusd on tron --- projects/helper/cex.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/helper/cex.js b/projects/helper/cex.js index acc56eec6cb..feadaa86dc3 100644 --- a/projects/helper/cex.js +++ b/projects/helper/cex.js @@ -95,7 +95,8 @@ const defaultTokens = { nullAddress, ADDRESSES.tron.USDT, // USDT ADDRESSES.tron.USDC, // USDC - 'TFptbWaARrWTX5Yvy3gNG5Lm8BmhPx82Bt' //wbt + 'TFptbWaARrWTX5Yvy3gNG5Lm8BmhPx82Bt', //wbt + ADDRESSES.tron.TUSD ], polygon: [ nullAddress, From 76b4bcdafb07360bdcaa50dc58a37fc67e28906c Mon Sep 17 00:00:00 2001 From: define Date: Thu, 6 Jul 2023 11:30:40 +0100 Subject: [PATCH 0241/1974] add tusd bsc --- projects/helper/cex.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/helper/cex.js b/projects/helper/cex.js index feadaa86dc3..12bdbc7cd5f 100644 --- a/projects/helper/cex.js +++ b/projects/helper/cex.js @@ -138,6 +138,7 @@ const defaultTokens = { '0x352Cb5E19b12FC216548a2677bD0fce83BaE434B', // BTT '0xAD29AbB318791D579433D831ed122aFeAf29dcfe', // FTM '0x02ff5065692783374947393723dba9599e59f591',// yoshi + '0x40af3827f39d0eacbf4a168f8d4ee67c121d11c9', //TUSD ], eos: [ ["eosio.token", "EOS", "eos"], From 9fe187b70aac0b5a3ea969c009537d65c2447502 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 6 Jul 2023 13:00:50 +0200 Subject: [PATCH 0242/1974] update chainport --- projects/chainport/index.js | 6 +++++- projects/hashdaofinance/index.js | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/projects/chainport/index.js b/projects/chainport/index.js index 80234017114..003c2e0557a 100644 --- a/projects/chainport/index.js +++ b/projects/chainport/index.js @@ -89,7 +89,11 @@ const config = { owners: [vault1ftm, vault2ftm], }, cardano: { - owners: ['addr1xxcqzje930yw0hykwhf0a89l62dmjwqqpfzdsppf8rhv9rg2czf3yffs8ar450sw50w4xn3pxxwvkz25s4ygh7pjq23ql4slcu'], + owners: [ + 'addr1xxcqzje930yw0hykwhf0a89l62dmjwqqpfzdsppf8rhv9rg2czf3yffs8ar450sw50w4xn3pxxwvkz25s4ygh7pjq23ql4slcu', // multi sig cold storage + 'addr1v9nygflpcedeg004tfghu9hdxhg29sv9550sdyvvu4gxepq5ps9ra', // hot bridge address 1 + 'addr1vxku68zc6wrewfkrdaduw2t8yj7nsh0z6mg8vwuxh7pwjxckzjkjq' // hot bridge address 2 + ], } } diff --git a/projects/hashdaofinance/index.js b/projects/hashdaofinance/index.js index d41df110b82..c7516f54d88 100644 --- a/projects/hashdaofinance/index.js +++ b/projects/hashdaofinance/index.js @@ -33,5 +33,5 @@ Object.keys(config).forEach(chain => { module.exports[chain].pool2 = isPool2 ? pool2(chef, lp) : staking(chef, lp) if (hash && vHash) - module.exports[chain].staking = staking(vHash, hash) + module.exports[chain].staking = staking(vHash, hash, undefined, 'arbitrum:'+config.arbitrum.hash) }) \ No newline at end of file From 11da2849be93c9d9435e5f2ed86340d909ea9601 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 6 Jul 2023 13:01:55 +0200 Subject: [PATCH 0243/1974] update surge --- projects/surge/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/surge/index.js b/projects/surge/index.js index 4a4da24f20c..92df270fbbb 100644 --- a/projects/surge/index.js +++ b/projects/surge/index.js @@ -2,7 +2,7 @@ const { getLogs } = require('../helper/cache/getLogs') const { sumTokens2 } = require('../helper/unwrapLPs') const config = { - arbitrum: { factory: '0xDaD057C49d957c98D20285935B0a87f23907e22C', fromBlock: 107875529, } + arbitrum: { factory: '0x503A14768e23456620fB3Cb61e37A36A2736Cbd0', fromBlock: 107875529, } } Object.keys(config).forEach(chain => { From a1b9172082b9a2cf735cc5c2b464766ab221380b Mon Sep 17 00:00:00 2001 From: zxyge <32669799+zxyge@users.noreply.github.com> Date: Thu, 6 Jul 2023 21:39:06 +0800 Subject: [PATCH 0244/1974] Update index.js (#6741) --- projects/dforce/index.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/projects/dforce/index.js b/projects/dforce/index.js index 1d76a4b0342..8a3d4ed8b11 100644 --- a/projects/dforce/index.js +++ b/projects/dforce/index.js @@ -52,7 +52,8 @@ let oracles = { optimism: "0x4f9312A21F8853384E0f6141F3F9fB855d860161", polygon: "0x9E8B68E17441413b26C2f18e741EAba69894767c", avax: "0x5237d212F9BbC83d91c2cbd810D2b07808d94f08", - kava: "0xe04cea4d02261923769D79Dd24D188C2cB29dB4A" + kava: "0xe04cea4d02261923769D79Dd24D188C2cB29dB4A", + conflux: "0xfd3868B848B5D9eD3583938B4db4746415bD43a3" }; let allControllers = { @@ -73,6 +74,7 @@ let allControllers = { polygon: ["0x52eaCd19E38D501D006D2023C813d7E37F025f37"], avax: ["0x078ad8d6faeD9DAeE55f5d446C80E0C81230DE6b"], kava: ["0xFBf64A8cAEA1D641affa185f850dbBF90d5c84dC"], + conflux: ["0xA377eCF53253275125D0a150aF195186271f6a56"] }; let yieldMarkets = { @@ -141,6 +143,9 @@ const excludeAlliTokens = { ], kava: [ "0x9787af345e765a3fbf0f881c49f8a6830d94a514" // iUSX + ], + conflux: [ + "0x6f87b39a2e36F205706921d81a6861B655db6358" // iUSX ] }; @@ -154,6 +159,7 @@ const USXs = { "polygon": "0xCf66EB3D546F0415b368d98A95EAF56DeD7aA752", "avax": "0x853ea32391AaA14c112C645FD20BA389aB25C5e0", "kava": ADDRESSES.kava.USX, + "conflux": "0x422a86f57b6b6F1e557d406331c25EEeD075E7aA" }; async function getDFStakingValue(block) { @@ -274,6 +280,6 @@ module.exports = { ...chainTvl("ethereum"), staking, }, - ...generalizedChainExports(chainTvl, ["bsc", "arbitrum", "optimism", "polygon", "avax", "kava"]), + ...generalizedChainExports(chainTvl, ["bsc", "arbitrum", "optimism", "polygon", "avax", "kava", "conflux"]), start: 1564165044, // Jul-27-2019 02:17:24 AM +UTC } From ef3dbb177183c9c897c31238635ffd11080919ad Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 6 Jul 2023 15:55:33 +0200 Subject: [PATCH 0245/1974] track unicrypt v3 --- projects/helper/unwrapLPs.js | 21 +++++++++++++-------- projects/unicrypt-v3/index.js | 26 ++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 8 deletions(-) create mode 100644 projects/unicrypt-v3/index.js diff --git a/projects/helper/unwrapLPs.js b/projects/helper/unwrapLPs.js index cff2ca6b24e..6f1a101181d 100644 --- a/projects/helper/unwrapLPs.js +++ b/projects/helper/unwrapLPs.js @@ -188,6 +188,8 @@ async function sumLPWithOnlyOneTokenOtherThanKnown(balances, lpToken, owner, tok } await sumLPWithOnlyOneToken(balances, lpToken, owner, listedToken, block, chain, transformAddress) } + +const PANCAKE_NFT_ADDRESS = '0x46A15B0b27311cedF172AB29E4f4766fbE7F4364' async function unwrapUniswapV3NFTs({ balances = {}, nftsAndOwners = [], block, chain = 'ethereum', owner, nftAddress, owners, blacklistedTokens = [], whitelistedTokens = [], }) { if (!nftsAndOwners.length) { if (!nftAddress) @@ -196,14 +198,17 @@ async function unwrapUniswapV3NFTs({ balances = {}, nftsAndOwners = [], block, c case 'polygon': case 'optimism': case 'arbitrum': nftAddress = '0xC36442b4a4522E871399CD717aBDD847Ab11FE88'; break; - case 'bsc': nftAddress = '0x7b8a01b39d58278b5de7e48c8449c9f4f5170613'; break; + case 'bsc': nftAddress = [PANCAKE_NFT_ADDRESS, '0x7b8a01b39d58278b5de7e48c8449c9f4f5170613']; break; default: throw new Error('missing default uniswap nft address') } if ((!owners || !owners.length) && owner) owners = [owner] owners = getUniqueAddresses(owners, chain) - nftsAndOwners = owners.map(o => [nftAddress, o]) + if (Array.isArray(nftAddress)) + nftsAndOwners = nftAddress.map(nft => owners.map(o => [nft, o])).flat() + else + nftsAndOwners = owners.map(o => [nftAddress, o]) } await Promise.all(nftsAndOwners.map(([nftAddress, owner]) => unwrapUniswapV3NFT({ balances, owner, nftAddress, block, chain, blacklistedTokens, whitelistedTokens, }))) return balances @@ -276,8 +281,8 @@ async function unwrapUniswapV3NFT({ balances, owner, nftAddress, block, chain = amount1 = liquidity * (sb - sa) } - addToken({ balances, token: token0, amount: amount0, chain, blacklistedTokens, whitelistedTokens}) - addToken({ balances, token: token1, amount: amount1, chain, blacklistedTokens, whitelistedTokens}) + addToken({ balances, token: token0, amount: amount0, chain, blacklistedTokens, whitelistedTokens }) + addToken({ balances, token: token1, amount: amount1, chain, blacklistedTokens, whitelistedTokens }) } } @@ -397,7 +402,7 @@ async function sumTokens(balances = {}, tokensAndOwners, block, chain = "ethereu ethBalanceInputs = getUniqueAddresses(ethBalanceInputs, chain) if (ethBalanceInputs.length) { - if(chain === "tron"){ + if (chain === "tron") { const ethBalances = await Promise.all(ethBalanceInputs.map(getTrxBalance)) ethBalances.forEach(balance => sdk.util.sumSingleBalance(balances, transformAddress(nullAddress), balance)) } else { @@ -730,7 +735,7 @@ async function sumTokens2({ } } -function sumTokensExport({ balances, tokensAndOwners,tokensAndOwners2, tokens, owner, owners, transformAddress, unwrapAll, resolveLP, blacklistedLPs, blacklistedTokens, skipFixBalances, ownerTokens, resolveUniV3, resolveArtBlocks, resolveNFTs, }) { +function sumTokensExport({ balances, tokensAndOwners, tokensAndOwners2, tokens, owner, owners, transformAddress, unwrapAll, resolveLP, blacklistedLPs, blacklistedTokens, skipFixBalances, ownerTokens, resolveUniV3, resolveArtBlocks, resolveNFTs, }) { return async (_, _b, _cb, { api }) => sumTokens2({ api, balances, tokensAndOwners, tokensAndOwners2, tokens, owner, owners, transformAddress, unwrapAll, resolveLP, blacklistedLPs, blacklistedTokens, skipFixBalances, ownerTokens, resolveUniV3, resolveArtBlocks, resolveNFTs, }) } @@ -814,8 +819,8 @@ async function unwrap4626Tokens({ api, tokensAndOwners, }) { } async function unwrapConvexRewardPools({ api, tokensAndOwners }) { - const bals = await api.multiCall({ abi: 'erc20:balanceOf', calls: tokensAndOwners.map(([t, o]) => ({ target: t, params: o}))}) - const tokens = await api.multiCall({ abi: 'address:stakingToken', calls: tokensAndOwners.map(i => i[0])}) + const bals = await api.multiCall({ abi: 'erc20:balanceOf', calls: tokensAndOwners.map(([t, o]) => ({ target: t, params: o })) }) + const tokens = await api.multiCall({ abi: 'address:stakingToken', calls: tokensAndOwners.map(i => i[0]) }) api.addTokens(tokens, bals) return api.getBalances() } diff --git a/projects/unicrypt-v3/index.js b/projects/unicrypt-v3/index.js new file mode 100644 index 00000000000..2f840ee9833 --- /dev/null +++ b/projects/unicrypt-v3/index.js @@ -0,0 +1,26 @@ +const sdk = require('@defillama/sdk') +const { sumTokens2 } = require('../helper/unwrapLPs') +const { getCoreAssets } = require('../helper/tokenMapping') + +const config = { + ethereum: { reserves: ['0x231278edd38b00b07fbd52120cef685b9baebcc1'] }, + arbitrum: { reserves: ['0xfa104eb3925a27e6263e05acc88f2e983a890637'] }, + bsc: { reserves: ['0x0D29598EC01fa03665feEAD91d4Fb423F393886c'] }, +} + +module.exports = { + misrepresentedTokens: true, +} + +Object.keys(config).forEach(chain => { + const { reserves } = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const uniV3WhitelistedTokens = await getCoreAssets(api.chain) + const tempBalances = await sumTokens2({ api, owners: reserves, resolveUniV3: true, uniV3WhitelistedTokens, }) + const balances = {} // we multiple core assets value by 2 as positions are spread between 0 - ∞ + Object.entries(tempBalances).forEach(([token, balance]) => sdk.util.sumSingleBalance(balances, token, balance * 2)) + return balances + } + } +}) \ No newline at end of file From ad8227520f4310162e5d8290b8068e798b42b8ac Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 6 Jul 2023 19:32:49 +0530 Subject: [PATCH 0246/1974] Buffer (#6742) * Added pools * Removed BFR pool * minor fix --------- Co-authored-by: Heisenberg --- projects/buffer/index.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/projects/buffer/index.js b/projects/buffer/index.js index e08f44bc4d1..0fc7e8cd662 100644 --- a/projects/buffer/index.js +++ b/projects/buffer/index.js @@ -13,6 +13,7 @@ const contracts = { USDC_POOL_V1: "0x37Cdbe3063002383B2018240bdAFE05127d36c3C", USDC_POOL_V2: "0x4d338bc1a2380752736718f49bd45d9a040fdff8", USDC_POOL_V3: "0x6Ec7B10bF7331794adAaf235cb47a2A292cD9c7e", + USDC_POOL_V4: "0xfD9f8841C471Fcc55f5c09B8ad868BdC9eDeBDE1", POLY_POOL_V1: "0x6FD5B386d8bed29b3b62C0856250cdD849b3564d", ARB_POOL_V1: "0xaE0628C88EC6C418B3F5C005f804E905f8123833", BFR_STAKING: "0x173817F33f1C09bCb0df436c2f327B9504d6e067" @@ -27,22 +28,26 @@ module.exports = { contracts.USDC_POOL_V1, contracts.USDC_POOL_V2, contracts.USDC_POOL_V3, - contracts.ARB_POOL_V1 + contracts.ARB_POOL_V1, + contracts.USDC_POOL_V4 ] }) }, polygon: { tvl: sumTokensExport({ tokens: [tokens.USDC_POLY], - owners: [ - contracts.POLY_POOL_V1 - ] + owners: [contracts.POLY_POOL_V1] }) }, hallmarks: [ [Math.floor(new Date("2022-10-26") / 1e3), "Shifted to USDC POL pool"], - [Math.floor(new Date("2023-01-30") / 1e3), "Opened USDC BLP pool to the public"], + [ + Math.floor(new Date("2023-01-30") / 1e3), + "Opened USDC BLP pool to the public" + ], [Math.floor(new Date("2023-02-22") / 1e3), "Added a USDC Pool on polygon"], - [Math.floor(new Date("2023-03-22") / 1e3), "Added ARB Pool"] + [Math.floor(new Date("2023-03-22") / 1e3), "Added ARB Pool"], + [Math.floor(new Date("2023-04-14") / 1e3), "Added USDC Protocol owned liquidity Pool"], + [Math.floor(new Date("2023-06-14") / 1e3), "Added BFR Pool"] ] }; From 8ef80ba8991f04943b9e6b52145cc411a78f369e Mon Sep 17 00:00:00 2001 From: Elliot Shiu Date: Thu, 6 Jul 2023 12:06:28 -0700 Subject: [PATCH 0247/1974] sommelier: add fraximal cellar (#6746) --- projects/sommelier/index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/projects/sommelier/index.js b/projects/sommelier/index.js index fba01c1bd27..fd08f3c7e92 100644 --- a/projects/sommelier/index.js +++ b/projects/sommelier/index.js @@ -32,6 +32,7 @@ const REAL_YIELD_1INCH = "0xc7b69e15d86c5c1581dacce3cacaf5b68cd6596f"; const REAL_YIELD_UNI = "0x6a6af5393dc23d7e3db28d28ef422db7c40932b6"; const REAL_YIELD_SNX = "0xcbf2250f33c4161e18d4a2fa47464520af5216b5"; const REAL_YIELD_ENS = "0x18ea937aba6053bc232d9ae2c42abe7a8a2be440"; +const FRAXIMAL = "0xdbe19d1c3f21b1bb250ca7bdae0687a97b5f77e6"; const cellarsV2 = [ { id: DEFI_STARS, startBlock: 17181497 }, @@ -42,6 +43,7 @@ const cellarsV2 = [ { id: REAL_YIELD_UNI, startBlock: 17377190 }, { id: REAL_YIELD_SNX, startBlock: 17377190 }, { id: REAL_YIELD_ENS, startBlock: 17377190 }, + { id: FRAXIMAL, startBlock: 17589948 }, ]; async function tvl(timestamp, block, chainBlocks, { api }) { From 272a782390bcf7d36b841a2055ab025b26b353e5 Mon Sep 17 00:00:00 2001 From: mayfairfund <130176886+mayfairfund@users.noreply.github.com> Date: Fri, 7 Jul 2023 10:41:52 +0500 Subject: [PATCH 0248/1974] Update Mayfair adapter (#6745) * Update Mayfair adapter * mayfair: cache graph response --------- Co-authored-by: g1nt0ki --- projects/mayfair/index.js | 37 ++++++++++++++++++++++++++++++++----- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/projects/mayfair/index.js b/projects/mayfair/index.js index 57eb0a20889..191602a0f1e 100644 --- a/projects/mayfair/index.js +++ b/projects/mayfair/index.js @@ -1,11 +1,38 @@ -const { staking } = require('../helper/staking'); +const { request } = require("../helper/utils/graphql") +const { cachedGraphQuery } = require('../helper/cache') -const token = "0xf9df075716b2d9b95616341dc6bc64c85e56645c"; -const masterchef = "0x5F54638dade598B9c478EcaB330C3E62861d00C1"; +const { toUSDTBalances } = require("../helper/balances") + +const url = "https://squid.subsquid.io/mayfair-indexer/graphql" + +async function getStakingData() { + return await request(url, `query StakingAnalytics { + stakingPools(where: {id_eq: "0x3ad426dc2f005b721359a94f8b8d71b8890b3068-0"}) { + tvl + } + } + `) + +} +async function getStaking() { + let staking = 0 + const data = await getStakingData() + staking = data.stakingPools?.[0].tvl; + return toUSDTBalances(staking) +} + +async function tvl(_, _1, _2, { api }) { + const { balancerVaults: [{ pools }] } = await cachedGraphQuery('mayfair', url, `{ balancerVaults { pools{ id vaultId } } }`) + const data = await api.multiCall({ abi: 'function getPoolTokens(bytes32) view returns (address[] tokens, uint256[] balances, uint256 lastChangeBlock)', calls: pools.map(i => ({ target: i.vaultId, params: i.id })) }) + data.forEach(({ tokens, balances }) => api.addTokens(tokens.slice(1), balances.slice(1))) + return api.getBalances() +} module.exports = { + timetravel: false, + doublecounted: true, // tokens are in balancer pools arbitrum: { - tvl: () => 0, - staking: staking(masterchef, token) + tvl, + staking: getStaking } } From 8eed368a41a602c18880be16db0014fd44c93e9b Mon Sep 17 00:00:00 2001 From: CronosLabsDev <106642922+CronosLabsDev@users.noreply.github.com> Date: Fri, 7 Jul 2023 13:43:14 +0800 Subject: [PATCH 0249/1974] feat: add staked atom and vno (#6748) --- projects/venofinance/index.js | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/projects/venofinance/index.js b/projects/venofinance/index.js index 0f2fbd3d432..af33e240d25 100644 --- a/projects/venofinance/index.js +++ b/projects/venofinance/index.js @@ -1,9 +1,15 @@ const sdk = require('@defillama/sdk') +const { staking } = require("../helper/staking.js"); -async function tvl(timestamp, ethBlock, chainBlocks) { +const fountain_contract_address = "0xb4be51216f4926ab09ddf4e64bc20f499fd6ca95" +const reservoir_contract_address = "0x21179329c1dcfd36ffe0862cca2c7e85538cca07" +const vno_contract_address = "0xdb7d0a1ec37de1de924f8e8adac6ed338d4404e9" + +async function tvl(timestamp, ethBlock, chainBlocks, {api}) { const lcro_contract_address = '0x9Fae23A2700FEeCd5b93e43fDBc03c76AA7C08A6'; + const latom_contract_address = '0xac974ee7fc5d083112c809ccb3fce4a4f385750d'; const block = chainBlocks.cronos @@ -14,8 +20,16 @@ async function tvl(timestamp, ethBlock, chainBlocks) { chain: 'cronos' }) + const atom_pooled = await sdk.api.abi.call({ + abi: "uint256:getTotalPooledToken", + target: latom_contract_address, + block: block, + chain: 'cronos' + }) + return { - 'crypto-com-chain': Number(cro_pooled.output) / 1e18 + 'crypto-com-chain': Number(cro_pooled.output) / 1e18, + "cosmos": Number(atom_pooled.output) / 1e6 }; } @@ -24,6 +38,7 @@ module.exports = { misrepresentedTokens: false, methodology: 'TVL counts CRO staked by the protocol.', cronos: { - tvl + tvl , + staking: staking([fountain_contract_address, reservoir_contract_address], vno_contract_address) } } \ No newline at end of file From 7ca36df240909c04630e2591a3415343e6f7c597 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 7 Jul 2023 09:23:58 +0200 Subject: [PATCH 0250/1974] track pinnako.io --- projects/helper/coreAssets.json | 2 ++ projects/pinnako/index.js | 17 +++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 projects/pinnako/index.js diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index b9d589ae4ae..efd13935ce2 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -1267,6 +1267,8 @@ "era": { "WETH": "0x5aea5775959fbc2557cc8789bc1bf90a239d9a91", "USDC": "0x3355df6d4c9c3035724fd0e3914de96a5a83aaf4", + "WBTC": "0xBBeB516fb02a01611cBBE0453Fe3c580D7281011", + "USDT": "0x493257fD37EDB34451f62EDf8D2a0C418852bA4C", "BUSD": "0x2039bb4116B4EFc145Ec4f0e2eA75012D6C0f181" }, "polygon_zkevm": { diff --git a/projects/pinnako/index.js b/projects/pinnako/index.js new file mode 100644 index 00000000000..05273454765 --- /dev/null +++ b/projects/pinnako/index.js @@ -0,0 +1,17 @@ +const { sumTokensExport } = require('../helper/unwrapLPs') +const ADDRESSES = require('../helper/coreAssets.json') + +module.exports = { + era: { + tvl: sumTokensExport({ + owner: '0x87A43dfAB5068c9Ae2f75da2906559bc9A71b42d', + tokens: [ + ADDRESSES.era.WETH, + ADDRESSES.era.WBTC, + ADDRESSES.era.USDC, + ADDRESSES.era.USDT, + ] + }), + staking: sumTokensExport({ owner: '0x2A283C805D11ad77161Be0c503805a2b8Bc7Fd84', tokens: ['0xf8C6dA1bbdc31Ea5F968AcE76E931685cA7F9962'] }), + }, +} From 481b3ec48975400077e1936760d7aed9878a8c63 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 7 Jul 2023 10:01:45 +0200 Subject: [PATCH 0251/1974] refactor stackswap --- projects/arkadiko.js | 50 ++++++++++---------------- projects/helper/chain/stacks-api.js | 56 +++++++++++++++++++++++++++++ projects/helper/coreAssets.json | 4 +++ projects/helper/tokenMapping.js | 2 +- projects/stackswap/api.js | 38 ++++++++++++++++++++ 5 files changed, 118 insertions(+), 32 deletions(-) create mode 100644 projects/helper/chain/stacks-api.js create mode 100644 projects/stackswap/api.js diff --git a/projects/arkadiko.js b/projects/arkadiko.js index 3961e425040..681d706a4c1 100644 --- a/projects/arkadiko.js +++ b/projects/arkadiko.js @@ -1,39 +1,27 @@ -const { get } = require('./helper/http') -// node test.js projects/arkadiko.js -async function tvl() { - let balances = {}; - const dikoPrice = (await get("https://arkadiko-api.herokuapp.com/api/v1/tokens/diko"))["price_in_cents"]; - const response = (await get("https://arkadiko-api.herokuapp.com/api/v1/pools")); - - for (let pool of response.pools) { - balances[pool.token_y_name] = - pool.token_y_name in balances - ? Number(balances[pool.token_y_name]) + Number(pool.tvl_token_y) - : Number(pool.tvl_token_y); - balances[pool.token_x_name] = - pool.token_x_name in balances - ? Number(balances[pool.token_x_name]) + Number(pool.tvl_token_x) - : Number(pool.tvl_token_x); - } +const { sumTokens } = require('./helper/chain/stacks') - balances["blockstack"] = balances["wrapped-stx-token"] / 10 ** 6; - delete balances["wrapped-stx-token"]; - balances["usd-coin"] = balances["usda-token"] / 10 ** 6; - delete balances["usda-token"]; - balances["usd-coin"] = - Number(balances["usd-coin"]) + - Number(balances["arkadiko-token"] / 10 ** 8) * dikoPrice; - delete balances["arkadiko-token"]; - balances["wrapped-bitcoin"] = balances["Wrapped-Bitcoin"] / 10 ** 8; - delete balances["Wrapped-Bitcoin"] - - return balances; +async function tvl() { + // https://info.arkadiko.finance/balances + return sumTokens({ + owners: [ + 'SP2C2YFP12AJZB4MABJBAJ55XECVS7E4PMMZ89YZR.arkadiko-stx-reserve-v1-1', // stacks reserve + 'SP2C2YFP12AJZB4MABJBAJ55XECVS7E4PMMZ89YZR.arkadiko-sip10-reserve-v2-1', // other vaults + 'SP2C2YFP12AJZB4MABJBAJ55XECVS7E4PMMZ89YZR.arkadiko-stacker-v3-1', // PoX stackers + 'SP2C2YFP12AJZB4MABJBAJ55XECVS7E4PMMZ89YZR.arkadiko-stacker-2-v3-1', + 'SP2C2YFP12AJZB4MABJBAJ55XECVS7E4PMMZ89YZR.arkadiko-stacker-3-v3-1', + 'SP2C2YFP12AJZB4MABJBAJ55XECVS7E4PMMZ89YZR.arkadiko-stacker-4-v3-1', + 'SP2C2YFP12AJZB4MABJBAJ55XECVS7E4PMMZ89YZR.arkadiko-swap-v2-1', // swap tokens + ], + blacklistedTokens: [ + 'SP2C2YFP12AJZB4MABJBAJ55XECVS7E4PMMZ89YZR.wrapped-stx-token::wstx', + 'stacks:SP2C2YFP12AJZB4MABJBAJ55XECVS7E4PMMZ89YZR.arkadiko-token::diko', + 'SP2C2YFP12AJZB4MABJBAJ55XECVS7E4PMMZ89YZR.usda-token::usda', + ] + }) } module.exports = { - misrepresentedTokens: true, stacks: { tvl, }, }; -// node test.js projects/arkadiko.js diff --git a/projects/helper/chain/stacks-api.js b/projects/helper/chain/stacks-api.js new file mode 100644 index 00000000000..d0eebe8a3a3 --- /dev/null +++ b/projects/helper/chain/stacks-api.js @@ -0,0 +1,56 @@ +const stacks = require('@stacks/transactions') +const { StacksMainnet } = require('@stacks/network') + +const { bufferCVFromString, callReadOnlyFunction, uintCV, principalCV, } = stacks +let network + +const senderAddress = 'ST2F4BK4GZH6YFBNHYDDGN4T1RKBA7DA1BJZPJEJJ' + +function getNetwork() { + if (!network) + network = new StacksMainnet() + return network +} + +async function call({ target, abi, inputArgs = [], }) { + const [contractAddress, contractName] = target.split('.') + const network = getNetwork() + const result = await callReadOnlyFunction({ network, contractAddress, contractName, functionName: abi, functionArgs: inputArgs.map(toClairty), senderAddress}); + return stacks.cvToValue(result) + + function toClairty(arg) { + switch (arg.type) { + case 'string': return bufferCVFromString(arg.value) + case 'number': return uintCV(arg.value) + case 'principal': return principalCV(arg.value) + default: throw new Error(`Unknown type ${arg.type}`) + } + } +} + +module.exports = { + call, +} + +async function main() { + const result = await callReadOnlyFunction(options); + const result1 = await callReadOnlyFunction({...options, functionName: 'get-lp-data' }); + console.log(sTransactions.cvToValue(result)); + console.log(sTransactions.cvToValue(result1)); + console.log(sTransactions.cvToValue(await callReadOnlyFunction({ + contractAddress: 'SP1Z92MPDQEWZXW36VX71Q25HKF5K2EPCJ304F275', + contractName: 'stackswap-swap-v5k', + functionName: 'get-pair-count', + functionArgs: [], + network, + senderAddress + }))) + console.log(sTransactions.cvToValue(await callReadOnlyFunction({ + contractAddress: 'SP1Z92MPDQEWZXW36VX71Q25HKF5K2EPCJ304F275', + contractName: 'stackswap-swap-v5k', + functionName: 'get-pair-contracts', + functionArgs: [uintCV(5)], + network, + senderAddress + }))) +} diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index efd13935ce2..28828deac8c 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -1336,5 +1336,9 @@ "USDT": "0xff276c6bca1f66fd54a8915e830735d6ab0c7b09", "BTC": "0x935765ad27a1af00f73097c998a9fb721d2d7790", "ETH": "0xb4373ebb073a4dcba47e567d075a9583fa3c763e" + }, + "stacks": { + "WSTX": "SP1Z92MPDQEWZXW36VX71Q25HKF5K2EPCJ304F275.wstx-token-v4a", + "WBTC": "SP3DX3H4FEYZJZ586MFBS25ZW3HZDMEW92260R2PR.Wrapped-Bitcoin::wrapped-bitcoin" } } diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index b8ac7ef9957..f69b60cb0a9 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -56,7 +56,7 @@ const fixBalancesTokens = { }, ozone: { // '0x83048f0bf34feed8ced419455a4320a735a92e9d': { coingeckoId: "ozonechain", decimals: 18 }, // was mapped to wrong chain - } + }, } ibcChains.forEach(chain => fixBalancesTokens[chain] = { ...ibcMappings, ...(fixBalancesTokens[chain] || {}) }) diff --git a/projects/stackswap/api.js b/projects/stackswap/api.js new file mode 100644 index 00000000000..89c64945e2d --- /dev/null +++ b/projects/stackswap/api.js @@ -0,0 +1,38 @@ +const sdk = require('@defillama/sdk') +const { call } = require('../helper/chain/stacks-api') +const { transformDexBalances } = require('../helper/portedTokens') +const { getCache, setCache, } = require('../helper/cache') + +const factory = 'SP1Z92MPDQEWZXW36VX71Q25HKF5K2EPCJ304F275.stackswap-swap-v5k' + +module.exports = { + stacks: { tvl } +} + +async function tvl(_, _b, _cb, { api, }) { + const data = [] + const { value: pairCount } = await call({ target: factory, abi: 'get-pair-count' }) + const cache = await getCache('stackswap', 'stacks-config') + if (!cache.pairData) cache.pairData = [] + for (let i = cache.pairData.length +1; i <= pairCount; i++) { + const pair = await call({ target: factory, abi: 'get-pair-contracts', inputArgs: [{ type: 'number', value: i }] }) + cache.pairData.push(pair) + console.log('pair count: ', cache.pairData.length) + } + + await setCache('stackswap', 'stacks-config', cache) + let j = 0 + + for (const pair of cache.pairData) { + if (pair['liquidity-token'].value === 'SP1Z92MPDQEWZXW36VX71Q25HKF5K2EPCJ304F275.liquidity-token-v5krqbd8nh6') continue // ignore STSW-lBTC + const pairData = await call({ target: pair['liquidity-token'].value, abi: 'get-lp-data', }) + data.push({ + token0: pair['token-x'].value, + token1: pair['token-y'].value, + token0Bal: +pairData.value['balance-x'].value + +pairData.value['fee-balance-x'].value, + token1Bal: +pairData.value['balance-y'].value + +pairData.value['fee-balance-y'].value, + }) + console.log('pair data: ',++j) + } + return transformDexBalances({ chain: 'stacks', data}) +} \ No newline at end of file From 6cda695f11a1d0a2aa7c12dc195b6c75f6dd44b7 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 7 Jul 2023 10:07:44 +0200 Subject: [PATCH 0252/1974] minor fix --- projects/helper/portedTokens.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/helper/portedTokens.js b/projects/helper/portedTokens.js index 638a9a4adbe..47fac2291bc 100644 --- a/projects/helper/portedTokens.js +++ b/projects/helper/portedTokens.js @@ -141,6 +141,7 @@ async function getChainTransform(chain) { if (chain === 'cardano' && addr === 'ADA') return 'coingecko:cardano' if (chain === 'near' && addr.endsWith('.near')) return chainStr if (chain === 'tron' && addr.startsWith('T')) return chainStr + if (chain === 'stacks' && addr.startsWith('SP')) return chainStr if (chain === 'tezos' && addr.startsWith('KT1')) return chainStr if (chain === 'terra2' && addr.startsWith('terra1')) return chainStr if (chain === 'algorand' && /^\d+$/.test(addr)) return chainStr From 6ea77db81d98027852879327178ba35cf83b349f Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 7 Jul 2023 10:30:56 +0200 Subject: [PATCH 0253/1974] fix ashswap --- projects/ashswap/index.js | 35 ++++++++++++----------------------- 1 file changed, 12 insertions(+), 23 deletions(-) diff --git a/projects/ashswap/index.js b/projects/ashswap/index.js index 4a8b3ea71b3..7159c2e13d6 100644 --- a/projects/ashswap/index.js +++ b/projects/ashswap/index.js @@ -1,32 +1,21 @@ -const { request } = require("graphql-request"); -const { toUSDTBalances } = require('../helper/balances') +const { cachedGraphQuery } = require('../helper/cache') +const { sumTokens, sumTokensExport } = require('../helper/sumTokens') const API_URL = 'https://api-v2.ashswap.io/graphql'; -const TVLQuery = ` -{ - defillama { - totalValueLockedUSD +const TVLQuery = `query ashBaseStateQuery { + pools { + address } -} -` - -const StakingQuery = ` -{ - defillama { - totalValueStakedUSD + poolsV2 { + address } -} -` +}` async function tvl() { - const results = await request(API_URL, TVLQuery) - return toUSDTBalances(results.defillama.totalValueLockedUSD) -} - -async function staking() { - const results = await request(API_URL, StakingQuery) - return toUSDTBalances(results.defillama.totalValueStakedUSD) + const data = await cachedGraphQuery('ashswap', API_URL, TVLQuery) + const owners = Object.values(data).flat().map(i => i.address) + return sumTokens({ owners, chain: 'elrond'}) } module.exports = { @@ -34,6 +23,6 @@ module.exports = { timetravel: false, elrond: { tvl, - staking, + staking: sumTokensExport({ owner: 'erd1qqqqqqqqqqqqqpgq58elfqng8edp0z83pywy3825vzhawfqp4fvsaldek8'}), }, } \ No newline at end of file From defb7184b62bfb317036026c6c2b57ec260fe1d4 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 7 Jul 2023 10:39:11 +0200 Subject: [PATCH 0254/1974] fix quantumx --- projects/quantumx-network/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/quantumx-network/index.js b/projects/quantumx-network/index.js index 3dfa35b2504..38b4a8698aa 100644 --- a/projects/quantumx-network/index.js +++ b/projects/quantumx-network/index.js @@ -64,7 +64,7 @@ const getRealBalance = (balance1, decimal) => { const real = balance.dividedBy(divider, 10); return real.toNumber(); }; -const formatBalanceDolar = (token, price) => { +const formatBalanceDolar = (token, price = 0) => { if (token && token.balance) { const strBalance = token.balance; From 4c619dbcc39b67e841a6f67860cdf6d1027f7ca2 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 7 Jul 2023 10:59:55 +0200 Subject: [PATCH 0255/1974] update stackswap --- projects/stackswap.js | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/projects/stackswap.js b/projects/stackswap.js index 5be904df0b8..0038db1eaca 100644 --- a/projects/stackswap.js +++ b/projects/stackswap.js @@ -1,16 +1,7 @@ -const { get } = require('./helper/http') - -async function fetch() { - let poolValues = ( - await get("https://app.stackswap.org/api/v1/pools") - ) - .filter(p => p.pair_name !== 'STSW-lBTC') - .map(p => p.liquidity_locked); - poolValues = poolValues.map(v => v.substring(0, v.indexOf('USD'))); - return poolValues.reduce((a, b) => a + parseFloat(b), 0); -} +const { getExports } = require('./helper/heroku-api') module.exports = { - timetravel: false, - fetch, -}; + timetravel: false, + misrepresentedTokens: true, + ...getExports("stackswap", ['stacks']), +} From c441c34b605eb4a0cc32a5314bbba9d0e0d3c32e Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 7 Jul 2023 12:01:00 +0200 Subject: [PATCH 0256/1974] fix kassandra --- projects/helper/tokenMapping.js | 4 ++ projects/kassandra/index.js | 84 +++++++++++++++++++++++++++------ 2 files changed, 73 insertions(+), 15 deletions(-) diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index f69b60cb0a9..2f565faf4dd 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -54,6 +54,10 @@ const fixBalancesTokens = { rpg: { '0x8e8816a1747fddc5f8b45d2e140a425d3788f659': { coingeckoId: "tether", decimals: 18 }, }, + avax: { + '0x8fdcf51d1aaeb9f031838ebeb15884a0d5efcda3': { coingeckoId: "wrapped-bitcoin", decimals: 18 }, + '0xaa44678304cc1a848bfc31dc013afcc6c9feae11': { coingeckoId: "benqi", decimals: 18 }, + }, ozone: { // '0x83048f0bf34feed8ced419455a4320a735a92e9d': { coingeckoId: "ozonechain", decimals: 18 }, // was mapped to wrong chain }, diff --git a/projects/kassandra/index.js b/projects/kassandra/index.js index e24bb1eb02d..a9d8d4acb87 100644 --- a/projects/kassandra/index.js +++ b/projects/kassandra/index.js @@ -1,19 +1,73 @@ -const { postURL } = require('../helper/utils') +const sdk = require('@defillama/sdk') +const { getLogs } = require('../helper/cache/getLogs') +const { sumTokens2 } = require('../helper/unwrapLPs') +const abi = require('../aura-finance/abi.json') +const { stripTokenHeader } = require('../helper/tokenMapping') -async function fetch() { - const data = { - operationName: "TotalValueLocked", - variables: {}, - query: "query TotalValueLocked { factory (id: \"0x958c051B55a173e393af696EcB4C4FF3D6C13930\") { total_value_locked_usd } }" - } - const response = await postURL("https://graph.kassandra.finance/subgraphs/name/KassandraAvalanche", data); - return response.data.data.factory.total_value_locked_usd +const config = { + avax: { factory: '0x878fa1ef7d9c7453ea493c2424449d32f1dbd846', fromBlock: 10087927 }, } -module.exports = { - timetravel: false, - fetch, - avax: { - fetch, - } +const configBalancer = { + polygon: { factory: '0x228885c9d0440Ae640B88fBeE31522CC6a59Fd2F', fromBlock: 42020509 }, } + +Object.keys(config).forEach(chain => { + const { factory, fromBlock } = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const logs = await getLogs({ + api, + target: factory, + topics: ['0x2dcffae760adbb49d27552cdcd6cf9835c1a8e4545a5b123f8cac6d5a968b11b'], + eventAbi: 'event LogNewPool(address indexed caller, address indexed pool)', + onlyArgs: true, + fromBlock, + }) + const pools = logs.map(log => log.pool) + const tokens = await api.multiCall({ abi: 'address[]:getCurrentTokens', calls: pools }) + await sumTokens2({ api, ownerTokens: pools.map((pool, i) => [tokens[i], pool]) }) + if (chain === 'avax') { + const balances = api.getBalances() + const allTokens = tokens.flat().map(i => i.toLowerCase()) + const symbols = await api.multiCall({ abi: 'string:symbol', calls: allTokens, }) + const yrtTokens = allTokens.filter((token, i) => symbols[i] === 'YRT') + const depositTokens = await api.multiCall({ abi: 'address:depositToken', calls: yrtTokens}) + const deposits = await api.multiCall({ abi: 'uint256:totalDeposits', calls: yrtTokens}) + const supply = await api.multiCall({ abi: 'uint256:totalSupply', calls: yrtTokens}) + Object.entries(balances).forEach(([token, balance]) => { + const t = stripTokenHeader(token) + yrtTokens.forEach((yToken, i) => { + if (yToken === t) { + delete balances[token] + sdk.util.sumSingleBalance(balances, depositTokens[i], balance * deposits[i] / supply[i], api.chain) + } + }) + }) + return balances + } + } + } +}) + +Object.keys(configBalancer).forEach(chain => { + const { factory, fromBlock } = configBalancer[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const managedPoolFactory = await api.call({ target: factory, abi: 'address:managedPoolFactory'}) + const vault = await api.call({ target: managedPoolFactory, abi: 'address:getVault'}) + const logs = await getLogs({ + api, + target: factory, + topics: ['0x3bccd8755c586fb977facb52bc850861b8588643edb28cbfef711671791710e9'], + eventAbi: 'event KassandraPoolCreatedTokens (bytes32 indexed vaultPoolId, string tokenName, string tokenSymbol, address[] tokens)', + onlyArgs: true, + fromBlock, + }) + const poolIds = logs.map(log => log.vaultPoolId) + const data = await api.multiCall({ abi: abi.getPoolTokens, calls: poolIds, target: vault}) + data.forEach(({ tokens, balances}) => api.addTokens(tokens.slice(1), balances.slice(1))) + return api.getBalances() + } + } +}) \ No newline at end of file From ace3746afd4850a830dffaa7edf198c0e393d78d Mon Sep 17 00:00:00 2001 From: MFIL <120017544+MFILDAO@users.noreply.github.com> Date: Fri, 7 Jul 2023 18:01:36 +0800 Subject: [PATCH 0257/1974] MFIL Update index.js (#6751) MFIL DAO updated the MFIL smart contract --- projects/MFIL/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/MFIL/index.js b/projects/MFIL/index.js index 6b16adf990a..c071cd8ff0d 100644 --- a/projects/MFIL/index.js +++ b/projects/MFIL/index.js @@ -1,5 +1,5 @@ -const MFILPOOLCONTRACT = '0x72A57760aE548B8d1B3a1b29bE25D2f09a6cB558'; -const MFILREGULARPOOLCONTRACT = '0xDcECF046dd21A7298Eb3c0a3c70d716999E7A607' +const MFILPOOLCONTRACT = '0x8aF827CDa3b7Eee9720496A30595D7Ee89A27ee2'; +const MFILREGULARPOOLCONTRACT = '0xD4f7c1A09ed5f50a3eC2F1e9fcF8B1bc2d1d3d70' const ADDRESSES = require('../helper/coreAssets.json') async function mfilTvl(_, _1, _2, { api }) { From e42d511899317f80d9c43a496376a015f74a4ca0 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 7 Jul 2023 15:33:22 +0530 Subject: [PATCH 0258/1974] Arcadia-fi (#6747) * :tada: Add tvl * Update projects/arcadia-finance/index.js Co-authored-by: Jasper <104004836+j-vp@users.noreply.github.com> * code refactor * arcadia-fi: count only available liquidity in lending pool * Update projects/arcadia-finance/index.js Co-authored-by: zeki --------- Co-authored-by: zeki Co-authored-by: Jasper <104004836+j-vp@users.noreply.github.com> Co-authored-by: g1nt0ki --- projects/arcadia-finance/helper/abi.json | 8 +++++ projects/arcadia-finance/helper/index.js | 38 ++++++++++++++++++++++++ projects/arcadia-finance/index.js | 9 ++++++ 3 files changed, 55 insertions(+) create mode 100644 projects/arcadia-finance/helper/abi.json create mode 100644 projects/arcadia-finance/helper/index.js create mode 100644 projects/arcadia-finance/index.js diff --git a/projects/arcadia-finance/helper/abi.json b/projects/arcadia-finance/helper/abi.json new file mode 100644 index 00000000000..f12130f7db1 --- /dev/null +++ b/projects/arcadia-finance/helper/abi.json @@ -0,0 +1,8 @@ +{ + "totalRealisedLiquidity": "uint128:totalRealisedLiquidity", + "totalUnrealisedLiquidity": "uint256:calcUnrealisedDebt", + "vaultLength": "uint256:allVaultsLength", + "vaultAddress": "function allVaults(uint256) view returns (address)", + "assetData": "function generateAssetData() view returns (address[], uint256[], uint256[])", + "assetsInPricingModule": "function assetsInPricingModule(uint256) view returns (address)" +} \ No newline at end of file diff --git a/projects/arcadia-finance/helper/index.js b/projects/arcadia-finance/helper/index.js new file mode 100644 index 00000000000..cc4aaaf409a --- /dev/null +++ b/projects/arcadia-finance/helper/index.js @@ -0,0 +1,38 @@ +const { sumTokens2 } = require('../../helper/unwrapLPs') +const abi = require("./abi.json") + +const config = { + optimism: { + factory: "0x00CB53780Ea58503D3059FC02dDd596D0Be926cB", + pools: { + wethPool: "0xD417c28aF20884088F600e724441a3baB38b22cc", + usdcPool: "0x9aa024D3fd962701ED17F76c17CaB22d3dc9D92d" + } + }, + ethereum: { + factory: "0x00CB53780Ea58503D3059FC02dDd596D0Be926cB", + pools: { + wethPool: "0xD417c28aF20884088F600e724441a3baB38b22cc", + usdcPool: "0x9aa024D3fd962701ED17F76c17CaB22d3dc9D92d", + } + } +} + + +async function tvl(_, _b, _cb, { api, }) { + const { chain } = api + let { factory, pools } = config[chain] + pools = Object.values(pools) + const poolAssets = await api.multiCall({ abi: 'address:asset', calls: pools }) + + const vaults = await api.fetchList({ lengthAbi: abi.vaultLength, itemAbi: abi.vaultAddress, target: factory, }) + const assetData = await api.multiCall({ abi: abi.assetData, calls: vaults, }) + + assetData.forEach((assetsInVaults) => api.addTokens(assetsInVaults[0], assetsInVaults[2])) + + return sumTokens2({ api, tokensAndOwners2: [poolAssets, pools, ]}) +} + +module.exports = { + tvl, +}; \ No newline at end of file diff --git a/projects/arcadia-finance/index.js b/projects/arcadia-finance/index.js new file mode 100644 index 00000000000..ffb07c2bfd0 --- /dev/null +++ b/projects/arcadia-finance/index.js @@ -0,0 +1,9 @@ +const { tvl, } = require("./helper"); + +module.exports = { + methodology: + "TVL includes ERC-20 tokens that have been supplied as collateral as well as ERC-20 tokens that are supplied by liquidity providers.", + optimism: { tvl }, + ethereum: { tvl }, + start: 1686391200 // Jun 10 2023 10:00:00 GMT+0000 +} \ No newline at end of file From 31ea9dcac297ba7920add8987453912654f2a4b3 Mon Sep 17 00:00:00 2001 From: Pham Anh Minh <93236465+phamminh0811@users.noreply.github.com> Date: Fri, 7 Jul 2023 17:42:17 +0700 Subject: [PATCH 0259/1974] Osmosis - Quasar add ICA adaper (#6708) * add tvl for quarsar * revert minh pr * add tvl for quarsar * add quarsar chain and change calculate lock on lpStrategyContracts * update pool contract * fix misspell quasar * add ica osmosis * minor fix * remove double counting --- projects/quasar/index.js | 67 ++++++++++------------------------------ 1 file changed, 16 insertions(+), 51 deletions(-) diff --git a/projects/quasar/index.js b/projects/quasar/index.js index bfd5c7a9adf..068a5a1689c 100644 --- a/projects/quasar/index.js +++ b/projects/quasar/index.js @@ -1,5 +1,4 @@ -const axios = require("axios"); -const { endPoints, queryContract } = require('../helper/chain/cosmos') +const { queryContract } = require('../helper/chain/cosmos') const sdk = require('@defillama/sdk') const chain = 'quasar' @@ -15,9 +14,6 @@ const lpStrategyContracts = { "quasar1suhgf5svhu4usrurvxzlgn54ksxmn8gljarjtxqnapv8kjnp4nrsmslfn4", "quasar1ma0g752dl0yujasnfs9yrk6uew7d0a2zrgvg62cfnlfftu2y0egqx8e7fv", ], - 704: [ - "quasar1yyca08xqdgvjz0psg56z67ejh9xms6l436u8y58m82npdqqhmmtqk5tv30", - ], 803: [ "quasar1jgn70d6pf7fqtjke0q63luc6tf7kcavdty67gvfpqhwwsx52xmjq7kd34f", "quasar1t9adyk9g2q0efn3xndunzy4wvdrnegjkpvp382vm2uc7hnvash5qpzmxe4", @@ -34,25 +30,26 @@ const lpStrategyContracts = { ], } - async function tvl() { const api = new sdk.ChainApi({ chain: 'osmosis' }) for (const poolID in lpStrategyContracts) { let lpContracts = lpStrategyContracts[poolID]; - let poolEndpoint = `${endPoints['osmosis']}/osmosis/gamm/v1beta1/pools/${poolID}`; - const poolData = (await axios.get(poolEndpoint)).data.pool; - for (const contractAddress of lpContracts) { - let lp_shares = await queryContract({ - contract: contractAddress, - chain: chain, - data: { 'lp_shares': {} } - }); - - let amount = calculateTokenAmounts(poolData, lp_shares['lp_shares']['locked_shares']) - for (const denom in amount) { - api.add(denom, amount[denom]) + try { + let ica_balances = await queryContract({ + contract: contractAddress, + chain: chain, + data: { 'ica_balance': {} } + }); + + let denom = ica_balances.amount.denom; + let amount = Number(ica_balances.amount.amount); + + api.add(denom, amount) + } catch (e) { + console.log(e) + continue; } } } @@ -60,42 +57,10 @@ async function tvl() { return api.getBalances() } - -function calculateTokenAmounts(poolData, gammAmount) { - // Extract the total pool shares. - let totalShares = poolData.total_shares.amount; - - // Initialize an object to hold the amounts of each token. - let tokenAmounts = {}; - - // For each token in the pool... - if (typeof poolData.pool_assets !== "undefined") { - for (let asset of poolData.pool_assets) { - // Extract the token's denom and amount. - let denom = asset.token.denom; - let assetAmount = asset.token.amount; - - // Calculate the amount of this token that corresponds to the given amount of pool shares. - tokenAmounts[denom] = (gammAmount * assetAmount) / totalShares; - } - } else { - for (let asset of poolData.pool_liquidity) { - // Extract the token's denom and amount. - let denom = asset.denom; - let assetAmount = asset.amount; - - // Calculate the amount of this token that corresponds to the given amount of pool shares. - tokenAmounts[denom] = (gammAmount * assetAmount) / totalShares; - } - } - - return tokenAmounts; -} - module.exports = { timetravel: false, methodology: "Total TVL on vaults", - quasar: { + osmosis: { tvl, }, } \ No newline at end of file From e00e0a3c3bfb0759259b346e0c4754b1c9557f14 Mon Sep 17 00:00:00 2001 From: define Date: Fri, 7 Jul 2023 11:46:42 +0100 Subject: [PATCH 0260/1974] add eth to davos (empty pool?!) --- projects/davos-protocol/index.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/projects/davos-protocol/index.js b/projects/davos-protocol/index.js index fb8b23e6a4d..930d905b680 100644 --- a/projects/davos-protocol/index.js +++ b/projects/davos-protocol/index.js @@ -6,5 +6,13 @@ module.exports = { tvl: sumTokensExport({ chain: 'polygon', owner: '0x5E851dC1f56A05Bb6d3C053FA756304a5171C345', tokens: [ '0x0E9b89007eEE9c958c0EDA24eF70723C2C93dD58', // ankrMATIC ] }), + }, + ethereum: { + tvl: sumTokensExport({ chain: 'ethereum', owner: '0x819d1Daa794c1c46B841981b61cC978d95A17b8e', tokens: [ + '0x7f39c581f595b53c5cb19bd0b3f8da6c935e2ca0', // WSTETH + '0xae78736cd615f374d3085123a210448e74fc6393', //reth + '0x9ee91f9f426fa633d227f7a9b000e28b9dfd8599', //stmatic + '0xac3e018457b222d93114458476f3e3416abbe38f', //SFRXETH + ] }), } } From 36a468d7d5345e2cb3c318df17420e1cecce62ac Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 7 Jul 2023 12:58:01 +0200 Subject: [PATCH 0261/1974] track radiate-protocol --- projects/radiate-protocol/index.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 projects/radiate-protocol/index.js diff --git a/projects/radiate-protocol/index.js b/projects/radiate-protocol/index.js new file mode 100644 index 00000000000..6e1c94227fd --- /dev/null +++ b/projects/radiate-protocol/index.js @@ -0,0 +1,17 @@ +const { sumTokens2 } = require('../helper/unwrapLPs') + +async function tvl(_, _b, _cb, { api, }) { + const vault = '0xC6dC7749781F7Ba1e9424704B2904f2F94D3eb63' + const dlp = await api.call({ abi: 'address:dlp', target: vault}) + const masterchef = await api.call({ abi: 'address:mfd', target: vault}) + const { total }= await api.call({ abi:"function lockedBalances(address user) view returns (uint256 total, uint256 unlockable, uint256 locked, uint256 lockedMultiplier, tuple(uint256 amount, uint256 unlockTime, uint256, uint256)[] lockData)", target: masterchef, params: vault }) + api.add(dlp, total) + return sumTokens2({ owner: vault, tokens: [dlp], api}) +} + +module.exports = { + doublecounted: true, + arbitrum: { + tvl, + }, +} \ No newline at end of file From 6269c7c377a949afa38db837147d3bb8ecccb62b Mon Sep 17 00:00:00 2001 From: "yepp4you - EOSeoul.io" Date: Fri, 7 Jul 2023 15:03:41 +0400 Subject: [PATCH 0262/1974] add new stake address on Klaytn (#6753) --- projects/neopin-staking/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/neopin-staking/index.js b/projects/neopin-staking/index.js index dbb6fc8cab2..08f1f6abcf7 100644 --- a/projects/neopin-staking/index.js +++ b/projects/neopin-staking/index.js @@ -11,6 +11,7 @@ module.exports = { '0xDa664b81C13b050F9b0435D0B712218Aa8BB1609', '0x0D3ACA076712DE598DF856cEcEF76daD38F0A75b', '0xf9d92BAd7b1410dfFB0a204B7aa418C9fd5A898F', + '0xf20816C9bdcb25da3ba79b206e9b7107ae02ae10' ], tokens: [nullAddress], }), From 0ee653a52e705440c925079a8d7a690015f7772c Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 7 Jul 2023 13:04:21 +0200 Subject: [PATCH 0263/1974] lint fix --- projects/helper/chain/stacks-api.js | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/projects/helper/chain/stacks-api.js b/projects/helper/chain/stacks-api.js index d0eebe8a3a3..e61045874e9 100644 --- a/projects/helper/chain/stacks-api.js +++ b/projects/helper/chain/stacks-api.js @@ -31,26 +31,3 @@ async function call({ target, abi, inputArgs = [], }) { module.exports = { call, } - -async function main() { - const result = await callReadOnlyFunction(options); - const result1 = await callReadOnlyFunction({...options, functionName: 'get-lp-data' }); - console.log(sTransactions.cvToValue(result)); - console.log(sTransactions.cvToValue(result1)); - console.log(sTransactions.cvToValue(await callReadOnlyFunction({ - contractAddress: 'SP1Z92MPDQEWZXW36VX71Q25HKF5K2EPCJ304F275', - contractName: 'stackswap-swap-v5k', - functionName: 'get-pair-count', - functionArgs: [], - network, - senderAddress - }))) - console.log(sTransactions.cvToValue(await callReadOnlyFunction({ - contractAddress: 'SP1Z92MPDQEWZXW36VX71Q25HKF5K2EPCJ304F275', - contractName: 'stackswap-swap-v5k', - functionName: 'get-pair-contracts', - functionArgs: [uintCV(5)], - network, - senderAddress - }))) -} From d111e99578b6f2632dbad37bd11004984845da3f Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 7 Jul 2023 14:48:55 +0200 Subject: [PATCH 0264/1974] harcode grim --- projects/grim/config.json | 539 ++++++++++++++++++++++++++++++++++++++ projects/grim/index.js | 124 +-------- projects/helper/utils.js | 2 +- 3 files changed, 551 insertions(+), 114 deletions(-) create mode 100644 projects/grim/config.json diff --git a/projects/grim/config.json b/projects/grim/config.json new file mode 100644 index 00000000000..d98d1d2cdb2 --- /dev/null +++ b/projects/grim/config.json @@ -0,0 +1,539 @@ +{ + "telos": [ + "0x5E9054c2eeCB9Dd9BC5818E9aE314070c92a9Dbb", + "0x8cAC1868B06A6B53181E497611c8496a96D72A8c", + "0x4Dc1B8dEee2aA42b2e6eC2c6C53d7f7D3fac3e9A", + "0x60DC3d4a7866E1F2802Fc851aC2AF12da4D65Cf1", + "0xB3e34c8046AFC1F7dE0F6f2C0d3140647AD58b30", + "0x6272593eEE38eC7F7F80f971250F39F34FE839ab", + "0x7AfB0Bc08873219d2b8F4Ee44312102e0a1A91d5", + "0xD52C0c24F47D06C5c3Bf41A610d7b591980e201c", + "0x69FE9896f7653BB1961bfCE4D01F3416f59f803E", + "0xaa5eE9cFc6c53419845867d5c4fE361c59D2a9bc", + "0x37CE0654FA0A5D7720b488f18B7c11f5b721BEC3", + "0x9a8d575B3f1Fc91Db2F29c4E87E48F528A3510B9", + "0x0Be694BBA360a5c375622aAf9e31EE82a95b680B", + "0xEcb20d5691E4eac894F4BD8f2A84b2c76BD49f67", + "0xFB65Af3cF542E356C16065467937BF90BB7B54BB", + "0xEC45eDc98243f9DaB8E8C738Aa51910075A0d90F", + "0x87EFdAe3fE46a861ec96fD5ffB5e4C5DDc8f9e79", + "0xeDb1A44fCBC18B0bc8998112b9a987E417bbb23b", + "0xF9c03F4042d4A5F2807A93381A8F7d68e93FD9B2", + "0x173630Ff7c7763DbcD9B38b03c2870B5d51dDB80", + "0xB0c5d5b4a59Ac769f54114D836e1530991da3863", + "0x9F8F4Ffe23Ff4bD7D64F82e60B046002dDCB6684", + "0x4b742d7f8E6E6911a9674EBB00cD6DEEf3091Afa", + "0xdf86120116F04E004f7EDF9B67e40452e08D5774" + ], + "polygon": [ + "0xEfA6e06B557ECF6b328bFffC361D559F4476c26b", + "0xa12e5A6f7968AE09a28e88D978Cae050751C06A5", + "0xBcDd8E50e2109cea403c9a7b88cdBD4c6F8F2045", + "0x00187581AAD2bf25724774676a6B22021Fe8b0C9", + "0x7F37f76d390eCFf2e9832C83fA70c1A1a53C40d8", + "0xbf5953bA9CD32c44e19795c17bC50Ff7369759e5", + "0x553F75622cF944b85f17Be3B53Cd17CE40798984", + "0x289Eb918eaD4cddaeCDE64f946569115E01Ba958", + "0x94118a1752cE651e8e4Ea21620C4da46D8f143d4" + ], + "fantom": [ + "0x54369163e3dE8D993A93f45946DFdadFED1E7Eb4", + "0x5a1d96F0ee43167B58234Bb81e008d3892639f0a", + "0x8Cf9E920AEF195C8D9024269699D762b0685C89c", + "0x6ab4a69a6E43D50f265F0619962F989B6615b7BC", + "0x3ae73a25532be8a67bAa2Cf2aDB765d63443d80D", + "0xAc38fB48A022971112019a40f2AcbB5b77bFB891", + "0x3e2e5AEf7Cea5606204d79616D0cdf8D5AcE385e", + "0x23869f49B5093aaaD5EDaF839B2C37707216b741", + "0x26CE39D79C3F13c6131B8B45577C87f9bB562857", + "0xB92D48c8896965c6eA7a04725F08564A2313D101", + "0x8410903237F9929146dcE683e7921CEA50547689", + "0x053365e9aeB14424a58c14117FEb6D760c0384e9", + "0x7964cd13E81F3B72d9E24FeA428772C29048f715", + "0x7d5196ed6F7E30B43297d5356ba31f3DE7a66827", + "0x66334e72Ba358b79cC2EBd0282c1d8949BFC7564", + "0x61f5d294D71Be47BB0Cb1C2430ECE5605EBA3734", + "0x4Bd6372d9b6e76ef55268b03e80C35b5BF743B62", + "0x40c3C7E16c5faFBAcD2F4f6A58858850d59a5a8e", + "0x30D89125F2b90942Ad77a7631481E0B49f449c13", + "0xb2cf157bA7B44922B30732ba0E98B95913c266A4", + "0xfD6DDdf0C9e6C5a7A518e6Cbfbc222cb2991a2B3", + "0x462aDf50aE6195f46430177450CdFB6eC742A0E5", + "0xf990AC8242FdB9De467A6e5E2b01CC08dC654717", + "0xD94C7DEd80CfA4650Dc61Ab483AF74df0d96f745", + "0x4edC791ddE70914B2C9179934ECaedFd539e1b0c", + "0xb6662bb1b66B75bE8A0cecFe5af08A1DcD46Cf82", + "0xc6493cE516CD3586bB77b41E1A410c6d8B0A305B", + "0x91B7c20330321095668Af86Fa746A7F1852fB190", + "0x6Cec287a3bF06b0d142777B2514FA419910BBC26", + "0x937576F8D178c2ea422b71016800916a1770c439", + "0x60Eba06eD584D1F1bd6620905Da36332D85422e6", + "0x104Bc733788AF33E674a676a227d273806AD958d", + "0xa3e348136D9F8A14300380225756BA6eAF40265d", + "0x18B19e727016409d7f76B0414A84c216Acd99185", + "0x2174f2aB95368B668971f0Ec015F82392d3ceAc1", + "0x6AbAb058747283B3E95BD987AB83B95e689Be3eE", + "0xfBBb8aeB8865fd776485Fd45bc96665E239c908a", + "0x21a5484D889DdEBCb9d192b5B96A794CA4147c91", + "0x7e8D2d029199a86950c733CbbC6d8160Cd21486C", + "0x883D002b2147CE081894f74a846F81FF97b141c2", + "0x10149fDf20A92822a5cBAf21eF9a4484238769F2", + "0x3E4Ea4d16233A5D5236739a8fe632b6b5848DA9e", + "0x54788611767AF25f0De57411354F111B5D9C6DEf", + "0xec0965D89C9E237b9BF0c8f6ed1e09314f5097E0", + "0xa0E9d69249E6AF75779EaB029d1ea3BaA7F2b381", + "0x9200Ac9C17EF8Ad1Ea16fDc63B8460e1F10d8eF4", + "0x9B30315e701945eBB855326f53335F717E4921d2", + "0xE1F9d163C2Fc5761a2860ae590E748BBEfAf39dA", + "0x9f68852dD559484e6BE2d034CEBfBF5d62B54449", + "0xc68048525bfC1a49910e740424399E10eef6dff9", + "0x829C25Bb47f35C02150E2cBBD0C962E5b7B02687", + "0x7f0f5C79b64d0544549c8FfDA52576d00963B15E", + "0x5253ea466157a498d195E1aDB3e19a6F5a97dEfb", + "0xc53103820Bbbeb0BE0592022C3d4d806D07F8610", + "0x43b99CC4384b3F0B384e81D8db2C763fBD6fd314", + "0x127Da0f069bc55410E551bf574438E757Df695dc", + "0x3cfdD338061fEE8523c75e372fc7D88033141eC4", + "0xBc9cad78f31F213A7a91C6f7C589081983398733", + "0xeC6F0E53597fb2e6d4b1a2B48743D52B662CDa24", + "0xbF1fB5E256c7C8D262e866EF20beFc72eD9fA633", + "0x3d9f39Bb535650b04d4B5Eb23bbA8609C117a695", + "0x3FB82257BBBA5A56aE748f1e1BE8A06127D45069", + "0x67769663Ea046dD2F3747827755ADd1694eff9d5", + "0xe30d25c275dA2cb8a8911BFB7cE9e59E227F80E0", + "0xD2752EB1794C4a1b7891feF1e1376B9C9c2FB2DA", + "0x56AFfc8EB077182157e90106B7924e089E86adcD", + "0xeC649a0Fc3D6af24d21ae9059DA1FFF4c9e6E727", + "0x94118a1752cE651e8e4Ea21620C4da46D8f143d4", + "0xe0BA4Bd9211e840e3B7b8B46816f247484916fE2", + "0xa21dD344EA44306e32582EB372B1e91B196e62FB", + "0xEA751A395725E54251308AE2DC5741E5EB4Bb5D0", + "0x3e739671De3B0321BA219fAA7468E5d349331BDA", + "0x67c35B10BB74e035EE062bbCa570c42B11893c71", + "0xa8D2Bee3C6FBc33c77814C208A420A3A8862c09B", + "0x77B76f8a50b4Beb89210E1e6194299243F334B03", + "0xEd83EFF17258cbB2d2a22579D1B001A8e9ae2e83", + "0xd70755B67dE0DeDC0fa749D47fF59ff61bB46933", + "0xdFE426842d07957c9e661794822dB12adc20b856", + "0xeDb1A44fCBC18B0bc8998112b9a987E417bbb23b", + "0xc9e80a3b7D26FF46b8A2F22D4a09E94f42e33039", + "0x126905C4708E55759A63F97D4D47c9E94FcEcB24", + "0x203166db0B7bdDa7a04440c7A0C1E8a8eEd0f11f", + "0xF9cDc12e329247639AC20fC2a2B9CCcAB0d85A4e", + "0xD82d0Cd391b8A1DEa50B9b4E79F02AA66Ee4BeDE", + "0x43691B5a3099365a32644c4216d9EA65cCD41B51", + "0x61373471A5CFaA25C3C7c291d8dc9b45989a8886", + "0x26D27a565865133c8Be4b7B28A1633B4D61bA852", + "0x73f0a7723c193C365Ae413D419EfD6E8e618Bbfe", + "0xb2229CC7a41CC7e5c3564982Cd48B06afFB49a09", + "0x97Fe4cFAeeCA2d0Cb54d8c88bD2D951eEb0C8Da4", + "0x1Bfe85c94bE740C9A8bd4423CfC03EdaB01E17D1", + "0x450b1f5D7872797A5704b1DBdc4042e22E28A495", + "0x6f5362bCAd5F3028FFb9D4575ef17D3e02AaE84b", + "0xe31d2Dba9ec60D0aE5653E967775D7113F75f3bF", + "0x207EC95A4d29b0AEAc7806f3B9FDd39Ce14b5Ff9", + "0x7a1467bb7026baD391d191D49a8B22D0c1E1DDF5", + "0xe9831B5A49D0193002ef4289E8a500438D26EdcC", + "0x341292523DFC4c46300B578D8E7825a83F092a09", + "0x2CeC649c9B5373dA72eF384A8c8340eFfAdcEaE2", + "0x6300ad0C0f0658caFB4D54688aeC30566f71A631", + "0x1A15885096CFE677E2Cd36e64A5FD4f8Fe7e96E1", + "0x8aD0A5159812A3A091E52F0Ee1FDFB8808Be238A", + "0x39768e3055399f05838Fd119eda229655610428b", + "0x373070fAaC2C75eE58Fda6f951a68494219dCda2", + "0x10CA611E52EAeA024535344BD3e1d651b9FaC184", + "0x8B0717362e7ddAf29d38235EB512Fd25C7A1E068", + "0x32C761d3B89e1878753279A4852a919950d448B9", + "0xb76F8dB409F3fe3F0cAA8E4922eEa6896a1A6171", + "0x71cb11349C43b482F654E5F38DC0331B3dD991FB", + "0x0626BE90ed887BC23AF94b546b49CF49521fE0d8", + "0x6c825D8AC98B98f7Ce2d4122154ece3f14188975", + "0x4080D6A1c828456aC4a9AdC8B60df6F4DE942B25", + "0x02392c98D9460DbfD564C04cFC6621d349B90C79", + "0x17cD27740580eA4F5773d4aa50D9E93579b02Dd5", + "0x4F25b50fd0aC12169323c07B693ad9aad6771670", + "0x259a7B98b07e0A8e3d51062901827F50D1462485", + "0x315E0B4C53EDE4DD721C8aad67794678595693F7", + "0x86B9e162C777ea108e7df6461Dd2644cA3A5fe32", + "0xd9F87DeC7dE788BcFc808Cd1c309dB37D977ACCA", + "0x15800c351a38d56d012189f21231e170c48a9764", + "0x86f50144077A62e2b2dd8514B3F06a7bC416eaE6", + "0xA74C821C224A85559c5bba7B76147bBcffEE32f4", + "0x7172A3F5453f453a6D0fb77327ae9209CFC5B519", + "0xd924B1adb80bf30fA49e54EAF9631cFFbBF29fc5", + "0x553899EAf7627bD4DDe54939F5d7791cc0986a9e", + "0xA74e3842b68a71789c8861F418d4F7c61b5f4f61", + "0x4096a34E71045d7B46205dBcf537a4bABD1fbA4B", + "0x89133D25aA5a1d935C5143A3Fc129E7FBdDc9F2c", + "0x0c2AEd118c234aB8adA5a268600FCde97211E9E0", + "0x35B04ADBa055f93AfB55C4aDcb1733E027007dC0", + "0x0b9A63D20dC2F104494FdCd9EdBd7e40d572f349", + "0xE315E491676170e2bE9ebAb022892b500e88E01b", + "0x10aA9E9446ed31B75df5B7F301235A7C5087b711", + "0x4Ea0C774620de22650F15f8f62B333780381DfDD", + "0xDFB65caDda2101a7B6c0B90D296d6A9c1B724A14", + "0x940C9Ba3113fcF75B87Dd46eB03DD023fc600816", + "0x0385131a643d2Eb15765297E0b48207aadbb0A5A", + "0x9883D89F48f0B4A88039cac78eD2A3081A66c2DC", + "0x2f5e44871ccbe7F53e4a812dF76e6417A2b36665", + "0xBabEC3e43C72b85741DEe9F3b6e98af83DF62FEc", + "0x8f4ce599b7A6c647913D7Ef111295d3a4bC8c006", + "0x19F823835650524571B2Efd83971Dc827ab7364A", + "0xe524fB2ad520aF3eD9Dce6D8Ea6E81b6752beFb2", + "0xBB0e625446F7519677db2aa0B5fc9949940b3D3b", + "0xe45C42ED2fa8bC48317c75227a91D8B49198FeD3", + "0x6B889C90D0Bfb856857a83ed02214A02FEE7fA46", + "0x0Cdb6366D8aE177AA273a866865baF4e058cdeB9", + "0x70b07305d17ad51ac8A81eaeDbbc2dA5DB12Fa84", + "0x3579a2711862e561973CbF28bC492b167CEBb8CF", + "0xf44b9aBCc5100DC22B33ac719c632bd1EEC5274d", + "0xDD8ed6392AF61e76BF3f17132A071756fDd094eE", + "0x8d008Aa4FF29733Bf09032cfd45979cE63c71969", + "0x55EcC8387232729ace7b15cD4EB55aaBF392F154", + "0xF20Cd3f92B99B4Bdc21b3C2ED7608267d4089abf", + "0x2487568947Dd2d03292a7F2Bd59485AaC8F00Afc", + "0x2Cb16567F59560C8F818B2Aa5d4b3fE7ab72d6dD", + "0x8208EBc031aBA6e13E7277cea54b42b7Ff6269DE", + "0x5e0c0d6EB53E35BA899b81fdb950ccCB0afAADcc", + "0x530578de626D4F3FDD716affe2e9bEd31A3b54A1", + "0xd1144236E50D257Cc23dA09d514aE4F8eC5C3607", + "0x2561b21335aE1223c61676F73e62d139f1bC88ef", + "0x946669cCBf544D35D272A04289A9AA55E19c1520", + "0x01F62c0FdB59bD820AdB0B45Ddb239a7e7EfCD20", + "0xBBcAD6595590EFB8c4b091298619919A7a51Cf7F", + "0x2D5B68eCdb083E26441EB73C16B86e0E7680DA66", + "0xCa88601ca582F5FA7AfBA26ECc47383E6B1770C2", + "0xA99Bc656A29993C05E6bCafd19A5D4c697277E1B", + "0xEeC83505C7136b4AE8bA9819222f3755A2A8cEF7", + "0xC7d681D00CF8f0C31a8ca9636E1f7058E4a465A4", + "0x6837701b116C74072deE9D8a26B62707b72e3329", + "0xb7754aE3b8044eC15CFe3491201288f1295D40d1", + "0x449A4000d69e46326B938185FfA2a7438A0Ba44b", + "0x99DF7acF2d2A8249B7F2Be131e9911903E0Bfc38", + "0x52614De8e8e2cD217de8AFC63c464205CbDEfE48", + "0x8Ed73DC3Bccc840C43E283740331371e6faC5E88", + "0xB2d955761fB9d481a3A42F17546211447E364DB6", + "0x5bCf5D988A373Bbd591D292F689f5D43d3FDA377", + "0x796Eb8E202ff1c1Db58B1716474e5f7562B07Aac", + "0x551CfDC850427E10522881E3BAe34ee256aCB65e", + "0xf97bd1cE45BF292e1588d4F0f2F7174CC2c81690", + "0x8302a17FC82Ab4Bc7BFa9595372fc89439b413D4", + "0x78292feeac11A682483aDD73660868466b3DC66D", + "0x23C424D3492f809DC3BC473918B12D4F914E97D8", + "0xa028F33b854F58Be522A24E57C32b9226aBD4dd8", + "0xb546841A83d1e3c10E814B280419c33a9e5B7c09", + "0xCAFc0bbeec46292689D881e6dFD02656FeFDBC8a", + "0x2a3CAfeaa0d6ccAe2c99bA285B1c1D3Cf3e8e3e0", + "0xbA1cB80d6Fd52e3174B9DaA0f7752eBe4773500B", + "0x485EFB09b1cddf8750f1abB96c712305D5d7d22a", + "0x3F36BA3a1C951122c59fe8e2EEa9F25D8cd266a2", + "0x9F8230c74E0F8E3c82505eEC20dDB4bd37Fbe7e9", + "0x5Cdd4df7C06a570C2733b2621F65bccc030D22fb", + "0x094Da2a7aa92Db16979F8c740a000F017C78E586", + "0x4db4F7eB136b78a21F6a49FAB2a07AC5454358D2", + "0x534d07b6d997d56d526bB0568F5c0a0875fA7491", + "0xe72bEeDEBc22042B3c054C9d985EF70F3F21C07F", + "0x4B4AC2115c7be54858341A357438089C360D0391", + "0x42443f195F8b0E25150E48965cDa520fDEEf1EC6", + "0x52A6ED8Af9a7587CD7c8097e55Ab51EA167FD1d5", + "0xE75a233bc8d59873CD5a443A7A7a14a18f80de04", + "0xfBdfabdEE0b082f92944cBf7321D901010a05Ff6", + "0x727f490Bd0fD299B98e6118Dbe3762c60241145d", + "0xeCe1E1a00159e831786337a0369eddeb41b44ce3", + "0xC44454116b12424c3CEF37CB4Cd314Be393F4414", + "0xaa6e92d650CD1008423f9502413cD3EB382E80bF", + "0xaaC80725AF8d74B5dCD0462B54bE6959faa49106", + "0x52eca7b8a6681d3541D44677CB7bf6436efaB104", + "0x43309fFccF1ecB86273f363c04b43Da25f2B9211", + "0xf18913fA8a97f703895aFe8102c06EC48a32E543", + "0xd8dC5856143d20A1C4534EAc565805BB23f88e71", + "0x666110FEF0cCee100CD154931aa1349312cb6C86", + "0x19AC1DA1172696c10bE21a3FE8E2f917913Fa2CE", + "0xccB4A945974316E21e333D1d2e81740831caD5Fc", + "0x8594c9e8Fdfe9Fa9D725cC4894E28484675C0894", + "0xa7793ea1aD45Be33EFA1Ea3C7d4ddD6746bc2176", + "0xd60055f132862dcF3Ed08880D8E11c1650BFb5c8", + "0x8C6d98751B4f6a6727F9dFd9670B3978A5762ac5", + "0x29e15bDAE0C0375A4412A83E9f95F7DfD0643Bc5", + "0x2B4a0737e3664A38597118D140E95D56cA022d97", + "0x5707742Df139ec717348E2eBa519891a6F523DD3", + "0x4A7D10BaF5207e866D4667314227123CEF785A01", + "0x48D681d5B9ED09DE4ee2453F26f6973D70611763", + "0xbce9282fe66b7Fc1B7823B884d97492D37530a36", + "0x55b7c199Bac27abbC5ec20B3c3f84d64878e3759", + "0xc98B1FeB7C339f29ca26182e820C9b09A588eAEe", + "0x0B28F99AB08151a751a6B2d5784e68F0796e36e0", + "0x3c50858ba3b778b6dbbe0b034f7ab23dcda37468", + "0xD6B7c1135D62f6EDF2F1d1Af003f3e6baD7deB00", + "0x66AF592fB516b1d8d337B2295B1D6Bade22cb681", + "0x84b106BE2A1b2781d3D560e8304c4197B6F2B40F", + "0xd6F57998B71A8FfE4cb085Ff015f40f75aD5a79E", + "0xE72B57B0c7567a5bE542F6B5ffF1BcB591D7B251", + "0x336dd54Acef3E913D5B59cb2e6fa139e528E8c58", + "0xaF01fC708f1d9bfc07DBcC74590afD005F551AF9", + "0x95c1A7Bc770E33dC1A9AB093a5Ca618Ff96852Fb", + "0x351e0322A75D96F2072c54E22f6013ED76F55FbC", + "0x5c695cf06CC40f0e4692ad4D0b096eF7C4b7ff00", + "0x50ADF00864c443a95253AD3C9ba90E6c0232881B", + "0xE2de4D4d19f6712f0d2836b477c311B627C96565", + "0x1C4C0040c99c0CAe55a66B028ae6644585d10094", + "0x29d237174Fe36eC20c3894251335ca2254b4C4C7", + "0x9cc639E3935b7650439212EC88946580292b5D09", + "0x6b654b20C5fb665d51DEDae98E421EBb0C0348b3", + "0x88249D5728492FFaD4Fb12B0539C9B88A05C3b41", + "0xcE677B9121Ed80429855376F4187bcc24D69dBe7", + "0x922615E9CD49bEf0dcdcdA5a3D650A300fae7d2a", + "0x22cA92B6Ce964c6E64A21Dc15198253231251dA0", + "0x522564885EB8d2b7bDc55Ee289563e1d5b09e8A9", + "0xAc2eAfdBDA2ca4d264A276Ca715081FB7c5fE2AA", + "0x31C5420cB9de6F5A317Efe7c10ab1bC440536dfc", + "0x0e1C794Fb817a20246439C093EBB41321729058a", + "0x8f8854b7782E190912adb538DCecd88fCC8e0909", + "0x01d17C8038cb21A43AFE1da372119A4e18717aFF", + "0x7A1885eC42597B1783dD5754c7a42AE60a5202E1", + "0x6a8673dAF590871198fe073B09D8a3fEAc73Bd3e", + "0x3bdF1D7723bCb1B544b137d3b0C8c38336e06621", + "0x3815a4883b1050D274AFeAf73FAfa41c47941C38", + "0x44a5B6be893cf8071A83aF8c8d81587C09422867", + "0x42A34bDCF4edf2B73Af56803e10654c65aDa3DCe", + "0x47A38879E95B271f8E6DA29006e619aE11eD5A1D", + "0xb1A7c9EcA5079D8Fa7073FB4B0A1150FA67dbf63", + "0x2B6e966230dfD7312979BB754f379c172dc39994", + "0x8bc41d77d5CbD1c7d8F7833Ba08dB5e559D53098", + "0x4ed0c0D87Ed8d52Bda0FfC5eEc393486eF09E8E6", + "0x2DCC96c2ff52E8BA8728C171A581EcE8665Cd34A", + "0x95a272b0672d85330baB132272A36D381F80Af98", + "0x93a2B600aD0dFE4Ba5b464DE30D164D1827F71c7", + "0x61f97F988FAB7c18c61c42d12e2D77612D5eb852", + "0x95dB548c3b9Ec3b310c4667BB6B4c490A5445A0e", + "0x48873b66d6Ec8ed753E1eFc733dA141c87772E5D", + "0x75F38c244dcf0C9214a1a75a423b10e896E1b2eB", + "0x92F9800229eb401106bbF273ECfE7F324620C5E8", + "0x3f24344DDc1C4b0A1D0D6d25260d50E6cF43c975", + "0x92eD2703e4EBC9363b894c645359bCCA5C1950A6", + "0xfa40006daBf692ccC12a5374352509D479f8dFA1", + "0xF1933ABb109bE140c03116aE2774Cf34c3A0eb39", + "0xC31E5c0a413Db0359765F3F88ef1052f802d9ed2", + "0x045A61547d592ea8e394607e601ec81167dDB2bd", + "0x3EF9c9e59dE3F53392dD75e1d0604b3cF85620D4", + "0xa5d08837b1160E83563de264551AFc0273C34B75", + "0x33177e16213d23CbB30e18C0011F5536943AbC83", + "0x75D1Bd5c18c7c4C9362Cd1A845C8c543E27c9f69", + "0x15B83d1A952ce0aCd31C57CA27a288217893991D", + "0x3c6870b4990c8dA73eF18eF25ce34432Cf127554", + "0x9b6F180AaDdF31fe0167aE931c9988548349Fb0D", + "0x39d61795F74377A2Bb69eeF09832c08263C25cc9", + "0x6D26C46086838602E398b0b660871FB961542433", + "0xA350c82529dFdc4Bd8C40086e5aBFd2C00f405a8", + "0xBFb23Ed072c442442f0f049Aa030885483517d36", + "0xD68Bf8eCbA2bc0002F0A8C6cDBE19283b7064C3A", + "0x234eadBA601E874fcED396758875f146992Cf72B", + "0x04aD31904B7cc9d84e6d924972146ABbeB22909b", + "0x420A8E998BC2cc0df14ec8DCf4076aE560B3Ed68", + "0xbCB81BFe71478d182eE612CF71Cb8b68DEC5E84A", + "0xB08a10588E5A8e89f0FaEBfFd18f0AC9eb984022", + "0x2a8d600aa656102Df55017fBA42e404a365bEb4b", + "0xBb381e6d0F3ed77bD47ecB7e9f5C21b800B3a9C6", + "0xbB398185E4b1587F666db8913Aa039fe1663Fd23", + "0xbD76310784908874E0F1f7DfcF2A8fB02594bE6F", + "0x7A729a3B63b9360C4939f8232235801b506c7240", + "0xbCAe8d211969279Eb1e07930e7da4670fe0c10e7", + "0x82D666B8113b7f4dBA99A7982518D6f4d50e771f", + "0xf34E317438C1F6fe863128bD43AB416203c7Cc0F", + "0xF447B93c108d50dc7D52593cB753702A283319aE", + "0xEf52fA3F031235289bd3088ef37c0c9471F99338", + "0x6c9a53d7BdA34815A80cCB6d239142354F39c232", + "0xCe4c5530A150FdB155F02cE42c8791234Bd93688", + "0x3a1FC65e730e3f00a43c58d3770D8a9a38aFEAa5", + "0x4Bc563ead4469C453d526ad603E5223e5B3EDfE4", + "0x24E68643e173BE75C9847ACE5B1aB02Ff2d347B3", + "0x6b6F8CfdF536C71Cc0820387259f181026E964ad", + "0x117325Ad73BFb95e6653baAc3114EF2Ec2f142C4", + "0xAF68D39a0AE64b88AE39A7531A54131946db380E", + "0xFA1054Bb918727B36008CCA64978CD83db230ae0", + "0xc094897bcf7aF2943f439E20ED3A7DcBd7b1C843", + "0xCF3Dfe76608bC47038bB47813081689Fc9a18299", + "0x739b2ea6824Ad2d5D1aF230E9fbc13FBb2E4746a", + "0x1DDE0476FA03c89CD4797169db7034231375F164", + "0xD67C2c733D9cAe58353c49A33Af6DDC206fCee9c", + "0x30B133b801cC60D0676b4c22E961E1718DE15ac9", + "0xf4F4fFCDDAe6B7a1B5B2e0d8eA0Dfd27F013D830", + "0xAF1986Efa7080f4546c2750f08f8Eb0BC714cdb8", + "0xE7D0a4950f44D845846Dd0BA499401ef9E6C310d", + "0x75831D954222abC150359D7A6ee495895Daa26f7", + "0xA321473aE338dd6B83BD20BAeB4D31fBBf1ff34C", + "0x95373F5C8A4FdFf72Cc9E9E0c0eB3b77eF10Ebec", + "0x5086D9849CdB2529a8E1cdB5AfC467aC5018A97d", + "0x89d5410F417858576197d6659D6680b532de7cAD", + "0x1473807Bb1F4328AD27b99d7846C9Df0bB7D46A0", + "0xA2186e410F61Bf1B5f84DD0b11AF281E55825264", + "0xAAfE784942216c8cA73cb0305d6d756B64c56bE2", + "0x4272955b14A1982dc90bec2fa9026941B318809f", + "0xACE58eF4c8350a20Db8cf2f7A452057f809F942F", + "0xe476e01732779Cd1c14b6E084Eb6D7abd10E4815", + "0x8D3c7311497489eBAcF0822f185779A5C7056F8b", + "0xD76f809CDEE95E8961E185003384315191E4F391", + "0x18ef2B849789a2BC790230A8280a6C899C791397", + "0xBac80a35E86fB2c31FfaFC12dF70cfc032D2fA5E", + "0x991C2C63ABfaA999B1Cb5Cb4B05237BCfcD3E1d8", + "0xcf256e5e665ae67ecd921da7b8c983427036c769", + "0xab3c0ab53ccc8d19a93fb331579ad98101f2bd14", + "0xafdb6f52bfacf17c676873115f50f2d3ebaef771", + "0x2Bf3b14711bDc8739e65D188d48E004645C9ed41", + "0x9E58c1F325f8D1Ba6a43E808588d67Ae6b4b6d34", + "0xe08B10E92D22339785038a494E39e98A62104A91", + "0x5B51dFF90Fe87E22A9170ddB74A979bEcEd880dB", + "0xD2B0009B3a222dF065d9DE766f2b2E01bC2a9825", + "0x6D04758840C946f0BFDB98599AdA4F0f68dE2247", + "0xf8b25F0D1Cfa1cbC3dD13c8a871643D14B81e7A4", + "0x5a06B00442E8bb2F1D7E8A191a27e0455369e9ca", + "0xF2D657a80C0246D81dF0ee02Aa3799b1cCc3F251", + "0x20Ed528e8fdbDCa16423f89dDcc848FfDbF2C14d", + "0xb157A23429fB6CaF15BE8aFA001c409C21A121c2", + "0x5bd1bcA04AE6F64842C4B8bd04fb464Fb7925195", + "0xAAE38D7D9987415Ee7502d2579092c559f1E767E", + "0x6518DCa3565fb7f6328284A6fb167968BA38BAE2", + "0x55A53C8491A3CCFB8084CB4Ea48884478c57346c", + "0xcc359d3C834760E587B579607fA3351dc4253e60", + "0xEe237BC2973963d5ADC121c542E2e508A049c18D", + "0xd835e8182372416E87bD904544501F485D6687cE", + "0xa7739978e6c7DA30D858e636ad2aCea4e912f482", + "0xd226F4F0a217A73035746E657b292c88EeE7daF3", + "0xc6595CEcD11f91517c7774357A0a824472b850D5", + "0x39475a68B88415B17324d06676B550A83BF2C70b", + "0x4636E1B72076732b16ea99DE639692Ea05a34893", + "0x3ED98536D5971D4EAC1881ffc8AbDDa2E2bc2ab4", + "0xA3Af04BaA3e418c4cE64DB8bC2d6FBCb1265f824", + "0x34dC8f8136E62B9323FB434D11CE26bAeFaaD3C3", + "0xAef0652343C154662F17D8b7AA86d2b2DE01D012", + "0x62b16eBF03C5aA31aF040a4C31D2d6b67107d92e", + "0x561078c9521519a71B512FBECa07F6C06AfE2e9b", + "0xc17f3e0cc8f8c270F9665d287fceAEeb228062F7", + "0x40FcDfB0d8f1c3B70745e5d6f62611783B22Ae0F", + "0x3aDb0D0F7569D7934ebB21088031D7663427EbC0", + "0x88e2641212047313d5AE5c01E4EaB4A2eAfBbC28", + "0x08B3361d3f0d51BB7D02894b3496ed771ca811e6", + "0xd1bE0B3c6F71adcF173bF3bD38AD260569B1Ed37", + "0x039C681B4CD27243e79C447BAEa6103f4c7A18e2", + "0x3eFfEc22EF5705a0Db035FE98E55df8b0D1F5076", + "0x6086765f5eaB32E5673629d8A33D5d28671182D4", + "0x8054A73E9e641E465d92CAA16B5Fd4a214C46Be3", + "0x46EebF35206BD1D0e11e89c5AB10b5Fd9DC759B6", + "0x1F72FbbB85591Edf28C73bE614f2F83381bbB95b", + "0x3DE1633fBc6A7B7CDe144f2A805A1c68ae5048f4", + "0xcec7b076BA94378d03e13D5898F9EF0f41394BEE", + "0xdA65AEDCE13c13a98dF8b872Af3596Bd22bC26E3", + "0xb7145dE7F5537D07D7Cc3410691D105566A5E434", + "0x18C5C07a9F68c82de678470a9E9306Ffc3e9Ced6", + "0x26f47811f74f67e0Dc00494406685d07A3255C96", + "0x8582267c3a2bb11fCcF1eBB1c9Af128e94B024E0", + "0x48eF177C15d091A038176cD262638bE999E138D6", + "0x40F7E873Ebefa5BB762341a8DD63f06d9A332D56", + "0x0d5Ecb27D1574E3B574d6D8c93C628d17348c99B", + "0x52692fF7230Bb3a11B77B09a63682F6Ef4d43B1c", + "0x177Bd708eB4880d2f0e0E319F48BF1308CFe6494", + "0x55BcAe2D9797184b30D0480A1F6aC3763AEdd9a5", + "0xFDc10560bd833B763352C481f5785Dd69C803429", + "0xC7abe55e5532ddA1943bbe5A94bD837dcd96e233", + "0xCce2E2ea6169449715D1B3E74c776335Cece21d6", + "0x7216e8395C37aE8A17665Aaeb8563ef81d6041A8", + "0x662bDd5cb8Aefc78361C653117Fd9a0f896e0246", + "0xfd5E8252d377f20dc53ABDc12B7A21704CC8A566", + "0xf17C4842D9b52C733a127591296B26FaA8F0d30b", + "0xCC0C4D49E2b104a24b6b6c35660fE8e5AEe1bA47", + "0x3a5138Cd818913169E6a5506a39ff1B0A18cA880", + "0x99e76A57337192B70BeC637e75fdd60251AC7Fb9", + "0x613dcbc575034eB8dbBF3FD5AF90697C241F4C73", + "0xEddA6eEd092736B15610767C6d3D7a1D2FCCb5EF", + "0xE7d661aCa8752Ac8A3C7dA51e4D8C468FeA0a76e", + "0xDe0A2585f0b2Fe4DE98C56DAF53389dDe8C315d2", + "0x9E6f53c29870C436F4eDC200714713549ADA274f", + "0x7BE6c15780390aa8335b356693d82411Fc26B6d9", + "0x45A3cac1d1620B28b8bED91d1bc0Eaf0323916A1", + "0x184bcF123cFF6af3F5Bb39BEE3E2a882c1497d6a", + "0x5cB9f1A5A184f56DE000B5Cf7492F1839451a742", + "0x1B589B49A02960973C8A1C2F5ab6e56023a6bbca", + "0x8F73C2eB80a0A6E83C6d74161f4872d5B9076A1C", + "0xaA4d006b4062650Ab4824f5E44187F10dbc6F100", + "0xc10c76ab2fcc743b783378ad5c192ade0ad70912", + "0x5fe9F73b79106f78552d3D846776300b9aDDd535" + ], + "kava": [ + "0xE9dfDD6Db5577504630aF0d59F6DA0fE58A7A543", + "0xA58580B3Ee8997A6F351b558Ba66785AFC9cF4aD", + "0xA066F4f1B3326a24EE88e0703b480E47fA28617c", + "0xD468F11f00133f843152eFE796094cF7da3C0CeF", + "0x144779e1D5d2177084e8DC58C703C7683a41c8Ad", + "0xC1D17E608236b7338c91ef6909Ed5631823d0631", + "0x83A369A0D21cCcC9594B35eA2EDb578737e2125E", + "0xfB8eDeD3e963C1Ba0e5215DB124848400C7a69dA" + ], + "arbitrum": [ + "0xC536FEDe5427cbF80A891eCABA1F4A67104c6bBf", + "0xAA23927C9ae3061517a6AD63d2F97E40d0357638", + "0x6b66F96cA6f9b27B87682c3FA6D628d509a550D9", + "0x4e3569d91F08402a6215cfA80E2CaA646d704242", + "0xCdE69123119036D088Ef45c6A28C4cECa697f52F", + "0xCfFfE2214D71835b23b8EFCB53253C56F2E4F86C", + "0xacC52DB471106b0cb4681958B9c40A2067C9F4b1", + "0x2228E92aF2bE0adeb69Fa5DF677E442BEf9a1343", + "0x77922ECD7618a4cEE460d2e45836827f1A35dee7", + "0xD6Ce8A5021C7731119Bb7ac714408ba38eFE450A", + "0xcc4373Ff112Bc16e56Fc57C4c75b90EaD04A16a9", + "0xC37b270a403057F3Fac0BEe873D72F8AdE086a3b", + "0x155fFdab92888d2600c1ff4cEBe9dB88f546890f", + "0xD71aA46F14e8CD63a18E3BBe778752D2a5E0cDD2", + "0xF3466b8dB66A3Fc6bb7cA22E3029E3f3F9f247AB", + "0xfe71D131b449e854bA6b3173ada393D41e58275f", + "0xf07355A90b03bfbf262CfBdB5DcABA6B6D77B23f", + "0x93f4f49411284636215C4CCf9120EC9C573a4235", + "0x7692a071Ab5267656333635e97E65b6F2734421E", + "0x1D8308b7cD5eD3762E0871EC2ef6b5b7d5DcDc47", + "0xc93E5392e1F2de59c822FB105AB10d75A547C895", + "0x488F3e4582cAaf0417b1051174861235726fbAb4", + "0x13AaeDC6d4Fb37Ebb71EC5612BfCC64Ff352E948", + "0x4dfC3Cc8275e71ecB9C060e0358044910Ecd572A", + "0x114Bc9fb8c6A0a92348C0Fb59a0ec3984a469b39", + "0x43AbE4df66235Cd8F11F8ef7931ca5330EC32c80", + "0xdD35cd7Bf20e22bbf6DF92221618202259e88661", + "0x15dF484c8caE85c895AcDD9198c3c01FEcd18938", + "0x622502B553AEaCC6D82d39f6AbedAb877B502ed9", + "0x6375B4C1eF33FE9A2dD4EFf936812f93c330134e", + "0x0bcACf155ceB5F5a3A8a61049934E3D79E65c13B", + "0x7c98B83925ea2574E688808Bc1cfB1F82F3Af559", + "0x0289dfF687B38b04eaE6887D1CB68a9F08B3e4f5", + "0xF4771304A5C01E5267b4E8Bc964042485ACaE5D8", + "0x48C0069565e2265b2D5586F762577DE38dc7778D", + "0x9E89e79DF8fEb31EB0d529586201A5541978CbE5", + "0x5E173F6Bf035cFf25029dee6003e8CC18Ac65D7e" + ], + "avax": [ + "0xdFE426842d07957c9e661794822dB12adc20b856", + "0x9aBE7c2062780e7ff8cd9E48bddc54c44107bB62", + "0x852e297f5fD64bB97da1Ce0eDfFB807dDe6f3296", + "0xF9cDc12e329247639AC20fC2a2B9CCcAB0d85A4e", + "0x6D254E5a833A62119631A75A52bEE7c9fb131199", + "0x9495651be0CAE17125091E86DdEf35C4D46085E7", + "0xe7EAbBF65BE5ecFf390124e0FABf15048C4442F5", + "0xFB65Af3cF542E356C16065467937BF90BB7B54BB", + "0xBA3D12D3a11ec109504518c7C284f39fD1626B6D", + "0x87EFdAe3fE46a861ec96fD5ffB5e4C5DDc8f9e79", + "0xf7afb8BBB576E883a6f8fA178b01d9D1E6233635", + "0xF57b11637EeE8e199A1CeE403F0A9efe0B9c968f", + "0x992804e457CBa7EC1f08c8EEE2536eE4a5c38304", + "0xc9dbE91fa4306208dFa092eCc6C1952AfF964bb3", + "0x507f9CB0A7269602588c184BcEB2e0Fdb1bA62Ce", + "0xc33e491BF463F410eF530DB307c384CE4Fa5B52B", + "0xc03edF8e71170985b0E7217C530BBEab83396F32", + "0xD468F11f00133f843152eFE796094cF7da3C0CeF", + "0xEA1A8b0D746b7ab2479655fB49ddFe9381b6d96C", + "0xCD2d3dF9b116E4f8A40271aD3838cDc581B20405", + "0xBa5702F3B09F9DD43b6915D67F5f98AfA2c4ef14", + "0xa638BC40082C2233a9285580d9176E7c0784e7A8", + "0x91bABb9e0CBdc9E7b6B04c03B8DC15E1Da92E143", + "0x7848B2163f0BE2Fc7c855021a8f0A59b2697934A", + "0x7B13baABa686990746153B08D420002Aa6eA2d75", + "0x81e9C6F53aD8576Ba9D73DEad9D48be91151d3da", + "0x8c0e385725070491F42f2b453559C478d9825763" + ] +} \ No newline at end of file diff --git a/projects/grim/index.js b/projects/grim/index.js index f432d3722d4..637772c25f8 100644 --- a/projects/grim/index.js +++ b/projects/grim/index.js @@ -1,116 +1,14 @@ -const utils = require('../helper/utils'); -const {toUSDTBalances} = require('../helper/balances') +const { sumTokens2 } = require('../helper/unwrapLPs') +const config = require('./config.json') -async function fantom() { - const response = await utils.fetchURL('https://api.grim.finance/tvl'); - - let tvl = 0; - for (const chainId in response.data) { - const chain = response.data[chainId]; - - for (const vault in chain) { - tvl += chain[vault]; - } - } - if(tvl === 0){ - throw new Error("TVL for grim finance cannot be 0") - } - - return toUSDTBalances(tvl); -} - -async function polygon() { - const response = await utils.fetchURL('https://api.grim.finance/tvl'); - - let tvl = 0; - - const chain = response.data[137]; - - for (const vault in chain) { - tvl += chain[vault]; - } - - if(tvl === 0){ - throw new Error("TVL for grim finance cannot be 0") - } - - return toUSDTBalances(tvl); -} - -async function kava() { - const response = await utils.fetchURL('https://api.grim.finance/tvl'); - - let tvl = 0; - - const chain = response.data[2222]; - - for (const vault in chain) { - tvl += chain[vault]; +Object.keys(config).forEach(chain => { + const pools = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const tokens = await api.multiCall({ abi: 'address:want', calls: pools}) + const bals = await api.multiCall({ abi: 'uint256:balance', calls: pools}) + api.addTokens(tokens, bals) + return sumTokens2({ api, resolveLP: true, }) } - - if(tvl === 0){ - throw new Error("TVL for grim finance cannot be 0") } - - return toUSDTBalances(tvl); -} - -async function arbitrum() { - const response = await utils.fetchURL('https://api.grim.finance/tvl'); - - let tvl = 0; - - const chain = response.data[42161]; - - for (const vault in chain) { - tvl += chain[vault]; - } - - if(tvl === 0){ - throw new Error("TVL for grim finance cannot be 0") - } - - return toUSDTBalances(tvl); -} - -async function avax() { - const response = await utils.fetchURL('https://api.grim.finance/tvl'); - - let tvl = 0; - - const chain = response.data[43114]; - - for (const vault in chain) { - tvl += chain[vault]; - } - - if(tvl === 0){ - throw new Error("TVL for grim finance cannot be 0") - } - - return toUSDTBalances(tvl); -} - -module.exports = { - misrepresentedTokens: true, - hallmarks: [ - [1639785600, "Reentrancy attack"] -], - timetravel: false, - methodology: 'TVL data is pulled from the Grim Finance API "https://api.grim.finance/tvl".', - fantom: { - tvl: fantom - }, - polygon: { - tvl: polygon - }, - kava: { - tvl: kava - }, - arbitrum: { - tvl: arbitrum - }, - avax: { - tvl: avax - }, -} +}) \ No newline at end of file diff --git a/projects/helper/utils.js b/projects/helper/utils.js index 2e74ecae44b..cc95d92fa21 100644 --- a/projects/helper/utils.js +++ b/projects/helper/utils.js @@ -64,7 +64,7 @@ function isLP(symbol, token, chain) { if (chain === 'dogechain' && ['DST-V2'].includes(symbol)) return true if (chain === 'harmony' && ['HLP'].includes(symbol)) return true if (chain === 'klaytn' && ['NLP'].includes(symbol)) return true - if (chain === 'fantom' && ['HLP'].includes(symbol)) return true + if (chain === 'fantom' && ['HLP', 'WLP'].includes(symbol)) return true if (chain === 'era' && /(cSLP|sSLP)$/.test(symbol)) return true // for syncswap if (chain === 'songbird' && ['FLRX', 'OLP'].includes(symbol)) return true if (chain === 'arbitrum' && ['DXS', 'ZLP',].includes(symbol)) return true From 6669d79fd6ecdff3fa3a8e2a9847e40b76f32821 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 7 Jul 2023 14:54:00 +0200 Subject: [PATCH 0265/1974] fix brewlabs --- projects/brewlabs/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/projects/brewlabs/index.js b/projects/brewlabs/index.js index 1c268b1962e..325d1c28ce9 100644 --- a/projects/brewlabs/index.js +++ b/projects/brewlabs/index.js @@ -62,8 +62,8 @@ async function staking(_, _b, _cb, { api, }) { const poolInfoAbi = "function poolInfo(uint256) view returns (address lpToken, uint256, uint256, uint256, uint256, uint256, uint16, uint16)" async function pool2(_, _b, _cb, { api, }) { - const pools = await getStakingPools(api.chain, 'pool2') - const infos = await api.multiCall({ abi: poolInfoAbi , calls: pools.map(i => ({ target: i.contractAddress, params: [0]}))}) - const tokensAndOwners = pools.map((v, i) => ([infos[i].lpToken, v.contractAddress])) + const pools = (await getStakingPools(api.chain, 'pool2')).filter(i => i.contractAddress !== '0xb4d96033a260f0a0ea9c927aa1583668118c8145') + const infos = await api.multiCall({ abi: poolInfoAbi , calls: pools.map(i => ({ target: i.contractAddress, params: [0]})), permitFailure: false, }) + const tokensAndOwners = pools.map((v, i) => ([infos[i].lpToken, v.contractAddress])).filter(i => i[0]) return sumUnknownTokens({ api, tokensAndOwners, blacklist}) } From acfa76e510e161ba195fe8a85b41d1632f9fecc3 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 7 Jul 2023 15:09:13 +0200 Subject: [PATCH 0266/1974] refactor halo fi --- projects/good-ghosting/index.js | 84 ++++++--------------------------- 1 file changed, 15 insertions(+), 69 deletions(-) diff --git a/projects/good-ghosting/index.js b/projects/good-ghosting/index.js index 0e333c145df..af6ef60cf27 100644 --- a/projects/good-ghosting/index.js +++ b/projects/good-ghosting/index.js @@ -1,5 +1,4 @@ -const sdk = require("@defillama/sdk"); -const { getChainTransform } = require("../helper/portedTokens"); +const { sumTokens2 } = require('../helper/unwrapLPs') const { getConfig } = require("../helper/cache"); const apiUrl = "https://goodghosting-api.com/v1/games"; @@ -26,78 +25,25 @@ const isV2Game = (contractVersion) => { return true; } return false; -}; - -function tvl(chain) { - return async (timestamp, ethBlock, chainBlocks) => { - const gameData = await getConfig("good-ghosting", apiUrl); - - const balances = {}; - const transform = await getChainTransform(chain); +} - const calls = Object.values(gameData) - .filter((game) => game.networkId == chainIdMap[chain]) +async function tvl(_, _b, _cb, { api, }) { + const gameData = await getConfig("good-ghosting", apiUrl) + const ownerTokens = [] + Object.values(gameData) + .filter((game) => game.networkId == chainIdMap[api.chain]) .map((game) => { - const gameParams = [ - { - target: game.depositTokenAddress, - params: [game.id], - }, - { - target: game.liquidityTokenAddress, - params: [game.id], - }, - ]; - - if (isV2Game(game.contractVersion)) { - gameParams.push({ - target: game.depositTokenAddress, - params: [game.strategyController.toLowerCase()], - }); + const tokens = [game.depositTokenAddress, game.liquidityTokenAddress].filter(i => i) + ownerTokens.push([tokens, game.id]) - gameParams.push({ - target: game.liquidityTokenAddress, - params: [game.strategyController.toLowerCase()], - }); - } - return gameParams; + if (isV2Game(game.contractVersion)) + ownerTokens.push([tokens, game.strategyController]) }) - .flat(); - - const gameContractBalances = await sdk.api.abi.multiCall({ - calls: calls.filter(i => i.target), - abi: "erc20:balanceOf", - chain, - permitFailure: true, - }); - - sdk.util.sumMultiBalanceOf( - balances, - gameContractBalances, - false, - transform - ); - - //fix decimal issue with celo tokens - for (const representation of ["celo-dollar", "celo", "celo-euro"]) { - if (balances[representation] !== undefined) { - balances[representation] = Number(balances[representation]) / 1e18; - } - } - - return balances; - }; + return sumTokens2({ api, ownerTokens}) } module.exports = { - timetravel: true, - misrepresentedTokens: false, - methodology: - "counts the amount of interest bearing tokens owned by the smart game contract", - polygon: { - tvl: tvl("polygon"), - }, - celo: { - tvl: tvl("celo"), - }, + methodology: "counts the amount of interest bearing tokens owned by the smart game contract", + polygon: { tvl }, + celo: { tvl }, }; From 44100c67a7ba70255693637df85afae0ed0f0cd8 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 7 Jul 2023 16:42:57 +0200 Subject: [PATCH 0267/1974] fix stakedao --- projects/stakedao/index.js | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/projects/stakedao/index.js b/projects/stakedao/index.js index 5b7678bcd6c..14d9bee993a 100644 --- a/projects/stakedao/index.js +++ b/projects/stakedao/index.js @@ -163,14 +163,21 @@ async function tvl(timestamp, block, _, { api }) { // To deal with special vePendle case const vePendle = "0x4f30A9D41B80ecC5B94306AB4364951AE3170210" + const veMAV = "0x4949Ac21d5b2A0cCd303C20425eeb29DCcba66D8".toLowerCase() const calls = [] const callsPendle = [] + const callsMAV = [] for (let i = 0; i < lockersInfos.length; ++i) { if (lockersInfos[i].veToken == vePendle) { callsPendle.push({ target: lockersInfos[i].veToken, params: lockersInfos[i].contract }) + } else if (lockersInfos[i].veToken.toLowerCase() == veMAV) { + callsMAV.push({ + veToken: lockersInfos[i].veToken, + contract: lockersInfos[i].contract + }) } else { calls.push({ target: lockersInfos[i].veToken, @@ -181,13 +188,27 @@ async function tvl(timestamp, block, _, { api }) { let lockerBals = await api.multiCall({ abi: abi.locked, calls }) let lockerPendleBal = await api.multiCall({ abi: "function positionData(address arg0) view returns (uint128 amount, uint128 end)", calls: callsPendle }) + let lockerMAVBal = [] + + for (const { contract, veToken } of callsMAV) { + const count = await api.call({ abi: 'function lockupCount(address) view returns (uint256)', target: veToken, params: contract }) + let balance = 0 + for (let i = 0; i < count; i++) { + const lockup = await api.call({ abi: 'function lockups(address,uint256) view returns (uint256 amount, uint256 end, uint256 points)', target: veToken, params: [contract, i] }) + balance += +lockup.amount + } + lockerMAVBal.push({ amount: balance, end: 0 }) + } + + console.log(lockerBals, lockerPendleBal, lockerMAVBal) for (let i = 0; i < lockersInfos.length; ++i) { let amount; if (lockersInfos[i].veToken == vePendle) { amount = lockerPendleBal.shift().amount - console.log("pendle") - } else { + } else if (lockersInfos[i].veToken.toLowerCase() == veMAV) { + amount = lockerMAVBal.shift().amount + } else { amount = lockerBals.shift().amount } sdk.util.sumSingleBalance(balances, lockersInfos[i].token, amount) From eb9e45604d6c7c5c874da1af54a8643db8a71318 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Sat, 8 Jul 2023 02:44:58 +0100 Subject: [PATCH 0268/1974] add hallmark --- projects/nowswap/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/nowswap/index.js b/projects/nowswap/index.js index 4abd3c9b932..19957883cfa 100644 --- a/projects/nowswap/index.js +++ b/projects/nowswap/index.js @@ -2,6 +2,9 @@ const { getUniTVL } = require('../helper/unknownTokens') module.exports = { + hallmarks: [ + [1631664000, "Hacked"] + ], ethereum: { tvl: getUniTVL({ factory: '0xa556E2d77060A42516C9A8002E9156d8d3c832CE', From debc20c5cbdcab2fe35898538c551fe1db1cde6a Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Sat, 8 Jul 2023 08:08:00 +0100 Subject: [PATCH 0269/1974] add hallmarks --- projects/asgardfinance/index.js | 3 +++ projects/cryptoyieldfocus/index.js | 3 +++ projects/kuufinance/index.js | 3 +++ 3 files changed, 9 insertions(+) diff --git a/projects/asgardfinance/index.js b/projects/asgardfinance/index.js index d33dbb92f19..4aa1535a86e 100644 --- a/projects/asgardfinance/index.js +++ b/projects/asgardfinance/index.js @@ -56,6 +56,9 @@ async function ethTvl(timestamp, block) { } module.exports = { + hallmarks: [ + [1643155200, "Token mint exploit"] + ], ethereum: { staking, tvl: ethTvl, diff --git a/projects/cryptoyieldfocus/index.js b/projects/cryptoyieldfocus/index.js index 3c35b110bee..d41be93634c 100644 --- a/projects/cryptoyieldfocus/index.js +++ b/projects/cryptoyieldfocus/index.js @@ -23,6 +23,9 @@ const avaxTvl = async (timestamp, ethBlock, chainBlocks) => { }; module.exports = { + hallmarks: [ + [1631318400, "Rug Pull"] + ], avax:{ tvl: avaxTvl, }, diff --git a/projects/kuufinance/index.js b/projects/kuufinance/index.js index b14a38422bc..6461825496e 100644 --- a/projects/kuufinance/index.js +++ b/projects/kuufinance/index.js @@ -6,6 +6,9 @@ const JITU_CONTRACT_ADDRESS = "0x037BB12721A8876386411dAE5E31ff0c5bA991A8"; module.exports = { deadFrom: 1648765747, + hallmarks: [ + [1633737600, "pausing liquidations program indefinitely"] + ], avax:{ tvl: sumTokensExport({ owner: JITU_CONTRACT_ADDRESS, From 1e8a66d36dcfda535cda1f028b705bfb2ccd4d6c Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Sat, 8 Jul 2023 10:41:09 +0200 Subject: [PATCH 0270/1974] fix broken adapters --- projects/deltaprime/mappings/assetToAddressMapping.json | 2 ++ projects/grim/config.json | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/deltaprime/mappings/assetToAddressMapping.json b/projects/deltaprime/mappings/assetToAddressMapping.json index 85dd436c435..6fe5809efd2 100644 --- a/projects/deltaprime/mappings/assetToAddressMapping.json +++ b/projects/deltaprime/mappings/assetToAddressMapping.json @@ -39,5 +39,7 @@ "SHLB_AVAX-USDC_B": "0x668530302c6ecc4ebe693ec877b79300ac72527c", "SHLB_BTC.b-AVAX_B": "0x536d7e7423e8fb799549caf574cfa12aae95ffcd", "GMX": "0x62edc0692bd897d2295872a9ffcac5425011c661", + "EUROC": "0xc891eb4cbdeff6e073e859e987815ed1505c2acd", + "SHLB_EUROC-USDC_V2_1_B": "0x638f969675822dfae4566b44d0f2a11362fbed52", "SHLB_USDT.e-USDt_C": "0x9f44e67ba256c18411bb041375e572e3dd11fa72" } \ No newline at end of file diff --git a/projects/grim/config.json b/projects/grim/config.json index d98d1d2cdb2..75945207568 100644 --- a/projects/grim/config.json +++ b/projects/grim/config.json @@ -108,7 +108,6 @@ "0xe0BA4Bd9211e840e3B7b8B46816f247484916fE2", "0xa21dD344EA44306e32582EB372B1e91B196e62FB", "0xEA751A395725E54251308AE2DC5741E5EB4Bb5D0", - "0x3e739671De3B0321BA219fAA7468E5d349331BDA", "0x67c35B10BB74e035EE062bbCa570c42B11893c71", "0xa8D2Bee3C6FBc33c77814C208A420A3A8862c09B", "0x77B76f8a50b4Beb89210E1e6194299243F334B03", From f72898e111161508d5d50381cc3ce91dbd260fc6 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Sat, 8 Jul 2023 12:40:08 +0200 Subject: [PATCH 0271/1974] update buffer hallmark --- projects/buffer/index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/projects/buffer/index.js b/projects/buffer/index.js index 0fc7e8cd662..3da25c99357 100644 --- a/projects/buffer/index.js +++ b/projects/buffer/index.js @@ -48,6 +48,5 @@ module.exports = { [Math.floor(new Date("2023-02-22") / 1e3), "Added a USDC Pool on polygon"], [Math.floor(new Date("2023-03-22") / 1e3), "Added ARB Pool"], [Math.floor(new Date("2023-04-14") / 1e3), "Added USDC Protocol owned liquidity Pool"], - [Math.floor(new Date("2023-06-14") / 1e3), "Added BFR Pool"] ] }; From a75374a6c5442b6755467bbf8040d0d0519a9e07 Mon Sep 17 00:00:00 2001 From: Michalis Kargakis Date: Sat, 8 Jul 2023 12:40:50 +0200 Subject: [PATCH 0272/1974] Add nftperp v1 shutdown hallmark (#6755) --- projects/nftperp/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/nftperp/index.js b/projects/nftperp/index.js index f6c8bf34107..cccf4948fbe 100644 --- a/projects/nftperp/index.js +++ b/projects/nftperp/index.js @@ -12,4 +12,7 @@ module.exports = { ] }) }, + hallmarks: [ + [1688695200, "v1 shutdown"], + ], }; From 1232a7458aca449dde09867d7703b6d3ee36a273 Mon Sep 17 00:00:00 2001 From: Michalis Kargakis Date: Sat, 8 Jul 2023 12:42:10 +0200 Subject: [PATCH 0273/1974] Add Tribe3 NFT perp market (#6757) --- projects/tribe3/index.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 projects/tribe3/index.js diff --git a/projects/tribe3/index.js b/projects/tribe3/index.js new file mode 100644 index 00000000000..ef871bd6ded --- /dev/null +++ b/projects/tribe3/index.js @@ -0,0 +1,15 @@ +const ADDRESSES = require('../helper/coreAssets.json'); +const { sumTokensExport } = require('../helper/sumTokens'); + +module.exports = { + arbitrum: { + tvl: sumTokensExport({ + tokensAndOwners: [ + // DEX + [ADDRESSES.arbitrum.WETH, '0x01b6407adf740d135ddf1ebdd1529407845773f3'], + // Insurance fund + [ADDRESSES.arbitrum.WETH, '0x3af692a5ab2da34f742686bd4a77b5e609ee9ec6'], + ] + }) + }, +}; From 5f80b407a8b1cf787683abea135d95913d2d9d8d Mon Sep 17 00:00:00 2001 From: 0xngmi <80541789+0xngmi@users.noreply.github.com> Date: Sat, 8 Jul 2023 11:44:35 +0100 Subject: [PATCH 0274/1974] Update paraswap.js --- projects/paraswap.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/paraswap.js b/projects/paraswap.js index 1724b18a3c9..488964c1399 100644 --- a/projects/paraswap.js +++ b/projects/paraswap.js @@ -19,7 +19,7 @@ async function safetyModuleStaking(timestamp, ethBlock, chainBlocks, { api }) { } module.exports = { - methodology: "PSP can be staked in staking pools, one pool per Private Market Maker, to signal and share the PMM benefits", + methodology: "PSP can be staked either on its single asset sePSP pool or 2x boosted sePSP2, an 80/20 balancer pool. Staking allows users to receive Revenue based on their boosted actions.", ethereum: { staking, pool2: safetyModuleStaking, From 0d3d5c74e2b062a4baeb2d9619c051afb6e37803 Mon Sep 17 00:00:00 2001 From: Dinotopia Rex <138904282+dinotopiafi@users.noreply.github.com> Date: Sat, 8 Jul 2023 16:24:05 -0400 Subject: [PATCH 0275/1974] Add Dinotopia (#6756) * Add Dinotopia * code refactor --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/dinotopia/abi.json | 8 ++++++++ projects/dinotopia/index.js | 31 +++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 projects/dinotopia/abi.json create mode 100644 projects/dinotopia/index.js diff --git a/projects/dinotopia/abi.json b/projects/dinotopia/abi.json new file mode 100644 index 00000000000..fa91e9331c0 --- /dev/null +++ b/projects/dinotopia/abi.json @@ -0,0 +1,8 @@ +{ + "bank": { + "usableBnbBalance": "uint256:usableCollateralBalance" + }, + "multiFeeDistribution": { + "totalSupply": "uint256:totalSupply" + } +} \ No newline at end of file diff --git a/projects/dinotopia/index.js b/projects/dinotopia/index.js new file mode 100644 index 00000000000..1598163f849 --- /dev/null +++ b/projects/dinotopia/index.js @@ -0,0 +1,31 @@ +const Abis = require("./abi.json"); +const { sumTokensExport, sumUnknownTokens, } = require('../helper/unknownTokens') + +const Contracts = { + bsc: { + wbnb: "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c", + brx: "0xe550c560a895d043E5EEd2bC7eC8A8e46c2408D6", + fossil: "0xfE8FFB60a2B6d46102caa35739Be465E600D0f5E", + bank: "0xF90c0b409001b97067c539693754008456f6C265", + multiFeeDistribution: "0xd1f2467b2E2cb7bABc5CE8a947A294f216D93F90", + chef: "0xF59e1568cb5FA1cdf1f4233D738D802A90c64B5E", + lps: [ + "0x9bB50fE7E33C15405f94978A5bb88F8544847007", // FOSSIL_BNB_LP + "0x5Ff686208DFe12D35761fe9C74396852303BC377", // BRX_BNB_LP + ], + }, +}; + +async function calcBscStakingTvl(timestamp, ethBlock, chainBlocks, {api}) { + const bscStakingData = await api.call({ target: Contracts.bsc.multiFeeDistribution, abi: Abis.multiFeeDistribution.totalSupply, }); + api.add(Contracts.bsc.fossil, bscStakingData) + return sumUnknownTokens({ api, useDefaultCoreAssets: true, lps: Contracts.bsc.lps, }) +} + +module.exports = { + bsc: { + tvl: sumTokensExport({ owner: Contracts.bsc.bank, tokens: [Contracts.bsc.wbnb] }), + pool2: sumTokensExport({ owner: Contracts.bsc.chef, tokens: Contracts.bsc.lps, useDefaultCoreAssets: true, }), + staking: calcBscStakingTvl, + }, +}; \ No newline at end of file From d8a527ca6f5e604181be8848912f1df5409b94fe Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Sun, 9 Jul 2023 00:11:43 +0100 Subject: [PATCH 0276/1974] add bsc contracts --- projects/penpie/config.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/projects/penpie/config.js b/projects/penpie/config.js index 36b200559dd..1d6d3ee2441 100644 --- a/projects/penpie/config.js +++ b/projects/penpie/config.js @@ -13,4 +13,11 @@ module.exports = { PENDLE: "0x0c880f6761F1af8d9Aa9C466984b80DAb9a8c9e8", pendleStaking: "0x6DB96BBEB081d2a85E0954C252f2c1dC108b3f81", }, + bsc: { + masterPenpie: "0xb35b3d118c0394e750b4b59d2a2f9307393cd5db", + vePENDLE: "0x8A09574b0401A856d89d1b583eE22E8cb0C5530B", + mPENDLE: "0x0465aad9da170798433f4ab7fa7ec8b9b9bf0bb1", + PENDLE: "0xb3Ed0A426155B79B898849803E3B36552f7ED507", + pendleStaking: "0x782d9d67feaa4d1cdf8222d9053c8cba1c3b7982", + }, }; From 9c87aa6a41d66c6846bc03b1166a3a3d33476756 Mon Sep 17 00:00:00 2001 From: define Date: Sun, 9 Jul 2023 10:55:59 +0100 Subject: [PATCH 0277/1974] add two wallets huobi --- projects/huobi/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/projects/huobi/index.js b/projects/huobi/index.js index 930ee55c8de..b9c5b0d2beb 100644 --- a/projects/huobi/index.js +++ b/projects/huobi/index.js @@ -8,6 +8,7 @@ const config = { '1KVpuCfhftkzJ67ZUegaMuaYey7qni7pPj', //These 3 addresses has 48,555 #Bitcoin. This is only less than 3% of the total high value assets we have, including btc, usd, stablecoins, T-bills.. According to Justin Sun https://twitter.com/justinsuntron/status/1590311559242612743 '14XKsv8tT6tt8P8mfDQZgNF8wtN5erNu5D', + '1LXzGrDQqKqVBqxfGDUyhC6rTRBN5s8Sbj' ], }, ethereum: { @@ -54,7 +55,10 @@ const config = { }, eos: { owners: ['vuniyuoxoeub'], - } + }, + ripple: { + owners: ['rKUDvXFJMFu65LqPTH3Yfpii4rbKT9bSQT'], + }, } module.exports = cexExports(config) From 49fecb3423ae96005bde7489a6ae1b0aa6cc2367 Mon Sep 17 00:00:00 2001 From: Michalis Kargakis Date: Sun, 9 Jul 2023 19:29:20 +0200 Subject: [PATCH 0278/1974] Share FRAX and SAFE addies (#6760) * Share FRAX address * Share SAFE address * Rename SFRETH to sfrxETH --- projects/asgardfinance/index.js | 2 +- projects/asymmetry-fi/index.js | 2 +- projects/bprotocol/index.js | 2 +- projects/celerbridge/index.js | 17 +---- projects/config/onx/constant.js | 2 +- projects/davos-protocol/index.js | 7 +- projects/dotoracle/index.js | 2 +- projects/finnexus/index.js | 2 +- projects/fpi/index.js | 4 +- projects/fraxlend/index.js | 3 +- projects/helper/coreAssets.json | 4 +- projects/helper/curvePools.js | 2 +- projects/helper/streamingHelper.js | 2 +- projects/metronome-synth/index.js | 4 +- projects/nomad/index.js | 8 +-- projects/ondofinance-v1/index.js | 2 +- projects/orion-money/index.js | 10 +-- projects/polygon/index.js | 2 +- projects/redacted/index.js | 4 +- projects/solace-finance/config.js | 2 +- projects/stakedao/index.js | 2 +- projects/standcash/index.js | 6 +- projects/swivel/index.js | 10 +-- projects/synapse/config.js | 104 ++++++++++++++--------------- projects/templedao-trade/index.js | 6 +- projects/templedao/index.js | 2 +- projects/tokemak/index.js | 6 +- projects/treasury/aave.js | 2 +- projects/treasury/aura.js | 6 +- projects/treasury/balancer.js | 19 +++--- projects/treasury/beanstalk.js | 6 +- projects/treasury/frax.js | 6 +- projects/treasury/guru-network.js | 6 +- projects/treasury/illuvium.js | 9 ++- projects/treasury/index-coop.js | 5 +- projects/treasury/inverse.js | 2 +- projects/treasury/iq.js | 11 ++- projects/treasury/jade-protocol.js | 16 ++--- projects/treasury/jpegd.js | 4 +- projects/treasury/looksrare.js | 4 +- projects/treasury/nexus-mutual.js | 6 +- projects/treasury/push.js | 2 +- projects/treasury/railgun.js | 6 +- projects/treasury/redacted.js | 12 ++-- projects/treasury/ribbon.js | 18 ++--- projects/treasury/stakedao.js | 12 ++-- projects/treasury/stargate.js | 2 +- projects/treasury/sudoswap.js | 2 +- projects/treasury/synapse.js | 60 ++++++++--------- projects/treasury/tokemak.js | 10 +-- 50 files changed, 212 insertions(+), 233 deletions(-) diff --git a/projects/asgardfinance/index.js b/projects/asgardfinance/index.js index 4aa1535a86e..bf5323aaa83 100644 --- a/projects/asgardfinance/index.js +++ b/projects/asgardfinance/index.js @@ -9,7 +9,7 @@ const AsgardTreasury = "0x9D5818af130705F95444d78A55B4F3d85cBfCC13"; const DAI = ADDRESSES.ethereum.DAI; const ASG_DAI_SLP = "0x024cc95611d478dd367240e72c82662d9e390a6a"; -const FRAX = "0x853d955acef822db058eb8505911ed77f175b99e"; +const FRAX = ADDRESSES.ethereum.FRAX; const ASG_FRAX_SLP = "0x5696cd9054ce11625141f5ee2c65fc4d57c2a5ca"; const WUST = "0xa47c8bf37f92abed4a126bda807a7b7498661acd"; const ASG_UST_SLP = "0x5a1abc007f031aa58238f45941d965ce6892fdff"; diff --git a/projects/asymmetry-fi/index.js b/projects/asymmetry-fi/index.js index 02ad6ab3318..8d669b28e39 100644 --- a/projects/asymmetry-fi/index.js +++ b/projects/asymmetry-fi/index.js @@ -7,7 +7,7 @@ module.exports = { tokensAndOwners: [ [ADDRESSES.ethereum.WSTETH, '0x972a53e3a9114f61b98921fb5b86c517e8f23fad'], [ADDRESSES.ethereum.RETH, '0x7b6633c0cd81dc338688a528c0a3f346561f5ca3'], - [ADDRESSES.ethereum.SFRETH, '0x36ce17a5c81e74dc111547f5dffbf40b8bf6b20a'], + [ADDRESSES.ethereum.sfrxETH, '0x36ce17a5c81e74dc111547f5dffbf40b8bf6b20a'], ] }) } diff --git a/projects/bprotocol/index.js b/projects/bprotocol/index.js index ee990af010a..8f5b6119651 100644 --- a/projects/bprotocol/index.js +++ b/projects/bprotocol/index.js @@ -33,7 +33,7 @@ const ADDRESSES = require('../helper/coreAssets.json') const usdtEth = ADDRESSES.ethereum.USDT const usdtArbitrum = ADDRESSES.arbitrum.USDT - const fraxEth = "0x853d955aCEf822Db058eb8505911ED77F175b99e" + const fraxEth = ADDRESSES.ethereum.FRAX const usdcFantomBAMM = "0xEDC7905a491fF335685e2F2F1552541705138A3D" const daiFantomBAMM = "0x6d62d6Af9b82CDfA3A7d16601DDbCF8970634d22" diff --git a/projects/celerbridge/index.js b/projects/celerbridge/index.js index d5a39397b18..4ee0a323bf0 100644 --- a/projects/celerbridge/index.js +++ b/projects/celerbridge/index.js @@ -117,7 +117,6 @@ const liquidityBridgeTokens = [ xdai: ADDRESSES.xdai.USDC, }, { - // BUSD ethereum: ADDRESSES.ethereum.BUSD, bsc: ADDRESSES.bsc.BUSD, }, @@ -319,7 +318,6 @@ const liquidityBridgeTokens = [ polygon: "0x08648471B5AAd25fEEeb853d6829048f3Fc37786", }, { - // iZi arbitrum: ADDRESSES.bsc.iZi, bsc: ADDRESSES.bsc.iZi, ethereum: "0x9ad37205d608B8b219e6a2573f922094CEc5c200", @@ -365,12 +363,9 @@ const liquidityBridgeTokens = [ ethereum: "0xcA37530E7c5968627BE470081d1C993eb1dEaf90", }, { - // cUSD celo: ADDRESSES.celo.cUSD, }, { - // WSYS - // origin: "syscoin:" + ADDRESSES.syscoin.WSYS, syscoin: ADDRESSES.syscoin.WSYS, bsc: "0x6822A778726CD2f0d4A1Cfaca2D04654e575cC82", ethereum: "0xF3C96924d85566C031ddc48DbC63B2d71da6D0f6", @@ -385,8 +380,7 @@ const liquidityBridgeTokens = [ ethereum: "0xa02120696c7b8fe16c09c749e4598819b2b0e915", }, { - // FRAX - ethereum: "0x853d955acef822db058eb8505911ed77f175b99e", + ethereum: ADDRESSES.ethereum.FRAX, }, { // FXS @@ -401,15 +395,12 @@ const liquidityBridgeTokens = [ bsc: "0x1fD991fb6c3102873ba68a4e6e6a87B3a5c10271", }, { - // BNB bsc: ADDRESSES.bsc.WBNB, }, { - // AVAX avax: ADDRESSES.avax.WAVAX, }, { - // FTM fantom: ADDRESSES.fantom.WFTM, }, { @@ -437,8 +428,6 @@ const liquidityBridgeTokens = [ heco: "0x4668e0E7cC545De886aBF038067F81cD4DC0924b", }, { - // SDN - // origin: "shiden:" + ADDRESSES.shiden.WSDN, shiden: ADDRESSES.shiden.WSDN, }, { @@ -450,15 +439,12 @@ const liquidityBridgeTokens = [ avax: "0x4fbf0429599460d327bd5f55625e30e4fc066095", }, { - // MATIC polygon: ADDRESSES.polygon.WMATIC_2, }, { - // AAVE ethereum: ADDRESSES.ethereum.AAVE, }, { - // CRV ethereum: ADDRESSES.ethereum.CRV, }, { @@ -486,7 +472,6 @@ const liquidityBridgeTokens = [ boba: "0xCe055Ea4f29fFB8bf35E852522B96aB67Cbe8197", }, { - // LUSD ethereum: ADDRESSES.ethereum.LUSD, }, { diff --git a/projects/config/onx/constant.js b/projects/config/onx/constant.js index 6ba33a7187b..9b3c7b565cb 100644 --- a/projects/config/onx/constant.js +++ b/projects/config/onx/constant.js @@ -12,7 +12,7 @@ const tokenAddresses = { aethToken: "0xE95A203B1a91a908F9B9CE46459d101078c2c3cb", onsToken: "0xfC97C0c12438B6E4CF246cD831b02FeF4950DCAD", daiToken: ADDRESSES.ethereum.DAI, - fraxToken: "0x853d955acef822db058eb8505911ed77f175b99e", + fraxToken: ADDRESSES.ethereum.FRAX, usdcToken: ADDRESSES.ethereum.USDC, aethPairEth: "0x6147805e1011417B93e5D693424a62A70d09d0E5", aethPairOns: "0x5022BbC26B3Bc8c8d2F1F7dB9ee3A2B4631b9b18", diff --git a/projects/davos-protocol/index.js b/projects/davos-protocol/index.js index 930d905b680..f4f6b47fe8d 100644 --- a/projects/davos-protocol/index.js +++ b/projects/davos-protocol/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokensExport, } = require('../helper/unknownTokens') module.exports = { @@ -9,10 +10,10 @@ module.exports = { }, ethereum: { tvl: sumTokensExport({ chain: 'ethereum', owner: '0x819d1Daa794c1c46B841981b61cC978d95A17b8e', tokens: [ - '0x7f39c581f595b53c5cb19bd0b3f8da6c935e2ca0', // WSTETH - '0xae78736cd615f374d3085123a210448e74fc6393', //reth + ADDRESSES.ethereum.WSTETH, + ADDRESSES.ethereum.RETH, '0x9ee91f9f426fa633d227f7a9b000e28b9dfd8599', //stmatic - '0xac3e018457b222d93114458476f3e3416abbe38f', //SFRXETH + ADDRESSES.ethereum.sfrxETH, ] }), } } diff --git a/projects/dotoracle/index.js b/projects/dotoracle/index.js index 78eb4bb8f2c..979e146a078 100644 --- a/projects/dotoracle/index.js +++ b/projects/dotoracle/index.js @@ -13,7 +13,7 @@ const config = { usdc: ADDRESSES.ethereum.USDC, usdt: ADDRESSES.ethereum.USDT, DAI: ADDRESSES.ethereum.DAI, - frax: '0x853d955acef822db058eb8505911ed77f175b99e', + frax: ADDRESSES.ethereum.FRAX, fxs: '0x3432b6a60d23ca0dfca7761b7ab56459d9c964d0', maker: ADDRESSES.ethereum.MKR, aave: ADDRESSES.ethereum.AAVE, diff --git a/projects/finnexus/index.js b/projects/finnexus/index.js index f0cc21f4d17..e64e540448e 100644 --- a/projects/finnexus/index.js +++ b/projects/finnexus/index.js @@ -5,7 +5,7 @@ const config = { // ['0xef9cd7882c067686691b6ff49e650b43afbbcc6b', '0x919a35A4F40c479B3319E3c3A2484893c06fd7de'], [ADDRESSES.ethereum.USDC, '0xff60d81287BF425f7B2838a61274E926440ddAa6'], [ADDRESSES.ethereum.USDT, '0xff60d81287BF425f7B2838a61274E926440ddAa6'], - ['0x853d955acef822db058eb8505911ed77f175b99e', '0x6f88e8fbF5311ab47527f4Fb5eC10078ec30ab10'], + [ADDRESSES.ethereum.FRAX, '0x6f88e8fbF5311ab47527f4Fb5eC10078ec30ab10'], ], wan: [ // ['0xC6F4465A6a521124C8e3096B62575c157999D361', '0xe96E4d6075d1C7848bA67A6850591a095ADB83Eb'], diff --git a/projects/fpi/index.js b/projects/fpi/index.js index 587b43b4403..90a3ccf3c99 100644 --- a/projects/fpi/index.js +++ b/projects/fpi/index.js @@ -1,4 +1,6 @@ -const frax = "0x853d955acef822db058eb8505911ed77f175b99e" +const ADDRESSES = require('../helper/coreAssets.json') + +const frax = ADDRESSES.ethereum.FRAX const fxs = "0x3432b6a60d23ca0dfca7761b7ab56459d9c964d0" async function tvl(_, _b, _cb, { api, erc20 }){ diff --git a/projects/fraxlend/index.js b/projects/fraxlend/index.js index 27f8acbf274..86df2b95b80 100644 --- a/projects/fraxlend/index.js +++ b/projects/fraxlend/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const abi = require("./abi.json"); const { sumTokens2 } = require('../helper/unwrapLPs') @@ -11,7 +12,7 @@ async function tvl(timestamp, block, chainBlocks, { api }) { async function borrowed(timestamp, block, chainBlocks, { api }) { const pairs = await api.call({ target: REGISTRY_ADDR, abi: abi['getAllPairAddresses'], }) const bals = await api.multiCall({ abi: 'function totalBorrow() view returns (uint128 amount, uint128 shares)', calls: pairs }) - bals.forEach(bal => api.add('0x853d955acef822db058eb8505911ed77f175b99e', bal.amount)) + bals.forEach(bal => api.add(ADDRESSES.ethereum.FRAX, bal.amount)) } module.exports = { diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index 28828deac8c..d8f2cb7de23 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -4,7 +4,7 @@ "WETH": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", "WSTETH": "0x7f39c581f595b53c5cb19bd0b3f8da6c935e2ca0", "STETH": "0xae7ab96520de3a18e5e111b5eaab095312d7fe84", - "SFRETH": "0xac3e018457b222d93114458476f3e3416abbe38f", + "sfrxETH": "0xac3e018457b222d93114458476f3e3416abbe38f", "USDC": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", "LINK": "0x514910771af9ca656af840dff83e8264ecf986ca", "MATIC": "0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0", @@ -22,9 +22,11 @@ "cvxCRV": "0x62B9c7356A2Dc64a1969e19C23e4f579F9810Aa7", "vlCVX": "0x72a19342e8f1838460ebfccef09f6585e32db86e", "CVX": "0x4e3FBD56CD56c3e72c1403e103b45Db9da5B9D2B", + "FRAX": "0x853d955aCEf822Db058eb8505911ED77F175b99e", "BNB": "0xb8c77482e45f1f44de1745f52c74426c631bdd52", "tBTC": "0x18084fba666a33d37592fa2633fd49a74dd93a88", "USX": "0x0a5e677a6a24b2f1a2bf4f3bffc443231d2fdec8", + "SAFE": "0x5aFE3855358E112B5647B952709E6165e1c1eEEe", "TOKE": "0x2e9d63788249371f1dfc918a52f8d799f4a38c94", "TUSD": "0x0000000000085d4780B73119b644AE5ecd22b376", "BUSD": "0x4fabb145d64652a948d72533023f6e7a623c7c53", diff --git a/projects/helper/curvePools.js b/projects/helper/curvePools.js index e4b847a0aad..4c4cd6f354b 100644 --- a/projects/helper/curvePools.js +++ b/projects/helper/curvePools.js @@ -156,7 +156,7 @@ module.exports = { '0xd632f22692fac7611d2aa1c0d552930d43caed3b': { swapContract: '0xd632f22692fac7611d2aa1c0d552930d43caed3b', underlyingTokens: [ - '0x853d955acef822db058eb8505911ed77f175b99e', + ADDRESSES.ethereum.FRAX, '0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490' ] }, diff --git a/projects/helper/streamingHelper.js b/projects/helper/streamingHelper.js index 32f1000a896..0b440f0b24a 100644 --- a/projects/helper/streamingHelper.js +++ b/projects/helper/streamingHelper.js @@ -43,7 +43,7 @@ const stableTokenAddresses = [ ADDRESSES.ethereum.DAI, ADDRESSES.ethereum.USDC, ADDRESSES.ethereum.USDT, - '0x853d955aCEf822Db058eb8505911ED77F175b99e', + ADDRESSES.ethereum.FRAX, '0xe2f2a5C287993345a840Db3B0845fbC70f5935a5', ADDRESSES.ethereum.WETH, diff --git a/projects/metronome-synth/index.js b/projects/metronome-synth/index.js index 9eab11276f8..2fce1487334 100644 --- a/projects/metronome-synth/index.js +++ b/projects/metronome-synth/index.js @@ -9,12 +9,12 @@ module.exports = { ADDRESSES.ethereum.USDC, ADDRESSES.ethereum.WETH, "0xd1C117319B3595fbc39b471AB1fd485629eb05F2", - "0x853d955aCEf822Db058eb8505911ED77F175b99e", + ADDRESSES.ethereum.FRAX, ADDRESSES.ethereum.DAI, ADDRESSES.ethereum.WBTC, "0xa8b607Aa09B6A2E306F93e74c282Fb13f6A80452", "0xc14900dFB1Aa54e7674e1eCf9ce02b3b35157ba5", - ADDRESSES.ethereum.SFRETH, + ADDRESSES.ethereum.sfrxETH, "0x4Dbe3f01aBe271D3E65432c74851625a8c30Aa7B", "0x650CD45DEdb19c33160Acc522aD1a82D9701036a", "0xDD9F61a85fFE73E41eF889817972f0B0AaE6D6Dd" diff --git a/projects/nomad/index.js b/projects/nomad/index.js index fd528b033aa..6639c25b3ab 100644 --- a/projects/nomad/index.js +++ b/projects/nomad/index.js @@ -16,19 +16,15 @@ const HOME_CHAINS = { const TOKEN_ADDRESSES = [ { - // FRAX - 'ethereum': '0x853d955aCEf822Db058eb8505911ED77F175b99e' + 'ethereum': ADDRESSES.ethereum.FRAX }, { - // USDC 'ethereum': ADDRESSES.ethereum.USDC }, { - // DAI 'ethereum': ADDRESSES.ethereum.DAI }, { - // USDT 'ethereum': ADDRESSES.ethereum.USDT }, { @@ -36,11 +32,9 @@ const TOKEN_ADDRESSES = [ 'ethereum': '0x3432B6A60D23Ca0dFCa7761B7ab56459D9C964D0' }, { - // WETH 'ethereum': ADDRESSES.ethereum.WETH }, { - // WBTC 'ethereum': ADDRESSES.ethereum.WBTC }, { diff --git a/projects/ondofinance-v1/index.js b/projects/ondofinance-v1/index.js index 1867f5b2b20..86e7796899f 100644 --- a/projects/ondofinance-v1/index.js +++ b/projects/ondofinance-v1/index.js @@ -45,7 +45,7 @@ const data = { supported_tokens: [ "0x4Eb8b4C65D8430647586cf44af4Bf23dEd2Bb794", "0x36784d3B5aa8A807698475b3437a13fA20B7E9e1", - "0x853d955aCEf822Db058eb8505911ED77F175b99e", + ADDRESSES.ethereum.FRAX, "0x3432B6A60D23Ca0dFCa7761B7ab56459D9C964D0", "0x956F47F50A910163D8BF957Cf5846D573E7f87CA", "0x0f2D719407FdBeFF09D87557AbB7232601FD9F29", diff --git a/projects/orion-money/index.js b/projects/orion-money/index.js index 92003423416..3179ed945fb 100644 --- a/projects/orion-money/index.js +++ b/projects/orion-money/index.js @@ -5,12 +5,12 @@ const fundedContracts = [ '0xd9184981bbab68e05eafd631dd2f8cbaf47e3e13' //TransparentUpgradeableProxy ]; const stable = [ - ADDRESSES.ethereum.USDC, //'USDC' : - ADDRESSES.ethereum.USDT, //'USDT' : - ADDRESSES.ethereum.DAI, //'DAI' : + ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.USDT, + ADDRESSES.ethereum.DAI, '0xa47c8bf37f92abed4a126bda807a7b7498661acd', //'wUST' : - ADDRESSES.ethereum.BUSD, //'BUSD' : - '0x853d955acef822db058eb8505911ed77f175b99e' //'FRAX' : + ADDRESSES.ethereum.BUSD, + ADDRESSES.ethereum.FRAX, ]; const anchor = [ '0x94eAd8f528A3aF425de14cfdDA727B218915687C', //'aUSDC': diff --git a/projects/polygon/index.js b/projects/polygon/index.js index 96d9f1e166c..d8c647dba2e 100644 --- a/projects/polygon/index.js +++ b/projects/polygon/index.js @@ -55,7 +55,7 @@ async function tvl(_, block) { '0xe912b8bA2513D7e29b7b2E5B14398dbf77503Fb4', '0xba8a621b4a54e61c442f5ec623687e2a942225ef', '0x249e38ea4102d0cf8264d3701f1a0e39c4f2dc3b', - '0x853d955acef822db058eb8505911ed77f175b99e', + ADDRESSES.ethereum.FRAX, '0xd0cd466b34a24fcb2f87676278af2005ca8a78c4', '0x3a4f40631a4f906c2BaD353Ed06De7A5D3fCb430', '0xba100000625a3754423978a60c9317c58a424e3d', diff --git a/projects/redacted/index.js b/projects/redacted/index.js index 0d5c4440f5b..01745540a4c 100644 --- a/projects/redacted/index.js +++ b/projects/redacted/index.js @@ -36,10 +36,8 @@ async function tvl(timestamp, block, chainBlocks){ [AURA, false], // BTRFLY/ETH Curve LP ['0x7483Dd57f6488b0e194A151C57Df6Ec85C00aCE9', false], - // USDC [ADDRESSES.ethereum.USDC, false], - // FRAX - ['0x853d955aCEf822Db058eb8505911ED77F175b99e', false], + [ADDRESSES.ethereum.FRAX, false], ], treasuries, block) //Add UniswapV3 LPs diff --git a/projects/solace-finance/config.js b/projects/solace-finance/config.js index 88929964148..51f428ae11d 100644 --- a/projects/solace-finance/config.js +++ b/projects/solace-finance/config.js @@ -6,7 +6,7 @@ module.exports = { uwp_address: '0x5efC0d9ee3223229Ce3b53e441016efC5BA83435', tokens: [ { - PoolToken: "0x853d955aCEf822Db058eb8505911ED77F175b99e", + PoolToken: ADDRESSES.ethereum.FRAX, TokenTicker: "FRAX", }, { diff --git a/projects/stakedao/index.js b/projects/stakedao/index.js index 14d9bee993a..9382c955e77 100644 --- a/projects/stakedao/index.js +++ b/projects/stakedao/index.js @@ -90,7 +90,7 @@ async function tvl(timestamp, block, _, { api }) { const angle_sanFRAX_V3 = { contract: angle_protocol.locker, sanFraxEurGauge: '0xb40432243E4F317cE287398e72Ab8f0312fc2FE8', - fraxToken: '0x853d955aCEf822Db058eb8505911ED77F175b99e', + fraxToken: ADDRESSES.ethereum.FRAX, abi: 'balanceOf', } const angle_sushi_agEUR_V3 = { diff --git a/projects/standcash/index.js b/projects/standcash/index.js index 2fbf23e79f7..62665eeb70e 100644 --- a/projects/standcash/index.js +++ b/projects/standcash/index.js @@ -40,15 +40,11 @@ const poolContracts = [ ]; const tokenAddresses = [ - //USDT ADDRESSES.ethereum.USDT, - //USDC ADDRESSES.ethereum.USDC, - //FRAX - "0x853d955acef822db058eb8505911ed77f175b99e", + ADDRESSES.ethereum.FRAX, //ESD "0x36F3FD68E7325a35EB768F1AedaAe9EA0689d723", - //DAI ADDRESSES.ethereum.DAI, //BAC "0x3449fc1cd036255ba1eb19d65ff4ba2b8903a69a", diff --git a/projects/swivel/index.js b/projects/swivel/index.js index f5729272dc0..ff654a4a7d4 100644 --- a/projects/swivel/index.js +++ b/projects/swivel/index.js @@ -14,14 +14,14 @@ module.exports = { ], tokens: [ "0x5d3a536E4D6DbD6114cc1Ead35777bAB948E3643", // cDAI - ADDRESSES.ethereum.DAI, // DAI - ADDRESSES.ethereum.USDC, // USDC + ADDRESSES.ethereum.DAI, + ADDRESSES.ethereum.USDC, "0x39AA39c021dfbaE8faC545936693aC917d5E7563", // cUSDC, // "0xEb91861f8A4e1C12333F42DCE8fB0Ecdc28dA716", // eUSDC - ADDRESSES.ethereum.STETH, // Lido stETH - ADDRESSES.ethereum.WSTETH, // Lido wstETH + ADDRESSES.ethereum.STETH, + ADDRESSES.ethereum.WSTETH, "0x5E8422345238F34275888049021821E8E08CAa1f", // frxETH - ADDRESSES.ethereum.SFRETH // sfrxETH + ADDRESSES.ethereum.sfrxETH ] }) } diff --git a/projects/synapse/config.js b/projects/synapse/config.js index f568024c5a9..af2ca176fc6 100644 --- a/projects/synapse/config.js +++ b/projects/synapse/config.js @@ -6,9 +6,9 @@ module.exports = { { pool: '0x1116898dda4015ed8ddefb84b6e8bc24528af2d8', tokens: [ - ADDRESSES.ethereum.DAI, // DAI - ADDRESSES.ethereum.USDC, // USDC - ADDRESSES.ethereum.USDT, // USDT + ADDRESSES.ethereum.DAI, + ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.USDT, ] }, ], @@ -16,17 +16,17 @@ module.exports = { address: '0x2796317b0fF8538F253012862c06787Adfb8cEb6', tokens: [ '0x98585dfc8d9e7d48f0b1ae47ce33332cf4237d96', // NEWO - ADDRESSES.ethereum.WETH, // WETH + ADDRESSES.ethereum.WETH, '0x0ab87046fBb341D058F17CBC4c1133F25a20a52f', // gOHM '0x71ab77b7dbb4fa7e017bc15090b2163221420282', // HIGH - '0x853d955acef822db058eb8505911ed77f175b99e', // FRAX + ADDRESSES.ethereum.FRAX, '0xbaac2b4491727d78d2b78815144570b9f2fe8899', // DOG '0x73968b9a57c6e53d41345fd57a6e6ae27d6cdb2f', // SDT - ADDRESSES.ethereum.USDC, // USDC - ADDRESSES.ethereum.USDT, // USDT + ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.USDT, '0xb753428af26e81097e7fd17f40c88aaa3e04902c', // SFI - ADDRESSES.ethereum.DAI, // DAI - ADDRESSES.ethereum.WBTC, // wBTC + ADDRESSES.ethereum.DAI, + ADDRESSES.ethereum.WBTC, '0x1a7e4e63778B4f12a199C062f3eFdD288afCBce8', // agEUR '0x0642026E7f0B6cCaC5925b4E7Fa61384250e1701', // H2O '0x02B5453D92B730F29a86A0D5ef6e930c4Cf8860B', // USDB @@ -45,14 +45,14 @@ module.exports = { pool: '0xE27BFf97CE92C3e1Ff7AA9f86781FDd6D48F5eE9', tokens: [ // '0x809DC529f07651bD43A172e8dB6f4a7a0d771036', // neth - ADDRESSES.optimism.WETH, // weth + ADDRESSES.optimism.WETH, ] }, { pool: '0xF44938b0125A6662f9536281aD2CD6c499F22004', tokens: [ // ADDRESSES.metis.SYN, // nusd - ADDRESSES.optimism.USDC, // usdc + ADDRESSES.optimism.USDC, ] }, ], @@ -63,10 +63,10 @@ module.exports = { bridge: { address: '0xC05e61d0E7a63D27546389B7aD62FdFf5A91aACE', tokens: [ - ADDRESSES.avax.WAVAX, // WAVAX + ADDRESSES.avax.WAVAX, '0x1f1e7c893855525b303f99bdf5c3c05be09ca251', // SYN '0x321E7092a180BB43555132ec53AaA65a5bF84251', // gOHM - ADDRESSES.avax.BTC_b, // BTC.b + ADDRESSES.avax.BTC_b, '0x5aB7084CB9d270c2Cb052dd30dbecBCA42F8620c', // USDB '0x62edc0692BD897D2295872a9FFCac5425011c661', // GMX ] @@ -75,9 +75,9 @@ module.exports = { { pool: '0xED2a7edd7413021d440b09D654f3b87712abAB66', tokens: [ - ADDRESSES.avax.DAI, // DAI - ADDRESSES.avax.USDC_e, // USDC - ADDRESSES.avax.USDT_e, // USDT + ADDRESSES.avax.DAI, + ADDRESSES.avax.USDC_e, + ADDRESSES.avax.USDT_e, // "0xCFc37A6AB183dd4aED08C204D1c2773c0b1BDf46", // nusd ] }, @@ -101,7 +101,7 @@ module.exports = { { pool: '0xCb6674548586F20ca39C97A52A0ded86f48814De', tokens: [ - ADDRESSES.cronos.USDC, // DAI + ADDRESSES.cronos.USDC, // "0x396c9c192dd323995346632581BEF92a31AC623b", // nusd ] }, @@ -115,7 +115,7 @@ module.exports = { tokens: [ '0x5f4bde007dc06b867f86ebfe4802e34a1ffeed63', // HIGH '0xaA88C603d142C371eA0eAC8756123c5805EdeE03', // DOG - ADDRESSES.bsc.BUSD, // BUSD + ADDRESSES.bsc.BUSD, '0x0FE9778c005a5A6115cBE12b0568a2d50b765A51', // NFD '0x130025eE738A66E691E6A7a62381CB33c6d9Ae83', // JUMP '0xc8699AbBba90C7479dedcCEF19eF78969a2fc608', // USDB @@ -125,9 +125,9 @@ module.exports = { { pool: '0x28ec0B36F0819ecB5005cAB836F4ED5a2eCa4D13', tokens: [ - ADDRESSES.bsc.BUSD, // BUSD - ADDRESSES.bsc.USDC, // USDC - ADDRESSES.bsc.USDT, // USDT + ADDRESSES.bsc.BUSD, + ADDRESSES.bsc.USDC, + ADDRESSES.bsc.USDT, // "0x23b891e5c62e0955ae2bd185990103928ab817b3", // nusd ] }, @@ -140,16 +140,16 @@ module.exports = { address: '0x8f5bbb2bb8c2ee94639e55d5f41de9b4839c1280', tokens: [ '0xd8cA34fd379d9ca3C6Ee3b3905678320F5b45195', // gOHM - ADDRESSES.polygon.WMATIC_2, // wMATIC + ADDRESSES.polygon.WMATIC_2, ] }, pools: [ { pool: '0x85fCD7Dd0a1e1A9FCD5FD886ED522dE8221C3EE5', tokens: [ - ADDRESSES.polygon.DAI, // DAI - ADDRESSES.polygon.USDC, // USDC - ADDRESSES.polygon.USDT, // USDT + ADDRESSES.polygon.DAI, + ADDRESSES.polygon.USDC, + ADDRESSES.polygon.USDT, // "0xb6c473756050de474286bed418b77aeac39b02af", // nusd ] }, @@ -162,7 +162,7 @@ module.exports = { address: '0xAf41a65F786339e7911F4acDAD6BD49426F2Dc6b', tokens: [ '0x91fa20244Fb509e8289CA630E5db3E9166233FDc', // gOHM - ADDRESSES.fantom.WFTM, // wFTM + ADDRESSES.fantom.WFTM, '0x6Fc9383486c163fA48becdEC79d6058f984f62cA', // USDB ] }, @@ -170,17 +170,17 @@ module.exports = { { pool: '0x85662fd123280827e11c59973ac9fcbe838dc3b4', tokens: [ - ADDRESSES.fantom.USDC, // USDC - ADDRESSES.fantom.fUSDT, // fUSDT + ADDRESSES.fantom.USDC, + ADDRESSES.fantom.fUSDT, // "0xED2a7edd7413021d440b09D654f3b87712abAB66", // nusd ] }, { pool: ADDRESSES.arbitrum.nUSD, tokens: [ - ADDRESSES.fantom.MIM, // MIM - ADDRESSES.fantom.USDC, // USDC - ADDRESSES.fantom.fUSDT, // USDT + ADDRESSES.fantom.MIM, + ADDRESSES.fantom.USDC, + ADDRESSES.fantom.fUSDT, // "0xED2a7edd7413021d440b09D654f3b87712abAB66", // nusd ] }, @@ -205,16 +205,16 @@ module.exports = { { pool: '0x753bb855c8fe814233d26Bb23aF61cb3d2022bE5', tokens: [ - ADDRESSES.boba.WETH, // weth + ADDRESSES.boba.WETH, // "0x96419929d7949D6A801A6909c145C8EEf6A40431", // neth ] }, { pool: '0x75FF037256b36F15919369AC58695550bE72fead', tokens: [ - ADDRESSES.boba.DAI, // DAI - ADDRESSES.boba.USDC, // USDC - ADDRESSES.boba.USDT, // USDT + ADDRESSES.boba.DAI, + ADDRESSES.boba.USDC, + ADDRESSES.boba.USDT, // "0x6B4712AE9797C199edd44F897cA09BC57628a1CF", // nusd ] }, @@ -233,14 +233,14 @@ module.exports = { { pool: '0x09fec30669d63a13c666d2129230dd5588e2e240', tokens: [ - ADDRESSES.metis.WETH, // weth + ADDRESSES.metis.WETH, // "0x931b8f17764362a3325d30681009f0edd6211231", // neth ] }, { pool: '0x555982d2E211745b96736665e19D9308B615F78e', tokens: [ - ADDRESSES.metis.m_USDC, // USDC + ADDRESSES.metis.m_USDC, // "0x961318fc85475e125b99cc9215f62679ae5200ab", // nusd ] }, @@ -259,24 +259,24 @@ module.exports = { { pool: '0xa067668661C84476aFcDc6fA5D758C4c01C34352', tokens: [ - ADDRESSES.arbitrum.WETH, // weth + ADDRESSES.arbitrum.WETH, // "0x3ea9b0ab55f34fb188824ee288ceaefc63cf908e", // neth ] }, { pool: '0x9Dd329F5411466d9e0C488fF72519CA9fEf0cb40', tokens: [ - ADDRESSES.arbitrum.USDT, // USDT - ADDRESSES.arbitrum.USDC, // USDC + ADDRESSES.arbitrum.USDT, + ADDRESSES.arbitrum.USDC, // ADDRESSES.arbitrum.nUSD, // nusd ] }, { pool: '0x0Db3FE3B770c95A0B99D1Ed6F2627933466c0Dd8', tokens: [ - ADDRESSES.arbitrum.USDT, // USDT - ADDRESSES.arbitrum.USDC, // USDC - ADDRESSES.arbitrum.MIM, // MIM + ADDRESSES.arbitrum.USDT, + ADDRESSES.arbitrum.USDC, + ADDRESSES.arbitrum.MIM, // ADDRESSES.arbitrum.nUSD, // nusd ] }, @@ -294,8 +294,8 @@ module.exports = { { pool: '0xcEf6C2e20898C2604886b888552CA6CcF66933B0', tokens: [ - ADDRESSES.aurora.USDC_e, // USDC - ADDRESSES.aurora.USDT_e, // USDT + ADDRESSES.aurora.USDC_e, + ADDRESSES.aurora.USDT_e, // ADDRESSES.aurora.nUSD, // nusd ] }, @@ -307,8 +307,8 @@ module.exports = { bridge: { address: '0xAf41a65F786339e7911F4acDAD6BD49426F2Dc6b', tokens: [ - ADDRESSES.harmony.JEWEL, // JEWEL - ADDRESSES.harmony.xJEWEL, // xJEWEL + ADDRESSES.harmony.JEWEL, + ADDRESSES.harmony.xJEWEL, '0x24eA0D436d3c2602fbfEfBe6a16bBc304C963D04', // DFKTEARS ] }, @@ -332,7 +332,7 @@ module.exports = { { pool: '0x00A4F57D926781f62D09bb05ec76e6D8aE4268da', tokens: [ - ADDRESSES.harmony.AVAX, // avax + ADDRESSES.harmony.AVAX, // "???", // synAvax ] }, @@ -370,21 +370,21 @@ module.exports = { { pool: ADDRESSES.aurora.nUSD, tokens: [ - ADDRESSES.canto.NOTE, // NOTE + ADDRESSES.canto.NOTE, // "0xd8836af2e565d3befce7d906af63ee45a57e8f80", // nUSD ] }, { pool: '0x273508478e099Fdf953349e6B3704E7c3dEE91a5', tokens: [ - ADDRESSES.functionx.WFX, // USDC + ADDRESSES.functionx.WFX, // "0xd8836af2e565d3befce7d906af63ee45a57e8f80", // nusd ] }, { pool: '0xF60F88bA0CB381b8D8A662744fF93486273c22F9', tokens: [ - ADDRESSES.functionx.PURSE, // cantoETH + ADDRESSES.functionx.PURSE, // "0x09fec30669d63a13c666d2129230dd5588e2e240", // nETH ] }, @@ -409,7 +409,7 @@ module.exports = { pool: '0xfdbad1699a550f933efebf652a735f2f89d3833c', tokens: [ "0xd6dab4cff47df175349e6e7ee2bf7c40bb8c05a3", // USDT - ADDRESSES.klaytn.oUSDT, // o.USDT + ADDRESSES.klaytn.oUSDT, ] }, ] diff --git a/projects/templedao-trade/index.js b/projects/templedao-trade/index.js index 2e155b27ddf..b0cb2306aff 100644 --- a/projects/templedao-trade/index.js +++ b/projects/templedao-trade/index.js @@ -1,12 +1,10 @@ const sdk = require("@defillama/sdk"); - - -const FRAX = "0x853d955aCEf822Db058eb8505911ED77F175b99e"; +const ADDRESSES = require('../helper/coreAssets.json') const tvlContracts = [ { address: '0x98257C876ACe5009e7B97843F8c71b3AE795c71E', // AMMrouter - token: FRAX + token: ADDRESSES.ethereum.FRAX } ]; diff --git a/projects/templedao/index.js b/projects/templedao/index.js index 1d52c4cc63c..3cc965307c2 100644 --- a/projects/templedao/index.js +++ b/projects/templedao/index.js @@ -15,7 +15,7 @@ const TEMPLE = "0x470ebf5f030ed85fc1ed4c2d36b9dd02e77cf1b7"; const auraLocker = '0x3Fa73f1E5d8A792C80F426fc8F84FBF7Ce9bBCAC'; const templeTreasuryContract = "0x5c8898f8e0f9468d4a677887bc03ee2659321012"; -const FRAX = "0x853d955acef822db058eb8505911ed77f175b99e"; +const FRAX = ADDRESSES.ethereum.FRAX; const FXS = "0x3432b6a60d23ca0dfca7761b7ab56459d9c964d0"; const CVX_FXS = ADDRESSES.ethereum.cvxFXS; const AURA = '0xC0c293ce456fF0ED870ADd98a0828Dd4d2903DBF' diff --git a/projects/tokemak/index.js b/projects/tokemak/index.js index 27abde62188..c65db1ca39b 100644 --- a/projects/tokemak/index.js +++ b/projects/tokemak/index.js @@ -1,8 +1,7 @@ const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk') -const { sumTokens, sumTokens2, } = require('../helper/unwrapLPs') +const { sumTokens2, } = require('../helper/unwrapLPs') const abi = require("../pendle/abi.json"); -const BigNumber = require('bignumber.js') const positions = require('./positions.json'); const cvx_abi = { @@ -16,7 +15,6 @@ const cvx_abi = { stkcvxFRAXBP_lockedStakesOf: "function lockedStakesOf(address account) view returns (tuple(bytes32 kek_id, uint256 start_timestamp, uint256 liquidity, uint256 ending_timestamp, uint256 lock_multiplier)[])", } -const cvxBoosterAddress = "0xF403C135812408BFbE8713b5A23a04b3D48AAE31"; const degenesisContract = "0xc803737D3E12CC4034Dde0B2457684322100Ac38"; const wethPool = "0xD3D13a578a53685B4ac36A1Bab31912D2B2A2F36"; const usdcPool = "0x04bda0cf6ad025948af830e75228ed420b0e860d"; @@ -39,7 +37,7 @@ const rtoke3 = "0xA374A62DdBd21e3d5716cB04821CB710897c0972"; const sushiPool = "0xf49764c9C5d644ece6aE2d18Ffd9F1E902629777"; const sushi = ADDRESSES.ethereum.SUSHI; const fraxPool = "0x94671A3ceE8C7A12Ea72602978D1Bb84E920eFB2"; -const frax = "0x853d955acef822db058eb8505911ed77f175b99e"; +const frax = ADDRESSES.ethereum.FRAX; const daiPool = "0x0CE34F4c26bA69158BC2eB8Bf513221e44FDfB75"; const dai = ADDRESSES.ethereum.DAI; const feiPool = "0x03DccCd17CC36eE61f9004BCfD7a85F58B2D360D"; diff --git a/projects/treasury/aave.js b/projects/treasury/aave.js index 36884d3c3d0..0aa792d7d3d 100644 --- a/projects/treasury/aave.js +++ b/projects/treasury/aave.js @@ -77,7 +77,7 @@ module.exports = treasuryExports({ '0xc713e5E149D5D0715DcD1c156a020976e7E56B88', // aMKR ADDRESSES.ethereum.BUSD, '0xA361718326c15715591c299427c62086F69923D9', // aBUSD - '0x853d955acef822db058eb8505911ed77f175b99e', // FRAX + ADDRESSES.ethereum.FRAX, '0xd4937682df3C8aEF4FE912A96A74121C0829E664', // aFRAX ADDRESSES.ethereum.sUSD, '0x6C5024Cd4F8A59110119C56f8933403A539555EB', // aSUSD diff --git a/projects/treasury/aura.js b/projects/treasury/aura.js index 0e7b4304316..906185f16f8 100644 --- a/projects/treasury/aura.js +++ b/projects/treasury/aura.js @@ -13,10 +13,10 @@ module.exports = treasuryExports({ ], tokens: [ nullAddress, - ADDRESSES.ethereum.USDC, // USDC - ADDRESSES.ethereum.WETH, // WETH + ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.WETH, "0xba100000625a3754423978a60c9317c58a424e3D", // BAL - "0x5aFE3855358E112B5647B952709E6165e1c1eEEe", // SAFE + ADDRESSES.ethereum.SAFE, "0x0d02755a5700414B26FF040e1dE35D337DF56218", // BEND "0x616e8BfA43F920657B3497DBf40D6b1A02D4608d", // auraBAL "0x3dd0843A028C86e0b760b1A76929d1C5Ef93a2dd", // B-auraBAL-STABLE diff --git a/projects/treasury/balancer.js b/projects/treasury/balancer.js index 8f0677a3c5f..c574c04df00 100644 --- a/projects/treasury/balancer.js +++ b/projects/treasury/balancer.js @@ -3,9 +3,6 @@ const { nullAddress, treasuryExports } = require("../helper/treasury"); const eth = "0x10A19e7eE7d7F8a52822f6817de8ea18204F2e4f"; const eth2 = "0xb129f73f1afd3a49c701241f374db17ae63b20eb" -const polygon = "0xd2bD536ADB0198f74D5f4f2Bd4Fe68Bae1e1Ba80"; -const arbitrum = "0x6207ed574152496c9B072C24FD87cE9cd9E17320"; -const optimism = "0x043f9687842771b3dF8852c1E9801DCAeED3f6bc"; const bal = "0xba100000625a3754423978a60c9317c58a424e3D"; const abal = "0x272F97b7a56a387aE942350bBC7Df5700f8a4576"; @@ -14,16 +11,16 @@ module.exports = treasuryExports({ ethereum: { tokens: [ nullAddress, - ADDRESSES.ethereum.LIDO, // LDO - ADDRESSES.ethereum.USDC, // USDC + ADDRESSES.ethereum.LIDO, + ADDRESSES.ethereum.USDC, "0xDe30da39c46104798bB5aA3fe8B9e0e1F348163F", // GTC "0xCFEAead4947f0705A14ec42aC3D44129E1Ef3eD5", // NOTE - ADDRESSES.ethereum.WETH, // WETH + ADDRESSES.ethereum.WETH, "0x2d94AA3e47d9D5024503Ca8491fcE9A2fB4DA198", // BANK - ADDRESSES.ethereum.DAI, // DAI + ADDRESSES.ethereum.DAI, "0x226f7b842E0F0120b7E194D05432b3fd14773a9D", // UNN - ADDRESSES.ethereum.STETH, // stETH - "0x5aFE3855358E112B5647B952709E6165e1c1eEEe", // SAFE + ADDRESSES.ethereum.STETH, + ADDRESSES.ethereum.SAFE, ], owners: [eth, eth2], ownTokens: [bal, abal], @@ -31,8 +28,8 @@ module.exports = treasuryExports({ arbitrum: { owners: ['0xaf23dc5983230e9eeaf93280e312e57539d098d0'], tokens: [ - ADDRESSES.arbitrum.WETH, // WETH - ADDRESSES.arbitrum.USDC, // USDC + ADDRESSES.arbitrum.WETH, + ADDRESSES.arbitrum.USDC, ], ownTokens: ['0xbc2597d3f1f9565100582cde02e3712d03b8b0f6'], } diff --git a/projects/treasury/beanstalk.js b/projects/treasury/beanstalk.js index 5df3969b825..6aeae1108bb 100644 --- a/projects/treasury/beanstalk.js +++ b/projects/treasury/beanstalk.js @@ -1,13 +1,15 @@ const ADDRESSES = require('../helper/coreAssets.json') const { treasuryExports, nullAddress } = require("../helper/treasury"); + const bean = "0xBEA0000029AD1c77D3d5D23Ba2D8893dB9d1Efab"; const sprout = "0xb7ab3f0667eFF5e2299d39C23Aa0C956e8982235"; const farms = "0x21DE18B6A8f78eDe6D16C50A167f6B222DC08DF7"; const tokens = [ nullAddress, - "0x5aFE3855358E112B5647B952709E6165e1c1eEEe", // SAFE - ADDRESSES.ethereum.USDC, // USDC + ADDRESSES.ethereum.SAFE, + ADDRESSES.ethereum.USDC, ]; + module.exports = treasuryExports({ ethereum: { tokens, diff --git a/projects/treasury/frax.js b/projects/treasury/frax.js index 6afee13fc05..744f04050e0 100644 --- a/projects/treasury/frax.js +++ b/projects/treasury/frax.js @@ -1,16 +1,16 @@ +const ADDRESSES = require('../helper/coreAssets.json'); const { nullAddress, treasuryExports } = require("../helper/treasury"); const treasury = "0x9AA7Db8E488eE3ffCC9CdFD4f2EaECC8ABeDCB48"; const fpis = "0xc2544A32872A91F4A553b404C6950e89De901fdb"; const fxs = "0x3432B6A60D23Ca0dFCa7761B7ab56459D9C964D0"; -const frax = "0x853d955aCEf822Db058eb8505911ED77F175b99e"; const treasuryarb = "0xe61d9ed1e5dc261d1e90a99304fadcef2c76fd10" module.exports = treasuryExports({ ethereum: { tokens: [ nullAddress, - "0x5aFE3855358E112B5647B952709E6165e1c1eEEe", // SAFE + ADDRESSES.ethereum.SAFE, ], owners: [ treasury, @@ -20,7 +20,7 @@ module.exports = treasuryExports({ '0x9AA7Db8E488eE3ffCC9CdFD4f2EaECC8ABeDCB48', '0x874a873e4891fB760EdFDae0D26cA2c00922C404', ], - ownTokens: [fpis, fxs, frax], + ownTokens: [fpis, fxs, ADDRESSES.ethereum.FRAX], }, arbitrum: { tokens: [ diff --git a/projects/treasury/guru-network.js b/projects/treasury/guru-network.js index 3e6922e6437..f03fa933d57 100644 --- a/projects/treasury/guru-network.js +++ b/projects/treasury/guru-network.js @@ -8,10 +8,10 @@ module.exports = treasuryExports({ ethereum: { tokens: [ nullAddress, - ADDRESSES.ethereum.USDC, //usdc + ADDRESSES.ethereum.USDC, '0x777172D858dC1599914a1C4c6c9fC48c99a60990',//solid - ADDRESSES.ethereum.WETH,//weth - '0x853d955aCEf822Db058eb8505911ED77F175b99e',//frax + ADDRESSES.ethereum.WETH, + ADDRESSES.ethereum.FRAX, ], owners: [treasury], ownTokens: [], diff --git a/projects/treasury/illuvium.js b/projects/treasury/illuvium.js index c50e18e68cb..78ca8eea09c 100644 --- a/projects/treasury/illuvium.js +++ b/projects/treasury/illuvium.js @@ -9,7 +9,14 @@ module.exports = treasuryExports({ owners: [Treasury], }, ethereum: { - tokens: [nullAddress, ADDRESSES.ethereum.USDC, ADDRESSES.ethereum.USDT, ADDRESSES.ethereum.USDC, ADDRESSES.ethereum.SUSHI, '0x5afe3855358e112b5647b952709e6165e1c1eeee' ], + tokens: [ + nullAddress, + ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.USDT, + ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.SUSHI, + ADDRESSES.ethereum.SAFE, + ], owners: [Treasury], ownTokens: ['0x767fe9edc9e0df98e07454847909b5e959d7ca0e'], } diff --git a/projects/treasury/index-coop.js b/projects/treasury/index-coop.js index 509a9612606..30c718a5fb6 100644 --- a/projects/treasury/index-coop.js +++ b/projects/treasury/index-coop.js @@ -1,6 +1,5 @@ const ADDRESSES = require('../helper/coreAssets.json') -const { Indexed } = require("ethers/lib/utils"); -const { nullAddress,treasuryExports } = require("../helper/treasury"); +const { nullAddress, treasuryExports } = require("../helper/treasury"); const treasury = "0x9467cfADC9DE245010dF95Ec6a585A506A8ad5FC"; const treasury2 = "0x462a63d4405a6462b157341a78fd1babfd3f8065" @@ -13,7 +12,7 @@ module.exports = treasuryExports({ ethereum: { tokens: [ nullAddress, - '0x5aFE3855358E112B5647B952709E6165e1c1eEEe',//SAFE + ADDRESSES.ethereum.SAFE, ADDRESSES.ethereum.USDC, ADDRESSES.ethereum.DAI, '0x7C07F7aBe10CE8e33DC6C5aD68FE033085256A84', diff --git a/projects/treasury/inverse.js b/projects/treasury/inverse.js index 5f378f36c53..7c00b230190 100644 --- a/projects/treasury/inverse.js +++ b/projects/treasury/inverse.js @@ -26,7 +26,7 @@ module.exports = treasuryExports({ ADDRESSES.ethereum.CRV, ADDRESSES.ethereum.CVX, "0x4C2e59D098DF7b6cBaE0848d66DE2f8A4889b9C3", // FODL - "0x5aFE3855358E112B5647B952709E6165e1c1eEEe", // SAFE + ADDRESSES.ethereum.SAFE, "0x22915f309EC0182c85cD8331C23bD187fd761360", // DOLA USDC Stable Pool Aura Deposit Vault "0x7f50786A0b15723D741727882ee99a0BF34e3466", // Stake DAO sdCRV Gauge "0x445494F823f3483ee62d854eBc9f58d5B9972A25", // 50DOLA-50DBR diff --git a/projects/treasury/iq.js b/projects/treasury/iq.js index 227813ec674..d7e909d3eed 100644 --- a/projects/treasury/iq.js +++ b/projects/treasury/iq.js @@ -1,4 +1,4 @@ -const ADDRESSES = require('../helper/coreAssets.json') +const ADDRESSES = require('../helper/coreAssets.json'); const { nullAddress, treasuryExports } = require("../helper/treasury"); const treasury = "0x56398b89d53e8731bca8c1b06886cfb14bd6b654"; @@ -6,10 +6,10 @@ const IQ = "0x579CEa1889991f68aCc35Ff5c3dd0621fF29b0C9" module.exports = treasuryExports({ ethereum: { - tokens: [ + tokens: [ nullAddress, - ADDRESSES.ethereum.SFRETH, - "0x853d955aCEf822Db058eb8505911ED77F175b99e", + ADDRESSES.ethereum.sfrxETH, + ADDRESSES.ethereum.FRAX, "0x9D45081706102E7aadDD0973268457527722E274", ADDRESSES.ethereum.WETH, ADDRESSES.ethereum.WBTC, @@ -18,6 +18,5 @@ module.exports = treasuryExports({ ], owners: [treasury], ownTokens: [IQ], - }, -}) \ No newline at end of file +}) diff --git a/projects/treasury/jade-protocol.js b/projects/treasury/jade-protocol.js index 02568fe90e2..ca55cdf63ca 100644 --- a/projects/treasury/jade-protocol.js +++ b/projects/treasury/jade-protocol.js @@ -16,9 +16,9 @@ module.exports = treasuryExports({ ethereum: { tokens: [ nullAddress, - ADDRESSES.ethereum.USDC,//USDC - ADDRESSES.ethereum.WBTC, // wbtc - ADDRESSES.ethereum.SFRETH, // sfrxETH + ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.WBTC, + ADDRESSES.ethereum.sfrxETH, '0x3432B6A60D23Ca0dFCa7761B7ab56459D9C964D0', // FXS ], owners: [treasury, treasury1], @@ -26,30 +26,30 @@ module.exports = treasuryExports({ bsc: { tokens: [ nullAddress, - ADDRESSES.bsc.BUSD,//busd + ADDRESSES.bsc.BUSD, ], owners: [treasuryBSC], }, avax: { tokens: [ nullAddress, - ADDRESSES.avax.USDC,//usdc + ADDRESSES.avax.USDC, ], owners: [treasuryAVAX] }, optimism: { tokens: [ nullAddress, - ADDRESSES.optimism.USDC, //usdc + ADDRESSES.optimism.USDC, ], owners: [treasuryOP] }, arbitrum: { tokens: [ nullAddress, - ADDRESSES.arbitrum.USDC, //usdc + ADDRESSES.arbitrum.USDC, '0x0C4681e6C0235179ec3D4F4fc4DF3d14FDD96017', //rdnt - ADDRESSES.arbitrum.GMX,//gmx + ADDRESSES.arbitrum.GMX, ], owners: [treasuryARB, treasuryARB2] } diff --git a/projects/treasury/jpegd.js b/projects/treasury/jpegd.js index a705859070c..a00f0ea7740 100644 --- a/projects/treasury/jpegd.js +++ b/projects/treasury/jpegd.js @@ -21,10 +21,10 @@ const treasuryTvl = treasuryExports({ ADDRESSES.ethereum.DAI, ADDRESSES.ethereum.TUSD, ADDRESSES.ethereum.CVX, - "0x853d955aCEf822Db058eb8505911ED77F175b99e", // FRAX + ADDRESSES.ethereum.FRAX, ADDRESSES.ethereum.LINK, ADDRESSES.ethereum.cvxCRV, - "0x5aFE3855358E112B5647B952709E6165e1c1eEEe", // SAFE + ADDRESSES.ethereum.SAFE, "0xC47EBd6c0f68fD5963005D28D0ba533750E5C11B", "0x34eD182D0812D119c92907852D2B429f095A9b07", "0x836A808d4828586A69364065A1e064609F5078c7", diff --git a/projects/treasury/looksrare.js b/projects/treasury/looksrare.js index 06d772b563c..4b906d6894d 100644 --- a/projects/treasury/looksrare.js +++ b/projects/treasury/looksrare.js @@ -11,8 +11,8 @@ const looks = "0xf4d2888d29D722226FafA5d9B24F9164c092421E"; const tokens = [ nullAddress, - ADDRESSES.ethereum.USDC, // USDC - "0x5aFE3855358E112B5647B952709E6165e1c1eEEe", // SAFE + ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.SAFE, ]; async function ownTokens(timestamp, block) { diff --git a/projects/treasury/nexus-mutual.js b/projects/treasury/nexus-mutual.js index 568a857a79f..dde13a0d431 100644 --- a/projects/treasury/nexus-mutual.js +++ b/projects/treasury/nexus-mutual.js @@ -10,10 +10,10 @@ module.exports = treasuryExports({ ethereum: { tokens: [ nullAddress, - ADDRESSES.ethereum.USDT, // USDT + ADDRESSES.ethereum.USDT, "0x2ba592F78dB6436527729929AAf6c908497cB200", // CREAM - ADDRESSES.ethereum.USDC, // USDC - "0x5aFE3855358E112B5647B952709E6165e1c1eEEe", // SAFE + ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.SAFE, ], ownTokens: [nxm, wNxm], owners: [communityFund, treasury], diff --git a/projects/treasury/push.js b/projects/treasury/push.js index 505349cb51c..25aa7ebb909 100644 --- a/projects/treasury/push.js +++ b/projects/treasury/push.js @@ -15,7 +15,7 @@ module.exports = treasuryExports({ "0xAf31Fd9C3B0350424BF96e551d2D1264d8466205", ADDRESSES.ethereum.DAI, ADDRESSES.ethereum.WBTC, - "0x5aFE3855358E112B5647B952709E6165e1c1eEEe" + ADDRESSES.ethereum.SAFE, ], }, }); \ No newline at end of file diff --git a/projects/treasury/railgun.js b/projects/treasury/railgun.js index e3bb995e496..f303f476c7f 100644 --- a/projects/treasury/railgun.js +++ b/projects/treasury/railgun.js @@ -29,7 +29,7 @@ module.exports = treasuryExports({ ADDRESSES.ethereum.cvxCRV, "0x3432B6A60D23Ca0dFCa7761B7ab56459D9C964D0",//wbtc "0x99D8a9C45b2ecA8864373A26D1459e3Dff1e17F3",//mim - ADDRESSES.ethereum.LUSD,//lusd + ADDRESSES.ethereum.LUSD, "0x090185f2135308BaD17527004364eBcC2D37e5F6",//spell ADDRESSES.ethereum.BUSD, "0x00a8b738E453fFd858a7edf03bcCfe20412f0Eb0",//albt @@ -42,7 +42,7 @@ module.exports = treasuryExports({ "0x767FE9EDC9E0dF98E07454847909b5E959D7ca0E",//ilv ADDRESSES.ethereum.MKR, "0xc5fb36dd2fb59d3b98deff88425a3f425ee469ed",//tsuka - "0x853d955acef822db058eb8505911ed77f175b99e",//frax + ADDRESSES.ethereum.FRAX, "0x2223bF1D7c19EF7C06DAB88938EC7B85952cCd89",//kxa "0x0f2d719407fdbeff09d87557abb7232601fd9f29",//syn "0x7aE1D57b58fA6411F32948314BadD83583eE0e8C",//paper @@ -96,7 +96,7 @@ module.exports = treasuryExports({ "0x2C89bbc92BD86F8075d1DEcc58C7F4E0107f286b",//avax "0x53E0bca35eC356BD5ddDFebbD1Fc0fD03FaBad39",//link "0xfe712251173A2cd5F5bE2B46Bb528328EA3565E1",//mvi - ADDRESSES.polygon.WMATIC_2,//wmatic + ADDRESSES.polygon.WMATIC_2, "0x752d59604d72b6DC44196f4A39A3f07779417407",//methmoon "0x8f006D1e1D9dC6C98996F50a4c810F17a47fBF19",//nsfw ADDRESSES.fantom.renBTC, diff --git a/projects/treasury/redacted.js b/projects/treasury/redacted.js index 1e37dbb1583..0dcf99dcbd1 100644 --- a/projects/treasury/redacted.js +++ b/projects/treasury/redacted.js @@ -13,10 +13,10 @@ module.exports = treasuryExports({ ethereum: { tokens: [ nullAddress, - ADDRESSES.ethereum.USDT, // USDT + ADDRESSES.ethereum.USDT, "0x2ba592F78dB6436527729929AAf6c908497cB200", // CREAM - ADDRESSES.ethereum.USDC, // USDC - "0x5aFE3855358E112B5647B952709E6165e1c1eEEe", // SAFE + ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.SAFE, "0xaa0C3f5F7DFD688C6E646F66CD2a6B66ACdbE434", ADDRESSES.ethereum.DAI, "0xaCe78D9BaB82b6B4783120Dba82aa10B040A14D9", @@ -29,9 +29,9 @@ module.exports = treasuryExports({ optimism: { tokens: [ nullAddress, - ADDRESSES.optimism.OP, // USDT + ADDRESSES.optimism.OP, "0xaf9fe3b5ccdae78188b1f8b9a49da7ae9510f151", // DHT - ADDRESSES.optimism.USDC, // USDC + ADDRESSES.optimism.USDC, "0x3f56e0c36d275367b8c502090edf38289b3dea0d", // QI "0x97513e975a7fa9072c72c92d8000b0db90b163c5", //BEETS "0x39fde572a18448f8139b7788099f0a0740f51205", //OATH @@ -44,7 +44,7 @@ module.exports = treasuryExports({ tokens: [ nullAddress, ADDRESSES.arbitrum.WETH, - ADDRESSES.arbitrum.USDC, // USDC + ADDRESSES.arbitrum.USDC, "0x10393c20975cf177a3513071bc110f7962cd67da", // JONES ], owners: [treasury6ARB], diff --git a/projects/treasury/ribbon.js b/projects/treasury/ribbon.js index c9a23759be9..899bc9c364f 100644 --- a/projects/treasury/ribbon.js +++ b/projects/treasury/ribbon.js @@ -12,18 +12,18 @@ module.exports = treasuryExports({ tokens: [ // Ethereum Assets nullAddress, - ADDRESSES.ethereum.WSTETH, // wstETH - ADDRESSES.ethereum.LIDO, // LDO - ADDRESSES.ethereum.WETH, // WETH - ADDRESSES.ethereum.WBTC, // WBTC - ADDRESSES.ethereum.USDC, // USDC - ADDRESSES.ethereum.RETH, // rETH - ADDRESSES.ethereum.STETH, // stETH + ADDRESSES.ethereum.WSTETH, + ADDRESSES.ethereum.LIDO, + ADDRESSES.ethereum.WETH, + ADDRESSES.ethereum.WBTC, + ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.RETH, + ADDRESSES.ethereum.STETH, "0xba100000625a3754423978a60c9317c58a424e3D", // BAL "0x4d224452801ACEd8B2F0aebE155379bb5D594381", // APE "0x090185f2135308BaD17527004364eBcC2D37e5F6", // SPELL - ADDRESSES.ethereum.UNI, // UNI - "0x5aFE3855358E112B5647B952709E6165e1c1eEEe", // SAFE + ADDRESSES.ethereum.UNI, + ADDRESSES.ethereum.SAFE, "0xa354F35829Ae975e850e23e9615b11Da1B3dC4DE", // yvUSDC "0x25751853Eab4D0eB3652B5eB6ecB102A2789644B", // rETH-THETA ], diff --git a/projects/treasury/stakedao.js b/projects/treasury/stakedao.js index c7b262bb6c1..2245cf21579 100644 --- a/projects/treasury/stakedao.js +++ b/projects/treasury/stakedao.js @@ -8,25 +8,25 @@ const arbitrumTreasury = "0xfdb1157ac847d334b8912df1cd24a93ee22ff3d0" const ethTokens = [ nullAddress, - ADDRESSES.ethereum.USDC, // USDC + ADDRESSES.ethereum.USDC, "0x31429d1856aD1377A8A0079410B297e1a9e214c2", // ANGLE - ADDRESSES.ethereum.CRV, // CRV + ADDRESSES.ethereum.CRV, "0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490", // 3CRV "0xc2544A32872A91F4A553b404C6950e89De901fdb", // FPIS "0xba100000625a3754423978a60c9317c58a424e3D", // BAL "0xdBdb4d16EdA451D0503b854CF79D55697F90c8DF", // ALCX - ADDRESSES.ethereum.WETH, // WETH + ADDRESSES.ethereum.WETH, "0x65Ef703f5594D2573eb71Aaf55BC0CB548492df4", // MULTI "0x1a7e4e63778B4f12a199C062f3eFdD288afCBce8", // agEUR "0xcAfE001067cDEF266AfB7Eb5A286dCFD277f3dE5", // PSP "0x4104b135DBC9609Fc1A9490E61369036497660c8", // APW - ADDRESSES.ethereum.LINK, // LINK + ADDRESSES.ethereum.LINK, "0x579CEa1889991f68aCc35Ff5c3dd0621fF29b0C9", // IQ - ADDRESSES.ethereum.AAVE, // AAVE + ADDRESSES.ethereum.AAVE, "0x1b40183EFB4Dd766f11bDa7A7c3AD8982e998421", // VSP "0x6f80310CA7F2C654691D1383149Fa1A57d8AB1f8", // SILO "0xd632f22692FaC7611d2AA1C0D552930D43CAEd3B", // FRAX3CRV-f - "0x5aFE3855358E112B5647B952709E6165e1c1eEEe", // SAFE + ADDRESSES.ethereum.SAFE, "0x318C3a9373419aA57c7C8aa53Eef92814e975F51", // 90D-StakeDAO-sdFRAX3CRV-f-0 "0x43E54C2E7b3e294De3A155785F52AB49d87B9922", // asdCRV "0xA13a9247ea42D743238089903570127DdA72fE44", // bb-a-USD diff --git a/projects/treasury/stargate.js b/projects/treasury/stargate.js index e73deed1268..b9ddbaa5bf5 100644 --- a/projects/treasury/stargate.js +++ b/projects/treasury/stargate.js @@ -18,7 +18,7 @@ module.exports = treasuryExports({ "0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490", // 3CRV DAI/USDC/USDT "0x73968b9a57c6E53d41345FD57a6E6ae27d6CDB2F", // SDT ADDRESSES.ethereum.cvxCRV, - "0x5aFE3855358E112B5647B952709E6165e1c1eEEe", // SAFE + ADDRESSES.ethereum.SAFE, "0xFCc5c47bE19d06BF83eB04298b026F81069ff65b", // yCRV "0x616e8BfA43F920657B3497DBf40D6b1A02D4608d", // auraBAl "0xA13a9247ea42D743238089903570127DdA72fE44", // bb-a-USD diff --git a/projects/treasury/sudoswap.js b/projects/treasury/sudoswap.js index f5ff7594ecd..902d6e480c7 100644 --- a/projects/treasury/sudoswap.js +++ b/projects/treasury/sudoswap.js @@ -16,7 +16,7 @@ module.exports = treasuryExports({ ADDRESSES.ethereum.DAI, ADDRESSES.ethereum.USDC, ADDRESSES.ethereum.USDT, - "0x853d955aCEf822Db058eb8505911ED77F175b99e", //frax + ADDRESSES.ethereum.FRAX, "0xb23d80f5FefcDDaa212212F028021B41DEd428CF", //PRIME ], }, diff --git a/projects/treasury/synapse.js b/projects/treasury/synapse.js index e0be92c3991..1404982bf37 100644 --- a/projects/treasury/synapse.js +++ b/projects/treasury/synapse.js @@ -33,11 +33,11 @@ module.exports = treasuryExports({ tokens: [ nullAddress, //"0x080F6AEd32Fc474DD5717105Dba5ea57268F46eb",//syn - ADDRESSES.arbitrum.WETH,//weth - ADDRESSES.optimism.DAI,//dai - ADDRESSES.arbitrum.nUSD,//nusd - ADDRESSES.arbitrum.USDT,//tether - ADDRESSES.arbitrum.USDC,//usdc + ADDRESSES.arbitrum.WETH, + ADDRESSES.optimism.DAI, + ADDRESSES.arbitrum.nUSD, + ADDRESSES.arbitrum.USDT, + ADDRESSES.arbitrum.USDC, ], owners: [arbtreasury, arbtreasury2], ownTokens: [arbSYN] @@ -46,10 +46,10 @@ module.exports = treasuryExports({ tokens: [ nullAddress, //"0x1f1E7c893855525b303f99bDF5c3c05Be09ca251",//syn - ADDRESSES.avax.WAVAX,//wavax - ADDRESSES.avax.DAI,//dai - ADDRESSES.avax.USDC_e,//usdc - ADDRESSES.avax.USDT_e,//tether + ADDRESSES.avax.WAVAX, + ADDRESSES.avax.DAI, + ADDRESSES.avax.USDC_e, + ADDRESSES.avax.USDT_e, ], owners: [avaxTreasury], @@ -58,13 +58,13 @@ module.exports = treasuryExports({ bsc: { tokens: [ nullAddress, - ADDRESSES.bsc.USDC,//usdc - ADDRESSES.bsc.BUSD,//busd - ADDRESSES.fantom.fUSDT,//fusdt - ADDRESSES.bsc.BTCB,//btcb + ADDRESSES.bsc.USDC, + ADDRESSES.bsc.BUSD, + ADDRESSES.fantom.fUSDT, + ADDRESSES.bsc.BTCB, "0x54261774905f3e6E9718f2ABb10ed6555cae308a",//anybtc "0x42F6f551ae042cBe50C739158b4f0CAC0Edb9096",//nrv - ADDRESSES.bsc.USDT,//bsc-usd + ADDRESSES.bsc.USDT, "0x23396cF899Ca06c4472205fC903bDB4de249D6fC",//ustc ], owners: [bscTreasury] @@ -74,8 +74,8 @@ module.exports = treasuryExports({ nullAddress, //"0xE55e19Fb4F2D85af758950957714292DAC1e25B2",//syn "0x74b23882a30290451A17c44f4F05243b6b58C76d",//eth - ADDRESSES.fantom.USDC,//usdc - ADDRESSES.fantom.WFTM,//wftm + ADDRESSES.fantom.USDC, + ADDRESSES.fantom.WFTM, ], owners: [FantomTreasury], ownTokens: [fantomSYN] @@ -90,22 +90,22 @@ module.exports = treasuryExports({ tokens: [ nullAddress, //"0x0f2D719407FdBeFF09D87557AbB7232601FD9F29",//syn - ADDRESSES.ethereum.USDC,//usdc + ADDRESSES.ethereum.USDC, "0x0ab87046fBb341D058F17CBC4c1133F25a20a52f",//gohm - "0x853d955aCEf822Db058eb8505911ED77F175b99e",//frax - ADDRESSES.ethereum.WETH,//weth - ADDRESSES.ethereum.DAI,//dai - ADDRESSES.ethereum.USDT,//tether + ADDRESSES.ethereum.FRAX, + ADDRESSES.ethereum.WETH, + ADDRESSES.ethereum.DAI, + ADDRESSES.ethereum.USDT, "0x98585dFc8d9e7D48F0b1aE47ce33332CF4237D96",//newo "0x71Ab77b7dbB4fa7e017BC15090b2163221420282",//high - ADDRESSES.ethereum.WBTC,//wbtc + ADDRESSES.ethereum.WBTC, "0x73968b9a57c6E53d41345FD57a6E6ae27d6CDB2F",//sdt "0xBAac2B4491727D78D2b78815144570b9f2Fe8899",//dog "0x02B5453D92B730F29a86A0D5ef6e930c4Cf8860B",//usdb "0x1a7e4e63778B4f12a199C062f3eFdD288afCBce8",//ageur "0x0642026E7f0B6cCaC5925b4E7Fa61384250e1701",//h2o "0xb753428af26E81097e7fD17f40c88aaA3E04902c",//sfi - ADDRESSES.ethereum.LINK,//link + ADDRESSES.ethereum.LINK, ], owners: [MainnetTreasury], ownTokens: [mainnetSYN, mainnetsynethLP] @@ -113,9 +113,9 @@ module.exports = treasuryExports({ metis: { tokens: [ nullAddress, - //ADDRESSES.metis.SYN,//syn + //ADDRESSES.metis.SYN, "0xFB21B70922B9f6e3C6274BcD6CB1aa8A0fe20B80",//gohm - ADDRESSES.metis.m_USDC,//usdc + ADDRESSES.metis.m_USDC, ], owners: [MetisTreasury], ownTokens: [metisSYN] @@ -123,7 +123,7 @@ module.exports = treasuryExports({ optimism: { tokens: [ nullAddress, - ADDRESSES.optimism.OP,//op + ADDRESSES.optimism.OP, "0x809DC529f07651bD43A172e8dB6f4a7a0d771036",//neth ], owners: [OptimismTreasury] @@ -131,10 +131,10 @@ module.exports = treasuryExports({ polygon: { tokens: [ nullAddress, - ADDRESSES.polygon.USDC,//usdc - ADDRESSES.polygon.USDT,//usdt - ADDRESSES.polygon.WMATIC_2,//wmatic - ADDRESSES.polygon.DAI,//dai + ADDRESSES.polygon.USDC, + ADDRESSES.polygon.USDT, + ADDRESSES.polygon.WMATIC_2, + ADDRESSES.polygon.DAI, "0xd8cA34fd379d9ca3C6Ee3b3905678320F5b45195",//gohm //"0xf8F9efC0db77d8881500bb06FF5D6ABc3070E695",//syn ], diff --git a/projects/treasury/tokemak.js b/projects/treasury/tokemak.js index 267a2482814..d5a0b47f5d6 100644 --- a/projects/treasury/tokemak.js +++ b/projects/treasury/tokemak.js @@ -5,20 +5,20 @@ const treasury = "0x8b4334d4812C530574Bd4F2763FcD22dE94A969B"; const tokens = [ nullAddress, - ADDRESSES.ethereum.USDC, // USDC - ADDRESSES.ethereum.STETH, // stETH + ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.STETH, "0x9C4A4204B79dd291D6b6571C5BE8BbcD0622F050", // TCR "0x4104b135DBC9609Fc1A9490E61369036497660c8", // APW "0x73968b9a57c6E53d41345FD57a6E6ae27d6CDB2F", // SDT "0xE1573B9D29e2183B1AF0e743Dc2754979A40D237", // Uniswap FXS/FRAX LP - ADDRESSES.ethereum.LIDO, // LDO - "0x5aFE3855358E112B5647B952709E6165e1c1eEEe", // SAFE + ADDRESSES.ethereum.LIDO, + ADDRESSES.ethereum.SAFE, "0xaa0C3f5F7DFD688C6E646F66CD2a6B66ACdbE434", // stkCvxCrv "0x04906695D6D12CF5459975d7C3C03356E4Ccd460", // sOHM ]; const ownTokens = [ - ADDRESSES.ethereum.TOKE, // TOKE + ADDRESSES.ethereum.TOKE, ]; module.exports = treasuryExports({ From 18688589f368174cf669e9d644b2df4438afc790 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Mon, 10 Jul 2023 05:17:20 +0100 Subject: [PATCH 0279/1974] add tranchess eth --- projects/tranchessETH/index.js | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 projects/tranchessETH/index.js diff --git a/projects/tranchessETH/index.js b/projects/tranchessETH/index.js new file mode 100644 index 00000000000..7d5a7e11d77 --- /dev/null +++ b/projects/tranchessETH/index.js @@ -0,0 +1,10 @@ +const sdk = require("@defillama/sdk") +const token = '0x93ef1Ea305D11A9b2a3EbB9bB4FCc34695292E7d' + +module.exports = { + ethereum: { + tvl: async (_, block) => ({ + [token]: (await sdk.api.erc20.totalSupply({ target: token, block})).output + }) + } +} \ No newline at end of file From 701ef6aa1ddb96ed066ce5c39e6e4358f9cfd840 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Mon, 10 Jul 2023 05:29:10 +0100 Subject: [PATCH 0280/1974] delete duplicated project --- projects/tranchessETH/index.js | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100644 projects/tranchessETH/index.js diff --git a/projects/tranchessETH/index.js b/projects/tranchessETH/index.js deleted file mode 100644 index 7d5a7e11d77..00000000000 --- a/projects/tranchessETH/index.js +++ /dev/null @@ -1,10 +0,0 @@ -const sdk = require("@defillama/sdk") -const token = '0x93ef1Ea305D11A9b2a3EbB9bB4FCc34695292E7d' - -module.exports = { - ethereum: { - tvl: async (_, block) => ({ - [token]: (await sdk.api.erc20.totalSupply({ target: token, block})).output - }) - } -} \ No newline at end of file From e5fdfb3987f95f939533d0238b269828b74b5089 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 10 Jul 2023 08:15:00 +0200 Subject: [PATCH 0281/1974] track level finance treasury --- projects/helper/coreAssets.json | 1 + projects/treasury/level.js | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 projects/treasury/level.js diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index d8f2cb7de23..167ba283a46 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -231,6 +231,7 @@ "LINK": "0xf97f4df75117a78c1a5a0dbb814af92458539fb4", "USDT": "0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9", "ARBY": "0x09ad12552ec45f82be90b38dfe7b06332a680864", + "ARB": "0x912ce59144191c1204e64559fe8253a0e49e6548", "MIM": "0xfea7a6a0b346362bf88a9e4a88416b77a57d6c2a", "renBTC": "0xdbf31df14b66535af65aac99c32e9ea844e14501", "DFL": "0x31635a2a3892daec7c399102676e344f55d20da7", diff --git a/projects/treasury/level.js b/projects/treasury/level.js new file mode 100644 index 00000000000..f08b75afe6e --- /dev/null +++ b/projects/treasury/level.js @@ -0,0 +1,24 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { treasuryExports } = require("../helper/treasury"); + +module.exports = treasuryExports({ + bsc: { + tokens: [ + "0xb5c42f84ab3f786bca9761240546aa9cec1f8821", + ], + owners: ['0x8BFf27E9Fa1C28934554e6B5239Fb52776573619'], + }, + arbitrum: { + tokens: [ + ADDRESSES.arbitrum.WETH, + ADDRESSES.arbitrum.WBTC, + ADDRESSES.arbitrum.USDT, + ADDRESSES.arbitrum.USDC, + ADDRESSES.arbitrum.ARB, + "0x502697AF336F7413Bb4706262e7C506Edab4f3B9", + "0xb076f79f8D1477165E2ff8fa99930381FB7d94c1", + "0x5573405636F4b895E511C9C54aAfbefa0E7Ee458", + ], + owners: ['0x635aac65f37a6bbe06a2dde77b0fd2f1748674d4'], + }, +}) \ No newline at end of file From f24185bdb49db4d9602304ba13f28cf57d2a8ec3 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 10 Jul 2023 10:14:06 +0200 Subject: [PATCH 0282/1974] fix solanax --- projects/solanax.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/solanax.js b/projects/solanax.js index 7deb202e357..59b5fa2a044 100644 --- a/projects/solanax.js +++ b/projects/solanax.js @@ -15,7 +15,7 @@ module.exports = { misrepresentedTokens: true, methodology: `TVL is fetched by making calls to the Solanax API (https://solanax.org/api/data/)`, solana: { - tvl: fetch, + tvl: () => ({}), } }; \ No newline at end of file From 1f4422469e7c48e05270afad63e31f092500bb4a Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 10 Jul 2023 10:23:28 +0200 Subject: [PATCH 0283/1974] add hallmark --- projects/arcadia-finance/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/projects/arcadia-finance/index.js b/projects/arcadia-finance/index.js index ffb07c2bfd0..a9d10c7b41f 100644 --- a/projects/arcadia-finance/index.js +++ b/projects/arcadia-finance/index.js @@ -5,5 +5,8 @@ module.exports = { "TVL includes ERC-20 tokens that have been supplied as collateral as well as ERC-20 tokens that are supplied by liquidity providers.", optimism: { tvl }, ethereum: { tvl }, - start: 1686391200 // Jun 10 2023 10:00:00 GMT+0000 + start: 1686391200, // Jun 10 2023 10:00:00 GMT+0000 + hallmarks: [ + [Math.floor(new Date('2023-07-10')/1e3), 'Protocol was exploited.'], + ], } \ No newline at end of file From d7d6855599ae27882654ddd0cb49a836e6214f92 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 10 Jul 2023 20:55:39 +0200 Subject: [PATCH 0284/1974] track https://sigmafi.app --- projects/ergodex.js | 18 ++++---------- projects/ergodex/index.js | 12 ---------- projects/ergopad/index.js | 26 +------------------- projects/helper/chain/ergo.js | 45 +++++++++++++++++++++++++++++++++++ projects/sigmafi/index.js | 22 +++++++++++++++++ projects/sigmausd/index.js | 23 +++++++----------- 6 files changed, 81 insertions(+), 65 deletions(-) delete mode 100644 projects/ergodex/index.js create mode 100644 projects/helper/chain/ergo.js create mode 100644 projects/sigmafi/index.js diff --git a/projects/ergodex.js b/projects/ergodex.js index f15973256d0..4cbf22d73a1 100644 --- a/projects/ergodex.js +++ b/projects/ergodex.js @@ -1,16 +1,8 @@ -const utils = require('./helper/utils'); -const {toUSDTBalances} = require('./helper/balances') - -async function tvl() { - var totalTvl = await utils.fetchURL('https://api.spectrum.fi/v1/amm/platform/stats'); - return toUSDTBalances(totalTvl.data.tvl.value); -} +const { sumTokensExport } = require('./helper/chain/ergo') module.exports = { - misrepresentedTokens: true, - timetravel: false, - ergo:{ - tvl - }, - methodology: `Spectrum Finance TVL is achieved by making a call to its API: https://api.spectrum.fi/v1/amm/platform/stats.` + timetravel: false, + ergo: { + tvl: sumTokensExport({ owner: '5vSUZRZbdVbnk4sJWjg2uhL94VZWRg4iatK9VgMChufzUgdihgvhR8yWSUEJKszzV7Vmi6K8hCyKTNhUaiP8p5ko6YEU9yfHpjVuXdQ4i5p4cRCzch6ZiqWrNukYjv7Vs5jvBwqg5hcEJ8u1eerr537YLWUoxxi1M4vQxuaCihzPKMt8NDXP4WcbN6mfNxxLZeGBvsHVvVmina5THaECosCWozKJFBnscjhpr3AJsdaL8evXAvPfEjGhVMoTKXAb2ZGGRmR8g1eZshaHmgTg2imSiaoXU5eiF3HvBnDuawaCtt674ikZ3oZdekqswcVPGMwqqUKVsGY4QuFeQoGwRkMqEYTdV2UDMMsfrjrBYQYKUBFMwsQGMNBL1VoY78aotXzdeqJCBVKbQdD3ZZWvukhSe4xrz8tcF3PoxpysDLt89boMqZJtGEHTV9UBTBEac6sDyQP693qT3nKaErN8TCXrJBUmHPqKozAg9bwxTqMYkpmb9iVKLSoJxG7MjAj72SRbcqQfNCVTztSwN3cRxSrVtz4p87jNFbVtFzhPg7UqDwNFTaasySCqM', }) + }, } diff --git a/projects/ergodex/index.js b/projects/ergodex/index.js deleted file mode 100644 index 2e4c4247e1c..00000000000 --- a/projects/ergodex/index.js +++ /dev/null @@ -1,12 +0,0 @@ -const utils = require("../helper/utils"); - -const api_ergo = "https://api.ergodex.io/v1/amm/platform/stats?"; - -async function fetch() { - const data = (await utils.fetchURL(api_ergo)).data.tvl; - return data.value / 10 ** data.units.currency.decimals; -} - -module.exports = { - fetch, -}; diff --git a/projects/ergopad/index.js b/projects/ergopad/index.js index a4e4335d02c..66aaa261b2d 100644 --- a/projects/ergopad/index.js +++ b/projects/ergopad/index.js @@ -2,39 +2,15 @@ const utils = require('../helper/utils'); async function staking() { const { data: { 'Total amount staked': totalStaked } } = await utils.fetchURL('https://api.ergopad.io/staking/status/'); - const price = await getErgopadPrice() return { - ergo: totalStaked * price + 'ergo:d71693c49a84fbbecd4908c94813b46514b18b67a99952dc1e6e4791556de413': totalStaked * 1e2 } } -async function getErgopadPrice() { - const { data: { lockedX, lockedY, } } = await utils.fetchURL('https://api.spectrum.fi/v1/amm/pool/d7868533f26db1b1728c1f85c2326a3c0327b57ddab14e41a2b77a5d4c20f4b2/stats'); - let ergQuantity, padQunatity - - const ergId = '0000000000000000000000000000000000000000000000000000000000000000' - if (lockedX.id === ergId) { - ergQuantity = getQuantity(lockedX) - padQunatity = getQuantity(lockedY) - } else { - ergQuantity = getQuantity(lockedY) - padQunatity = getQuantity(lockedX) - } - - function getQuantity({ amount, decimals }) { - return amount / 10 ** decimals - } - - return ergQuantity / padQunatity - -} - module.exports = { - misrepresentedTokens: true, timetravel: false, ergo: { tvl: () => ({}), staking }, - methodology: `Ergopad TVL is achieved by making a call to its API: https://ergopad.io/api/blockchain/tvl/d71693c49a84fbbecd4908c94813b46514b18b67a99952dc1e6e4791556de413 and consists of both staked ergopad tokens.` } diff --git a/projects/helper/chain/ergo.js b/projects/helper/chain/ergo.js new file mode 100644 index 00000000000..1ca8efd45ec --- /dev/null +++ b/projects/helper/chain/ergo.js @@ -0,0 +1,45 @@ +const ADDRESSES = require('../coreAssets.json') +const axios = require("axios") +const sdk = require('@defillama/sdk') +const chain = 'ergo' + +const API_HOST = 'https://api.ergoplatform.com/api/v1' + +const nullAddress = ADDRESSES.null + +async function queryTree({ address, params = {}}) { + const { data } = await axios.get(`${API_HOST}/boxes/unspent/byErgoTree/${address}`, { + params, + }) + return data +} + +async function getTokens({ address, balances = {}, tokens = [], blacklistedTokens = [] }) { + const { data: { confirmed: { nanoErgs, tokens: tokenData}}} = await axios.get(`${API_HOST}/addresses/${address}/balance/total`) + tokenData.push({ tokenId: nullAddress, amount: nanoErgs ?? 0 }) + tokenData.forEach(({ tokenId, amount }) => { + if (tokens.length && !tokens.includes(tokenId)) return; // sum only whitelistedTokens + if (blacklistedTokens.includes(tokenId)) return; // skip blacklisted tokens + sdk.util.sumSingleBalance(balances, tokenId, amount, chain) + }) +} + +async function sumTokens({ owners = [], tokens = [], balances = {}, blacklistedTokens = [], tokensAndOwners = [], owner,}) { + if (owner) owners = [owner] + if (tokensAndOwners.length) { + await Promise.all(tokensAndOwners.map(([token, owner]) => sumTokens({ owners: [owner], tokens: [token], balances, blacklistedTokens, }))) + return balances + } + + await Promise.all(owners.map(i => getTokens({ address: i, balances, tokens, blacklistedTokens, }))) + return balances +} + +function sumTokensExport(args) { + return () => sumTokens(args) +} + +module.exports = { + sumTokens, + sumTokensExport, +} \ No newline at end of file diff --git a/projects/sigmafi/index.js b/projects/sigmafi/index.js new file mode 100644 index 00000000000..245d0dbd588 --- /dev/null +++ b/projects/sigmafi/index.js @@ -0,0 +1,22 @@ +const { nullAddress } = require('../helper/tokenMapping') +const { sumTokensExport } = require('../helper/chain/ergo') +const axios = require('axios') + +async function borrowed(_, _b, _cb, { api, }) { + const { data } = await axios.get('https://api.sigmaexplorer.org/sigmafi/loans/ongoing?limit=10000') + data.forEach(({ repayment: { tokenId, amount}}) => { + api.add(tokenId === 'erg' ? nullAddress : tokenId, amount) + }) + return api.getBalances() +} + +module.exports = { + timetravel: false, + ergo: { + tvl: sumTokensExport({ owners: [ + '47r8CNpYJhLaJy9vQAyyhVX7SLu73dg8EDmi9zzei7YWomvTAbNaZMAHdM38TsFoiZfAcKuyrgngD6ZS2uPQktLfFpvypxkRiRi9LswRYd5tk6B5HHDsFNMfLcdqeWT9RDR2SRq1zm2HF9F913aY1gc9gVyeh8PGED2ThKJ2NCG19XhyPqCbgTFY5uTC6RaqpGCdH9p58fD4DWDd46D3EfUXz3XLzqGQvDGXTghkh9UtZ1LB7nFFoPDFc2QVDt6BCtTQwq4Jh9vFfTfBG9q6ReVF5cVX7nA6vXhWjUuHKMd7Zw5anM2u95e', + '2f7L4F3Q9eCjdWRmxSENw18Bw5SPAf3vBaimRqgpWB5JayiqSWG2tvnc6kF8ae8mpYwtZasmVDzmgjbfa8EBTdA1u55yB8ypRZDDFhs6DmhQekuGvzBoViApMyKdAXCPriXMaJWgHxAdjtR7QhXSjdnyozxZ7ApXrQY6hDSX6H2Fg9siuGUQpTQ3oJDa8nScMGdLNK2T5A7oHs', + ] }), + borrowed, + }, +} diff --git a/projects/sigmausd/index.js b/projects/sigmausd/index.js index 6fe990661cd..81e46d3f511 100644 --- a/projects/sigmausd/index.js +++ b/projects/sigmausd/index.js @@ -1,17 +1,10 @@ -const utils = require('../helper/utils'); - -async function tvl() { - const {data: { confirmed }} = await utils.fetchURL('https://api.ergoplatform.com/api/v1/addresses/MUbV38YgqHy7XbsoXWF5z7EZm524Ybdwe5p9WDrbhruZRtehkRPT92imXer2eTkjwPDfboa1pR3zb3deVKVq3H7Xt98qcTqLuSBSbHb7izzo5jphEpcnqyKJ2xhmpNPVvmtbdJNdvdopPrHHDBbAGGeW7XYTQwEeoRfosXzcDtiGgw97b2aqjTsNFmZk7khBEQywjYfmoDc9nUCJMZ3vbSspnYo3LarLe55mh2Np8MNJqUN9APA6XkhZCrTTDRZb1B4krgFY1sVMswg2ceqguZRvC9pqt3tUUxmSnB24N6dowfVJKhLXwHPbrkHViBv1AKAJTmEaQW2DN1fRmD9ypXxZk8GXmYtxTtrj3BiunQ4qzUCu1eGzxSREjpkFSi2ATLSSDqUwxtRz639sHM6Lav4axoJNPCHbY8pvuBKUxgnGRex8LEGM8DeEJwaJCaoy8dBw9Lz49nq5mSsXLeoC4xpTUmp47Bh7GAZtwkaNreCu74m9rcZ8Di4w1cmdsiK1NWuDh9pJ2Bv7u3EfcurHFVqCkT3P86JUbKnXeNxCypfrWsFuYNKYqmjsix82g9vWcGMmAcu5nagxD4iET86iE2tMMfZZ5vqZNvntQswJyQqv2Wc6MTh4jQx1q2qJZCQe4QdEK63meTGbZNNKMctHQbp3gRkZYNrBtxQyVtNLR8xEY8zGp85GeQKbb37vqLXxRpGiigAdMe3XZA4hhYPmAAU5hpSMYaRAjtvvMT3bNiHRACGrfjvSsEG9G2zY5in2YWz5X9zXQLGTYRsQ4uNFkYoQRCBdjNxGv6R58Xq74zCgt19TxYZ87gPWxkXpWwTaHogG1eps8WXt8QzwJ9rVx6Vu9a5GjtcGsQxHovWmYixgBU8X9fPNJ9UQhYyAWbjtRSuVBtDAmoV1gCBEPwnYVP5GCGhCocbwoYhZkZjFZy6ws4uxVLid3FxuvhWvQrVEDYp7WRvGXbNdCbcSXnbeTrPMey1WPaXX/balance/total'); - - return { - ergo: confirmed.nanoErgs / 1e9 - }; -} +const { nullAddress } = require('../helper/tokenMapping') +const { sumTokensExport } = require('../helper/chain/ergo') module.exports = { - timetravel: false, - ergo:{ - tvl - }, - methodology: `SigmaUSD TVL is calculated by calling the sigmaUSD bank (via the ergo blockchain explorer API), this returns the confirmed total within the contract in nanoERGs` -} \ No newline at end of file + timetravel: false, + ergo: { + tvl: sumTokensExport({ owner: 'MUbV38YgqHy7XbsoXWF5z7EZm524Ybdwe5p9WDrbhruZRtehkRPT92imXer2eTkjwPDfboa1pR3zb3deVKVq3H7Xt98qcTqLuSBSbHb7izzo5jphEpcnqyKJ2xhmpNPVvmtbdJNdvdopPrHHDBbAGGeW7XYTQwEeoRfosXzcDtiGgw97b2aqjTsNFmZk7khBEQywjYfmoDc9nUCJMZ3vbSspnYo3LarLe55mh2Np8MNJqUN9APA6XkhZCrTTDRZb1B4krgFY1sVMswg2ceqguZRvC9pqt3tUUxmSnB24N6dowfVJKhLXwHPbrkHViBv1AKAJTmEaQW2DN1fRmD9ypXxZk8GXmYtxTtrj3BiunQ4qzUCu1eGzxSREjpkFSi2ATLSSDqUwxtRz639sHM6Lav4axoJNPCHbY8pvuBKUxgnGRex8LEGM8DeEJwaJCaoy8dBw9Lz49nq5mSsXLeoC4xpTUmp47Bh7GAZtwkaNreCu74m9rcZ8Di4w1cmdsiK1NWuDh9pJ2Bv7u3EfcurHFVqCkT3P86JUbKnXeNxCypfrWsFuYNKYqmjsix82g9vWcGMmAcu5nagxD4iET86iE2tMMfZZ5vqZNvntQswJyQqv2Wc6MTh4jQx1q2qJZCQe4QdEK63meTGbZNNKMctHQbp3gRkZYNrBtxQyVtNLR8xEY8zGp85GeQKbb37vqLXxRpGiigAdMe3XZA4hhYPmAAU5hpSMYaRAjtvvMT3bNiHRACGrfjvSsEG9G2zY5in2YWz5X9zXQLGTYRsQ4uNFkYoQRCBdjNxGv6R58Xq74zCgt19TxYZ87gPWxkXpWwTaHogG1eps8WXt8QzwJ9rVx6Vu9a5GjtcGsQxHovWmYixgBU8X9fPNJ9UQhYyAWbjtRSuVBtDAmoV1gCBEPwnYVP5GCGhCocbwoYhZkZjFZy6ws4uxVLid3FxuvhWvQrVEDYp7WRvGXbNdCbcSXnbeTrPMey1WPaXX', tokens: [nullAddress] }) + }, + methodology: `Spectrum Finance TVL is achieved by making a call to its API: https://api.spectrum.fi/v1/amm/platform/stats.` +} From 508c8d591e15ec479cb5883d54f59560dd0b82f5 Mon Sep 17 00:00:00 2001 From: tstemko <57684389+tstemko@users.noreply.github.com> Date: Mon, 10 Jul 2023 15:39:35 -0400 Subject: [PATCH 0285/1974] Add bsc vaults (#6766) * Addition of Arbitrum vaults and Polygon Retro vaults to TVL calculation * ichifarm: code refactor * Add BNB chain vaults --------- Co-authored-by: Tatyana Stemkovski Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/ichifarm/index.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/projects/ichifarm/index.js b/projects/ichifarm/index.js index 3245a3e22b9..9d491c42b5f 100644 --- a/projects/ichifarm/index.js +++ b/projects/ichifarm/index.js @@ -40,6 +40,11 @@ const config = { { factory: '0xfBf38920cCbCFF7268Ad714ae5F9Fad6dF607065', fromBlock: 102858581, }, ], }, + bsc: { + vaultConfigs: [ + { factory: '0xbBB97d634460DACCA0d41E249510Bb741ef46ad3', fromBlock: 29702590, }, + ], + }, polygon: { vaultConfigs: [ { factory: '0x2d2c72c4dc71aa32d64e5142e336741131a73fc0', fromBlock: 25697834, }, From 6b945af1b65daf0713e3bd4cb73b4bd5b132052a Mon Sep 17 00:00:00 2001 From: Rafael Albuquerque <70333411+albuquerque-rafael@users.noreply.github.com> Date: Mon, 10 Jul 2023 15:40:11 -0400 Subject: [PATCH 0286/1974] feat(pirex): add px btrfly vault (#6765) --- projects/pirex/index.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/projects/pirex/index.js b/projects/pirex/index.js index ce193c685db..47fa8fbbaeb 100644 --- a/projects/pirex/index.js +++ b/projects/pirex/index.js @@ -7,16 +7,25 @@ const pxGMX = "0x9a592b4539e22eeb8b2a3df679d572c7712ef999"; const pxGLP = "0x0eac365e4d7de0e293078bd771ba7d0ba9a4c892" const GMX = ADDRESSES.arbitrum.GMX; const GLP = "0x4277f8F2c384827B5273592FF7CeBd9f2C1ac258"; +const BTRFLY = "0xc55126051B22eBb829D00368f4B12Bde432de5Da"; +const pxBTRFLY = "0x10978Db3885bA79Bf1Bc823E108085FB88e6F02f"; async function ethereum(ts, block, _, { api }) { const balances = {}; + const chain = "ethereum"; + const { locked: lockedCVX } = await api.call({ abi: abi.balances, target: ADDRESSES.ethereum.vlCVX, params: [PirexCVX], }); + const { output: pxBTRFLYSupply } = await sdk.api.erc20.totalSupply({ + target: pxBTRFLY, + chain + }); sdk.util.sumSingleBalance(balances, ADDRESSES.ethereum.CVX, lockedCVX); + sdk.util.sumSingleBalance(balances, BTRFLY, pxBTRFLYSupply, chain); return balances; } From 80b6553b190090537d0974b9da49837d7c9f550a Mon Sep 17 00:00:00 2001 From: Dan Date: Mon, 10 Jul 2023 21:41:18 +0200 Subject: [PATCH 0287/1974] Rysk beyond (#6764) * added beyond liquidity pool * added beyond margin pool --- projects/rysk/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/projects/rysk/index.js b/projects/rysk/index.js index 2f65c945ebb..f76bef041b3 100644 --- a/projects/rysk/index.js +++ b/projects/rysk/index.js @@ -14,8 +14,10 @@ async function tvl(_, _b, _cb, { api, }) { return sumTokens2({ api, balances, tokensAndOwners: [ - [ADDRESSES.arbitrum.USDC, '0xc10b976c671ce9bff0723611f01422acbae100a5'], // LP + [ADDRESSES.arbitrum.USDC, '0xc10b976c671ce9bff0723611f01422acbae100a5'], // LP alpha + ["0xaf88d065e77c8cC2239327C5EDb3A432268e5831", '0x217749d9017cB87712654422a1F5856AAA147b80'], // LP beyond USDC native [ADDRESSES.arbitrum.USDC, '0xb9F33349db1d0711d95c1198AcbA9511B8269626'], // marginPool + ["0xaf88d065e77c8cC2239327C5EDb3A432268e5831", '0xb9F33349db1d0711d95c1198AcbA9511B8269626'], // marginPool USDC native [ADDRESSES.arbitrum.WETH, '0xb9F33349db1d0711d95c1198AcbA9511B8269626'], // marginPool ] }) From c93aa16a459f6764274e3b730143bcd4b6d499d6 Mon Sep 17 00:00:00 2001 From: Michalis Kargakis Date: Mon, 10 Jul 2023 21:42:28 +0200 Subject: [PATCH 0288/1974] Add Immutable X (#6758) --- projects/dydx/index.js | 2 -- projects/immutablex/index.js | 17 +++++++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 projects/immutablex/index.js diff --git a/projects/dydx/index.js b/projects/dydx/index.js index 0189c829c5c..eb26b94f880 100644 --- a/projects/dydx/index.js +++ b/projects/dydx/index.js @@ -1,8 +1,6 @@ const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk'); - const BigNumber = require("bignumber.js"); - const contracts = [ '0x5199071825CC1d6cd019B0D7D42B08106f6CF16D', '0x1e0447b19bb6ecfdae1e4ae1694b0c3659614e4e', diff --git a/projects/immutablex/index.js b/projects/immutablex/index.js new file mode 100644 index 00000000000..b13c4128c7c --- /dev/null +++ b/projects/immutablex/index.js @@ -0,0 +1,17 @@ +const ADDRESSES = require('../helper/coreAssets.json'); +const { sumTokensExport } = require('../helper/sumTokens'); + +const owners = [ + '0x5FDCCA53617f4d2b9134B29090C87D01058e27e9', +]; + +const tokens = [ + ADDRESSES.null, + ADDRESSES.ethereum.USDC, + "0xeD35af169aF46a02eE13b9d79Eb57d6D68C1749e", // OMI + "0xccC8cb5229B0ac8069C51fd58367Fd1e622aFD97", // GODS +]; + +module.exports = { + ethereum: { tvl: sumTokensExport({ owners, tokens }) }, +}; From 9eb80e3a9144a919ccd63ce49bc7b649f05bd291 Mon Sep 17 00:00:00 2001 From: Michalis Kargakis Date: Mon, 10 Jul 2023 21:43:08 +0200 Subject: [PATCH 0289/1974] Track staked ETH in JPEGd treasury (#6761) Start tracking staked ETH coins that are going to be staked in the JPEGd treasury based on PIP-67[1] [1] https://snapshot.org/#/jpeg%E2%80%99d.eth/proposal/0x3d1fe59da03edceceedac15cd5cb30b002dc5a1daa0be4d52ac6fa37bd594d57 --- projects/treasury/jpegd.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/projects/treasury/jpegd.js b/projects/treasury/jpegd.js index a00f0ea7740..1ccd1352bc5 100644 --- a/projects/treasury/jpegd.js +++ b/projects/treasury/jpegd.js @@ -30,6 +30,10 @@ const treasuryTvl = treasuryExports({ "0x836A808d4828586A69364065A1e064609F5078c7", "0x9848482da3Ee3076165ce6497eDA906E66bB85C5", ADDRESSES.ethereum.vlCVX, + ADDRESSES.ethereum.sfrxETH, + ADDRESSES.ethereum.STETH, + ADDRESSES.ethereum.WSTETH, + ADDRESSES.ethereum.RETH, lp, lp2, ], From bb493e1ca2345c03d0b6950584d265f054cce402 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 10 Jul 2023 22:01:14 +0200 Subject: [PATCH 0290/1974] fix sigmafi tvl --- projects/sigmafi/index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/projects/sigmafi/index.js b/projects/sigmafi/index.js index 245d0dbd588..a0bcac9f17c 100644 --- a/projects/sigmafi/index.js +++ b/projects/sigmafi/index.js @@ -16,6 +16,8 @@ module.exports = { tvl: sumTokensExport({ owners: [ '47r8CNpYJhLaJy9vQAyyhVX7SLu73dg8EDmi9zzei7YWomvTAbNaZMAHdM38TsFoiZfAcKuyrgngD6ZS2uPQktLfFpvypxkRiRi9LswRYd5tk6B5HHDsFNMfLcdqeWT9RDR2SRq1zm2HF9F913aY1gc9gVyeh8PGED2ThKJ2NCG19XhyPqCbgTFY5uTC6RaqpGCdH9p58fD4DWDd46D3EfUXz3XLzqGQvDGXTghkh9UtZ1LB7nFFoPDFc2QVDt6BCtTQwq4Jh9vFfTfBG9q6ReVF5cVX7nA6vXhWjUuHKMd7Zw5anM2u95e', '2f7L4F3Q9eCjdWRmxSENw18Bw5SPAf3vBaimRqgpWB5JayiqSWG2tvnc6kF8ae8mpYwtZasmVDzmgjbfa8EBTdA1u55yB8ypRZDDFhs6DmhQekuGvzBoViApMyKdAXCPriXMaJWgHxAdjtR7QhXSjdnyozxZ7ApXrQY6hDSX6H2Fg9siuGUQpTQ3oJDa8nScMGdLNK2T5A7oHs', + '2jMoa21VMLebD9C3j1jXHBCSZitYqMdcqJt7jSKAVwAsVaKifkspA8jfSeRp2dnnQVgjdsXfRDzo4h1hmroTnPsMAB8qiBnyGjStmMxxFirroejmZFgH25zouApdAZtjTERNrvn67QFPGhGRpxopGEZYrQbpj3PmNR4UPyvKkCHzWbkM7cMA2o45RadU4gY6LAoDwvop35QmPsbP2CuETfJPWUKHgDw87wzwPfpBHYxNht3btUuaNB7ifL1To8KotbFKQyRQ3s84vsbed5abchfWhgSkU6HDvJJM9vmt2axcC5P72jEtPsdK19oGw3FsYZp5S9DpKmQRJasDStTRtgBEbD6vnP6orTrje9oJEpvarFdRE9gG1gQKoQdUn5PtssaVhWG3yX67BSyy1mQVkdPq17CrD4di6mhuakBKi9Wn6YTFCvdeLqfSTAaFJPA3uitsqpSkLxNGyqMMtHZ5oahuZ3jVtx3As5N2ZTt835XUYsFE31n3CzfZPvyHCDtahYTRqeCBvPMZw8vdh3a1XtfqNX15AmQy7Jf8W6Y7McsKQVwG5gogXu6XSSCrGn9r2j9m3DBPitUPpEdNqavvxX5Jqrrp2UNLNNfsZZRT26ifnWWa1W5LnjVQVeRFdki5Haf', + '3FdyuY8fqeTtYcsuvTsmsw4ZBGde2cad6hyntGxzSY3rd4JtTwTvK64xp3XJZvYNTijrTMZMQxkFiULuHpq46VFbAiSSHXLe1qy5WXNRELj4tcx6wEPbSDqzDyVbY6wKFQhmvYQT2XjqLJAiBGV9F6f2uXrjXFPzPnXpVeJnWc8ob1wMqbfgBQKdfu24qx3pejkAfAz2hmQQ57xgzGwHCcGyJdad7UxwmDetAUER8iwE32rygGCmqXaVeKGcJ33epYNGpDLPnYUg3Qz7eYuHHb7mAqwkEp6XGE1jWbf8nS7TA1taNpakssbWYN2YmB9NBG8nWNzLhc9QBdqyAn9WQ63Jh1znt2up6sQJR7xnon9ZsYoeo7bErzg4uoJbTLzwjhZBJ9En9bMX72xUb5zhvSSua6CseMMA6s86g2mwrieRwqFM7CGDypy78MzWS1nagUBKLet8LAFFpb6DKBK1h2HpAvLnMbWB7Kp3rJ4be6ed5crNdZTqhbSww96P2KNSZemhwfgAkUFjMJzB2dEG9VNAW1dMk5nBrS8JsRHhYpPqFcJiFtQvcar1ijs2PqsR9k4P41Y99iomfYXkSoA6z612v1U1C19ASVurzuxGP1vNwNyKLceFVTYXbgkgUFX8Z2nwMz6d2TCa4XTpt9daV5sBV88YJgCiYbL5QhxnoTdYRZbxu725jnV7gbnX9FWjLNaXYJubi5u8kPs3MYzSALeUvtfx6wJV1XyBn5DMbvy8XgFFMKyxtUrfU3dAVaZmUZJnYy8Dz6qrf8tyKx3uU7RfosjV7rcAFRDpozznWRfsxZUir5EzcVFQc9NbjB4HdgJxxvUJ9Nr9F8XCQLL89wCTtaNZBFF284qLtrQ', ] }), borrowed, }, From ff384ffd40133801d9cf7392a44d1276f840f34a Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Tue, 11 Jul 2023 06:19:55 +0100 Subject: [PATCH 0291/1974] comment bsc chain while mpendle is priced --- projects/penpie/config.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/penpie/config.js b/projects/penpie/config.js index 1d6d3ee2441..31b01d49234 100644 --- a/projects/penpie/config.js +++ b/projects/penpie/config.js @@ -12,12 +12,12 @@ module.exports = { mPENDLE: "0xB688BA096b7Bb75d7841e47163Cd12D18B36A5bF", PENDLE: "0x0c880f6761F1af8d9Aa9C466984b80DAb9a8c9e8", pendleStaking: "0x6DB96BBEB081d2a85E0954C252f2c1dC108b3f81", - }, + },/* bsc: { masterPenpie: "0xb35b3d118c0394e750b4b59d2a2f9307393cd5db", vePENDLE: "0x8A09574b0401A856d89d1b583eE22E8cb0C5530B", mPENDLE: "0x0465aad9da170798433f4ab7fa7ec8b9b9bf0bb1", PENDLE: "0xb3Ed0A426155B79B898849803E3B36552f7ED507", pendleStaking: "0x782d9d67feaa4d1cdf8222d9053c8cba1c3b7982", - }, + },*/ }; From c51757a3249a33607544e81405da4a37d49bd476 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 11 Jul 2023 09:50:01 +0200 Subject: [PATCH 0292/1974] ergo update --- projects/anetabtc/index.js | 29 ++--------------------------- projects/helper/sumTokens.js | 1 + projects/helper/tokenMapping.js | 2 +- projects/milkomeda-djed/index.js | 7 ------- projects/sigmafi/index.js | 2 ++ 5 files changed, 6 insertions(+), 35 deletions(-) diff --git a/projects/anetabtc/index.js b/projects/anetabtc/index.js index 597139bf53b..c635356d983 100644 --- a/projects/anetabtc/index.js +++ b/projects/anetabtc/index.js @@ -1,21 +1,4 @@ -const { get } = require('../helper/http') -const { sumTokensExport } = require('../helper/chain/cardano') - -let tokenPrice -const DAY = 24 * 60 * 60 * 1000 -const aDayAgo = new Date() - DAY - -async function getTokenPrice() { - if (!tokenPrice) tokenPrice = _getTokenPrice() - return tokenPrice - - async function _getTokenPrice() { - const data = await get('https://api.ergodex.io/v1/amm/markets?from='+aDayAgo) - const priceObj = data.find(i => i.quoteSymbol === 'NETA' && i.baseSymbol === 'ERG') - if (!priceObj) return 0 - return 1/(priceObj.lastPrice) - } -} +const { sumTokensExport } = require('../helper/sumTokens') module.exports = { timetravel: false, @@ -24,14 +7,6 @@ module.exports = { staking: sumTokensExport({ tokens: ['b34b3ea80060ace9427bda98690a73d33840e27aaa8d6edb7f0c757a634e455441'], owner: 'addr1w8p79rekquuw5kmdg4z36y9gpnm88k5huddwqluk9mjjeqgc3xmss'}) }, ergo: { - staking: async () => { - const api = 'https://api.ergoplatform.com/api/v1/addresses/5ASYVJ2w8tH3bDQx5ZLz6rZUdokD1kmTXSRZ8GfrsAUW4vqy9eg5omtTYVzY22ibHANf7GgSc2E5FiThgo8qXzWpU3RDLohN277hksbAf9yykajXbYPUaXUeMPfSXbS1GdE4y2GoYKaXHR3H57MV5CDZE58YteqWe3XVXzmMvj1192AD7UZ1N6nguRfjgijxEWTrLq2ZrykjRAut2JBGYHanAKn46tYWW3chpxNosXG7ZW2ShDzKju2ttHhfxeZVMBydryuoEya5E9KVagjsfa9E2qPUdLpbh8enppVWcwoQ4GF1ktgzSX32QbfKhfpD23iWQixThUbcCca14FjXDt94GVFPuhAT5tQyiKen863Cq5eRAEgsQ7otX6pWa32Q28sxSF9Az4abwiJKNbFhbhb3cDCs6A45ZnW6aB6AkfwTJSAZ2ZzqqG7LXT4HdxNpdmiwno9sJWxPf2PC4vRhVqBPdxxyCgoodjyutf4UuinSCibhfqdhUJLc1JM8zX9UcD699mChgUZoKE8kXD4soVGSgQD3qfGXC6RP7n8dtowArNLm3H5QJ3EobDCbEgECLHFaHN2BPwwWscAt5eejKeFvkp3CuQ3mqFW7vfQG4n9tTLnshj8cjxnpkBdfFKC83sW8A3AoZAX4K1UrhndfLSFh4w/balance/confirmed' - const data = await get(api) - const tokenData = data.tokens.find(i => i.tokenId === '472c3d4ecaa08fb7392ff041ee2e6af75f4a558810a74b28600549d5392810e8') - return { - // cneta: tokenData.amount * (await getTokenPrice())/(10 ** tokenData.decimals) - cneta: tokenData.amount /(10 ** tokenData.decimals) - } - } + staking: sumTokensExport({ tokens: ['472c3d4ecaa08fb7392ff041ee2e6af75f4a558810a74b28600549d5392810e8'], owner: '5ASYVJ2w8tH3bDQx5ZLz6rZUdokD1kmTXSRZ8GfrsAUW4vqy9eg5omtTYVzY22ibHANf7GgSc2E5FiThgo8qXzWpU3RDLohN277hksbAf9yykajXbYPUaXUeMPfSXbS1GdE4y2GoYKaXHR3H57MV5CDZE58YteqWe3XVXzmMvj1192AD7UZ1N6nguRfjgijxEWTrLq2ZrykjRAut2JBGYHanAKn46tYWW3chpxNosXG7ZW2ShDzKju2ttHhfxeZVMBydryuoEya5E9KVagjsfa9E2qPUdLpbh8enppVWcwoQ4GF1ktgzSX32QbfKhfpD23iWQixThUbcCca14FjXDt94GVFPuhAT5tQyiKen863Cq5eRAEgsQ7otX6pWa32Q28sxSF9Az4abwiJKNbFhbhb3cDCs6A45ZnW6aB6AkfwTJSAZ2ZzqqG7LXT4HdxNpdmiwno9sJWxPf2PC4vRhVqBPdxxyCgoodjyutf4UuinSCibhfqdhUJLc1JM8zX9UcD699mChgUZoKE8kXD4soVGSgQD3qfGXC6RP7n8dtowArNLm3H5QJ3EobDCbEgECLHFaHN2BPwwWscAt5eejKeFvkp3CuQ3mqFW7vfQG4n9tTLnshj8cjxnpkBdfFKC83sW8A3AoZAX4K1UrhndfLSFh4w'}) } } \ No newline at end of file diff --git a/projects/helper/sumTokens.js b/projects/helper/sumTokens.js index d79a3295f9a..79e40ad52c8 100644 --- a/projects/helper/sumTokens.js +++ b/projects/helper/sumTokens.js @@ -5,6 +5,7 @@ const sdk = require('@defillama/sdk') const helpers = { "eos": require("./chain/eos"), + "ergo": require("./chain/ergo"), "elrond": require("./chain/elrond"), "cardano":require("./chain/cardano"), "algorand":require("./chain/algorand"), diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 2f565faf4dd..98a24d9d33c 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -17,7 +17,7 @@ coreAssets = JSON.parse(JSON.stringify(coreAssets)) // orbit brige: https://bridge.orbitchain.io/open/v1/api/monitor/rawTokenList const ibcChains = ['ibc', 'terra', 'terra2', 'crescent', 'osmosis', 'kujira', 'stargaze', 'juno', 'injective', 'cosmos', 'comdex', 'stargaze', 'umee', 'orai', 'persistence', 'fxcore', 'neutron', 'quasar', 'chihuahua', ] -const caseSensitiveChains = [...ibcChains, 'solana', 'tezos', 'ton', 'algorand', 'aptos', 'near', 'bitcoin', 'waves', 'tron', 'litecoin', 'polkadot', 'ripple', 'elrond', 'cardano', 'stacks', 'sui'] +const caseSensitiveChains = [...ibcChains, 'solana', 'tezos', 'ton', 'algorand', 'aptos', 'near', 'bitcoin', 'waves', 'tron', 'litecoin', 'polkadot', 'ripple', 'elrond', 'cardano', 'stacks', 'sui', 'ergo', ] const distressedAssts = new Set(Object.values({ CRK: '0x065de42e28e42d90c2052a1b49e7f83806af0e1f', diff --git a/projects/milkomeda-djed/index.js b/projects/milkomeda-djed/index.js index 6cf3a6de31d..c1ed78e7b80 100644 --- a/projects/milkomeda-djed/index.js +++ b/projects/milkomeda-djed/index.js @@ -1,6 +1,4 @@ const sdk = require('@defillama/sdk'); -const utils = require('../helper/utils'); -const { sumTokensExport } = require("../helper/chain/cardano"); const { transformBalances } = require('../helper/portedTokens'); const abi = require('./abi.json'); @@ -17,11 +15,6 @@ async function tvl(chain, chainBlocks) { return transformBalances(chain, balances); } -async function ergotvl() { - const {data: { confirmed }} = await utils.fetchURL('https://api.ergoplatform.com/api/v1/addresses/MUbV38YgqHy7XbsoXWF5z7EZm524Ybdwe5p9WDrbhruZRtehkRPT92imXer2eTkjwPDfboa1pR3zb3deVKVq3H7Xt98qcTqLuSBSbHb7izzo5jphEpcnqyKJ2xhmpNPVvmtbdJNdvdopPrHHDBbAGGeW7XYTQwEeoRfosXzcDtiGgw97b2aqjTsNFmZk7khBEQywjYfmoDc9nUCJMZ3vbSspnYo3LarLe55mh2Np8MNJqUN9APA6XkhZCrTTDRZb1B4krgFY1sVMswg2ceqguZRvC9pqt3tUUxmSnB24N6dowfVJKhLXwHPbrkHViBv1AKAJTmEaQW2DN1fRmD9ypXxZk8GXmYtxTtrj3BiunQ4qzUCu1eGzxSREjpkFSi2ATLSSDqUwxtRz639sHM6Lav4axoJNPCHbY8pvuBKUxgnGRex8LEGM8DeEJwaJCaoy8dBw9Lz49nq5mSsXLeoC4xpTUmp47Bh7GAZtwkaNreCu74m9rcZ8Di4w1cmdsiK1NWuDh9pJ2Bv7u3EfcurHFVqCkT3P86JUbKnXeNxCypfrWsFuYNKYqmjsix82g9vWcGMmAcu5nagxD4iET86iE2tMMfZZ5vqZNvntQswJyQqv2Wc6MTh4jQx1q2qJZCQe4QdEK63meTGbZNNKMctHQbp3gRkZYNrBtxQyVtNLR8xEY8zGp85GeQKbb37vqLXxRpGiigAdMe3XZA4hhYPmAAU5hpSMYaRAjtvvMT3bNiHRACGrfjvSsEG9G2zY5in2YWz5X9zXQLGTYRsQ4uNFkYoQRCBdjNxGv6R58Xq74zCgt19TxYZ87gPWxkXpWwTaHogG1eps8WXt8QzwJ9rVx6Vu9a5GjtcGsQxHovWmYixgBU8X9fPNJ9UQhYyAWbjtRSuVBtDAmoV1gCBEPwnYVP5GCGhCocbwoYhZkZjFZy6ws4uxVLid3FxuvhWvQrVEDYp7WRvGXbNdCbcSXnbeTrPMey1WPaXX/balance/total'); - return { ergo: confirmed.nanoErgs / 1e9 }; -} - module.exports = { methodology: 'The TVL of each Djed deployment on Milkomeda C1.', milkomeda: { diff --git a/projects/sigmafi/index.js b/projects/sigmafi/index.js index a0bcac9f17c..0845f58e595 100644 --- a/projects/sigmafi/index.js +++ b/projects/sigmafi/index.js @@ -18,6 +18,8 @@ module.exports = { '2f7L4F3Q9eCjdWRmxSENw18Bw5SPAf3vBaimRqgpWB5JayiqSWG2tvnc6kF8ae8mpYwtZasmVDzmgjbfa8EBTdA1u55yB8ypRZDDFhs6DmhQekuGvzBoViApMyKdAXCPriXMaJWgHxAdjtR7QhXSjdnyozxZ7ApXrQY6hDSX6H2Fg9siuGUQpTQ3oJDa8nScMGdLNK2T5A7oHs', '2jMoa21VMLebD9C3j1jXHBCSZitYqMdcqJt7jSKAVwAsVaKifkspA8jfSeRp2dnnQVgjdsXfRDzo4h1hmroTnPsMAB8qiBnyGjStmMxxFirroejmZFgH25zouApdAZtjTERNrvn67QFPGhGRpxopGEZYrQbpj3PmNR4UPyvKkCHzWbkM7cMA2o45RadU4gY6LAoDwvop35QmPsbP2CuETfJPWUKHgDw87wzwPfpBHYxNht3btUuaNB7ifL1To8KotbFKQyRQ3s84vsbed5abchfWhgSkU6HDvJJM9vmt2axcC5P72jEtPsdK19oGw3FsYZp5S9DpKmQRJasDStTRtgBEbD6vnP6orTrje9oJEpvarFdRE9gG1gQKoQdUn5PtssaVhWG3yX67BSyy1mQVkdPq17CrD4di6mhuakBKi9Wn6YTFCvdeLqfSTAaFJPA3uitsqpSkLxNGyqMMtHZ5oahuZ3jVtx3As5N2ZTt835XUYsFE31n3CzfZPvyHCDtahYTRqeCBvPMZw8vdh3a1XtfqNX15AmQy7Jf8W6Y7McsKQVwG5gogXu6XSSCrGn9r2j9m3DBPitUPpEdNqavvxX5Jqrrp2UNLNNfsZZRT26ifnWWa1W5LnjVQVeRFdki5Haf', '3FdyuY8fqeTtYcsuvTsmsw4ZBGde2cad6hyntGxzSY3rd4JtTwTvK64xp3XJZvYNTijrTMZMQxkFiULuHpq46VFbAiSSHXLe1qy5WXNRELj4tcx6wEPbSDqzDyVbY6wKFQhmvYQT2XjqLJAiBGV9F6f2uXrjXFPzPnXpVeJnWc8ob1wMqbfgBQKdfu24qx3pejkAfAz2hmQQ57xgzGwHCcGyJdad7UxwmDetAUER8iwE32rygGCmqXaVeKGcJ33epYNGpDLPnYUg3Qz7eYuHHb7mAqwkEp6XGE1jWbf8nS7TA1taNpakssbWYN2YmB9NBG8nWNzLhc9QBdqyAn9WQ63Jh1znt2up6sQJR7xnon9ZsYoeo7bErzg4uoJbTLzwjhZBJ9En9bMX72xUb5zhvSSua6CseMMA6s86g2mwrieRwqFM7CGDypy78MzWS1nagUBKLet8LAFFpb6DKBK1h2HpAvLnMbWB7Kp3rJ4be6ed5crNdZTqhbSww96P2KNSZemhwfgAkUFjMJzB2dEG9VNAW1dMk5nBrS8JsRHhYpPqFcJiFtQvcar1ijs2PqsR9k4P41Y99iomfYXkSoA6z612v1U1C19ASVurzuxGP1vNwNyKLceFVTYXbgkgUFX8Z2nwMz6d2TCa4XTpt9daV5sBV88YJgCiYbL5QhxnoTdYRZbxu725jnV7gbnX9FWjLNaXYJubi5u8kPs3MYzSALeUvtfx6wJV1XyBn5DMbvy8XgFFMKyxtUrfU3dAVaZmUZJnYy8Dz6qrf8tyKx3uU7RfosjV7rcAFRDpozznWRfsxZUir5EzcVFQc9NbjB4HdgJxxvUJ9Nr9F8XCQLL89wCTtaNZBFF284qLtrQ', + '3FdyuY8fqeBRBVN7uhPo71JiPcmugpqdCjG5gakgXSPR7DKEGbXWkwm4dfer46kn8nCbAK1Ycw8svJGj2fMLM2kiA7GsZZdVEqDeR9K3RcVHRUCATB9qo9pf9FmekGVfG6pbzRMNrPp3TaWimHFhZCLUyqukuSaf4h9JuDqJE29hHCtdb8W7AeXTV2kfB18jUpDhCKxET3EnoBTHC1buAg3SdhPiBhVAYJFw5NVfph6kfV37nHn6hdawVrdtLbnC47xgQ7KzeMG9spHbEbn73Mz9bhCdPeqnS75jAQSjokrDLDeQSgKU8aN3Cb4i5oE5MUT9p55ignJnjzJ335UfAiEGve4tbr489sCcZ5sCNeXZEGK1WYWp39RbwdpdsfhyrVNKCpXn9xHsjSPwZVGduc5fanzGDGHEESEJCV1JYzzJ32ai274q1aQMgJuPB3CSvcy4pqcJe2XNKVSMrrwou9VXNrpeNv4DTDcnVSjB8kc6omgSYKaWBjGwaSVs6vuHK9gLfvQrDa3G1EMhfpuM3Vqs2TaHqxjc4XQyGRjJnhhqKwN4td5bo54MXEa8kojxXrXSFbi2DwcVzMQemjzxs1m5VqLv3wjCSzP9wXDEhyFMCsRbfNPTju5j7HVsRf4YBgViG6vXbAvbUcE7bA3nHMpB9SKyuGQZRVabo5899yfJpWyUM1DEwAnPDjoK4v1UYsSvUBHfs6adrHWu6oVDhZBFZZXYMVvmo56jhSXhGYTrecnhPY25a2UV5cN64bPcE3vFnW7Lpvo1nvh8XYGT9bJuP9fn1ohgnKqBwpgnwMEZxoCWHqvSsbyp4SV6nMcA416YCBYrNmwfiwFqmhYYFfAYCFdutEx52xa8E2r', + '3FdyuY8fqvU21gvgv1A5Vo8XkkR4ba8RzyqwDv6ig7466wTwax4fbJc5bJMeGnYrRsvS5uiAisS7gykBJsxYgE4LRuRuKr9KzZn4BtcNeT3Hsw3zncjE7yhzSPKoW7FkbijxtTUoKYXuby5W8TEk9L1kBaDzgKRpG1YahyHVghtJYgMcy3utVjRZXxBqZbij3cZtqSNqk3UZJmTBZKufYT17C5Mae62DckHwk6ZSZi9GVSTvw2xiENo5koKya67JcX4n23WPQ4dCVsEKcQ2cGjETJhSCi4fsvFUteGkayZW9Q4jqkuum3hz3imhdSAyPvhHnRTMEPG7PKvnn4E7hbiPsbTRAd5L8DruVosvQkcyFPXJ8qhaKDrzmcqy4baHzWHN5GRqY1CrFMnSMJTmznHXzdPwm4MfdjHXppvxBsmDTFxoRdGtriafByVmvYtkKmH9pS3agL142ByqKo79yFSWucVQnE6ojfY8gmVb7uwHqxq1Lez2Nxjbupu2tC9hHdYeM3kX3VBYrjTnXP72sv3Gr3eocm383ZGC5Ppa3pB4DSYmtiJ9LdxU85WBA36KzfrLLEsnHj9gRFWwqEfA6akTNgtboo4wQH9HTCSyHRFnu4HZh4fHaLZe6Wg1LrbbTrcEWUaMFaTEaGhKR32KG2Pd75BxVbYeF6LTQ5yfVeSyhvLWBgKD49X6Y2AemNdV2JE62cS42WDFNH7NwJL7Zqrf465mWhJ137rcrzUpm4sGqv3fnVuxcT2bY2AD8UKindPGjSzP9cg8Pey8EqG4c5jZ44D4rbmNSGaVBzm47tvNyEZRNAmhRPhkuvqsMDoNNjAGwUDxQ2XCShQHhdQAMSdTfKiPMGxmqv7n25js', ] }), borrowed, }, From d0915539d97f8a0f8265e45d3965c845b91720c8 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 11 Jul 2023 10:04:06 +0200 Subject: [PATCH 0293/1974] penpie: include bsc --- projects/penpie/config.js | 4 ++-- projects/penpie/index.js | 40 +++++++++------------------------------ 2 files changed, 11 insertions(+), 33 deletions(-) diff --git a/projects/penpie/config.js b/projects/penpie/config.js index 31b01d49234..1d6d3ee2441 100644 --- a/projects/penpie/config.js +++ b/projects/penpie/config.js @@ -12,12 +12,12 @@ module.exports = { mPENDLE: "0xB688BA096b7Bb75d7841e47163Cd12D18B36A5bF", PENDLE: "0x0c880f6761F1af8d9Aa9C466984b80DAb9a8c9e8", pendleStaking: "0x6DB96BBEB081d2a85E0954C252f2c1dC108b3f81", - },/* + }, bsc: { masterPenpie: "0xb35b3d118c0394e750b4b59d2a2f9307393cd5db", vePENDLE: "0x8A09574b0401A856d89d1b583eE22E8cb0C5530B", mPENDLE: "0x0465aad9da170798433f4ab7fa7ec8b9b9bf0bb1", PENDLE: "0xb3Ed0A426155B79B898849803E3B36552f7ED507", pendleStaking: "0x782d9d67feaa4d1cdf8222d9053c8cba1c3b7982", - },*/ + }, }; diff --git a/projects/penpie/index.js b/projects/penpie/index.js index a3533146141..cb783d1deda 100644 --- a/projects/penpie/index.js +++ b/projects/penpie/index.js @@ -1,49 +1,27 @@ -const sdk = require("@defillama/sdk"); -const { staking } = require("../helper/staking"); const MasterMagpieAbi = require("../magpiexyz/abis/masterMagpie.json"); const config = require("./config"); async function tvl(timestamp, block, chainBlocks, { api }) { - const { masterPenpie, pendleStaking, vePENDLE, PENDLE } = config[api.chain]; + const { masterPenpie, pendleStaking, vePENDLE, PENDLE, mPENDLE, } = config[api.chain]; const poolTokens = await api.fetchList({ lengthAbi: MasterMagpieAbi.poolLength, itemAbi: MasterMagpieAbi.registeredToken, target: masterPenpie, }); - - const decimals = await api.multiCall({ - abi: "erc20:decimals", - calls: poolTokens, - }); - - const balances = {}; - poolTokens.push(vePENDLE); - decimals.push("18"); - - const bals = await api.multiCall({ - abi: "erc20:balanceOf", - calls: poolTokens.map((i) => ({ target: i, params: pendleStaking })), - }); - - bals.forEach((v, i) => { - v /= 10 ** (18 - decimals[i]); - sdk.util.sumSingleBalance( - balances, - poolTokens[i] == vePENDLE ? PENDLE : poolTokens[i], - v, - api.chain - ); - }); - - return balances; + const poolInfos = await api.multiCall({ abi: 'function getPoolInfo(address) view returns ( uint256 emission, uint256 allocpoint, uint256 sizeOfPool, uint256 totalPoint)', calls: poolTokens, target: masterPenpie, }) + const symbols = await api.multiCall({ abi: 'erc20:symbol', calls: poolTokens, }) + poolTokens.forEach((token, i) => { + if (symbols[i] === 'vlPenpie' || symbols[i] === 'mPendle' || symbols[i] === 'mPendleOFT') { + token = PENDLE + } + api.add(token, poolInfos[i].sizeOfPool) + }) } Object.keys(config).forEach((chain) => { - const { masterPenpie, mPENDLE } = config[chain]; module.exports[chain] = { doublecounted: true, tvl: tvl, - staking: staking(masterPenpie, mPENDLE), }; }); From 11f29262ad4b9c40a92b1eb4dbb0f943b43d86bb Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 11 Jul 2023 10:39:21 +0200 Subject: [PATCH 0294/1974] track https://lab.aerielab.io --- projects/aerie/index.js. | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 projects/aerie/index.js. diff --git a/projects/aerie/index.js. b/projects/aerie/index.js. new file mode 100644 index 00000000000..2740ae30835 --- /dev/null +++ b/projects/aerie/index.js. @@ -0,0 +1,27 @@ +const { sumUnknownTokens } = require('../helper/unknownTokens') + +async function tvl(_, _b, _cb, { api, }) { + const Indexer = '0x0336dfb02ba66ce75f5cc7898c3eafeddc493daf' + let pools = await api.call({ abi: abi.getAllSaaSPools, target: Indexer }) + const isEnabled = await api.multiCall({ abi: abi.poolEnabled, calls: pools }) + pools = pools.filter((_, i) => isEnabled[i]) + const tokens = await api.multiCall({ abi: abi.stakedTokenAddress, calls: pools}) + const poolInfo = await api.multiCall({ abi: abi.pool, calls: pools}) + const bals = poolInfo.map(i => i.totalTokensStaked) + api.addTokens(tokens, bals) + return sumUnknownTokens({ api, useDefaultCoreAssets: true, lps: ['0x412cb411be14ec0ee87c2823f830d33dd37aa8f8']}) +} + +module.exports = { + ethereum: { + tvl: () => ({}), + staking: tvl, + }, +} + +const abi = { + "getAllSaaSPools": "address[]:getAllSaaSPools", + "stakedTokenAddress": "address:stakedTokenAddress", + "pool": "function pool() view returns (address creator, address tokenOwner, uint256 poolTotalSupply, uint256 poolRemainingSupply, uint256 totalTokensStaked, uint256 creationBlock, uint256 perBlockNum, uint256 lockedUntilDate, uint256 lastRewardBlock, uint256 accERC20PerShare, uint256 stakeTimeLockSec, bool isStakedNft, bytes32 website)", + "poolEnabled": "bool:poolEnabled", +} \ No newline at end of file From 06906dd4471ac68411b9f3a80e055a8531881764 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 11 Jul 2023 10:43:13 +0200 Subject: [PATCH 0295/1974] add hallmark --- projects/rodeo/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/rodeo/index.js b/projects/rodeo/index.js index 6357615d1d0..a353abdedb7 100644 --- a/projects/rodeo/index.js +++ b/projects/rodeo/index.js @@ -20,4 +20,7 @@ async function tvl(_, _b, _cb, { api, }) { module.exports = { arbitrum: { tvl, borrowed, }, methodology: `The TVL shown is the result of subtracting the borrow from the supply for each Rodeo lending pool`, + hallmarks: [ + [Math.floor(new Date('2023-07-11')/1e3), 'Protocol was exploited'], + ], }; From b0458a255e68cd7aa7523f8e4c47d3b25173dffb Mon Sep 17 00:00:00 2001 From: 0xjosaphat <120175614+0xjosaphat@users.noreply.github.com> Date: Tue, 11 Jul 2023 10:43:48 +0200 Subject: [PATCH 0296/1974] added new chain arbitrum (#6770) * added new chain polygon_zkevm * added marker for new chain launch on Polygon zkEVM * added new chain arbitrum --- projects/swapline/index.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/projects/swapline/index.js b/projects/swapline/index.js index a380e758817..e1b9a93133e 100644 --- a/projects/swapline/index.js +++ b/projects/swapline/index.js @@ -4,6 +4,7 @@ const factories = { fantom: '0x640801a6983c109805E928dc7d9794080C21C88E', optimism: '0xd08C98F6409fCAe3E61f3157B4147B6595E60cf3', polygon_zkevm: '0x5A5c0C4832828FF878CE3ab4fEc44d21200b1496', + arbitrum: '0xEE0616a2DEAa5331e2047Bc61E0b588195A49cEa', } async function tvl(_, _b, _cb, { api, }) { @@ -31,7 +32,8 @@ async function tvl(_, _b, _cb, { api, }) { module.exports = { hallmarks: [ [1682298000,"Launch on Optimism"], - [1687827600,"Launch on Polygon zkEVM"] + [1687827600,"Launch on Polygon zkEVM"], + [1689037200,"Launch on Arbitrum"] ], methodology: 'We count the token balances in in different liquidity book contracts', fantom:{ @@ -43,4 +45,7 @@ module.exports = { polygon_zkevm:{ tvl, }, + arbitrum:{ + tvl, + }, }; \ No newline at end of file From 43b64fc8a9ebbb70260311b453fb61b8313614f9 Mon Sep 17 00:00:00 2001 From: Maksim Kurbatov <94808996+yungwine@users.noreply.github.com> Date: Tue, 11 Jul 2023 15:44:25 +0700 Subject: [PATCH 0297/1974] add bemo protocol (#6769) * add bemo * remove logs --- projects/bemo/index.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 projects/bemo/index.js diff --git a/projects/bemo/index.js b/projects/bemo/index.js new file mode 100644 index 00000000000..a829af299bc --- /dev/null +++ b/projects/bemo/index.js @@ -0,0 +1,23 @@ +const BigNumber = require("bignumber.js"); +const { post } = require('../helper/http') + +module.exports = { + timetravel: false, + methodology: "stTon", + ton: { + tvl: async () => { + const requestBody = { + "address": "EQDNhy-nxYFgUqzfUzImBEP67JqsyMIcyk2S5_RwNNEYku0k", + "method": "get_full_data", + "stack": [] + } + const response = await post('https://toncenter.com/api/v2/runGetMethod', requestBody) + if (! response.ok) { + throw new Error("Unknown"); + } + const result = response.result + const tonTotalSupply = parseInt(result.stack[1][1], 16) + return {"coingecko:the-open-network": BigNumber(tonTotalSupply).div(1e9).toFixed(0)}; + } + } +} From ed2afdd63babd6b3e4fbbb7e4fe720bc3d1c7bb3 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 11 Jul 2023 14:50:05 +0530 Subject: [PATCH 0298/1974] Coinscope (#6771) * Added coinscope project. * Finalized adapter. * refactor coinscope --------- Co-authored-by: geovla93 --- projects/coinscope/index.js | 44 +++++++++++++++++++++++++++++++++++++ projects/helper/utils.js | 2 +- 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 projects/coinscope/index.js diff --git a/projects/coinscope/index.js b/projects/coinscope/index.js new file mode 100644 index 00000000000..773f5391bff --- /dev/null +++ b/projects/coinscope/index.js @@ -0,0 +1,44 @@ + +const { sumUnknownTokens } = require('../helper/unknownTokens') +module.exports = { + misrepresentedTokens: true, + methodology: "TVL is calculated by summing the values of LP tokens held in lockers for a specific network", +}; + +const lockerFactories = { + ethereum: "0x269D4d211CBc9845B006128717eE51b0D6524955", + bsc: "0x269D4d211CBc9845B006128717eE51b0D6524955", + polygon: "0x269D4d211CBc9845B006128717eE51b0D6524955", + avax: "0x269D4d211CBc9845B006128717eE51b0D6524955", + arbitrum: "0x269D4d211CBc9845B006128717eE51b0D6524955", + cronos: "0x269D4d211CBc9845B006128717eE51b0D6524955", + fantom: "0x269D4d211CBc9845B006128717eE51b0D6524955", + telos: "0x269D4d211CBc9845B006128717eE51b0D6524955", + harmony: "0x097f5E933306ad0EbB1c0027B223a3dd153520BE", +} + +Object.keys(lockerFactories).forEach(chain => { + const factory = lockerFactories[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + let fetchLength = 100 + let page = 0 + const tokensAndOwners = [] + let result + do { + result = await api.call({ + abi: abi.getTokens, + target: factory, + params: [true, page, fetchLength, "0x0000000000000000000000000000000000000000",], + }) + tokensAndOwners.push(...result.pageTokens.map(i => i.lockerAddresses.map(j => [i.tokenAddress, j]))) + ++page + } while (result.total === tokensAndOwners) + return sumUnknownTokens({ api, tokensAndOwners: tokensAndOwners.flat(), useDefaultCoreAssets: true }) + } + } +}) + +const abi = { + "getTokens": "function getTokens(bool lp, uint256 page, uint256 pageSize, address token) view returns (tuple(address tokenAddress, uint8 decimals, uint256 totalSupply, bool pair, string pairToken1Name, address pairToken1Address, string pairToken2Name, address pairToken2Address, address pairDexAddress, string tokenName, string tokenSymbol, uint256 totalAmountLocked, uint256 currentAmountLocked, address[] lockerAddresses)[] pageTokens, uint256 total)", +} \ No newline at end of file diff --git a/projects/helper/utils.js b/projects/helper/utils.js index cc95d92fa21..a2243c17402 100644 --- a/projects/helper/utils.js +++ b/projects/helper/utils.js @@ -53,7 +53,7 @@ function isLP(symbol, token, chain) { if (!symbol) return false if (token && blacklisted_LPS.includes(token.toLowerCase()) || symbol.includes('HOP-LP-')) return false if (chain === 'bsc' && ['OLP', 'DLP', 'MLP', 'LP', 'Stable-LP'].includes(symbol)) return false - if (chain === 'bsc' && ['WLP', 'FstLP', 'BLP',].includes(symbol)) return true + if (chain === 'bsc' && ['WLP', 'FstLP', 'BLP', 'DsgLP'].includes(symbol)) return true if (chain === 'pulse' && ['PLP', 'PLT'].includes(symbol)) return true if (chain === 'avax' && ['ELP', 'EPT', 'CRL', 'YSL', 'BGL', 'PLP'].includes(symbol)) return true if (chain === 'ethereum' && ['SSLP'].includes(symbol)) return true From 05dac94f3ef481f7d817ae6074a5ecd687897845 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 11 Jul 2023 15:06:48 +0530 Subject: [PATCH 0299/1974] Tenx (#6772) * add: Tenet Network projects: TenX && Tendieswap * add: Tenet Network to chain.json * code refactor --------- Co-authored-by: bulbazavr1024 --- projects/helper/chains.json | 1 + projects/helper/tokenMapping.js | 3 +++ projects/tenx-exchange/index.js | 3 +++ 3 files changed, 7 insertions(+) create mode 100644 projects/tenx-exchange/index.js diff --git a/projects/helper/chains.json b/projects/helper/chains.json index 9c91550f151..e74b1076e69 100644 --- a/projects/helper/chains.json +++ b/projects/helper/chains.json @@ -187,6 +187,7 @@ "sx", "syscoin", "telos", + "tenet", "terra", "terra2", "tezos", diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 98a24d9d33c..8223b701ac5 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -54,6 +54,9 @@ const fixBalancesTokens = { rpg: { '0x8e8816a1747fddc5f8b45d2e140a425d3788f659': { coingeckoId: "tether", decimals: 18 }, }, + tenet: { + '0xd6cb8a253e12893b0cf39ca78f7d858652cca1fe': { coingeckoId: "tenet-1b000f7b-59cb-4e06-89ce-d62b32d362b9", decimals: 18 }, + }, avax: { '0x8fdcf51d1aaeb9f031838ebeb15884a0d5efcda3': { coingeckoId: "wrapped-bitcoin", decimals: 18 }, '0xaa44678304cc1a848bfc31dc013afcc6c9feae11': { coingeckoId: "benqi", decimals: 18 }, diff --git a/projects/tenx-exchange/index.js b/projects/tenx-exchange/index.js new file mode 100644 index 00000000000..4fddb4762c9 --- /dev/null +++ b/projects/tenx-exchange/index.js @@ -0,0 +1,3 @@ +const { uniTvlExport } = require('../helper/unknownTokens') + +module.exports = uniTvlExport('tenet', '0xbaB158ED71F7FD4AD43b1db1aAc5d0EFA0a8469f') \ No newline at end of file From 62b6f64d6cc9b785c5e6215d6d3b1839b130e6ac Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 11 Jul 2023 12:15:28 +0200 Subject: [PATCH 0300/1974] bugfix --- projects/aerie/{index.js. => index.js} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename projects/aerie/{index.js. => index.js} (100%) diff --git a/projects/aerie/index.js. b/projects/aerie/index.js similarity index 100% rename from projects/aerie/index.js. rename to projects/aerie/index.js From 8606c919351e1775b13f6eaad036768ad5698725 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 11 Jul 2023 12:52:16 +0200 Subject: [PATCH 0301/1974] track swaap-v2 --- projects/swaap-v2/index.js | 27 +++++++++++++++++++++++++++ projects/swaap/index.js | 29 +++++++++++------------------ 2 files changed, 38 insertions(+), 18 deletions(-) create mode 100644 projects/swaap-v2/index.js diff --git a/projects/swaap-v2/index.js b/projects/swaap-v2/index.js new file mode 100644 index 00000000000..a2f7d3325a9 --- /dev/null +++ b/projects/swaap-v2/index.js @@ -0,0 +1,27 @@ +const { getLogs } = require('../helper/cache/getLogs') + +const config = { + ethereum: { factory: '0x03C01Acae3D0173a93d819efDc832C7C4F153B06', fromBlock: 17598603, }, + polygon: { factory: '0x03C01Acae3D0173a93d819efDc832C7C4F153B06', fromBlock: 44521619, }, +} + +Object.keys(config).forEach(chain => { + const { factory, fromBlock } = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const logs = await getLogs({ + api, + target: factory, + topics: ['0x83a48fbcfc991335314e74d0496aab6a1987e992ddc85dddbcc4d6dd6ef2e9fc'], + eventAbi: 'event PoolCreated (address indexed pool)', + onlyArgs: true, + fromBlock, + }) + const pools = logs.map(log => log.pool) + const vault = await api.call({ abi: 'address:getVault', target: factory }) + const poolIds = await api.multiCall({ abi: 'function getPoolId() view returns (bytes32)', calls: pools }) + const data = await api.multiCall({ abi: 'function getPoolTokens(bytes32) view returns (address[] tokens, uint256[] balances, uint256 lastChangeBlock)', calls: poolIds, target: vault }) + data.forEach(({ tokens, balances }) => api.addTokens(tokens, balances)) + } + } +}) \ No newline at end of file diff --git a/projects/swaap/index.js b/projects/swaap/index.js index bf5d6f10ce9..a269c0e564f 100644 --- a/projects/swaap/index.js +++ b/projects/swaap/index.js @@ -1,7 +1,7 @@ -const { GraphQLClient, gql } = require("graphql-request"); const { sumTokens2 } = require('../helper/unwrapLPs') +const { cachedGraphQuery } = require('../helper/cache') -const configV1 = { +const configV1 = { polygon: { startBlock: 29520285, blockDelay: 30, @@ -18,33 +18,26 @@ const configV1 = { } function tvlFunctionGetterV1(chain) { - - return async function tvlFunction(timestamp, ethBlock, chainBlocks) { - - var graphQLClient = new GraphQLClient(configV1[chain]['theGraph']['endpoint']); - + return async function tvlFunction(timestamp, ethBlock, chainBlocks, { api }) { let block = chainBlocks[chain] if (block) - block = configV1[chain]['startBlock'] + configV1[chain]['blockDelay'] > chainBlocks[chain]['startBlock'] ? - configV1[chain]['startBlock'] : chainBlocks[chain] - configV1[chain]['blockDelay'] // delayed to allow subgraph to update - - const fetchAllPools = gql`query ($block: Int) { ${configV1[chain]['theGraph']['query']} }`; - const results = await graphQLClient.request(fetchAllPools, { - block, + block = configV1[chain]['startBlock'] + configV1[chain]['blockDelay'] > chainBlocks[chain]['startBlock'] ? + configV1[chain]['startBlock'] : chainBlocks[chain] - configV1[chain]['blockDelay'] // delayed to allow subgraph to update + + const fetchAllPools = `query ($block: Int) { ${configV1[chain]['theGraph']['query']} }`; + const results = await cachedGraphQuery('swaaap-v1/' + chain, configV1[chain]['theGraph']['endpoint'], fetchAllPools, { + variables: { block, } }); const toa = results.pools.map(i => i.tokens.map(j => ([j.address, i.id]))).flat() - return sumTokens2({ chain, block, tokensAndOwners: toa, }) - } + return sumTokens2({ api, tokensAndOwners: toa, }) + } } module.exports = { start: 1655130642, // Jun-13-2022 02:30:42 PM +UTC - timetravel: true, - misrepresentedTokens: false, methodology: `The TVL is retrieved using a mix of TheGraph (to get the list of pools) and on-chain (to get the pools' assets balance) calls.`, polygon: { tvl: tvlFunctionGetterV1("polygon"), }, - hallmarks:[] }; From 2075976abeb9b24aec4b3d83ed78a1c76d70f01d Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 11 Jul 2023 13:16:21 +0200 Subject: [PATCH 0302/1974] cega: track arbitrum --- projects/cega/evm.js | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/projects/cega/evm.js b/projects/cega/evm.js index 35c5b978438..dee221d9fed 100644 --- a/projects/cega/evm.js +++ b/projects/cega/evm.js @@ -3,9 +3,10 @@ const abi = require("./abi.json"); const maxLeverage = 5; const LOV_SUFFIX = "-lov"; -const CEGA_STATE = "0x0730AA138062D8Cc54510aa939b533ba7c30f26B"; -const CEGA_PRODUCT_VIEWER = "0x31C73c07Dbd8d026684950b17dD6131eA9BAf2C4"; -const usdcAddress = ADDRESSES.ethereum.USDC; +const config = { + ethereum: { CEGA_STATE: "0x0730AA138062D8Cc54510aa939b533ba7c30f26B", CEGA_PRODUCT_VIEWER: '0x31C73c07Dbd8d026684950b17dD6131eA9BAf2C4', usdcAddress: ADDRESSES.ethereum.USDC, }, + arbitrum: { CEGA_STATE: "0xc809B7F21250B1ce0a61b7Fb645AEf5CE7c1B5ed", CEGA_PRODUCT_VIEWER: '0x8c32a5d9f29da36ed68a9d454eda1b374795b6ca', usdcAddress: ADDRESSES.arbitrum.USDC, }, +} // Funds are not lent out const FCN_PURE_OPTIONS_ADDRESSES = [ @@ -23,6 +24,7 @@ const FCN_BOND_AND_OPTIONS_ADDRESSES = [ ]; async function getProducts(api) { + const { CEGA_STATE } = config[api.chain] const productNames = await api.call({ target: CEGA_STATE, abi: abi.getProductNames, }) const LOVProductNames = productNames.filter(v => v.includes(LOV_SUFFIX)) return api.multiCall({ target: CEGA_STATE, abi: abi.products, calls: LOVProductNames }) @@ -42,32 +44,39 @@ function getLOVCalls(lovProducts) { for (const product of lovProducts) for (let i = 2; i < maxLeverage; i++) calls.push([product, i]) - return calls.map(i => ({ params: i})) + return calls.map(i => ({ params: i })) } async function getSumLOVProductDeposits(lovProducts, api) { + const { CEGA_PRODUCT_VIEWER } = config[api.chain] const calls = getLOVCalls(lovProducts) return (await api.multiCall({ target: CEGA_PRODUCT_VIEWER, abi: abi.getLOVVaultMetadata, calls })).map(i => i.map(j => j.underlyingAmount)).flat() } async function getSumLOVProductQueuedDeposits(lovProducts, api) { + const { CEGA_PRODUCT_VIEWER } = config[api.chain] const calls = getLOVCalls(lovProducts) return await api.multiCall({ target: CEGA_PRODUCT_VIEWER, abi: abi.getLOVProductQueuedDeposits, calls }) } async function getEthereumTvl(_, _1, _2, { api }) { + const { usdcAddress } = config[api.chain] const lovProducts = await getProducts(api); - const results = await Promise.all([ - getSumFCNProductDeposits(FCN_PURE_OPTIONS_ADDRESSES, api), - getSumFCNProductQueuedDeposits(FCN_PURE_OPTIONS_ADDRESSES, api), + const calls = [ getSumLOVProductDeposits(lovProducts, api), getSumLOVProductQueuedDeposits(lovProducts, api) - ]); + ] + if (api.chain === 'ethereum') { + calls.push(getSumFCNProductDeposits(FCN_PURE_OPTIONS_ADDRESSES, api), getSumFCNProductQueuedDeposits(FCN_PURE_OPTIONS_ADDRESSES, api)) + } + const results = await Promise.all(calls); const sum = results.flat().flat().reduce((total, currentValue) => total + +currentValue, 0); api.add(usdcAddress, sum) + return api.getBalances() } async function getBorrowedTvl(_, _1, _2, { api }) { + const { usdcAddress } = config[api.chain] const results = await Promise.all([ getSumFCNProductDeposits(FCN_BOND_AND_OPTIONS_ADDRESSES, api), getSumFCNProductQueuedDeposits(FCN_BOND_AND_OPTIONS_ADDRESSES, api), @@ -80,5 +89,8 @@ module.exports = { ethereum: { tvl: getEthereumTvl, borrowed: getBorrowedTvl, - } + }, + arbitrum: { + tvl: getEthereumTvl, + }, } \ No newline at end of file From d67753c75e2bb32b64b85995cedb5e3fef999086 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 11 Jul 2023 13:26:44 +0200 Subject: [PATCH 0303/1974] stader: track ETHx --- projects/stader/index.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/projects/stader/index.js b/projects/stader/index.js index a927826224d..758de462c6d 100644 --- a/projects/stader/index.js +++ b/projects/stader/index.js @@ -1,3 +1,4 @@ +const { nullAddress } = require('../helper/unwrapLPs') const { fetchURL } = require("../helper/utils") async function hbarTvl(timestamp) { @@ -67,6 +68,14 @@ module.exports = { near: { tvl: nearTvl }, + ethereum: { + tvl: async (_, _1, _2, { api }) => { + return { + [nullAddress]: await api.call({ abi: 'uint256:totalAssets', target: '0xcf5ea1b38380f6af39068375516daf40ed70d299' }) + // [nullAddress]: await api.call({ abi: 'uint256:totalSupply', target: '0xa35b1b31ce002fbf2058d22f30f95d405200a15b' }) + } + } + }, hallmarks:[ [1651881600, "UST depeg"], ] From 154a825986e2e00c4ea19bcc53b8af1c7fa67f04 Mon Sep 17 00:00:00 2001 From: ZkSwapDev <131446232+ZkSwapDev@users.noreply.github.com> Date: Tue, 11 Jul 2023 15:44:37 +0400 Subject: [PATCH 0304/1974] add zk-Swap (#6773) * add zk-swap-dex tvl * to full on-chain adapter --- projects/zk-swap-dex/index.js | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 projects/zk-swap-dex/index.js diff --git a/projects/zk-swap-dex/index.js b/projects/zk-swap-dex/index.js new file mode 100644 index 00000000000..ea67a2ab965 --- /dev/null +++ b/projects/zk-swap-dex/index.js @@ -0,0 +1,30 @@ +const { getLogs } = require('../helper/cache/getLogs') +const { sumTokens2 } = require('../helper/unwrapLPs') + +const FACTORY = '0x91C94381a0F0B7F03d911676bD59d32Bb3410060' +const CHAIN = 'era' + +async function getFactoryLogs(api) { + return getLogs({ + api, + target: FACTORY, + fromBlock: 7891758, + topic: 'PoolCreated(address,address,uint24,int24,address)', + eventAbi: 'event PoolCreated(address indexed token0,address indexed token1,uint24 indexed swapFeeUnits,int24 tickDistance,address pool)', + onlyArgs: true, + }) +} + +async function tvl(timestamp, ethBlock, chainBlocks, { api }) { + const factoryLogs = await getFactoryLogs(api) + let balanceRequests = [] + factoryLogs.forEach(({ token0, token1, pool}) => { + balanceRequests.push([token0, pool]) + balanceRequests.push([token1, pool]) + }) + return sumTokens2({ chain: CHAIN, ethBlock, tokensAndOwners: balanceRequests }) +} + +module.exports = { + era: { tvl, } +} From a3f46775c4c20a77a83343bf3bb16ddcd87bc024 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 11 Jul 2023 13:46:15 +0200 Subject: [PATCH 0305/1974] ergopad: on chain now --- projects/ergopad/index.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/projects/ergopad/index.js b/projects/ergopad/index.js index 66aaa261b2d..bf427343285 100644 --- a/projects/ergopad/index.js +++ b/projects/ergopad/index.js @@ -1,16 +1,16 @@ -const utils = require('../helper/utils'); - -async function staking() { - const { data: { 'Total amount staked': totalStaked } } = await utils.fetchURL('https://api.ergopad.io/staking/status/'); - return { - 'ergo:d71693c49a84fbbecd4908c94813b46514b18b67a99952dc1e6e4791556de413': totalStaked * 1e2 - } -} +const { sumTokensExport } = require('../helper/sumTokens') module.exports = { timetravel: false, ergo: { tvl: () => ({}), - staking + staking: sumTokensExport({ + owners: [ + '3eiC8caSy3jiCxCmdsiFNFJ1Ykppmsmff2TEpSsXY1Ha7xbpB923Uv2midKVVkxL3CzGbSS2QURhbHMzP9b9rQUKapP1wpUQYPpH8UebbqVFHJYrSwM3zaNEkBkM9RjjPxHCeHtTnmoun7wzjajrikVFZiWurGTPqNnd1prXnASYh7fd9E2Limc2Zeux4UxjPsLc1i3F9gSjMeSJGZv3SNxrtV14dgPGB9mY1YdziKaaqDVV2Lgq3BJC9eH8a3kqu7kmDygFomy3DiM2hYkippsoAW6bYXL73JMx1tgr462C4d2PE7t83QmNMPzQrD826NZWM2c1kehWB6Y1twd5F9JzEs4Lmd2qJhjQgGg4yyaEG9irTC79pBeGUj98frZv1Aaj6xDmZvM22RtGX5eDBBu2C8GgJw3pUYr3fQuGZj7HKPXFVuk3pSTQRqkWtJvnpc4rfiPYYNpM5wkx6CPenQ39vsdeEi36mDL8Eww6XvyN4cQxzJFcSymATDbQZ1z8yqYSQeeDKF6qCM7ddPr5g5fUzcApepqFrGNg7MqGAs1euvLGHhRk7UoeEpofFfwp3Km5FABdzAsdFR9', + 'BxjSQHD1hqQFUXbXatkn46YUxM6wVsLkT5HNXJe1N1n3dM2c7X8BtgnLqszJuxoRTnzXzrCrmEjPyLxqstcnW7YkQJ9m7QTmhChBYt1hAFcTWiyVMdaiYYFtxr7qfXKcjsadtfusNhS63ZddciC3wogjrfSE3U2Fy9dhrrKStUVzWhTP22ZuwdDPv8F88WVtdLsu24bbHsv2ntXZJGhvdKnvJL83kJWs9XV582sqUBqX7kL2A5qp6T2Jxgt3gLxcZ99JhUG99YtRsmpuwb94TE5KVTESWA6cD8EdReTbP1kwW77rnJyNfj8KUsy1j7AZuNBUsVBc3oLV4GxYFDvaTNEyNBmGY3dEe8k7UKjUSnqCmYH2QM2cmhtPEdT6UBR9sS4h4YFiGsRHiybjuTSaBUPrzhJ12ESKf8jcaNna9rYprzm8ZnfwNEQFtPJyKfCoJjbwkfsAEirsMcyU3VjPAvKJ2mtu7A3WwXViBSfwUgdCnWkEhdPCRPueAXfN38JXG8HjJeZTPi3VtgcnFobg8Zjp1XtRkTaoj6i4BgyfwCft3sCYgBgmNjXhtFuuozpCiAXWyGMMs5rhJL6FzXsJWiTSML96LdshFnhoPRPi8FXVooURKztnqJowFcpLApL2ou2jfeC4iaxKgtd6zDR6ikFVXMsipVHmBrhan9dheUPnfjeXz9WVPmGLmVkrxnVv', + '5ASYVJ2w8tH3bDMmDvjvgX76HQen4rcvoHku32GsL9js8THW6rduV5VDy8Diue6rRQfp4DRTs4P9bd4vjQY9mmE94A473YeANVps31i76HD88Xk3oeuMgWSgAPuTncfYG1hYHvyT9N7RECUYb64Hs8b2kuvUksccZ841k1vYTmhzseiAFEC59PPnfxxJ4EL9MJ6oHSfwwJBYaZHjmH5eCPkXbJZhGwnTb6bFXvCGGucjDXhmiDPSXGUU49U3r8gN2eTnbh5Dz5mh9eSudUGf7N1fWtT3asz1uruMcdYeNFptD2jFNz6MDTqajZjSEw5guvAmvZAYnfiXwRW8yQyqbd5GcwiuiaPybcGThdf5TLhYxrNeTr1eLn7d1A1RGvySo8dz9vHNrzsK4Zd8HGK4ofhE4kwepyNbYWJY9XbfKVZxqtmLTUHwheNwiJ7cQSCcQUFyMZwAKmjuXdPrVZ9AftFc5gkdqdaC82ya8oMhsbHBV68yorJbp4yyXs8qjaegUfEb4TEZ4L9NsTTsKZxfHB2GypBmssJ6gHGEongQWnca3zqSV9A55SGwbvMQrrkrnvAe9UVsK1h6XwzBj41vF2faVp7Sfp5noqJi9jZjobiCTYA344RW6dNpGS2YpxNzrZtxvyVhmyF9Tms7nSTUMpbF4L', + '5ASYVJ2w8tH3bDQx5ZLz6rZUdokD1kmTXSRZ8GfrsAUW4vqy9eg5omtTYVzY22ibHANf7GgSc2E5FiThgo8qXzWpU3RDLohN277hksbAf9yykajXbYPUaXUeMPfSXbS1GdE4y2GoYKaXHR3H57MV5CDZE58YteqWe3XVXzmMvj1192AD7UZ1N6nguRfjgijxEWTrLq2ZrykjRAut2JBGYHanAKn46tYWW3chpxNosXG7ZW2ShDzKju2ttHhfxeZVMBydryuoEya5E9KVagjsfa9E2qPUdLpbh8enppVWcwoQ4GF1ktgzSX32QbfKhfpD23iWQixThUbcCca14FjXDt94GVFPuhAT5tQyiKen863Cq5eRAEgsQ7otX6pWa32Q28sxSF9Az4abwiJKNbFhbhb3cDCs6A45ZnW6aB6AkfwTJSAZ2ZzqqG7LXT4HdxNpdmiwno9sJWxPf2PC4vRhVqBPdxxyCgoodjyutf4UuinSCibhfqdhUJLc1JM8zX9UcD699mChgUZoKE8kXD4soVGSgQD3qfGXC6RP7n8dtowArNLm3H5QJ3EobDCbEgECLHFaHN2BPwwWscAt5eejKeFvkp3CuQ3mqFW7vfQG4n9tTLnshj8cjxnpkBdfFKC83sW8A3AoZAX4K1UrhndfLSFh4w', + ] + }) }, } From 9bd245fcb2e2c5dbf468cb1b3a5894ba6aff2dc7 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 11 Jul 2023 14:20:36 +0200 Subject: [PATCH 0306/1974] track : https://www.sigmao.cc --- projects/sigmao/index.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 projects/sigmao/index.js diff --git a/projects/sigmao/index.js b/projects/sigmao/index.js new file mode 100644 index 00000000000..1dd00d9f736 --- /dev/null +++ b/projects/sigmao/index.js @@ -0,0 +1,12 @@ +const { sumTokensExport } = require('../helper/sumTokens') + +module.exports = { + timetravel: false, + ergo: { + tvl: sumTokensExport({ + owners: [ + '2PnwgiUqPKQyKUNfDShUyoZZA1DLwJyVE7oNri6JrKVWf4DYCiBqqoBYFfokffDVaV9VYahvpDiKBt9x6NVXBkBm4LgE5tM3wC8w2Qhbhh9Ps7scNLGXJZ3tLbZpu1E78ynnrn4MBouTuE7rqTaG6Su8PwkzhBFBaiQgZKqCtQMVDLrN1D6MzAj5MvbpscFEsLTqaWEemPQvxKfx7rW1HgcMSCccWAvzy4pThM7re7Mqxz9Su7ETX2RRmjGksPpHMJxVV5cGM8ijQwNsdakuMWDVLJ7qL1FEaBAbwEih6CdRZMnkYV6sNS3FFrepAa8G1nA21ztiadoQdT9wKx9gfQZJwPe2DJWoeTEp3s2TezdUiZEM67MFa5RiSEtQwkuYzin8nQ7EMWenqmSQkRfhf1QyfwEsWz7cGYHHndBp8Axg29qp1kEzcGBMUA4f8Qivi3JLPrzqKPZH7neTRYmcbYKxSTFkdzBvbKJSVoKcUaUb4QVvpcdNg4TywHELP4B2JRjhaDJFgKQvZT14owh1xuB62VoMGQhoRg8Xub4fJVJUXVSAVLcZ5qhmrc1X6Gwt5a5Nju1t4R6LFERuBYmfreofxpACfsq3oN83cSQCSiNbkRn4YVQzZqGnrHaDbsDgR2wEJbdYfXpfV6YMX525MfCj6t2TXjBzuhyYtBTnQyp7bRQeQ47kfm77gYU6esdCokZj4ic2jxyxnpm6AHxkM2oDLqrvQ8uXCM4oToNEsr8xJWFRmDsUvtu5zs9dm5HGoyXjfjojCXuE2ZMhgweU4v7N21mzGgKepzpJvWARzjtnFFK7wRpCyZvLcgq9Hf4gqdR82Pmiko5azFBYA3T1su3L1u93RxAZTSWEGJ54uoYnbBWr1mT3GDo8iXPjXQ8S5SCwJ5xzASCsvi1DAtS5jmMWp745TJPekGFE7jovG9eoqzYCgoTmjfuFHv6cuMK6TQpFRKqLGPyprmDEGSVZ2TUTzP7JoJZgQxRHrwoAwFRejgJzgVxdxH9LXCuvYvzy4GnNaTJ3eatzhwpHPQjsMdZjBsEbLujgqWV4je5d719sAb5Lqc3Dd6LRFNqR6SRw8cL3XXKiRnEmVBrTokA91CFnjroSgQ3erYBabNTpQF64Nd4BrLxKVt3UEppfXFghaQ8AjBnkjwjkrnCrwt83XtnehwjMGpJksiy9yYKoP281njgfe2S8y6JQziy9peQoSLuUXtLE9Ptz6MmKgn22NonRxMA7Rzqw8Wywsbs9Z7yrpKyzNJJ89Vwyd9aRWBuPLuNEwoLqv54bUsPoiqeyfSK8RaCpE1WhzoCK6Uncrx9pAbysJNZVesMCu5CydDKTJC3MY7ryLe4cL82PxzTjTTrvGPmdtKfro4jpR3nnPFg8FkJ3YktHKzzJjM91fs283hjVJBxuvugQTbd5SdfTro9fd3P3YPSQPzRhEHY63642x8qez4Q2HnhKeKuvhvTNiN6XpvzFMtu5DN268BYwP3V4qc2btLbEWtVG3QLVL363Q4UiBgscq5XV', + ] + }) + }, +} From 6abbcb67a037645609f460c9445a8b7a6b376b28 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 11 Jul 2023 15:16:16 +0200 Subject: [PATCH 0307/1974] fix broken adapters --- projects/fractal-protocol/index.js | 1 + projects/gearbox/events.js | 15 ++++++++++----- projects/logium/index.js | 9 +++++++-- projects/maskex/index.js | 24 ++++++++++++------------ 4 files changed, 30 insertions(+), 19 deletions(-) diff --git a/projects/fractal-protocol/index.js b/projects/fractal-protocol/index.js index e3fb14c1ae8..370f575696b 100644 --- a/projects/fractal-protocol/index.js +++ b/projects/fractal-protocol/index.js @@ -55,6 +55,7 @@ const abis = { async function getLoanDebt(loans, api) { const loanDebts = await api.multiCall({ abi: abis.getDebt, calls: loans }) loanDebts.map((loanDebt) => api.add(USDC_ETH, loanDebt.principalDebtAmount, { skipChain: true })) + return api.getBalances() } const getEthTvl = async (_, ethBlock, __, { api }) => { diff --git a/projects/gearbox/events.js b/projects/gearbox/events.js index 04c7df166cc..08d505fd9fa 100644 --- a/projects/gearbox/events.js +++ b/projects/gearbox/events.js @@ -1,9 +1,14 @@ const { api, api2 } = require("@defillama/sdk"); -const { providers } = require("@defillama/sdk/build/general"); const { Contract, BigNumber } = require("ethers"); +const sdk = require('@defillama/sdk') const abi = require("./abi.json"); +function getProvider(network) { + const chainApi = new sdk.ChainApi(network) + return chainApi.provider +} + const getV2CAs = async (creditManager, block) => { const eventsByDate = []; const accounts = new Set(); @@ -11,7 +16,7 @@ const getV2CAs = async (creditManager, block) => { const cm = new Contract( creditManager, abi["creditManagerV2"], - providers["ethereum"] + getProvider("ethereum") ); const creditFacade = await cm.creditFacade(); @@ -31,7 +36,7 @@ const getV2CAs = async (creditManager, block) => { const cc = new Contract( cca, abi["creditConfiguratorV2"], - providers["ethereum"] + getProvider("ethereum") ); const cfs = ( @@ -60,7 +65,7 @@ const getV2CAs = async (creditManager, block) => { const logs = []; for (let cfAddr of cfAddrs) { - const cf = new Contract(cfAddr, abi["filtersV2"], providers["ethereum"]); + const cf = new Contract(cfAddr, abi["filtersV2"], getProvider("ethereum")) const topics = { OpenCreditAccount: cf.interface.getEventTopic("OpenCreditAccount"), @@ -159,7 +164,7 @@ const getV1CAs = async (creditManager, block) => { const cm = new Contract( creditManager, abi["filtersV1"], - providers["ethereum"] + getProvider("ethereum") ); const cf = await cm.creditFilter(); diff --git a/projects/logium/index.js b/projects/logium/index.js index 891b7d9a166..de8afe83216 100644 --- a/projects/logium/index.js +++ b/projects/logium/index.js @@ -2,7 +2,7 @@ const ADDRESSES = require('../helper/coreAssets.json') const { getBlock } = require('../helper/http') -const { providers } = require('@defillama/sdk/build/general'); +const sdk = require('@defillama/sdk') const { Contract } = require('ethers') const { sumTokens2 } = require('../helper/unwrapLPs') const USDC = ADDRESSES.ethereum.USDC @@ -11,9 +11,14 @@ const ONE_DAY = 24 * 60 * 60 const usdcABI = 'event Transfer(address indexed from, address indexed to, uint256 value)' +function getProvider(network) { + const chainApi = new sdk.ChainApi(network) + return chainApi.provider +} + async function tvl(ts, block) { const fromBlock = await getBlock(ts - (31 * ONE_DAY), 'ethereum', {}, false) //33 days ago - const usdcContract = new Contract(USDC, [usdcABI], providers.ethereum) + const usdcContract = new Contract(USDC, [usdcABI], getProvider('ethereum')) const eventFilter = usdcContract.filters.Transfer(LOGIUM_CORE); const events = await usdcContract.queryFilter(eventFilter, fromBlock, block); const owners = [LOGIUM_CORE] diff --git a/projects/maskex/index.js b/projects/maskex/index.js index fe9b6f6268f..c8de7c1a07b 100644 --- a/projects/maskex/index.js +++ b/projects/maskex/index.js @@ -47,25 +47,25 @@ const config = { }, tron: { owners: [ - 'TArBsHHp4zz1TWgHhZWvNcxD4A7DMbcoMm', + // 'TArBsHHp4zz1TWgHhZWvNcxD4A7DMbcoMm', 'TAv486fty6xRuWHQfhBiMh4jBofSuXJcpV', - 'TBqiQviC27UdWU58qbviJKJwp9b3DygLpY', + // 'TBqiQviC27UdWU58qbviJKJwp9b3DygLpY', 'TDQ7nxDTJBMZkkWcFZKs9KdWzb2vT2drDu', 'TKCbzA6HPnwEDL9M2tAWnqsbD6TXLUD7yy', - 'TLHuz1191oCESWJH6sAq9MS5w66HtHVbyc', + // 'TLHuz1191oCESWJH6sAq9MS5w66HtHVbyc', 'TLqPRfPHieHsMMFaQSMXoXqWD18C97cFqB', - 'TNoQvaDoPHcdoux2Ymt3yUnsSGJgLSXygo', + // 'TNoQvaDoPHcdoux2Ymt3yUnsSGJgLSXygo', 'TSFvf8LZuwy4BKNPdULFD5vaCFMrkiGRme', - 'TTNeMfGyAL1Bb8vw32U8hxJ5Vmju5tsQ8y', - 'TUTh7mS9o2EPgxLbx2bNSwwyoPCsLUmkNq', - 'TUXjobUdiUPvSZmbBVWTcSEqoXzFNr4ZDa', - 'TUrk8EeZgKCQkfd1KhAfRMBmH1Y4NYnaaL', + // 'TTNeMfGyAL1Bb8vw32U8hxJ5Vmju5tsQ8y', + // 'TUTh7mS9o2EPgxLbx2bNSwwyoPCsLUmkNq', + // 'TUXjobUdiUPvSZmbBVWTcSEqoXzFNr4ZDa', + // 'TUrk8EeZgKCQkfd1KhAfRMBmH1Y4NYnaaL', 'TW6DLBY5dyCUVzc3sgKV72HXNT8EkmEUT8', - 'TX39NXuXviJ1be8y1XkbnQ4DfFmp9gRhez', + // 'TX39NXuXviJ1be8y1XkbnQ4DfFmp9gRhez', 'TXiZ9ddXTBUke9PDs5HLXVvvHY68kmC3me', - 'TYp46EYRTHb2grSfjkDFFtakcgedXBHEhh', - 'TYshj25EXjnPB7P5xRGLmFTNPV6HMoZyrq', - 'TUiATx1SGs3TwwKY1atafMvYjrQD8KLiSk', + // 'TYp46EYRTHb2grSfjkDFFtakcgedXBHEhh', + // 'TYshj25EXjnPB7P5xRGLmFTNPV6HMoZyrq', + // 'TUiATx1SGs3TwwKY1atafMvYjrQD8KLiSk', ] }, bitcoin: { From a7a212f3db41e3284e02660c97600b5e097965ed Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 11 Jul 2023 15:21:59 +0200 Subject: [PATCH 0308/1974] update sigmao --- projects/sigmao/index.js | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/projects/sigmao/index.js b/projects/sigmao/index.js index 1dd00d9f736..01cf185e772 100644 --- a/projects/sigmao/index.js +++ b/projects/sigmao/index.js @@ -5,7 +5,29 @@ module.exports = { ergo: { tvl: sumTokensExport({ owners: [ - '2PnwgiUqPKQyKUNfDShUyoZZA1DLwJyVE7oNri6JrKVWf4DYCiBqqoBYFfokffDVaV9VYahvpDiKBt9x6NVXBkBm4LgE5tM3wC8w2Qhbhh9Ps7scNLGXJZ3tLbZpu1E78ynnrn4MBouTuE7rqTaG6Su8PwkzhBFBaiQgZKqCtQMVDLrN1D6MzAj5MvbpscFEsLTqaWEemPQvxKfx7rW1HgcMSCccWAvzy4pThM7re7Mqxz9Su7ETX2RRmjGksPpHMJxVV5cGM8ijQwNsdakuMWDVLJ7qL1FEaBAbwEih6CdRZMnkYV6sNS3FFrepAa8G1nA21ztiadoQdT9wKx9gfQZJwPe2DJWoeTEp3s2TezdUiZEM67MFa5RiSEtQwkuYzin8nQ7EMWenqmSQkRfhf1QyfwEsWz7cGYHHndBp8Axg29qp1kEzcGBMUA4f8Qivi3JLPrzqKPZH7neTRYmcbYKxSTFkdzBvbKJSVoKcUaUb4QVvpcdNg4TywHELP4B2JRjhaDJFgKQvZT14owh1xuB62VoMGQhoRg8Xub4fJVJUXVSAVLcZ5qhmrc1X6Gwt5a5Nju1t4R6LFERuBYmfreofxpACfsq3oN83cSQCSiNbkRn4YVQzZqGnrHaDbsDgR2wEJbdYfXpfV6YMX525MfCj6t2TXjBzuhyYtBTnQyp7bRQeQ47kfm77gYU6esdCokZj4ic2jxyxnpm6AHxkM2oDLqrvQ8uXCM4oToNEsr8xJWFRmDsUvtu5zs9dm5HGoyXjfjojCXuE2ZMhgweU4v7N21mzGgKepzpJvWARzjtnFFK7wRpCyZvLcgq9Hf4gqdR82Pmiko5azFBYA3T1su3L1u93RxAZTSWEGJ54uoYnbBWr1mT3GDo8iXPjXQ8S5SCwJ5xzASCsvi1DAtS5jmMWp745TJPekGFE7jovG9eoqzYCgoTmjfuFHv6cuMK6TQpFRKqLGPyprmDEGSVZ2TUTzP7JoJZgQxRHrwoAwFRejgJzgVxdxH9LXCuvYvzy4GnNaTJ3eatzhwpHPQjsMdZjBsEbLujgqWV4je5d719sAb5Lqc3Dd6LRFNqR6SRw8cL3XXKiRnEmVBrTokA91CFnjroSgQ3erYBabNTpQF64Nd4BrLxKVt3UEppfXFghaQ8AjBnkjwjkrnCrwt83XtnehwjMGpJksiy9yYKoP281njgfe2S8y6JQziy9peQoSLuUXtLE9Ptz6MmKgn22NonRxMA7Rzqw8Wywsbs9Z7yrpKyzNJJ89Vwyd9aRWBuPLuNEwoLqv54bUsPoiqeyfSK8RaCpE1WhzoCK6Uncrx9pAbysJNZVesMCu5CydDKTJC3MY7ryLe4cL82PxzTjTTrvGPmdtKfro4jpR3nnPFg8FkJ3YktHKzzJjM91fs283hjVJBxuvugQTbd5SdfTro9fd3P3YPSQPzRhEHY63642x8qez4Q2HnhKeKuvhvTNiN6XpvzFMtu5DN268BYwP3V4qc2btLbEWtVG3QLVL363Q4UiBgscq5XV', + "2PnwgiUqPKQyKUNfDShUyoZZA1DLwJyVE7oNri6JrKVWf4DYCiBqqoBYFfokffDVaV9VYahvpDiKBt9x6NVXBkBm4LgE5tM3wC8w2Qhbhh9Ps7scNLGXJZ3tLbZpu1E78ynnrn4MBouTuE7rqTaG6Su8PwkzhBFBaiQgZKqCtQMVDLrN1D6MzAj5MvbpscFEsLTqaWEemPQvxKfx7rW1HgcMSCccWAvzy4pThM7re7Mqxz9Su7ETX2RRmjGksPpHMJxVV5cGM8ijQwNsdakuMWDVLJ7qL1FEaBAbwEih6CdRZMnkYV6sNS3FFrepAa8G1nA21ztiadoQdT9wKx9gfQZJwPe2DJWoeTEp3s2TezdUiZEM67MFa5RiSEtQwkuYzin8nQ7EMWenqmSQkRfhf1QyfwEsWz7cGYHHndBp8Axg29qp1kEzcGBMUA4f8Qivi3JLPrzqKPZH7neTRYmcbYKxSTFkdzBvbKJSVoKcUaUb4QVvpcdNg4TywHELP4B2JRjhaDJFgKQvZT14owh1xuB62VoMGQhoRg8Xub4fJVJUXVSAVLcZ5qhmrc1X6Gwt5a5Nju1t4R6LFERuBYmfreofxpACfsq3oN83cSQCSiNbkRn4YVQzZqGnrHaDbsDgR2wEJbdYfXpfV6YMX525MfCj6t2TXjBzuhyYtBTnQyp7bRQeQ47kfm77gYU6esdCokZj4ic2jxyxnpm6AHxkM2oDLqrvQ8uXCM4oToNEsr8xJWFRmDsUvtu5zs9dm5HGoyXjfjojCXuE2ZMhgweU4v7N21mzGgKepzpJvWARzjtnFFK7wRpCyZvLcgq9Hf4gqdR82Pmiko5azFBYA3T1su3L1u93RxAZTSWEGJ54uoYnbBWr1mT3GDo8iXPjXQ8S5SCwJ5xzASCsvi1DAtS5jmMWp745TJPekGFE7jovG9eoqzYCgoTmjfuFHv6cuMK6TQpFRKqLGPyprmDEGSVZ2TUTzP7JoJZgQxRHrwoAwFRejgJzgVxdxH9LXCuvYvzy4GnNaTJ3eatzhwpHPQjsMdZjBsEbLujgqWV4je5d719sAb5Lqc3Dd6LRFNqR6SRw8cL3XXKiRnEmVBrTokA91CFnjroSgQ3erYBabNTpQF64Nd4BrLxKVt3UEppfXFghaQ8AjBnkjwjkrnCrwt83XtnehwjMGpJksiy9yYKoP281njgfe2S8y6JQziy9peQoSLuUXtLE9Ptz6MmKgn22NonRxMA7Rzqw8Wywsbs9Z7yrpKyzNJJ89Vwyd9aRWBuPLuNEwoLqv54bUsPoiqeyfSK8RaCpE1WhzoCK6Uncrx9pAbysJNZVesMCu5CydDKTJC3MY7ryLe4cL82PxzTjTTrvGPmdtKfro4jpR3nnPFg8FkJ3YktHKzzJjM91fs283hjVJBxuvugQTbd5SdfTro9fd3P3YPSQPzRhEHY63642x8qez4Q2HnhKeKuvhvTNiN6XpvzFMtu5DN268BYwP3V4qc2btLbEWtVG3QLVL363Q4UiBgscq5XV", + "2k6W1ZcLsgRi4qtmdmFKEXGL6c5Av34BGEeRrEVAZ3jeKzmdAX37YEmd3bDCz9sZkf7tP6Pvz6qWcXnWGxvrrBwPqrJvCgubAD4Tn5WipkY5YXz8yjNCzEPaFmwZm6iMqtFsrjhWc9QE91ZYoWzAPU8fmf8uZxuJn37W9wHAV5Qxs96VWiJ1rjo7AiWX7SavEZC3nCBeDKpSnjgsoaq5qEkhYWDYR4woDT6B7ui8o38ZuHS3jDx88YHaMEqKWLHJYmRszJFMM2x1keJgHX3syPXgVfkinmMC8wVACDgQkaALBodq6fcVsF2Hs82XvmaMu4fDkA9uLG9cgw86AWCNWaMhcGp678UPNCeT9hsd31nPaUETxhgyibmonHpJk5if5QPyn3p45rYn3i71Y1Wgq3uvMCwuC682K8vCzc8DVHCDZDQgnBYbbQNypEWAadSWv6iVZU78mjwZ", + "7uQ7MoQgMkyP9RxB7cfAAtZFWUtuWGEWzskvUq4ZxEvh4nDruTmrRQejoBbVmZXirMTmG8Yxk3p7HPQwzziugxxXrQhgXP62k6jrz28xXVz1bNJfACUstvozRNBzcB5MuX2RYMoE", + "V9BoRZ3WH5ph9FY7MfrNc6cNtPdd6PNA7EWZVkHCDiuxwrcore2gCWbGcZWQxpwkqQK5rp78KPSSD1DLV8nqv4RnuN4Q7oaknZxYEN2LbVDcZHNffxSJ1sEVsqDMe418qyzYoaSvTBGZ3e6UkEWVvCb3vzQATAcv7zAEP3dzs7kZEB9prJChfn4mjUNGpdeeh8KwsrxMdS5m2a7TmkkWJ6SH4KCJpVaQikKqUYk2wMKgH3yBLL6h1ZnPtdptL7F6YRkfU74UFxubsFb5ZrkmWV1ynjJ1orz7c8Nzdh44tqCX1VUdFWwqUwH5wXggawXPNwSCR8qLQawkrhAdR7kRBEMGTWMXvwdtXbtQGpiC8VXWbYS77d7L82CYBwqwZk1eYatASrNrzyc7LXpjKZ3JzAibeDJiKSpQzH79QT1F84zvF3pFYR9XTmYMRcNSS3a8qupqyRG1JawzF4FUnnQpsyhTmQYnfQGiG5ob9ymQyBHdj4fE3787VzQRhoJQQtztBhvQye992odAQyJZbdfgF4KetoCPK6t9XTHfKxGtse1yk7MZGUQC4WMF4dyhJnaRcfrJupn4Y5UcqYhMN9vmCUe8BvypkqPUsUW834Q", + "3i4iuEoB17WB96toihTpjxoGeMFs7y9oMkvB5GnAkS8mPpPNbJuyHNAZBaDqURaurt93CwV532VNXe1sQmCGXySDGLmsx8WQXP7yNdK1L5cz3yLfxZkMUKddYejNnyV53CfHs8QVyRLUjCXwZB3g27UxwsirTNvhuWC4F2ACMwvqSgpVuDjpSEb3sgBqjFG1tpJHxHiyss5GyriA2X54Nip35ANWQJ9KXfXRj1ogjoNUNFQVtotPkfA9LdCoF9ZCuT94UpgXw1kj6Ndp1Y3Rvmy4crrxBt2J9PcwiGvq1WNH5PdVyUJCgYpwhHELbZTBABbhmcj92mp3cbBHqF6qHqvG4ZjoVMLvT5CXKkx2u8psshcqTdEqpe2D3QH6CJNAwANv2iY3kaVct2jhjNqNoY7S8RMT18ZCZQo9RJQX26QFyEBwkoAsxAFCLAqVRRosrUUTWkUUfzaVYzMZJ8gsQLAjbD4WcChktk6B5ju3f5WG4YX2C3wjGkFBsvzMcMwZt8ZfiRpdKp7ooJryVBPp8sf4aZEm8GjorjzV58xMzUa2crRLDd3rg3FTAvPzGWKpaaAAbTRyePEy1Vm5B44t32x3Rv2mR9jbCcxfQDAHAXNJSgVFNDaUCUk2p2QqraQNUFY98sg7Q9PDQhbMPafyBpyS2AvPLQgP4JvfB67TzAVwS121FNjdfczHSETJMEf8q7gXXhDu2zuXhVwS4tcWNabS9rJ2hnL7zubi3TsKN2LLboHs8KNkcoGLY1rcfgmhoovF92nK3p5ZP1hE2YyZDwUyH88WydUJiKW4R7GEzqZ88bPfH3NArzenoRQAfWcsbbzBTbMJvfBeRwv57RYUciWqNe2nrAom6GoyFi1RuHfJb3W4Y8d6Ez4Fn17Guhtu7aMBa7uaWaHKuv58wAf8wQgv6vpvETEhPJvSGTaXY4dpbKyGhqSiPSqPNJsLjWMyMWqT9ceQAjhMpitxq7e2TuHCGYzQdvtJbgN2UfyX14r2BEkbzE6xxEQunF3eugXwoG22ymgeFw2qMURmuREV7QThf96o2sQ396tUBJNuMvnbCBRB4XK6wAfiN5xUh3CFwajw5yhtikhjc2o2Uj6yZTPpFcGGqaWbCEBc3zqVQZivXJSp1QcF3eGXqKKJKyoPc4g4uxrk448a1Aa4PugVWqmUsnKyfuh1vd3L6TYNVhmxbnMbkSAm2i31fgMaJTSnodTZ1QcPtvWngZtbwEHEmbAkXppoe9cT9zq42dHAfskPZ4MPysaGbqEKPJcUmNwP4SSa1CtgVShHrtL6Z4CsZJCNjatZXNhSczPE9WDewUZ22jnUaYFQd4ULuJFS5zfU2iBTRvxR83q6xU8NNiWTH2VvquPg2gBJMZS7bRL4AD71Hsq29r3UxNHGDQHDo7YouA7mKUdyLp2BhaZHrbNdbK22T9Y1e6U1D9Y2GGpcX2gu2zEKRe3eLZAiCqC942BoYJob147SoDPmrJcJ1pngJVVg8ECzA3aq8XNWuT3VPbWnyhNAaqqMLYC3RHw7ch7SnUzctq6GVbcEcA11YgvrwVYjnPFLxd9d4MisfARjN", + "4tQGGLNJFJ2pSiGpQZZRxamsS2moL5vEZ2Y35pnqyjXNVdoRQgTNwcwZN2wKpHt1DAndD6pkBeuZbCEKC4khRKxFd9KEJvpEesmZUvQ2RMXTTeXXioMMonSbGHouMX5Ng6GixyNfyHWXrDUJEmbNqgcGsMxUKaab4fCgQt95GU1dgJ9XFVchpbJ62m3R9ZEEWrUPCBM5MmC57xV7uKhdJkJdw74QU6pAMeFxgru3CSTWznFm62zMx3GKeMQsVMLVuJrDkUe5jDQ8Ru5uwZSc5pqdMTPQVDMP3GKxr5g5ghBj229zLJFZZcMjVE1amzioJqeLVFLFmw7bN739P39oPBnmoccJXn7YZzx1tEtkzxCwSv8z7Nson6UEt98emWremVCAYbWpHqqiaUnZzSckLENiAnq4MBdSht7xhRf3NjCRLQEsm9RaGs1hUHVXaynNXJt4uoYddFhZPZC3ZqftdtxUNgwBqAdMQPNaEantUL1Q5qum5iW8oiPJFj7yp4dbt5xBab3ot5eb5yGSkR4LtENHJ4x36gheFmRNx51bxYt5cbzPZLrRNyFLRFaABxKmTT9FHAkgZVb1zNKgnviw2nzreC5Gspqsa2L3tRFGdHQCcEYE2QpkUw3ntTfUfPx4sTkYgimMJ23W2t7wWdb7Q9mT1cyRSD5GzDuvXwKHbKvedVgZSvvLVPUgfK7YyHhTPcv2LyZCho1j6NUcXY525FhbfdquMFmcR6JedSRv8hpWHYJ7QcfWG2StoaM5CjzqGzMWtNXJ6hrmK526jzWzBaDVETaN4afb9k6CspQL3zfkpY3Wu7Dhv8APN7nAH2y4b7vZ3DShvQjNBAipXKnim1b5JQaxGJCFPL8FGXXDnJUx5NPZrh4TgDAzBA7c3erqYHBa2Q44pUoZLBnQBzjEsDAQvfaW7AjX5p7HBZoa2aVVf8QpsBkxwqTxs5QQ6q8An9PYXagocKWMaX7zbvjvXrAQ3RLMPgDQtM1LkiSvL9fQVKaBXcnzwUhiPB5S7UNNdBfBdRa9o2rG9Q1EDZkdqZpQgShkHchN93S4BMVFzJa2e3tbCqyyMRTYeZ3Yi24k3EVSp9hYspKjW37ghPajqLnwrXHowM9dm7JUi2g8nnGowTPsu7TuPaEZfFsCkPUwVyHqntArHwdy24tLHuogD2FYxYNMSS4psT3TJxZJWSCvjmYxpsB1pm24rSEmjcRnbLGwC6J42qE8ceKeY3pLHJS9yEYvBkNjWkw8QjT7hejABFMA9QYoir7fAdEDq6feVUvRVgVNKis9Th1L8AGVSDVPJdSwE1p5NGenH2x1giKsDQVfNeQ9FbaZsQFS1d3CUc3fcSahov1nBnMYWr5HwqeeCotCbL3HT1zjfpZmsYA5hyGjthTur8dMKvy7vQoKjK1RoZW11fQr6FmGsFUa2rAj3wdrMfXHbMdU5hPNN6hjDFknmeGNGzXDfRLUWrUptaiU5bQKhkzSH3vyG7CyjCuQo3hpJGbmSmvdV6px4C3jFLfYDhYTT2zieos3yadm12fpB1Nxt15KWXv69EsJCHba4sng1Expk8TgeNp6s6TzerpsxSCu5Ccc6a6L9phLeVqCQ2QqVWqv8Ve3fW9N8JD3bRY5rrvS9MA9j", + "4tQGGLNJFJ2pSiGpQZZRxamsS2moL5vEZ2Y35pnqyjXNVdoRQgTNwcwZN2wKpHt1DAndD6pkBeuZbCEKC4khRKxFd9KEJvpEesmZUvQ2RMXTTeXXioMMonSbGHouMX5Ng6GixyNfyHWXrDUJEmbNqgcGsMxUKaab4fCgQt95GU1dgJ9XFVchpbJ62m3R9ZEEWrUPCBM5MmC57xV7uKhdJkJdw74QU6pAMeFxgru3CSTWznFm62zMx3GKeMQsVMLVuJrDkUe5jDQ8Ru5uwafpAmWPbXWv7XFV6Yx1pFJUg3q1Y5Cxi4TvYU5z6yhupeXQZgccL253TQKbFupXLzqSJ8J85QNAM3hFCg4xvVTMsdM5ovVsvSXLNXvM2VX12BR5otuJwfJVBAfYdYwPSecEbeGjoCecPS1SCw4S5rErEE8RcTEG9zn8Gpt1aKyT8qhwvvapksxcfGG5d9wCg8k3La87LW1DT5djS6nMZ9XH5zMUPuxHnMsoEj2UhQYBHyX3nuX3u8qmFb2JVgTUZqbYfu1SGHe6FTsQcTgm9e6zt8KFxzrMAk1QSHhC4FD6jS65cyWhwLVPyF2miB8KeoGLCoUdc26vhen7uDiwyz8gZZMaWcSKrVWsS45xK6vi1BNA5LrLYRE6YM8X69jXkcLdZHUgkph1Z9gjr3tCzYXXrPvUsHBLZhkaUTXzNkcnPj4LFTHLS2NGnxUcnvRDjk5eZ6mj7dDtux3HWqzf8bmdd25e4qALwRXDdmoPRw6L6MMvojHAJndjW4LEPmk3Stkffo1EHAvrDBPcmuhkzJ6tq4Lc355AykviKo7daJgN7aAwBW5r7p21RcHwuth6po9eUsp8nwJhrBDHv9CenPAtpjUTE2twL8YavVFbcDigGqQMcCa4puKsGyCmF2bfbgzSWw7R4gh2i4eb9NmaJXqSceYiqv39HDbVuaQhzhitfXXG9E15sCf7MK95F7zfmepD1uLzUbErGZGWDtDbNnVNA3QR66QkwivhHXQh6Ce1ERp3xAa7V5hNa4HnKZJLgGqNC6fCvLphUp7ZaKX883bSyTUn6VSAL414ss6oxejQT1C2CFrYceSecF8RhLSDBUeqiusYuwPgNrNyn7jyRxs2KuoiJQZpftnvF6rpg5fs5MyzkhG7hG6RwvfMG2D6BxDobHYumQq8ZHGZ9RYeiKZQuScAYsNF7JmondyYXSW97ciyCSGLskSdGxHq6auJzc5SE8bq8tjJUPpgKhqfbew8Ry93oWgSkzUnDjS2Na2UG6mf1RqZcVphH6LWrpvdtJEQXxYcoN8w4ogTMhm8iM5WEXDL4H49iBKpHkqcntyKx7sEGt8xqif4bbgBkpPvFDAz4z6aqTASnjgKdmmBQfbj1cAJTPNtZbnyQBghjohqEyHgnZ3NA5qm1Ax289QHtsiTLvB7c4HhdqRQ5reV3APRxg3Tq9fENvZB9UAeHoc68QkuPqEnFCtK29i94zAVrJiMu6zX1p9NprPf5a1Q3MYspfMicf4zJfeJtZj3Qo4jbnVUkjrtDwuY8Mjaaari32ipiqXFeATYvt7w9J3hky98aK7VZh4v7EdAmMzckYyjxZMhejr3gTj8H1g9nx22R3AzZaAXkZLdvSXArKKhB", + "9YRY2j5TBZrc5T8aJWNMmxmPWyA8JMCRvtTQmpz7QJSJKED1fnjgt2FLEf5tgHZAKtZZvprxZdLx91q4zDYbZ9GCAd8DNmoAJe4fpEU89HMWa7NdQTuisS8vKGN6HuBj73rjzCfUuA6xupEq5ihPSC1a9f7w3GayayDtDJvK9wjdpf8tV18893kPW3sbZAzs6fbvZZhMpaA8EmVg7n1UemRDAv1jxgGs6vHpPb3FUk59Lpa6r41Fp3ycwiGMy53bVUT4V36bFXV9sJyE4dCnyjK4Aik8LVc3u5jymVH1boSC31q6m3PMNsUiWxq8N91m4NXnDZiic5jT8iGou1g9FodbTN5ntExFr4s1rHnJ2FbrSqxPbZnvZFekSBJVFDFXYbGnwpkoEEk4h9RZLHGrUgYqp6sCEWoiUddKyrxgN8fjUZx1aEEV6N5kgrarJpfpUQr8YCreCJH6cxfgSeGxrHKMKK1xdfyhGfHgfgo2XKWmGPySFuSTJDkNAJZ9C5KS3RKCMuFvn2zREw1T26hNQXpwMADnMF3SBqHrqhdzxdaaPBkUXncoFnbVKYTxo4x2WeTCx4Pp7ZeWkWBpGaoAiMwRenqcK9GbXy89Ff3DF9UGunGsGMzch4qwicWviFrqcUhw87CZu9jhEEj7Akw6A6p8JwqEEkM4qFpHCpn3DApvViDpLZoCNGF23uh9ydy2Sa7v71ohFBSojDv6dQexKY9J8UwxuLm6FjLm1XwBwX7Dq678zdKdTHkxekwx2ec1x5Sd48NrVNHSoVNbA4ZQvbh66R6B68S14HE1oDn5yAS39wQxPpe8y2qg25wa4nFKPJRo7LXa9adP7sCyQvrp26PhMp8E5b1VCYNfSu1dBDxEU33JVKyaKB1rU8bQk798wLRtqnGo5Bg3MXVdSmoM6zGrDuzYfmCmKj78yTP59EHLEd9P64hLVB7igtSZWaBipkadxAFUFSvoaNCgG4T7p7wYSXjCPcKnL5BPaEwvdovd9VjpoaahSEac3QRaDFtfduym4GC6ACXW9bs8zYRygGf3hEkyLMwHfEpHJTP6U4cVka8tPDpmZq2L7aBkSYph64SctB8yKe3HuQEQJnUwtuEry3ysbAaS12CQZj7xgGyCqhVQc4Eqe1Dvk7bBmKbxD9ABcMypiMUpciEg4xAutR64TJBbrbvQ5R4JuX6a3oc68WExV8YM8MufyeTyGhn6NBCCttzRJS3FRJjhyrjDDx8C4i7Xcmz1b6SDTiM9MrzffCExDxKabhUucTkxoA5sA6P8aqyw7yGBLZ1aAbULL6vasLqrihF1agY6SSthh9cjjyidZBytvZ5k9v1CsunKBoc4G742RQUzERXhpyikiPEqqRE6tY5oTGaAdaTihTLG54iRkYZgwMen83sXLTUzjSYA4q8A666nVaTHLafdHs7BdgqtrK651ntW7BC8Vm6sSWs2GnyfsPQxWQYhnFGX5ZTaWMnPuSGviXr3xcXRknqcvaGZDW4BuUgzDSdug5npopJw6FLbGKTyXZDsQDKgHTHKr7iegEPazg53RxKBsqiAivNiqz9dBNFwrSwu8eVMkL7thQy4zCgnhY1gxAbasMPMqcNDDWPq7tvS4LR5GTMrxzzzZiszXnSfnJrF8nSrK", + "2wF8sNAVsk5NkVqW2tt34Q6HgnHMX8b3v2TWAsHfkFGHF5ep16ZUU8vTnKdiunuoQEvHJCtXuok1LL77t5izFHkRzF8YVNPYEvT2efNJDKdj4YAxRH3F92XMh8VqFGyikYopcd5rvCcnciHW21fhnEGUdZcvSfjtyCWbywgZc95y7vm6GvTXTxNdaDKJNinkzNiTvbqnzyRFDSWaALpmTGAkaXtaTKVyQrgwieBV6W5xbW23FT1ibjirjLBoEWaKfK9NfQMDDzjYDu82PvRXBFdE8Sxosv5LnwGVXVtAVmrEbgLtb9zXsy8BKjhhUbmZmjjjqcDSKbmQ1R3E4oX7dAnb6wwPHSJQtKUW47KPV8pDAwP89hVTik57VEAJ1Tp2ssUN7CVZc1HhUYrmuoFCfrWPPwoYhCXR8NEUzjvVaZc2JmofKo4huZFTyD4YV1JnUiaAtwMUkBGZdJpQbrMqtUUww5H4p5VtDir8di9tAxBBewkimAc1YeraJUpCbWsb1MJWwk97bkZo9XiMUX2uucVMjq8EnMWcmfcihxRp2omZ4KPLfYMsQaDu8hDc5JL6mdtcPKAyFKV5LW2ALcdbNoqyPEV7AanwnP5SL81PSX6L7PTcCCrkyBcmTp2Vix7DpxVerZpbpxxWsAhGQPu6BnwSioNJDXUNGyMKZKuLnMu3nBqYeSkWf2XUaouTb8N5UE53iAw81gCvHyHjyqUcNhAGW3CCQG7VfQSwVuwqtZyg94kjcS6nuNvtBBottQZi63XbiicmeFPZJNdBUxXpEiTjQmBdTdYmNbL8mDH9XMo7DpRnPGdAYwnUXpreXxAxnAX6yvAbMVCeK5dsx65Cw2jJyeGbKCQ47bjmMPLtsgzvoXqBnHwBNu6eWuEW9q3shTqeyGsgAjxtxA7JLpkGVE5EyVSPuiAqMnsThNXeopshL2sd5a3HS6De4VXtXQLeiUvLYPTpqipiD59obempFrj8DsTWu5oP2LkCGzHErtfSyp8GvVRbg3fm4HGiSbP8DEr3CPGRKgTWkedVGQ3wT5R6ULUsVTXjZXCv7V8McZhCxH1skeJHqEt2u1jbtWmaS9KH4n5J1rp59GFeqZaLSbrsRoXVa495yppeSG2ga52iJcE96ZUTuHVMLTVmTZ9fVnT1JJdbkeRQcTxXNQQnMADBPNgSfbT7cL6JkkrAiRgtA74rUajW2WYFuSEm6bgtfKTmUk8VgADHEQsPhpJ9egibddASoezYw1PuWWWeq4Qp2QcwbwgWbiMRZPyga4eezzZVZP3f1X8kCXWxJapqTBvZtogDfWnoHKKe3kX3yG6ntUZ2BJ9DTj5ZUUwdZP6vrk3C1KTJoMMuXxhVTwGsDoLADx4qGw8aPpdobKBMEfWHjSu5yNbZoffBDvrcsQsxMAC9vbeMmqSYBxvGvqLQNfV5oU3ZHS6uB8ys6ESSGUxS9HLrSMEZrHmwWeYX7XRSE6gYmemWBnWB3wfjSiMk62n6nnhTweEQhj6pAUWGoqdsVCfAyzZ6C9x1JETc2YbGGQJET8kisX6rzqfx4APm786vSK7wyK7xCEMe1JZrdtpTv7xXwxAn3R9NcvJZAyi6Ms5BJYPpEt5bXMn4fYHZD7JrJRHuQiBctnpARmv6PLB9", + "DfVFCdP3wxHvs1T6zV3UaL1RWXGbVUouKbBja63RCjur5imaiNUSPWh4DJUzkQ74FK9exj66xjtRYwtYtndzyJZWvbAPjML1znXQZ8S3hVTNBfHXmyZvCpK3oSdproRWHQBHYtPsxDqtFoqdwLPqo7B2fpjUxoPksRpimGzqWUkQpPb79NW6B8H9qr7ktmfpy864YgMDcXZAQPoTVZRPsozRaB7UJ3xbgVmFfGfkivF9Zm6FCWHe76M9rjFGoZjZbEZWSv1pyn2XhGMZhQYPYysMToaEKrgXZwnvkejzWdt2jk7PYbzCeVGQ3vaTrgvZWfMuMxwTiFiRKxb55gkNbcSnojSDzk91mA55CV42K6HtijTjn4JukcwafcfsM26N6eD8s9a5wDhtVFNy6XSU54nvkWo4AcSijRL8hHwAHS2LyhgjDmExQc384TtXhjjmKUqBKumJw77gFX7H7vitSPpSejHLJ7AaNtoZEaVhPEVUnSgTLizkfCEZkSsAufXpRVgHNWtyFRwSqraDfUBkuTgDBYE17N9efhNA5tHAQDKBkFxofR4cQL9veBMPCJSSAPieoXjo5a8J1NXZuyAiub53J2J8g8FBkHtesNZRuEzLQYUtDmDfXhjBSxDV8GDa4eVgbX2FyPddAfen79vXUKWDEzAVnDkHezvmmJSd24in5vYCuhPDhBXvBcXt4NL6MmH5gHcUWzWEcj9pXvs5E2tuFhPJGbyVGqJkqVcAMX6dTA2Y5Y25CHPU9W4SVo7d78avDa1G23nGhGzf59BBQPJiDeCs7Mo5qS7PX6RFFeKtwEnzvhh4vmzbXNcSpE9wvpZyaPaiscmjurti9djNMd74zecbii9bgUKEyh913ze79xcYZ7s1DZEj65u9vHgVmMUbyfzBhnc5FpwpdQF999DEdioYhJ2gioYxA97gLbmzHjqxFt59Gr1STcn9UeDsiwg7rJJRu34DNxbmSa8x51kBQYCFQ5ZQ7izJzk5FVAaNkurJ9wh8tUC8iXzqd1o33rpEb84jrNJdxnkB1JHo6PrkWfHxQ2LvAZSTPS2W9EmmS2qPF5i2Hegd5Mt4zzCSsdAQYBJG2DDoDAyMskZPLqfJ6sgS1i5rRV84CiGsvhoJg6d7xZc6px7oCpxpnMU3iGRm6Z5avWo4dJBbUYRvdtiASxzqz1UqZJA5SGZ5iad6xmQ61dSGT7RpSWnXZ8Cw5nNicUD4YxYy5fckVSZ3qkt8BxBsB2r5Q3x4ZVKMMe9oPE32mgY5YPqVyXnanz4LubBFhKmC4LoyHLxRjuSkvMpBwN8usbwTj87zp4sxomMtcEhKsagTpSg5Qvms46ERpLdsiywQAhLkiMEeychcZtVhXTTPdE2sTVPaaR21uALrLWwsWsss1awugG3eZFdR8oAZF9TTdAjTMViMcuh3GxzhmgoxEeWPuv6TyzkpWQkAZVCafnchPJxa9QfWZ6Z6rt7gAry6d5eHWkm3Qx6aQ5DCaA6JMrjufubGJJK12mHRnEvjU6xNj2PZzj8y6WhSSh3L4ADDLhvprwUT2udQHPgMZmGf5X2oBXyNj9hAmYJi8mdHeHfF6LAAaDmEduWtDGmzy8778Txy1ZT1SjE2Hqhwb5figyFvfMtTY9wdv3nQ7Gws8", + "DfVFCdP3wxHvs1T6zV3UaL1RWXGbVUouKbBja63RCjur5imaiNUSPWh4DJUzkQ74FK9exj66xjtRYwtYtndzyJZWvbAPjML1znXQZ8S3hVTNBfHXmyZvCpK3oSdproRWHQBHYtPsxDqtFoqdwLPqo7B2fpjUxoPksRpimGzqWUkQpPb79NW6B8H9qr7ktmfpy864YgMDcXZAQPoTVZRPsozRaB7UJ3xbgVmFfGfkivF9Zm6FCWHe76M9rjFGoZjZbEZWSv1pyn2XhGMZhQYPYysMToaEKrdFPymjFMFAsNt2vSWhVxh7X7KigVuWQCTv5ig7qcM7aShwN9fnpMtLMxh6jadCWN5ozS1oQ4pQxx4E5RzQwen7YJ1j6jisP2XjJ3vSozEzBqeui2kUevVQwDxc2jziAodhPc5PWNS7KaAX7y7m5PmgKU6sSnXnuPj6d85gv95fmEr3w8DpttTf9m2oQP4PERchifotFQPNQ83cod3c2tj7BCHnbFR5JaJadjbbxk3634R6JFJ56v9S3JGuBDZjZ7dVo6giLJUybDBRbN7xYTbzBLHyYdvnhXnczMvRGQ6XNVdNVbHkLheRQGqH6UAsMR6SCkyuW66H8boKGjTbNFigtjj9MGPbyvjAVQUWteUpJY9UqmNYVpbNesm2jx3sVQLy9oEMzmACKkjrM8ZBk31SN9CQLshVfPdBFPJ7Tb82uckM3t4gYXEWJXJGQ1JVMriwHGizXJ6pM8gckfPb5XLo11hu1P1eXz1FDQzqUoNyocTA8TT5KArePH7CjyQUZ5PAKv6d8UbZMcJwdxiwFhRQtthPGbhbWKe6ttwqz3pw3Vm15y4PUeknf6ULzWzvZok31J7fB1QXyPvsPZMZQ4eWGf4mqkM7W5ff5DgtvXaRP2oJCDQueTr1DyApSwXP796uEWyC3M3dczzsS4DJ4fe3Sxz8PSWFoKKZR4KwxJW9gtBdYN8WyEjwouzsf7tGtPQN5y6jF7VS914grZkMMVYBCVqsN58vAazAHVnqdSkoUmrdiHjUp1bFFZhcQLZx3arj1JK9mFGzarthvxJYMUH1aweoAE84o18acqrxNJsQpDGE1oiLrBukBs2j8t7bC5Cb9wJ4NtM9bD4vsC1mSpyW3utVZHDWcZQT9dD18MyDFzkoeQsKFhcNtkGzyUg1yo3uy5YfM79pnMnmGYWxpYz8h75DL8BFESjJvdwGXYzAgo6fGep7t7hzdV18tmrXUhUwW8VFnqjwLki8ceEzvz3bzc9q7c76qrRCt1fe2pAD2ku9HhZhpFBQ13yLR1inM71Brq9KdWD1ek8GSCDmanqmuV7EKf2WtjsuytbBmHs3qQ3djCZPX4hfDfqXbKqfsVfAATRsk9bNCbgGqqfGUgMrkxV6ErMtShWKc8GS6qHYdJ7p6TPu2Xw9SntozAXg3GSFLXrGyFhKQ2z77woL3EG8MTWnbjqJsWPJm6nrPtcZjErwJ5uArH5s5mTPU95mrmRDrtVQDGEZJ363APFmNNiqaJVigkHtiRAnHhStL49xK5pDhzmTxhmEwt6Y2yYmaSqAxoMa7szdwqZaJ1b7qbq3gfSzBdUE9K7HjL2MAoTKu8W7dL8P8j7fXbqLbPN2KHfAGDim6hb2BXsgtXT5D", + "DfVFCdP3wxHvs1T6zV3UaL1RWXGbVUouKbBja63RCjur5imaiNUSPWh4DJUzkQ74FK9exj66xjtRYwtYtndzyJZWvbAPjML1znXQZ8S3hVTNBfHXmyZvCpK3oSdproRWHQBHYtPsxDqtFoqdwLPqo7B2fpjUxoPksRpimGzqWUkQpPb79NW6B8H9qr7ktmfpy864YgMDcXZAQPoTVZRPsozRaB7UJ3xbgVmFfGfkivF9Zm6FCWHe76M9rjFGoZjZbEZWSv1pyn2XhGMZhQYPYysMToaEKreqRNRKK6po3m1zS8u2h5wn3N767WB2LZkGSY5ayo74A9nTXGteRuZU1cv4ZUudsmAHbLR7XCvgKxGPnZ2hfYv2n9c2xqcUyjJaaewAMhrEBw3ZswNvNA9zobF49ak1yXZA2EJ29bghhMk7EFZqSTTP3mfUtunS2aCfhgeMJ7HBgLT6HHxyJfygfvW6XEjNgfnzFGQjfq3SNFCGcbDirQJ36wEbZemFahCLGi5oPLzPzTSgN5i8wpNuyNJoaBGBwpVTnHdTAi6HPda67xTbRxyM6A8pNprveRGPtgxt6Y9CughZatz3M5kxT7GToXUWTuv3zZCceRPkxffcscSWDyHrvPcweWgJS54MA38njaKKBRAQMwvDUt332uiUTNVzSaAHkZzDNUS7JoJjRQZiUGBua9t7YRxoibPCQVPtcFQqy6rJNawrkUyVqDLxDnuCfttCwxzhshtvZf6jtgGm9E6XDw3m6rtFqqyUWFwQrnE4jc1imJf9reFR5pU2VhVLF7GoMb9GTHrXG8x5vLGuDsPb3GNsPDcMMC75a3qpPMtTVRmwAY4gfghhmCAEiFwV2fTZuXVLKJRUUkmTVB9qwFpBpyH5hsjVxG7LshYNBWfqj3a7p8u8nHKS2sVaFaQXsoRcNzmduTrK8mdvBRkQ8XbQGeN1pRiVVoAhTM2sqv2KHMLAmHswtyKFc5JD9jkqNV14SpkXETMQDQLRh8X5j3TvAyMK6kBXdqwwdPzGVGqrjbpsZJd5GtquJSfSDh1mF1yUrq9CaXtxCALBDXNgj4ZrjXUvGeXC7SgjdSubtBcdjWVuBkKUAUurszLnT6j9LY9gvQLn6HhAB661Yy7yqYKRR8KciVrRJtAjp7VN8HjNixdALCx47kGp2wm293FHshLmBRtGMHSsNmHBr6bYUtTsZV6jVRxqaqFo66ZXVjt4ofdhYCAK39ubmaBB7WXajuG5XrZzK7if3HwVUbCjo4cSJwVUzujdQNNtK7DyjunPkBQqwbPKPN1c5kLdYippp6bN2JHZHpEWedfw38dTtDwFavc6qyL3pVAcRjuJWeUeR1Wb8Lsji639VmCLk2Bog4tDbQGzDsmr8h7Q2tCFWmgVameJJWpV5j3JXC1C7GNfWwUAE4JUnYoTssCLTCzPchJJ6UqetZQgmvG2w4zZbz185gNea4HtzkMhgREaZW4tjhkQqRppN3DhgsHXp6KYf1w3YkPEmX1qVED3hQrvghP2Mdt3WbxVYDJcurMTCht2EvdjZyEHTbz13ULFvsUxRCa8XkoGcgq96LRac724fPQrK6dCzQVeUkj5ygvAcXcqMJm5kVhPJRxYTgU8Xho5VPgy14ZbRZ5wBojGu64Mm", + "DfVFCdP3wxHvs1T6zV3UaL1RWXGbVUouKbBja63RCjur5imaiNUSPWh4DJUzkQ74FK9exj66xjtRYwtYtndzyJZWvbAPjML1znXQZ8S3hVTNBfHXmyZvCpK3oSdproRWHQBHYtPsxDqtFoqdwLPqo7B2fpjUxoPksRpimGzqWUkQpPb79NW6B8H9qr7ktmfpy864YgMDcXZAQPoTVZRPsozRaB7UJ3xbgVmFfGfkivF9Zm6FCWHe76M9rjFGoZjZbEZWSv1pyn2XhGMZhQYPYysMToaEKrDP659LKft7LjBqo5YaTaYmdThf8X71Ky2sUoLWEWjHX2uKqhdKHnS95Ngwovo4YFWKMA4pWNpy23AaK7a5Qxs8Uc31RgjDekU2Yhm1goy3xk7sa4rwJfQPHKp7CBQn6NcWVW2fwmk6SVYAWDgj1jvK3kWTxmuBFReAVpdMXCTfRALMi7MuWkXVkuYgrgxpScMTfCZgYFApDhCgz1r46Y6AWgcJW1h6HejfatJCQmdujEoTSz76CP3g7VxyZFSmosAyRkQaDAkvud3bgkdawWftihkwUHvrwnHWtRqehsR7ybQa4Fgipfg67nMGJPMLcc2T6fR4Q9jFehDPU1aBaaBprxneHERTSJNUF5ospECkQXK4VDAcZscz4kJkTnbAnrBd8a65Wa6eWUWQqUQUYYP7yPCUeDy3mJDQJm5MKUSM5YxphNucf8a2MT9KdLvR1CM78jgpztiKupoparB2mBw1HAN7uLMZzRgbumypf66w5rLsVp3GbEBWnD2S3UJX1qxQZBGVcDdXviWoBq3V4NiqidruRUfyKhg8yJ74GGJtJfgBrE9oFDQ5zPqTkqkrm7k8b77C7E4G5gp79udZyKn5FbkazdVA8rE8PyzMj2Q8H2qJ1ozapi6y5qi7os4CNwiqxoUMyvQxvqHViL5HzhiejKgnsCMXEm18msPtxrx8yvQPu1u1HCe5PEdNAU9UiGhrDYeTywfbgw2ANaN5BRYwLqb7SYzs4zrBHV889D6VXKVqpTPBWuHhsLpCEMfcbp5qS8tVX5ubHQA1Fip3nWqizMdXi3XY84WwBc1FjyHUnRrJCDa3PRWMzAzqVZyjgCyGQP8iq7baKDAGw4R8DmKXdfVV8dqmYP5479vaqutCWLEz7AtZtQve3zf9MRpQLtXnepmaQ7J9Ddw7BRb4DkjWR2acubBMDcJvEhUJbMr3tqcA9pABzUTyKmYU1igEkCZTDRqArs81yUP5MDJ28vq6TuGrrcm27V4SJcKEdxUG7PATsYWuBSRpk29iCYDz7hG9DxsnSps67HRREZeE6kZRr8rTR3G971eqZys1992fk4LGLZHKUBDyXkyKtCrNCGwt3UeqcJuewxvQj4RZ3z3gZaZiBX7pAS7inpb6jxyio8Grt6poyfwCykhb7NaNYHGZGx9TvYgzcEudXpTuzhFRgg4aTwbhcU4LKuqY8ZQ964MrRTJGmem8HN5LvrpRDpn7R2FERfWoKRsEmrULR2rmjpEe1p4WsVcpxNhT6RZeoBvL33sD4XnV1bstiwiD48RXt9S9UE5YnhjNZPaLkp5v581EZzk4US8JdXCh6X9sSxYjF5G6rA3EEBiXeAgQ9d6pdcTwkdwPXbvHEr2CK", + "4tQGGLNJFJ2pSiGpQZZRxamsS2moL5vEZ2Y35pnqyjXNVdoRQgTNwcwZN2wKpHt1DAndD6pkBeuZbCEKC4khRKxFd9KEJvpEesmZUvQ2RMXTTeXXioMMonSbGHouMX5Ng6GixyNfyHWXrDUJEmbNqgcGsMxUKaab4fCgQt95GU1dgJ9XFVchpbJ62m3R9ZEEWrUPCBM5MmC57xV7uKhdJkJdw74QU6pAMeFxgru3CSTWznFm62zMx3GKeMQsVMLVuJrDkUe5jDQ8Ru5uwyCBu5zHeqqGcGzqjvHbHHGH1ev98wMmeqGbeGpi4yL5Cxq4FRgLDUTr5g9C6eTkrwuE31q3YYoDAzwfzFHtq7eognqaiWMR2t25qb69QGDt8wnYKHMNkxNuug7kBM4btmhPm9D6NcLJsCScWueFAtHnQKgHGmUSde9HqsiFXehmXcnJL2rQpWaj12ktNcruUdLKYrpbAGAoUtt7QFD4jwaXmnJZcPPymV6fb3EQ71NMAL6VBaSu8wqhYAXDsfHa2s3pfYxydmWiY4n1FwLYAgfh5mPhK5ukjzxbA7ioBvWpHhDMAnZhGdj6AHKN1zwruyjEmrRHFP9J8bA5nVhgQ7uqQmHatrZY2e3i2Y2jvgWSZrj12b6YKW3pihasyR9fiYLy9MGtV5cvEHCr28h8F2xFStkhkEP3WqkjTXzJYuv8cL6xVMv1gXxM9xpUBkchSw9WWdzn5Mii5xafufEqVTT1L7Zpbr8jr36S4h84HUhcnfton1pEJb3Enr8eCEjcJqvsPZaxjr1pkL3rjvVHRWM1rWYp86LTEGwQgAcAvBdkRw1QoJASBH6uMfZWMgRrAsyNPdbnQHX1Aupku3Gvy115p3VPhPtnC1p1NSW3dUGH94z6MRq3aG1kVpn3vjnG6mKuFWRBqNTHVj2wk7cJgjXsSeydDcVxGNNh9FyCwSjjLnp7H4FNESK8d21TYPfNSha5mPu6UGTRo2oNrSbjHRnFPubYL4te1zzowjb9JsQLGKzfYyXoBgrLmjvcqZcNJuL798eSr1yACpWm5928K13536MV8BTtR8FgNA57WNkzLQkuUi3hEwWEkG8hBK1DRbr5kU35paQ9FuXo6ZDhvokenubw5xXxnXMg59Ky3ce2xA7qnkYTv5orD7ipLybrNL8PN4KHx2te1dhV399qEPChRPegiFL56sDavsJuRjgWCWxkSoKaL3hvR7eLBuMwxdAch21Kpv8w6ex2di9kHFEuXKZCfrEtWfHbp8KbfRcyzkG7DwVMrHygPbvkBNXxnEqvBXqBaA2TJxUQsmvaPRahYtiyUSpSsScQwkTEnEGMNxo6NKFiLn1aiN64b6bfgELNHqV3tJ99WvhvNNQBjRAzJZFk6EeURiJFwYyn4w9MyA8hPeoGAt2WgvqAMYfKfysoiHZdtfnyQJKXAC3Bu2wj3qZ7Su9jzKJgykFsrUvBkcGPTaQ15KWbiyQ5xvBW3xvw53Xw8uFvMb2DM1FdZTguysxxH7HLj3ZfkcDeL1iykH9RVS3mABVFe9XvRss2Qwg5aoqcKfbtDnTSrAGkrJ6iZSgKePbUVDavN479WJhZ9oXLjuQWHhjtTQ6LCeFGZroTksLAppottiXNDy4un", + "4tQGGLNJFJ2pSiGpQZZRxamsS2moL5vEZ2Y35pnqyjXNVdoRQgTNwcwZN2wKpHt1DAndD6pkBeuZbCEKC4khRKxFd9KEJvpEesmZUvQ2RMXTTeXXioMMonSbGHouMX5Ng6GixyNfyHWXrDUJEmbNqgcGsMxUKaab4fCgQt95GU1dgJ9XFVchpbJ62m3R9ZEEWrUPCBM5MmC57xV7uKhdJkJdw74QU6pAMeFxgru3CSTWznFm62zMx3GKeMQsVMLVuJrDkUe5jDQ8Ru5uzBrpBUJWAamhRD8zzu3iHTh6MN2Zb5m64ydpNUrtxhECCWPDaSSRBXu9noUmHTR93e72FFyXcxxCwx2oq2N9S2DyoEoytLur2nzgczMPKqEMvEfy8X19xp2ih7hNCthn2eq6Hqr7pamZUWp7srji587CkDFq11YnKMgXeGweRHQ3hPTGeFCnaLMJ6SAPjj8VgPKQMEhnT6graMsAgZiwqDKiLtPWqVCvzZ8Dhhma62moTthnBc9aw1v4WNsnnX43VnEgWVQFnnxwLp55uv7AAhxHC96EnA3jPrXcUNadm82njEaHBayfzLy9dr9PVjPHhrrsWThvG41ZPa8iP936EA81c2usCtWKqsie71hrmxB5CzJypFV5U6eurtf7t8pZab1tyKCgn4pN6HBPuFTzRV3Tcw5JTsdTbTvG7f7eieC9UrnuxFFwHdUgdGXnfAmND6j3Jrzhxsc9rzbEAv561QdKmns113JZeLNrUdkfvPr7XiSethpQugvUt1n2cNHwj77whEHMFnKgEsygJUD5xVKtG8cxS9AdB4egPe6gwSuGuW63oBXq6xKt8RURmy3FGf865LqBtb5a7Q1SdxnyFWPQsjJrPpE9SsyBfN8VFh3wEsTqNUtfnh6WwJ1SdRFycSJBiuFK7mWHKqJQNNMwrzS88Fw1AJscbvq23AvgCj9RboGSn1CLd4o3yqNec26i9Ucgy2djVxZjjdCsxDhqsRoevNjrNsRbAE3fiddJ2T5pxWg75NYBiCDiqd9hc361MUNy8n8BXA87CdexrstrGUHQd4EW424cVAoV7X48kYmHJnUuegA6aXKCSYvrMhEGPC38trrYgDav4DN1VzKK81nE3zjHS2JrnXGiNsmven8JFH3yEL463iWLw3rZAVGpjSaEHWsgKnf3JLB72kA2D6WrFjv7PWWPuQiKLgsSTxLkcbDcQ7ttdBfzMuMLFPtahcsdYgjrrRc7v99UYEyMnfJMbJqWAAquguZQ1WvacdjdJmRue46QyboQeKE3LuscRk4nhBvubpSPbLcwEaHsjeDaw4PwSEPS5H1GQt9iWvCybjmnFvSB9G5a6udRjJj9nVL8N483uJUfzSfxgLLmEQ57EoJ5rDptM8oAUB1zd12KuE7Bzgg8t1ENoS1MxPWRHKSgmC9qWjpVQHxKwPT1PyRaxsj6CM2ysqiwtEaok7G5d7dMdA7eom8ENB2JoSFSbsii6zSDBGkuzfakJeatfWvYtu9phtvykaWAqbqwk33u9jZkbTP6vjrgoxzGDQkdsdqNKn3BXwihmTwJfG7HQidueaW7LWiq8LR1Hw3X2pWzsrwn8vag48qhBfxm65gvm2wGVVvxthDPMvHeLPuZS", + "9YRY2j5TBZrc5T8aJWNMmxmPWyA8JMCRvtTQmpz7QJSJKED1fnjgt2FLEf5tgHZAKtZZvprxZdLx91q4zDYbZ9GCAd8DNmoAJe4fpEU89HMWa7NdQTuisS8vKGN6HuBj73rjzCfUuA6xupEq5ihPSC1a9f7w3GayayDtDJvK9wjdpf8tV18893kPW3sbZAzs6fbvZZhMpaA8EmVg7n1UemRDAv1jxgGs6vHpPb3FUk59Lpa6r41Fp3ycwiGMy53bVUT4V36bFXV9sJyE4dCnyjK4AiLX8BnsqZm5G1dTdPUaJD4XAi5pQa46XTS2NL7fZpLnUVJcfH6dnLxdmTEuppABYqXiGM5pT9FQbkaSyVxiqfFS4j6Q18pn6WSz1DQfTJRQtt1r4UA79UaimUsoMEoQBXVyVyHCEpChf99faDaasNmZ7Qc7WECCRi7yazV7roJNAb2EmhBMGqXQjokt7NwcRFJPd82k6NtyjEH7CXsVgRQGnZ2Sie6H4A51L71MsbMV5cy6rmJHzXVYe7fGwcZGxVeCmfCQVBz7w1xazYSZAM1HfoFAkggj29Zq1N1rbpBRXQvSZd7d9rLGFwgozk5N7AMmwJY9r7HiQWioZdM9A5tXtKDZ5PnFi163HtyZHaLA5AwnBzpUutigkYwT4KpPdzqFJNtu3heu9ZBJ6VxQZaXHbG2YmZaU84c53dEyLitW2j6V4CXVzDTLxe6briherveYiwvnGiujFCGuisBktzGMcgsA32qR45pnRFRYfWuvPTNjLWUkd3LR4jjEgeds41PW85rD195Lc9Aqtt7X1f9TMBuR5cmyL9enRhEipaSiReynxcp2iofKH63gneHkCbite6sJDojdK5tnUhzPSjZHYeqHfd2eNhWUYdZG9kFjxfBGk8v4jDXvbp7Y7mKPf6VTLieBcJK9ufke3ZonA15pRAG14fzKNxWvYr3qPEWAJUF96sms6TFuLV77PbZigKJooajg6kzDzvPEbwaDg2x9j5rATPEXv2iqUXK1TJLRetS6mckqQQ7CsQy1a2sbQ1UmzxAtmRLU2KFmxkcWiPEqeQvkgMYKksySajBEKybTDimesVoDkPLrNeFQmXr46voqPo9hNaerkZN86zjspPWBLLmGE3BWJVyzMiEGzPPJTDDki4n6hww3zbeiniJqboSTf7DrvaBRL3YiG3RgqfvH3spVjsbDB96KtqLRPqXCQHftnt3jwCSGYW5P1hVGdfQSnq8Re2a8xhkoQpbRaa7B5JEmVyfNXFoLbzwXwdE8f8AeQbchCNgCHJjksdJ7BsRCGTZoqS1VDLSyEC8183XG5rsUHpKWvibbHXDiZ7sfVDa1n3jSFGNpQvKisivXhZR4ETVfYg6bfLdbZyNuY3so8ax1vCTTsanXtxva57PMLPnn44s1BG1nHf6pPFYhBubJTbG7qvGf8TLdthZYVohsoVW6j7kGiMhziupRLJp5oL9joBg1AjxrhT3Z6mkDiJUc8KTvmZjtnbR5E2JEti2WCwabGCi28nnX4hQ5GNGLnRJPyAQwzXTce5HCWjD8qn7L94Uv17cChouKNw7q4A8jp6udJCLGFuF1rdUUBmkjtwQG1vCP6hYe6VmP2mG7s7WP2ctSb7qDdzahSr4qo", + "2RsDz4W1HJ6FBsRyHnBfHFpLfJkeVLAVVc3SN1xCct4EEs88B7jHasKNoPVyer4sLhafNViWaSbsKaNUiqwnb1c7LHF49bKDTZtp5KgC1scYWCJoRLu9Qr8LuzVNmS97QsSV2raZKKMG7e6uyCGAFqn2VCSnBWtUhgHRtg8r1KSnZYd8BpWthL8QMqxSjABYp8oEjCnP69Fg2LugAApCj5YkdJDknYUw4Ph8iAnmzHBRggiazCcRKscYkM6ZySqGUJ8gjtBdnWt5TZQ9rVdoPiRa9z5tVNcwgYQi5WoWdr4Mj9RhPskN63rKBifnAJnnbXCcZdAFKLvQvy1weiY27tWTRD9eLYujw4ZLGh9wFk1er86zCsg1ntyU5CJ638J8y3i3pf4yUhmKC2DhRA1YqMpiukRjxqeiiXVLGMhhWsXRv8N4JHA1N53SzmZmi4Ba1V566SgwGbFaWJQYSNmLSRqgaoKWTuqz4bcG2AYBXoitrrsgraVsh3Nh56KLzeNLPPJTMpnQMS8MKCCoq8XkwdRjf1fd5vmoV43dAAUfez9joYWBZdiCNZfHUCB5PCPjuZJTLXDVcmwEn5ALJurdH6gyUPu57Z9Dd2a2BbQjb9YdHEegaaKn36BJoA3iS32rexEf6uQF4yyhu4N8NBQqoTbBE2BWXAEf81dZ76J6vuc7ZHg53UBW4E4KiymHfbHPfLAU6vLBcuaAemxAP4YgsbU9a7MYR9hMxtdSc4mpcauDT2tEGBT9fMm98wVurk2qXBS47oXNWXDUbQhDMU4DhB2NthU9qkWTvjtsXGdBA44Rogk3FXftUBfYwDR1Sfw9PnNaYaqdqnADhFCe33jGXD3z49bu1htufZRnoHK3QULiUiN6SMgHDhvCjEK7tvuNSTtbjZ8rBxF8FFkHNTD76W8cdkw4bGjPeNnQn7ujGhkD4zvtS14o8bPH6wA8qthaHDHmyvA62R8C7Ybw2L3gwYaKjCnTHuDB2CiFZKvhpVUbmvNXJLMtAJ66J5UjE19JmjcGTEnbSrXCtooYpVntPUFqAjgfddFk2TyNBr8SwhKLSAAPdmN8R21qArCxqoR97968JkQh5SC3kH8b55Kos3KAsFMBbJgek9Cs7DErithUsB4CM4HN275saRSNkREGdRkSKbLmdbER26D8sr6VBdFz7CYRDUoWejhWsG7vgAeWbZPpncCsAQmu9gMirps1aY3xPSm9nfmHFQ67SFzBE4yg2rbBTqbuhQ46yBALRjuAPC1vn1MyrVuagDcoA4NSXVARkCNnipGqUPm55WDDq9zZixSjfVQ2qr3RrDkZJA5ucb67h7hAVQpBJtacer4GCCHseEh2yTip2pYPwn7h9BHAcrkxNNVbmb9iscbVtP7o7dVBCrQCmi59f7QXHhk8rET8JPanWDCJhwnXbmLJUJ4hSUkzVw1LvyFY9qFj4MZegr3HdKr8GzWHnoay9MibfxwMjBH2gUre2bjUtGHgAeMnhMAd17vfaD3aUjUQE4pwXsAGdoeUzn2Yb68vBZs3jqbaktpcm9Uzm8DB5iqR6mp2Vd1y2xXWG8J7bHcUPdR5y9hL2fpPUH7hhR5byJNDHZYnMLLETmF9J6TmEE2k6cABvF9wetw5a38dcpS1EV8WXh8uPpQERn3", + "4tQGGLNJFJ2pSiGpQZZRxamsS2moL5vEZ2Y35pnqyjXNVdoRQgTNwcwZN2wKpHt1DAndD6pkBeuZbCEKC4khRKxFd9KEJvpEesmZUvQ2RMXTTeXXioMMonSbGHouMX5Ng6GixyNfyHWXrDUJEmbNqgcGsMxUKaab4fCgQt95GU1dgJ9XFVchpbJ62m3R9ZEEWrUPCBM5MmC57xV7uKhdJkJdw74QU6pAMeFxgru3CSTWznFm62zMx3GKeMQsVMLVuJrDkUe5jDQ8Ru5uwyFfu8QeAwhd3MwnV7kFhdAXsvoDWj9SsyXtdF9EJhHBmod6E34PmJgQWhp9qEnu1qwQw5Pqaw48EQKoYbME1ceE13vXNcQmWYGTYJT5qVq3wHJEsVWTSQYzSNGcTaDrSonH2b8rmAPGceLLv8Dcp76aw8UbBEUXZSBRnTekkh52GRYJYqHoXf1Pyxqtudu5FUWvxwGkq2ZJDgqLpTkCw9SrkuPQJn8QZErrNqzEaFzS9YbDoHs99SxaX5kmzMt353Q3dcCQe6YE65jjKydFkNCuMEfybDbP3Dk7t8dxhpMcrL1qdh4YhMV3QV1z2Q7qfYNoLbwjMxdqL4ESX7VZTXhJ5MuJ8GMHoqsKiRWz4ge1z474gksy8DXKVKDFisWpNhcL7hvJov7mKj5gjq2xM37fJe79QoKEb8WNywGzAgVsntvKKTtParmkiNtWW9bJMr1ewzW27FBhDzvaXutkXejfJKp7GiHGiLUDkS89Jqy8YnZUwqo7Vus5fgVjxYXJHACHHhGuPPSkKf5PaFDUCJhDLKz7to1djuVeNCJBnDU1JjHVNeznQWL1wmsuurTgWnaCww1raacT8jnxc3rj4v4BYuTfTdgJsY6sPpuX5KHNNjWGyvR3r8R4HhKUJteC7mv6czPTPTSy38rKkNW5pT9NxUQQgpSxFt3s6Py9sPvovSj8xU3Cu9RhvPQQnsKfEWZDXs6BfhTdVaXWB8CYz4Reeb2CCwtdYbyxvTz2T9i12EA4PecRXGjqxddm9CwVBEnWhzLFiSgVgBWyGpirSjujv6v6SKUc2MWyyqDRBWmBTZjKrf7DHvGDe5fVWZf4kwiU4jMLkF7T6AdSDrMnnUsdfWA9NcajV7U1VTnANaUtcB1oc2E4NiqfdFQHDrMbeN7K2HKzod6bjuNAYh3sQ6BBotKAsJdNbWCM6THYceY4nSfkSfVBsUdaiqXaUHKEXYH1LNRBdr5Rx7jPGm6sAUbSdLWD6UT362gK69rBc3auv5rZSfThL9bY8MPLhJN6hzetknw1bnsrc4UVqmYNgXX4tVJHYGwiPw2hjQsJC6f45QbvyFct2jeQ62ARhi1kmV5Vvb5VfT2DnCjKkgjXgXw93JVmhpgnC7jAiWJr2iFzHjfgvUQUBgMCT7DnjixDrmJfTXVu4BZjP7AVaBa34PBkgznofoz7ojJKJ1sjtRKj2Gg8gknwLsVaTjKaqXsgLtt3TFRYGmoWHtpihadJ3ELBbb1S8w2LmUDiWbJXw4oyHdcVuW6TWofniQQh9XFZX3uu7omug68ttLGnbbtfmvqmdmYNAz4apixj2EW1shev7ciwAh5ZF5hCvFsrJBYFSbxb1BGRoRQWvxQ77z6Hq", + "2RsDz4W1HJ6FBsRyHnBfHFpLfJkeVLAVVc3SN1xCct4EEs88B7jHasKNoPVyer4sLhafNViWaSbsKaNUiqwnb1c7LHF49bKDTZtp5KgC1scYWCJoRLu9Qr8LuzVNmS97QsSV2raZKKMG7e6uyCGAFqn2VCSnBWtUhgHRtg8r1KSnZYd8BpWthL8QMqxSjABYp8oEjCnP69Fg2LugAApCj5YkdJDknYUw4Ph8iAnmzHBRggiazCcRKscYkM6ZySqGUJ8gjtBdnWt5TZQ9rVdoPiRa9z5tVNcwgYQiS3EhZMmc78gU1DqGVM4HruSkCZoeiReXaUwE232Uprm8P6dK8NM8nGL2NC6bMraxqpKNUvx39ENjSy9z8rcQuU9t4KUP2tfvHxWFwZ6nU2EWgpTDVkdwg1nbJyDLeGL37FgfiqzdGhS1QgmZsinpN1cowo8P7fyyngHuUzD5E6aiqS7uNVvUmLvQ4TDGA7sDa6UQqhd8eTxcm7EksetrQqXKGZMzJApp1HLvgxdGBNUMMajSbauk1bjVjyCpcjkJyLznFerZEqcmwEhEnCXUVdQaM9dtRhiMVVVgujt925rEDbjGcjkT1XCibxrcKBT2raL7W6ScSFTm9py8z3CtBrU4w9htwDoQ7n3pwheEAP7LKkMzBXdEi3J9sXAJy2pJBqM5bGLvRqXykdswpKCzogpGktfXRpiQ5d6TooH7MTEfTibvk9aEoGDhhuf5oakcvJnBGkebMfK9S7tbaWQF1NudjFrUJoD6ZGFFeJGQs51HTTCT4UWhQyYED6ZdCD351YJXG5bZnVr4Tc8oTDV1LtSVbRAjtMT9Fai5fh6P1Lb9P2NGnXayVWHdkHFGFT7drCDAjsqyA4ar5bWUwadLgpPzKpim9yuCdAdiey6FUitJfqtWt63MMEGBd76ahd7SHnXS9QVsuytrgu4FKRYbnfo3akTTWio1d4EorrebqgpcCuyvduR4bU4dJHsqYfZ8qmL4FtqiHLw7P8dKoeWkwvV2quu4nuxWtZ4TWLP2MqeYYyCFEtC6eY1b9cJXt7VMVCJGjsoy63vWmZ13S7pQytguUNmipW77TL7z5TZSsBEY5WsDNeGTFr522YynUp6fWv1sYzxSDDg2Xb5gEaDWx8McJYZjbyBUmwPoaiuEizs47A2fKP6dTbBck8QAGEeD5XeXWRS2equjpF242CDMY4UeGWvVbD9BzfitimAtK923nRtFr6LGP1GsTAL4TNKMMHxVpWLHfXbsWF8uq2ZJj8vPFBeymaaNdqnoPXzaRmt8T5vDuZYvFzqgKdLsr42e6sX7j2iNgNFt4obmR6fqYk3EABHVYHJ166ArX16XNRbF1MPDyTqESLiBQA5MGEd4jA89YzMM1CtzcnRpy9DrJsDR7xZqhq89aVCfB2WGF7sENKcrRBRXRvAGts2ciytTKTj2aToq8AifQMBFZiWieHtRwQUWz3ieLU99Ygrh7zya57wAYpJ2W1DhyjjXpvkgAKrJ3FRFqLMkz21iSSwFTjJk9d15FxGun13wyKcjcwaRytmwbx4QreQP88mqsNcSVZ2UYkfCaRa2HreDf19RmxzCQuXWpbhX5GhyDqMvrMn9rW9t3afKn7wpZ26UQWkDHM8L2edatcH6ojmb2tV", + "DfVFCdP3wxHvs1T6zV3UaL1RWXGbVUouKbBja63RCjur5imaiNUSPWh4DJUzkQ74FK9exj66xjtRYwtYtndzyJZWvbAPjML1znXQZ8S3hVTNBfHXmyZvCpK3oSdproRWHQBHYtPsxDqtFoqdwLPqo7B2fpjUxoPksRpimGzqWUkQpPb79NW6B8H9qr7ktmfpy864YgMDcXZAQPoTVZRPsozRaB7UJ3xbgVmFfGfkivF9Zm6FCWHe76M9rjFGoZjZbEZWSv1pyn2XhGMZhQYPYysMToaEKrVo1ikPrYsQKMPDqBa3Pg5U4ZXUK58YY6Q4n8H4NQM4fYo8JchQqqhu7Hhf5oSGnkZPJ8MhCPLbg5i1XRLZDFSsm6Jq3LCdrdLuyiGUafaWznLi54oghwQcTBdhjABWLZiZydxMxjq7uD3NULABrXrC8FCaKfTLEe64FyhjxuFch2EmrrmhmKGjvzYqvc67xrWpvYSZLDmVwkH2wC7hQmYxTwPzant3GwCx1uhREnHHJLvv2keK8bAwhb4H9GCygx1p4s72e91NXBHg1RmR7YQLChEDjMLgCydCNAayi81SGzspNkqGQy4CThqYGRP6vxXPHP3ZYyn8TGvyQDtGahgqNchSHTGbcxcTp83fJ7wEEDpoEQF7yAVDkosRFYz7b98uiSFzhQ4PVtmLhY3fGCBySCqUhjNjqYeufh2uE4P23ELxEbVQJAFQw6aFcpudZmHuyXreQmenqYfnSuU1ZixwNGs2TJrqGVVTbpKNtEqZCp6ZbdPTETJPHtja94qBBdh5qgTfWeZQVfXrZsnXqWbjPBBQC2j96ZX4cZLXSc1GEzQXb6ci7yFQvZoUY4JPETwCQetSNUajLcnZUay7V9pFbKv9sWJfgUBKh3nZ7fsKcYBgMmfnqcbtHjZ1fypQj9TS1cnDSGj5tkbuZUVdGh7PoCbTSC8LE1eCEA6KBSJzSZLVLUFT2JQVnbb28fYEMtRcwB48T84mP1MTDuP1BP1Bpsntm2EWcuRHA4mVTBpcm8AYksFpyBwpiSHosBwRhxoGiSsFp9YB7cNSjQQa3k5EHbAm4Far2qYiSymWXWDVejdCygubcLD6dctAMcqswj9js6XyWRcBxgCBUQCXTM1HohBLye8DYe1k51doqLVuEqnniWqNSHR1Bik6Fxkxi26zsmwB9uMdfovRJ8jYmtr6BSKY4Ameb83ozKTDsMHcoq2tVP6GkCm7Um8FtwRYQRGLTzJcT8BH1QyUCwnThFwtoD45x9YoteLdY4ahY12DK1dx2dpFhC5dyKbpXMaBEZ6xZKmBJE6Vr2WBK8Y3VYmvsdNuyktEvNdMmSmLck63uM1xCRdpSWpRy1RioKkk8myvCF45mhNgmZXcDo8BY4raFjfLCtUzsvQXyoeS3pWuvJnkuv9JSe48XKqXtWDxukrbzzjU9ZrNskEBzMUfao4LFYDSy6FVEo6kpNBWwa3yeN83gozACAK31HqRYV3XhpwjsUyNiE4cqpvdWACYkbQvFKJZ137B4b76vFC3h4aqdcF86cxsRbZ7jE3sifk15ZKfbQJ3CbseD1XiBoLMCdgefKoYLTZGDvimwh1pAP7s3M8ttRxM19UNLHGatTtEiSB654Qo3MkaosdceFUzC", + "DfVFCdP3wxHvs1T6zV3UaL1RWXGbVUouKbBja63RCjur5imaiNUSPWh4DJUzkQ74FK9exj66xjtRYwtYtndzyJZWvbAPjML1znXQZ8S3hVTNBfHXmyZvCpK3oSdproRWHQBHYtPsxDqtFoqdwLPqo7B2fpjUxoPksRpimGzqWUkQpPb79NW6B8H9qr7ktmfpy864YgMDcXZAQPoTVZRPsozRaB7UJ3xbgVmFfGfkivF9Zm6FCWHe76M9rjFGoZjZbEZWSv1pyn2XhGMZhQYPYysMToaEKrESE3griYC7sq7LWyGr6NTyzbgn2arrrCEjKoUe1HdXRERBe2YjxTMtFgFqXGeB8dyZddrQ75apZoGzXheCbHt4PXesqwzTPg1ybNoqiBDLr4AyoWqkt8BNFCzGxNL8Rb5dGozChvJG82batVEwbjbygaL9mmFHxBi4kNvY7abk8bh6gCwFVE4dKBq6mrvXaoqnR27DpwrcgSHKpBkB4KuWqKBMdKXCmDSFj5E7LRezwEWyUTu5exovMknqgj9hiMKzczK8RzDhLsEL9w4a1FKfn4UYcpk9dNNguftUQgQkyzmUPDaMX17acbgW99qNvMgGvc2xc2aTqyCNTKtzbaRiXyStQz8onT4SmgxjvdEXiTRCtnG953sCYHYGKrYRtvdXQw4yTRhoXznKPiFoYC5fse51S5PRZV5VjLbQZxX3BfMmwEXMt18TQyBd2WJLryKVdVtDR5pmxPrrpHjeRdAt1Ar7r7hDy4mQ5kAaFLzDVsTWCXkRZdAG45S8FvQfWV7Mh8JLEC41HdSBuZdaNXbBRagKj5W92EyDyajYLPQ5nzUmq2VJprLitQmzTrBvV6qBJcxZm42kDazY3TKfwZ2d1bHezxNPbiYZivy8qm58Z8aPKQQd1qEL3WbrfMQRTGFTDEC9RUaLKPnS3fdovKpbxkmfU1oou26MeWFrATRp5FNJiGNZ7Gb2TaLokPUhrv9sCMg7g5x7MGBhGpeXdAyb8hri6K5SbVaWj7fHgEDJnjhTDvF2Y9A75GE4tpcsM9XHaqnvDeBZakjUdW88F28LfTUHmyCjGmopsgChL1rjKFoYnqV5fDHKWqJtSLjeg6RzXV94CGzyq6BD7mojdVtmMQjnQEbFcnrs5am55w8nUE4F7jk6XsEsiZinN23ehG9zuAMJUiXtVMPWbXefRAUwHLpbnCur32C7suwCcFzzxFS3w1sMkJhvPYi6bfienqhX1tks6cfR4YkPWuu1HaHVbCrYybdA5fnR8hqM5URG4HSXXfLe8hnK4Lro6rJx1m1bXeYxdgzJdczejDKj3rmedSu4HC2BMZSGVatPScReH9sQVpZ3GS7ALpr5TMm6jisYLqFT6JWfZsJmydqrn5QZMZv5x9XAwkWEoEB8Sk8W7SuH1ZwvS4m8pDmegVFKWXTLqPxW11q9ydWZQ8zjqMxDTR42K2oVJUkRk3qgcsYiJSjyLBrbpheArpxB7z1JneQ7b97zu8j1KQS1aHTFvxU4ANRU3quRtySxy6iPNLapmwpBWwK6uniGkv3UmjWjvhzx3fiTC2rrMj6NdqP1fLAUkMTczWHkdCA4abRmPHiTYP3YuTvyy1QcQhAowwcdQsnD959dHXtJ4XsKAb4z8", + "4tQGGLNJFJ2pSiGpQZZRxamsS2moL5vEZ2Y35pnqyjXNVdoRQgTNwcwZN2wKpHt1DAndD6pkBeuZbCEKC4khRKxFd9KEJvpEesmZUvQ2RMXTTeXXioMMonSbGHouMX5Ng6GixyNfyHWXrDUJEmbNqgcGsMxUKaab4fCgQt95GU1dgJ9XFVchpbJ62m3R9ZEEWrUPCBM5MmC57xV7uKhdJkJdw74QU6pAMeFxgru3CSTWznFm62zMx3GKeMQsVMLVuJrDkUe5jDQ8Ru5uxJcBB868FiQToHL5G1dW9W7RfJrD6ZqAgLBm8V48XCSG9TfZhrjjmj4hukQ8etisz7FuDu1Tx3Tf2bEhfeqm9j1WUpzRt5DwYQc8Tu21gdT3zzwNgPkTugxgzJH6cPL393tgktCXNF5Ar64s5E6DodUXhc5NEapAc1uSCP5RaZ7spaEhXr5XsUqH9VUzMhSXSss2ziDiTU31Stz9DLGdhumXMzbR1y89zHEeKEWA9PFqNqf9svF41hiuTinRNeSDtpMqcf2EPDyEbB87kMQE4UHTzFn18DEHryVpkUGbbL1GT5c8E89rUqNGtEG1z1Aw8849veWDoX4xqDnomWT5FWWj2ozAMbbRZqYBDGxWZfPq8XZdXwz836Z6m1GysiCJVCTuMXUZnZ6Lqo49thrK8SPUX656rik8M6Vec6QRri517wf6EWR69iLe9ZUKK99XbwqkFb1y3kni6mqz4Z2q6a8QdepMNfCUXTPoFe2MMJRQZ3XdxSSKd3Ht71RfrGbDdR4Gu9xojZY46paGSBGDsDmvQFbnqQiN4yZjcNFwrVvpWPFVQL5hh6BBiHU2WGgEZ3doc8hU6kcJUMaNkLMAKusMCzhDWr4rC9m9qoagpBojNTqttqnvERLPggwKcpP9wtYrwRXgoSVKiQTFmbRtTofcCgFjCU8wgU3DMRWY289oH5VvKX3WkJ1k8UbDcnymv3V18zCRhmaLwygDSbzXR8ye92fjxrHPEQa56D7WVy8dRjVxAPfmWw75QVTusmRswcKNipLE4RSE5Kx1gfGcsN52NkwVYwV6aGN9T65MJccvEdUbG16Lz515QbCFtK5ay1TBkzi21XpR5jwiUBU4zc98VqS21YmAyVgbRf4JMCJXHzKWyhpYaa3BFGuVx5by59DVv3ZTjghKdHt2osCGSHPmoXRw2MA6RdvZuiPntJ7TsNcSpSmJqftZTCSXvkYGkDuoj8YRHbzKANs1cu2zkYHz6HANxiTgD71px8Xrtooh13RZBQ5PQ3ZdzpyT3etAGEHqcYsvAwm12zhtctL7NXuDpgJ7V1NYcuAXsRoRkBVMU5WUPCZ3ZmySyAXFyGf6XP2U1mKVoTxKRDay6JJr6kDa57zDYQJD3L1beKBUMXQnFhfyzBBMDwVVTvw7n2t73wz6k5jHggtU1eBKhRmhwTvur9otMJmtXN5yGDY7vcxxnP3MFeptq1zAGXYFFdQcU26ceThahq9TpixmZFALohtyjUCxBYpSJVdZNRW71Uueu7sqjKdBtAAC9e8NtdekJMYqsBdRRiui8ectZjJL6Dz4zuEmq19ruQsqxF4v1zgEQaTX35djjg44k91kBdQN1TzNHCvn3XireZyP9NKRW", + "2wF8sNAVsk5NkVqW2tt34Q6HgnHMX8b3v2TWAsHfkFGHF5ep16ZUU8vTnKdiunuoQEvHJCtXuok1LL77t5izFHkRzF8YVNPYEvT2efNJDKdj4YAxRH3F92XMh8VqFGyikYopcd5rvCcnciHW21fhnEGUdZcvSfjtyCWbywgZc95y7vm6GvTXTxNdaDKJNinkzNiTvbqnzyRFDSWaALpmTGAkaXtaTKVyQrgwieBV6W5xbW23FT1ibjirjLBoEWaKfK9NfQMDDzjYDu82PvRXBFdE8nyhYmsYXmX8dGVfg6kMcKgMqXR4C5QsmUqJ5bazAcWYPCv4LpsQtw1oMa31f25LgXMt88HWa5V1iQoZNXbh7drCERXhrpGsPGwAbgRqJZ5DfRvc4EtoqYiR4N66i5PkrpVHYJTV9VHtMv8zFJEavDaRaUk9wPXqprTXhjk4f8r3U2QtBTPrp9YUMWL1YxoeAtdQCMLSqRwRVVvJbXPcQEKzTUUDvqsUdDofPXwVHVq23Z93BU9WKDZ3YR98VnRdrFMKavE6uGbT99ay5XtYZAKhNVrZNdJnQyLHDsT1DnT4QDZ5mcAJSAVpNgwoPFmvJYrcntoVH1Pye7rJHCxZSRrwo9kTeM1RBS8frGMJmUiPcC1K9yGb6JeXQADEsNPPG8ZXTRry16JdUCjDW1JYMV4YrhuX3Kr69R2LHJ5AVgk2Cup2LjSEJ8FJ2MjHaAgGPPegn3UCWbZYM2VBWm1pBLaXEEYP8cc22JmGWVcbv2zP6ixGDefdGS2E9sEnQj76avTz8qcejTgaP8tTVsgBdi7sTSr5xE6peqK7tbT7PWL2Skwhr4BKQyfi38nVbyfH1gVtKLVoiK4bcpVdzdXRtkCoqqVeerXzonnFHSgzYFuH3fUrbJQrDwSCfyE42dZjeC3SD2aqdTkvLyKbhs1ws2diRcioJ6ZmwQ6T8qANEzoavbKbzsJqbCFQEdQVy67jsXiJhFQX83LzAcVkcmqdmCcGfNpBze1gshH72YpTf5as9DysZZYnUmSdYAxuHo69S69WNiKs5oQyUfvyLkMpUh16BCho4BP5dJF8Xou26Vwfzb8BXrMQf5RG65tzfy1tqsADWq4gCkFwhSp9vG7BxxvLFvWGZCa1GKjrHPagPEchuekA4s8kMEvZzkC119myDLjniThawLxGF9CLzW9kXfEPRVCoVpFYs3vqVcxLMAKyuHGCRumWgEjJJbtDAxSnMYAr5iRkDXoLfyvvip28167L16xfLD4d5VNrk6hsu3Ta8WUqt2y1WnMAXYkdLE5zswhGFQVyTow1CH2oqezoJLJLs3Vp4HAb6ng2WS6JBGDxL3EhRrAgzruezYBYCZBMoeMDn8Lt2M8kHxCaKax5mzves8AaE1ooi8m5uiLFVPmd6NJCTM2Tia7XLZTxu3YLEbztRqz1tTox8muB481c7SEn9S5L9ENHxPswy4KdS5k8BVMT86yxnnctx4ruEnLRYENmMDp2McBz22z3tJ4tVq37nn3hMuc5pajTnR99it5wBbwZWbHXzyU9uMeK8MjS9GmVz52KqAwi53WnbnkyboKeFunH99Dt4D8AhJoH3iFNXn9PTXLcGw7AMonWCB4qMfwQieMJgRAHf1PGUnzV", ] }) }, From d10f80ce30d88b83868a21c9751bbafca5eb123e Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 11 Jul 2023 17:54:46 +0200 Subject: [PATCH 0309/1974] track tendieswap.app --- projects/tendieswap-app/index.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 projects/tendieswap-app/index.js diff --git a/projects/tendieswap-app/index.js b/projects/tendieswap-app/index.js new file mode 100644 index 00000000000..be38e7a01a9 --- /dev/null +++ b/projects/tendieswap-app/index.js @@ -0,0 +1,13 @@ +const { staking } = require("../helper/staking.js"); +const { getUniTVL } = require("../helper/unknownTokens.js"); + +const masterchef = "0x6dDb25ca46656767f8f2385D653992dC1cdb4470"; +const tendie = "0x0260F440AEa04a1690aB183Dd63C5596d66A9a43" + +module.exports = { + misrepresentedTokens: true, + tenet: { + tvl: getUniTVL({ useDefaultCoreAssets: true, factory: '0x2D2ee1a4aec9f3c8c14dFcE837e1C89b639dd1E4', }), + // staking: staking(masterchef, tendie) + }, +}; \ No newline at end of file From 5817e5662285a90375260683d4a34292a2309d7f Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 11 Jul 2023 19:53:12 +0200 Subject: [PATCH 0310/1974] fix platypus --- projects/platypus-finance/index.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/projects/platypus-finance/index.js b/projects/platypus-finance/index.js index a653008c7ba..5ec8120e1f0 100644 --- a/projects/platypus-finance/index.js +++ b/projects/platypus-finance/index.js @@ -32,13 +32,16 @@ async function getToa(pool, api) { return tokens.map((val, i) => [val, owners[i]]); } +const blacklistedTokens = [] + async function tvl(timestamp, ethereumBlock, chainBlocks, { api }) { + if (timestamp > +new Date("2023-02-17") / 1e3) blacklistedTokens.push("0xdaCDe03d7Ab4D81fEDdc3a20fAA89aBAc9072CE2") // USP was hacked const toa = (await Promise.all(pools.map((i) => getToa(i, api)))).flat(); toa.push([ "0xb599c3590f42f8f995ecfa0f85d2980b76862fc1", "0xc7388d98fa86b6639d71a0a6d410d5cdfc63a1d0", ]); - return sumTokens2({ api, tokensAndOwners: toa }); + return sumTokens2({ api, tokensAndOwners: toa, blacklistedTokens }); } module.exports = { @@ -47,7 +50,9 @@ module.exports = { staking: staking( "0x5857019c749147eee22b1fe63500f237f3c1b692", "0x22d4002028f537599be9f666d1c4fa138522f9c8", - "avax" ), }, + hallmarks: [ + [Math.floor(new Date('2023-02-17') / 1e3), 'Protocol was hacked for $8.5m'], + ], }; From 0a400d78892972973d7ddf127e1f78ba2a7d688a Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 11 Jul 2023 20:04:48 +0200 Subject: [PATCH 0311/1974] fix stader --- projects/stader/index.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/projects/stader/index.js b/projects/stader/index.js index 758de462c6d..2e308d7b4fe 100644 --- a/projects/stader/index.js +++ b/projects/stader/index.js @@ -53,9 +53,9 @@ module.exports = { tvl: hbarTvl, }, // its on ethereum because funds are locked there - ethereum: { + /* ethereum: { tvl: maticTvl - }, + }, */ fantom: { tvl: ftmTvl }, @@ -70,13 +70,16 @@ module.exports = { }, ethereum: { tvl: async (_, _1, _2, { api }) => { + + const res = await fetchURL("https://universe.staderlabs.com/common/tvl") return { + "matic-network": res.data.polygon.native, [nullAddress]: await api.call({ abi: 'uint256:totalAssets', target: '0xcf5ea1b38380f6af39068375516daf40ed70d299' }) // [nullAddress]: await api.call({ abi: 'uint256:totalSupply', target: '0xa35b1b31ce002fbf2058d22f30f95d405200a15b' }) } } }, - hallmarks:[ + hallmarks: [ [1651881600, "UST depeg"], ] } From 237edfd6ce3bbda34e98ade7bdf7466bd257218d Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 11 Jul 2023 20:18:01 +0200 Subject: [PATCH 0312/1974] fix platypus --- projects/platypus-finance/index.js | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/projects/platypus-finance/index.js b/projects/platypus-finance/index.js index 5ec8120e1f0..62638cab708 100644 --- a/projects/platypus-finance/index.js +++ b/projects/platypus-finance/index.js @@ -19,29 +19,18 @@ const pools = [ "0xb3393f4e609c504da770ebc968540784cc4e016c", ]; -async function getToa(pool, api) { - const tokens = await api.call({ - abi: "function getTokenAddresses() view returns (address[])", - target: pool, - }); - const owners = await api.multiCall({ - abi: "function assetOf(address) view returns (address)", - calls: tokens, - target: pool, - }); - return tokens.map((val, i) => [val, owners[i]]); -} - const blacklistedTokens = [] async function tvl(timestamp, ethereumBlock, chainBlocks, { api }) { if (timestamp > +new Date("2023-02-17") / 1e3) blacklistedTokens.push("0xdaCDe03d7Ab4D81fEDdc3a20fAA89aBAc9072CE2") // USP was hacked - const toa = (await Promise.all(pools.map((i) => getToa(i, api)))).flat(); - toa.push([ - "0xb599c3590f42f8f995ecfa0f85d2980b76862fc1", - "0xc7388d98fa86b6639d71a0a6d410d5cdfc63a1d0", - ]); - return sumTokens2({ api, tokensAndOwners: toa, blacklistedTokens }); + const tokensArray = await api.multiCall({ abi: "function getTokenAddresses() view returns (address[])", calls: pools}) + const tokens = tokensArray.flat() + const calls = tokensArray.map((t, i)=> t.map((token) => ({ target: pools[i], params: token }))).flat() + + const owners = await api.multiCall({ abi:"function assetOf(address) view returns (address)", calls}) + tokens.push('0xb599c3590f42f8f995ecfa0f85d2980b76862fc1') + owners.push('0xc7388d98fa86b6639d71a0a6d410d5cdfc63a1d0') + return sumTokens2({ api, tokensAndOwners2: [tokens, owners], blacklistedTokens }); } module.exports = { From 5aa74e9ca1eeb66be755d42610e3439371507f61 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Wed, 12 Jul 2023 07:04:00 +0100 Subject: [PATCH 0313/1974] add hallmarks --- projects/axe/index.js | 3 +++ projects/moondao/index.js | 3 +++ projects/snowdogdao/index.js | 3 +++ projects/taichi/index.js | 3 +++ 4 files changed, 12 insertions(+) diff --git a/projects/axe/index.js b/projects/axe/index.js index b7e7797f61c..92b63f35320 100644 --- a/projects/axe/index.js +++ b/projects/axe/index.js @@ -30,6 +30,9 @@ const AXE_DAI_POOL = "0xd34d3b648db688bee383022dd26a9027592b82d5"; } module.exports = { + hallmarks: [ + [1648765747, "Rug Pull"] + ], deadFrom: 1648765747, start: 1637036516, // 16 Nov 2021 ethereum: { diff --git a/projects/moondao/index.js b/projects/moondao/index.js index 01234074c91..475529c8dd8 100644 --- a/projects/moondao/index.js +++ b/projects/moondao/index.js @@ -2,6 +2,9 @@ const ADDRESSES = require('../helper/coreAssets.json') const { ohmTvl } = require('../helper/ohm') const treasury = "0xeC2aE8A3E2692E4b0836AB5cf88104d101DEBEf4" +module.exports.hallmarks=[ + [1639180800,"Rug Pull"] +], module.exports = ohmTvl(treasury, [ //DAI ["0x80a16016cc4a2e6a2caca8a4a498b1699ff0f844", false], diff --git a/projects/snowdogdao/index.js b/projects/snowdogdao/index.js index 152c9005d09..bd4938f6da2 100644 --- a/projects/snowdogdao/index.js +++ b/projects/snowdogdao/index.js @@ -1,6 +1,9 @@ const ADDRESSES = require('../helper/coreAssets.json') const { ohmTvl } = require('../helper/ohm') +module.exports.hallmarks=[ + [1637798400,"Rug Pull"] +], module.exports=ohmTvl("0xC0E7DA06e56727F3B55B24F58e9503FdaAfb2a68", [ //mim ["0x130966628846bfd36ff31a822705796e8cb8c18d", false], diff --git a/projects/taichi/index.js b/projects/taichi/index.js index f6ad6dd63bc..daeb79d21d4 100644 --- a/projects/taichi/index.js +++ b/projects/taichi/index.js @@ -3,6 +3,9 @@ const { ohmTvl } = require('../helper/ohm') const treasury = "0xD4b0DC48AB6BD7907E3698A62CCD1DBE2d46d310" module.exports = { + hallmarks: [ + [1648765747,"Rug Pull"] + ], deadFrom: 1648765747, ...ohmTvl(treasury, [ //BUSD From f686aa21bd3867015086de4682ba821f0330d374 Mon Sep 17 00:00:00 2001 From: define Date: Wed, 12 Jul 2023 09:41:13 +0100 Subject: [PATCH 0314/1974] golem treasury --- projects/treasury/golem.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 projects/treasury/golem.js diff --git a/projects/treasury/golem.js b/projects/treasury/golem.js new file mode 100644 index 00000000000..eb1fdddc427 --- /dev/null +++ b/projects/treasury/golem.js @@ -0,0 +1,24 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +// Treasury +const treasury = "0x7da82c7ab4771ff031b66538d2fb9b0b047f6cf9"; +const GLM = "0x7dd9c5cba05e151c895fde1cf355c9a1d5da6429"; + + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + // Ethereum Assets + nullAddress, + ADDRESSES.ethereum.WETH, + ADDRESSES.ethereum.WBTC, + ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.DAI, + ADDRESSES.ethereum.WSTETH,//wsteth + "0x2b591e99afE9f32eAA6214f7B7629768c40Eeb39" //hex + ], + owners: [treasury], + ownTokens: [GLM] + }, +}) \ No newline at end of file From f370338f4da4eee2f6031869130b55933a48c4cd Mon Sep 17 00:00:00 2001 From: strobie <0xstrobe@protonmail.com> Date: Wed, 12 Jul 2023 11:03:08 +0200 Subject: [PATCH 0315/1974] delist fantom assets cuz bridge rugged --- liquidations/mimo-protocol/index.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/liquidations/mimo-protocol/index.ts b/liquidations/mimo-protocol/index.ts index 40071814f1d..9d0bc72c796 100644 --- a/liquidations/mimo-protocol/index.ts +++ b/liquidations/mimo-protocol/index.ts @@ -24,14 +24,14 @@ const latestRoundDataABI = { enum Chain { ethereum = "ethereum", polygon = "polygon", - fantom = "fantom", + // fantom = "fantom", } const getEURUSD = async (chain: Chain) => { const oracleAddresses = { [Chain.ethereum]: "0xb49f677943bc038e9857d61e7d053caa2c1734c1", [Chain.polygon]: "0x73366fe0aa0ded304479862808e02506fe556a98", - [Chain.fantom]: "0x3e68e68ea2c3698400465e3104843597690ae0f7", + // [Chain.fantom]: "0x3e68e68ea2c3698400465e3104843597690ae0f7", }; const eurUSDRoundData = await sdk.api.abi.call({ @@ -56,11 +56,11 @@ const getSubgraphUrl = (chain: Chain) => { subgraphUrl = "https://api.thegraph.com/subgraphs/name/m19/titanpolygon"; break; } - case Chain.fantom: { - subgraphUrl = - "https://api.thegraph.com/subgraphs/name/rayxpub/titanfantom"; - break; - } + // case Chain.fantom: { + // subgraphUrl = + // "https://api.thegraph.com/subgraphs/name/rayxpub/titanfantom"; + // break; + // } } return subgraphUrl; @@ -194,7 +194,7 @@ module.exports = { polygon: { liquidations: positions(Chain.polygon), }, - fantom: { - liquidations: positions(Chain.fantom), - }, + // fantom: { + // liquidations: positions(Chain.fantom), + // }, }; From 4071dd4408dc20a06399e22b0083c717b5b6dafb Mon Sep 17 00:00:00 2001 From: Michalis Kargakis Date: Wed, 12 Jul 2023 11:46:27 +0200 Subject: [PATCH 0316/1974] Add comments and group JPEGd treasury addresses (#6775) * Add comments and group JPEGd treasury addresses * Remove redundant addresses --- projects/treasury/jpegd.js | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/projects/treasury/jpegd.js b/projects/treasury/jpegd.js index 1ccd1352bc5..79bbdfd5e43 100644 --- a/projects/treasury/jpegd.js +++ b/projects/treasury/jpegd.js @@ -3,13 +3,13 @@ const ADDRESSES = require('../helper/coreAssets.json') const { treasuryExports, nullAddress } = require("../helper/treasury"); const jpegd = "0xE80C0cd204D654CEbe8dd64A4857cAb6Be8345a3"; + +// Owners const multisig = "0x51C2cEF9efa48e08557A361B52DB34061c025a1B"; const donationEvent = "0x3b7157E5E732863170597790b4c005436572570F"; const usdcVault = "0xFD110cf7985f6B7cAb4dc97dF1932495cADa9d08"; const usdtVault = "0x152DE634FF2f0A6eCBd05cB591cD1eEaCd2900Ed"; const pethVault = "0x548cAB89eBF34509Ae562BC8cE8D5Cdb4F08c3AD"; -const lp = "0xdB06a76733528761Eda47d356647297bC35a98BD" -const lp2 = "0xC36442b4a4522E871399CD717aBDD847Ab11FE88" const treasuryTvl = treasuryExports({ ethereum: { @@ -19,23 +19,22 @@ const treasuryTvl = treasuryExports({ ADDRESSES.ethereum.USDT, ADDRESSES.ethereum.WETH, ADDRESSES.ethereum.DAI, - ADDRESSES.ethereum.TUSD, ADDRESSES.ethereum.CVX, ADDRESSES.ethereum.FRAX, ADDRESSES.ethereum.LINK, ADDRESSES.ethereum.cvxCRV, ADDRESSES.ethereum.SAFE, - "0xC47EBd6c0f68fD5963005D28D0ba533750E5C11B", - "0x34eD182D0812D119c92907852D2B429f095A9b07", - "0x836A808d4828586A69364065A1e064609F5078c7", - "0x9848482da3Ee3076165ce6497eDA906E66bB85C5", ADDRESSES.ethereum.vlCVX, ADDRESSES.ethereum.sfrxETH, ADDRESSES.ethereum.STETH, ADDRESSES.ethereum.WSTETH, ADDRESSES.ethereum.RETH, - lp, - lp2, + "0x836A808d4828586A69364065A1e064609F5078c7", // pETH + // Liquidity positions + "0xC47EBd6c0f68fD5963005D28D0ba533750E5C11B", // pUSDFRAXBP3CRV-f + "0x34eD182D0812D119c92907852D2B429f095A9b07", // JPEGETH-f + "0x9848482da3Ee3076165ce6497eDA906E66bB85C5", // pETH-ETH-f + "0xdB06a76733528761Eda47d356647297bC35a98BD", // JPEGWETH SLP ], owners: [multisig, donationEvent, usdcVault, usdtVault, pethVault], ownTokens: [jpegd], From 4194632d64defde5cf431db6830a7f3f1dea6467 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 12 Jul 2023 12:07:17 +0200 Subject: [PATCH 0317/1974] pinjam: add hallmark --- projects/pinjam/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/pinjam/index.js b/projects/pinjam/index.js index c9f719f2867..0112742f7d8 100644 --- a/projects/pinjam/index.js +++ b/projects/pinjam/index.js @@ -40,6 +40,9 @@ module.exports = { kava: { staking: staking(stakingContract, PINKAV), }, + hallmarks: [ + [1688670115, "Multichain Exploit"], +], }; From 4ca705be0a534649287857933b589c9ed6d7a0cb Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 12 Jul 2023 12:36:45 +0200 Subject: [PATCH 0318/1974] update jojo --- projects/jojo/index.js | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/projects/jojo/index.js b/projects/jojo/index.js index 4e8f4eb7cad..532f4d57fb1 100644 --- a/projects/jojo/index.js +++ b/projects/jojo/index.js @@ -1,14 +1,7 @@ const ADDRESSES = require('../helper/coreAssets.json') const { sumTokensExport } = require('../helper/unwrapLPs') -const contracts = [ - '0x25173BB47CB712cFCDFc13ECBebDAd753090801E' -]; - -const tokens = [ - ADDRESSES.bsc.USDC -]; - module.exports = { - bsc: { tvl: sumTokensExport({ tokens, chain: 'bsc', owners: contracts, }) } + era: { tvl: sumTokensExport({ tokens: [ADDRESSES.era.USDC], owners: ['0x47eAD228547db8397398C1D3aAfd0847CBEbddeC'], }) }, + bsc: { tvl: sumTokensExport({ tokens: [ADDRESSES.bsc.USDC], owners: ['0x25173BB47CB712cFCDFc13ECBebDAd753090801E'], }) }, }; From 80a2fe6b6ff4c13031e59e99a9f6e838d5a80b6a Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 12 Jul 2023 12:46:44 +0200 Subject: [PATCH 0319/1974] fix metronome --- projects/metronome-synth/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/metronome-synth/index.js b/projects/metronome-synth/index.js index 2fce1487334..b8c57da6845 100644 --- a/projects/metronome-synth/index.js +++ b/projects/metronome-synth/index.js @@ -26,7 +26,7 @@ module.exports = { owner: '0x4c6bf87b7fc1c8db85877151c6ede38ed27c34f6', tokens: [ ADDRESSES.optimism.USDC, - ADDRESSES.optimism.WETH, + ADDRESSES.optimism.WETH_1, ADDRESSES.optimism.OP, "0xdd63ae655b388cd782681b7821be37fdb6d0e78d", "0xccf3d1acf799bae67f6e354d685295557cf64761", From bab1cae9ebbf62eddf838a662d2e1c687ad8da2d Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 12 Jul 2023 12:57:45 +0200 Subject: [PATCH 0320/1974] track https://app.hope.money --- projects/hope-swap/index.js | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 projects/hope-swap/index.js diff --git a/projects/hope-swap/index.js b/projects/hope-swap/index.js new file mode 100644 index 00000000000..1c8fabe0c41 --- /dev/null +++ b/projects/hope-swap/index.js @@ -0,0 +1,8 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports = { + misrepresentedTokens: true, + ethereum: { + tvl: getUniTVL({ factory: '0x26F53fbADeEb777fb2A122dC703433d79241b64e', useDefaultCoreAssets: true, fetchBalances: true }), + }, +}; \ No newline at end of file From 299f70afbcba3c5e7c1b99431e482470b040f339 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 12 Jul 2023 14:02:05 +0200 Subject: [PATCH 0321/1974] aura: track op --- projects/aura-finance/index.js | 22 +++++++++++++++------- projects/brewlabs/index.js | 6 +++--- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/projects/aura-finance/index.js b/projects/aura-finance/index.js index df8f5cd2dc9..4fd9a113b2f 100644 --- a/projects/aura-finance/index.js +++ b/projects/aura-finance/index.js @@ -60,24 +60,32 @@ async function tvl(_, block, _1, { api }) { } } +const config = { + arbitrum: { factory: '0x6817149cb753bf529565b4d023d7507ed2ff4bc0', fromBlock: 72942741, voterProxy: '0xc181edc719480bd089b94647c2dc504e2700a2b0'}, + optimism: { factory: '0xa523f47A933D5020b23629dDf689695AA94612Dc', fromBlock: 83239534, voterProxy: '0xc181edc719480bd089b94647c2dc504e2700a2b0'}, +} + module.exports = { methodology: "TVL of Aura Finance consists of the total deposited assets, protocol-controlled value via veBAL and vote-locked AURA (staking)", ethereum: { tvl, staking: staking(addresses.auraLocker, addresses.aura) - }, - arbitrum: { - tvl: async (_, _1, _2, { api }) => { + } +} + +Object.keys(config).forEach(chain => { + const { factory, fromBlock, voterProxy, } = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { const logs = await getLogs({ api, - target: '0x6817149cb753bf529565b4d023d7507ed2ff4bc0', + target: factory, topics: ['0xaa98436d09d130af48de49867af8b723bbbebb0d737638b5fe8f1bf31bbb71c0'], eventAbi: 'event GaugeCreated (address indexed gauge)', onlyArgs: true, - fromBlock: 72942741, + fromBlock, }) - const voterProxy = '0xc181edc719480bd089b94647c2dc504e2700a2b0' // const auraBalVault = '0x4EA9317D90b61fc28C418C247ad0CA8939Bbb0e9' // const asset = await api.call({ abi: 'address:asset', target: auraBalVault }) // const bal = await api.call({ abi: 'uint256:totalAssets', target: auraBalVault }) @@ -88,4 +96,4 @@ module.exports = { api.addTokens(tokens, bals) } } -} +}) diff --git a/projects/brewlabs/index.js b/projects/brewlabs/index.js index 325d1c28ce9..19854398771 100644 --- a/projects/brewlabs/index.js +++ b/projects/brewlabs/index.js @@ -39,6 +39,7 @@ async function getStakingPools(chain, poolType) { async function _getPools() { const poolTypeStr = poolType === 'pool2' ? 'farms' : 'pools' const pools = await post(`${api_endpoint}/${poolTypeStr}`, { chainId: chains[chain]}) + console.log(pools, `brewlabs ${chain} ${poolType} pools: ${pools.length}`) setCache(`brewlabs/pools`, chain, pools) return pools } @@ -62,8 +63,7 @@ async function staking(_, _b, _cb, { api, }) { const poolInfoAbi = "function poolInfo(uint256) view returns (address lpToken, uint256, uint256, uint256, uint256, uint256, uint16, uint16)" async function pool2(_, _b, _cb, { api, }) { - const pools = (await getStakingPools(api.chain, 'pool2')).filter(i => i.contractAddress !== '0xb4d96033a260f0a0ea9c927aa1583668118c8145') - const infos = await api.multiCall({ abi: poolInfoAbi , calls: pools.map(i => ({ target: i.contractAddress, params: [0]})), permitFailure: false, }) - const tokensAndOwners = pools.map((v, i) => ([infos[i].lpToken, v.contractAddress])).filter(i => i[0]) + const pools = (await getStakingPools(api.chain, 'pool2')) + const tokensAndOwners = pools.map((v, i) => ([v.lpAddress, v.contractAddress])) return sumUnknownTokens({ api, tokensAndOwners, blacklist}) } From 0c287328740c3f19a78387983a33db53c9307073 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 12 Jul 2023 15:10:02 +0200 Subject: [PATCH 0322/1974] update golem treasury --- projects/treasury/golem.js | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/projects/treasury/golem.js b/projects/treasury/golem.js index eb1fdddc427..284adb71937 100644 --- a/projects/treasury/golem.js +++ b/projects/treasury/golem.js @@ -11,14 +11,8 @@ module.exports = treasuryExports({ tokens: [ // Ethereum Assets nullAddress, - ADDRESSES.ethereum.WETH, - ADDRESSES.ethereum.WBTC, - ADDRESSES.ethereum.USDC, - ADDRESSES.ethereum.DAI, - ADDRESSES.ethereum.WSTETH,//wsteth - "0x2b591e99afE9f32eAA6214f7B7629768c40Eeb39" //hex ], - owners: [treasury], + owners: [treasury, '0x70a0a7be87deb51e1fab16d4f2bf00be1510e476'], ownTokens: [GLM] }, }) \ No newline at end of file From 4b99f1ce53c485cc209c16e995a239d6141da14d Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 12 Jul 2023 18:40:53 +0530 Subject: [PATCH 0323/1974] refactor anyswap to be on chain (#6774) --- projects/anyswap/index.js | 84 +++++++++++++++------------------------ 1 file changed, 33 insertions(+), 51 deletions(-) diff --git a/projects/anyswap/index.js b/projects/anyswap/index.js index decb28c57a3..d094245225f 100644 --- a/projects/anyswap/index.js +++ b/projects/anyswap/index.js @@ -1,4 +1,8 @@ -const { get } = require('../helper/http') +const sdk = require('@defillama/sdk') +const { sumTokens } = require('../helper/sumTokens') +const { getConfig } = require('../helper/cache') +const ADDRESSES = require('../helper/coreAssets.json') + const chains = { '1': 'ethereum', @@ -58,67 +62,45 @@ const chains = { '32520': 'bitgert' } - - -const sleep = ms => new Promise(r => setTimeout(r, ms)); - -let coingeckoMcapsPromise - -async function getCgMcaps() { - if (!coingeckoMcapsPromise) coingeckoMcapsPromise = _getData() - return coingeckoMcapsPromise - - async function _getData() { - const protocolsInChain = await getChainData() - const protocolsWithRouters = Array.from(new Set(protocolsInChain.filter(p => p.type === "router" && p.label !== null).map(p => p.label.toLowerCase()))); - - const coingeckoMcaps = {} - const step = 200; - for (let i = 0; i < protocolsWithRouters.length; i += step) { - console.log(i / step) - const cgUrl = `https://api.coingecko.com/api/v3/simple/price?vs_currencies=usd&include_market_cap=true&ids=${protocolsWithRouters.slice(i, i + step).join(',') - }` - await sleep(1e3) - const partMcaps = await get(cgUrl) - Object.assign(coingeckoMcaps, partMcaps) - } - return coingeckoMcaps - } -} - let chainData async function getChainData() { - if (!chainData) chainData = get('https://netapi.anyswap.net/bridge/v2/info').then(i => i.bridgeList.filter(j => j.amount > 0)) + if (!chainData) chainData = getConfig('anyswap-config', 'https://netapi.anyswap.net/bridge/v2/info').then(i => i.bridgeList.filter(j => j.amount > 0)) return chainData } +const blacklistedTokens = [ + '0xc342774492b54ce5f8ac662113ed702fc1b34972' // BGEO +] + +const EXECUTOR = '0x2A038e100F8B85DF21e4d44121bdBfE0c288A869' +const NEW_ADDR = '0x1eed63efba5f81d95bfe37d82c8e736b974f477b' + function fetchChain(chain) { - return async () => { + return async (_, _1, _2, { api }) => { const data = await getChainData() const protocolsInChain = chain === null ? data : data.filter(p => p.srcChainId.toString() === chain.toString()) - - const coingeckoMcaps = await getCgMcaps(); - const counted = {} - let total = 0 + const tokensAndOwners = [] protocolsInChain.forEach((item) => { - const tvl = Number(item.tvl || 0) - if (item.type === "bridge") { - total += tvl - } else if (item.type === "router") { - const label = item.label - const mcap = coingeckoMcaps[label]?.usd_market_cap - if (counted[label] === undefined) { - counted[label] = 0 + let token = item.srcToken + let owner = item.depositAddr + if (owner.startsWith("0x") && !token.startsWith("0x")) { + sdk.log(chain, 'replace', token, 'with null') + token = ADDRESSES.null } - if (mcap !== undefined && mcap > counted[label]) { - const tvlToAdd = Math.min(tvl, mcap - counted[label]) - total += tvlToAdd - counted[label] += tvlToAdd + tokensAndOwners.push([token, owner]) + tokensAndOwners.push([token, EXECUTOR]) + // tokensAndOwners.push([token, NEW_ADDR]) + } else if (item.type === "router") { + if (item.token === item.srcToken && item.underlying) { + tokensAndOwners.push([item.underlying, item.token]) + tokensAndOwners.push([item.underlying, EXECUTOR]) + // tokensAndOwners.push([item.underlying, NEW_ADDR]) } } }) - return total + + return sumTokens({ api, tokensAndOwners, blacklistedTokens, }) } } @@ -127,7 +109,7 @@ const chainTvls = {} Object.keys(chains).forEach((chain) => { const chainName = chains[chain] chainTvls[chainName] = { - fetch: fetchChain(chain) + tvl: fetchChain(chain) } }) @@ -135,8 +117,8 @@ module.exports = { misrepresentedTokens: true, timetravel: false, ...chainTvls, - fetch: fetchChain(null), - hallmarks:[ + // fetch: fetchChain(null), + hallmarks: [ [1651881600, "UST depeg"], ], } From 318e79afe74251fa5cffaa399ddc5ac34ef54d2f Mon Sep 17 00:00:00 2001 From: m00n <93987216+0xm00neth@users.noreply.github.com> Date: Wed, 12 Jul 2023 10:18:09 -0500 Subject: [PATCH 0324/1974] list blur vault for spice finance (#6786) --- projects/spice-finance/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/spice-finance/index.js b/projects/spice-finance/index.js index a343b0b0e69..a5e83ababe8 100644 --- a/projects/spice-finance/index.js +++ b/projects/spice-finance/index.js @@ -2,6 +2,7 @@ const vaults = [ '0xAe11ae7CaD244dD1d321Ff2989543bCd8a6Db6DF', // Flagship '0xd68871bd7D28572860b2E0Ee5c713b64445104F9', // Leverage '0x6110d61DD1133b0f845f1025d6678Cd22A11a2fe', // VIP + '0xfC287513E2DD58fbf952eB0ED05D511591a6215B', // Blur ] async function tvl(_1, _2, chainBlocks, { api }) { From 44b14e5e282e11fc678781c19a9956fc89033880 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 12 Jul 2023 21:18:47 +0200 Subject: [PATCH 0325/1974] uniswap: track avax --- projects/uniswap/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/uniswap/index.js b/projects/uniswap/index.js index c7076c493e0..2d44b64835c 100644 --- a/projects/uniswap/index.js +++ b/projects/uniswap/index.js @@ -9,6 +9,7 @@ const graphs = { polygon: "https://api.thegraph.com/subgraphs/name/ianlapham/uniswap-v3-polygon", celo: "https://api.thegraph.com/subgraphs/name/jesse-sawa/uniswap-celo", bsc: "https://api.thegraph.com/subgraphs/name/ianlapham/uniswap-v3-bsc", + avax: "https://api.thegraph.com/subgraphs/name/lynnshaoyu/uniswap-v3-avax", } const blacklists = { @@ -74,7 +75,7 @@ module.exports = { ] } -const chains = ['ethereum', 'arbitrum', 'optimism', 'polygon', 'celo', 'bsc'] +const chains = ['ethereum', 'arbitrum', 'optimism', 'polygon', 'celo', 'bsc', 'avax'] chains.forEach(chain => { module.exports[chain] = { From f5a4875799dfd969d3ec05f4aef42c3806bcf2d8 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Thu, 13 Jul 2023 03:23:38 +0100 Subject: [PATCH 0326/1974] add hallmark --- projects/zodiac/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/zodiac/index.js b/projects/zodiac/index.js index ed36b5a41cf..65949d4dc7b 100644 --- a/projects/zodiac/index.js +++ b/projects/zodiac/index.js @@ -7,6 +7,9 @@ const Staking = "0x1450d20E99F7e8c27864a8D9e6E3d0694ed567DA"; const ZD = "0x98051143830fa99848E7059E97AcB03B3cc62403"; const ZD_USDT_POOL = "0x4cb107576c7f3d59e3355ce760af5cbc36cf5e0d"; +module.exports.hallmarks=[ + [1641254400,"Rug Pull"] +], module.exports = ohmTvl(treasuryAddress, [ [USDT, false], [ZD_USDT_POOL, true], From 9eda4a217df4ecbd46ede6e9e7a20719b9744d42 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 13 Jul 2023 12:52:26 +0530 Subject: [PATCH 0327/1974] Update how secrets are fetched (#6787) --- projects/helper/chain/aptos.js | 18 +++++++-------- projects/helper/chain/bitcoin.js | 4 ++-- projects/helper/chain/sui.js | 12 +++++----- projects/helper/env.js | 39 ++++++++++++++++++++++++-------- projects/helper/http.js | 7 +++--- projects/helper/solana.js | 24 ++++++++++---------- projects/helper/utils.js | 8 +++---- projects/lofty/index.js | 4 ++-- projects/olympus/index.js | 5 ++-- 9 files changed, 69 insertions(+), 52 deletions(-) diff --git a/projects/helper/chain/aptos.js b/projects/helper/chain/aptos.js index 03a26303f15..d820b393e8e 100644 --- a/projects/helper/chain/aptos.js +++ b/projects/helper/chain/aptos.js @@ -2,24 +2,24 @@ const sdk = require('@defillama/sdk') const http = require('../http') -const env = require('../env') +const { getEnv } = require('../env') const coreTokensAll = require('../coreAssets.json') const { transformBalances } = require('../portedTokens') const { log, getUniqueAddresses } = require('../utils') const coreTokens = Object.values(coreTokensAll.aptos) -const endpoint = env.APTOS_RPC || "https://aptos-mainnet.pontem.network" +const endpoint = () => getEnv('APTOS_RPC') async function aQuery(api) { - return http.get(`${endpoint}${api}`) + return http.get(`${endpoint()}${api}`) } async function getResources(account) { const data = [] let lastData let cursor do { - let url = `${endpoint}/v1/accounts/${account}/resources?limit=9999` + let url = `${endpoint()}/v1/accounts/${account}/resources?limit=9999` if (cursor) url += '&start=' + cursor const res = await http.getWithMetadata(url) lastData = res.data @@ -31,14 +31,14 @@ async function getResources(account) { } async function getResource(account, key) { - let url = `${endpoint}/v1/accounts/${account}/resource/${key}` + let url = `${endpoint()}/v1/accounts/${account}/resource/${key}` const { data } = await http.get(url) return data } async function getCoinInfo(address) { if (address === '0x1') return { data: { decimals: 8, name: 'Aptos' } } - return http.get(`${endpoint}/v1/accounts/${address}/resource/0x1::coin::CoinInfo%3C${address}::coin::T%3E`) + return http.get(`${endpoint()}/v1/accounts/${address}/resource/0x1::coin::CoinInfo%3C${address}::coin::T%3E`) } function dexExport({ @@ -95,12 +95,12 @@ async function sumTokens({ balances = {}, owners = [] }) { } async function getTableData({ table, data }) { - const response = await http.post(`${endpoint}/v1/tables/${table}/item`, data) + const response = await http.post(`${endpoint()}/v1/tables/${table}/item`, data) return response } async function function_view({ functionStr, type_arguments = [], args = [] }) { - const response = await http.post(`${endpoint}/v1/view`, { "function": functionStr, "type_arguments": type_arguments, arguments:args }) + const response = await http.post(`${endpoint()}/v1/view`, { "function": functionStr, "type_arguments": type_arguments, arguments:args }) return response } @@ -121,7 +121,7 @@ function hexToString(hexString) { } module.exports = { - endpoint, + endpoint: endpoint(), dexExport, aQuery, getCoinInfo, diff --git a/projects/helper/chain/bitcoin.js b/projects/helper/chain/bitcoin.js index bcf8cbe23ea..b2a8563aebd 100644 --- a/projects/helper/chain/bitcoin.js +++ b/projects/helper/chain/bitcoin.js @@ -1,6 +1,6 @@ const sdk = require('@defillama/sdk') const { get } = require('../http') -const env = require('../env') +const { getEnv } = require('../env') const url = addr => 'https://blockstream.info/api/address/' + addr @@ -34,7 +34,7 @@ async function getBalance(addr, timestamp) { if (!timestamp || (now - timestamp) < delay) return balance - let endpoint = `https://btc.getblock.io/${env.GETBLOCK_KEY}/mainnet/blockbook/api/v2/balancehistory/${addr}?fiatcurrency=btc&groupBy=86400&from=${timestamp}` + let endpoint = `https://btc.getblock.io/${getEnv('GETBLOCK_KEY')}/mainnet/blockbook/api/v2/balancehistory/${addr}?fiatcurrency=btc&groupBy=86400&from=${timestamp}` const response = await get(endpoint) response.forEach(({ sent, received }) => balance += sent / 1e8 - received / 1e8) diff --git a/projects/helper/chain/sui.js b/projects/helper/chain/sui.js index 9123b4f4921..a90941f0f24 100644 --- a/projects/helper/chain/sui.js +++ b/projects/helper/chain/sui.js @@ -2,13 +2,13 @@ const sdk = require('@defillama/sdk') const http = require('../http') -const env = require('../env') +const { getEnv } = require('../env') const { transformDexBalances } = require('../portedTokens') const { sliceIntoChunks } = require('../utils') //https://docs.sui.io/sui-jsonrpc -const endpoint = env.SUI_RPC || "https://fullnode.mainnet.sui.io/" +const endpoint = () => getEnv('SUI_RPC') async function getObject(objectId) { return (await call('sui_getObject', [objectId, { @@ -40,7 +40,7 @@ async function getObjects(objectIds) { } const { result - } = await http.post(endpoint, { + } = await http.post(endpoint(), { jsonrpc: "2.0", id: 1, method: 'sui_multiGetObjects', params: [objectIds, { "showType": true, "showOwner": true, @@ -60,7 +60,7 @@ async function getDynamicFieldObject(parent, id) { async function getDynamicFieldObjects({ parent, cursor = null, limit = 48, items = [], idFilter = i => i, addedIds = new Set() }) { const { result: { data, hasNextPage, nextCursor } - } = await http.post(endpoint, { jsonrpc: "2.0", id: 1, method: 'suix_getDynamicFields', params: [parent, cursor, limit], }) + } = await http.post(endpoint(), { jsonrpc: "2.0", id: 1, method: 'suix_getDynamicFields', params: [parent, cursor, limit], }) sdk.log('[sui] fetched items length', data.length, hasNextPage, nextCursor) const fetchIds = data.filter(idFilter).map(i => i.objectId).filter(i => !addedIds.has(i)) fetchIds.forEach(i => addedIds.add(i)) @@ -74,7 +74,7 @@ async function call(method, params, { withMetadata = false} = {}) { if (!Array.isArray(params)) params = [params] const { result - } = await http.post(endpoint, { jsonrpc: "2.0", id: 1, method, params, }) + } = await http.post(endpoint(), { jsonrpc: "2.0", id: 1, method, params, }) return withMetadata ? result : result.data } @@ -131,7 +131,7 @@ function dexExport({ } module.exports = { - endpoint, + endpoint: endpoint(), call, multiCall, getObject, diff --git a/projects/helper/env.js b/projects/helper/env.js index 483f825597d..fe0419c1413 100644 --- a/projects/helper/env.js +++ b/projects/helper/env.js @@ -1,13 +1,32 @@ -const env = process.env +const BOOL_KEYS = [ + 'HISTORICAL', + 'LLAMA_DEBUG_MODE', +] + +const ENV_KEYS = [ + ...BOOL_KEYS, + 'GETBLOCK_KEY', + 'SOLANA_RPC', + 'APTOS_RPC', + 'SUI_RPC', + 'LOFTY_API', + 'COVALENT_KEY', + 'OLYMPUS_GRAPH_API_KEY', +] + +const DEFAULTS = { + COVALENT_KEY: 'ckey_72cd3b74b4a048c9bc671f7c5a6', + SOLANA_RPC: 'https://try-rpc.mainnet.solana.blockdaemon.tech', + APTOS_RPC: 'https://aptos-mainnet.pontem.network', + SUI_RPC: 'https://fullnode.mainnet.sui.io/', +} + +function getEnv(key) { + if (!ENV_KEYS.includes(key)) throw new Error(`Unknown env key: ${key}`) + const value = process.env[key] ?? DEFAULTS[key] + return BOOL_KEYS.includes(key) ? !!value : value +} module.exports = { - HISTORICAL: !!env.HISTORICAL, - LLAMA_DEBUG_MODE: !!env.LLAMA_DEBUG_MODE, - GETBLOCK_KEY: env.GETBLOCK_KEY, - SOLANA_RPC: env.SOLANA_RPC, - APTOS_RPC: env.APTOS_RPC, - SUI_RPC: env.SUI_RPC, - LOFTY_API: env.LOFTY_API, - COVALENT_KEY: env.COVALENT_KEY, - OLYMPUS_GRAPH_API_KEY: env.OLYMPUS_GRAPH_API_KEY, + getEnv, } \ No newline at end of file diff --git a/projects/helper/http.js b/projects/helper/http.js index adc522911b0..cdae512f942 100644 --- a/projects/helper/http.js +++ b/projects/helper/http.js @@ -1,9 +1,8 @@ const axios = require("axios") const { request, GraphQLClient, } = require("graphql-request") const sdk = require('@defillama/sdk') -const env = require('./env') +const { getEnv } = require('./env') const { getCache: cGetCache, setCache } = require('./cache') -const COVALENT_KEY = env.COVALENT_KEY ?? 'ckey_72cd3b74b4a048c9bc671f7c5a6' const chainIds = { 'ethereum': 1, @@ -23,7 +22,7 @@ async function getCache(endpoint) { } async function getBlock(timestamp, chain, chainBlocks, undefinedOk = false) { - if (chainBlocks[chain] || (!env.HISTORICAL && undefinedOk)) { + if (chainBlocks[chain] || (!getEnv('HISTORICAL') && undefinedOk)) { return chainBlocks[chain] } else { if (chain === "celo") { @@ -74,7 +73,7 @@ async function covalentGetTokens(address, chain = 'ethereum') { async function _covalentGetTokens() { const { data: { items } - } = await get(`https://api.covalenthq.com/v1/${chainId}/address/${address}/balances_v2/?&key=${COVALENT_KEY}`) + } = await get(`https://api.covalenthq.com/v1/${chainId}/address/${address}/balances_v2/?&key=${getEnv('COVALENT_KEY')}`) let table = {} items .filter(i => +i.balance > 0) diff --git a/projects/helper/solana.js b/projects/helper/solana.js index d8c053dbd31..e7e2a773128 100644 --- a/projects/helper/solana.js +++ b/projects/helper/solana.js @@ -1,7 +1,7 @@ const ADDRESSES = require('./coreAssets.json') const axios = require("axios"); const http = require('./http') -const env = require('./env') +const { getEnv } = require('./env') const { transformBalances: transformBalancesOrig, transformDexBalances, } = require('./portedTokens.js') const { getUniqueAddresses } = require('./tokenMapping') const { Connection, PublicKey, Keypair } = require("@solana/web3.js") @@ -21,10 +21,10 @@ const blacklistedTokens_default = [ let connection, provider -const endpoint = env.SOLANA_RPC || "https://try-rpc.mainnet.solana.blockdaemon.tech" +const endpoint = () => getEnv('SOLANA_RPC') function getConnection() { - if (!connection) connection = new Connection(endpoint) + if (!connection) connection = new Connection(endpoint()) return connection } @@ -46,7 +46,7 @@ async function getSolBalances(accounts) { const tokenBalances = [] const chunks = sliceIntoChunks(accounts, 99) for (let chunk of chunks) { - const bal = await axios.post(endpoint, chunk.map(formBody)) + const bal = await axios.post(endpoint(), chunk.map(formBody)) tokenBalances.push(...bal.data) } return tokenBalances.reduce((a, i) => a + i.result.value, 0) @@ -59,7 +59,7 @@ async function getSolBalance(account) { const TOKEN_LIST_URL = "https://cdn.jsdelivr.net/gh/solana-labs/token-list@main/src/tokens/solana.tokenlist.json" async function getTokenSupply(token) { - const tokenSupply = await axios.post(endpoint, { + const tokenSupply = await axios.post(endpoint(), { jsonrpc: "2.0", id: 1, method: "getTokenSupply", @@ -88,7 +88,7 @@ async function getTokenDecimals(tokens) { const res = {} const chunks = sliceIntoChunks(tokens, 99) for (const chunk of chunks) { - const tokenSupply = await axios.post(endpoint, calls(chunk)) + const tokenSupply = await axios.post(endpoint(), calls(chunk)) tokenSupply.data.forEach(({ id, result }) => res[id] = result.value.decimals) } return res @@ -107,7 +107,7 @@ function formTokenBalanceQuery(token, account) { } } async function getTokenBalance(token, account) { - const tokenBalance = await axios.post(endpoint, formTokenBalanceQuery(token, account)); + const tokenBalance = await axios.post(endpoint(), formTokenBalanceQuery(token, account)); return tokenBalance.data.result.value.reduce( (total, account) => total + account.account.data.parsed.info.tokenAmount.uiAmount, @@ -117,7 +117,7 @@ async function getTokenBalance(token, account) { async function getTokenBalances(tokensAndAccounts) { const body = tokensAndAccounts.map(([token, account]) => formTokenBalanceQuery(token, account)) - const tokenBalances = await axios.post(endpoint, body); + const tokenBalances = await axios.post(endpoint(), body); const balances = {} tokenBalances.data.forEach((v, i )=> { if (!v.result) console.log(v, tokensAndAccounts[i]) @@ -138,7 +138,7 @@ async function getTokenAccountBalances(tokenAccounts, { individual = false, chun const chunks = sliceIntoChunks(tokenAccounts, chunkSize) for (const chunk of chunks) { const body = chunk.map(formBody) - const data = await axios.post(endpoint, body); + const data = await axios.post(endpoint(), body); data.data.forEach(({ result: { value } }, i) => { if (!value || !value.data.parsed) { if (tokenAccounts[i].toString() === '11111111111111111111111111111111') { @@ -164,7 +164,7 @@ async function getTokenAccountBalances(tokenAccounts, { individual = false, chun async function getTokenAccountBalance(account) { const tokenBalance = await axios.post( - endpoint, + endpoint(), { jsonrpc: "2.0", id: 1, @@ -210,7 +210,7 @@ async function getMultipleAccountsRaw(accountsArray) { const res = [] const chunks = sliceIntoChunks(accountsArray, 99) for (const chunk of chunks) { - const accountsInfo = await axios.post(endpoint, { + const accountsInfo = await axios.post(endpoint(), { jsonrpc: "2.0", id: 1, method: "getMultipleAccounts", @@ -391,7 +391,7 @@ function readBigUInt64LE(buffer, offset) { } module.exports = { - endpoint, + endpoint: endpoint(), getTokenSupply, getTokenBalance, getTokenAccountBalance, diff --git a/projects/helper/utils.js b/projects/helper/utils.js index a2243c17402..7b68ec4a0f7 100644 --- a/projects/helper/utils.js +++ b/projects/helper/utils.js @@ -3,7 +3,7 @@ const BigNumber = require("bignumber.js"); const axios = require("axios"); const sdk = require('@defillama/sdk') const http = require('./http') -const env = require('./env') +const { getEnv } = require('./env') const erc20 = require('./abis/erc20.json') async function returnBalance(token, address, block, chain) { @@ -144,7 +144,7 @@ function getUniqueAddresses(addresses, isCaseSensitive = false) { return [...set] } -const DEBUG_MODE = env.LLAMA_DEBUG_MODE +const DEBUG_MODE = () => getEnv('LLAMA_DEBUG_MODE') const log = sdk.log function sliceIntoChunks(arr, chunkSize = 100) { @@ -167,7 +167,7 @@ function stripTokenHeader(token) { } async function diplayUnknownTable({ tvlResults = {}, tvlBalances = {}, storedKey = 'ethereum', tableLabel = 'Unrecognized tokens' }) { - if (!DEBUG_MODE) return; + if (!DEBUG_MODE()) return; const balances = {} storedKey = storedKey.split('-')[0] Object.entries(tvlResults.tokenBalances).forEach(([label, balance]) => { @@ -215,7 +215,7 @@ async function getDecimals(chain, tokens) { } async function debugBalances({ balances = {}, chain, log = false, tableLabel = '', withETH = true }) { - if (!DEBUG_MODE && !log) return; + if (!DEBUG_MODE() && !log) return; if (!Object.keys(balances).length) return; const labelMapping = {} diff --git a/projects/lofty/index.js b/projects/lofty/index.js index a91bbd652f7..c3597c946f8 100644 --- a/projects/lofty/index.js +++ b/projects/lofty/index.js @@ -1,6 +1,6 @@ const { toUSDTBalances } = require('../helper/balances'); -const { LOFTY_API } = require('../helper/env'); +const { getEnv } = require('../helper/env'); const axios = require("axios"); const LoftyTVLApi = "https://partners.lofty.ai/properties/v2/valuations"; @@ -9,7 +9,7 @@ async function loftyTVL() { const response = ( await axios.get(LoftyTVLApi, { headers: { - 'X-API-Key': LOFTY_API + 'X-API-Key': getEnv('LOFTY_API') } }) ).data.data; diff --git a/projects/olympus/index.js b/projects/olympus/index.js index eb4c2eb581c..da2f70e5839 100644 --- a/projects/olympus/index.js +++ b/projects/olympus/index.js @@ -1,7 +1,6 @@ const ADDRESSES = require('../helper/coreAssets.json') -const sdk = require("@defillama/sdk"); const { blockQuery } = require("../helper/http"); -const env = require("../helper/env"); +const { getEnv } = require("../helper/env"); const { staking } = require('../helper/staking'); const { sumTokens2 } = require("../helper/unwrapLPs"); @@ -65,7 +64,7 @@ query { }`; const subgraphUrls = { - ethereum: `https://gateway.thegraph.com/api/${env.OLYMPUS_GRAPH_API_KEY}/subgraphs/id/DTcDcUSBRJjz9NeoK5VbXCVzYbRTyuBwdPUqMi8x32pY`, + ethereum: `https://gateway.thegraph.com/api/${getEnv('OLYMPUS_GRAPH_API_KEY')}/subgraphs/id/DTcDcUSBRJjz9NeoK5VbXCVzYbRTyuBwdPUqMi8x32pY`, arbitrum: "https://api.thegraph.com/subgraphs/name/olympusdao/protocol-metrics-arbitrum", fantom: From 3daf143c3bb750d9b8744a3a0fad9fa7e69b2e7c Mon Sep 17 00:00:00 2001 From: kavsky02 <95619352+kavsky02@users.noreply.github.com> Date: Thu, 13 Jul 2023 09:26:03 +0200 Subject: [PATCH 0328/1974] Add new tokens to DeltaPrime adapter (#6789) * Add SteakHut tokens * Add new tokens * Fix JSON --- projects/deltaprime/mappings/assetToAddressMapping.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/projects/deltaprime/mappings/assetToAddressMapping.json b/projects/deltaprime/mappings/assetToAddressMapping.json index 6fe5809efd2..3bd2b801b92 100644 --- a/projects/deltaprime/mappings/assetToAddressMapping.json +++ b/projects/deltaprime/mappings/assetToAddressMapping.json @@ -5,6 +5,8 @@ "ETH": "0x49d5c2bdffac6ce2bfdb6640f4f80f226bc10bab", "BTC": "0x152b9d0FdC40C096757F570A51E494bd4b943E50", "USDT": "0x9702230a8ea53601f5cd2dc00fdbc13d4df4a8c7", + "EUROC": "0xC891EB4cbdEFf6e073e859e987815Ed1505c2ACD", + "GMX": "0x62edc0692BD897D2295872a9FFCac5425011c661", "QI": "0x8729438eb15e2c8b576fcc6aecda6a148776c0f5", "PNG": "0x60781C2586D68229fde47564546784ab3fACA982", "PTP": "0x22d4002028f537599bE9f666d1c4Fa138522f9c8", @@ -38,8 +40,7 @@ "crvUSDBTCETH": "0x1daB6560494B04473A0BE3E7D83CF3Fdf3a51828", "SHLB_AVAX-USDC_B": "0x668530302c6ecc4ebe693ec877b79300ac72527c", "SHLB_BTC.b-AVAX_B": "0x536d7e7423e8fb799549caf574cfa12aae95ffcd", - "GMX": "0x62edc0692bd897d2295872a9ffcac5425011c661", - "EUROC": "0xc891eb4cbdeff6e073e859e987815ed1505c2acd", + "SHLB_JOE-AVAX_B": "0x89547441489262feb5cee346fdacb9037c2574db", "SHLB_EUROC-USDC_V2_1_B": "0x638f969675822dfae4566b44d0f2a11362fbed52", "SHLB_USDT.e-USDt_C": "0x9f44e67ba256c18411bb041375e572e3dd11fa72" } \ No newline at end of file From db7fc05684ed90706a8d9c9de50ef28541b5ad24 Mon Sep 17 00:00:00 2001 From: Rafael Albuquerque <70333411+albuquerque-rafael@users.noreply.github.com> Date: Thu, 13 Jul 2023 03:55:55 -0400 Subject: [PATCH 0329/1974] feat(hidden-hand): add hidden hand tvl (#6779) * feat(hidden-hand): add hidden hand tvl * code refactor * fix(hidden-hand): change subgraph url --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/hidden-hand/index.js | 84 +++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 projects/hidden-hand/index.js diff --git a/projects/hidden-hand/index.js b/projects/hidden-hand/index.js new file mode 100644 index 00000000000..8f9deeb7afd --- /dev/null +++ b/projects/hidden-hand/index.js @@ -0,0 +1,84 @@ +const { sumTokens2 } = require('../helper/unwrapLPs') +const { cachedGraphQuery } = require('../helper/cache') + +const protocol_contracts = { + ethereum: { + v1: { + distributor: "0x0b139682d5c9df3e735063f46fb98c689540cf3a", + vault: "0x9DDb2da7Dd76612e0df237B89AF2CF4413733212", + }, + v2: { + distributor: "0xa9b08B4CeEC1EF29EdEC7F9C94583270337D6416", + vault: "0xE00fe722e5bE7ad45b1A16066E431E47Df476CeC", + harvester: "0xd23aa7EdF42CD3Fc4CD391faAbc0c207B1c86542", + }, + }, + optimism: { + v1: { + distributor: "0x0b139682d5c9df3e735063f46fb98c689540cf3a", + vault: "0x9DDb2da7Dd76612e0df237B89AF2CF4413733212", + }, + v2: { + distributor: "0x7354BB6842E421773E7b78f8875A1B85991677c0", + vault: "0xa9b08B4CeEC1EF29EdEC7F9C94583270337D6416", + harvester: "0x4573F58461acd1a6C743d9CDE34A142Ca18B6873", + }, + }, + arbitrum: { + v2: { + distributor: "0x0A390DE04B7717B078CF5c8A7Eb891130d4a843b", + vault: "0x8d89593c199Cb763bDEF04529F978f82503E4669", + harvester: "0xcA795Dc6f668add4801D2B92cF36C8FBcBEb8Ac4", + }, + }, +}; + +const subgraphs = { + ethereum: { + v1: "https://api.thegraph.com/subgraphs/name/albuquerque-rafael/hidden-hand", + v2: "https://api.thegraph.com/subgraphs/name/albuquerque-rafael/hidden-hand-v2", + }, + optimism: { + v1: "https://api.thegraph.com/subgraphs/name/albuquerque-rafael/hidden-hand-v1-optimism", + v2: "https://api.thegraph.com/subgraphs/name/albuquerque-rafael/hidden-hand-v2-optimism", + }, + arbitrum: { + v2: "https://api.thegraph.com/subgraphs/name/albuquerque-rafael/hidden-hand-v2-arbitrum", + }, +}; + +async function getTokens(chain, version) { + const graphQuery = ` + { + tokens { + address + } + } + `; + + const { tokens } = await cachedGraphQuery(`hidden-hand/${chain}-${version}`, subgraphs[chain][version], graphQuery); + const addresses = tokens.map((token) => token.address); + + return addresses; +} + +async function tvl(ts, block, _, { api }) { + const { chain } = api + const ownerTokens = [] + + for (const version of Object.keys(protocol_contracts[chain])) { + const tokens = await getTokens(chain, version); + for (const owner of Object.values(protocol_contracts[chain][version])) { + ownerTokens.push([tokens, owner]) + } + } + + return sumTokens2({ api, ownerTokens, permitFailure: true, }); +} + +module.exports = { + methodology: `Sums bribe tokens deposited on Hidden Hand Reward Distributors, Bribe Vaults and Harvester contracts.`, + ethereum: { tvl }, + optimism: { tvl }, + arbitrum: { tvl }, +}; From a91e89648db67b6d6779dc51c4fbb4373f7a0093 Mon Sep 17 00:00:00 2001 From: chainupk <121842069+chainupk@users.noreply.github.com> Date: Thu, 13 Jul 2023 16:09:37 +0800 Subject: [PATCH 0330/1974] updated nodedao etehreum tvl calculations (#6785) Co-authored-by: zhenhao goh --- projects/node-dao/index.js | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/projects/node-dao/index.js b/projects/node-dao/index.js index 6c70f489ace..e19286cb848 100644 --- a/projects/node-dao/index.js +++ b/projects/node-dao/index.js @@ -3,9 +3,31 @@ const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') module.exports = { ethereum: { tvl: async (_, _1, _2, { api }) => { - const owner = '0x8103151E2377e78C04a3d2564e20542680ed3096' - const totalEth = await api.call({ abi: 'uint256:getTotalEthValue', target: owner }) - api.add(nullAddress,totalEth) + // nodeDAO v0 validator nft + const nodeDaoV0ValidatorNFT = '0x40Cd77D9aa9e0b2D485259415eA05486B201c514' + const v0VdalitorsNumber = await api.call({ abi: 'uint256:totalSupply', target: nodeDaoV0ValidatorNFT }) + + // nodeDAO liquidStaking + const nodeDaoLiquidStaking = '0x8103151E2377e78C04a3d2564e20542680ed3096' + const nethTVL = await api.call({ abi: 'uint256:getTotalEthValue', target: nodeDaoLiquidStaking }) + + // nodeDAO v1 validator nft + const nodeDaoV1ValidatorNFT = '0x58553F5c5a6AEE89EaBFd42c231A18aB0872700d' + const v1Vdalitors = await api.call({ abi: 'uint256[]:activeNftsOfUser', target: nodeDaoV1ValidatorNFT }) + + // nodeDAO totalEth = nethTVL + (v1ValidatorNumber + v0VdalitorsNumber)* 32 eth + let totalEth = parseInt(nethTVL) + (v1Vdalitors.length + parseInt(v0VdalitorsNumber)) * 32_000_000_000_000_000_000 + + // nodeDAO largeStaking + const nodeDaoLargeStaking = '0xBBd19e8F766Dcc94D50e47502b79C81cdaD484B8' + const nodeOperatorRegistry = '0x8742178Ac172eC7235E54808d5F327C30A51c492' + const operatorNumbers = await api.call({ abi: 'uint256:getNodeOperatorsCount', target: nodeOperatorRegistry }) + for (let i = 1; i <= operatorNumbers; i++) { + const validatorNumbers = await api.call({ abi: 'function getOperatorValidatorCounts(uint256 _operatorId) external view returns (uint256)', target: nodeDaoLargeStaking, params: [i] }) + totalEth += parseInt(validatorNumbers) * 32_000_000_000_000_000_000 + } + + api.add(nullAddress, totalEth) } } -} \ No newline at end of file +} From 1f8bae9b07cdd5433467b888ed159f8d93428078 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 13 Jul 2023 13:59:48 +0530 Subject: [PATCH 0331/1974] Revert "updated nodedao etehreum tvl calculations (#6785)" (#6793) This reverts commit a91e89648db67b6d6779dc51c4fbb4373f7a0093. --- projects/node-dao/index.js | 30 ++++-------------------------- 1 file changed, 4 insertions(+), 26 deletions(-) diff --git a/projects/node-dao/index.js b/projects/node-dao/index.js index e19286cb848..6c70f489ace 100644 --- a/projects/node-dao/index.js +++ b/projects/node-dao/index.js @@ -3,31 +3,9 @@ const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') module.exports = { ethereum: { tvl: async (_, _1, _2, { api }) => { - // nodeDAO v0 validator nft - const nodeDaoV0ValidatorNFT = '0x40Cd77D9aa9e0b2D485259415eA05486B201c514' - const v0VdalitorsNumber = await api.call({ abi: 'uint256:totalSupply', target: nodeDaoV0ValidatorNFT }) - - // nodeDAO liquidStaking - const nodeDaoLiquidStaking = '0x8103151E2377e78C04a3d2564e20542680ed3096' - const nethTVL = await api.call({ abi: 'uint256:getTotalEthValue', target: nodeDaoLiquidStaking }) - - // nodeDAO v1 validator nft - const nodeDaoV1ValidatorNFT = '0x58553F5c5a6AEE89EaBFd42c231A18aB0872700d' - const v1Vdalitors = await api.call({ abi: 'uint256[]:activeNftsOfUser', target: nodeDaoV1ValidatorNFT }) - - // nodeDAO totalEth = nethTVL + (v1ValidatorNumber + v0VdalitorsNumber)* 32 eth - let totalEth = parseInt(nethTVL) + (v1Vdalitors.length + parseInt(v0VdalitorsNumber)) * 32_000_000_000_000_000_000 - - // nodeDAO largeStaking - const nodeDaoLargeStaking = '0xBBd19e8F766Dcc94D50e47502b79C81cdaD484B8' - const nodeOperatorRegistry = '0x8742178Ac172eC7235E54808d5F327C30A51c492' - const operatorNumbers = await api.call({ abi: 'uint256:getNodeOperatorsCount', target: nodeOperatorRegistry }) - for (let i = 1; i <= operatorNumbers; i++) { - const validatorNumbers = await api.call({ abi: 'function getOperatorValidatorCounts(uint256 _operatorId) external view returns (uint256)', target: nodeDaoLargeStaking, params: [i] }) - totalEth += parseInt(validatorNumbers) * 32_000_000_000_000_000_000 - } - - api.add(nullAddress, totalEth) + const owner = '0x8103151E2377e78C04a3d2564e20542680ed3096' + const totalEth = await api.call({ abi: 'uint256:getTotalEthValue', target: owner }) + api.add(nullAddress,totalEth) } } -} +} \ No newline at end of file From a0fc3ada9487e82a4a25b97bc8b74cb6ffd179f0 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 13 Jul 2023 10:35:07 +0200 Subject: [PATCH 0332/1974] fix helio money --- projects/helio-money/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/projects/helio-money/index.js b/projects/helio-money/index.js index 8969efde6bd..accb969050e 100644 --- a/projects/helio-money/index.js +++ b/projects/helio-money/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokensExport, } = require('../helper/unknownTokens') module.exports = { @@ -7,8 +8,9 @@ module.exports = { //[1670544000,"aBNBc to AnkrBNB swap & HAY buyback"] ], bsc: { - tvl: sumTokensExport({ chain: 'bsc', owner: '0x25b21472c073095bebC681001Cbf165f849eEe5E', tokens: [ + tvl: sumTokensExport({ owner: '0x25b21472c073095bebC681001Cbf165f849eEe5E', tokens: [ '0x52F24a5e03aee338Da5fd9Df68D2b6FAe1178827', // ankrBNB + ADDRESSES.null, ] }), } } From e6953164bada28d2227a3a3e74fd22a12b2cea0e Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 13 Jul 2023 10:39:47 +0200 Subject: [PATCH 0333/1974] fix nexon --- projects/helper/compound.js | 2 +- projects/nexon/index.js | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/projects/helper/compound.js b/projects/helper/compound.js index fa243b8d283..d819e42f83d 100644 --- a/projects/helper/compound.js +++ b/projects/helper/compound.js @@ -172,7 +172,7 @@ function getCompoundV2Tvl(comptroller, chain, transformAdress, await unwrapUniswapLPs(balances, lpPositions, block, chain, transformAdress) } - if (resolveLPs) return unwrapLPsAuto({ balances, block, chain}) + if (resolveLPs) return unwrapLPsAuto({ balances, block, chain, abis}) return balances; } diff --git a/projects/nexon/index.js b/projects/nexon/index.js index f592935d29a..aa8d221b218 100644 --- a/projects/nexon/index.js +++ b/projects/nexon/index.js @@ -3,6 +3,9 @@ const { nullAddress } = require('../helper/tokenMapping'); module.exports = { era: compoundExports('0x0171cA5b372eb510245F5FA214F5582911934b3D', 'era', '0x1BbD33384869b30A323e15868Ce46013C82B86FB', nullAddress, undefined, undefined, { - resolveLPs: false + resolveLPs: true, + abis: { + getReservesABI: 'function getReserves() view returns (uint112 _reserve0, uint112 _reserve1)' + } }), }; \ No newline at end of file From 3f44d74f0f9c0a9796ce1382bbf39d63765b1715 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 13 Jul 2023 11:44:51 +0200 Subject: [PATCH 0334/1974] fix liqwid --- projects/liqwid/index.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/projects/liqwid/index.js b/projects/liqwid/index.js index 65cacb68166..cb366728f25 100644 --- a/projects/liqwid/index.js +++ b/projects/liqwid/index.js @@ -63,9 +63,6 @@ const query = `{ market { scripts { actionToken { - assetClass { - name - } script { value0 { value0 From 3654ed505bbe8db4c6b239c68f6b0a40fc26fc60 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 13 Jul 2023 12:28:08 +0200 Subject: [PATCH 0335/1974] fix croswap --- projects/croswap/index.js | 40 +++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/projects/croswap/index.js b/projects/croswap/index.js index 47d3dcee320..983df3793d2 100644 --- a/projects/croswap/index.js +++ b/projects/croswap/index.js @@ -1,38 +1,46 @@ const { staking } = require("../helper/staking"); const { getLogs, getAddress } = require('../helper/cache/getLogs'); const { transformDexBalances } = require("../helper/portedTokens"); +const { cachedGraphQuery } = require('../helper/cache') module.exports = { misrepresentedTokens: true, } async function tvl(_, _b, _cb, { api, }) { - const { factory, fromBlock }= config[api.chain] - - const logs = await getLogs({ - api, - target: factory, - topics: ['0x0d3648bd0f6ba80134a33ba9275ac585d9d315f0ad8355cddefde31afa28d0e9'], - fromBlock, - }) - const pools = logs.map(i => getAddress(i.data.slice(0, 64 + 2))) - const token0s = await api.multiCall({ abi: 'address:token0', calls: pools}) - const token1s = await api.multiCall({ abi: 'address:token1', calls: pools}) - const reserves = await api.multiCall({ abi: 'function getReserves() view returns (uint112, uint112, uint32)', calls: pools}) - const data = reserves.map(([token0Bal, token1Bal], i) => ({ token0Bal, token1Bal, token1: token1s[i], token0: token0s[i]})) + const { factory, fromBlock } = config[api.chain] + let pools + + if (api.chain === 'cronos') { + const data = await cachedGraphQuery('croswap/cronos', 'https://graph.croswap.com/subgraphs/name/croswap/croswap-v2', `{ pairInfos { pair { id}}}`) + pools = data.pairInfos.map(i => i.pair.id) + } else { + + const logs = await getLogs({ + api, + target: factory, + topics: ['0x0d3648bd0f6ba80134a33ba9275ac585d9d315f0ad8355cddefde31afa28d0e9'], + fromBlock, + }) + pools = logs.map(i => getAddress(i.data.slice(0, 64 + 2))) + } + const token0s = await api.multiCall({ abi: 'address:token0', calls: pools }) + const token1s = await api.multiCall({ abi: 'address:token1', calls: pools }) + const reserves = await api.multiCall({ abi: 'function getReserves() view returns (uint112, uint112, uint32)', calls: pools }) + const data = reserves.map(([token0Bal, token1Bal], i) => ({ token0Bal, token1Bal, token1: token1s[i], token0: token0s[i] })) return transformDexBalances({ ...api, data, }) } const config = { - arbitrum: { factory: '0x8f6ecb066f2bfe31bf87e022c76f63bc4642d8bc', fromBlock: 82954506, stakingContracts: ['0x8e9DA87f58A8480dD6b8878Aa37144a5Fb2F122D'], cros: '0x780469101caBD2bFe4B596D98d4777C2a142e012'}, - cronos: { factory: '0x4ae2bd26e60741890edb9e5c7e984bb396ec26e3', fromBlock: 4807004, stakingContracts: ['0xedfe968033fd2b9a98371d052cd7f32a711e533a'], cros: '0x1Ba477CA252C0FF21c488d41759795E7E7812aB4'}, + arbitrum: { factory: '0x8f6ecb066f2bfe31bf87e022c76f63bc4642d8bc', fromBlock: 82954506, stakingContracts: ['0x8e9DA87f58A8480dD6b8878Aa37144a5Fb2F122D'], cros: '0x780469101caBD2bFe4B596D98d4777C2a142e012' }, + cronos: { factory: '0x4ae2bd26e60741890edb9e5c7e984bb396ec26e3', fromBlock: 4807004, stakingContracts: ['0xedfe968033fd2b9a98371d052cd7f32a711e533a'], cros: '0x1Ba477CA252C0FF21c488d41759795E7E7812aB4' }, } module.exports = { }; Object.keys(config).forEach(chain => { - const {stakingContracts, cros,} = config[chain] + const { stakingContracts, cros, } = config[chain] module.exports[chain] = { tvl, staking: staking(stakingContracts, cros) } From abf15e6acd0fb219cc9e859df64a99ca367dec1c Mon Sep 17 00:00:00 2001 From: Bluespadexyz <129598406+Bluespadexyz@users.noreply.github.com> Date: Thu, 13 Jul 2023 19:31:00 +0900 Subject: [PATCH 0336/1974] add bluespade to DefiLlama (#6795) * add bluespade to DefiLlama * minor fix --------- Co-authored-by: alphamate Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/bluespade/index.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 projects/bluespade/index.js diff --git a/projects/bluespade/index.js b/projects/bluespade/index.js new file mode 100644 index 00000000000..0bf9136b7ea --- /dev/null +++ b/projects/bluespade/index.js @@ -0,0 +1,22 @@ +const {staking} = require('../helper/staking') +const { gmxExports } = require('../helper/gmx') + +//Cronos +const cronosVault = '0x26e5FbFbfd38a27D5777C9C9CC5543e687E637D8'; +const cronosStaking = '0xbCCE1c2efDED06ee73183f8B20f03e452EF8495D'; +const cronosBLU = '0x1542bA4CA0fb6D1B4476a933B292002fd1959A52'; +//Polygon +const polygonVault = '0xd6f70237f501891C3E1634544F36E026250c2D3F' +const polygonStaking = '0xb710f0D97023340eB3faBC4259FEAdf3bBeDdf05' +const polygonBLU = '0x759d34685468604c695De301ad11A9418e2f1038' + +module.exports = { + cronos: { + staking: staking(cronosStaking, cronosBLU), + tvl: gmxExports({ vault: cronosVault, }) + }, + polygon:{ + staking: staking(polygonStaking, polygonBLU), + tvl: gmxExports({ vault: polygonVault, }) + } +}; From ec32dc7f90f42882f004e0e118f3dd597b154b6c Mon Sep 17 00:00:00 2001 From: Roch Date: Thu, 13 Jul 2023 14:42:11 +0200 Subject: [PATCH 0337/1974] Fix Owna protocol tvl by calling contract (#6790) * Fix Owna protocol tvl by calling contract * count borrows as borrows * remove repaid borrows * minor refactor --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/owna/config.js | 5 ++--- projects/owna/index.js | 21 +++++++++++++++++---- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/projects/owna/config.js b/projects/owna/config.js index 05d736df3c5..ad8b5edca06 100644 --- a/projects/owna/config.js +++ b/projects/owna/config.js @@ -6,9 +6,8 @@ module.exports = { tokens: [ ADDRESSES.polygon_zkevm.USDC, ], - holders: [ - '0x27Ca3D6c64398FF9BcF2E66896EC4B3BEc5e1959', - ] + nftContract: '0xa0db7ef54eeffb7a3a5d9e7a95fb853392573b90', + lendingContract: '0x27Ca3D6c64398FF9BcF2E66896EC4B3BEc5e1959', }, ] } \ No newline at end of file diff --git a/projects/owna/index.js b/projects/owna/index.js index ad2b1240da5..84a4aece5a6 100644 --- a/projects/owna/index.js +++ b/projects/owna/index.js @@ -5,9 +5,22 @@ module.exports = { methodology: 'Counts the amount of stables locked in Owna protocol contracts', }; -config.chains.forEach(chainInfo => { - const {name: chain, tokens, holders} = chainInfo +config.chains.forEach(async chainInfo => { + const { name: chain, tokens, lendingContract, nftContract } = chainInfo + + async function borrowed(_, _1, _2, { api }) { + const count = await api.call({ abi: 'uint256:noOfTokenId', target: nftContract }) + let calls = [] + for (let i = 0; i < count; i++) calls.push(i) + const borrows = await api.multiCall({ calls, abi: 'function borrow(uint256) view returns (bool nft, bool isEntryFeePaid, bool isSold, uint256 nftId, uint256 offerType, uint256 loanAmount, uint256 debtPaid, uint256 lastUpdate, uint256 borrowedStartTime)', target: lendingContract }) + borrows.forEach(borrow => { + if (!borrow.isEntryFeePaid) + api.add(tokens[0], borrow.loanAmount - borrow.debtPaid) + }) + } + module.exports[chain] = { - tvl: sumTokensExport({ chain, tokens, owners: holders }) + tvl: sumTokensExport({ tokens, owners: [lendingContract] }), + borrowed, } -}) \ No newline at end of file +}) From 60f2d349d1c2a22a01b1eeb0e433dbef89cef4cc Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 13 Jul 2023 14:54:19 +0200 Subject: [PATCH 0338/1974] track mare v2 --- projects/mare-finance-v2/index.js | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 projects/mare-finance-v2/index.js diff --git a/projects/mare-finance-v2/index.js b/projects/mare-finance-v2/index.js new file mode 100644 index 00000000000..c4848883fea --- /dev/null +++ b/projects/mare-finance-v2/index.js @@ -0,0 +1,11 @@ +const { compoundExports } = require("../helper/compound"); +const { staking } = require("../helper/staking"); + +const unitroller = "0xFcD7D41D5cfF03C7f6D573c9732B0506C72f5C72"; + +module.exports = { + methodology: "Same as Compound Finance, we just count all the tokens supplied (not borrowed money) on the lending markets", + kava: { + ...compoundExports(unitroller, "kava"), + }, +} \ No newline at end of file From 78f2a5132b33c6382d7026c8e617824562304640 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 13 Jul 2023 15:35:58 +0200 Subject: [PATCH 0339/1974] delist genshiro --- projects/genshiro/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/projects/genshiro/index.js b/projects/genshiro/index.js index ea2ed9934e2..e940d249d94 100644 --- a/projects/genshiro/index.js +++ b/projects/genshiro/index.js @@ -2,5 +2,8 @@ const { getExports } = require('../helper/heroku-api') module.exports = { timetravel: false, - ...getExports("genshiro", ['genshiro']) + // ...getExports("genshiro", ['genshiro']), + genshiro: { + tvl: async () => ({}), + } } \ No newline at end of file From 610a4096c41e352fd91bec22830d989023b0b838 Mon Sep 17 00:00:00 2001 From: gaspare100 Date: Thu, 13 Jul 2023 14:58:26 +0100 Subject: [PATCH 0340/1974] new lp in Invest (#6788) * new lp in Invest * add base assets aswell if available * add base assets aswell if available * usdt vault and new kava vault --------- Co-authored-by: theg --- projects/scrubinvest/index.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/projects/scrubinvest/index.js b/projects/scrubinvest/index.js index e14eaa6409e..1621561e062 100644 --- a/projects/scrubinvest/index.js +++ b/projects/scrubinvest/index.js @@ -13,6 +13,9 @@ async function tvl(_, _b, _cb, { api, }) { { target: '0x8EEA85dA61b397EaB933C001DAAD6fC1C5A4c67C', params: '0xcf4673F714183C42DADc1B42DAC21BE09cfc3684' }, { target: '0xc28fcef5970fd23e5bfcdc31ce1ba72ef98cc70a', params: '0xef7541FCa94988fA423bC418a854f7967f83a3E0' }, { target: '0x371d33963fb89ec9542a11ccf955b3a90391f99f', params: '0x43Ac7f627e41EBDa7515FEaCa425306AaB9cB602' }, + { target: '0x1E5573b2A7C1D08112d0Ff22e9F2D8EFc9583532', params: '0x9e890FBD4295D92c41fA12a2083b51C387699Fd8' }, + { target: '0x8fE243F8B47107c468537D74514d7c52Cd61E937', params: '0x56a9c9230d6D3b7bF147c10fdDBCD8F2eB1a2B6d' }, + ] const bals = await api.multiCall({ abi: 'erc20:balanceOf', calls }) const lps = await api.multiCall({ abi: 'address:stake', calls: calls.map(i => i.target)}) @@ -26,8 +29,20 @@ async function tvl(_, _b, _cb, { api, }) { ['0x92e17FD2DA50775FBD423702E4717cCD7FB2A6BB', '0x88555c4d8e53ffB223aB5baDe0B5e6B2Cd3966c4'], ['0x58333b7D0644b52E0e56cC3803CA94aF9e0B52C3', '0xB4Ba7ba722eacAE8f1e4c6213AF05b5E8B27dbdB'], ['0x24149e2D0D3F79EBb7Fc464b09e3628dE395b39D', '0xB9774bB2A18Af59Ec9bf86dCaeC07473A2D2F230'], - // WETH ['0x0B6c2a9d4d739778dF6cD1cf815754BD1438063c', '0x3CcA2C0d433E00433082ba16e968CA11dA6Dc156'], + ['0x2f9e61D4E9A9A3694CcDc287c790EA5cc3302E88', '0x1504B9EDdD57Ed8252b3b3b407DdE27B72A80790'], + ['0x350c4A0aC240755Bb6432FeB907eCAFbbBc75770', '0xC05021F3b3601BF33aB59dc75577B85985ACaab7'], + // also count base assets if available + ['0xfA9343C3897324496A05fC75abeD6bAC29f8A40f', '0xcd017B495DF1dE2DC8069b274e2ddfBB78561176'], + ['0xB44a9B6905aF7c801311e8F4E76932ee959c663C', '0x88555c4d8e53ffB223aB5baDe0B5e6B2Cd3966c4'], + ['0x765277EebeCA2e31912C9946eAe1021199B39C61', '0xB4Ba7ba722eacAE8f1e4c6213AF05b5E8B27dbdB'], + ['0xc86c7C0eFbd6A49B35E8714C5f59D99De09A225b', '0xB9774bB2A18Af59Ec9bf86dCaeC07473A2D2F230'], + ['0xe3f5a90f9cb311505cd691a46596599aa1a0ad7d', '0x3CcA2C0d433E00433082ba16e968CA11dA6Dc156'], + ['0xe3f5a90f9cb311505cd691a46596599aa1a0ad7d', '0x1504B9EDdD57Ed8252b3b3b407DdE27B72A80790'], + ['0xc86c7C0eFbd6A49B35E8714C5f59D99De09A225b', '0xC05021F3b3601BF33aB59dc75577B85985ACaab7'], + + // WETH + // Vaults Equilibre Scrub // ['0xeA848151ACB1508988e56Ee7689F004df2B15ced', "0x4402Cf5433D57266563979654d20887AcE672393"], // ['0x7f8ed7d31795dc6f5fc5f6685b11419674361501', "0xa2355f35Ab85f1771FB1085a0e5b2599B8F47457"], From c09e634904416a2ad1625a9b2ecbf0da3ef98490 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 13 Jul 2023 16:25:44 +0200 Subject: [PATCH 0341/1974] fix protectorate --- projects/helper/erc4626.js | 18 ++++++++++++++++++ projects/protectorate/index.js | 16 ++++++---------- 2 files changed, 24 insertions(+), 10 deletions(-) create mode 100644 projects/helper/erc4626.js diff --git a/projects/helper/erc4626.js b/projects/helper/erc4626.js new file mode 100644 index 00000000000..7beff42e8cf --- /dev/null +++ b/projects/helper/erc4626.js @@ -0,0 +1,18 @@ + +async function sumERC4626Vaults({ api, vaults }) { + const tokens = await api.multiCall({ abi: 'address:asset', calls: vaults}) + const bals = await api.multiCall({ abi: 'uint256:totalAssets', calls: vaults}) + api.addTokens(tokens, bals) + return api.getBalances() +} + +function sumERC4626VaultsExport({ vaults, ...options}) { + return async (timestamp, ethBlock, chainBlocks, { api }) => { + return sumERC4626Vaults({ ...options, api, vaults }) + } +} + +module.exports = { + sumERC4626Vaults, + sumERC4626VaultsExport, +} \ No newline at end of file diff --git a/projects/protectorate/index.js b/projects/protectorate/index.js index 1248a900d1b..20c9813de62 100644 --- a/projects/protectorate/index.js +++ b/projects/protectorate/index.js @@ -1,11 +1,7 @@ -const { treasuryExports } = require("../helper/treasury"); -const ADDRESSES = require('../helper/coreAssets.json') +const { sumERC4626VaultsExport } = require("../helper/erc4626"); -module.exports = treasuryExports({ - ethereum: { - tokens: [ - ADDRESSES.ethereum.WETH, - ], - owners: ["0xaF53431488E871D103baA0280b6360998F0F9926"], - }, -}) \ No newline at end of file +module.exports = { + ethereum: { + tvl: sumERC4626VaultsExport({ vaults: ["0xaF53431488E871D103baA0280b6360998F0F9926"], }), + }, +} \ No newline at end of file From a610c90e69ae8ab45eabb82900a8d8179061d344 Mon Sep 17 00:00:00 2001 From: IamNimrod <125320281+IamNimrod@users.noreply.github.com> Date: Thu, 13 Jul 2023 16:46:27 +0200 Subject: [PATCH 0342/1974] Add ChainTools Adapter (#6794) * Added initial ChainTools Adapter for TVL Calcs * code refactor * lint fix * add treasury adapter --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/chaintools/index.js | 18 ++++++++++++++++++ projects/treasury/chaintools.js | 11 +++++++++++ 2 files changed, 29 insertions(+) create mode 100644 projects/chaintools/index.js create mode 100644 projects/treasury/chaintools.js diff --git a/projects/chaintools/index.js b/projects/chaintools/index.js new file mode 100644 index 00000000000..79b1d943e7d --- /dev/null +++ b/projects/chaintools/index.js @@ -0,0 +1,18 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const YIELD_BOOSTER_ADDRESS = "0x9954B485E650E067BCAD654F66CD67DAC122123b"; +const YIELD_VAULT_ADDRESS = "0xce2C952B27FCc41F868BDC32c9411F0759378ED0"; +const MULTISIG_ADDRESS = "0xb0Df68E0bf4F54D06A4a448735D2a3d7D97A2222"; +const CTLS_ADDRESS = "0xE155F64B9aD8c81318c313196a60c72e72fD2cD1"; +const UNI_V3_POOL = "0xc53489F27F4d8A1cdceD3BFe397CAF628e8aBC13"; // we cant count liquidity on uni v3 as your tvl +const INCENTIVES_WALLET = "0x9318a070a16E25554f098c6930B506123b66E19d"; // this is EOA, whis is it included in tvl? +const COMPOUNDING_KEEPER_ADDRESS = "0x5648C24Ea7cFE703836924bF2080ceFa44A12cA8"; // this is EOA, whis is it included in tvl? + +const { sumTokensExport } = require('../helper/unwrapLPs') + +module.exports = { + methodology: "Total balances of the Uniswap V3 Pool plus protocol/user controlled balances (in WETH+ETH and CTLS)", + ethereum: { + tvl: sumTokensExport({ owners: [YIELD_VAULT_ADDRESS,], tokens: [ADDRESSES.ethereum.WETH, ADDRESSES.null, ], }), + staking: sumTokensExport({ owners: [YIELD_BOOSTER_ADDRESS, YIELD_VAULT_ADDRESS,], tokens: [CTLS_ADDRESS,], }), + }, +}; diff --git a/projects/treasury/chaintools.js b/projects/treasury/chaintools.js new file mode 100644 index 00000000000..808a225cc02 --- /dev/null +++ b/projects/treasury/chaintools.js @@ -0,0 +1,11 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const MULTISIG_ADDRESS = "0xb0Df68E0bf4F54D06A4a448735D2a3d7D97A2222"; +const CTLS_ADDRESS = "0xE155F64B9aD8c81318c313196a60c72e72fD2cD1"; +const { sumTokensExport } = require('../helper/unwrapLPs') + +module.exports = { + ethereum: { + tvl: sumTokensExport({ owners: [MULTISIG_ADDRESS,], tokens: [ADDRESSES.ethereum.WETH, ADDRESSES.null, ADDRESSES.ethereum.USDC,], }), + ownTokens: sumTokensExport({ owners: [MULTISIG_ADDRESS,], tokens: [CTLS_ADDRESS, ], }), + }, +}; From ff8493bea0fd93b5d86937d7d7d7d545dac79a37 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 13 Jul 2023 18:26:22 +0200 Subject: [PATCH 0343/1974] fix quoll --- projects/quoll/index.js | 96 ++++++++++------------------------------- 1 file changed, 22 insertions(+), 74 deletions(-) diff --git a/projects/quoll/index.js b/projects/quoll/index.js index c8799c12330..26ea2999c55 100644 --- a/projects/quoll/index.js +++ b/projects/quoll/index.js @@ -1,6 +1,6 @@ const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk'); -const { ethers: {BigNumber} } = require("ethers") +const { ethers: { BigNumber } } = require("ethers") const { staking } = require("../helper/staking"); const abi = require('./abi.json'); const voterProxy = '0xe96c48C5FddC0DC1Df5Cf21d68A3D8b3aba68046'; @@ -11,95 +11,43 @@ const wom = '0xAD6742A35fB341A9Cc6ad674738Dd8da98b94Fb1'; const veWom = '0x3DA62816dD31c56D9CdF22C6771ddb892cB5b0Cc'; const chain = 'bsc'; -async function voterProxyBalances(block) { - const poolLength = await sdk.api.abi.call({ - abi: abi.poolLength, - target: masterWombat, - params: [], - block, - chain - }).then(l => parseInt(l.output.toString())); +async function voterProxyBalances(api) { + const poolLength = await api.call({ abi: abi.poolLength, target: masterWombat, }) - const masterWombatPoolInfos = await sdk.api.abi.multiCall({ - block, - abi: abi.poolInfo, - calls: Array.from(Array(poolLength).keys()).map((pid) => ({ target: masterWombat, params: [pid] })), - chain, - }); - - const masterWombatVoterProxyBalances = await sdk.api.abi.multiCall({ - block, - abi: abi.userInfo, - calls: Array.from(Array(poolLength).keys()).map((pid) => ({ target: masterWombat, params: [pid, voterProxy] })), - chain, - }); - - const lpTokenTargets = masterWombatPoolInfos.output.map((pool) => ({ target: pool.output.lpToken, params: [] })); + const masterWombatPoolInfos = await api.multiCall({ abi: abi.poolInfo, target: masterWombat, calls: Array.from(Array(+poolLength).keys()), }); + const masterWombatVoterProxyBalances = await api.multiCall({ abi: abi.userInfo, target: masterWombat, calls: Array.from(Array(+poolLength).keys()).map((pid) => ({ params: [pid, voterProxy] })), }); - const lpPools = await sdk.api.abi.multiCall({ - block, - abi: abi.pool, - calls: lpTokenTargets, - chain, - }); - - const underlyingTokens = await sdk.api.abi.multiCall({ - block, - abi: abi.underlyingToken, - calls: lpTokenTargets, - chain, - }); + const lpTokenTargets = masterWombatPoolInfos.map((pool) => pool.lpToken); + const lpPools = await api.multiCall({ abi: abi.pool, calls: lpTokenTargets, }); + const underlyingTokens = await api.multiCall({ abi: abi.underlyingToken, calls: lpTokenTargets, }); - const underlyingAmounts = await sdk.api.abi.multiCall({ - block, + const underlyingAmounts = await api.multiCall({ abi: abi.quotePotentialWithdraw, - calls: lpPools.output.map((pool, index) => { + calls: lpPools.map((pool, index) => { return { - target: pool.output, - params: [underlyingTokens.output[index].output, masterWombatVoterProxyBalances.output[index].output.amount], + target: pool, + params: [underlyingTokens[index], masterWombatVoterProxyBalances[index].amount], }; }), - chain, permitFailure: true, }); - return underlyingAmounts.output + return underlyingAmounts .map((a, i) => { - if (masterWombatVoterProxyBalances.output[i].output.amount === '0') return; - if (underlyingTokens.output[i].output.toLowerCase() === ADDRESSES.bsc.ankrBNB.toLowerCase()) return; // disable aBNBc (ankr bnb) - return ({amount: a.output.amount, token: underlyingTokens.output[i].output}) - }).filter(i => i); + if (+masterWombatVoterProxyBalances[i].amount === 0) return; + if (underlyingTokens[i].toLowerCase() === ADDRESSES.bsc.ankrBNB.toLowerCase()) return; // disable aBNBc (ankr bnb) + if (a) + api.add(underlyingTokens[i], a.amount) + }) } -async function veWomBalance(block) { - return sdk.api.erc20.balanceOf({ - owner: voterProxy, - target: veWom, - block, - chain, - }).then(s => s.output); -} - -async function tvl(timestamp, ethereumBlock, chainBlocks) { - const block = chainBlocks[chain]; - - let balances = {}; - balances[`${chain}:${wom}`] = await veWomBalance(block); - - const vpBalances = await voterProxyBalances(block); - vpBalances.forEach(b => { - if (balances[`${chain}:${b.token}`]) { - balances[`${chain}:${b.token}`] = BigNumber.from(balances[`${chain}:${b.token}`]).add(BigNumber.from(b.amount)).toString(); - } else { - balances[`${chain}:${b.token}`] = b.amount; - } - }); - - return balances; +async function tvl(timestamp, ethereumBlock, chainBlocks, { api }) { + api.add(wom, await api.call({ abi: 'erc20:balanceOf', target: veWom, params: [voterProxy], })) + await voterProxyBalances(api) } module.exports = { methodology: - "TVL of Quoll Finance consists of Wombat LP tokens staked in MasterWombat, WOM tokens locked in veWOM, and Quoll tokens locked in QUO Vote Lock contract.", + "TVL of Quoll Finance consists of Wombat LP tokens staked in MasterWombat, WOM tokens locked in veWOM, and Quoll tokens locked in QUO Vote Lock contract.", bsc: { tvl, staking: staking( From b275d8c04077cedfab5637fa457ff282ec3f806b Mon Sep 17 00:00:00 2001 From: Elliot Shiu Date: Thu, 13 Jul 2023 12:51:08 -0700 Subject: [PATCH 0344/1974] sommelier: add RealYieldBTC cellar (#6797) --- projects/sommelier/index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/projects/sommelier/index.js b/projects/sommelier/index.js index fd08f3c7e92..a263c6bd29a 100644 --- a/projects/sommelier/index.js +++ b/projects/sommelier/index.js @@ -32,6 +32,7 @@ const REAL_YIELD_1INCH = "0xc7b69e15d86c5c1581dacce3cacaf5b68cd6596f"; const REAL_YIELD_UNI = "0x6a6af5393dc23d7e3db28d28ef422db7c40932b6"; const REAL_YIELD_SNX = "0xcbf2250f33c4161e18d4a2fa47464520af5216b5"; const REAL_YIELD_ENS = "0x18ea937aba6053bc232d9ae2c42abe7a8a2be440"; +const REAL_YIELD_BTC = "0x0274a704a6d9129f90a62ddc6f6024b33ecdad36"; const FRAXIMAL = "0xdbe19d1c3f21b1bb250ca7bdae0687a97b5f77e6"; const cellarsV2 = [ @@ -43,6 +44,7 @@ const cellarsV2 = [ { id: REAL_YIELD_UNI, startBlock: 17377190 }, { id: REAL_YIELD_SNX, startBlock: 17377190 }, { id: REAL_YIELD_ENS, startBlock: 17377190 }, + { id: REAL_YIELD_BTC, startBlock: 17667535 }, { id: FRAXIMAL, startBlock: 17589948 }, ]; From a199fe058ddfcf19ebe4ba8f35814423a757e1de Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Fri, 14 Jul 2023 00:37:41 +0100 Subject: [PATCH 0345/1974] add hallmarks --- projects/sashimidao/index.js | 3 +++ projects/sierra/index.js | 3 +++ projects/trapeza-protocol/index.js | 3 +++ 3 files changed, 9 insertions(+) diff --git a/projects/sashimidao/index.js b/projects/sashimidao/index.js index 14c3c14578e..015f1abed7f 100644 --- a/projects/sashimidao/index.js +++ b/projects/sashimidao/index.js @@ -36,6 +36,9 @@ async function avaxTvl(timestamp, chainBlocks) { } module.exports = { + hallmarks: [ + [1642464000, "Rug Pull"] + ], misrepresentedTokens: true, avax: { staking: stakings(sashimidaoStakings, SASHI, "avax"), diff --git a/projects/sierra/index.js b/projects/sierra/index.js index f48d2438656..76920615074 100644 --- a/projects/sierra/index.js +++ b/projects/sierra/index.js @@ -9,6 +9,9 @@ const treasuryTokens = [ ]; module.exports = { + hallmarks: [ + [1648765747, "Rug Pull"] + ], deadFrom: 1648765747, misrepresentedTokens: true, ...ohmTvl(treasury, treasuryTokens, "avax", tokenStaking, token, undefined, undefined, false) diff --git a/projects/trapeza-protocol/index.js b/projects/trapeza-protocol/index.js index 250b68315ef..7e8925d9461 100644 --- a/projects/trapeza-protocol/index.js +++ b/projects/trapeza-protocol/index.js @@ -10,6 +10,9 @@ const treasuryTokens = [ ]; module.exports = { + hallmarks: [ + [1648684800, "Rug Pull"] + ], misrepresentedTokens: true, ...ohmTvl(treasury, treasuryTokens, "bsc", fidlStaking, fidl, undefined, undefined, false) } \ No newline at end of file From 7587020ddaa0ff7e33cfc3d2a59ca7b284a8e536 Mon Sep 17 00:00:00 2001 From: define Date: Fri, 14 Jul 2023 11:09:56 +0100 Subject: [PATCH 0346/1974] add new wallets to bitvenus --- projects/bitvenus/index.js | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/projects/bitvenus/index.js b/projects/bitvenus/index.js index f5c24bccfbf..af65a1bc5cd 100644 --- a/projects/bitvenus/index.js +++ b/projects/bitvenus/index.js @@ -3,35 +3,39 @@ const { cexExports } = require('../helper/cex') const config = { ethereum: { owners: [ - '0xe43c53c466a282773f204df0b0a58fb6f6a88633', - '0x2b097741854eedeb9e5c3ef9d221fb403d8d8609', - '0x686b9202a36c09ce8aba8b49ae5f75707edec5fe', - '0xef7a2610a7c9cfb2537d68916b6a87fea8acfec3', - '0x5631aa1fc1868703a962e2fd713dc02cad07c1db', - '0x4785e47ae7061632c2782384da28b9f68a5647a3' + // '0xe43c53c466a282773f204df0b0a58fb6f6a88633', Old wallets + // '0x2b097741854eedeb9e5c3ef9d221fb403d8d8609', Old wallets + // '0x686b9202a36c09ce8aba8b49ae5f75707edec5fe', Old wallets + // '0xef7a2610a7c9cfb2537d68916b6a87fea8acfec3', Old wallets + '0x5631aa1fc1868703a962e2fd713dc02cad07c1db', + '0x4785e47ae7061632c2782384da28b9f68a5647a3', + '0x25Ee4Ce905Da85df8620cB82884adDf96A14498A', + '0xE1E5F8caCc6B9Ace0894Fe7ba467328587e60bE7' ], }, bitcoin: { owners: [ - '3FdoFGYYcD1EU7ekrt2x2u2mFrjmxouMJG', - '358pjjkYRG8exw2BKZnn7Q9s6SCb7wZEWN', - '3C1ykoWkHBMZwmY8PUUMVxtJJSBkZBCtN8', - 'bc1qrm2a7u9xyeffvulm6e589qvesmt0v0rjxqfkhv' + // '3FdoFGYYcD1EU7ekrt2x2u2mFrjmxouMJG', + // '358pjjkYRG8exw2BKZnn7Q9s6SCb7wZEWN', + // '3C1ykoWkHBMZwmY8PUUMVxtJJSBkZBCtN8', + 'bc1qrm2a7u9xyeffvulm6e589qvesmt0v0rjxqfkhv', + 'bc1qvht34dma2uy23l9j862nnqr38a42kjr66e6lec' ] }, bsc: { owners: [ - '0xef7a2610a7c9cfb2537d68916b6a87fea8acfec3', + // '0xef7a2610a7c9cfb2537d68916b6a87fea8acfec3', '0x4785e47aE7061632C2782384DA28B9F68a5647a3' ] }, tron: { owners: [ - 'TPbExxiw99nMsDfWVjaweSPkMVQfZSVVZj', + 'TPbExxiw99nMsDfWVjaweSPkMVQfZSVVZj', + 'TSM8m5ADsMRySsWy7d4REX7FBXusMQCi6y' ] } } module.exports = cexExports(config) -module.exports.methodology = 'This wallets where provide by BitVenus team on the 07/02/2023' \ No newline at end of file +module.exports.methodology = 'This wallets where provide by BitVenus team on the 07/02/2023. *On the 14/07/2023 BitVenus team provided new wallets' \ No newline at end of file From 48159431ad662bb46ae792c56ae4501abc1876d8 Mon Sep 17 00:00:00 2001 From: define Date: Fri, 14 Jul 2023 11:53:48 +0100 Subject: [PATCH 0347/1974] add hallmark to multichain --- projects/anyswap/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/anyswap/index.js b/projects/anyswap/index.js index d094245225f..583a4d470bc 100644 --- a/projects/anyswap/index.js +++ b/projects/anyswap/index.js @@ -120,5 +120,6 @@ module.exports = { // fetch: fetchChain(null), hallmarks: [ [1651881600, "UST depeg"], + [1689202800,"Access to Wallets Lost"] ], } From 9d535c9ecbad1ebd43961977b0e81b4675111e97 Mon Sep 17 00:00:00 2001 From: DainaTsuru <102115233+DainaTsuru@users.noreply.github.com> Date: Fri, 14 Jul 2023 04:13:53 -0700 Subject: [PATCH 0348/1974] New Project xWin Finance (#6792) * New Project xWinFinance * Deleted md file * Update index.js * code refactor --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/xWinFinance/Helper.js | 72 ++++++++++++++++++++++++++++++++++ projects/xWinFinance/index.js | 27 +++++++++++++ 2 files changed, 99 insertions(+) create mode 100644 projects/xWinFinance/Helper.js create mode 100644 projects/xWinFinance/index.js diff --git a/projects/xWinFinance/Helper.js b/projects/xWinFinance/Helper.js new file mode 100644 index 00000000000..4636c161219 --- /dev/null +++ b/projects/xWinFinance/Helper.js @@ -0,0 +1,72 @@ +const token = { + XWIN: '0xd88ca08d8eec1e9e09562213ae83a7853ebb5d28' +}; + +const Strategies = { + xSCA: "0x0a652784DF3f8Abde85dAEeee77D1EA97f5c5B24", + xDCA: "0x482ae949E4a70953fCa090717b68359b73b8602a", + xWinBBMA: "0x5EFaaBc34a3ba66f1fD02F056AC457AeBaF57D55", + xWinIRT: "0x5A8a66DF53DF88844c60829967b88d00eD208E08", + xCAKE_V: "0x1d2430bBfe86432E36A7C7286E99f78546F23De9", + xETH_V: "0x0C34Aa4e36983aB6ec11bC557A3B8cF79A7a9Ae7", + xUSDC_V: "0xcBca44d60c5A2b3c56ACfB51aFC66Ea04b8a2742", + xBUSD_V: "0xf4979C043df6f7d5dA929DeAB11b220A82886395", + xBTC_V: "0x7A0dEc70473602Cd0EF3Dc3d909b6Dc3FA42116C", + xUSDT_V: "0x8B7fcACB99124F009c8470FDa6f5fcF60277BDB2", + xADA_V: "0x605926F795FD9B4c3A8B1A2db33cBE01c66bA83f", + xBTC_O: "0x69764856e82180150f5366be610E40c2f812d7D6", + xUSDT_O: "0xCEbd365e4BFd8589Fd6BDe21898DB35a8095f956", +}; + +const PublicVault = { + fDEFI: "0x61d5722290F8755b2f31D260064658D6Ad837F37", + fMIV: "0x0A0817454710102F2bcB2215D616cBe3aFf495e5", + fxDollar: "0xFa4d4B4243dDA1F5f4d09269f61D57d02470635C", + fBTCETH: "0x284b4aDD0C9669f635EA64418C216821c45D0B48", + fvUSDT: "0xE949d266E8740470a15DFB1F40A795b5a2b63f02", + fCombo: "0x4d4F948C8E9Ec3d1cE1B80d598f57F8c75c64e4a", + fTACombo: "0xaaFF5eFe1376474a520FFe9129d8Aa8d7422AAbe", +}; + +const PrivateVault = { + Vault1: "0xa74c70d0bf531171360e603e6441faeb71b117d1", + Vault2: "0x834672c33291fd6932c1786e0c5fd4a3b921dc00", + Vault3: "0xc1908cf72426c0d6c48a4930bef681bb6621c106", + Vault4: "0x774c1ba3c31af51e4596fcaf9f90eaf167aee34c", + Vault5: "0x69f69df395c05202ec935999d072fa390defc31f", + Vault6: "0xb3c713a845378484f66e3f2ad608e3438675ff7c", + Vault7: "0xc5782a89ad76fe0b68cd67dcc4b294fcb5307415", + Vault8: "0xbddd3ff6f5902171faebb34e9ee084341c94a1e6", + Vault9: "0xe6eff8492c6832c1da6f76d3cc3288951021a7b5", + Vault10: "0x42289b0356470bdc0a93d6710f0bcf8bc0868f96", + Vault11: "0x90aadea5b2f10c4c53139fe4cf8005ffe5ed8d47", + Vault12: "0xbff5506a0c604cbf231646838f2f29118210e236", + Vault13: "0xeb23a52115e5ac9ed9085a1c0b25ec29529eef3b", +}; + +const farms = { + MasterChefAddress: "0xD09774e3d5Dc02fa969896c53D3Cbb5bC8900A60", + BuddyChefAddress: "0x4B87a60fC5a94e5ac886867977e29c9711C2E903", + LockStakingAddress: "0xa4AE0DCC89Af9855946C0b2ad4A10FF27125a9Fc", + PriceMasterAddr: "0xB1233713FeA0984fff84c7456d2cCed43e5e48E2", +}; + +const abi = { + getVaultValues: + "function getVaultValuesInUSD() public view returns (uint vaultValue)", + poolLength: "function poolLength() view returns (uint)", + poolInfoMaster: + "function poolInfo(uint256) view returns (address, uint256, uint256, uint256, uint256, uint256)", + balance: "function balanceOf(address) view returns (uint256)", + decimals: "function decimals() view returns (uint8)", + getPrice: "function getPrice(address, address) view returns (uint rate)", +}; + +module.exports = { + Strategies, + PublicVault, + PrivateVault, + farms, + abi, + token, +}; diff --git a/projects/xWinFinance/index.js b/projects/xWinFinance/index.js new file mode 100644 index 00000000000..6ac76cf048b --- /dev/null +++ b/projects/xWinFinance/index.js @@ -0,0 +1,27 @@ +const { sumTokens2, sumTokensExport, } = require('../helper/unwrapLPs') +const Helper = require("./Helper.js"); +const { farms: { MasterChefAddress, LockStakingAddress }, abi, token: { XWIN } } = require('./Helper.js'); + +async function tvl(_, _1, _2, { api }) { + const vaults = [ + ...Object.values(Helper.Strategies), + ...Object.values(Helper.PublicVault), + ...Object.values(Helper.PrivateVault), + ] + const bals = await api.multiCall({ abi: 'uint256:getVaultValues', calls: vaults}) + const tokens = await api.multiCall({ abi: 'address:baseToken', calls: vaults}) + api.addTokens(tokens, bals) +} + +async function pool2(_, _1, _2, { api }) { + const data = await api.fetchList({ lengthAbi: abi.poolLength, itemAbi: abi.poolInfoMaster, target: MasterChefAddress, }) + return sumTokens2({ api, owner: MasterChefAddress, tokens: data.map(i => i[0]), resolveLP: true, blacklistedTokens: [XWIN, LockStakingAddress] }) +} + +module.exports = { + bsc: { + tvl, + pool2, + staking: sumTokensExport({ owners: [MasterChefAddress, LockStakingAddress], tokens: [XWIN]}) + }, +}; From 9772f1bb3360582217a5ebaffb0200f936f98c54 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 14 Jul 2023 13:17:17 +0200 Subject: [PATCH 0349/1974] zkswap get token breakdown --- projects/zkSwap-finance/index.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/projects/zkSwap-finance/index.js b/projects/zkSwap-finance/index.js index ab2df257970..b115f0565d3 100644 --- a/projects/zkSwap-finance/index.js +++ b/projects/zkSwap-finance/index.js @@ -1,11 +1,9 @@ const { getUniTVL } = require('../helper/unknownTokens') module.exports = { - misrepresentedTokens: true, era: { tvl: getUniTVL({ factory: '0x3a76e377ED58c8731F9DF3A36155942438744Ce3', - useDefaultCoreAssets: true, fetchBalances: true, }) }, From 3d6943e5a5e4f76dec756e294441e057a607ed8c Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 14 Jul 2023 17:16:50 +0530 Subject: [PATCH 0350/1974] Revert "Revert "updated nodedao etehreum tvl calculations (#6785)" (#6793)" (#6805) This reverts commit 1f8bae9b07cdd5433467b888ed159f8d93428078. --- projects/node-dao/index.js | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/projects/node-dao/index.js b/projects/node-dao/index.js index 6c70f489ace..e19286cb848 100644 --- a/projects/node-dao/index.js +++ b/projects/node-dao/index.js @@ -3,9 +3,31 @@ const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') module.exports = { ethereum: { tvl: async (_, _1, _2, { api }) => { - const owner = '0x8103151E2377e78C04a3d2564e20542680ed3096' - const totalEth = await api.call({ abi: 'uint256:getTotalEthValue', target: owner }) - api.add(nullAddress,totalEth) + // nodeDAO v0 validator nft + const nodeDaoV0ValidatorNFT = '0x40Cd77D9aa9e0b2D485259415eA05486B201c514' + const v0VdalitorsNumber = await api.call({ abi: 'uint256:totalSupply', target: nodeDaoV0ValidatorNFT }) + + // nodeDAO liquidStaking + const nodeDaoLiquidStaking = '0x8103151E2377e78C04a3d2564e20542680ed3096' + const nethTVL = await api.call({ abi: 'uint256:getTotalEthValue', target: nodeDaoLiquidStaking }) + + // nodeDAO v1 validator nft + const nodeDaoV1ValidatorNFT = '0x58553F5c5a6AEE89EaBFd42c231A18aB0872700d' + const v1Vdalitors = await api.call({ abi: 'uint256[]:activeNftsOfUser', target: nodeDaoV1ValidatorNFT }) + + // nodeDAO totalEth = nethTVL + (v1ValidatorNumber + v0VdalitorsNumber)* 32 eth + let totalEth = parseInt(nethTVL) + (v1Vdalitors.length + parseInt(v0VdalitorsNumber)) * 32_000_000_000_000_000_000 + + // nodeDAO largeStaking + const nodeDaoLargeStaking = '0xBBd19e8F766Dcc94D50e47502b79C81cdaD484B8' + const nodeOperatorRegistry = '0x8742178Ac172eC7235E54808d5F327C30A51c492' + const operatorNumbers = await api.call({ abi: 'uint256:getNodeOperatorsCount', target: nodeOperatorRegistry }) + for (let i = 1; i <= operatorNumbers; i++) { + const validatorNumbers = await api.call({ abi: 'function getOperatorValidatorCounts(uint256 _operatorId) external view returns (uint256)', target: nodeDaoLargeStaking, params: [i] }) + totalEth += parseInt(validatorNumbers) * 32_000_000_000_000_000_000 + } + + api.add(nullAddress, totalEth) } } -} \ No newline at end of file +} From 238141e70e642e84151034c0d64cc26773b8e923 Mon Sep 17 00:00:00 2001 From: Philipp Date: Fri, 14 Jul 2023 13:48:33 +0200 Subject: [PATCH 0351/1974] add osmosis, injective to eris (#6802) --- projects/eris-protocol/index.js | 103 ++++++++++++++++++++------------ 1 file changed, 65 insertions(+), 38 deletions(-) diff --git a/projects/eris-protocol/index.js b/projects/eris-protocol/index.js index ecbfb7de250..ed1c3eec284 100644 --- a/projects/eris-protocol/index.js +++ b/projects/eris-protocol/index.js @@ -50,6 +50,10 @@ const config = { kujira: { coinGeckoId: "kujira", hub: "kujira1n3fr5f56r2ce0s37wdvwrk98yhhq3unnxgcqus8nzsfxvllk0yxquurqty", + voteEscrow: + "kujira1mxzfcxpn6cjx4u9zln6ttxuc6fuw6g0cettd6nes74vrt2f22h4q3j5cdz", + ampToken: + "factory/kujira1n3fr5f56r2ce0s37wdvwrk98yhhq3unnxgcqus8nzsfxvllk0yxquurqty/ampKUJI", }, juno: { coinGeckoId: "juno-network", @@ -62,6 +66,24 @@ const config = { "migaloo1hntfu45etpkdf8prq6p6la9tsnk3u3muf5378kds73c7xd4qdzysuv567q", ampToken: "factory/migaloo1436kxs0w2es6xlqpp9rd35e3d0cjnw4sv8j3a7483sgks29jqwgshqdky4/ampWHALE", + // currently not running due to node simulation gas issues + arbVault: + "migaloo1ey4sn2mkmhew4pdrzk90l9acluvas25qlhuvsfgssw42ugz8yjlqx92j9l", + }, + osmosis: { + coinGeckoId: "osmosis", + hub: "osmo1dv8wz09tckslr2wy5z86r46dxvegylhpt97r9yd6qc3kyc6tv42qa89dr9", + voteEscrow: + "osmo1vcg9a7zwfeuqwtkya5l34tdgzxnafdzpe22ahphd02uwed43wnfs3wtf8a", + ampToken: + "factory/osmo1dv8wz09tckslr2wy5z86r46dxvegylhpt97r9yd6qc3kyc6tv42qa89dr9/ampOSMO", + }, + injective: { + coinGeckoId: "injective-protocol", + hub: "inj1cdwt8g7nxgtg2k4fn8sj363mh9ahkw2qt0vrnc", + voteEscrow: "inj1yp0lgxq460ked0egtzyj2nck3mdhr8smfmteh5", + ampToken: "factory/inj1cdwt8g7nxgtg2k4fn8sj363mh9ahkw2qt0vrnc/ampINJ", + decimals: 18, }, }; @@ -79,19 +101,29 @@ async function tvlHub(chain, state) { state ||= await getState(chain, chainConfig.hub); - let tvl = +(state.tvl_uluna ?? state.tvl_utoken ?? 0) / 1e6; + let tvl = + +(state.tvl_uluna ?? state.tvl_utoken ?? 0) / getDecimalFactor(chainConfig); return { [coinGeckoId]: tvl, }; } +function getDecimalFactor(chainConfig) { + let decimals = chainConfig.decimals ?? 6; + return Math.pow(10, decimals); +} + async function tvlArbVault(chain) { let chainConfig = config[chain]; let coinGeckoId = chainConfig.coinGeckoId; + if (!chainConfig.arbVault) { + return {}; + } + const res = await getState(chain, chainConfig.arbVault); - let tvl = +(res.balances.tvl_utoken ?? 0) / 1e6; + let tvl = +(res.balances.tvl_utoken ?? 0) / getDecimalFactor(chainConfig); return { [coinGeckoId]: tvl, }; @@ -100,6 +132,10 @@ async function tvlArbVault(chain) { async function tvlAmpGovernance(chain, state) { let chainConfig = config[chain]; + if (!chainConfig.ampToken) { + return {}; + } + let isTokenFactory = chainConfig.ampToken.startsWith("factory"); let ampAmount = 0; @@ -122,11 +158,12 @@ async function tvlAmpGovernance(chain, state) { if (chainConfig.coinGeckoIdAmp) { return { - [chainConfig.coinGeckoIdAmp]: ampAmount / 1e6, + [chainConfig.coinGeckoIdAmp]: ampAmount / getDecimalFactor(chainConfig), }; } else { state ||= await getState(chain, chainConfig.hub); - let amount = (ampAmount / 1e6) * +state.exchange_rate; + let amount = + (ampAmount / getDecimalFactor(chainConfig)) * +state.exchange_rate; return { [chainConfig.coinGeckoId]: amount, }; @@ -135,7 +172,7 @@ async function tvlAmpGovernance(chain, state) { async function farm2Tvl(farm) { const res = await queryContractCosmos({ - chain: 'terra2', + chain: "terra2", contract: farm, data: { state: {} }, }); @@ -199,44 +236,34 @@ function merge(elements) { }, {}); } -function terraTvl() { - return mergePromises([tvlHub("terra")]); -} - -function kujiraTvl() { - return mergePromises([tvlHub("kujira")]); -} - -function junoTvl() { - return mergePromises([tvlHub("juno")]); -} - -async function migalooTvl() { - let chain = "migaloo"; +async function productsTvl(chain) { let chainConfig = config[chain]; - let state = await getState(chain, chainConfig.hub); - return await mergePromises([ - tvlHub(chain, state), - tvlAmpGovernance(chain, state), - ]); -} - -function terra2Tvl() { - return mergePromises([ - tvlHub("terra2"), - tvlArbVault("terra2"), - tvlAmpGovernance("terra2"), - ...config.terra2.farms.map(farm2Tvl), - ]); + try { + let state = await getState(chain, chainConfig.hub); + return await mergePromises([ + tvlHub(chain, state), + tvlAmpGovernance(chain, state), + tvlArbVault(chain).catch((a) => ({})), + ...(chainConfig.farms ?? []).map(farm2Tvl), + ]); + } catch (error) { + let url = error?.response?.config?.url; + if (url) { + console.log("Issue calling", error?.response?.config?.url); + } + throw error; + } } module.exports = { timetravel: false, misrepresentedTokens: false, methodology: "Liquid Staking and Arbitrage Protocol", - terra2: { tvl: terra2Tvl }, - terra: { tvl: terraTvl }, - kujira: { tvl: kujiraTvl }, - juno: { tvl: junoTvl }, - migaloo: { tvl: migalooTvl }, + terra2: { tvl: () => productsTvl("terra2") }, + terra: { tvl: () => productsTvl("terra") }, + kujira: { tvl: () => productsTvl("kujira") }, + juno: { tvl: () => productsTvl("juno") }, + migaloo: { tvl: () => productsTvl("migaloo") }, + injective: { tvl: () => productsTvl("injective") }, + osmosis: { tvl: () => productsTvl("osmosis") }, }; From aff2175e8266fb4042056d534994bf948db3118c Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 14 Jul 2023 14:01:02 +0200 Subject: [PATCH 0352/1974] fix spookyswap --- projects/spookyswap/index.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/projects/spookyswap/index.js b/projects/spookyswap/index.js index d266bfd34ab..9416f18f215 100644 --- a/projects/spookyswap/index.js +++ b/projects/spookyswap/index.js @@ -1,9 +1,7 @@ -const { getChainTvl } = require("../helper/getUniSubgraphTvl") +const { getUniTVL } = require("../helper/unknownTokens") module.exports={ misrepresentedTokens: true, fantom:{ - tvl: getChainTvl({ - fantom: 'https://api.thegraph.com/subgraphs/name/eerieeight/spookyswap' - })('fantom') - } -} \ No newline at end of file + tvl: getUniTVL({ useDefaultCoreAssets: true, factory: '0x152eE697f2E276fA89E96742e9bB9aB1F2E61bE3' }), + }, +} \ No newline at end of file From 24ce57c26b315bba2f27ee7db25bb4bbb281626a Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 14 Jul 2023 16:41:21 +0200 Subject: [PATCH 0353/1974] blacklist anyswap tokens from coreAssets --- projects/helper/tokenMapping.js | 95 +++++++++++++++++++++++++++++++-- 1 file changed, 92 insertions(+), 3 deletions(-) diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 8223b701ac5..7f609adefe0 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -16,8 +16,8 @@ coreAssets = JSON.parse(JSON.stringify(coreAssets)) // carbon: https://api-insights.carbon.network/info/denom_gecko_map // orbit brige: https://bridge.orbitchain.io/open/v1/api/monitor/rawTokenList -const ibcChains = ['ibc', 'terra', 'terra2', 'crescent', 'osmosis', 'kujira', 'stargaze', 'juno', 'injective', 'cosmos', 'comdex', 'stargaze', 'umee', 'orai', 'persistence', 'fxcore', 'neutron', 'quasar', 'chihuahua', ] -const caseSensitiveChains = [...ibcChains, 'solana', 'tezos', 'ton', 'algorand', 'aptos', 'near', 'bitcoin', 'waves', 'tron', 'litecoin', 'polkadot', 'ripple', 'elrond', 'cardano', 'stacks', 'sui', 'ergo', ] +const ibcChains = ['ibc', 'terra', 'terra2', 'crescent', 'osmosis', 'kujira', 'stargaze', 'juno', 'injective', 'cosmos', 'comdex', 'stargaze', 'umee', 'orai', 'persistence', 'fxcore', 'neutron', 'quasar', 'chihuahua',] +const caseSensitiveChains = [...ibcChains, 'solana', 'tezos', 'ton', 'algorand', 'aptos', 'near', 'bitcoin', 'waves', 'tron', 'litecoin', 'polkadot', 'ripple', 'elrond', 'cardano', 'stacks', 'sui', 'ergo',] const distressedAssts = new Set(Object.values({ CRK: '0x065de42e28e42d90c2052a1b49e7f83806af0e1f', @@ -97,8 +97,9 @@ function getCoreAssets(chain = 'ethereum') { Object.keys(transformTokens[chain] || {}), Object.keys(fixBalancesTokens[chain] || {}), ].flat() - const addresses = getUniqueAddresses(tokens, chain) + let addresses = getUniqueAddresses(tokens, chain) if (ibcChains.includes(chain)) addresses.push(...coreAssets.ibc) + if (anyswapTokenBlacklist[chain]) addresses = addresses.filter(i => !anyswapTokenBlacklist[chain].includes(i)) return addresses } @@ -129,6 +130,94 @@ const eulerTokens = [ "0xbd1bd5c956684f7eb79da40f582cbe1373a1d593", ] +const anyswapTokenBlacklist = { + ethereum: ['0x4e15361fd6b4bb609fa63c81a2be19d873717870'], + fantom: [ + '0x95bf7e307bc1ab0ba38ae10fc27084bc36fcd605', + '0x049d68029688eabf473097a2fc38ef61633a3c7a', + '0x04068da6c83afcfa0e13ba15a6696662335d5b75', + '0x049d68029688eabf473097a2fc38ef61633a3c7a', + '0x8d11ec38a3eb5e956b052f67da8bdc9bef8abf3e', + '0x82f0b8b456c1a451378467398982d4834b6829c1', + '0x7f620d7d0b3479b1655cefb1b0bc67fb0ef4e443' + ], + harmony: ['0xb12c13e66ade1f72f71834f2fc5082db8c091358'], + kcc: [ + '0xe3f5a90f9cb311505cd691a46596599aa1a0ad7d', + '0x639a647fbe20b6c8ac19e48e2de44ea792c62c5c', + '0xc9baa8cfdde8e328787e29b4b078abf2dadc2055', + '0x218c3c3d49d0e7b37aff0d8bb079de36ae61a4c0' + ], + moonriver: [ + '0xb44a9b6905af7c801311e8f4e76932ee959c663c', + '0xe3f5a90f9cb311505cd691a46596599aa1a0ad7d', + '0x639a647fbe20b6c8ac19e48e2de44ea792c62c5c' + ], + arbitrum: ['0xfea7a6a0b346362bf88a9e4a88416b77a57d6c2a'], + shiden: [ + '0xfa9343c3897324496a05fc75abed6bac29f8a40f', + '0x818ec0a7fe18ff94269904fced6ae3dae6d6dc0b', + '0x735abe48e8782948a37c7765ecb76b98cde97b0f', + '0x765277eebeca2e31912c9946eae1021199b39c61', + '0x332730a4f6e03d9c55829435f10360e13cfa41ff', + '0x65e66a61d0a8f1e686c2d6083ad611a10d84d97a' + ], + telos: [ + '0xfa9343c3897324496a05fc75abed6bac29f8a40f', + '0xf390830df829cf22c53c8840554b98eafc5dcbc2', + '0x818ec0a7fe18ff94269904fced6ae3dae6d6dc0b', + '0xefaeee334f0fd1712f9a8cc375f427d9cdd40d73' + ], + syscoin: [ + '0x2bf9b864cdc97b08b6d79ad4663e71b8ab65c45c', + '0x7c598c96d02398d89fbcb9d41eab3df0c16f227d', + '0x922d641a426dcffaef11680e5358f34d97d112e1' + ], + boba: ['0x461d52769884ca6235b685ef2040f47d30c94eb5'], + velas: [ + '0x639a647fbe20b6c8ac19e48e2de44ea792c62c5c', + '0xe3f5a90f9cb311505cd691a46596599aa1a0ad7d' + ], + dogechain: [ + '0xb44a9b6905af7c801311e8f4e76932ee959c663c', + '0x332730a4f6e03d9c55829435f10360e13cfa41ff', + '0xdc42728b0ea910349ed3c6e1c9dc06b5fb591f98' + ], + kava: [ + '0xfa9343c3897324496a05fc75abed6bac29f8a40f', + '0xb44a9b6905af7c801311e8f4e76932ee959c663c', + '0x818ec0a7fe18ff94269904fced6ae3dae6d6dc0b', + '0x765277eebeca2e31912c9946eae1021199b39c61', + '0x7c598c96d02398d89fbcb9d41eab3df0c16f227d', + '0xe3f5a90f9cb311505cd691a46596599aa1a0ad7d', + '0x332730a4f6e03d9c55829435f10360e13cfa41ff' + ], + step: [ + '0xe3f5a90f9cb311505cd691a46596599aa1a0ad7d', + '0xfa9343c3897324496a05fc75abed6bac29f8a40f', + '0x818ec0a7fe18ff94269904fced6ae3dae6d6dc0b', + '0xefaeee334f0fd1712f9a8cc375f427d9cdd40d73' + ], + godwoken_v1: [ + '0xe3f5a90f9cb311505cd691a46596599aa1a0ad7d', + '0x765277eebeca2e31912c9946eae1021199b39c61', + '0xfa9343c3897324496a05fc75abed6bac29f8a40f', + '0xb44a9b6905af7c801311e8f4e76932ee959c663c' + ], + milkomeda_a1: ['0xfa9343c3897324496a05fc75abed6bac29f8a40f'], + wemix: [ + '0x461d52769884ca6235b685ef2040f47d30c94eb5', + '0x765277eebeca2e31912c9946eae1021199b39c61', + '0xe3f5a90f9cb311505cd691a46596599aa1a0ad7d' + ], + eos_evm: [ + '0x922d641a426dcffaef11680e5358f34d97d112e1', + '0x765277eebeca2e31912c9946eae1021199b39c61', + '0xfa9343c3897324496a05fc75abed6bac29f8a40f', + '0xefaeee334f0fd1712f9a8cc375f427d9cdd40d73' + ] +} + module.exports = { nullAddress, caseSensitiveChains, From dc7cd3c4489cf6cb7a449f750bc62d2919c9890f Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 14 Jul 2023 16:46:47 +0200 Subject: [PATCH 0354/1974] sushiswap: fix fantom --- projects/sushiswap/api.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/sushiswap/api.js b/projects/sushiswap/api.js index 85809d040e4..977473cc2f4 100644 --- a/projects/sushiswap/api.js +++ b/projects/sushiswap/api.js @@ -79,5 +79,5 @@ module.exports = { module.exports.polygon.tvl = getChainTVL('polygon') // module.exports.bsc.tvl = getChainTVL('bsc') -module.exports.fantom.tvl = getChainTVL('fantom') +// module.exports.fantom.tvl = getChainTVL('fantom') // module.exports.harmony.tvl = getChainTVL('harmony') From cedc27b9dc1f451527b0636d99e99d5356a05472 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 14 Jul 2023 17:54:33 +0200 Subject: [PATCH 0355/1974] refactor yearn --- projects/helper/erc4626.js | 6 +- projects/yearn/index.js | 160 +++++++++++++++---------------------- 2 files changed, 67 insertions(+), 99 deletions(-) diff --git a/projects/helper/erc4626.js b/projects/helper/erc4626.js index 7beff42e8cf..145f12a4a60 100644 --- a/projects/helper/erc4626.js +++ b/projects/helper/erc4626.js @@ -1,7 +1,7 @@ -async function sumERC4626Vaults({ api, vaults }) { - const tokens = await api.multiCall({ abi: 'address:asset', calls: vaults}) - const bals = await api.multiCall({ abi: 'uint256:totalAssets', calls: vaults}) +async function sumERC4626Vaults({ api, vaults, abi = {} }) { + const tokens = await api.multiCall({ abi: abi.asset ?? 'address:asset', calls: vaults}) + const bals = await api.multiCall({ abi: abi.balance ?? 'uint256:totalAssets', calls: vaults}) api.addTokens(tokens, bals) return api.getBalances() } diff --git a/projects/yearn/index.js b/projects/yearn/index.js index 99985ebffd4..c7830be7d32 100644 --- a/projects/yearn/index.js +++ b/projects/yearn/index.js @@ -1,104 +1,72 @@ +const { sumTokens2 } = require('../helper/unwrapLPs') const axios = require('axios') -const { getApiTvl } = require('../helper/historicalApi') +const { getConfig } = require('../helper/cache') +const { sumERC4626Vaults } = require('../helper/erc4626') -async function ethereum(timestamp) { - return getApiTvl(timestamp, async () => { - const tvl = await axios.get('https://api.yearn.finance/v1/chains/1/vaults/all') - return tvl.data.reduce((all, vault) => all + vault.tvl.tvl, 0) - }, async () => { - /* - Outdated as of Dec 2022 - const historicalTvls = Object.entries((await axios.get('https://yearn.science/v1/tvl')).data) - .map(([date, tvl]) => [Date.parse(date)/1000, tvl]).sort(([date1], [date2]) => date1 - date2); - */ - const ibTvl = await axios.post("https://yearn.vision/api/ds/query", { "queries": [{ "datasource": { "uid": "PBFE396EC0B189D67", "type": "prometheus" }, "expr": "(sum(ironbank{network=\"ETH\", param=\"tvl\"}) or vector(0))", "utcOffsetSec": 0, "datasourceId": 1 }], "from": "1639958400000", "to": Date.now().toString() }) - const totalTvl = await axios.post("https://yearn.vision/api/ds/query", { "queries": [{ "datasource": { "uid": "PBFE396EC0B189D67", "type": "prometheus" }, "expr": "(sum(ironbank{network=\"ETH\", param=\"tvl\"}) or vector(0)) + (sum(yearn_vault{network=\"ETH\", param=\"tvl\"}) or vector(0))", "utcOffsetSec": 0, "datasourceId": 1 }], "from": "1639958400000", "to": Date.now().toString() }) - const result = [] - const [tvlTimestamps, tvls] = totalTvl.data.results.A.frames[0].data.values - const [ibTimestamps, ib] = ibTvl.data.results.A.frames[0].data.values - tvlTimestamps.forEach((time, index) => { - const ibIndex = ibTimestamps.indexOf(time) - const tvl = tvls[index] - ib[ibIndex] - result.push({ - date: Math.round(time / 1000), - totalLiquidityUSD: tvl - }) - }) - return result - }) -} - -async function fantom(timestamp) { - return getApiTvl(timestamp, async () => { - const tvl = await axios.get('https://api.yearn.finance/v1/chains/250/vaults/all') - const total = tvl.data.reduce((all, vault) => all + vault.tvl.tvl, 0) - if(total === 0){ throw new Error("TVL can't be 0")} - return total - }, async () => { - const totalTvl = await axios.post("https://yearn.vision/api/ds/query", {"queries":[{"datasource":{"uid":"PBFE396EC0B189D67","type":"prometheus"},"expr":"(sum(ironbank{network=\"FTM\", param=\"tvl\"}) or vector(0)) + (sum(yearn_vault{network=\"FTM\", param=\"tvl\"}) or vector(0))", "utcOffsetSec":0,"datasourceId":1}],"from":"1642091361529","to": Date.now().toString() }) - const result = [] - const [tvlTimestamps, tvls] = totalTvl.data.results.A.frames[0].data.values - tvlTimestamps.forEach((time, index) => { - const tvl = tvls[index] - result.push({ - date: Math.round(time / 1000), - totalLiquidityUSD: tvl - }) - }) - return result - }) -} - -async function arbitrum(timestamp) { - return getApiTvl(timestamp, async () => { - const tvl = await axios.get('https://api.yearn.finance/v1/chains/42161/vaults/all') - const total = tvl.data.reduce((all, vault) => all + vault.tvl.tvl, 0) - if(total === 0){ throw new Error("TVL can't be 0")} - return total - }, async () => { - const totalTvl = await axios.post("https://yearn.vision/api/ds/query", {"queries":[{"datasource":{"uid":"PBFE396EC0B189D67","type":"prometheus"},"expr":"(sum(ironbank{network=\"AETH\", param=\"tvl\"}) or vector(0)) + (sum(yearn_vault{network=\"AETH\", param=\"tvl\"}) or vector(0))", "utcOffsetSec":0,"datasourceId":1}],"from":"1645565848000","to": Date.now().toString() }) - const result = [] - const [tvlTimestamps, tvls] = totalTvl.data.results.A.frames[0].data.values - tvlTimestamps.forEach((time, index) => { - const tvl = tvls[index] - result.push({ - date: Math.round(time / 1000), - totalLiquidityUSD: tvl - }) - }) - return result - }) -} +const v1Vaults = [ + '0x597aD1e0c13Bfe8025993D9e79C69E1c0233522e', + '0x5dbcF33D8c2E976c6b560249878e6F1491Bca25c', + '0x37d19d1c4E1fa9DC47bD1eA12f742a0887eDa74a', + '0xACd43E627e64355f1861cEC6d3a6688B31a6F952', + '0x2f08119C6f07c006695E079AAFc638b8789FAf18', + '0xBA2E7Fed597fd0E3e70f5130BcDbbFE06bB94fe1', + '0x2994529C0652D127b7842094103715ec5299bBed', + '0x7Ff566E1d69DEfF32a7b244aE7276b9f90e9D0f6', + '0xe1237aA7f535b0CC33Fd973D66cBf830354D16c7', + '0x9cA85572E6A3EbF24dEDd195623F188735A5179f', + '0xec0d8D3ED5477106c6D4ea27D90a60e594693C90', + '0x629c759D1E83eFbF63d84eb3868B564d9521C129', + '0x0FCDAeDFb8A7DfDa2e9838564c5A1665d856AFDF', + '0xcC7E70A958917cCe67B4B87a8C30E6297451aE98', + '0x98B058b2CBacF5E99bC7012DF757ea7CFEbd35BC', + '0xE0db48B4F71752C4bEf16De1DBD042B82976b8C7', + '0x5334e150B938dd2b6bd040D9c4a03Cff0cED3765', + '0xFe39Ce91437C76178665D64d7a2694B0f6f17fE3', + '0xF6C9E9AF314982A4b38366f4AbfAa00595C5A6fC', + '0xA8B1Cb4ed612ee179BDeA16CCa6Ba596321AE52D', + '0x46AFc2dfBd1ea0c0760CAD8262A5838e803A37e5', + '0x5533ed0a3b83F70c3c4a1f69Ef5546D3D4713E44', + '0x8e6741b456a074F0Bc45B8b82A755d4aF7E965dF', + '0x03403154afc09Ce8e44C3B185C82C6aD5f86b9ab', + '0xE625F5923303f1CE7A43ACFEFd11fd12f30DbcA4', + '0xBacB69571323575C6a5A3b4F9EEde1DC7D31FBc1', + '0x1B5eb1173D2Bf770e50F10410C9a96F7a8eB6e75', + '0x96Ea6AF74Af09522fCB4c28C269C26F59a31ced6', +] +const blacklist = [ + '0xbD17B1ce622d73bD438b9E658acA5996dc394b0d', + '0xc5bDdf9843308380375a611c18B50Fb9341f502A', + '0x07FB4756f67bD46B748b16119E802F1f880fb2CC', + '0x7F83935EcFe4729c4Ea592Ab2bC1A32588409797', + '0x123964EbE096A920dae00Fb795FFBfA0c9Ff4675', + '0x39546945695DCb1c037C836925B355262f551f55', + ...v1Vaults, +] -async function optimism(timestamp) { - return getApiTvl(timestamp, async () => { - const tvl = await axios.get('https://api.yearn.finance/v1/chains/10/vaults/all') - const total = tvl.data.reduce((all, vault) => all + vault.tvl.tvl, 0) - if(total === 0){ throw new Error("TVL can't be 0")} - return total - }, async () => { - throw new Error("No historical data for optimism") - }) +async function tvl(timestamp, _, _1, { api }) { + const data = await getConfig('yearn/' + api.chain, `https://api.yearn.finance/v1/chains/${api.chainId}/vaults/all`) + const vaults = data.map(i => i.address).filter(i => !blacklist.includes(i)) + await sumERC4626Vaults({ api, vaults, abi: { asset: 'address:token', } }) + if (api.chain === 'ethereum') { + const tokens = await api.multiCall({ abi: 'address:token', calls: v1Vaults }) + let bals = await api.multiCall({ abi: 'erc20:totalSupply', calls: v1Vaults }) + const ratio = await api.multiCall({ abi: 'uint256:getPricePerFullShare', calls: v1Vaults }) + bals = bals.map((bal, i) => bal * ratio[i] / 1e18) + api.addTokens(tokens, bals) + } + return sumTokens2({ api, resolveLP: true,}) } module.exports = { - doublecounted: true, - misrepresentedTokens: true, - timetravel: false, - fantom: { - tvl: fantom - }, - ethereum: { - tvl: ethereum - }, - arbitrum: { - tvl: arbitrum - }, - optimism: { - tvl: optimism - }, - hallmarks:[ - [1594944000, "YFI token Launch"], - ] + doublecounted: true, + misrepresentedTokens: true, + timetravel: false, + fantom: { tvl }, + ethereum: { tvl }, + arbitrum: { tvl }, + optimism: { tvl }, + hallmarks: [ + [1594944000, "YFI token Launch"], + ] }; From e8dddb59b19cb65db71abecced0074bdc3f78f01 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 14 Jul 2023 18:05:30 +0200 Subject: [PATCH 0356/1974] update yoshi --- projects/yoshi-exchange/index.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/projects/yoshi-exchange/index.js b/projects/yoshi-exchange/index.js index e83b0796187..eddf65b737b 100644 --- a/projects/yoshi-exchange/index.js +++ b/projects/yoshi-exchange/index.js @@ -10,8 +10,11 @@ const factoryData = { }; let tvls = {}; -Object.entries(factoryData).forEach(([chain, data]) => tvls[chain] = {tvl: uniTvlExport(data.factory, chain)}); +Object.entries(factoryData).forEach(([chain, data]) => tvls[chain] = {tvl: uniTvlExport(data.factory, chain, undefined, undefined, { + useDefaultCoreAssets: true, +})}); module.exports = { - ...tvls + ...tvls, + misrepresentedTokens: true, } From 24071317918e0c929ce1e4ea018bc710ea8a142b Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Fri, 14 Jul 2023 18:16:51 +0100 Subject: [PATCH 0357/1974] remove un-used adapter files --- projects/ftmguru/index.js | 27 -- projects/growth-defi.js | 29 -- projects/hydradex.js | 27 -- projects/ordernchaos/index.js | 38 --- projects/pegasusdao/index.js | 11 - projects/push/index.js | 9 - projects/shibance-bsc/constants/abi.json | 4 - .../shibance-bsc/constants/bsc/contracts.js | 22 -- projects/shibance-bsc/constants/bsc/farms.js | 215 ------------ projects/shibance-bsc/constants/bsc/pools.js | 79 ----- projects/shibance-bsc/constants/bsc/tokens.js | 135 -------- projects/shibance-bsc/constants/chain.js | 4 - .../shibance-bsc/constants/kcc/contracts.js | 14 - projects/shibance-bsc/constants/kcc/farms.js | 105 ------ projects/shibance-bsc/constants/kcc/pools.js | 39 --- projects/shibance-bsc/constants/kcc/tokens.js | 73 ---- projects/shibance-bsc/farm.js | 318 ------------------ projects/shibance-bsc/format.js | 43 --- projects/shibance-bsc/index.js | 93 ----- projects/shibance-bsc/pool.js | 78 ----- projects/shibance-bsc/vault.js | 88 ----- 21 files changed, 1451 deletions(-) delete mode 100644 projects/ftmguru/index.js delete mode 100644 projects/growth-defi.js delete mode 100644 projects/hydradex.js delete mode 100644 projects/ordernchaos/index.js delete mode 100644 projects/pegasusdao/index.js delete mode 100644 projects/push/index.js delete mode 100644 projects/shibance-bsc/constants/abi.json delete mode 100644 projects/shibance-bsc/constants/bsc/contracts.js delete mode 100644 projects/shibance-bsc/constants/bsc/farms.js delete mode 100644 projects/shibance-bsc/constants/bsc/pools.js delete mode 100644 projects/shibance-bsc/constants/bsc/tokens.js delete mode 100644 projects/shibance-bsc/constants/chain.js delete mode 100644 projects/shibance-bsc/constants/kcc/contracts.js delete mode 100644 projects/shibance-bsc/constants/kcc/farms.js delete mode 100644 projects/shibance-bsc/constants/kcc/pools.js delete mode 100644 projects/shibance-bsc/constants/kcc/tokens.js delete mode 100644 projects/shibance-bsc/farm.js delete mode 100644 projects/shibance-bsc/format.js delete mode 100644 projects/shibance-bsc/index.js delete mode 100644 projects/shibance-bsc/pool.js delete mode 100644 projects/shibance-bsc/vault.js diff --git a/projects/ftmguru/index.js b/projects/ftmguru/index.js deleted file mode 100644 index ed3d2e94287..00000000000 --- a/projects/ftmguru/index.js +++ /dev/null @@ -1,27 +0,0 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const ITVL = { - pool2: "uint256:pool2", - staking: "uint256:staking", - tvl: "uint256:tvl", -} - -const tvlGuru = "0x0786c3a78f5133F08C1c70953B8B10376bC6dCad"; //On-Chain Universal TVL Finder -const USD = "fantom:" + ADDRESSES.fantom.USDC; //same as abi.call({target:tvlGuru,abi:ITVL[3]}) -//NOTE: USD===fantom:USDC is used explicitly to reduce EVM calls by this adapter. It makes this process faster. - -function tvl(abi) { - return async (_, _b, _cb, { api, }) => { - return { - [USD]: (await api.call({ target: tvlGuru, abi: ITVL[abi], })) / 1e12 - } - } -} - -module.exports = { - methodology: "USD-denominated value aggregation of most Locked assets held across ftm.guru's contracts, powered by direct on-chain storage of quantity, pools and prices using ftm.guru's Universal TVL Finder Tool (tvlGuru.sol). More detailed documentation of TVL is available at https://ftm.guru/rawdata/tvl", - fantom: { - pool2: tvl('pool2'), - staking: tvl('staking'), - tvl: tvl('tvl'), - }, -} diff --git a/projects/growth-defi.js b/projects/growth-defi.js deleted file mode 100644 index 63afc2d69bf..00000000000 --- a/projects/growth-defi.js +++ /dev/null @@ -1,29 +0,0 @@ -const axios = require("axios"); - -async function fetch() { - const query = ` - { - totalValueLocked(id: 1) { - totalValueLockedUSD - } - } - `; - - const options = { - method: "post", - url: "https://api.thegraph.com/subgraphs/name/growthdefi/growth-defi", - data: { - query, - }, - }; - - const response = await axios(options); - - const tvl = response.data.data.totalValueLocked.totalValueLockedUSD; - - return parseFloat(tvl); -} - -module.exports = { - fetch -} diff --git a/projects/hydradex.js b/projects/hydradex.js deleted file mode 100644 index 109c65f2205..00000000000 --- a/projects/hydradex.js +++ /dev/null @@ -1,27 +0,0 @@ -const { blockQuery } = require('./helper/http') -const { getBlock } = require('./hydradex/getHydraV3SubgraphTvl') - -async function tvl(timestamp) { - const endpoint = 'https://info.hydradex.org/graphql' - const block = await getBlock(endpoint, timestamp) - const query = `query ($block: Float!){ - hydraswapFactories (block: { number: $block }) { - totalLiquidityUSD - } - }` - const { hydraswapFactories: [{ totalLiquidityUSD }] } = await blockQuery(endpoint, query, { - api: { - getBlock: () => block, - block - } - }) - return { tether: +totalLiquidityUSD } -} - -module.exports = { - misrepresentedTokens: true, - methodology: "We count liquidity on the dex, pulling data from subgraph", - hydra: { - tvl, - }, -}; \ No newline at end of file diff --git a/projects/ordernchaos/index.js b/projects/ordernchaos/index.js deleted file mode 100644 index 6ccd1a3b0d0..00000000000 --- a/projects/ordernchaos/index.js +++ /dev/null @@ -1,38 +0,0 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const { getChainTransform} = require("../helper/portedTokens") -const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); - - -const DAI = ADDRESSES.avax.DAI -const USDC = ADDRESSES.avax.USDC -const USDT = ADDRESSES.avax.USDt - - -const collateralAddr = [ - "0xD5a7Df8B56d285011AbE406235109c029F45797A", // 3pool - ]; - -async function stablePoolTvl(timestamp, chainBlocks) { - const balances = {}; - const transformAddress = await getChainTransform("avax"); - await sumTokensAndLPsSharedOwners( - balances, - [ - [DAI, false], - [USDC, false], - [USDT, false], - ], - collateralAddr, - chainBlocks["avax"], - "avax", - transformAddress - ); - return balances; - } - -module.exports = { - methodology: 'Counts the DAI, USDC, and USDT that have been deposited to mint CHAOS', - avax: { - tvl: stablePoolTvl - } -}; \ No newline at end of file diff --git a/projects/pegasusdao/index.js b/projects/pegasusdao/index.js deleted file mode 100644 index e1240030ca1..00000000000 --- a/projects/pegasusdao/index.js +++ /dev/null @@ -1,11 +0,0 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const {ohmTvl} = require("../helper/ohm"); - -const sus = "0x5b5Fe1238aca91C65683aCd7f9D9Bf922e271EAA"; -const stakingContract = ""; - -const treasury = "0x7310855e0Aa8B110925fdE0100b01c62984d2a3C"; -const treasuryTokens = [ - [ADDRESSES.cronos.USDC, false], // USDC - ["0xAE182Db2F7897D7678c5099C1e52A1c802580827", true], // SUS-USDC CRONA LPS -] \ No newline at end of file diff --git a/projects/push/index.js b/projects/push/index.js deleted file mode 100644 index 2c0b8fed493..00000000000 --- a/projects/push/index.js +++ /dev/null @@ -1,9 +0,0 @@ -const { staking } = require('../helper/staking') - -module.exports = { - ethereum: { - tvl: () => 0, - pool2: staking('0xb72ff1e675117bedeff05a7d0a472c3844cfec85', '0xaf31fd9c3b0350424bf96e551d2d1264d8466205'), - staking: staking('0xb72ff1e675117bedeff05a7d0a472c3844cfec85', '0xf418588522d5dd018b425e472991e52ebbeeeeee'), - } -} \ No newline at end of file diff --git a/projects/shibance-bsc/constants/abi.json b/projects/shibance-bsc/constants/abi.json deleted file mode 100644 index 195cb3b29be..00000000000 --- a/projects/shibance-bsc/constants/abi.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "poolInfo": "function poolInfo(uint256) view returns (address lpToken, uint256 allocPoint, uint256 lastRewardBlock, uint256 accCakePerShare)", - "totalAllocPoint": "uint256:totalAllocPoint" -} \ No newline at end of file diff --git a/projects/shibance-bsc/constants/bsc/contracts.js b/projects/shibance-bsc/constants/bsc/contracts.js deleted file mode 100644 index 69944188578..00000000000 --- a/projects/shibance-bsc/constants/bsc/contracts.js +++ /dev/null @@ -1,22 +0,0 @@ -module.exports = { - masterChef: { - 56: "0x4fbEebd68B71aE4367F778129d4218668151EB99", - 97: "0x5559C8a6267b0b1bcDe0005a44db0B1546711B76", - }, - sousChef: { - 56: "0x0703c295644ba1d333e14367e510773629264Ee2", - 97: "0x4A2947DE6A35F0B83cc26827A9Cf832193c38614", - }, - multiCall: { - 56: "0x3dB443d8e82700FaBdB831dBe180994B6b109790", - 97: "0x6a45C680E74c81797E287Ccf48284698f85909b4", - }, - woofVault: { - 56: "0x09fE45A62502E7a0b226a99f18043F3eC32F78E8", - 97: "0x238d502163AC149Da69A180Cbae59347d72AE842", - }, - woofCollectibles: { - 56: "0x89e36408cc275168ab235e8a5902a2dd4c8fbaa7", - 97: "", - }, -}; diff --git a/projects/shibance-bsc/constants/bsc/farms.js b/projects/shibance-bsc/constants/bsc/farms.js deleted file mode 100644 index b6fb682aba6..00000000000 --- a/projects/shibance-bsc/constants/bsc/farms.js +++ /dev/null @@ -1,215 +0,0 @@ -const tokens = require("./tokens"); -const farms = [ - { - pid: 0, - lpSymbol: "WOOF", - lpAddresses: { - 56: "0x9e26c50B8A3b7652c3fD2B378252A8647a0C9268", - 97: "0x43eef5BA4899431F7F9D855E9C5Ed06016c8227b", - }, - token: tokens.syrup, - quoteToken: tokens.wbnb, - }, - { - pid: 1, - lpSymbol: "WOOF-BNB LP", - lpAddresses: { - 56: "0xccefc6013a4f3e1c4e71c5006353a55e228f4c2d", - 97: "0x5d6ddb67bcef8dd94a7f4ade4f5b912da9bacd62", - }, - token: tokens.woof, - quoteToken: tokens.wbnb, - }, - { - pid: 18, - lpSymbol: "CUPCAKE-WOOF LP", - lpAddresses: { - 97: "", - 56: "0x897a60da157cdca5faff2fd9314e72b763dda9cd", - }, - token: tokens.cupcake, - quoteToken: tokens.woof, - }, - { - pid: 21, - lpSymbol: "CUPCAKE-BUSD LP", - lpAddresses: { - 97: "", - 56: "0x9e20535e12d1ef96a3838ea27256ee6c767f644f", - }, - token: tokens.cupcake, - quoteToken: tokens.busd, - }, - { - pid: 3, - lpSymbol: "WOOF-BUSD SHIBANCE LP", - lpAddresses: { - 97: "0x00ce857d4a66beF6614E2EBAcf16c8fF5C451146", - 56: "0x6e729f2ed894fbcebc14dfd7344975a558052c55", - }, - token: tokens.woof, - quoteToken: tokens.busd, - }, - { - pid: 4, - lpSymbol: "WOOF-BUSD PANCAKESWAP LP", - lpAddresses: { - 97: "0x638798c119ffC95482423981884c0461664d7195", - 56: "0xe064a0666b86d5554e83adf4bf14fa6d5ffc4175", - }, - token: tokens.woof, - quoteToken: tokens.busd, - }, - { - pid: 2, - lpSymbol: "BUSD-BNB LP", - lpAddresses: { - 56: "0xf5ef5e2ecfb73126ea2db39703e4f6269d484f61", - 97: "0x354f0d65790d44ac7ad65354e150dd8a1aa76f48", - }, - token: tokens.busd, - quoteToken: tokens.wbnb, - }, - { - pid: 6, - lpSymbol: "DOGE-BUSD LP", - lpAddresses: { - 97: "0xaC0AEC94af77eDCc868BDb7BA816380c5129E163", - 56: "0xe076028cecc3e9390e9ae1222b7c99b13de95627", - }, - token: tokens.doge, - quoteToken: tokens.busd, - }, - { - pid: 20, - lpSymbol: "BIRB-WOOF LP", - lpAddresses: { - 97: "", - 56: "0x9809eFcc1E1cDEE2BbA0Efd23ec000ca840725cb", - }, - token: tokens.birb, - quoteToken: tokens.woof, - }, - { - pid: 15, - lpSymbol: "MOONSHOT-WOOF LP", - lpAddresses: { - 97: "", - 56: "0xaa19A0bF68acc25e6a853044AA0f9E9c08C97A7d", - }, - token: tokens.moonshot, - quoteToken: tokens.woof, - }, - { - pid: 8, - lpSymbol: "CUMMIES-WOOF LP", - lpAddresses: { - 97: "", - 56: "0x8Fe92296F007F7B864765BAEc58fCfB7820d71B6", - }, - token: tokens.cummies, - quoteToken: tokens.woof, - }, - { - pid: 11, - lpSymbol: "CUMMIES-BUSD LP", - lpAddresses: { - 97: "", - 56: "0x82b34a5384d337a8f306d1d49063d7e22ebcc296", - }, - token: tokens.cummies, - quoteToken: tokens.busd, - }, - { - pid: 16, - lpSymbol: "CAKE-WOOF LP", - lpAddresses: { - 97: "", - 56: "0xba7e74e2d06d7a76025413a1f338ab849084843b", - }, - token: tokens.cake, - quoteToken: tokens.woof, - }, - { - pid: 17, - lpSymbol: "CAKE-BUSD LP", - lpAddresses: { - 97: "", - 56: "0xcda8205d6bd1619bf79b27e765e4e29651fd987e", - }, - token: tokens.cake, - quoteToken: tokens.busd, - }, - { - pid: 14, - lpSymbol: "ASS-WOOF LP", - lpAddresses: { - 97: "", - 56: "0x2e4a51084eae9237388bec1dce2a26afcbbdb568", - }, - token: tokens.ass, - quoteToken: tokens.woof, - }, - { - pid: 13, - lpSymbol: "ASS-BUSD LP", - lpAddresses: { - 97: "0xF7a8F04bFE8813Ad888d1b6a123aACc2DD86B120", - 56: "0xb719c3f92cdbf7d8426217ae323509b8cee8f4b9", - }, - token: tokens.ass, - quoteToken: tokens.busd, - }, - { - pid: 9, - lpSymbol: "SAFEMOON-WOOF LP", - lpAddresses: { - 97: "", - 56: "0x5261bd9a6fed9361cbf5d00c831e11d7db6bdf54", - }, - token: tokens.safemoon, - quoteToken: tokens.woof, - }, - { - pid: 10, - lpSymbol: "SAFEMOON-BUSD LP", - lpAddresses: { - 97: "", - 56: "0x916c7e58017e24de428b48a05db7531dd478a75b", - }, - token: tokens.safemoon, - quoteToken: tokens.busd, - }, - { - pid: 7, - lpSymbol: "BABYDOGE-WOOF LP", - lpAddresses: { - 97: "", - 56: "0x3627589F64e3942b18549361fC35a5F2Bd08eF77", - }, - token: tokens.babydoge, - quoteToken: tokens.woof, - }, - { - pid: 12, - lpSymbol: "BABYDOGE-BUSD LP", - lpAddresses: { - 97: "", - 56: "0x1f6753200130e3478c7d02671bb7234220f4520c", - }, - token: tokens.babydoge, - quoteToken: tokens.busd, - }, - { - pid: 5, - lpSymbol: "USDT-BUSD LP", - lpAddresses: { - 97: "0x2E2b6cdB1ea0C39b397EbFc50BF2117437819002", - 56: "0x6f5ae0eb19343b8b1b1426fc11fa9ae1f0a15159", - }, - token: tokens.usdt, - quoteToken: tokens.busd, - }, -]; - -module.exports = farms; \ No newline at end of file diff --git a/projects/shibance-bsc/constants/bsc/pools.js b/projects/shibance-bsc/constants/bsc/pools.js deleted file mode 100644 index b1b6fae888f..00000000000 --- a/projects/shibance-bsc/constants/bsc/pools.js +++ /dev/null @@ -1,79 +0,0 @@ -const tokens = require("./tokens"); - -const PoolCategory = { - 'COMMUNITY' :'Community', - 'CORE' : 'Core', - 'BINANCE' : 'Binance', // Pools using native BNB behave differently than pools using a token - 'AUTO' : 'Auto', -} - -const pools = [ - { - sousId: 0, - stakingToken: tokens.woof, - earningToken: tokens.woof, - contractAddress: { - 97: "0x5559C8a6267b0b1bcDe0005a44db0B1546711B76", - 56: "0x4fbEebd68B71aE4367F778129d4218668151EB99", - }, - poolCategory: PoolCategory.CORE, - harvest: true, - tokenPerBlock: "10", - sortOrder: 1, - isFinished: false, - }, - { - sousId: 1, - stakingToken: tokens.woof, - earningToken: tokens.ass, - contractAddress: { - 97: "0x1E3C2695Aa1b040a56e9aE7db7E7b2B96125e17A", - 56: "0xb2b694833e0875eA76AF7Fe50800658A41831fcF", - }, - poolCategory: PoolCategory.CORE, - harvest: true, - tokenPerBlock: "3260302.556", - sortOrder: 1, - }, - { - sousId: 2, - stakingToken: tokens.woof, - earningToken: tokens.busd, - contractAddress: { - 97: "0x4Cad350eA6F1C0010A11aA6b4Df26617A50AD8fF", - 56: "0x52C68033b2eEEFD7b6875b3f9b880a5ccDc51eF7", - }, - poolCategory: PoolCategory.CORE, - harvest: true, - tokenPerBlock: "0.011574", - sortOrder: 1, - }, - { - sousId: 3, - stakingToken: tokens.woof, - earningToken: tokens.cummies, - contractAddress: { - 97: "0x88f1Ee74eE6727Cb77208A8935261146F9b64293", - 56: "0x2d7831a6C7018dCEF7f9764Bee684B8f7d505222", - }, - poolCategory: PoolCategory.CORE, - harvest: true, - tokenPerBlock: "0.230902777", - sortOrder: 1, - }, - { - sousId: 4, - stakingToken: tokens.woof, - earningToken: tokens.cupcake, - contractAddress: { - 97: "", - 56: "0xD7a7b01C47497339ECaDcca579492De45bE68A71", - }, - poolCategory: PoolCategory.CORE, - harvest: true, - tokenPerBlock: "1765", - sortOrder: 2, - }, -]; - -module.exports = pools; \ No newline at end of file diff --git a/projects/shibance-bsc/constants/bsc/tokens.js b/projects/shibance-bsc/constants/bsc/tokens.js deleted file mode 100644 index 5140a1a7a50..00000000000 --- a/projects/shibance-bsc/constants/bsc/tokens.js +++ /dev/null @@ -1,135 +0,0 @@ -const ADDRESSES = require('../../../helper/coreAssets.json') -const tokens = { - bnb: { - symbol: "BNB", - projectLink: "https://www.binance.com/", - }, - woof: { - symbol: "WOOF", - address: { - 56: "0x9e26c50B8A3b7652c3fD2B378252A8647a0C9268", - 97: "0x43eef5BA4899431F7F9D855E9C5Ed06016c8227b", - }, - decimals: 18, - projectLink: "https://shibance.com/", - }, - syrup: { - symbol: "DOGGYPOUND", - address: { - 56: "0x516B3D832379cd9417bFA3cc54459460CB91fd33", - 97: "0xCBc317eFa8f0b18683C6c1b9e1842BcaCbC46f36", - }, - decimals: 18, - projectLink: "https://pancakeswap.finance/", - }, - wbnb: { - symbol: "wBNB", - address: { - 56: ADDRESSES.bsc.WBNB, - 97: "0xae13d989dac2f0debff460ac112a837c89baa7cd", - }, - decimals: 18, - projectLink: "https://pancakeswap.finance/", - }, - busd: { - symbol: "BUSD", - address: { - 56: ADDRESSES.bsc.BUSD, - 97: "0x8301f2213c0eed49a7e28ae4c3e91722919b8b47", - }, - decimals: 18, - projectLink: "https://www.paxos.com/busd/", - }, - usdt: { - symbol: "USDT", - address: { - 56: ADDRESSES.bsc.USDT, - 97: "0x9D4BB7939D27D3bd7F425744DFBf7eE777490388", - }, - decimals: 18, - projectLink: "https://usdt.com/", - }, - doge: { - symbol: "DOGE", - address: { - 56: "0xba2ae424d960c26247dd6c32edc70b295c744c43", - 97: "0x30c638Fd87379Dc280fA1892667a1BFA4ff31387", - }, - decimals: 8, - projectLink: "https://doge.com/", - }, - babydoge: { - symbol: "BABYDOGE", - address: { - 56: "0xc748673057861a797275cd8a068abb95a902e8de", - 97: "", - }, - decimals: 18, - projectLink: "https://babydogecoin.com/", - }, - cummies: { - symbol: "CUMMIES", - address: { - 56: "0x27ae27110350b98d564b9a3eed31baebc82d878d", - 97: "", - }, - decimals: 18, - projectLink: "https://cumrocket.io/", - }, - safemoon: { - symbol: "SAFEMOON", - address: { - 56: "0x8076c74c5e3f5852037f31ff0093eeb8c8add8d3", - 97: "", - }, - decimals: 9, - projectLink: "https://safemoon.net/", - }, - ass: { - symbol: "ASS", - address: { - 56: "0x7c63f96feafacd84e75a594c00fac3693386fbf0", - 97: "0x422227357806ed386de58340d34c17b60d68046e", - }, - decimals: 9, - projectLink: "https://assfinance.com/", - }, - moonshot: { - symbol: "MOONSHOT", - address: { - 56: "0xd27d3f7f329d93d897612e413f207a4dbe8bf799", - 97: "", - }, - decimals: 9, - projectLink: "https://project-moonshot.me/", - }, - cake: { - symbol: "CAKE", - address: { - 56: "0x0e09fabb73bd3ade0a17ecc321fd13a19e81ce82", - 97: "", - }, - decimals: 18, - projectLink: "https://pancakeswap.finance/", - }, - cupcake: { - symbol: "CUPCAKE", - address: { - 56: "0x5d74b0f8c474f96e093c70b507452399573cff73", - 97: "", - }, - decimals: 18, - projectLink: "https://cupcakecoin.io/", - }, - birb: { - symbol: "BIRB", - address: { - 56: "0x82a479264b36104be4fdb91618a59a4fc0f50650", - 97: "", - }, - decimals: 18, - projectLink: "https://birb.co/", - }, -}; - -module.exports = tokens; \ No newline at end of file diff --git a/projects/shibance-bsc/constants/chain.js b/projects/shibance-bsc/constants/chain.js deleted file mode 100644 index 16c71478962..00000000000 --- a/projects/shibance-bsc/constants/chain.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - kcc: 321, - bsc: 56, -}; \ No newline at end of file diff --git a/projects/shibance-bsc/constants/kcc/contracts.js b/projects/shibance-bsc/constants/kcc/contracts.js deleted file mode 100644 index 929889ec98e..00000000000 --- a/projects/shibance-bsc/constants/kcc/contracts.js +++ /dev/null @@ -1,14 +0,0 @@ -module.exports = { - masterChef: { - 321: "0x1Ae33198c47799e9333bbcd74cd3aB80DC03D283", - }, - sousChef: { - 321: "0xE35a1619319BBfa5Bf985e4Ca14964210774aB31", - }, - multiCall: { - 321: "0xEdf9cC6cC32842D74ffD6D85D7985ee9283B1E24", - }, - woofVault: { - 321: "0x5cE1e2F6c99aFcfbB6E640354837C263ec3a5664", - }, -}; \ No newline at end of file diff --git a/projects/shibance-bsc/constants/kcc/farms.js b/projects/shibance-bsc/constants/kcc/farms.js deleted file mode 100644 index 0abaf129c3b..00000000000 --- a/projects/shibance-bsc/constants/kcc/farms.js +++ /dev/null @@ -1,105 +0,0 @@ -const tokens = require("./tokens"); - -const farms = [ - { - pid: 0, - lpSymbol: "KWOOF", - lpAddresses: { - 321: "0x192F72eFD1009D90B0e6F82Ff27a0a2389F803e5", - }, - token: tokens.syrup, - quoteToken: tokens.wbnb, - }, - { - pid: 10, - lpSymbol: "KAFE-KWOOF LP", - lpAddresses: { - 321: "0x016b2ec91d6eebf65827c16b612a35187e0db6f9", - }, - token: tokens.kafe, - quoteToken: tokens.kwoof, - }, - { - pid: 11, - lpSymbol: "KAFE-USDT LP", - lpAddresses: { - 321: "0x473666ca99a69c3d445386c0c4d1b524c9e8fd35", - }, - token: tokens.kafe, - quoteToken: tokens.busd, - }, - { - pid: 1, - lpSymbol: "KWOOF-KCS LP", - lpAddresses: { - 321: "0x463e451d05f84da345d641fbaa3129693ce13816", - }, - token: tokens.kwoof, - quoteToken: tokens.wbnb, - }, - { - pid: 3, - lpSymbol: "KWOOF-USDT LP", - lpAddresses: { - 321: "0x5ea4ee58945c7e94c6efdce53d0b46d3dfbcf7db", - }, - token: tokens.kwoof, - quoteToken: tokens.busd, - }, - { - pid: 4, - lpSymbol: "KWOOF-USDC LP", - lpAddresses: { - 321: "0xd05be4d487beffb4eb9dbec9f16158d7c9e60a7c", - }, - token: tokens.kwoof, - quoteToken: tokens.usdc, - }, - { - pid: 2, - lpSymbol: "USDT-KCS LP", - lpAddresses: { - 321: "0x5a4b75cec96b99bc7dda80c42914636a5a46dfb1", - }, - token: tokens.busd, - quoteToken: tokens.wbnb, - }, - { - pid: 5, - lpSymbol: "USDC-KCS LP", - lpAddresses: { - 321: "0x3705eef160335a9aaa375ce31f858ba0a64aade0", - }, - token: tokens.usdc, - quoteToken: tokens.wbnb, - }, - { - pid: 6, - lpSymbol: "USDC-USDT LP", - lpAddresses: { - 321: "0x7060d8bfe77df123c8992d6ebf36b66163124c33", - }, - token: tokens.usdc, - quoteToken: tokens.busd, - }, - { - pid: 7, - lpSymbol: "GHOST-KWOOF LP", - lpAddresses: { - 321: "0x35540268609fbfbbed512bc917d75668e5f5d11d", - }, - token: tokens.ghost, - quoteToken: tokens.kwoof, - }, - { - pid: 8, - lpSymbol: "KUST-KWOOF LP", - lpAddresses: { - 321: "0x4eda6784ed216a30d89da18a73c05dff810c69e2", - }, - token: tokens.kust, - quoteToken: tokens.kwoof, - }, -]; - -module.exports = farms; diff --git a/projects/shibance-bsc/constants/kcc/pools.js b/projects/shibance-bsc/constants/kcc/pools.js deleted file mode 100644 index b9593ae39af..00000000000 --- a/projects/shibance-bsc/constants/kcc/pools.js +++ /dev/null @@ -1,39 +0,0 @@ -const tokens = require("./tokens"); - -const PoolCategory = { - COMMUNITY: "Community", - CORE: "Core", - BINANCE: "Binance", // Pools using native BNB behave differently than pools using a token - AUTO: "Auto", -}; - -const pools = [ - { - sousId: 0, - stakingToken: tokens.kwoof, - earningToken: tokens.kwoof, - contractAddress: { - 321: "0x1Ae33198c47799e9333bbcd74cd3aB80DC03D283", - }, - poolCategory: PoolCategory.CORE, - harvest: true, - tokenPerBlock: "10", - sortOrder: 1, - isFinished: false, - }, - { - sousId: 1, - stakingToken: tokens.kwoof, - earningToken: tokens.kafe, - contractAddress: { - 321: "0x27d55dd01cb6bff2791f46e4a7657e69257e80df", - }, - poolCategory: PoolCategory.CORE, - harvest: true, - tokenPerBlock: "0.00289", - sortOrder: 1, - isFinished: false, - }, -]; - -module.exports = pools; diff --git a/projects/shibance-bsc/constants/kcc/tokens.js b/projects/shibance-bsc/constants/kcc/tokens.js deleted file mode 100644 index f99759f16c3..00000000000 --- a/projects/shibance-bsc/constants/kcc/tokens.js +++ /dev/null @@ -1,73 +0,0 @@ -const ADDRESSES = require('../../../helper/coreAssets.json') -const tokens = { - bnb: { - symbol: "BNB", - projectLink: "https://www.kucoin.com/", - }, - kwoof: { - symbol: "KWOOF", - address: { - 321: "0x192F72eFD1009D90B0e6F82Ff27a0a2389F803e5", - }, - decimals: 18, - projectLink: "https://shibance.com/", - }, - syrup: { - symbol: "DOGGYPOUND", - address: { - 321: "0xc72B04864aE423CD97F83E49D53b76b5937de8C8", - }, - decimals: 18, - projectLink: "https://shibance.com/", - }, - wbnb: { - symbol: "wBNB", - address: { - 321: ADDRESSES.kcc.WKCS, - }, - decimals: 18, - projectLink: "https://www.kcc.io/", - }, - busd: { - symbol: "BUSD", - address: { - 321: ADDRESSES.kcc.USDT, - }, - decimals: 18, - projectLink: "https://www.kcc.io/", - }, - usdc: { - symbol: "USDC", - address: { - 321: ADDRESSES.kcc.USDC, - }, - decimals: 18, - projectLink: "https://www.kcc.io/", - }, - ghost: { - symbol: "GHOST", - address: { - 321: "0x3341a4cc481637a773187400227446f85f66da0a", - }, - decimals: 9, - projectLink: "https://twitter.com/kughostkcc/", - }, - kust: { - symbol: "KUST", - address: { - 321: "0xfc56a7e70f6c970538020cc39939929b4d393f1f", - }, - decimals: 18, - projectLink: "https://kustarter.com/", - }, - kafe: { - symbol: "KAFE", - address: { - 321: "0x516F50028780B60e2FE08eFa853124438f9E46a7", - }, - decimals: 18, - projectLink: "https://kukafe.finance/", - }, -}; - -module.exports = tokens; diff --git a/projects/shibance-bsc/farm.js b/projects/shibance-bsc/farm.js deleted file mode 100644 index 97ba169f07b..00000000000 --- a/projects/shibance-bsc/farm.js +++ /dev/null @@ -1,318 +0,0 @@ - - -const chains = require('./constants/chain'); -const { BIG_TEN, BIG_ZERO } = require("./format"); -const sdk = require("@defillama/sdk"); -const multiCall = sdk.api.abi.multiCall; -const allABI = require("./constants/abi.json"); -const BigNumber = require("bignumber.js"); - -const fetchFarm = async (chain, farm, block) => { - const { pid, lpAddresses, token, quoteToken } = farm; - const chainId = chains[chain]; - const addresses = require("./constants/" + chain + "/contracts.js"); - - function getAddress(addrs) { - return addrs[chainId]; - } - - const getMasterChefAddress = () => { - return getAddress(addresses.masterChef); - }; - - const lpAddress = lpAddresses[chainId]; - const farmFetch = async () => { - var _a; - const balances = ( - await multiCall({ - chain, - block, - calls: [ - // Balance of token in the LP contract - { - target: getAddress(token.address), - params: lpAddress, - }, - // Balance of quote token on LP contract - { - target: getAddress(quoteToken.address), - params: lpAddress, - }, - // Balance of LP tokens in the master chef contract - { - target: lpAddress, - params: getMasterChefAddress(), - }, - ].filter((_) => _.params), - abi: "erc20:balanceOf", - }) - ).output.map((_) => _.output); - - const decimals = ( - await multiCall({ - chain, - block, - calls: [ - { - target: getAddress(token.address), - }, - { - target: getAddress(quoteToken.address), - }, - ], - abi: "erc20:decimals", - }) - ).output.map((_) => _.output); - - const lpTotal = ( - await multiCall({ - chain, - block, - calls: [ - { - target: lpAddress, - }, - ], - abi: "erc20:totalSupply", - }) - ).output.map((_) => _.output); - - - const [tokenBalanceLP, quoteTokenBalanceLP, lpTokenBalanceMC] = balances; - const [lpTotalSupply] = lpTotal; - const [tokenDecimals, quoteTokenDecimals] = decimals; - - // Ratio in % of LP tokens that are staked in the MC, vs the total number in circulation - const lpTokenRatio = new BigNumber(lpTokenBalanceMC).div( - new BigNumber(lpTotalSupply) - ); - // Raw amount of token in the LP, including those not staked - const tokenAmountTotal = new BigNumber(tokenBalanceLP).div( - BIG_TEN.pow(tokenDecimals) - ); - const quoteTokenAmountTotal = new BigNumber(quoteTokenBalanceLP).div( - BIG_TEN.pow(quoteTokenDecimals) - ); - // Amount of token in the LP that are staked in the MC (i.e amount of token * lp ratio) - const tokenAmountMc = tokenAmountTotal.times(lpTokenRatio); - const quoteTokenAmountMc = quoteTokenAmountTotal.times(lpTokenRatio); - // Total staked in LP, in quote token value - const lpTotalInQuoteToken = quoteTokenAmountMc.times(new BigNumber(2)); - - // Only make masterchef calls if farm has pid - const [info, totalAllocPoint] = - pid || pid === 0 - ? [ - ( - await multiCall({ - chain, - block, - calls: [ - { - target: getMasterChefAddress(), - name: "poolInfo", - params: [pid], - }, - ], - abi: allABI["poolInfo"], - }) - ).output.map((_) => _.output)[0], - ( - await multiCall({ - chain, - block, - calls: [ - { - target: getMasterChefAddress(), - name: "totalAllocPoint", - }, - ], - abi: allABI["totalAllocPoint"], - }) - ).output.map((_) => _.output)[0], - ] - : [null, null]; - - const allocPoint = info ? new BigNumber(info.allocPoint) : BIG_ZERO; - const poolWeight = totalAllocPoint - ? allocPoint.div(new BigNumber(totalAllocPoint)) - : BIG_ZERO; - return { - ...farm, - tokenAmountMc: tokenAmountMc.toJSON(), - quoteTokenAmountMc: quoteTokenAmountMc.toJSON(), - tokenAmountTotal: tokenAmountTotal.toJSON(), - quoteTokenAmountTotal: quoteTokenAmountTotal.toJSON(), - lpTotalSupply: new BigNumber(lpTotalSupply).toJSON(), - lpTotalInQuoteToken: lpTotalInQuoteToken.toJSON(), - tokenPriceVsQuote: quoteTokenAmountTotal.div(tokenAmountTotal).toJSON(), - poolWeight: poolWeight.toJSON(), - multiplier: `${allocPoint.div(100).toString()}X`, - }; - }; - // // In some browsers promise above gets stuck that causes fetchFarms to not proceed. - // const timeout = new Promise((resolve) => { - // const id = setTimeout(() => { - // clearTimeout(id); - // resolve({}); - // }, 25000); - // }); - return await farmFetch(); -}; - -const filterFarmsByQuoteToken = ( - farms, - preferredQuoteTokens = ["BUSD", "wBNB"] -) => { - const preferredFarm = farms.find((farm) => { - return preferredQuoteTokens.some((quoteToken) => { - return farm.quoteToken.symbol === quoteToken; - }); - }); - return preferredFarm || farms[0]; -}; - - -const getFarmFromTokenSymbol = ( - farms, - tokenSymbol, - preferredQuoteTokens -) => { - const farmsWithTokenSymbol = farms.filter( - (farm) => farm.token.symbol === tokenSymbol - ); - const filteredFarm = filterFarmsByQuoteToken( - farmsWithTokenSymbol, - preferredQuoteTokens - ); - return filteredFarm; -}; - -const getFarmBaseTokenPrice = ( - farm, - quoteTokenFarm, - bnbPriceBusd -) => { - const hasTokenPriceVsQuote = Boolean(farm.tokenPriceVsQuote); - - if (farm.quoteToken.symbol === "BUSD") { - return hasTokenPriceVsQuote - ? new BigNumber(farm.tokenPriceVsQuote) - : BIG_ZERO; - } - - if (farm.quoteToken.symbol === "wBNB") { - return hasTokenPriceVsQuote - ? bnbPriceBusd.times(farm.tokenPriceVsQuote) - : BIG_ZERO; - } - - // We can only calculate profits without a quoteTokenFarm for BUSD/BNB farms - if (!quoteTokenFarm) { - return BIG_ZERO; - } - - // Possible alternative farm quoteTokens: - // UST (i.e. MIR-UST), pBTC (i.e. PNT-pBTC), BTCB (i.e. bBADGER-BTCB), ETH (i.e. SUSHI-ETH) - // If the farm's quote token isn't BUSD or wBNB, we then use the quote token, of the original farm's quote token - // i.e. for farm PNT - pBTC we use the pBTC farm's quote token - BNB, (pBTC - BNB) - // from the BNB - pBTC price, we can calculate the PNT - BUSD price - if (quoteTokenFarm.quoteToken.symbol === "wBNB") { - const quoteTokenInBusd = bnbPriceBusd.times( - quoteTokenFarm.tokenPriceVsQuote - ); - return hasTokenPriceVsQuote && quoteTokenInBusd - ? new BigNumber(farm.tokenPriceVsQuote).times(quoteTokenInBusd) - : BIG_ZERO; - } - - if (quoteTokenFarm.quoteToken.symbol === "BUSD") { - const quoteTokenInBusd = quoteTokenFarm.tokenPriceVsQuote; - return hasTokenPriceVsQuote && quoteTokenInBusd - ? new BigNumber(farm.tokenPriceVsQuote).times(quoteTokenInBusd) - : BIG_ZERO; - } - - // Catch in case token does not have immediate or once-removed BUSD/wBNB quoteToken - return BIG_ZERO; -}; - -const getFarmQuoteTokenPrice = ( - farm, - quoteTokenFarm, - bnbPriceBusd -) => { - if (farm.quoteToken.symbol === "BUSD") { - return new BigNumber(1); - } - - if (farm.quoteToken.symbol === "wBNB") { - return bnbPriceBusd; - } - - if (!quoteTokenFarm) { - return BIG_ZERO; - } - - if (quoteTokenFarm.quoteToken.symbol === "wBNB") { - return quoteTokenFarm.tokenPriceVsQuote - ? bnbPriceBusd.times(quoteTokenFarm.tokenPriceVsQuote) - : BIG_ZERO; - } - - if (quoteTokenFarm.quoteToken.symbol === "BUSD") { - return quoteTokenFarm.tokenPriceVsQuote - ? new BigNumber(quoteTokenFarm.tokenPriceVsQuote) - : BIG_ZERO; - } - - return BIG_ZERO; -}; - -const fetchFarmsPrices = async (farms) => { - const bnbBusdFarm = farms.find((farm) => farm.pid === 2); - const bnbPriceBusd = bnbBusdFarm.tokenPriceVsQuote - ? new BigNumber(1).div(bnbBusdFarm.tokenPriceVsQuote) - : BIG_ZERO; - - const farmsWithPrices = farms.map((farm) => { - const quoteTokenFarm = getFarmFromTokenSymbol( - farms, - farm.quoteToken.symbol - ); - const baseTokenPrice = getFarmBaseTokenPrice( - farm, - quoteTokenFarm, - bnbPriceBusd - ); - const quoteTokenPrice = getFarmQuoteTokenPrice( - farm, - quoteTokenFarm, - bnbPriceBusd - ); - const token = { ...farm.token, busdPrice: baseTokenPrice.toJSON() }; - const quoteToken = { - ...farm.quoteToken, - busdPrice: quoteTokenPrice.toJSON(), - }; - return { ...farm, token, quoteToken }; - }); - - return farmsWithPrices; -}; - - -async function fetchFarms(chain, block) { - try { - const farms = require("./constants/" + chain + "/farms"); - let allInfos = await Promise.all( - farms.map((_) => fetchFarm(chain, _, block)) - ); - allInfos = fetchFarmsPrices(allInfos); - return allInfos; - } catch(e) { - sdk.log("fetchFarms.error", e); - } -} - -module.exports = fetchFarms; \ No newline at end of file diff --git a/projects/shibance-bsc/format.js b/projects/shibance-bsc/format.js deleted file mode 100644 index dbca93475ea..00000000000 --- a/projects/shibance-bsc/format.js +++ /dev/null @@ -1,43 +0,0 @@ - -const BigNumber = require("bignumber.js"); -const BIG_TEN = new BigNumber(10) -const BIG_ZERO = new BigNumber(0); -/** - * Take a formatted amount, e.g. 15 BNB and convert it to full decimal value, e.g. 15000000000000000 - */ -const getDecimalAmount = (amount, decimals = 18) => { - return new BigNumber(amount).times(BIG_TEN.pow(decimals)) -} - -const getBalanceAmount = (amount, decimals = 18) => { - return new BigNumber(amount).dividedBy(BIG_TEN.pow(decimals)) -} - -/** - * This function is not really necessary but is used throughout the site. - */ -const getBalanceNumber = (balance, decimals = 18) => { - return getBalanceAmount(balance, decimals).toNumber() -} - -const getFullDisplayBalance = (balance, decimals = 18, decimalsToAppear) => { - return getBalanceAmount(balance, decimals).toFixed(decimalsToAppear) -} - -const formatNumber = (number, minPrecision = 2, maxPrecision = 2) => { - const options = { - minimumFractionDigits: minPrecision, - maximumFractionDigits: maxPrecision, - } - return number.toLocaleString(undefined, options) -} - -module.exports = { - BIG_ZERO, - BIG_TEN, - formatNumber, - getFullDisplayBalance, - getBalanceNumber, - getBalanceAmount, - getDecimalAmount -} \ No newline at end of file diff --git a/projects/shibance-bsc/index.js b/projects/shibance-bsc/index.js deleted file mode 100644 index cfc420d444c..00000000000 --- a/projects/shibance-bsc/index.js +++ /dev/null @@ -1,93 +0,0 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const BigNumber = require("bignumber.js"); -const { getBalanceNumber } = require('./format'); -const chains = require('./constants/chain'); - -const fetchPublicVaultData = require("./vault"); -const fetchFarms = require('./farm'); -const { fetchPoolsTotalStaking } = require('./pool'); - -function getChainTvl(chain) { - return function (timestamp, _ethBlock, chainBlocks) { - return getTvl(chain, timestamp, _ethBlock, chainBlocks); - }; -} - -async function getTvl(chain, timestamp, _ethBlock, chainBlocks) { - const block = chainBlocks ? chainBlocks[chain] : null; - const chainPid = { - kcc: 1, - bsc: 3 - }; - - const chainId = chains[chain]; - const [vData, pools, farmsLP] = await Promise.all([ - fetchPublicVaultData(chain, block), - fetchPoolsTotalStaking(chain, block), - fetchFarms(chain, block), - ]); - - const totalCakeInVault = new BigNumber(vData.totalCakeInVault); - const woofLp = farmsLP.filter(_ => _.pid == chainPid[chain])[0]; - const woofPrice = new BigNumber(woofLp.token.busdPrice); - - const farmsLiquidity = farmsLP - .map((farm) => { - if ( - farm.pid !== 0 && - farm.multiplier !== "0X" && - farm.lpTotalInQuoteToken && - farm.quoteToken.busdPrice - ) { - return new BigNumber(farm.lpTotalInQuoteToken).times( - farm.quoteToken.busdPrice - ); - } - return null; - }) - .filter((liquidity) => !!liquidity) - .reduce((a, b) => a.plus(b)); - - let poolsStaked = null; - - if (woofPrice.gt(0) && totalCakeInVault.gt(0)) { - const staked = pools.map((pool) => { - if (pool.sousId === 0) { - return new BigNumber(pool.totalStaked) - .minus(totalCakeInVault) - .times(woofPrice); - } - return new BigNumber(pool.totalStaked).times(woofPrice); - }); - poolsStaked = staked.reduce((a, b) => a.plus(b)); - } - - const tvl = - farmsLiquidity && totalCakeInVault && poolsStaked - ? farmsLiquidity - .plus( - getBalanceNumber( - totalCakeInVault.times(woofPrice).plus(poolsStaked), - 18 - ) - ) - : null; - - const balances = {}; - const usdMappings = { - 'bsc' : ADDRESSES.ethereum.BUSD - } - const baseToken = usdMappings[chain]; - balances[`${chain}:${baseToken}`] = tvl.toNumber(); - - return tvl.toNumber(); -} - - -module.exports = { - misrepresentedTokens: true, - methodology: "We count liquidity on the dexes, pulling data from onchain", - bsc: { - tvl: getChainTvl("bsc"), - } -}; \ No newline at end of file diff --git a/projects/shibance-bsc/pool.js b/projects/shibance-bsc/pool.js deleted file mode 100644 index c8533bf5fa6..00000000000 --- a/projects/shibance-bsc/pool.js +++ /dev/null @@ -1,78 +0,0 @@ -const chains = require("./constants/chain"); -const sdk = require("@defillama/sdk"); -const multiCall = sdk.api.abi.multiCall; -const BigNumber = require("bignumber.js"); - -const fetchPoolsTotalStaking = async (chain, block) => { - const chainId = chains[chain]; - const tokens = require("./constants/" + chain + "/tokens"); - const poolsConfig = require("./constants/" + chain + "/pools"); - - function getAddress(addrs) { - return addrs[chainId]; - } - - const getWbnbAddress = () => { - return getAddress(tokens.wbnb.address); - }; - try { - - const nonBnbPools = poolsConfig.filter( - (p) => p.stakingToken.symbol !== "BNB" - ); - const bnbPool = poolsConfig.filter((p) => p.stakingToken.symbol === "BNB"); - const callsNonBnbPools = nonBnbPools - .map((poolConfig) => { - return { - target: getAddress(poolConfig.stakingToken.address), - params: getAddress(poolConfig.contractAddress), - }; - }) - .filter((_) => _.params); - - const callsBnbPools = bnbPool - .map((poolConfig) => { - return { - target: getWbnbAddress(), - params: getAddress(poolConfig.contractAddress), - }; - }) - .filter((_) => _.params); - - const nonBnbPoolsTotalStaked = ( - await multiCall({ - chain, - block, - calls: callsNonBnbPools, - abi: "erc20:balanceOf", - }) - ).output.map((_) => _.output); - - const bnbPoolsTotalStaked = ( - await multiCall({ - chain, - block, - calls: callsBnbPools, - abi: "erc20:balanceOf", - }) - ).output.map((_) => _.output); - - return [ - ...nonBnbPools.map((p, index) => ({ - sousId: p.sousId, - totalStaked: new BigNumber(nonBnbPoolsTotalStaked[index]).toJSON(), - })), - ...bnbPool.map((p, index) => ({ - sousId: p.sousId, - totalStaked: new BigNumber(bnbPoolsTotalStaked[index]).toJSON(), - })), - ]; - } catch (e) { - sdk.log("fetchPoolsTotalStaking", e); - } -}; - - -module.exports = { - fetchPoolsTotalStaking, -}; \ No newline at end of file diff --git a/projects/shibance-bsc/vault.js b/projects/shibance-bsc/vault.js deleted file mode 100644 index 5d5832ae2fa..00000000000 --- a/projects/shibance-bsc/vault.js +++ /dev/null @@ -1,88 +0,0 @@ -const cakeVaultAbi = { - getPricePerFullShare: "uint256:getPricePerFullShare", - totalShares: "uint256:totalShares", - calculateHarvestCakeRewards: "uint256:calculateHarvestCakeRewards", - calculateTotalPendingCakeRewards: "uint256:calculateTotalPendingCakeRewards", -} -const BigNumber = require("bignumber.js"); -const { - getBalanceNumber, - getFullDisplayBalance, - getDecimalAmount, -} = require("./format"); - -const woofVaultContractAddres = { - kcc: "0x5cE1e2F6c99aFcfbB6E640354837C263ec3a5664", - bsc: "0x09fE45A62502E7a0b226a99f18043F3eC32F78E8", -}; -const sdk = require("@defillama/sdk") - -const convertSharesToWoof = ( - shares, - cakePerFullShare, - decimals = 18, - decimalsToRound = 3 -) => { - const sharePriceNumber = getBalanceNumber(cakePerFullShare, decimals); - const amountInCake = new BigNumber(shares.multipliedBy(sharePriceNumber)); - const cakeAsNumberBalance = getBalanceNumber(amountInCake, decimals); - const cakeAsBigNumber = getDecimalAmount( - new BigNumber(cakeAsNumberBalance), - decimals - ); - const cakeAsDisplayBalance = getFullDisplayBalance( - amountInCake, - decimals, - decimalsToRound - ); - return { cakeAsNumberBalance, cakeAsBigNumber, cakeAsDisplayBalance }; -}; - -const fetchPublicVaultData = async (chain, block) => { - const woofVaultAddress = woofVaultContractAddres[chain]; - const [ - sharePrice, - shares, - estimatedCakeBountyReward, - totalPendingCakeHarvest, - ] = await Promise.all([ - sdk.api.abi.call({ - block, chain, - target: woofVaultAddress, - abi: cakeVaultAbi.getPricePerFullShare - }), - sdk.api.abi.call({ - block, chain, - target: woofVaultAddress, - abi: cakeVaultAbi.totalShares - }), - sdk.api.abi.call({ - block, chain, - target: woofVaultAddress, - abi: cakeVaultAbi.calculateHarvestCakeRewards - }), - sdk.api.abi.call({ - block, chain, - target: woofVaultAddress, - abi: cakeVaultAbi.calculateTotalPendingCakeRewards - }), - ]).then(response => response.map(a => a.output)); - - const totalSharesAsBigNumber = new BigNumber(shares); - const sharePriceAsBigNumber = new BigNumber(sharePrice); - const totalCakeInVaultEstimate = convertSharesToWoof( - totalSharesAsBigNumber, - sharePriceAsBigNumber - ); - return { - totalShares: totalSharesAsBigNumber.toJSON(), - pricePerFullShare: sharePriceAsBigNumber.toJSON(), - totalCakeInVault: totalCakeInVaultEstimate.cakeAsBigNumber.toJSON(), - estimatedCakeBountyReward: new BigNumber( - estimatedCakeBountyReward - ).toJSON(), - totalPendingCakeHarvest: new BigNumber(totalPendingCakeHarvest).toJSON(), - }; -}; - -module.exports = fetchPublicVaultData; \ No newline at end of file From 95035fe63da75ca94f103001cf27ee029467209c Mon Sep 17 00:00:00 2001 From: saehrimnir Date: Fri, 14 Jul 2023 21:30:44 +0300 Subject: [PATCH 0358/1974] add USDT+USDC [polygon] + TRX [tron] --- projects/pepe-bridge/index.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/projects/pepe-bridge/index.js b/projects/pepe-bridge/index.js index b4440ebb1a9..b690b874cfe 100644 --- a/projects/pepe-bridge/index.js +++ b/projects/pepe-bridge/index.js @@ -27,6 +27,16 @@ const config = { ], polygon: [ [[nullAddress], '0xEa3cc73165748AD1Ca76b4d1bA9ebC43fb399018'], + [ + [ + ADDRESSES.polygon.USDT, + ADDRESSES.polygon.USDC, + ], + '0xF57dB884606a0ed589c06320d9004FBeD4f81e4A' + ] + ], + tron: [ + [[nullAddress], 'TMsm33cUm8HuxyRqwG7xhV46cmx5NVPPGB'] ] } module.exports = {}; From b87db77ac19f3a01f3c0d29053bd1cb4fd443f71 Mon Sep 17 00:00:00 2001 From: MirthFutures <69535002+MirthFutures@users.noreply.github.com> Date: Sat, 15 Jul 2023 07:40:20 -0400 Subject: [PATCH 0359/1974] Add Beefy Polygon zkEVM (#6812) --- projects/beefy/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/beefy/index.js b/projects/beefy/index.js index f26b625255f..2556850b164 100644 --- a/projects/beefy/index.js +++ b/projects/beefy/index.js @@ -34,6 +34,7 @@ const chains = { fantom: 250, zksync: 324, metis: 1088, + polygon_zkevm: 1101, moonbeam: 1284, moonriver: 1285, kava: 2222, From 533b63a0d3b7c4689440c35c1953520fc54b2dea Mon Sep 17 00:00:00 2001 From: stupid-boar <6961601+stupid-boar@users.noreply.github.com> Date: Sat, 15 Jul 2023 14:40:58 +0300 Subject: [PATCH 0360/1974] Add TRON chain (#6809) * fix swop.fi TVL * add USDT/USDC/BTCB for BSC TVL * add CRV token * add polygon MATIC * add USDT+USDC [polygon] + TRX [tron] --- projects/pepe-bridge/index.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/projects/pepe-bridge/index.js b/projects/pepe-bridge/index.js index b4440ebb1a9..b690b874cfe 100644 --- a/projects/pepe-bridge/index.js +++ b/projects/pepe-bridge/index.js @@ -27,6 +27,16 @@ const config = { ], polygon: [ [[nullAddress], '0xEa3cc73165748AD1Ca76b4d1bA9ebC43fb399018'], + [ + [ + ADDRESSES.polygon.USDT, + ADDRESSES.polygon.USDC, + ], + '0xF57dB884606a0ed589c06320d9004FBeD4f81e4A' + ] + ], + tron: [ + [[nullAddress], 'TMsm33cUm8HuxyRqwG7xhV46cmx5NVPPGB'] ] } module.exports = {}; From 59e3acab8aa532740e0c66557c1ece129db7594c Mon Sep 17 00:00:00 2001 From: yieldpulse <138122078+yieldpulse@users.noreply.github.com> Date: Sat, 15 Jul 2023 17:24:36 +0530 Subject: [PATCH 0361/1974] add yieldpulse finance (#6808) * add yieldpulse finance * minor fix --------- Co-authored-by: darkcrystl <111988230+tombhio@users.noreply.github.com> Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/YieldPulseFinance/index.js | 10 ++++++++++ projects/helper/coreAssets.json | 1 + 2 files changed, 11 insertions(+) create mode 100644 projects/YieldPulseFinance/index.js diff --git a/projects/YieldPulseFinance/index.js b/projects/YieldPulseFinance/index.js new file mode 100644 index 00000000000..98946809a2f --- /dev/null +++ b/projects/YieldPulseFinance/index.js @@ -0,0 +1,10 @@ +const { masterchefExports } = require("../helper/unknownTokens"); + +module.exports = masterchefExports({ + chain: "pulse", + masterchef: "0xc9649cd27cFe8D74a47D711e04fEF3AbC4B56bae", + nativeTokens: ["0xDd40a166b43c0b95F1248c9A5AFFD7A166f1526a"], + useDefaultCoreAssets: true, + poolInfoABI: "function poolInfo(uint256) view returns (address)", + getToken: (i) => i, +}); diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index 167ba283a46..07e338b099b 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -1330,6 +1330,7 @@ "ETH": "0x02dcdd04e3f455d838cd1249292c58f3b79e3c3c", "USDC": "0x15D38573d2feeb82e7ad5187aB8c1D52810B1f07", "USDT": "0x0Cb6F5a34ad42ec934882A05265A7d5F59b51A2f", + "HEX": "0x2b591e99afe9f32eaa6214f7b7629768c40eeb39", "DAI": "0xefd766ccb38eaf1dfd701853bfce31359239f305" }, "onus": { From 0d6e53f15ece4ab189b750ae82b0be8212d3b91f Mon Sep 17 00:00:00 2001 From: Lawson Graham <45542987+LawsonGraham@users.noreply.github.com> Date: Sat, 15 Jul 2023 05:15:11 -0700 Subject: [PATCH 0362/1974] added psm tvl (#6810) * added psm tvl * Update package-lock.json --- projects/move-dollar/index.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/projects/move-dollar/index.js b/projects/move-dollar/index.js index 36880178b7a..43d9d511f2c 100644 --- a/projects/move-dollar/index.js +++ b/projects/move-dollar/index.js @@ -12,6 +12,7 @@ async function _getResources() { } const extractVaultType = resource => resource.type.split('<')[1].replace('>', '').split(', '); const vaultsFilter = resource => resource.type.includes(`${moveDollarAddress}::vault::Vaults<`) +const psmsFilter = resource => resource.type.includes(`${moveDollarAddress}::psm::PSM<`) module.exports = { timetravel: false, @@ -25,10 +26,16 @@ module.exports = { total_collateral: vault.data.total_collateral, asset_type: extractVaultType(vault), })); - + const psms = resources.filter(psmsFilter).map(psm => ({ + total_collateral: psm.data.coin.value, + asset_type: extractVaultType(psm), + })); vaults.forEach(({ asset_type, total_collateral }) => { sdk.util.sumSingleBalance(balances, asset_type, total_collateral); }); + psms.forEach(({ asset_type, total_collateral }) => { + sdk.util.sumSingleBalance(balances, asset_type, total_collateral); + }); return transformBalances("aptos", balances); }, From e2a8ce9306b19bf75515478532b17ddc801a0f31 Mon Sep 17 00:00:00 2001 From: gaspare100 Date: Sat, 15 Jul 2023 13:15:42 +0100 Subject: [PATCH 0363/1974] New LPs 14/07 Scrub Invest (#6807) Co-authored-by: theg --- projects/scrubinvest/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/projects/scrubinvest/index.js b/projects/scrubinvest/index.js index 1621561e062..3515579cfd2 100644 --- a/projects/scrubinvest/index.js +++ b/projects/scrubinvest/index.js @@ -15,6 +15,10 @@ async function tvl(_, _b, _cb, { api, }) { { target: '0x371d33963fb89ec9542a11ccf955b3a90391f99f', params: '0x43Ac7f627e41EBDa7515FEaCa425306AaB9cB602' }, { target: '0x1E5573b2A7C1D08112d0Ff22e9F2D8EFc9583532', params: '0x9e890FBD4295D92c41fA12a2083b51C387699Fd8' }, { target: '0x8fE243F8B47107c468537D74514d7c52Cd61E937', params: '0x56a9c9230d6D3b7bF147c10fdDBCD8F2eB1a2B6d' }, + //NEW LPs 14/07 - GAUGE / CONTRACT + { target: '0x5383dEB37479599a33584f7Bbc346ab299e30FF0', params: '0x79eb3848B7B4630D1d883172f8e56B2e8fb18521' }, + { target: '0x776d2Ae19FC4c5982D5b20d8c14BCDae09755796', params: '0x1C415Ce79D0A18A4aA835D3d9083d2aF4d7894FC' }, + { target: '0x1f343A11b317EB54F08D80FD3cF9d706eDA5982c', params: '0xF35265f9713FD7ab6a27D387B2D02C1306FFB606' }, ] const bals = await api.multiCall({ abi: 'erc20:balanceOf', calls }) From 261d4191c2e0830c8bc4b89cbf2a0a7f88fdcee9 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Sat, 15 Jul 2023 15:40:14 +0100 Subject: [PATCH 0364/1974] add ajna --- projects/ajna/index.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 projects/ajna/index.js diff --git a/projects/ajna/index.js b/projects/ajna/index.js new file mode 100644 index 00000000000..70070aee1f4 --- /dev/null +++ b/projects/ajna/index.js @@ -0,0 +1,25 @@ +const sdk = require("@defillama/sdk") +const { sumTokens2 } = require('../helper/unwrapLPs') + +async function tvl(_, _b, _cb, { api, }) { + const pools = await api.call({ abi: 'address[]:getDeployedPoolsList', target: '0xe6f4d9711121e5304b30ac2aae57e3b085ad3c4d'}) + const collaterals = await api.multiCall({ abi: 'address:collateralAddress', calls: pools}) + const borrows = await api.multiCall({ abi: 'address:quoteTokenAddress', calls: pools}) + const ownerTokens = pools.map((v, i) => [[collaterals[i], borrows[i]], v]) + return sumTokens2({ ownerTokens, api}) +} + +async function borrowed(_, _b, _cb, { api, }) { + const pools = await api.call({ abi: 'address[]:getDeployedPoolsList', target: '0xe6f4d9711121e5304b30ac2aae57e3b085ad3c4d'}) + const debts = await api.multiCall({ abi: 'function debtInfo() external view returns (uint256, uint256, uint256, uint256)', calls: pools}) + const borrows = await api.multiCall({ abi: 'address:quoteTokenAddress', calls: pools}) + const borrowScale = await api.multiCall({ abi: 'uint:quoteTokenScale', calls: pools}) + const balances = {} + pools.map((v, i) => sdk.util.sumSingleBalance(balances, borrows[i], debts[i][0]/borrowScale[i])) + return balances + } + +module.exports = { + misrepresentedTokens: true, + ethereum: { tvl, borrowed } +} \ No newline at end of file From ff0d2275d3c243b93ec264bbe7dc9f22bcaf6d8c Mon Sep 17 00:00:00 2001 From: Joss Duff Date: Sat, 15 Jul 2023 14:09:31 -0400 Subject: [PATCH 0365/1974] Added Arbitrum TVL (#6806) * Added 3 new hallmark events * Added tvl data for arbitrum. Both queries run off a dynamic token query from metrics subgraph * code refactor --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/rubicon/index.js | 78 ++++++++++++++++++++------------------- 1 file changed, 41 insertions(+), 37 deletions(-) diff --git a/projects/rubicon/index.js b/projects/rubicon/index.js index 32f6290c202..53b4768732b 100644 --- a/projects/rubicon/index.js +++ b/projects/rubicon/index.js @@ -1,43 +1,47 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const {transformOptimismAddress} = require('../helper/portedTokens') -const {sumTokensAndLPsSharedOwners} = require('../helper/unwrapLPs') +const { cachedGraphQuery } = require('../helper/cache') +const { sumTokens2 } = require('../helper/unwrapLPs') -const tokens = [ - ADDRESSES.optimism.USDC, //USDC - "0x68f180fcce6836688e9084f035309e29bf0a2095", //WBTC - ADDRESSES.optimism.DAI, //DAI - ADDRESSES.optimism.USDT, //USDT - "0x8700daec35af8ff88c16bdf0418774cb3d7599b4", //SNX - ADDRESSES.tombchain.FTM, //ETH - ADDRESSES.optimism.OP //OP -] +const RUBICON_MARKET_OPTIMISM = '0x7a512d3609211e719737E82c7bb7271eC05Da70d' +const RUBICON_MARKET_ARBITRUM = '0xC715a30FDe987637A082Cf5F19C74648b67f2db8' -const owners = [ - "0x7a512d3609211e719737E82c7bb7271eC05Da70d", // Rubicon Market - // * Bath Tokens * TODO: drive dynamically off of subgraph query - "0xB0bE5d911E3BD4Ee2A8706cF1fAc8d767A550497", // bathETH - "0x7571CC9895D8E997853B1e0A1521eBd8481aa186", // bathWBTC - "0xe0e112e8f33d3f437D1F895cbb1A456836125952", // bathUSDC - "0x60daEC2Fc9d2e0de0577A5C708BcaDBA1458A833", // bathDAI - "0xfFBD695bf246c514110f5DAe3Fa88B8c2f42c411", // bathUSDT - "0xeb5F29AfaaA3f44eca8559c3e8173003060e919f", // bathSNX - "0x574a21fE5ea9666DbCA804C9d69d8Caf21d5322b" // bathOP -] +module.exports = { + methodology: "Counts the tokens on the market (orders in the orderbook) and in bath pools", + hallmarks: [ + [1657915200, "OP Rewards Start"], + [1685073974, "V2 Upgrade"], + [1688184374, "OP Rewards for Makers"], + [1688616374, "Arbitrum Launch"] + ] +} -async function tvl(time, ethBlock, {optimism: block}){ - const balances={} - const transform = await transformOptimismAddress() - await sumTokensAndLPsSharedOwners(balances, tokens.map(t=>[t, false]), owners, block, "optimism", transform) - return balances +const config = { + optimism: { + endpoint: 'https://api.thegraph.com/subgraphs/name/denverbaumgartner/rubiconmetricsoptimism', + owners: [ + RUBICON_MARKET_OPTIMISM, // Rubicon Market + "0xB0bE5d911E3BD4Ee2A8706cF1fAc8d767A550497", // bathETH + "0x7571CC9895D8E997853B1e0A1521eBd8481aa186", // bathWBTC + "0xe0e112e8f33d3f437D1F895cbb1A456836125952", // bathUSDC + "0x60daEC2Fc9d2e0de0577A5C708BcaDBA1458A833", // bathDAI + "0xfFBD695bf246c514110f5DAe3Fa88B8c2f42c411", // bathUSDT + "0xeb5F29AfaaA3f44eca8559c3e8173003060e919f", // bathSNX + "0x574a21fE5ea9666DbCA804C9d69d8Caf21d5322b" // bathOP + ] + }, + arbitrum: { + endpoint: 'https://api.thegraph.com/subgraphs/name/jossduff/rubiconmetricsarbitrum', + owners: [RUBICON_MARKET_ARBITRUM,] + } } -module.exports={ - methodology: "Counts the tokens on the bath pools and on the market (orders in the orderbook)", - optimism:{ - tvl - }, - hallmarks:[ - [1657915200, "OP Rewards Start"], - ] -} \ No newline at end of file +Object.keys(config).forEach(chain => { + const { endpoint, owners } = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const response = await cachedGraphQuery('rubicon/' + chain, endpoint, `{ tokens { address } }`) + const tokens = response.tokens.map(i => i.address) + return sumTokens2({ api, tokens, owners}) + } + } +}) \ No newline at end of file From 724b37c6176bf53927293c3ff7554242d2d598d4 Mon Sep 17 00:00:00 2001 From: daedboi <87483308+daedboi@users.noreply.github.com> Date: Sat, 15 Jul 2023 21:16:44 +0300 Subject: [PATCH 0366/1974] Add BSC for Morphex --- projects/morphex/index.js | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/projects/morphex/index.js b/projects/morphex/index.js index 89de1466812..bc99181130b 100644 --- a/projects/morphex/index.js +++ b/projects/morphex/index.js @@ -1,14 +1,24 @@ const { staking } = require("../helper/staking"); const { gmxExports } = require("../helper/gmx"); -const vaultAddress = "0x3CB54f0eB62C371065D739A34a775CC16f46563e"; -const stakingAddress = "0xa4157E273D88ff16B3d8Df68894e1fd809DbC007"; -const tokenAddressMPX = "0x66eEd5FF1701E6ed8470DC391F05e27B1d0657eb"; +// Fantom +const vaultAddressFantom = "0x3CB54f0eB62C371065D739A34a775CC16f46563e"; +const stakingAddressFantom = "0xa4157E273D88ff16B3d8Df68894e1fd809DbC007"; +const tokenAddressMPXFantom = "0x66eEd5FF1701E6ed8470DC391F05e27B1d0657eb"; + +// BNB Chain +const vaultAddressBSC = "0x46940Dc651bFe3F2CC3E04cf9dC5579B50Cf0765"; +const stakingAddressBSC = "0x13d2bBAE955c54Ab99F71Ff70833dE64482519B1"; +const tokenAddressMPXBSC = "0x94C6B279b5df54b335aE51866d6E2A56BF5Ef9b7"; module.exports = { methodology: "Morphex liquidity is calculated by the value of tokens in the MLP pool. TVL also includes MPX staked.", fantom: { - staking: staking(stakingAddress, tokenAddressMPX, "fantom"), - tvl: gmxExports({ vault: vaultAddress }) - } + staking: staking(stakingAddressFantom, tokenAddressMPXFantom, "fantom"), + tvl: gmxExports({ vault: vaultAddressFantom }) + }, + bsc: { + staking: staking(stakingAddressBSC, tokenAddressMPXBSC, "bsc"), + tvl: gmxExports({ vault: vaultAddressBSC }) + }, }; From 4a442a7693dd71994385e63cd35a0bffb2d42e52 Mon Sep 17 00:00:00 2001 From: daedboi <87483308+daedboi@users.noreply.github.com> Date: Sat, 15 Jul 2023 21:30:28 +0300 Subject: [PATCH 0367/1974] Add BSC for Morphex (#6814) --- projects/morphex/index.js | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/projects/morphex/index.js b/projects/morphex/index.js index 89de1466812..bc99181130b 100644 --- a/projects/morphex/index.js +++ b/projects/morphex/index.js @@ -1,14 +1,24 @@ const { staking } = require("../helper/staking"); const { gmxExports } = require("../helper/gmx"); -const vaultAddress = "0x3CB54f0eB62C371065D739A34a775CC16f46563e"; -const stakingAddress = "0xa4157E273D88ff16B3d8Df68894e1fd809DbC007"; -const tokenAddressMPX = "0x66eEd5FF1701E6ed8470DC391F05e27B1d0657eb"; +// Fantom +const vaultAddressFantom = "0x3CB54f0eB62C371065D739A34a775CC16f46563e"; +const stakingAddressFantom = "0xa4157E273D88ff16B3d8Df68894e1fd809DbC007"; +const tokenAddressMPXFantom = "0x66eEd5FF1701E6ed8470DC391F05e27B1d0657eb"; + +// BNB Chain +const vaultAddressBSC = "0x46940Dc651bFe3F2CC3E04cf9dC5579B50Cf0765"; +const stakingAddressBSC = "0x13d2bBAE955c54Ab99F71Ff70833dE64482519B1"; +const tokenAddressMPXBSC = "0x94C6B279b5df54b335aE51866d6E2A56BF5Ef9b7"; module.exports = { methodology: "Morphex liquidity is calculated by the value of tokens in the MLP pool. TVL also includes MPX staked.", fantom: { - staking: staking(stakingAddress, tokenAddressMPX, "fantom"), - tvl: gmxExports({ vault: vaultAddress }) - } + staking: staking(stakingAddressFantom, tokenAddressMPXFantom, "fantom"), + tvl: gmxExports({ vault: vaultAddressFantom }) + }, + bsc: { + staking: staking(stakingAddressBSC, tokenAddressMPXBSC, "bsc"), + tvl: gmxExports({ vault: vaultAddressBSC }) + }, }; From 9aa1e2a7c52bfe7291d83b174037097fce4ce6cb Mon Sep 17 00:00:00 2001 From: techyderp <138676931+techyderp@users.noreply.github.com> Date: Sun, 16 Jul 2023 20:38:08 +0530 Subject: [PATCH 0368/1974] Added new project(dex) - DerpDEX (#6815) * added DerpDEX as a project(dex) * formatted * Update index.js --------- Co-authored-by: tehyderp <138676931+tehyderp@users.noreply.github.com> Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/DerpDEX/index.js | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 projects/DerpDEX/index.js diff --git a/projects/DerpDEX/index.js b/projects/DerpDEX/index.js new file mode 100644 index 00000000000..7c09f1f6abd --- /dev/null +++ b/projects/DerpDEX/index.js @@ -0,0 +1,8 @@ +const { uniV3Export } = require("../helper/uniswapV3"); + +module.exports = uniV3Export({ + era: { + factory: "0x52a1865eb6903bc777a02ae93159105015ca1517", + fromBlock: 7790768, + }, +}); From b2684dbd3e19d6967209fe39d9f4b51bff8c3c98 Mon Sep 17 00:00:00 2001 From: gaspare100 Date: Sun, 16 Jul 2023 16:08:27 +0100 Subject: [PATCH 0369/1974] New Scrub Invest Pool (#6816) * New LPs 14/07 Scrub Invest * New Pool on Scrub Invest --------- Co-authored-by: theg --- projects/scrubinvest/index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/projects/scrubinvest/index.js b/projects/scrubinvest/index.js index 3515579cfd2..9ffe54bb090 100644 --- a/projects/scrubinvest/index.js +++ b/projects/scrubinvest/index.js @@ -44,6 +44,8 @@ async function tvl(_, _b, _cb, { api, }) { ['0xe3f5a90f9cb311505cd691a46596599aa1a0ad7d', '0x3CcA2C0d433E00433082ba16e968CA11dA6Dc156'], ['0xe3f5a90f9cb311505cd691a46596599aa1a0ad7d', '0x1504B9EDdD57Ed8252b3b3b407DdE27B72A80790'], ['0xc86c7C0eFbd6A49B35E8714C5f59D99De09A225b', '0xC05021F3b3601BF33aB59dc75577B85985ACaab7'], + // New Scrub Pool + ['0x471F79616569343e8e84a66F342B7B433b958154', '0x67041094c4fc1492A1AB988Fb8De0ab4A0a4A080'], // WETH From 7ec0cdf944e1dfe4bc8f48592faa03335c0caade Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Sun, 16 Jul 2023 20:24:25 +0100 Subject: [PATCH 0370/1974] cull events --- projects/meanfinance/index.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/projects/meanfinance/index.js b/projects/meanfinance/index.js index de54e2772ed..6b8637e2f88 100644 --- a/projects/meanfinance/index.js +++ b/projects/meanfinance/index.js @@ -61,13 +61,9 @@ module.exports = { arbitrum: getV2TvlObject('arbitrum'), bsc: getV2TvlObject('bsc'), hallmarks: [ - [1638850958, "V2 Beta launch on Optimism"], - [1643602958, "V2 full launch"], - [1646367758, "Deployment on Polygon"], - [1650082958, "Protocol is paused because a non-critical vulnerability"], + [1650082958, "Protocol is paused due to non-critical vulnerability"], [1653366158, "V2 Relaunch"], - [1654057358, "OP launch brings more users into Optimism and benefits Mean"], - [1666364400, "Yield-While-DCA launch"], + [1654057358, "OP launch"], [1668006000, "Deployment on Arbitrum"], [1672099200, "Deployment on Ethereum"], ] From 54fd4e744e4b9156a9eabe0c02aae229e47180f1 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Sun, 16 Jul 2023 20:25:52 +0100 Subject: [PATCH 0371/1974] remove another event --- projects/meanfinance/index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/projects/meanfinance/index.js b/projects/meanfinance/index.js index 6b8637e2f88..bab0a68a3d1 100644 --- a/projects/meanfinance/index.js +++ b/projects/meanfinance/index.js @@ -62,7 +62,6 @@ module.exports = { bsc: getV2TvlObject('bsc'), hallmarks: [ [1650082958, "Protocol is paused due to non-critical vulnerability"], - [1653366158, "V2 Relaunch"], [1654057358, "OP launch"], [1668006000, "Deployment on Arbitrum"], [1672099200, "Deployment on Ethereum"], From d1ceab1b624fd86312bbe9f9871db1ce62eeb09d Mon Sep 17 00:00:00 2001 From: skydest <139523103+skydest@users.noreply.github.com> Date: Mon, 17 Jul 2023 15:24:34 +0800 Subject: [PATCH 0372/1974] add skydex tvl (#6799) * add skydex tvl * refactor skydex --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/skydex/index.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 projects/skydex/index.js diff --git a/projects/skydex/index.js b/projects/skydex/index.js new file mode 100644 index 00000000000..52156dd304b --- /dev/null +++ b/projects/skydex/index.js @@ -0,0 +1,22 @@ +const { sumTokens2 } = require("../helper/unwrapLPs"); + +const pools = [ + "0xe59eA42466f3dD0ea620A622701085983A068863", + "0x33b4424A65cfE19CDf0Dff4E54e399782327a1b6", +]; + +const blacklistedTokens = [] + +async function tvl(timestamp, ethereumBlock, chainBlocks, { api }) { + const tokensArray = await api.multiCall({ abi: "address[]:getTokens", calls: pools}) + const tokens = tokensArray.flat() + const calls = tokensArray.map((t, i)=> t.map((token) => ({ target: pools[i], params: token }))).flat() + const owners = await api.multiCall({ abi:"function assetOf(address) view returns (address)", calls}) + return sumTokens2({ api, tokensAndOwners2: [tokens, owners], blacklistedTokens }); +} + +module.exports = { + era: { + tvl, + }, +}; From 42aff58c35108417820c37c0335549be4c0a7a15 Mon Sep 17 00:00:00 2001 From: 0xortizzz <139551063+0xortizzz@users.noreply.github.com> Date: Mon, 17 Jul 2023 14:34:58 +0700 Subject: [PATCH 0373/1974] Update treasury (#6819) --- projects/treasury/level.js | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/projects/treasury/level.js b/projects/treasury/level.js index f08b75afe6e..8ddfe1fee2f 100644 --- a/projects/treasury/level.js +++ b/projects/treasury/level.js @@ -1,12 +1,20 @@ const ADDRESSES = require('../helper/coreAssets.json') const { treasuryExports } = require("../helper/treasury"); +const LVL = '0xb64e280e9d1b5dbec4accedb2257a87b400db149'; + module.exports = treasuryExports({ bsc: { tokens: [ "0xb5c42f84ab3f786bca9761240546aa9cec1f8821", ], - owners: ['0x8BFf27E9Fa1C28934554e6B5239Fb52776573619'], + owners: [ + '0x8BFf27E9Fa1C28934554e6B5239Fb52776573619', + '0xb07953f23545796710957faec97f05b21146ac2d', + '0x92a0a11a57c28d4c86a629530fd59b83b1276003', + '0x712a2e08c67cd7153f04fdb3037d4696300921d0', + ], + ownTokens: [LVL], }, arbitrum: { tokens: [ @@ -19,6 +27,10 @@ module.exports = treasuryExports({ "0xb076f79f8D1477165E2ff8fa99930381FB7d94c1", "0x5573405636F4b895E511C9C54aAfbefa0E7Ee458", ], - owners: ['0x635aac65f37a6bbe06a2dde77b0fd2f1748674d4'], + owners: [ + '0x635aac65f37a6bbe06a2dde77b0fd2f1748674d4', + '0x4b47ef68180ec46a0b6be4d34fd9d8680bee2b2c', + ], + ownTokens: [LVL], }, -}) \ No newline at end of file +}) From b3e518e21763f5d18710300e33a425c2e5d8ad0f Mon Sep 17 00:00:00 2001 From: rh-low <113329217+rh-low@users.noreply.github.com> Date: Mon, 17 Jul 2023 15:35:46 +0800 Subject: [PATCH 0374/1974] Added avax, arb, and bsc chains. (#6818) --- projects/messinaone/index.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/projects/messinaone/index.js b/projects/messinaone/index.js index 9d8dd2bdf53..c906f8a0ca5 100644 --- a/projects/messinaone/index.js +++ b/projects/messinaone/index.js @@ -8,6 +8,9 @@ const tokenChain = { algorand: 8, cronos: 20025, polygon: 5, + avax: 6, + arbitrum: 23, + bsc: 4, }; const fetchAssets = async () => { @@ -36,4 +39,7 @@ module.exports = { algorand: { tvl }, cronos: { tvl }, polygon: { tvl }, + avax: { tvl }, + arbitrum: { tvl }, + bsc: { tvl }, }; From 10310103da80892d546f64d3592ec3ab4f72cab1 Mon Sep 17 00:00:00 2001 From: ColaZero-dev <134653846+ColaZero-dev@users.noreply.github.com> Date: Mon, 17 Jul 2023 09:39:03 +0200 Subject: [PATCH 0375/1974] update colafactory adapter (#6817) * update colafactory adapter * minor fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/ColaFactory/index.js | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 projects/ColaFactory/index.js diff --git a/projects/ColaFactory/index.js b/projects/ColaFactory/index.js new file mode 100644 index 00000000000..e34b1fc206d --- /dev/null +++ b/projects/ColaFactory/index.js @@ -0,0 +1,11 @@ +const { masterchefExports } = require("../helper/unknownTokens"); + +module.exports = masterchefExports({ + chain: "pulse", + masterchef: "0x5Fe423A22d4bFD1caFd6044042f4269Fc930F8dC", + nativeTokens: ["0x02Dff78fDeDaF86D9dfbe9B3132aA3Ea72Ed1680"], + useDefaultCoreAssets: true, + poolInfoABI: "function poolInfo(uint256) view returns (address)", + getToken: (i) => i, + blacklistedTokens: ['0x9bd778df9b803a2df1fbe94ca9b5765cdb299a23'], +}); From 870e962494f338e252b810204e1e64a079d2e551 Mon Sep 17 00:00:00 2001 From: define Date: Mon, 17 Jul 2023 10:48:30 +0100 Subject: [PATCH 0376/1974] yield guild game adapters --- projects/treasury/yield-guild-game.js | 57 +++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 projects/treasury/yield-guild-game.js diff --git a/projects/treasury/yield-guild-game.js b/projects/treasury/yield-guild-game.js new file mode 100644 index 00000000000..209fd1e80b4 --- /dev/null +++ b/projects/treasury/yield-guild-game.js @@ -0,0 +1,57 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const Treasury = "0xe30ed74c6633a1b0d34a71c50889f9f0fdb7d68a"; +const YGG = "0x25f8087EAD173b73D6e8B84329989A8eEA16CF73"; +const Treasury1 = "0xf0103243f4d22b5696588646b21313d85916a16a" +const Treasury2 = "0x16b281438c5984a46d94acc6c4b31e252a03dfcf" +const Treasury3 = "0xcafeacdadd29f55ce935492e20f1f982df3fb51d" +const Treasury4 = "0x23eb4e02c29e69452718cd5caf2255488bc7ce3a" +const Treasury5 = "0xb981290d9d804075986482f0302c03a3cd2aff32" +const Treasury6 = "0x21653e2f0472afaf64ec85f585f0db4ab83a83f0" +const Treasury7 = "0x8e8d8015a7ffa49c83ee7a8773b0f69380cc6552" + + +const treasurySolana = "GvAm8xG5BSWXy286jWXWzYpN2xzPADQEoK9U8dQCDtzt" +const treasurySolana1 = "3fGSv3VdKvf7KSMt1o9Lb3dZ4YK9ScUTWktcrC4JJBTq" + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.DAI,//DAI + ADDRESSES.ethereum.STETH,//stETH + ADDRESSES.ethereum.MATIC,//MATIC + ADDRESSES.ethereum.USDC,//USDC + ADDRESSES.ethereum.USDT, + '0x61E90A50137E1F645c9eF4a0d3A4f01477738406',//loka + '0xbA6B0dbb2bA8dAA8F5D6817946393Aef8D3A4487',//HSF + '0x232FB065D9d24c34708eeDbF03724f2e95ABE768',//SHEESHA + '0x0d02755a5700414B26FF040e1dE35D337DF56218' //BEND + ], + owners: [Treasury, Treasury1, Treasury2, Treasury3, Treasury5, Treasury6, Treasury7], + ownTokens: [YGG], + }, + solana: { + tokens: [ + "7dHbWXmci3dT8UFYWYZweBLXgycu7Y3iL6trKn1Y7ARj" + ], + owners: [treasurySolana, treasurySolana1], + }, + optimism: { + tokens: [ + ADDRESSES.optimism.OP, + ADDRESSES.optimism.WETH + ], + owners: [Treasury1], + }, + polygon: { + tokens: [ + "0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619", + "0x8dF3aad3a84da6b69A4DA8aeC3eA40d9091B2Ac4", + "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270", + "0x0b3F868E0BE5597D5DB7fEB59E1CADBb0fdDa50a" + ], + owners: [Treasury2, Treasury4], + }, +}) \ No newline at end of file From 6dda1addbb93fb7c896f4b9683ce167acb1e4e1f Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 17 Jul 2023 13:30:25 +0200 Subject: [PATCH 0377/1974] track fusionx.fi --- package-lock.json | 12 ++++++------ projects/fusionx-fi/index.js | 10 ++++++++++ projects/helper/chains.json | 1 + projects/helper/tokenMapping.js | 4 ++++ 4 files changed, 21 insertions(+), 6 deletions(-) create mode 100644 projects/fusionx-fi/index.js diff --git a/package-lock.json b/package-lock.json index 56af725e087..a24e14c6d4a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -63,9 +63,9 @@ } }, "node_modules/@defillama/sdk": { - "version": "4.0.30", - "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.30.tgz", - "integrity": "sha512-2Z5uQhddHSlcAePFw7d6xBK7JjDXDjmJQiOM7E5/IckaDu7AAD1bm5HScBeTKvBItKAdgDvU48nZeMFj7okImA==", + "version": "4.0.34", + "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.34.tgz", + "integrity": "sha512-Y6YWoqQWts3kliQ7+yXATEOoNn0iVZaz6PVPUdCN0dOta0eOFG6SgaVUDusaqxriQAHUKoYsodcFaIiMeQnQuw==", "dependencies": { "@supercharge/promise-pool": "^2.1.0", "ethers": "^5.4.5", @@ -4194,9 +4194,9 @@ } }, "@defillama/sdk": { - "version": "4.0.30", - "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.30.tgz", - "integrity": "sha512-2Z5uQhddHSlcAePFw7d6xBK7JjDXDjmJQiOM7E5/IckaDu7AAD1bm5HScBeTKvBItKAdgDvU48nZeMFj7okImA==", + "version": "4.0.34", + "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.34.tgz", + "integrity": "sha512-Y6YWoqQWts3kliQ7+yXATEOoNn0iVZaz6PVPUdCN0dOta0eOFG6SgaVUDusaqxriQAHUKoYsodcFaIiMeQnQuw==", "requires": { "@supercharge/promise-pool": "^2.1.0", "ethers": "^5.4.5", diff --git a/projects/fusionx-fi/index.js b/projects/fusionx-fi/index.js new file mode 100644 index 00000000000..5c28a365896 --- /dev/null +++ b/projects/fusionx-fi/index.js @@ -0,0 +1,10 @@ +const { getUniTVL } = require("../helper/unknownTokens"); +module.exports = { + misrepresentedTokens: true, + mantle: { + tvl: getUniTVL({ + factory: "0xe5020961fa51ffd3662cdf307def18f9a87cce7c", + useDefaultCoreAssets: true, + }), + }, +}; diff --git a/projects/helper/chains.json b/projects/helper/chains.json index e74b1076e69..85a86bef980 100644 --- a/projects/helper/chains.json +++ b/projects/helper/chains.json @@ -110,6 +110,7 @@ "litecoin", "loop", "lung", + "mantle", "map", "meta", "meter", diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 7f609adefe0..a6ff5a4e467 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -64,6 +64,10 @@ const fixBalancesTokens = { ozone: { // '0x83048f0bf34feed8ced419455a4320a735a92e9d': { coingeckoId: "ozonechain", decimals: 18 }, // was mapped to wrong chain }, + mantle: { + '0x201eba5cc46d216ce6dc03f6a759e8e766e956ae': { coingeckoId: "tether", decimals: 6 }, + '0x78c1b0c915c4faa5fffa6cabf0219da63d7f4cb8': { coingeckoId: "mantle", decimals: 18 }, + } } ibcChains.forEach(chain => fixBalancesTokens[chain] = { ...ibcMappings, ...(fixBalancesTokens[chain] || {}) }) From 8ddbaf87787f5ad58d51e83d3b0ea8538b9175ad Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 17 Jul 2023 13:44:16 +0200 Subject: [PATCH 0378/1974] track fusionx v3 --- projects/fusionx-v3/index.js | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 projects/fusionx-v3/index.js diff --git a/projects/fusionx-v3/index.js b/projects/fusionx-v3/index.js new file mode 100644 index 00000000000..a460bd32c07 --- /dev/null +++ b/projects/fusionx-v3/index.js @@ -0,0 +1,5 @@ +const { uniV3Export } = require('../helper/uniswapV3') + +module.exports = uniV3Export({ + mantle: { factory: '0x0c69e6B21cD183e2A268649178A66d53d738E760', fromBlock: 2646 }, +}) From d92094aaaad13432fd443440b49b99a165e7c596 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 17 Jul 2023 13:55:33 +0200 Subject: [PATCH 0379/1974] iziswap track mantle --- package-lock.json | 12 ++++++------ projects/helper/tokenMapping.js | 4 ++++ projects/izumi-iziswap/index.js | 1 + 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index a24e14c6d4a..463ef7a6ba5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -63,9 +63,9 @@ } }, "node_modules/@defillama/sdk": { - "version": "4.0.34", - "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.34.tgz", - "integrity": "sha512-Y6YWoqQWts3kliQ7+yXATEOoNn0iVZaz6PVPUdCN0dOta0eOFG6SgaVUDusaqxriQAHUKoYsodcFaIiMeQnQuw==", + "version": "4.0.35", + "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.35.tgz", + "integrity": "sha512-v9v8Ang7xfDOqT93uxzR6jtpICRMGS+AI6/3dbKDk/WVfT1nq9I3Hz2uXcs1q4vIwK8WSpoeT5qlRXgadyJ95g==", "dependencies": { "@supercharge/promise-pool": "^2.1.0", "ethers": "^5.4.5", @@ -4194,9 +4194,9 @@ } }, "@defillama/sdk": { - "version": "4.0.34", - "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.34.tgz", - "integrity": "sha512-Y6YWoqQWts3kliQ7+yXATEOoNn0iVZaz6PVPUdCN0dOta0eOFG6SgaVUDusaqxriQAHUKoYsodcFaIiMeQnQuw==", + "version": "4.0.35", + "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.35.tgz", + "integrity": "sha512-v9v8Ang7xfDOqT93uxzR6jtpICRMGS+AI6/3dbKDk/WVfT1nq9I3Hz2uXcs1q4vIwK8WSpoeT5qlRXgadyJ95g==", "requires": { "@supercharge/promise-pool": "^2.1.0", "ethers": "^5.4.5", diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index a6ff5a4e467..858902bd141 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -57,6 +57,9 @@ const fixBalancesTokens = { tenet: { '0xd6cb8a253e12893b0cf39ca78f7d858652cca1fe': { coingeckoId: "tenet-1b000f7b-59cb-4e06-89ce-d62b32d362b9", decimals: 18 }, }, + ultron: { + '0xb1183357745d3fd7d291e42a2c4b478cdb5710c6': { coingeckoId: "ultron", decimals: 18 }, + }, avax: { '0x8fdcf51d1aaeb9f031838ebeb15884a0d5efcda3': { coingeckoId: "wrapped-bitcoin", decimals: 18 }, '0xaa44678304cc1a848bfc31dc013afcc6c9feae11': { coingeckoId: "benqi", decimals: 18 }, @@ -67,6 +70,7 @@ const fixBalancesTokens = { mantle: { '0x201eba5cc46d216ce6dc03f6a759e8e766e956ae': { coingeckoId: "tether", decimals: 6 }, '0x78c1b0c915c4faa5fffa6cabf0219da63d7f4cb8': { coingeckoId: "mantle", decimals: 18 }, + '0xdeaddeaddeaddeaddeaddeaddeaddeaddead1111': { coingeckoId: "ethereum", decimals: 18 }, } } diff --git a/projects/izumi-iziswap/index.js b/projects/izumi-iziswap/index.js index ccdf428ac89..95e75d5580b 100644 --- a/projects/izumi-iziswap/index.js +++ b/projects/izumi-iziswap/index.js @@ -14,6 +14,7 @@ const poolHelpers = { 'cronos': '0x33531bDBFE34fa6Fd5963D0423f7699775AacaaF', 'polygon': '0x33531bDBFE34fa6Fd5963D0423f7699775AacaaF', // 'conflux': '0x1502d025BfA624469892289D45C0352997251728', + 'mantle': '0x1502d025BfA624469892289D45C0352997251728', 'ethereum': '0x19b683A2F45012318d9B2aE1280d68d3eC54D663', 'ontology_evm': '0x110dE362cc436D7f54210f96b8C7652C2617887D', 'ultron' : '0xcA7e21764CD8f7c1Ec40e651E25Da68AeD096037' From ac263becdb293c4ade48a3a365feaf0731c8e7b3 Mon Sep 17 00:00:00 2001 From: 0xngmi <80541789+0xngmi@users.noreply.github.com> Date: Mon, 17 Jul 2023 13:45:54 +0100 Subject: [PATCH 0380/1974] Update fusion v3 --- projects/fusionx-v3/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/fusionx-v3/index.js b/projects/fusionx-v3/index.js index a460bd32c07..ff3f1093c31 100644 --- a/projects/fusionx-v3/index.js +++ b/projects/fusionx-v3/index.js @@ -1,5 +1,5 @@ const { uniV3Export } = require('../helper/uniswapV3') module.exports = uniV3Export({ - mantle: { factory: '0x0c69e6B21cD183e2A268649178A66d53d738E760', fromBlock: 2646 }, + mantle: { factory: '0x530d2766D1988CC1c000C8b7d00334c14B69AD71', fromBlock: 2646 }, }) From 1726fce912a1f1460992d86df385e72207ae1c68 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 17 Jul 2023 18:32:02 +0200 Subject: [PATCH 0381/1974] track magicianmv.com --- projects/autofarm.js | 63 +++++++++++++++++++++--------------- projects/helper/utils.js | 4 +++ projects/magicianmv/index.js | 10 ++++++ 3 files changed, 51 insertions(+), 26 deletions(-) create mode 100644 projects/magicianmv/index.js diff --git a/projects/autofarm.js b/projects/autofarm.js index e0d7b518883..aec56e503b8 100644 --- a/projects/autofarm.js +++ b/projects/autofarm.js @@ -1,31 +1,42 @@ -const utils = require('./helper/utils'); -const {fetchChainExports} = require('./helper/exports'); +const { sumUnknownTokens } = require('./helper/unknownTokens'); -const transformChain = { - okexchain: 'okex', - avax: 'avax', - wan: 'wanchain', -} - -function chainTvl(chain){ - return async()=>{ - const data = await utils.fetchURL(`https://static.autofarm.network/${transformChain[chain] ?? chain}/stats.json`) - return data.data.platformTVL - } -} - -module.exports=fetchChainExports(chainTvl, [ - 'bsc', 'polygon', - 'heco', 'avax', - 'fantom', 'moonriver', - 'okexchain', 'celo', - 'cronos', 'boba', - 'harmony', 'xdai', - 'velas', 'aurora', - 'oasis', 'wan', - 'kcc', 'evmos' -]) module.exports.hallmarks=[ [1618966800, "Venus incident"], [1634778000, "Emissions end"], ] + +const config = { + aurora: "0x62537419c8327AB66165bAE205Da8fcB6871A700", + avax: "0x864A0B7F8466247A0e44558D29cDC37D4623F213", + boba: "0x864A0B7F8466247A0e44558D29cDC37D4623F213", + bsc: "0x0895196562c7868c5be92459fae7f877ed450452", + celo: "0xdD11b66B90402F294a017c4688509c364312303F", + cronos: "0x76b8c3ECdF99483335239e66F34191f11534cbAA", + fantom: "0x76b8c3ECdF99483335239e66F34191f11534cbAA", + fuse: "0x9C30e4B50b4b3804D3b50f01619c61fE44ed894e", + harmony: "0x9c57658139afb41949cebc07d806f37d29d13eea", + heco: "0x96a29c4bce3126266983f535b41c30dba80d5d99", + moonbeam: "0x77286f5257e090b1bedbc6df6726d53cbf8573a6", + moonriver: "0xfadA8Cc923514F1D7B0586aD554b4a0CeAD4680E", + oasis: "0xbf19C3fe078258F1D1C34bEc7e624AD8a1DE343A", + okexchain: "0x864A0B7F8466247A0e44558D29cDC37D4623F213", + polygon: "0x89d065572136814230A55DdEeDDEC9DF34EB0B76", + velas: "0xAd2DB12795CeD89cA2D1819710233106115E3034", + xdai: "0xfadA8Cc923514F1D7B0586aD554b4a0CeAD4680E", + evmos: "0x9C30e4B50b4b3804D3b50f01619c61fE44ed894e", + kcc: "0x76b8c3ECdF99483335239e66F34191f11534cbAA", + wan: "0xAd2DB12795CeD89cA2D1819710233106115E3034", +} + +Object.keys(config).forEach(chain => { + const masterchef = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const data = await api.fetchList({ lengthAbi: 'uint256:poolLength', itemAbi: 'function poolInfo(uint256) view returns (address want, uint256,uint256,uint256,address strat)', target: masterchef, }) + const tokens = data.map(i => i.want) + const bals = await api.multiCall({ abi: 'uint256:wantLockedTotal', calls: data.map(i => i.strat), permitFailure: true, }) + bals.forEach((v, i) => v && api.add(tokens[i], v)) + return sumUnknownTokens({ api, resolveLP: true, useDefaultCoreAssets: true, }) + } + } +}) diff --git a/projects/helper/utils.js b/projects/helper/utils.js index 7b68ec4a0f7..787dfae90ab 100644 --- a/projects/helper/utils.js +++ b/projects/helper/utils.js @@ -60,6 +60,10 @@ function isLP(symbol, token, chain) { if (chain === 'polygon' && ['WLP', 'FLP'].includes(symbol)) return true if (chain === 'moonriver' && ['HBLP'].includes(symbol)) return true if (chain === 'ethpow' && ['LFG_LP'].includes(symbol)) return true + if (chain === 'aurora' && ['wLP'].includes(symbol)) return true + if (chain === 'oasis' && ['LPT'].includes(symbol)) return true + if (chain === 'wan' && ['WSLP'].includes(symbol)) return true + if (chain === 'polygon' && ['MbtLP'].includes(symbol)) return true if (chain === 'ethereum' && ['SUDO-LP'].includes(symbol)) return false if (chain === 'dogechain' && ['DST-V2'].includes(symbol)) return true if (chain === 'harmony' && ['HLP'].includes(symbol)) return true diff --git a/projects/magicianmv/index.js b/projects/magicianmv/index.js new file mode 100644 index 00000000000..05f52d0903e --- /dev/null +++ b/projects/magicianmv/index.js @@ -0,0 +1,10 @@ +const { getUniTVL } = require("../helper/unknownTokens"); +module.exports = { + misrepresentedTokens: true, + polygon: { + tvl: getUniTVL({ + factory: "0xf08ae17c2a2728a788bb1b6c243fe7eb3e5bbadc", + useDefaultCoreAssets: true, + }), + }, +}; From 01aa5ad1c4bab584a8f7c7105d80a0ca82e5b5f1 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 17 Jul 2023 20:32:39 +0200 Subject: [PATCH 0382/1974] hotfix: heliswap --- projects/heliswap/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/heliswap/index.js b/projects/heliswap/index.js index 1adf5a52513..2d8a730585e 100644 --- a/projects/heliswap/index.js +++ b/projects/heliswap/index.js @@ -44,7 +44,7 @@ const tvl = async () => { data: { data: { poolsConsistingOf }} } = await axios(requestObject); - totalTVL = poolsConsistingOf.reduce((acc, pool) => (isNaN(+pool.tvl)) ? acc : acc + +pool.tvl, 0) + totalTVL = poolsConsistingOf.reduce((acc, pool) => (isNaN(+pool.tvl) || +pool.tvl > 1e7) ? acc : acc + +pool.tvl, 0) return { tether: totalTVL }; }; From a4ce1ac3660baf08ab1a8780d1934759e8e603bf Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 17 Jul 2023 20:43:26 +0200 Subject: [PATCH 0383/1974] minor fix --- projects/heliswap/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/heliswap/index.js b/projects/heliswap/index.js index 2d8a730585e..a6c26debbd9 100644 --- a/projects/heliswap/index.js +++ b/projects/heliswap/index.js @@ -44,7 +44,7 @@ const tvl = async () => { data: { data: { poolsConsistingOf }} } = await axios(requestObject); - totalTVL = poolsConsistingOf.reduce((acc, pool) => (isNaN(+pool.tvl) || +pool.tvl > 1e7) ? acc : acc + +pool.tvl, 0) + totalTVL = poolsConsistingOf.reduce((acc, pool) => (isNaN(+pool.tvl) || +pool.tvl > 1e8) ? acc : acc + +pool.tvl, 0) return { tether: totalTVL }; }; From e508f68c811efbbf9f24087192986b09a826e5a3 Mon Sep 17 00:00:00 2001 From: 0xkaidev <92993009+0xkaidev@users.noreply.github.com> Date: Tue, 18 Jul 2023 01:51:51 +0700 Subject: [PATCH 0384/1974] Moraswap V2 on Neon EVM (#6823) * moraswap v2 * add neon evm chain * code refactor --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/helper/chains.json | 1 + projects/helper/tokenMapping.js | 9 +++------ projects/moraswap/index.js | 24 ++++++++++++++++++++++++ 3 files changed, 28 insertions(+), 6 deletions(-) create mode 100644 projects/moraswap/index.js diff --git a/projects/helper/chains.json b/projects/helper/chains.json index 85a86bef980..2b85f5f4767 100644 --- a/projects/helper/chains.json +++ b/projects/helper/chains.json @@ -127,6 +127,7 @@ "near", "neo", "neo3", + "neon_evm", "neutron", "nova", "nuls", diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 858902bd141..5150ee20ac9 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -45,12 +45,9 @@ const ibcMappings = { const fixBalancesTokens = { // Sample Code - // arbitrum_nova: { - // [nullAddress]: { coingeckoId: "ethereum", decimals: 18 }, - // [ADDRESSES.arbitrum_nova.WETH]: { coingeckoId: "ethereum", decimals: 18 }, - // [ADDRESSES.arbitrum_nova.USDT]: { coingeckoId: "tether", decimals: 6 }, - // [ADDRESSES.arbitrum_nova.USDC]: { coingeckoId: "usd-coin", decimals: 6 }, - // }, + neon_evm: { + '0xb14760c064a1b9eaf9ec5a8a421971e40a51b59c': { coingeckoId: 'neon', decimals:18}, + }, rpg: { '0x8e8816a1747fddc5f8b45d2e140a425d3788f659': { coingeckoId: "tether", decimals: 18 }, }, diff --git a/projects/moraswap/index.js b/projects/moraswap/index.js new file mode 100644 index 00000000000..b587bd0f292 --- /dev/null +++ b/projects/moraswap/index.js @@ -0,0 +1,24 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +const ethers = require("ethers") +const { config } = require('@defillama/sdk/build/api'); +config.setProvider("neon_evm", new ethers.providers.StaticJsonRpcProvider( + "https://neon-proxy-mainnet.solana.p2p.org", + { + name: "neon_evm", + chainId: 245022934, + } + )) + + +const dexTVL_neon = getUniTVL({ factory: '0xd43F135f6667174f695ecB7DD2B5f953d161e4d1', useDefaultCoreAssets: true }) + + +module.exports = { + misrepresentedTokens: true, + neon_evm: { + tvl: dexTVL_neon, + } +}; + + From 291a39b12904b03432944918b16fa6d42d54368d Mon Sep 17 00:00:00 2001 From: camolezi Date: Mon, 17 Jul 2023 17:20:32 -0300 Subject: [PATCH 0385/1974] feat: add gauge staked lp token for crv pools (#6824) --- projects/good-ghosting/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/good-ghosting/index.js b/projects/good-ghosting/index.js index af6ef60cf27..dddce3197ad 100644 --- a/projects/good-ghosting/index.js +++ b/projects/good-ghosting/index.js @@ -33,7 +33,7 @@ async function tvl(_, _b, _cb, { api, }) { Object.values(gameData) .filter((game) => game.networkId == chainIdMap[api.chain]) .map((game) => { - const tokens = [game.depositTokenAddress, game.liquidityTokenAddress].filter(i => i) + const tokens = [game.depositTokenAddress, game.liquidityTokenAddress, game.gaugeLiquidityTokenAddress].filter(i => i) ownerTokens.push([tokens, game.id]) if (isV2Game(game.contractVersion)) From 5bb3acabd916f3cf52dcb07607deab991361eeeb Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Mon, 17 Jul 2023 23:43:39 +0100 Subject: [PATCH 0386/1974] add polygon --- projects/kromatika/index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/projects/kromatika/index.js b/projects/kromatika/index.js index dce4f8b3c9b..e7d6fbb0d60 100644 --- a/projects/kromatika/index.js +++ b/projects/kromatika/index.js @@ -15,10 +15,10 @@ const contracts = { KROM: "0x55ff62567f09906a85183b866df84bf599a4bf70", position: "0x02c282f60fb2f3299458c2b85eb7e303b25fc6f0", }, - // polygon: { - // KROM: "0x14Af1F2f02DCcB1e43402339099A05a5E363b83c", - // position: "0xD1fDF0144be118C30a53E1d08Cc1E61d600E508e", - // }, + polygon: { + KROM: "0x14Af1F2f02DCcB1e43402339099A05a5E363b83c", + position: "0x03F490aE5b59E428E6692059d0Dca1B87ED42aE1", + }, }; async function opTvl(api, position) { From 7b8167dca2a0e75df9779b1fac9a44ee9a7bd491 Mon Sep 17 00:00:00 2001 From: ngfam Date: Tue, 18 Jul 2023 09:03:19 +0700 Subject: [PATCH 0387/1974] Fix Pendle v2 TVL (Accounting for interest bearing token exchangeRate) --- projects/pendle/v2.js | 96 ++++++++++++++++++++++++++++--------------- 1 file changed, 64 insertions(+), 32 deletions(-) diff --git a/projects/pendle/v2.js b/projects/pendle/v2.js index 20d807ab5be..73ff88c91cd 100644 --- a/projects/pendle/v2.js +++ b/projects/pendle/v2.js @@ -1,46 +1,75 @@ -const ADDRESSES = require('../helper/coreAssets.json') +const ADDRESSES = require("../helper/coreAssets.json"); const contracts = require("./contracts"); -const { staking } = require('../helper/staking') -const { getLogs } = require('../helper/cache/getLogs') +const { staking } = require("../helper/staking"); +const { getLogs } = require("../helper/cache/getLogs"); const steth = ADDRESSES.ethereum.STETH; const config = { - ethereum: { factory: '0x27b1dacd74688af24a64bd3c9c1b143118740784', fromBlock: 16032059 }, - arbitrum: { factory: '0xf5a7de2d276dbda3eef1b62a9e718eff4d29ddc8', fromBlock: 62979673 }, - bsc: { factory: '0x2bEa6BfD8fbFF45aA2a893EB3B6d85D10EFcC70E', fromBlock: 29484286 }, -} + ethereum: { + factory: "0x27b1dacd74688af24a64bd3c9c1b143118740784", + fromBlock: 16032059, + }, + arbitrum: { + factory: "0xf5a7de2d276dbda3eef1b62a9e718eff4d29ddc8", + fromBlock: 62979673, + }, + bsc: { + factory: "0x2bEa6BfD8fbFF45aA2a893EB3B6d85D10EFcC70E", + fromBlock: 29484286, + }, +}; -module.exports = {} +module.exports = {}; -Object.keys(config).forEach(chain => { - const { factory, fromBlock } = config[chain] +Object.keys(config).forEach((chain) => { + const { factory, fromBlock } = config[chain]; module.exports[chain] = { - tvl: async (_, _b, _cb, { api, }) => { + tvl: async (_, _b, _cb, { api }) => { const logs = await getLogs({ api, target: factory, - topics: ['0x166ae5f55615b65bbd9a2496e98d4e4d78ca15bd6127c0fe2dc27b76f6c03143'], - eventAbi: 'event CreateNewMarket (address indexed market, address indexed PT, int256 scalarRoot, int256 initialAnchor)', + topics: [ + "0x166ae5f55615b65bbd9a2496e98d4e4d78ca15bd6127c0fe2dc27b76f6c03143", + ], + eventAbi: + "event CreateNewMarket (address indexed market, address indexed PT, int256 scalarRoot, int256 initialAnchor)", onlyArgs: true, fromBlock, - }) - const pt = logs.map(i => i.PT) - const sy = [ + }); + const pt = logs.map((i) => i.PT); + let sy = [ ...new Set( - (await api.multiCall({ - abi: "address:SY", - calls: pt, - })).map(s => s.toLowerCase()), + ( + await api.multiCall({ + abi: "address:SY", + calls: pt, + }) + ).map((s) => s.toLowerCase()) ), - ] + ]; + const [data, supply, decimals] = await Promise.all([ - api.multiCall({ abi: 'function assetInfo() view returns (uint8 assetType , address uAsset , uint8 decimals )', calls: sy }), - api.multiCall({ abi: 'erc20:totalSupply', calls: sy }), - api.multiCall({ abi: 'erc20:decimals', calls: sy }), - ]) + api.multiCall({ + abi: "function assetInfo() view returns (uint8 assetType , address uAsset , uint8 decimals )", + calls: sy, + }), + api.multiCall({ abi: "erc20:totalSupply", calls: sy }), + api.multiCall({ abi: "erc20:decimals", calls: sy }), + ]); + + const tokenAssetTypeSy = sy.filter((_, i) => data[i].assetType === "0"); + const exchangeRates = await api.multiCall({ + abi: "function exchangeRate() view returns (uint256 res)", + calls: tokenAssetTypeSy, + }); + data.forEach((v, i) => { - let value = supply[i] * (10 ** (v.decimals - decimals[i])) - api.add(v.uAsset.toLowerCase(), value) - }) + let value = supply[i] * 10 ** (v.decimals - decimals[i]); + let index = tokenAssetTypeSy.indexOf(sy[i]); + if (index !== -1) { + value = (value * exchangeRates[index]) / 10 ** 18; + } + api.add(v.uAsset.toLowerCase(), value); + }); let balances = api.getBalances(); const bridged = `arbitrum:${steth}`; if (bridged in balances) { @@ -48,8 +77,11 @@ Object.keys(config).forEach(chain => { delete balances[bridged]; } return balances; - } - } -}) + }, + }; +}); -module.exports.ethereum.staking = staking(contracts.v2.vePENDLE, contracts.v2.PENDLE) \ No newline at end of file +module.exports.ethereum.staking = staking( + contracts.v2.vePENDLE, + contracts.v2.PENDLE +); From f15465ab27f3cd73e1242e9f9dc32fcfa62a17e2 Mon Sep 17 00:00:00 2001 From: DCota <32775237+DaigaroCota@users.noreply.github.com> Date: Mon, 17 Jul 2023 21:46:16 -0700 Subject: [PATCH 0388/1974] Fujidaov2/refactor/add multiple factories per chain (#6813) * feat(fujidaov2): add newly deployed factories public launch * refactor(fujidaov2): tvl and borrow logic to consider array of factories * feat(fujidaov2): add ethereum factories but commented * fix(fujidao-v2): uncomment ethereum factories * minor fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/fujidao-v2/index.js | 78 +++++++++++++++++++++++++----------- 1 file changed, 54 insertions(+), 24 deletions(-) diff --git a/projects/fujidao-v2/index.js b/projects/fujidao-v2/index.js index bd6070edc0f..b91df7b9210 100644 --- a/projects/fujidao-v2/index.js +++ b/projects/fujidao-v2/index.js @@ -1,10 +1,25 @@ const { getLogs } = require('../helper/cache/getLogs') const config = { - xdai: { borrowFactory: '0xBeaa4b2cE11cc2F8a059341DaD422814B66d1aD0', borrowStartBlock: 28448319, }, - arbitrum: { borrowFactory: '0x2855666fbc5f526269b1f5dc73dfc8e11acb67f1', borrowStartBlock: 101069692, }, - optimism: { borrowFactory: '0xC377e6e13426739f14E411dD88Af8056e2DcabA4', borrowStartBlock: 105577184, }, - polygon: { borrowFactory: '0x157A03942e4F88c0357e4Afc1da46E9Cc12DB1D5', borrowStartBlock: 43896122, }, + ethereum: [ + { borrowFactory: '0x24E72207a078558BF9018dcF97D7f580E79B9221', borrowStartBlock: 17690796 }, + ], + xdai: [ + { borrowFactory: '0xBeaa4b2cE11cc2F8a059341DaD422814B66d1aD0', borrowStartBlock: 28448319 }, + { borrowFactory: '0xeAcb50131a46a7b8C750c03ba336f2632fDb0344', borrowStartBlock: 28911067 }, + ], + arbitrum: [ + { borrowFactory: '0x2855666fbc5f526269b1f5dc73dfc8e11acb67f1', borrowStartBlock: 101069692 }, + { borrowFactory: '0x2bb069a248Ba1c62062143462AE7bDB5C4360E3d', borrowStartBlock: 110400709 }, + ], + optimism: [ + { borrowFactory: '0xC377e6e13426739f14E411dD88Af8056e2DcabA4', borrowStartBlock: 105577184 }, + { borrowFactory: '0x1cbf7f06c04226488B4D5b2d5EA5C8B965130500', borrowStartBlock: 106780843 }, + ], + polygon: [ + { borrowFactory: '0x157A03942e4F88c0357e4Afc1da46E9Cc12DB1D5', borrowStartBlock: 43896122 }, + { borrowFactory: '0x6Ed2428624da78cfE2daeC70BE171D1752cDEfF8', borrowStartBlock: 44986739 }, + ], } module.exports = { @@ -12,18 +27,25 @@ module.exports = { }; Object.keys(config).forEach(chain => { - const { borrowFactory, borrowStartBlock } = config[chain] + const factories = config[chain] module.exports[chain] = { tvl: async (_, _b, _cb, { api, }) => { - const logs = await getLogs({ - api, - target: borrowFactory, - topics: ['0x89d38637357ca536d5c3f7cfcf4738f465b8b6bf51af92d02cb9fa8eb093f368'], - eventAbi: 'event DeployBorrowingVault (address indexed vault, address indexed asset, address indexed debtAsset, string name, string symbol, bytes32 salt)', - onlyArgs: true, - fromBlock: borrowStartBlock, - extraKey: 'borrow-vault' - }) + let logs = []; + for (let i = 0; i < factories.length; i++) { + const { borrowFactory, borrowStartBlock } = factories[i]; + const interlogs = await getLogs({ + api, + target: borrowFactory, + topics: ['0x89d38637357ca536d5c3f7cfcf4738f465b8b6bf51af92d02cb9fa8eb093f368'], + eventAbi: 'event DeployBorrowingVault (address indexed vault, address indexed asset, address indexed debtAsset, string name, string symbol, bytes32 salt)', + onlyArgs: true, + fromBlock: borrowStartBlock, + extraKey: 'borrow-vault' + }) + interlogs.forEach(log => { + logs.push(log); + }) + } const vaults = logs.map(log => log.vault) const assets = logs.map(log => log.asset) const debtAssets = logs.map(log => log.debtAsset) @@ -37,19 +59,26 @@ Object.keys(config).forEach(chain => { api.add(assets[i], bal) api.add(debtAssets[i], debtBals[i] * -1) }) + return api.getBalances() }, borrowed: async (_, _b, _cb, { api, }) => { - const logs = await getLogs({ - api, - target: borrowFactory, - topics: ['0x89d38637357ca536d5c3f7cfcf4738f465b8b6bf51af92d02cb9fa8eb093f368'], - eventAbi: 'event DeployBorrowingVault (address indexed vault, address indexed asset, address indexed debtAsset, string name, string symbol, bytes32 salt)', - onlyArgs: true, - fromBlock: borrowStartBlock, - extraKey: 'borrow-vault' - }) + let logs = []; + for (let i = 0; i < factories.length; i++) { + const { borrowFactory, borrowStartBlock } = factories[i]; + const interlogs = await getLogs({ + api, + target: borrowFactory, + topics: ['0x89d38637357ca536d5c3f7cfcf4738f465b8b6bf51af92d02cb9fa8eb093f368'], + eventAbi: 'event DeployBorrowingVault (address indexed vault, address indexed asset, address indexed debtAsset, string name, string symbol, bytes32 salt)', + onlyArgs: true, + fromBlock: borrowStartBlock, + extraKey: 'borrow-vault' + }) + interlogs.forEach(log => { + logs.push(log); + }) + } const vaults = logs.map(log => log.vault) - const assets = logs.map(log => log.asset) const debtAssets = logs.map(log => log.debtAsset) const bals = await api.multiCall({ abi: 'uint256:totalAssets', calls: vaults }) const debtBals = (await api.multiCall({ abi: 'uint256:totalDebt', calls: vaults, permitFailure: true, })) @@ -60,6 +89,7 @@ Object.keys(config).forEach(chain => { } api.add(debtAssets[i], debtBals[i]) }) + return api.getBalances() } } }) \ No newline at end of file From 06ee19e104db7bc0d56ccf387fb9e7a6eb633423 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B4=94=E6=A3=89=E5=A4=A7=E5=B8=88?= <1046166@qq.com> Date: Tue, 18 Jul 2023 12:48:27 +0800 Subject: [PATCH 0389/1974] add Meter Liquid Staking (#6826) * create stMTRG * rename --- projects/meter-Liquid-Staking/index.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 projects/meter-Liquid-Staking/index.js diff --git a/projects/meter-Liquid-Staking/index.js b/projects/meter-Liquid-Staking/index.js new file mode 100644 index 00000000000..390a59cb03e --- /dev/null +++ b/projects/meter-Liquid-Staking/index.js @@ -0,0 +1,21 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const sdk = require("@defillama/sdk"); +const { BigNumber,utils } = require('ethers'); + +const stMTRG = '0x215d603293357ca222bE92A1bf75eEc38DeF0aad'; +async function tvl(timestamp, _, { meter: block }) { + const stMTRGStaking = await sdk.api.abi.call({ + target: stMTRG, + abi: 'erc20:totalSupply', + chain: "meter", block, + }); + return { + meter: stMTRGStaking.output / 1e18 + }; +} + +module.exports = { + meter: { + tvl, + } +} \ No newline at end of file From 81fd9586f62a340fb7a06c2a83430883e9f51c1c Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 18 Jul 2023 07:58:00 +0200 Subject: [PATCH 0390/1974] fix tron issue by rate limiting queries --- projects/helper/unwrapLPs.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/projects/helper/unwrapLPs.js b/projects/helper/unwrapLPs.js index 6f1a101181d..e16d54476b4 100644 --- a/projects/helper/unwrapLPs.js +++ b/projects/helper/unwrapLPs.js @@ -12,6 +12,7 @@ const { isLP, log, } = require('./utils') const { sumArtBlocks, whitelistedNFTs, } = require('./nft') const wildCreditABI = require('../wildcredit/abi.json'); const { covalentGetTokens, get } = require("./http"); +const { sliceIntoChunks } = require('@defillama/sdk/build/util'); const lpReservesAbi = 'function getReserves() view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast)' const lpSuppliesAbi = "uint256:totalSupply" @@ -720,7 +721,14 @@ async function sumTokens2({ tokensAndOwners = getUniqueToA(tokensAndOwners) log(chain, 'summing tokens', tokensAndOwners.length) - await sumTokens(balances, tokensAndOwners, block, chain, transformAddress, { resolveLP, unwrapAll, blacklistedLPs, skipFixBalances: true, abis, permitFailure, }) + if (chain === 'tron') { + const tokensAndOwnersChunks = sliceIntoChunks(tokensAndOwners, 3) + for (const toa of tokensAndOwnersChunks) { + await sumTokens(balances, toa, block, chain, transformAddress, { resolveLP, unwrapAll, blacklistedLPs, skipFixBalances: true, abis, permitFailure, }) + } + } else { + await sumTokens(balances, tokensAndOwners, block, chain, transformAddress, { resolveLP, unwrapAll, blacklistedLPs, skipFixBalances: true, abis, permitFailure, }) + } if (!skipFixBalances) { const fixBalances = await getFixBalances(chain) From c349c5d5202554b6ccce9b9d37761323c4fd496e Mon Sep 17 00:00:00 2001 From: Philipp Date: Tue, 18 Jul 2023 08:22:59 +0200 Subject: [PATCH 0391/1974] Eris: Add Neutron TVL (#6831) * add osmosis, injective to eris * add neutron --- projects/eris-protocol/index.js | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/projects/eris-protocol/index.js b/projects/eris-protocol/index.js index ed1c3eec284..c4e1cf057eb 100644 --- a/projects/eris-protocol/index.js +++ b/projects/eris-protocol/index.js @@ -85,9 +85,31 @@ const config = { ampToken: "factory/inj1cdwt8g7nxgtg2k4fn8sj363mh9ahkw2qt0vrnc/ampINJ", decimals: 18, }, + neutron: { + farms: [ + "neutron1h4ehzx3j92jv4tkgjy3k2qphh5863l68cyep7vaf83fj6k89l4lqjfyh77", + "neutron1sfmpf84xacu2la88zzsgende2jjlczswdmhzn7jh6tuhn43jl86q6d0vhj", + "neutron1smam4j5cypw2vp7un3q8w68sg97zq9s2c95ukwsmpsl2jh4xwzdskxm6az", + "neutron188xz8cg4uqk4ssg9tcf3q2764ar8ev0jr8qpx2qspchul98ykzuqx58r50", + ], + coinGeckoMap: { + "ibc/F082B65C88E4B6D5EF1DB243CDA1D331D002759E938A0F5CD3FFDC5D53B3E349": + "usd-coin", + "ibc/57503D7852EF4E1899FE6D71C5E81D7C839F76580F86F21E39348FC2BC9D7CE2": + "tether", + "ibc/5751B8BCDA688FD0A8EC0B292EEF1CDEAB4B766B63EC632778B196D317C40C3A": + "astroport-fi", + untrn: "neutron-3", + "ibc/C4CFF46FD6DE35CA4CF4CE031E643C8FDC9BA4B99AE598E9B0ED98FE3A2319F9": + "cosmos", + }, + }, }; async function getState(chain, contract) { + if (!contract) { + return {}; + } return queryContractCosmos({ contract, chain, @@ -170,9 +192,9 @@ async function tvlAmpGovernance(chain, state) { } } -async function farm2Tvl(farm) { +async function farm2Tvl(chain, farm) { const res = await queryContractCosmos({ - chain: "terra2", + chain: chain, contract: farm, data: { state: {} }, }); @@ -191,8 +213,8 @@ async function farm2Tvl(farm) { amount: +res.locked_assets[1].amount, }; - token1.coinGeckoId = getCoinGeckoId("terra2", token1.denom); - token2.coinGeckoId = getCoinGeckoId("terra2", token2.denom); + token1.coinGeckoId = getCoinGeckoId(chain, token1.denom); + token2.coinGeckoId = getCoinGeckoId(chain, token2.denom); let results = []; if (token1.coinGeckoId) { @@ -244,7 +266,7 @@ async function productsTvl(chain) { tvlHub(chain, state), tvlAmpGovernance(chain, state), tvlArbVault(chain).catch((a) => ({})), - ...(chainConfig.farms ?? []).map(farm2Tvl), + ...(chainConfig.farms ?? []).map((farm) => farm2Tvl(chain, farm)), ]); } catch (error) { let url = error?.response?.config?.url; @@ -266,4 +288,5 @@ module.exports = { migaloo: { tvl: () => productsTvl("migaloo") }, injective: { tvl: () => productsTvl("injective") }, osmosis: { tvl: () => productsTvl("osmosis") }, + neutron: { tvl: () => productsTvl("neutron") }, }; From 793e792837f6424bf8ae446ae60cd4bc523643f9 Mon Sep 17 00:00:00 2001 From: ZeroLend <139714235+zerolend@users.noreply.github.com> Date: Tue, 18 Jul 2023 11:54:40 +0530 Subject: [PATCH 0392/1974] Added zerolend into defilamma (#6830) Co-authored-by: ZeroLend --- projects/zerolend/index.js | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 projects/zerolend/index.js diff --git a/projects/zerolend/index.js b/projects/zerolend/index.js new file mode 100644 index 00000000000..76516fa3472 --- /dev/null +++ b/projects/zerolend/index.js @@ -0,0 +1,7 @@ +const { aaveExports } = require("../helper/aave"); + +module.exports = { + era: aaveExports("era", undefined, undefined, [ + "0xB73550bC1393207960A385fC8b34790e5133175E", + ]), +}; From e96e04e3544c1558a424023465f89aa5e335d00a Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 18 Jul 2023 11:48:15 +0200 Subject: [PATCH 0393/1974] fix elrond --- projects/helper/chain/elrond.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/helper/chain/elrond.js b/projects/helper/chain/elrond.js index f31dc0772f9..bafae368705 100644 --- a/projects/helper/chain/elrond.js +++ b/projects/helper/chain/elrond.js @@ -52,7 +52,7 @@ async function getTokens({ address, balances = {}, tokens = [], blacklistedToken if (prices[token]) return sdk.util.sumSingleBalance(balances, nullAddress, (prices[token] * i.balance).toFixed(0), chain) } - return sdk.util.sumSingleBalance(balances, token, i.balance / (10 ** i.decimals), chain) + return sdk.util.sumSingleBalance(balances, token, i.balance, chain) }) return balances } From e0e683cfac791424a8c9da53628132e471b4065e Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 18 Jul 2023 13:29:28 +0200 Subject: [PATCH 0394/1974] track onedex --- projects/coindrip/index.js | 4 ++- projects/helper/chain/elrond.js | 43 +++++---------------------------- projects/helper/coreAssets.json | 23 +----------------- projects/onedex/index.js | 8 ++++++ projects/proteo-farms/index.js | 43 ++------------------------------- 5 files changed, 20 insertions(+), 101 deletions(-) create mode 100644 projects/onedex/index.js diff --git a/projects/coindrip/index.js b/projects/coindrip/index.js index dd48f8021c6..1d717f2d35e 100644 --- a/projects/coindrip/index.js +++ b/projects/coindrip/index.js @@ -1,6 +1,7 @@ const { toUSDTBalances } = require("../helper/balances"); const { get } = require("../helper/http"); const { sumTokensExport } = require('../helper/sumTokens') +const { getCoreAssets } = require('../helper/tokenMapping') const API_URL = "https://app.coindrip.finance/api/tvl"; @@ -12,6 +13,7 @@ async function tvl() { module.exports = { timetravel: false, elrond: { - tvl: sumTokensExport({ owner: 'erd1qqqqqqqqqqqqqpgqqnm3x37972323nuv3l3kywev0n8q5n6gyc8qwljqz9', }) + tvl: sumTokensExport({ owner: 'erd1qqqqqqqqqqqqqpgqqnm3x37972323nuv3l3kywev0n8q5n6gyc8qwljqz9', whitelistedTokens: getCoreAssets('elrond')}), + vesting: sumTokensExport({ owner: 'erd1qqqqqqqqqqqqqpgqqnm3x37972323nuv3l3kywev0n8q5n6gyc8qwljqz9', blacklistedTokens: getCoreAssets('elrond')}), }, }; \ No newline at end of file diff --git a/projects/helper/chain/elrond.js b/projects/helper/chain/elrond.js index bafae368705..20f63d880a3 100644 --- a/projects/helper/chain/elrond.js +++ b/projects/helper/chain/elrond.js @@ -1,34 +1,11 @@ const ADDRESSES = require('../coreAssets.json') -const { get, graphQuery } = require('../http') +const { get } = require('../http') const { getCoreAssets, } = require('../tokenMapping') const { transformBalances } = require('../portedTokens') const sdk = require('@defillama/sdk') const chain = 'elrond' const API_HOST = 'https://api.multiversx.com' -const MAIAR_GRAPH = 'http://graph.xexchange.com/graphql' -const unknownTokenList = ["CYBER-489c1c", "CPA-97530a"] -let prices - -async function getTokenPrices() { - if (!prices) prices = _getPrices() - return prices - - async function _getPrices() { - const query = `{ - tokens (identifiers: ${JSON.stringify(unknownTokenList)}){ - price - decimals - derivedEGLD - identifier - } - }` - const { tokens } = await graphQuery(MAIAR_GRAPH, query) - const res = {} - tokens.forEach(i => res[i.identifier] = i.derivedEGLD * 1e18/(10 ** i.decimals)) - return res - } -} async function getElrondBalance(address) { const { data: { account: { balance } } } = await get(`${API_HOST}/address/${address}`) @@ -36,34 +13,26 @@ async function getElrondBalance(address) { } const nullAddress = ADDRESSES.null -async function getTokens({ address, balances = {}, tokens = [], blacklistedTokens = [] }) { - const prices = await getTokenPrices() - const coreAssets = new Set(getCoreAssets('elrond')) +async function getTokens({ address, balances = {}, tokens = [], blacklistedTokens = [], whitelistedTokens = [], }) { const res = await get(`${API_HOST}/accounts/${address}/tokens?size=1000`) res.filter(i => i.type === 'FungibleESDT') .forEach(i => { const token = i.identifier if (tokens.length && !tokens.includes(token)) return; // sum only whitelistedTokens + if (whitelistedTokens.length && !whitelistedTokens.includes(token)) return; // sum only whitelistedTokens if (blacklistedTokens.includes(token)) return; // skip blacklisted tokens - if (!coreAssets.has(token)) { - if (i.valueUsd) - return sdk.util.sumSingleBalance(balances, 'ethereum:' + ADDRESSES.ethereum.USDT, i.valueUsd * 1e6) - - if (prices[token]) - return sdk.util.sumSingleBalance(balances, nullAddress, (prices[token] * i.balance).toFixed(0), chain) - } return sdk.util.sumSingleBalance(balances, token, i.balance, chain) }) return balances } -async function sumTokens({ owners = [], tokens = [], balances = {}, blacklistedTokens = [], tokensAndOwners = []}) { +async function sumTokens({ owners = [], tokens = [], balances = {}, blacklistedTokens = [], tokensAndOwners = [], whitelistedTokens = []}) { if (tokensAndOwners.length) { - await Promise.all(tokensAndOwners.map(([token, owner]) => sumTokens({ owners: [owner], tokens: [token], balances, blacklistedTokens, }))) + await Promise.all(tokensAndOwners.map(([token, owner]) => sumTokens({ owners: [owner], tokens: [token], balances, blacklistedTokens, whitelistedTokens, }))) return balances } - await Promise.all(owners.map(i => getTokens({ address: i, balances, tokens, blacklistedTokens, }))) + await Promise.all(owners.map(i => getTokens({ address: i, balances, tokens, blacklistedTokens, whitelistedTokens, }))) if (!tokens.length || tokens.includes(nullAddress)) await Promise.all(owners.map(async i => { const bal = await getElrondBalance(i) diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index 07e338b099b..4becd95c5eb 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -1215,28 +1215,7 @@ "USDT": "USDT" }, "elrond": { - "SUPER": "SUPER-507aa6", - "WEGLD": "WEGLD-bd4d79", - "LAND": "LAND-40f26f", - "CHECKR": "CHECKR-60108b", - "ITHEUM": "ITHEUM-df6f26", - "ISET": "ISET-84e55e", - "MEX": "MEX-455c57", - "ASH": "ASH-a642d1", - "RIDE": "RIDE-7d18e9", - "QWT": "QWT-46ac01", - "AERO": "AERO-458bbf", - "VITAL": "erd1qqqqqqqqqqqqqpgq3ahw8fctzfnwgvq2g4hjsqzkkvgl9ksr2jps646dnj", - "TLC": "TLC-1a2357", - "BHAT": "BHAT-c1fde3", - "CRT": "CRT-52decf", - "BSK": "BSK-baa025", - "UTK": "UTK-2f80e9", - "ZPAY": "ZPAY-247875", - "KRO": "KRO-df97ec", - "EGLD": "0x0000000000000000000000000000000000000000", - "KOSON": "KOSON-5dd4fa", - "CTP": "CTP-298075" + "WEGLD": "WEGLD-bd4d79" }, "bitindi": { "WBNI": "0x15E162205421dc3A47b15A1A740FbF5EAbB77921" diff --git a/projects/onedex/index.js b/projects/onedex/index.js new file mode 100644 index 00000000000..73fd88f9b62 --- /dev/null +++ b/projects/onedex/index.js @@ -0,0 +1,8 @@ +const { sumTokensExport } = require('../helper/sumTokens') + +module.exports = { + timetravel: false, + elrond: { + tvl: sumTokensExport({ owner: 'erd1qqqqqqqqqqqqqpgqqz6vp9y50ep867vnr296mqf3dduh6guvmvlsu3sujc', }), + }, +}; \ No newline at end of file diff --git a/projects/proteo-farms/index.js b/projects/proteo-farms/index.js index 76cc93009b1..b1d0f258286 100644 --- a/projects/proteo-farms/index.js +++ b/projects/proteo-farms/index.js @@ -1,32 +1,5 @@ const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens } = require('../helper/chain/elrond') -const { get } = require('../helper/http') -const sdk = require('@defillama/sdk') - -let prices - -async function getPrices() { - if (!prices) prices = _getPrices() - return prices - - async function _getPrices() { - const getApi = ({ token1, token2 }) => `https://api.multiversx.com/mex/pairs/${token1}/${token2}?fields=price` - const lps = [ - // { lp: 'PROTEOEGLD-baf054', token1: 'PROTEO-0c7311', token2: ADDRESSES.elrond.WEGLD, }, - { lp: 'ZPAYWEGLD-34e5c1', token1: ADDRESSES.elrond.ZPAY, token2: ADDRESSES.elrond.WEGLD, }, - { lp: 'AEROWEGLD-81cc37', token1: ADDRESSES.elrond.AERO, token2: ADDRESSES.elrond.WEGLD, }, - { lp: 'KROUSDC-7787ab', token1: 'USDC-c76f1f', token2: ADDRESSES.elrond.KRO, }, - ] - - const prices = {} - await Promise.all(lps.map(async i => { - const { price } = await get(getApi(i)) - prices['elrond:' + i.lp] = i.token1.startsWith('USDC') ? 1 / price : price - })) - - return prices - } -} async function tvl() { const tokensAndOwners = [ @@ -41,18 +14,7 @@ async function tvl() { ['AEROWEGLD-81cc37', 'erd1qqqqqqqqqqqqqpgqapmdgehzl22pu6m5pkvy2fhzm49uxkxhznyqhwhcx5'], ['AEROWEGLD-81cc37', 'erd1qqqqqqqqqqqqqpgqnedra5da464rkcektgzyv0qxcgqgyh26znyq8q4phx'], ] - return computeTvl(tokensAndOwners) -} - -async function computeTvl(tokensAndOwners) { - const balances = await sumTokens({ chain: 'elrond', tokensAndOwners, }) - const prices = await getPrices() - Object.entries(prices).forEach(([token, price]) => { - if (!balances[token]) return; - sdk.util.sumSingleBalance(balances, 'tether', balances[token] * price) - delete balances[token] - }) - return balances + return sumTokens({tokensAndOwners}) } async function pool2() { @@ -61,11 +23,10 @@ async function pool2() { ['PROTEOEGLD-baf054', 'erd1qqqqqqqqqqqqqpgq6hzck3wac3ljmth7dkzk2wcw3c9lvcauznyq268sn6'], ] - return computeTvl(tokensAndOwners) + return sumTokens({tokensAndOwners}) } module.exports = { - misrepresentedTokens: true, timetravel: false, elrond: { tvl, From fa2eb3c0f1d3145d2dc08cf69af6c4c32558ff57 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 18 Jul 2023 14:01:07 +0200 Subject: [PATCH 0395/1974] refactor quantumx --- projects/quantumx-network/api.js | 9 +- projects/quantumx-network/index.js | 262 +---------------------------- 2 files changed, 6 insertions(+), 265 deletions(-) diff --git a/projects/quantumx-network/api.js b/projects/quantumx-network/api.js index 64732503253..95326af5291 100644 --- a/projects/quantumx-network/api.js +++ b/projects/quantumx-network/api.js @@ -1,8 +1 @@ -const { getExports } = require('../helper/heroku-api') - -module.exports = { - methodology: "It counts the TVL from the Staking Farms/Pools of QuantumX.", - timetravel: false, - misrepresentedTokens: true, - ...getExports("quantumx-network", ['elrond']), -} +module.exports = require('./index') \ No newline at end of file diff --git a/projects/quantumx-network/index.js b/projects/quantumx-network/index.js index 38b4a8698aa..5a7ca2265da 100644 --- a/projects/quantumx-network/index.js +++ b/projects/quantumx-network/index.js @@ -1,260 +1,8 @@ -const { toUSDTBalances } = require("../helper/balances"); -var abiFile = require("./farms.abi.json"); -var { - AbiRegistry, - ContractFunction, - ResultsParser, - SmartContract, - // SmartContractAbi, - Address, -} = require("@multiversx/sdk-core/out"); -var { - ProxyNetworkProvider, -} = require("@multiversx/sdk-network-providers"); -var axios = require("axios"); -var BigNumber = require("bignumber.js"); -const sdk = require('@defillama/sdk') - -//provider -const provider = new ProxyNetworkProvider("https://api.multiversx.com", { - timeout: 30000, -}); - -// api -const BASE_URL = "https://api.multiversx.com"; -const api = axios.create({ - baseURL: BASE_URL, -}); - -// fetch multiversx economics for egld info -const getEconomics = async () => { - return await api.get("/economics"); -}; -// fetch tokens info -const getFromAllTokens = async ({ - size = 10000, - name = undefined, - identifier = undefined, - identifiers = undefined, - search = undefined, -}) => { - return await api.get("/tokens", { - params: { - identifier, - identifiers, - name, - size, - search, - }, - }); -}; -// api to fetch lp prices -const fetchLpPrices = async () => { - const { data } = await axios.get("https://eldar.solutions/api/lpapi.php"); - return data; -}; -const getMexPairs = async () => { - return await api.get("/mex/pairs?size=150"); -}; - -/* ---------------- UTILS ------------------------ */ -const getRealBalance = (balance1, decimal) => { - const divider = Math.pow(10, decimal ?? 18); - const balance = new BigNumber(balance1); - const real = balance.dividedBy(divider, 10); - return real.toNumber(); -}; -const formatBalanceDolar = (token, price = 0) => { - if (token && token.balance) { - const strBalance = token.balance; - - const intBalance = Number(strBalance); - const intBalanceDolar = intBalance * Number(price); - const realDollarAmount = getRealBalance(intBalanceDolar, token.decimals); - return realDollarAmount; - } - return 0; -}; - -// fetch info from sc -const scQuery = async (funcName, args) => { - try { - const abiRegistry = await AbiRegistry.create(abiFile); - // const abi = new SmartContractAbi(abiRegistry, ["Farms"]); - const contract = new SmartContract({ - address: new Address( - "erd1qqqqqqqqqqqqqpgql6dxenaameqn2uyyru3nmmpf7e95zmlxu7zskzpdcw" - ), - abi: abiRegistry, - }); - - const query = contract.createQuery({ - func: new ContractFunction(funcName), - args: args, - }); - const queryResponse = await provider.queryContract(query); - const endpointDefinition = contract.getEndpoint(funcName); - const parser = new ResultsParser(); - const data = parser.parseQueryResponse(queryResponse, endpointDefinition); - - return data; - } catch (error) { - console.log(`query error for ${funcName} : `, error); - } -}; - -// get Tvl -const tvl = async () => { - // tvl - let tvlDollar = 0; - - try { - sdk.log("getting all farms"); - const scFarmsRes = await scQuery("getAllFarms", []); - const allFarmsFirstValue = scFarmsRes?.firstValue?.valueOf(); - if (allFarmsFirstValue) { - // get all farms from sc - const allFarms = allFarmsFirstValue.map((farm) => { - // sdk.log(farm); - return { - farm: { - farmId: farm.field0.id.toNumber(), - creationEpoch: farm.field0.creation_epoch.toNumber(), - stakingToken: farm.field0.staked_token, - rewardToken: farm.field0.reward_token, - creator: farm.field0.creator.bech32(), - }, - stakedBalance: farm.field2.toNumber(), - totalRewardsLeft: farm.field3.toNumber(), - }; - }); - - // array of tokens identifiers - const tokensIdentifiers = allFarms.map((f) => f.farm.stakingToken); - // all tokens info - let tokensInfo = []; - - // get the info of tokens in array from multiversx api - sdk.log("\n\ngetting all tokens info"); - const { data: tokensData } = await getFromAllTokens({ - identifiers: tokensIdentifiers.join(","), - }); - // add info of the returned tokens to the array of info - tokensInfo = [...tokensData]; - // sdk.log(tokensInfo); - - // if egld is include in tokens indentifeirs, we need to get the data of egld for price - const isEgldonTokens = tokensIdentifiers.includes("EGLD"); - if (isEgldonTokens) { - // fetch egld data - sdk.log("getting egld data"); - - const { data: egldData } = await getEconomics(); - sdk.log("egldData", egldData); - - tokensInfo.unshift({ - type: "FungibleESDT", - identifier: "EGLD", - name: "EGLD", - ticker: "EGLD", - decimals: 18, - price: egldData.data.price, - marketCap: egldData.data.marketCap, - supply: egldData.data.totalSupply, - circulatingSupply: egldData.data.circulatingSupply, - }); - } - - sdk.log("\n\ngetting lp prices"); - const lptokensInfo = await fetchLpPrices(); - // sdk.log(lptokensInfo); - - sdk.log("\n\ngetting mex pairs"); - const { data: mexPairs } = await getMexPairs(); - - const pools = mexPairs - ? allFarms.filter( - (farm) => - mexPairs.findIndex( - (mexPair) => mexPair.id === farm.farm.stakingToken - ) === -1 - ) - : []; - const farms = mexPairs - ? allFarms.filter( - (farm) => - mexPairs.findIndex( - (mexPair) => mexPair.id === farm.farm.stakingToken - ) !== -1 || farm.farm.stakingToken == "RAREWEGLD-b29251" || farm.farm.stakingToken == "HYPELEGLD-d65493" - ) - : []; - - // sdk.log(pools); - // sdk.log(farms.length); - - // get tvl in dollar for farms - for (let i = 0; i < farms.length; i++) { - // info from sc about the farm - const farm = farms[i]; - - const stakingToken = tokensInfo.find( - (token) => token.identifier === farm.farm.stakingToken - ); - const lpPrice = - lptokensInfo.find( - (lpToken) => lpToken.token === farm.farm.stakingToken - )?.tokenvalue || 0; - - tvlDollar += formatBalanceDolar( - { - balance: farm.stakedBalance, - decimals: stakingToken.decimals, - }, - Number(lpPrice) - ); - // sdk.log(stakingToken?.identifier); - // sdk.log(farm.stakedBalance); - // sdk.log(tvlDollar); - } - - // // get tvl in dollar for pools - for (let i = 0; i < pools.length; i++) { - const farm = pools[i]; - - const stakingToken = tokensInfo.find( - (token) => token.identifier === farm.farm.stakingToken - ); - - if (stakingToken?.identifier != "BONEZ-ff9a73" - && stakingToken?.identifier != "RAREWEGLD-b29251" - && stakingToken?.identifier != "HYPELEGLD-d65493" - && farm.farm.farmId != 36 - && farm.farm.farmId != 41) { - tvlDollar += formatBalanceDolar( - { - balance: farm.stakedBalance, - decimals: stakingToken.decimals, - }, - stakingToken?.price - ); - // sdk.log(stakingToken?.identifier); - // sdk.log(tvlDollar); - // sdk.log(farm); - } - } - - sdk.log("\n\nTotal calculated: ", tvlDollar); - return toUSDTBalances(tvlDollar); - } - } catch (err) { - sdk.log("Exeption error : ", err); - } - return tvlDollar; -}; +const { sumTokensExport } = require('../helper/sumTokens') module.exports = { - methodology: "It counts the TVL from the Staking Farms/Pools of QuantumX.", + timetravel: false, elrond: { - tvl, - }, -}; + tvl: sumTokensExport({ chain: 'elrond', owner: 'erd1qqqqqqqqqqqqqpgql6dxenaameqn2uyyru3nmmpf7e95zmlxu7zskzpdcw', }) + } +} \ No newline at end of file From 5b6faf7ebcb64d0454e5ebc7bf808fe9a627dc99 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 18 Jul 2023 14:38:29 +0200 Subject: [PATCH 0396/1974] fix broken adapters --- projects/hydradex.js | 27 +++++++++++++++++++++++++++ projects/hydradex/api.js | 2 ++ projects/tegro/index.js | 3 ++- 3 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 projects/hydradex.js diff --git a/projects/hydradex.js b/projects/hydradex.js new file mode 100644 index 00000000000..4e1a2893259 --- /dev/null +++ b/projects/hydradex.js @@ -0,0 +1,27 @@ +const { blockQuery } = require('./helper/http') +const { getBlock } = require('./hydradex/getHydraV3SubgraphTvl') + +async function tvl(timestamp) { + const endpoint = 'https://info.hydradex.org/graphql' + const block = await getBlock(endpoint, timestamp) + const query = `query ($block: Float!){ + hydraswapFactories (block: { number: $block }) { + totalLiquidityUSD + } + }` + const { hydraswapFactories: [{ totalLiquidityUSD }] } = await blockQuery(endpoint, query, { + api: { + getBlock: () => block, + block + } + }) + return { tether: totalLiquidityUSD } +} + +module.exports = { + misrepresentedTokens: true, + methodology: "We count liquidity on the dex, pulling data from subgraph", + hydra: { + tvl, + }, +}; \ No newline at end of file diff --git a/projects/hydradex/api.js b/projects/hydradex/api.js index 9b31da47f1c..9a1b91f36f6 100644 --- a/projects/hydradex/api.js +++ b/projects/hydradex/api.js @@ -1,3 +1,5 @@ + +const hydraExport = require('../hydradex.js') const { getExports } = require('../helper/heroku-api') module.exports = { diff --git a/projects/tegro/index.js b/projects/tegro/index.js index 7652b284f21..e66a25a663c 100644 --- a/projects/tegro/index.js +++ b/projects/tegro/index.js @@ -1,5 +1,6 @@ const ADDRESSES = require('../helper/coreAssets.json') const { get } = require('../helper/http') +const { getConfig } = require('../helper/cache') const { getTonBalance } = require('../helper/chain/ton') const sdk = require('@defillama/sdk') const nullAddress = ADDRESSES.null @@ -9,7 +10,7 @@ module.exports = { timetravel: false, ton: { tvl: async (_, _1, _2, { api}) => { - const pools = await get('https://api.tegro.finance/v1/pairs') + const pools = await getConfig('tegro-fi', 'https://api.tegro.finance/v1/pairs') let tonPools = pools.filter(i => !i.base.address ).map(i => i.address) sdk.log(pools.length, tonPools.length) const tonBalances = await Promise.all(tonPools.map(getTonBalance)) From 96674180e2d63226c69880a51a182e677ecb1443 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 18 Jul 2023 15:01:14 +0200 Subject: [PATCH 0397/1974] moraswap: code refactor --- projects/moraswap/index.js | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/projects/moraswap/index.js b/projects/moraswap/index.js index b587bd0f292..9efe0f8a00f 100644 --- a/projects/moraswap/index.js +++ b/projects/moraswap/index.js @@ -1,23 +1,9 @@ const { getUniTVL } = require('../helper/unknownTokens') -const ethers = require("ethers") -const { config } = require('@defillama/sdk/build/api'); -config.setProvider("neon_evm", new ethers.providers.StaticJsonRpcProvider( - "https://neon-proxy-mainnet.solana.p2p.org", - { - name: "neon_evm", - chainId: 245022934, - } - )) - - -const dexTVL_neon = getUniTVL({ factory: '0xd43F135f6667174f695ecB7DD2B5f953d161e4d1', useDefaultCoreAssets: true }) - - module.exports = { misrepresentedTokens: true, neon_evm: { - tvl: dexTVL_neon, + tvl: getUniTVL({ factory: '0xd43F135f6667174f695ecB7DD2B5f953d161e4d1', useDefaultCoreAssets: true }), } }; From aaf9de9e89545a37c3d3600fa787244fb175730f Mon Sep 17 00:00:00 2001 From: Strategic Reserve Date: Tue, 18 Jul 2023 06:02:27 -0700 Subject: [PATCH 0398/1974] Update index.js (#6832) Update Fantom, Avax, Mantle, new AMMs --- projects/visor/index.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/projects/visor/index.js b/projects/visor/index.js index bc6d11f0e24..51197f2e0ab 100644 --- a/projects/visor/index.js +++ b/projects/visor/index.js @@ -26,6 +26,7 @@ const HYPE_REGISTRY = { "0xAeC731F69Fa39aD84c7749E913e3bC227427Adfd", // Quickswap "0xcAC19d43C9558753d7535978A370055614Ce832E", // Retro "0x97686103B3E7238Ca6c2C439146B30adBd84a593", // Sushiswap + "0x7b9c2f68f16c3618bb45616fb98d83f94fd7062e", // Ascent ], polygon_zkevm: [ "0xD08B593eb3460B7aa5Ce76fFB0A3c5c938fd89b8", // Quickswap @@ -51,6 +52,15 @@ const HYPE_REGISTRY = { celo: [ "0x0F548d7AD1A0CB30D1872b8C18894484d76e1569", // Uniswap ], + avax: [ + "0x3FE6F25DA67DC6AD2a5117a691f9951eA14d6f15", // Glacier + ], + fantom: [ + "0xf874d4957861e193aec9937223062679c14f9aca", // Spiritswap + ], + mantle: [ + "0x683292172E2175bd08e3927a5e72FC301b161300", // FusionX + ], }; /* List of bad addresses added to registries that need to be excluded manually */ @@ -160,4 +170,13 @@ module.exports = { celo: { tvl: tvlWrapper, }, + avax: { + tvl: tvlWrapper, + }, + fantom: { + tvl: tvlWrapper, + }, + mantle: { + tvl: tvlWrapper, + }, }; From f91d2db9c974622a27974ef96fde2f436a8e2050 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 18 Jul 2023 15:59:16 +0200 Subject: [PATCH 0399/1974] balancer: track base --- package-lock.json | 12 ++++++------ projects/balancer/onchain.js | 1 + projects/helper/chains.json | 1 + projects/wombat-exchange/index.js | 17 ++++------------- 4 files changed, 12 insertions(+), 19 deletions(-) diff --git a/package-lock.json b/package-lock.json index 463ef7a6ba5..47af3ebb4bc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -63,9 +63,9 @@ } }, "node_modules/@defillama/sdk": { - "version": "4.0.35", - "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.35.tgz", - "integrity": "sha512-v9v8Ang7xfDOqT93uxzR6jtpICRMGS+AI6/3dbKDk/WVfT1nq9I3Hz2uXcs1q4vIwK8WSpoeT5qlRXgadyJ95g==", + "version": "4.0.38", + "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.38.tgz", + "integrity": "sha512-eZUQwJqR5VNR0BgSL2Z/kmjf7VBd+Ggazs5KSbfDM4xcUm3pyEHcnkia6VlSikyzMk2OsbuKIrJGX47Ys/EZkA==", "dependencies": { "@supercharge/promise-pool": "^2.1.0", "ethers": "^5.4.5", @@ -4194,9 +4194,9 @@ } }, "@defillama/sdk": { - "version": "4.0.35", - "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.35.tgz", - "integrity": "sha512-v9v8Ang7xfDOqT93uxzR6jtpICRMGS+AI6/3dbKDk/WVfT1nq9I3Hz2uXcs1q4vIwK8WSpoeT5qlRXgadyJ95g==", + "version": "4.0.38", + "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.38.tgz", + "integrity": "sha512-eZUQwJqR5VNR0BgSL2Z/kmjf7VBd+Ggazs5KSbfDM4xcUm3pyEHcnkia6VlSikyzMk2OsbuKIrJGX47Ys/EZkA==", "requires": { "@supercharge/promise-pool": "^2.1.0", "ethers": "^5.4.5", diff --git a/projects/balancer/onchain.js b/projects/balancer/onchain.js index dd04ca028d5..057f1a06495 100644 --- a/projects/balancer/onchain.js +++ b/projects/balancer/onchain.js @@ -21,6 +21,7 @@ const config = { arbitrum: { fromBlock: 222832, }, xdai: { fromBlock: 24821598, }, polygon_zkevm: { fromBlock: 203079, }, + base: { fromBlock: 1196036, }, } module.exports = {}; diff --git a/projects/helper/chains.json b/projects/helper/chains.json index 2b85f5f4767..dcbb5a21f9b 100644 --- a/projects/helper/chains.json +++ b/projects/helper/chains.json @@ -7,6 +7,7 @@ "astar", "aurora", "avax", + "base", "bifrost", "binance", "bitcoin", diff --git a/projects/wombat-exchange/index.js b/projects/wombat-exchange/index.js index e959a2d88c5..ab4f03a3f8f 100644 --- a/projects/wombat-exchange/index.js +++ b/projects/wombat-exchange/index.js @@ -8,10 +8,7 @@ Object.keys(config).forEach((chain) => { tvl: async (_, _b, { [chain]: block }, { api }) => { const pools = Object.values(arg["pools"]); - let allUnderlying = await api.multiCall({ - abi: "address[]:getTokens", - calls: pools, - }); + let allUnderlying = await api.multiCall({ abi: "address[]:getTokens", calls: pools, }); const tokens = []; const calls = []; @@ -21,16 +18,10 @@ Object.keys(config).forEach((chain) => { calls.push({ target: v, params: t }); }); }); - const wTokens = await api.multiCall({ - abi: "function addressOfAsset(address) view returns (address)", - calls, - }); - return sumTokens2({ - api, - tokensAndOwners: tokens.map((v, i) => [v, wTokens[i]]), - }); + const wTokens = await api.multiCall({ abi: "function addressOfAsset(address) view returns (address)", calls, }); + return sumTokens2({ api, tokensAndOwners2: [tokens, wTokens], }); }, - staking: staking(arg["veWom"], arg["wom"], chain), + staking: staking(arg["veWom"], arg["wom"],), }; }); From 5a9c13b4df1da49d66e8570af06de9bea2dae44e Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 18 Jul 2023 17:57:54 +0200 Subject: [PATCH 0400/1974] track venus isolated pools --- projects/compound-v3/index.js | 1 - projects/helper/tokenMapping.js | 4 ++++ projects/venus-isolated-pools/index.js | 32 ++++++++++++++++++++++++++ 3 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 projects/venus-isolated-pools/index.js diff --git a/projects/compound-v3/index.js b/projects/compound-v3/index.js index 99685551024..137669d1c23 100644 --- a/projects/compound-v3/index.js +++ b/projects/compound-v3/index.js @@ -1,4 +1,3 @@ -const ADDRESSES = require('../helper/coreAssets.json') const { compoundV3Exports } = require('../helper/compoundV3') const markets = [ "0xc3d688B66703497DAA19211EEdff47f25384cdc3", // USDC Market diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 5150ee20ac9..68931409448 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -54,6 +54,10 @@ const fixBalancesTokens = { tenet: { '0xd6cb8a253e12893b0cf39ca78f7d858652cca1fe': { coingeckoId: "tenet-1b000f7b-59cb-4e06-89ce-d62b32d362b9", decimals: 18 }, }, + bsc: { + '0x352cb5e19b12fc216548a2677bd0fce83bae434b': { coingeckoId: 'bittorrent', decimals: 18, }, + '0xce7de646e7208a4ef112cb6ed5038fa6cc6b12e3': { coingeckoId: 'tron', decimals: 6, }, + }, ultron: { '0xb1183357745d3fd7d291e42a2c4b478cdb5710c6': { coingeckoId: "ultron", decimals: 18 }, }, diff --git a/projects/venus-isolated-pools/index.js b/projects/venus-isolated-pools/index.js new file mode 100644 index 00000000000..7b51fbceb9f --- /dev/null +++ b/projects/venus-isolated-pools/index.js @@ -0,0 +1,32 @@ +const { cachedGraphQuery } = require('../helper/cache') +const sdk = require('@defillama/sdk') +const { compoundExports2 } = require('../helper/compound') +const config = { + bsc: { + endpoint: 'https://api.thegraph.com/subgraphs/name/venusprotocol/venus-isolated-pools', + } +} + +Object.keys(config).forEach(chain => { + module.exports[chain] = { tvl, borrowed, } +}) + +async function getPools(api) { + const { endpoint } = config[api.chain] + const { pools } = await cachedGraphQuery('venus-v4', endpoint, `{ pools { id }}`) + return pools.map(i => i.id) +} + +async function tvl(...args) { + const [_, _b, _cb, { api, }] = args + const pools = await getPools(api) + const tvls = pools.map(i => compoundExports2({ comptroller: i, fetchBalances: true, })) + return sdk.util.sumChainTvls(tvls.map(i => i.tvl))(...args) +} + +async function borrowed(...args) { + const [_, _b, _cb, { api, }] = args + const pools = await getPools(api) + const tvls = pools.map(i => compoundExports2({ comptroller: i, fetchBalances: true, })) + return sdk.util.sumChainTvls(tvls.map(i => i.borrowed))(...args) +} \ No newline at end of file From e094dc001169602f4d61012f5b1f5cd0bf5dc2f6 Mon Sep 17 00:00:00 2001 From: yashvik <39464729+waverune@users.noreply.github.com> Date: Tue, 18 Jul 2023 21:56:06 +0530 Subject: [PATCH 0401/1974] timeswap: adds mantle chain (#6834) --- projects/timeswap-v2/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/projects/timeswap-v2/index.js b/projects/timeswap-v2/index.js index 82d1ff0f476..ba1328dcc75 100644 --- a/projects/timeswap-v2/index.js +++ b/projects/timeswap-v2/index.js @@ -78,6 +78,10 @@ const config = { newFactory: "0x406d3Dfcbe20b642c2262b29b960822975371502", fromBlock: 70785970, }, + mantle: { + factory: "0xf8F5e4B7825d484FBDFDC36fc915E79f30b02f9E", + fromBlock: 3563, + } }; module.exports = {}; From 68a085603e0805b117c6327ebb910498ea55f907 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 18 Jul 2023 20:48:31 +0200 Subject: [PATCH 0402/1974] raydium: add staking --- projects/raydium.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/projects/raydium.js b/projects/raydium.js index 3cddebde1aa..972f9f94e70 100644 --- a/projects/raydium.js +++ b/projects/raydium.js @@ -1,4 +1,4 @@ -const { getConnection, sumTokens2, decodeAccount, getValidGeckoSolTokens, } = require("./helper/solana"); +const { getConnection, sumTokens2, decodeAccount, getValidGeckoSolTokens, sumTokens, } = require("./helper/solana"); const { PublicKey, } = require("@solana/web3.js"); const sdk = require('@defillama/sdk') @@ -43,12 +43,11 @@ async function ammV4Tvl() { ]}) } - - module.exports = { timetravel: false, hallmarks: [[1667865600, "FTX collapse"]], solana: { tvl: sdk.util.sumChainTvls([tvlCLMM, ammStableTvl, ammV4Tvl]), + staking: () => sumTokens2({ tokenAccounts: ['8tnpAECxAT9nHBqR1Ba494Ar5dQMPGhL31MmPJz1zZvY']}) }, }; \ No newline at end of file From 47787500acbef1033270dfbb21664591cf60f662 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 18 Jul 2023 22:17:46 +0200 Subject: [PATCH 0403/1974] ondo: track polygon --- projects/ondofinance/index.js | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/projects/ondofinance/index.js b/projects/ondofinance/index.js index cfaf0c09cdd..8c8279512b7 100644 --- a/projects/ondofinance/index.js +++ b/projects/ondofinance/index.js @@ -1,18 +1,26 @@ -const sdk = require("@defillama/sdk"); -const funds = [ - "0x1B19C19393e2d034D8Ff31ff34c81252FcBbee92", // OUSG -]; module.exports = { methodology: "Sums Ondo's fund supplies.", misrepresentedTokens: true, doublecounted: true, +}; + +const config = { ethereum: { - tvl: async (_, __, ___, { api }) => { + OUSG: '0x1B19C19393e2d034D8Ff31ff34c81252FcBbee92', + }, + polygon: { + OUSG: '0xbA11C5effA33c4D6F8f593CFA394241CfE925811', + } +} + +Object.keys(config).forEach(chain => { + let funds = config[chain] + funds = Object.values(funds) + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { const supplies = await api.multiCall({ abi: 'erc20:totalSupply', calls: funds }) - const balances = {} - supplies.forEach((v, i) => sdk.util.sumSingleBalance(balances, funds[i], v, api.chain)) - return balances + api.addTokens(funds, supplies) } - }, -}; + } +}) \ No newline at end of file From 9e4899cecfbc69b3b799bdc6d3b6e8bfcaaff673 Mon Sep 17 00:00:00 2001 From: define Date: Tue, 18 Jul 2023 22:10:32 +0100 Subject: [PATCH 0404/1974] update gains treasury --- projects/treasury/gains.js | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/projects/treasury/gains.js b/projects/treasury/gains.js index 2783aaf851f..c9ebbce7dd1 100644 --- a/projects/treasury/gains.js +++ b/projects/treasury/gains.js @@ -1,11 +1,34 @@ const { nullAddress,treasuryExports } = require("../helper/treasury"); +const ADDRESSES = require('../helper/coreAssets.json'); + +const GNS = "0x18c11FD286C5EC11c3b683Caa813B77f5163A122" +const multisig = "0xf8e93a7d954f7d31d5fa54bc0eb0e384412a158d" +const treasury = "0x80fd0accC8Da81b0852d2Dca17b5DDab68f22253" +const gnspolygon = "0xE5417Af564e4bFDA1c483642db72007871397896" module.exports = treasuryExports({ arbitrum: { tokens: [ nullAddress, + ADDRESSES.arbitrum.USDC, + ADDRESSES.arbitrum.USDC_CIRCLE, + ADDRESSES.arbitrum.DAI, + "0xAAA6C1E32C55A7Bfa8066A6FAE9b42650F262418", + "0xC36442b4a4522E871399CD717aBDD847Ab11FE88" //UNI V3 + ], + owners: [multisig, treasury], + ownTokens: [GNS], + resolveUniV3: true, + }, + polygon: { + tokens: [ + nullAddress, + ADDRESSES.polygon.DAI, + ADDRESSES.polygon.USDT, + "0xC36442b4a4522E871399CD717aBDD847Ab11FE88" //UNI V3 ], - owners: ['0xf8e93a7d954f7d31d5fa54bc0eb0e384412a158d'], - ownTokens: [], + owners: [treasury], + ownTokens: [gnspolygon], + resolveUniV3: true, }, }) \ No newline at end of file From ef2cdf94d7aea33cf86a320b5ff81179634d5bd1 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 19 Jul 2023 05:52:33 +0200 Subject: [PATCH 0405/1974] update ondo --- projects/helper/coreAssets.json | 15 ++++++++++++++- projects/helper/tokenMapping.js | 25 ------------------------- projects/ondofinance/index.js | 7 ++++++- 3 files changed, 20 insertions(+), 27 deletions(-) diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index 4becd95c5eb..a839b81b1c7 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -670,6 +670,7 @@ }, "ultron": { "wULX": "0x3a4f06431457de873b588846d139ec0d86275d54", + "wULX_1": "0xb1183357745d3fd7d291e42a2c4b478cdb5710c6", "wETH": "0x2318bf5809a72aabadd15a3453a18e50bbd651cd", "wBTC": "0xd2b86a80a8f30b83843e247a50ecdc8d843d87dd", "BUSD": "0xc7cac85c1779d2b8ada94effff49a4754865e2e4", @@ -1235,7 +1236,8 @@ "WLOOP": "0x3936D20a39eD4b0d44EaBfC91757B182f14A38d5" }, "rpg": { - "WRPG": "0x71d9cfd1b7adb1e8eb4c193ce6ffbe19b4aee0db" + "WRPG": "0x71d9cfd1b7adb1e8eb4c193ce6ffbe19b4aee0db", + "USDT": "0x8e8816a1747fddc5f8b45d2e140a425d3788f659" }, "map": { "BUSD": "0x35bf4004c3fc9f509259d4942da6bae3669e1db1", @@ -1323,5 +1325,16 @@ "stacks": { "WSTX": "SP1Z92MPDQEWZXW36VX71Q25HKF5K2EPCJ304F275.wstx-token-v4a", "WBTC": "SP3DX3H4FEYZJZ586MFBS25ZW3HZDMEW92260R2PR.Wrapped-Bitcoin::wrapped-bitcoin" + }, + "neon_evm": { + "WNEON": "0xb14760c064a1b9eaf9ec5a8a421971e40a51b59c" + }, + "tenet": { + "WTENET": "0xd6cb8a253e12893b0cf39ca78f7d858652cca1fe" + }, + "mantle": { + "WMNT": "0x78c1b0c915c4faa5fffa6cabf0219da63d7f4cb8", + "WETH": "0xdeaddeaddeaddeaddeaddeaddeaddeaddead1111", + "USDT": "0x201eba5cc46d216ce6dc03f6a759e8e766e956ae" } } diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 68931409448..7da1b881fef 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -45,34 +45,9 @@ const ibcMappings = { const fixBalancesTokens = { // Sample Code - neon_evm: { - '0xb14760c064a1b9eaf9ec5a8a421971e40a51b59c': { coingeckoId: 'neon', decimals:18}, - }, - rpg: { - '0x8e8816a1747fddc5f8b45d2e140a425d3788f659': { coingeckoId: "tether", decimals: 18 }, - }, - tenet: { - '0xd6cb8a253e12893b0cf39ca78f7d858652cca1fe': { coingeckoId: "tenet-1b000f7b-59cb-4e06-89ce-d62b32d362b9", decimals: 18 }, - }, - bsc: { - '0x352cb5e19b12fc216548a2677bd0fce83bae434b': { coingeckoId: 'bittorrent', decimals: 18, }, - '0xce7de646e7208a4ef112cb6ed5038fa6cc6b12e3': { coingeckoId: 'tron', decimals: 6, }, - }, - ultron: { - '0xb1183357745d3fd7d291e42a2c4b478cdb5710c6': { coingeckoId: "ultron", decimals: 18 }, - }, - avax: { - '0x8fdcf51d1aaeb9f031838ebeb15884a0d5efcda3': { coingeckoId: "wrapped-bitcoin", decimals: 18 }, - '0xaa44678304cc1a848bfc31dc013afcc6c9feae11': { coingeckoId: "benqi", decimals: 18 }, - }, ozone: { // '0x83048f0bf34feed8ced419455a4320a735a92e9d': { coingeckoId: "ozonechain", decimals: 18 }, // was mapped to wrong chain }, - mantle: { - '0x201eba5cc46d216ce6dc03f6a759e8e766e956ae': { coingeckoId: "tether", decimals: 6 }, - '0x78c1b0c915c4faa5fffa6cabf0219da63d7f4cb8': { coingeckoId: "mantle", decimals: 18 }, - '0xdeaddeaddeaddeaddeaddeaddeaddeaddead1111': { coingeckoId: "ethereum", decimals: 18 }, - } } ibcChains.forEach(chain => fixBalancesTokens[chain] = { ...ibcMappings, ...(fixBalancesTokens[chain] || {}) }) diff --git a/projects/ondofinance/index.js b/projects/ondofinance/index.js index 8c8279512b7..8574f516e65 100644 --- a/projects/ondofinance/index.js +++ b/projects/ondofinance/index.js @@ -1,4 +1,7 @@ +const { toUSDTBalances } = require('../helper/balances') +const sdk = require('@defillama/sdk') + module.exports = { methodology: "Sums Ondo's fund supplies.", misrepresentedTokens: true, @@ -19,8 +22,10 @@ Object.keys(config).forEach(chain => { funds = Object.values(funds) module.exports[chain] = { tvl: async (_, _b, _cb, { api, }) => { + const ethApi = new sdk.ChainApi({ chain: 'ethereum', block: _b}) const supplies = await api.multiCall({ abi: 'erc20:totalSupply', calls: funds }) - api.addTokens(funds, supplies) + const tokenPrice = (await ethApi.call({ abi: 'uint256:rwaPrice', target: '0xc53e6824480d976180A65415c19A6931D17265BA'})) / 1e18 + return toUSDTBalances(supplies.reduce((a, i) => a +i/1e18, 0) * tokenPrice) } } }) \ No newline at end of file From 3a1cef48310151b2c62b8cc23df5b4888ee1cc67 Mon Sep 17 00:00:00 2001 From: bryansniyve <134277602+bryansniyve@users.noreply.github.com> Date: Wed, 19 Jul 2023 12:43:57 +0800 Subject: [PATCH 0406/1974] feat: ApolloX support more ALP Token: BTCB/HAY/WBNB (#6838) Co-authored-by: bryan.y --- projects/apollox/index.js | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/projects/apollox/index.js b/projects/apollox/index.js index 1090f5c169f..2f80e92f3d5 100644 --- a/projects/apollox/index.js +++ b/projects/apollox/index.js @@ -24,6 +24,9 @@ const TOKEN_BANANA = "0x603c7f932ED1fc6575303D8Fb018fDCBb0f39a95"; const TOKEN_MDX = "0x9c65ab58d8d978db963e63f2bfb7121627e3a739"; const TOKEN_HAY = "0x0782b6d8c4551B9760e74c0545a9bCD90bdc41E5"; +const TOKEN_BTC = "0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c"; +const TOKEN_BNB = "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c"; + const TreasureTokens = [ // TOKEN_APX, nullAddress, @@ -39,11 +42,21 @@ const TreasureTokens = [ TOKEN_HAY, ]; +const ALPTokens = [ + nullAddress, + TOKEN_BSC_USD, + TOKEN_BUSD, + TOKEN_USDC, + TOKEN_BTC, + TOKEN_BNB, + TOKEN_HAY, +] + async function tvl(timestamp, _block, { bsc: block }) { - const toa = TreasureTokens.map((t) => [t, treasureContract]); - toa.push([TOKEN_BSC_USD, ALPContract]); - toa.push([TOKEN_BUSD, ALPContract]); - toa.push([TOKEN_USDC, ALPContract]); + const toa = [ + ...TreasureTokens.map((t) => [t, treasureContract]), + ...ALPTokens.map((t) => [t, ALPContract]), + ] return sumTokens({}, toa, block, "bsc"); } From 8c526fbee97a15c268acf98399e8e237a7e45271 Mon Sep 17 00:00:00 2001 From: Joeh <32411671+joehquak@users.noreply.github.com> Date: Wed, 19 Jul 2023 06:50:23 +0100 Subject: [PATCH 0407/1974] Add TVL trackers for Sobal DEX on Neon EVM (#6837) * feat: add sobal TVL trackers for neon-evm * add token mappings for neon evm * code refactor --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/sobal/index.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 projects/sobal/index.js diff --git a/projects/sobal/index.js b/projects/sobal/index.js new file mode 100644 index 00000000000..0f52626b487 --- /dev/null +++ b/projects/sobal/index.js @@ -0,0 +1,14 @@ +const { onChainTvl } = require('../helper/balancer') + +const V2_ADDRESS = '0x7122e35ceC2eED4A989D9b0A71998534A203972C'; // Vault + +const config = { + neon_evm: { fromBlock: 206166057, }, +} + +Object.keys(config).forEach(chain => { + const { fromBlock } = config[chain] + module.exports[chain] = { + tvl: onChainTvl(V2_ADDRESS, fromBlock) + } +}) From d18f7707115d2015e3269ba6a51e118e53c109c4 Mon Sep 17 00:00:00 2001 From: Amilcar Rey Date: Wed, 19 Jul 2023 04:32:16 -0300 Subject: [PATCH 0408/1974] feat: Add Hatom Protocol (#6811) * Hatom protocol init Co-authored-by: Daniela Pena * Clean code * Conver cash and borrows from string to number * Adding bignumber.js * Adding to usdc balances * To usdc manual * Getting token prices from api and format code. * Change API_URL to mainnet * minor refactor and code formatting * fix: :bug: attempt to fix graphql query error on test * chore: :coffin: remove unused import * add back * Split adapter in two * Adding helpers and dependencies * Lending tvl and borrowed * Adding liquid staking * Finish lending * Handle timeout * Delete trasury for now * hatom: code refactor --------- Co-authored-by: Daniela Pena Co-authored-by: Daniela Pena Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/hatom-lending/index.js | 42 ++++++++++++ projects/hatom-liquid-staking/index.js | 14 ++++ projects/helper/chain/elrond.js | 42 ++++++++++-- projects/helper/env.js | 19 +++--- projects/quantumx-network/farms.abi.json | 83 ------------------------ 5 files changed, 101 insertions(+), 99 deletions(-) create mode 100644 projects/hatom-lending/index.js create mode 100644 projects/hatom-liquid-staking/index.js delete mode 100644 projects/quantumx-network/farms.abi.json diff --git a/projects/hatom-lending/index.js b/projects/hatom-lending/index.js new file mode 100644 index 00000000000..adb9a9cb6db --- /dev/null +++ b/projects/hatom-lending/index.js @@ -0,0 +1,42 @@ +const { sumTokens, call, } = require('../helper/chain/elrond') +const { cachedGraphQuery } = require('../helper/cache') +const { nullAddress } = require('../helper/tokenMapping') + +async function getMoneyMarkets() { + const { queryMoneyMarket: res } = await cachedGraphQuery('hatom-TVLLendingProtocolQuery', 'https://mainnet-api.hatom.com/graphql', ` + query QueryMoneyMarket { + queryMoneyMarket { + address + underlying { + name + decimals + id + } + } + } + `) + res.forEach(i => { + if (i.underlying.id === 'EGLD') i.underlying.id = nullAddress + }) + return res +} + +const tvl = async () => { + const moneyMarkets = await getMoneyMarkets() + return sumTokens({ owners: moneyMarkets.map(i => i.address), }) +}; + +const borrowed = async (_, _1, _2, { api }) => { + const moneyMarkets = await getMoneyMarkets() + const tokens = moneyMarkets.map(i => i.underlying.id) + const bals = await Promise.all(moneyMarkets.map(i => call({ target: i.address, abi: 'getTotalBorrows', responseTypes: ['number'] }))) + api.addTokens(tokens, bals) +}; + +module.exports = { + timetravel: false, + elrond: { + tvl, + borrowed, + }, +}; diff --git a/projects/hatom-liquid-staking/index.js b/projects/hatom-liquid-staking/index.js new file mode 100644 index 00000000000..db9ff8b7bca --- /dev/null +++ b/projects/hatom-liquid-staking/index.js @@ -0,0 +1,14 @@ +const { call, } = require("../helper/chain/elrond"); + +const ADDRESSES = require('../helper/coreAssets.json'); + +const tvl = async () => { + return { ['elrond:' + ADDRESSES.null]: await call({ target: 'erd1qqqqqqqqqqqqqpgq4gzfcw7kmkjy8zsf04ce6dl0auhtzjx078sslvrf4e', abi: 'getCashReserve', responseTypes: ['number'] }) } +}; + +module.exports = { + timetravel: false, + elrond: { + tvl, + }, +}; diff --git a/projects/helper/chain/elrond.js b/projects/helper/chain/elrond.js index 20f63d880a3..07f0c60db12 100644 --- a/projects/helper/chain/elrond.js +++ b/projects/helper/chain/elrond.js @@ -1,20 +1,49 @@ const ADDRESSES = require('../coreAssets.json') const { get } = require('../http') -const { getCoreAssets, } = require('../tokenMapping') const { transformBalances } = require('../portedTokens') const sdk = require('@defillama/sdk') -const chain = 'elrond' +const { post } = require('../http') +const { getEnv } = require('../env') + +const call = async ({ target, abi, params = [], responseTypes = [] }) => { + const data = await post(getEnv('MULTIVERSX_RPC') + '/query', { scAddress: target, funcName: abi, args: params, }) + + const response = data.returnData.map(parseResponses) + return responseTypes.length === 1 ? response[0] : response + + // https://github.com/multiversx/mx-sdk-js-core/blob/main/src/smartcontracts/resultsParser.ts + function parseResponses(item, idx) { + const buffer = Buffer.from(item || "", "base64") + switch (responseTypes[idx]) { + case 'number': return parseNumber(buffer) + default: throw new Error('Unknown/unsupported data type') + } + } -const API_HOST = 'https://api.multiversx.com' + function parseNumber(buffer) { + // https://github.com/juanelas/bigint-conversion/blob/master/src/ts/index.ts#L63 + buffer = new Uint8Array(buffer) + let bits = 8n + + let ret = 0n + for (const i of buffer.values()) { + const bi = BigInt(i) + ret = (ret << bits) + bi + } + return ret.toString() + } +}; + +const chain = 'elrond' async function getElrondBalance(address) { - const { data: { account: { balance } } } = await get(`${API_HOST}/address/${address}`) + const { data: { account: { balance } } } = await get(`${getEnv('MULTIVERSX_RPC')}/address/${address}`) return balance } const nullAddress = ADDRESSES.null async function getTokens({ address, balances = {}, tokens = [], blacklistedTokens = [], whitelistedTokens = [], }) { - const res = await get(`${API_HOST}/accounts/${address}/tokens?size=1000`) + const res = await get(`${getEnv('MULTIVERSX_RPC')}/accounts/${address}/tokens?size=1000`) res.filter(i => i.type === 'FungibleESDT') .forEach(i => { const token = i.identifier @@ -26,7 +55,7 @@ async function getTokens({ address, balances = {}, tokens = [], blacklistedToken return balances } -async function sumTokens({ owners = [], tokens = [], balances = {}, blacklistedTokens = [], tokensAndOwners = [], whitelistedTokens = []}) { +async function sumTokens({ owners = [], tokens = [], balances = {}, blacklistedTokens = [], tokensAndOwners = [], whitelistedTokens = [] }) { if (tokensAndOwners.length) { await Promise.all(tokensAndOwners.map(([token, owner]) => sumTokens({ owners: [owner], tokens: [token], balances, blacklistedTokens, whitelistedTokens, }))) return balances @@ -43,4 +72,5 @@ async function sumTokens({ owners = [], tokens = [], balances = {}, blacklistedT module.exports = { sumTokens, + call, } \ No newline at end of file diff --git a/projects/helper/env.js b/projects/helper/env.js index fe0419c1413..1517ef24cf8 100644 --- a/projects/helper/env.js +++ b/projects/helper/env.js @@ -3,23 +3,22 @@ const BOOL_KEYS = [ 'LLAMA_DEBUG_MODE', ] +const DEFAULTS = { + COVALENT_KEY: 'ckey_72cd3b74b4a048c9bc671f7c5a6', + SOLANA_RPC: 'https://try-rpc.mainnet.solana.blockdaemon.tech', + APTOS_RPC: 'https://aptos-mainnet.pontem.network', + SUI_RPC: 'https://fullnode.mainnet.sui.io/', + MULTIVERSX_RPC: 'https://api.multiversx.com', +} + const ENV_KEYS = [ ...BOOL_KEYS, + ...Object.keys(DEFAULTS), 'GETBLOCK_KEY', - 'SOLANA_RPC', - 'APTOS_RPC', - 'SUI_RPC', 'LOFTY_API', - 'COVALENT_KEY', 'OLYMPUS_GRAPH_API_KEY', ] -const DEFAULTS = { - COVALENT_KEY: 'ckey_72cd3b74b4a048c9bc671f7c5a6', - SOLANA_RPC: 'https://try-rpc.mainnet.solana.blockdaemon.tech', - APTOS_RPC: 'https://aptos-mainnet.pontem.network', - SUI_RPC: 'https://fullnode.mainnet.sui.io/', -} function getEnv(key) { if (!ENV_KEYS.includes(key)) throw new Error(`Unknown env key: ${key}`) diff --git a/projects/quantumx-network/farms.abi.json b/projects/quantumx-network/farms.abi.json deleted file mode 100644 index b53e4b0e1bf..00000000000 --- a/projects/quantumx-network/farms.abi.json +++ /dev/null @@ -1,83 +0,0 @@ -{ - "buildInfo": { - "rustc": { - "version": "1.67.0-nightly", - "commitHash": "b7bc90fea3b441234a84b49fdafeb75815eebbab", - "commitDate": "2022-11-21", - "channel": "Nightly", - "short": "rustc 1.67.0-nightly (b7bc90fea 2022-11-21)" - }, - "contractCrate": { - "name": "farms", - "version": "0.0.0" - }, - "framework": { - "name": "elrond-wasm", - "version": "0.38.0" - } - }, - "name": "Farms", - "constructor": { - "inputs": [], - "outputs": [] - }, - "endpoints": [ - { - "name": "getAllFarms", - "mutability": "readonly", - "inputs": [], - "outputs": [ - { - "type": "variadic>", - "multi_result": true - } - ] - } - ], - "events": [], - "hasCallback": false, - "types": { - "EsdtTokenPayment": { - "type": "struct", - "fields": [ - { - "name": "token_identifier", - "type": "TokenIdentifier" - }, - { - "name": "token_nonce", - "type": "u64" - }, - { - "name": "amount", - "type": "BigUint" - } - ] - }, - "Farm": { - "type": "struct", - "fields": [ - { - "name": "id", - "type": "BigUint" - }, - { - "name": "creator", - "type": "Address" - }, - { - "name": "creation_epoch", - "type": "u64" - }, - { - "name": "staked_token", - "type": "EgldOrEsdtTokenIdentifier" - }, - { - "name": "reward_token", - "type": "EgldOrEsdtTokenIdentifier" - } - ] - } - } -} From 95eb959e4fa20f07a8d0e010da928a53214804e8 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 19 Jul 2023 10:04:32 +0200 Subject: [PATCH 0409/1974] minor fix --- projects/treasury/gains.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/projects/treasury/gains.js b/projects/treasury/gains.js index c9ebbce7dd1..f77c9ccd0aa 100644 --- a/projects/treasury/gains.js +++ b/projects/treasury/gains.js @@ -14,7 +14,6 @@ module.exports = treasuryExports({ ADDRESSES.arbitrum.USDC_CIRCLE, ADDRESSES.arbitrum.DAI, "0xAAA6C1E32C55A7Bfa8066A6FAE9b42650F262418", - "0xC36442b4a4522E871399CD717aBDD847Ab11FE88" //UNI V3 ], owners: [multisig, treasury], ownTokens: [GNS], @@ -25,7 +24,6 @@ module.exports = treasuryExports({ nullAddress, ADDRESSES.polygon.DAI, ADDRESSES.polygon.USDT, - "0xC36442b4a4522E871399CD717aBDD847Ab11FE88" //UNI V3 ], owners: [treasury], ownTokens: [gnspolygon], From c38760c13fd983b02066bb9214cbdb4b90fd65c8 Mon Sep 17 00:00:00 2001 From: Define101 <93603962+Define101@users.noreply.github.com> Date: Wed, 19 Jul 2023 09:10:00 +0100 Subject: [PATCH 0410/1974] update gains treasury (#6835) * update gains treasury * minor fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/treasury/gains.js | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/projects/treasury/gains.js b/projects/treasury/gains.js index 2783aaf851f..f77c9ccd0aa 100644 --- a/projects/treasury/gains.js +++ b/projects/treasury/gains.js @@ -1,11 +1,32 @@ const { nullAddress,treasuryExports } = require("../helper/treasury"); +const ADDRESSES = require('../helper/coreAssets.json'); + +const GNS = "0x18c11FD286C5EC11c3b683Caa813B77f5163A122" +const multisig = "0xf8e93a7d954f7d31d5fa54bc0eb0e384412a158d" +const treasury = "0x80fd0accC8Da81b0852d2Dca17b5DDab68f22253" +const gnspolygon = "0xE5417Af564e4bFDA1c483642db72007871397896" module.exports = treasuryExports({ arbitrum: { tokens: [ nullAddress, + ADDRESSES.arbitrum.USDC, + ADDRESSES.arbitrum.USDC_CIRCLE, + ADDRESSES.arbitrum.DAI, + "0xAAA6C1E32C55A7Bfa8066A6FAE9b42650F262418", + ], + owners: [multisig, treasury], + ownTokens: [GNS], + resolveUniV3: true, + }, + polygon: { + tokens: [ + nullAddress, + ADDRESSES.polygon.DAI, + ADDRESSES.polygon.USDT, ], - owners: ['0xf8e93a7d954f7d31d5fa54bc0eb0e384412a158d'], - ownTokens: [], + owners: [treasury], + ownTokens: [gnspolygon], + resolveUniV3: true, }, }) \ No newline at end of file From 0321e059cabc16d6800c316a17833ae9ce4c232e Mon Sep 17 00:00:00 2001 From: LpcAries <101619245+LpcAries@users.noreply.github.com> Date: Wed, 19 Jul 2023 16:10:35 +0800 Subject: [PATCH 0411/1974] [izumi-iziswap]update poolHelpers contracts (#6839) * update poolHelpers contracts * remove console --- projects/izumi-iziswap/index.js | 88 ++++++++++++++++++--------------- 1 file changed, 49 insertions(+), 39 deletions(-) diff --git a/projects/izumi-iziswap/index.js b/projects/izumi-iziswap/index.js index 95e75d5580b..90a5de8fd43 100644 --- a/projects/izumi-iziswap/index.js +++ b/projects/izumi-iziswap/index.js @@ -5,19 +5,22 @@ const { sumTokens2, } = require('../helper/unwrapLPs') const nullAddress = ADDRESSES.null const poolHelpers = { - 'bsc': '0x93C22Fbeff4448F2fb6e432579b0638838Ff9581', - 'arbitrum': '0x611575eE1fbd4F7915D0eABCC518eD396fF78F0c', - 'era': '0x936c9A1B8f88BFDbd5066ad08e5d773BC82EB15F', - 'meter': '0x07aBf894D5C25E626bb30f75eFC728a1d86BEeDC', - 'aurora': '0xE78e7447223aaED59301b44513D1d3A892ECF212', + 'bsc': ['0x93C22Fbeff4448F2fb6e432579b0638838Ff9581', + '0xBF55ef05412f1528DbD96ED9E7181f87d8C9F453'], + 'arbitrum': ['0xAD1F11FBB288Cd13819cCB9397E59FAAB4Cdc16F'], + 'era': ['0x936c9A1B8f88BFDbd5066ad08e5d773BC82EB15F', + '0x483FDE31bcE3DCc168E23a870831b50Ce2cCd1F1'], + 'meter': ['0x07aBf894D5C25E626bb30f75eFC728a1d86BEeDC'], + 'aurora': ['0x61A41182CD6e94f2A026aE3c0D1b73B1AA579aEa', + '0xE78e7447223aaED59301b44513D1d3A892ECF212'], // 'ethereumclassic': '0x1D377311b342633A970e71a787C50F83858BFC1B', - 'cronos': '0x33531bDBFE34fa6Fd5963D0423f7699775AacaaF', - 'polygon': '0x33531bDBFE34fa6Fd5963D0423f7699775AacaaF', + 'cronos': ['0x33531bDBFE34fa6Fd5963D0423f7699775AacaaF'], + 'polygon': ['0x33531bDBFE34fa6Fd5963D0423f7699775AacaaF'], // 'conflux': '0x1502d025BfA624469892289D45C0352997251728', - 'mantle': '0x1502d025BfA624469892289D45C0352997251728', - 'ethereum': '0x19b683A2F45012318d9B2aE1280d68d3eC54D663', - 'ontology_evm': '0x110dE362cc436D7f54210f96b8C7652C2617887D', - 'ultron' : '0xcA7e21764CD8f7c1Ec40e651E25Da68AeD096037' + 'mantle': ['0x611575eE1fbd4F7915D0eABCC518eD396fF78F0c'], + 'ethereum': ['0x19b683A2F45012318d9B2aE1280d68d3eC54D663'], + 'ontology_evm': ['0x110dE362cc436D7f54210f96b8C7652C2617887D'], + 'ultron' : ['0xcA7e21764CD8f7c1Ec40e651E25Da68AeD096037'] } const blacklistedTokens = [ @@ -27,40 +30,47 @@ const blacklistedTokens = [ const tvl = async (_, _1, _2, { api }) => { const chain = api.chain - const toa = [] - let i = 1 - let foundLastPool = false + const toa = [] const chunkSize = 10 - const poolMetaData = [] const bTokens = [...blacklistedTokens] + const allPools = [] + const allPoolMetas = [] - do { - const calls = [] - for (let j = i; j < i + chunkSize; j++) - calls.push(j) - i += chunkSize - const poolMetas = await api.multiCall({ - target: poolHelpers[chain], - abi: abi.poolMetas, - calls, - }) - for (const output of poolMetas) { - if (output.tokenX === nullAddress && output.fee === '0') { - foundLastPool = true - break; + for(const manager of poolHelpers[chain]) { + let i = 1 + let foundLastPool = false + const poolMetaData = [] + do { + const calls = [] + for (let j = i; j < i + chunkSize; j++) + calls.push(j) + i += chunkSize + const poolMetas = await api.multiCall({ + target: manager, + abi: abi.poolMetas, + calls, + }) + for (const output of poolMetas) { + if (output.tokenX === nullAddress && output.fee === '0') { + foundLastPool = true + break; + } + poolMetaData.push(output) } - poolMetaData.push(output) - } - } while (!foundLastPool) + } while (!foundLastPool) + + const poolCalls = poolMetaData.map(i => ({ params: [i.tokenX, i.tokenY, i.fee] })) + const pools = await api.multiCall({ + target: manager, + abi: abi.pool, + calls: poolCalls, + }) - const poolCalls = poolMetaData.map(i => ({ params: [i.tokenX, i.tokenY, i.fee] })) - const pools = await api.multiCall({ - target: poolHelpers[chain], - abi: abi.pool, - calls: poolCalls, - }) + allPools.push(...pools) + allPoolMetas.push(...poolMetaData) + } - pools.forEach((output, i) => toa.push([poolMetaData[i].tokenX, output], [poolMetaData[i].tokenY, output],)) + allPools.forEach((output, i) => toa.push([allPoolMetas[i].tokenX, output], [allPoolMetas[i].tokenY, output],)) // if (chain === 'era') bTokens.push(ADDRESSES.arbitrum.WETH) return sumTokens2({ tokensAndOwners: toa, api, blacklistedTokens: bTokens, permitFailure: true}) } From 1a2c38a4e20fd3ebb9cdf30a9724e07e543a5d73 Mon Sep 17 00:00:00 2001 From: 69ren <111715700+69ren@users.noreply.github.com> Date: Wed, 19 Jul 2023 16:42:27 +0800 Subject: [PATCH 0412/1974] Add ennead (#6833) * Add ennead * code refactor --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/ennead/index.js | 51 +++++++++++++++++++++++++++++++++ projects/ennead/ramsesLens.json | 7 +++++ projects/helper/unwrapLPs.js | 5 ++-- 3 files changed, 61 insertions(+), 2 deletions(-) create mode 100644 projects/ennead/index.js create mode 100644 projects/ennead/ramsesLens.json diff --git a/projects/ennead/index.js b/projects/ennead/index.js new file mode 100644 index 00000000000..b98b11c2dfa --- /dev/null +++ b/projects/ennead/index.js @@ -0,0 +1,51 @@ +const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') +const { sumTokensExport } = require('../helper/unknownTokens') +const { staking, } = require("../helper/staking"); +const lensAbi = require("./ramsesLens.json"); + +// Ramses contracts +const ramsesLens = '0xAAA68f40515bCcd8e407EBB4dBdF5046D105621e'; +const nfpManager = '0xAA277CB7914b7e5514946Da92cb9De332Ce610EF'; + +// Ennead contracts +// arbi +const neadRam = '0x40301951Af3f80b8C1744ca77E55111dd3c1dba1'; +const neadStake = '0x7D07A61b8c18cb614B99aF7B90cBBc8cD8C72680'; +const lpDepositor = '0x1863736c768f232189F95428b5ed9A51B0eCcAe5'; +const neadNfpDepositor = '0xe99ead648Fb2893d1CFA4e8Fe8B67B35572d2581'; +// avax +const neadStake_avax = '0xe99ead39204bd394e56502A3ad56d7061EE6B1c7'; +const neadSnek = '0xe99ead9519239F3eAad9339292d8A399739Cd55d'; +const neadSnekLp = '0x82360748aC3D7045812c6783f355b41193d3492E'; +const snekView = '0xe99eadc22747c95c658f41a02F1c6C2CcAefA757'; +const booster = '0xe99ead683Dcf1eF0C7F6612be5098BC5fDF4998d'; + +async function arbiTvl(timestamp, block, chainBlocks, { api }) { + let poolsAddresses = await api.call({ target: ramsesLens, abi: lensAbi.allPools, }) + let gauges = await api.multiCall({ target: ramsesLens, calls: poolsAddresses, abi: lensAbi.gaugeForPool, }) + poolsAddresses = poolsAddresses.filter((_, i) => gauges[i] !== nullAddress) + gauges = gauges.filter(gauge => gauge !== nullAddress) + const bals = await api.multiCall({ abi: 'erc20:balanceOf', calls: gauges.map(i => ({ target: i, params: lpDepositor}))}) + api.addTokens(poolsAddresses, bals) + await sumTokens2({ api, uniV3nftsAndOwners: [[nfpManager, neadNfpDepositor],], resolveLP: true, }) +} + +async function avaxTvl(timestamp, block, chainBlocks, { api }) { + const poolsAddresses = await api.call({ target: snekView, abi: lensAbi.allActivePools, }) + const gauges = await api.call({ target: snekView, abi: lensAbi.allGauges, }) + const bals = await api.multiCall({ abi: 'erc20:balanceOf', calls: gauges.map(i => ({ target: i, params: booster}))}) + api.addTokens(poolsAddresses, bals) + return sumTokens2({ api, resolveLP: true, }) +} + +module.exports = { + misrepresentedTokens: true, + arbitrum: { + staking: staking(neadStake, neadRam), + tvl: arbiTvl, + }, + avax: { + staking: sumTokensExport({ owner: neadStake_avax, tokens: [neadSnek], lps: [neadSnekLp], useDefaultCoreAssets: true, }), + tvl: avaxTvl + } +}; \ No newline at end of file diff --git a/projects/ennead/ramsesLens.json b/projects/ennead/ramsesLens.json new file mode 100644 index 00000000000..2686073867a --- /dev/null +++ b/projects/ennead/ramsesLens.json @@ -0,0 +1,7 @@ +{ + "allPools": "function allPools() view returns (address[])", + "gaugeForPool": "function gaugeForPool(address) view returns (address)", + "allActivePools": "function allActivePools() view returns (address[])", + "allGauges": "function allGauges() view returns (address[])", + "allStakingPositionsOf": "function allStakingPositionsOf(address) view returns (tuple(address gauge, uint256 balance, uint256 derivedBalance, tuple(address token, uint256 earned)[] userRewards)[] rewardsData)" +} \ No newline at end of file diff --git a/projects/helper/unwrapLPs.js b/projects/helper/unwrapLPs.js index e16d54476b4..e862a01ad9b 100644 --- a/projects/helper/unwrapLPs.js +++ b/projects/helper/unwrapLPs.js @@ -671,6 +671,7 @@ async function sumTokens2({ api, resolveUniV3 = false, uniV3WhitelistedTokens = [], + uniV3nftsAndOwners = [], resolveArtBlocks = false, resolveNFTs = false, permitFailure = false, @@ -713,8 +714,8 @@ async function sumTokens2({ } } - if (resolveUniV3) - await unwrapUniswapV3NFTs({ balances, chain, block, owner, owners, blacklistedTokens, whitelistedTokens: uniV3WhitelistedTokens, }) + if (resolveUniV3 || uniV3nftsAndOwners.length) + await unwrapUniswapV3NFTs({ balances, chain, block, owner, owners, blacklistedTokens, whitelistedTokens: uniV3WhitelistedTokens, nftsAndOwners: uniV3nftsAndOwners, }) blacklistedTokens = blacklistedTokens.map(t => normalizeAddress(t, chain)) tokensAndOwners = tokensAndOwners.map(([t, o]) => [normalizeAddress(t, chain), o]).filter(([token]) => !blacklistedTokens.includes(token)) From d856f275dbdd467aa71ba8f7ee285ba810ba9fb4 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 19 Jul 2023 11:11:36 +0200 Subject: [PATCH 0413/1974] hop: track arbitrum_nova --- projects/hop/index.js | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/projects/hop/index.js b/projects/hop/index.js index 9ee18e17d8b..cf62bfc65d9 100644 --- a/projects/hop/index.js +++ b/projects/hop/index.js @@ -1,14 +1,21 @@ const { chainExports } = require('../helper/exports') const { default: axios } = require('axios') const { sumTokens2 } = require('../helper/unwrapLPs') +const { getConfig } = require('../helper/cache') + +const chainMapping = { + xdai: 'gnosis', + arbitrum_nova: 'nova' +} +const getChainKey = chain => chainMapping[chain] ?? chain // node test.js projects/hop/index.js function chainTvl(chain) { return async (_, _b, {[chain]: block}) => { const toa = [] - const tokens = await axios('https://raw.githubusercontent.com/hop-protocol/hop/develop/packages/core/build/addresses/mainnet.json') - for (const tokenConstants of Object.values(tokens.data.bridges)) { - const chainConstants = (chain == 'xdai' ? tokenConstants['gnosis'] : tokenConstants[chain]) + const { bridges, bonders } = await getConfig('hop-protocol', 'https://raw.githubusercontent.com/hop-protocol/hop/develop/packages/core/build/addresses/mainnet.json') + for (const tokenConstants of Object.values(bridges)) { + const chainConstants = tokenConstants[getChainKey(chain)] if (chainConstants === undefined) continue @@ -17,7 +24,7 @@ function chainTvl(chain) { toa.push([token, bridge]) } if (chain === "ethereum") { - for (const bonder of Object.entries(tokens.data.bonders)) { + for (const bonder of Object.entries(bonders)) { const tokenName = bonder[0] let contractList = [] for (let i of Object.values(bonder[1])) { @@ -30,7 +37,7 @@ function chainTvl(chain) { } } for (const contract of contractList) { - const token = tokens.data.bridges[tokenName].ethereum.l1CanonicalToken + const token = bridges[tokenName].ethereum.l1CanonicalToken toa.push([token, contract]) } } @@ -39,4 +46,4 @@ function chainTvl(chain) { } } -module.exports = chainExports(chainTvl, ['ethereum', 'xdai', 'polygon', 'optimism', 'arbitrum']) \ No newline at end of file +module.exports = chainExports(chainTvl, ['ethereum', 'polygon', 'optimism', 'arbitrum', ...Object.keys(chainMapping)]) \ No newline at end of file From 5882a9635d78fb0333dbcde9ef30b8f82562941e Mon Sep 17 00:00:00 2001 From: lineabank <135123153+lineabank@users.noreply.github.com> Date: Wed, 19 Jul 2023 18:24:38 +0900 Subject: [PATCH 0414/1974] Add Lineabank (#6840) * Add Lineabank * minor fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/helper/chains.json | 1 + projects/helper/env.js | 5 +++++ projects/lineabank/index.js | 11 +++++++++++ 3 files changed, 17 insertions(+) create mode 100644 projects/lineabank/index.js diff --git a/projects/helper/chains.json b/projects/helper/chains.json index dcbb5a21f9b..7c655105ba9 100644 --- a/projects/helper/chains.json +++ b/projects/helper/chains.json @@ -107,6 +107,7 @@ "lamden", "lbry", "libre", + "linea", "liquidchain", "litecoin", "loop", diff --git a/projects/helper/env.js b/projects/helper/env.js index 1517ef24cf8..9b13bdebfac 100644 --- a/projects/helper/env.js +++ b/projects/helper/env.js @@ -9,6 +9,7 @@ const DEFAULTS = { APTOS_RPC: 'https://aptos-mainnet.pontem.network', SUI_RPC: 'https://fullnode.mainnet.sui.io/', MULTIVERSX_RPC: 'https://api.multiversx.com', + LINEA_RPC: 'https://linea.rpc.thirdweb.com', } const ENV_KEYS = [ @@ -19,6 +20,10 @@ const ENV_KEYS = [ 'OLYMPUS_GRAPH_API_KEY', ] +Object.keys(DEFAULTS).forEach(i => { + if (!process.env[i]) process.env[i] = DEFAULTS[i] // this is done to set the chain RPC details in @defillama/sdk +}) + function getEnv(key) { if (!ENV_KEYS.includes(key)) throw new Error(`Unknown env key: ${key}`) diff --git a/projects/lineabank/index.js b/projects/lineabank/index.js new file mode 100644 index 00000000000..07b1a9be0e8 --- /dev/null +++ b/projects/lineabank/index.js @@ -0,0 +1,11 @@ +const { compoundExports2 } = require("../helper/compound"); + +module.exports = { + linea: compoundExports2({ + comptroller: "0x009a0b7C38B542208936F1179151CD08E2943833", + abis: { + getAllMarkets: "address[]:allMarkets", + totalBorrows: "uint256:totalBorrow", + }, + }), +}; From 64131d7b807bc37bcea6faed7ac2121491c728b9 Mon Sep 17 00:00:00 2001 From: "3.141592653589793238462643383279" Date: Wed, 19 Jul 2023 17:17:15 +0700 Subject: [PATCH 0415/1974] fix: update market id and add borrow info (#6842) --- projects/scallop/index.js | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/projects/scallop/index.js b/projects/scallop/index.js index eb67fce7572..5d7ad92a46e 100644 --- a/projects/scallop/index.js +++ b/projects/scallop/index.js @@ -12,7 +12,7 @@ const SCALLOP_PROGRAM_ID = new PublicKey("SCPv1LabixHirZbX6s7Zj3oiBogadWZvGUKRvX const COUPON_SEED = "coupon_seed"; const POOL_AUTHORITY = "pool_authority_seed"; -const SCALLOP_SUI_MARKET_ID = "0xcdd65d04519aea065fdbd15315ab75ff41a65a4a39fd71e107dffc4a06c02f32" +const SCALLOP_SUI_MARKET_ID = "0xa757975255146dc9686aa823b7838b507f315d704f428cbadad2f4ea061939d9" function getTokenGeckoId(mintAuthority) { for (let i = 0; i < activePoolBases.length; i++) { @@ -58,19 +58,36 @@ async function solanaTvl() { return balances; } +async function suiBorrowed() { + const { api } = arguments[3] + const object = await sui.getObject(SCALLOP_SUI_MARKET_ID) + + const balanceSheetsFields = await sui.getDynamicFieldObjects({ + parent: object.fields.vault.fields.balance_sheets.fields.table.fields.id.id, + }); + + const balanceSheets = await sui.getObjects(balanceSheetsFields.map((e) => e.fields.id.id)) + + balanceSheets.forEach((e) => { + const coinType = '0x' + e.fields.name.fields.name + const amount = new BigNumber(e.fields.value.fields.debt).toString() + api.add(coinType, amount) + }) +} + async function suiTvl() { const { api } = arguments[3] const object = await sui.getObject(SCALLOP_SUI_MARKET_ID) const balanceSheetsFields = await sui.getDynamicFieldObjects({ - parent: object.fields.vault.fields.balance_sheets.fields.table.fields.id.id, - }); + parent: object.fields.vault.fields.balance_sheets.fields.table.fields.id.id, + }); const balanceSheets = await sui.getObjects(balanceSheetsFields.map((e) => e.fields.id.id)) - + balanceSheets.forEach((e) => { const coinType = '0x' + e.fields.name.fields.name - const amount = new BigNumber(e.fields.value.fields.cash).plus(new BigNumber(e.fields.value.fields.debt)).toString() + const amount = new BigNumber(e.fields.value.fields.cash).toString() api.add(coinType, amount) }) @@ -93,5 +110,6 @@ module.exports = { }, sui: { tvl: suiTvl, + borrowed: suiBorrowed, }, } \ No newline at end of file From 3579276f6ee49fa9d862527bc12224f19c6c6d56 Mon Sep 17 00:00:00 2001 From: define Date: Wed, 19 Jul 2023 13:27:35 +0100 Subject: [PATCH 0416/1974] beamex adapter --- projects/beamex/index.js | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 projects/beamex/index.js diff --git a/projects/beamex/index.js b/projects/beamex/index.js new file mode 100644 index 00000000000..5fa70476e30 --- /dev/null +++ b/projects/beamex/index.js @@ -0,0 +1,7 @@ +const { gmxExports } = require('../helper/gmx') + +module.exports = { + moonbeam: { + tvl: gmxExports({ vault: '0x73197B461eA369b36d5ee96A1C9f090Ef512be21', }) + }, +} \ No newline at end of file From ba595dae68e67af6f2e9fc4e1439bd040d8014d6 Mon Sep 17 00:00:00 2001 From: vladjito <95035799+vladjito@users.noreply.github.com> Date: Wed, 19 Jul 2023 16:00:39 +0300 Subject: [PATCH 0417/1974] Update index.js (#6843) We have switched our fiat equivalents from EUR to USD in our dApp, so previous modifications are obsolete now. Returned index.js to its initial state. --- projects/concordex-io/index.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/projects/concordex-io/index.js b/projects/concordex-io/index.js index 7ae0fc91eeb..39ab729a2a7 100644 --- a/projects/concordex-io/index.js +++ b/projects/concordex-io/index.js @@ -1,11 +1,10 @@ -const { post, get } = require('../helper/http') +const { post } = require('../helper/http') async function tvl(_, _b, _cb, { api, }) { const body = {"jsonrpc":"2.0","method":"liquidity_pools_list","params":{"filter":{"sort":"EFFECTIVE_TVL","page":1,"is_desc":true,"search":"","limit":999}},"id":0} const { result: { pools }} = await post('https://cdex-liquidity-pool.concordex.io/v1/rpc', body) - const { rates } = await get('https://open.er-api.com/v6/latest/EUR'); return { - tether: pools.reduce((acc, i) => acc + +i.tvl, 0) * rates['USD'] + tether: pools.reduce((acc, i) => acc + +i.tvl, 0) } } @@ -13,4 +12,4 @@ module.exports = { misrepresentedTokens: true, timetravel: false, concordium: { tvl }, -} \ No newline at end of file +} From f42b5e5aefa3f2c40eefa2ad3dfee0c5b54a02e7 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 19 Jul 2023 18:31:34 +0530 Subject: [PATCH 0418/1974] Revert "Update index.js (#6843)" (#6848) This reverts commit ba595dae68e67af6f2e9fc4e1439bd040d8014d6. --- projects/concordex-io/index.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/projects/concordex-io/index.js b/projects/concordex-io/index.js index 39ab729a2a7..7ae0fc91eeb 100644 --- a/projects/concordex-io/index.js +++ b/projects/concordex-io/index.js @@ -1,10 +1,11 @@ -const { post } = require('../helper/http') +const { post, get } = require('../helper/http') async function tvl(_, _b, _cb, { api, }) { const body = {"jsonrpc":"2.0","method":"liquidity_pools_list","params":{"filter":{"sort":"EFFECTIVE_TVL","page":1,"is_desc":true,"search":"","limit":999}},"id":0} const { result: { pools }} = await post('https://cdex-liquidity-pool.concordex.io/v1/rpc', body) + const { rates } = await get('https://open.er-api.com/v6/latest/EUR'); return { - tether: pools.reduce((acc, i) => acc + +i.tvl, 0) + tether: pools.reduce((acc, i) => acc + +i.tvl, 0) * rates['USD'] } } @@ -12,4 +13,4 @@ module.exports = { misrepresentedTokens: true, timetravel: false, concordium: { tvl }, -} +} \ No newline at end of file From af8d97280ca1431736b3d57f8e68442e26231d00 Mon Sep 17 00:00:00 2001 From: ezoia-com <53337996+ezoia-com@users.noreply.github.com> Date: Wed, 19 Jul 2023 21:04:48 +0800 Subject: [PATCH 0419/1974] Added stMatic vault on Polygon_zkEVM chain (#6850) --- projects/thetanuts/index.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/projects/thetanuts/index.js b/projects/thetanuts/index.js index e5104acef5d..0e32d6ffc4d 100644 --- a/projects/thetanuts/index.js +++ b/projects/thetanuts/index.js @@ -70,6 +70,9 @@ const bobaPutVault = '0xff5fe7909fc4d0d6643f1e8be8cba72610d0b485' //Arbitrum Vaults const arbCallVault = '0x0833EC3262Dcc417D88f85Ed5E1EBAf768080f41' +//zkEVM vaults +const stMaticCallVault = '0x7bF3c7C23501EA3E09B237D6F8AdcB7Ea3CeF41C' + // Ethereum Assets const weth = ADDRESSES.ethereum.WETH const usdc = ADDRESSES.ethereum.USDC @@ -110,6 +113,9 @@ const bobaUSDC = ADDRESSES.boba.USDC // Arbitrum assets let arb = '0x912ce59144191c1204e64559fe8253a0e49e6548' +// zkEVM assets +const stMatic = '0x83b874c1e09D316059d929da402dcB1A98e92082'; + module.exports = { methodology: `Only the funds deposited by the users into our vaults are calculated as TVL.`, hallmarks: [ @@ -199,6 +205,11 @@ const config = { [near, nearCallVault,], ] }, + polygon_zkevm: { + tokensAndOwners: [ + [stMatic, stMaticCallVault,], + ] + } } Object.keys(config).forEach(chain => { From 1db949b1662bfd0adbf69bde20c37ee1e45c034d Mon Sep 17 00:00:00 2001 From: Michael Semin Date: Wed, 19 Jul 2023 21:09:05 +0800 Subject: [PATCH 0420/1974] Add ReHold V2 (#6846) * added avax to rehold * try to fix covalent * added arbitrum & fantom to rehold * added optimism to rehold * removed fantom from rehold * added rehold v2 * rehold: re-add fantom --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/rehold-v2/index.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 projects/rehold-v2/index.js diff --git a/projects/rehold-v2/index.js b/projects/rehold-v2/index.js new file mode 100644 index 00000000000..8b5fb1aa287 --- /dev/null +++ b/projects/rehold-v2/index.js @@ -0,0 +1,23 @@ +const { sumTokens2 } = require('../helper/unwrapLPs') +const { covalentGetTokens } = require('../helper/http') + +const VAULT_V2 = '0xde6b4964c4384bcdfa150a4a8be9865c5b91e29c'; + +async function tvl(_, _b, _cb, { api, }) { + const tokens = await covalentGetTokens(VAULT_V2, api.chain) + + return sumTokens2({ + api, + owner: VAULT_V2, + tokens, + blacklistedTokens: ['0x594f9274e08ba6c5760bacfba795b1879af17255'], + }); +} + +module.exports = { + bsc: { tvl }, + polygon: { tvl }, + avax: { tvl }, + arbitrum: { tvl }, + optimism: { tvl }, +}; From 365c8939c648a0624d5cec65a75dc8647e7b0035 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 19 Jul 2023 18:47:00 +0530 Subject: [PATCH 0421/1974] Symbiosis (#6851) * feat: symbiosis adds mantle and linea chains * minor fix --------- Co-authored-by: allush --- projects/helper/coreAssets.json | 6 +++++- projects/symbiosis-finance/config.js | 18 ++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index a839b81b1c7..c4a13c6d186 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -1335,6 +1335,10 @@ "mantle": { "WMNT": "0x78c1b0c915c4faa5fffa6cabf0219da63d7f4cb8", "WETH": "0xdeaddeaddeaddeaddeaddeaddeaddeaddead1111", - "USDT": "0x201eba5cc46d216ce6dc03f6a759e8e766e956ae" + "USDT": "0x201eba5cc46d216ce6dc03f6a759e8e766e956ae", + "USDC": "0x09Bc4E0D864854c6aFB6eB9A9cdF58aC190D0dF9" + }, + "linea": { + "WETH": "0xe5D7C2a44FfDDf6b295A15c148167daaAf5Cf34f" } } diff --git a/projects/symbiosis-finance/config.js b/projects/symbiosis-finance/config.js index c04f4108f17..d344a09f57a 100644 --- a/projects/symbiosis-finance/config.js +++ b/projects/symbiosis-finance/config.js @@ -165,5 +165,23 @@ module.exports = { '0x292fC50e4eB66C3f6514b9E402dBc25961824D62', // portal v2 ] }, + { + name: 'mantle', + tokens: [ + ADDRESSES.mantle.USDC, + ], + holders: [ + '0x292fC50e4eB66C3f6514b9E402dBc25961824D62', // portal v2 + ] + }, + { + name: 'linea', + tokens: [ + ADDRESSES.linea.WETH, + ], + holders: [ + '0x292fC50e4eB66C3f6514b9E402dBc25961824D62', // portal v2 + ] + }, ] } \ No newline at end of file From 204f5019a94ef34d30d14cb0cb7df6e919b2c9f1 Mon Sep 17 00:00:00 2001 From: barbat0x Date: Wed, 19 Jul 2023 16:01:34 +0200 Subject: [PATCH 0422/1974] add Antfarm finance DAO treasury --- projects/treasury/antfarm_finance.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 projects/treasury/antfarm_finance.js diff --git a/projects/treasury/antfarm_finance.js b/projects/treasury/antfarm_finance.js new file mode 100644 index 00000000000..451b4119fee --- /dev/null +++ b/projects/treasury/antfarm_finance.js @@ -0,0 +1,13 @@ +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const daoTreasury = "0x529C78Ee582e4293a20Ab60c848506eADd8723D8"; +const ATF = "0x518b63Da813D46556FEa041A88b52e3CAa8C16a8"; +const AGT = "0x0BF43350076F95e0d16120b4D6bdfA1C9D50BDBD"; + +module.exports = treasuryExports({ + ethereum: { + tokens: [nullAddress, ATF, AGT], + owners: [daoTreasury], + ownTokens: [ATF, AGT], + }, +}); From 43a1d312aacbf7864382a318ace9741899a73296 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 19 Jul 2023 16:18:50 +0200 Subject: [PATCH 0423/1974] fix bitgert issue --- package-lock.json | 12 ++++++------ projects/helper/env.js | 1 + 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index 47af3ebb4bc..95a6310852c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -63,9 +63,9 @@ } }, "node_modules/@defillama/sdk": { - "version": "4.0.38", - "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.38.tgz", - "integrity": "sha512-eZUQwJqR5VNR0BgSL2Z/kmjf7VBd+Ggazs5KSbfDM4xcUm3pyEHcnkia6VlSikyzMk2OsbuKIrJGX47Ys/EZkA==", + "version": "4.0.40", + "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.40.tgz", + "integrity": "sha512-HlAR2LjWINdTkn2mg9hTTFgWoCnmY2Z5tTjZG4urMwJO1OA/BbBqzv7Cz9oSLnlgNUOalAp1oQNDeS0/abSKPg==", "dependencies": { "@supercharge/promise-pool": "^2.1.0", "ethers": "^5.4.5", @@ -4194,9 +4194,9 @@ } }, "@defillama/sdk": { - "version": "4.0.38", - "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.38.tgz", - "integrity": "sha512-eZUQwJqR5VNR0BgSL2Z/kmjf7VBd+Ggazs5KSbfDM4xcUm3pyEHcnkia6VlSikyzMk2OsbuKIrJGX47Ys/EZkA==", + "version": "4.0.40", + "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.40.tgz", + "integrity": "sha512-HlAR2LjWINdTkn2mg9hTTFgWoCnmY2Z5tTjZG4urMwJO1OA/BbBqzv7Cz9oSLnlgNUOalAp1oQNDeS0/abSKPg==", "requires": { "@supercharge/promise-pool": "^2.1.0", "ethers": "^5.4.5", diff --git a/projects/helper/env.js b/projects/helper/env.js index 9b13bdebfac..e51ee55fad9 100644 --- a/projects/helper/env.js +++ b/projects/helper/env.js @@ -9,6 +9,7 @@ const DEFAULTS = { APTOS_RPC: 'https://aptos-mainnet.pontem.network', SUI_RPC: 'https://fullnode.mainnet.sui.io/', MULTIVERSX_RPC: 'https://api.multiversx.com', + BITGERT_RPC: 'https://rpc.icecreamswap.com', LINEA_RPC: 'https://linea.rpc.thirdweb.com', } From 0ba516933f15995d8fa2d987d9ef1ee3ecab794b Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 19 Jul 2023 16:23:53 +0200 Subject: [PATCH 0424/1974] revert change --- projects/helper/env.js | 1 - 1 file changed, 1 deletion(-) diff --git a/projects/helper/env.js b/projects/helper/env.js index e51ee55fad9..9b13bdebfac 100644 --- a/projects/helper/env.js +++ b/projects/helper/env.js @@ -9,7 +9,6 @@ const DEFAULTS = { APTOS_RPC: 'https://aptos-mainnet.pontem.network', SUI_RPC: 'https://fullnode.mainnet.sui.io/', MULTIVERSX_RPC: 'https://api.multiversx.com', - BITGERT_RPC: 'https://rpc.icecreamswap.com', LINEA_RPC: 'https://linea.rpc.thirdweb.com', } From 0c6468e7144b807fe191dc5c6a16fd319eff8459 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 19 Jul 2023 16:40:28 +0200 Subject: [PATCH 0425/1974] pancakeswap: track linea --- projects/pancake-swap/index.js | 7 +++++-- projects/pancakeswap-v3/index.js | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/projects/pancake-swap/index.js b/projects/pancake-swap/index.js index 1ce33bfabd8..86432fa0756 100644 --- a/projects/pancake-swap/index.js +++ b/projects/pancake-swap/index.js @@ -80,10 +80,13 @@ module.exports = { }, ethereum: { staking: stakings(["0x556B9306565093C855AEA9AE92A594704c2Cd59e"], "0x152649ea73beab28c5b49b26eb48f7ead6d4c898", "ethereum"), - tvl: getUniTVL({ chain: 'ethereum', factory: '0x1097053Fd2ea711dad45caCcc45EfF7548fCB362', useDefaultCoreAssets: true, }) + tvl: getUniTVL({ factory: '0x1097053Fd2ea711dad45caCcc45EfF7548fCB362', useDefaultCoreAssets: true, }) }, polygon_zkevm: { - tvl: getUniTVL({ chain: 'polygon_zkevm', factory: '0x02a84c1b3BBD7401a5f7fa98a384EBC70bB5749E', useDefaultCoreAssets: true, }) + tvl: getUniTVL({ factory: '0x02a84c1b3BBD7401a5f7fa98a384EBC70bB5749E', useDefaultCoreAssets: true, }) + }, + linea: { + tvl: getUniTVL({ factory: '0x02a84c1b3BBD7401a5f7fa98a384EBC70bB5749E', useDefaultCoreAssets: true, }) }, aptos: dexExport({ account: '0xc7efb4076dbe143cbcd98cfaaa929ecfc8f299203dfff63b95ccb6bfe19850fa', diff --git a/projects/pancakeswap-v3/index.js b/projects/pancakeswap-v3/index.js index 91906c7488b..b266175edf2 100644 --- a/projects/pancakeswap-v3/index.js +++ b/projects/pancakeswap-v3/index.js @@ -11,4 +11,5 @@ module.exports = uniV3Export({ ] }, ethereum: { factory: '0x0bfbcf9fa4f9c56b0f40a671ad40e0805a091865', fromBlock: 16950685, }, polygon_zkevm: { factory: '0x0BFbCF9fa4f9C56B0F40a671Ad40E0805A091865', fromBlock: 750148, }, + linea: { factory: '0x0BFbCF9fa4f9C56B0F40a671Ad40E0805A091865', fromBlock: 1444, }, }) From 8ff47659d731070f4e68d062629c96492e1fc5da Mon Sep 17 00:00:00 2001 From: SwirlLend <139681025+SwirlLend@users.noreply.github.com> Date: Thu, 20 Jul 2023 02:29:51 +0800 Subject: [PATCH 0426/1974] Add Swirllend on Linea (#6854) * Add Swirllend on Linea * minor fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/lineabank/index.js | 1 + projects/swirllend/index.js | 9 +++++++++ 2 files changed, 10 insertions(+) create mode 100644 projects/swirllend/index.js diff --git a/projects/lineabank/index.js b/projects/lineabank/index.js index 07b1a9be0e8..90636a7dda7 100644 --- a/projects/lineabank/index.js +++ b/projects/lineabank/index.js @@ -3,6 +3,7 @@ const { compoundExports2 } = require("../helper/compound"); module.exports = { linea: compoundExports2({ comptroller: "0x009a0b7C38B542208936F1179151CD08E2943833", + fetchBalances: true, abis: { getAllMarkets: "address[]:allMarkets", totalBorrows: "uint256:totalBorrow", diff --git a/projects/swirllend/index.js b/projects/swirllend/index.js new file mode 100644 index 00000000000..bb0102d3189 --- /dev/null +++ b/projects/swirllend/index.js @@ -0,0 +1,9 @@ +const { compoundExports2 } = require("../helper/compound"); + +module.exports = { + linea: compoundExports2({ + comptroller: "0xcAABf6Ffb76634183254B0a4a3D5fb36180FdAE4", + fetchBalances: true, + cether: '0x91067b912f89dfca50c3f5529dbeb78b63c6a2e5', + }), +}; From 39ae030e55a8e906a01e27ea8ed1ef1888a2e07a Mon Sep 17 00:00:00 2001 From: kev1n-peters <96065607+kev1n-peters@users.noreply.github.com> Date: Wed, 19 Jul 2023 13:30:16 -0500 Subject: [PATCH 0427/1974] Updated wormhole.js (#6855) --- projects/wormhole.js | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/projects/wormhole.js b/projects/wormhole.js index dec8e7aee40..803081be60e 100644 --- a/projects/wormhole.js +++ b/projects/wormhole.js @@ -1,6 +1,6 @@ const { get } = require('./helper/http') const BigNumber = require("bignumber.js"); -const url = 'https://europe-west3-wormhole-315720.cloudfunctions.net/mainnet-notionaltvl' +const url = 'https://europe-west3-wormhole-message-db-mainnet.cloudfunctions.net/tvl' let _response function fetch(chainId) { @@ -25,9 +25,6 @@ module.exports = { ethereum: { fetch: fetch("2") }, - aptos: { - fetch: fetch("22") - }, terra: { fetch: fetch("3") }, @@ -56,7 +53,7 @@ module.exports = { fetch: fetch("11") }, acala: { - fetch: fetch("12") + fetch: fetch("12") }, klaytn: { fetch: fetch("13") @@ -73,9 +70,30 @@ module.exports = { terra2: { fetch: fetch("18") }, + injective: { + fetch: fetch("19") + }, + sui: { + fetch: fetch("21") + }, + aptos: { + fetch: fetch("22") + }, + arbitrum: { + fetch: fetch("23") + }, + optimism: { + fetch: fetch("24") + }, + xpla: { + fetch: fetch("28") + }, + base: { + fetch: fetch("30") + }, fetch: fetch("*"), - hallmarks:[ + hallmarks: [ [1652008803, "UST depeg"], - [Math.floor(new Date('2022-02-02')/1e3), 'Hacked: Signature Exploit'], + [Math.floor(new Date('2022-02-02') / 1e3), 'Hacked: Signature Exploit'], ], } From 14e9ab393a5c298591e279946830442a82c6a2d6 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 19 Jul 2023 21:00:57 +0200 Subject: [PATCH 0428/1974] track mantleswap.org --- projects/mantleswap/index.js | 30 ++++++++++++++++++++++++++++++ projects/timeswap-v2/index.js | 1 - 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 projects/mantleswap/index.js diff --git a/projects/mantleswap/index.js b/projects/mantleswap/index.js new file mode 100644 index 00000000000..587f2f200a1 --- /dev/null +++ b/projects/mantleswap/index.js @@ -0,0 +1,30 @@ +const { getLogs } = require('../helper/cache/getLogs') +const { transformDexBalances } = require('../helper/portedTokens') + + +module.exports = { + misrepresentedTokens: true, + mantle: { + tvl + } +} + +async function tvl(_, _b, _cb, { api, }) { + const logs = await getLogs({ + api, + target: '0x5c84e5d27fc7575D002fe98c5A1791Ac3ce6fD2f', + topics: ['0x0d3648bd0f6ba80134a33ba9275ac585d9d315f0ad8355cddefde31afa28d0e9'], + eventAbi: 'event PairCreated(address indexed token0, address indexed token1, address pair, uint256 )', + onlyArgs: true, + fromBlock: 5964, + }) + const tok0Bals = await api.multiCall({ abi: 'erc20:balanceOf', calls: logs.map(i => ({ target: i.token0, params: i.pair}))}) + const tok1Bals = await api.multiCall({ abi: 'erc20:balanceOf', calls: logs.map(i => ({ target: i.token1, params: i.pair}))}) + return transformDexBalances({ chain: api.chain, data: logs.map((log, i) => ({ + token0: log.token0, + token0Bal: tok0Bals[i], + token1: log.token1, + token1Bal: tok1Bals[i], + }))}) + +} \ No newline at end of file diff --git a/projects/timeswap-v2/index.js b/projects/timeswap-v2/index.js index ba1328dcc75..3ec474d73de 100644 --- a/projects/timeswap-v2/index.js +++ b/projects/timeswap-v2/index.js @@ -12,7 +12,6 @@ async function tvl(_, _b, _cb, { api }) { ], fromBlock, }); - const block = await api.getBlock(); let ownerTokens = logs.map((i) => { return [ From 99c980626838a44d76a87eaf115a085670e3ee68 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 19 Jul 2023 21:18:05 +0200 Subject: [PATCH 0429/1974] syncswap: track linea --- projects/syncswap/index.js | 40 ++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/projects/syncswap/index.js b/projects/syncswap/index.js index 214956024ed..8b76cdcb786 100644 --- a/projects/syncswap/index.js +++ b/projects/syncswap/index.js @@ -1,22 +1,11 @@ const { getLogs } = require('../helper/cache/getLogs') const { transformDexBalances } = require('../helper/portedTokens') const sdk = require('@defillama/sdk') -const vault = '0x621425a1Ef6abE91058E9712575dcc4258F8d091' - -async function getFactoryLogs(api, factory) { - return getLogs({ - api, - target: factory, - fromBlock: 9775, - topic: 'PoolCreated(address,address,address)', - eventAbi: 'event PoolCreated(address indexed token0, address indexed token1, address pool)', - onlyArgs: true, - }) -} async function tvl(timestamp, ethBlock, chainBlocks, { api }) { - const stableLogs = await getFactoryLogs(api, '0x5b9f21d407F35b10CbfDDca17D5D84b129356ea3') - const classicLogs = await getFactoryLogs(api, '0xf2DAd89f2788a8CD54625C60b55cD3d2D0ACa7Cb') + const { fromBlock, stableFactory, classicFactory, } = config[api.chain] + const stableLogs = await getFactoryLogs(api, stableFactory) + const classicLogs = await getFactoryLogs(api, classicFactory) const balances = {} const data = [] const stableReserves = await api.multiCall({ abi: 'function getReserves() external view returns (uint, uint)', calls: stableLogs.map(i => i.pool) }) @@ -28,10 +17,27 @@ async function tvl(timestamp, ethBlock, chainBlocks, { api }) { classicReserves.forEach(([token0Bal, token1Bal], i) => { data.push({ token0Bal, token1Bal, token0: classicLogs[i].token0, token1: classicLogs[i].token1, }) }) - return transformDexBalances({ balances, data, chain: 'era' }) + return transformDexBalances({ balances, data, chain: api.chain }) + + async function getFactoryLogs(api, factory) { + return getLogs({ + api, + target: factory, + fromBlock, + topic: 'PoolCreated(address,address,address)', + eventAbi: 'event PoolCreated(address indexed token0, address indexed token1, address pool)', + onlyArgs: true, + }) + } +} + +const config = { + era: { fromBlock: 9775, stableFactory: '0x5b9f21d407F35b10CbfDDca17D5D84b129356ea3', classicFactory: '0xf2DAd89f2788a8CD54625C60b55cD3d2D0ACa7Cb', }, + linea: { fromBlock: 716, stableFactory: '0xE4CF807E351b56720B17A59094179e7Ed9dD3727', classicFactory: '0x37BAc764494c8db4e54BDE72f6965beA9fa0AC2d', }, } module.exports = { misrepresentedTokens: true, - era: { tvl, } -} \ No newline at end of file +} + +Object.keys(config).forEach(chain => { module.exports[chain] = { tvl } }) From 1079814b6735e012988799da251eb50bdc86716a Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 19 Jul 2023 21:27:51 +0200 Subject: [PATCH 0430/1974] track https://app.horizondex.io/pool/ --- projects/horizondex/index.js | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 projects/horizondex/index.js diff --git a/projects/horizondex/index.js b/projects/horizondex/index.js new file mode 100644 index 00000000000..1b26ea1d436 --- /dev/null +++ b/projects/horizondex/index.js @@ -0,0 +1,8 @@ +const { uniV3Export } = require("../helper/uniswapV3"); + +module.exports = uniV3Export({ + linea: { + factory: "0x9Fe607e5dCd0Ea318dBB4D8a7B04fa553d6cB2c5", + fromBlock: 1150, + }, +}); \ No newline at end of file From 72811e183128a3e3c34dc8f889833f569fcb0913 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 19 Jul 2023 21:34:12 +0200 Subject: [PATCH 0431/1974] leetswap: track linea --- projects/leetswap/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/leetswap/index.js b/projects/leetswap/index.js index 3eecf3a37af..9a89cb1dcd9 100644 --- a/projects/leetswap/index.js +++ b/projects/leetswap/index.js @@ -4,4 +4,5 @@ module.exports = { misrepresentedTokens: true, polygon_zkevm: { tvl: getUniTVL({ factory: '0xcE87E0960f4e2702f4bFFE277655E993Ae720e84', useDefaultCoreAssets: true, }), }, canto: { tvl: getUniTVL({ factory: '0x116e8a41E8B0A5A87058AF110C0Ddd55a0ed82B7', useDefaultCoreAssets: true, }), }, + linea: { tvl: getUniTVL({ factory: '0x4DDf0fa98B5f9Bd7Cb0645c25bA89A574fe9Be8c', useDefaultCoreAssets: true, }), }, } From 2674751a1d7b8eadec62f3c0162fd69ca8aa43d5 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 19 Jul 2023 21:50:11 +0200 Subject: [PATCH 0432/1974] track https://www.echodex.io --- projects/echodex/index.js | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 projects/echodex/index.js diff --git a/projects/echodex/index.js b/projects/echodex/index.js new file mode 100644 index 00000000000..47eec9b7c35 --- /dev/null +++ b/projects/echodex/index.js @@ -0,0 +1,6 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports = { + misrepresentedTokens: true, + linea: { tvl: getUniTVL({ factory: '0x6D1063F2187442Cc9adbFAD2f55A96B846FCB399', useDefaultCoreAssets: true, fetchBalances: true }), }, +} From 11ba5066a1d6e7ed4170beb51a2ef806bb1ee0c1 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 19 Jul 2023 22:21:13 +0200 Subject: [PATCH 0433/1974] track icpswap.com --- projects/icpswap/index.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 projects/icpswap/index.js diff --git a/projects/icpswap/index.js b/projects/icpswap/index.js new file mode 100644 index 00000000000..245162d3f04 --- /dev/null +++ b/projects/icpswap/index.js @@ -0,0 +1,27 @@ + +const { get } = require('../helper/http') +const { toUSDTBalances } = require('../helper/balances') +const { PromisePool } = require('@supercharge/promise-pool') + +module.exports = { + misrepresentedTokens: true, + icp: { tvl }, +} + +async function tvl() { + let tvl = 0 + const pairs = await get('https://uvevg-iyaaa-aaaak-ac27q-cai.raw.ic0.app/pairs') + + const { errors } = await PromisePool.withConcurrency(15) + .for(pairs) + .process(async ({ pool_id }) => { + const res = await get(`https://uvevg-iyaaa-aaaak-ac27q-cai.raw.ic0.app/pool_tvl?poolId=${pool_id}&limit=1`) + if (res.length > 0) + tvl += +res[0].tvlUSD + }) + + if (errors && errors.length) + throw errors[0] + + return toUSDTBalances(tvl) +} From 9f0be9baa4ebdbb95d0893e542c513c3553f9b76 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Thu, 20 Jul 2023 07:10:16 +0100 Subject: [PATCH 0434/1974] set borrowed to 0 --- projects/agora/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/agora/index.js b/projects/agora/index.js index 79f5f2d85b4..540a04f77c5 100644 --- a/projects/agora/index.js +++ b/projects/agora/index.js @@ -61,6 +61,6 @@ module.exports = { methodology: `As in Compound Finance, TVL counts the tokens locked in the contracts to be used as collateral to borrow or to earn yield. Borrowed coins are counted as "Borrowed" TVL and can be toggled towards the regular TVL.`, metis: { tvl: sdk.util.sumChainTvls([chainTvl, agoraTvl, agoraPlusTvl, agoraFarmTvl, agoraStakeTvl]), - borrowed: sdk.util.sumChainTvls([agoraBorrowed, agoraPlusBorrowed, agoraFarmBorrowed, agoraStakeBorrowed]), + borrowed: ()=>({}), }, }; From 1585fc4ba6baaf02f74caa5f479125f4ecbbfea5 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 20 Jul 2023 09:10:22 +0200 Subject: [PATCH 0435/1974] cryptex: remove treasury --- projects/cryptex-finance/index.js | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/projects/cryptex-finance/index.js b/projects/cryptex-finance/index.js index ee8c6bf88cc..d427f3d248c 100755 --- a/projects/cryptex-finance/index.js +++ b/projects/cryptex-finance/index.js @@ -1,6 +1,5 @@ const { getLogs } = require('../helper/cache/getLogs') const ADDRESSES = require('../helper/coreAssets.json') -const sdk = require("@defillama/sdk"); const { sumTokensSharedOwners, sumTokens2 } = require("../helper/unwrapLPs"); const { staking } = require('../helper/staking') @@ -61,40 +60,18 @@ async function optTvl(timestamp, block, chainBlocks) { return balances; } -const treasuryAddress = "0xa54074b2cc0e96a43048d4a68472F7F046aC0DA8"; -const treasuryContents = [ - ADDRESSES.ethereum.USDC -] -const optTreasury = "0x271901c3268D0959bbc9543DE4f073D3708C88F7"; - -async function treasury(timestamp, block) { - let balances = {}; - const ethBal = (await sdk.api.eth.getBalance({ - target: treasuryAddress, - block, - })).output; - sdk.util.sumSingleBalance(balances, ADDRESSES.ethereum.WETH, ethBal); - await sumTokensSharedOwners(balances, treasuryContents, [treasuryAddress], block); - return balances; -} - - module.exports = { methodology: "TVL includes collateral in vaults", ethereum: { tvl: ethTvl, pool2: staking(ethStakingContracts, ethPool2s), staking: staking_, - treasury }, optimism: { tvl: optTvl } }; - - - async function staking_(_, _b, _cb, { api, }) { const logs = await getLogs({ api, From 0761831b4b4b52d59cac934198fcf352455ba099 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 20 Jul 2023 09:14:20 +0200 Subject: [PATCH 0436/1974] cryptex: refactor --- projects/cryptex-finance/index.js | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/projects/cryptex-finance/index.js b/projects/cryptex-finance/index.js index d427f3d248c..6b64a2ac244 100755 --- a/projects/cryptex-finance/index.js +++ b/projects/cryptex-finance/index.js @@ -1,7 +1,8 @@ const { getLogs } = require('../helper/cache/getLogs') const ADDRESSES = require('../helper/coreAssets.json') -const { sumTokensSharedOwners, sumTokens2 } = require("../helper/unwrapLPs"); +const { sumTokens2, sumTokensExport, } = require("../helper/unwrapLPs"); const { staking } = require('../helper/staking') +const { pool2 } = require('../helper/pool2') const ctxToken = "0x321c2fe4446c7c963dc41dd58879af648838f98d"; const factory = "0x70236b36f86AB4bd557Fe9934E1246537B472918"; @@ -48,27 +49,15 @@ const optCollaterals = [ "0x6fd9d7AD17242c41f7131d257212c54A0e816691" // UNI ] -async function ethTvl(timestamp, block) { - let balances = {}; - await sumTokensSharedOwners(balances, ethCollaterals, ethVaults, block); - return balances; -} - -async function optTvl(timestamp, block, chainBlocks) { - let balances = {}; - await sumTokensSharedOwners(balances, optCollaterals, optVaults, chainBlocks.optimism, "optimism"); - return balances; -} - module.exports = { methodology: "TVL includes collateral in vaults", ethereum: { - tvl: ethTvl, - pool2: staking(ethStakingContracts, ethPool2s), + tvl: sumTokensExport({ tokens: ethCollaterals, owners: ethVaults,}), + pool2: pool2(ethStakingContracts, ethPool2s), staking: staking_, }, optimism: { - tvl: optTvl + tvl: sumTokensExport({ tokens: optCollaterals, owners: optVaults,}) } }; From be4eb9cab164817b6776212bb26268ea9e4d6554 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 20 Jul 2023 12:33:49 +0200 Subject: [PATCH 0437/1974] fix broken adapters --- projects/atlantisloans/index.js | 13 ++++++++----- projects/xWeowns/index.js | 3 +-- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/projects/atlantisloans/index.js b/projects/atlantisloans/index.js index e1d5b18169d..59bdac93ff0 100644 --- a/projects/atlantisloans/index.js +++ b/projects/atlantisloans/index.js @@ -28,11 +28,14 @@ module.exports = { // ), tvl: async () => ({}), }, - polygon: compoundExports(polygonComptroller, - "polygon", - "0xa65722af4957cef481edb4cb255f804dd36e8adc", - ADDRESSES.polygon.WMATIC_2 - ), + // polygon: compoundExports(polygonComptroller, + // "polygon", + // "0xa65722af4957cef481edb4cb255f804dd36e8adc", + // ADDRESSES.polygon.WMATIC_2 + // ), + polygon: { + tvl: async () => ({}), + }, avax: compoundExports(avaxComptroller, "avax", "0x6bd2154fbc086cb43411966e0e72584196ccd065", diff --git a/projects/xWeowns/index.js b/projects/xWeowns/index.js index f65baa54996..a1a4736db23 100644 --- a/projects/xWeowns/index.js +++ b/projects/xWeowns/index.js @@ -21,8 +21,7 @@ async function tvl(timestamp, block, chainBlocks) { } module.exports = { - doublecounted: false, lachain: { - tvl + tvl: () => 0, } }; \ No newline at end of file From 306d0cf0c33c3554d56a479dc1366d8296bfe2a8 Mon Sep 17 00:00:00 2001 From: box25 Date: Thu, 20 Jul 2023 13:14:47 +0200 Subject: [PATCH 0438/1974] added Telos to IceCreamSwap (#6863) * added Telos to IceCreamSwap * minor fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/helper/tokenMapping.js | 3 +++ projects/icecreamswap/index.js | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 7da1b881fef..7f42e5e9bc2 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -48,6 +48,9 @@ const fixBalancesTokens = { ozone: { // '0x83048f0bf34feed8ced419455a4320a735a92e9d': { coingeckoId: "ozonechain", decimals: 18 }, // was mapped to wrong chain }, + telos: { + '0xdc2393dc10734bf153153038943a5deb42b209cd': { coingeckoId: "telos", decimals: 18 }, + } } ibcChains.forEach(chain => fixBalancesTokens[chain] = { ...ibcMappings, ...(fixBalancesTokens[chain] || {}) }) diff --git a/projects/icecreamswap/index.js b/projects/icecreamswap/index.js index 21d724c5522..17f13c17f26 100644 --- a/projects/icecreamswap/index.js +++ b/projects/icecreamswap/index.js @@ -32,4 +32,10 @@ module.exports = { useDefaultCoreAssets: true, }) }, + telos: { + tvl: getUniTVL({ + factory: '0x9E6d21E759A7A288b80eef94E4737D313D31c13f', + useDefaultCoreAssets: true, + }) + }, }; From 1231a34251b51c4095ac0431e7f1530eed9830dd Mon Sep 17 00:00:00 2001 From: Coco <120009255+Coaetlicanth@users.noreply.github.com> Date: Thu, 20 Jul 2023 19:15:59 +0800 Subject: [PATCH 0439/1974] add narwhal.finance trading vault tvl (#6862) --- projects/narwhal-finance/index.js | 46 +++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 projects/narwhal-finance/index.js diff --git a/projects/narwhal-finance/index.js b/projects/narwhal-finance/index.js new file mode 100644 index 00000000000..5bd89827211 --- /dev/null +++ b/projects/narwhal-finance/index.js @@ -0,0 +1,46 @@ +const coreAssets = require('../helper/coreAssets.json'); +const { sumTokens2 } = require('../helper/unwrapLPs'); + +const tokens = { + arbitrum: { + USDT: coreAssets.arbitrum.USDT, + }, + bsc: { + USDT: coreAssets.bsc.USDT, + }, +}; + +const narwhal = { + arbitrum: { + NarwhalTradingVault: '0x14559479DC1041Ef6565f44028D454F423d2b9E6', + }, + bsc: { + NarwhalTradingVault: '0x71AF984f825C7BEf79cAEE5De14565ca8A29Fe93', + }, +}; + +async function arbTvl() { + const tokensAndOwners = [ + [tokens.arbitrum.USDT, narwhal.arbitrum.NarwhalTradingVault], + ]; + return sumTokens2({ chain: "arbitrum", tokensAndOwners }); +} + +async function bscTvl() { + const tokensAndOwners = [ + [tokens.bsc.USDT, narwhal.bsc.NarwhalTradingVault], + ]; + return sumTokens2({ chain: "bsc", tokensAndOwners }); +} + +module.exports = { + hallmarks: [ + [1689034511, "Launch on Arbitrum & BSC"], + ], + arbitrum: { + tvl: arbTvl, + }, + bsc: { + tvl: bscTvl, + }, +}; From 84626716a9e48907f10ffa68a8b862510f0637e5 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 20 Jul 2023 13:18:35 +0200 Subject: [PATCH 0440/1974] code refactor --- projects/narwhal-finance/index.js | 53 ++++++++----------------------- 1 file changed, 13 insertions(+), 40 deletions(-) diff --git a/projects/narwhal-finance/index.js b/projects/narwhal-finance/index.js index 5bd89827211..20365454b9b 100644 --- a/projects/narwhal-finance/index.js +++ b/projects/narwhal-finance/index.js @@ -1,46 +1,19 @@ -const coreAssets = require('../helper/coreAssets.json'); -const { sumTokens2 } = require('../helper/unwrapLPs'); - -const tokens = { - arbitrum: { - USDT: coreAssets.arbitrum.USDT, - }, - bsc: { - USDT: coreAssets.bsc.USDT, - }, -}; - -const narwhal = { - arbitrum: { - NarwhalTradingVault: '0x14559479DC1041Ef6565f44028D454F423d2b9E6', - }, - bsc: { - NarwhalTradingVault: '0x71AF984f825C7BEf79cAEE5De14565ca8A29Fe93', - }, -}; - -async function arbTvl() { - const tokensAndOwners = [ - [tokens.arbitrum.USDT, narwhal.arbitrum.NarwhalTradingVault], - ]; - return sumTokens2({ chain: "arbitrum", tokensAndOwners }); -} - -async function bscTvl() { - const tokensAndOwners = [ - [tokens.bsc.USDT, narwhal.bsc.NarwhalTradingVault], - ]; - return sumTokens2({ chain: "bsc", tokensAndOwners }); -} +const { sumTokensExport } = require('../helper/unwrapLPs') +const ADDRESSES = require('../helper/coreAssets.json'); module.exports = { hallmarks: [ [1689034511, "Launch on Arbitrum & BSC"], ], - arbitrum: { - tvl: arbTvl, - }, - bsc: { - tvl: bscTvl, - }, }; + +const config = { + bsc: { owner: '0x71AF984f825C7BEf79cAEE5De14565ca8A29Fe93', tokens: [ADDRESSES.bsc.USDT,]}, + arbitrum: { owner: '0x14559479DC1041Ef6565f44028D454F423d2b9E6', tokens: [ADDRESSES.arbitrum.USDT,]}, +} + +Object.keys(config).forEach(chain => { + module.exports[chain] = { + tvl: sumTokensExport(config[chain]) + } +}) From 9ba84817a8db3a39a74c9f79ac609afd6efacbb2 Mon Sep 17 00:00:00 2001 From: LpcAries <101619245+LpcAries@users.noreply.github.com> Date: Thu, 20 Jul 2023 19:19:07 +0800 Subject: [PATCH 0441/1974] add linea config on izumi-iziswap (#6861) --- projects/izumi-iziswap/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/izumi-iziswap/index.js b/projects/izumi-iziswap/index.js index 90a5de8fd43..538de53bfd7 100644 --- a/projects/izumi-iziswap/index.js +++ b/projects/izumi-iziswap/index.js @@ -20,7 +20,8 @@ const poolHelpers = { 'mantle': ['0x611575eE1fbd4F7915D0eABCC518eD396fF78F0c'], 'ethereum': ['0x19b683A2F45012318d9B2aE1280d68d3eC54D663'], 'ontology_evm': ['0x110dE362cc436D7f54210f96b8C7652C2617887D'], - 'ultron' : ['0xcA7e21764CD8f7c1Ec40e651E25Da68AeD096037'] + 'ultron' : ['0xcA7e21764CD8f7c1Ec40e651E25Da68AeD096037'], + 'linea': ['0x1CB60033F61e4fc171c963f0d2d3F63Ece24319c'], } const blacklistedTokens = [ From 42145038a13813e08a46718ada226aaa75ad856a Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 20 Jul 2023 15:51:35 +0200 Subject: [PATCH 0442/1974] track https://aftermath.finance --- projects/aftermath-fi/index.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 projects/aftermath-fi/index.js diff --git a/projects/aftermath-fi/index.js b/projects/aftermath-fi/index.js new file mode 100644 index 00000000000..e2b4bbb4dcf --- /dev/null +++ b/projects/aftermath-fi/index.js @@ -0,0 +1,23 @@ +const sui = require("../helper/chain/sui"); + +const MAINNET_PROTOCOL_ID = + "0x0625dc2cd40aee3998a1d6620de8892964c15066e0a285d8b573910ed4c75d50"; + +async function tvl(_, _1, _2, { api }) { + const pools = await sui.queryEvents({ eventType: '0xefe170ec0be4d762196bedecd7a065816576198a6527c99282a2551aaa7da38c::events::CreatedPoolEvent', transform: i => i.pool_id}) + const poolData = await sui.getObjects(pools) + + for (const { fields: { type_names: tokens, normalized_balances: bals, decimal_scalars } } of poolData) { + bals.forEach((v, i) => { + if (/af_lp::AF_LP/.test(tokens[i])) return; + api.add('0x' + tokens[i], v / decimal_scalars[i]) + }) + } +} + +module.exports = { + timetravel: false, + sui: { + tvl, + }, +}; From ec5376097fd0849084392a46a65719a235dc962b Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 20 Jul 2023 19:39:14 +0530 Subject: [PATCH 0443/1974] Bella (#6866) * feat: Add Bella-LP-Farm tvl * code refactor --------- Co-authored-by: shjie047 --- projects/bella.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/projects/bella.js b/projects/bella.js index 7f5ee4b0d91..fb5e74d9e52 100644 --- a/projects/bella.js +++ b/projects/bella.js @@ -47,5 +47,22 @@ module.exports = { tvl, pool2, }, + era: { + pool2: async (_, _1, _2, { api }) => { + const pool2s = [ + '0x9FB6Ca27D20E569E5c8FeC359C9d33D468d2803C', + '0x3bd7a1D8c760d8be1bC57A3205cbFfBaDFB74D94' + ] + const infoABI = "function getMiningContractInfo() external view returns (address tokenX, address tokenY, uint24 fee_, address iziTokenAddr, uint256 lastTouchTime_, uint256 totalVLiquidity_, uint256 bal0, uint256 bal1, uint256 balIzi, uint256 startTime_, uint256 endTime_)" + + const data = await api.multiCall({ abi: infoABI, calls: pool2s }) + const transform = i => i.toLowerCase() === '0xb83cfb285fc8d936e8647fa9b1cc641dbaae92d9' ? 'ethereum:0xa91ac63d040deb1b7a5e4d4134ad23eb0ba07e14': 'era:'+i + for (const { tokenX, tokenY, iziTokenAddr, bal0, bal1, balIzi } of data) { + api.add(transform(tokenX), bal0, { skipChain: true}) + api.add(transform(tokenY), bal1, { skipChain: true}) + api.add(iziTokenAddr, balIzi) + } + }, + }, } From 70dcbd00df0ef146d1f543fe59265183fe5670d2 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 20 Jul 2023 17:33:52 +0200 Subject: [PATCH 0444/1974] track reax.one --- projects/reax-one-dex/index.js | 13 +++++++++++++ projects/reax-one-synth/index.js | 14 ++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 projects/reax-one-dex/index.js create mode 100644 projects/reax-one-synth/index.js diff --git a/projects/reax-one-dex/index.js b/projects/reax-one-dex/index.js new file mode 100644 index 00000000000..16bd3a0be4d --- /dev/null +++ b/projects/reax-one-dex/index.js @@ -0,0 +1,13 @@ +const { onChainTvl } = require('../helper/balancer') + +module.exports = { + mantle: { + tvl: onChainTvl('0x1AA7f1f5b51fe22478e683466232B5C8fc49407f', 10790, { + blacklistedTokens: [ + '0xf7dfe223e19701a514e78f3ce7ba98f2c5fbb5b2', + '0xa84bdecd44e6cee1c588a3c97fcc4482831fde05', + '0x62959ad021402f48d0d8067bc5c4c03f63fceaa4', + ] + }), + } +} diff --git a/projects/reax-one-synth/index.js b/projects/reax-one-synth/index.js new file mode 100644 index 00000000000..b2738990b29 --- /dev/null +++ b/projects/reax-one-synth/index.js @@ -0,0 +1,14 @@ +const { sumTokensExport } = require('../helper/unwrapLPs') + +module.exports = { + mantle: { + tvl: sumTokensExport({ + owner: '0x78B2fa94A94bF3E96fcF9CE965bed55bE49FA9E7', + tokens: [ + '0xdEAddEaDdeadDEadDEADDEAddEADDEAddead1111', + '0x201EBa5CC46D216Ce6DC03F6a759e8E766e956aE', + '0xCAbAE6f6Ea1ecaB08Ad02fE02ce9A44F09aebfA2', + ] + }), + } +} From f8959229cca440ca16efae89115fe4858b8d5d05 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 20 Jul 2023 18:14:09 +0200 Subject: [PATCH 0445/1974] minor fix --- projects/helper/coreAssets.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index c4a13c6d186..d382f539a77 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -1216,7 +1216,8 @@ "USDT": "USDT" }, "elrond": { - "WEGLD": "WEGLD-bd4d79" + "WEGLD": "WEGLD-bd4d79", + "USDC": "USDC-c76f1f" }, "bitindi": { "WBNI": "0x15E162205421dc3A47b15A1A740FbF5EAbB77921" From 3bd09d4b8241d46648934b7b55d7b268d9c71537 Mon Sep 17 00:00:00 2001 From: Ryan Holloway <110117008+raho11@users.noreply.github.com> Date: Thu, 20 Jul 2023 11:38:22 -0500 Subject: [PATCH 0446/1974] Update index.js (#6867) Add 'OP Rewards Start' for OP Governance Fund rewards on PoolTogether cc: https://pooltogether.mirror.xyz/aq9EttzDCwZ5iXp4MSQtdszzdrjnnIMQgr_qrR8To3Q --- projects/pooltogether/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/pooltogether/index.js b/projects/pooltogether/index.js index fc879665c7c..1392e6e813b 100644 --- a/projects/pooltogether/index.js +++ b/projects/pooltogether/index.js @@ -147,6 +147,7 @@ module.exports = { }, hallmarks:[ [1658872800, "OP Rewards Start"], + [1669615200, "OP Rewards Start"], ], methodology: `TVL is the total quantity of tokens locked in PoolTogether pools on Ethereum, Polygon, Avalanche, Optimism, Celo, and BSC` } From ff299bc84abeb2da14b4243453421494261a44bf Mon Sep 17 00:00:00 2001 From: gaspare100 Date: Thu, 20 Jul 2023 18:02:21 +0100 Subject: [PATCH 0447/1974] Add ATOM mare Pool (#6868) * New LPs 14/07 Scrub Invest * New Pool on Scrub Invest * add atom pool --------- Co-authored-by: theg --- projects/scrubinvest/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/scrubinvest/index.js b/projects/scrubinvest/index.js index 9ffe54bb090..b2eea9d54fb 100644 --- a/projects/scrubinvest/index.js +++ b/projects/scrubinvest/index.js @@ -36,6 +36,7 @@ async function tvl(_, _b, _cb, { api, }) { ['0x0B6c2a9d4d739778dF6cD1cf815754BD1438063c', '0x3CcA2C0d433E00433082ba16e968CA11dA6Dc156'], ['0x2f9e61D4E9A9A3694CcDc287c790EA5cc3302E88', '0x1504B9EDdD57Ed8252b3b3b407DdE27B72A80790'], ['0x350c4A0aC240755Bb6432FeB907eCAFbbBc75770', '0xC05021F3b3601BF33aB59dc75577B85985ACaab7'], + ['0x8E00102d96b34BEF29F3E1e0e5DBd0a611Cac312', '0x6d81FcA3abD89Bd89D400281aE5f1Ee0D62Cd16f'], // also count base assets if available ['0xfA9343C3897324496A05fC75abeD6bAC29f8A40f', '0xcd017B495DF1dE2DC8069b274e2ddfBB78561176'], ['0xB44a9B6905aF7c801311e8F4E76932ee959c663C', '0x88555c4d8e53ffB223aB5baDe0B5e6B2Cd3966c4'], From f622b9d50aef2e2d552b91a33ba25de77b053802 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 20 Jul 2023 21:14:24 +0200 Subject: [PATCH 0448/1974] helio: update vaults --- projects/helio-money/index.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/projects/helio-money/index.js b/projects/helio-money/index.js index accb969050e..2a5f63479f6 100644 --- a/projects/helio-money/index.js +++ b/projects/helio-money/index.js @@ -8,9 +8,19 @@ module.exports = { //[1670544000,"aBNBc to AnkrBNB swap & HAY buyback"] ], bsc: { - tvl: sumTokensExport({ owner: '0x25b21472c073095bebC681001Cbf165f849eEe5E', tokens: [ - '0x52F24a5e03aee338Da5fd9Df68D2b6FAe1178827', // ankrBNB - ADDRESSES.null, - ] }), + tvl: + sumTokensExport({ + tokensAndOwners: [ + //ankrBNB + ['0x52F24a5e03aee338Da5fd9Df68D2b6FAe1178827', '0x25b21472c073095bebC681001Cbf165f849eEe5E'], + [ADDRESSES.null, '0x25b21472c073095bebC681001Cbf165f849eEe5E'], + //stkBNB + ['0xc2E9d07F66A89c44062459A47a0D2Dc038E4fb16', '0x98CB81d921B8F5020983A46e96595471Ad4E60Be'], + //snBNB + ['0xB0b84D294e0C75A6abe60171b70edEb2EFd14A1B', '0x6F28FeC449dbd2056b76ac666350Af8773E03873'], + //BNBx + ['0x1bdd3Cf7F79cfB8EdbB955f20ad99211551BA275', '0x6ae7073d801a74eE753F19323DF320C8F5Fe2DbC'] + ] + }) } } From 4c2897539b8b8b677188348dc64d00045bf4f608 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 21 Jul 2023 01:09:12 +0530 Subject: [PATCH 0449/1974] Revert "Revert "Update index.js (#6843)" (#6848)" (#6849) This reverts commit f42b5e5aefa3f2c40eefa2ad3dfee0c5b54a02e7. --- projects/concordex-io/index.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/projects/concordex-io/index.js b/projects/concordex-io/index.js index 7ae0fc91eeb..39ab729a2a7 100644 --- a/projects/concordex-io/index.js +++ b/projects/concordex-io/index.js @@ -1,11 +1,10 @@ -const { post, get } = require('../helper/http') +const { post } = require('../helper/http') async function tvl(_, _b, _cb, { api, }) { const body = {"jsonrpc":"2.0","method":"liquidity_pools_list","params":{"filter":{"sort":"EFFECTIVE_TVL","page":1,"is_desc":true,"search":"","limit":999}},"id":0} const { result: { pools }} = await post('https://cdex-liquidity-pool.concordex.io/v1/rpc', body) - const { rates } = await get('https://open.er-api.com/v6/latest/EUR'); return { - tether: pools.reduce((acc, i) => acc + +i.tvl, 0) * rates['USD'] + tether: pools.reduce((acc, i) => acc + +i.tvl, 0) } } @@ -13,4 +12,4 @@ module.exports = { misrepresentedTokens: true, timetravel: false, concordium: { tvl }, -} \ No newline at end of file +} From ea2315b9fea1e1022862673e5cd23d54ee6d2d22 Mon Sep 17 00:00:00 2001 From: Zilch Capital <137987236+ZilchCapital@users.noreply.github.com> Date: Fri, 21 Jul 2023 05:27:54 +0800 Subject: [PATCH 0450/1974] Add Zilch Capital on zkSync (#6847) * Add Zilch Capital on zkSync * refactor code --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/zilch/abi.js | 90 +++++++++++++++++++++++++++++++++++++++++ projects/zilch/index.js | 22 ++++++++++ 2 files changed, 112 insertions(+) create mode 100644 projects/zilch/abi.js create mode 100644 projects/zilch/index.js diff --git a/projects/zilch/abi.js b/projects/zilch/abi.js new file mode 100644 index 00000000000..2f98db614d8 --- /dev/null +++ b/projects/zilch/abi.js @@ -0,0 +1,90 @@ +module.exports = { + poolLength: { + "inputs": [], + "name": "poolLength", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function", + "constant": true + }, + poolInfo: { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "poolInfo", + "outputs": [ + { + "internalType": "contract IAsset", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "baseAllocPoint", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastRewardTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "accZilchPerShare", + "type": "uint256" + }, + { + "internalType": "contract IRewarder", + "name": "rewarder", + "type": "address" + }, + { + "internalType": "uint256", + "name": "sumOfFactors", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "accZilchPerFactorShare", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "adjustedAllocPoint", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function", + "constant": true + }, + underlyingToken: { + "inputs": [], + "name": "underlyingToken", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function", + "constant": true + }, +} \ No newline at end of file diff --git a/projects/zilch/index.js b/projects/zilch/index.js new file mode 100644 index 00000000000..8a8e5e957c4 --- /dev/null +++ b/projects/zilch/index.js @@ -0,0 +1,22 @@ +const abi = require('./abi') +const { sumTokens2 } = require('../helper/unwrapLPs') +const farm = "0xa65D04f79633BeBdC4Dd785498269e8ABD6A1476" + +async function tvl(_, _b, _cb, { api }) { + const poolInfos = await api.fetchList({ lengthAbi: abi.poolLength, itemAbi: abi.poolInfo, target: farm }) + let pools = poolInfos.map(i => i.lpToken) + const stakingPools = pools.slice(0, 3) + pools = pools.slice(3) + const stakingTokens = await api.multiCall({ abi: abi.underlyingToken, calls: stakingPools }) + const tokens = await api.multiCall({ abi: 'address:want', calls: pools }) + const bals = await api.multiCall({ abi: 'uint256:balanceOf', calls: pools }) + api.addTokens(tokens, bals) + return sumTokens2({ api, tokensAndOwners2: [stakingTokens, stakingPools] }) +} + +module.exports = { + era: { + tvl, + } +} + From 5e5289eea1f7423b3141d10321bf6d80b5f1fdb8 Mon Sep 17 00:00:00 2001 From: LPX Date: Fri, 21 Jul 2023 06:31:59 +0900 Subject: [PATCH 0451/1974] add(revert-evmos) (#6872) --- projects/helper/coreAssets.json | 2 +- projects/helper/unwrapLPs.js | 1 + projects/revert-v3-staker/index.js | 3 +++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index d382f539a77..185647d0f86 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -257,7 +257,7 @@ "evmos": { "WEVMOS": "0xd4949664cd82660aae99bedc034a0dea8a0bd517", "STEVMOS": "0x2c68d1d6ab986ff4640b51e1f14c716a076e44c4", - "STATIM": "0xb5124fa2b2cf92b2d469b249433ba1c96bdf536d", + "STATOM": "0xb5124fa2b2cf92b2d469b249433ba1c96bdf536d", "ATOM": "0xc5e00d3b04563950941f7137b5afa3a534f0d6d6", "STRIDE": "0x8fa78ceb7f04118ec6d06aac37ca854691d8e963", "axlRETH": "0xe60ce2dfa6d4ad37ade1dcb7ac4d6c3a093b3a7e", diff --git a/projects/helper/unwrapLPs.js b/projects/helper/unwrapLPs.js index e862a01ad9b..9437f3a08ea 100644 --- a/projects/helper/unwrapLPs.js +++ b/projects/helper/unwrapLPs.js @@ -200,6 +200,7 @@ async function unwrapUniswapV3NFTs({ balances = {}, nftsAndOwners = [], block, c case 'optimism': case 'arbitrum': nftAddress = '0xC36442b4a4522E871399CD717aBDD847Ab11FE88'; break; case 'bsc': nftAddress = [PANCAKE_NFT_ADDRESS, '0x7b8a01b39d58278b5de7e48c8449c9f4f5170613']; break; + case 'evmos': nftAddress = '0x5fe5daaa011673289847da4f76d63246ddb2965d'; break; default: throw new Error('missing default uniswap nft address') } diff --git a/projects/revert-v3-staker/index.js b/projects/revert-v3-staker/index.js index ac1fca11372..9a0b4d58b52 100644 --- a/projects/revert-v3-staker/index.js +++ b/projects/revert-v3-staker/index.js @@ -3,6 +3,9 @@ const { unwrapUniswapV3NFTs } = require('../helper/unwrapLPs') const config = { polygon: { owners: ['0x8c696deF6Db3104DF72F7843730784460795659a'] + }, + evmos: { + owners: ['0x3eb0fffa1470cdd3725b9eb29aded2736144b078'] } } From f4f957d791ffcc4b2edddfe16c335b275d55ebed Mon Sep 17 00:00:00 2001 From: LaazyPotaato <97098805+LaazyPotaato@users.noreply.github.com> Date: Fri, 21 Jul 2023 03:03:08 +0530 Subject: [PATCH 0452/1974] Added crust-finance (#6871) --- projects/crust-finance/index.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 projects/crust-finance/index.js diff --git a/projects/crust-finance/index.js b/projects/crust-finance/index.js new file mode 100644 index 00000000000..0436be8a00b --- /dev/null +++ b/projects/crust-finance/index.js @@ -0,0 +1,13 @@ +const { getUniTVL } = require("../helper/unknownTokens"); + +module.exports = { + misrepresentedTokens: true, + methodology: `Uses factory(0x62DbCa39067f99C9D788a253cB325c6BA50e51cE) address and whitelisted tokens address to find and price liquidity pool pairs`, + mantle: { + tvl: getUniTVL({ + factory: "0x62DbCa39067f99C9D788a253cB325c6BA50e51cE", + hasStablePools: true, + useDefaultCoreAssets: true, + }), + }, +}; From 60c681d5b912144db39bea68e3afa7c95c9d9167 Mon Sep 17 00:00:00 2001 From: "0x0.ai" <128368554+0x0ai@users.noreply.github.com> Date: Fri, 21 Jul 2023 05:40:52 +0800 Subject: [PATCH 0453/1974] Added 0x0dex tvl (#6870) * Added 0x0dex tvl * refactor code --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/0x0dex/index.js | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 projects/0x0dex/index.js diff --git a/projects/0x0dex/index.js b/projects/0x0dex/index.js new file mode 100644 index 00000000000..54d77d54b04 --- /dev/null +++ b/projects/0x0dex/index.js @@ -0,0 +1,7 @@ +const { sumTokensExport, nullAddress } = require('../helper/unwrapLPs'); +const ETH_POOL_ADDRESS = "0x3d18AD735f949fEbD59BBfcB5864ee0157607616"; + +module.exports = { + start: 1685386800, // 19/05/2023 @ 07:00pm UTC + ethereum: { tvl: sumTokensExport({ owner: ETH_POOL_ADDRESS, tokens: [nullAddress]}) }, +}; \ No newline at end of file From 595f01d8a2886c6d57421b56010e4b2d19c3c42c Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 21 Jul 2023 09:01:29 +0200 Subject: [PATCH 0454/1974] track https://agni.finance --- projects/agni-fi/index.js | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 projects/agni-fi/index.js diff --git a/projects/agni-fi/index.js b/projects/agni-fi/index.js new file mode 100644 index 00000000000..87d0a8982e0 --- /dev/null +++ b/projects/agni-fi/index.js @@ -0,0 +1,5 @@ +const { uniV3Export } = require("../helper/uniswapV3"); + +module.exports = uniV3Export({ + mantle: { factory: "0xae411e11D9fA2773CEaC200cC2C73F17324Fc93B", fromBlock: 35714, }, +}); \ No newline at end of file From 86d4ac33a5561e2e479287c1c3a9890fce693ea2 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 21 Jul 2023 12:52:03 +0530 Subject: [PATCH 0455/1974] Smardex (#6876) * feat(smardex): update multichain tvl * code refactor --------- Co-authored-by: Esteban --- projects/SmarDex/index.js | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/projects/SmarDex/index.js b/projects/SmarDex/index.js index b357f3895f9..e7b845dd073 100644 --- a/projects/SmarDex/index.js +++ b/projects/SmarDex/index.js @@ -1,9 +1,18 @@ -const { getUniTVL, } = require('../helper/unknownTokens'); -const { staking } = require('../helper/staking') +const { getUniTVL } = require("../helper/unknownTokens"); +const { stakings } = require("../helper/staking"); -module.exports = { - ethereum: { - tvl: getUniTVL({ factory: '0x7753F36E711B66a0350a753aba9F5651BAE76A1D', abis: { getReserves: 'function getReserves() view returns (uint112 _reserve0, uint112 _reserve1)'} }), - staking: staking('0xB940D63c2deD1184BbdE059AcC7fEE93654F02bf', '0x5de8ab7e27f6e7a1fff3e5b337584aa43961beef') - }, +const config = { + ethereum: '0x7753F36E711B66a0350a753aba9F5651BAE76A1D', + bsc: '0xA8EF6FEa013034E62E2C4A9Ec1CDb059fE23Af33', + polygon: '0x9A1e1681f6D59Ca051776410465AfAda6384398f', + arbitrum: '0x41A00e3FbE7F479A99bA6822704d9c5dEB611F22', } + +Object.keys(config).forEach(chain => { + const factory = config[chain] + module.exports[chain] = { + tvl: getUniTVL({ factory, fetchBalances: true, }) + } +}) + +module.exports.ethereum.staking = stakings(["0xB940D63c2deD1184BbdE059AcC7fEE93654F02bf", "0x80497049b005Fd236591c3CD431DBD6E06eB1A31",], "0x5de8ab7e27f6e7a1fff3e5b337584aa43961beef") \ No newline at end of file From b93d4622c029de13a743d055808e734cc7652eb5 Mon Sep 17 00:00:00 2001 From: Muzammil Siddiqui <66691754+Webners1@users.noreply.github.com> Date: Fri, 21 Jul 2023 12:45:47 +0500 Subject: [PATCH 0456/1974] adding Shibshift project (#6877) * adding Shibshift project * minor fix --------- Co-authored-by: unknown Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/shibshift/index.js | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 projects/shibshift/index.js diff --git a/projects/shibshift/index.js b/projects/shibshift/index.js new file mode 100644 index 00000000000..2b850ab1979 --- /dev/null +++ b/projects/shibshift/index.js @@ -0,0 +1,8 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports = { + misrepresentedTokens: true, + pulse: { + tvl: getUniTVL({ factory: '0xD56B9f53A1CAf0a6b66B209a54DAE5C5D40dE622', useDefaultCoreAssets: true, fetchBalances: true, }), + }, +}; \ No newline at end of file From 227eb566c9ae9247f8b85a392e1270149db6a37d Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 21 Jul 2023 10:40:29 +0200 Subject: [PATCH 0457/1974] track sui deepbook --- projects/deepbook-sui/index.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 projects/deepbook-sui/index.js diff --git a/projects/deepbook-sui/index.js b/projects/deepbook-sui/index.js new file mode 100644 index 00000000000..b3442194670 --- /dev/null +++ b/projects/deepbook-sui/index.js @@ -0,0 +1,23 @@ +const { toUSDTBalances } = require('../helper/balances') +const { get } = require('../helper/http') + +async function tvl(ts) { + const {data} = await get('https://49490zsfv2.execute-api.us-east-1.amazonaws.com/sui/deepbook?interval=hour&timeFrame=1&dataType=tvl') + return toUSDTBalances(findClosestTvl(data, ts)) +} + +module.exports = { + timetravel: false, + misrepresentedTokens: true, + sui: { + tvl + } +} + +function findClosestTvl(data, ts) { + ts = ts * 1000 + data.forEach(i => i.ts = new Date(i.timestamp)) + data = data.filter(i => i.ts < ts && (ts -i.ts) < 86400000) // filter for recent tvl but less than day old + data.sort((a, b) => b.ts - a.ts) + return data[0].tvl +} \ No newline at end of file From 620f8d12f44d87dcc7c26b9f6a633e98658f9911 Mon Sep 17 00:00:00 2001 From: Andrei Stefan Date: Fri, 21 Jul 2023 12:07:49 +0300 Subject: [PATCH 0458/1974] add SolidWorld polygon (#6856) --- projects/solid-world/abi.json | 7 ++++ projects/solid-world/config.js | 15 ++++++++ projects/solid-world/index.js | 65 ++++++++++++++++++++++++++++++++++ 3 files changed, 87 insertions(+) create mode 100644 projects/solid-world/abi.json create mode 100644 projects/solid-world/config.js create mode 100644 projects/solid-world/index.js diff --git a/projects/solid-world/abi.json b/projects/solid-world/abi.json new file mode 100644 index 00000000000..5b52c1fc79a --- /dev/null +++ b/projects/solid-world/abi.json @@ -0,0 +1,7 @@ +{ + "getTotalAmounts": "function getTotalAmounts() external view returns (uint256 total0, uint256 total1)", + "totalSupply": "uint256:totalSupply", + "balanceOf": "erc20:balanceOf", + "token0": "address:token0", + "token1": "address:token1" +} diff --git a/projects/solid-world/config.js b/projects/solid-world/config.js new file mode 100644 index 00000000000..f1b5182f65a --- /dev/null +++ b/projects/solid-world/config.js @@ -0,0 +1,15 @@ +const config = { + polygon: { + pools: [ + { + crispToken: "0xEF6Ab48ef8dFe984FAB0d5c4cD6AFF2E54dfdA14", + hypervisor: "0x4a39cBb8198376AB08c24e596fF5E668c3ca269E", + stakingContract: "0xaD7Ce5Cf8E594e1EFC6922Ab2c9F81d7a0E14337" + } + ] + } +}; + +module.exports = { + config +}; diff --git a/projects/solid-world/index.js b/projects/solid-world/index.js new file mode 100644 index 00000000000..7694ec1fb4a --- /dev/null +++ b/projects/solid-world/index.js @@ -0,0 +1,65 @@ +const sdk = require("@defillama/sdk"); +const BigNumber = require("bignumber.js"); +const { config } = require("./config"); +const abi = require("./abi.json"); + +async function tvl(timestamp, ethBlock, _, { api }) { + const chainConfig = config[api.chain]; + const crispSupplies = await api.multiCall({ + calls: chainConfig.pools.map(pool => pool.crispToken), + abi: abi.totalSupply + }); + + const TVL = {}; + chainConfig.pools.forEach(({ crispToken }, i) => { + sdk.util.sumSingleBalance(TVL, crispToken, crispSupplies[i], api.chain); + }); + + return TVL; +} + +async function pool2(timestamp, ethBlock, _, { api }) { + const chainConfig = config[api.chain]; + const [token0s, token1s, totalAmounts, totalSupplies, stakedAmounts] = await Promise.all([ + api.multiCall({ calls: chainConfig.pools.map(pool => pool.hypervisor), abi: abi.token0 }), + api.multiCall({ calls: chainConfig.pools.map(pool => pool.hypervisor), abi: abi.token1 }), + api.multiCall({ calls: chainConfig.pools.map(pool => pool.hypervisor), abi: abi.getTotalAmounts }), + api.multiCall({ calls: chainConfig.pools.map(pool => pool.hypervisor), abi: abi.totalSupply }), + api.multiCall({ + calls: chainConfig.pools.map(pool => ({ + target: pool.hypervisor, + params: [pool.stakingContract] + })), abi: abi.balanceOf + }) + ]); + + // zip the results + const poolStats = chainConfig.pools.map((_, i) => ({ + token0: token0s[i], + token1: token1s[i], + totalAmount: totalAmounts[i], + totalSupply: totalSupplies[i], + stakedAmount: stakedAmounts[i] + })); + + const TVL = {}; + poolStats.forEach((e) => { + sdk.util.sumSingleBalance(TVL, e.token0, adjustAmount(e.totalAmount.total0, e.stakedAmount, e.totalSupply), api.chain); + sdk.util.sumSingleBalance(TVL, e.token1, adjustAmount(e.totalAmount.total1, e.stakedAmount, e.totalSupply), api.chain); + }); + + return TVL; +} + +function adjustAmount(amount, numerator, denominator) { + return BigNumber(amount).times(numerator).div(denominator).toFixed(0); +} + +module.exports = { + start: 1684477800, // Fri May 19 2023 06:30:00 GMT+0000 + methodology: "TVL is a measure of the health of the Solid World ecosystem. It's the total amount of value that is locked up in our staking contract, and it's calculated by adding up the value of all the LP tokens that are staked. The LP tokens represent the amount of liquidity that has been provided to the Solid World platform.", + polygon: { + tvl, + pool2 + } +}; From 4b73bb4dcb5bdb92ce11a9e3b832806d9108d628 Mon Sep 17 00:00:00 2001 From: codehans <94654388+codehans@users.noreply.github.com> Date: Fri, 21 Jul 2023 10:55:03 +0100 Subject: [PATCH 0459/1974] fetch contracts from canonical source (#6878) --- projects/bow/index.js | 12 +++++------- projects/fin/index.js | 5 ++--- projects/ghost/index.js | 6 ++++-- projects/kujira/index.js | 6 ++++-- projects/orca-kujira/index.js | 7 ++++--- 5 files changed, 19 insertions(+), 17 deletions(-) diff --git a/projects/bow/index.js b/projects/bow/index.js index e7507e9b29b..7c1f8895d3c 100644 --- a/projects/bow/index.js +++ b/projects/bow/index.js @@ -1,13 +1,11 @@ -const { get } = require("../helper/http"); -const { sumTokens, endPoints } = require('../helper/chain/cosmos') + +const { getConfig } = require("../helper/cache"); +const { sumTokens } = require('../helper/chain/cosmos') async function tvl() { - const bowPoolCodes = [46, 54, 36]; - const bowPools = (await Promise.all(bowPoolCodes.map(async (code) => { - const result = await get(endPoints.kujira + `/cosmwasm/wasm/v1/code/${code}/contracts?pagination.limit=100`); - return result.contracts; - }))).flat(); + const contracts = await getConfig("kujira/contracts", "https://raw.githubusercontent.com/Team-Kujira/kujira.js/master/src/resources/contracts.json"); + const bowPools = contracts["kaiyo-1"].bow.map(x => x.address) const owners = [ ...bowPools ] diff --git a/projects/fin/index.js b/projects/fin/index.js index 8438ecfe8c9..61e7ca3a453 100644 --- a/projects/fin/index.js +++ b/projects/fin/index.js @@ -1,15 +1,14 @@ -const { get } = require("../helper/http"); const { getConfig } = require("../helper/cache"); const { sumTokens, } = require('../helper/chain/cosmos'); async function tvl() { - const { pairs } = await getConfig("kujira/fin", "https://api.kujira.app/api/coingecko/pairs"); + const contracts = await getConfig("kujira/contracts", "https://raw.githubusercontent.com/Team-Kujira/kujira.js/master/src/resources/contracts.json"); const blacklist = [ 'kujira1hs95lgvuy0p6jn4v7js5x8plfdqw867lsuh5xv6d2ua20jprkgesw2pujt', 'kujira1gl8js9zn7h9u2h37fx7qg8xy65jrk9t4zpa6s7j5hdlanud2uwxshqq67m' ] let owners = [ - ...pairs.map((pair) => pair.pool_id), + ...contracts["kaiyo-1"].fin.map(x => x.address), ] owners = owners.filter(item => { diff --git a/projects/ghost/index.js b/projects/ghost/index.js index 00c5ad52e25..e1cd7484fcd 100644 --- a/projects/ghost/index.js +++ b/projects/ghost/index.js @@ -2,11 +2,13 @@ const { queryContracts, queryContract, } = require("../helper/chain/cosmos"); +const { getConfig } = require("../helper/cache"); async function tvl(_, _1, _2, { api }) { const chain = api.chain - const vaultContracts = await queryContracts({ chain, codeId: 106 }); - const marketContracts = await queryContracts({ chain, codeId: 113 }); + const contracts = await getConfig("kujira/contracts", "https://raw.githubusercontent.com/Team-Kujira/kujira.js/master/src/resources/contracts.json"); + const vaultContracts = contracts["kaiyo-1"].ghostVault.map(x => x.address) + const marketContracts = contracts["kaiyo-1"].ghostMarket.map(x => x.address) for (const contract of vaultContracts) { const { deposited, borrowed } = await queryContract({ contract, chain, data: { status: {} } }) const { denom } = await queryContract({ contract, chain, data: { config: {} } }) diff --git a/projects/kujira/index.js b/projects/kujira/index.js index 51a3a34a999..193ad071e47 100644 --- a/projects/kujira/index.js +++ b/projects/kujira/index.js @@ -1,9 +1,11 @@ -const { sumTokens, queryContracts } = require('../helper/chain/cosmos') +const { sumTokens } = require('../helper/chain/cosmos') +const { getConfig } = require("../helper/cache"); const chain = "kujira"; async function tvl() { - const uskContracts = await queryContracts({ chain, codeId: 73 }); + const contracts = await getConfig("kujira/contracts", "https://raw.githubusercontent.com/Team-Kujira/kujira.js/master/src/resources/contracts.json"); + const uskContracts = contracts["kaiyo-1"].uskMarket.map(x => x.address) return sumTokens({ owners: uskContracts, chain }) } diff --git a/projects/orca-kujira/index.js b/projects/orca-kujira/index.js index 586ad767ba5..0bd465e0bac 100644 --- a/projects/orca-kujira/index.js +++ b/projects/orca-kujira/index.js @@ -1,9 +1,10 @@ -const { get } = require("../helper/http"); -const { sumTokens, endPoints } = require('../helper/chain/cosmos') +const { sumTokens } = require('../helper/chain/cosmos') +const { getConfig } = require("../helper/cache"); async function tvl() { - const { contracts: orcaPools } = await get(endPoints.kujira + "/cosmwasm/wasm/v1/code/59/contracts?pagination.limit=100"); + const contracts = await getConfig("kujira/contracts", "https://raw.githubusercontent.com/Team-Kujira/kujira.js/master/src/resources/contracts.json"); + const orcaPools = contracts["kaiyo-1"].orca.map(x => x.address) const owners = [ ...orcaPools, ] From a5e01659cc7f738fe4e4d0d0ca3d9e5a91a9fec6 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 21 Jul 2023 14:06:05 +0200 Subject: [PATCH 0460/1974] track reax-one lending --- projects/helper/aave.js | 4 ++-- projects/reax-one-lending/index.js | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 projects/reax-one-lending/index.js diff --git a/projects/helper/aave.js b/projects/helper/aave.js index 4d22ccd1dfb..74ef546ab0c 100644 --- a/projects/helper/aave.js +++ b/projects/helper/aave.js @@ -187,7 +187,7 @@ const oracleAbis = { getAssetsPrices: "function getAssetsPrices(address[] assets) view returns (uint256[])", } -function aaveV2Export(registry, { useOracle = false, baseCurrency, baseCurrencyUnit, } = {}) { +function aaveV2Export(registry, { useOracle = false, baseCurrency, baseCurrencyUnit, abis = {}} = {}) { async function tvl(_, _b, _c, { api }) { const data = await getReservesData(api) @@ -226,7 +226,7 @@ function aaveV2Export(registry, { useOracle = false, baseCurrency, baseCurrencyU async function getReservesData(api) { const tokens = await api.call({ abi: abiv2.getReservesList, target: registry }) - const data = await api.multiCall({ abi: abiv2.getReserveData, calls: tokens, target: registry, }) + const data = await api.multiCall({ abi: abis.getReserveData ?? abiv2.getReserveData, calls: tokens, target: registry, }) data.forEach((v, i) => v.underlying = tokens[i]) if (useOracle) { let currency = baseCurrency diff --git a/projects/reax-one-lending/index.js b/projects/reax-one-lending/index.js new file mode 100644 index 00000000000..0ed1782c2f1 --- /dev/null +++ b/projects/reax-one-lending/index.js @@ -0,0 +1,7 @@ +const { aaveV2Export } = require('../helper/aave.js'); + +module.exports = { + mantle: aaveV2Export('0x4bbea708f4e48eb0bb15e0041611d27c3c8638cf', { abis: { + "getReserveData": "function getReserveData(address asset) view returns (tuple(tuple(uint256 data) configuration, uint128 liquidityIndex, uint128 currentLiquidityRate, uint128 variableBorrowIndex, uint128 currentVariableBorrowRate, uint128 currentStableBorrowRate, uint40 lastUpdateTimestamp, uint16 id, address aTokenAddress, address stableDebtTokenAddress, address variableDebtTokenAddress, address interestRateStrategyAddress, uint128 accruedToTreasury, uint128 unbacked, uint128 isolationModeTotalDebt))" + } }) +} From aad15d00c89c761a282597e8c96a3b7a04c08de1 Mon Sep 17 00:00:00 2001 From: Dozer <71271486+dev-dozer@users.noreply.github.com> Date: Fri, 21 Jul 2023 15:31:40 +0300 Subject: [PATCH 0461/1974] added new chain polygon_zkevm (#6879) --- projects/interport-finance/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/interport-finance/index.js b/projects/interport-finance/index.js index b66f85da9fe..def75747fb5 100644 --- a/projects/interport-finance/index.js +++ b/projects/interport-finance/index.js @@ -12,7 +12,7 @@ module.exports = { methodology: 'Interport TVL is calculated by summing the USDT and USDC balance of the vaults contracts, ITP token balance in the ITP Revenue Share contract and LP token balance in the LP Revenue Share contract.', }; -['ethereum', 'avax', 'bsc', 'fantom', 'arbitrum', 'polygon', 'era'].forEach(chain => { +['ethereum', 'avax', 'bsc', 'fantom', 'arbitrum', 'polygon', 'polygon_zkevm', 'era'].forEach(chain => { module.exports[chain] = { tvl: async (_, _1, _2, { api }) => { const vaults = config[chain]?.vaults || defaultVaults From 444637da1184a619c8cc0c003f63a71c44146a4c Mon Sep 17 00:00:00 2001 From: define Date: Fri, 21 Jul 2023 14:44:28 +0100 Subject: [PATCH 0462/1974] add hallmark to conic --- projects/conic-omnipool/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/conic-omnipool/index.js b/projects/conic-omnipool/index.js index a4c290cab4c..c473908b1b5 100644 --- a/projects/conic-omnipool/index.js +++ b/projects/conic-omnipool/index.js @@ -2,6 +2,9 @@ const sdk = require('@defillama/sdk') module.exports = { doublecounted: true, + hallmarks: [ + [1689937200,"ETH Omnipool Hacked"] + ], ethereum: { tvl: async (_, _b, _cb, { api, }) => { const balances = {} From 8a19df875ca1c90ac4b911a04872d1f436eb1ada Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 21 Jul 2023 16:00:44 +0200 Subject: [PATCH 0463/1974] update unicrypt-v3 --- projects/unicrypt-v3/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/unicrypt-v3/index.js b/projects/unicrypt-v3/index.js index 2f840ee9833..ef338a99b76 100644 --- a/projects/unicrypt-v3/index.js +++ b/projects/unicrypt-v3/index.js @@ -6,6 +6,7 @@ const config = { ethereum: { reserves: ['0x231278edd38b00b07fbd52120cef685b9baebcc1'] }, arbitrum: { reserves: ['0xfa104eb3925a27e6263e05acc88f2e983a890637'] }, bsc: { reserves: ['0x0D29598EC01fa03665feEAD91d4Fb423F393886c'] }, + polygon: { reserves: ['0xc22218406983bf88bb634bb4bf15fa4e0a1a8c84'] }, } module.exports = { From 56fa82ce5f0897ac8a4e4cafaa5a087da200f1cf Mon Sep 17 00:00:00 2001 From: Mubashir Zebi <102967755+mubashirzebi@users.noreply.github.com> Date: Fri, 21 Jul 2023 19:52:10 +0530 Subject: [PATCH 0464/1974] add WMNT token (#6880) --- projects/reax-one-dex/index.js | 1 + projects/reax-one-synth/index.js | 1 + 2 files changed, 2 insertions(+) diff --git a/projects/reax-one-dex/index.js b/projects/reax-one-dex/index.js index 16bd3a0be4d..43fd2f353a7 100644 --- a/projects/reax-one-dex/index.js +++ b/projects/reax-one-dex/index.js @@ -7,6 +7,7 @@ module.exports = { '0xf7dfe223e19701a514e78f3ce7ba98f2c5fbb5b2', '0xa84bdecd44e6cee1c588a3c97fcc4482831fde05', '0x62959ad021402f48d0d8067bc5c4c03f63fceaa4', + '0x8348b81b9ed72f29e52027c349f30703b42c0110' ] }), } diff --git a/projects/reax-one-synth/index.js b/projects/reax-one-synth/index.js index b2738990b29..ed44820be5d 100644 --- a/projects/reax-one-synth/index.js +++ b/projects/reax-one-synth/index.js @@ -8,6 +8,7 @@ module.exports = { '0xdEAddEaDdeadDEadDEADDEAddEADDEAddead1111', '0x201EBa5CC46D216Ce6DC03F6a759e8E766e956aE', '0xCAbAE6f6Ea1ecaB08Ad02fE02ce9A44F09aebfA2', + '0x78c1b0c915c4faa5fffa6cabf0219da63d7f4cb8' ] }), } From 56dd199a1965661797c604ee07593a6e01910b87 Mon Sep 17 00:00:00 2001 From: "Guillermo M. Narvaja" Date: Sat, 22 Jul 2023 05:15:35 -0300 Subject: [PATCH 0465/1974] Ensuro: new pools and Premiums accounts (#6882) Adds new eTokens (liquidity pool) and Premiums Accounts for recently onboarded risks. --- projects/ensuro/index.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/projects/ensuro/index.js b/projects/ensuro/index.js index e31bae3714d..3eb3881ec3f 100644 --- a/projects/ensuro/index.js +++ b/projects/ensuro/index.js @@ -13,10 +13,16 @@ const addressBook = { {name: "eToken Innov Zone", address: "0x1C48Accaf6f8106883AA1973A45F02525652DEfC"}, {name: "eToken Junior Koala BMA", address: "0xBC33c283A37d46ABA17BC5F8C27b27242688DeC6"}, {name: "eToken Senior BMA", address: "0xF383eF2D31E1d4a19B3e04ca2937DB6A8DA9f229"}, + {name: "eToken Junior Spot", address: "0x6229D78658305a301E177f9dAEa3a0799fd1528C"}, + {name: "eToken Junior Revo", address: "0x6A0e61C757e384eB1E4A2b94F7E02E68e4b4515e"}, + {name: "eToken Junior StormStrong", address: "0xE36D6585F0c200195b196C66644C519e7674b476"}, // PremiumsAccounts {name: "PremiumsAccount Koala", address: "0xCCf5C404d32eB6E777088AB13837a1b8dCBA9328"}, {name: "PremiumsAccount Innov Zone", address: "0x4f43B8F252887F814ED689346fdb5Bd266394520"}, {name: "PremiumsAccount Koala BMA", address: "0xc1A74eaC52a195E54E0cd672A9dAB023292C6100"}, + {name: "PremiumsAccount StormStrong", address: "0x06347eA3dA6a5B44eEAe3B8F4a65992Ae073e6F4"}, + {name: "PremiumsAccount Revo", address: "0x47f35B4876138b5d96FfDed1e46aE6b58E6e7B31"}, + {name: "PremiumsAccount Spot", address: "0x42118Df6EBb18346ca425f1c67AC739E95aD9358"}, ], v1: { pool: "0xF7ED72430bEA07D8dB6eC264603811381F5af8e0", From 241f1b3dca916d7000aff52291ad43c0036a9d5e Mon Sep 17 00:00:00 2001 From: bryansniyve <134277602+bryansniyve@users.noreply.github.com> Date: Sat, 22 Jul 2023 20:51:22 +0800 Subject: [PATCH 0466/1974] feat: add zksync tvl (#6873) * feat: add zksync tvl * code fix --------- Co-authored-by: bryan.y Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/apollox/index.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/projects/apollox/index.js b/projects/apollox/index.js index 2f80e92f3d5..85e0e24846c 100644 --- a/projects/apollox/index.js +++ b/projects/apollox/index.js @@ -83,4 +83,10 @@ module.exports = { ADDRESSES.arbitrum.USDT, ]}) }, + era: { + tvl: sumTokensExport({ owner: '0xD6f4e33063C881cE9a98e07E13673B92a637D908', tokens: [ + nullAddress, + ADDRESSES.era.USDC, + ]}) + }, }; From 6333f91bda226216dda87a07c3714657ed758570 Mon Sep 17 00:00:00 2001 From: LPX Date: Sat, 22 Jul 2023 21:53:29 +0900 Subject: [PATCH 0467/1974] add: Evmos Community Treasury (#6883) * add(revert-evmos) * add(basic-treasury) * add(forge-contract-owner) --- projects/helper/coreAssets.json | 3 ++- projects/treasury/evmos-dao.js | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 projects/treasury/evmos-dao.js diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index 185647d0f86..c704a5472e4 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -273,7 +273,8 @@ "WETH": "0x5842c5532b61acf3227679a8b1bd0242a41752f2", "WBTC": "0xf80699dc594e00ae7ba200c7533a07c1604a106d", "FRAX": "0xe03494d0033687543a80c9b1ca7d6237f2ea8bd8", - "DIFF": "0x3f75ceabcdfed1aca03257dc6bdc0408e2b4b026" + "DIFF": "0x3f75ceabcdfed1aca03257dc6bdc0408e2b4b026", + "AXL_USDC": "0x15c3eb3b621d1bff62cba1c9536b7c1ae9149b57" }, "oasis": { "WETH": "0x3223f17957ba502cbe71401d55a0db26e5f7c68f", diff --git a/projects/treasury/evmos-dao.js b/projects/treasury/evmos-dao.js new file mode 100644 index 00000000000..ecc78b01135 --- /dev/null +++ b/projects/treasury/evmos-dao.js @@ -0,0 +1,23 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const community_pool = "0x93354845030274cd4bf1686abd60ab28ec52e1a7"; +const treasury = "0xc3c5156911bf53f12913b68e0532096536b30600"; +const forge_liquidity = "0x4c3c271ca2e841c0051c0402021ddaef3ce666d0"; +const forge_owner = "0x2A72df162bD5B9Ba4cBB4F28bCE590c20db7aEC1"; + +const tokens = [ + nullAddress, + ADDRESSES.evmos.WEVMOS, + ADDRESSES.evmos.STEVMOS, + ADDRESSES.evmos.STRIDE, + ADDRESSES.evmos.AXL_USDC +] + + +module.exports = treasuryExports({ + evmos: { + tokens: tokens, + owners: [community_pool, treasury, forge_liquidity, forge_owner], + }, +}) \ No newline at end of file From 59680e7eac850cf1e8451dc209a437d0c57dba8e Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Sat, 22 Jul 2023 20:35:13 +0100 Subject: [PATCH 0468/1974] add dracula --- projects/dracula.js | 2 +- projects/dracula/index.js | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 projects/dracula/index.js diff --git a/projects/dracula.js b/projects/dracula.js index ef1a264b98b..d1fce2a21b4 100644 --- a/projects/dracula.js +++ b/projects/dracula.js @@ -4,7 +4,7 @@ module.exports = { hallmarks: [ [Math.floor(new Date('2022-03-17')/1e3), 'DRACULA is for now fully focused on it\'s Metaverse product'], ], - methodology: 'DRACULA is for now fully focused on it\'s Metaverse product', + methodology: 'Tokens staked on 0xC8DFD57E82657f1e7EdEc5A9aA4906230C29A62A', ethereum: { tvl: () => ({}), staking: staking('0xC8DFD57E82657f1e7EdEc5A9aA4906230C29A62A', '0xb78b3320493a4efaa1028130c5ba26f0b6085ef8'), diff --git a/projects/dracula/index.js b/projects/dracula/index.js new file mode 100644 index 00000000000..bd5f0612eb9 --- /dev/null +++ b/projects/dracula/index.js @@ -0,0 +1,7 @@ +const { uniTvlExport } = require("../helper/calculateUniTvl.js"); + +module.exports = { + era: { + tvl: uniTvlExport("0x68e03D7B8B3F9669750C1282AD6d36988f4FE18e", "era", undefined, undefined, { hasStablePools: true, useDefaultCoreAssets: false, }), + }, +}; From 1d9d9c3f786eb225de1918d5bd6a3ef5af76dec2 Mon Sep 17 00:00:00 2001 From: Slok contributors <138642329+gitslok@users.noreply.github.com> Date: Sun, 23 Jul 2023 16:18:55 +0800 Subject: [PATCH 0469/1974] sharelock (#6884) * sharelock * Update index.js --------- Co-authored-by: zliwei-git <745096434@qq.com> Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/sharelock/index.js | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 projects/sharelock/index.js diff --git a/projects/sharelock/index.js b/projects/sharelock/index.js new file mode 100644 index 00000000000..d3810ed4ab7 --- /dev/null +++ b/projects/sharelock/index.js @@ -0,0 +1,7 @@ +const { getUniTVL} = require("../helper/unknownTokens") + +module.exports = { + era: { + tvl: getUniTVL({ factory: '0xea51CE8A1f9C1Cbbf5B89D9B1dA4A94fB1557866', fetchBalances: true, }) + }, +} From 4373701529a6155dcb165d9a45492c075b902a1f Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Sun, 23 Jul 2023 18:38:32 +0100 Subject: [PATCH 0470/1974] add dyad --- projects/dyad/index.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 projects/dyad/index.js diff --git a/projects/dyad/index.js b/projects/dyad/index.js new file mode 100644 index 00000000000..e3fd5854153 --- /dev/null +++ b/projects/dyad/index.js @@ -0,0 +1,23 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const sdk = require("@defillama/sdk"); + + +async function tvl(_timestamp, block) { + return { + [ADDRESSES.null]: ( + await sdk.api.eth.getBalance({ + target: "0xdc400bbe0b8b79c07a962ea99a642f5819e3b712", + block, + }) + ).output, + }; +} + +module.exports = { + ethereum: { + tvl, + }, +}; + + + From 5b9084d1d21b4ee0817d259729762cad8f7bef4c Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 24 Jul 2023 06:45:38 +0200 Subject: [PATCH 0471/1974] track https://dbx.finance/ --- projects/amaterasu.js | 1 - projects/astroswap.js | 2 +- projects/clever-protocol/index.js | 1 - projects/complus/index.js | 8 ++++---- projects/dbx-finance/index.js | 8 ++++++++ projects/ethwswap/index.js | 1 - projects/syncdex-finance/index.js | 22 ---------------------- 7 files changed, 13 insertions(+), 30 deletions(-) create mode 100644 projects/dbx-finance/index.js diff --git a/projects/amaterasu.js b/projects/amaterasu.js index 6309cd74f29..da23a1807c0 100644 --- a/projects/amaterasu.js +++ b/projects/amaterasu.js @@ -5,7 +5,6 @@ module.exports = { aurora: { tvl: getUniTVL({ factory: "0x34696b6cE48051048f07f4cAfa39e3381242c3eD", - chain: 'aurora', useDefaultCoreAssets: true, }) } diff --git a/projects/astroswap.js b/projects/astroswap.js index a2b605a6d08..d892c95850b 100644 --- a/projects/astroswap.js +++ b/projects/astroswap.js @@ -4,7 +4,7 @@ module.exports = { misrepresentedTokens: true, velas: { tvl: getUniTVL({ - factory: '0xe82d721A6CdeC2f86e9Fca074Ff671c8621F8459', chain: 'velas', useDefaultCoreAssets: true, + factory: '0xe82d721A6CdeC2f86e9Fca074Ff671c8621F8459', useDefaultCoreAssets: true, blacklist: ['0xcd7509b76281223f5b7d3ad5d47f8d7aa5c2b9bf', '0xd12f7a98c0d740e7ec82e8caf94eb79c56d1b623',], }) }, diff --git a/projects/clever-protocol/index.js b/projects/clever-protocol/index.js index 98dea1f6746..7d38e6c1120 100644 --- a/projects/clever-protocol/index.js +++ b/projects/clever-protocol/index.js @@ -6,7 +6,6 @@ module.exports = { misrepresentedTokens: true, dogechain: { tvl: getUniTVL({ - chain: 'dogechain', factory: FACTORY, useDefaultCoreAssets: true, }), diff --git a/projects/complus/index.js b/projects/complus/index.js index fdca047b026..85c0aa6cad6 100644 --- a/projects/complus/index.js +++ b/projects/complus/index.js @@ -3,15 +3,15 @@ const { getUniTVL } = require('../helper/unknownTokens') module.exports = { misrepresentedTokens: true, polygon: { - tvl: getUniTVL({ chain: 'polygon', useDefaultCoreAssets: true, factory: '0x973c934137dd687eca67bdd1c5a8b74286964ac6', }), + tvl: getUniTVL({ useDefaultCoreAssets: true, factory: '0x973c934137dd687eca67bdd1c5a8b74286964ac6', }), }, heco: { - tvl: getUniTVL({ chain: 'heco', useDefaultCoreAssets: true, factory: '0xc32cccf795940ca8491cd4f31161509db28ab719', }), + tvl: getUniTVL({ useDefaultCoreAssets: true, factory: '0xc32cccf795940ca8491cd4f31161509db28ab719', }), }, bsc: { - tvl: getUniTVL({ chain: 'bsc', useDefaultCoreAssets: true, factory: '0xdf97982bf70be91df4acd3d511c551f06a0d19ec', }), + tvl: getUniTVL({ useDefaultCoreAssets: true, factory: '0xdf97982bf70be91df4acd3d511c551f06a0d19ec', }), }, avax:{ - tvl: getUniTVL({ chain: 'avax', useDefaultCoreAssets: true, factory: '0x5c02e78a3969d0e64aa2cfa765acc1d671914ac0', }), + tvl: getUniTVL({ useDefaultCoreAssets: true, factory: '0x5c02e78a3969d0e64aa2cfa765acc1d671914ac0', }), }, } \ No newline at end of file diff --git a/projects/dbx-finance/index.js b/projects/dbx-finance/index.js new file mode 100644 index 00000000000..9de7567c70f --- /dev/null +++ b/projects/dbx-finance/index.js @@ -0,0 +1,8 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports = { + misrepresentedTokens: true, + arbitrum: { + tvl: getUniTVL({ factory: '0x41755a88d4ab443d5d8ef73ec64dd3df71fb5559', useDefaultCoreAssets: true, }), + } +} diff --git a/projects/ethwswap/index.js b/projects/ethwswap/index.js index b57a7727b76..e840b9fcdda 100644 --- a/projects/ethwswap/index.js +++ b/projects/ethwswap/index.js @@ -4,7 +4,6 @@ module.exports = { misrepresentedTokens: true, ethpow: { tvl: getUniTVL({ - chain: 'ethpow', useDefaultCoreAssets: true, factory: '0x78376072F4945b2A5450B1A6B41a85ff20034527', }) diff --git a/projects/syncdex-finance/index.js b/projects/syncdex-finance/index.js index dda3a87a1fa..e84840811ec 100644 --- a/projects/syncdex-finance/index.js +++ b/projects/syncdex-finance/index.js @@ -1,30 +1,8 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const { sumTokensExport } = require("../helper/unwrapLPs"); - -const native_staking_contract = "0x9212456Da7804245BDF02e7294E4f36D27f9c2B1"; -const usdc_staking_contract = "0xa8CD01322Ad632c9656879e99Fd7FbC11ca8E3BB"; -const sydx_staking_contract = "0xB2bD1427b04d84eA14214582C59CB16D4F1d676E"; -const native_usdc_farming_contract = "0x3F90A802B5D6E984A6f296F697AB847C5fE23F31"; -const native_sydx_farming_contract = "0xDA24F9528102A5A126Cd7eeE8c6e22A786cAE844"; -const sydx_usdc_farming_contract = "0x75aC887df149076b7DF4deAA0267711475b71572"; -const usdc_usdplus_farming_contract = "0xF0B42d393eAB886bd9310AaF0A2B1eDbaaD31fdE" - -const assets = [ - ADDRESSES.era.USDC, - ADDRESSES.era.WETH, - ADDRESSES.null, // This is address of native token (ETH), you can check native_staking_contract - "0x8E86e46278518EFc1C5CEd245cBA2C7e3ef11557" -]; -const SYNC_DEX = '0x3a34FA9a1288597Ad6C1Da709f001D37FeF8b19e' - -const owners = [native_staking_contract, usdc_staking_contract, sydx_staking_contract, native_usdc_farming_contract, native_sydx_farming_contract, sydx_usdc_farming_contract, usdc_usdplus_farming_contract] - module.exports = { era: { hallmarks: [ [1681340401,"Rug Pull"] ], tvl: () => 0, - staking: () => 0, }, }; \ No newline at end of file From 7c83ded753658b7336825d9f00c78e1368434bb6 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 24 Jul 2023 06:47:46 +0200 Subject: [PATCH 0472/1974] split pika into 2 --- projects/pika-v4/index.js | 10 ++++++++++ projects/pika.js | 1 - 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 projects/pika-v4/index.js diff --git a/projects/pika-v4/index.js b/projects/pika-v4/index.js new file mode 100644 index 00000000000..e3d3705a97c --- /dev/null +++ b/projects/pika-v4/index.js @@ -0,0 +1,10 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require('../helper/unwrapLPs') + +module.exports = { + optimism: { + tvl: sumTokensExport({ owners: [ + '0x9b86B2Be8eDB2958089E522Fe0eB7dD5935975AB', + ], tokens: [ADDRESSES.optimism.USDC]}) + } +} \ No newline at end of file diff --git a/projects/pika.js b/projects/pika.js index 5a404a89f35..9744d4fae37 100644 --- a/projects/pika.js +++ b/projects/pika.js @@ -6,7 +6,6 @@ module.exports = { tvl: sumTokensExport({ owners: [ '0x2FaE8C7Edd26213cA1A88fC57B65352dbe353698', '0xD5A8f233CBdDb40368D55C3320644Fb36e597002', - '0x9b86B2Be8eDB2958089E522Fe0eB7dD5935975AB', ], tokens: [ADDRESSES.optimism.USDC]}) } } \ No newline at end of file From deb0d2001af045b4a722b765797f176a74ea4256 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 24 Jul 2023 07:11:50 +0200 Subject: [PATCH 0473/1974] track https://app.dexfinance.com/swap --- projects/dexswap-arbi/index.js | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 projects/dexswap-arbi/index.js diff --git a/projects/dexswap-arbi/index.js b/projects/dexswap-arbi/index.js new file mode 100644 index 00000000000..8b46b8d8fe9 --- /dev/null +++ b/projects/dexswap-arbi/index.js @@ -0,0 +1,8 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports = { + misrepresentedTokens: true, + arbitrum: { + tvl: getUniTVL({ factory: '0x3E40739d8478c58f9B973266974C58998D4F9e8b', useDefaultCoreAssets: true, }), + } +} From 107121e4945ff44ba87bd31c3a90fcbef4bb07a7 Mon Sep 17 00:00:00 2001 From: Centipede5 Date: Mon, 24 Jul 2023 01:24:35 -0400 Subject: [PATCH 0474/1974] Add DogeDollar (#6885) * add dogedollar * Update index.js --- projects/dogedollar/index.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 projects/dogedollar/index.js diff --git a/projects/dogedollar/index.js b/projects/dogedollar/index.js new file mode 100644 index 00000000000..2cebc693c7e --- /dev/null +++ b/projects/dogedollar/index.js @@ -0,0 +1,15 @@ +const { sumTokensExport, nullAddress, } = require("../helper/unwrapLPs"); + +const DJED_ADDR = '0xA99ef299CdA10AC4Ec974370778fbd27Cfb5CF61' + +module.exports = { + methodology: 'finds the DOGE balance of the DJED instance backing the stablecoin, aswell as the fallback stablecoin balance', + start: 14576300, + dogechain: { + tvl: sumTokensExport({ + tokensAndOwners: [ + [nullAddress, DJED_ADDR], + ] + }), + } +}; From 1b305f35292ce959f28808d7775b09098f51c908 Mon Sep 17 00:00:00 2001 From: brightiron <95196612+brightiron@users.noreply.github.com> Date: Mon, 24 Jul 2023 00:41:12 -0500 Subject: [PATCH 0475/1974] Add Whale Game (#6889) * add tvl calcs for whalegame contracts * remove unused abis * vesting contract * update description * code refactor --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/whalegame/index.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 projects/whalegame/index.js diff --git a/projects/whalegame/index.js b/projects/whalegame/index.js new file mode 100644 index 00000000000..e3922dded61 --- /dev/null +++ b/projects/whalegame/index.js @@ -0,0 +1,26 @@ + +const ADDRESSES = require("../helper/coreAssets.json"); + +const GAME_CONTRACT_ADDRESS = "0xF1baf16Db25405856f5379246Beba2B694e1449D"; + +async function tvl(_, _1, _2, { api }) { + const whaleTokenAddress = await api.call({ abi: abi.whaleToken, target: GAME_CONTRACT_ADDRESS, }); + const owners = [GAME_CONTRACT_ADDRESS, whaleTokenAddress] + + owners.push(...await api.fetchList({ itemAbi: abi.vestingContractforRound, lengthAbi: abi.round, target: GAME_CONTRACT_ADDRESS, })) + return api.sumTokens({ tokens: [ADDRESSES.null], owners, blacklistedOwners: [ADDRESSES.null] }) +} + +module.exports = { + methodology: + "Counts the amount of ETH in the Game Pot, WHALE Rewards Contract and unclaimed ETH in vesting contracts", + ethereum: { + tvl, + }, +}; + +const abi = { + "vestingContractforRound": "function vestingContractForRound(uint256) view returns (address)", + "round": "uint256:round", + "whaleToken": "address:whaleToken" +} \ No newline at end of file From 09ce378e1f5e898211f356db61a2191f11ac4fcb Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 24 Jul 2023 11:15:50 +0530 Subject: [PATCH 0476/1974] Palmswap (#6890) * tvl working staking is not working * code refactor --------- Co-authored-by: Eren Boyraz --- projects/palmswap/index.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 projects/palmswap/index.js diff --git a/projects/palmswap/index.js b/projects/palmswap/index.js new file mode 100644 index 00000000000..6c61b803a9b --- /dev/null +++ b/projects/palmswap/index.js @@ -0,0 +1,14 @@ +const { gmxExports } = require("../helper/gmx"); +const { staking } = require("../helper/staking"); + +const palmswapVault = "0x806f709558CDBBa39699FBf323C8fDA4e364Ac7A"; //Vault + +const palmTokenStakingContract = "0x95fc6f7df412040a815494cf27fbc82be6c7585c"; //RewardTracker +const palmToken = "0x29745314B4D294B7C77cDB411B8AAa95923aae38"; //PALM token address + +module.exports = { + bsc: { + tvl: gmxExports({ vault: palmswapVault }), + staking: staking(palmTokenStakingContract, palmToken), + }, +}; From 2d5cd4c3e1977d2fcc66e9ab5ce1d1b84c4e0355 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 24 Jul 2023 08:49:52 +0200 Subject: [PATCH 0477/1974] refactor popsicle --- projects/popsicle/index.js | 80 ++++++++++++-------------------------- 1 file changed, 24 insertions(+), 56 deletions(-) diff --git a/projects/popsicle/index.js b/projects/popsicle/index.js index 9da49e89c3b..90e98b628b3 100644 --- a/projects/popsicle/index.js +++ b/projects/popsicle/index.js @@ -1,14 +1,8 @@ const ADDRESSES = require('../helper/coreAssets.json') -const sdk = require("@defillama/sdk"); const poolInfoAbi = require("../helper/abis/masterchef.json"); -const { sumTokensAndLPsSharedOwners, sumTokens2 } = require('../helper/unwrapLPs'); +const { sumTokens2 } = require('../helper/unwrapLPs'); const { addFundsInMasterChef } = require("../helper/masterchef"); -const { - transformBscAddress, - transformFantomAddress, -} = require("../helper/portedTokens"); -const { fetchURL } = require("../helper/utils"); -const { toUSDTBalances } = require("../helper/balances"); +const { getConfig } = require('../helper/cache') const MasterChefContract = "0xbf513aCe2AbDc69D38eE847EFFDaa1901808c31c"; const ice = "0xf16e81dce15B08F326220742020379B855B87DF9"; @@ -16,77 +10,51 @@ const ice = "0xf16e81dce15B08F326220742020379B855B87DF9"; function pool2(chain) { return async (timestamp, ethBlock, chainBlocks) => { const balances = {}; - await addFundsInMasterChef( - balances, - MasterChefContract, - chainBlocks[chain], - chain, - undefined, - poolInfoAbi.poolInfo, - [ice] - ); + await addFundsInMasterChef(balances, MasterChefContract, chainBlocks[chain], chain, undefined, poolInfoAbi.poolInfo, [ice]); return balances; }; } -async function optimizerV3(time, block) { - const data = await fetchURL( - "https://analytics.back.popsicle.finance/api/v1/FragolaApy" - ); - return toUSDTBalances(data.data.reduce((total, pool) => total + pool.tvl, 0)); +const config = { + ethereum: 'https://analytics.back.popsicle.finance/api/v1/FragolaApy', + polygon: 'https://analytics.back.popsicle.finance/api/v1/polygon/FragolaApy', } -async function fantomTvl(timestamp, block, chainBlocks) { - const transform = await transformFantomAddress(); - const balances = {}; - await sumTokensAndLPsSharedOwners( - balances, - [ - ["0xddc0385169797937066bbd8ef409b5b3c0dfeb52", false], - ], - [ - "0xFDB988aF9ef9D0C430176f972bA82B98b476F3ee", - ], - chainBlocks.fantom, "fantom", transform - ); - - //wMEMO - const memo = ( - await sdk.api.abi.call({ - target: "0x0da67235dd5787d67955420c84ca1cecd4e5bb3b", - params: [ - balances["fantom:0xddc0385169797937066bbd8ef409b5b3c0dfeb52"], - ], - abi: 'function wMEMOToMEMO(uint256 _amount) view returns (uint256)', - block: chainBlocks.avax, - chain: "avax", - }) - ).output; - balances["avax:0xb54f16fb19478766a268f172c9480f8da1a7c9c3"] = memo; - delete balances["fantom:0xddc0385169797937066bbd8ef409b5b3c0dfeb52"]; - - return balances; +async function optimizerV3(time, block, _, {api}) { + const data = await getConfig('popsicle/'+api.chain, config[api.chain]) + const pools = data.map(i => i.fragolaAddress) + const token0s = await api.multiCall({ abi: 'address:token0', calls: pools}) + const token1s = await api.multiCall({ abi: 'address:token1', calls: pools}) + const bals = await api.multiCall({ abi: 'function usersAmounts() returns (uint256,uint256)', calls: pools}) + bals.forEach(([bal0, bal1], i) => { + api.add(token0s[i], bal0) + api.add(token1s[i], bal1) + }) +} +async function fantomTvl(timestamp, block, chainBlocks, {api}) { + return api.sumTokens({ owner: '0xFDB988aF9ef9D0C430176f972bA82B98b476F3ee', tokens: ['0xddc0385169797937066bbd8ef409b5b3c0dfeb52']}) } -async function fantomStaking(timestamp, block, chainBlocks) { +async function fantomStaking(timestamp, block, chainBlocks, { api }) { return sumTokens2({ + api, tokensAndOwners: [ ['0xf16e81dce15b08f326220742020379b855b87df9', '0xaE2e07276A77DAdE3378046eEd92FfDE3995b0D5'], // ICE [ADDRESSES.fantom.nICE, '0xBC8d95Ab498502242b41fdaD30bDFfC841f436e2'], // nICE ], - chain: 'fantom', - block: chainBlocks.fantom, }) } // node test.js projects/popsicle/index.js module.exports = { doublecounted: true, - misrepresentedTokens: true, ethereum: { pool2: pool2("ethereum"), tvl: optimizerV3, }, + polygon: { + tvl: optimizerV3, + }, bsc: { pool2: pool2("bsc"), }, From 855a5c99ab35b1fa579a60f4cc06cbecf9185e88 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 24 Jul 2023 09:08:53 +0200 Subject: [PATCH 0478/1974] pulsar: track mantle --- projects/pulsarswap/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/pulsarswap/index.js b/projects/pulsarswap/index.js index cee0ea4ba7b..eca81a5832e 100644 --- a/projects/pulsarswap/index.js +++ b/projects/pulsarswap/index.js @@ -2,6 +2,7 @@ const { sumTokens2 } = require('../helper/unwrapLPs') const config = { arbitrum: '0x336a2f76d2be24e7cb6f468665a4277d4d617d00', ethereum: '0x408f66057163d829a30d4d466092c6b0eebb692f', + mantle: '0xB5B03706C24c79D3F7a368b30562a1711d74F688', } module.exports = {}; From b1b7510b7c6e10e9ca6eb363da0a6f54f2c1f402 Mon Sep 17 00:00:00 2001 From: Autoearn-Finance <129837237+Autoearn-Finance@users.noreply.github.com> Date: Mon, 24 Jul 2023 07:38:28 +0000 Subject: [PATCH 0479/1974] Uptade ATE on both Arbitrum and zkSync chains (#6891) * Uptade ATE on both Arbitrum and zkSync chains * minor fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/ate/index.js | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 projects/ate/index.js diff --git a/projects/ate/index.js b/projects/ate/index.js new file mode 100644 index 00000000000..2ee6b6969a8 --- /dev/null +++ b/projects/ate/index.js @@ -0,0 +1,29 @@ +const { mergeExports } = require("../helper/utils") +const { yieldHelper, } = require("../helper/yieldHelper") + +const farm_arbi = '0x9373da81F82Aba62605a8A03950B9Aa188a02bF7' +const ate_arbi = '0xd5DA32Ad4C7510457C0e46Fa4332F75f6C4C4dC0' +const abis ={ + poolInfo: 'function poolInfo(uint256) view returns (address want, uint256 allocPoint, uint256 lastRewardBlock, uint256 accSushiPerShare, uint256 accAQUAPerShare, uint256 depositFee, uint256 withdrawFee, uint256 amount, uint256 reserve, address strat, address strat1)', +} + +const arbi_helper = yieldHelper({ + project: 'autoearn-finance', + chain: 'arbitrum', + masterchef: farm_arbi, + nativeToken: ate_arbi, + abis, +}) + +const farm_zk = '0x6d90D891A03C32d4082126D0CEe145f3bE62444A' +const ate_zk = '0x8E6D4473031f4B81E19B13C632933a913d4B4F8e' + +const zk_helper = yieldHelper({ + project: 'autoearn-finance-era', + chain: 'era', + masterchef: farm_zk, + nativeToken: ate_zk, + abis, +}) + +module.exports = mergeExports([arbi_helper, zk_helper]) \ No newline at end of file From 235def42d7358f22519ef30a3eda73ecd7b88b8d Mon Sep 17 00:00:00 2001 From: deadline <89900222+web3deadline@users.noreply.github.com> Date: Mon, 24 Jul 2023 15:38:51 +0800 Subject: [PATCH 0480/1974] add zkswap(zksync) (#6892) * add zkswap(zksync) * minor fix --------- Co-authored-by: deadline Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/zkswap-2/index.js | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 projects/zkswap-2/index.js diff --git a/projects/zkswap-2/index.js b/projects/zkswap-2/index.js new file mode 100644 index 00000000000..98b210d6cba --- /dev/null +++ b/projects/zkswap-2/index.js @@ -0,0 +1,9 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +const factory = "0xeeE1Af1CE68D280e9cAfD861B7d4af776798F18d"; +const zks = ""; + +module.exports = { + misrepresentedTokens: true, + era: { tvl: getUniTVL({ factory, useDefaultCoreAssets: true, fetchBalances: true }) }, +}; \ No newline at end of file From 74ae65b035bc1be4b635a359af99a3a36d5109dc Mon Sep 17 00:00:00 2001 From: define Date: Mon, 24 Jul 2023 11:33:32 +0100 Subject: [PATCH 0481/1974] add zk era to autoearn --- projects/autoearn/index.js | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/projects/autoearn/index.js b/projects/autoearn/index.js index 58a3e35c753..2ee6b6969a8 100644 --- a/projects/autoearn/index.js +++ b/projects/autoearn/index.js @@ -1,14 +1,29 @@ +const { mergeExports } = require("../helper/utils") const { yieldHelper, } = require("../helper/yieldHelper") -const farm = '0x9373da81F82Aba62605a8A03950B9Aa188a02bF7' -const ate = '0xd5DA32Ad4C7510457C0e46Fa4332F75f6C4C4dC0' +const farm_arbi = '0x9373da81F82Aba62605a8A03950B9Aa188a02bF7' +const ate_arbi = '0xd5DA32Ad4C7510457C0e46Fa4332F75f6C4C4dC0' +const abis ={ + poolInfo: 'function poolInfo(uint256) view returns (address want, uint256 allocPoint, uint256 lastRewardBlock, uint256 accSushiPerShare, uint256 accAQUAPerShare, uint256 depositFee, uint256 withdrawFee, uint256 amount, uint256 reserve, address strat, address strat1)', +} -module.exports = yieldHelper({ +const arbi_helper = yieldHelper({ project: 'autoearn-finance', chain: 'arbitrum', - masterchef: farm, - nativeToken: ate, - abis: { - poolInfo: 'function poolInfo(uint256) view returns (address want, uint256 allocPoint, uint256 lastRewardBlock, uint256 accSushiPerShare, uint256 accAQUAPerShare, uint256 depositFee, uint256 withdrawFee, uint256 amount, uint256 reserve, address strat, address strat1)', - } + masterchef: farm_arbi, + nativeToken: ate_arbi, + abis, }) + +const farm_zk = '0x6d90D891A03C32d4082126D0CEe145f3bE62444A' +const ate_zk = '0x8E6D4473031f4B81E19B13C632933a913d4B4F8e' + +const zk_helper = yieldHelper({ + project: 'autoearn-finance-era', + chain: 'era', + masterchef: farm_zk, + nativeToken: ate_zk, + abis, +}) + +module.exports = mergeExports([arbi_helper, zk_helper]) \ No newline at end of file From 48df77615cf5ad1c467edb6d5945a78a18100b7e Mon Sep 17 00:00:00 2001 From: define Date: Mon, 24 Jul 2023 14:13:03 +0100 Subject: [PATCH 0482/1974] update kyberswap treasury --- projects/treasury/kyber.js | 48 ++++++++++++++++++++++++++++++++++---- 1 file changed, 44 insertions(+), 4 deletions(-) diff --git a/projects/treasury/kyber.js b/projects/treasury/kyber.js index eca7c7b625c..57722bfb52d 100644 --- a/projects/treasury/kyber.js +++ b/projects/treasury/kyber.js @@ -1,9 +1,49 @@ -const { nullAddress,treasuryExports } = require("../helper/treasury"); +const ADDRESSES = require('../helper/coreAssets.json') +const { treasuryExports } = require("../helper/treasury"); + +const treasury = "0xe6a7338cba0a1070adfb22c07115299605454713" +const treasury2 = "0x91c9d4373b077ef8082f468c7c97f2c499e36f5b" +const knc = "0xdeFA4e8a7bcBA345F687a2f1456F5Edd9CE97202" +const kncarb = "0xe4DDDfe67E7164b0FE14E218d80dC4C08eDC01cB" +const kncop = "0xa00E3A3511aAC35cA78530c85007AFCd31753819" +const kncbsc= "0xfe56d5892BDffC7BF58f2E84BE1b2C32D21C308b" module.exports = treasuryExports({ + ethereum: { + tokens: [ + ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.WETH, + ADDRESSES.ethereum.USDT + + ], + owners: [treasury, treasury2], + ownTokens: [knc], + }, arbitrum: { - tokens: ['0x3F56e0c36d275367b8C502090EDF38289b3dEa0d'], - owners: ['0x91c9d4373b077ef8082f468c7c97f2c499e36f5b'], - ownTokens: ['0xe4dddfe67e7164b0fe14e218d80dc4c08edc01cb'], + tokens: [ + ADDRESSES.arbitrum.ARB, + ADDRESSES.arbitrum.WBTC, + ADDRESSES.arbitrum.USDC, + ADDRESSES.arbitrum.USDC_CIRCLE, + "0x3F56e0c36d275367b8C502090EDF38289b3dEa0d" //MAI + ], + owners: [treasury2], + ownTokens: [kncarb], + }, + optimism: { + tokens: [ + ADDRESSES.optimism.OP, + ADDRESSES.optimism.WETH, + "0x8700dAec35aF8Ff88c16BdF0418774CB3D7599B4" + ], + owners: [treasury2], + ownTokens: [kncop], + }, + bsc: { + tokens: [ + ADDRESSES.bsc.WBNB + ], + owners: [treasury2], + ownTokens: [kncbsc], }, }) \ No newline at end of file From f0e8c76bae189fc9a0b4eb48efc712d440af2a1b Mon Sep 17 00:00:00 2001 From: yashvik <39464729+waverune@users.noreply.github.com> Date: Mon, 24 Jul 2023 19:40:52 +0530 Subject: [PATCH 0483/1974] Timeswap: zkevm chain added (#6893) * timeswap: adds mantle chain * update: polygon_zkevm chain added --- projects/timeswap-v2/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/projects/timeswap-v2/index.js b/projects/timeswap-v2/index.js index 3ec474d73de..d07b58ca7a8 100644 --- a/projects/timeswap-v2/index.js +++ b/projects/timeswap-v2/index.js @@ -80,6 +80,10 @@ const config = { mantle: { factory: "0xf8F5e4B7825d484FBDFDC36fc915E79f30b02f9E", fromBlock: 3563, + }, + polygon_zkevm: { + factory: "0x406d3Dfcbe20b642c2262b29b960822975371502", + fromBlock: 1787343, } }; From a3b645723c1a587650b99c79f449be4704e1a5c6 Mon Sep 17 00:00:00 2001 From: ajak1124 <107387535+ajak1124@users.noreply.github.com> Date: Mon, 24 Jul 2023 22:11:13 +0800 Subject: [PATCH 0484/1974] feat: add tvl of teahouse protocol and teahouse-v3 (#6895) * add tvl of teahouse and teahouse-v3 * minor fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/teahouse-v3/abi.json | 4 +++ projects/teahouse-v3/index.js | 40 ++++++++++++++++++++++++++++ projects/teahouse/abi.json | 6 +++++ projects/teahouse/index.js | 49 +++++++++++++++++++++++++++++++++++ 4 files changed, 99 insertions(+) create mode 100644 projects/teahouse-v3/abi.json create mode 100644 projects/teahouse-v3/index.js create mode 100644 projects/teahouse/abi.json create mode 100644 projects/teahouse/index.js diff --git a/projects/teahouse-v3/abi.json b/projects/teahouse-v3/abi.json new file mode 100644 index 00000000000..b6e21cbcbbb --- /dev/null +++ b/projects/teahouse-v3/abi.json @@ -0,0 +1,4 @@ +{ + "assetToken1": "function assetToken1() view returns (address)", + "estimatedValueIntoken1": "function estimatedValueInToken1() view returns (uint256 value1)" +} diff --git a/projects/teahouse-v3/index.js b/projects/teahouse-v3/index.js new file mode 100644 index 00000000000..25f35be4e02 --- /dev/null +++ b/projects/teahouse-v3/index.js @@ -0,0 +1,40 @@ +const abi = require("./abi.json"); +const { getConfig } = require("../helper/cache"); + +// teahouse public api for vault +const teahouseVaultAPI = "https://vault-content-api.teahouse.finance/vaults"; + +// get vault contract addresses from teahouse api +async function getVaultContractsAddress(chain) { + let plAddress = []; + const { vaults } = await getConfig("teahouse", teahouseVaultAPI); + vaults.forEach((element) => { + // v3 vaults + if (element.isDeFi == true && element.isActive == true) { + if (element.chain === chain) plAddress.push(element.share.address); + } + }); + return plAddress; +} + +const chains = ["ethereum", "optimism", "arbitrum"]; + +chains.forEach((chain) => { + module.exports[chain] = { + tvl: async (_, _b, _cb, { api }) => { + const vaults = await getVaultContractsAddress(chain); + const tokens = await api.multiCall({ + abi: abi.assetToken1, + calls: vaults, + }); + const bals = await api.multiCall({ + abi: abi.estimatedValueIntoken1, + calls: vaults, + }); + api.addTokens(tokens, bals); + return api.getBalances(); + }, + }; +}); + +module.exports.misrepresentedTokens = true \ No newline at end of file diff --git a/projects/teahouse/abi.json b/projects/teahouse/abi.json new file mode 100644 index 00000000000..4ec981ae73f --- /dev/null +++ b/projects/teahouse/abi.json @@ -0,0 +1,6 @@ +{ + "globalState": "function globalState() view returns (uint128 depositLimit, uint128 lockedAssets, uint32 cycleIndex, uint64 cycleStartTimestamp, uint64 fundingLockTimestamp, bool fundClosed)", + "cycleState": "function cycleState(uint32) view returns (uint128 totalFundValue, uint128 fundValueAfterRequests, uint128 requestedDeposits, uint128 convertedDeposits, uint128 requestedWithdrawals, uint128 convertedWithdrawals)", + "asset": "function asset() view returns (address assetTokenAddress)", + "latestAnswer": "function latestAnswer() view returns (int256)" +} diff --git a/projects/teahouse/index.js b/projects/teahouse/index.js new file mode 100644 index 00000000000..62853ef81d4 --- /dev/null +++ b/projects/teahouse/index.js @@ -0,0 +1,49 @@ +const abi = require("./abi.json"); +const { getConfig } = require("../helper/cache"); + +// teahouse public api for vault +const teahouseVaultAPI = "https://vault-content-api.teahouse.finance/vaults"; + +// get vault contract addresses from teahouse api +async function getVaultContractsAddress(chain) { + let htAddress = []; + const { vaults } = await getConfig("teahouse", teahouseVaultAPI); + vaults.forEach((element) => { + // v2 vaults + if (element.isDeFi == false && element.isActive == true) { + if (element.chain === chain) htAddress.push(element.share.address); + } + }); + return htAddress; +} + + +const chains = ["ethereum", "optimism", "arbitrum"]; + +chains.forEach((chain) => { + module.exports[chain] = { + tvl: async (_, _b, _cb, { api }) => { + const vaults = await getVaultContractsAddress(chain); + const tokens = await api.multiCall({ + abi: "address:asset", + calls: vaults, + }); + const cycleIndices = ( + await api.multiCall({ abi: abi.globalState, calls: vaults }) + ).map((i) => i.cycleIndex); + const bals = ( + await api.multiCall({ + abi: abi.cycleState, + calls: vaults.map((vault, i) => ({ + target: vault, + params: cycleIndices[i] - 1, + })), + }) + ).map((i) => i.fundValueAfterRequests); + api.addTokens(tokens, bals); + return api.getBalances(); + }, + }; +}); + +module.exports.misrepresentedTokens = true \ No newline at end of file From ab891e2c8e2f73211cf70ce5b2373b2301e26066 Mon Sep 17 00:00:00 2001 From: Curbis Norris <130688524+curbisn@users.noreply.github.com> Date: Mon, 24 Jul 2023 07:12:29 -0700 Subject: [PATCH 0485/1974] Dexilla: Add Arbitrum contracts (#6894) * add Dexilla project * Update contract * update timestamp * add optimism chain * add V.4 contracts * add zk contracts * add arbitrum contracts --- projects/dexilla/index.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/projects/dexilla/index.js b/projects/dexilla/index.js index 000dd94ee1a..51d677ed509 100644 --- a/projects/dexilla/index.js +++ b/projects/dexilla/index.js @@ -22,6 +22,14 @@ const config = { '0x44F1C33ED3bf77A5883cBEce1c1b34E71425CE84', ], }, + arbitrum: { + exchanges: [ + '0x8ea13d1a455e5c5b425a6fc7260a01265d4c4673', + '0x8C9DBB80f12D0425eAf127FCC1D92FB21Cb4CE4C', + '0x66A724fa0CEB8adfa064afEf5102A2e04E4264c6', + '0x5dD2a1C1Fb25E30928C901a28Ceaf53E59B606dD', + ], + }, } module.exports = { From 140a37bf5e32cc57cf7065d3ac2f1bdd0f5c6ff6 Mon Sep 17 00:00:00 2001 From: define Date: Mon, 24 Jul 2023 15:25:12 +0100 Subject: [PATCH 0486/1974] treasury geth and l2beat --- projects/treasury/geth.js | 15 +++++++++++++++ projects/treasury/l2beat.js | 15 +++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 projects/treasury/geth.js create mode 100644 projects/treasury/l2beat.js diff --git a/projects/treasury/geth.js b/projects/treasury/geth.js new file mode 100644 index 00000000000..f8df4036935 --- /dev/null +++ b/projects/treasury/geth.js @@ -0,0 +1,15 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { treasuryExports } = require("../helper/treasury"); + +const treasury = "0x21539334f45Ac41Bd10789942b744a18a4775d6d" // + +module.exports = treasuryExports({ + optimism: { + tokens: [ + ADDRESSES.optimism.OP, + ADDRESSES.optimism.WETH + ], + owners: [treasury], + }, + +}) \ No newline at end of file diff --git a/projects/treasury/l2beat.js b/projects/treasury/l2beat.js new file mode 100644 index 00000000000..4b9b5bac739 --- /dev/null +++ b/projects/treasury/l2beat.js @@ -0,0 +1,15 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { treasuryExports } = require("../helper/treasury"); + +const treasury = "0xea78912803be5e356eac2b8e127d4ba87230a48e" // + +module.exports = treasuryExports({ + optimism: { + tokens: [ + ADDRESSES.optimism.OP, + ADDRESSES.optimism.WETH + ], + owners: [treasury], + }, + +}) \ No newline at end of file From 749416937a71f51ec58e1ef2f19d39f4184b9f26 Mon Sep 17 00:00:00 2001 From: Marcin Ciarka Date: Mon, 24 Jul 2023 16:32:25 +0200 Subject: [PATCH 0487/1974] =?UTF-8?q?=E2=98=80=EF=B8=8F=20Summer.fi=20TVL?= =?UTF-8?q?=20adapter=20(#6820)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * automation adapter work * modularize * better events / cdp list handling * rm fs * dpm adapter * rearrange the files * disable regular maker vaults TVL * ajna borrowish positions * maker tvl with confirmed vaults * ajna earn positions * include block height in automation and maker vaults * add block param to the dpm handler * minor fix --------- Co-authored-by: Piotr Konowrocki Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/helper/env.js | 3 + projects/summer-fi/constants/abi.js | 17 +++ projects/summer-fi/constants/contracts.js | 6 + .../summer-fi/constants/creation-blocks.js | 5 + projects/summer-fi/constants/endpoints.js | 11 ++ projects/summer-fi/constants/index.js | 11 ++ projects/summer-fi/constants/logs-topic.js | 8 ++ projects/summer-fi/handlers/automation-v1.js | 30 +++++ projects/summer-fi/handlers/dpm-positions.js | 108 ++++++++++++++++++ projects/summer-fi/handlers/index.js | 9 ++ projects/summer-fi/handlers/maker-vaults.js | 45 ++++++++ projects/summer-fi/helpers/calls.js | 29 +++++ .../helpers/get-automation-cdp-ids.js | 53 +++++++++ projects/summer-fi/helpers/index.js | 13 +++ projects/summer-fi/index.js | 25 ++++ 15 files changed, 373 insertions(+) create mode 100644 projects/summer-fi/constants/abi.js create mode 100644 projects/summer-fi/constants/contracts.js create mode 100644 projects/summer-fi/constants/creation-blocks.js create mode 100644 projects/summer-fi/constants/endpoints.js create mode 100644 projects/summer-fi/constants/index.js create mode 100644 projects/summer-fi/constants/logs-topic.js create mode 100644 projects/summer-fi/handlers/automation-v1.js create mode 100644 projects/summer-fi/handlers/dpm-positions.js create mode 100644 projects/summer-fi/handlers/index.js create mode 100644 projects/summer-fi/handlers/maker-vaults.js create mode 100644 projects/summer-fi/helpers/calls.js create mode 100644 projects/summer-fi/helpers/get-automation-cdp-ids.js create mode 100644 projects/summer-fi/helpers/index.js create mode 100644 projects/summer-fi/index.js diff --git a/projects/helper/env.js b/projects/helper/env.js index 9b13bdebfac..4982ec6c8d0 100644 --- a/projects/helper/env.js +++ b/projects/helper/env.js @@ -18,6 +18,9 @@ const ENV_KEYS = [ 'GETBLOCK_KEY', 'LOFTY_API', 'OLYMPUS_GRAPH_API_KEY', + 'SUMMER_HISTORY_ENDPOINT', + 'SUMMER_AJNA_ENDPOINT', + 'SUMMER_CONFIRMED_VAULTS_ENDPOINT', ] Object.keys(DEFAULTS).forEach(i => { diff --git a/projects/summer-fi/constants/abi.js b/projects/summer-fi/constants/abi.js new file mode 100644 index 00000000000..aa69665e9b6 --- /dev/null +++ b/projects/summer-fi/constants/abi.js @@ -0,0 +1,17 @@ +module.exports = { + TriggerAdded: + "event TriggerAdded(uint256 indexed triggerId, address indexed commandAddress, uint256 indexed cdpId, bytes triggerData)", + TriggerExecuted: + "event TriggerExecuted(uint256 indexed triggerId, uint256 indexed cdpId, bytes executionData)", + TriggerRemoved: + "event TriggerRemoved(uint256 indexed cdpId, uint256 indexed triggerId)", + activeTriggers: + "function activeTriggers(uint256) view returns (bytes32 triggerHash, uint256 cdpId)", + self: "address:self", + serviceRegistry: "address:serviceRegistry", + triggersCounter: "uint256:triggersCounter", + getVaultInfo: + "function getVaultInfo(uint256 vaultId) view returns (uint256 collateralLocked, uint256)", + ilks: "function ilks(uint256) view returns (bytes32)", + info: "function info(bytes32 ilk) view returns (string name, string symbol, uint256 class, uint256 dec, address gem, address pip, address join, address xlip)", +}; diff --git a/projects/summer-fi/constants/contracts.js b/projects/summer-fi/constants/contracts.js new file mode 100644 index 00000000000..1e71a703eea --- /dev/null +++ b/projects/summer-fi/constants/contracts.js @@ -0,0 +1,6 @@ +module.exports = { + AutomationV1Contract: "0x6E87a7A0A03E51A741075fDf4D1FCce39a4Df01b", + McdView: "0x6FBef01dd5B8e85b19733AB2A8e243FA3870623B", + CdpManager: "0x5ef30b9986345249bc32d8928b7ee64de9435e39", + IlkRegistry: "0x5a464c28d19848f44199d003bef5ecc87d090f87", +}; diff --git a/projects/summer-fi/constants/creation-blocks.js b/projects/summer-fi/constants/creation-blocks.js new file mode 100644 index 00000000000..be10d07edc4 --- /dev/null +++ b/projects/summer-fi/constants/creation-blocks.js @@ -0,0 +1,5 @@ +const creationBlocks = { + AutomationV1Contract: 14583413, +}; + +module.exports = creationBlocks; diff --git a/projects/summer-fi/constants/endpoints.js b/projects/summer-fi/constants/endpoints.js new file mode 100644 index 00000000000..fade9273d9c --- /dev/null +++ b/projects/summer-fi/constants/endpoints.js @@ -0,0 +1,11 @@ +const { getEnv } = require("../../helper/env"); + +const endpoints = { + aave: getEnv("SUMMER_HISTORY_ENDPOINT"), + ajna: getEnv("SUMMER_AJNA_ENDPOINT"), + makerVaults: getEnv("SUMMER_CONFIRMED_VAULTS_ENDPOINT"), +}; + +module.exports = { + endpoints, +}; diff --git a/projects/summer-fi/constants/index.js b/projects/summer-fi/constants/index.js new file mode 100644 index 00000000000..382d9642311 --- /dev/null +++ b/projects/summer-fi/constants/index.js @@ -0,0 +1,11 @@ +const creationBlocks = require("./creation-blocks"); +const abi = require("./abi"); +const contracts = require("./contracts"); +const logsTopic = require("./logs-topic"); + +module.exports = { + creationBlocks, + abi, + contracts, + logsTopic, +}; diff --git a/projects/summer-fi/constants/logs-topic.js b/projects/summer-fi/constants/logs-topic.js new file mode 100644 index 00000000000..46580cecb3a --- /dev/null +++ b/projects/summer-fi/constants/logs-topic.js @@ -0,0 +1,8 @@ +module.exports = { + TriggerAdded: + "0xcb616360dd177f28577e33576c8ac7ffcc1008cba7ac2323e0b2f170faf60bd2", + TriggerExecuted: + "0xc10f224f2f1ceab5e36f97effaa05c4b75eccbecd77b65bfb20c484de9096cdd", + TriggerRemoved: + "0xb4a1fc324bd863f8cd42582bebf2ce7f2d309c6a84bf371f28e069f95a4fa9e1", +}; diff --git a/projects/summer-fi/handlers/automation-v1.js b/projects/summer-fi/handlers/automation-v1.js new file mode 100644 index 00000000000..6b20fbb9035 --- /dev/null +++ b/projects/summer-fi/handlers/automation-v1.js @@ -0,0 +1,30 @@ +const { + getCdpData, + getCdpManagerData, + getIlkRegistryData, +} = require("../helpers"); + +const automationTvl = async ({ api, cdpIdList }) => { + let positionsWithTriggersAndCollateral = 0; + + const cdpIds = [...cdpIdList]; + const ilkNames = await getCdpManagerData(cdpIds, api); + const ilkIds = [...new Set(ilkNames)]; + const tokens = (await getIlkRegistryData(ilkIds, api)).map((i) => i.gem); + const decimals = await api.multiCall({ + abi: "erc20:decimals", + calls: tokens, + }); + const collData = await getCdpData(cdpIds, api); + collData.forEach(({ collateralLocked }, i) => { + if (collateralLocked > 0) { + positionsWithTriggersAndCollateral++; + } + const idx = ilkIds.indexOf(ilkNames[i]); + api.add(tokens[idx], collateralLocked / 10 ** (18 - decimals[idx])); + }); +}; + +module.exports = { + automationTvl, +}; diff --git a/projects/summer-fi/handlers/dpm-positions.js b/projects/summer-fi/handlers/dpm-positions.js new file mode 100644 index 00000000000..09d35a81a05 --- /dev/null +++ b/projects/summer-fi/handlers/dpm-positions.js @@ -0,0 +1,108 @@ +const BigNumber = require("bignumber.js"); +const { blockQuery } = require("../../helper/http"); +const { endpoints } = require("../constants/endpoints"); + +const NEGATIVE_WAD_PRECISION = -18; +const WETH_ADDRESS = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"; + +const aaveQuery = (block) => ` +query { + positions(first: 10000, where: { + and: [ + { collateral_gt: 0 }, + { or: [{ protocol: "AAVE" }, { protocol: "AAVE_V3" }] } + ] + }, block: { number: ${block} }) { + collateral + collateralAddress + } +}`; + +const ajnaQuery = (block) => ` +query { + accounts(first: 10000, where: { + and: [ + { isDPM: true }, + { protocol: "Ajna" }, + ] + }, block: { number: ${block} }) { + collateralToken + borrowPositions { + collateral + } + pool { + address + } + } + pools(block: { number: ${block} }) { + address + depositSize + debt + quoteTokenAddress + } +}`; + +const dpmPositions = async ({ api, block }) => { + const aave = await blockQuery(endpoints.aave, aaveQuery(block), { api }); + const ajna = await blockQuery(endpoints.ajna, ajnaQuery(block), { api }); + + const supportedAjnaPools = [ + ...new Set(ajna.accounts.map(({ pool: { address } }) => address)), + ]; + + const aaveBorrowishPositions = aave.positions.map( + ({ collateral, collateralAddress }) => ({ + collateral: new BigNumber(collateral), + collateralAddress, + }) + ); + const ajnaBorrowishPositions = ajna.accounts + .filter(({ borrowPositions }) => borrowPositions.length) + .map(({ borrowPositions: [{ collateral }], collateralToken }) => ({ + collateral: new BigNumber(collateral).shiftedBy(NEGATIVE_WAD_PRECISION), + collateralAddress: collateralToken, + })); + const ajnaEarnPositions = ajna.pools + .filter(({ address }) => supportedAjnaPools.includes(address)) + .map(({ debt, depositSize, quoteTokenAddress }) => ({ + collateral: new BigNumber(depositSize) + .minus(new BigNumber(debt)) + .shiftedBy(NEGATIVE_WAD_PRECISION), + collateralAddress: quoteTokenAddress, + })); + + const tokensWithAmounts = [ + ...aaveBorrowishPositions, + ...ajnaBorrowishPositions, + ...ajnaEarnPositions, + ].reduce( + (total, { collateral, collateralAddress }) => ({ + ...total, + [collateralAddress]: total[collateralAddress] + ? total[collateralAddress].plus(collateral) + : collateral, + }), + {} + ); + + const fallbackDecimal = await api.call({ + abi: "erc20:decimals", + target: WETH_ADDRESS, + }); + const decimals = await api.multiCall({ + abi: "erc20:decimals", + calls: Object.keys(tokensWithAmounts), + }); + + Object.keys(tokensWithAmounts).forEach((collateralAddress, i) => { + api.add( + collateralAddress, + tokensWithAmounts[collateralAddress].toNumber() * + 10 ** (decimals[i] || fallbackDecimal) + ); + }); +}; + +module.exports = { + dpmPositions, +}; diff --git a/projects/summer-fi/handlers/index.js b/projects/summer-fi/handlers/index.js new file mode 100644 index 00000000000..d0ebe456ac3 --- /dev/null +++ b/projects/summer-fi/handlers/index.js @@ -0,0 +1,9 @@ +const { automationTvl } = require("./automation-v1"); +const { dpmPositions } = require("./dpm-positions"); +const { makerTvl } = require("./maker-vaults"); + +module.exports = { + automationTvl, + dpmPositions, + makerTvl, +}; diff --git a/projects/summer-fi/handlers/maker-vaults.js b/projects/summer-fi/handlers/maker-vaults.js new file mode 100644 index 00000000000..c1224690874 --- /dev/null +++ b/projects/summer-fi/handlers/maker-vaults.js @@ -0,0 +1,45 @@ +const { + getCdpData, + getCdpManagerData, + getIlkRegistryData, +} = require("../helpers"); +const { get } = require("../../helper/http"); +const { endpoints } = require("../constants/endpoints"); + +const makerTvl = async ({ api, cdpIdList, block }) => { + const confirmedSummerFiMakerVaults = await get(endpoints.makerVaults); + const confirmedSummerFiMakerVaultsArray = [ + ...Object.keys(confirmedSummerFiMakerVaults), + ]; + const confirmedSummerFiMakerVaultsSet = new Set( + confirmedSummerFiMakerVaultsArray + ); + cdpIdList.forEach((cdpId) => { + confirmedSummerFiMakerVaultsSet.delete(cdpId); + }); + const filteredVaultsList = [...confirmedSummerFiMakerVaultsSet].filter( + (i) => block >= confirmedSummerFiMakerVaults[i] + ); + const ilkNames = await getCdpManagerData( + [...new Set(filteredVaultsList)], + api + ); + const ilkIds = [...new Set(ilkNames)]; + const tokens = (await getIlkRegistryData(ilkIds, api)).map((i) => i.gem); + const decimals = await api.multiCall({ + abi: "erc20:decimals", + calls: tokens, + }); + const collData = await getCdpData(filteredVaultsList, api); + collData.forEach(({ collateralLocked }, i) => { + const idx = ilkIds.indexOf(ilkNames[i]); + if (idx === -1) { + return; + } + api.add(tokens[idx], collateralLocked / 10 ** (18 - decimals[idx])); + }); +}; + +module.exports = { + makerTvl, +}; diff --git a/projects/summer-fi/helpers/calls.js b/projects/summer-fi/helpers/calls.js new file mode 100644 index 00000000000..0b4bd0ac868 --- /dev/null +++ b/projects/summer-fi/helpers/calls.js @@ -0,0 +1,29 @@ +const abi = require("../constants/abi.js"); +const contracts = require("../constants/contracts.js"); + +const getCdpData = async (cdpIds, api) => + api.multiCall({ + abi: abi.getVaultInfo, + target: contracts.McdView, + calls: cdpIds, + }); + +const getCdpManagerData = async (cdpIds, api) => + api.multiCall({ + abi: abi.ilks, + target: contracts.CdpManager, + calls: cdpIds, + }); + +const getIlkRegistryData = async (ilks, api) => + api.multiCall({ + abi: abi.info, + target: contracts.IlkRegistry, + calls: ilks, + }); + +module.exports = { + getCdpData, + getCdpManagerData, + getIlkRegistryData, +}; diff --git a/projects/summer-fi/helpers/get-automation-cdp-ids.js b/projects/summer-fi/helpers/get-automation-cdp-ids.js new file mode 100644 index 00000000000..07dad771e18 --- /dev/null +++ b/projects/summer-fi/helpers/get-automation-cdp-ids.js @@ -0,0 +1,53 @@ +const { getLogs } = require("../../helper/cache/getLogs"); + +const { abi, contracts, logsTopic, creationBlocks } = require("../constants"); + +const getAutomationCdpIdList = async ({ api, block }) => { + const cdpIdList = new Set(); + const [triggerAddedEvents, triggerRemovedEvents, triggerExecutedEvents] = + await Promise.all( + Object.keys(logsTopic).map((key) => + getLogs({ + api, + fromBlock: creationBlocks.AutomationV1Contract, + toBlock: block, + target: contracts.AutomationV1Contract, + topics: [logsTopic[key]], + eventAbi: abi[key], + extraKey: key, + onlyArgs: true, + }) + ) + ); + const triggerEvents = [ + ...triggerAddedEvents.map((event) => ({ + cdp: event.cdpId.toString(), + trigger: event.triggerId.toString(), + action: "triggerAdded", + })), + ...triggerRemovedEvents.map((event) => ({ + cdp: event.cdpId.toString(), + trigger: event.triggerId.toString(), + action: "triggerRemoved", + })), + ...triggerExecutedEvents.map((event) => ({ + cdp: event.cdpId.toString(), + trigger: event.triggerId.toString(), + action: "triggerExecuted", + })), + ].sort((a, b) => a.trigger - b.trigger); + + triggerEvents.forEach((event) => { + const { cdp, action } = event; + if (action === "triggerAdded") { + cdpIdList.add(cdp); + } else if (action === "triggerRemoved" || action === "triggerExecuted") { + cdpIdList.delete(cdp); + } + }); + return cdpIdList; +}; + +module.exports = { + getAutomationCdpIdList, +}; diff --git a/projects/summer-fi/helpers/index.js b/projects/summer-fi/helpers/index.js new file mode 100644 index 00000000000..0a8157d5c8a --- /dev/null +++ b/projects/summer-fi/helpers/index.js @@ -0,0 +1,13 @@ +const { getAutomationCdpIdList } = require("./get-automation-cdp-ids"); +const { + getCdpData, + getCdpManagerData, + getIlkRegistryData, +} = require("./calls"); + +module.exports = { + getAutomationCdpIdList, + getCdpData, + getCdpManagerData, + getIlkRegistryData, +}; diff --git a/projects/summer-fi/index.js b/projects/summer-fi/index.js new file mode 100644 index 00000000000..b100ac3b50e --- /dev/null +++ b/projects/summer-fi/index.js @@ -0,0 +1,25 @@ +const { automationTvl, dpmPositions, makerTvl } = require("./handlers"); +const { getAutomationCdpIdList } = require("./helpers"); + +module.exports = { + doublecounted: true, + ethereum: { + tvl, + }, +}; + +async function tvl( + timestamp, + block, + { ethereum: ethereumBlockHeight }, // not used, but included for clarity + { api } +) { + const executionStart = Date.now() / 1000; + const cdpIdList = await getAutomationCdpIdList({ api, block }); + await Promise.all([ + dpmPositions({ api, block }), + automationTvl({ api, cdpIdList }), + makerTvl({ api, cdpIdList, block }), + ]); + console.log("Execution time", Date.now() / 1000 - executionStart, "seconds"); +} From 73cdd26d6f54370dc28f4907f64306d665a17608 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 24 Jul 2023 18:03:19 +0200 Subject: [PATCH 0488/1974] summer-fi: code refactor --- projects/summer-fi/handlers/dpm-positions.js | 6 +++--- projects/summer-fi/handlers/maker-vaults.js | 7 ++----- projects/summer-fi/helpers/calls.js | 21 +++++++++++++------ .../helpers/get-automation-cdp-ids.js | 3 +-- projects/summer-fi/index.js | 17 +++++++++++---- 5 files changed, 34 insertions(+), 20 deletions(-) diff --git a/projects/summer-fi/handlers/dpm-positions.js b/projects/summer-fi/handlers/dpm-positions.js index 09d35a81a05..a77cf2423fb 100644 --- a/projects/summer-fi/handlers/dpm-positions.js +++ b/projects/summer-fi/handlers/dpm-positions.js @@ -42,9 +42,9 @@ query { } }`; -const dpmPositions = async ({ api, block }) => { - const aave = await blockQuery(endpoints.aave, aaveQuery(block), { api }); - const ajna = await blockQuery(endpoints.ajna, ajnaQuery(block), { api }); +const dpmPositions = async ({ api, }) => { + const aave = await blockQuery(endpoints.aave, aaveQuery(api.block), { api }); + const ajna = await blockQuery(endpoints.ajna, ajnaQuery(api.block), { api }); const supportedAjnaPools = [ ...new Set(ajna.accounts.map(({ pool: { address } }) => address)), diff --git a/projects/summer-fi/handlers/maker-vaults.js b/projects/summer-fi/handlers/maker-vaults.js index c1224690874..a34c83ab133 100644 --- a/projects/summer-fi/handlers/maker-vaults.js +++ b/projects/summer-fi/handlers/maker-vaults.js @@ -3,11 +3,8 @@ const { getCdpManagerData, getIlkRegistryData, } = require("../helpers"); -const { get } = require("../../helper/http"); -const { endpoints } = require("../constants/endpoints"); -const makerTvl = async ({ api, cdpIdList, block }) => { - const confirmedSummerFiMakerVaults = await get(endpoints.makerVaults); +const makerTvl = async ({ api, cdpIdList, confirmedSummerFiMakerVaults }) => { const confirmedSummerFiMakerVaultsArray = [ ...Object.keys(confirmedSummerFiMakerVaults), ]; @@ -18,7 +15,7 @@ const makerTvl = async ({ api, cdpIdList, block }) => { confirmedSummerFiMakerVaultsSet.delete(cdpId); }); const filteredVaultsList = [...confirmedSummerFiMakerVaultsSet].filter( - (i) => block >= confirmedSummerFiMakerVaults[i] + (i) => api.block >= confirmedSummerFiMakerVaults[i] ); const ilkNames = await getCdpManagerData( [...new Set(filteredVaultsList)], diff --git a/projects/summer-fi/helpers/calls.js b/projects/summer-fi/helpers/calls.js index 0b4bd0ac868..4bf6b0bf30a 100644 --- a/projects/summer-fi/helpers/calls.js +++ b/projects/summer-fi/helpers/calls.js @@ -1,12 +1,21 @@ +const { sliceIntoChunks } = require("@defillama/sdk/build/util/index.js"); const abi = require("../constants/abi.js"); const contracts = require("../constants/contracts.js"); -const getCdpData = async (cdpIds, api) => - api.multiCall({ - abi: abi.getVaultInfo, - target: contracts.McdView, - calls: cdpIds, - }); +const getCdpData = async (cdpIds, api) => { + sdk.log(cdpIds.length, 'cdpIds') + const res = [] + const chunks = sliceIntoChunks(cdpIds, 25) + for (const chunk of chunks) + res.push(...await api.multiCall({ + abi: abi.getVaultInfo, + target: contracts.McdView, + calls: chunk, + })) + ; + + return res +} const getCdpManagerData = async (cdpIds, api) => api.multiCall({ diff --git a/projects/summer-fi/helpers/get-automation-cdp-ids.js b/projects/summer-fi/helpers/get-automation-cdp-ids.js index 07dad771e18..6df1731a7fb 100644 --- a/projects/summer-fi/helpers/get-automation-cdp-ids.js +++ b/projects/summer-fi/helpers/get-automation-cdp-ids.js @@ -2,7 +2,7 @@ const { getLogs } = require("../../helper/cache/getLogs"); const { abi, contracts, logsTopic, creationBlocks } = require("../constants"); -const getAutomationCdpIdList = async ({ api, block }) => { +const getAutomationCdpIdList = async ({ api }) => { const cdpIdList = new Set(); const [triggerAddedEvents, triggerRemovedEvents, triggerExecutedEvents] = await Promise.all( @@ -10,7 +10,6 @@ const getAutomationCdpIdList = async ({ api, block }) => { getLogs({ api, fromBlock: creationBlocks.AutomationV1Contract, - toBlock: block, target: contracts.AutomationV1Contract, topics: [logsTopic[key]], eventAbi: abi[key], diff --git a/projects/summer-fi/index.js b/projects/summer-fi/index.js index b100ac3b50e..7d129dd29af 100644 --- a/projects/summer-fi/index.js +++ b/projects/summer-fi/index.js @@ -1,5 +1,8 @@ const { automationTvl, dpmPositions, makerTvl } = require("./handlers"); const { getAutomationCdpIdList } = require("./helpers"); +const sdk = require('@defillama/sdk') +const { getConfig } = require("../helper/cache"); +const { endpoints } = require("./constants/endpoints"); module.exports = { doublecounted: true, @@ -14,12 +17,18 @@ async function tvl( { ethereum: ethereumBlockHeight }, // not used, but included for clarity { api } ) { + await api.getBlock() const executionStart = Date.now() / 1000; - const cdpIdList = await getAutomationCdpIdList({ api, block }); + const confirmedSummerFiMakerVaults = await getConfig('summer-fi/maker-vaults', endpoints.makerVaults) + const cdpIdList = await getAutomationCdpIdList({ api }); + + sdk.log([...cdpIdList].length, 'cdpIdList') + await Promise.all([ - dpmPositions({ api, block }), + dpmPositions({ api }), automationTvl({ api, cdpIdList }), - makerTvl({ api, cdpIdList, block }), + makerTvl({ api, cdpIdList, confirmedSummerFiMakerVaults, }), ]); - console.log("Execution time", Date.now() / 1000 - executionStart, "seconds"); + + sdk.log("Execution time", Date.now() / 1000 - executionStart, "seconds"); } From 5e057c801c96f437587f7a59d9f7d1d423ba76d5 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 24 Jul 2023 20:59:46 +0200 Subject: [PATCH 0489/1974] bugfix --- projects/summer-fi/helpers/calls.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/summer-fi/helpers/calls.js b/projects/summer-fi/helpers/calls.js index 4bf6b0bf30a..19d997ae268 100644 --- a/projects/summer-fi/helpers/calls.js +++ b/projects/summer-fi/helpers/calls.js @@ -1,6 +1,7 @@ const { sliceIntoChunks } = require("@defillama/sdk/build/util/index.js"); const abi = require("../constants/abi.js"); const contracts = require("../constants/contracts.js"); +const sdk = require('@defillama/sdk') const getCdpData = async (cdpIds, api) => { sdk.log(cdpIds.length, 'cdpIds') From 7b1e461442177ca025622c33f49d4d480114487d Mon Sep 17 00:00:00 2001 From: Rubydex <118339704+Rubydex@users.noreply.github.com> Date: Tue, 25 Jul 2023 03:27:55 +0800 Subject: [PATCH 0490/1974] add two chains (#6902) * add bsc chain * add 2 chains --------- Co-authored-by: robert --- projects/rubydex/index.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/projects/rubydex/index.js b/projects/rubydex/index.js index bc06531bbe3..59164aa6d8b 100644 --- a/projects/rubydex/index.js +++ b/projects/rubydex/index.js @@ -2,6 +2,8 @@ const ADDRESSES = require('../helper/coreAssets.json') const { sumTokensExport } = require('../helper/unwrapLPs'); const VAULT_ARBITRUM = '0x4a7c10780afdba628332e31c9e7d1675cfad594c'; const VAULT_BSC = '0xedB6CD4fdd2F465d2234f978276F9Ed2EE02102c'; +const VAULT_ZKSYNC_ERA = '0x211ac72f3ee4a35523B41aA8D67644E1eF860059'; +const VAULT_ETHEREUM = '0x1DE35eB48f92Fb38dee51041AAE86FFf18029E90'; module.exports = { methodology: 'USDT tokens held by the RubyDex Vault contract.', @@ -10,5 +12,11 @@ module.exports = { }, bsc: { tvl: sumTokensExport({ owner: VAULT_BSC, tokens: [ADDRESSES.bsc.USDT] }), - } + }, + era: { + tvl: sumTokensExport({ owner: VAULT_ZKSYNC_ERA, tokens: [ADDRESSES.era.USDT] }), + }, + ethereum: { + tvl: sumTokensExport({ owner: VAULT_ETHEREUM, tokens: [ADDRESSES.ethereum.USDT] }), + }, }; From 3827882796de0d850e0399aac0fc0d73013c5b38 Mon Sep 17 00:00:00 2001 From: define Date: Tue, 25 Jul 2023 10:25:20 +0100 Subject: [PATCH 0491/1974] fix ethereum chain davos protocol --- projects/davos-protocol/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/davos-protocol/index.js b/projects/davos-protocol/index.js index f4f6b47fe8d..9b077e3ad9a 100644 --- a/projects/davos-protocol/index.js +++ b/projects/davos-protocol/index.js @@ -9,11 +9,12 @@ module.exports = { ] }), }, ethereum: { - tvl: sumTokensExport({ chain: 'ethereum', owner: '0x819d1Daa794c1c46B841981b61cC978d95A17b8e', tokens: [ + tvl: sumTokensExport({ chain: 'ethereum', owners: ['0x97f0BdaDbfAA05a1944fFbA862b3336a175056cF', '0xc7b219a9A8e246f9C4d4A1c7d4a371F0840ff724', '0x0730BA2252670Cd71580dadf471f3E137592e800', '0xb396b31599333739A97951b74652c117BE86eE1D', '0x7281d1bCcbe34574Ee6507b3f4816AFBe85A2e3d'], tokens: [ ADDRESSES.ethereum.WSTETH, ADDRESSES.ethereum.RETH, '0x9ee91f9f426fa633d227f7a9b000e28b9dfd8599', //stmatic ADDRESSES.ethereum.sfrxETH, + ADDRESSES.ethereum.MATIC ] }), } } From f3b0050d44c70e18364823b3962da742ae276823 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 25 Jul 2023 12:28:38 +0200 Subject: [PATCH 0492/1974] summer-fi: cache responses --- projects/summer-fi/constants/contracts.js | 2 +- projects/summer-fi/handlers/automation-v1.js | 8 +- projects/summer-fi/handlers/maker-vaults.js | 5 +- projects/summer-fi/helpers/calls.js | 82 ++++++++++++++++---- projects/summer-fi/helpers/index.js | 4 + projects/summer-fi/index.js | 27 ++++--- 6 files changed, 90 insertions(+), 38 deletions(-) diff --git a/projects/summer-fi/constants/contracts.js b/projects/summer-fi/constants/contracts.js index 1e71a703eea..52c475bf9b3 100644 --- a/projects/summer-fi/constants/contracts.js +++ b/projects/summer-fi/constants/contracts.js @@ -1,6 +1,6 @@ module.exports = { AutomationV1Contract: "0x6E87a7A0A03E51A741075fDf4D1FCce39a4Df01b", - McdView: "0x6FBef01dd5B8e85b19733AB2A8e243FA3870623B", + McdView: "0x55Dc2Be8020bCa72E58e665dC931E03B749ea5E0", CdpManager: "0x5ef30b9986345249bc32d8928b7ee64de9435e39", IlkRegistry: "0x5a464c28d19848f44199d003bef5ecc87d090f87", }; diff --git a/projects/summer-fi/handlers/automation-v1.js b/projects/summer-fi/handlers/automation-v1.js index 6b20fbb9035..65d401ac90a 100644 --- a/projects/summer-fi/handlers/automation-v1.js +++ b/projects/summer-fi/handlers/automation-v1.js @@ -2,6 +2,7 @@ const { getCdpData, getCdpManagerData, getIlkRegistryData, + getDecimalsData, } = require("../helpers"); const automationTvl = async ({ api, cdpIdList }) => { @@ -10,11 +11,8 @@ const automationTvl = async ({ api, cdpIdList }) => { const cdpIds = [...cdpIdList]; const ilkNames = await getCdpManagerData(cdpIds, api); const ilkIds = [...new Set(ilkNames)]; - const tokens = (await getIlkRegistryData(ilkIds, api)).map((i) => i.gem); - const decimals = await api.multiCall({ - abi: "erc20:decimals", - calls: tokens, - }); + const tokens = (await getIlkRegistryData(ilkIds, api)).map((i) => i[4]); + const decimals = await getDecimalsData(tokens, api); const collData = await getCdpData(cdpIds, api); collData.forEach(({ collateralLocked }, i) => { if (collateralLocked > 0) { diff --git a/projects/summer-fi/handlers/maker-vaults.js b/projects/summer-fi/handlers/maker-vaults.js index a34c83ab133..18844419840 100644 --- a/projects/summer-fi/handlers/maker-vaults.js +++ b/projects/summer-fi/handlers/maker-vaults.js @@ -11,9 +11,10 @@ const makerTvl = async ({ api, cdpIdList, confirmedSummerFiMakerVaults }) => { const confirmedSummerFiMakerVaultsSet = new Set( confirmedSummerFiMakerVaultsArray ); - cdpIdList.forEach((cdpId) => { + ([...cdpIdList]).forEach((cdpId) => { confirmedSummerFiMakerVaultsSet.delete(cdpId); }); + const filteredVaultsList = [...confirmedSummerFiMakerVaultsSet].filter( (i) => api.block >= confirmedSummerFiMakerVaults[i] ); @@ -22,7 +23,7 @@ const makerTvl = async ({ api, cdpIdList, confirmedSummerFiMakerVaults }) => { api ); const ilkIds = [...new Set(ilkNames)]; - const tokens = (await getIlkRegistryData(ilkIds, api)).map((i) => i.gem); + const tokens = (await getIlkRegistryData(ilkIds, api)).map((i) => i[4]); const decimals = await api.multiCall({ abi: "erc20:decimals", calls: tokens, diff --git a/projects/summer-fi/helpers/calls.js b/projects/summer-fi/helpers/calls.js index 19d997ae268..58f22f7ae2d 100644 --- a/projects/summer-fi/helpers/calls.js +++ b/projects/summer-fi/helpers/calls.js @@ -4,36 +4,86 @@ const contracts = require("../constants/contracts.js"); const sdk = require('@defillama/sdk') const getCdpData = async (cdpIds, api) => { - sdk.log(cdpIds.length, 'cdpIds') const res = [] - const chunks = sliceIntoChunks(cdpIds, 25) - for (const chunk of chunks) + const chunks = sliceIntoChunks(cdpIds, 100) + for (const chunk of chunks) res.push(...await api.multiCall({ abi: abi.getVaultInfo, target: contracts.McdView, calls: chunk, })) - ; return res } -const getCdpManagerData = async (cdpIds, api) => - api.multiCall({ - abi: abi.ilks, - target: contracts.CdpManager, - calls: cdpIds, - }); +const getCdpManagerData = async (cdpIds, api) => { + return cachedCalls({ + items: cdpIds, + multiCall: async calls => api.multiCall({ + abi: abi.ilks, + target: contracts.CdpManager, + calls, + }), + key: 'getCdpManagerData', + }) +} + +const getIlkRegistryData = async (ilks, api) => { + return cachedCalls({ + items: ilks, + multiCall: async calls => api.multiCall({ + abi: abi.info, + target: contracts.IlkRegistry, + calls, + }), + key: 'getIlkRegistryData', + }) +} -const getIlkRegistryData = async (ilks, api) => - api.multiCall({ - abi: abi.info, - target: contracts.IlkRegistry, - calls: ilks, - }); +const getDecimalsData = async (tokens, api) => { + return cachedCalls({ + items: tokens, + multiCall: async calls => api.multiCall({ + abi: 'erc20:decimals', + calls, + }), + key: 'getDecimalsData', + }) +} + +let cache = {} +function setCallCache(_cache) { + cache = _cache +} + +async function cachedCalls({ items, multiCall, key }) { + if (!cache[key]) cache[key] = {} + const res = [] + const missingIds = [] + const missingIndices = [] + items.forEach((id, i) => { + if (cache[key][id]) res[i] = cache[key][id] + else { + missingIds.push(id) + missingIndices.push(i) + } + }) + + if (missingIds.length) { + sdk.log('Missing ids', missingIds.length, 'key', key) + const tempRes = await multiCall(missingIds); + missingIds.forEach((id, i) => { + res[missingIndices[i]] = tempRes[i] + cache[key][id] = tempRes[i] + }) + } + return res +} module.exports = { getCdpData, getCdpManagerData, getIlkRegistryData, + getDecimalsData, + setCallCache, }; diff --git a/projects/summer-fi/helpers/index.js b/projects/summer-fi/helpers/index.js index 0a8157d5c8a..ccad34a095d 100644 --- a/projects/summer-fi/helpers/index.js +++ b/projects/summer-fi/helpers/index.js @@ -3,11 +3,15 @@ const { getCdpData, getCdpManagerData, getIlkRegistryData, + getDecimalsData, + setCallCache, } = require("./calls"); module.exports = { + setCallCache, getAutomationCdpIdList, getCdpData, getCdpManagerData, getIlkRegistryData, + getDecimalsData, }; diff --git a/projects/summer-fi/index.js b/projects/summer-fi/index.js index 7d129dd29af..4a26e05a678 100644 --- a/projects/summer-fi/index.js +++ b/projects/summer-fi/index.js @@ -1,34 +1,33 @@ const { automationTvl, dpmPositions, makerTvl } = require("./handlers"); -const { getAutomationCdpIdList } = require("./helpers"); +const { getAutomationCdpIdList, setCallCache } = require("./helpers"); const sdk = require('@defillama/sdk') -const { getConfig } = require("../helper/cache"); +const { getConfig, getCache, setCache } = require("../helper/cache"); const { endpoints } = require("./constants/endpoints"); module.exports = { doublecounted: true, - ethereum: { - tvl, - }, + ethereum: { tvl, }, }; -async function tvl( - timestamp, - block, - { ethereum: ethereumBlockHeight }, // not used, but included for clarity - { api } -) { +async function tvl(_, _1, _2, { api }) { await api.getBlock() const executionStart = Date.now() / 1000; - const confirmedSummerFiMakerVaults = await getConfig('summer-fi/maker-vaults', endpoints.makerVaults) - const cdpIdList = await getAutomationCdpIdList({ api }); + const [ confirmedSummerFiMakerVaults, cdpIdList, cache ] = await Promise.all([ + getConfig('summer-fi/maker-vaults', endpoints.makerVaults), + getAutomationCdpIdList({ api }), + getCache('summer-fi/cache', api.chain), + ]); + + setCallCache(cache) sdk.log([...cdpIdList].length, 'cdpIdList') - + await Promise.all([ dpmPositions({ api }), automationTvl({ api, cdpIdList }), makerTvl({ api, cdpIdList, confirmedSummerFiMakerVaults, }), ]); + await setCache('summer-fi/cache', api.chain, cache); sdk.log("Execution time", Date.now() / 1000 - executionStart, "seconds"); } From 6d64b5102fa772ca3cc8bc646ef90ba0813cf41d Mon Sep 17 00:00:00 2001 From: Kosiso Date: Tue, 25 Jul 2023 12:03:15 +0100 Subject: [PATCH 0493/1974] feat: adds support for base (#6906) --- projects/good-ghosting/index.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/projects/good-ghosting/index.js b/projects/good-ghosting/index.js index dddce3197ad..62d1d315f18 100644 --- a/projects/good-ghosting/index.js +++ b/projects/good-ghosting/index.js @@ -7,24 +7,23 @@ const chainIdMap = { ethereum: 1, polygon: 137, celo: 42220, + base: 8453, }; const contractVersions = { - v200: ["2.0.0", "2.0.1", "2.0.2", "2.0.3", "2.0.4", "2.0.5"], + v200: ["2.0"], v001: "0.0.1", v002: "0.0.2", v003: "0.0.3", }; const isV2Game = (contractVersion) => { - if (contractVersions.v200.includes(contractVersion)) { - return true; - } - const [derivedContractVersion] = contractVersion.split("-"); - if (contractVersions.v200.includes(derivedContractVersion)) { - return true; - } - return false; + const baseContractVersion = contractVersion.slice(0, 3); + + if (contractVersions.v200.indexOf(baseContractVersion) !== -1) { + return true; + } + return false; } async function tvl(_, _b, _cb, { api, }) { @@ -46,4 +45,5 @@ module.exports = { methodology: "counts the amount of interest bearing tokens owned by the smart game contract", polygon: { tvl }, celo: { tvl }, + base: {tvl} }; From 7f4ace644a17558fd13d1caa58db23363a2c3960 Mon Sep 17 00:00:00 2001 From: Krunal Amin Date: Tue, 25 Jul 2023 05:05:06 -0600 Subject: [PATCH 0494/1974] Add arbitrum and all its pools (#6904) * add zksync era * add arbitrum --- projects/unidex/index.js | 42 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/projects/unidex/index.js b/projects/unidex/index.js index 8ba83dba568..55bc1ec7abf 100644 --- a/projects/unidex/index.js +++ b/projects/unidex/index.js @@ -15,6 +15,45 @@ async function FantomTvl(_time, _ethBlock, { fantom: block }) { return sumTokens2({ chain, block, tokens, owners, }) } +async function ArbitrumTvl(_time, _ethBlock, { arbitrum: block }) { + const contracts = { + "ethPool": "0xdAF7D157F5c6E0F1d7917Ca02a7C185cEF81e6d0", + "usdcPool": "0x09E122453A079bc2Be621769ae7799e53dA0054E", + "daiPool": "0xb764729C6bEbd6E60E151F2c46aFce7D6Ff513fD", + "usdtPool": "0x9f6B9e253De52C5fD6c65283ff472b15520a7070", + "wbtcPool": "0xe736742Eb62F271c48F4a26168FD8F356AeE68db", + "arbPool": "0xF1Cb521C753e41906073eBEd30FE34BCB00845f8", + "mimPool": "0x266B30394da3D99a846dD30A2F7C50bb523c5dE1", + "gdaiPool": "0x7638Db20715c5AC09f52bE1E3a4DBb220680BdFd", + "ramPool": "0x914172b52262E867D8f2959D884e0ea73795B2c6", + "maiPool": "0xEfD0B28810dC3cdD88763f40DCc44462bb85Cf32", + "gmxPool": "0xDaa78E776D3788F9FBABDAc02aa6De45f7BC50C6", + "wstethPool": "0x53C6c525a635eF56Bce43d4523D90aACE551D81b", + "gnsPool": "0x13ff1aB07540b1681173003E361D046530506c11", + "capPool": "0x99DDb3E66A592579B9D46a47824042F62D690a9e", + "unshethPool": "0x5372Af9b4E9d4b9C016574Dad0f2406Dfe023D5F", + }; + const usdc = "0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8"; + const dai = "0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1"; + const usdt = "0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9"; + const wbtc = "0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f"; + const arb = "0x912ce59144191c1204e64559fe8253a0e49e6548"; + const mim = "0xfea7a6a0b346362bf88a9e4a88416b77a57d6c2a"; + const gdai = "0xd85e038593d7a098614721eae955ec2022b9b91b"; + const ram = "0xaaa6c1e32c55a7bfa8066a6fae9b42650f262418"; + const mai = "0x5979D7b546E38E414F7E9822514be443A4800529"; + const gmx = "0xfc5a1a6eb076a2c7ad06ed22c90d7e710e35ad0a"; + const wsteth = "0x5979D7b546E38E414F7E9822514be443A4800529"; + const gns = "0x18c11FD286C5EC11c3b683Caa813B77f5163A122"; + const cap = "0x031d35296154279dc1984dcd93e392b1f946737b"; + const unsheth = "0x0Ae38f7E10A43B5b2fB064B42a2f4514cbA909ef"; + + const chain = 'arbitrum' + const tokens = [usdc, dai, nullAddress, usdt, wbtc, arb, mim, gdai, ram, mai, gmx, wsteth, gns, cap, unsheth] + const owners = Object.values(contracts) + return sumTokens2({ chain, block, tokens, owners, }) +} + async function BobaTvl(_time, _ethBlock, { boba: block }) { const contracts = { "ethpool": "0x9673B0E0F07e4a6da712F6847aE93C3F157DD509", @@ -75,6 +114,9 @@ module.exports = { fantom: { tvl: FantomTvl }, + arbitrum: { + tvl: ArbitrumTvl + }, boba: { tvl: BobaTvl }, From 317b8810fcd383fd72bbc74f0c00f9f657be1991 Mon Sep 17 00:00:00 2001 From: Marcin Ciarka Date: Tue, 25 Jul 2023 14:49:31 +0200 Subject: [PATCH 0495/1974] =?UTF-8?q?=E2=98=80=EF=B8=8F=20Summer.fi=20-=20?= =?UTF-8?q?adapter=20fixes=20(#6907)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * new confirmedSummerFiMakerVaults handling, change the MCDView contract * sync --- projects/summer-fi/constants/contracts.js | 2 +- projects/summer-fi/handlers/maker-vaults.js | 8 +- projects/summer-fi/helpers/calls.js | 102 +++++++++++--------- projects/summer-fi/index.js | 20 ++-- 4 files changed, 72 insertions(+), 60 deletions(-) diff --git a/projects/summer-fi/constants/contracts.js b/projects/summer-fi/constants/contracts.js index 52c475bf9b3..d33ef54c98b 100644 --- a/projects/summer-fi/constants/contracts.js +++ b/projects/summer-fi/constants/contracts.js @@ -1,6 +1,6 @@ module.exports = { AutomationV1Contract: "0x6E87a7A0A03E51A741075fDf4D1FCce39a4Df01b", - McdView: "0x55Dc2Be8020bCa72E58e665dC931E03B749ea5E0", + McdMonitorV2: "0xa59d5E94BFE605A9a4aC7e02f5380e02061c8dd2", CdpManager: "0x5ef30b9986345249bc32d8928b7ee64de9435e39", IlkRegistry: "0x5a464c28d19848f44199d003bef5ecc87d090f87", }; diff --git a/projects/summer-fi/handlers/maker-vaults.js b/projects/summer-fi/handlers/maker-vaults.js index 18844419840..9d7eae5c935 100644 --- a/projects/summer-fi/handlers/maker-vaults.js +++ b/projects/summer-fi/handlers/maker-vaults.js @@ -16,7 +16,13 @@ const makerTvl = async ({ api, cdpIdList, confirmedSummerFiMakerVaults }) => { }); const filteredVaultsList = [...confirmedSummerFiMakerVaultsSet].filter( - (i) => api.block >= confirmedSummerFiMakerVaults[i] + (i) => { + const [startBlock, endBlock] = confirmedSummerFiMakerVaults[i]; + if (!endBlock) { + return api.block > startBlock; + } + return api.block > startBlock && api.block <= endBlock; + } ); const ilkNames = await getCdpManagerData( [...new Set(filteredVaultsList)], diff --git a/projects/summer-fi/helpers/calls.js b/projects/summer-fi/helpers/calls.js index 58f22f7ae2d..0befab017e2 100644 --- a/projects/summer-fi/helpers/calls.js +++ b/projects/summer-fi/helpers/calls.js @@ -1,83 +1,89 @@ const { sliceIntoChunks } = require("@defillama/sdk/build/util/index.js"); const abi = require("../constants/abi.js"); const contracts = require("../constants/contracts.js"); -const sdk = require('@defillama/sdk') +const sdk = require("@defillama/sdk"); const getCdpData = async (cdpIds, api) => { - const res = [] - const chunks = sliceIntoChunks(cdpIds, 100) + sdk.log(cdpIds.length, "cdpIds"); + const res = []; + const chunks = sliceIntoChunks(cdpIds, 25); for (const chunk of chunks) - res.push(...await api.multiCall({ - abi: abi.getVaultInfo, - target: contracts.McdView, - calls: chunk, - })) + res.push( + ...(await api.multiCall({ + abi: abi.getVaultInfo, + target: contracts.McdMonitorV2, + calls: chunk, + })) + ); - return res -} + return res; +}; const getCdpManagerData = async (cdpIds, api) => { return cachedCalls({ items: cdpIds, - multiCall: async calls => api.multiCall({ - abi: abi.ilks, - target: contracts.CdpManager, - calls, - }), - key: 'getCdpManagerData', - }) -} + multiCall: async (calls) => + api.multiCall({ + abi: abi.ilks, + target: contracts.CdpManager, + calls, + }), + key: "getCdpManagerData", + }); +}; const getIlkRegistryData = async (ilks, api) => { return cachedCalls({ items: ilks, - multiCall: async calls => api.multiCall({ - abi: abi.info, - target: contracts.IlkRegistry, - calls, - }), - key: 'getIlkRegistryData', - }) -} + multiCall: async (calls) => + api.multiCall({ + abi: abi.info, + target: contracts.IlkRegistry, + calls, + }), + key: "getIlkRegistryData", + }); +}; const getDecimalsData = async (tokens, api) => { return cachedCalls({ items: tokens, - multiCall: async calls => api.multiCall({ - abi: 'erc20:decimals', - calls, - }), - key: 'getDecimalsData', - }) -} + multiCall: async (calls) => + api.multiCall({ + abi: "erc20:decimals", + calls, + }), + key: "getDecimalsData", + }); +}; -let cache = {} +let cache = {}; function setCallCache(_cache) { - cache = _cache + cache = _cache; } async function cachedCalls({ items, multiCall, key }) { - if (!cache[key]) cache[key] = {} - const res = [] - const missingIds = [] - const missingIndices = [] + if (!cache[key]) cache[key] = {}; + const res = []; + const missingIds = []; + const missingIndices = []; items.forEach((id, i) => { - if (cache[key][id]) res[i] = cache[key][id] + if (cache[key][id]) res[i] = cache[key][id]; else { - missingIds.push(id) - missingIndices.push(i) + missingIds.push(id); + missingIndices.push(i); } - }) + }); if (missingIds.length) { - sdk.log('Missing ids', missingIds.length, 'key', key) + sdk.log("Missing ids", missingIds.length, "key", key); const tempRes = await multiCall(missingIds); missingIds.forEach((id, i) => { - res[missingIndices[i]] = tempRes[i] - cache[key][id] = tempRes[i] - }) + res[missingIndices[i]] = tempRes[i]; + cache[key][id] = tempRes[i]; + }); } - return res + return res; } module.exports = { diff --git a/projects/summer-fi/index.js b/projects/summer-fi/index.js index 4a26e05a678..8ac5635c8e5 100644 --- a/projects/summer-fi/index.js +++ b/projects/summer-fi/index.js @@ -1,33 +1,33 @@ const { automationTvl, dpmPositions, makerTvl } = require("./handlers"); const { getAutomationCdpIdList, setCallCache } = require("./helpers"); -const sdk = require('@defillama/sdk') +const sdk = require("@defillama/sdk"); const { getConfig, getCache, setCache } = require("../helper/cache"); const { endpoints } = require("./constants/endpoints"); module.exports = { doublecounted: true, - ethereum: { tvl, }, + ethereum: { tvl }, }; async function tvl(_, _1, _2, { api }) { - await api.getBlock() + await api.getBlock(); const executionStart = Date.now() / 1000; - const [ confirmedSummerFiMakerVaults, cdpIdList, cache ] = await Promise.all([ - getConfig('summer-fi/maker-vaults', endpoints.makerVaults), + const [confirmedSummerFiMakerVaults, cdpIdList, cache] = await Promise.all([ + await getConfig("summer-fi/maker-vaults", endpoints.makerVaults), getAutomationCdpIdList({ api }), - getCache('summer-fi/cache', api.chain), + getCache("summer-fi/cache", api.chain), ]); - setCallCache(cache) + setCallCache(cache); - sdk.log([...cdpIdList].length, 'cdpIdList') + sdk.log([...cdpIdList].length, "cdpIdList"); await Promise.all([ dpmPositions({ api }), automationTvl({ api, cdpIdList }), - makerTvl({ api, cdpIdList, confirmedSummerFiMakerVaults, }), + makerTvl({ api, cdpIdList, confirmedSummerFiMakerVaults }), ]); - await setCache('summer-fi/cache', api.chain, cache); + await setCache("summer-fi/cache", api.chain, cache); sdk.log("Execution time", Date.now() / 1000 - executionStart, "seconds"); } From 5f97453310517fdb32fd6c6fe9152aa6b6ce7e1f Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 25 Jul 2023 15:29:10 +0200 Subject: [PATCH 0496/1974] update summer.fi --- projects/summer-fi/constants/abi.js | 2 +- projects/summer-fi/handlers/automation-v1.js | 4 +++- projects/summer-fi/handlers/maker-vaults.js | 16 +++++++--------- projects/summer-fi/helpers/calls.js | 5 ++--- 4 files changed, 13 insertions(+), 14 deletions(-) diff --git a/projects/summer-fi/constants/abi.js b/projects/summer-fi/constants/abi.js index aa69665e9b6..5dc735e42be 100644 --- a/projects/summer-fi/constants/abi.js +++ b/projects/summer-fi/constants/abi.js @@ -11,7 +11,7 @@ module.exports = { serviceRegistry: "address:serviceRegistry", triggersCounter: "uint256:triggersCounter", getVaultInfo: - "function getVaultInfo(uint256 vaultId) view returns (uint256 collateralLocked, uint256)", + "function getCdpInfo(uint256 vaultId,bytes32) view returns (uint256 collateralLocked, uint256)", ilks: "function ilks(uint256) view returns (bytes32)", info: "function info(bytes32 ilk) view returns (string name, string symbol, uint256 class, uint256 dec, address gem, address pip, address join, address xlip)", }; diff --git a/projects/summer-fi/handlers/automation-v1.js b/projects/summer-fi/handlers/automation-v1.js index 65d401ac90a..7458782616a 100644 --- a/projects/summer-fi/handlers/automation-v1.js +++ b/projects/summer-fi/handlers/automation-v1.js @@ -10,10 +10,12 @@ const automationTvl = async ({ api, cdpIdList }) => { const cdpIds = [...cdpIdList]; const ilkNames = await getCdpManagerData(cdpIds, api); + const cdpIlkIds = {} + ilkNames.forEach((val, idx) => cdpIlkIds[cdpIds[idx]] = val) const ilkIds = [...new Set(ilkNames)]; const tokens = (await getIlkRegistryData(ilkIds, api)).map((i) => i[4]); const decimals = await getDecimalsData(tokens, api); - const collData = await getCdpData(cdpIds, api); + const collData = await getCdpData(cdpIds.map(i => [i, cdpIlkIds[i]]), api); collData.forEach(({ collateralLocked }, i) => { if (collateralLocked > 0) { positionsWithTriggersAndCollateral++; diff --git a/projects/summer-fi/handlers/maker-vaults.js b/projects/summer-fi/handlers/maker-vaults.js index 9d7eae5c935..74a6bde966d 100644 --- a/projects/summer-fi/handlers/maker-vaults.js +++ b/projects/summer-fi/handlers/maker-vaults.js @@ -2,6 +2,7 @@ const { getCdpData, getCdpManagerData, getIlkRegistryData, + getDecimalsData, } = require("../helpers"); const makerTvl = async ({ api, cdpIdList, confirmedSummerFiMakerVaults }) => { @@ -24,17 +25,14 @@ const makerTvl = async ({ api, cdpIdList, confirmedSummerFiMakerVaults }) => { return api.block > startBlock && api.block <= endBlock; } ); - const ilkNames = await getCdpManagerData( - [...new Set(filteredVaultsList)], - api - ); + const cdpIds = [...new Set(filteredVaultsList)] + const ilkNames = await getCdpManagerData(cdpIds, api); + const cdpIlkIds = {} + ilkNames.forEach((val, idx) => cdpIlkIds[cdpIds[idx]] = val) const ilkIds = [...new Set(ilkNames)]; const tokens = (await getIlkRegistryData(ilkIds, api)).map((i) => i[4]); - const decimals = await api.multiCall({ - abi: "erc20:decimals", - calls: tokens, - }); - const collData = await getCdpData(filteredVaultsList, api); + const decimals = await getDecimalsData(tokens, api); + const collData = await getCdpData(filteredVaultsList.map(i => [i, cdpIlkIds[i]]), api); collData.forEach(({ collateralLocked }, i) => { const idx = ilkIds.indexOf(ilkNames[i]); if (idx === -1) { diff --git a/projects/summer-fi/helpers/calls.js b/projects/summer-fi/helpers/calls.js index 0befab017e2..cf2c8223d93 100644 --- a/projects/summer-fi/helpers/calls.js +++ b/projects/summer-fi/helpers/calls.js @@ -4,15 +4,14 @@ const contracts = require("../constants/contracts.js"); const sdk = require("@defillama/sdk"); const getCdpData = async (cdpIds, api) => { - sdk.log(cdpIds.length, "cdpIds"); const res = []; - const chunks = sliceIntoChunks(cdpIds, 25); + const chunks = sliceIntoChunks(cdpIds, 100); for (const chunk of chunks) res.push( ...(await api.multiCall({ abi: abi.getVaultInfo, target: contracts.McdMonitorV2, - calls: chunk, + calls: chunk.map(i => ({ params: i})), })) ); From b5fb9ead930e015367e64488676412e6cf9e2fe0 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 25 Jul 2023 15:56:28 +0200 Subject: [PATCH 0497/1974] fix broken adapters --- projects/ABCDEFX/index.js | 1 + projects/Lockless/index.js | 12 ++++++------ projects/defyswap/index.js | 2 +- projects/echswap/index.js | 2 +- projects/helper/chain/litecoin.js | 7 +++++-- 5 files changed, 14 insertions(+), 10 deletions(-) diff --git a/projects/ABCDEFX/index.js b/projects/ABCDEFX/index.js index 1623b148fa4..6e31454c9dd 100644 --- a/projects/ABCDEFX/index.js +++ b/projects/ABCDEFX/index.js @@ -9,3 +9,4 @@ module.exports = { chains.forEach(chain => { module.exports[chain] = { tvl: getUniTVL({ factory: '0x01F43D2A7F4554468f77e06757e707150e39130c', useDefaultCoreAssets: true, hasStablePools: true, stablePoolSymbol: 'ABcDeFx.LP' }) } }) +module.exports.echelon.tvl = () => ({}) \ No newline at end of file diff --git a/projects/Lockless/index.js b/projects/Lockless/index.js index 1fccefa0b26..1640ef60f07 100644 --- a/projects/Lockless/index.js +++ b/projects/Lockless/index.js @@ -1,19 +1,19 @@ -const swkava = '0x9d9682577CA889c882412056669bd936894663fd' -const swech = '0x86e4D91800c03e803d4c8FA3293d1C7d612A7300' +const swkava = '0x9d9682577CA889c882412056669bd936894663fd' +const swech = '0x86e4D91800c03e803d4c8FA3293d1C7d612A7300' -async function tvl(timestamp, ethBlock, {kava: block}, { api }) { +async function tvl(timestamp, ethBlock, { kava: block }, { api }) { const pooledCoin = await api.call({ - target: api.chain === 'kava' ? swkava: swech, + target: api.chain === 'kava' ? swkava : swech, abi: "uint256:totalSupply", }) return { - [api.chain === 'kava' ? 'kava' : 'echelon']: pooledCoin/1e18, + [api.chain === 'kava' ? 'kava' : 'echelon']: pooledCoin / 1e18, } } module.exports = { kava: { tvl }, - echelon: { tvl }, + echelon: { tvl: () => ({}), }, methodology: "Any & Each 1 SW-Token can only ever be minted by permanent locking of 1 Native token. Hence, the totalSupply() method is used to aggregate the amounts of underlying assets, with their prices fed by the DefiLlama SDK.", } diff --git a/projects/defyswap/index.js b/projects/defyswap/index.js index 2889e5e6483..b1457bad445 100644 --- a/projects/defyswap/index.js +++ b/projects/defyswap/index.js @@ -15,7 +15,7 @@ const whitelist = [ module.exports = { misrepresentedTokens: true, echelon: { - tvl: getUniTVL({ chain: 'echelon', useDefaultCoreAssets: true, factory: '0xdBE4CC36D0C19858d8cc7c5030593E9922aC680D' }) + tvl: () => ({}), }, fantom: { tvl: getUniTVL({ factory, chain: 'fantom', useDefaultCoreAssets: true }), diff --git a/projects/echswap/index.js b/projects/echswap/index.js index d694c736ce3..751dcffd946 100644 --- a/projects/echswap/index.js +++ b/projects/echswap/index.js @@ -6,6 +6,6 @@ module.exports = { [1671062400, "Rug Pull"] ], echelon: { - tvl: getUniTVL({ chain: 'echelon', useDefaultCoreAssets: true, factory: '0xaFd37A86044528010d0E70cDc58d0A9B5Eb03206' }) + tvl: () => ({}), } } \ No newline at end of file diff --git a/projects/helper/chain/litecoin.js b/projects/helper/chain/litecoin.js index 092c830d881..f24b942d5b7 100644 --- a/projects/helper/chain/litecoin.js +++ b/projects/helper/chain/litecoin.js @@ -1,10 +1,13 @@ const sdk = require('@defillama/sdk') const { get } = require('../http') -const url = addr => 'https://chainz.cryptoid.info/ltc/api.dws?q=getbalance&a=' + addr +// const url = addr => 'https://chainz.cryptoid.info/ltc/api.dws?q=getbalance&a=' + addr +const url = addr => 'https://ltc.tokenview.io/api/address/balancetrend/ltc/' + addr async function getBalance(addr) { - return get(url(addr)) + // return get(url(addr)) + const {data} = await get(url(addr)) + return +Object.values(data[0])[0] } async function sumTokens({ balances = {}, owners = [] }) { From d0881734931adeb27a1d594b79559d7d3a34019a Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 25 Jul 2023 16:43:24 +0200 Subject: [PATCH 0498/1974] trufin: liquid staking --- projects/trufin-trustake/index.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 projects/trufin-trustake/index.js diff --git a/projects/trufin-trustake/index.js b/projects/trufin-trustake/index.js new file mode 100644 index 00000000000..e218d2f7b67 --- /dev/null +++ b/projects/trufin-trustake/index.js @@ -0,0 +1,24 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const abi = { + "totalShares": "uint256:totalShares", + "sharePrice": "function sharePrice() external view returns (uint256, uint256)", + "getDust": "uint256:getDust" +} + +const TRUSTAKE_CONTRACT_ADDR = "0xa43a7c62d56df036c187e1966c03e2799d8987ed" +const MATIC_TOKEN_ADDR = ADDRESSES.ethereum.MATIC + +async function tvl(timestamp, block, chainBlocks, { api }) { + const totalSupply = (await api.call({ abi: 'erc20:totalSupply', target: TRUSTAKE_CONTRACT_ADDR, })) + const sharePriceArray = (await api.call({ abi: abi.sharePrice, target: TRUSTAKE_CONTRACT_ADDR, })) + const dust = (await api.call({ abi: abi.getDust, target: TRUSTAKE_CONTRACT_ADDR, })) + const sharePrice = sharePriceArray[0] / sharePriceArray[1] / 1e18 + api.add(MATIC_TOKEN_ADDR, (totalSupply * sharePrice) + +dust) +} + +module.exports = { + methodology: `Counts the TVL of MATIC tokens in TruFin's TruStake vault.`, + ethereum: { + tvl + } +} From 5579d90cb41712cc755c5f5cf4f846637a647cc8 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 25 Jul 2023 17:16:32 +0200 Subject: [PATCH 0499/1974] update summer.fi --- projects/summer-fi/handlers/maker-vaults.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/projects/summer-fi/handlers/maker-vaults.js b/projects/summer-fi/handlers/maker-vaults.js index 74a6bde966d..9c2e810ded8 100644 --- a/projects/summer-fi/handlers/maker-vaults.js +++ b/projects/summer-fi/handlers/maker-vaults.js @@ -18,11 +18,8 @@ const makerTvl = async ({ api, cdpIdList, confirmedSummerFiMakerVaults }) => { const filteredVaultsList = [...confirmedSummerFiMakerVaultsSet].filter( (i) => { - const [startBlock, endBlock] = confirmedSummerFiMakerVaults[i]; - if (!endBlock) { - return api.block > startBlock; - } - return api.block > startBlock && api.block <= endBlock; + const [startBlock] = confirmedSummerFiMakerVaults[i]; + return api.block > startBlock; } ); const cdpIds = [...new Set(filteredVaultsList)] From 65cc4549c70b8c8ead70188974069715a987b1f5 Mon Sep 17 00:00:00 2001 From: define Date: Tue, 25 Jul 2023 16:43:08 +0100 Subject: [PATCH 0500/1974] new factory address agni fi --- projects/agni-fi/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/agni-fi/index.js b/projects/agni-fi/index.js index 87d0a8982e0..8a4a44049a6 100644 --- a/projects/agni-fi/index.js +++ b/projects/agni-fi/index.js @@ -1,5 +1,5 @@ const { uniV3Export } = require("../helper/uniswapV3"); module.exports = uniV3Export({ - mantle: { factory: "0xae411e11D9fA2773CEaC200cC2C73F17324Fc93B", fromBlock: 35714, }, + mantle: { factory: "0x25780dc8Fc3cfBD75F33bFDAB65e969b603b2035", fromBlock: 35714, }, }); \ No newline at end of file From bd2e7feb5456759a85fa0b3e56bc4898025da4b1 Mon Sep 17 00:00:00 2001 From: Viktor <99098789+combased-dev@users.noreply.github.com> Date: Tue, 25 Jul 2023 19:49:03 +0300 Subject: [PATCH 0501/1974] Jewelswap update (#6887) * jewelswap init * jewelswap: coide refactor * updated for others * pool2 * lint * update * revert * misrepresentedTokens * WIP: jewelswap * completed nfts/lyf * lint update * added guard * swapped to gateway * lev-farming-to-gateway * jewelswap: code refactor --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/helper/chain/elrond.js | 6 + projects/jewelswap-lev-farming/api.js | 6 + projects/jewelswap-lev-farming/index.js | 96 +++++++++ .../jewel-onedex-farm.abi.json | 115 +++++++++++ projects/jewelswap-nft/api.js | 6 + projects/jewelswap-nft/index.js | 79 ++++++++ .../jewelswap-nft/jewel-nft-lending.abi.json | 183 ++++++++++++++++++ 7 files changed, 491 insertions(+) create mode 100644 projects/jewelswap-lev-farming/api.js create mode 100644 projects/jewelswap-lev-farming/index.js create mode 100644 projects/jewelswap-lev-farming/jewel-onedex-farm.abi.json create mode 100644 projects/jewelswap-nft/api.js create mode 100644 projects/jewelswap-nft/index.js create mode 100644 projects/jewelswap-nft/jewel-nft-lending.abi.json diff --git a/projects/helper/chain/elrond.js b/projects/helper/chain/elrond.js index 07f0c60db12..c65e43a3a51 100644 --- a/projects/helper/chain/elrond.js +++ b/projects/helper/chain/elrond.js @@ -70,7 +70,13 @@ async function sumTokens({ owners = [], tokens = [], balances = {}, blacklistedT return transformBalances(chain, balances) } +async function getNFTs(address) { + const res = await get(`${getEnv('MULTIVERSX_RPC')}/accounts/${address}/nfts?size=1000`) + return res +} + module.exports = { sumTokens, call, + getNFTs, } \ No newline at end of file diff --git a/projects/jewelswap-lev-farming/api.js b/projects/jewelswap-lev-farming/api.js new file mode 100644 index 00000000000..8e562c21b03 --- /dev/null +++ b/projects/jewelswap-lev-farming/api.js @@ -0,0 +1,6 @@ +const { getExports } = require('../helper/heroku-api') + +module.exports = { + timetravel: false, + ...getExports("jewelswap-lev-farming", ['elrond']), +} diff --git a/projects/jewelswap-lev-farming/index.js b/projects/jewelswap-lev-farming/index.js new file mode 100644 index 00000000000..4d78f06a9d8 --- /dev/null +++ b/projects/jewelswap-lev-farming/index.js @@ -0,0 +1,96 @@ +const { getNFTs, sumTokens } = require("../helper/chain/elrond"); +const { ResultsParser, AbiRegistry, SmartContract, Address, } = require("@multiversx/sdk-core/out"); +const { ProxyNetworkProvider } = require("@multiversx/sdk-network-providers/out"); +const JEWEL_ONEDEX_FARM_SC_ABI = require("./jewel-onedex-farm.abi.json"); + + +const JEWEL_ONEDEX_FARM_SC_ADDRESS = "erd1qqqqqqqqqqqqqpgqm7exdla3rzshywy99pvlxzkr45wt9kjsdfys7qqpn0"; +const LENDING_POOL_FARMS = "erd1qqqqqqqqqqqqqpgq96n4gxvmw8nxgxud8nv8qmms5namspc5vmusg930sh"; + +const FARMS = "erd1qqqqqqqqqqqqqpgqlnxy2hmvs8qxr6ezq2wmggn7ev62cjp6vmusvdral4"; + +const jewelOnedexFarmAbiRegistry = AbiRegistry.create(JEWEL_ONEDEX_FARM_SC_ABI); +const jewelOnedexFarmSmartContract = new SmartContract({ + address: new Address(JEWEL_ONEDEX_FARM_SC_ADDRESS), + abi: jewelOnedexFarmAbiRegistry +}); + + +const networkConfigs = { + mainnet: { + id: "mainnet", + chainId: "1", + apiUrl: "https://api.multiversx.com", + gatewayUrl: "https://gateway.multiversx.com", + explorerUrl: "https://explorer.multiversx.com", + apiTimeout: 10000 + } +}; + + +const ELROND_NETWORK = "mainnet"; +const networkConfig = networkConfigs[ELROND_NETWORK]; + +const proxyProvider = new ProxyNetworkProvider(networkConfig.gatewayUrl, { + timeout: networkConfig.apiTimeout +}); + + +async function tvl() { + const { api } = arguments[3] + + const nfts = await getNFTs(FARMS) + nfts.forEach(nft => { + let lpToken + switch (nft.collection) { + case "FARM-e5ffde": lpToken = "ALP-2d0cf8"; break; + case "FARM-9ed1f9": lpToken = "ALP-5f9191"; break; + case "FARM-ccefc2": lpToken = "ALP-0fe50a"; break; + case "FARM-795466": lpToken = "ALP-afc922"; break; + default: lpToken = null; + } + if (lpToken) api.add(lpToken, nft.balance) + }) + await oneDexFarm(api) + return sumTokens({ owners: [LENDING_POOL_FARMS], balances: api.getBalances() }) +} + +async function oneDexFarm(api) { + const interaction = + jewelOnedexFarmSmartContract.methodsExplicit.viewFarms(); + const query = interaction.check().buildQuery(); + const queryResponse = + await proxyProvider.queryContract(query); + const endpointDefinition = interaction.getEndpoint(); + const { firstValue, returnCode, returnMessage } = + new ResultsParser().parseQueryResponse( + queryResponse, + endpointDefinition + ); + + if (!firstValue || !returnCode.isSuccess()) { + throw Error(returnMessage); + } + + const values = firstValue.valueOf(); + const decoded = values.map((value) => ({ + token0: value.first_token_id.toString(), + token1: value.second_token_id.toString(), + lpAmount: value.lp_token_amount.toFixed(0), + lpSupply: value.lp_token_supply.toFixed(0), + token0Supply: value.first_token_reserve.toFixed(0), + token1Supply: value.second_token_reserve.toFixed(0) + })); + decoded.forEach(({ token0, token1, lpAmount, lpSupply, token0Supply, token1Supply}) => { + const ratio = lpAmount / lpSupply + api.add(token0, token0Supply * ratio) + api.add(token1, token1Supply * ratio) + }) +} + +module.exports = { + timetravel: false, + elrond: { + tvl + } +}; diff --git a/projects/jewelswap-lev-farming/jewel-onedex-farm.abi.json b/projects/jewelswap-lev-farming/jewel-onedex-farm.abi.json new file mode 100644 index 00000000000..8af49b34716 --- /dev/null +++ b/projects/jewelswap-lev-farming/jewel-onedex-farm.abi.json @@ -0,0 +1,115 @@ +{ + "buildInfo": { + }, + "name": "JewelOnedexFarm", + "constructor": { + "inputs": [], + "outputs": [] + }, + "endpoints": [ + { + "name": "viewFarms", + "mutability": "readonly", + "inputs": [], + "outputs": [ + { + "type": "List" + } + ] + } + ], + "events": [], + "hasCallback": false, + "types": { + "FarmContext": { + "type": "struct", + "fields": [ + { + "name": "farm_id", + "type": "u32" + }, + { + "name": "dex_swap_pool_id", + "type": "u32" + }, + { + "name": "dex_farm_pool_id", + "type": "u32" + }, + { + "name": "min_deposit_base_token", + "type": "TokenIdentifier" + }, + { + "name": "min_deposit_base_amount", + "type": "BigUint" + }, + { + "name": "min_compound_rewards_amount", + "type": "BigUint" + }, + { + "name": "fee_percent", + "type": "u64" + }, + { + "name": "first_token_id", + "type": "TokenIdentifier" + }, + { + "name": "second_token_id", + "type": "TokenIdentifier" + }, + { + "name": "lp_token_id", + "type": "TokenIdentifier" + }, + { + "name": "rewards_token_id", + "type": "TokenIdentifier" + }, + { + "name": "pending_first_token_amount", + "type": "BigUint" + }, + { + "name": "pending_second_token_amount", + "type": "BigUint" + }, + { + "name": "farm_share", + "type": "BigUint" + }, + { + "name": "lp_token_amount", + "type": "BigUint" + }, + { + "name": "current_rewards_amount", + "type": "BigUint" + }, + { + "name": "farm_yearly_reward_amount", + "type": "BigUint" + }, + { + "name": "lp_token_supply", + "type": "BigUint" + }, + { + "name": "first_token_reserve", + "type": "BigUint" + }, + { + "name": "second_token_reserve", + "type": "BigUint" + }, + { + "name": "opened_position_count", + "type": "u32" + } + ] + } + + } +} diff --git a/projects/jewelswap-nft/api.js b/projects/jewelswap-nft/api.js new file mode 100644 index 00000000000..a3af2c0031e --- /dev/null +++ b/projects/jewelswap-nft/api.js @@ -0,0 +1,6 @@ +const { getExports } = require('../helper/heroku-api') + +module.exports = { + timetravel: false, + ...getExports("jewelswap-nft", ['elrond'], ['borrowed']), +} diff --git a/projects/jewelswap-nft/index.js b/projects/jewelswap-nft/index.js new file mode 100644 index 00000000000..fd0502fa3ed --- /dev/null +++ b/projects/jewelswap-nft/index.js @@ -0,0 +1,79 @@ +const { ResultsParser, AbiRegistry, SmartContract, Address, OptionalValue } = require("@multiversx/sdk-core/out"); +const { ProxyNetworkProvider } = require("@multiversx/sdk-network-providers/out"); +const NFT_LENDING_SC_ABI_JSON = require("./jewel-nft-lending.abi.json"); +const { sumTokens } = require("../helper/chain/elrond"); +const { nullAddress } = require("../helper/tokenMapping"); + + +const LENDING_POOL = "erd1qqqqqqqqqqqqqpgqhpauarfmx75nf4pwxh2fuy520ym03p8e8jcqt466up"; + +const abi = AbiRegistry.create(NFT_LENDING_SC_ABI_JSON); +const nftLendingSmartContract = new SmartContract({ + address: new Address(LENDING_POOL), + abi: abi +}); + +const networkConfigs = { + mainnet: { + id: "mainnet", + chainId: "1", + apiUrl: "https://api.multiversx.com", + gatewayUrl: "https://gateway.multiversx.com", + explorerUrl: "https://explorer.multiversx.com", + apiTimeout: 10000 + } +}; + + +const ELROND_NETWORK = "mainnet"; +const networkConfig = networkConfigs[ELROND_NETWORK]; + +const proxyProvider = new ProxyNetworkProvider(networkConfig.gatewayUrl, { + timeout: networkConfig.apiTimeout +}); + + +module.exports = { + misrepresentedTokens: true, + timetravel: false, + elrond: { + tvl: () => sumTokens({ owners: [LENDING_POOL] }), + borrowed, + } +}; + +async function borrowed() { + const { api } = arguments[3] + const commonSettings = await queryNFTDataFromSc(); + api.add(nullAddress, commonSettings.total_loan_amount) + + return api.getBalances() +} + +async function queryNFTDataFromSc() { + const args = [ + OptionalValue.newMissing() + ]; + const interaction = nftLendingSmartContract.methodsExplicit.viewCommonSettings(args); + const query = interaction.check().buildQuery(); + const queryResponse = await proxyProvider.queryContract(query); + const endpointDefinition = interaction.getEndpoint(); + const { + firstValue, + returnCode, + returnMessage + } = new ResultsParser().parseQueryResponse(queryResponse, endpointDefinition); + + if (!firstValue || !returnCode.isSuccess()) { + console.error(returnMessage); + return undefined; + } + + const value = firstValue.valueOf(); + const decoded = { + total_lending_amount: value.total_lending_amount.toFixed(), + total_collateral_amount: value.total_collateral_amount.toFixed(), + total_loan_amount: value.total_loan_amount.toFixed(), + }; + return decoded; +} diff --git a/projects/jewelswap-nft/jewel-nft-lending.abi.json b/projects/jewelswap-nft/jewel-nft-lending.abi.json new file mode 100644 index 00000000000..6c12f761ed9 --- /dev/null +++ b/projects/jewelswap-nft/jewel-nft-lending.abi.json @@ -0,0 +1,183 @@ +{ + "buildInfo": { + }, + "name": "EpunksNftLending", + "constructor": { + "inputs": [], + "outputs": [] + }, + "endpoints": [ + { + "name": "viewCommonSettings", + "mutability": "readonly", + "inputs": [ + { + "name": "opt_user_address", + "type": "optional
", + "multi_arg": true + } + ], + "outputs": [ + { + "type": "CommonSettings" + } + ] + } + ], + "hasCallback": true, + "types": { + "CommonSettings": { + "type": "struct", + "fields": [ + { + "name": "rewards_pool_rate", + "type": "u64" + }, + { + "name": "epunks_buyback_rate", + "type": "u64" + }, + { + "name": "team_rate", + "type": "u64" + }, + { + "name": "epunks_buyback_wallet", + "type": "Address" + }, + { + "name": "team_wallet", + "type": "Address" + }, + { + "name": "liquidation_wallet", + "type": "Address" + }, + { + "name": "lend_epoch_length", + "type": "u64" + }, + { + "name": "lend_lock_period", + "type": "u64" + }, + { + "name": "liquidation_threshold", + "type": "u64" + }, + { + "name": "lend_grace_period", + "type": "u64" + }, + { + "name": "liquidation_fee", + "type": "u64" + }, + { + "name": "total_lending_amount", + "type": "BigUint" + }, + { + "name": "lend_users", + "type": "u32" + }, + { + "name": "current_lend_epoch_id", + "type": "u32" + }, + { + "name": "lend_epoch_start_timestamp", + "type": "u64" + }, + { + "name": "lend_rewards_pool_amount", + "type": "BigUint" + }, + { + "name": "global_liquidation_rate", + "type": "u64" + }, + { + "name": "global_max_borrow_amount", + "type": "BigUint" + }, + { + "name": "global_collection_max_lend_cap_percent", + "type": "u64" + }, + { + "name": "global_max_borrower_cap_percent", + "type": "u64" + }, + { + "name": "borrow_plan_count", + "type": "u32" + }, + { + "name": "max_borrow_periods", + "type": "List" + }, + { + "name": "borrow_rates", + "type": "List" + }, + { + "name": "accumulated_loan_amount", + "type": "BigUint" + }, + { + "name": "total_loan_amount", + "type": "BigUint" + }, + { + "name": "total_collateral_amount", + "type": "BigUint" + }, + { + "name": "opened_loan_count", + "type": "u32" + }, + { + "name": "loan_owners", + "type": "u32" + }, + { + "name": "last_loan_id", + "type": "u32" + }, + { + "name": "collection_ids", + "type": "List" + }, + { + "name": "collection_collateral_rates", + "type": "List" + }, + { + "name": "collection_trait_counts", + "type": "List" + }, + { + "name": "collection_supplies", + "type": "List" + }, + { + "name": "collection_max_borrow_amounts", + "type": "List" + }, + { + "name": "collection_borrow_amounts", + "type": "List" + }, + { + "name": "collection_max_lend_cap_percents", + "type": "List" + }, + { + "name": "user_borrow_status", + "type": "bool" + } + ] + } + } +} From 5e82668ac9cc9cc84fb4894034cad11e8cff2f70 Mon Sep 17 00:00:00 2001 From: Jadeswap <136394034+Jadeswap@users.noreply.github.com> Date: Tue, 25 Jul 2023 22:19:31 +0500 Subject: [PATCH 0502/1974] add JadeSwap (#6908) * added jadeswap * minor fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/jadeswap/index.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 projects/jadeswap/index.js diff --git a/projects/jadeswap/index.js b/projects/jadeswap/index.js new file mode 100644 index 00000000000..913d7a16b86 --- /dev/null +++ b/projects/jadeswap/index.js @@ -0,0 +1,28 @@ +const ADDRESSES = require("../helper/coreAssets.json"); +const { getUniTVL, staking } = require("../helper/unknownTokens"); +const sdk = require("@defillama/sdk"); +const uniTvl = getUniTVL({ + factory: "0x210D0c3d885C5D296e8F32Ad4B7a9a2Fe39E983b", + useDefaultCoreAssets: true, + fetchBalances: true, +}); +const masterchef = "0xcC507803A4b832684154C4E395D92A6EDbEAfE52"; +const jade = "0x7c70229F108D3d506Cff8Ea243FFA57344Fc4cE1"; +const wmnt = ADDRESSES.mantle.WMNT; + +module.exports = { + misrepresentedTokens: true, + mantle: { + tvl: sdk.util.sumChainTvls([ + uniTvl, + staking({ + owners: [masterchef], + tokens: [wmnt], + }), + ]), + staking: staking({ + owners: [masterchef], + tokens: [jade], + }), + }, +}; From 1d4e3f34802f2e14813b480def3536b6707fc5fc Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Tue, 25 Jul 2023 20:07:28 +0100 Subject: [PATCH 0503/1974] separate fvm --- projects/fvm/index.js | 12 ++++++++++++ projects/velocimeter-v2/index.js | 7 ------- 2 files changed, 12 insertions(+), 7 deletions(-) create mode 100644 projects/fvm/index.js diff --git a/projects/fvm/index.js b/projects/fvm/index.js new file mode 100644 index 00000000000..3dfbc9e99fe --- /dev/null +++ b/projects/fvm/index.js @@ -0,0 +1,12 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports = { + misrepresentedTokens: true, + fantom: { + tvl: getUniTVL({ + factory: '0x472f3C3c9608fe0aE8d702f3f8A2d12c410C881A', + useDefaultCoreAssets: true, + hasStablePools: true, + }) + } +} diff --git a/projects/velocimeter-v2/index.js b/projects/velocimeter-v2/index.js index 39a4d0fe244..7732e6d89c7 100644 --- a/projects/velocimeter-v2/index.js +++ b/projects/velocimeter-v2/index.js @@ -16,11 +16,4 @@ module.exports = { hasStablePools: true, }) }, - fantom: { - tvl: getUniTVL({ - factory: '0x472f3C3c9608fe0aE8d702f3f8A2d12c410C881A', - useDefaultCoreAssets: true, - hasStablePools: true, - }) - } } From 0ce0d3c39b0a8a6e0923446e91374e0760d29d59 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 25 Jul 2023 21:55:16 +0200 Subject: [PATCH 0504/1974] add jewelswap liquid staking --- projects/helper/chain/elrond.js | 11 +++++++++++ projects/jewelswap-liq-staking/index.js | 12 ++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 projects/jewelswap-liq-staking/index.js diff --git a/projects/helper/chain/elrond.js b/projects/helper/chain/elrond.js index c65e43a3a51..c489ccff681 100644 --- a/projects/helper/chain/elrond.js +++ b/projects/helper/chain/elrond.js @@ -75,8 +75,19 @@ async function getNFTs(address) { return res } +async function getTokenData(token) { + const data = await get(`https://api.multiversx.com/tokens/${token}`) + return data +} + +async function sumTokensExport(...args) { + return () => sumTokens(...args) +} + module.exports = { sumTokens, call, getNFTs, + getTokenData, + sumTokensExport, } \ No newline at end of file diff --git a/projects/jewelswap-liq-staking/index.js b/projects/jewelswap-liq-staking/index.js new file mode 100644 index 00000000000..d6d82bb220a --- /dev/null +++ b/projects/jewelswap-liq-staking/index.js @@ -0,0 +1,12 @@ +const { getTokenData } = require('../helper/chain/elrond') +const { nullAddress } = require('../helper/tokenMapping') + +module.exports = { + elrond: { tvl} +} + +async function tvl(_, _b, _cb, { api, }) { + const data = await getTokenData('JWLEGLD-023462') + api.add(nullAddress, data.minted - data.burnt) +} + From 6fd74b8bbc5112123b2e8f7962f54b9c99dfb742 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 25 Jul 2023 22:33:43 +0200 Subject: [PATCH 0505/1974] update jewelswap liquid staking --- projects/jewelswap-liq-staking/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/projects/jewelswap-liq-staking/index.js b/projects/jewelswap-liq-staking/index.js index d6d82bb220a..18faf36c927 100644 --- a/projects/jewelswap-liq-staking/index.js +++ b/projects/jewelswap-liq-staking/index.js @@ -1,4 +1,4 @@ -const { getTokenData } = require('../helper/chain/elrond') +const { getTokenData, sumTokens, } = require('../helper/chain/elrond') const { nullAddress } = require('../helper/tokenMapping') module.exports = { @@ -7,6 +7,8 @@ module.exports = { async function tvl(_, _b, _cb, { api, }) { const data = await getTokenData('JWLEGLD-023462') + const data2 = await getTokenData('JWLASH-f362b9') api.add(nullAddress, data.minted - data.burnt) + api.add('JWLASH-f362b9', data2.minted - data2.burnt) } From f50c30809b3573d16d41023a2d94e4e95eb17343 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Wed, 26 Jul 2023 00:16:51 +0100 Subject: [PATCH 0506/1974] add hallmark --- projects/nexon/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/nexon/index.js b/projects/nexon/index.js index aa8d221b218..dd0d3c3cbfe 100644 --- a/projects/nexon/index.js +++ b/projects/nexon/index.js @@ -2,6 +2,9 @@ const { compoundExports } = require('../helper/compound'); const { nullAddress } = require('../helper/tokenMapping'); module.exports = { + hallmarks: [ + [1690243200, "read-only Reentrancy Attack"] + ], era: compoundExports('0x0171cA5b372eb510245F5FA214F5582911934b3D', 'era', '0x1BbD33384869b30A323e15868Ce46013C82B86FB', nullAddress, undefined, undefined, { resolveLPs: true, abis: { From 9ad88b7db7dd554dbbc9ea80aa43eb57cb80e6a4 Mon Sep 17 00:00:00 2001 From: happywomwom-wombat Date: Wed, 26 Jul 2023 11:24:36 +0800 Subject: [PATCH 0507/1974] add rbnb pool address --- projects/wombat-exchange/config.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/wombat-exchange/config.js b/projects/wombat-exchange/config.js index 697b6cdeb96..9b3a8325254 100644 --- a/projects/wombat-exchange/config.js +++ b/projects/wombat-exchange/config.js @@ -24,6 +24,7 @@ module.exports = { smartHAY: "0xa61dccC6c6E34C8Fbf14527386cA35589e9b8C27", wBETH: "0x8b892b6Ea1d0e5B29b719d6Bd6eb9354f1cDE060", ankrETH: "0x1b507b97c89eDE3E40d1b2Ed92972197c6276D35", + rbnb: "0x0592083B285aa75B9c8BaD2485C6cCCF93cCC348", }, }, arbitrum: { From 062fc3ceb84c788198a83a00aaf649988e62a717 Mon Sep 17 00:00:00 2001 From: happywomwom-wombat <129473631+happywomwom-wombat@users.noreply.github.com> Date: Wed, 26 Jul 2023 11:27:31 +0800 Subject: [PATCH 0508/1974] add snbnb address (#1) --- projects/wombat-exchange/config.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/wombat-exchange/config.js b/projects/wombat-exchange/config.js index 697b6cdeb96..12b5007dfa2 100644 --- a/projects/wombat-exchange/config.js +++ b/projects/wombat-exchange/config.js @@ -24,6 +24,7 @@ module.exports = { smartHAY: "0xa61dccC6c6E34C8Fbf14527386cA35589e9b8C27", wBETH: "0x8b892b6Ea1d0e5B29b719d6Bd6eb9354f1cDE060", ankrETH: "0x1b507b97c89eDE3E40d1b2Ed92972197c6276D35", + SnBNB: "0xF1e604e9A31c3b575f91CF008445B7ce06BF3fef", }, }, arbitrum: { From c681a9a76d150998cc2a47e58ce4bc5b1437c6b2 Mon Sep 17 00:00:00 2001 From: happywomwom-wombat <129473631+happywomwom-wombat@users.noreply.github.com> Date: Wed, 26 Jul 2023 14:14:29 +0800 Subject: [PATCH 0509/1974] feat/rbnb (#6913) * add rbnb pool address * add snbnb address (#1) --- projects/wombat-exchange/config.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/wombat-exchange/config.js b/projects/wombat-exchange/config.js index 12b5007dfa2..e11f0b7b3fe 100644 --- a/projects/wombat-exchange/config.js +++ b/projects/wombat-exchange/config.js @@ -24,6 +24,7 @@ module.exports = { smartHAY: "0xa61dccC6c6E34C8Fbf14527386cA35589e9b8C27", wBETH: "0x8b892b6Ea1d0e5B29b719d6Bd6eb9354f1cDE060", ankrETH: "0x1b507b97c89eDE3E40d1b2Ed92972197c6276D35", + rbnb: "0x0592083B285aa75B9c8BaD2485C6cCCF93cCC348", SnBNB: "0xF1e604e9A31c3b575f91CF008445B7ce06BF3fef", }, }, From e49276addaa0e9bd5efc94aa586f93d13678adb5 Mon Sep 17 00:00:00 2001 From: ftm1337 <84405345+ftm1337@users.noreply.github.com> Date: Wed, 26 Jul 2023 02:29:39 -0400 Subject: [PATCH 0510/1974] Equity - Add new pool (#6914) --- projects/equity/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/equity/index.js b/projects/equity/index.js index cf3c77cb8b3..ac9a5fa9678 100644 --- a/projects/equity/index.js +++ b/projects/equity/index.js @@ -3,6 +3,7 @@ const { gmxExports } = require("../helper/gmx"); module.exports = { fantom: { - tvl: gmxExports({ vault: '0x9e4105f9e2284532474f69e65680e440f4c91cb8' }), // Vault 01 + //tvl: gmxExports({ vault: '0x9e4105f9e2284532474f69e65680e440f4c91cb8' }), // Vault #1 - Disabled + tvl: gmxExports({ vault: '0x0Fb84ADB9c16D28b92c09c382CaadbDdD8e354c4' }), // Vault #2 }, }; From 7fe6246921308000af6e7cbf419c45bd416fb974 Mon Sep 17 00:00:00 2001 From: Jadeswap <136394034+Jadeswap@users.noreply.github.com> Date: Wed, 26 Jul 2023 12:54:22 +0500 Subject: [PATCH 0511/1974] updated the factory address (#6915) * added jadeswap * minor fix * Update index.js just updated the factory --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/jadeswap/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/jadeswap/index.js b/projects/jadeswap/index.js index 913d7a16b86..a1dde66f407 100644 --- a/projects/jadeswap/index.js +++ b/projects/jadeswap/index.js @@ -2,7 +2,7 @@ const ADDRESSES = require("../helper/coreAssets.json"); const { getUniTVL, staking } = require("../helper/unknownTokens"); const sdk = require("@defillama/sdk"); const uniTvl = getUniTVL({ - factory: "0x210D0c3d885C5D296e8F32Ad4B7a9a2Fe39E983b", + factory: "0xb20a6389cA872d094f3c7A8180fE5BAb431BD794", useDefaultCoreAssets: true, fetchBalances: true, }); From 60e780c52f8548f6722b794ceb8f5f1dbff755b0 Mon Sep 17 00:00:00 2001 From: Joseph Chalabi <100090645+chalabi2@users.noreply.github.com> Date: Wed, 26 Jul 2023 01:04:25 -0700 Subject: [PATCH 0512/1974] gravity bridge (#6869) * Add Gravity Bridge * Add All Tokens * track https://agni.finance * Delete index.js * Add gravity bridge query * gravity-bridge: code refactor --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/gravity-bridge/index.js | 79 ++++++++++++++++++++++++++++++++ projects/helper/chain/cosmos.js | 1 + projects/helper/chains.json | 1 + projects/helper/unwrapLPs.js | 13 +++++- 4 files changed, 92 insertions(+), 2 deletions(-) create mode 100644 projects/gravity-bridge/index.js diff --git a/projects/gravity-bridge/index.js b/projects/gravity-bridge/index.js new file mode 100644 index 00000000000..7854d1719af --- /dev/null +++ b/projects/gravity-bridge/index.js @@ -0,0 +1,79 @@ +const { getBalance2 } = require("../helper/chain/cosmos.js"); +const { sumTokensExport } = require('../helper/unwrapLPs') + +const erc20Contracts = [ + + "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC + "0xdAC17F958D2ee523a2206206994597C13D831ec7", // USDT + "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", // WBTC + "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", // WETH + "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0", // wstETH + "0xEa5A82B35244d9e5E48781F00b11B14E627D2951", // ATOM + "0xd2877702675e6cEb975b4A1dFf9fb7BAF4C91ea9", // WLUNC + "0xfB5c6815cA3AC72Ce9F5006869AE67f18bF77006", // pSTAKE + "0x45804880De22913dAFE09f4980848ECE6EcbAf78", // PAXG + "0xc0a4Df35568F116C370E6a6A6022Ceb908eedDaC", // UMEE + "0x44017598f2AF1bD733F9D87b5017b4E7c1B28DDE", // stkATOM + "0x817bbDbC3e8A1204f3691d14bB44992841e3dB35", // CUDOS + "0x467719aD09025FcC6cF6F8311755809d45a5E5f3", // AXL + "0x77E06c9eCCf2E797fd462A92B6D7642EF85b0A44", // WTAO + "0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE", // SHIB + "0x35a532d376FFd9a705d0Bb319532837337A398E7", // WDOGE + "0x93581991f68DBaE1eA105233b67f7FA0D6BDeE7b", // WEVMOS + "0x514910771AF9Ca656af840dff83E8264EcF986CA", // LINK + "0xa670d7237398238DE01267472C6f13e5B8010FD1", // SOMM + "0xd3E4Ba569045546D09CF021ECC5dFe42b1d7f6E4", // MNW + "0xd23Ed8cA350CE2631F7EcDC5E6bf80D0A1DeBB7B", // PLQ + "0x07baC35846e5eD502aA91AdF6A9e7aA210F2DcbE", // EROWAN + "0xA0b73E1Ff0B80914AB6fe0444E65848C4C34450b", // CRO + "0xe28b3B32B6c345A34Ff64674606124Dd5Aceca30", // INJ + "0x4c11249814f11b9346808179Cf06e71ac328c1b5", // ORAI + "0x4Fabb145d64652a948d72533023f6E7A623C7C53", // BUSD + "0x147faF8De9d8D8DAAE129B187F0D02D819126750", // GEO + "0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84", // stETH + "0xD8912C10681D8B21Fd3742244f44658dBA12264E", // PLU + "0x4f6103BAd230295baCF30f914FDa7D4273B7F585", // KI + "0xed0d5747A9AB03a75fBfEC3228cd55848245B75d", // NGM + "0x7D1AfA7B718fb893dB30A3aBc0Cfc608AaCfeBB0", // MATIC + "0x892A6f9dF0147e5f079b0993F486F9acA3c87881", //xFUND + "0x853d955aCEf822Db058eb8505911ED77F175b99e", //FRAX + "0xaea46A60368A7bD060eec7DF8CBa43b7EF41Ad85", //FET + "0x467719aD09025FcC6cF6F8311755809d45a5E5f3", //AXL + "0x2B89bF8ba858cd2FCee1faDa378D5cd6936968Be", //WSCRT + "0x4Fabb145d64652a948d72533023f6E7A623C7C53", //BUSD + "0x4c11249814f11b9346808179Cf06e71ac328c1b5", //ORAI + "0xa693B19d2931d498c5B318dF961919BB4aee87a5", //WUST + "0xBA11D00c5f74255f56a5E366F4F77f5A186d7f55", //BAND + "0x4547254E6E3195cE57Bc50352193A25c2F4B8FCf", //STARS + "0x7bE48633D86AA9821284B01030b8a3F9B06eA876", //HUAHUA + "0x6982508145454Ce325dDbE47a25d4ec3d2311933", //PEPE + "0xd2877702675e6cEb975b4A1dFf9fb7BAF4C91ea9", //WLUNC + "0x43373AE537945085Ee1001928E96204034bF55e6", //USDC2 + "0x76C4A2B59523eaE19594c630aAb43288dBB1463f", //IRIS + +]; + +const GRAVITY_BRIDGE_CONTRACT = "0xa4108aa1ec4967f8b52220a4f7e94a8201f2d906"; + +module.exports = { + methodology: 'Counts the tokens locked in the Gravity Bridge contract on Ethereum chain.', + start: 13798211, + ethereum: { + tvl: sumTokensExport({ owner: GRAVITY_BRIDGE_CONTRACT, tokens: erc20Contracts, }), + }, + gravitybridge: { + tvl, + } +}; + +async function tvl(_, _b, _cb, { api, }) { + const bals = await getBalance2({ chain: 'gravitybridge', owner: 'gravity16n3lc7cywa68mg50qhp847034w88pntqzx3ksm'}) + Object.entries(bals).forEach(([key, val]) => { + if (key.startsWith('gravity0x')) { + // these tokens are already counted on ethereum side + // api.add(key.replace('gravity', ''), val, { skipChain: true}) + } else { + api.add(key, val) + } + }) +} \ No newline at end of file diff --git a/projects/helper/chain/cosmos.js b/projects/helper/chain/cosmos.js index eeb1f554bf8..65de317ef8d 100644 --- a/projects/helper/chain/cosmos.js +++ b/projects/helper/chain/cosmos.js @@ -29,6 +29,7 @@ const endPoints = { kava: "https://api2.kava.io", neutron: "https://rest-kralum.neutron-1.neutron.org", quasar: "https://quasar-api.polkachu.com", + gravitybridge: "https://rest.cosmos.directory/gravitybridge", }; const chainSubpaths = { diff --git a/projects/helper/chains.json b/projects/helper/chains.json index 7c655105ba9..7e40cf02e04 100644 --- a/projects/helper/chains.json +++ b/projects/helper/chains.json @@ -79,6 +79,7 @@ "godwoken", "godwoken_v1", "goerli", + "gravitybridge", "grove", "harmony", "heco", diff --git a/projects/helper/unwrapLPs.js b/projects/helper/unwrapLPs.js index 9437f3a08ea..ffe169255a8 100644 --- a/projects/helper/unwrapLPs.js +++ b/projects/helper/unwrapLPs.js @@ -676,6 +676,7 @@ async function sumTokens2({ resolveArtBlocks = false, resolveNFTs = false, permitFailure = false, + fetchCoValentTokens = false, }) { if (api) { chain = api.chain ?? chain @@ -690,6 +691,14 @@ async function sumTokens2({ await sumArtBlocks({ balances, api, owner, owners, }) } + if (fetchCoValentTokens) { + if (!api) throw new Error('Missing arg: api') + if (!owners || !owners.length) owners = [owner] + const cTokens = (await Promise.all(owners.map(i => covalentGetTokens(i, api.chain)))).flat() + tokens = [...cTokens, ...tokens] + console.log('cTokens', cTokens.length) + } + if (resolveNFTs) { if (!api) throw new Error('Missing arg: api') if (!owners || !owners.length) owners = [owner] @@ -745,8 +754,8 @@ async function sumTokens2({ } } -function sumTokensExport({ balances, tokensAndOwners, tokensAndOwners2, tokens, owner, owners, transformAddress, unwrapAll, resolveLP, blacklistedLPs, blacklistedTokens, skipFixBalances, ownerTokens, resolveUniV3, resolveArtBlocks, resolveNFTs, }) { - return async (_, _b, _cb, { api }) => sumTokens2({ api, balances, tokensAndOwners, tokensAndOwners2, tokens, owner, owners, transformAddress, unwrapAll, resolveLP, blacklistedLPs, blacklistedTokens, skipFixBalances, ownerTokens, resolveUniV3, resolveArtBlocks, resolveNFTs, }) +function sumTokensExport({ balances, tokensAndOwners, tokensAndOwners2, tokens, owner, owners, transformAddress, unwrapAll, resolveLP, blacklistedLPs, blacklistedTokens, skipFixBalances, ownerTokens, resolveUniV3, resolveArtBlocks, resolveNFTs, fetchCoValentTokens, ...args }) { + return async (_, _b, _cb, { api }) => sumTokens2({ api, balances, tokensAndOwners, tokensAndOwners2, tokens, owner, owners, transformAddress, unwrapAll, resolveLP, blacklistedLPs, blacklistedTokens, skipFixBalances, ownerTokens, resolveUniV3, resolveArtBlocks, resolveNFTs, fetchCoValentTokens, ...args,}) } async function unwrapBalancerToken({ api, chain, block, balancerToken, owner, balances = {}, isBPool = false, isV2 = true }) { From 069aef5d0c067cfbc225e23ede59887f3a09622b Mon Sep 17 00:00:00 2001 From: define Date: Wed, 26 Jul 2023 10:33:51 +0100 Subject: [PATCH 0513/1974] add treasury --- projects/treasury/ether.js | 26 ++++++++++++++++++ projects/treasury/ethglobal.js | 16 +++++++++++ projects/treasury/rotki.js | 42 +++++++++++++++++++++++++++++ projects/treasury/wagmi.js | 18 +++++++++++++ projects/treasury/zachxtb-theman.js | 41 ++++++++++++++++++++++++++++ 5 files changed, 143 insertions(+) create mode 100644 projects/treasury/ether.js create mode 100644 projects/treasury/ethglobal.js create mode 100644 projects/treasury/rotki.js create mode 100644 projects/treasury/wagmi.js create mode 100644 projects/treasury/zachxtb-theman.js diff --git a/projects/treasury/ether.js b/projects/treasury/ether.js new file mode 100644 index 00000000000..b4acc5affcc --- /dev/null +++ b/projects/treasury/ether.js @@ -0,0 +1,26 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasuryOP = "0x8ba1f109551bD432803012645Ac136ddd64DBA72"; +const treasuryETH = "0x8ba1f109551bD432803012645Ac136ddd64DBA72" + +module.exports = treasuryExports({ + optimism: { + tokens: [ + nullAddress, + ADDRESSES.optimism.USDC, // USDC + ADDRESSES.optimism.OP + ], + owners: [treasuryOP], + }, + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.USDC, // USDC + ADDRESSES.ethereum.TUSD, + ADDRESSES.ethereum.DAI, + ADDRESSES.ethereum.USDT + ], + owners: [treasuryETH], + }, +}); \ No newline at end of file diff --git a/projects/treasury/ethglobal.js b/projects/treasury/ethglobal.js new file mode 100644 index 00000000000..1fb3aaa9b1a --- /dev/null +++ b/projects/treasury/ethglobal.js @@ -0,0 +1,16 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0x336DEe4022d6CC2F95cfe9e0949B9E0EDDAC457D"; + +module.exports = treasuryExports({ + optimism: { + tokens: [ + nullAddress, + ADDRESSES.optimism.USDC, // USDC + ADDRESSES.optimism.OP + ], + owners: [treasury], + ownTokens: [], + }, +}); diff --git a/projects/treasury/rotki.js b/projects/treasury/rotki.js new file mode 100644 index 00000000000..3420dd3cda8 --- /dev/null +++ b/projects/treasury/rotki.js @@ -0,0 +1,42 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0x9531C059098e3d194fF87FebB587aB07B30B1306"; + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.USDC, // USDC + ADDRESSES.ethereum.USDT, + ADDRESSES.ethereum.DAI, + "0xC18360217D8F7Ab5e7c516566761Ea12Ce7F9D72", + "0x8290333ceF9e6D528dD5618Fb97a76f268f3EDD4", + "0xc5102fE9359FD9a28f877a67E36B0F050d81a3CC", + ADDRESSES.ethereum.sUSD, + ADDRESSES.ethereum.MKR + ], + owners: [treasury], + ownTokens: [], + }, + optimism: { + tokens: [ + nullAddress, + ADDRESSES.optimism.USDC, + ADDRESSES.optimism.USDT, + ADDRESSES.optimism.OP + ], + owners: [treasury] + }, + arbitrum: { + tokens: [ + nullAddress, + ADDRESSES.arbitrum.USDC, + ADDRESSES.arbitrum.USDT, + ADDRESSES.arbitrum.ARB, + ADDRESSES.arbitrum.DAI, + ADDRESSES.arbitrum.WETH + ], + owners: [treasury] + }, +}); \ No newline at end of file diff --git a/projects/treasury/wagmi.js b/projects/treasury/wagmi.js new file mode 100644 index 00000000000..4d21dca03bd --- /dev/null +++ b/projects/treasury/wagmi.js @@ -0,0 +1,18 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0xd2135CfB216b74109775236E36d4b433F1DF507B"; + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.USDC, // USDC + ADDRESSES.ethereum.USDT, + ADDRESSES.ethereum.DAI, + "0x8290333ceF9e6D528dD5618Fb97a76f268f3EDD4" + ], + owners: [treasury], + ownTokens: [], + }, +}); \ No newline at end of file diff --git a/projects/treasury/zachxtb-theman.js b/projects/treasury/zachxtb-theman.js new file mode 100644 index 00000000000..bb7338de540 --- /dev/null +++ b/projects/treasury/zachxtb-theman.js @@ -0,0 +1,41 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasuryOP = "0x9D727911B54C455B0071A7B682FcF4Bc444B5596"; +const treasuryETH = "0x9D727911B54C455B0071A7B682FcF4Bc444B5596" +const treasuryARB = "0x9D727911B54C455B0071A7B682FcF4Bc444B5596" + +module.exports = treasuryExports({ + optimism: { + tokens: [ + nullAddress, + ADDRESSES.optimism.USDC, // USDC + ADDRESSES.optimism.OP + ], + owners: [treasuryOP], + }, + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.USDC, // USDC + ADDRESSES.ethereum.WETH, + ADDRESSES.ethereum.TUSD, + ADDRESSES.ethereum.DAI, + ADDRESSES.ethereum.USDT, + "0xE80C0cd204D654CEbe8dd64A4857cAb6Be8345a3", + ADDRESSES.ethereum.WBTC, + "0xC0c293ce456fF0ED870ADd98a0828Dd4d2903DBF", //AURA + "0xB6eD7644C69416d67B522e20bC294A9a9B405B31", //0XBTC + ], + owners: [treasuryETH], + }, + arbitrum: { + tokens: [ + nullAddress, + ADDRESSES.arbitrum.USDC, // USDC + ADDRESSES.arbitrum.USDC_CIRCLE, + ADDRESSES.arbitrum.WETH + ], + owners: [treasuryARB], + }, +}); \ No newline at end of file From fc001d93a8a3417b007454bc87fc8637574bc479 Mon Sep 17 00:00:00 2001 From: define Date: Wed, 26 Jul 2023 11:15:57 +0100 Subject: [PATCH 0514/1974] add factories pancake era --- projects/pancake-swap/index.js | 3 +++ projects/pancakeswap-v3/index.js | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/projects/pancake-swap/index.js b/projects/pancake-swap/index.js index 86432fa0756..6de8621a3d4 100644 --- a/projects/pancake-swap/index.js +++ b/projects/pancake-swap/index.js @@ -94,4 +94,7 @@ module.exports = { token0Reserve: i => i.data.reserve_x, token1Reserve: i => i.data.reserve_y, }).aptos, + era: { + tvl: getUniTVL({ factory: '0xd03D8D566183F0086d8D09A84E1e30b58Dd5619d', useDefaultCoreAssets: true, }) + }, } diff --git a/projects/pancakeswap-v3/index.js b/projects/pancakeswap-v3/index.js index b266175edf2..2e2afab9811 100644 --- a/projects/pancakeswap-v3/index.js +++ b/projects/pancakeswap-v3/index.js @@ -11,5 +11,6 @@ module.exports = uniV3Export({ ] }, ethereum: { factory: '0x0bfbcf9fa4f9c56b0f40a671ad40e0805a091865', fromBlock: 16950685, }, polygon_zkevm: { factory: '0x0BFbCF9fa4f9C56B0F40a671Ad40E0805A091865', fromBlock: 750148, }, - linea: { factory: '0x0BFbCF9fa4f9C56B0F40a671Ad40E0805A091865', fromBlock: 1444, }, + linea: { factory: '0x0BFbCF9fa4f9C56B0F40a671Ad40E0805A091865', fromBlock: 1445, }, + era: { factory: '0x1BB72E0CbbEA93c08f535fc7856E0338D7F7a8aB', fromBlock: 9413438, } }) From e7abf1a039bed35dd0a6d9391262e806aa750091 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 26 Jul 2023 16:13:27 +0200 Subject: [PATCH 0515/1974] track factor v2 --- projects/factor-v2/index.js | 26 ++++++++++++++++++++++++++ projects/factor/index.js | 7 ++++--- projects/helper/chains.json | 2 ++ projects/helper/env.js | 1 + 4 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 projects/factor-v2/index.js diff --git a/projects/factor-v2/index.js b/projects/factor-v2/index.js new file mode 100644 index 00000000000..dc4521416f1 --- /dev/null +++ b/projects/factor-v2/index.js @@ -0,0 +1,26 @@ +const { getLogs } = require('../helper/cache/getLogs') + +const config = { + arbitrum: { factory: '0x6b3e693b436510c430ffbb6b5ca6c8248022f1cd', fromBlock: 112324705 }, +} + +Object.keys(config).forEach(chain => { + const { factory, fromBlock, } = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const logs = await getLogs({ + api, + target: factory, + topics: ['0xc66cfbda93c132fbda8600e8032ce13d18d0db1d139e72d677d5556e0acf9484'], + eventAbi: 'event VaultCreated (address indexed vault, address strategy, string name, string symbol, uint256 approval)', + onlyArgs: true, + fromBlock, + }) + const vaults = logs.map(log => log.vault) + const tokens = await api.multiCall({ abi: 'address:asset', calls: vaults }) + const bals = await api.multiCall({ abi: 'uint256:assetBalance', calls: vaults }) + // console.table(vaults.map((v, i) => ({ vault: v, token: tokens[i], bal: bals[i] }))) + api.addTokens(tokens, bals) + } + } +}) \ No newline at end of file diff --git a/projects/factor/index.js b/projects/factor/index.js index 59df2118a6d..4bbc739b2d3 100644 --- a/projects/factor/index.js +++ b/projects/factor/index.js @@ -1,13 +1,14 @@ const { staking } = require("../helper/staking"); const { sumTokens2 } = require('../helper/unwrapLPs'); +const { cachedGraphQuery } = require('../helper/cache'); const FCTR = "0x6dD963C510c2D2f09d5eDdB48Ede45FeD063Eb36" const veFCTR = "0xA032082B08B2EF5A6C3Ea80DaEac58300F68FB73" -const FCTR_RNDTX = "0x95C34a4efFc5eEF480c65E2865C63EE28F2f9C7e" // Factor Roundtable Index - -const indices = [FCTR_RNDTX] async function tvl(timestamp, block, chainBlocks, { api }) { + const endpoint = 'https://api.thegraph.com/subgraphs/name/yanuar-ar/factor-arbitrum' + const res = await cachedGraphQuery('factor-v1', endpoint, `{vaultGeneses { id }}`) + const indices = res.vaultGeneses.map(v => v.id) const uBalances = await api.multiCall({ abi: 'uint256[]:underlyingAssetsBalance', calls: indices }) const calls = [] uBalances.forEach((v, i) => { diff --git a/projects/helper/chains.json b/projects/helper/chains.json index 7e40cf02e04..9cbc34087b8 100644 --- a/projects/helper/chains.json +++ b/projects/helper/chains.json @@ -112,6 +112,7 @@ "liquidchain", "litecoin", "loop", + "lukso", "lung", "mantle", "map", @@ -151,6 +152,7 @@ "palm", "parallel", "persistence", + "pgn", "pokt", "polis", "polkadot", diff --git a/projects/helper/env.js b/projects/helper/env.js index 4982ec6c8d0..629da7076d2 100644 --- a/projects/helper/env.js +++ b/projects/helper/env.js @@ -10,6 +10,7 @@ const DEFAULTS = { SUI_RPC: 'https://fullnode.mainnet.sui.io/', MULTIVERSX_RPC: 'https://api.multiversx.com', LINEA_RPC: 'https://linea.rpc.thirdweb.com', + PGN_RPC: 'https://rpc.publicgoods.network', } const ENV_KEYS = [ From 9ae97dc9ddc5bb65b3036d58e018598b0198d16d Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 26 Jul 2023 16:44:42 +0200 Subject: [PATCH 0516/1974] update drift.js --- projects/drift.js | 59 ++++++++++++++++++++++++++++++++--------------- 1 file changed, 41 insertions(+), 18 deletions(-) diff --git a/projects/drift.js b/projects/drift.js index f5c1c48e61c..97d5c678111 100644 --- a/projects/drift.js +++ b/projects/drift.js @@ -1,25 +1,48 @@ -const { sumTokens2 } = require('./helper/solana') - -async function tvl() { - // token account authority: JCNCMFXo5M5qwUPg2Utu1u6YWp3MbygxqBsBeXXJfrw - return sumTokens2({ - tokenAccounts: [ - '6W9yiHDCW9EpropkFV8R3rPiL8LVWUHSiys3YeW6AT6S', // legacy usdc vault - 'Bzjkrm1bFwVXUaV9HTnwxFrPtNso7dnwPQamhqSxtuhZ', // usdc insurance fund - 'GXWqPpjQpdz7KZw9p7f5PX2eGxHAhvpNXiviFkAB8zXg', // usdc vault - 'DfYCNezifxAEsQbAJ1b3j6PX3JVBe8fu11KBhxsbw5d2', // sol vault - '4vwQWa4RjmPkn1WrmyEE3t912yWsBf9JNkASH36AQL3F', // sol insurance fund - '5p8B6KhJjesV212heBu1o86W2vUSnW1P83ZNnMLtCAAx', // msol vault - 'iBM2BTsrXXDfwm4P4ssbzBAquaj7gGgNNhBVaq8ryiY', // msol insurance fund - '2CqkQvYxp9Mq4PqLvAQ1eryYxebUh4Liyn5YMDtXsYci', // legacy usdc insurance fund - ] - }) -} +const { PublicKey } = require("@solana/web3.js"); +const anchor = require("@project-serum/anchor"); +const { sumTokens2, } = require("./helper/solana"); +const DRIFT_PROGRAM_ID = new PublicKey('dRiftyHA39MWEi3m9aunc5MzRF1JYuBsbn6VPcn33UH') +const { getConfig } = require('./helper/cache') module.exports = { timetravel: false, methodology: "Calculate sum across all program token accounts", solana: { - tvl + tvl, + }, +}; + +async function tvl(_, _b, _cb, { api, }) { + + const legacyVaults = [ + '6W9yiHDCW9EpropkFV8R3rPiL8LVWUHSiys3YeW6AT6S', // legacy usdc vault + '2CqkQvYxp9Mq4PqLvAQ1eryYxebUh4Liyn5YMDtXsYci', // legacy usdc insurance fund + ]; + const getSpotMarketVaultPublicKey = marketIndex => getVaultPublicKey('spot_market_vault', marketIndex) + const getInsuranceFundVaultPublicKey = marketIndex => getVaultPublicKey('insurance_fund_vault', marketIndex) + let configFile = await getConfig('drift-config', 'https://raw.githubusercontent.com/drift-labs/protocol-v2/master/sdk/src/constants/spotMarkets.ts') + const marketIndices = []; + configFile = configFile.slice(configFile.indexOf('MainnetSpotMarkets:')) + + const regex = /marketIndex:\s*(\d+),/g + let match; + while ((match = regex.exec(configFile))) { + marketIndices.push(parseInt(match[1])); } + + const vaults = [ + ...legacyVaults, + ...marketIndices.map(getSpotMarketVaultPublicKey), + ...marketIndices.map(getInsuranceFundVaultPublicKey), + ] + + return sumTokens2({ tokenAccounts: vaults }) +} + +function getVaultPublicKey(seed, marketIndex) { + return PublicKey.findProgramAddressSync( + [ + Buffer.from(anchor.utils.bytes.utf8.encode(seed)), + new anchor.BN(marketIndex).toArrayLike(Buffer, 'le', 2), + ], DRIFT_PROGRAM_ID)[0]; } From 70c2fa3f454b3840e0e47fd3f0d69851dad1df59 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 26 Jul 2023 17:38:06 +0200 Subject: [PATCH 0517/1974] aura: track polygon --- projects/aura-finance/index.js | 1 + projects/hawksight/index.js | 2 ++ 2 files changed, 3 insertions(+) diff --git a/projects/aura-finance/index.js b/projects/aura-finance/index.js index 4fd9a113b2f..fca63047ec3 100644 --- a/projects/aura-finance/index.js +++ b/projects/aura-finance/index.js @@ -63,6 +63,7 @@ async function tvl(_, block, _1, { api }) { const config = { arbitrum: { factory: '0x6817149cb753bf529565b4d023d7507ed2ff4bc0', fromBlock: 72942741, voterProxy: '0xc181edc719480bd089b94647c2dc504e2700a2b0'}, optimism: { factory: '0xa523f47A933D5020b23629dDf689695AA94612Dc', fromBlock: 83239534, voterProxy: '0xc181edc719480bd089b94647c2dc504e2700a2b0'}, + polygon: { factory: '0x22625eedd92c81a219a83e1dc48f88d54786b017', fromBlock: 40687417, voterProxy: '0xC181Edc719480bd089b94647c2Dc504e2700a2B0'}, } module.exports = { diff --git a/projects/hawksight/index.js b/projects/hawksight/index.js index b87e0570e9a..d7b253f4e68 100644 --- a/projects/hawksight/index.js +++ b/projects/hawksight/index.js @@ -1,4 +1,5 @@ const { fetchURL } = require('../helper/utils') +const { sumTokens2 } = require('../helper/solana') async function tvl() { @@ -11,5 +12,6 @@ module.exports = { methodology: 'Sums the total value locked of all strategies in Hawksight', solana: { tvl, + staking: () => sumTokens2({ tokenAccounts: ['2eFeetCpZJprr67F2dToT52BbSkdeqKZT6hmVdVG14eU']}) } } \ No newline at end of file From 69088d5b4048f4a5f66f619b27daa939db9834a4 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Wed, 26 Jul 2023 19:51:49 +0100 Subject: [PATCH 0518/1974] fix olympus --- projects/olympus/index.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/projects/olympus/index.js b/projects/olympus/index.js index da2f70e5839..157d96f2edb 100644 --- a/projects/olympus/index.js +++ b/projects/olympus/index.js @@ -63,15 +63,6 @@ query { } }`; -const subgraphUrls = { - ethereum: `https://gateway.thegraph.com/api/${getEnv('OLYMPUS_GRAPH_API_KEY')}/subgraphs/id/DTcDcUSBRJjz9NeoK5VbXCVzYbRTyuBwdPUqMi8x32pY`, - arbitrum: - "https://api.thegraph.com/subgraphs/name/olympusdao/protocol-metrics-arbitrum", - fantom: - "https://api.thegraph.com/subgraphs/name/olympusdao/protocol-metrics-fantom", - polygon: - "https://api.thegraph.com/subgraphs/name/olympusdao/protocol-metrics-polygon", -}; //Subgraph returns balances in tokenAddress / allocator pairs. Need to return based on balance. function sumBalancesByTokenAddress(arr) { @@ -98,6 +89,15 @@ function sumBalancesByTokenAddress(arr) { * #3. Sum values returned ***/ async function tvl(timestamp, block, _, { api }, isOwnTokensMode = false) { +const subgraphUrls = { + ethereum: `https://gateway.thegraph.com/api/${getEnv('OLYMPUS_GRAPH_API_KEY')}/subgraphs/id/DTcDcUSBRJjz9NeoK5VbXCVzYbRTyuBwdPUqMi8x32pY`, + arbitrum: + "https://api.thegraph.com/subgraphs/name/olympusdao/protocol-metrics-arbitrum", + fantom: + "https://api.thegraph.com/subgraphs/name/olympusdao/protocol-metrics-fantom", + polygon: + "https://api.thegraph.com/subgraphs/name/olympusdao/protocol-metrics-polygon", +}; const indexedBlockForEndpoint = await blockQuery( subgraphUrls[api.chain], getLatestBlockIndexed, From 7e6e371bb3e3453f33b0a650d41721b7a861e693 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 27 Jul 2023 09:33:10 +0200 Subject: [PATCH 0519/1974] update zkbob --- projects/zkbob/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/projects/zkbob/index.js b/projects/zkbob/index.js index cca35262c4f..e3983c16cab 100644 --- a/projects/zkbob/index.js +++ b/projects/zkbob/index.js @@ -1,10 +1,12 @@ const { sumTokensExport } = require('../helper/unwrapLPs') +const ADDRESSES = require('../helper/coreAssets.json') module.exports = { polygon: { tvl: sumTokensExport({ tokens: [ '0xB0B195aEFA3650A6908f15CdaC7D92F8a5791B0B', // BOB + ADDRESSES.polygon.USDC, ], owner: '0x72e6b59d4a90ab232e55d4bb7ed2dd17494d62fb' }), @@ -13,8 +15,9 @@ module.exports = { tvl: sumTokensExport({ tokens: [ '0xb0b195aefa3650a6908f15cdac7d92f8a5791b0b', // BOB + ADDRESSES.optimism.WETH_1, ], - owner: '0x1ca8c2b9b20e18e86d5b9a72370fc6c91814c97c' + owners: ['0x1ca8c2b9b20e18e86d5b9a72370fc6c91814c97c', '0x58320A55bbc5F89E5D0c92108F762Ac0172C5992'] }), }, } \ No newline at end of file From 9620e089b89d7e281b419772faf3be59e3985116 Mon Sep 17 00:00:00 2001 From: Jon Date: Thu, 27 Jul 2023 00:37:29 -0700 Subject: [PATCH 0520/1974] Fix tvl double subtract bug (#6921) --- projects/glif/index.js | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/projects/glif/index.js b/projects/glif/index.js index 2744e17f6a2..195fead9a62 100644 --- a/projects/glif/index.js +++ b/projects/glif/index.js @@ -11,9 +11,8 @@ module.exports = { "The GLIF Pools protocol is a liquid staking protocol for Filecoin that requires borrowers to collateralize FIL in order to borrow for their storage providing operation. This TVL calculation adds the total amount of FIL staked into the protocol, and the total amount of locked FIL collateral by borrowers, to arrive at TVL.", filecoin: { tvl: async (_, _1, _2, { api }) => { - const [totalAssets, totalIssued, totalLockedByMiners] = await Promise.all([ + const [totalAssets, totalLockedByMiners] = await Promise.all([ api.call({ abi: totalAssetsABI, target: INFINITY_POOL_CONTRACT }), - api.call({ abi: totalBorrowedABI, target: INFINITY_POOL_CONTRACT }), // this call is too costly to perform on chain in this environment, // we wrapped the locked miners collateral in a server that derives the information directly on-chain // but serves it in a more efficient manner to not overload defillama frontend @@ -21,17 +20,15 @@ module.exports = { get("https://pools-metrics.vercel.app/api/v0/miner-collaterals"), ]); - const totalAssetsBN = BigNumber.from(totalAssets) - const totalIssuedBN = BigNumber.from(totalIssued) - const totalLockedByMinersBN = BigNumber.from(totalLockedByMiners.totalMinerCollaterals) - - // first we remove the totalIssued by the Pool from its totalAssets, to avoid double counting in the next step - const totalAssetsMinusIssued = totalAssetsBN.sub(totalIssuedBN); + const totalAssetsBN = BigNumber.from(totalAssets); + const totalLockedByMinersBN = BigNumber.from( + totalLockedByMiners.totalMinerCollaterals + ); // then we add the totalLockedByMiners to the totalAssets, to account for the FIL locked by miners as borrow collateral // this gets our tvl in attoFIL (wei denominated) without double counting - const tvl = totalAssetsMinusIssued.add(totalLockedByMinersBN).toString(); + const tvl = totalAssetsBN.add(totalLockedByMinersBN).toString(); - api.add(nullAddress, tvl) + api.add(nullAddress, tvl); }, }, }; From 06fd0aa795ba709012cfebd1a956895ebf15cd06 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 27 Jul 2023 13:50:28 +0200 Subject: [PATCH 0521/1974] track https://fcondex.com --- projects/fcondex/index.js | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 projects/fcondex/index.js diff --git a/projects/fcondex/index.js b/projects/fcondex/index.js new file mode 100644 index 00000000000..73c66369fff --- /dev/null +++ b/projects/fcondex/index.js @@ -0,0 +1,11 @@ +const { getUniTVL } = require("../helper/unknownTokens"); +module.exports = { + misrepresentedTokens: true, + mantle: { + tvl: getUniTVL({ + factory: "0x3eF942017d51BA257c4B61BE2f8f641209C8b341", + useDefaultCoreAssets: true, + fetchBalanes: true, + }), + }, +}; From 0072826cc7ac43c8736c54bfd0b747329f710150 Mon Sep 17 00:00:00 2001 From: Zyberswap-Arbitrum <121235717+Zyberswap-Arbitrum@users.noreply.github.com> Date: Thu, 27 Jul 2023 13:56:07 +0200 Subject: [PATCH 0522/1974] add optimism v3 algebra (#6927) --- projects/zyberswap-v3/index.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/projects/zyberswap-v3/index.js b/projects/zyberswap-v3/index.js index 1cd8e80e441..1cace364a18 100644 --- a/projects/zyberswap-v3/index.js +++ b/projects/zyberswap-v3/index.js @@ -5,5 +5,10 @@ module.exports = uniV3Export({ factory: '0x9c2abd632771b433e5e7507bcaa41ca3b25d8544', fromBlock: 62714800, isAlgebra: true, + }, + optimism: { + factory: '0x0c8f7b0cb986b31c67d994fb5c224592a03a4afd', + fromBlock: 105900073, + isAlgebra: true, } }) From d3b5df8f2bb782344a5a73fe61f22e965e451103 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 27 Jul 2023 14:22:09 +0200 Subject: [PATCH 0523/1974] update tegisto --- projects/tegisto/index.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/projects/tegisto/index.js b/projects/tegisto/index.js index 11032fd5007..699f0725948 100644 --- a/projects/tegisto/index.js +++ b/projects/tegisto/index.js @@ -1,9 +1,16 @@ const { staking } = require("../helper/staking") const { getUniTVL } = require("../helper/unknownTokens") +const sdk = require('@defillama/sdk') module.exports = { kava: { - tvl: getUniTVL({ chain: 'kava', factory: '0x07fA706528c0bb721327798B5686B620BCcf5b99', useDefaultCoreAssets: true, fetchBalances: true }), + tvl: sdk.util.sumChainTvls([ + getUniTVL({ factory: '0x07fA706528c0bb721327798B5686B620BCcf5b99', useDefaultCoreAssets: true, fetchBalances: true }), + getUniTVL({ factory: '0xfdF832fe60a5145909e7b24Cff225830c1850917', useDefaultCoreAssets: true, fetchBalances: true }), + ]), staking: staking('0x744Dd9f79b80437a9e5eb0292128045F51C48b6d', '0x87F1E00d6bcD3712031e5edD26DFcdB0FEd35D20', undefined, 'tegisto', 18), + }, + celo: { + tvl: getUniTVL({ factory: '0x1FA136Ba715889B691305a687A0fbD82e6287A67', useDefaultCoreAssets: true, fetchBalances: true }), } } \ No newline at end of file From 7526087c448ed3822aeb28ffdefcaeb4d7f4bd19 Mon Sep 17 00:00:00 2001 From: Luke Date: Thu, 27 Jul 2023 22:25:35 +1000 Subject: [PATCH 0524/1974] Patched incorrect legacy USDC insurance fund address being used (#6925) * Patched incorrect legacy USDC insurance fund address being used * Fixed typo in address --- projects/drift.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/drift.js b/projects/drift.js index 97d5c678111..54e11d9f39f 100644 --- a/projects/drift.js +++ b/projects/drift.js @@ -16,7 +16,7 @@ async function tvl(_, _b, _cb, { api, }) { const legacyVaults = [ '6W9yiHDCW9EpropkFV8R3rPiL8LVWUHSiys3YeW6AT6S', // legacy usdc vault - '2CqkQvYxp9Mq4PqLvAQ1eryYxebUh4Liyn5YMDtXsYci', // legacy usdc insurance fund + 'Bzjkrm1bFwVXUaV9HTnwxFrPtNso7dnwPQamhqSxtuhZ', // legacy usdc insurance fund ]; const getSpotMarketVaultPublicKey = marketIndex => getVaultPublicKey('spot_market_vault', marketIndex) const getInsuranceFundVaultPublicKey = marketIndex => getVaultPublicKey('insurance_fund_vault', marketIndex) From 538a79ef9cce02ff5e41addaf54225969eebe18c Mon Sep 17 00:00:00 2001 From: Michael Semin Date: Thu, 27 Jul 2023 20:27:04 +0800 Subject: [PATCH 0525/1974] added ethereum to rehold-v2 (#6922) --- projects/rehold-v2/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/rehold-v2/index.js b/projects/rehold-v2/index.js index 8b5fb1aa287..d42de3b0345 100644 --- a/projects/rehold-v2/index.js +++ b/projects/rehold-v2/index.js @@ -15,6 +15,7 @@ async function tvl(_, _b, _cb, { api, }) { } module.exports = { + ethereum: { tvl }, bsc: { tvl }, polygon: { tvl }, avax: { tvl }, From 4e8bc76650fec7535ef293c9c4e9f8a2df484bf0 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 27 Jul 2023 15:10:08 +0200 Subject: [PATCH 0526/1974] track https://www.lendle.xyz --- package-lock.json | 12 ++++---- projects/drift.js | 2 +- projects/helper/aave.js | 16 +++++++++- projects/lendle/index.js | 5 +++ projects/umee/index.js | 66 ++-------------------------------------- 5 files changed, 30 insertions(+), 71 deletions(-) create mode 100644 projects/lendle/index.js diff --git a/package-lock.json b/package-lock.json index 95a6310852c..155721c37f7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -63,9 +63,9 @@ } }, "node_modules/@defillama/sdk": { - "version": "4.0.40", - "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.40.tgz", - "integrity": "sha512-HlAR2LjWINdTkn2mg9hTTFgWoCnmY2Z5tTjZG4urMwJO1OA/BbBqzv7Cz9oSLnlgNUOalAp1oQNDeS0/abSKPg==", + "version": "4.0.42", + "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.42.tgz", + "integrity": "sha512-eP9eo82vmWUqnw6Xjz9rvoNDH/5QTQp7cXdZyQa6cYV/JGRZ4Yq05BuHtnIt0ngH7BJJ4UsjDN66nMFA3uN2vA==", "dependencies": { "@supercharge/promise-pool": "^2.1.0", "ethers": "^5.4.5", @@ -4194,9 +4194,9 @@ } }, "@defillama/sdk": { - "version": "4.0.40", - "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.40.tgz", - "integrity": "sha512-HlAR2LjWINdTkn2mg9hTTFgWoCnmY2Z5tTjZG4urMwJO1OA/BbBqzv7Cz9oSLnlgNUOalAp1oQNDeS0/abSKPg==", + "version": "4.0.42", + "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.42.tgz", + "integrity": "sha512-eP9eo82vmWUqnw6Xjz9rvoNDH/5QTQp7cXdZyQa6cYV/JGRZ4Yq05BuHtnIt0ngH7BJJ4UsjDN66nMFA3uN2vA==", "requires": { "@supercharge/promise-pool": "^2.1.0", "ethers": "^5.4.5", diff --git a/projects/drift.js b/projects/drift.js index 54e11d9f39f..bc0d8dc90df 100644 --- a/projects/drift.js +++ b/projects/drift.js @@ -44,5 +44,5 @@ function getVaultPublicKey(seed, marketIndex) { [ Buffer.from(anchor.utils.bytes.utf8.encode(seed)), new anchor.BN(marketIndex).toArrayLike(Buffer, 'le', 2), - ], DRIFT_PROGRAM_ID)[0]; + ], DRIFT_PROGRAM_ID)[0].toBase58() } diff --git a/projects/helper/aave.js b/projects/helper/aave.js index 74ef546ab0c..744a360af3a 100644 --- a/projects/helper/aave.js +++ b/projects/helper/aave.js @@ -1,3 +1,4 @@ +const { getLogs } = require('./cache/getLogs') const ADDRESSES = require('./coreAssets.json') const sdk = require('@defillama/sdk'); const { default: BigNumber } = require('bignumber.js'); @@ -187,7 +188,7 @@ const oracleAbis = { getAssetsPrices: "function getAssetsPrices(address[] assets) view returns (uint256[])", } -function aaveV2Export(registry, { useOracle = false, baseCurrency, baseCurrencyUnit, abis = {}} = {}) { +function aaveV2Export(registry, { useOracle = false, baseCurrency, baseCurrencyUnit, abis = {}, fromBlock, } = {}) { async function tvl(_, _b, _c, { api }) { const data = await getReservesData(api) @@ -225,6 +226,7 @@ function aaveV2Export(registry, { useOracle = false, baseCurrency, baseCurrencyU } async function getReservesData(api) { + if (fromBlock) return getReservesDataFromBlock(api) const tokens = await api.call({ abi: abiv2.getReservesList, target: registry }) const data = await api.multiCall({ abi: abis.getReserveData ?? abiv2.getReserveData, calls: tokens, target: registry, }) data.forEach((v, i) => v.underlying = tokens[i]) @@ -250,6 +252,18 @@ function aaveV2Export(registry, { useOracle = false, baseCurrency, baseCurrencyU return data } + async function getReservesDataFromBlock(api) { + const logs = await getLogs({ + api, + target: registry, + topics: ['0x3a0ca721fc364424566385a1aa271ed508cc2c0949c2272575fb3013a163a45f'], + fromBlock, + eventAbi: 'event ReserveInitialized (address indexed underlying, address indexed aTokenAddress, address stableDebtTokenAddress, address variableDebtTokenAddress, address interestRateStrategyAddress)', + onlyArgs: true, + }) + return logs + } + const abiv2 = { getReservesList: "address[]:getReservesList", getAddressesProvider: "address:getAddressesProvider", diff --git a/projects/lendle/index.js b/projects/lendle/index.js new file mode 100644 index 00000000000..7397de943a0 --- /dev/null +++ b/projects/lendle/index.js @@ -0,0 +1,5 @@ +const { aaveV2Export } = require("../helper/aave"); + +module.exports = { + mantle: aaveV2Export('0x30D990834539E1CE8Be816631b73a534e5044856', { fromBlock: 56556, }) +}; \ No newline at end of file diff --git a/projects/umee/index.js b/projects/umee/index.js index 496c68b98c7..1fc6c6de6fd 100644 --- a/projects/umee/index.js +++ b/projects/umee/index.js @@ -1,9 +1,8 @@ const sdk = require("@defillama/sdk"); const { transformBalances } = require("../helper/portedTokens"); -const { getLogs, } = require("../helper/cache/getLogs"); - -const { sumTokens2 } = require("../helper/unwrapLPs"); +const { aaveV2Export } = require("../helper/aave"); const { queryV1Beta1 } = require("../helper/chain/cosmos"); + let data; async function getData() { @@ -41,62 +40,6 @@ async function borrowed() { return transformBalances("umee", balances); } -async function ethTvl(_, _b, _cb, { api }) { - const logs = await getLogs({ - api, - target: "0xe296db0a0e9a225202717e9812bf29ca4f333ba6", - topics: [ - "0x3a0ca721fc364424566385a1aa271ed508cc2c0949c2272575fb3013a163a45f", - ], - fromBlock: 14216544, - eventAbi: - "event ReserveInitialized (address indexed asset, address indexed aToken, address stableDebtToken, address variableDebtToken, address interestRateStrategyAddress)", - onlyArgs: true, - }); - const tokensAndOwners = logs.map((i) => [i.asset, i.aToken]); - return sumTokens2({ api, tokensAndOwners }); -} - -async function ethBorrowed(_, _b, _cb, { api }) { - const balances = {}; - const logs = await getLogs({ - api, - target: "0xe296db0a0e9a225202717e9812bf29ca4f333ba6", - topics: [ - "0x3a0ca721fc364424566385a1aa271ed508cc2c0949c2272575fb3013a163a45f", - ], - fromBlock: 14216544, - eventAbi: - "event ReserveInitialized (address indexed asset, address indexed aToken, address stableDebtToken, address variableDebtToken, address interestRateStrategyAddress)", - onlyArgs: true, - }); - const [stableDebtSupplies, variableDebtSupplies] = await Promise.all([ - api.multiCall({ - abi: "uint256:totalSupply", - calls: logs.map((i) => i.stableDebtToken), - }), - api.multiCall({ - abi: "uint256:totalSupply", - calls: logs.map((i) => i.variableDebtToken), - }), - ]); - logs.forEach((v, i) => { - sdk.util.sumSingleBalance( - balances, - v.asset, - stableDebtSupplies[i], - api.chain - ); - sdk.util.sumSingleBalance( - balances, - v.asset, - variableDebtSupplies[i], - api.chain - ); - }); - return balances; -} - module.exports = { timetravel: false, methodology: "Total supplied assets - total borrowed assets", @@ -104,8 +47,5 @@ module.exports = { tvl, borrowed, }, - ethereum: { - tvl: ethTvl, - borrowed: ethBorrowed, - }, + ethereum: aaveV2Export('0xe296db0a0e9a225202717e9812bf29ca4f333ba6', { fromBlock: 14216544, }), }; From 320824beb452a488e1bba625ebba66d322ac9b70 Mon Sep 17 00:00:00 2001 From: rogsta-dev <126240529+rogsta-dev@users.noreply.github.com> Date: Thu, 27 Jul 2023 15:23:20 +0200 Subject: [PATCH 0527/1974] add grizzly trade (#6928) --- projects/grizzly-trade/index.js | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 projects/grizzly-trade/index.js diff --git a/projects/grizzly-trade/index.js b/projects/grizzly-trade/index.js new file mode 100644 index 00000000000..e2f16a31bf5 --- /dev/null +++ b/projects/grizzly-trade/index.js @@ -0,0 +1,7 @@ +const { gmxExports } = require('../helper/gmx') + +module.exports = { + bsc: { + tvl: gmxExports({ vault: '0x606E4922b259fe28c10e6731e8317705AA1e253B', }) + }, +} \ No newline at end of file From 62f8fcedccaf988b2fd095dfba22c1514d05c479 Mon Sep 17 00:00:00 2001 From: Staking Agency Date: Thu, 27 Jul 2023 16:28:49 +0300 Subject: [PATCH 0528/1974] add SALSA from MultiversX (#6929) * add SALSA from MultiversX * minor fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/salsa/index.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 projects/salsa/index.js diff --git a/projects/salsa/index.js b/projects/salsa/index.js new file mode 100644 index 00000000000..2f689343e74 --- /dev/null +++ b/projects/salsa/index.js @@ -0,0 +1,16 @@ +const { call } = require("../helper/chain/elrond"); + +const ADDRESSES = require('../helper/coreAssets.json'); + +const tvl = async (_, _1, _2, { api }) => { + const tokenPrice = await call({ target: 'erd1qqqqqqqqqqqqqpgqaqxztq0y764dnet95jwtse5u5zkg92sfacts6h9su3', abi: 'getTokenPrice', responseTypes: ['number'] }); + const lsTokenSupply = await call({ target: 'erd1qqqqqqqqqqqqqpgqaqxztq0y764dnet95jwtse5u5zkg92sfacts6h9su3', abi: 'getLiquidTokenSupply', responseTypes: ['number'] }); + api.add(ADDRESSES.null, tokenPrice * lsTokenSupply / 1e18) +}; + +module.exports = { + timetravel: false, + elrond: { + tvl, + }, +}; From 998c128338b23ba93c8e0818d85c399780596ee0 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 27 Jul 2023 15:45:37 +0200 Subject: [PATCH 0529/1974] update bhavish --- projects/bhavish/index.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/projects/bhavish/index.js b/projects/bhavish/index.js index 3c04e593167..5e361a69dd8 100644 --- a/projects/bhavish/index.js +++ b/projects/bhavish/index.js @@ -13,4 +13,11 @@ module.exports = { ] }), }, + mantle: { + tvl: sumTokensExport({ + tokensAndOwners: [ + [nullAddress, '0xca0112597B795728d0aFC33dB2E3eD56D95F624d'], + ] + }), + } } \ No newline at end of file From 635c89d947ebfb89e0f680363803ba805daac8d6 Mon Sep 17 00:00:00 2001 From: lulzBoB Date: Thu, 27 Jul 2023 17:07:19 +0200 Subject: [PATCH 0530/1974] added adapter for weave (#6920) --- projects/weave/index.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 projects/weave/index.js diff --git a/projects/weave/index.js b/projects/weave/index.js new file mode 100644 index 00000000000..1e9a03a6eb8 --- /dev/null +++ b/projects/weave/index.js @@ -0,0 +1,23 @@ + +const WKAVA = '0xc86c7C0eFbd6A49B35E8714C5f59D99De09A225b'; +const STRATEGY_CONTRACT = '0x9633a42E4f73F465DD421b22C09E2787493DaAdA' + +async function tvl(_, _1, _2, { api }) { + const strategyBalance = await api.call({ + abi: 'erc20:balanceOf', + target: WKAVA, + params: [STRATEGY_CONTRACT], + }); + + api.add(WKAVA, strategyBalance) +} + +module.exports = { + timetravel: true, + misrepresentedTokens: false, + methodology: 'gets the balance of the strategy contract', + start: 5793963, + kava: { + tvl, + } +}; \ No newline at end of file From 2aea80a671f8cc9dc6daeeb1557f75ff5c7fbfa4 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 27 Jul 2023 17:12:18 +0200 Subject: [PATCH 0531/1974] split velodrome --- projects/velodrome-v2/index.js | 13 +++++++++++++ projects/velodrome/index.js | 10 +--------- 2 files changed, 14 insertions(+), 9 deletions(-) create mode 100644 projects/velodrome-v2/index.js diff --git a/projects/velodrome-v2/index.js b/projects/velodrome-v2/index.js new file mode 100644 index 00000000000..e7bde1cf71e --- /dev/null +++ b/projects/velodrome-v2/index.js @@ -0,0 +1,13 @@ +const { uniTvlExport } = require('../helper/calculateUniTvl.js') + +module.exports = { + optimism: { + tvl: uniTvlExport("0xF1046053aa5682b4F9a81b5481394DA16BE5FF5a", undefined, undefined, { + allPairsLength: 'uint256:allPoolsLength', + allPairs: 'function allPools(uint256) view returns (address)', + }, { fetchBalances: true, }), + }, + hallmarks: [ + [1687465883, "v2 Migration on OP Mainnet"], // https://twitter.com/VelodromeFi/status/1671979216039202816 + ] +} diff --git a/projects/velodrome/index.js b/projects/velodrome/index.js index fa388d3afb7..ebd864d507b 100644 --- a/projects/velodrome/index.js +++ b/projects/velodrome/index.js @@ -1,20 +1,12 @@ -const sdk = require('@defillama/sdk') const {uniTvlExport} = require('../helper/calculateUniTvl.js') module.exports = { misrepresentedTokens: true, - doublecounted: false, - timetravel: true, - incentivized: true, optimism: { - tvl: sdk.util.sumChainTvls([uniTvlExport("0x25CbdDb98b35ab1FF77413456B31EC81A6B6B746"), uniTvlExport("0xF1046053aa5682b4F9a81b5481394DA16BE5FF5a", undefined, undefined, { - allPairsLength: 'uint256:allPoolsLength', - allPairs: 'function allPools(uint256) view returns (address)', - }, { fetchBalances: true,})]), + tvl: uniTvlExport("0x25CbdDb98b35ab1FF77413456B31EC81A6B6B746"), }, hallmarks:[ [1657760400, "First OP grant awarded"], [1659618000, "Loss $350k Operational Funds"], - [1687465883, "v2 Migration on OP Mainnet"], // https://twitter.com/VelodromeFi/status/1671979216039202816 ] } From 14c7f2478450fa7d3813c815f57b560afb835251 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 27 Jul 2023 17:18:59 +0200 Subject: [PATCH 0532/1974] track https://app.ammos.fi --- projects/ammos-fi/index.js | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 projects/ammos-fi/index.js diff --git a/projects/ammos-fi/index.js b/projects/ammos-fi/index.js new file mode 100644 index 00000000000..82f5938c37b --- /dev/null +++ b/projects/ammos-fi/index.js @@ -0,0 +1,5 @@ +const { uniV3Export } = require("../helper/uniswapV3"); + +module.exports = uniV3Export({ + mantle: { factory: "0x636eA278699A300d3A849aB2cE36c891C4eE3Da0", fromBlock: 20634, }, +}); \ No newline at end of file From 4a0684fb35aebd59f65c9a4ec96034473d284ce5 Mon Sep 17 00:00:00 2001 From: stupid_boar Date: Thu, 27 Jul 2023 19:24:37 +0300 Subject: [PATCH 0533/1974] Add USDT/USDC Tron --- projects/pepe-bridge/index.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/projects/pepe-bridge/index.js b/projects/pepe-bridge/index.js index b690b874cfe..2314078ac00 100644 --- a/projects/pepe-bridge/index.js +++ b/projects/pepe-bridge/index.js @@ -36,7 +36,14 @@ const config = { ] ], tron: [ - [[nullAddress], 'TMsm33cUm8HuxyRqwG7xhV46cmx5NVPPGB'] + [[nullAddress], 'TMsm33cUm8HuxyRqwG7xhV46cmx5NVPPGB'], + [ + [ + ADDRESSES.tron.USDT, + ADDRESSES.tron.USDC + ], + 'TNN42f7dXYksBsh8hjVo8XD8aYSKcSEhJF' + ] ] } module.exports = {}; From 7d8bf1bdeb7bdc9f0db67930fb1a06484febe0be Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Thu, 27 Jul 2023 17:58:06 +0100 Subject: [PATCH 0534/1974] add cardano tvl --- projects/ergodex.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/projects/ergodex.js b/projects/ergodex.js index 4cbf22d73a1..46776b2495b 100644 --- a/projects/ergodex.js +++ b/projects/ergodex.js @@ -1,8 +1,24 @@ const { sumTokensExport } = require('./helper/chain/ergo') +const utils = require('./helper/utils'); + +async function cardanoTVL() { + let response = await utils.fetchURL('https://analytics.spectrum.fi/cardano/pools/overview?after=0') + let data = response.data; + + let totalTvl = 0; + for(let i=0; i Date: Thu, 27 Jul 2023 20:07:23 +0300 Subject: [PATCH 0535/1974] PepeTeam Bridge | Add USDT/USDC on Tron (#6932) * fix swop.fi TVL * add USDT/USDC/BTCB for BSC TVL * add CRV token * add polygon MATIC * add USDT+USDC [polygon] + TRX [tron] * Add USDT/USDC Tron --- projects/pepe-bridge/index.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/projects/pepe-bridge/index.js b/projects/pepe-bridge/index.js index b690b874cfe..2314078ac00 100644 --- a/projects/pepe-bridge/index.js +++ b/projects/pepe-bridge/index.js @@ -36,7 +36,14 @@ const config = { ] ], tron: [ - [[nullAddress], 'TMsm33cUm8HuxyRqwG7xhV46cmx5NVPPGB'] + [[nullAddress], 'TMsm33cUm8HuxyRqwG7xhV46cmx5NVPPGB'], + [ + [ + ADDRESSES.tron.USDT, + ADDRESSES.tron.USDC + ], + 'TNN42f7dXYksBsh8hjVo8XD8aYSKcSEhJF' + ] ] } module.exports = {}; From 4669ea46f58794f0eff90b8823c668bcce7a0ff3 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 28 Jul 2023 12:16:53 +0530 Subject: [PATCH 0536/1974] track https://app.tangent.art/ (#6933) --- projects/tangent-protocol/index.js | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 projects/tangent-protocol/index.js diff --git a/projects/tangent-protocol/index.js b/projects/tangent-protocol/index.js new file mode 100644 index 00000000000..235771d647d --- /dev/null +++ b/projects/tangent-protocol/index.js @@ -0,0 +1,8 @@ +const { sumTokensExport } = require('../helper/chain/cardano') + +module.exports = { + cardano: { + tvl: () => 0, + staking: sumTokensExport({ owner: 'addr1q92f5qddkudgq6sna3qfsqrwnk9253gv4qwmfw735xvluhrsqycc2x23z60333ktgjrrufgv8xh2gnxr4m6av63jkassawurfj'}), + }, +}; \ No newline at end of file From a62b6d1d1899c5e11a00919a2678f29ffff14141 Mon Sep 17 00:00:00 2001 From: Roch Date: Fri, 28 Jul 2023 08:53:36 +0200 Subject: [PATCH 0537/1974] Count owna offers + fix missing borrowed tvl (#6934) * Fix Owna protocol tvl by calling contract * count borrows as borrows * remove repaid borrows * Owna: include offers + interests * Count owna offers + fix missing borrowed tvl --- projects/owna/index.js | 92 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 80 insertions(+), 12 deletions(-) diff --git a/projects/owna/index.js b/projects/owna/index.js index 84a4aece5a6..4bb4f8a0a40 100644 --- a/projects/owna/index.js +++ b/projects/owna/index.js @@ -1,4 +1,6 @@ +const { get } = require('../helper/http') const config = require("./config"); +const sdk = require("@defillama/sdk"); const { sumTokensExport } = require('../helper/unwrapLPs') module.exports = { @@ -6,21 +8,87 @@ module.exports = { }; config.chains.forEach(async chainInfo => { - const { name: chain, tokens, lendingContract, nftContract } = chainInfo + const {name: chain, tokens, lendingContract, nftContract} = chainInfo - async function borrowed(_, _1, _2, { api }) { - const count = await api.call({ abi: 'uint256:noOfTokenId', target: nftContract }) - let calls = [] - for (let i = 0; i < count; i++) calls.push(i) - const borrows = await api.multiCall({ calls, abi: 'function borrow(uint256) view returns (bool nft, bool isEntryFeePaid, bool isSold, uint256 nftId, uint256 offerType, uint256 loanAmount, uint256 debtPaid, uint256 lastUpdate, uint256 borrowedStartTime)', target: lendingContract }) - borrows.forEach(borrow => { - if (!borrow.isEntryFeePaid) - api.add(tokens[0], borrow.loanAmount - borrow.debtPaid) - }) + async function currentTokenId() { + return (await sdk.api.abi.call({ + abi: "uint256:noOfTokenId", + target: nftContract, + chain + })).output + } + + async function getBorrow(tokenId) { + return (await sdk.api.abi.call({ + abi: "function borrow(uint256) view returns (bool nft, bool isEntryFeePaid, bool isSold, uint256 nftId, uint256 offerType, uint256 loanAmount, uint256 debtPaid, uint256 lastUpdate, uint256 borrowedStartTime)", + target: lendingContract, + chain, + params: [tokenId] + })).output + } + + async function requestAgainstNft(tokenId, offerID) { + return (await sdk.api.abi.call({ + abi: "function requestAgainstNft(uint256,uint256) view returns (uint256 offerID, uint256 offerType, uint256 nftId, uint256 durations, uint256 offerStartTime, uint256 apr, uint256 minLoan, uint256 maxLoan, uint256 loan, uint256 acceptable_debt, address lender, address borrower, string status)", + target: lendingContract, + chain, + params: [tokenId, offerID] + })).output + } + + async function readDynamicInterest(tokenId, offerID) { + return (await sdk.api.abi.call({ + abi: "function readDynamicInterest(uint256,uint256) view returns (uint256)", + target: lendingContract, + chain, + params: [tokenId, offerID] + })).output + } + + async function getOffersCount(tokenId) { + return parseInt(await get('https://backend.owna.io/offer/getOffersCount?mintId=' + tokenId)); + } + + async function totalOffers() { + let total = 0; + for (let i = 0; i < await currentTokenId(); i++) { + const borrow = await getBorrow(i); + if (parseInt(borrow.offerType) === 0) { + var offerCount = await getOffersCount(i); + if (offerCount > 0) { + for (let j = 0; j < offerCount; j++) { + var offer = await requestAgainstNft(i, j); + if (offer.status == "Pending") { + total += parseInt(offer.maxLoan); + } + } + } + } + } + return { + usd: total / 10 ** 6, + }; + } + + async function totalBorrowed() { + let total = 0; + let totalInterest = 0; + for (let i = 0; i <= await currentTokenId(); i++) { + const borrow = await getBorrow(i); + if (!borrow.isEntryFeePaid) { + total += parseInt(borrow.loanAmount); + if (parseInt(borrow.offerType) > 0) { + totalInterest += parseInt(await readDynamicInterest(i, 0)); + } + }} + return { + usd: (total / 10 ** 6) + (totalInterest / 10 ** 6), + }; } module.exports[chain] = { - tvl: sumTokensExport({ tokens, owners: [lendingContract] }), - borrowed, + tvl: sumTokensExport({ chain, tokens, owners: [lendingContract] }), + borrowed: totalBorrowed, + offers: totalOffers, } }) From 7af3d2a07dbd347740cdbd9af491ba78baef3fe2 Mon Sep 17 00:00:00 2001 From: Noah Bayindirli Date: Thu, 27 Jul 2023 23:54:46 -0700 Subject: [PATCH 0538/1974] Add BSC & Polygon PoS to Prime Protocol (#6935) --- projects/prime-protocol/index.js | 128 ++++++++++++++++++++++++------- 1 file changed, 100 insertions(+), 28 deletions(-) diff --git a/projects/prime-protocol/index.js b/projects/prime-protocol/index.js index a5e835dbe32..3c770ad99c1 100644 --- a/projects/prime-protocol/index.js +++ b/projects/prime-protocol/index.js @@ -3,7 +3,7 @@ const sdk = require('@defillama/sdk'); const { sumTokens2, } = require('../helper/unwrapLPs') const MASTER_VIEW_CONTRACT = { - v146: { + v1_4_6: { address: '0x47ecFB57deD0160d66103A6A201C5f30f7CC7d13', abi: { calculateAssetTVL: 'function calculateRawAssetTVL(uint256 chainId, address pToken) view returns (uint256)' @@ -12,113 +12,179 @@ const MASTER_VIEW_CONTRACT = { }; const MOONBEAM_MARKETS = { - GLMR_v146: { + xcDOT_v0_v1_2_0: { + pTokenMarketAddress: '0x156F5c70a157A381610F1DbaAE4f336a2DB70E7E', + pTokenUnderlyingAddress: '0xFfFFfFff1FcaCBd218EDc0EbA20Fc2308C778080' + }, + GLMR_v1_v1_4_6: { pTokenMarketAddress: '0x53d5a47bb874eE688acb479676aD133d47CB9B25', pTokenUnderlyingAddress: ADDRESSES.null, }, - whUSDC_v146: { + whUSDC_v1_v1_4_6: { pTokenMarketAddress: '0x5f8d500ec32dB09aa3115a852f30e9C756867d5A', pTokenUnderlyingAddress: '0x931715FEE2d06333043d11F658C8CE934aC61D0c', }, - xcUSDT_v146: { + xcUSDT_v1_v1_4_6: { pTokenMarketAddress: '0x1D5CC7840a05BA39Db0AAd21e14dF1ff09b599ED', pTokenUnderlyingAddress: ADDRESSES.moonbeam.xcUSDT, }, - xcDOT_v146: { + xcDOT_v1_v1_4_6: { pTokenMarketAddress: '0x8f7F208F38A4362e6Fe6112b720630f93bb608aA', pTokenUnderlyingAddress: '0xFfFFfFff1FcaCBd218EDc0EbA20Fc2308C778080', }, - GLMR_v160: { + GLMR_v2_v1_6_0: { pTokenMarketAddress: '0xdC427cDB81E1532747BEDeB8077a4AEcDbfB585e', pTokenUnderlyingAddress: ADDRESSES.null, }, - whUSDC_v160: { + whUSDC_v2_v1_6_0: { pTokenMarketAddress: '0x227EEB717a3Ec78025bE51c87b3A7160192613D2', pTokenUnderlyingAddress: '0x931715FEE2d06333043d11F658C8CE934aC61D0c', }, - xcUSDT_v160: { + xcUSDT_v2_v1_6_0: { pTokenMarketAddress: '0x8ef25FAC30DeD9A210151C1d27e58F71f2142e2f', pTokenUnderlyingAddress: ADDRESSES.moonbeam.xcUSDT, }, - xcDOT_v160: { + xcDOT_v2_v1_6_0: { pTokenMarketAddress: '0x525c6B3D27B6b1Fc28bca7dc04964247c1a942B1', pTokenUnderlyingAddress: '0xFfFFfFff1FcaCBd218EDc0EbA20Fc2308C778080', + }, + whWBTC_v2_v1_10_2: { + pTokenMarketAddress: '0x2A104E502480b4e3C1D13EA2EC657C08f4578a7a', + pTokenUnderlyingAddress: '0xE57eBd2d67B462E9926e04a8e33f01cD0D64346D', } }; const AVALANCHE_MARKETS = { - ETH_v146: { + ETH_v1_v1_4_6: { pTokenMarketAddress: '0x94ebF80b33120a1AbE370E56192db39f4944b6ca', pTokenUnderlyingAddress: ADDRESSES.avax.WETH_e, }, - USDC_v146: { + USDC_v1_v1_4_6: { pTokenMarketAddress: '0x6Cce9601CA44a9049A761C22b70D5849662c2C0a', pTokenUnderlyingAddress: ADDRESSES.avax.USDC, }, - USDT_v146: { + USDT_v1_v1_4_6: { pTokenMarketAddress: '0xe06F55FB6c6C62b74AAD7eb77f00b06920FB176e', pTokenUnderlyingAddress: ADDRESSES.avax.USDt, }, - ETH_v160: { + ETH_v2_v1_6_0: { pTokenMarketAddress: '0x4Ebba16380fEb2083938c008aEDD4b5EBeA80f72', pTokenUnderlyingAddress: ADDRESSES.avax.WETH_e, }, - USDC_v160: { + USDC_v2_v1_6_0: { pTokenMarketAddress: '0x73c5c93E78cB8CA4939307e0D95e032631fB9eEe', pTokenUnderlyingAddress: ADDRESSES.avax.USDC, }, - USDT_v160: { + USDT_v2_v1_6_0: { pTokenMarketAddress: '0x1BF6752282039ee82C06DE64D094C9E35578A1a0', pTokenUnderlyingAddress: ADDRESSES.avax.USDt, }, + DAI_v2_v1_10_2: { + pTokenMarketAddress: '0x05f2B8EAc42c9Cc771B8ECF6448481A3802e08c6', + pTokenUnderlyingAddress: '0xd586E7F844cEa2F87f50152665BCbc2C279D8d70', + }, + bBTC_v2_v1_10_2: { + pTokenMarketAddress: '0xA5c74A10B60f276F806468c6E2f83D490dCfA89A', + pTokenUnderlyingAddress: '0x152b9d0FdC40C096757F570A51E494bd4b943E50', + }, }; const ARBITRUM_MARKETS = { - ETH_v146: { + ETH_v1_v1_4_6: { pTokenMarketAddress: '0x2E9F73aA3F16748C9c1E8243D204d60F87dEC872', pTokenUnderlyingAddress: ADDRESSES.null, }, - USDC_v146: { + USDC_v1_v1_4_6: { pTokenMarketAddress: '0x1b0509D8CC044805F54D132ccDa7b4A4ED88261A', pTokenUnderlyingAddress: ADDRESSES.arbitrum.USDC, }, - ETH_v160: { + ETH_v2_v1_6_0: { pTokenMarketAddress: '0xc01683398fFCc86264ba17bC36977f51A1d25e06', pTokenUnderlyingAddress: ADDRESSES.null, }, - USDC_v160: { + USDC_v2_v1_6_0: { pTokenMarketAddress: '0xddC6Df52F9749ED80966Fb6a9D4C87264cC1e6C1', pTokenUnderlyingAddress: ADDRESSES.arbitrum.USDC, }, + DAI_v2_v1_10_2: { + pTokenMarketAddress: '0x3e1C8203B8D36E8E427Ee181A65549fd86AE3907', + pTokenUnderlyingAddress: '0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1', + }, + WBTC_v2_v1_10_2: { + pTokenMarketAddress: '0x51Ff97d92683992AD091E04470069bB942219D71', + pTokenUnderlyingAddress: '0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f', + }, + nativeUSDC_v1_v1_10_2: { + pTokenMarketAddress: '0xA44C28Bd4Fd4fc307f23B2E6e9cC07BC03571798', + pTokenUnderlyingAddress: '0xaf88d065e77c8cC2239327C5EDb3A432268e5831', + }, }; const ETHEREUM_MARKETS = { - ETH_v146: { + ETH_v1_v1_4_6: { pTokenMarketAddress: '0xD15a15C0b6d79D9E59F4fcC0D17912219f6b470C', pTokenUnderlyingAddress: ADDRESSES.null, }, - USDC_v146: { + USDC_v1_v1_4_6: { pTokenMarketAddress: '0x8F0Ba37DAC51a8102b1203C9D9ac26724DC684Ac', pTokenUnderlyingAddress: ADDRESSES.ethereum.USDC, }, - USDT_v146: { + USDT_v1_v1_4_6: { pTokenMarketAddress: '0x373bb8bE40Ee6f704576CDC815372ff71d6825c5', pTokenUnderlyingAddress: ADDRESSES.ethereum.USDT, }, - ETH_v160: { + ETH_v2_v1_6_0: { pTokenMarketAddress: '0xd833F882ca07F69C4C5a069675B6B65C235325C3', pTokenUnderlyingAddress: ADDRESSES.null, }, - USDC_v160: { + USDC_v2_v1_6_0: { pTokenMarketAddress: '0x67CeC45eB8d9f059D4c974a4BdEA357b68Ad80Ef', pTokenUnderlyingAddress: ADDRESSES.ethereum.USDC, }, - USDT_v160: { + USDT_v2_v1_6_0: { pTokenMarketAddress: '0xDC313B592949E8F4bB91A22c6DC9f7BE11b74Ea7', pTokenUnderlyingAddress: ADDRESSES.ethereum.USDT, }, }; +const BSC_MARKETS = { + USDC_v2_v1_10_2: { + pTokenMarketAddress: '0xc01683398fFCc86264ba17bC36977f51A1d25e06', + pTokenUnderlyingAddress: '0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d', + }, + USDT_v2_v1_10_2: { + pTokenMarketAddress: '0xddC6Df52F9749ED80966Fb6a9D4C87264cC1e6C1', + pTokenUnderlyingAddress: '0x55d398326f99059fF775485246999027B3197955', + }, + BNB_v2_v1_10_2: { + pTokenMarketAddress: '0xaCD7a2991f3514E215034Ace732Bafe005185C94', + pTokenUnderlyingAddress: ADDRESSES.null, + }, + BTCB_v2_v1_10_2: { + pTokenMarketAddress: '0xA7BCF4433e044e454c43fe596C9eE8DDAF5776aC', + pTokenUnderlyingAddress: '0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c', + }, + ETH_v2_v1_10_2: { + pTokenMarketAddress: '0xBdDc67911C63f63e6720A8EEfCAF08a573Fd9AE4', + pTokenUnderlyingAddress: '0x2170Ed0880ac9A755fd29B2688956BD959F933F8', + }, +}; + +const POLYGON_POS_MARKETS = { + USDC_v1_v1_10_2: { + pTokenMarketAddress: '0x45913B2088E2910C3Dd168c2f08eaf2274D7bf6c', + pTokenUnderlyingAddress: '0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174', + }, + USDT_v1_v1_10_2: { + pTokenMarketAddress: '0x2ce0Ac2FD666a93b70fbE731C9Fe6581f410F73B', + pTokenUnderlyingAddress: '0xc2132D05D31c914a87C6611C10748AEb04B58e8F', + }, + WBTC_v1_v1_10_2: { + pTokenMarketAddress: '0x786D8B5d16171f441BC5F2047bDf0Ea54268a735', + pTokenUnderlyingAddress: '0x1bfd67037b42cf73acf2047067bd4f2c47d9bfd6', + }, +}; + const PRIME_MARKETS = { moonbeam: { networkMarkets: MOONBEAM_MARKETS @@ -132,7 +198,13 @@ const PRIME_MARKETS = { ethereum: { networkMarkets: ETHEREUM_MARKETS }, -} + bsc: { + networkMarkets: BSC_MARKETS + }, + polygon: { + networkMarkets: POLYGON_POS_MARKETS + }, +}; async function borrowed(_, _1, _2, { api }) { const moonbeamApi = new sdk.ChainApi({ chain: 'moonbeam' }); @@ -141,8 +213,8 @@ async function borrowed(_, _1, _2, { api }) { let uDecimals = await api.multiCall({ abi: 'erc20:decimals', calls: markets.map(i => i.pTokenUnderlyingAddress), permitFailure: true, }) uDecimals = uDecimals.map(i => i ?? 18) let rawTvls = await moonbeamApi.multiCall({ - abi: MASTER_VIEW_CONTRACT.v146.abi.calculateAssetTVL, - target: MASTER_VIEW_CONTRACT.v146.address, + abi: MASTER_VIEW_CONTRACT.v1_4_6.abi.calculateAssetTVL, + target: MASTER_VIEW_CONTRACT.v1_4_6.address, calls: markets.map(i => ({ params: [api.getChainId(), i.pTokenMarketAddress] })), }) rawTvls.forEach((v, i) => api.add(markets[i].pTokenUnderlyingAddress, v * (10 ** uDecimals[i] / 1e18))) From 16cc5698c958c565cf5f485be9624a72a7ac5184 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 28 Jul 2023 12:32:01 +0530 Subject: [PATCH 0539/1974] Paraspace (#6942) * feat: support polygon and zksync * minor fix --------- Co-authored-by: jfzhou5 <1241330802@qq.com> --- .../paraspace/helper/abis/UiPoolDataProvider.json | 4 ++-- projects/paraspace/helper/address.js | 11 ++++++++++- projects/paraspace/index.js | 8 ++++++++ 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/projects/paraspace/helper/abis/UiPoolDataProvider.json b/projects/paraspace/helper/abis/UiPoolDataProvider.json index 29f6c694878..5172ed11532 100644 --- a/projects/paraspace/helper/abis/UiPoolDataProvider.json +++ b/projects/paraspace/helper/abis/UiPoolDataProvider.json @@ -1,4 +1,4 @@ { - "getReservesData": "function getReservesData(address provider) view returns (tuple(address underlyingAsset, string name, string symbol, uint256 decimals, uint256 baseLTVasCollateral, uint256 reserveLiquidationThreshold, uint256 reserveLiquidationBonus, uint256 reserveFactor, bool usageAsCollateralEnabled, bool borrowingEnabled, bool auctionEnabled, bool isActive, bool isFrozen, bool isPaused, bool isAtomicPricing, uint128 liquidityIndex, uint128 variableBorrowIndex, uint128 liquidityRate, uint128 variableBorrowRate, uint40 lastUpdateTimestamp, address xTokenAddress, address variableDebtTokenAddress, address interestRateStrategyAddress, address auctionStrategyAddress, uint256 availableLiquidity, uint256 totalScaledVariableDebt, uint256 priceInMarketReferenceCurrency, address priceOracle, uint256 variableRateSlope1, uint256 variableRateSlope2, uint256 baseVariableBorrowRate, uint256 optimalUsageRatio, uint128 accruedToTreasury, uint256 borrowCap, uint256 supplyCap, uint8 assetType)[], tuple(uint256 marketReferenceCurrencyUnit, int256 marketReferenceCurrencyPriceInUsd, int256 networkBaseTokenPriceInUsd, uint8 networkBaseTokenPriceDecimals))", + "getReservesData": "function getReservesData(address provider) view returns (tuple(address underlyingAsset, string name, string symbol, uint256 decimals, uint256 baseLTVasCollateral, uint256 reserveLiquidationThreshold, uint256 reserveLiquidationBonus, uint256 reserveFactor, bool usageAsCollateralEnabled, bool borrowingEnabled, bool auctionEnabled, bool isActive, bool isFrozen, bool isPaused, bool isAtomicPricing, uint128 liquidityIndex, uint128 variableBorrowIndex, uint128 liquidityRate, uint128 variableBorrowRate, uint40 lastUpdateTimestamp, address xTokenAddress, address variableDebtTokenAddress, address interestRateStrategyAddress, address auctionStrategyAddress, address timeLockStrategyAddress, uint256 availableLiquidity, uint256 totalScaledVariableDebt, uint256 priceInMarketReferenceCurrency, address priceOracle, uint256 variableRateSlope1, uint256 variableRateSlope2, uint256 baseVariableBorrowRate, uint256 optimalUsageRatio, uint128 accruedToTreasury, uint256 borrowCap, uint256 supplyCap, uint8 assetType, tuple(uint256 minThreshold, uint256 midThreshold, uint48 minWaitTime, uint48 midWaitTime, uint48 maxWaitTime, uint48 poolPeriodWaitTime, uint256 poolPeriodLimit, uint256 period, uint128 totalAmountInCurrentPeriod, uint48 lastResetTimestamp) timeLockStrategyData)[], tuple(uint256 marketReferenceCurrencyUnit, int256 marketReferenceCurrencyPriceInUsd, int256 networkBaseTokenPriceInUsd, uint8 networkBaseTokenPriceDecimals))", "getUniswapV3LpTokenData": "function getUniswapV3LpTokenData(address provider, address lpTokenAddress, uint256 tokenId) view returns (tuple(address token0, address token1, uint24 feeRate, int24 positionTickLower, int24 positionTickUpper, int24 currentTick, uint128 liquidity, uint256 liquidityToken0Amount, uint256 liquidityToken1Amount, uint256 lpFeeToken0Amount, uint256 lpFeeToken1Amount, uint256 tokenPrice, uint256 baseLTVasCollateral, uint256 reserveLiquidationThreshold))" -} \ No newline at end of file +} diff --git a/projects/paraspace/helper/address.js b/projects/paraspace/helper/address.js index f9e91b5887a..5d313c70713 100644 --- a/projects/paraspace/helper/address.js +++ b/projects/paraspace/helper/address.js @@ -1,6 +1,6 @@ module.exports = { ethereum: { - UiPoolDataProvider: "0xcFcca0A2531069f16634beeD1C74d28ac1F7d271", + UiPoolDataProvider: "0x30E6C173Ff3958a6629258C71Bd161e70BEe0e6D", PoolAddressProvider: "0x6cD30e716ADbE47dADf7319f6F2FB83d507c857d", UniV3Pos: "0xC36442b4a4522E871399CD717aBDD847Ab11FE88", P2PPairStaking: "0xf090Eb4c2B63e7B26E8Bb09e6Fc0cC3A7586263B", @@ -16,4 +16,13 @@ module.exports = { PoolAddressProvider: "0x45a35124749B061a29f91cc8ddf85606586dcf24", UniV3Pos: "0xC36442b4a4522E871399CD717aBDD847Ab11FE88", }, + polygon: { + UiPoolDataProvider: "0xa2a9dD7079f05d17BE291D99048e671129DdDc83", + PoolAddressProvider: "0x42b0C49130162F949e82ba855C4eFF0C3Fd4C5cC", + UniV3Pos: "0xC36442b4a4522E871399CD717aBDD847Ab11FE88", + }, + era: { + UiPoolDataProvider: "0x451E3288a2dcD91b001cd831dD75109D524578b6", + PoolAddressProvider: "0xc11B2F53E119634c8755855e56D323C4F6dfd23d", + }, }; diff --git a/projects/paraspace/index.js b/projects/paraspace/index.js index 353aec961e1..83dfe189914 100644 --- a/projects/paraspace/index.js +++ b/projects/paraspace/index.js @@ -13,5 +13,13 @@ module.exports = { arbitrum: { tvl, borrowed, + }, + polygon: { + tvl, + borrowed, + }, + era: { + tvl, + borrowed, } }; From 51b0a5ee5f587ca7a6431039201e66b86199f950 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 28 Jul 2023 09:39:43 +0200 Subject: [PATCH 0540/1974] track lodestar-v1 --- projects/lodestar-v1/index.js | 52 +++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 projects/lodestar-v1/index.js diff --git a/projects/lodestar-v1/index.js b/projects/lodestar-v1/index.js new file mode 100644 index 00000000000..ca0bb507b1a --- /dev/null +++ b/projects/lodestar-v1/index.js @@ -0,0 +1,52 @@ +const sdk = require('@defillama/sdk') +const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') +const { transformBalances } = require('../helper/portedTokens') +const chain = 'arbitrum' +const controller = '0xa86dd95c210dd186fa7639f93e4177e97d057576' +const cETHER = '0x2193c45244AF12C280941281c8aa67dD08be0a64'.toLowerCase() + +async function getMarkets(block) { + let markets = await sdk.api2.abi.call({ target: controller, abi: abis.getAllMarkets, chain, block }) + markets = markets.filter(i => i.toLowerCase() !== cETHER) + + const tokens = await sdk.api2.abi.multiCall({ + abi: abis.underlying, + calls: markets, + chain, block, + }) + + markets.push(cETHER) + tokens.push(nullAddress) + return { markets, tokens } +} + +async function tvl(_, _b, { arbitrum: block }) { + const { markets, tokens } = await getMarkets(block) + const tokensAndOwners = tokens.map((t, i) => ([t, markets[i]])) + return sumTokens2({ tokensAndOwners, chain, block, }) +} + +async function borrowed(_, _b, { arbitrum: block }) { + const { markets, tokens } = await getMarkets(block) + const balances = {} + const borrows = await sdk.api2.abi.multiCall({ + abi: abis.totalBorrows, + calls: markets, + chain, block, + }) + borrows.forEach((a, i) => sdk.util.sumSingleBalance(balances, tokens[i], a)) + return transformBalances(chain, balances) +} + +module.exports = { + arbitrum: { + tvl, + borrowed, + } +}; + +const abis = { + getAllMarkets: "address[]:getAllMarkets", + underlying: "address:underlying", + totalBorrows: "uint256:totalBorrows", +} \ No newline at end of file From 48cc0362891985ee659d21470c0aa1bd07e1c9b8 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 28 Jul 2023 12:08:36 +0200 Subject: [PATCH 0541/1974] update fluidity --- projects/fluidity-money/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/fluidity-money/index.js b/projects/fluidity-money/index.js index 4e30bdc9ac7..bc6b358e3cd 100644 --- a/projects/fluidity-money/index.js +++ b/projects/fluidity-money/index.js @@ -1,8 +1,8 @@ const { sumTokens2 } = require("../helper/unwrapLPs"); const ATOKENS_ETHEREUM = ['0x028171bCA77440897B824Ca71D1c56caC55b68A3', '0x101cc05f4A51C0319f570d5E146a8C625198e636', '0xd4937682df3C8aEF4FE912A96A74121C0829E664']; const APOOL_ETHEREUM = ['0xFC66c25dbDb0606e7F9cA1d2754Eb0A0f8306dA9', '0x5E88f6dc0aa126FA28A137B24d0B4d7231352a0B', '0xB7a2930e66D84Da74CdcFE4f97FaE9fC8f1114e8']; -const ATOKENS_ARBITRUM = ['0x6ab707Aca953eDAeFBc4fD23bA73294241490620', '0x625E7708f30cA75bfd92586e17077590C60eb4cD', '0x82E64f49Ed5EC1bC6e43DAD4FC8Af9bb3A2312EE']; -const APOOL_ARBITRUM = ['0xad7e2165FEa1d29030dF806cE4d530fa7a44511B', '0x23E7f09Fae0933db01420173726d18Dae809022C', '0xB7D37C5b15CDF29265C20668c20cD78586c423A8']; +const ATOKENS_ARBITRUM = ['0x6ab707Aca953eDAeFBc4fD23bA73294241490620', '0x625E7708f30cA75bfd92586e17077590C60eb4cD', '0x82E64f49Ed5EC1bC6e43DAD4FC8Af9bb3A2312EE', '0x724dc807b04555b71ed48a6896b6f41593b8c637']; +const APOOL_ARBITRUM = ['0xad7e2165FEa1d29030dF806cE4d530fa7a44511B', '0x23E7f09Fae0933db01420173726d18Dae809022C', '0xB7D37C5b15CDF29265C20668c20cD78586c423A8', '0x91beB5C41dF001175b588C9510327D53f278972A']; const COMPOUND_ETHEREUM = [ ['0xf650C3d88D12dB855b8bf7D11Be6C55A4e07dCC9', '0x372025203D25589eC3aDAd82652De78eC76fFabC'], ['0x39AA39c021dfbaE8faC545936693aC917d5E7563', '0xE87Adc9D382Eee54C1eDE017D6E5C1324D59F457'], From 3ce2de1eec2dbf54025ab257cce7e75d979ede85 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 28 Jul 2023 13:25:47 +0200 Subject: [PATCH 0542/1974] fix izumi --- projects/izumi/utils.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/projects/izumi/utils.js b/projects/izumi/utils.js index b672f0012f8..786fb7d6dfb 100644 --- a/projects/izumi/utils.js +++ b/projects/izumi/utils.js @@ -3,7 +3,8 @@ const { unwrapUniswapV3NFTs } = require('../helper/unwrapLPs') const sdk = require("@defillama/sdk"); const abi = require('./abi.json'); const BigNumber = require('bignumber.js'); -const { get } = require('../helper/http') +const { get } = require('../helper/http'); +const { nullAddress } = require('../helper/tokenMapping'); function point2PoolPriceUndecimalSqrt(point) { return (1.0001 ** point) ** 0.5; @@ -155,6 +156,7 @@ async function unwrapiZiswapFixNFT({ balances, owner, nftAddress, block, chain = const poolInfo = (await sdk.api.abi.call({ target: factory, abi: abi.pool, block, chain, params: [miningInfo.tokenX_, miningInfo.tokenY_, miningInfo.fee_] })).output + if (poolInfo == nullAddress) return balances const state = (await sdk.api.abi.call({ target: poolInfo, abi: abi.state, block, chain })).output let params = { From 02c2493c3571e40262155db237f768c915ae83a8 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 28 Jul 2023 13:36:04 +0200 Subject: [PATCH 0543/1974] fix sunswap --- projects/sunswap-v2/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/sunswap-v2/index.js b/projects/sunswap-v2/index.js index 90b64aa6988..8d96bbac225 100644 --- a/projects/sunswap-v2/index.js +++ b/projects/sunswap-v2/index.js @@ -4,6 +4,6 @@ module.exports = { timetravel: false, misrepresentedTokens: true, tron: { - tvl: getUniTVL({ factory: 'TKWJdrQkqHisa1X8HUdHEfREvTzw4pMAaY', useDefaultCoreAssets: true, }), + tvl: getUniTVL({ factory: 'TKWJdrQkqHisa1X8HUdHEfREvTzw4pMAaY', useDefaultCoreAssets: true, queryBatched: 21 }), } } From d7eeaf9d7d6bfd804f4e51fe85b8eeaea64c1af2 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 28 Jul 2023 15:02:49 +0200 Subject: [PATCH 0544/1974] fix sft --- projects/sft-protocol/index.js | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/projects/sft-protocol/index.js b/projects/sft-protocol/index.js index 283f4db2a8a..2a3c6bab710 100644 --- a/projects/sft-protocol/index.js +++ b/projects/sft-protocol/index.js @@ -1,26 +1,30 @@ const ADDRESSES = require('../helper/coreAssets.json') -const {sumTokens2} = require('../helper/unwrapLPs'); -const {utils} = require("ethers"); -const {get} = require('../helper/http'); +const { sumTokens2 } = require('../helper/unwrapLPs'); +const { utils } = require("ethers"); +const { getConfig } = require('../helper/cache'); const tokens = [ ADDRESSES.null, // FIL ] const getActiveMinersFromRPC = async () => { - const resp = await get('https://api.sftproject.io/api/v1/public/dashboard/info') + const resp = await getConfig('sft-protocol', 'https://api.sftproject.io/api/v1/public/dashboard/info') let nodes = [] let node_i = [] - nodes = resp.data.combined.map(({ miner }) => { + nodes = resp.data.combined + .filter(i => i.miner && i.miner !== '') + .map(({ miner }) => { let node = parseInt(miner.slice(2,)) let bytes = Buffer.alloc(20); bytes.writeUint8(0xff, 0); bytes.writeBigUint64BE(BigInt(node), 12); return utils.getAddress('0x' + bytes.toString('hex')); }); - + if (resp.data.independent !== null) { - node_i = resp.data.independent.map(({ miner }) => { + node_i = resp.data.independent + .filter(i => i.miner && i.miner !== '') + .map(({ miner }) => { let node = parseInt(miner.slice(2,)) let bytes = Buffer.alloc(20); bytes.writeUint8(0xff, 0); @@ -34,12 +38,12 @@ const getActiveMinersFromRPC = async () => { module.exports = { filecoin: { - tvl: async (_, _1, _2, {api}) => { + tvl: async (_, _1, _2, { api }) => { let balances = {}; let minerAddrs = await getActiveMinersFromRPC(); - await sumTokens2({balances, owners: minerAddrs, tokens, api, }); + await sumTokens2({ balances, owners: minerAddrs, tokens, api, }); return balances; } From f7667afd473bf53664980576b8e1d7c6eba3c3bb Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 28 Jul 2023 16:52:17 +0200 Subject: [PATCH 0545/1974] fix broken adapters --- projects/helper/env.js | 1 - projects/helper/http.js | 4 +-- projects/hydradex/getHydraV3SubgraphTvl.js | 4 +-- projects/sudoswap/index.js | 33 ++++++++++++++++++++++ projects/unipilot/index.js | 27 ++++++++++++++++-- 5 files changed, 61 insertions(+), 8 deletions(-) diff --git a/projects/helper/env.js b/projects/helper/env.js index 629da7076d2..d1cd406d5c5 100644 --- a/projects/helper/env.js +++ b/projects/helper/env.js @@ -9,7 +9,6 @@ const DEFAULTS = { APTOS_RPC: 'https://aptos-mainnet.pontem.network', SUI_RPC: 'https://fullnode.mainnet.sui.io/', MULTIVERSX_RPC: 'https://api.multiversx.com', - LINEA_RPC: 'https://linea.rpc.thirdweb.com', PGN_RPC: 'https://rpc.publicgoods.network', } diff --git a/projects/helper/http.js b/projects/helper/http.js index cdae512f942..09a9bb3eb27 100644 --- a/projects/helper/http.js +++ b/projects/helper/http.js @@ -104,9 +104,9 @@ async function blockQuery(endpoint, query, { api, blockCatchupLimit = 500, }) { } } -async function graphFetchById({ endpoint, query, params = {}, api, options: { useBlock = false } = {} }) { +async function graphFetchById({ endpoint, query, params = {}, api, options: { useBlock = false, safeBlockLimit = 100 } = {} }) { if (useBlock && !params.block) - params.block = await api.getBlock() - 100 + params.block = await api.getBlock() - safeBlockLimit let data = [] let lastId = "" diff --git a/projects/hydradex/getHydraV3SubgraphTvl.js b/projects/hydradex/getHydraV3SubgraphTvl.js index e0fd25b3961..2f0373bde20 100644 --- a/projects/hydradex/getHydraV3SubgraphTvl.js +++ b/projects/hydradex/getHydraV3SubgraphTvl.js @@ -4,8 +4,8 @@ const HOURS_12 = 12 * 3600 async function getBlock(endpoint, timestamp) { const params = { - timestamp_from: timestamp - HOURS_12, - timestamp_to: timestamp + HOURS_12, + timestamp_from: timestamp - HOURS_12 * 2, + timestamp_to: timestamp + HOURS_12 * 2, } const query = `query ($timestamp_to: Int, $timestamp_from: Int){ blocks (orderBy: "timestamp" first:1 orderDirection: "desc" where: { timestamp_lte: $timestamp_to timestamp_gte: $timestamp_from}) { diff --git a/projects/sudoswap/index.js b/projects/sudoswap/index.js index c06bc712008..c65d4034951 100644 --- a/projects/sudoswap/index.js +++ b/projects/sudoswap/index.js @@ -39,6 +39,7 @@ module.exports = { api, options: { useBlock: true, + safeBlockLimit: 500, } }) const balances = {} @@ -60,3 +61,35 @@ module.exports = { } } } + +/* +const { getLogs } = require('../helper/cache/getLogs') +const { getCache, setCache } = require('../helper/cache') +const { nullAddress, } = require('../helper/unwrapLPs') + +module.exports = { + methodology: 'Sum up all the ETH & nfts in pools', + ethereum: { + tvl: async (_, block, _1, { api }) => { + const PairFactory = '0xb16c1342E617A5B6E4b631EB114483FDB289c0A4' + const logs = await getLogs({ + api, + target: PairFactory, + topics: ['0xf5bdc103c3e68a20d5f97d2d46792d3fdddfa4efeb6761f8141e6a7b936ca66c'], + eventAbi: 'event NewPair(address pool)', + onlyArgs: true, + fromBlock: 14645816, + }) + const pools = logs.map(i => i.pool) + const cache = await getCache('sudoswap-v1', api.chain) + if (!cache.pools) cache.nfts = [] + const missingPools = pools.slice(cache.nfts.length) + const missingNfts = await api.multiCall({ abi: 'address:nft', calls: missingPools}) + cache.nfts.push(...missingNfts) + + if (missingPools.length > 0) await setCache('sudoswap-v1', api.chain, cache) + await api.sumTokens({ owners: pools, tokens: [nullAddress]}) + return api.sumTokens({ tokensAndOwners2: [cache.nfts, pools], blacklistedTokens: ['0x08142348e6bbf233002b81047bc2f27026af10a5']}) + } + } +} \ No newline at end of file diff --git a/projects/unipilot/index.js b/projects/unipilot/index.js index 9ff6ea60d99..6a2f2b63389 100644 --- a/projects/unipilot/index.js +++ b/projects/unipilot/index.js @@ -1,4 +1,4 @@ -const sdk = require("@defillama/sdk"); +const { cachedGraphQuery } = require('../helper/cache') const { getLogs } = require("../helper/cache/getLogs"); const { sumTokens2 } = require("../helper/unwrapLPs"); const { staking } = require("../helper/staking"); @@ -99,8 +99,29 @@ async function getVaultLogs(vaults, factoryType, api) { async function tvl(timestamp, block, chainBlocks, { api }) { let vaults = {}; - for (const label of Object.keys(START_BLOCKS[api.chain])) - await getVaultLogs(vaults, label, api) + if (api.chain === "dogechain") { + const res = await cachedGraphQuery('unipilot/'+api.chain, 'https://apis.unipilot.io:5000/subgraphs/name/hamzabhatti125/stats-dogechain', `{ + vaults { + token0 { + id + } + token1 { + id + } + id + } + }`) + res.vaults.forEach(({ token0, token1, id }) => { + vaults[id] = { + token0Address: token0.id, + token1Address: token1.id, + } + }) + } else { + for (const label of Object.keys(START_BLOCKS[api.chain])) + await getVaultLogs(vaults, label, api) + + } const ownerTokens = Object.entries(vaults).map(([v, i]) => [[i.token0Address, i.token1Address], v]) const vaultKeys = Object.keys(vaults) From fef3ba9a73401a5d6d1024d915454f5f0cb83589 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Sat, 29 Jul 2023 11:43:39 +0200 Subject: [PATCH 0546/1974] track sablier-v2 --- projects/flashstake-old/index.js | 32 ++++++++---------- projects/sablier-v2/index.js | 57 ++++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+), 19 deletions(-) create mode 100644 projects/sablier-v2/index.js diff --git a/projects/flashstake-old/index.js b/projects/flashstake-old/index.js index c9cac47aa65..25dfe370179 100644 --- a/projects/flashstake-old/index.js +++ b/projects/flashstake-old/index.js @@ -1,24 +1,18 @@ -const { request, gql } = require("graphql-request"); -const { toUSDTBalances } = require("../helper/balances"); -const graphUrl = - "https://api.thegraph.com/subgraphs/name/blockzerohello/flash-stake-stats-v2-subgraph"; -const graphQuery = gql` - query get_tvl($block: Int) { - flashFactories(block: { number: $block }) { - totalVolumeUSD - totalLiquidityUSD - } - } -`; -async function tvl(timestamp, block) { - const { flashFactories } = await request(graphUrl, graphQuery, { - block, - }); - const usdTvl = Number(flashFactories[0].totalLiquidityUSD); - return toUSDTBalances(usdTvl); +const { getLogs } = require('../helper/cache/getLogs') + +async function tvl(timestamp, block, _, { api }) { + const logs = await getLogs({ + api, + target: '0xb0aeae6e204bd95911ead25263d7078954fb7fb0', + topics: ['0x4f2ce4e40f623ca765fc0167a25cb7842ceaafb8d82d3dec26ca0d0e0d2d4896'], + eventAbi: 'event PoolCreated (address pool, address token)', + onlyArgs: true, + fromBlock: 12030855, + }) + return api.sumTokens({ tokensAndOwners: logs.map(log => [log.token, log.pool]) }) } + module.exports = { - misrepresentedTokens: true, ethereum: { tvl, }, diff --git a/projects/sablier-v2/index.js b/projects/sablier-v2/index.js new file mode 100644 index 00000000000..7f056a6c564 --- /dev/null +++ b/projects/sablier-v2/index.js @@ -0,0 +1,57 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokens2, sumTokensExport } = require('../helper/unwrapLPs') +const { covalentGetTokens } = require('../helper/http') +const { isWhitelistedToken } = require('../helper/streamingHelper') +const { getUniqueAddresses } = require('../helper/utils') +const { cachedGraphQuery } = require('../helper/cache') + +const blacklistedTokens = [ + ADDRESSES.ethereum.sUSD_OLD, + // TODO: We shouldn't need to lowercase here + ADDRESSES.ethereum.SAI.toLowerCase(), + ADDRESSES.ethereum.MKR, +] + +async function getTokensConfig(api, isVesting) { + const ownerTokens = [] + const { endpoints } = config[api.chain] + let i = 0 + for (const endpoint of endpoints) { + i++ + const { contracts, assets } = await cachedGraphQuery('sablier-v2/' + api.chain + '-' + i, endpoint, `{ + contracts { id address category } + assets { id chainId symbol } + }`) + const owners = contracts.map(i => i.address) + let tokens = assets.map(i => i.id) + const symbols = assets.map(i => i.symbol) + tokens = tokens.filter((v, i) => isWhitelistedToken(symbols[i], v, isVesting)) + owners.forEach(owner => ownerTokens.push([tokens, owner])) + } + + return { ownerTokens } +} + +async function tvl(_, block, _1, { api }) { + const { owners } = config[api.chain] + return api.sumTokens(await getTokensConfig(api, false)) +} + +async function vesting(_, block, _1, { api }) { + const { owners } = config[api.chain] + return api.sumTokens(await getTokensConfig(api, true)) +} + +const config = { + ethereum: { endpoints: ['https://api.thegraph.com/subgraphs/name/sablier-labs/sablier-v2'], }, + arbitrum: { endpoints: ['https://api.thegraph.com/subgraphs/name/sablier-labs/sablier-v2-arbitrum'], }, + bsc: { endpoints: ['https://api.thegraph.com/subgraphs/name/sablier-labs/sablier-v2-bsc'], }, + xdai: { endpoints: ['https://api.thegraph.com/subgraphs/name/sablier-labs/sablier-v2-gnosis'], }, + optimism: { endpoints: ['https://api.thegraph.com/subgraphs/name/sablier-labs/sablier-v2-optimism'], }, + polygon: { endpoints: ['https://api.thegraph.com/subgraphs/name/sablier-labs/sablier-v2-polygon'], }, + avax: { endpoints: ['https://api.thegraph.com/subgraphs/name/sablier-labs/sablier-v2-avalanche'], }, +} + +Object.keys(config).forEach(chain => { + module.exports[chain] = { tvl, vesting } +}) \ No newline at end of file From 6f049079d8d60dbbc46aad763a76cbbf01de3fb7 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Sat, 29 Jul 2023 13:24:01 +0100 Subject: [PATCH 0547/1974] fix synatx --- projects/sudoswap/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/sudoswap/index.js b/projects/sudoswap/index.js index c65d4034951..5b1235cf79a 100644 --- a/projects/sudoswap/index.js +++ b/projects/sudoswap/index.js @@ -92,4 +92,5 @@ module.exports = { return api.sumTokens({ tokensAndOwners2: [cache.nfts, pools], blacklistedTokens: ['0x08142348e6bbf233002b81047bc2f27026af10a5']}) } } -} \ No newline at end of file +} +*/ \ No newline at end of file From d38445960b37af973116bb056ad19020d5a9361c Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Sat, 29 Jul 2023 20:02:51 +0100 Subject: [PATCH 0548/1974] add new pool --- projects/gyroscope/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/gyroscope/index.js b/projects/gyroscope/index.js index 2651b62456d..89f84e68323 100644 --- a/projects/gyroscope/index.js +++ b/projects/gyroscope/index.js @@ -6,7 +6,8 @@ const GYRO_POOL_ADDRESSES = [ "0x97469e6236bd467cd147065f77752b00efadce8a", "0xdac42eeb17758daa38caf9a3540c808247527ae3", "0xf0ad209e2e969eaaa8c882aac71f02d8a047d5c2", - "0xfa9ee04a5545d8e0a26b30f5ca5cbecd75ea645f" + "0xfa9ee04a5545d8e0a26b30f5ca5cbecd75ea645f", + "0xee278d943584dd8640eaf4cc6c7a5c80c0073e85" ] async function tvl(_, _b, _cb, { api, }) { From c36641bdbeaf30fb9e7b126d010c3d9c7c95e7e6 Mon Sep 17 00:00:00 2001 From: 0xngmi <80541789+0xngmi@users.noreply.github.com> Date: Sun, 30 Jul 2023 01:12:07 +0100 Subject: [PATCH 0549/1974] add rug event --- projects/kannagi-finance/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/kannagi-finance/index.js b/projects/kannagi-finance/index.js index 6c8c5f085e9..f46bb61a46f 100644 --- a/projects/kannagi-finance/index.js +++ b/projects/kannagi-finance/index.js @@ -34,4 +34,4 @@ helperReturn.era.tvl = tvlFunWrapper return helperReturn; } -module.exports = yieldHelperWrapper() +module.exports = {...yieldHelperWrapper(), hallmarks:[[1690589340, "Rug"]]} From 8d1d92197b21d6a545f24eedd63738b1f9fde793 Mon Sep 17 00:00:00 2001 From: deboguer-jng <71242057+deboguer-jng@users.noreply.github.com> Date: Sun, 30 Jul 2023 02:55:00 -0700 Subject: [PATCH 0550/1974] arbitrove tvl (#6951) * implemented tvl function for arbitrove or APL token * code refactor --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/arbitrove/index.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 projects/arbitrove/index.js diff --git a/projects/arbitrove/index.js b/projects/arbitrove/index.js new file mode 100644 index 00000000000..08ae691e021 --- /dev/null +++ b/projects/arbitrove/index.js @@ -0,0 +1,21 @@ +const { getLogs } = require('../helper/cache/getLogs'); +const { nullAddress, } = require('../helper/unwrapLPs'); +const ALP_TOKEN = '0xb49B6A3Fd1F4bB510Ef776de7A88A9e65904478A'; + +async function tvl(_, _b, _cb, { api }) { + const logs = await getLogs({ + api, + target: ALP_TOKEN, + topic: 'SetCoinCap(address,uint256)', + eventAbi: 'event SetCoinCap(address indexed coin, uint256 indexed cap)', + onlyArgs: true, + fromBlock: 67635825, + }) + return api.sumTokens({ owners: [ALP_TOKEN], tokens: [nullAddress, ...logs.map(l => l.coin)]}) +} + +module.exports = { + arbitrum: { + tvl, + } +} \ No newline at end of file From 344dacc2d1758f12c32860d76b0016d0b5f0dd45 Mon Sep 17 00:00:00 2001 From: devsceth <139822274+devsceth@users.noreply.github.com> Date: Sun, 30 Jul 2023 14:00:29 +0200 Subject: [PATCH 0551/1974] add yogurtfinance (#6950) --- projects/YogurtFinance/index.js | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 projects/YogurtFinance/index.js diff --git a/projects/YogurtFinance/index.js b/projects/YogurtFinance/index.js new file mode 100644 index 00000000000..6f2b74dba30 --- /dev/null +++ b/projects/YogurtFinance/index.js @@ -0,0 +1,10 @@ +const { masterchefExports } = require("../helper/unknownTokens"); + +module.exports = masterchefExports({ + chain: "pulse", + masterchef: "0xca3E704Bd09B979170D76d34880c7A72fda51B63", + nativeTokens: ["0xece11C704F38FF38520667AeCDd7f53eA82F60F5"], + useDefaultCoreAssets: true, + poolInfoABI: "function poolInfo(uint256) view returns (address)", + getToken: (i) => i, +}); From 0e0099282792b8afc75ab836f60e552fc5d1cb79 Mon Sep 17 00:00:00 2001 From: Christian Holman Date: Sun, 30 Jul 2023 13:00:57 +0100 Subject: [PATCH 0552/1974] retro adapter (#6949) --- projects/retro/index.js | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 projects/retro/index.js diff --git a/projects/retro/index.js b/projects/retro/index.js new file mode 100644 index 00000000000..990098bbd7a --- /dev/null +++ b/projects/retro/index.js @@ -0,0 +1,8 @@ +const { uniV3Export } = require("../helper/uniswapV3"); + +module.exports = uniV3Export({ + polygon: { + factory: "0x91e1B99072f238352f59e58de875691e20Dc19c1", + fromBlock: 43939793, + }, +}); From fb183fd5b99585501a243bca47e70c1139896d7c Mon Sep 17 00:00:00 2001 From: LendleM <138593011+LendleM@users.noreply.github.com> Date: Sun, 30 Jul 2023 15:07:51 +0300 Subject: [PATCH 0553/1974] update Lendle adapter (#6948) --- projects/lendle/index.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/projects/lendle/index.js b/projects/lendle/index.js index 7397de943a0..d332dc1e495 100644 --- a/projects/lendle/index.js +++ b/projects/lendle/index.js @@ -1,5 +1,15 @@ const { aaveV2Export } = require("../helper/aave"); +const { staking } = require("../helper/staking"); + +const LPConfiguratorContract = "0x30D990834539E1CE8Be816631b73a534e5044856"; +const StakingContract = "0x5C75A733656c3E42E44AFFf1aCa1913611F49230"; +const TokenContract = "0x25356aeca4210eF7553140edb9b8026089E49396"; module.exports = { - mantle: aaveV2Export('0x30D990834539E1CE8Be816631b73a534e5044856', { fromBlock: 56556, }) -}; \ No newline at end of file + mantle: { + ...aaveV2Export(LPConfiguratorContract, { + fromBlock: 56556, + }), + staking: staking(StakingContract, TokenContract), + }, +}; From 948d64a66342f3050ee9d118b8656b167f984d4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gilgame=C5=A1?= <22778436+Gilgames000@users.noreply.github.com> Date: Sun, 30 Jul 2023 14:28:31 +0200 Subject: [PATCH 0554/1974] leetswap: track base (#6945) * leetswap: track base * minor fix * minor fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/helper/tokenMapping.js | 5 ++++- projects/helper/utils.js | 3 ++- projects/leetswap/index.js | 1 + 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 7f42e5e9bc2..4689c04b1c2 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -50,7 +50,10 @@ const fixBalancesTokens = { }, telos: { '0xdc2393dc10734bf153153038943a5deb42b209cd': { coingeckoId: "telos", decimals: 18 }, - } + }, + base: { + '0x4200000000000000000000000000000000000006': { coingeckoId: "ethereum", decimals: 18 }, + }, } ibcChains.forEach(chain => fixBalancesTokens[chain] = { ...ibcMappings, ...(fixBalancesTokens[chain] || {}) }) diff --git a/projects/helper/utils.js b/projects/helper/utils.js index 787dfae90ab..b97c5129d20 100644 --- a/projects/helper/utils.js +++ b/projects/helper/utils.js @@ -250,7 +250,8 @@ async function debugBalances({ balances = {}, chain, log = false, tableLabel = ' const symbols = await api.multiCall({ abi: 'erc20:symbol', calls: tokens, permitFailure: true, }) const decimals = await api.multiCall({ abi: 'erc20:decimals', calls: tokens, permitFailure: true, }) - const name = await api.multiCall({ abi: erc20.name, calls: tokens, permitFailure: true, }) + let name = await api.multiCall({ abi: erc20.name, calls: tokens, permitFailure: true, }) + name = name.map(i => i && i.length > 50 ? i.slice(0, 50) + '...' : i) let symbolsETH, nameETH diff --git a/projects/leetswap/index.js b/projects/leetswap/index.js index 9a89cb1dcd9..fb9ab444a69 100644 --- a/projects/leetswap/index.js +++ b/projects/leetswap/index.js @@ -5,4 +5,5 @@ module.exports = { polygon_zkevm: { tvl: getUniTVL({ factory: '0xcE87E0960f4e2702f4bFFE277655E993Ae720e84', useDefaultCoreAssets: true, }), }, canto: { tvl: getUniTVL({ factory: '0x116e8a41E8B0A5A87058AF110C0Ddd55a0ed82B7', useDefaultCoreAssets: true, }), }, linea: { tvl: getUniTVL({ factory: '0x4DDf0fa98B5f9Bd7Cb0645c25bA89A574fe9Be8c', useDefaultCoreAssets: true, }), }, + base: { tvl: getUniTVL({ factory: '0x169C06b4cfB09bFD73A81e6f2Bb1eB514D75bB19', useDefaultCoreAssets: true, hasStablePools: true, stablePoolSymbol: 'sLS2', fetchBalances: true, }), }, } From 014edf5d5353398a56c4bc94287c93bcccd7d74d Mon Sep 17 00:00:00 2001 From: Peter Volnov <41264338+pvolnov@users.noreply.github.com> Date: Sun, 30 Jul 2023 05:28:41 -0700 Subject: [PATCH 0555/1974] here wallet support (#6946) * here wallet support * minor fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/helper/chain/near.js | 1 + projects/here-staking/index.js | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 projects/here-staking/index.js diff --git a/projects/helper/chain/near.js b/projects/helper/chain/near.js index d7b88100798..4076476ac80 100644 --- a/projects/helper/chain/near.js +++ b/projects/helper/chain/near.js @@ -18,6 +18,7 @@ const tokenMapping = { 'wrap.near': { name: 'near', decimals: 24, }, 'meta-pool.near': { name: 'staked-near', decimals: 24, }, [ADDRESSES.near.LINA]: { name: 'linear-protocol', decimals: 24, }, + "storage.herewallet.near": { name: 'here-staking', decimals: 24, }, 'usn': { name: 'usn', decimals: 18, }, 'aurora': { name: 'ethereum', decimals: 18, }, 'token.skyward.near': { name: 'skyward-finance', decimals: 18, }, diff --git a/projects/here-staking/index.js b/projects/here-staking/index.js new file mode 100644 index 00000000000..e0d77de7150 --- /dev/null +++ b/projects/here-staking/index.js @@ -0,0 +1,16 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { call } = require('../helper/chain/near') + +async function tvl() { + const here_balance = await call("storage.herewallet.near", 'ft_total_supply', {}); + return { + near: (here_balance / 1e24) + }; +} + +module.exports = { + near: { + tvl + }, + timetravel: false, +}; \ No newline at end of file From 2f4feb85d0bf5cde5e31478462fad6209f543937 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Sun, 30 Jul 2023 16:17:43 +0200 Subject: [PATCH 0556/1974] track openworld.vision --- projects/openworld/index.js | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 projects/openworld/index.js diff --git a/projects/openworld/index.js b/projects/openworld/index.js new file mode 100644 index 00000000000..d5580cf7082 --- /dev/null +++ b/projects/openworld/index.js @@ -0,0 +1,7 @@ +const { gmxExports } = require('../helper/gmx') + +module.exports = { + arbitrum: { + tvl: gmxExports({ vault: '0xec45801399EB38B75A3bf793051b00bb64fF3eF8', }) + }, +} \ No newline at end of file From d5384216ef44b68b4802145275072ccb800342e8 Mon Sep 17 00:00:00 2001 From: gpt dev Date: Mon, 31 Jul 2023 04:09:51 +0800 Subject: [PATCH 0557/1974] sft v2 upgrade to new api url (#6947) --- projects/sft-protocol/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/sft-protocol/index.js b/projects/sft-protocol/index.js index 2a3c6bab710..aa3b06591d1 100644 --- a/projects/sft-protocol/index.js +++ b/projects/sft-protocol/index.js @@ -8,7 +8,7 @@ const tokens = [ ] const getActiveMinersFromRPC = async () => { - const resp = await getConfig('sft-protocol', 'https://api.sftproject.io/api/v1/public/dashboard/info') + const resp = await getConfig('sft-protocol', 'https://ww8.sftproject.io/api/c/api/v1/public/dashboard/info') let nodes = [] let node_i = [] nodes = resp.data.combined From 68ba80666fbcc0df7fa0df1378ad4f80a6895b20 Mon Sep 17 00:00:00 2001 From: oxSaturn Date: Mon, 31 Jul 2023 04:10:56 +0800 Subject: [PATCH 0558/1974] add base chain for velocimeter (#6952) --- projects/velocimeter-v2/index.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/projects/velocimeter-v2/index.js b/projects/velocimeter-v2/index.js index 7732e6d89c7..180101696e5 100644 --- a/projects/velocimeter-v2/index.js +++ b/projects/velocimeter-v2/index.js @@ -16,4 +16,11 @@ module.exports = { hasStablePools: true, }) }, + base: { + tvl: getUniTVL({ + factory: '0xe21Aac7F113Bd5DC2389e4d8a8db854a87fD6951', + useDefaultCoreAssets: true, + hasStablePools: true, + }) + }, } From 9f8436b50ba1f8c57f2026cfc3cd16912f1f3e46 Mon Sep 17 00:00:00 2001 From: Michalis Kargakis Date: Sun, 30 Jul 2023 22:11:20 +0200 Subject: [PATCH 0559/1974] Track pETH-ETH liquidity drain (#6953) --- projects/jpeg-d/index.js | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/projects/jpeg-d/index.js b/projects/jpeg-d/index.js index 48431faa550..0637c369239 100644 --- a/projects/jpeg-d/index.js +++ b/projects/jpeg-d/index.js @@ -12,13 +12,7 @@ module.exports = { hallmarks: [ [1666003500, "pETH borrows"], [1669551000, "JPEG LTV boost"], - // [1670518800, "APE staking"], not that much impact on TVL - //[1674669600, "Autoglyphs & Fidenza support"], not that much impact on TVL - //[1675166400, "Ringers & Chromie Squiggle support"], not that much impact on TVL - //[1675598400, "70% LTV for CryptoPunks & BAYC"], not that much impact on TVL - //[1678665600, "Otherdeeds & Meebits support"], - // [1679529600, "BAKC support"], not that much impact on TVL [1683662400, "P2P Ape Staking"], - //[1684108800, "Milady support"], + [1690730000, "pETH-ETH Curve pool drained"], ], }; From e3abe437095053d653b2bb17024257b592c190d6 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Sun, 30 Jul 2023 21:24:00 +0100 Subject: [PATCH 0560/1974] add distressed asset check --- projects/beefy/index.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/projects/beefy/index.js b/projects/beefy/index.js index 2556850b164..45d036bf390 100644 --- a/projects/beefy/index.js +++ b/projects/beefy/index.js @@ -2,6 +2,8 @@ const utils = require('../helper/utils'); const { toUSDTBalances } = require('../helper/balances'); let _response +const distressedAssets = ['aleth']; // Add any distressed asset names here + function fetchChain(chainId, staking) { return async () => { if (!_response) _response = utils.fetchURL('https://api.beefy.finance/tvl') @@ -10,6 +12,11 @@ function fetchChain(chainId, staking) { let tvl = 0; const chain = response.data[chainId]; for (const vault in chain) { + // Skip distressed assets + if (distressedAssets.some(asset => vault.includes(asset))) { + continue; + } + const isBIFI = vault.includes("bifi") if ((isBIFI && staking) || (!isBIFI && !staking)) { tvl += Number(chain[vault]); From 5ad3e06c6a41f1e72c8880e744fcda93532cb81e Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Sun, 30 Jul 2023 23:12:13 +0200 Subject: [PATCH 0561/1974] move bulky adapters --- projects/summer-fi/api.js | 7 +++++++ projects/sunswap-v2/api.js | 7 +++++++ 2 files changed, 14 insertions(+) create mode 100644 projects/summer-fi/api.js create mode 100644 projects/sunswap-v2/api.js diff --git a/projects/summer-fi/api.js b/projects/summer-fi/api.js new file mode 100644 index 00000000000..702709855f7 --- /dev/null +++ b/projects/summer-fi/api.js @@ -0,0 +1,7 @@ +const {getExports} = require('../helper/heroku-api') +const chains = ['ethereum'] + +module.exports = { + timetravel: false, + ...getExports("summer-fi", chains) +} diff --git a/projects/sunswap-v2/api.js b/projects/sunswap-v2/api.js new file mode 100644 index 00000000000..4d82220cd47 --- /dev/null +++ b/projects/sunswap-v2/api.js @@ -0,0 +1,7 @@ +const {getExports} = require('../helper/heroku-api') +const chains = ['tron'] + +module.exports = { + timetravel: false, + ...getExports("sunswap-v2", chains) +} From d099ca97b3ccf0c35055ea41f7b1e3930bd0f36a Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Mon, 31 Jul 2023 01:14:05 +0100 Subject: [PATCH 0562/1974] fix harvest pump from hack --- projects/harvest.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/projects/harvest.js b/projects/harvest.js index 57adeb10432..1b837eb852c 100644 --- a/projects/harvest.js +++ b/projects/harvest.js @@ -19,7 +19,10 @@ Object.keys(chains).forEach(chain => { if (!_response) _response = get(endpoint) const response = await _response var tvl = 0; - Object.values(response[chain]).map(async item => { + Object.values(response[chain]).map(item => { + if(item.id === "convex_pETH"){ + return + } const poolTvl = parseFloat(item.totalValueLocked ?? 0) tvl += poolTvl }) From 1f5c92a5f89489c05e4d07a7070c8b17be55a589 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 31 Jul 2023 08:10:02 +0200 Subject: [PATCH 0563/1974] fix broken adapters --- projects/summer-fi/constants/endpoints.js | 6 +++--- projects/summer-fi/index.js | 2 +- projects/sunswap-v2/index.js | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/projects/summer-fi/constants/endpoints.js b/projects/summer-fi/constants/endpoints.js index fade9273d9c..517494cb664 100644 --- a/projects/summer-fi/constants/endpoints.js +++ b/projects/summer-fi/constants/endpoints.js @@ -1,9 +1,9 @@ const { getEnv } = require("../../helper/env"); const endpoints = { - aave: getEnv("SUMMER_HISTORY_ENDPOINT"), - ajna: getEnv("SUMMER_AJNA_ENDPOINT"), - makerVaults: getEnv("SUMMER_CONFIRMED_VAULTS_ENDPOINT"), + aave: () => getEnv("SUMMER_HISTORY_ENDPOINT"), + ajna: () => getEnv("SUMMER_AJNA_ENDPOINT"), + makerVaults: () => getEnv("SUMMER_CONFIRMED_VAULTS_ENDPOINT"), }; module.exports = { diff --git a/projects/summer-fi/index.js b/projects/summer-fi/index.js index 8ac5635c8e5..a3ca89f388d 100644 --- a/projects/summer-fi/index.js +++ b/projects/summer-fi/index.js @@ -13,7 +13,7 @@ async function tvl(_, _1, _2, { api }) { await api.getBlock(); const executionStart = Date.now() / 1000; const [confirmedSummerFiMakerVaults, cdpIdList, cache] = await Promise.all([ - await getConfig("summer-fi/maker-vaults", endpoints.makerVaults), + await getConfig("summer-fi/maker-vaults", endpoints.makerVaults()), getAutomationCdpIdList({ api }), getCache("summer-fi/cache", api.chain), ]); diff --git a/projects/sunswap-v2/index.js b/projects/sunswap-v2/index.js index 8d96bbac225..2c432b713da 100644 --- a/projects/sunswap-v2/index.js +++ b/projects/sunswap-v2/index.js @@ -4,6 +4,6 @@ module.exports = { timetravel: false, misrepresentedTokens: true, tron: { - tvl: getUniTVL({ factory: 'TKWJdrQkqHisa1X8HUdHEfREvTzw4pMAaY', useDefaultCoreAssets: true, queryBatched: 21 }), + tvl: getUniTVL({ factory: 'TKWJdrQkqHisa1X8HUdHEfREvTzw4pMAaY', useDefaultCoreAssets: true, queryBatched: 11 }), } } From 1b274dcacdda89ee7a435d5598bbc06c50e9268c Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 31 Jul 2023 08:23:46 +0200 Subject: [PATCH 0564/1974] fix sunswap-v2 --- projects/sunswap-v2/index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/projects/sunswap-v2/index.js b/projects/sunswap-v2/index.js index 2c432b713da..055990fcfc9 100644 --- a/projects/sunswap-v2/index.js +++ b/projects/sunswap-v2/index.js @@ -1,5 +1,7 @@ const { getUniTVL } = require('../helper/unknownTokens.js') +process.env.TRON_RPC="https://rpc.ankr.com/http/tron/wallet/triggerconstantcontract" + module.exports = { timetravel: false, misrepresentedTokens: true, From 87800036063214f8061e4ad6155835c2bb5752c2 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 31 Jul 2023 08:25:40 +0200 Subject: [PATCH 0565/1974] fix broken adapters: summer-fi --- projects/summer-fi/handlers/dpm-positions.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/summer-fi/handlers/dpm-positions.js b/projects/summer-fi/handlers/dpm-positions.js index a77cf2423fb..a5390f11cab 100644 --- a/projects/summer-fi/handlers/dpm-positions.js +++ b/projects/summer-fi/handlers/dpm-positions.js @@ -43,8 +43,8 @@ query { }`; const dpmPositions = async ({ api, }) => { - const aave = await blockQuery(endpoints.aave, aaveQuery(api.block), { api }); - const ajna = await blockQuery(endpoints.ajna, ajnaQuery(api.block), { api }); + const aave = await blockQuery(endpoints.aave(), aaveQuery(api.block), { api }); + const ajna = await blockQuery(endpoints.ajna(), ajnaQuery(api.block), { api }); const supportedAjnaPools = [ ...new Set(ajna.accounts.map(({ pool: { address } }) => address)), From 9e21a980bccaab0f62c77b84b8ac8b0453c2b0d0 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 31 Jul 2023 08:38:41 +0200 Subject: [PATCH 0566/1974] track https://app.rocketswap.cc --- projects/helper/coreAssets.json | 4 ++++ projects/helper/tokenMapping.js | 3 --- projects/leetswap/index.js | 2 +- projects/rocketswap-cc/index.js | 6 ++++++ 4 files changed, 11 insertions(+), 4 deletions(-) create mode 100644 projects/rocketswap-cc/index.js diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index c704a5472e4..714a50dad61 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -475,6 +475,7 @@ }, "telos": { "WTLOS": "0xd102ce6a4db07d247fcc28f366a623df0938ca9e", + "WTLOS_1": "0xdc2393dc10734bf153153038943a5deb42b209cd", "ETH": "0xfa9343c3897324496a05fc75abed6bac29f8a40f", "WBTC": "0xf390830df829cf22c53c8840554b98eafc5dcbc2", "USDC": "0x818ec0a7fe18ff94269904fced6ae3dae6d6dc0b", @@ -1342,5 +1343,8 @@ }, "linea": { "WETH": "0xe5D7C2a44FfDDf6b295A15c148167daaAf5Cf34f" + }, + "base": { + "WETH": "0x4200000000000000000000000000000000000006" } } diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 4689c04b1c2..8ce25e60c36 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -51,9 +51,6 @@ const fixBalancesTokens = { telos: { '0xdc2393dc10734bf153153038943a5deb42b209cd': { coingeckoId: "telos", decimals: 18 }, }, - base: { - '0x4200000000000000000000000000000000000006': { coingeckoId: "ethereum", decimals: 18 }, - }, } ibcChains.forEach(chain => fixBalancesTokens[chain] = { ...ibcMappings, ...(fixBalancesTokens[chain] || {}) }) diff --git a/projects/leetswap/index.js b/projects/leetswap/index.js index fb9ab444a69..f4e9edb0e80 100644 --- a/projects/leetswap/index.js +++ b/projects/leetswap/index.js @@ -5,5 +5,5 @@ module.exports = { polygon_zkevm: { tvl: getUniTVL({ factory: '0xcE87E0960f4e2702f4bFFE277655E993Ae720e84', useDefaultCoreAssets: true, }), }, canto: { tvl: getUniTVL({ factory: '0x116e8a41E8B0A5A87058AF110C0Ddd55a0ed82B7', useDefaultCoreAssets: true, }), }, linea: { tvl: getUniTVL({ factory: '0x4DDf0fa98B5f9Bd7Cb0645c25bA89A574fe9Be8c', useDefaultCoreAssets: true, }), }, - base: { tvl: getUniTVL({ factory: '0x169C06b4cfB09bFD73A81e6f2Bb1eB514D75bB19', useDefaultCoreAssets: true, hasStablePools: true, stablePoolSymbol: 'sLS2', fetchBalances: true, }), }, + base: { tvl: getUniTVL({ factory: '0x169C06b4cfB09bFD73A81e6f2Bb1eB514D75bB19', useDefaultCoreAssets: true, hasStablePools: true, stablePoolSymbol: 'sLS2', }), }, } diff --git a/projects/rocketswap-cc/index.js b/projects/rocketswap-cc/index.js new file mode 100644 index 00000000000..46868795e8d --- /dev/null +++ b/projects/rocketswap-cc/index.js @@ -0,0 +1,6 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports = { + misrepresentedTokens: true, + base: { tvl: getUniTVL({ factory: '0x1b8128c3a1b7d20053d10763ff02466ca7ff99fc', useDefaultCoreAssets: true, fetchBalances: true, }), }, +} From 242d73870e4a8012c520e60a62fcee1e92155aec Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 31 Jul 2023 08:50:07 +0200 Subject: [PATCH 0567/1974] track https://app.crescentswap.exchange --- projects/crescentswap/index.js | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 projects/crescentswap/index.js diff --git a/projects/crescentswap/index.js b/projects/crescentswap/index.js new file mode 100644 index 00000000000..10eb3aea867 --- /dev/null +++ b/projects/crescentswap/index.js @@ -0,0 +1,6 @@ +const { uniV3Export } = require("../helper/uniswapV3"); + +module.exports = uniV3Export({ + arbitrum: { factory: "0x8219904A8683d06e38605276baCBf2D29aa764DD", fromBlock: 91137559, }, + base: { factory: "0x3539dA2AdB3f8311D203D334f25f7Bee604A5c50", fromBlock: 1979234, }, +}); From d6567573621081471c8b242926018dfc931af753 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 31 Jul 2023 09:49:48 +0200 Subject: [PATCH 0568/1974] remove redundant param --- projects/1bch/index.js | 2 +- projects/DogeShrek/index.js | 1 - projects/ElonSwap/index.js | 1 - projects/Kwikswap/index.js | 5 ----- projects/LFIswap/index.js | 1 - projects/PowSea/index.js | 1 - projects/SweetSwap/index.js | 3 --- projects/VAX/index.js | 1 - projects/adaswap/index.js | 2 +- projects/agile/index.js | 1 - projects/agora/index.js | 2 +- projects/agsfinance/index.js | 2 +- projects/alita-finance/index.js | 6 +++--- projects/aliumswap/index.js | 4 ++-- projects/apeswap-amm/index.js | 4 ---- projects/apexswap/index.js | 1 - projects/arbswap/index.js | 2 -- projects/archerswap/index.js | 1 - projects/archly-finance/index.js | 16 ++++++++-------- projects/argano/index.js | 4 ++-- projects/arthswap/index.js | 1 - projects/astarexchange/index.js | 2 +- projects/babydogeswap/index.js | 7 +++---- projects/babyswap/index.js | 4 ++-- projects/baguette/index.js | 2 +- projects/bamboodefi/index.js | 4 +--- projects/barnswap/index.js | 1 - projects/baryon/index.js | 1 - projects/based-finance/index.js | 2 +- projects/beamswap/index.js | 3 +-- projects/bearnfi/index.js | 1 - projects/becoswap/index.js | 1 - projects/benswap/index.js | 4 ++-- projects/biswap/index.js | 4 ++-- projects/bitgert-swap/index.js | 1 - projects/blindex/index.js | 1 - projects/blockng/index.js | 1 - projects/bourbon/index.js | 1 - projects/brightside/index.js | 2 +- projects/brise-swap/index.js | 1 - projects/cafeswap/index.js | 2 -- projects/cakewwap/index.js | 1 - projects/candycity/index.js | 1 - projects/canto-dex/index.js | 1 - projects/canto-forte/index.js | 1 - projects/cantoswap/index.js | 1 - projects/capitaldex/index.js | 2 +- projects/capricorn/index.js | 1 - projects/carbonswap/index.js | 2 -- projects/casinocronos/index.js | 1 - projects/champagne-swap.js | 2 +- projects/cherryswap/index.js | 1 - projects/coinswap/index.js | 1 - projects/convergence/index.js | 1 - projects/coreswap/index.js | 1 - projects/corgiswap.js | 2 +- projects/cronaswap/index.js | 1 - projects/daomaker-swap/index.js | 2 +- projects/dddx.js | 2 +- projects/defi-swap/index.js | 3 ++- projects/dfyn/index.js | 3 --- projects/dmusk/index.js | 1 - projects/dogmoney/index.js | 3 +-- projects/dooar/index.js | 1 - projects/duneswap.js | 2 +- projects/elephantdex/index.js | 1 - projects/empiredex/index.js | 24 ++++++++++-------------- projects/energiswap.js | 1 - projects/energyfi/index.js | 1 - projects/etcswap/index.js | 1 - projects/farmersonly/index.js | 1 - projects/fatex/index.js | 1 - projects/foodcourt/index.js | 2 -- projects/fstswap/index.js | 1 - projects/fusefi/swap.js | 1 - projects/fusion/index.js | 3 --- projects/fxswap/index.js | 2 +- projects/gemkeeper.js | 2 +- projects/gemswap/index.js | 1 - projects/ginfinance.js | 2 +- projects/gravis-finance/index.js | 23 ++++++++++------------- projects/gxypad/index.js | 1 - projects/hermes/index.js | 2 -- projects/hippowswap/index.js | 1 - projects/honeyswap/index.js | 2 -- projects/hopswap/index.js | 1 - projects/hpdex/index.js | 1 - projects/huckleberry/index.js | 3 +-- projects/hurricaneswap.js | 1 - projects/hyperjump/index.js | 3 --- projects/inuswap/index.js | 1 - projects/jswap-finance/index.js | 1 - projects/juggler-red/index.js | 1 - projects/julswap/index.js | 1 - projects/jupiterswap/index.js | 1 - projects/kaidex/index.js | 1 - projects/kasavadex/index.js | 1 - projects/katana-ronin.js | 2 +- projects/kdex/index.js | 1 - projects/kefirswap/index.js | 1 - projects/kokomoswap/index.js | 1 - projects/kokoswap/index.js | 1 - projects/kuswap/index.js | 1 - projects/kyotoswap/index.js | 1 - projects/liquid-bolt/index.js | 8 ++++---- projects/lydia/index.js | 2 +- projects/mm-finance-polygon/index.js | 1 - projects/mm-finance/index.js | 1 - projects/mochiswap/index.js | 2 -- projects/moonlift/index.js | 1 - projects/moonswap/index.js | 1 - projects/niifi.js | 2 +- projects/nomiswap/index.js | 1 - projects/oaswap.js | 2 +- projects/occam.js | 2 +- projects/octopow/index.js | 1 - projects/okcswap/index.js | 1 - projects/onavax/index.js | 1 - projects/oolongswap/index.js | 1 - projects/oortswap/index.js | 1 - projects/openswap_harmony/index.js | 1 - projects/orionprotocol/index.js | 4 ++-- projects/pegasys/index.js | 1 - projects/photonswap/index.js | 3 --- projects/pinkswap/index.js | 1 - projects/pippifinance/index.js | 2 +- projects/planet-blue/index.js | 1 - projects/pls2e/index.js | 1 - projects/powerswap/index.js | 1 - projects/powswap/index.js | 1 - projects/puddingswap/index.js | 1 - projects/pyeswap/index.js | 1 - projects/quasar-swap/index.js | 1 - projects/rcpswap/index.js | 1 - projects/redemption/index.js | 1 - projects/scaryswap/index.js | 1 - projects/sealightswap/index.js | 1 - projects/shadowswap/index.js | 1 - projects/sharkswap/index.js | 1 - projects/shibaswap/index.js | 2 +- projects/solarbeam/index.js | 2 +- projects/soyfinance/index.js | 4 ---- projects/spicetrade/index.js | 1 - projects/starswap/index.js | 1 - projects/stellaswap.js | 1 - projects/sumswap/index.js | 2 +- projects/swapfish/index.js | 4 ++-- projects/swapperchan/index.js | 1 - projects/swipeswap.js | 4 ++-- projects/tendieswap/index.js | 2 +- projects/tetu-swap/index.js | 1 - projects/thorusfi/index.js | 4 ++-- projects/tifi-bank/index.js | 5 +++-- projects/titano-swych/index.js | 1 - projects/tomb-swap/index.js | 1 - projects/trisolaris.js | 1 - projects/ultronSwap/index.js | 2 -- projects/uniwswap/index.js | 1 - projects/valuedefi.js | 2 +- projects/vanswap/index.js | 1 - projects/vvs-finance/index.js | 1 - projects/w3swap/index.js | 1 - projects/wagyuswap/index.js | 2 +- projects/wakafinance.js | 1 - projects/wardenswap/index.js | 1 - projects/whaleswap/index.js | 13 ------------- projects/winery-swap/index.js | 1 - projects/wojakfinance/index.js | 1 - projects/wtfdex/index.js | 2 +- projects/xspswap/index.js | 1 - projects/yodeswap/api.js | 3 --- projects/yuzu.js | 2 +- projects/zerodex/index.js | 3 --- projects/zipswap/index.js | 1 - projects/zkevmswap/index.js | 1 - projects/zkmoonswap/index.js | 1 - 176 files changed, 96 insertions(+), 275 deletions(-) diff --git a/projects/1bch/index.js b/projects/1bch/index.js index fb161a5bc04..6d0047b0250 100644 --- a/projects/1bch/index.js +++ b/projects/1bch/index.js @@ -26,7 +26,7 @@ async function bchMasterChef(timestamp, ethBlock, {[CHAIN]: block}) { } } -const bchDexTvl = getUniTVL({ factory: FACTORY, chain: CHAIN, useDefaultCoreAssets: true, }) +const bchDexTvl = getUniTVL({ factory: FACTORY, useDefaultCoreAssets: true, }) module.exports = { misrepresentedTokens: true, diff --git a/projects/DogeShrek/index.js b/projects/DogeShrek/index.js index 1c8f3e36398..bf265e609d0 100644 --- a/projects/DogeShrek/index.js +++ b/projects/DogeShrek/index.js @@ -4,7 +4,6 @@ module.exports = { misrepresentedTokens: true, dogechain: { tvl: getUniTVL({ - chain: 'dogechain', useDefaultCoreAssets: true, factory: '0x7C10a3b7EcD42dd7D79C0b9d58dDB812f92B574A', }) diff --git a/projects/ElonSwap/index.js b/projects/ElonSwap/index.js index 4f36d6bf672..39ac9faf204 100644 --- a/projects/ElonSwap/index.js +++ b/projects/ElonSwap/index.js @@ -6,7 +6,6 @@ module.exports = { misrepresentedTokens: true, dogechain: { tvl: getUniTVL({ - chain, factory: "0x8B8CFD13ec09454E6440A4812ed306796a4Fb3eE", useDefaultCoreAssets: true, }), diff --git a/projects/Kwikswap/index.js b/projects/Kwikswap/index.js index 6bbb21e9b50..db7a438e869 100644 --- a/projects/Kwikswap/index.js +++ b/projects/Kwikswap/index.js @@ -15,12 +15,10 @@ const STAKING_CONTRACTS = { }; module.exports = { - timetravel: true, misrepresentedTokens: true, ethereum: { tvl: getUniTVL({ factory: '0xdD9EFCbDf9f422e2fc159eFe77aDD3730d48056d', - chain: 'ethereum', useDefaultCoreAssets: true, }), staking: staking( @@ -32,7 +30,6 @@ module.exports = { polygon: { tvl: getUniTVL({ factory: '0x0B29D7a989D6647E4A56eE9899DaF7535FF9620c', - chain: 'polygon', useDefaultCoreAssets: true, }), staking: staking( @@ -44,7 +41,6 @@ module.exports = { shiden: { tvl: getUniTVL({ factory: '0xf5fC2D145381A2eBAFb93Cc2B60fB2b97FB405aa', - chain: 'shiden', useDefaultCoreAssets: true, }), staking: staking( @@ -56,7 +52,6 @@ module.exports = { }, bsc: { tvl: getUniTVL({ - chain: 'bsc', useDefaultCoreAssets: true, factory: '0x64eBD6CaCece790e9C4DDeA1a24952Ddb2715279', }), diff --git a/projects/LFIswap/index.js b/projects/LFIswap/index.js index 88824b07d61..9fc0d8f9ac0 100644 --- a/projects/LFIswap/index.js +++ b/projects/LFIswap/index.js @@ -6,7 +6,6 @@ module.exports = { kava: { tvl: getUniTVL({ factory: '0xB702C2917f47012C331C6c65B74e07dA61260Bd4', - chain: 'kava', useDefaultCoreAssets: true, }), } diff --git a/projects/PowSea/index.js b/projects/PowSea/index.js index 4dfbdfe8af6..461fb2f69b8 100644 --- a/projects/PowSea/index.js +++ b/projects/PowSea/index.js @@ -4,7 +4,6 @@ module.exports = { misrepresentedTokens: true, ethpow: { tvl: getUniTVL({ - chain: 'ethpow', useDefaultCoreAssets: true, factory: '0x1Ee0fe7f80BeA6353b137B2E7DCA9e26F3c6F442', }) diff --git a/projects/SweetSwap/index.js b/projects/SweetSwap/index.js index de54f3f55da..db42172b92b 100644 --- a/projects/SweetSwap/index.js +++ b/projects/SweetSwap/index.js @@ -1,11 +1,8 @@ const { getUniTVL } = require('../helper/unknownTokens') -const chain = 'dogechain' - module.exports = { dogechain: { tvl: getUniTVL({ - chain, useDefaultCoreAssets: true, factory: '0xf1036CA4762cD601BDc630cd32942f90d19ED970', }), diff --git a/projects/VAX/index.js b/projects/VAX/index.js index b9da773ec16..fa6c232c3cb 100644 --- a/projects/VAX/index.js +++ b/projects/VAX/index.js @@ -4,7 +4,6 @@ module.exports = { misrepresentedTokens: true, multivac: { tvl: getUniTVL({ - chain: 'multivac', factory: '0xbaC576111e2BC5EfBbE7c5d765b9DC44083901fD', useDefaultCoreAssets: true, }) diff --git a/projects/adaswap/index.js b/projects/adaswap/index.js index 8474c2cdb65..0edff47d152 100644 --- a/projects/adaswap/index.js +++ b/projects/adaswap/index.js @@ -5,6 +5,6 @@ module.exports = { methodology: "Factory address (0xe07C22C184ca252A525511B798BB8Ce96abDCc5b) is used to find the LP pairs. TVL is equal to the liquidity on the AMM.", milkomeda: { - tvl: getUniTVL({ factory: '0xe07C22C184ca252A525511B798BB8Ce96abDCc5b', chain: 'milkomeda', useDefaultCoreAssets: true, }), + tvl: getUniTVL({ factory: '0xe07C22C184ca252A525511B798BB8Ce96abDCc5b', useDefaultCoreAssets: true, }), }, }; \ No newline at end of file diff --git a/projects/agile/index.js b/projects/agile/index.js index e27f768c191..3cf0343718f 100644 --- a/projects/agile/index.js +++ b/projects/agile/index.js @@ -18,7 +18,6 @@ module.exports = { tvl: sdk.util.sumChainTvls([ getUniTVL({ factory: '0xb89E86701C4Fe4a22a16914e3b0Df53eA4BE771b', - chain: 'cronos', useDefaultCoreAssets: true, }), lendingMarket.tvl diff --git a/projects/agora/index.js b/projects/agora/index.js index 540a04f77c5..aef9b34a536 100644 --- a/projects/agora/index.js +++ b/projects/agora/index.js @@ -50,7 +50,7 @@ const { tvl: agoraFarmTvl, borrowed: agoraFarmBorrowed } = compoundExports( undefined, ); -const chainTvl = getUniTVL({ factory, chain: 'metis', useDefaultCoreAssets: true, }) +const chainTvl = getUniTVL({ factory, useDefaultCoreAssets: true, }) module.exports = { hallmarks: [ diff --git a/projects/agsfinance/index.js b/projects/agsfinance/index.js index e298ce7e9e9..21bdbde72f6 100644 --- a/projects/agsfinance/index.js +++ b/projects/agsfinance/index.js @@ -6,7 +6,7 @@ module.exports = { misrepresentedTokens: true, methodology: "AGS Finance Tvl Calculation", astar: { - tvl: getUniTVL({ factory: FACTORIES, chain: 'astar', useDefaultCoreAssets: true }), + tvl: getUniTVL({ factory: FACTORIES, useDefaultCoreAssets: true }), } }; diff --git a/projects/alita-finance/index.js b/projects/alita-finance/index.js index 1e3a8a5e4ac..dc30078f2ae 100644 --- a/projects/alita-finance/index.js +++ b/projects/alita-finance/index.js @@ -1,14 +1,14 @@ const { getUniTVL } = require('../helper/unknownTokens') const { staking } = require('../helper/staking') -const chain = 'bsc' const ALI_TOKEN = '0x557233E794d1a5FbCc6D26dca49147379ea5073c' const ALI_FACTORY = "0xC7a506ab3ac668EAb6bF9eCf971433D6CFeF05D9"; const ALI_MASTER_CHEF = '0x4f7b2Be2bc3C61009e9aE520CCfc830612A10694' module.exports = { + misrepresentedTokens: true, bsc: { - tvl: getUniTVL({ chain, factory: ALI_FACTORY, }), - staking: staking(ALI_MASTER_CHEF, ALI_TOKEN, chain), + tvl: getUniTVL({ factory: ALI_FACTORY, useDefaultCoreAssets: true,}), + staking: staking(ALI_MASTER_CHEF, ALI_TOKEN), } } \ No newline at end of file diff --git a/projects/aliumswap/index.js b/projects/aliumswap/index.js index 75912ea9e59..bec32848be2 100644 --- a/projects/aliumswap/index.js +++ b/projects/aliumswap/index.js @@ -7,7 +7,7 @@ const stakingPool1 = "0x4f388167F8B52F89C87A4E46706b9C1408F2c137"; // Old Strong module.exports = { bsc: { - tvl: getUniTVL({ chain: 'bsc', factory: '0xbEAC7e750728e865A3cb39D5ED6E3A3044ae4B98', useDefaultCoreAssets: true, }), - staking: stakings([stakingPool0, stakingPool1, ], ALMToken, 'bsc'), + tvl: getUniTVL({ factory: '0xbEAC7e750728e865A3cb39D5ED6E3A3044ae4B98', useDefaultCoreAssets: true, }), + staking: stakings([stakingPool0, stakingPool1, ], ALMToken), }, }; diff --git a/projects/apeswap-amm/index.js b/projects/apeswap-amm/index.js index 496ae7bc26f..99157d69bc7 100644 --- a/projects/apeswap-amm/index.js +++ b/projects/apeswap-amm/index.js @@ -15,7 +15,6 @@ module.exports = { bsc: { tvl: getUniTVL({ factory: FACTORY_BSC, - chain: "bsc", useDefaultCoreAssets: true, }), staking: staking([MASTER_APE, MASTER_APE_V2], BANANA_TOKEN, "bsc"), @@ -23,7 +22,6 @@ module.exports = { polygon: { tvl: getUniTVL({ factory: FACTORY_POLYGON, - chain: "polygon", useDefaultCoreAssets: true, }), }, @@ -33,14 +31,12 @@ module.exports = { telos: { tvl: getUniTVL({ factory: FACTORY_TELOS, - chain: "telos", useDefaultCoreAssets: true, }), }, arbitrum: { tvl: getUniTVL({ factory: FACTORY_ARBITRUM, - chain: "arbitrum", useDefaultCoreAssets: true, }), }, diff --git a/projects/apexswap/index.js b/projects/apexswap/index.js index cbadf3ab1ed..d509b1c8a36 100644 --- a/projects/apexswap/index.js +++ b/projects/apexswap/index.js @@ -8,7 +8,6 @@ module.exports = { avax: { tvl: getUniTVL({ factory: '0x21cadeb92c8bbfbef98c3098846f0999209c3a97', - chain: 'avax', useDefaultCoreAssets: true }) }, diff --git a/projects/arbswap/index.js b/projects/arbswap/index.js index 4b50e62475e..173cf14f32f 100644 --- a/projects/arbswap/index.js +++ b/projects/arbswap/index.js @@ -4,14 +4,12 @@ module.exports = { misrepresentedTokens: true, arbitrum_nova: { tvl: getUniTVL({ - chain: 'arbitrum_nova', useDefaultCoreAssets: true, factory: '0xf6239423FcF1c19ED2791D9648A90836074242Fd', }) }, arbitrum: { tvl: getUniTVL({ - chain: 'arbitrum', useDefaultCoreAssets: true, factory: '0xd394e9cc20f43d2651293756f8d320668e850f1b', }) diff --git a/projects/archerswap/index.js b/projects/archerswap/index.js index 11692f31a20..263af3ff89b 100644 --- a/projects/archerswap/index.js +++ b/projects/archerswap/index.js @@ -4,7 +4,6 @@ module.exports = { misrepresentedTokens: true, core: { tvl: getUniTVL({ - chain: 'core', useDefaultCoreAssets: true, factory: '0xe0b8838e8d73ff1CA193E8cc2bC0Ebf7Cf86F620', }) diff --git a/projects/archly-finance/index.js b/projects/archly-finance/index.js index 916d76bc291..42cfa21734e 100644 --- a/projects/archly-finance/index.js +++ b/projects/archly-finance/index.js @@ -7,7 +7,7 @@ const ARCHLY_ARC_TOKEN_OTHER = "0x684802262D614D0Cd0C9571672F03Dd9e85D7824" module.exports = { telos: { - tvl: getUniTVL({ factory: '0x39fdd4Fec9b41e9AcD339a7cf75250108D32906c', chain: 'telos', useDefaultCoreAssets: true, hasStablePools: true, }), + tvl: getUniTVL({ factory: '0x39fdd4Fec9b41e9AcD339a7cf75250108D32906c', useDefaultCoreAssets: true, hasStablePools: true, }), staking: sumTokensExport({ owner: '0x5680b3059b860d07A33B7A43d03D2E4dEdb226BB', tokens: ['0xa84df7aFbcbCC1106834a5feD9453bd1219B1fb5'], @@ -17,7 +17,7 @@ module.exports = { }) }, arbitrum: { - tvl: getUniTVL({ factory: '0xeafBFeb64F8e3793D7d1767774efd33b203200C9', chain: 'arbitrum', useDefaultCoreAssets: true, hasStablePools: true, }), + tvl: getUniTVL({ factory: '0xeafBFeb64F8e3793D7d1767774efd33b203200C9',useDefaultCoreAssets: true, hasStablePools: true, }), staking: sumTokensExport({ owner: '0x4c01dF6B9be381BA2a687D0ED5c40039dEEaf0a9', tokens: ['0x9435Ffb33Ce0180F55E08490C606eC3BD07da929'], @@ -27,7 +27,7 @@ module.exports = { }) }, arbitrum_nova: { - tvl: getUniTVL({ factory: ARCHLY_FACTORY_OTHER, chain: 'arbitrum_nova', useDefaultCoreAssets: true, hasStablePools: true, }), + tvl: getUniTVL({ factory: ARCHLY_FACTORY_OTHER, useDefaultCoreAssets: true, hasStablePools: true, }), staking: sumTokensExport({ owner: ARCHLY_VE_TOKEN_OTHER, tokens: [ARCHLY_ARC_TOKEN_OTHER], @@ -37,7 +37,7 @@ module.exports = { }) }, bsc: { - tvl: getUniTVL({ factory: ARCHLY_FACTORY_OTHER, chain: 'bsc', useDefaultCoreAssets: true, hasStablePools: true, }), + tvl: getUniTVL({ factory: ARCHLY_FACTORY_OTHER, seDefaultCoreAssets: true, hasStablePools: true, }), staking: sumTokensExport({ owner: ARCHLY_VE_TOKEN_OTHER, tokens: [ARCHLY_ARC_TOKEN_OTHER], @@ -47,7 +47,7 @@ module.exports = { }) }, fantom: { - tvl: getUniTVL({ factory: ARCHLY_FACTORY_OTHER, chain: 'fantom', useDefaultCoreAssets: true, hasStablePools: true, }), + tvl: getUniTVL({ factory: ARCHLY_FACTORY_OTHER, useDefaultCoreAssets: true, hasStablePools: true, }), staking: sumTokensExport({ owner: ARCHLY_VE_TOKEN_OTHER, tokens: [ARCHLY_ARC_TOKEN_OTHER], @@ -57,7 +57,7 @@ module.exports = { }) }, kava: { - tvl: getUniTVL({ factory: ARCHLY_FACTORY_OTHER, chain: 'kava', useDefaultCoreAssets: true, hasStablePools: true, }), + tvl: getUniTVL({ factory: ARCHLY_FACTORY_OTHER, useDefaultCoreAssets: true, hasStablePools: true, }), staking: sumTokensExport({ owner: ARCHLY_VE_TOKEN_OTHER, tokens: [ARCHLY_ARC_TOKEN_OTHER], @@ -67,7 +67,7 @@ module.exports = { }) }, optimism: { - tvl: getUniTVL({ factory: ARCHLY_FACTORY_OTHER, chain: 'optimism', useDefaultCoreAssets: true, hasStablePools: true, }), + tvl: getUniTVL({ factory: ARCHLY_FACTORY_OTHER, useDefaultCoreAssets: true, hasStablePools: true, }), staking: sumTokensExport({ owner: ARCHLY_VE_TOKEN_OTHER, tokens: [ARCHLY_ARC_TOKEN_OTHER], @@ -77,7 +77,7 @@ module.exports = { }) }, polygon: { - tvl: getUniTVL({ factory: ARCHLY_FACTORY_OTHER, chain: 'polygon', useDefaultCoreAssets: true, hasStablePools: true, }), + tvl: getUniTVL({ factory: ARCHLY_FACTORY_OTHER, useDefaultCoreAssets: true, hasStablePools: true, }), staking: sumTokensExport({ owner: ARCHLY_VE_TOKEN_OTHER, tokens: [ARCHLY_ARC_TOKEN_OTHER], diff --git a/projects/argano/index.js b/projects/argano/index.js index 05a6acc78fc..039ffb99bee 100644 --- a/projects/argano/index.js +++ b/projects/argano/index.js @@ -15,11 +15,11 @@ module.exports = { misrepresentedTokens: true, polygon: { tvl: sdk.util.sumChainTvls([ - sumTokensExport({ chain: 'polygon', tokensAndOwners: [ + sumTokensExport({ tokensAndOwners: [ [contracts.wbtc, contracts.wbtcPool], [contracts.usdt, contracts.usdtPool], ]}), - getUniTVL({ chain: 'polygon', factory: contracts.factory, useDefaultCoreAssets: true, }) + getUniTVL({ factory: contracts.factory, useDefaultCoreAssets: true, }) ]) } }; \ No newline at end of file diff --git a/projects/arthswap/index.js b/projects/arthswap/index.js index c490dbbd60c..ad7bdb436da 100644 --- a/projects/arthswap/index.js +++ b/projects/arthswap/index.js @@ -18,7 +18,6 @@ module.exports = { astar: { tvl: getUniTVL({ factory: FACTORIES, - chain: 'astar', useDefaultCoreAssets: true, }), staking: stakingPricedLP( diff --git a/projects/astarexchange/index.js b/projects/astarexchange/index.js index 61bd6d8c0ca..531eb870d84 100644 --- a/projects/astarexchange/index.js +++ b/projects/astarexchange/index.js @@ -4,6 +4,6 @@ module.exports = { misrepresentedTokens: true, methodology: "Astar Exchange Tvl Calculation", astar: { - tvl: getUniTVL({ factory: '0x95f506E72777efCB3C54878bB4160b00Cd11cd84', chain: 'astar', useDefaultCoreAssets: true }), + tvl: getUniTVL({ factory: '0x95f506E72777efCB3C54878bB4160b00Cd11cd84', useDefaultCoreAssets: true }), } } diff --git a/projects/babydogeswap/index.js b/projects/babydogeswap/index.js index d1299335fdb..6155edb6a89 100644 --- a/projects/babydogeswap/index.js +++ b/projects/babydogeswap/index.js @@ -1,18 +1,17 @@ const { getUniTVL } = require('../helper/unknownTokens') const { staking } = require('../helper/staking') -const chain = 'bsc' const farmFactoryContract = '0x4693B62E5fc9c0a45F89D62e6300a03C85f43137' const babydogeTokenAddress = '0xc748673057861a797275CD8A068AbB95A902e8de' const stakingContract = '0xcecd3e7eadae1ad0c94f53bf6a2af188df1a90d0' module.exports = { methodology: 'Total TVL in all farms and BabyDoge staking pool', + misrepresentedTokens: true, bsc: { - staking: staking(stakingContract, babydogeTokenAddress, chain), + staking: staking(stakingContract, babydogeTokenAddress), tvl: getUniTVL({ - chain: chain, - useDefaultCoreAssets: false, + useDefaultCoreAssets: true, factory: farmFactoryContract, blacklistedTokens: [ '0xe320df552e78d57e95cf1182b6960746d5016561' diff --git a/projects/babyswap/index.js b/projects/babyswap/index.js index 77290fedb9d..d1a6999bda1 100644 --- a/projects/babyswap/index.js +++ b/projects/babyswap/index.js @@ -21,8 +21,8 @@ module.exports = { misrepresentedTokens: true, incentivized: true, bsc: { - tvl: getUniTVL({ factory: '0x86407bEa2078ea5f5EB5A52B2caA963bC1F889Da', chain: 'bsc', useDefaultCoreAssets: true }), - staking: staking(MasterChefContract, BABY, "bsc"), + tvl: getUniTVL({ factory: '0x86407bEa2078ea5f5EB5A52B2caA963bC1F889Da', useDefaultCoreAssets: true }), + staking: staking(MasterChefContract, BABY), } }; diff --git a/projects/baguette/index.js b/projects/baguette/index.js index b596685369b..445197101ff 100644 --- a/projects/baguette/index.js +++ b/projects/baguette/index.js @@ -3,6 +3,6 @@ const { getUniTVL } = require("../helper/unknownTokens") module.exports = { misrepresentedTokens: true, avax:{ - tvl: getUniTVL({ chain: 'avax', useDefaultCoreAssets: true, factory: '0x3587B8c0136c2C3605a9E5B03ab54Da3e4044b50', }), + tvl: getUniTVL({ useDefaultCoreAssets: true, factory: '0x3587B8c0136c2C3605a9E5B03ab54Da3e4044b50', }), }, } \ No newline at end of file diff --git a/projects/bamboodefi/index.js b/projects/bamboodefi/index.js index 8df47dcf193..89c86cad0d6 100644 --- a/projects/bamboodefi/index.js +++ b/projects/bamboodefi/index.js @@ -16,8 +16,6 @@ module.exports = { Object.keys(config).forEach(chain => { const { factory } = config[chain] module.exports[chain] = { - tvl: getUniTVL({ - factory, chain, useDefaultCoreAssets: true, - }) + tvl: getUniTVL({ factory, useDefaultCoreAssets: true, }) } }) diff --git a/projects/barnswap/index.js b/projects/barnswap/index.js index 72a523a1e5a..ad0e957ae47 100644 --- a/projects/barnswap/index.js +++ b/projects/barnswap/index.js @@ -5,7 +5,6 @@ module.exports = { muuchain: { tvl: getUniTVL({ factory: '0x058f3f7857d47326021451b6b67c3e92838a6edc', - chain: 'muuchain', useDefaultCoreAssets: true, }) }, diff --git a/projects/baryon/index.js b/projects/baryon/index.js index b6f1435d2df..326fd473442 100644 --- a/projects/baryon/index.js +++ b/projects/baryon/index.js @@ -4,7 +4,6 @@ module.exports = { bsc: { misrepresentedTokens: true, tvl: getUniTVL({ - chain: 'bsc', factory: '0x03879e2a3944fd601e7638dfcbc9253fb793b599', useDefaultCoreAssets: true, }) diff --git a/projects/based-finance/index.js b/projects/based-finance/index.js index ad339d396b9..565b4f73fc7 100644 --- a/projects/based-finance/index.js +++ b/projects/based-finance/index.js @@ -31,7 +31,7 @@ module.exports = { fantom: { tvl: getUniTVL({ factory: '0x407C47E3FDB7952Ee53aa232B5f28566A024A759', - chain: 'fantom', + useDefaultCoreAssets: true, }), staking: staking(acropolisAddress, bshareTokenAddress, "fantom"), treasury diff --git a/projects/beamswap/index.js b/projects/beamswap/index.js index f95ebffcd9a..3685455e3eb 100644 --- a/projects/beamswap/index.js +++ b/projects/beamswap/index.js @@ -7,7 +7,6 @@ const SHARE_CONTRACT = "0x4204cAd97732282d261FbB7088e07557810A6408" const dexTVL = getUniTVL({ factory: "0x985BcA32293A7A496300a48081947321177a86FD", - chain: "moonbeam", useDefaultCoreAssets: true, }) @@ -17,6 +16,6 @@ module.exports = { "Factory address (0x985BcA32293A7A496300a48081947321177a86FD) is used to find the LP pairs. TVL is equal to the liquidity on the AMM & Staking balance is equal to the amount of GLINT staked within the SHARE token contract(0x4204cAd97732282d261FbB7088e07557810A6408)", moonbeam: { tvl: dexTVL, - staking: staking(SHARE_CONTRACT, GLINT_TOKEN, 'moonbeam') + staking: staking(SHARE_CONTRACT, GLINT_TOKEN) }, }; diff --git a/projects/bearnfi/index.js b/projects/bearnfi/index.js index 1ab8a3cae2b..19af898bbaa 100644 --- a/projects/bearnfi/index.js +++ b/projects/bearnfi/index.js @@ -87,7 +87,6 @@ async function yieldTVL(timestamp, chainBlocks) { const cExports = compoundExports(COMPTROLLER, chain, cBNB, wBNB,) const dexTVL = getUniTVL({ - chain, factory: BDEX_FACTORY, useDefaultCoreAssets: true, }) diff --git a/projects/becoswap/index.js b/projects/becoswap/index.js index ccecce6b8f5..5429048c0ec 100644 --- a/projects/becoswap/index.js +++ b/projects/becoswap/index.js @@ -10,7 +10,6 @@ module.exports = { kardia: { staking: staking(masterChef, becoToken, "kardia"), tvl: getUniTVL({ - chain: 'kardia', useDefaultCoreAssets: true, factory: '0x58b54BCDF2aF8a70dD6433EB39b308148261bB49', }) diff --git a/projects/benswap/index.js b/projects/benswap/index.js index 19568bc9766..5b6900b2274 100644 --- a/projects/benswap/index.js +++ b/projects/benswap/index.js @@ -27,7 +27,7 @@ async function bchMasterChef(timestamp, ethBlock, {[CHAIN]: block}) { } } -const bchDexTvl = getUniTVL({ chain: 'smartbch', factory: FACTORY, useDefaultCoreAssets: true, }) +const bchDexTvl = getUniTVL({ factory: FACTORY, useDefaultCoreAssets: true, }) module.exports = { misrepresentedTokens: true, @@ -38,7 +38,7 @@ module.exports = { staking: stakingPricedLP(MASTERBREEDER, EBEN, "smartbch", EBEN_WBCH_LP, COREASSETNAME), }, bsc: { - tvl: getUniTVL({ factory: '0x4dC6048552e2DC6Eb1f82A783E859157d40FA193', chain: 'bsc', useDefaultCoreAssets: true }), + tvl: getUniTVL({ factory: '0x4dC6048552e2DC6Eb1f82A783E859157d40FA193', useDefaultCoreAssets: true }), staking: stakingPricedLP("0x03245d87295cd0783e1f10a2ea54f9e80b726af8", "0x8173dda13fd405e5bca84bd7f64e58caf4810a32", "bsc", "0x4558e53328cddd5877b7348702c991f521aa35c0", "binancecoin", true), }, } diff --git a/projects/biswap/index.js b/projects/biswap/index.js index 53e6d9591f6..ba24ee6ac93 100644 --- a/projects/biswap/index.js +++ b/projects/biswap/index.js @@ -35,8 +35,8 @@ const stakingPools = [ module.exports = { bsc: { - staking: stakings(stakingPools, BSW, 'bsc'), - tvl: getUniTVL({ chain: 'bsc', factory, }) + staking: stakings(stakingPools, BSW), + tvl: getUniTVL({ factory, useDefaultCoreAssets: true,}) }, hallmarks:[ [1651881600, "UST depeg"], diff --git a/projects/bitgert-swap/index.js b/projects/bitgert-swap/index.js index 38a5556efda..4a5a6de03ac 100644 --- a/projects/bitgert-swap/index.js +++ b/projects/bitgert-swap/index.js @@ -4,7 +4,6 @@ module.exports = { misrepresentedTokens: true, bitgert: { tvl: getUniTVL({ - chain: 'bitgert', factory: '0x456405E3d355ad27010Fd87e3c7cC8a2DcA372fD', useDefaultCoreAssets: true, }), diff --git a/projects/blindex/index.js b/projects/blindex/index.js index 1479887dfdc..72bbfb23f8f 100644 --- a/projects/blindex/index.js +++ b/projects/blindex/index.js @@ -216,7 +216,6 @@ const rsk = async function rskTvl(timestamp, ethBlock, chainblocks) { }; const dexTVL = getUniTVL({ - chain: 'rsk', factory: '0x5Af7cba7CDfE30664ab6E06D8D2210915Ef73c2E', useDefaultCoreAssets: true, }) diff --git a/projects/blockng/index.js b/projects/blockng/index.js index 465a3716130..376ce4cc57c 100644 --- a/projects/blockng/index.js +++ b/projects/blockng/index.js @@ -54,7 +54,6 @@ const LAW_RIGHTS = "0xe24Ed1C92feab3Bb87cE7c97Df030f83E28d9667" // DAO address const lawSwapTVL = getUniTVL({ - chain, factory: lawswapFactory, useDefaultCoreAssets: true, }) diff --git a/projects/bourbon/index.js b/projects/bourbon/index.js index 772903e7f7f..2b2521aa135 100644 --- a/projects/bourbon/index.js +++ b/projects/bourbon/index.js @@ -4,7 +4,6 @@ module.exports = { misrepresentedTokens: true, dogechain: { tvl: getUniTVL({ - chain: 'dogechain', useDefaultCoreAssets: true, factory: '0x6B09Aa7a03d918b08C8924591fc792ce9d80CBb5', }) diff --git a/projects/brightside/index.js b/projects/brightside/index.js index dadb4945728..d2d2d91d7d9 100644 --- a/projects/brightside/index.js +++ b/projects/brightside/index.js @@ -4,7 +4,7 @@ module.exports = { misrepresentedTokens: true, milkomeda_a1: { tvl: getUniTVL({ - factory: '0x65be76efd12e7932bcd99acfefb8d531ec4f7e0d', chain: 'milkomeda_a1', useDefaultCoreAssets: true, + factory: '0x65be76efd12e7932bcd99acfefb8d531ec4f7e0d', useDefaultCoreAssets: true, }) }, }; \ No newline at end of file diff --git a/projects/brise-swap/index.js b/projects/brise-swap/index.js index 2271e4dd50e..3945c1cd3e6 100644 --- a/projects/brise-swap/index.js +++ b/projects/brise-swap/index.js @@ -4,7 +4,6 @@ module.exports = { misrepresentedTokens: true, bitgert: { tvl: getUniTVL({ - chain: 'bitgert', factory: '0x1379a7f0bfc346d48508B4b162c37a4c43dd89dc', useDefaultCoreAssets: true, }), diff --git a/projects/cafeswap/index.js b/projects/cafeswap/index.js index fc6d97fdd97..de587de9d34 100644 --- a/projects/cafeswap/index.js +++ b/projects/cafeswap/index.js @@ -13,7 +13,6 @@ const POLYGON_BREW_ADDRESS = "0xb5106A3277718eCaD2F20aB6b86Ce0Fee7A21F09"; module.exports = { bsc: { tvl: getUniTVL({ - chain: 'bsc', useDefaultCoreAssets: true, factory: BSC_DEX_FACTORY, }), @@ -21,7 +20,6 @@ module.exports = { }, polygon: { tvl: getUniTVL({ - chain: 'polygon', useDefaultCoreAssets: true, factory: POLYGON_DEX_FACTORY, }), diff --git a/projects/cakewwap/index.js b/projects/cakewwap/index.js index 8a1a6caf324..a5cfce11c35 100644 --- a/projects/cakewwap/index.js +++ b/projects/cakewwap/index.js @@ -4,7 +4,6 @@ module.exports = { misrepresentedTokens: true, ethpow: { tvl: getUniTVL({ - chain: 'ethpow', useDefaultCoreAssets: true, factory: '0xe97352E2d3a4F418044a91533a2379dbd11b425d', }) diff --git a/projects/candycity/index.js b/projects/candycity/index.js index 84d1bb70d55..a9c913a1c33 100644 --- a/projects/candycity/index.js +++ b/projects/candycity/index.js @@ -7,7 +7,6 @@ const { getUniTVL } = require('../helper/unknownTokens') const chainTvl = getUniTVL({ factory: '0x84343b84EEd78228CCFB65EAdEe7659F246023bf', - chain: 'cronos', useDefaultCoreAssets: true }) diff --git a/projects/canto-dex/index.js b/projects/canto-dex/index.js index 4e9590eaccf..399ec064586 100644 --- a/projects/canto-dex/index.js +++ b/projects/canto-dex/index.js @@ -6,7 +6,6 @@ module.exports = { misrepresentedTokens: true, canto: { tvl: getUniTVL({ - chain: 'canto', factory: '0xE387067f12561e579C5f7d4294f51867E0c1cFba', useDefaultCoreAssets: true, hasStablePools: true, diff --git a/projects/canto-forte/index.js b/projects/canto-forte/index.js index 4af5016dbdc..c3a3613a3d3 100644 --- a/projects/canto-forte/index.js +++ b/projects/canto-forte/index.js @@ -4,7 +4,6 @@ module.exports = { misrepresentedTokens: true, canto: { tvl: getUniTVL({ - chain: 'canto', factory: '0x759e390D946249c63e0A1d8a810C5A577a591719', useDefaultCoreAssets: true, }) diff --git a/projects/cantoswap/index.js b/projects/cantoswap/index.js index eb82c56658d..f2544d876bb 100644 --- a/projects/cantoswap/index.js +++ b/projects/cantoswap/index.js @@ -4,7 +4,6 @@ module.exports = { misrepresentedTokens: true, canto: { tvl: getUniTVL({ - chain: "canto", factory: "0x6eE19E5e5F1018c26bDa107cB2CCd9dA461A698c", useDefaultCoreAssets: true, }), diff --git a/projects/capitaldex/index.js b/projects/capitaldex/index.js index e4d13173db9..570e9c6f28f 100644 --- a/projects/capitaldex/index.js +++ b/projects/capitaldex/index.js @@ -5,7 +5,7 @@ module.exports = { methodology: "Factory address in Ethereum(0x03407772F5EBFB9B10Df007A2DD6FFf4EdE47B53) and in Curio(0xc36f5180b181f1b949e0ff4d65b258e0987f443f) is used to find the LP pairs. TVL is equal to the liquidity on the AMM.", ethereum: { - tvl: getUniTVL({ factory: '0x03407772F5EBFB9B10Df007A2DD6FFf4EdE47B53', chain: 'ethereum' }), + tvl: getUniTVL({ factory: '0x03407772F5EBFB9B10Df007A2DD6FFf4EdE47B53', useDefaultCoreAssets: true }), }, curio: { // tvl: getUniTVL({ factory: '0xc36f5180b181f1b949e0ff4d65b258e0987f443f', chain: 'curio', useDefaultCoreAssets: true }), diff --git a/projects/capricorn/index.js b/projects/capricorn/index.js index 604f4b86473..c74813e23b0 100644 --- a/projects/capricorn/index.js +++ b/projects/capricorn/index.js @@ -4,7 +4,6 @@ module.exports = { misrepresentedTokens: true, cube: { tvl: getUniTVL({ - chain: 'cube', useDefaultCoreAssets: true, factory: '0x33CB4150f3ADFCD92fbFA3309823A2a242bF280f', }) diff --git a/projects/carbonswap/index.js b/projects/carbonswap/index.js index b1be7bdd5c8..418659b0a1a 100644 --- a/projects/carbonswap/index.js +++ b/projects/carbonswap/index.js @@ -1,12 +1,10 @@ const { getUniTVL } = require('../helper/unknownTokens') module.exports = { - timetravel: true, misrepresentedTokens: true, methodology: "Factory address (0x17854c8d5a41d5A89B275386E24B2F38FD0AfbDd) is used to find the LP pairs. TVL is equal to the liquidity on the AMM.", energyweb: { tvl: getUniTVL({ - chain: 'energyweb', factory: '0x17854c8d5a41d5A89B275386E24B2F38FD0AfbDd', useDefaultCoreAssets: true, }) diff --git a/projects/casinocronos/index.js b/projects/casinocronos/index.js index 00aae14732d..4c57fc6c777 100644 --- a/projects/casinocronos/index.js +++ b/projects/casinocronos/index.js @@ -6,7 +6,6 @@ module.exports={ methodology: "Factory address (0x570aA1E0aa3d679Bc9DaAA47564ed3Daba1208FE) is used to find the LP pairs. TVL is equal to the liquidity on the AMM, while staking is the amount of CASINO tokens found in the Masterchef(0x81b5118bF8A720B19FEC6F3078d2b555790cb0AB).", cronos: { tvl: getUniTVL({ - chain: 'cronos', factory: '0x570aA1E0aa3d679Bc9DaAA47564ed3Daba1208FE', useDefaultCoreAssets: true, diff --git a/projects/champagne-swap.js b/projects/champagne-swap.js index 52d7b98dcd5..9a77c91ec29 100644 --- a/projects/champagne-swap.js +++ b/projects/champagne-swap.js @@ -11,6 +11,6 @@ module.exports = { methodology: 'TVL accounts for the liquidity on all AMM pools, using the TVL chart on https://champagne.finance/ as the source. Staking accounts for the CHAM locked in MasterChef (0x15C17442eb2Cd3a56139e877ec7784b2dbD97270)', bsc: { staking: staking(masterChef, champagneToken, 'bsc'), - tvl: getUniTVL({ chain: 'bsc', useDefaultCoreAssets: true, factory, }) + tvl: getUniTVL({ useDefaultCoreAssets: true, factory, }) }, } diff --git a/projects/cherryswap/index.js b/projects/cherryswap/index.js index bb0dfa4567c..be6b15d9b5a 100644 --- a/projects/cherryswap/index.js +++ b/projects/cherryswap/index.js @@ -11,7 +11,6 @@ module.exports = { staking: staking(cheStaking, che, "okexchain", "okexchain:" + che), tvl: getUniTVL({ factory: '0x709102921812b3276a65092fe79edfc76c4d4afe', - chain: 'okexchain', useDefaultCoreAssets: true, }) }, diff --git a/projects/coinswap/index.js b/projects/coinswap/index.js index e3985899c01..81d8c7719ba 100644 --- a/projects/coinswap/index.js +++ b/projects/coinswap/index.js @@ -7,7 +7,6 @@ module.exports = { methodology: 'TVL counts the liquidity of the DEX. The factory address(0xC2D8d27F3196D9989aBf366230a47384010440c0) is used to find every LP pair that has been created.', bsc: { tvl: getUniTVL({ - chain: 'bsc', factory, useDefaultCoreAssets: true, }), diff --git a/projects/convergence/index.js b/projects/convergence/index.js index ee0b65a19e6..41a945345b3 100644 --- a/projects/convergence/index.js +++ b/projects/convergence/index.js @@ -16,7 +16,6 @@ module.exports = { tvl: getUniTVL({ factory: MOONBEAM_FACTORY, useDefaultCoreAssets: true, - chain: 'moonbeam', }) } }; \ No newline at end of file diff --git a/projects/coreswap/index.js b/projects/coreswap/index.js index d39dcfe7830..6ab1aec4343 100644 --- a/projects/coreswap/index.js +++ b/projects/coreswap/index.js @@ -4,7 +4,6 @@ module.exports = { misrepresentedTokens: true, core: { tvl: getUniTVL({ - chain: 'core', useDefaultCoreAssets: true, factory: '0x97814a1F542aFe7fd02de53926621b0D40e8Ad6C', }) diff --git a/projects/corgiswap.js b/projects/corgiswap.js index 41b8fe4cfb2..059f6df9696 100644 --- a/projects/corgiswap.js +++ b/projects/corgiswap.js @@ -9,7 +9,7 @@ module.exports = { misrepresentedTokens: true, methodology: 'TVL accounts for the liquidity on all AMM pools, using the TVL chart on https://corgiswap.info/ as the source. Staking accounts for the CORIS locked in MasterChef (0x60E5Cf9111d046E8F986fC98e37d6703607d5Baf)', bsc: { - tvl: getUniTVL({ factory, chain: 'bsc', useDefaultCoreAssets: true, }), + tvl: getUniTVL({ factory, useDefaultCoreAssets: true, }), staking: stakingPricedLP(masterChef, corisToken, "bsc", "0x1881bd6aba086da0c5cfed7247f216dea50e38ed", "wbnb", true) }, } diff --git a/projects/cronaswap/index.js b/projects/cronaswap/index.js index 6629b55b9bb..bd16746ac99 100644 --- a/projects/cronaswap/index.js +++ b/projects/cronaswap/index.js @@ -6,7 +6,6 @@ module.exports={ methodology: "Factory address (0x73A48f8f521EB31c55c0e1274dB0898dE599Cb11) is used to find the LP pairs. TVL is equal to the liquidity on the AMM, while staking is the amount of CRONA tokens found in the Masterchef(0x77ea4a4cF9F77A034E4291E8f457Af7772c2B254).", cronos: { tvl: getUniTVL({ - chain: 'cronos', factory: '0x73A48f8f521EB31c55c0e1274dB0898dE599Cb11', useDefaultCoreAssets: true, blacklist: [ diff --git a/projects/daomaker-swap/index.js b/projects/daomaker-swap/index.js index da9b24c4a92..74c23d97f8b 100644 --- a/projects/daomaker-swap/index.js +++ b/projects/daomaker-swap/index.js @@ -4,7 +4,7 @@ module.exports = { misrepresentedTokens: false, bsc: { tvl: getUniTVL({ - factory: '0x940BEb635cbEeC04720AC97FADb97205676e6aa4', chain: 'bsc', useDefaultCoreAssets: false, + factory: '0x940BEb635cbEeC04720AC97FADb97205676e6aa4', useDefaultCoreAssets: false, }) }, }; \ No newline at end of file diff --git a/projects/dddx.js b/projects/dddx.js index 12c998336c4..f85ce36e7ed 100644 --- a/projects/dddx.js +++ b/projects/dddx.js @@ -7,7 +7,7 @@ module.exports = { timetravel: true, incentivized: true, bsc: { - tvl: getUniTVL({ factory: '0xb5737A06c330c22056C77a4205D16fFD1436c81b', chain: 'bsc', useDefaultCoreAssets: true }), + tvl: getUniTVL({ factory: '0xb5737A06c330c22056C77a4205D16fFD1436c81b', useDefaultCoreAssets: true }), staking: stakings( [ '0x488f0252B4bEa5A851FE9C827894d08868D552C0', diff --git a/projects/defi-swap/index.js b/projects/defi-swap/index.js index 270c1eaeeb7..e2b4294eb8c 100644 --- a/projects/defi-swap/index.js +++ b/projects/defi-swap/index.js @@ -1,8 +1,9 @@ const { getUniTVL } = require('../helper/unknownTokens') module.exports = { + misrepresentedTokens: true, start: 1599523200, // Tuesday, 8 September 2020 00:00:00 ethereum: { - tvl: getUniTVL({ factory: '0x9DEB29c9a4c7A88a3C0257393b7f3335338D9A9D'}) + tvl: getUniTVL({ factory: '0x9DEB29c9a4c7A88a3C0257393b7f3335338D9A9D', useDefaultCoreAssets: true }), }, } diff --git a/projects/dfyn/index.js b/projects/dfyn/index.js index e6f26845228..55f632af215 100644 --- a/projects/dfyn/index.js +++ b/projects/dfyn/index.js @@ -3,7 +3,6 @@ const { getUniTVL } = require('../helper/unknownTokens') module.exports = { polygon:{ tvl: getUniTVL({ - chain: 'polygon', factory: '0xE7Fb3e833eFE5F9c441105EB65Ef8b261266423B', useDefaultCoreAssets: true, }), @@ -11,14 +10,12 @@ module.exports = { okexchain:{ tvl: getUniTVL({ factory: '0xE7Fb3e833eFE5F9c441105EB65Ef8b261266423B', - chain: 'okexchain', useDefaultCoreAssets: true, }), }, fantom:{ tvl: getUniTVL({ factory: '0xd9820a17053d6314B20642E465a84Bf01a3D64f5', - chain: 'fantom', useDefaultCoreAssets: true, }), }, diff --git a/projects/dmusk/index.js b/projects/dmusk/index.js index 8fe45804c52..9ba6b50815b 100644 --- a/projects/dmusk/index.js +++ b/projects/dmusk/index.js @@ -9,7 +9,6 @@ module.exports = { misrepresentedTokens: true, dogechain: { tvl: getUniTVL({ - chain, factory: '0x4e5E0739231A3BdE1c51188aCfEabC19983541E6', useDefaultCoreAssets: true, }) diff --git a/projects/dogmoney/index.js b/projects/dogmoney/index.js index c973d58bbf4..77455c0901b 100644 --- a/projects/dogmoney/index.js +++ b/projects/dogmoney/index.js @@ -8,10 +8,9 @@ module.exports = { misrepresentedTokens: true, dogechain: { tvl: getUniTVL({ - chain: 'dogechain', useDefaultCoreAssets: true, factory: FACTORY, }), - staking: staking({ owner: xDOGMONEY, tokens: [ DOGMONEY ], chain: 'dogechain', lps: ['0x9ab710cd0bfbee60e14115d19c76213c4d4b1687'], useDefaultCoreAssets: true, }) + staking: staking({ owner: xDOGMONEY, tokens: [ DOGMONEY ], lps: ['0x9ab710cd0bfbee60e14115d19c76213c4d4b1687'], useDefaultCoreAssets: true, }) } } \ No newline at end of file diff --git a/projects/dooar/index.js b/projects/dooar/index.js index 2f689e51b67..d2837739a8f 100644 --- a/projects/dooar/index.js +++ b/projects/dooar/index.js @@ -6,7 +6,6 @@ module.exports = { bsc: { tvl: getUniTVL({ factory: '0x1e895bFe59E3A5103e8B7dA3897d1F2391476f3c', - chain: 'bsc', useDefaultCoreAssets: true }) }, diff --git a/projects/duneswap.js b/projects/duneswap.js index 39c52886276..7888adc96fe 100644 --- a/projects/duneswap.js +++ b/projects/duneswap.js @@ -1,6 +1,6 @@ const { getUniTVL } = require('./helper/unknownTokens') module.exports = { oasis: { - tvl: getUniTVL({ factory: '0x9dd422B52618f4eDD13E08c840f2b6835F3C0585', chain: 'oasis', useDefaultCoreAssets: true }), + tvl: getUniTVL({ factory: '0x9dd422B52618f4eDD13E08c840f2b6835F3C0585', useDefaultCoreAssets: true }), } } \ No newline at end of file diff --git a/projects/elephantdex/index.js b/projects/elephantdex/index.js index 77faf4e2970..f997d4c2c6f 100644 --- a/projects/elephantdex/index.js +++ b/projects/elephantdex/index.js @@ -3,7 +3,6 @@ const { getUniTVL } = require("../helper/unknownTokens"); module.exports = { harmony: { tvl: getUniTVL({ - chain: 'harmony', useDefaultCoreAssets: true, factory: '0x0Dea90EC11032615E027664D2708BC292Bbd976B', }) diff --git a/projects/empiredex/index.js b/projects/empiredex/index.js index 16ca3f3832f..26b6e2254eb 100644 --- a/projects/empiredex/index.js +++ b/projects/empiredex/index.js @@ -3,36 +3,32 @@ const { getUniTVL } = require("../helper/unknownTokens") module.exports = { misrepresentedTokens: true, bsc: { - tvl: getUniTVL({ chain: 'bsc', factory: '0x06530550A48F990360DFD642d2132354A144F31d', useDefaultCoreAssets: true, }), + tvl: getUniTVL({ factory: '0x06530550A48F990360DFD642d2132354A144F31d', useDefaultCoreAssets: true, }), }, cronos: { - tvl: getUniTVL({ chain: 'cronos', factory: '0x06530550A48F990360DFD642d2132354A144F31d', useDefaultCoreAssets: true, }), + tvl: getUniTVL({ factory: '0x06530550A48F990360DFD642d2132354A144F31d', useDefaultCoreAssets: true, }), }, xdai: { - tvl: getUniTVL({ chain: 'xdai', factory: '0x06530550A48F990360DFD642d2132354A144F31d', useDefaultCoreAssets: true, }), + tvl: getUniTVL({ factory: '0x06530550A48F990360DFD642d2132354A144F31d', useDefaultCoreAssets: true, }), }, polygon: { - tvl: getUniTVL({ chain: 'polygon', factory: '0x06530550A48F990360DFD642d2132354A144F31d', useDefaultCoreAssets: true, }), + tvl: getUniTVL({ factory: '0x06530550A48F990360DFD642d2132354A144F31d', useDefaultCoreAssets: true, }), }, fantom: { - tvl: getUniTVL({ chain: 'fantom', factory: '0x06530550A48F990360DFD642d2132354A144F31d', useDefaultCoreAssets: true, }), + tvl: getUniTVL({ factory: '0x06530550A48F990360DFD642d2132354A144F31d', useDefaultCoreAssets: true, }), }, avax: { - tvl: getUniTVL({ chain: 'avax', factory: '0x06530550A48F990360DFD642d2132354A144F31d', useDefaultCoreAssets: true, }), + tvl: getUniTVL({ factory: '0x06530550A48F990360DFD642d2132354A144F31d', useDefaultCoreAssets: true, }), }, ethereum: { - tvl: getUniTVL({ chain: 'ethereum', factory: '0xd674b01E778CF43D3E6544985F893355F46A74A5', useDefaultCoreAssets: true, }), + tvl: getUniTVL({ factory: '0xd674b01E778CF43D3E6544985F893355F46A74A5', useDefaultCoreAssets: true, }), }, kava: { - tvl: getUniTVL({ - factory: '0x06530550A48F990360DFD642d2132354A144F31d', - chain: 'kava', - useDefaultCoreAssets: true, - }), + tvl: getUniTVL({ factory: '0x06530550A48F990360DFD642d2132354A144F31d', useDefaultCoreAssets: true, }), }, empire: { - tvl: getUniTVL({ chain: 'empire', factory: '0x06530550A48F990360DFD642d2132354A144F31d', useDefaultCoreAssets: true, }), + tvl: getUniTVL({ factory: '0x06530550A48F990360DFD642d2132354A144F31d', useDefaultCoreAssets: true, }), }, - + methodology: "Factory address(0x06530550A48F990360DFD642d2132354A144F31d) is used to find the LP pairs. TVL is equal to the liquidity on the AMM.", }; diff --git a/projects/energiswap.js b/projects/energiswap.js index 5af3e7c9e6f..9015e4e6c96 100644 --- a/projects/energiswap.js +++ b/projects/energiswap.js @@ -3,7 +3,6 @@ const { getUniTVL } = require('./helper/unknownTokens') module.exports = { energi: { tvl: getUniTVL({ - chain: 'energi', factory: '0x875aDBaF8109c9CC9AbCC708a42607F573f594E4', useDefaultCoreAssets: true, }), diff --git a/projects/energyfi/index.js b/projects/energyfi/index.js index 0771cf78c63..c72ae4e3793 100644 --- a/projects/energyfi/index.js +++ b/projects/energyfi/index.js @@ -4,7 +4,6 @@ module.exports = { misrepresentedTokens: true, moonbeam: { tvl: getUniTVL({ - chain: 'moonbeam', useDefaultCoreAssets: true, factory: '0x7c7EaEa389d958BB37a3fd08706Ca884D53Dc1F3', }) diff --git a/projects/etcswap/index.js b/projects/etcswap/index.js index 1d70984a77b..74dce7673e0 100644 --- a/projects/etcswap/index.js +++ b/projects/etcswap/index.js @@ -5,7 +5,6 @@ module.exports = { "Factory address (0x0307cd3d7da98a29e6ed0d2137be386ec1e4bc9c) is used to find the LP pairs. TVL is equal to the liquidity on the AMM.", ethereumclassic: { tvl: getUniTVL({ - chain: 'ethereumclassic', factory: '0x0307cd3d7da98a29e6ed0d2137be386ec1e4bc9c', useDefaultCoreAssets: true, }) diff --git a/projects/farmersonly/index.js b/projects/farmersonly/index.js index 80939400c8a..1d2c0420c42 100644 --- a/projects/farmersonly/index.js +++ b/projects/farmersonly/index.js @@ -11,7 +11,6 @@ const vaultChef = '0x2914646e782cc36297c6639734892927b3b6fe56' const chain = 'harmony' const dexTVL = getUniTVL({ - chain: 'harmony', factory: '0xfa53b963a39621126bf45f647f813952cd3c5c66', useDefaultCoreAssets: true, }) diff --git a/projects/fatex/index.js b/projects/fatex/index.js index d26064b626a..6408047a842 100644 --- a/projects/fatex/index.js +++ b/projects/fatex/index.js @@ -11,7 +11,6 @@ module.exports = { polygon: { tvl: getUniTVL({ factory: FACTORY_CONTRACT, - chain: 'polygon', useDefaultCoreAssets: true, }), staking: stakingUnknownPricedLP(X_FATE_TOKEN, FATE_TOKEN, 'polygon', FATE_USDC_PAIR_TOKEN) diff --git a/projects/foodcourt/index.js b/projects/foodcourt/index.js index 2f967780ff2..ef20f699f04 100644 --- a/projects/foodcourt/index.js +++ b/projects/foodcourt/index.js @@ -6,14 +6,12 @@ module.exports = { misrepresentedTokens: true, bsc: { tvl: getUniTVL({ - chain: 'bsc', factory: '0xc801C7980c8C7900Bc898B1F38392b235fF64097', useDefaultCoreAssets: true, }), }, reichain: { tvl: getUniTVL({ - chain: 'reichain', factory: '0xC437190E5c4F85EbBdE74c86472900b323447603', useDefaultCoreAssets: true, }), diff --git a/projects/fstswap/index.js b/projects/fstswap/index.js index 629e3bfb298..2923ab98af8 100644 --- a/projects/fstswap/index.js +++ b/projects/fstswap/index.js @@ -5,7 +5,6 @@ module.exports = { bsc: { tvl: getUniTVL({ factory: '0x9A272d734c5a0d7d84E0a892e891a553e8066dce', - chain: 'bsc', useDefaultCoreAssets: true }) }, diff --git a/projects/fusefi/swap.js b/projects/fusefi/swap.js index 28e7fde6cd2..f86527ed8f3 100644 --- a/projects/fusefi/swap.js +++ b/projects/fusefi/swap.js @@ -3,7 +3,6 @@ const { getUniTVL } = require('../helper/unknownTokens'); module.exports = { tvl: getUniTVL({ factory: '0x1998E4b0F1F922367d8Ec20600ea2b86df55f34E', - chain: 'fuse', useDefaultCoreAssets: true, }) } diff --git a/projects/fusion/index.js b/projects/fusion/index.js index 1b1b8b34d97..5224723c116 100644 --- a/projects/fusion/index.js +++ b/projects/fusion/index.js @@ -49,7 +49,6 @@ const dexTVL = { nova: { tvl: getUniTVL({ factory: dexFactory, - chain: "nova", useDefaultCoreAssets: true, }), }, @@ -58,7 +57,6 @@ const dexTVL = { fantom: { tvl: getUniTVL({ factory: dexFactory, - chain: "fantom", useDefaultCoreAssets: true, }), }, @@ -67,7 +65,6 @@ const dexTVL = { ethereumclassic: { tvl: getUniTVL({ factory: dexFactoryClassic, - chain: "ethereumclassic", useDefaultCoreAssets: true, }), }, diff --git a/projects/fxswap/index.js b/projects/fxswap/index.js index f3627936308..c0b9732830e 100644 --- a/projects/fxswap/index.js +++ b/projects/fxswap/index.js @@ -4,7 +4,7 @@ module.exports = { misrepresentedTokens: true, functionx: { tvl: getUniTVL({ - factory: '0x9E229BE3812228454499FAf771b296bedFe8c904', chain: 'functionx', useDefaultCoreAssets: true, + factory: '0x9E229BE3812228454499FAf771b296bedFe8c904', useDefaultCoreAssets: true, }) }, }; diff --git a/projects/gemkeeper.js b/projects/gemkeeper.js index a6718b8ce71..2e5f1b7d9fb 100644 --- a/projects/gemkeeper.js +++ b/projects/gemkeeper.js @@ -5,7 +5,7 @@ const BlingAddr = "0x72Ad551af3c884d02e864B182aD9A34EE414C36C" const wRoseBlingLP = "0xb29553faf847ba5b79b6ae13fa82d0b216faf626" module.exports = { oasis: { - tvl: getUniTVL({ factory: '0xa7200334f652425A12BF2f7e4F0F5409CCA4d963', chain: 'oasis', useDefaultCoreAssets: true }), + tvl: getUniTVL({ factory: '0xa7200334f652425A12BF2f7e4F0F5409CCA4d963', useDefaultCoreAssets: true }), staking: stakingPricedLP(xBlingContract,BlingAddr,"oasis",wRoseBlingLP,"oasis-network") } }; \ No newline at end of file diff --git a/projects/gemswap/index.js b/projects/gemswap/index.js index a39bc076fff..49c8d251942 100644 --- a/projects/gemswap/index.js +++ b/projects/gemswap/index.js @@ -8,7 +8,6 @@ module.exports = { era: { tvl: getUniTVL({ factory: '0x065c8703132F2A38Be3d2dbF7Be6BE455930560c', - chain: 'era', useDefaultCoreAssets: true, }) }, diff --git a/projects/ginfinance.js b/projects/ginfinance.js index 48bdf9fa08f..c4e66281af7 100644 --- a/projects/ginfinance.js +++ b/projects/ginfinance.js @@ -1,6 +1,6 @@ const { getUniTVL } = require('./helper/unknownTokens') module.exports = { boba: { - tvl: getUniTVL({ factory: '0x06350499760aa3ea20FEd2837321a84a92417f39', chain: 'boba', useDefaultCoreAssets: true }), + tvl: getUniTVL({ factory: '0x06350499760aa3ea20FEd2837321a84a92417f39', useDefaultCoreAssets: true }), } }; \ No newline at end of file diff --git a/projects/gravis-finance/index.js b/projects/gravis-finance/index.js index 19b4088601c..777f2204735 100644 --- a/projects/gravis-finance/index.js +++ b/projects/gravis-finance/index.js @@ -4,23 +4,20 @@ module.exports = { misrepresentedTokens: true, bsc: { tvl: getUniTVL({ - chain: 'bsc', factory: '0x4a3b76860c1b76f0403025485de7bfa1f08c48fd', useDefaultCoreAssets: true, }), }, polygon: { - tvl: getUniTVL({ - chain: 'polygon', - factory: '0x17c1d25d5a2d833c266639de5fbe8896bdbeb234', - useDefaultCoreAssets: true, - }), + tvl: getUniTVL({ + factory: '0x17c1d25d5a2d833c266639de5fbe8896bdbeb234', + useDefaultCoreAssets: true, + }), + }, + heco: { + tvl: getUniTVL({ + factory: '0x4a3B76860C1b76f0403025485DE7bfa1F08C48fD', + useDefaultCoreAssets: true, + }), }, -heco: { -tvl: getUniTVL({ -chain: 'heco', -factory: '0x4a3B76860C1b76f0403025485DE7bfa1F08C48fD', -useDefaultCoreAssets: true, -}), -}, }; \ No newline at end of file diff --git a/projects/gxypad/index.js b/projects/gxypad/index.js index 1db6294ef88..64cf72344b3 100644 --- a/projects/gxypad/index.js +++ b/projects/gxypad/index.js @@ -5,7 +5,6 @@ module.exports = { era: { tvl: getUniTVL({ factory: '0xdCBA2077FE5261753AB29Cc886Bd5CFe1786a7D6', - chain: 'era', useDefaultCoreAssets: true, }) }, diff --git a/projects/hermes/index.js b/projects/hermes/index.js index 1850dde22b0..c76c3ad21a8 100644 --- a/projects/hermes/index.js +++ b/projects/hermes/index.js @@ -9,13 +9,11 @@ module.exports = { harmony: { tvl: getUniTVL({ factory: '0xfe5e54a8e28534fffe89b9cfddfd18d3a90b42ca', - chain: 'harmony', useDefaultCoreAssets: true, }), staking: staking({ owners: ['0x28a4e128f823b1b3168f82f64ea768569a25a37f', '0x8812420fb6e5d971c969ccef2275210ab8d014f0'], tokens: ['0xba4476a302f5bc1dc4053cf79106dc43455904a3'], - chain: 'harmony', useDefaultCoreAssets: true, lps: ['0x8604197eb7123888b551fe78a8828b895608d093'], }), diff --git a/projects/hippowswap/index.js b/projects/hippowswap/index.js index cd4a8637973..b05c5fd65da 100644 --- a/projects/hippowswap/index.js +++ b/projects/hippowswap/index.js @@ -4,7 +4,6 @@ module.exports = { misrepresentedTokens: true, ethpow: { tvl: getUniTVL({ - chain: 'ethpow', useDefaultCoreAssets: true, factory: '0x8cF9A887e53be909C221A2708E72898546dAB7Cc', }) diff --git a/projects/honeyswap/index.js b/projects/honeyswap/index.js index e1d8500a758..5d94a36f0cb 100644 --- a/projects/honeyswap/index.js +++ b/projects/honeyswap/index.js @@ -4,7 +4,6 @@ module.exports = { misrepresentedTokens: true, xdai: { tvl: getUniTVL({ - chain: 'xdai', factory: '0xa818b4f111ccac7aa31d0bcc0806d64f2e0737d7', useDefaultCoreAssets: true, blacklist: [ @@ -20,7 +19,6 @@ module.exports = { }, polygon: { tvl: getUniTVL({ - chain: 'polygon', factory: '0x03daa61d8007443a6584e3d8f85105096543c19c', useDefaultCoreAssets: true, blacklist: ['0x8db0a6d1b06950b4e81c4f67d1289fc7b9359c7f'] diff --git a/projects/hopswap/index.js b/projects/hopswap/index.js index 67d318847bf..076eaf43384 100644 --- a/projects/hopswap/index.js +++ b/projects/hopswap/index.js @@ -5,7 +5,6 @@ module.exports = { cronos: { tvl: getUniTVL({ factory: '0x918cefF586C00c1fa4726Dc50697172fd87df8e9', - chain: 'cronos', useDefaultCoreAssets: true }) }, diff --git a/projects/hpdex/index.js b/projects/hpdex/index.js index 0d693c961da..2a4b8f45495 100644 --- a/projects/hpdex/index.js +++ b/projects/hpdex/index.js @@ -6,7 +6,6 @@ module.exports = { hpb: { tvl: getUniTVL({ factory: "0xE1d563BcFD4E2a5A9ce355CC8631421186521aAA", - chain: "hpb", useDefaultCoreAssets: true, }) } diff --git a/projects/huckleberry/index.js b/projects/huckleberry/index.js index 7fa6b864fe8..60367430d57 100644 --- a/projects/huckleberry/index.js +++ b/projects/huckleberry/index.js @@ -3,7 +3,6 @@ const { getUniTVL } = require('../helper/unknownTokens') const dexTVL = getUniTVL({ factory: '0x017603C8f29F7f6394737628a93c57ffBA1b7256', - chain: 'moonriver', useDefaultCoreAssets: true, }) @@ -15,6 +14,6 @@ module.exports = { tvl: dexTVL, }, clv: { - tvl: getUniTVL({ factory: '0x4531e148b55d89212E219F612A459fC65f657d7d', chain: 'clv', useDefaultCoreAssets: true }), + tvl: getUniTVL({ factory: '0x4531e148b55d89212E219F612A459fC65f657d7d', useDefaultCoreAssets: true }), }, } \ No newline at end of file diff --git a/projects/hurricaneswap.js b/projects/hurricaneswap.js index d89b0791891..690b4af6666 100644 --- a/projects/hurricaneswap.js +++ b/projects/hurricaneswap.js @@ -13,7 +13,6 @@ const stakingConttract_shctBar = "0xE4aE2E8648B8E84c4A487a559b04e884B822a350"; const HCT = "0x45C13620B55C35A5f539d26E88247011Eb10fDbd"; const chainTvl = getUniTVL({ - chain: 'avax', factory: '0x7009b3619d5ee60d0665BA27Cf85eDF95fd8Ad01', useDefaultCoreAssets: true, }) diff --git a/projects/hyperjump/index.js b/projects/hyperjump/index.js index 55e24e810d6..04222bb0f83 100644 --- a/projects/hyperjump/index.js +++ b/projects/hyperjump/index.js @@ -11,21 +11,18 @@ module.exports = { bsc: { tvl: getUniTVL({ factory: FACTORY.bsc, - chain: 'bsc', useDefaultCoreAssets: true, }), }, fantom: { tvl: getUniTVL({ factory: FACTORY.fantom, - chain: 'fantom', useDefaultCoreAssets: true, }), }, metis: { tvl: getUniTVL({ factory: FACTORY.metis, - chain: 'metis', useDefaultCoreAssets: true, }), }, diff --git a/projects/inuswap/index.js b/projects/inuswap/index.js index 0d551754788..1cb8565c425 100644 --- a/projects/inuswap/index.js +++ b/projects/inuswap/index.js @@ -10,7 +10,6 @@ module.exports = { ], dogechain: { tvl: getUniTVL({ - chain, useDefaultCoreAssets: true, factory: '0xbDe460e12B5dcD955e70da8889754958113E988a', }), diff --git a/projects/jswap-finance/index.js b/projects/jswap-finance/index.js index c91b1038915..bce3153e227 100644 --- a/projects/jswap-finance/index.js +++ b/projects/jswap-finance/index.js @@ -7,7 +7,6 @@ module.exports = { okexchain: { tvl: getUniTVL({ factory, - chain: 'okexchain', useDefaultCoreAssets: true, }) }, diff --git a/projects/juggler-red/index.js b/projects/juggler-red/index.js index 317d2cf772a..036a004c3f7 100644 --- a/projects/juggler-red/index.js +++ b/projects/juggler-red/index.js @@ -4,7 +4,6 @@ module.exports = { misrepresentedTokens: true, optimism: { tvl: getUniTVL({ - chain: 'optimism', useDefaultCoreAssets: true, factory: '0x0bef94f16ce5b7c83b0bdbd9924cf80239ba9837', }), diff --git a/projects/julswap/index.js b/projects/julswap/index.js index 846ef55844c..d088f68b082 100644 --- a/projects/julswap/index.js +++ b/projects/julswap/index.js @@ -4,7 +4,6 @@ module.exports = { misrepresentedTokens: true, bsc: { tvl: getUniTVL({ - chain: 'bsc', useDefaultCoreAssets: true, factory: '0x553990F2CBA90272390f62C5BDb1681fFc899675', }) diff --git a/projects/jupiterswap/index.js b/projects/jupiterswap/index.js index ae008a54045..6c8dd3b9a59 100644 --- a/projects/jupiterswap/index.js +++ b/projects/jupiterswap/index.js @@ -9,7 +9,6 @@ module.exports = { kava: { tvl: getUniTVL({ factory: '0xc08BAEA14C14f25bcafe3e3E05550715505eF3dE', - chain: 'kava', useDefaultCoreAssets: true, }), } diff --git a/projects/kaidex/index.js b/projects/kaidex/index.js index b90de3f175c..9ed941fe566 100644 --- a/projects/kaidex/index.js +++ b/projects/kaidex/index.js @@ -10,7 +10,6 @@ module.exports = { methodology: 'TVL accounts for the liquidity on all AMM pools, using the TVL chart on https://becoswap.com/info as the source. Staking accounts for the BECO locked in MasterChef (0x20e8Ff1e1d9BC429489dA76B1Fc20A9BFbF3ee7e)', kardia: { tvl: sdk.util.sumChainTvls(factories.map(factory => getUniTVL({ - chain: 'kardia', useDefaultCoreAssets: true, factory, }))) diff --git a/projects/kasavadex/index.js b/projects/kasavadex/index.js index 0300bb05d94..9679c4859ce 100644 --- a/projects/kasavadex/index.js +++ b/projects/kasavadex/index.js @@ -9,7 +9,6 @@ module.exports = { kava: { tvl: getUniTVL({ factory: '0x8F1fD6Ed57B0806FF114135F5b50B5f76e9542F2', - chain: 'kava', useDefaultCoreAssets: true, }), } diff --git a/projects/katana-ronin.js b/projects/katana-ronin.js index 4cda0f4cdeb..2b348925b83 100644 --- a/projects/katana-ronin.js +++ b/projects/katana-ronin.js @@ -1,7 +1,7 @@ const { getUniTVL } = require('./helper/unknownTokens'); module.exports = { - ronin: { tvl: getUniTVL({ chain: 'ronin', useDefaultCoreAssets: true, factory: '0xb255d6a720bb7c39fee173ce22113397119cb930', }) }, + ronin: { tvl: getUniTVL({ useDefaultCoreAssets: true, factory: '0xb255d6a720bb7c39fee173ce22113397119cb930', }) }, hallmarks:[ [1653744720, "Ronin Bridge Hack $625m"], ], diff --git a/projects/kdex/index.js b/projects/kdex/index.js index c541b9d5899..6a0c7ef5d14 100644 --- a/projects/kdex/index.js +++ b/projects/kdex/index.js @@ -6,7 +6,6 @@ module.exports = { kava: { tvl: getUniTVL({ factory: '0x9a6d197e85e61c23146F5b7FA55fc8a6EDDD2D57', - chain: 'kava', useDefaultCoreAssets: true, }), } diff --git a/projects/kefirswap/index.js b/projects/kefirswap/index.js index b2d98d9fae9..a459ae97e6b 100644 --- a/projects/kefirswap/index.js +++ b/projects/kefirswap/index.js @@ -13,7 +13,6 @@ module.exports = { misrepresentedTokens: true, kava: { tvl: getUniTVL({ - chain: 'kava', factory: FACTORY, useDefaultCoreAssets: true, }), diff --git a/projects/kokomoswap/index.js b/projects/kokomoswap/index.js index 6fa47f43828..3bad2fefb2b 100644 --- a/projects/kokomoswap/index.js +++ b/projects/kokomoswap/index.js @@ -5,7 +5,6 @@ const FACTORY = "0x971A5f6Ef792bA565cdF61C904982419AA77989f"; module.exports = { bsc: { tvl: getUniTVL({ - chain: 'bsc', useDefaultCoreAssets: true, factory: FACTORY, }), diff --git a/projects/kokoswap/index.js b/projects/kokoswap/index.js index 3cd4e88ac76..d96661b992d 100644 --- a/projects/kokoswap/index.js +++ b/projects/kokoswap/index.js @@ -5,7 +5,6 @@ module.exports = { misrepresentedTokens: true, bsc: { tvl: getUniTVL({ - chain: 'bsc', useDefaultCoreAssets: true, factory: FACTORY, }), diff --git a/projects/kuswap/index.js b/projects/kuswap/index.js index bb4c5948beb..a3cfcbb6ff4 100644 --- a/projects/kuswap/index.js +++ b/projects/kuswap/index.js @@ -4,7 +4,6 @@ module.exports = { misrepresentedTokens: true, kcc: { tvl: getUniTVL({ - chain: 'kcc', factory: '0xAE46cBBCDFBa3bE0F02F463Ec5486eBB4e2e65Ae', useDefaultCoreAssets: true, }), diff --git a/projects/kyotoswap/index.js b/projects/kyotoswap/index.js index 81edbb1b1e4..9c44e416fae 100644 --- a/projects/kyotoswap/index.js +++ b/projects/kyotoswap/index.js @@ -14,7 +14,6 @@ module.exports = { bsc: { tvl: getUniTVL({ factory: FACTORY, - chain: "bsc", useDefaultCoreAssets: true, }), staking: stakings([LOCKER], KSWAP, "bsc"), diff --git a/projects/liquid-bolt/index.js b/projects/liquid-bolt/index.js index 47d39bc8a27..45317b3401b 100644 --- a/projects/liquid-bolt/index.js +++ b/projects/liquid-bolt/index.js @@ -11,16 +11,16 @@ const factory = { module.exports = { methodology: `Uses factory addresses to find and price Liquidity Pools TVL`, bsc: { - tvl: getUniTVL({ factory: factory.bsc, }), + tvl: getUniTVL({ factory: factory.bsc, useDefaultCoreAssets: true, }), }, fantom: { - tvl: getUniTVL({ factory: factory.fantom, }), + tvl: getUniTVL({ factory: factory.fantom, useDefaultCoreAssets: true, }), }, polygon: { - tvl: getUniTVL({ factory: factory.polygon, }), + tvl: getUniTVL({ factory: factory.polygon, useDefaultCoreAssets: true, }), }, arbitrum: { - tvl: getUniTVL({ factory: factory.arbitrum, }), + tvl: getUniTVL({ factory: factory.arbitrum, useDefaultCoreAssets: true, }), }, }; diff --git a/projects/lydia/index.js b/projects/lydia/index.js index 8d4523ae5c6..572dc293017 100644 --- a/projects/lydia/index.js +++ b/projects/lydia/index.js @@ -3,6 +3,6 @@ const { getUniTVL } = require('../helper/unknownTokens') module.exports = { misrepresentedTokens: true, avax:{ - tvl: getUniTVL({ chain: 'avax', factory: '0xe0C1bb6DF4851feEEdc3E14Bd509FEAF428f7655', blacklistedTokens: ['0xc1a49c0b9c10f35850bd8e15eaef0346be63e002']}) + tvl: getUniTVL({ misrepresentedTokens: true, factory: '0xe0C1bb6DF4851feEEdc3E14Bd509FEAF428f7655', blacklistedTokens: ['0xc1a49c0b9c10f35850bd8e15eaef0346be63e002']}) }, } diff --git a/projects/mm-finance-polygon/index.js b/projects/mm-finance-polygon/index.js index 7308a6c5ff8..20a8b406e1d 100644 --- a/projects/mm-finance-polygon/index.js +++ b/projects/mm-finance-polygon/index.js @@ -11,7 +11,6 @@ module.exports = { polygon: { staking: staking(masterChef, mmfToken, 'polygon'), tvl: getUniTVL({ - chain: 'polygon', factory, useDefaultCoreAssets: true, }), diff --git a/projects/mm-finance/index.js b/projects/mm-finance/index.js index b12acb5b13f..89cbfe5e0ca 100644 --- a/projects/mm-finance/index.js +++ b/projects/mm-finance/index.js @@ -13,7 +13,6 @@ module.exports = { cronos: { staking: staking(masterChef, mmfToken, 'cronos'), tvl: getUniTVL({ - chain: 'cronos', factory, useDefaultCoreAssets: true, blacklist:[ diff --git a/projects/mochiswap/index.js b/projects/mochiswap/index.js index c319ba26796..3b0fc7e3aea 100644 --- a/projects/mochiswap/index.js +++ b/projects/mochiswap/index.js @@ -39,7 +39,6 @@ async function harmonyStaking(timestamp, block, chainBlocks) { module.exports = { bsc: { tvl: getUniTVL({ - chain: 'bsc', factory: bscFactory, useDefaultCoreAssets: true, }), @@ -47,7 +46,6 @@ module.exports = { }, harmony: { tvl: getUniTVL({ - chain: 'harmony', factory: harmonyFactory, useDefaultCoreAssets: true, }), diff --git a/projects/moonlift/index.js b/projects/moonlift/index.js index ba5ea9ea3e3..2a7e44da2aa 100644 --- a/projects/moonlift/index.js +++ b/projects/moonlift/index.js @@ -5,7 +5,6 @@ module.exports = { bsc: { tvl: getUniTVL({ factory: '0xe9cABbC746C03010020Fd093cD666e40823E0D87', - chain: 'bsc', useDefaultCoreAssets: true }) }, diff --git a/projects/moonswap/index.js b/projects/moonswap/index.js index a28b4cf6122..ba0db0ebce9 100644 --- a/projects/moonswap/index.js +++ b/projects/moonswap/index.js @@ -3,7 +3,6 @@ const { getUniTVL } = require('../helper/unknownTokens') module.exports = { moonriver: { tvl: getUniTVL({ - chain: 'moonriver', factory: '0x056973f631a5533470143bb7010c9229c19c04d2', useDefaultCoreAssets: true, blacklist: [ diff --git a/projects/niifi.js b/projects/niifi.js index d04129c7624..2872bf0acd6 100644 --- a/projects/niifi.js +++ b/projects/niifi.js @@ -3,6 +3,6 @@ const { getUniTVL } = require('./helper/unknownTokens') module.exports = { misrepresentedTokens: true, nahmii: { - tvl: getUniTVL({ factory: '0xe3DcF89D0c90A877cD82283EdFA7C3Bd03e77E86', chain: 'nahmii', useDefaultCoreAssets: true }), + tvl: getUniTVL({ factory: '0xe3DcF89D0c90A877cD82283EdFA7C3Bd03e77E86', useDefaultCoreAssets: true }), } }; // node test.js projects/niifi.js \ No newline at end of file diff --git a/projects/nomiswap/index.js b/projects/nomiswap/index.js index 9b6858670d3..282a7c3f243 100644 --- a/projects/nomiswap/index.js +++ b/projects/nomiswap/index.js @@ -7,7 +7,6 @@ const constantProductFactory = "0xd6715A8be3944ec72738F0BFDC739d48C3c29349"; const stableSwapFactory = "0xC6B7ee49D386bAe4FD501F2d2f8d18828F1f6285"; const factories = [constantProductFactory, stableSwapFactory].map(factory => getUniTVL({ factory, - chain: 'bsc', useDefaultCoreAssets: true })) diff --git a/projects/oaswap.js b/projects/oaswap.js index 435f6984c4e..12026b8bb93 100644 --- a/projects/oaswap.js +++ b/projects/oaswap.js @@ -1,6 +1,6 @@ const { getUniTVL } = require('./helper/unknownTokens') module.exports = { oasis: { - tvl: getUniTVL({ factory: '0x84b11e8fb9a5dE10347eEA24c73d02B835505FDd', chain: 'oasis', useDefaultCoreAssets: true }), + tvl: getUniTVL({ factory: '0x84b11e8fb9a5dE10347eEA24c73d02B835505FDd', useDefaultCoreAssets: true }), } }; \ No newline at end of file diff --git a/projects/occam.js b/projects/occam.js index 88d26dac937..4b658018b9b 100644 --- a/projects/occam.js +++ b/projects/occam.js @@ -1,6 +1,6 @@ const { getUniTVL } = require('./helper/unknownTokens') module.exports = { milkomeda: { - tvl: getUniTVL({ factory: '0x2ef06A90b0E7Ae3ae508e83Ea6628a3987945460', chain: 'milkomeda', useDefaultCoreAssets: true }), + tvl: getUniTVL({ factory: '0x2ef06A90b0E7Ae3ae508e83Ea6628a3987945460', useDefaultCoreAssets: true }), } } diff --git a/projects/octopow/index.js b/projects/octopow/index.js index ddd771f250b..29fe60f109f 100644 --- a/projects/octopow/index.js +++ b/projects/octopow/index.js @@ -4,7 +4,6 @@ module.exports = { misrepresentedTokens: true, ethpow: { tvl: getUniTVL({ - chain: 'ethpow', useDefaultCoreAssets: true, factory: '0x3a69E908fA1614e445720Ab816a0CD51e5dc6FeC', }) diff --git a/projects/okcswap/index.js b/projects/okcswap/index.js index 1045f7b8ffb..d86a82b2492 100644 --- a/projects/okcswap/index.js +++ b/projects/okcswap/index.js @@ -6,7 +6,6 @@ module.exports = { okexchain: { tvl: getUniTVL({ factory: '0x7b9F0a56cA7D20A44f603C03C6f45Db95b31e539', - chain: 'okexchain', useDefaultCoreAssets: true, }) }, diff --git a/projects/onavax/index.js b/projects/onavax/index.js index f7ce9732e65..ba7d3338f33 100644 --- a/projects/onavax/index.js +++ b/projects/onavax/index.js @@ -6,7 +6,6 @@ module.exports = { avax: { tvl: getUniTVL({ factory, - chain: 'avax', useDefaultCoreAssets: true, }), }, diff --git a/projects/oolongswap/index.js b/projects/oolongswap/index.js index 3df13a6855a..18e768251b2 100644 --- a/projects/oolongswap/index.js +++ b/projects/oolongswap/index.js @@ -3,7 +3,6 @@ const { getUniTVL } = require('../helper/unknownTokens') module.exports = { boba: { tvl: getUniTVL({ - chain: 'boba', factory: '0x7DDaF116889D655D1c486bEB95017a8211265d29', useDefaultCoreAssets: true, }) diff --git a/projects/oortswap/index.js b/projects/oortswap/index.js index f40ad1ccb93..4e2202bc3ed 100644 --- a/projects/oortswap/index.js +++ b/projects/oortswap/index.js @@ -6,7 +6,6 @@ module.exports = { "Factory address (0xac15fe2C74bD635EfAF687F302633C7e5EbfF973) is used to find the LP pairs. TVL is equal to the liquidity on the AMM.", rei: { tvl: getUniTVL({ - chain: 'rei', factory: '0xac15fe2C74bD635EfAF687F302633C7e5EbfF973', useDefaultCoreAssets: true, }) diff --git a/projects/openswap_harmony/index.js b/projects/openswap_harmony/index.js index 78b3fbd8b5e..f9e21141a41 100644 --- a/projects/openswap_harmony/index.js +++ b/projects/openswap_harmony/index.js @@ -4,7 +4,6 @@ module.exports = { harmony: { tvl: getUniTVL({ factory: '0x5d2f9817303b940c9bb4f47c8c566c5c034d9848', - chain: 'harmony', useDefaultCoreAssets: true, blacklist: [ '0xed0b4b0f0e2c17646682fc98ace09feb99af3ade', // RVRS diff --git a/projects/orionprotocol/index.js b/projects/orionprotocol/index.js index 64d05a9d2ae..f272d3f9791 100644 --- a/projects/orionprotocol/index.js +++ b/projects/orionprotocol/index.js @@ -6,13 +6,13 @@ module.exports = { methodology: 'The Factory address is used to find the liquidity in each of the LP pairs', bsc: { tvl: getUniTVL({ - chain: 'bsc', useDefaultCoreAssets: true, + useDefaultCoreAssets: true, factory: '0xE52cCf7B6cE4817449F2E6fA7efD7B567803E4b4', }), }, ethereum: { tvl: getUniTVL({ - chain: 'ethereum', useDefaultCoreAssets: true, + useDefaultCoreAssets: true, factory: ethFactory, }), }, diff --git a/projects/pegasys/index.js b/projects/pegasys/index.js index c8fc67304cc..3c5c517936e 100644 --- a/projects/pegasys/index.js +++ b/projects/pegasys/index.js @@ -7,7 +7,6 @@ module.exports = { "Factory address (0x7Bbbb6abaD521dE677aBe089C85b29e3b2021496) is used to find the LP pairs. TVL is equal to the liquidity on the AMM.", syscoin: { tvl: getUniTVL({ - chain: 'syscoin', factory: '0x7Bbbb6abaD521dE677aBe089C85b29e3b2021496', useDefaultCoreAssets: true, }) diff --git a/projects/photonswap/index.js b/projects/photonswap/index.js index 4f325154305..d1c2ec365a5 100644 --- a/projects/photonswap/index.js +++ b/projects/photonswap/index.js @@ -6,21 +6,18 @@ module.exports = { cronos: { tvl: getUniTVL({ factory: '0x462C98Cae5AffEED576c98A55dAA922604e2D875', - chain: 'cronos', useDefaultCoreAssets: true, }), }, evmos: { tvl: getUniTVL({ factory: '0x1c671d6fEC45Ec0de88C82e6D8536bFe33F00c8a', - chain: 'evmos', useDefaultCoreAssets: true, }), }, kava: { tvl: getUniTVL({ factory: '0x4FD2c40c25Dd40e9Bf0CE8479bA384178b8671b5', - chain: 'kava', useDefaultCoreAssets: true, }), } diff --git a/projects/pinkswap/index.js b/projects/pinkswap/index.js index 85af1529f8d..c8443974675 100644 --- a/projects/pinkswap/index.js +++ b/projects/pinkswap/index.js @@ -7,7 +7,6 @@ const masterChef = '0xe981676633dCf0256Aa512f4923A7e8DA180C595' module.exports = { bsc: { tvl: getUniTVL({ - chain: 'bsc', factory: FACTORY, useDefaultCoreAssets: true, }), diff --git a/projects/pippifinance/index.js b/projects/pippifinance/index.js index 4df97f7093d..4fbb2e01cf8 100644 --- a/projects/pippifinance/index.js +++ b/projects/pippifinance/index.js @@ -5,8 +5,8 @@ const PIPPI_FACTORY = "0x979efE7cA072b72d6388f415d042951dDF13036e"; module.exports = { heco: { tvl: getUniTVL({ - chain: 'heco', factory: PIPPI_FACTORY, + useDefaultCoreAssets: true, }), }, }; \ No newline at end of file diff --git a/projects/planet-blue/index.js b/projects/planet-blue/index.js index c4f54a947c7..576e5cb5e95 100644 --- a/projects/planet-blue/index.js +++ b/projects/planet-blue/index.js @@ -5,7 +5,6 @@ module.exports = { bsc: { tvl: getUniTVL({ factory: '0xa053582601214FEb3778031a002135cbBB7DBa18', - chain: 'bsc', useDefaultCoreAssets: false }) }, diff --git a/projects/pls2e/index.js b/projects/pls2e/index.js index d86a30a5374..5a605b75ef6 100644 --- a/projects/pls2e/index.js +++ b/projects/pls2e/index.js @@ -5,7 +5,6 @@ module.exports = { bsc: { tvl: getUniTVL({ factory: '0x0944AB692786D9104AE9a29778285c41C33c0415', - chain: 'bsc', useDefaultCoreAssets: true }) }, diff --git a/projects/powerswap/index.js b/projects/powerswap/index.js index 25c2c7eb81e..9cb6b93fae1 100644 --- a/projects/powerswap/index.js +++ b/projects/powerswap/index.js @@ -5,7 +5,6 @@ module.exports = { ethpow: { tvl: getUniTVL({ factory: '0xD51CFEb0fa23101f67cF62EB02D0a82A4BaD52b7', - chain: 'ethpow', useDefaultCoreAssets: true }) }, diff --git a/projects/powswap/index.js b/projects/powswap/index.js index 9387d4b09aa..0af5680945d 100644 --- a/projects/powswap/index.js +++ b/projects/powswap/index.js @@ -4,7 +4,6 @@ module.exports = { misrepresentedTokens: true, ethpow: { tvl: getUniTVL({ - chain: 'ethpow', useDefaultCoreAssets: true, factory: '0x62009bD6349A3A1d7f1bcC7C69492Cd26F1FBF75', }) diff --git a/projects/puddingswap/index.js b/projects/puddingswap/index.js index c8ab38925fd..b2ea0e18d03 100644 --- a/projects/puddingswap/index.js +++ b/projects/puddingswap/index.js @@ -3,7 +3,6 @@ const { getUniTVL } = require('../helper/unknownTokens') module.exports = { hoo: { tvl: getUniTVL({ - chain: 'hoo', factory: '0x6168D508ad65D87f8F5916986B55d134Af7153bb', useDefaultCoreAssets: true, }), diff --git a/projects/pyeswap/index.js b/projects/pyeswap/index.js index 6d4d6c4477e..575fef9eaa7 100644 --- a/projects/pyeswap/index.js +++ b/projects/pyeswap/index.js @@ -5,7 +5,6 @@ module.exports = { bsc: { tvl: getUniTVL({ factory: '0xb664bdce35b5ee182e8832d4f3b615232e98a51e', - chain: 'bsc', useDefaultCoreAssets: true }) }, diff --git a/projects/quasar-swap/index.js b/projects/quasar-swap/index.js index 950c31d2418..978a457c47d 100644 --- a/projects/quasar-swap/index.js +++ b/projects/quasar-swap/index.js @@ -19,7 +19,6 @@ module.exports = { nova: { tvl: getUniTVL({ factory: dexFactory, - chain: "nova", useDefaultCoreAssets: true, }), staking: async (_, _b, { nova: block }) => diff --git a/projects/rcpswap/index.js b/projects/rcpswap/index.js index a5fab5f8fd8..e5ad8b1d274 100644 --- a/projects/rcpswap/index.js +++ b/projects/rcpswap/index.js @@ -4,7 +4,6 @@ module.exports = { misrepresentedTokens: true, arbitrum_nova: { tvl: getUniTVL({ - chain: 'arbitrum_nova', useDefaultCoreAssets: true, factory: '0xF9901551B4fDb1FE8d5617B5deB6074Bb8E1F6FB', }) diff --git a/projects/redemption/index.js b/projects/redemption/index.js index c97ab5806d6..1b446aa614c 100644 --- a/projects/redemption/index.js +++ b/projects/redemption/index.js @@ -5,7 +5,6 @@ module.exports = { fantom: { tvl: getUniTVL({ factory: '0xa2dF50d1401afF182D19Bb41d76cf35953942c51', - chain: 'fantom', useDefaultCoreAssets: true }) }, diff --git a/projects/scaryswap/index.js b/projects/scaryswap/index.js index 47e030c3148..fb42b01a1be 100644 --- a/projects/scaryswap/index.js +++ b/projects/scaryswap/index.js @@ -15,7 +15,6 @@ async function staking(timestamp, block, chainBlocks, { api }) { module.exports = { fantom: { tvl: getUniTVL({ - chain, useDefaultCoreAssets: true, factory: "0x7ceb5f3a6d1888eec74a41a5377afba5b97200ea", }), diff --git a/projects/sealightswap/index.js b/projects/sealightswap/index.js index 06735b2f066..34a57823e2a 100644 --- a/projects/sealightswap/index.js +++ b/projects/sealightswap/index.js @@ -5,7 +5,6 @@ module.exports = { polygon: { tvl: getUniTVL({ factory: '0xd0B30Fc63169bAaa3702ad7ec33EBe3f9e8627c0', - chain: 'polygon', useDefaultCoreAssets: false }) }, diff --git a/projects/shadowswap/index.js b/projects/shadowswap/index.js index 3c76b421c9d..009bb8b3e9e 100644 --- a/projects/shadowswap/index.js +++ b/projects/shadowswap/index.js @@ -4,7 +4,6 @@ module.exports = { misrepresentedTokens: true, core: { tvl: getUniTVL({ - chain: 'core', useDefaultCoreAssets: true, factory: '0x326Ee96748E7DcC04BE1Ef8f4E4F6bdd54048932', }) diff --git a/projects/sharkswap/index.js b/projects/sharkswap/index.js index 8b0c71592aa..104c5a856c8 100644 --- a/projects/sharkswap/index.js +++ b/projects/sharkswap/index.js @@ -3,7 +3,6 @@ const { getUniTVL } = require("../helper/unknownTokens") module.exports = { sx: { tvl: getUniTVL({ - chain: 'sx', factory: '0x6A482aC7f61Ed75B4Eb7C26cE8cD8a66bd07B88D', useDefaultCoreAssets: true, }) diff --git a/projects/shibaswap/index.js b/projects/shibaswap/index.js index 1871269e234..772fb8ccf36 100644 --- a/projects/shibaswap/index.js +++ b/projects/shibaswap/index.js @@ -7,7 +7,7 @@ module.exports = { ethereum: { tvl: getUniTVL({ factory: FACTORY, - chain: 'ethereum', + useDefaultCoreAssets: true, blacklist: [ '0x6ADb2E268de2aA1aBF6578E4a8119b960E02928F', '0xab167E816E4d76089119900e941BEfdfA37d6b32', diff --git a/projects/solarbeam/index.js b/projects/solarbeam/index.js index a59a5ff7ebc..54c0b6b2f6c 100644 --- a/projects/solarbeam/index.js +++ b/projects/solarbeam/index.js @@ -164,8 +164,8 @@ async function stableDexTVL(timestamp, _block, chainBlocks) { } const dexTVL = getUniTVL({ + useDefaultCoreAssets: true, factory: '0x049581aEB6Fe262727f290165C29BDAB065a1B68', - chain: 'moonriver', coreAssets: [ '0xf50225a84382c74CbdeA10b0c176f71fc3DE0C4d', // moonriver "0x98878B06940aE243284CA214f92Bb71a2b032B8A", // WMOVR diff --git a/projects/soyfinance/index.js b/projects/soyfinance/index.js index 4b64eca10c7..cc8899fa920 100644 --- a/projects/soyfinance/index.js +++ b/projects/soyfinance/index.js @@ -8,28 +8,24 @@ module.exports = { callisto: { tvl: getUniTVL({ factory: '0x9CC7C769eA3B37F1Af0Ad642A268b80dc80754c5', - chain: 'callisto', useDefaultCoreAssets: true, }) }, ethereumclassic: { tvl: getUniTVL({ factory: '0x23675f1Ac7cce101Aff647B96d7201EfCf66E4b0', - chain: 'ethereumclassic', useDefaultCoreAssets: true, }) }, bittorrent: { tvl: getUniTVL({ factory: ADDRESSES.callisto.BUSDT, - chain: 'bittorrent', useDefaultCoreAssets: true, }) }, bsc: { tvl: getUniTVL({ factory: '0x23675f1Ac7cce101Aff647B96d7201EfCf66E4b0', - chain: 'bsc', useDefaultCoreAssets: true, }) }, diff --git a/projects/spicetrade/index.js b/projects/spicetrade/index.js index c271b69d92f..060a8cda62b 100644 --- a/projects/spicetrade/index.js +++ b/projects/spicetrade/index.js @@ -36,7 +36,6 @@ const tvl = (chain, type) => { const chainTypeExports = (chains) => { return chains.reduce((obj, chain) => { const uniTVL = getUniTVL({ - chain, factory: contracts[chain].factory, useDefaultCoreAssets: true, }) diff --git a/projects/starswap/index.js b/projects/starswap/index.js index a5b0d8bc424..5fb6aa0cacb 100644 --- a/projects/starswap/index.js +++ b/projects/starswap/index.js @@ -20,7 +20,6 @@ module.exports = { astar: { tvl: getUniTVL({ factory: FACTORIES, - chain, useDefaultCoreAssets: true, }), staking: async (_, _b, { [chain]: block }) => { diff --git a/projects/stellaswap.js b/projects/stellaswap.js index 3f373be999f..c2174592d05 100644 --- a/projects/stellaswap.js +++ b/projects/stellaswap.js @@ -6,7 +6,6 @@ const { sumTokens2 } = require('./helper/unwrapLPs') const dexTVL = getUniTVL({ factory: "0x68A384D826D3678f78BB9FB1533c7E9577dACc0E", - chain: "moonbeam", useDefaultCoreAssets: true, }) diff --git a/projects/sumswap/index.js b/projects/sumswap/index.js index cb0999353a7..7b83e60042e 100644 --- a/projects/sumswap/index.js +++ b/projects/sumswap/index.js @@ -2,6 +2,6 @@ const { getUniTVL } = require('../helper/unknownTokens') module.exports = { ethereum: { - tvl: getUniTVL({ chain: 'ethereum', factory: '0x96FF042f8c6757fCE515d171F194b5816CAFEe11', }), + tvl: getUniTVL({ useDefaultCoreAssets: true, factory: '0x96FF042f8c6757fCE515d171F194b5816CAFEe11', }), }, }; diff --git a/projects/swapfish/index.js b/projects/swapfish/index.js index bfeb4d4616d..4acd24c93c3 100644 --- a/projects/swapfish/index.js +++ b/projects/swapfish/index.js @@ -8,11 +8,11 @@ const { getUniTVL } = require('../helper/unknownTokens') module.exports = { methodology: `Uses factory(0x71539D09D3890195dDa87A6198B98B75211b72F3) address and whitelisted tokens address to find and price Liquidity Pool pairs`, arbitrum: { - tvl: getUniTVL({ factory: '0x71539D09D3890195dDa87A6198B98B75211b72F3', chain: 'arbitrum' }), + tvl: getUniTVL({ factory: '0x71539D09D3890195dDa87A6198B98B75211b72F3', useDefaultCoreAssets: true }), staking: staking(MasterChefContract, FISH, "arbitrum"), }, bsc: { - tvl: getUniTVL({ factory: '0x71539D09D3890195dDa87A6198B98B75211b72F3', chain: 'bsc' }), + tvl: getUniTVL({ factory: '0x71539D09D3890195dDa87A6198B98B75211b72F3', useDefaultCoreAssets: true }), staking: staking(MasterChefBscContract, FISH, "bsc"), } }; diff --git a/projects/swapperchan/index.js b/projects/swapperchan/index.js index ccdfc7d12a4..c301e120755 100644 --- a/projects/swapperchan/index.js +++ b/projects/swapperchan/index.js @@ -4,7 +4,6 @@ module.exports={ boba:{ tvl: getUniTVL({ factory: '0x3d97964506800d433fb5dbebdd0c202ec9b62557', - chain: 'boba', useDefaultCoreAssets: true, }) } diff --git a/projects/swipeswap.js b/projects/swipeswap.js index 309c5232048..62b78be35d6 100644 --- a/projects/swipeswap.js +++ b/projects/swipeswap.js @@ -2,9 +2,9 @@ const { getUniTVL } = require('./helper/unknownTokens') module.exports = { ethereum:{ - tvl: getUniTVL({ chain: 'ethereum', factory: '0x8a93b6865c4492ff17252219b87ea6920848edc0', }) + tvl: getUniTVL({ factory: '0x8a93b6865c4492ff17252219b87ea6920848edc0', useDefaultCoreAssets: true, }) }, bsc:{ - tvl: getUniTVL({ chain: 'bsc', factory: '0x7810d4b7bc4f7faee9deec3242238a39c4f1197d', }) + tvl: getUniTVL({ factory: '0x7810d4b7bc4f7faee9deec3242238a39c4f1197d', useDefaultCoreAssets: true, }) }, } diff --git a/projects/tendieswap/index.js b/projects/tendieswap/index.js index 5429f6de3cf..be6c8a943e9 100644 --- a/projects/tendieswap/index.js +++ b/projects/tendieswap/index.js @@ -8,7 +8,7 @@ const tendie = "0x9853A30C69474BeD37595F9B149ad634b5c323d9" module.exports = { bsc: { tvl: getUniTVL({ - chain: 'bsc', useDefaultCoreAssets: true, + useDefaultCoreAssets: true, factory: factoryBSC, }), staking: staking(masterchef, tendie, "bsc") diff --git a/projects/tetu-swap/index.js b/projects/tetu-swap/index.js index 17d8cb6859f..d179dc83314 100644 --- a/projects/tetu-swap/index.js +++ b/projects/tetu-swap/index.js @@ -4,7 +4,6 @@ module.exports = { misrepresentedTokens: true, polygon: { tvl: getUniTVL({ - chain: 'polygon', useDefaultCoreAssets: true, factory: '0x684d8c187be836171a1af8d533e4724893031828', }), diff --git a/projects/thorusfi/index.js b/projects/thorusfi/index.js index ffbe60e5e42..7c690ca89f9 100644 --- a/projects/thorusfi/index.js +++ b/projects/thorusfi/index.js @@ -15,14 +15,14 @@ module.exports = { timetravel: true, avax:{ tvl: getUniTVL({ - chain: 'avax', + useDefaultCoreAssets: true, factory: factoryContract, }), staking: staking(thorusMaster_avax, THO_avax, "avax"), }, moonbeam: { tvl: getUniTVL({ - chain: 'moonbeam', + useDefaultCoreAssets: true, factory: factoryContract, }), staking: staking( diff --git a/projects/tifi-bank/index.js b/projects/tifi-bank/index.js index 1b512da6887..9a2bb52039f 100644 --- a/projects/tifi-bank/index.js +++ b/projects/tifi-bank/index.js @@ -27,9 +27,10 @@ const lpTokens = [ module.exports = { + misrepresentedTokens: true, bsc: { - tvl: getUniTVL({ chain: 'bsc', factory: '0xb3456550c17128ca7ebbcc47d4be6cae29d43853', }), - staking: stakings(stakingContracts, '0x17E65E6b9B166Fb8e7c59432F0db126711246BC0', 'bsc'), + tvl: getUniTVL({ factory: '0xb3456550c17128ca7ebbcc47d4be6cae29d43853', useDefaultCoreAssets: true }), + staking: stakings(stakingContracts, '0x17E65E6b9B166Fb8e7c59432F0db126711246BC0'), // pool2: sumTokensExport({ tokens: lpTokens, owners: lpContract, useDefaultCoreAssets: true }), } } diff --git a/projects/titano-swych/index.js b/projects/titano-swych/index.js index b2562009776..94a8ddc0c26 100644 --- a/projects/titano-swych/index.js +++ b/projects/titano-swych/index.js @@ -5,7 +5,6 @@ module.exports = { bsc: { tvl: getUniTVL({ factory: '0x80f112CD8Ac529d6993090A0c9a04E01d495BfBf', - chain: 'bsc', useDefaultCoreAssets: true }) }, diff --git a/projects/tomb-swap/index.js b/projects/tomb-swap/index.js index a4da5e045ee..5d18240374c 100644 --- a/projects/tomb-swap/index.js +++ b/projects/tomb-swap/index.js @@ -5,7 +5,6 @@ const { getUniTVL } = require("../helper/unknownTokens") fantom: { tvl: getUniTVL({ factory: '0xE236f6890F1824fa0a7ffc39b1597A5A6077Cfe9', - chain: 'fantom', useDefaultCoreAssets: true, }) }, diff --git a/projects/trisolaris.js b/projects/trisolaris.js index 773321a3842..32a5aa4cbbb 100644 --- a/projects/trisolaris.js +++ b/projects/trisolaris.js @@ -6,7 +6,6 @@ const chain = 'aurora' const dexTVL = getUniTVL({ factory: '0xc66F594268041dB60507F00703b152492fb176E7', - chain: 'aurora', useDefaultCoreAssets: true, }) diff --git a/projects/ultronSwap/index.js b/projects/ultronSwap/index.js index 4c19a4bba6b..163c65779ab 100644 --- a/projects/ultronSwap/index.js +++ b/projects/ultronSwap/index.js @@ -5,14 +5,12 @@ module.exports = { misrepresentedTokens: true, ultron: { tvl: getUniTVL({ - chain: 'ultron', useDefaultCoreAssets: true, factory: '0xe1F0D4a5123Fd0834Be805d84520DFDCd8CF00b7', }), staking: staking({ owner: '0xf26E50c26Ed51AbeC4078380Ed1F13440011F2A1', tokens: [ADDRESSES.ultron.wULX], - chain: 'ultron' }) } }; \ No newline at end of file diff --git a/projects/uniwswap/index.js b/projects/uniwswap/index.js index 3f39b8fb282..0d570f8fc29 100644 --- a/projects/uniwswap/index.js +++ b/projects/uniwswap/index.js @@ -4,7 +4,6 @@ module.exports = { misrepresentedTokens: true, ethpow: { tvl: getUniTVL({ - chain: 'ethpow', useDefaultCoreAssets: true, factory: '0xaBC4325bAD182076EAa5877c68437833d596D3Ee', }) diff --git a/projects/valuedefi.js b/projects/valuedefi.js index 2f2fc06f3ec..e218764de75 100644 --- a/projects/valuedefi.js +++ b/projects/valuedefi.js @@ -14,8 +14,8 @@ const abis = { } const bscDexTVL = getUniTVL({ - chain: 'bsc', factory: swapFactory, + useDefaultCoreAssets: true, }) async function bscStableSwapTvl(_, _b, { bsc: block }) { diff --git a/projects/vanswap/index.js b/projects/vanswap/index.js index ea99b9f0ef8..e1f34428677 100644 --- a/projects/vanswap/index.js +++ b/projects/vanswap/index.js @@ -10,7 +10,6 @@ module.exports = { misrepresentedTokens: true, vision: { tvl: getUniTVL({ - chain: 'vision', useDefaultCoreAssets: true, factory: '0xF6D67482DEDE4D208F74CCD0E6592764014F546F', }), diff --git a/projects/vvs-finance/index.js b/projects/vvs-finance/index.js index 7abc0334da3..74b04fc0b7b 100644 --- a/projects/vvs-finance/index.js +++ b/projects/vvs-finance/index.js @@ -5,7 +5,6 @@ module.exports={ methodology: "Factory address (0x3b44b2a187a7b3824131f8db5a74194d0a42fc15) is used to find the LP pairs. TVL is equal to the liquidity on the AMM.", cronos: { tvl: getUniTVL({ - chain: 'cronos', factory: '0x3b44b2a187a7b3824131f8db5a74194d0a42fc15', useDefaultCoreAssets: true, }) diff --git a/projects/w3swap/index.js b/projects/w3swap/index.js index 349e4a76be7..39bfb8281f3 100644 --- a/projects/w3swap/index.js +++ b/projects/w3swap/index.js @@ -5,7 +5,6 @@ module.exports = { bsc: { tvl: getUniTVL({ factory: '0xD04A80baeeF12fD7b1D1ee6b1f8ad354f81bc4d7', - chain: 'bsc', useDefaultCoreAssets: true }) }, diff --git a/projects/wagyuswap/index.js b/projects/wagyuswap/index.js index 37f12ea337d..fc91b7d2dcc 100644 --- a/projects/wagyuswap/index.js +++ b/projects/wagyuswap/index.js @@ -4,7 +4,7 @@ module.exports = { misrepresentedTokens: true, velas: { tvl: getUniTVL({ - factory: '0x69f3212344a38b35844cce4864c2af9c717f35e3', chain: 'velas', useDefaultCoreAssets: true, + factory: '0x69f3212344a38b35844cce4864c2af9c717f35e3', useDefaultCoreAssets: true, blacklist: ['0xcd7509b76281223f5b7d3ad5d47f8d7aa5c2b9bf'], }) }, diff --git a/projects/wakafinance.js b/projects/wakafinance.js index 530e8774359..693633155dc 100644 --- a/projects/wakafinance.js +++ b/projects/wakafinance.js @@ -6,7 +6,6 @@ module.exports = { tvl: getUniTVL({ factory: '0xb2435253c71fca27be41206eb2793e44e1df6b6d', useDefaultCoreAssets: true, - chain: 'fantom', }), }, } \ No newline at end of file diff --git a/projects/wardenswap/index.js b/projects/wardenswap/index.js index 478b68f9974..32557f48fb0 100644 --- a/projects/wardenswap/index.js +++ b/projects/wardenswap/index.js @@ -7,7 +7,6 @@ module.exports = { methodology: "TVL is calculated from total liquidity of WardenSwap's active pools listed on our farm page https://farm.wardenswap.finance/?t=1&s=1/#/farm, excluding pools at PancakeSwap and inactive pools are not included, plus total warden staked in Warden pool", bsc:{ tvl: getUniTVL({ - chain: 'bsc', factory: '0x3657952d7bA5A0A4799809b5B6fdfF9ec5B46293', useDefaultCoreAssets: true, }), diff --git a/projects/whaleswap/index.js b/projects/whaleswap/index.js index 433b29df1b2..a7ae009ecbd 100644 --- a/projects/whaleswap/index.js +++ b/projects/whaleswap/index.js @@ -4,12 +4,10 @@ const pod = '0xdded222297b3d08dafdac8f65eeb799b2674c78f' module.exports = { bsc: { tvl: getUniTVL({ - chain: 'bsc', factory: '0xabc26f8364cc0dd728ac5c23fa40886fda3dd121', useDefaultCoreAssets: true, }), staking: staking( { - chain: 'bsc', owners: ["0xdEe627eaaB378ec57ECfB94b389B718ef3687c0D", "0xdc8715aCFB63cd0BD01a2C3e7De514845FdbcDF7"], tokens: [pod], useDefaultCoreAssets: true, @@ -18,12 +16,10 @@ module.exports = { }, fantom: { tvl: getUniTVL({ - chain: 'fantom', factory: '0xabc26f8364cc0dd728ac5c23fa40886fda3dd121', useDefaultCoreAssets: true, }), staking: staking( { - chain: 'fantom', owners: ["0xdEe627eaaB378ec57ECfB94b389B718ef3687c0D", "0xdc8715aCFB63cd0BD01a2C3e7De514845FdbcDF7"], tokens: [pod], useDefaultCoreAssets: true, @@ -32,12 +28,10 @@ module.exports = { }, arbitrum: { tvl: getUniTVL({ - chain: 'arbitrum', factory: '0xabc26f8364cc0dd728ac5c23fa40886fda3dd121', useDefaultCoreAssets: true, }), staking: staking( { - chain: 'arbitrum', owners: ["0xdEe627eaaB378ec57ECfB94b389B718ef3687c0D", "0xdc8715aCFB63cd0BD01a2C3e7De514845FdbcDF7"], tokens: [pod], useDefaultCoreAssets: true, @@ -46,12 +40,10 @@ module.exports = { }, optimism: { tvl: getUniTVL({ - chain: 'optimism', factory: '0xabc26f8364cc0dd728ac5c23fa40886fda3dd121', useDefaultCoreAssets: true, }), staking: staking( { - chain: 'optimism', owners: ["0xdEe627eaaB378ec57ECfB94b389B718ef3687c0D", "0xdc8715aCFB63cd0BD01a2C3e7De514845FdbcDF7"], tokens: [pod], useDefaultCoreAssets: true, @@ -60,12 +52,10 @@ module.exports = { }, avax: { tvl: getUniTVL({ - chain: 'avax', factory: '0xabc26f8364cc0dd728ac5c23fa40886fda3dd121', useDefaultCoreAssets: true, }), staking: staking( { - chain: 'avax', owners: ["0xdEe627eaaB378ec57ECfB94b389B718ef3687c0D", "0xdc8715aCFB63cd0BD01a2C3e7De514845FdbcDF7"], tokens: [pod], useDefaultCoreAssets: true, @@ -74,12 +64,10 @@ module.exports = { }, polygon: { tvl: getUniTVL({ - chain: 'polygon', factory: '0xabc26f8364cc0dd728ac5c23fa40886fda3dd121', useDefaultCoreAssets: true, }), staking: staking( { - chain: 'polygon', owners: ["0xdEe627eaaB378ec57ECfB94b389B718ef3687c0D", "0xdc8715aCFB63cd0BD01a2C3e7De514845FdbcDF7"], tokens: [pod], useDefaultCoreAssets: true, @@ -88,7 +76,6 @@ module.exports = { }, kava: { tvl: getUniTVL({ - chain: 'kava', factory: '0xabc26f8364cc0dd728ac5c23fa40886fda3dd121', useDefaultCoreAssets: true, }) diff --git a/projects/winery-swap/index.js b/projects/winery-swap/index.js index 5f89afcd75c..9dbca80e985 100644 --- a/projects/winery-swap/index.js +++ b/projects/winery-swap/index.js @@ -5,7 +5,6 @@ module.exports = { bsc: { tvl: getUniTVL({ factory: '0x79C342FddBBF376cA6B4EFAc7aaA457D6063F8Cb', - chain: 'bsc', useDefaultCoreAssets: true }) }, diff --git a/projects/wojakfinance/index.js b/projects/wojakfinance/index.js index aa2b248c4a6..077cf3c07ac 100644 --- a/projects/wojakfinance/index.js +++ b/projects/wojakfinance/index.js @@ -14,7 +14,6 @@ module.exports = { dogechain: { tvl: getUniTVL({ factory: '0xc7c86B4f940Ff1C13c736b697e3FbA5a6Bc979F9', - chain, useDefaultCoreAssets: true, }), staking: staking({ diff --git a/projects/wtfdex/index.js b/projects/wtfdex/index.js index dc9fac53ac9..49fc8bb614c 100644 --- a/projects/wtfdex/index.js +++ b/projects/wtfdex/index.js @@ -7,7 +7,7 @@ const { getUniTVL } = require('../helper/unknownTokens') module.exports = { methodology: `Uses factory(0x63FD0a6acBfFB128E7BC7753BFA3B8639A233d50) address and whitelisted tokens address to find and price Liquidity Pool pairs`, arbitrum: { - tvl: getUniTVL({ factory: '0x63FD0a6acBfFB128E7BC7753BFA3B8639A233d50', chain: 'arbitrum' }), + tvl: getUniTVL({ factory: '0x63FD0a6acBfFB128E7BC7753BFA3B8639A233d50', useDefaultCoreAssets: true }), staking: staking(MasterChefContract, WTFX, "arbitrum"), } }; diff --git a/projects/xspswap/index.js b/projects/xspswap/index.js index 02e4b711e3e..045b5af23bd 100644 --- a/projects/xspswap/index.js +++ b/projects/xspswap/index.js @@ -5,7 +5,6 @@ module.exports = { xdc: { tvl: getUniTVL({ factory: '0x347D14b13a68457186b2450bb2a6c2Fd7B38352f', - chain: 'xdc', useDefaultCoreAssets: true, }) }, diff --git a/projects/yodeswap/api.js b/projects/yodeswap/api.js index 181e62e7a16..3e7fa96fba5 100644 --- a/projects/yodeswap/api.js +++ b/projects/yodeswap/api.js @@ -1,12 +1,9 @@ const { getUniTVL, } = require('../helper/unknownTokens') -const chain = 'dogechain' - module.exports = { misrepresentedTokens: true, dogechain: { tvl: getUniTVL({ - chain, factory: '0xAaA04462e35f3e40D798331657cA015169e005d7', useDefaultCoreAssets: true, queryBatched: 1000, diff --git a/projects/yuzu.js b/projects/yuzu.js index 7c8786384dc..6ef7401a4d3 100644 --- a/projects/yuzu.js +++ b/projects/yuzu.js @@ -1,6 +1,6 @@ const { getUniTVL } = require('./helper/unknownTokens') module.exports = { oasis: { - tvl: getUniTVL({ factory: '0x5F50fDC22697591c1D7BfBE8021163Fc73513653', chain: 'oasis', useDefaultCoreAssets: true }), + tvl: getUniTVL({ factory: '0x5F50fDC22697591c1D7BfBE8021163Fc73513653', useDefaultCoreAssets: true }), }, }; \ No newline at end of file diff --git a/projects/zerodex/index.js b/projects/zerodex/index.js index f6245775fd2..f30abae68f2 100644 --- a/projects/zerodex/index.js +++ b/projects/zerodex/index.js @@ -2,21 +2,18 @@ const { getUniTVL } = require('../helper/unknownTokens'); module.exports = { avax: { tvl: getUniTVL( { - chain: 'avax', factory: '0x2Ef422F30cdb7c5F1f7267AB5CF567A88974b308', useDefaultCoreAssets: true, }) }, bsc: { tvl: getUniTVL( { - chain: 'bsc', factory: '0x52abdb3536a3a966056e096f2572b2755df26eac', useDefaultCoreAssets: true, }) }, polygon: { tvl: getUniTVL( { - chain: 'polygon', factory: '0x6fd98cf211134081fe02f551d64cf89671d5443b', useDefaultCoreAssets: true, }) diff --git a/projects/zipswap/index.js b/projects/zipswap/index.js index 06dfa808552..85b36c0a30c 100644 --- a/projects/zipswap/index.js +++ b/projects/zipswap/index.js @@ -34,7 +34,6 @@ module.exports = { }, arbitrum: { tvl: getUniTVL({ - chain: 'arbitrum', factory: '0x9e343Bea27a12B23523ad88333a1B0f68cc1F05E', useDefaultCoreAssets: true, }), diff --git a/projects/zkevmswap/index.js b/projects/zkevmswap/index.js index 8ed204e69a5..95b0648319a 100644 --- a/projects/zkevmswap/index.js +++ b/projects/zkevmswap/index.js @@ -4,7 +4,6 @@ module.exports = { misrepresentedTokens: true, polygon_zkevm: { tvl: getUniTVL({ - chain: 'polygon_zkevm', factory: '0x213c25900f365F1BE338Df478CD82beF7Fd43F85', useDefaultCoreAssets: true, }) diff --git a/projects/zkmoonswap/index.js b/projects/zkmoonswap/index.js index 8ada309e8c9..ae6dfcc8b01 100644 --- a/projects/zkmoonswap/index.js +++ b/projects/zkmoonswap/index.js @@ -4,7 +4,6 @@ module.exports = { misrepresentedTokens: true, polygon_zkevm: { tvl: getUniTVL({ - chain: 'polygon_zkevm', factory: '0x49841094F19659e044671825d7ecb3B79368e6E5', useDefaultCoreAssets: true, }) From db24cedbbe2adc6175727aaea1568706a37eb8eb Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 31 Jul 2023 10:11:45 +0200 Subject: [PATCH 0569/1974] price against whitelisted tokens where one can --- projects/BombFinance/index.js | 2 +- projects/Shibafantom/index.js | 2 +- projects/alligator-exchange/index.js | 2 +- projects/auraswap/index.js | 2 +- projects/auroraswap/index.js | 2 +- projects/bakeryswap/index.js | 2 +- projects/baoswap/index.js | 2 +- projects/bitindi-dex/index.js | 2 +- projects/bxh/index.js | 10 +++++----- projects/concave/index.js | 2 +- projects/degenhaus/index.js | 2 +- projects/dinoexchange/index.js | 4 ++-- projects/dinosaureggs/index.js | 2 +- projects/duckydefi/index.js | 2 +- projects/excalibur/index.js | 11 +---------- projects/firebird/index.js | 2 +- projects/fuzzfinance/index.js | 2 +- projects/gravity-finance/index.js | 2 +- projects/hakuswap/index.js | 2 +- projects/helper/calculateUniTvl.js | 3 ++- projects/hswap.js | 2 +- projects/jetswap/index.js | 12 ++++++------ projects/kaco/index.js | 2 +- projects/knightswap/index.js | 4 ++-- projects/kronosdao/index.js | 2 +- projects/latte/index.js | 2 +- projects/levinswap/index.js | 2 +- projects/pandora-digital/index.js | 2 +- projects/pantherswap/index.js | 2 +- projects/polydex/index.js | 2 +- projects/pond/index.js | 2 +- projects/ponyswap/index.js | 2 +- projects/protofi/index.js | 2 +- projects/tranquil/index.js | 2 +- projects/twindex/index.js | 2 +- projects/vampireswap/index.js | 2 +- projects/velodrome-v2/index.js | 3 ++- projects/velodrome/index.js | 2 +- projects/viperswap/index.js | 4 ++-- projects/vultureswap/index.js | 4 ++-- projects/wagmidao/index.js | 3 +-- projects/wigoswap/index.js | 2 +- projects/wraithswap/index.js | 2 +- projects/youswap/index.js | 6 +++--- projects/zoodex/index.js | 2 +- 45 files changed, 62 insertions(+), 70 deletions(-) diff --git a/projects/BombFinance/index.js b/projects/BombFinance/index.js index f5e2e490f83..ddbd3f9c9be 100644 --- a/projects/BombFinance/index.js +++ b/projects/BombFinance/index.js @@ -4,6 +4,6 @@ const factory = '0xD9473A05b2edf4f614593bA5D1dBd3021d8e0Ebe' module.exports = { fantom:{ - tvl: uniTvlExport(factory, 'fantom'), + tvl: uniTvlExport(factory, 'fantom', true), }, } diff --git a/projects/Shibafantom/index.js b/projects/Shibafantom/index.js index 6652c6d454c..7d9b8f36dcc 100644 --- a/projects/Shibafantom/index.js +++ b/projects/Shibafantom/index.js @@ -4,6 +4,6 @@ const factory = '0xeAcC845E4db0aB59A326513347a37ed4E999aBD8' module.exports = { fantom:{ - tvl: uniTvlExport(factory, 'fantom'), + tvl: uniTvlExport(factory, 'fantom', true), }, } \ No newline at end of file diff --git a/projects/alligator-exchange/index.js b/projects/alligator-exchange/index.js index 31c56e824d3..7ba232276a3 100644 --- a/projects/alligator-exchange/index.js +++ b/projects/alligator-exchange/index.js @@ -8,7 +8,7 @@ const factory = "0xD9362AA8E0405C93299C573036E7FB4ec3bE1240" module.exports = { misrepresentedTokens: true, avax:{ - tvl: uniTvlExport(factory, 'avax'), + tvl: uniTvlExport(factory, 'avax', true), staking: stakingUnknownPricedLP(stakingContract, token, "avax", "0x039b4C79916b7ACc953f0f67e6181842EFBE6e6e") } } \ No newline at end of file diff --git a/projects/auraswap/index.js b/projects/auraswap/index.js index a1fcf777b1e..21dce941f42 100644 --- a/projects/auraswap/index.js +++ b/projects/auraswap/index.js @@ -7,7 +7,7 @@ const FACTORY_POLYGON = "0x015DE3ec460869eb5ceAe4224Dc7112ac0a39303"; module.exports = { polygon: { - tvl: uniTvlExport(FACTORY_POLYGON, 'polygon'), + tvl: uniTvlExport(FACTORY_POLYGON, 'polygon', true), staking: staking(MASTER_CHEF, AURA_TOKEN, "polygon"), }, } \ No newline at end of file diff --git a/projects/auroraswap/index.js b/projects/auroraswap/index.js index ba07005e9b7..e89758a348d 100644 --- a/projects/auroraswap/index.js +++ b/projects/auroraswap/index.js @@ -5,7 +5,7 @@ const brlTokenAddress = "0x12c87331f086c3C926248f964f8702C0842Fd77F"; module.exports = { aurora: { - tvl: uniTvlExport('0xC5E1DaeC2ad401eBEBdd3E32516d90Ab251A3aA3', 'aurora'), + tvl: uniTvlExport('0xC5E1DaeC2ad401eBEBdd3E32516d90Ab251A3aA3', 'aurora', true), staking: staking(masterchefAddress, brlTokenAddress, "aurora"), }, }; diff --git a/projects/bakeryswap/index.js b/projects/bakeryswap/index.js index 00a3dc8936b..f921f862ba9 100644 --- a/projects/bakeryswap/index.js +++ b/projects/bakeryswap/index.js @@ -6,6 +6,6 @@ const factory = "0x01bF7C66c6BD861915CdaaE475042d3c4BaE16A7"; module.exports = { bsc:{ staking: staking("6a8dbbfbb5a57d07d14e63e757fb80b4a7494f81", "0xE02dF9e3e622DeBdD69fb838bB799E3F168902c5", "bsc"), - tvl: uniTvlExport(factory, "bsc") + tvl: uniTvlExport(factory, "bsc", true) } }; diff --git a/projects/baoswap/index.js b/projects/baoswap/index.js index fa157305236..cf0d6f5724f 100644 --- a/projects/baoswap/index.js +++ b/projects/baoswap/index.js @@ -1,3 +1,3 @@ const { uniTvlExport } = require('../helper/unknownTokens') -module.exports = uniTvlExport('xdai', '0x45DE240fbE2077dd3e711299538A09854FAE9c9b') \ No newline at end of file +module.exports = uniTvlExport('xdai', '0x45DE240fbE2077dd3e711299538A09854FAE9c9b', true) \ No newline at end of file diff --git a/projects/bitindi-dex/index.js b/projects/bitindi-dex/index.js index 4bc259c87ef..2d9ae3663cf 100644 --- a/projects/bitindi-dex/index.js +++ b/projects/bitindi-dex/index.js @@ -1,2 +1,2 @@ const { uniTvlExport } = require('../helper/unknownTokens') -module.exports = uniTvlExport('bitindi', '0x87cef801D44D6eDa8106087e7676153c30e36950') \ No newline at end of file +module.exports = uniTvlExport('bitindi', '0x87cef801D44D6eDa8106087e7676153c30e36950', true) \ No newline at end of file diff --git a/projects/bxh/index.js b/projects/bxh/index.js index f5f89cad71b..6fba1b096d0 100644 --- a/projects/bxh/index.js +++ b/projects/bxh/index.js @@ -3,18 +3,18 @@ const { uniTvlExport } = require('../helper/calculateUniTvl'); module.exports = { heco: { - tvl: uniTvlExport('0xe0367ec2bd4ba22b1593e4fefcb91d29de6c512a', 'heco'), + tvl: uniTvlExport('0xe0367ec2bd4ba22b1593e4fefcb91d29de6c512a', 'heco', true), }, bsc: { - tvl: uniTvlExport('0x7897c32cbda1935e97c0b59f244747562d4d97c1', 'bsc'), + tvl: uniTvlExport('0x7897c32cbda1935e97c0b59f244747562d4d97c1', 'bsc', true), }, ethereum: { - tvl: uniTvlExport('0x8d0fCA60fDf50CFE65e3E667A37Ff3010D6d1e8d', 'ethereum'), + tvl: uniTvlExport('0x8d0fCA60fDf50CFE65e3E667A37Ff3010D6d1e8d', 'ethereum', true), }, avax: { - tvl: uniTvlExport('0xDeC9231b2492ccE6BA01376E2cbd2bd821150e8C', 'avax'), + tvl: uniTvlExport('0xDeC9231b2492ccE6BA01376E2cbd2bd821150e8C', 'avax', true), }, okexchain: { - tvl: uniTvlExport('0xff65bc42c10dcc73ac0924b674fd3e30427c7823', 'okexchain'), + tvl: uniTvlExport('0xff65bc42c10dcc73ac0924b674fd3e30427c7823', 'okexchain', true), }, }; // node test.js projects/bxh/index.js diff --git a/projects/concave/index.js b/projects/concave/index.js index 995209a8694..bccbfb656aa 100644 --- a/projects/concave/index.js +++ b/projects/concave/index.js @@ -35,6 +35,6 @@ async function tvl(timestamp, ethBlock, chainBlocks) { module.exports = ohmTvl(treasury, treasuryTokens, 'ethereum', stakingAddress, cnv_token, undefined, undefined, true) -module.exports.ethereum.tvl = sdk.util.sumChainTvls([tvl, module.exports.ethereum.tvl, uniTvlExport(gemSwap_factory)]) +module.exports.ethereum.tvl = sdk.util.sumChainTvls([tvl, module.exports.ethereum.tvl, uniTvlExport(gemSwap_factory, undefined, true)]) delete module.exports.ethereum.staking module.exports.methodology = 'Count the treasury assets backing the CNV price + LP assets in the AMM Gemswap' diff --git a/projects/degenhaus/index.js b/projects/degenhaus/index.js index 33edef05e6b..7bf9482d371 100644 --- a/projects/degenhaus/index.js +++ b/projects/degenhaus/index.js @@ -5,7 +5,7 @@ const factory = '0xA01C3d760738c79e10334408aE59684Aa36B1131' module.exports = { fantom:{ - tvl: uniTvlExport(factory, 'fantom'), + tvl: uniTvlExport(factory, 'fantom', true), staking: stakingPricedLP("0x72A7A3770B4BC999026F3663F1534581E0c59f2a", "0xd948efcc99be419ca9bdace89b2bec31edf13adb", 'fantom', "0x1758d21f2915583f49cc2b3e583df3e55f0dd2c0", "fantom") }, } diff --git a/projects/dinoexchange/index.js b/projects/dinoexchange/index.js index 6c05bffb287..e3f567e9045 100644 --- a/projects/dinoexchange/index.js +++ b/projects/dinoexchange/index.js @@ -7,7 +7,7 @@ const FACTORY_DINO = "0x35E9455c410EacD6B4Dc1D0ca3144031f6251Dc2"; module.exports = { bsc:{ - tvl: uniTvlExport(FACTORY_DINO, 'bsc'), - staking: staking(MASTER_DINO, DINO_TOKEN, "bsc") + tvl: uniTvlExport(FACTORY_DINO, 'bsc', true), + staking: staking(MASTER_DINO, DINO_TOKEN) }, } \ No newline at end of file diff --git a/projects/dinosaureggs/index.js b/projects/dinosaureggs/index.js index a8106201c6f..dc33f218955 100644 --- a/projects/dinosaureggs/index.js +++ b/projects/dinosaureggs/index.js @@ -3,5 +3,5 @@ const {uniTvlExport} = require("../helper/calculateUniTvl"); const factory = "0x73d9f93d53505cb8c4c7f952ae42450d9e859d10"; module.exports = { - bsc: { tvl: uniTvlExport(factory, 'bsc') } + bsc: { tvl: uniTvlExport(factory, 'bsc', true) } }; diff --git a/projects/duckydefi/index.js b/projects/duckydefi/index.js index df4fe890fe4..0c23ad6ae28 100644 --- a/projects/duckydefi/index.js +++ b/projects/duckydefi/index.js @@ -5,6 +5,6 @@ const duckyFactory = "0x796E38Bb00f39a3D39ab75297D8d6202505f52e2"; module.exports = { cronos: { - tvl: uniTvlExport(duckyFactory, "cronos") + tvl: uniTvlExport(duckyFactory, "cronos", true) } } diff --git a/projects/excalibur/index.js b/projects/excalibur/index.js index 285b4a69633..11de2b1a525 100644 --- a/projects/excalibur/index.js +++ b/projects/excalibur/index.js @@ -1,16 +1,7 @@ const {uniTvlExport} = require('../helper/calculateUniTvl') -function transformFantomAddress(addr){ - return ((addr) => { - if(addr === "0x846e4d51d7e2043c1a87e0ab7490b93fb940357b"){ // UST address - return 'ethereum:0xa693b19d2931d498c5b318df961919bb4aee87a5' - } - return `fantom:${addr}`; - }) -} - module.exports={ fantom:{ - tvl: uniTvlExport("0x08b3CCa975a82cFA6f912E0eeDdE53A629770D3f", "fantom", transformFantomAddress) + tvl: uniTvlExport("0x08b3CCa975a82cFA6f912E0eeDdE53A629770D3f", "fantom", true) } } diff --git a/projects/firebird/index.js b/projects/firebird/index.js index 69dac2a0862..702b458c15b 100644 --- a/projects/firebird/index.js +++ b/projects/firebird/index.js @@ -15,5 +15,5 @@ async function tvl(_, ethBlock, chainBlocks) { module.exports = { methodology: "Includes liquidity on all the pools on the uniswap fork plus the liquidity in the 3FBird stableswap pool", - polygon: { tvl: sdk.util.sumChainTvls([tvl, uniTvlExport(FACTORY, 'polygon')]) }, + polygon: { tvl: sdk.util.sumChainTvls([tvl, uniTvlExport(FACTORY, 'polygon', true)]) }, }; diff --git a/projects/fuzzfinance/index.js b/projects/fuzzfinance/index.js index 895c0866e84..0f4d72a4b17 100644 --- a/projects/fuzzfinance/index.js +++ b/projects/fuzzfinance/index.js @@ -22,7 +22,7 @@ async function staking(timestamp, block, chainBlocks) { module.exports = { methodology: `Counts the tokens locked on AMM pools from the factory contract.`, harmony: { - tvl: uniTvlExport(factory, 'harmony'), + tvl: uniTvlExport(factory, 'harmony', true), staking, }, }; diff --git a/projects/gravity-finance/index.js b/projects/gravity-finance/index.js index 0cbda11d308..340b7ca7447 100644 --- a/projects/gravity-finance/index.js +++ b/projects/gravity-finance/index.js @@ -4,6 +4,6 @@ module.exports = { methodology: `Counts the liquidity on all AMM pools. We get the TVL by first fetching all the PairCreated() events emitted by the factory contract in order to get all the pairs and then we get the amount of tokens on each pair by calling getReserves() on that pair's contract. Once we have the total amount locked of each token we just price them using coingecko, and, if coingecko doesn't have the price of one of the tokens we just exclude that token from the TVL.`, polygon: { - tvl: uniTvlExport('0x3ed75AfF4094d2Aaa38FaFCa64EF1C152ec1Cf20', 'polygon'), + tvl: uniTvlExport('0x3ed75AfF4094d2Aaa38FaFCa64EF1C152ec1Cf20', 'polygon', true), } }; diff --git a/projects/hakuswap/index.js b/projects/hakuswap/index.js index 1fb531d126f..995be403a6c 100644 --- a/projects/hakuswap/index.js +++ b/projects/hakuswap/index.js @@ -8,7 +8,7 @@ const XHAKU_ADDRESS = "0xa95C238B5a72f481f6Abd50f951F01891130b441"; module.exports = { avax:{ - tvl: uniTvlExport(FACTORY_ADDRESS, 'avax'), + tvl: uniTvlExport(FACTORY_ADDRESS, 'avax', true), staking: stakingUnknownPricedLP(XHAKU_ADDRESS, HAKU_TOKEN_ADDRESS, "avax", "0x7943Acd42c41a345841cB22Bd846794a22d8682d") }, misrepresentedTokens: true, diff --git a/projects/helper/calculateUniTvl.js b/projects/helper/calculateUniTvl.js index 62154b2efec..e44f04d00b1 100644 --- a/projects/helper/calculateUniTvl.js +++ b/projects/helper/calculateUniTvl.js @@ -1,6 +1,7 @@ const { getUniTVL } = require('./cache/uniswap') -function uniTvlExport(factory, chain, transformAddressOriginal = undefined, abis, options = {}) { +function uniTvlExport(factory, chain, useDefaultCoreAssets = false, abis, options = {}) { + if (useDefaultCoreAssets) options.useDefaultCoreAssets = true return getUniTVL({ chain, factory, abis, ...options }) } diff --git a/projects/hswap.js b/projects/hswap.js index 09c1082f445..9606a89dac5 100644 --- a/projects/hswap.js +++ b/projects/hswap.js @@ -2,6 +2,6 @@ const { uniTvlExport } = require("./helper/calculateUniTvl") module.exports = { heco: { - tvl: uniTvlExport('0x13D1EA691C8153F5bc9a491d41b927E2baF8A6b1', "heco") + tvl: uniTvlExport('0x13D1EA691C8153F5bc9a491d41b927E2baF8A6b1', "heco", true) } } \ No newline at end of file diff --git a/projects/jetswap/index.js b/projects/jetswap/index.js index 67197469050..30cf48c43cd 100644 --- a/projects/jetswap/index.js +++ b/projects/jetswap/index.js @@ -31,15 +31,15 @@ function staking(masterchef, token, chain) { module.exports = { bsc: { - tvl: uniTvlExport(bscFactory, 'bsc'), - staking: staking(MASTER_BSC, WINGS_TOKEN_BSC, "bsc"), + tvl: uniTvlExport(bscFactory, 'bsc', true), + staking: staking(MASTER_BSC, WINGS_TOKEN_BSC), }, polygon: { - tvl: uniTvlExport(polygonFactory, 'polygon'), - staking: staking(MASTER_POLYGON, WINGS_TOKEN_POLYGON, "polygon"), + tvl: uniTvlExport(polygonFactory, 'polygon', true), + staking: staking(MASTER_POLYGON, WINGS_TOKEN_POLYGON), }, fantom: { - tvl: uniTvlExport(fantomFactory, 'fantom'), - staking: staking(MASTER_FANTOM, WINGS_TOKEN_FANTOM, "fantom"), + tvl: uniTvlExport(fantomFactory, 'fantom', true), + staking: staking(MASTER_FANTOM, WINGS_TOKEN_FANTOM), }, }; diff --git a/projects/kaco/index.js b/projects/kaco/index.js index ca5117962a1..17ccace50d4 100644 --- a/projects/kaco/index.js +++ b/projects/kaco/index.js @@ -24,7 +24,7 @@ module.exports = { bsc: { staking: stakingUnknownPricedLP("0x81b71D0bC2De38e37978E6701C342d0b7AA67D59", "0xf96429A7aE52dA7d07E60BE95A3ece8B042016fB", "bsc", "0x315F25Cea80AC6c039B86e79Ffc46aE6b2e30922", addr=>`bsc:${addr}`), - tvl: uniTvlExport(KACFactory.bsc, 'bsc'), + tvl: uniTvlExport(KACFactory.bsc, 'bsc', true), }, shiden: { staking: staking( diff --git a/projects/knightswap/index.js b/projects/knightswap/index.js index 502113ca4c3..821c90e9864 100644 --- a/projects/knightswap/index.js +++ b/projects/knightswap/index.js @@ -15,7 +15,7 @@ const knightUsdcLP = "0x68D47D67b893c44A72BCAC39b1b658D4Cbdf87CA"; module.exports = { methodology: "TVL consists of pools created by the factory contract", bsc: { - tvl: uniTvlExport(bscFactory, 'bsc'), + tvl: uniTvlExport(bscFactory, 'bsc', true), staking: stakingUnknownPricedLP( bscStaking, bscKnight, @@ -25,7 +25,7 @@ module.exports = { ), }, fantom: { - tvl: uniTvlExport(ftmFactory, 'fantom'), + tvl: uniTvlExport(ftmFactory, 'fantom', true), staking: stakingUnknownPricedLP( ftmStaking, ftmKnight, diff --git a/projects/kronosdao/index.js b/projects/kronosdao/index.js index 88df2b35376..4505713cdad 100644 --- a/projects/kronosdao/index.js +++ b/projects/kronosdao/index.js @@ -9,7 +9,7 @@ const kronosBusdLP = "0xDBB34E29D345788273e85DE84814CfAA95c9c5f7"; module.exports = { methodology: "TVL consists of pools created by the factory contract", bsc: { - tvl: uniTvlExport(kronosFactory, 'bsc'), + tvl: uniTvlExport(kronosFactory, 'bsc', true), staking: stakingUnknownPricedLP( kRONOSMasterChef, kronosDaoToken, diff --git a/projects/latte/index.js b/projects/latte/index.js index 1eb10a819ae..a67c49695f5 100644 --- a/projects/latte/index.js +++ b/projects/latte/index.js @@ -34,7 +34,7 @@ async function staking(timestamp, block, chainBlocks) { module.exports = { bsc: { - tvl: uniTvlExport(factory, 'bsc'), + tvl: uniTvlExport(factory, 'bsc', true), staking, }, }; diff --git a/projects/levinswap/index.js b/projects/levinswap/index.js index 46db7b6a94e..9b4126fac09 100644 --- a/projects/levinswap/index.js +++ b/projects/levinswap/index.js @@ -7,7 +7,7 @@ const xlevin = "0xafa57Fb9d8D63Ff8124E17c1495C73bc3a7678D0"; module.exports = { xdai: { - tvl: uniTvlExport(factory, 'xdai'), + tvl: uniTvlExport(factory, 'xdai', true), staking: staking(xlevin, levin, "xdai") } } \ No newline at end of file diff --git a/projects/pandora-digital/index.js b/projects/pandora-digital/index.js index 097ad8e47ce..9f10805130b 100644 --- a/projects/pandora-digital/index.js +++ b/projects/pandora-digital/index.js @@ -4,7 +4,7 @@ const PANDORA_FACTORY = "0xFf9A4E72405Df3ca3D909523229677e6B2b8dC71" module.exports = { bsc:{ - tvl: uniTvlExport(PANDORA_FACTORY, 'bsc'), + tvl: uniTvlExport(PANDORA_FACTORY, 'bsc', true), }, methodology: "The TVL is the total of all liquidity pools on Pandora DEX", } \ No newline at end of file diff --git a/projects/pantherswap/index.js b/projects/pantherswap/index.js index 99a71bbd59f..31dfebfaade 100644 --- a/projects/pantherswap/index.js +++ b/projects/pantherswap/index.js @@ -5,5 +5,5 @@ const factory = "0x670f55c6284c629c23baE99F585e3f17E8b9FC31"; module.exports = { bsc: { - tvl: uniTvlExport(factory, 'bsc'), } + tvl: uniTvlExport(factory, 'bsc', true), } } diff --git a/projects/polydex/index.js b/projects/polydex/index.js index 0e2a9c7035f..e905ee63810 100644 --- a/projects/polydex/index.js +++ b/projects/polydex/index.js @@ -5,6 +5,6 @@ const FACTORY = '0xEAA98F7b5f7BfbcD1aF14D0efAa9d9e68D82f640'; module.exports = { polygon: { - tvl: uniTvlExport(FACTORY, 'polygon'), + tvl: uniTvlExport(FACTORY, 'polygon', true), } }; diff --git a/projects/pond/index.js b/projects/pond/index.js index 010234eb580..31a0901b3f9 100644 --- a/projects/pond/index.js +++ b/projects/pond/index.js @@ -4,6 +4,6 @@ const factory = "0x1d1f1A7280D67246665Bb196F38553b469294f3a"; module.exports = { fuse: { - tvl: uniTvlExport(factory, 'fuse'), + tvl: uniTvlExport(factory, 'fuse', true), } } \ No newline at end of file diff --git a/projects/ponyswap/index.js b/projects/ponyswap/index.js index 46f95b743c7..009a1d1de65 100644 --- a/projects/ponyswap/index.js +++ b/projects/ponyswap/index.js @@ -4,6 +4,6 @@ module.exports = { timetravel: true, start: 1678790700, arbitrum: { - tvl: uniTvlExport("0x66020547Ce3c861dec7632495D86e1b93dA6542c", "arbitrum"), + tvl: uniTvlExport("0x66020547Ce3c861dec7632495D86e1b93dA6542c", "arbitrum", true), }, }; \ No newline at end of file diff --git a/projects/protofi/index.js b/projects/protofi/index.js index 1dcc3fbe921..75fe468cc5b 100644 --- a/projects/protofi/index.js +++ b/projects/protofi/index.js @@ -2,6 +2,6 @@ const {uniTvlExport} = require('../helper/calculateUniTvl') module.exports={ fantom:{ - tvl: uniTvlExport("0x39720E5Fe53BEEeb9De4759cb91d8E7d42c17b76", "fantom") + tvl: uniTvlExport("0x39720E5Fe53BEEeb9De4759cb91d8E7d42c17b76", "fantom", true) } } \ No newline at end of file diff --git a/projects/tranquil/index.js b/projects/tranquil/index.js index e58a44ff23f..9778d78b9b3 100644 --- a/projects/tranquil/index.js +++ b/projects/tranquil/index.js @@ -129,7 +129,7 @@ module.exports = { harmony: { tvl: sdk.util.sumChainTvls([ tvl, - uniTvlExport('0xF166939E9130b03f721B0aE5352CCCa690a7726a', 'harmony'), + uniTvlExport('0xF166939E9130b03f721B0aE5352CCCa690a7726a', 'harmony', true), ]), borrowed: borrowed, pool2: pool2, diff --git a/projects/twindex/index.js b/projects/twindex/index.js index f50fba6db0f..44b14678398 100644 --- a/projects/twindex/index.js +++ b/projects/twindex/index.js @@ -20,7 +20,7 @@ async function poolsTvl(timestamp, ethBlock, chainBlocks) { module.exports = { misrepresentedTokens: true, bsc:{ - tvl: uniTvlExport(FACTORY_BSC, 'bsc'), + tvl: uniTvlExport(FACTORY_BSC, 'bsc', true), staking: poolsTvl }, methodology: "TVL comes from the DEX liquidity pools, staking TVL is accounted as the TWX on 0x41171D5770C4c68686d1aF042Ada88a45B02f82b", diff --git a/projects/vampireswap/index.js b/projects/vampireswap/index.js index 8e20f1aee34..86019c71b04 100644 --- a/projects/vampireswap/index.js +++ b/projects/vampireswap/index.js @@ -6,6 +6,6 @@ const factory = '0xdf0a0a62995ae821d7a5cf88c4112c395fc41358' module.exports = { fantom:{ staking: stakingPricedLP("0xa9d452E3CEA2b06d7DBE812A6C3ec81cf52334dD", "0x97058c0B5ff0E0E350e241EBc63b55906a9EADbc", "fantom", "0x8fa291be663a069e6289f844944752cd011ec719", "wrapped-fantom", false), - tvl:uniTvlExport(factory, 'fantom'), + tvl:uniTvlExport(factory, 'fantom', true), }, } \ No newline at end of file diff --git a/projects/velodrome-v2/index.js b/projects/velodrome-v2/index.js index e7bde1cf71e..06cff58a15c 100644 --- a/projects/velodrome-v2/index.js +++ b/projects/velodrome-v2/index.js @@ -1,11 +1,12 @@ const { uniTvlExport } = require('../helper/calculateUniTvl.js') module.exports = { + misrepresentedTokens: true, optimism: { tvl: uniTvlExport("0xF1046053aa5682b4F9a81b5481394DA16BE5FF5a", undefined, undefined, { allPairsLength: 'uint256:allPoolsLength', allPairs: 'function allPools(uint256) view returns (address)', - }, { fetchBalances: true, }), + }, { fetchBalances: true, useDefaultCoreAssets: true, hasStablePools: true, }), }, hallmarks: [ [1687465883, "v2 Migration on OP Mainnet"], // https://twitter.com/VelodromeFi/status/1671979216039202816 diff --git a/projects/velodrome/index.js b/projects/velodrome/index.js index ebd864d507b..9665ffd8bfb 100644 --- a/projects/velodrome/index.js +++ b/projects/velodrome/index.js @@ -3,7 +3,7 @@ const {uniTvlExport} = require('../helper/calculateUniTvl.js') module.exports = { misrepresentedTokens: true, optimism: { - tvl: uniTvlExport("0x25CbdDb98b35ab1FF77413456B31EC81A6B6B746"), + tvl: uniTvlExport("0x25CbdDb98b35ab1FF77413456B31EC81A6B6B746", undefined, true, undefined, { useDefaultCoreAssets: true, hasStablePools: true, }), }, hallmarks:[ [1657760400, "First OP grant awarded"], diff --git a/projects/viperswap/index.js b/projects/viperswap/index.js index 695e155e566..bb20492c95e 100644 --- a/projects/viperswap/index.js +++ b/projects/viperswap/index.js @@ -9,8 +9,8 @@ const xviper = "0xe064a68994e9380250cfee3e8c0e2ac5c0924548"; module.exports = { harmony: { - tvl: uniTvlExport(factory, 'harmony'), - staking: staking(xviper, viper, "harmony") + tvl: uniTvlExport(factory, 'harmony', true), + staking: staking(xviper, viper) }, hallmarks:[ [1655991120, "Horizon bridge Hack $100m"], diff --git a/projects/vultureswap/index.js b/projects/vultureswap/index.js index 047bb53a7ff..2c03cf2dd46 100644 --- a/projects/vultureswap/index.js +++ b/projects/vultureswap/index.js @@ -1,10 +1,10 @@ -const {uniTvlExport} = require("../helper/calculateUniTvl") +const { uniTvlExport } = require("../helper/calculateUniTvl") const factory = "0x45523BD2aB7E563E3a0F286be1F766e77546d579"; module.exports = { cronos: { - tvl:uniTvlExport(factory, 'cronos') + tvl: uniTvlExport(factory, 'cronos', true) } } \ No newline at end of file diff --git a/projects/wagmidao/index.js b/projects/wagmidao/index.js index a7eca0699ce..2c0bf2849cb 100644 --- a/projects/wagmidao/index.js +++ b/projects/wagmidao/index.js @@ -104,10 +104,9 @@ const Staking = async (chainBlocks) => { }; module.exports = { - timetravel: true, harmony: { staking: Staking, - tvl: sdk.util.sumChainTvls([uniTvlExport(factory, 'harmony'),]), + tvl: sdk.util.sumChainTvls([uniTvlExport(factory, 'harmony', true),]), }, methodology: "Counts liquidity on the Farms through Factory Contract, and counts Treasury as it is determined by bonding of assets. Staking refers to the staked GMI tokens", }; diff --git a/projects/wigoswap/index.js b/projects/wigoswap/index.js index e3cca72597c..36f4d5b22e3 100644 --- a/projects/wigoswap/index.js +++ b/projects/wigoswap/index.js @@ -22,6 +22,6 @@ module.exports = { methodology: 'The factory address (0xC831A5cBfb4aC2Da5ed5B194385DFD9bF5bFcBa7) is used find the pairs and sum the liquidity of the AMM. Staking accounts for the WIGO locked in MasterFarmer (0xA1a938855735C0651A6CfE2E93a32A28A236d0E9).', fantom: { staking, - tvl: uniTvlExport(factory, 'fantom') + tvl: uniTvlExport(factory, 'fantom', true) }, } \ No newline at end of file diff --git a/projects/wraithswap/index.js b/projects/wraithswap/index.js index 68487832450..5fbf90eb5e4 100644 --- a/projects/wraithswap/index.js +++ b/projects/wraithswap/index.js @@ -7,7 +7,7 @@ const wra = "0x4cf098d3775bd78a4508a13e126798da5911b6cd" module.exports = { fantom: { - tvl: uniTvlExport(factory, 'fantom'), + tvl: uniTvlExport(factory, 'fantom', true), staking: stakingUnknownPricedLP(masterchef, wra, "fantom", "0x6a80BD3eb550adcfF4f2f5f12a1bB213c1Ef57fA") } } \ No newline at end of file diff --git a/projects/youswap/index.js b/projects/youswap/index.js index 3ab5db2d0c8..cd23c1f4254 100644 --- a/projects/youswap/index.js +++ b/projects/youswap/index.js @@ -2,12 +2,12 @@ const { uniTvlExport } = require('../helper/calculateUniTvl'); module.exports = { heco: { - tvl: uniTvlExport('0x9f1cd0e59e78f5288e2fcf43030c9010d4f2991d', 'heco'), + tvl: uniTvlExport('0x9f1cd0e59e78f5288e2fcf43030c9010d4f2991d', 'heco', true), }, bsc: { - tvl: uniTvlExport('0x137f34df5bcdb30f5e858fc77cb7ab60f8f7a09a', 'bsc'), + tvl: uniTvlExport('0x137f34df5bcdb30f5e858fc77cb7ab60f8f7a09a', 'bsc', true), }, ethereum: { - tvl: uniTvlExport('0xa7028337d3da1f04d638cc3b4dd09411486b49ea', 'ethereum'), + tvl: uniTvlExport('0xa7028337d3da1f04d638cc3b4dd09411486b49ea', 'ethereum', true), }, } diff --git a/projects/zoodex/index.js b/projects/zoodex/index.js index f7ad62a300a..581fcbe7278 100644 --- a/projects/zoodex/index.js +++ b/projects/zoodex/index.js @@ -4,6 +4,6 @@ const factory = '0x6178C3B21F7cA1adD84c16AD35452c85a85F5df4' module.exports = { fantom:{ - tvl: uniTvlExport(factory, 'fantom'), + tvl: uniTvlExport(factory, 'fantom', true), }, } From ba44815911ed60f030da79a8f8760e7f7b216323 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 31 Jul 2023 10:24:39 +0200 Subject: [PATCH 0570/1974] use token labels --- projects/apollox/index.js | 4 +- projects/atlas-fi/index.js | 2 +- projects/buffer/index.js | 2 +- projects/coinscope/index.js | 3 +- projects/diamond-unibot-v2/index.js | 4 +- projects/dinotopia/index.js | 3 +- projects/fraxfinance/index.js | 1 + projects/gravity-bridge/index.js | 25 ++-- projects/helper/cex.js | 2 +- projects/helper/tokenMapping.js | 120 +++++++++---------- projects/helper/treasury.js | 3 +- projects/hex/index.js | 3 +- projects/kannagi-finance/index.js | 3 +- projects/kinesis/index.js | 2 +- projects/level/index.js | 4 +- projects/prime-protocol/index.js | 26 ++-- projects/reax-one-synth/index.js | 7 +- projects/rysk/index.js | 4 +- projects/scrubinvest/index.js | 15 +-- projects/shell/index.js | 2 +- projects/stUSDT/index.js | 3 +- projects/summer-fi/handlers/dpm-positions.js | 3 +- projects/synthex/index.js | 2 +- projects/thetanuts/index.js | 2 +- projects/treasury/abracadabra.js | 2 +- projects/treasury/ajira-pay-finance.js | 2 +- projects/treasury/arbitrum-dao.js | 3 +- projects/treasury/cryptodickbutts.js | 4 +- projects/treasury/empyreal.js | 2 +- projects/treasury/paraswap.js | 2 +- projects/treasury/savvy.js | 2 +- projects/treasury/stakedao.js | 2 +- projects/treasury/themis-capital-ohm.js | 3 +- projects/treasury/umamifinance.js | 2 +- projects/treasury/yield-guild-game.js | 4 +- projects/unidex/index.js | 14 +-- projects/vertex/index.js | 2 +- projects/weave/index.js | 3 +- projects/woofi.js | 4 +- projects/zigzag/index.js | 2 +- projects/zkasino/index.js | 2 +- 41 files changed, 157 insertions(+), 143 deletions(-) diff --git a/projects/apollox/index.js b/projects/apollox/index.js index 85e0e24846c..158e5a0d414 100644 --- a/projects/apollox/index.js +++ b/projects/apollox/index.js @@ -24,8 +24,8 @@ const TOKEN_BANANA = "0x603c7f932ED1fc6575303D8Fb018fDCBb0f39a95"; const TOKEN_MDX = "0x9c65ab58d8d978db963e63f2bfb7121627e3a739"; const TOKEN_HAY = "0x0782b6d8c4551B9760e74c0545a9bCD90bdc41E5"; -const TOKEN_BTC = "0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c"; -const TOKEN_BNB = "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c"; +const TOKEN_BTC = ADDRESSES.bsc.BTCB; +const TOKEN_BNB = ADDRESSES.bsc.WBNB; const TreasureTokens = [ // TOKEN_APX, diff --git a/projects/atlas-fi/index.js b/projects/atlas-fi/index.js index a3309fcd008..ae5bc8a97cc 100644 --- a/projects/atlas-fi/index.js +++ b/projects/atlas-fi/index.js @@ -16,7 +16,7 @@ async function tvl(_, _b, _cb, { api, }) { '0xd3204e4189becd9cd957046a8e4a643437ee0acc', '0xf52f079af080c9fb5afca57dde0f8b83d49692a9', ], VAULT], - [['0x912CE59144191C1204E64559FE8253a0e49E6548'], FARM_PROXY] + [[ADDRESSES.arbitrum.ARB], FARM_PROXY] ] }) } diff --git a/projects/buffer/index.js b/projects/buffer/index.js index 3da25c99357..f95bfa69d43 100644 --- a/projects/buffer/index.js +++ b/projects/buffer/index.js @@ -6,7 +6,7 @@ const tokens = { BFR: "0x1A5B0aaF478bf1FDA7b934c76E7692D722982a6D", USDC_ARB: ADDRESSES.arbitrum.USDC, USDC_POLY: ADDRESSES.polygon.USDC, - ARB: "0x912CE59144191C1204E64559FE8253a0e49E6548" + ARB: ADDRESSES.arbitrum.ARB }; const contracts = { diff --git a/projects/coinscope/index.js b/projects/coinscope/index.js index 773f5391bff..fef26fb8afa 100644 --- a/projects/coinscope/index.js +++ b/projects/coinscope/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumUnknownTokens } = require('../helper/unknownTokens') module.exports = { @@ -29,7 +30,7 @@ Object.keys(lockerFactories).forEach(chain => { result = await api.call({ abi: abi.getTokens, target: factory, - params: [true, page, fetchLength, "0x0000000000000000000000000000000000000000",], + params: [true, page, fetchLength, ADDRESSES.null,], }) tokensAndOwners.push(...result.pageTokens.map(i => i.lockerAddresses.map(j => [i.tokenAddress, j]))) ++page diff --git a/projects/diamond-unibot-v2/index.js b/projects/diamond-unibot-v2/index.js index 8e97c7ad9cf..d4fd33284e8 100644 --- a/projects/diamond-unibot-v2/index.js +++ b/projects/diamond-unibot-v2/index.js @@ -13,7 +13,7 @@ const config = { "0xFEaDE428e2Fe0F547d560B540a7617087505538B", ], // USDC [ - "0x912ce59144191c1204e64559fe8253a0e49e6548", + ADDRESSES.arbitrum.ARB, "0x4d5043d90f13ac2E6318B3aF9C3423A5224b920C", ], // ARB ], @@ -22,7 +22,7 @@ const config = { [ ADDRESSES.arbitrum.USDC, // USDC ADDRESSES.arbitrum.GMX, // GMX - "0x912ce59144191c1204e64559fe8253a0e49e6548", // ARB + ADDRESSES.arbitrum.ARB, // ARB ], "0x8610D60f5329B0560c8F0CEb80175F342fe943F3", // vault ], diff --git a/projects/dinotopia/index.js b/projects/dinotopia/index.js index 1598163f849..af8b7150c90 100644 --- a/projects/dinotopia/index.js +++ b/projects/dinotopia/index.js @@ -1,9 +1,10 @@ +const ADDRESSES = require('../helper/coreAssets.json') const Abis = require("./abi.json"); const { sumTokensExport, sumUnknownTokens, } = require('../helper/unknownTokens') const Contracts = { bsc: { - wbnb: "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c", + wbnb: ADDRESSES.bsc.WBNB, brx: "0xe550c560a895d043E5EEd2bC7eC8A8e46c2408D6", fossil: "0xfE8FFB60a2B6d46102caa35739Be465E600D0f5E", bank: "0xF90c0b409001b97067c539693754008456f6C265", diff --git a/projects/fraxfinance/index.js b/projects/fraxfinance/index.js index 66c70cc6a50..0bc23dc4264 100644 --- a/projects/fraxfinance/index.js +++ b/projects/fraxfinance/index.js @@ -142,6 +142,7 @@ async function addInvestorAMO(api, balances) { Synapse: '0x0f2d719407fdbeff09d87557abb7232601fd9f29', 'Wrapped BTC': ADDRESSES.ethereum.WBTC, 'USD Coin': ADDRESSES.ethereum.USDC, + 'PAX': '0x8e870d67f660d95d5be530380d0ec0bd388289e1', ZigZag: '0xc91a71a1ffa3d8b22ba615ba1b9c01b2bbbf55ad', 'Governance OHM': '0x0ab87046fbb341d058f17cbc4c1133f25a20a52f', 'Aave interest bearing USDC': '0xbcca60bb61934080951369a648fb03df4f96263c', diff --git a/projects/gravity-bridge/index.js b/projects/gravity-bridge/index.js index 7854d1719af..af4c607773b 100644 --- a/projects/gravity-bridge/index.js +++ b/projects/gravity-bridge/index.js @@ -1,13 +1,14 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { getBalance2 } = require("../helper/chain/cosmos.js"); const { sumTokensExport } = require('../helper/unwrapLPs') const erc20Contracts = [ - "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC - "0xdAC17F958D2ee523a2206206994597C13D831ec7", // USDT - "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", // WBTC - "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", // WETH - "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0", // wstETH + ADDRESSES.ethereum.USDC, // USDC + ADDRESSES.ethereum.USDT, // USDT + ADDRESSES.ethereum.WBTC, // WBTC + ADDRESSES.ethereum.WETH, // WETH + ADDRESSES.ethereum.WSTETH, // wstETH "0xEa5A82B35244d9e5E48781F00b11B14E627D2951", // ATOM "0xd2877702675e6cEb975b4A1dFf9fb7BAF4C91ea9", // WLUNC "0xfB5c6815cA3AC72Ce9F5006869AE67f18bF77006", // pSTAKE @@ -17,10 +18,10 @@ const erc20Contracts = [ "0x817bbDbC3e8A1204f3691d14bB44992841e3dB35", // CUDOS "0x467719aD09025FcC6cF6F8311755809d45a5E5f3", // AXL "0x77E06c9eCCf2E797fd462A92B6D7642EF85b0A44", // WTAO - "0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE", // SHIB + ADDRESSES.ethereum.INU, // SHIB "0x35a532d376FFd9a705d0Bb319532837337A398E7", // WDOGE "0x93581991f68DBaE1eA105233b67f7FA0D6BDeE7b", // WEVMOS - "0x514910771AF9Ca656af840dff83E8264EcF986CA", // LINK + ADDRESSES.ethereum.LINK, // LINK "0xa670d7237398238DE01267472C6f13e5B8010FD1", // SOMM "0xd3E4Ba569045546D09CF021ECC5dFe42b1d7f6E4", // MNW "0xd23Ed8cA350CE2631F7EcDC5E6bf80D0A1DeBB7B", // PLQ @@ -28,19 +29,19 @@ const erc20Contracts = [ "0xA0b73E1Ff0B80914AB6fe0444E65848C4C34450b", // CRO "0xe28b3B32B6c345A34Ff64674606124Dd5Aceca30", // INJ "0x4c11249814f11b9346808179Cf06e71ac328c1b5", // ORAI - "0x4Fabb145d64652a948d72533023f6E7A623C7C53", // BUSD + ADDRESSES.ethereum.BUSD, // BUSD "0x147faF8De9d8D8DAAE129B187F0D02D819126750", // GEO - "0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84", // stETH + ADDRESSES.ethereum.STETH, // stETH "0xD8912C10681D8B21Fd3742244f44658dBA12264E", // PLU "0x4f6103BAd230295baCF30f914FDa7D4273B7F585", // KI "0xed0d5747A9AB03a75fBfEC3228cd55848245B75d", // NGM - "0x7D1AfA7B718fb893dB30A3aBc0Cfc608AaCfeBB0", // MATIC + ADDRESSES.ethereum.MATIC, // MATIC "0x892A6f9dF0147e5f079b0993F486F9acA3c87881", //xFUND - "0x853d955aCEf822Db058eb8505911ED77F175b99e", //FRAX + ADDRESSES.ethereum.FRAX, //FRAX "0xaea46A60368A7bD060eec7DF8CBa43b7EF41Ad85", //FET "0x467719aD09025FcC6cF6F8311755809d45a5E5f3", //AXL "0x2B89bF8ba858cd2FCee1faDa378D5cd6936968Be", //WSCRT - "0x4Fabb145d64652a948d72533023f6E7A623C7C53", //BUSD + ADDRESSES.ethereum.BUSD, //BUSD "0x4c11249814f11b9346808179Cf06e71ac328c1b5", //ORAI "0xa693B19d2931d498c5B318dF961919BB4aee87a5", //WUST "0xBA11D00c5f74255f56a5E366F4F77f5A186d7f55", //BAND diff --git a/projects/helper/cex.js b/projects/helper/cex.js index 12bdbc7cd5f..ec7e42bf1a9 100644 --- a/projects/helper/cex.js +++ b/projects/helper/cex.js @@ -138,7 +138,7 @@ const defaultTokens = { '0x352Cb5E19b12FC216548a2677bD0fce83BaE434B', // BTT '0xAD29AbB318791D579433D831ed122aFeAf29dcfe', // FTM '0x02ff5065692783374947393723dba9599e59f591',// yoshi - '0x40af3827f39d0eacbf4a168f8d4ee67c121d11c9', //TUSD + ADDRESSES.bsc.TUSD, //TUSD ], eos: [ ["eosio.token", "EOS", "eos"], diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 8ce25e60c36..ba8c048c32f 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -49,7 +49,7 @@ const fixBalancesTokens = { // '0x83048f0bf34feed8ced419455a4320a735a92e9d': { coingeckoId: "ozonechain", decimals: 18 }, // was mapped to wrong chain }, telos: { - '0xdc2393dc10734bf153153038943a5deb42b209cd': { coingeckoId: "telos", decimals: 18 }, + [ADDRESSES.telos.WTLOS_1]: { coingeckoId: "telos", decimals: 18 }, }, } @@ -118,90 +118,90 @@ const eulerTokens = [ ] const anyswapTokenBlacklist = { - ethereum: ['0x4e15361fd6b4bb609fa63c81a2be19d873717870'], + ethereum: [ADDRESSES.ethereum.FTM], fantom: [ - '0x95bf7e307bc1ab0ba38ae10fc27084bc36fcd605', - '0x049d68029688eabf473097a2fc38ef61633a3c7a', - '0x04068da6c83afcfa0e13ba15a6696662335d5b75', - '0x049d68029688eabf473097a2fc38ef61633a3c7a', - '0x8d11ec38a3eb5e956b052f67da8bdc9bef8abf3e', - '0x82f0b8b456c1a451378467398982d4834b6829c1', - '0x7f620d7d0b3479b1655cefb1b0bc67fb0ef4e443' + ADDRESSES.fantom.anyUSDC, + ADDRESSES.fantom.fUSDT, + ADDRESSES.fantom.USDC, + ADDRESSES.fantom.fUSDT, + ADDRESSES.fantom.DAI, + ADDRESSES.fantom.MIM, + ADDRESSES.fantom.nICE ], - harmony: ['0xb12c13e66ade1f72f71834f2fc5082db8c091358'], + harmony: [ADDRESSES.harmony.AVAX], kcc: [ - '0xe3f5a90f9cb311505cd691a46596599aa1a0ad7d', - '0x639a647fbe20b6c8ac19e48e2de44ea792c62c5c', - '0xc9baa8cfdde8e328787e29b4b078abf2dadc2055', - '0x218c3c3d49d0e7b37aff0d8bb079de36ae61a4c0' + ADDRESSES.moonriver.USDC, + ADDRESSES.moonriver.ETH, + ADDRESSES.kcc.DAI, + ADDRESSES.kcc.WBTC ], moonriver: [ - '0xb44a9b6905af7c801311e8f4e76932ee959c663c', - '0xe3f5a90f9cb311505cd691a46596599aa1a0ad7d', - '0x639a647fbe20b6c8ac19e48e2de44ea792c62c5c' + ADDRESSES.moonriver.USDT, + ADDRESSES.moonriver.USDC, + ADDRESSES.moonriver.ETH ], - arbitrum: ['0xfea7a6a0b346362bf88a9e4a88416b77a57d6c2a'], + arbitrum: [ADDRESSES.arbitrum.MIM], shiden: [ - '0xfa9343c3897324496a05fc75abed6bac29f8a40f', - '0x818ec0a7fe18ff94269904fced6ae3dae6d6dc0b', - '0x735abe48e8782948a37c7765ecb76b98cde97b0f', - '0x765277eebeca2e31912c9946eae1021199b39c61', - '0x332730a4f6e03d9c55829435f10360e13cfa41ff', - '0x65e66a61d0a8f1e686c2d6083ad611a10d84d97a' + ADDRESSES.telos.ETH, + ADDRESSES.telos.USDC, + ADDRESSES.shiden.JPYC, + ADDRESSES.shiden.ETH, + ADDRESSES.dogechain.BUSD, + ADDRESSES.shiden.BUSD ], telos: [ - '0xfa9343c3897324496a05fc75abed6bac29f8a40f', - '0xf390830df829cf22c53c8840554b98eafc5dcbc2', - '0x818ec0a7fe18ff94269904fced6ae3dae6d6dc0b', - '0xefaeee334f0fd1712f9a8cc375f427d9cdd40d73' + ADDRESSES.telos.ETH, + ADDRESSES.telos.WBTC, + ADDRESSES.telos.USDC, + ADDRESSES.telos.USDT ], syscoin: [ - '0x2bf9b864cdc97b08b6d79ad4663e71b8ab65c45c', - '0x7c598c96d02398d89fbcb9d41eab3df0c16f227d', - '0x922d641a426dcffaef11680e5358f34d97d112e1' + ADDRESSES.syscoin.USDC, + ADDRESSES.syscoin.ETH, + ADDRESSES.syscoin.USDT ], - boba: ['0x461d52769884ca6235b685ef2040f47d30c94eb5'], + boba: [ADDRESSES.boba.BUSD], velas: [ - '0x639a647fbe20b6c8ac19e48e2de44ea792c62c5c', - '0xe3f5a90f9cb311505cd691a46596599aa1a0ad7d' + ADDRESSES.moonriver.ETH, + ADDRESSES.moonriver.USDC ], dogechain: [ - '0xb44a9b6905af7c801311e8f4e76932ee959c663c', - '0x332730a4f6e03d9c55829435f10360e13cfa41ff', - '0xdc42728b0ea910349ed3c6e1c9dc06b5fb591f98' + ADDRESSES.moonriver.USDT, + ADDRESSES.dogechain.BUSD, + ADDRESSES.dogechain.MATIC ], kava: [ - '0xfa9343c3897324496a05fc75abed6bac29f8a40f', - '0xb44a9b6905af7c801311e8f4e76932ee959c663c', - '0x818ec0a7fe18ff94269904fced6ae3dae6d6dc0b', - '0x765277eebeca2e31912c9946eae1021199b39c61', - '0x7c598c96d02398d89fbcb9d41eab3df0c16f227d', - '0xe3f5a90f9cb311505cd691a46596599aa1a0ad7d', - '0x332730a4f6e03d9c55829435f10360e13cfa41ff' + ADDRESSES.telos.ETH, + ADDRESSES.moonriver.USDT, + ADDRESSES.telos.USDC, + ADDRESSES.shiden.ETH, + ADDRESSES.syscoin.ETH, + ADDRESSES.moonriver.USDC, + ADDRESSES.dogechain.BUSD ], step: [ - '0xe3f5a90f9cb311505cd691a46596599aa1a0ad7d', - '0xfa9343c3897324496a05fc75abed6bac29f8a40f', - '0x818ec0a7fe18ff94269904fced6ae3dae6d6dc0b', - '0xefaeee334f0fd1712f9a8cc375f427d9cdd40d73' + ADDRESSES.moonriver.USDC, + ADDRESSES.telos.ETH, + ADDRESSES.telos.USDC, + ADDRESSES.telos.USDT ], godwoken_v1: [ - '0xe3f5a90f9cb311505cd691a46596599aa1a0ad7d', - '0x765277eebeca2e31912c9946eae1021199b39c61', - '0xfa9343c3897324496a05fc75abed6bac29f8a40f', - '0xb44a9b6905af7c801311e8f4e76932ee959c663c' + ADDRESSES.moonriver.USDC, + ADDRESSES.shiden.ETH, + ADDRESSES.telos.ETH, + ADDRESSES.moonriver.USDT ], - milkomeda_a1: ['0xfa9343c3897324496a05fc75abed6bac29f8a40f'], + milkomeda_a1: [ADDRESSES.telos.ETH], wemix: [ - '0x461d52769884ca6235b685ef2040f47d30c94eb5', - '0x765277eebeca2e31912c9946eae1021199b39c61', - '0xe3f5a90f9cb311505cd691a46596599aa1a0ad7d' + ADDRESSES.boba.BUSD, + ADDRESSES.shiden.ETH, + ADDRESSES.moonriver.USDC ], eos_evm: [ - '0x922d641a426dcffaef11680e5358f34d97d112e1', - '0x765277eebeca2e31912c9946eae1021199b39c61', - '0xfa9343c3897324496a05fc75abed6bac29f8a40f', - '0xefaeee334f0fd1712f9a8cc375f427d9cdd40d73' + ADDRESSES.syscoin.USDT, + ADDRESSES.shiden.ETH, + ADDRESSES.telos.ETH, + ADDRESSES.telos.USDT ] } diff --git a/projects/helper/treasury.js b/projects/helper/treasury.js index 227afc1df55..c8c22f74c83 100644 --- a/projects/helper/treasury.js +++ b/projects/helper/treasury.js @@ -1,8 +1,9 @@ +const ADDRESSES = require('./coreAssets.json') const { sumTokensExport, nullAddress, } = require('../helper/sumTokens') const { covalentGetTokens } = require('./http') const axios = require("axios") -const ARB = "0x912CE59144191C1204E64559FE8253a0e49E6548"; +const ARB = ADDRESSES.arbitrum.ARB; function treasuryExports(config) { const chains = Object.keys(config) diff --git a/projects/hex/index.js b/projects/hex/index.js index 7e62ef710c2..8a84d9e9a39 100644 --- a/projects/hex/index.js +++ b/projects/hex/index.js @@ -1,7 +1,8 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk") const abi = require('./abi.json') -const HEX = "0x2b591e99afe9f32eaa6214f7b7629768c40eeb39" +const HEX = ADDRESSES.pulse.HEX async function staking(timestamp, block){ const globalInfo = await sdk.api.abi.call({ target: HEX, diff --git a/projects/kannagi-finance/index.js b/projects/kannagi-finance/index.js index f46bb61a46f..56cfcd23b53 100644 --- a/projects/kannagi-finance/index.js +++ b/projects/kannagi-finance/index.js @@ -1,8 +1,9 @@ +const ADDRESSES = require('../helper/coreAssets.json') const abi = require("./abi.json"); const {yieldHelper} = require('../helper/yieldHelper'); const KANA_ADDRESS = "0x26aC1D9945f65392B8E4E6b895969b5c01A7B414"; const YIELD_ADDRESS= "0x6E415ba5a37761256D13E84B45f4822c179DEF47"; -const USDT_ADDRESS = "era:0x493257fd37edb34451f62edf8d2a0c418852ba4c"; +const USDT_ADDRESS = "era:" + ADDRESSES.era.USDT; function yieldHelperWrapper(){ diff --git a/projects/kinesis/index.js b/projects/kinesis/index.js index 380dad6823a..61f79cba1cc 100644 --- a/projects/kinesis/index.js +++ b/projects/kinesis/index.js @@ -46,7 +46,7 @@ const ceUSDT = ADDRESSES.evmos.ceUSDT; // Bridged Axelar Stablecoins const axlDAI = "0x4A2a90D444DbB7163B5861b772f882BbA394Ca67"; -const axlUSDC = "0x15C3Eb3B621d1Bff62CbA1c9536B7c1AE9149b57"; +const axlUSDC = ADDRESSES.evmos.AXL_USDC; const axlUSDT = "0xe01C6D4987Fc8dCE22988DADa92d56dA701d0Fe0"; // Bridged Gravity Stablecoins diff --git a/projects/level/index.js b/projects/level/index.js index ce27610d122..43ef7d3c924 100644 --- a/projects/level/index.js +++ b/projects/level/index.js @@ -22,9 +22,9 @@ const ContractsArb = { Tokens: { ETH: ADDRESSES.arbitrum.WETH, USDT: ADDRESSES.arbitrum.USDT, - USDC: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831", + USDC: ADDRESSES.arbitrum.USDC_CIRCLE, BTC: ADDRESSES.arbitrum.WBTC, - ARB: "0x912CE59144191C1204E64559FE8253a0e49E6548" + ARB: ADDRESSES.arbitrum.ARB } } async function arbtvl(_,b, _cb, { api, }) { diff --git a/projects/prime-protocol/index.js b/projects/prime-protocol/index.js index 3c770ad99c1..8b42aea6294 100644 --- a/projects/prime-protocol/index.js +++ b/projects/prime-protocol/index.js @@ -50,7 +50,7 @@ const MOONBEAM_MARKETS = { }, whWBTC_v2_v1_10_2: { pTokenMarketAddress: '0x2A104E502480b4e3C1D13EA2EC657C08f4578a7a', - pTokenUnderlyingAddress: '0xE57eBd2d67B462E9926e04a8e33f01cD0D64346D', + pTokenUnderlyingAddress: ADDRESSES.moonbeam.WBTC, } }; @@ -81,11 +81,11 @@ const AVALANCHE_MARKETS = { }, DAI_v2_v1_10_2: { pTokenMarketAddress: '0x05f2B8EAc42c9Cc771B8ECF6448481A3802e08c6', - pTokenUnderlyingAddress: '0xd586E7F844cEa2F87f50152665BCbc2C279D8d70', + pTokenUnderlyingAddress: ADDRESSES.avax.DAI, }, bBTC_v2_v1_10_2: { pTokenMarketAddress: '0xA5c74A10B60f276F806468c6E2f83D490dCfA89A', - pTokenUnderlyingAddress: '0x152b9d0FdC40C096757F570A51E494bd4b943E50', + pTokenUnderlyingAddress: ADDRESSES.avax.BTC_b, }, }; @@ -108,15 +108,15 @@ const ARBITRUM_MARKETS = { }, DAI_v2_v1_10_2: { pTokenMarketAddress: '0x3e1C8203B8D36E8E427Ee181A65549fd86AE3907', - pTokenUnderlyingAddress: '0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1', + pTokenUnderlyingAddress: ADDRESSES.optimism.DAI, }, WBTC_v2_v1_10_2: { pTokenMarketAddress: '0x51Ff97d92683992AD091E04470069bB942219D71', - pTokenUnderlyingAddress: '0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f', + pTokenUnderlyingAddress: ADDRESSES.arbitrum.WBTC, }, nativeUSDC_v1_v1_10_2: { pTokenMarketAddress: '0xA44C28Bd4Fd4fc307f23B2E6e9cC07BC03571798', - pTokenUnderlyingAddress: '0xaf88d065e77c8cC2239327C5EDb3A432268e5831', + pTokenUnderlyingAddress: ADDRESSES.arbitrum.USDC_CIRCLE, }, }; @@ -150,11 +150,11 @@ const ETHEREUM_MARKETS = { const BSC_MARKETS = { USDC_v2_v1_10_2: { pTokenMarketAddress: '0xc01683398fFCc86264ba17bC36977f51A1d25e06', - pTokenUnderlyingAddress: '0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d', + pTokenUnderlyingAddress: ADDRESSES.bsc.USDC, }, USDT_v2_v1_10_2: { pTokenMarketAddress: '0xddC6Df52F9749ED80966Fb6a9D4C87264cC1e6C1', - pTokenUnderlyingAddress: '0x55d398326f99059fF775485246999027B3197955', + pTokenUnderlyingAddress: ADDRESSES.bsc.USDT, }, BNB_v2_v1_10_2: { pTokenMarketAddress: '0xaCD7a2991f3514E215034Ace732Bafe005185C94', @@ -162,26 +162,26 @@ const BSC_MARKETS = { }, BTCB_v2_v1_10_2: { pTokenMarketAddress: '0xA7BCF4433e044e454c43fe596C9eE8DDAF5776aC', - pTokenUnderlyingAddress: '0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c', + pTokenUnderlyingAddress: ADDRESSES.bsc.BTCB, }, ETH_v2_v1_10_2: { pTokenMarketAddress: '0xBdDc67911C63f63e6720A8EEfCAF08a573Fd9AE4', - pTokenUnderlyingAddress: '0x2170Ed0880ac9A755fd29B2688956BD959F933F8', + pTokenUnderlyingAddress: ADDRESSES.bsc.ETH, }, }; const POLYGON_POS_MARKETS = { USDC_v1_v1_10_2: { pTokenMarketAddress: '0x45913B2088E2910C3Dd168c2f08eaf2274D7bf6c', - pTokenUnderlyingAddress: '0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174', + pTokenUnderlyingAddress: ADDRESSES.polygon.USDC, }, USDT_v1_v1_10_2: { pTokenMarketAddress: '0x2ce0Ac2FD666a93b70fbE731C9Fe6581f410F73B', - pTokenUnderlyingAddress: '0xc2132D05D31c914a87C6611C10748AEb04B58e8F', + pTokenUnderlyingAddress: ADDRESSES.polygon.USDT, }, WBTC_v1_v1_10_2: { pTokenMarketAddress: '0x786D8B5d16171f441BC5F2047bDf0Ea54268a735', - pTokenUnderlyingAddress: '0x1bfd67037b42cf73acf2047067bd4f2c47d9bfd6', + pTokenUnderlyingAddress: ADDRESSES.polygon.WBTC, }, }; diff --git a/projects/reax-one-synth/index.js b/projects/reax-one-synth/index.js index ed44820be5d..5c66fb96bb9 100644 --- a/projects/reax-one-synth/index.js +++ b/projects/reax-one-synth/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokensExport } = require('../helper/unwrapLPs') module.exports = { @@ -5,10 +6,10 @@ module.exports = { tvl: sumTokensExport({ owner: '0x78B2fa94A94bF3E96fcF9CE965bed55bE49FA9E7', tokens: [ - '0xdEAddEaDdeadDEadDEADDEAddEADDEAddead1111', - '0x201EBa5CC46D216Ce6DC03F6a759e8E766e956aE', + ADDRESSES.mantle.WETH, + ADDRESSES.mantle.USDT, '0xCAbAE6f6Ea1ecaB08Ad02fE02ce9A44F09aebfA2', - '0x78c1b0c915c4faa5fffa6cabf0219da63d7f4cb8' + ADDRESSES.mantle.WMNT ] }), } diff --git a/projects/rysk/index.js b/projects/rysk/index.js index f76bef041b3..ddf047b693f 100644 --- a/projects/rysk/index.js +++ b/projects/rysk/index.js @@ -15,9 +15,9 @@ async function tvl(_, _b, _cb, { api, }) { return sumTokens2({ api, balances, tokensAndOwners: [ [ADDRESSES.arbitrum.USDC, '0xc10b976c671ce9bff0723611f01422acbae100a5'], // LP alpha - ["0xaf88d065e77c8cC2239327C5EDb3A432268e5831", '0x217749d9017cB87712654422a1F5856AAA147b80'], // LP beyond USDC native + [ADDRESSES.arbitrum.USDC_CIRCLE, '0x217749d9017cB87712654422a1F5856AAA147b80'], // LP beyond USDC native [ADDRESSES.arbitrum.USDC, '0xb9F33349db1d0711d95c1198AcbA9511B8269626'], // marginPool - ["0xaf88d065e77c8cC2239327C5EDb3A432268e5831", '0xb9F33349db1d0711d95c1198AcbA9511B8269626'], // marginPool USDC native + [ADDRESSES.arbitrum.USDC_CIRCLE, '0xb9F33349db1d0711d95c1198AcbA9511B8269626'], // marginPool USDC native [ADDRESSES.arbitrum.WETH, '0xb9F33349db1d0711d95c1198AcbA9511B8269626'], // marginPool ] }) diff --git a/projects/scrubinvest/index.js b/projects/scrubinvest/index.js index b2eea9d54fb..eae68ef0d16 100644 --- a/projects/scrubinvest/index.js +++ b/projects/scrubinvest/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumUnknownTokens } = require("../helper/unknownTokens"); async function tvl(_, _b, _cb, { api, }) { @@ -38,13 +39,13 @@ async function tvl(_, _b, _cb, { api, }) { ['0x350c4A0aC240755Bb6432FeB907eCAFbbBc75770', '0xC05021F3b3601BF33aB59dc75577B85985ACaab7'], ['0x8E00102d96b34BEF29F3E1e0e5DBd0a611Cac312', '0x6d81FcA3abD89Bd89D400281aE5f1Ee0D62Cd16f'], // also count base assets if available - ['0xfA9343C3897324496A05fC75abeD6bAC29f8A40f', '0xcd017B495DF1dE2DC8069b274e2ddfBB78561176'], - ['0xB44a9B6905aF7c801311e8F4E76932ee959c663C', '0x88555c4d8e53ffB223aB5baDe0B5e6B2Cd3966c4'], - ['0x765277EebeCA2e31912C9946eAe1021199B39C61', '0xB4Ba7ba722eacAE8f1e4c6213AF05b5E8B27dbdB'], - ['0xc86c7C0eFbd6A49B35E8714C5f59D99De09A225b', '0xB9774bB2A18Af59Ec9bf86dCaeC07473A2D2F230'], - ['0xe3f5a90f9cb311505cd691a46596599aa1a0ad7d', '0x3CcA2C0d433E00433082ba16e968CA11dA6Dc156'], - ['0xe3f5a90f9cb311505cd691a46596599aa1a0ad7d', '0x1504B9EDdD57Ed8252b3b3b407DdE27B72A80790'], - ['0xc86c7C0eFbd6A49B35E8714C5f59D99De09A225b', '0xC05021F3b3601BF33aB59dc75577B85985ACaab7'], + [ADDRESSES.telos.ETH, '0xcd017B495DF1dE2DC8069b274e2ddfBB78561176'], + [ADDRESSES.moonriver.USDT, '0x88555c4d8e53ffB223aB5baDe0B5e6B2Cd3966c4'], + [ADDRESSES.shiden.ETH, '0xB4Ba7ba722eacAE8f1e4c6213AF05b5E8B27dbdB'], + [ADDRESSES.kava.WKAVA, '0xB9774bB2A18Af59Ec9bf86dCaeC07473A2D2F230'], + [ADDRESSES.moonriver.USDC, '0x3CcA2C0d433E00433082ba16e968CA11dA6Dc156'], + [ADDRESSES.moonriver.USDC, '0x1504B9EDdD57Ed8252b3b3b407DdE27B72A80790'], + [ADDRESSES.kava.WKAVA, '0xC05021F3b3601BF33aB59dc75577B85985ACaab7'], // New Scrub Pool ['0x471F79616569343e8e84a66F342B7B433b958154', '0x67041094c4fc1492A1AB988Fb8De0ab4A0a4A080'], diff --git a/projects/shell/index.js b/projects/shell/index.js index c66fc552090..76706ae431a 100644 --- a/projects/shell/index.js +++ b/projects/shell/index.js @@ -7,7 +7,7 @@ const USDC_CONTRACT = ADDRESSES.arbitrum.USDC; const USDT_CONTRACT = ADDRESSES.arbitrum.USDT; const WBTC_CONTRACT = ADDRESSES.arbitrum.WBTC; const WSTETH_CONTRACT = '0x5979D7b546E38E414F7E9822514be443A4800529'; -const ARB_CONTRACT = '0x912ce59144191c1204e64559fe8253a0e49e6548'; +const ARB_CONTRACT = ADDRESSES.arbitrum.ARB; const TOKEN_CONTRACTS = [ DAI_CONTRACT, diff --git a/projects/stUSDT/index.js b/projects/stUSDT/index.js index cd4ac290b68..93d9199fe84 100644 --- a/projects/stUSDT/index.js +++ b/projects/stUSDT/index.js @@ -1,9 +1,10 @@ +const ADDRESSES = require('../helper/coreAssets.json') module.exports = { tron: { tvl: async (_, _b, _cb, { api, }) => { const supply = await api.call({ abi: "erc20:totalSupply", target: "TThzxNRLrW2Brp9DcTQU8i4Wd9udCWEdZ3" }) return { - "0xdac17f958d2ee523a2206206994597c13d831ec7": supply/1e12 + [ADDRESSES.ethereum.USDT]: supply/1e12 } } } diff --git a/projects/summer-fi/handlers/dpm-positions.js b/projects/summer-fi/handlers/dpm-positions.js index a5390f11cab..48b06e9370f 100644 --- a/projects/summer-fi/handlers/dpm-positions.js +++ b/projects/summer-fi/handlers/dpm-positions.js @@ -1,9 +1,10 @@ +const ADDRESSES = require('../../helper/coreAssets.json') const BigNumber = require("bignumber.js"); const { blockQuery } = require("../../helper/http"); const { endpoints } = require("../constants/endpoints"); const NEGATIVE_WAD_PRECISION = -18; -const WETH_ADDRESS = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"; +const WETH_ADDRESS = ADDRESSES.ethereum.WETH; const aaveQuery = (block) => ` query { diff --git a/projects/synthex/index.js b/projects/synthex/index.js index 228326c2ab6..88364890f12 100644 --- a/projects/synthex/index.js +++ b/projects/synthex/index.js @@ -5,7 +5,7 @@ const poolC = '0x8d6E834277E4f513BacF83B0A87524c913eF8691'; const poolF = "0x0546458d110Dff9D394C0F4621423Bc8f009A779"; const USDC = ADDRESSES.arbitrum.USDC; const WBTC = ADDRESSES.arbitrum.WBTC; -const ARB = "0x912CE59144191C1204E64559FE8253a0e49E6548"; +const ARB = ADDRESSES.arbitrum.ARB; const ETH = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE"; const WETH = ADDRESSES.arbitrum.WETH; const USDT = ADDRESSES.arbitrum.USDT; diff --git a/projects/thetanuts/index.js b/projects/thetanuts/index.js index 0e32d6ffc4d..6e70fb30a1e 100644 --- a/projects/thetanuts/index.js +++ b/projects/thetanuts/index.js @@ -111,7 +111,7 @@ let boba = ADDRESSES.boba.BOBA const bobaUSDC = ADDRESSES.boba.USDC // Arbitrum assets -let arb = '0x912ce59144191c1204e64559fe8253a0e49e6548' +let arb = ADDRESSES.arbitrum.ARB // zkEVM assets const stMatic = '0x83b874c1e09D316059d929da402dcB1A98e92082'; diff --git a/projects/treasury/abracadabra.js b/projects/treasury/abracadabra.js index e465ad52b3d..3f3a8cf07e7 100644 --- a/projects/treasury/abracadabra.js +++ b/projects/treasury/abracadabra.js @@ -39,7 +39,7 @@ module.exports = treasuryExports({ arbitrum: { tokens: [ nullAddress, - "0x912CE59144191C1204E64559FE8253a0e49E6548", // ARB + ADDRESSES.arbitrum.ARB, // ARB ADDRESSES.arbitrum.MIM, // MIM ADDRESSES.arbitrum.USDC, // USDC ADDRESSES.arbitrum.USDT, // USDT diff --git a/projects/treasury/ajira-pay-finance.js b/projects/treasury/ajira-pay-finance.js index 8aa94fa4c7f..22270a79d3e 100644 --- a/projects/treasury/ajira-pay-finance.js +++ b/projects/treasury/ajira-pay-finance.js @@ -6,7 +6,7 @@ const arb_tokens = [ ADDRESSES.arbitrum.USDC, ADDRESSES.arbitrum.WETH, ADDRESSES.arbitrum.WBTC, ADDRESSES.arbitrum.USDT, ADDRESSES.optimism.DAI, '0x9DBC0Ad09184226313FbDe094E7c3DD75c94f997', - '0x912CE59144191C1204E64559FE8253a0e49E6548', + ADDRESSES.arbitrum.ARB, nullAddress ] diff --git a/projects/treasury/arbitrum-dao.js b/projects/treasury/arbitrum-dao.js index 7503df37b3e..e2fa9c2417e 100644 --- a/projects/treasury/arbitrum-dao.js +++ b/projects/treasury/arbitrum-dao.js @@ -1,7 +1,8 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { nullAddress, treasuryExports } = require("../helper/treasury"); const treasury = "0xf3fc178157fb3c87548baa86f9d24ba38e649b58"; -const ARB = "0x912CE59144191C1204E64559FE8253a0e49E6548"; +const ARB = ADDRESSES.arbitrum.ARB; module.exports = treasuryExports({ arbitrum: { diff --git a/projects/treasury/cryptodickbutts.js b/projects/treasury/cryptodickbutts.js index f45297dcccd..49da62aeae8 100644 --- a/projects/treasury/cryptodickbutts.js +++ b/projects/treasury/cryptodickbutts.js @@ -11,10 +11,10 @@ module.exports = treasuryExports({ nullAddress, ADDRESSES.ethereum.USDT,//TETHER ADDRESSES.ethereum.USDC,//USDC - "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + ADDRESSES.ethereum.WETH, "0x6d3D490964205c8bC8DeD39e48e88E8Fde45b41f", "0x0000000000A39bb272e79075ade125fd351887Ac", - "0x6B175474E89094C44Da98b954EedeAC495271d0F" + ADDRESSES.ethereum.DAI ], owners: [treasury], ownTokens: [dick], diff --git a/projects/treasury/empyreal.js b/projects/treasury/empyreal.js index 8ab7f54d84b..f2a5674abc2 100644 --- a/projects/treasury/empyreal.js +++ b/projects/treasury/empyreal.js @@ -11,7 +11,7 @@ module.exports = treasuryExports({ arbitrum: { tokens: [ nullAddress, - "0x912CE59144191C1204E64559FE8253a0e49E6548", //ARB + ADDRESSES.arbitrum.ARB, //ARB ADDRESSES.arbitrum.USDC, //USDC ], owners: [treasury], diff --git a/projects/treasury/paraswap.js b/projects/treasury/paraswap.js index 5b27543c2c4..6ea4c70f4a2 100644 --- a/projects/treasury/paraswap.js +++ b/projects/treasury/paraswap.js @@ -26,7 +26,7 @@ module.exports = treasuryExports({ }, arbitrum: { tokens: [ - "0x912ce59144191c1204e64559fe8253a0e49e6548" + ADDRESSES.arbitrum.ARB ], owners: ["0xfe98240ddAEDF78E278C28F1EdD690ee1a774e66"], }, diff --git a/projects/treasury/savvy.js b/projects/treasury/savvy.js index 4aa3e9e0adf..2ce17b21a62 100644 --- a/projects/treasury/savvy.js +++ b/projects/treasury/savvy.js @@ -10,7 +10,7 @@ module.exports = treasuryExports({ ADDRESSES.arbitrum.USDC, ADDRESSES.arbitrum.WBTC, ADDRESSES.arbitrum.WETH, - '0xaf88d065e77c8cC2239327C5EDb3A432268e5831' + ADDRESSES.arbitrum.USDC_CIRCLE ], owners: [treasury,], ownTokens: [SVY], diff --git a/projects/treasury/stakedao.js b/projects/treasury/stakedao.js index 2245cf21579..c091f6d25d5 100644 --- a/projects/treasury/stakedao.js +++ b/projects/treasury/stakedao.js @@ -81,7 +81,7 @@ const polyTokens = [ const arbTokens = [ nullAddress, - "0x912CE59144191C1204E64559FE8253a0e49E6548", //arb + ADDRESSES.arbitrum.ARB, //arb "0x11cDb42B0EB46D95f990BeDD4695A6e3fA034978", //crv ] diff --git a/projects/treasury/themis-capital-ohm.js b/projects/treasury/themis-capital-ohm.js index 5efc3bdfaa0..455b1de5be8 100644 --- a/projects/treasury/themis-capital-ohm.js +++ b/projects/treasury/themis-capital-ohm.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokensExport } = require('../helper/unknownTokens') module.exports = { @@ -5,7 +6,7 @@ module.exports = { filecoin: { tvl: sumTokensExport({ owner: '0x0e511806C7AC38cF6d1EeAa9Ee51027e44Dcbf94', - tokens: ['0x422849B355039bC58F2780cc4854919fC9cfaF94', '0x45680718F6BdB7Ec3A7dF7D61587aC7C3fB49d50'], + tokens: [ADDRESSES.filecoin.USDT, '0x45680718F6BdB7Ec3A7dF7D61587aC7C3fB49d50'], useDefaultCoreAssets: true, }) }, diff --git a/projects/treasury/umamifinance.js b/projects/treasury/umamifinance.js index 1e1d8e10680..31ad7cfa380 100644 --- a/projects/treasury/umamifinance.js +++ b/projects/treasury/umamifinance.js @@ -26,7 +26,7 @@ module.exports = treasuryExports({ "0x55ff62567f09906a85183b866df84bf599a4bf70", // KROM "0x3d9907f9a368ad0a51be60f7da3b97cf940982d8", // GRAIL "0x3CAaE25Ee616f2C8E13C74dA0813402eae3F496b", // xGRAIL - "0x912CE59144191C1204E64559FE8253a0e49E6548", // ARB + ADDRESSES.arbitrum.ARB, // ARB "0x3e6648c5a70a150a88bce65f4ad4d506fe15d2af", //spell "0x10010078a54396f62c96df8532dc2b4847d47ed3", //hnd "0x32eb7902d4134bf98a28b963d26de779af92a212", //rpdx diff --git a/projects/treasury/yield-guild-game.js b/projects/treasury/yield-guild-game.js index 209fd1e80b4..d9d8cae7d2e 100644 --- a/projects/treasury/yield-guild-game.js +++ b/projects/treasury/yield-guild-game.js @@ -47,9 +47,9 @@ module.exports = treasuryExports({ }, polygon: { tokens: [ - "0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619", + ADDRESSES.polygon.WETH_1, "0x8dF3aad3a84da6b69A4DA8aeC3eA40d9091B2Ac4", - "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270", + ADDRESSES.polygon.WMATIC_2, "0x0b3F868E0BE5597D5DB7fEB59E1CADBb0fdDa50a" ], owners: [Treasury2, Treasury4], diff --git a/projects/unidex/index.js b/projects/unidex/index.js index 55bc1ec7abf..f290b1702d9 100644 --- a/projects/unidex/index.js +++ b/projects/unidex/index.js @@ -33,16 +33,16 @@ async function ArbitrumTvl(_time, _ethBlock, { arbitrum: block }) { "capPool": "0x99DDb3E66A592579B9D46a47824042F62D690a9e", "unshethPool": "0x5372Af9b4E9d4b9C016574Dad0f2406Dfe023D5F", }; - const usdc = "0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8"; - const dai = "0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1"; - const usdt = "0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9"; - const wbtc = "0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f"; - const arb = "0x912ce59144191c1204e64559fe8253a0e49e6548"; - const mim = "0xfea7a6a0b346362bf88a9e4a88416b77a57d6c2a"; + const usdc = ADDRESSES.arbitrum.USDC; + const dai = ADDRESSES.optimism.DAI; + const usdt = ADDRESSES.arbitrum.USDT; + const wbtc = ADDRESSES.arbitrum.WBTC; + const arb = ADDRESSES.arbitrum.ARB; + const mim = ADDRESSES.arbitrum.MIM; const gdai = "0xd85e038593d7a098614721eae955ec2022b9b91b"; const ram = "0xaaa6c1e32c55a7bfa8066a6fae9b42650f262418"; const mai = "0x5979D7b546E38E414F7E9822514be443A4800529"; - const gmx = "0xfc5a1a6eb076a2c7ad06ed22c90d7e710e35ad0a"; + const gmx = ADDRESSES.arbitrum.GMX; const wsteth = "0x5979D7b546E38E414F7E9822514be443A4800529"; const gns = "0x18c11FD286C5EC11c3b683Caa813B77f5163A122"; const cap = "0x031d35296154279dc1984dcd93e392b1f946737b"; diff --git a/projects/vertex/index.js b/projects/vertex/index.js index 5c2f9885e48..5aaf3dfc833 100644 --- a/projects/vertex/index.js +++ b/projects/vertex/index.js @@ -16,7 +16,7 @@ module.exports = { arbitrum: { tvl: sumTokensExport({ owners: [config.clearinghouse, config.endpoint], - tokens: [ADDRESSES.arbitrum.WBTC, ADDRESSES.arbitrum.WETH, ADDRESSES.arbitrum.USDC, "0x912ce59144191c1204e64559fe8253a0e49e6548"], + tokens: [ADDRESSES.arbitrum.WBTC, ADDRESSES.arbitrum.WETH, ADDRESSES.arbitrum.USDC, ADDRESSES.arbitrum.ARB], }) } } \ No newline at end of file diff --git a/projects/weave/index.js b/projects/weave/index.js index 1e9a03a6eb8..2412fc89137 100644 --- a/projects/weave/index.js +++ b/projects/weave/index.js @@ -1,5 +1,6 @@ +const ADDRESSES = require('../helper/coreAssets.json') -const WKAVA = '0xc86c7C0eFbd6A49B35E8714C5f59D99De09A225b'; +const WKAVA = ADDRESSES.kava.WKAVA; const STRATEGY_CONTRACT = '0x9633a42E4f73F465DD421b22C09E2787493DaAdA' async function tvl(_, _1, _2, { api }) { diff --git a/projects/woofi.js b/projects/woofi.js index eaecca27c0b..f3bd2151c28 100644 --- a/projects/woofi.js +++ b/projects/woofi.js @@ -38,9 +38,9 @@ const wooPPConfig = { ADDRESSES.arbitrum.WETH, // WETH ADDRESSES.arbitrum.WBTC, // WBTC '0xcAFcD85D8ca7Ad1e1C6F82F651fA15E33AEfD07b', // WOO - '0x912CE59144191C1204E64559FE8253a0e49E6548', // ARB + ADDRESSES.arbitrum.ARB, // ARB ADDRESSES.arbitrum.USDC, // USDC - '0xaf88d065e77c8cC2239327C5EDb3A432268e5831', // native USDC + ADDRESSES.arbitrum.USDC_CIRCLE, // native USDC ADDRESSES.arbitrum.USDT, ], optimism: [ diff --git a/projects/zigzag/index.js b/projects/zigzag/index.js index a5e9308fcdd..691d0a386eb 100644 --- a/projects/zigzag/index.js +++ b/projects/zigzag/index.js @@ -28,7 +28,7 @@ module.exports = { ADDRESSES.arbitrum.WETH, ADDRESSES.arbitrum.USDT, ADDRESSES.arbitrum.WBTC, - '0x912CE59144191C1204E64559FE8253a0e49E6548', + ADDRESSES.arbitrum.ARB, ADDRESSES.arbitrum.LINK, ]}) } diff --git a/projects/zkasino/index.js b/projects/zkasino/index.js index 2066ae9a539..c7c6831921c 100644 --- a/projects/zkasino/index.js +++ b/projects/zkasino/index.js @@ -24,7 +24,7 @@ const config = { tokens: [ADDRESSES.fantom.USDC, nullAddress,] }, arbitrum: { - tokens: [ADDRESSES.arbitrum.USDT, ADDRESSES.arbitrum.USDC, '0xADA42bb73b42e0472A994218fb3799dFCDA21237', '0x912CE59144191C1204E64559FE8253a0e49E6548', nullAddress,] + tokens: [ADDRESSES.arbitrum.USDT, ADDRESSES.arbitrum.USDC, '0xADA42bb73b42e0472A994218fb3799dFCDA21237', ADDRESSES.arbitrum.ARB, nullAddress,] } } From 4377ec442279816e407a077116cb39d5d63cd7d7 Mon Sep 17 00:00:00 2001 From: 0xngmi <80541789+0xngmi@users.noreply.github.com> Date: Mon, 31 Jul 2023 12:14:55 +0100 Subject: [PATCH 0571/1974] add hack event --- projects/curve/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/curve/index.js b/projects/curve/index.js index 665099ec94d..ac61aed4614 100644 --- a/projects/curve/index.js +++ b/projects/curve/index.js @@ -271,5 +271,6 @@ module.exports.hallmarks = [ [1642374675, "MIM depeg"], [1651881600, "UST depeg"], [1654822801, "stETH depeg"], - [1667692800, "FTX collapse"] + [1667692800, "FTX collapse"], + [1690715622, "Reentrancy hack"] ]; From 96fb4d8289fc78c5fdcba7ffbaa17c6cb8254ed6 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 31 Jul 2023 13:28:06 +0200 Subject: [PATCH 0572/1974] fix broken adapters --- package-lock.json | 12 +-- projects/alchemix/index.js | 2 +- projects/icpswap/index.js | 3 +- projects/polysynth/index.js | 15 ++-- projects/swapline/index.js | 4 +- projects/yaxis/index.js | 159 ++++-------------------------------- 6 files changed, 36 insertions(+), 159 deletions(-) diff --git a/package-lock.json b/package-lock.json index 155721c37f7..37383e00d9e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -63,9 +63,9 @@ } }, "node_modules/@defillama/sdk": { - "version": "4.0.42", - "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.42.tgz", - "integrity": "sha512-eP9eo82vmWUqnw6Xjz9rvoNDH/5QTQp7cXdZyQa6cYV/JGRZ4Yq05BuHtnIt0ngH7BJJ4UsjDN66nMFA3uN2vA==", + "version": "4.0.43", + "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.43.tgz", + "integrity": "sha512-SS311nPgkIOEbqWe3n2kT8n3UKyLQhQmJcEhlMhv6XnPhIBk4l7kLQXQmOYHpetAZmvUxOVnQwZbl75vh2EM5w==", "dependencies": { "@supercharge/promise-pool": "^2.1.0", "ethers": "^5.4.5", @@ -4194,9 +4194,9 @@ } }, "@defillama/sdk": { - "version": "4.0.42", - "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.42.tgz", - "integrity": "sha512-eP9eo82vmWUqnw6Xjz9rvoNDH/5QTQp7cXdZyQa6cYV/JGRZ4Yq05BuHtnIt0ngH7BJJ4UsjDN66nMFA3uN2vA==", + "version": "4.0.43", + "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.43.tgz", + "integrity": "sha512-SS311nPgkIOEbqWe3n2kT8n3UKyLQhQmJcEhlMhv6XnPhIBk4l7kLQXQmOYHpetAZmvUxOVnQwZbl75vh2EM5w==", "requires": { "@supercharge/promise-pool": "^2.1.0", "ethers": "^5.4.5", diff --git a/projects/alchemix/index.js b/projects/alchemix/index.js index 9b6c096de22..7b4c35d9f71 100644 --- a/projects/alchemix/index.js +++ b/projects/alchemix/index.js @@ -19,7 +19,7 @@ function tvl(chain) { alToken = alToken.toLowerCase() tokens.forEach((token, i) => { if (token.toLowerCase() !== alToken) { - api.add(token, tokenBalances[i] * ratio) + if (!isNaN(tokenBalances[i] * ratio))api.add(token, tokenBalances[i] * ratio) } }) }) diff --git a/projects/icpswap/index.js b/projects/icpswap/index.js index 245162d3f04..e0cfff7225b 100644 --- a/projects/icpswap/index.js +++ b/projects/icpswap/index.js @@ -10,7 +10,8 @@ module.exports = { async function tvl() { let tvl = 0 - const pairs = await get('https://uvevg-iyaaa-aaaak-ac27q-cai.raw.ic0.app/pairs') + let pairs = await get('https://uvevg-iyaaa-aaaak-ac27q-cai.raw.ic0.app/pairs') + if (typeof pairs === 'string') pairs = JSON.parse(pairs.replace('},]', '}]')) const { errors } = await PromisePool.withConcurrency(15) .for(pairs) diff --git a/projects/polysynth/index.js b/projects/polysynth/index.js index 5bba442ccb9..99aefd6f517 100644 --- a/projects/polysynth/index.js +++ b/projects/polysynth/index.js @@ -1,18 +1,17 @@ -const { getCache } = require('../helper/http'); +const { getConfig } = require('../helper/cache') const { sumTokens2 } = require('../helper/unwrapLPs') let _response; async function getVaults(chain) { - if (!_response) _response = getCache('https://h.oliveapp.finance/api/rest/vaults/tvl') + if (!_response) _response = getConfig('polysynth', 'https://fast-wren-87.hasura.app/api/rest/vaults/all/meta') return (await _response).vault_meta_data - .map(i => i.vault_object) .filter(i => i.chain_id === chains[chain]) } const chains = { - ethereum: '1', - polygon: '137', - arbitrum: '42161' + ethereum: 1, + polygon: 137, + arbitrum: 42161 } module.exports = {}; @@ -21,9 +20,9 @@ Object.keys(chains).forEach(chain => { module.exports[chain] = { tvl: async (_, _b, _cb, { api, }) => { const vaultData = await getVaults(chain) - const vaults = vaultData.map(i => i.id) + const vaults = vaultData.map(i => i.vault_address) const beefys = await api.multiCall({ abi: 'address:BEEFY_VAULT', calls: vaults, permitFailure: true, }) - const tokens = vaultData.map((v, i) => beefys[i] ? beefys[i] : v.underlying_asset) + const tokens = vaultData.map((v, i) => beefys[i] ? beefys[i] : v.asset_address) return sumTokens2({ api, tokensAndOwners2: [tokens, vaults] }) } } diff --git a/projects/swapline/index.js b/projects/swapline/index.js index e1b9a93133e..28dcf9c131e 100644 --- a/projects/swapline/index.js +++ b/projects/swapline/index.js @@ -8,6 +8,8 @@ const factories = { } async function tvl(_, _b, _cb, { api, }) { + let blacklistedTokens = [] + if (api.chain === 'fantom') blacklistedTokens = ['0xdc6ff44d5d932cbd77b52e5612ba0529dc6226f1'] const pools = await api.fetchList({ target: factories[api.chain], itemAbi: 'function getLBPairAtIndex(uint256) view returns (address)', @@ -26,7 +28,7 @@ async function tvl(_, _b, _cb, { api, }) { toa.push([tokenA[i], pools[i]]) toa.push([tokenB[i], pools[i]]) }) - return sumTokens2({...api, tokensAndOwners: toa, }) + return sumTokens2({...api, tokensAndOwners: toa, blacklistedTokens,}) } module.exports = { diff --git a/projects/yaxis/index.js b/projects/yaxis/index.js index 29d3b30870d..92680466484 100644 --- a/projects/yaxis/index.js +++ b/projects/yaxis/index.js @@ -1,3 +1,4 @@ +const { staking } = require('../helper/staking') const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const BigNumber = require("bignumber.js"); @@ -6,156 +7,30 @@ const { abi } = require("../yaxis/abi.js"); const constants = require("../yaxis/constants.js"); async function tvl(timestamp, block) { - const balances = {}; - - // 1. MetaVault (LEGACY v2) - LP-3POOL-CURVE - const metaVault = ( - await sdk.api.abi.call({ - target: constants.METAVAULT, - abi: abi.yAxisMetaVault, - block: block, - }) - ).output; - - sdk.util.sumSingleBalance( - balances, - constants.CURRENCIES["LP-3POOL-CURVE"], - metaVault - ); - - // 3. VAULTS - - const vaults = ( - await sdk.api.abi.multiCall({ - calls: constants.VAULTS.map(({ vaultTokenContract }) => ({ - target: vaultTokenContract, - })), - abi: "erc20:totalSupply", - block: block, - }) - ).output.map((val) => val.output); - - constants.VAULTS.map(async (vault, index) => { - sdk.util.sumSingleBalance(balances, vault.tokenContract, vaults[index]) - }) - - // Add ALETH eth balance - - const alethVault = ( - await sdk.api.erc20.totalSupply({ - target: "0xeF84fAc432846Ad5f6f1bD4caCcF2849e2818e66", - block, - }) - ).output; - - const crvTotalSupply = ( - await sdk.api.erc20.totalSupply({ - target: "0xC4C319E2D4d66CcA4464C0c2B32c9Bd23ebe784e", - block, - }) - ).output; - - const eth = ( - await sdk.api.eth.getBalance({ - target: "0xC4C319E2D4d66CcA4464C0c2B32c9Bd23ebe784e", - block, - }) - ).output; - - balances[ADDRESSES.null] = BigNumber(alethVault) - .multipliedBy(eth) - .dividedBy(crvTotalSupply) - .toFixed(0); - - return balances; -} - -async function pool2(time, block) { - const balances = {}; - // 4. LPs - const uniswapLPs = ( - await sdk.api.abi.multiCall({ - calls: constants.UNISWAP_LPS.map((lp) => ({ - target: lp.address, - params: [lp.staking] - })), - abi: "erc20:balanceOf", - block: block, - }) - ).output.map((val) => val.output); - - const lpPositions = []; - - constants.UNISWAP_LPS.forEach((lp, index) => { - lpPositions.push({ - balance: uniswapLPs[index], - token: lp.address, - }); - }); - - await unwrapUniswapLPs(balances, lpPositions, block); - - return balances + const { api } = arguments[3] + const token = await api.call({ abi: 'address:want', target: constants.METAVAULT}) + const bal = await api.call({ abi: 'uint256:balance', target: constants.METAVAULT}) + api.add(token, bal) + const tokens = await api.multiCall({ abi: 'address:token', calls: constants.VAULTS.map(v => v.vault)}) + const bals = await api.multiCall({ abi: 'uint256:balance', calls: constants.VAULTS.map(v => v.vault)}) + api.addTokens(tokens, bals) } -async function staking(time, block) { - const balances = {}; - - // 2. sYAX (LEGACY v1) - YAXIS - const sYAX = ( - await sdk.api.abi.call({ - target: constants.BAR, - abi: abi.yAxisBar, - block: block, - }) - ).output; - - sdk.util.sumSingleBalance(balances, constants.CURRENCIES["YAXIS"], sYAX); - - // sYAXIS (LEGACY v2) - YAXIS - const sYAXIS = ( - await sdk.api.erc20.totalSupply({ - target: constants.STAKING.YAXIS, - block, - }) - ).output; - - sdk.util.sumSingleBalance(balances, constants.CURRENCIES["YAXIS"], sYAXIS); - - // Voting Escrow (v3) - YAXIS - const veYAXIS = ( - await sdk.api.abi.call({ - target: constants.VOTING_ESCROW, - abi: abi.votingEscrow, - block, - }) - ).output; - - sdk.util.sumSingleBalance(balances, constants.CURRENCIES["YAXIS"], veYAXIS); - - // Add YAXIS vault - const yaxisVault = ( - await sdk.api.erc20.totalSupply({ - target: constants.YAXIS_GAUGE, - block, - }) - ).output; - - sdk.util.sumSingleBalance( - balances, - constants.CURRENCIES["YAXIS"], - yaxisVault - ); - - return balances +async function staking_(time, block) { + const { api } = arguments[3] + const token = constants.CURRENCIES["YAXIS"] + api.add(token, await api.call({ abi: abi.votingEscrow, target: constants.VOTING_ESCROW})) + api.add(token, await api.call({ abi: abi.yAxisBar, target: constants.BAR})) + api.add(token, await api.call({ abi: 'erc20:totalSupply', target: constants.STAKING.YAXIS})) + api.add(token, await api.call({ abi: 'erc20:totalSupply', target: constants.YAXIS_GAUGE})) } module.exports = { doublecounted: true, ethereum: { tvl, - staking, - pool2 + staking: staking_, + pool2: staking(constants.UNISWAP_LPS.map(i => i.staking), constants.UNISWAP_LPS.map(i => i.address)) }, start: 1600185600, // 09/16/2020 @ 12:00am (UTC+8) }; From 4d7834fe0abd9dd2e45ebc11f7133be3cbe50fbc Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 31 Jul 2023 13:35:26 +0200 Subject: [PATCH 0573/1974] fix gearbox --- projects/gearbox/events.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/gearbox/events.js b/projects/gearbox/events.js index 08d505fd9fa..49d5ec104eb 100644 --- a/projects/gearbox/events.js +++ b/projects/gearbox/events.js @@ -150,6 +150,9 @@ const getV2CAs = async (creditManager, block) => { }; const getV1CAs = async (creditManager, block) => { + if (creditManager === "0x4C6309fe2085EfE7A0Cfb426C16Ef3b41198cCE3") { + return "0"; + } const eventsByDate = []; const accounts = new Set(); From 0cbf0acf3eb855f98353f0ed0acfdd18b376fc7e Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 31 Jul 2023 13:55:44 +0200 Subject: [PATCH 0574/1974] fix quickswap v3 --- projects/quickswap-v3/index.js | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/projects/quickswap-v3/index.js b/projects/quickswap-v3/index.js index fab4ede8aca..647708069a3 100644 --- a/projects/quickswap-v3/index.js +++ b/projects/quickswap-v3/index.js @@ -1,7 +1,25 @@ const { uniV3Export } = require('../helper/uniswapV3') - +const { cachedGraphQuery } = require('../helper/cache') module.exports = uniV3Export({ polygon: { factory: '0x411b0facc3489691f28ad58c47006af5e3ab3a28', fromBlock: 32610688, isAlgebra: true, }, dogechain: { factory: '0xd2480162aa7f02ead7bf4c127465446150d58452', fromBlock: 837574, isAlgebra: true, }, polygon_zkevm: { factory: '0x4B9f4d2435Ef65559567e5DbFC1BbB37abC43B57', fromBlock: 300, isAlgebra: true, }, -}) \ No newline at end of file +}) + +async function tvl(_, _b, _cb, { api, }) { + const { pools } = await cachedGraphQuery('quickswap-v3/'+api.chain, 'https://graph-node.dogechain.dog/subgraphs/name/quickswap/dogechain-info', `{ + pools(first:1000) { + token0 { + id + } + token1 { + id + } + id + } + }`) + const ownerTokens = pools.map(p=>[[p.token0.id, p.token1.id], p.id]) + return api.sumTokens({ ownerTokens }) +} + +module.exports.dogechain.tvl = tvl \ No newline at end of file From b3cfb9403d396bfdcc53b93b9ba430eaf81630cb Mon Sep 17 00:00:00 2001 From: Landon Gingerich Date: Mon, 31 Jul 2023 09:56:18 -0500 Subject: [PATCH 0575/1974] add zkSync Era Gate.io addresses --- projects/gate-io/index.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/projects/gate-io/index.js b/projects/gate-io/index.js index ee3b36769f7..0955b769b95 100644 --- a/projects/gate-io/index.js +++ b/projects/gate-io/index.js @@ -59,6 +59,18 @@ const config = { '0xc882b111a75c0c657fc507c04fbfcd2cc984f071', ] }, + era: { + owners: [ + '0x0d0707963952f2fba59dd06f2b425ace40b492fe', + '0x1c4b70a3968436b9a0a9cf5205c787eb81bb558c', + '0x234ee9e35f8e9749a002fc42970d570db716453b', + '0x925206b8a707096Ed26ae47C84747fE0bb734F59', + '0xD793281182A0e3E023116004778F45c29fc14F19', + '0xc882b111a75c0c657fc507c04fbfcd2cc984f071', + '0x85FAa6C1F2450b9caEA300838981C2e6E120C35c', + '0xeb01f8cdae433e7b55023ff0b2da44c4c712dce2', + ] + }, bitcoin: { owners: [ '14kmvhQrWrNEHbrSKBySj4qHGjemDtS3SF', From 6be8396dec1cfe140e6732f7ecded007095a888a Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 31 Jul 2023 17:57:00 +0200 Subject: [PATCH 0576/1974] fix jetswap --- projects/jetswap/index.js | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/projects/jetswap/index.js b/projects/jetswap/index.js index 30cf48c43cd..6386c5a3cac 100644 --- a/projects/jetswap/index.js +++ b/projects/jetswap/index.js @@ -1,5 +1,5 @@ -const sdk = require("@defillama/sdk"); const { uniTvlExport } = require("../helper/calculateUniTvl"); +const { staking } = require('../helper/staking') const bscFactory = "0x0eb58E5c8aA63314ff5547289185cC4583DfCBD5"; const polygonFactory = "0x668ad0ed2622C62E24f0d5ab6B6Ac1b9D2cD4AC7"; @@ -13,22 +13,6 @@ const MASTER_BSC = "0x63d6EC1cDef04464287e2af710FFef9780B6f9F5"; const MASTER_POLYGON = "0x4e22399070aD5aD7f7BEb7d3A7b543e8EcBf1d85"; const MASTER_FANTOM = "0x9180583C1ab03587b545629dd60D2be0bf1DF4f2"; -function staking(masterchef, token, chain) { - return async (_timestamp, _block, chainBlocks) => { - let balances = {}; - let balance = ( - await sdk.api.erc20.balanceOf({ - target: token, - owner: masterchef, - block: chainBlocks[chain], - chain, - }) - ).output; - sdk.util.sumSingleBalance(balances, `bsc:${WINGS_TOKEN_BSC}`, balance); - return balances; - }; -} - module.exports = { bsc: { tvl: uniTvlExport(bscFactory, 'bsc', true), From 8da3d16cb8e22ecb52bbfa4966c50133518d19f0 Mon Sep 17 00:00:00 2001 From: dev0kokoa <86997922+dev0kokoa@users.noreply.github.com> Date: Tue, 1 Aug 2023 03:11:02 +0900 Subject: [PATCH 0577/1974] feat: add base chain for kokonut swap (#6959) * feat: add kokonutswap for polygon zkevm * fix: eslint * feat: add base chain for kokonut swap --- projects/kokonut-swap/index.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/projects/kokonut-swap/index.js b/projects/kokonut-swap/index.js index bd3d46276bc..49ccdf34c76 100644 --- a/projects/kokonut-swap/index.js +++ b/projects/kokonut-swap/index.js @@ -77,6 +77,19 @@ async function polygon_zkevm_tvl(_, _b, _cb, { api }) { return sumTokens2({ api, ownerTokens }); } +async function base_tvl(_, _b, _cb, { api }) { + const ownerTokens = []; + const poolList = (await sdk.api.abi.call({ + target: "0x03173F638B3046e463Ab6966107534f56E82E1F3", + abi: abi.getRegisteredPools, + chain: 'base' + })).output; + for (const pool of poolList) { + ownerTokens.push([pool.liquidity.map(t => t.addr), pool.addr]); + } + return sumTokens2({ api, ownerTokens }); +} + async function staking(timestamp, _, { klaytn: block }) { const info = (await sdk.api.abi.call({ target: helper_addr, @@ -97,6 +110,9 @@ module.exports = { polygon_zkevm: { tvl: polygon_zkevm_tvl }, + base: { + tvl: base_tvl + }, methodology: "tvl is calculated using the total value of protocol's liquidity pool. Staked tokens include staked EYE values. Pool2 includes staked lp tokens eligible for KOKOS emissions" }; \ No newline at end of file From b2a7595c24e7e7f71e5d223782b7c22eec357cf8 Mon Sep 17 00:00:00 2001 From: SwirlLend <139681025+SwirlLend@users.noreply.github.com> Date: Tue, 1 Aug 2023 02:16:02 +0800 Subject: [PATCH 0578/1974] Add base tvl (#6958) * Add Swirllend on Linea * minor fix * add base tvl --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/swirllend/index.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/projects/swirllend/index.js b/projects/swirllend/index.js index bb0102d3189..5f394d4dad9 100644 --- a/projects/swirllend/index.js +++ b/projects/swirllend/index.js @@ -6,4 +6,10 @@ module.exports = { fetchBalances: true, cether: '0x91067b912f89dfca50c3f5529dbeb78b63c6a2e5', }), + + base: compoundExports2({ + comptroller: "0xcAABf6Ffb76634183254B0a4a3D5fb36180FdAE4", + fetchBalances: true, + cether: '0x91067b912f89dfca50c3f5529dbeb78b63c6a2e5', + }), }; From 66c486f7d135e1a6bfbc08d09881a595890f16bb Mon Sep 17 00:00:00 2001 From: Austin <128147981+austinjfi@users.noreply.github.com> Date: Tue, 1 Aug 2023 00:02:01 +0530 Subject: [PATCH 0579/1974] add brine-finance adapter (#6957) * add brine-finance adapter * minor fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/brine/index.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 projects/brine/index.js diff --git a/projects/brine/index.js b/projects/brine/index.js new file mode 100644 index 00000000000..357951e7a19 --- /dev/null +++ b/projects/brine/index.js @@ -0,0 +1,18 @@ +const ADDRESSES = require("../helper/coreAssets.json"); +const { sumTokensExport } = require("../helper/unwrapLPs"); + +const contracts = ["0x1390f521A79BaBE99b69B37154D63D431da27A07"]; + +const tokens = [ + ADDRESSES.null, + ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.USDT, + ADDRESSES.ethereum.WBTC, + ADDRESSES.ethereum.MATIC, + '0xB50721BCf8d664c30412Cfbc6cf7a15145234ad1' +]; + +module.exports = { + start: 1685817000, + ethereum: { tvl: sumTokensExport({ owners: contracts, tokens, }) }, +}; From 148746465396452616d0254c4837244d11a55f8f Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 1 Aug 2023 00:06:36 +0530 Subject: [PATCH 0580/1974] Vivaleva (#6961) * vivaleva * minor fix --------- Co-authored-by: Sooyoung Lee --- projects/vivaleva/index.js | 87 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 projects/vivaleva/index.js diff --git a/projects/vivaleva/index.js b/projects/vivaleva/index.js new file mode 100644 index 00000000000..018dc603349 --- /dev/null +++ b/projects/vivaleva/index.js @@ -0,0 +1,87 @@ +const vaults = [ + { + symbol: "ibETH", + decimals: 18, + baseTokenAddress: "0x5aea5775959fbc2557cc8789bc1bf90a239d9a91", + address: "0x23FDd6487a17abB8360E8Da8b1B370C94ee94Cc2", + }, + { + symbol: "ibUSDC", + decimals: 6, + baseTokenAddress: "0x3355df6D4c9C3035724Fd0e3914dE96A5a83aaf4", + address: "0x0755DA5D9e9A722A9e5cc4bb83742387ae2990a5", + }, +]; +const syncswapWorkers = [ + { + name: "ETH-USDC Syncswap Farm", + address: "0x39356ed5dC2F7Ea897296e07E97b59Af9C8153Ec", + farmingTokenAddress: "0x5aea5775959fbc2557cc8789bc1bf90a239d9a91", + baseTokenAddress: "0x3355df6D4c9C3035724Fd0e3914dE96A5a83aaf4", + lpToken: "0x80115c708E12eDd42E504c1cD52Aea96C547c05c", + }, + { + name: "USDC-ETH Syncswap Farm", + address: "0x3A613EFAe4a6A6447A9D784E398730811a57af6e", + farmingTokenAddress: "0x3355df6D4c9C3035724Fd0e3914dE96A5a83aaf4", + baseTokenAddress: "0x5aea5775959fbc2557cc8789bc1bf90a239d9a91", + lpToken: "0x80115c708E12eDd42E504c1cD52Aea96C547c05c", + }, + { + name: "USDT-ETH Syncswap Farm", + address: "0x95C78e21Beb54314fe5A4571E7361f6c6A144B2f", + farmingTokenAddress: "0x493257fd37edb34451f62edf8d2a0c418852ba4c", + baseTokenAddress: "0x5aea5775959fbc2557cc8789bc1bf90a239d9a91", + lpToken: "0xd3D91634Cf4C04aD1B76cE2c06F7385A897F54D3", + }, + { + name: "USDT-USDC Syncswap Farm", + address: "0xfbF4BcD3266Af20B72dc484F6D7Dc13855885ba0", + farmingTokenAddress: "0x493257fd37edb34451f62edf8d2a0c418852ba4c", + baseTokenAddress: "0x3355df6D4c9C3035724Fd0e3914dE96A5a83aaf4", + lpToken: "0x0E595bfcAfb552F83E25d24e8a383F88c1Ab48A4", + }, +]; + +module.exports = { + timetravel: false, + misrepresentedTokens: true, + era: { + async tvl(_, _1, _2, { api }) { + const vaultBalances = await api.multiCall({ + abi: "uint256:vaultBalance", + calls: vaults.map((v) => v.address), + }); + + vaults.forEach((v, i) => { + api.add(v.baseTokenAddress, vaultBalances[i]); + }); + + const [ + syncswapWorkerBalances, + syncswapReserves, + syncswapLpTotalSupplies, + token0s, + token1s, + ] = await Promise.all([ + api.multiCall({ abi: "uint256:totalStakedLpBalance", calls: syncswapWorkers.map((v) => v.address), }), + api.multiCall({ abi: "function getReserves() view returns (uint256, uint256)", calls: syncswapWorkers.map((v) => v.lpToken), }), + api.multiCall({ abi: "uint256:totalSupply", calls: syncswapWorkers.map((v) => v.lpToken), }), + api.multiCall({ abi: "address:token0", calls: syncswapWorkers.map((v) => v.lpToken), }), + api.multiCall({ abi: "address:token1", calls: syncswapWorkers.map((v) => v.lpToken), }), + ]); + + syncswapWorkers.forEach((w, i) => { + const token0 = token0s[i] + const token1 = token1s[i] + const lpBalance = BigInt(syncswapWorkerBalances[i]) + const totalSupply = BigInt(syncswapLpTotalSupplies[i]) + const [r0, r1] = syncswapReserves[i].map(BigInt); + const underlying0 = String(lpBalance * r0 / totalSupply); + const underlying1 = String(lpBalance * r1 / totalSupply); + api.add(token0, underlying0); + api.add(token1, underlying1); + }); + }, + }, +}; From 4e1c8cf7b0e60970182399195de4d2e9a1dcab3d Mon Sep 17 00:00:00 2001 From: Kevin Park Date: Mon, 31 Jul 2023 20:43:25 +0200 Subject: [PATCH 0581/1974] feat: adapter for Nayms (#6956) * feat: adapter for Nayms * minor fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/nayms/index.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 projects/nayms/index.js diff --git a/projects/nayms/index.js b/projects/nayms/index.js new file mode 100644 index 00000000000..c4b954c24eb --- /dev/null +++ b/projects/nayms/index.js @@ -0,0 +1,21 @@ +const ADDRESSES = require("../helper/coreAssets.json"); +const { sumTokensExport } = require("../helper/unwrapLPs"); + +const tokens = [ + ADDRESSES.ethereum.WETH, + ADDRESSES.ethereum.DAI, + ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.TUSD, + ADDRESSES.ethereum.USDT, +]; + +const owner = '0x39e2f550fef9ee15b459d16bD4B243b04b1f60e5' + +module.exports = { + methodology: "Sum assets on Nayms", + start: 1681990619, // Thu Apr 20 13:36:59 2023 GMT + ethereum: { + tvl: sumTokensExport({ owner, tokens }), + }, + hallmarks: [[1681990619, "Nayms V3 Launch"]], +}; From 64b039282760ccc5db935b80245e7595f08f8880 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Tue, 1 Aug 2023 02:52:44 +0100 Subject: [PATCH 0582/1974] add snapshot treasury --- projects/treasury/snapshot.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 projects/treasury/snapshot.js diff --git a/projects/treasury/snapshot.js b/projects/treasury/snapshot.js new file mode 100644 index 00000000000..8b51b040029 --- /dev/null +++ b/projects/treasury/snapshot.js @@ -0,0 +1,16 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0x3E87e5BCE4dEb09FeE5045EF15E18f873212E6A7"; + +module.exports = treasuryExports({ + optimism: { + tokens: [ + nullAddress, + ADDRESSES.optimism.USDC, // USDC + ADDRESSES.optimism.OP, + ], + owners: [treasury], + ownTokens: [], + }, +}); \ No newline at end of file From bb2d5247a22ed065673f9213a7e978ab182b66df Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Tue, 1 Aug 2023 04:05:38 +0100 Subject: [PATCH 0583/1974] add adapters --- projects/treasury/giveth.js | 70 +++++++++++++++++++++++++++++++ projects/treasury/revoke.js | 83 +++++++++++++++++++++++++++++++++++++ projects/treasury/safe.js | 15 +++++++ 3 files changed, 168 insertions(+) create mode 100644 projects/treasury/giveth.js create mode 100644 projects/treasury/revoke.js create mode 100644 projects/treasury/safe.js diff --git a/projects/treasury/giveth.js b/projects/treasury/giveth.js new file mode 100644 index 00000000000..c7334ea4b45 --- /dev/null +++ b/projects/treasury/giveth.js @@ -0,0 +1,70 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0x4D9339dd97db55e3B9bCBE65dE39fF9c04d1C2cd"; + +module.exports = treasuryExports({ + optimism: { + tokens: [ + nullAddress, + ADDRESSES.optimism.USDC, // USDC + ADDRESSES.optimism.OP, + ADDRESSES.optimism.DAI, + ADDRESSES.optimism.USDT, + ADDRESSES.optimism.WETH + ], + owners: [treasury], + ownTokens: [], + }, + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.USDC, // USDC + ADDRESSES.ethereum.DAI, + ADDRESSES.ethereum.USDT, + ADDRESSES.ethereum.WETH, + "0x7C07F7aBe10CE8e33DC6C5aD68FE033085256A84", //icETH + "0x1d462414fe14cf489c7A21CaC78509f4bF8CD7c0", //can + "0xa117000000f279D81A1D3cc75430fAA017FA5A2e", //ant + "0x19062190B1925b5b6689D7073fDfC8c2976EF8Cb", //bzz + "0xC18360217D8F7Ab5e7c516566761Ea12Ce7F9D72", //ens + "0x2d94AA3e47d9D5024503Ca8491fcE9A2fB4DA198", //bank + "0xDe30da39c46104798bB5aA3fe8B9e0e1F348163F", //gtc + "0x0bc529c00C6401aEF6D220BE8C6Ea1667F6Ad93e", //yfi + "0x7D1AfA7B718fb893dB30A3aBc0Cfc608AaCfeBB0", //matic + "0xDd1Ad9A21Ce722C151A836373baBe42c868cE9a4", //ubi + ], + owners: [treasury], + ownTokens: ["0x900dB999074d9277c5DA2A43F252D74366230DA0"], + }, + polygon: { + tokens: [ + nullAddress, + ADDRESSES.polygon.USDC, // USDC + ADDRESSES.polygon.DAI, + ADDRESSES.polygon.USDT, + ADDRESSES.polygon.WETH, + ADDRESSES.polygon.WMATIC, + "0x18e73A5333984549484348A94f4D219f4faB7b81", //duckies + "0xD6DF932A45C0f255f85145f286eA0b292B21C90B", //aave + "0x53E0bca35eC356BD5ddDFebbD1Fc0fD03FaBad39", //link + "0xb33EaAd8d922B1083446DC23f610c2567fB5180f", //uni + ], + owners: [treasury], + ownTokens: [], + }, + xdai: { + tokens: [ + nullAddress, + "0x71850b7E9Ee3f13Ab46d67167341E4bDc905Eef9", //hny + "0xDDAfbb505ad214D7b80b1f830fcCc89B60fb7A83", //usdc + "0x21a42669643f45Bc0e086b8Fc2ed70c23D67509d", //fox + "0x83FF60E2f93F8eDD0637Ef669C69D5Fb4f64cA8E", //bright + "0x6A023CCd1ff6F2045C3309768eAd9E68F978f6e1", //weth + "0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d", //wxdai + "0x177127622c4A00F3d409B75571e12cB3c8973d3c", //cow + ], + owners: [treasury], + ownTokens: ["0x4f4F9b8D5B4d0Dc10506e5551B0513B61fD59e75"], + } +}); \ No newline at end of file diff --git a/projects/treasury/revoke.js b/projects/treasury/revoke.js new file mode 100644 index 00000000000..1fae8c0fcc9 --- /dev/null +++ b/projects/treasury/revoke.js @@ -0,0 +1,83 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0xe126b3E5d052f1F575828f61fEBA4f4f2603652a" // + +module.exports = treasuryExports({ + optimism: { + tokens: [ + nullAddress, + ADDRESSES.optimism.DAI, + ADDRESSES.optimism.WETH, + ADDRESSES.optimism.USDT, + ADDRESSES.optimism.USDC, + "0x8700dAec35aF8Ff88c16BdF0418774CB3D7599B4", //snx + ], + owners: [treasury], + }, + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.USDC, + "0xC18360217D8F7Ab5e7c516566761Ea12Ce7F9D72", //ens + "0xDd1Ad9A21Ce722C151A836373baBe42c868cE9a4", //ubi + "0x7aE1D57b58fA6411F32948314BadD83583eE0e8C", //paper + "0xb24cd494faE4C180A89975F1328Eab2a7D5d8f11", //code + "0x6243d8CEA23066d098a15582d81a598b4e8391F4", //flx + "0xc4De189Abf94c57f396bD4c52ab13b954FebEfD8", //b20 + "0xad32A8e6220741182940c5aBF610bDE99E737b2D", //dough + "0x90DE74265a416e1393A450752175AED98fe11517", //udt + "0x6fB3e0A217407EFFf7Ca062D46c26E5d60a14d69", //iotx + "0x5dD57Da40e6866C9FcC34F4b6DDC89F1BA740DfE", //bright + "0xc770EEfAd204B5180dF6a14Ee197D99d808ee52d", //fox + "0xdBdb4d16EdA451D0503b854CF79D55697F90c8DF", //alcx + "0x4F14cDBd815B79E9624121f564f24685c6B1211b", //anfd + "0xE41d2489571d322189246DaFA5ebDe1F4699F498", //zrx + "0x7b35Ce522CB72e4077BaeB96Cb923A5529764a00", //imx + ], + owners: [treasury], + }, + bsc: { + tokens: [ + nullAddress, + "0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56", //busd + "0xF68C9Df95a18B2A5a5fa1124d79EEEffBaD0B6Fa", //any + ], + owners: [treasury], + }, + polygon: { + tokens: [ + nullAddress, + "0xc2132D05D31c914a87C6611C10748AEb04B58e8F", //usdt + "0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063", //dai + "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174", //usdc + "0x8dF3aad3a84da6b69A4DA8aeC3eA40d9091B2Ac4", //ammatic + ], + owners: [treasury], + }, + arbitrum: { + tokens: [ + nullAddress, + "0x912CE59144191C1204E64559FE8253a0e49E6548", //arb + "0x539bdE0d7Dbd336b79148AA742883198BBF60342", //magic + "0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8", //usdc + "0x1F52145666C862eD3E2f1Da213d479E61b2892af", //fuc + ], + owners: [treasury], + }, + arbitrum_nova: { + tokens: [ + nullAddress, + "0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1", //dai + ], + owners: [treasury], + }, + xdai: { + tokens: [ + nullAddress, + "0x71850b7E9Ee3f13Ab46d67167341E4bDc905Eef9", //hny + ], + owners: [treasury], + }, + +}) \ No newline at end of file diff --git a/projects/treasury/safe.js b/projects/treasury/safe.js new file mode 100644 index 00000000000..bda53508ec4 --- /dev/null +++ b/projects/treasury/safe.js @@ -0,0 +1,15 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { treasuryExports } = require("../helper/treasury"); + +const treasury = "0x3EDf6868d7c42863E44072DaEcC16eCA2804Dea1" // + +module.exports = treasuryExports({ + optimism: { + tokens: [ + nullAddress, + ADDRESSES.optimism.OP, + ], + owners: [treasury], + }, + +}) \ No newline at end of file From 2ea10f0a364ce4a2365bd36c0b73ad831400e716 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Tue, 1 Aug 2023 04:56:14 +0100 Subject: [PATCH 0584/1974] fix import --- projects/treasury/safe.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/treasury/safe.js b/projects/treasury/safe.js index bda53508ec4..f86dddf3eb6 100644 --- a/projects/treasury/safe.js +++ b/projects/treasury/safe.js @@ -1,5 +1,5 @@ const ADDRESSES = require('../helper/coreAssets.json') -const { treasuryExports } = require("../helper/treasury"); +const { nullAddress,treasuryExports } = require("../helper/treasury"); const treasury = "0x3EDf6868d7c42863E44072DaEcC16eCA2804Dea1" // From 713275bd2e3fba906b0fed6de212727742155a25 Mon Sep 17 00:00:00 2001 From: Ronan Clooney <73086339+clooneyr@users.noreply.github.com> Date: Tue, 1 Aug 2023 15:48:46 +1000 Subject: [PATCH 0585/1974] Update custody address's for new architecture (#6964) --- projects/algomint/index.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/projects/algomint/index.js b/projects/algomint/index.js index b38256a915b..ecf9f2f3508 100644 --- a/projects/algomint/index.js +++ b/projects/algomint/index.js @@ -3,12 +3,14 @@ const { tokens } = require("../helper/chain/algorand"); const { lpTokenPostion } = require("./utils"); //Algomint Basket contracts where the liquidty is held -const goUsdBasketAddress = - "B7GJK5XWIYRM7Y5ZBSLHYGQFOWMBRNCITBL37U6HMXETTA37BRJVLF7XRM"; +const goUsdcBasketAddress = + "S3VJZN4AXUP3IZKE4O7TUN6LRIEYNJCMXQSFP6DPGUKU6YYK2VLN2W7DXA"; +const goUsdtBasketAddress = + "CX7ICRT4HRKHZSSYYMW765AKSBDH3XJBQZ2DXN32DCWTD2732RVHR25Y5Q"; const goBtcBasketAddress = - "OYJM6HVQESRPVFMMGPXA6AL6T4JP5U25J6IQ7UKA6I3NC7VRSH6H3F7KDI"; + "MGGJI6CKRMIEN7CGXY2SK3KTPRCXW4SNPDPN4G7RWON4DB4262G4IRFHXE"; const goEthBasketAddress = - "72BMR3TYPOLPNUEUL6FTY5ZE4SQQ7KZ2PE5QRTA4Z2M76IEFA72A24NXGQ"; + "IUTNDPUTZ5MKFFIZ5L7MG35I5WXS64LLJKVXRTJNJISBRPOTOAM3DA65CY"; //The following pool ID's are the PACT LP pool contracts const usdcPoolId = 885102197; @@ -21,13 +23,13 @@ async function tvl() { const usdcPostion = await lpTokenPostion( tokens.usdcGoUsdLp, usdcPoolId, - goUsdBasketAddress + goUsdcBasketAddress ); const usdtPosition = await lpTokenPostion( tokens.usdtGoUsdLp, usdtPoolId, - goUsdBasketAddress + goUsdtBasketAddress ); const wBtcPosition = await lpTokenPostion( From ee26ffaaf056fea05f9470565291f523b6fbe6e9 Mon Sep 17 00:00:00 2001 From: Joeh <32411671+joehquak@users.noreply.github.com> Date: Tue, 1 Aug 2023 06:51:01 +0100 Subject: [PATCH 0586/1974] feat: add base network to Sobal listing (#6965) --- projects/sobal/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/sobal/index.js b/projects/sobal/index.js index 0f52626b487..dd4ce279afd 100644 --- a/projects/sobal/index.js +++ b/projects/sobal/index.js @@ -4,6 +4,7 @@ const V2_ADDRESS = '0x7122e35ceC2eED4A989D9b0A71998534A203972C'; // Vault const config = { neon_evm: { fromBlock: 206166057, }, + base: { fromBlock: 2029566 } } Object.keys(config).forEach(chain => { From 0b5f233c45207c7135267cb0844b0696d46bf9f7 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 1 Aug 2023 08:01:03 +0200 Subject: [PATCH 0587/1974] jojo: track arbitrum --- projects/jojo/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/jojo/index.js b/projects/jojo/index.js index 532f4d57fb1..5fb852df6a9 100644 --- a/projects/jojo/index.js +++ b/projects/jojo/index.js @@ -4,4 +4,5 @@ const { sumTokensExport } = require('../helper/unwrapLPs') module.exports = { era: { tvl: sumTokensExport({ tokens: [ADDRESSES.era.USDC], owners: ['0x47eAD228547db8397398C1D3aAfd0847CBEbddeC'], }) }, bsc: { tvl: sumTokensExport({ tokens: [ADDRESSES.bsc.USDC], owners: ['0x25173BB47CB712cFCDFc13ECBebDAd753090801E'], }) }, + arbitrum: { tvl: sumTokensExport({ tokens: [ADDRESSES.arbitrum.USDC], owners: ['0xcDf9eED57Fe8dFaaCeCf40699E5861517143bcC7'], }) }, }; From 6f65aa919f934bd77cacee9ac6aa983a9ca7ec60 Mon Sep 17 00:00:00 2001 From: Curbis Norris <130688524+curbisn@users.noreply.github.com> Date: Tue, 1 Aug 2023 01:09:59 -0700 Subject: [PATCH 0588/1974] Add contract for base chain on Dexilla (#6970) --- projects/dexilla/index.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/projects/dexilla/index.js b/projects/dexilla/index.js index 51d677ed509..697f812e448 100644 --- a/projects/dexilla/index.js +++ b/projects/dexilla/index.js @@ -30,6 +30,11 @@ const config = { '0x5dD2a1C1Fb25E30928C901a28Ceaf53E59B606dD', ], }, + base:{ + exchanges: [ + '0x3F7F51983fb95084a5cb73EB2F28757Bd8bb65E3', + ], + } } module.exports = { From c221436b2c6e2c848a623e7c2870be2ac6124e79 Mon Sep 17 00:00:00 2001 From: synthswapdev <141114700+synthswapdev@users.noreply.github.com> Date: Tue, 1 Aug 2023 10:11:14 +0200 Subject: [PATCH 0589/1974] feat: add Synthswap (#6969) --- projects/synthswap/index.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 projects/synthswap/index.js diff --git a/projects/synthswap/index.js b/projects/synthswap/index.js new file mode 100644 index 00000000000..8e3d38af7da --- /dev/null +++ b/projects/synthswap/index.js @@ -0,0 +1,21 @@ +const { getUniTVL, sumTokensExport } = require('../helper/unknownTokens') +const SYNTH = "0xbd2DBb8eceA9743CA5B16423b4eAa26bDcfE5eD2"; +const FACTORY = "0x4bd16d59A5E1E0DB903F724aa9d721a31d7D720D" + + +const dexTVL = getUniTVL({ factory: FACTORY, useDefaultCoreAssets: true }) + + +module.exports = { + misrepresentedTokens: true, + methodology: `Uses factory(${FACTORY}) address and whitelisted tokens address to find and price Liquidity Pool pairs.`, + base: { + tvl: dexTVL, + staking: sumTokensExport({ + owners: ['0x01CC6b33c63CeE896521D63451896C14D42D05Ea'], + tokens: [SYNTH], + }) + } +}; + + From f8e49ff10baed02707fdad7e641527388f188015 Mon Sep 17 00:00:00 2001 From: 0xkaidev <92993009+0xkaidev@users.noreply.github.com> Date: Tue, 1 Aug 2023 15:35:23 +0700 Subject: [PATCH 0590/1974] sMora staking (#6967) * moraswap v2 * add neon evm chain * code refactor * sMora staking * import lib * code refactor --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/moraswap/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/projects/moraswap/index.js b/projects/moraswap/index.js index 9efe0f8a00f..efcf9e3ca0c 100644 --- a/projects/moraswap/index.js +++ b/projects/moraswap/index.js @@ -1,9 +1,13 @@ const { getUniTVL } = require('../helper/unknownTokens') +const { stakingUnknownPricedLP } = require('../helper/staking.js') + +const dexTVL_neon = getUniTVL({ factory: '0xd43F135f6667174f695ecB7DD2B5f953d161e4d1', useDefaultCoreAssets: true }) module.exports = { misrepresentedTokens: true, neon_evm: { - tvl: getUniTVL({ factory: '0xd43F135f6667174f695ecB7DD2B5f953d161e4d1', useDefaultCoreAssets: true }), + tvl: dexTVL_neon, + staking: stakingUnknownPricedLP("0xa3da566fdE97c90c08052f612BdBed8F3B8004B7", "0x2043191e10a2A4b4601F5123D6C94E000b5d915F", 'neon_evm', '0xe6faaf048b2A9b9Bf906aBdD8623811458d81Cf3'), } }; From 6a2ad5172b2605b355dbf4213f91566acd6e1209 Mon Sep 17 00:00:00 2001 From: VaporwaveFinance <95114728+VaporwaveFinance@users.noreply.github.com> Date: Tue, 1 Aug 2023 04:35:34 -0400 Subject: [PATCH 0591/1974] Update vaporwave.js (#6944) Add multichain TVL data --- projects/vaporwave.js | 46 +++++++++++++++++++++++++++++++------------ 1 file changed, 33 insertions(+), 13 deletions(-) diff --git a/projects/vaporwave.js b/projects/vaporwave.js index 02d01c80b4a..4f801f60093 100644 --- a/projects/vaporwave.js +++ b/projects/vaporwave.js @@ -1,24 +1,44 @@ const utils = require("./helper/utils"); -var chainId; -var vault; +const { toUSDTBalances } = require('./helper/balances'); +let _response -async function fetch() { - const response = await utils.fetchURL("https://api.vaporwave.farm/tvl"); +function fetchChain(chainId, staking) { + return async () => { + if (!_response) _response = utils.fetchURL('https://api.vaporwave.farm/tvl') + const response = await _response; - let tvl = 0; - for (chainId in response.data) { + let tvl = 0; const chain = response.data[chainId]; - - for (vault in chain) { - tvl += chain[vault]; + for (const vault in chain) { + const isVWAVE = vault.includes("vwave") + if ((isVWAVE && staking) || (!isVWAVE && !staking)) { + tvl += Number(chain[vault]); + } + } + if (tvl === 0 && !staking) { + throw new Error(`chain ${chainId} tvl is 0`) } + + return toUSDTBalances(tvl); } +} - return tvl; +const chains = { + polygon_zkevm: 1101, + arbitrum: 42161, + aurora: 1313161554, } module.exports = { + timetravel: false, + misrepresentedTokens: true, methodology: - 'TVL data is pulled from the Vaporwave Finance API "https://api.vaporwave.farm/tvl".', - fetch, -}; + 'TVL data is pulled from the Vaporwave Finance API "https://api.vaporwave.farm/tvl".', + doublecounted: true, + ...Object.fromEntries(Object.entries(chains).map(chain => [chain[0], { + tvl: fetchChain(chain[1], false), + staking: fetchChain(chain[1], true), + }])) +} + + From 4ab41d9992a94363bf81422d4a9f500a9c4e38ff Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 1 Aug 2023 12:39:28 +0200 Subject: [PATCH 0592/1974] turn atrix on-chain --- projects/atrix.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/projects/atrix.js b/projects/atrix.js index e8375508e86..6c17bf09f6b 100644 --- a/projects/atrix.js +++ b/projects/atrix.js @@ -1,15 +1,16 @@ -const { get } = require('./helper/http') +const { sumTokens2 } = require('./helper/solana') +const { getConfig } = require('./helper/cache') -async function fetch() { - return (await get('https://api.atrix.finance/api/tvl')).tvl; +async function tvl() { + const { pools } = await getConfig('atrix-v1', 'https://api.atrix.finance/api/all') + return sumTokens2({ tokenAccounts: pools.map(({ marketData: { coinVault, pcVault } }) => [coinVault, pcVault]).flat() }) } module.exports = { timetravel: false, - methodology: "The Atrix API endpoint fetches on-chain data from the Serum orderbook and token accounts for each liquidity pool, then uses prices from Coingecko to aggregate total TVL.", - fetch, + solana: { tvl }, hallmarks: [ [1665521360, "Mango Markets Hack"], [1667865600, "FTX collapse"] ], -}; +} From 2c00e9a72eb965131a4e49d2e418a5f515b9fa23 Mon Sep 17 00:00:00 2001 From: Winson Cheng <83229800+0xKMG@users.noreply.github.com> Date: Tue, 1 Aug 2023 19:37:14 +0800 Subject: [PATCH 0593/1974] add hallmark for the project (#6971) --- projects/vaultka/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/vaultka/index.js b/projects/vaultka/index.js index 19f211c55dc..9b95fa39c49 100644 --- a/projects/vaultka/index.js +++ b/projects/vaultka/index.js @@ -1,5 +1,6 @@ module.exports = { misrepresentedTokens: true, + hallmark: [1688342964, "Launch Sake Vault"], arbitrum: { tvl: async (_, _b, _cb, { api }) => { const vaults = [ From 3e16bb64c074a84e4fb0dca99ccdbbaaa9d576d5 Mon Sep 17 00:00:00 2001 From: define Date: Tue, 1 Aug 2023 13:29:47 +0100 Subject: [PATCH 0594/1974] add base chain to oasisswap --- projects/oasisswapdex/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/projects/oasisswapdex/index.js b/projects/oasisswapdex/index.js index e6c233fa8f5..a3e5d657d94 100644 --- a/projects/oasisswapdex/index.js +++ b/projects/oasisswapdex/index.js @@ -13,4 +13,8 @@ module.exports = { ]), staking: staking("0x73c1fb66b4e183bc101b98d4c17431b667d85958", "0x602eb0d99a5e3e76d1510372c4d2020e12eaea8a", "arbitrum") }, -}; // node test.js projects/oasisswapdex/index.js \ No newline at end of file + base: { + tvl: sdk.util.sumChainTvls([ + getUniTVL({ factory: '0xc8126578093366968199707b7f8edff258f473b6', chain: 'base', useDefaultCoreAssets: true }), + ]), +} }// node test.js projects/oasisswapdex/index.js \ No newline at end of file From ce10e3f871624ed776fe15dcc1d92745eb75f868 Mon Sep 17 00:00:00 2001 From: xiaodong <81516175+javaandfly@users.noreply.github.com> Date: Tue, 1 Aug 2023 21:26:03 +0800 Subject: [PATCH 0595/1974] add navi protocol (#6972) * add navi protocol Signed-off-by: xiaodong * minor fix --------- Signed-off-by: xiaodong Co-authored-by: xiaodong Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/navi/index.js | 43 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 projects/navi/index.js diff --git a/projects/navi/index.js b/projects/navi/index.js new file mode 100644 index 00000000000..7acf22c3d17 --- /dev/null +++ b/projects/navi/index.js @@ -0,0 +1,43 @@ +const sui = require("../helper/chain/sui") + +const reserves = [ + "0xab644b5fd11aa11e930d1c7bc903ef609a9feaf9ffe1b23532ad8441854fbfaf", + "0xeb3903f7748ace73429bd52a70fff278aac1725d3b58afa781f25ce3450ac203", +] + +const decimalShift = { + '0x5d4b302506645c37ff133b98c4b50a5ae14841659738d6d733d59d0d217a93bf::coin::COIN': -3, // USDC +} + + +async function borrow() { + const { api } = arguments[3] + const objects = await sui.getObjects(reserves) + objects.forEach(object => { + const coin = '0x' + object.fields.value.fields.coin_type + const borrowed = object.fields.value.fields.borrow_balance.fields.total_supply + const amount = borrowed * (10 ** (decimalShift[coin] ?? 0)) + api.add(coin, amount) + }) +} + + +async function tvl() { + const { api } = arguments[3] + const objects = await sui.getObjects(reserves) + objects.forEach(object => { + const coin = '0x' + object.fields.value.fields.coin_type + const total_supply = object.fields.value.fields.supply_balance.fields.total_supply + const borrowed = object.fields.value.fields.borrow_balance.fields.total_supply + const amount = (total_supply - borrowed) * (10 ** (decimalShift[coin] ?? 0)) + api.add(coin, amount) + }) +} + +module.exports = { + timetravel: false, + sui: { + tvl, + borrowed: borrow, + }, +} \ No newline at end of file From 5a59b1968387e391325cbb6a85e31d201b4a4a3e Mon Sep 17 00:00:00 2001 From: define Date: Tue, 1 Aug 2023 15:24:38 +0100 Subject: [PATCH 0596/1974] fix vaultka hallmark --- projects/vaultka/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/projects/vaultka/index.js b/projects/vaultka/index.js index 9b95fa39c49..24c744a0303 100644 --- a/projects/vaultka/index.js +++ b/projects/vaultka/index.js @@ -1,6 +1,8 @@ module.exports = { misrepresentedTokens: true, - hallmark: [1688342964, "Launch Sake Vault"], + hallmarks: [ + [1688342964,"Launch Sake Vault"] + ], arbitrum: { tvl: async (_, _b, _cb, { api }) => { const vaults = [ From 0475b06e1491354df7f1ede9e43cc7eb9a1e043f Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 1 Aug 2023 16:26:22 +0200 Subject: [PATCH 0597/1974] track predy v5 --- projects/predy-v5/index.js | 39 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 projects/predy-v5/index.js diff --git a/projects/predy-v5/index.js b/projects/predy-v5/index.js new file mode 100644 index 00000000000..be27dd09199 --- /dev/null +++ b/projects/predy-v5/index.js @@ -0,0 +1,39 @@ +const v5Address = '0x06a61E55d4d4659b1A23C0F20AEdfc013C489829'; + +const abi = { + v5: { + getAsset: "function getAsset(uint256 _id) view returns (tuple(uint256 id, uint256 pairGroupId, tuple(address token, address supplyTokenAddress, tuple(uint256 totalCompoundDeposited, uint256 totalNormalDeposited, uint256 totalNormalBorrowed, uint256 assetScaler, uint256 assetGrowth, uint256 debtGrowth) tokenStatus, tuple(uint256 baseRate, uint256 kinkRate, uint256 slope1, uint256 slope2) irmParams) stablePool, tuple(address token, address supplyTokenAddress, tuple(uint256 totalCompoundDeposited, uint256 totalNormalDeposited, uint256 totalNormalBorrowed, uint256 assetScaler, uint256 assetGrowth, uint256 debtGrowth) tokenStatus, tuple(uint256 baseRate, uint256 kinkRate, uint256 slope1, uint256 slope2) irmParams) underlyingPool, tuple(uint256 riskRatio, int24 rangeSize, int24 rebalanceThreshold) riskParams, tuple(address uniswapPool, int24 tickLower, int24 tickUpper, uint64 numRebalance, uint256 totalAmount, uint256 borrowedAmount, uint256 lastRebalanceTotalSquartAmount, uint256 lastFee0Growth, uint256 lastFee1Growth, uint256 borrowPremium0Growth, uint256 borrowPremium1Growth, uint256 fee0Growth, uint256 fee1Growth, tuple(int256 positionAmount, uint256 lastFeeGrowth) rebalancePositionUnderlying, tuple(int256 positionAmount, uint256 lastFeeGrowth) rebalancePositionStable, int256 rebalanceFeeGrowthUnderlying, int256 rebalanceFeeGrowthStable) sqrtAssetStatus, bool isMarginZero, bool isIsolatedMode, uint256 lastUpdateTimestamp) data)", + globalData: "function globalData() view returns (uint256 pairGroupsCount, uint256 pairsCount, uint256 vaultCount)", + } +} + +async function tvl(_, _b, _cb, { api, }) { + const { pairsCount } = await api.call({ abi: abi.v5.globalData, target: v5Address}) + const data = await api.fetchList({ itemCount: pairsCount - 1, startFromOne: true, itemAbi: abi.v5.getAsset, target: v5Address}) + const tokens = [] + data.forEach(({ stablePool, underlyingPool }) => { + tokens.push(stablePool.token) + tokens.push(underlyingPool.token) + }) + return api.sumTokens({ tokens, owner:v5Address,}) +} + +async function borrowed(_, _b, _cb, { api, }) { + const { pairsCount } = await api.call({ abi: abi.v5.globalData, target: v5Address}) + const data = await api.fetchList({ itemCount: pairsCount - 1, startFromOne: true, itemAbi: abi.v5.getAsset, target: v5Address}) + data.forEach(({ stablePool, underlyingPool }) => { + api.add(stablePool.token, stablePool.tokenStatus.totalNormalBorrowed) + api.add(underlyingPool.token, underlyingPool.tokenStatus.totalNormalBorrowed) + }) +} + +module.exports = { + methodology: "USDC and WETH locked on predy contracts", + arbitrum: { + tvl, + borrowed, + }, + hallmarks: [ + [1688490168, "Launch Predy V5"] + ], +}; \ No newline at end of file From 6e4113362ace5988194f91ec80bc1141c5780b44 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 1 Aug 2023 16:30:32 +0200 Subject: [PATCH 0598/1974] minor fix --- projects/oasisswapdex/index.js | 8 ++++---- projects/predy-v5/index.js | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/projects/oasisswapdex/index.js b/projects/oasisswapdex/index.js index a3e5d657d94..75d618b10a4 100644 --- a/projects/oasisswapdex/index.js +++ b/projects/oasisswapdex/index.js @@ -8,13 +8,13 @@ module.exports = { "Factory address (0x947D83b35Cd2e71df4aC7B359C6761B07d0bce19) is used to find the LP pairs. TVL is equal to the liquidity on the AMM.", arbitrum: { tvl: sdk.util.sumChainTvls([ - getUniTVL({ factory: '0xbC467D80AD6401dC25B37EB86F5fcd048Ae4BF6d', chain: 'arbitrum', useDefaultCoreAssets: true }), - getUniTVL({ factory: '0x947D83b35Cd2e71df4aC7B359C6761B07d0bce19', chain: 'arbitrum', useDefaultCoreAssets: true }), + getUniTVL({ factory: '0xbC467D80AD6401dC25B37EB86F5fcd048Ae4BF6d', useDefaultCoreAssets: true }), + getUniTVL({ factory: '0x947D83b35Cd2e71df4aC7B359C6761B07d0bce19', useDefaultCoreAssets: true }), ]), - staking: staking("0x73c1fb66b4e183bc101b98d4c17431b667d85958", "0x602eb0d99a5e3e76d1510372c4d2020e12eaea8a", "arbitrum") + staking: staking("0x73c1fb66b4e183bc101b98d4c17431b667d85958", "0x602eb0d99a5e3e76d1510372c4d2020e12eaea8a") }, base: { tvl: sdk.util.sumChainTvls([ - getUniTVL({ factory: '0xc8126578093366968199707b7f8edff258f473b6', chain: 'base', useDefaultCoreAssets: true }), + getUniTVL({ factory: '0xc8126578093366968199707b7f8edff258f473b6', useDefaultCoreAssets: true }), ]), } }// node test.js projects/oasisswapdex/index.js \ No newline at end of file diff --git a/projects/predy-v5/index.js b/projects/predy-v5/index.js index be27dd09199..7ea9209f1a8 100644 --- a/projects/predy-v5/index.js +++ b/projects/predy-v5/index.js @@ -8,19 +8,19 @@ const abi = { } async function tvl(_, _b, _cb, { api, }) { - const { pairsCount } = await api.call({ abi: abi.v5.globalData, target: v5Address}) - const data = await api.fetchList({ itemCount: pairsCount - 1, startFromOne: true, itemAbi: abi.v5.getAsset, target: v5Address}) + const { pairsCount } = await api.call({ abi: abi.v5.globalData, target: v5Address }) + const data = await api.fetchList({ itemCount: pairsCount - 1, startFromOne: true, itemAbi: abi.v5.getAsset, target: v5Address }) const tokens = [] data.forEach(({ stablePool, underlyingPool }) => { tokens.push(stablePool.token) tokens.push(underlyingPool.token) }) - return api.sumTokens({ tokens, owner:v5Address,}) + return api.sumTokens({ tokens, owner: v5Address, }) } async function borrowed(_, _b, _cb, { api, }) { - const { pairsCount } = await api.call({ abi: abi.v5.globalData, target: v5Address}) - const data = await api.fetchList({ itemCount: pairsCount - 1, startFromOne: true, itemAbi: abi.v5.getAsset, target: v5Address}) + const { pairsCount } = await api.call({ abi: abi.v5.globalData, target: v5Address }) + const data = await api.fetchList({ itemCount: pairsCount - 1, startFromOne: true, itemAbi: abi.v5.getAsset, target: v5Address }) data.forEach(({ stablePool, underlyingPool }) => { api.add(stablePool.token, stablePool.tokenStatus.totalNormalBorrowed) api.add(underlyingPool.token, underlyingPool.tokenStatus.totalNormalBorrowed) From d6554dc110eeaea0ca95712ed9fbf16d6677460c Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 1 Aug 2023 17:43:34 +0200 Subject: [PATCH 0599/1974] fix credix --- projects/credix/credix.json | 185 ------------------ projects/credix/index.js | 374 +++++++++++++++--------------------- 2 files changed, 156 insertions(+), 403 deletions(-) delete mode 100644 projects/credix/credix.json diff --git a/projects/credix/credix.json b/projects/credix/credix.json deleted file mode 100644 index db7013fd9c8..00000000000 --- a/projects/credix/credix.json +++ /dev/null @@ -1,185 +0,0 @@ -{ - "version": "2.0.1", - "name": "credix", - "instructions": [], - "accounts": [ - { - "name": "Deal", - "type": { - "kind": "struct", - "fields": [ - { - "name": "name", - "type": "string" - }, - { - "name": "borrower", - "type": "publicKey" - }, - { - "name": "amountWithdrawn", - "type": "u64" - }, - { - "name": "lateFeePercentage", - "type": { - "defined": "Fraction" - } - }, - { - "name": "earlyRedemptionFees", - "type": "u64" - }, - { - "name": "earlyRedemptionFeesRepaid", - "type": "u64" - }, - { - "name": "unusedField1", - "type": "u16" - }, - { - "name": "goLiveAt", - "type": "i64" - }, - { - "name": "createdAt", - "type": "i64" - }, - { - "name": "maxFundingDuration", - "type": "u8" - }, - { - "name": "slashInterestToPrincipal", - "type": "bool" - }, - { - "name": "slashPrincipalToInterest", - "type": "bool" - }, - { - "name": "unusedField2", - "type": { - "array": ["u8", 6] - } - }, - { - "name": "dealNumber", - "type": "u16" - }, - { - "name": "bump", - "type": "u8" - }, - { - "name": "lateFees", - "type": "u64" - }, - { - "name": "lateFeesRepaid", - "type": "u64" - }, - { - "name": "defaulted", - "type": "bool" - }, - { - "name": "trueWaterfall", - "type": "bool" - }, - { - "name": "openedAt", - "type": "i64" - }, - { - "name": "interestFee", - "type": { - "defined": "Fraction" - } - } - ] - } - }, - { - "name": "RepaymentSchedule", - "type": { - "kind": "struct", - "fields": [ - { - "name": "periodDuration", - "type": "u8" - }, - { - "name": "daysInYear", - "type": "u16" - }, - { - "name": "totalPeriods", - "type": "u16" - }, - { - "name": "periods", - "type": { - "vec": { - "defined": "RepaymentPeriod" - } - } - } - ] - } - } - ], - "types": [ - { - "name": "Fraction", - "type": { - "kind": "struct", - "fields": [ - { - "name": "numerator", - "type": "u32" - }, - { - "name": "denominator", - "type": "u32" - } - ] - } - }, - { - "name": "RepaymentPeriod", - "type": { - "kind": "struct", - "fields": [ - { - "name": "principal", - "type": "u64" - }, - { - "name": "interest", - "type": "u64" - }, - { - "name": "totalInterestExpected", - "type": "u64" - }, - { - "name": "totalPrincipalExpected", - "type": "u64" - }, - { - "name": "principalRepaid", - "type": "u64" - }, - { - "name": "interestRepaid", - "type": "u64" - } - ] - } - } - ], - "events": [], - "errors": [] -} diff --git a/projects/credix/index.js b/projects/credix/index.js index 2353c6894e9..8557b9ccd38 100644 --- a/projects/credix/index.js +++ b/projects/credix/index.js @@ -1,20 +1,17 @@ const ADDRESSES = require("../helper/coreAssets.json"); -const BigNumber = require("bignumber.js"); const { PublicKey } = require("@solana/web3.js"); -const { Program, utils, BN } = require("@project-serum/anchor"); -const { getProvider, sumTokens2, sumTokens } = require("../helper/solana"); +const { Program, utils,} = require("@project-serum/anchor"); +const { getProvider, sumTokens2, } = require("../helper/solana"); -const MAX_NUMBER_OF_ACCOUNT_INFOS = 99; const MARKET_SEED_FINTECH = "credix-marketplace"; const MARKET_SEED_RECEIVABLES = "receivables-factoring"; -const IDL = require("./credix.json"); const USDC = ADDRESSES.solana.USDC; const programId = new PublicKey("CRDx2YkdtYtGZXGHZ59wNv1EwKHQndnRc1gT4p8i2vPX"); const encodeSeedString = (seedString) => Buffer.from(utils.bytes.utf8.encode(seedString)); const constructProgram = (provider) => { - return new Program(IDL, programId, provider); + return new Program(idl, programId, provider); }; const findPDA = async (seeds) => { @@ -32,161 +29,6 @@ const findSigningAuthorityPDA = async (globalMarketSeed) => { return findPDA(seeds); }; -const findDealPda = (marketPk, borrowerPk, dealNumber) => { - const dealSeed = encodeSeedString("deal-info"); - const dealNumberSeed = new BN(dealNumber).toArrayLike(Buffer, "le", 2); - const seeds = [ - marketPk.toBuffer(), - borrowerPk.toBuffer(), - dealNumberSeed, - dealSeed, - ]; - return findPDA(seeds); -}; - -async function generateRepaymentSchedulePDA(deal, globalMarketSeed) { - const marketAdress = await findGlobalMarketStatePDA(globalMarketSeed); - const seed = [ - marketAdress[0].toBuffer(), - deal.publicKey.toBuffer(), - encodeSeedString("repayment-schedule"), - ]; - return PublicKey.findProgramAddress(seed, programId); -} - -function periodIsRepaid(period) { - const principal = period.principal; - const principalRepaid = period.principalRepaid; - const interest = period.interest; - const interestRepaid = period.interestRepaid; - - return principal === principalRepaid && interest === interestRepaid; -} - -function isRepaid(schedule) { - return schedule.periods.every((period) => periodIsRepaid(period)); -} - -function openedAt(deal) { - const openedAt = deal.openedAt; - return openedAt.bitLength() > 53 ? null : openedAt.toNumber(); -} - -function goLiveAt(deal) { - const goLiveAt = deal.goLiveAt; - return goLiveAt.bitLength() > 53 ? null : goLiveAt.toNumber(); -} - -function status(deal, schedule) { - if (!schedule) { - return "NO SCHEDULE FOUND"; - } - if (deal.defaulted) { - return "DEFAULTED"; - } - - if (!openedAt(deal)) { - return "PENDING"; - } - - if (!goLiveAt(deal)) { - return "OPEN_FOR_FUNDING"; - } - - if (isRepaid(schedule)) { - return "CLOSED"; - } - - return "IN_PROGRESS"; -} - -function isInProgress(deal, schedule) { - const dealStatus = status(deal.account, schedule); - return dealStatus === "IN_PROGRESS"; -} - -function totalPrincipal(repaymentSchedule) { - return new BigNumber( - repaymentSchedule.periods[ - repaymentSchedule.periods.length - 1 - ].totalPrincipalExpected.toString() - ); -} - -function principalRepaid(repaymentSchedule) { - const cumulPrincipalRepaid = repaymentSchedule.periods.reduce( - (acc, p) => acc.plus(new BigNumber(p.principalRepaid.toString())), - new BigNumber(0) - ); - - return cumulPrincipalRepaid; -} - -function chunk(inputArray, perChunk) { - const result = inputArray.reduce((resultArray, item, index) => { - const chunkIndex = Math.floor(index / perChunk); - - if (!resultArray[chunkIndex]) { - resultArray[chunkIndex] = []; // start a new chunk - } - - resultArray[chunkIndex].push(item); - - return resultArray; - }, []); - - return result; -} - -async function asyncFilter(arr, filter) { - const results = await Promise.all(arr.map(filter)); - return arr.filter((_, i) => results[i]); -} - -async function filterDealsForMarket(deals, globalMarketSeed) { - const [globalMarketStatePk] = await findGlobalMarketStatePDA( - globalMarketSeed - ); - const marketDeals = await asyncFilter(deals, async (deal) => { - const [dealPDA] = await findDealPda( - globalMarketStatePk, - deal.account.borrower, - deal.account.dealNumber - ); - return dealPDA.equals(deal.publicKey); - }); - return marketDeals; -} - -async function fetchRepaymentScheduleForDeals( - program, - provider, - deals, - globalMarketSeed -) { - const pdaPromises = deals.map((d) => - generateRepaymentSchedulePDA(d, globalMarketSeed) - ); - const pdas = await Promise.all(pdaPromises); - const addresses = pdas.map((pda) => pda[0]); - const addressesChunks = chunk(addresses, MAX_NUMBER_OF_ACCOUNT_INFOS - 1); - const accountInfosChunks = await Promise.all( - addressesChunks.map((addressChunk) => { - const accInfos = - provider.connection.getMultipleAccountsInfo(addressChunk); - return accInfos; - }) - ); - const accountInfos = accountInfosChunks.flat(); - - const programVersions = accountInfos.map( - (accountInfo) => - accountInfo && - program.coder.accounts.decode("RepaymentSchedule", accountInfo.data) - ); - return programVersions; -} - async function tvl() { // Fintech pool const [signingAuthorityKeyFintech] = await findSigningAuthorityPDA( @@ -206,63 +48,6 @@ async function tvl() { return tokens; } -async function fetchOutstandingCreditPool( - provider, - program, - deals, - globalMarketSeed -) { - const marketDeals = await filterDealsForMarket(deals, globalMarketSeed); - const allRepaymentSchedules = await fetchRepaymentScheduleForDeals( - program, - provider, - marketDeals, - globalMarketSeed - ); - const inProgressSchedules = marketDeals.map((deal, index) => { - const schedule = allRepaymentSchedules[index]; - const dealIsInProgress = isInProgress(deal, schedule); - return dealIsInProgress ? schedule : null; - }); - const totalOutstandingCredit = inProgressSchedules - .filter((schedule) => schedule !== null) - .reduce((principalSum, schedule) => { - return principalSum - .plus(totalPrincipal(schedule)) - .minus(principalRepaid(schedule)); - }, new BigNumber(0)); - - return totalOutstandingCredit; -} - -async function borrowed() { - const provider = getProvider(); - const program = constructProgram(provider); - const allDeals = await program.account.deal.all(); - - // FinTech pool - const totalOutstandingCreditFintech = await fetchOutstandingCreditPool( - provider, - program, - allDeals, - MARKET_SEED_FINTECH - ); - - // Receivables factoring pool - const totalOutstandingCreditReceivables = await fetchOutstandingCreditPool( - provider, - program, - allDeals, - MARKET_SEED_RECEIVABLES - ); - - return { - ["solana:" + USDC]: totalOutstandingCreditFintech - .plus(totalOutstandingCreditReceivables) - .toString(), - }; -} - module.exports = { timetravel: false, solana: { @@ -270,3 +55,156 @@ module.exports = { borrowed, }, }; + +async function borrowed(_, _b, _cb, { api, }) { + + const provider = getProvider(); + const program = constructProgram(provider); + const states = await program.account.globalMarketState.all(); + + states.forEach(({ account }) => { + api.add(account.baseTokenMint.toBase58(), account.poolOutstandingCredit.toString()) + }) +} + +async function tvl1(_, _b, _cb, { api, }) { + + const provider = getProvider(); + const program = constructProgram(provider); + const states = await program.account.globalMarketState.all(); + + const tokenAccounts = states.map(({ account }) => account.treasuryPoolTokenAccount.toBase58()) + return sumTokens2({ tokenAccounts }) +} + +const idl = { + version: '3.11.0', + name: 'credix', + instructions: [], + accounts: [{ + name: 'globalMarketState', + type: { + kind: 'struct', + fields: [ + { + name: 'baseTokenMint', + type: 'publicKey' + }, + { + name: 'lpTokenMint', + type: 'publicKey' + }, + { + name: 'poolOutstandingCredit', + docs: [ + 'The amount from senior tranche lent' + ], + type: 'u64' + }, + { + name: 'treasuryPoolTokenAccount', + type: 'publicKey' + }, + { + name: 'signingAuthorityBump', + type: 'u8' + }, + { + name: 'bump', + type: 'u8' + }, + { + name: 'credixFeePercentage', + type: { + defined: 'Fraction' + } + }, + { + name: 'withdrawalFee', + docs: [ + 'The fee charged for withdrawals' + ], + type: { + defined: 'Fraction' + } + }, + { + name: 'frozen', + type: 'bool' + }, + { + name: 'seed', + type: 'string' + }, + { + name: 'poolSizeLimitPercentage', + docs: [ + 'Maximum possible deposit limit in addition the pool outstanding credit', + 'pool_size_limit = pool_outstanding_credit + pool_size_limit_percentage * pool_outstanding_credit' + ], + type: { + defined: 'Fraction' + } + }, + { + name: 'withdrawEpochRequestSeconds', + type: 'u32' + }, + { + name: 'withdrawEpochRedeemSeconds', + type: 'u32' + }, + { + name: 'withdrawEpochAvailableLiquiditySeconds', + type: 'u32' + }, + { + name: 'latestWithdrawEpochIdx', + type: 'u32' + }, + { + name: 'latestWithdrawEpochEnd', + type: 'i64' + }, + { + name: 'lockedLiquidity', + type: 'u64' + }, + { + name: 'totalRedeemedBaseAmount', + type: 'u64' + }, + { + name: 'hasWithdrawEpochs', + type: 'bool' + }, + { + name: 'redeemAuthorityBump', + docs: [ + 'This is only used for wormhole related token transfer occurs.' + ], + type: 'u8' + } + ] + } + }], + types: [ + { + name: 'Fraction', + type: { + kind: 'struct', + fields: [ + { + name: 'numerator', + type: 'u32' + }, + { + name: 'denominator', + type: 'u32' + } + ] + } + }], + events: [], + errors: [ ] +} \ No newline at end of file From f3098953284ec55c7f80c6054b13366dccddc6ad Mon Sep 17 00:00:00 2001 From: define Date: Tue, 1 Aug 2023 17:26:59 +0100 Subject: [PATCH 0600/1974] add base chain to sushi-v3 --- projects/sushiswap-v3/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/projects/sushiswap-v3/index.js b/projects/sushiswap-v3/index.js index 9dea5ba634c..30af1c0e74b 100644 --- a/projects/sushiswap-v3/index.js +++ b/projects/sushiswap-v3/index.js @@ -58,4 +58,8 @@ module.exports = uniV3Export({ factory: "0xc35dadb65012ec5796536bd9864ed8773abc74c4", fromBlock: 132536332, }, + base: { + factory: "0xc35DADB65012eC5796536bD9864eD8773aBc74C4", + fromBlock: 1759510, + }, }); From 8df7542094851696a322983eaa55ed8003b73edb Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Tue, 1 Aug 2023 19:48:37 +0100 Subject: [PATCH 0601/1974] export as usdc --- projects/ondofinance/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/ondofinance/index.js b/projects/ondofinance/index.js index 8574f516e65..4c91c46b45d 100644 --- a/projects/ondofinance/index.js +++ b/projects/ondofinance/index.js @@ -1,5 +1,4 @@ -const { toUSDTBalances } = require('../helper/balances') const sdk = require('@defillama/sdk') module.exports = { @@ -25,7 +24,8 @@ Object.keys(config).forEach(chain => { const ethApi = new sdk.ChainApi({ chain: 'ethereum', block: _b}) const supplies = await api.multiCall({ abi: 'erc20:totalSupply', calls: funds }) const tokenPrice = (await ethApi.call({ abi: 'uint256:rwaPrice', target: '0xc53e6824480d976180A65415c19A6931D17265BA'})) / 1e18 - return toUSDTBalances(supplies.reduce((a, i) => a +i/1e18, 0) * tokenPrice) + const totalTvl = (supplies.reduce((a, i) => a +i/1e18, 0) * tokenPrice) + return {'usd-coin':totalTvl} } } }) \ No newline at end of file From 1a5983fa24193bc257e95274b5166f18d04016b7 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Wed, 2 Aug 2023 00:44:00 +0100 Subject: [PATCH 0602/1974] blacklist YAKU --- projects/openbook/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/openbook/index.js b/projects/openbook/index.js index ec53dee1963..462302fd50f 100644 --- a/projects/openbook/index.js +++ b/projects/openbook/index.js @@ -5,6 +5,7 @@ const blacklistedTokens = new Set([ '674PmuiDtgKx3uKuJ1B16f9m5L84eFvNwj3xDMvHcbo7', // $WOOD 'SNSNkV9zfG5ZKWQs6x4hxvBRV6s8SqMfSGCtECDvdMd', // SNS 'A7rqejP8LKN8syXMr4tvcKjs2iJ4WtZjXNs1e6qP3m9g', // ZION + 'NGK3iHqqQkyRZUj4uhJDQqEyKKcZ7mdawWpqwMffM3s', // YAKU ]) async function tvl(_, _1, _2, { api }) { From f028522254304edfdd0b35ca8fbf4f1c698bde18 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Wed, 2 Aug 2023 00:58:28 +0100 Subject: [PATCH 0603/1974] add YAKU to distressed assets --- projects/helper/tokenMapping.js | 1 + projects/openbook/index.js | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index ba8c048c32f..6a5f2c0bd91 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -24,6 +24,7 @@ const distressedAssts = new Set(Object.values({ aBNBc: ADDRESSES.bsc.ankrBNB, aBNBb: ADDRESSES.bsc.aBNBb, XRPC: '0xd4ca5c2aff1eefb0bea9e9eab16f88db2990c183', + YAKU: 'NGK3iHqqQkyRZUj4uhJDQqEyKKcZ7mdawWpqwMffM3s' }).map(i => i.toLowerCase())) const transformTokens = { diff --git a/projects/openbook/index.js b/projects/openbook/index.js index 462302fd50f..ec53dee1963 100644 --- a/projects/openbook/index.js +++ b/projects/openbook/index.js @@ -5,7 +5,6 @@ const blacklistedTokens = new Set([ '674PmuiDtgKx3uKuJ1B16f9m5L84eFvNwj3xDMvHcbo7', // $WOOD 'SNSNkV9zfG5ZKWQs6x4hxvBRV6s8SqMfSGCtECDvdMd', // SNS 'A7rqejP8LKN8syXMr4tvcKjs2iJ4WtZjXNs1e6qP3m9g', // ZION - 'NGK3iHqqQkyRZUj4uhJDQqEyKKcZ7mdawWpqwMffM3s', // YAKU ]) async function tvl(_, _1, _2, { api }) { From 589504330a7d9942614d191fd678f1baddb93702 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Wed, 2 Aug 2023 03:02:29 +0100 Subject: [PATCH 0604/1974] add base to sushi --- projects/sushiswap/api.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/sushiswap/api.js b/projects/sushiswap/api.js index 977473cc2f4..bded00d1074 100644 --- a/projects/sushiswap/api.js +++ b/projects/sushiswap/api.js @@ -73,6 +73,7 @@ module.exports = { tvl: getUniTVL({ factory: '0x43eA90e2b786728520e4f930d2A71a477BF2737C', useDefaultCoreAssets: true, }), }, arbitrum_nova: { tvl, }, + base: { tvl, }, //moved kava to trident adapter //kava: { // tvl: kavaTridentTvl, //}, } From 79f6b55eee4291460b61b59db14646b4f452516d Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Wed, 2 Aug 2023 05:14:17 +0100 Subject: [PATCH 0605/1974] blacklist YAKU on adapter --- projects/openbook/index.js | 1 + projects/serum.js | 1 + 2 files changed, 2 insertions(+) diff --git a/projects/openbook/index.js b/projects/openbook/index.js index ec53dee1963..072f8a7bae0 100644 --- a/projects/openbook/index.js +++ b/projects/openbook/index.js @@ -5,6 +5,7 @@ const blacklistedTokens = new Set([ '674PmuiDtgKx3uKuJ1B16f9m5L84eFvNwj3xDMvHcbo7', // $WOOD 'SNSNkV9zfG5ZKWQs6x4hxvBRV6s8SqMfSGCtECDvdMd', // SNS 'A7rqejP8LKN8syXMr4tvcKjs2iJ4WtZjXNs1e6qP3m9g', // ZION + 'NGK3iHqqQkyRZUj4uhJDQqEyKKcZ7mdawWpqwMffM3s', //YAKU ]) async function tvl(_, _1, _2, { api }) { diff --git a/projects/serum.js b/projects/serum.js index 9e1f68e6c5a..a270aef86db 100644 --- a/projects/serum.js +++ b/projects/serum.js @@ -6,6 +6,7 @@ const blacklistedTokens = new Set([ '674PmuiDtgKx3uKuJ1B16f9m5L84eFvNwj3xDMvHcbo7', // $WOOD 'SNSNkV9zfG5ZKWQs6x4hxvBRV6s8SqMfSGCtECDvdMd', // SNS 'A7rqejP8LKN8syXMr4tvcKjs2iJ4WtZjXNs1e6qP3m9g', // ZION + 'NGK3iHqqQkyRZUj4uhJDQqEyKKcZ7mdawWpqwMffM3s', //YAKU ]) async function tvl(_, _1, _2, { api }) { From a6c3668f854637519675d430dd859aff4eadf47b Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 2 Aug 2023 07:42:19 +0200 Subject: [PATCH 0606/1974] fix serum --- projects/serum.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/serum.js b/projects/serum.js index a270aef86db..38fb4171994 100644 --- a/projects/serum.js +++ b/projects/serum.js @@ -7,6 +7,7 @@ const blacklistedTokens = new Set([ 'SNSNkV9zfG5ZKWQs6x4hxvBRV6s8SqMfSGCtECDvdMd', // SNS 'A7rqejP8LKN8syXMr4tvcKjs2iJ4WtZjXNs1e6qP3m9g', // ZION 'NGK3iHqqQkyRZUj4uhJDQqEyKKcZ7mdawWpqwMffM3s', //YAKU + 'EP2aYBDD4WvdhnwWLUMyqU69g1ePtEjgYK6qyEAFCHTx', //KRILL ]) async function tvl(_, _1, _2, { api }) { From d36e3aa320e2a203f2a8750a147a3fd8dec4de8e Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 2 Aug 2023 08:13:39 +0200 Subject: [PATCH 0607/1974] fix helix --- projects/helper/chain/injective.js | 2 +- projects/injective-orderbook/api.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/helper/chain/injective.js b/projects/helper/chain/injective.js index c482ba2315d..e0a674aea84 100644 --- a/projects/helper/chain/injective.js +++ b/projects/helper/chain/injective.js @@ -14,7 +14,7 @@ function getClient(type = TYPES.SPOT) { if (!clients[type]) { const network = getNetworkInfo(Network.Mainnet) if (type === TYPES.SPOT) - clients[type] = new IndexerGrpcSpotApi(network.grpc); + clients[type] = new IndexerGrpcSpotApi(network.indexerApi); else if (type === TYPES.DERIVATIVES) clients[type] = new IndexerGrpcDerivativesApi(network.indexerApi) else diff --git a/projects/injective-orderbook/api.js b/projects/injective-orderbook/api.js index 56b8cca4985..313a21eb90f 100644 --- a/projects/injective-orderbook/api.js +++ b/projects/injective-orderbook/api.js @@ -35,7 +35,7 @@ module.exports = { timetravel: false, injective: { tvl: sdk.util.sumChainTvls([ - // getOrderBookTvl(TYPES.SPOT), + getOrderBookTvl(TYPES.SPOT), getOrderBookTvl(TYPES.DERIVATIVES) ]) } From 0366001de713388a0705fcd0b97edc47dc0a1d38 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 2 Aug 2023 08:27:44 +0200 Subject: [PATCH 0608/1974] balancer: track avax --- projects/balancer/onchain.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/balancer/onchain.js b/projects/balancer/onchain.js index 057f1a06495..0009056f6e2 100644 --- a/projects/balancer/onchain.js +++ b/projects/balancer/onchain.js @@ -22,6 +22,7 @@ const config = { xdai: { fromBlock: 24821598, }, polygon_zkevm: { fromBlock: 203079, }, base: { fromBlock: 1196036, }, + avax: { fromBlock: 26386141, }, } module.exports = {}; From a197f2a0675b39e37f50cad1cdc4641f78314503 Mon Sep 17 00:00:00 2001 From: ALPHADA <48852104+ALPHADA@users.noreply.github.com> Date: Wed, 2 Aug 2023 15:45:25 +0900 Subject: [PATCH 0609/1974] Add Gambit Project (#6985) * Add Gambit Project * minor fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/gambit/index.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 projects/gambit/index.js diff --git a/projects/gambit/index.js b/projects/gambit/index.js new file mode 100644 index 00000000000..29c47248412 --- /dev/null +++ b/projects/gambit/index.js @@ -0,0 +1,12 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require("../helper/unwrapLPs"); + +const SimpleGToken = "0x0729e806f57CE71dA4464c6B2d313E517f41560b"; // SimpleGToken + +module.exports = { + methodology: `Count the USDC that has been deposited on Gambit`, + era: { + tvl: sumTokensExport({ owner: SimpleGToken, tokens: [ADDRESSES.era.USDC], }), + }, +}; + From cd1144037b8b97a87569852fd66c5d9ccde7e36c Mon Sep 17 00:00:00 2001 From: 0xSTONE Date: Wed, 2 Aug 2023 14:45:32 +0800 Subject: [PATCH 0610/1974] feat: add mufex tvl (#6984) Co-authored-by: stone --- projects/mufex/index.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 projects/mufex/index.js diff --git a/projects/mufex/index.js b/projects/mufex/index.js new file mode 100644 index 00000000000..6cabb58fb75 --- /dev/null +++ b/projects/mufex/index.js @@ -0,0 +1,13 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require('../helper/unwrapLPs') + +const owners = [ + '0x763ecd00eEA0CDAECBDF97d88c3e0fd5457eE5A0', + '0x16BEDB2Ab2aEf9023ff2cbF0C78135cA120c03C6', +] + +module.exports = { + arbitrum: { tvl: sumTokensExport({ owners, tokens: [ADDRESSES.arbitrum.USDT] }) }, + polygon: { tvl: sumTokensExport({ owners, tokens: [ADDRESSES.polygon.USDT] }) }, + bsc: { tvl: sumTokensExport({ owners, tokens: [ADDRESSES.bsc.USDT] }) }, +}; From cc2a8709909071ce8759b15ee237828297e019d8 Mon Sep 17 00:00:00 2001 From: dev0kokoa <86997922+dev0kokoa@users.noreply.github.com> Date: Wed, 2 Aug 2023 15:46:21 +0900 Subject: [PATCH 0611/1974] feat: add uni v2 factory in kokonutswap for base chain (#6983) * feat: add kokonutswap for polygon zkevm * fix: eslint * feat: add base chain for kokonut swap * feat: add uni v2 factory in kokonutswap for base chain --- projects/kokonut-swap/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/projects/kokonut-swap/index.js b/projects/kokonut-swap/index.js index 49ccdf34c76..7c6f58e6577 100644 --- a/projects/kokonut-swap/index.js +++ b/projects/kokonut-swap/index.js @@ -2,6 +2,7 @@ const abi = require("./abi.json"); const sdk = require("@defillama/sdk"); const { requery } = require('../helper/requery.js'); const { sumTokens2 } = require("../helper/unwrapLPs"); +const { getUniTVL } = require("../helper/unknownTokens"); const registry_addr = "0xBd21dD5BCFE28475D26154935894d4F515A7b1C0"; const helper_addr = "0x1A09643f4D70B9Aa9da5737568C1935ED37423aa"; @@ -77,6 +78,8 @@ async function polygon_zkevm_tvl(_, _b, _cb, { api }) { return sumTokens2({ api, ownerTokens }); } +const uniV2TVL = getUniTVL({ factory: '0x4Cf1284dcf30345232D5BfD8a8AAd6734b6941c4', useDefaultCoreAssets: true}); + async function base_tvl(_, _b, _cb, { api }) { const ownerTokens = []; const poolList = (await sdk.api.abi.call({ @@ -111,7 +114,7 @@ module.exports = { tvl: polygon_zkevm_tvl }, base: { - tvl: base_tvl + tvl: sdk.util.sumChainTvls([base_tvl, uniV2TVL]) }, methodology: "tvl is calculated using the total value of protocol's liquidity pool. Staked tokens include staked EYE values. Pool2 includes staked lp tokens eligible for KOKOS emissions" From b32cc4bbc5a6a47b855735fcecde77daf37bd2f3 Mon Sep 17 00:00:00 2001 From: Romuald Date: Wed, 2 Aug 2023 08:47:35 +0200 Subject: [PATCH 0612/1974] Update BetSwirl staking + Pool2 (#6982) * feat(betswirl): Add Staking contracts TVLs * feat(betswirl): update contracts and add pool2 --- projects/betswirl/index.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/projects/betswirl/index.js b/projects/betswirl/index.js index ec75654a00f..3cae7d5da13 100644 --- a/projects/betswirl/index.js +++ b/projects/betswirl/index.js @@ -1,19 +1,23 @@ const { staking } = require('../helper/staking') +const { sumTokens2 } = require("../helper/unwrapLPs.js") module.exports = { - methodology: "TVL counts BETS tokens deposited on the Staking contracts.", + methodology: "TVL counts BETS tokens or 8020 LP deposited on the Staking contracts.", start: 1687715559, bsc: { - tvl: () => ({}), - staking: staking('0xeb5F6571861EAA6de9F827519B48eFe979d4d913', '0x3e0a7C7dB7bB21bDA290A80c9811DE6d47781671'), + staking: staking('0x20Df34eBe5dCB1082297A18BA8d387B55fB975a0', '0x94025780a1aB58868D9B2dBBB775f44b32e8E6e5'), }, polygon: { - staking: staking('0xa184468972c71209BC31a5eF39b7321d2A839225', '0x9246a5f10a79a5a939b0c2a75a3ad196aafdb43b'), + staking: staking('0xA0D5F23dc9131597975afF96d293E5a7d0516665', '0x94025780a1aB58868D9B2dBBB775f44b32e8E6e5'), }, avax: { - staking: staking('0x31EDcD915e695AdAF782c482b9816613b347AC8c', '0xc763f8570a48c4c00c80b76107cbe744dda67b79'), + staking: staking('0x9913EffA744B72385E537E092710072D21f8BC98', '0x94025780a1aB58868D9B2dBBB775f44b32e8E6e5'), }, arbitrum: { - staking: staking('0xD4BFB259D8785228e5D2c19115D5DB342E2eE064', '0xe26ae3d881f3d5def58d795f611753804e7a6b26'), + staking: staking('0xA7Dd05a6CFC6e5238f04FD6E53D4eFa859B492e4', '0x94025780a1aB58868D9B2dBBB775f44b32e8E6e5'), + }, + ethereum: { + tvl: () => ({}), + pool2: (_, __, ___, { api }) => sumTokens2({ api, owners: ['0xaeaF7948C38973908fFA97c92F3384595d057135'], tokens: ['0x26cc136e9b8fd65466f193a8e5710661ed9a9827'] }), }, }; From f02b37c4cc1f92c50501c34f995badce3a46106e Mon Sep 17 00:00:00 2001 From: BoozeHuahua <124003923+BoozeHuahua@users.noreply.github.com> Date: Wed, 2 Aug 2023 08:48:51 +0200 Subject: [PATCH 0613/1974] added ChiHuaHua Amplifier, erisprotocol (#6981) erisprotocol -> ChiHuaHua Amplifier from https://www.erisprotocol.com/chihuahua/amplifier contract https://www.mintscan.io/chihuahua/account/chihuahua1nktfhalzvtx82kyn4dh6l8htcl0prfpnu380a39zj52nzu3j467qqg23ry --- projects/eris-protocol/index.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/projects/eris-protocol/index.js b/projects/eris-protocol/index.js index c4e1cf057eb..e8ffe72bfed 100644 --- a/projects/eris-protocol/index.js +++ b/projects/eris-protocol/index.js @@ -104,6 +104,10 @@ const config = { "cosmos", }, }, + chihuahua: { + coinGeckoId: "chihuahua-token", + hub: "chihuahua1nktfhalzvtx82kyn4dh6l8htcl0prfpnu380a39zj52nzu3j467qqg23ry", + }, }; async function getState(chain, contract) { @@ -289,4 +293,5 @@ module.exports = { injective: { tvl: () => productsTvl("injective") }, osmosis: { tvl: () => productsTvl("osmosis") }, neutron: { tvl: () => productsTvl("neutron") }, + chihuahua: { tvl: () => productsTvl("chihuahua") }, }; From 1ba31f2f9951d9078f915d3e2d25d385ac49a0e3 Mon Sep 17 00:00:00 2001 From: Michael Semin Date: Wed, 2 Aug 2023 14:49:41 +0800 Subject: [PATCH 0614/1974] Add hallmarks for ReHold (#6976) * added ethereum to rehold-v2 * added `hallmarks` for rehold --- projects/rehold/index.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/projects/rehold/index.js b/projects/rehold/index.js index cafb4212d12..64f9047d4df 100644 --- a/projects/rehold/index.js +++ b/projects/rehold/index.js @@ -18,4 +18,10 @@ module.exports = { arbitrum: { tvl }, optimism: { tvl }, fantom: { tvl }, + + hallmarks: [ + [1688688480, "ReHold V2 Launch"], + [1689743327, "Ethereum Deployment"], + [1690898169, "Limit Orders Launch"], + ], } From e9fd9cc4f5d20544ee1eca456eef2fb0bbdfeda4 Mon Sep 17 00:00:00 2001 From: 0xchiado <128964553+0xchiado@users.noreply.github.com> Date: Wed, 2 Aug 2023 08:54:02 +0200 Subject: [PATCH 0615/1974] Added new chain Base (#6980) * test * added SwapLine adapter * added SwapLine adapter * added new Fantom factory address; added Optimism Factory details * added new Base factory address --- projects/swapline/index.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/projects/swapline/index.js b/projects/swapline/index.js index 28dcf9c131e..d3dd743d6e3 100644 --- a/projects/swapline/index.js +++ b/projects/swapline/index.js @@ -5,8 +5,8 @@ const factories = { optimism: '0xd08C98F6409fCAe3E61f3157B4147B6595E60cf3', polygon_zkevm: '0x5A5c0C4832828FF878CE3ab4fEc44d21200b1496', arbitrum: '0xEE0616a2DEAa5331e2047Bc61E0b588195A49cEa', + base: '0x5A5c0C4832828FF878CE3ab4fEc44d21200b1496', } - async function tvl(_, _b, _cb, { api, }) { let blacklistedTokens = [] if (api.chain === 'fantom') blacklistedTokens = ['0xdc6ff44d5d932cbd77b52e5612ba0529dc6226f1'] @@ -35,7 +35,8 @@ module.exports = { hallmarks: [ [1682298000,"Launch on Optimism"], [1687827600,"Launch on Polygon zkEVM"], - [1689037200,"Launch on Arbitrum"] + [1689037200,"Launch on Arbitrum"], + [1690848000,"Launch on Base"] ], methodology: 'We count the token balances in in different liquidity book contracts', fantom:{ @@ -50,4 +51,7 @@ module.exports = { arbitrum:{ tvl, }, + base:{ + tvl, + }, }; \ No newline at end of file From 4e1139d32079debd353fbd4ba953fed772c5d380 Mon Sep 17 00:00:00 2001 From: Thanh Nguyen Date: Wed, 2 Aug 2023 11:18:58 +0700 Subject: [PATCH 0616/1974] feat: add USDS to `config.js` --- projects/wombat-exchange/config.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/wombat-exchange/config.js b/projects/wombat-exchange/config.js index e11f0b7b3fe..4704bcfa092 100644 --- a/projects/wombat-exchange/config.js +++ b/projects/wombat-exchange/config.js @@ -26,6 +26,7 @@ module.exports = { ankrETH: "0x1b507b97c89eDE3E40d1b2Ed92972197c6276D35", rbnb: "0x0592083B285aa75B9c8BaD2485C6cCCF93cCC348", SnBNB: "0xF1e604e9A31c3b575f91CF008445B7ce06BF3fef", + USDS: "0x0c735f84BD7EDA8F8176236091AF8068Bb6C41dE" }, }, arbitrum: { From 4c3c65e4c9c67826185f1b539abb1e542dec7565 Mon Sep 17 00:00:00 2001 From: Alexander Ponomarev Date: Wed, 2 Aug 2023 12:03:54 +0500 Subject: [PATCH 0617/1974] add line project (#6977) * add line project * typo * minor fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/line/index.js | 50 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 projects/line/index.js diff --git a/projects/line/index.js b/projects/line/index.js new file mode 100644 index 00000000000..f58d7083317 --- /dev/null +++ b/projects/line/index.js @@ -0,0 +1,50 @@ +/** + * LINE is a price-protected token. + * It is issued by borrowing against locking a collateral. + * If the token's price on DEXes grows after borrowing, the user will be able to sell it for profit. + * If it falls, the user will be able to repay the loan and get their collateral back (less fees). + * This is what ensures price protection. + * + * @see https://linetoken.org + * + */ + +const { sumUnknownTokens } = require('../helper/unknownTokens'); + +const LINE_CONTRACT_ADDRESS = "0x31f8d38df6514b6cc3C360ACE3a2EFA7496214f6"; +const COLLATERAL_TOKEN_ADDRESS = "0x0b93109d05Ef330acD2c75148891cc61D20C3EF1"; + +const tvl = async (_, _1, { kava: block }, { api }) => { + const LOAN_NFT_CONTRACT_ADDRESS = await api.call({ + abi: "address:loanNFT", + target: LINE_CONTRACT_ADDRESS, + }); + + return api.sumTokens({ + owners: [LINE_CONTRACT_ADDRESS, LOAN_NFT_CONTRACT_ADDRESS], + tokens: [COLLATERAL_TOKEN_ADDRESS], + }); +} + + +const staking = async (_, _1, { kava: block }, { api }) => { + const poolAddresses = await api.call({ + abi: "function getAllPools() view returns (tuple[](tuple(bool, uint16, uint256, uint256, uint256), address))", + target: LINE_CONTRACT_ADDRESS, + }).then(allPools => allPools.map(([_, address]) => address)); + + return sumUnknownTokens({ + owners: [LINE_CONTRACT_ADDRESS], + tokens: poolAddresses, + api, resolveLP: true, + coreAssets: [COLLATERAL_TOKEN_ADDRESS ] + }); +} + +module.exports = { + methodology: 'The TVL is calculated as USD value of the collateral locked for issuing LINE tokens, staked LP tokens of incentivized pools, and the balances of pending orders on the options market.', + kava: { + tvl, + staking + } +} \ No newline at end of file From 3318ea9e80d617588bf5306a595df2314047fc58 Mon Sep 17 00:00:00 2001 From: Baptiste Guerin <38328426+BaptistG@users.noreply.github.com> Date: Wed, 2 Aug 2023 12:09:23 +0200 Subject: [PATCH 0618/1974] feat(projects/angle): add Transmuter migration event (#6988) --- projects/angle/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/angle/index.js b/projects/angle/index.js index d22e94718a7..bbbd16e6657 100644 --- a/projects/angle/index.js +++ b/projects/angle/index.js @@ -104,6 +104,7 @@ If not, the API call defaults to mainnet and the blockchain calls fail and retur module.exports = { hallmarks: [ [Math.floor(new Date('2023-03-13') / 1e3), 'Euler was hacked'], + [Math.floor(new Date('2023-08-02') / 1e3), 'Migration to v2 (Transmuter)'], ], ethereum: { staking: staking(veANGLE, ANGLE, "ethereum"), From 5effc81e59c859d4ab6fb06a3bb22db3c7aab718 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 2 Aug 2023 12:15:42 +0200 Subject: [PATCH 0619/1974] hashdao: track bsc --- projects/hashdaofinance/index.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/projects/hashdaofinance/index.js b/projects/hashdaofinance/index.js index c7516f54d88..28dd4708df5 100644 --- a/projects/hashdaofinance/index.js +++ b/projects/hashdaofinance/index.js @@ -1,6 +1,6 @@ const { sumTokens2 } = require("../helper/unwrapLPs"); +const { sumTokensExport } = require("../helper/unknownTokens") const { staking } = require('../helper/staking') -const { pool2 } = require('../helper/pool2') const config = { arbitrum: { @@ -18,6 +18,14 @@ const config = { hash: '0x2e80259c9071b6176205ff5f5eb6f7ec8361b93f', isPool2: true, }, + bsc: { + contract: '0x882105478F2193001f8Fed8399aF93f31CC42F85', + lp: '0xc970cdEBe5cF52eA416C5160Dc64A17Db134feE9', + chef: '0x2b9c8B76176957A0448279Da9B8cDEbE94Becd19', + vHash: '0xb557c071BAe7DC3aa2366Cd0FC0477B45Eb696f1', + hash: '0xb4e0E46cC733106F8f5B9845e2011B128A1EA39a', + isPool2: true, + }, } Object.keys(config).forEach(chain => { @@ -30,7 +38,7 @@ Object.keys(config).forEach(chain => { } } if (chef && lp) - module.exports[chain].pool2 = isPool2 ? pool2(chef, lp) : staking(chef, lp) + module.exports[chain].pool2 = isPool2 ? sumTokensExport({ owner: chef, tokens: [lp], useDefaultCoreAssets: true, }) : staking(chef, lp) if (hash && vHash) module.exports[chain].staking = staking(vHash, hash, undefined, 'arbitrum:'+config.arbitrum.hash) From 6a0967ab155d35f85dbf445a76314dd6d01dd0d3 Mon Sep 17 00:00:00 2001 From: velocore <128014130+velocore@users.noreply.github.com> Date: Wed, 2 Aug 2023 19:35:41 +0900 Subject: [PATCH 0620/1974] add velocore-v2 (#6990) * add velocore-v2 * minor fix --------- Co-authored-by: Haruka Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/velocore-v2/index.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 projects/velocore-v2/index.js diff --git a/projects/velocore-v2/index.js b/projects/velocore-v2/index.js new file mode 100644 index 00000000000..70b58a07e58 --- /dev/null +++ b/projects/velocore-v2/index.js @@ -0,0 +1,21 @@ +const { sumTokens2 } = require('../helper/unwrapLPs'); + +module.exports = { + linea: { + tvl: async (_, _1, _2, { api }) => { + const a = await api.call({ + abi: "function canonicalPools(address user, uint256 begin, uint256 maxLength) returns (tuple(address gauge, tuple(address pool, string poolType, bytes32[] lpTokens, uint256[] mintedLPTokens, bytes32[] listedTokens, uint256[] reserves, bytes poolParams) poolData, bool killed, uint256 totalVotes, uint256 userVotes, uint256 userClaimable, uint256 emissionRate, uint256 userEmissionRate, uint256 stakedValueInHubToken, uint256 userStakedValueInHubToken, uint256 averageInterestRatePerSecond, uint256 userInterestRatePerSecond, bytes32[] stakeableTokens, uint256[] stakedAmounts, uint256[] userStakedAmounts, bytes32[] underlyingTokens, uint256[] stakedUnderlying, uint256[] userUnderlying, tuple(bytes32[] tokens, uint256[] rates, uint256[] userClaimable, uint256[] userRates)[] bribes)[] gaugeDataArray)", + target: "0x2AB2398303B79884B8eC18A145EBd496145dfeEC", + params: ["0x2AB2398303B79884B8eC18A145EBd496145dfeEC", 0, 1000] + }); + let tokens = a.map(g => g.poolData.listedTokens).flat().map(i => '0x' + i.slice(2 + 24)) + return sumTokens2({ + owner: "0x1d0188c4B276A09366D05d6Be06aF61a73bC7535", tokens, blacklistedTokens: [ + '0x2441488a43e9F35289564c2c9f8c783F3c6bb596', + '0x226398c89a2BA3C30689939EF9c4984c4a4d314A', + ], api, + }) + }, + }, + methodology: "counts tokens in the vault.", +}; \ No newline at end of file From 574501c936afd0e3cd5642c01804a187e98f07a4 Mon Sep 17 00:00:00 2001 From: kilo-dev1 <135103843+kilo-dev1@users.noreply.github.com> Date: Wed, 2 Aug 2023 18:35:53 +0800 Subject: [PATCH 0621/1974] Add Kiloex Adapter (#6989) * kiloex * fix * fix * code refactor --------- Co-authored-by: hao.yue Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/kiloex/index.js | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 projects/kiloex/index.js diff --git a/projects/kiloex/index.js b/projects/kiloex/index.js new file mode 100644 index 00000000000..056ed53416a --- /dev/null +++ b/projects/kiloex/index.js @@ -0,0 +1,9 @@ +const ADDRESSES = require("../helper/coreAssets.json"); +const { sumTokensExport } = require("../helper/unwrapLPs"); + +const owners = ["0x1c3f35F7883fc4Ea8C4BCA1507144DC6087ad0fb", "0xfE03be1b0504031e92eDA810374222c944351356"]; + +module.exports = { + start: 1690971144, + bsc: { tvl: sumTokensExport({ owners, tokens: [ADDRESSES.bsc.USDT], }) }, +}; \ No newline at end of file From bc728a652d56a0b7f720666170a2240bdcd2b79a Mon Sep 17 00:00:00 2001 From: define Date: Wed, 2 Aug 2023 11:39:09 +0100 Subject: [PATCH 0622/1974] swapbase adapter --- projects/swapbase/index.js | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 projects/swapbase/index.js diff --git a/projects/swapbase/index.js b/projects/swapbase/index.js new file mode 100644 index 00000000000..605dd0f5e99 --- /dev/null +++ b/projects/swapbase/index.js @@ -0,0 +1,6 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports = { + misrepresentedTokens: true, + base: { tvl: getUniTVL({ factory: '0x04C9f118d21e8B767D2e50C946f0cC9F6C367300', useDefaultCoreAssets: true, fetchBalances: true, }), }, +} \ No newline at end of file From 14c93b729ea7e5c510908f8d7344372610a688ac Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 2 Aug 2023 13:10:49 +0200 Subject: [PATCH 0623/1974] stader: add node operator ETH balance --- projects/stader/index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/projects/stader/index.js b/projects/stader/index.js index 2e308d7b4fe..adcc8869101 100644 --- a/projects/stader/index.js +++ b/projects/stader/index.js @@ -1,4 +1,4 @@ -const { nullAddress } = require('../helper/unwrapLPs') +const { nullAddress, sumTokens2 } = require('../helper/unwrapLPs') const { fetchURL } = require("../helper/utils") async function hbarTvl(timestamp) { @@ -72,11 +72,12 @@ module.exports = { tvl: async (_, _1, _2, { api }) => { const res = await fetchURL("https://universe.staderlabs.com/common/tvl") - return { + const balances= { "matic-network": res.data.polygon.native, [nullAddress]: await api.call({ abi: 'uint256:totalAssets', target: '0xcf5ea1b38380f6af39068375516daf40ed70d299' }) // [nullAddress]: await api.call({ abi: 'uint256:totalSupply', target: '0xa35b1b31ce002fbf2058d22f30f95d405200a15b' }) } + return sumTokens2({ api, balances, owner: '0x4f4bfa0861f62309934a5551e0b2541ee82fdcf1', tokens: [nullAddress] }) } }, hallmarks: [ From 30819d172f68740024bb3aa5c2be649bb6e7bb59 Mon Sep 17 00:00:00 2001 From: buchaoqun Date: Wed, 2 Aug 2023 20:37:37 +0800 Subject: [PATCH 0624/1974] slov protocol v3 add poolTvl --- projects/solv-protocol-v3/abi.json | 3 +- projects/solv-protocol-v3/index.js | 128 +++++++++++++++++++++-------- 2 files changed, 95 insertions(+), 36 deletions(-) diff --git a/projects/solv-protocol-v3/abi.json b/projects/solv-protocol-v3/abi.json index a7d28aec895..c2ad7222359 100644 --- a/projects/solv-protocol-v3/abi.json +++ b/projects/solv-protocol-v3/abi.json @@ -3,5 +3,6 @@ "slotTotalValue": "function slotTotalValue(uint256 slot_) view returns (uint256)", "slotBaseInfo": "function slotBaseInfo(uint256 slot_) view returns (tuple(address issuer, address currency, uint64 valueDate, uint64 maturity, uint64 createTime, bool transferable, bool isValid))", "decimals": "uint8:decimals", - "balanceOf": "function balanceOf(address _owner) view returns (uint256 balance)" + "balanceOf": "function balanceOf(address _owner) view returns (uint256 balance)", + "getSubscribeNav": "function getSubscribeNav(bytes32 poolId_, uint256 time_) view returns (uint256 nav_, uint256 navTime_)" } \ No newline at end of file diff --git a/projects/solv-protocol-v3/index.js b/projects/solv-protocol-v3/index.js index 81ec0c49507..32673d22629 100644 --- a/projects/solv-protocol-v3/index.js +++ b/projects/solv-protocol-v3/index.js @@ -6,7 +6,7 @@ const { cachedGraphQuery } = require("../helper/cache"); const graphUrlList = { ethereum: 'https://api.studio.thegraph.com/query/40045/solv-payable-factory-prod/version/latest', bsc: 'https://api.thegraph.com/subgraphs/name/slov-payable/solv-v3-earn-factory', - arbitrum: 'https://api.studio.thegraph.com/query/40045/solv-payable-factory-arbitrum/version/latest', + arbitrum: 'https://api.studio.thegraph.com/query/29232/test-3/version/latest', } const filterSlot = [ @@ -19,37 +19,75 @@ const filterSlot = [ async function tvl() { const { api } = arguments[3]; const network = api.chain; - const slots = await getSlot(api.timestamp, network); - if (slots.length <= 0) { - return; + const graphData = await getGraphData(api.timestamp, network); + if (graphData.slots.length > 0) { + const slots = graphData.slots; + const closeConcretes = await concrete(slots, api); + const closeTotalValues = await api.multiCall({ + abi: abi.slotTotalValue, + calls: slots.map((index) => ({ + target: closeConcretes[index.contractAddress], + params: [index.slot] + })), + }) + + const closeBaseInfos = await api.multiCall({ + abi: abi.slotBaseInfo, + calls: slots.map((index) => ({ + target: closeConcretes[index.contractAddress], + params: [index.slot] + })), + }) + + const closeDecimalList = await api.multiCall({ + abi: abi.decimals, + calls: closeBaseInfos.map(i => i[1]), + }) + + for (let i = 0; i < closeTotalValues.length; i++) { + const decimals = closeDecimalList[i]; + const balance = BigNumber(closeTotalValues[i]).div(BigNumber(10).pow(18 - decimals)).toNumber(); + api.add(closeBaseInfos[i][1], balance) + } } - const concretes = await concrete(slots, api); - - const totalValues = await api.multiCall({ - abi: abi.slotTotalValue, - calls: slots.map((index) => ({ - target: concretes[index.contractAddress], - params: [index.slot] - })), - }) - const baseInfos = await api.multiCall({ - abi: abi.slotBaseInfo, - calls: slots.map((index) => ({ - target: concretes[index.contractAddress], - params: [index.slot] - })), - }) + if (graphData.pools.length > 0) { + const pools = graphData.pools; + const poolConcretes = await concrete(pools, api); + const nav = await api.multiCall({ + abi: abi.getSubscribeNav, + calls: pools.map((index) => ({ + target: index.navOracle, + params: [index.poolId, api.timestamp] + })), + }) - const decimalList = await api.multiCall({ - abi: abi.decimals, - calls: baseInfos.map(i => i[1]), - }) + const poolTotalValues = await api.multiCall({ + abi: abi.slotTotalValue, + calls: pools.map((index) => ({ + target: poolConcretes[index.contractAddress], + params: [index.openFundShareSlot] + })), + }) + + const poolBaseInfos = await api.multiCall({ + abi: abi.slotBaseInfo, + calls: pools.map((index) => ({ + target: poolConcretes[index.contractAddress], + params: [index.openFundShareSlot] + })), + }) + + const poolDecimalList = await api.multiCall({ + abi: abi.decimals, + calls: poolBaseInfos.map(i => i[1]), + }) - for (let i = 0; i < totalValues.length; i++) { - const decimals = decimalList[i]; - const balance = BigNumber(totalValues[i]).div(BigNumber(10).pow(18 - decimals)).toNumber(); - api.add(baseInfos[i][1], balance) + for (let i = 0; i < poolTotalValues.length; i++) { + const decimals = poolDecimalList[i]; + const balance = BigNumber(poolTotalValues[i]).div(BigNumber(10).pow(18 - decimals)).times(BigNumber(nav[i].nav_).div(BigNumber(10).pow(decimals))).toNumber(); + api.add(poolBaseInfos[i][1], balance) + } } } @@ -77,24 +115,44 @@ async function concrete(slots, api) { } -async function getSlot(timestamp, chain) { +async function getGraphData(timestamp, chain) { const slotDataQuery = `query BondSlotInfos { bondSlotInfos(first: 1000, where:{maturity_gt:${timestamp}}) { contractAddress slot } + poolOrderInfos(first: 1000, where:{fundraisingEndTime_gt:${timestamp}}) { + marketContractAddress + contractAddress + navOracle + poolId + openFundShareSlot + } }`; - const slots = (await cachedGraphQuery(`solv-protocol/graph-data/${chain}`, graphUrlList[chain], slotDataQuery)).bondSlotInfos; + const data = (await cachedGraphQuery(`solv-protocol/graph-data/${chain}`, graphUrlList[chain], slotDataQuery)); + let slotList = []; - for (let i = 0; i < slots.length; i++) { - const bondSlotInfo = slots[i]; - if (filterSlot.indexOf(bondSlotInfo.slot) == -1) { - slotList.push(bondSlotInfo) + let poolList = []; + if (data != undefined && data.bondSlotInfos != undefined) { + for (let i = 0; i < data.bondSlotInfos.length; i++) { + const bondSlotInfo = data.bondSlotInfos[i]; + if (filterSlot.indexOf(bondSlotInfo.slot) == -1) { + slotList.push(bondSlotInfo) + } } } - return slotList; + if (data != undefined && data.poolOrderInfos != undefined) { + poolList = data.poolOrderInfos; + } + return { + slots: slotList, + pools: poolList + }; } +// ['arbitrum'].forEach(chain => { +// module.exports[chain] = { tvl } +// }) ['ethereum', 'bsc', 'arbitrum'].forEach(chain => { module.exports[chain] = { tvl } }) \ No newline at end of file From 7d01f9a0bcf555a26f56b9eb6a16e167570e60f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Federico=20Rodr=C3=ADguez?= Date: Wed, 2 Aug 2023 10:47:16 -0300 Subject: [PATCH 0625/1974] Add Neutron TVL to Mars protocol (#6995) * Add vaults to tvl * Use fields naming. Add better methodology description * Fix punctuation * Use 10 as page Limit * Add neutron tvl --- projects/mars/index.js | 39 +++++++++++++++++++++++++++++++++------ 1 file changed, 33 insertions(+), 6 deletions(-) diff --git a/projects/mars/index.js b/projects/mars/index.js index 66fcfca7669..a9b9d4b2bfb 100644 --- a/projects/mars/index.js +++ b/projects/mars/index.js @@ -4,12 +4,22 @@ const axios = require('axios'); const { endPoints, queryContract, sumTokens } = require('../helper/chain/cosmos'); const { getChainTransform } = require('../helper/portedTokens'); -const redBankAddress = 'osmo1c3ljch9dfw5kf52nfwpxd2zmj2ese7agnx0p9tenkrryasrle5sqf3ftpg'; -const creditManagerAddress = 'osmo1f2m24wktq0sw3c0lexlg7fv4kngwyttvzws3a3r3al9ld2s2pvds87jqvf'; +const addresses = { + osmosis: { + redBank: 'osmo1c3ljch9dfw5kf52nfwpxd2zmj2ese7agnx0p9tenkrryasrle5sqf3ftpg', + creditManager: 'osmo1f2m24wktq0sw3c0lexlg7fv4kngwyttvzws3a3r3al9ld2s2pvds87jqvf', + }, + neutron: { + redBank: 'neutron1n97wnm7q6d2hrcna3rqlnyqw2we6k0l8uqvmyqq6gsml92epdu7quugyph', + } +} + + +// OSMOSIS async function osmosisTVL() { let balances = {}; - await sumTokens({balances, owners: [redBankAddress], chain: 'osmosis'}); + await addRedBankTvl(balances, 'osmosis'); await osmosisSumVaultsTVL(balances); return balances; } @@ -23,7 +33,7 @@ async function osmosisSumVaultsTVL(balances) { while (vaultPagesRemaining) { const fieldsVaultsInfo = await queryContract({ - contract: creditManagerAddress, + contract: addresses.osmosis.creditManager, chain: 'osmosis', data: { 'vaults_info': { limit: pageLimit, 'start_after': startAfter } } }); @@ -60,7 +70,7 @@ async function osmosisAddCoinsForVaultsInfoPage(coins, fieldsVaultsInfoPage) { // get total vault shares owned by fields for each vault await Promise.all(vaultsMetadata.map(async vm => { let vaultShares = await queryContract({ - contract: creditManagerAddress, + contract: addresses.osmosis.creditManager, chain: 'osmosis', data: { 'total_vault_coin_balance': { vault: vm.fieldsVaultInfo.vault } } }); @@ -99,6 +109,20 @@ async function osmosisAddCoinsForVaultsInfoPage(coins, fieldsVaultsInfoPage) { })); } +// NEUTRON + +async function neutronTVL() { + let balances = {}; + await addRedBankTvl(balances, 'neutron'); + return balances; +} + +// HELPERS + +async function addRedBankTvl(balances, chain) { + await sumTokens({balances, owners: [addresses[chain].redBank], chain}); +} + function getEndpoint(chain) { if (!endPoints[chain]) throw new Error('Chain not found: ' + chain); return endPoints[chain]; @@ -112,10 +136,13 @@ async function cosmosLCDQuery(url, chain) { module.exports = { timetravel: false, - methodology: 'Sum up token balances in Red Bank smart contract and vault underlying assets in Fields smart contract', + methodology: 'For each chain, sum up token balances in Red Bank smart contracts and vault underlying assets in Fields smart contracts', osmosis: { tvl: osmosisTVL, }, + neutron: { + tvl: neutronTVL, + }, terra: { tvl: () => 0, }, From c81ae621f23b538bb4aee7b652cf606727aa2783 Mon Sep 17 00:00:00 2001 From: HorizonDex <136569605+HorizonDex@users.noreply.github.com> Date: Wed, 2 Aug 2023 18:48:51 +0400 Subject: [PATCH 0626/1974] add horizondex base network (#6997) --- projects/horizondex/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/projects/horizondex/index.js b/projects/horizondex/index.js index 1b26ea1d436..3ae6099763e 100644 --- a/projects/horizondex/index.js +++ b/projects/horizondex/index.js @@ -5,4 +5,8 @@ module.exports = uniV3Export({ factory: "0x9Fe607e5dCd0Ea318dBB4D8a7B04fa553d6cB2c5", fromBlock: 1150, }, -}); \ No newline at end of file + base: { + factory: "0x07AceD5690e09935b1c0e6E88B772d9440F64718", + fromBlock: 2053334, + }, +}); From 24c16cd24162fe256c2a4afe1ff6076d662a82d7 Mon Sep 17 00:00:00 2001 From: Landon Gingerich Date: Wed, 2 Aug 2023 10:53:22 -0500 Subject: [PATCH 0627/1974] Add Bitget address for zkSync Era (#6998) --- projects/bitget/index.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/projects/bitget/index.js b/projects/bitget/index.js index da26aaee041..58bd333dc7e 100644 --- a/projects/bitget/index.js +++ b/projects/bitget/index.js @@ -60,6 +60,11 @@ const config = { '0x97b9d2102a9a65a26e1ee82d59e42d1b73b68689' ] }, + era: { + owners: [ + '0x97b9d2102a9a65a26e1ee82d59e42d1b73b68689' + ] + }, fantom :{ owners: ['0x5bdf85216ec1e38d6458c870992a69e38e03f7ef'] }, From 0021cf493fcf040fe9a56510529dc4dd5f292212 Mon Sep 17 00:00:00 2001 From: buchaoqun Date: Thu, 3 Aug 2023 00:15:50 +0800 Subject: [PATCH 0628/1974] update the graph arbitrum url --- projects/solv-protocol-v3/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/solv-protocol-v3/index.js b/projects/solv-protocol-v3/index.js index 32673d22629..e044a3fc033 100644 --- a/projects/solv-protocol-v3/index.js +++ b/projects/solv-protocol-v3/index.js @@ -6,7 +6,7 @@ const { cachedGraphQuery } = require("../helper/cache"); const graphUrlList = { ethereum: 'https://api.studio.thegraph.com/query/40045/solv-payable-factory-prod/version/latest', bsc: 'https://api.thegraph.com/subgraphs/name/slov-payable/solv-v3-earn-factory', - arbitrum: 'https://api.studio.thegraph.com/query/29232/test-3/version/latest', + arbitrum: 'https://api.studio.thegraph.com/query/40045/solv-payable-factory-arbitrum/version/latest', } const filterSlot = [ From 886f100f0793d4405bc3c5eb23644e799408aae1 Mon Sep 17 00:00:00 2001 From: buchaoqun Date: Thu, 3 Aug 2023 00:19:18 +0800 Subject: [PATCH 0629/1974] del note --- projects/solv-protocol-v3/index.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/projects/solv-protocol-v3/index.js b/projects/solv-protocol-v3/index.js index e044a3fc033..d013e6c040a 100644 --- a/projects/solv-protocol-v3/index.js +++ b/projects/solv-protocol-v3/index.js @@ -150,9 +150,6 @@ async function getGraphData(timestamp, chain) { }; } -// ['arbitrum'].forEach(chain => { -// module.exports[chain] = { tvl } -// }) ['ethereum', 'bsc', 'arbitrum'].forEach(chain => { module.exports[chain] = { tvl } }) \ No newline at end of file From 1226fd7a3278b031c461168ceb9280ef3703a5a1 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Wed, 2 Aug 2023 18:42:52 +0100 Subject: [PATCH 0630/1974] add winding down hallmark --- projects/algofi/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/algofi/index.js b/projects/algofi/index.js index 0ef1c1e81e3..00dda959e4f 100644 --- a/projects/algofi/index.js +++ b/projects/algofi/index.js @@ -90,6 +90,9 @@ async function staking() { } module.exports = { + hallmarks: [ + [1688947200, "Winding down of protocol"] + ], timetravel: false, misrepresentedTokens: true, algorand: { From f0d463557e4a12e9d4eef2d1405fea12421b4f87 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 2 Aug 2023 20:55:36 +0200 Subject: [PATCH 0631/1974] fix broken adapters --- projects/steadefi/index.js | 14 +++++++++++++- projects/treasury/beefy.js | 12 +++++++++--- projects/yieldly/index.js | 9 +++++---- 3 files changed, 27 insertions(+), 8 deletions(-) diff --git a/projects/steadefi/index.js b/projects/steadefi/index.js index e6f3bdd1ebf..7937b60d9b0 100644 --- a/projects/steadefi/index.js +++ b/projects/steadefi/index.js @@ -1,6 +1,7 @@ const ADDRESSES = require('../helper/coreAssets.json') const { getConfig } = require('../helper/cache'); const { sumTokens2 } = require('../helper/unwrapLPs'); +const { camelotNFTPoolAbi } = require('../single/abi'); async function getProjectInfo() { return Promise.all([ @@ -24,7 +25,8 @@ Object.keys(config).forEach(chain => { const chainId = api.getChainId() let [lendingPools, vaults] = await getProjectInfo() lendingPools = lendingPools.filter(i => i.chainId === chainId).map(i => i.address) - vaults = vaults.filter(i => i.chainId === chainId).map(i => i.address) + const grailVaults = vaults.filter(i => i.chainId === chainId && i.protocol === 'Camelot').map(i => i.address) + vaults = vaults.filter(i => i.chainId === chainId && i.protocol !== 'Camelot').map(i => i.address) const lpAssets = await api.multiCall({ abi: 'address:asset', calls: lendingPools }) const managers = await api.multiCall({ abi: 'address:manager', calls: vaults }) let lpTokens = await api.multiCall({ abi: 'address:lpToken', calls: managers, permitFailure: true, }) @@ -38,6 +40,16 @@ Object.keys(config).forEach(chain => { const bals = await api.multiCall({ abi: 'uint256:lpTokenAmt', calls: lpPoolManagers }) api.addTokens(lpTokens, bals) // api.add('tether', tokenValue.reduce((a, v) => a + v/1e13, 0), { skipChain: true}) + if (grailVaults.length) { + const grailManagers = await api.multiCall({ abi: 'address:manager', calls: grailVaults }) + const spNfts = await api.multiCall({ abi: 'address:spNft', calls: grailManagers }) + const positionIds = await api.multiCall({ abi: 'uint256:positionId', calls: grailManagers }) + const poolInfos = await api.multiCall({ abi: camelotNFTPoolAbi.getPoolInfo, calls: spNfts }) + const stakedPositionInfo = await api.multiCall({ abi: camelotNFTPoolAbi.getStakingPosition, calls: spNfts.map((v, i) => ({ target: v, params: positionIds[i] })) }) + const lpTokens = poolInfos.map(v => v.lpToken) + const lpBalances = stakedPositionInfo.map(v => v.amount) + api.addTokens(lpTokens, lpBalances) + } return sumTokens2({ api, tokensAndOwners2: [lpAssets, lendingPools] }) } } diff --git a/projects/treasury/beefy.js b/projects/treasury/beefy.js index 226a4cb619d..fd0004accf5 100644 --- a/projects/treasury/beefy.js +++ b/projects/treasury/beefy.js @@ -48,16 +48,22 @@ chains.forEach(chain => { tvl: async (_, _b, _cb, { api, }) => { const balances = {} let data = (await _getConfig())[getKey(chain)] || {} + const uniV3Owners = [] const ownerTokens = Object.entries(data) .filter(i => { if (i[0] !== 'validator') return true - sdk.util.sumSingleBalance(balances, nullAddress, i[1].balances.validator.balance, api.chain) + api.add(nullAddress, i[1].balances.validator.balance) }) .map(([owner, { balances }]) => { + const tokens = Object.entries(balances).filter(([_, info]) => info.name !== 'BIFI').map(i => i[0] === 'native' ? nullAddress : i[0]) + if (Object.keys(balances).some(i => i.toLowerCase() === '0x8e295789c9465487074a65b1ae9ce0351172393f')) + uniV3Owners.push(owner) + return [tokens, owner] }) - return sumTokens2({ balances, api, ownerTokens, }) + if (uniV3Owners.length) await sumTokens2({ api, owners: uniV3Owners, resolveUniV3: true, }) + return sumTokens2({ balances, api, ownerTokens, blacklistedTokens: ['0x8e295789c9465487074a65b1ae9ce0351172393f'], }) }, ownTokens: async (_, _b, _cb, { api, }) => { let BIFI @@ -72,7 +78,7 @@ chains.forEach(chain => { }) }) if (!BIFI) return {} - return sumTokens2({ api, tokens: [BIFI], owners }) + return sumTokens2({ api, tokens: [BIFI], owners, blacklistedTokens: ['0x8e295789c9465487074a65b1ae9ce0351172393f'], }) }, } }) \ No newline at end of file diff --git a/projects/yieldly/index.js b/projects/yieldly/index.js index 285bb3a877f..82a8b77cd66 100644 --- a/projects/yieldly/index.js +++ b/projects/yieldly/index.js @@ -50,8 +50,9 @@ async function pool2() { module.exports = { timetravel: false, algorand: { - tvl, - staking, - pool2, - } + tvl: () => ({}), + }, + hallmarks: [ + [Math.floor(new Date('2023-08-02')/1e3), 'Project pivoted to be being a NFT marketplace.'], + ], }; From 7a21dc4509ff65030f6566a52be02b192353f394 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 2 Aug 2023 22:24:13 +0200 Subject: [PATCH 0632/1974] track tetu pawnshop --- projects/tetu-pawnshop/index.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 projects/tetu-pawnshop/index.js diff --git a/projects/tetu-pawnshop/index.js b/projects/tetu-pawnshop/index.js new file mode 100644 index 00000000000..c99f56f73e0 --- /dev/null +++ b/projects/tetu-pawnshop/index.js @@ -0,0 +1,28 @@ +const { sumTokens2 } = require('../helper/unwrapLPs') + +const config = { + polygon: { shop: '0x0c9fa52d7ed12a6316d3738c80931ecbc6c49907', }, +} + +module.exports = { +}; + +Object.keys(config).forEach(chain => { + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const shop = config[chain].shop + const posIds = await api.fetchList({ itemAbi: abi.openPositions, lengthAbi: abi.openPositionsSize, target: shop }) + const posData = await api.multiCall({ abi: abi.positions, calls: posIds, target: shop }) + const tokens = posData.map(pos => ([pos.collateral.collateralToken, pos.acquired.acquiredToken, pos.depositToken])).flat() + console.log(tokens) + return sumTokens2({ api, owner: shop, tokens, resolveUniV3: true, blacklistedTokens: ['0xc36442b4a4522e871399cd717abdd847ab11fe88']}) + return {} + } + } +}) + +const abi = { + "openPositions": "function openPositions(uint256) view returns (uint256)", + "openPositionsSize": "uint256:openPositionsSize", + "positions": "function positions(uint256) view returns (uint256 id, address borrower, address depositToken, uint256 depositAmount, bool open, uint256 minAuctionAmount, tuple(uint256 posDurationBlocks, uint256 posFee, uint256 createdBlock, uint256 createdTs) info, tuple(address collateralToken, uint8 collateralType, uint256 collateralAmount, uint256 collateralTokenId) collateral, tuple(address acquiredToken, uint256 acquiredAmount) acquired, tuple(address lender, uint256 posStartBlock, uint256 posStartTs, uint256 posEndTs) execution)", +} \ No newline at end of file From a85cbd7da49ff4f8b9dc9907069d89080ac0f98e Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 2 Aug 2023 23:01:45 +0200 Subject: [PATCH 0633/1974] stader: include node operator staked eth --- projects/stader/index.js | 45 +++++++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/projects/stader/index.js b/projects/stader/index.js index adcc8869101..1906dc87982 100644 --- a/projects/stader/index.js +++ b/projects/stader/index.js @@ -1,45 +1,51 @@ const { nullAddress, sumTokens2 } = require('../helper/unwrapLPs') -const { fetchURL } = require("../helper/utils") +const { get } = require("../helper/http") +let _res + +async function getData() { + if (!_res) _res = get("https://universe.staderlabs.com/common/tvl") + return _res +} async function hbarTvl(timestamp) { - const res = await fetchURL("https://universe.staderlabs.com/common/tvl") + const res = await get("https://universe.staderlabs.com/common/tvl") return { - "hedera-hashgraph": res.data.hedera.native + "hedera-hashgraph": res.hedera.native } } async function maticTvl() { - const res = await fetchURL("https://universe.staderlabs.com/common/tvl") + const res = await getData() return { - "matic-network": res.data.polygon.native + "matic-network": res.polygon.native } } async function ftmTvl() { - const res = await fetchURL("https://universe.staderlabs.com/common/tvl") + const res = await getData() return { - "fantom": res.data.fantom.native + "fantom": res.fantom.native } } async function terra2Tvl() { - const res = await fetchURL("https://universe.staderlabs.com/common/tvl") + const res = await getData() return { - "terra-luna-2": res.data.terra.native + "terra-luna-2": res.terra.native } } async function bscTvl() { - const res = await fetchURL("https://universe.staderlabs.com/common/tvl") + const res = await getData() return { - "binancecoin": res.data.bnb.native + "binancecoin": res.bnb.native } } async function nearTvl() { - const res = await fetchURL("https://universe.staderlabs.com/common/tvl") + const res = await getData() return { - "near": res.data.near.native + "near": res.near.native } } @@ -71,13 +77,14 @@ module.exports = { ethereum: { tvl: async (_, _1, _2, { api }) => { - const res = await fetchURL("https://universe.staderlabs.com/common/tvl") - const balances= { - "matic-network": res.data.polygon.native, - [nullAddress]: await api.call({ abi: 'uint256:totalAssets', target: '0xcf5ea1b38380f6af39068375516daf40ed70d299' }) - // [nullAddress]: await api.call({ abi: 'uint256:totalSupply', target: '0xa35b1b31ce002fbf2058d22f30f95d405200a15b' }) + const res = await getData() + const nodeOperatorRegistry = '0x4f4bfa0861f62309934a5551e0b2541ee82fdcf1' + const nodeOperatorCount = await api.call({ abi: 'uint256:totalActiveValidatorCount', target: nodeOperatorRegistry }) + const balances = { + "matic-network": res.polygon.native, + [nullAddress]: +(await api.call({ abi: 'uint256:totalAssets', target: '0xcf5ea1b38380f6af39068375516daf40ed70d299' })) + +nodeOperatorCount * 4 * 1e18 // 4 ETH per node operator } - return sumTokens2({ api, balances, owner: '0x4f4bfa0861f62309934a5551e0b2541ee82fdcf1', tokens: [nullAddress] }) + return sumTokens2({ api, balances, owner: nodeOperatorRegistry, tokens: [nullAddress] }) } }, hallmarks: [ From b402f283a2de099b487e970bf4df7b2af07b6cc2 Mon Sep 17 00:00:00 2001 From: HPS_Official <113499242+HPSOfficial@users.noreply.github.com> Date: Thu, 3 Aug 2023 02:33:10 +0530 Subject: [PATCH 0634/1974] Add IgnoreFud TVL (#6996) * Add IgnoreFud TVL * Update index.js --------- Co-authored-by: Ignore Fud <127217823+IgnoreFud@users.noreply.github.com> Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/IgnoreFUD/index.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 projects/IgnoreFUD/index.js diff --git a/projects/IgnoreFUD/index.js b/projects/IgnoreFUD/index.js new file mode 100644 index 00000000000..2c1e5236d4d --- /dev/null +++ b/projects/IgnoreFUD/index.js @@ -0,0 +1,18 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require('../helper/unknownTokens'); + +const LpAddress = "0x5Ab9f0Ea4fD182a1edC89D379c1F1c5d6B6eF623"; +const IgnoreFUDToken = "0x98564E70c7fCC6d947fFE6d9EfeD5ba68b306F2E"; +const ERC20ContractWCoreAddress = ADDRESSES.core.WCORE; +const Pool_One = "0x2CaBc908c163f966fD9A1493211F91B0371A8575"; +const Pool_Two = "0xBA554Bd93BF6EE9E2F2f85F9448513F932E338Ad"; +const Pool_Three = "0x8b3cC46943243E260E201ADd16F2ed15253f6702" + +module.exports = { + core: { + tvl: () => ({}), + staking: sumTokensExport({ owners: [Pool_One,Pool_Two,Pool_Three], tokens: [IgnoreFUDToken], useDefaultCoreAssets: true, lps: [LpAddress], }), + } +}; + + From 1bc08bdf893c07ccb8c0159b4f934d41470469b4 Mon Sep 17 00:00:00 2001 From: Harleen <119888996+harleen-m@users.noreply.github.com> Date: Wed, 2 Aug 2023 23:03:30 +0200 Subject: [PATCH 0635/1974] Add BaseSwap (#6999) * Add BaseSwap * Update index.js --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/baseswap/index.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 projects/baseswap/index.js diff --git a/projects/baseswap/index.js b/projects/baseswap/index.js new file mode 100644 index 00000000000..0080ffa9b8f --- /dev/null +++ b/projects/baseswap/index.js @@ -0,0 +1,14 @@ +const { getUniTVL } = require('../helper/unknownTokens') +const BSWAP = "0x78a087d713Be963Bf307b18F2Ff8122EF9A63ae9"; +const FACTORY = "0xFDa619b6d20975be80A10332cD39b9a4b0FAa8BB" + +const dexTVL = getUniTVL({ factory: FACTORY, useDefaultCoreAssets: true, fetchBalances: true, }) + + +module.exports = { + misrepresentedTokens: true, + methodology: `Uses factory(${FACTORY}) address and whitelisted tokens address to find and price Liquidity Pool pairs. We also have our native token $ARX staking.`, + base: { + tvl: dexTVL, + } +}; From 52dfb96364b3d74ae369c4815255942c63e9737a Mon Sep 17 00:00:00 2001 From: stupid_boar Date: Thu, 3 Aug 2023 00:22:25 +0300 Subject: [PATCH 0636/1974] PepeTeam Bridge add WAVES --- projects/pepe-bridge/index.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/projects/pepe-bridge/index.js b/projects/pepe-bridge/index.js index 2314078ac00..e0104f20f65 100644 --- a/projects/pepe-bridge/index.js +++ b/projects/pepe-bridge/index.js @@ -1,5 +1,16 @@ const ADDRESSES = require('../helper/coreAssets.json') const { nullAddress, sumTokensExport, } = require('../helper/unwrapLPs'); +const { data } = require("../helper/chain/waves"); +const sdk = require('@defillama/sdk') + +const wavesCoinBridgeContract = '3PFPuctNkdbwGKKUNymWw816jGPexHzGXW5'; + +async function wavesTVL() { + const balances = {}; + const contractTVLInWAVES = await data(wavesCoinBridgeContract, "BALANCE"); + sdk.util.sumSingleBalance(balances, 'waves', contractTVLInWAVES.value/1e8) + return balances; +} const config = { ethereum: [ @@ -51,3 +62,7 @@ module.exports = {}; Object.keys(config).forEach(chain => { module.exports[chain] = { tvl: sumTokensExport({ ownerTokens: config[chain] }) } }) +module.exports.waves = { tvl: wavesTVL } + +module.exports.timetravel = false; // Waves blockchain +module.exports.methodology = 'All tokens locked in PepeTeam Bridge.'; \ No newline at end of file From a705b3cf794b9497893d087c02c878033823475a Mon Sep 17 00:00:00 2001 From: stupid_boar Date: Thu, 3 Aug 2023 00:24:06 +0300 Subject: [PATCH 0637/1974] fix conversations --- projects/pepe-bridge/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/pepe-bridge/index.js b/projects/pepe-bridge/index.js index e0104f20f65..50c84d34b80 100644 --- a/projects/pepe-bridge/index.js +++ b/projects/pepe-bridge/index.js @@ -65,4 +65,4 @@ Object.keys(config).forEach(chain => { module.exports.waves = { tvl: wavesTVL } module.exports.timetravel = false; // Waves blockchain -module.exports.methodology = 'All tokens locked in PepeTeam Bridge.'; \ No newline at end of file +module.exports.methodology = 'All tokens locked in PepeTeam Bridge.'; From 64b87b1d34af06693fc91c522a5b2677049cb39b Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 3 Aug 2023 06:50:29 +0200 Subject: [PATCH 0638/1974] track galador.io --- projects/afraswap/index.js | 2 +- projects/galador-io/index.js | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 projects/galador-io/index.js diff --git a/projects/afraswap/index.js b/projects/afraswap/index.js index d2356ca1981..21e2ffb61ab 100644 --- a/projects/afraswap/index.js +++ b/projects/afraswap/index.js @@ -6,7 +6,7 @@ module.exports = { methodology: "Factory address (0xa098751D407796d773032f5Cc219c3e6889fB893) is used to find the LP pairs. TVL is equal to the liquidity on the AMM.", bsc: { - tvl: getUniTVL({ factory: '0xa098751D407796d773032f5Cc219c3e6889fB893', chain: 'bsc', useDefaultCoreAssets: true }), + tvl: getUniTVL({ factory: '0xa098751D407796d773032f5Cc219c3e6889fB893', useDefaultCoreAssets: true }), staking: stakingPricedLP("0x259C852834375864b65202375558AB11B2d330fd", "0x5badD826AeFa700446Fa6d784e6ff97eD6eeDca9", "bsc", "0x1Da189c1BA3d718Cc431a2ed240a3753f89CD47A", "wbnb") }, }; \ No newline at end of file diff --git a/projects/galador-io/index.js b/projects/galador-io/index.js new file mode 100644 index 00000000000..8d3f6eb0644 --- /dev/null +++ b/projects/galador-io/index.js @@ -0,0 +1,8 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports = { + misrepresentedTokens: true, + mantle: { + tvl: getUniTVL({ factory: '0x6F602b6F11F174c627813262fA713F334ca20aA6', fetchBalances: true, useDefaultCoreAssets: true }), + }, +}; \ No newline at end of file From 878dfff46175e2efaee00576d54c6685960aa66b Mon Sep 17 00:00:00 2001 From: "andreapn.eth" Date: Thu, 3 Aug 2023 13:18:03 +0700 Subject: [PATCH 0639/1974] DackieSwap CLMM integrate with Defillama --- projects/dackieswap/index.js | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 projects/dackieswap/index.js diff --git a/projects/dackieswap/index.js b/projects/dackieswap/index.js new file mode 100644 index 00000000000..bcfaa2ff21a --- /dev/null +++ b/projects/dackieswap/index.js @@ -0,0 +1,8 @@ +const { uniV3Export } = require('../helper/uniswapV3') + +module.exports = uniV3Export({ + base: { + factory: '0x3D237AC6D2f425D2E890Cc99198818cc1FA48870', + fromBlock: 2124844, + } +}) \ No newline at end of file From d623dd85bde55457e1ddb8f60ebd64c2d6212d0c Mon Sep 17 00:00:00 2001 From: Seagram Date: Thu, 3 Aug 2023 17:34:19 +0900 Subject: [PATCH 0640/1974] Add Base to Tonic Cash --- projects/tonic-cash/config.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/projects/tonic-cash/config.js b/projects/tonic-cash/config.js index 7af12226db4..a0ad7780b40 100644 --- a/projects/tonic-cash/config.js +++ b/projects/tonic-cash/config.js @@ -2,6 +2,18 @@ const ADDRESSES = require('../helper/coreAssets.json') const { nullAddress } = require('../helper/unwrapLPs'); module.exports = { + base: [ + { + tokens: [nullAddress], // KLAY + holders: [ + '0x86D5CF69842BBe4bdE06331C5480FFE8179EF6fB', + '0x713C3e59309CA047A7c8AA7201D302adceb79861', + '0x923815bBb945e96e5BF9240f612b41C3708529fd', + '0x9f9D6152bDA66265B31c9c0e90116E11481Afa70', + '0x60F7f382B2fe949c91c5b302A9E0fF9BF7E9158d', + ], + }, + ], klaytn: [ { tokens: [nullAddress], // KLAY From 81cf122b18d7be807ad488e2dde325501b0982e0 Mon Sep 17 00:00:00 2001 From: define Date: Thu, 3 Aug 2023 10:24:50 +0100 Subject: [PATCH 0641/1974] add eth chain to stusdt --- projects/stUSDT/index.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/projects/stUSDT/index.js b/projects/stUSDT/index.js index 93d9199fe84..d52f1f79b00 100644 --- a/projects/stUSDT/index.js +++ b/projects/stUSDT/index.js @@ -7,5 +7,13 @@ module.exports = { [ADDRESSES.ethereum.USDT]: supply/1e12 } } + }, + ethereum: { + tvl: async (_, _b, _cb, { api, }) => { + const supply = await api.call({ abi: "erc20:totalSupply", target: "0x25ec98773d7b4ced4cafab96a2a1c0945f145e10" }) + return { + [ADDRESSES.ethereum.USDT]: supply/1e12 + } + } } } From 0db749a84b782e15be4e8c67648f0453abb4abe6 Mon Sep 17 00:00:00 2001 From: Dan Hsu Date: Thu, 3 Aug 2023 17:29:37 +0800 Subject: [PATCH 0642/1974] feature: add price of BUCK --- projects/bucket-protocol/index.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/projects/bucket-protocol/index.js b/projects/bucket-protocol/index.js index ced7ee1722f..6a64a7d49ff 100644 --- a/projects/bucket-protocol/index.js +++ b/projects/bucket-protocol/index.js @@ -2,6 +2,8 @@ const sui = require("../helper/chain/sui"); const MAINNET_PROTOCOL_ID = "0x9e3dab13212b27f5434416939db5dec6a319d15b89a84fd074d03ece6350d3df"; +const BUCK = + "0xce7ff77a83ea0cb6fd39bd8748e2ec89a3f41e8efdc3f4eb123e0ca37b184db2::buck::BUCK"; async function tvl(_, _1, _2, { api }) { const protocolFields = await sui.getDynamicFieldObjects({ @@ -12,10 +14,16 @@ async function tvl(_, _1, _2, { api }) { item.type.includes("Bucket") ); + const tankList = protocolFields.filter((item) => item.type.includes("Tank")); + for (const bucket of bucketList) { const coin = bucket.type.split("<").pop()?.replace(">", "") ?? ""; api.add(coin, bucket.fields.collateral_vault); } + + for (const tank of tankList) { + api.add(BUCK, tank.fields.reserve); + } } module.exports = { From 1b87190ed92f4b460bf9a01316792f5092e4e90f Mon Sep 17 00:00:00 2001 From: power-f-god Date: Thu, 3 Aug 2023 11:42:09 +0100 Subject: [PATCH 0643/1974] chore: Partial sync repo with upstream. --- projects/1inch.js | 58 ++---- projects/algodex.js | 5 +- projects/allinx.js | 16 +- projects/alphadex.js | 27 +-- projects/amaterasu.js | 4 - projects/annex.js | 40 +--- projects/antex.js | 28 +-- projects/apricot.js | 7 +- projects/arbis.js | 56 +----- projects/arkadiko.js | 50 ++--- projects/astral.js | 24 +-- projects/astroswap.js | 4 +- projects/atmossoft.js | 11 +- projects/atrix.js | 13 +- projects/autofarm.js | 63 +++--- projects/badgerdao.js | 9 +- projects/basis-cash.js | 9 +- projects/bella.js | 21 +- projects/bitBTC.js | 13 +- projects/blackpool.js | 4 +- projects/bond-appetit.js | 7 +- projects/bt-finance.js | 3 + projects/btn-group.js | 3 + projects/cennz-bridge.js | 5 +- projects/champagne-swap.js | 2 +- projects/chaotic.js | 2 +- projects/cleopatradao.js | 3 +- projects/cofix.js | 7 +- projects/corgiswap.js | 2 +- projects/cotiTreasury.js | 2 +- projects/cover.js | 9 +- projects/crema.js | 13 +- projects/dddx.js | 2 +- projects/defichain-dex.js | 2 +- projects/definix.js | 24 +-- projects/defiplaza.js | 4 +- projects/defisaver.js | 322 +++++++------------------------ projects/demeter.js | 15 +- projects/dev.js | 40 +--- projects/dhedge.js | 139 ++++++++----- projects/dracula.js | 12 +- projects/drift.js | 56 ++++-- projects/duneswap.js | 2 +- projects/edgeprotocol.js | 57 ++---- projects/energiswap.js | 1 - projects/ergodex.js | 30 +-- projects/fantom.js | 7 +- projects/flamincome.js | 56 +++--- projects/fortunedao.js | 3 +- projects/fountain.js | 3 +- projects/fractional-art.js | 219 +++++---------------- projects/gainsNetwork.js | 98 +++++----- projects/gdao.js | 17 +- projects/gemkeeper.js | 2 +- projects/ginfinance.js | 2 +- projects/goose.js | 3 + projects/gton.js | 7 +- projects/gyro.js | 8 +- projects/hakka.js | 9 +- projects/harbor-protocol.js | 14 ++ projects/hard.js | 72 ++----- projects/harvest.js | 12 +- projects/hswap.js | 2 +- projects/hurricaneswap.js | 4 +- projects/hydradex.js | 32 +-- projects/hyfi.js | 3 + projects/jaguarswap.js | 5 +- projects/jetprotocol.js | 35 +--- projects/justlend.js | 23 +-- projects/katana-ronin.js | 2 +- projects/kava.js | 48 +---- projects/kavaswap.js | 54 ++---- projects/keep.js | 6 +- projects/know-to-earn.js | 3 +- projects/lachain-yield-market.js | 4 +- projects/lachainBridge.js | 17 +- projects/linear.js | 5 +- projects/lobis.js | 3 +- projects/mantradao.js | 3 +- projects/marinade.js | 26 +-- projects/mercurial.js | 71 +++---- projects/metapool.js | 9 +- projects/midasdao.js | 5 +- projects/mobox.js | 37 +--- projects/moonbase.js | 11 ++ projects/multichainMiner.js | 28 +-- projects/mushrooms.js | 28 +-- projects/nervenetwork.js | 3 + projects/neuronswap.js | 22 +-- projects/nft20.js | 13 +- projects/niifi.js | 2 +- projects/o3swap.js | 20 +- projects/oakfarm.js | 90 +-------- projects/oaswap.js | 2 +- projects/occam.js | 2 +- projects/only1.js | 9 +- projects/openocean.js | 35 ++-- projects/oraichain.js | 9 +- projects/pactfi.js | 10 +- projects/paraswap.js | 37 +--- projects/parrot.js | 140 ++------------ projects/pegasusdao.js | 5 +- projects/pika.js | 17 +- projects/pinyottas.js | 23 +-- projects/pnetwork.js | 95 ++++----- projects/polymarket.js | 20 +- projects/polyroll.js | 11 +- projects/puzzle.js | 2 +- projects/ram.js | 3 +- projects/raydium.js | 58 ++++-- projects/realt.js | 8 +- projects/retreeb.js | 4 +- projects/revuto.js | 2 +- projects/risq.js | 11 +- projects/rivrkitty.js | 2 +- projects/rocketswap.js | 2 +- projects/saber.js | 42 ++-- projects/sapphiremine.js | 5 +- projects/secretswap.js | 3 + projects/serum.js | 62 +++--- projects/sheesha.js | 3 +- projects/sifchain.js | 3 +- projects/smartcredit.js | 3 +- projects/smoothy.js | 8 +- projects/snowswap.js | 124 ++---------- projects/solanax.js | 4 +- projects/sora.js | 108 ++--------- projects/specfinance.js | 6 +- projects/stackswap.js | 19 +- projects/stellaswap.js | 34 +--- projects/stipend.js | 6 +- projects/sunny.js | 75 +------ projects/superfluid.js | 75 ++++--- projects/swerve.js | 145 ++------------ projects/swipeswap.js | 4 +- projects/symblox.js | 4 +- projects/synlev.js | 3 +- projects/tbill.js | 5 +- projects/tempus.js | 13 +- projects/terrafloki.js | 4 +- projects/tomofinance.js | 2 +- projects/tonbridge.js | 6 +- projects/tonpound.js | 6 + projects/trisolaris.js | 12 +- projects/typhoon.js | 5 +- projects/unagii.js | 42 +--- projects/unit.js | 19 +- projects/unslashed.js | 4 +- projects/valuedefi.js | 70 +------ projects/vaporwave.js | 46 +++-- projects/velhalla.js | 3 +- projects/venus.js | 7 +- projects/veritable.js | 4 +- projects/wakafinance.js | 1 - projects/wanbridge.js | 53 ++--- projects/wault.js | 23 +-- projects/wbtc.js | 10 +- projects/wepiggy.js | 3 + projects/woofi.js | 125 +++++++++--- projects/wormhole.js | 32 ++- projects/wrappedBNB.js | 17 +- projects/wrappedfi.js | 1 - projects/yuzu.js | 2 +- projects/zai.js | 46 +---- 164 files changed, 1532 insertions(+), 2644 deletions(-) create mode 100644 projects/harbor-protocol.js create mode 100644 projects/moonbase.js create mode 100644 projects/tonpound.js diff --git a/projects/1inch.js b/projects/1inch.js index 6abbb5eb1da..a50296c51de 100644 --- a/projects/1inch.js +++ b/projects/1inch.js @@ -1,57 +1,27 @@ const { sumTokens2, } = require('./helper/unwrapLPs') -const sdk = require('@defillama/sdk') -const { createIncrementArray } = require('./helper/utils') +const { getLogs } = require('./helper/cache/getLogs') -const abi = require("./mooniswap/abi.json"); const config = require("./1inch/config"); module.exports = {} -const minIndexes = { - ethereum: 30, - bsc: 136, -} Object.keys(config).forEach(chain => { - const { MooniswapFactory, blacklistedTokens } = config[chain] + const { blacklistedTokens = [], factories } = config[chain] module.exports[chain] = { - tvl: async (_, _b, { [chain]: block }) => { - const toa = [] - const pools = [] - const length = 10 - let i = minIndexes[chain] - - const { output: data1 } = await sdk.api.abi.multiCall({ - target: MooniswapFactory, - abi: abi.getPool, - calls: createIncrementArray(i * length).map(j => ({ params: j})), - chain, block, - }) - pools.push(...data1.map(i => i.output)) - let currentPools - do { - - const { output: data } = await sdk.api.abi.multiCall({ + tvl: async (_, _b, _2, { api }) => { + const ownerTokens = [] + for (const { MooniswapFactory, fromBlock} of factories) { + const logs = await getLogs({ + api, target: MooniswapFactory, - abi: abi.getPool, - calls: createIncrementArray(length).map(j => ({ params: j + i*length})), - chain, block, + topic: 'Deployed(address,address,address)', + eventAbi: 'event Deployed(address indexed mooniswap, address indexed token1, address indexed token2)', + onlyArgs: true, + fromBlock, }) - currentPools = data.map(i => i.output).filter(i => i) - pools.push(...currentPools) - i++ - } while(currentPools.length === length) - - const calls = pools.map(i => ({ target: i })) - const { output: tokensAll } = await sdk.api.abi.multiCall({ - abi: abi.getTokens, - calls, chain, block, - }) - - tokensAll.forEach(({ output: tokens, input: { target: pool } }) => { - tokens.forEach(i => toa.push([i, pool])) - }) - - return sumTokens2({ chain, block, tokensAndOwners: toa, blacklistedTokens, }) + logs.forEach(i => ownerTokens.push([[i.token1, i.token2], i.mooniswap])) + } + return sumTokens2({ api, ownerTokens, blacklistedTokens, }) } } }) \ No newline at end of file diff --git a/projects/algodex.js b/projects/algodex.js index 720268aec04..659b9eec8b6 100644 --- a/projects/algodex.js +++ b/projects/algodex.js @@ -10,7 +10,7 @@ async function fetch() { const total_liquidity_in_usd = tvlData.data.reduce((sum, asset) => { var assetPrice = 0 - if (usdPriceData.data.hasOwnProperty(asset.assetId)) { + if (usdPriceData.data[asset.assetId]) { assetPrice = usdPriceData.data[asset.assetId].price } else { // price for some asset is not found on tinyman then @@ -25,5 +25,8 @@ async function fetch() { } // tvl in USD module.exports = { + algorand: { + fetch + }, fetch } diff --git a/projects/allinx.js b/projects/allinx.js index bce3dc895d3..aa29395bdda 100644 --- a/projects/allinx.js +++ b/projects/allinx.js @@ -1,14 +1,6 @@ -const utils = require('./helper/utils'); - -/* * * * * * * * -* ==> Correct adapter needs to be created. -* -*****************/ -async function fetch() { - let staked = await utils.fetchURL('https://api.allinx.io/api/stats') - return staked.data.data.totalLockedValue; -} - module.exports = { - fetch + methodology: 'Project is abandoned', + bsc: { + tvl: () => 0 + }, } diff --git a/projects/alphadex.js b/projects/alphadex.js index 48197a85b32..0c7ba0b6c84 100644 --- a/projects/alphadex.js +++ b/projects/alphadex.js @@ -1,12 +1,17 @@ -const { getUniTVL } = require('./helper/unknownTokens') +const { getUniTVL } = require("./helper/unknownTokens"); module.exports = { - methodology: `Uses factory(0xdD9EFCbDf9f422e2fc159eFe77aDD3730d48056d) address and whitelisted tokens address to find and price Liquidity Pool pairs`, - misrepresentedTokens: true, - moonriver: { - tvl: getUniTVL({ - factory: "0xdD9EFCbDf9f422e2fc159eFe77aDD3730d48056d", - chain: 'moonriver', - useDefaultCoreAssets: true, - }) - } -}; \ No newline at end of file + methodology: `Uses factory(0xdD9EFCbDf9f422e2fc159eFe77aDD3730d48056d) address and whitelisted tokens address to find and price Liquidity Pool pairs`, + misrepresentedTokens: true, + moonriver: { + tvl: getUniTVL({ + factory: "0xdD9EFCbDf9f422e2fc159eFe77aDD3730d48056d", + useDefaultCoreAssets: true, + }), + }, + kava: { + tvl: getUniTVL({ + factory: "0x7e666D934F7525dF840d0CfFEaa3d6Bf3b3253a3", + useDefaultCoreAssets: true, + }), + }, +}; diff --git a/projects/amaterasu.js b/projects/amaterasu.js index 3c27f685177..da23a1807c0 100644 --- a/projects/amaterasu.js +++ b/projects/amaterasu.js @@ -2,13 +2,9 @@ const { getUniTVL } = require('./helper/unknownTokens') module.exports = { methodology: `Uses factory(0x34696b6cE48051048f07f4cAfa39e3381242c3eD) address and whitelisted tokens address to find and price Liquidity Pool pairs`, misrepresentedTokens: true, - doublecounted: false, - timetravel: true, - incentivized: true, aurora: { tvl: getUniTVL({ factory: "0x34696b6cE48051048f07f4cAfa39e3381242c3eD", - chain: 'aurora', useDefaultCoreAssets: true, }) } diff --git a/projects/annex.js b/projects/annex.js index 66c19f5a1c7..140683c71b8 100644 --- a/projects/annex.js +++ b/projects/annex.js @@ -1,42 +1,18 @@ -const {compoundExports} = require('./helper/compound') +const ADDRESSES = require('./helper/coreAssets.json') +const { compoundExports } = require('./helper/compound') -const wBNB = "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c"; +const wBNB = ADDRESSES.bsc.WBNB; const cBNB = "0xC5a83aD9f3586e143D2C718E8999206887eF9dDc"; const wCRO = "0x5C7F8A570d578ED84E63fdFA7b1eE72dEae1AE23"; const cCRO = "0x61FCA31c51aCc4CC683291Be936E6799AeAAFe41"; -const wKAVA = "0xc86c7C0eFbd6A49B35E8714C5f59D99De09A225b"; +const wKAVA = ADDRESSES.kava.WKAVA; const cKAVA = "0x5642Aa2fC7028a203C689Bf21c1a92861D8C449B"; module.exports = { - methodology: - 'TVL is comprised of tokens deposited to the protocol as collateral, similar to Compound Finance and other lending protocols the borrowed tokens are not counted as TVL. Data is pull from the Annex API "https://api.annex.finance/api/v1/governance/annex".', - bsc: { - ...compoundExports( - "0xb13026db8aafa2fd6d23355533dccccbd4442f4c", - "bsc", - cBNB, - wBNB, - addr => `bsc:${addr}`, - ) - }, - cronos: { - ...compoundExports( - "0xbC1f72e751DE303Ff545D2E348fef2E84D493645", - "cronos", - cCRO, - wCRO, - addr => `cronos:${addr}`, - ), - }, - kava: { - ...compoundExports( - "0xFb6FE7d66E55831b7e108B77D11b8e4d479c2986", - "kava", - cKAVA, - wKAVA, - addr => `kava:${addr}`, - ), - }, + methodology: 'TVL is comprised of tokens deposited to the protocol as collateral, similar to Compound Finance and other lending protocols the borrowed tokens are not counted as TVL. Data is pull from the Annex API "https://api.annex.finance/api/v1/governance/annex".', + bsc: compoundExports("0xb13026db8aafa2fd6d23355533dccccbd4442f4c", "bsc", cBNB, wBNB,), + cronos: compoundExports("0xbC1f72e751DE303Ff545D2E348fef2E84D493645", "cronos", cCRO, wCRO,), + kava: compoundExports("0xFb6FE7d66E55831b7e108B77D11b8e4d479c2986", "kava", cKAVA, wKAVA,), }; // node test.js projects/annex.js \ No newline at end of file diff --git a/projects/antex.js b/projects/antex.js index 7527da4c321..1f156578adc 100644 --- a/projects/antex.js +++ b/projects/antex.js @@ -1,16 +1,20 @@ -const { toUSDTBalances } = require('./helper/balances'); -const { get } = require('./helper/http'); +const { sumTokens2 } = require('./helper/unwrapLPs') -async function fetch() { - let response = await get( - 'https://antpad.io/api/index/statistic?platform=bsc&network=main' - ) - return toUSDTBalances(response.data.total_liquidity_locked); -}; +async function tvl(_, _b, _cb, { api, }) { + const owner = '0xCe43E857c92195BeB417a167B777a11720e6E355' + const tokens = [ + '0xf6088cbd287c4d5ab226aaa9b437b27f5dbb5207', + '0x9d1b716e6bb100d0dc441074dff0326c97ad57d4', + '0x34943E562503bfEc83250E5069AD21100c2830cD', + '0x68955aad77823983cda98d047298e74a2fb5bea8', + '0x6922E64BEe7CF22437eaC06A0063D138479e5cF8', + ] + return sumTokens2({ api, owner, tokens, resolveLP: true, }) +} module.exports = { - timetravel: false, - bsc: { - tvl: fetch, - } + misrepresentedTokens: true, + bsc: { + tvl, + } }; \ No newline at end of file diff --git a/projects/apricot.js b/projects/apricot.js index c999ac76414..af44d6dcffd 100644 --- a/projects/apricot.js +++ b/projects/apricot.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('./helper/coreAssets.json') const { sumTokens2, sumOrcaLPs } = require('./helper/solana') async function tvl() { @@ -28,13 +29,13 @@ async function tvl() { } const owner = '7Ne6h2w3LpTNTa7CNYcUs7UkjeJT3oW7jcrXWfVScTXW' const tokens = [ - 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v', + ADDRESSES.solana.USDC, '9n4nbM75f5Ui33ZbPYXn59EwSgE8CGsHtAeTH5YFeJ9E', '2FPyTwcZLUg1MDrwsyoP4D6s1tM7hAkHYRjkNb5w6Pxk', 'mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So', - 'Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB', + ADDRESSES.solana.USDT, '4k3Dyjzvzp8eMZWUXbBCjEvwSkkk59S5iCNLY3QrkX6R', - 'So11111111111111111111111111111111111111112', + ADDRESSES.solana.SOL, '9vMJfxuKxXBoEa7rM12mYLMwTacLMLDJqHozw96WQL8i', 'orcaEKTdK7LKz57vaAYr9QeNsVEPfiu6QeMU1kektZE', ] diff --git a/projects/arbis.js b/projects/arbis.js index 23c2c1394ab..5fa40183cfe 100644 --- a/projects/arbis.js +++ b/projects/arbis.js @@ -71,56 +71,8 @@ module.exports = { } const abi = { - depositToken: { - "inputs": [], - "name": "depositToken", - "outputs": [ - { - "internalType": "contract IPair", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - totalDeposits: { - "inputs": [], - "name": "totalDeposits", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - stakedToken: { - "inputs": [], - "name": "stakedToken", - "outputs": [ - { - "internalType": "contract IPair", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - totalSupply: { - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, + depositToken: "address:depositToken", + totalDeposits: "uint256:totalDeposits", + stakedToken: "address:stakedToken", + totalSupply: "uint256:totalSupply", } \ No newline at end of file diff --git a/projects/arkadiko.js b/projects/arkadiko.js index 3961e425040..681d706a4c1 100644 --- a/projects/arkadiko.js +++ b/projects/arkadiko.js @@ -1,39 +1,27 @@ -const { get } = require('./helper/http') -// node test.js projects/arkadiko.js -async function tvl() { - let balances = {}; - const dikoPrice = (await get("https://arkadiko-api.herokuapp.com/api/v1/tokens/diko"))["price_in_cents"]; - const response = (await get("https://arkadiko-api.herokuapp.com/api/v1/pools")); - - for (let pool of response.pools) { - balances[pool.token_y_name] = - pool.token_y_name in balances - ? Number(balances[pool.token_y_name]) + Number(pool.tvl_token_y) - : Number(pool.tvl_token_y); - balances[pool.token_x_name] = - pool.token_x_name in balances - ? Number(balances[pool.token_x_name]) + Number(pool.tvl_token_x) - : Number(pool.tvl_token_x); - } +const { sumTokens } = require('./helper/chain/stacks') - balances["blockstack"] = balances["wrapped-stx-token"] / 10 ** 6; - delete balances["wrapped-stx-token"]; - balances["usd-coin"] = balances["usda-token"] / 10 ** 6; - delete balances["usda-token"]; - balances["usd-coin"] = - Number(balances["usd-coin"]) + - Number(balances["arkadiko-token"] / 10 ** 8) * dikoPrice; - delete balances["arkadiko-token"]; - balances["wrapped-bitcoin"] = balances["Wrapped-Bitcoin"] / 10 ** 8; - delete balances["Wrapped-Bitcoin"] - - return balances; +async function tvl() { + // https://info.arkadiko.finance/balances + return sumTokens({ + owners: [ + 'SP2C2YFP12AJZB4MABJBAJ55XECVS7E4PMMZ89YZR.arkadiko-stx-reserve-v1-1', // stacks reserve + 'SP2C2YFP12AJZB4MABJBAJ55XECVS7E4PMMZ89YZR.arkadiko-sip10-reserve-v2-1', // other vaults + 'SP2C2YFP12AJZB4MABJBAJ55XECVS7E4PMMZ89YZR.arkadiko-stacker-v3-1', // PoX stackers + 'SP2C2YFP12AJZB4MABJBAJ55XECVS7E4PMMZ89YZR.arkadiko-stacker-2-v3-1', + 'SP2C2YFP12AJZB4MABJBAJ55XECVS7E4PMMZ89YZR.arkadiko-stacker-3-v3-1', + 'SP2C2YFP12AJZB4MABJBAJ55XECVS7E4PMMZ89YZR.arkadiko-stacker-4-v3-1', + 'SP2C2YFP12AJZB4MABJBAJ55XECVS7E4PMMZ89YZR.arkadiko-swap-v2-1', // swap tokens + ], + blacklistedTokens: [ + 'SP2C2YFP12AJZB4MABJBAJ55XECVS7E4PMMZ89YZR.wrapped-stx-token::wstx', + 'stacks:SP2C2YFP12AJZB4MABJBAJ55XECVS7E4PMMZ89YZR.arkadiko-token::diko', + 'SP2C2YFP12AJZB4MABJBAJ55XECVS7E4PMMZ89YZR.usda-token::usda', + ] + }) } module.exports = { - misrepresentedTokens: true, stacks: { tvl, }, }; -// node test.js projects/arkadiko.js diff --git a/projects/astral.js b/projects/astral.js index 52a2c3e0826..6c53d5835be 100644 --- a/projects/astral.js +++ b/projects/astral.js @@ -1,24 +1,6 @@ -const utils = require("./helper/utils"); - var chainId; - var vault; - - async function fetch() { - const response = await utils.fetchURL("https://api.astral.financial/tvl"); - - let tvl = 0; - for (chainId in response.data) { - const chain = response.data[chainId]; - - for (vault in chain) { - tvl += chain[vault]; - } - } - - return tvl; - } module.exports = { - methodology: - 'TVL data is pulled from the Astral Financial API "https://api.astral.financial/tvl".', - fetch, + fantom: { + tvl: () => 0, + } }; \ No newline at end of file diff --git a/projects/astroswap.js b/projects/astroswap.js index 70efa3ddb46..d892c95850b 100644 --- a/projects/astroswap.js +++ b/projects/astroswap.js @@ -4,8 +4,8 @@ module.exports = { misrepresentedTokens: true, velas: { tvl: getUniTVL({ - factory: '0xe82d721A6CdeC2f86e9Fca074Ff671c8621F8459', chain: 'velas', useDefaultCoreAssets: true, - blacklist: ['0xcd7509b76281223f5b7d3ad5d47f8d7aa5c2b9bf'], + factory: '0xe82d721A6CdeC2f86e9Fca074Ff671c8621F8459', useDefaultCoreAssets: true, + blacklist: ['0xcd7509b76281223f5b7d3ad5d47f8d7aa5c2b9bf', '0xd12f7a98c0d740e7ec82e8caf94eb79c56d1b623',], }) }, }; diff --git a/projects/atmossoft.js b/projects/atmossoft.js index a0ec43996f5..9461ed5bae9 100644 --- a/projects/atmossoft.js +++ b/projects/atmossoft.js @@ -1,14 +1,15 @@ +const ADDRESSES = require('./helper/coreAssets.json') const { sumUnknownTokens } = require('./helper/unknownTokens') async function bsc(timestamp, ethBlock, chainBlocks) { const pools = [{ 'pool2Address': '0xaF18cde26fdd22561df2a02958CbA092f41875d8', - 'pairToken': 'bsc:0x55d398326f99059ff775485246999027b3197955', + 'pairToken': 'bsc:' + ADDRESSES.bsc.USDT, 'stakingContract': '0x282FFbE782F903340A14955649032302e8020b9C' }, { 'pool2Address': '0xdf825e486d9d15848a36c113b7725d7923e886a4', - 'pairToken': '0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c', + 'pairToken': ADDRESSES.bsc.WBNB, 'stakingContract': '0xa65d60e8a71dBDbb14B6eE7073522546FE73CFE4' }]; @@ -16,18 +17,18 @@ async function bsc(timestamp, ethBlock, chainBlocks) { const coreAssets = pools.map(i => i.pairToken) return sumUnknownTokens({ tokensAndOwners, coreAssets, chain: 'bsc', block: chainBlocks.bsc }) -}; +} async function ftm(timestamp, ethBlock, chainBlocks) { const pools = [{ 'pool2Address': '0x662db0c6fa77041fe4901149558cc70ca1c8e874', - 'pairToken': '0x4e15361fd6b4bb609fa63c81a2be19d873717870', + 'pairToken': ADDRESSES.ethereum.FTM, 'stakingContract': 'f043f876d3d220acce029ca76c9572f0449e5e71' }]; const tokensAndOwners = pools.map(i => ([i.pool2Address, i.stakingContract])) const coreAssets = pools.map(i => i.pairToken) return sumUnknownTokens({ tokensAndOwners, coreAssets, chain: 'fantom', block: chainBlocks.fantom }) -}; +} module.exports = { misrepresentedTokens: true, diff --git a/projects/atrix.js b/projects/atrix.js index e8375508e86..6c17bf09f6b 100644 --- a/projects/atrix.js +++ b/projects/atrix.js @@ -1,15 +1,16 @@ -const { get } = require('./helper/http') +const { sumTokens2 } = require('./helper/solana') +const { getConfig } = require('./helper/cache') -async function fetch() { - return (await get('https://api.atrix.finance/api/tvl')).tvl; +async function tvl() { + const { pools } = await getConfig('atrix-v1', 'https://api.atrix.finance/api/all') + return sumTokens2({ tokenAccounts: pools.map(({ marketData: { coinVault, pcVault } }) => [coinVault, pcVault]).flat() }) } module.exports = { timetravel: false, - methodology: "The Atrix API endpoint fetches on-chain data from the Serum orderbook and token accounts for each liquidity pool, then uses prices from Coingecko to aggregate total TVL.", - fetch, + solana: { tvl }, hallmarks: [ [1665521360, "Mango Markets Hack"], [1667865600, "FTX collapse"] ], -}; +} diff --git a/projects/autofarm.js b/projects/autofarm.js index e0d7b518883..aec56e503b8 100644 --- a/projects/autofarm.js +++ b/projects/autofarm.js @@ -1,31 +1,42 @@ -const utils = require('./helper/utils'); -const {fetchChainExports} = require('./helper/exports'); +const { sumUnknownTokens } = require('./helper/unknownTokens'); -const transformChain = { - okexchain: 'okex', - avax: 'avax', - wan: 'wanchain', -} - -function chainTvl(chain){ - return async()=>{ - const data = await utils.fetchURL(`https://static.autofarm.network/${transformChain[chain] ?? chain}/stats.json`) - return data.data.platformTVL - } -} - -module.exports=fetchChainExports(chainTvl, [ - 'bsc', 'polygon', - 'heco', 'avax', - 'fantom', 'moonriver', - 'okexchain', 'celo', - 'cronos', 'boba', - 'harmony', 'xdai', - 'velas', 'aurora', - 'oasis', 'wan', - 'kcc', 'evmos' -]) module.exports.hallmarks=[ [1618966800, "Venus incident"], [1634778000, "Emissions end"], ] + +const config = { + aurora: "0x62537419c8327AB66165bAE205Da8fcB6871A700", + avax: "0x864A0B7F8466247A0e44558D29cDC37D4623F213", + boba: "0x864A0B7F8466247A0e44558D29cDC37D4623F213", + bsc: "0x0895196562c7868c5be92459fae7f877ed450452", + celo: "0xdD11b66B90402F294a017c4688509c364312303F", + cronos: "0x76b8c3ECdF99483335239e66F34191f11534cbAA", + fantom: "0x76b8c3ECdF99483335239e66F34191f11534cbAA", + fuse: "0x9C30e4B50b4b3804D3b50f01619c61fE44ed894e", + harmony: "0x9c57658139afb41949cebc07d806f37d29d13eea", + heco: "0x96a29c4bce3126266983f535b41c30dba80d5d99", + moonbeam: "0x77286f5257e090b1bedbc6df6726d53cbf8573a6", + moonriver: "0xfadA8Cc923514F1D7B0586aD554b4a0CeAD4680E", + oasis: "0xbf19C3fe078258F1D1C34bEc7e624AD8a1DE343A", + okexchain: "0x864A0B7F8466247A0e44558D29cDC37D4623F213", + polygon: "0x89d065572136814230A55DdEeDDEC9DF34EB0B76", + velas: "0xAd2DB12795CeD89cA2D1819710233106115E3034", + xdai: "0xfadA8Cc923514F1D7B0586aD554b4a0CeAD4680E", + evmos: "0x9C30e4B50b4b3804D3b50f01619c61fE44ed894e", + kcc: "0x76b8c3ECdF99483335239e66F34191f11534cbAA", + wan: "0xAd2DB12795CeD89cA2D1819710233106115E3034", +} + +Object.keys(config).forEach(chain => { + const masterchef = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const data = await api.fetchList({ lengthAbi: 'uint256:poolLength', itemAbi: 'function poolInfo(uint256) view returns (address want, uint256,uint256,uint256,address strat)', target: masterchef, }) + const tokens = data.map(i => i.want) + const bals = await api.multiCall({ abi: 'uint256:wantLockedTotal', calls: data.map(i => i.strat), permitFailure: true, }) + bals.forEach((v, i) => v && api.add(tokens[i], v)) + return sumUnknownTokens({ api, resolveLP: true, useDefaultCoreAssets: true, }) + } + } +}) diff --git a/projects/badgerdao.js b/projects/badgerdao.js index 4b32aa9507f..01d48c07bac 100644 --- a/projects/badgerdao.js +++ b/projects/badgerdao.js @@ -1,5 +1,6 @@ const utils = require('./helper/utils'); const { fetchChainExports } = require('./helper/exports'); +const sdk = require('@defillama/sdk') function chainTvl(chain) { @@ -8,7 +9,13 @@ function chainTvl(chain) { // chain = chain === "ethereum" ? "eth" : chain return async () => { let data = await utils.fetchURL(`https://api.badger.com/v2/vaults?chain=${chain}¤cy=usd`) - return data.data.reduce((acc, i) => acc + i.value, 0) + return data.data.filter(i => { + if (i.value > 1e9) { + sdk.log('error', i) + return false + } + return true + }).reduce((acc, i) => acc + i.value, 0) } } diff --git a/projects/basis-cash.js b/projects/basis-cash.js index 180e00b7ba8..04796ac67a7 100644 --- a/projects/basis-cash.js +++ b/projects/basis-cash.js @@ -1,11 +1,12 @@ +const ADDRESSES = require('./helper/coreAssets.json') const { sumTokens } = require('./helper/unwrapLPs') async function tvl(ts, block) { const toa = [ - ['0x6b175474e89094c44da98b954eedeac495271d0f', '0xEBd12620E29Dc6c452dB7B96E1F190F3Ee02BDE8'], - ['0x57ab1ec28d129707052df4df418d58a2d46d5f51', '0xdc42a21e38c3b8028b01a6b00d8dbc648f93305c'], - ['0xdac17f958d2ee523a2206206994597c13d831ec7', '0x2833bdc5B31269D356BDf92d0fD8f3674E877E44'], - ['0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', '0x51882184b7F9BEEd6Db9c617846140DA1d429fD4'], + [ADDRESSES.ethereum.DAI, '0xEBd12620E29Dc6c452dB7B96E1F190F3Ee02BDE8'], + [ADDRESSES.ethereum.sUSD, '0xdc42a21e38c3b8028b01a6b00d8dbc648f93305c'], + [ADDRESSES.ethereum.USDT, '0x2833bdc5B31269D356BDf92d0fD8f3674E877E44'], + [ADDRESSES.ethereum.USDC, '0x51882184b7F9BEEd6Db9c617846140DA1d429fD4'], ['0xdf5e0e81dff6faf3a7e52ba697820c5e32d806a8', '0xC462d8ee54953E7d7bF276612b75387Ea114c3bf'], ] diff --git a/projects/bella.js b/projects/bella.js index e441355eeca..fb5e74d9e52 100644 --- a/projects/bella.js +++ b/projects/bella.js @@ -22,11 +22,11 @@ async function tvl(ts, block) { const tokenCalls = Object.values(bVaults).map(a => ({ target: a.address })) const { output: tokenResponse } = await sdk.api.abi.multiCall({ - block, calls: tokenCalls, abi: bVaultAbi.find(i => i.name === 'token') + block, calls: tokenCalls, abi: bVaultAbi.token }) const { output: underlyingBalances } = await sdk.api.abi.multiCall({ - block, calls: tokenCalls, abi: bVaultAbi.find(i => i.name === 'underlyingBalance') + block, calls: tokenCalls, abi: bVaultAbi.underlyingBalance }) const balances = {} @@ -47,5 +47,22 @@ module.exports = { tvl, pool2, }, + era: { + pool2: async (_, _1, _2, { api }) => { + const pool2s = [ + '0x9FB6Ca27D20E569E5c8FeC359C9d33D468d2803C', + '0x3bd7a1D8c760d8be1bC57A3205cbFfBaDFB74D94' + ] + const infoABI = "function getMiningContractInfo() external view returns (address tokenX, address tokenY, uint24 fee_, address iziTokenAddr, uint256 lastTouchTime_, uint256 totalVLiquidity_, uint256 bal0, uint256 bal1, uint256 balIzi, uint256 startTime_, uint256 endTime_)" + + const data = await api.multiCall({ abi: infoABI, calls: pool2s }) + const transform = i => i.toLowerCase() === '0xb83cfb285fc8d936e8647fa9b1cc641dbaae92d9' ? 'ethereum:0xa91ac63d040deb1b7a5e4d4134ad23eb0ba07e14': 'era:'+i + for (const { tokenX, tokenY, iziTokenAddr, bal0, bal1, balIzi } of data) { + api.add(transform(tokenX), bal0, { skipChain: true}) + api.add(transform(tokenY), bal1, { skipChain: true}) + api.add(iziTokenAddr, balIzi) + } + }, + }, } diff --git a/projects/bitBTC.js b/projects/bitBTC.js index 54e050d4e9f..70f8700d0e0 100644 --- a/projects/bitBTC.js +++ b/projects/bitBTC.js @@ -1,8 +1,9 @@ +const ADDRESSES = require('./helper/coreAssets.json') const sdk = require("@defillama/sdk"); const { transformOptimismAddress } = require('./helper/portedTokens'); const WBTC = "0x68f180fcce6836688e9084f035309e29bf0a2095"; -const bitANT = "0x5029c236320b8f15ef0a657054b84d90bfbeded3"; +const bitANT = ADDRESSES.optimism.BitANT; const bitBTC = "0xc98b98d17435aa00830c87ea02474c5007e1f272"; const tvlContracts = [ @@ -58,18 +59,18 @@ async function findBalances(contracts, block) { transform(contracts[i].token), balanceOfs[i].output ); - }; - }; + } + } return balances; -}; +} async function tvl(timestamp, block, chainBlocks) { return await findBalances(tvlContracts, chainBlocks.optimism); -}; +} async function staking(timestamp, block, chainBlocks) { return await findBalances(stakingContracts, chainBlocks.optimism); -}; +} module.exports = { optimism: { diff --git a/projects/blackpool.js b/projects/blackpool.js index 52155ca1ef4..98e745737f4 100644 --- a/projects/blackpool.js +++ b/projects/blackpool.js @@ -28,7 +28,7 @@ async function mainnetStaking(timestamp, ethBlock, chainBlocks) { block: ethBlock, chain: 'ethereum' }) - console.log(`BPT staked in xBPT on mainnet: ${xBPT_BPT_bal / 1e18}`) + sdk.log(`BPT staked in xBPT on mainnet: ${xBPT_BPT_bal / 1e18}`) sdk.util.sumSingleBalance( balances, BPT_mainnet, @@ -46,7 +46,7 @@ async function mainnetStaking(timestamp, ethBlock, chainBlocks) { 'token': BPT_WETH_LP_mainnet_sushi, 'balance': BPT_WETH_LP_tokens }] - console.log('Sushiswap BPT/WETH LP staked in masterchef', BPT_WETH_LP_tokens / 1e18) + sdk.log('Sushiswap BPT/WETH LP staked in masterchef', BPT_WETH_LP_tokens / 1e18) balances = {} await unwrapUniswapLPs(balances, lpBalances, ethBlock); diff --git a/projects/bond-appetit.js b/projects/bond-appetit.js index f736cf3371f..49b5cebfb2a 100644 --- a/projects/bond-appetit.js +++ b/projects/bond-appetit.js @@ -1,14 +1,17 @@ -const { GraphQLClient, gql } = require('graphql-request') +const { GraphQLClient, } = require('graphql-request') async function fetch() { var endpoint = 'https://cache.bondappetit.io/api' var graphQLClient = new GraphQLClient(endpoint) - var query = gql` { getTVL } `; + var query = ` { getTVL } `; var results = await graphQLClient.request(query) return parseFloat(results.getTVL) } module.exports = { + ethereum: { + fetch + }, fetch } diff --git a/projects/bt-finance.js b/projects/bt-finance.js index c346c93c081..accbd875ef7 100644 --- a/projects/bt-finance.js +++ b/projects/bt-finance.js @@ -10,5 +10,8 @@ async function fetch() { } module.exports = { + ethereum: { + fetch, + }, fetch } diff --git a/projects/btn-group.js b/projects/btn-group.js index b8f91a31ac2..c1313b800fc 100644 --- a/projects/btn-group.js +++ b/projects/btn-group.js @@ -5,5 +5,8 @@ async function fetch() { } module.exports = { + secret: { + fetch + }, fetch } \ No newline at end of file diff --git a/projects/cennz-bridge.js b/projects/cennz-bridge.js index b7c072fdc7e..b41b7fc3084 100644 --- a/projects/cennz-bridge.js +++ b/projects/cennz-bridge.js @@ -1,12 +1,13 @@ +const ADDRESSES = require('./helper/coreAssets.json') const sdk = require("@defillama/sdk"); const target = '0x76BAc85e1E82cd677faa2b3f00C4a2626C4c6E32'; -const WETH = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'; +const WETH = ADDRESSES.ethereum.WETH; async function tvl(timestamp, block) { return { [ WETH ]: (await sdk.api.eth.getBalance({ target, block })).output }; -}; +} module.exports = { methodology: "Tracks funds locked in the ERC20Peg contract on Ethereum", diff --git a/projects/champagne-swap.js b/projects/champagne-swap.js index 52d7b98dcd5..9a77c91ec29 100644 --- a/projects/champagne-swap.js +++ b/projects/champagne-swap.js @@ -11,6 +11,6 @@ module.exports = { methodology: 'TVL accounts for the liquidity on all AMM pools, using the TVL chart on https://champagne.finance/ as the source. Staking accounts for the CHAM locked in MasterChef (0x15C17442eb2Cd3a56139e877ec7784b2dbD97270)', bsc: { staking: staking(masterChef, champagneToken, 'bsc'), - tvl: getUniTVL({ chain: 'bsc', useDefaultCoreAssets: true, factory, }) + tvl: getUniTVL({ useDefaultCoreAssets: true, factory, }) }, } diff --git a/projects/chaotic.js b/projects/chaotic.js index 6b311eba4da..f5b7dd7ad6d 100644 --- a/projects/chaotic.js +++ b/projects/chaotic.js @@ -1,5 +1,5 @@ const sdk = require("@defillama/sdk"); -const getReserves = require("./helper/abis/getReserves.json"); +const getReserves = 'function getReserves() view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast)' const BigNumber = require("bignumber.js"); const CollateralSystemAddress = "0x78D4664408c06F2BeDc4f108f3Fc8f0AB017a0AE"; diff --git a/projects/cleopatradao.js b/projects/cleopatradao.js index 352cd0379ad..78420920ca3 100644 --- a/projects/cleopatradao.js +++ b/projects/cleopatradao.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('./helper/coreAssets.json') const { ohmTvl } = require("./helper/ohm"); const cat = "0x48358BfAA1EC39AafCb0786c3e0342Db676Df93E"; @@ -5,7 +6,7 @@ const stakingContract = "0x6636dF51544bAef6B90f4012504B1dfE1eD5e3Fd"; const treasury = "0x10243C6D13875443716ff3E88b7Da7664e431E09"; const treasuryTokens = [ ["0x130966628846bfd36ff31a822705796e8cb8c18d", false], // MIM - ["0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7", false], // WAVAX + [ADDRESSES.avax.WAVAX, false], // WAVAX ["0x6a71044647c960afb6bbe758cc444dedfa9349f7", true] // CAT-MIM JLP ] diff --git a/projects/cofix.js b/projects/cofix.js index 8c81e1ff95e..f4c958ad545 100644 --- a/projects/cofix.js +++ b/projects/cofix.js @@ -1,11 +1,12 @@ +const ADDRESSES = require('./helper/coreAssets.json') const { sumTokens } = require('./helper/unwrapLPs') async function tvl(_, block) { return sumTokens({}, [ - ['0xdac17f958d2ee523a2206206994597c13d831ec7', '0xb2b7bedd7d7fc19804c7dd4a4e8174c4c73c210d'], - ['0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', '0xb2b7bedd7d7fc19804c7dd4a4e8174c4c73c210d'], + [ADDRESSES.ethereum.USDT, '0xb2b7bedd7d7fc19804c7dd4a4e8174c4c73c210d'], + [ADDRESSES.ethereum.WETH, '0xb2b7bedd7d7fc19804c7dd4a4e8174c4c73c210d'], ['0x0316EB71485b0Ab14103307bf65a021042c6d380', '0x7c2d7b53aca4038f2eb649164181114b9aee93cb'], - ['0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', '0x7c2d7b53aca4038f2eb649164181114b9aee93cb'], + [ADDRESSES.ethereum.WETH, '0x7c2d7b53aca4038f2eb649164181114b9aee93cb'], ], block) } diff --git a/projects/corgiswap.js b/projects/corgiswap.js index 41b8fe4cfb2..059f6df9696 100644 --- a/projects/corgiswap.js +++ b/projects/corgiswap.js @@ -9,7 +9,7 @@ module.exports = { misrepresentedTokens: true, methodology: 'TVL accounts for the liquidity on all AMM pools, using the TVL chart on https://corgiswap.info/ as the source. Staking accounts for the CORIS locked in MasterChef (0x60E5Cf9111d046E8F986fC98e37d6703607d5Baf)', bsc: { - tvl: getUniTVL({ factory, chain: 'bsc', useDefaultCoreAssets: true, }), + tvl: getUniTVL({ factory, useDefaultCoreAssets: true, }), staking: stakingPricedLP(masterChef, corisToken, "bsc", "0x1881bd6aba086da0c5cfed7247f216dea50e38ed", "wbnb", true) }, } diff --git a/projects/cotiTreasury.js b/projects/cotiTreasury.js index 68d00d25e11..2cac3fe8a0e 100644 --- a/projects/cotiTreasury.js +++ b/projects/cotiTreasury.js @@ -4,7 +4,7 @@ async function staking() { return { 'coti': Number((await http.get("https://treasury-app.coti.io/get-total")).totalCotiInPool).toFixed(0), }; -}; +} module.exports = { timetravel: false, diff --git a/projects/cover.js b/projects/cover.js index 976379a6d2c..527841ea420 100644 --- a/projects/cover.js +++ b/projects/cover.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('./helper/coreAssets.json') const sdk = require("@defillama/sdk"); const abis = require('./config/cover/cover.js') const { sumTokens } = require('./helper/unwrapLPs'); @@ -8,24 +9,24 @@ async function tvl(ts, block) { const { output: allProtocols } = await sdk.api.abi.call({ block, target: factory, - abi: abis.abis.protocols.find(i => i.name === 'getAllProtocolAddresses') + abi: abis.abis.protocols.getAllProtocolAddresses }) const calls = allProtocols.map(p => ({ target: p })) const { output: protocolDetails } = await sdk.api.abi.multiCall({ block, calls, - abi: abis.abis.cover.find(i => i.name === 'getProtocolDetails') + abi: abis.abis.cover.getProtocolDetails }) const toa = [] protocolDetails.forEach(({ output }) => { output._allCovers.forEach(cover => toa.push( - ['0x6b175474e89094c44da98b954eedeac495271d0f', cover], // DAI + [ADDRESSES.ethereum.DAI, cover], // DAI ['0x16de59092dAE5CcF4A1E6439D611fd0653f0Bd01', cover], // yearn DAI )) }) - return sumTokens({}, toa, block, undefined, undefined, { resolveYearn: true }) + return sumTokens({}, toa, block) } diff --git a/projects/crema.js b/projects/crema.js index f23fa88788c..cdf5533dd76 100644 --- a/projects/crema.js +++ b/projects/crema.js @@ -1,10 +1,15 @@ -const { get } = require('./helper/http') +const { getConfig } = require('./helper/cache') +const { sumTokens2 } = require('./helper/solana') -async function fetch() { - return (await get("https://api.crema.finance/v1/swap/count")).data.tvl_in_usd; +async function tvl() { + const { data } = await getConfig('crema-solana', "https://api.crema.finance/v1/swap/count") + const tokenAccounts = data.pools.map(i => ([i.token_a_reserves, i.token_b_reserves])).flat() + return sumTokens2({ tokenAccounts }) } module.exports = { timetravel: false, - fetch, + solana: { + tvl + }, }; diff --git a/projects/dddx.js b/projects/dddx.js index 12c998336c4..f85ce36e7ed 100644 --- a/projects/dddx.js +++ b/projects/dddx.js @@ -7,7 +7,7 @@ module.exports = { timetravel: true, incentivized: true, bsc: { - tvl: getUniTVL({ factory: '0xb5737A06c330c22056C77a4205D16fFD1436c81b', chain: 'bsc', useDefaultCoreAssets: true }), + tvl: getUniTVL({ factory: '0xb5737A06c330c22056C77a4205D16fFD1436c81b', useDefaultCoreAssets: true }), staking: stakings( [ '0x488f0252B4bEa5A851FE9C827894d08868D552C0', diff --git a/projects/defichain-dex.js b/projects/defichain-dex.js index b9df3ff03a6..8d2144ce1f3 100644 --- a/projects/defichain-dex.js +++ b/projects/defichain-dex.js @@ -6,7 +6,7 @@ async function tvl() { const { data: info } = await get('https://ocean.defichain.com/v0/mainnet/poolpairs?size=200') info.forEach(i => data.push({ token0: i.tokenA.symbol, token0Bal: i.tokenA.reserve, token1: i.tokenB.symbol, token1Bal: i.tokenB.reserve,})) const balances = await transformDexBalances({data, chain: 'defichain'}) - balances['decentralized-usd'] = balances['decentralized-usd'] * 0.7 + balances['defichain:dusd'] = balances['defichain:dusd'] * 0.7 return balances } diff --git a/projects/definix.js b/projects/definix.js index dfada42c14b..02fd19502f9 100644 --- a/projects/definix.js +++ b/projects/definix.js @@ -1,24 +1,10 @@ -const { get } = require('./helper/http') +const { getUniTVL } = require('./helper/unknownTokens') -async function klaytn() { - const response = await get( - "https://database-s3public-g8ignhbbbk6e.s3.ap-southeast-1.amazonaws.com/definix/tvl.json" - ) - return response.caverTVL; -} -async function bsc() { - const response = await get( - "https://database-s3public-g8ignhbbbk6e.s3.ap-southeast-1.amazonaws.com/definix/tvl.json" - ) - return response.web3TVL; -} module.exports = { - klaytn: { - fetch: klaytn, - }, bsc: { - fetch: bsc, + tvl: getUniTVL({ factory: '0x43eBb0cb9bD53A3Ed928Dd662095aCE1cef92D19', useDefaultCoreAssets: true, }), + }, + klaytn: { + tvl: getUniTVL({ factory: '0xdee3df2560bceb55d3d7ef12f76dcb01785e6b29', useDefaultCoreAssets: true, }), }, - fetch: async () => (await bsc()) + (await klaytn()), }; -// node test.js projects/definix.js diff --git a/projects/defiplaza.js b/projects/defiplaza.js index 791f262b990..6aa8bda1367 100644 --- a/projects/defiplaza.js +++ b/projects/defiplaza.js @@ -1,8 +1,8 @@ -const { request, gql } = require('graphql-request'); +const { request, } = require('graphql-request'); const { toUSDTBalances } = require('./helper/balances'); const graphUrl = 'https://api.thegraph.com/subgraphs/name/omegasyndicate/defiplaza'; -const graphQuery = gql` +const graphQuery = ` query get_tvl($timestamp: Int) { hourlies(first: 1, orderBy: date, orderDirection: desc, where:{date_lte: $timestamp}) { totalValueLockedUSD diff --git a/projects/defisaver.js b/projects/defisaver.js index e7875668fa9..f22646d7968 100644 --- a/projects/defisaver.js +++ b/projects/defisaver.js @@ -1,13 +1,12 @@ -const BigNumber = require("bignumber.js"); +const ADDRESSES = require('./helper/coreAssets.json') const defisaverABIs = require("./config/defisaver/abis"); const utils = require("./helper/utils"); +const { nullAddress, } = require("./helper/tokenMapping"); const sdk = require('@defillama/sdk') -const usdtAddress = "0xdac17f958d2ee523a2206206994597c13d831ec7" +const dai = ADDRESSES.ethereum.DAI const { - AaveSubscriptions, - AaveLoanInfo, CompoundSubscriptions, CompoundLoanInfo, McdSubscriptions, @@ -21,274 +20,90 @@ function getAddress(defisaverConfig) { } function getAbi(defisaverConfig, abiName) { - return defisaverConfig.abi.find(obj => obj.name === abiName) + return defisaverConfig.abi[abiName] } -// Configs -const coins = { - ETH: 18, - WETH: 18, - cETH: 8, - DAI: 18, - cDAI: 8, - iDAI: 18, - MKR: 18, - BAT: 18, - cBAT: 8, - ZRX: 18, - KNC: 18, - cZRX: 8, - REP: 18, - REPv2: 18, - cREP: 8, - USDC: 6, - cUSDC: 8, - WBTC: 8, - cWBTC: 8, - DGD: 9, - USDT: 6, - cUSDT: 8, - SAI: 18, - COMP: 18, - aETH: 18, - aDAI: 18, - aUSDC: 18, - aSUSD: 18, - SUSD: 18, - aTUSD: 18, - TUSD: 18, - aUSDT: 18, - aBUSD: 18, - BUSD: 18, - aBAT: 18, - aKNC: 18, - aLEND: 18, - LEND: 18, - aLINK: 18, - LINK: 18, - aMANA: 18, - MANA: 18, - aMKR: 18, - aREP: 18, - aSNX: 18, - SNX: 18, - aWBTC: 18, - aZRX: 18, - aENJ: 18, - ENJ: 18, - aREN: 18, - REN: 18, - CRV: 18, - YFI: 18, - aYFI: 18, - PAXUSD: 18, - DPI: 18, - UNI: 18, - cUNI: 8, - LRC: 18, - cCOMP: 8, - aUNI: 18, - AAVE: 18, - aAave: 18, - BAL: 18, - GUSD: 2, - RENBTC: 18, - MATIC: 18, -}; - -const keys = [ - { - ETH: "ethereum", - WETH: "ethereum", - cETH: "ethereum", - DAI: "dai", - cDAI: "cdai", - iDAI: "dai", - MKR: "maker", - BAT: "basic-attention-token", - cBAT: "compound-basic-attention-token", - ZRX: "0x", - cZRX: "compound-0x", - KNC: "kyber-network", - REP: "augur", - REPv2: "augur", - cREP: "compound-augur", - USDC: "usd-coin", - cUSDC: "compound-usd-coin", - WBTC: "wrapped-bitcoin", - cWBTC: "compound-wrapped-btc", - DGD: "digixdao", - USDT: "tether", - cUSDT: "compound-usdt", - SAI: "sai", - COMP: "compound-coin", - aETH: "aave-eth", - aDAI: "aave-dai", - aUSDC: "aave-usdc", - aSUSD: "aave-susd", - SUSD: "nusd", - aTUSD: "aave-tusd", - TUSD: "true-usd", - aUSDT: "aave-usdt", - aBUSD: "aave-busd", - BUSD: "binance-usd", - aBAT: "aave-bat", - aKNC: "aave-k", - aLEND: "aave-lend", - LEND: "ethlend", - aLINK: "aave-link", - LINK: "chainlink", - aMANA: "aave-mana", - MANA: "decentraland", - aMKR: "aave-mkr", - aREP: "aave-rep", - aSNX: "aave-snx", - SNX: "havven", - aWBTC: "aave-wbtc", - aZRX: "aave-zrx", - aENJ: "aave-enj", - ENJ: "enjincoin", - aREN: "aave-ren", - REN: "renbtc", - CRV: "curve-dao-token", - YFI: "yearn-finance", - aYFI: "ayfi", - PAXUSD: "paxos-standard", - DPI: "defipulse-index", - UNI: "uniswap", - cUNI: "compound-uniswap", - LRC: "loopring", - cCOMP: "ccomp", - aUNI: "uniswap", - AAVE: "aave", - aAave: "aave", - BAL: "balancer", - GUSD: "gemini-dollar", - RENBTC: "renbtc", - WSTETH: "staked-ether", - MATIC: "matic-network", - }, -]; - // Utils const bytesToString = (hex) => - Buffer.from(hex.replace(/^0x/, ""), "hex").toString().replace(/\x00/g, ""); + Buffer.from(hex.replace(/^0x/, ""), "hex").toString().replace(/\x00/g, ""); // eslint-disable-line const ilkToAsset = (ilk) => (ilk.substr(0, 2) === "0x" ? bytesToString(ilk) : ilk).replace(/-.*/, ""); -const assetAmountInEth = (amount, asset = "ETH") => { - let decimals; - if (asset.substr(0, 4) === "MCD-") decimals = 18; - else if (asset === "USD") decimals = 18; - else decimals = coins[asset]; - return new BigNumber((amount && amount.toString()) || 0) - .div(10 ** decimals) - .toString(); -}; - -async function tvl(ts, block) { +async function tvl(ts, block, _, { api }) { const balances = {} - const prices = (await utils.getPrices(keys)).data; - await getCompoundData() - await getAaveV2Data() - await getMakerData() + await Promise.all([ + getCompoundData, + getAaveV2Data, + getMakerData, + ].map(i => i())) return balances async function getCompoundData() { - let { output: compoundSubs } = await sdk.api.abi.call({ + let compoundSubs = await api.call({ target: getAddress(CompoundSubscriptions), abi: getAbi(CompoundSubscriptions, 'getSubscribers'), - block, }) - let { output: subData } = await sdk.api.abi.call({ + let subData = await api.call({ target: getAddress(CompoundLoanInfo), abi: getAbi(CompoundLoanInfo, 'getLoanDataArr'), params: [compoundSubs.map((s) => s.user)], - block, }) - const activeSubs = subData.map((sub) => { - let sumBorrowUsd = 0; - let sumCollUsd = 0; - - sub.borrowAmounts.forEach((amount, i) => { - if (sub.borrowAddr[i] === "0x0000000000000000000000000000000000000000") - return; - const borrowUsd = assetAmountInEth(amount); - sumBorrowUsd += parseFloat(borrowUsd); - }); - - sub.collAmounts.forEach((amount, i) => { - if (sub.collAddr[i] === "0x0000000000000000000000000000000000000000") - return; - const collUsd = assetAmountInEth(amount); - sumCollUsd += parseFloat(collUsd); - }); - - return { sumBorrowUsd, sumCollUsd }; - }).filter(({ sumBorrowUsd }) => sumBorrowUsd); - - activeSubs.forEach(sub => addToBalances(sub.sumCollUsd)) + subData.map((sub) => { + const { collAmounts, collAddr, borrowAddr, borrowAmounts } = sub + + let borrowAmountTotal = 0 + borrowAddr.forEach((value, i) => { + if (value === nullAddress) return; + borrowAmountTotal += +borrowAmounts[i] + }) + + if (borrowAmountTotal <= 0) return; + collAddr.forEach((value, i) => { + if (value === nullAddress) return; + sdk.util.sumSingleBalance(balances, dai, collAmounts[i], api.chain) + }) + }) } async function getAaveV2Data() { const defaultMarket = "0xB53C1a33016B2DC2fF3653530bfF1848a515c8c5"; - let { output: aaveSubs } = await sdk.api.abi.call({ + let aaveSubs = await api.call({ target: getAddress(AaveSubscriptionsV2), abi: getAbi(AaveSubscriptionsV2, 'getSubscribers'), - block, }) - let subData = []; - for (let i = 0; i < subData.length; i += 30) { - let userAddresses = aaveSubs.map((s) => s.user).slice(i, i + 30) - subData = subData.concat( - (await sdk.api.abi.call({ - target: getAddress(AaveLoanInfoV2), - abi: getAbi(AaveLoanInfoV2, 'getLoanDataArr'), - params: [defaultMarket, userAddresses], - block, + const chunks = utils.sliceIntoChunks(aaveSubs, 30) + await Promise.all(chunks.map(async aaveSubs => { + const subData = await api.call({ + target: getAddress(AaveLoanInfoV2), + abi: getAbi(AaveLoanInfoV2, 'getLoanDataArr'), + params: [defaultMarket, aaveSubs.map(i => i.user)], + }) + subData.map((sub) => { + const { collAmounts, collAddr, borrowAddr, borrowStableAmounts, borrowVariableAmounts, } = sub + + let borrowAmountTotal = 0 + borrowAddr.forEach((value, i) => { + if (value === nullAddress) return; + borrowAmountTotal += +borrowStableAmounts[i] + borrowAmountTotal += +borrowVariableAmounts[i] }) - ).output - ) - } - - const activeSubs = subData.map((sub) => { - let sumBorrowUsd = 0; - let sumCollUsd = 0; - - sub.borrowStableAmounts.forEach((amount, i) => { - if (sub.borrowAddr[i] === "0x0000000000000000000000000000000000000000") - return; - const borrowUsd = assetAmountInEth(amount) * prices.ethereum.usd; - sumBorrowUsd += borrowUsd; - }); - - sub.borrowVariableAmounts.forEach((amount, i) => { - if (sub.borrowAddr[i] === "0x0000000000000000000000000000000000000000") - return; - const borrowUsd = assetAmountInEth(amount) * prices.ethereum.usd; - sumBorrowUsd += borrowUsd; - }); - - sub.collAmounts.forEach((amount, i) => { - if (sub.collAddr[i] === "0x0000000000000000000000000000000000000000") - return; - const collUsd = assetAmountInEth(amount) * prices.ethereum.usd; - sumCollUsd += collUsd; - }); - return { sumBorrowUsd, sumCollUsd }; - }).filter(({ sumBorrowUsd }) => sumBorrowUsd); + if (borrowAmountTotal <= 0) return; + collAddr.forEach((value, i) => { + if (value === nullAddress) return; + sdk.util.sumSingleBalance(balances, nullAddress, collAmounts[i], api.chain) + }) - activeSubs.forEach(sub => addToBalances(sub.sumCollUsd)) + }) + })) } async function getMakerData() { - let { output: makerSubs } = await sdk.api.abi.call({ + let makerSubs = await api.call({ target: getAddress(McdSubscriptions), abi: getAbi(McdSubscriptions, 'getSubscribers'), - block, }) const getCdpDetailedInfoABI = getAbi(MCDSaverProxy, 'getCdpDetailedInfo') @@ -300,29 +115,32 @@ async function tvl(ts, block) { params: [cdp.cdpId,], }); } - const { output: callResults } = await sdk.api.abi.multiCall({ + const callResults = await api.multiCall({ abi: getCdpDetailedInfoABI, calls, - block, }) - const results = {} - callResults.forEach(result => results[result.input.params[0]] = result.output) - let data = []; + callResults.forEach((cdp, i) => { + const asset = ilkToAsset(cdp.ilk) + if (+cdp.debt <= 0 || asset === 'RENBTC' ) return; + let balance = cdp.collateral + if (asset === 'WBTC') + balance /= 1e10 - makerSubs.forEach((cdp, i) => { - const asset = ilkToAsset(results[cdp.cdpId].ilk) - const debt = assetAmountInEth(results[cdp.cdpId].debt, 'DAI') - const collateral = assetAmountInEth(results[cdp.cdpId].collateral, `MCD-${asset}`) - data.push({ debt, collateralUsd: parseFloat(collateral) * parseFloat(prices[keys[0][asset]].usd), }) + sdk.util.sumSingleBalance(balances, assetMapping[asset] || asset, balance) }); - const activeSubs = data.filter(({ debt }) => parseFloat(debt)); - activeSubs.forEach(sub => addToBalances(sub.collateralUsd)) } +} - function addToBalances(usdValue) { - sdk.util.sumSingleBalance(balances, usdtAddress, parseFloat(usdValue) * (10 ** 6)) - } +const assetMapping = { + ETH: nullAddress, + DAI: ADDRESSES.ethereum.DAI, + BAT: ADDRESSES.ethereum.BAT, + RETH: ADDRESSES.ethereum.RETH, + LINK: ADDRESSES.ethereum.LINK, + WBTC: ADDRESSES.ethereum.WBTC, + MATIC: ADDRESSES.ethereum.MATIC, + WSTETH: ADDRESSES.ethereum.WSTETH } module.exports = { diff --git a/projects/demeter.js b/projects/demeter.js index 0940ea564a1..84a329748b9 100644 --- a/projects/demeter.js +++ b/projects/demeter.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('./helper/coreAssets.json') const { sumTokensExport } = require('./helper/unwrapLPs') @@ -5,7 +6,7 @@ const config = { heco: { markets: [ [ - "0xa71EdC38d189767582C38A3145b5873052c3e47a", + ADDRESSES.heco.USDT, "0x8d8fD8139CEaf0034A021E6eb039bB6f70C83d9c" ], [ @@ -21,7 +22,7 @@ const config = { "0x59a626a783A9C071fDcEFC95B3664a34d0592e24" ], [ - "0x5545153CCFcA01fbd7Dd11C0b23ba694D9509A6F", + ADDRESSES.heco.WHT, "0xDA77B5663a0baFa56080Ae5D0a1F462848465b14" ], [ @@ -73,23 +74,23 @@ const config = { bsc: { markets: [ [ - "0x55d398326f99059fF775485246999027B3197955", + ADDRESSES.bsc.USDT, "0x89bB17aF665Ec0607268C697Bb294117992027Cf" ], [ - "0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56", + ADDRESSES.bsc.BUSD, "0xB275b6AE294159278547297dBE7617f66A7bC6e2" ], [ - "0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c", + ADDRESSES.bsc.BTCB, "0x6c9FcBD7aD9dFB241f4fA2cc08FaABb42d764606" ], [ - "0x2170Ed0880ac9A755fd29B2688956BD959F933F8", + ADDRESSES.bsc.ETH, "0x4A345187BFAe9A14DA764C2222c4B7E816C18216" ], [ - "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c", + ADDRESSES.bsc.WBNB, "0x5C4E2B1E6E03cCF5F3c3356C008a69C7f93BD10B" ], [ diff --git a/projects/dev.js b/projects/dev.js index ebb05389af7..1f02f198ea5 100644 --- a/projects/dev.js +++ b/projects/dev.js @@ -3,52 +3,16 @@ const sdk = require("@defillama/sdk") const ADDRESS_CONFIG_ADDRESS = '0x1D415aa39D647834786EB9B5a333A50e9935b796' const TOKEN_ADDRESS = '0x5cAf454Ba92e6F2c929DF14667Ee360eD9fD5b26' -const ADDRESS_CONFIG_ABI = [ - { - constant: true, - inputs: [], - name: 'lockup', - outputs: [ - { - internalType: 'address', - name: '', - type: 'address', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, -] - -const LOCKUP_ABI = [ - { - constant: true, - inputs: [], - name: 'getAllValue', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, -] - async function staking(ts, block) { const { output: lockupAddress } = await sdk.api.abi.call({ block, target: ADDRESS_CONFIG_ADDRESS, - abi: ADDRESS_CONFIG_ABI.find(i => i.name === 'lockup') + abi: 'address:lockup' }) const { output: allValue } = await sdk.api.abi.call({ block, target: lockupAddress, - abi: LOCKUP_ABI.find(i => i.name === 'getAllValue') + abi: 'uint256:getAllValue' }) return { [TOKEN_ADDRESS]: allValue diff --git a/projects/dhedge.js b/projects/dhedge.js index c43968de11d..e4364d3f880 100644 --- a/projects/dhedge.js +++ b/projects/dhedge.js @@ -1,64 +1,99 @@ -const utils = require('./helper/utils'); -const { GraphQLClient, gql } = require('graphql-request'); - -/* * * * * * * * - * ==> Correct adapter needs to be created. - * - *****************/ - -const STATS_URL = 'https://us-central1-dh-alpha.cloudfunctions.net/stats'; - -async function fetch() { - var totalTvl = await utils.fetchURL(STATS_URL); - return totalTvl.data.protocolStats.totalAssetUnderManagement; -} - -async function ethereum() { - var totalTvl = await utils.fetchURL(STATS_URL); - return totalTvl.data.protocolStats.ethereum.totalAumEthereum; -} - -async function polygon() { - var totalTvl = await utils.fetchURL(STATS_URL); - return totalTvl.data.protocolStats.polygon.totalAumPolygon; -} - -async function optimism() { - var totalTvl = await utils.fetchURL(STATS_URL); - return totalTvl.data.protocolStats.optimism.totalAumOptimism; -} - -async function staking() { - var endpoint = 'https://api.thegraph.com/subgraphs/name/dhedge/dht-staking'; - var graphQLClient = new GraphQLClient(endpoint); - - var query = gql` - { - stakingContracts { - id - balance - } - } - `; - - const data = await graphQLClient.request(query); - const balance = data.stakingContracts[0].balance; +/* *** Common config *** */ +const { sliceIntoChunks } = require("@defillama/sdk/build/util"); + +const DHEDGE_FACTORY_PROXIES = { + ethereum: "0x03D20ef9bdc19736F5e8Baf92D02C8661a5941F7", + polygon: "0xfdc7b8bFe0DD3513Cc669bB8d601Cb83e2F69cB0", + optimism: "0x5e61a079A178f0E5784107a4963baAe0c5a680c6", +}; + +/* *** dHEDGE V1 *** */ + +const DHEDGE_V1_VAULTS_QUANTITY_ABI = + "function deployedFundsLength() view returns (uint256)"; +const DHEDGE_V1_VAULTS_ABI = + "function deployedFunds(uint256) view returns (address)"; +const DHEDGE_V1_TVL_ABI = "function totalFundValue() view returns (uint256)"; + +const getV1TotalValueLocked = async (_, __, ___, { api, chain }) => { + const target = DHEDGE_FACTORY_PROXIES[chain]; + const vaults = await api.fetchList({ lengthAbi: DHEDGE_V1_VAULTS_QUANTITY_ABI, itemAbi: DHEDGE_V1_VAULTS_ABI, target, }); + const vaultsValues = await api.multiCall({ abi: DHEDGE_V1_TVL_ABI, calls: vaults, permitFailure: true, }); + const totalValueLocked = vaultsValues.reduce((acc, value) => acc + +(value ?? 0), 0); return { - 'dhedge-dao': balance / 10 ** 18 + tether: totalValueLocked / 1e18, + }; +}; + +/* *** dHEDGE V2 *** */ + +const DHEDGE_V2_VAULTS_ABI = + "function getDeployedFunds() view returns (address[])"; +const DHEDGE_V2_VAULT_SUMMARY_ABI = + "function getFundSummary() view returns (tuple(string name, uint256 totalSupply, uint256 totalFundValue))"; + +const tvl = async (_, __, ___, { api, chain }) => { + const target = DHEDGE_FACTORY_PROXIES[chain]; + const vaults = await api.call({ abi: DHEDGE_V2_VAULTS_ABI, target, }) + let chunkSize = chain === 'optimism' ? 42 : 51 // Optimism has a lower gas limit + const vaultChunks = sliceIntoChunks(vaults, chunkSize); + const summaries = []; + for (const chunk of vaultChunks) { + summaries.push(...await api.multiCall({ abi: DHEDGE_V2_VAULT_SUMMARY_ABI, calls: chunk, permitFailure: true, })) } -} + const totalValueLocked = summaries.reduce((acc, vault) => acc + +(vault?.totalFundValue ?? 0), 0); + return { + tether: totalValueLocked / 1e18, + }; +}; + +/* *** DHT Staking V1 *** */ + +const DHT_STAKING_V1_PROXY = "0xEe1B6b93733eE8BA77f558F8a87480349bD81F7f"; +const DHT_ON_MAINNET = "0xca1207647Ff814039530D7d35df0e1Dd2e91Fa84"; + +const getV1StakingTotalAmount = async (_, __, ___, { api }) => ({ + [DHT_ON_MAINNET]: await api.call({ + abi: "erc20:balanceOf", + target: DHT_ON_MAINNET, + params: [DHT_STAKING_V1_PROXY], + }), +}); + +/* *** DHT Staking V2 *** */ + +const DHT_STAKED_ABI = "function dhtStaked() view returns (uint256)"; +const DHT_STAKING_V2_PROXY = "0xf165ca3d75120d817b7428eef8c39ea5cb33b612"; +const DHT_ON_OPTIMISM = "optimism:0xaf9fe3b5ccdae78188b1f8b9a49da7ae9510f151"; + +const getV2StakingTotalAmount = async (_, __, ___, { api }) => ({ + [DHT_ON_OPTIMISM]: await api.call({ + abi: DHT_STAKED_ABI, + target: DHT_STAKING_V2_PROXY, + }), +}); + +/* *** Exports *** */ module.exports = { ethereum: { - fetch: ethereum, - staking, + tvl: getV1TotalValueLocked, + staking: getV1StakingTotalAmount, }, polygon: { - fetch: polygon, + tvl, }, optimism: { - fetch: optimism, + tvl, + staking: getV2StakingTotalAmount, }, - fetch, + misrepresentedTokens: true, + methodology: "Aggregates total value of each dHEDGE vault ever created", + hallmarks: [ + [1627693200, "dHEDGE V2 Launch"], + [1639616400, "Optimism Launch"], + [1674003600, "Optimism Incentives Start"], + [1679965200, "DHT Staking V2 Release"], + ], }; diff --git a/projects/dracula.js b/projects/dracula.js index 0d9934d5d98..d1fce2a21b4 100644 --- a/projects/dracula.js +++ b/projects/dracula.js @@ -1,20 +1,10 @@ const { staking } = require("./helper/staking"); -// const utils = require("./helper/utils"); - -// async function fetch() { -// var tvl = 0; -// var staked = await utils.fetchURL("https://dracula.sucks/api-v2.1/stats"); -// staked.data.victimPools.map((pool) => { -// tvl += pool.tvl; -// }); -// return tvl; -// } module.exports = { hallmarks: [ [Math.floor(new Date('2022-03-17')/1e3), 'DRACULA is for now fully focused on it\'s Metaverse product'], ], - methodology: 'DRACULA is for now fully focused on it\'s Metaverse product', + methodology: 'Tokens staked on 0xC8DFD57E82657f1e7EdEc5A9aA4906230C29A62A', ethereum: { tvl: () => ({}), staking: staking('0xC8DFD57E82657f1e7EdEc5A9aA4906230C29A62A', '0xb78b3320493a4efaa1028130c5ba26f0b6085ef8'), diff --git a/projects/drift.js b/projects/drift.js index 333d9fa3204..bc0d8dc90df 100644 --- a/projects/drift.js +++ b/projects/drift.js @@ -1,20 +1,48 @@ -const { sumTokens2 } = require('./helper/solana') - -async function tvl() { - return sumTokens2({ - tokenAccounts: [ - '6W9yiHDCW9EpropkFV8R3rPiL8LVWUHSiys3YeW6AT6S', - 'Bzjkrm1bFwVXUaV9HTnwxFrPtNso7dnwPQamhqSxtuhZ', - 'GXWqPpjQpdz7KZw9p7f5PX2eGxHAhvpNXiviFkAB8zXg', - 'DfYCNezifxAEsQbAJ1b3j6PX3JVBe8fu11KBhxsbw5d2', - ] - }) -} +const { PublicKey } = require("@solana/web3.js"); +const anchor = require("@project-serum/anchor"); +const { sumTokens2, } = require("./helper/solana"); +const DRIFT_PROGRAM_ID = new PublicKey('dRiftyHA39MWEi3m9aunc5MzRF1JYuBsbn6VPcn33UH') +const { getConfig } = require('./helper/cache') module.exports = { timetravel: false, - methodology: "Calculate the USDC on 6W9yiHDCW9EpropkFV8R3rPiL8LVWUHSiys3YeW6AT6S through on-chain calls & add the USDC on Bzjkrm1bFwVXUaV9HTnwxFrPtNso7dnwPQamhqSxtuhZ which is the insurance fund for liquidations", + methodology: "Calculate sum across all program token accounts", solana: { - tvl + tvl, + }, +}; + +async function tvl(_, _b, _cb, { api, }) { + + const legacyVaults = [ + '6W9yiHDCW9EpropkFV8R3rPiL8LVWUHSiys3YeW6AT6S', // legacy usdc vault + 'Bzjkrm1bFwVXUaV9HTnwxFrPtNso7dnwPQamhqSxtuhZ', // legacy usdc insurance fund + ]; + const getSpotMarketVaultPublicKey = marketIndex => getVaultPublicKey('spot_market_vault', marketIndex) + const getInsuranceFundVaultPublicKey = marketIndex => getVaultPublicKey('insurance_fund_vault', marketIndex) + let configFile = await getConfig('drift-config', 'https://raw.githubusercontent.com/drift-labs/protocol-v2/master/sdk/src/constants/spotMarkets.ts') + const marketIndices = []; + configFile = configFile.slice(configFile.indexOf('MainnetSpotMarkets:')) + + const regex = /marketIndex:\s*(\d+),/g + let match; + while ((match = regex.exec(configFile))) { + marketIndices.push(parseInt(match[1])); } + + const vaults = [ + ...legacyVaults, + ...marketIndices.map(getSpotMarketVaultPublicKey), + ...marketIndices.map(getInsuranceFundVaultPublicKey), + ] + + return sumTokens2({ tokenAccounts: vaults }) +} + +function getVaultPublicKey(seed, marketIndex) { + return PublicKey.findProgramAddressSync( + [ + Buffer.from(anchor.utils.bytes.utf8.encode(seed)), + new anchor.BN(marketIndex).toArrayLike(Buffer, 'le', 2), + ], DRIFT_PROGRAM_ID)[0].toBase58() } diff --git a/projects/duneswap.js b/projects/duneswap.js index 39c52886276..7888adc96fe 100644 --- a/projects/duneswap.js +++ b/projects/duneswap.js @@ -1,6 +1,6 @@ const { getUniTVL } = require('./helper/unknownTokens') module.exports = { oasis: { - tvl: getUniTVL({ factory: '0x9dd422B52618f4eDD13E08c840f2b6835F3C0585', chain: 'oasis', useDefaultCoreAssets: true }), + tvl: getUniTVL({ factory: '0x9dd422B52618f4eDD13E08c840f2b6835F3C0585', useDefaultCoreAssets: true }), } } \ No newline at end of file diff --git a/projects/edgeprotocol.js b/projects/edgeprotocol.js index e5ae89fdf17..8900b3ba435 100644 --- a/projects/edgeprotocol.js +++ b/projects/edgeprotocol.js @@ -1,51 +1,22 @@ -const { request, gql } = require("graphql-request"); - -function getCoinGeckoId(apiId) { - return { - 'terra14z56l0fp2lsf86zy3hty2z47ezkhnthtr9yq76': 'anchor-protocol', - 'terra15gwkyepfc6xgca5t5zefzwy42uts8l2m4g40k6': 'mirror-protocol', - 'terra17y9qkl8dfkeg4py7n0g5407emqnemc3yqk5rup': 'stader-lunax', - 'terra1hzh9vpxhsk8253se0vv5jj6etdvxu3nv8z07zu': 'anchorust', - 'terra1kc87mu460fwkqte29rquh4hc20m54fxwtsx7gp': 'bonded-luna', - 'uluna': 'terra-luna', - 'uusd': 'terrausd' - }[apiId] -}; - -const graphUrl = `https://mantle.terra.dev/` -const query = gql` -query ($poolQuery: String!) { - markets: WasmContractsContractAddressStore( - ContractAddress: "terra1pcxwtrxppj9xj7pq3k95wm2zztfr9kwfkcgq0w" - QueryMsg: $poolQuery - ) { - Result - }, -} -` +const { queryContract, } = require('./helper/chain/cosmos') async function getMarkets() { - const { markets: { Result } } = await request(graphUrl, query, { poolQuery: JSON.stringify({ market_lists: {} }) }) - return Result + const res = await queryContract({ contract: 'terra1pcxwtrxppj9xj7pq3k95wm2zztfr9kwfkcgq0w', data: { market_lists: {} }, chain: 'terra' }) + return res } - -async function tvl() { - const balances = {}; +async function tvl(_, _1, _2, { api }) { const markets = await getMarkets() - JSON.parse(markets).forEach(m => { - balances[getCoinGeckoId(m.underlying)] = (m.total_credit - m.total_insurance) / 10 ** 6; + markets.forEach(m => { + api.add(m.underlying, Math.floor(m.total_credit - m.total_insurance)) }); - return balances; -}; +} -async function borrowed() { - const balances = {}; +async function borrowed(_, _1, _2, { api }) { const markets = await getMarkets() - JSON.parse(markets).forEach(m => { - balances[getCoinGeckoId(m.underlying)] = m.total_loan / 10 ** 6; + markets.forEach(m => { + api.add(m.underlying, Math.floor(m.total_loan)) }); - return balances; -}; +} module.exports = { timetravel: false, @@ -54,7 +25,7 @@ module.exports = { tvl, borrowed }, - hallmarks:[ - [1651881600, "UST depeg"], - ] + hallmarks: [ + [1651881600, "UST depeg"], + ] }; diff --git a/projects/energiswap.js b/projects/energiswap.js index 5af3e7c9e6f..9015e4e6c96 100644 --- a/projects/energiswap.js +++ b/projects/energiswap.js @@ -3,7 +3,6 @@ const { getUniTVL } = require('./helper/unknownTokens') module.exports = { energi: { tvl: getUniTVL({ - chain: 'energi', factory: '0x875aDBaF8109c9CC9AbCC708a42607F573f594E4', useDefaultCoreAssets: true, }), diff --git a/projects/ergodex.js b/projects/ergodex.js index c58c8445d8e..46776b2495b 100644 --- a/projects/ergodex.js +++ b/projects/ergodex.js @@ -1,16 +1,24 @@ +const { sumTokensExport } = require('./helper/chain/ergo') const utils = require('./helper/utils'); -const {toUSDTBalances} = require('./helper/balances') -async function tvl() { - var totalTvl = await utils.fetchURL('https://api.spectrum.fi/v1/amm/platform/stats'); - return toUSDTBalances(totalTvl.data.tvl.value/100); +async function cardanoTVL() { + let response = await utils.fetchURL('https://analytics.spectrum.fi/cardano/pools/overview?after=0') + let data = response.data; + + let totalTvl = 0; + for(let i=0; i ({ target: t })) - const { output: token } = await sdk.api.abi.multiCall({ - block, - calls, - abi: abis['VaultBaseline'].find(i => i.name === 'token') - }) - const { output: balance } = await sdk.api.abi.multiCall({ - block, - calls, - abi: abis['VaultBaseline'].find(i => i.name === 'balance') - }) - - const balances = {} - token.forEach((t, i) => sdk.util.sumSingleBalance(balances, t.output, balance[i].output)) - return balances +const { sumTokens2 } = require('./helper/unwrapLPs') + +const abis = { + balance: "uint256:balance", + token: "address:token", +} + +const vaults = { + "VaultBaselineUSDT": "0x54bE9254ADf8D5c8867a91E44f44c27f0c88e88A", + "VaultBaselinewBTC": "0x1a389c381a8242B7acFf0eB989173Cd5d0EFc3e3", + "VaultBaselinewETH": "0x1E9DC5d843731D333544e63B2B2082D21EF78ed3", + "VaultBaselineDAI": "0x163D457fA8247f1A9279B9fa8eF513de116e4327", + "VaultBaselineUNI-V2[WBTC]": "0x743BC5cc8F52a84fF6e06E47Bc2af5324f5463D6", + /* "VaultBaselinerenBTC": "0xB0B3442b632175B0b7d9521291c51060722C4e8C", + "VaultBaselineTUSD": "0xa322AEa77769666453377CC697fbE4C6390b9942", + "VaultBaselineyCRV": "0x5e7B4de4aC8e319fB2ec4bF9Fa98192346f8C99B", + "VaultBaselinesBTC": "0x681D3261CC6d2A18b59f8B53219b96F06BcEeB69", + "VaultBaselineUSDC": "0x3f7E3d82bdDc28d3Eb04F0d0A51e9Fc82db581f0", + "VaultBaselineyDAI": "0x79A2e8C1120d6B5fBfaBD3f7a39CF8473A635742", + "VaultBaselinecrvBTC": "0x483A47247d5cBd420A9c5d2838Ec89776ba8B56B", + "VaultBaselineOKB": "0x272C8dF3E8068952606046c1389fc1e2320FCCfd", + "VaultBaselinecrvRenWBTC": "0x10d0A001EeDC62b2A483EB9DFA0bb021aC61d55b", + "VaultBaselinecrvRenWSBTC": "0x483A47247d5cBd420A9c5d2838Ec89776ba8B56B", */ +} + +async function tvl(ts, block, _, { api }) { + const contracts =Object.values(vaults) + const tokens = await api.multiCall({ abi: abis.token, calls: contracts}) + const bals = await api.multiCall({ abi: abis.balance, calls: contracts}) + api.addTokens(tokens, bals) } module.exports = { diff --git a/projects/fortunedao.js b/projects/fortunedao.js index e98cd57bd7f..7cfc8f44864 100644 --- a/projects/fortunedao.js +++ b/projects/fortunedao.js @@ -1,7 +1,8 @@ +const ADDRESSES = require('./helper/coreAssets.json') const { ohmTvl } = require('./helper/ohm') module.exports=ohmTvl("0xC8F249cDCDCBBa52d0908Dd201F20Af926710a9c", [ ["0xF2001B145b43032AAF5Ee2884e456CCd805F677D", false], ["0x88ef5a29eEc8BAAAb8c1111A57Ad2FCeC8aD6109", true], ], "cronos", "0xAFfB721B859db8300F7a13d8E80E7b74845Fe47a", "0xcA558149225Fb386B9c26716e8C35a650C74d35e", -()=>"0x6b175474e89094c44da98b954eedeac495271d0f", undefined, false) +()=>ADDRESSES.ethereum.DAI, undefined, false) diff --git a/projects/fountain.js b/projects/fountain.js index d09f8177f6e..e74cbdb5832 100644 --- a/projects/fountain.js +++ b/projects/fountain.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('./helper/coreAssets.json') const { compoundExports } = require("./helper/compound"); module.exports = { @@ -7,7 +8,7 @@ module.exports = { '0xA7684aE7e07Dac91113900342b3ef25B9Fd1D841', 'oasis', '0xD7d588bAbFb99E82Cd6dd0cA7677A5599AA678B5', - '0x21C718C22D52d0F3a789b752D4c2fD5908a8A733', + ADDRESSES.oasis.wROSE, ) }, }; // node test.js projects/fountain.js \ No newline at end of file diff --git a/projects/fractional-art.js b/projects/fractional-art.js index 79f5d13d103..d607a5bc109 100644 --- a/projects/fractional-art.js +++ b/projects/fractional-art.js @@ -1,187 +1,56 @@ -const sdk = require("@defillama/sdk"); -const { BigNumber } = require("bignumber.js"); -const utils = require('./helper/utils'); - - -// Retrieve needed vaults attributes from REST API -const fractional_api_url = 'https://mainnet-api.fractional.art/vaults?perPage=12' // &page=1' -async function retrieveVaultsAPI() { - // Get page count - const page1 = await utils.fetchURL(fractional_api_url + '&page=1') - let pageCount = page1.data.metadata.pagination.totalPages; - //pageCount = 1 // uncomment for for debug - - const vaults = [] - let openedVaultsCount = 0 - for (let i = 0; i < pageCount; i++) { - let vaults_i = await utils.fetchURL(fractional_api_url + `&page=${i+1}`) - // Filter out unwanted attributes: keep analytics.tvlUsd, pools, contractAddress, symbol, slug, collectables - vaults_i = vaults_i.data.data.map(({ analytics, pools, contractAddress, symbol, slug, collectables, isClosed, tokenAddress }) => ({analytics, pools, contractAddress, symbol, slug, collectables, isClosed, tokenAddress})) - - // Note : Could filter out closed vaults, but their tokens can still be provided to pools, so not filtering - openedVaultsCount += vaults_i.filter(vault => !vault.isClosed).length +const { getLogs } = require('./helper/cache/getLogs') +const { sumTokens2 } = require('./helper/unwrapLPs') +const { isArtBlocks } = require('./helper/nft') + +async function tvl(_, _b, _cb, { api, }) { + const factory = '0x85aa7f78bdb2de8f3e0c0010d99ad5853ffcfc63' + const logs = await getLogs({ + api, + target: factory, + topics: ['0xf9c32fbc56ff04f32a233ebc26e388564223745e28abd8d0781dd906537f563e'], + eventAbi: 'event Mint (address indexed token, uint256 id, uint256 price, address vault, uint256 vaultId)', + onlyArgs: true, + fromBlock: 12743932, + }) + const artBlockOwners = [] + const tokensAndOwners = logs.map(log => [log.token, log.vault]).filter(([token, vault]) => { + if (isArtBlocks(token)) { + artBlockOwners.push(vault) + return false + } + return true + }) - // Append to complete vaults array - vaults.push(...vaults_i) - } - return {vaults, openedVaultsCount} -} + await sumTokens2({ api, owners: artBlockOwners, resolveArtBlocks: true, }) -// This API returns a list of vaults similar to the following exampleVaultDebug -function exampleVaultDebug() { - return { - "symbol": "DOG", - "contractAddress": "0xbaac2b4491727d78d2b78815144570b9f2fe8899", - "pools": [ { - "pool": "0x7731CA4d00800b6a681D031F565DeB355c5b77dA", - "tokens": ["0xBAac2B4491727D78D2b78815144570b9f2Fe8899", "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"], - "provider": "UNISWAP_V3" - }], - "tokenAddress": "0xabEFBc9fD2F806065b4f3C237d4b59D9A97Bcac7", - "analytics": { - "tvlUsd": 21790624 - }, - "slug": "the-doge-nft", - "isClosed": false, - } + return sumTokens2({ + api, tokensAndOwners, blacklistedTokens: [ + '0x9ef27de616154ff8b38893c59522b69c7ba8a81c', + '0x57f1887a8BF19b14fC0dF6Fd9B2acc9Af147eA85', + ] + }) } - -// Get Fractional.art TVL -async function tvl(timestamp, block, chainBlocks, chain) { - // Get vaults and Compute vaults TVL (trusting fractional rest api) - const {vaults, openedVaultsCount} = await retrieveVaultsAPI() - const vaulstTVL_api = getVaultsTvlApi(vaults) - // note: vault with slug fractional-dream-930 has null analytics and symbol, because it is an ERC1155 not listed on any DEXes - - // Or try to find all pools associated to vault and account for tokens locked against vault token - // In pool: provider, pool, tokens - const univ2_sushiv1_pools = [] - const univ3_pools = [] - let token0; - let token1; - vaults.forEach(vault => { - vault.pools.forEach(pool => { - token0 = pool.tokens[0]; - token1 = pool.tokens[1]; - // Swap token0 and token1 if needed so token0 is always vault token - if (vault.contractAddress.toLowerCase() === token1.toLowerCase()) { - const tmp = token1 - token1 = token0; - token0 = tmp; - } - // Pool provider can be any of ['UNISWAP_V3', 'SUSHISWAP_V1', 'UNISWAP_V2'] - const provider = pool.provider - if ((provider === 'UNISWAP_V2') || (provider === 'SUSHISWAP_V1')) { - univ2_sushiv1_pools.push(pool) - } else if (provider === 'UNISWAP_V3') { - univ3_pools.push(pool) - } - }) +async function tvlLPDA(_, _b, _cb, { api, }) { + const factory = '0x32e8ab1e243d8d912a5ae937635e07e7e451d2ae' + const logs = await getLogs({ + api, + target: factory, + topics: ['0x4a08e09eb1f4b221a4d4faff944c52d3bb85486dd0f7e647977d35b406e16e43'], + eventAbi: 'event CreatedLPDA(address indexed vault, address indexed token, uint256 _id, tuple(uint32 startTime, uint32 endTime, uint64 dropPerSecond, uint128 startPrice, uint128 endPrice, uint128 minBid, uint16 supply, uint16 numSold, uint128 curatorClaimed, address curator) _lpdaInfo)', + onlyArgs: true, + fromBlock: 16125170, }) - // Concat v2 and v3 pools - const v2_v3_pools = univ3_pools.concat(univ2_sushiv1_pools) - - // Retrieve balances from onchain calls - let balances = {} - - // Get UNISWAP_V3 LPs - // Simply get amount of token0 and token1 allocated to pool contract. And since we only need the token1 it is even more efficient - const calls_v3_v2_t0_t1 = v2_v3_pools.map((pool) => ({ - target: token1, - params: pool.pool - })) - /* - const calls_v3_t1 = univ3_pools.map((pool) => ({ // 33.67 // 20.69 - target: pool.token1, - params: pool.pool - })) - const calls_v3_t0_t1 = univ3_pools.map((pool) => ({ // 69.12 // 20.69 univ2_sushiv1_pools - target: pool.token1, - params: pool.pool - })).concat(univ3_pools.map((pool) => ({ - target: pool.token0, - params: pool.pool - }))) - */ - const poolBalance = await sdk.api.abi.multiCall({ - block, - calls: calls_v3_v2_t0_t1, // calls_v3_t0_t1 - abi: 'erc20:balanceOf' + return sumTokens2({ + api, tokensAndOwners: logs.map(log => [log.token, log.vault]), blacklistedTokens: [ + '0x9ef27de616154ff8b38893c59522b69c7ba8a81c', + ], }) - balances = {} - sdk.util.sumMultiBalanceOf(balances, poolBalance) - - // Remove vaults tokens balances as they should not account for TVL. - // TODO: Choose if we remove the vaults tokens from pooled balances or not - - return balances -} - -// Using fractional REST API, a TVL is returned in USD, stored as USDC -function getVaultsTvlApi(vaults) { - return vaults.reduce((acc, vault) => acc.plus(BigNumber(vault.analytics ? vault.analytics.tvlUsd : 0)), BigNumber(0)) -} - -const usdc = '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48' -async function tvl_api(timestamp, block, chainBlocks, chain) { - const {vaults, openedVaultsCount} = await retrieveVaultsAPI() - return {[usdc]: getVaultsTvlApi(vaults).times(1e6)} } module.exports = { - ethereum: { tvl }, - methodology: `TVL is the total quantity of tokens held in LPs against any vault token. Each vault has a token, which is provided as LP in several pools returned by fractional REST API. Do not account for vault token locked in pools as contributing to TVL.` -} - - - -// ------------ -// Alternatives -// ------------ - -// 1. COULD USE unwrapUniswapLPs with lpPositions set to erc20:totalSupply of pool but does not work for uni_v3 -/* - // Get UNISWAP_V2 and SUSHISWAP_V1 LPs - // Call unwrapUniswapLPs with lpPositions set to totalSupply of LP token. So you unwrap the whole pool without needing to pull reserves of token1 - only pull totalSupply of LP token - const univ2_sushiv1_pairAddresses = univ2_sushiv1_pools.map(p => p.pool) - const univ3_pairAddresses = univ3_pools.map(p => p.pool) - const lpSupply = (await sdk.api.abi.multiCall({ - block, - abi: 'erc20:totalSupply', - calls: univ2_sushiv1_pairAddresses.map(address=>({ // cannot retrieve uni_v3 balances - target: address - })), - chain - })).output - // Format the way unwrapUniswapLPs function requires the token/balance pairs - const lpPositions = lpSupply.map(call => ({ - token: call.input.target, - balance: call.output - })) - // Accumulate to balances - await unwrapUniswapLPs(balances, lpPositions, block, chain=chain) - */ - -// 2. COULD USE staking contract, but too slow to retrieve call by call the amount of tokens -/* -const { staking } = require("./helper/staking.js"); -balances = {} -for (const pool of v2_v3_pools) { // univ3_pools - const token1_locked = staking(pool.pool, pool.token1, chain="ethereum") - token1_pool_balance = await token1_locked(timestamp, block, chainBlocks) - - sdk.util.sumSingleBalance(balances, pool.token1, token1_pool_balance[pool.token1]); - // sdk.util.sumMultiBalanceOf(balances, [token1_pool_balance], true); + ethereum: { tvl: tvl }, + methodology: `TVL is value of nfts in the vaults` } -*/ -// 3. COULD USE core/index.js functions to get TL locked in given Uniswap pools, but too much to copy-paste from ./CORE/INDEX.JS -/* -const {getUniswapPairInfo, getPairUnderlyingReserves, flattenUnderlyingReserves} = require('./core/index.js'); -Would need to copy-paste these functions are export them by module -const pairInfo = await getUniswapPairInfo(univ2_sushiv1_pairAddresses, timestamp, block); -const underlyingReserves = await Promise.all(pairInfo.map(info => getPairUnderlyingReserves(info, timestamp, block))); -let balances = flattenUnderlyingReserves(underlyingReserves); -*/ diff --git a/projects/gainsNetwork.js b/projects/gainsNetwork.js index 5c8bbb722a1..25ddb327f6a 100644 --- a/projects/gainsNetwork.js +++ b/projects/gainsNetwork.js @@ -1,58 +1,50 @@ -const { transformPolygonAddress } = require('./helper/portedTokens'); -const sdk = require('@defillama/sdk'); -const { staking } = require('./helper/staking'); - -const contracts = [ - '0x151757c2E830C467B28Fe6C09c3174b6c76aA0c5', - '0x203F5c9567d533038d2da70Cbc20e6E8B3f309F9', - '0x176586Dec2b70df5B72a6Efe158a87f210551798', - '0xaee4d11a16B2bc65EDD6416Fb626EB404a6D65BD', - '0xd7052EC0Fe1fe25b20B7D65F6f3d490fCE58804f' -]; +const ADDRESSES = require('./helper/coreAssets.json') +const { pool2 } = require("./helper/pool2"); +const { staking } = require("./helper/staking"); +const { sumTokens2 } = require("./helper/unwrapLPs"); const tokens = { - DAI: '0x8f3cf7ad23cd3cadbd9735aff958023239c6a063', - dQUICK: '0xf28164a485b0b2c90639e47b0f377b4a438a16b1' -}; - -async function tvl(timestamp, block, chainBlocks) { - const transform = await transformPolygonAddress(); - const balances = {}; - block = chainBlocks.polygon; - - const DAIbalance = (await sdk.api.abi.multiCall({ - calls: contracts.map((c) => ({ - target: tokens.DAI, - params: c - })), - abi: "erc20:balanceOf", - block, - chain: 'polygon' - })).output.reduce((a, b) => Number(a) + Number(b.output), 0); - - const dQUICKbalance = (await sdk.api.abi.multiCall({ - calls: contracts.map((c) => ({ - target: tokens.dQUICK, - params: c - })), - abi: "erc20:balanceOf", - block, - chain: 'polygon' - })).output.reduce((a, b) => Number(a) + Number(b.output), 0); - - return { - [transform(tokens.DAI)]: DAIbalance, - [transform(tokens.dQUICK)]: dQUICKbalance - }; + polygon: { + DAI: ADDRESSES.polygon.DAI, + dQUICK: "0xf28164a485b0b2c90639e47b0f377b4a438a16b1", + }, + arbitrum: { + DAI: ADDRESSES.optimism.DAI, + }, }; +async function polyTvl(_, _b, _cb, { api }) { + const tokensAndOwners = [ + [tokens.polygon.dQUICK, "0x151757c2E830C467B28Fe6C09c3174b6c76aA0c5"], + [tokens.polygon.dQUICK, "0x203F5c9567d533038d2da70Cbc20e6E8B3f309F9"], + [tokens.polygon.DAI, "0xaee4d11a16B2bc65EDD6416Fb626EB404a6D65BD"], + [tokens.polygon.DAI, "0xd7052EC0Fe1fe25b20B7D65F6f3d490fCE58804f"], + [tokens.polygon.DAI, "0x91993f2101cc758D0dEB7279d41e880F7dEFe827"], + ]; + return sumTokens2({ api, tokensAndOwners }); +} +async function arbiTvl(_, _b, cb) { + const tokensAndOwners = [ + [tokens.arbitrum.DAI, "0xd85E038593d7A098614721EaE955EC2022B9B91B"], + ]; + return sumTokens2({ chain: "arbitrum", tokensAndOwners }); +} // node test.js projects/gainsNetwork.js -module.exports={ - polygon: { - tvl, - pool2: staking( - '0x33025b177A35F6275b78f9c25684273fc24B4e43', - '0x6e53cb6942e518376e9e763554db1a45ddcd25c4', - 'polygon') - } -}; \ No newline at end of file +module.exports = { + hallmarks: [ + [1672531200,"Launch on Arbitrum"] + ], + polygon: { + tvl: polyTvl, + pool2: pool2( + "0x33025b177A35F6275b78f9c25684273fc24B4e43", + "0x6e53cb6942e518376e9e763554db1a45ddcd25c4", + "polygon", + ), + staking: staking('0xfb06a737f549eb2512eb6082a808fc7f16c0819d', '0xE5417Af564e4bFDA1c483642db72007871397896'), + }, + arbitrum: { + tvl: arbiTvl, + staking: staking('0x6b8d3c08072a020ac065c467ce922e3a36d3f9d6', '0x18c11fd286c5ec11c3b683caa813b77f5163a122'), + }, +}; diff --git a/projects/gdao.js b/projects/gdao.js index f4c19f687e9..df31a6e9504 100644 --- a/projects/gdao.js +++ b/projects/gdao.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('./helper/coreAssets.json') const { sumTokens } = require('./helper/unwrapLPs'); const { staking } = require('./helper/staking'); @@ -5,14 +6,14 @@ const liquidityMinesAddress = '0x4DaC3e07316D2A31baABb252D89663deE8F76f09'; const loyaltyMineAddress = '0xda58927f4065f1d02a6ea850c2aac49d7362a643'; const stakedTokens = [ - '0x514910771af9ca656af840dff83e8264ecf986ca', //link - '0x1f9840a85d5af5bf1d1762f925bdaddc4201f984', //uni - '0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9', //aave - '0x2260fac5e5542a773aa44fbcfedf7c193bc2c599', //wbtc - '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', //weth - '0xc011a73ee8576fb46f5e1c5751ca3b9fe0af2a6f', //snx - '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', //usdc - '0x0bc529c00C6401aEF6D220BE8C6Ea1667F6Ad93e', //yfi + ADDRESSES.ethereum.LINK, //link + ADDRESSES.ethereum.UNI, //uni + ADDRESSES.ethereum.AAVE, //aave + ADDRESSES.ethereum.WBTC, //wbtc + ADDRESSES.ethereum.WETH, //weth + ADDRESSES.ethereum.SNX, //snx + ADDRESSES.ethereum.USDC, //usdc + ADDRESSES.ethereum.YFI, //yfi ]; const GDAOLP = '0x4d184bf6f805ee839517164d301f0c4e5d25c374'; diff --git a/projects/gemkeeper.js b/projects/gemkeeper.js index a6718b8ce71..2e5f1b7d9fb 100644 --- a/projects/gemkeeper.js +++ b/projects/gemkeeper.js @@ -5,7 +5,7 @@ const BlingAddr = "0x72Ad551af3c884d02e864B182aD9A34EE414C36C" const wRoseBlingLP = "0xb29553faf847ba5b79b6ae13fa82d0b216faf626" module.exports = { oasis: { - tvl: getUniTVL({ factory: '0xa7200334f652425A12BF2f7e4F0F5409CCA4d963', chain: 'oasis', useDefaultCoreAssets: true }), + tvl: getUniTVL({ factory: '0xa7200334f652425A12BF2f7e4F0F5409CCA4d963', useDefaultCoreAssets: true }), staking: stakingPricedLP(xBlingContract,BlingAddr,"oasis",wRoseBlingLP,"oasis-network") } }; \ No newline at end of file diff --git a/projects/ginfinance.js b/projects/ginfinance.js index 48bdf9fa08f..c4e66281af7 100644 --- a/projects/ginfinance.js +++ b/projects/ginfinance.js @@ -1,6 +1,6 @@ const { getUniTVL } = require('./helper/unknownTokens') module.exports = { boba: { - tvl: getUniTVL({ factory: '0x06350499760aa3ea20FEd2837321a84a92417f39', chain: 'boba', useDefaultCoreAssets: true }), + tvl: getUniTVL({ factory: '0x06350499760aa3ea20FEd2837321a84a92417f39', useDefaultCoreAssets: true }), } }; \ No newline at end of file diff --git a/projects/goose.js b/projects/goose.js index c1731d9aef8..3f669731e78 100644 --- a/projects/goose.js +++ b/projects/goose.js @@ -12,5 +12,8 @@ async function fetch() { } module.exports = { + bsc: { + fetch + }, fetch } diff --git a/projects/gton.js b/projects/gton.js index 39bb4a95af9..c25c3e403f9 100644 --- a/projects/gton.js +++ b/projects/gton.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('./helper/coreAssets.json') const { sumTokensExport, nullAddress } = require("./helper/unwrapLPs"); const { staking } = require('./helper/staking') @@ -13,13 +14,13 @@ module.exports = { '0xddcb3ffd12750b45d32e084887fdf1aabab34239', '0x841fad6eae12c286d1fd18d1d525dffa75c7effe', '0x5cc61a78f164885776aa610fb0fe1257df78e59b', - '0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83', + ADDRESSES.fantom.WFTM, '0xb688e18f34e6e424c44b247318f22367ed7df3e2', - '0xdbf31df14b66535af65aac99c32e9ea844e14501', + ADDRESSES.fantom.renBTC, '0x1E4F97b9f9F913c46F1632781732927B9019C68b', '0x657A1861c15A3deD9AF0B6799a195a249ebdCbc6', '0xc3f069d7439baf6d4d6e9478d9cc77778e62d147', - '0x049d68029688eabf473097a2fc38ef61633a3c7a', + ADDRESSES.fantom.fUSDT, '0xf16e81dce15b08f326220742020379b855b87df9', ]}), staking: staking([stakingContract, treasury,], gton, chain), diff --git a/projects/gyro.js b/projects/gyro.js index 6264b6a20d7..d9818ba516c 100644 --- a/projects/gyro.js +++ b/projects/gyro.js @@ -1,8 +1,10 @@ +const ADDRESSES = require('./helper/coreAssets.json') const { ohmTvl } = require('./helper/ohm') module.exports=ohmTvl("0x8B1522402FECe066d83E0F6C97024248Be3C8c01", [ - ["0x55d398326f99059ff775485246999027b3197955", false], - ["0xe9e7cea3dedca5984780bafc599bd69add087d56", false], + [ADDRESSES.bsc.USDT, false], + [ADDRESSES.bsc.BUSD, false], ["0x5ca063a7e2bebefeb2bdea42158f5b825f0f9ffb", true], ["0xa5399084a5f06d308c4527517bbb781c4dce887c", true] -], "bsc", "0xe9c178cfdfeb917a46429714e5d51f6d4f296b75", "0x1b239abe619e74232c827fbe5e49a4c072bd869d") \ No newline at end of file +], "bsc", "0xe9c178cfdfeb917a46429714e5d51f6d4f296b75", "0x1b239abe619e74232c827fbe5e49a4c072bd869d") +module.exports.bsc.tvl = () => 0 \ No newline at end of file diff --git a/projects/hakka.js b/projects/hakka.js index 185a08f40dc..62d6a4117f4 100644 --- a/projects/hakka.js +++ b/projects/hakka.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('./helper/coreAssets.json') const { sumTokens2, nullAddress, sumTokensExport } = require('./helper/unwrapLPs') const HAKKA_ADDRESSES = { @@ -20,9 +21,9 @@ async function ethereum(_, block) { [nullAddress, thirdFloorAddress], // thirdFloor // guild bank [nullAddress, hakkaGuildBank], - ['0x9f8f72aa9304c8b593d555f12ef6589cc3a579a2', hakkaGuildBank], + [ADDRESSES.ethereum.MKR, hakkaGuildBank], ['0x35101c731b1548B5e48bb23F99eDBc2f5c341935', hakkaGuildBank], - ['0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', hakkaGuildBank], + [ADDRESSES.ethereum.USDC, hakkaGuildBank], ] return sumTokens2({ tokensAndOwners: toa, block, }) @@ -30,8 +31,8 @@ async function ethereum(_, block) { async function bsc(_, _b, { bsc: block }) { const chain = 'bsc' const toa = [ - ['0xe9e7cea3dedca5984780bafc599bd69add087d56', BSC_BHS_ADDRESS], // thirdFloor - ['0x55d398326f99059ff775485246999027b3197955', BSC_BHS_ADDRESS], // thirdFloor + [ADDRESSES.bsc.BUSD, BSC_BHS_ADDRESS], // thirdFloor + [ADDRESSES.bsc.USDT, BSC_BHS_ADDRESS], // thirdFloor ] return sumTokens2({ tokensAndOwners: toa, block, chain }) diff --git a/projects/harbor-protocol.js b/projects/harbor-protocol.js new file mode 100644 index 00000000000..2add656d23d --- /dev/null +++ b/projects/harbor-protocol.js @@ -0,0 +1,14 @@ +const { get } = require('./helper/http') +const { transformBalances } = require('./helper/portedTokens') +const sdk = require('@defillama/sdk') + +async function tvl(_, _b, _cb, { chain }) { + const { tvldata } = await get('https://rest.comdex.one/comdex/vault/v1beta1/tvl-by-app-all-extended-pairs/2') + const balances = {} + tvldata.forEach(i => sdk.util.sumSingleBalance(balances,i.asset_denom,i.collateral_locked_amount, chain)) + return transformBalances(chain, balances) +} + +module.exports = { + comdex: { tvl } +} \ No newline at end of file diff --git a/projects/hard.js b/projects/hard.js index 92a46a69d48..879f4190431 100644 --- a/projects/hard.js +++ b/projects/hard.js @@ -1,62 +1,26 @@ -const { get } = require('./helper/http') +const { queryV1Beta1 } = require('./helper/chain/cosmos'); +const chain = 'kava' -const KAVA_DENOM = "ukava"; -const HARD_DENOM = "hard"; -const USDX_DENOM = "usdx"; -const BNB_DENOM = "bnb"; -const BTC_DENOM = "btcb"; -const BUSD_DENOM = "busd"; -const XRPB_DENOM = "xrpb"; -const ATOM_DENOM = "ibc/27394FB092D2ECCD56123C74F36E4C1F926001CEADA9CA97EA622B25F41E5EB2" -const AKT_DENOM = "ibc/799FDD409719A1122586A629AE8FCA17380351A51C1F47A80A1B8E7F2A491098" -const coingeckoIds = { - [KAVA_DENOM]: 'kava', - [HARD_DENOM]:'kava-lend', - [USDX_DENOM]:'usdx', - [BNB_DENOM]:'binancecoin', - [BTC_DENOM]:'bitcoin', - [BUSD_DENOM]:'binance-usd', - [XRPB_DENOM]:'ripple', - [ATOM_DENOM]:'cosmos', - [AKT_DENOM]:'akash-network' -} -const decimals = { - [KAVA_DENOM]: 6, - [HARD_DENOM]:6, - [USDX_DENOM]:6, - [BNB_DENOM]:8, - [BTC_DENOM]:8, - [BUSD_DENOM]:8, - [XRPB_DENOM]:8, - [ATOM_DENOM]:6, - [AKT_DENOM]:6 +const tvl = async (_, _1, _2, { api }) => { + const [deposited, borrowed] = await Promise.all([ + queryV1Beta1({ chain, url: 'hard/v1beta1/total-deposited' }), + queryV1Beta1({ chain, url: 'hard/v1beta1/total-borrowed' }) + ]) + deposited.supplied_coins.forEach(({ denom, amount }) => api.add(denom, amount)) + borrowed.borrowed_coins.forEach(({ denom, amount }) => api.add(denom, amount * -1)) } -var tvl = async () => { - const balances = {} - const totalDeposited = await get('https://api2.kava.io/hard/total-deposited') - const totalBorrowed = await get('https://api2.kava.io/hard/total-borrowed') - for(const coin of totalDeposited.result){ - const borrowed = Number(totalBorrowed.result.find(item=>item.denom === coin.denom)?.amount || 0); - balances[coingeckoIds[coin.denom]]=(Number(coin.amount)-borrowed)/(10**decimals[coin.denom]); - } - return balances; -} -var borrowed = async () => { - const balances = {} - const totalBorrowed = await get('https://api2.kava.io/hard/total-borrowed') - for(const coin of totalBorrowed.result){ - balances[coingeckoIds[coin.denom]]=Number(coin.amount)/(10**decimals[coin.denom]); - } - return balances; -} +const borrowed = async (_, _1, _2, { api }) => { + const borrowed = await queryV1Beta1({ chain, url: 'hard/v1beta1/total-borrowed' }) + borrowed.borrowed_coins.forEach(({ denom, amount }) => api.add(denom, amount)) +} module.exports = { - timetravel: false, - kava:{ - tvl, - borrowed - } + timetravel: false, + kava: { + tvl, + borrowed + } } diff --git a/projects/harvest.js b/projects/harvest.js index 087580df4ed..1b837eb852c 100644 --- a/projects/harvest.js +++ b/projects/harvest.js @@ -1,10 +1,11 @@ const { get } = require('./helper/http') // historical tvl on https://ethparser-api.herokuapp.com/api/transactions/history/alltvl?network=eth -const endpoint = "https://api-ui.harvest.finance/vaults?key=41e90ced-d559-4433-b390-af424fdc76d6" +const endpoint = "https://api.harvest.finance/vaults?key=41e90ced-d559-4433-b390-af424fdc76d6" const chains = { ethereum: 'eth', - bsc: 'bsc', + // bsc: 'bsc', + arbitrum: 'arbitrum', polygon: 'matic' } @@ -18,11 +19,14 @@ Object.keys(chains).forEach(chain => { if (!_response) _response = get(endpoint) const response = await _response var tvl = 0; - Object.values(response[chain]).map(async item => { + Object.values(response[chain]).map(item => { + if(item.id === "convex_pETH"){ + return + } const poolTvl = parseFloat(item.totalValueLocked ?? 0) tvl += poolTvl }) return { tether: tvl } } } -}) +}) \ No newline at end of file diff --git a/projects/hswap.js b/projects/hswap.js index 09c1082f445..9606a89dac5 100644 --- a/projects/hswap.js +++ b/projects/hswap.js @@ -2,6 +2,6 @@ const { uniTvlExport } = require("./helper/calculateUniTvl") module.exports = { heco: { - tvl: uniTvlExport('0x13D1EA691C8153F5bc9a491d41b927E2baF8A6b1', "heco") + tvl: uniTvlExport('0x13D1EA691C8153F5bc9a491d41b927E2baF8A6b1', "heco", true) } } \ No newline at end of file diff --git a/projects/hurricaneswap.js b/projects/hurricaneswap.js index f8ad1ddc0b4..690b4af6666 100644 --- a/projects/hurricaneswap.js +++ b/projects/hurricaneswap.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('./helper/coreAssets.json') const sdk = require("@defillama/sdk"); const { staking, stakings } = require("./helper/staking"); @@ -5,14 +6,13 @@ const { getUniTVL } = require('./helper/unknownTokens') const masterChefV1 = "0x9984d70D5Ab32E8e552974A5A24661BFEfE81DbE"; const masterChefV2 = "0x1c9F36FE608190D1fe99e001b596c31871696b24"; -const AVAX = "0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7"; +const AVAX = ADDRESSES.avax.WAVAX; const stakingConttract_xhctBar = "0x75B797a0ed87F77bB546F3A3556F18fC35a01140"; const stakingConttract_shctBar = "0xE4aE2E8648B8E84c4A487a559b04e884B822a350"; const HCT = "0x45C13620B55C35A5f539d26E88247011Eb10fDbd"; const chainTvl = getUniTVL({ - chain: 'avax', factory: '0x7009b3619d5ee60d0665BA27Cf85eDF95fd8Ad01', useDefaultCoreAssets: true, }) diff --git a/projects/hydradex.js b/projects/hydradex.js index 06413cb0324..4e1a2893259 100644 --- a/projects/hydradex.js +++ b/projects/hydradex.js @@ -1,21 +1,27 @@ -const cloudscraper = require('cloudscraper') +const { blockQuery } = require('./helper/http') +const { getBlock } = require('./hydradex/getHydraV3SubgraphTvl') -async function fetch() { - const uri = 'https://info.hydradex.org/graphql' - const body = { "operationName": "Query", "variables": {}, "query": "query Query {\n hydraswapFactories(where: {id: \"5a2a927bea6c5f4a48d4e0116049c1e36d52a528\"}) {\n totalLiquidityUSD\n }\n}\n" } - const reserves = ( - await cloudscraper.post(uri, { - json: body - }) - ) - return { tether: +reserves.data.hydraswapFactories[0].totalLiquidityUSD } -}; +async function tvl(timestamp) { + const endpoint = 'https://info.hydradex.org/graphql' + const block = await getBlock(endpoint, timestamp) + const query = `query ($block: Float!){ + hydraswapFactories (block: { number: $block }) { + totalLiquidityUSD + } + }` + const { hydraswapFactories: [{ totalLiquidityUSD }] } = await blockQuery(endpoint, query, { + api: { + getBlock: () => block, + block + } + }) + return { tether: totalLiquidityUSD } +} module.exports = { misrepresentedTokens: true, - timetravel: false, methodology: "We count liquidity on the dex, pulling data from subgraph", hydra: { - tvl: fetch, + tvl, }, }; \ No newline at end of file diff --git a/projects/hyfi.js b/projects/hyfi.js index ad01fd32b47..3a837198e56 100644 --- a/projects/hyfi.js +++ b/projects/hyfi.js @@ -6,5 +6,8 @@ async function fetch() { } module.exports = { + bsc: { + fetch + }, fetch } diff --git a/projects/jaguarswap.js b/projects/jaguarswap.js index de85eef1fc1..79e794beccb 100644 --- a/projects/jaguarswap.js +++ b/projects/jaguarswap.js @@ -16,7 +16,6 @@ module.exports = { methodology: 'All tokens and LP tokens staked on the Masterchef (0x1cCf20F4eE3EFD291267c07268BEcbFDFd192311) are counted as the TVL, with the exception of the native token(JAGUAR) which is considered staking TVL.', arbitrum: { tvl: arbitrumTvl, - staking: staking(STAKING_CONTRACT, JAGUAR, "arbitrum", `arbitrum:${JAGUAR}`) + staking: staking(STAKING_CONTRACT, JAGUAR) }, -} -// node test.js projects/jaguarswap.js +} \ No newline at end of file diff --git a/projects/jetprotocol.js b/projects/jetprotocol.js index 7696e36d0c1..cc04fc43e14 100644 --- a/projects/jetprotocol.js +++ b/projects/jetprotocol.js @@ -1,4 +1,5 @@ -const { getTokenBalance } = require("./helper/solana"); +const ADDRESSES = require('./helper/coreAssets.json') +const { getTokenBalance, sumTokens2 } = require("./helper/solana"); async function borrowed() { const [usdcAmount, ethAmount, solAmount, btcAmount] = await Promise.all([ @@ -28,32 +29,16 @@ async function borrowed() { } async function tvl() { - const [usdcAmount, ethAmount, solAmount, btcAmount] = await Promise.all([ - getTokenBalance( - "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", - "7gpj9cpzBBW9Ci1yMwWz7iGbQYpm5fZmadNQyrYsqch8" - ), - getTokenBalance( - "2FPyTwcZLUg1MDrwsyoP4D6s1tM7hAkHYRjkNb5w6Pxk", - "7gpj9cpzBBW9Ci1yMwWz7iGbQYpm5fZmadNQyrYsqch8" - ), - getTokenBalance( - "So11111111111111111111111111111111111111112", - "7gpj9cpzBBW9Ci1yMwWz7iGbQYpm5fZmadNQyrYsqch8" - ), - getTokenBalance( - "9n4nbM75f5Ui33ZbPYXn59EwSgE8CGsHtAeTH5YFeJ9E", - "7gpj9cpzBBW9Ci1yMwWz7iGbQYpm5fZmadNQyrYsqch8" - ), - ]); - return { - bitcoin: btcAmount, - "usd-coin": usdcAmount, - ethereum: ethAmount, - solana: solAmount, - }; + return sumTokens2({ owner: '7gpj9cpzBBW9Ci1yMwWz7iGbQYpm5fZmadNQyrYsqch8', tokens: [ + ADDRESSES.solana.USDC, + '2FPyTwcZLUg1MDrwsyoP4D6s1tM7hAkHYRjkNb5w6Pxk', + ADDRESSES.solana.SOL, + '9n4nbM75f5Ui33ZbPYXn59EwSgE8CGsHtAeTH5YFeJ9E', + ]}); } +// JPv1rCqrhagNNmJVM5J1he7msQ5ybtvE1nNuHpDHMNU +// https://docs.jetprotocol.io/jet-protocol/protocol/smart-contracts module.exports = { timetravel: false, solana: { diff --git a/projects/justlend.js b/projects/justlend.js index 13ce516008f..f609798c856 100644 --- a/projects/justlend.js +++ b/projects/justlend.js @@ -1,23 +1,6 @@ -const { get } = require('./helper/http') -const { toUSDTBalances } = require('./helper/balances'); - -function core(borrowed){ -return async () => { - const response = ( - await get( - 'https://labc.ablesdxd.link/justlend/markets/dashboard') - ).data; - - const tvl = response.totalDepositedUSD - response.totalBorrowedUSD; - - return toUSDTBalances(borrowed? response.totalBorrowedUSD : tvl); -}; -} +const { compoundExports2 } = require('./helper/compound') +const ADDRESSES = require('./helper/coreAssets.json') module.exports = { - misrepresentedTokens: true, - tron: { - tvl: core(false), - borrowed: core(true), - }, + tron: compoundExports2({ comptroller: 'TGjYzgCyPobsNS9n6WcbdLVR9dH7mWqFx7', cether: '0x2c7c9963111905d29eb8da37d28b0f53a7bb5c28', cetheEquivalent: ADDRESSES.tron.WTRX, transformAdressRaw: i => 'tron:' + i }), }; diff --git a/projects/katana-ronin.js b/projects/katana-ronin.js index 4cda0f4cdeb..2b348925b83 100644 --- a/projects/katana-ronin.js +++ b/projects/katana-ronin.js @@ -1,7 +1,7 @@ const { getUniTVL } = require('./helper/unknownTokens'); module.exports = { - ronin: { tvl: getUniTVL({ chain: 'ronin', useDefaultCoreAssets: true, factory: '0xb255d6a720bb7c39fee173ce22113397119cb930', }) }, + ronin: { tvl: getUniTVL({ useDefaultCoreAssets: true, factory: '0xb255d6a720bb7c39fee173ce22113397119cb930', }) }, hallmarks:[ [1653744720, "Ronin Bridge Hack $625m"], ], diff --git a/projects/kava.js b/projects/kava.js index ebaafba97cd..74450f74c00 100644 --- a/projects/kava.js +++ b/projects/kava.js @@ -1,46 +1,10 @@ -const { get } = require('./helper/http') +const { queryV1Beta1 } = require('./helper/chain/cosmos'); -async function tvl() { - let balances = {}; - - let deposits = (await get('https://api2.kava.io/cdp/totalCollateral')).result; - for (let i = 0; i < deposits.length; i++) { - const info = convertSymbol(deposits[i].amount.denom); - if (info.id in balances) { - balances[info.id] = Number(balances[info.id]) + - Number(deposits[i].amount.amount / 10 ** info.decimals); - } else { - balances[info.id] = deposits[i].amount.amount / 10 ** info.decimals; - }; - }; - - return balances; -}; - -function convertSymbol(symbol) { - switch (symbol) { - case 'bnb': - return {id: 'binancecoin', decimals: 8}; - case 'btcb': - return {id: 'bitcoin', decimals: 8}; - case 'busd': - return {id: 'binance-usd', decimals: 8}; - case 'hard': - return {id: 'kava-lend', decimals: 6}; - case 'hbtc': - return {id: 'bitcoin', decimals: 8}; - case 'swp': - return {id: 'kava-swap', decimals: 6}; - case 'ukava': - return {id: 'kava', decimals: 6}; - case 'xrpb': - return {id: 'ripple', decimals: 8}; - case 'ibc/B448C0CA358B958301D328CCDC5D5AD642FC30A6D3AE106FF721DB315F3DDE5C': - return {id: 'terra-usd', decimals: 6}; - default: - console.log(symbol); - }; -}; +const chain = 'kava' +async function tvl(_, _1, _2, { api }) { + const { total_collateral: pools } = await queryV1Beta1({ chain, url: 'cdp/v1beta1/totalCollateral' }); + pools.forEach(({ amount: { denom, amount} }) => api.add(denom, amount)) +} module.exports = { timetravel: false, diff --git a/projects/kavaswap.js b/projects/kavaswap.js index 957df4a8e7d..dd16b263bf1 100644 --- a/projects/kavaswap.js +++ b/projects/kavaswap.js @@ -1,49 +1,19 @@ -const utils = require('./helper/utils'); -const sdk = require('@defillama/sdk') +const { queryV1Beta1 } = require('./helper/chain/cosmos'); +const { transformDexBalances } = require('./helper/portedTokens') -async function tvl(timestamp, ethBlock, chainBlocks) { - let balances = {}; - let url = `https://api2.kava.io/swap/pools` - if(Math.abs(Date.now()/1000 - timestamp) > 3600){ - const block = await sdk.api.util.lookupBlock(timestamp, {chain:'kava'}) - url += `?height=${block.block}` - } +const chain = 'kava' - const response = await utils.fetchURL(url); +async function tvl() { + const { pools } = await queryV1Beta1({ chain, url: 'swap/v1beta1/pools' }); - for (let pool of response.data.result) { - for (let coin of pool.coins) { - let tokenInfo = generic(coin.denom); - if(!tokenInfo) { - console.log('unknown token', coin.denom) - continue; - } - if (balances[tokenInfo[0]]) { - balances[tokenInfo[0]] += coin.amount / 10**tokenInfo[1]; - } else { - balances[tokenInfo[0]] = coin.amount / 10**tokenInfo[1]; - }; - }; - }; -return balances; + const data = pools.map(({ coins }) => ({ + token0: coins[0].denom, + token1: coins[1].denom, + token0Bal: coins[0].amount, + token1Bal: coins[1].amount + })) + return transformDexBalances({ chain, data }) } -function generic(ticker) { - switch(ticker) { - case 'bnb': return ['binancecoin',8]; - case 'btcb': return ['bitcoin',8]; - case 'busd': return ['binance-usd',8]; - case 'hard': return ['kava-lend',6]; - case 'swp': return ['kava-swap',6]; - case 'ukava': return ['kava',6]; - case 'xrpb': return ['ripple',8]; - case 'usdx': return ['usdx',6]; - case 'ibc/27394FB092D2ECCD56123C74F36E4C1F926001CEADA9CA97EA622B25F41E5EB2': return ['cosmos',6]; - case 'ibc/799FDD409719A1122586A629AE8FCA17380351A51C1F47A80A1B8E7F2A491098': return ['akash-network',6]; - case 'ibc/B8AF5D92165F35AB31F3FC7C7B444B9D240760FA5D406C49D24862BD0284E395': return ['terra-luna',6]; - case 'ibc/0471F1C4E7AFD3F07702BEF6DC365268D64570F7C1FDC98EA6098DD6DE59817B': return ['osmosis',6]; - case 'ibc/B448C0CA358B958301D328CCDC5D5AD642FC30A6D3AE106FF721DB315F3DDE5C': return ['terrausd',6]; - }; -}; module.exports = { timetravel: false, diff --git a/projects/keep.js b/projects/keep.js index d28d872034b..83c6c879fe0 100644 --- a/projects/keep.js +++ b/projects/keep.js @@ -1,9 +1,9 @@ -const { GraphQLClient, gql } = require('graphql-request') +const { GraphQLClient, } = require('graphql-request') const utils = require('./helper/utils'); const sdk = require('@defillama/sdk') async function tvl() { - var q2 = gql`{ + var q2 = `{ totalBondedECDSAKeeps { id totalAvailable @@ -25,7 +25,7 @@ async function tvl() { } async function staking() { - var q1 = gql`{ + var q1 = `{ tokenStakings { contractAddress totalStaker diff --git a/projects/know-to-earn.js b/projects/know-to-earn.js index 67c3759801b..4bc3a4655a8 100644 --- a/projects/know-to-earn.js +++ b/projects/know-to-earn.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('./helper/coreAssets.json') // 0x515343ed04b054d098a0c15cbd7f98b0250d0b38 KNOW token // 0x767eded9032ce68dc4e475addf0059baab936585 lp token // 0xEA934138CFEF2c5efedf2b670B93Fb6827295cC4 owner @@ -5,7 +6,7 @@ const { sumLPWithOnlyOneToken } = require("./helper/unwrapLPs"); const iotx = "0x6fb3e0a217407efff7ca062d46c26e5d60a14d69"; -const wiotx = "0xA00744882684C3e4747faEFD68D283eA44099D03"; +const wiotx = ADDRESSES.iotex.WIOTX; function pool2(chain, gasToken) { return async (timestamp, _block, {[chain]: block}) => { diff --git a/projects/lachain-yield-market.js b/projects/lachain-yield-market.js index 5cc582cc8c6..fb34d20f73f 100644 --- a/projects/lachain-yield-market.js +++ b/projects/lachain-yield-market.js @@ -9,12 +9,12 @@ async function fetch() { for (let i = 0; i < response.data.length; i++) { const f = response.data[i]; tvl_sum += parseFloat(f['lachainTvl']); - }; + } for (let i = 0; i < response_ladex.data.length; i++) { const f = response_ladex.data[i]; tvl_sum += parseFloat(f['lachainTvl']); - }; + } return tvl_sum; } diff --git a/projects/lachainBridge.js b/projects/lachainBridge.js index ff167069165..950a84c1a5d 100644 --- a/projects/lachainBridge.js +++ b/projects/lachainBridge.js @@ -1,37 +1,38 @@ +const ADDRESSES = require('./helper/coreAssets.json') const sdk = require("@defillama/sdk"); const { sumTokens } = require('./helper/unwrapLPs') const { getChainTransform } = require('./helper/portedTokens') const config = { polygon: { - nativeBridge: ['0xE372D290F83c7487bdc925ddA187671bfF9e347b'], tokenBridge: ['0x82E4d5d7F36a22f2FEaaF87eCcDcDA7e0EFc98C3'], tokens: ['0xc2132D05D31c914a87C6611C10748AEb04B58e8F'], + nativeBridge: ['0xE372D290F83c7487bdc925ddA187671bfF9e347b'], tokenBridge: ['0x82E4d5d7F36a22f2FEaaF87eCcDcDA7e0EFc98C3'], tokens: [ADDRESSES.polygon.USDT], }, bsc: { - nativeBridge: ['0xC926f267418d69147c88Edf88e93E78F2153f923'], tokenBridge: ['0x6571DD15430a455118EC6e24Dc7820489ED7019b'], tokens: ['0x55d398326f99059fF775485246999027B3197955'], + nativeBridge: ['0xC926f267418d69147c88Edf88e93E78F2153f923'], tokenBridge: ['0x6571DD15430a455118EC6e24Dc7820489ED7019b'], tokens: [ADDRESSES.bsc.USDT], }, ethereum: { - nativeBridge: ['0xc7fc91a0a93d570738b2af6efb1595c3183809d7'], tokenBridge: ['0xAB49eb8Ca42f42fd7e8b745F2CC5BeDfb78d2D3E'], tokens: ['0xdAC17F958D2ee523a2206206994597C13D831ec7'], + nativeBridge: ['0xc7fc91a0a93d570738b2af6efb1595c3183809d7'], tokenBridge: ['0xAB49eb8Ca42f42fd7e8b745F2CC5BeDfb78d2D3E'], tokens: [ADDRESSES.ethereum.USDT], }, avax: { - nativeBridge: ['0xD4aE8F772dcf2e20b103c740AfD9D9f9E78dbfFC'], tokenBridge: ['0x8783256443217856B716464A068aabdecc3F0b95'], tokens: ['0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7'], + nativeBridge: ['0xD4aE8F772dcf2e20b103c740AfD9D9f9E78dbfFC'], tokenBridge: ['0x8783256443217856B716464A068aabdecc3F0b95'], tokens: [ADDRESSES.avax.USDt], }, fantom: { - nativeBridge: ['0x012cebA65fD071473a9E0d3C5048702734a1eE5e'], tokenBridge: ['0x73Ec53a1Ee3Ea275D95212b41Dcce8cb9e0206Cd'], tokens: ['0x049d68029688eabf473097a2fc38ef61633a3c7a'], + nativeBridge: ['0x012cebA65fD071473a9E0d3C5048702734a1eE5e'], tokenBridge: ['0x73Ec53a1Ee3Ea275D95212b41Dcce8cb9e0206Cd'], tokens: [ADDRESSES.fantom.fUSDT], }, arbitrum: { - nativeBridge: ['0xD4aE8F772dcf2e20b103c740AfD9D9f9E78dbfFC'], tokenBridge: ['0x43d92690D302C0e9f2fBD624eb9589F52b5AD115'], tokens: ['0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9'], + nativeBridge: ['0xD4aE8F772dcf2e20b103c740AfD9D9f9E78dbfFC'], tokenBridge: ['0x43d92690D302C0e9f2fBD624eb9589F52b5AD115'], tokens: [ADDRESSES.arbitrum.USDT], }, harmony: { nativeBridge: ['0x0A19afbE4519A40Df3b48BE46EDc0720724B4A6B'], tokenBridge: ['0x5DDDc78C8a59CeD4d25a8FD96BF9D9FdA561D0FF'], tokens: ['0x3c2b8be99c50593081eaa2a724f0b8285f5aba8f'], }, heco: { - nativeBridge: ['0xbBF0b12A0Be425Db284905A3Cb0Ab72b178b6A4F'], tokenBridge: ['0x334d6D6c5EaE4bf5ec7De39a1547e6bDBdDcfbf3'], tokens: ['0xa71edc38d189767582c38a3145b5873052c3e47a'], + nativeBridge: ['0xbBF0b12A0Be425Db284905A3Cb0Ab72b178b6A4F'], tokenBridge: ['0x334d6D6c5EaE4bf5ec7De39a1547e6bDBdDcfbf3'], tokens: [ADDRESSES.heco.USDT], }, } module.exports = {}; -const nullAddress = "0x0000000000000000000000000000000000000000" +const nullAddress = ADDRESSES.null Object.keys(config).forEach(chain => { const { nativeBridge, tokenBridge, tokens} = config[chain] diff --git a/projects/linear.js b/projects/linear.js index 2291b38e04e..3e1bb6a1c9f 100644 --- a/projects/linear.js +++ b/projects/linear.js @@ -1,14 +1,15 @@ +const ADDRESSES = require('./helper/coreAssets.json') const { call } = require('./helper/chain/near') async function tvl() { return { near: (await call( - 'linear-protocol.near', + ADDRESSES.near.LINA, 'get_total_staked_balance', {} ) / 1e24 ) }; -}; +} module.exports = { near: { diff --git a/projects/lobis.js b/projects/lobis.js index d35143c0bce..5ca84c19859 100644 --- a/projects/lobis.js +++ b/projects/lobis.js @@ -1,9 +1,10 @@ +const ADDRESSES = require('./helper/coreAssets.json') const { ohmTvl } = require('./helper/ohm') const treasury = "0x873ad91fA4F2aA0d557C0919eC3F6c9D240cDd05" module.exports = ohmTvl(treasury, [ //curve - ["0xD533a949740bb3306d119CC777fa900bA034cd52", false], + [ADDRESSES.ethereum.CRV, false], //frax ["0x3432b6a60d23ca0dfca7761b7ab56459d9c964d0", false], //Sushi LP diff --git a/projects/mantradao.js b/projects/mantradao.js index ec8e88ec0ab..f2bc28967a7 100644 --- a/projects/mantradao.js +++ b/projects/mantradao.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('./helper/coreAssets.json') const { sumTokens } = require("./helper/unwrapLPs"); const { compoundExports } = require("./helper/compound"); const { stakingAssetsETH, stakingAssetsBSC, stakingAssetsPOLYGON, } = require("./config/mantra-dao/contracts/naked-staking-contracts"); @@ -11,7 +12,7 @@ const chainConfig = { const comptroller = "0x606246e9EF6C70DCb6CEE42136cd06D127E2B7C7" const zenETH = "0x4F905f75F5576228eD2D0EA508Fb0c32a0696090" -const zenETHEquivalent = "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"; +const zenETHEquivalent = ADDRESSES.ethereum.WETH; module.exports = {} diff --git a/projects/marinade.js b/projects/marinade.js index 34003f7fb9b..ad204fd662b 100644 --- a/projects/marinade.js +++ b/projects/marinade.js @@ -1,4 +1,4 @@ -const { getProvider, sumTokens2, } = require('./helper/solana') +const { getProvider, getSolBalance, } = require("./helper/solana") const { Program, } = require("@project-serum/anchor"); async function tvl() { @@ -6,17 +6,21 @@ async function tvl() { const programId = 'MarBmsSgKXdrN1egZf5sqe1TMai9K1rChYNDJgjq7aD' const idl = await Program.fetchIdl(programId, provider) const program = new Program(idl, programId, provider) - const [{ - account: { - validatorSystem: { totalActiveBalance }, availableReserveBalance - } - }] = await program.account.state.all() - const balances = { - solana: (+totalActiveBalance + +availableReserveBalance)/1e9 + const [ + { + account: { + validatorSystem: { totalActiveBalance }, + availableReserveBalance, + }, + }, + ] = await program.account.state.all() + return { + solana: + (+totalActiveBalance + + +availableReserveBalance + + (await getSolBalance("UefNb6z6yvArqe4cJHTXCqStRsKmWhGxnZzuHbikP5Q"))) / // Liq Pool Sol Leg Pda + 1e9, } - return sumTokens2({ balances, solOwners: [ - 'UefNb6z6yvArqe4cJHTXCqStRsKmWhGxnZzuHbikP5Q', // Liq Pool Sol Leg Pda - ]}) } module.exports = { diff --git a/projects/mercurial.js b/projects/mercurial.js index 83b8cf20978..a5f1da11530 100644 --- a/projects/mercurial.js +++ b/projects/mercurial.js @@ -1,90 +1,91 @@ +const ADDRESSES = require('./helper/coreAssets.json') const { sumTokens2 } = require("./helper/solana"); async function tvl() { const tokensAndOwners = [ // PAI-3Pool - ['EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v', '2dc3UgMuVkASzW4sABDjDB5PjFbPTncyECUnZL73bmQR'], - ['Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB', '2dc3UgMuVkASzW4sABDjDB5PjFbPTncyECUnZL73bmQR'], + [ADDRESSES.solana.USDC, '2dc3UgMuVkASzW4sABDjDB5PjFbPTncyECUnZL73bmQR'], + [ADDRESSES.solana.USDT, '2dc3UgMuVkASzW4sABDjDB5PjFbPTncyECUnZL73bmQR'], ['Ea5SjE2Y6yvCeW5dYTn7PYMuW5ikXkvbGdcmSnXeaLjS', '2dc3UgMuVkASzW4sABDjDB5PjFbPTncyECUnZL73bmQR'], // UST-3Pool ['CXLBjMMcwkc17GfJtBos6rQCo1ypeH6eDbB82Kby4MRm','FDonWCo5RJhx8rzSwtToUXiLEL7dAqLmUhnyH76F888D'], - ['EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v','FDonWCo5RJhx8rzSwtToUXiLEL7dAqLmUhnyH76F888D'], - ['Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB','FDonWCo5RJhx8rzSwtToUXiLEL7dAqLmUhnyH76F888D'], + [ADDRESSES.solana.USDC,'FDonWCo5RJhx8rzSwtToUXiLEL7dAqLmUhnyH76F888D'], + [ADDRESSES.solana.USDT,'FDonWCo5RJhx8rzSwtToUXiLEL7dAqLmUhnyH76F888D'], // pSOL-2Pool - ['9EaLkQrbjmbbuZG9Wdpo8qfNUEjHATJFSycEmw6f1rGX','8RXqdSRFGLX8iifT2Cu5gD3fG7G4XcEBWCk9X5JejpG3'], - ['So11111111111111111111111111111111111111112','8RXqdSRFGLX8iifT2Cu5gD3fG7G4XcEBWCk9X5JejpG3'], + [ADDRESSES.solana.pSOL,'8RXqdSRFGLX8iifT2Cu5gD3fG7G4XcEBWCk9X5JejpG3'], + [ADDRESSES.solana.SOL,'8RXqdSRFGLX8iifT2Cu5gD3fG7G4XcEBWCk9X5JejpG3'], // wUSD-4Pool - ['EjmyN6qEC1Tf1JxiG1ae7UTJhUxSwk1TCWNWqxWV4J6o','3m15qNJDM5zydsYNJzkFYXE7iGCVnkKz1mrmbawrDUAH'], + [ADDRESSES.solana.DAI,'3m15qNJDM5zydsYNJzkFYXE7iGCVnkKz1mrmbawrDUAH'], ['A9mUU4qviSctJVPJdBJWkb28deg915LYJKrzQ19ji3FM','3m15qNJDM5zydsYNJzkFYXE7iGCVnkKz1mrmbawrDUAH'], - ['EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v','3m15qNJDM5zydsYNJzkFYXE7iGCVnkKz1mrmbawrDUAH'], + [ADDRESSES.solana.USDC,'3m15qNJDM5zydsYNJzkFYXE7iGCVnkKz1mrmbawrDUAH'], ['Dn4noZ5jgGfkntzcQSUZ8czkreiZ1ForXYoV2H8Dm7S1','3m15qNJDM5zydsYNJzkFYXE7iGCVnkKz1mrmbawrDUAH'], // stSOL-2Pool - ['So11111111111111111111111111111111111111112','pG6noYMPVR9ykNgD4XSNa6paKKGGwciU2LckEQPDoSW'], + [ADDRESSES.solana.SOL,'pG6noYMPVR9ykNgD4XSNa6paKKGGwciU2LckEQPDoSW'], ['7dHbWXmci3dT8UFYWYZweBLXgycu7Y3iL6trKn1Y7ARj','pG6noYMPVR9ykNgD4XSNa6paKKGGwciU2LckEQPDoSW'], // mSOL-2Pool - ['So11111111111111111111111111111111111111112','GcJckEnDiWjpjQ8sqDKuNZjJUKAFZSiuQZ9WmuQpC92a'], + [ADDRESSES.solana.SOL,'GcJckEnDiWjpjQ8sqDKuNZjJUKAFZSiuQZ9WmuQpC92a'], ['mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So','GcJckEnDiWjpjQ8sqDKuNZjJUKAFZSiuQZ9WmuQpC92a'], // wbBUSD-4Pool - ['EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v','D9QnVSaKxcoYHhXpyhpHWjVhY1xtNxaQbuHocjHKVzf1'], - ['8qJSyQprMC57TWKaYEmetUR3UUiTP2M3hXdcvFhkZdmv','D9QnVSaKxcoYHhXpyhpHWjVhY1xtNxaQbuHocjHKVzf1'], - ['FCqfQSujuPxy6V42UvafBhsysWtEq1vhjfMN1PUbgaxA','D9QnVSaKxcoYHhXpyhpHWjVhY1xtNxaQbuHocjHKVzf1'], - ['5RpUwQ8wtdPCZHhu6MERp2RGrpobsbZ6MH5dDHkUjs2','D9QnVSaKxcoYHhXpyhpHWjVhY1xtNxaQbuHocjHKVzf1'], + [ADDRESSES.solana.USDC,'D9QnVSaKxcoYHhXpyhpHWjVhY1xtNxaQbuHocjHKVzf1'], + [ADDRESSES.solana.USDTbs,'D9QnVSaKxcoYHhXpyhpHWjVhY1xtNxaQbuHocjHKVzf1'], + [ADDRESSES.solana.USDCbs,'D9QnVSaKxcoYHhXpyhpHWjVhY1xtNxaQbuHocjHKVzf1'], + [ADDRESSES.solana.BUSDbs,'D9QnVSaKxcoYHhXpyhpHWjVhY1xtNxaQbuHocjHKVzf1'], // UXD-3Pool ['7kbnvuGBxxj8AG9qp8Scn56muWGaRaFqxg1FsRp3PaFT','62JkSDhZLgwLu8in73E46CPTzEf8hMGMxSNUw5r5mMA8'], - ['EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v','62JkSDhZLgwLu8in73E46CPTzEf8hMGMxSNUw5r5mMA8'], - ['Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB','62JkSDhZLgwLu8in73E46CPTzEf8hMGMxSNUw5r5mMA8'], + [ADDRESSES.solana.USDC,'62JkSDhZLgwLu8in73E46CPTzEf8hMGMxSNUw5r5mMA8'], + [ADDRESSES.solana.USDT,'62JkSDhZLgwLu8in73E46CPTzEf8hMGMxSNUw5r5mMA8'], // USTv2-3Pool ['9vMJfxuKxXBoEa7rM12mYLMwTacLMLDJqHozw96WQL8i','44K7k9pjjKB6LcWZ1sJ7TvksR3sb4AXpBxwzF1pcEJ5n'], - ['EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v','44K7k9pjjKB6LcWZ1sJ7TvksR3sb4AXpBxwzF1pcEJ5n'], - ['Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB','44K7k9pjjKB6LcWZ1sJ7TvksR3sb4AXpBxwzF1pcEJ5n'], + [ADDRESSES.solana.USDC,'44K7k9pjjKB6LcWZ1sJ7TvksR3sb4AXpBxwzF1pcEJ5n'], + [ADDRESSES.solana.USDT,'44K7k9pjjKB6LcWZ1sJ7TvksR3sb4AXpBxwzF1pcEJ5n'], // USDH-3Pool ['USDH1SM1ojwWUga67PGrgFWUHibbjqMvuMaDkRJTgkX','F1TVmk1LAaVDGDfEFJWfNLCh9wikZxv33e54ZPeRQzEh'], - ['EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v','F1TVmk1LAaVDGDfEFJWfNLCh9wikZxv33e54ZPeRQzEh'], - ['Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB','F1TVmk1LAaVDGDfEFJWfNLCh9wikZxv33e54ZPeRQzEh'], + [ADDRESSES.solana.USDC,'F1TVmk1LAaVDGDfEFJWfNLCh9wikZxv33e54ZPeRQzEh'], + [ADDRESSES.solana.USDT,'F1TVmk1LAaVDGDfEFJWfNLCh9wikZxv33e54ZPeRQzEh'], // aUSDC-4Pool - ['DdFPRnccQqLD4zCHrBqdY95D6hvw6PLWp9DEXj1fLCL9','5g5yYtiCy3ZrUpfvNg3LXVQDnVJtjmL1eMWXoMgqEuRx'], - ['8Yv9Jz4z7BUHP68dz8E8m3tMe6NKgpMUKn8KVqrPA6Fr','5g5yYtiCy3ZrUpfvNg3LXVQDnVJtjmL1eMWXoMgqEuRx'], - ['eqKJTf1Do4MDPyKisMYqVaUFpkEFAs3riGF3ceDH2Ca','5g5yYtiCy3ZrUpfvNg3LXVQDnVJtjmL1eMWXoMgqEuRx'], - ['EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v','5g5yYtiCy3ZrUpfvNg3LXVQDnVJtjmL1eMWXoMgqEuRx'], + [ADDRESSES.solana.aeUSDC,'5g5yYtiCy3ZrUpfvNg3LXVQDnVJtjmL1eMWXoMgqEuRx'], + [ADDRESSES.solana.aaUSDC,'5g5yYtiCy3ZrUpfvNg3LXVQDnVJtjmL1eMWXoMgqEuRx'], + [ADDRESSES.solana.apUSDC,'5g5yYtiCy3ZrUpfvNg3LXVQDnVJtjmL1eMWXoMgqEuRx'], + [ADDRESSES.solana.USDC,'5g5yYtiCy3ZrUpfvNg3LXVQDnVJtjmL1eMWXoMgqEuRx'], // acUSD-3Pool ['A96PoNcxa9LMxcF9HhKAfA1p3M1dGbubPMWf19gHAkgJ','FhqkDgkhrDY75Tq6rx1ezp6R36AjHsXVvRYJkiyhFoZU'], ['EwxNF8g9UfmsJVcZFTpL9Hx5MCkoQFoJi6XNWzKf1j8e','FhqkDgkhrDY75Tq6rx1ezp6R36AjHsXVvRYJkiyhFoZU'], - ['EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v','FhqkDgkhrDY75Tq6rx1ezp6R36AjHsXVvRYJkiyhFoZU'], + [ADDRESSES.solana.USDC,'FhqkDgkhrDY75Tq6rx1ezp6R36AjHsXVvRYJkiyhFoZU'], // fUSD-3Pool ['B7mXkkZgn7abwz1A3HnKkb18Y6y18WcbeSkh1DuLMkee','EdJbEpfASQB99Y2BMUEb5rtgVUcJ2bBUqe59f4JJ9o6t'], - ['EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v','EdJbEpfASQB99Y2BMUEb5rtgVUcJ2bBUqe59f4JJ9o6t'], - ['Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB','EdJbEpfASQB99Y2BMUEb5rtgVUcJ2bBUqe59f4JJ9o6t'], + [ADDRESSES.solana.USDC,'EdJbEpfASQB99Y2BMUEb5rtgVUcJ2bBUqe59f4JJ9o6t'], + [ADDRESSES.solana.USDT,'EdJbEpfASQB99Y2BMUEb5rtgVUcJ2bBUqe59f4JJ9o6t'], // USN-4Pool ['EwxNF8g9UfmsJVcZFTpL9Hx5MCkoQFoJi6XNWzKf1j8e','CrUucFMGc8iLxT4uZX965M7iQWozsRxai8ChevwdtXri'], - ['Grk6b4UMRWkgyq4Y6S1BnNRF4hRgtnMFp7Sorkv6Ez4u','CrUucFMGc8iLxT4uZX965M7iQWozsRxai8ChevwdtXri'], + [ADDRESSES.solana.afUSDC,'CrUucFMGc8iLxT4uZX965M7iQWozsRxai8ChevwdtXri'], ['PUhuAtMHsKavMTwZsLaDeKy2jb7ciETHJP7rhbKLJGY','CrUucFMGc8iLxT4uZX965M7iQWozsRxai8ChevwdtXri'], - ['EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v','CrUucFMGc8iLxT4uZX965M7iQWozsRxai8ChevwdtXri'], + [ADDRESSES.solana.USDC,'CrUucFMGc8iLxT4uZX965M7iQWozsRxai8ChevwdtXri'], // abBUSD-4Pool - ['8XSsNvaKU9FDhYWAv7Yc7qSNwuJSzVrXBNEk7AFiWF69','89WiJDwdAqjgsKrb9gxXcVgsmh38BBNm13xnPTuXjBwA'], - ['EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v','89WiJDwdAqjgsKrb9gxXcVgsmh38BBNm13xnPTuXjBwA'], - ['E77cpQ4VncGmcAXX16LHFFzNBEBb2U7Ar7LBmZNfCgwL','89WiJDwdAqjgsKrb9gxXcVgsmh38BBNm13xnPTuXjBwA'], + [ADDRESSES.solana.abUSDC,'89WiJDwdAqjgsKrb9gxXcVgsmh38BBNm13xnPTuXjBwA'], + [ADDRESSES.solana.USDC,'89WiJDwdAqjgsKrb9gxXcVgsmh38BBNm13xnPTuXjBwA'], + [ADDRESSES.solana.abUSDT,'89WiJDwdAqjgsKrb9gxXcVgsmh38BBNm13xnPTuXjBwA'], ['6nuaX3ogrr2CaoAPjtaKHAoBNWok32BMcRozuf32s2QF','89WiJDwdAqjgsKrb9gxXcVgsmh38BBNm13xnPTuXjBwA'], // aaUSDT-4Pool ['DNhZkUaxHXYvpxZ7LNnHtss8sQgdAfd1ZYS1fB7LKWUZ','A2UHy42vcoKKK4JhNzNTY9PJ5kPcb4EZUSxRAbUtKeUU'], - ['Bn113WT6rbdgwrm12UJtnmNqGqZjY4it2WoUQuQopFVn','A2UHy42vcoKKK4JhNzNTY9PJ5kPcb4EZUSxRAbUtKeUU'], - ['FwEHs3kJEdMa2qZHv7SgzCiFXUQPEycEXksfBkwmS8gj','A2UHy42vcoKKK4JhNzNTY9PJ5kPcb4EZUSxRAbUtKeUU'], - ['Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB','A2UHy42vcoKKK4JhNzNTY9PJ5kPcb4EZUSxRAbUtKeUU'], + [ADDRESSES.solana.aeUSDT,'A2UHy42vcoKKK4JhNzNTY9PJ5kPcb4EZUSxRAbUtKeUU'], + [ADDRESSES.solana.aaUSDT,'A2UHy42vcoKKK4JhNzNTY9PJ5kPcb4EZUSxRAbUtKeUU'], + [ADDRESSES.solana.USDT,'A2UHy42vcoKKK4JhNzNTY9PJ5kPcb4EZUSxRAbUtKeUU'], ] diff --git a/projects/metapool.js b/projects/metapool.js index 7e6f13d15a2..92d45bdc3e7 100644 --- a/projects/metapool.js +++ b/projects/metapool.js @@ -1,4 +1,6 @@ const utils = require('./helper/utils'); +const ADDRESSES = require('./helper/coreAssets.json') +const sdk = require("@defillama/sdk") async function tvl() { const totalTvl = await utils.fetchURL('http://validators.narwallets.com:7000/metrics_json') @@ -10,5 +12,10 @@ async function tvl() { module.exports = { methodology: 'TVL counts the NEAR tokens that are staked.', - near: { tvl, } + near: { tvl, }, + aurora: { + tvl: async (_, block, chainBlocks) => ({ + ["aurora:" + ADDRESSES.aurora.AURORA]: (await sdk.api.erc20.totalSupply({ target: "0xb01d35D469703c6dc5B369A1fDfD7D6009cA397F", chain:"aurora", block: chainBlocks.aurora})).output + }) + } } \ No newline at end of file diff --git a/projects/midasdao.js b/projects/midasdao.js index 5a4100ad068..b31982111b3 100644 --- a/projects/midasdao.js +++ b/projects/midasdao.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('./helper/coreAssets.json') const { sumTokensAndLPsSharedOwners } = require("./helper/unwrapLPs"); const sdk = require('@defillama/sdk'); @@ -7,7 +8,7 @@ const CROWN = "0x39912d83acb4a373321387300f4fbe88aa5d6f14"; const JoePair = "0x089a9BF16453b519Fab02e40d143C0dcF9083778"; const TREASURY = "0x6D9Cfb705C7b7A5ca1C4565A47Fa1b26FC1bE3d0"; const MIM = "0x130966628846BFd36ff31a822705796e8cb8C18D"; -const WAVAX = "0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7" +const WAVAX = ADDRESSES.avax.WAVAX const staking = async (timestamp, ethBlock, chainBlocks) => { const balances = {}; @@ -42,7 +43,7 @@ async function tvl(timestamp, block, chainBlocks) { ); return balances; -}; +} module.exports = { avax:{ diff --git a/projects/mobox.js b/projects/mobox.js index 8304980de5d..7a32d426d46 100644 --- a/projects/mobox.js +++ b/projects/mobox.js @@ -1,47 +1,18 @@ -const sdk = require("@defillama/sdk"); -const { unwrapUniswapLPs } = require("./helper/unwrapLPs"); -const abi = require("./pendle/abi.json"); -const { stakings } = require("./helper/staking.js"); - -async function pool2(timestamp, block, chainBlocks) { - const balances = {}; - - const masterChefDeposits = await sdk.api.abi.call({ - target: "0x73feaa1ee314f8c655e354234017be2193c9e24e", - abi: abi.userInfo, - params: [405, "0x9442dad1df11c858a900f55291dc1cf645ff66df"], - block: chainBlocks.bsc, - chain: "bsc", - }); - - await unwrapUniswapLPs( - balances, - [ - { - balance: masterChefDeposits.output.amount, - token: "0x8FA59693458289914dB0097F5F366d771B7a7C3F", - }, - ], - chainBlocks.bsc, - "bsc", - (a) => `bsc:${a}` - ); - - return balances; -} +const { stakings, staking } = require("./helper/staking.js"); +const { pool2 } = require("./helper/pool2.js"); module.exports = { bsc: { tvl: () => ({}), - pool2, + pool2: pool2(['0xdad49e63f97c967955975490a432de3796c699e6','0xa5f8c5dbd5f286960b9d90548680ae5ebff07652'], '0x8FA59693458289914dB0097F5F366d771B7a7C3F'), staking: stakings( [ "0xdad49e63f97c967955975490a432de3796c699e6", "0xf8c1bA88F1E4aeD152F945F1Df2a8fdc36127B5f", "0x3bD6a582698ECCf6822dB08141818A1a8512c68D", + "0x5E7Eb57B163b78e93608E773e0F4a88A55d7C28F", ], "0x3203c9e46ca618c8c1ce5dc67e7e9d75f5da2377", - "bsc" ), }, }; diff --git a/projects/moonbase.js b/projects/moonbase.js new file mode 100644 index 00000000000..3947242dc43 --- /dev/null +++ b/projects/moonbase.js @@ -0,0 +1,11 @@ +const { getUniTVL } = require("./helper/unknownTokens"); +module.exports = { + methodology: `Uses factory(0x44B678F32a2f6aBB72eeFA2df58f12D17c3eD403) address and whitelisted tokens address to find and price Liquidity Pool pairs`, + misrepresentedTokens: true, + arbitrum: { + tvl: getUniTVL({ + factory: "0x44B678F32a2f6aBB72eeFA2df58f12D17c3eD403", + useDefaultCoreAssets: true, + }), + }, +}; \ No newline at end of file diff --git a/projects/multichainMiner.js b/projects/multichainMiner.js index d596b66ca83..2b58694579d 100644 --- a/projects/multichainMiner.js +++ b/projects/multichainMiner.js @@ -1,16 +1,17 @@ +const ADDRESSES = require('./helper/coreAssets.json') const sdk = require("@defillama/sdk"); const { getChainTransform, getFixBalances } = require("./helper/portedTokens"); const minedTokens = { 'cake': '0x0e09fabb73bd3ade0a17ecc321fd13a19e81ce82', - 'busd': '0xe9e7cea3dedca5984780bafc599bd69add087d56', - 'matic': '0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270', - 'ftm': '0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83', - 'avax': '0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7', - 'usdc': '0x2791bca1f2de4661ed88a30c99a7a9449aa84174', // polygon + 'busd': ADDRESSES.bsc.BUSD, + 'matic': ADDRESSES.polygon.WMATIC_2, + 'ftm': ADDRESSES.fantom.WFTM, + 'avax': ADDRESSES.avax.WAVAX, + 'usdc': ADDRESSES.polygon.USDC, // polygon 'doge': '0xba2ae424d960c26247dd6c32edc70b295c744c43', // bsc - 'eth': '0x2170ed0880ac9a755fd29b2688956bd959f933f8' // bsc + 'eth': ADDRESSES.bsc.ETH // bsc }; const minerContracts = { 'cake': '0xD5d38f1815b4555527DE075a584268E08c5909EA', @@ -22,20 +23,7 @@ const minerContracts = { 'doge': '0x026d814935a053D10abA9987e4D047Aa9369c97E', // bsc 'eth': '0x212A3A41a0e58CCdc86F013b003d4afF805a958c' // bsc }; -const abi = { - "constant": true, - "inputs": [], - "name": "getBalance", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" -}; +const abi = "uint256:getBalance"; const config = { bsc: { diff --git a/projects/mushrooms.js b/projects/mushrooms.js index 8ede6f38b48..8d9cbe8b0af 100644 --- a/projects/mushrooms.js +++ b/projects/mushrooms.js @@ -2,32 +2,8 @@ const sdk = require('@defillama/sdk') const { getChainTransform } = require('./helper/portedTokens') const { unwrapLPsAuto, } = require('./helper/unwrapLPs') const abi = { - balance: { - "inputs": [], - "name": "balance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - token: { - "inputs": [], - "name": "token", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, + balance: "uint256:balance", + token: "address:token", } const config = { diff --git a/projects/nervenetwork.js b/projects/nervenetwork.js index 1c889f1e021..66782d38ece 100644 --- a/projects/nervenetwork.js +++ b/projects/nervenetwork.js @@ -6,5 +6,8 @@ async function fetch(){ } module.exports = { + nuls: { + fetch + }, fetch } \ No newline at end of file diff --git a/projects/neuronswap.js b/projects/neuronswap.js index 524a7b20036..9573a25c0ce 100644 --- a/projects/neuronswap.js +++ b/projects/neuronswap.js @@ -1,22 +1,16 @@ -const { toUSDTBalances } = require("./helper/balances"); -const { get } = require('./helper/http') - -async function NRtvl() { - const response = await get("https://core.neuronswap.com/api/dashboard") - return toUSDTBalances(response.data.totalLp); -}; - -async function stakedNR() { - const response = await get("https://core.neuronswap.com/api/dashboard") - return toUSDTBalances(response.data.totalStakedNeuronPrice); -}; +const { getUniTVL, staking, } = require('./helper/unknownTokens') module.exports = { misrepresentedTokens: true, timetravel: false, methodology: `Tvl counts the tokens locked on AMM pools and staking counts the NR that has been staked. Data is pulled from the 'https://core.neuronswap.com/api/dashboard'`, klaytn: { - tvl: NRtvl, - staking: stakedNR, + tvl: getUniTVL({ factory: '0xe334e8c7073e9aaae3cab998eecca33f56df6621', useDefaultCoreAssets: true, }), + staking: staking({ + tokens: ['0x340073962a8561cb9e0c271aab7e182d5f5af5c8'], + owner: '0x92a47a5c6b742b2056f0f4afb7724112c83715e1', + lps: ['0x908a4E95b447bD2e0fd7c020618Ab84b5d6FFc87'], + useDefaultCoreAssets: true, + }), }, }; \ No newline at end of file diff --git a/projects/nft20.js b/projects/nft20.js index 04d6b13b8e9..8751ae41dc7 100644 --- a/projects/nft20.js +++ b/projects/nft20.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('./helper/coreAssets.json') const sdk = require("@defillama/sdk") const axios = require("axios") const { staking } = require("./helper/staking"); @@ -8,8 +9,8 @@ const MUSE_ETH_univ2 = '0x20d2c17d1928ef4290bf17f922a10eaa2770bf43' const MUSE_ETH_univ2_staking = '0x193b775af4bf9e11656ca48724a710359446bf52' const abi = { - 'uni_v2_getPair': {"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"getPair","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"}, - 'uni_v3_getPool': {"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint24","name":"","type":"uint24"}],"name":"getPool","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"} + uni_v2_getPair: "function getPair(address, address) view returns (address)", + uni_v3_getPool: "function getPool(address, address, uint24) view returns (address)", } const nft20_rest_api_base = 'https://api.nft20.io/pools?perPage=2000&page=1' @@ -20,14 +21,14 @@ const contracts = { '0x5c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f', // univ2_factory_ethereum, '0xC0AEe478e3658e2610c5F7A4A2E1777cE9e4f2Ac' // sushiv1_factory_ethereum ], - weth: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', + weth: ADDRESSES.ethereum.WETH, univ3_factory: '0x1f98431c8ad98523631ae4a59f267346ea31f984', transform: addr => addr, }, polygon: { nft20_rest_api: nft20_rest_api_base + '&network=1', uni_v2_factories: ['0xc35DADB65012eC5796536bD9864eD8773aBc74C4'], // sushiv1_factory_polygon - weth: '0x7ceb23fd6bc0add59e62ac25578270cff1b9f619', + weth: ADDRESSES.polygon.WETH_1, univ3_factory: [], transform: addr => `polygon:${addr}`, } @@ -42,7 +43,7 @@ function chainTvl(chain) { // Retrieve pools using REST API let nft20_pools = (await axios.get(nft20_rest_api)).data.data // ?perPage=20&page=1&sortBy=pool_users const nft20_lp_usd_balance = nft20_pools.reduce((acc, p) => parseFloat(p['lp_usd_balance']) + acc, 0) - console.log(`${chain}: nft20 pools count: ${nft20_pools.length}\n${chain}: nft20 usd balance of LP returned by API: ${(nft20_lp_usd_balance/1e6).toFixed(2)}M`) + sdk.log(`${chain}: nft20 pools count: ${nft20_pools.length}\n${chain}: nft20 usd balance of LP returned by API: ${(nft20_lp_usd_balance/1e6).toFixed(2)}M`) // Get LPs addresses of UNI_v2 and SUSHI_v1 pools const calls_v2 = nft20_pools @@ -76,7 +77,7 @@ function chainTvl(chain) { }) ).output - const LPs = [...uni_v2_LPs, ...uni_v3_LPs].filter(lp => lp.output !== '0x0000000000000000000000000000000000000000') + const LPs = [...uni_v2_LPs, ...uni_v3_LPs].filter(lp => lp.output !== ADDRESSES.null) const weth_LPs = ( await sdk.api.abi.multiCall({ calls: LPs.map(pool => ({ diff --git a/projects/niifi.js b/projects/niifi.js index d04129c7624..2872bf0acd6 100644 --- a/projects/niifi.js +++ b/projects/niifi.js @@ -3,6 +3,6 @@ const { getUniTVL } = require('./helper/unknownTokens') module.exports = { misrepresentedTokens: true, nahmii: { - tvl: getUniTVL({ factory: '0xe3DcF89D0c90A877cD82283EdFA7C3Bd03e77E86', chain: 'nahmii', useDefaultCoreAssets: true }), + tvl: getUniTVL({ factory: '0xe3DcF89D0c90A877cD82283EdFA7C3Bd03e77E86', useDefaultCoreAssets: true }), } }; // node test.js projects/niifi.js \ No newline at end of file diff --git a/projects/o3swap.js b/projects/o3swap.js index 2884948a4c7..01847286c77 100644 --- a/projects/o3swap.js +++ b/projects/o3swap.js @@ -1,10 +1,17 @@ const { default: BigNumber } = require('bignumber.js'); -const { fetchURL } = require('./helper/utils') +const { get } = require('./helper/http') + +let data + +async function getData() { + if (!data) data = get('https://api.o3swap.com/v1/statistics') + return data +} async function fetch() { - const tvl = await fetchURL('https://api.o3swap.com/v1/statistics') + const tvl = await getData() let totalTvl = new BigNumber(0) - tvl.data.data.tvls.forEach(item => { + tvl.data.tvls.forEach(item => { totalTvl = totalTvl.plus(new BigNumber(item.tvl)) }); return totalTvl.toFixed(); @@ -23,7 +30,8 @@ const chains = { celo: 42220, kcc: 321, cube: 1818, - astar: 592 + astar: 592, + bitgert: 32520 } module.exports = { @@ -32,8 +40,8 @@ module.exports = { ...exp, [chain]: { fetch: async () => { - const tvl = await fetchURL('https://api.o3swap.com/v1/statistics') - return tvl.data.data.tvls.find(item => item.chain_id === id).tvl + const tvl = await getData() + return tvl.data.tvls.find(item => item.chain_id === id).tvl } } } diff --git a/projects/oakfarm.js b/projects/oakfarm.js index 72a84398aa9..249e7d04cf7 100644 --- a/projects/oakfarm.js +++ b/projects/oakfarm.js @@ -3,71 +3,11 @@ const { unwrapLPsAuto } = require('./helper/unwrapLPs') const sdk = require('@defillama/sdk') const abi = { - poolInfo: { - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "poolInfo", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "lpToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "allocPoint", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastRewardBlock", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accSushiPerShare", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - token: { - "inputs": [], - "name": "token", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - balance: { - "inputs": [], - "name": "balance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, + poolInfo: "function poolInfo(uint256) view returns (address lpToken, uint256 allocPoint, uint256 lastRewardBlock, uint256 accSushiPerShare)", + token: "address:token", + balance: "uint256:balance", } + const mcExports = masterchefExports({ chain: 'okexchain', @@ -83,36 +23,22 @@ const config = { '0x85fa637524da5a438df26b85fd55c8ce759168b1', '0xfb75a5998dff36862571fb93b9953b78d33401d7', '0xa8c3fccd40018bf16e152bef3abc66c245a942c0', - '0xb8f2c41d33d11fa2e06407ba8b0e09abdb7d6fa1', '0xd51524bb57bac2287135f9651984fb4b3e0aea35', '0xd730dab3aff9dd845b3054f4de0a9e935d125b58', ], }, - // bsc: { - // vaults: Object.values({ - // cake_maximizer_cake_bnb: '0xDcf55Cc791Ef7c04Da67625b00aD38CbbdC211F4', - // cake_maximizer_usdt_busd: '0x8204E97267309D880f8430f6E20c1a39AF96D568', - // cake_maximizer_busd_bnb: '0x3a90bC01eB56Dc9ae5460705711F678Ae84240BE', - // cake_maximizer_bp_bnb: '0x7Ceed8Ad4D242CA3a5d88ED482dA7Cd92Bcb36c8' - // }) - // } } module.exports = {}; Object.keys(config).forEach(chain => { module.exports[chain] = { - tvl: async (_, _b, { [chain]: block }) => { + tvl: async (_, _b, { [chain]: block }, { api }) => { const balances = {} const { vaults } = config[chain] - const calls = vaults.map(i => ({ target: i })) - const { output: tokens } = await sdk.api.abi.multiCall({ - abi: abi.token, calls, chain, block, - }) - const { output: bal } = await sdk.api.abi.multiCall({ - abi: abi.balance, calls, chain, block, - }) - tokens.forEach(({ output: token, }, i) => sdk.util.sumSingleBalance(balances, `${chain}:${token}`, bal[i].output)) + const tokens = await api.multiCall({ abi: abi.token, calls: vaults }) + const bal = await api.multiCall({ abi: abi.balance, calls: vaults }) + tokens.forEach((token, i) => sdk.util.sumSingleBalance(balances, `${chain}:${token}`, bal[i])) await unwrapLPsAuto({ balances, chain, block, }) return balances } diff --git a/projects/oaswap.js b/projects/oaswap.js index 435f6984c4e..12026b8bb93 100644 --- a/projects/oaswap.js +++ b/projects/oaswap.js @@ -1,6 +1,6 @@ const { getUniTVL } = require('./helper/unknownTokens') module.exports = { oasis: { - tvl: getUniTVL({ factory: '0x84b11e8fb9a5dE10347eEA24c73d02B835505FDd', chain: 'oasis', useDefaultCoreAssets: true }), + tvl: getUniTVL({ factory: '0x84b11e8fb9a5dE10347eEA24c73d02B835505FDd', useDefaultCoreAssets: true }), } }; \ No newline at end of file diff --git a/projects/occam.js b/projects/occam.js index 88d26dac937..4b658018b9b 100644 --- a/projects/occam.js +++ b/projects/occam.js @@ -1,6 +1,6 @@ const { getUniTVL } = require('./helper/unknownTokens') module.exports = { milkomeda: { - tvl: getUniTVL({ factory: '0x2ef06A90b0E7Ae3ae508e83Ea6628a3987945460', chain: 'milkomeda', useDefaultCoreAssets: true }), + tvl: getUniTVL({ factory: '0x2ef06A90b0E7Ae3ae508e83Ea6628a3987945460', useDefaultCoreAssets: true }), } } diff --git a/projects/only1.js b/projects/only1.js index 764b7a4dc34..94706694f6d 100644 --- a/projects/only1.js +++ b/projects/only1.js @@ -1,13 +1,10 @@ -const axios = require("axios") +const { getConfig } = require('./helper/cache') const { sumTokens2 } = require('./helper/solana') async function staking() { - // const { data } = await axios.get("https://us-central1-only1-staking-stats.cloudfunctions.net/tvl") - const { data: { data } } = await axios.get("https://api.only1.app/staking-pools?limit=100&sort=numTokensLocked%3Adesc") - const { data: { data: data1 } } = await axios.get("https://api.only1.app/staking-pools?limit=100&page=2&sort=numTokensLocked%3Adesc") + const { data } = await getConfig('only1-solana',"https://api-edge.only1.app/staking-pools") - data.push(...data1) - const owners = data.map(i => i.address) + const owners = data.map(i => i.publicKey) return sumTokens2({ tokens: ['3bRTivrVsitbmCTGtqwp7hxXPsybkjn4XLNtPsHqa3zR'], owners, }) } diff --git a/projects/openocean.js b/projects/openocean.js index 5ed132dae64..6a497757672 100644 --- a/projects/openocean.js +++ b/projects/openocean.js @@ -1,35 +1,38 @@ -const { getUniTVL, getLPData } = require('./helper/unknownTokens') -const { sumTokens2 } = require('./helper/unwrapLPs') +const { getUniTVL } = require('./helper/unknownTokens') const { staking } = require('./helper/staking') module.exports = { bsc: { tvl: getUniTVL({ - chain: 'bsc', factory: '0xd76d8c2a7ca0a1609aea0b9b5017b3f7782891bf', useDefaultCoreAssets: true, }), - staking: staking('0x44eB0f1ce777394564070f9E50dD8784FCDB7e6a', '0x9029fdfae9a03135846381c7ce16595c3554e10a', 'bsc') + staking: staking('0x44eB0f1ce777394564070f9E50dD8784FCDB7e6a', '0x9029fdfae9a03135846381c7ce16595c3554e10a') }, ethereum: { - tvl: async (_, block) => { // work around since I dont know how to get factory - const data = await getLPData({ lps: [ - '0x3c647b36e30f4be590dcea349a0ecf8c259660af', - '0x9f872cd72521a6189ddf25cd752e6386129647d9', - '0x61583697a9f4dc2e40ea6afec2502c4a76a8785d', - '0x526648286569cefc133ce78f5f7b519c1c6862e0', - ], allLps: true, block, }) - const toa = Object.entries(data).map(([lp, tokens]) => Object.values(tokens).map(t => [t, lp])).flat() - return sumTokens2({ tokensAndOwners: toa, block, }) - }, + tvl: getUniTVL({ + factory: '0x1f8c25f8da3990ecd3632ee4f02c2ea37755c3c6', + useDefaultCoreAssets: true, + }), staking: staking('0xb99d38eb69214e493b1183ffa3d561fc9f75d519', '0x7778360f035c589fce2f4ea5786cbd8b36e5396b',) }, avax: { tvl: getUniTVL({ - chain: 'avax', factory: '0x042AF448582d0a3cE3CFa5b65c2675e88610B18d', useDefaultCoreAssets: true, }), - staking: staking('0x4C431b568e8baAB20F004BB16E44570e8E0cD6D7', '0x0ebd9537a25f56713e34c45b38f421a1e7191469', 'avax') + staking: staking('0x4C431b568e8baAB20F004BB16E44570e8E0cD6D7', '0x0ebd9537a25f56713e34c45b38f421a1e7191469') }, + polygon: { + tvl: getUniTVL({ + factory: '0xd76d8C2A7CA0a1609Aea0b9b5017B3F7782891bf', + useDefaultCoreAssets: true, + }), + }, + kava: { + tvl: getUniTVL({ + factory: '0x6dd434082EAB5Cd134B33719ec1FF05fE985B97b', + useDefaultCoreAssets: true, + }) + } } diff --git a/projects/oraichain.js b/projects/oraichain.js index 5616d952de7..26db097ac40 100644 --- a/projects/oraichain.js +++ b/projects/oraichain.js @@ -1,10 +1,11 @@ +const ADDRESSES = require('./helper/coreAssets.json') const sdk = require("@defillama/sdk"); const { unwrapUniswapLPs } = require("./helper/unwrapLPs") const { transformBscAddress } = require("./helper/portedTokens"); const BigNumber = require('bignumber.js'); const { sumSingleBalance } = require("@defillama/sdk/build/generalUtil"); -const usdtAddress = '0xdac17f958d2ee523a2206206994597c13d831ec7'; +const usdtAddress = ADDRESSES.ethereum.USDT; const oraichainToken = { 'bsc': '0xa325ad6d9c92b55a3fc5ad7e412b1518f96441c0', @@ -70,7 +71,7 @@ async function tvl(chainBlocks, chain, transform=a=>a) { } return balances; -}; +} async function ethTvl(timestamp, ethBlock, chainBlocks) { let balances = await tvl(chainBlocks, 'ethereum'); @@ -83,11 +84,11 @@ async function ethTvl(timestamp, ethBlock, chainBlocks) { })).output; sdk.util.sumSingleBalance(balances, usdtAddress, usdtBalance); return balances; -}; +} async function bscTvl(timestamp, ethBlock, chainBlocks) { return await tvl(chainBlocks, 'bsc', await transformBscAddress()); -}; +} module.exports = { ethereum: { diff --git a/projects/pactfi.js b/projects/pactfi.js index d9717609841..9f194b0b56a 100644 --- a/projects/pactfi.js +++ b/projects/pactfi.js @@ -1,9 +1,11 @@ const { get } = require('./helper/http') + + async function fetch() { - return ( - await get("https://api.pact.fi/api/pools/all?ordering=-tvl_usd") - ).map(p => p.tvl_usd).reduce((a, b) => a + parseFloat(b), 0); -}; + const global_data = await get("https://api.pact.fi/api/global_stats") + return parseFloat(global_data.tvl) +} + module.exports = { algorand: { diff --git a/projects/paraswap.js b/projects/paraswap.js index 589e6fb0da5..488964c1399 100644 --- a/projects/paraswap.js +++ b/projects/paraswap.js @@ -1,44 +1,25 @@ -const sdk = require("@defillama/sdk") -const BigNumber = require("bignumber.js") -const axios = require("axios") -const {sumBalancerLps} = require("./helper/unwrapLPs.js") +const {sumTokens2, } = require("./helper/unwrapLPs.js") +const { getConfig } = require("./helper/cache.js") // PSP staking for sPSP in each PMM pool (used for signalling amon other things) const PSP = '0xcafe001067cdef266afb7eb5a286dcfd277f3de5' const pools_url = 'https://api.paraswap.io/staking/pools/1' -async function staking(timestamp, ethBlock, chainBlocks) { - const {data} = await axios.get(pools_url) - const pools = data.pools.map(p => p.address) - - const poolsBalances = ( - await sdk.api.abi.multiCall({ - calls: pools.map(sPSP => ({target: PSP, params: sPSP})), - abi: 'erc20:balanceOf', - block: ethBlock, - chain: 'ethereum' - }) - ).output - - const balances = {} - poolsBalances.forEach(t => { - const token = t.input.target - balances[token] = (new BigNumber(balances[token] || "0").plus(new BigNumber(t.output)) ).toString(10) - }) - return balances +async function staking(timestamp, ethBlock, chainBlocks, { api }) { + const data = await getConfig('paraswap', pools_url) + const owners = data.pools.map(p => p.address).concat(["0x716fBC68E0c761684D9280484243FF094CC5FfAB"]) + return sumTokens2({ api, owners, tokens: [PSP]}) } // Safety Module staking of 20WETH_80PSP balancer LP // pool2(safetyModuleBalStaking, balancerLP_20WETH_80PSP, "ethereum") // not working as it is a balancer and not a uniswap LP const balancerLP_20WETH_80PSP = '0xcb0e14e96f2cefa8550ad8e4aea344f211e5061d' const safetyModuleBalStaking = '0xc8dc2ec5f5e02be8b37a8444a1931f02374a17ab' -async function safetyModuleStaking(timestamp, ethBlock, chainBlocks) { - const balances = {} - await sumBalancerLps(balances, [[balancerLP_20WETH_80PSP, safetyModuleBalStaking]], ethBlock, 'ethereum', a=>a) - return balances +async function safetyModuleStaking(timestamp, ethBlock, chainBlocks, { api }) { + return sumTokens2({ api, owners: [safetyModuleBalStaking, "0x593F39A4Ba26A9c8ed2128ac95D109E8e403C485"], tokens: [balancerLP_20WETH_80PSP]}) } module.exports = { - methodology: "PSP can be staked in staking pools, one pool per Private Market Maker, to signal and share the PMM benefits", + methodology: "PSP can be staked either on its single asset sePSP pool or 2x boosted sePSP2, an 80/20 balancer pool. Staking allows users to receive Revenue based on their boosted actions.", ethereum: { staking, pool2: safetyModuleStaking, diff --git a/projects/parrot.js b/projects/parrot.js index 20f832c5c92..5c32b39cdf7 100644 --- a/projects/parrot.js +++ b/projects/parrot.js @@ -1,134 +1,16 @@ -const { getTokenBalance, getTokenSupply } = require('./helper/solana') -async function tvl() { - const [ - usdcEarn, btcSbrEarn, solMerPai, usdTriEarn, - usdcUstSbrEarn, solprtSbrEarn, usdcRayEarn, solPai, solPsol, - btcRenP, btcRenPai, srmPai, usdtPai, solPrtP, - usdcPbtc, usdcUsdtSbrEarn, solRayEarn, usdcPai, btcPbtc, - solmSbrEarn, - // invested - iUsdcEarn, iSbrBtcEarn1, iSbrBtcEarn2, iMerTriUsdEarn1, iMerTriUsdEarn2, - iMerUsdcUsdtPai, - iSbrUsdcUsdtEarn1, iSbrUsdcUsdtEarn2, iSbrUsdcUsdtEarn3, - iSbrUstUsdcEarn1, iSbrUstUsdcEarn2, iSbrUstUsdcEarn, - iSbrMSolSolEarn1, iSbrMSolSolEarn2, - iSabPrtSolSolEarn1, iSabPrtSolSolEarn2, - - // staked - sPoolSupplySol - ] = await Promise.all([ - //getTokenBalance('mint', 'vaultTypePDA') https://doc.parrot.fi/security/inspect.html - - //USDC:PAI+EARN YES - getTokenBalance("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", "AjExAjiLEDLLka42n1biVs5akE5qJ6gNTHH8JKByxW4h"), - //SBR LP (BTC-renBTC):pBTC+EARN YES - getTokenBalance("SLPbsNrLHv8xG4cTc4R5Ci8kB9wUPs6yn6f7cKosoxs", "Cz5G4RkGdEFN4BACZHJnTW67GUcVzdSi4jAH2E173pkK"), - //MER LP (pSOL-SOL):PAI NO - getTokenBalance("GHhDU9Y7HM37v6cQyaie1A3aZdfpCDp6ScJ5zZn2c3uk", "nkNjtZMzxhFsb3hEWvA5cvsX1otTrKkTd1DnS177bd3"), - //MER LP (USDC-USDT-UST):PAI+EARN NO - getTokenBalance("57h4LEnBooHrKbacYWGCFghmrTzYPVn8PwZkzTzRLvHa", "6EnWVbLNijTPNQEy73MvkPcDeyEvChiKeMY2aVvMtvkC"), - - //PTT:PAI Parrot Test Token - // getTokenBalance("E2Ub8wPfxxEvdrtumbfeL2HaQHgpd3gUGkDxDmmgN3p9", "4wqB5wkBbQu4E4V3RofEJmy2zgHh354nvvPqhZw2ySVc"), - - //SBR LP (UST-USDC):PAI+EARN NO - getTokenBalance("UST32f2JtPGocLzsL41B3VBBoJzTm1mK1j3rwyM3Wgc", "9zJi3M2wWeafjt9eyPh9iGNovuFeM4xrdtzen1sKSjeb"), - //SBR LP (prtSOL-SOL):pSOL+EARN NO - getTokenBalance("PrsVdKtXDDf6kJQu5Ff6YqmjfE4TZXtBgHM4bjuvRnR", "9jCNEAn4PUNwGvpQikHjt1Udv1z58gf1Yb5x5bmE7y1k"), - //RAY LP (MER-USDC):PAI+EARN NO - getTokenBalance("3H9NxvaZoxMZZDZcbBDdWMKbrfNj7PCF5sbRwDr7SdDW", "5xbHeB7BS7YJAChLamfdeFna5HPxj481KQrymxJnH4S2"), - //wSOL:PAI - getTokenBalance("So11111111111111111111111111111111111111112", "62Xb5ydBN1vrkg85SuKEL6aPv4bsy6iTiH3Jvki8NfNr"), - //mSOL:pSOL - getTokenBalance("mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So", "GJU8CWPYSg6Zu4jpMN9M9JSxaftm54NjpZe6QPtiVeXK"), - - //renBTC:pBTC - getTokenBalance("CDJWUqTcYTVAKXAVXoQZFes5JUFc7owSeq7eMQcDSbo5", "6HE83GFg4odsntioHrNrWHyyBeJR1644c3b2yLNV8LDN"), - //renBTC:PAI - getTokenBalance("CDJWUqTcYTVAKXAVXoQZFes5JUFc7owSeq7eMQcDSbo5", "7Efka6Lp7i1zUdQxwCpVpCKkiU52t9HR8QULir3K6oBe"), - //SRM:PAI - getTokenBalance("SRMuApVNdxXokk5GT7XD5cUUgXMBCoAz2LHeuAoKWRt", "q96RZiNkec9PAfLtgrJaGLvXSK9fxs4DQ1g6RbiSvJg"), - //USDT:PAI - getTokenBalance("Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB", "DGi3TxcKUq3E5t1mL33n9jRgdWWKngeRkP3fUppG4inn"), - //prtSOL:pSOL - getTokenBalance("BdZPG9xWrG3uFrx2KrUW1jT4tZ9VKPDWknYihzoPRJS3", "tjXrYz2USzesD9YUXWoW8UJRAmkQ3dwSmzfYDN6bifk"), +const { Program } = require("@project-serum/anchor"); +const { getProvider, sumTokens2, } = require("./helper/solana"); - //USDC:pBTC - getTokenBalance("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", "DQV7nFUWKSsiT7eWPhfGhdiRFsU1DmnEYgbFGKuPPsMs"), - //SBR LP (USDC-USDT):PAI+EARN - getTokenBalance("2poo1w1DL6yd2WNTCnNTzDqkC6MBXq7axo77P16yrBuf", "AvfKigSXwRKXNQ9PTeUDWQnMdZWz2j6oH569t96S1Md5"), - //RAY LP (SOL-USDC):PAI+EARN - getTokenBalance("8HoQnePLqPj4M7PUDzfw8e3Ymdwgc7NLGnaTUapubyvu", "4zTNPK46rsRNRCpbkGChBaEZZYYMoZ7YaBEn51yfBHuW"), - //USDC:PAI - getTokenBalance("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", "DefDiDiauGqS8ZUiHHuRCpmt8XZPGTTp6DY7UQP5NkkP"), - //BTC (sollet):pBTC - getTokenBalance("9n4nbM75f5Ui33ZbPYXn59EwSgE8CGsHtAeTH5YFeJ9E", "CkgNPPZasMZJyNsefrTGgG8shZ87W1CAcXCHjhjwAEUW"), - - //SBR LP (mSOL-SOL):pSOL+EARN - getTokenBalance("SoLEao8wTzSfqhuou8rcYsVoLjthVmiXuEjzdNPMnCz", "A8gtS5FV2UgjCjKxAEPm6aCXjPQaaeiZJKeGJnR1adCs"), - - // ----- INVESTED VAULTS ----- - - // USDC:PAI+EARN - getTokenBalance("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", "E82ho9Mc1xKmL6aPpDneFMobDywiRM5PuPa7AMcEhofw"), - // SBR LP (BTC-renBTC):pBTC+Earn (1) - getTokenBalance("SLPbsNrLHv8xG4cTc4R5Ci8kB9wUPs6yn6f7cKosoxs", "Gmzr6b6iPWKvWQtCmqL9yB6hYGec8Rv3XksmMT2VThDg"), - // SBR LP (BTC-renBTC):pBTC+Earn (2: sunny) - getTokenBalance("9Re318zAqN2VxT9fELUJxhJkZ7zyEhLXMxW4gCoxqbwc", "HU6JgiEGGzPCMHXbJbuNTNniTDUkHntMML9PJZLrJttT"), - // MER LP (USDC-USDT-UST):PAI+Earn (1) - getTokenBalance("57h4LEnBooHrKbacYWGCFghmrTzYPVn8PwZkzTzRLvHa", "E82ho9Mc1xKmL6aPpDneFMobDywiRM5PuPa7AMcEhofw"), - // MER LP (USDC-USDT-UST):PAI+Earn (2) - getTokenBalance("57h4LEnBooHrKbacYWGCFghmrTzYPVn8PwZkzTzRLvHa", "4Xjmy2UMdj6WsHHpUUw7bZJWbusyPNYj3aNQMJa4ayxT"), - // MER LP (USDC-USDT-PAI) - getTokenBalance("9s6dXtMgV5E6v3rHqBF2LejHcA2GWoZb7xNUkgXgsBqt", "E82ho9Mc1xKmL6aPpDneFMobDywiRM5PuPa7AMcEhofw"), - // SBR LP (USDC-USDT):PAI+Earn (1) - getTokenBalance("2poo1w1DL6yd2WNTCnNTzDqkC6MBXq7axo77P16yrBuf", "BLzKZp83pw6ESC7Ks19uUMce81HEthMWonavsYFRKxvE"), - // SBR LP (USDC-USDT):PAI+Earn (2) - getTokenBalance("2poo1w1DL6yd2WNTCnNTzDqkC6MBXq7axo77P16yrBuf", "9mazCmauvJ1bz8whGG6XF7jFCvdJz6r7n24kHkQyei8w"), - // SBR LP (USDC-USDT):PAI+Earn (3: sunny) - getTokenBalance("DtYJRBbkHbSP1H8Gc3iAAEeBWfm3cPHqQqRW8Xrmu5xs", "4S7KVrXcQiF8Y23swSVpodzyLrruKhQ6mou62mdv2hHg"), - // SBR LP (UST-USDC):PAI+Earn (1) - getTokenBalance("UST32f2JtPGocLzsL41B3VBBoJzTm1mK1j3rwyM3Wgc", "HSaGLKsiHDGUbXZRNrQ9R6WWmxjtoKZToSCUgcxpiuNj"), - // SBR LP (UST-USDC):PAI+Earn (2) - getTokenBalance("UST32f2JtPGocLzsL41B3VBBoJzTm1mK1j3rwyM3Wgc", "CsmHqWmq5KHNpQ6YkffiByqdp23zphHqN27orXb1gkye"), - // SBR LP (UST-USDC):PAI+Earn (3: sunny) - getTokenBalance("HoSvqUMwQsiHbykioLW4Wu1BgFB34kSVByW223ACqDz3", "9V5NgpvTSd4JbiWLY3EupiZVTZDJK6Q1JWwkfob5kJP1"), - // SBR LP (mSOL-SOL):pSOL+Earn (1) - getTokenBalance("SoLEao8wTzSfqhuou8rcYsVoLjthVmiXuEjzdNPMnCz", "4iP8x3kMB3TJGhtpkng17wdHXyo4jj99K1N2Bk6mu3pW"), - // SBR LP (mSOL-SOL):pSOL+Earn (2: sunny) - getTokenBalance("3SfwMcnxtQQCM83ADxcp3VoTriLrL1WueuKZmuquTLiz", "7yN3Nx9QUThQFXnQdYGuYj1VypyzAdbRnHUFKgVoGyye"), - // SBR LP (prtSOL-SOL):pSOL+Earn (1) - getTokenBalance("PrsVdKtXDDf6kJQu5Ff6YqmjfE4TZXtBgHM4bjuvRnR", "B2MadbQ6LmdKo1fCz4cbbuXKDMtzRmZZPSCCUUJfApmb"), - // SBR LP (prtSOL-SOL):pSOL+Earn (2: sunny) - getTokenBalance("CNE9khSS1NdgP3Uf7woYKsCDrohgVpigfvDkCg2CqtC7", "FB81RMPyPtFQ1xb25RdBof8xBgtMVVXcfGBg8fWUwgyz"), - - // Stake pool total supply - getTokenSupply("BdZPG9xWrG3uFrx2KrUW1jT4tZ9VKPDWknYihzoPRJS3") - ]) - return { - 'usd-coin': usdcEarn + usdcPbtc + usdcPai + usdcUstSbrEarn + (usdTriEarn / 3) - + iUsdcEarn + (iMerTriUsdEarn1 / 3) + (iMerTriUsdEarn2 / 3) - + iSbrUsdcUsdtEarn1 / 2 + iSbrUsdcUsdtEarn2 / 2 + iSbrUsdcUsdtEarn3 / 2 - + iSbrUstUsdcEarn1 / 2 + iSbrUstUsdcEarn2 / 2 - + iMerUsdcUsdtPai / 3 - + iSbrUstUsdcEarn / 2, - 'terrausd': usdcUstSbrEarn + (usdTriEarn / 3) - + (iMerTriUsdEarn1 / 3) + (iMerTriUsdEarn2 / 3) - + iSbrUstUsdcEarn1 / 2 + iSbrUstUsdcEarn2 / 2 - + iSbrUstUsdcEarn / 2, - 'tether': usdtPai + usdcUsdtSbrEarn + (usdTriEarn / 3) - + (iMerTriUsdEarn1 / 3) + (iMerTriUsdEarn2 / 3) - + iSbrUsdcUsdtEarn1 / 2 + iSbrUsdcUsdtEarn2 / 2 + iSbrUsdcUsdtEarn3 / 2, - 'solana': solPai + solPrtP + solPsol + solmSbrEarn + solprtSbrEarn + solRayEarn + solMerPai - + iSbrMSolSolEarn1 + iSbrMSolSolEarn2 + iSabPrtSolSolEarn1 + iSabPrtSolSolEarn2 + sPoolSupplySol, - 'serum': srmPai, - 'renbtc': btcRenP + btcRenPai, - 'bitcoin': btcPbtc + btcSbrEarn + iSbrBtcEarn1 + iSbrBtcEarn2, - } +async function tvl() { + const provider = getProvider() + const idl = await Program.fetchIdl('HajXYaDXmohtq2ZxZ6QVNEpqNn1T53Zc9FnR1CnaNnUf', provider) + const program = new Program(idl, 'HajXYaDXmohtq2ZxZ6QVNEpqNn1T53Zc9FnR1CnaNnUf', provider) + const pools = await program.account.vaultType.all() + return sumTokens2({ tokenAccounts: pools.map(i => i.account.collateralTokenHolder.toString()), blacklistedTokens: ['PRT88RkA4Kg5z7pKnezeNH4mafTvtQdfFgpQTGRjz44'], }) } + module.exports = { - timetravel: false, - solana: { tvl }, - methodology: `To obtain the Parrot TVL we make on-chain calls using the function getTokenBalance() that uses the token addresses and the vault addresses where deposits are made to mint PAI, pBTC or pSOL. Hence, the addresses used are the addresses that hold the collateral for the protocol and these addresses are hard-coded. The calls made return the number of tokens held in each contract for us to then use Coingecko to get the price of each token in USD and export the sum of all tokens. Since the Mercurial and Saber LP tokens that are used as collateral have a virtual price of $1, these are counted as Tether. We also include SOL staked on prtSOL that is used for the liquidity staking program.`, + timetravel: false, + solana: { tvl, staking: async () => sumTokens2({ tokenAccounts: ['CJM5Un8AhMgLJv2mcj3o5z2z8H3deDzLA1TH7E3WhZQG']}) }, } diff --git a/projects/pegasusdao.js b/projects/pegasusdao.js index b97981f3182..8bc80b6bc68 100644 --- a/projects/pegasusdao.js +++ b/projects/pegasusdao.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('./helper/coreAssets.json') const { tombTvl } = require("./helper/tomb"); const sdk = require("@defillama/sdk"); const { getChainTransform } = require("./helper/portedTokens"); @@ -15,7 +16,7 @@ const shareLps = "0x72c1f5fb7e5513a07e1ff663ad861554887a0a0a"; const genesisPool = "0x64bfCBe4480B53E8234Ca258a96720F29fe6A6fB"; const genesisTokens = [ "0x5c7f8a570d578ed84e63fdfa7b1ee72deae1ae23", - "0xc21223249ca28397b4b6541dffaecc539bff0c59", + ADDRESSES.cronos.USDC, "0x97749c9b61f878a880dfe312d2594ae07aed7656", "0xb8df27c687c6af9afe845a2afad2d01e199f4878", "0x43713f13a350d104319126c13cd7402822a44f6b" @@ -66,7 +67,7 @@ async function tvl(timestamp, block, chainBlocks) { delete balances[`cronos:${PES}`]; await unwrapLPsAuto({ balances, block: chainBlocks.cronos, chain: 'cronos', }) return balances; -}; +} addToExports('cronos', 'tvl', tvl) diff --git a/projects/pika.js b/projects/pika.js index 380ff92c3e5..9744d4fae37 100644 --- a/projects/pika.js +++ b/projects/pika.js @@ -1,16 +1,11 @@ -const { sumTokens2 } = require('./helper/unwrapLPs') -const chain = 'optimism' - -async function tvl(_, _b, { [ chain]: block }) { - const owners = [ - '0x2FaE8C7Edd26213cA1A88fC57B65352dbe353698', '0xD5A8f233CBdDb40368D55C3320644Fb36e597002', - ] - const tokens = ['0x7f5c764cbc14f9669b88837ca1490cca17c31607'] - return sumTokens2({ chain, block, owners, tokens, }) -}; +const ADDRESSES = require('./helper/coreAssets.json') +const { sumTokensExport } = require('./helper/unwrapLPs') module.exports = { optimism: { - tvl + tvl: sumTokensExport({ owners: [ + '0x2FaE8C7Edd26213cA1A88fC57B65352dbe353698', + '0xD5A8f233CBdDb40368D55C3320644Fb36e597002', + ], tokens: [ADDRESSES.optimism.USDC]}) } } \ No newline at end of file diff --git a/projects/pinyottas.js b/projects/pinyottas.js index 4b8a959c849..f20449bcdd0 100644 --- a/projects/pinyottas.js +++ b/projects/pinyottas.js @@ -2,24 +2,9 @@ const sdk = require('@defillama/sdk'); const pinyottasContract = '0x2861e4d8e26b10029e5cd1d236239f810c664b99' -const abi = { - "getTokenContractsInPinyotta": { - "inputs":[{"internalType":"uint256","name":"_id","type":"uint256"}], - "name":"getTokenContractsInPinyotta", - "outputs":[{"internalType":"address[]","name":"tokenContracts","type":"address[]"}], - "stateMutability":"view", - "type":"function" - }, - "getTokenBalanceInPinyotta": { - "inputs":[ - {"internalType":"uint256","name":"_id","type":"uint256"}, - {"internalType":"address","name":"_tokenContract","type":"address"} - ], - "name":"getTokenBalanceInPinyotta", - "outputs":[{"internalType":"uint256","name":"balance","type":"uint256"}], - "stateMutability":"view", - "type":"function" - } +const abi = { + getTokenContractsInPinyotta: "function getTokenContractsInPinyotta(uint256 _id) view returns (address[] tokenContracts)", + getTokenBalanceInPinyotta: "function getTokenBalanceInPinyotta(uint256 _id, address _tokenContract) view returns (uint256 balance)", } async function tvl(timestamp, block, chainBlocks) { @@ -32,7 +17,7 @@ async function tvl(timestamp, block, chainBlocks) { chain: 'ethereum' }) ).output - console.log('nPinyottas', nPinyottas) + sdk.log('nPinyottas', nPinyottas) // Get contract of tokens held within each pinyotta const pinyottasIndices = Array.from(Array(parseInt(nPinyottas)).keys()); diff --git a/projects/pnetwork.js b/projects/pnetwork.js index b09e381a8bc..84515246066 100644 --- a/projects/pnetwork.js +++ b/projects/pnetwork.js @@ -1,54 +1,63 @@ -const axios = require('axios'); -const { getApiTvl } = require('./helper/historicalApi'); - -const historicalUrl = "https://pnetwork.watch/api/datasources/proxy/1/query?db=pnetwork-volumes-1&q=SELECT%20sum(%22tvl_number%22)%20FROM%20%22tvl_test%22%20WHERE%20time%20%3E%3D%201600150697388ms%20GROUP%20BY%20time(1d)%2C%20%22host_blockchain%22%3BSELECT%20sum(%22tvl_number%22)%20FROM%20%22tvl_test%22%20WHERE%20time%20%3E%3D%201600150697388ms%20GROUP%20BY%20time(1d)%20fill(null)&epoch=ms" -const currentUrl = "https://chart.ptokens.io/index.php?a=assets" -let _response - -function getChainTvl(chain) { - async function current() { - if (!_response) _response = axios.get(currentUrl) - let response = await _response - return response.data.filter(c => c.nativeBlockchain === chain && !['EFX', 'PNT',].includes(c.name)).reduce((total, asset) => total + asset.tvl_number, 0); - } +const { toUSDTBalances } = require('./helper/balances'); +const axios = require('axios') + +const data = {} + +const HOURS_12 = 12 * 60 * 60 * 1000 + +function getTvl(timestamp) { + const tsStr = '' + timestamp + if (!data[tsStr]) data[tsStr] = _getTvl() + return data[tsStr] + + async function _getTvl() { + timestamp = timestamp * 1e3 + const query = ` FROM "tvl_v2" WHERE time >= ${timestamp - HOURS_12}ms AND time <= ${timestamp + HOURS_12}ms GROUP BY time(1d)` + const queryObj = { + q: `SELECT sum("tvl_number")${query}, "host_blockchain";SELECT sum("tvl_number")${query} fill(null)`, + epoch: 'ms', + db: 'pnetwork-volumes-1', + } - async function historical() { - let response = await axios.get(historicalUrl) - return response.data.results[0].series.find(s => s.tags.host_blockchain === chain).values.map(d => ({ - date: d[0] / 1000, - totalLiquidityUSD: d[1] - })) + const { data: res } = await axios.get('https://pnetwork.watch/api/datasources/proxy/1/query', { params: queryObj }) + + const { results: [{ series }, sumTvl] } = res + const response = {} + + response.tvlTotal = getTvl(sumTvl.series[0].values) + series.forEach(({ tags: { host_blockchain }, values }) => response[chainMapping[host_blockchain]] = getTvl(values)) + if (!response.tvlTotal) throw new Error('Incorrect tvl') + + return response } - return async (time) => { - return getApiTvl(time, current, historical) + + function getTvl(values) { + return values.reduce((a, i) => a ? a : i[1], 0) } } -const chains = { - "ethereum": "eth", - "bsc": "bsc", - "eos": "eos", - "telos": "telos", - "bitcoin": "btc", - "ore": "ore", - "litecoin": "ltc", - "doge": "dogecoin", - "lbry": "lbry", - "rvn": "rvn", - "fantom": "fantom", - "polygon": "polygon", - "ultra": "ultra", - "xdai": "xdai", - // "algorand": "algorand", - // "arbitrum": "arbitrum", - // "luxochain": "luxochain", +const chainMapping = { + algorand: 'algorand', + arbitrum: 'arbitrum', + 'binance-smart-chain': 'bsc', + eosio: 'eos', + ethereum: 'ethereum', + libre: 'lbry', + polygon: 'polygon', + telos: 'telos', + ultra: 'ultra', } module.exports = { - timetravel: false, + misrepresentedTokens: true, methodology: 'Queries the pNetwork database, using the same API endpoint as their own UI. TVL is based on the amount of assets “locked” in the system and that therefore has a 1:1 tokenisation on a host blockchain, including all of the assets and all of the blockchains supported by pNetwork.' }; -Object.entries(chains).forEach(([chain, key]) => { - module.exports[chain] = { tvl: getChainTvl(key) } -}) +Object.values(chainMapping).forEach(chain => { + module.exports[chain] = { + tvl: async (ts) => { + const response = await getTvl(ts) + return toUSDTBalances(response[chain] || 0) + } + } +}) \ No newline at end of file diff --git a/projects/polymarket.js b/projects/polymarket.js index 1f29557da10..55d4f557f61 100644 --- a/projects/polymarket.js +++ b/projects/polymarket.js @@ -1,5 +1,6 @@ +const ADDRESSES = require('./helper/coreAssets.json') const sdk = require("@defillama/sdk"); -const { request, gql } = require("graphql-request"); +const { request, } = require("graphql-request"); const { BigNumber } = require("bignumber.js"); const utils = require('./helper/utils'); @@ -12,7 +13,7 @@ const utils = require('./helper/utils'); // # block: { number: $block } const graphUrl = 'https://api.thegraph.com/subgraphs/name/polymarket/matic-markets-5' -const graphQuery = gql` +const graphQuery = ` query GET_POLYMARKET($skip: Int, $block: Int) { conditions( first: 1000 @@ -75,20 +76,7 @@ async function getMarketsLiquidity_graphql(timestamp, block, chainBlocks) { // const polymarket_api_url = 'https://strapi-matic.poly.market/markets?_limit=-1&_sort=closed_time:desc' // &active=true const conditionalTokensContract = '0x4D97DCd97eC945f40cF65F87097ACe5EA0476045' -const polygonUsdcContract = '0x2791bca1f2de4661ed88a30c99a7a9449aa84174' -const polymarket_api_url = 'https://strapi-matic.poly.market/markets?_limit=-1&_sort=volume:desc' // &active=true -async function getMarketsLiquidity_api() { - let markets = await utils.fetchURL(polymarket_api_url) - // Filter out unwanted fields - markets = markets.data.map(({ id, slug, volume, liquidity, created_at, closed }) => ({id, slug, volume, liquidity, created_at, closed})); - markets.forEach(market => { - market.volume = Number(market.volume) || 0 - market.liquidity = Number(market.liquidity) || 0 - if (market.liquidity < 0) market.liquidity = 0 - }); - const marketsLiquidity = markets.reduce((acc, market) => acc.plus(BigNumber(market.liquidity)), BigNumber(0)); - return marketsLiquidity -} +const polygonUsdcContract = ADDRESSES.polygon.USDC async function polygon(timestamp, block, chainBlocks) { // Get markets liquidity using API diff --git a/projects/polyroll.js b/projects/polyroll.js index 104621c8cfb..3a81dcc7f81 100644 --- a/projects/polyroll.js +++ b/projects/polyroll.js @@ -1,10 +1,11 @@ +const ADDRESSES = require('./helper/coreAssets.json') const { sumTokensAndLPsSharedOwners } = require('./helper/unwrapLPs'); const { transformPolygonAddress } = require('./helper/portedTokens'); const tokens = [ - ['0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270', false], //WMATIC - ['0x7ceb23fd6bc0add59e62ac25578270cff1b9f619', false], //WETH - ['0xc2132d05d31c914a87c6611c10748aeb04b58e8f', false], //USDT + [ADDRESSES.polygon.WMATIC_2, false], //WMATIC + [ADDRESSES.polygon.WETH_1, false], //WETH + [ADDRESSES.polygon.USDT, false], //USDT ['0x831753dd7087cac61ab5644b308642cc1c33dc13', false] //QUICK ]; const fundedContracts = [ @@ -29,7 +30,7 @@ async function tvl(timestamp, block, chainBlocks) { ); return balances; -}; +} async function staking(timestamp, block, chainBlocks) { const transform = await transformPolygonAddress(); const balances = {}; @@ -45,7 +46,7 @@ async function staking(timestamp, block, chainBlocks) { ); return balances; -}; +} // node test.js projects/polyroll.js module.exports={ polygon: { diff --git a/projects/puzzle.js b/projects/puzzle.js index e6e142e6271..b36cd4df5cb 100644 --- a/projects/puzzle.js +++ b/projects/puzzle.js @@ -6,7 +6,7 @@ async function tvl() { const tvl = pools.reduce((acc, { statistics: { liquidity } = {} }) => acc + +(liquidity || 0), 0) return toUSDTBalances(tvl) -}; +} module.exports = { timetravel: false, diff --git a/projects/ram.js b/projects/ram.js index 39eccde407c..d6f67cd28f9 100644 --- a/projects/ram.js +++ b/projects/ram.js @@ -1,8 +1,9 @@ +const ADDRESSES = require('./helper/coreAssets.json') const {usdCompoundExports} = require("./helper/compound"); const controllerAddress = "0x0d4fe8832857Bb557d8CFCf3737cbFc8aE784106"; module.exports = { timetravel: true, // but we don't have a thundercore archive node atm - thundercore: usdCompoundExports(controllerAddress, "thundercore", "0xeF5A0CE54a519B1Db3F350EB902C4cFbf7671D88") + thundercore: usdCompoundExports(controllerAddress, "thundercore", "0xeF5A0CE54a519B1Db3F350EB902C4cFbf7671D88", undefined, { cetheEquivalent: ADDRESSES.thundercore.WTT }) }; diff --git a/projects/raydium.js b/projects/raydium.js index f541d36acbe..972f9f94e70 100644 --- a/projects/raydium.js +++ b/projects/raydium.js @@ -1,17 +1,53 @@ -const { get } = require('./helper/http') -async function fetch() { - const response = ( - await get("https://api.raydium.io/pairs")) +const { getConnection, sumTokens2, decodeAccount, getValidGeckoSolTokens, sumTokens, } = require("./helper/solana"); +const { PublicKey, } = require("@solana/web3.js"); +const sdk = require('@defillama/sdk') - const liqArrPerPool = response.map((pool) => pool.liquidity); +const CLMM = 'CAMMCzo5YL8w4VFF8KVHrK22GGUsp5VTaW7grrKgrWqK' +const AmmV4 = '675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8' +const AmmStable = '5quBtoiQqxF9Jv6KYKctB59NT3gtJD2Y65kdnB1Uev3h' - return liqArrPerPool.reduce((a, b) => a + b, 0); +async function ammStableTvl() { + const connection = getConnection() + const accounts = await connection.getProgramAccounts(new PublicKey(AmmStable), { + filters: [{ + dataSize: 1232 + }] + }) + const data = accounts.map(i => decodeAccount('raydiumLPStable', i.account)) + const tokenAccounts = data.map(i => [i.baseVault, i.quoteVault]).flat().map(i => i.toString()) + return sumTokens2({ tokenAccounts }) +} + +async function tvlCLMM() { + const connection = getConnection() + const accounts = await connection.getProgramAccounts(new PublicKey(CLMM), { + filters: [{ + dataSize: 1544 + }] + }) + const data = accounts.map(i => decodeAccount('raydiumCLMM', i.account)) + const tokenAccounts = data.map(i => [i.vaultA, i.vaultB]).flat().map(i => i.toString()) + return sumTokens2({ tokenAccounts }) +} + + +async function ammV4Tvl() { + const owner = '5Q544fKrFoe6tsEbD7S8EmxGTJYAKtTVhAW5Q5pge4j1' + return sumTokens2({ owner, tokens: [...await getValidGeckoSolTokens()], blacklistedTokens: [ + '674PmuiDtgKx3uKuJ1B16f9m5L84eFvNwj3xDMvHcbo7', // $WOOD + 'SNSNkV9zfG5ZKWQs6x4hxvBRV6s8SqMfSGCtECDvdMd', // SNS + 'A7rqejP8LKN8syXMr4tvcKjs2iJ4WtZjXNs1e6qP3m9g', // ZION + 'RdFHYW7mPJouuSpb5vEzUfbHeQedmQMuCoHN4VQkUDn', // LUCHOW + 'RFn7mUjf24UFMBdDVmoggAii4gyHdRDDqmKzGVbkd8c', // FOUR + 'FTD9EisrsMt5TW5wSTMqyXLh2o7xTb6KNuTiXgHhw8Q8', // POLYPLAY + ]}) } module.exports = { - hallmarks:[ - [1667865600, "FTX collapse"] -], timetravel: false, - fetch, -}; + hallmarks: [[1667865600, "FTX collapse"]], + solana: { + tvl: sdk.util.sumChainTvls([tvlCLMM, ammStableTvl, ammV4Tvl]), + staking: () => sumTokens2({ tokenAccounts: ['8tnpAECxAT9nHBqR1Ba494Ar5dQMPGhL31MmPJz1zZvY']}) + }, +}; \ No newline at end of file diff --git a/projects/realt.js b/projects/realt.js index 72b5229f8d0..e5d501ff7e0 100644 --- a/projects/realt.js +++ b/projects/realt.js @@ -1,12 +1,13 @@ +const ADDRESSES = require('./helper/coreAssets.json') const sdk = require("@defillama/sdk") const BigNumber = require("bignumber.js") -const { get } = require('./helper/http') +const { getConfig } = require('./helper/cache') // Loop through all RealT tokens listed by realt.community API and accumulate tokenprice * supply, where supply is biggest of xdai or mainnet // See https://api.realt.community/ for reference -const xdai_usdc = 'xdai:0xDDAfbb505ad214D7b80b1f830fcCc89B60fb7A83' +const xdai_usdc = 'xdai:' + ADDRESSES.xdai.USDC async function xdaiTvl(timestamp, block, chainBlocks) { - let realt_tokens = await get('https://api.realt.community/v1/token') + let realt_tokens = await getConfig('realt', 'https://api.realt.community/v1/token') // Filter out deprecated contracts realt_tokens = realt_tokens.filter(t => !t['fullName'].startsWith('OLD-')) @@ -42,7 +43,6 @@ async function xdaiTvl(timestamp, block, chainBlocks) { BigNumber(0) ) tvl = tvl.times(1e6).toFixed(0) - console.log('Realt TVL:', tvl) return {[xdai_usdc]: tvl} } diff --git a/projects/retreeb.js b/projects/retreeb.js index e9605001ba2..420b8012916 100644 --- a/projects/retreeb.js +++ b/projects/retreeb.js @@ -8,7 +8,9 @@ const contracts = [ '0x5C6f3A0d2a8A921Fa473a22C71a84504b43c0DA6', // AMBER '0xB767C1fAcA04DD9eaBE20e307C52E81c37Bfb1a1', // CARBON '0x326b7cCcBA7370fAd44a7CE82bee71B6504576B0', // MINERAL - '0x6A45918D754b167d3E492A10A6DDf81e6C24E455' // SECRET + '0x6A45918D754b167d3E492A10A6DDf81e6C24E455', // SECRET + '0xbBC2BBd0335d0c60160E9b3fb7102602510EAc03', // staking pool 1 + '0x2EE9261F7A4226FeC96B2a0c64c0613bf5367A12', // staking pool 2 ]; module.exports = { diff --git a/projects/revuto.js b/projects/revuto.js index 61652e2de27..0ec59d55f9f 100644 --- a/projects/revuto.js +++ b/projects/revuto.js @@ -4,7 +4,7 @@ const { get } = require('./helper/http') async function staking() { const url = 'https://production-testing.revuto.com/api/v1/wallet/total_revu_staked_usd'; return toUSDTBalances((await get(url))) -}; +} module.exports = { timetravel: false, diff --git a/projects/risq.js b/projects/risq.js index 16ec3a11420..4a66cec738c 100644 --- a/projects/risq.js +++ b/projects/risq.js @@ -1,8 +1,9 @@ +const ADDRESSES = require('./helper/coreAssets.json') const sdk = require("@defillama/sdk"); const { transformBscAddress } = require('./helper/portedTokens'); const bnbPool = "0x55D10490C500FBF334C0fD91A0b205a5D64b9367"; //BNB_POOL -const WBNBAddresss = "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c"; +const WBNBAddresss = ADDRESSES.bsc.WBNB; const poolsV1 = [ "0x3BEC8B9e416d65209eB5432aDDCb38146E977CcB", //WBTC_POOL @@ -17,8 +18,8 @@ const poolsV1 = [ ]; const tokens = [ - "0x7130d2a12b9bcbfae4f2634d864a1ee1ce3ead9c", //WBTC - "0x2170ed0880ac9a755fd29b2688956bd959f933f8", //WETH + ADDRESSES.bsc.BTCB, //WBTC + ADDRESSES.bsc.ETH, //WETH "0x8ff795a6f4d97e7887c79bea79aba5cc76444adf", //BCH "0x4338665cbb7b2485a8855a139b75d5e34ab0db94", //LTC "0x52ce071bd9b1c4b00a0b92d298c512478cad67e8", //COMP @@ -46,7 +47,7 @@ async function tvl(_timestamp, ethBlock, chainBlocks) { balances[transform(tokens[i])] = ((transform(tokens[i]) in balances) ? Number(balances[transform(tokens[i])]) + Number(vaultBalances[i]) : vaultBalances[i]); - }; + } balances[transform(WBNBAddresss)] = (await sdk.api.eth.getBalance({ target: bnbPool, @@ -55,7 +56,7 @@ async function tvl(_timestamp, ethBlock, chainBlocks) { })).output; return balances; -}; +} module.exports = { start: 10340221, // Aug-25-2021 03:12:42 PM +UTC diff --git a/projects/rivrkitty.js b/projects/rivrkitty.js index a6c33528bea..8420d0f368c 100644 --- a/projects/rivrkitty.js +++ b/projects/rivrkitty.js @@ -44,7 +44,7 @@ async function pool2(timestamp, _block, { moonriver: block }) { ); const tokens1 = tokens.filter(t => t.isLP).map(i => i.address) return sumTokens2({ balances, chain, block, owner: stakingContract, tokens: tokens1, resolveLP: true, }) -}; +} module.exports = { moonriver: { diff --git a/projects/rocketswap.js b/projects/rocketswap.js index f586ad4e999..a2a923cba19 100644 --- a/projects/rocketswap.js +++ b/projects/rocketswap.js @@ -1,6 +1,6 @@ const {fetchURL} = require('./helper/utils') -const endpoint = "https://rocketswap.exchange:2053/api/get_market_summaries_w_token" +const endpoint = "https://rocketswap.exchange/api/get_market_summaries_w_token" async function tvl(){ const markets = await fetchURL(endpoint) diff --git a/projects/saber.js b/projects/saber.js index af546c488be..6baab67ca21 100644 --- a/projects/saber.js +++ b/projects/saber.js @@ -1,20 +1,36 @@ -const { sumTokens2, getGeckoSolTokens, getSolTokenMap } = require("./helper/solana"); +const { sumTokens2, } = require("./helper/solana"); +const { getConfig } = require('./helper/cache') // The data here comes directly from // https://registry.saber.so/data/llama.mainnet.json -const utils = require("./helper/utils"); +const blacklistedTokens = new Set([ + 'JEFFSQ3s8T3wKsvp4tnRAsUBW7Cqgnf8ukBZC4C8XBm1', + 'AEUT5uFm1D575FVCoQd5Yq891FJEqkncZUbBFoFcAhTV', + 'FACTQhZBfRzC7A76antnpAoZtiwYmUfdAN8wz7e8rxC5', + 'KNVfdSJyq1pRQk9AKKv1g5uyGuk6wpm4WG16Bjuwdma', + 'EU9aLffrTckFCs16da6CppHy63fAxMPF9ih1erQTuuRt', + 'C9xqJe3gMTUDKidZsZ6jJ7tL9zSLimDUKVpgUbLZnNbi', + 'LUNGEjUXyP48nrC1GYY5o4eTAkwm4RdX8BxFUxWJBLB', + 'SBTCB6pWqeDo6zGi9WVRMLCsKsN6JiR1RMUqvLtgSRv', + '88881Hu2jGMfCs9tMu5Rr7Ah7WBNBuXqde4nR5ZmKYYy', + 'UST98bfV6EASdTFQrRwCBczpehdMFwYCUdLT5tEbhpW', + 'CASHedBw9NfhsLBXq1WNVfueVznx255j8LLTScto3S6s', + 'UST8SCn7jrqsq51odVLqcmvnC658HkqrKrPL3w2hHQ7', + 'FTT9rBBrYwcHam4qLvkzzzhrsihYMbZ3k6wJbdoahxAt', + '9999j2A8sXUtHtDoQdk528oVzhaKBsXyRGZ67FKGoi7H', + 'KUANeD8EQvwpT1W7QZDtDqctLEh2FfSTy5pThE9CogT', + 'FTT8cGNp3rfTC6c44uPTuEFLqmsVDhjd2BhH65v2uppr', + 'T8KdT8hDzNhbGx5sjpEUxepnbDB1TZoCa7vtC5JjsMw', + 'FTT9GrHBVHvDeUTgLU8FxVJouGqg9uiWGmmjETdm32Sx', + 'SL819j8K9FuFPL84UepVcFkEZqDUUvVzwDmJjCHySYj', + 'BtX7AfzEJLnU8KQR1AgHrhGH5s2AHUTbfjhUQP8BhPvi', +]) async function tvl() { - const { data: saberPools } = await utils.fetchURL( - "https://registry.saber.so/data/llama.mainnet.json" - ); - const whitelistedTokens = await getGeckoSolTokens() - const tokenMap = await getSolTokenMap() + const saberPools = await getConfig('saber', "https://registry.saber.so/data/llama.mainnet.json"); function isValidToken(token) { - // if (!whitelistedTokens.has(token)) return false - const isSaberToken = /saber/i.test(tokenMap[token]?.name ?? '') - return !isSaberToken + return !blacklistedTokens.has(token) } const tokenAccounts = saberPools.map(i => { @@ -26,13 +42,13 @@ async function tvl() { res.push(i.reserveB) return res }).flat() - return sumTokens2({ tokenAccounts }) + return sumTokens2({ tokenAccounts, }) } module.exports = { - hallmarks:[ + hallmarks: [ [1667865600, "FTX collapse"] -], + ], timetravel: false, solana: { tvl }, methodology: diff --git a/projects/sapphiremine.js b/projects/sapphiremine.js index cdc3294cfff..81d620c4b01 100644 --- a/projects/sapphiremine.js +++ b/projects/sapphiremine.js @@ -1,6 +1,7 @@ +const ADDRESSES = require('./helper/coreAssets.json') const sdk = require("@defillama/sdk"); const target = '0x7146854856E3f373675105556c7D964B329606be'; -const WMATIC = '0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270'; +const WMATIC = ADDRESSES.polygon.WMATIC_2; async function tvl(timestamp, block, chainBlocks) { return { [ `polygon:${WMATIC}` ]: @@ -10,7 +11,7 @@ async function tvl(timestamp, block, chainBlocks) { chain: 'polygon' })).output }; -}; +} module.exports = { polygon: { diff --git a/projects/secretswap.js b/projects/secretswap.js index b3c6c1ce656..e670c160927 100644 --- a/projects/secretswap.js +++ b/projects/secretswap.js @@ -7,5 +7,8 @@ async function fetch() { } module.exports = { + secret: { + fetch + }, fetch } \ No newline at end of file diff --git a/projects/serum.js b/projects/serum.js index 66d4e230ad6..38fb4171994 100644 --- a/projects/serum.js +++ b/projects/serum.js @@ -1,38 +1,40 @@ -const { get } = require('./helper/http'); -const { getTokenDecimals, } = require('./helper/solana'); -const { transformBalances } = require('./helper/portedTokens') +const { getConnection, decodeAccount, } = require('./helper/solana') const sdk = require('@defillama/sdk') +const { PublicKey } = require("@solana/web3.js") -const blacklisted = [ - '2Dzzc14S1D7cEFGJyMZMACuoQRHVUYFhVE74C5o8Fwau', // BAB - bad token price -] +const blacklistedTokens = new Set([ + '674PmuiDtgKx3uKuJ1B16f9m5L84eFvNwj3xDMvHcbo7', // $WOOD + 'SNSNkV9zfG5ZKWQs6x4hxvBRV6s8SqMfSGCtECDvdMd', // SNS + 'A7rqejP8LKN8syXMr4tvcKjs2iJ4WtZjXNs1e6qP3m9g', // ZION + 'NGK3iHqqQkyRZUj4uhJDQqEyKKcZ7mdawWpqwMffM3s', //YAKU + 'EP2aYBDD4WvdhnwWLUMyqU69g1ePtEjgYK6qyEAFCHTx', //KRILL +]) -async function tvl() { - const response = await get('https://serum-volume-tracker.vercel.app/') +async function tvl(_, _1, _2, { api }) { + const connection = getConnection() - const markets = response.markets.filter(i => i.total_liquidity > 50) - const tokens = new Set() - for (const { quote_address, base_address, } of markets) { - tokens.add(quote_address) - tokens.add(base_address) - } - const balances = {} - const tokenDecimals = await getTokenDecimals([...tokens]) - for (const { quote_address, base_address, base_quantity, quote_quantity, } of markets) { - const quoteDecimals = +tokenDecimals[quote_address] - const baseDecimals = +tokenDecimals[base_address] - if (isNaN(quoteDecimals) || isNaN(baseDecimals)) - throw new Error('Missing token Mapping') - sdk.util.sumSingleBalance(balances, quote_address, quote_quantity * (10 ** quoteDecimals)) - sdk.util.sumSingleBalance(balances, base_address, base_quantity * (10 ** baseDecimals)) - } - blacklisted.forEach(i => delete balances[i]) - return transformBalances('solana', balances) + const programPublicKey = new PublicKey('9xQeWvG816bUx9EPjHmaT23yvVM2ZWbrrpZb9PusVFin') + const programAccounts = await connection.getProgramAccounts(programPublicKey, { + filters: [{ dataSize: 388 }] + }); + sdk.log('#markets', programAccounts.length) + + programAccounts.forEach((account) => { + const market = decodeAccount('openbook', account.account) + const baseToken = market.baseMint.toBase58() + const quoteToken = market.quoteMint.toBase58() + const baseBal = +market.baseDepositsTotal + +market.baseFeesAccrued + const quoteBal = +market.quoteDepositsTotal + +market.quoteFeesAccrued + if (!blacklistedTokens.has(baseToken)) api.add(baseToken, baseBal) + if (!blacklistedTokens.has(quoteToken)) api.add(quoteToken, quoteBal) + }); } module.exports = { timetravel: false, - solana: { - tvl - }, -}; + hallmarks: [ + [1667826000, "FTX/Alameda collapse"], + [1680310800, "Move to onchain data"], + ], + solana: { tvl, }, +} diff --git a/projects/sheesha.js b/projects/sheesha.js index 972a062be2e..2562c0a91d5 100644 --- a/projects/sheesha.js +++ b/projects/sheesha.js @@ -1,9 +1,10 @@ +const ADDRESSES = require('./helper/coreAssets.json') const { sumLPWithOnlyOneToken } = require("./helper/unwrapLPs"); const { stakingUnknownPricedLP } = require("./helper/staking"); async function pool2(timestamp, block, chainBlocks) { const balances = {}; - await sumLPWithOnlyOneToken(balances, "0xB31Ecb43645EB273210838e710f2692CC6b30a11", "0x5d350F07c1D9245c1Ecb7c622c67EDD49c6a0A35", "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c", chainBlocks.bsc, "bsc", addr=>`bsc:${addr}`) + await sumLPWithOnlyOneToken(balances, "0xB31Ecb43645EB273210838e710f2692CC6b30a11", "0x5d350F07c1D9245c1Ecb7c622c67EDD49c6a0A35", ADDRESSES.bsc.WBNB, chainBlocks.bsc, "bsc", addr=>`bsc:${addr}`) return balances } diff --git a/projects/sifchain.js b/projects/sifchain.js index 626818e8e6e..8676406083f 100644 --- a/projects/sifchain.js +++ b/projects/sifchain.js @@ -1,7 +1,8 @@ const { get } = require('./helper/http') async function tvl() { - const getPoolsRes = await get('https://api.sifchain.finance/clp/getPools') + // const getPoolsRes = await get('https://api.sifchain.finance/clp/getPools') + const getPoolsRes = await get('https://lcd-sifchain.cosmostation.io/clp/getPools') const total = getPoolsRes.result.pools .map(pool => +pool.native_asset_balance) diff --git a/projects/smartcredit.js b/projects/smartcredit.js index d4c30455f5a..1ce29666deb 100644 --- a/projects/smartcredit.js +++ b/projects/smartcredit.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('./helper/coreAssets.json') const { GraphQLClient, } = require('graphql-request') const sdk = require('@defillama/sdk') const { default: BigNumber } = require('bignumber.js') @@ -14,7 +15,7 @@ async function getStats() { function replaceEth(addr) { if (addr.toLowerCase() === '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee') - return '0x0000000000000000000000000000000000000000' + return ADDRESSES.null return addr } diff --git a/projects/smoothy.js b/projects/smoothy.js index 1305a88f65c..506693314ac 100644 --- a/projects/smoothy.js +++ b/projects/smoothy.js @@ -10,7 +10,7 @@ module.exports = { const { output: poolLength } = await sdk.api.abi.call({ block, target: imp, - abi: abis.abis.smoothy.find(i => i.name === '_ntokens') + abi: abis.abis.smoothy._ntokens }) const calls = [] for (let i = 0; i < poolLength; i++) @@ -20,7 +20,7 @@ module.exports = { block, calls, target: imp, - abi: abis.abis.smoothy.find(i => i.name === 'getTokenStats') + abi: abis.abis.smoothy.getTokenStats }) tvls.forEach(t => tvl += t.output.balance / 10 ** t.output.decimals) return toUSDTBalances(tvl) @@ -34,7 +34,7 @@ module.exports = { block, target: imp, chain: 'bsc', - abi: abis.abis.smoothy.find(i => i.name === '_ntokens') + abi: abis.abis.smoothy._ntokens }) const calls = [] for (let i = 0; i < poolLength; i++) @@ -45,7 +45,7 @@ module.exports = { calls, target: imp, chain: 'bsc', - abi: abis.abis.smoothy.find(i => i.name === 'getTokenStats') + abi: abis.abis.smoothy.getTokenStats }) tvls.forEach(t => tvl += t.output.balance / 10 ** t.output.decimals) return toUSDTBalances(tvl) diff --git a/projects/snowswap.js b/projects/snowswap.js index 6affd92d34a..f70ae282111 100644 --- a/projects/snowswap.js +++ b/projects/snowswap.js @@ -1,21 +1,20 @@ -const BigNumber = require("bignumber.js"); -const curveAbis = require('./config/curve/abis.js') -const sdk = require("@defillama/sdk"); -const { sumTokens } = require('./helper/unwrapLPs'); +const ADDRESSES = require('./helper/coreAssets.json') +const { staking } = require('./helper/staking'); +const { sumTokens2, } = require('./helper/unwrapLPs'); -const wBTC = '0x2260fac5e5542a773aa44fbcfedf7c193bc2c599' +const wBTC = ADDRESSES.ethereum.WBTC const y2DAI = { addr: "0xacd43e627e64355f1861cec6d3a6688b31a6f952", dec: 18, getPrice: false, type: 'yv', pfsDec: 18 } ///y2DAI yv const y2USDC = { addr: "0x597ad1e0c13bfe8025993d9e79c69e1c0233522e", dec: 6, getPrice: false, type: 'yv', pfsDec: 18 } ///y2USDC yv const y2USDT = { addr: "0x2f08119c6f07c006695e079aafc638b8789faf18", dec: 6, getPrice: false, type: 'yv', pfsDec: 18 } ///y2USDT yv const Y2TUSD = { addr: "0x37d19d1c4e1fa9dc47bd1ea12f742a0887eda74a", dec: 18, getPrice: false, type: 'yv', pfsDec: 18 } ///Y2TUSD yv const yyDAIT = { addr: "0x5dbcf33d8c2e976c6b560249878e6f1491bca25c", dec: 18, getPrice: false, type: 'yv', pfsDec: 18 } ///yyDAI+yUSDC+yUSDT+yTUSD hbtc const yyDAIB = { addr: "0x2994529c0652d127b7842094103715ec5299bbed", dec: 18, getPrice: false, type: 'yv', pfsDec: 18 } ///yyDAI+yUSDC+yUSDT+yBUSD hbtc -const WETH = { addr: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", dec: 18, get getPrice() { return this.addr }, type: '' } ///WETH crvETH +const WETH = { addr: ADDRESSES.ethereum.WETH, dec: 18, get getPrice() { return this.addr }, type: '' } ///WETH crvETH const eCRV = { addr: "0xa3d87fffce63b53e0d54faa1cc983b7eb0b74a9c", dec: 18, getPrice: WETH.getPrice, type: '' } ///eCRV crvETH const steCRV = { addr: "0x06325440d014e39736583c165c2963ba99faf14e", dec: 18, getPrice: WETH.getPrice, type: '' } ///steCRV crvETH const ankrCRV = { addr: "0xaa17a236f2badc98ddc0cf999abb47d47fc0a6cf", dec: 18, getPrice: WETH.getPrice, type: '' } ///ankrCRV crvETH -const usdc = { addr: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", dec: 6, getPrice: false, type: '' } ///fUSD +const usdc = { addr: ADDRESSES.ethereum.USDC, dec: 6, getPrice: false, type: '' } ///fUSD const fUSDC = { addr: "0xf0358e8c3cd5fa238a29301d0bea3d63a17bedbe", dec: 6, getPrice: false, type: 'yv', pfsDec: 6 } ///fUSD const fUSDT = { addr: "0x053c80ea73dc6941f518a68e2fc52ac45bde7c9c", dec: 6, getPrice: false, type: 'yv', pfsDec: 6 } ///fUSD const fDAI = { addr: "0xab7fa2b2985bccfc13c6d86b1d5a17486ab1e04c", dec: 18, getPrice: false, type: 'yv', pfsDec: 18 } ///fUSD @@ -34,9 +33,9 @@ const ycrvRenWSBTC = { addr: '0x7ff566e1d69deff32a7b244ae7276b9f90e9d0f6', dec: // TODO: the next should be yv const fcrvRenWBTC = { addr: '0x5f18c75abdae578b483e5f43f12a39cf75b973a9', dec: 18, getPrice: wBTC, type: '', pfsDec: 18 } ///btcSnow -const polyDai = { addr: "0x8f3cf7ad23cd3cadbd9735aff958023239c6a063", dec: 18, getPrice: false } ///penguin -const polyUsdc = { addr: "0x2791bca1f2de4661ed88a30c99a7a9449aa84174", dec: 6, getPrice: false } ///penguin -const polyUSDT = { addr: "0xc2132d05d31c914a87c6611c10748aeb04b58e8f", dec: 6, getPrice: false } ///penguin +const polyDai = { addr: ADDRESSES.polygon.DAI, dec: 18, getPrice: false } ///penguin +const polyUsdc = { addr: ADDRESSES.polygon.USDC, dec: 6, getPrice: false } ///penguin +const polyUSDT = { addr: ADDRESSES.polygon.USDT, dec: 6, getPrice: false } ///penguin const snow = { addr: '0xfe9a29ab92522d14fc65880d817214261d8479ae', dec: 18, get getPrice() { return this.addr } } ///Frosty @@ -47,159 +46,70 @@ let swaps = [ 'name': 'yv', 'addr': '0x4571753311e37ddb44faa8fb78a6df9a6e3c6c0b', 'coins': [y2DAI, y2USDC, y2USDT, Y2TUSD], - 'abi': curveAbis.abis.abisBTC }, { 'name': 'hbtc', 'addr': '0xbf7ccd6c446acfcc5df023043f2167b62e81899b', 'coins': [yyDAIT, yyDAIB], - 'abi': curveAbis.abis.abisBTC }, { 'name': 'crvETH', 'addr': '0x3820a21c6d99e57fb6a17ab3fbdbe22552af9bb0', 'coins': [WETH, eCRV, steCRV, ankrCRV], - // 'abi': abi - 'abi': curveAbis.abis.abiNew }, { 'name': 'fUSD', 'addr': '0x8470281f5149eb282ce956d8c0e4f2ebbc0c21fc', 'coins': [usdc, fUSDC, fUSDT, fDAI], - 'abi': curveAbis.abis.abiNew }, { 'name': 'yVault v3', 'addr': '0x668e76F1E74e6391ed3fe947E923878109647879', 'coins': [yvDAI, yvUSDC, yvUSDT], - 'abi': curveAbis.abis.abiNew }, { 'name': 'eth2SNOW', 'addr': '0x16BEa2e63aDAdE5984298D53A4d4d9c09e278192', 'coins': [WETH, vETH2, aETHc, CRETH2], - 'abi': curveAbis.abis.abiNew }, { 'name': 'btcSnow', 'addr': '0xeF034645b9035C106acC04cB6460049D3c95F9eE', 'coins': [ycrvRenWSBTC, fcrvRenWBTC], - 'abi': curveAbis.abis.abisBTC } ] const pools = [ - { - 'name': 'frosty', - 'addr': '0x7d2c8B58032844F222e2c80219975805DcE1921c', - 'coins': [snow], - 'chain': 'ethereum' - }, { 'name': 'penguin', 'addr': '0x6852E7399C6cC73256Ca46A4921e1c7b2682D912', 'coins': [polyDai, polyUsdc, polyUSDT], 'chain': 'polygon' - }, - { - 'name': `Olaf's`, - 'addr': "0x4f3B8FD5617287d1073cd3275c3d040265624575", - 'coins': [polyUsdc, polySnow], - 'chain': "polygon", } ] -async function polygon(ts, _block, { polygon: block }) { +async function polygon(ts, _block, { polygon: block }, { api }) { const poolsPolygon = pools.filter(p => p.chain === "polygon") const toa = [] poolsPolygon.forEach(pool => { pool.coins.map(coin => toa.push([coin.addr, pool.addr])) }) - return sumTokens({}, toa, block, 'polygon') + return sumTokens2({ api, tokensAndOwners: toa, }) } -async function ethereum(ts, block) { - const tokensForPrice = [WETH.getPrice, wBTC, snow.getPrice] - - const poolsEth = pools.filter(p => p.chain === "ethereum") +async function ethereum(ts, block, _, { api }) { const toa = [] - poolsEth.forEach(pool => { - pool.coins.map(coin => toa.push([coin.addr, pool.addr])) + swaps.map(({ addr, coins }) => { + coins.forEach(i => toa.push([i.addr, addr])) }) - const balances = await sumTokens({}, toa, block) - - await Promise.all(swaps.map(async item => { - await Promise.all( - item.coins.map(async (coin, index) => { - let { output: balance } = await sdk.api.abi.call({ - block, - params: [index], - target: item.addr, - abi: item.abi.find(i => i.name === 'balances') - }) - let poolAmount = new BigNumber(balance).div(10 ** coin.dec); - balance = BigNumber(balance) - - if (coin.type) { - var multiplier = 1; - let virtualPrice, virtualPriceObj - switch (coin.type) { - case 'yv': // getPricePerFullShare - virtualPriceObj = await sdk.api.abi.call({ - block, - target: coin.addr, - abi: curveAbis.abis.yTokens.find(i => i.name === 'getPricePerFullShare') - }) - virtualPrice = virtualPriceObj.output - break; - case 'yv2': // pricePerShare - virtualPriceObj = await sdk.api.abi.call({ - block, - target: coin.addr, - abi: abi.yv2.find(i => i.name === 'pricePerShare') - }) - virtualPrice = virtualPriceObj.output - break; - case 'ankr': // ratio - virtualPriceObj = await sdk.api.abi.call({ - block, - target: coin.addr, - abi: abi.ankr.find(i => i.name === 'ratio') - }) - virtualPrice = virtualPriceObj.output - break; - default: - virtualPrice = 1; - } - - multiplier = await new BigNumber(virtualPrice) - .div(10 ** coin.pfsDec) - .toFixed(4); - - poolAmount = poolAmount.multipliedBy(multiplier) - balance = balance.multipliedBy(multiplier) - } - if (coin.getPrice) { - if (coin.getPrice === wBTC) balance = poolAmount.multipliedBy(1e8) - sdk.util.sumSingleBalance(balances, coin.getPrice, balance.toFixed(0)) - } else { - sdk.util.sumSingleBalance(balances, '0xdac17f958d2ee523a2206206994597c13d831ec7', poolAmount.multipliedBy(1e6).toFixed(0)) // add as usdt - } - }) - ) - })) - return balances + return sumTokens2({ api, tokensAndOwners: toa, }) } module.exports = { ethereum: { - tvl: ethereum + tvl: ethereum, + staking: staking('0x7d2c8B58032844F222e2c80219975805DcE1921c', snow.addr) }, polygon: { tvl: polygon }, } - -const abi = { - yv2: [{ "stateMutability": "view", "type": "function", "name": "pricePerShare", "inputs": [], "outputs": [{ "name": "", "type": "uint256" }], "gas": 77734 }], - ankr: [{ "inputs": [], "name": "ratio", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }] -} diff --git a/projects/solanax.js b/projects/solanax.js index d0ca0851738..59b5fa2a044 100644 --- a/projects/solanax.js +++ b/projects/solanax.js @@ -1,5 +1,5 @@ const { get } = require('./helper/http') -const { toUSDTBalances } = require('./helper/balances');; +const { toUSDTBalances } = require('./helper/balances'); async function fetch() { const response = ( @@ -15,7 +15,7 @@ module.exports = { misrepresentedTokens: true, methodology: `TVL is fetched by making calls to the Solanax API (https://solanax.org/api/data/)`, solana: { - tvl: fetch, + tvl: () => ({}), } }; \ No newline at end of file diff --git a/projects/sora.js b/projects/sora.js index a821b86f127..fa05e920acf 100644 --- a/projects/sora.js +++ b/projects/sora.js @@ -1,103 +1,23 @@ -const BigNumber = require('bignumber.js'); -const { request, gql } = require('graphql-request'); -const axios = require('axios'); -const {getApiTvl} = require('./helper/historicalApi'); +const { post } = require('./helper/http') -/* -const BASE_URL = 'https://api.subquery.network/sq/sora-xor/sora'; -const XOR_ASSET_ID = '0x0200000000000000000000000000000000000000000000000000000000000000'; -const POOL_XYK_ENTITIES = gql` -query PoolXYKEntities ( - $first: Int = 1) -{ - poolXYKEntities ( - first: $first - ) - { - nodes { - pools { - edges { - node { - targetAssetId, - priceUSD, - baseAssetReserves, - targetAssetReserves - } - } - } - } - } -}`; - -async function fetch () { - try { - const { poolXYKEntities } = await request(BASE_URL, POOL_XYK_ENTITIES, {}); - if (!poolXYKEntities) { - throw new Error('SORA adapter: Something was happened with SORA requested data!'); - } - const data = poolXYKEntities.nodes[0].pools.edges.map(item => item.node); - if (!data || !data.length) { - throw new Error('SORA adapter: Something was happened with SORA requested data!'); - } - const xor = data.find(item => item.targetAssetId === XOR_ASSET_ID); - const xorPriceUSD = new BigNumber(xor.priceUSD); - - const tvl = data.reduce((acc, item) => { - if (item.targetAssetId === XOR_ASSET_ID) { - return acc; // XOR-XOR pair - } - const priceUSD = new BigNumber(item.priceUSD); - const baseAssetReserves = new BigNumber(item.baseAssetReserves); - const targetAssetReserves = new BigNumber(item.targetAssetReserves); - // x += (xorReserves * xorPrice + targetAssetReserves * targetAssetPriceUSD) - return acc.plus(baseAssetReserves.times(xorPriceUSD).plus(targetAssetReserves.times(priceUSD))); - }, new BigNumber(0)); - - return tvl.toNumber(); - } catch (error) { - throw new Error('SORA adapter: Something was happened with SORA subquery connection!'); - } -} -*/ - -const getData = async ()=>{ - const data = await axios.post("https://polkaview.io:8086/api/v2/query?org=PolkaCloud", { - "query": "from(bucket: \"polkaswap_platform\") |> range(start: -600d, stop: now()) |> filter(fn: (r) => r[\"_measurement\"] == \"tvl_USD\" and r[\"_field\"] == \"value\") |> aggregateWindow(every: 60m, fn: last, createEmpty: false) |> yield(name: \"last\")", - "dialect": { - "header": true, - "delimiter": ",", - "quoteChar": "\"", - "commentPrefix": "#", - "annotations": [ - "datatype", - "group", - "default" - ] - }, - "type": "flux" - }, { - headers: { - "authorization": "Token C2IS7BxyTxbxLGU75byPIy3eYn95xtcZdOEV6ap_Kp0pXMv4fKrCWIMHrFD8hg0Tlv44QJlH25asvlthauOXXA==" - } - }) - const parsed = data.data.split("\n").slice(4, -2).map(row=>{ - const els = row.split(',') - return { - date: new Date(els[5]).getTime()/1000, - totalLiquidityUSD: Number(els[6]) +async function tvl(timestamp) { + const { data: { entities: { nodes } } } = await post('https://api.subquery.network/sq/sora-xor/sora-prod-sub4', { + "query": "query NetworkTvlQuery($after: Cursor, $type: SnapshotType, $from: Int, $to: Int) {\n entities: networkSnapshots(\n after: $after\n orderBy: TIMESTAMP_DESC\n filter: {and: [{type: {equalTo: $type}}, {timestamp: {lessThanOrEqualTo: $from}}, {timestamp: {greaterThanOrEqualTo: $to}}]}\n ) {\n pageInfo {\n hasNextPage\n endCursor\n \n }\n nodes {\n timestamp\n liquidityUSD\n }\n }\n}", + "operationName": "NetworkTvlQuery", + "variables": { + "from": timestamp, + "to": timestamp - 3600 * 6, + "type": "HOUR", + "after": "" } }) - return parsed -} - -async function tvl(timestamp) { - return getApiTvl(timestamp, async()=>{ - const data = await getData() - return data[data.length-1].totalLiquidityUSD - }, getData) + return { + tether: nodes[0].liquidityUSD + } } module.exports = { + misrepresentedTokens: true, methodology: "All pools from https://polkaswap.io launched on SORA network are included in TVL. Data comes from https://polkaview.io", sora: { tvl }, }; diff --git a/projects/specfinance.js b/projects/specfinance.js index d0fd173c2c8..0e8ec7817c0 100644 --- a/projects/specfinance.js +++ b/projects/specfinance.js @@ -1,9 +1,9 @@ const axios = require('axios') async function tvl(){ - const tvl = await axios.get('https://api.spec.finance/api/stat') + const tvl = await axios.get('https://spec-api-eeh8efcmd2b0fffh.z01.azurefd.net/api/data?type=lpVault') return { - 'terrausd': tvl.data.tvl, + 'terrausd': tvl.data.stat.tvl / 1e6, } } @@ -18,7 +18,7 @@ module.exports = { misrepresentedTokens: true, timetravel: false, terra:{ - tvl + tvl: () => ({}), }, terra2:{ tvl: terra2 diff --git a/projects/stackswap.js b/projects/stackswap.js index b06d3a88db9..0038db1eaca 100644 --- a/projects/stackswap.js +++ b/projects/stackswap.js @@ -1,16 +1,7 @@ -const { get } = require('./helper/http') - -async function fetch() { - let poolValues = ( - await get("https://app.stackswap.org/api/v1/pools") - ) - .filter(p => p.pair_name !== 'STSW-lBTC') - .map(p => p.liquidity_locked); - poolValues = poolValues.map(v => v.substring(0, v.indexOf('USD'))); - return poolValues.reduce((a, b) => a + parseFloat(b), 0); -}; +const { getExports } = require('./helper/heroku-api') module.exports = { - timetravel: false, - fetch, -}; + timetravel: false, + misrepresentedTokens: true, + ...getExports("stackswap", ['stacks']), +} diff --git a/projects/stellaswap.js b/projects/stellaswap.js index 7a5e3ad5576..c2174592d05 100644 --- a/projects/stellaswap.js +++ b/projects/stellaswap.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('./helper/coreAssets.json') const { getUniTVL } = require('./helper/unknownTokens') const { staking } = require('./helper/staking') const sdk = require('@defillama/sdk') @@ -5,7 +6,6 @@ const { sumTokens2 } = require('./helper/unwrapLPs') const dexTVL = getUniTVL({ factory: "0x68A384D826D3678f78BB9FB1533c7E9577dACc0E", - chain: "moonbeam", useDefaultCoreAssets: true, }) @@ -16,6 +16,8 @@ async function stablePoolTVL(_, _b, { [chain]: block }) { '0xb86271571c90ad4e0c9776228437340b42623402', // ETH '0x7FbE3126C03444D43fC403626ec81E3e809E6b46', // MAI B4P '0xB1BC9f56103175193519Ae1540A0A4572b1566F6', // 4pool WH + '0x5c3dc0ab1bd70c5cdc8d0865e023164d4d3fd8ec', // Frax pool + '0x95953409374e1ed252c6D100E7466E346E3dC5b9', // 2pool ] let { output: lpTokens } = await sdk.api.abi.multiCall({ @@ -47,36 +49,12 @@ module.exports = { misrepresentedTokens: true, moonbeam: { tvl: sdk.util.sumChainTvls([dexTVL, stablePoolTVL]), - staking: staking('0x06A3b410b681c82417A906993aCeFb91bAB6A080', '0x0E358838ce72d5e61E0018a2ffaC4bEC5F4c88d2', 'moonbeam') + staking: staking('0x06A3b410b681c82417A906993aCeFb91bAB6A080', ADDRESSES.moonbeam.STELLA, 'moonbeam') } } const abi = { - getTokens: { - "inputs": [], - "name": "getTokens", - "outputs": [ - { - "internalType": "contract IERC20[]", - "name": "", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - getLpToken: { - "inputs": [], - "name": "getLpToken", - "outputs": [ - { - "internalType": "contract LPToken", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, + getTokens: "address[]:getTokens", + getLpToken: "address:getLpToken", } \ No newline at end of file diff --git a/projects/stipend.js b/projects/stipend.js index 7edf8338fe2..1a63e274125 100644 --- a/projects/stipend.js +++ b/projects/stipend.js @@ -1,13 +1,11 @@ +const ADDRESSES = require('./helper/coreAssets.json') const { staking } = require("./helper/staking.js"); module.exports = { kava: { tvl: staking( "0xfc30fE377f7E333cC1250B7768107a7Da0277c44", - "0xc86c7C0eFbd6A49B35E8714C5f59D99De09A225b", - "kava", - "kava", - 18 + ADDRESSES.kava.WKAVA, ) } }; diff --git a/projects/sunny.js b/projects/sunny.js index 115c255eeed..87ab107098e 100644 --- a/projects/sunny.js +++ b/projects/sunny.js @@ -1,12 +1,10 @@ -const { getProvider, getSaberPools, getQuarryData, getMultipleAccountBuffers, } = require('./helper/solana') +const { getProvider,} = require('./helper/solana') const sdk = require('@defillama/sdk') const { PublicKey } = require('@solana/web3.js') const { Program, } = require("@project-serum/anchor"); -const { sliceIntoChunks, } = require('./helper/utils') async function tvl_V2() { - const { quarriesByStakedMint, } = await getQuarryData(); - const saberPools = await getSaberPools() + const balances = {} const quarryId = new PublicKey('QMNeHCGYnLVDn1icRAfQZpjPLBNkfGbSKRB83G5d8KB') const sunnyProgramId = new PublicKey('SPQR4kT3q2oUKEJes2L6NNSBCiPW9SfuhkuqC9bp6Sx') const provider = getProvider() @@ -17,86 +15,23 @@ async function tvl_V2() { const pools = await sunnyProgram.account.pool.all() const quarries = pools.map(i => i.account.quarry) const quaryData = await quarryProgram.account.quarry.fetchMultiple(quarries) - const quarryDataKeyed = {} quaryData.forEach((data, i) => { - if (!data) return; - quarryDataKeyed[quarries[i]] = { - quarry: data, - tokenAmount: pools[i].account.totalVendorBalance, - decimals: data.tokenMintDecimals - } - }) - - const dataKeys = [] - for (const [stakedMint, quarryKeys] of Object.entries(quarriesByStakedMint)) { - const saberPool = saberPools.find((p) => p.lpMint === stakedMint) - if (!saberPool) continue; - quarryKeys.forEach(key => { - if (!quarryDataKeyed[key]) return; - quarryDataKeyed[key].saberPool = saberPool - quarryDataKeyed[key].stakedMint = stakedMint - dataKeys.push(stakedMint, saberPool.reserveA, saberPool.reserveB) - }) - } - const dataCache = {} - for (const keys of sliceIntoChunks(dataKeys, 99)) { - const res = await getMultipleAccountBuffers(keys) - keys.forEach((key, i) => { - dataCache[key] = res[i] - }) - } - const balances = {} - Object.keys(quarryDataKeyed).forEach(key => { - if (!quarryDataKeyed[key].saberPool) delete quarryDataKeyed[key] + sdk.util.sumSingleBalance(balances,data.tokenMintKey.toString(),pools[i].account.totalVendorBalance, 'solana') }) - Object.values(quarryDataKeyed).forEach(quarry => addQuarryBalance(dataCache, balances, quarry)) return balances } async function tvl_V1() { - const saberPools = await getSaberPools() + const balances = {} const sunnyProgramId = new PublicKey('SSFNHWYFdELMTkWNdaPaZQuVL4d2RY7ykjGmeGkmKXW') const provider = getProvider() const sunnyOldIDL = await Program.fetchIdl(sunnyProgramId, provider) const sunnyProgram = new Program(sunnyOldIDL, sunnyProgramId, provider) const pools = await sunnyProgram.account.pool.all() - const poolsDataKeyed = {} - const dataKeys = [] pools.forEach((data, i) => { - if (!data) return; const lpMint = data.account.lpMint.toString() - const saberPool = saberPools.find((p) => p.lpMint === lpMint) - if (!saberPool) return; - poolsDataKeyed[lpMint] = { - pool: data, - saberPool: saberPool, - tokenAmount: data.account.totalLpTokenBalance, - lpMint: lpMint, - stakedMint: lpMint, - } - dataKeys.push(lpMint, saberPool.reserveA, saberPool.reserveB) + sdk.util.sumSingleBalance(balances,lpMint,data.account.totalLpTokenBalance, 'solana') }) - - const dataCache = {} - for (const keys of sliceIntoChunks(dataKeys, 99)) { - const res = await getMultipleAccountBuffers(keys) - keys.forEach((key, i) => { - dataCache[key] = res[i] - }) - } - const balances = {} - Object.values(poolsDataKeyed).forEach(pool => addQuarryBalance(dataCache, balances, pool)) - return balances -} - -function addQuarryBalance(dataCache, balances = {}, { tokenAmount, stakedMint, saberPool: { reserveA, reserveB, tokenA, tokenB, } }) { - const lpTokenTotalSupply = Number(dataCache[stakedMint].readBigUInt64LE(36)); - let poolShare = tokenAmount / lpTokenTotalSupply; - - const reserveAAmount = Number(dataCache[reserveA].readBigUInt64LE(64)); - const reserveBAmount = Number(dataCache[reserveB].readBigUInt64LE(64)); - sdk.util.sumSingleBalance(balances, 'solana:'+tokenA, poolShare * reserveAAmount) - sdk.util.sumSingleBalance(balances, 'solana:'+tokenB, poolShare * reserveBAmount) return balances } diff --git a/projects/superfluid.js b/projects/superfluid.js index 43ca564e303..d04b58f2300 100644 --- a/projects/superfluid.js +++ b/projects/superfluid.js @@ -1,17 +1,16 @@ const sdk = require("@defillama/sdk"); const { default: BigNumber } = require("bignumber.js"); -const { request, gql } = require("graphql-request"); // GraphQLClient +const { request, } = require("graphql-request"); // GraphQLClient const { isStableToken } = require('./helper/streamingHelper') -const { getBlock } = require('./helper/getBlock') +const { getBlock } = require('./helper/http') +const { transformBalances } = require('./helper/portedTokens') // Superfluid Supertokens can be retrieved using GraphQl API - cannot use block number to retrieve historical data at the moment though // TheGraph URL before being deprecated, before 2021-12-23 // const polygonGraphUrl = 'https://api.thegraph.com/subgraphs/name/superfluid-finance/superfluid-matic' // const xdaiGraphUrl = 'https://api.thegraph.com/subgraphs/name/superfluid-finance/superfluid-xdai' -const polygonGraphUrl = 'https://api.thegraph.com/subgraphs/name/superfluid-finance/protocol-v1-matic' -const xdaiGraphUrl = 'https://api.thegraph.com/subgraphs/name/superfluid-finance/protocol-v1-xdai' -const supertokensQuery = gql` +const supertokensQuery = ` query get_supertokens($block: Int) { tokens( first: 1000, @@ -44,6 +43,8 @@ function isWhitelistedToken(token, address, isVesting) { return isVesting ? !isStable : isStable } +const blacklist = new Set(['0x441bb79f2da0daf457bad3d401edb68535fb3faa'].map(i => i.toLowerCase())) + // Main function for all chains to get balances of superfluid tokens async function getChainBalances(allTokens, chain, block, isVesting) { // Init empty balances @@ -58,8 +59,7 @@ async function getChainBalances(allTokens, chain, block, isVesting) { target: token.id, }) ), - block, - chain + block, chain }) supply.forEach(({ output: totalSupply }, i) => { @@ -68,21 +68,20 @@ async function getChainBalances(allTokens, chain, block, isVesting) { underlyingAddress, underlyingToken, decimals, - name, + name, symbol, isNativeAssetSuperToken, } = allTokens[i] let underlyingTokenBalance = BigNumber(totalSupply * (10 ** (underlyingToken || { decimals: 18 }).decimals) / (10 ** decimals)).toFixed(0) // Accumulate to balances, the balance for tokens on mainnet or sidechain - let prefixedUnderlyingAddress = chain + ':' + underlyingAddress + let prefixedUnderlyingAddress = underlyingAddress // if (!underlyingToken && underlyingTokenBalance/1e24 > 1) console.log(name, symbol, chain, Math.floor(underlyingTokenBalance/1e24)) - if (isNativeAssetSuperToken) prefixedUnderlyingAddress = chain + ':' + id - else if (!underlyingToken) return; + // if (isNativeAssetSuperToken) prefixedUnderlyingAddress = chain + ':' + underlyingAddress + if (!underlyingToken || blacklist.has(underlyingAddress.toLowerCase())) return; sdk.util.sumSingleBalance(balances, prefixedUnderlyingAddress, underlyingTokenBalance) }) - //console.log(chain, lockedTokensOutput.output, allTokens) - return balances + return transformBalances(chain, balances) } const tokensNativeToSidechain = [ @@ -91,41 +90,35 @@ const tokensNativeToSidechain = [ '0x263026e7e53dbfdce5ae55ade22493f828922965', // polygon RIC ] -async function retrieveSupertokensBalances(chain, block, isVesting, ts) { - - block = await getBlock(ts, chain, { [chain]: block }) +async function retrieveSupertokensBalances(chain, block, isVesting, ts, graphUrl) { + const gblock = (await getBlock(ts, chain, { [chain]: block })) - 5000 // Retrieve supertokens from graphql API - let graphUrl; - if (chain === 'polygon') { - graphUrl = polygonGraphUrl - } - else if (chain === 'xdai') { - graphUrl = xdaiGraphUrl - } - - const { tokens } = await request( - graphUrl, - supertokensQuery, - { block } - ) - + const { tokens } = await request(graphUrl, supertokensQuery, { block: gblock }) const allTokens = tokens.filter(t => t.isSuperToken) return getChainBalances(allTokens, chain, block, isVesting) } +const config = { + avax: { graph: 'https://api.thegraph.com/subgraphs/name/superfluid-finance/protocol-v1-avalanche-c', }, + polygon: { graph: 'https://api.thegraph.com/subgraphs/name/superfluid-finance/protocol-v1-matic', }, + xdai: { graph: 'https://api.thegraph.com/subgraphs/name/superfluid-finance/protocol-v1-xdai', }, + optimism: { graph: 'https://api.thegraph.com/subgraphs/name/superfluid-finance/protocol-v1-optimism-mainnet', }, + arbitrum: { graph: 'https://api.thegraph.com/subgraphs/name/superfluid-finance/protocol-v1-arbitrum-one', }, + bsc: { graph: 'https://api.thegraph.com/subgraphs/name/superfluid-finance/protocol-v1-bsc-mainnet', }, +} + module.exports = { + methodology: `TVL is the total quantity of tokens locked in Super Tokens from Superfluid, on Polygon and xDai (most important being weth, dai, usdc and wbtc, as well as QiDAO and MOCA)`, hallmarks: [ [1644278400, "Fake ctx hack"], - [Math.floor(new Date('2022-10-03')/1e3), 'Vesting tokens are not included in tvl'], ], - polygon: { - tvl: async (_, _b, { polygon: block }) => retrieveSupertokensBalances('polygon', block, false, _), - vesting: async (_, _b, { polygon: block }) => retrieveSupertokensBalances('polygon', block, true, _), - }, - xdai: { - tvl: async (_, _b, { xdai: block }) => retrieveSupertokensBalances('xdai', block, false, _), - vesting: async (_, _b, { xdai: block }) => retrieveSupertokensBalances('xdai', block, true, _), - }, - methodology: `TVL is the total quantity of tokens locked in Super Tokens from Superfluid, on Polygon and xDai (most important being weth, dai, usdc and wbtc, as well as QiDAO and MOCA)` -} +}; + +Object.keys(config).forEach(chain => { + const { graph } = config[chain] + module.exports[chain] = { + tvl: async (_, _b, { [chain]: block }) => retrieveSupertokensBalances(chain, block, false, _, graph), + vesting: async (_, _b, { [chain]: block }) => retrieveSupertokensBalances(chain, block, true, _, graph), + } +}) diff --git a/projects/swerve.js b/projects/swerve.js index 0c681d03dfd..dee065753d3 100644 --- a/projects/swerve.js +++ b/projects/swerve.js @@ -1,139 +1,16 @@ -const BigNumber = require("bignumber.js"); -const abis = require('./config/curve/abis.js') -const sdk = require("@defillama/sdk"); -const { get } = require('./helper/http') - -let swaps = [ - { - 'name': 'swerve', - 'address': '0x329239599afB305DA0A2eC69c58F8a6697F9F88d', - 'coins': [0,1,2,3], - 'type': 1, - 'abi': abis.abis.abisBTC - } -] - -let coinDecimals = [ - { - '0x8dAEBADE922dF735c38C80C7eBD708Af50815fAa': '18', - '0x0316EB71485b0Ab14103307bf65a021042c6d380': '18', - '0xEB4C2781e4ebA804CE9a9803C67d0893436bB27D': '8', - '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599': '8', - '0xfE18be6b3Bd88A2D2A7f928d00292E7a9963CfC6': '18', - '0x196f4727526eA7FB1e17b2071B3d8eAA38486988': '18', - '0xe2f2a5C287993345a840Db3B0845fbC70f5935a5': '18', - '0x0E2EC54fC0B509F445631Bf4b91AB8168230C752': '18', //linkusd - '0x674C6Ad92Fd080e4004b2312b45f796a192D27a0': '18', //USDN - '0x1c48f86ae57291F7686349F12601910BD8D470bb': '18', //USDK - '0x056Fd409E1d7A124BD7017459dFEa2F387b6d5Cd': '2', //GUSD - '0x39AA39c021dfbaE8faC545936693aC917d5E7563': '8', //cUSD - '0x5d3a536E4D6DbD6114cc1Ead35777bAB948E3643': '8', //cDAI - '0xdAC17F958D2ee523a2206206994597C13D831ec7': '6', //USDT - '0x73a052500105205d34Daf004eAb301916DA8190f': '18', //yTUSD - '0xd6aD7a6750A7593E092a9B218d66C0A814a3436e': '6', ///yUSDC - '0x16de59092dAE5CcF4A1E6439D611fd0653f0Bd01': '18', ///yDAI - '0x83f798e925BcD4017Eb265844FDDAbb448f1707D': '6', ///yUSDT - '0x8E870D67F660D95d5be530380D0eC0bd388289E1': '18', //PAX - '0x9777d7E2b60bB01759D0E2f8be2095df444cb07E': '6', ///ycUSDC - '0x99d1Fa417f94dcD62BfE781a1213c092a47041Bc': '18', ///ycDAI - '0x1bE5d71F2dA660BFdee8012dDc58D024448A0A59': '6', ///ycUSDT - '0x04bC0Ab673d88aE9dbC9DA2380cB6B79C4BCa9aE': '18', //Y2busd - '0x26EA744E5B887E5205727f55dFBE8685e3b21951': '6', ///y2USDC - '0xC2cB1040220768554cf699b0d863A3cd4324ce32': '18', ///y2DAI - '0xE6354ed5bC4b393a5Aad09f21c46E101e692d447': '6', ///y2USDT - '0x57Ab1ec28D129707052df4dF418D58a2D46d5f51': '18', //sUSD - '0x6B175474E89094C44Da98b954EedeAC495271d0F': '18', //DAI - '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48': '6', //USDC - '0x5BC25f649fc4e26069dDF4cF4010F9f706c23831': '18', //dusd - '0x0000000000085d4780B73119b644AE5ecd22b376': '18' - } -] - -async function tvl(ts, block) { - var price_feed = await get('https://api.coingecko.com/api/v3/simple/price?ids=bitcoin,cdai,compound-usd-coin&vs_currencies=usd&include_market_cap=true&include_24hr_vol=true&include_24hr_change=true') - - var tvl = 0; - var btcTVL = 0; - - await Promise.all( - swaps.map(async item => { - await Promise.all( - item.coins.map(async i => { - const poolAmount = await calc(item, i, price_feed, block); - if (item.type == 'btc') { - btcTVL += parseFloat(poolAmount); - } else { - tvl += parseFloat(poolAmount ) - } - }) - ) - }) - ) - - const balances = {} - const wBTC = '0x2260fac5e5542a773aa44fbcfedf7c193bc2c599' - sdk.util.sumSingleBalance(balances, wBTC, btcTVL * 1e8) - sdk.util.sumSingleBalance(balances, '0xdac17f958d2ee523a2206206994597c13d831ec7', tvl * 1e6) // add as usdt - return balances; -} - -async function getVirtualPrice(abi, contract, block) { - const { output: virtualPrice } = await sdk.api.abi.call({ - block, - target: contract, - abi: abi.find(i => i.name === 'getPricePerFullShare') - }) - return virtualPrice; -} - - - -async function calc(item, i, price_feed, block) { - const { output: balances } = await sdk.api.abi.call({ - block, - target: item.address, - params: [i], - abi: item.abi.find(i => i.name === 'balances') - }) - const { output: coins } = await sdk.api.abi.call({ - block, - target: item.address, - params: [i], - abi: item.abi.find(i => i.name === 'coins') - }) - - - var poolAmount = new BigNumber(balances).div(10 ** coinDecimals[0][coins]).toFixed(2); - - - if (item.type == 'compound') { - var multiplier = 1; - if (coins === '0x39AA39c021dfbaE8faC545936693aC917d5E7563') { - multiplier = price_feed['compound-usd-coin'].usd; - } - if (coins === '0x5d3a536E4D6DbD6114cc1Ead35777bAB948E3643') { - multiplier = price_feed.cdai.usd; - } - poolAmount = poolAmount * multiplier; - } - - if (item.type == 'yToken') { - var multiplier = 1; - if (coins !== '0x8E870D67F660D95d5be530380D0eC0bd388289E1') { // PAX exception - multiplier = await getVirtualPrice(abis.abis.yTokens, coins, block) - multiplier = new BigNumber(multiplier).div(10 ** 18).toFixed(4); - } - poolAmount = poolAmount * multiplier; - } - - return poolAmount; -} - - +const { sumTokensExport } = require('./helper/unwrapLPs') +const ADDRESSES = require('./helper/coreAssets.json') module.exports = { - timetravel: false, ethereum: { - tvl + tvl: sumTokensExport({ + owner: '0x329239599afB305DA0A2eC69c58F8a6697F9F88d', + tokens: [ + ADDRESSES.ethereum.TUSD, + ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.USDT, + ADDRESSES.ethereum.DAI, + ] + }) } } diff --git a/projects/swipeswap.js b/projects/swipeswap.js index 309c5232048..62b78be35d6 100644 --- a/projects/swipeswap.js +++ b/projects/swipeswap.js @@ -2,9 +2,9 @@ const { getUniTVL } = require('./helper/unknownTokens') module.exports = { ethereum:{ - tvl: getUniTVL({ chain: 'ethereum', factory: '0x8a93b6865c4492ff17252219b87ea6920848edc0', }) + tvl: getUniTVL({ factory: '0x8a93b6865c4492ff17252219b87ea6920848edc0', useDefaultCoreAssets: true, }) }, bsc:{ - tvl: getUniTVL({ chain: 'bsc', factory: '0x7810d4b7bc4f7faee9deec3242238a39c4f1197d', }) + tvl: getUniTVL({ factory: '0x7810d4b7bc4f7faee9deec3242238a39c4f1197d', useDefaultCoreAssets: true, }) }, } diff --git a/projects/symblox.js b/projects/symblox.js index 32ed91a2ebd..ca2ab31185d 100644 --- a/projects/symblox.js +++ b/projects/symblox.js @@ -66,10 +66,10 @@ async function tvl(timestamp, block, chainBlocks) { syxBalances[i].output / 10 ** 18 ), ]); - }; + } return balances; -}; +} module.exports = { velas: { diff --git a/projects/synlev.js b/projects/synlev.js index 8e675589af4..ab041be7595 100644 --- a/projects/synlev.js +++ b/projects/synlev.js @@ -1,6 +1,7 @@ +const ADDRESSES = require('./helper/coreAssets.json') const sdk = require("@defillama/sdk") -const WETH = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"; +const WETH = ADDRESSES.ethereum.WETH; async function tvl(ts, block) { const balances = {} const { output: balance1 } = await sdk.api.eth.getBalance({ target: '0xFf40827Ee1c4Eb6052044101E1C6E28DBe1440e3', block }) diff --git a/projects/tbill.js b/projects/tbill.js index 54b55458a77..4ab4a7a8159 100644 --- a/projects/tbill.js +++ b/projects/tbill.js @@ -1,17 +1,18 @@ +const ADDRESSES = require('./helper/coreAssets.json') const sdk = require("@defillama/sdk"); async function tvl(timestamp, _, { theta: block }) { return { "theta-fuel": ( await sdk.api.eth.getBalance({ - target: "0x4dc08b15ea0e10b96c41aec22fab934ba15c983e", + target: ADDRESSES.theta.WTFUEL, block, chain: "theta", decimals: 18, }) ).output, }; -}; +} module.exports = { theta: { diff --git a/projects/tempus.js b/projects/tempus.js index bc390e7158c..3e62811b4bf 100644 --- a/projects/tempus.js +++ b/projects/tempus.js @@ -1,10 +1,11 @@ +const ADDRESSES = require('./helper/coreAssets.json') const sdk = require("@defillama/sdk"); -const USDT = "0xdac17f958d2ee523a2206206994597c13d831ec7"; -const USDC = "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" -const DAI = "0x6b175474e89094c44da98b954eedeac495271d0f"; -const YFI = "0x0bc529c00c6401aef6d220be8c6ea1667f6ad93e"; -const WETH = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"; +const USDT = ADDRESSES.ethereum.USDT; +const USDC = ADDRESSES.ethereum.USDC +const DAI = ADDRESSES.ethereum.DAI; +const YFI = ADDRESSES.ethereum.YFI; +const WETH = ADDRESSES.ethereum.WETH; const CHAIN_DATA = { ethereum: { @@ -67,7 +68,7 @@ function tvl(chain) { let balances = {}; const lockedBalances = ( await sdk.api.abi.multiCall({ - abi: { "inputs": [ { "internalType": "contract ITempusPool", "name": "pool", "type": "address" } ], "name": "totalValueLockedInBackingTokens", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, + abi: 'function totalValueLockedInBackingTokens(address pool) view returns (uint256)', calls: pools.map((p) => ({ target: stats, params: [p.address], diff --git a/projects/terrafloki.js b/projects/terrafloki.js index 7ac527c1dc3..ff78e182a7f 100644 --- a/projects/terrafloki.js +++ b/projects/terrafloki.js @@ -18,9 +18,7 @@ async function tvl() { module.exports = { terra:{ - pool2, - staking, - tvl + tvl: () => 0 }, hallmarks:[ [1651881600, "UST depeg"], diff --git a/projects/tomofinance.js b/projects/tomofinance.js index b06f52baa06..44c90a83c06 100644 --- a/projects/tomofinance.js +++ b/projects/tomofinance.js @@ -11,7 +11,7 @@ async function taiSupply(timestamp, ethBlock, {tomochain: block}) { })).output; return { 'usd-coin': supply }; -}; +} module.exports = { timetravel: true, diff --git a/projects/tonbridge.js b/projects/tonbridge.js index 4475fa6e73c..395b1c21196 100644 --- a/projects/tonbridge.js +++ b/projects/tonbridge.js @@ -30,9 +30,9 @@ async function tvl() { for (let i = 0; i < tokenAddresses.length; i++) { const supply = (await axios.get(burl + tokenAddresses[i])).data.totalSupply; balances[tokenMap[tokenAddresses[i]]] = new BigNumber(supply); - }; + } return balances; -}; +} function evm(chain, target) { return async (timestamp, block, chainBlocks) => { @@ -43,7 +43,7 @@ function evm(chain, target) { chain })).output / 10 ** 9 }; }; -}; +} module.exports = { timetravel: false, diff --git a/projects/tonpound.js b/projects/tonpound.js new file mode 100644 index 00000000000..f3477dd18fe --- /dev/null +++ b/projects/tonpound.js @@ -0,0 +1,6 @@ +const { compoundExports2 } = require('./helper/compound'); + +module.exports = { + ethereum:compoundExports2({ comptroller: '0x1775286Cbe9db126a95AbF52c58a3214FCA26803',}), + methodology: "Counts the tokens locked in the contracts to be used as collateral to borrow or to earn yield. Borrowed coins are not counted towards the TVL, so only the coins actually locked in the contracts are counted.", +} \ No newline at end of file diff --git a/projects/trisolaris.js b/projects/trisolaris.js index d8be0aecb0d..32a5aa4cbbb 100644 --- a/projects/trisolaris.js +++ b/projects/trisolaris.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('./helper/coreAssets.json') const { getUniTVL } = require('./helper/unknownTokens') const sdk = require('@defillama/sdk') const { sumTokens2 } = require('./helper/unwrapLPs') @@ -5,7 +6,6 @@ const chain = 'aurora' const dexTVL = getUniTVL({ factory: '0xc66F594268041dB60507F00703b152492fb176E7', - chain: 'aurora', useDefaultCoreAssets: true, }) @@ -16,23 +16,23 @@ async function stableswapTVL(_, _b, { [chain]: block }) { contract: '0x458459E48dbAC0C8Ca83F8D0b7b29FEfE60c3970', tokens: [ '0x5183e1b1091804bc2602586919e6880ac1cf2896', - '0x4988a896b1227218e4a686fde5eabdcabd91571f', - '0xb12bfca5a55806aaf64e99521918a4bf0fc40802', + ADDRESSES.aurora.USDT_e, + ADDRESSES.aurora.USDC_e, ], }, { name: 'USDC/USDT', contract: '0x13e7a001EC72AB30D66E2f386f677e25dCFF5F59', tokens: [ - '0x4988a896b1227218e4a686fde5eabdcabd91571f', - '0xb12bfca5a55806aaf64e99521918a4bf0fc40802', + ADDRESSES.aurora.USDT_e, + ADDRESSES.aurora.USDC_e, ], }, { name: 'nUSD-USDC/USDT', contract: '0x3CE7AAD78B9eb47Fd2b487c463A17AAeD038B7EC', tokens: [ - '0x07379565cd8b0cae7c60dc78e7f601b34af2a21c', + ADDRESSES.aurora.nUSD, ], }, ] diff --git a/projects/typhoon.js b/projects/typhoon.js index 0c78531e37a..e919f9fe1ed 100644 --- a/projects/typhoon.js +++ b/projects/typhoon.js @@ -1,7 +1,8 @@ +const ADDRESSES = require('./helper/coreAssets.json') const sdk = require('@defillama/sdk'); const tornado = '0x9cDb933eDab885bB767658B9ED5C3800bc1d761B'; const reserve = '0xC9B4Dff1ce5384C7014579099e63EA0092e14eD5'; -const weth = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'; +const weth = ADDRESSES.ethereum.WETH; async function tvl(timestamp, block) { return { [weth] : Number((await sdk.api.eth.getBalance({ @@ -11,7 +12,7 @@ async function tvl(timestamp, block) { target: reserve, block })).output)}; -}; +} module.exports = { ethereum: { diff --git a/projects/unagii.js b/projects/unagii.js index 36181746e88..20408950cae 100644 --- a/projects/unagii.js +++ b/projects/unagii.js @@ -51,43 +51,7 @@ module.exports = { } const abi = { - minter: { - "inputs": [], - "name": "minter", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - token: { - "inputs": [], - "name": "token", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - totalAssets: { - "inputs": [], - "name": "totalAssets", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } + minter: "address:minter", + token: "address:token", + totalAssets: "uint256:totalAssets", } \ No newline at end of file diff --git a/projects/unit.js b/projects/unit.js index 461ed89395a..0c2f41b6677 100644 --- a/projects/unit.js +++ b/projects/unit.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('./helper/coreAssets.json') const { sumTokens } = require('./helper/unwrapLPs'); @@ -9,15 +10,15 @@ async function tvl(ts, block) { '0x92e187a03b6cd19cb6af293ba17f2745fd2357d5', '0x1ceb5cb57c4d4e2b2433641b95dd330a33185a44', '0x2ba592F78dB6436527729929AAf6c908497cB200', - '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', + ADDRESSES.ethereum.WETH, '0x0Ae055097C6d159879521C384F1D2123D1f195e6', - '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', + ADDRESSES.ethereum.USDC, '0xbC396689893D065F41bc2C6EcbeE5e0085233447', - '0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9', - '0x4e15361fd6b4bb609fa63c81a2be19d873717870', - '0x0bc529c00C6401aEF6D220BE8C6Ea1667F6Ad93e', - '0xD533a949740bb3306d119CC777fa900bA034cd52', - '0x6b3595068778dd592e39a122f4f5a5cf09c90fe2', + ADDRESSES.ethereum.AAVE, + ADDRESSES.ethereum.FTM, + ADDRESSES.ethereum.YFI, + ADDRESSES.ethereum.CRV, + ADDRESSES.ethereum.SUSHI, '0x4688a8b1f292fdab17e9a90c8bc379dc1dbd8713', '0x8798249c2E607446EfB7Ad49eC89dD1865Ff4272', '0xb753428af26e81097e7fd17f40c88aaa3e04902c', @@ -25,10 +26,10 @@ async function tvl(ts, block) { '0x3472A5A71965499acd81997a54BBA8D852C6E53d', '0xc5bddf9843308380375a611c18b50fb9341f502a', //apecrv '0x1337def16f9b486faed0293eb623dc8395dfe46a', //armor - '0x2260fac5e5542a773aa44fbcfedf7c193bc2c599', //wbtc + ADDRESSES.ethereum.WBTC, //wbtc '0xeb4c2781e4eba804ce9a9803c67d0893436bb27d', //renbtc '0xd291e7a03283640fdc51b121ac401383a46cc623', - '0x6b175474e89094c44da98b954eedeac495271d0f', //dai + ADDRESSES.ethereum.DAI, //dai ]; const toa = tokens.map(t => [t, pool]) return sumTokens({}, toa, block) diff --git a/projects/unslashed.js b/projects/unslashed.js index a73b180c470..fbb77e69b43 100644 --- a/projects/unslashed.js +++ b/projects/unslashed.js @@ -1,10 +1,10 @@ const { sumTokens } = require('./helper/unwrapLPs') -const { get } = require('./helper/http') +const { getConfig } = require('./helper/cache') const ENZYME_VAULT = '0x86fb84e92c1eedc245987d28a42e123202bd6701'.toLowerCase() async function tvl(ts, block) { - const response = (await get('https://app.enzyme.finance/api/v1/network-asset-balances?network=ethereum')) + const response = (await getConfig('enzyme', 'https://app.enzyme.finance/api/v1/network-asset-balances?network=ethereum')) const tokens = response.filter(d => d.vaults.includes(ENZYME_VAULT)).map(d => d.id) const balances = {} await sumTokens(balances, tokens.map(token => [token, ENZYME_VAULT]), block) diff --git a/projects/valuedefi.js b/projects/valuedefi.js index 33de157859f..e218764de75 100644 --- a/projects/valuedefi.js +++ b/projects/valuedefi.js @@ -7,75 +7,15 @@ const swapFactory = '0x1b8e12f839bd4e73a47addf76cf7f0097d74c14c' const stableSwapFactory = '0xc6e111637440d1fe9c1ee45d5a1239771b267122' const abis = { - allPools: { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "allPools", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - allPoolsLength: { - "inputs": [], - "name": "allPoolsLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - getTokenLength: { - "inputs": [], - "name": "getTokenLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - getToken: { - "inputs": [ - { - "internalType": "uint8", - "name": "index", - "type": "uint8" - } - ], - "name": "getToken", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, + allPools: "function allPools(uint256) view returns (address)", + allPoolsLength: "uint256:allPoolsLength", + getTokenLength: "uint256:getTokenLength", + getToken: "function getToken(uint8 index) view returns (address)", } const bscDexTVL = getUniTVL({ - chain: 'bsc', factory: swapFactory, + useDefaultCoreAssets: true, }) async function bscStableSwapTvl(_, _b, { bsc: block }) { diff --git a/projects/vaporwave.js b/projects/vaporwave.js index 02d01c80b4a..4f801f60093 100644 --- a/projects/vaporwave.js +++ b/projects/vaporwave.js @@ -1,24 +1,44 @@ const utils = require("./helper/utils"); -var chainId; -var vault; +const { toUSDTBalances } = require('./helper/balances'); +let _response -async function fetch() { - const response = await utils.fetchURL("https://api.vaporwave.farm/tvl"); +function fetchChain(chainId, staking) { + return async () => { + if (!_response) _response = utils.fetchURL('https://api.vaporwave.farm/tvl') + const response = await _response; - let tvl = 0; - for (chainId in response.data) { + let tvl = 0; const chain = response.data[chainId]; - - for (vault in chain) { - tvl += chain[vault]; + for (const vault in chain) { + const isVWAVE = vault.includes("vwave") + if ((isVWAVE && staking) || (!isVWAVE && !staking)) { + tvl += Number(chain[vault]); + } + } + if (tvl === 0 && !staking) { + throw new Error(`chain ${chainId} tvl is 0`) } + + return toUSDTBalances(tvl); } +} - return tvl; +const chains = { + polygon_zkevm: 1101, + arbitrum: 42161, + aurora: 1313161554, } module.exports = { + timetravel: false, + misrepresentedTokens: true, methodology: - 'TVL data is pulled from the Vaporwave Finance API "https://api.vaporwave.farm/tvl".', - fetch, -}; + 'TVL data is pulled from the Vaporwave Finance API "https://api.vaporwave.farm/tvl".', + doublecounted: true, + ...Object.fromEntries(Object.entries(chains).map(chain => [chain[0], { + tvl: fetchChain(chain[1], false), + staking: fetchChain(chain[1], true), + }])) +} + + diff --git a/projects/velhalla.js b/projects/velhalla.js index 6dd903b9373..7c4ceb9579b 100644 --- a/projects/velhalla.js +++ b/projects/velhalla.js @@ -1,6 +1,7 @@ +const ADDRESSES = require('./helper/coreAssets.json') const sdk = require("@defillama/sdk"); const owner = "0x7DeD7f9D3dF541190F666FB6897483e46D54e948"; -const target = "0x8d9fb713587174ee97e91866050c383b5cee6209"; +const target = ADDRESSES.velas.SCAR; async function staking(timestamp, block, chainBlocks) { return { diff --git a/projects/venus.js b/projects/venus.js index 3b89325ac2a..29dfd3d48de 100644 --- a/projects/venus.js +++ b/projects/venus.js @@ -1,10 +1,11 @@ +const ADDRESSES = require('./helper/coreAssets.json') const {fullCoumpoundExports} = require('./helper/compound'); const replace = { - "0x250632378e573c6be1ac2f97fcdf00515d0aa91b": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", // beth->weth - "0xfb6115445bff7b52feb98650c87f44907e58f802": "0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9", // aave + [ADDRESSES.bsc.BETH]: ADDRESSES.ethereum.WETH, // beth->weth + "0xfb6115445bff7b52feb98650c87f44907e58f802": ADDRESSES.ethereum.AAVE, // aave } -module.exports = fullCoumpoundExports("0xfd36e2c2a6789db23113685031d7f16329158384", "bsc", "0xA07c5b74C9B40447a954e1466938b865b6BBea36", "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c", addr=>{ +module.exports = fullCoumpoundExports("0xfd36e2c2a6789db23113685031d7f16329158384", "bsc", "0xA07c5b74C9B40447a954e1466938b865b6BBea36", ADDRESSES.bsc.WBNB, addr=>{ return replace[addr.toLowerCase()] || `bsc:${addr}` }) diff --git a/projects/veritable.js b/projects/veritable.js index 5e42e751650..950bf35b87f 100644 --- a/projects/veritable.js +++ b/projects/veritable.js @@ -3,7 +3,7 @@ const { transformPolygonAddress } = require("./helper/portedTokens"); const token = "0x6397835430a5a5f8530F30C412CB217CE3f0943b"; const masterchef = "0xE139E30D5C375C59140DFB6FD3bdC91B9406201c"; -const abi = { "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "name": "poolInfo", "outputs": [{ "internalType": "contract IERC20", "name": "lpToken", "type": "address" }, { "internalType": "uint256", "name": "allocPoint", "type": "uint256" }, { "internalType": "uint256", "name": "lastRewardTime", "type": "uint256" }, { "internalType": "uint256", "name": "accVRTPerShare", "type": "uint256" }], "stateMutability": "view", "type": "function" } +const abi = 'function poolInfo(uint256) view returns (address lpToken, uint256 allocPoint, uint256 lastRewardTime, uint256 accVRTPerShare)' async function tvl(timestamp, blokc, chainBlocks) { const balances = {}; @@ -23,7 +23,7 @@ async function tvl(timestamp, blokc, chainBlocks) { ); return balances; -}; +} module.exports = { polygon: {tvl} }; \ No newline at end of file diff --git a/projects/wakafinance.js b/projects/wakafinance.js index 530e8774359..693633155dc 100644 --- a/projects/wakafinance.js +++ b/projects/wakafinance.js @@ -6,7 +6,6 @@ module.exports = { tvl: getUniTVL({ factory: '0xb2435253c71fca27be41206eb2793e44e1df6b6d', useDefaultCoreAssets: true, - chain: 'fantom', }), }, } \ No newline at end of file diff --git a/projects/wanbridge.js b/projects/wanbridge.js index 8b73dbe2520..7e116b62204 100644 --- a/projects/wanbridge.js +++ b/projects/wanbridge.js @@ -1,40 +1,43 @@ const { get } = require("./helper/http"); -let data - -async function getAll() { - if (!data) data = _getAll() - return data -} - -async function _getAll() { - let cache = {}; - cache.minted = await get("https://wanscan.org/api/cc/minted"); - // cache.stake = await get("https://wanscan.org/api/cc/stake"); - // cache.timestamp = Date.now(); - return cache; +let ret; +async function getTvl() { + // This is an api which could get wanchain bridge's lockAddress, balance, tvl and price; + // The infomation is updated every 1 hour. + if (!ret) { + ret = await get("https://api.wanpos.xyz/api/tvl"); + } + return ret.data.tvl; } const chainsMap = { - wan: "wanchain", - ethereum: "ethereum", + arbitrum: "arbitrum", + astar: "astar", + avax: "avalanche", bsc: "bsc", - avax: "avax", - moonriver: "moonriver", - polygon: "polygon", + bitcoin: "btc", + doge: "doge", + ethereum: "ethereum", + fantom: "fantom", + litecoin: "ltc", moonbeam: "moonbeam", + moonriver: "moonriver", okexchain: "okexchain", - clv: "clover", + optimism: "optimism", + polkadot: "polkadot", + polygon: "polygon", + tron: "tron", + wan: "wanchain", xdc: "xdc", -} + ripple: "xrp", + // clover: "clover", + // telos: "telos", +}; Object.keys(chainsMap).map((chain) => { module.exports[chain] = { tvl: async () => { - let ret = await getAll(); - let minted = ret.minted.filter((v) => v.chain == chainsMap[chain]); - let total = 0; - minted.map((v) => (total += v.quantity * v.price)); - return { tether: total } + let ret = await getTvl(); + return { tether: ret[chainsMap[chain]] } }, }; }); diff --git a/projects/wault.js b/projects/wault.js index d68c2d54d6d..b231c59703e 100644 --- a/projects/wault.js +++ b/projects/wault.js @@ -1,28 +1,9 @@ -const axios = require('axios'); - -async function fetchBsc() { - let bsc = await axios.get('https://api.wault.finance/waultTotalValueLocked.json'); - return bsc.data.protocolTvl; -} - -async function fetchPoly() { - let poly = await axios.get('https://polyapi.wault.finance/waultTotalValueLocked.json'); - return poly.data.protocolTvl; -} - -async function fetch() { - let poly = await axios.get('https://polyapi.wault.finance/waultTotalValueLocked.json'); - let bsc = await axios.get('https://api.wault.finance/waultTotalValueLocked.json'); - const tvl = poly.data.protocolTvl + bsc.data.protocolTvl; - return tvl; -} module.exports = { bsc: { - fetch: () => 0 + tvl: () => 0 }, polygon: { - fetch: () => 0 + tvl: () => 0 }, - fetch: () => 0 // Project was initially relaunced as thorus.fi but it is dead now } diff --git a/projects/wbtc.js b/projects/wbtc.js index 1dfc6cacc97..39e9bc8f89d 100644 --- a/projects/wbtc.js +++ b/projects/wbtc.js @@ -1,12 +1,20 @@ +const ADDRESSES = require('./helper/coreAssets.json') const sdk = require('@defillama/sdk') async function tvl(ts, block) { return { - '0x2260fac5e5542a773aa44fbcfedf7c193bc2c599': (await sdk.api.erc20.totalSupply({ target: '0x2260fac5e5542a773aa44fbcfedf7c193bc2c599', block })).output + [ADDRESSES.ethereum.WBTC]: (await sdk.api.erc20.totalSupply({ target: ADDRESSES.ethereum.WBTC, block })).output + } +} +async function tvlTron(ts, block, _, { api }) { + return { + [ADDRESSES.ethereum.WBTC]: (await api.call({ target: 'TXpw8XeWYeTUd4quDskoUqeQPowRh4jY65', abi: 'erc20:totalSupply' })), + ['ethereum:'+ADDRESSES.null]: (await api.call({ target: 'TXWkP3jLBqRGojUih1ShzNyDaN5Csnebok', abi: 'erc20:totalSupply' })), } } module.exports = { ethereum: { tvl }, + tron: { tvl: tvlTron }, methodology: `TVL for WBTC consists of the BTC deposits in custody that were used to mint WBTC` } diff --git a/projects/wepiggy.js b/projects/wepiggy.js index 0c6a6ac77b1..736c416c9bf 100644 --- a/projects/wepiggy.js +++ b/projects/wepiggy.js @@ -99,3 +99,6 @@ module.exports={ ...chainExports, methodology: `TVL is comprised of tokens deposited to the protocol as collateral, similar to Compound Finance and other lending protocols the borrowed tokens are not counted as TVL.` } + +module.exports.oasis = { tvl: () => 0, borrowed: () => 0 } +module.exports.heco = { tvl: () => 0, borrowed: () => 0 } \ No newline at end of file diff --git a/projects/woofi.js b/projects/woofi.js index aae9709543a..f3bd2151c28 100644 --- a/projects/woofi.js +++ b/projects/woofi.js @@ -1,75 +1,148 @@ -const { staking } = require('./helper/staking') +const ADDRESSES = require('./helper/coreAssets.json') +const { staking, stakings } = require('./helper/staking') const wooPPConfig = { fantom: [ - '0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83', // WFTM + ADDRESSES.fantom.WFTM, // WFTM '0x74b23882a30290451A17c44f4F05243b6b58C76d', // ETH '0x321162Cd933E2Be498Cd2267a90534A804051b11', // BTC '0x6626c47c00F1D87902fc13EECfaC3ed06D5E8D8a', // WOO - '0x04068DA6C83AFCFA0e13ba15A6696662335D5B75', // USDC + ADDRESSES.fantom.USDC, // USDC + ADDRESSES.fantom.fUSDT, ], bsc: [ - '0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c', // WBNB - '0x2170Ed0880ac9A755fd29B2688956BD959F933F8', // ETH - '0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c', // BTC + ADDRESSES.bsc.WBNB, // WBNB + ADDRESSES.bsc.ETH, // ETH + ADDRESSES.bsc.BTCB, // BTC '0x4691937a7508860F876c9c0a2a617E7d9E945D4B', // WOO - '0x55d398326f99059fF775485246999027B3197955', // USDT + ADDRESSES.bsc.USDT, // USDT + ADDRESSES.bsc.BUSD, // BUSD ], avax: [ - '0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7', // WAVAX - '0x49D5c2BdFfac6CE2BFdB6640F4F80f226bc10bAB', // WETH.e - '0x152b9d0FdC40C096757F570A51E494bd4b943E50', // BTC.b + ADDRESSES.avax.WAVAX, // WAVAX + ADDRESSES.avax.WETH_e, // WETH.e + ADDRESSES.avax.BTC_b, // BTC.b '0xaBC9547B534519fF73921b1FBA6E672b5f58D083', // WOO.e - '0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E', // USDC + ADDRESSES.avax.USDC, // USDC + ADDRESSES.avax.USDt, ], polygon: [ - '0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270', // WMATIC - '0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619', // WETH - '0x1BFD67037B42Cf73acF2047067bd4F2C47D9BfD6', // WBTC + ADDRESSES.polygon.WMATIC_2, // WMATIC + ADDRESSES.polygon.WETH_1, // WETH + ADDRESSES.polygon.WBTC, // WBTC '0x1B815d120B3eF02039Ee11dC2d33DE7aA4a8C603', // WOO - '0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174', // USDC + ADDRESSES.polygon.USDC, // USDC + ADDRESSES.polygon.USDT, ], arbitrum: [ - '0x82aF49447D8a07e3bd95BD0d56f35241523fBab1', // WETH - '0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f', // WBTC + ADDRESSES.arbitrum.WETH, // WETH + ADDRESSES.arbitrum.WBTC, // WBTC '0xcAFcD85D8ca7Ad1e1C6F82F651fA15E33AEfD07b', // WOO - '0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8', // USDC + ADDRESSES.arbitrum.ARB, // ARB + ADDRESSES.arbitrum.USDC, // USDC + ADDRESSES.arbitrum.USDC_CIRCLE, // native USDC + ADDRESSES.arbitrum.USDT, + ], + optimism: [ + ADDRESSES.tombchain.FTM, // WETH + '0x68f180fcCe6836688e9084f035309E29Bf0A2095', // WBTC + ADDRESSES.optimism.OP, // OP + ADDRESSES.optimism.USDC, // USDC + ADDRESSES.optimism.USDT, + '0x871f2F2ff935FD1eD867842FF2a7bfD051A5E527', // WOO + ], + ethereum: [], + era: [ + ADDRESSES.era.WETH, // WETH + ADDRESSES.era.USDC, // USDC + ], + polygon_zkevm: [ + ADDRESSES.polygon_zkevm.WETH, + ADDRESSES.polygon_zkevm.USDC, ], } const chainConfig = { fantom: { - wooPPContract: '0x9503E7517D3C5bc4f9E4A1c6AE4f8B33AC2546f2', + wooPPContract: '0x286ab107c5E9083dBed35A2B5fb0242538F4f9bf', woo: '0x6626c47c00f1d87902fc13eecfac3ed06d5e8d8a', stakingContract: '0x2Fe5E5D341cFFa606a5d9DA1B6B646a381B0f7ec', + stakingContractV2: '0x1416E1378682b5Ca53F76656549f7570ad0703d9', }, bsc: { - wooPPContract: '0xbf365Ce9cFcb2d5855521985E351bA3bcf77FD3F', + wooPPContract: '0x59dE3B49314Bf5067719364A2Cb43e8525ab93FA', woo: '0x4691937a7508860f876c9c0a2a617e7d9e945d4b', stakingContract: '0x2AEab1a338bCB1758f71BD5aF40637cEE2085076', + stakingContractV2: '0xba91ffD8a2B9F68231eCA6aF51623B3433A89b13', }, avax: { - wooPPContract: '0x1df3009c57a8B143c6246149F00B090Bce3b8f88', + wooPPContract: '0x3b3E4b4741e91aF52d0e9ad8660573E951c88524', woo: '0xabc9547b534519ff73921b1fba6e672b5f58d083', stakingContract: '0xcd1B9810872aeC66d450c761E93638FB9FE09DB0', + stakingContractV2: '0x3Bd96847C40De8b0F20dA32568BD15462C1386E3', }, polygon: { - wooPPContract: '0x7400B665C8f4f3a951a99f1ee9872efb8778723d', + wooPPContract: '0x7081A38158BD050Ae4a86e38E0225Bc281887d7E', woo: '0x1b815d120b3ef02039ee11dc2d33de7aa4a8c603', stakingContract: '0x9BCf8b0B62F220f3900e2dc42dEB85C3f79b405B', + stakingContractV2: '0xba91ffD8a2B9F68231eCA6aF51623B3433A89b13', }, arbitrum: { wooPPContract: '0xeFF23B4bE1091b53205E35f3AfCD9C7182bf3062', woo: '0xcafcd85d8ca7ad1e1c6f82f651fa15e33aefd07b', stakingContract: '0x9321785D257b3f0eF7Ff75436a87141C683DC99d', - } + stakingContractV2: '0x2CFa72E7f58dc82B990529450Ffa83791db7d8e2', + }, + optimism: { + wooPPContract: '0xd1778F9DF3eee5473A9640f13682e3846f61fEbC', + woo: '0x871f2f2ff935fd1ed867842ff2a7bfd051a5e527', + stakingContract: null, + stakingContractV2: '0xba91ffD8a2B9F68231eCA6aF51623B3433A89b13', + }, + ethereum: { + wooPPContract: null, + woo: '0x4691937a7508860F876c9c0a2a617E7d9E945D4B', + stakingContract: null, + stakingContractV2: '0xba91ffD8a2B9F68231eCA6aF51623B3433A89b13', + }, + era: { + wooPPContract: '0x42ED123EB5266A5B8E2B54B2C76180CCF5e72FEe', + woo: null, + stakingContract: null, + stakingContractV2: null, + }, + polygon_zkevm: { + wooPPContract: '0xF5d215d9C84778F85746D15762DaF39B9E83a2d6', + woo: null, + stakingContract: null, + stakingContractV2: null, + }, } Object.keys(chainConfig).forEach(chain => { const wooPPTokens = wooPPConfig[chain] - const { wooPPContract, woo, stakingContract } = chainConfig[chain] + const { wooPPContract, woo, stakingContract, stakingContractV2 } = chainConfig[chain] + + var tvl = 0 + if (wooPPContract != null) { + tvl = staking(wooPPContract, wooPPTokens, chain) + } + + var contracts = [] + if (stakingContract != null) { + contracts.push(stakingContract) + } + if (stakingContractV2 != null) { + contracts.push(stakingContractV2) + } + + var stakingAmount = 0 + if (woo != null) { + stakingAmount = stakings(contracts, woo, chain) + } + module.exports[chain] = { - staking: staking(stakingContract, woo, chain), - tvl: staking(wooPPContract, wooPPTokens, chain), + staking: stakingAmount, + tvl: tvl, } }) diff --git a/projects/wormhole.js b/projects/wormhole.js index dec8e7aee40..803081be60e 100644 --- a/projects/wormhole.js +++ b/projects/wormhole.js @@ -1,6 +1,6 @@ const { get } = require('./helper/http') const BigNumber = require("bignumber.js"); -const url = 'https://europe-west3-wormhole-315720.cloudfunctions.net/mainnet-notionaltvl' +const url = 'https://europe-west3-wormhole-message-db-mainnet.cloudfunctions.net/tvl' let _response function fetch(chainId) { @@ -25,9 +25,6 @@ module.exports = { ethereum: { fetch: fetch("2") }, - aptos: { - fetch: fetch("22") - }, terra: { fetch: fetch("3") }, @@ -56,7 +53,7 @@ module.exports = { fetch: fetch("11") }, acala: { - fetch: fetch("12") + fetch: fetch("12") }, klaytn: { fetch: fetch("13") @@ -73,9 +70,30 @@ module.exports = { terra2: { fetch: fetch("18") }, + injective: { + fetch: fetch("19") + }, + sui: { + fetch: fetch("21") + }, + aptos: { + fetch: fetch("22") + }, + arbitrum: { + fetch: fetch("23") + }, + optimism: { + fetch: fetch("24") + }, + xpla: { + fetch: fetch("28") + }, + base: { + fetch: fetch("30") + }, fetch: fetch("*"), - hallmarks:[ + hallmarks: [ [1652008803, "UST depeg"], - [Math.floor(new Date('2022-02-02')/1e3), 'Hacked: Signature Exploit'], + [Math.floor(new Date('2022-02-02') / 1e3), 'Hacked: Signature Exploit'], ], } diff --git a/projects/wrappedBNB.js b/projects/wrappedBNB.js index 334be223187..f7b9e4c2834 100644 --- a/projects/wrappedBNB.js +++ b/projects/wrappedBNB.js @@ -1,13 +1,14 @@ -const { get } = require('./helper/http') +const { queryV1Beta1 } = require('./helper/chain/cosmos'); +const { transformBalances } = require('./helper/portedTokens') + +const chain = 'kava' async function tvl() { - const totals = (await get('https://api.kava.io/bank/total')).result.supply; - const bnb = (totals.filter(a => a.denom == 'bnb'))[0]; - const supply = bnb.amount / 10 ** 8; - return { 'binancecoin': supply }; -}; + const data = await queryV1Beta1({ chain, url: '/bep3/v1beta1/assetsupply/bnb'}) // https://swagger.kava.io/#/BEP3/BEP3AssetSupply + return transformBalances(chain, { bnb: data.asset_supply.current_supply.amount}) +} module.exports = { - timetravel: false, - bsc: { tvl } + timetravel: false, + bsc: { tvl } }; \ No newline at end of file diff --git a/projects/wrappedfi.js b/projects/wrappedfi.js index 8742fbe4c7e..8e9ca0d4b31 100644 --- a/projects/wrappedfi.js +++ b/projects/wrappedfi.js @@ -1,5 +1,4 @@ const sdk = require("@defillama/sdk"); -const { getBlock } = require("./helper/getBlock"); const ethContracts = [ /** diff --git a/projects/yuzu.js b/projects/yuzu.js index 7c8786384dc..6ef7401a4d3 100644 --- a/projects/yuzu.js +++ b/projects/yuzu.js @@ -1,6 +1,6 @@ const { getUniTVL } = require('./helper/unknownTokens') module.exports = { oasis: { - tvl: getUniTVL({ factory: '0x5F50fDC22697591c1D7BfBE8021163Fc73513653', chain: 'oasis', useDefaultCoreAssets: true }), + tvl: getUniTVL({ factory: '0x5F50fDC22697591c1D7BfBE8021163Fc73513653', useDefaultCoreAssets: true }), }, }; \ No newline at end of file diff --git a/projects/zai.js b/projects/zai.js index c83c23e8f29..b2651dba07f 100644 --- a/projects/zai.js +++ b/projects/zai.js @@ -1,45 +1,11 @@ -const sdk = require("@defillama/sdk"); -const { unwrapUniswapLPs } = require('./helper/unwrapLPs'); -const zaiV1 = '0x9d1233cc46795e94029fda81aaadc1455d510f15'; +const { staking } = require('./helper/staking') const zaiV2 = '0xe420bce9109365eae3ba6ebf24e5045b72388025'; const zaiLP = '0x675a8fa1cf8a9c3bf2c49ff14fdcaa01b11dd842'; -async function tvl() { - return {}; -}; - -async function staking(timestamp, block) { - const zaiBalance = (await sdk.api.erc20.balanceOf({ - block, - target: zaiV2, - owner: '0xE2612091Ec3dBE6f40BbfD0f30e3b8E4eA896e53' - })).output; - return { [zaiV1]: zaiBalance }; -}; - -async function pool2(timestamp, block) { - let balances = {}; - const lpBalance = (await sdk.api.erc20.balanceOf({ - block, - target: zaiLP, - owner: '0x326E906A28Cd7fF56cCe6A84a8043786B8762cDf' - })).output; - - await unwrapUniswapLPs( - balances, - [{ balance: lpBalance, token: zaiLP }], - block - ); - - balances[zaiV1] = balances[zaiV2]; - delete balances[zaiV2]; - - return balances; -}; module.exports = { - ethereum: { - tvl, - staking, - pool2 - } + ethereum: { + tvl: () => 0, + pool2: staking('0x326E906A28Cd7fF56cCe6A84a8043786B8762cDf', zaiLP), + staking: staking('0xE2612091Ec3dBE6f40BbfD0f30e3b8E4eA896e53', zaiV2), + } }; \ No newline at end of file From 0d42d392949f6bb7243d09bbc4cfb265246383be Mon Sep 17 00:00:00 2001 From: power-f-god Date: Thu, 3 Aug 2023 11:44:35 +0100 Subject: [PATCH 0644/1974] chore: Sync liquidations. --- liquidations/angle/index.ts | 12 +- liquidations/gravita-protocol/index.ts | 174 +++++++++++++++++++++ liquidations/mimo-protocol/index.ts | 200 +++++++++++++++++++++++++ liquidations/strike/index.ts | 148 ++++++++++++++++++ liquidations/utils/binResults.ts | 4 + 5 files changed, 532 insertions(+), 6 deletions(-) create mode 100644 liquidations/gravita-protocol/index.ts create mode 100644 liquidations/mimo-protocol/index.ts create mode 100644 liquidations/strike/index.ts diff --git a/liquidations/angle/index.ts b/liquidations/angle/index.ts index 03c0eb31582..26a93a770a3 100644 --- a/liquidations/angle/index.ts +++ b/liquidations/angle/index.ts @@ -136,12 +136,12 @@ module.exports = { ethereum: { liquidations: positions(Chain.ethereum), }, - polygon: { - liquidations: positions(Chain.polygon), - }, - optimism: { - liquidations: positions(Chain.optimism), - }, + // polygon: { + // liquidations: positions(Chain.polygon), + // }, + // optimism: { + // liquidations: positions(Chain.optimism), + // }, arbitrum: { liquidations: positions(Chain.arbitrum), }, diff --git a/liquidations/gravita-protocol/index.ts b/liquidations/gravita-protocol/index.ts new file mode 100644 index 00000000000..e681aeb183a --- /dev/null +++ b/liquidations/gravita-protocol/index.ts @@ -0,0 +1,174 @@ +import axios from "axios"; +import BigNumber from "bignumber.js"; +import { Liq } from "../utils/types"; +const sdk = require("@defillama/sdk"); + +type MulticallResponse = { + output: { + input: any; + success: boolean; + output: T; + }[]; +}; + +const ADMIN_CONTRACT_ADDRESS = "0xf7Cc67326F9A1D057c1e4b110eF6c680B13a1f53"; +const VESSEL_MANAGER_CONTRACT_ADDRESS = "0xdB5DAcB1DFbe16326C3656a88017f0cB4ece0977"; +const BLUSD_CONTRACT_ADDRESS = "0xB9D7DdDca9a4AC480991865EfEf82E01273F79C3"; +const WETH_CONTRACT_ADDRESS = "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"; + +const EXPLORER_BASE_URL = "https://etherscan.io/address/"; + +const getTokenInfo = async (tokenId: string) => { + const info = (await axios.get("https://coins.llama.fi/prices/current/" + tokenId)).data.coins as { + [tokenId: string]: { + decimals: number; + price: number; + symbol: string; + timestamp: number; + confidence: number; + }; + }; + const price = info[tokenId]; + return price; +}; + +// cr * debt / collateral = price +const calculateLiquidationPrice = (debt: string, collateral: string, cr: string) => { + const price = new BigNumber(cr).times(debt).div(collateral).toString(); + return price; +}; + +const tokenToCollateralAddress = (token: string) => { + if (token === WETH_CONTRACT_ADDRESS) { + return "ethereum:0x0000000000000000000000000000000000000000" + } + return "ethereum:" + token +} + +const positions = async () => { + let collAddresses = (await sdk.api.abi.call({ + abi: "function getValidCollateral() external view returns (address[])", + target: ADMIN_CONTRACT_ADDRESS, + })).output; + + collAddresses = collAddresses.filter(i => i !== BLUSD_CONTRACT_ADDRESS) // BLUSD is not liquidatable + + // get prices for calculating recovery mode + const prices = {} + for (const c of collAddresses) { + const info = await getTokenInfo(`ethereum:${c}`) + prices[c] = BigNumber(info.price).times(10e18).toFixed() + } + + const vesselCounts = ( + (await sdk.api.abi.multiCall({ + calls: collAddresses.map((i) => ({ target: VESSEL_MANAGER_CONTRACT_ADDRESS, params: [i] })), + abi: "function getVesselOwnersCount(address) external view returns (uint256)", + requery: true, + })) as MulticallResponse + ).output.map((x, i) => { + return { + asset: collAddresses[i], + count: x.output + } + }); + + const vesselOwnerQueries = ([] as any[]).concat(...vesselCounts.map(({ asset, count }) => { + return Array.from(Array(Number(count))).map((_, i) => { + return { + target: VESSEL_MANAGER_CONTRACT_ADDRESS, + params: [asset, i] + } + }) + })); + + const vesselAddresses = ( + (await sdk.api.abi.multiCall({ + calls: vesselOwnerQueries, + abi: "function getVesselFromVesselOwnersArray(address,uint256) external view returns (address)", + requery: true, + })) as MulticallResponse + ).output.map((x, i) => { + return { + asset: vesselOwnerQueries[i].params[0], + vessel: x.output + } + }); + + const vesselDebtsAndCollaterals = ( + (await sdk.api.abi.multiCall({ + calls: vesselAddresses.map((i) => ({ target: VESSEL_MANAGER_CONTRACT_ADDRESS, params: [i.asset, i.vessel] })), + abi: "function getEntireDebtAndColl(address,address) external view returns (uint256,uint256,uint256,uint256)", + requery: true, + })) as MulticallResponse + ).output.map((x, i) => { + return { + asset: vesselAddresses[i].asset, + owner: vesselAddresses[i].vessel, + coll: x.output[1], + debt: x.output[0] + } + }); + + const recoveryModeCRs = ( + (await sdk.api.abi.multiCall({ + calls: collAddresses.map((i) => ({ target: ADMIN_CONTRACT_ADDRESS, params: [i] })), + abi: "function getCcr(address) external view returns (uint256)", + requery: true, + })) as MulticallResponse + ).output.map((x, i) => { + return { + asset: collAddresses[i], + recoveryCR: BigNumber(x.output).div(10e17).toFixed(3) + } + }); + + const minimumCRs = ( + (await sdk.api.abi.multiCall({ + calls: collAddresses.map((i) => ({ target: ADMIN_CONTRACT_ADDRESS, params: [i] })), + abi: "function getMcr(address) external view returns (uint256)", + requery: true, + })) as MulticallResponse + ).output.map((x, i) => { + return { + asset: collAddresses[i], + minCR: BigNumber(x.output).div(10e17).toFixed(3) + } + }); + + const recoveryModes = ( + (await sdk.api.abi.multiCall({ + calls: collAddresses.map((i) => ({ target: VESSEL_MANAGER_CONTRACT_ADDRESS, params: [i, prices[i]] })), + abi: "function checkRecoveryMode(address,uint256) external view returns (bool)", + requery: true, + })) as MulticallResponse + ).output.map((x, i) => { + return { + asset: collAddresses[i], + isRecoveryMode: x.output + } + }); + + const vessels = vesselDebtsAndCollaterals.map(({ asset, coll, debt, owner }) => { + const cr = recoveryModes.find(i => i.asset === asset).isRecoveryMode ? + recoveryModeCRs.find(i => i.asset === asset).recoveryCR : + minimumCRs.find(i => i.asset === asset).minCR; + return { + owner, + liqPrice: Number(calculateLiquidationPrice(debt, coll, cr)), + collateral: tokenToCollateralAddress(asset), // ETH + collateralAmount: coll, + extra: { + url: EXPLORER_BASE_URL + owner, + }, + } as Liq; + }); + + return vessels; +}; + +module.exports = { + ethereum: { + liquidations: positions, + }, +}; diff --git a/liquidations/mimo-protocol/index.ts b/liquidations/mimo-protocol/index.ts new file mode 100644 index 00000000000..9d0bc72c796 --- /dev/null +++ b/liquidations/mimo-protocol/index.ts @@ -0,0 +1,200 @@ +import axios from "axios"; +import { gql } from "graphql-request"; +import BigNumber from "bignumber.js"; +import { getPagedGql } from "../utils/gql"; +import { Liq } from "../utils/types"; +const sdk = require("@defillama/sdk"); + +const RATE_ACCURACY = BigNumber("1000000000000000000000000000"); // 1e27 + +const latestRoundDataABI = { + inputs: [], + name: "latestRoundData", + outputs: [ + { internalType: "uint80", name: "roundId", type: "uint80" }, + { internalType: "int256", name: "answer", type: "int256" }, + { internalType: "uint256", name: "startedAt", type: "uint256" }, + { internalType: "uint256", name: "updatedAt", type: "uint256" }, + { internalType: "uint80", name: "answeredInRound", type: "uint80" }, + ], + stateMutability: "view", + type: "function", +}; + +enum Chain { + ethereum = "ethereum", + polygon = "polygon", + // fantom = "fantom", +} + +const getEURUSD = async (chain: Chain) => { + const oracleAddresses = { + [Chain.ethereum]: "0xb49f677943bc038e9857d61e7d053caa2c1734c1", + [Chain.polygon]: "0x73366fe0aa0ded304479862808e02506fe556a98", + // [Chain.fantom]: "0x3e68e68ea2c3698400465e3104843597690ae0f7", + }; + + const eurUSDRoundData = await sdk.api.abi.call({ + chain: chain, + target: oracleAddresses[chain], + params: [], + abi: latestRoundDataABI, + }); + + return eurUSDRoundData.output.answer / 10 ** 8; +}; + +const getSubgraphUrl = (chain: Chain) => { + let subgraphUrl: string; + + switch (chain) { + case Chain.ethereum: { + subgraphUrl = "https://api.thegraph.com/subgraphs/name/m19/titan"; + break; + } + case Chain.polygon: { + subgraphUrl = "https://api.thegraph.com/subgraphs/name/m19/titanpolygon"; + break; + } + // case Chain.fantom: { + // subgraphUrl = + // "https://api.thegraph.com/subgraphs/name/rayxpub/titanfantom"; + // break; + // } + } + + return subgraphUrl; +}; + +const vaultsQuery = gql` + query vaults($lastId: ID, $pageSize: Int) { + vaults(first: $pageSize, where: { id_gt: $lastId, baseDebt_gt: 0 }) { + id + owner { + id + } + baseDebt + collateralBalance + collateralType + } + } +`; + +const collateralQuery = gql` + query collateralConfigs($lastId: ID, $pageSize: Int) { + collateralConfigs(first: $pageSize, where: { id_gt: $lastId }) { + id + currentCumulativeRate + liquidationRatio + } + } +`; + +type VaultData = { + id: string; + baseDebt: string; + collateralBalance: string; + collateralType: string; + owner: { + id: string; + }; +}; + +type CollateralConfig = { + id: string; + currentCumulativeRate: string; + liquidationRatio: string; +}; + +const getVaultData = async (chain: Chain) => { + const subgraphUrl = getSubgraphUrl(chain); + const vaultData = (await getPagedGql( + subgraphUrl, + vaultsQuery, + "vaults" + )) as VaultData[]; + return vaultData; +}; + +const getTokenInfo = async (tokenId: string) => { + const info = ( + await axios.get("https://coins.llama.fi/prices/current/" + tokenId) + ).data.coins as { + [tokenId: string]: { + decimals: number; + price: number; + symbol: string; + timestamp: number; + confidence: number; + }; + }; + const price = info[tokenId]; + return price; +}; + +const getCollateralConfigs = async (chain: Chain) => { + const subgraphUrl = getSubgraphUrl(chain); + const collateralConfigsData = (await getPagedGql( + subgraphUrl, + collateralQuery, + "collateralConfigs" + )) as CollateralConfig[]; + + return collateralConfigsData + .filter( + (value) => value.id !== "0x0000000000000000000000000000000000000001" + ) // get rid of some faulty configs + .reduce(async (previous, item, index, array) => { + const result = await previous; + result[item.id] = { + ...item, + tokenInfo: await getTokenInfo(`${chain}:${item.id}`), + }; + return result; + }, Promise.resolve({})); +}; + +const positions = (chain: Chain) => async (): Promise => { + const vaultData = await getVaultData(chain); + const collateralConfigs = await getCollateralConfigs(chain); + + const eurUSD = await getEURUSD(chain); + + const positions: Liq[] = vaultData.map((data) => { + const collateralConfig = collateralConfigs[data.collateralType]; + const currentCumulativeRate = collateralConfig.currentCumulativeRate; + const vaultDebt = BigNumber(currentCumulativeRate) + .times(BigNumber(data.baseDebt)) + .div(RATE_ACCURACY) + .div(10 ** 18); // debt is always in PAR, and PAR is 18 decimals + + const accuracy = BigNumber(10 ** collateralConfig.tokenInfo.decimals); + const liqPriceInPAR = vaultDebt + .times(accuracy) + .times(BigNumber(collateralConfig.liquidationRatio)) + .div(BigNumber(data.collateralBalance)) + .div(BigNumber(10 ** 18)); + const liqPrice = liqPriceInPAR.times(eurUSD); + + return { + owner: data.owner.id, + liqPrice: liqPrice.toNumber(), + collateral: `${chain}:${data.collateralType}`, + collateralAmount: data.collateralBalance, + }; + }); + + return positions.filter((position) => position.liqPrice > 0); +}; + +module.exports = { + ethereum: { + liquidations: positions(Chain.ethereum), + }, + polygon: { + liquidations: positions(Chain.polygon), + }, + // fantom: { + // liquidations: positions(Chain.fantom), + // }, +}; diff --git a/liquidations/strike/index.ts b/liquidations/strike/index.ts new file mode 100644 index 00000000000..a609dceec3b --- /dev/null +++ b/liquidations/strike/index.ts @@ -0,0 +1,148 @@ +import { gql } from "graphql-request"; +import { getPagedGql } from "../utils/gql"; +import BigNumber from "bignumber.js"; +import { Liq, Prices } from "../utils/types"; +import { + Account, + borrowBalanceUnderlying, + getMarkets, + getUnderlyingPrices, + totalBorrowValueInUsd, + tokenInUsd, +} from "../utils/compound-helpers"; + +const bignum = (value: string | number) => new BigNumber(value); +const supplyBalanceUnderlying = (sToken: any): BigNumber => + bignum(sToken.sTokenBalance).times(sToken.market.exchangeRate); +const totalCollateralValueInUsd = (account: any, prices: Prices, chainPrefix: string): BigNumber => + account.tokens.reduce( + (acc, token) => acc.plus(tokenInUsd(token.market, prices, chainPrefix).times(token.sTokenBalance)), + bignum("0") + ); + +const subgraphUrl = "https://api.thegraph.com/subgraphs/name/elias029/strike-lending"; + +const accountsQuery = gql` + query accounts($lastId: ID, $pageSize: Int) { + accounts(first: $pageSize, where: { hasBorrowed: true, id_gt: $lastId }) { + id + tokens { + id + sTokenBalance + accountBorrowIndex + storedBorrowBalance + market { + id + name + symbol + + exchangeRate + collateralFactor + borrowIndex + + underlyingAddress + } + enteredMarket + } + hasBorrowed + } + _meta { + block { + number + } + } + } +`; + +const EXPLORER_BASE_URL = "https://etherscan.io/address/"; + +const positions = async () => { + const accounts = (await getPagedGql(subgraphUrl, accountsQuery, "accounts")) as Account[]; + const markets = await getMarkets(subgraphUrl); + const prices = await getUnderlyingPrices(markets, "ethereum:"); + + // all positions across all users + const positions = accounts.flatMap((account) => { + const _totalBorrowValueInUsd = totalBorrowValueInUsd(account, prices, "ethereum:"); + const _totalCollateralValueInUsd = totalCollateralValueInUsd(account, prices, "ethereum:"); + // console.log('_totalBorrowValueInUsd', _totalBorrowValueInUsd) + // console.log('_totalCollateralValueInUsd', _totalCollateralValueInUsd) + + const debts = account.tokens + .filter((token) => { + const _borrowBalanceUnderlying = borrowBalanceUnderlying(token); + const _supplyBalanceUnderlying = supplyBalanceUnderlying(token); + return !(_borrowBalanceUnderlying.eq(0) && _supplyBalanceUnderlying.eq(0)); + }) + .map((token) => { + const _borrowBalanceUnderlying = borrowBalanceUnderlying(token); + const _supplyBalanceUnderlying = supplyBalanceUnderlying(token); + const _price = prices["ethereum:" + token.market.underlyingAddress]; + if (!_price) { + // console.log("no price for", "ethereum:" + token.market.underlyingAddress); + return { + debt: new BigNumber(0), + price: 0, + token: "ethereum:" + token.market.underlyingAddress, + totalBal: _supplyBalanceUnderlying, + decimals: 0, + }; + } + const decimals = _price.decimals; + const price = _price.price; + const collateralFactor = Number(token.market.collateralFactor); // equivalent to liqThreshold in aave + let debt = _borrowBalanceUnderlying; + if (token.enteredMarket) { + const factoredSupply = _supplyBalanceUnderlying.times(collateralFactor); + debt = debt.minus(factoredSupply); + } + debt = debt.times(price); + return { + debt, + price, + token: "ethereum:" + token.market.underlyingAddress, + totalBal: _supplyBalanceUnderlying, + decimals, + }; + }); + + const liquidablePositions = debts + .filter(({ debt }) => debt.lt(0)) + .map((pos) => { + const usdPosNetCollateral = pos.debt.negated(); + const otherCollateral = _totalCollateralValueInUsd.minus(usdPosNetCollateral); + const diffDebt = _totalBorrowValueInUsd.minus(otherCollateral); + if (diffDebt.gt(0)) { + const amountCollateral = usdPosNetCollateral.div(pos.price); + const liqPrice = diffDebt.div(amountCollateral); + return { + owner: account.id, + liqPrice: Number(liqPrice.toFixed(6)), + collateral: pos.token, + collateralAmount: pos.totalBal.times(10 ** pos.decimals).toFixed(0), + extra: { + url: EXPLORER_BASE_URL + account.id, + }, + } as Liq; + } else { + return { + owner: "", + liqPrice: 0, + collateral: "", + collateralAmount: "", + }; + } + }) + .filter((t) => !!t.owner); + + return liquidablePositions; + }); + + return positions; +}; + +module.exports = { + ethereum: { + liquidations: positions, + }, +}; diff --git a/liquidations/utils/binResults.ts b/liquidations/utils/binResults.ts index 167b8a6e096..40af7a79c5d 100644 --- a/liquidations/utils/binResults.ts +++ b/liquidations/utils/binResults.ts @@ -20,6 +20,10 @@ export async function binResults(liqs: Liq[]) { .coins as { [address: string]: { decimals: number; price: number; symbol: string; timestamp: number }; }; + // coins api doesn't support decimals for coingecko keys + if (prices["coingecko:tezos"]) { + prices["coingecko:tezos"].decimals = 6; + } console.log(prices); const bins = Object.values(prices).reduce( (all, token) => ({ From 3b553252533c04a260176907d1d2e6c2a3680841 Mon Sep 17 00:00:00 2001 From: power-f-god Date: Thu, 3 Aug 2023 11:46:28 +0100 Subject: [PATCH 0645/1974] chore: Sync `utils`. --- utils/contracts/TestUniQuery.sol | 31 +++ utils/contracts/UniV2TVL.sol | 100 +++++++++ utils/formatAbis.js | 110 ++++++++++ utils/package-lock.json | 262 ++++++++++++++++++++++- utils/package.json | 4 + utils/scripts/changeCoreAssetsFormat.js | 44 ++++ utils/scripts/changeCoreAssetsFormat2.js | 71 ++++++ utils/scripts/coingeckoApi.js | 64 ++++++ utils/scripts/formatAllAbis.js | 76 +++++++ utils/scripts/testBatchCall.js | 24 +++ utils/scripts/testCompiler.js | 28 +++ utils/scripts/testTokenMapping.js | 29 +++ utils/scripts/tokenMapping.js | 132 ++++++++++++ utils/scripts/useTokenLabels.js | 69 ++++++ utils/testInteractive.js | 15 +- 15 files changed, 1047 insertions(+), 12 deletions(-) create mode 100644 utils/contracts/TestUniQuery.sol create mode 100644 utils/contracts/UniV2TVL.sol create mode 100644 utils/formatAbis.js create mode 100644 utils/scripts/changeCoreAssetsFormat.js create mode 100644 utils/scripts/changeCoreAssetsFormat2.js create mode 100644 utils/scripts/coingeckoApi.js create mode 100644 utils/scripts/formatAllAbis.js create mode 100644 utils/scripts/testBatchCall.js create mode 100644 utils/scripts/testCompiler.js create mode 100644 utils/scripts/testTokenMapping.js create mode 100644 utils/scripts/tokenMapping.js create mode 100644 utils/scripts/useTokenLabels.js diff --git a/utils/contracts/TestUniQuery.sol b/utils/contracts/TestUniQuery.sol new file mode 100644 index 00000000000..44587597d59 --- /dev/null +++ b/utils/contracts/TestUniQuery.sol @@ -0,0 +1,31 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +interface IUniswapV2Factory { + function allPairsLength() external view returns (uint); + + function allPairs(uint) external view returns (address); +} + +contract TestUniQuery { + constructor(address factory) { + IUniswapV2Factory uniswapFactory = IUniswapV2Factory(factory); + uint pairCount = uniswapFactory.allPairsLength(); + + // encode the return data + bytes memory _data = abi.encode(pairCount); + // force constructor to return data via assembly + assembly { + // abi.encode adds an additional offset (32 bytes) that we need to skip + let _dataStart := add(_data, 32) + // msize() gets the size of active memory in bytes. + // if we subtract msize() from _dataStart, the output will be + // the amount of bytes from _dataStart to the end of memory + // which due to how the data has been laid out in memory, will coincide with + // where our desired data ends. + let _dataEnd := sub(msize(), _dataStart) + // starting from _dataStart, get all the data in memory. + return(_dataStart, _dataEnd) + } + } +} diff --git a/utils/contracts/UniV2TVL.sol b/utils/contracts/UniV2TVL.sol new file mode 100644 index 00000000000..dc46c81a854 --- /dev/null +++ b/utils/contracts/UniV2TVL.sol @@ -0,0 +1,100 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +interface IUniswapV2Pair { + function token0() external view returns (address); + + function token1() external view returns (address); + + function getReserves() + external + view + returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast); +} + +interface IUniswapV2Factory { + function allPairsLength() external view returns (uint); + + function allPairs(uint) external view returns (address); +} + +contract UniV2TVL { + struct KeyValuePair { + address key; + uint value; + } + + mapping(address => uint) public tvlMap; + mapping(address => bool) public isBaseToken; + address[] public tokens; + + constructor( + address factory, + address[] memory baseTokens, + bool includeQuoteTokens, + uint startIndex, + uint endIndex + ) { + IUniswapV2Factory uniswapFactory = IUniswapV2Factory(factory); + uint pairCount = uniswapFactory.allPairsLength(); + if (endIndex == 0 || endIndex > pairCount) endIndex = pairCount; + + // Create a set of base tokens for efficient membership check + for (uint i = 0; i < baseTokens.length; i++) { + isBaseToken[baseTokens[i]] = true; + } + + for (uint i = startIndex; i < endIndex; i++) { + address pairAddress = uniswapFactory.allPairs(i); + IUniswapV2Pair pair = IUniswapV2Pair(pairAddress); + address token0 = pair.token0(); + address token1 = pair.token1(); + uint reserve0; + uint reserve1; + (reserve0, reserve1, ) = pair.getReserves(); + bool isToken0BaseToken = isBaseToken[token0]; + bool isToken1BaseToken = isBaseToken[token1]; + + if ( reserve0 == 0 || reserve1 == 0) continue; + + if (isToken0BaseToken && isToken1BaseToken) { + if (tvlMap[token0] == 0) tokens.push(token0); + if (tvlMap[token1] == 0) tokens.push(token1); + tvlMap[token0] += reserve0; + tvlMap[token1] += reserve1; + } else if (isToken0BaseToken) { + if (tvlMap[token0] == 0) tokens.push(token0); + tvlMap[token0] += reserve0 * 2; + } else if (isToken1BaseToken) { + if (tvlMap[token1] == 0) tokens.push(token1); + tvlMap[token1] += reserve1 * 2; + } else if (includeQuoteTokens) { + if (tvlMap[token0] == 0) tokens.push(token0); + if (tvlMap[token1] == 0) tokens.push(token1); + tvlMap[token0] += reserve0; + tvlMap[token1] += reserve1; + } + } + + KeyValuePair[] memory returnData = new KeyValuePair[](tokens.length); + for (uint i = 0; i < tokens.length; i++) { + returnData[i] = KeyValuePair(tokens[i], tvlMap[tokens[i]]); + } + + // encode the return data + bytes memory _data = abi.encode(returnData); + // force constructor to return data via assembly + assembly { + // abi.encode adds an additional offset (32 bytes) that we need to skip + let _dataStart := add(_data, 32) + // msize() gets the size of active memory in bytes. + // if we subtract msize() from _dataStart, the output will be + // the amount of bytes from _dataStart to the end of memory + // which due to how the data has been laid out in memory, will coincide with + // where our desired data ends. + let _dataEnd := sub(msize(), _dataStart) + // starting from _dataStart, get all the data in memory. + return(_dataStart, _dataEnd) + } + } +} diff --git a/utils/formatAbis.js b/utils/formatAbis.js new file mode 100644 index 00000000000..afc7e52fc42 --- /dev/null +++ b/utils/formatAbis.js @@ -0,0 +1,110 @@ +const ethers = require('ethers') +const glob = require('glob') +const jsonfile = require('jsonfile') +const fs = require('fs') + +let data = require('../projects/test/abi.json') +const rootFolder = '../projects' +const rootFolderTest = '../projects/yfii' + +// https://docs.soliditylang.org/en/latest/abi-spec.html +let knownTypes = [ + 'string', 'address', 'bool', + 'int', 'int8', 'int16', 'int32', 'int64', 'int128', 'int256', + 'uint', 'uint8', 'uint16', 'uint32', 'uint64', 'uint128', 'uint256', +]; + +([...knownTypes]).forEach(i => knownTypes.push(i + '[]')) // support array type for all known types +knownTypes = new Set(knownTypes) + +function run() { + glob(rootFolder + '/**/*.json', {}, async (e, files) => { + if (e) throw e + console.log('JSON file count', files.length) + const objs = files.map(file => ({ + file, + data: jsonfile.readFileSync(file) + })) + const isTransformables = objs.filter(i => isTransformable(i.data, i.file)) + const isNotTransformables = objs.filter(i => !isTransformable(i.data, i.file)).filter(i => Object.values(i.data).some(i => typeof i !== 'string')) + console.log(isNotTransformables.length) + const files2 = isNotTransformables.map(i => i.file) + console.log(JSON.stringify(files2, null, 2)) + // console.log(isTransformables.length) + const fileWriteOptions = { spaces: 2, finalEOL: false } + isTransformables.forEach(i => i.newData = transform(i.data, i.file)) + isTransformables.forEach(i => jsonfile.writeFile(i.file, i.newData, fileWriteOptions)) + }) +} + +const validStates = new Set(['view', 'pure', 'nonpayable']) +const isValidState = i => validStates.has(i.stateMutability) || i.constant === true + +function isTransformable(obj, file) { + if (typeof obj !== 'object' || Array.isArray(obj)) return false; + const values = Object.values(obj) + const isAbi0 = i => isValidState(i) + const isAbi = i => (i.stateMutability === 'view' || i.stateMutability === 'pure' || i.stateMutability === 'nonpayable') && i.type === 'function' + const i = values[0] + if (!isAbi0(i)) return false + const edgeCase = values.find(i => !isAbi(i)) + if (edgeCase) { + const first = Object.values(edgeCase).pop() + if (!Array.isArray(edgeCase) && !isAbi(first)) + console.log('edge case: ', file, edgeCase) + } + return !edgeCase +} + +function transform(obj, file) { + const res = {} + for (const [key, value] of Object.entries(obj)) { + if (['constructor', 'error'].includes(value.type)) { + console.log('skipping element of type: ', value.type) + continue; + } + if (!value.inputs) console.log('inputs missing', file) + const iLen = value.inputs.length === 0 + const oLen = value.outputs?.length === 1 + const oType = oLen && value.outputs[0].type + if (iLen && oLen && knownTypes.has(oType)) { + res[key] = `${oType}:${value.name}` + } else { + const iface = new ethers.utils.Interface([value]) + res[key] = iface.format(ethers.utils.FormatTypes.full)[0] + } + } + + return res +} + +function print() { + let res = data + if (data.name) data = [data] + if (Array.isArray(data)) { + res = {} + data + .filter(i => i.type === 'function' || i.type === 'event') + // .filter(i => isTransformable({ test: i})) + // .filter(i => i.stateMutability === 'view' || i.stateMutability === 'pure') + .forEach(i => res[i.name ?? 'ignore'] = i) + } + console.log(res) + res = transform(res) + fs.writeFileSync(__dirname+'/../projects/test/abi.json', JSON.stringify(res, null, 2)) + // console.log(res) + console.log(JSON.stringify(res, null, 2)) +} + + + + +print() + +async function printRes(abi, target, api) { + const res = {} + await Promise.all(Object.entries(abi).map(async ([name, abi]) => { + res[name] = await api.call({ abi, target}) + })) + console.log(res) +} \ No newline at end of file diff --git a/utils/package-lock.json b/utils/package-lock.json index 0baa56138e3..6c664695861 100644 --- a/utils/package-lock.json +++ b/utils/package-lock.json @@ -8,6 +8,10 @@ "name": "run-interactive", "version": "0.0.1", "license": "ISC", + "dependencies": { + "glob": "^8.0.3", + "solc": "^0.8.20" + }, "devDependencies": { "inquirer": "^8.2.4", "inquirer-fuzzy-path": "^2.3.0" @@ -52,6 +56,11 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" + }, "node_modules/base64-js": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", @@ -83,6 +92,14 @@ "readable-stream": "^3.4.0" } }, + "node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, "node_modules/buffer": { "version": "5.7.1", "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", @@ -189,6 +206,19 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, + "node_modules/command-exists": { + "version": "1.2.9", + "resolved": "https://registry.npmjs.org/command-exists/-/command-exists-1.2.9.tgz", + "integrity": "sha512-LTQ/SGc+s0Xc0Fu5WaKnR0YiygZkm9eKFvyS+fRsU7/ZWFF8ykFM6Pc9aCVf1+xasOOZpO3BAVgVrKvsqKHV7w==" + }, + "node_modules/commander": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-8.3.0.tgz", + "integrity": "sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==", + "engines": { + "node": ">= 12" + } + }, "node_modules/defaults": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.3.tgz", @@ -242,6 +272,30 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/follow-redirects": { + "version": "1.15.2", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", + "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" + }, "node_modules/fuzzy": { "version": "0.1.3", "resolved": "https://registry.npmjs.org/fuzzy/-/fuzzy-0.1.3.tgz", @@ -251,6 +305,24 @@ "node": ">= 0.6.0" } }, + "node_modules/glob": { + "version": "8.0.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-8.0.3.tgz", + "integrity": "sha512-ull455NHSHI/Y1FqGaaYFaLGkNMMJbavMrEGFXG/PGrg6y7sutWHUHrz6gy6WEBH6akM1M414dWKCNs+IhKdiQ==", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^5.0.1", + "once": "^1.3.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -292,11 +364,19 @@ } ] }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, "node_modules/inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" }, "node_modules/inquirer": { "version": "8.2.4", @@ -654,6 +734,11 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/js-sha3": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz", + "integrity": "sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q==" + }, "node_modules/lodash": { "version": "4.17.21", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", @@ -676,6 +761,14 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/memorystream": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/memorystream/-/memorystream-0.3.1.tgz", + "integrity": "sha512-S3UwM3yj5mtUSEfP41UZmt/0SCoVYUcU1rkXv+BQ5Ig8ndL4sPoJNBUJERafdPb5jjHJGuMgytgKvKIf58XNBw==", + "engines": { + "node": ">= 0.10.0" + } + }, "node_modules/mimic-fn": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", @@ -685,12 +778,31 @@ "node": ">=6" } }, + "node_modules/minimatch": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.2.tgz", + "integrity": "sha512-bNH9mmM9qsJ2X4r2Nat1B//1dJVcn3+iBLa3IgqJ7EbGaDNepL9QSHOxN4ng33s52VMMhhIfgCYDk3C4ZmlDAg==", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/mute-stream": { "version": "0.0.8", "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==", "dev": true }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dependencies": { + "wrappy": "1" + } + }, "node_modules/onetime": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", @@ -733,7 +845,6 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", - "dev": true, "engines": { "node": ">=0.10.0" } @@ -809,12 +920,40 @@ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", "dev": true }, + "node_modules/semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "bin": { + "semver": "bin/semver" + } + }, "node_modules/signal-exit": { "version": "3.0.7", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", "dev": true }, + "node_modules/solc": { + "version": "0.8.20", + "resolved": "https://registry.npmjs.org/solc/-/solc-0.8.20.tgz", + "integrity": "sha512-fPRnGspIEqmhu63RFO3pc79sLA7ZmzO0Uy0L5l6hEt2wAsq0o7UV6pXkAp3Mfv9IBhg7Px/oTu3a+y4gs3BWrQ==", + "dependencies": { + "command-exists": "^1.2.8", + "commander": "^8.1.0", + "follow-redirects": "^1.12.1", + "js-sha3": "0.8.0", + "memorystream": "^0.3.1", + "semver": "^5.5.0", + "tmp": "0.0.33" + }, + "bin": { + "solcjs": "solc.js" + }, + "engines": { + "node": ">=10.0.0" + } + }, "node_modules/string_decoder": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", @@ -872,7 +1011,6 @@ "version": "0.0.33", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", - "dev": true, "dependencies": { "os-tmpdir": "~1.0.2" }, @@ -929,6 +1067,11 @@ "funding": { "url": "https://github.com/chalk/wrap-ansi?sponsor=1" } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" } }, "dependencies": { @@ -956,6 +1099,11 @@ "color-convert": "^2.0.1" } }, + "balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" + }, "base64-js": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", @@ -973,6 +1121,14 @@ "readable-stream": "^3.4.0" } }, + "brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "requires": { + "balanced-match": "^1.0.0" + } + }, "buffer": { "version": "5.7.1", "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", @@ -1041,6 +1197,16 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, + "command-exists": { + "version": "1.2.9", + "resolved": "https://registry.npmjs.org/command-exists/-/command-exists-1.2.9.tgz", + "integrity": "sha512-LTQ/SGc+s0Xc0Fu5WaKnR0YiygZkm9eKFvyS+fRsU7/ZWFF8ykFM6Pc9aCVf1+xasOOZpO3BAVgVrKvsqKHV7w==" + }, + "commander": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-8.3.0.tgz", + "integrity": "sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==" + }, "defaults": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.3.tgz", @@ -1082,12 +1248,34 @@ "escape-string-regexp": "^1.0.5" } }, + "follow-redirects": { + "version": "1.15.2", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", + "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==" + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" + }, "fuzzy": { "version": "0.1.3", "resolved": "https://registry.npmjs.org/fuzzy/-/fuzzy-0.1.3.tgz", "integrity": "sha1-THbsL/CsGjap3M+aAN+GIweNTtg=", "dev": true }, + "glob": { + "version": "8.0.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-8.0.3.tgz", + "integrity": "sha512-ull455NHSHI/Y1FqGaaYFaLGkNMMJbavMrEGFXG/PGrg6y7sutWHUHrz6gy6WEBH6akM1M414dWKCNs+IhKdiQ==", + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^5.0.1", + "once": "^1.3.0" + } + }, "has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -1109,11 +1297,19 @@ "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", "dev": true }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, "inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" }, "inquirer": { "version": "8.2.4", @@ -1396,6 +1592,11 @@ "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", "dev": true }, + "js-sha3": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz", + "integrity": "sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q==" + }, "lodash": { "version": "4.17.21", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", @@ -1412,18 +1613,39 @@ "is-unicode-supported": "^0.1.0" } }, + "memorystream": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/memorystream/-/memorystream-0.3.1.tgz", + "integrity": "sha512-S3UwM3yj5mtUSEfP41UZmt/0SCoVYUcU1rkXv+BQ5Ig8ndL4sPoJNBUJERafdPb5jjHJGuMgytgKvKIf58XNBw==" + }, "mimic-fn": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", "dev": true }, + "minimatch": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.2.tgz", + "integrity": "sha512-bNH9mmM9qsJ2X4r2Nat1B//1dJVcn3+iBLa3IgqJ7EbGaDNepL9QSHOxN4ng33s52VMMhhIfgCYDk3C4ZmlDAg==", + "requires": { + "brace-expansion": "^2.0.1" + } + }, "mute-stream": { "version": "0.0.8", "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==", "dev": true }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "requires": { + "wrappy": "1" + } + }, "onetime": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", @@ -1453,8 +1675,7 @@ "os-tmpdir": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", - "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", - "dev": true + "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=" }, "readable-stream": { "version": "3.6.0", @@ -1504,12 +1725,31 @@ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", "dev": true }, + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==" + }, "signal-exit": { "version": "3.0.7", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", "dev": true }, + "solc": { + "version": "0.8.20", + "resolved": "https://registry.npmjs.org/solc/-/solc-0.8.20.tgz", + "integrity": "sha512-fPRnGspIEqmhu63RFO3pc79sLA7ZmzO0Uy0L5l6hEt2wAsq0o7UV6pXkAp3Mfv9IBhg7Px/oTu3a+y4gs3BWrQ==", + "requires": { + "command-exists": "^1.2.8", + "commander": "^8.1.0", + "follow-redirects": "^1.12.1", + "js-sha3": "0.8.0", + "memorystream": "^0.3.1", + "semver": "^5.5.0", + "tmp": "0.0.33" + } + }, "string_decoder": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", @@ -1558,7 +1798,6 @@ "version": "0.0.33", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", - "dev": true, "requires": { "os-tmpdir": "~1.0.2" } @@ -1600,6 +1839,11 @@ "string-width": "^4.1.0", "strip-ansi": "^6.0.0" } + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" } } } diff --git a/utils/package.json b/utils/package.json index fdf01f63334..49d6ccc564f 100644 --- a/utils/package.json +++ b/utils/package.json @@ -11,5 +11,9 @@ "devDependencies": { "inquirer": "^8.2.4", "inquirer-fuzzy-path": "^2.3.0" + }, + "dependencies": { + "glob": "^8.0.3", + "solc": "^0.8.20" } } diff --git a/utils/scripts/changeCoreAssetsFormat.js b/utils/scripts/changeCoreAssetsFormat.js new file mode 100644 index 00000000000..0ce14836330 --- /dev/null +++ b/utils/scripts/changeCoreAssetsFormat.js @@ -0,0 +1,44 @@ +const assets = require("../../projects/helper/coreAssets.json"); +const fs = require('fs') + +const sdk = require('@defillama/sdk') +const newJson = {} + +async function run() { + const entries = Object.entries(assets) + for (const entry of entries) { + console.log('for ', entry[0]) + await updateNames(entry) + fs.writeFileSync('./coreAssets.json', JSON.stringify(newJson, null, 2)) + } +} + +async function updateNames([chain, addresses]) { + const api = new sdk.ChainApi({ chain }) + if (!addresses.length) return; + const chainObj = {} + newJson[chain] = chainObj + if (!addresses[addresses.length -1].startsWith('0x') || ['starknet', 'aptos'].includes(chain)) { + addresses.forEach((v, i) => { + const key = 'temp_' + i + chainObj[key] = v + }) + console.log('------- non-evm chain: ', chain) + return; + } + const symbols = await api.multiCall({ abi: 'string:symbol', calls: addresses, permitFailure: true}) + addresses.forEach((v, i) => { + let key = symbols[i] + if (!key) { + key = v === '0x0000000000000000000000000000000000000000' ? 'null' : 'temp_' + i + } + key = key.replace(/\W+/g, '_') + chainObj[key] = v + }) +} + + +run().then(() => { + console.log('done') + process.exit(0) +}) \ No newline at end of file diff --git a/utils/scripts/changeCoreAssetsFormat2.js b/utils/scripts/changeCoreAssetsFormat2.js new file mode 100644 index 00000000000..a9d5c7dbe4c --- /dev/null +++ b/utils/scripts/changeCoreAssetsFormat2.js @@ -0,0 +1,71 @@ +const assets = require("../../projects/helper/coreAssets.json"); +const fs = require('fs') +const axios = require('axios') + +const newJson = {} + +async function run() { + const entries = Object.entries(assets) + await Promise.all(entries.map(checkSymbols)) + // for (const entry of entries) { + // await getSymbols(entry) + // fs.writeFileSync('./projects/helper/coreAssets.json', JSON.stringify(newJson, null, 2)) + // } + // for (const entry of entries) { + // await checkSymbols(entry) + // } +} + +async function getSymbols([chain, mapping]) { + newJson[chain] = mapping + let reverseMapping = {} + const tokens = Object.entries(mapping).map(([key, value]) => { + if (!key.startsWith('temp_')) return; + const key2 = chain + ':' + value + reverseMapping[key2] = key + return key2 + }).filter(i => i) + if (!tokens.length) return; + const { data: { coins } } = await axios.get('https://coins.llama.fi/prices/current/' + tokens.join(',')) + const symbolSet = new Set() + Object.entries(coins).forEach(([key, { symbol }]) => { + const key2 = reverseMapping[key] + if (!key2) { + console.log('Bug: ', key, chain) + throw new Error('Fix this') + } + const value = mapping[key2] + delete mapping[key2] + let iterator = 0 + let label = symbol + while (symbolSet.has(label)) { + label = symbol + '_' + ++iterator + } + symbolSet.add(label) + mapping[label] = value + }) + +} + +async function checkSymbols([chain, mapping]) { + try { + if (chain === 'null') return; + newJson[chain] = mapping + let tokens = Object.entries(mapping).map(([key, value]) => { + return chain + ':' + value + }) + if (!tokens.length) return; + const { data: { coins } } = await axios.get('https://coins.llama.fi/prices/current/' + tokens.join(',')) + Object.entries(coins).forEach(([key, { symbol }]) => { + tokens = tokens.filter(i => i !== key) + }) + if (tokens.length) console.log('failed to find price:', chain, tokens) + } catch (e) { + console.log('error in ', chain) + } +} + +run().then(() => { + console.log('done') + process.exit(0) +}) \ No newline at end of file diff --git a/utils/scripts/coingeckoApi.js b/utils/scripts/coingeckoApi.js new file mode 100644 index 00000000000..c91a9360bb0 --- /dev/null +++ b/utils/scripts/coingeckoApi.js @@ -0,0 +1,64 @@ +const axios = require('axios') +const fs = require('fs') +const { sliceIntoChunks, sleep } = require('../../projects/helper/utils') +const cacheFile = '../../../coingeckoCache.json' +const geckoCache = require(cacheFile) + +const api = { + tokens: "https://api.coingecko.com/api/v3/coins/list", + prices: ids => `https://api.coingecko.com/api/v3/simple/price?ids=${ids}&vs_currencies=usd&include_market_cap=true&include_24hr_vol=true&include_last_updated_at=true` +} +const timeNow = Date.now() / 1e3 +const ONE_DAY = 24 * 3600 +const ONE_WEEK = 7 * ONE_DAY + +run() + + +function writeToCache() { + fs.writeFileSync(cacheFile, JSON.stringify(geckoCache)) +} + +async function updatePriceData() { + let allData = sliceIntoChunks(geckoCache.tokens.map(i => i.id), 50) + let index = 0 + for (const idSet of allData) { + try { + + ++index + const ids = idSet + .filter(i => !geckoCache.prices[i]) + if (!ids.length) continue; + const url = api.prices(ids.join(',')) + const res = (await axios.get(url)).data + Object.entries(res).forEach(([key, value]) => geckoCache.prices[key] = value) + writeToCache() + console.log('fetched ', index, 'out of', allData.length) + await sleep(10000) + } catch (e) { + console.log('failed ', index, 'out of', allData.length) + await sleep(10000) + } + } +} + +async function run() { + if (!geckoCache.tokens) geckoCache.tokens = (await axios.get(api.tokens)).data + if (!geckoCache.prices) geckoCache.prices = {} + // await updatePriceData() + + const prices = Object.values(geckoCache.prices) + console.log('Coins (Total)', prices.length) + console.log('Coins (mcap > 1M)', prices.filter(i => i.usd_market_cap > 1e6).length) + console.log('Coins (mcap > 10M)', prices.filter(i => i.usd_market_cap > 1e7).length) + console.log('Coins (24h vol > 1M)', prices.filter(i => i.usd_24h_vol > 1e6).length) + console.log('Coins (24h vol > 10M)', prices.filter(i => i.usd_24h_vol > 1e7).length) + console.log('Coins (update < 1 day)', prices.filter(i => (timeNow - i.last_updated_at) < ONE_WEEK).length) + console.log('Coins (update < 1 week)', prices.filter(i => (timeNow - i.last_updated_at) < ONE_DAY).length) + + + console.log('Coins (mcap > 1M | 24h vol > 1M | update < 1 week ) ', prices.filter(i => i.usd_market_cap > 1e6).filter(i => i.usd_24h_vol > 1e6).filter(i => (timeNow - i.last_updated_at) < ONE_WEEK).length) + console.log('Coins (mcap > 10M | 24h vol > 10M | update < 1 day ) ', prices.filter(i => i.usd_market_cap > 1e7).filter(i => i.usd_24h_vol > 1e7).filter(i => (timeNow - i.last_updated_at) < ONE_DAY).length) + + writeToCache() +} diff --git a/utils/scripts/formatAllAbis.js b/utils/scripts/formatAllAbis.js new file mode 100644 index 00000000000..de1b736f85a --- /dev/null +++ b/utils/scripts/formatAllAbis.js @@ -0,0 +1,76 @@ +const ethers = require('ethers') +const glob = require('glob') +const jsonfile = require('jsonfile') +const fs = require('fs') + +const rootFolder = '../../projects' + +// https://docs.soliditylang.org/en/latest/abi-spec.html +let knownTypes = [ + 'string', 'address', 'bool', + 'int', 'int8', 'int16', 'int32', 'int64', 'int128', 'int256', + 'uint', 'uint8', 'uint16', 'uint32', 'uint64', 'uint128', 'uint256', +]; + +([...knownTypes]).forEach(i => knownTypes.push(i + '[]')) // support array type for all known types +knownTypes = new Set(knownTypes) + +function run() { + glob(rootFolder + '/**/*.json', {}, async (e, files) => { + if (e) throw e + console.log('JSON file count', files.length) + const objs = files.map(file => ({ + file, + data: jsonfile.readFileSync(file) + })) + const isTransformables = objs.filter(i => isTransformable(i.data, i.file)) + const isNotTransformables = objs.filter(i => !isTransformable(i.data, i.file)).filter(i => Object.values(i.data).some(i => typeof i !== 'string')) + console.log(isNotTransformables.length) + const files2 = isNotTransformables.map(i => i.file) + console.log(JSON.stringify(files2, null, 2)) + // console.log(isTransformables.length) + const fileWriteOptions = { spaces: 2, finalEOL: false } + isTransformables.forEach(i => i.newData = transform(i.data, i.file)) + isTransformables.forEach(i => jsonfile.writeFile(i.file, i.newData, fileWriteOptions)) + }) +} + +const validStates = new Set(['view', 'pure', 'nonpayable']) +const isValidState = i => validStates.has(i.stateMutability) || i.constant === true + +function isTransformable(obj, file) { + if (typeof obj !== 'object' || Array.isArray(obj)) return false; + const values = Object.values(obj) + const isAbi0 = i => isValidState(i) + const isAbi = i => (i.stateMutability === 'view' || i.stateMutability === 'pure' || i.stateMutability === 'nonpayable') && i.type === 'function' + const i = values[0] + if (!isAbi0(i)) return false + const edgeCase = values.find(i => !isAbi(i)) + if (edgeCase) { + const first = Object.values(edgeCase).pop() + if (!Array.isArray(edgeCase) && !isAbi(first)) + console.log('edge case: ', file, edgeCase) + } + return !edgeCase +} + +function transform(obj, file) { + const res = {} + for (const [key, value] of Object.entries(obj)) { + if (!value.inputs) console.log('inputs missing', file) + const iLen = value.inputs.length === 0 + const oLen = value.outputs?.length === 1 + const oType = oLen && value.outputs[0].type + if (iLen && oLen && knownTypes.has(oType)) { + res[key] = `${oType}:${value.name}` + } else { + const iface = new ethers.utils.Interface([value]) + res[key] = iface.format(ethers.utils.FormatTypes.full)[0] + } + } + + return res +} + +run() + diff --git a/utils/scripts/testBatchCall.js b/utils/scripts/testBatchCall.js new file mode 100644 index 00000000000..b84f0713197 --- /dev/null +++ b/utils/scripts/testBatchCall.js @@ -0,0 +1,24 @@ +const fs = require('fs') +const coreAssets = require('../../projects/helper/coreAssets.json') +const sdk = require('@defillama/sdk') + +const bytecode = fs.readFileSync(__dirname + `/../artifacts/UniV2TVL.bytecode`, 'utf8') + +async function main() { + await getUniTvl('0x460b2005b3318982feADA99f7ebF13e1D6f6eFfE', 'ethereum') + await getUniTvl('0x21cadeb92c8bbfbef98c3098846f0999209c3a97', 'avax') + await getUniTvl('0xAaA04462e35f3e40D798331657cA015169e005d7', 'dogechain') +} + +async function getUniTvl(factory, chain = 'ethereum') { + const api = new sdk.ChainApi({ chain}) + const res = await api.bytecodeCall({ + bytecode, + inputs: [factory, Object.values(coreAssets[chain]), false, 0, 50], + inputTypes: ['address', 'address[]', 'bool', 'uint256', 'uint256'], + outputTypes: ['tuple(address,uint256)[]'] + }) + console.log(chain, factory, res) +} + +main() \ No newline at end of file diff --git a/utils/scripts/testCompiler.js b/utils/scripts/testCompiler.js new file mode 100644 index 00000000000..eb3dc8df0e3 --- /dev/null +++ b/utils/scripts/testCompiler.js @@ -0,0 +1,28 @@ +const solc = require('solc'); +const fs = require('fs'); + +const contractName = 'UniV2TVL'; +const contractFile = `${contractName}.sol`; +// Solidity contract code +const solidityCode = fs.readFileSync(__dirname+`/../contracts/${contractFile}`, 'utf8'); + +function compileContract(contractCode) { + const input = { + language: 'Solidity', + sources: { + [contractFile]: { + content: contractCode, + }, + }, + settings: { + outputSelection: { '*': { '*': ['*'], }, }, + }, + }; + + const output = JSON.parse(solc.compile(JSON.stringify(input))); + const bytecode = output.contracts[contractFile][contractName].evm.bytecode.object; + fs.writeFileSync(__dirname+`/../artifacts/${contractName}.bytecode`, bytecode) +} + +// Compile the contract and get the bytecode +compileContract(solidityCode) \ No newline at end of file diff --git a/utils/scripts/testTokenMapping.js b/utils/scripts/testTokenMapping.js new file mode 100644 index 00000000000..ceaf04b3c8d --- /dev/null +++ b/utils/scripts/testTokenMapping.js @@ -0,0 +1,29 @@ +const { sliceIntoChunks } = require('@defillama/sdk/build/util') +const { default: PromisePool } = require('@supercharge/promise-pool/dist') +const { default: axios } = require('axios') +const mapping = require('../../../server/coins/src/adapters/tokenMapping.json') + +const tokens = Object.entries(mapping).map(i => { + const [chain, obj] = i + return Object.keys(obj).map(j => chain+':'+j) +}).flat() + +async function main() { + console.log('token count:', tokens.length) + const missing = [] + const chunks = sliceIntoChunks(tokens, 50) + + await PromisePool + .withConcurrency(5) + .for(chunks) + .process(async chunk => { + const str = chunk.join(',') + const { data } = await axios.get('https://coins.llama.fi/prices/current/'+str) + missing.push(...chunk.filter(i => !data.coins[i])) + }) + + console.log(missing, missing.length) + +} + +main() \ No newline at end of file diff --git a/utils/scripts/tokenMapping.js b/utils/scripts/tokenMapping.js new file mode 100644 index 00000000000..0469ddd44cd --- /dev/null +++ b/utils/scripts/tokenMapping.js @@ -0,0 +1,132 @@ +const fs = require('fs') +const { getUniqueAddresses, } = require('../../projects/helper/utils') +const cacheFile = '../../../server/coins/src/adapters/tokenMapping.json' +const coreAssetsFile = '../../projects/helper/coreAssets.json' +const sdk = require('@defillama/sdk') + + +const cache = require(cacheFile) +const coreAssets = require(coreAssetsFile) + +const nullAddress = '0x0000000000000000000000000000000000000000' +const gasTokens = [ + nullAddress, + "0xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", + "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", +] + +const transformTokens = { +} + +const ibcMappings = {} + +const fixBalancesTokens = {} + +// run() + +// function writeToCache() { +// fs.writeFileSync(cacheFile, JSON.stringify(cache, null, 2)) +// fs.writeFileSync(coreAssetsFile, JSON.stringify(coreAssets, null, 2)) +// } + +function transformTo(address) { + if (address.startsWith('0x')) return 'ethereum:' + address + if (address.includes('0x')) return address + return 'coingecko#' + address +} + +async function run() { + let promises = [] + Object.entries(transformTokens).forEach(([chain, obj]) => { + cache[chain] = cache[chain] ?? {} + if (!sdk.api.config.getProvider(chain)) { + console.log('skipping because it is not evm: ', chain) + const tokens = Object.keys(obj) + cache[chain] + tokens.forEach((token, i) => { + // token = token.toLowerCase() + cache[chain][token] = { name: "", decimals: "", symbol: "", to: transformTo(obj[token]) } + }) + + return; + } + gasTokens.forEach(token => { + if (obj[token]) { + console.log('skipping null token', token, chain) + cache[chain][token] = { name: "", decimals: "", symbol: "", to: transformTo(obj[token]) } + delete obj[token] + } + }) + + promises.push(addChain()) + async function addChain() { + + const tokens = Object.keys(obj) + const api = new sdk.ChainApi({ chain }) + const symbol = await api.multiCall({ abi: 'erc20:symbol', calls: tokens }) + const decimals = await api.multiCall({ abi: 'erc20:decimals', calls: tokens }) + const name = await api.multiCall({ abi: 'string:name', calls: tokens }) + cache[chain] = cache[chain] ?? {} + tokens.forEach((token, i) => { + token = token.toLowerCase() + cache[chain][token] = { name: name[i], decimals: decimals[i], symbol: symbol[i], to: transformTo(obj[tokens[i]]) } + }) + let coreTokens = coreAssets[chain] ?? [] + coreTokens.push(...tokens) + coreAssets[chain] = getUniqueAddresses(coreTokens) + } + }) + + + Object.entries(fixBalancesTokens).forEach(([chain, obj]) => { + cache[chain] = cache[chain] ?? {} + if (!sdk.api.config.getProvider(chain)) { + console.log('skipping because it is not evm: ', chain) + const tokens = Object.keys(obj) + tokens.forEach((token, i) => { + // token = token.toLowerCase() + cache[chain][token] = { name: obj[token].coingeckoId, decimals: obj[token].decimals + "", symbol: "", to: transformTo(obj[token].coingeckoId) } + }) + + return; + } + gasTokens.forEach(token => { + if (obj[token]) { + console.log('skipping null token', token, chain) + cache[chain][token] = { name: obj[token].coingeckoId, decimals: obj[token].decimals + "", symbol: "", to: transformTo(obj[token].coingeckoId) } + delete obj[token] + } + }) + + promises.push(addChain()) + + + async function addChain() { + + const tokens = Object.keys(obj) + const api = new sdk.ChainApi({ chain }) + const symbol = await api.multiCall({ abi: 'erc20:symbol', calls: tokens }) + const decimals = await api.multiCall({ abi: 'erc20:decimals', calls: tokens }) + const name = await api.multiCall({ abi: 'string:name', calls: tokens }) + + tokens.forEach((token, i) => { + token = token.toLowerCase() + cache[chain][token] = { name: name[i], decimals: decimals[i], symbol: symbol[i], to: transformTo(obj[tokens[i]].coingeckoId) } + }) + let coreTokens = coreAssets[chain] ?? [] + coreTokens.push(...tokens) + coreAssets[chain] = getUniqueAddresses(coreTokens) + } + }) + + + + Object.entries(ibcMappings).forEach(([token, { decimals, coingeckoId}]) => { + const chain = 'ibc' + cache[chain] = cache[chain] ?? {} + cache[chain][token.replace('ibc/', '')] = { name: coingeckoId, decimals: decimals + "", symbol: "", to: transformTo(coingeckoId) } + }) + + await Promise.all(promises) + // writeToCache() +} diff --git a/utils/scripts/useTokenLabels.js b/utils/scripts/useTokenLabels.js new file mode 100644 index 00000000000..e065d2b3f1e --- /dev/null +++ b/utils/scripts/useTokenLabels.js @@ -0,0 +1,69 @@ +const glob = require('glob') +const projectsDir = __dirname + '/../../projects' +const allLabelsFile = projectsDir + '/helper/coreAssets.json' +const allLabels = require(allLabelsFile) +const fs = require('fs') +const path = require('path') +const { ibcChains } = require('../../projects/helper/tokenMapping') + +// const rootFolder = '../../projects' +// const projectsDir = '../../projects/zharta' +// const rootFolder = projectsDir + '/zharta' +const rootFolder = projectsDir + +const ignoredChains = ['tezos', 'waves', 'algorand', 'klaytn', 'astar', 'iotex', 'elrond', 'defichain', 'cardano', ...ibcChains] + +function run() { + ignoredChains.forEach(i => delete allLabels[i]) + // console.table(Object.entries(allLabels).map(([c, mapping]) => { return [c, Object.values(mapping).length] }).sort((a, b) => b[1] - a[1])) + + // return; + + glob(rootFolder + '/**/*.js', {}, async (e, files) => { + console.log('JSON file count', files.length) + // console.log(files) + files.forEach(updateFile) + }) +} + +run() + +function updateFile(file) { + let relativePath = path.relative(file + '/..', allLabelsFile) + if (relativePath.startsWith('coreAssets')) relativePath = './' + relativePath + const requireStr = `const ADDRESSES = require('${relativePath}')\n` + let fileStr = fs.readFileSync(file, 'utf-8') + const importedAddresses = fileStr.includes('coreAssets.json') + let updateFile = false + + Object.entries(allLabels).forEach(([chain, mapping]) => { + const label = ['ADDRESSES', chain] + if (chain === 'null') { + updateFileStr([...label].join('.'), mapping, file) + } else { + Object.entries(mapping).forEach(([symbol, addr]) => { + updateFileStr([...label, symbol].join('.'), addr, file) + }) + } + }) + if (!importedAddresses && updateFile) + fileStr = requireStr + fileStr + fs.writeFileSync(file, fileStr, { encoding: 'utf-8' }) + + function updateFileStr(label, address, file) { + if (!updateFile) { + updateFile = (new RegExp(address, 'i')).test(fileStr) + // if (updateFile) + // console.log(updateFile, address, new RegExp(address, 'i'), file) + } + if (!updateFile) return; + const tokensBareRegex = new RegExp('["\']' + address + '["\']\\s*:', 'gi') + const tokensBareRegex2 = new RegExp('["\']' + address + '["\']', 'gi') + const tokensRegex = new RegExp('(["\'])(\\w+:)' + address + '["\']\\s*:', 'gi') + const tokensRegex2 = new RegExp('(["\'])(\\w+:)' + address + '["\']', 'gi') + fileStr = fileStr.replace(tokensBareRegex, `[${label}]:`) + fileStr = fileStr.replace(tokensBareRegex2, label) + fileStr = fileStr.replace(tokensRegex, `[$1$2$1 + ${label}]:`) + fileStr = fileStr.replace(tokensRegex2, `$1$2$1 + ${label}`) + } +} diff --git a/utils/testInteractive.js b/utils/testInteractive.js index fa55ac417d7..ba20144d5ce 100644 --- a/utils/testInteractive.js +++ b/utils/testInteractive.js @@ -1,6 +1,15 @@ const inquirer = require('inquirer') const childProcess = require('child_process') inquirer.registerPrompt('fuzzypath', require('inquirer-fuzzy-path')) +console.log('Starting directory: ' + process.cwd()); +try { + process.chdir('./projects/'); + console.log('New directory: ' + process.cwd()); +} +catch (err) { + console.log('chdir: ' + err); +} + const adapterPrompt = { type: 'fuzzypath', @@ -8,7 +17,7 @@ const adapterPrompt = { excludePath: nodePath => nodePath.startsWith('helper'), excludeFilter: nodePath => nodePath == '.', itemType: 'any', - rootPath: 'projects', + rootPath: '.', message: 'Select an adapter to run:', suggestOnly: false, depthLimit: 0, @@ -29,7 +38,7 @@ async function run() { ]) adapterPath = response.adapterPath - while (true) { + while (true) { // eslint-disable-line adapterPrompt.default = adapterPath await runAdapter(adapterPath, true) const answer = await inquirer.prompt([adapterPrompt]) @@ -48,7 +57,7 @@ async function runAdapter(adapterPath, debugMode) { const startTime = Date.now() - const child = childProcess.fork('test.js', [adapterPath], { + const child = childProcess.fork(__dirname +'/../test.js', [adapterPath], { env, }) From c09d1715fae84bbe0c3a7e20ee5ebdb898ad10d6 Mon Sep 17 00:00:00 2001 From: power-f-god Date: Thu, 3 Aug 2023 11:47:23 +0100 Subject: [PATCH 0646/1974] chore: Sync root. --- README.md | 21 +- env.sample | 2 +- package-lock.json | 3457 ++++++++++++++++++++++++++++++++------ package.json | 8 +- pull_request_template.md | 27 +- test.js | 48 +- 6 files changed, 3056 insertions(+), 507 deletions(-) diff --git a/README.md b/README.md index c06f969731f..a4b9dc7340b 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,17 @@ Follow [this guide](https://docs.llama.fi/submit-a-project) to create an adapter and submit a PR with it. -Also, don't hesitate to send a message on [our discord](https://discord.gg/buPFYXzDDd) if we're late to merge your PR. +Also, don't hesitate to send a message on [our discord](https://discord.defillama.com/) if we're late to merge your PR. -> If you would like to add a `volume` adapter please submit the PR [here](https://github.com/DefiLlama/adapters). +> If you would like to add a `volume` adapter please submit the PR [here](https://github.com/DefiLlama/adapters) +> - If you would like to add a `liquidations` adapter, please refer to [this readme document](https://github.com/DefiLlama/DefiLlama-Adapters/tree/main/liquidations) for details. + +1. Once your adapter has been merged, it takes time to show on the UI. If more than 24 hours have passed, please let us know in Discord. +2. Please enable "Allow edits by maintainers" while putting up the PR. +3. Sorry, We no longer accept fetch adapter for new projects, we prefer the tvl to computed from blockchain data, if you have trouble with creating a the adapter, please hop onto our discord, we are happy to assist you. +4. **For updating listing info** It is a different repo, you can find your listing in this file: https://github.com/DefiLlama/defillama-server/blob/master/defi/src/protocols/data2.ts, you can edit it there and put up a PR +5. Do not edit/push `package-lock.json` file as part of your changes, we use lockfileVersion 2, and most use v1 and using that messes up our CI +6. No need to go to our discord and announce that you've created a PR, we monitor all PRs and will review it asap ## Getting listed @@ -14,7 +22,7 @@ Please send answers to questions there https://github.com/DefiLlama/DefiLlama-Ad This is a work in progress. The goal is to eventually handle historical data. DefiLlama aims to be transparent, accurate and open source. -If you have any suggestions, want to contribute or want to chat, please join [our discord](https://discord.gg/buPFYXzDDd) and drop a message. +If you have any suggestions, want to contribute or want to chat, please join [our discord](https://discord.defillama.com/) and drop a message. ## Testing adapters ``` @@ -27,11 +35,6 @@ If you want to change RPC providers because you need archive node access or beca ETHEREUM_RPC="..." BSC_RPC="..." POLYGON_RPC="..." -FANTOM_RPC="..." -ARBITRUM_RPC="..." -OPTIMISM_RPC="..." -XDAI_RPC="..." -HARMONY_RPC="..." ``` -The name of each rpc is `{CHAIN-NAME}_RPC`, and the name we use for each chain can be found [here](https://github.com/DefiLlama/defillama-sdk/blob/master/src/general.ts#L33) +The name of each rpc is `{CHAIN-NAME}_RPC`, and the name we use for each chain can be found [here](https://github.com/DefiLlama/defillama-sdk/blob/master/src/providers.json) diff --git a/env.sample b/env.sample index fe667ff0dfd..0770d98efb9 100644 --- a/env.sample +++ b/env.sample @@ -10,7 +10,7 @@ XDAI_RPC=https://xdai.poanetwork.dev AVAX_RPC=https://api.avax.network/ext/bc/C/rpc WAN_RPC=https://gwan-ssl.wandevs.org:56891 HARMONY_RPC=https://api.s0.t.hmny.io -THUNDERCORE_RPC=https://mainnet-rpc.thundercore.com +THUNDERCORE_RPC=https://mainnet-rpc.thundercore.com/archived/DEFILLAMAaakTsRI6LnA OKEXCHAIN_RPC=https://exchainrpc.okex.org OPTIMISM_RPC=https://mainnet.optimism.io/ ARBITRUM_RPC=https://arb1.arbitrum.io/rpc diff --git a/package-lock.json b/package-lock.json index f258529ed33..37383e00d9e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,32 +15,36 @@ "@solana/web3.js": "^1.36.0", "@solendprotocol/solend-sdk": "^0.6.2", "@supercharge/promise-pool": "^2.1.0", - "axios": "^0.27.0", + "aws-sdk": "^2.1268.0", + "axios": "^0.27.2", "bignumber.js": "^9.0.1", "blakejs": "^1.2.1", "bn.js": "^5.2.1", "borsh": "^0.7.0", "dotenv": "^8.6.0", "ethers": "^5.6.5", + "graphql": "^16.6.0", "graphql-request": "^4.0.0", "hi-base32": "^0.5.1", "js-sha512": "^0.8.0", "limiter": "2.1.0", + "starknet": "^4.17.1", "tron-format-address": "^0.1.8", "typescript": "^4.7.4" }, "devDependencies": { "@types/async-retry": "^1.4.5", "@types/bn.js": "^5.1.0", + "eslint": "^8.32.0", "ts-node": "^10.8.1" } }, "node_modules/@babel/runtime": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.19.0.tgz", - "integrity": "sha512-eR8Lo9hnDS7tqkO7NsV+mKvCmv5boaXFSZ70DnfhcgiEne8hv9oCEd36Klw74EtizEqLsy4YnW8UWwpBVolHZA==", + "version": "7.20.7", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.20.7.tgz", + "integrity": "sha512-UF0tvkUtxwAgZ5W/KrkHf0Rn0fdnLDU9ScxBrEVNUprE/MzirjK4MJUX1/BVDv00Sv8cljtukVK1aky++X1SjQ==", "dependencies": { - "regenerator-runtime": "^0.13.4" + "regenerator-runtime": "^0.13.11" }, "engines": { "node": ">=6.9.0" @@ -59,13 +63,37 @@ } }, "node_modules/@defillama/sdk": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-3.0.1.tgz", - "integrity": "sha512-kfsGrUvlcY76rMj0Nc9RtLGmVP0XYiS2/qILTlCa0DOBWMbsgfdQLvkf6sr0ww2G0If2VDwhTGsQEhiV7jDxcw==", + "version": "4.0.43", + "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.43.tgz", + "integrity": "sha512-SS311nPgkIOEbqWe3n2kT8n3UKyLQhQmJcEhlMhv6XnPhIBk4l7kLQXQmOYHpetAZmvUxOVnQwZbl75vh2EM5w==", "dependencies": { "@supercharge/promise-pool": "^2.1.0", "ethers": "^5.4.5", - "node-fetch": "^2.6.7" + "node-fetch": "^2.6.7", + "tron-format-address": "^0.1.11" + } + }, + "node_modules/@eslint/eslintrc": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.4.1.tgz", + "integrity": "sha512-XXrH9Uarn0stsyldqDYq8r++mROmWRI1xKMXa640Bb//SY1+ECYX6VzT6Lcx5frD0V30XieqJ0oX9I2Xj5aoMA==", + "dev": true, + "dependencies": { + "ajv": "^6.12.4", + "debug": "^4.3.2", + "espree": "^9.4.0", + "globals": "^13.19.0", + "ignore": "^5.2.0", + "import-fresh": "^3.2.1", + "js-yaml": "^4.1.0", + "minimatch": "^3.1.2", + "strip-json-comments": "^3.1.1" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" } }, "node_modules/@ethersproject/abi": { @@ -457,9 +485,9 @@ } }, "node_modules/@ethersproject/providers": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/@ethersproject/providers/-/providers-5.7.1.tgz", - "integrity": "sha512-vZveG/DLyo+wk4Ga1yx6jSEHrLPgmTt+dFv0dv8URpVCRf0jVhalps1jq/emN/oXnMRsC7cQgAF32DcXLL7BPQ==", + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/@ethersproject/providers/-/providers-5.7.2.tgz", + "integrity": "sha512-g34EWZ1WWAVgr4aptGlVBF8mhl3VWjv+8hoAnzStu8Ah22VHBsuGzP17eb6xDVRzw895G4W7vvx60lFFur/1Rg==", "funding": [ { "type": "individual", @@ -739,6 +767,39 @@ "@ethersproject/strings": "^5.7.0" } }, + "node_modules/@humanwhocodes/config-array": { + "version": "0.11.8", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.8.tgz", + "integrity": "sha512-UybHIJzJnR5Qc/MsD9Kr+RpO2h+/P1GhOwdiLPXK5TWk5sgTdu88bTD9UP+CKbPPh5Rni1u0GjAdYQLemG8g+g==", + "dev": true, + "dependencies": { + "@humanwhocodes/object-schema": "^1.2.1", + "debug": "^4.1.1", + "minimatch": "^3.0.5" + }, + "engines": { + "node": ">=10.10.0" + } + }, + "node_modules/@humanwhocodes/module-importer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", + "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", + "dev": true, + "engines": { + "node": ">=12.22" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@humanwhocodes/object-schema": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", + "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", + "dev": true + }, "node_modules/@jridgewell/resolve-uri": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz", @@ -808,22 +869,6 @@ "base-x": "^3.0.2" } }, - "node_modules/@marinade.finance/marinade-ts-sdk/node_modules/@solana/spl-token": { - "version": "0.1.8", - "resolved": "https://registry.npmjs.org/@solana/spl-token/-/spl-token-0.1.8.tgz", - "integrity": "sha512-LZmYCKcPQDtJgecvWOgT/cnoIQPWjdH+QVyzPcFvyDUiT0DiRjZaam4aqNUyvchLFhzgunv3d9xOoyE34ofdoQ==", - "dependencies": { - "@babel/runtime": "^7.10.5", - "@solana/web3.js": "^1.21.0", - "bn.js": "^5.1.0", - "buffer": "6.0.3", - "buffer-layout": "^1.2.0", - "dotenv": "10.0.0" - }, - "engines": { - "node": ">= 10" - } - }, "node_modules/@marinade.finance/marinade-ts-sdk/node_modules/borsh": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/borsh/-/borsh-0.6.0.tgz", @@ -855,18 +900,10 @@ "resolved": "https://registry.npmjs.org/base-x/-/base-x-4.0.0.tgz", "integrity": "sha512-FuwxlW4H5kh37X/oW59pwTzzTKRzfrrQwhmyspRM7swOEZcHtDZSCt45U6oKgtuFE+WYPblePMVIPR4RZrh/hw==" }, - "node_modules/@marinade.finance/marinade-ts-sdk/node_modules/dotenv": { - "version": "10.0.0", - "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-10.0.0.tgz", - "integrity": "sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q==", - "engines": { - "node": ">=10" - } - }, "node_modules/@mithraic-labs/psy-american": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/@mithraic-labs/psy-american/-/psy-american-0.2.2.tgz", - "integrity": "sha512-MmgLH3Mx4/TXXKLTWApRLchHaUteO31YC8jbtA6/GLqvSpIkLwfcmlzN7Ncca7UgWWCmDYgI3J15hRubqkTjmw==", + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/@mithraic-labs/psy-american/-/psy-american-0.2.3.tgz", + "integrity": "sha512-NsDfb9QNuLKNqRnq8rWAoD2Y3ouAEsAPFfwP28SmDVfkugvj03nvQtjotFLlH2TsE31YonG+gauhpeeGKZyyuw==", "dependencies": { "@project-serum/anchor": "^0.24.2", "@project-serum/serum": "^0.13.60", @@ -898,30 +935,6 @@ "node": ">=11" } }, - "node_modules/@mithraic-labs/psy-american/node_modules/@solana/spl-token": { - "version": "0.1.8", - "resolved": "https://registry.npmjs.org/@solana/spl-token/-/spl-token-0.1.8.tgz", - "integrity": "sha512-LZmYCKcPQDtJgecvWOgT/cnoIQPWjdH+QVyzPcFvyDUiT0DiRjZaam4aqNUyvchLFhzgunv3d9xOoyE34ofdoQ==", - "dependencies": { - "@babel/runtime": "^7.10.5", - "@solana/web3.js": "^1.21.0", - "bn.js": "^5.1.0", - "buffer": "6.0.3", - "buffer-layout": "^1.2.0", - "dotenv": "10.0.0" - }, - "engines": { - "node": ">= 10" - } - }, - "node_modules/@mithraic-labs/psy-american/node_modules/dotenv": { - "version": "10.0.0", - "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-10.0.0.tgz", - "integrity": "sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q==", - "engines": { - "node": ">=10" - } - }, "node_modules/@noble/ed25519": { "version": "1.7.1", "resolved": "https://registry.npmjs.org/@noble/ed25519/-/ed25519-1.7.1.tgz", @@ -934,9 +947,9 @@ ] }, "node_modules/@noble/hashes": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.1.3.tgz", - "integrity": "sha512-CE0FCR57H2acVI5UOzIGSSIYxZ6v/HOhDR0Ro9VLyhnzLwx0o8W1mmgaqlEUx4049qJDlIBRztv5k+MM8vbO3A==", + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.1.5.tgz", + "integrity": "sha512-LTMZiiLc+V4v1Yi16TD6aX2gmtKszNye0pQgbaLqkvhIqP7nVsSaJsWloGQjJfJ8offaoP5GtX3yY5swbcJxxQ==", "funding": [ { "type": "individual", @@ -955,6 +968,41 @@ } ] }, + "node_modules/@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, + "dependencies": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, + "dependencies": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + }, + "engines": { + "node": ">= 8" + } + }, "node_modules/@project-serum/anchor": { "version": "0.25.0", "resolved": "https://registry.npmjs.org/@project-serum/anchor/-/anchor-0.25.0.tgz", @@ -1034,30 +1082,6 @@ "node": ">=11" } }, - "node_modules/@project-serum/serum/node_modules/@solana/spl-token": { - "version": "0.1.8", - "resolved": "https://registry.npmjs.org/@solana/spl-token/-/spl-token-0.1.8.tgz", - "integrity": "sha512-LZmYCKcPQDtJgecvWOgT/cnoIQPWjdH+QVyzPcFvyDUiT0DiRjZaam4aqNUyvchLFhzgunv3d9xOoyE34ofdoQ==", - "dependencies": { - "@babel/runtime": "^7.10.5", - "@solana/web3.js": "^1.21.0", - "bn.js": "^5.1.0", - "buffer": "6.0.3", - "buffer-layout": "^1.2.0", - "dotenv": "10.0.0" - }, - "engines": { - "node": ">= 10" - } - }, - "node_modules/@project-serum/serum/node_modules/dotenv": { - "version": "10.0.0", - "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-10.0.0.tgz", - "integrity": "sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q==", - "engines": { - "node": ">=10" - } - }, "node_modules/@pythnetwork/client": { "version": "2.8.0", "resolved": "https://registry.npmjs.org/@pythnetwork/client/-/client-2.8.0.tgz", @@ -1069,46 +1093,74 @@ "@solana/web3.js": "^1.30.2" } }, - "node_modules/@solana/buffer-layout": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/@solana/buffer-layout/-/buffer-layout-4.0.0.tgz", - "integrity": "sha512-lR0EMP2HC3+Mxwd4YcnZb0smnaDw7Bl2IQWZiTevRH5ZZBZn6VRWn3/92E3qdU4SSImJkA6IDHawOHAnx/qUvQ==", + "node_modules/@scure/base": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.1.tgz", + "integrity": "sha512-ZxOhsSyxYwLJj3pLZCefNitxsj093tb2vq90mp2txoYeBqbcjDjqFhyM8eUjq/uFm6zJ+mUuqxlS2FkuSY1MTA==", + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ] + }, + "node_modules/@scure/bip32": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.1.0.tgz", + "integrity": "sha512-ftTW3kKX54YXLCxH6BB7oEEoJfoE2pIgw7MINKAs5PsS6nqKPuKk1haTF/EuHmYqG330t5GSrdmtRuHaY1a62Q==", + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ], "dependencies": { - "buffer": "~6.0.3" - }, - "engines": { - "node": ">=5.10" + "@noble/hashes": "~1.1.1", + "@noble/secp256k1": "~1.6.0", + "@scure/base": "~1.1.0" } }, - "node_modules/@solana/web3.js": { - "version": "1.63.1", - "resolved": "https://registry.npmjs.org/@solana/web3.js/-/web3.js-1.63.1.tgz", - "integrity": "sha512-wgEdGVK5FTS2zENxbcGSvKpGZ0jDS6BUdGu8Gn6ns0CzgJkK83u4ip3THSnBPEQ5i/jrqukg998BwV1H67+qiQ==", + "node_modules/@scure/bip32/node_modules/@noble/secp256k1": { + "version": "1.6.3", + "resolved": "https://registry.npmjs.org/@noble/secp256k1/-/secp256k1-1.6.3.tgz", + "integrity": "sha512-T04e4iTurVy7I8Sw4+c5OSN9/RkPlo1uKxAomtxQNLq8j1uPAqnsqG1bqvY3Jv7c13gyr6dui0zmh/I3+f/JaQ==", + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ] + }, + "node_modules/@scure/bip39": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.1.0.tgz", + "integrity": "sha512-pwrPOS16VeTKg98dYXQyIjJEcWfz7/1YJIwxUEPFfQPtc86Ym/1sVgQ2RLoD43AazMk2l/unK4ITySSpW2+82w==", + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ], "dependencies": { - "@babel/runtime": "^7.12.5", - "@noble/ed25519": "^1.7.0", - "@noble/hashes": "^1.1.2", - "@noble/secp256k1": "^1.6.3", - "@solana/buffer-layout": "^4.0.0", - "bigint-buffer": "^1.1.5", - "bn.js": "^5.0.0", - "borsh": "^0.7.0", - "bs58": "^4.0.1", - "buffer": "6.0.1", - "fast-stable-stringify": "^1.0.0", - "jayson": "^3.4.4", - "node-fetch": "2", - "rpc-websockets": "^7.5.0", - "superstruct": "^0.14.2" + "@noble/hashes": "~1.1.1", + "@scure/base": "~1.1.0" + } + }, + "node_modules/@solana/buffer-layout": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@solana/buffer-layout/-/buffer-layout-4.0.1.tgz", + "integrity": "sha512-E1ImOIAD1tBZFRdjeM4/pzTiTApC0AOBGwyAMS4fwIodCWArzJ3DWdoh8cKxeFM2fElkxBh2Aqts1BPC373rHA==", + "dependencies": { + "buffer": "~6.0.3" }, "engines": { - "node": ">=12.20.0" + "node": ">=5.10" } }, - "node_modules/@solana/web3.js/node_modules/buffer": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.1.tgz", - "integrity": "sha512-rVAXBwEcEoYtxnHSO5iWyhzV/O1WMtkUYWlfdLS7FjU4PnSJJHEfHXi/uHPI5EwltmOA794gN3bm3/pzuctWjQ==", + "node_modules/@solana/buffer-layout/node_modules/buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", "funding": [ { "type": "github", @@ -1128,58 +1180,26 @@ "ieee754": "^1.2.1" } }, - "node_modules/@solana/web3.js/node_modules/superstruct": { - "version": "0.14.2", - "resolved": "https://registry.npmjs.org/superstruct/-/superstruct-0.14.2.tgz", - "integrity": "sha512-nPewA6m9mR3d6k7WkZ8N8zpTWfenFH3q9pA2PkuiZxINr9DKB2+40wEQf0ixn8VaGuJ78AB6iWOtStI+/4FKZQ==" - }, - "node_modules/@solendprotocol/solend-sdk": { - "version": "0.6.5", - "resolved": "https://registry.npmjs.org/@solendprotocol/solend-sdk/-/solend-sdk-0.6.5.tgz", - "integrity": "sha512-d5CardFpcbWT4x8B5Whxe2zuGjnLe5D8ZJtz+op0Lah/oqcZXWMneW+iRdlgH+PKEchi2XcuuRZyfYuMKRA6Ow==", - "dependencies": { - "@marinade.finance/marinade-ts-sdk": "^3.1.1", - "@mithraic-labs/psy-american": "^0.2.1", - "@project-serum/anchor": "^0.24.2", - "@pythnetwork/client": "^2.5.1", - "@solana/buffer-layout": "^4.0.0", - "@solana/spl-token": "^0.1.8", - "@solana/web3.js": "^1.52.0", - "axios": "^0.24.0", - "bignumber.js": "^9.0.2", - "bn.js": "^5.2.0", - "buffer": "^6.0.3", - "buffer-layout": "^1.2.0", - "isomorphic-fetch": "^3.0.0", - "jsbi": "^4.3.0", - "typedoc-plugin-cname": "^1.0.1" - } - }, - "node_modules/@solendprotocol/solend-sdk/node_modules/@project-serum/anchor": { - "version": "0.24.2", - "resolved": "https://registry.npmjs.org/@project-serum/anchor/-/anchor-0.24.2.tgz", - "integrity": "sha512-0/718g8/DnEuwAidUwh5wLYphUYXhUbiClkuRNhvNoa+1Y8a4g2tJyxoae+emV+PG/Gikd/QUBNMkIcimiIRTA==", - "dependencies": { - "@project-serum/borsh": "^0.2.5", - "@solana/web3.js": "^1.36.0", - "base64-js": "^1.5.1", - "bn.js": "^5.1.2", - "bs58": "^4.0.1", - "buffer-layout": "^1.2.2", - "camelcase": "^5.3.1", - "cross-fetch": "^3.1.5", - "crypto-hash": "^1.3.0", - "eventemitter3": "^4.0.7", - "js-sha256": "^0.9.0", - "pako": "^2.0.3", - "snake-case": "^3.0.4", - "toml": "^3.0.0" - }, - "engines": { - "node": ">=11" - } + "node_modules/@solana/buffer-layout/node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] }, - "node_modules/@solendprotocol/solend-sdk/node_modules/@solana/spl-token": { + "node_modules/@solana/spl-token": { "version": "0.1.8", "resolved": "https://registry.npmjs.org/@solana/spl-token/-/spl-token-0.1.8.tgz", "integrity": "sha512-LZmYCKcPQDtJgecvWOgT/cnoIQPWjdH+QVyzPcFvyDUiT0DiRjZaam4aqNUyvchLFhzgunv3d9xOoyE34ofdoQ==", @@ -1195,22 +1215,184 @@ "node": ">= 10" } }, - "node_modules/@solendprotocol/solend-sdk/node_modules/axios": { - "version": "0.24.0", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.24.0.tgz", - "integrity": "sha512-Q6cWsys88HoPgAaFAVUb0WpPk0O8iTeisR9IMqy9G8AbO4NlpVknrnQS03zzF9PGAWgO3cgletO3VjV/P7VztA==", - "dependencies": { - "follow-redirects": "^1.14.4" - } - }, - "node_modules/@solendprotocol/solend-sdk/node_modules/dotenv": { - "version": "10.0.0", - "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-10.0.0.tgz", - "integrity": "sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q==", - "engines": { - "node": ">=10" - } - }, + "node_modules/@solana/spl-token/node_modules/buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" + } + }, + "node_modules/@solana/spl-token/node_modules/dotenv": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-10.0.0.tgz", + "integrity": "sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q==", + "engines": { + "node": ">=10" + } + }, + "node_modules/@solana/spl-token/node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/@solana/web3.js": { + "version": "1.72.0", + "resolved": "https://registry.npmjs.org/@solana/web3.js/-/web3.js-1.72.0.tgz", + "integrity": "sha512-xMoCk0y/GpiQhHbRjMcrd5NpmkwhAA0c01id7lrr6nhNdz6Uc/CywPdBeZw3Qz6BVZ/qlUoerpKPWeiXqMUjwA==", + "dependencies": { + "@babel/runtime": "^7.12.5", + "@noble/ed25519": "^1.7.0", + "@noble/hashes": "^1.1.2", + "@noble/secp256k1": "^1.6.3", + "@solana/buffer-layout": "^4.0.0", + "agentkeepalive": "^4.2.1", + "bigint-buffer": "^1.1.5", + "bn.js": "^5.0.0", + "borsh": "^0.7.0", + "bs58": "^4.0.1", + "buffer": "6.0.1", + "fast-stable-stringify": "^1.0.0", + "jayson": "^3.4.4", + "node-fetch": "2", + "rpc-websockets": "^7.5.0", + "superstruct": "^0.14.2" + }, + "engines": { + "node": ">=12.20.0" + } + }, + "node_modules/@solana/web3.js/node_modules/superstruct": { + "version": "0.14.2", + "resolved": "https://registry.npmjs.org/superstruct/-/superstruct-0.14.2.tgz", + "integrity": "sha512-nPewA6m9mR3d6k7WkZ8N8zpTWfenFH3q9pA2PkuiZxINr9DKB2+40wEQf0ixn8VaGuJ78AB6iWOtStI+/4FKZQ==" + }, + "node_modules/@solendprotocol/solend-sdk": { + "version": "0.6.9", + "resolved": "https://registry.npmjs.org/@solendprotocol/solend-sdk/-/solend-sdk-0.6.9.tgz", + "integrity": "sha512-KToDqIDsn11hdNY3M/Lew5spSF2ML2S8q5H21pwjVxFW1BV01Mgm0Y1sD6pLnQ9epQUAqxtbGj1oUETs6bqFMQ==", + "dependencies": { + "@marinade.finance/marinade-ts-sdk": "^3.1.1", + "@mithraic-labs/psy-american": "^0.2.1", + "@project-serum/anchor": "^0.24.2", + "@pythnetwork/client": "^2.5.1", + "@solana/buffer-layout": "^4.0.0", + "@solana/spl-token": "^0.1.8", + "@solana/web3.js": "^1.66.2", + "axios": "^0.24.0", + "bignumber.js": "^9.0.2", + "bn.js": "^5.2.0", + "buffer": "^6.0.3", + "buffer-layout": "^1.2.0", + "hot-shots": "^9.3.0", + "isomorphic-fetch": "^3.0.0", + "jsbi": "^4.3.0", + "typedoc-plugin-cname": "^1.0.1" + } + }, + "node_modules/@solendprotocol/solend-sdk/node_modules/@project-serum/anchor": { + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@project-serum/anchor/-/anchor-0.24.2.tgz", + "integrity": "sha512-0/718g8/DnEuwAidUwh5wLYphUYXhUbiClkuRNhvNoa+1Y8a4g2tJyxoae+emV+PG/Gikd/QUBNMkIcimiIRTA==", + "dependencies": { + "@project-serum/borsh": "^0.2.5", + "@solana/web3.js": "^1.36.0", + "base64-js": "^1.5.1", + "bn.js": "^5.1.2", + "bs58": "^4.0.1", + "buffer-layout": "^1.2.2", + "camelcase": "^5.3.1", + "cross-fetch": "^3.1.5", + "crypto-hash": "^1.3.0", + "eventemitter3": "^4.0.7", + "js-sha256": "^0.9.0", + "pako": "^2.0.3", + "snake-case": "^3.0.4", + "toml": "^3.0.0" + }, + "engines": { + "node": ">=11" + } + }, + "node_modules/@solendprotocol/solend-sdk/node_modules/axios": { + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.24.0.tgz", + "integrity": "sha512-Q6cWsys88HoPgAaFAVUb0WpPk0O8iTeisR9IMqy9G8AbO4NlpVknrnQS03zzF9PGAWgO3cgletO3VjV/P7VztA==", + "dependencies": { + "follow-redirects": "^1.14.4" + } + }, + "node_modules/@solendprotocol/solend-sdk/node_modules/buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" + } + }, + "node_modules/@solendprotocol/solend-sdk/node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, "node_modules/@solendprotocol/solend-sdk/node_modules/typedoc": { "version": "0.20.37", "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.20.37.tgz", @@ -1319,9 +1501,9 @@ } }, "node_modules/@types/node": { - "version": "18.8.0", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.8.0.tgz", - "integrity": "sha512-u+h43R6U8xXDt2vzUaVP3VwjjLyOJk6uEciZS8OSyziUQGOwmk+l+4drxcsDboHXwyTaqS1INebghmWMRxq3LA==" + "version": "18.11.18", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.18.tgz", + "integrity": "sha512-DHQpWGjyQKSHj3ebjFI/wRKcqQcdR+MoFBygntYOZytCqNfkd2ZC4ARDJ2DQqhjH5p85Nnd3jhUJIXrszFX/JA==" }, "node_modules/@types/retry": { "version": "0.12.2", @@ -1338,9 +1520,9 @@ } }, "node_modules/acorn": { - "version": "8.8.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.0.tgz", - "integrity": "sha512-QOxyigPVrpZ2GXT+PFyZTl6TtOFc5egxHIP9IlQ+RbupQuX4RkT/Bee4/kQuC02Xkzg84JcT7oLYtDIQxp+v7w==", + "version": "8.8.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.1.tgz", + "integrity": "sha512-7zFpHzhnqYKrkYdUjF1HI1bzd0VygEGX8lFk4k5zVMqHEoES+P+7TKI+EvLO9WVMJ8eekdO0aDEK044xTXwPPA==", "dev": true, "bin": { "acorn": "bin/acorn" @@ -1349,6 +1531,15 @@ "node": ">=0.4.0" } }, + "node_modules/acorn-jsx": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "dev": true, + "peerDependencies": { + "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, "node_modules/acorn-walk": { "version": "8.2.0", "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", @@ -1363,12 +1554,71 @@ "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-3.0.0.tgz", "integrity": "sha512-H7wUZRn8WpTq9jocdxQ2c8x2sKo9ZVmzfRE13GiNJXfp7NcKYEdvl3vspKjXox6RIG2VtaRe4JFvxG4rqp2Zuw==" }, + "node_modules/agentkeepalive": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.2.1.tgz", + "integrity": "sha512-Zn4cw2NEqd+9fiSVWMscnjyQ1a8Yfoc5oBajLeo5w+YBHgDUcEBY2hS4YpTz6iN5f/2zQiktcuM6tS8x1p9dpA==", + "dependencies": { + "debug": "^4.1.0", + "depd": "^1.1.2", + "humanize-ms": "^1.2.1" + }, + "engines": { + "node": ">= 8.0.0" + } + }, + "node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, "node_modules/arg": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", "dev": true }, + "node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, "node_modules/asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", @@ -1383,6 +1633,47 @@ "node": ">= 4.0.0" } }, + "node_modules/available-typed-arrays": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz", + "integrity": "sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/aws-sdk": { + "version": "2.1283.0", + "resolved": "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.1283.0.tgz", + "integrity": "sha512-YlxTF0T9X8AcNrOzFPVOPnX1jNtHZjYHRUCfpsVwqdajHDGGruVsVppgBYXEiCRuTQNUhcJTUx0J0uKBhKQZIA==", + "dependencies": { + "buffer": "4.9.2", + "events": "1.1.1", + "ieee754": "1.1.13", + "jmespath": "0.16.0", + "querystring": "0.2.0", + "sax": "1.2.1", + "url": "0.10.3", + "util": "^0.12.4", + "uuid": "8.0.0", + "xml2js": "0.4.19" + }, + "engines": { + "node": ">= 10.0.0" + } + }, + "node_modules/aws-sdk/node_modules/buffer": { + "version": "4.9.2", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-4.9.2.tgz", + "integrity": "sha512-xq+q3SRMOxGivLhBNaUdC64hDTQwejJ+H0T/NB1XMtTVEwNTrfFF3gAxiyW0Bu/xWEGhjVKgUcMhCrUy2+uCWg==", + "dependencies": { + "base64-js": "^1.0.2", + "ieee754": "^1.1.4", + "isarray": "^1.0.0" + } + }, "node_modules/axios": { "version": "0.27.2", "resolved": "https://registry.npmjs.org/axios/-/axios-0.27.2.tgz", @@ -1395,8 +1686,7 @@ "node_modules/balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", - "peer": true + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" }, "node_modules/base-x": { "version": "3.0.9", @@ -1443,9 +1733,9 @@ } }, "node_modules/bignumber.js": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.1.0.tgz", - "integrity": "sha512-4LwHK4nfDOraBCtst+wOWIHbu1vhvAPJK8g8nROd4iuc3PSEjWif/qwbkh8jwCJz6yDBvtU4KPynETgrfh7y3A==", + "version": "9.1.1", + "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.1.1.tgz", + "integrity": "sha512-pHm4LsMJ6lzgNGVfZHjMoO8sdoRhOzOH4MLmY65Jg70bpxCKu5iOHNJyfF6OyvYw7t8Fpf35RuzUyqnQsj8Vig==", "engines": { "node": "*" } @@ -1482,7 +1772,6 @@ "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "peer": true, "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -1502,9 +1791,9 @@ } }, "node_modules/buffer": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", - "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.1.tgz", + "integrity": "sha512-rVAXBwEcEoYtxnHSO5iWyhzV/O1WMtkUYWlfdLS7FjU4PnSJJHEfHXi/uHPI5EwltmOA794gN3bm3/pzuctWjQ==", "funding": [ { "type": "github", @@ -1532,10 +1821,29 @@ "node": ">=4.5" } }, + "node_modules/buffer/node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, "node_modules/bufferutil": { - "version": "4.0.6", - "resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.6.tgz", - "integrity": "sha512-jduaYOYtnio4aIAyc6UbvPCVcgq7nYpVnucyxr6eCYg/Woad9Hf/oxxBRDnGGjPfjUm6j5O/uBWhIu4iLebFaw==", + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.7.tgz", + "integrity": "sha512-kukuqc39WOHtdxtw4UScxF/WVnMFVSQVKhtx3AjZJzhd0RGZZldcrfSEbVsWWe6KNH253574cq5F+wpv0G9pJw==", "hasInstallScript": true, "optional": true, "dependencies": { @@ -1545,6 +1853,27 @@ "node": ">=6.14.2" } }, + "node_modules/call-bind": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", + "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "dependencies": { + "function-bind": "^1.1.1", + "get-intrinsic": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, "node_modules/camelcase": { "version": "5.3.1", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", @@ -1553,6 +1882,40 @@ "node": ">=6" } }, + "node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, "node_modules/colors": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz", @@ -1581,8 +1944,7 @@ "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", - "peer": true + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" }, "node_modules/create-require": { "version": "1.1.1", @@ -1598,6 +1960,20 @@ "node-fetch": "2.6.7" } }, + "node_modules/cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, "node_modules/crypto-hash": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/crypto-hash/-/crypto-hash-1.3.0.tgz", @@ -1609,6 +1985,28 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/deep-is": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "dev": true + }, "node_modules/delay": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/delay/-/delay-5.0.0.tgz", @@ -1628,6 +2026,14 @@ "node": ">=0.4.0" } }, + "node_modules/depd": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", + "integrity": "sha512-7emPTl6Dpo6JRXOXjLRxck+FlLRX5847cLKEn00PLAgc3g2hTZZgr+e4c2v6QpSmLeFP3n5yUo7ft6avBK/5jQ==", + "engines": { + "node": ">= 0.6" + } + }, "node_modules/diff": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", @@ -1637,6 +2043,18 @@ "node": ">=0.3.1" } }, + "node_modules/doctrine": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", + "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", + "dev": true, + "dependencies": { + "esutils": "^2.0.2" + }, + "engines": { + "node": ">=6.0.0" + } + }, "node_modules/dot-case": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/dot-case/-/dot-case-3.0.4.tgz", @@ -1686,10 +2104,219 @@ "es6-promise": "^4.0.3" } }, + "node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint": { + "version": "8.32.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.32.0.tgz", + "integrity": "sha512-nETVXpnthqKPFyuY2FNjz/bEd6nbosRgKbkgS/y1C7LJop96gYHWpiguLecMHQ2XCPxn77DS0P+68WzG6vkZSQ==", + "dev": true, + "dependencies": { + "@eslint/eslintrc": "^1.4.1", + "@humanwhocodes/config-array": "^0.11.8", + "@humanwhocodes/module-importer": "^1.0.1", + "@nodelib/fs.walk": "^1.2.8", + "ajv": "^6.10.0", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.2", + "debug": "^4.3.2", + "doctrine": "^3.0.0", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^7.1.1", + "eslint-utils": "^3.0.0", + "eslint-visitor-keys": "^3.3.0", + "espree": "^9.4.0", + "esquery": "^1.4.0", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^6.0.1", + "find-up": "^5.0.0", + "glob-parent": "^6.0.2", + "globals": "^13.19.0", + "grapheme-splitter": "^1.0.4", + "ignore": "^5.2.0", + "import-fresh": "^3.0.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "is-path-inside": "^3.0.3", + "js-sdsl": "^4.1.4", + "js-yaml": "^4.1.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.4.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.1.2", + "natural-compare": "^1.4.0", + "optionator": "^0.9.1", + "regexpp": "^3.2.0", + "strip-ansi": "^6.0.1", + "strip-json-comments": "^3.1.0", + "text-table": "^0.2.0" + }, + "bin": { + "eslint": "bin/eslint.js" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-scope": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.1.1.tgz", + "integrity": "sha512-QKQM/UXpIiHcLqJ5AOyIW7XZmzjkzQXYE54n1++wb0u9V/abW3l9uQnxX8Z5Xd18xyKIMTUAyQ0k1e8pz6LUrw==", + "dev": true, + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, + "node_modules/eslint-utils": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-3.0.0.tgz", + "integrity": "sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==", + "dev": true, + "dependencies": { + "eslint-visitor-keys": "^2.0.0" + }, + "engines": { + "node": "^10.0.0 || ^12.0.0 || >= 14.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/mysticatea" + }, + "peerDependencies": { + "eslint": ">=5" + } + }, + "node_modules/eslint-utils/node_modules/eslint-visitor-keys": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", + "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/eslint-visitor-keys": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz", + "integrity": "sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA==", + "dev": true, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, + "node_modules/espree": { + "version": "9.4.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.4.1.tgz", + "integrity": "sha512-XwctdmTO6SIvCzd9810yyNzIrOrqNYV9Koizx4C/mRhf9uq0o4yHoCEU/670pOxOL/MSraektvSAji79kX90Vg==", + "dev": true, + "dependencies": { + "acorn": "^8.8.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^3.3.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/esquery": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.4.0.tgz", + "integrity": "sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w==", + "dev": true, + "dependencies": { + "estraverse": "^5.1.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "dependencies": { + "estraverse": "^5.2.0" + }, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/ethereum-cryptography": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-1.1.2.tgz", + "integrity": "sha512-XDSJlg4BD+hq9N2FjvotwUET9Tfxpxc3kWGE2AqUG5vcbeunnbImVk3cj6e/xT3phdW21mE8R5IugU4fspQDcQ==", + "dependencies": { + "@noble/hashes": "1.1.2", + "@noble/secp256k1": "1.6.3", + "@scure/bip32": "1.1.0", + "@scure/bip39": "1.1.0" + } + }, + "node_modules/ethereum-cryptography/node_modules/@noble/hashes": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.1.2.tgz", + "integrity": "sha512-KYRCASVTv6aeUi1tsF8/vpyR7zpfs3FUzy2Jqm+MU+LmUKhQ0y2FpfwqkCcxSg2ua4GALJd8k2R76WxwZGbQpA==", + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ] + }, + "node_modules/ethereum-cryptography/node_modules/@noble/secp256k1": { + "version": "1.6.3", + "resolved": "https://registry.npmjs.org/@noble/secp256k1/-/secp256k1-1.6.3.tgz", + "integrity": "sha512-T04e4iTurVy7I8Sw4+c5OSN9/RkPlo1uKxAomtxQNLq8j1uPAqnsqG1bqvY3Jv7c13gyr6dui0zmh/I3+f/JaQ==", + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ] + }, "node_modules/ethers": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/ethers/-/ethers-5.7.1.tgz", - "integrity": "sha512-5krze4dRLITX7FpU8J4WscXqADiKmyeNlylmmDLbS95DaZpBhDe2YSwRQwKXWNyXcox7a3gBgm/MkGXV1O1S/Q==", + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/ethers/-/ethers-5.7.2.tgz", + "integrity": "sha512-wswUsmWo1aOK8rR7DIKiWSw9DbLWe6x98Jrn8wcTflTVvaXhAMaB5zGAXy0GYQEQp9iO1iSHWVyARQm11zUtyg==", "funding": [ { "type": "individual", @@ -1719,7 +2346,7 @@ "@ethersproject/networks": "5.7.1", "@ethersproject/pbkdf2": "5.7.0", "@ethersproject/properties": "5.7.0", - "@ethersproject/providers": "5.7.1", + "@ethersproject/providers": "5.7.2", "@ethersproject/random": "5.7.0", "@ethersproject/rlp": "5.7.0", "@ethersproject/sha2": "5.7.0", @@ -1738,6 +2365,14 @@ "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==" }, + "node_modules/events": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/events/-/events-1.1.1.tgz", + "integrity": "sha512-kEcvvCBByWXGnZy6JUlgAp2gBIUjfCAV6P6TgT1/aaQKcmuAEC4OZTV1I4EWQLz2gxZw76atuVyvHhTxvi0Flw==", + "engines": { + "node": ">=0.4.x" + } + }, "node_modules/extract-files": { "version": "9.0.0", "resolved": "https://registry.npmjs.org/extract-files/-/extract-files-9.0.0.tgz", @@ -1757,11 +2392,50 @@ "node": "> 0.1.90" } }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true + }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true + }, + "node_modules/fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", + "dev": true + }, "node_modules/fast-stable-stringify": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fast-stable-stringify/-/fast-stable-stringify-1.0.0.tgz", "integrity": "sha512-wpYMUmFu5f00Sm0cj2pfivpmawLZ0NKdviQ4w9zJeR8JVtOpOxHmLaJuj0vxvGqMJQWyP/COUkF75/57OKyRag==" }, + "node_modules/fastq": { + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.15.0.tgz", + "integrity": "sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==", + "dev": true, + "dependencies": { + "reusify": "^1.0.4" + } + }, + "node_modules/file-entry-cache": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", + "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", + "dev": true, + "dependencies": { + "flat-cache": "^3.0.4" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + } + }, "node_modules/file-uri-to-path": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", @@ -1775,6 +2449,41 @@ "traverse-chain": "~0.1.0" } }, + "node_modules/find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "dependencies": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/flat-cache": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz", + "integrity": "sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==", + "dev": true, + "dependencies": { + "flatted": "^3.1.0", + "rimraf": "^3.0.2" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + } + }, + "node_modules/flatted": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.7.tgz", + "integrity": "sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==", + "dev": true + }, "node_modules/follow-redirects": { "version": "1.15.2", "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", @@ -1794,6 +2503,14 @@ } } }, + "node_modules/for-each": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", + "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", + "dependencies": { + "is-callable": "^1.1.3" + } + }, "node_modules/form-data": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", @@ -1825,20 +2542,30 @@ "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", - "peer": true + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" }, "node_modules/function-bind": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", - "peer": true + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" + }, + "node_modules/get-intrinsic": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.3.tgz", + "integrity": "sha512-QJVz1Tj7MS099PevUG5jvnt9tSkXN8K14dxQlikJuPt4uD9hHAHjLyLBiLR5zELelBdD9QNRAXZzsJx0WaDL9A==", + "dependencies": { + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } }, "node_modules/glob": { "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "peer": true, "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", @@ -1854,17 +2581,60 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/globals": { + "version": "13.19.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.19.0.tgz", + "integrity": "sha512-dkQ957uSRWHw7CFXLUtUHQI3g3aWApYhfNR2O6jn/907riyTYKVBmxYVROkBcY614FSSeSJh7Xm7SrUWCxvJMQ==", + "dev": true, + "dependencies": { + "type-fest": "^0.20.2" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/gopd": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", + "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", + "dependencies": { + "get-intrinsic": "^1.1.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/graceful-fs": { "version": "4.2.10", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", "peer": true }, + "node_modules/grapheme-splitter": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz", + "integrity": "sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==", + "dev": true + }, "node_modules/graphql": { "version": "16.6.0", "resolved": "https://registry.npmjs.org/graphql/-/graphql-16.6.0.tgz", "integrity": "sha512-KPIBPDlW7NxrbT/eh4qPXz5FiFdL5UbaA0XUNz2Rp3Z3hqBSkbj0GVjwFDztsWVauZUWsbKHgMg++sk8UX0bkw==", - "peer": true, "engines": { "node": "^12.22.0 || ^14.16.0 || ^16.0.0 || >=17.0.0" } @@ -1920,7 +2690,6 @@ "version": "1.0.3", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", - "peer": true, "dependencies": { "function-bind": "^1.1.1" }, @@ -1928,6 +2697,40 @@ "node": ">= 0.4.0" } }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/has-symbols": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", + "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-tostringtag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.0.tgz", + "integrity": "sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==", + "dependencies": { + "has-symbols": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/hash.js": { "version": "1.1.7", "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", @@ -1952,30 +2755,68 @@ "minimalistic-crypto-utils": "^1.0.1" } }, - "node_modules/ieee754": { + "node_modules/hot-shots": { + "version": "9.3.0", + "resolved": "https://registry.npmjs.org/hot-shots/-/hot-shots-9.3.0.tgz", + "integrity": "sha512-e4tgWptiBvlIMnAX0ORe+dNEt0HznD+T2ckzXDUwCBsU7uWr2mwq5UtoT+Df5r9hD5S/DuP8rTxJUQvqAFSFKA==", + "engines": { + "node": ">=6.0.0" + }, + "optionalDependencies": { + "unix-dgram": "2.x" + } + }, + "node_modules/humanize-ms": { "version": "1.2.1", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", - "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] + "resolved": "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz", + "integrity": "sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ==", + "dependencies": { + "ms": "^2.0.0" + } + }, + "node_modules/ieee754": { + "version": "1.1.13", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.13.tgz", + "integrity": "sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg==" + }, + "node_modules/ignore": { + "version": "5.2.4", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.4.tgz", + "integrity": "sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==", + "dev": true, + "engines": { + "node": ">= 4" + } + }, + "node_modules/import-fresh": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", + "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", + "dev": true, + "dependencies": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", + "dev": true, + "engines": { + "node": ">=0.8.19" + } }, "node_modules/inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", - "peer": true, "dependencies": { "once": "^1.3.0", "wrappy": "1" @@ -1995,10 +2836,36 @@ "node": ">= 0.10" } }, + "node_modules/is-arguments": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.1.tgz", + "integrity": "sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA==", + "dependencies": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-callable": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", + "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-core-module": { - "version": "2.10.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.10.0.tgz", - "integrity": "sha512-Erxj2n/LDAZ7H8WNJXd9tw38GYM3dv8rk8Zcs+jJuxYTW7sozH+SS8NtrSjVL1/vpLvWi1hxy96IzjJ3EHTJJg==", + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.11.0.tgz", + "integrity": "sha512-RRjxlvLDkD1YJwDbroBHMb+cukurkDWNyHx7D3oNB5x9rb5ogcksMC5wHCadcXoo67gVr/+3GFySh3134zi6rw==", "peer": true, "dependencies": { "has": "^1.0.3" @@ -2007,6 +2874,79 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-generator-function": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.10.tgz", + "integrity": "sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A==", + "dependencies": { + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-path-inside": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", + "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-typed-array": { + "version": "1.1.10", + "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.10.tgz", + "integrity": "sha512-PJqgEHiWZvMpaFZ3uTc8kHPM4+4ADTlDniuQL7cU/UDA0Ql7F70yGfHph3cLNe+c9toaigv+DFzTJKhc2CtO6A==", + "dependencies": { + "available-typed-arrays": "^1.0.5", + "call-bind": "^1.0.2", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==" + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true + }, "node_modules/isomorphic-fetch": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/isomorphic-fetch/-/isomorphic-fetch-3.0.0.tgz", @@ -2055,6 +2995,32 @@ "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.55.tgz", "integrity": "sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==" }, + "node_modules/jayson/node_modules/uuid": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "bin": { + "uuid": "dist/bin/uuid" + } + }, + "node_modules/jmespath": { + "version": "0.16.0", + "resolved": "https://registry.npmjs.org/jmespath/-/jmespath-0.16.0.tgz", + "integrity": "sha512-9FzQjJ7MATs1tSpnco1K6ayiYE3figslrXA72G2HQ/n76RzvYlofyi5QM+iX4YRs/pu3yzxlVQSST23+dMDknw==", + "engines": { + "node": ">= 0.6.0" + } + }, + "node_modules/js-sdsl": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/js-sdsl/-/js-sdsl-4.2.0.tgz", + "integrity": "sha512-dyBIzQBDkCqCu+0upx25Y2jGdbTGxE9fshMsCdK0ViOongpV+n5tXRcZY9v7CaVQ79AGS9KA1KHtojxiM7aXSQ==", + "dev": true, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/js-sdsl" + } + }, "node_modules/js-sha256": { "version": "0.9.0", "resolved": "https://registry.npmjs.org/js-sha256/-/js-sha256-0.9.0.tgz", @@ -2070,11 +3036,43 @@ "resolved": "https://registry.npmjs.org/js-sha512/-/js-sha512-0.8.0.tgz", "integrity": "sha512-PWsmefG6Jkodqt+ePTvBZCSMFgN7Clckjd0O7su3I0+BW2QWUTJNzjktHsztGLhncP2h8mcF9V9Y2Ha59pAViQ==" }, + "node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dev": true, + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, "node_modules/jsbi": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/jsbi/-/jsbi-4.3.0.tgz", "integrity": "sha512-SnZNcinB4RIcnEyZqFPdGPVgrg2AcnykiBy0sHVJQKHYeaLUvi3Exj+iaPpLnFVkDPZIV4U0yvgC9/R4uEAZ9g==" }, + "node_modules/json-bigint": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-bigint/-/json-bigint-1.0.0.tgz", + "integrity": "sha512-SiPv/8VpZuWbvLSMtTDU8hEfrZWg/mH/nV/b4o0CYbSxu1UIQPLdwKOCIyLQX+VIPO5vrLX3i8qtqFyhdPSUSQ==", + "dependencies": { + "bignumber.js": "^9.0.0" + } + }, + "node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true + }, + "node_modules/json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", + "dev": true + }, "node_modules/json-stringify-safe": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", @@ -2126,6 +3124,19 @@ "resolved": "https://registry.npmjs.org/just-performance/-/just-performance-4.3.0.tgz", "integrity": "sha512-L7RjvtJsL0QO8xFs5wEoDDzzJwoiowRw6Rn/GnvldlchS2JQr9wFYPiwZcDfrbbujEKqKN0tvENdbjXdYhDp5Q==" }, + "node_modules/levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "dependencies": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, "node_modules/limiter": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/limiter/-/limiter-2.1.0.tgz", @@ -2134,11 +3145,32 @@ "just-performance": "4.3.0" } }, + "node_modules/locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "dependencies": { + "p-locate": "^5.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/lodash": { "version": "4.17.21", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" }, + "node_modules/lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", + "dev": true + }, "node_modules/lower-case": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/lower-case/-/lower-case-2.0.2.tgz", @@ -2204,7 +3236,6 @@ "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "peer": true, "dependencies": { "brace-expansion": "^1.1.7" }, @@ -2213,10 +3244,30 @@ } }, "node_modules/minimist": { - "version": "1.2.6", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", - "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==", - "peer": true + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.7.tgz", + "integrity": "sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g==", + "peer": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "node_modules/nan": { + "version": "2.17.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.17.0.tgz", + "integrity": "sha512-2ZTgtl0nJsO0KQCjEpxcIr5D+Yv90plTitZt9JBfQvVJDS5seMl3FOvsh3+9CoYWXf/1l5OaZzzF6nDm4cagaQ==", + "optional": true + }, + "node_modules/natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", + "dev": true }, "node_modules/neo-async": { "version": "2.6.2", @@ -2263,35 +3314,119 @@ "node-gyp-build-test": "build-test.js" } }, - "node_modules/once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", - "peer": true, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/optionator": { + "version": "0.9.1", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", + "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==", + "dev": true, + "dependencies": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.3" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "dependencies": { + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/pako": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/pako/-/pako-2.1.0.tgz", + "integrity": "sha512-w+eufiZ1WuJYgPXbV/PO3NCMEc3xqylkKHzp8bxp1uW4qaSNQUkwmLLEc3kKsfz8lpV1F8Ht3U1Cm+9Srog2ug==" + }, + "node_modules/parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, "dependencies": { - "wrappy": "1" + "callsites": "^3.0.0" + }, + "engines": { + "node": ">=6" } }, - "node_modules/pako": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/pako/-/pako-2.0.4.tgz", - "integrity": "sha512-v8tweI900AUkZN6heMU/4Uy4cXRc2AYNRggVmTR+dEncawDJgCdLMximOVA2p4qO57WMynangsfGRb5WD6L1Bg==" + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true, + "engines": { + "node": ">=8" + } }, "node_modules/path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", - "peer": true, "engines": { "node": ">=0.10.0" } }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/path-parse": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", "peer": true }, + "node_modules/prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true, + "engines": { + "node": ">= 0.8.0" + } + }, "node_modules/progress": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", @@ -2301,6 +3436,40 @@ "node": ">=0.4.0" } }, + "node_modules/punycode": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz", + "integrity": "sha512-RofWgt/7fL5wP1Y7fxE7/EmTLzQVnB0ycyibJ0OOHIlJqTNzglYFxVwETOcIoJqJmpDXJ9xImDv+Fq34F/d4Dw==" + }, + "node_modules/querystring": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz", + "integrity": "sha512-X/xY82scca2tau62i9mDyU9K+I+djTMUsvwf7xnUX5GLvVzgJybOJf4Y6o9Zx3oJK/LSXg5tTZBjwzqVPaPO2g==", + "deprecated": "The querystring API is considered Legacy. new code should use the URLSearchParams API instead.", + "engines": { + "node": ">=0.4.x" + } + }, + "node_modules/queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, "node_modules/rechoir": { "version": "0.6.2", "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", @@ -2314,9 +3483,21 @@ } }, "node_modules/regenerator-runtime": { - "version": "0.13.9", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.9.tgz", - "integrity": "sha512-p3VT+cOEgxFsRRA9X4lkI1E+k2/CtnKtU4gcxyaCUreilL/vqI6CdZ3wxVUx3UOUg+gnUOQQcRI7BmSI656MYA==" + "version": "0.13.11", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz", + "integrity": "sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==" + }, + "node_modules/regexpp": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz", + "integrity": "sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/mysticatea" + } }, "node_modules/resolve": { "version": "1.22.1", @@ -2335,6 +3516,40 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "dev": true, + "engines": { + "iojs": ">=1.0.0", + "node": ">=0.10.0" + } + }, + "node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/rpc-websockets": { "version": "7.5.0", "resolved": "https://registry.npmjs.org/rpc-websockets/-/rpc-websockets-7.5.0.tgz", @@ -2354,10 +3569,18 @@ "utf-8-validate": "^5.0.2" } }, + "node_modules/rpc-websockets/node_modules/uuid": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "bin": { + "uuid": "dist/bin/uuid" + } + }, "node_modules/rpc-websockets/node_modules/ws": { - "version": "8.9.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.9.0.tgz", - "integrity": "sha512-Ja7nszREasGaYUYCI2k4lCKIRTt+y7XuqVoHR44YpI49TtryyqbqvDMn5eqfW7e6HzTukDRIsXqzVHScqRcafg==", + "version": "8.11.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.11.0.tgz", + "integrity": "sha512-HPG3wQd9sNQoT9xHyNCXoDUa+Xw/VevmY9FoHyQ+g+rrMn4j6FB4np7Z0OhdTgjx6MgQLK7jwSy1YecU1+4Asg==", "engines": { "node": ">=10.0.0" }, @@ -2374,6 +3597,29 @@ } } }, + "node_modules/run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "queue-microtask": "^1.2.2" + } + }, "node_modules/safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", @@ -2393,11 +3639,37 @@ } ] }, + "node_modules/sax": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.1.tgz", + "integrity": "sha512-8I2a3LovHTOpm7NV5yOyO8IHqgVsfK4+UuySrXU8YXkSRX7k6hCV9b3HrkKCr3nMpgj+0bmocaJJWpvp1oc7ZA==" + }, "node_modules/scrypt-js": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/scrypt-js/-/scrypt-js-3.0.1.tgz", "integrity": "sha512-cdwTTnqPu0Hyvf5in5asVdZocVDTNRmR7XEcJuIzMjJeSHybHl7vpB66AzwTaIg6CLSbtjcxc8fqcySfnTkccA==" }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/shelljs": { "version": "0.8.5", "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.5.tgz", @@ -2444,11 +3716,65 @@ "node": ">=0.10.0" } }, + "node_modules/starknet": { + "version": "4.17.1", + "resolved": "https://registry.npmjs.org/starknet/-/starknet-4.17.1.tgz", + "integrity": "sha512-xihdf+pWUCdKK30r+fNLfg+5RHHpTNw20gvrucbcPPDnsDr2bjwtFu3UjXOtHnbys6qF8fW3ttMkctRoQ5J6Xg==", + "dependencies": { + "@ethersproject/bytes": "^5.6.1", + "bn.js": "^5.2.1", + "elliptic": "^6.5.4", + "ethereum-cryptography": "^1.0.3", + "hash.js": "^1.1.7", + "isomorphic-fetch": "^3.0.0", + "json-bigint": "^1.0.0", + "minimalistic-assert": "^1.0.1", + "pako": "^2.0.4", + "ts-custom-error": "^3.3.1", + "url-join": "^4.0.1" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/superstruct": { "version": "0.15.5", "resolved": "https://registry.npmjs.org/superstruct/-/superstruct-0.15.5.tgz", "integrity": "sha512-4AOeU+P5UuE/4nOUkmcQdW5y7i9ndt1cQd/3iUe+LTz3RxESf/W/5lg4B74HbDMMv8PHnPnGCQFH45kBcrQYoQ==" }, + "node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/supports-preserve-symlinks-flag": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", @@ -2466,6 +3792,12 @@ "resolved": "https://registry.npmjs.org/text-encoding-utf-8/-/text-encoding-utf-8-1.0.2.tgz", "integrity": "sha512-8bw4MY9WjdsD2aMtO0OzOCY3pXGYNx2d2FfHRVUKkiCPDWjKuOlhLVASS+pD7VkLTVjW268LYJHwsnPFlBpbAg==" }, + "node_modules/text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", + "dev": true + }, "node_modules/through": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", @@ -2487,9 +3819,17 @@ "integrity": "sha512-up6Yvai4PYKhpNp5PkYtx50m3KbwQrqDwbuZP/ItyL64YEWHAvH6Md83LFLV/GRSk/BoUVwwgUzX6SOQSbsfAg==" }, "node_modules/tron-format-address": { - "version": "0.1.8", - "resolved": "https://registry.npmjs.org/tron-format-address/-/tron-format-address-0.1.8.tgz", - "integrity": "sha512-oTtzUM43OZhQiv1p2aOVqbnev6mmJHXQrMpS3nn7zVAI/+ffA/aF+Y/vugHtYotckkromRLPEl/SR1HfJjAYQA==" + "version": "0.1.11", + "resolved": "https://registry.npmjs.org/tron-format-address/-/tron-format-address-0.1.11.tgz", + "integrity": "sha512-Jx2i3R1yXrEMQsfc2jueAI71ivnySzdeva6SiSM/pddwj8TK7PVABSP6s/iYcTRI63GxJEgGMmOJXNNKoBmbQw==" + }, + "node_modules/ts-custom-error": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/ts-custom-error/-/ts-custom-error-3.3.1.tgz", + "integrity": "sha512-5OX1tzOjxWEgsr/YEUWSuPrQ00deKLh6D7OTWcvNHm12/7QPyRh8SYpyWvA4IZv8H/+GQWQEh/kwo95Q9OVW1A==", + "engines": { + "node": ">=14.0.0" + } }, "node_modules/ts-node": { "version": "10.9.1", @@ -2535,9 +3875,33 @@ } }, "node_modules/tslib": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz", - "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==" + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.1.tgz", + "integrity": "sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==" + }, + "node_modules/type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "dependencies": { + "prelude-ls": "^1.2.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } }, "node_modules/typedoc-default-themes": { "version": "0.12.10", @@ -2549,9 +3913,9 @@ } }, "node_modules/typescript": { - "version": "4.8.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.4.tgz", - "integrity": "sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ==", + "version": "4.9.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.4.tgz", + "integrity": "sha512-Uz+dTXYzxXXbsFpM86Wh3dKCxrQqUcVMxwU54orwlJjOpO3ao8L7j5lH+dWfTwgCwIuM9GQ2kvVotzYJMXTBZg==", "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -2561,9 +3925,9 @@ } }, "node_modules/uglify-js": { - "version": "3.17.2", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.17.2.tgz", - "integrity": "sha512-bbxglRjsGQMchfvXZNusUcYgiB9Hx2K4AHYXQy2DITZ9Rd+JzhX7+hoocE5Winr7z2oHvPsekkBwXtigvxevXg==", + "version": "3.17.4", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.17.4.tgz", + "integrity": "sha512-T9q82TJI9e/C1TAxYvfb16xO120tMVFZrGA3f9/P4424DNu6ypK103y0GPFVa17yotwSyZW5iYXgjYHkGrJW/g==", "optional": true, "peer": true, "bin": { @@ -2582,10 +3946,56 @@ "node": ">= 10.0.0" } }, + "node_modules/unix-dgram": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/unix-dgram/-/unix-dgram-2.0.6.tgz", + "integrity": "sha512-AURroAsb73BZ6CdAyMrTk/hYKNj3DuYYEuOaB8bYMOHGKupRNScw90Q5C71tWJc3uE7dIeXRyuwN0xLLq3vDTg==", + "hasInstallScript": true, + "optional": true, + "dependencies": { + "bindings": "^1.5.0", + "nan": "^2.16.0" + }, + "engines": { + "node": ">=0.10.48" + } + }, + "node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, + "dependencies": { + "punycode": "^2.1.0" + } + }, + "node_modules/uri-js/node_modules/punycode": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.2.0.tgz", + "integrity": "sha512-LN6QV1IJ9ZhxWTNdktaPClrNfp8xdSAYS0Zk2ddX7XsXZAxckMHPCBcHRo0cTcEIgYPRiGEkmji3Idkh2yFtYw==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/url": { + "version": "0.10.3", + "resolved": "https://registry.npmjs.org/url/-/url-0.10.3.tgz", + "integrity": "sha512-hzSUW2q06EqL1gKM/a+obYHLIO6ct2hwPuviqTTOcfFVc61UbfJ2Q32+uGL/HCPxKqrdGB5QUwIe7UqlDgwsOQ==", + "dependencies": { + "punycode": "1.3.2", + "querystring": "0.2.0" + } + }, + "node_modules/url-join": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/url-join/-/url-join-4.0.1.tgz", + "integrity": "sha512-jk1+QP6ZJqyOiuEI9AEWQfju/nB2Pw466kbA0LEZljHwKeMgd9WrAEgEGxjPDD2+TNbbb37rTyhEfrCXfuKXnA==" + }, "node_modules/utf-8-validate": { - "version": "5.0.9", - "resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.9.tgz", - "integrity": "sha512-Yek7dAy0v3Kl0orwMlvi7TPtiCNrdfHNd7Gcc/pLq4BLXqfAmd0J7OWMizUQnTTJsyjKn02mU7anqwfmUP4J8Q==", + "version": "5.0.10", + "resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.10.tgz", + "integrity": "sha512-Z6czzLq4u8fPOyx7TU6X3dvUZVvoJmxSQ+IcrlmagKhilxlhZgxPK6C5Jqbkw1IDUmFTM+cz9QDnnLTwDz/2gQ==", "hasInstallScript": true, "optional": true, "dependencies": { @@ -2595,10 +4005,22 @@ "node": ">=6.14.2" } }, + "node_modules/util": { + "version": "0.12.5", + "resolved": "https://registry.npmjs.org/util/-/util-0.12.5.tgz", + "integrity": "sha512-kZf/K6hEIrWHI6XqOFUiiMa+79wE/D8Q+NCNAWclkyg3b4d2k7s0QGepNjiABc+aR3N1PAyHL7p6UcLY6LmrnA==", + "dependencies": { + "inherits": "^2.0.3", + "is-arguments": "^1.0.4", + "is-generator-function": "^1.0.7", + "is-typed-array": "^1.1.3", + "which-typed-array": "^1.1.2" + } + }, "node_modules/uuid": { - "version": "8.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", - "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.0.0.tgz", + "integrity": "sha512-jOXGuXZAWdsTH7eZLtyXMqUb9EcWMGZNbL9YcGBJl4MH4nrxHmZJhEHvyLFrkxo+28uLb/NYRcStH48fnD0Vzw==", "bin": { "uuid": "dist/bin/uuid" } @@ -2610,9 +4032,9 @@ "dev": true }, "node_modules/vscode-oniguruma": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/vscode-oniguruma/-/vscode-oniguruma-1.6.2.tgz", - "integrity": "sha512-KH8+KKov5eS/9WhofZR8M8dMHWN2gTxjMsG4jd04YhpbPR91fUj7rYQ2/XjeHCJWbg7X++ApRIU9NUwM2vTvLA==", + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/vscode-oniguruma/-/vscode-oniguruma-1.7.0.tgz", + "integrity": "sha512-L9WMGRfrjOhgHSdOYgCt/yRMsXzLDJSL7BPrOZt73gU0iWO4mpqzqQzOz5srxqTvMBaR0XZTSrVWo4j55Rc6cA==", "peer": true }, "node_modules/vscode-textmate": { @@ -2640,6 +4062,49 @@ "webidl-conversions": "^3.0.0" } }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/which-typed-array": { + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.9.tgz", + "integrity": "sha512-w9c4xkx6mPidwp7180ckYWfMmvxpjlZuIudNtDf4N/tTAUB8VJbX25qZoAsrtGuYNnGw3pa0AXgbGKRB8/EceA==", + "dependencies": { + "available-typed-arrays": "^1.0.5", + "call-bind": "^1.0.2", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "has-tostringtag": "^1.0.0", + "is-typed-array": "^1.1.10" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/word-wrap": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", + "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/wordwrap": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", @@ -2649,8 +4114,7 @@ "node_modules/wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", - "peer": true + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" }, "node_modules/ws": { "version": "7.4.6", @@ -2672,6 +4136,23 @@ } } }, + "node_modules/xml2js": { + "version": "0.4.19", + "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.19.tgz", + "integrity": "sha512-esZnJZJOiJR9wWKMyuvSE1y6Dq5LCuJanqhxslH2bxM6duahNZ+HMpCLhBQGZkbX6xRf8x1Y2eJlgt2q3qo49Q==", + "dependencies": { + "sax": ">=0.6.0", + "xmlbuilder": "~9.0.1" + } + }, + "node_modules/xmlbuilder": { + "version": "9.0.7", + "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-9.0.7.tgz", + "integrity": "sha512-7YXTQc3P2l9+0rjaUbLwMKRhtmwg1M1eDf6nag7urC7pIPYLD9W/jmzQ4ptRSUbodw5S0jfoGTflLemQibSpeQ==", + "engines": { + "node": ">=4.0" + } + }, "node_modules/yn": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", @@ -2680,15 +4161,27 @@ "engines": { "node": ">=6" } + }, + "node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } } }, "dependencies": { "@babel/runtime": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.19.0.tgz", - "integrity": "sha512-eR8Lo9hnDS7tqkO7NsV+mKvCmv5boaXFSZ70DnfhcgiEne8hv9oCEd36Klw74EtizEqLsy4YnW8UWwpBVolHZA==", + "version": "7.20.7", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.20.7.tgz", + "integrity": "sha512-UF0tvkUtxwAgZ5W/KrkHf0Rn0fdnLDU9ScxBrEVNUprE/MzirjK4MJUX1/BVDv00Sv8cljtukVK1aky++X1SjQ==", "requires": { - "regenerator-runtime": "^0.13.4" + "regenerator-runtime": "^0.13.11" } }, "@cspotcode/source-map-support": { @@ -2701,13 +4194,31 @@ } }, "@defillama/sdk": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-3.0.1.tgz", - "integrity": "sha512-kfsGrUvlcY76rMj0Nc9RtLGmVP0XYiS2/qILTlCa0DOBWMbsgfdQLvkf6sr0ww2G0If2VDwhTGsQEhiV7jDxcw==", + "version": "4.0.43", + "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.43.tgz", + "integrity": "sha512-SS311nPgkIOEbqWe3n2kT8n3UKyLQhQmJcEhlMhv6XnPhIBk4l7kLQXQmOYHpetAZmvUxOVnQwZbl75vh2EM5w==", "requires": { "@supercharge/promise-pool": "^2.1.0", "ethers": "^5.4.5", - "node-fetch": "^2.6.7" + "node-fetch": "^2.6.7", + "tron-format-address": "^0.1.11" + } + }, + "@eslint/eslintrc": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.4.1.tgz", + "integrity": "sha512-XXrH9Uarn0stsyldqDYq8r++mROmWRI1xKMXa640Bb//SY1+ECYX6VzT6Lcx5frD0V30XieqJ0oX9I2Xj5aoMA==", + "dev": true, + "requires": { + "ajv": "^6.12.4", + "debug": "^4.3.2", + "espree": "^9.4.0", + "globals": "^13.19.0", + "ignore": "^5.2.0", + "import-fresh": "^3.2.1", + "js-yaml": "^4.1.0", + "minimatch": "^3.1.2", + "strip-json-comments": "^3.1.1" } }, "@ethersproject/abi": { @@ -2919,9 +4430,9 @@ } }, "@ethersproject/providers": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/@ethersproject/providers/-/providers-5.7.1.tgz", - "integrity": "sha512-vZveG/DLyo+wk4Ga1yx6jSEHrLPgmTt+dFv0dv8URpVCRf0jVhalps1jq/emN/oXnMRsC7cQgAF32DcXLL7BPQ==", + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/@ethersproject/providers/-/providers-5.7.2.tgz", + "integrity": "sha512-g34EWZ1WWAVgr4aptGlVBF8mhl3VWjv+8hoAnzStu8Ah22VHBsuGzP17eb6xDVRzw895G4W7vvx60lFFur/1Rg==", "requires": { "@ethersproject/abstract-provider": "^5.7.0", "@ethersproject/abstract-signer": "^5.7.0", @@ -3081,6 +4592,29 @@ "@ethersproject/strings": "^5.7.0" } }, + "@humanwhocodes/config-array": { + "version": "0.11.8", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.8.tgz", + "integrity": "sha512-UybHIJzJnR5Qc/MsD9Kr+RpO2h+/P1GhOwdiLPXK5TWk5sgTdu88bTD9UP+CKbPPh5Rni1u0GjAdYQLemG8g+g==", + "dev": true, + "requires": { + "@humanwhocodes/object-schema": "^1.2.1", + "debug": "^4.1.1", + "minimatch": "^3.0.5" + } + }, + "@humanwhocodes/module-importer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", + "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", + "dev": true + }, + "@humanwhocodes/object-schema": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", + "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", + "dev": true + }, "@jridgewell/resolve-uri": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz", @@ -3146,19 +4680,6 @@ } } }, - "@solana/spl-token": { - "version": "0.1.8", - "resolved": "https://registry.npmjs.org/@solana/spl-token/-/spl-token-0.1.8.tgz", - "integrity": "sha512-LZmYCKcPQDtJgecvWOgT/cnoIQPWjdH+QVyzPcFvyDUiT0DiRjZaam4aqNUyvchLFhzgunv3d9xOoyE34ofdoQ==", - "requires": { - "@babel/runtime": "^7.10.5", - "@solana/web3.js": "^1.21.0", - "bn.js": "^5.1.0", - "buffer": "6.0.3", - "buffer-layout": "^1.2.0", - "dotenv": "10.0.0" - } - }, "borsh": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/borsh/-/borsh-0.6.0.tgz", @@ -3193,18 +4714,13 @@ "integrity": "sha512-FuwxlW4H5kh37X/oW59pwTzzTKRzfrrQwhmyspRM7swOEZcHtDZSCt45U6oKgtuFE+WYPblePMVIPR4RZrh/hw==" } } - }, - "dotenv": { - "version": "10.0.0", - "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-10.0.0.tgz", - "integrity": "sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q==" } } }, "@mithraic-labs/psy-american": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/@mithraic-labs/psy-american/-/psy-american-0.2.2.tgz", - "integrity": "sha512-MmgLH3Mx4/TXXKLTWApRLchHaUteO31YC8jbtA6/GLqvSpIkLwfcmlzN7Ncca7UgWWCmDYgI3J15hRubqkTjmw==", + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/@mithraic-labs/psy-american/-/psy-american-0.2.3.tgz", + "integrity": "sha512-NsDfb9QNuLKNqRnq8rWAoD2Y3ouAEsAPFfwP28SmDVfkugvj03nvQtjotFLlH2TsE31YonG+gauhpeeGKZyyuw==", "requires": { "@project-serum/anchor": "^0.24.2", "@project-serum/serum": "^0.13.60", @@ -3232,24 +4748,6 @@ "snake-case": "^3.0.4", "toml": "^3.0.0" } - }, - "@solana/spl-token": { - "version": "0.1.8", - "resolved": "https://registry.npmjs.org/@solana/spl-token/-/spl-token-0.1.8.tgz", - "integrity": "sha512-LZmYCKcPQDtJgecvWOgT/cnoIQPWjdH+QVyzPcFvyDUiT0DiRjZaam4aqNUyvchLFhzgunv3d9xOoyE34ofdoQ==", - "requires": { - "@babel/runtime": "^7.10.5", - "@solana/web3.js": "^1.21.0", - "bn.js": "^5.1.0", - "buffer": "6.0.3", - "buffer-layout": "^1.2.0", - "dotenv": "10.0.0" - } - }, - "dotenv": { - "version": "10.0.0", - "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-10.0.0.tgz", - "integrity": "sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q==" } } }, @@ -3259,15 +4757,41 @@ "integrity": "sha512-Rk4SkJFaXZiznFyC/t77Q0NKS4FL7TLJJsVG2V2oiEq3kJVeTdxysEe/yRWSpnWMe808XRDJ+VFh5pt/FN5plw==" }, "@noble/hashes": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.1.3.tgz", - "integrity": "sha512-CE0FCR57H2acVI5UOzIGSSIYxZ6v/HOhDR0Ro9VLyhnzLwx0o8W1mmgaqlEUx4049qJDlIBRztv5k+MM8vbO3A==" + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.1.5.tgz", + "integrity": "sha512-LTMZiiLc+V4v1Yi16TD6aX2gmtKszNye0pQgbaLqkvhIqP7nVsSaJsWloGQjJfJ8offaoP5GtX3yY5swbcJxxQ==" }, "@noble/secp256k1": { "version": "1.7.0", "resolved": "https://registry.npmjs.org/@noble/secp256k1/-/secp256k1-1.7.0.tgz", "integrity": "sha512-kbacwGSsH/CTout0ZnZWxnW1B+jH/7r/WAAKLBtrRJ/+CUH7lgmQzl3GTrQua3SGKWNSDsS6lmjnDpIJ5Dxyaw==" }, + "@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, + "requires": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + } + }, + "@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true + }, + "@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, + "requires": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + } + }, "@project-serum/anchor": { "version": "0.25.0", "resolved": "https://registry.npmjs.org/@project-serum/anchor/-/anchor-0.25.0.tgz", @@ -3331,24 +4855,6 @@ "snake-case": "^3.0.4", "toml": "^3.0.0" } - }, - "@solana/spl-token": { - "version": "0.1.8", - "resolved": "https://registry.npmjs.org/@solana/spl-token/-/spl-token-0.1.8.tgz", - "integrity": "sha512-LZmYCKcPQDtJgecvWOgT/cnoIQPWjdH+QVyzPcFvyDUiT0DiRjZaam4aqNUyvchLFhzgunv3d9xOoyE34ofdoQ==", - "requires": { - "@babel/runtime": "^7.10.5", - "@solana/web3.js": "^1.21.0", - "bn.js": "^5.1.0", - "buffer": "6.0.3", - "buffer-layout": "^1.2.0", - "dotenv": "10.0.0" - } - }, - "dotenv": { - "version": "10.0.0", - "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-10.0.0.tgz", - "integrity": "sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q==" } } }, @@ -3360,24 +4866,106 @@ "buffer": "^6.0.1" } }, + "@scure/base": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.1.tgz", + "integrity": "sha512-ZxOhsSyxYwLJj3pLZCefNitxsj093tb2vq90mp2txoYeBqbcjDjqFhyM8eUjq/uFm6zJ+mUuqxlS2FkuSY1MTA==" + }, + "@scure/bip32": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.1.0.tgz", + "integrity": "sha512-ftTW3kKX54YXLCxH6BB7oEEoJfoE2pIgw7MINKAs5PsS6nqKPuKk1haTF/EuHmYqG330t5GSrdmtRuHaY1a62Q==", + "requires": { + "@noble/hashes": "~1.1.1", + "@noble/secp256k1": "~1.6.0", + "@scure/base": "~1.1.0" + }, + "dependencies": { + "@noble/secp256k1": { + "version": "1.6.3", + "resolved": "https://registry.npmjs.org/@noble/secp256k1/-/secp256k1-1.6.3.tgz", + "integrity": "sha512-T04e4iTurVy7I8Sw4+c5OSN9/RkPlo1uKxAomtxQNLq8j1uPAqnsqG1bqvY3Jv7c13gyr6dui0zmh/I3+f/JaQ==" + } + } + }, + "@scure/bip39": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.1.0.tgz", + "integrity": "sha512-pwrPOS16VeTKg98dYXQyIjJEcWfz7/1YJIwxUEPFfQPtc86Ym/1sVgQ2RLoD43AazMk2l/unK4ITySSpW2+82w==", + "requires": { + "@noble/hashes": "~1.1.1", + "@scure/base": "~1.1.0" + } + }, "@solana/buffer-layout": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/@solana/buffer-layout/-/buffer-layout-4.0.0.tgz", - "integrity": "sha512-lR0EMP2HC3+Mxwd4YcnZb0smnaDw7Bl2IQWZiTevRH5ZZBZn6VRWn3/92E3qdU4SSImJkA6IDHawOHAnx/qUvQ==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@solana/buffer-layout/-/buffer-layout-4.0.1.tgz", + "integrity": "sha512-E1ImOIAD1tBZFRdjeM4/pzTiTApC0AOBGwyAMS4fwIodCWArzJ3DWdoh8cKxeFM2fElkxBh2Aqts1BPC373rHA==", "requires": { "buffer": "~6.0.3" + }, + "dependencies": { + "buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "requires": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" + } + }, + "ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==" + } + } + }, + "@solana/spl-token": { + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/@solana/spl-token/-/spl-token-0.1.8.tgz", + "integrity": "sha512-LZmYCKcPQDtJgecvWOgT/cnoIQPWjdH+QVyzPcFvyDUiT0DiRjZaam4aqNUyvchLFhzgunv3d9xOoyE34ofdoQ==", + "requires": { + "@babel/runtime": "^7.10.5", + "@solana/web3.js": "^1.21.0", + "bn.js": "^5.1.0", + "buffer": "6.0.3", + "buffer-layout": "^1.2.0", + "dotenv": "10.0.0" + }, + "dependencies": { + "buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "requires": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" + } + }, + "dotenv": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-10.0.0.tgz", + "integrity": "sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q==" + }, + "ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==" + } } }, "@solana/web3.js": { - "version": "1.63.1", - "resolved": "https://registry.npmjs.org/@solana/web3.js/-/web3.js-1.63.1.tgz", - "integrity": "sha512-wgEdGVK5FTS2zENxbcGSvKpGZ0jDS6BUdGu8Gn6ns0CzgJkK83u4ip3THSnBPEQ5i/jrqukg998BwV1H67+qiQ==", + "version": "1.72.0", + "resolved": "https://registry.npmjs.org/@solana/web3.js/-/web3.js-1.72.0.tgz", + "integrity": "sha512-xMoCk0y/GpiQhHbRjMcrd5NpmkwhAA0c01id7lrr6nhNdz6Uc/CywPdBeZw3Qz6BVZ/qlUoerpKPWeiXqMUjwA==", "requires": { "@babel/runtime": "^7.12.5", "@noble/ed25519": "^1.7.0", "@noble/hashes": "^1.1.2", "@noble/secp256k1": "^1.6.3", "@solana/buffer-layout": "^4.0.0", + "agentkeepalive": "^4.2.1", "bigint-buffer": "^1.1.5", "bn.js": "^5.0.0", "borsh": "^0.7.0", @@ -3390,15 +4978,6 @@ "superstruct": "^0.14.2" }, "dependencies": { - "buffer": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.1.tgz", - "integrity": "sha512-rVAXBwEcEoYtxnHSO5iWyhzV/O1WMtkUYWlfdLS7FjU4PnSJJHEfHXi/uHPI5EwltmOA794gN3bm3/pzuctWjQ==", - "requires": { - "base64-js": "^1.3.1", - "ieee754": "^1.2.1" - } - }, "superstruct": { "version": "0.14.2", "resolved": "https://registry.npmjs.org/superstruct/-/superstruct-0.14.2.tgz", @@ -3407,9 +4986,9 @@ } }, "@solendprotocol/solend-sdk": { - "version": "0.6.5", - "resolved": "https://registry.npmjs.org/@solendprotocol/solend-sdk/-/solend-sdk-0.6.5.tgz", - "integrity": "sha512-d5CardFpcbWT4x8B5Whxe2zuGjnLe5D8ZJtz+op0Lah/oqcZXWMneW+iRdlgH+PKEchi2XcuuRZyfYuMKRA6Ow==", + "version": "0.6.9", + "resolved": "https://registry.npmjs.org/@solendprotocol/solend-sdk/-/solend-sdk-0.6.9.tgz", + "integrity": "sha512-KToDqIDsn11hdNY3M/Lew5spSF2ML2S8q5H21pwjVxFW1BV01Mgm0Y1sD6pLnQ9epQUAqxtbGj1oUETs6bqFMQ==", "requires": { "@marinade.finance/marinade-ts-sdk": "^3.1.1", "@mithraic-labs/psy-american": "^0.2.1", @@ -3417,12 +4996,13 @@ "@pythnetwork/client": "^2.5.1", "@solana/buffer-layout": "^4.0.0", "@solana/spl-token": "^0.1.8", - "@solana/web3.js": "^1.52.0", + "@solana/web3.js": "^1.66.2", "axios": "^0.24.0", "bignumber.js": "^9.0.2", "bn.js": "^5.2.0", "buffer": "^6.0.3", "buffer-layout": "^1.2.0", + "hot-shots": "^9.3.0", "isomorphic-fetch": "^3.0.0", "jsbi": "^4.3.0", "typedoc-plugin-cname": "^1.0.1" @@ -3449,19 +5029,6 @@ "toml": "^3.0.0" } }, - "@solana/spl-token": { - "version": "0.1.8", - "resolved": "https://registry.npmjs.org/@solana/spl-token/-/spl-token-0.1.8.tgz", - "integrity": "sha512-LZmYCKcPQDtJgecvWOgT/cnoIQPWjdH+QVyzPcFvyDUiT0DiRjZaam4aqNUyvchLFhzgunv3d9xOoyE34ofdoQ==", - "requires": { - "@babel/runtime": "^7.10.5", - "@solana/web3.js": "^1.21.0", - "bn.js": "^5.1.0", - "buffer": "6.0.3", - "buffer-layout": "^1.2.0", - "dotenv": "10.0.0" - } - }, "axios": { "version": "0.24.0", "resolved": "https://registry.npmjs.org/axios/-/axios-0.24.0.tgz", @@ -3470,10 +5037,19 @@ "follow-redirects": "^1.14.4" } }, - "dotenv": { - "version": "10.0.0", - "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-10.0.0.tgz", - "integrity": "sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q==" + "buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "requires": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" + } + }, + "ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==" }, "typedoc": { "version": "0.20.37", @@ -3564,9 +5140,9 @@ } }, "@types/node": { - "version": "18.8.0", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.8.0.tgz", - "integrity": "sha512-u+h43R6U8xXDt2vzUaVP3VwjjLyOJk6uEciZS8OSyziUQGOwmk+l+4drxcsDboHXwyTaqS1INebghmWMRxq3LA==" + "version": "18.11.18", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.18.tgz", + "integrity": "sha512-DHQpWGjyQKSHj3ebjFI/wRKcqQcdR+MoFBygntYOZytCqNfkd2ZC4ARDJ2DQqhjH5p85Nnd3jhUJIXrszFX/JA==" }, "@types/retry": { "version": "0.12.2", @@ -3583,11 +5159,18 @@ } }, "acorn": { - "version": "8.8.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.0.tgz", - "integrity": "sha512-QOxyigPVrpZ2GXT+PFyZTl6TtOFc5egxHIP9IlQ+RbupQuX4RkT/Bee4/kQuC02Xkzg84JcT7oLYtDIQxp+v7w==", + "version": "8.8.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.1.tgz", + "integrity": "sha512-7zFpHzhnqYKrkYdUjF1HI1bzd0VygEGX8lFk4k5zVMqHEoES+P+7TKI+EvLO9WVMJ8eekdO0aDEK044xTXwPPA==", "dev": true }, + "acorn-jsx": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "dev": true, + "requires": {} + }, "acorn-walk": { "version": "8.2.0", "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", @@ -3599,12 +5182,55 @@ "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-3.0.0.tgz", "integrity": "sha512-H7wUZRn8WpTq9jocdxQ2c8x2sKo9ZVmzfRE13GiNJXfp7NcKYEdvl3vspKjXox6RIG2VtaRe4JFvxG4rqp2Zuw==" }, + "agentkeepalive": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.2.1.tgz", + "integrity": "sha512-Zn4cw2NEqd+9fiSVWMscnjyQ1a8Yfoc5oBajLeo5w+YBHgDUcEBY2hS4YpTz6iN5f/2zQiktcuM6tS8x1p9dpA==", + "requires": { + "debug": "^4.1.0", + "depd": "^1.1.2", + "humanize-ms": "^1.2.1" + } + }, + "ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, + "requires": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + } + }, + "ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true + }, + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, "arg": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", "dev": true }, + "argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, "asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", @@ -3616,6 +5242,40 @@ "integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==", "peer": true }, + "available-typed-arrays": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz", + "integrity": "sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==" + }, + "aws-sdk": { + "version": "2.1283.0", + "resolved": "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.1283.0.tgz", + "integrity": "sha512-YlxTF0T9X8AcNrOzFPVOPnX1jNtHZjYHRUCfpsVwqdajHDGGruVsVppgBYXEiCRuTQNUhcJTUx0J0uKBhKQZIA==", + "requires": { + "buffer": "4.9.2", + "events": "1.1.1", + "ieee754": "1.1.13", + "jmespath": "0.16.0", + "querystring": "0.2.0", + "sax": "1.2.1", + "url": "0.10.3", + "util": "^0.12.4", + "uuid": "8.0.0", + "xml2js": "0.4.19" + }, + "dependencies": { + "buffer": { + "version": "4.9.2", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-4.9.2.tgz", + "integrity": "sha512-xq+q3SRMOxGivLhBNaUdC64hDTQwejJ+H0T/NB1XMtTVEwNTrfFF3gAxiyW0Bu/xWEGhjVKgUcMhCrUy2+uCWg==", + "requires": { + "base64-js": "^1.0.2", + "ieee754": "^1.1.4", + "isarray": "^1.0.0" + } + } + } + }, "axios": { "version": "0.27.2", "resolved": "https://registry.npmjs.org/axios/-/axios-0.27.2.tgz", @@ -3628,8 +5288,7 @@ "balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", - "peer": true + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" }, "base-x": { "version": "3.0.9", @@ -3658,9 +5317,9 @@ } }, "bignumber.js": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.1.0.tgz", - "integrity": "sha512-4LwHK4nfDOraBCtst+wOWIHbu1vhvAPJK8g8nROd4iuc3PSEjWif/qwbkh8jwCJz6yDBvtU4KPynETgrfh7y3A==" + "version": "9.1.1", + "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.1.1.tgz", + "integrity": "sha512-pHm4LsMJ6lzgNGVfZHjMoO8sdoRhOzOH4MLmY65Jg70bpxCKu5iOHNJyfF6OyvYw7t8Fpf35RuzUyqnQsj8Vig==" }, "bindings": { "version": "1.5.0", @@ -3694,7 +5353,6 @@ "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "peer": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -3714,12 +5372,19 @@ } }, "buffer": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", - "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.1.tgz", + "integrity": "sha512-rVAXBwEcEoYtxnHSO5iWyhzV/O1WMtkUYWlfdLS7FjU4PnSJJHEfHXi/uHPI5EwltmOA794gN3bm3/pzuctWjQ==", "requires": { "base64-js": "^1.3.1", "ieee754": "^1.2.1" + }, + "dependencies": { + "ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==" + } } }, "buffer-layout": { @@ -3728,19 +5393,59 @@ "integrity": "sha512-kWSuLN694+KTk8SrYvCqwP2WcgQjoRCiF5b4QDvkkz8EmgD+aWAIceGFKMIAdmF/pH+vpgNV3d3kAKorcdAmWA==" }, "bufferutil": { - "version": "4.0.6", - "resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.6.tgz", - "integrity": "sha512-jduaYOYtnio4aIAyc6UbvPCVcgq7nYpVnucyxr6eCYg/Woad9Hf/oxxBRDnGGjPfjUm6j5O/uBWhIu4iLebFaw==", + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.7.tgz", + "integrity": "sha512-kukuqc39WOHtdxtw4UScxF/WVnMFVSQVKhtx3AjZJzhd0RGZZldcrfSEbVsWWe6KNH253574cq5F+wpv0G9pJw==", "optional": true, "requires": { "node-gyp-build": "^4.3.0" } }, + "call-bind": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", + "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "requires": { + "function-bind": "^1.1.1", + "get-intrinsic": "^1.0.2" + } + }, + "callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true + }, "camelcase": { "version": "5.3.1", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==" }, + "chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, "colors": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz", @@ -3763,8 +5468,7 @@ "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", - "peer": true + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" }, "create-require": { "version": "1.1.1", @@ -3780,11 +5484,36 @@ "node-fetch": "2.6.7" } }, + "cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "requires": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + } + }, "crypto-hash": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/crypto-hash/-/crypto-hash-1.3.0.tgz", "integrity": "sha512-lyAZ0EMyjDkVvz8WOeVnuCPvKVBXcMv1l5SVqO1yC7PzTwrD/pPje/BIRbWhMoPe436U+Y2nD7f5bFx0kt+Sbg==" }, + "debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "requires": { + "ms": "2.1.2" + } + }, + "deep-is": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "dev": true + }, "delay": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/delay/-/delay-5.0.0.tgz", @@ -3795,12 +5524,26 @@ "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==" }, + "depd": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", + "integrity": "sha512-7emPTl6Dpo6JRXOXjLRxck+FlLRX5847cLKEn00PLAgc3g2hTZZgr+e4c2v6QpSmLeFP3n5yUo7ft6avBK/5jQ==" + }, "diff": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", "dev": true }, + "doctrine": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", + "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", + "dev": true, + "requires": { + "esutils": "^2.0.2" + } + }, "dot-case": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/dot-case/-/dot-case-3.0.4.tgz", @@ -3849,10 +5592,160 @@ "es6-promise": "^4.0.3" } }, + "escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true + }, + "eslint": { + "version": "8.32.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.32.0.tgz", + "integrity": "sha512-nETVXpnthqKPFyuY2FNjz/bEd6nbosRgKbkgS/y1C7LJop96gYHWpiguLecMHQ2XCPxn77DS0P+68WzG6vkZSQ==", + "dev": true, + "requires": { + "@eslint/eslintrc": "^1.4.1", + "@humanwhocodes/config-array": "^0.11.8", + "@humanwhocodes/module-importer": "^1.0.1", + "@nodelib/fs.walk": "^1.2.8", + "ajv": "^6.10.0", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.2", + "debug": "^4.3.2", + "doctrine": "^3.0.0", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^7.1.1", + "eslint-utils": "^3.0.0", + "eslint-visitor-keys": "^3.3.0", + "espree": "^9.4.0", + "esquery": "^1.4.0", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^6.0.1", + "find-up": "^5.0.0", + "glob-parent": "^6.0.2", + "globals": "^13.19.0", + "grapheme-splitter": "^1.0.4", + "ignore": "^5.2.0", + "import-fresh": "^3.0.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "is-path-inside": "^3.0.3", + "js-sdsl": "^4.1.4", + "js-yaml": "^4.1.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.4.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.1.2", + "natural-compare": "^1.4.0", + "optionator": "^0.9.1", + "regexpp": "^3.2.0", + "strip-ansi": "^6.0.1", + "strip-json-comments": "^3.1.0", + "text-table": "^0.2.0" + } + }, + "eslint-scope": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.1.1.tgz", + "integrity": "sha512-QKQM/UXpIiHcLqJ5AOyIW7XZmzjkzQXYE54n1++wb0u9V/abW3l9uQnxX8Z5Xd18xyKIMTUAyQ0k1e8pz6LUrw==", + "dev": true, + "requires": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + } + }, + "eslint-utils": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-3.0.0.tgz", + "integrity": "sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==", + "dev": true, + "requires": { + "eslint-visitor-keys": "^2.0.0" + }, + "dependencies": { + "eslint-visitor-keys": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", + "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", + "dev": true + } + } + }, + "eslint-visitor-keys": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz", + "integrity": "sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA==", + "dev": true + }, + "espree": { + "version": "9.4.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.4.1.tgz", + "integrity": "sha512-XwctdmTO6SIvCzd9810yyNzIrOrqNYV9Koizx4C/mRhf9uq0o4yHoCEU/670pOxOL/MSraektvSAji79kX90Vg==", + "dev": true, + "requires": { + "acorn": "^8.8.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^3.3.0" + } + }, + "esquery": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.4.0.tgz", + "integrity": "sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w==", + "dev": true, + "requires": { + "estraverse": "^5.1.0" + } + }, + "esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "requires": { + "estraverse": "^5.2.0" + } + }, + "estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true + }, + "esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true + }, + "ethereum-cryptography": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-1.1.2.tgz", + "integrity": "sha512-XDSJlg4BD+hq9N2FjvotwUET9Tfxpxc3kWGE2AqUG5vcbeunnbImVk3cj6e/xT3phdW21mE8R5IugU4fspQDcQ==", + "requires": { + "@noble/hashes": "1.1.2", + "@noble/secp256k1": "1.6.3", + "@scure/bip32": "1.1.0", + "@scure/bip39": "1.1.0" + }, + "dependencies": { + "@noble/hashes": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.1.2.tgz", + "integrity": "sha512-KYRCASVTv6aeUi1tsF8/vpyR7zpfs3FUzy2Jqm+MU+LmUKhQ0y2FpfwqkCcxSg2ua4GALJd8k2R76WxwZGbQpA==" + }, + "@noble/secp256k1": { + "version": "1.6.3", + "resolved": "https://registry.npmjs.org/@noble/secp256k1/-/secp256k1-1.6.3.tgz", + "integrity": "sha512-T04e4iTurVy7I8Sw4+c5OSN9/RkPlo1uKxAomtxQNLq8j1uPAqnsqG1bqvY3Jv7c13gyr6dui0zmh/I3+f/JaQ==" + } + } + }, "ethers": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/ethers/-/ethers-5.7.1.tgz", - "integrity": "sha512-5krze4dRLITX7FpU8J4WscXqADiKmyeNlylmmDLbS95DaZpBhDe2YSwRQwKXWNyXcox7a3gBgm/MkGXV1O1S/Q==", + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/ethers/-/ethers-5.7.2.tgz", + "integrity": "sha512-wswUsmWo1aOK8rR7DIKiWSw9DbLWe6x98Jrn8wcTflTVvaXhAMaB5zGAXy0GYQEQp9iO1iSHWVyARQm11zUtyg==", "requires": { "@ethersproject/abi": "5.7.0", "@ethersproject/abstract-provider": "5.7.0", @@ -3872,7 +5765,7 @@ "@ethersproject/networks": "5.7.1", "@ethersproject/pbkdf2": "5.7.0", "@ethersproject/properties": "5.7.0", - "@ethersproject/providers": "5.7.1", + "@ethersproject/providers": "5.7.2", "@ethersproject/random": "5.7.0", "@ethersproject/rlp": "5.7.0", "@ethersproject/sha2": "5.7.0", @@ -3891,6 +5784,11 @@ "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==" }, + "events": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/events/-/events-1.1.1.tgz", + "integrity": "sha512-kEcvvCBByWXGnZy6JUlgAp2gBIUjfCAV6P6TgT1/aaQKcmuAEC4OZTV1I4EWQLz2gxZw76atuVyvHhTxvi0Flw==" + }, "extract-files": { "version": "9.0.0", "resolved": "https://registry.npmjs.org/extract-files/-/extract-files-9.0.0.tgz", @@ -3901,11 +5799,47 @@ "resolved": "https://registry.npmjs.org/eyes/-/eyes-0.1.8.tgz", "integrity": "sha512-GipyPsXO1anza0AOZdy69Im7hGFCNB7Y/NGjDlZGJ3GJJLtwNSb2vrzYrTYJRrRloVx7pl+bhUaTB8yiccPvFQ==" }, + "fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true + }, + "fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true + }, + "fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", + "dev": true + }, "fast-stable-stringify": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fast-stable-stringify/-/fast-stable-stringify-1.0.0.tgz", "integrity": "sha512-wpYMUmFu5f00Sm0cj2pfivpmawLZ0NKdviQ4w9zJeR8JVtOpOxHmLaJuj0vxvGqMJQWyP/COUkF75/57OKyRag==" }, + "fastq": { + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.15.0.tgz", + "integrity": "sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==", + "dev": true, + "requires": { + "reusify": "^1.0.4" + } + }, + "file-entry-cache": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", + "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", + "dev": true, + "requires": { + "flat-cache": "^3.0.4" + } + }, "file-uri-to-path": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", @@ -3919,11 +5853,45 @@ "traverse-chain": "~0.1.0" } }, + "find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "requires": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + } + }, + "flat-cache": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz", + "integrity": "sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==", + "dev": true, + "requires": { + "flatted": "^3.1.0", + "rimraf": "^3.0.2" + } + }, + "flatted": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.7.tgz", + "integrity": "sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==", + "dev": true + }, "follow-redirects": { "version": "1.15.2", "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==" }, + "for-each": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", + "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", + "requires": { + "is-callable": "^1.1.3" + } + }, "form-data": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", @@ -3949,20 +5917,27 @@ "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", - "peer": true + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" }, "function-bind": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", - "peer": true + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" + }, + "get-intrinsic": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.3.tgz", + "integrity": "sha512-QJVz1Tj7MS099PevUG5jvnt9tSkXN8K14dxQlikJuPt4uD9hHAHjLyLBiLR5zELelBdD9QNRAXZzsJx0WaDL9A==", + "requires": { + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.3" + } }, "glob": { "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "peer": true, "requires": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", @@ -3972,17 +5947,48 @@ "path-is-absolute": "^1.0.0" } }, + "glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, + "requires": { + "is-glob": "^4.0.3" + } + }, + "globals": { + "version": "13.19.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.19.0.tgz", + "integrity": "sha512-dkQ957uSRWHw7CFXLUtUHQI3g3aWApYhfNR2O6jn/907riyTYKVBmxYVROkBcY614FSSeSJh7Xm7SrUWCxvJMQ==", + "dev": true, + "requires": { + "type-fest": "^0.20.2" + } + }, + "gopd": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", + "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", + "requires": { + "get-intrinsic": "^1.1.3" + } + }, "graceful-fs": { "version": "4.2.10", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", "peer": true }, + "grapheme-splitter": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz", + "integrity": "sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==", + "dev": true + }, "graphql": { "version": "16.6.0", "resolved": "https://registry.npmjs.org/graphql/-/graphql-16.6.0.tgz", - "integrity": "sha512-KPIBPDlW7NxrbT/eh4qPXz5FiFdL5UbaA0XUNz2Rp3Z3hqBSkbj0GVjwFDztsWVauZUWsbKHgMg++sk8UX0bkw==", - "peer": true + "integrity": "sha512-KPIBPDlW7NxrbT/eh4qPXz5FiFdL5UbaA0XUNz2Rp3Z3hqBSkbj0GVjwFDztsWVauZUWsbKHgMg++sk8UX0bkw==" }, "graphql-request": { "version": "4.3.0", @@ -4023,11 +6029,29 @@ "version": "1.0.3", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", - "peer": true, "requires": { "function-bind": "^1.1.1" } }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "has-symbols": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", + "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==" + }, + "has-tostringtag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.0.tgz", + "integrity": "sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==", + "requires": { + "has-symbols": "^1.0.2" + } + }, "hash.js": { "version": "1.1.7", "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", @@ -4052,16 +6076,53 @@ "minimalistic-crypto-utils": "^1.0.1" } }, - "ieee754": { + "hot-shots": { + "version": "9.3.0", + "resolved": "https://registry.npmjs.org/hot-shots/-/hot-shots-9.3.0.tgz", + "integrity": "sha512-e4tgWptiBvlIMnAX0ORe+dNEt0HznD+T2ckzXDUwCBsU7uWr2mwq5UtoT+Df5r9hD5S/DuP8rTxJUQvqAFSFKA==", + "requires": { + "unix-dgram": "2.x" + } + }, + "humanize-ms": { "version": "1.2.1", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", - "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==" + "resolved": "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz", + "integrity": "sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ==", + "requires": { + "ms": "^2.0.0" + } + }, + "ieee754": { + "version": "1.1.13", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.13.tgz", + "integrity": "sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg==" + }, + "ignore": { + "version": "5.2.4", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.4.tgz", + "integrity": "sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==", + "dev": true + }, + "import-fresh": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", + "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", + "dev": true, + "requires": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + } + }, + "imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", + "dev": true }, "inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", - "peer": true, "requires": { "once": "^1.3.0", "wrappy": "1" @@ -4078,15 +6139,81 @@ "integrity": "sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==", "peer": true }, + "is-arguments": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.1.tgz", + "integrity": "sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA==", + "requires": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + } + }, + "is-callable": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", + "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==" + }, "is-core-module": { - "version": "2.10.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.10.0.tgz", - "integrity": "sha512-Erxj2n/LDAZ7H8WNJXd9tw38GYM3dv8rk8Zcs+jJuxYTW7sozH+SS8NtrSjVL1/vpLvWi1hxy96IzjJ3EHTJJg==", + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.11.0.tgz", + "integrity": "sha512-RRjxlvLDkD1YJwDbroBHMb+cukurkDWNyHx7D3oNB5x9rb5ogcksMC5wHCadcXoo67gVr/+3GFySh3134zi6rw==", "peer": true, "requires": { "has": "^1.0.3" } }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true + }, + "is-generator-function": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.10.tgz", + "integrity": "sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A==", + "requires": { + "has-tostringtag": "^1.0.0" + } + }, + "is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "requires": { + "is-extglob": "^2.1.1" + } + }, + "is-path-inside": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", + "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", + "dev": true + }, + "is-typed-array": { + "version": "1.1.10", + "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.10.tgz", + "integrity": "sha512-PJqgEHiWZvMpaFZ3uTc8kHPM4+4ADTlDniuQL7cU/UDA0Ql7F70yGfHph3cLNe+c9toaigv+DFzTJKhc2CtO6A==", + "requires": { + "available-typed-arrays": "^1.0.5", + "call-bind": "^1.0.2", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "has-tostringtag": "^1.0.0" + } + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==" + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true + }, "isomorphic-fetch": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/isomorphic-fetch/-/isomorphic-fetch-3.0.0.tgz", @@ -4126,9 +6253,25 @@ "version": "12.20.55", "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.55.tgz", "integrity": "sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==" + }, + "uuid": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==" } } }, + "jmespath": { + "version": "0.16.0", + "resolved": "https://registry.npmjs.org/jmespath/-/jmespath-0.16.0.tgz", + "integrity": "sha512-9FzQjJ7MATs1tSpnco1K6ayiYE3figslrXA72G2HQ/n76RzvYlofyi5QM+iX4YRs/pu3yzxlVQSST23+dMDknw==" + }, + "js-sdsl": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/js-sdsl/-/js-sdsl-4.2.0.tgz", + "integrity": "sha512-dyBIzQBDkCqCu+0upx25Y2jGdbTGxE9fshMsCdK0ViOongpV+n5tXRcZY9v7CaVQ79AGS9KA1KHtojxiM7aXSQ==", + "dev": true + }, "js-sha256": { "version": "0.9.0", "resolved": "https://registry.npmjs.org/js-sha256/-/js-sha256-0.9.0.tgz", @@ -4144,11 +6287,40 @@ "resolved": "https://registry.npmjs.org/js-sha512/-/js-sha512-0.8.0.tgz", "integrity": "sha512-PWsmefG6Jkodqt+ePTvBZCSMFgN7Clckjd0O7su3I0+BW2QWUTJNzjktHsztGLhncP2h8mcF9V9Y2Ha59pAViQ==" }, + "js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dev": true, + "requires": { + "argparse": "^2.0.1" + } + }, "jsbi": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/jsbi/-/jsbi-4.3.0.tgz", "integrity": "sha512-SnZNcinB4RIcnEyZqFPdGPVgrg2AcnykiBy0sHVJQKHYeaLUvi3Exj+iaPpLnFVkDPZIV4U0yvgC9/R4uEAZ9g==" }, + "json-bigint": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-bigint/-/json-bigint-1.0.0.tgz", + "integrity": "sha512-SiPv/8VpZuWbvLSMtTDU8hEfrZWg/mH/nV/b4o0CYbSxu1UIQPLdwKOCIyLQX+VIPO5vrLX3i8qtqFyhdPSUSQ==", + "requires": { + "bignumber.js": "^9.0.0" + } + }, + "json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true + }, + "json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", + "dev": true + }, "json-stringify-safe": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", @@ -4189,6 +6361,16 @@ "resolved": "https://registry.npmjs.org/just-performance/-/just-performance-4.3.0.tgz", "integrity": "sha512-L7RjvtJsL0QO8xFs5wEoDDzzJwoiowRw6Rn/GnvldlchS2JQr9wFYPiwZcDfrbbujEKqKN0tvENdbjXdYhDp5Q==" }, + "levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "requires": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + } + }, "limiter": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/limiter/-/limiter-2.1.0.tgz", @@ -4197,11 +6379,26 @@ "just-performance": "4.3.0" } }, + "locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "requires": { + "p-locate": "^5.0.0" + } + }, "lodash": { "version": "4.17.21", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" }, + "lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", + "dev": true + }, "lower-case": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/lower-case/-/lower-case-2.0.2.tgz", @@ -4255,17 +6452,33 @@ "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "peer": true, "requires": { "brace-expansion": "^1.1.7" } }, "minimist": { - "version": "1.2.6", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", - "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==", + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.7.tgz", + "integrity": "sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g==", "peer": true }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "nan": { + "version": "2.17.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.17.0.tgz", + "integrity": "sha512-2ZTgtl0nJsO0KQCjEpxcIr5D+Yv90plTitZt9JBfQvVJDS5seMl3FOvsh3+9CoYWXf/1l5OaZzzF6nDm4cagaQ==", + "optional": true + }, + "natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", + "dev": true + }, "neo-async": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", @@ -4299,21 +6512,72 @@ "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", - "peer": true, "requires": { "wrappy": "1" } }, + "optionator": { + "version": "0.9.1", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", + "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==", + "dev": true, + "requires": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.3" + } + }, + "p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "requires": { + "yocto-queue": "^0.1.0" + } + }, + "p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "requires": { + "p-limit": "^3.0.2" + } + }, "pako": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/pako/-/pako-2.0.4.tgz", - "integrity": "sha512-v8tweI900AUkZN6heMU/4Uy4cXRc2AYNRggVmTR+dEncawDJgCdLMximOVA2p4qO57WMynangsfGRb5WD6L1Bg==" + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/pako/-/pako-2.1.0.tgz", + "integrity": "sha512-w+eufiZ1WuJYgPXbV/PO3NCMEc3xqylkKHzp8bxp1uW4qaSNQUkwmLLEc3kKsfz8lpV1F8Ht3U1Cm+9Srog2ug==" + }, + "parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "requires": { + "callsites": "^3.0.0" + } + }, + "path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true }, "path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", - "peer": true + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==" + }, + "path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true }, "path-parse": { "version": "1.0.7", @@ -4321,12 +6585,34 @@ "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", "peer": true }, + "prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true + }, "progress": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", "peer": true }, + "punycode": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz", + "integrity": "sha512-RofWgt/7fL5wP1Y7fxE7/EmTLzQVnB0ycyibJ0OOHIlJqTNzglYFxVwETOcIoJqJmpDXJ9xImDv+Fq34F/d4Dw==" + }, + "querystring": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz", + "integrity": "sha512-X/xY82scca2tau62i9mDyU9K+I+djTMUsvwf7xnUX5GLvVzgJybOJf4Y6o9Zx3oJK/LSXg5tTZBjwzqVPaPO2g==" + }, + "queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true + }, "rechoir": { "version": "0.6.2", "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", @@ -4337,9 +6623,15 @@ } }, "regenerator-runtime": { - "version": "0.13.9", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.9.tgz", - "integrity": "sha512-p3VT+cOEgxFsRRA9X4lkI1E+k2/CtnKtU4gcxyaCUreilL/vqI6CdZ3wxVUx3UOUg+gnUOQQcRI7BmSI656MYA==" + "version": "0.13.11", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz", + "integrity": "sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==" + }, + "regexpp": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz", + "integrity": "sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==", + "dev": true }, "resolve": { "version": "1.22.1", @@ -4352,6 +6644,27 @@ "supports-preserve-symlinks-flag": "^1.0.0" } }, + "resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true + }, + "reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "dev": true + }, + "rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + }, "rpc-websockets": { "version": "7.5.0", "resolved": "https://registry.npmjs.org/rpc-websockets/-/rpc-websockets-7.5.0.tgz", @@ -4365,24 +6678,58 @@ "ws": "^8.5.0" }, "dependencies": { + "uuid": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==" + }, "ws": { - "version": "8.9.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.9.0.tgz", - "integrity": "sha512-Ja7nszREasGaYUYCI2k4lCKIRTt+y7XuqVoHR44YpI49TtryyqbqvDMn5eqfW7e6HzTukDRIsXqzVHScqRcafg==", + "version": "8.11.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.11.0.tgz", + "integrity": "sha512-HPG3wQd9sNQoT9xHyNCXoDUa+Xw/VevmY9FoHyQ+g+rrMn4j6FB4np7Z0OhdTgjx6MgQLK7jwSy1YecU1+4Asg==", "requires": {} } } }, + "run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "requires": { + "queue-microtask": "^1.2.2" + } + }, "safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" }, + "sax": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.1.tgz", + "integrity": "sha512-8I2a3LovHTOpm7NV5yOyO8IHqgVsfK4+UuySrXU8YXkSRX7k6hCV9b3HrkKCr3nMpgj+0bmocaJJWpvp1oc7ZA==" + }, "scrypt-js": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/scrypt-js/-/scrypt-js-3.0.1.tgz", "integrity": "sha512-cdwTTnqPu0Hyvf5in5asVdZocVDTNRmR7XEcJuIzMjJeSHybHl7vpB66AzwTaIg6CLSbtjcxc8fqcySfnTkccA==" }, + "shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "requires": { + "shebang-regex": "^3.0.0" + } + }, + "shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true + }, "shelljs": { "version": "0.8.5", "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.5.tgz", @@ -4420,11 +6767,53 @@ "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", "peer": true }, + "starknet": { + "version": "4.17.1", + "resolved": "https://registry.npmjs.org/starknet/-/starknet-4.17.1.tgz", + "integrity": "sha512-xihdf+pWUCdKK30r+fNLfg+5RHHpTNw20gvrucbcPPDnsDr2bjwtFu3UjXOtHnbys6qF8fW3ttMkctRoQ5J6Xg==", + "requires": { + "@ethersproject/bytes": "^5.6.1", + "bn.js": "^5.2.1", + "elliptic": "^6.5.4", + "ethereum-cryptography": "^1.0.3", + "hash.js": "^1.1.7", + "isomorphic-fetch": "^3.0.0", + "json-bigint": "^1.0.0", + "minimalistic-assert": "^1.0.1", + "pako": "^2.0.4", + "ts-custom-error": "^3.3.1", + "url-join": "^4.0.1" + } + }, + "strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "requires": { + "ansi-regex": "5.0.1" + } + }, + "strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true + }, "superstruct": { "version": "0.15.5", "resolved": "https://registry.npmjs.org/superstruct/-/superstruct-0.15.5.tgz", "integrity": "sha512-4AOeU+P5UuE/4nOUkmcQdW5y7i9ndt1cQd/3iUe+LTz3RxESf/W/5lg4B74HbDMMv8PHnPnGCQFH45kBcrQYoQ==" }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + }, "supports-preserve-symlinks-flag": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", @@ -4436,6 +6825,12 @@ "resolved": "https://registry.npmjs.org/text-encoding-utf-8/-/text-encoding-utf-8-1.0.2.tgz", "integrity": "sha512-8bw4MY9WjdsD2aMtO0OzOCY3pXGYNx2d2FfHRVUKkiCPDWjKuOlhLVASS+pD7VkLTVjW268LYJHwsnPFlBpbAg==" }, + "text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", + "dev": true + }, "through": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", @@ -4457,9 +6852,14 @@ "integrity": "sha512-up6Yvai4PYKhpNp5PkYtx50m3KbwQrqDwbuZP/ItyL64YEWHAvH6Md83LFLV/GRSk/BoUVwwgUzX6SOQSbsfAg==" }, "tron-format-address": { - "version": "0.1.8", - "resolved": "https://registry.npmjs.org/tron-format-address/-/tron-format-address-0.1.8.tgz", - "integrity": "sha512-oTtzUM43OZhQiv1p2aOVqbnev6mmJHXQrMpS3nn7zVAI/+ffA/aF+Y/vugHtYotckkromRLPEl/SR1HfJjAYQA==" + "version": "0.1.11", + "resolved": "https://registry.npmjs.org/tron-format-address/-/tron-format-address-0.1.11.tgz", + "integrity": "sha512-Jx2i3R1yXrEMQsfc2jueAI71ivnySzdeva6SiSM/pddwj8TK7PVABSP6s/iYcTRI63GxJEgGMmOJXNNKoBmbQw==" + }, + "ts-custom-error": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/ts-custom-error/-/ts-custom-error-3.3.1.tgz", + "integrity": "sha512-5OX1tzOjxWEgsr/YEUWSuPrQ00deKLh6D7OTWcvNHm12/7QPyRh8SYpyWvA4IZv8H/+GQWQEh/kwo95Q9OVW1A==" }, "ts-node": { "version": "10.9.1", @@ -4483,9 +6883,24 @@ } }, "tslib": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz", - "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==" + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.1.tgz", + "integrity": "sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==" + }, + "type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "requires": { + "prelude-ls": "^1.2.1" + } + }, + "type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "dev": true }, "typedoc-default-themes": { "version": "0.12.10", @@ -4494,14 +6909,14 @@ "peer": true }, "typescript": { - "version": "4.8.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.4.tgz", - "integrity": "sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ==" + "version": "4.9.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.4.tgz", + "integrity": "sha512-Uz+dTXYzxXXbsFpM86Wh3dKCxrQqUcVMxwU54orwlJjOpO3ao8L7j5lH+dWfTwgCwIuM9GQ2kvVotzYJMXTBZg==" }, "uglify-js": { - "version": "3.17.2", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.17.2.tgz", - "integrity": "sha512-bbxglRjsGQMchfvXZNusUcYgiB9Hx2K4AHYXQy2DITZ9Rd+JzhX7+hoocE5Winr7z2oHvPsekkBwXtigvxevXg==", + "version": "3.17.4", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.17.4.tgz", + "integrity": "sha512-T9q82TJI9e/C1TAxYvfb16xO120tMVFZrGA3f9/P4424DNu6ypK103y0GPFVa17yotwSyZW5iYXgjYHkGrJW/g==", "optional": true, "peer": true }, @@ -4511,19 +6926,72 @@ "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==", "peer": true }, + "unix-dgram": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/unix-dgram/-/unix-dgram-2.0.6.tgz", + "integrity": "sha512-AURroAsb73BZ6CdAyMrTk/hYKNj3DuYYEuOaB8bYMOHGKupRNScw90Q5C71tWJc3uE7dIeXRyuwN0xLLq3vDTg==", + "optional": true, + "requires": { + "bindings": "^1.5.0", + "nan": "^2.16.0" + } + }, + "uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, + "requires": { + "punycode": "^2.1.0" + }, + "dependencies": { + "punycode": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.2.0.tgz", + "integrity": "sha512-LN6QV1IJ9ZhxWTNdktaPClrNfp8xdSAYS0Zk2ddX7XsXZAxckMHPCBcHRo0cTcEIgYPRiGEkmji3Idkh2yFtYw==", + "dev": true + } + } + }, + "url": { + "version": "0.10.3", + "resolved": "https://registry.npmjs.org/url/-/url-0.10.3.tgz", + "integrity": "sha512-hzSUW2q06EqL1gKM/a+obYHLIO6ct2hwPuviqTTOcfFVc61UbfJ2Q32+uGL/HCPxKqrdGB5QUwIe7UqlDgwsOQ==", + "requires": { + "punycode": "1.3.2", + "querystring": "0.2.0" + } + }, + "url-join": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/url-join/-/url-join-4.0.1.tgz", + "integrity": "sha512-jk1+QP6ZJqyOiuEI9AEWQfju/nB2Pw466kbA0LEZljHwKeMgd9WrAEgEGxjPDD2+TNbbb37rTyhEfrCXfuKXnA==" + }, "utf-8-validate": { - "version": "5.0.9", - "resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.9.tgz", - "integrity": "sha512-Yek7dAy0v3Kl0orwMlvi7TPtiCNrdfHNd7Gcc/pLq4BLXqfAmd0J7OWMizUQnTTJsyjKn02mU7anqwfmUP4J8Q==", + "version": "5.0.10", + "resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.10.tgz", + "integrity": "sha512-Z6czzLq4u8fPOyx7TU6X3dvUZVvoJmxSQ+IcrlmagKhilxlhZgxPK6C5Jqbkw1IDUmFTM+cz9QDnnLTwDz/2gQ==", "optional": true, "requires": { "node-gyp-build": "^4.3.0" } }, + "util": { + "version": "0.12.5", + "resolved": "https://registry.npmjs.org/util/-/util-0.12.5.tgz", + "integrity": "sha512-kZf/K6hEIrWHI6XqOFUiiMa+79wE/D8Q+NCNAWclkyg3b4d2k7s0QGepNjiABc+aR3N1PAyHL7p6UcLY6LmrnA==", + "requires": { + "inherits": "^2.0.3", + "is-arguments": "^1.0.4", + "is-generator-function": "^1.0.7", + "is-typed-array": "^1.1.3", + "which-typed-array": "^1.1.2" + } + }, "uuid": { - "version": "8.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", - "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==" + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.0.0.tgz", + "integrity": "sha512-jOXGuXZAWdsTH7eZLtyXMqUb9EcWMGZNbL9YcGBJl4MH4nrxHmZJhEHvyLFrkxo+28uLb/NYRcStH48fnD0Vzw==" }, "v8-compile-cache-lib": { "version": "3.0.1", @@ -4532,9 +7000,9 @@ "dev": true }, "vscode-oniguruma": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/vscode-oniguruma/-/vscode-oniguruma-1.6.2.tgz", - "integrity": "sha512-KH8+KKov5eS/9WhofZR8M8dMHWN2gTxjMsG4jd04YhpbPR91fUj7rYQ2/XjeHCJWbg7X++ApRIU9NUwM2vTvLA==", + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/vscode-oniguruma/-/vscode-oniguruma-1.7.0.tgz", + "integrity": "sha512-L9WMGRfrjOhgHSdOYgCt/yRMsXzLDJSL7BPrOZt73gU0iWO4mpqzqQzOz5srxqTvMBaR0XZTSrVWo4j55Rc6cA==", "peer": true }, "vscode-textmate": { @@ -4562,6 +7030,34 @@ "webidl-conversions": "^3.0.0" } }, + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + }, + "which-typed-array": { + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.9.tgz", + "integrity": "sha512-w9c4xkx6mPidwp7180ckYWfMmvxpjlZuIudNtDf4N/tTAUB8VJbX25qZoAsrtGuYNnGw3pa0AXgbGKRB8/EceA==", + "requires": { + "available-typed-arrays": "^1.0.5", + "call-bind": "^1.0.2", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "has-tostringtag": "^1.0.0", + "is-typed-array": "^1.1.10" + } + }, + "word-wrap": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", + "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", + "dev": true + }, "wordwrap": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", @@ -4571,8 +7067,7 @@ "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", - "peer": true + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" }, "ws": { "version": "7.4.6", @@ -4580,11 +7075,31 @@ "integrity": "sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A==", "requires": {} }, + "xml2js": { + "version": "0.4.19", + "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.19.tgz", + "integrity": "sha512-esZnJZJOiJR9wWKMyuvSE1y6Dq5LCuJanqhxslH2bxM6duahNZ+HMpCLhBQGZkbX6xRf8x1Y2eJlgt2q3qo49Q==", + "requires": { + "sax": ">=0.6.0", + "xmlbuilder": "~9.0.1" + } + }, + "xmlbuilder": { + "version": "9.0.7", + "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-9.0.7.tgz", + "integrity": "sha512-7YXTQc3P2l9+0rjaUbLwMKRhtmwg1M1eDf6nag7urC7pIPYLD9W/jmzQ4ptRSUbodw5S0jfoGTflLemQibSpeQ==" + }, "yn": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", "dev": true + }, + "yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true } } } diff --git a/package.json b/package.json index ff592f473d6..20f3e822308 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,8 @@ "test": "echo \"Error: no test specified\" && exit 1", "weeklyChanges": "git pull && git diff $(git log -1 --before=@{7.days.ago} --format=%H) --stat | grep -E \"projects/\" | cut -d / -f 2 | cut -d \" \" -f 1 | uniq | wc -l", "dev": "babel-watch curve.js", + "lint": "eslint .", + "eslint:github-action": "eslint .", "test-interactive": "node utils/testInteractive", "postinstall": "echo 'run \"npm update @defillama/sdk\" if you want lastest sdk changes' " }, @@ -18,17 +20,20 @@ "@solana/web3.js": "^1.36.0", "@solendprotocol/solend-sdk": "^0.6.2", "@supercharge/promise-pool": "^2.1.0", - "axios": "^0.27.0", + "aws-sdk": "^2.1268.0", + "axios": "^0.27.2", "bignumber.js": "^9.0.1", "blakejs": "^1.2.1", "bn.js": "^5.2.1", "borsh": "^0.7.0", "dotenv": "^8.6.0", "ethers": "^5.6.5", + "graphql": "^16.6.0", "graphql-request": "^4.0.0", "hi-base32": "^0.5.1", "js-sha512": "^0.8.0", "limiter": "2.1.0", + "starknet": "^4.17.1", "tron-format-address": "^0.1.8", "typescript": "^4.7.4" }, @@ -45,6 +50,7 @@ "devDependencies": { "@types/async-retry": "^1.4.5", "@types/bn.js": "^5.1.0", + "eslint": "^8.32.0", "ts-node": "^10.8.1" } } diff --git a/pull_request_template.md b/pull_request_template.md index 334db19cdc6..4f4ead273d1 100644 --- a/pull_request_template.md +++ b/pull_request_template.md @@ -1,13 +1,15 @@ **NOTE** -> If you would like to add a `volume` adapter please submit the PR [here](https://github.com/DefiLlama/adapters). +> - If you would like to add a `volume` adapter please submit the PR [here](https://github.com/DefiLlama/adapters). +> - If you would like to add a `liquidations` adapter, please refer to [this readme document](https://github.com/DefiLlama/DefiLlama-Adapters/tree/main/liquidations) for details. -1. Sorry, We no longer accept fetch adapter for new projects, we prefer the tvl to computed from blockchain data, if you have trouble with creating a the adapter, please hop onto our discord, we are happy to assist you. -2. The protocol is usually listed within 24 hours of merging the PR -3. Please fill the form below **only if the PR is for listing a new protocol** else it can be ignored/replaced with reason/details about the PR -4. **For updating listing info** It is a different repo, you can find your listing in this file: https://github.com/DefiLlama/defillama-server/blob/master/defi/src/protocols/data2.ts, you can edit it there and put up a PR -5. Do not edit/push `package-lock.json` file as part of your changes, we use lockfileVersion 2, and most use v1 and using that messes up our CI -6. No need to go to our discord and announce that you've created a PR, we monitor all PRs and will review it asap +1. Once your adapter has been merged, it takes time to show on the UI. If more than 24 hours have passed, please let us know in Discord. +2. Please enable "Allow edits by maintainers" while putting up the PR. +3. Sorry, We no longer accept fetch adapter for new projects, we prefer the tvl to computed from blockchain data, if you have trouble with creating a the adapter, please hop onto our discord, we are happy to assist you. +4. Please fill the form below **only if the PR is for listing a new protocol** else it can be ignored/replaced with reason/details about the PR +5. **For updating listing info** It is a different repo, you can find your listing in this file: https://github.com/DefiLlama/defillama-server/blob/master/defi/src/protocols/data2.ts, you can edit it there and put up a PR +6. Do not edit/push `package-lock.json` file as part of your changes, we use lockfileVersion 2, and most use v1 and using that messes up our CI +7. No need to go to our discord and announce that you've created a PR, we monitor all PRs and will review it asap --- ##### Name (to be shown on DefiLlama): @@ -22,19 +24,22 @@ ##### Website Link: -##### Logo (High resolution, preferably in .svg and .png, for application on both white and black backgrounds. Will be shown with rounded borders): +##### Logo (High resolution, will be shown with rounded borders): ##### Current TVL: +##### Treasury Addresses (if the protocol has treasury) + + ##### Chain: -##### Coingecko ID (so your TVL can appear on Coingecko): (https://api.coingecko.com/api/v3/coins/list) +##### Coingecko ID (so your TVL can appear on Coingecko, leave empty if not listed): (https://api.coingecko.com/api/v3/coins/list) -##### Coinmarketcap ID (so your TVL can appear on Coinmarketcap): (https://api.coinmarketcap.com/data-api/v3/map/all?listing_status=active,inactive,untracked&start=1&limit=10000) +##### Coinmarketcap ID (so your TVL can appear on Coinmarketcap, leave empty if not listed): (https://api.coinmarketcap.com/data-api/v3/map/all?listing_status=active,inactive,untracked&start=1&limit=10000) ##### Short Description (to be shown on DefiLlama): @@ -54,3 +59,5 @@ ##### methodology (what is being counted as tvl, how is tvl being calculated): + +##### Github org/user (Optional, if your code is open source, we can track activity): \ No newline at end of file diff --git a/test.js b/test.js index d65d312cdff..c2c793a6d88 100644 --- a/test.js +++ b/test.js @@ -11,6 +11,7 @@ const whitelistedExportKeys = require('./projects/helper/whitelistedExportKeys.j const chainList = require('./projects/helper/chains.json') const handleError = require('./utils/handleError') const { log, diplayUnknownTable, sliceIntoChunks } = require('./projects/helper/utils') +const { normalizeAddress } = require('./projects/helper/tokenMapping') const { PromisePool } = require('@supercharge/promise-pool') const locks = []; @@ -45,7 +46,11 @@ async function getTvl( knownTokenPrices ) { if (!isFetchFunction) { - const tvlBalances = await tvlFunction(unixTimestamp, ethBlock, chainBlocks); + const chain = storedKey.split('-')[0] + const block = chainBlocks[chain] + const api = new sdk.ChainApi({ chain, block: chainBlocks[chain], timestamp: unixTimestamp, }) + let tvlBalances = await tvlFunction(unixTimestamp, ethBlock, chainBlocks, { api, chain, block, storedKey }); + if (!tvlBalances && Object.keys(api.getBalances()).length) tvlBalances = api.getBalances() const tvlResults = await computeTVL( tvlBalances, "now", @@ -229,7 +234,10 @@ function checkExportKeys(module, filePath, chains) { if (filePath.length > 2 || (filePath.length === 1 && !['.js', ''].includes(path.extname(filePath[0]))) // matches .../projects/projectXYZ.js or .../projects/projectXYZ - || (filePath.length === 2 && !['api.js', 'index.js', 'apiCache.js', ].includes(filePath[1]))) // matches .../projects/projectXYZ/index.js + || (filePath.length === 2 && + !(['api.js', 'index.js', 'apiCache.js',].includes(filePath[1]) // matches .../projects/projectXYZ/index.js + || ['treasury', 'entities'].includes(filePath[0]) // matches .../projects/treasury/project.js + ))) process.exit(0) const blacklistedRootExportKeys = ['tvl', 'staking', 'pool2', 'borrowed', 'treasury', 'offers', 'vesting']; @@ -318,15 +326,12 @@ async function computeTVL(balances, timestamp) { fixBalances(balances) Object.keys(balances).map(k => { - if (+balances[k] === 0) { - delete balances[k] - return; - } - if (k.toLowerCase() === k) return; - balances[k.toLowerCase()] = (k.toLowerCase() in balances) - ? Number(balances[k.toLowerCase()]) - + Number(balances[k]) : balances[k]; + const balance = balances[k] delete balances[k] + if (+balance === 0) + return; + const normalizedAddress = normalizeAddress(k, undefined, true) + sdk.util.sumSingleBalance(balances, normalizedAddress, balance) }) const eth = balances[ethereumAddress]; @@ -338,7 +343,7 @@ async function computeTVL(balances, timestamp) { const PKsToTokens = {}; const readKeys = Object.keys(balances) .map((address) => { - const PK = `${timestamp === "now" ? "" : "asset#"}${address.toLowerCase()}`; + const PK = address; if (PKsToTokens[PK] === undefined) { PKsToTokens[PK] = [address]; return PK; @@ -349,16 +354,14 @@ async function computeTVL(balances, timestamp) { }) .filter((item) => item !== undefined); - const burl = "https://coins.llama.fi/prices/current/"; const unknownTokens = {} let tokenData = [] readKeys.forEach(i => unknownTokens[i] = true) const { errors } = await PromisePool.withConcurrency(5) - .for(sliceIntoChunks(readKeys, 40)) + .for(sliceIntoChunks(readKeys, 100)) .process(async (keys) => { - const coins = keys.reduce((p, c) => p + `${c},`, ""); - tokenData.push((await axios.get(`${burl}${coins}`)).data.coins) + tokenData.push((await axios.get(`https://coins.llama.fi/prices/current/${keys.join(',')}`)).data.coins) }) if (errors && errors.length) @@ -376,6 +379,10 @@ async function computeTVL(balances, timestamp) { if (data == undefined) tokenBalances[`UNKNOWN (${address})`] = balance if ('confidence' in data && data.confidence < confidenceThreshold) return + if (Math.abs(data.timestamp - Date.now() / 1e3) > (24 * 3600)) { + console.log(`Price for ${address} is stale, ignoring...`) + return + } let amount, usdAmount; if (address.includes(":") && !address.startsWith("coingecko:")) { @@ -385,6 +392,13 @@ async function computeTVL(balances, timestamp) { amount = Number(balance); usdAmount = amount * data.price; } + + if (usdAmount > 1e8) { + console.log(`------------------- +Warning: `) + console.log(`Token ${address} has more than 100M in value (${usdAmount / 1e6} M) , price data: `, data) + console.log(`-------------------`) + } tokenBalances[data.symbol] = (tokenBalances[data.symbol] ?? 0) + amount; usdTokenBalances[data.symbol] = (usdTokenBalances[data.symbol] ?? 0) + usdAmount; usdTvl += usdAmount; @@ -393,6 +407,10 @@ async function computeTVL(balances, timestamp) { Object.keys(unknownTokens).forEach(address => tokenBalances[`UNKNOWN (${address})`] = balances[address]) + + // console.log('--------token balances-------') + // console.table(tokenBalances) + return { usdTvl, tokenBalances, From da84bb770f84ebe97a8491a239f054a2be4160e4 Mon Sep 17 00:00:00 2001 From: power-f-god Date: Thu, 3 Aug 2023 11:48:07 +0100 Subject: [PATCH 0647/1974] chore: Sync `projects`. --- projects/01/index.js | 7 +- projects/0vix/index.js | 11 +- projects/0x0dex/index.js | 7 + projects/0xDAO/erc20.json | 255 +- projects/0xDAO/index.js | 23 +- projects/0xDAO/oxLens.json | 93 +- projects/0xDAO/solidlyLens.json | 52 +- projects/0xDAO/ve.json | 13 +- projects/0x_nodes/index.js | 13 +- projects/0xacid/index.js | 12 + projects/10kswap/abi.js | 87 + projects/10kswap/api.js | 38 + projects/10kswap/index.js | 1 + projects/1bch/index.js | 7 +- projects/1beam/abi.json | 32 +- projects/1beam/index.js | 4 +- projects/1beam/utils.js | 7 +- projects/1inch/api.js | 8 +- projects/1inch/apiCache.js | 67 +- projects/1inch/config.js | 36 +- projects/1pulse/index.js | 12 + projects/1swap/abi-moonriver.json | 30 +- projects/1swap/index.js | 93 +- projects/2doge/index.js | 5 +- projects/2omb-finance/abi.json | 54 +- projects/2pi/archimedes.json | 76 +- projects/2pi/index.js | 8 +- projects/3xcalibur/index.js | 4 +- projects/88mph/abi.json | 73 - projects/88mph/index.js | 195 +- projects/ABCDEFX/index.js | 12 + projects/ArbiTen/contracts.json | 9 + projects/ArbiTen/index.js | 15 + projects/ArbitrumExchange/index.js | 17 + .../ArchimedesFinance/archimedesVaultAbi.json | 3 + projects/ArchimedesFinance/curvePoolAbi.json | 4 + projects/ArchimedesFinance/index.js | 25 + projects/AstroFi/index.js | 17 + projects/AxiaProtocol/index.js | 184 +- projects/BankOfCronos/index.js | 17 + projects/BankofCronos-Loans/index.js | 17 + projects/BombFinance/index.js | 11 +- projects/Caketomb/index.js | 2 - projects/ChirpFinance/index.js | 10 + projects/ColaFactory/index.js | 11 + projects/CollectifDAO/index.js | 18 + projects/CthulhuFinance/index.js | 29 + projects/DerpDEX/index.js | 8 + projects/DogeShrek/index.js | 1 - projects/E3/index.js | 36 + projects/El-Dorado-Exchange/index.js | 34 + projects/ElonSwap/index.js | 1 - projects/Equalizer/index.js | 3 +- projects/FlashLiquidity/index.js | 23 + projects/GotchiVault/abi.json | 27 +- projects/GotchiVault/index.js | 6 +- projects/Guru/index.js | 78 +- projects/HoneyFarm/index.js | 8 +- projects/IgnoreFUD/index.js | 18 + projects/KungFuu-Finance/index.js | 5 +- projects/Kwikswap/index.js | 5 - projects/KyborgExchange/index.js | 23 + projects/LFIswap/index.js | 1 - projects/Liquify/index.js | 12 + projects/Lockless/index.js | 19 + projects/MFIL/index.js | 18 + projects/MantisSwap/index.js | 26 + projects/MellowProtocol/index.js | 56 + projects/MineFi/index.js | 24 + projects/MultiSwap/index.js | 38 +- projects/MyTrade/index.js | 53 +- projects/OCTOplace/index.js | 13 + projects/OT/index.js | 15 + projects/Paraluni/index.js | 174 +- projects/PlsPrint/index.js | 18 + projects/PowSea/index.js | 1 - .../RealProtocol/getEntireSystemColl.abi.json | 13 - projects/RealProtocol/index.js | 9 +- projects/Revoluzion/index.js | 5 + projects/SharpeLabs/index.js | 27 + projects/Shibafantom/index.js | 11 +- projects/SmarDex/index.js | 18 + projects/Solily/index.js | 99 +- projects/SweetSwap/index.js | 3 - projects/TokenPocket/index.js | 12 + projects/Torr-Finance/index.js | 5 + projects/TronNRG/index.js | 28 + projects/VAX/index.js | 1 - projects/Velocimeter/index.js | 18 + projects/YieldPulseFinance/index.js | 10 + projects/YogurtFinance/index.js | 10 + projects/Zolidly/index.js | 16 + projects/ZukeSwap/index.js | 14 + projects/aada/index.js | 59 +- projects/aave/index.js | 17 +- projects/aave/v1.js | 11 +- projects/aave/v3.js | 40 +- projects/aavegotchi/index.js | 10 +- projects/abc-pool/index.js | 57 + projects/abelfinance/index.js | 50 + projects/aboard-exchange/index.js | 42 + projects/abracadabra/abi.json | 25 +- projects/abracadabra/index.js | 72 +- projects/abracadabra/market.json | 96 +- projects/acala-lending/index.js | 4 + projects/acoconut/abis/singlePlus.json | 30 +- projects/acoconut/index.js | 5 +- projects/across/abi.json | 59 +- projects/across/index.js | 23 +- projects/acryptos/index.js | 9 + projects/acumen/index.js | 31 +- projects/ad-astra/index.js | 11 + projects/adamantfinance/abi.json | 120 +- projects/adamantfinance/index.js | 258 +- projects/adao/abi.json | 17 - projects/adao/index.js | 3 +- projects/adaswap/index.js | 10 + projects/adenafinance/index.js | 2 +- projects/aelin/abi.json | 4 - projects/aelin/index.js | 104 +- projects/aequinox/index.js | 40 +- projects/aerie/index.js | 27 + projects/aevo-xyz/index.js | 8 + projects/affine-defi/index.js | 29 + projects/afraswap/index.js | 2 +- projects/aftermath-fi/index.js | 23 + projects/agarthadao/index.js | 3 +- projects/agile/index.js | 1 - projects/agilitylsd/index.js | 34 + projects/agni-fi/index.js | 5 + projects/agora/abi.json | 44 +- projects/agora/index.js | 16 +- projects/agsfinance/index.js | 2 +- projects/ajira-pay-finance/index.js | 35 + projects/ajna/index.js | 25 + projects/akiba/index.js | 24 + projects/aktionariat/index.js | 51 + projects/aladdin-dao/abis/Vault.json | 4 +- projects/aladdin-dao/index.js | 18 +- projects/alchemix/contracts.json | 20 + projects/alchemix/index.js | 68 +- projects/alexar/index.js | 96 +- projects/algebra/index.js | 82 +- projects/algem/index.js | 16 +- projects/algoblocks/index.js | 12 + projects/algofi-swap/index.js | 6 +- projects/algofi/index.js | 3 + projects/algomint/index.js | 74 +- projects/algomint/utils.js | 37 + projects/algorai-finance/constants.js | 34 +- projects/algorai-finance/index.js | 3 +- projects/algorai-finance/utils.js | 28 +- projects/alienfi/index.js | 16 + projects/alita-finance/index.js | 31 +- projects/aliumswap/index.js | 4 +- projects/alkemi/index.js | 11 +- projects/allbridge/index.js | 65 +- projects/allchainbridge/index.js | 47 +- projects/alligator-exchange/index.js | 32 +- projects/alongside/index.js | 20 + projects/alpaca-finance-lend/abi.json | 6 + projects/alpaca-finance-lend/index.js | 9 + projects/alpaca-finance-lend/lend.js | 38 + projects/alpaca-finance-v2/abi.json | 4 + projects/alpaca-finance-v2/index.js | 10 + projects/alpaca-finance-v2/moneyMarket.js | 30 + projects/alpaca-finance/abi.json | 231 +- projects/alpaca-finance/ausd.js | 14 +- projects/alpaca-finance/index.js | 6 +- projects/alpaca-finance/lyf.js | 36 +- projects/alpaca-finance/xalpaca.js | 11 +- projects/alpacacity/index.js | 44 - projects/alpacafinance-gmx/index.js | 18 + projects/alpha-homora/abi.json | 177 +- projects/alpha-homora/index.js | 8 +- projects/alpha-homora/v1.js | 12 +- projects/alpha-homora/v2.js | 30 +- projects/alpha-homora/v2/legacy-pools.json | 838 ------ projects/alyx-finance/index.js | 116 + projects/ambient-finance/index.js | 22 + projects/ammos-fi/index.js | 5 + projects/ampere/index.js | 3 +- projects/ampleswap/index.js | 15 + projects/amulet-liquidity-staking/index.js | 5 +- projects/amulet-protocol/index.js | 5 +- projects/amun/abi.json | 16 +- projects/amyfinance/index.js | 15 +- projects/anchor/index.js | 76 +- projects/anetabtc/index.js | 36 +- projects/angel-protocol/index.js | 14 +- projects/angle/index.js | 98 +- projects/animeswap/index.js | 11 +- projects/ankr/abi.json | 26 +- projects/ante/index.js | 193 +- projects/antfarm-finance/index.js | 43 + projects/antimatter/abi.json | 66 - projects/antimatter/index.js | 60 - projects/antimatterDAO/abi.json | 88 +- projects/antimatterDAO/index.js | 212 +- projects/anyhedge/index.js | 79 + projects/anyswap/index.js | 89 +- projects/apeCoinStaking/config.js | 4 + projects/apeCoinStaking/index.js | 19 + projects/aperocket/abi.json | 52 +- projects/aperture/abi.json | 69 +- projects/aperture/getVaults.js | 28 +- projects/aperture/index.js | 60 +- projects/aperture/openPositions.json | 1 - projects/apeswap-amm/index.js | 43 +- projects/apeswap-lending/index.js | 8 +- projects/apex/index.js | 37 +- projects/apexswap/index.js | 4 +- projects/api3/abi.json | 7 - projects/api3/index.js | 27 +- projects/apollodao/index.js | 92 +- projects/apollox/index.js | 92 +- projects/aptin-finance/index.js | 49 + projects/apwine/abi.json | 34 +- projects/apwine/index.js | 45 +- projects/apyfinance/abi.json | 16 +- .../aquarius/getEntireSystemColl.abi.json | 13 - projects/aquarius/index.js | 18 +- projects/arbicheems/index.js | 5 +- projects/arbinyan/index.js | 5 +- .../abis/arbiStakerERC20.json | 56 +- projects/arbirise-finance/abis/getPair.json | 26 - .../arbirise-finance/abis/getReserves.json | 25 - projects/arbirise-finance/abis/token0.json | 15 - projects/arbirise-finance/getPrice.js | 8 +- projects/arbiswap/index.js | 14 + projects/arbitrove/index.js | 21 + projects/arbitrumexchange-v3/index.js | 8 + projects/arbor-finance/index.js | 34 +- projects/arbswap-stableswap/index.js | 24 + projects/arbswap/index.js | 9 +- projects/arc-swap/index.js | 8 + projects/arcade-xyz/abi.js | 5 + projects/arcade-xyz/constants.js | 24 + projects/arcade-xyz/index.js | 64 + projects/arcade-xyz/queries.js | 91 + projects/arcadia-finance/helper/abi.json | 8 + projects/arcadia-finance/helper/index.js | 38 + projects/arcadia-finance/index.js | 12 + projects/arch-ethereum-web-3/index.js | 14 +- projects/archerswap/index.js | 11 + projects/archi-finance/abi.json | 10 + projects/archi-finance/index.js | 51 + projects/archly-finance/index.js | 90 +- projects/arctic/abi.js | 129 +- projects/arctic/index.js | 5 +- projects/arenaswap/index.js | 2 +- projects/argano/index.js | 9 +- projects/argofinance/index.js | 28 +- projects/aries-markets/index.js | 38 +- projects/armorfinance/abiNXMVault.json | 16 +- projects/armorfinance/index.js | 5 +- projects/arpa-staking/index.js | 16 + projects/arrakis-v2/index.js | 45 + projects/array-capital/index.js | 11 + projects/arrow/index.js | 56 +- projects/artemis/index.js | 3 +- projects/arthswap/index.js | 4 +- projects/asgard-dao/index.js | 7 +- projects/asgardfinance/index.js | 8 +- projects/ashswap/index.js | 28 + projects/astarexchange/index.js | 2 +- projects/astarexchangev3/index.js | 5 + projects/astarfarm/abi.json | 15 - projects/astarfarm/index.js | 3 +- projects/astaria/index.js | 67 + projects/astarnova/abi.json | 19 - projects/astarnova/index.js | 3 +- projects/astra-dao/index.js | 31 + projects/astriddao/abi/ActivePool.abi.json | 14 +- projects/astriddao/abi/DefaultPool.abi.json | 14 +- projects/astriddao/index.js | 29 +- projects/astroport-classic/index.js | 13 + projects/astroport/index.js | 20 +- projects/astrowar-finance/index.js | 5 +- projects/asymetrix/index.js | 13 + projects/asymmetry-fi/index.js | 14 + projects/ate/index.js | 29 + projects/athenafinance-io/index.js | 39 + projects/athos/index.js | 14 + projects/atlantisloans/index.js | 33 +- projects/atlas-fi/index.js | 34 + projects/atlas-usv/api.js | 8 + projects/atlas-usv/index.js | 3 +- projects/atlendis/index.js | 2 +- projects/atomic/index.js | 35 + projects/auctus/abi.json | 56 +- projects/auctus/index.js | 34 +- projects/augmented-finance/abi.json | 230 -- projects/augmented-finance/index.js | 101 +- projects/augur/index.js | 5 +- projects/auguryfinance/abi.json | 54 +- projects/auguryfinance/index.js | 44 - projects/aura-finance/abi.json | 84 +- projects/aura-finance/index.js | 150 +- projects/auragi-finance/index.js | 12 + projects/auraswap/index.js | 17 +- projects/aurora-plus/index.js | 3 +- projects/auroraswap/index.js | 16 +- projects/autobark/index.js | 18 +- projects/autocoreDefi/index.js | 38 + projects/autoearn/index.js | 29 + projects/autoshark/abi.json | 22 +- projects/avalaunch/index.js | 6 +- projects/avatr/index.js | 32 + projects/avault/abi.json | 74 +- projects/avault/index.js | 35 +- projects/avaware/abi.json | 75 +- projects/avaware/index.js | 15 +- projects/avely-finance-staking/index.js | 59 + projects/avely-finance-swap/index.js | 54 + projects/axe/index.js | 8 +- projects/axial/abi.json | 139 +- projects/axial/index.js | 98 +- projects/axion/abi.json | 58 +- projects/axion/index.js | 3 +- projects/aztec/abi.json | 13 +- projects/aztec/index.js | 24 +- projects/azuro/index.js | 54 +- projects/babydogeswap/index.js | 12 +- projects/babylon-finance/abi.json | 119 +- projects/babylon-finance/index.js | 2 +- projects/babyswap/abi.json | 49 +- projects/babyswap/index.js | 4 +- projects/backfinance/abi.json | 140 +- projects/bagel-finance/abi.json | 108 +- projects/bagel-finance/index.js | 17 +- projects/baguette/index.js | 2 +- projects/baker-guild-finance/index.js | 13 +- projects/bakeryswap/index.js | 2 +- projects/baksdao/index.js | 9 +- projects/balanced/index.js | 48 +- projects/balanced/prices.js | 6 +- projects/balancer-v1/index.js | 16 + projects/balancer/abi.json | 18 - projects/balancer/index.js | 100 +- projects/balancer/onchain.js | 150 +- projects/bamboodefi/index.js | 4 +- projects/bancor/abi.json | 76 +- projects/bancor/index.js | 3 +- projects/bancor/v3.js | 3 +- projects/bank-of-chain/index.js | 5 +- .../bank-of-chain/risk_off_vault_abi.json | 14 +- projects/bao-baskets/index.js | 39 + projects/bao-markets/index.js | 11 + projects/bao-usd/index.js | 8 + projects/bao/abi.json | 49 +- projects/baoswap/index.js | 3 + projects/baptswap/index.js | 9 + projects/barnbridge/index.js | 201 +- projects/barnswap/index.js | 1 - projects/baryon/index.js | 1 - projects/based-finance/basedV2.js | 25 +- projects/based-finance/index.js | 61 +- projects/baseswap/index.js | 14 + projects/basilisk/index.js | 9 + projects/basketdao/index.js | 5 +- projects/bastion/abi.json | 24 +- projects/baton/index.js | 42 + projects/baymax/index.js | 15 + projects/bayswap/index.js | 40 + projects/bchpad/index.js | 3 +- projects/beamer/index.js | 31 + projects/beamex/index.js | 7 + projects/beamswap-stableswap/index.js | 25 + projects/beamswap-v3/index.js | 5 + projects/beamswap/index.js | 74 +- projects/bean/bean-utils.js | 100 - projects/bean/index.js | 38 +- projects/bearfinance/index.js | 5 +- projects/bearnfi/abi.json | 18 +- projects/bearnfi/index.js | 9 +- projects/becoswap/index.js | 1 - projects/beefy/index.js | 10 + projects/beekava/index.js | 20 + projects/beethovenx/index.js | 59 +- projects/behodler/index.js | 23 +- projects/belt/abi.json | 28 +- projects/belt/index.js | 15 +- projects/beluga-dex/index.js | 21 + projects/beluga-protocol/index.js | 5 +- projects/beluga/index.js | 62 +- projects/bemo/index.js | 23 + projects/benddao-ape-staking/index.js | 65 + .../benddao/helper/abis/ApeCoinStaking.json | 4 + .../benddao/helper/abis/BNFTRegistry.json | 4 + projects/benddao/helper/abis/ERC721.json | 3 + .../helper/abis/UiPoolDataProvider.json | 184 +- projects/benddao/helper/abis/index.js | 6 + projects/benddao/helper/address.js | 37 +- projects/benddao/helper/index.js | 108 +- projects/benddao/index.js | 25 +- projects/benqi-staked-avax/index.js | 6 +- projects/benqi-staked-avax/savax.json | 36 +- projects/benswap/index.js | 11 +- projects/bent/bentBasePoolAbi.json | 18 +- projects/bent/constants.js | 9 +- projects/bent/curvePoolAbi.json | 35 +- projects/bent/curveRegistryAbi.json | 20 +- projects/bent/index.js | 222 +- projects/bepro/index.js | 5 +- projects/betafinance/index.js | 38 +- projects/betswirl/index.js | 205 +- projects/bfx/index.js | 14 + projects/bhavish/index.js | 23 + projects/biconomy/index.js | 33 +- projects/bifi/index.js | 43 +- projects/bifrost-dex/api.js | 103 +- projects/bifrost-liquid-crowdloan/api.js | 55 + projects/bifrost-liquid-crowdloan/index.js | 6 + projects/bifrost-staking/api.js | 58 +- projects/bifrost-staking/index.js | 30 +- projects/bigdataprotocol/abi.json | 35 +- projects/bigdataprotocol/index.js | 54 +- projects/billion-happiness/index.js | 5 +- projects/binance-beth/index.js | 15 + projects/binance-staked-eth/index.js | 16 + projects/binance-us/index.js | 14 + projects/binance/config.js | 375 ++- projects/binance/index.js | 1 + projects/bishares/abi.js | 28 +- projects/bishares/config.js | 23 +- projects/biswap-v3/index.js | 24 + projects/biswap/index.js | 4 +- projects/bitgert-swap/index.js | 1 - projects/bitget/index.js | 98 + projects/bitindi-dex/index.js | 2 + projects/bitindi/index.js | 14 + projects/bitlend/index.js | 7 +- projects/bitmake/index.js | 13 + projects/bitvenus/index.js | 41 + projects/black-whale/index.js | 19 + projects/blackbird-finance/index.js | 9 +- projects/blazestake/index.js | 15 + projects/blindex/index.js | 4 +- projects/blizzard/abi.json | 42 +- projects/blizzard/index.js | 107 +- projects/blockng/index.js | 60 +- projects/blockswap/index.js | 88 + projects/blue-move-mart/index.js | 31 + projects/bluebit/abis.json | 27 +- projects/bluebit/index.js | 5 +- projects/bluefin/index.js | 9 + projects/bluemove-dex/index.js | 20 + projects/blueshift/abi.json | 131 +- projects/blueshift/config.json | 24 +- projects/blueshift/index.js | 82 +- projects/bluespade/index.js | 22 + projects/blur-finance/abi.js | 69 +- projects/blur-finance/index.js | 5 +- projects/blur-lend/index.js | 11 + projects/blur/index.js | 32 + projects/bmcc/index.js | 8 +- projects/bnpl-pay/index.js | 157 +- projects/bobagateway/abi.json | 55 +- projects/bobagateway/index.js | 5 +- projects/bodhfinance/index.js | 3 +- projects/bolide/index.js | 42 +- projects/bond-protocol/index.js | 37 + projects/boneriumtech/index.js | 7 + projects/bonkswap/index.js | 212 ++ projects/bonqdao/index.js | 77 + projects/bonsai-strike/index.js | 8 + projects/boofinance/abi.json | 51 +- projects/boofinance/index.js | 182 +- projects/borgswap/abi.json | 143 +- projects/boringdao/index.js | 2 +- projects/bourbon-dao/index.js | 7 +- projects/bourbon/index.js | 1 - projects/bow/index.js | 21 + projects/bprotocol/abi.json | 166 +- projects/bprotocol/index.js | 29 +- projects/brahmafi/batcher.json | 16 +- projects/brahmafi/erc4626.json | 30 +- projects/brahmafi/helper.js | 56 +- projects/brahmafi/index.js | 9 +- projects/brahmafi/tradeExecutor.json | 21 +- projects/brahmafi/vault.json | 49 +- projects/brainiac/index.js | 3 +- projects/brewlabs/index.js | 69 + projects/bridge-mutual/abi.json | 75 +- projects/bridge-mutual/index.js | 7 +- projects/bright-union/abi.json | 17 +- projects/bright-union/index.js | 3 +- projects/brightside/index.js | 10 + projects/brinc/index.js | 3 +- projects/brine/index.js | 18 + projects/brise-swap/index.js | 1 - projects/brokkr/index.js | 58 + projects/bscstation/abi.json | 14 +- projects/btcst/index.js | 11 +- projects/bubbleswap-v2/index.js | 25 + projects/bubbleswap/index.js | 39 +- projects/bucket-protocol/index.js | 26 + projects/buffer/index.js | 58 +- projects/bullionFX/index.js | 3 + projects/bullish/index.js | 20 - projects/bumper/index.js | 24 +- projects/bunicorn/index.js | 24 +- projects/bunni/index.js | 66 + projects/bunny/abi.json | 19 - projects/bunny/index.js | 6 +- projects/bunny/leverage_abi.json | 28 - projects/bunny/pot_abi.json | 13 - projects/bunnypark/index.js | 37 +- projects/burgerswap/abi.json | 104 +- projects/burgerswap/index.js | 3 +- projects/burrow.cash/index.js | 2 +- projects/business-builders-nfts/index.js | 21 + projects/butternetwork/index.js | 66 + projects/butterswap/index.js | 72 +- projects/bwatch/index.js | 3 + projects/bxh/index.js | 10 +- projects/bzx.js | 14 - projects/cache-gold/abis.js | 19 +- projects/cache-gold/index.js | 4 +- projects/cafeswap/index.js | 2 - projects/caffeinefund/index.js | 16 - projects/cake-defi/index.js | 12 +- projects/cakedao/index.js | 7 +- projects/cakewwap/index.js | 1 - projects/calculated-finance/index.js | 16 + projects/camel-farm/index.js | 9 + projects/camelot-v2/index.js | 13 + projects/camelot/index.js | 8 +- projects/candycity/index.js | 53 +- projects/canto-dex/index.js | 2 +- projects/canto-forte/index.js | 1 - projects/canto-lending/index.js | 63 +- projects/cantohm/index.js | 30 + projects/cantoswap/index.js | 1 - projects/cap-v4/index.js | 16 + projects/cap/index.js | 81 +- projects/capitaldex/index.js | 2 +- projects/capricorn/index.js | 1 - projects/carbon/index.js | 5 +- projects/carbondefi/index.js | 21 + projects/carbonswap/index.js | 2 - projects/carmine-options/abi.js | 41 + projects/carmine-options/api.js | 31 + projects/carmine-options/index.js | 1 + projects/carthage/index.js | 38 - projects/cashcow/abi.json | 35 +- projects/cashcow/index.js | 3 +- projects/cashio/index.js | 5 +- projects/casinocronos/index.js | 15 + projects/cat-in-a-box/index.js | 11 + projects/catsapes/index.js | 10 + projects/catsluck/index.js | 31 +- projects/caviar-v2/index.js | 24 + projects/caviar/index.js | 27 + projects/cega/abi.json | 8 + projects/cega/evm.js | 96 + projects/cega/index.js | 69 +- projects/cega/solana.js | 65 + projects/celerbridge/index.js | 136 +- projects/cells/index.js | 7 + projects/cemetery/index.js | 3 + projects/cerberusdao/api.js | 8 + projects/cerberusdao/index.js | 5 +- projects/cesta/abi.json | 10 +- projects/cesta/index.js | 3 +- projects/cetus/index.js | 54 +- projects/cexdex-stacking/index.js | 15 + projects/chainport/index.js | 119 +- projects/chaintools/index.js | 18 + projects/chainxyz/index.js | 13 - projects/changex/index.js | 29 + projects/channels/abi.json | 154 +- projects/channels/index.js | 5 +- projects/charmfinance/cubePoolAbi.json | 16 +- projects/charmfinance/index.js | 17 +- projects/charmfinance/vaultAbi.json | 47 +- projects/chee-finance/index.js | 11 +- projects/cherryswap/index.js | 4 +- projects/chest-finance/index.js | 3 +- projects/chfry/abi.json | 12 +- projects/chfry/index.js | 7 +- projects/chickenswap/abi.json | 63 +- projects/chocodoge/index.js | 7 +- projects/chronos/index.js | 10 + projects/cian/index.js | 38 +- projects/citadao/index.js | 20 + projects/citrus/index.js | 229 ++ projects/citycoins/index.js | 80 +- projects/claimswap-v2/index.js | 12 + projects/claimswap/index.js | 26 +- projects/claystack/clayABIs/clayMain.json | 24 +- projects/claystack/index.js | 3 +- projects/clearpool/abi.json | 16 +- projects/clearpool/index.js | 26 +- projects/clever-protocol/index.js | 1 - projects/clever/abis/index.json | 112 +- projects/clever/config.js | 59 +- projects/clever/index.js | 140 +- projects/clipper/index.js | 9 +- projects/clober/abi.json | 6 + projects/clober/index.js | 56 + projects/cobraswap/index.js | 63 +- projects/coconuts-finance/abi.json | 15 +- projects/coconuts-finance/index.js | 64 - projects/coffin/index.js | 3 +- projects/coindcx/index.js | 8 - projects/coindrip/index.js | 19 + projects/coinscope/index.js | 45 + projects/coinswap/index.js | 1 - projects/coinwind/abi.json | 249 +- projects/collectionxyz/index.js | 42 + projects/comb/index.js | 56 +- projects/commodo/index.js | 51 + projects/complifi/abi.json | 123 +- projects/complus/index.js | 8 +- projects/component/index.js | 43 +- projects/componentswap/index.js | 14 + projects/composable/index.js | 43 +- projects/compound-onchain/abi.json | 154 +- projects/compound-onchain/index.js | 19 +- projects/compound-onchain/v1Abi.json | 87 +- projects/compound-v3/index.js | 97 +- projects/compound-v3/v3abi.js | 1059 ------- projects/concave/index.js | 15 +- projects/concentrator/abis/AladdinAFXS.json | 28 +- projects/concentrator/abis/AladdinCRV.json | 28 +- projects/concentrator/abis/AladdinCVX.json | 4 + .../concentrator/abis/AladdinConvexVault.json | 71 +- projects/concentrator/abis/AladdinSdCRV.json | 4 + projects/concentrator/abis/abi.json | 130 +- projects/concentrator/config.js | 562 ---- projects/concentrator/index.js | 248 +- projects/concordex-io/index.js | 15 + projects/cone/index.js | 2 +- projects/config/abis.js | 51 - projects/config/bella/abis/bVault.js | 36 +- projects/config/boringdao/abis.js | 9 - projects/config/cover/cover.js | 525 +--- projects/config/defisaver/abis.js | 44 +- projects/config/ellipsis/abis.js | 7 - projects/config/finnexus/abis.js | 6 - projects/config/flamincome/abis.js | 3 - projects/config/hakka/abi.json | 85 +- projects/config/hodltree/addresses.js | 27 +- projects/config/indexed/abis.js | 8 - projects/config/keys.js | 39 +- .../contracts/lp-staking-contracts.js | 41 +- projects/config/n3rd/abis.js | 178 -- projects/config/onx/constant.js | 9 +- projects/config/onx/ethereum/farmTvl.js | 2 +- projects/config/onx/ethereum/farms.js | 42 +- projects/config/onx/ethereum/index.js | 7 +- projects/config/onx/fantom/index.js | 3 +- projects/config/piedao/abi/IBCP.json | 18 +- projects/config/piedao/abi/IPie.json | 43 +- projects/config/piedao/abi/IStakedToken.json | 20 +- projects/config/piedao/abi/IStakingAll.json | 37 +- .../config/piedao/abi/IStakingBalancer.json | 20 +- projects/config/smoothy/abis.js | 66 +- projects/config/uma/abis.js | 10 - projects/config/wepiggy/abi.json | 110 +- projects/conic-omnipool/index.js | 18 + projects/connext/abi.json | 17 +- projects/connext/index.js | 69 +- projects/connext/old.js | 17 +- projects/contango/index.js | 56 + projects/convergence/index.js | 1 - projects/convex/abi.json | 59 +- projects/convex/index.js | 21 +- projects/convex/pools-crv.js | 5 +- projects/cookfinance/index.js | 17 +- projects/cookfinance/venusFinanceAbi.json | 38 +- projects/cookfinance/yieldyakAbi.json | 22 +- projects/core/index.js | 13 +- projects/coreswap/index.js | 11 + projects/corgi/abi.js | 69 +- projects/corgi/index.js | 93 - projects/cortexdao/index.js | 15 + projects/counterstake/index.js | 77 +- projects/covo-finance/index.js | 7 + projects/covo-v2/index.js | 15 + projects/cowswap-cash/index.js | 14 + projects/cozy-v2/index.js | 25 + projects/cozy/index.js | 3 +- projects/crETH2/index.js | 10 + projects/crabada/index.js | 40 - projects/crafting/index.js | 11 +- projects/cranium/index.js | 13 + projects/cream/cerc20.json | 64 +- projects/cream/creth2.json | 16 +- projects/cream/index.js | 68 +- projects/creamswap/abi.json | 90 +- projects/creamswap/index.js | 329 +-- projects/creditum/abi.json | 14 +- projects/creditum/helper.js | 3 +- projects/creditum/index.js | 9 +- projects/credix/credix.json | 185 -- projects/credix/index.js | 325 +- projects/crescentswap/index.js | 6 + projects/croblanc/abi.json | 42 +- projects/croblanc/index.js | 5 - projects/cron-fi/index.js | 25 + projects/cronaswap/index.js | 1 - projects/crosschainbridge/index.js | 41 +- projects/croswap/index.js | 47 + projects/crowdswap/index.js | 38 + projects/crowfi/index.js | 23 +- projects/crown-finance/index.js | 3 + projects/crust-finance/index.js | 13 + projects/crv-usd/index.js | 39 + projects/cryptex-finance/index.js | 88 +- projects/cryptex-v2/index.js | 25 + projects/cryptex/cryptex-config.js | 337 --- projects/cryptex/cryptex-helper.js | 104 - projects/cryptex/index.js | 152 +- projects/crypto-com/index.js | 53 +- projects/cryptoyieldfocus/abi.json | 39 - projects/cryptoyieldfocus/index.js | 22 +- projects/crystl/index.js | 17 +- projects/cswap/index.js | 33 + projects/cubfinance/abi.json | 60 +- projects/cubo/index.js | 75 +- projects/curve/abi.json | 241 +- projects/curve/contracts.json | 8 +- .../curve => curve/historical}/abis.js | 9 +- projects/curve/historical/index.js | 254 ++ projects/curve/index.js | 532 ++-- projects/cvi/index.js | 28 +- projects/cybertime/abi.json | 35 +- projects/cyclefinance/abi.json | 42 +- projects/cyclefinance/index.js | 78 +- projects/cyclone/index.js | 56 +- projects/cypher-trade/idl.json | 2625 +++++++++++++++++ projects/cypher-trade/index.js | 19 + projects/czodiac/abi-chef-czb.json | 4 + projects/czodiac/abi-chef-czf.json | 4 + projects/czodiac/index.js | 37 + projects/dam-finance/index.js | 14 + projects/damm-finance/index.js | 3 +- projects/damx/index.js | 14 + projects/daolama/borrowed.js | 17 + projects/daolama/constants.js | 4 + projects/daolama/index.js | 12 + projects/daolama/tvl.js | 17 + projects/daomaker-swap/index.js | 2 +- projects/daomaker/index.js | 11 +- projects/daoventures/abi.json | 28 +- projects/daoventures/index.js | 1 - projects/darkauto/abi.json | 73 +- projects/darkcrypto/abi.json | 105 +- projects/darkcrypto/index.js | 58 +- projects/darkcrypto/vault-utils.js | 153 +- projects/darkness/index.js | 107 +- projects/darkness/utils.js | 51 - projects/darumadao/index.js | 3 +- projects/davos-protocol/index.js | 20 + projects/daytona-finance/index.js | 10 + projects/dbx-finance/index.js | 8 + projects/ddex/index.js | 69 +- projects/debets/getPoolInfo.json | 31 - projects/debets/index.js | 76 +- projects/debridge/index.js | 5 +- projects/debtdao/index.js | 92 + projects/decubate/index.js | 4 +- projects/dedust/index.js | 22 + projects/deepbook-sui/index.js | 23 + projects/deeplock/abi.json | 68 +- projects/deeplock/apiCache.js | 9 +- projects/deerfi/abi.json | 70 +- projects/defenderfinance/index.js | 24 + projects/defi-basket/abi.json | 7 - projects/defi-basket/api.js | 43 + projects/defi-basket/index.js | 62 +- projects/defi-swap/index.js | 3 +- projects/defibox/index.js | 67 +- projects/defichain-loans/api.js | 6 + .../index.js} | 10 +- projects/defichain-staking.js | 11 - projects/defidollar/abi.json | 37 +- projects/defidollar/index.js | 3 + projects/defiedge/index.js | 40 + .../defifranc/getEntireSystemColl.abi.json | 19 - projects/defifranc/index.js | 12 +- projects/defihalal/index.js | 3 +- projects/defikingdoms/index.js | 10 +- projects/defil/abi.json | 15 - projects/defil/index.js | 10 +- projects/defily-dex/index.js | 15 + projects/defilyio/index.js | 7 +- projects/defimaster/index.js | 29 + projects/definer/abi.json | 202 +- projects/definer/index.js | 3 +- projects/defirex/index.js | 37 +- projects/defiyieldprotocol/index.js | 112 +- projects/deflex/index.js | 33 + projects/defrost/abi.json | 17 - projects/defrost/index.js | 96 +- projects/defyswap/index.js | 7 +- projects/degenerative/index.js | 11 +- projects/degenhaus/index.js | 13 +- projects/dehive/abi.json | 227 +- projects/dehive/assetsInfo.js | 55 +- projects/dehive/index.js | 82 +- projects/delta/index.js | 3 +- .../deltaprime/abis/getAllOwnedAssetsAbi.json | 13 + projects/deltaprime/index.js | 132 + .../mappings/assetToAddressMapping.json | 46 + projects/deltatheta/factory.abi.js | 34 +- projects/deltatheta/index.js | 37 +- projects/demeter/index.js | 5 +- projects/demodyfi/index.js | 7 +- projects/depth/index.js | 7 +- projects/deri/abi.json | 63 +- projects/deri/index.js | 53 +- projects/deribit/index.js | 1 + projects/deridex/index.js | 37 + projects/deridex/utils.js | 26 + projects/derify/index.js | 8 + projects/derivadex/index.js | 9 +- projects/deversifi/index.js | 51 +- projects/devil-finance/index.js | 4 +- projects/dexfinance/abi.js | 15 +- projects/dexfinance/index.js | 75 +- projects/dexilla/index.js | 54 + projects/dexio-protocol/index.js | 13 + projects/dexit-swap/index.js | 5 + projects/dexpad/abis.js | 74 +- projects/dexpad/api.js | 5 +- projects/dexpad/apiCache.js | 9 +- projects/dexswap-arbi/index.js | 8 + projects/dexter-tezos/index.js | 18 + projects/dexter/index.js | 49 + projects/dextf/abis/getPositions.json | 40 - projects/dextf/abis/getReserves.json | 25 - projects/dextf/abis/getSets.json | 13 - projects/dextf/abis/totalSupply.json | 13 - projects/dextf/index.js | 55 +- projects/dextf/v1.js | 89 +- projects/dextf/v2.js | 147 +- projects/dforce/abi.json | 201 +- projects/dforce/index.js | 29 +- projects/dfx/contracts.json | 128 - projects/dfx/index.js | 78 +- projects/dfyn/index.js | 3 - projects/diamond-unibot-v2/index.js | 79 + projects/diamond/abi.json | 156 +- projects/diamond/index.js | 12 +- projects/diffusionfi/index.js | 3 +- projects/dinoexchange/index.js | 11 +- projects/dinosaur-finance/index.js | 31 + projects/dinosaureggs/index.js | 8 +- projects/dinoswap/abi.json | 51 +- projects/dinoswap/index.js | 3 +- projects/dinotopia/abi.json | 8 + projects/dinotopia/index.js | 32 + projects/diosfinance/index.js | 3 +- projects/direct-exchange/index.js | 7 + projects/djed-alliance/abi.json | 5 + projects/djed-alliance/config.json | 10 + projects/djed-alliance/index.js | 37 + projects/dmmexchange/abi.json | 78 - projects/dmmexchange/index.js | 69 - projects/dmusk/index.js | 1 - projects/dnadollar/abi.json | 40 +- projects/dnadollar/index.js | 7 +- projects/dodo/index.js | 4 +- projects/dogecompounder/index.js | 22 +- projects/dogedollar/index.js | 15 + projects/dogeswap-org/api.js | 8 + projects/dogeswap-org/index.js | 12 +- projects/dogewhale/index.js | 14 + projects/doglands-swap/index.js | 11 + projects/dogmoney/index.js | 3 +- projects/dokidoki/index.js | 5 +- projects/dolomite/dolomite-margin.json | 71 +- projects/dolomite/index.js | 73 +- projects/domfi/abi.js | 50 +- projects/domfi/registry.js | 9 +- projects/donkey/abi.json | 30 +- projects/donkey/index.js | 3 +- projects/dooar/index.js | 1 - projects/doorainu/index.js | 8 + projects/dopex/abi.json | 68 +- projects/dopex/index.js | 11 +- projects/dopplefinance/index.js | 21 +- projects/dotdot/index.js | 271 +- projects/dotoracle/index.js | 15 +- projects/double/abis.json | 107 +- projects/double/index.js | 10 +- projects/doveswap-v3/index.js | 5 + projects/doveswap/index.js | 3 + projects/dpex/index.js | 7 + projects/drachma-exchange/index.js | 17 +- projects/drachma/index.js | 12 +- projects/dracula/index.js | 7 + projects/droplit-money/index.js | 18 + projects/drops/index.js | 58 +- projects/dsu-money/index.js | 17 + projects/dual/idl.json | 421 +-- projects/dual/index.js | 71 +- projects/dubble-exchange/index.js | 14 + projects/duckydefi/index.js | 2 +- projects/duet/abis/collateral-reader.json | 32 +- projects/duet/abis/ebcake-reader.json | 3 + projects/duet/abis/pro-pool.json | 3 + projects/duet/arbitrum.js | 9 + projects/duet/bsc.js | 68 + projects/duet/index.js | 57 +- projects/dxsale/abis.js | 203 +- projects/dxsale/api.js | 3 + projects/dxsale/apiCache.js | 29 +- projects/dxsale/config.js | 49 +- projects/dxsale/index.js | 20 +- projects/dyad/index.js | 23 + projects/dydx/index.js | 11 +- projects/dynastyswap-xyz/index.js | 8 + projects/dypius/index.js | 86 + projects/dyson-money/index.js | 78 + projects/dystopia/index.js | 10 +- projects/earnifty/abis/vault.json | 14 +- projects/earnifty/index.js | 2 +- projects/ease/index.js | 54 +- projects/eazyswap/index.js | 15 + projects/echidna/abi.json | 124 +- projects/echidna/index.js | 13 +- projects/echodex/index.js | 6 + projects/echswap/index.js | 5 +- projects/ecodefi/babyRouterAbi.json | 4 +- projects/ecodefi/index.js | 3 +- projects/ecodefi/stakingAbi.json | 4 +- projects/eigenlayer/index.js | 34 + projects/eklipse/index.js | 19 +- projects/elasticswap/index.js | 30 +- projects/electrikfinance/abi/addressBook.json | 144 - projects/electrikfinance/abi/poolstat.json | 81 - projects/electrikfinance/index.js | 33 +- projects/elementfi/abi.json | 78 +- projects/elementfi/index.js | 192 +- projects/elephantdex/index.js | 1 - projects/elephantmoney/index.js | 5 +- projects/elkfinance/index.js | 2 +- projects/ellipisis-phoenix/index.js | 26 + projects/ellipsis/abi.json | 84 +- projects/ellipsis/index.js | 45 +- projects/ellipsis/onchain.js | 8 +- projects/elysia/index.js | 11 +- projects/emberswap/index.js | 3 +- projects/embr/index.js | 19 +- projects/emdx/index.js | 3 +- projects/emiswap/index.js | 103 +- projects/empiredex/index.js | 25 +- projects/empyreal/index.js | 21 + projects/empyrean/index.js | 3 +- projects/energyfi/index.js | 1 - projects/ennead/index.js | 51 + projects/ennead/ramsesLens.json | 7 + projects/enosys-bridge/index.js | 7 + projects/ensuro/index.js | 54 + projects/enterdao/index.js | 3 +- projects/entities/a16z-cold.js | 14 + projects/entities/akg-ventures.js | 12 + projects/entities/animoca-brands.js | 12 + projects/entities/arca.js | 22 + projects/entities/axia8-venture.js | 17 + projects/entities/binance-labs.js | 12 + projects/entities/block-one.js | 12 + projects/entities/blockchain-capital.js | 14 + projects/entities/chain-capital.js | 22 + projects/entities/coin98-venture.js | 28 + projects/entities/defiance-capital.js | 32 + projects/entities/delphi-digital.js | 22 + projects/entities/digital-finance-group.js | 22 + projects/entities/dragonfly-capital.js | 18 + projects/entities/fbg-capital.js | 18 + projects/entities/fenbushi-capital.js | 18 + projects/entities/framework-ventures.js | 11 + projects/entities/genesis-trading.js | 25 + projects/entities/id-capital.js | 34 + projects/entities/jump-capital.js | 25 + projects/entities/mechanism-capital.js | 13 + projects/entities/mt-gox.js | 14 + projects/entities/multi-chain-capital.js | 31 + projects/entities/ngc-ventures.js | 31 + projects/entities/pantera-capital.js | 12 + projects/entities/paradigm-capital.js | 15 + projects/entities/plutus-vc.js | 16 + projects/entities/polychain-capital.js | 13 + projects/entities/silkroad-fbifunds.js | 14 + projects/entropyfi/abi.json | 77 +- projects/enzyme/index.js | 4 +- projects/eoswap/index.js | 8 + projects/epsylon/abi.json | 16 +- projects/epsylon/index.js | 5 +- projects/equilibre/index.js | 10 + projects/equilibria/index.js | 96 + projects/equilibrium/api.js | 97 + projects/equilibrium/index.js | 30 +- projects/equito-finance/index.js | 38 + projects/equity/index.js | 9 + projects/erasure/abi.json | 44 +- projects/erasure/index.js | 3 +- projects/ergodex/index.js | 12 - projects/ergopad/index.js | 42 +- projects/eris-protocol/index.js | 274 +- projects/esdt-market/index.js | 8 + projects/ester/abi.json | 119 +- projects/etcswap/index.js | 1 - projects/eternalFinance/helper.js | 12 + projects/eternalFinance/index.js | 19 + projects/eternalFinance/lending.js | 27 + projects/eternalFinance/lyf.js | 77 + projects/eternalFinance/pancake.js | 43 + projects/ethalend/abi.json | 4 +- projects/ethalend/index.js | 11 +- projects/ether-fi/index.js | 14 + projects/etherberry/index.js | 34 + projects/ethichub/index.js | 3 +- projects/ethos/index.js | 22 + projects/ethwswap/index.js | 1 - projects/ethx/index.js | 13 + projects/euler/abi.json | 4 - projects/euler/index.js | 93 +- projects/everestdao/index.js | 69 - projects/everlend/index.js | 18 +- projects/everrise/abi.json | 149 +- projects/everrise/index.js | 161 +- projects/evmoswap/index.js | 11 +- projects/evolutionland/index.js | 232 +- projects/evolve/abi.js | 115 +- projects/evolve/index.js | 2 +- projects/exactly/.prettierrc | 3 + projects/exactly/index.js | 95 + projects/excalibur/index.js | 11 +- projects/exinpool/index.js | 3 + projects/exinswap/index.js | 3 + projects/exit10-fi/index.js | 19 + projects/exodia/index.js | 7 +- projects/extra/index.js | 44 + projects/ezkalibur/index.js | 15 + projects/fabric/index.js | 19 - projects/factor-v2/index.js | 26 + projects/factor/index.js | 27 + projects/fairyswap-v2/index.js | 8 + projects/fantOHM/BalancerVaultBeets.json | 30 +- .../fantOHM/BalancerWeightedPoolBeets.json | 14 +- projects/fantOHM/MasterChefBeets.json | 57 +- projects/fantOHM/api.js | 4 + projects/fantOHM/index.js | 51 +- projects/fantOHM/index.json | 16 +- projects/fantasm/abi.json | 30 +- projects/fantasm/index.js | 5 +- projects/farmersonly/abi.js | 57 +- projects/farmersonly/index.js | 1 - projects/farmhero/abi.json | 75 +- projects/fatex/index.js | 1 - projects/fathom-dex/index.js | 8 + projects/fcondex/index.js | 11 + projects/fdoge/index.js | 3 + projects/feederfinance/index.js | 17 +- projects/fei/index.js | 5 +- projects/fenrirfinance/index.js | 7 +- projects/ferro/index.js | 16 +- projects/fiatdao/abi.json | 111 +- projects/fiatdao/index.js | 14 +- projects/filda/abi.json | 154 +- projects/filda/index.js | 18 +- projects/filet/abi.js | 7 + projects/filet/index.js | 93 +- projects/fin/index.js | 27 + projects/finext-finance/index.js | 15 + projects/finnexus/index.js | 11 +- projects/fire/index.js | 2 +- projects/firebird/index.js | 26 +- projects/firebot/index.js | 29 + projects/firedao/abi.json | 70 +- projects/flair-dex/index.js | 13 + projects/flare-loans/index.js | 18 +- projects/flareWatermelon/index.js | 14 + projects/flarefarm/index.js | 45 +- projects/flarex/index.js | 2 +- projects/flashstake-old/index.js | 32 +- projects/flashstake/abi.json | 116 - projects/flashstake/index.js | 346 +-- projects/flatcoin/index.js | 11 + projects/float-capital/abi.json | 16 +- projects/float-capital/index.js | 9 +- projects/float/abi.json | 16 +- projects/flokifi-locker/index.js | 60 + projects/floor-dao/api.js | 4 + projects/floor-dao/index.js | 84 +- projects/florence-finance/index.js | 21 + projects/flowx-finance/index.js | 28 + projects/fluidity-money/index.js | 26 + projects/fluidtokens/index.js | 98 +- projects/fluity/getEntireSystemColl.abi.json | 13 - projects/fluity/index.js | 18 +- projects/flux-exchange/index.js | 23 + projects/flux/index.js | 25 +- projects/fluxbeam-xyz/index.js | 24 + projects/fluxfinance/index.js | 9 + projects/fndzdao/index.js | 5 +- projects/fodl/abi.json | 89 +- projects/folks-finance/index.js | 76 +- projects/folks-finance/{ => v1}/constants.js | 2 +- projects/folks-finance/v1/index.js | 71 + projects/folks-finance/{ => v1}/prices.js | 7 +- projects/folks-finance/v2/constants.js | 61 + projects/folks-finance/v2/index.js | 78 + projects/folks-finance/v2/prices.js | 92 + projects/folks-galgo/index.js | 1 - projects/folks-xalgo/index.js | 14 + projects/foodcourt/index.js | 2 - projects/footballmanager/index.js | 15 + projects/forcedao/abi.json | 17 - projects/forcedao/index.js | 65 - projects/forge-sx-dex/index.js | 7 + projects/forge/index.js | 5 + projects/forgesx/index.js | 12 + projects/forta/index.js | 8 + projects/forthewin/index.js | 20 + projects/fortress-lending/index.js | 3 +- projects/fortress/api.js | 9 + projects/fortress/index.js | 3 +- projects/fortube/abi.json | 197 +- projects/fortube/index.js | 271 +- projects/fortunedao/api.js | 8 + projects/fpi/index.js | 22 + projects/fractal-protocol/index.js | 239 +- projects/frakt/index.js | 11 +- projects/frax-swap/index.js | 33 +- projects/fraxfinance/abi.json | 41 - projects/fraxfinance/index.js | 280 +- projects/fraxlend/abi.json | 8 +- projects/fraxlend/index.js | 43 +- projects/freebie/index.js | 24 + projects/frfi/index.js | 13 +- projects/frigg-eco/abi/primaryRouter.json | 36 - projects/frigg-eco/index.js | 3 +- projects/friktion/index.js | 5 +- projects/fringe/pit-abi.json | 100 +- projects/frogge-fi/index.js | 8 + projects/froggy-protocol/index.js | 26 + projects/frostfinance/abi.json | 54 +- projects/frostfinance/index.js | 3 +- projects/fstswap/index.js | 1 - projects/ftmguru/index.js | 99 - projects/fujidao-v2/index.js | 95 + projects/fujidao/abi.json | 20 +- projects/fujidao/index.js | 11 +- projects/fulcrom/index.js | 26 + projects/funbear/index.js | 19 + projects/fundex/index.js | 22 + projects/fusefi/olalending.js | 8 +- projects/fusefi/swap.js | 1 - projects/fusion/index.js | 14 +- projects/fusionx-fi/index.js | 10 + projects/fusionx-v3/index.js | 5 + projects/future-swap/index.js | 35 + projects/futureswap/index.js | 17 +- projects/fuzzfinance/index.js | 51 +- projects/fvm/index.js | 12 + projects/fxdx/index.js | 14 + projects/fxswap/index.js | 2 +- projects/gaia-dao/index.js | 7 +- projects/galador-io/index.js | 8 + projects/galatea/index.js | 24 - projects/galaxygoggle/index.js | 45 +- projects/gale/index.js | 4 +- projects/gale/windmillABI.json | 16 +- projects/galoswap/index.js | 10 + projects/gambit-financial/index.js | 15 + projects/gambit/index.js | 12 + projects/gamblefi/index.js | 8 +- projects/gamutexchange/abi.js | 6 + projects/gamutexchange/factory.json | 4 + projects/gamutexchange/getTVL.js | 96 + projects/gamutexchange/index.js | 14 + projects/garbi/index.js | 74 + projects/garble-money/index.js | 15 + projects/gard/index.js | 3 +- projects/gardensdao/index.js | 15 +- projects/garuda-staking/index.js | 9 + projects/gate-io/index.js | 12 + projects/gearbox/abi.json | 483 +-- projects/gearbox/events.js | 156 +- projects/gearbox/index.js | 48 +- projects/geist/index.js | 2 +- projects/gemswap/index.js | 14 + projects/genesis/abi.json | 42 +- projects/genesys/index.js | 5 +- projects/genius-yield/index.js | 17 + projects/genius/genius-abi.json | 4 + projects/genius/genius-stability-abi.json | 3 + projects/genius/index.js | 108 + projects/genshiro/api.js | 2 +- projects/genshiro/index.js | 5 +- projects/geode/abis/avax/DWP.json | 23 - projects/geode/abis/avax/Portal.json | 44 - projects/geode/abis/avax/gAVAX.json | 43 - projects/geode/index.js | 25 +- projects/gfs/index.js | 3 +- projects/gft/index.js | 3 +- projects/ghast/index.js | 29 + projects/ghost/index.js | 41 + projects/gizadao/index.js | 5 +- projects/glacier-finance/index.js | 10 + projects/glif/index.js | 34 + projects/glitter-finance/index.js | 49 +- projects/gmcash/abi.json | 5 + projects/gmcash/index.js | 25 + projects/gmd/index.js | 71 +- projects/gmx/index.js | 13 +- projects/gnd-protocol/index.js | 16 + projects/gnosis/conditional-token.js | 73 - projects/gnosis/index.js | 124 +- projects/goblin/abi.json | 49 +- projects/goblinscash/api.js | 8 + projects/goblinscash/index.js | 3 +- projects/gogocoin/index.js | 31 +- projects/gogopool/index.js | 12 + projects/goldbank/index.js | 13 + projects/goldfinch/abi.json | 60 +- projects/goldfinch/index.js | 21 +- projects/goledo/index.js | 22 + projects/golff-finance/abi.json | 28 - projects/golff-finance/index.js | 3 - projects/goober/abis.js | 20 +- projects/good-ghosting/index.js | 96 +- projects/gooddollar/abi.json | 30 +- projects/gooddollar/index.js | 30 +- projects/goodentry/index.js | 50 + projects/gplx/index.js | 10 + projects/grappa-finance/grappa-ethereum.js | 20 + projects/grappa-finance/index.js | 12 + projects/grave/index.js | 13 +- projects/gravis-finance/index.js | 23 +- projects/gravita-protocol/index.js | 28 + projects/gravity-bridge/index.js | 80 + projects/gravity-finance/index.js | 22 +- projects/greenhouse/index.js | 2 +- projects/gridex/index.js | 48 + projects/grim/config.json | 538 ++++ projects/grim/index.js | 38 +- projects/grizzly-trade/index.js | 7 + projects/grizzlyfi/index.js | 255 +- projects/groprotocol/abi.json | 30 +- projects/groprotocol/helpers.js | 236 -- projects/groprotocol/index.js | 165 +- projects/groveswap/index.js | 16 + projects/growth-defi.js | 29 - projects/growthdefi/abi.json | 160 +- projects/growthdefi/abis/belt.json | 86 +- projects/growthdefi/abis/clqdr.json | 14 +- projects/growthdefi/abis/psm.json | 14 +- projects/growthdefi/index.js | 23 +- projects/gumball/index.js | 71 + projects/gxypad/index.js | 11 + projects/gyroscope/index.js | 43 + projects/gysr/index.js | 7 +- projects/hadesswap/index.js | 11 +- projects/hadouken-fi-dex/index.js | 22 + projects/hadouken-fi-lending/index.js | 5 + projects/hakuswap/index.js | 19 +- projects/halodao/index.js | 27 +- projects/hamburger/index.js | 8 + projects/handlefi-fxpreps/index.js | 18 +- projects/handlefi/abi.json | 96 +- projects/handlefi/index.js | 3 +- projects/hashdaofinance/index.js | 45 + projects/hashflow/index.js | 3 +- projects/hashking/index.js | 13 + projects/hashmix/index.js | 58 + projects/hatom-lending/index.js | 42 + projects/hatom-liquid-staking/index.js | 14 + projects/hats-v2/index.js | 25 + projects/hats/index.js | 12 + projects/hawksight/index.js | 17 + projects/hebeswap/index.js | 2 - projects/hectagon/index.js | 3 +- projects/hector-lendng/index.js | 7 + projects/hector/abi.json | 56 +- projects/hector/api.js | 4 + projects/hector/contracts.json | 95 +- projects/hector/index.js | 296 +- projects/hedgefarm/index.js | 45 +- projects/hedgehog/index.js | 18 + projects/hegic/index.js | 13 +- projects/helio-money/index.js | 22 +- projects/heliosprime/abi.json | 2 +- projects/heliosprime/index.js | 3 +- projects/heliswap/index.js | 18 +- projects/helmetinsure/index.js | 11 +- projects/helper/aave.js | 210 +- projects/helper/abis/aave.json | 534 +--- projects/helper/abis/balancer.json | 88 +- projects/helper/abis/blindex.json | 98 +- projects/helper/abis/blockng.json | 108 +- projects/helper/abis/chainlink.json | 15 - projects/helper/abis/compound.json | 193 +- projects/helper/abis/cream.json | 32 +- projects/helper/abis/dodo.json | 28 +- projects/helper/abis/erc20.json | 37 +- projects/helper/abis/factory.json | 25 +- .../helper/abis/getEntireSystemColl.abi.json | 13 - projects/helper/abis/getPair.json | 26 - projects/helper/abis/getPricePerShare.json | 31 - projects/helper/abis/getReserves.json | 25 - projects/helper/abis/kashipair.json | 20 - projects/helper/abis/kslp.js | 55 +- projects/helper/abis/masterchef.json | 37 +- projects/helper/abis/morpho.json | 87 +- projects/helper/abis/symbol.json | 15 - projects/helper/abis/token.json | 14 - projects/helper/abis/token0.json | 15 - projects/helper/abis/token1.json | 15 - projects/helper/abis/underlying.json | 14 - projects/helper/abis/uniswap.js | 4 + projects/helper/abis/userInfo.json | 27 - projects/helper/acala/api.js | 24 +- projects/helper/acala/dex-staking.js | 3 +- projects/helper/ankr/abis/AethToken.json | 293 -- projects/helper/ankr/abis/ERC20.json | 347 --- projects/helper/ankr/abis/OnsToken.json | 602 ---- projects/helper/ankr/abis/OnxPool.json | 41 - projects/helper/ankr/abis/OnxToken.json | 384 --- projects/helper/ankr/abis/QuickswapPool.json | 345 --- projects/helper/ankr/abis/QuickswapVault.json | 292 -- projects/helper/ankr/abis/SOnxToken.json | 322 -- projects/helper/ankr/abis/SpookyswapPool.json | 285 -- .../helper/ankr/abis/SpookyswapVault.json | 277 -- projects/helper/ankr/abis/SushiswapPool.json | 285 -- projects/helper/ankr/abis/SushiswapVault.json | 280 -- projects/helper/ankr/abis/TraderJoePool.json | 285 -- projects/helper/ankr/abis/TraderJoeVault.json | 284 -- projects/helper/ankr/abis/UniswapV2Pair.json | 713 ----- projects/helper/ankr/abis/activePool.json | 13 - projects/helper/ankr/abis/wethAddress.json | 13 - projects/helper/ankr/chainAddresses.js | 9 +- projects/helper/ankr/prices/binance.js | 12 - projects/helper/ankr/utils.js | 28 +- projects/helper/balancer.js | 75 +- projects/helper/balances.js | 3 +- projects/helper/cache.js | 463 +-- projects/helper/cache/compound.js | 74 + projects/helper/cache/getLogs.js | 100 + projects/helper/cache/sumUnknownTokens.js | 402 +++ projects/helper/cache/uniswap.js | 160 + projects/helper/cache/vestingHelper.js | 46 + projects/helper/calculateUniTvl.js | 168 +- projects/helper/cex.js | 145 +- projects/helper/chain/algorand.js | 54 +- projects/helper/chain/aptos.js | 64 +- projects/helper/chain/bitcoin.js | 42 +- projects/helper/chain/cardano.js | 101 +- projects/helper/chain/cardano/blockfrost.js | 4 +- projects/helper/chain/cardano/index.js | 2 +- projects/helper/chain/cosmos.js | 252 +- projects/helper/chain/elrond.js | 105 +- projects/helper/chain/ergo.js | 45 + projects/helper/chain/hbar.js | 8 +- projects/helper/chain/injective.js | 10 +- projects/helper/chain/libre.js | 94 + projects/helper/chain/litecoin.js | 7 +- projects/helper/chain/near.js | 12 +- projects/helper/chain/obyte.js | 34 +- projects/helper/chain/proton.js | 2 +- projects/helper/chain/stacks-api.js | 33 + projects/helper/chain/stacks.js | 50 + projects/helper/chain/starknet.js | 100 + projects/helper/chain/sui.js | 143 + projects/helper/chain/terra.js | 164 - projects/helper/chain/tezos.js | 96 +- projects/helper/chain/ton.js | 10 + projects/helper/chain/tron.js | 164 +- projects/helper/chain/waves.js | 72 + projects/helper/chain/wavesAdapter.js | 36 +- projects/helper/chains.json | 344 ++- projects/helper/compound.js | 73 +- projects/helper/compoundV3.js | 42 + projects/helper/coreAssets.json | 2509 ++++++++-------- projects/helper/curvePools.js | 91 +- projects/helper/dexpad.js | 8 +- projects/helper/env.js | 39 + projects/helper/erc4626.js | 18 + projects/helper/getBlock.js | 19 - projects/helper/getTokens.js | 16 - projects/helper/getUniFactory.js | 20 - projects/helper/getUniSubgraphTvl.js | 10 +- projects/helper/getUsdUniTvl.js | 40 - projects/helper/gmx.js | 60 +- projects/helper/graph.js | 24 - projects/helper/http.js | 125 +- projects/helper/koyo.js | 33 +- projects/helper/liquity.js | 14 +- projects/helper/masterchef.js | 18 +- projects/helper/nft.js | 45 + projects/helper/pact.js | 2 +- projects/helper/pool2.js | 10 +- projects/helper/portedTokens.js | 133 +- projects/helper/resolveCrvTokens.js | 202 -- projects/helper/saddle.js | 33 + projects/helper/solana.js | 86 +- projects/helper/staking.js | 20 +- projects/helper/streamingHelper.js | 67 +- projects/helper/sumTokens.js | 19 +- projects/helper/sushi-trident.js | 48 +- projects/helper/tokenMapping.js | 1481 +--------- projects/helper/tokenholders.js | 58 - projects/helper/tomb.js | 4 +- projects/helper/treasury.js | 88 + projects/helper/uniswapV3.js | 84 + projects/helper/unknownTokens.js | 554 +--- projects/helper/unwrapLPs.js | 784 ++--- projects/helper/utils.js | 166 +- projects/helper/utils/graphql.js | 8 + projects/helper/utils/pact.js | 2 +- projects/helper/utils/solana/layout.js | 681 +---- .../utils/solana/layouts/investin-layout.js | 129 + .../utils/solana/layouts/layout-base.js | 95 + projects/helper/utils/solana/layouts/lido.js | 249 ++ .../utils/solana/layouts/mixed-layout.js | 201 ++ .../utils/solana/layouts/openbook-layout.js | 96 + .../utils/solana/layouts/phoenix-dex.js | 37 + .../utils/solana/layouts/raydium-layout.js | 187 ++ projects/helper/whitelistedExportKeys.json | 1 - projects/helper/whitelistedNfts.js | 97 + projects/helper/yieldHelper.js | 102 +- projects/heraswap/index.js | 8 + projects/here-staking/index.js | 16 + projects/hermes-protocol/index.js | 3 +- projects/hermes/abi.json | 115 +- projects/hermes/index.js | 2 - projects/hex/abi.json | 2 +- projects/hex/index.js | 3 +- projects/hexal/index.js | 9 +- projects/hfione/abi.json | 30 +- projects/hidden-hand/index.js | 84 + projects/hippowswap/index.js | 1 - projects/hiveswap/index.js | 3 + projects/hodl/index.js | 3 + projects/holdr-fi/index.js | 7 + projects/holdstation/index.js | 15 + projects/homecoin/abi.json | 41 +- projects/homecoin/index.js | 3 +- projects/honeyswap/index.js | 2 - projects/honkswap/index.js | 3 +- projects/hop/index.js | 67 +- projects/hope-swap/index.js | 8 + projects/hopswap/index.js | 1 - projects/hord-fi/index.js | 10 + projects/horizon/collateral.js | 2 +- projects/horizondex/index.js | 12 + projects/hotbit/index.js | 82 + projects/hotfries/index.js | 3 +- projects/houdiniswap/index.js | 15 + projects/hpdex/index.js | 1 - projects/hubble-exchange/index.js | 7 +- projects/hubble/index.js | 5 +- projects/huckleberry/index.js | 3 +- projects/hummus/constants.js | 9 +- projects/hundredfinance/index.js | 33 +- projects/hunnyfinance/abi.json | 28 +- projects/hunnyfinance/index.js | 7 +- projects/huobi/index.js | 6 +- projects/hxro-network/index.js | 24 + projects/hydradex-v3/api.js | 7 + projects/hydradex-v3/index.js | 27 + projects/hydradex/api.js | 2 + projects/hydradex/getHydraV3SubgraphTvl.js | 22 + projects/hyperjump/index.js | 3 - projects/hyperliquid/index.js | 8 + projects/iTrustfinance/abi.json | 14 +- projects/iTrustfinance/index.js | 3 +- projects/ibcx/index.js | 42 + projects/ice-dao/index.js | 3 +- projects/icecreamswap/index.js | 37 +- projects/ichifarm/abi.json | 295 +- projects/ichifarm/index.js | 302 +- projects/icpswap/index.js | 28 + projects/ideamarket/abi.json | 1 - projects/ideamarket/index.js | 6 +- projects/idex/index.js | 10 +- projects/idle/abi.json | 45 - projects/idle/index.js | 262 +- projects/ifpool/abis.json | 50 - projects/ifpool/index.js | 6 +- projects/ignite-finance/abi.json | 83 +- projects/illuminate-fi/index.js | 43 + projects/illuvium/index.js | 55 +- projects/immortal/api.js | 8 + projects/immortal/index.js | 7 +- projects/immutablex/index.js | 17 + projects/impact-market/index.js | 3 +- projects/impermax/index.js | 25 +- projects/impossiblefi/index.js | 5 +- projects/inbuilt-finance/index.js | 20 + projects/increment-swap/index.js | 15 +- projects/indexcoop/index.js | 36 +- projects/indexed/index.js | 46 +- projects/infinitypad/index.js | 52 +- projects/infy/index.js | 17 +- projects/injective/index.js | 50 +- projects/ink-protocol/index.js | 2 +- projects/insrt_finance/index.js | 30 + projects/insurace/abi.json | 20 +- projects/insurace/index.js | 14 +- projects/insuredao/abi.json | 104 - projects/insuredao/index.js | 110 +- projects/insuredefi/abi.json | 53 +- projects/integral/abis/sizeGetReserves.json | 20 - projects/integral/index.js | 12 +- projects/intercroneswap/index.js | 29 + projects/interest-protocol/index.js | 16 + projects/interport-finance/index.js | 26 + projects/inuswap/index.js | 4 +- projects/invar-finance/abis.js | 39 +- projects/invar-finance/index.js | 3 +- projects/inverse-finance-firm/abi.json | 6 + projects/inverse-finance-firm/index.js | 48 + projects/inverse/abi.json | 81 +- projects/inverse/index.js | 9 +- projects/invictus/index.js | 3 +- projects/iotube/index.js | 242 +- projects/ip/index.js | 176 +- projects/ipor/abi.js | 18 +- projects/ironbank/cerc20.json | 64 +- projects/ironfinance/abi-polygon.json | 94 +- projects/ironfinance/index.js | 11 +- projects/ironfinance/utils.js | 8 +- projects/izumi-iziswap/abi.js | 129 +- projects/izumi-iziswap/index.js | 118 +- projects/izumi/abi.json | 349 +-- projects/izumi/api.js | 37 + projects/izumi/index.js | 40 +- projects/izumi/utils.js | 6 +- projects/jade-protocol/index.js | 14 +- projects/jadeswap/index.js | 28 + projects/jarvis/abi.json | 20 +- projects/jarvis/index.js | 266 +- projects/jbc/index.js | 22 + projects/jediswap/abi.js | 75 + projects/jediswap/api.js | 36 + projects/jediswap/index.js | 1 + projects/jelly/index.js | 3 +- projects/jet-protocol-v2-fixed-term/idl.json | 209 ++ projects/jet-protocol-v2-fixed-term/index.js | 19 + projects/jetfuelfinance/abi.json | 62 +- projects/jetfuelfinance/index.js | 20 +- projects/jetprotocol-v2-margin/index.js | 20 + projects/jetswap/index.js | 68 +- projects/jewelswap-lev-farming/api.js | 6 + projects/jewelswap-lev-farming/index.js | 96 + .../jewel-onedex-farm.abi.json | 115 + projects/jewelswap-liq-staking/index.js | 14 + projects/jewelswap-nft/api.js | 6 + projects/jewelswap-nft/index.js | 79 + .../jewelswap-nft/jewel-nft-lending.abi.json | 183 ++ projects/jexchange/index.js | 2 +- projects/jlswap/index.js | 8 + projects/jojo/index.js | 13 +- projects/jones-dao/abi.json | 104 +- projects/jones-dao/addresses.json | 58 +- projects/jones-dao/index.js | 231 +- projects/jones-dao/locked.json | 48 + projects/joystickclub/index.js | 14 +- projects/jpeg-d/helper/abis.js | 79 +- projects/jpeg-d/helper/addresses.js | 140 + projects/jpeg-d/helper/index.js | 293 +- projects/jpeg-d/index.js | 38 +- projects/jswap-finance/index.js | 1 - projects/juggler-red/index.js | 1 - projects/juicebox-v1/index.js | 24 + projects/juicebox-v2/index.js | 22 + projects/juicebox-v3/index.js | 24 + projects/jujubefinance/index.js | 6 + projects/julswap/index.js | 1 - projects/junoswap/index.js | 5 +- projects/jupiterswap/index.js | 4 +- projects/justCryptos/index.js | 3 + projects/justmoney/index.js | 104 +- projects/juststable/index.js | 30 +- projects/justyield/index.js | 18 + projects/kaDefi/index.js | 17 + projects/kaco/index.js | 35 +- projects/kaddex/index.js | 22 +- projects/kafefinance/index.js | 48 - projects/kafidao/index.js | 4 + projects/kagla/abi/addressProvider.json | 8 +- projects/kagla/abi/registry.json | 32 +- projects/kagla/addresses.js | 47 +- projects/kagla/index.js | 19 +- projects/kagla/pools.js | 76 +- projects/kagla/staking.js | 22 - projects/kagla/utils.js | 11 - projects/kaidex/index.js | 1 - projects/kalata/index.js | 77 +- projects/kalmy-app/abi.json | 192 +- projects/kalmy-app/index.js | 16 +- projects/kamino/api.js | 21 +- projects/kamino/index.js | 1 + projects/kannagi-finance/abi.json | 4 + projects/kannagi-finance/index.js | 38 + projects/kanvas/abi.json | 51 +- projects/kanvas/index.js | 12 +- projects/kapaswap/index.js | 7 + projects/kapinus/index.js | 13 + projects/karura-staking/index.js | 1 + projects/kasavadex/index.js | 4 +- projects/kassandra/index.js | 84 +- projects/kava-boost/index.js | 46 +- projects/kava-earn/index.js | 40 +- projects/kava-liquid/index.js | 36 +- projects/kavacave/index.js | 11 +- projects/kavacave/kavaAbi.json | 60 +- projects/kavafc/index.js | 19 + projects/kavastarter/index.js | 18 + projects/kccguru/index.js | 69 +- projects/kdex/index.js | 1 - projects/kebab-finance/index.js | 13 +- projects/keep3r/abis.js | 74 +- projects/keep3r/index.js | 194 +- projects/keep3r/registry.js | 15 +- projects/keeper-dao/abi/liquidity.json | 120 +- projects/keeper-dao/index.js | 139 +- projects/kefirswap/index.js | 7 +- projects/kei-finance/index.js | 38 + projects/key/index.js | 89 + projects/kiloex/index.js | 9 + projects/kimberlite/abi.json | 4 + projects/kimberlite/config.js | 56 + projects/kimberlite/index.js | 19 + projects/kinefinance/abi.json | 50 +- projects/kinefinance/index.js | 11 +- projects/kinesis/index.js | 19 +- projects/king-finance/index.js | 10 + projects/kintsugi/api.js | 2 +- projects/kinza/index.js | 11 + projects/kivach/index.js | 64 + projects/klaybank/abi/IDefiLlamaViewer.json | 103 - projects/klaybank/index.js | 9 +- projects/klaylend/index.js | 5 +- projects/klayportal/abi.json | 15 +- projects/klayswap-v3/index.js | 36 + projects/klayswap/index.js | 61 +- projects/klend/index.js | 8 +- projects/kleros/index.js | 2 +- projects/kleva-lend/index.js | 37 + projects/kleva/FairLaunch.json | 35 +- projects/kleva/index.js | 28 +- projects/klex/index.js | 24 +- projects/klima-dao/index.js | 5 +- projects/klondike/abi.json | 14 +- projects/kmex-io/index.js | 15 + projects/knightswap/index.js | 41 +- projects/koffeeswap/abi.json | 72 +- projects/koffeeswap/index.js | 98 +- projects/kogefarm/abi.json | 199 +- projects/kogefarm/helper.js | 25 +- projects/kogefarm/index.js | 29 +- projects/kokoa-finance/Helper.json | 72 +- projects/kokoa-finance/index.js | 9 +- projects/kokomo/index.js | 9 + projects/kokomoswap/abi.json | 51 +- projects/kokomoswap/index.js | 1 - projects/kokonut-swap/abi.json | 64 +- projects/kokonut-swap/index.js | 48 +- projects/kokoswap/abi.json | 51 +- projects/kokoswap/index.js | 1 - projects/kommunitas/index.js | 24 +- projects/konverter/contracts.json | 31 + projects/konverter/index.js | 16 + projects/koone/index.js | 9 + projects/koyo/constants.js | 42 +- projects/koyo/index.js | 144 +- projects/kperp-exchange/index.js | 4 +- projects/kriya-dex/index.js | 21 + projects/kromatika/abi.json | 87 +- projects/kromatika/index.js | 140 +- projects/kronos/index.js | 9 +- projects/kronosdao/index.js | 14 +- projects/ktx/index.js | 13 + projects/kucoin/index.js | 9 +- projects/kudexfinance/abi.json | 59 +- projects/kujira/index.js | 19 +- projects/kumu-finance/abi.js | 69 +- projects/kumu-finance/index.js | 6 +- projects/kurrency/index.js | 23 + projects/kuswap/index.js | 1 - projects/kuufinance/abi.json | 20 +- projects/kuufinance/index.js | 65 +- projects/kyber-classic/index.js | 62 + projects/kyber/abi.json | 101 +- projects/kyber/index.js | 29 +- projects/kyotoswap/index.js | 21 + projects/l2fibank-xyz/index.js | 9 + projects/l2finance/abi.json | 28 +- projects/l2finance/index.js | 46 +- projects/ladao-xocolatl/index.js | 26 + projects/lagobridge/index.js | 30 +- projects/landshare/index.js | 34 + projects/lanternswap/index.js | 7 +- projects/latoken/index.js | 142 + projects/latte/index.js | 38 +- projects/lazyfi/index.js | 9 + projects/leNFT/index.js | 51 + projects/leaguedao/api.js | 8 + projects/leaguedao/index.js | 9 +- projects/leetswap/index.js | 9 + projects/lemma/abis/perpLemmaWrapper.json | 14 +- projects/lemma/abis/perpV2Vault.json | 25 +- projects/lemma/index.js | 5 +- projects/lendexe/index.js | 34 + projects/lendflare/convexBooster.js | 2 +- projects/lendhub/abi.json | 77 +- projects/lendhub/index.js | 9 +- projects/lendle/index.js | 15 + projects/lenlen/index.js | 17 + projects/leonicornswap/index.js | 9 +- projects/letsfil/index.js | 28 + projects/level/index.js | 46 + projects/levinswap/index.js | 8 +- projects/levvy-fi/index.js | 19 + projects/lfgswap-arbitrum/index.js | 11 + projects/lfgswap-core/index.js | 21 + projects/lfgswap/index.js | 2 - projects/libre-swap/index.js | 51 + projects/lido/abis.json | 16 - projects/lido/index.js | 44 +- projects/lido/sol-helpers.js | 8 +- projects/lien/index.js | 3 +- projects/lif3-swap/index.js | 34 +- projects/lif3-trade/index.js | 10 + projects/lifedao/index.js | 3 +- projects/lighter/index.js | 19 + projects/line/index.js | 50 + projects/lineabank/index.js | 12 + projects/linear/abis.json | 44 +- projects/linear/index.js | 3 +- projects/lioncommerce/index.js | 19 + projects/liondex/index.js | 19 + projects/liqee/abi.json | 186 +- projects/liquid-bolt/index.js | 28 + projects/liquid-finance/index.js | 5 +- projects/liquiddriver/abi.json | 251 +- projects/liquiddriver/index.js | 602 +--- projects/liquidity-book/index.js | 21 - projects/liquidrium/abi.json | 24 +- projects/liquidrium/index.js | 26 +- projects/liquidrium/vaults.js | 25 +- projects/liquidswap-aptos/index.js | 19 +- projects/liquity/getEntireSystemColl.abi.json | 13 - projects/liquity/index.js | 19 +- projects/liqwid/index.js | 101 + projects/litxswap/index.js | 14 + projects/lixir/abi.json | 124 +- projects/lixir/index.js | 5 +- projects/llama-airforce/abi.json | 27 - projects/llama-airforce/index.js | 72 +- projects/llamalend/abi.json | 12 +- projects/llamalend/index.js | 29 +- projects/llamapay/abi.json | 44 +- projects/llamapay/index.js | 3 + projects/lobsterswap/index.js | 19 + projects/lodestar-v1/index.js | 52 + projects/lodestar/index.js | 55 + projects/lofty/index.js | 7 +- projects/logium/index.js | 40 +- projects/loop-finance/index.js | 143 +- projects/loopring/index.js | 15 +- projects/loterra/index.js | 30 +- projects/louverture/abi.json | 14 +- projects/lsdx/index.js | 33 + projects/luchadores/index.js | 26 +- projects/luckychip/index.js | 5 +- projects/luminous/index.js | 60 +- projects/lunafi/index.js | 18 + projects/lunggens-dex/index.js | 2 + .../lusd-chickenbonds/getTreasury.abi.json | 23 - projects/lusd-chickenbonds/index.js | 6 +- projects/luxor/api.js | 8 + projects/luxor/index.js | 9 +- projects/luxs.fi/index.js | 52 + projects/lybra/index.js | 12 + projects/lydia/index.js | 2 +- projects/lympo/index.js | 5 +- projects/lyra/index.js | 63 +- projects/macaron/abi.json | 120 +- projects/macaron/config.js | 5 +- projects/macaron/index.js | 9 +- projects/madmex/index.js | 2 +- projects/magicfox-vault/index.js | 45 + projects/magicfox/index.js | 13 + projects/magicianmv/index.js | 10 + .../magik-farm/config/vault/aurora_pools.js | 1 + .../config/vault/avalanche_pools.js | 1 + projects/magik-farm/config/vault/bsc_pools.js | 1 + .../magik-farm/config/vault/fantom_pools.js | 1 + projects/magik-farm/index.js | 10 +- projects/magpiexyz/abis/masterMagpie.json | 5 + projects/magpiexyz/abis/wombatPoolHelper.json | 3 + projects/magpiexyz/config.js | 19 + projects/magpiexyz/index.js | 65 +- projects/magpiexyz/pool.js | 250 -- projects/mahadao/bsc.js | 3 +- projects/mahadao/ethereum.js | 78 +- projects/mahadao/polygon.js | 3 +- projects/mahalend/index.js | 10 + projects/maia-dao-uni/index.js | 5 + projects/maia-dao/abis.json | 59 +- projects/maia-dao/api.js | 8 + projects/maia-dao/index.js | 9 +- projects/maiar/index.js | 24 +- projects/maker/abis/maker-mcd.js | 35 +- projects/maker/abis/makerdao.js | 5 +- projects/maker/index.js | 172 +- projects/makiswap/abi.json | 22 +- projects/mama-dao/index.js | 3 +- projects/mango-farmers-club/index.js | 18 + projects/mango-markets-v4/idl.json | 361 +++ projects/mango-markets-v4/index.js | 24 + projects/manhattan/abi.json | 28 +- projects/manhattan/index.js | 88 +- projects/manifest/index.js | 3 +- projects/manifesto/index.js | 33 + projects/mantleswap/index.js | 30 + projects/maple-rwa/index.js | 16 + projects/maple/abi.json | 90 +- projects/maple/index.js | 170 +- projects/mare-finance-v2/index.js | 11 + projects/mare-finance/index.js | 12 + projects/marginfi/idl.js | 763 +++++ projects/marginfi/index.js | 15 + projects/marginx/index.js | 30 + projects/market.xyz/abi.js | 71 +- projects/market.xyz/index.js | 7 +- projects/mars/index.js | 150 +- projects/marsecosystem/abi.json | 8 +- projects/marsecosystem/index.js | 10 +- projects/marshamallowdefi/abi.json | 40 +- projects/maskex/index.js | 34 +- projects/matrix.farm/index.js | 3 + projects/matrix/abi.json | 33 +- projects/matrixdock/index.js | 9 + projects/maverick/index.js | 73 + projects/maximizer/allocatorAbi.json | 56 +- projects/maximizer/index.js | 19 +- projects/maximizer/qiTokenAbi.json | 33 +- projects/maximizer/stableJoeStakingAbi.json | 30 +- projects/maximizer/stakingRewardsAbi.json | 20 +- projects/maximizer/veptpAbi.json | 20 +- projects/mayfair/index.js | 38 + projects/mcdex/index.js | 75 +- projects/mcs/index.js | 13 + projects/mdex/abi.json | 39 - projects/mdex/api.js | 21 - projects/mdex/index.js | 36 +- projects/mdex/subgraphs.js | 91 - projects/meanfinance/addresses.js | 43 +- projects/meanfinance/index.js | 15 +- projects/megamoon/index.js | 23 + projects/megatonfi/index.js | 26 + projects/meld-gold/index.js | 45 + projects/meld/index.js | 25 +- projects/meme-dollar/index.js | 27 + projects/memedex/index.js | 8 + projects/mensa/abi.json | 304 -- projects/mensa/index.js | 77 +- projects/mento/index.js | 3 +- projects/meowfinance/abi.json | 105 +- projects/meowfinance/index.js | 16 +- projects/mercurity/abi.json | 16 +- projects/mercurity/index.js | 82 +- projects/merkl/index.js | 29 + projects/merlin/index.js | 9 + projects/merlinlab/index.js | 2 +- projects/merlinlab/staking.json | 16 +- projects/merlinlab/vault.json | 18 +- projects/mero/abi.json | 62 +- projects/meshswap/index.js | 66 +- projects/messinaone/index.js | 45 + projects/metacoin/index.js | 22 + projects/metaid/index.js | 16 + projects/metalswap/index.js | 25 +- projects/metapoly/abi.json | 26 +- projects/metareserve/index.js | 3 +- projects/metastreet-v2/abi.json | 6 + projects/metastreet-v2/index.js | 102 + projects/metastreet/abi.json | 59 +- projects/metastreet/index.js | 4 +- projects/metaswap/index.js | 8 + projects/metatdex/index.js | 14 +- projects/metavault-bo/index.js | 8 + projects/metavault.trade/abi.js | 34 +- projects/metavault/index.js | 7 +- projects/metavault/mvlpManager.json | 14 +- projects/metavault/reader.json | 25 +- projects/metaversepro/index.js | 7 +- projects/metavisor/index.js | 49 + projects/meter-Liquid-Staking/index.js | 21 + projects/meterBridge/addresses.json | 108 +- projects/meterBridge/index.js | 19 +- projects/metf-finance/TreasuryContract.json | 19 - projects/metf-finance/getPairPrice.json | 29 - projects/metf-finance/index.js | 6 +- projects/metf-finance/valueOfAsset.json | 29 - projects/metronome-synth/index.js | 38 + projects/metronome/index.js | 66 +- projects/metropolis/index.js | 36 + projects/mexc-cex/index.js | 44 + projects/mfinance/abi.json | 35 +- projects/mfinance/index.js | 21 - projects/miaswap/index.js | 8 + projects/midas-capital/index.js | 66 +- projects/milkomeda-djed/abi.json | 5 + projects/milkomeda-djed/config.json | 10 + projects/milkomeda-djed/index.js | 24 + projects/milkomeda-macc/abi.json | 3 + projects/milkomeda-macc/index.js | 16 + projects/mimo/index.js | 19 +- projects/mindgames/index.js | 34 +- projects/minerswap/index.js | 5 +- projects/minerva/index.js | 9 + projects/minimax/index.js | 69 +- projects/miningtycoon/index.js | 5 +- projects/minipanther/index.js | 7 +- projects/minmax-finance/index.js | 23 +- projects/minotaur-money/index.js | 5 +- projects/minswap/index.js | 16 +- projects/mintswap/index.js | 3 +- projects/mirror/index.js | 89 +- projects/mirrosset/index.js | 17 + projects/mm-finance-arbitrum-v3/index.js | 8 + projects/mm-finance-arbitrum/index.js | 19 + projects/mm-finance-polygon/index.js | 1 - projects/mm-finance/index.js | 1 - projects/mm-stableswap-polygon/index.js | 9 +- projects/mm-stableswap/index.js | 7 +- projects/mmo-finance-polygon/abi.json | 19 - projects/mmo-finance-polygon/index.js | 2 +- projects/mmo-finance/abi.json | 19 - projects/mmo-finance/genericVaultBalance.json | 15 - projects/mmo-finance/index.js | 6 +- projects/mmo-finance/valueOfAsset.json | 29 - .../mmo/helper/abis/MEtherInterfaceFull.json | 59 - .../helper/abis/MtrollerInterfaceFull.json | 58 - projects/mmo/helper/helper.js | 28 +- projects/mmo/index.js | 12 +- projects/mobius/index.js | 51 +- projects/mobiusfinance/abis/Resolver.json | 72 - projects/mobiusfinance/index.js | 23 +- projects/mochifi/index.js | 24 +- projects/mochiswap/index.js | 2 - projects/mojitoswap/index.js | 3 +- projects/mole/abi.json | 136 +- projects/mole/index.js | 36 +- projects/mole/lyf.js | 241 +- projects/mole/utils.js | 12 + projects/mole/xmole.js | 7 +- projects/monolend/index.js | 6 + projects/monolith/abis.json | 13 + projects/monolith/index.js | 58 + projects/monopoly-finance/abi.json | 10 + projects/monopoly-finance/index.js | 37 + projects/monox/index.js | 19 +- projects/moola/index.js | 3 +- projects/moondao/index.js | 6 +- projects/mooniswap/abi.json | 48 +- projects/moonlift/index.js | 1 - projects/moonswap/index.js | 1 - projects/moonswap/onchain.js | 24 +- projects/moraswap/index.js | 14 + projects/moremoney/StakingMetadata.js | 85 +- projects/moremoney/StrategyMetadata.js | 25 +- projects/moremoney/StrategyViewer.json | 109 +- projects/moret/index.js | 20 + projects/morpheusswap/abi.json | 61 +- projects/morpheusswap/index.js | 8 +- projects/morphex/index.js | 24 + projects/morpho-aave/index.js | 3 +- projects/morpho-aaveV3/addresses.js | 3 + projects/morpho-aaveV3/index.js | 60 + projects/morpho-aaveV3/markets.js | 17 + projects/morpho/addresses.js | 3 +- projects/morpho/index.js | 3 +- projects/mosquitos-finance/helper.js | 16 + projects/mosquitos-finance/index.js | 148 + projects/move-dollar/index.js | 43 + projects/mover/abi.json | 28 +- projects/mover/baseLedgerPoolAbi.json | 14 +- projects/mover/index.js | 5 +- projects/mover/savingsPlusPoolAbi.json | 14 +- projects/mover/savingsPoolAbi.json | 16 +- projects/mstable-yield/index.js | 27 + projects/mstable/abi-massetv1.json | 53 +- projects/mstable/abi-massetv2.json | 54 +- projects/mt-gox/index.js | 89 + projects/mtgo/index.js | 38 +- projects/muesliswap/index.js | 134 +- projects/mufex/index.js | 13 + projects/mugen-fi/index.js | 17 + projects/multialt-stacking/index.js | 15 + projects/multiplierfinance/abi.json | 148 +- projects/multiplierfinance/index.js | 4 +- projects/mummy/index.js | 34 + projects/mustcometh/index.js | 12 +- projects/mute/index.js | 29 + projects/muuu/abi.json | 270 +- projects/muuu/index.js | 1 - projects/muuu/tvl.js | 227 +- projects/muuu/utils.js | 11 - projects/mux/abi.json | 338 +-- projects/mux/index.js | 17 +- projects/mversex/index.js | 7 + projects/mycelium/index.js | 2 +- projects/mymetatrader/index.js | 21 + projects/myso/index.js | 70 + projects/myswap/abi.js | 102 + projects/myswap/api.js | 32 + projects/myswap/index.js | 1 + projects/nacho-finance/index.js | 2 +- projects/naos/index.js | 78 +- projects/narwhal-finance/index.js | 19 + projects/native/index.js | 32 + projects/nava-finance/index.js | 3 +- projects/navi/index.js | 43 + projects/nayms/index.js | 21 + projects/nearpad/index.js | 11 +- projects/nemesis-dao/index.js | 3 +- projects/neopin-liquid-staking/index.js | 32 + projects/neopin-staking/index.js | 28 + projects/neopin/index.js | 9 + projects/neptune-mutual/index.js | 40 +- projects/nereus/index.js | 11 +- projects/nerve/index.js | 98 +- projects/nervenetworkbridge/index.js | 123 + projects/nerveswap/index.js | 17 + projects/nest/index.js | 6 +- projects/nested/abi.json | 2 +- projects/nested/index.js | 14 +- projects/nestfi/index.js | 53 + projects/neutra-finance/index.js | 24 + projects/neutrino/index.js | 9 +- projects/neutroswap/index.js | 8 + projects/newland/abi.json | 144 +- projects/newland/index.js | 1 - projects/newspace/index.js | 5 +- projects/nex/index.js | 4 +- projects/nexo-cex/index.js | 77 + projects/nexon/index.js | 14 + projects/nexus-protocol/index.js | 29 +- projects/nexus/index.js | 85 +- projects/nft360/index.js | 15 + projects/nftb/abi.json | 40 +- projects/nftfi/helper/index.js | 53 - projects/nftfi/index.js | 16 +- projects/nftperp/index.js | 18 + projects/nftx/abi.json | 34 +- projects/nftx/index.js | 16 +- projects/nidhi-dao/index.js | 20 +- projects/nightmare/index.js | 3 + projects/nirvana/index.js | 3 + projects/nitron/index.js | 64 + projects/noahark/index.js | 8 + projects/noaharkdao/index.js | 3 +- projects/node-dao/index.js | 33 + projects/nodoka/index.js | 3 +- projects/nodoka/uniswapV3.json | 27 - projects/nomad/index.js | 19 +- projects/nomiswap/index.js | 4 +- projects/nord-finance/config.js | 41 +- projects/northpole/abi.json | 16 +- projects/northpole/index.js | 3 +- projects/nostra/abi.js | 33 + projects/nostra/index.js | 32 + projects/notiboy/index.js | 6 + projects/notional/abi.json | 34 +- projects/notional/index.js | 70 +- projects/nowswap/index.js | 3 + projects/nsure/abi.json | 53 +- projects/nsure/index.js | 5 +- projects/nucleon/index.js | 23 + projects/numisme/abi.json | 58 +- projects/numoen/index.js | 56 + projects/nuon/index.js | 8 + projects/nutbox/index.js | 30 + projects/o2-dao/index.js | 36 +- projects/oasisswapdex/index.js | 20 + projects/obric/index.js | 8 + projects/ocean-one/index.js | 3 + projects/ocean-protocol/abi.json | 10 +- projects/oceanus/index.js | 1 - projects/octane/index.js | 3 +- projects/octolsd/index.js | 31 + projects/octopow/index.js | 1 - projects/oddz/index.js | 17 +- projects/oh-finance/abi.json | 28 +- projects/ohmw/index.js | 6 +- projects/oin-finance/abi.json | 46 +- projects/oin-finance/index.js | 3 +- projects/okc-liquid-staking/index.js | 9 + projects/okcoin/index.js | 120 + projects/okcswap/index.js | 1 - projects/okex/index.js | 7 +- projects/olafinance/index.js | 10 +- projects/olivecash/abi.json | 51 +- projects/olivecash/index.js | 94 +- projects/olivedao/index.js | 5 +- projects/olympulsex/index.js | 12 + projects/olympus/abi.json | 44 +- projects/olympus/api.js | 8 + projects/olympus/index.js | 197 +- projects/omaxswap/index.js | 3 + projects/omicron/api.js | 8 + projects/omicron/index.js | 5 +- projects/omm/index.js | 3 + projects/omnidex-lend/abi.json | 23 +- projects/omnidex-perpetuals/index.js | 10 + projects/omnidex/index.js | 1 + projects/omniprotocol/helper.js | 101 - projects/omniprotocol/index.js | 130 +- projects/omniprotocol/omni.json | 141 +- projects/omt-finance/index.js | 7 + projects/onavax/index.js | 1 - projects/onc/index.js | 49 + projects/ondofinance-v1/abi.json | 3 + projects/ondofinance-v1/index.js | 128 + projects/ondofinance/abi.json | 130 - projects/ondofinance/index.js | 108 +- projects/one-ring/abi.json | 28 +- projects/one-ring/index.js | 8 +- projects/onedaofinance/index.js | 3 +- projects/onedex/index.js | 8 + projects/oneswap/index.js | 53 +- projects/onsenswap/index.js | 13 + projects/onus-usdo/index.js | 8 + projects/onyx/index.js | 16 + projects/onyxdao-farm/index.js | 8 + projects/ooki/abi.json | 133 +- projects/ooki/index.js | 249 +- projects/ooki/itoken.json | 66 +- projects/ooki/masterchef.json | 37 +- projects/ooki/registry.json | 39 +- projects/oolongswap/index.js | 1 - projects/oortswap/index.js | 1 - projects/openbook/index.js | 59 +- projects/opendao/abi.json | 150 +- projects/openeden-tbill/index.js | 12 + projects/openleverage/index.js | 164 +- projects/opensky/index.js | 116 +- projects/openswap_harmony/index.js | 1 - projects/openworld/index.js | 7 + projects/openxswap/index.js | 17 + projects/optidoge/index.js | 3 +- projects/optifi/index.js | 3 +- projects/optim-liquidity-bonds/index.js | 13 + projects/optinyan/index.js | 3 +- projects/optitude/index.js | 11 + projects/optyfi/index.js | 32 +- projects/opx/index.js | 2 +- projects/opyn-convexity/index.js | 35 + projects/opyn-gamma/gamma_avax.js | 7 + projects/opyn-gamma/gamma_ethereum.js | 28 + projects/opyn-gamma/gamma_polygon.js | 10 + projects/opyn-gamma/index.js | 17 + projects/opyn-squeeth/index.js | 33 + projects/opyn/abis/convexity/collateral.json | 14 - .../getNumberOfOptionsContracts.json | 14 - .../opyn/abis/convexity/optionsContracts.json | 19 - .../abis/gamma/isWhitelistedCollateral.json | 20 - projects/opyn/convexity.js | 115 - projects/opyn/gamma.js | 85 - projects/opyn/gamma_avax.js | 23 - projects/opyn/gamma_polygon.js | 47 - projects/opyn/index.js | 30 - projects/opyn/squeeth.js | 36 - projects/oraidex/index.js | 12 + projects/orbitbridge/index.js | 91 +- projects/orbiter-one/index.js | 11 + projects/orca-kujira/index.js | 21 + projects/orca/index.js | 237 +- projects/orcadao/abi.json | 10 +- projects/orcadao/index.js | 21 +- projects/orcus/abi.js | 20 +- projects/orcus/index.js | 5 +- projects/ordernchaos/index.js | 37 - projects/oreoswap/index.js | 22 + projects/origindollar/abi.json | 60 +- projects/originether/index.js | 38 + projects/orio/index.js | 23 + projects/orion-money/abi.json | 221 -- projects/orion-money/index.js | 62 +- projects/orionprotocol/index.js | 4 +- projects/oswap-token/index.js | 44 + projects/otterclam.js | 12 - projects/overnight-daiPlus/index.js | 28 + projects/overnight-usdPlus/index.js | 34 + projects/overnight-usdtPlus/index.js | 26 + projects/ovnstable.js | 45 - projects/ovr/index.js | 26 +- projects/owna/config.js | 13 + projects/owna/index.js | 94 + projects/oxygen/idl.js | 661 +---- projects/oxygen/index.js | 111 +- projects/pacman/index.js | 32 + projects/padswap/index.js | 2 +- projects/paintswap/abis/getReserves.json | 25 - projects/pairex/index.js | 26 + projects/pala/abi.json | 128 +- projects/paladin-dao/index.js | 3 +- projects/paladinfinance-warlord/abi.json | 5 + projects/paladinfinance-warlord/index.js | 45 + projects/paladinfinance/abi.json | 49 +- projects/paladinfinance/index.js | 3 +- projects/palmaswap/index.js | 26 + projects/palmswap/index.js | 14 + projects/pancake-swap-stableswap/index.js | 39 + .../index.js} | 36 +- projects/pancakeswap-v3/index.js | 16 + projects/pandachef/index.js | 24 + projects/pandaland/index.js | 35 +- projects/pandaswap/abi.json | 36 - projects/pandaswap/index.js | 8 +- projects/pandora-digital/index.js | 10 +- projects/pangolin/index.js | 28 +- projects/pantherswap/index.js | 13 +- projects/papa-dao/index.js | 5 +- projects/paperdao/index.js | 3 +- projects/papr-wtf/index.js | 20 + projects/paprprintr/index.js | 48 +- projects/parallax/abis/prllxERC20.json | 4 + projects/parallax/contracts.json | 26 + projects/parallax/getPrice.js | 89 + projects/parallax/index.js | 157 + projects/paraluni-dex/index.js | 8 + projects/paraspace-ape-staking/index.js | 59 + .../paraspace/helper/abis/ApeCoinStaking.json | 3 + projects/paraspace/helper/abis/ERC721.json | 3 + .../helper/abis/UiPoolDataProvider.json | 4 + projects/paraspace/helper/abis/index.js | 9 + projects/paraspace/helper/address.js | 28 + projects/paraspace/helper/index.js | 50 + projects/paraspace/index.js | 25 + projects/parasset/index.js | 5 +- projects/parcl/index.js | 208 ++ projects/paribus/index.js | 4 + projects/pawnfi-ape-staking/index.js | 26 + projects/pawnfi-lending/index.js | 43 + projects/pawnfi-nft/index.js | 19 + projects/pawnfi/helper/abi.json | 4 + projects/pawnfi/helper/config.js | 25 + projects/pawnfi/index.js | 12 + projects/paxo-finance/index.js | 7 + projects/peakdefi/index.js | 158 +- projects/peaky-finance/index.js | 5 +- projects/peardao/index.js | 12 +- projects/pearlfi/index.js | 10 + projects/pegasusdao/index.js | 10 - projects/pegasusfinance/index.js | 6 +- projects/pegasys-v3/index.js | 5 + projects/pegasys/index.js | 1 - projects/pembrock/index.js | 3 +- projects/pendle/abi.json | 96 +- projects/pendle/index.js | 24 +- projects/pendle/v1.js | 80 +- projects/pendle/v2.js | 156 +- projects/penguin/abi.json | 60 +- projects/penpie/config.js | 23 + projects/penpie/index.js | 27 + projects/penrose/abi.js | 161 +- projects/pepe-bridge/index.js | 53 + projects/pepe-swaves/index.js | 19 + projects/pepedex/index.js | 12 + projects/percent/abi.json | 32 +- projects/percent/index.js | 76 +- projects/perennial/index.js | 15 + projects/perifinance/abi.json | 22 +- projects/perifinance/index.js | 4 +- projects/perion/index.js | 9 + projects/perlinx/abi.json | 124 +- projects/perlinx/index.js | 2 +- projects/perp/index.js | 54 +- projects/perp88/index.js | 28 +- projects/phantom-finance/index.js | 3 + projects/pheasantswap/index.js | 5 + projects/phemex/index.js | 17 + projects/phenix-dex/index.js | 17 + projects/phezzan/index.js | 45 + projects/phission-finance/index.js | 3 +- projects/phoenix-bonds/index.js | 27 + projects/phoenix-dex/index.js | 5 +- projects/phoenix/abi.json | 20 +- projects/phoenix/index.js | 3 +- projects/photon-protocol/index.js | 3 +- projects/photonswap/index.js | 3 - projects/phuture/abis/Index.abi.json | 47 +- projects/phuture/abis/SavingsVault.abi.json | 28 +- projects/phuture/abis/vToken.abi.json | 16 +- projects/phuture/abis/vTokenFactory.abi.json | 20 +- projects/phuture/index.js | 43 +- projects/phux/index.js | 16 + projects/pickle/index.js | 4 +- projects/pidao-finance/index.js | 7 +- projects/piedao/pieDAO.js | 22 +- projects/piggy/abi.json | 13 - projects/piggy/index.js | 10 +- projects/piggybankdao/index.js | 3 +- projects/pika-v4/index.js | 10 + projects/pilotprotocol/abi.json | 107 +- projects/pilotprotocol/index.js | 4 +- projects/pine-protocol/index.js | 44 + projects/pinjam/index.js | 60 + projects/pinkpea/index.js | 5 +- projects/pinkpea/lens.json | 68 +- projects/pinksale/abi.js | 143 +- projects/pinksale/apiCache.js | 9 +- projects/pinksale/config.js | 3 + projects/pinkswap/abi.json | 38 +- projects/pinkswap/index.js | 1 - projects/pinnako/index.js | 17 + projects/pippifinance/abi.json | 49 +- projects/pippifinance/index.js | 2 +- projects/pirex/abi.json | 13 + projects/pirex/index.js | 73 +- projects/pizza/index.js | 6 +- projects/planet-blue/index.js | 1 - projects/planet-finance/abi.json | 105 +- projects/planet-finance/index.js | 23 +- projects/planet-green/index.js | 12 +- projects/platypus-finance/constants.js | 261 -- projects/platypus-finance/index.js | 65 +- projects/plenty/index.js | 34 +- projects/pls2e/index.js | 1 - projects/pluto/index.js | 12 +- projects/plutusDAO/index.js | 11 +- projects/pocm-staking/index.js | 15 + projects/pods-yield/constants.js | 24 +- projects/podsfinance/constants.js | 3 +- projects/poison-finance/index.js | 37 + projects/polaris-finance/abi.json | 54 +- projects/polaris-finance/index.js | 89 +- projects/polkaex/index.js | 35 +- projects/polkamarkets/index.js | 2 +- projects/pollyfinance/index.js | 84 +- projects/polycat-dex/index.js | 15 + projects/polycat/abi.json | 81 +- projects/polycat/index.js | 188 +- projects/polydex/index.js | 14 +- projects/polygon/index.js | 106 +- projects/polynetwork/index.js | 7 + projects/polynomial-earn/abi.json | 8 + projects/polynomial-earn/abi2.json | 8 + .../{polynomial => polynomial-earn}/index.js | 61 +- projects/polynomial-trade/index.js | 24 + projects/polynomial/abi.json | 8 - projects/polynomial/abi2.json | 80 - projects/polyo-exchange/index.js | 7 +- projects/polyquail/abi.json | 40 +- .../polyquity/getEntireSystemColl.abi.json | 13 - projects/polyquity/index.js | 10 +- .../{qidao/abi.json => polysynth/bps.json} | 2 +- projects/polysynth/index.js | 229 +- projects/polysynth/vault.json | 14 +- projects/polytrade/index.js | 35 + projects/pond/index.js | 11 +- projects/ponyswap/index.js | 9 + projects/ponytaswap/index.js | 11 + projects/poofcash/index.js | 13 +- projects/pooltogether/abi.json | 14 +- projects/pooltogether/index.js | 8 +- projects/poopsicle/abi.json | 17 +- .../popcorn/abi/basicSetIssuanceModule.json | 29 - .../popcorn/abi/butterBatchProcessing.json | 24 - projects/popcorn/abi/curveMetapoolABI.json | 13 - projects/popcorn/abi/yearnVaultABI.json | 13 - projects/popcorn/butter.js | 4 +- projects/popcorn/constants.js | 20 +- projects/popcorn/index.js | 13 +- projects/popcorn/vault.js | 17 + projects/popsicle/index.js | 94 +- projects/poptown/abi.json | 98 +- projects/poptown/index.js | 3 +- projects/portfinance/index.js | 19 +- projects/potluckprotocol/abi.json | 61 +- projects/powaa-protocol/index.js | 31 +- projects/powerbomb/abi.json | 16 +- projects/powerbomb/index.js | 32 +- projects/powerindex/abi.json | 89 +- projects/powerindex/index.js | 141 +- projects/powerswap/index.js | 1 - projects/powswap/index.js | 1 - projects/prdt/index.js | 10 +- projects/prePo/index.js | 34 + projects/predy-v3/index.js | 33 + projects/predy-v320/index.js | 34 + projects/predy-v5/index.js | 39 + projects/predy/index.js | 61 +- projects/premia/abi.json | 18 +- projects/premia/index.js | 7 +- projects/premia/v1.js | 5 +- projects/premio/index.js | 15 + projects/prime-protocol/index.js | 238 ++ projects/primitive/.prettierrc | 4 - projects/primitive/abi.json | 4 +- .../primitive/abis/getAssetAddresses.json | 23 - projects/primitive/abis/getCacheBalances.json | 18 - projects/primitive/abis/getPair.json | 26 - projects/primitive/abis/getReserves.json | 25 - .../primitive/abis/getStrikeTokenAddress.json | 13 - .../abis/getUnderlyingTokenAddress.json | 13 - projects/primitive/abis/redeemToken.json | 13 - projects/primitive/abis/token0.json | 15 - projects/primitive/abis/token1.json | 15 - projects/primitive/v1.js | 29 +- projects/printerfinancial/helper.js | 4 +- projects/printy/index.js | 8 + projects/prism/index.js | 21 +- projects/privcash/config.js | 27 + projects/privcash/index.js | 13 + projects/protectorate/index.js | 7 + projects/proteo-farms/index.js | 35 + projects/protofi/index.js | 2 +- projects/proton-dex/index.js | 82 + projects/proton-loan/index.js | 4 +- projects/protoss-dex/abi.js | 87 + projects/protoss-dex/api.js | 38 + projects/protoss-dex/index.js | 1 + projects/prxy/abi.json | 13 - projects/prxy/index.js | 9 +- projects/pstake/index.js | 159 +- projects/psyoptions/index.js | 95 +- projects/psyoptions/psyFiMmIdl.json | 202 ++ projects/psyoptions/psyLendIdl.json | 380 +++ projects/psyoptions/psyfiV2Idl.json | 302 ++ projects/puddingswap/index.js | 1 - projects/puli/index.js | 22 +- projects/pulsarswap/index.js | 20 + projects/pulsedao/index.js | 3 + projects/pulsemaxfinance/index.js | 17 + projects/pulserate/index.js | 22 + projects/pulsex-v2/index.js | 8 + projects/pulsex/index.js | 10 + projects/pumpkin-dao/index.js | 7 +- projects/purple-bridge-dex/index.js | 8 + projects/puzzle-lend/index.js | 3 + projects/pxswap/index.js | 10 + projects/pyeswap/index.js | 1 - projects/pylon/index.js | 65 +- projects/qian/abi.json | 48 +- projects/qidao/index.js | 914 ++---- projects/qilin/index.js | 15 +- projects/quadrat/index.js | 66 + projects/quantumx-network/api.js | 1 + projects/quantumx-network/index.js | 8 + projects/quarry/index.js | 87 +- projects/quarry/msolLP.js | 37 - projects/quasar-swap/index.js | 4 +- projects/quasar/index.js | 66 + projects/qubit/abi.json | 78 +- projects/qubit/index.js | 3 +- projects/quicksilver/index.js | 49 + projects/quickswap-perps/index.js | 7 + projects/quickswap-v3/index.js | 88 +- projects/quickswap/index.js | 2 +- projects/quipuswap-stableswap/index.js | 52 + projects/quipuswap-v2/index.js | 16 + projects/quipuswap-v3/index.js | 12 + projects/quipuswap/index.js | 16 +- projects/quoll/abi.json | 178 +- projects/quoll/index.js | 100 +- projects/rabbitfinance/abi.json | 14 +- projects/rabbitfinance/index.js | 9 +- projects/rabbitx/index.js | 8 + projects/radao/index.js | 3 +- projects/radial/index.js | 27 +- projects/radiant-v2/index.js | 18 + projects/radiant/index.js | 20 +- projects/radiate-protocol/index.js | 17 + projects/radioshack/index.js | 3 +- projects/raft/index.js | 23 + projects/ragetrade/index.js | 47 +- projects/ragetrade/tricrypto-vault.json | 13 - projects/ragnarokdao/index.js | 3 +- projects/raidshift/index.js | 37 + projects/railgun/ABI.json | 215 -- projects/railgun/index.js | 61 +- projects/ramp/abi.json | 42 +- projects/ramses-cl/index.js | 5 + projects/ramses/index.js | 10 + projects/range/abi.json | 3 + projects/range/index.js | 39 + projects/rari/abi.json | 144 +- projects/rari/index.js | 85 +- projects/ray/abis/Opportunity.json | 21 - projects/ray/index.js | 236 +- projects/rbx/index.js | 19 + projects/rcpswap/index.js | 1 - projects/reactorfusion/index.js | 8 + projects/realtmarkets/abi.json | 103 +- projects/realtmarkets/index.js | 96 +- projects/reaper.farm/index.js | 12 + projects/reax-one-dex/index.js | 14 + projects/reax-one-lending/index.js | 7 + projects/reax-one-synth/index.js | 16 + projects/redacted/index.js | 19 +- projects/redbees/index.js | 8 - projects/redemption/index.js | 1 - projects/reflexer/index.js | 3 +- projects/rehold-v2/index.js | 24 + projects/rehold/index.js | 27 + projects/relayChain/index.js | 125 +- projects/ren/index.js | 3 +- projects/reserve/index.js | 98 +- projects/resonatefinance/index.js | 41 + projects/retro/index.js | 8 + projects/retrodefi/abi.json | 75 +- projects/retrodefi/index.js | 1 + projects/revault/RevaChef.json | 42 +- projects/revault/index.js | 6 +- projects/revert-compoundor/index.js | 3 + projects/revert-v3-staker/index.js | 4 + projects/revest/index.js | 306 +- projects/rhea/index.js | 5 +- projects/ribbon-earn/index.js | 21 +- projects/ribbon-lend/index.js | 33 +- projects/ribbon/abi.json | 2 +- projects/ribbon/evm.js | 45 +- projects/ribbon/solana.js | 156 +- projects/rift-finance/abis/masterChefAbi.js | 38 - projects/rift-finance/abis/riftVaultAbi.js | 67 - projects/rift-finance/index.js | 18 +- projects/rigoblock/index.js | 67 + projects/rikkei-finance/index.js | 3 +- projects/ripae/index.js | 11 + projects/rising-undead/index.js | 16 + projects/risk-harbor/index.js | 247 +- projects/roaring-lion/index.js | 16 +- projects/robovault/index.js | 54 +- projects/rocifi-v2/index.js | 64 + projects/rocifiv1/index.js | 94 +- projects/rocketpool/abi.json | 208 +- projects/rocketpool/index.js | 5 +- projects/rocketswap-cc/index.js | 6 + projects/rodeo/abi.json | 3 + projects/rodeo/index.js | 26 + projects/roe/index.js | 10 + projects/rollup-fi/index.js | 7 + projects/rose-finance/index.js | 28 + projects/rose/abi.json | 67 +- projects/rose/index.js | 11 +- projects/routerprotocol/index.js | 57 +- projects/rubic/index.js | 21 +- projects/rubicon/index.js | 78 +- projects/ruby-exchange-stable/index.js | 14 + projects/ruby-exchange/index.js | 9 + projects/rubydex/index.js | 22 + projects/rubyfinance/index.js | 6 +- projects/rugdao/index.js | 5 +- projects/ruler/index.js | 74 +- projects/ryoshi/index.js | 74 +- projects/rysk/index.js | 29 + projects/sablier-v2/index.js | 57 + projects/sablier/index.js | 74 +- projects/saddle/config.json | 852 ------ projects/saddle/contracts.json | 9 + projects/saddle/index.js | 98 +- projects/safedollar/index.js | 7 +- projects/safeohm/index.js | 3 +- projects/saffron/abi.json | 35 +- projects/sagebet/index.js | 11 + projects/saharadao/abi.json | 46 +- projects/saitaswap/index.js | 13 + projects/sakai-vault/index.js | 13 + projects/sakeperp/abi.json | 50 +- projects/sakeperp/index.js | 3 +- projects/salem/index.js | 5 +- projects/salsa/index.js | 16 + projects/samodao/index.js | 3 +- projects/sandclock/index.js | 40 + projects/sapphire/index.js | 7 +- projects/sashimidao/index.js | 7 +- projects/sashimiswap/index.js | 195 +- projects/satin/index.js | 12 + projects/satori/index.js | 24 + projects/satoshiswap/index.js | 11 + projects/savvy/contracts.json | 46 + projects/savvy/index.js | 16 + projects/scallop/index.js | 57 +- projects/scanto/index.js | 13 + projects/scarecrow-raven/abi.json | 59 +- projects/scarecrow-raven/index.js | 57 +- projects/scaryswap/contracts.json | 23 + projects/scaryswap/index.js | 30 +- projects/scaryswap/pool.json | 1 + projects/scientixfinance/abi/AlpacaVault.json | 28 - projects/scientixfinance/abi/ScToken.json | 36 - projects/scientixfinance/abi/Scientist.json | 15 - .../scientixfinance/abi/StakingPools.json | 22 - projects/scientixfinance/abi/Transmuter.json | 15 - .../scientixfinance/abi/VotingEscrow.json | 16 - .../abi/YearnVaultAdapterWithIndirection.json | 16 - projects/scientixfinance/index.js | 32 +- projects/scion-finance/abis/scionVaultAbi.js | 14 +- projects/scion-finance/addresses.js | 3 +- projects/scream/index.js | 3 +- projects/scrub/index.js | 69 +- projects/scrubKava/index.js | 23 - projects/scrubinvest/index.js | 70 + projects/sealightswap/index.js | 1 - projects/seashell/index.js | 13 + projects/sector-fi/index.js | 49 + projects/securedao/index.js | 3 +- projects/securofinance/abiLci.json | 12 +- projects/seeder/abi.json | 96 +- projects/seeder/index.js | 3 +- projects/selfex/index.js | 11 + projects/sencha/index.js | 5 +- projects/senpai/index.js | 9 +- projects/sense/index.js | 256 +- projects/sentiment/index.js | 86 +- projects/set-protocol/abis/getPositions.json | 40 - projects/set-protocol/abis/getReserves.json | 25 - projects/set-protocol/abis/getSets.json | 13 - projects/set-protocol/abis/totalSupply.json | 13 - projects/set-protocol/v1.js | 30 +- projects/set-protocol/v2.js | 21 +- projects/sevenswap/index.js | 7 + projects/sfinance/index.js | 71 +- projects/sft-protocol/index.js | 52 + projects/shadecash/index.js | 11 +- projects/shadeprotocol-derivatives/index.js | 15 + projects/shadeprotocol-lend/index.js | 24 + projects/shadeprotocol-silk/index.js | 15 + projects/shadeprotocol-swap/index.js | 17 + projects/shadeswap/index.js | 17 + projects/shadowswap/index.js | 11 + projects/shapeshift/index.js | 27 +- projects/sharedstake/index.js | 3 +- projects/sharelock/index.js | 7 + projects/sharkswap/index.js | 1 - projects/sharky/helper/index.js | 47 + projects/sharky/helper/sharky.json | 196 ++ projects/sharky/index.js | 7 + projects/sharkyswap/index.js | 12 + projects/sheepdex/abi.json | 28 +- projects/shell/index.js | 54 +- projects/sherlock/abi.json | 16 +- projects/sherlock/index.js | 3 +- projects/sherlock/sherlockV2abi.json | 16 +- projects/sherlock/usdcabi.json | 12 +- projects/shibance-bsc/abi.json | 54 - projects/shibance-bsc/constants/abi.json | 49 - .../shibance-bsc/constants/bsc/contracts.js | 22 - projects/shibance-bsc/constants/bsc/farms.js | 215 -- projects/shibance-bsc/constants/bsc/pools.js | 79 - projects/shibance-bsc/constants/bsc/tokens.js | 134 - projects/shibance-bsc/constants/chain.js | 4 - .../shibance-bsc/constants/kcc/contracts.js | 14 - projects/shibance-bsc/constants/kcc/farms.js | 105 - projects/shibance-bsc/constants/kcc/pools.js | 39 - projects/shibance-bsc/constants/kcc/tokens.js | 72 - projects/shibance-bsc/farm.js | 318 -- projects/shibance-bsc/format.js | 44 - projects/shibance-bsc/index.js | 112 - projects/shibance-bsc/pool.js | 78 - projects/shibance-bsc/vault.js | 83 - projects/shibaswap/index.js | 16 +- projects/shibshift/index.js | 8 + projects/shibui/index.js | 22 +- projects/shield/index.js | 3 +- projects/shiftdollar/index.js | 3 +- projects/shipyard-finance/abi.json | 32 +- projects/shipyard-finance/index.js | 11 +- projects/shoebillFinance/index.js | 46 + projects/shrike-perps/index.js | 7 + projects/sierra/index.js | 3 + projects/sigmafi/index.js | 26 + projects/sigmao/index.js | 34 + projects/sigmausd/index.js | 23 +- projects/silkroad-fbifunds/index.js | 14 + projects/silo/index.js | 144 +- projects/silodefi/index.js | 8 +- projects/single/abi.js | 29 + projects/single/cronos/vvsPoolInfo.json | 34 - .../fantom/spookyMasterChefV2PoolInfo.json | 19 - projects/single/helpers.js | 78 +- projects/single/index.js | 60 +- projects/singularfarm/avaxAbi.json | 72 +- projects/singularfarm/bscAbi.json | 72 +- projects/singularfarm/ftmAbi.json | 77 +- projects/singularfarm/polyAbi.json | 72 +- projects/singularityDAO/abi.json | 48 +- projects/singularityDAO/index.js | 111 +- projects/sio2/abi.json | 401 --- projects/sio2/constants.js | 38 - projects/sio2/index.js | 58 +- projects/sio2/sio2.js | 100 - projects/sio2/utils.js | 11 - projects/siren/index.js | 162 +- projects/sirius-finance/constants.js | 39 +- projects/sithswap/abi.js | 112 + projects/sithswap/api.js | 40 + projects/sithswap/index.js | 1 + projects/skcs/index.js | 2 +- projects/skeleton/abi.json | 82 +- projects/skeleton/index.js | 4 +- projects/skullswap-v3/index.js | 9 + projects/skullswap/index.js | 3 + projects/skydex/index.js | 22 + projects/sleepearn/index.js | 4 +- projects/slsd/index.js | 32 + projects/smbswap-v3/index.js | 5 + projects/smolswap/abi.json | 36 +- projects/smurfmoney/index.js | 5 +- projects/smxswap/index.js | 17 +- projects/snarklaunch/index.js | 12 + projects/snowball/abi.json | 76 +- projects/snowball/index.js | 147 +- projects/snowdogdao/index.js | 10 +- projects/snowflake/abi.js | 15 +- projects/snowflake/constants.js | 7 +- projects/snowflake/index.js | 27 +- projects/snowswap-xyz/index.js | 11 + projects/soarpulse/index.js | 9 + projects/sobal/index.js | 15 + projects/socialswap/index.js | 22 +- projects/soda-protocol/index.js | 7 +- projects/sohei/index.js | 12 + projects/solace-finance/config.js | 35 +- projects/solarbeam/index.js | 15 +- projects/solend/index.js | 6 +- projects/solhero/index.js | 21 +- projects/solid-world/abi.json | 7 + projects/solid-world/config.js | 15 + projects/solid-world/index.js | 65 + projects/solidex/abis.json | 98 +- projects/solidex/index.js | 4 +- projects/solidlizard/index.js | 12 + projects/solidly-v2/index.js | 9 + projects/solidly/index.js | 3 +- projects/solisnek/index.js | 9 + projects/solo/abi.json | 21 +- projects/solo/index.js | 9 +- projects/soluna/index.js | 8 +- projects/solunea/index.js | 19 + projects/solv-protocol-v3/abi.json | 7 + projects/solv-protocol-v3/index.js | 100 + projects/solv-protocol/index.js | 96 +- projects/sommelier/cellar-v0-8-15.json | 72 +- projects/sommelier/cellar-v0-8-16.json | 44 +- projects/sommelier/index.js | 40 +- projects/sommelier/utils.js | 10 - projects/sommelier/v0-8-16.js | 3 +- projects/sommelier/v2.js | 12 + projects/sonne-finance/index.js | 23 +- projects/sorbetfinance/abi.json | 81 +- projects/sorbetfinance/index.js | 5 + projects/sorbetto/abi.json | 54 - projects/sorbetto/index.js | 30 - projects/soulswap/abis/factory.json | 22 +- projects/soulswap/abis/getReserves.json | 25 - projects/soulswap/abis/token0.json | 15 - projects/soulswap/abis/token1.json | 15 - projects/soulswap/helper/getUsdSoulTvl.js | 9 +- projects/soulswap/index.js | 11 +- projects/soulswap/underworld-lending.js | 2 - projects/sovryn-dex/index.js | 15 + projects/sovryn-lending/index.js | 27 + projects/sovryn-zero/index.js | 12 + projects/sovryn.js | 10 - projects/soyfinance/index.js | 18 +- projects/spacedex-io/index.js | 28 + projects/spacefi/index.js | 7 +- projects/spadefinance/index.js | 4 +- projects/spark-fi/index.js | 7 + projects/spartacus-exchange/index.js | 5 +- projects/spartacus/index.js | 18 +- .../spartan-protocol/abis/PoolFactory.json | 24 +- projects/sperax-demeter/index.js | 38 + projects/sperax/abi.json | 16 +- projects/sphere-finance/index.js | 8 +- projects/spherium/abi.json | 36 +- projects/sphynx/index.js | 45 +- projects/spice-finance/index.js | 20 + projects/spicetrade/index.js | 9 +- projects/spin-prep/index.js | 19 + projects/spin-vault/index.js | 21 + projects/spin/index.js | 10 - projects/spiral-dao/abi.json | 6 + projects/spiral-dao/index.js | 28 + projects/spiral-fi-mixer/index.js | 11 + projects/spiral-finance/abi.json | 116 +- projects/spiral-finance/index.js | 177 +- projects/spiritswap-lending/index.js | 4 +- projects/spl-governance/index.js | 22 + projects/spookyswap/index.js | 11 +- projects/spool/abi.json | 10 +- projects/spool/index.js | 79 +- projects/spoon-exchange/index.js | 12 + projects/squid-dao/index.js | 3 +- projects/squidstake/index.js | 17 +- projects/stCelo/index.js | 13 +- projects/stUSDT/index.js | 19 + .../stabilizefi/getEntireSystemColl.abi.json | 13 - projects/stabilizefi/index.js | 195 +- .../stabilizefi/totalTokenStaked.abi.json | 13 - projects/stabl-v2/abi.json | 5 + projects/stabl-v2/index.js | 39 + projects/stabl/index.js | 20 +- projects/stabledoin/index.js | 3 + projects/stablekoi/abi.json | 18 +- projects/stablekoi/index.js | 13 +- projects/stablz/index.js | 20 + projects/stacker/index.js | 7 +- projects/stacks/index.js | 1 + projects/stackswap/api.js | 38 + projects/stader/index.js | 52 +- projects/stafi/index.js | 16 +- projects/stake-ly/index.js | 8 +- projects/stake1/abi.json | 28 +- projects/stake1/index.js | 4 +- projects/stakedao/abi.json | 213 +- projects/stakedao/index.js | 544 ++-- projects/stakedicp/index.js | 23 + projects/stakedotlink-index/index.js | 13 + projects/stakedotlink/index.js | 43 + projects/stakehound/index.js | 3 +- projects/stakerz-io/index.js | 3 - projects/stakesteak/abi.json | 46 - projects/stakesteak/index.js | 5 +- projects/stakewise/index.js | 17 +- projects/standcash/index.js | 13 +- projects/starbank/index.js | 29 +- projects/starfish-finance/index.js | 33 +- projects/starfish-liq-staking/index.js | 9 + projects/stargate-finance/api.js | 4 + projects/stargate-finance/index.js | 5 +- projects/stargatefinance/abi.json | 82 +- projects/stargatefinance/index.js | 76 +- projects/stargaze/index.js | 26 + projects/starkex/abi.js | 87 + projects/starkex/api.js | 38 + projects/starkex/index.js | 1 + projects/starlay/abi.json | 401 --- projects/starlay/constanrs.js | 52 - projects/starlay/index.js | 71 +- projects/starlay/starlay.js | 97 - projects/starlay/utils.js | 11 - projects/starlay/ve.js | 19 - projects/starmaker/index.js | 9 + projects/starswap/index.js | 51 +- projects/steadefi/index.js | 56 + projects/steak/terra.js | 10 +- projects/steak/terra.test.js | 5 - projects/steakHut-lb/abi.json | 7 + projects/steakHut-lb/index.js | 87 + projects/steakHut/abi.json | 54 +- projects/steakHut/index.js | 3 +- projects/steakbank/abis.json | 2 +- projects/steakbank/index.js | 3 +- projects/steer/index.js | 43 + projects/stellarx/index.js | 7 +- projects/stellaswap-v3/index.js | 9 + projects/stellaxyz-io/index.js | 40 + projects/sterling-finance/index.js | 12 + projects/steroids/index.js | 32 +- projects/steth-win/index.js | 12 + projects/stfil/index.js | 35 + projects/stlos-liquid-staking/index.js | 3 +- projects/stlos-liquid-staking/sTlos.json | 19 +- projects/ston/index.js | 24 + projects/stonedefi/abi.json | 28 +- projects/stonedefi/index.js | 3 +- projects/stream/abi.js | 4 + projects/stream/index.js | 42 + projects/streamflow/api.js | 7 + projects/streamflow/index.js | 53 + projects/stride/index.js | 58 +- projects/strike/index.js | 3 +- projects/strips/abi.json | 40 +- projects/strips/index.js | 5 +- projects/struct-finance/index.js | 29 + projects/strxfinance/index.js | 37 +- projects/sturdy/index.js | 85 +- projects/subzero-plus/index.js | 22 + projects/sudoinu/index.js | 20 +- projects/sudoswap-v2/index.js | 34 + projects/sudoswap/index.js | 107 +- projects/sugarswap/index.js | 26 + projects/summer-fi/api.js | 7 + projects/summer-fi/constants/abi.js | 17 + projects/summer-fi/constants/contracts.js | 6 + .../summer-fi/constants/creation-blocks.js | 5 + projects/summer-fi/constants/endpoints.js | 11 + projects/summer-fi/constants/index.js | 11 + projects/summer-fi/constants/logs-topic.js | 8 + projects/summer-fi/handlers/automation-v1.js | 30 + projects/summer-fi/handlers/dpm-positions.js | 109 + projects/summer-fi/handlers/index.js | 9 + projects/summer-fi/handlers/maker-vaults.js | 44 + projects/summer-fi/helpers/calls.js | 94 + .../helpers/get-automation-cdp-ids.js | 52 + projects/summer-fi/helpers/index.js | 17 + projects/summer-fi/index.js | 33 + projects/summitdefi/abi.json | 106 +- projects/summitdefi/index.js | 3 +- projects/sumswap/index.js | 3 +- projects/sun/index.js | 101 +- projects/sunSwap/index.js | 25 - projects/sunflowerswap/index.js | 22 +- projects/sunswap-v2/api.js | 7 + projects/sunswap-v2/index.js | 11 + projects/superbots/index.js | 9 +- projects/superlauncher/index.js | 13 + projects/surfswap-stableswap/index.js | 24 + projects/surfswap/index.js | 68 +- projects/surge/index.js | 31 + projects/sushiswap-bentobox/bentobox.js | 4 +- projects/sushiswap-bentobox/helper.js | 87 +- projects/sushiswap-furo/furo.js | 12 +- projects/sushiswap-kashi/kashi-lending.js | 44 +- projects/sushiswap-trident/index.js | 13 +- projects/sushiswap-trident/trident.js | 45 +- projects/sushiswap-v3/index.js | 65 + projects/sushiswap/api.js | 227 +- projects/sushiswap/historical.js | 3 +- projects/sushiswap/index.js | 18 +- projects/suter-shield/index.js | 66 +- projects/svn/abi.json | 80 +- projects/svn/index.js | 12 +- projects/swaap-v2/index.js | 27 + projects/swaap/index.js | 29 +- projects/swampfinance/index.js | 2 + projects/swapbase/index.js | 6 + projects/swapfish/index.js | 7 +- projects/swapline/index.js | 57 + projects/swapmatic/index.js | 48 +- projects/swapperchan/index.js | 1 - projects/swaprum/index.js | 19 + projects/swapscanner-staking/index.js | 24 + projects/swapscanner/index.js | 57 +- projects/swapsicle/iceBoxABI.json | 3 + projects/swapsicle/icevaultABI.json | 3 + projects/swapsicle/index.js | 141 +- projects/swarm-markets/index.js | 73 +- projects/swell/index.js | 14 + projects/swift-finance/abi.json | 28 +- projects/swift-finance/index.js | 12 +- projects/swim/config.js | 9 +- projects/swirllend/index.js | 15 + projects/swivel/index.js | 31 +- projects/swop/index.js | 21 +- projects/symbiosis-finance/abi/getToken.json | 19 - projects/symbiosis-finance/config.js | 187 ++ projects/symbiosis-finance/index.js | 110 +- projects/symmetric/index.js | 68 +- projects/symmetry/index.js | 41 + projects/symphony/abi.json | 30 +- projects/symphony/index.js | 18 +- projects/synapse/config.js | 149 +- projects/synapse/index.js | 10 +- projects/syncdex-finance/index.js | 8 + projects/syncnetwork/abi.json | 48 +- projects/syncswap/index.js | 43 + projects/synfutures-v1/index.js | 81 +- projects/synfutures-v2/index.js | 26 + projects/synthetix-v1/index.js | 7 + projects/synthetix-v2/index.js | 7 + projects/synthetix/abi.json | 73 +- projects/synthetix/api.js | 12 +- projects/synthetix/apiCache.js | 15 +- projects/synthex/index.js | 28 + projects/synthswap/index.js | 21 + projects/syrupfinance/index.js | 19 + projects/t-protocol/index.js | 14 + projects/tai-money/index.js | 31 + projects/taichi/index.js | 8 +- projects/taiga/api.js | 1 - projects/talentprotocol/index.js | 3 +- projects/tangent-protocol/index.js | 8 + projects/tangent/index.js | 7 +- projects/tangible/abi.js | 241 +- projects/tarina/index.js | 5 +- projects/tarot/abi.js | 113 +- projects/tarot/index.js | 52 +- projects/tarot/tarotHelper.js | 125 +- projects/tashi/index.js | 7 + projects/tbtc/index.js | 13 + projects/teahouse-v3/abi.json | 4 + projects/teahouse-v3/index.js | 40 + projects/teahouse/abi.json | 6 + projects/teahouse/index.js | 49 + projects/tealswap/index.js | 8 + projects/team-finance/apiCache.js | 11 +- projects/team-finance/index.js | 2 +- projects/team-finance/lockcontract.abi.json | 51 +- .../team-finance/lockcontract_v3.abi.json | 68 +- projects/tectonic/abi.json | 32 +- projects/teddy/getEntireSystemColl.abi.json | 13 - projects/teddy/index.js | 28 +- projects/tegisto/index.js | 16 + projects/tegro/index.js | 20 + projects/teller/index.js | 100 + projects/templar/api.js | 18 + projects/templar/index.js | 110 +- projects/templedao-trade/index.js | 12 +- projects/templedao/abi.json | 118 +- projects/templedao/index.js | 47 +- projects/tempodao/index.js | 3 +- projects/tender-finance/index.js | 10 + projects/tenderize/index.js | 5 +- projects/tenderize/tenderSwapABI.json | 9 - projects/tendieswap-app/index.js | 13 + projects/tendieswap/index.js | 2 +- projects/tenet/abi.json | 60 +- projects/tenfinance/abi.json | 46 +- projects/tenfinance/index.js | 3 - projects/tenx-exchange/index.js | 3 + projects/terra-bridge/index.js | 57 +- projects/terraswap/factoryTvl.js | 76 +- projects/terraswap/index.js | 2 +- projects/tesseract/abi.json | 4 +- projects/tethys-perpetual/index.js | 9 + projects/tethys/index.js | 13 +- projects/tetu-pawnshop/index.js | 28 + projects/tetu-swap/index.js | 1 - projects/tetu/abi.json | 92 +- projects/tetu/index.js | 94 +- projects/tezos-baking/index.js | 28 +- projects/thalaswap/index.js | 41 + projects/thales/abi.json | 11 +- projects/thales/index.js | 191 +- projects/the-granary/abi.json | 103 - projects/the-granary/index.js | 6 +- projects/the-idols/index.js | 3 +- projects/thedragonslair/abi.json | 59 +- projects/thedragonslair/index.js | 5 +- projects/thegrandbanks/abi.json | 59 +- projects/thegrandbanks/index.js | 11 +- projects/themis-capital-dex/index.js | 12 + projects/themis-capital-ohm/index.js | 14 + projects/themis-exchange/index.js | 42 + projects/thena-v3/index.js | 5 + projects/thena/index.js | 6 + projects/thetanuts/index.js | 326 +- projects/thorchain/index.js | 116 +- projects/thorusfi/index.js | 7 +- projects/thunderpokt/index.js | 2 +- projects/tidalfinance/abi.json | 34 +- projects/tidalfinance/index.js | 3 +- projects/tifi-bank/index.js | 33 +- projects/tigris/index.js | 61 + projects/timeless/abi.json | 34 +- projects/timeless/index.js | 32 +- projects/timeswap-v2/index.js | 94 + projects/timeswap/index.js | 42 +- projects/timewarp/abi.json | 14 +- projects/tinlake/index.js | 34 +- projects/tipidao/api.js | 9 + projects/tipidao/index.js | 17 +- projects/titano-swych/index.js | 1 - projects/titi-finance/index.js | 45 + projects/tlchain-decryption/index.js | 3 + projects/tokemak/index.js | 186 +- projects/tokenlon/abi.json | 42 +- projects/tokenlon/index.js | 16 +- projects/tokensfarm/index.js | 2 +- projects/tomb-swap/index.js | 1 - projects/tomb/index.js | 9 +- projects/tonic-cash/config.js | 63 + projects/tonic-cash/index.js | 11 + projects/tonic/index.js | 45 + projects/tonswap/index.js | 5 +- projects/topshelf/index.js | 13 +- projects/toreus/index.js | 14 + projects/tornadao/index.js | 3 +- projects/tornado/config.js | 34 +- projects/tornado/index.js | 37 +- projects/toros/abis.js | 98 +- projects/toros/config.js | 9 - projects/toros/index.js | 63 +- projects/tortuga/index.js | 1 + projects/totemfi/index.js | 20 +- projects/toucan-protocol/config.js | 6 +- projects/toucan-protocol/index.js | 33 +- projects/tracerdao/abi.json | 34 +- projects/tracerdao/index.js | 3 +- projects/traddify/index.js | 11 + projects/traderjoe-lb-v2-1/index.js | 39 + projects/traderjoe-lb/index.js | 36 + projects/traderjoe-lend/index.js | 8 +- projects/traderjoe/index.js | 12 +- projects/trainswap/index.js | 23 + projects/tranche/index.js | 19 +- projects/tranchess-ETH/abi.json | 4 + projects/tranchess-ETH/index.js | 19 + projects/tranchess/abi.json | 109 +- projects/tranquil/index.js | 20 +- projects/trapeza-protocol/index.js | 6 +- projects/trava/abi.json | 192 +- projects/trava/index.js | 11 +- projects/traverse/index.js | 3 +- projects/treasury/1inch.js | 23 + projects/treasury/3xcalibur.js | 12 + projects/treasury/aave.js | 284 ++ projects/treasury/aavegotchi.js | 31 + projects/treasury/abracadabra.js | 52 + projects/treasury/across.js | 12 + projects/treasury/airswap.js | 20 + projects/treasury/ajira-pay-finance.js | 63 + projects/treasury/alchemix.js | 57 + projects/treasury/alpacacity.js | 24 + projects/treasury/alyx.js | 17 + projects/treasury/antfarm_finance.js | 13 + projects/treasury/ape-coin.js | 22 + projects/treasury/apex-protocol.js | 12 + projects/treasury/api3.js | 24 + projects/treasury/apollox.js | 22 + projects/treasury/aragon.js | 33 + projects/treasury/arbitrum-dao.js | 16 + projects/treasury/archimedes.js | 20 + projects/treasury/atlas-usv.js | 53 + projects/treasury/augury.js | 16 + projects/treasury/aura.js | 25 + projects/treasury/axelar.js | 12 + projects/treasury/badger-dao.js | 60 + projects/treasury/balancer.js | 36 + projects/treasury/bancor.js | 51 + projects/treasury/banklessdao.js | 35 + projects/treasury/bankofcronos.js | 22 + projects/treasury/battlefly.js | 16 + projects/treasury/beanstalk.js | 19 + projects/treasury/beefy.js | 84 + projects/treasury/beethovenx.js | 63 + projects/treasury/benddao.js | 14 + projects/treasury/benqi.js | 12 + projects/treasury/betswirl.js | 90 + projects/treasury/bitdao.js | 28 + projects/treasury/btcst.js | 11 + projects/treasury/camelot.js | 16 + projects/treasury/cap.js | 21 + projects/treasury/cat-in-a-box.js | 12 + projects/treasury/cerberusdao.js | 3 + projects/treasury/chaintools.js | 11 + projects/treasury/compound.js | 26 + projects/treasury/convex.js | 32 + projects/treasury/crabada.js | 31 + projects/treasury/cream-finance.js | 17 + projects/treasury/croblanc.js | 10 + projects/treasury/cryptex.js | 25 + projects/treasury/cryptodickbutts.js | 23 + projects/treasury/cthulhufinance.js | 15 + projects/treasury/cubo.js | 21 + projects/treasury/curve.js | 13 + projects/treasury/cvi.js | 12 + projects/treasury/defender.js | 12 + projects/treasury/deri-protocol.js | 12 + projects/treasury/dex.js | 28 + projects/treasury/dforce.js | 15 + projects/treasury/dfyn.js | 17 + projects/treasury/dnadollar.js | 13 + projects/treasury/dodo.js | 30 + projects/treasury/dopex.js | 20 + projects/treasury/dxdao.js | 28 + projects/treasury/dydx.js | 18 + projects/treasury/ease-org.js | 19 + projects/treasury/elements-fi.js | 16 + projects/treasury/empyreal.js | 20 + projects/treasury/ens.js | 24 + projects/treasury/equilibre.js | 78 + projects/treasury/eth-foundation.js | 20 + projects/treasury/ether.js | 26 + projects/treasury/ethglobal.js | 16 + projects/treasury/euler.js | 17 + projects/treasury/evmos-dao.js | 23 + projects/treasury/exactly.js | 26 + projects/treasury/fantohm-dao.js | 22 + projects/treasury/fei-protocol.js | 14 + projects/treasury/femboy-dao.js | 10 + projects/treasury/flair-dex.js | 23 + projects/treasury/flokifi-locker.js | 30 + projects/treasury/floor-dao.js | 10 + projects/treasury/forth-dao.js | 23 + projects/treasury/fortress.js | 3 + projects/treasury/fortunedao.js | 3 + projects/treasury/frax.js | 33 + projects/treasury/friendswithbenefits.js | 21 + projects/treasury/futureswap.js | 12 + projects/treasury/gains.js | 32 + projects/treasury/galaxygoogle.js | 56 + projects/treasury/gale.js | 18 + projects/treasury/galxe.js | 14 + projects/treasury/gearbox.js | 23 + projects/treasury/geth.js | 15 + projects/treasury/gitcoin.js | 26 + projects/treasury/giveth.js | 70 + projects/treasury/gnosis-dao.js | 82 + projects/treasury/goblinscash.js | 3 + projects/treasury/golem.js | 18 + projects/treasury/gooddollar.js | 60 + projects/treasury/grabi.js | 11 + projects/treasury/guru-network.js | 19 + projects/treasury/gyro.js | 22 + projects/treasury/handlefi.js | 12 + projects/treasury/hector.js | 4 + projects/treasury/hegic.js | 25 + projects/treasury/hop.js | 17 + projects/treasury/idle-dao.js | 55 + projects/treasury/illuvium.js | 23 + projects/treasury/immortal.js | 5 + projects/treasury/impermax.js | 12 + projects/treasury/index-coop.js | 29 + projects/treasury/india-covid-relief-fund.js | 46 + projects/treasury/instadapp.js | 33 + projects/treasury/insure-dao.js | 12 + projects/treasury/interport-finance.js | 18 + projects/treasury/inverse.js | 86 + projects/treasury/ipor.js | 43 + projects/treasury/iq.js | 22 + projects/treasury/jade-protocol.js | 56 + projects/treasury/jonesdao.js | 32 + projects/treasury/jpegd.js | 57 + projects/treasury/just-yield.js | 16 + projects/treasury/keeperdao.js | 26 + projects/treasury/kei.js | 14 + projects/treasury/king-finance.js | 19 + projects/treasury/kinza.js | 14 + projects/treasury/klima-dao.js | 29 + projects/treasury/koyo.js | 17 + projects/treasury/kromatika.js | 19 + projects/treasury/kyber.js | 49 + projects/treasury/l2beat.js | 15 + projects/treasury/leaguedao.js | 5 + projects/treasury/level.js | 36 + projects/treasury/lido.js | 34 + projects/treasury/liondex.js | 20 + projects/treasury/liquity-treasury.js | 45 + projects/treasury/looksrare.js | 37 + projects/treasury/lsdx-finance.js | 19 + projects/treasury/luxor.js | 5 + projects/treasury/lyra.js | 37 + projects/treasury/macaron.js | 14 + projects/treasury/mahadao.js | 15 + projects/treasury/maia-dao.js | 4 + projects/treasury/maker.js | 46 + projects/treasury/mantra-dao.js | 26 + projects/treasury/maple.js | 17 + projects/treasury/metacartel.js | 20 + projects/treasury/metronome.js | 22 + projects/treasury/mimo-protocol.js | 55 + projects/treasury/moret.js | 18 + projects/treasury/mstable.js | 32 + projects/treasury/mux.js | 11 + projects/treasury/mycelium.js | 14 + projects/treasury/nemesis.js | 18 + projects/treasury/neutra-finance.js | 20 + projects/treasury/newland.js | 24 + projects/treasury/nexus-mutual.js | 21 + projects/treasury/nftx.js | 16 + projects/treasury/notiboy-treasury.js | 15 + projects/treasury/notional.js | 17 + projects/treasury/nouns.js | 15 + projects/treasury/o2-dao.js | 15 + projects/treasury/o3-swap.js | 12 + projects/treasury/oasisswapdex.js | 15 + projects/treasury/oceanus.js | 12 + projects/treasury/olympulsex.js | 11 + projects/treasury/olympus-dao.js | 3 + projects/treasury/omicron.js | 3 + projects/treasury/ooki.js | 24 + projects/treasury/op-foundation.js | 23 + projects/treasury/open-oceans.js | 12 + projects/treasury/openxswap.js | 20 + projects/treasury/ovr.js | 18 + projects/treasury/p-network.js | 17 + projects/treasury/paladin-finance.js | 37 + projects/treasury/paraswap.js | 33 + projects/treasury/parrot-protocol.js | 16 + projects/treasury/peardao.js | 20 + projects/treasury/pegasusfinance.js | 19 + projects/treasury/perion.js | 23 + projects/treasury/perpetual-protocol.js | 24 + projects/treasury/piedao.js | 39 + projects/treasury/platypus.js | 34 + projects/treasury/pleasrdao.js | 27 + projects/treasury/plutusdao.js | 22 + projects/treasury/pooltogether.js | 69 + projects/treasury/premia.js | 21 + projects/treasury/puli.js | 26 + projects/treasury/push.js | 21 + projects/treasury/qidao.js | 12 + projects/treasury/radiant.js | 15 + projects/treasury/railgun.js | 128 + projects/treasury/rarible.js | 23 + projects/treasury/redacted.js | 52 + projects/treasury/relay.js | 12 + projects/treasury/revoke.js | 83 + projects/treasury/revoluzion.js | 17 + projects/treasury/ribbon.js | 36 + projects/treasury/rotki.js | 42 + projects/treasury/router.js | 12 + projects/treasury/saddle.js | 15 + projects/treasury/safe.js | 15 + projects/treasury/sakai-vault.js | 17 + projects/treasury/savvy.js | 18 + projects/treasury/shapeshift.js | 26 + projects/treasury/shibui.js | 61 + projects/treasury/silo-finance.js | 25 + projects/treasury/snapshot.js | 16 + projects/treasury/spartacus.js | 19 + projects/treasury/sperax.js | 11 + projects/treasury/sphere-finance.js | 63 + projects/treasury/spherium.js | 12 + projects/treasury/spiral-dao.js | 44 + projects/treasury/spookyswap.js | 19 + projects/treasury/spool-protocol.js | 19 + projects/treasury/stakedao.js | 113 + projects/treasury/stargate-finance.js | 11 + projects/treasury/stargate.js | 153 + projects/treasury/stealcam.js | 10 + projects/treasury/sudoswap.js | 23 + projects/treasury/sushiswap.js | 17 + projects/treasury/synapse.js | 144 + projects/treasury/synthetix.js | 27 + projects/treasury/teddy.js | 11 + projects/treasury/templar-dao.js | 52 + projects/treasury/tempus-finance.js | 20 + projects/treasury/thales.js | 50 + projects/treasury/thellamas.js | 33 + projects/treasury/themis-capital-ohm.js | 13 + projects/treasury/tipidao.js | 3 + projects/treasury/tokemak.js | 30 + projects/treasury/tokenIon.js | 41 + projects/treasury/tornado-cash.js | 16 + projects/treasury/traderjoe.js | 14 + projects/treasury/tranchess.js | 37 + projects/treasury/treasure-dao.js | 35 + projects/treasury/umamifinance.js | 49 + projects/treasury/uniswap.js | 24 + projects/treasury/uwulend.js | 31 + projects/treasury/vaporfi.js | 16 + projects/treasury/velodrome.js | 43 + projects/treasury/venus.js | 25 + projects/treasury/vesta.js | 18 + projects/treasury/void.js | 19 + projects/treasury/volta-dao.js | 4 + projects/treasury/volta.js | 25 + projects/treasury/wagmi.js | 18 + projects/treasury/wagmidao.js | 78 + projects/treasury/we-piggy.js | 12 + projects/treasury/wonderland.js | 119 + projects/treasury/woofi.js | 39 + projects/treasury/x7.js | 19 + projects/treasury/xeus.js | 4 + projects/treasury/y2k.js | 19 + projects/treasury/yam-finance.js | 18 + projects/treasury/yearn.js | 33 + projects/treasury/yield-guild-game.js | 57 + projects/treasury/zachxtb-theman.js | 41 + projects/treasury/zero-swap.js | 12 + projects/treasury/zigzag.js | 11 + projects/treasury/zyber-swap.js | 12 + projects/treedefi/abi.json | 56 +- projects/treehousefinance/index.js | 3 + projects/tribe3/index.js | 15 + projects/trickortreat/index.js | 34 - projects/tropicalfinance/index.js | 11 +- projects/tropykus-zkevm/index.js | 6 + projects/tropykus/index.js | 6 +- projects/troydefi/index.js | 2 +- projects/truefeedback/index.js | 12 + projects/truefi/abi.json | 98 +- projects/trufin-trustake/index.js | 24 + projects/trufin/abi.json | 5 + projects/trufin/index.js | 20 + projects/trustswap/abi.json | 30 +- projects/trustswap/index.js | 9 +- projects/trxStakingGovernance/index.js | 3 + projects/tsunami-fi/index.js | 15 + projects/ttswap/index.js | 52 +- projects/turbos/index.js | 32 + projects/twindex/index.js | 9 +- projects/twtstake/index.js | 16 + projects/typus-finance/index.js | 48 + projects/tzwrap/tokens.js | 67 +- projects/ubiquitydao/index.js | 3 +- projects/ultronStakingHub/index.js | 3 +- projects/ultronSwap/index.js | 5 +- projects/uma/abi.json | 58 +- projects/uma/index.js | 54 +- projects/umamifinance/abi.json | 16 +- projects/umamifinance/index.js | 36 +- projects/umbria/abi.json | 35 +- projects/umee/index.js | 51 + projects/unamano/index.js | 16 + projects/unbk/fantom-yields.js | 11 +- projects/unbk/router-abi.js | 27 +- projects/unfederalreserve/index.js | 3 +- projects/unicrypt-v3/index.js | 27 + projects/unicrypt/abis.js | 74 +- projects/unicrypt/api.js | 2 +- projects/unicrypt/apiCache.js | 9 +- projects/unicrypt/config.js | 3 +- projects/unidex/index.js | 77 +- projects/unieth/index.js | 25 + projects/unifarm/helper.js | 4 +- projects/unifarm/index.js | 2 +- projects/unifi-protocol-staking/index.js | 32 + projects/unifi-protocol/index.js | 59 +- projects/unilend/index.js | 3 +- projects/union-finance/index.js | 160 +- .../unipilot/abis/getPositionDetails.json | 38 - projects/unipilot/index.js | 250 +- projects/unipower/index.js | 3 +- projects/uniswap-v2/index.js | 2 +- projects/uniswap/index.js | 25 +- projects/uniswap/v1.js | 17 +- projects/uniswap/v3/index.js | 16 +- projects/unite-finance/index.js | 2 +- projects/united-farmers/index.js | 17 - projects/unitrade/abi.json | 61 +- projects/unitrade/gateway.abi.json | 26 +- projects/unitrade/index.js | 6 +- projects/universe-finance/index.js | 11 +- projects/universe/index.js | 28 +- projects/uniwhale/index.js | 12 + projects/uniwswap-unia/index.js | 19 + projects/uniwswap/index.js | 1 - projects/unizen/abi.json | 30 +- projects/unknown/abi.js | 161 +- projects/unlimited-trade/index.js | 21 + projects/unlockd/helper/address.js | 12 + projects/unlockd/index.js | 41 + projects/uno-farm/apps.json | 84 + projects/uno-farm/index.js | 107 + .../uno-helplers/abis/UnoFactory.json | 5 + .../uno-helplers/abis/UnoFarmBalancer.json | 4 + .../uno-helplers/abis/UnoFarmQuickswap.json | 3 + projects/uno-farm/uno-helplers/index.js | 161 + projects/unore/index.js | 111 +- projects/unsheth/index.js | 26 + projects/unusdao/index.js | 5 +- projects/urdex/index.js | 21 + projects/usesugarswap/index.js | 12 + projects/uswap-me/index.js | 11 + projects/uwu-cash/index.js | 11 + projects/uwulend/index.js | 9 +- projects/v3s-finance/abi.json | 105 +- projects/v3s-finance/index.js | 3 +- projects/vacusfinance/abi.js | 69 +- projects/vacusfinance/index.js | 3 + projects/valkyrie/index.js | 30 - projects/valleyswap/index.js | 7 +- .../valueliquid/abis/getCurrentTokens.json | 15 - projects/valueliquid/index.js | 33 +- projects/vampireswap/index.js | 13 +- projects/vanswap/index.js | 1 - projects/vapordex/index.js | 3 + projects/vaporfi/index.js | 11 - projects/vaultka/index.js | 81 + projects/veax/index.js | 14 + projects/vector/abi.json | 24 - projects/vector/index.js | 208 +- projects/vector/vectorContracts.json | 1792 +++++++++++ projects/vee-finance/index.js | 7 +- projects/vega-protocol/index.js | 64 + projects/vela-exchange/index.js | 36 + projects/velaro/index.js | 40 +- projects/velocimeter-v2/index.js | 26 + projects/velocore-v2/index.js | 21 + projects/velocore/index.js | 15 + projects/velodrome-v2/index.js | 14 + projects/velodrome/index.js | 5 +- projects/velvet-capital/index.js | 29 + projects/vendor-finance-v2/index.js | 54 + projects/vendor-finance/cmUmami.abi.json | 7 - projects/vendor-finance/index.js | 100 +- projects/veniceswap/index.js | 8 + projects/venofinance/index.js | 44 + projects/venus-isolated-pools/index.js | 32 + projects/veplus/index.js | 13 + projects/verified-credits/index.js | 6 + projects/versedex/index.js | 9 +- projects/vertex/index.js | 22 + projects/vesper/abi.json | 79 +- projects/vesper/index.js | 14 +- projects/vesq/index.js | 3 +- projects/vesta/getEntireSystemColl.abi.json | 19 - projects/vesta/index.js | 25 +- projects/vesta/vestaFarming.abi.json | 14 - projects/vestige/index.js | 34 + projects/vesync/index.js | 32 + projects/vett/index.js | 27 + projects/vexchange/abi.json | 82 +- projects/vidya/index.js | 36 + projects/vigor/index.js | 30 +- projects/viperswap/index.js | 17 +- projects/vires/index.js | 2 +- projects/visor/abis/hypeRegistry.json | 4 + projects/visor/abis/hypervisor.json | 109 +- projects/visor/abis/tokens.json | 4 + projects/visor/index.js | 310 +- projects/vitcswap/api.js | 15 + projects/vitcswap/index.js | 13 +- projects/vivaleva/index.js | 87 + projects/void/index.js | 10 + projects/volmex/index.js | 13 +- projects/volta-dao/api.js | 12 + projects/volta-dao/index.js | 13 +- projects/volta-finance/index.js | 22 + projects/voltz/index.js | 46 +- projects/voodoo-trade/index.js | 13 + projects/vortex/http.js | 23 - projects/vortex/index.js | 29 +- projects/vortex/queries.js | 74 - projects/vortex/vortex.api.js | 43 - projects/votium/index.js | 34 - projects/vovo/index.js | 34 +- projects/vultureswap/index.js | 9 +- projects/vvs-finance/index.js | 1 - projects/vyfi-dex/index.js | 24 + projects/vyfi/index.js | 51 +- projects/w3swap/index.js | 1 - projects/wagmi-com/index.js | 6 + projects/wagmidao/abi.json | 48 +- projects/wagmidao/index.js | 23 +- projects/wagyuswap/index.js | 2 +- projects/wardenswap/index.js | 1 - projects/warp/index.js | 163 +- projects/warpbond/index.js | 3 +- projects/wasabi/index.js | 21 + projects/wasabix/abi.json | 85 +- projects/wasabix/index.js | 21 +- projects/waterdendy/index.js | 5 + projects/waterfallbsc/index.js | 8 +- projects/waterfalldefi/abi.json | 99 +- projects/waterfalldefi/index.js | 15 +- projects/waterloan/index.js | 15 +- projects/wavelength/index.js | 9 +- projects/waves-exchange/index.js | 43 +- projects/weave/index.js | 24 + projects/weldfinance/index.js | 53 +- projects/welnance/index.js | 3 +- projects/wemix-fi/index.js | 3 + projects/wemix-lend/index.js | 10 + projects/wemix-staking/index.js | 11 + projects/westater/index.js | 3 +- projects/westater/index.json | 14 +- projects/whalegame/index.js | 26 + projects/whaleloans/index.js | 15 - projects/whaleswap/index.js | 58 +- projects/wheat.js | 15 - projects/whiteheart/index.js | 7 +- projects/whitehole-finance/index.js | 5 + projects/whitewhale-dex/index.js | 24 + projects/whitewhale/index.js | 31 +- projects/wigoswap/index.js | 17 +- projects/wildcredit/abi.json | 196 +- projects/wildcredit/abis.json | 244 +- projects/wildcredit/index.js | 49 +- projects/winery-swap/index.js | 1 - projects/wingriders/index.js | 47 +- projects/winr-protocol/index.js | 9 + projects/witswap/index.js | 4 +- projects/wojakfinance/index.js | 1 - projects/wombat-exchange/config.js | 55 + projects/wombat-exchange/index.js | 110 +- projects/wombex/abi.json | 178 +- projects/wombex/config.js | 18 + projects/wombex/index.js | 134 +- projects/wonderland/api.js | 4 + projects/wonderland/index.js | 108 +- projects/wonderly/abi.json | 9 + projects/wonderly/index.js | 172 ++ projects/woo-cex/index.js | 34 + projects/woofi-earn/index.js | 2 +- projects/worldmobiletoken/index.js | 14 + projects/wowswap/abi.json | 258 +- projects/wowswap/constants.js | 7 +- projects/wowswap/protocol.js | 3 +- projects/wraithswap/index.js | 18 +- projects/wspp/index.js | 2 +- projects/wtfdex/index.js | 13 + projects/wyndao-dex/index.js | 27 + projects/wyndao-lsd/index.js | 12 + projects/x2y2/index.js | 47 +- projects/x7/index.js | 5 + projects/xWeowns/index.js | 8 +- projects/xWinFinance/Helper.js | 72 + projects/xWinFinance/index.js | 27 + projects/xbacked/index.js | 12 + projects/xbank/index.js | 8 + projects/xbluefinance/index.js | 8 + projects/xcadnetwork/index.js | 51 - projects/xcarnival/helper/abis/index.js | 59 +- projects/xcarnival/helper/index.js | 12 +- projects/xdai/index.js | 74 +- projects/xdao.js | 74 - projects/xdao/apiCache.js | 25 +- projects/xdefi/index.js | 12 +- .../getEntireSystemColl.abi.json | 13 - projects/xdollar-finance/index.js | 32 +- projects/xenophon/index.js | 3 +- projects/xensa/abi.json | 304 -- projects/xensa/index.js | 45 +- projects/xeus/api.js | 4 + projects/xeus/index.js | 3 +- projects/xlsd/index.js | 12 + projects/xpla/index.js | 10 + projects/xrayswap/index.js | 5 +- projects/xrune/abi.json | 56 +- projects/xsigma/index.js | 7 +- projects/xspswap/index.js | 1 - projects/xtoken/abi.json | 167 +- projects/xtoken/constants.js | 23 +- projects/xtoken/index.js | 8 +- projects/xusdmoney/index.js | 7 +- projects/xy-finance/index.js | 98 +- projects/y2b-finance/index.js | 32 + projects/y2k-finance/index.js | 32 + projects/y2k-v2/index.js | 50 + projects/y2r/index.js | 42 +- projects/yama-finance/index.js | 27 + projects/yaxis/abi.js | 55 +- projects/yaxis/index.js | 164 +- projects/yearn/index.js | 158 +- projects/yel/config/abi.json | 140 +- .../curve_get_virtual_price.abi.json | 10 - .../yetiFinance/farmPoolTotalSupply.abi.json | 13 - projects/yetiFinance/fetchPrice_v.abi.json | 13 - .../yetiFinance/getAllCollateral.abi.json | 18 - projects/yetiFinance/getPrice.abi.json | 19 - projects/yetiFinance/getReserves.json | 19 - projects/yetiFinance/index.js | 44 +- projects/yfdai/index.js | 5 +- projects/yfii/abi.json | 34 +- projects/yieldbank/index.js | 36 + projects/yieldis/abi.json | 15 - projects/yieldis/index.js | 168 +- projects/yieldly/index.js | 9 +- projects/yieldwolf/abi.json | 69 +- projects/yieldyak-staked-avax/index.js | 46 +- projects/yieldyak/abi.json | 8 +- projects/yieldyak/index.js | 29 +- projects/yodeswap/api.js | 12 + projects/yodeswap/index.js | 29 +- projects/yogi/index.js | 35 - projects/yokaiswap/index.js | 36 +- projects/yoshi-exchange/index.js | 25 +- projects/youswap/index.js | 6 +- projects/youves/data.js | 23 +- projects/youves/index.js | 30 +- projects/yslio/abi.json | 75 +- projects/ysmart/index.js | 15 + projects/yupana/index.js | 11 +- projects/zabufinance/abi.json | 49 +- projects/zencha/index.js | 21 +- projects/zeniq-swap/index.js | 3 + projects/zenith/contracts.json | 32 + projects/zenith/index.js | 18 + projects/zenithswap/index.js | 15 + projects/zenlink/abis/StableSwap.json | 28 +- projects/zenlink/abis/factory.json | 34 - projects/zenlink/abis/getReserves.json | 18 - projects/zenlink/abis/stake.json | 28 - projects/zenlink/abis/token0.json | 13 - projects/zenlink/abis/token1.json | 13 - projects/zenlink/getUsdTvl.js | 364 --- projects/zenlink/index.js | 199 +- projects/zerodex/index.js | 8 +- projects/zerolend/index.js | 7 + projects/zeroshift/index.js | 3 +- projects/zerotwohm/index.js | 21 - projects/zest-protocol/abi.json | 46 +- projects/zest-protocol/index.js | 5 +- projects/zeus-finance/index.js | 3 +- projects/zeus/index.js | 27 - projects/zharta/index.js | 19 + projects/zigzag/index.js | 12 + projects/zilch/abi.js | 90 + projects/zilch/index.js | 22 + projects/zipswap/index.js | 35 +- projects/zircon-gamma/index.js | 39 +- projects/zk-swap-dex/index.js | 30 + projects/zk-swap/index.js | 21 + projects/zkBoost/abi.js | 5 + projects/zkBoost/config.js | 7 + projects/zkBoost/index.js | 18 + projects/zkSwap-finance/index.js | 11 + projects/zkasino/index.js | 38 + projects/zkbob-cdp/index.js | 11 + projects/zkbob/index.js | 16 +- projects/zkdefi/index.js | 12 + projects/zkdx/index.js | 15 + projects/zkevmswap/index.js | 11 + projects/zkfox/index.js | 5 + projects/zklend/abi.js | 25 + projects/zklend/index.js | 38 + projects/zkmoonswap/index.js | 11 + projects/zks-miner/index.js | 16 + projects/zkswap-2/index.js | 9 + projects/zkswap/index.js | 4 +- projects/zkswap/v1.js | 14 +- projects/zkswap/v2.js | 14 +- projects/zlot/abi.json | 14 +- projects/zodiac/index.js | 6 +- projects/zomb2/index.js | 3 +- projects/zombi/index.js | 6 +- projects/zombi/zombi.js | 4 +- projects/zombie-network/index.js | 2 +- projects/zomma/index.js | 16 + projects/zoodao/abis/battle-arena-abi.json | 3 + projects/zoodao/index.js | 32 + projects/zoodex/index.js | 11 +- projects/zoomswap/index.js | 3 +- projects/zootopia-finance/index.js | 10 +- projects/zswap-plus/index.js | 7 + projects/zunami/abi.json | 16 +- projects/zunami/index.js | 15 +- projects/zyberswap-stableswap/index.js | 20 + projects/zyberswap-v3/index.js | 14 + projects/zyberswap/index.js | 20 + 3722 files changed, 73970 insertions(+), 89291 deletions(-) create mode 100644 projects/0x0dex/index.js create mode 100644 projects/0xacid/index.js create mode 100644 projects/10kswap/abi.js create mode 100644 projects/10kswap/api.js create mode 100644 projects/10kswap/index.js create mode 100644 projects/1pulse/index.js delete mode 100644 projects/88mph/abi.json create mode 100644 projects/ABCDEFX/index.js create mode 100644 projects/ArbiTen/contracts.json create mode 100644 projects/ArbiTen/index.js create mode 100644 projects/ArbitrumExchange/index.js create mode 100644 projects/ArchimedesFinance/archimedesVaultAbi.json create mode 100644 projects/ArchimedesFinance/curvePoolAbi.json create mode 100644 projects/ArchimedesFinance/index.js create mode 100644 projects/AstroFi/index.js create mode 100644 projects/BankOfCronos/index.js create mode 100644 projects/BankofCronos-Loans/index.js create mode 100644 projects/ChirpFinance/index.js create mode 100644 projects/ColaFactory/index.js create mode 100644 projects/CollectifDAO/index.js create mode 100644 projects/CthulhuFinance/index.js create mode 100644 projects/DerpDEX/index.js create mode 100644 projects/E3/index.js create mode 100644 projects/El-Dorado-Exchange/index.js create mode 100644 projects/FlashLiquidity/index.js create mode 100644 projects/IgnoreFUD/index.js create mode 100644 projects/KyborgExchange/index.js create mode 100644 projects/Liquify/index.js create mode 100644 projects/Lockless/index.js create mode 100644 projects/MFIL/index.js create mode 100644 projects/MantisSwap/index.js create mode 100644 projects/MellowProtocol/index.js create mode 100644 projects/MineFi/index.js create mode 100644 projects/OCTOplace/index.js create mode 100644 projects/OT/index.js create mode 100644 projects/PlsPrint/index.js delete mode 100644 projects/RealProtocol/getEntireSystemColl.abi.json create mode 100644 projects/Revoluzion/index.js create mode 100644 projects/SharpeLabs/index.js create mode 100644 projects/SmarDex/index.js create mode 100644 projects/TokenPocket/index.js create mode 100644 projects/Torr-Finance/index.js create mode 100644 projects/TronNRG/index.js create mode 100644 projects/Velocimeter/index.js create mode 100644 projects/YieldPulseFinance/index.js create mode 100644 projects/YogurtFinance/index.js create mode 100644 projects/Zolidly/index.js create mode 100644 projects/ZukeSwap/index.js create mode 100644 projects/abc-pool/index.js create mode 100644 projects/abelfinance/index.js create mode 100644 projects/aboard-exchange/index.js create mode 100644 projects/ad-astra/index.js delete mode 100644 projects/adao/abi.json create mode 100644 projects/adaswap/index.js delete mode 100644 projects/aelin/abi.json create mode 100644 projects/aerie/index.js create mode 100644 projects/aevo-xyz/index.js create mode 100644 projects/affine-defi/index.js create mode 100644 projects/aftermath-fi/index.js create mode 100644 projects/agilitylsd/index.js create mode 100644 projects/agni-fi/index.js create mode 100644 projects/ajira-pay-finance/index.js create mode 100644 projects/ajna/index.js create mode 100644 projects/akiba/index.js create mode 100644 projects/aktionariat/index.js create mode 100644 projects/algoblocks/index.js create mode 100644 projects/algomint/utils.js create mode 100644 projects/alienfi/index.js create mode 100644 projects/alongside/index.js create mode 100644 projects/alpaca-finance-lend/abi.json create mode 100644 projects/alpaca-finance-lend/index.js create mode 100644 projects/alpaca-finance-lend/lend.js create mode 100644 projects/alpaca-finance-v2/abi.json create mode 100644 projects/alpaca-finance-v2/index.js create mode 100644 projects/alpaca-finance-v2/moneyMarket.js create mode 100644 projects/alpacafinance-gmx/index.js create mode 100644 projects/alyx-finance/index.js create mode 100644 projects/ambient-finance/index.js create mode 100644 projects/ammos-fi/index.js create mode 100644 projects/ampleswap/index.js create mode 100644 projects/antfarm-finance/index.js delete mode 100644 projects/antimatter/abi.json delete mode 100644 projects/antimatter/index.js create mode 100644 projects/anyhedge/index.js create mode 100644 projects/apeCoinStaking/config.js create mode 100644 projects/apeCoinStaking/index.js delete mode 100644 projects/aperture/openPositions.json delete mode 100644 projects/api3/abi.json create mode 100644 projects/aptin-finance/index.js delete mode 100644 projects/aquarius/getEntireSystemColl.abi.json delete mode 100644 projects/arbirise-finance/abis/getPair.json delete mode 100644 projects/arbirise-finance/abis/getReserves.json delete mode 100644 projects/arbirise-finance/abis/token0.json create mode 100644 projects/arbiswap/index.js create mode 100644 projects/arbitrove/index.js create mode 100644 projects/arbitrumexchange-v3/index.js create mode 100644 projects/arbswap-stableswap/index.js create mode 100644 projects/arc-swap/index.js create mode 100644 projects/arcade-xyz/abi.js create mode 100644 projects/arcade-xyz/constants.js create mode 100644 projects/arcade-xyz/index.js create mode 100644 projects/arcade-xyz/queries.js create mode 100644 projects/arcadia-finance/helper/abi.json create mode 100644 projects/arcadia-finance/helper/index.js create mode 100644 projects/arcadia-finance/index.js create mode 100644 projects/archerswap/index.js create mode 100644 projects/archi-finance/abi.json create mode 100644 projects/archi-finance/index.js create mode 100644 projects/arpa-staking/index.js create mode 100644 projects/arrakis-v2/index.js create mode 100644 projects/array-capital/index.js create mode 100644 projects/ashswap/index.js create mode 100644 projects/astarexchangev3/index.js delete mode 100644 projects/astarfarm/abi.json create mode 100644 projects/astaria/index.js delete mode 100644 projects/astarnova/abi.json create mode 100644 projects/astra-dao/index.js create mode 100644 projects/astroport-classic/index.js create mode 100644 projects/asymetrix/index.js create mode 100644 projects/asymmetry-fi/index.js create mode 100644 projects/ate/index.js create mode 100644 projects/athenafinance-io/index.js create mode 100644 projects/athos/index.js create mode 100644 projects/atlas-fi/index.js create mode 100644 projects/atlas-usv/api.js create mode 100644 projects/atomic/index.js delete mode 100644 projects/augmented-finance/abi.json create mode 100644 projects/auragi-finance/index.js create mode 100644 projects/autocoreDefi/index.js create mode 100644 projects/autoearn/index.js create mode 100644 projects/avatr/index.js create mode 100644 projects/avely-finance-staking/index.js create mode 100644 projects/avely-finance-swap/index.js create mode 100644 projects/balancer-v1/index.js delete mode 100644 projects/balancer/abi.json create mode 100644 projects/bao-baskets/index.js create mode 100644 projects/bao-markets/index.js create mode 100644 projects/bao-usd/index.js create mode 100644 projects/baoswap/index.js create mode 100644 projects/baptswap/index.js create mode 100644 projects/baseswap/index.js create mode 100644 projects/basilisk/index.js create mode 100644 projects/baton/index.js create mode 100644 projects/baymax/index.js create mode 100644 projects/bayswap/index.js create mode 100644 projects/beamer/index.js create mode 100644 projects/beamex/index.js create mode 100644 projects/beamswap-stableswap/index.js create mode 100644 projects/beamswap-v3/index.js delete mode 100644 projects/bean/bean-utils.js create mode 100644 projects/beekava/index.js create mode 100644 projects/beluga-dex/index.js create mode 100644 projects/bemo/index.js create mode 100644 projects/benddao-ape-staking/index.js create mode 100644 projects/benddao/helper/abis/ApeCoinStaking.json create mode 100644 projects/benddao/helper/abis/BNFTRegistry.json create mode 100644 projects/benddao/helper/abis/ERC721.json create mode 100644 projects/bfx/index.js create mode 100644 projects/bhavish/index.js create mode 100644 projects/bifrost-liquid-crowdloan/api.js create mode 100644 projects/bifrost-liquid-crowdloan/index.js create mode 100644 projects/binance-beth/index.js create mode 100644 projects/binance-staked-eth/index.js create mode 100644 projects/binance-us/index.js create mode 100644 projects/biswap-v3/index.js create mode 100644 projects/bitget/index.js create mode 100644 projects/bitindi-dex/index.js create mode 100644 projects/bitindi/index.js create mode 100644 projects/bitmake/index.js create mode 100644 projects/bitvenus/index.js create mode 100644 projects/black-whale/index.js create mode 100644 projects/blazestake/index.js create mode 100644 projects/blockswap/index.js create mode 100644 projects/blue-move-mart/index.js create mode 100644 projects/bluefin/index.js create mode 100644 projects/bluemove-dex/index.js create mode 100644 projects/bluespade/index.js create mode 100644 projects/blur-lend/index.js create mode 100644 projects/blur/index.js create mode 100644 projects/bond-protocol/index.js create mode 100644 projects/boneriumtech/index.js create mode 100644 projects/bonkswap/index.js create mode 100644 projects/bonqdao/index.js create mode 100644 projects/bonsai-strike/index.js create mode 100644 projects/bow/index.js create mode 100644 projects/brewlabs/index.js create mode 100644 projects/brightside/index.js create mode 100644 projects/brine/index.js create mode 100644 projects/brokkr/index.js create mode 100644 projects/bubbleswap-v2/index.js create mode 100644 projects/bucket-protocol/index.js create mode 100644 projects/bullionFX/index.js delete mode 100644 projects/bullish/index.js create mode 100644 projects/bunni/index.js delete mode 100644 projects/bunny/abi.json delete mode 100644 projects/bunny/leverage_abi.json delete mode 100644 projects/bunny/pot_abi.json create mode 100644 projects/business-builders-nfts/index.js create mode 100644 projects/butternetwork/index.js delete mode 100644 projects/bzx.js delete mode 100644 projects/caffeinefund/index.js create mode 100644 projects/calculated-finance/index.js create mode 100644 projects/camel-farm/index.js create mode 100644 projects/camelot-v2/index.js create mode 100644 projects/cantohm/index.js create mode 100644 projects/cap-v4/index.js create mode 100644 projects/carbondefi/index.js create mode 100644 projects/carmine-options/abi.js create mode 100644 projects/carmine-options/api.js create mode 100644 projects/carmine-options/index.js delete mode 100644 projects/carthage/index.js create mode 100644 projects/casinocronos/index.js create mode 100644 projects/cat-in-a-box/index.js create mode 100644 projects/catsapes/index.js create mode 100644 projects/caviar-v2/index.js create mode 100644 projects/caviar/index.js create mode 100644 projects/cega/abi.json create mode 100644 projects/cega/evm.js create mode 100644 projects/cega/solana.js create mode 100644 projects/cells/index.js create mode 100644 projects/cerberusdao/api.js create mode 100644 projects/cexdex-stacking/index.js create mode 100644 projects/chaintools/index.js delete mode 100644 projects/chainxyz/index.js create mode 100644 projects/changex/index.js create mode 100644 projects/chronos/index.js create mode 100644 projects/citadao/index.js create mode 100644 projects/citrus/index.js create mode 100644 projects/claimswap-v2/index.js create mode 100644 projects/clober/abi.json create mode 100644 projects/clober/index.js create mode 100644 projects/coindrip/index.js create mode 100644 projects/coinscope/index.js create mode 100644 projects/collectionxyz/index.js create mode 100644 projects/commodo/index.js create mode 100644 projects/componentswap/index.js delete mode 100644 projects/compound-v3/v3abi.js create mode 100644 projects/concentrator/abis/AladdinCVX.json create mode 100644 projects/concentrator/abis/AladdinSdCRV.json create mode 100644 projects/concordex-io/index.js delete mode 100644 projects/config/abis.js delete mode 100644 projects/config/boringdao/abis.js delete mode 100644 projects/config/ellipsis/abis.js delete mode 100644 projects/config/finnexus/abis.js delete mode 100644 projects/config/flamincome/abis.js delete mode 100644 projects/config/indexed/abis.js delete mode 100644 projects/config/n3rd/abis.js delete mode 100644 projects/config/uma/abis.js create mode 100644 projects/conic-omnipool/index.js create mode 100644 projects/contango/index.js create mode 100644 projects/coreswap/index.js create mode 100644 projects/cortexdao/index.js create mode 100644 projects/covo-finance/index.js create mode 100644 projects/covo-v2/index.js create mode 100644 projects/cowswap-cash/index.js create mode 100644 projects/cozy-v2/index.js create mode 100644 projects/crETH2/index.js create mode 100644 projects/cranium/index.js delete mode 100644 projects/credix/credix.json create mode 100644 projects/crescentswap/index.js create mode 100644 projects/cron-fi/index.js create mode 100644 projects/croswap/index.js create mode 100644 projects/crowdswap/index.js create mode 100644 projects/crust-finance/index.js create mode 100644 projects/crv-usd/index.js create mode 100644 projects/cryptex-v2/index.js delete mode 100644 projects/cryptex/cryptex-helper.js delete mode 100644 projects/cryptoyieldfocus/abi.json create mode 100644 projects/cswap/index.js rename projects/{config/curve => curve/historical}/abis.js (58%) create mode 100644 projects/curve/historical/index.js create mode 100644 projects/cypher-trade/idl.json create mode 100644 projects/cypher-trade/index.js create mode 100644 projects/czodiac/abi-chef-czb.json create mode 100644 projects/czodiac/abi-chef-czf.json create mode 100644 projects/czodiac/index.js create mode 100644 projects/dam-finance/index.js create mode 100644 projects/damx/index.js create mode 100644 projects/daolama/borrowed.js create mode 100644 projects/daolama/constants.js create mode 100644 projects/daolama/index.js create mode 100644 projects/daolama/tvl.js delete mode 100644 projects/darkness/utils.js create mode 100644 projects/davos-protocol/index.js create mode 100644 projects/daytona-finance/index.js create mode 100644 projects/dbx-finance/index.js delete mode 100644 projects/debets/getPoolInfo.json create mode 100644 projects/debtdao/index.js create mode 100644 projects/dedust/index.js create mode 100644 projects/deepbook-sui/index.js create mode 100644 projects/defenderfinance/index.js delete mode 100644 projects/defi-basket/abi.json create mode 100644 projects/defi-basket/api.js create mode 100644 projects/defichain-loans/api.js rename projects/{defichain-loans.js => defichain-loans/index.js} (78%) delete mode 100644 projects/defichain-staking.js create mode 100644 projects/defiedge/index.js delete mode 100644 projects/defifranc/getEntireSystemColl.abi.json delete mode 100644 projects/defil/abi.json create mode 100644 projects/defily-dex/index.js create mode 100644 projects/defimaster/index.js create mode 100644 projects/deflex/index.js delete mode 100644 projects/defrost/abi.json create mode 100644 projects/deltaprime/abis/getAllOwnedAssetsAbi.json create mode 100644 projects/deltaprime/index.js create mode 100644 projects/deltaprime/mappings/assetToAddressMapping.json create mode 100644 projects/deridex/index.js create mode 100644 projects/deridex/utils.js create mode 100644 projects/derify/index.js create mode 100644 projects/dexilla/index.js create mode 100644 projects/dexio-protocol/index.js create mode 100644 projects/dexit-swap/index.js create mode 100644 projects/dexswap-arbi/index.js create mode 100644 projects/dexter-tezos/index.js create mode 100644 projects/dexter/index.js delete mode 100644 projects/dextf/abis/getPositions.json delete mode 100644 projects/dextf/abis/getReserves.json delete mode 100644 projects/dextf/abis/getSets.json delete mode 100644 projects/dextf/abis/totalSupply.json delete mode 100644 projects/dfx/contracts.json create mode 100644 projects/diamond-unibot-v2/index.js create mode 100644 projects/dinosaur-finance/index.js create mode 100644 projects/dinotopia/abi.json create mode 100644 projects/dinotopia/index.js create mode 100644 projects/direct-exchange/index.js create mode 100644 projects/djed-alliance/abi.json create mode 100644 projects/djed-alliance/config.json create mode 100644 projects/djed-alliance/index.js delete mode 100644 projects/dmmexchange/abi.json delete mode 100644 projects/dmmexchange/index.js create mode 100644 projects/dogedollar/index.js create mode 100644 projects/dogeswap-org/api.js create mode 100644 projects/dogewhale/index.js create mode 100644 projects/doglands-swap/index.js create mode 100644 projects/doorainu/index.js create mode 100644 projects/doveswap-v3/index.js create mode 100644 projects/doveswap/index.js create mode 100644 projects/dpex/index.js create mode 100644 projects/dracula/index.js create mode 100644 projects/droplit-money/index.js create mode 100644 projects/dsu-money/index.js create mode 100644 projects/dubble-exchange/index.js create mode 100644 projects/duet/abis/ebcake-reader.json create mode 100644 projects/duet/abis/pro-pool.json create mode 100644 projects/duet/arbitrum.js create mode 100644 projects/duet/bsc.js create mode 100644 projects/dyad/index.js create mode 100644 projects/dynastyswap-xyz/index.js create mode 100644 projects/dypius/index.js create mode 100644 projects/dyson-money/index.js create mode 100644 projects/eazyswap/index.js create mode 100644 projects/echodex/index.js create mode 100644 projects/eigenlayer/index.js delete mode 100644 projects/electrikfinance/abi/addressBook.json delete mode 100644 projects/electrikfinance/abi/poolstat.json create mode 100644 projects/ellipisis-phoenix/index.js create mode 100644 projects/empyreal/index.js create mode 100644 projects/ennead/index.js create mode 100644 projects/ennead/ramsesLens.json create mode 100644 projects/enosys-bridge/index.js create mode 100644 projects/ensuro/index.js create mode 100644 projects/entities/a16z-cold.js create mode 100644 projects/entities/akg-ventures.js create mode 100644 projects/entities/animoca-brands.js create mode 100644 projects/entities/arca.js create mode 100644 projects/entities/axia8-venture.js create mode 100644 projects/entities/binance-labs.js create mode 100644 projects/entities/block-one.js create mode 100644 projects/entities/blockchain-capital.js create mode 100644 projects/entities/chain-capital.js create mode 100644 projects/entities/coin98-venture.js create mode 100644 projects/entities/defiance-capital.js create mode 100644 projects/entities/delphi-digital.js create mode 100644 projects/entities/digital-finance-group.js create mode 100644 projects/entities/dragonfly-capital.js create mode 100644 projects/entities/fbg-capital.js create mode 100644 projects/entities/fenbushi-capital.js create mode 100644 projects/entities/framework-ventures.js create mode 100644 projects/entities/genesis-trading.js create mode 100644 projects/entities/id-capital.js create mode 100644 projects/entities/jump-capital.js create mode 100644 projects/entities/mechanism-capital.js create mode 100644 projects/entities/mt-gox.js create mode 100644 projects/entities/multi-chain-capital.js create mode 100644 projects/entities/ngc-ventures.js create mode 100644 projects/entities/pantera-capital.js create mode 100644 projects/entities/paradigm-capital.js create mode 100644 projects/entities/plutus-vc.js create mode 100644 projects/entities/polychain-capital.js create mode 100644 projects/entities/silkroad-fbifunds.js create mode 100644 projects/eoswap/index.js create mode 100644 projects/equilibre/index.js create mode 100644 projects/equilibria/index.js create mode 100644 projects/equilibrium/api.js create mode 100644 projects/equito-finance/index.js create mode 100644 projects/equity/index.js delete mode 100644 projects/ergodex/index.js create mode 100644 projects/esdt-market/index.js create mode 100644 projects/eternalFinance/helper.js create mode 100644 projects/eternalFinance/index.js create mode 100644 projects/eternalFinance/lending.js create mode 100644 projects/eternalFinance/lyf.js create mode 100644 projects/eternalFinance/pancake.js create mode 100644 projects/ether-fi/index.js create mode 100644 projects/etherberry/index.js create mode 100644 projects/ethos/index.js create mode 100644 projects/ethx/index.js delete mode 100644 projects/euler/abi.json create mode 100644 projects/exactly/.prettierrc create mode 100644 projects/exactly/index.js create mode 100644 projects/exit10-fi/index.js create mode 100644 projects/extra/index.js create mode 100644 projects/ezkalibur/index.js create mode 100644 projects/factor-v2/index.js create mode 100644 projects/factor/index.js create mode 100644 projects/fairyswap-v2/index.js create mode 100644 projects/fantOHM/api.js create mode 100644 projects/fathom-dex/index.js create mode 100644 projects/fcondex/index.js create mode 100644 projects/filet/abi.js create mode 100644 projects/fin/index.js create mode 100644 projects/finext-finance/index.js create mode 100644 projects/firebot/index.js create mode 100644 projects/flair-dex/index.js create mode 100644 projects/flareWatermelon/index.js delete mode 100644 projects/flashstake/abi.json create mode 100644 projects/flatcoin/index.js create mode 100644 projects/flokifi-locker/index.js create mode 100644 projects/floor-dao/api.js create mode 100644 projects/florence-finance/index.js create mode 100644 projects/flowx-finance/index.js create mode 100644 projects/fluidity-money/index.js delete mode 100644 projects/fluity/getEntireSystemColl.abi.json create mode 100644 projects/flux-exchange/index.js create mode 100644 projects/fluxbeam-xyz/index.js create mode 100644 projects/fluxfinance/index.js rename projects/folks-finance/{ => v1}/constants.js (98%) create mode 100644 projects/folks-finance/v1/index.js rename projects/folks-finance/{ => v1}/prices.js (96%) create mode 100644 projects/folks-finance/v2/constants.js create mode 100644 projects/folks-finance/v2/index.js create mode 100644 projects/folks-finance/v2/prices.js create mode 100644 projects/folks-xalgo/index.js create mode 100644 projects/footballmanager/index.js delete mode 100644 projects/forcedao/abi.json create mode 100644 projects/forge-sx-dex/index.js create mode 100644 projects/forge/index.js create mode 100644 projects/forgesx/index.js create mode 100644 projects/forta/index.js create mode 100644 projects/forthewin/index.js create mode 100644 projects/fortress/api.js create mode 100644 projects/fortunedao/api.js create mode 100644 projects/fpi/index.js delete mode 100644 projects/fraxfinance/abi.json create mode 100644 projects/freebie/index.js delete mode 100644 projects/frigg-eco/abi/primaryRouter.json create mode 100644 projects/frogge-fi/index.js create mode 100644 projects/froggy-protocol/index.js delete mode 100644 projects/ftmguru/index.js create mode 100644 projects/fujidao-v2/index.js create mode 100644 projects/fulcrom/index.js create mode 100644 projects/funbear/index.js create mode 100644 projects/fundex/index.js create mode 100644 projects/fusionx-fi/index.js create mode 100644 projects/fusionx-v3/index.js create mode 100644 projects/future-swap/index.js create mode 100644 projects/fvm/index.js create mode 100644 projects/fxdx/index.js create mode 100644 projects/galador-io/index.js create mode 100644 projects/galoswap/index.js create mode 100644 projects/gambit-financial/index.js create mode 100644 projects/gambit/index.js create mode 100644 projects/gamutexchange/abi.js create mode 100644 projects/gamutexchange/factory.json create mode 100644 projects/gamutexchange/getTVL.js create mode 100644 projects/gamutexchange/index.js create mode 100644 projects/garbi/index.js create mode 100644 projects/garble-money/index.js create mode 100644 projects/garuda-staking/index.js create mode 100644 projects/gemswap/index.js create mode 100644 projects/genius-yield/index.js create mode 100644 projects/genius/genius-abi.json create mode 100644 projects/genius/genius-stability-abi.json create mode 100644 projects/genius/index.js delete mode 100644 projects/geode/abis/avax/DWP.json delete mode 100644 projects/geode/abis/avax/Portal.json delete mode 100644 projects/geode/abis/avax/gAVAX.json create mode 100644 projects/ghast/index.js create mode 100644 projects/ghost/index.js create mode 100644 projects/glacier-finance/index.js create mode 100644 projects/glif/index.js create mode 100644 projects/gmcash/abi.json create mode 100644 projects/gmcash/index.js create mode 100644 projects/gnd-protocol/index.js delete mode 100644 projects/gnosis/conditional-token.js create mode 100644 projects/goblinscash/api.js create mode 100644 projects/gogopool/index.js create mode 100644 projects/goldbank/index.js create mode 100644 projects/goledo/index.js delete mode 100644 projects/golff-finance/abi.json create mode 100644 projects/goodentry/index.js create mode 100644 projects/gplx/index.js create mode 100644 projects/grappa-finance/grappa-ethereum.js create mode 100644 projects/grappa-finance/index.js create mode 100644 projects/gravita-protocol/index.js create mode 100644 projects/gravity-bridge/index.js create mode 100644 projects/gridex/index.js create mode 100644 projects/grim/config.json create mode 100644 projects/grizzly-trade/index.js delete mode 100644 projects/groprotocol/helpers.js create mode 100644 projects/groveswap/index.js delete mode 100644 projects/growth-defi.js create mode 100644 projects/gumball/index.js create mode 100644 projects/gxypad/index.js create mode 100644 projects/gyroscope/index.js create mode 100644 projects/hadouken-fi-dex/index.js create mode 100644 projects/hadouken-fi-lending/index.js create mode 100644 projects/hamburger/index.js create mode 100644 projects/hashdaofinance/index.js create mode 100644 projects/hashking/index.js create mode 100644 projects/hashmix/index.js create mode 100644 projects/hatom-lending/index.js create mode 100644 projects/hatom-liquid-staking/index.js create mode 100644 projects/hats-v2/index.js create mode 100644 projects/hats/index.js create mode 100644 projects/hawksight/index.js create mode 100644 projects/hector-lendng/index.js create mode 100644 projects/hector/api.js create mode 100644 projects/hedgehog/index.js delete mode 100644 projects/helper/abis/chainlink.json delete mode 100644 projects/helper/abis/getEntireSystemColl.abi.json delete mode 100644 projects/helper/abis/getPair.json delete mode 100644 projects/helper/abis/getPricePerShare.json delete mode 100644 projects/helper/abis/getReserves.json delete mode 100644 projects/helper/abis/kashipair.json delete mode 100644 projects/helper/abis/symbol.json delete mode 100644 projects/helper/abis/token.json delete mode 100644 projects/helper/abis/token0.json delete mode 100644 projects/helper/abis/token1.json delete mode 100644 projects/helper/abis/underlying.json create mode 100644 projects/helper/abis/uniswap.js delete mode 100644 projects/helper/abis/userInfo.json delete mode 100644 projects/helper/ankr/abis/AethToken.json delete mode 100644 projects/helper/ankr/abis/ERC20.json delete mode 100644 projects/helper/ankr/abis/OnsToken.json delete mode 100644 projects/helper/ankr/abis/OnxPool.json delete mode 100644 projects/helper/ankr/abis/OnxToken.json delete mode 100644 projects/helper/ankr/abis/QuickswapPool.json delete mode 100644 projects/helper/ankr/abis/QuickswapVault.json delete mode 100644 projects/helper/ankr/abis/SOnxToken.json delete mode 100644 projects/helper/ankr/abis/SpookyswapPool.json delete mode 100644 projects/helper/ankr/abis/SpookyswapVault.json delete mode 100644 projects/helper/ankr/abis/SushiswapPool.json delete mode 100644 projects/helper/ankr/abis/SushiswapVault.json delete mode 100644 projects/helper/ankr/abis/TraderJoePool.json delete mode 100644 projects/helper/ankr/abis/TraderJoeVault.json delete mode 100644 projects/helper/ankr/abis/UniswapV2Pair.json delete mode 100644 projects/helper/ankr/abis/activePool.json delete mode 100644 projects/helper/ankr/abis/wethAddress.json delete mode 100644 projects/helper/ankr/prices/binance.js create mode 100644 projects/helper/cache/compound.js create mode 100644 projects/helper/cache/getLogs.js create mode 100644 projects/helper/cache/sumUnknownTokens.js create mode 100644 projects/helper/cache/uniswap.js create mode 100644 projects/helper/cache/vestingHelper.js create mode 100644 projects/helper/chain/ergo.js create mode 100644 projects/helper/chain/libre.js create mode 100644 projects/helper/chain/stacks-api.js create mode 100644 projects/helper/chain/stacks.js create mode 100644 projects/helper/chain/starknet.js create mode 100644 projects/helper/chain/sui.js delete mode 100644 projects/helper/chain/terra.js create mode 100644 projects/helper/chain/ton.js create mode 100644 projects/helper/chain/waves.js create mode 100644 projects/helper/compoundV3.js create mode 100644 projects/helper/env.js create mode 100644 projects/helper/erc4626.js delete mode 100644 projects/helper/getBlock.js delete mode 100644 projects/helper/getTokens.js delete mode 100644 projects/helper/getUniFactory.js delete mode 100644 projects/helper/getUsdUniTvl.js delete mode 100644 projects/helper/graph.js create mode 100644 projects/helper/nft.js delete mode 100644 projects/helper/resolveCrvTokens.js create mode 100644 projects/helper/saddle.js delete mode 100644 projects/helper/tokenholders.js create mode 100644 projects/helper/treasury.js create mode 100644 projects/helper/uniswapV3.js create mode 100644 projects/helper/utils/graphql.js create mode 100644 projects/helper/utils/solana/layouts/investin-layout.js create mode 100644 projects/helper/utils/solana/layouts/layout-base.js create mode 100644 projects/helper/utils/solana/layouts/lido.js create mode 100644 projects/helper/utils/solana/layouts/mixed-layout.js create mode 100644 projects/helper/utils/solana/layouts/openbook-layout.js create mode 100644 projects/helper/utils/solana/layouts/phoenix-dex.js create mode 100644 projects/helper/utils/solana/layouts/raydium-layout.js create mode 100644 projects/helper/whitelistedNfts.js create mode 100644 projects/heraswap/index.js create mode 100644 projects/here-staking/index.js create mode 100644 projects/hidden-hand/index.js create mode 100644 projects/hiveswap/index.js create mode 100644 projects/holdr-fi/index.js create mode 100644 projects/holdstation/index.js create mode 100644 projects/hope-swap/index.js create mode 100644 projects/hord-fi/index.js create mode 100644 projects/horizondex/index.js create mode 100644 projects/hotbit/index.js create mode 100644 projects/houdiniswap/index.js create mode 100644 projects/hxro-network/index.js create mode 100644 projects/hydradex-v3/api.js create mode 100644 projects/hydradex-v3/index.js create mode 100644 projects/hydradex/getHydraV3SubgraphTvl.js create mode 100644 projects/hyperliquid/index.js create mode 100644 projects/ibcx/index.js create mode 100644 projects/icpswap/index.js delete mode 100644 projects/ideamarket/abi.json delete mode 100644 projects/idle/abi.json delete mode 100644 projects/ifpool/abis.json create mode 100644 projects/illuminate-fi/index.js create mode 100644 projects/immortal/api.js create mode 100644 projects/immutablex/index.js create mode 100644 projects/inbuilt-finance/index.js create mode 100644 projects/insrt_finance/index.js delete mode 100644 projects/insuredao/abi.json delete mode 100644 projects/integral/abis/sizeGetReserves.json create mode 100644 projects/intercroneswap/index.js create mode 100644 projects/interest-protocol/index.js create mode 100644 projects/interport-finance/index.js create mode 100644 projects/inverse-finance-firm/abi.json create mode 100644 projects/inverse-finance-firm/index.js create mode 100644 projects/izumi/api.js create mode 100644 projects/jadeswap/index.js create mode 100644 projects/jbc/index.js create mode 100644 projects/jediswap/abi.js create mode 100644 projects/jediswap/api.js create mode 100644 projects/jediswap/index.js create mode 100644 projects/jet-protocol-v2-fixed-term/idl.json create mode 100644 projects/jet-protocol-v2-fixed-term/index.js create mode 100644 projects/jetprotocol-v2-margin/index.js create mode 100644 projects/jewelswap-lev-farming/api.js create mode 100644 projects/jewelswap-lev-farming/index.js create mode 100644 projects/jewelswap-lev-farming/jewel-onedex-farm.abi.json create mode 100644 projects/jewelswap-liq-staking/index.js create mode 100644 projects/jewelswap-nft/api.js create mode 100644 projects/jewelswap-nft/index.js create mode 100644 projects/jewelswap-nft/jewel-nft-lending.abi.json create mode 100644 projects/jlswap/index.js create mode 100644 projects/jones-dao/locked.json create mode 100644 projects/jpeg-d/helper/addresses.js create mode 100644 projects/juicebox-v1/index.js create mode 100644 projects/juicebox-v2/index.js create mode 100644 projects/juicebox-v3/index.js create mode 100644 projects/jujubefinance/index.js create mode 100644 projects/justyield/index.js create mode 100644 projects/kaDefi/index.js create mode 100644 projects/kafidao/index.js delete mode 100644 projects/kagla/staking.js delete mode 100644 projects/kagla/utils.js create mode 100644 projects/kannagi-finance/abi.json create mode 100644 projects/kannagi-finance/index.js create mode 100644 projects/kapaswap/index.js create mode 100644 projects/kapinus/index.js create mode 100644 projects/kavafc/index.js create mode 100644 projects/kavastarter/index.js create mode 100644 projects/kei-finance/index.js create mode 100644 projects/key/index.js create mode 100644 projects/kiloex/index.js create mode 100644 projects/kimberlite/abi.json create mode 100644 projects/kimberlite/config.js create mode 100644 projects/kimberlite/index.js create mode 100644 projects/king-finance/index.js create mode 100644 projects/kinza/index.js create mode 100644 projects/kivach/index.js delete mode 100644 projects/klaybank/abi/IDefiLlamaViewer.json create mode 100644 projects/klayswap-v3/index.js create mode 100644 projects/kleva-lend/index.js create mode 100644 projects/kmex-io/index.js create mode 100644 projects/kokomo/index.js create mode 100644 projects/konverter/contracts.json create mode 100644 projects/konverter/index.js create mode 100644 projects/koone/index.js create mode 100644 projects/kriya-dex/index.js create mode 100644 projects/ktx/index.js create mode 100644 projects/kurrency/index.js create mode 100644 projects/kyber-classic/index.js create mode 100644 projects/kyotoswap/index.js create mode 100644 projects/l2fibank-xyz/index.js create mode 100644 projects/ladao-xocolatl/index.js create mode 100644 projects/landshare/index.js create mode 100644 projects/latoken/index.js create mode 100644 projects/lazyfi/index.js create mode 100644 projects/leNFT/index.js create mode 100644 projects/leaguedao/api.js create mode 100644 projects/leetswap/index.js create mode 100644 projects/lendexe/index.js create mode 100644 projects/lendle/index.js create mode 100644 projects/lenlen/index.js create mode 100644 projects/letsfil/index.js create mode 100644 projects/level/index.js create mode 100644 projects/levvy-fi/index.js create mode 100644 projects/lfgswap-arbitrum/index.js create mode 100644 projects/lfgswap-core/index.js create mode 100644 projects/libre-swap/index.js delete mode 100644 projects/lido/abis.json create mode 100644 projects/lif3-trade/index.js create mode 100644 projects/lighter/index.js create mode 100644 projects/line/index.js create mode 100644 projects/lineabank/index.js create mode 100644 projects/lioncommerce/index.js create mode 100644 projects/liondex/index.js create mode 100644 projects/liquid-bolt/index.js delete mode 100644 projects/liquidity-book/index.js delete mode 100644 projects/liquity/getEntireSystemColl.abi.json create mode 100644 projects/liqwid/index.js create mode 100644 projects/litxswap/index.js delete mode 100644 projects/llama-airforce/abi.json create mode 100644 projects/lobsterswap/index.js create mode 100644 projects/lodestar-v1/index.js create mode 100644 projects/lodestar/index.js create mode 100644 projects/lsdx/index.js create mode 100644 projects/lunafi/index.js create mode 100644 projects/lunggens-dex/index.js delete mode 100644 projects/lusd-chickenbonds/getTreasury.abi.json create mode 100644 projects/luxor/api.js create mode 100755 projects/luxs.fi/index.js create mode 100644 projects/lybra/index.js create mode 100644 projects/magicfox-vault/index.js create mode 100644 projects/magicfox/index.js create mode 100644 projects/magicianmv/index.js create mode 100644 projects/magpiexyz/abis/masterMagpie.json create mode 100644 projects/magpiexyz/abis/wombatPoolHelper.json create mode 100644 projects/magpiexyz/config.js delete mode 100644 projects/magpiexyz/pool.js create mode 100644 projects/mahalend/index.js create mode 100644 projects/maia-dao-uni/index.js create mode 100644 projects/maia-dao/api.js create mode 100644 projects/mango-farmers-club/index.js create mode 100644 projects/mango-markets-v4/idl.json create mode 100644 projects/mango-markets-v4/index.js create mode 100644 projects/manifesto/index.js create mode 100644 projects/mantleswap/index.js create mode 100644 projects/maple-rwa/index.js create mode 100644 projects/mare-finance-v2/index.js create mode 100644 projects/mare-finance/index.js create mode 100644 projects/marginfi/idl.js create mode 100644 projects/marginfi/index.js create mode 100644 projects/marginx/index.js create mode 100644 projects/matrixdock/index.js create mode 100644 projects/maverick/index.js create mode 100644 projects/mayfair/index.js create mode 100644 projects/mcs/index.js delete mode 100644 projects/mdex/abi.json delete mode 100644 projects/mdex/api.js delete mode 100644 projects/mdex/subgraphs.js create mode 100644 projects/megamoon/index.js create mode 100644 projects/megatonfi/index.js create mode 100644 projects/meld-gold/index.js create mode 100644 projects/meme-dollar/index.js create mode 100644 projects/memedex/index.js delete mode 100644 projects/mensa/abi.json create mode 100644 projects/merkl/index.js create mode 100644 projects/merlin/index.js create mode 100644 projects/messinaone/index.js create mode 100644 projects/metacoin/index.js create mode 100644 projects/metaid/index.js create mode 100644 projects/metastreet-v2/abi.json create mode 100644 projects/metastreet-v2/index.js create mode 100644 projects/metaswap/index.js create mode 100644 projects/metavault-bo/index.js create mode 100644 projects/metavisor/index.js create mode 100644 projects/meter-Liquid-Staking/index.js delete mode 100644 projects/metf-finance/TreasuryContract.json delete mode 100644 projects/metf-finance/getPairPrice.json delete mode 100644 projects/metf-finance/valueOfAsset.json create mode 100644 projects/metronome-synth/index.js create mode 100644 projects/metropolis/index.js create mode 100644 projects/mexc-cex/index.js create mode 100644 projects/miaswap/index.js create mode 100644 projects/milkomeda-djed/abi.json create mode 100644 projects/milkomeda-djed/config.json create mode 100644 projects/milkomeda-djed/index.js create mode 100644 projects/milkomeda-macc/abi.json create mode 100644 projects/milkomeda-macc/index.js create mode 100644 projects/minerva/index.js create mode 100644 projects/mirrosset/index.js create mode 100644 projects/mm-finance-arbitrum-v3/index.js create mode 100644 projects/mm-finance-arbitrum/index.js delete mode 100644 projects/mmo-finance-polygon/abi.json delete mode 100644 projects/mmo-finance/abi.json delete mode 100644 projects/mmo-finance/genericVaultBalance.json delete mode 100644 projects/mmo-finance/valueOfAsset.json delete mode 100644 projects/mmo/helper/abis/MEtherInterfaceFull.json delete mode 100644 projects/mmo/helper/abis/MtrollerInterfaceFull.json delete mode 100644 projects/mobiusfinance/abis/Resolver.json create mode 100644 projects/mole/utils.js create mode 100644 projects/monolend/index.js create mode 100644 projects/monolith/abis.json create mode 100644 projects/monolith/index.js create mode 100644 projects/monopoly-finance/abi.json create mode 100644 projects/monopoly-finance/index.js create mode 100644 projects/moraswap/index.js create mode 100644 projects/moret/index.js create mode 100644 projects/morphex/index.js create mode 100644 projects/morpho-aaveV3/addresses.js create mode 100644 projects/morpho-aaveV3/index.js create mode 100644 projects/morpho-aaveV3/markets.js create mode 100644 projects/mosquitos-finance/helper.js create mode 100644 projects/mosquitos-finance/index.js create mode 100644 projects/move-dollar/index.js create mode 100644 projects/mstable-yield/index.js create mode 100644 projects/mt-gox/index.js create mode 100644 projects/mufex/index.js create mode 100644 projects/mugen-fi/index.js create mode 100644 projects/multialt-stacking/index.js create mode 100644 projects/mummy/index.js create mode 100644 projects/mute/index.js delete mode 100644 projects/muuu/utils.js create mode 100644 projects/mversex/index.js create mode 100644 projects/mymetatrader/index.js create mode 100644 projects/myso/index.js create mode 100644 projects/myswap/abi.js create mode 100644 projects/myswap/api.js create mode 100644 projects/myswap/index.js create mode 100644 projects/narwhal-finance/index.js create mode 100644 projects/native/index.js create mode 100644 projects/navi/index.js create mode 100644 projects/nayms/index.js create mode 100644 projects/neopin-liquid-staking/index.js create mode 100644 projects/neopin-staking/index.js create mode 100644 projects/neopin/index.js create mode 100644 projects/nervenetworkbridge/index.js create mode 100644 projects/nerveswap/index.js create mode 100644 projects/nestfi/index.js create mode 100644 projects/neutra-finance/index.js create mode 100644 projects/neutroswap/index.js create mode 100644 projects/nexo-cex/index.js create mode 100644 projects/nexon/index.js create mode 100644 projects/nft360/index.js delete mode 100644 projects/nftfi/helper/index.js create mode 100644 projects/nftperp/index.js create mode 100644 projects/nitron/index.js create mode 100644 projects/noahark/index.js create mode 100644 projects/node-dao/index.js delete mode 100644 projects/nodoka/uniswapV3.json create mode 100644 projects/nostra/abi.js create mode 100644 projects/nostra/index.js create mode 100644 projects/notiboy/index.js create mode 100644 projects/nucleon/index.js create mode 100644 projects/numoen/index.js create mode 100644 projects/nuon/index.js create mode 100644 projects/nutbox/index.js create mode 100644 projects/oasisswapdex/index.js create mode 100644 projects/obric/index.js create mode 100644 projects/octolsd/index.js create mode 100644 projects/okc-liquid-staking/index.js create mode 100644 projects/okcoin/index.js create mode 100644 projects/olympulsex/index.js create mode 100644 projects/olympus/api.js create mode 100644 projects/omaxswap/index.js create mode 100644 projects/omicron/api.js create mode 100644 projects/omnidex-perpetuals/index.js delete mode 100644 projects/omniprotocol/helper.js create mode 100644 projects/omt-finance/index.js create mode 100644 projects/onc/index.js create mode 100644 projects/ondofinance-v1/abi.json create mode 100644 projects/ondofinance-v1/index.js delete mode 100644 projects/ondofinance/abi.json create mode 100644 projects/onedex/index.js create mode 100644 projects/onsenswap/index.js create mode 100644 projects/onus-usdo/index.js create mode 100644 projects/onyx/index.js create mode 100644 projects/onyxdao-farm/index.js create mode 100644 projects/openeden-tbill/index.js create mode 100644 projects/openworld/index.js create mode 100644 projects/openxswap/index.js create mode 100644 projects/optim-liquidity-bonds/index.js create mode 100644 projects/optitude/index.js create mode 100644 projects/opyn-convexity/index.js create mode 100644 projects/opyn-gamma/gamma_avax.js create mode 100644 projects/opyn-gamma/gamma_ethereum.js create mode 100644 projects/opyn-gamma/gamma_polygon.js create mode 100644 projects/opyn-gamma/index.js create mode 100644 projects/opyn-squeeth/index.js delete mode 100644 projects/opyn/abis/convexity/collateral.json delete mode 100644 projects/opyn/abis/convexity/getNumberOfOptionsContracts.json delete mode 100644 projects/opyn/abis/convexity/optionsContracts.json delete mode 100644 projects/opyn/abis/gamma/isWhitelistedCollateral.json delete mode 100644 projects/opyn/convexity.js delete mode 100644 projects/opyn/gamma.js delete mode 100644 projects/opyn/gamma_avax.js delete mode 100644 projects/opyn/gamma_polygon.js delete mode 100644 projects/opyn/index.js delete mode 100644 projects/opyn/squeeth.js create mode 100644 projects/oraidex/index.js create mode 100644 projects/orbiter-one/index.js create mode 100644 projects/orca-kujira/index.js delete mode 100644 projects/ordernchaos/index.js create mode 100644 projects/oreoswap/index.js create mode 100644 projects/originether/index.js create mode 100644 projects/orio/index.js delete mode 100644 projects/orion-money/abi.json create mode 100644 projects/oswap-token/index.js delete mode 100644 projects/otterclam.js create mode 100644 projects/overnight-daiPlus/index.js create mode 100644 projects/overnight-usdPlus/index.js create mode 100644 projects/overnight-usdtPlus/index.js delete mode 100644 projects/ovnstable.js create mode 100644 projects/owna/config.js create mode 100644 projects/owna/index.js create mode 100644 projects/pacman/index.js delete mode 100644 projects/paintswap/abis/getReserves.json create mode 100644 projects/pairex/index.js create mode 100644 projects/paladinfinance-warlord/abi.json create mode 100644 projects/paladinfinance-warlord/index.js create mode 100644 projects/palmaswap/index.js create mode 100644 projects/palmswap/index.js create mode 100644 projects/pancake-swap-stableswap/index.js rename projects/{pancake-swap.js => pancake-swap/index.js} (58%) create mode 100644 projects/pancakeswap-v3/index.js create mode 100644 projects/pandachef/index.js delete mode 100644 projects/pandaswap/abi.json create mode 100644 projects/papr-wtf/index.js create mode 100644 projects/parallax/abis/prllxERC20.json create mode 100644 projects/parallax/contracts.json create mode 100644 projects/parallax/getPrice.js create mode 100644 projects/parallax/index.js create mode 100644 projects/paraluni-dex/index.js create mode 100644 projects/paraspace-ape-staking/index.js create mode 100644 projects/paraspace/helper/abis/ApeCoinStaking.json create mode 100644 projects/paraspace/helper/abis/ERC721.json create mode 100644 projects/paraspace/helper/abis/UiPoolDataProvider.json create mode 100644 projects/paraspace/helper/abis/index.js create mode 100644 projects/paraspace/helper/address.js create mode 100644 projects/paraspace/helper/index.js create mode 100644 projects/paraspace/index.js create mode 100644 projects/parcl/index.js create mode 100644 projects/paribus/index.js create mode 100644 projects/pawnfi-ape-staking/index.js create mode 100644 projects/pawnfi-lending/index.js create mode 100644 projects/pawnfi-nft/index.js create mode 100644 projects/pawnfi/helper/abi.json create mode 100644 projects/pawnfi/helper/config.js create mode 100644 projects/pawnfi/index.js create mode 100644 projects/paxo-finance/index.js create mode 100644 projects/pearlfi/index.js delete mode 100644 projects/pegasusdao/index.js create mode 100644 projects/pegasys-v3/index.js create mode 100644 projects/penpie/config.js create mode 100644 projects/penpie/index.js create mode 100644 projects/pepe-bridge/index.js create mode 100644 projects/pepe-swaves/index.js create mode 100644 projects/pepedex/index.js create mode 100644 projects/perennial/index.js create mode 100644 projects/perion/index.js create mode 100644 projects/pheasantswap/index.js create mode 100644 projects/phemex/index.js create mode 100644 projects/phenix-dex/index.js create mode 100644 projects/phezzan/index.js create mode 100644 projects/phoenix-bonds/index.js create mode 100644 projects/phux/index.js delete mode 100644 projects/piggy/abi.json create mode 100644 projects/pika-v4/index.js create mode 100644 projects/pine-protocol/index.js create mode 100644 projects/pinjam/index.js create mode 100644 projects/pinnako/index.js create mode 100644 projects/pirex/abi.json delete mode 100644 projects/platypus-finance/constants.js create mode 100644 projects/pocm-staking/index.js create mode 100644 projects/poison-finance/index.js create mode 100644 projects/polycat-dex/index.js create mode 100644 projects/polynomial-earn/abi.json create mode 100644 projects/polynomial-earn/abi2.json rename projects/{polynomial => polynomial-earn}/index.js (79%) create mode 100644 projects/polynomial-trade/index.js delete mode 100644 projects/polynomial/abi.json delete mode 100644 projects/polynomial/abi2.json delete mode 100644 projects/polyquity/getEntireSystemColl.abi.json rename projects/{qidao/abi.json => polysynth/bps.json} (87%) create mode 100644 projects/polytrade/index.js create mode 100644 projects/ponyswap/index.js create mode 100644 projects/ponytaswap/index.js delete mode 100644 projects/popcorn/abi/basicSetIssuanceModule.json delete mode 100644 projects/popcorn/abi/butterBatchProcessing.json delete mode 100644 projects/popcorn/abi/curveMetapoolABI.json delete mode 100644 projects/popcorn/abi/yearnVaultABI.json create mode 100644 projects/popcorn/vault.js create mode 100644 projects/prePo/index.js create mode 100644 projects/predy-v3/index.js create mode 100644 projects/predy-v320/index.js create mode 100644 projects/predy-v5/index.js create mode 100644 projects/premio/index.js create mode 100644 projects/prime-protocol/index.js delete mode 100644 projects/primitive/.prettierrc delete mode 100644 projects/primitive/abis/getAssetAddresses.json delete mode 100644 projects/primitive/abis/getCacheBalances.json delete mode 100644 projects/primitive/abis/getPair.json delete mode 100644 projects/primitive/abis/getReserves.json delete mode 100644 projects/primitive/abis/getStrikeTokenAddress.json delete mode 100644 projects/primitive/abis/getUnderlyingTokenAddress.json delete mode 100644 projects/primitive/abis/redeemToken.json delete mode 100644 projects/primitive/abis/token0.json delete mode 100644 projects/primitive/abis/token1.json create mode 100644 projects/printy/index.js create mode 100644 projects/privcash/config.js create mode 100644 projects/privcash/index.js create mode 100644 projects/protectorate/index.js create mode 100644 projects/proteo-farms/index.js create mode 100644 projects/proton-dex/index.js create mode 100644 projects/protoss-dex/abi.js create mode 100644 projects/protoss-dex/api.js create mode 100644 projects/protoss-dex/index.js delete mode 100644 projects/prxy/abi.json create mode 100644 projects/psyoptions/psyFiMmIdl.json create mode 100644 projects/psyoptions/psyLendIdl.json create mode 100644 projects/psyoptions/psyfiV2Idl.json create mode 100644 projects/pulsarswap/index.js create mode 100644 projects/pulsemaxfinance/index.js create mode 100644 projects/pulserate/index.js create mode 100644 projects/pulsex-v2/index.js create mode 100644 projects/pulsex/index.js create mode 100644 projects/purple-bridge-dex/index.js create mode 100644 projects/puzzle-lend/index.js create mode 100644 projects/pxswap/index.js create mode 100644 projects/quadrat/index.js create mode 100644 projects/quantumx-network/api.js create mode 100644 projects/quantumx-network/index.js delete mode 100644 projects/quarry/msolLP.js create mode 100644 projects/quasar/index.js create mode 100644 projects/quicksilver/index.js create mode 100644 projects/quickswap-perps/index.js create mode 100644 projects/quipuswap-stableswap/index.js create mode 100644 projects/quipuswap-v2/index.js create mode 100644 projects/quipuswap-v3/index.js create mode 100644 projects/rabbitx/index.js create mode 100644 projects/radiant-v2/index.js create mode 100644 projects/radiate-protocol/index.js create mode 100644 projects/raft/index.js delete mode 100644 projects/ragetrade/tricrypto-vault.json create mode 100644 projects/raidshift/index.js delete mode 100644 projects/railgun/ABI.json create mode 100644 projects/ramses-cl/index.js create mode 100644 projects/ramses/index.js create mode 100644 projects/range/abi.json create mode 100644 projects/range/index.js delete mode 100644 projects/ray/abis/Opportunity.json create mode 100644 projects/rbx/index.js create mode 100644 projects/reactorfusion/index.js create mode 100644 projects/reax-one-dex/index.js create mode 100644 projects/reax-one-lending/index.js create mode 100644 projects/reax-one-synth/index.js delete mode 100644 projects/redbees/index.js create mode 100644 projects/rehold-v2/index.js create mode 100644 projects/rehold/index.js create mode 100644 projects/resonatefinance/index.js create mode 100644 projects/retro/index.js delete mode 100644 projects/rift-finance/abis/masterChefAbi.js delete mode 100644 projects/rift-finance/abis/riftVaultAbi.js create mode 100644 projects/rigoblock/index.js create mode 100644 projects/rising-undead/index.js create mode 100644 projects/rocifi-v2/index.js create mode 100644 projects/rocketswap-cc/index.js create mode 100644 projects/rodeo/abi.json create mode 100644 projects/rodeo/index.js create mode 100644 projects/roe/index.js create mode 100644 projects/rollup-fi/index.js create mode 100644 projects/rose-finance/index.js create mode 100644 projects/ruby-exchange-stable/index.js create mode 100644 projects/ruby-exchange/index.js create mode 100644 projects/rubydex/index.js create mode 100644 projects/rysk/index.js create mode 100644 projects/sablier-v2/index.js delete mode 100644 projects/saddle/config.json create mode 100644 projects/saddle/contracts.json create mode 100644 projects/sagebet/index.js create mode 100644 projects/saitaswap/index.js create mode 100644 projects/sakai-vault/index.js create mode 100644 projects/salsa/index.js create mode 100644 projects/sandclock/index.js create mode 100644 projects/satin/index.js create mode 100644 projects/satori/index.js create mode 100644 projects/satoshiswap/index.js create mode 100644 projects/savvy/contracts.json create mode 100644 projects/savvy/index.js create mode 100644 projects/scanto/index.js create mode 100644 projects/scaryswap/contracts.json create mode 100644 projects/scaryswap/pool.json delete mode 100644 projects/scientixfinance/abi/AlpacaVault.json delete mode 100644 projects/scientixfinance/abi/ScToken.json delete mode 100644 projects/scientixfinance/abi/Scientist.json delete mode 100644 projects/scientixfinance/abi/StakingPools.json delete mode 100644 projects/scientixfinance/abi/Transmuter.json delete mode 100644 projects/scientixfinance/abi/VotingEscrow.json delete mode 100644 projects/scientixfinance/abi/YearnVaultAdapterWithIndirection.json delete mode 100644 projects/scrubKava/index.js create mode 100644 projects/scrubinvest/index.js create mode 100644 projects/seashell/index.js create mode 100644 projects/sector-fi/index.js create mode 100644 projects/selfex/index.js delete mode 100644 projects/set-protocol/abis/getPositions.json delete mode 100644 projects/set-protocol/abis/getReserves.json delete mode 100644 projects/set-protocol/abis/getSets.json delete mode 100644 projects/set-protocol/abis/totalSupply.json create mode 100644 projects/sevenswap/index.js create mode 100644 projects/sft-protocol/index.js create mode 100644 projects/shadeprotocol-derivatives/index.js create mode 100644 projects/shadeprotocol-lend/index.js create mode 100644 projects/shadeprotocol-silk/index.js create mode 100644 projects/shadeprotocol-swap/index.js create mode 100644 projects/shadeswap/index.js create mode 100644 projects/shadowswap/index.js create mode 100644 projects/sharelock/index.js create mode 100644 projects/sharky/helper/index.js create mode 100644 projects/sharky/helper/sharky.json create mode 100644 projects/sharky/index.js create mode 100644 projects/sharkyswap/index.js delete mode 100644 projects/shibance-bsc/abi.json delete mode 100644 projects/shibance-bsc/constants/abi.json delete mode 100644 projects/shibance-bsc/constants/bsc/contracts.js delete mode 100644 projects/shibance-bsc/constants/bsc/farms.js delete mode 100644 projects/shibance-bsc/constants/bsc/pools.js delete mode 100644 projects/shibance-bsc/constants/bsc/tokens.js delete mode 100644 projects/shibance-bsc/constants/chain.js delete mode 100644 projects/shibance-bsc/constants/kcc/contracts.js delete mode 100644 projects/shibance-bsc/constants/kcc/farms.js delete mode 100644 projects/shibance-bsc/constants/kcc/pools.js delete mode 100644 projects/shibance-bsc/constants/kcc/tokens.js delete mode 100644 projects/shibance-bsc/farm.js delete mode 100644 projects/shibance-bsc/format.js delete mode 100644 projects/shibance-bsc/index.js delete mode 100644 projects/shibance-bsc/pool.js delete mode 100644 projects/shibance-bsc/vault.js create mode 100644 projects/shibshift/index.js create mode 100644 projects/shoebillFinance/index.js create mode 100644 projects/shrike-perps/index.js create mode 100644 projects/sigmafi/index.js create mode 100644 projects/sigmao/index.js create mode 100644 projects/silkroad-fbifunds/index.js create mode 100644 projects/single/abi.js delete mode 100644 projects/single/cronos/vvsPoolInfo.json delete mode 100644 projects/single/fantom/spookyMasterChefV2PoolInfo.json delete mode 100644 projects/sio2/abi.json delete mode 100644 projects/sio2/constants.js delete mode 100644 projects/sio2/sio2.js delete mode 100644 projects/sio2/utils.js create mode 100644 projects/sithswap/abi.js create mode 100644 projects/sithswap/api.js create mode 100644 projects/sithswap/index.js create mode 100644 projects/skullswap-v3/index.js create mode 100644 projects/skullswap/index.js create mode 100644 projects/skydex/index.js create mode 100644 projects/slsd/index.js create mode 100644 projects/smbswap-v3/index.js create mode 100644 projects/snarklaunch/index.js create mode 100644 projects/snowswap-xyz/index.js create mode 100644 projects/soarpulse/index.js create mode 100644 projects/sobal/index.js create mode 100644 projects/sohei/index.js create mode 100644 projects/solid-world/abi.json create mode 100644 projects/solid-world/config.js create mode 100644 projects/solid-world/index.js create mode 100644 projects/solidlizard/index.js create mode 100644 projects/solidly-v2/index.js create mode 100644 projects/solisnek/index.js create mode 100644 projects/solunea/index.js create mode 100644 projects/solv-protocol-v3/abi.json create mode 100644 projects/solv-protocol-v3/index.js delete mode 100644 projects/sommelier/utils.js create mode 100644 projects/sommelier/v2.js delete mode 100644 projects/sorbetto/abi.json delete mode 100644 projects/sorbetto/index.js delete mode 100644 projects/soulswap/abis/getReserves.json delete mode 100644 projects/soulswap/abis/token0.json delete mode 100644 projects/soulswap/abis/token1.json create mode 100644 projects/sovryn-dex/index.js create mode 100644 projects/sovryn-lending/index.js create mode 100644 projects/sovryn-zero/index.js delete mode 100644 projects/sovryn.js create mode 100644 projects/spacedex-io/index.js create mode 100644 projects/spark-fi/index.js create mode 100644 projects/sperax-demeter/index.js create mode 100644 projects/spice-finance/index.js create mode 100644 projects/spin-prep/index.js create mode 100644 projects/spin-vault/index.js create mode 100644 projects/spiral-dao/abi.json create mode 100644 projects/spiral-dao/index.js create mode 100644 projects/spiral-fi-mixer/index.js create mode 100644 projects/spl-governance/index.js create mode 100644 projects/spoon-exchange/index.js create mode 100644 projects/stUSDT/index.js delete mode 100644 projects/stabilizefi/getEntireSystemColl.abi.json delete mode 100644 projects/stabilizefi/totalTokenStaked.abi.json create mode 100644 projects/stabl-v2/abi.json create mode 100644 projects/stabl-v2/index.js create mode 100644 projects/stablz/index.js create mode 100644 projects/stackswap/api.js create mode 100644 projects/stakedicp/index.js create mode 100644 projects/stakedotlink-index/index.js create mode 100644 projects/stakedotlink/index.js delete mode 100644 projects/stakesteak/abi.json create mode 100644 projects/starfish-liq-staking/index.js create mode 100644 projects/stargate-finance/api.js create mode 100644 projects/stargaze/index.js create mode 100644 projects/starkex/abi.js create mode 100644 projects/starkex/api.js create mode 100644 projects/starkex/index.js delete mode 100644 projects/starlay/abi.json delete mode 100644 projects/starlay/constanrs.js delete mode 100644 projects/starlay/starlay.js delete mode 100644 projects/starlay/utils.js delete mode 100644 projects/starlay/ve.js create mode 100644 projects/starmaker/index.js create mode 100644 projects/steadefi/index.js delete mode 100644 projects/steak/terra.test.js create mode 100644 projects/steakHut-lb/abi.json create mode 100644 projects/steakHut-lb/index.js create mode 100644 projects/steer/index.js create mode 100644 projects/stellaswap-v3/index.js create mode 100644 projects/stellaxyz-io/index.js create mode 100644 projects/sterling-finance/index.js create mode 100644 projects/steth-win/index.js create mode 100644 projects/stfil/index.js create mode 100644 projects/ston/index.js create mode 100644 projects/stream/abi.js create mode 100644 projects/stream/index.js create mode 100644 projects/streamflow/api.js create mode 100644 projects/streamflow/index.js create mode 100644 projects/struct-finance/index.js create mode 100644 projects/subzero-plus/index.js create mode 100644 projects/sudoswap-v2/index.js create mode 100644 projects/sugarswap/index.js create mode 100644 projects/summer-fi/api.js create mode 100644 projects/summer-fi/constants/abi.js create mode 100644 projects/summer-fi/constants/contracts.js create mode 100644 projects/summer-fi/constants/creation-blocks.js create mode 100644 projects/summer-fi/constants/endpoints.js create mode 100644 projects/summer-fi/constants/index.js create mode 100644 projects/summer-fi/constants/logs-topic.js create mode 100644 projects/summer-fi/handlers/automation-v1.js create mode 100644 projects/summer-fi/handlers/dpm-positions.js create mode 100644 projects/summer-fi/handlers/index.js create mode 100644 projects/summer-fi/handlers/maker-vaults.js create mode 100644 projects/summer-fi/helpers/calls.js create mode 100644 projects/summer-fi/helpers/get-automation-cdp-ids.js create mode 100644 projects/summer-fi/helpers/index.js create mode 100644 projects/summer-fi/index.js delete mode 100644 projects/sunSwap/index.js create mode 100644 projects/sunswap-v2/api.js create mode 100644 projects/sunswap-v2/index.js create mode 100644 projects/superlauncher/index.js create mode 100644 projects/surfswap-stableswap/index.js create mode 100644 projects/surge/index.js create mode 100644 projects/sushiswap-v3/index.js create mode 100644 projects/swaap-v2/index.js create mode 100644 projects/swapbase/index.js create mode 100644 projects/swapline/index.js create mode 100644 projects/swaprum/index.js create mode 100644 projects/swapscanner-staking/index.js create mode 100644 projects/swapsicle/iceBoxABI.json create mode 100644 projects/swapsicle/icevaultABI.json create mode 100644 projects/swell/index.js create mode 100644 projects/swirllend/index.js delete mode 100644 projects/symbiosis-finance/abi/getToken.json create mode 100644 projects/symbiosis-finance/config.js create mode 100644 projects/symmetry/index.js create mode 100644 projects/syncdex-finance/index.js create mode 100644 projects/syncswap/index.js create mode 100644 projects/synfutures-v2/index.js create mode 100644 projects/synthetix-v1/index.js create mode 100644 projects/synthetix-v2/index.js create mode 100644 projects/synthex/index.js create mode 100644 projects/synthswap/index.js create mode 100644 projects/syrupfinance/index.js create mode 100644 projects/t-protocol/index.js create mode 100644 projects/tai-money/index.js create mode 100644 projects/tangent-protocol/index.js create mode 100644 projects/tashi/index.js create mode 100644 projects/tbtc/index.js create mode 100644 projects/teahouse-v3/abi.json create mode 100644 projects/teahouse-v3/index.js create mode 100644 projects/teahouse/abi.json create mode 100644 projects/teahouse/index.js create mode 100644 projects/tealswap/index.js delete mode 100644 projects/teddy/getEntireSystemColl.abi.json create mode 100644 projects/tegisto/index.js create mode 100644 projects/tegro/index.js create mode 100644 projects/teller/index.js create mode 100644 projects/templar/api.js create mode 100644 projects/tender-finance/index.js delete mode 100644 projects/tenderize/tenderSwapABI.json create mode 100644 projects/tendieswap-app/index.js create mode 100644 projects/tenx-exchange/index.js create mode 100644 projects/tethys-perpetual/index.js create mode 100644 projects/tetu-pawnshop/index.js create mode 100644 projects/thalaswap/index.js delete mode 100644 projects/the-granary/abi.json create mode 100644 projects/themis-capital-dex/index.js create mode 100644 projects/themis-capital-ohm/index.js create mode 100644 projects/themis-exchange/index.js create mode 100644 projects/thena-v3/index.js create mode 100644 projects/thena/index.js create mode 100644 projects/tigris/index.js create mode 100644 projects/timeswap-v2/index.js create mode 100644 projects/tipidao/api.js create mode 100644 projects/titi-finance/index.js create mode 100644 projects/tlchain-decryption/index.js create mode 100644 projects/tonic-cash/config.js create mode 100644 projects/tonic-cash/index.js create mode 100644 projects/tonic/index.js create mode 100644 projects/toreus/index.js create mode 100644 projects/traddify/index.js create mode 100644 projects/traderjoe-lb-v2-1/index.js create mode 100644 projects/traderjoe-lb/index.js create mode 100644 projects/trainswap/index.js create mode 100644 projects/tranchess-ETH/abi.json create mode 100644 projects/tranchess-ETH/index.js create mode 100644 projects/treasury/1inch.js create mode 100644 projects/treasury/3xcalibur.js create mode 100644 projects/treasury/aave.js create mode 100644 projects/treasury/aavegotchi.js create mode 100644 projects/treasury/abracadabra.js create mode 100644 projects/treasury/across.js create mode 100644 projects/treasury/airswap.js create mode 100644 projects/treasury/ajira-pay-finance.js create mode 100644 projects/treasury/alchemix.js create mode 100644 projects/treasury/alpacacity.js create mode 100644 projects/treasury/alyx.js create mode 100644 projects/treasury/antfarm_finance.js create mode 100644 projects/treasury/ape-coin.js create mode 100644 projects/treasury/apex-protocol.js create mode 100644 projects/treasury/api3.js create mode 100644 projects/treasury/apollox.js create mode 100644 projects/treasury/aragon.js create mode 100644 projects/treasury/arbitrum-dao.js create mode 100644 projects/treasury/archimedes.js create mode 100644 projects/treasury/atlas-usv.js create mode 100644 projects/treasury/augury.js create mode 100644 projects/treasury/aura.js create mode 100644 projects/treasury/axelar.js create mode 100644 projects/treasury/badger-dao.js create mode 100644 projects/treasury/balancer.js create mode 100644 projects/treasury/bancor.js create mode 100644 projects/treasury/banklessdao.js create mode 100644 projects/treasury/bankofcronos.js create mode 100644 projects/treasury/battlefly.js create mode 100644 projects/treasury/beanstalk.js create mode 100644 projects/treasury/beefy.js create mode 100644 projects/treasury/beethovenx.js create mode 100644 projects/treasury/benddao.js create mode 100644 projects/treasury/benqi.js create mode 100644 projects/treasury/betswirl.js create mode 100644 projects/treasury/bitdao.js create mode 100644 projects/treasury/btcst.js create mode 100644 projects/treasury/camelot.js create mode 100644 projects/treasury/cap.js create mode 100644 projects/treasury/cat-in-a-box.js create mode 100644 projects/treasury/cerberusdao.js create mode 100644 projects/treasury/chaintools.js create mode 100644 projects/treasury/compound.js create mode 100644 projects/treasury/convex.js create mode 100644 projects/treasury/crabada.js create mode 100644 projects/treasury/cream-finance.js create mode 100644 projects/treasury/croblanc.js create mode 100644 projects/treasury/cryptex.js create mode 100644 projects/treasury/cryptodickbutts.js create mode 100644 projects/treasury/cthulhufinance.js create mode 100644 projects/treasury/cubo.js create mode 100644 projects/treasury/curve.js create mode 100644 projects/treasury/cvi.js create mode 100644 projects/treasury/defender.js create mode 100644 projects/treasury/deri-protocol.js create mode 100644 projects/treasury/dex.js create mode 100644 projects/treasury/dforce.js create mode 100644 projects/treasury/dfyn.js create mode 100644 projects/treasury/dnadollar.js create mode 100644 projects/treasury/dodo.js create mode 100644 projects/treasury/dopex.js create mode 100644 projects/treasury/dxdao.js create mode 100644 projects/treasury/dydx.js create mode 100644 projects/treasury/ease-org.js create mode 100644 projects/treasury/elements-fi.js create mode 100644 projects/treasury/empyreal.js create mode 100644 projects/treasury/ens.js create mode 100644 projects/treasury/equilibre.js create mode 100644 projects/treasury/eth-foundation.js create mode 100644 projects/treasury/ether.js create mode 100644 projects/treasury/ethglobal.js create mode 100644 projects/treasury/euler.js create mode 100644 projects/treasury/evmos-dao.js create mode 100644 projects/treasury/exactly.js create mode 100644 projects/treasury/fantohm-dao.js create mode 100644 projects/treasury/fei-protocol.js create mode 100644 projects/treasury/femboy-dao.js create mode 100644 projects/treasury/flair-dex.js create mode 100644 projects/treasury/flokifi-locker.js create mode 100644 projects/treasury/floor-dao.js create mode 100644 projects/treasury/forth-dao.js create mode 100644 projects/treasury/fortress.js create mode 100644 projects/treasury/fortunedao.js create mode 100644 projects/treasury/frax.js create mode 100644 projects/treasury/friendswithbenefits.js create mode 100644 projects/treasury/futureswap.js create mode 100644 projects/treasury/gains.js create mode 100644 projects/treasury/galaxygoogle.js create mode 100644 projects/treasury/gale.js create mode 100644 projects/treasury/galxe.js create mode 100644 projects/treasury/gearbox.js create mode 100644 projects/treasury/geth.js create mode 100644 projects/treasury/gitcoin.js create mode 100644 projects/treasury/giveth.js create mode 100644 projects/treasury/gnosis-dao.js create mode 100644 projects/treasury/goblinscash.js create mode 100644 projects/treasury/golem.js create mode 100644 projects/treasury/gooddollar.js create mode 100644 projects/treasury/grabi.js create mode 100644 projects/treasury/guru-network.js create mode 100644 projects/treasury/gyro.js create mode 100644 projects/treasury/handlefi.js create mode 100644 projects/treasury/hector.js create mode 100644 projects/treasury/hegic.js create mode 100644 projects/treasury/hop.js create mode 100644 projects/treasury/idle-dao.js create mode 100644 projects/treasury/illuvium.js create mode 100644 projects/treasury/immortal.js create mode 100644 projects/treasury/impermax.js create mode 100644 projects/treasury/index-coop.js create mode 100644 projects/treasury/india-covid-relief-fund.js create mode 100644 projects/treasury/instadapp.js create mode 100644 projects/treasury/insure-dao.js create mode 100644 projects/treasury/interport-finance.js create mode 100644 projects/treasury/inverse.js create mode 100644 projects/treasury/ipor.js create mode 100644 projects/treasury/iq.js create mode 100644 projects/treasury/jade-protocol.js create mode 100644 projects/treasury/jonesdao.js create mode 100644 projects/treasury/jpegd.js create mode 100644 projects/treasury/just-yield.js create mode 100644 projects/treasury/keeperdao.js create mode 100644 projects/treasury/kei.js create mode 100644 projects/treasury/king-finance.js create mode 100644 projects/treasury/kinza.js create mode 100644 projects/treasury/klima-dao.js create mode 100644 projects/treasury/koyo.js create mode 100644 projects/treasury/kromatika.js create mode 100644 projects/treasury/kyber.js create mode 100644 projects/treasury/l2beat.js create mode 100644 projects/treasury/leaguedao.js create mode 100644 projects/treasury/level.js create mode 100644 projects/treasury/lido.js create mode 100644 projects/treasury/liondex.js create mode 100644 projects/treasury/liquity-treasury.js create mode 100644 projects/treasury/looksrare.js create mode 100644 projects/treasury/lsdx-finance.js create mode 100644 projects/treasury/luxor.js create mode 100644 projects/treasury/lyra.js create mode 100644 projects/treasury/macaron.js create mode 100644 projects/treasury/mahadao.js create mode 100644 projects/treasury/maia-dao.js create mode 100644 projects/treasury/maker.js create mode 100644 projects/treasury/mantra-dao.js create mode 100644 projects/treasury/maple.js create mode 100644 projects/treasury/metacartel.js create mode 100644 projects/treasury/metronome.js create mode 100644 projects/treasury/mimo-protocol.js create mode 100644 projects/treasury/moret.js create mode 100644 projects/treasury/mstable.js create mode 100644 projects/treasury/mux.js create mode 100644 projects/treasury/mycelium.js create mode 100644 projects/treasury/nemesis.js create mode 100644 projects/treasury/neutra-finance.js create mode 100644 projects/treasury/newland.js create mode 100644 projects/treasury/nexus-mutual.js create mode 100644 projects/treasury/nftx.js create mode 100644 projects/treasury/notiboy-treasury.js create mode 100644 projects/treasury/notional.js create mode 100644 projects/treasury/nouns.js create mode 100644 projects/treasury/o2-dao.js create mode 100644 projects/treasury/o3-swap.js create mode 100644 projects/treasury/oasisswapdex.js create mode 100644 projects/treasury/oceanus.js create mode 100644 projects/treasury/olympulsex.js create mode 100644 projects/treasury/olympus-dao.js create mode 100644 projects/treasury/omicron.js create mode 100644 projects/treasury/ooki.js create mode 100644 projects/treasury/op-foundation.js create mode 100644 projects/treasury/open-oceans.js create mode 100644 projects/treasury/openxswap.js create mode 100644 projects/treasury/ovr.js create mode 100644 projects/treasury/p-network.js create mode 100644 projects/treasury/paladin-finance.js create mode 100644 projects/treasury/paraswap.js create mode 100644 projects/treasury/parrot-protocol.js create mode 100644 projects/treasury/peardao.js create mode 100644 projects/treasury/pegasusfinance.js create mode 100644 projects/treasury/perion.js create mode 100644 projects/treasury/perpetual-protocol.js create mode 100644 projects/treasury/piedao.js create mode 100644 projects/treasury/platypus.js create mode 100644 projects/treasury/pleasrdao.js create mode 100644 projects/treasury/plutusdao.js create mode 100644 projects/treasury/pooltogether.js create mode 100644 projects/treasury/premia.js create mode 100644 projects/treasury/puli.js create mode 100644 projects/treasury/push.js create mode 100644 projects/treasury/qidao.js create mode 100644 projects/treasury/radiant.js create mode 100644 projects/treasury/railgun.js create mode 100644 projects/treasury/rarible.js create mode 100644 projects/treasury/redacted.js create mode 100644 projects/treasury/relay.js create mode 100644 projects/treasury/revoke.js create mode 100644 projects/treasury/revoluzion.js create mode 100644 projects/treasury/ribbon.js create mode 100644 projects/treasury/rotki.js create mode 100644 projects/treasury/router.js create mode 100644 projects/treasury/saddle.js create mode 100644 projects/treasury/safe.js create mode 100644 projects/treasury/sakai-vault.js create mode 100644 projects/treasury/savvy.js create mode 100644 projects/treasury/shapeshift.js create mode 100644 projects/treasury/shibui.js create mode 100644 projects/treasury/silo-finance.js create mode 100644 projects/treasury/snapshot.js create mode 100644 projects/treasury/spartacus.js create mode 100644 projects/treasury/sperax.js create mode 100644 projects/treasury/sphere-finance.js create mode 100644 projects/treasury/spherium.js create mode 100644 projects/treasury/spiral-dao.js create mode 100644 projects/treasury/spookyswap.js create mode 100644 projects/treasury/spool-protocol.js create mode 100644 projects/treasury/stakedao.js create mode 100644 projects/treasury/stargate-finance.js create mode 100644 projects/treasury/stargate.js create mode 100644 projects/treasury/stealcam.js create mode 100644 projects/treasury/sudoswap.js create mode 100644 projects/treasury/sushiswap.js create mode 100644 projects/treasury/synapse.js create mode 100644 projects/treasury/synthetix.js create mode 100644 projects/treasury/teddy.js create mode 100644 projects/treasury/templar-dao.js create mode 100644 projects/treasury/tempus-finance.js create mode 100644 projects/treasury/thales.js create mode 100644 projects/treasury/thellamas.js create mode 100644 projects/treasury/themis-capital-ohm.js create mode 100644 projects/treasury/tipidao.js create mode 100644 projects/treasury/tokemak.js create mode 100644 projects/treasury/tokenIon.js create mode 100644 projects/treasury/tornado-cash.js create mode 100644 projects/treasury/traderjoe.js create mode 100644 projects/treasury/tranchess.js create mode 100644 projects/treasury/treasure-dao.js create mode 100644 projects/treasury/umamifinance.js create mode 100644 projects/treasury/uniswap.js create mode 100644 projects/treasury/uwulend.js create mode 100644 projects/treasury/vaporfi.js create mode 100644 projects/treasury/velodrome.js create mode 100644 projects/treasury/venus.js create mode 100644 projects/treasury/vesta.js create mode 100644 projects/treasury/void.js create mode 100644 projects/treasury/volta-dao.js create mode 100644 projects/treasury/volta.js create mode 100644 projects/treasury/wagmi.js create mode 100644 projects/treasury/wagmidao.js create mode 100644 projects/treasury/we-piggy.js create mode 100644 projects/treasury/wonderland.js create mode 100644 projects/treasury/woofi.js create mode 100644 projects/treasury/x7.js create mode 100644 projects/treasury/xeus.js create mode 100644 projects/treasury/y2k.js create mode 100644 projects/treasury/yam-finance.js create mode 100644 projects/treasury/yearn.js create mode 100644 projects/treasury/yield-guild-game.js create mode 100644 projects/treasury/zachxtb-theman.js create mode 100644 projects/treasury/zero-swap.js create mode 100644 projects/treasury/zigzag.js create mode 100644 projects/treasury/zyber-swap.js create mode 100644 projects/tribe3/index.js create mode 100644 projects/tropykus-zkevm/index.js create mode 100644 projects/truefeedback/index.js create mode 100644 projects/trufin-trustake/index.js create mode 100644 projects/trufin/abi.json create mode 100644 projects/trufin/index.js create mode 100644 projects/tsunami-fi/index.js create mode 100644 projects/turbos/index.js create mode 100644 projects/twtstake/index.js create mode 100644 projects/typus-finance/index.js create mode 100644 projects/umee/index.js create mode 100644 projects/unamano/index.js create mode 100644 projects/unicrypt-v3/index.js create mode 100644 projects/unieth/index.js create mode 100644 projects/unifi-protocol-staking/index.js delete mode 100644 projects/unipilot/abis/getPositionDetails.json delete mode 100644 projects/united-farmers/index.js create mode 100644 projects/uniwhale/index.js create mode 100644 projects/uniwswap-unia/index.js create mode 100644 projects/unlimited-trade/index.js create mode 100644 projects/unlockd/helper/address.js create mode 100644 projects/unlockd/index.js create mode 100644 projects/uno-farm/apps.json create mode 100644 projects/uno-farm/index.js create mode 100644 projects/uno-farm/uno-helplers/abis/UnoFactory.json create mode 100644 projects/uno-farm/uno-helplers/abis/UnoFarmBalancer.json create mode 100644 projects/uno-farm/uno-helplers/abis/UnoFarmQuickswap.json create mode 100644 projects/uno-farm/uno-helplers/index.js create mode 100644 projects/unsheth/index.js create mode 100644 projects/urdex/index.js create mode 100644 projects/usesugarswap/index.js create mode 100644 projects/uswap-me/index.js create mode 100644 projects/uwu-cash/index.js delete mode 100644 projects/valueliquid/abis/getCurrentTokens.json create mode 100644 projects/vapordex/index.js create mode 100644 projects/vaultka/index.js create mode 100644 projects/veax/index.js delete mode 100644 projects/vector/abi.json create mode 100644 projects/vector/vectorContracts.json create mode 100644 projects/vega-protocol/index.js create mode 100644 projects/vela-exchange/index.js create mode 100644 projects/velocimeter-v2/index.js create mode 100644 projects/velocore-v2/index.js create mode 100644 projects/velocore/index.js create mode 100644 projects/velodrome-v2/index.js create mode 100644 projects/velvet-capital/index.js create mode 100644 projects/vendor-finance-v2/index.js delete mode 100644 projects/vendor-finance/cmUmami.abi.json create mode 100644 projects/veniceswap/index.js create mode 100644 projects/venofinance/index.js create mode 100644 projects/venus-isolated-pools/index.js create mode 100644 projects/veplus/index.js create mode 100644 projects/verified-credits/index.js create mode 100644 projects/vertex/index.js delete mode 100644 projects/vesta/getEntireSystemColl.abi.json delete mode 100644 projects/vesta/vestaFarming.abi.json create mode 100644 projects/vestige/index.js create mode 100644 projects/vesync/index.js create mode 100644 projects/vett/index.js create mode 100644 projects/vidya/index.js create mode 100644 projects/visor/abis/hypeRegistry.json create mode 100644 projects/visor/abis/tokens.json create mode 100644 projects/vitcswap/api.js create mode 100644 projects/vivaleva/index.js create mode 100644 projects/void/index.js create mode 100644 projects/volta-dao/api.js create mode 100644 projects/volta-finance/index.js create mode 100644 projects/voodoo-trade/index.js delete mode 100644 projects/vortex/http.js delete mode 100644 projects/vortex/queries.js delete mode 100644 projects/vortex/vortex.api.js delete mode 100644 projects/votium/index.js create mode 100644 projects/vyfi-dex/index.js create mode 100644 projects/wagmi-com/index.js create mode 100644 projects/wasabi/index.js create mode 100644 projects/waterdendy/index.js create mode 100644 projects/weave/index.js create mode 100644 projects/wemix-fi/index.js create mode 100644 projects/wemix-lend/index.js create mode 100644 projects/wemix-staking/index.js create mode 100644 projects/whalegame/index.js delete mode 100644 projects/wheat.js create mode 100644 projects/whitehole-finance/index.js create mode 100644 projects/whitewhale-dex/index.js create mode 100644 projects/winr-protocol/index.js create mode 100644 projects/wombat-exchange/config.js create mode 100644 projects/wombex/config.js create mode 100644 projects/wonderland/api.js create mode 100644 projects/wonderly/abi.json create mode 100644 projects/wonderly/index.js create mode 100644 projects/woo-cex/index.js create mode 100644 projects/worldmobiletoken/index.js create mode 100644 projects/wtfdex/index.js create mode 100644 projects/wyndao-dex/index.js create mode 100644 projects/wyndao-lsd/index.js create mode 100644 projects/x7/index.js create mode 100644 projects/xWinFinance/Helper.js create mode 100644 projects/xWinFinance/index.js create mode 100644 projects/xbacked/index.js create mode 100644 projects/xbank/index.js create mode 100644 projects/xbluefinance/index.js delete mode 100644 projects/xcadnetwork/index.js delete mode 100644 projects/xdao.js delete mode 100644 projects/xdollar-finance/getEntireSystemColl.abi.json delete mode 100644 projects/xensa/abi.json create mode 100644 projects/xeus/api.js create mode 100644 projects/xlsd/index.js create mode 100644 projects/xpla/index.js create mode 100644 projects/y2b-finance/index.js create mode 100644 projects/y2k-finance/index.js create mode 100644 projects/y2k-v2/index.js create mode 100644 projects/yama-finance/index.js delete mode 100644 projects/yetiFinance/curve_get_virtual_price.abi.json delete mode 100644 projects/yetiFinance/farmPoolTotalSupply.abi.json delete mode 100644 projects/yetiFinance/fetchPrice_v.abi.json delete mode 100644 projects/yetiFinance/getAllCollateral.abi.json delete mode 100644 projects/yetiFinance/getPrice.abi.json delete mode 100644 projects/yetiFinance/getReserves.json create mode 100644 projects/yieldbank/index.js delete mode 100644 projects/yieldis/abi.json create mode 100644 projects/yodeswap/api.js create mode 100644 projects/ysmart/index.js create mode 100644 projects/zeniq-swap/index.js create mode 100644 projects/zenith/contracts.json create mode 100644 projects/zenith/index.js create mode 100644 projects/zenithswap/index.js delete mode 100644 projects/zenlink/abis/factory.json delete mode 100644 projects/zenlink/abis/getReserves.json delete mode 100644 projects/zenlink/abis/stake.json delete mode 100644 projects/zenlink/abis/token0.json delete mode 100644 projects/zenlink/abis/token1.json delete mode 100644 projects/zenlink/getUsdTvl.js create mode 100644 projects/zerolend/index.js delete mode 100644 projects/zerotwohm/index.js delete mode 100644 projects/zeus/index.js create mode 100644 projects/zharta/index.js create mode 100644 projects/zilch/abi.js create mode 100644 projects/zilch/index.js create mode 100644 projects/zk-swap-dex/index.js create mode 100644 projects/zk-swap/index.js create mode 100644 projects/zkBoost/abi.js create mode 100644 projects/zkBoost/config.js create mode 100644 projects/zkBoost/index.js create mode 100644 projects/zkSwap-finance/index.js create mode 100644 projects/zkasino/index.js create mode 100644 projects/zkbob-cdp/index.js create mode 100644 projects/zkdefi/index.js create mode 100644 projects/zkdx/index.js create mode 100644 projects/zkevmswap/index.js create mode 100644 projects/zkfox/index.js create mode 100644 projects/zklend/abi.js create mode 100644 projects/zklend/index.js create mode 100644 projects/zkmoonswap/index.js create mode 100644 projects/zks-miner/index.js create mode 100644 projects/zkswap-2/index.js create mode 100644 projects/zomma/index.js create mode 100644 projects/zoodao/abis/battle-arena-abi.json create mode 100644 projects/zoodao/index.js create mode 100644 projects/zswap-plus/index.js create mode 100644 projects/zyberswap-stableswap/index.js create mode 100644 projects/zyberswap-v3/index.js create mode 100644 projects/zyberswap/index.js diff --git a/projects/01/index.js b/projects/01/index.js index f209a3bc4c5..d7c4101cef1 100644 --- a/projects/01/index.js +++ b/projects/01/index.js @@ -1,10 +1,11 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens2 } = require('../helper/solana') async function tvl() { const tokens = [ - "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", - "So11111111111111111111111111111111111111112", - "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB", + ADDRESSES.solana.USDC, + ADDRESSES.solana.SOL, + ADDRESSES.solana.USDT, "7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs", "9n4nbM75f5Ui33ZbPYXn59EwSgE8CGsHtAeTH5YFeJ9E", "mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So", diff --git a/projects/0vix/index.js b/projects/0vix/index.js index 445d4c41a38..a7e7b202d31 100644 --- a/projects/0vix/index.js +++ b/projects/0vix/index.js @@ -1,10 +1,17 @@ +const ADDRESSES = require('../helper/coreAssets.json') const {compoundExports} = require('../helper/compound') const master0vix = "0x8849f1a0cB6b5D6076aB150546EddEe193754F1C"; const oMATIC = "0xE554E874c9c60E45F1Debd479389C76230ae25A8"; -const matic = "0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270"; +const matic = ADDRESSES.polygon.WMATIC_2; const chain = "polygon"; module.exports = { + hallmarks: [ + [Math.floor(new Date('2023-04-28')/1e3), 'Protocol was hacked!'], + ], polygon: compoundExports(master0vix, chain, oMATIC, matic), -}; \ No newline at end of file + polygon_zkevm: compoundExports("0x6EA32f626e3A5c41547235ebBdf861526e11f482", "polygon_zkevm", "0xee1727f5074e747716637e1776b7f7c7133f16b1", ADDRESSES.polygon_zkevm.WETH), +}; + +delete module.exports.polygon.borrowed \ No newline at end of file diff --git a/projects/0x0dex/index.js b/projects/0x0dex/index.js new file mode 100644 index 00000000000..54d77d54b04 --- /dev/null +++ b/projects/0x0dex/index.js @@ -0,0 +1,7 @@ +const { sumTokensExport, nullAddress } = require('../helper/unwrapLPs'); +const ETH_POOL_ADDRESS = "0x3d18AD735f949fEbD59BBfcB5864ee0157607616"; + +module.exports = { + start: 1685386800, // 19/05/2023 @ 07:00pm UTC + ethereum: { tvl: sumTokensExport({ owner: ETH_POOL_ADDRESS, tokens: [nullAddress]}) }, +}; \ No newline at end of file diff --git a/projects/0xDAO/erc20.json b/projects/0xDAO/erc20.json index c0499368ac5..fcb2bc00330 100644 --- a/projects/0xDAO/erc20.json +++ b/projects/0xDAO/erc20.json @@ -1,245 +1,10 @@ -[ - { - "inputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "constant": false, - "inputs": [ - { "internalType": "address", "name": "_minter", "type": "address" } - ], - "name": "addMinter", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { "internalType": "address", "name": "owner", "type": "address" }, - { "internalType": "address", "name": "spender", "type": "address" } - ], - "name": "allowance", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { "internalType": "address", "name": "spender", "type": "address" }, - { "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "approve", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { "internalType": "address", "name": "account", "type": "address" } - ], - "name": "balanceOf", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "decimals", - "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { "internalType": "address", "name": "spender", "type": "address" }, - { - "internalType": "uint256", - "name": "subtractedValue", - "type": "uint256" - } - ], - "name": "decreaseAllowance", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "governance", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { "internalType": "address", "name": "spender", "type": "address" }, - { "internalType": "uint256", "name": "addedValue", "type": "uint256" } - ], - "name": "increaseAllowance", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { "internalType": "address", "name": "account", "type": "address" }, - { "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "mint", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [{ "internalType": "address", "name": "", "type": "address" }], - "name": "minters", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "name", - "outputs": [{ "internalType": "string", "name": "", "type": "string" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { "internalType": "address", "name": "_minter", "type": "address" } - ], - "name": "removeMinter", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { "internalType": "address", "name": "_governance", "type": "address" } - ], - "name": "setGovernance", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "symbol", - "outputs": [{ "internalType": "string", "name": "", "type": "string" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "totalSupply", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { "internalType": "address", "name": "recipient", "type": "address" }, - { "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "transfer", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { "internalType": "address", "name": "sender", "type": "address" }, - { "internalType": "address", "name": "recipient", "type": "address" }, - { "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "transferFrom", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - } -] +{ + "allowance": "function allowance(address owner, address spender) view returns (uint256)", + "balanceOf": "function balanceOf(address account) view returns (uint256)", + "decimals": "uint8:decimals", + "governance": "address:governance", + "minters": "function minters(address) view returns (bool)", + "name": "string:name", + "symbol": "string:symbol", + "totalSupply": "uint256:totalSupply" +} diff --git a/projects/0xDAO/index.js b/projects/0xDAO/index.js index 9e060051d35..b1b9238de29 100644 --- a/projects/0xDAO/index.js +++ b/projects/0xDAO/index.js @@ -11,14 +11,14 @@ const veAddress = "0xcBd8fEa77c2452255f59743f55A3Ea9d83b3c72b"; const oxSolidAddress = "0xDA0053F0bEfCbcaC208A3f867BB243716734D809"; const sanitize = require("./sanitizeWeb3Response.js"); -const { masterChefExports, standardPoolInfoAbi, addFundsInMasterChef } = require('../helper/masterchef') +const { standardPoolInfoAbi, addFundsInMasterChef } = require('../helper/masterchef') const sdk = require('@defillama/sdk') const { default: BigNumber } = require('bignumber.js') -const shareValue = { "inputs": [], "name": "getShareValue", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" } +const shareValue = "uint256:getShareValue" const xSCREAM = "0xe3D17C7e840ec140a7A51ACA351a482231760824" const xCREDIT = "0xd9e28749e80D867d5d14217416BFf0e668C10645" -const shareTarot = { "inputs": [{ "internalType": "uint256", "name": "_share", "type": "uint256" }], "name": "shareValuedAsUnderlying", "outputs": [{ "internalType": "uint256", "name": "underlyingAmount_", "type": "uint256" }], "stateMutability": "nonpayable", "type": "function" } +const shareTarot = "function shareValuedAsUnderlying(uint256 _share) returns (uint256 underlyingAmount_)" const xTAROT = "0x74D1D2A851e339B8cB953716445Be7E8aBdf92F4" const fBEET = "0xfcef8a994209d6916EB2C86cDD2AFD60Aa6F54b1" @@ -77,15 +77,15 @@ async function tvl(time, ethBlock, chainBlocks) { block, chain: 'fantom', target: oxLensAddress, - abi: oxLensAbi.find(i => i.name === 'oxPoolsAddresses') + abi: oxLensAbi.oxPoolsAddresses }) - const pageSize = 50; + const pageSize = 200; const poolsMap = {}; let currentPage = 0; // Add pools const addPools = (pools, reservesData) => { - pools.forEach((pool, index) => { + pools.forEach((pool) => { const solidlyPoolAddress = pool.poolData.id; const reserveData = reservesData.find( (data) => data.id === solidlyPoolAddress @@ -110,10 +110,11 @@ async function tvl(time, ethBlock, chainBlocks) { poolsMap[pool.id] = newPool; }); }; - while (true) { + let addresses = [] + while (addresses) { const start = currentPage * pageSize; const end = start + pageSize; - const addresses = oxPoolsAddresses.slice(start, end); + addresses = oxPoolsAddresses.slice(start, end); if (addresses.length === 0) { break; } @@ -124,7 +125,7 @@ async function tvl(time, ethBlock, chainBlocks) { chain: 'fantom', params: [addresses], target: oxLensAddress, - abi: oxLensAbi.find(i => i.name === 'oxPoolsData') + abi: oxLensAbi.oxPoolsData }) const solidlyPoolsAddresses = poolsData.map((pool) => pool.poolData.id); const { output: reservesData } = await sdk.api.abi.call({ @@ -132,7 +133,7 @@ async function tvl(time, ethBlock, chainBlocks) { chain: 'fantom', target: solidlyLensAddress, params: [solidlyPoolsAddresses], - abi: solidlyLensAbi.find(i => i.name === 'poolsReservesInfo') + abi: solidlyLensAbi.poolsReservesInfo }) addPools( sanitize(poolsData), @@ -166,7 +167,7 @@ async function tvl(time, ethBlock, chainBlocks) { chain: 'fantom', target: veAddress, params: 2, - abi: veAbi.find(i => i.name === 'locked') + abi: veAbi.locked }) addBalance(solidAddress, lockedSolidAmount); diff --git a/projects/0xDAO/oxLens.json b/projects/0xDAO/oxLens.json index 8271e4cb56f..ddad5030678 100644 --- a/projects/0xDAO/oxLens.json +++ b/projects/0xDAO/oxLens.json @@ -1,89 +1,4 @@ -[ - { - "inputs": [], - "name": "oxPoolsAddresses", - "outputs": [ - { "internalType": "address[]", "name": "", "type": "address[]" } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address[]", - "name": "_oxPoolsAddresses", - "type": "address[]" - } - ], - "name": "oxPoolsData", - "outputs": [ - { - "components": [ - { "internalType": "address", "name": "id", "type": "address" }, - { - "internalType": "address", - "name": "stakingAddress", - "type": "address" - }, - { - "internalType": "uint256", - "name": "stakedTotalSupply", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" - }, - { - "components": [ - { "internalType": "address", "name": "id", "type": "address" }, - { "internalType": "string", "name": "symbol", "type": "string" }, - { "internalType": "bool", "name": "stable", "type": "bool" }, - { - "internalType": "address", - "name": "token0Address", - "type": "address" - }, - { - "internalType": "address", - "name": "token1Address", - "type": "address" - }, - { - "internalType": "address", - "name": "gaugeAddress", - "type": "address" - }, - { - "internalType": "address", - "name": "bribeAddress", - "type": "address" - }, - { - "internalType": "address[]", - "name": "bribeTokensAddresses", - "type": "address[]" - }, - { "internalType": "address", "name": "fees", "type": "address" }, - { - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" - } - ], - "internalType": "struct ISolidlyLens.Pool", - "name": "poolData", - "type": "tuple" - } - ], - "internalType": "struct OxLens.OxPoolData[]", - "name": "", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - } -] \ No newline at end of file +{ + "oxPoolsAddresses": "address[]:oxPoolsAddresses", + "oxPoolsData": "function oxPoolsData(address[] _oxPoolsAddresses) view returns (tuple(address id, address stakingAddress, uint256 stakedTotalSupply, uint256 totalSupply, tuple(address id, string symbol, bool stable, address token0Address, address token1Address, address gaugeAddress, address bribeAddress, address[] bribeTokensAddresses, address fees, uint256 totalSupply) poolData)[])" +} diff --git a/projects/0xDAO/solidlyLens.json b/projects/0xDAO/solidlyLens.json index cfa8b1f1760..5bb2f7d9011 100644 --- a/projects/0xDAO/solidlyLens.json +++ b/projects/0xDAO/solidlyLens.json @@ -1,49 +1,3 @@ -[ - { - "inputs": [ - { - "internalType": "address[]", - "name": "_poolsAddresses", - "type": "address[]" - } - ], - "name": "poolsReservesInfo", - "outputs": [ - { - "components": [ - { "internalType": "address", "name": "id", "type": "address" }, - { - "internalType": "address", - "name": "token0Address", - "type": "address" - }, - { - "internalType": "address", - "name": "token1Address", - "type": "address" - }, - { - "internalType": "uint256", - "name": "token0Reserve", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "token1Reserve", - "type": "uint256" - }, - { - "internalType": "uint8", - "name": "token0Decimals", - "type": "uint8" - }, - { "internalType": "uint8", "name": "token1Decimals", "type": "uint8" } - ], - "internalType": "struct ISolidlyLens.PoolReserveData[]", - "name": "", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }] \ No newline at end of file +{ + "poolsReservesInfo": "function poolsReservesInfo(address[] _poolsAddresses) view returns (tuple(address id, address token0Address, address token1Address, uint256 token0Reserve, uint256 token1Reserve, uint8 token0Decimals, uint8 token1Decimals)[])" +} diff --git a/projects/0xDAO/ve.json b/projects/0xDAO/ve.json index d1f27c23adb..3600933cc82 100644 --- a/projects/0xDAO/ve.json +++ b/projects/0xDAO/ve.json @@ -1,10 +1,3 @@ -[{ - "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "name": "locked", - "outputs": [ - { "internalType": "int128", "name": "amount", "type": "int128" }, - { "internalType": "uint256", "name": "end", "type": "uint256" } - ], - "stateMutability": "view", - "type": "function" -}] \ No newline at end of file +{ + "locked": "function locked(uint256) view returns (int128 amount, uint256 end)" +} diff --git a/projects/0x_nodes/index.js b/projects/0x_nodes/index.js index 5715cc8058c..3184233400b 100644 --- a/projects/0x_nodes/index.js +++ b/projects/0x_nodes/index.js @@ -1,12 +1,13 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { GraphQLClient, gql } = require('graphql-request') -const { getBlock } = require('../helper/getBlock') +const { getBlock } = require('../helper/http') const { staking } = require('../helper/staking') const sdk = require('@defillama/sdk') const CONFIG = { ethereum: { uri: 'https://api.thegraph.com/subgraphs/name/0xnodes/system11', - strategy_token: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', //wETH + strategy_token: ADDRESSES.ethereum.WETH, //wETH bios_token: '0xAACa86B876ca011844b5798ECA7a67591A9743C8', kernel_addr: '0xcfcff4eb4799cda732e5b27c3a36a9ce82dbabe0' }, @@ -18,13 +19,13 @@ const CONFIG = { }, polygon: { uri: 'https://api.thegraph.com/subgraphs/name/0xnodes/system11-polygon', - strategy_token: '0x7D1AfA7B718fb893dB30A3aBc0Cfc608AaCfeBB0', //wMATIC + strategy_token: ADDRESSES.ethereum.MATIC, //wMATIC bios_token: '0xe20d2df5041f8ed06976846470f727295cdd4d23', kernel_addr: '0x267720b5d8dcbdb847fc333ccc68cb284648b816' }, fantom: { uri: 'https://api.thegraph.com/subgraphs/name/0xnodes/system11-fantom', - strategy_token: '0x4e15361fd6b4bb609fa63c81a2be19d873717870', //wFTM + strategy_token: ADDRESSES.ethereum.FTM, //wFTM bios_token: '0x75e0eb8e6d92ab832bb11e46c041d06a89ac5f0d', kernel_addr: '0x9db0e84ea53c5a3c000a721bb4295a6053b3de78' }, @@ -55,8 +56,8 @@ function offset(chain) { return 500 case 'avax': return 750 - }; -}; + } +} function chainTvl(chain) { return async (timestamp, ethBlock, chainBlocks) => { if (timestamp > 1659527340) return {} diff --git a/projects/0xacid/index.js b/projects/0xacid/index.js new file mode 100644 index 00000000000..ed924429df2 --- /dev/null +++ b/projects/0xacid/index.js @@ -0,0 +1,12 @@ +const { stakingUnknownPricedLP } = require("../helper/staking"); + +const ACID_STAKING = "0x00a842038a674616f6a97e62f80111a536778282"; +const ACID_TOKEN = "0x29C1EA5ED7af53094b1a79eF60d20641987c867e"; + +module.exports = { + start: 1678417200, + arbitrum: { + tvl: () => ({}), + staking: stakingUnknownPricedLP(ACID_STAKING, ACID_TOKEN, "arbitrum", "0x73474183a94956cd304c6c5a504923d8150bd9ce") + }, +} \ No newline at end of file diff --git a/projects/10kswap/abi.js b/projects/10kswap/abi.js new file mode 100644 index 00000000000..07114bcb6be --- /dev/null +++ b/projects/10kswap/abi.js @@ -0,0 +1,87 @@ +const fabis = [{ + "name": "allPairs", + "type": "function", + "inputs": [ + { + "name": "index", + "type": "felt" + } + ], + "outputs": [ + { + "name": "pair", + "type": "felt" + } + ], + "stateMutability": "view" +}, +{ + "name": "allPairsLength", + "type": "function", + "inputs": [], + "outputs": [ + { + "name": "length", + "type": "felt" + } + ], + "stateMutability": "view" +} +] + +const pabis = [ + { + "name": "token0", + "type": "function", + "inputs": [], + "outputs": [ + { + "name": "token0", + "type": "felt" + } + ], + "stateMutability": "view" + }, + { + "name": "token1", + "type": "function", + "inputs": [], + "outputs": [ + { + "name": "token1", + "type": "felt" + } + ], + "stateMutability": "view" + }, + { + "name": "getReserves", + "type": "function", + "inputs": [], + "outputs": [ + { + "name": "reserve0", + "type": "felt" + }, + { + "name": "reserve1", + "type": "felt" + }, + { + "name": "blockTimestampLast", + "type": "felt" + } + ], + "stateMutability": "view" + }, +] + + +const factory = {} +const pair = {} +fabis.forEach(i => factory[i.name] = i) +pabis.forEach(i => pair[i.name] = i) + +module.exports = { + factory, pair, fabis, pabis, +} \ No newline at end of file diff --git a/projects/10kswap/api.js b/projects/10kswap/api.js new file mode 100644 index 00000000000..501664f1aaa --- /dev/null +++ b/projects/10kswap/api.js @@ -0,0 +1,38 @@ + +const { call, multiCall, parseAddress } = require('../helper/chain/starknet') +const abi = require('./abi') +const { transformDexBalances } = require('../helper/portedTokens') +const { getParamCalls } = require('../helper/utils') + +async function tvl() { + const factory = '0x1c0a36e26a8f822e0d81f20a5a562b16a8f8a3dfd99801367dd2aea8f1a87a2' + let pairLength = await call({ target: factory, abi: abi.factory.allPairsLength}) + let pairs = await multiCall({ abi: abi.factory.allPairs, target: factory, calls: getParamCalls(+pairLength)}) + + const calls = pairs.map(i => parseAddress(i)) + + const [ token0s, token1s, reserves ] = await Promise.all([ + multiCall({ abi: abi.pair.token0, calls }), + multiCall({ abi: abi.pair.token1, calls }), + multiCall({ abi: abi.pair.getReserves, calls }), + ]) + + const data = [] + reserves.forEach((reserve, i) => { + data.push({ + token0: parseAddress(token0s[i]), + token1: parseAddress(token1s[i]), + token0Bal: +reserve.reserve0, + token1Bal: +reserve.reserve1, + }) + }) + + return transformDexBalances({chain:'starknet', data}) +} + +module.exports = { + timetravel: false, + starknet: { + tvl, + } +} \ No newline at end of file diff --git a/projects/10kswap/index.js b/projects/10kswap/index.js new file mode 100644 index 00000000000..674e8c995c1 --- /dev/null +++ b/projects/10kswap/index.js @@ -0,0 +1 @@ +module.exports = require('./api') \ No newline at end of file diff --git a/projects/1bch/index.js b/projects/1bch/index.js index 6582d6d0f2d..6d0047b0250 100644 --- a/projects/1bch/index.js +++ b/projects/1bch/index.js @@ -1,8 +1,9 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk'); const { getUniTVL } = require('../helper/unknownTokens') const { stakingPricedLP } = require('../helper/staking') -const WBCH = "0x3743eC0673453E5009310C727Ba4eaF7b3a1cc04"; +const WBCH = ADDRESSES.smartbch.WBCH; const rBCH = "0xb4602588E5F1F9653B6F234206c91552E457fAcB"; const FACTORY = "0x3dC4e6aC26df957a908cfE1C0E6019545D08319b"; const MASTERBREEDER = "0xeC0A7496e66a206181034F86B261DDDC1A2c406E"; @@ -25,14 +26,14 @@ async function bchMasterChef(timestamp, ethBlock, {[CHAIN]: block}) { } } -const bchDexTvl = getUniTVL({ factory: FACTORY, chain: CHAIN, useDefaultCoreAssets: true, }) +const bchDexTvl = getUniTVL({ factory: FACTORY, useDefaultCoreAssets: true, }) module.exports = { misrepresentedTokens: true, methodology: "Factory address (" + FACTORY + ") is used to find the LP pairs on smartBCH. TVL is equal to AMMs liquidity plus the extra staking balance and masterchef pools.", smartbch: { tvl: sdk.util.sumChainTvls([bchDexTvl, bchMasterChef]), - masterchef: bchMasterChef, + // masterchef: bchMasterChef, staking: stakingPricedLP(MASTERBREEDER, rBCH, "smartbch", rBCH_WBCH_LP, COREASSETNAME), }, } diff --git a/projects/1beam/abi.json b/projects/1beam/abi.json index 560db359347..eacd8a1595e 100644 --- a/projects/1beam/abi.json +++ b/projects/1beam/abi.json @@ -1,30 +1,4 @@ { - "swap": { - "getTokenBalances": { - "inputs": [], - "name": "getTokenBalances", - "outputs": [ - { - "internalType": "uint256[]", - "name": "", - "type": "uint256[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getTokens": { - "inputs": [], - "name": "getTokens", - "outputs": [ - { - "internalType": "contract IERC20[]", - "name": "", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - } - } -} + "getTokenBalances": "uint256[]:getTokenBalances", + "getTokens": "address[]:getTokens" +} \ No newline at end of file diff --git a/projects/1beam/index.js b/projects/1beam/index.js index bc0a5983ccb..0b7b1fef300 100644 --- a/projects/1beam/index.js +++ b/projects/1beam/index.js @@ -17,13 +17,13 @@ const poolTvl = async (chain, poolAddress, block) => { const [balances, tokens] = await Promise.all([ sdk.api.abi.call({ target: poolAddress, - abi: Abis.swap.getTokenBalances, + abi: Abis.getTokenBalances, chain: chain, block, }), sdk.api.abi.call({ target: poolAddress, - abi: Abis.swap.getTokens, + abi: Abis.getTokens, chain: chain, block, }), diff --git a/projects/1beam/utils.js b/projects/1beam/utils.js index 51c15add81f..47d6cbbeefb 100644 --- a/projects/1beam/utils.js +++ b/projects/1beam/utils.js @@ -1,7 +1,8 @@ +const ADDRESSES = require('../helper/coreAssets.json') const TokenMaps = { - '0x765277eebeca2e31912c9946eae1021199b39c61': ['dai', 18], - '0x818ec0a7fe18ff94269904fced6ae3dae6d6dc0b': ['usd-coin', 6], - '0xefaeee334f0fd1712f9a8cc375f427d9cdd40d73': ['tether', 6], + [ADDRESSES.shiden.ETH]: ['dai', 18], + [ADDRESSES.telos.USDC]: ['usd-coin', 6], + [ADDRESSES.telos.USDT]: ['tether', 6], '0xa649325aa7c5093d12d6f98eb4378deae68ce23f': ['binance-usd', 18] } diff --git a/projects/1inch/api.js b/projects/1inch/api.js index 3d708e36753..cb3db3d5bab 100644 --- a/projects/1inch/api.js +++ b/projects/1inch/api.js @@ -1,7 +1 @@ -const { getExports } = require('../helper/heroku-api') - -module.exports = { - timetravel: false, - misrepresentedTokens: true, - ...getExports("1inch", ['bsc', 'ethereum']), -} +module.exports = require('../1inch.js') \ No newline at end of file diff --git a/projects/1inch/apiCache.js b/projects/1inch/apiCache.js index a784cc9d6ed..cb3db3d5bab 100644 --- a/projects/1inch/apiCache.js +++ b/projects/1inch/apiCache.js @@ -1,66 +1 @@ -const abi = require("../mooniswap/abi.json"); -const config = require("./config") -const { sumTokens2, } = require('../helper/unwrapLPs') -const sdk = require('@defillama/sdk') -const { createIncrementArray } = require('../helper/utils') -const { getCache, setCache, } = require("../helper/cache"); - -const project = '1inch' - -module.exports = {} -Object.keys(config).forEach(chain => { - const { MooniswapFactory, blacklistedTokens } = config[chain] - module.exports[chain] = { - tvl: async (_, _b, { [chain]: block }) => { - const cache = getCache(project, chain) || { pools: {} } - if (!cache.pools) cache.pools = {} - const toa = [] - const pools = [] - const length = 5 - - let i = cache.lastI || Math.floor(Object.keys(cache.pools).length / length) - let currentPools - do { - const { output: data } = await sdk.api.abi.multiCall({ - target: MooniswapFactory, - abi: abi.getPool, - calls: createIncrementArray(length).map(j => ({ params: j + i * length })), - chain, block, - }) - currentPools = data.map(i => i.output).filter(i => i) - pools.push(...currentPools) - i++ - } while (currentPools.length === length) - - cache.lastI = i-1 - const calls = pools.map(i => ({ target: i })) - const { output: tokensAll } = await sdk.api.abi.multiCall({ - abi: abi.getTokens, - calls, chain, block, - }) - - tokensAll.forEach(({ output: tokens, input: { target: pool } }) => { - cache.pools[pool.toLowerCase()] = tokens - }) - // const deletePools = [] - - // let j = 0 - // for (let [pool, tokens] of Object.entries(cache.pools)) { - // tokens = tokens.map(i => i.toLowerCase()) - // console.log(++j, chain, deletePools.length) - // const testBal = await sumTokens2({ owner: pool, tokens, chain, block, transformAddress: i => i, skipFixBalances: true }) - // console.log(pool, tokens, testBal) - // if (!tokens.some(i => testBal[i] && !isNaN(testBal[i]) && +testBal[i] > 1e6)) deletePools.push(pool) - // } - - // console.log(deletePools.length, 'deleting from chain', chain) - // deletePools.forEach(i => delete cache.pools[i]) - - for (const [pool, tokens] of Object.entries(cache.pools)) - tokens.forEach(i => toa.push([i, pool])) - - setCache(project, chain, cache) - return sumTokens2({ chain, block, tokensAndOwners: toa, blacklistedTokens, }) - } - } -}) \ No newline at end of file +module.exports = require('../1inch.js') \ No newline at end of file diff --git a/projects/1inch/config.js b/projects/1inch/config.js index b29c19dfa13..119b5b3a29f 100644 --- a/projects/1inch/config.js +++ b/projects/1inch/config.js @@ -1,27 +1,43 @@ +const ADDRESSES = require('../helper/coreAssets.json') module.exports = { ethereum: { - MooniswapFactory: '0xbaf9a5d4b0052359326a6cdab54babaa3a3a9643', - blacklistedTokens: ['0x58730ae0faa10d73b0cddb5e7b87c3594f7a20cb'], + blacklistedTokens: ['0x58730ae0faa10d73b0cddb5e7b87c3594f7a20cb', '0x77777feddddffc19ff86db637967013e6c6a116c',], + factories: [{ + MooniswapFactory: '0xbaf9a5d4b0052359326a6cdab54babaa3a3a9643', + fromBlock: 11607841, + }] }, + // polygon: { + // factories: [{ + // MooniswapFactory: '0xbaf9a5d4b0052359326a6cdab54babaa3a3a9643', + // fromBlock: 36040621, + // }] + // }, bsc: { - MooniswapFactory: '0xd41b24bba51fac0e4827b6f94c0d6ddeb183cd64', + factories: [{ + MooniswapFactory: '0xd41b24bba51fac0e4827b6f94c0d6ddeb183cd64', + fromBlock: 4994614, + }, { + MooniswapFactory: '0xbaf9a5d4b0052359326a6cdab54babaa3a3a9643', + fromBlock: 10588911, + }], blacklistedTokens: [ - '0x6b175474e89094c44da98b954eedeac495271d0f', - '0xae7ab96520de3a18e5e111b5eaab095312d7fe84', - '0x2260fac5e5542a773aa44fbcfedf7c193bc2c599', - '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', + ADDRESSES.ethereum.DAI, + ADDRESSES.ethereum.STETH, + ADDRESSES.ethereum.WBTC, + ADDRESSES.ethereum.WETH, '0x220b71671b649c03714da9c621285943f3cbcdc6', '0x875773784af8135ea0ef43b5a374aad105c5d39e', '0x1b40183efb4dd766f11bda7a7c3ad8982e998421', '0xaa7a9ca87d3694b5755f213b5d04094b8d0f0a6f', - '0xdac17f958d2ee523a2206206994597c13d831ec7', + ADDRESSES.ethereum.USDT, '0xaea46a60368a7bd060eec7df8cba43b7ef41ad85', '0x888888888889c00c67689029d7856aac1065ec11', '0xe796d6ca1ceb1b022ece5296226bf784110031cd', - '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', + ADDRESSES.ethereum.USDC, '0xbb9284484cb9a2bc7950a1276edba2f6358ea677', - '0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9', + ADDRESSES.ethereum.AAVE, '0x9dcae4a9e65bf7925eb7809142f848d3cf8e96ac', '0x3fa729b4548becbad4eab6ef18413470e6d5324c', '0xcd62b1c403fa761baadfc74c525ce2b51780b184', diff --git a/projects/1pulse/index.js b/projects/1pulse/index.js new file mode 100644 index 00000000000..11948494ac4 --- /dev/null +++ b/projects/1pulse/index.js @@ -0,0 +1,12 @@ +const { getUniTVL } = require("../helper/unknownTokens"); + +module.exports = { + misrepresentedTokens: true, + pulse: { + tvl: getUniTVL({ + fetchBalances: true, + useDefaultCoreAssets: true, + factory: "0x17C335D22456c798D5A3D021583eDAcbD4Ef6444", + }), + }, +}; diff --git a/projects/1swap/abi-moonriver.json b/projects/1swap/abi-moonriver.json index 963ed9f4e6a..aa187d1b953 100644 --- a/projects/1swap/abi-moonriver.json +++ b/projects/1swap/abi-moonriver.json @@ -1,30 +1,4 @@ { - "1Swap": { - "getTokenBalances": { - "inputs": [], - "name": "getTokenBalances", - "outputs": [ - { - "internalType": "uint256[]", - "name": "", - "type": "uint256[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getTokens": { - "inputs": [], - "name": "getTokens", - "outputs": [ - { - "internalType": "contract IERC20[]", - "name": "", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - } - } + "getTokenBalances": "uint256[]:getTokenBalances", + "getTokens": "address[]:getTokens" } diff --git a/projects/1swap/index.js b/projects/1swap/index.js index 336f6c8a571..83a9a0a0207 100644 --- a/projects/1swap/index.js +++ b/projects/1swap/index.js @@ -1,6 +1,5 @@ -const sdk = require('@defillama/sdk'); -const { default: BigNumber } = require('bignumber.js'); const abiMoonriver = require('./abi-moonriver.json'); +const { sumTokens2 } = require('../helper/unwrapLPs') const Contracts = { moonriver: { @@ -12,95 +11,23 @@ const Contracts = { '1s3pavaxusd': '0x7179F2C31763f395082489588534F4abb3Dd4Be6', '1s3pwanusd': '0x02A105939Dc0C47cb6bD04f320dAa77Bd9E3Bb0D', }, - ignoredLps: ['0x17da5445f3cd02b3f1cd820e6de55983fe80cf85'] , + ignoredLps: ['0x17da5445f3cd02b3f1cd820e6de55983fe80cf85'], } }; -const poolTvl = async (chain, poolAddress, block) => { - const [balances, tokens] = await Promise.all([ - sdk.api.abi.call({ - target: poolAddress, - abi: abiMoonriver['1Swap'].getTokenBalances, - chain: chain, - block, - }), - sdk.api.abi.call({ - target: poolAddress, - abi: abiMoonriver['1Swap'].getTokens, - chain: chain, - block, - }), - ]); - const sum = {}; - - tokens.output.forEach((token, i) => { - if ( - Contracts[chain].ignoredLps && - Contracts[chain].ignoredLps.includes(token.toLowerCase()) - ) { - return; - } - const [symbol, decimals] = getTokenId(token.toLowerCase()); - sum[symbol] = new BigNumber(balances.output[i]).div(new BigNumber(10).pow(decimals)).toNumber() - }); - - return sum; -}; - -const moonriverTvl = async (timestamp, ethBlock, chainBlocks) => { - let block = chainBlocks['moonriver']; - const tvl = {}; - - for (let address of Object.values(Contracts.moonriver.pools)) { - const balances = await poolTvl( - 'moonriver', - address, - block, - ); - - Object.entries(balances).forEach(([token, value]) => { - sdk.util.sumSingleBalance(tvl, token, value); - }); - } - - return tvl; -}; - - -function getTokenId(address) { - switch(address) { - case '0xe3f5a90f9cb311505cd691a46596599aa1a0ad7d': - return ['usd-coin', 6] - case '0xb44a9b6905af7c801311e8f4e76932ee959c663c': - return ['tether', 6] - case '0x80a16016cc4a2e6a2caca8a4a498b1699ff0f844': - return ['dai', 18] - case '0x5d9ab5522c64e1f6ef5e3627eccc093f56167818': - return ['binance-usd', 18] - case '0x0cae51e1032e8461f4806e26332c030e34de3adb': - return ['magic-internet-money', 18] - case '0x965f84d915a9efa2dd81b653e3ae736555d945f4': - return ['frax', 18]; - case '0xd8b99eae34afdf1a9bfa5770066404ee4468d0f2': // AVAX bridge - return ['usd-coin', 6]; - case '0xf97c8556af29089d5d1627096958187b11f1915c': // AVAX bridge - return ['tether', 6]; - case '0x26dfff76d9123a1c79279abc29b676c48a8bd77e': // AVAX bridge - return ['dai', 18]; - case '0x748134b5f553f2bcbd78c6826de99a70274bdeb3': // WANCHAIN bridge - return ['usd-coin', 6]; - case '0xe936caa7f6d9f5c9e907111fcaf7c351c184cda7': // WANCHAIN bridge - return ['tether', 6]; - default: - return false; +const tvl = async (timestamp, ethBlock, chainBlocks, { api }) => { + const ownerTokens = [] + const poolTvl = async (pool) => { + ownerTokens.push([await api.call({ target: pool, abi: abiMoonriver.getTokens, }), pool]) }; + const pools = Object.values(Contracts.moonriver.pools) + await Promise.all(pools.map(poolTvl)) + return sumTokens2({ api, ownerTokens, blacklistedTokens: pools}) }; - - module.exports = { moonriver: { - tvl: moonriverTvl, + tvl, }, }; diff --git a/projects/2doge/index.js b/projects/2doge/index.js index 84a90fd344c..10470022eb7 100644 --- a/projects/2doge/index.js +++ b/projects/2doge/index.js @@ -1,6 +1,6 @@ const sdk = require("@defillama/sdk"); const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); -const { staking, stakingPricedLP } = require("../helper/staking"); +const { stakingPricedLP } = require("../helper/staking"); const tombTokenAddress = "0xDD057bCcB72982753266A903Feda154608e54468"; const tshareTokenAddress = "0x0c55339a139acd3a8ba07a9abad345b05c4bf804"; @@ -65,4 +65,7 @@ module.exports = { staking: stakingPricedLP(masonryAddress, tshareTokenAddress, "fantom", "0xB254973e067AF44eB4D506e7117A33C4F3F77783", "fantom"), treasury }, + hallmarks: [ + [1646179200, "Rug Pull"] + ] }; diff --git a/projects/2omb-finance/abi.json b/projects/2omb-finance/abi.json index 9afc3dd59ba..d2254252a19 100644 --- a/projects/2omb-finance/abi.json +++ b/projects/2omb-finance/abi.json @@ -1,54 +1,4 @@ { - "poolInfo": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "poolInfo", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "allocPoint", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastRewardTime", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accTombPerShare", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "isStarted", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - "symbol": { - "inputs": [], - "name": "symbol", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - } + "poolInfo": "function poolInfo(uint256) view returns (address token, uint256 allocPoint, uint256 lastRewardTime, uint256 accTombPerShare, bool isStarted)", + "symbol": "string:symbol" } \ No newline at end of file diff --git a/projects/2pi/archimedes.json b/projects/2pi/archimedes.json index 3e562dffe99..2ead126b00a 100644 --- a/projects/2pi/archimedes.json +++ b/projects/2pi/archimedes.json @@ -1,73 +1,5 @@ { - "poolInfo": { - "name": "poolInfo", - "type": "function", - "stateMutability": "view", - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "outputs": [ - { - "internalType": "contract IERC20", - "name": "want", - "type": "address" - }, - { - "internalType": "uint256", - "name": "weighing", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastRewardBlock", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accPiTokenPerShare", - "type": "uint256" - }, - { - "internalType": "address", - "name": "controller", - "type": "address" - } - ] - }, - "poolLength": { - "name": "poolLength", - "type": "function", - "stateMutability": "view", - "inputs": [], - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ] - }, - "balance": { - "name": "balance", - "type": "function", - "stateMutability": "view", - "inputs": [ - { - "internalType": "uint256", - "name": "_pid", - "type": "uint256" - } - ], - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ] - } -} + "poolInfo": "function poolInfo(uint256) view returns (address want, uint256 weighing, uint256 lastRewardBlock, uint256 accPiTokenPerShare, address controller)", + "poolLength": "uint256:poolLength", + "balance": "function balance(uint256 _pid) view returns (uint256)" +} \ No newline at end of file diff --git a/projects/2pi/index.js b/projects/2pi/index.js index 93137eb0688..9532670df7a 100644 --- a/projects/2pi/index.js +++ b/projects/2pi/index.js @@ -1,6 +1,6 @@ const sdk = require('@defillama/sdk') -const { fetchItemList, getUniqueAddresses } = require('../helper/utils') -const { get } = require('../helper/http') +const { getUniqueAddresses } = require('../helper/utils') +const { getConfig } = require('../helper/cache') const archimedesAbi = require('./archimedes.json') const baseUrl = 'https://api.2pi.network/v1' @@ -12,7 +12,7 @@ const chains = { } const fetchChainAddresses = async chain => { - const { data: { archimedes } } = await get(`${baseUrl}/addresses/${chain}`) + const { data: { archimedes } } = await getConfig(`archimedes/${chain}`, `${baseUrl}/addresses/${chain}`) return getUniqueAddresses(archimedes) } @@ -20,7 +20,7 @@ const fetchTvl = chain => { return async (_timestamp, _block, chainBlocks) => { const block = chainBlocks[chain] const addresses = await fetchChainAddresses(chains[chain]) - let pools = await Promise.all(addresses.map(i => fetchItemList({ chain, block, target: i, lengthAbi: archimedesAbi['poolLength'], itemAbi: archimedesAbi['poolInfo'] }))) + let pools = await Promise.all(addresses.map(i => sdk.api2.abi.fetchList({ withMetadata: true, chain, block, target: i, lengthAbi: archimedesAbi['poolLength'], itemAbi: archimedesAbi['poolInfo'] }))) pools = pools.flat() const wantTokens = pools.map(i => i.output.want) const calls = pools.map(i => i.input) diff --git a/projects/3xcalibur/index.js b/projects/3xcalibur/index.js index 0f548a4fdfa..f195d92a9dc 100644 --- a/projects/3xcalibur/index.js +++ b/projects/3xcalibur/index.js @@ -1,11 +1,11 @@ const { uniTvlExport } = require("../helper/calculateUniTvl.js"); module.exports = { - doublecounted: false, + misrepresentedTokens: true, timetravel: true, start: 1667689200, arbitrum: { - tvl: uniTvlExport("0xD158bd9E8b6efd3ca76830B66715Aa2b7Bad2218", "arbitrum"), + tvl: uniTvlExport("0xD158bd9E8b6efd3ca76830B66715Aa2b7Bad2218", "arbitrum", undefined, undefined, { hasStablePools: true, useDefaultCoreAssets: true, }), }, hallmarks: [[1668038400, "Emissions started"]], }; diff --git a/projects/88mph/abi.json b/projects/88mph/abi.json deleted file mode 100644 index 471af834120..00000000000 --- a/projects/88mph/abi.json +++ /dev/null @@ -1,73 +0,0 @@ -{ - "totalDeposit": { - "constant": true, - "inputs": [], - "name": "totalDeposit", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "stablecoin": { - "constant": true, - "inputs": [], - "name": "stablecoin", - "outputs": [ - { - "internalType": "contract ERC20", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "calculateInterestAmount": { - "constant": false, - "inputs": [ - { - "internalType": "uint256", - "name": "depositAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "depositPeriodInSeconds", - "type": "uint256" - } - ], - "name": "calculateInterestAmount", - "outputs": [ - { - "internalType": "uint256", - "name": "interestAmount", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - "symbol": { - "constant": true, - "inputs": [], - "name": "symbol", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } -} \ No newline at end of file diff --git a/projects/88mph/index.js b/projects/88mph/index.js index 5ebcbe4e570..989901f0748 100644 --- a/projects/88mph/index.js +++ b/projects/88mph/index.js @@ -1,129 +1,96 @@ const sdk = require('@defillama/sdk') -const abi = require('./abi') -const BigNumber = require('bignumber.js') -const { default: axios } = require('axios') -const { chainExports } = require('../helper/exports') const { staking } = require('../helper/staking') -const { transformFantomAddress } = require('../helper/portedTokens') +const { getUniqueAddresses } = require('../helper/utils') +const { graphQuery } = require('../helper/http') -const olddInterestAddresses = [ - '0x35966201A7724b952455B73A36C8846D8745218e', // Compound DAI - '0x374226dbAa3e44bF3923AfB63f5Fd83928B7e148', // Compound USDC - '0x19E10132841616CE4790920d5f94B8571F9b9341', // Compound UNI - '0xe615e59353f70cA2424Aa0F24F49C639B8E924D3', // yearn yCRV - '0x681Aaa7CF3F7E1f110842f0149bA8A4AF53Ef2Fd', // yearn crvSBTC - '0x23Fa6b36E870ca5753853538D17C3ca7f5269e84', // Harvest yCRV - '0xe8C52367b81113ED32bb276184e521C2fbE9393A', // Aave USDC - '0xb1ABAac351e06d40441CF2CD97F6f0098e6473F2', // Harvest CRV:HUSD - '0x2F3EFD1a90a2336ab8fa1B9060380DC37361Ca55', // Harvest 3CRV - '0x3f5611F7762cc39FC11E10C864ae38526f650e9D', // Harvest CRV:HBTC - '0x6712BAab01FA2dc7bE6635746Ec2Da6F8Bd73e71', // Aave sUSD - '0xDC86AC6140026267E0873B27c8629eFE748E7146', // Aave DAI - '0xD4837145c7e13D580904e8431cfD481f9794fC41', // Harvest CRV:oBTC - '0x904F81EFF3c35877865810CCA9a63f2D9cB7D4DD', // yearn yaLINK - '0x303CB7Ede0c3AD99CE017CDC3aBAcD65164Ff486', // Harvest CRV:STETH - '0x22E6b9A65163CE1225D1F65EF7942a979d093039' // Harvest CRV:RENWBTC -] -const wrappedTokenToSubsitute = { - '0x2fE94ea3d5d4a175184081439753DE15AeF9d614': { // CRV:oBTC - address: '0x8064d9Ae6cDf087b1bcd5BDf3531bD5d8C537a68', // oBTC - decimals: 18 - }, - '0xb19059ebb43466C323583928285a49f558E572Fd': { // CRV:HBTC - address: '0x0316EB71485b0Ab14103307bf65a021042c6d380', // HBTC - decimals: 18 - }, - '0x5B5CFE992AdAC0C9D48E05854B2d91C73a003858': { // CRV:HUSD - address: '0xdf574c24545e5ffecb9a659c229253d4111d87e1', // HUSD - decimals: 8 - }, - '0x06325440D014e39736583c165C2963BA99fAf14E': { // CRV:STETH - address: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', - decimals: 18 - }, - '0x49849C98ae39Fff122806C06791Fa73784FB3675': { // CRV:RENWBTC - address: '0x2260fac5e5542a773aa44fbcfedf7c193bc2c599', - decimals: 8 - }, - '0x075b1bb99792c9E1041bA13afEf80C91a1e70fB3': { // CRV: sBTC - address: '0xfe18be6b3bd88a2d2a7f928d00292e7a9963cfc6', //sBTC - decimals: 18 - } -} - -const urls = { - ethereum: "https://api.88mph.app/v3/pools", - polygon: 'https://api.88mph.app/v3/polygon/pools', - avax: 'https://api.88mph.app/v3/avalanche/pools', - fantom: 'https://api.88mph.app/v3/fantom/pools', +const config = { + ethereum: { dpools: 'https://api.thegraph.com/subgraphs/name/bacon-labs/eighty-eight-mph', vPools: [ + "0x062214fbe3f15d217512deb14572eb01face0392", + "0x085d70ca0dade4683d0f59d5a5b7d3298011b4de", + "0x0f834c3601088d1b060c47737a2f5ce4ffa5ac1d", + "0x0fd585328666923a3a772dd5c37e2dc065c7b137", + "0x10e8bd414eee26d82e88d6e308fd81ef37d03155", + "0x11b1c87983f881b3686f8b1171628357faa30038", + "0x1821aadb9ac1b7e4d56c728afdadc7541a785cd2", + "0x24867f5665414d93f7b3d195f848917d57d5be27", + "0x2a74f09a8e4899115529ec8808c5fc1de62c2fe4", + "0x2d3141f4c9872d4f53b587c3fb8b22736feb54b0", + "0x3816579c8cb62500a45ae29a33040a3dea4160de", + "0x46603a1cca20e7ae18f1a069125369609d9d4153", + "0x4b4626c1265d22b71ded11920795a3c6127a0559", + "0x4d794db79c4a85dc763d08a7c440a92a2d153ffd", + "0x4f7ec502ca0be8ef1f984ab1f164022a15ff5561", + "0x572be575d1aa1ca84d8ac4274067f7bcb578a368", + "0x5b1a10aaf807d4297048297c30b2504b42c3395f", + "0x60f0f24b0fbf066e877c3a89014c2e4e98c33678", + "0x6d97ea6e14d35e10b50df9475e9efaad1982065e", + "0x6e6002a4bd704a3c8e24a70b0be670f1c2b4d35c", + "0x7dc14d047d6d8bb03539f92b9e2ca1f1648a5717", + "0x7f10134c32a4544e4cdc0fd57f5c820bff3070e9", + "0xa0e78812e9cd3e754a83bbd74a3f1579b50436e8", + "0xae5dde7ea5c44b38c0bccfb985c40006ed744ea6", + "0xb1b225402b5ec977af8c721f42f21db5518785dc", + "0xf61681b8cbf87615f30f96f491fa28a2ff39947a", + "0xbfdb51ec0adc6d5bf2ebba54248d40f81796e12b", + "0x5dda04b2bdbbc3fcfb9b60cd9ebfd1b27f1a4fe3", + "0xf50ef673ee810e6acb725f941a53bf92586a39ad", + "0x6bf909ce507e94608f0fcbab2cfdd499e0150a21", + "0xafdd82d73f5dae907f86ad37f346221081dc917b", + "0x8eb1b3ac29e0dcbd7f519c86f1eb76a3aea41b76", + "0xc1f147db2b6a9c9fbf322fac3d1fbf8b8aaeec10" + ] }, + avax: { dpools: 'https://api.thegraph.com/subgraphs/name/88mphapp/88mph-avalanche' }, + fantom: { dpools: 'https://api.thegraph.com/subgraphs/name/88mphapp/88mph-fantom', vPools: [ + "0x3cab1cb5a9b68350b39ddf7ce23518d609a8bc78", + "0xa1857578cec558eaed9120739b0c533549bdcb61", + "0xa78276c04d8d807feb8271fe123c1f94c08a414d", + "0xbdf43e9c6cf68359deff9292098622643ede5ec3", + "0xc0710b3564fd4768f912150d39d519b66f2952d4", + "0xc7cbb403d1722ee3e4ae61f452dc36d71e8800de", + "0xcb29ce2526ff5f80ad1536c6a1b13238d615b4b9", + "0xd62f71937fca1c7c05da08cec4c451f12fc64964", + "0xf7fb7f095c8d0f4ee8ffbd142fe0b311491b45f3", + "0x23fe5a2ba80ea2251843086ec000911cfc79c864", + "0xc80cc61910c6f8f47aadc69e40ab8d1b2fa2c4df", + "0x7e4697f650934ea6743b8b0619fc2454db02405a", + "0x2744b79c985ae0c6b81f1da8eed1a4c67eb4b732", + "0xc91c2255525e80630eee710e7c0637bce7d98978" + ] }, + polygon: { dpools: 'https://api.thegraph.com/subgraphs/name/88mphapp/88mph-polygon' }, } -function chainTvl(chain) { - const url = urls[chain] - return async (timestamp, ethBlock, chainBlocks) => { - const block = chainBlocks[chain] - const balances = {} - const poolToUnderlyingToken = {} - let transform = addr=>`${chain}:${addr}` - if(chain === "fantom"){ - transform = await transformFantomAddress() - } - - const v3Pools = await axios.get(url) - let dInterestAddresses = v3Pools.data.map(p => p.address) - if (chain === "ethereum") { - dInterestAddresses = olddInterestAddresses.concat(dInterestAddresses) - } - - // Get deposit pools' underlying tokens - const poolUnderlyingAddressResults = await sdk.api.abi.multiCall({ - calls: dInterestAddresses.map((address) => ({ - target: address - })), - block, - chain, - abi: abi.stablecoin - }) - - poolUnderlyingAddressResults.output.forEach((token) => { - const underlyingTokenAddress = token.output - if(underlyingTokenAddress === null){ - throw new Error(`token ${token} is broken`) - } - const poolAddress = token.input.target - poolToUnderlyingToken[poolAddress] = underlyingTokenAddress - }) +const dPoolQuery = `{ + dpools { + id + address + } +}` - // Get deposit pools' balances in underlying token - const poolDepositBalanceResults = await sdk.api.abi.multiCall({ - block, - calls: dInterestAddresses.map((address) => ({ - target: address - })), - chain, - abi: abi.totalDeposit - }) +const tvlExports = {}; - poolDepositBalanceResults.output.forEach((tokenBalanceResult) => { - let valueInToken = tokenBalanceResult.output - const poolAddress = tokenBalanceResult.input.target - let underlyingTokenAddress = poolToUnderlyingToken[poolAddress] - // replace curve LP token with subsitute - if (wrappedTokenToSubsitute[underlyingTokenAddress]) { - const substituteInfo = wrappedTokenToSubsitute[underlyingTokenAddress] - underlyingTokenAddress = substituteInfo.address - valueInToken = BigNumber(valueInToken).div(BigNumber(10).pow(18 - substituteInfo.decimals)).toFixed(0) - } - sdk.util.sumSingleBalance(balances, transform(underlyingTokenAddress), valueInToken) - }) +Object.keys(config).forEach(chain => { + const { dpools, vPools = [], } = config[chain] + tvlExports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const balances = {} - return balances + const logs = await graphQuery(dpools, dPoolQuery) + let pools = logs.dpools.map(i => i.address) + pools.push(...vPools) + pools = getUniqueAddresses(pools) + const tokens = await api.multiCall({ abi: 'address:stablecoin', calls: pools }) + const bals = await api.multiCall({ abi: 'uint256:totalDeposit', calls: pools }) + const bals2 = await api.multiCall({ abi: 'uint256:totalInterestOwed', calls: pools }) + bals.forEach((b, i) => sdk.util.sumSingleBalance(balances, tokens[i], b, api.chain)) + bals2.forEach((b, i) => sdk.util.sumSingleBalance(balances, tokens[i], b, api.chain)) + return balances + }, } -} +}) -const tvlExports = chainExports(chainTvl, Object.keys(urls)) tvlExports.ethereum.staking = staking("0x1702F18c1173b791900F81EbaE59B908Da8F689b", "0x8888801af4d980682e47f1a9036e589479e835c5") + module.exports = { methodology: `Using the addresses for the fixed interest rate bonds we are able to find the underlying tokens held in each address. Once we have the underlying token we then get the balances of each of the tokens. For the CRV tokens used "CRV:STETH" for example, the address is replaced with the address of one of the tokens. In the example at hand the address is replaced with the "WETH" address so that the price can be calculated.`, start: 1606109629, // Monday, November 23, 2020 5:33:49 AM GMT diff --git a/projects/ABCDEFX/index.js b/projects/ABCDEFX/index.js new file mode 100644 index 00000000000..6e31454c9dd --- /dev/null +++ b/projects/ABCDEFX/index.js @@ -0,0 +1,12 @@ +const { getUniTVL } = require('../helper/unknownTokens') +const chains = ['fantom', 'kcc', 'echelon', 'multivac', 'kava'] + +module.exports = { + misrepresentedTokens: true, + methodology: "Using DefiLlama's SDK for making on-chain calls to ABcDeFX Factory Contract to iterate over Liquidity Pools & count token balances therein.", +}; + +chains.forEach(chain => { + module.exports[chain] = { tvl: getUniTVL({ factory: '0x01F43D2A7F4554468f77e06757e707150e39130c', useDefaultCoreAssets: true, hasStablePools: true, stablePoolSymbol: 'ABcDeFx.LP' }) } +}) +module.exports.echelon.tvl = () => ({}) \ No newline at end of file diff --git a/projects/ArbiTen/contracts.json b/projects/ArbiTen/contracts.json new file mode 100644 index 00000000000..8d4c241388f --- /dev/null +++ b/projects/ArbiTen/contracts.json @@ -0,0 +1,9 @@ +{ + "weth": "0x82af49447d8a07e3bd95bd0d56f35241523fbab1", + "_10SHARE": "0xc8a1c0D8255bc2eB5f6236e119E3428FD0c33A74", + "boardroom": "0xCa262a493aA4FBA5c6913c6FC3AD0bC724f37A2E", + "masterchef": "0xd3f9f6D52f46BF047388FA0EA19F9e671eaD080a", + "ironPool": "0x9388160a6f9F3B58Ac95A50A4B58Cd3034535790", + "arbiten": "0x3e6b3021Dab44dEbf93091030DbFCBdf52464Afe", + "WHEAT": "0x384f5698aB5B73470F8741b38aD4ABBC84F3fCC1" +} diff --git a/projects/ArbiTen/index.js b/projects/ArbiTen/index.js new file mode 100644 index 00000000000..bf1b5fa13cf --- /dev/null +++ b/projects/ArbiTen/index.js @@ -0,0 +1,15 @@ +const contracts = require("./contracts.json"); + +const { masterchefExports, sumTokensExport } = require('../helper/unknownTokens'); +const { mergeExports } = require("../helper/utils"); + + +module.exports = mergeExports([ + masterchefExports({ chain: 'arbitrum', masterchef: contracts.masterchef, nativeTokens: [contracts.WHEAT, contracts.arbiten, contracts._10SHARE], useDefaultCoreAssets: true,}), + { + arbitrum: { + tvl: sumTokensExport({ owner: contracts.ironPool, tokens: [contracts.weth]}), + staking: sumTokensExport({ owner: contracts.boardroom, tokens: [ contracts.arbiten, contracts._10SHARE], lps: ['0x653c1b00eb6d6039d27e0d8a6d1f337f98156a04', '0xc76ccfcb48c423127672bdb9c1d6c80d3f945295'], useDefaultCoreAssets: true, }), + } + }, +]) \ No newline at end of file diff --git a/projects/ArbitrumExchange/index.js b/projects/ArbitrumExchange/index.js new file mode 100644 index 00000000000..5c7454795d9 --- /dev/null +++ b/projects/ArbitrumExchange/index.js @@ -0,0 +1,17 @@ +const { getUniTVL, sumTokensExport } = require('../helper/unknownTokens') +const ARX = "0xD5954c3084a1cCd70B4dA011E67760B8e78aeE84"; + +const dexTVL = getUniTVL({ factory: '0x1C6E968f2E6c9DEC61DB874E28589fd5CE3E1f2c', useDefaultCoreAssets: true }) + + +module.exports = { + misrepresentedTokens: true, + methodology: `Uses factory(0x1C6E968f2E6c9DEC61DB874E28589fd5CE3E1f2c) address and whitelisted tokens address to find and price Liquidity Pool pairs. We also have our native token $ARX staking.`, + arbitrum: { + tvl: dexTVL, + staking: sumTokensExport({ + owners: ['0xd2bcFd6b84E778D2DE5Bb6A167EcBBef5D053A06', '0xee1D57aCE6350D70E8161632769d29D34B2FbfC8', '0x907E5d334F27a769EF779358089fE5fdAA6cf2Bb', '0x75Bca51be93E97FF7D3198506f368b472730265a', '0x466f4380327cD948572AE0C98f2E04930ce05767'], + tokens: [ARX], + }) + } +}; diff --git a/projects/ArchimedesFinance/archimedesVaultAbi.json b/projects/ArchimedesFinance/archimedesVaultAbi.json new file mode 100644 index 00000000000..6970014587f --- /dev/null +++ b/projects/ArchimedesFinance/archimedesVaultAbi.json @@ -0,0 +1,3 @@ +{ + "totalAssets": "function totalAssets() view returns (uint256)" +} \ No newline at end of file diff --git a/projects/ArchimedesFinance/curvePoolAbi.json b/projects/ArchimedesFinance/curvePoolAbi.json new file mode 100644 index 00000000000..923224d48d6 --- /dev/null +++ b/projects/ArchimedesFinance/curvePoolAbi.json @@ -0,0 +1,4 @@ +{ + "balances": "function balances(uint256 arg0) view returns (uint256)" +} + \ No newline at end of file diff --git a/projects/ArchimedesFinance/index.js b/projects/ArchimedesFinance/index.js new file mode 100644 index 00000000000..04e532b2819 --- /dev/null +++ b/projects/ArchimedesFinance/index.js @@ -0,0 +1,25 @@ +const curvePoolAbi = require('./curvePoolAbi.json'); +const archimedesVaultAbi = require('./archimedesVaultAbi.json') +const ERC20_TOKEN_3CRV = "0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490"; +const POOL_CONTRACT_LVUSD_3CRV = "0xe9123cbc5d1ea65301d417193c40a72ac8d53501"; +const POOL_INDEX_3CRV = 1; +const ARCHIMEDES_VAULT_OUSD = "0x4c12c57C37Ff008450A2597e810B51B2BbA0383A"; +const ERC20_TOKEN_OUSD = "0x2A8e1E676Ec238d8A992307B495b45B3fEAa5e86"; + +async function tvl(_, _1, _2, { api }) { + // 3CRV liquidity in LVUSD-3CRV curve pool + const poolLiquidity3CRV = await api.call({ target: POOL_CONTRACT_LVUSD_3CRV, abi: curvePoolAbi.balances, params: POOL_INDEX_3CRV }); + + // Total OUSD held in vault + const totalAssetsOUSD = await api.call({ target: ARCHIMEDES_VAULT_OUSD, abi: archimedesVaultAbi.totalAssets }); + + api.add(ERC20_TOKEN_3CRV, poolLiquidity3CRV) + api.add(ERC20_TOKEN_OUSD, totalAssetsOUSD) +} + +module.exports = { + methodology: 'total 3CRV liquidity in curve pool + total OUSD assets in protocol vault.', + ethereum: { + tvl: tvl, + } +}; \ No newline at end of file diff --git a/projects/AstroFi/index.js b/projects/AstroFi/index.js new file mode 100644 index 00000000000..b002b537346 --- /dev/null +++ b/projects/AstroFi/index.js @@ -0,0 +1,17 @@ +const { getUniTVL, sumTokensExport } = require('../helper/unknownTokens') +const AFI = "0x360111d897d32614619F37f151061c8D431a47f9"; + +const dexTVL = getUniTVL({ factory: '0xd430999a8034cbc0eC84f7e5C6442470D20ef997', useDefaultCoreAssets: true, }) + + +module.exports = { + misrepresentedTokens: true, + methodology: `Uses factory(0xd430999a8034cbc0eC84f7e5C6442470D20ef997) address and whitelisted tokens address to find and price Liquidity Pool pairs. We also have our native token $AFI staking.`, + ethereum: { + tvl: dexTVL, + staking: sumTokensExport({ + owners: ['0x08d1199E3Be6e703644ac83C3159F6E169089996', '0xe8054a77fAb0ca0e1f7a750f34B9E064b366ebe6'], + tokens: [AFI], + }) + } +}; diff --git a/projects/AxiaProtocol/index.js b/projects/AxiaProtocol/index.js index 058c6f5ed2e..92d392856b3 100644 --- a/projects/AxiaProtocol/index.js +++ b/projects/AxiaProtocol/index.js @@ -1,11 +1,5 @@ -const sdk = require("@defillama/sdk"); -const { unwrapUniswapLPs, sumBalancerLps } = require("../helper/unwrapLPs"); -const {transformPolygonAddress} = require('../helper/portedTokens.js'); +const { unwrapBalancerToken } = require("../helper/unwrapLPs"); const { staking } = require("../helper/staking"); -const { getCurrentTokens } = require("../balancer/abi.json") -const BigNumber = require('bignumber.js') - -const wETHonEth = '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2' const axiaPoly = '0x49690541e3f6e933a9aa3cffee6010a7bb5b72d7' const lonePoolPoly = '0x6c43cd84f2199eef1e7fcf169357b6c7948efe03' @@ -21,175 +15,27 @@ const defiFundLPEth = '0x4833e8b56fc8e8a777fcc5e37cb6035c504c9478' const oracleFundEth = '0x152959A2f50D716707fEa4897e72C554272dC584' const oracleFundLPEth = '0xbf11db4e63c72c5dffde0f5831d667817c9e9ad5' +async function tvl(_, _b, _cb, { api, }) { + const balances = {} -async function calculatePolygonTvl(masterchef, lps, block, chain) { - let balances = {}; - const lpBalances = ( - await sdk.api.abi.multiCall({ - calls: lps.split(',').map((p) => ({ - target: p, - params: masterchef, - })), - abi: "erc20:balanceOf", - block, - chain, - }) - ).output; - let lpPositions = []; - lpBalances.forEach((p) => { - lpPositions.push({ - balance: p.output, - token: p.input.target, - }); - }); - await unwrapUniswapLPs( - balances, - lpPositions, - block, - chain, - (addr) => `${chain}:${addr}` - ); - return balances; -} - -const polygonTvl = async (timestamp, block, chainBlocks) => { - return await calculatePolygonTvl(swapPoolPoly, swapPoolLPoly, chainBlocks.polygon, "polygon"); -} - -async function calculateEthereumTvl(masterchef, lps, block, chain) { - let balances = {}; - - //Swap Fund - const lpBalances = ( - await sdk.api.abi.multiCall({ - calls: lps.split(',').map((p) => ({ - target: p, - params: masterchef, - })), - abi: "erc20:balanceOf", - block, - chain, - }) - ).output; - let lpPositions = []; - lpBalances.forEach((p) => { - lpPositions.push({ - balance: p.output, - token: p.input.target, - }); - }); - await unwrapUniswapLPs( - balances, - lpPositions, - block, - chain, - (addr) => `${chain}:${addr}` - ); - - //Defi Fund - const defiFundTokensEth = (await sdk.api.abi.call({ - abi: getCurrentTokens, - target: defiFundLPEth, - chain, - block, - })).output; - - const defiFundBalanceEth = (await sdk.api.abi.call({ - abi: 'erc20:balanceOf', - chain, - target: defiFundLPEth, - params: defiFundEth, - block, - })).output; - - const defiFundSupplyEth = (await sdk.api.abi.call({ - abi: 'erc20:totalSupply', - target: defiFundLPEth, - chain, - block, - })).output; - - const defiFundStakedSharesEth = defiFundBalanceEth / defiFundSupplyEth - - const defiFundLPUnderlyingBalanceEth = await sdk.api.abi.multiCall({ - calls: defiFundTokensEth.map(token => ({ - target: token, - params: [defiFundLPEth] - })), - abi: 'erc20:balanceOf', - block, - }); - - async function getDefiFundUnderlyingBalanceEth () { - await defiFundLPUnderlyingBalanceEth; - console.log(defiFundLPUnderlyingBalanceEth) - console.log(defiFundLPUnderlyingBalanceEth.output.map(outs => outs.output)) - defiFundLPUnderlyingBalanceEth.output.map(outs => outs.output = BigNumber(outs.output * defiFundStakedSharesEth).toFixed()); - console.log(defiFundLPUnderlyingBalanceEth)} - await getDefiFundUnderlyingBalanceEth(); - - sdk.util.sumMultiBalanceOf(balances, defiFundLPUnderlyingBalanceEth); - - //Oracle Fund - const oracleFundTokensEth = (await sdk.api.abi.call({ - abi: getCurrentTokens, - target: oracleFundLPEth, - chain, - block, - })).output; - - const oracleFundBalanceEth = (await sdk.api.abi.call({ - abi: 'erc20:balanceOf', - chain, - target: oracleFundLPEth, - params: oracleFundEth, - block, - })).output; - - const oracleFundSupplyEth = (await sdk.api.abi.call({ - abi: 'erc20:totalSupply', - target: oracleFundLPEth, - chain, - block, - })).output; - - const oracleFundStakedSharesEth = oracleFundBalanceEth / oracleFundSupplyEth - - const oracleFundLPUnderlyingBalanceEth = await sdk.api.abi.multiCall({ - calls: oracleFundTokensEth.map(token => ({ - target: token, - params: [oracleFundLPEth] - })), - abi: 'erc20:balanceOf', - block, - }); - - async function getOracleFundUnderlyingBalanceEth () { - await oracleFundLPUnderlyingBalanceEth; - console.log(oracleFundLPUnderlyingBalanceEth) - console.log(oracleFundLPUnderlyingBalanceEth.output.map(outs => outs.output)) - oracleFundLPUnderlyingBalanceEth.output.map(outs => outs.output = BigNumber(outs.output * oracleFundStakedSharesEth).toFixed()); - console.log(oracleFundLPUnderlyingBalanceEth)} - await getOracleFundUnderlyingBalanceEth(); - - sdk.util.sumMultiBalanceOf(balances, oracleFundLPUnderlyingBalanceEth); - - return balances; -} - + await Promise.all([ + unwrapBalancerToken({ api, owner: defiFundEth, balancerToken: defiFundLPEth, balances, isBPool: true, isV2: false, }), + unwrapBalancerToken({ api, owner: oracleFundEth, balancerToken: oracleFundLPEth, balances, isBPool: true, isV2: false, }), + ]) -const ethereumTvl = async (timestamp, ethBlock) => { - return await calculateEthereumTvl(swapPoolEth, swapPoolLPEth, ethBlock, "ethereum"); + return balances } module.exports = { - polygon:{ - tvl: polygonTvl, - staking: staking(lonePoolPoly, axiaPoly, "polygon") + doublecounted: true, + polygon: { + pool2: staking(swapPoolPoly, swapPoolLPoly), + staking: staking(lonePoolPoly, axiaPoly) }, ethereum: { - tvl: ethereumTvl, - staking: staking(lonelyPoolEth, axiaEth, "ethereum"), + tvl, + pool2: staking(swapPoolEth, swapPoolLPEth), + staking: staking(lonelyPoolEth, axiaEth), } } diff --git a/projects/BankOfCronos/index.js b/projects/BankOfCronos/index.js new file mode 100644 index 00000000000..59704192af4 --- /dev/null +++ b/projects/BankOfCronos/index.js @@ -0,0 +1,17 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require("../helper/unwrapLPs"); + +const BOC_TREASURY_ADDRESS = "0xBacF28BF21B374459C738289559EF89978D08102"; +const CUSD_ADDRESS = "0x26043Aaa4D982BeEd7750e2D424547F5D76951d4"; +const USDC_ADDRESS = ADDRESSES.cronos.USDC; + +module.exports = { + start: 6949784, + cronos: { + // tvl: sumTokensExport({ owner: BOC_TREASURY_ADDRESS, tokens: [CUSD_ADDRESS, USDC_ADDRESS]}), + tvl: () => 0 + }, + methodology: + "CDP collateral value + treasury mv", +}; + diff --git a/projects/BankofCronos-Loans/index.js b/projects/BankofCronos-Loans/index.js new file mode 100644 index 00000000000..0ab09ade2a2 --- /dev/null +++ b/projects/BankofCronos-Loans/index.js @@ -0,0 +1,17 @@ +const { sumTokens2 } = require("../helper/unwrapLPs"); + +// Active Pool holds total system collateral value(deposited collateral) +const ACTIVE_POOL_ADDRESS = "0xa86Ba8b60Aa4d943D15FF2894964da4C2A8F1B03"; + +async function tvl(_, _b, _cb, { api, }) { + const [tokens] = await api.call({ target: ACTIVE_POOL_ADDRESS, abi: 'function getAllCollateral() view returns (address[], uint256[])' }) + return sumTokens2({ api, owner: ACTIVE_POOL_ADDRESS, tokens }) +} + +module.exports = { + start: 6949784, + cronos: { + tvl, + }, + methodology: "Total CDP collateral value", +}; diff --git a/projects/BombFinance/index.js b/projects/BombFinance/index.js index 9810529ac16..ddbd3f9c9be 100644 --- a/projects/BombFinance/index.js +++ b/projects/BombFinance/index.js @@ -1,16 +1,9 @@ -const {calculateUniTvl} = require('../helper/calculateUniTvl.js') -const {transformFantomAddress} = require('../helper/portedTokens.js') +const {uniTvlExport} = require('../helper/calculateUniTvl.js') const factory = '0xD9473A05b2edf4f614593bA5D1dBd3021d8e0Ebe' -async function tvl(_timestamp, _block, chainBlocks){ - const transform = await transformFantomAddress(); - - const balances = await calculateUniTvl(transform, chainBlocks['fantom'], 'fantom', factory, 13483113, true); - return balances -} module.exports = { fantom:{ - tvl, + tvl: uniTvlExport(factory, 'fantom', true), }, } diff --git a/projects/Caketomb/index.js b/projects/Caketomb/index.js index a52b60e15b1..d95217c0cc2 100644 --- a/projects/Caketomb/index.js +++ b/projects/Caketomb/index.js @@ -1,8 +1,6 @@ -const sdk = require("@defillama/sdk"); const {pool2Exports} = require("../helper/pool2"); const { staking } = require("../helper/staking"); -const token = "0xAB4F3fC9831dBC77424269B9255fC1A082AC9840"; const shares = "0x9f8349C33B942b6CBb15426E02b5Bbb77fAeB64f"; const shareRewardPool = "0x02361bAd5b50AfDDea2d8c4359a8C9595445a90D"; const boardroom = "0xcE2912101EF05034Eb2FA818dd6e57Ab09c8Ca73"; diff --git a/projects/ChirpFinance/index.js b/projects/ChirpFinance/index.js new file mode 100644 index 00000000000..9b14b8cc4a2 --- /dev/null +++ b/projects/ChirpFinance/index.js @@ -0,0 +1,10 @@ +const { masterchefExports } = require("../helper/unknownTokens"); + +module.exports = masterchefExports({ + chain: "pulse", + masterchef: "0x8d1e3458dA9E8a685732322D435178E790486651", + nativeTokens: ["0xCa66B54a8A4AD9a231DD70d3605D1ff6aE95d427"], + useDefaultCoreAssets: true, + poolInfoABI: "function poolInfo(uint256) view returns (address)", + getToken: (i) => i, +}); diff --git a/projects/ColaFactory/index.js b/projects/ColaFactory/index.js new file mode 100644 index 00000000000..e34b1fc206d --- /dev/null +++ b/projects/ColaFactory/index.js @@ -0,0 +1,11 @@ +const { masterchefExports } = require("../helper/unknownTokens"); + +module.exports = masterchefExports({ + chain: "pulse", + masterchef: "0x5Fe423A22d4bFD1caFd6044042f4269Fc930F8dC", + nativeTokens: ["0x02Dff78fDeDaF86D9dfbe9B3132aA3Ea72Ed1680"], + useDefaultCoreAssets: true, + poolInfoABI: "function poolInfo(uint256) view returns (address)", + getToken: (i) => i, + blacklistedTokens: ['0x9bd778df9b803a2df1fbe94ca9b5765cdb299a23'], +}); diff --git a/projects/CollectifDAO/index.js b/projects/CollectifDAO/index.js new file mode 100644 index 00000000000..c54761837ef --- /dev/null +++ b/projects/CollectifDAO/index.js @@ -0,0 +1,18 @@ +const { nullAddress } = require("../helper/tokenMapping"); + +const COLLECTIF_LIQUID_STAKING_POOL_CONTRACT = "0xd0437765D1Dc0e2fA14E97d290F135eFdf1a8a9A"; // pool address +const totalAssetsABI = "function totalAssets() public view returns (uint256)"; + +module.exports = { + methodology: + "Collectif DAO is a non-custodial liquid staking protocol on Filecoin. It allows users stake FIL tokens to the pool and get back clFIL token, which is a native yield bearing liquid staking asset on Filecoin. This TVL calculation returns total amount of assets backing clFIL, that includes buffered capital in the pool and pledged capital to the Filecoin Storage Providers (miners)", + filecoin: { + tvl: async (_, _1, _2, { api }) => { + const totalAssets = await api.call({ abi: totalAssetsABI, target: COLLECTIF_LIQUID_STAKING_POOL_CONTRACT }); + + const tvl = totalAssets.toString(); + + api.add(nullAddress, tvl) + }, + }, +}; diff --git a/projects/CthulhuFinance/index.js b/projects/CthulhuFinance/index.js new file mode 100644 index 00000000000..7d293df098b --- /dev/null +++ b/projects/CthulhuFinance/index.js @@ -0,0 +1,29 @@ +const { sumUnknownTokens } = require("../helper/unknownTokens") + +function vaultTvl(vaults) { + return async (_, _b, _cb, { api, }) => { + const [tokens, bals] = await Promise.all([ + api.multiCall({ abi: 'address:want', calls: vaults }), + api.multiCall({ abi: 'uint256:balance', calls: vaults }), + ]) + api.addTokens(tokens, bals) + return sumUnknownTokens({ api, tokensAndOwners: [], useDefaultCoreAssets: true, lps: ['0xb220503db292a4d01fdb1725b95c0bdd734a6ce3'], resolveLP: true, }) + } +} + +module.exports = { + hallmarks: [ + [1679788800, "Rug Pull"] + ], + optimism: { + tvl: vaultTvl([ + "0xF6a6C4573099E6F6b9D8E1186a2C089B4d0fDf91", + "0x8296E2C3a78EdfEf9847F7Bcb6Cf57e09fDA5B83", + "0xabd80105bb547904e5B33A41e84FFFCF1623f5A9", + "0xeb2e04225D9a570eBd1C9577FfAF401ee076b7FD", + ]), + pool2: vaultTvl(['0xD61eE9E1991A22660FF10161926FF24B98Ad7918']), + staking: vaultTvl(['0xFca7B025449373fdDE24acCA662304b36cFd26a8']), + } +} + diff --git a/projects/DerpDEX/index.js b/projects/DerpDEX/index.js new file mode 100644 index 00000000000..7c09f1f6abd --- /dev/null +++ b/projects/DerpDEX/index.js @@ -0,0 +1,8 @@ +const { uniV3Export } = require("../helper/uniswapV3"); + +module.exports = uniV3Export({ + era: { + factory: "0x52a1865eb6903bc777a02ae93159105015ca1517", + fromBlock: 7790768, + }, +}); diff --git a/projects/DogeShrek/index.js b/projects/DogeShrek/index.js index 1c8f3e36398..bf265e609d0 100644 --- a/projects/DogeShrek/index.js +++ b/projects/DogeShrek/index.js @@ -4,7 +4,6 @@ module.exports = { misrepresentedTokens: true, dogechain: { tvl: getUniTVL({ - chain: 'dogechain', useDefaultCoreAssets: true, factory: '0x7C10a3b7EcD42dd7D79C0b9d58dDB812f92B574A', }) diff --git a/projects/E3/index.js b/projects/E3/index.js new file mode 100644 index 00000000000..473dc90087c --- /dev/null +++ b/projects/E3/index.js @@ -0,0 +1,36 @@ +const { sumTokens2 } = require('../helper/unwrapLPs') + +const factories = { + fantom: '0x8597dB3ba8dE6BAAdEDa8cBa4dAC653E24a0e57B', + arbitrum: '0x8597dB3ba8dE6BAAdEDa8cBa4dAC653E24a0e57B' + ///zkevm: tbd +} +async function tvl(_, _b, _cb, { api, }) { + const pools = await api.fetchList({ + target: factories[api.chain], + itemAbi: 'function getLBPairAtIndex(uint256) view returns (address)', + lengthAbi: 'uint256:getNumberOfLBPairs', + }) + const tokenA = await api.multiCall({ + abi: 'address:getTokenX', + calls: pools, + }) + const tokenB = await api.multiCall({ + abi: 'address:getTokenY', + calls: pools, + }) + const toa = [] + tokenA.map((_, i) => { + toa.push([tokenA[i], pools[i]]) + toa.push([tokenB[i], pools[i]]) + }) + return sumTokens2({ api, tokensAndOwners: toa, }) +} + +module.exports = { + methodology: 'Only the tokens inside E3 Liquidity Pools are counted in our TVL.', +} + +Object.keys(factories).forEach(chain => { + module.exports[chain] = { tvl } +}) diff --git a/projects/El-Dorado-Exchange/index.js b/projects/El-Dorado-Exchange/index.js new file mode 100644 index 00000000000..6ed3b8f5093 --- /dev/null +++ b/projects/El-Dorado-Exchange/index.js @@ -0,0 +1,34 @@ +const sdk = require('@defillama/sdk'); +const { gmxExports } = require("../helper/gmx"); +const { sumTokens2 } = require('../helper/unwrapLPs'); + +module.exports = { + bsc: { + tvl: sdk.util.sumChainTvls([ + gmxExports({ vault: '0x7f90C8De425e2E21F6d152e881713DE5Fe37dEAB', }), + gmxExports({ vault: '0x2c7077cF9bd07C3BC45B4E5b8C27f8B95c6550B3', }), + async (_, _1, _2, { api }) => { + const vault = '0xF1D7e3f06aF6EE68E22baFd37E6a67b1757c35a9' + const tokens = await api.call({ abi: 'address[]:fundingTokenList', target: vault}) + return sumTokens2({ api, owner: vault, tokens, }) + } + ]) + }, + arbitrum: { + tvl: sdk.util.sumChainTvls([ + async (_, _1, _2, { api }) => { + const vault = '0xfc36be177868b05f966e57bfc01617501b1f6926' + const tokens = await api.call({ abi: 'address[]:fundingTokenList', target: vault}) + return sumTokens2({ api, owner: vault, tokens, }) + }, + async (_, _1, _2, { api }) => { + const vault = '0x24b6137A5fe9d058baf654bb73aB857F57DF8BB4' + const tokens = await api.call({ abi: 'address[]:fundingTokenList', target: vault}) + return sumTokens2({ api, owner: vault, tokens, }) + }, + ]) + }, + hallmarks: [ + [Math.floor(new Date('2023-05-30')/1e3), 'Protocol was hacked!'], + ], +} diff --git a/projects/ElonSwap/index.js b/projects/ElonSwap/index.js index 4f36d6bf672..39ac9faf204 100644 --- a/projects/ElonSwap/index.js +++ b/projects/ElonSwap/index.js @@ -6,7 +6,6 @@ module.exports = { misrepresentedTokens: true, dogechain: { tvl: getUniTVL({ - chain, factory: "0x8B8CFD13ec09454E6440A4812ed306796a4Fb3eE", useDefaultCoreAssets: true, }), diff --git a/projects/Equalizer/index.js b/projects/Equalizer/index.js index e918f141f79..ade0739938d 100644 --- a/projects/Equalizer/index.js +++ b/projects/Equalizer/index.js @@ -2,8 +2,9 @@ const {uniTvlExport} = require('../helper/calculateUniTvl.js') const { staking } = require('../helper/staking') module.exports = { + misrepresentedTokens: true, fantom:{ - tvl: uniTvlExport("0xc6366EFD0AF1d09171fe0EBF32c7943BB310832a", "fantom"), + tvl: uniTvlExport("0xc6366EFD0AF1d09171fe0EBF32c7943BB310832a", "fantom", undefined, undefined, { hasStablePools: true, useDefaultCoreAssets: true, }), staking: staking("0x8313f3551C4D3984FfbaDFb42f780D0c8763Ce94", "0x3Fd3A0c85B70754eFc07aC9Ac0cbBDCe664865A6","fantom"), }, } diff --git a/projects/FlashLiquidity/index.js b/projects/FlashLiquidity/index.js new file mode 100644 index 00000000000..d503e336d94 --- /dev/null +++ b/projects/FlashLiquidity/index.js @@ -0,0 +1,23 @@ +const { getUniTVL } = require("../helper/unknownTokens"); + +const factory = "0x6e553d5f028bD747a27E138FA3109570081A23aE" + +module.exports = { + misrepresentedTokens: true, + polygon: { + tvl: getUniTVL({ + factory: factory, + useDefaultCoreAssets: true, + fetchBalances: true, + }), + }, + polygon_zkevm: { + tvl: getUniTVL({ + factory: factory, + useDefaultCoreAssets: true, + fetchBalances: true, + }), + }, + methodology: + "TVL comes from the DEX liquidity pools" +}; \ No newline at end of file diff --git a/projects/GotchiVault/abi.json b/projects/GotchiVault/abi.json index 803eae0e3ae..8fd52e8d066 100644 --- a/projects/GotchiVault/abi.json +++ b/projects/GotchiVault/abi.json @@ -1,25 +1,4 @@ { - "totalGHST": - { - "inputs": [ - { - "internalType": "address", - "name": "_user", - "type": "address" - } - ], - "name": "totalGHST", - "outputs": [ - { - "internalType": "uint256", - "name": "_totalGHST", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "tokenIdsOfOwner": - {"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"tokenIdsOfOwner","outputs":[{"internalType":"uint32[]","name":"tokenIds_","type":"uint32[]"}],"stateMutability":"view","type":"function"} - - } \ No newline at end of file + "totalGHST": "function totalGHST(address _user) view returns (uint256 _totalGHST)", + "tokenIdsOfOwner": "function tokenIdsOfOwner(address _owner) view returns (uint32[] tokenIds_)" +} \ No newline at end of file diff --git a/projects/GotchiVault/index.js b/projects/GotchiVault/index.js index 184a3073ca3..8d5f80f2b85 100644 --- a/projects/GotchiVault/index.js +++ b/projects/GotchiVault/index.js @@ -2,15 +2,13 @@ const sdk = require('@defillama/sdk'); const { transformPolygonAddress } = require('../helper/portedTokens'); const abi = require("./abi.json"); const { request, gql } = require("graphql-request"); -const { getBlock } = require('../helper/getBlock') - - +const { getBlock } = require('../helper/http') const VGHST_CONTRACT = "0x51195e21BDaE8722B29919db56d95Ef51FaecA6C"; const GHST_CONTRACT = "0x385Eeac5cB85A38A9a07A70c73e0a3271CfB54A7"; const VAULT_CONTRACT = "0xDd564df884Fd4e217c9ee6F65B4BA6e5641eAC63"; -const graphUrl = 'https://api.thegraph.com/subgraphs/name/aavegotchi/aavegotchi-core-matic' +const graphUrl = 'https://subgraph.satsuma-prod.com/tWYl5n5y04oz/aavegotchi/aavegotchi-core-matic/api' const graphQuery = gql` query GET_SUMMONED_GOTCHIS ($minGotchiId: Int, $block: Int) { aavegotchis( diff --git a/projects/Guru/index.js b/projects/Guru/index.js index 1ffdfe9858a..3391dc8a2c3 100644 --- a/projects/Guru/index.js +++ b/projects/Guru/index.js @@ -1,66 +1,19 @@ -const sdk = require("@defillama/sdk") -const ITVL = [ - { - "inputs": [], - "name": "pool2", //POOL2 TVL : 1e18 === 1 USD - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "staking", //STAKING TVL : 1e18 === 1 USD - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "tvl", //GLOABL TVL : 1e18 === 1 USD - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "usd", //On-chain USD Reference Token - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } -] +const ITVL = { + pool2: "uint256:pool2", + staking: "uint256:staking", + tvl: "uint256:tvl", +} // TvlGuru: On-Chain Universal TVL Finder const tvlGuru = { "fantom": "0x0786c3a78f5133F08C1c70953B8B10376bC6dCad", "kcc": "0x426a4A4B73d4CD173C9aB78d18c0d79d1717eaA9", "multivac": "0xe345A50C33e5c9D0284D6fF0b891c4Fc99a9C117", - "echelon": "0x5C652A94c672f8F6D021417bB5eE75c322ecf1Fc", - "metis": "0x50Dcc6cb1B2d6965c42d98a2b07629c57a6be895" + "echelon": "0xa254bfd74c38b26145b980162fb1a49bc0a4f14b", + "metis": "0x50Dcc6cb1B2d6965c42d98a2b07629c57a6be895", + "bsc": "0xD600Ec98cf6418c50EE051ACE53219D95AeAa134", + "arbitrum": "0xFAB311FE3E3be4bB3fEd77257EE294Fb22Fa888b", + "avax": "0xFAB311FE3E3be4bB3fEd77257EE294Fb22Fa888b" } module.exports = { @@ -68,11 +21,12 @@ module.exports = { methodology: "USD-denominated value aggregation of most Locked assets held across Guru Network's & Kompound Protocol's smart contracts across multiple chains, powered by direct on-chain storage of quantity, pools and prices using ftm.guru's Universal TVL Finder Tool (tvlGuru.sol). More detailed documentation of TVL is available at https://ftm.guru/rawdata/tvl", } -Object.keys(tvlGuru).forEach(chain => { - const callArgs = { target: tvlGuru[chain], chain, } +Object.entries(tvlGuru).forEach(([chain, target]) => { module.exports[chain] = { - pool2: async (_, _b, { [chain]: block }) => ({ tether: ((await sdk.api.abi.call({ ...callArgs, abi: ITVL[0], block })).output) / 1e18 }), - staking: async (_, _b, { [chain]: block }) => ({ tether: ((await sdk.api.abi.call({ ...callArgs, abi: ITVL[1], block })).output) / 1e18 }), - tvl: async (_, _b, { [chain]: block }) => ({ tether: ((await sdk.api.abi.call({ ...callArgs, abi: ITVL[2], block })).output) / 1e18 }), + // pool2: async (_, _b, _c, { api, }) => ({ tether: ((await api.call({ target, abi: ITVL.pool2 }))) / 1e18 }), + // staking: async (_, _b, _c, { api, }) => ({ tether: ((await api.call({ target, abi: ITVL.staking}))) / 1e18 }), + tvl: async (_, _b, _c, { api, }) => ({ tether: ((await api.call({ target, abi: ITVL.tvl }))) / 1e18 }), } }) + +module.exports.echelon.tvl = () => ({}) \ No newline at end of file diff --git a/projects/HoneyFarm/index.js b/projects/HoneyFarm/index.js index d47af22bcbd..30d1f7cd715 100644 --- a/projects/HoneyFarm/index.js +++ b/projects/HoneyFarm/index.js @@ -1,13 +1,9 @@ const { addFundsInMasterChef } = require("../helper/masterchef"); -const { - transformAvaxAddress, - transformBscAddress, -} = require("../helper/portedTokens"); const { staking } = require("../helper/staking"); async function avax(timestamp, _, {avax: block}) { let balances = {}; - const transform = await transformAvaxAddress(); + const transform = addr => 'avax:'+addr await addFundsInMasterChef( {}, @@ -23,7 +19,7 @@ async function avax(timestamp, _, {avax: block}) { async function bsc(timestamp, _, {bsc: block}) { let balances = {}; - const transform = await transformBscAddress(); + const transform = addr => 'bsc:'+addr await addFundsInMasterChef( {}, diff --git a/projects/IgnoreFUD/index.js b/projects/IgnoreFUD/index.js new file mode 100644 index 00000000000..2c1e5236d4d --- /dev/null +++ b/projects/IgnoreFUD/index.js @@ -0,0 +1,18 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require('../helper/unknownTokens'); + +const LpAddress = "0x5Ab9f0Ea4fD182a1edC89D379c1F1c5d6B6eF623"; +const IgnoreFUDToken = "0x98564E70c7fCC6d947fFE6d9EfeD5ba68b306F2E"; +const ERC20ContractWCoreAddress = ADDRESSES.core.WCORE; +const Pool_One = "0x2CaBc908c163f966fD9A1493211F91B0371A8575"; +const Pool_Two = "0xBA554Bd93BF6EE9E2F2f85F9448513F932E338Ad"; +const Pool_Three = "0x8b3cC46943243E260E201ADd16F2ed15253f6702" + +module.exports = { + core: { + tvl: () => ({}), + staking: sumTokensExport({ owners: [Pool_One,Pool_Two,Pool_Three], tokens: [IgnoreFUDToken], useDefaultCoreAssets: true, lps: [LpAddress], }), + } +}; + + diff --git a/projects/KungFuu-Finance/index.js b/projects/KungFuu-Finance/index.js index f28f58110d0..87f256fc684 100644 --- a/projects/KungFuu-Finance/index.js +++ b/projects/KungFuu-Finance/index.js @@ -1,8 +1,9 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens } = require('../helper/unwrapLPs') const { getChainTransform } = require('../helper/portedTokens') const sdk = require("@defillama/sdk") -const wFTM = '0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83' +const wFTM = ADDRESSES.fantom.WFTM const kngfuu_token = "0x89b61Ab033584918103698953870F07D6db412A3".toLowerCase() async function tvl(ts, _block, { fantom: block }) { @@ -12,7 +13,7 @@ async function tvl(ts, _block, { fantom: block }) { const owners = ["0x29187b10a04B269Cf067AE013B3ab58d4affaC03", "0xaaef45e31e2d2865a4722c1591ba4cd8f6e83bad", "0xfeAFAF0610fe2c73bB6345080056066aE109B31F"] const treasuryTokens = [ wFTM, // WFTM - "0x04068da6c83afcfa0e13ba15a6696662335d5b75", // USDC + ADDRESSES.fantom.USDC, // USDC "0xf704f5ac5edf152168e07e6f5f108366911250ac", // WFTM/KNGFUU, needs to account only half of it ] diff --git a/projects/Kwikswap/index.js b/projects/Kwikswap/index.js index 6bbb21e9b50..db7a438e869 100644 --- a/projects/Kwikswap/index.js +++ b/projects/Kwikswap/index.js @@ -15,12 +15,10 @@ const STAKING_CONTRACTS = { }; module.exports = { - timetravel: true, misrepresentedTokens: true, ethereum: { tvl: getUniTVL({ factory: '0xdD9EFCbDf9f422e2fc159eFe77aDD3730d48056d', - chain: 'ethereum', useDefaultCoreAssets: true, }), staking: staking( @@ -32,7 +30,6 @@ module.exports = { polygon: { tvl: getUniTVL({ factory: '0x0B29D7a989D6647E4A56eE9899DaF7535FF9620c', - chain: 'polygon', useDefaultCoreAssets: true, }), staking: staking( @@ -44,7 +41,6 @@ module.exports = { shiden: { tvl: getUniTVL({ factory: '0xf5fC2D145381A2eBAFb93Cc2B60fB2b97FB405aa', - chain: 'shiden', useDefaultCoreAssets: true, }), staking: staking( @@ -56,7 +52,6 @@ module.exports = { }, bsc: { tvl: getUniTVL({ - chain: 'bsc', useDefaultCoreAssets: true, factory: '0x64eBD6CaCece790e9C4DDeA1a24952Ddb2715279', }), diff --git a/projects/KyborgExchange/index.js b/projects/KyborgExchange/index.js new file mode 100644 index 00000000000..bf26c8fa31c --- /dev/null +++ b/projects/KyborgExchange/index.js @@ -0,0 +1,23 @@ +const { getLogs } = require('../helper/cache/getLogs'); +const { sumTokens2 } = require('../helper/unwrapLPs'); + +const config = { + arbitrum: { factory: '0x25620d76654caC426229C85bE8eAEB010Ea25c8F', fromBlock: 89067435 }, +} + +module.exports = { + hallmarks: [ + [1684108800, "Rug Pull"] + ], + methodology: `Counts the tokens balances of the KyborgHub contract`, +}; + +Object.keys(config).forEach(chain => { + const { factory, fromBlock } = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const logs = await getLogs({ api, target: factory, onlyArgs: true, eventAbi: 'event PoolCreated (address indexed token0, address indexed token1, bytes32 indexed poolId)', topics: ['0xec5dc6309c83a50f60f4a1fae9422b2c406da78c579b9b12b92d033db37c7194'], fromBlock, }) + return sumTokens2({ api, owner: factory, tokens: logs.map(i => [i.token0, i.token1]).flat()}) + } + } +}) \ No newline at end of file diff --git a/projects/LFIswap/index.js b/projects/LFIswap/index.js index 88824b07d61..9fc0d8f9ac0 100644 --- a/projects/LFIswap/index.js +++ b/projects/LFIswap/index.js @@ -6,7 +6,6 @@ module.exports = { kava: { tvl: getUniTVL({ factory: '0xB702C2917f47012C331C6c65B74e07dA61260Bd4', - chain: 'kava', useDefaultCoreAssets: true, }), } diff --git a/projects/Liquify/index.js b/projects/Liquify/index.js new file mode 100644 index 00000000000..fe7a6fbdc72 --- /dev/null +++ b/projects/Liquify/index.js @@ -0,0 +1,12 @@ +const { getUniTVL } = require('../helper/unknownTokens.js') + +module.exports = { + misrepresentedTokens: true, + core:{ + tvl: getUniTVL({ + useDefaultCoreAssets: true, + hasStablePools: true, + factory: '0x0Ed2a54c8fD6dcc3cF0f8fd97c748438f0f32eAD', + }), + }, +} diff --git a/projects/Lockless/index.js b/projects/Lockless/index.js new file mode 100644 index 00000000000..1640ef60f07 --- /dev/null +++ b/projects/Lockless/index.js @@ -0,0 +1,19 @@ +const swkava = '0x9d9682577CA889c882412056669bd936894663fd' +const swech = '0x86e4D91800c03e803d4c8FA3293d1C7d612A7300' + +async function tvl(timestamp, ethBlock, { kava: block }, { api }) { + + const pooledCoin = await api.call({ + target: api.chain === 'kava' ? swkava : swech, + abi: "uint256:totalSupply", + }) + return { + [api.chain === 'kava' ? 'kava' : 'echelon']: pooledCoin / 1e18, + } +} + +module.exports = { + kava: { tvl }, + echelon: { tvl: () => ({}), }, + methodology: "Any & Each 1 SW-Token can only ever be minted by permanent locking of 1 Native token. Hence, the totalSupply() method is used to aggregate the amounts of underlying assets, with their prices fed by the DefiLlama SDK.", +} diff --git a/projects/MFIL/index.js b/projects/MFIL/index.js new file mode 100644 index 00000000000..c071cd8ff0d --- /dev/null +++ b/projects/MFIL/index.js @@ -0,0 +1,18 @@ +const MFILPOOLCONTRACT = '0x8aF827CDa3b7Eee9720496A30595D7Ee89A27ee2'; +const MFILREGULARPOOLCONTRACT = '0xD4f7c1A09ed5f50a3eC2F1e9fcF8B1bc2d1d3d70' +const ADDRESSES = require('../helper/coreAssets.json') + +async function mfilTvl(_, _1, _2, { api }) { + const mfilPoolStakeMfil = await api.call({ + target: MFILPOOLCONTRACT, + abi: "erc20:totalSupply", + }) + + api.add(ADDRESSES.null, mfilPoolStakeMfil) +} + +module.exports = { + filecoin: { + tvl: mfilTvl + }, +} diff --git a/projects/MantisSwap/index.js b/projects/MantisSwap/index.js new file mode 100644 index 00000000000..439b3c14a5c --- /dev/null +++ b/projects/MantisSwap/index.js @@ -0,0 +1,26 @@ +const { sumTokens2 } = require("../helper/unwrapLPs"); + +const config = { + polygon: { vaults: ['0x62Ba5e1AB1fa304687f132f67E35bFC5247166aD'] }, + polygon_zkevm: { vaults: ['0x12d41b6DF938C739F00c392575e3FD9292d98215'] }, +} + +const MAX_LP_TOKENS = 3 + +Object.keys(config).forEach(chain => { + const { vaults } = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const calls = vaults.map(vault => { + let res = [] + for (let i = 0; i < MAX_LP_TOKENS; i++) + res.push({ target: vault, params: i }) + return res + }).flat() + let lpVaults = await api.multiCall({ abi: 'function lpList(uint256) view returns (address)', calls, permitFailure: true }) + lpVaults = lpVaults.filter(v => v) + const tokens = await api.multiCall({ abi: 'address:underlier', calls: lpVaults }) + return sumTokens2({ api, tokensAndOwners2: [tokens, lpVaults] }) + } + } +}) diff --git a/projects/MellowProtocol/index.js b/projects/MellowProtocol/index.js new file mode 100644 index 00000000000..fced703a119 --- /dev/null +++ b/projects/MellowProtocol/index.js @@ -0,0 +1,56 @@ +const { getLogs } = require('../helper/cache/getLogs') +const sdk = require('@defillama/sdk') + +const config = { + ethereum: { + registry: '0xfd23f971696576331fcf96f80a20b4d3b31ca5b2', + fromBlock: 15237714, + }, + polygon: { + registry: '0xd3d0e85f225348a2006270daf624d8c46cae4e1f', + fromBlock: 31243728, + } +} + +module.exports = { + doublecounted: true, +}; + +Object.keys(config).forEach(chain => { + const { registry, fromBlock, } = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const balances = {} + const logs = await getLogs({ + api, + target: registry, + topic: 'VaultRegistered(address,address,uint256,address,address)', + fromBlock, + eventAbi: 'event VaultRegistered (address indexed origin, address indexed sender, uint256 indexed nft, address vault, address owner)', + onlyArgs: true, + extraKey: 'VaultRegistered' + }) + const vaultKeys = {} + logs.forEach(i => vaultKeys[i.nft] = i.vault) + const tokenLockedLogs = await getLogs({ + api, + target: registry, + topic: 'TokenLocked(address,address,uint256)', + fromBlock, + eventAbi: 'event TokenLocked (address indexed origin, address indexed sender, uint256 indexed nft)', + onlyArgs: true, + extraKey: 'TokenLocked' + }) + tokenLockedLogs.forEach(i => delete vaultKeys[i.nft]) + let vaults = Object.values(vaultKeys) + const tokens = await api.multiCall({ abi: 'function vaultTokens() view returns (address[])', calls: vaults }) + const bals = await api.multiCall({ abi: 'function tvl() view returns (uint256[] minTokenAmounts, uint256[] maxTokenAmounts)', calls: vaults, permitFailure: true }) + tokens.forEach((tokens, i) => { + if (!bals[i]) return; + let balsInner = bals[i].minTokenAmounts + tokens.forEach((v, i) => sdk.util.sumSingleBalance(balances, v, balsInner[i], api.chain)) + }) + return balances + } + } +}) \ No newline at end of file diff --git a/projects/MineFi/index.js b/projects/MineFi/index.js new file mode 100644 index 00000000000..d853f5d55e0 --- /dev/null +++ b/projects/MineFi/index.js @@ -0,0 +1,24 @@ +const sdk = require('@defillama/sdk'); +const ADDRESSES = require('../helper/coreAssets.json') +const MINEFI_CONTRACT = "0xeCa50369cb0cDBaE173C9c81c1B48212adc4b501"; + +async function tvl(_, _1, _2, { api }) { + + const collateralBalance = await api.call({ + abi: 'function getTvl() external view returns (uint256)', + target: MINEFI_CONTRACT, + }); + + api.add(ADDRESSES.null,collateralBalance) +} + + + +module.exports = { + timetravel: false, + misrepresentedTokens: false, + methodology: 'counts the number of pledge filecoins in the minefi contract', + filecoin: { + tvl + } +}; \ No newline at end of file diff --git a/projects/MultiSwap/index.js b/projects/MultiSwap/index.js index 2473edfb81a..8912fc2fd49 100755 --- a/projects/MultiSwap/index.js +++ b/projects/MultiSwap/index.js @@ -2,42 +2,12 @@ const sdk = require('@defillama/sdk') const { createIncrementArray } = require('../helper/utils') const { sumTokens2 } = require('../helper/unwrapLPs') -const token0ABI = require('../helper/abis/token0.json') -const token1ABI = require('../helper/abis/token1.json') +const token0ABI = 'address:token0' +const token1ABI = 'address:token1' const abis = { - "poolsCount": { - "inputs": [], - "name": "poolsCount", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "poolsAddresses": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "poolsAddresses", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, + poolsCount: "uint256:poolsCount", + poolsAddresses: "function poolsAddresses(uint256) view returns (address)", } const config = { diff --git a/projects/MyTrade/index.js b/projects/MyTrade/index.js index b570e456038..6eaa5528f8c 100644 --- a/projects/MyTrade/index.js +++ b/projects/MyTrade/index.js @@ -1,32 +1,33 @@ -const { getUniTVL } = require("../helper/unknownTokens") const { sumTokens2 } = require("../helper/unwrapLPs") -const { getUniqueAddresses } = require("../helper/utils") +const { getUniqueAddresses, } = require("../helper/utils") +const uniswapAbi = require("../helper/abis/uniswap") const sdk = require('@defillama/sdk') -const orderBook = '0x5D36b36c53438C0fb70DCA5082EE5BDe25Bd888B' - -module.exports = { - polygon: { - tvl: async (_, _b, { polygon: block }) => { - const { - pairs, - updateBalances, - balances, - } = await getUniTVL({ - factory: '0x3ee4154c7f42d94e1092ad8ce5debb4b743ed0b2', - chain: 'polygon', - useDefaultCoreAssets: true, - withMetaData: true, - })(_, _b, { polygon: block }) +const config = { + polygon: { orderBook: '0x5D36b36c53438C0fb70DCA5082EE5BDe25Bd888B', factory: '0x3ee4154c7f42d94e1092ad8ce5debb4b743ed0b2'}, + moonbeam: { orderBook: '0x75037b5D3B0bC1f28748918579BF35B68d01ebD3', factory: '0xdd760d04200c40e8dbBa158A860D4C872a6E3C35'}, +} - const tokens = Object.values(pairs).map(i => Object.values(i)).flat() +module.exports = {}; - await sumTokens2({ - chain: 'polygon', block, owner: orderBook, tokens: getUniqueAddresses(tokens), balances, +Object.keys(config).forEach(chain => { + const {orderBook, factory } = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, chain, block }) => { + const balances = {} + const calls = await api.fetchList({ lengthAbi: uniswapAbi.allPairsLength, itemAbi: uniswapAbi.allPairs, target: factory }) + const token0s = await api.multiCall({ abi: uniswapAbi.token0, calls }) + const token1s = await api.multiCall({ abi: uniswapAbi.token1, calls }) + const reserves = await api.multiCall({ abi: uniswapAbi.getReserves, calls }) + reserves.forEach(({ _reserve0, _reserve1}, i) => { + sdk.util.sumSingleBalance(balances,token0s[i],_reserve0, chain) + sdk.util.sumSingleBalance(balances,token1s[i],_reserve1, chain) }) - - await updateBalances(balances) - return balances - } - }, -} + const tokens = [...token0s, ...token1s] + + return sumTokens2({ + chain, block, owner: orderBook, tokens: getUniqueAddresses(tokens), balances, + }) + }, + } +}) diff --git a/projects/OCTOplace/index.js b/projects/OCTOplace/index.js new file mode 100644 index 00000000000..dd09f3c7b90 --- /dev/null +++ b/projects/OCTOplace/index.js @@ -0,0 +1,13 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const sdk = require("@defillama/sdk"); +const { sumTokensExport } = require("../helper/unwrapLPs"); + +const contractKAVA = "0x61F91266F6abEA61447E00EB781A3c38a3D1b925"; +const contractTHETA = "0x6e4c614da85DD861e08f84706742239dBA892Df1"; +const KAVA_TFUEL = ADDRESSES.null; // Native coin +const USDC = ADDRESSES.telos.ETH; + +module.exports = { + kava: { tvl: sumTokensExport({ owner: contractKAVA, tokens: [KAVA_TFUEL, USDC] }) }, + theta: { tvl: sumTokensExport({ owner: contractTHETA, tokens: [KAVA_TFUEL] }) } +}; diff --git a/projects/OT/index.js b/projects/OT/index.js new file mode 100644 index 00000000000..5cb37353519 --- /dev/null +++ b/projects/OT/index.js @@ -0,0 +1,15 @@ +const swapContractV1 = '0x84c18204c30da662562b7a2c79397C9E05f942f0'; +const swapContractV2 = '0x2a98158166BE71D21Dd97e248ba670211Df9a73C'; +const { sumTokens2 } = require('../helper/unwrapLPs') + +async function tvl(timestamp, ethBlock, chainBlocks, { api }) { + const v1tokens = await api.call({ target: swapContractV1, abi: 'function getPoolTokenList() external view returns (address[])', }); + const v2tokens = await api.call({ target: swapContractV2, abi: 'function getPoolTokenList() external view returns (address[])', }); + return sumTokens2({ api,tokens:[...v1tokens,...v2tokens],owners:[swapContractV1,swapContractV2]}) +} + +module.exports = { + era: { + tvl + }, +}; \ No newline at end of file diff --git a/projects/Paraluni/index.js b/projects/Paraluni/index.js index 3e97ec5d3da..fabadc573dc 100644 --- a/projects/Paraluni/index.js +++ b/projects/Paraluni/index.js @@ -1,159 +1,25 @@ -const sdk = require("@defillama/sdk"); -const { addFundsInMasterChef } = require("../helper/masterchef"); -const BigNumber = require("bignumber.js"); -const usdtAddr = "0x55d398326f99059ff775485246999027b3197955"; -const busdAddr = "0xe9e7cea3dedca5984780bafc599bd69add087d56"; -const usdtBusd = "0xEF7ae734a1E522498DF44d68853E9329674d51D5"; -const ethAddr = "0x2170ed0880ac9a755fd29b2688956bd959f933f8"; -const wBNBAddr = "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c"; +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require("../helper/unwrapLPs"); const paraChef = "0x77341bF31472E9c896f36F4a448fdf573A0D9B60"; -const poolInfo = { - "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "name": "poolInfo", - "outputs": [{ "internalType": "contract IERC20", "name": "lpToken", "type": "address" }, { - "internalType": "uint256", - "name": "allocPoint", - "type": "uint256" - }, { "internalType": "uint256", "name": "lastRewardBlock", "type": "uint256" }, { - "internalType": "uint256", - "name": "accT42PerShare", - "type": "uint256" - }, { "internalType": "contract IParaTicket", "name": "ticket", "type": "address" }, { - "internalType": "uint256", - "name": "pooltype", - "type": "uint256" - }], - "stateMutability": "view", - "type": "function" -}; - -async function tvl(timestamp, block, chainBlocks) { - let balances = {}; - //Some tokens are ignored because we modified the logic that a token can only create a pool. - //It will only be added once below to prevent repeated calculations - await addFundsInMasterChef(balances, paraChef, chainBlocks.bsc, "bsc", addr => `bsc:${addr}`, poolInfo, [ - usdtAddr, - usdtBusd, - ethAddr, - wBNBAddr, - busdAddr, - "0x5976815f279D8bF22748f75072887591e1f65264", - "0xcDD33E0A056470E281a03B1d1f3Ef05334f9dBE1", - "0x781f5D719Dcd59B6eE01aDEE6170750DC9132247" - - ], true, false, V42); - //add usdt pool - let usdtBalance0 = (await sdk.api.erc20.balanceOf({ - target: usdtAddr, - owner: paraChef, - block: chainBlocks.bsc, - chain: "bsc" - })).output; - sdk.util.sumSingleBalance(balances, `bsc:${usdtAddr}`, usdtBalance0); - //add usdt of usdt-busd - let usdtBalance1 = (await sdk.api.erc20.balanceOf({ - target: usdtAddr, - owner: usdtBusd, - block: chainBlocks.bsc, - chain: "bsc" - })).output; - sdk.util.sumSingleBalance(balances, `bsc:${usdtAddr}`, usdtBalance1); - //add busd of usdt-busd - let busdBalance = (await sdk.api.erc20.balanceOf({ - target: busdAddr, - owner: usdtBusd, - block: chainBlocks.bsc, - chain: "bsc" - })).output; - sdk.util.sumSingleBalance(balances, `bsc:${busdAddr}`, busdBalance); - //add eth - let ethBalance = (await sdk.api.erc20.balanceOf({ - target: ethAddr, - owner: paraChef, - block: chainBlocks.bsc, - chain: "bsc" - })).output; - sdk.util.sumSingleBalance(balances, `bsc:${ethAddr}`, ethBalance); - //add wbnb - let wbnbBalance = (await sdk.api.erc20.balanceOf({ - target: wBNBAddr, - owner: paraChef, - block: chainBlocks.bsc, - chain: "bsc" - })).output; - sdk.util.sumSingleBalance(balances, `bsc:${wBNBAddr}`, wbnbBalance); - return balances; -} - - -const pool2Addresses = [ - //BTCB_V42 - "0x7Bdc1963CA77f22C0c4829182876EBB2478e6380", - //BUSD_V42 - "0xdbbDF41929d65c974C13c979A87B235377897DF9", - //BNB_V42 - "0x478d1721f6FA74124C281CB17744249F51D55BC5" -]; - -const WBNB = "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c"; -const BUSD = "0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56"; -const BTCB = "0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c"; -const V42 = "0xA573cD6890b50E02Dd658164882ee7B6A86C1122"; - -async function pool2(time, ethBlock, chainBlocks) { - const balances = {}; - - for (let idx = 0; idx < pool2Addresses.length; idx++) { - const balances_slp = ( - await sdk.api.abi.call({ - abi: 'erc20:balanceOf', - target: pool2Addresses[idx], - params: paraChef, - chain: "bsc", - block: chainBlocks["bsc"] - }) - ).output; - - const totalSupply_slp = ( - await sdk.api.erc20.totalSupply({ - target: pool2Addresses[idx], - chain: "bsc", - block: chainBlocks["bsc"] - }) - ).output; - - const underlyingsBalance = ( - await sdk.api.abi.multiCall({ - calls: [BTCB, BUSD, WBNB, V42].map((token) => ({ - target: token, - params: pool2Addresses[idx] - })), - abi: 'erc20:balanceOf', - chain: "bsc", - block: chainBlocks["bsc"] - }) - ).output; - - underlyingsBalance.forEach((call) => { - const underlyingSetBalance = BigNumber(call.output) - .times(balances_slp) - .div(totalSupply_slp); - - sdk.util.sumSingleBalance( - balances, - `bsc:${call.input.target}`, - underlyingSetBalance.toFixed(0) - ); - }); - } - - return balances; -} +const prehackChef = '0x633fa755a83b015cccdc451f82c57ea0bd32b4b4' module.exports = { - start: 1651408734, bsc: { - tvl: tvl, - pool2: pool2 - } + tvl: sumTokensExport({ + owner: paraChef, + tokens: [ + ADDRESSES.bsc.BTCB, + ADDRESSES.bsc.ETH, + ADDRESSES.bsc.USDT, + ADDRESSES.bsc.WBNB, + ADDRESSES.bsc.BUSD, + '0xf8a0bf9cf54bb92f17374d9e9a321e6a111a51bd', + '0x965f527d9159dce6288a2219db51fc6eef120dd1', + '0x0e09fabb73bd3ade0a17ecc321fd13a19e81ce82', + ] + }), + }, + hallmarks: [ + [Math.floor(new Date('2022-03-13')/1e3), 'Masterchef was hacked'], + ], }; diff --git a/projects/PlsPrint/index.js b/projects/PlsPrint/index.js new file mode 100644 index 00000000000..f703f28ade4 --- /dev/null +++ b/projects/PlsPrint/index.js @@ -0,0 +1,18 @@ +const { sumTokens2, nullAddress } = require("../helper/unwrapLPs"); + +const contract = "0x750684313510d680D172FD5734e49De3cE91925D"; + +async function tvl(time, ethBlock, { bsc: block }) { + return sumTokens2({ + tokens: [nullAddress], + owner: contract, + block, + chain: "pulse", + }); +} + +module.exports = { + pulse: { + tvl, + }, +}; diff --git a/projects/PowSea/index.js b/projects/PowSea/index.js index 4dfbdfe8af6..461fb2f69b8 100644 --- a/projects/PowSea/index.js +++ b/projects/PowSea/index.js @@ -4,7 +4,6 @@ module.exports = { misrepresentedTokens: true, ethpow: { tvl: getUniTVL({ - chain: 'ethpow', useDefaultCoreAssets: true, factory: '0x1Ee0fe7f80BeA6353b137B2E7DCA9e26F3c6F442', }) diff --git a/projects/RealProtocol/getEntireSystemColl.abi.json b/projects/RealProtocol/getEntireSystemColl.abi.json deleted file mode 100644 index 15a2c6c04b3..00000000000 --- a/projects/RealProtocol/getEntireSystemColl.abi.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "inputs": [], - "name": "getEntireSystemColl", - "outputs": [ - { - "internalType": "uint256", - "name": "entireSystemColl", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" -} \ No newline at end of file diff --git a/projects/RealProtocol/index.js b/projects/RealProtocol/index.js index 20a9c2a4f76..9e09bbcc23c 100644 --- a/projects/RealProtocol/index.js +++ b/projects/RealProtocol/index.js @@ -1,11 +1,4 @@ const sdk = require("@defillama/sdk"); -const getEntireSystemCollAbi = require("./getEntireSystemColl.abi.json"); - -const ETHW_ADDRESS = "0x0000000000000000000000000000000000000000"; -//const USDW_TOKEN_ADDRESS = "0x520A36eE3aa0b506288915f91Fb4BBB23d09a7D7"; - -// StabilityPool holds deposited LUSD -//const STABILITY_POOL_ADDRESS = "0x78E03893818fcE52Bf7BBf3bb2854077AB10BA98"; // TroveManager holds total system collateral (deposited ETH) const TROVE_MANAGER_ADDRESS = "0x25d27cbdfaFb1B7314AC5e409a1F24112e376829"; @@ -15,7 +8,7 @@ async function tvl(_, _b, {ethpow: block}) { await sdk.api.abi.call({ target: TROVE_MANAGER_ADDRESS, chain: 'ethpow', - abi: getEntireSystemCollAbi, + abi: "uint256:getEntireSystemColl", block, }) ).output; diff --git a/projects/Revoluzion/index.js b/projects/Revoluzion/index.js new file mode 100644 index 00000000000..19b3dd2365f --- /dev/null +++ b/projects/Revoluzion/index.js @@ -0,0 +1,5 @@ +module.exports = { + bsc: { + tvl: () => 0, + } +} diff --git a/projects/SharpeLabs/index.js b/projects/SharpeLabs/index.js new file mode 100644 index 00000000000..43097a1a4a4 --- /dev/null +++ b/projects/SharpeLabs/index.js @@ -0,0 +1,27 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const sdk = require('@defillama/sdk'); +const StEthVaultContract = '0xfc85db895e070017ab9c84cb65b911d56b729ee9'; + +// function to return TVL of magnum +async function tvl(_, _1, _2, { api }) { + const balances = {}; + + // get balance of eth + const EthBalance = await api.call({ + abi: 'function getVaultsActualBalance() public view returns(uint amount)', + target: StEthVaultContract, + }); + + return { + ['ethereum:' + ADDRESSES.null]: EthBalance + }; +} + +module.exports = { + timetravel: true, + misrepresentedTokens: false, + methodology: 'counts the Eth amount of by substracting Supplied stEth amount of vault by borrowed Weth of vault', + ethereum: { + tvl, + } +}; \ No newline at end of file diff --git a/projects/Shibafantom/index.js b/projects/Shibafantom/index.js index ce7b40f8025..7d9b8f36dcc 100644 --- a/projects/Shibafantom/index.js +++ b/projects/Shibafantom/index.js @@ -1,16 +1,9 @@ -const {calculateUniTvl} = require('../helper/calculateUniTvl.js') -const {transformFantomAddress} = require('../helper/portedTokens.js') +const {uniTvlExport} = require('../helper/calculateUniTvl.js') const factory = '0xeAcC845E4db0aB59A326513347a37ed4E999aBD8' -async function tvl(_timestamp, _ethBlock, chainBlocks){ - const transform = await transformFantomAddress(); - - const balances = await calculateUniTvl(transform, chainBlocks['fantom'], 'fantom', factory, 3795376, true); - return balances -} module.exports = { fantom:{ - tvl, + tvl: uniTvlExport(factory, 'fantom', true), }, } \ No newline at end of file diff --git a/projects/SmarDex/index.js b/projects/SmarDex/index.js new file mode 100644 index 00000000000..e7b845dd073 --- /dev/null +++ b/projects/SmarDex/index.js @@ -0,0 +1,18 @@ +const { getUniTVL } = require("../helper/unknownTokens"); +const { stakings } = require("../helper/staking"); + +const config = { + ethereum: '0x7753F36E711B66a0350a753aba9F5651BAE76A1D', + bsc: '0xA8EF6FEa013034E62E2C4A9Ec1CDb059fE23Af33', + polygon: '0x9A1e1681f6D59Ca051776410465AfAda6384398f', + arbitrum: '0x41A00e3FbE7F479A99bA6822704d9c5dEB611F22', +} + +Object.keys(config).forEach(chain => { + const factory = config[chain] + module.exports[chain] = { + tvl: getUniTVL({ factory, fetchBalances: true, }) + } +}) + +module.exports.ethereum.staking = stakings(["0xB940D63c2deD1184BbdE059AcC7fEE93654F02bf", "0x80497049b005Fd236591c3CD431DBD6E06eB1A31",], "0x5de8ab7e27f6e7a1fff3e5b337584aa43961beef") \ No newline at end of file diff --git a/projects/Solily/index.js b/projects/Solily/index.js index 5ee2fd85442..d72e86d38b5 100644 --- a/projects/Solily/index.js +++ b/projects/Solily/index.js @@ -1,101 +1,12 @@ -const BigNumber = require('bignumber.js') -const { getConnection } = require('../helper/solana') -const { PublicKey } = require('@solana/web3.js') -const utils = require('../helper/utils') -const programInfoKey = new PublicKey('4GmnzdmugEG4EcwqV5PqEYNsEpXR7KHHFjdUR581383U') - -const stratTokens = [ - ['So11111111111111111111111111111111111111112', 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v'], // ray lp: sol-usdc - ['So11111111111111111111111111111111111111112', 'Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB'], // ray lp: sol-usdt - ['4k3Dyjzvzp8eMZWUXbBCjEvwSkkk59S5iCNLY3QrkX6R', 'So11111111111111111111111111111111111111112'], // ray lp: ray-sol - ['4k3Dyjzvzp8eMZWUXbBCjEvwSkkk59S5iCNLY3QrkX6R', 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v'], // ray lp: ray-usdc - ['Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB'], // larix USDT - ['So11111111111111111111111111111111111111112'], // larix SOL - ['mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So'], // larix mSOL - ['EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v'], // larix USDC - ['9n4nbM75f5Ui33ZbPYXn59EwSgE8CGsHtAeTH5YFeJ9E'], // larix btc - [''], - ['2FPyTwcZLUg1MDrwsyoP4D6s1tM7hAkHYRjkNb5w6Pxk'], // larix eth -] - -const tokenMaps = { - 'So11111111111111111111111111111111111111112': 'solana', - 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v': 'usd-coin', - 'Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB': 'tether', - '4k3Dyjzvzp8eMZWUXbBCjEvwSkkk59S5iCNLY3QrkX6R': 'raydium', - 'mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So': 'msol', - '9n4nbM75f5Ui33ZbPYXn59EwSgE8CGsHtAeTH5YFeJ9E': 'bitcoin', - '2FPyTwcZLUg1MDrwsyoP4D6s1tM7hAkHYRjkNb5w6Pxk': 'ethereum', -} - -var priceCache = new Map() -async function getTokenPrice(tokenPubkey) -{ - //console.log('getTokenPrice(' + tokenPubkey.toString() + ')') - - if (priceCache[tokenPubkey.toString()]) - return priceCache[tokenPubkey.toString()] - - var price = new BigNumber(1.0) - - const prefix = 'https://public-api.solscan.io/market/token/' - const url = prefix + tokenPubkey.toString() - - const res = await utils.fetchURL(url) - if (res && res.data && res.data.priceUsdt) { - price = new BigNumber(res.data.priceUsdt) - priceCache[tokenPubkey.toString()] = price - } - - return price -} -async function getSolPrice() -{ - let tokenPubkey = 'So11111111111111111111111111111111111111112' - var price = new BigNumber(80.0) - - const prefix = 'https://public-api.solscan.io/market/token/' - const url = prefix + tokenPubkey - - const res = await utils.fetchURL(url) - if (res && res.data && res.data.priceUsdt) - price = new BigNumber(res.data.priceUsdt) - - return price -} - -async function tvl() { - const stratInfo = await getConnection().getAccountInfo(programInfoKey) - - const buffer = stratInfo.data - let tvls = { } - - for (let i in stratTokens) { - if (i == 9) - continue - - const xu = buffer.readBigInt64LE(8 + i * 32) - const pu = new BigNumber(xu).div(1000) - - for (let token of stratTokens[i]) { - const u = pu.div(stratTokens[i].length) - const price = await getTokenPrice(new PublicKey(token)) - const amount = u.div(price) - if (tvls[tokenMaps[token]]) - tvls[tokenMaps[token]] = tvls[tokenMaps[token]].plus(amount) - else - tvls[tokenMaps[token]] = amount - } - } - - return tvls -} module.exports = { + hallmarks: [ + [1655251200, "Rug Pull"] + ], timetravel: false, solana: { - tvl, + tvl: () => 0, }, - methodology: 'TVL consists of staked tokens and ray-lps, saber-lps', + methodology: 'website unreachable, twitter deleted', } diff --git a/projects/SweetSwap/index.js b/projects/SweetSwap/index.js index de54f3f55da..db42172b92b 100644 --- a/projects/SweetSwap/index.js +++ b/projects/SweetSwap/index.js @@ -1,11 +1,8 @@ const { getUniTVL } = require('../helper/unknownTokens') -const chain = 'dogechain' - module.exports = { dogechain: { tvl: getUniTVL({ - chain, useDefaultCoreAssets: true, factory: '0xf1036CA4762cD601BDc630cd32942f90d19ED970', }), diff --git a/projects/TokenPocket/index.js b/projects/TokenPocket/index.js new file mode 100644 index 00000000000..97225d8b1d3 --- /dev/null +++ b/projects/TokenPocket/index.js @@ -0,0 +1,12 @@ +const axios = require("axios"); + +async function tvl() { + const tvlData = await axios.get("https://preserver.mytokenpocket.vip/v1/pledge/global") + return { ethereum: tvlData.data.data.data.staking_total} +} + +module.exports = { + ethereum: { + tvl, + }, +}; diff --git a/projects/Torr-Finance/index.js b/projects/Torr-Finance/index.js new file mode 100644 index 00000000000..82b8b08dd9f --- /dev/null +++ b/projects/Torr-Finance/index.js @@ -0,0 +1,5 @@ +const { uniTvlExport } = require("../helper/unknownTokens"); +const chain = "bittorrent"; +const factory = "0xea34610f4373c8d75ed1810A6096197F297F2786"; // v2 factory address + +module.exports = uniTvlExport(chain, factory); diff --git a/projects/TronNRG/index.js b/projects/TronNRG/index.js new file mode 100644 index 00000000000..37e34cc3c7e --- /dev/null +++ b/projects/TronNRG/index.js @@ -0,0 +1,28 @@ +const { + postURL +} = require('../helper/utils'); + +async function getCurrentStake() { + let postdata = { + "contract_address": "413346c747c65b7e53d79737dcf106c82cece27a92", + "owner_address": "417c97da66c8e3c48bbc6ed925fdd8596e50365925", + "function_selector": "readStaked()", + "parameter": "", + "call_value": 0 + }; + let result = await postURL('https://api.trongrid.io/wallet/triggerconstantcontract', postdata); + let trx = parseInt(result.data.constant_result[0], 16) / 10 ** 6; + return trx; +} + +async function tvl() { + return { + "tron": await getCurrentStake() + } +} + +module.exports = { + tron: { + tvl, + }, +} diff --git a/projects/VAX/index.js b/projects/VAX/index.js index b9da773ec16..fa6c232c3cb 100644 --- a/projects/VAX/index.js +++ b/projects/VAX/index.js @@ -4,7 +4,6 @@ module.exports = { misrepresentedTokens: true, multivac: { tvl: getUniTVL({ - chain: 'multivac', factory: '0xbaC576111e2BC5EfBbE7c5d765b9DC44083901fD', useDefaultCoreAssets: true, }) diff --git a/projects/Velocimeter/index.js b/projects/Velocimeter/index.js new file mode 100644 index 00000000000..acb9f6dfce6 --- /dev/null +++ b/projects/Velocimeter/index.js @@ -0,0 +1,18 @@ +const { getUniTVL } = require('../helper/unknownTokens') +const { staking } = require('../helper/staking') + +module.exports = { + misrepresentedTokens: true, + canto: { + tvl: getUniTVL({ + factory: '0xb12aF64E128A1D4489D13314eB4Df81cBCE126aC', + useDefaultCoreAssets: true, + hasStablePools: true, + }), + staking: staking( + '0x990efF367C6c4aece43c1E98099061c897730F27', + '0x2Baec546a92cA3469f71b7A091f7dF61e5569889', + 'canto' + ) + } +} diff --git a/projects/YieldPulseFinance/index.js b/projects/YieldPulseFinance/index.js new file mode 100644 index 00000000000..98946809a2f --- /dev/null +++ b/projects/YieldPulseFinance/index.js @@ -0,0 +1,10 @@ +const { masterchefExports } = require("../helper/unknownTokens"); + +module.exports = masterchefExports({ + chain: "pulse", + masterchef: "0xc9649cd27cFe8D74a47D711e04fEF3AbC4B56bae", + nativeTokens: ["0xDd40a166b43c0b95F1248c9A5AFFD7A166f1526a"], + useDefaultCoreAssets: true, + poolInfoABI: "function poolInfo(uint256) view returns (address)", + getToken: (i) => i, +}); diff --git a/projects/YogurtFinance/index.js b/projects/YogurtFinance/index.js new file mode 100644 index 00000000000..6f2b74dba30 --- /dev/null +++ b/projects/YogurtFinance/index.js @@ -0,0 +1,10 @@ +const { masterchefExports } = require("../helper/unknownTokens"); + +module.exports = masterchefExports({ + chain: "pulse", + masterchef: "0xca3E704Bd09B979170D76d34880c7A72fda51B63", + nativeTokens: ["0xece11C704F38FF38520667AeCDd7f53eA82F60F5"], + useDefaultCoreAssets: true, + poolInfoABI: "function poolInfo(uint256) view returns (address)", + getToken: (i) => i, +}); diff --git a/projects/Zolidly/index.js b/projects/Zolidly/index.js new file mode 100644 index 00000000000..ebb6c6a5586 --- /dev/null +++ b/projects/Zolidly/index.js @@ -0,0 +1,16 @@ +const { getUniTVL } = require('../helper/unknownTokens'); + +module.exports = { + misrepresentedTokens: true, + hallmarks: [ + [1684713600, "Rug Pull"] + ], + era: { + tvl: getUniTVL({ + factory: '0x6E1315819908Eaa036405f405c033cC2BfFBFc75', + useDefaultCoreAssets: true, + hasStablePools: true, + }) + }, + methodology: "Counts liquidity in pools", +}; \ No newline at end of file diff --git a/projects/ZukeSwap/index.js b/projects/ZukeSwap/index.js new file mode 100644 index 00000000000..6d16f07a583 --- /dev/null +++ b/projects/ZukeSwap/index.js @@ -0,0 +1,14 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports = { + hallmarks: [ + [1680307200, "Rug Pull"] + ], + misrepresentedTokens: true, + loop: { + tvl: getUniTVL({ + useDefaultCoreAssets: true, + factory: '0xc738bE6fE1A54d7B0F6e4C3262a46a002aC2508e', + }) + } +} \ No newline at end of file diff --git a/projects/aada/index.js b/projects/aada/index.js index b3e6bf24b17..49115ff554d 100644 --- a/projects/aada/index.js +++ b/projects/aada/index.js @@ -1,67 +1,20 @@ -const axios = require('axios'); -const { default: BigNumber } = require('bignumber.js'); -const { getAddressesUTXOs, getAssets, } = require("../helper/chain/cardano/blockfrost"); - -async function staking() { - const stakingContract = 'addr1wyvej5rmcrhfpcwrwmnqsjtwvf8gv3dn64vwy3xzekp95wqqhdkwa' - const aadaLocked = (await getAssets(stakingContract)).find(token => token.unit === "8fef2d34078659493ce161a6c7fba4b56afefa8535296a5743f6958741414441").quantity; - - return { - 'aada-finance': aadaLocked / 1e6, - } -} +const { sumTokensExport, } = require("../helper/chain/cardano"); const scriptAdresses = [ 'addr1zy9940grv28qxz9k82l9gmqd80vfd8a2734e35yzsz9cqktfjcnq9fczt4qkxgec2hz6x7f38vnj8xuxywk4x4qgzh9smq5w00', //request.hs -- Request created. Lender to fund 'addr1zykhtew0z93z6hmgu2ew7kl9puqz0wmafp0f3jypuejkwmrfjcnq9fczt4qkxgec2hz6x7f38vnj8xuxywk4x4qgzh9skq4p22', //collateral.hs -- Loan funded. Borrower to repay 'addr1zxfgvtfgp9476dhmq8fkm3x8wg20v33s6c9unyxmnpm0y5rfjcnq9fczt4qkxgec2hz6x7f38vnj8xuxywk4x4qgzh9st8q78h', //interest.hs -- Borrower repaid -- Lender to claim 'addr1zxcjtxuc7mj8w6v9l3dfxvm30kxf78nzw387mqjqvszxr4mfjcnq9fczt4qkxgec2hz6x7f38vnj8xuxywk4x4qgzh9sp92046', //liquidation.hs -- Funds were liquidated. Borrower to claim + 'addr1zytwe3qhc0kf5k8yaur60cnhcxjg9zvfdnftp0rfu2czprtfjcnq9fczt4qkxgec2hz6x7f38vnj8xuxywk4x4qgzh9sgzwepc', //debt_request.hs -- Funds locked as liquidity deposits 'addr1z8tjrqy2dj5uk6her4ksltyxy2flzykktxkahzlahm9nwctfjcnq9fczt4qkxgec2hz6x7f38vnj8xuxywk4x4qgzh9st86ewu', //request.hs v2 -- Funds locked as liquidity deposits + 'addr1zyc7w5n699ews00yujnhw59g4nuzykuzgl5x6nzqp49zv5tfjcnq9fczt4qkxgec2hz6x7f38vnj8xuxywk4x4qgzh9sdyxnxc', //collateral.hs v2-- Funds locked as liquidity deposits + 'addr1zy6v8c7xdhftln7zk5uvt9h6jaknaxlx6hz5nkw63mpgwamfjcnq9fczt4qkxgec2hz6x7f38vnj8xuxywk4x4qgzh9sw9snf6', //debt_request.hs v2-- Funds locked as liquidity deposits ]; -const tvl = async () => { - let tvlLocked = {}; - const tokenPairsUrl = 'https://api-mainnet-prod.minswap.org/coinmarketcap/v2/pairs'; - const res = await axios.get(tokenPairsUrl); - let pairs; - if (res.data) { - pairs = res.data; - } - - for (const scriptAddress of scriptAdresses) { - const utxos = await getAddressesUTXOs(scriptAddress); - utxos.map(utxo => utxo.amount) - .reduce((a, b) => a.concat(b), []) - .forEach(amount => { - const { unit, quantity } = amount; - if (!tvlLocked[unit]) { - tvlLocked[unit] = { - value: 0, - valueLovelace: 0, - }; - } - tvlLocked[unit].value = BigNumber.sum(quantity, tvlLocked[unit].value).toNumber(); - const pair = pairs[`${unit}_lovelace`]; - if (pair) { - if (!tvlLocked[unit].valueLovelace) { - tvlLocked[unit].valueLovelace = 0; - } - const valueLovelace = BigNumber.sum(new BigNumber(quantity).multipliedBy(pair.last_price), tvlLocked[unit].valueLovelace); - tvlLocked[unit].valueLovelace = valueLovelace.toNumber(); - } - }); - } - - const totalLovelaceLocked = Object.entries(tvlLocked).map(([id, values]) => id === 'lovelace' ? values.value : values.valueLovelace).reduce((a, b) => BigNumber.sum(a, b).toNumber(), 0); - console.log({ totalLovelaceLocked }); - const cardano = totalLovelaceLocked / 1e6; - return { cardano, }; -}; module.exports = { - misrepresentedTokens: true, methodology: 'Counts amount of AADA staked; by a price of ADA sitting in the orderbook.', timetravel: false, cardano: { - staking, - tvl + staking: sumTokensExport({ owner: 'addr1wyvej5rmcrhfpcwrwmnqsjtwvf8gv3dn64vwy3xzekp95wqqhdkwa' , tokens: ['8fef2d34078659493ce161a6c7fba4b56afefa8535296a5743f6958741414441']}), + tvl: sumTokensExport({ scripts: scriptAdresses, }) } }; diff --git a/projects/aave/index.js b/projects/aave/index.js index 14174051534..98f526686be 100644 --- a/projects/aave/index.js +++ b/projects/aave/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk'); const { getV2Reserves, getTvl, getBorrowed, aaveChainTvl } = require('../helper/aave'); const { staking } = require('../helper/staking'); @@ -28,10 +29,10 @@ function ethereum(borrowed) { } } -const aaveTokenAddress = "0x7Fc66500c84A76Ad7e9c93437bFc5Ac33E2DDaE9"; +const aaveTokenAddress = ADDRESSES.ethereum.AAVE; -async function stakingBalancerTvl(timestamp, block) { - return unwrapBalancerToken({ block, owner: '0xa1116930326d21fb917d5a27f1e9943a9595fb47', balancerToken: '0x41a08648c3766f9f9d85598ff102a08f4ef84f84' }) +async function stakingBalancerTvl(timestamp, block, _, { api }) { + return unwrapBalancerToken({ api, owner: '0xa1116930326d21fb917d5a27f1e9943a9595fb47', balancerToken: '0x41a08648c3766f9f9d85598ff102a08f4ef84f84', isV2: false, }) } const aaveStakingContract = "0x4da27a545c0c5b758a6ba100e3a049001de870f5"; @@ -57,5 +58,13 @@ module.exports = { }, avax: v2("avax", "0x4235E22d9C3f28DCDA82b58276cb6370B01265C2"), polygon: v2("polygon", "0x3ac4e9aa29940770aeC38fe853a4bbabb2dA9C19"), + hallmarks:[ + //[1618419730, "Start MATIC V2 Rewards"], + [1619470313, "Start Ethereum V2 Rewards"], + [1633377983, "Start AVAX V2 Rewards"], + [1635339600, "Potential xSUSHI attack found"], + [1651881600, "UST depeg"], + [1654822801, "stETH depeg"], + ], }; -// node test.js projects/aave/index.js \ No newline at end of file +// node test.js projects/aave/index.js diff --git a/projects/aave/v1.js b/projects/aave/v1.js index 00979d92b94..1c00170dccc 100644 --- a/projects/aave/v1.js +++ b/projects/aave/v1.js @@ -1,6 +1,8 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk'); const BigNumber = require("bignumber.js"); const abi = require('../helper/abis/aave.json'); +const { nullAddress } = require('../helper/unwrapLPs'); async function getV1Assets(lendingPoolCore, block, chain) { const reserves = ( @@ -56,7 +58,7 @@ async function depositMultiMarketV1Tvl(balances, lendingPoolCore, block, chain, return balances; } -function multiMarketV1Tvl(balances, lendingPoolCore, block, borrowed, chain="ethereum", eth = "0x0000000000000000000000000000000000000000") { +function multiMarketV1Tvl(balances, lendingPoolCore, block, borrowed, chain="ethereum", eth = ADDRESSES.null) { return (borrowed?multiMarketV1TvlBorrowed:depositMultiMarketV1Tvl)(balances, lendingPoolCore, block, chain, eth) } @@ -64,7 +66,7 @@ async function singleAssetV1Market(balances, lendingPoolCore, block, borrowed, c return multiMarketV1Tvl(balances, lendingPoolCore, block, borrowed, chain, eth); } -async function uniswapV1Market(balances, uniswapLendingPoolCore, block, borrowed, eth = "0x0000000000000000000000000000000000000000"){ +async function uniswapV1Market(balances, uniswapLendingPoolCore, block, borrowed, eth = ADDRESSES.null){ const uniswapMarketTvlBalances = {} await multiMarketV1Tvl( uniswapMarketTvlBalances, @@ -76,8 +78,9 @@ async function uniswapV1Market(balances, uniswapLendingPoolCore, block, borrowed const uniswapv1Calls = Object.keys(uniswapMarketTvlBalances).map(t => ({ target: t })); const [uniswapV1Tokens, uniswapV1EthBalance, uniswapV1Supplies] = await Promise.all([ sdk.api.abi.multiCall({ - abi: { "name": "tokenAddress", "outputs": [{ "type": "address", "name": "out" }], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 1413 }, + abi: "address:tokenAddress", calls: uniswapv1Calls, + permitFailure: true, block }), sdk.api.eth.getBalances({ @@ -87,6 +90,7 @@ async function uniswapV1Market(balances, uniswapLendingPoolCore, block, borrowed sdk.api.abi.multiCall({ abi: 'erc20:totalSupply', calls: uniswapv1Calls, + permitFailure: true, block }), ]) @@ -97,6 +101,7 @@ async function uniswapV1Market(balances, uniswapLendingPoolCore, block, borrowed target: t.output, params: t.input.target })), + permitFailure: true, block }) diff --git a/projects/aave/v3.js b/projects/aave/v3.js index 9c94ce2231f..ec94b29bcd0 100644 --- a/projects/aave/v3.js +++ b/projects/aave/v3.js @@ -2,22 +2,26 @@ const { aaveChainTvl } = require('../helper/aave'); const v3params = ["0x770ef9f4fe897e59daCc474EF11238303F9552b6", undefined, ["0x69FA688f1Dc47d4B5d8029D5a35FB7a548310654"]] -function v3(chain){ - const section = borrowed => aaveChainTvl(chain, ...v3params, borrowed, true); - return { - tvl: section(false), - borrowed: section(true) - } +function v3(chain) { + let params = v3params + if (chain === 'ethereum') + params = ['0xbaA999AC55EAce41CcAE355c77809e68Bb345170', undefined, ['0x7B4EB56E7CD4b454BA8ff71E4518426369a138a3']] + else if (chain === 'metis') + params = ['0x9E7B73ffD9D2026F3ff4212c29E209E09C8A91F5', undefined, ['0x99411FC17Ad1B56f49719E3850B2CDcc0f9bBFd8']] + const section = borrowed => aaveChainTvl(chain, ...params, borrowed, true); + return { + tvl: section(false), + borrowed: section(true) } - - module.exports = { - timetravel: true, - methodology: `Counts the tokens locked in the contracts to be used as collateral to borrow or to earn yield. Borrowed coins are not counted towards the TVL, so only the coins actually locked in the contracts are counted. There's multiple reasons behind this but one of the main ones is to avoid inflating the TVL through cycled lending`, - avax: v3("avax"), - ...["optimism", "fantom", "harmony", "arbitrum", "polygon"].reduce((t, c)=>({...t, [c]:v3(c)}), {}), - hallmarks:[ - [1659630089, "Start OP Rewards"], - [1650471689, "Start AVAX Rewards"] - ], - }; - // node test.js projects/aave/index.js \ No newline at end of file +} + +module.exports = { + methodology: `Counts the tokens locked in the contracts to be used as collateral to borrow or to earn yield. Borrowed coins are not counted towards the TVL, so only the coins actually locked in the contracts are counted. There's multiple reasons behind this but one of the main ones is to avoid inflating the TVL through cycled lending`, + avax: v3("avax"), + ...["optimism", "fantom", "harmony", "arbitrum", "polygon", "ethereum", "metis"].reduce((t, c) => ({ ...t, [c]: v3(c) }), {}), + hallmarks: [ + [1659630089, "Start OP Rewards"], + [1650471689, "Start AVAX Rewards"] + ], +}; +// node test.js projects/aave/index.js diff --git a/projects/aavegotchi/index.js b/projects/aavegotchi/index.js index a7eeb99a271..8b7b6879eaf 100644 --- a/projects/aavegotchi/index.js +++ b/projects/aavegotchi/index.js @@ -1,15 +1,15 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const { staking } = require("../helper/staking"); -const { pool2s } = require("../helper/pool2"); const { transformPolygonAddress } = require("../helper/portedTokens"); const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); const { request, gql } = require("graphql-request"); -const { getBlock } = require('../helper/getBlock') +const { getBlock } = require('../helper/http') const vaultContractETH = "0xFFE6280ae4E864D9aF836B562359FD828EcE8020"; const tokensETH = [ "0x3F382DbD960E3a9bbCeaE22651E88158d2791550", // GHST - "0x6b175474e89094c44da98b954eedeac495271d0f", // DAI + ADDRESSES.ethereum.DAI, // DAI ]; const vaultContractsPolygon = [ @@ -40,7 +40,7 @@ const ethTvl = async (timestamp, ethBlock, chainBlocks) => { }; -const graphUrl = 'https://api.thegraph.com/subgraphs/name/aavegotchi/aavegotchi-core-matic' +const graphUrl = 'https://subgraph.satsuma-prod.com/tWYl5n5y04oz/aavegotchi/aavegotchi-core-matic/api' const graphQuery = gql` query GET_SUMMONED_GOTCHIS ($minGotchiId: Int, $block: Int) { aavegotchis( @@ -90,7 +90,7 @@ async function getGotchisCollateral(timestamp, block) { const polygonTvl = async (_, _block, chainBlocks) => { const balances = {}; - const block = await getBlock(_, 'polygon', chainBlocks) + const block = await getBlock(_, 'polygon', chainBlocks) - 500 let transformAddress = await transformPolygonAddress(); diff --git a/projects/abc-pool/index.js b/projects/abc-pool/index.js new file mode 100644 index 00000000000..d6d00cd5f71 --- /dev/null +++ b/projects/abc-pool/index.js @@ -0,0 +1,57 @@ +const PoSPoolProxy1967_core = "cfx:type.contract:accpx9uxky39pg1hzav757vdej95w1kbcp13d0hvm7"; +const PoSPoolProxy1967_espace = "0xb6eb7aa86f3886b6edc0fc1c826221b1fb26e437"; +const core_rpc = "https://main.confluxrpc.com"; +const espace_rpc = "https://evm.confluxrpc.com"; + +const poolSummaryResponse = (rpc, method, contract, state) => { + return fetch(rpc, { + method: 'POST', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify({ + jsonrpc: '2.0', + method: method, + params: [{ + to: contract, + data: '0x7571fcf6' // poolSummary() in keccak256 + }, state], + id: 1 + }) + }) + .then(res => res.json()) + .then(res => res.result) +} + + +async function tvl(_, _1, _2, { api }) { + // this result has to be multiplied by 1000, + // as you can stake minimum 1000 tokens + const core_poolSummaryResponse = await poolSummaryResponse( + core_rpc, + 'cfx_call', + PoSPoolProxy1967_core, + 'latest_state' + ) + const espace_poolSummaryResponse = await poolSummaryResponse( + espace_rpc, + 'eth_call', + PoSPoolProxy1967_espace, + 'latest' + ) + // the result returns 3 values, we only need the first one + // every value is 32 bytes long, so we slice the first 32 bytes ("0x" + 64 characters) + const core_cfxTVL = parseInt(core_poolSummaryResponse.slice(2, 66), 16) + const espace_cfxTVL = parseInt(espace_poolSummaryResponse.slice(2, 66), 16) + + return { + 'conflux-token': (core_cfxTVL + espace_cfxTVL) * 1000 + } +} + +module.exports = { + methodology: 'Calls poolSummary() in the proxy contract. The result is multiplied by 1000, as you can stake minimum 1000 CFX.', + conflux: { + tvl + } +}; \ No newline at end of file diff --git a/projects/abelfinance/index.js b/projects/abelfinance/index.js new file mode 100644 index 00000000000..7e8c96a6c5b --- /dev/null +++ b/projects/abelfinance/index.js @@ -0,0 +1,50 @@ +const sdk = require("@defillama/sdk"); +const { getResources, } = require("../helper/chain/aptos"); +const { transformBalances } = require("../helper/portedTokens"); + +let resourcesCache + +async function _getResources() { + if (!resourcesCache) resourcesCache = getResources("0xc0188ad3f42e66b5bd3596e642b8f72749b67d84e6349ce325b27117a9406bdf") + return resourcesCache +} +const extractCoinAddress = (str) => str.slice(str.indexOf("<") + 1, str.lastIndexOf(">")); +const reserveContrainerFilter = (i) => i.type.includes("0xc0188ad3f42e66b5bd3596e642b8f72749b67d84e6349ce325b27117a9406bdf::acoin::ACoinInfo") + +module.exports = { + timetravel: false, + methodology: + "Counts the lamports in each coin container in the Aries contract account.", + aptos: { + tvl: async () => { + const balances = {}; + const data = await _getResources() + const coinContainers = data.filter(reserveContrainerFilter) + .map((i) => ({ + lamports: i.data.total_supply - i.data.total_borrows, + tokenAddress: extractCoinAddress(i.type), + })); + + coinContainers.forEach(({ lamports, tokenAddress }) => { + sdk.util.sumSingleBalance(balances, tokenAddress, lamports); + }); + + return transformBalances("aptos", balances); + }, + borrowed: async () => { + const balances = {}; + const data = await _getResources() + const coinContainers = data.filter(reserveContrainerFilter) + .map((i) => ({ + lamports: i.data.total_borrows, + tokenAddress: extractCoinAddress(i.type), + })); + + coinContainers.forEach(({ lamports, tokenAddress }) => { + sdk.util.sumSingleBalance(balances, tokenAddress, lamports); + }); + + return transformBalances("aptos", balances); + }, + }, +}; diff --git a/projects/aboard-exchange/index.js b/projects/aboard-exchange/index.js new file mode 100644 index 00000000000..21472aee317 --- /dev/null +++ b/projects/aboard-exchange/index.js @@ -0,0 +1,42 @@ +//20230428 initial release: simple and clear +//20230606 update: add chain: zkSync Era +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require('../helper/unwrapLPs'); + +//arbitrum +const ownerArbitrum = '0x7a08b29A7Ad4A19A5ECa0c82F5F082872488D135'; // contract address +const tokensArbitrum = [ + ADDRESSES.arbitrum.USDC, // USDC + ADDRESSES.null, // ETH + ADDRESSES.arbitrum.USDT, // USDT + ADDRESSES.arbitrum.WBTC, // WBTC +]; +//avalanche +const ownerAvalanche = '0xd8b0D18faE7eA29F2AD95d01FFb479E0021a9A5e'; // contract address +const tokensAvalanche = [ + ADDRESSES.avax.USDC, // USDC + ADDRESSES.null, // AVAX + ADDRESSES.avax.BTC_b, // BTC.b + ADDRESSES.avax.WETH_e, // WETH.e + ADDRESSES.avax.USDt, // USDt +]; +//zkSync Era +const ownerEra = '0xa1795B95C543428AFf866dA613e43895457bf1C1'; // contract address +const tokensEra = [ + ADDRESSES.era.USDC, // USDC + ADDRESSES.null, // ETH +]; + +module.exports = { + methodology: "TVL is equal to users' deposits minus withdrawals", + start: 1641625200, // Jan-08-2022 07:00:00 AM +UTC + arbitrum: { + tvl: sumTokensExport({ owner:ownerArbitrum, tokens:tokensArbitrum }) + }, + avax: { + tvl: sumTokensExport({ owner:ownerAvalanche, tokens:tokensAvalanche }) + }, + era: { + tvl: sumTokensExport({ owner:ownerEra, tokens:tokensEra }) + } +}; diff --git a/projects/abracadabra/abi.json b/projects/abracadabra/abi.json index 4ee9294c560..c6f7105d2f7 100644 --- a/projects/abracadabra/abi.json +++ b/projects/abracadabra/abi.json @@ -1,26 +1,3 @@ { - "balanceOf": { - "inputs": [ - { - "internalType": "contract IERC20", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } + "balanceOf": "function balanceOf(address, address) view returns (uint256)" } \ No newline at end of file diff --git a/projects/abracadabra/index.js b/projects/abracadabra/index.js index 5556dae8e53..a00d9754f50 100644 --- a/projects/abracadabra/index.js +++ b/projects/abracadabra/index.js @@ -1,10 +1,6 @@ const sdk = require('@defillama/sdk'); const marketsJSON = require('./market.json'); const abi = require('./abi.json'); -const { unwrapCrv, unwrapYearn } = require('../helper/unwrapLPs') -const { transformAvaxAddress, transformArbitrumAddress, transformFantomAddress - } = require("../helper/portedTokens"); -const { getBlock } = require('../helper/getBlock'); // -------------------------- // cvx3pool & yvcrvIB tokens @@ -12,33 +8,27 @@ const { getBlock } = require('../helper/getBlock'); // on eth (~$169M tvl) // -------------------------- const bentoBoxAddresses = { - "ethereum": "0xF5BCE5077908a1b7370B9ae04AdC565EBd643966", - "arbitrum": "0x74c764D41B77DBbb4fe771daB1939B00b146894A", - "avax": "0xf4F46382C2bE1603Dc817551Ff9A7b333Ed1D18f", - "fantom": "0xF5BCE5077908a1b7370B9ae04AdC565EBd643966" -}; -async function transformEthAddress() { - return (addr) => { - switch(addr.toLowerCase()) { - case '0xca76543cf381ebbb277be79574059e32108e3e65': - return '0x383518188c0c6d7730d91b2c03a03c837814a899'; - default: - return addr; - }; - }; + "ethereum": ["0xF5BCE5077908a1b7370B9ae04AdC565EBd643966", "0xd96f48665a1410C0cd669A88898ecA36B9Fc2cce"], + "arbitrum": ["0x74c764D41B77DBbb4fe771daB1939B00b146894A", "0x7c8fef8ea9b1fe46a7689bfb8149341c90431d38"], + "avax": ["0xf4F46382C2bE1603Dc817551Ff9A7b333Ed1D18f", "0x1fC83f75499b7620d53757f0b01E2ae626aAE530"], + "fantom": ["0xF5BCE5077908a1b7370B9ae04AdC565EBd643966", "0x74A0BcA2eeEdf8883cb91E37e9ff49430f20a616"], + "optimism": ["0xa93c81f564579381116ee3e007c9fcfd2eba1723"], }; async function ethTvl(timestamp, ethBlock, chainBlocks) { - return tvl(timestamp, chainBlocks, 'ethereum', (await transformEthAddress())); -}; + return tvl(timestamp, chainBlocks, 'ethereum', addr => 'ethereum:'+addr); +} async function ftmTvl(timestamp, ethBlock, chainBlocks) { - return tvl(timestamp, chainBlocks, 'fantom', (await transformFantomAddress())); -}; + return tvl(timestamp, chainBlocks, 'fantom', addr => 'fantom:'+addr); +} async function arbiTvl(timestamp, ethBlock, chainBlocks) { - return tvl(timestamp, chainBlocks, 'arbitrum', (await transformArbitrumAddress())); -}; + return tvl(timestamp, chainBlocks, 'arbitrum', addr => 'arbitrum:'+addr); +} async function avaxTvl(timestamp, ethBlock, chainBlocks) { - return tvl(timestamp, chainBlocks, 'avax', (await transformAvaxAddress())); -}; + return tvl(timestamp, chainBlocks, 'avax', addr => 'avax:'+addr); +} +async function opTvl(timestamp, ethBlock, chainBlocks) { + return tvl(timestamp, chainBlocks, 'optimism', addr => 'optimism:'+addr); +} async function tvl(timestamp, chainBlocks, chain, transformAddress=addr=>addr) { let marketsArray = []; let balances = {}; @@ -46,20 +36,16 @@ async function tvl(timestamp, chainBlocks, chain, transformAddress=addr=>addr) { for (const [marketContract, lockedToken] of Object.entries(marketsJSON[chain])) { marketsArray.push([lockedToken, marketContract]); - }; + } - if (chainBlocks[chain]) { - block = chainBlocks[chain]; - } else { - block = await getBlock(timestamp, chain, chainBlocks); - }; + block = chainBlocks[chain]; let tokenBalances = (await sdk.api.abi.multiCall({ block: block, - calls: marketsArray.map((market) => ({ - target: bentoBoxAddresses[chain], + calls: bentoBoxAddresses[chain].map(bentoBoxAddress=> marketsArray.map((market) => ({ + target: bentoBoxAddress, params: market - })), + }))).flat(), abi: abi.balanceOf, chain: chain })).output.map(t => t.output); @@ -70,17 +56,10 @@ async function tvl(timestamp, chainBlocks, chain, transformAddress=addr=>addr) { transformAddress(marketsArray[index][0]), tokenBalances[index] ); - await unwrapYearn(balances, marketsArray[index][0], block, chain, transformAddress); - }; - for (let [token, balance] of Object.entries(balances)) { - await unwrapCrv(balances, token, balance, block, chain, transformAddress); - }; - if ('0x383518188c0c6d7730d91b2c03a03c837814a899' in balances) { - balances['0x383518188c0c6d7730d91b2c03a03c837814a899'] = - balances['0x383518188c0c6d7730d91b2c03a03c837814a899'] / 10**9; - }; + } + return balances; -}; +} module.exports = { ethereum: { tvl: ethTvl @@ -94,4 +73,7 @@ module.exports = { fantom: { tvl: ftmTvl }, + optimism:{ + tvl: opTvl + } } \ No newline at end of file diff --git a/projects/abracadabra/market.json b/projects/abracadabra/market.json index d2a3db16c94..38291438f1d 100644 --- a/projects/abracadabra/market.json +++ b/projects/abracadabra/market.json @@ -1,28 +1,70 @@ { - "ethereum": { - "0x7b7473a76D6ae86CE19f7352A1E89F6C9dc39020":"0xdbdb4d16eda451d0503b854cf79d55697f90c8df", - "0x806e16ec797c69afa8590A55723CE4CC1b54050E":"0xd92494cb921e5c0d3a39ea88d0147bbd82e51008", - "0x05500e2Ee779329698DF35760bEdcAAC046e7C27":"0x4e15361fd6b4bb609fa63c81a2be19d873717870", - "0x003d5A75d284824Af736df51933be522DE9Eed0f":"0xca76543cf381ebbb277be79574059e32108e3e65", - "0x98a84EfF6e008c5ed0289655CcdCa899bcb6B99F":"0x8798249c2e607446efb7ad49ec89dd1865ff4272", - "0xEBfDe87310dc22404d918058FAa4D56DC4E93f0A":"0x27b7b1ad7288079a66d12350c828d3c00a6f07d7", - "0x0BCa8ebcB26502b013493Bf8fE53aA2B1ED401C1":"0xdcd90c7f6324cfa40d7169ef80b12031770b4325", - "0x6cbAFEE1FaB76cA5B5e144c43B3B50d42b7C8c8f":"0x5f18c75abdae578b483e5f43f12a39cf75b973a9", - "0x551a7CfF4de931F32893c928bBc3D25bF1Fc5147":"0x7da96a3891add058ada2e826306d812c638d87a7", - "0x920D9BD936Da4eAFb5E25c6bDC9f6CB528953F9f":"0xa258c4606ca8206d8aa700ce2143d7db854d168c", - "0xFFbF4892822e0d552CFF317F65e1eE7b5D3d9aE6":"0xe14d13d8b3b85af791b2aadd661cdbd5e6097db1", - - "0x6Ff9061bB8f97d948942cEF376d98b51fA38B91f":"0xa9fe4601811213c340e850ea305481aff02f5b28", - "0xbb02A884621FB8F5BFd263A67F58B65df5b090f3":"0x8798249c2e607446efb7ad49ec89dd1865ff4272" - }, - "fantom": { - "0x8E45Af6743422e488aFAcDad842cE75A09eaEd34": "0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83", - "0xd4357d43545F793101b592bACaB89943DC89d11b": "0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83" - }, - "avax": { - "0x3CFEd0439aB822530b1fFBd19536d897EF30D2a2": "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7" - }, - "arbitrum": { - "0xC89958B03A55B5de2221aCB25B58B89A000215E6": "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1" - } -} \ No newline at end of file + "avax": { + "0x35fA7A723B3B39f15623Ff1Eb26D8701E7D6bB21": "0x0da67235dD5787D67955420C84ca1cEcd4E5Bb3b", + "0x3b63f81Ad1fc724E44330b4cf5b5B6e355AD964B": "0x57319d41F71E81F3c65F2a47CA4e001EbAFd4F33", + "0x0a1e6a80E93e62Bd0D3D3BFcF4c362C40FB1cF3D": "0xeD8CBD9F0cE3C6986b22002F03c6475CEb7a6256", + "0x95cCe62C3eCD9A33090bBf8a9eAC50b699B54210": "0xA389f9430876455C36478DeEa9769B7Ca4E3DDB1", + "0x3cfed0439ab822530b1ffbd19536d897ef30d2a2": "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7", + "0xAcc6821d0F368b02d223158F8aDA4824dA9f28E3": "0xcBb424fd93cDeC0EF330d8A8C985E8b147F62339", + "0x2450Bf8e625e98e14884355205af6F97E3E68d07": "0x781655d802670bbA3c89aeBaaEa59D3182fD755D", + "0x56984F04d2d04B2F63403f0EbeDD3487716bA49d": "0x0da67235dD5787D67955420C84ca1cEcd4E5Bb3b" + }, + "bsc": { + "0x692CF15F80415D83E8c0e139cAbcDA67fcc12C90": "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c", + "0xF8049467F3A9D50176f4816b20cDdd9bB8a93319": "0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82" + }, + "ethereum": { + "0x53375adD9D2dFE19398eD65BAaEFfe622760A9A6": "0x5faF6a2D186448Dfa667c51CB3D695c7A6E52d8E", + "0x4EAeD76C3A388f4a841E9c765560BBe7B3E4B3A0": "0x5958A8DB7dfE0CC49382209069b00F54e17929C2", + "0x98a84eff6e008c5ed0289655ccdca899bcb6b99f": "0x8798249c2E607446EfB7Ad49eC89dD1865Ff4272", + "0x9617b633EF905860D919b88E1d9d9a6191795341": "0x50D1c9771902476076eCFc8B2A83Ad6b9355a4c9", + "0x257101F20cB7243E2c7129773eD5dBBcef8B34E0": "0x3Ba207c25A278524e1cC7FaAea950753049072A4", + "0x207763511da879a900973A5E092382117C3c1588": "0xD533a949740bb3306d119CC777fa900bA034cd52", + "0x1062eB452f8C7A94276437ec1F4aAca9b1495B72": "0x38EA452219524Bb87e18dE1C24D3bB59510BD783", + "0x003d5a75d284824af736df51933be522de9eed0f": "0xCa76543Cf381ebBB277bE79574059e32108e3E65", + "0x7259e152103756e1616A77Ae982353c3751A6a90": "0x8078198Fc424986ae89Ce4a910Fc109587b6aBF3", + "0xc1879bf24917ebE531FbAA20b0D05Da027B592ce": "0x32353A6C91143bfd6C7d363B546e62a9A2489A20", + "0x252dCf1B621Cc53bc22C256255d2bE5C8c32EaE4": "0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE", + "0x05500e2ee779329698df35760bedcaac046e7c27": "0x4E15361FD6b4BB609Fa63C81A2be19d873717870", + "0x35a0Dd182E4bCa59d5931eae13D0A2332fA30321": "0xB65eDE134521F0EFD4E943c835F450137dC6E83e", + "0x0bca8ebcb26502b013493bf8fe53aa2b1ed401c1": "0xdCD90C7f6324cfa40d7169ef80b12031770B4325", + "0x390Db10e65b5ab920C19149C919D970ad9d18A41": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + "0x7Ce7D9ED62B9A6c5aCe1c6Ec9aeb115FA3064757": "0xdA816459F1AB5631232FE5e97a05BBBb94970c95", + "0xebfde87310dc22404d918058faa4d56dc4e93f0a": "0x27b7b1ad7288079A66d12350c828D3C00A6F07d7", + "0x6Ff9061bB8f97d948942cEF376d98b51fA38B91f": "0xa9fE4601811213c340e850ea305481afF02f5b28", + "0xFFbF4892822e0d552CFF317F65e1eE7b5D3d9aE6": "0xE14d13d8B3b85aF791b2AADD661cDBd5E6097Db1", + "0xbc36FdE44A7FD8f545d459452EF9539d7A14dd63": "0xa47c8bf37f92aBed4A126BDA807A7b7498661acD", + "0x8227965A7f42956549aFaEc319F4E444aa438Df5": "0x5f98805A4E8be255a32880FDeC7F6728C6568bA0", + "0x551a7CfF4de931F32893c928bBc3D25bF1Fc5147": "0x7Da96a3891Add058AdA2E826306D812C638D87a7", + "0xbb02A884621FB8F5BFd263A67F58B65df5b090f3": "0x8798249c2E607446EfB7Ad49eC89dD1865Ff4272", + "0x920d9bd936da4eafb5e25c6bdc9f6cb528953f9f": "0xa258C4606Ca8206D8aA700cE2143D7db854D168c", + "0x6371EfE5CD6e3d2d7C477935b7669401143b7985": "0xd92494CB921E5C0d3A39eA88d0147bbd82E51008", + "0x7b7473a76d6ae86ce19f7352a1e89f6c9dc39020": "0xdBdb4d16EdA451D0503b854CF79D55697F90c8DF", + "0xc6B2b3fE7c3D7a6f823D9106E22e66660709001e": "0x38EA452219524Bb87e18dE1C24D3bB59510BD783", + "0xd31E19A0574dBF09310c3B06f3416661B4Dc7324": "0xdf0770dF86a8034b3EFEf0A1Bb3c889B8332FF56", + "0xCfc571f3203756319c231d3Bc643Cee807E74636": "0x090185f2135308BaD17527004364eBcC2D37e5F6", + "0xc319eea1e792577c319723b5e60a15da3857e7da": "0x26FA3fFFB6EfE8c1E69103aCb4044C26B9A106a9", + "0xf179fe36a36B32a4644587B8cdee7A23af98ed37": "0x1635b506a88fBF428465Ad65d00e8d6B6E5846C3", + "0x5ec47EE69BEde0b6C2A2fC0D9d094dF16C192498": "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", + "0x59E9082E068Ddb27FC5eF1690F9a9f22B32e573f": "0xa47c8bf37f92aBed4A126BDA807A7b7498661acD", + "0x806e16ec797c69afa8590a55723ce4cc1b54050e": "0xd92494CB921E5C0d3A39eA88d0147bbd82E51008", + "0x3410297D89dCDAf4072B805EFc1ef701Bb3dd9BF": "0x26FA3fFFB6EfE8c1E69103aCb4044C26B9A106a9", + "0x6cbAFEE1FaB76cA5B5e144c43B3B50d42b7C8c8f": "0x5f18C75AbDAe578b483E5F43f12a39cF75b973a9" + }, + "fantom": { + "0xed745b045f9495b8bfc7b58eea8e0d0597884e12": "0x0DEC85e74A92c52b7F708c4B10207D9560CEFaf0", + "0xd4357d43545F793101b592bACaB89943DC89d11b": "0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83", + "0x4fdfFa59bf8dda3F4d5b38F260EAb8BFaC6d7bC1": "0x6f86e65b255c9111109d2D2325ca2dFc82456efc", + "0xa3Fc1B4b7f06c2391f7AD7D4795C1cD28A59917e": "0xa48d959AE2E88f1dAA7D5F611E01908106dE7598", + "0x8E45Af6743422e488aFAcDad842cE75A09eaEd34": "0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83", + "0x7208d9F9398D7b02C5C22c334c2a7A3A98c0A45d": "0xB32b31DfAfbD53E310390F641C7119b5B9Ea0488" + }, + "arbitrum": { + "0x5698135CA439f21a57bDdbe8b582C62f090406D5": "0x3477Df28ce70Cecf61fFfa7a95be4BEC3B3c7e75", + "0x726413d7402fF180609d0EBc79506df8633701B1": "0x85667409a723684Fe1e57Dd1ABDe8D88C2f54214", + "0xC89958B03A55B5de2221aCB25B58B89A000215E6": "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1" + }, + "optimism": { + "0x68f498C230015254AFF0E1EB6F85Da558dFf2362": "0x6eb1709e0b562097bf1cc48bc6a378446c297c04" + } +} diff --git a/projects/acala-lending/index.js b/projects/acala-lending/index.js index 6e94b8c3030..5be675453ce 100644 --- a/projects/acala-lending/index.js +++ b/projects/acala-lending/index.js @@ -1,6 +1,10 @@ const {getExports} = require('../helper/heroku-api') module.exports = { + hallmarks: [ + [1660521600, "aUSD exploit"] + ], timetravel: false, + misrepresentedTokens: true, ...getExports("acala-lending", ['acala']) } \ No newline at end of file diff --git a/projects/acoconut/abis/singlePlus.json b/projects/acoconut/abis/singlePlus.json index 9ae0c403dbc..7936ebcea10 100644 --- a/projects/acoconut/abis/singlePlus.json +++ b/projects/acoconut/abis/singlePlus.json @@ -1,28 +1,4 @@ { - "totalUnderlying": { - "inputs": [], - "name": "totalUnderlying", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "token": { - "inputs": [], - "name": "token", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } -} + "totalUnderlying": "uint256:totalUnderlying", + "token": "address:token" +} \ No newline at end of file diff --git a/projects/acoconut/index.js b/projects/acoconut/index.js index 0e8584094ee..65fdc8aeac7 100644 --- a/projects/acoconut/index.js +++ b/projects/acoconut/index.js @@ -1,9 +1,10 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk'); const singlePlusAbi = require('./abis/singlePlus'); const { sumTokens2 } = require('../helper/unwrapLPs') const tokensInacBTC = [ - '0x2260fac5e5542a773aa44fbcfedf7c193bc2c599', + ADDRESSES.ethereum.WBTC, '0xEB4C2781e4ebA804CE9a9803C67d0893436bB27D' ] @@ -16,7 +17,7 @@ const bscSingleTokens = [ '0x02827D495B2bBe37e1C021eB91BCdCc92cD3b604', //autoBTC+ ] -const btcb = 'bsc:0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c' +const btcb = 'bsc:' + ADDRESSES.bsc.BTCB async function eth(timestamp, block) { return sumTokens2({ block, owner: acBTCTokenHolder, tokens: tokensInacBTC}) diff --git a/projects/across/abi.json b/projects/across/abi.json index 03f631a4303..0b2a10a0db2 100644 --- a/projects/across/abi.json +++ b/projects/across/abi.json @@ -1,59 +1,4 @@ { - "l1Token": { - "inputs": [], - "name": "l1Token", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "pooledTokens": { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "pooledTokens", - "outputs": [ - { - "internalType": "address", - "name": "lpToken", - "type": "address" - }, - { - "internalType": "bool", - "name": "isEnabled", - "type": "bool" - }, - { - "internalType": "uint32", - "name": "lastLpFeeUpdate", - "type": "uint32" - }, - { - "internalType": "int256", - "name": "utilizedReserves", - "type": "int256" - }, - { - "internalType": "uint256", - "name": "liquidReserves", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "undistributedLpFees", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } + "l1Token": "address:l1Token", + "pooledTokens": "function pooledTokens(address) view returns (address lpToken, bool isEnabled, uint32 lastLpFeeUpdate, int256 utilizedReserves, uint256 liquidReserves, uint256 undistributedLpFees)" } \ No newline at end of file diff --git a/projects/across/index.js b/projects/across/index.js index 21d43631e02..0544de93ad0 100644 --- a/projects/across/index.js +++ b/projects/across/index.js @@ -1,30 +1,31 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); -const ethers = require("ethers"); +const { getLogs } = require('../helper/cache/getLogs') + const hubPoolAddress = "0xc186fA914353c44b2E33eBE05f21846F1048bEda" let pools = [ // bridge pools - ["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", "0x256c8919ce1ab0e33974cf6aa9c71561ef3017b6"], - ["0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", "0x7355efc63ae731f584380a9838292c7046c1e433"], + [ADDRESSES.ethereum.USDC, "0x256c8919ce1ab0e33974cf6aa9c71561ef3017b6"], + [ADDRESSES.ethereum.WETH, "0x7355efc63ae731f584380a9838292c7046c1e433"], ["0x04Fa0d235C4abf4BcF4787aF4CF447DE572eF828", "0xdfe0ec39291e3b60aca122908f86809c9ee64e90"], ["0x3472A5A71965499acd81997a54BBA8D852C6E53d", "0x43298f9f91a4545df64748e78a2c777c580573d6"], - ["0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", "0x02fbb64517e1c6ed69a6faa3abf37db0482f1152"], + [ADDRESSES.ethereum.WBTC, "0x02fbb64517e1c6ed69a6faa3abf37db0482f1152"], ["0x42bBFa2e77757C645eeaAd1655E0911a7553Efbc", "0x4841572daa1f8e4ce0f62570877c2d0cc18c9535"], - ["0x6B175474E89094C44Da98b954EedeAC495271d0F", "0x43f133fe6fdfa17c417695c476447dc2a449ba5b"], + [ADDRESSES.ethereum.DAI, "0x43f133fe6fdfa17c417695c476447dc2a449ba5b"], ] -async function tvl(_, block) { - const v2Logs = await sdk.api.util.getLogs({ +async function tvl(_, block, _1, { api }) { + const v2Logs = await getLogs({ + api, target: hubPoolAddress, topic: "L1TokenEnabledForLiquidityProvision(address,address)", - keys: [], fromBlock: 14819537, - toBlock: block, + eventAbi: 'event L1TokenEnabledForLiquidityProvision (address l1Token, address lpToken)', }); - let iface = new ethers.utils.Interface(['event L1TokenEnabledForLiquidityProvision (address l1Token, address lpToken)']) pools = pools.map(i => i.map(j => j.toLowerCase())) - v2Logs.output.map((log) => iface.parseLog(log).args).forEach(i => { + v2Logs.map((log) => log.args).forEach(i => { const pool = i[1].toLowerCase() if (pools.some(i => i[1] === pool)) return; pools.push([i[0], pool]) diff --git a/projects/acryptos/index.js b/projects/acryptos/index.js index 144133e5928..12c7c9d576e 100644 --- a/projects/acryptos/index.js +++ b/projects/acryptos/index.js @@ -37,6 +37,9 @@ module.exports = { xdai: { tvl: fetchallchain(100), }, + polygon: { + tvl: fetchallchain(137), + }, fantom: { tvl: fetchallchain(250), }, @@ -49,6 +52,12 @@ module.exports = { moonriver: { tvl: fetchallchain(1285), }, + kava: { + tvl: fetchallchain(2222), + }, + canto: { + tvl: fetchallchain(7700), + }, arbitrum:{ tvl: fetchallchain(42161), }, diff --git a/projects/acumen/index.js b/projects/acumen/index.js index 0f65a7103eb..ff69b2394e6 100644 --- a/projects/acumen/index.js +++ b/projects/acumen/index.js @@ -1,29 +1,8 @@ -const { sumTokens2 } = require('../helper/solana') - -async function tvl() { - const owner = '5nDMa98okBQRNyQrtei1YBMCSFd1Nrkb9FZxf39g8aEW' - const tokens = [ - "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",//usdc - "9n4nbM75f5Ui33ZbPYXn59EwSgE8CGsHtAeTH5YFeJ9E",//btc - "SRMuApVNdxXokk5GT7XD5cUUgXMBCoAz2LHeuAoKWRt",//srm - "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB", //added//usdt - "2FPyTwcZLUg1MDrwsyoP4D6s1tM7hAkHYRjkNb5w6Pxk",//eth - "4k3Dyjzvzp8eMZWUXbBCjEvwSkkk59S5iCNLY3QrkX6R",//ray - "StepAscQoEioFxxWGnh2sLBDFp9d8rvKz2Yp39iDpyT",//step - "xStpgUCss9piqeFUk2iLVcvJEGhAdJxJQuwLkXP555G", //added = 0//xstep - "So11111111111111111111111111111111111111112",//sol - "DLukwcEV1bhGxzkZmQMNXtTjr1Mre42VvjQYiFjeRAsc", //changed for tulipa = 0//sbrm - "Saber2gLauYim4Mvftnrasomsv6NvAuncvMEZwcLpD1",//sbr - "7QbiocpcnMs5qTXsvUDQ4HJ2yZwFC1DA4f2d2w9Bj52L", //added = 0//sbrusd - "3reHdP6RnTvv5cqp7bXDm7ah2Q3t4mfJh8Ekj3EVNWkB", //added = 0//sbrust - "MERt85fc5boKw3BW1eYdxonEuJNvXbiMbs6hvheau5K",//mer - ] - - return sumTokens2({ owner, tokens, }) -} - module.exports = { timetravel: false, - solana: { tvl }, - methodology: `To obtain the Acumen TVL we make on-chain calls using the function getTokenBalance() that uses the address of the token and the address of the contract where the token is located. The addresses used are the pool address where the corresponding tokens were deposited as collateral to borrow and or earn, borrowed tokens are not counted and these addresses are hard-coded. These calls return the number of tokens held in each pool contract. We then use Coingecko to get the price of each token in USD to export the sum of all tokens.`, + solana: { tvl: () => ({}) }, + hallmarks: [ + [Math.floor(new Date('2022-12-12')/1e3), 'Product is deprecated'], + ], + methodology: `Product is deprecated. More information: https://acumenofficial.medium.com/acumen-stable-dapp-update-7e96333e9318`, } \ No newline at end of file diff --git a/projects/ad-astra/index.js b/projects/ad-astra/index.js new file mode 100644 index 00000000000..5eb4b8e040f --- /dev/null +++ b/projects/ad-astra/index.js @@ -0,0 +1,11 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require('../helper/sumTokens') + +module.exports={ + ethereum:{ + tvl: sumTokensExport({ + owner: '0x92a26975433a61cf1134802586aa669bab8b69f3', + tokens: [ADDRESSES.ethereum.USDC, ADDRESSES.ethereum.USDT, ADDRESSES.ethereum.BUSD, '0xdc9Ac3C20D1ed0B540dF9b1feDC10039Df13F99c', ], + }) + } +} \ No newline at end of file diff --git a/projects/adamantfinance/abi.json b/projects/adamantfinance/abi.json index 9165f1369c5..dea346007a6 100644 --- a/projects/adamantfinance/abi.json +++ b/projects/adamantfinance/abi.json @@ -1,112 +1,10 @@ { - "balance": { - "inputs": [], - "name": "balance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "balanceOfVault": { - "inputs": [], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "balanceOf": { - "stateMutability": "view", - "type": "function", - "name": "balanceOf", - "inputs": [ - { - "name": "arg0", - "type": "address" - } - ], - "outputs": [ - { - "name": "", - "type": "uint256" - } - ] - }, - "minter": { - "stateMutability": "view", - "type": "function", - "name": "minter", - "inputs": [], - "outputs": [ - { - "name": "", - "type": "address" - } - ] - }, - "totalSupply": { - "stateMutability": "view", - "type": "function", - "name": "totalSupply", - "inputs": [], - "outputs": [ - { - "name": "", - "type": "uint256" - } - ] - }, - "coins": { - "stateMutability": "view", - "type": "function", - "name": "coins", - "inputs": [ - { - "name": "arg0", - "type": "uint256" - } - ], - "outputs": [ - { - "name": "", - "type": "address" - } - ] - }, - "lp_token": { - "stateMutability":"view", - "type":"function", - "name":"lp_token", - "inputs":[], - "outputs":[ - { - "name":"", - "type":"address" - } - ] - }, - "decimals": { - "constant": true, - "inputs": [], - "name": "decimals", - "outputs": [ - { - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } -} + "balance": "uint256:balance", + "balanceOfVault": "uint256:balanceOf", + "balanceOf": "function balanceOf(address arg0) view returns (uint256)", + "minter": "address:minter", + "totalSupply": "uint256:totalSupply", + "coins": "function coins(uint256 arg0) view returns (address)", + "lp_token": "address:lp_token", + "decimals": "uint8:decimals" +} \ No newline at end of file diff --git a/projects/adamantfinance/index.js b/projects/adamantfinance/index.js index b8c04234ed6..20226bf6248 100644 --- a/projects/adamantfinance/index.js +++ b/projects/adamantfinance/index.js @@ -1,15 +1,15 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); -const utils = require("../helper/utils"); const { stakings } = require("../helper/staking"); -const { unwrapUniswapLPs, sumTokens, unwrapLPsAuto, } = require("../helper/unwrapLPs"); +const { getConfig } = require('../helper/cache') +const { unwrapUniswapLPs, unwrapLPsAuto, } = require("../helper/unwrapLPs"); const { transformPolygonAddress, getChainTransform, getFixBalances, } = require("../helper/portedTokens"); -const BigNumber = require("bignumber.js"); -const { staking: stakingUnknown, sumTokensExport, } = require("../helper/unknownTokens"); +const { staking: stakingUnknown, } = require("../helper/unknownTokens"); const vaultsUrl = { polygon: @@ -39,7 +39,7 @@ const stakingContracts_Arbitrum = [ ]; const lpAddresses_arbitrum = []; -const ARBY = "0x09ad12552ec45f82bE90B38dFE7b06332A680864" +const ARBY = ADDRESSES.arbitrum.ARBY /*** Cronos Addresses ***/ const stakingContracts_cronos = [ @@ -47,7 +47,7 @@ const stakingContracts_cronos = [ "0xD4bcCf04a7CA546D3cfC46205AA7C58EB98c7495", "0x323663B759567BAf744C182634585F7164c3c442", ]; -const CADDY = "0x09ad12552ec45f82be90b38dfe7b06332a680864"; +const CADDY = ADDRESSES.arbitrum.ARBY; const vaultAddresses_cronos = [ "0x3a9645ee664DCE6529Af678aaB4fE3AD9d68323f", @@ -123,225 +123,6 @@ async function cronosTvl(timestamp, block, chainBlocks) { return await tvl(timestamp, "cronos", chainBlocks, lpAddresses_cronos); } -async function valueInGauge(chain, block, GAUGE, HOLDER, transformAddress = (a) => a) { - // lp token - let lp_token = ( - await sdk.api.abi.call({ - chain: chain, block: block, target: GAUGE, abi: abi.lp_token, - }) - ).output; - - // balance of lp token - const gauge_lp_balance = new BigNumber( - (await sdk.api.abi.call({ chain: chain, block: block, target: lp_token, abi: abi.balanceOf, params: GAUGE, }) - ).output - ); - - // total supply of lp token - const lp_total_supply = new BigNumber( - (await sdk.api.abi.call({ chain: chain, block: block, target: lp_token, abi: abi.totalSupply, }) - ).output - ); - - // balance of gauge - const holder_gauge_balance = new BigNumber( - (await sdk.api.abi.call({ chain: chain, block: block, target: GAUGE, abi: abi.balanceOf, params: HOLDER, }) - ).output - ); - - // total supply of gauge - const gauge_total_supply = new BigNumber( - (await sdk.api.abi.call({ chain: chain, block: block, target: GAUGE, abi: abi.totalSupply, }) - ).output - ); - - // calc the portion of curve lp locked in the strategy - let poolCoins = await crvPoolTvl(chain, block, lp_token, transformAddress); - for (const coinQty in poolCoins) { - poolCoins[coinQty] = new BigNumber(poolCoins[coinQty]).times(gauge_lp_balance).dividedBy(lp_total_supply).times(holder_gauge_balance).dividedBy(gauge_total_supply).toFixed(0); - } - - return poolCoins; -} - -async function crvPoolTvl(chain, block, COIN_TARGET, transformAddress = (a) => a, SUPPLY_TARGET = COIN_TARGET) { - const balances = {}; - const maincoins = []; - - // find coins in curve pool - for (var c = 0; c < 10; c++) { - try { - var coinX = await sdk.api.abi.call({ - chain: chain, - block: block, - target: COIN_TARGET, - abi: abi.coins, - params: c, - }); - maincoins.push(coinX.output); - } catch (error) { - break; - } - } - - // find balances of coins - const underlying_balances = ( - await sdk.api.abi.multiCall({ - chain: chain, - block: block, - calls: maincoins.map((coin) => ({ - target: coin, - params: SUPPLY_TARGET, - })), - abi: abi.balanceOf, - }) - ).output.map((val) => new BigNumber(val.output)); - - // add up total pool tvl - for (let j = 0; j < maincoins.length; j++) { - sdk.util.sumSingleBalance(balances, transformAddress(maincoins[j]), underlying_balances[j].toFixed(0)); - } - - return balances; -} - -async function curveTvl(balances, chain, block, curveVaults, transformAddress = (a) => a) { - let crv3Address; - - if (chain == "arbitrum") { - crv3Address = "0x7f90122BF0700F9E7e1F688fe926940E8839F353"; - } else if (chain == "polygon") { - // this is actually 2crv not 3crv - crv3Address = "0xE7a24EF0C5e95Ffb0f6684b813A78F2a3AD7D171"; - } - - let strat_balances = ( - await sdk.api.abi.multiCall({ - chain: chain, - block: block, - calls: curveVaults.map((vault) => ({ - target: vault.strategyAddress, - })), - abi: abi.balanceOfVault, - }) - ).output.map((val) => new BigNumber(val.output)); - - let strat_minters = ( - await sdk.api.abi.multiCall({ - chain: chain, - block: block, - calls: curveVaults.map((vault) => ({ - target: vault.lpAddress, - })), - abi: abi.minter, - }) - ).output.map((val) => val.output); - - const strat_supplies = ( - await sdk.api.abi.multiCall({ - chain: chain, - block: block, - calls: curveVaults.map((vault) => ({ - target: vault.lpAddress, - })), - abi: abi.totalSupply, - }) - ).output.map((val) => new BigNumber(val.output)); - - for (var i = 0; i < curveVaults.length; i++) { - const maincoins = []; - - // if it hasn't got a minter, the balance is probably in the token contract - if (!strat_minters[i]) { - strat_minters[i] = curveVaults[i].lpAddress; - } - - for (var c = 0; c < 10; c++) { - try { - var coinX = await sdk.api.abi.call({ - chain: chain, - block: block, - target: strat_minters[i], - abi: abi.coins, - params: c, - }); - if (coinX.output === "0x7f90122BF0700F9E7e1F688fe926940E8839F353") { - coinX.output = "0xbF7E49483881C76487b0989CD7d9A8239B20CA41"; // gauge - } - maincoins.push(coinX.output); - } catch { - break; - } - } - - if (maincoins.length == 0) { - continue; - } - - const underlying_balances = ( - await sdk.api.abi.multiCall({ - chain: chain, - block: block, - calls: maincoins.map((coin) => ({ - target: coin, - params: strat_minters[i], - })), - abi: abi.balanceOf, - }) - ).output.map((val) => - new BigNumber(val.output) - // only want the portion locked in adamant - .times(strat_balances[i]) - .dividedBy(strat_supplies[i]) - ); - - for (let j = 0; j < maincoins.length; j++) { - sdk.util.sumSingleBalance( - balances, - await transformAddress(maincoins[j]), - underlying_balances[j].toFixed(0) - ); - } - - if (i == curveVaults.length - 1) { - if (chain == "arbitrum") { - // I know that this guaged pool wont add up properly, so do it manually - /* - balances = join(balances, await - valueInGauge(chain, block, "0xbf7e49483881c76487b0989cd7d9a8239b20ca41", - "0x30dF229cefa463e991e29D42DB0bae2e122B2AC7", transformAddress)); - */ - } - - // lastly, break down any 3crv / 2crv - // if (`${chain}:${crv3Address}` in balances) { - //strat_balances.push(new BigNumber(balances[`${chain}:${crv3Address}`])); - // } else { - //return balances; - // } - } - } - - const crv2 = "arbitrum:0xbF7E49483881C76487b0989CD7d9A8239B20CA41"; - sdk.util.sumSingleBalance( - balances, - "0x6b175474e89094c44da98b954eedeac495271d0f", - balances[crv2] ?? "0" - ); - delete balances[crv2]; - // something wrong with decimals - /* - if (chain == 'arbitrum') { - balances['0xdAC17F958D2ee523a2206206994597C13D831ec7'] = - (balances['0xdAC17F958D2ee523a2206206994597C13D831ec7'] / 10**12).toFixed(0); - balances['0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48'] = - (balances['0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48'] / 10**12).toFixed(0); - } - */ - - return balances; -} - async function uniTvl(balances, chain, block, uniVaults, lpAddressesIgnored, transformAddress = (a) => a) { const vault_balances = ( await sdk.api.abi.multiCall({ @@ -354,15 +135,12 @@ async function uniTvl(balances, chain, block, uniVaults, lpAddressesIgnored, tra }) ).output.map((val) => val.output); - const lpPositions = []; - uniVaults.forEach((v, idx) => { if ( - lpAddressesIgnored.some( + !lpAddressesIgnored.some( (addr) => addr.toLowerCase() === v.lpAddress.toLowerCase() ) ) { - } else { sdk.util.sumSingleBalance(balances, chain + ':' + v.lpAddress, vault_balances[idx]) } }); @@ -372,29 +150,19 @@ async function uniTvl(balances, chain, block, uniVaults, lpAddressesIgnored, tra } const tvl = async (timestamp, chain, chainBlocks, lpAddressesIgnored) => { + const block = chainBlocks[chain]; const transformAddress = await getChainTransform(chain) const fixBalances = await getFixBalances(chain) let balances = {}; - let resp = await utils.fetchURL(vaultsUrl[chain]); - - let curveVaults = resp.data - .filter((vault) => vault.platform.toLowerCase() == "curve" || vault.poolName.toLowerCase() === 'mai-3crv') - .map((vault) => ({ - vaultAddress: vault.vaultAddress, - lpAddress: vault.lpAddress, - strategyAddress: vault.strategyAddress, - })); - balances = await curveTvl(balances, chain, block, curveVaults, transformAddress); + let resp = await getConfig('adamant-fi/'+chain, vaultsUrl[chain]); - let uniVaults = resp.data + let uniVaults = resp .filter( (vault) => - vault.token0 !== vault.token1 && - vault.vaultAddress !== "" && - vault.platform !== "dodo" && - vault.poolName.toLowerCase() !== 'mai-3crv' + vault.vaultAddress !== '0x459dc0fB79653A48469F2C3c375d0A522750Dd40' && + vault.platform !== "dodo" ) .map((vault) => ({ vaultAddress: vault.vaultAddress, @@ -418,8 +186,6 @@ module.exports = { }, cronos: { staking: stakingUnknown({ owners: stakingContracts_cronos, tokens: [CADDY], chain: 'cronos', lps: lpAddresses_cronos, useDefaultCoreAssets: true }), - // pool2 appears empty - // pool2: sumTokensExport({ owners: vaultAddresses_cronos, tokens: lpAddresses_cronos, chain: 'cronos', useDefaultCoreAssets: true }), tvl: cronosTvl, }, methodology: diff --git a/projects/adao/abi.json b/projects/adao/abi.json deleted file mode 100644 index 470fd135c83..00000000000 --- a/projects/adao/abi.json +++ /dev/null @@ -1,17 +0,0 @@ -[ - { - "constant": true, - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } -] \ No newline at end of file diff --git a/projects/adao/index.js b/projects/adao/index.js index b8ed6bcff53..46cb21d6723 100644 --- a/projects/adao/index.js +++ b/projects/adao/index.js @@ -1,4 +1,3 @@ -const abi = require("./abi.json"); const sdk = require("@defillama/sdk") const ADAOTreasuryAddress = "0x9E5A8BB92C3E5A8bf5bad9c40a807dE4151311d1"; @@ -13,7 +12,7 @@ async function treasury(timestamp, block, chainBlocks) { async function tvl(timestamp, block, chainBlocks) { const balances = {}; - const { output } = await sdk.api.abi.call({ target: ADAOStakingContract, chain: 'astar', block: chainBlocks.astar, abi: abi.find(i => i.name === 'totalSupply') }) + const { output } = await sdk.api.abi.call({ target: ADAOStakingContract, chain: 'astar', block: chainBlocks.astar, abi: "uint256:totalSupply" }) balances[`astar`] = output/1e18; return balances; } diff --git a/projects/adaswap/index.js b/projects/adaswap/index.js new file mode 100644 index 00000000000..0edff47d152 --- /dev/null +++ b/projects/adaswap/index.js @@ -0,0 +1,10 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports = { + misrepresentedTokens: true, + methodology: + "Factory address (0xe07C22C184ca252A525511B798BB8Ce96abDCc5b) is used to find the LP pairs. TVL is equal to the liquidity on the AMM.", + milkomeda: { + tvl: getUniTVL({ factory: '0xe07C22C184ca252A525511B798BB8Ce96abDCc5b', useDefaultCoreAssets: true, }), + }, +}; \ No newline at end of file diff --git a/projects/adenafinance/index.js b/projects/adenafinance/index.js index a8ce5a34a9b..a7080d65794 100644 --- a/projects/adenafinance/index.js +++ b/projects/adenafinance/index.js @@ -3,6 +3,6 @@ const { getUniTVL } = require('../helper/unknownTokens') module.exports = { misrepresentedTokens: true, harmony: { - tvl: getUniTVL({ factory: '0x44485473431fAF6EFA11D346d1057182d2A0A290', chain: 'harmony', useDefaultCoreAssets: true }), + tvl: getUniTVL({ factory: '0x44485473431fAF6EFA11D346d1057182d2A0A290', useDefaultCoreAssets: true }), } } diff --git a/projects/aelin/abi.json b/projects/aelin/abi.json deleted file mode 100644 index 5c534764585..00000000000 --- a/projects/aelin/abi.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "aelinPool_purchaseToken": {"inputs":[],"name":"purchaseToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}, - "aelinPool_aelinRewardsAddress": {"inputs":[],"name":"aelinRewardsAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"} -} \ No newline at end of file diff --git a/projects/aelin/index.js b/projects/aelin/index.js index 1bb979bae9b..1408b5cc819 100644 --- a/projects/aelin/index.js +++ b/projects/aelin/index.js @@ -1,77 +1,49 @@ const sdk = require('@defillama/sdk'); -const { request, gql } = require("graphql-request"); -const { getBlock } = require('../helper/getBlock'); const { staking } = require('../helper/staking') const { pool2 } = require('../helper/pool2') -const { unwrapUniswapLPs } = require('../helper/unwrapLPs') +const { unwrapUniswapLPs, sumTokens2, } = require('../helper/unwrapLPs') +const { getLogs } = require('../helper/cache/getLogs') const { default: BigNumber } = require('bignumber.js') -const abi = require('./abi.json') const aelin_data = { 'ethereum': { + logConfig: [ + { target: '0x2c0979b0de5f99c2bde1e698aeca13b55695951e', fromBlock: 13996006 }, + { target: '0x5541da82549d732878c4104c9887c408790397af', fromBlock: 13846412 }, + ], 'graphUrl': 'https://api.thegraph.com/subgraphs/name/aelin-xyz/aelin', 'AELIN_ETH_LP': '0x974d51fafc9013e42cbbb9465ea03fe097824bcc', 'AELIN_ETH_staking': '0x944cb90082fc1416d4b551a21cfe6d7cc5447c80', 'AELIN': '0xa9c125bf4c8bb26f299c00969532b66732b1f758' }, 'optimism': { - 'graphUrl': 'https://api.thegraph.com/subgraphs/name/aelin-xyz/optimism', + logConfig: [ + { target: '0x9219f9f65b007fd3ba0b53762861f54062531a31', fromBlock: 2266169 }, + { target: '0x87525307974a312AF13a78041F88B0BAe23ebb10', fromBlock: 1487918 }, + { target: '0x914ffc8dc0678911aae77f51b8489d6e214da20f', fromBlock: 1971285 }, + ], + 'graphUrl': 'https://api.thegraph.com/subgraphs/name/aelin-xyz/optimism', 'AELIN': '0x61BAADcF22d2565B0F471b291C475db5555e0b76', 'AELIN_staking': '0xfe757a40f3eda520845b339c698b321663986a4d', 'AELIN_ETH_LP': '0x665d8D87ac09Bdbc1222B8B9E72Ddcb82f76B54A', 'AELIN_ETH_staking': '0x4aec980a0daef4905520a11b99971c7b9583f4f8', - 'vAELIN': '0x780f70882fF4929D1A658a4E8EC8D4316b24748A', + 'vAELIN': '0x780f70882fF4929D1A658a4E8EC8D4316b24748A', }, } -// https://thegraph.com/hosted-service/subgraph/aelin-xyz/optimism -const graphQuery = gql` -query GET_AELIN_POOLS ($minGotchiId: Int, $block: Int) { - poolCreateds( - first: 1000 - skip: 0 - block: { number: $block } - ) { - id - name - } - totalPoolsCreateds(first: 5) { - count - } -}` function tvl(chain) { - return async (timestamp, ethBlock, chainBlocks) => { - const block = await getBlock(timestamp, chain, chainBlocks, false) - 100; // graph out of sync - - const { poolCreateds, totalPoolsCreateds } = await request( - aelin_data[chain]['graphUrl'], - graphQuery, - {block} - ); - - const n_pools = totalPoolsCreateds[0]['count'] - const poolsAddressesCalls = poolCreateds.map(p => ({ target: p.id })) - console.log(`${chain} - ${block}: n_pools: ${poolsAddressesCalls.length} / ${n_pools}`) // , poolsAddressesCalls) - - const {output: purchaseTokens} = await sdk.api.abi.multiCall({ - calls: poolsAddressesCalls, - abi: abi["aelinPool_purchaseToken"], - chain, - block, - }) - const balancesCall = purchaseTokens.map((purchaseToken, i) => - ({ target: purchaseToken.output, params: [poolCreateds[i].id] })) - const tokenBalances = await sdk.api.abi.multiCall({ - calls: balancesCall, - abi: "erc20:balanceOf", - chain, - block, + return async (timestamp, ethBlock, chainBlocks, { api }) => { + const { logConfig } = aelin_data[chain] + const logs = (await Promise.all(logConfig.map(({ target, fromBlock }) => getLogs({ + api, + target, + topics: ['0x2f9902ccfa1b25adff84fa12ff5b7cbcffcb5578f08631567f5173b39c3004fe'], + fromBlock, + eventAbi: 'event CreatePool(address indexed poolAddress, string name, string symbol, uint256 purchaseTokenCap, address indexed purchaseToken, uint256 duration, uint256 sponsorFee, address indexed sponsor, uint256 purchaseDuration, bool hasAllowList)' }) + ))).flat() - // console.log(rewardsBalances.output.map(b => b.input.params + ' aelinRewardsAddress pool has: ' + BigNumber(b.output).div(1e18).toFixed(0) + ' of purchaseToken ' + b.input.target)) - const balances = {}; - sdk.util.sumMultiBalanceOf(balances, tokenBalances, true, x => `${chain}:${x}`); - return balances + return sumTokens2({ api, tokensAndOwners: logs.map(i => ([i.args.purchaseToken, i.args.poolAddress])) }) } } @@ -79,43 +51,43 @@ function stakingTVL(chain) { return async (timestamp, ethBlock, chainBlocks) => { if (chain === 'ethereum') { return {} - } + } const staked = await staking( - aelin_data[chain]['AELIN_staking'], - aelin_data[chain]['AELIN'], + aelin_data[chain]['AELIN_staking'], + aelin_data[chain]['AELIN'], chain - ) (timestamp, ethBlock, chainBlocks) + )(timestamp, ethBlock, chainBlocks) return staked } } function pool2TVL(chain) { - return async (timestamp, ethBlock, chainBlocks) => { + return async (timestamp, ethBlock, chainBlocks, { api }) => { const stakingContract = aelin_data[chain]['AELIN_ETH_staking'] const lpToken = aelin_data[chain]['AELIN_ETH_LP'] - const block = await getBlock(timestamp, chain, chainBlocks, false) - 100; // graph out of sync + const block = api.block if (chain === 'ethereum') { - const staked = await pool2(stakingContract, lpToken, chain) (timestamp, ethBlock, chainBlocks) + const staked = await pool2(stakingContract, lpToken, chain)(timestamp, ethBlock, chainBlocks, { api }) const aelin_addr = `ethereum:${aelin_data[chain]['AELIN']}` staked['AELIN'] = BigNumber(staked[aelin_addr]).div(1e18).toFixed(0) staked[aelin_addr] = 0 return staked - } + } else if (chain === 'optimism') { const balances = {} const transformAddress = (addr) => `${chain}:${addr}`; - const {output: heldLPshares} = await sdk.api.abi.call({ - abi: 'erc20:balanceOf', - target: lpToken, - params: stakingContract, - chain, - block, + const { output: heldLPshares } = await sdk.api.abi.call({ + abi: 'erc20:balanceOf', + target: lpToken, + params: stakingContract, + chain, + block, }) const lpBalances = [ { - balance: heldLPshares, + balance: heldLPshares, token: lpToken } ] diff --git a/projects/aequinox/index.js b/projects/aequinox/index.js index c62f266442a..93ea5de7eb8 100644 --- a/projects/aequinox/index.js +++ b/projects/aequinox/index.js @@ -1,26 +1,26 @@ -const { request, gql } = require("graphql-request"); -const { toUSDTBalances } = require("../helper/balances"); +const { getLogs } = require("../helper/cache/getLogs"); +const { getUniqueAddresses } = require("../helper/utils"); +const { sumTokens2 } = require('../helper/unwrapLPs') -const backendGraphUrlBsc = "https://dex-backend-prod.herokuapp.com/graphql"; +const vault = '0xee1c8dbfbf958484c6a4571f5fb7b99b74a54aa7' -const backendTvlGraphQuery = gql` - query get_tvl { - data: beetsGetProtocolData { - totalLiquidity - } - }`; - -async function bscTvl(timestamp, ...params) { - if (Math.abs(timestamp - Date.now() / 1000) < 3600 / 2) { - const { data } = await request(backendGraphUrlBsc, backendTvlGraphQuery); - return toUSDTBalances(data.totalLiquidity); - }} +async function tvl(_, _b, _cb, { api, }) { + const data = await getLogs({ + api, + target: vault, + topics: ['0xf5847d3f2197b16cdcd2098ec95d0905cd1abdaf415f07bb7cef2bba8ac5dec4'], + fromBlock: 20457369, + eventAbi: 'event TokensRegistered(bytes32 indexed poolId, address[] tokens, address[] assetManagers)' + }) + let tokens = [] + data.forEach(i => tokens.push(...i.args.tokens)) + tokens = getUniqueAddresses(tokens) + return sumTokens2({ api, tokens, owner: vault, }) +} module.exports = { - misrepresentedTokens: true, - incentivized: true, - methodology: `Aequinox TVL is pulled from its subgraph. It includes deposits made to the liquidity pools.`, + methodology: `TVL is computed by summing up all the tokens in the vault: ${vault}`, bsc: { - tvl: bscTvl, + tvl, }, -}; \ No newline at end of file +}; diff --git a/projects/aerie/index.js b/projects/aerie/index.js new file mode 100644 index 00000000000..2740ae30835 --- /dev/null +++ b/projects/aerie/index.js @@ -0,0 +1,27 @@ +const { sumUnknownTokens } = require('../helper/unknownTokens') + +async function tvl(_, _b, _cb, { api, }) { + const Indexer = '0x0336dfb02ba66ce75f5cc7898c3eafeddc493daf' + let pools = await api.call({ abi: abi.getAllSaaSPools, target: Indexer }) + const isEnabled = await api.multiCall({ abi: abi.poolEnabled, calls: pools }) + pools = pools.filter((_, i) => isEnabled[i]) + const tokens = await api.multiCall({ abi: abi.stakedTokenAddress, calls: pools}) + const poolInfo = await api.multiCall({ abi: abi.pool, calls: pools}) + const bals = poolInfo.map(i => i.totalTokensStaked) + api.addTokens(tokens, bals) + return sumUnknownTokens({ api, useDefaultCoreAssets: true, lps: ['0x412cb411be14ec0ee87c2823f830d33dd37aa8f8']}) +} + +module.exports = { + ethereum: { + tvl: () => ({}), + staking: tvl, + }, +} + +const abi = { + "getAllSaaSPools": "address[]:getAllSaaSPools", + "stakedTokenAddress": "address:stakedTokenAddress", + "pool": "function pool() view returns (address creator, address tokenOwner, uint256 poolTotalSupply, uint256 poolRemainingSupply, uint256 totalTokensStaked, uint256 creationBlock, uint256 perBlockNum, uint256 lockedUntilDate, uint256 lastRewardBlock, uint256 accERC20PerShare, uint256 stakeTimeLockSec, bool isStakedNft, bytes32 website)", + "poolEnabled": "bool:poolEnabled", +} \ No newline at end of file diff --git a/projects/aevo-xyz/index.js b/projects/aevo-xyz/index.js new file mode 100644 index 00000000000..3d2e14f5a6b --- /dev/null +++ b/projects/aevo-xyz/index.js @@ -0,0 +1,8 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require("../helper/unwrapLPs"); + +module.exports = { + ethereum: { + tvl: sumTokensExport({ owner: '0x4082C9647c098a6493fb499EaE63b5ce3259c574', tokens: [ADDRESSES.ethereum.USDC]}) + } +} \ No newline at end of file diff --git a/projects/affine-defi/index.js b/projects/affine-defi/index.js new file mode 100644 index 00000000000..605963845c7 --- /dev/null +++ b/projects/affine-defi/index.js @@ -0,0 +1,29 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokens2 } = require('../helper/unwrapLPs') + +async function tvl(_, _b, _cb, { api, }) { + const vaults = ['0x829363736a5A9080e05549Db6d1271f070a7e224'] + const tokens = await api.multiCall({ abi: 'address:asset', calls: vaults }) + const bals = await api.multiCall({ abi: 'uint256:totalAssets', calls: vaults }) + api.addTokens(tokens, bals) + const ownerTokens = [ + [[ADDRESSES.polygon.WETH_1, ADDRESSES.polygon.WBTC], '0x1F9b1057cd93fb2d07d18810903B791b56acc2E1'] + ] + return sumTokens2({ api, ownerTokens }) +} + +async function ethTvl(_, _b, _cb, { api, }) { + const ethBaskets = [ + '0x61A18EE9d6d51F838c7e50dFD750629Fd141E944', '0x78Bb94Feab383ccEd39766a7d6CF31dED177Ad0c', '0x72D51B2233c5feA8a702FDd0E51B0adE95638f2c' + ] + const tokens = await api.multiCall({ abi: 'address:asset', calls: ethBaskets }) + const bals = await api.multiCall({ abi: 'uint256:totalAssets', calls: ethBaskets }) + api.addTokens(tokens, bals) +} + +module.exports = { + doublecounted: true, + methodology: 'Counts the tokens in the Affine baskets', + polygon: { tvl }, + ethereum: { tvl: ethTvl } +} diff --git a/projects/afraswap/index.js b/projects/afraswap/index.js index d2356ca1981..21e2ffb61ab 100644 --- a/projects/afraswap/index.js +++ b/projects/afraswap/index.js @@ -6,7 +6,7 @@ module.exports = { methodology: "Factory address (0xa098751D407796d773032f5Cc219c3e6889fB893) is used to find the LP pairs. TVL is equal to the liquidity on the AMM.", bsc: { - tvl: getUniTVL({ factory: '0xa098751D407796d773032f5Cc219c3e6889fB893', chain: 'bsc', useDefaultCoreAssets: true }), + tvl: getUniTVL({ factory: '0xa098751D407796d773032f5Cc219c3e6889fB893', useDefaultCoreAssets: true }), staking: stakingPricedLP("0x259C852834375864b65202375558AB11B2d330fd", "0x5badD826AeFa700446Fa6d784e6ff97eD6eeDca9", "bsc", "0x1Da189c1BA3d718Cc431a2ed240a3753f89CD47A", "wbnb") }, }; \ No newline at end of file diff --git a/projects/aftermath-fi/index.js b/projects/aftermath-fi/index.js new file mode 100644 index 00000000000..e2b4bbb4dcf --- /dev/null +++ b/projects/aftermath-fi/index.js @@ -0,0 +1,23 @@ +const sui = require("../helper/chain/sui"); + +const MAINNET_PROTOCOL_ID = + "0x0625dc2cd40aee3998a1d6620de8892964c15066e0a285d8b573910ed4c75d50"; + +async function tvl(_, _1, _2, { api }) { + const pools = await sui.queryEvents({ eventType: '0xefe170ec0be4d762196bedecd7a065816576198a6527c99282a2551aaa7da38c::events::CreatedPoolEvent', transform: i => i.pool_id}) + const poolData = await sui.getObjects(pools) + + for (const { fields: { type_names: tokens, normalized_balances: bals, decimal_scalars } } of poolData) { + bals.forEach((v, i) => { + if (/af_lp::AF_LP/.test(tokens[i])) return; + api.add('0x' + tokens[i], v / decimal_scalars[i]) + }) + } +} + +module.exports = { + timetravel: false, + sui: { + tvl, + }, +}; diff --git a/projects/agarthadao/index.js b/projects/agarthadao/index.js index 113b72a73e4..011f7358221 100644 --- a/projects/agarthadao/index.js +++ b/projects/agarthadao/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const {ohmTvl} = require("../helper/ohm"); const clavis = "0xa5b0f5ef809fd04c9d4320211c711cb34ef812dd"; @@ -6,7 +7,7 @@ const stakingContract = "0x7e4939ca7847ae3ff9501b27470dcd0a69f54fa6"; const treasury = "0x2c5bb99df3d43efd98ff1d7aa34d4207c83638e4" const treasuryTokens = [ ["0x130966628846bfd36ff31a822705796e8cb8c18d", false],// MIM - ["0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7", false], // WAVAX + [ADDRESSES.avax.WAVAX, false], // WAVAX ["0x72f95Da8d7a9b405191cAE0Fc31711d575044eFb", true], // CLAVIS-MIM JLP ["0x7d5b42704bb34c5bbbcd3be4f5762a663b38a2df", true] // CLAVIS-WAVAX JLP ] diff --git a/projects/agile/index.js b/projects/agile/index.js index e27f768c191..3cf0343718f 100644 --- a/projects/agile/index.js +++ b/projects/agile/index.js @@ -18,7 +18,6 @@ module.exports = { tvl: sdk.util.sumChainTvls([ getUniTVL({ factory: '0xb89E86701C4Fe4a22a16914e3b0Df53eA4BE771b', - chain: 'cronos', useDefaultCoreAssets: true, }), lendingMarket.tvl diff --git a/projects/agilitylsd/index.js b/projects/agilitylsd/index.js new file mode 100644 index 00000000000..55392b9089f --- /dev/null +++ b/projects/agilitylsd/index.js @@ -0,0 +1,34 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokens2, nullAddress } = require("../helper/unwrapLPs"); +const { getLogs } = require("../helper/cache/getLogs"); +const { staking } = require("../helper/staking"); + +const FACTORY_CONTRACT = "0xe4a51ec59233ba1f62b71f84554622a532b584ed"; +const WETH_ADDRESS = ADDRESSES.ethereum.WETH; +const AGI_ETH_LP_ADDRESS = "0x498c00E1ccC2AFFf80F6Cc6144EAEB95c46cc3B5"; +const AGI_ETH_STAKING_POOL = "0xC8187048f7Ab0db0774b674fEf3f4F4285A01bF4"; + +async function tvl(timestamp, block, chainBlocks, { api }) { + const logs = await getLogs({ + api, + target: FACTORY_CONTRACT, + topics: ["0x489ab9065c597368f4a678fadcb323bf4c848713ea7d5a296d16ec97203eae83",], + eventAbi: "event StakingPoolDeployed(address indexed poolAddress,address indexed stakingToken,uint256 startTime,uint256 roundDurationInDays)", + onlyArgs: true, + fromBlock: 17015686, + }); + + const lsdAddresses = logs.map((i) => i.stakingToken === nullAddress ? WETH_ADDRESS : i.stakingToken); + const poolAddresses = logs.map((i) => i.poolAddress); + + return sumTokens2({ api, tokensAndOwners2: [lsdAddresses, poolAddresses], blacklistedTokens: [AGI_ETH_LP_ADDRESS], }); +} + +module.exports = { + ethereum: { + methodology: + "TVL of Staked ETH & LSD tokens, with pool2 including value of staked AGI/ETH Uniswap-V2 LP tokens", + tvl, + pool2: staking([AGI_ETH_STAKING_POOL], [AGI_ETH_LP_ADDRESS]), + }, +}; diff --git a/projects/agni-fi/index.js b/projects/agni-fi/index.js new file mode 100644 index 00000000000..8a4a44049a6 --- /dev/null +++ b/projects/agni-fi/index.js @@ -0,0 +1,5 @@ +const { uniV3Export } = require("../helper/uniswapV3"); + +module.exports = uniV3Export({ + mantle: { factory: "0x25780dc8Fc3cfBD75F33bFDAB65e969b603b2035", fromBlock: 35714, }, +}); \ No newline at end of file diff --git a/projects/agora/abi.json b/projects/agora/abi.json index fa1401c5903..a4941c297a8 100644 --- a/projects/agora/abi.json +++ b/projects/agora/abi.json @@ -1,41 +1,5 @@ { - "getPricePerFullShare": { - "type": "function", - "stateMutability": "view", - "outputs": [ - { - "type": "uint256", - "name": "", - "internalType": "uint256" - } - ], - "name": "getPricePerFullShare", - "inputs": [] - }, - "want": { - "type": "function", - "stateMutability": "view", - "outputs": [ - { - "type": "address", - "name": "", - "internalType": "contract IERC20" - } - ], - "name": "want", - "inputs": [] - }, - "balance": { - "inputs": [], - "name": "balance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -} + "getPricePerFullShare": "uint256:getPricePerFullShare", + "want": "address:want", + "balance": "uint256:balance" +} \ No newline at end of file diff --git a/projects/agora/index.js b/projects/agora/index.js index 6364fd095ea..aef9b34a536 100644 --- a/projects/agora/index.js +++ b/projects/agora/index.js @@ -1,16 +1,17 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const { compoundExports } = require("../helper/compound"); const { getUniTVL } = require('../helper/unknownTokens') const factory = '0x3c4063B964B1b3bF229315fCc4df61a694B0aE84' -const metis = '0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000' +const metis = ADDRESSES.metis.Metis const agora = '0x0Ed0Ca6872073E02cd3aE005BaF04bA43BE947fA' const whitelist = [ agora, // AGORA - '0xEA32A96608495e54156Ae48931A7c20f0dcc1a21', // USDC - '0xbB06DCA3AE6887fAbF931640f67cab3e3a16F4dC', // USDT - '0x420000000000000000000000000000000000000A', // WETH + ADDRESSES.metis.m_USDC, // USDC + ADDRESSES.metis.m_USDT, // USDT + ADDRESSES.metis.WETH, // WETH '0x94e56c0c59433599ba857a9a7243b2826745cf91', //kWBTC '0x6d11f074131e3fc61c983cce538f5d0ca3553c0f', //kUSDC '0xcfd482dce13ca1d27834d381af1b570e9e6c6810', //kmetis @@ -49,14 +50,17 @@ const { tvl: agoraFarmTvl, borrowed: agoraFarmBorrowed } = compoundExports( undefined, ); -const chainTvl = getUniTVL({ factory, chain: 'metis', useDefaultCoreAssets: true, }) +const chainTvl = getUniTVL({ factory, useDefaultCoreAssets: true, }) module.exports = { + hallmarks: [ + [1649376000, "STARS collateral Exploit"] + ], incentivized: true, misrepresentedTokens: true, methodology: `As in Compound Finance, TVL counts the tokens locked in the contracts to be used as collateral to borrow or to earn yield. Borrowed coins are counted as "Borrowed" TVL and can be toggled towards the regular TVL.`, metis: { tvl: sdk.util.sumChainTvls([chainTvl, agoraTvl, agoraPlusTvl, agoraFarmTvl, agoraStakeTvl]), - borrowed: sdk.util.sumChainTvls([agoraBorrowed, agoraPlusBorrowed, agoraFarmBorrowed, agoraStakeBorrowed]), + borrowed: ()=>({}), }, }; diff --git a/projects/agsfinance/index.js b/projects/agsfinance/index.js index e298ce7e9e9..21bdbde72f6 100644 --- a/projects/agsfinance/index.js +++ b/projects/agsfinance/index.js @@ -6,7 +6,7 @@ module.exports = { misrepresentedTokens: true, methodology: "AGS Finance Tvl Calculation", astar: { - tvl: getUniTVL({ factory: FACTORIES, chain: 'astar', useDefaultCoreAssets: true }), + tvl: getUniTVL({ factory: FACTORIES, useDefaultCoreAssets: true }), } }; diff --git a/projects/ajira-pay-finance/index.js b/projects/ajira-pay-finance/index.js new file mode 100644 index 00000000000..6d7674cb810 --- /dev/null +++ b/projects/ajira-pay-finance/index.js @@ -0,0 +1,35 @@ +const { staking } = require("../helper/staking"); + +const AJP_CONTRACT_ADDRESS = "0x9DBC0Ad09184226313FbDe094E7c3DD75c94f997" +const KAVA_STAKING_CONTRACT = "0xD1cAf204721A02016993796663EDb00E6Ad9dac4" +const BSC_STAKING_CONTRACT = '0xEbD5a0bAED48747ea10feEB61a09a93550Fddcef' + +const ammLpData = { + arbitrum: { + poolAddress: '0x0C36cB133CFF5D36313eFF3FF1761F9d391DF8Fc', + }, + bsc: { + poolAddress: '0x808A234665c7684A5e0Ed5e6BB551dBA1cc9d3e4', + }, + polygon: { + poolAddress: '0x2aDA82d11f6bC2bd357E7F3A6674983C372a50A3', + } +} + +module.exports = { + methodology: "Ajira Pay Finance TVL Calculations are based on AJP Staking pool and Liquidity pool balances respectively on the AMMs", + kava: { + staking: staking(KAVA_STAKING_CONTRACT, AJP_CONTRACT_ADDRESS), + tvl: () => ({}) + }, + bsc: { + staking: staking(BSC_STAKING_CONTRACT, AJP_CONTRACT_ADDRESS), + tvl: () => ({}) + }, + polygon: { + tvl: () => ({}), + }, + arbitrum: { + tvl: () => ({}), + } +}; diff --git a/projects/ajna/index.js b/projects/ajna/index.js new file mode 100644 index 00000000000..70070aee1f4 --- /dev/null +++ b/projects/ajna/index.js @@ -0,0 +1,25 @@ +const sdk = require("@defillama/sdk") +const { sumTokens2 } = require('../helper/unwrapLPs') + +async function tvl(_, _b, _cb, { api, }) { + const pools = await api.call({ abi: 'address[]:getDeployedPoolsList', target: '0xe6f4d9711121e5304b30ac2aae57e3b085ad3c4d'}) + const collaterals = await api.multiCall({ abi: 'address:collateralAddress', calls: pools}) + const borrows = await api.multiCall({ abi: 'address:quoteTokenAddress', calls: pools}) + const ownerTokens = pools.map((v, i) => [[collaterals[i], borrows[i]], v]) + return sumTokens2({ ownerTokens, api}) +} + +async function borrowed(_, _b, _cb, { api, }) { + const pools = await api.call({ abi: 'address[]:getDeployedPoolsList', target: '0xe6f4d9711121e5304b30ac2aae57e3b085ad3c4d'}) + const debts = await api.multiCall({ abi: 'function debtInfo() external view returns (uint256, uint256, uint256, uint256)', calls: pools}) + const borrows = await api.multiCall({ abi: 'address:quoteTokenAddress', calls: pools}) + const borrowScale = await api.multiCall({ abi: 'uint:quoteTokenScale', calls: pools}) + const balances = {} + pools.map((v, i) => sdk.util.sumSingleBalance(balances, borrows[i], debts[i][0]/borrowScale[i])) + return balances + } + +module.exports = { + misrepresentedTokens: true, + ethereum: { tvl, borrowed } +} \ No newline at end of file diff --git a/projects/akiba/index.js b/projects/akiba/index.js new file mode 100644 index 00000000000..64aaf634f83 --- /dev/null +++ b/projects/akiba/index.js @@ -0,0 +1,24 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport, nullAddress, } = require('../helper/unknownTokens') + +const Contracts = { + kava: { + wkava: ADDRESSES.kava.WKAVA, + akiba: "0x8f5af8d2E06c976970752b5596BE05Cd518Adcdd", + bank: "0x0CA1088C075E5C9447D5C07984aCCc48c816D01D", // Pool + multiFeeDistribution: "0xa41045953C7fa32CCea9132997b2E7460db5ae3F", // Staking + chef: "0x6b2349b0B2b2b9c1B970a1d0E5AB4226d6Cb78c8", + lps: [ + "0xAd18F4d2087d954989d7b1f728AeE1941F7BC25F", // AKIBA_KAVA_LP + "0xc75Bd803C2671fC4C0d7350C88e8250e9F7E9805", // KAVAX_KAVA_LP + ] + }, +}; + +module.exports = { + kava: { + tvl: sumTokensExport({ owner: Contracts.kava.bank, tokens: [Contracts.kava.wkava, nullAddress] }), + staking: sumTokensExport({ owner: Contracts.kava.multiFeeDistribution, tokens: [Contracts.kava.akiba], useDefaultCoreAssets: true, lps: Contracts.kava.lps}), + pool2: sumTokensExport({ owner: Contracts.kava.chef, tokens: Contracts.kava.lps, useDefaultCoreAssets: true, lps: Contracts.kava.lps}), + }, +}; diff --git a/projects/aktionariat/index.js b/projects/aktionariat/index.js new file mode 100644 index 00000000000..6aab1fceaa1 --- /dev/null +++ b/projects/aktionariat/index.js @@ -0,0 +1,51 @@ +const { request, gql } = require('graphql-request'); +const { getBlock } = require('../helper/http'); +const { sumTokens2 } = require('../helper/unwrapLPs') + +const graphs = { + ethereum: "https://api.thegraph.com/subgraphs/name/aktionariat/brokerbot", + optimism: "https://api.thegraph.com/subgraphs/name/aktionariat/brokerbot-optimism", +} + +function tvlPaged(chain) { + return async (_, _b, { [chain]: block }) => { + block = await getBlock(_, chain, { [chain]: block }) + const balances = {} + const size = 1000 + let lastId = '' + let brokerbots + let graphQueryPaged = gql` + query brokerbotQuery($lastId: String, $block: Int) { + brokerbots(block: { number: $block } first:${size} where: {id_gt: $lastId totalValueLockedUSD_gt: 100}) { + id + token { id } + base { id } + } + } + ` + + + do { + const res = await request(graphs[chain], graphQueryPaged, { lastId, block: block - 5000 }); + brokerbots = res.brokerbots + const tokensAndOwners = brokerbots.map(i => ([[i.token.id, i.id], [i.base.id, i.id]])).flat() + await sumTokens2({ balances, tokensAndOwners, chain, block }) + lastId = brokerbots[brokerbots.length - 1]?.id + } while (brokerbots.length === size) + + return balances + } +} + +module.exports = { + methodology: `Counts the tokens locked on brokerbots, pulling the brokerbot addresses from the 'aktionariat/brokerbot' subgraph`, + timetravel: false, + hallmarks: [] +} +const chains = ['ethereum', 'optimism'] + +chains.forEach(chain => { + module.exports[chain] = { + tvl: tvlPaged(chain) + } +}) diff --git a/projects/aladdin-dao/abis/Vault.json b/projects/aladdin-dao/abis/Vault.json index 7c4c9218f79..1226a3d5237 100644 --- a/projects/aladdin-dao/abis/Vault.json +++ b/projects/aladdin-dao/abis/Vault.json @@ -1,3 +1,3 @@ { - "balance":{"inputs":[],"name":"balance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"} -} + "balance": "uint256:balance" +} \ No newline at end of file diff --git a/projects/aladdin-dao/index.js b/projects/aladdin-dao/index.js index b3294a05781..2473f69d620 100644 --- a/projects/aladdin-dao/index.js +++ b/projects/aladdin-dao/index.js @@ -1,5 +1,4 @@ const sdk = require("@defillama/sdk"); -const {unwrapUniswapLPs, unwrapCrv} = require('../helper/unwrapLPs') const vaultABI = require('./abis/Vault.json') @@ -17,9 +16,9 @@ const slpETHWBTC = '0xceff51756c56ceffca006cd410b03ffc46dd3a58' const pools = [aldcrvRenWBTC, aldsETH, ald3CRV, aldSLPETHWBTC, unilpALDETH, unilpALDUSDC] const aldVaults = [aldcrvRenWBTC, aldsETH, ald3CRV, aldSLPETHWBTC] -const aldVaultUnderlyingTokens = [crvRenWBTC, SETH, threeCRV, slpETHWBTC]; +const aldVaultUnderlyingTokens = [crvRenWBTC, SETH, threeCRV, ]; -async function tvl(timestamp, block) { +async function tvl(timestamp, block, _, api) { let balances = {} const lockedTokens = await sdk.api.abi.multiCall({ abi: 'erc20:balanceOf', @@ -51,19 +50,12 @@ async function tvl(timestamp, block) { } else if (index === 0 || index == 1 || index == 2 ) { crvBalances.push(aldUnderlyingTokenBalances[index]) } else if (index === 3) { - lpPositions.push({balance: aldUnderlyingTokenBalances[index], token: aldVaultUnderlyingTokens[index]}) + lpPositions.push({balance: aldUnderlyingTokenBalances[index], token: slpETHWBTC}) } }) - await unwrapUniswapLPs( - balances, - lpPositions, - block, - ); - - await unwrapCrv(balances, aldVaultUnderlyingTokens[0], crvBalances[0]); - await unwrapCrv(balances, aldVaultUnderlyingTokens[1], crvBalances[1]); - await unwrapCrv(balances, aldVaultUnderlyingTokens[2], crvBalances[2]); + lpPositions.forEach(({balance, token}) => sdk.util.sumSingleBalance(balances,token,balance, api.chain)) + aldVaultUnderlyingTokens.forEach((token, i) => sdk.util.sumSingleBalance(balances,token,crvBalances[i], api.chain)) return balances } diff --git a/projects/alchemix/contracts.json b/projects/alchemix/contracts.json index ca657b66449..2ae2252739f 100644 --- a/projects/alchemix/contracts.json +++ b/projects/alchemix/contracts.json @@ -69,5 +69,25 @@ "token": "0xdBdb4d16EdA451D0503b854CF79D55697F90c8DF", "holder": "0xAB8e74017a8Cc7c15FFcCd726603790d26d7DeCa" } + }, + "cvxLPpools": { + "alUSD​+FRAXBP": { + "poolAddress": "0x26598e3E511ADFadefD70ab2C3475Ff741741104", + "holder": "0x06378717d86b8cd2dba58c87383da1eda92d3495", + "tokenAddress": "0xb30da2376f63de30b42dc055c93fa474f31330a5", + "alToken": "0xBC6DA0FE9aD5f3b0d58160288917AA56653660E9" + }, + "alUSD-3CRV": { + "poolAddress": "0x02E2151D4F351881017ABdF2DD2b51150841d5B3", + "holder": "0x9735f7d3ea56b454b24ffd74c58e9bd85cfad31b", + "tokenAddress": "0x43b4fdfd4ff969587185cdb6f0bd875c5fc83f8c", + "alToken": "0xBC6DA0FE9aD5f3b0d58160288917AA56653660E9" + }, + "alETH-ETH": { + "poolAddress": "0x48Bc302d8295FeA1f8c3e7F57D4dDC9981FEE410", + "holder": "0xe761bf731a06fe8259fee05897b2687d56933110", + "tokenAddress": "0xc4c319e2d4d66cca4464c0c2b32c9bd23ebe784e", + "alToken": "0x0100546F2cD4C9D97f798fFC9755E47865FF7Ee6" + } } } \ No newline at end of file diff --git a/projects/alchemix/index.js b/projects/alchemix/index.js index 0a2ca2289bd..7b4c35d9f71 100644 --- a/projects/alchemix/index.js +++ b/projects/alchemix/index.js @@ -1,47 +1,45 @@ -const { getChainTransform } = require('../helper/portedTokens.js'); -const { unwrapYearn, sumTokensSharedOwners } = require('../helper/unwrapLPs'); +const { sumTokens2 } = require("../helper/unwrapLPs"); const { staking } = require("../helper/staking.js"); -const contracts = require('./contracts'); +const contracts = require("./contracts"); function tvl(chain) { - return async (timestamp, block, chainBlocks) => { - const balances = {}; - const transform = await getChainTransform(chain); + return async (timestamp, block, chainBlocks, { api }) => { + const tokens = Object.values(contracts[chain].underlyingTokens).concat(Object.values(contracts[chain].yvTokens)) + await sumTokens2({ tokens, api, owners: Object.values(contracts[chain].tokenHolders) }) + if (api.chain !== 'ethereum') return - await sumTokensSharedOwners( - balances, - Object.values(contracts[chain].underlyingTokens) - .concat(Object.values(contracts[chain].yvTokens)), - Object.values(contracts[chain].tokenHolders), - chainBlocks[chain], - chain, - transform - ); - - for (const [name, yvToken] of Object.entries(contracts[chain].yvTokens)) { - if(chain === "optimism"){ - const underlying = "optimism:"+contracts[chain].underlyingTokens[name.substring(1)] - const yvTokenFinal = transform(yvToken) - balances[underlying] = balances[yvTokenFinal] - delete balances[yvTokenFinal] - } else { - await unwrapYearn(balances, yvToken, chainBlocks[chain], chain, transform); - } - }; - - return balances; + await Promise.all( + Object.values(contracts.cvxLPpools).map(async ({ poolAddress, holder, tokenAddress, alToken }) => { + const lpTokenBalance = await api.call({ target: poolAddress, abi: "erc20:balanceOf", params: holder, }) + const supply = await api.call({ target: tokenAddress, abi: "erc20:totalSupply", }) + const ratio = lpTokenBalance / supply + if (+ratio === 0) return; + const tokenBalances = await api.multiCall({ target: tokenAddress, abi: 'function balances(uint256) view returns (uint256)', calls: [0, 1] }) + const tokens = await api.multiCall({ target: tokenAddress, abi: 'function coins(uint256) view returns (address)', calls: [0, 1] }) + alToken = alToken.toLowerCase() + tokens.forEach((token, i) => { + if (token.toLowerCase() !== alToken) { + if (!isNaN(tokenBalances[i] * ratio))api.add(token, tokenBalances[i] * ratio) + } + }) + }) + ); }; -}; +} module.exports = { + doublecounted: true, ethereum: { - tvl: tvl('ethereum'), - staking: staking(contracts.ethereum.staking.holder, contracts.ethereum.staking.token) + tvl: tvl("ethereum"), + staking: staking( + contracts.ethereum.staking.holder, + contracts.ethereum.staking.token + ), }, fantom: { - tvl: tvl('fantom') + tvl: tvl("fantom"), }, optimism: { - tvl: tvl('optimism') - } -}; \ No newline at end of file + tvl: tvl("optimism"), + }, +}; diff --git a/projects/alexar/index.js b/projects/alexar/index.js index bcc43b823ab..f07123db2c6 100644 --- a/projects/alexar/index.js +++ b/projects/alexar/index.js @@ -1,18 +1,86 @@ +const { get } = require('../helper/http'); +const blacklistedAssets = ['uaxl']; -const { get, } = require('../helper/http') +const chainMapping = { + avax: 'avalanche', + cosmos: 'cosmoshub', + terra2: 'terra-2', + bsc: 'binance' + }; -const blacklistedAssets = ['uaxl'] -async function fetch() { - var { data } = await get('https://api.axelarscan.io/cross-chain/tvl') + const assetChainMap = { + 'uusdc': 'ethereum', + 'weth-wei': 'ethereum', + 'wbtc-satoshi': 'ethereum', + 'dai-wei': 'ethereum', + 'uusdt': 'ethereum', + 'wbnb-wei': 'binance', + 'dot-planck': 'moonbeam', + 'wmatic-wei': 'polygon', + 'uluna': 'terra', + 'wavax-wei': 'avalanche', + 'uusd': 'terra', + 'wftm-wei': 'fantom', + 'busd-wei': 'ethereum', + 'uatom': 'cosmoshub', + 'link-wei': 'ethereum', + 'polygon-uusdc': 'polygon', + 'mkr-wei': 'ethereum', + 'frax-wei': 'ethereum', + 'eth-wei': 'ethereum', + 'shib-wei': 'ethereum', + 'wglmr-wei': 'moonbeam', + 'stuatom': 'stride', + 'steth-wei': 'ethereum', + 'aave-wei': 'ethereum', + 'uni-wei': 'ethereum', + 'ustrd': 'stride', + 'rai-wei': 'ethereum', + 'ape-wei': 'ethereum', + 'ujuno': 'juno' + } - var tvl = 0; - for (const asset of data) { - if (blacklistedAssets.includes(asset.asset)) continue; - tvl += asset.value - } - return tvl -} +const chainListSupply = ['juno', 'cosmos', 'comdex', 'carbon', 'crescent', 'injective', 'kujira', 'osmosis', +'persistence', 'stargaze', 'secret', 'stargaze', 'umee', 'evmos', 'terra2']; +const chainListTotal = [ 'avax', 'bsc', 'moonbeam', 'polygon', 'fantom', 'arbitrum', 'aurora', 'celo', 'kava', +]; -module.exports = { - fetch -} + async function getTVL(chain) { + const { data } = await get('https://api.axelarscan.io/cross-chain/tvl'); + const mappedChain = chainMapping[chain] || chain; + + return data.reduce((tvl, asset) => { + // Skip the asset if it is on the blacklisted chain specified in the assetChainMap + if (assetChainMap[asset.asset] === mappedChain) return tvl; + if (blacklistedAssets.includes(asset.asset)) return tvl; + const chainData = asset.tvl[mappedChain]; + if (!chainData) return tvl; + + let assetAmount; + + if (chainListSupply.includes(chain)) { + assetAmount = chainData.supply; + } else if (chainListTotal.includes(chain)) { + assetAmount = chainData.total; + } else { + return tvl; + } + + const assetPrice = asset.price; + + // Check if both assetAmount and assetPrice are numbers + if (isNaN(assetAmount) || isNaN(assetPrice)) return tvl; + + return tvl + (assetAmount * assetPrice); + }, 0); + } + + const exportObj = {}; + + chainListSupply.concat(chainListTotal).forEach(chain => { + exportObj[chain] = { tvl: () => getTVL(chain).then(tether => ({ tether })) }; + }); + + module.exports = exportObj; + module.exports.misrepresentedTokens = true; + module.exports.timetravel = false; \ No newline at end of file diff --git a/projects/algebra/index.js b/projects/algebra/index.js index 3868d0811b0..af4a08b6b1e 100644 --- a/projects/algebra/index.js +++ b/projects/algebra/index.js @@ -1,7 +1,5 @@ -const sdk = require('@defillama/sdk') -const {transformPolygonAddress} = require('../helper/portedTokens') - -const { getBlock } = require('../helper/getBlock'); +const { getLogs } = require('../helper/cache/getLogs') +const { sumTokens2 } = require('../helper/unwrapLPs') const { staking } = require('../helper/staking'); const FACTORY = '0x8C1EB1e5325049B412B7E71337116BEF88a29b3A'; @@ -11,82 +9,22 @@ const startBlocks = { } function chainTvl(chain) { - return async (timestamp, ethBlock, chainBlocks) => { + return async (timestamp, ethBlock, chainBlocks, { api }) => { const START_BLOCK = startBlocks[chain] - const block = await getBlock(timestamp, chain, chainBlocks) - const logs = ( - await sdk.api.util.getLogs({ - keys: [], - toBlock: block, + const logs = await getLogs({ + api, target: FACTORY, fromBlock: START_BLOCK, - chain, topic: 'PoolCreated(address,address,address)', + eventAbi: 'event PoolCreated(address indexed token0, address indexed token1, address pool)', + onlyArgs: true, }) - ).output - - const pairAddresses = [] - const token0Addresses = [] - const token1Addresses = [] - - for (let log of logs) { - token0Addresses.push(`0x${log.topics[1].substr(-40)}`.toLowerCase()) - token1Addresses.push(`0x${log.topics[2].substr(-40)}`.toLowerCase()) - pairAddresses.push(`0x${log.data.substr(-40)}`.toLowerCase()) - } - - const pairs = {} - - token0Addresses.forEach((token0Address, i) => { - const pairAddress = pairAddresses[i] - pairs[pairAddress] = { - token0Address: token0Address, - } - }) - - token1Addresses.forEach((token1Address, i) => { - const pairAddress = pairAddresses[i] - pairs[pairAddress] = { - ...(pairs[pairAddress] || {}), - token1Address: token1Address, - } - }) - - let balanceCalls = [] - - for (let pair of Object.keys(pairs)) { - balanceCalls.push({ - target: pairs[pair].token0Address, - params: pair, - }) - balanceCalls.push({ - target: pairs[pair].token1Address, - params: pair, - }) - } - - const tokenBalances = ( - await sdk.api.abi.multiCall({ - abi: 'erc20:balanceOf', - calls: balanceCalls, - block, - chain, - }) - ) - let transform = id=>id - if(chain === "polygon"){ - transform = await transformPolygonAddress() - } - - let balances = {}; - - sdk.util.sumMultiBalanceOf(balances, tokenBalances, true, transform) - - return balances; + const toa = [] + logs.forEach(({ token0, token1, pool}) => toa.push([token0, pool], [token1, pool])) + return sumTokens2({ api, tokensAndOwners: toa }) } } - module.exports = { polygon: { tvl: chainTvl('polygon'), diff --git a/projects/algem/index.js b/projects/algem/index.js index 6c8351af80a..b61d74ba8bf 100644 --- a/projects/algem/index.js +++ b/projects/algem/index.js @@ -2,23 +2,9 @@ const sdk = require("@defillama/sdk"); const LIQUID_STAKING_CONTRACT = "0x70d264472327B67898c919809A9dc4759B6c0f27"; -const abi = { - inputs: [], - name: "totalBalance", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256" - } - ], - stateMutability: "view", - type: "function" - }; - async function tvl(timestamp, block, chainBlocks) { const balance = (await sdk.api.abi.call({ - abi: abi, + abi: "uint256:totalBalance", chain: "astar", target: LIQUID_STAKING_CONTRACT})).output; const balances = { 'astar': balance / 10e17 }; diff --git a/projects/algoblocks/index.js b/projects/algoblocks/index.js new file mode 100644 index 00000000000..fd638eeb490 --- /dev/null +++ b/projects/algoblocks/index.js @@ -0,0 +1,12 @@ +const { staking } = require("../helper/staking"); + +const ALGOBLOCKS_TOKEN_CONTRACT = "0xfecCa80fF6DeB2B492E93df3B67f0C523Cfd3a48"; +const ALGOBLOCKS_STAKING_POOL = "0xaC87dE420894eAA8234d288334FAec08bB46ffe7"; + +module.exports = { + methodology: "We are computing the tvl from algoblocks staking pools.", + bsc: { + tvl: () => 0, + staking: staking(ALGOBLOCKS_STAKING_POOL, ALGOBLOCKS_TOKEN_CONTRACT), + }, +}; diff --git a/projects/algofi-swap/index.js b/projects/algofi-swap/index.js index ed8b887d02b..87b7d01af51 100644 --- a/projects/algofi-swap/index.js +++ b/projects/algofi-swap/index.js @@ -1,5 +1,5 @@ const sdk = require('@defillama/sdk') -const { get } = require('../helper/http') +const { getConfig } = require('../helper/cache') const { getAssetInfo, } = require("../helper/chain/algorand"); const { transformBalances } = require('../helper/portedTokens') @@ -11,8 +11,8 @@ const blacklistedTokens = [ ] async function dex() { - let lpTokens = (await get("https://api.algofi.org/ammLPTokens?network=MAINNET")).map(i => i.asset_id); - // let lpTokens = (await get("https://api.algofi.org/pools?network=MAINNET")).map(i => i.lp_asset_id); + let lpTokens = (await getConfig('algofi-swap',"https://api.algofi.org/ammLPTokens?network=MAINNET")).map(i => i.asset_id); + // let lpTokens = (await getConfig('algofi-swap',"https://api.algofi.org/pools?network=MAINNET")).map(i => i.lp_asset_id); lpTokens = [...new Set(lpTokens)] const lpData = await Promise.all(lpTokens.map(getAssetInfo)) const balances = {} diff --git a/projects/algofi/index.js b/projects/algofi/index.js index 0ef1c1e81e3..00dda959e4f 100644 --- a/projects/algofi/index.js +++ b/projects/algofi/index.js @@ -90,6 +90,9 @@ async function staking() { } module.exports = { + hallmarks: [ + [1688947200, "Winding down of protocol"] + ], timetravel: false, misrepresentedTokens: true, algorand: { diff --git a/projects/algomint/index.js b/projects/algomint/index.js index 3867a0ee30c..ecf9f2f3508 100644 --- a/projects/algomint/index.js +++ b/projects/algomint/index.js @@ -1,19 +1,69 @@ -const goUsdBasketAddress = "SORHGFCFW4DMJRG33OBWQ5X5YQMRPHK3P5ITMBFMRCVNX74WAOOMLK32F4"; -const { sumTokens, tokens } = require('../helper/chain/algorand') +const { tokens } = require("../helper/chain/algorand"); + +const { lpTokenPostion } = require("./utils"); + +//Algomint Basket contracts where the liquidty is held +const goUsdcBasketAddress = + "S3VJZN4AXUP3IZKE4O7TUN6LRIEYNJCMXQSFP6DPGUKU6YYK2VLN2W7DXA"; +const goUsdtBasketAddress = + "CX7ICRT4HRKHZSSYYMW765AKSBDH3XJBQZ2DXN32DCWTD2732RVHR25Y5Q"; +const goBtcBasketAddress = + "MGGJI6CKRMIEN7CGXY2SK3KTPRCXW4SNPDPN4G7RWON4DB4262G4IRFHXE"; +const goEthBasketAddress = + "IUTNDPUTZ5MKFFIZ5L7MG35I5WXS64LLJKVXRTJNJISBRPOTOAM3DA65CY"; + +//The following pool ID's are the PACT LP pool contracts +const usdcPoolId = 885102197; +const usdtPoolId = 1081978547; +const wBtcPoolId = 1058934586; +const wEthPoolId = 1058935016; async function tvl() { - const balances = await sumTokens({ - owner: goUsdBasketAddress, - blacklistedTokens: [ tokens.goUsd, ], - blacklistOnLpAsWell: true, - tinymanLps: [ [tokens.usdcGoUsdLp,], ], - }) - return balances + //Returns the position of the LP token. + const usdcPostion = await lpTokenPostion( + tokens.usdcGoUsdLp, + usdcPoolId, + goUsdcBasketAddress + ); + + const usdtPosition = await lpTokenPostion( + tokens.usdtGoUsdLp, + usdtPoolId, + goUsdtBasketAddress + ); + + const wBtcPosition = await lpTokenPostion( + tokens.wBtcGoBtcLp, + wBtcPoolId, + goBtcBasketAddress + ); + + const wEthPosition = await lpTokenPostion( + tokens.wEthGoEthLp, + wEthPoolId, + goEthBasketAddress + ); + + //positionA is USDC in the LP + const usdcTvlvalue = usdcPostion.positionA / 10 ** 6; + //positionA is USDT in the LP + const usdtTvlValue = usdtPosition.positionA / 10 ** 6; + //positionB is wBTC in the LP + + const wBtcTvlValue = wBtcPosition.positionB / 10 ** 8; + //positionB is wEth in the LP + const wEthTvlValue = wEthPosition.positionB / 10 ** 8; + return { + bitcoin: wBtcTvlValue, + ethereum: wEthTvlValue, + tether: usdtTvlValue, + usd: usdcTvlvalue, + }; } module.exports = { timetravel: false, algorand: { - tvl - } -} + tvl, + }, +}; diff --git a/projects/algomint/utils.js b/projects/algomint/utils.js new file mode 100644 index 00000000000..a5e01cb6502 --- /dev/null +++ b/projects/algomint/utils.js @@ -0,0 +1,37 @@ +const { + getAppGlobalState, + getAccountInfo, +} = require("../helper/chain/algorand"); + +async function lpTokenPostion(asaId, appId, basketAddress) { + const poolGlobalState = await getAppGlobalState(appId); + + //A & B represent the two tokens in the LP pool, Token A is always the ASA with the lowest ID + + const balanceA = poolGlobalState.A; + const balanceB = poolGlobalState.B; + const lpCirculatingSupply = poolGlobalState.L; + + const ratioA = balanceA / lpCirculatingSupply; + const ratioB = balanceB / lpCirculatingSupply; + + //get basket balance of lp token + const basketBalance = await getAccountInfo(basketAddress); + + const basketLpBalanceObject = basketBalance.assets; + let basketLpBalance; + + for (let lpAsset of basketLpBalanceObject) { + if (lpAsset["asset-id"] === asaId) { + basketLpBalance = lpAsset.amount; + } + } + const positionA = basketLpBalance * ratioA; + const positionB = basketLpBalance * ratioB; + + return { positionA: positionA, positionB: positionB }; +} + +module.exports = { + lpTokenPostion, +}; diff --git a/projects/algorai-finance/constants.js b/projects/algorai-finance/constants.js index 049abcf2d62..975079ea9af 100644 --- a/projects/algorai-finance/constants.js +++ b/projects/algorai-finance/constants.js @@ -6,35 +6,53 @@ const vaults = [ // v1.0 { vaultID: 878144513, - depositAssetID: 0, assetDecimals: 6, coingecko: 'algorand', - stable: false }, { vaultID: 878140320, - depositAssetID: 31566704, assetDecimals: 6, coingecko: 'usd-coin', - stable: true }, // v1.1 { vaultID: 919531421, - depositAssetID: 0, assetDecimals: 6, coingecko: 'algorand', - stable: false }, { vaultID: 919539218, - depositAssetID: 31566704, assetDecimals: 6, coingecko: 'usd-coin', - stable: true + }, + { + vaultID: 1004309470, + assetDecimals: 8, + coingecko: 'bitcoin', + }, + { + vaultID: 1004325987, + assetDecimals: 6, + coingecko: 'usd-coin', + }, + { + vaultID: 1004326861, + assetDecimals: 8, + coingecko: 'ethereum', + }, + { + vaultID: 1004374058, + assetDecimals: 6, + coingecko: 'usd-coin', + }, + { + vaultID: 1097368119, + assetDecimals: 4, + coingecko: 'pepe', }, ]; + module.exports = { vaults, }; diff --git a/projects/algorai-finance/index.js b/projects/algorai-finance/index.js index 7165a306cc9..7e9ee64588b 100644 --- a/projects/algorai-finance/index.js +++ b/projects/algorai-finance/index.js @@ -22,10 +22,9 @@ async function tvl() { return balances } - module.exports = { timetravel: false, algorand: { tvl, }, -}; +}; \ No newline at end of file diff --git a/projects/algorai-finance/utils.js b/projects/algorai-finance/utils.js index 86b8ccf0265..0cfd7e875e1 100644 --- a/projects/algorai-finance/utils.js +++ b/projects/algorai-finance/utils.js @@ -1,4 +1,4 @@ -const {lookupApplications} = require("../helper/chain/algorand"); +const { lookupApplications } = require("../helper/chain/algorand"); /** * @desc Read global state from algorand application @@ -28,24 +28,22 @@ const decodeString = (str) => { * @param keys - Asset keys to find. */ const readGlobalState = async (appIndex, keys) => { - return new Promise(async (resolve, reject) => { - const states = await getAppState(appIndex) + const states = await getAppState(appIndex) - const foundedState = []; + const foundedState = []; - for (let i = 0; i < states.length; i++) { - const state = states[i]; - const stateKey = decodeString(state.key); + for (let i = 0; i < states.length; i++) { + const state = states[i]; + const stateKey = decodeString(state.key); - keys.forEach((key, index) => { - if (key === stateKey) { - foundedState[index] = state.value.uint; - } - }); + keys.forEach((key, index) => { + if (key === stateKey) { + foundedState[index] = state.value.uint; + } + }); - } - resolve(foundedState); - }); + } + return foundedState }; module.exports = { diff --git a/projects/alienfi/index.js b/projects/alienfi/index.js new file mode 100644 index 00000000000..aebdb881ee7 --- /dev/null +++ b/projects/alienfi/index.js @@ -0,0 +1,16 @@ +const { getUniTVL, staking } = require("../helper/unknownTokens"); + +const arbiFactory = "0xac9d019B7c8B7a4bbAC64b2Dbf6791ED672ba98B"; +const arbiStaking = "0xCf8D01c1a20dabcC025368607020473cCb119F5C"; +// const arbiPoolStaking = "0xf0E1cE233Bf3DF4f19F36aD03D98faf52E9fD653"; +const arbiAlien = "0x6740Acb82ac5C63A7ad2397ee1faed7c788F5f8c"; +const AlienUsdcLP = "0xE145A5710Be68C3C9C50c5288909E813c5e92F4e"; + +module.exports = { + misrepresentedTokens: true, + methodology: "TVL consists of pools created by the factory contract", + arbitrum: { + tvl: getUniTVL({ factory: arbiFactory, useDefaultCoreAssets: true, }), + staking: staking({ tokensAndOwners: [[arbiAlien, arbiStaking]], lps: [AlienUsdcLP] }) + }, +}; diff --git a/projects/alita-finance/index.js b/projects/alita-finance/index.js index 2d1350b737d..dc30078f2ae 100644 --- a/projects/alita-finance/index.js +++ b/projects/alita-finance/index.js @@ -1,33 +1,14 @@ -const sdk = require("@defillama/sdk"); -const {calculateUniTvl} = require('../helper/calculateUniTvl.js') +const { getUniTVL } = require('../helper/unknownTokens') +const { staking } = require('../helper/staking') const ALI_TOKEN = '0x557233E794d1a5FbCc6D26dca49147379ea5073c' const ALI_FACTORY = "0xC7a506ab3ac668EAb6bF9eCf971433D6CFeF05D9"; const ALI_MASTER_CHEF = '0x4f7b2Be2bc3C61009e9aE520CCfc830612A10694' - - -async function bscTvl(timestamp, block, chainBlocks) { - return calculateUniTvl(addr=>`bsc:${addr}`, chainBlocks['bsc'], 'bsc', ALI_FACTORY, 0, true); -} - -async function poolsTvl(timestamp, ethBlock, chainBlocks) { - const balances = {}; - const stakedAli = sdk.api.erc20.balanceOf({ - target: ALI_TOKEN, - owner: ALI_MASTER_CHEF, - chain: 'bsc', - block: chainBlocks.bsc - }) - sdk.util.sumSingleBalance(balances, 'bsc:' + ALI_TOKEN, (await stakedAli).output) - return balances -} - module.exports = { misrepresentedTokens: true, - bsc:{ - tvl: bscTvl, - staking: poolsTvl - }, - methodology: "The TVL is the total of all liquidity pools. The staking TVL is accounted as the ALI on MasterChef(0x4f7b2Be2bc3C61009e9aE520CCfc830612A10694)", + bsc: { + tvl: getUniTVL({ factory: ALI_FACTORY, useDefaultCoreAssets: true,}), + staking: staking(ALI_MASTER_CHEF, ALI_TOKEN), + } } \ No newline at end of file diff --git a/projects/aliumswap/index.js b/projects/aliumswap/index.js index 75912ea9e59..bec32848be2 100644 --- a/projects/aliumswap/index.js +++ b/projects/aliumswap/index.js @@ -7,7 +7,7 @@ const stakingPool1 = "0x4f388167F8B52F89C87A4E46706b9C1408F2c137"; // Old Strong module.exports = { bsc: { - tvl: getUniTVL({ chain: 'bsc', factory: '0xbEAC7e750728e865A3cb39D5ED6E3A3044ae4B98', useDefaultCoreAssets: true, }), - staking: stakings([stakingPool0, stakingPool1, ], ALMToken, 'bsc'), + tvl: getUniTVL({ factory: '0xbEAC7e750728e865A3cb39D5ED6E3A3044ae4B98', useDefaultCoreAssets: true, }), + staking: stakings([stakingPool0, stakingPool1, ], ALMToken), }, }; diff --git a/projects/alkemi/index.js b/projects/alkemi/index.js index d193f0810bd..dda8ab3dd4d 100644 --- a/projects/alkemi/index.js +++ b/projects/alkemi/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') /*================================================== Modules ==================================================*/ @@ -12,7 +13,7 @@ const BigNumber = require('bignumber.js'); ==================================================*/ -const etherAddress = '0x0000000000000000000000000000000000000000'; +const etherAddress = ADDRESSES.null; const alkPools = [ '0x397c315d64D74d82A731d656f9C4D586D200F90A', // Alkemi Earn '0x4822D9172e5b76b9Db37B75f5552F9988F98a888', // Alkemi Earn Open @@ -20,9 +21,9 @@ const alkPools = [ const alkTokens = [ '0x8125afd067094cD573255f82795339b9fe2A40ab', // WETH, Alkemi Earn Open '0x1f52453B32BFab737247114D56d756A6c37dd9Ef', // WETH, Alkemi Earn - '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599', // WBTC - '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', // USDC - '0x6B175474E89094C44Da98b954EedeAC495271d0F', // DAI + ADDRESSES.ethereum.WBTC, // WBTC + ADDRESSES.ethereum.USDC, // USDC + ADDRESSES.ethereum.DAI, // DAI ]; async function tvl(timestamp, block) { @@ -64,7 +65,7 @@ async function tvl(timestamp, block) { //console.table(balances); // for debugging return balances; -}; +} /*================================================== Exports diff --git a/projects/allbridge/index.js b/projects/allbridge/index.js index a5f56d0e0bf..50f5395befa 100644 --- a/projects/allbridge/index.js +++ b/projects/allbridge/index.js @@ -1,7 +1,8 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk') const solana = require('../helper/solana') -const terra = require('../helper/chain/terra') +const cosmos = require('../helper/chain/cosmos') const { staking } = require('../helper/staking'); const near = require('../helper/chain/near'); const { default: BigNumber } = require('bignumber.js'); @@ -17,8 +18,8 @@ const data = { decimals: 18 }, tokens: [ - {name: "celo-dollar", address: "0x765DE816845861e75A25fCA122bb6898B8B1282a", decimals: 18}, - {name: "usd-coin", address: "0x2A3684e9Dc20B857375EA04235F2F7edBe818FA7", decimals: 6}, + {name: "celo-dollar", address: ADDRESSES.celo.cUSD, decimals: 18}, + {name: "usd-coin", address: ADDRESSES.celo.USDC, decimals: 6}, {name: "poofcash", address: "0x00400FcbF0816bebB94654259de7273f4A05c762", decimals: 18}, {name: "celo-euro", address: "0xD8763CBa276a3738E6DE85b4b3bF5FDed6D6cA73", decimals: 18}, {name: "celo", address: NATIVE_ADDRESS, decimals: 18}, @@ -33,10 +34,10 @@ const data = { }, tokens: [ {name: "avalanche-2", address: NATIVE_ADDRESS, decimals: 18}, - {name: "usd-coin", address: "0xA7D7079b0FEaD91F3e65f86E8915Cb59c1a4C664", decimals: 6}, - {name: "tether", address: "0xc7198437980c041c805A1EDcbA50c1Ce5db95118", decimals: 6}, + {name: "usd-coin", address: ADDRESSES.avax.USDC_e, decimals: 6}, + {name: "tether", address: ADDRESSES.avax.USDT_e, decimals: 6}, {name: "bitcoin", address: "0x50b7545627a5162F82A992c33b87aDc75187B218", decimals: 8}, - {name: "dai", address: "0xd586E7F844cEa2F87f50152665BCbc2C279D8d70", decimals: 18} + {name: "dai", address: ADDRESSES.avax.DAI, decimals: 18} ] }, fantom: { @@ -49,8 +50,8 @@ const data = { tokens: [ {name: "bitcoin", address: "0x321162Cd933E2Be498Cd2267a90534A804051b11", decimals: 8}, {name: "ethereum", address: "0x74b23882a30290451A17c44f4F05243b6b58C76d", decimals: 18}, - {name: "usd-coin", address: "0x04068DA6C83AFCFA0e13ba15A6696662335D5B75", decimals: 6}, - {name: "dai", address: "0x8D11eC38a3EB5E956B052f67Da8Bdc9bef8Abf3E", decimals: 18}, + {name: "usd-coin", address: ADDRESSES.fantom.USDC, decimals: 6}, + {name: "dai", address: ADDRESSES.fantom.DAI, decimals: 18}, {name: "chainlink", address: "0xb3654dc3D10Ea7645f8319668E8F54d2574FBdC8", decimals: 18}, {name: "fantom", address: NATIVE_ADDRESS, decimals: 18}, ] @@ -64,7 +65,7 @@ const data = { }, tokens: [ {name: "bitcoin", address: "0x66a79D23E58475D2738179Ca52cd0b41d73f0BEa", decimals: 18}, - {name: "tether", address: "0xa71EdC38d189767582C38A3145b5873052c3e47a", decimals: 18}, + {name: "tether", address: ADDRESSES.heco.USDT, decimals: 18}, {name: "apyswap", address: "0x90e8896b12a92D51CD213b681C2CaD83A9a6bD49", decimals: 18}, ] @@ -78,12 +79,12 @@ const data = { }, tokens: [ {name: "mimatic", address: "0xa3Fa99A148fA48D14Ed51d610c367C61876997F1", decimals: 18}, - {name: "usd-coin", address: "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174", decimals: 6}, - {name: "tether", address: "0xc2132D05D31c914a87C6611C10748AEb04B58e8F", decimals: 6}, + {name: "usd-coin", address: ADDRESSES.polygon.USDC, decimals: 6}, + {name: "tether", address: ADDRESSES.polygon.USDT, decimals: 6}, {name: "matic-network", address: NATIVE_ADDRESS, decimals: 18}, - {name: "ethereum", address: "0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619", decimals: 18}, - {name: "bitcoin", address: "0x1BFD67037B42Cf73acF2047067bd4F2C47D9BfD6", decimals: 8}, - {name: "dai", address: "0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063", decimals: 18}, + {name: "ethereum", address: ADDRESSES.polygon.WETH_1, decimals: 18}, + {name: "bitcoin", address: ADDRESSES.polygon.WBTC, decimals: 8}, + {name: "dai", address: ADDRESSES.polygon.DAI, decimals: 18}, {name: "apyswap", address: "0x14743E1c6f812154F7ecc980D890F0F5234103e7", decimals: 18}, ] }, @@ -97,12 +98,12 @@ const data = { tokens: [ {name: "impossible-finance", address: "0xB0e1fc65C1a741b4662B813eB787d369b8614Af1", decimals: 18}, {name: "krown", address: "0x1446f3CEdf4d86a9399E49f7937766E6De2A3AAB", decimals: 18}, - {name: "binance-usd", address: "0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56", decimals: 18}, - {name: "investin", address: "0x6A46d878401F46B4C7f665f065E0667580e031ec", decimals: 18}, - {name: "tether", address: "0x55d398326f99059fF775485246999027B3197955", decimals: 18}, - {name: "usd-coin", address: "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d", decimals: 18}, - {name: "bitcoin", address: "0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c", decimals: 18}, - {name: "ethereum", address: "0x2170Ed0880ac9A755fd29B2688956BD959F933F8", decimals: 18}, + {name: "binance-usd", address: ADDRESSES.bsc.BUSD, decimals: 18}, + {name: "investin", address: ADDRESSES.bsc.IVN, decimals: 18}, + {name: "tether", address: ADDRESSES.bsc.USDT, decimals: 18}, + {name: "usd-coin", address: ADDRESSES.bsc.USDC, decimals: 18}, + {name: "bitcoin", address: ADDRESSES.bsc.BTCB, decimals: 18}, + {name: "ethereum", address: ADDRESSES.bsc.ETH, decimals: 18}, {name: "binancecoin", address: NATIVE_ADDRESS, decimals: 18}, {name: "uniswap", address: "0xBf5140A22578168FD562DCcF235E5D43A02ce9B1", decimals: 18}, {name: "chainlink", address: "0xF8A0BF9cF54Bb92F17374d9e9A321E6a111a51bD", decimals: 18}, @@ -124,16 +125,16 @@ const data = { {name: "ariadne", address: "0xb1c9bc94aCd2fAE6aABf4ffae4429B93512a81D2", decimals: 18}, {name: "cyberfi", address: "0x63b4f3e3fa4e438698CE330e365E831F7cCD1eF4", decimals: 18}, {name: "ethereum", address: NATIVE_ADDRESS, decimals: 18}, - {name: "usd-coin", address: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", decimals: 6}, - {name: "tether", address: "0xdAC17F958D2ee523a2206206994597C13D831ec7", decimals: 6}, + {name: "usd-coin", address: ADDRESSES.ethereum.USDC, decimals: 6}, + {name: "tether", address: ADDRESSES.ethereum.USDT, decimals: 6}, {name: "ftx-token", address: "0x50D1c9771902476076eCFc8B2A83Ad6b9355a4c9", decimals: 18}, - {name: "dai", address: "0x6B175474E89094C44Da98b954EedeAC495271d0F", decimals: 18}, - {name: "bitcoin", address: "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", decimals: 8}, + {name: "dai", address: ADDRESSES.ethereum.DAI, decimals: 18}, + {name: "bitcoin", address: ADDRESSES.ethereum.WBTC, decimals: 8}, {name: "magic-internet-money", address: "0x99D8a9C45b2ecA8864373A26D1459e3Dff1e17F3", decimals: 18}, {name: "fei-usd", address: "0x956F47F50A910163D8BF957Cf5846D573E7f87CA", decimals: 18}, {name: "thorstarter", address: "0x69fa0feE221AD11012BAb0FdB45d444D3D2Ce71c", decimals: 18}, - {name: "uniswap", address: "0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984", decimals: 18}, - {name: "chainlink", address: "0x514910771AF9Ca656af840dff83E8264EcF986CA", decimals: 18}, + {name: "uniswap", address: ADDRESSES.ethereum.UNI, decimals: 18}, + {name: "chainlink", address: ADDRESSES.ethereum.LINK, decimals: 18}, {name: "smartpad", address: "0x5067006f830224960fb419d7f25a3a53e9919bb0", decimals: 18}, ] }, @@ -230,19 +231,13 @@ async function solanaStaking() { } async function terraTvl() { - const balances = {} - for (const token of terraData.tokens) { - const balance = token.address.length > 5 - ? await terra.getBalance(token.address, terraData.contractAddress) - : await terra.getDenomBalance(token.address, terraData.contractAddress); - sdk.util.sumSingleBalance(balances, token.name, toNumber(token.decimals, balance)); - } - return balances + return cosmos.sumTokens({ chain: "terra", owner: terraData.contractAddress }) } + async function terraStaking() { - const balance = await terra.getBalance(terraData.staking.abrAddress, terraData.staking.contractAddress); + const balance = await cosmos.getBalance({ token: terraData.staking.abrAddress, owner: terraData.staking.contractAddress, chain: "terra"}); return { allbridge: toNumber(terraData.staking.decimals, balance) } } diff --git a/projects/allchainbridge/index.js b/projects/allchainbridge/index.js index aa9053200ac..dfa855d1512 100644 --- a/projects/allchainbridge/index.js +++ b/projects/allchainbridge/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens2, nullAddress, } = require('../helper/unwrapLPs') const getBridgeContract = (chain) => { @@ -29,53 +30,53 @@ const getBridgeContract = (chain) => { const tokensConf = { ethereum: { ETH: nullAddress, - BUSD: "0x4Fabb145d64652a948d72533023f6E7A623C7C53", - USDC: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", - USDT: "0xdac17f958d2ee523a2206206994597c13d831ec7", - DAI: "0x6b175474e89094c44da98b954eedeac495271d0f", + BUSD: ADDRESSES.ethereum.BUSD, + USDC: ADDRESSES.ethereum.USDC, + USDT: ADDRESSES.ethereum.USDT, + DAI: ADDRESSES.ethereum.DAI, HBTC: "0x0316EB71485b0Ab14103307bf65a021042c6d380", - WETH: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + WETH: ADDRESSES.ethereum.WETH, SWFTC: "0x0bb217e40f8a5cb79adf04e1aab60e5abd0dfc1e", HT: "0x6f259637dcd74c767781e37bc6133cd6a68aa161", }, bsc: { BNB: nullAddress, - BUSD: "0xe9e7cea3dedca5984780bafc599bd69add087d56", - USDC: "0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d", - USDT: "0x55d398326f99059fF775485246999027B3197955", + BUSD: ADDRESSES.bsc.BUSD, + USDC: ADDRESSES.bsc.USDC, + USDT: ADDRESSES.bsc.USDT, DAI: "0x1af3f329e8be154074d8769d1ffa4ee058b1dbc3", - WBNB: "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c", - BTCB: "0x7130d2a12b9bcbfae4f2634d864a1ee1ce3ead9c", - ETH: "0x2170ed0880ac9a755fd29b2688956bd959f933f8", + WBNB: ADDRESSES.bsc.WBNB, + BTCB: ADDRESSES.bsc.BTCB, + ETH: ADDRESSES.bsc.ETH, SWFTC: "0xe64e30276c2f826febd3784958d6da7b55dfbad3", DOGE: "0xba2ae424d960c26247dd6c32edc70b295c744c43", }, heco: { HT: nullAddress, - USDC: "0x9362bbef4b8313a8aa9f0c9808b80577aa26b73b", - USDT: "0xa71edc38d189767582c38a3145b5873052c3e47a", + USDC: ADDRESSES.heco.USDC_HECO, + USDT: ADDRESSES.heco.USDT, HUSD: "0x0298c2b32eae4da002a15f36fdf7615bea3da047", ETH: "0x64ff637fb478863b7468bc97d30a5bf3a428a1fd", SWFTC: "0x329dda64Cbc4DFD5FA5072b447B3941CE054ebb3", }, okexchain: { OKT: nullAddress, - USDC: "0xc946daf81b08146b1c7a8da2a851ddf2b3eaaf85", - USDT: "0x382bb369d343125bfb2117af9c149795c6c65c50", - ETH: "0xef71ca2ee68f45b9ad6f72fbdb33d707b872315c", - OKB: "0xdf54b6c6195ea4d948d03bfd818d365cf175cfc2", + USDC: ADDRESSES.okexchain.USDC, + USDT: ADDRESSES.okexchain.USDT, + ETH: ADDRESSES.okexchain.ETHK, + OKB: ADDRESSES.okexchain.OKB, }, polygon: { MATIC: nullAddress, - USDC: "0x2791bca1f2de4661ed88a30c99a7a9449aa84174", - USDT: "0xc2132d05d31c914a87c6611c10748aeb04b58e8f", - WMATIC: "0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270", + USDC: ADDRESSES.polygon.USDC, + USDT: ADDRESSES.polygon.USDT, + WMATIC: ADDRESSES.polygon.WMATIC_2, }, fantom: { FTM: nullAddress, - USDC: "0x04068DA6C83AFCFA0e13ba15A6696662335D5B75", - USDT: "0x049d68029688eabf473097a2fc38ef61633a3c7a", - DAI: "0x8d11ec38a3eb5e956b052f67da8bdc9bef8abf3e", + USDC: ADDRESSES.fantom.USDC, + USDT: ADDRESSES.fantom.fUSDT, + DAI: ADDRESSES.fantom.DAI, WETH: "0x74b23882a30290451A17c44f4F05243b6b58C76d", }, kava: { diff --git a/projects/alligator-exchange/index.js b/projects/alligator-exchange/index.js index f27c8da1e33..7ba232276a3 100644 --- a/projects/alligator-exchange/index.js +++ b/projects/alligator-exchange/index.js @@ -1,42 +1,14 @@ -const { calculateUniTvl } = require("../helper/calculateUniTvl"); +const { uniTvlExport } = require("../helper/calculateUniTvl"); const { stakingUnknownPricedLP } = require("../helper/staking"); -const sdk = require("@defillama/sdk"); -const { default: BigNumber } = require("bignumber.js"); const token = "0x43C812Ba28cb061b1Be7514145A15C9E18a27342"; const stakingContract = "0x32A948F018870548bEd7e888Cd97a257b700D4c6"; const factory = "0xD9362AA8E0405C93299C573036E7FB4ec3bE1240" -async function getGtrPrice (block) { - const chain = "avax"; - const usdtBalance = (await sdk.api.erc20.balanceOf({ - target: "0xc7198437980c041c805a1edcba50c1ce5db95118", - owner: "0x039b4C79916b7ACc953f0f67e6181842EFBE6e6e", - block, - chain - })).output; - const gtrBalance = (await sdk.api.erc20.balanceOf({ - target: "0x43C812Ba28cb061b1Be7514145A15C9E18a27342", - owner: "0x039b4C79916b7ACc953f0f67e6181842EFBE6e6e", - block, - chain - })).output; - const gtrPrice = usdtBalance/gtrBalance; - return gtrPrice -} - -async function tvl(timestamp, block, chainBlocks) { - let balances = await calculateUniTvl(addr=>`avax:${addr}`, chainBlocks.avax, "avax", factory, 0, true); - const gtrPrice = await getGtrPrice(chainBlocks.avax); - sdk.util.sumSingleBalance(balances, `avax:0x19860ccb0a68fd4213ab9d8266f7bbf05a8dde98`, BigNumber(balances["avax:0x43c812ba28cb061b1be7514145a15c9e18a27342"]).times(gtrPrice).times(10 ** 12).toFixed(0)); - delete balances["avax:0x43c812ba28cb061b1be7514145a15c9e18a27342"]; - return balances; -} - module.exports = { misrepresentedTokens: true, avax:{ - tvl, + tvl: uniTvlExport(factory, 'avax', true), staking: stakingUnknownPricedLP(stakingContract, token, "avax", "0x039b4C79916b7ACc953f0f67e6181842EFBE6e6e") } } \ No newline at end of file diff --git a/projects/alongside/index.js b/projects/alongside/index.js new file mode 100644 index 00000000000..d83daf385e4 --- /dev/null +++ b/projects/alongside/index.js @@ -0,0 +1,20 @@ +const sdk = require("@defillama/sdk"); + +const INDEX = "0xF17A3fE536F8F7847F1385ec1bC967b2Ca9caE8D"; + +async function tvl(_, block, _cb) { + const balances = {} + const supply = await sdk.api2.abi.call({ abi: 'uint256:totalSupply', target: INDEX, block }) + sdk.util.sumSingleBalance(balances, INDEX, supply, 'ethereum') + return balances +} + +module.exports = { + doublecounted: true, + misrepresentedTokens: true, + methodology: + "Data is retrieved from calculation of market price and total supply", + ethereum: { + tvl, + }, +}; diff --git a/projects/alpaca-finance-lend/abi.json b/projects/alpaca-finance-lend/abi.json new file mode 100644 index 00000000000..ba568317cd3 --- /dev/null +++ b/projects/alpaca-finance-lend/abi.json @@ -0,0 +1,6 @@ +{ + "vaultDebtVal": "uint256:vaultDebtVal", + "totalToken": "uint256:totalToken", + "pendingInterest": "function pendingInterest(uint256 value) public view returns (uint256)", + "balanceOf": "function balanceOf(address account) view returns (uint256)" +} \ No newline at end of file diff --git a/projects/alpaca-finance-lend/index.js b/projects/alpaca-finance-lend/index.js new file mode 100644 index 00000000000..4ddec9ca94f --- /dev/null +++ b/projects/alpaca-finance-lend/index.js @@ -0,0 +1,9 @@ +const { tvl, borrowed } = require("./lend"); + +// node test.js projects/alpaca-finance-lend/index.js +module.exports = { + start: 1602054167, + methodology: "Sum floating balance and vaultDebtValue in each vault", + bsc: { tvl, borrowed, }, + fantom: { tvl, borrowed, }, +}; diff --git a/projects/alpaca-finance-lend/lend.js b/projects/alpaca-finance-lend/lend.js new file mode 100644 index 00000000000..31131b70b9a --- /dev/null +++ b/projects/alpaca-finance-lend/lend.js @@ -0,0 +1,38 @@ +const { getProcolAddresses } = require("../alpaca-finance/lyf"); +const abi = require("./abi.json"); +const { sumTokens2 } = require('../helper/unwrapLPs') + +async function tvl(_, _b, _cb, { api, }) { + /// @dev Getting all addresses from Github + const addresses = await getProcolAddresses(api.chain) + return sumTokens2({ api, tokensAndOwners: addresses["Vaults"].map(v => [v.baseToken, v.address]) }) +} + +async function borrowed(_, _b, _cb, { api, }) { + /// @dev Getting all addresses from Github + const addresses = await getProcolAddresses(api.chain); + + const vaultsDebtVal = await api.multiCall({ + abi: abi.vaultDebtVal, + calls: addresses["Vaults"].map((v) => v.address), + }) + + const vaultsPendingInterest = await pendingInterest(addresses, api); + addresses["Vaults"].forEach((v, i) => { + api.add(v.baseToken, +vaultsPendingInterest[i] + +vaultsDebtVal[i]) + }) +} + +async function pendingInterest(addresses, api) { + return api.multiCall({ + abi: abi.pendingInterest, + calls: addresses["Vaults"].map((v) => { + return { target: v.address, params: [0] }; + }), + }) +} + +module.exports = { + tvl, + borrowed, +}; diff --git a/projects/alpaca-finance-v2/abi.json b/projects/alpaca-finance-v2/abi.json new file mode 100644 index 00000000000..8650c709ef6 --- /dev/null +++ b/projects/alpaca-finance-v2/abi.json @@ -0,0 +1,4 @@ +{ + "getFloatingBalance": "function getFloatingBalance(address _token) external view returns (uint256 _floating)", + "getGlobalDebtValueWithPendingInterest": "function getGlobalDebtValueWithPendingInterest(address _token) external view returns (uint256)" +} \ No newline at end of file diff --git a/projects/alpaca-finance-v2/index.js b/projects/alpaca-finance-v2/index.js new file mode 100644 index 00000000000..546dabaa96c --- /dev/null +++ b/projects/alpaca-finance-v2/index.js @@ -0,0 +1,10 @@ +const { lendingTvl, borrowTvl } = require("./moneyMarket"); + +module.exports = { + start: 1602054167, + methodology: "Sum floating balance and borrow for each token", + bsc: { + tvl: lendingTvl, + borrowed: borrowTvl + }, +}; \ No newline at end of file diff --git a/projects/alpaca-finance-v2/moneyMarket.js b/projects/alpaca-finance-v2/moneyMarket.js new file mode 100644 index 00000000000..d469aacc7e8 --- /dev/null +++ b/projects/alpaca-finance-v2/moneyMarket.js @@ -0,0 +1,30 @@ +const sdk = require("@defillama/sdk"); +const abi = require("./abi.json"); +const { getConfig } = require("../helper/cache"); +const { sumTokens2 } = require('../helper/unwrapLPs') + +async function getMoneyMarketData() { + return (await getConfig("alpaca-finance-2.0", "https://raw.githubusercontent.com/alpaca-finance/alpaca-v2-money-market/main/.mainnet.json")).moneyMarket; +} + +async function lendingTvl(ts, _, _1, {api}) { + const { moneyMarketDiamond, markets } = await getMoneyMarketData(); + return sumTokens2({ api, owner: moneyMarketDiamond, tokens: markets.map(i => i.token)}) +} + +async function borrowTvl(ts, _, _1, {api}) { + const { moneyMarketDiamond, markets } = await getMoneyMarketData(); + const tokens = markets.map(i => i.token) + + const borrows = (await api.multiCall({ + abi: abi.getGlobalDebtValueWithPendingInterest, + target: moneyMarketDiamond, + calls: tokens + })) + api.addTokens(tokens, borrows) +} + +module.exports = { + lendingTvl, + borrowTvl +} \ No newline at end of file diff --git a/projects/alpaca-finance/abi.json b/projects/alpaca-finance/abi.json index d8c602cba44..ec31a9cd8a0 100644 --- a/projects/alpaca-finance/abi.json +++ b/projects/alpaca-finance/abi.json @@ -1,217 +1,16 @@ { - "vaultDebtVal": { - "inputs": [], - "name": "vaultDebtVal", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "totalToken": { - "inputs": [], - "name": "totalToken", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "token": { - "inputs": [], - "name": "token", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "pid": { - "inputs": [], - "name": "pid", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "reservePool": { - "inputs": [], - "name": "reservePool", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "balanceOf": { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "totalSupply": { - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "lpToken": { - "inputs": [], - "name": "lpToken", - "outputs": [ - { - "internalType": "contract IPancakePair", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "userInfo": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "userInfo", - "outputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "rewardDebt", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "userInfoCake": { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "userInfo", - "outputs": [ - { - "internalType": "uint256", - "name": "shares", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastDepositedTime", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "singleAssetPrice":{ - "inputs": [], - "name": "getPricePerFullShare", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "pId": { - "inputs": [], - "name": "pid", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "ausdTotalStablecoinIssued": { - "inputs": [], - "name": "totalStablecoinIssued", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "xalpacaTotalSupply": { - "inputs": [], - "name": "supply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -} + "vaultDebtVal": "uint256:vaultDebtVal", + "totalToken": "uint256:totalToken", + "token": "address:token", + "pid": "uint256:pid", + "reservePool": "uint256:reservePool", + "balanceOf": "function balanceOf(address account) view returns (uint256)", + "totalSupply": "uint256:totalSupply", + "lpToken": "address:lpToken", + "userInfo": "function userInfo(uint256, address) view returns (uint256 amount, uint256 rewardDebt)", + "userInfoCake": "function userInfo(address) view returns (uint256 shares, uint256 lastDepositedTime)", + "singleAssetPrice": "uint256:getPricePerFullShare", + "pId": "uint256:pid", + "ausdTotalStablecoinIssued": "uint256:totalStablecoinIssued", + "xalpacaTotalSupply": "uint256:supply" +} \ No newline at end of file diff --git a/projects/alpaca-finance/ausd.js b/projects/alpaca-finance/ausd.js index 791340de526..9c96cb515dc 100644 --- a/projects/alpaca-finance/ausd.js +++ b/projects/alpaca-finance/ausd.js @@ -1,32 +1,32 @@ const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); const BigNumber = require("bignumber.js"); -const axios = require("axios"); +const { getConfig } = require('../helper/cache') async function getProcolAUSDAddresses(chain) { if (chain == "bsc") { return ( - await axios.get( + await getConfig('alpaca-finance/ausd-bsc', "https://raw.githubusercontent.com/alpaca-finance/alpaca-stablecoin/main/.mainnet.json" ) - ).data; + ); } } async function getProcolLYFAddresses(chain) { if (chain == "bsc") { return ( - await axios.get( + await getConfig('alpaca-finance/lyf-bsc', "https://raw.githubusercontent.com/alpaca-finance/bsc-alpaca-contract/main/.mainnet.json" ) - ).data; + ); } if (chain == "fantom") { return ( - await axios.get( + await getConfig('alpaca-finance/lyf-fantom', "https://raw.githubusercontent.com/alpaca-finance/bsc-alpaca-contract/main/.fantom_mainnet.json" ) - ).data; + ); } } diff --git a/projects/alpaca-finance/index.js b/projects/alpaca-finance/index.js index 034347ce7f6..81ee4eeb265 100644 --- a/projects/alpaca-finance/index.js +++ b/projects/alpaca-finance/index.js @@ -1,6 +1,8 @@ +const sdk = require('@defillama/sdk') const { calLyfTvl } = require("./lyf"); const { calAusdTvl } = require('./ausd'); const { calxALPACAtvl } = require('./xalpaca'); +const aExports = require('../alpaca-finance-lend'); async function bscTvl(timestamp, ethBlock, chainBlocks) { const lyfTvl = await calLyfTvl('bsc', chainBlocks.bsc); @@ -25,11 +27,11 @@ async function ftmStaking(timestamp, ethBlock, chainBlocks) { module.exports = { start: 1602054167, bsc: { - tvl: bscTvl, + tvl: sdk.util.sumChainTvls([bscTvl, aExports.bsc.tvl]), staking: bscStaking, }, fantom: { - tvl: fantomTvl, + tvl: sdk.util.sumChainTvls([fantomTvl, aExports.fantom.tvl]), staking: ftmStaking, } }; diff --git a/projects/alpaca-finance/lyf.js b/projects/alpaca-finance/lyf.js index 6714d71d99f..d448335c577 100644 --- a/projects/alpaca-finance/lyf.js +++ b/projects/alpaca-finance/lyf.js @@ -1,23 +1,23 @@ const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); const BigNumber = require("bignumber.js"); -const axios = require("axios"); +const { getConfig } = require('../helper/cache') const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); async function getProcolAddresses(chain) { if (chain == 'bsc') { return ( - await axios.get( + await getConfig('alpaca-finance/lyf-bsc', "https://raw.githubusercontent.com/alpaca-finance/bsc-alpaca-contract/main/.mainnet.json" ) - ).data; + ) } if (chain == 'fantom') { return ( - await axios.get( + await getConfig('alpaca-finance/lyf-fantom', "https://raw.githubusercontent.com/alpaca-finance/bsc-alpaca-contract/main/.fantom_mainnet.json" ) - ).data; + ) } } @@ -135,33 +135,11 @@ async function calLyfTvl(chain, block) { }); } - /// @dev getting all unused liquidity on each vault - const unusedBTOKEN = ( - await sdk.api.abi.multiCall({ - block, - abi: abi.balanceOf, - calls: addresses["Vaults"].map((v) => { - return { - target: v["baseToken"], - params: [v["address"]], - }; - }), - chain, - }) - ).output; - - unusedBTOKEN.forEach((u) => { - balances[`${chain}:${u.input.target.toLowerCase()}`] = BigNumber( - balances[`${chain}:${u.input.target.toLowerCase()}`] || 0 - ) - .plus(BigNumber(u.output)) - .toFixed(0); - }); - return balances; } module.exports = { - calLyfTvl + calLyfTvl, + getProcolAddresses } \ No newline at end of file diff --git a/projects/alpaca-finance/xalpaca.js b/projects/alpaca-finance/xalpaca.js index de547ebb1c5..490a9dd4037 100644 --- a/projects/alpaca-finance/xalpaca.js +++ b/projects/alpaca-finance/xalpaca.js @@ -1,22 +1,21 @@ const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); -const BigNumber = require("bignumber.js"); -const axios = require("axios"); +const { getConfig } = require('../helper/cache') async function getProcolXAlpacaAddresses(chain) { if (chain == "bsc") { return ( - await axios.get( + await getConfig('alpaca-finance/x-bsc', "https://raw.githubusercontent.com/alpaca-finance/xALPACA-contract/main/.mainnet.json" ) - ).data; + ) } if (chain == "fantom") { return ( - await axios.get( + await getConfig('alpaca-finance/x-fantom', "https://raw.githubusercontent.com/alpaca-finance/xALPACA-contract/main/.fantom_mainnet.json" ) - ).data; + ) } } diff --git a/projects/alpacacity/index.js b/projects/alpacacity/index.js index 77156a32dd0..1fe3e782df7 100644 --- a/projects/alpacacity/index.js +++ b/projects/alpacacity/index.js @@ -1,7 +1,4 @@ const { staking } = require("../helper/staking"); -const { pool2, pool2s } = require("../helper/pool2"); -const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); -const { transformBscAddress } = require("../helper/portedTokens"); /*** Ethereum Addresss ***/ const stakingContracts = [ @@ -17,11 +14,6 @@ const ALPA = "0x7cA4408137eb639570F8E647d9bD7B7E8717514A"; const farmContract = "0x217a7D0Ac6573b0f013e12f92B6d5B250FA15D97"; const WETH_ALPA2_UNIV2 = "0x441f9e2c89a343cefb390a8954b3b562f8f91eca"; -const treasuryContracts = [ - "0xd93DC6B8Ef043C3ad409C6480A57b4851b3C055e", - "0xF30Ccf37c7058Db0026DE9239d373a1c8723210a" -]; - /*** BSC Addresss ***/ const stakingContractBSC = "0xa24FBFE379Ecb914c205BE4d9214592F64194059"; const ALPA_BSC = "0xc5E6689C9c8B02be7C49912Ef19e79cF24977f03"; @@ -39,40 +31,6 @@ const lpPairContractsBSC = [ "0x837cD42282801E340f1F17AAdf3166fEE99fb07c" ] -const treasuryContractsBSC = [ - "0x3226dBce6317dF643EB68bbeF379E6B968b3E669", - "0xb9C76Db167Fa6BFd0e6d78063C63B3073C637497", - "0x6F712F28834b82B7781311b42a945a6134112B2A" -]; - -async function ethTreasury() { - const balances = {}; - - await sumTokensAndLPsSharedOwners( - balances, - [[ALPA, false]], - treasuryContracts - ); - - return balances; -} - -async function bscTreasury(chainBlocks) { - const balances = {}; - - let transform = await transformBscAddress(); - await sumTokensAndLPsSharedOwners( - balances, - [[ALPA_BSC, false]], - treasuryContractsBSC, - chainBlocks["bsc"], - "bsc", - transform - ); - - return balances; -} - async function Staking(...params) { for (const contract of stakingContracts) { return staking(contract, ALPA)(...params) @@ -83,12 +41,10 @@ async function Staking(...params) { module.exports = { ethereum: { tvl: async => ({}), - treasury: ethTreasury, staking: Staking, pool2: staking(farmContract, WETH_ALPA2_UNIV2), }, bsc: { - treasury: bscTreasury, staking: staking(stakingContractBSC, ALPA_BSC, "bsc"), pool2: staking(farmContractsBSC, lpPairContractsBSC, "bsc"), }, diff --git a/projects/alpacafinance-gmx/index.js b/projects/alpacafinance-gmx/index.js new file mode 100644 index 00000000000..94cbf1351f6 --- /dev/null +++ b/projects/alpacafinance-gmx/index.js @@ -0,0 +1,18 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { gmxExports } = require('../helper/gmx') +const { sumTokensExport } = require('../helper/unwrapLPs') + +module.exports = { + bsc:{ + tvl: sumTokensExport({ + owner: '0x18A15bF2Aa1E514dc660Cc4B08d05f9f6f0FdC4e', + tokens: [ + ADDRESSES.bsc.USDC, + ADDRESSES.bsc.USDT, + ADDRESSES.bsc.ETH, + ADDRESSES.bsc.BTCB, + ADDRESSES.bsc.WBNB, + ], + }) + } +}; diff --git a/projects/alpha-homora/abi.json b/projects/alpha-homora/abi.json index b9bc87a5cf4..6a94a49225b 100644 --- a/projects/alpha-homora/abi.json +++ b/projects/alpha-homora/abi.json @@ -1,170 +1,11 @@ { - "glbDebtVal": { - "constant": true, - "inputs": [], - "name": "glbDebtVal", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "totalETH": { - "constant": true, - "inputs": [], - "name": "totalETH", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "reservePool": { - "constant": true, - "inputs": [], - "name": "reservePool", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "balanceOf": { - "constant": true, - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "totalSupply": { - "constant": true, - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "pendingSushi": { - "inputs": [ - { - "internalType": "uint256", - "name": "_pid", - "type": "uint256" - }, - { - "internalType": "address", - "name": "_user", - "type": "address" - } - ], - "name": "pendingSushi", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "userInfo": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "userInfo", - "outputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "rewardDebt", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getETHPx": { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "name": "getETHPx", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "lpToken": { - "constant": true, - "inputs": [], - "name": "lpToken", - "outputs": [ - { - "internalType": "contract IUniswapV2Pair", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } + "glbDebtVal": "uint256:glbDebtVal", + "totalETH": "uint256:totalETH", + "reservePool": "uint256:reservePool", + "balanceOf": "function balanceOf(address account) view returns (uint256)", + "totalSupply": "uint256:totalSupply", + "pendingSushi": "function pendingSushi(uint256 _pid, address _user) view returns (uint256)", + "userInfo": "function userInfo(uint256, address) view returns (uint256 amount, uint256 rewardDebt)", + "getETHPx": "function getETHPx(address token) view returns (uint256)", + "lpToken": "address:lpToken" } \ No newline at end of file diff --git a/projects/alpha-homora/index.js b/projects/alpha-homora/index.js index 9da125d61f6..d512fa9997e 100644 --- a/projects/alpha-homora/index.js +++ b/projects/alpha-homora/index.js @@ -1,9 +1,10 @@ +const ADDRESSES = require('../helper/coreAssets.json') const BigNumber = require("bignumber.js"); const {tvlV1Eth, tvlV1Bsc} = require('./v1.js') const {tvlV2, tvlV2Onchain} = require('./v2.js') async function ethTvl(timestamp, block) { - const ethAddress = "0x0000000000000000000000000000000000000000"; + const ethAddress = ADDRESSES.null; const balances = {}; const tvls = await Promise.all([ @@ -48,10 +49,7 @@ module.exports = { }, start: 1602054167, // unix timestamp (utc 0) specifying when the project began, or where live data begins hallmarks: [ - [1621382400, "DeFi summer, Homora V1 TVL at its peak"], // May 19, 2021 00:00 UTC + [1613178000, "37M exploit"], // Feb 13, 2021 [1626220800, "Upgrade to V2 on ETH"], // July 14, 2021 00:00 UTC - [1634774400, "Homora V2 on Avalanche"], // Oct 21, 2021 00:00 UTC - [1648080000, "Homora V2 on Fantom"], // Mar 24, 2022 00:00 UTC - [1660780800, "Homora V2 on Optimism"], // Aug 18, 2022 00:00 UTC ] }; diff --git a/projects/alpha-homora/v1.js b/projects/alpha-homora/v1.js index c8598e5e53c..0715bfe4d1e 100644 --- a/projects/alpha-homora/v1.js +++ b/projects/alpha-homora/v1.js @@ -1,6 +1,7 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); -const axios = require("axios"); +const { getConfig } = require('../helper/cache') const BigNumber = require("bignumber.js"); module.exports = { @@ -18,7 +19,7 @@ async function tvlV1Eth(timestamp, block) { return tvlV1("ethereum", block, "https://homora.alphafinance.io/static/contracts.json", "WETHAddress", "totalETH") } -const wBNB = '0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c' +const wBNB = ADDRESSES.bsc.WBNB async function tvlV1Bsc(timestamp, block, chainBlocks) { const tvlBNB = await tvlV1("bsc", chainBlocks.bsc, "https://homora-bsc.alphafinance.io/static/contracts.json", "WBNBAddress", "totalBNB") return { @@ -27,7 +28,7 @@ async function tvlV1Bsc(timestamp, block, chainBlocks) { } async function tvlV1(chain, block, contractsUrl, wrappedBaseName, totalEthMethodName) { - const { data } = await axios.get( + const data = await getConfig('alpha-hormora/v1/'+chain, contractsUrl ); @@ -49,10 +50,7 @@ async function tvlV1(chain, block, contractsUrl, wrappedBaseName, totalEthMethod target: bankAddress, block, chain, - abi: { - ...abi["totalETH"], - name: totalEthMethodName - }, + abi: 'uint256:'+totalEthMethodName, }); const totalETH = BigNumber(_totalETH); diff --git a/projects/alpha-homora/v2.js b/projects/alpha-homora/v2.js index 56cbcc3adcc..7b42a6d8cf3 100644 --- a/projects/alpha-homora/v2.js +++ b/projects/alpha-homora/v2.js @@ -1,9 +1,10 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); const BigNumber = require("bignumber.js"); -const axios = require("axios"); const { request, gql } = require("graphql-request"); const { unwrapCreamTokens, unwrapUniswapLPs, unwrapUniswapV3NFTs } = require('../helper/unwrapLPs') +const { getConfig } = require('../helper/cache') const chainParams = { @@ -113,26 +114,26 @@ module.exports = { tvlV2Onchain } -async function getPools(poolsJsonUrl){ - return poolsJsonUrl === "local"? require('./v2/legacy-pools.json') : (await axios.get(poolsJsonUrl)).data +async function getPools(poolsJsonUrl, chain){ + return poolsJsonUrl === "local"? require('./v2/legacy-pools.json') : (await getConfig('alpha-hormora/v2-pools/'+chain, poolsJsonUrl)) } async function tvlV2Onchain(block, chain) { const balances = {} const transform = addr => { if (addr.toLowerCase() === '0x260bbf5698121eb85e7a74f2e45e16ce762ebe11') - return 'avax:0xc7198437980c041c805a1edcba50c1ce5db95118' // Axelar wrapped UST -> USDT + return 'avax:' + ADDRESSES.avax.USDT_e // Axelar wrapped UST -> USDT if (addr.toLowerCase() === '0x2147efff675e4a4ee1c2f918d181cdbd7a8e208f') return '0xa1faa113cbe53436df28ff0aee54275c13b40975' // Wrapped Alpha Finance -> ALPHA (erc20) return `${chain}:${addr}` } const { safeBoxApi, poolsJsonUrl, instances, } = chainParams[chain]; - let { data: safebox } = await axios.get(safeBoxApi); + let safebox = await getConfig('alpha-hormora/v2-safebox/'+chain, safeBoxApi); const safeBoxRewards = safebox.filter(i => i.ibStakingReward) safebox = safebox.filter(i => !i.ibStakingReward) await unwrapIBRewards({ boxes: safeBoxRewards, balances, chain, block, transform, }) await unwrapCreamTokens(balances, safebox.map(s=>[s.cyTokenAddress, s.safeboxAddress]), block, chain, transform) - let pools= await getPools(poolsJsonUrl); + let pools= await getPools(poolsJsonUrl, chain); const owners = pools.filter(i => i.wTokenType === 'WUniswapV3').map(i => i.wTokenAddress).filter(i => i) pools = pools.filter(i => i.wTokenType !== 'WUniswapV3') let poolsWithPid = pools.filter(p => p.pid !== undefined) @@ -192,8 +193,8 @@ async function unwrapIBRewards({ block, chain, boxes, balances, transform}) { async function tvlV2(block, chain) { const { safeBoxApi, coreOracleAddress, latestAlphaHomoraV2GraphUrl, instances } = chainParams[chain]; - const cyTokens = await getCyTokens(block, safeBoxApi, latestAlphaHomoraV2GraphUrl); - const collateralGroups = await Promise.all(instances.map(params => getTotalCollateral(block, params))) + const cyTokens = await getCyTokens(block, safeBoxApi, latestAlphaHomoraV2GraphUrl, chain); + const collateralGroups = await Promise.all(instances.map(params => getTotalCollateral(block, params, chain))) const tokens = Array.from( new Set([ @@ -236,8 +237,8 @@ function sumCollaterals(collaterals, tokenPrices) { ); } -async function getCyTokens(block, safeBoxApi, AlphaHomoraV2GraphUrl) { - const { data: safebox } = await axios.get( +async function getCyTokens(block, safeBoxApi, AlphaHomoraV2GraphUrl, chain) { + const safebox = await getConfig('alpha-hormora/v2-safebox/'+chain, safeBoxApi ); return Promise.all( @@ -271,12 +272,13 @@ async function getTokenPrices(tokens, block, chain, coreOracleAddress) { chain, abi: abi["getETHPx"], block, + permitFailure: true, }); const tokenPrices = {}; for (let i = 0; i < _ethPrices.length; i++) { - const price = BigNumber(_ethPrices[i].output).div(BigNumber(2).pow(112)); - if (price.gte(0)) { + const price = _ethPrices[i].output / 2 ** 112; + if (price > 0) { tokenPrices[tokens[i]] = price; } } @@ -293,9 +295,9 @@ async function getTotalCollateral( wStakingRewardPerp, poolsJsonUrl, graphUrl, - } + }, chain ) { - const pools = await getPools(poolsJsonUrl); + const pools = await getPools(poolsJsonUrl, chain); const { crvCollaterals, diff --git a/projects/alpha-homora/v2/legacy-pools.json b/projects/alpha-homora/v2/legacy-pools.json index 0976429324e..8a0a014d51f 100644 --- a/projects/alpha-homora/v2/legacy-pools.json +++ b/projects/alpha-homora/v2/legacy-pools.json @@ -59,844 +59,6 @@ "wTokenAddress": "0xfdb4f97953150e47c8606758c13e70b5a789a7ec", "pid": 0, "gid": 0, - "poolContractAbi": [ - { - "name": "TokenExchange", - "inputs": [ - { - "type": "address", - "name": "buyer", - "indexed": true - }, - { - "type": "int128", - "name": "sold_id", - "indexed": false - }, - { - "type": "uint256", - "name": "tokens_sold", - "indexed": false - }, - { - "type": "int128", - "name": "bought_id", - "indexed": false - }, - { - "type": "uint256", - "name": "tokens_bought", - "indexed": false - } - ], - "anonymous": false, - "type": "event" - }, - { - "name": "AddLiquidity", - "inputs": [ - { - "type": "address", - "name": "provider", - "indexed": true - }, - { - "type": "uint256[3]", - "name": "token_amounts", - "indexed": false - }, - { - "type": "uint256[3]", - "name": "fees", - "indexed": false - }, - { - "type": "uint256", - "name": "invariant", - "indexed": false - }, - { - "type": "uint256", - "name": "token_supply", - "indexed": false - } - ], - "anonymous": false, - "type": "event" - }, - { - "name": "RemoveLiquidity", - "inputs": [ - { - "type": "address", - "name": "provider", - "indexed": true - }, - { - "type": "uint256[3]", - "name": "token_amounts", - "indexed": false - }, - { - "type": "uint256[3]", - "name": "fees", - "indexed": false - }, - { - "type": "uint256", - "name": "token_supply", - "indexed": false - } - ], - "anonymous": false, - "type": "event" - }, - { - "name": "RemoveLiquidityOne", - "inputs": [ - { - "type": "address", - "name": "provider", - "indexed": true - }, - { - "type": "uint256", - "name": "token_amount", - "indexed": false - }, - { - "type": "uint256", - "name": "coin_amount", - "indexed": false - } - ], - "anonymous": false, - "type": "event" - }, - { - "name": "RemoveLiquidityImbalance", - "inputs": [ - { - "type": "address", - "name": "provider", - "indexed": true - }, - { - "type": "uint256[3]", - "name": "token_amounts", - "indexed": false - }, - { - "type": "uint256[3]", - "name": "fees", - "indexed": false - }, - { - "type": "uint256", - "name": "invariant", - "indexed": false - }, - { - "type": "uint256", - "name": "token_supply", - "indexed": false - } - ], - "anonymous": false, - "type": "event" - }, - { - "name": "CommitNewAdmin", - "inputs": [ - { - "type": "uint256", - "name": "deadline", - "indexed": true - }, - { - "type": "address", - "name": "admin", - "indexed": true - } - ], - "anonymous": false, - "type": "event" - }, - { - "name": "NewAdmin", - "inputs": [ - { - "type": "address", - "name": "admin", - "indexed": true - } - ], - "anonymous": false, - "type": "event" - }, - { - "name": "CommitNewFee", - "inputs": [ - { - "type": "uint256", - "name": "deadline", - "indexed": true - }, - { - "type": "uint256", - "name": "fee", - "indexed": false - }, - { - "type": "uint256", - "name": "admin_fee", - "indexed": false - } - ], - "anonymous": false, - "type": "event" - }, - { - "name": "NewFee", - "inputs": [ - { - "type": "uint256", - "name": "fee", - "indexed": false - }, - { - "type": "uint256", - "name": "admin_fee", - "indexed": false - } - ], - "anonymous": false, - "type": "event" - }, - { - "name": "RampA", - "inputs": [ - { - "type": "uint256", - "name": "old_A", - "indexed": false - }, - { - "type": "uint256", - "name": "new_A", - "indexed": false - }, - { - "type": "uint256", - "name": "initial_time", - "indexed": false - }, - { - "type": "uint256", - "name": "future_time", - "indexed": false - } - ], - "anonymous": false, - "type": "event" - }, - { - "name": "StopRampA", - "inputs": [ - { - "type": "uint256", - "name": "A", - "indexed": false - }, - { - "type": "uint256", - "name": "t", - "indexed": false - } - ], - "anonymous": false, - "type": "event" - }, - { - "outputs": [], - "inputs": [ - { - "type": "address", - "name": "_owner" - }, - { - "type": "address[3]", - "name": "_coins" - }, - { - "type": "address", - "name": "_pool_token" - }, - { - "type": "uint256", - "name": "_A" - }, - { - "type": "uint256", - "name": "_fee" - }, - { - "type": "uint256", - "name": "_admin_fee" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "name": "A", - "outputs": [ - { - "type": "uint256", - "name": "" - } - ], - "inputs": [], - "stateMutability": "view", - "type": "function", - "gas": 5227 - }, - { - "name": "get_virtual_price", - "outputs": [ - { - "type": "uint256", - "name": "" - } - ], - "inputs": [], - "stateMutability": "view", - "type": "function", - "gas": 1133537 - }, - { - "name": "calc_token_amount", - "outputs": [ - { - "type": "uint256", - "name": "" - } - ], - "inputs": [ - { - "type": "uint256[3]", - "name": "amounts" - }, - { - "type": "bool", - "name": "deposit" - } - ], - "stateMutability": "view", - "type": "function", - "gas": 4508776 - }, - { - "name": "add_liquidity", - "outputs": [], - "inputs": [ - { - "type": "uint256[3]", - "name": "amounts" - }, - { - "type": "uint256", - "name": "min_mint_amount" - } - ], - "stateMutability": "nonpayable", - "type": "function", - "gas": 6954858 - }, - { - "name": "get_dy", - "outputs": [ - { - "type": "uint256", - "name": "" - } - ], - "inputs": [ - { - "type": "int128", - "name": "i" - }, - { - "type": "int128", - "name": "j" - }, - { - "type": "uint256", - "name": "dx" - } - ], - "stateMutability": "view", - "type": "function", - "gas": 2673791 - }, - { - "name": "get_dy_underlying", - "outputs": [ - { - "type": "uint256", - "name": "" - } - ], - "inputs": [ - { - "type": "int128", - "name": "i" - }, - { - "type": "int128", - "name": "j" - }, - { - "type": "uint256", - "name": "dx" - } - ], - "stateMutability": "view", - "type": "function", - "gas": 2673474 - }, - { - "name": "exchange", - "outputs": [], - "inputs": [ - { - "type": "int128", - "name": "i" - }, - { - "type": "int128", - "name": "j" - }, - { - "type": "uint256", - "name": "dx" - }, - { - "type": "uint256", - "name": "min_dy" - } - ], - "stateMutability": "nonpayable", - "type": "function", - "gas": 2818066 - }, - { - "name": "remove_liquidity", - "outputs": [], - "inputs": [ - { - "type": "uint256", - "name": "_amount" - }, - { - "type": "uint256[3]", - "name": "min_amounts" - } - ], - "stateMutability": "nonpayable", - "type": "function", - "gas": 192846 - }, - { - "name": "remove_liquidity_imbalance", - "outputs": [], - "inputs": [ - { - "type": "uint256[3]", - "name": "amounts" - }, - { - "type": "uint256", - "name": "max_burn_amount" - } - ], - "stateMutability": "nonpayable", - "type": "function", - "gas": 6951851 - }, - { - "name": "calc_withdraw_one_coin", - "outputs": [ - { - "type": "uint256", - "name": "" - } - ], - "inputs": [ - { - "type": "uint256", - "name": "_token_amount" - }, - { - "type": "int128", - "name": "i" - } - ], - "stateMutability": "view", - "type": "function", - "gas": 1102 - }, - { - "name": "remove_liquidity_one_coin", - "outputs": [], - "inputs": [ - { - "type": "uint256", - "name": "_token_amount" - }, - { - "type": "int128", - "name": "i" - }, - { - "type": "uint256", - "name": "min_amount" - } - ], - "stateMutability": "nonpayable", - "type": "function", - "gas": 4025523 - }, - { - "name": "ramp_A", - "outputs": [], - "inputs": [ - { - "type": "uint256", - "name": "_future_A" - }, - { - "type": "uint256", - "name": "_future_time" - } - ], - "stateMutability": "nonpayable", - "type": "function", - "gas": 151919 - }, - { - "name": "stop_ramp_A", - "outputs": [], - "inputs": [], - "stateMutability": "nonpayable", - "type": "function", - "gas": 148637 - }, - { - "name": "commit_new_fee", - "outputs": [], - "inputs": [ - { - "type": "uint256", - "name": "new_fee" - }, - { - "type": "uint256", - "name": "new_admin_fee" - } - ], - "stateMutability": "nonpayable", - "type": "function", - "gas": 110461 - }, - { - "name": "apply_new_fee", - "outputs": [], - "inputs": [], - "stateMutability": "nonpayable", - "type": "function", - "gas": 97242 - }, - { - "name": "revert_new_parameters", - "outputs": [], - "inputs": [], - "stateMutability": "nonpayable", - "type": "function", - "gas": 21895 - }, - { - "name": "commit_transfer_ownership", - "outputs": [], - "inputs": [ - { - "type": "address", - "name": "_owner" - } - ], - "stateMutability": "nonpayable", - "type": "function", - "gas": 74572 - }, - { - "name": "apply_transfer_ownership", - "outputs": [], - "inputs": [], - "stateMutability": "nonpayable", - "type": "function", - "gas": 60710 - }, - { - "name": "revert_transfer_ownership", - "outputs": [], - "inputs": [], - "stateMutability": "nonpayable", - "type": "function", - "gas": 21985 - }, - { - "name": "admin_balances", - "outputs": [ - { - "type": "uint256", - "name": "" - } - ], - "inputs": [ - { - "type": "uint256", - "name": "i" - } - ], - "stateMutability": "view", - "type": "function", - "gas": 3481 - }, - { - "name": "withdraw_admin_fees", - "outputs": [], - "inputs": [], - "stateMutability": "nonpayable", - "type": "function", - "gas": 21502 - }, - { - "name": "donate_admin_fees", - "outputs": [], - "inputs": [], - "stateMutability": "nonpayable", - "type": "function", - "gas": 111389 - }, - { - "name": "kill_me", - "outputs": [], - "inputs": [], - "stateMutability": "nonpayable", - "type": "function", - "gas": 37998 - }, - { - "name": "unkill_me", - "outputs": [], - "inputs": [], - "stateMutability": "nonpayable", - "type": "function", - "gas": 22135 - }, - { - "name": "coins", - "outputs": [ - { - "type": "address", - "name": "" - } - ], - "inputs": [ - { - "type": "uint256", - "name": "arg0" - } - ], - "stateMutability": "view", - "type": "function", - "gas": 2220 - }, - { - "name": "balances", - "outputs": [ - { - "type": "uint256", - "name": "" - } - ], - "inputs": [ - { - "type": "uint256", - "name": "arg0" - } - ], - "stateMutability": "view", - "type": "function", - "gas": 2250 - }, - { - "name": "fee", - "outputs": [ - { - "type": "uint256", - "name": "" - } - ], - "inputs": [], - "stateMutability": "view", - "type": "function", - "gas": 2171 - }, - { - "name": "admin_fee", - "outputs": [ - { - "type": "uint256", - "name": "" - } - ], - "inputs": [], - "stateMutability": "view", - "type": "function", - "gas": 2201 - }, - { - "name": "owner", - "outputs": [ - { - "type": "address", - "name": "" - } - ], - "inputs": [], - "stateMutability": "view", - "type": "function", - "gas": 2231 - }, - { - "name": "initial_A", - "outputs": [ - { - "type": "uint256", - "name": "" - } - ], - "inputs": [], - "stateMutability": "view", - "type": "function", - "gas": 2261 - }, - { - "name": "future_A", - "outputs": [ - { - "type": "uint256", - "name": "" - } - ], - "inputs": [], - "stateMutability": "view", - "type": "function", - "gas": 2291 - }, - { - "name": "initial_A_time", - "outputs": [ - { - "type": "uint256", - "name": "" - } - ], - "inputs": [], - "stateMutability": "view", - "type": "function", - "gas": 2321 - }, - { - "name": "future_A_time", - "outputs": [ - { - "type": "uint256", - "name": "" - } - ], - "inputs": [], - "stateMutability": "view", - "type": "function", - "gas": 2351 - }, - { - "name": "admin_actions_deadline", - "outputs": [ - { - "type": "uint256", - "name": "" - } - ], - "inputs": [], - "stateMutability": "view", - "type": "function", - "gas": 2381 - }, - { - "name": "transfer_ownership_deadline", - "outputs": [ - { - "type": "uint256", - "name": "" - } - ], - "inputs": [], - "stateMutability": "view", - "type": "function", - "gas": 2411 - }, - { - "name": "future_fee", - "outputs": [ - { - "type": "uint256", - "name": "" - } - ], - "inputs": [], - "stateMutability": "view", - "type": "function", - "gas": 2441 - }, - { - "name": "future_admin_fee", - "outputs": [ - { - "type": "uint256", - "name": "" - } - ], - "inputs": [], - "stateMutability": "view", - "type": "function", - "gas": 2471 - }, - { - "name": "future_owner", - "outputs": [ - { - "type": "address", - "name": "" - } - ], - "inputs": [], - "stateMutability": "view", - "type": "function", - "gas": 2501 - } - ], "curveGaugeAddress": "0xbfcf63294ad7105dea65aa58f8ae5be2d9d0952a", "curveGaugeControllerAddress": "0x2f50d538606fa9edd2b11e2446beb18c9d5846bb", "curveRawStatsApiUrl": "https://stats.curve.fi/raw-stats/3pool-1440m.json", diff --git a/projects/alyx-finance/index.js b/projects/alyx-finance/index.js new file mode 100644 index 00000000000..cd272ea6ed6 --- /dev/null +++ b/projects/alyx-finance/index.js @@ -0,0 +1,116 @@ +const { BN } = require("bn.js"); +const { request, gql } = require("graphql-request"); +const { sumTokensExport } = require("../helper/unknownTokens"); + +const masterchefAddress = "0x7Bd2f7641b875872c7c04ee3B426F753C7093aD5"; +const alyxToken = "0x2701C7cBf3220FFF6e6CEaabbCD9B932Eb11E3Ff"; +const alyx_bsc_lp = "0xf5Ea0B5AafC6eDACA15909a02C1e16bCaCd74C1e" +const treasury = "0x576182b7a1b0bC67701ead28a087228c50Aa0982"; + +const marketplace = "https://api.thegraph.com/subgraphs/name/alyxfinance/alyx-marketplace"; +const nftLending = "https://api.thegraph.com/subgraphs/name/alyxfinance/alyx-nft-lending"; +const bonds = "https://api.thegraph.com/subgraphs/name/alyxfinance/alyx-bonds" +const coinflip = "https://api.thegraph.com/subgraphs/name/alyxfinance/alyx-coinflip"; +const roll = "https://api.thegraph.com/subgraphs/name/alyxfinance/alyx-rollgame"; + +const marketplaceQuery = gql` + query volumeStat { + volumeStat(id: "total") { + bid + listing + period + sold + } + } +`; + +const nftLendingQuery = gql` + query volumeStat { + volumeStat(id: "total") { + closeLoan + createLoan + id + liquidateLoan + period + reduceLoan + repayLoan + } + } +`; + +const bondsQuery = gql` + query volumeStat { + volumeStat(id: "total") { + redemption + period + id + creation + } + } +`; + +const coinflipQuery = gql` +query volumeStat { + query coinFlipAllTimeDataAggregateds { + betAmount + token + id + } +} +`; + +async function getMarketplaceData() { + try { + const { volumeStat: data } = await request(marketplace, marketplaceQuery); + data.total = (new BN(data.listing).add(new BN(data.bid)).add(new BN(data.sold))).toString(10) + console.log("marketplace", data) + return data + } catch (err) { + console.error(err.response) + } +} + + +async function getNFTLendingData() { + try { + const { volumeStat: data } = await request(nftLending, nftLendingQuery); + data.total = (new BN(data.closeLoan).add(new BN(data.createLoan)).add(new BN(data.liquidateLoan))).add(new BN(data.reduceLoan)).add(new BN(data.repayLoan)).toString(10) + console.log("NFTlending", data) + return data + } catch (err) { + console.error(err.response) + } +} + +async function getBondsData() { + try { + const { volumeStat: data } = await request(bonds, bondsQuery); + data.total = (new BN(data.redemption).add(new BN(data.creation)).toString(10)); + console.log("bonds", data) + return data + } catch (err) { + console.error(err.response) + } +} + +// Will be used in future +async function totalVolume(timestamp, block) { + try { + const marketplaceVolume = await getMarketplaceData(); + const nftlendingVolume = await getNFTLendingData(); + const bondsVolume = await getBondsData(); + return marketplaceVolume.total.add(nftlendingVolume.total.add(bondsVolume.total)) + } catch (err) { + console.error(err.response) + } +} + +module.exports = { + misrepresentedTokens: true, + bsc: { + tvl: sumTokensExport({ tokens: [alyx_bsc_lp], owner: treasury, useDefaultCoreAssets: true }), + pool2: sumTokensExport({ tokens: [alyx_bsc_lp], owner: masterchefAddress, useDefaultCoreAssets: true }), + staking: sumTokensExport({ tokens: [alyxToken], owner: masterchefAddress, useDefaultCoreAssets: true, lps: [alyx_bsc_lp] }), + }, + methodology: `Total amount of tokens in treasury and masterchef contract`, +}; \ No newline at end of file diff --git a/projects/ambient-finance/index.js b/projects/ambient-finance/index.js new file mode 100644 index 00000000000..d1bfef53300 --- /dev/null +++ b/projects/ambient-finance/index.js @@ -0,0 +1,22 @@ +const { sumTokens2 } = require('../helper/unwrapLPs'); +const { covalentGetTokens } = require("../helper/http"); +const { cachedGraphQuery } = require("../helper/cache"); + +const vault = "0xAaAaAAAaA24eEeb8d57D431224f73832bC34f688" +const tvlV1 = async (_, _1, _2, { api }) => { + const tokens = await covalentGetTokens(vault, api.chain) + return sumTokens2({ api, owner: vault, tokens, }) +} + +async function tvl(_, _b, _cb, { api, }) { + + const { pools } = await cachedGraphQuery(`ambient-finance/${api.chain}`, `https://api.thegraph.com/subgraphs/name/crocswap/croc-mainnet`, "{ pools { base quote }}") + const tokens = pools.map(i => [i.base, i.quote]).flat() + return sumTokens2({ api, owner: vault, tokens, }) +} + +module.exports = { + ethereum: { + tvl, + } +} \ No newline at end of file diff --git a/projects/ammos-fi/index.js b/projects/ammos-fi/index.js new file mode 100644 index 00000000000..82f5938c37b --- /dev/null +++ b/projects/ammos-fi/index.js @@ -0,0 +1,5 @@ +const { uniV3Export } = require("../helper/uniswapV3"); + +module.exports = uniV3Export({ + mantle: { factory: "0x636eA278699A300d3A849aB2cE36c891C4eE3Da0", fromBlock: 20634, }, +}); \ No newline at end of file diff --git a/projects/ampere/index.js b/projects/ampere/index.js index c66b7646cf7..cda18f15d62 100644 --- a/projects/ampere/index.js +++ b/projects/ampere/index.js @@ -1,6 +1,7 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { tombTvl } = require("../helper/tomb"); const FUSE_ON_ETH = "0x970b9bb2c0444f5e81e9d0efb84c8ccdcdcaf84d"; -const FUSE_ON_FUSE = "0x0be9e53fd7edac9f859882afdda116645287c629"; +const FUSE_ON_FUSE = ADDRESSES.fuse.WFUSE; const AMP = "0x2b09179D26FdDB27a24ee25328890791c7A984c2".toLowerCase(); const CURRENT = "0x3B1292FEf70C3F9Fb933DD2e2F4B734DcB35648d".toLowerCase(); diff --git a/projects/ampleswap/index.js b/projects/ampleswap/index.js new file mode 100644 index 00000000000..da6763b1e4f --- /dev/null +++ b/projects/ampleswap/index.js @@ -0,0 +1,15 @@ +const { staking } = require("../helper/staking"); +const { getUniTVL } = require('../helper/unknownTokens') + +const MasterChefContract = "0xeb642d600bf593cb21e1551e9a15426ff6d42f82"; +const AMPLE = "0x335f6e0e804b70a96bf9eb8af31588942e9b2515"; + +module.exports = { + methodology: `Uses factory(0x381fefadab5466bff0e8e96842e8e76a143e8f73) address and whitelisted tokens address to find and price Liquidity Pool pairs`, + misrepresentedTokens: true, + incentivized: true, + bsc: { + tvl: getUniTVL({ factory: '0x381fefadab5466bff0e8e96842e8e76a143e8f73', useDefaultCoreAssets: true }), + staking: staking(MasterChefContract, AMPLE), + } +}; diff --git a/projects/amulet-liquidity-staking/index.js b/projects/amulet-liquidity-staking/index.js index 814b5972f04..240d31c1681 100644 --- a/projects/amulet-liquidity-staking/index.js +++ b/projects/amulet-liquidity-staking/index.js @@ -31,5 +31,8 @@ module.exports = { solana:{ tvl }, - methodology: `Amulet enables users to earn PoS staking rewards on Solana by staking SOL and mint amtSOL. Hence, the amount of SOL staked are counted as our TVL for Amulet Liquidity Staking which the value are calculated based on the price get from Coingecko.` + methodology: `Amulet enables users to earn PoS staking rewards on Solana by staking SOL and mint amtSOL. Hence, the amount of SOL staked are counted as our TVL for Amulet Liquidity Staking which the value are calculated based on the price get from Coingecko.`, + hallmarks: [ + [1667692800, "FTX collapse"] + ], } diff --git a/projects/amulet-protocol/index.js b/projects/amulet-protocol/index.js index f4f3d497051..1f6e591836a 100644 --- a/projects/amulet-protocol/index.js +++ b/projects/amulet-protocol/index.js @@ -25,5 +25,8 @@ module.exports = { solana:{ tvl }, - methodology: `Amulet provides solution which allows user to to earn rewards from underwriting covers with SOL derivatives token (amtSOL). Hence, the amount of SOL derivatives staked are counted as our TVL which the value are calculated based on the price get from Coingecko.` + methodology: `Amulet provides solution which allows user to to earn rewards from underwriting covers with SOL derivatives token (amtSOL). Hence, the amount of SOL derivatives staked are counted as our TVL which the value are calculated based on the price get from Coingecko.`, + hallmarks: [ + [1667692800, "FTX collapse"] + ], } diff --git a/projects/amun/abi.json b/projects/amun/abi.json index 2fa4fb890dd..19e467e295d 100644 --- a/projects/amun/abi.json +++ b/projects/amun/abi.json @@ -1,17 +1,3 @@ { - "getTokens": { - "name": "getTokens", - "type": "function", - "inputs": [ - - ], - "outputs": [ - { - "name": "", - "type": "address[]", - "internalType": "address[]" - } - ], - "stateMutability": "view" - } + "getTokens": "address[]:getTokens" } \ No newline at end of file diff --git a/projects/amyfinance/index.js b/projects/amyfinance/index.js index 5c4db3a81bd..421728d03d3 100644 --- a/projects/amyfinance/index.js +++ b/projects/amyfinance/index.js @@ -1,15 +1,16 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokensAndLPsSharedOwners } = require('../helper/unwrapLPs'); const { transformArbitrumAddress } = require('../helper/portedTokens'); const tokens = [ - ["0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8", false], //USDC - ["0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9", false], //USDT - ["0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1", false], //DAI - ["0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f", false], //WBTC - ["0x82aF49447D8a07e3bd95BD0d56f35241523fBab1", false], //WETH + [ADDRESSES.arbitrum.USDC, false], //USDC + [ADDRESSES.arbitrum.USDT, false], //USDT + [ADDRESSES.optimism.DAI, false], //DAI + [ADDRESSES.arbitrum.WBTC, false], //WBTC + [ADDRESSES.arbitrum.WETH, false], //WETH ["0xFa7F8980b0f1E64A2062791cc3b0871572f1F7f0", false], //UNI - ["0xf97f4df75117a78c1A5a0DBb814Af92458539FB4", false], //LINK - ["0xFEa7a6a0B346362BF88A9e4A88416B77a57D6c2A", false], //MIM + [ADDRESSES.arbitrum.LINK, false], //LINK + [ADDRESSES.arbitrum.MIM, false], //MIM ["0xd4d42F0b6DEF4CE0383636770eF773390d85c61A", false], //SUSHI ]; const aibContracts = [ diff --git a/projects/anchor/index.js b/projects/anchor/index.js index ff441ae78d7..2ac5d583497 100644 --- a/projects/anchor/index.js +++ b/projects/anchor/index.js @@ -1,80 +1,14 @@ -const { request, gql } = require("graphql-request"); -const { fetchURL } = require("../helper/utils"); -const sdk = require("@defillama/sdk"); -const { default: BigNumber } = require("bignumber.js"); -const { toUSDTBalances } = require('../helper/balances'); - -const graphUrl = 'https://mantle.terra.dev/' -const query = gql` -query __bAssetMarket($bAssetTokenBalanceQuery: String!, $bEthTokenBalanceQuery: String!) { - ubLunaBalance: WasmContractsContractAddressStore( - ContractAddress: "terra1kc87mu460fwkqte29rquh4hc20m54fxwtsx7gp" - QueryMsg: $bAssetTokenBalanceQuery - ) { - Result - __typename - }, - ubEthBalance: WasmContractsContractAddressStore( - ContractAddress: "terra1dzhzukyezv0etz22ud940z7adyv7xgcjkahuun" - QueryMsg: $bEthTokenBalanceQuery - ) { - Result - __typename - }, - balances: BankBalancesAddress(Address: "terra1sepfj7s0aeg5967uxnfk4thzlerrsktkpelm5s") { - Result { - Denom - Amount - __typename - } - __typename - } -} -` - -async function tvl(timestamp, block) { - const result = await request(graphUrl, query, { - "bAssetTokenBalanceQuery": '{"balance":{"address":"terra1ptjp2vfjrwh0j0faj9r6katm640kgjxnwwq9kn"}}', - "bEthTokenBalanceQuery": '{"balance":{"address":"terra10cxuzggyvvv44magvrh3thpdnk9cmlgk93gmx2"}}' - }) - const ust = Number(result.balances.Result[0].Amount) / 1e6; - const luna = Number(JSON.parse(result.ubLunaBalance.Result).balance) / 1e6 - const beth = Number(JSON.parse(result.ubEthBalance.Result).balance) / 1e6 - return { - "staked-ether": beth, - "terra-luna": luna, - "terrausd": ust - } -} - -async function borrowed() { - const data = await fetchURL("https://api.anchorprotocol.com/api/v1/borrow") - return { - "terrausd": Number(data.data.total_borrowed) / 1e6 - } -} - -async function avalancheTVL(timestamp, ethBlock, chainBlocks) { - const chain = "avax" - const wormholeAnchorUST = "0xaB9A04808167C170A9EC4f8a87a0cD781ebcd55e" - const block = chainBlocks[chain] - const { output: aUSTBalance } = await sdk.api.erc20.totalSupply({ target: wormholeAnchorUST, block, chain }) - return { - "anchorust": BigNumber(aUSTBalance).dividedBy(10 ** 6) - } -} - module.exports = { timetravel: false, methodology: `We use the Anchor subgraph to get the amount of bLUNA and bETH used as collateral on anchor and the UST that is on anchor but has not been lent, we then use Coingecko to price the tokens in USD.`, terra: { - tvl, - borrowed + tvl: () => ({}), + // borrowed }, - avax:{ - tvl: avalancheTVL + avax: { + tvl: () => ({}), }, - hallmarks:[ + hallmarks: [ [1651881600, "UST depeg"], ] } diff --git a/projects/anetabtc/index.js b/projects/anetabtc/index.js index 7a2af751e50..c635356d983 100644 --- a/projects/anetabtc/index.js +++ b/projects/anetabtc/index.js @@ -1,42 +1,12 @@ -const { get } = require('../helper/http') -const { getAssets } = require('../helper/chain/cardano/blockfrost') - -let tokenPrice -const DAY = 24 * 60 * 60 * 1000 -const aDayAgo = new Date() - DAY - -async function getTokenPrice() { - if (!tokenPrice) tokenPrice = _getTokenPrice() - return tokenPrice - - async function _getTokenPrice() { - const data = await get('https://api.ergodex.io/v1/amm/markets?from='+aDayAgo) - const priceObj = data.find(i => i.quoteSymbol === 'NETA' && i.baseSymbol === 'ERG') - return 1/priceObj.lastPrice - } -} +const { sumTokensExport } = require('../helper/sumTokens') module.exports = { - misrepresentedTokens: true, timetravel: false, cardano: { tvl: () => ({}), - staking: async () => { - const data = await getAssets('addr1w8p79rekquuw5kmdg4z36y9gpnm88k5huddwqluk9mjjeqgc3xmss') - const balance = data.find(i => i.unit === 'b34b3ea80060ace9427bda98690a73d33840e27aaa8d6edb7f0c757a634e455441').quantity - return { - ergo: +balance * (await getTokenPrice()) - } - } + staking: sumTokensExport({ tokens: ['b34b3ea80060ace9427bda98690a73d33840e27aaa8d6edb7f0c757a634e455441'], owner: 'addr1w8p79rekquuw5kmdg4z36y9gpnm88k5huddwqluk9mjjeqgc3xmss'}) }, ergo: { - staking: async () => { - const api = 'https://api.ergoplatform.com/api/v1/addresses/5ASYVJ2w8tH3bDQx5ZLz6rZUdokD1kmTXSRZ8GfrsAUW4vqy9eg5omtTYVzY22ibHANf7GgSc2E5FiThgo8qXzWpU3RDLohN277hksbAf9yykajXbYPUaXUeMPfSXbS1GdE4y2GoYKaXHR3H57MV5CDZE58YteqWe3XVXzmMvj1192AD7UZ1N6nguRfjgijxEWTrLq2ZrykjRAut2JBGYHanAKn46tYWW3chpxNosXG7ZW2ShDzKju2ttHhfxeZVMBydryuoEya5E9KVagjsfa9E2qPUdLpbh8enppVWcwoQ4GF1ktgzSX32QbfKhfpD23iWQixThUbcCca14FjXDt94GVFPuhAT5tQyiKen863Cq5eRAEgsQ7otX6pWa32Q28sxSF9Az4abwiJKNbFhbhb3cDCs6A45ZnW6aB6AkfwTJSAZ2ZzqqG7LXT4HdxNpdmiwno9sJWxPf2PC4vRhVqBPdxxyCgoodjyutf4UuinSCibhfqdhUJLc1JM8zX9UcD699mChgUZoKE8kXD4soVGSgQD3qfGXC6RP7n8dtowArNLm3H5QJ3EobDCbEgECLHFaHN2BPwwWscAt5eejKeFvkp3CuQ3mqFW7vfQG4n9tTLnshj8cjxnpkBdfFKC83sW8A3AoZAX4K1UrhndfLSFh4w/balance/confirmed' - const data = await get(api) - const tokenData = data.tokens.find(i => i.tokenId === '472c3d4ecaa08fb7392ff041ee2e6af75f4a558810a74b28600549d5392810e8') - return { - ergo: tokenData.amount * (await getTokenPrice())/(10 ** tokenData.decimals) - } - } + staking: sumTokensExport({ tokens: ['472c3d4ecaa08fb7392ff041ee2e6af75f4a558810a74b28600549d5392810e8'], owner: '5ASYVJ2w8tH3bDQx5ZLz6rZUdokD1kmTXSRZ8GfrsAUW4vqy9eg5omtTYVzY22ibHANf7GgSc2E5FiThgo8qXzWpU3RDLohN277hksbAf9yykajXbYPUaXUeMPfSXbS1GdE4y2GoYKaXHR3H57MV5CDZE58YteqWe3XVXzmMvj1192AD7UZ1N6nguRfjgijxEWTrLq2ZrykjRAut2JBGYHanAKn46tYWW3chpxNosXG7ZW2ShDzKju2ttHhfxeZVMBydryuoEya5E9KVagjsfa9E2qPUdLpbh8enppVWcwoQ4GF1ktgzSX32QbfKhfpD23iWQixThUbcCca14FjXDt94GVFPuhAT5tQyiKen863Cq5eRAEgsQ7otX6pWa32Q28sxSF9Az4abwiJKNbFhbhb3cDCs6A45ZnW6aB6AkfwTJSAZ2ZzqqG7LXT4HdxNpdmiwno9sJWxPf2PC4vRhVqBPdxxyCgoodjyutf4UuinSCibhfqdhUJLc1JM8zX9UcD699mChgUZoKE8kXD4soVGSgQD3qfGXC6RP7n8dtowArNLm3H5QJ3EobDCbEgECLHFaHN2BPwwWscAt5eejKeFvkp3CuQ3mqFW7vfQG4n9tTLnshj8cjxnpkBdfFKC83sW8A3AoZAX4K1UrhndfLSFh4w'}) } } \ No newline at end of file diff --git a/projects/angel-protocol/index.js b/projects/angel-protocol/index.js index b4ab60736dc..379e9a2c50c 100644 --- a/projects/angel-protocol/index.js +++ b/projects/angel-protocol/index.js @@ -1,20 +1,8 @@ - -const { fetchURL } = require('../helper/utils') -const BigNumber = require('bignumber.js'); - - -async function tvl() { - const res = await fetchURL(`https://fcd.terra.dev/wasm/contracts/terra172ue5d0zm7jlsj2d9af4vdff6wua7mnv6dq5vp/store?query_msg=%7B%22token_info%22:%7B%22sid%22:0%7D%7D`) - return { - 'anchorust': BigNumber(res.data.result.total_supply) / 1e6, - } -} - module.exports = { timetravel: false, methodology: 'TVL takes total apANC in the contract and returns AnchorUST value', terra: { - tvl, + tvl: () => ({}), }, hallmarks:[ [1651881600, "UST depeg"], diff --git a/projects/angle/index.js b/projects/angle/index.js index edd3fbb840b..bbbd16e6657 100644 --- a/projects/angle/index.js +++ b/projects/angle/index.js @@ -1,32 +1,16 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const { staking } = require("../helper/staking"); -const { get } = require("../helper/http"); +const { getConfig } = require("../helper/cache"); const { sumTokens2 } = require("../helper/unwrapLPs"); +const { getUniqueAddresses } = require("../helper/tokenMapping"); const ANGLE = "0x31429d1856ad1377a8a0079410b297e1a9e214c2"; const veANGLE = "0x0C462Dbb9EC8cD1630f1728B2CFD2769d09f0dd5"; const poolManagers_abi = { - getTotalAsset: { - inputs: [], - name: "getTotalAsset", - outputs: [{ internalType: "uint256", name: "", type: "uint256" }], - stateMutability: "view", - type: "function", - }, - token: { - inputs: [], - name: "token", - outputs: [ - { - internalType: "contract IERC20", - name: "", - type: "address", - }, - ], - stateMutability: "view", - type: "function", - }, + getTotalAsset: "uint256:getTotalAsset", + token: "address:token", }; // get Borrowing module vault managers list @@ -37,10 +21,12 @@ async function getVaultManagersFromAPI(chain) { optimism: 10, arbitrum: 42161, fantom: 250, + avax: 43114, }; let chainId = chainIds[chain]; let calls = []; - let result = await get( + let result = await getConfig( + "angle/" + chain, "https://api.angle.money/v1/vaultManagers?chainId=" + chainId ); @@ -51,60 +37,63 @@ async function getVaultManagersFromAPI(chain) { return calls; } -async function tvl(chain, block) { +async function tvl(_, _1, _2, { api }) { + const chain = api.chain const balances = {}; const tokensAndOwners = []; if (chain === "ethereum") { // Registry will be released in next sdk of Angle + graphql endpoint to come - const collaterals = { - dai: "0x6b175474e89094c44da98b954eedeac495271d0f", - usdc: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", - frax: "0x853d955acef822db058eb8505911ed77f175b99e", - fei: "0x956F47F50A910163D8BF957Cf5846D573E7f87CA", - weth: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", - }; - const agEUR = { contract: "0x1a7e4e63778B4f12a199C062f3eFdD288afCBce8", stableMasterFront: "0x5adDc89785D75C86aB939E9e15bfBBb7Fc086A87", poolManagers: { dai: "0xc9daabC677F3d1301006e723bD21C60be57a5915", // DAI - usdc: "0xe9f183FC656656f1F17af1F2b0dF79b8fF9ad8eD", // USDC + // usdc: "0xe9f183FC656656f1F17af1F2b0dF79b8fF9ad8eD", // USDC disabled because of EULER hack fei: "0x53b981389Cfc5dCDA2DC2e903147B5DD0E985F44", // FEI frax: "0x6b4eE7352406707003bC6f6b96595FD35925af48", // FRAX weth: "0x3f66867b4b6eCeBA0dBb6776be15619F73BC30A2", // WETH }, }; - const agTokens = [agEUR]; - const tokenMapping = {}; - agTokens.map((t) => { - return Object.entries(t.poolManagers).forEach(([key, value]) => { - tokenMapping[value] = collaterals[key]; - }); - }); + // count the USDC in pool manager contract + tokensAndOwners.push([ADDRESSES.ethereum.USDC, '0xe9f183FC656656f1F17af1F2b0dF79b8fF9ad8eD']) // add USDC in USDC manager + const poolManagers = getUniqueAddresses([agEUR].map(i => Object.values(i.poolManagers)).flat()) - let { output: assets } = await sdk.api.abi.multiCall({ - calls: Object.keys(tokenMapping).map((i) => ({ target: i })), + let assets = await api.multiCall({ + calls: poolManagers, abi: poolManagers_abi["getTotalAsset"], - chain, - block, }); - let { output: tokens } = await sdk.api.abi.multiCall({ - calls: Object.keys(tokenMapping).map((i) => ({ target: i })), + let tokens = await api.multiCall({ + calls: poolManagers, abi: poolManagers_abi["token"], - chain, - block, }); - assets.forEach(({ output }, i) => - sdk.util.sumSingleBalance(balances, tokens[i].output, output) + assets.forEach((output, i) => + sdk.util.sumSingleBalance(balances, tokens[i], output) ); + + // AMOs + const EUROC = "0x1aBaEA1f7C830bD89Acc67eC4af516284b1bC33c"; + const curvePool = "0xBa3436Fd341F2C8A928452Db3C5A3670d1d5Cc73"; + const sdagEUREUROC = "0x63f222079608EEc2DDC7a9acdCD9344a21428Ce7"; + const cvxagEUREUROCstaker = "0xA91fccC1ec9d4A2271B7A86a7509Ca05057C1A98"; + const AngleagEUREUROCStaker = "0xC1e8Dba1cbF29f1CaA8343CAe96d5AdFD9bca736"; + // pool TVL + const [agEurBal, eurocBal, totPoolTokenSupply, sdagEUREUROCTVL, cvxagEUREUROCstakerTVL] = await Promise.all([ + api.call({ abi: 'erc20:balanceOf', target: agEUR.contract, params: curvePool }), + api.call({ abi: 'erc20:balanceOf', target: EUROC, params: curvePool }), + api.call({ abi: 'erc20:totalSupply', target: curvePool }), + // Angle holdings of Curve agEUREUROC LP tokens (staked on Stake DAO and Convex) + api.call({ abi: 'erc20:balanceOf', target: sdagEUREUROC, params: AngleagEUREUROCStaker }), + api.call({ abi: 'erc20:balanceOf', target: cvxagEUREUROCstaker, params: AngleagEUREUROCStaker }), + ]) + const eurocBalance = eurocBal * (+sdagEUREUROCTVL + +cvxagEUREUROCstakerTVL) / totPoolTokenSupply + sdk.util.sumSingleBalance(balances, EUROC, eurocBalance); } // Borrowing module tokensAndOwners.push(...(await getVaultManagersFromAPI(chain))); - return sumTokens2({ balances, chain, block, tokensAndOwners }); + return sumTokens2({ balances, api, tokensAndOwners }); } /* @@ -113,14 +102,17 @@ If not, the API call defaults to mainnet and the blockchain calls fail and retur */ module.exports = { + hallmarks: [ + [Math.floor(new Date('2023-03-13') / 1e3), 'Euler was hacked'], + [Math.floor(new Date('2023-08-02') / 1e3), 'Migration to v2 (Transmuter)'], + ], ethereum: { staking: staking(veANGLE, ANGLE, "ethereum"), }, methodology: `TVL is retrieved on-chain by querying the total assets managed by the Core module, and the balances of the vaultManagers of the Borrowing module.`, }; -["ethereum", "polygon", "optimism", "arbitrum"].forEach((chain) => { +["ethereum", "polygon", "optimism", "arbitrum", "avax"].forEach((chain) => { if (!module.exports[chain]) module.exports[chain] = {}; - module.exports[chain].tvl = async (_, _b, { [chain]: block }) => - tvl(chain, block); + module.exports[chain].tvl = tvl }); diff --git a/projects/animeswap/index.js b/projects/animeswap/index.js index fe49f857ae3..c489a3df570 100644 --- a/projects/animeswap/index.js +++ b/projects/animeswap/index.js @@ -1,6 +1,15 @@ const { dexExport } = require('../helper/chain/aptos') +const { dexExport: dexExportSUI } = require('../helper/chain/sui') +const { mergeExports } = require('../helper/utils') -module.exports = dexExport({ +const aptosExports = dexExport({ account: '0x796900ebe1a1a54ff9e932f19c548f5c1af5c6e7d34965857ac2f7b1d1ab2cbf', poolStr: 'AnimeSwapPoolV1::LiquidityPool', }) + +const suiExprots = dexExportSUI({ + account: '0xdd7e3a071c6a090a157eccc3c9bbc4d2b3fb5ac9a4687b1c300bf74be6a58945', + poolStr: 'animeswap::LiquidityPool', +}) + +module.exports = mergeExports([suiExprots, aptosExports]) diff --git a/projects/ankr/abi.json b/projects/ankr/abi.json index 02c8488be72..ee441dd6bc7 100644 --- a/projects/ankr/abi.json +++ b/projects/ankr/abi.json @@ -1,27 +1,3 @@ { - "getProviderBalance": - { - "inputs": [ - { - "internalType": "address", - "name": "provider", - "type": "address" - } - ], - "name": "getProviderBalance", - "outputs": [ - { - "internalType": "uint128", - "name": "balance", - "type": "uint128" - }, - { - "internalType": "uint128", - "name": "totalCap", - "type": "uint128" - } - ], - "stateMutability": "view", - "type": "function" - } + "getProviderBalance": "function getProviderBalance(address provider) view returns (uint128 balance, uint128 totalCap)" } \ No newline at end of file diff --git a/projects/ante/index.js b/projects/ante/index.js index bcf8c3ba419..27f4b2a4838 100644 --- a/projects/ante/index.js +++ b/projects/ante/index.js @@ -1,84 +1,159 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk'); -const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') -const { createIncrementArray } = require('../helper/utils') +const { sumTokens2, nullAddress } = require('../helper/unwrapLPs'); +const { createIncrementArray } = require('../helper/utils'); const CONFIG = { ethereum: { - factory: '0xa03492A9A663F04c51684A3c172FC9c4D7E02eDc', - version: '0.5.0', + factories: [ + { + factory: '0xa03492A9A663F04c51684A3c172FC9c4D7E02eDc', + version: '0.5.0', + }, + { + factory: '0x89E583A67B5FA1B39b8CE7E77654071c3a34cc48', + version: '0.6.0', + }, + ], startBlock: 13234803, - gasToken: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', + gasToken: ADDRESSES.ethereum.WETH, }, avax: { - factory: '0x18aB6357f673696375018f006B86fE44F195DE1f', - version: '0.5.1', + factories: [ + { + factory: '0x18aB6357f673696375018f006B86fE44F195DE1f', + version: '0.5.1', + }, + ], startBlock: 16037331, - gasToken: '0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7', + gasToken: ADDRESSES.avax.WAVAX, }, polygon: { - factory: '0xb4FD0Ce108e196d0C9844c48174d4C32Cd42F7bC', - version: '0.5.1', + factories: [ + { + factory: '0xb4FD0Ce108e196d0C9844c48174d4C32Cd42F7bC', + version: '0.5.1', + }, + ], startBlock: 32245577, - gasToken: '0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270', + gasToken: ADDRESSES.polygon.WMATIC_2, }, bsc: { - factory: '0xb4FD0Ce108e196d0C9844c48174d4C32Cd42F7bC', - version: '0.5.1', + factories: [ + { + factory: '0xb4FD0Ce108e196d0C9844c48174d4C32Cd42F7bC', + version: '0.5.1', + }, + ], startBlock: 20928838, - gasToken: '0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c', + gasToken: ADDRESSES.bsc.WBNB, }, fantom: { - factory: '0xb4FD0Ce108e196d0C9844c48174d4C32Cd42F7bC', - version: '0.5.1', + factories: [ + { + factory: '0xb4FD0Ce108e196d0C9844c48174d4C32Cd42F7bC', + version: '0.5.1', + }, + ], startBlock: 46604874, - gasToken: '0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83', - } + gasToken: ADDRESSES.fantom.WFTM, + }, + optimism: { + factories: [ + { + factory: '0xb4FD0Ce108e196d0C9844c48174d4C32Cd42F7bC', + version: '0.5.2', + }, + { + factory: '0x4f2be0244146b4408154504a481c799ba1a9a355', + version: '0.6.0', + }, + ], + startBlock: 39240199, + gasToken: ADDRESSES.tombchain.FTM, + }, + arbitrum: { + factories: [ + { + factory: '0xb4FD0Ce108e196d0C9844c48174d4C32Cd42F7bC', + version: '0.5.2', + }, + ], + startBlock: 33495774, + gasToken: ADDRESSES.arbitrum.WETH, + }, + aurora: { + factories: [ + { + factory: '0xb4FD0Ce108e196d0C9844c48174d4C32Cd42F7bC', + version: '0.5.2', + }, + ], + startBlock: 80670441, + gasToken: '0xc9bdeed33cd01541e1eed10f90519d2c06fe3feb', + }, }; -Object.keys(CONFIG).forEach(chain => { - const { startBlock, factory } = CONFIG[chain] +Object.keys(CONFIG).forEach((chain) => { + const { startBlock, factories } = CONFIG[chain]; module.exports[chain] = { - tvl: async (_, _b, {[chain]: block }) => { - let calls, currentRes - const pools = [] - let i = 0 - const length = 4 - do { - calls = createIncrementArray(4).map(j => ({ params: j + i * length})) - const { output: res } = await sdk.api.abi.multiCall({ - target: factory, - abi: abis.allPools, - calls, chain, block, - }) + tvl: async (_, _b, { [chain]: block }) => { + let calls, currentRes; + const pools = []; + let tokens = []; + let i = 0; + const length = 4; + + for (const factory of factories) { + if (factory.version >= '0.6') { + const controller = await sdk.api.abi.call({ + target: factory.factory, + abi: abis.getController, + chain, + block, + }); + const allowedTokens = await sdk.api.abi.call({ + target: controller.output, + abi: abis.getAllowedTokens, + chain, + block, + }); + + tokens = [...new Set([...tokens, ...allowedTokens.output])]; + } + do { + calls = createIncrementArray(4).map((j) => ({ + params: j + i * length, + })); + const { output: res } = await sdk.api.abi.multiCall({ + target: factory.factory, + abi: abis.allPools, + calls, + chain, + block, + permitFailure: true, + }); + + currentRes = res.map((i) => i.output).filter((i) => i); + + pools.push(...currentRes); - currentRes = res.map(i => i.output).filter(i => i) - pools.push(...currentRes) - i++ - } while (currentRes.length === length) - return sumTokens2({ tokens:[nullAddress], owners: pools, chain, block, }) + i++; + } while (currentRes.length === length); + } + return sumTokens2({ + tokens: [nullAddress, ...tokens], + owners: pools, + chain, + block, + }); }, start: startBlock, - } -}) + }; +}); const abis = { - allPools: { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "allPools", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } -} \ No newline at end of file + allPools: 'function allPools(uint256) view returns (address)', + getController: 'function controller() view returns (address)', + getAllowedTokens: 'function getAllowedTokens() view returns (address[])', +}; diff --git a/projects/antfarm-finance/index.js b/projects/antfarm-finance/index.js new file mode 100644 index 00000000000..cbcef8f0b50 --- /dev/null +++ b/projects/antfarm-finance/index.js @@ -0,0 +1,43 @@ +const { getUniTVL } = require("../helper/unknownTokens"); +const { staking } = require("../helper/staking.js"); + +const config = { + arbitrum: "0x61f4ECD130291e5D5D7809A112f9F9081b8Ed3A5", + ethereum: "0xE48AEE124F9933661d4DD3Eb265fA9e153e32CBe", + polygon_zkevm: "0x8aF94528FBE3c4C148523E7aAD48BcEbcC0A71d7", +}; + +const ethereum_staking = "0x6142b36B3dD1812993C2ecaa300b962A7Da0A900"; + +module.exports = { + misrepresentedTokens: true, + doublecounted: true, +}; + +Object.keys(config).forEach((chain) => { + const factory = config[chain]; + if (config[chain] == config["ethereum"]) { + module.exports[chain] = { + tvl: getUniTVL({ + factory, + useDefaultCoreAssets: true, + + }), + staking: staking( + "0x6142b36B3dD1812993C2ecaa300b962A7Da0A900", + "0x518b63Da813D46556FEa041A88b52e3CAa8C16a8", + "ethereum" + ), + }; + } else { + module.exports[chain] = { + tvl: getUniTVL({ + factory, + useDefaultCoreAssets: true, + + }), + }; + } +}); + +//0xDCd2B58585DF999DD145e529f09e8ACaFA6cd244 diff --git a/projects/antimatter/abi.json b/projects/antimatter/abi.json deleted file mode 100644 index a8d9b627a8e..00000000000 --- a/projects/antimatter/abi.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "allCalls": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "allCalls", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "allPuts": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "allPuts", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "underlying": { - "inputs": [], - "name": "underlying", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "length": { - "inputs": [], - "name": "length", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -} \ No newline at end of file diff --git a/projects/antimatter/index.js b/projects/antimatter/index.js deleted file mode 100644 index b635a79007e..00000000000 --- a/projects/antimatter/index.js +++ /dev/null @@ -1,60 +0,0 @@ -const sdk = require("@defillama/sdk"); -const abi = require('./abi.json') - -const factory = "0x60d0769c4940cA58648C0AA34ecdf390a10F272e" -const usdt = "0xdac17f958d2ee523a2206206994597c13d831ec7" -async function tvl(timestamp, ethBlock) { - const balances = {}; - const contractsLength = await sdk.api.abi.call({ - target:factory, - abi: abi.length, - block:ethBlock - }) - const calls = []; - for(let i=0; iresult.output) - const underlying = await sdk.api.abi.multiCall({ - calls: contracts.map(contract=>({ - target: contract - })), - block: ethBlock, - abi: abi.underlying - }); - const underlyingBalances = await sdk.api.abi.multiCall({ - calls: underlying.output.map(call=>[{ - target: call.output, - params: [call.input.target] - },{ - target: usdt, - params: [call.input.target] - }]).flat(), - block: ethBlock, - abi: "erc20:balanceOf" - }); - sdk.util.sumMultiBalanceOf(balances, underlyingBalances, true) - - return balances -} - -module.exports = { - ethereum: { - tvl - }, -} \ No newline at end of file diff --git a/projects/antimatterDAO/abi.json b/projects/antimatterDAO/abi.json index 8bfe364c354..d0ea9b93b40 100644 --- a/projects/antimatterDAO/abi.json +++ b/projects/antimatterDAO/abi.json @@ -1,83 +1,7 @@ { - "staking": { - "TVL": { - "inputs": [], - "name": "TVL", - "outputs": [ - { - "internalType": "uint256", - "name": "tvl", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } - }, - "bullbear": { - "allCalls": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "allCalls", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "allPuts": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "allPuts", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "underlying": { - "inputs": [], - "name": "underlying", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "length": { - "inputs": [], - "name": "length", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } - } -} \ No newline at end of file + "TVL": "uint256:TVL", + "allCalls": "function allCalls(uint256) view returns (address)", + "allPuts": "function allPuts(uint256) view returns (address)", + "underlying": "address:underlying", + "length": "uint256:length" +} diff --git a/projects/antimatterDAO/index.js b/projects/antimatterDAO/index.js index d57c62f86b7..62468dc7f70 100644 --- a/projects/antimatterDAO/index.js +++ b/projects/antimatterDAO/index.js @@ -1,181 +1,67 @@ -const sdk = require("@defillama/sdk"); +const ADDRESSES = require('../helper/coreAssets.json') const abi = require("./abi.json"); +const { sumTokens2 } = require('../helper/unwrapLPs') +const { staking } = require('../helper/staking') const antimatterStakingContract = "0xCB8429f22541E8F5cd8ea6c20BFFdcE7cDA65227"; const dualInvestContract = "0x7E45149820Fa33B66DCD3fd57158A0E755A67a16"; const dualInvestManagerAddress = "0x32275702f5A47Dcd89705c1ea4d47E99517b0e1a"; -const bscBTCContract = "0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c"; -const bscUSDTContract = "0x55d398326f99059fF775485246999027B3197955"; -const bscETHContract = "0x2170Ed0880ac9A755fd29B2688956BD959F933F8"; +const bscBTCContract = ADDRESSES.bsc.BTCB; +const bscUSDTContract = ADDRESSES.bsc.USDT; +const bscETHContract = ADDRESSES.bsc.ETH; +const kavaUSDTContract = ADDRESSES.moonriver.USDT; +const kavaBTCContract = ADDRESSES.moonriver.USDT; +const kavaDualinvertContract = "0x626B5c394542960faa9495e64E812d17D5B605F9"; -const factory = "0x90183C741CC13195884B6E332Aa0ac1F7c1E67Fa" +const factory = "0x90183C741CC13195884B6E332Aa0ac1F7c1E67Fa"; -async function bullbearTVL(block, chain, usdToken) { - const balances = {}; - const contractsLength = await sdk.api.abi.call({ - target: factory, - abi: abi.bullbear.length, - block, - chain, - }) - const calls = []; - for (let i = 0; i < Number(contractsLength.output); i++) { - calls.push({ - target: factory, - params: [i] - }) - } - const [allCalls, allPuts] = await Promise.all([ - sdk.api.abi.multiCall({ - calls, - block, - abi: abi.bullbear.allCalls, - chain, - }), - sdk.api.abi.multiCall({ - calls, - block, - abi: abi.bullbear.allPuts, - chain, - }) - ]) - const contracts = allCalls.output.concat(allPuts.output).map(result => result.output) - const underlying = await sdk.api.abi.multiCall({ - calls: contracts.map(contract => ({ - target: contract - })), - block, - abi: abi.bullbear.underlying, - chain, - }); - const underlyingBalances = await sdk.api.abi.multiCall({ - calls: underlying.output.map(call => [{ - target: call.output, - params: [call.input.target] - }, { - target: usdToken, - params: [call.input.target] - }]).flat(), - block, - abi: "erc20:balanceOf", - chain, - }); - sdk.util.sumMultiBalanceOf(balances, underlyingBalances, true) - return balances -} - -async function ethBullbearTVL(timestamp, ethBlock) { - return await bullbearTVL(ethBlock, 'ethereum', '0xdac17f958d2ee523a2206206994597c13d831ec7') +const usdTokens = { + bsc: ADDRESSES.bsc.BUSD, + ethereum: ADDRESSES.ethereum.USDT, + arbitrum: ADDRESSES.arbitrum.USDT, + avax: ADDRESSES.avax.USDC_e, } -async function bscBullbearTVL(block) { - return await bullbearTVL(block, 'bsc', '0xe9e7cea3dedca5984780bafc599bd69add087d56') +const dualInvest = { + bsc: { + tokens: [bscUSDTContract, bscBTCContract, bscETHContract,], + owners: [dualInvestContract,], + }, + kava: { + tokens: [kavaUSDTContract, kavaBTCContract,], + owners: [kavaDualinvertContract,], + }, } -async function arbitrumBullbearTVL(timestamp, ethBlock, chainBlocks) { - const balances = await bullbearTVL(chainBlocks['arbitrum'], 'arbitrum', '0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9') - const chainBalances = {} - Object.keys(balances).forEach(key => chainBalances['arbitrum:' + key] = balances[key]) - return chainBalances -} +module.exports = { + methodology: "Antimatter application is consist of four parts: 1) Antimatter structured product 2) Antimatter Bull and Bear 3) Antimatter Governance staking and 4) antimatter Nonfungible finance . There are assets locked in each part of the application on multiple chains. TVL is counted as the value of the underlying assets in each part of the application’s contract. Our TVL is calling contract from our smart contracts", +}; -async function avaxBullbearTVL(timestamp, ethBlock, chainBlocks) { - const balances = await bullbearTVL(chainBlocks['avax'], 'avax', '0xA7D7079b0FEaD91F3e65f86E8915Cb59c1a4C664') - const chainBalances = {} - Object.keys(balances).forEach(key => chainBalances['avax:' + key] = balances[key]) - return chainBalances -} +const chains = Object.keys(usdTokens) +chains.push('kava') -const dualInvestTVL = async (bscBlock) => { - const balances = {} - const usdtValue = await sdk.api.abi.multiCall({ - target: bscUSDTContract, - calls: [{ - target: bscUSDTContract, - params: dualInvestContract - }, - { - target: bscUSDTContract, - params: dualInvestManagerAddress - }], - params: dualInvestContract, - abi: "erc20:balanceOf", - block: bscBlock, - chain: "bsc" - }); - const btcValue = await sdk.api.abi.multiCall({ - target: bscUSDTContract, - calls: [{ - target: bscBTCContract, - params: dualInvestContract - }, - { - target: bscBTCContract, - params: dualInvestManagerAddress - }], - params: dualInvestContract, - abi: "erc20:balanceOf", - block: bscBlock, - chain: "bsc" - }); +chains.forEach(chain => { + module.exports[chain] = { tvl } +}) - const ethValue = await sdk.api.abi.multiCall({ - target: bscETHContract, - calls: [{ - target: bscETHContract, - params: dualInvestContract - }, - { - target: bscETHContract, - params: dualInvestManagerAddress - }], - params: dualInvestContract, - abi: "erc20:balanceOf", - block: bscBlock, - chain: "bsc" - }); +module.exports.ethereum.staking = staking(antimatterStakingContract, '0x9b99cca871be05119b2012fd4474731dd653febe') - sdk.util.sumMultiBalanceOf(balances, usdtValue, true); - sdk.util.sumMultiBalanceOf(balances, btcValue, true); - sdk.util.sumMultiBalanceOf(balances, ethValue, true) - return balances; -}; -const stakingTVL = async (timestamp, ethBlock) => { - const balances = {} - const { output: staked } = await sdk.api.abi.call({ - target: antimatterStakingContract, - abi: abi.staking.TVL, - block: ethBlock, - chain: "ethereum" - }); - sdk.util.sumSingleBalance(balances, '0xdac17f958d2ee523a2206206994597c13d831ec7', staked) - return balances -}; +async function tvl(_, _1, _2, { api }) { + let toa = [] + const usdToken = usdTokens[api.chain] + if (usdToken) { + const puts = await api.fetchList({ lengthAbi: abi.length, itemAbi: abi.allPuts, target: factory }) + const calls = await api.fetchList({ lengthAbi: abi.length, itemAbi: abi.allCalls, target: factory }) + const contracts = [...puts, ...calls] + toa = contracts.map(i => [usdToken, i]) + const underlyings = await api.multiCall({ abi: abi.underlying, calls: contracts }) + underlyings.forEach((v, i) => toa.push([v, contracts[i]])) + } -async function bscTVL(timestamp, ethBlock, chainBlocks) { - const dualinvestTVL = await dualInvestTVL(chainBlocks['bsc']) - const bullbearTvl = await bscBullbearTVL(chainBlocks['bsc']) - const tvl = Object.assign(dualinvestTVL, bullbearTvl) - const chainBalances = {} - Object.keys(tvl).forEach(key => chainBalances['bsc:' + key] = tvl[key]) - return chainBalances + const { owners = [], tokens = [] } = dualInvest[api.chain] || {} + if (tokens.length) { + owners.forEach(o => tokens.forEach(t => toa.push([t, o]))) + } + return sumTokens2({ api, tokensAndOwners: toa }) } - -module.exports = { - methodology: "Antimatter application is consist of four parts: 1) Antimatter structured product 2) Antimatter Bull and Bear 3) Antimatter Governance staking and 4) antimatter Nonfungible finance . There are assets locked in each part of the application on multiple chains. TVL is counted as the value of the underlying assets in each part of the application’s contract. Our TVL is calling contract from our smart contracts", - ethereum: { - staking: stakingTVL, // dao staking - tvl: ethBullbearTVL - }, - bsc: { - tvl: bscTVL - }, - arbitrum: { - tvl: arbitrumBullbearTVL - }, - avax:{ - tvl: avaxBullbearTVL - }, - timetravel: true, -}; \ No newline at end of file diff --git a/projects/anyhedge/index.js b/projects/anyhedge/index.js new file mode 100644 index 00000000000..a0fac108d3e --- /dev/null +++ b/projects/anyhedge/index.js @@ -0,0 +1,79 @@ +const axios = require("axios"); + + +const dayHistory = {}; + +async function GetDailyHistory() { + // Data & calculation method is fully reproducible, see: + // https://gitlab.com/0353F40E/anyhedge-stats/-/blob/master/readme.md + + let { data } = await axios.get('https://gitlab.com/0353F40E/anyhedge-stats/-/raw/master/stats_daily.csv'); + data = parseCSV(data); + + data.forEach((row) => { + if (!row.tvl) return; + dayHistory[row.day] = row.tvl; + }); +} + +async function getTVLAnyHedge(timestamp) { + const day = new Date(timestamp * 1000).toISOString().slice(0,10) + return dayHistory[day] +} + +async function tvl(timestamp) { + let tvlAnyHedge, testDataSource + + // tvl data lags by contract duration since contracts are secret until settled + // so tvl at current time will always be 0, and only later when contracts are revealed + // can it be calculated in retrospect and stats back-filled + // for this reason, we cut-off the data at (today-31d) + const lastTimestamp = Math.floor(new Date().getTime() / 1000 - 31*86400); + if (timestamp > lastTimestamp) + throw "Data for the date is incomplete, awaiting contract reveals." + + await GetDailyHistory(); + + tvlAnyHedge = await getTVLAnyHedge(timestamp) + testDataSource = await getTVLAnyHedge(timestamp + 31*86400) + + // if we're querying data for `timestamp`, a row for `timestamp+31d` should exist + if (testDataSource == null) + throw "Data source hasn't been updated yet." + + // if none of our scrape targets worked then throw an error + if (tvlAnyHedge == null) + throw "Unable to determine AnyHedge TVL." + + const bchTvl = Number(tvlAnyHedge).toFixed(); + + return { + 'bitcoin-cash': bchTvl + } +} + +module.exports = { + methodology: "Scrape the blockchain and filter for spent transaction outputs that match the contract's input script template. Aggregate them to compute TVL. The TVL data lags by contract duration since contracts are secret until settled. So, TVL at the current time will always be 0 and can only be calculated in retrospect and stats back-filled when contracts are revealed. For this reason, the code cuts-off the data at 31 days ago. See here for more details: https://gitlab.com/0353F40E/anyhedge-stats/-/blob/master/readme.md", + start: 1654787405, + bitcoincash: { tvl }, + hallmarks: [ + [1654787405, "First AnyHedge v0.11 Contract"], + [1663106400, "AnyHedge Alpha is live and available"], + [1666585080, "The BCH Bull (Beta) goes live"], + [1666785960, "Paytaca wallet's product live"], + ] +}; + +function parseCSV(csvData) { + csvData = csvData.replaceAll('\r', '').split('\n').map(i => i.split(',')) + const headers = csvData.shift() + return csvData.map(row => toObject(headers, row)) +} + +function toObject(keys, values) { + const res = {} + keys.forEach((key, i) => { + res[key] = values[i] + }) + return res +} diff --git a/projects/anyswap/index.js b/projects/anyswap/index.js index bf2c68d4607..583a4d470bc 100644 --- a/projects/anyswap/index.js +++ b/projects/anyswap/index.js @@ -1,4 +1,8 @@ -const { get } = require('../helper/http') +const sdk = require('@defillama/sdk') +const { sumTokens } = require('../helper/sumTokens') +const { getConfig } = require('../helper/cache') +const ADDRESSES = require('../helper/coreAssets.json') + const chains = { '1': 'ethereum', @@ -29,6 +33,7 @@ const chains = { '1024': 'clv', '1030': 'conflux', '1088': 'metis', + '1101': 'polygon_zkevm', '1284': 'moonbeam', '1285': 'moonriver', '1818': 'cube', @@ -57,68 +62,45 @@ const chains = { '32520': 'bitgert' } - - -const sleep = ms => new Promise(r => setTimeout(r, ms)); - -let coingeckoMcapsPromise - -async function getCgMcaps() { - if (coingeckoMcapsPromise) { - return coingeckoMcapsPromise - } - coingeckoMcapsPromise = new Promise(async (resolve) => { - const protocolsInChain = await getChainData() - const protocolsWithRouters = Array.from(new Set(protocolsInChain.filter(p => p.type === "router" && p.label !== null).map(p => p.label.toLowerCase()))); - - const coingeckoMcaps = {} - const step = 200;; - for (let i = 0; i < protocolsWithRouters.length; i += step) { - console.log(i / step) - const cgUrl = `https://api.coingecko.com/api/v3/simple/price?vs_currencies=usd&include_market_cap=true&ids=${protocolsWithRouters.slice(i, i + step).join(',') - }` - await sleep(1e3) - const partMcaps = await get(cgUrl) - Object.assign(coingeckoMcaps, partMcaps) - } - resolve(coingeckoMcaps) - }) - return coingeckoMcapsPromise -} - let chainData async function getChainData() { - if (!chainData) chainData = get('https://netapi.anyswap.net/bridge/v2/info').then(i => i.bridgeList.filter(j => j.amount > 0)) + if (!chainData) chainData = getConfig('anyswap-config', 'https://netapi.anyswap.net/bridge/v2/info').then(i => i.bridgeList.filter(j => j.amount > 0)) return chainData } +const blacklistedTokens = [ + '0xc342774492b54ce5f8ac662113ed702fc1b34972' // BGEO +] + +const EXECUTOR = '0x2A038e100F8B85DF21e4d44121bdBfE0c288A869' +const NEW_ADDR = '0x1eed63efba5f81d95bfe37d82c8e736b974f477b' + function fetchChain(chain) { - return async () => { + return async (_, _1, _2, { api }) => { const data = await getChainData() - const protocolsInChain = chain === null ? data : data.filter(p => p.chainId.toString() === chain.toString()) - - const coingeckoMcaps = await getCgMcaps(); - const counted = {} - let total = 0 + const protocolsInChain = chain === null ? data : data.filter(p => p.srcChainId.toString() === chain.toString()) + const tokensAndOwners = [] protocolsInChain.forEach((item) => { - const tvl = Number(item.tvl || 0) - if (item.type === "bridge") { - total += tvl - } else if (item.type === "router") { - const label = item.label - const mcap = coingeckoMcaps[label]?.usd_market_cap - if (counted[label] === undefined) { - counted[label] = 0 + let token = item.srcToken + let owner = item.depositAddr + if (owner.startsWith("0x") && !token.startsWith("0x")) { + sdk.log(chain, 'replace', token, 'with null') + token = ADDRESSES.null } - if (mcap !== undefined && mcap > counted[label]) { - const tvlToAdd = Math.min(tvl, mcap - counted[label]) - total += tvlToAdd - counted[label] += tvlToAdd + tokensAndOwners.push([token, owner]) + tokensAndOwners.push([token, EXECUTOR]) + // tokensAndOwners.push([token, NEW_ADDR]) + } else if (item.type === "router") { + if (item.token === item.srcToken && item.underlying) { + tokensAndOwners.push([item.underlying, item.token]) + tokensAndOwners.push([item.underlying, EXECUTOR]) + // tokensAndOwners.push([item.underlying, NEW_ADDR]) } } }) - return total + + return sumTokens({ api, tokensAndOwners, blacklistedTokens, }) } } @@ -127,7 +109,7 @@ const chainTvls = {} Object.keys(chains).forEach((chain) => { const chainName = chains[chain] chainTvls[chainName] = { - fetch: fetchChain(chain) + tvl: fetchChain(chain) } }) @@ -135,8 +117,9 @@ module.exports = { misrepresentedTokens: true, timetravel: false, ...chainTvls, - fetch: fetchChain(null), - hallmarks:[ + // fetch: fetchChain(null), + hallmarks: [ [1651881600, "UST depeg"], + [1689202800,"Access to Wallets Lost"] ], } diff --git a/projects/apeCoinStaking/config.js b/projects/apeCoinStaking/config.js new file mode 100644 index 00000000000..0f05f9f400c --- /dev/null +++ b/projects/apeCoinStaking/config.js @@ -0,0 +1,4 @@ +module.exports = { + "APE_COIN_STAKE_VAULT": "0xAfc2BE801F55Cb0ee2D65C11EB14F88cbD6C576C", + "APE_COIN": "0x4d224452801ACEd8B2F0aebE155379bb5D594381" +} \ No newline at end of file diff --git a/projects/apeCoinStaking/index.js b/projects/apeCoinStaking/index.js new file mode 100644 index 00000000000..b4204b00cdf --- /dev/null +++ b/projects/apeCoinStaking/index.js @@ -0,0 +1,19 @@ +const sdk = require("@defillama/sdk"); +const config = require("./config"); + +async function tvl(_, _1, _2, { api }) { + const balances = {}; + + const totalAssets = await api.call({ + abi: "function totalAssets() public view returns(uint256)", + target: config.APE_COIN_STAKE_VAULT, + }); + + sdk.util.sumSingleBalance(balances, config.APE_COIN, totalAssets, api.chain); + + return balances; +} + +module.exports = { + ethereum: { tvl } +} \ No newline at end of file diff --git a/projects/aperocket/abi.json b/projects/aperocket/abi.json index 1fbeee79e1e..8f90529e6e9 100644 --- a/projects/aperocket/abi.json +++ b/projects/aperocket/abi.json @@ -1,50 +1,4 @@ -{ - "tvlOfPool": { - "inputs": [ - { - "internalType": "address", - "name": "vault", - "type": "address" - } - ], - "name": "tvlOfPool", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "tvlOfVault": { - "inputs": [ - { - "internalType": "address", - "name": "_vault", - "type": "address" - }, - { - "internalType": "bool", - "name": "isLp", - "type": "bool" - }, - { - "internalType": "address", - "name": "tokenRouter", - "type": "address" - } - ], - "name": "tvlOfVault", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } +{ + "tvlOfPool": "function tvlOfPool(address vault) view returns (uint256)", + "tvlOfVault": "function tvlOfVault(address _vault, bool isLp, address tokenRouter) view returns (uint256)" } \ No newline at end of file diff --git a/projects/aperture/abi.json b/projects/aperture/abi.json index 2b937223205..1406ebe36ab 100644 --- a/projects/aperture/abi.json +++ b/projects/aperture/abi.json @@ -1,65 +1,6 @@ { - "getStrategyId": { - "inputs": [], - "name": "nextStrategyId", - "outputs": [ - { - "internalType": "uint64", - "name": "", - "type": "uint64" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getLeverage": { - "inputs": [], - "name": "leverageLevel", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getEquityETHValue": { - "inputs": [], - "name": "getEquityETHValue", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getETHPx": { - "inputs": [ - { - "internalType": "address", - "name": "oracle", - "type": "address" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "name": "getETHPx", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -} + "getStrategyId": "uint64:nextStrategyId", + "getLeverage": "uint256:leverageLevel", + "getEquityETHValue": "uint256:getEquityETHValue", + "getETHPx": "function getETHPx(address oracle, address token) view returns (uint256)" +} \ No newline at end of file diff --git a/projects/aperture/getVaults.js b/projects/aperture/getVaults.js index e9bd6756cb9..dc2a35f7484 100644 --- a/projects/aperture/getVaults.js +++ b/projects/aperture/getVaults.js @@ -5,33 +5,7 @@ const { getParamCalls, getUniqueAddresses } = require('../helper/utils') const APERTURE_MANAGER_ADDRESS = "0xeD380115259FcC9088c187Be1279678e23a6E565"; const abis = { - strategyIdToMetadata: { - "inputs": [ - { - "name": "arg0", - "type": "uint64" - }], - "name": "strategyIdToMetadata", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - }, - { - "internalType": "string", - "name": "", - "type": "string" - }, - { - "internalType": "contract IERC20", - "name": "", - "type": "address" - }, - ], - "stateMutability": "view", - "type": "function" - }, + strategyIdToMetadata: "function strategyIdToMetadata(uint64 arg0) view returns (string, string, address)", } async function getVaults(chain, block) { diff --git a/projects/aperture/index.js b/projects/aperture/index.js index 622b722f3e1..d7f269fc488 100644 --- a/projects/aperture/index.js +++ b/projects/aperture/index.js @@ -1,61 +1,3 @@ -const { queryContractStore } = require("../helper/chain/terra"); -const { log } = require("../helper/utils"); - -const TERRA_MANAGER = "terra1ajkmy2c0g84seh66apv9x6xt6kd3ag80jmcvtz"; -const APERTURE_CONTRACT = "terra1jvehz6d9gk3gl4tldrzd8qzj8zfkurfvtcg99x"; -let openPositions = require("./openPositions.json"); - -const currentQueriedCount = 11190; - -async function terra_tvl() { - let sumTvl = 0; - const { next_position_id } = await queryContractStore({ - contract: TERRA_MANAGER, - queryParam: { get_next_position_id: {} }, - }); - for (let i = currentQueriedCount; i < +next_position_id; i++) - openPositions.push(i); - - log(next_position_id, currentQueriedCount, openPositions.length); - const positions = openPositions.map((_value) => ({ - chain_id: 3, - position_id: `${_value}`, - })); - - const chunkSize = 50; - for (let i = 0; i < positions.length; i += chunkSize) { - log("fetching %s of %s", i, positions.length); - await Promise.all( - positions.slice(i, i + chunkSize).map(async (position) => { - const { - items: [ - { - info: { position_close_info, detailed_info }, - }, - ], - } = await queryContractStore({ - contract: APERTURE_CONTRACT, - queryParam: getQuery(position), - }); - - if (!position_close_info) - // position is closed no need to add it to tvl - sumTvl += +detailed_info.uusd_value; - }) - ); - } - - log("Final UST sum: %s", sumTvl); - - return { - terrausd: sumTvl / 1e6, - }; - - function getQuery(postion) { - return { batch_get_position_info: { positions: [postion] } }; - } -} - const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); const { default: BigNumber } = require("bignumber.js"); @@ -102,7 +44,7 @@ module.exports = { tvl: avax_tvl, }, terra: { - tvl: terra_tvl, + tvl: () => ({}), }, hallmarks: [[1651881600, "UST depeg"]], }; diff --git a/projects/aperture/openPositions.json b/projects/aperture/openPositions.json deleted file mode 100644 index 0fd224f8358..00000000000 --- a/projects/aperture/openPositions.json +++ /dev/null @@ -1 +0,0 @@ -[10,11,13,18,23,34,50,61,64,65,68,69,79,100,103,106,117,130,131,180,182,189,192,200,201,202,217,218,228,235,237,239,243,321,325,362,364,374,385,386,388,403,404,429,430,431,456,472,496,528,576,595,628,635,639,643,654,658,682,723,747,768,771,774,792,793,839,841,842,843,844,845,846,847,866,895,936,941,954,960,967,975,978,1006,1021,1026,1027,1039,1046,1047,1114,1117,1125,1145,1147,1157,1207,1209,1210,1230,1231,1238,1241,1248,1258,1266,1278,1282,1292,1297,1353,1392,1397,1398,1399,1404,1416,1417,1440,1444,1513,1514,1541,1546,1559,1572,1573,1579,1586,1587,1588,1593,1594,1630,1631,1638,1639,1649,1652,1658,1659,1662,1667,1692,1719,1721,1731,1761,1777,1786,1788,1802,1803,1807,1836,1840,1845,1846,1847,1858,1861,1882,1902,1940,1954,1992,1998,2022,2048,2053,2058,2099,2100,2101,2102,2115,2120,2124,2126,2133,2136,2137,2157,2158,2160,2171,2175,2179,2190,2217,2218,2233,2234,2236,2240,2241,2246,2258,2269,2272,2285,2289,2300,2301,2302,2303,2304,2305,2306,2315,2316,2319,2324,2327,2330,2335,2337,2339,2340,2341,2342,2343,2344,2356,2377,2379,2382,2391,2422,2424,2425,2428,2429,2431,2434,2438,2443,2451,2454,2466,2474,2476,2481,2482,2483,2489,2490,2491,2496,2499,2507,2508,2509,2510,2524,2535,2547,2563,2582,2590,2607,2611,2618,2626,2628,2637,2653,2659,2665,2677,2702,2704,2712,2714,2791,2831,2832,2834,2835,2861,2874,2884,2905,2919,2973,2988,3005,3016,3037,3048,3113,3199,3204,3208,3221,3259,3267,3270,3277,3290,3293,3306,3310,3327,3351,3386,3460,3482,3549,3561,3583,3622,3668,3702,3716,3726,3744,3763,3782,3785,3805,3806,3821,3824,3864,3971,3985,4020,4021,4025,4030,4074,4075,4086,4126,4128,4129,4141,4151,4155,4169,4228,4243,4258,4322,4354,4367,4414,4415,4462,4464,4474,4486,4496,4504,4514,4525,4581,4644,4666,4698,4737,4740,4741,4754,4780,4783,4786,4798,4829,4836,4840,4849,4850,4853,4888,4905,4916,4943,5023,5028,5071,5080,5101,5128,5157,5159,5187,5188,5194,5207,5217,5223,5225,5226,5258,5263,5264,5281,5296,5357,5389,5433,5434,5451,5455,5459,5460,5535,5613,5638,5678,5680,5693,5699,5711,5712,5714,5718,5720,5721,5733,5743,5756,5759,5760,5793,5800,5802,5805,5806,5931,5957,5979,5999,6000,6008,6010,6012,6049,6073,6090,6108,6131,6141,6155,6165,6280,6329,6332,6337,6352,6378,6401,6435,6440,6506,6519,6528,6600,6610,6624,6632,6663,6665,6691,6705,6712,6748,6753,6759,6811,6819,6820,6848,6849,6851,6853,6865,6884,6913,6914,6922,6924,6934,6953,6955,6956,6968,6991,7000,7018,7022,7050,7062,7070,7108,7124,7134,7137,7184,7189,7192,7213,7228,7255,7265,7267,7268,7271,7279,7285,7293,7294,7295,7336,7337,7385,7390,7394,7400,7446,7451,7454,7478,7493,7494,7496,7499,7509,7510,7511,7514,7544,7546,7548,7553,7555,7571,7573,7575,7586,7609,7620,7653,7673,7682,7711,7712,7724,7759,7763,7792,7794,7807,7808,7809,7811,7812,7836,7837,7846,7856,7888,7894,7900,7924,7960,7976,7979,8001,8004,8007,8053,8083,8087,8092,8094,8102,8103,8107,8116,8117,8118,8133,8136,8155,8159,8163,8166,8168,8188,8194,8209,8213,8218,8228,8231,8234,8237,8258,8259,8260,8263,8264,8281,8294,8300,8319,8323,8332,8355,8356,8397,8453,8460,8473,8478,8479,8480,8489,8490,8522,8523,8535,8545,8547,8561,8574,8577,8578,8587,8606,8609,8653,8668,8691,8693,8696,8697,8701,8712,8713,8714,8719,8726,8752,8761,8766,8769,8793,8798,8809,8838,8843,8850,8853,8855,8856,8875,8881,8888,8894,8899,8909,8913,8934,8949,8951,8990,8994,8995,9002,9005,9013,9033,9034,9035,9046,9055,9061,9063,9072,9089,9099,9106,9115,9117,9120,9121,9135,9136,9137,9141,9153,9169,9174,9179,9196,9200,9206,9208,9213,9236,9241,9244,9261,9264,9267,9338,9363,9370,9400,9404,9413,9433,9455,9462,9479,9484,9492,9504,9535,9543,9553,9555,9624,9625,9647,9649,9665,9674,9682,9685,9691,9694,9721,9722,9723,9726,9734,9743,9751,9759,9864,9881,9883,9898,9902,9918,9921,9936,9937,9947,9957,9958,9987,9988,10012,10013,10031,10033,10035,10046,10058,10059,10060,10067,10078,10081,10089,10101,10102,10103,10106,10122,10156,10162,10183,10193,10194,10204,10206,10211,10221,10224,10263,10272,10285,10286,10288,10290,10298,10299,10313,10331,10337,10338,10366,10370,10371,10372,10373,10374,10380,10392,10395,10401,10403,10415,10441,10462,10471,10481,10483,10489,10491,10492,10517,10549,10552,10553,10555,10556,10557,10559,10563,10566,10583,10596,10624,10655,10696,10697,10702,10704,10707,10708,10711,10724,10726,10730,10731,10735,10749,10750,10751,10754,10760,10764,10768,10772,10778,10786,10789,10822,10862,10910,10935,10949,10952,10954,10959,10993,10997,11003,11007,11017,11019,11021,11022,11026,11042,11048,11060,11063,11066,11090,11104,11108,11109,11130,11148,11151,11152,11155,11163,11164,11165,11177,11182,11185] \ No newline at end of file diff --git a/projects/apeswap-amm/index.js b/projects/apeswap-amm/index.js index f7818c01cd4..99157d69bc7 100644 --- a/projects/apeswap-amm/index.js +++ b/projects/apeswap-amm/index.js @@ -1,32 +1,45 @@ const { staking } = require("../helper/staking.js"); -const { getUniTVL } = require('../helper/unknownTokens') -const { getChainTvl } = require('../helper/getUniSubgraphTvl') +const { getUniTVL } = require("../helper/unknownTokens"); -const BANANA_TOKEN = '0x603c7f932ED1fc6575303D8Fb018fDCBb0f39a95' -const MASTER_APE = '0x5c8D727b265DBAfaba67E050f2f739cAeEB4A6F9' +const BANANA_TOKEN = "0x603c7f932ED1fc6575303D8Fb018fDCBb0f39a95"; +const MASTER_APE = "0x5c8D727b265DBAfaba67E050f2f739cAeEB4A6F9"; +const MASTER_APE_V2 = "0x71354AC3c695dfB1d3f595AfA5D4364e9e06339B"; const FACTORY_BSC = "0x0841BD0B734E4F5853f0dD8d7Ea041c241fb0Da6"; const FACTORY_POLYGON = "0xcf083be4164828f00cae704ec15a36d711491284"; const FACTORY_ETHEREUM = "0xBAe5dc9B19004883d0377419FeF3c2C8832d7d7B"; - -const chainTvls = getChainTvl({ - bsc: 'https://bnb.apeswapgraphs.com/subgraphs/name/ape-swap/apeswap-subgraph', - polygon: 'https://api.thegraph.com/subgraphs/name/apeswapfinance/dex-polygon', -}) +const FACTORY_TELOS = "0x411172Dfcd5f68307656A1ff35520841C2F7fAec"; +const FACTORY_ARBITRUM = "0xCf083Be4164828f00cAE704EC15a36D711491284" module.exports = { misrepresentedTokens: true, bsc: { - tvl: chainTvls('bsc'), - staking: staking(MASTER_APE, BANANA_TOKEN, "bsc"), + tvl: getUniTVL({ + factory: FACTORY_BSC, + useDefaultCoreAssets: true, + }), + staking: staking([MASTER_APE, MASTER_APE_V2], BANANA_TOKEN, "bsc"), }, polygon: { - tvl: getUniTVL({ factory: FACTORY_POLYGON, chain: 'polygon', useDefaultCoreAssets: true }), + tvl: getUniTVL({ + factory: FACTORY_POLYGON, + useDefaultCoreAssets: true, + }), }, ethereum: { tvl: getUniTVL({ factory: FACTORY_ETHEREUM, useDefaultCoreAssets: true }), }, telos: { - tvl: getUniTVL({ factory: '0x411172Dfcd5f68307656A1ff35520841C2F7fAec', chain: 'telos', useDefaultCoreAssets: true }), + tvl: getUniTVL({ + factory: FACTORY_TELOS, + useDefaultCoreAssets: true, + }), + }, + arbitrum: { + tvl: getUniTVL({ + factory: FACTORY_ARBITRUM, + useDefaultCoreAssets: true, + }), }, - methodology: "TVL comes from the DEX liquidity pools, staking TVL is accounted as the banana on 0x5c8D727b265DBAfaba67E050f2f739cAeEB4A6F9", -} \ No newline at end of file + methodology: + "TVL comes from the DEX liquidity pools, staking TVL is accounted as the banana on 0x5c8D727b265DBAfaba67E050f2f739cAeEB4A6F9 and 0x71354AC3c695dfB1d3f595AfA5D4364e9e06339B", +}; diff --git a/projects/apeswap-lending/index.js b/projects/apeswap-lending/index.js index e33841ee70d..de0d05409f0 100644 --- a/projects/apeswap-lending/index.js +++ b/projects/apeswap-lending/index.js @@ -1,14 +1,10 @@ -const sdk = require("@defillama/sdk"); const {usdCompoundExports} = require('../helper/compound'); -const { transformBscAddress } = require("../helper/portedTokens.js"); -const BANANA_TOKEN = '0x603c7f932ED1fc6575303D8Fb018fDCBb0f39a95' const unitroller_bsc = "0xad48b2c9dc6709a560018c678e918253a65df86e" - const abis = { - oracle: {"constant":true,"inputs":[],"name":"getRegistry","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"}, - underlyingPrice: {"constant":true,"inputs":[{"internalType":"address","name":"cToken","type":"address"}],"name":"getPriceForUnderling","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"}, + oracle: "address:getRegistry", + underlyingPrice: "function getPriceForUnderling(address cToken) view returns (uint256)", } const lendingMarket = usdCompoundExports(unitroller_bsc, "bsc", "0x34878F6a484005AA90E7188a546Ea9E52b538F6f", abis) diff --git a/projects/apex/index.js b/projects/apex/index.js index 241e52eca51..b07ea7615c1 100644 --- a/projects/apex/index.js +++ b/projects/apex/index.js @@ -1,25 +1,14 @@ -const { - GraphQLClient, - gql -} = require('graphql-request') - -async function fetch() { - - var endpoint = 'https://api.apex.exchange/g2/subgraphs/name/apex/exchange' - var graphQLClient = new GraphQLClient(endpoint) - - var query = gql ` - { - dexFactories{ - totalLiquidityUSD - } - } - `; - - const results = await graphQLClient.request(query) - return parseFloat(results.dexFactories[0].totalLiquidityUSD) -} - +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require('../helper/unwrapLPs') +const tokens = [ + ADDRESSES.ethereum.USDC, +]; + +const owners = [ + '0xA1D5443F2FB80A5A55ac804C948B45ce4C52DCbb' +] module.exports = { - fetch -} \ No newline at end of file + start: 15402867, + ethereum: { tvl: sumTokensExport({ owners, tokens, }) }, + arbitrum: { tvl: () => 0 } +}; diff --git a/projects/apexswap/index.js b/projects/apexswap/index.js index f7b34fe421f..d509b1c8a36 100644 --- a/projects/apexswap/index.js +++ b/projects/apexswap/index.js @@ -2,10 +2,12 @@ const { getUniTVL } = require('../helper/unknownTokens') module.exports = { misrepresentedTokens: true, + hallmarks: [ + [1665532800, "Rug Pull"] + ], avax: { tvl: getUniTVL({ factory: '0x21cadeb92c8bbfbef98c3098846f0999209c3a97', - chain: 'avax', useDefaultCoreAssets: true }) }, diff --git a/projects/api3/abi.json b/projects/api3/abi.json deleted file mode 100644 index 5176eed4436..00000000000 --- a/projects/api3/abi.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "getLockedByGovernance": {"inputs":[],"name":"getLockedByGovernance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}, - "getLockedRewards": {"inputs":[],"name":"getLockedRewards","outputs":[{"internalType":"uint256","name":"totalLockedRewards","type":"uint256"}],"stateMutability":"view","type":"function"}, - "getLockedVestings": {"inputs":[],"name":"getLockedVestings","outputs":[{"internalType":"uint256","name":"totalLockedVestings","type":"uint256"}],"stateMutability":"view","type":"function"}, - "getTimelocked": {"inputs":[],"name":"getTimelocked","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}, - "getTotalLocked": {"inputs":[],"name":"getTotalLocked","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"} -} \ No newline at end of file diff --git a/projects/api3/index.js b/projects/api3/index.js index 1b5873bfcd3..c94505487dd 100644 --- a/projects/api3/index.js +++ b/projects/api3/index.js @@ -1,33 +1,24 @@ const sdk = require('@defillama/sdk'); -const { staking } = require('../helper/staking') -const { BigNumber } = require('bignumber.js'); -const abi = require('./abi.json') +const { sumTokens2 } = require('../helper/unwrapLPs') const api3_token = '0x0b38210ea11411557c13457d4da7dc6ea731b88a' const api3_dao_pool = '0x6dd655f10d4b9e242ae186d9050b68f725c76d76' -const api3CirculatingSupply = "cD34bC5B03C954268d27c9Bc165a623c318bD0a8" +const api3CirculatingSupply = "0xcD34bC5B03C954268d27c9Bc165a623c318bD0a8" -const stakingTVL = async (timestamp, ethBlock, chainBlocks) => { - const staked = await staking(api3_dao_pool, api3_token)(timestamp, ethBlock, chainBlocks) - - const { output: locked_and_vested } = await sdk.api.abi.call({ +const stakingTVL = async (timestamp, ethBlock, chainBlocks, { api }) => { + const balances = {} + const locked_and_vested = await api.call({ target: api3CirculatingSupply, - abi: abi["getLockedVestings"], - block: ethBlock, - chain: 'ethereum' - }); - console.log(staked, locked_and_vested) - staked[api3_token] = BigNumber(staked[api3_token]).minus(BigNumber(locked_and_vested)).toFixed(0) - console.log(staked) + abi: "uint256:getLockedVestings", + }) - return staked + sdk.util.sumSingleBalance(balances,api3_token,locked_and_vested * -1, api.chain) + return sumTokens2({ owner: api3_dao_pool, tokens: [api3_token], balances, api }) } -// TODO: choose if this should be counted as staking or tvl, since this is how the protocol functions (to insure dAPI) module.exports = { ethereum: { staking: stakingTVL, // tvl / staking - // staking: staking(api3_dao_pool, api3_token), // tvl / staking tvl: () => ({}) }, methodology: 'API3 TVL is all API3 token staked in the API3 DAO Pool contract', diff --git a/projects/apollodao/index.js b/projects/apollodao/index.js index 49a7d2097a2..6ef923eeaba 100644 --- a/projects/apollodao/index.js +++ b/projects/apollodao/index.js @@ -1,13 +1,97 @@ // vaults are closed: https://articles.apollo.farm/apollo-dao-will-be-closing-vaults-on-terra-classic/ +const axios = require("axios"); +const { endPoints, queryContract } = require('../helper/chain/cosmos') + +const chain = 'osmosis' + +const contractAddresses = { + atom_statom: "osmo1a6tcf60pyz8qq2n532dzcs7s7sj8klcmra04tvaqympzcvxqg9esn7xz7l", + atom_osmo: "osmo1g3kmqpp8608szfp0pdag3r6z85npph7wmccat8lgl3mp407kv73qlj7qwp", + usdc_osmo: "osmo1jfmwayj8jqp9tfy4v4eks5c2jpnqdumn8x8xvfllng0wfes770qqp7jl4j", + st_osmo_osmo: "osmo1p4zqs5y2w5srzd2vesznzu5ql8wfq9tpz3e7mf2j3y07nxrtkdes5r5g0t", + wbtc_osmo: "osmo185gqewrlde8vrqw7j8lpad67v8jfrx9u7770k9q87tqqecctp5tq50wt2c", + strd_osmo: "osmo1e3qjfcg9adrauz6jg030ptfy35r6zzplsgaavnn6xrh6686udhfqq7muwy", + evmos_osmo: "osmo1rkv6vcmty4rpypuxp2a6a0y5ze4ztm3y6d6xwy5a7cye85f7reqsm85c5s", + juno_osmo: "osmo1ceku0zks6y43r9l35n7wnv5pf82s6l4k5jhlrhkurakeemey9n4snz3x6z", + weth_osmo: "osmo1r235f4tdkwrsnj3mdm9hf647l754y6g6xsmz0nas5r4vr5tda3qsgtftef", + ist_osmo: "osmo1qajgwrcce9srkq370pa9ew96dyk4hajyyk6rfpuexrktm8862xnst443kp", + ion_osmo: "osmo1869zena97sctemj78sgjmu737p2g94905hsf3hhkrfgummrfz4tsxj2k6r", + cro_osmo: "osmo1gmd2vc4crmv7urlfn3j5avhplfncjf5mg649dkgsu5a0zvd6cgrsn9dq4l", + axl_osmo: "osmo1m9e4cks405tvzlppkw64znr35vkvujvptrdqtgu5q6luk4ccw9qqeuenwd", + dai_osmo: "osmo1lhs6kyuxytu4suua0qf88z5057wzpxs77tyrlgztw2uctcy75hcqf2ajrt", + akt_osmo: "osmo122ryl7pez7yjprtvjckltu2uvjxrq3kqt4nvclax2la7maj6757qg054ga", +}; + +async function tvl(_, _1, _2, { api }) { + if (api.chain != "osmosis") return {} + for (const contractName in contractAddresses) { + let contractAddress = contractAddresses[contractName]; + let vaultInfo = await queryContract({ + contract: contractAddress, + chain: 'osmosis', + data: { 'info': {} } + }); + const gammToken = vaultInfo.base_token; + const poolID = gammToken.split('gamm/pool/')[1]; + let totalAssets = await queryContract({ + contract: contractAddress, + chain: 'osmosis', + data: { 'total_assets': {} } + }); + + let poolEndpoint = `${endPoints[chain]}/osmosis/gamm/v1beta1/pools/${poolID}`; + const poolData = (await axios.get(poolEndpoint)).data.pool; + + let amount = calculateTokenAmounts(poolData, totalAssets) + for (const denom in amount) { + api.add(denom, amount[denom]) + } + } +} + +function calculateTokenAmounts(poolData, gammAmount) { + // Extract the total pool shares. + let totalShares = poolData.total_shares.amount; + + // Initialize an object to hold the amounts of each token. + let tokenAmounts = {}; + + // For each token in the pool... + if (typeof poolData.pool_assets !== "undefined") { + for (let asset of poolData.pool_assets) { + // Extract the token's denom and amount. + let denom = asset.token.denom; + let assetAmount = asset.token.amount; + + // Calculate the amount of this token that corresponds to the given amount of pool shares. + tokenAmounts[denom] = (gammAmount * assetAmount) / totalShares; + } + } else { + for (let asset of poolData.pool_liquidity) { + // Extract the token's denom and amount. + let denom = asset.denom; + let assetAmount = asset.amount; + + // Calculate the amount of this token that corresponds to the given amount of pool shares. + tokenAmounts[denom] = (gammAmount * assetAmount) / totalShares; + } + } + + return tokenAmounts; +} module.exports = { timetravel: false, methodology: "Total TVL on vaults", terra: { - tvl: () => ({}) + tvl: () => 0 + }, + osmosis: { + tvl, }, -}, - module.exports.hallmarks = [ + hallmarks: [ [1651881600, "UST depeg"], [Math.floor(new Date('2022-09-13') / 1e3), 'Stop supporting Terra Classic'], - ] + [Math.floor(new Date('2023-02-16') / 1e3), 'Relaunch on Osmosis '], + ], +} diff --git a/projects/apollox/index.js b/projects/apollox/index.js index 6e1a3105f31..158e5a0d414 100644 --- a/projects/apollox/index.js +++ b/projects/apollox/index.js @@ -1,38 +1,92 @@ -const { pool2 } = require('../helper/pool2'); -const { stakings } = require('../helper/staking'); -const { sumTokens } = require('../helper/unwrapLPs'); +const ADDRESSES = require('../helper/coreAssets.json') +const { pool2s } = require("../helper/pool2"); +const { stakings } = require("../helper/staking"); +const { sumTokens, sumTokensExport, nullAddress } = require("../helper/unwrapLPs"); -const stakingContract = '0x7eb5af418f199ea47494023c3a8b83a210f8846f' -const stakingContract_APX = '0x6bE863e01E17A226c945e3629D0D9Cb6E52Ce90E' -const poolContract = '0xa0ee789a8f581cb92dd9742ed0b5d54a0916976c' -const treasureContract = '0xe2e912f0b1b5961be7cb0d6dbb4a920ace06cd99' -const daoContract = "0x7f878994507F5B0588cF0EBEE07128d9A742ad9d" +const stakingContract = "0x7eb5af418f199ea47494023c3a8b83a210f8846f"; +const stakingContract_APX = "0x6bE863e01E17A226c945e3629D0D9Cb6E52Ce90E"; +const poolContract = "0xa0ee789a8f581cb92dd9742ed0b5d54a0916976c"; +const stakingContractV2 = "0x60d910f9dE5c6Fd2171716042AF2Fd3D2Aa9D942"; +const poolContractV2 = "0xAf839f4D3620a1EED00cCc21dDC01119C26a75E1"; +const treasureContract = "0xe2e912f0b1b5961be7cb0d6dbb4a920ace06cd99"; +const daoContract = "0x7f878994507F5B0588cF0EBEE07128d9A742ad9d"; +const ALPContract = "0x1b6F2d3844C6ae7D56ceb3C3643b9060ba28FEb0"; -const TOKEN_APX = '0x78f5d389f5cdccfc41594abab4b0ed02f31398b3' -const TOKEN_BSC_USD = '0x55d398326f99059fF775485246999027B3197955' -const TOKEN_BUSD = '0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56' -const TOKEN_CAKE = '0x0e09fabb73bd3ade0a17ecc321fd13a19e81ce82' -const TOKEN_BABY = '0x53e562b9b7e5e94b81f10e96ee70ad06df3d2657' -const TOKEN_LEOS = '0x2c8368f8f474ed9af49b87eac77061beb986c2f1' +const TOKEN_APX = "0x78f5d389f5cdccfc41594abab4b0ed02f31398b3"; +const TOKEN_BSC_USD = ADDRESSES.bsc.USDT; +const TOKEN_BUSD = ADDRESSES.bsc.BUSD; +const TOKEN_CAKE = "0x0e09fabb73bd3ade0a17ecc321fd13a19e81ce82"; +const TOKEN_BABY = "0x53e562b9b7e5e94b81f10e96ee70ad06df3d2657"; +const TOKEN_LEOS = "0x2c8368f8f474ed9af49b87eac77061beb986c2f1"; +const TOKEN_USDC = ADDRESSES.bsc.USDC; +const TOKEN_VUSDT = "0xfD5840Cd36d94D7229439859C0112a4185BC0255"; +const TOKEN_BANANA = "0x603c7f932ED1fc6575303D8Fb018fDCBb0f39a95"; +const TOKEN_MDX = "0x9c65ab58d8d978db963e63f2bfb7121627e3a739"; +const TOKEN_HAY = "0x0782b6d8c4551B9760e74c0545a9bCD90bdc41E5"; + +const TOKEN_BTC = ADDRESSES.bsc.BTCB; +const TOKEN_BNB = ADDRESSES.bsc.WBNB; const TreasureTokens = [ + // TOKEN_APX, + nullAddress, TOKEN_BSC_USD, TOKEN_BUSD, TOKEN_CAKE, TOKEN_BABY, TOKEN_LEOS, + TOKEN_USDC, + TOKEN_VUSDT, + TOKEN_BANANA, + TOKEN_MDX, + TOKEN_HAY, +]; + +const ALPTokens = [ + nullAddress, + TOKEN_BSC_USD, + TOKEN_BUSD, + TOKEN_USDC, + TOKEN_BTC, + TOKEN_BNB, + TOKEN_HAY, ] async function tvl(timestamp, _block, { bsc: block }) { - const toa = TreasureTokens.map(t => [t, treasureContract]) - return sumTokens({}, toa, block, 'bsc') + const toa = [ + ...TreasureTokens.map((t) => [t, treasureContract]), + ...ALPTokens.map((t) => [t, ALPContract]), + ] + return sumTokens({}, toa, block, "bsc"); } module.exports = { - start: 1640100600, // 12/21/2021 @ 15:30pm (UTC) + start: 1640100600, // 12/21/2021 @ 15:30pm (UTC) bsc: { tvl, - staking: stakings([stakingContract_APX, daoContract], TOKEN_APX, 'bsc'), - pool2: pool2(stakingContract, poolContract, 'bsc'), + staking: stakings([stakingContract_APX, daoContract], TOKEN_APX, "bsc"), + pool2: pool2s([stakingContract, stakingContractV2], [poolContract, poolContractV2], "bsc"), + }, + ethereum: { + tvl: sumTokensExport({ owner: '0xb40EEd68d7d6B3b6d6f4E93DE6239B7C53EFc786', tokens: [ + nullAddress, + ADDRESSES.ethereum.USDT, + ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.BUSD, + '0xf650c3d88d12db855b8bf7d11be6c55a4e07dcc9', + ]}) + }, + arbitrum: { + tvl: sumTokensExport({ owner: '0xbad4ccc91ef0dfffbcab1402c519601fbaf244ef', tokens: [ + nullAddress, + ADDRESSES.arbitrum.USDC, + ADDRESSES.arbitrum.USDT, + ]}) + }, + era: { + tvl: sumTokensExport({ owner: '0xD6f4e33063C881cE9a98e07E13673B92a637D908', tokens: [ + nullAddress, + ADDRESSES.era.USDC, + ]}) }, }; diff --git a/projects/aptin-finance/index.js b/projects/aptin-finance/index.js new file mode 100644 index 00000000000..750e2ae57cc --- /dev/null +++ b/projects/aptin-finance/index.js @@ -0,0 +1,49 @@ +const sdk = require("@defillama/sdk"); +const { getResource, getTableData, } = require("../helper/chain/aptos"); +const { transformBalances } = require("../helper/portedTokens"); + +let data + +async function getData() { + if (!data) data = _getData() + return data + + async function _getData() { + const lendPool = await getResource('0xabaf41ed192141b481434b99227f2b28c313681bc76714dc88e5b2e26b24b84c', '0xb7d960e5f0a58cc0817774e611d7e3ae54c6843816521f02d7ced583d6434896::pool::LendProtocol') + const coins = lendPool.coins + const table = lendPool.pools.handle + + const params = { + key_type: '0x1::string::String', + value_type: '0xb7d960e5f0a58cc0817774e611d7e3ae54c6843816521f02d7ced583d6434896::pool::Pool', + } + const coinInfos = await Promise.all(coins.map(i => getTableData({ table, data: { ...params, key: i } }))) + const balances = { + tvl: {}, + borrowed: {}, + } + coinInfos.forEach((data, i) => { + sdk.util.sumSingleBalance(balances.tvl, coins[i], data.supply_pool.total_value - data.borrow_pool.total_value) + sdk.util.sumSingleBalance(balances.borrowed, coins[i], data.borrow_pool.total_value) + }) + + return balances + } +} + + +module.exports = { + timetravel: false, + methodology: + "TVL contains the sum of the supply of all markets in the Aptin protocol contract, borrowed tokens are not counted.", + aptos: { + tvl: async () => { + const data = await getData() + return transformBalances('aptos', data.tvl) + }, + borrowed: async () => { + const data = await getData() + return transformBalances('aptos', data.borrowed) + }, + }, +}; diff --git a/projects/apwine/abi.json b/projects/apwine/abi.json index c3873defd90..c41df6b992b 100644 --- a/projects/apwine/abi.json +++ b/projects/apwine/abi.json @@ -1,21 +1,15 @@ { - "registry_futureVaultCount": {"inputs":[],"name":"futureVaultCount","outputs":[{"internalType":"uint256","name":"futureVaultCount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"}, - "registry_getFutureVaultAt": {"inputs":[{"internalType":"uint256","name":"_index","type":"uint256"}],"name":"getFutureVaultAt","outputs":[{"internalType":"address","name":"futureVault","type":"address"}],"stateMutability":"nonpayable","type":"function"}, - "registry_getIBTAddress": {"inputs":[],"name":"getIBTAddress","outputs":[{"internalType":"address","name":"IBTAddress","type":"address"}],"stateMutability":"nonpayable","type":"function"}, - "ammregistry_getFutureAMMPool": {"inputs":[{"internalType":"address","name":"_futureVaultAddress ","type":"address"}],"name":"getFutureAMMPool","outputs":[{"internalType":"address","name":"_futureAMMPoolAddress ","type":"address"}],"stateMutability":"nonpayable","type":"function"}, - "futurevault_STAKED_TOKEN": {"inputs":[],"name":"STAKED_TOKEN","outputs":[{"internalType":"address","name":"_STAKED_TOKEN_Address ","type":"address"}],"stateMutability":"nonpayable","type":"function"}, - "futurevault_getPTAddress": {"inputs":[],"name":"getPTAddress","outputs":[{"internalType":"address","name":"_PTAddress ","type":"address"}],"stateMutability":"nonpayable","type":"function"}, - - "ammPool_getFYTAddress": {"inputs":[],"name":"getFYTAddress","outputs":[{"internalType":"address","name":"_address ","type":"address"}],"stateMutability":"nonpayable","type":"function"}, - "ammPool_getFutureAddress": {"inputs":[],"name":"getFutureAddress","outputs":[{"internalType":"address","name":"_address ","type":"address"}],"stateMutability":"nonpayable","type":"function"}, - "ammPool_getIBTAddress": {"inputs":[],"name":"getIBTAddress","outputs":[{"internalType":"address","name":"IBTAddress","type":"address"}],"stateMutability":"nonpayable","type":"function"}, - "ammPool_getPTAddress": {"inputs":[],"name":"getPTAddress","outputs":[{"internalType":"address","name":"_address ","type":"address"}],"stateMutability":"nonpayable","type":"function"}, - "ammPool_getPoolTokenAddress": {"inputs":[],"name":"getPoolTokenAddress","outputs":[{"internalType":"address","name":"_address ","type":"address"}],"stateMutability":"nonpayable","type":"function"}, - "ammPool_getUnderlyingOfIBTAddress": {"inputs":[],"name":"getUnderlyingOfIBTAddress","outputs":[{"internalType":"address","name":"_address ","type":"address"}],"stateMutability":"nonpayable","type":"function"}, - "ammPool_getPairWithID_BAD_OUTPUT_ABI": {"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"getPairWithID","outputs":[ - {"internalType":"address","name":"tokenAddress ","type":"address"}, - {"internalType":"uint256[2]","name":"weights ","type":"uint256[2]"}, - {"internalType":"uint256[2]","name":"balances ","type":"uint256[2]"}, - {"internalType":"bool","name":"liquidityIsInitialized ","type":"bool"} - ],"stateMutability":"nonpayable","type":"function"} -} + "registry_futureVaultCount": "uint256:futureVaultCount", + "registry_getFutureVaultAt": "function getFutureVaultAt(uint256 _index) returns (address futureVault)", + "registry_getIBTAddress": "address:getIBTAddress", + "ammregistry_getFutureAMMPool": "function getFutureAMMPool(address _futureVaultAddress ) returns (address _futureAMMPoolAddress )", + "futurevault_STAKED_TOKEN": "address:STAKED_TOKEN", + "futurevault_getPTAddress": "address:getPTAddress", + "ammPool_getFYTAddress": "address:getFYTAddress", + "ammPool_getFutureAddress": "address:getFutureAddress", + "ammPool_getIBTAddress": "address:getIBTAddress", + "ammPool_getPTAddress": "address:getPTAddress", + "ammPool_getPoolTokenAddress": "address:getPoolTokenAddress", + "ammPool_getUnderlyingOfIBTAddress": "address:getUnderlyingOfIBTAddress", + "ammPool_getPairWithID_BAD_OUTPUT_ABI": "function getPairWithID(uint256 id) returns (address tokenAddress , uint256[2] weights , uint256[2] balances , bool liquidityIsInitialized )" +} \ No newline at end of file diff --git a/projects/apwine/index.js b/projects/apwine/index.js index b540b8cf616..5b46bc7518e 100644 --- a/projects/apwine/index.js +++ b/projects/apwine/index.js @@ -1,6 +1,7 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk") const abi = require("./abi.json") -const {sumTokens, unwrapCrv} = require("../helper/unwrapLPs.js") +const {sumTokens} = require("../helper/unwrapLPs.js") const {staking} = require("../helper/staking.js") const {pool2s} = require("../helper/pool2.js") @@ -12,8 +13,8 @@ const AMMregistry = '0x6646A35e74e35585B0B02e5190445A324E5D4D01' const transformMapping_ethereum = { '0xaC14864ce5A98aF3248Ffbf549441b04421247D3': '0x73968b9a57c6e53d41345fd57a6e6ae27d6cdb2f', // xSDT -> SDT '0x6b1D394Ca67fDB9C90BBd26FE692DdA4F4f53ECD': '0xcafe001067cdef266afb7eb5a286dcfd277f3de5', // sPSP_PP4 -> PSP - '0xA991356d261fbaF194463aF6DF8f0464F8f1c742': '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', // tfUSDC -> USDC - '0x24E79e946dEa5482212c38aaB2D0782F04cdB0E0': '0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9', // palStkAave -> AAVE + '0xA991356d261fbaF194463aF6DF8f0464F8f1c742': ADDRESSES.ethereum.USDC, // tfUSDC -> USDC + '0x24E79e946dEa5482212c38aaB2D0782F04cdB0E0': ADDRESSES.ethereum.AAVE, // palStkAave -> AAVE } const transformMapping_polygon = { } @@ -85,7 +86,7 @@ const tvl_from_registry = (chain) => { })), block, chain, - })).output.filter(v=>v.output !== "0x0000000000000000000000000000000000000000") + })).output.filter(v=>v.output !== ADDRESSES.null) const {output: underlyingOfIBTAddresses} = await sdk.api.abi.multiCall({ abi: abi['ammPool_getUnderlyingOfIBTAddress'], calls: ammPools.map((vault) => ({ @@ -99,41 +100,7 @@ const tvl_from_registry = (chain) => { .concat(underlyingOfIBTAddresses.map((t, i) => [t.output, ammPools[i].output])) // Use FYTAddresses in the concat to get balances of FYT // Use underlyingOfIBTAddresses in concat to mimic a twice - await sumTokens(balances, tokensAndOwnersAMM, block, chain, transform[chain]) - - // const {output: FYTAddresses} = await sdk.api.abi.multiCall({ - // abi: abi['ammPool_getFYTAddress'], - // calls: ammPools.map((vault) => ({ - // target: vault.output, - // })), - // block, - // chain, - // }) - // let transform_to_underlying = (addr) => { - // const idx = FYTAddresses.map(c => c.output).indexOf(addr) - // if (idx >= 0) { - // return transform[chain](underlyingOfIBTAddresses[idx].output) - // } - // return transform[chain](addr) - // } - // transform_to_underlying = transform[chain] - - // ------------------------ - // Handle wrapped pools in balances - like curvePools, etc - for (let i = 0; i < 2; i++) { // since crvTriCrypto contains am3crv, unwrap twice - for (const token of Object.keys(balances)) { - if (Object.keys(tokensToUnwrap).includes(token) && balances[token] > 0) { - if (tokensToUnwrap[token].type === 'crv') { - await unwrapCrv(balances, tokensToUnwrap[token].unwrapTo, balances[token], block, chain, transform[chain]) - } - balances[token] = 0 // Once unwrapped, set balance of wrapped curve token to zero - // console.log('unwrapping', token, balances) - } - } - } - - console.log(`balances for chain ${chain}`, balances) - return balances + return sumTokens(balances, tokensAndOwnersAMM, block, chain, transform[chain]) } } diff --git a/projects/apyfinance/abi.json b/projects/apyfinance/abi.json index 36b1c000c31..908f90f741c 100644 --- a/projects/apyfinance/abi.json +++ b/projects/apyfinance/abi.json @@ -1,16 +1,4 @@ { - "underlyer": { - "inputs": [], - "name": "underlyer", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getPoolTotalValue":{"inputs":[],"name":"getPoolTotalValue","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"} + "underlyer": "address:underlyer", + "getPoolTotalValue": "uint256:getPoolTotalValue" } \ No newline at end of file diff --git a/projects/aquarius/getEntireSystemColl.abi.json b/projects/aquarius/getEntireSystemColl.abi.json deleted file mode 100644 index 15a2c6c04b3..00000000000 --- a/projects/aquarius/getEntireSystemColl.abi.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "inputs": [], - "name": "getEntireSystemColl", - "outputs": [ - { - "internalType": "uint256", - "name": "entireSystemColl", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" -} \ No newline at end of file diff --git a/projects/aquarius/index.js b/projects/aquarius/index.js index de5c036bfa9..9b6d3c19353 100644 --- a/projects/aquarius/index.js +++ b/projects/aquarius/index.js @@ -1,23 +1,9 @@ -const sdk = require("@defillama/sdk"); -const getEntireSystemCollAbi = require("./getEntireSystemColl.abi.json") +const ADDRESSES = require('../helper/coreAssets.json') const {getLiquityTvl} = require('../helper/liquity') -const FTM_ADDRESS = '0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83'; +const FTM_ADDRESS = ADDRESSES.fantom.WFTM; const TROVE_MANAGER_ADDRESS = "0xC87D230B3239d1A90463463d8adDFD70709D391b"; -/* -async function tvl(_, _ethBlock, chainBlocks) { - const balance = ( - await sdk.api.abi.call({ - target: TROVE_MANAGER_ADDRESS, - abi: getEntireSystemCollAbi, - block: chainBlocks['fantom'], - chain: 'fantom' - }) - ).output; - return { [FTM_ADDRESS]: balance }; -} -*/ module.exports = { fantom: { tvl: getLiquityTvl(FTM_ADDRESS,TROVE_MANAGER_ADDRESS,"fantom"), diff --git a/projects/arbicheems/index.js b/projects/arbicheems/index.js index bded1bd93a4..b1e6962476d 100644 --- a/projects/arbicheems/index.js +++ b/projects/arbicheems/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const { stakingUnknownPricedLP } = require("../helper/staking"); const { pool2Exports } = require("../helper/pool2"); @@ -5,7 +6,7 @@ const { pool2Exports } = require("../helper/pool2"); const cheems = "0x75a2f30929C539E7d4eE033c9331b89F879c0cf7"; const stakingContract = "0xaaCcB989FE1084c6935f09aE4BBD49AfF58Bdb94"; -const mim = "0xfea7a6a0b346362bf88a9e4a88416b77a57d6c2a"; +const mim = ADDRESSES.arbitrum.MIM; const mimPool = "0x79F12596B78F9E982bDaB6e2d83D4bc155672372"; const ethPool = "0xd495Beb0011e3DFEC0C93376f5216C1C3dD01C23"; @@ -24,7 +25,7 @@ async function tvl(timestamp, block, chainBlocks) { ).output; sdk.util.sumSingleBalance( balances, - "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", + ADDRESSES.ethereum.WETH, ethBal ); diff --git a/projects/arbinyan/index.js b/projects/arbinyan/index.js index 3ae47dfde2d..f977cef4037 100644 --- a/projects/arbinyan/index.js +++ b/projects/arbinyan/index.js @@ -1,16 +1,17 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const { staking } = require("../helper/staking"); const BigNumber = require("bignumber.js"); const stakingETHContract = "0x9F7968de728aC7A6769141F63dCA03FD8b03A76F"; -const WETH = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"; +const WETH = ADDRESSES.ethereum.WETH; const stakingNYANContract = "0x32e5594F14de658b0d577D6560fA0d9C6F1aa724"; const NYAN = "0xed3fb761414da74b74f33e5c5a1f78104b188dfc"; const stakingPool2Contract = "0x62FF5Be795262999fc1EbaC29277575031d2dA2C"; const NYAN_WETH_SLP = "0x70Df9Dd83be2a9F9Fcc58Dd7C00d032d007b7859"; -const WETH_arb = "0x82af49447d8a07e3bd95bd0d56f35241523fbab1"; +const WETH_arb = ADDRESSES.arbitrum.WETH; async function pool2(time, ethBlock, chainBlocks) { const balances = {}; diff --git a/projects/arbirise-finance/abis/arbiStakerERC20.json b/projects/arbirise-finance/abis/arbiStakerERC20.json index ff40a1c902a..c9224c60fa2 100644 --- a/projects/arbirise-finance/abis/arbiStakerERC20.json +++ b/projects/arbirise-finance/abis/arbiStakerERC20.json @@ -1,53 +1,5 @@ { - "stakedTokenTotal": { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "stakedTokenTotal", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getNumTokensStaked": { - "inputs": [], - "name": "getNumTokensStaked", - "outputs": [ - { - "internalType": "uint256", - "name": "num", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getTokenStakedAt": { - "inputs": [ - { - "internalType": "uint256", - "name": "index", - "type": "uint256" - } - ], - "name": "getTokenStakedAt", - "outputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } -} + "stakedTokenTotal": "function stakedTokenTotal(address) view returns (uint256)", + "getNumTokensStaked": "uint256:getNumTokensStaked", + "getTokenStakedAt": "function getTokenStakedAt(uint256 index) view returns (address token)" +} \ No newline at end of file diff --git a/projects/arbirise-finance/abis/getPair.json b/projects/arbirise-finance/abis/getPair.json deleted file mode 100644 index f7f469683a7..00000000000 --- a/projects/arbirise-finance/abis/getPair.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "constant": true, - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "getPair", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" -} diff --git a/projects/arbirise-finance/abis/getReserves.json b/projects/arbirise-finance/abis/getReserves.json deleted file mode 100644 index e3f6fcc11d8..00000000000 --- a/projects/arbirise-finance/abis/getReserves.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "constant": true, - "inputs": [], - "name": "getReserves", - "outputs": [ - { - "internalType": "uint112", - "name": "_reserve0", - "type": "uint112" - }, - { - "internalType": "uint112", - "name": "_reserve1", - "type": "uint112" - }, - { - "internalType": "uint32", - "name": "_blockTimestampLast", - "type": "uint32" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" -} diff --git a/projects/arbirise-finance/abis/token0.json b/projects/arbirise-finance/abis/token0.json deleted file mode 100644 index eefbeb998a3..00000000000 --- a/projects/arbirise-finance/abis/token0.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "constant": true, - "inputs": [], - "name": "token0", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" -} diff --git a/projects/arbirise-finance/getPrice.js b/projects/arbirise-finance/getPrice.js index 410e8cc5c33..b3cd1bfeda6 100644 --- a/projects/arbirise-finance/getPrice.js +++ b/projects/arbirise-finance/getPrice.js @@ -1,10 +1,8 @@ const sdk = require("@defillama/sdk"); -const getPair = require("./abis/getPair.json"); -const getReserves = require("./abis/getReserves.json"); -const token0 = require("./abis/token0.json"); +const getReserves = 'function getReserves() view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast)'; +const token0 = "address:token0"; const contracts = require("./contracts.json"); const { default: BigNumber } = require("bignumber.js"); -const { getBlock } = require("../helper/getBlock"); const getETHPrice = async (block) => { const reserves = ( @@ -63,7 +61,7 @@ const getPrice = async (tokenAddress, block) => { : ( await sdk.api.abi.call({ target: contracts["sushiFactoryAddress"], - abi: getPair, + abi: 'function getPair(address, address) view returns (address)', params: [tokenAddress, contracts["weth"]], block: block, chain: "arbitrum", diff --git a/projects/arbiswap/index.js b/projects/arbiswap/index.js new file mode 100644 index 00000000000..b618ae314bb --- /dev/null +++ b/projects/arbiswap/index.js @@ -0,0 +1,14 @@ +const { getUniTVL, } = require('../helper/unknownTokens') + +const dexTVL = getUniTVL({ factory: '0x88F1E030eb4C6C4320Da3992070bAF6c648ce37f', useDefaultCoreAssets: true }) + +module.exports = { + hallmarks: [ + [1677744000,"Rug Pull"] + ], + misrepresentedTokens: true, + methodology: `Uses factory(0x88F1E030eb4C6C4320Da3992070bAF6c648ce37f) address and whitelisted tokens address to find and price Liquidity Pool pairs. We also have our native token $ARBI staking.`, + arbitrum: { + tvl: dexTVL, + } +}; diff --git a/projects/arbitrove/index.js b/projects/arbitrove/index.js new file mode 100644 index 00000000000..08ae691e021 --- /dev/null +++ b/projects/arbitrove/index.js @@ -0,0 +1,21 @@ +const { getLogs } = require('../helper/cache/getLogs'); +const { nullAddress, } = require('../helper/unwrapLPs'); +const ALP_TOKEN = '0xb49B6A3Fd1F4bB510Ef776de7A88A9e65904478A'; + +async function tvl(_, _b, _cb, { api }) { + const logs = await getLogs({ + api, + target: ALP_TOKEN, + topic: 'SetCoinCap(address,uint256)', + eventAbi: 'event SetCoinCap(address indexed coin, uint256 indexed cap)', + onlyArgs: true, + fromBlock: 67635825, + }) + return api.sumTokens({ owners: [ALP_TOKEN], tokens: [nullAddress, ...logs.map(l => l.coin)]}) +} + +module.exports = { + arbitrum: { + tvl, + } +} \ No newline at end of file diff --git a/projects/arbitrumexchange-v3/index.js b/projects/arbitrumexchange-v3/index.js new file mode 100644 index 00000000000..e3577288206 --- /dev/null +++ b/projects/arbitrumexchange-v3/index.js @@ -0,0 +1,8 @@ +const { uniV3Export } = require("../helper/uniswapV3"); + +module.exports = uniV3Export({ + arbitrum: { + factory: "0x855f2c70cf5cb1d56c15ed309a4dfefb88ed909e", + fromBlock: 86863305, + }, +}); \ No newline at end of file diff --git a/projects/arbor-finance/index.js b/projects/arbor-finance/index.js index 86b16dca9d7..9cddd90bf19 100644 --- a/projects/arbor-finance/index.js +++ b/projects/arbor-finance/index.js @@ -1,27 +1,19 @@ -const { request, gql } = require("graphql-request"); const { sumTokens2 } = require('../helper/unwrapLPs') -const { getBlock } = require('../helper/getBlock') +const { getLogs } = require('../helper/cache/getLogs') -const graphUrl = - "https://api.thegraph.com/subgraphs/name/alwaysbegrowing/arbor-v1"; +const bondFactory = '0x1533eb8c6cc510863b496d182596ab0e9e77a00c' -// Get a list of collateral from active bonds at the given block number. -const graphQuery = (block) => gql` - { - bonds(where: { state: active }, block: { number: ${block} }) { - id - collateralToken { - id - } - } - } -` - -async function tvl(timestamp, block, cb) { - block = await getBlock(timestamp, 'ethereum', cb) - const { bonds } = await request(graphUrl, graphQuery(block - 500), {}); - const toa = bonds.map(i => ([i.collateralToken.id, i.id])).filter(i => i[0] && i[1]) - return sumTokens2({ block, tokensAndOwners: toa}) +async function tvl(timestamp, block, chainBlocks, { api }) { + + const logs = await getLogs({ + api, + fromBlock: 15785514, + topic: 'BondCreated(address,string,string,address,uint256,address,address,uint256,uint256,uint256)', + eventAbi: 'event BondCreated (address newBond, string name, string symbol, address owner, uint256 maturity, address paymentToken, address collateralToken, uint256 collateralTokenAmount, uint256 convertibleTokenAmount, uint256 bonds)', + target: bondFactory, + }) + const toa = logs.map(i => ([i.topics[3], i.args.newBond])) + return sumTokens2({ block, tokensAndOwners: toa, }) } module.exports = { diff --git a/projects/arbswap-stableswap/index.js b/projects/arbswap-stableswap/index.js new file mode 100644 index 00000000000..bd2f0fe3274 --- /dev/null +++ b/projects/arbswap-stableswap/index.js @@ -0,0 +1,24 @@ +const { getLogs } = require('../helper/cache/getLogs') +const { sumTokens2 } = require('../helper/unwrapLPs') + +async function tvl(_, _b, _cb, { api, }) { + const { factory, fromBlock, } = config[api.chain] + const logs = await getLogs({ + api, + target: factory, + topics: ['0x48dc7a1b156fe3e70ed5ed0afcb307661905edf536f15bb5786e327ea1933532'], + fromBlock, + eventAbi: 'event NewStableSwapPair (address indexed swapContract, address tokenA, address tokenB, address tokenC, address LP)', + onlyArgs: true, + }) + return sumTokens2({ api, ownerTokens: logs.map(({ tokenA, tokenB, tokenC, swapContract }) => ([[tokenA, tokenB, tokenC], swapContract])) }) +} + +const config = { + arbitrum: { factory: '0x3a52e9200Ed7403D9d21664fDee540C2d02c099d', fromBlock: 78843656 }, + arbitrum_nova: { factory: '0x11f6206AEF570aE946C0117C8f4B298B0A706f18', fromBlock: 3732144 }, +} + +Object.keys(config).forEach(chain => { + module.exports[chain] = { tvl } +}) \ No newline at end of file diff --git a/projects/arbswap/index.js b/projects/arbswap/index.js index cb68b9d8724..173cf14f32f 100644 --- a/projects/arbswap/index.js +++ b/projects/arbswap/index.js @@ -4,9 +4,14 @@ module.exports = { misrepresentedTokens: true, arbitrum_nova: { tvl: getUniTVL({ - chain: 'arbitrum_nova', useDefaultCoreAssets: true, factory: '0xf6239423FcF1c19ED2791D9648A90836074242Fd', }) + }, + arbitrum: { + tvl: getUniTVL({ + useDefaultCoreAssets: true, + factory: '0xd394e9cc20f43d2651293756f8d320668e850f1b', + }) } -}; \ No newline at end of file +}; diff --git a/projects/arc-swap/index.js b/projects/arc-swap/index.js new file mode 100644 index 00000000000..a84d7bd89df --- /dev/null +++ b/projects/arc-swap/index.js @@ -0,0 +1,8 @@ +const { masterChefExports } = require('../helper/masterchef') + +const token = "0xC82E3dB60A52CF7529253b4eC688f631aad9e7c2"; +const masterchef = "0x1575F4b5364dDBd6c9C77D1fE603E2d76432aA6a"; + +module.exports = { + ...masterChefExports(masterchef, "ethereum", token) +} \ No newline at end of file diff --git a/projects/arcade-xyz/abi.js b/projects/arcade-xyz/abi.js new file mode 100644 index 00000000000..fd9ab69d42f --- /dev/null +++ b/projects/arcade-xyz/abi.js @@ -0,0 +1,5 @@ +const VAULT_FACTORY_ABI = 'event VaultCreated(address vault,address to)' + +module.exports = { + VAULT_FACTORY_ABI, +}; diff --git a/projects/arcade-xyz/constants.js b/projects/arcade-xyz/constants.js new file mode 100644 index 00000000000..4d76e73a0e1 --- /dev/null +++ b/projects/arcade-xyz/constants.js @@ -0,0 +1,24 @@ +const SUBGRAPH_URL = 'https://protocol-sg.arcade.xyz/subgraphs/name/arcade/protocol-v2'; +const CHAIN = 'ethereum'; +const LOAN_CORE = '0x81b2f8fc75bab64a6b144aa6d2faa127b4fa7fd9'; +const VAULT_FACTORY_A = '0x6e9b4c2f6bd57b7b924d29b5dcfca1273ecc94a2'; +const VAULT_FACTORY_APE_STAKING_A = '0x666faa632e5f7ba20a7fce36596a6736f87133be'; + +const VAULT_FACTORIES = new Set(); +VAULT_FACTORIES.add(VAULT_FACTORY_A); +VAULT_FACTORIES.add(VAULT_FACTORY_APE_STAKING_A); + +const START_BLOCKS = new Map(); +START_BLOCKS.set(VAULT_FACTORY_A, 15045028); +START_BLOCKS.set(VAULT_FACTORY_APE_STAKING_A, 16128500); + +module.exports = { + CHAIN, + LOAN_CORE, + START_BLOCKS, + SUBGRAPH_URL, + VAULT_FACTORY_A, + VAULT_FACTORY_APE_STAKING_A, + VAULT_FACTORIES, +} + diff --git a/projects/arcade-xyz/index.js b/projects/arcade-xyz/index.js new file mode 100644 index 00000000000..24e10661ecd --- /dev/null +++ b/projects/arcade-xyz/index.js @@ -0,0 +1,64 @@ +const sdk = require("@defillama/sdk"); + +const { fetchVaults, fetchLoans } = require('./queries'); +const { sumTokens2 } = require('../helper/unwrapLPs'); +const { sumArtBlocks, isArtBlocks, } = require('../helper/nft'); + +const { + LOAN_CORE, + START_BLOCKS, + VAULT_FACTORY_A, +} = require('./constants'); + +// Uses chainlink oracle floor price for all whitelisted NFTS owned by every vault and the Loan Core contract. +// Tokens owned by vaults have been wrapped into an Arcade.xyz vault. Tokens owned by the Loan Core contract +// are currently in escrow. +async function tvl(_, block, _cb, { api }) { + // Get list of all vaults + const vaults = await fetchVaults(block+'') + const balances = {} + const artBlockOwners = [] + + // Sum up total count of each token + for (const vault of vaults) { + const collateral = vault.collateral ?? []; + + for (const token of collateral) { + const { collectionAddress, amount } = token; + if (isArtBlocks(collectionAddress)) { + artBlockOwners.push(vault.address) + continue; + } + sdk.util.sumSingleBalance(balances,collectionAddress,amount, api.chain) + } + } + + await sumArtBlocks({ balances, api, owners: artBlockOwners, }) + // Initialize balances with tokens held by the escrow contract, Loan Core + return sumTokens2({ + balances, + owners: [LOAN_CORE], + resolveNFTs: true, + api, + }); +} + +// Fetches all active loans, their payable curency and amount borrowed then sums it up. +async function borrowed(_, block, _cb, { api }) { + const loans = await fetchLoans(block); + const balances = {} + + // Iterate over each loan to sum up principal by currency + for (const loan of loans) { + const { payableCurrency, principal } = loan; + sdk.util.sumSingleBalance(balances,payableCurrency,principal, api.chain) + } + + return balances; +} + +module.exports = { + methodology: `Sums up the floor value of all vaulted and escrowed NFTs with Chainlink price feeds. Borrowed coins are not counted towards the TVL`, + start: START_BLOCKS[VAULT_FACTORY_A], + ethereum: { tvl, borrowed }, +} diff --git a/projects/arcade-xyz/queries.js b/projects/arcade-xyz/queries.js new file mode 100644 index 00000000000..c4744d8b862 --- /dev/null +++ b/projects/arcade-xyz/queries.js @@ -0,0 +1,91 @@ +const { gql, request } = require('graphql-request'); +const { SUBGRAPH_URL } = require('./constants'); + +// Max recursion depth +const MAX_DEPTH = 100; + +// Fetch from the SG until there are no results +async function fetchPaginated(query, key = '', first = 100, block, cursor = 0, depth = 0) { + // Defensive so we don't give DeFiLlama engineers a headache + if (cursor < 0 || depth >= MAX_DEPTH) { + return []; + } + + let q = query.replace('', first); + q = q.replace('', cursor); + q = q.replace('', ''+block); + + const res = await request(SUBGRAPH_URL, q); + + // Check if the HTTP request was successful but the Subgraph returned an error + if (res.errors && res.errors.length > 0) { + const { errors } = res; + + let message; + + // It should always be an array, but lets be safe + if (Array.isArray(errors)) { + message = errors.join('\n'); + } else if (typeof errors === 'string') { + message = errors; + } else { + message = 'Unknown error fetching Subgraph data for arcade-xyz project'; + } + + throw new Error(message); + } + + const results = res[key]; + + // There could be more results if the length matches the query limit + if (Array.isArray(results) && results.length >= first) { + // Get the cursor for the last item + const lastCursor = results[first - 1].cursor ?? -1; + + // Fetch more results starting from the last cursor + 1, inclusive + const moreResults = await fetchPaginated(query, key, first, block, lastCursor + 1, depth + 1); + return results.concat(moreResults); + } + + return results; +} + +// Fetches vaults that have tokens deposited and are available to be used on the platform. +// Broken vaults (withdrawEnabled) cannot be used in a loan. +const fetchVaultQuery = gql` + query { + arcadeVaults(first: , block: { number: }, where:{hasCollateral:true, withdrawEnabled:false, cursor_gte: }) { + address + collateral { + collectionAddress + amount + } + } + } +`; + +// Helper function to fetch the first 1000 active +async function fetchVaults(block) { + return fetchPaginated(fetchVaultQuery, 'arcadeVaults', 1000, block); +} + +// Fetches active loans +const fetchLoansQuery = gql` + query { + arcadeLoans(first: , block: { number: }, where :{ state: "Active", cursor_gte: }) { + payableCurrency + principal + } + } +` + +// Helper function to fetch the first 1000 active loans +async function fetchLoans(block) { + return fetchPaginated(fetchLoansQuery, 'arcadeLoans', 1000, block); +} + +module.exports = { + fetchLoans, + fetchPaginated, + fetchVaults, +} diff --git a/projects/arcadia-finance/helper/abi.json b/projects/arcadia-finance/helper/abi.json new file mode 100644 index 00000000000..f12130f7db1 --- /dev/null +++ b/projects/arcadia-finance/helper/abi.json @@ -0,0 +1,8 @@ +{ + "totalRealisedLiquidity": "uint128:totalRealisedLiquidity", + "totalUnrealisedLiquidity": "uint256:calcUnrealisedDebt", + "vaultLength": "uint256:allVaultsLength", + "vaultAddress": "function allVaults(uint256) view returns (address)", + "assetData": "function generateAssetData() view returns (address[], uint256[], uint256[])", + "assetsInPricingModule": "function assetsInPricingModule(uint256) view returns (address)" +} \ No newline at end of file diff --git a/projects/arcadia-finance/helper/index.js b/projects/arcadia-finance/helper/index.js new file mode 100644 index 00000000000..cc4aaaf409a --- /dev/null +++ b/projects/arcadia-finance/helper/index.js @@ -0,0 +1,38 @@ +const { sumTokens2 } = require('../../helper/unwrapLPs') +const abi = require("./abi.json") + +const config = { + optimism: { + factory: "0x00CB53780Ea58503D3059FC02dDd596D0Be926cB", + pools: { + wethPool: "0xD417c28aF20884088F600e724441a3baB38b22cc", + usdcPool: "0x9aa024D3fd962701ED17F76c17CaB22d3dc9D92d" + } + }, + ethereum: { + factory: "0x00CB53780Ea58503D3059FC02dDd596D0Be926cB", + pools: { + wethPool: "0xD417c28aF20884088F600e724441a3baB38b22cc", + usdcPool: "0x9aa024D3fd962701ED17F76c17CaB22d3dc9D92d", + } + } +} + + +async function tvl(_, _b, _cb, { api, }) { + const { chain } = api + let { factory, pools } = config[chain] + pools = Object.values(pools) + const poolAssets = await api.multiCall({ abi: 'address:asset', calls: pools }) + + const vaults = await api.fetchList({ lengthAbi: abi.vaultLength, itemAbi: abi.vaultAddress, target: factory, }) + const assetData = await api.multiCall({ abi: abi.assetData, calls: vaults, }) + + assetData.forEach((assetsInVaults) => api.addTokens(assetsInVaults[0], assetsInVaults[2])) + + return sumTokens2({ api, tokensAndOwners2: [poolAssets, pools, ]}) +} + +module.exports = { + tvl, +}; \ No newline at end of file diff --git a/projects/arcadia-finance/index.js b/projects/arcadia-finance/index.js new file mode 100644 index 00000000000..a9d10c7b41f --- /dev/null +++ b/projects/arcadia-finance/index.js @@ -0,0 +1,12 @@ +const { tvl, } = require("./helper"); + +module.exports = { + methodology: + "TVL includes ERC-20 tokens that have been supplied as collateral as well as ERC-20 tokens that are supplied by liquidity providers.", + optimism: { tvl }, + ethereum: { tvl }, + start: 1686391200, // Jun 10 2023 10:00:00 GMT+0000 + hallmarks: [ + [Math.floor(new Date('2023-07-10')/1e3), 'Protocol was exploited.'], + ], +} \ No newline at end of file diff --git a/projects/arch-ethereum-web-3/index.js b/projects/arch-ethereum-web-3/index.js index 4838f196345..11e62c31a78 100644 --- a/projects/arch-ethereum-web-3/index.js +++ b/projects/arch-ethereum-web-3/index.js @@ -3,19 +3,7 @@ const { sumTokens } = require('../helper/unwrapLPs'); const archEthereumWeb3AddressETH = "0xe8e8486228753E01Dbc222dA262Aa706Bd67e601"; -const abi = { - "inputs": [], - "name": "getComponents", - "outputs": [ - { - "internalType": "address[]", - "name": "", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" -} +const abi = 'address[]:getComponents' async function tvl(ts, block) { const { output: tokens } = await sdk.api.abi.call({ target: archEthereumWeb3AddressETH, abi, block }) diff --git a/projects/archerswap/index.js b/projects/archerswap/index.js new file mode 100644 index 00000000000..263af3ff89b --- /dev/null +++ b/projects/archerswap/index.js @@ -0,0 +1,11 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports = { + misrepresentedTokens: true, + core: { + tvl: getUniTVL({ + useDefaultCoreAssets: true, + factory: '0xe0b8838e8d73ff1CA193E8cc2bC0Ebf7Cf86F620', + }) + } +} \ No newline at end of file diff --git a/projects/archi-finance/abi.json b/projects/archi-finance/abi.json new file mode 100644 index 00000000000..b2575606de3 --- /dev/null +++ b/projects/archi-finance/abi.json @@ -0,0 +1,10 @@ +{ + "getTokenPrice": "function getTokenPrice(address _token) view returns (uint256)", + "getGlpPrice": "function getGlpPrice(bool _isBuying) view returns (uint256 price)", + "borrowedRewardPool": "address:borrowedRewardPool", + "supplyRewardPool": "address:supplyRewardPool", + "workingBalance": "function workingBalance(address[] _vaults) view returns (address[], uint256[])", + "borrowedBalance": "function borrowedBalance(address[] _vaults) view returns (address[], uint256[])", + "lockedBalance": "function lockedBalance(address[] _vaults) view returns (address[], uint256[])", + "debtBalance": "function debtBalance(address[] _vaults) view returns (address[], uint256[])" + } \ No newline at end of file diff --git a/projects/archi-finance/index.js b/projects/archi-finance/index.js new file mode 100644 index 00000000000..d3fe4961367 --- /dev/null +++ b/projects/archi-finance/index.js @@ -0,0 +1,51 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokens2 } = require("../helper/unwrapLPs"); +const ABI = require("./abi.json"); + +const addresses = { + vaultInfo: "0x73956FF7375476EBFD5e82d80Ea9065a5bCc3d2b", + collateralPoolAddress: "0xbd198617aD1dc75B0f7A0A67BbE31993919Cd716", + fsGlpAddress: ADDRESSES.arbitrum.fsGLP, + fsGlpHolders: ["0x65C59eE732BD249224718607Ee0EC0e293309923", "0x49EE14e37Cb47bff8c512B3A0d672302A3446eb1"], + vaults: [ + // weth pool + "0x7674Ccf6cAE51F20d376644C42cd69EC7d4324f4", + // usdt pool + "0x179bD8d1d654DB8aa1603f232E284FF8d53a0688", + // usdc pool + "0xa7490e0828Ed39DF886b9032ebBF98851193D79c", + // wbtc pool + "0xee54A31e9759B0F7FDbF48221b72CD9F3aEA00AB", + // dai pool + "0x4262BA30d5c1bba98e9E9fc3c40602a7E09Ca49F", + // link pool + "0xB86a783C329d5D0CE84093757586F5Fd5364cd71", + // uni pool + "0xAf2a336AE86eF90a3958F4bFC6EFc23cD6190951", + // frax pool + "0x2032998a5312B88f6b4d2b86638Be31B20d1B573", + // mim pool + "0xbd70E8712264D6A62a7A6BD255A59992068adCAd" + ] +} + +async function tvl(timestamp, block, chainBlocks, { api }) { + const tokens = await api.multiCall({ abi: 'address:underlyingToken', calls: addresses.vaults }) + const tokensAndOwners = tokens.map((v, i) => [v, addresses.vaults[i]]) + addresses.fsGlpHolders.forEach(i => tokensAndOwners.push([addresses.fsGlpAddress, i])) + + return sumTokens2({ api, tokensAndOwners}) +} + +async function borrowed(timestamp, block, chainBlocks, { api }) { + const borrowedBalance = await api.call({ target: addresses.vaultInfo, abi: ABI.borrowedBalance, params: [addresses.vaults] }); + api.addTokens(borrowedBalance[0], borrowedBalance[1]); +} + +module.exports = { + methodology: "The TVL (Total Value Locked) of ArchiFinance is calculated by adding the total liquidity and borrowing amount.", + arbitrum: { + tvl, + borrowed, + }, +}; \ No newline at end of file diff --git a/projects/archly-finance/index.js b/projects/archly-finance/index.js index 970d5db4f74..42cfa21734e 100644 --- a/projects/archly-finance/index.js +++ b/projects/archly-finance/index.js @@ -1,7 +1,89 @@ -const { getUniTVL } = require('../helper/unknownTokens') +const ADDRESSES = require('../helper/coreAssets.json') +const { getUniTVL, sumTokensExport } = require('../helper/unknownTokens') -module.exports={ - telos:{ - tvl: getUniTVL({ factory: '0x39fdd4Fec9b41e9AcD339a7cf75250108D32906c', chain: 'telos', useDefaultCoreAssets: true }), +const ARCHLY_FACTORY_OTHER = "0xBa06043a777652BAF540CcC785EDaFd94eE05b37" +const ARCHLY_VE_TOKEN_OTHER = "0xf070654b08595f8F358Ff90170829892F3254C67" +const ARCHLY_ARC_TOKEN_OTHER = "0x684802262D614D0Cd0C9571672F03Dd9e85D7824" + +module.exports = { + telos: { + tvl: getUniTVL({ factory: '0x39fdd4Fec9b41e9AcD339a7cf75250108D32906c', useDefaultCoreAssets: true, hasStablePools: true, }), + staking: sumTokensExport({ + owner: '0x5680b3059b860d07A33B7A43d03D2E4dEdb226BB', + tokens: ['0xa84df7aFbcbCC1106834a5feD9453bd1219B1fb5'], + lps: ['0x34480A4C917caDbE41cb805f3e3baDb93bD9068C'], + coreAssets: [ADDRESSES.telos.WTLOS], + restrictTokenRatio: 100, + }) + }, + arbitrum: { + tvl: getUniTVL({ factory: '0xeafBFeb64F8e3793D7d1767774efd33b203200C9',useDefaultCoreAssets: true, hasStablePools: true, }), + staking: sumTokensExport({ + owner: '0x4c01dF6B9be381BA2a687D0ED5c40039dEEaf0a9', + tokens: ['0x9435Ffb33Ce0180F55E08490C606eC3BD07da929'], + lps: ['0x6083E6F4c0f9826e60D0180A00203F7A70C1aC25'], + coreAssets: [ADDRESSES.arbitrum.WETH], + restrictTokenRatio: 100, + }) + }, + arbitrum_nova: { + tvl: getUniTVL({ factory: ARCHLY_FACTORY_OTHER, useDefaultCoreAssets: true, hasStablePools: true, }), + staking: sumTokensExport({ + owner: ARCHLY_VE_TOKEN_OTHER, + tokens: [ARCHLY_ARC_TOKEN_OTHER], + lps: ['0xC8Cb0012BBBEFE6E04d9A58fFb5b9A623f4EC40c'], + coreAssets: [ADDRESSES.arbitrum_nova.WETH], + restrictTokenRatio: 100, + }) + }, + bsc: { + tvl: getUniTVL({ factory: ARCHLY_FACTORY_OTHER, seDefaultCoreAssets: true, hasStablePools: true, }), + staking: sumTokensExport({ + owner: ARCHLY_VE_TOKEN_OTHER, + tokens: [ARCHLY_ARC_TOKEN_OTHER], + lps: ['0x3a1c6C7Ced1c14e07385582c5bB82eFBA4df4f19'], + coreAssets: [ADDRESSES.bsc.WBNB], + restrictTokenRatio: 100, + }) + }, + fantom: { + tvl: getUniTVL({ factory: ARCHLY_FACTORY_OTHER, useDefaultCoreAssets: true, hasStablePools: true, }), + staking: sumTokensExport({ + owner: ARCHLY_VE_TOKEN_OTHER, + tokens: [ARCHLY_ARC_TOKEN_OTHER], + lps: ['0xe962fEF0e7cE6D666359Dab6127f6f8d814aC1a9'], + coreAssets: [ADDRESSES.fantom.WFTM], + restrictTokenRatio: 100, + }) + }, + kava: { + tvl: getUniTVL({ factory: ARCHLY_FACTORY_OTHER, useDefaultCoreAssets: true, hasStablePools: true, }), + staking: sumTokensExport({ + owner: ARCHLY_VE_TOKEN_OTHER, + tokens: [ARCHLY_ARC_TOKEN_OTHER], + lps: ['0x008C71505A2e110d1FFAA402B01aeb202fb107dB'], + coreAssets: [ADDRESSES.kava.WKAVA], + restrictTokenRatio: 100, + }) + }, + optimism: { + tvl: getUniTVL({ factory: ARCHLY_FACTORY_OTHER, useDefaultCoreAssets: true, hasStablePools: true, }), + staking: sumTokensExport({ + owner: ARCHLY_VE_TOKEN_OTHER, + tokens: [ARCHLY_ARC_TOKEN_OTHER], + lps: ['0xc492BCa6777818256C2e2e5FC8e180BC8697DfF5'], + coreAssets: [ADDRESSES.tombchain.FTM], + restrictTokenRatio: 100, + }) + }, + polygon: { + tvl: getUniTVL({ factory: ARCHLY_FACTORY_OTHER, useDefaultCoreAssets: true, hasStablePools: true, }), + staking: sumTokensExport({ + owner: ARCHLY_VE_TOKEN_OTHER, + tokens: [ARCHLY_ARC_TOKEN_OTHER], + lps: ['0x2651D7B53BaF1925D28A3b5A3ef371274e630C4C'], + coreAssets: [ADDRESSES.polygon.WMATIC_2], + restrictTokenRatio: 100, + }) } } \ No newline at end of file diff --git a/projects/arctic/abi.js b/projects/arctic/abi.js index ae6225207e2..85b7159ba48 100644 --- a/projects/arctic/abi.js +++ b/projects/arctic/abi.js @@ -1,127 +1,6 @@ module.exports = { - liquidities: { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "liquidities", - "outputs": [ - { - "internalType": "int24", - "name": "leftPt", - "type": "int24" - }, - { - "internalType": "int24", - "name": "rightPt", - "type": "int24" - }, - { - "internalType": "uint128", - "name": "liquidity", - "type": "uint128" - }, - { - "internalType": "uint256", - "name": "lastFeeScaleX_128", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastFeeScaleY_128", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "remainTokenX", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "remainTokenY", - "type": "uint256" - }, - { - "internalType": "uint128", - "name": "poolId", - "type": "uint128" - } - ], - "stateMutability": "view", - "type": "function" - }, - liquidityNum: { - "inputs": [], - "name": "liquidityNum", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - pool: { - "inputs": [ - { - "internalType": "address", - "name": "tokenX", - "type": "address" - }, - { - "internalType": "address", - "name": "tokenY", - "type": "address" - }, - { - "internalType": "uint24", - "name": "fee", - "type": "uint24" - } - ], - "name": "pool", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - poolMetas: { - "inputs": [ - { - "internalType": "uint128", - "name": "", - "type": "uint128" - } - ], - "name": "poolMetas", - "outputs": [ - { - "internalType": "address", - "name": "tokenX", - "type": "address" - }, - { - "internalType": "address", - "name": "tokenY", - "type": "address" - }, - { - "internalType": "uint24", - "name": "fee", - "type": "uint24" - } - ], - "stateMutability": "view", - "type": "function" - }, + liquidities: "function liquidities(uint256) view returns (int24 leftPt, int24 rightPt, uint128 liquidity, uint256 lastFeeScaleX_128, uint256 lastFeeScaleY_128, uint256 remainTokenX, uint256 remainTokenY, uint128 poolId)", + liquidityNum: "uint256:liquidityNum", + pool: "function pool(address tokenX, address tokenY, uint24 fee) view returns (address)", + poolMetas: "function poolMetas(uint128) view returns (address tokenX, address tokenY, uint24 fee)", } \ No newline at end of file diff --git a/projects/arctic/index.js b/projects/arctic/index.js index cd3ed5251ca..7fa52d14ea6 100644 --- a/projects/arctic/index.js +++ b/projects/arctic/index.js @@ -1,9 +1,10 @@ +const ADDRESSES = require('../helper/coreAssets.json') let abi = require('./abi') const { sumTokens2, } = require('../helper/unwrapLPs') const sdk = require('@defillama/sdk') -const nullAddress = '0x0000000000000000000000000000000000000000' +const nullAddress = ADDRESSES.null const poolHelper = '0xE78e7447223aaED59301b44513D1d3A892ECF212' module.exports = { @@ -49,5 +50,5 @@ module.exports = { return sumTokens2({ tokensAndOwners: toa, chain, block }) } }, - ownTokens: ['ARC'], + // ownTokens: ['ARC'], } diff --git a/projects/arenaswap/index.js b/projects/arenaswap/index.js index 6c69dbf7e5b..021ed932cc8 100644 --- a/projects/arenaswap/index.js +++ b/projects/arenaswap/index.js @@ -4,7 +4,7 @@ const arena = "0x2A17Dc11a1828725cdB318E0036ACF12727d27a2"; const arenaMasterChef = "0xbEa60d145747a66CF27456ef136B3976322b7e77"; const pyram = "0xedeCfB4801C04F3EB394b89397c6Aafa4ADDa15B"; const pyramMasterChef = "0x3e91B21ddE13008Aa73f07BdE26970322Fe5D533"; -const poolInfo = {"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"poolInfo","outputs":[{"internalType":"contract IBEP20","name":"lpToken","type":"address"},{"internalType":"uint256","name":"allocPoint","type":"uint256"},{"internalType":"uint256","name":"lastRewardBlock","type":"uint256"},{"internalType":"uint256","name":"accArenaPerShare","type":"uint256"},{"internalType":"uint16","name":"depositFeeBP","type":"uint16"},{"internalType":"uint256","name":"harvestInterval","type":"uint256"}],"stateMutability":"view","type":"function"}; +const poolInfo = 'function poolInfo(uint256) view returns (address lpToken, uint256 allocPoint, uint256 lastRewardBlock, uint256 accArenaPerShare, uint16 depositFeeBP, uint256 harvestInterval)' async function tvl(timestamp, block, chainBlocks) { let balances = {}; diff --git a/projects/argano/index.js b/projects/argano/index.js index d1ed9960501..039ffb99bee 100644 --- a/projects/argano/index.js +++ b/projects/argano/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk') const { sumTokensExport } = require('../helper/unwrapLPs') const { getUniTVL } = require('../helper/unknownTokens') @@ -5,20 +6,20 @@ const { getUniTVL } = require('../helper/unknownTokens') const contracts = { factory: '0xdAc31E70c2C4Fea0629e85e7B67222127A8672d8', usdtPool: '0x250EFcd45D9f83036f2D403223c7cCb2E1e9D00b', - usdt: '0xc2132d05d31c914a87c6611c10748aeb04b58e8f', + usdt: ADDRESSES.polygon.USDT, wbtcPool: '0x610094adF401626D6B62df62bF6E67A7A6E22043', - wbtc: '0x1bfd67037b42cf73acf2047067bd4f2c47d9bfd6' + wbtc: ADDRESSES.polygon.WBTC }; module.exports = { misrepresentedTokens: true, polygon: { tvl: sdk.util.sumChainTvls([ - sumTokensExport({ chain: 'polygon', tokensAndOwners: [ + sumTokensExport({ tokensAndOwners: [ [contracts.wbtc, contracts.wbtcPool], [contracts.usdt, contracts.usdtPool], ]}), - getUniTVL({ chain: 'polygon', factory: contracts.factory, useDefaultCoreAssets: true, }) + getUniTVL({ factory: contracts.factory, useDefaultCoreAssets: true, }) ]) } }; \ No newline at end of file diff --git a/projects/argofinance/index.js b/projects/argofinance/index.js index 7072fe3d6a1..00991a7c652 100644 --- a/projects/argofinance/index.js +++ b/projects/argofinance/index.js @@ -1,26 +1,18 @@ -const { fetchURL } = require("../helper/utils"); +const { queryV1Beta1 } = require("../helper/chain/cosmos"); const sdk = require("@defillama/sdk"); -const { default: BigNumber } = require("bignumber.js"); -const cryptoOrgUrl = 'https://mainnet.crypto.org:1317/cosmos/staking/v1beta1/delegations/cro1klkxkl2c59m5dcw4w0683ctfaxklsy9py26jg3' -async function tvl(timestamp, chain) { - const data = await fetchURL(cryptoOrgUrl) - let total = new BigNumber(0) - data.data.delegation_responses.forEach(delegation => { - total = BigNumber.sum(total, new BigNumber(delegation.balance.amount)) - }) - let balance = { - 'cronos:0x5c7f8a570d578ed84e63fdfa7b1ee72deae1ae23': total.multipliedBy(new BigNumber(10000000000), 10), - } - return balance +async function tvl() { + const data = await queryV1Beta1({ chain: 'cronos', url: '/staking/v1beta1/delegations/cro1klkxkl2c59m5dcw4w0683ctfaxklsy9py26jg3', }) + let total = data.delegation_responses.reduce((a, i) => a += +i.balance.amount, 0) + const balances = {} + sdk.util.sumSingleBalance(balances, 'cronos:0x5c7f8a570d578ed84e63fdfa7b1ee72deae1ae23', total * 1e10) + return balances } -async function staking(timestamp, chain) { - const { output: xargoBalance } = await sdk.api.erc20.totalSupply({ target: "0x1dE93ce995d1bC763c2422ba30b1E73dE4A45a01", chain: 'cronos' }) - - const bigXArgoBalance = new BigNumber(xargoBalance) +async function staking(timestamp, _, _1, { api }) { + const xargoBalance = await api.call({ target: '0x1dE93ce995d1bC763c2422ba30b1E73dE4A45a01', abi: 'erc20:totalSupply' }) let balance = { - "cronos:0x47A9D630dc5b28F75d3AF3be3AAa982512Cd89Aa": bigXArgoBalance + "cronos:0x47A9D630dc5b28F75d3AF3be3AAa982512Cd89Aa": xargoBalance } return balance } diff --git a/projects/aries-markets/index.js b/projects/aries-markets/index.js index dd6008c517d..20a2e72f70b 100644 --- a/projects/aries-markets/index.js +++ b/projects/aries-markets/index.js @@ -1,7 +1,8 @@ const sdk = require("@defillama/sdk"); const { default: BigNumber } = require("bignumber.js"); -const { getResources, } = require("../helper/chain/aptos"); +const { getResources, getTableData, } = require("../helper/chain/aptos"); const { transformBalances } = require("../helper/portedTokens"); +const toHex = (str) => Buffer.from(str, 'utf-8').toString('hex'); let resourcesCache @@ -35,11 +36,36 @@ module.exports = { borrowed: async () => { const balances = {}; const data = await _getResources() - const coinContainers = data.filter(reserveContrainerFilter) - .map((i) => ({ - lamports: BigNumber(i.data.collateralised_lp_coin.value - i.data.underlying_coin.value).toFixed(0), - tokenAddress: extractCoinAddress(i.type), - })); + const reserveTableHandle = data.filter(i => i.type === "0x9770fa9c725cbd97eb50b2be5f7416efdfd1f1554beb0750d4dae4c64e860da3::reserve::Reserves")[0].data.stats.handle + + const coinContainers = await Promise.all( + data.filter(reserveContrainerFilter) + .map(async (i) => { + const coin_type = extractCoinAddress(i.type) + + const [address, module, struct] = coin_type.split("::"); + + const reserveStatus = await getTableData({ + table: reserveTableHandle, + data: { + key_type: "0x1::type_info::TypeInfo", + value_type: "0x9770fa9c725cbd97eb50b2be5f7416efdfd1f1554beb0750d4dae4c64e860da3::reserve_details::ReserveDetails", + key: { + account_address: address, + module_name: toHex(module), + struct_name: toHex(struct) + } + } + }); + + const total_borrowed = BigInt(reserveStatus.total_borrowed.val) / BigInt(10 ** 18); + + return { + lamports: total_borrowed.toString(), + tokenAddress: coin_type, + }; + }) + ); coinContainers.forEach(({ lamports, tokenAddress }) => { sdk.util.sumSingleBalance(balances, tokenAddress, lamports); diff --git a/projects/armorfinance/abiNXMVault.json b/projects/armorfinance/abiNXMVault.json index 9413a77e1f6..71791f6c64a 100644 --- a/projects/armorfinance/abiNXMVault.json +++ b/projects/armorfinance/abiNXMVault.json @@ -1,15 +1,3 @@ { - "aum": { - "inputs": [], - "name": "aum", - "outputs": [ - { - "internalType": "uint256", - "name": "aumTotal", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -} + "aum": "uint256:aum" +} \ No newline at end of file diff --git a/projects/armorfinance/index.js b/projects/armorfinance/index.js index f559dc15778..d30679b7ed9 100644 --- a/projects/armorfinance/index.js +++ b/projects/armorfinance/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const { sumTokens2, nullAddress, } = require("../helper/unwrapLPs"); @@ -6,9 +7,9 @@ const { staking } = require("../helper/staking"); const POOL_BUYCOVER_ACTION = "0xcafea35cE5a2fc4CED4464DA4349f81A122fd12b"; const NXM_VAULT = "0x1337DEF1FC06783D4b03CB8C1Bf3EBf7D0593FC4"; -const DAI = "0x6b175474e89094c44da98b954eedeac495271d0f"; +const DAI = ADDRESSES.ethereum.DAI; const NXM = "0xd7c49cee7e9188cca6ad8ff264c1da2e69d4cf3b"; -const stETH = "0xae7ab96520de3a18e5e111b5eaab095312d7fe84"; +const stETH = ADDRESSES.ethereum.STETH; const ethTvl = async (timestamp, block) => { let balances = {}; diff --git a/projects/arpa-staking/index.js b/projects/arpa-staking/index.js new file mode 100644 index 00000000000..e079e77122b --- /dev/null +++ b/projects/arpa-staking/index.js @@ -0,0 +1,16 @@ +const STAKING_CONTRACT = "0xee710f79aa85099e200be4d40cdf1bfb2b467a01"; +const ARPA = "0xBA50933C268F567BDC86E1aC131BE072C6B0b71a"; + +const staking = async (_, _1, _2, { api }) => { + const val = await api.call({ target: STAKING_CONTRACT, abi: 'uint256:getTotalCommunityStakedAmount', }); + api.add(ARPA, val) + return api.getBalances() +}; + +module.exports = { + methodology: "TVL is the total amount of ARPA staked by the community", + ethereum: { + tvl: () => ({}), + staking, + }, +}; diff --git a/projects/arrakis-v2/index.js b/projects/arrakis-v2/index.js new file mode 100644 index 00000000000..d1c40930165 --- /dev/null +++ b/projects/arrakis-v2/index.js @@ -0,0 +1,45 @@ +const { getLogs } = require('../helper/cache/getLogs') + +const helper = '0x07d2CeB4869DFE17e8D48c92A71eDC3AE564449f' +const config = { + ethereum: { + factory: '0xECb8Ffcb2369EF188A082a662F496126f66c8288', + fromBlock: 16534507, + }, + arbitrum: { + factory: '0xECb8Ffcb2369EF188A082a662F496126f66c8288', + fromBlock: 57173679, + }, + optimism: { + factory: '0xECb8Ffcb2369EF188A082a662F496126f66c8288', + fromBlock: 71646573, + }, + polygon: { + factory: '0xECb8Ffcb2369EF188A082a662F496126f66c8288', + fromBlock: 38788368, + } +} + +module.exports = { + doublecounted: true, +}; + +Object.keys(config).forEach(chain => { + const { factory, fromBlock, } = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const numVaults = await api.call({ abi: 'uint256:numVaults', target: factory }) + const vaults = await api.call({ abi: 'function vaults(uint256 startIndex_, uint256 endIndex_) returns (address[] memory)', target: factory, params:[0, numVaults] }) + const [token0s, token1s, bals ] = await Promise.all([ + api.multiCall({ abi: 'address:token0', calls: vaults }), + api.multiCall({ abi: 'address:token1', calls: vaults }), + api.multiCall({ abi: 'function totalUnderlying(address) view returns (uint256, uint256)', target: helper, calls: vaults }), + ]) + + bals.forEach(([v0, v1], i) => { + api.add(token0s[i],v0) + api.add(token1s[i],v1) + }) + } + } +}) \ No newline at end of file diff --git a/projects/array-capital/index.js b/projects/array-capital/index.js new file mode 100644 index 00000000000..c878cc4a741 --- /dev/null +++ b/projects/array-capital/index.js @@ -0,0 +1,11 @@ +const { staking } = require('../helper/staking'); + +const token = "0x164731cd270daa4a94bc70761e53320e48367b8b"; +const masterchef = "0x1b91b24d12C934383f25aa07C2c9C9666accf39e"; + +module.exports = { + arbitrum: { + tvl: () => 0, + staking: staking(masterchef, token) + } +} \ No newline at end of file diff --git a/projects/arrow/index.js b/projects/arrow/index.js index fe5a510d9d2..cb558398fed 100644 --- a/projects/arrow/index.js +++ b/projects/arrow/index.js @@ -1,16 +1,14 @@ -const { Program, BorshAccountsCoder, } = require("@project-serum/anchor"); -const { sliceIntoChunks, } = require("../helper/utils"); +const { Program, } = require("@project-serum/anchor"); const { PublicKey } = require("@solana/web3.js"); const arrowIDL = require("./arrowIDL.json"); const sdk = require('@defillama/sdk') -const { getMultipleAccountBuffers, getSaberPools, getProvider, } = require("../helper/solana"); +const { getProvider, } = require("../helper/solana"); async function tvl() { const arrowId = new PublicKey('ARoWLTBWoWrKMvxEiaE2EH9DrWyV7mLpKywGDWxBGeq9') const quarryId = new PublicKey('QMNeHCGYnLVDn1icRAfQZpjPLBNkfGbSKRB83G5d8KB') const provider = getProvider() const QuarryMineIDL = await Program.fetchIdl(quarryId, provider) - const saberPools = await getSaberPools() const arrowProgram = new Program(arrowIDL, arrowId, provider) const balances = {} const arrows = (await arrowProgram.account.arrow.all()).filter(i => i.account.internalMiner.miner._bn > 0) @@ -18,57 +16,9 @@ async function tvl() { const lpMints = arrows.map(i => i.account.vendorMiner.mint.toString()) const quarryProgram = new Program(QuarryMineIDL, quarryId, provider) const quaryData = await quarryProgram.account.miner.fetchMultiple(miners) - // return {} - // const coder = new BorshAccountsCoder(QuarryMineIDL); - // const minersRaw = await connection.getMultipleAccountsInfo( - // miners.map((q) => new PublicKey(q)) - // ); - // const quaryData = minersRaw.map((q) => - // coder.accountLayouts.get('Miner').decode(q.data) - // ); - // const quaryData = await quarryProgram.account.miner.fetchMultiple(miners) - const quarryDataKeyed = {} quaryData.forEach((data, i) => { - if (!data) return; - quarryDataKeyed[miners[i]] = { - tokenAmount: data.balance, - } + sdk.util.sumSingleBalance(balances,lpMints[i],+data.balance, 'solana') }) - - const dataKeys = [] - lpMints.forEach((lpMint, i) => { - const saberPool = saberPools.find((p) => p.lpMint === lpMint) - const miner = miners[i] - if (!saberPool) return; - if (!quarryDataKeyed[miner]) return; - quarryDataKeyed[miner].saberPool = saberPool - quarryDataKeyed[miner].stakedMint = lpMint - dataKeys.push(lpMint, saberPool.reserveA, saberPool.reserveB) - }) - - const dataCache = {} - for (const keys of sliceIntoChunks(dataKeys, 99)) { - const res = await getMultipleAccountBuffers(keys) - keys.forEach((key, i) => { - dataCache[key] = res[i] - }) - } - Object.keys(quarryDataKeyed).forEach(key => { - if (!quarryDataKeyed[key].saberPool) delete quarryDataKeyed[key] - }) - Object.values(quarryDataKeyed).forEach(quarry => addQuarryBalance(dataCache, balances, quarry)) - - return balances; -} - -function addQuarryBalance(dataCache, balances = {}, { tokenAmount, stakedMint, saberPool: { reserveA, reserveB, tokenA, tokenB, } }) { - const lpTokenTotalSupply = Number(dataCache[stakedMint].readBigUInt64LE(36)); - let poolShare = tokenAmount / lpTokenTotalSupply - - const reserveAAmount = Number(dataCache[reserveA].readBigUInt64LE(64)); - const reserveBAmount = Number(dataCache[reserveB].readBigUInt64LE(64)); - sdk.util.sumSingleBalance(balances, 'solana:'+tokenA, poolShare * reserveAAmount) - sdk.util.sumSingleBalance(balances, 'solana:'+tokenB, poolShare * reserveBAmount) return balances } diff --git a/projects/artemis/index.js b/projects/artemis/index.js index 54d33d28a0a..1d598524d1c 100644 --- a/projects/artemis/index.js +++ b/projects/artemis/index.js @@ -1,6 +1,7 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { masterchefExports, } = require("../helper/unknownTokens") -const token = "0xd74433b187cf0ba998ad9be3486b929c76815215"; +const token = ADDRESSES.harmony.MIS; const masterchef = "0x59c777cd749b307be910f15c54a3116ff88f9706"; module.exports = masterchefExports({ diff --git a/projects/arthswap/index.js b/projects/arthswap/index.js index 4b4d3fd40cc..ad7bdb436da 100644 --- a/projects/arthswap/index.js +++ b/projects/arthswap/index.js @@ -1,10 +1,11 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { getUniTVL } = require("../helper/unknownTokens"); const { stakingPricedLP } = require("../helper/staking"); const FACTORIES = "0xA9473608514457b4bF083f9045fA63ae5810A03E"; const TOKENS = { - ARSW: "0xDe2578Edec4669BA7F41c5d5D2386300bcEA4678", + ARSW: ADDRESSES.astar.ARSW, }; const STAKING_CONTRACTS = { @@ -17,7 +18,6 @@ module.exports = { astar: { tvl: getUniTVL({ factory: FACTORIES, - chain: 'astar', useDefaultCoreAssets: true, }), staking: stakingPricedLP( diff --git a/projects/asgard-dao/index.js b/projects/asgard-dao/index.js index f4269fa8c9b..797b36f78be 100644 --- a/projects/asgard-dao/index.js +++ b/projects/asgard-dao/index.js @@ -1,12 +1,13 @@ +const ADDRESSES = require('../helper/coreAssets.json') const {ohmTvl} = require("../helper/ohm"); const treasury = "0xFb445ce1CFE11B86505dD293f1bE438fFaa4fF8c"; const treasuryTokens = [ ["0x1af3f329e8be154074d8769d1ffa4ee058b1dbc3", false], // DAI - ["0xe9e7cea3dedca5984780bafc599bd69add087d56", false], // BUSD - ["0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c", false], // WBNB + [ADDRESSES.bsc.BUSD, false], // BUSD + [ADDRESSES.bsc.WBNB, false], // WBNB ["0x0e09fabb73bd3ade0a17ecc321fd13a19e81ce82", false], // CAKE - ["0x55d398326f99059ff775485246999027b3197955", false], // USDT + [ADDRESSES.bsc.USDT, false], // USDT ["0xE119c951b68555d50eB6Aa54b5Cf0b854715CB2c", true], // ASGARD-WBNB CAKE LP ["0x11ceddd7a64ec79212d8ae9c8b46d23b8b750db0", true], // ASGARD-BUSD CAKE LP ["0xE5E926c8Ca7A44F7FFD900F5a88eA33E2B07162D", true] // ASGARD-DAI CAKE LP diff --git a/projects/asgardfinance/index.js b/projects/asgardfinance/index.js index af74f4378b4..bf5323aaa83 100644 --- a/projects/asgardfinance/index.js +++ b/projects/asgardfinance/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); @@ -6,9 +7,9 @@ const ASG = "0x0DC5189Ec8CDe5732a01F0F592e927B304370551"; const AsgardTreasury = "0x9D5818af130705F95444d78A55B4F3d85cBfCC13"; -const DAI = "0x6b175474e89094c44da98b954eedeac495271d0f"; +const DAI = ADDRESSES.ethereum.DAI; const ASG_DAI_SLP = "0x024cc95611d478dd367240e72c82662d9e390a6a"; -const FRAX = "0x853d955acef822db058eb8505911ed77f175b99e"; +const FRAX = ADDRESSES.ethereum.FRAX; const ASG_FRAX_SLP = "0x5696cd9054ce11625141f5ee2c65fc4d57c2a5ca"; const WUST = "0xa47c8bf37f92abed4a126bda807a7b7498661acd"; const ASG_UST_SLP = "0x5a1abc007f031aa58238f45941d965ce6892fdff"; @@ -55,6 +56,9 @@ async function ethTvl(timestamp, block) { } module.exports = { + hallmarks: [ + [1643155200, "Token mint exploit"] + ], ethereum: { staking, tvl: ethTvl, diff --git a/projects/ashswap/index.js b/projects/ashswap/index.js new file mode 100644 index 00000000000..7159c2e13d6 --- /dev/null +++ b/projects/ashswap/index.js @@ -0,0 +1,28 @@ +const { cachedGraphQuery } = require('../helper/cache') +const { sumTokens, sumTokensExport } = require('../helper/sumTokens') + +const API_URL = 'https://api-v2.ashswap.io/graphql'; + +const TVLQuery = `query ashBaseStateQuery { + pools { + address + } + poolsV2 { + address + } +}` + +async function tvl() { + const data = await cachedGraphQuery('ashswap', API_URL, TVLQuery) + const owners = Object.values(data).flat().map(i => i.address) + return sumTokens({ owners, chain: 'elrond'}) +} + +module.exports = { + misrepresentedTokens: true, + timetravel: false, + elrond: { + tvl, + staking: sumTokensExport({ owner: 'erd1qqqqqqqqqqqqqpgq58elfqng8edp0z83pywy3825vzhawfqp4fvsaldek8'}), + }, +} \ No newline at end of file diff --git a/projects/astarexchange/index.js b/projects/astarexchange/index.js index 61bd6d8c0ca..531eb870d84 100644 --- a/projects/astarexchange/index.js +++ b/projects/astarexchange/index.js @@ -4,6 +4,6 @@ module.exports = { misrepresentedTokens: true, methodology: "Astar Exchange Tvl Calculation", astar: { - tvl: getUniTVL({ factory: '0x95f506E72777efCB3C54878bB4160b00Cd11cd84', chain: 'astar', useDefaultCoreAssets: true }), + tvl: getUniTVL({ factory: '0x95f506E72777efCB3C54878bB4160b00Cd11cd84', useDefaultCoreAssets: true }), } } diff --git a/projects/astarexchangev3/index.js b/projects/astarexchangev3/index.js new file mode 100644 index 00000000000..3f71bb8a070 --- /dev/null +++ b/projects/astarexchangev3/index.js @@ -0,0 +1,5 @@ +const { uniV3Export } = require('../helper/uniswapV3') + +module.exports = uniV3Export({ + astar: { factory: '0x0bA242809B5b8AC2C362372807bc616fc620DB97', fromBlock: 3333333, }, +}) diff --git a/projects/astarfarm/abi.json b/projects/astarfarm/abi.json deleted file mode 100644 index f24cd1eba00..00000000000 --- a/projects/astarfarm/abi.json +++ /dev/null @@ -1,15 +0,0 @@ -[ - { - "inputs": [], - "name": "stakedV2", - "outputs": [ - { - "internalType": "uint128", - "name": "", - "type": "uint128" - } - ], - "stateMutability": "view", - "type": "function" - } -] diff --git a/projects/astarfarm/index.js b/projects/astarfarm/index.js index 2be348878c4..a7f1b8ba8dd 100644 --- a/projects/astarfarm/index.js +++ b/projects/astarfarm/index.js @@ -1,4 +1,3 @@ -const abi = require("./abi.json"); const sdk = require('@defillama/sdk') const stakingContract = '0x992bad137Fc8a50a486B5C6375f581964b4A15FC' @@ -6,7 +5,7 @@ const stakingContract = '0x992bad137Fc8a50a486B5C6375f581964b4A15FC' module.exports = { astar: { tvl: async (ts, _block, { astar: block }) => { - const { output: lockedAstar } = await sdk.api.abi.call({ target: stakingContract, block, abi: abi.find(i => i.name === 'stakedV2'), chain: 'astar' }) + const { output: lockedAstar } = await sdk.api.abi.call({ target: stakingContract, block, abi: 'uint128:stakedV2', chain: 'astar' }) return { 'astar': +lockedAstar / 1e18 } } } diff --git a/projects/astaria/index.js b/projects/astaria/index.js new file mode 100644 index 00000000000..9d9fd4c051e --- /dev/null +++ b/projects/astaria/index.js @@ -0,0 +1,67 @@ +const { getLogs } = require('../helper/cache/getLogs'); +const { sumTokens2 } = require('../helper/unwrapLPs'); + +const config = { + ethereum: { factory: '0x197Bb6Cd6cC9E9ABBFdaBff23DE7435c51d1B7BE', fromBlock: 16935232 , ACT: '0x455ad0f677628ed40e7397fb41818f474e0e5afe' }, +} + +/* +Object.keys(config).forEach(chain => { + const { factory, fromBlock, ACT } = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const logs = await getLogs({ + api, + target: factory, + topics: ['0x9aa6282003aa425f2bb942f91daaf7080de24835fc4fa8f3f4dc52c7d014ea97'], + eventAbi: 'event NewVault (address strategist, address delegate, address vault, uint8 vaultType)', + onlyArgs: true, + fromBlock, + }) + const actLogs = await getLogs({ + api, + target: ACT, + topics: ['0xd6b6bfb15fe5be5c1a8af879e26df8c0e2470c4ad95a47a1397868b45910e853'], + eventAbi: 'event Deposit721 (address indexed tokenContract, uint256 indexed tokenId, uint256 indexed collateralId, address depositedFor)', + onlyArgs: true, + fromBlock, + }) + const vaults = logs.map(l => l.vault) + const nfts = actLogs.map(l => l.tokenContract) + const collIds = actLogs.map(l => l.collateralId) + const clearingHouses = await api.multiCall({ abi: "function getClearingHouse(uint256 collateralId) view returns (address)", calls: collIds.map(i => i.toString()), target:ACT}) + const tokensAndOwners = nfts.map((v, i) => [v, clearingHouses[i]]) + + const tokens = await api.multiCall({ abi: 'address:asset', calls: vaults}) + const bals = await api.multiCall({ abi: 'uint256:totalAssets', calls: vaults}) + tokens.forEach((t, i) => tokensAndOwners.push([t, vaults[i]])) + return sumTokens2({ api, tokensAndOwners }) + }, + borrowed: async (_, _b, _cb, { api, }) => { + const logs = await getLogs({ + api, + target: factory, + topics: ['0x9aa6282003aa425f2bb942f91daaf7080de24835fc4fa8f3f4dc52c7d014ea97'], + eventAbi: 'event NewVault (address strategist, address delegate, address vault, uint8 vaultType)', + onlyArgs: true, + fromBlock, + }) + const vaults = logs.map(l => l.vault) + const tokens = await api.multiCall({ abi: 'address:asset', calls: vaults}) + const deposited = await api.multiCall({ abi: 'uint256:totalAssets', calls: vaults}) + const liquidity = await api.multiCall({ abi: 'erc20:balanceOf', calls: vaults.map((v, i) => ({ target: tokens[i], params: v }))}) + tokens.forEach((token, i) => api.add(token, deposited[i] - liquidity[i])) + }, + } +}) +*/ + +module.exports={ + ethereum:{ + tvl: ()=>({}), + borrowed: ()=>({}), + }, + hallmarks:[ + [1687301106, "White hack"] + ] +} diff --git a/projects/astarnova/abi.json b/projects/astarnova/abi.json deleted file mode 100644 index b99c7d2b86b..00000000000 --- a/projects/astarnova/abi.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "inputs": [ - { - "internalType": "address", - "name": "pool", - "type": "address" - } - ], - "name": "tvlOfPool", - "outputs": [ - { - "internalType": "uint256", - "name": "tvl", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" -} \ No newline at end of file diff --git a/projects/astarnova/index.js b/projects/astarnova/index.js index 64dd6391a5d..9e8417c7b3c 100644 --- a/projects/astarnova/index.js +++ b/projects/astarnova/index.js @@ -1,5 +1,4 @@ const sdk = require('@defillama/sdk') -const abi = require('./abi.json') const BigNumber = require('bignumber.js') const dashboard = '0x63d3b2d066c1247245B31252441B3B6744e5BeB1' @@ -28,7 +27,7 @@ async function astar(timestamp, ethBlock, chainBlock) { params: address })), block, - abi: abi, + abi: 'function tvlOfPool(address pool) view returns (uint256 tvl)', chain: 'astar' })).output.reduce((tvl, call) => tvl.plus(new BigNumber(call.output)), ZERO) diff --git a/projects/astra-dao/index.js b/projects/astra-dao/index.js new file mode 100644 index 00000000000..e22a9a49d57 --- /dev/null +++ b/projects/astra-dao/index.js @@ -0,0 +1,31 @@ +const { sumTokensExport, sumTokens2 } = require('../helper/unwrapLPs') +const ASTRA_TOKEN_CONTRACT = '0x7E9c15C43f0D6C4a12E6bdfF7c7D55D0f80e3E23'; +const ASTRA_STAKING_CONTRACT = '0xDFE672C671943411fc16197fb8E328662B57CE2C'; + +async function tvl(_, _b, _cb, { api, }) { + let gotError = false + const indexAddr = '0x17b9B197E422820b3e28629a2BB101949EE7D12B' + const stableCoin = await api.call({ abi: 'address:baseStableCoin', target: indexAddr}) + let i = 0 + const tokens = [stableCoin] + do { + try { + const _tokens = await api.call({ abi: 'function getIndexTokenDetails(uint256) view returns (address[])', target: indexAddr, params: i}) + tokens.push(..._tokens) + i++ + } catch(e) { + if (i === 0) throw e + gotError = true + } + } while(!gotError) + return sumTokens2({ api, owner: indexAddr, tokens}) +} + +module.exports = { + start: 17243078, + ethereum: { + tvl, + pool2: sumTokensExport({ owner: ASTRA_STAKING_CONTRACT, resolveUniV3: true, }), + staking: sumTokensExport({ owner: ASTRA_STAKING_CONTRACT, tokens: [ASTRA_TOKEN_CONTRACT], }) + } +}; \ No newline at end of file diff --git a/projects/astriddao/abi/ActivePool.abi.json b/projects/astriddao/abi/ActivePool.abi.json index 3a1175c0839..466610360b5 100644 --- a/projects/astriddao/abi/ActivePool.abi.json +++ b/projects/astriddao/abi/ActivePool.abi.json @@ -1,15 +1,3 @@ { - "getCOL": { - "inputs": [], - "name": "getCOL", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } + "getCOL": "uint256:getCOL" } \ No newline at end of file diff --git a/projects/astriddao/abi/DefaultPool.abi.json b/projects/astriddao/abi/DefaultPool.abi.json index 3a1175c0839..466610360b5 100644 --- a/projects/astriddao/abi/DefaultPool.abi.json +++ b/projects/astriddao/abi/DefaultPool.abi.json @@ -1,15 +1,3 @@ { - "getCOL": { - "inputs": [], - "name": "getCOL", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } + "getCOL": "uint256:getCOL" } \ No newline at end of file diff --git a/projects/astriddao/index.js b/projects/astriddao/index.js index 7c1b8c9dfeb..6e1bb69e272 100644 --- a/projects/astriddao/index.js +++ b/projects/astriddao/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens } = require('../helper/unwrapLPs') const { getFixBalances } = require('../helper/portedTokens') @@ -12,54 +13,54 @@ const COLLATERALS = { } }, BUSD: { - tokenAddress: "0x4Bf769b05E832FCdc9053fFFBC78Ca889aCb5E1E", - bridgeTokenMapping: "0x4fabb145d64652a948d72533023f6e7a623c7c53", + tokenAddress: ADDRESSES.oasis.ceUSDT, + bridgeTokenMapping: ADDRESSES.ethereum.BUSD, contracts: { activePool: "0x892af684Afd5fCee1023f7811C35fd695Bf0cd6f", defaultPool: "0xe487b9066A8fFde840b29892f1052CBEdccc3073", } }, DAI: { - tokenAddress: "0x6De33698e9e9b787e09d3Bd7771ef63557E148bb", - bridgeTokenMapping: "0x6b175474e89094c44da98b954eedeac495271d0f", + tokenAddress: ADDRESSES.astar.DAI, + bridgeTokenMapping: ADDRESSES.ethereum.DAI, contracts: { activePool: "0xCE90059FbCEc696634981945600d642A79e262aD", defaultPool: "0x3aD8FE12674B4c9481d5C7585ed5bDC4E35025b9", } }, DOT: { - tokenAddress: "0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF", + tokenAddress: ADDRESSES.astar.DOT, contracts: { activePool: "0x8cd0b101838b082133e25eEb76C916Ae2AC56f36", defaultPool: "0x4e8B4867899A69bB05EFa6A16e68363C2BBeB02f", } }, USDC: { - tokenAddress: "0x6a2d262d56735dba19dd70682b39f6be9a931d98", - bridgeTokenMapping: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", + tokenAddress: ADDRESSES.moonbeam.USDC, + bridgeTokenMapping: ADDRESSES.ethereum.USDC, contracts: { activePool: "0x5070d543654D866964C44E610a3b7f85fcAf2859", defaultPool: "0xEb80f1a9ede36412cF26E1e35ae74dbA30cCfF02", } }, WETH: { - tokenAddress: "0x81ECac0D6Be0550A00FF064a4f9dd2400585FE9c", + tokenAddress: ADDRESSES.moonbeam.USDT, contracts: { activePool: "0x5Ec419F08602caE5e4C591dE65bD640d66673035", defaultPool: "0x2eE0F3daa042af6Fdd56f0194d5aBfdA0A723D95", } }, WBTC: { - tokenAddress: "0xad543f18cFf85c77E140E3E5E3c3392f6Ba9d5CA", - bridgeTokenMapping: "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", + tokenAddress: ADDRESSES.astar.WBTC, + bridgeTokenMapping: ADDRESSES.ethereum.WBTC, contracts: { activePool: "0x1685E4f68FD9A50246ce92F0eb07a977591F5Ba2", defaultPool: "0xD69eB04d9ff456A31Da6D2a20538512C433ac1Ca", } }, USDT: { - tokenAddress: "0x3795c36e7d12a8c252a20c5a7b455f7c57b60283", - bridgeTokenMapping: "0xdAC17F958D2ee523a2206206994597C13D831ec7", + tokenAddress: ADDRESSES.astar.USDT, + bridgeTokenMapping: ADDRESSES.ethereum.USDT, contracts: { activePool: "0x74dFF63491B39E5fFE0Be44Ee3B23F674C27DB7c", defaultPool: "0x8EE2f5403246b86d7493ddCeED19f9347bc4DF1D", @@ -67,7 +68,7 @@ const COLLATERALS = { }, } -const BAI_TOKEN_ADDRESS = "0x733ebcC6DF85f8266349DEFD0980f8Ced9B45f35" +const BAI_TOKEN_ADDRESS = ADDRESSES.astar.BAI const STAKES = { WASTAR: { contracts: { @@ -111,7 +112,7 @@ const STAKES = { }, } -const ATID_TOKEN_ADDRESS = "0x5271D85CE4241b310C0B34b7C2f1f036686A6d7C"; +const ATID_TOKEN_ADDRESS = ADDRESSES.astar.ATID; const ATID_STAKES = { WASTAR: { contracts: { diff --git a/projects/astroport-classic/index.js b/projects/astroport-classic/index.js new file mode 100644 index 00000000000..b15e40f8b5e --- /dev/null +++ b/projects/astroport-classic/index.js @@ -0,0 +1,13 @@ +const { getFactoryTvl } = require('../terraswap/factoryTvl') + +module.exports = { + timetravel: false, + misrepresentedTokens: true, + methodology: "Liquidity on the DEX", + terra: { + tvl: getFactoryTvl("terra1fnywlw4edny3vw44x04xd67uzkdqluymgreu7g",) + }, + hallmarks: [ + [1651881600, "UST depeg"], + ] +} // node test.js projects/astroport/index.js diff --git a/projects/astroport/index.js b/projects/astroport/index.js index 4ab0b95f589..981dfb0ace8 100644 --- a/projects/astroport/index.js +++ b/projects/astroport/index.js @@ -1,22 +1,16 @@ -const {getFactoryTvl} = require('../terraswap/factoryTvl') +const { getFactoryTvl } = require('../terraswap/factoryTvl') module.exports = { timetravel: false, misrepresentedTokens: true, methodology: "Liquidity on the DEX", - terra: { - tvl: getFactoryTvl( - "terra1fnywlw4edny3vw44x04xd67uzkdqluymgreu7g" - ) + injective: { + tvl: getFactoryTvl("inj19aenkaj6qhymmt746av8ck4r8euthq3zmxr2r6",) }, terra2: { - tvl: getFactoryTvl( - "terra14x9fr055x5hvr48hzy2t4q7kvjvfttsvxusa4xsdcy702mnzsvuqprer8r", - true - ) + tvl: getFactoryTvl("terra14x9fr055x5hvr48hzy2t4q7kvjvfttsvxusa4xsdcy702mnzsvuqprer8r") + }, + neutron: { + tvl: getFactoryTvl("neutron1hptk0k5kng7hjy35vmh009qd5m6l33609nypgf2yc6nqnewduqasxplt4e") }, - hallmarks:[ - [1651881600, "UST depeg"], - ] - } // node test.js projects/astroport/index.js \ No newline at end of file diff --git a/projects/astrowar-finance/index.js b/projects/astrowar-finance/index.js index c4e41062752..c8d4f032ea4 100644 --- a/projects/astrowar-finance/index.js +++ b/projects/astrowar-finance/index.js @@ -5,7 +5,7 @@ const { getPoolInfo, } = require('../helper/masterchef') async function tvl(timestamp, _block, { harmony: block }) { const stakePool = '0x1B7084DD5A3874C7DE8ff3e7AA668290f0613Afb'; const masterChef = '0x50bca04eb01e4B66cBb04dcdFA872D23942D0B00'; - const standardPoolInfoAbi = { "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "name": "poolInfo", "outputs": [{ "internalType": "contract IERC20", "name": "lpToken", "type": "address" }, { "internalType": "uint256", "name": "allocPoint", "type": "uint256" }, { "internalType": "uint256", "name": "lastRewardBlock", "type": "uint256" }, { "internalType": "uint256", "name": "accWeVEPerShare", "type": "uint256" }], "stateMutability": "view", "type": "function" } + const standardPoolInfoAbi = 'function poolInfo(uint256) view returns (address lpToken, uint256 allocPoint, uint256 lastRewardBlock, uint256 accWeVEPerShare)' const chain = 'harmony' const poolInfo = await getPoolInfo(masterChef, block, chain, standardPoolInfoAbi) const toa = poolInfo.map(i => [i.output[0], stakePool]) @@ -14,6 +14,9 @@ async function tvl(timestamp, _block, { harmony: block }) { module.exports = { deadFrom: 1650564340, + hallmarks: [ + [1650412800, "Rug Pull"] + ], harmony: { tvl } diff --git a/projects/asymetrix/index.js b/projects/asymetrix/index.js new file mode 100644 index 00000000000..fb3e87041b9 --- /dev/null +++ b/projects/asymetrix/index.js @@ -0,0 +1,13 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require("../helper/unwrapLPs"); + +const STAKE_PRIZE_POOL_CONTRACT = "0x82D24dD5041A3Eb942ccA68B319F1fDa9EB0c604"; +const ST_ETH_TOKEN_CONTRACT = ADDRESSES.ethereum.STETH; + +module.exports = { + methodology: + "TVL is counted as the amount of all stETH on the StakePrizePool contract. stETH that is not distributed yet are also counting because they will be distributed in the end of the current draw.", + ethereum: { + tvl: sumTokensExport({ owners: [STAKE_PRIZE_POOL_CONTRACT], tokens: [ST_ETH_TOKEN_CONTRACT]}), + }, +}; diff --git a/projects/asymmetry-fi/index.js b/projects/asymmetry-fi/index.js new file mode 100644 index 00000000000..8d669b28e39 --- /dev/null +++ b/projects/asymmetry-fi/index.js @@ -0,0 +1,14 @@ +const { sumTokensExport } = require('../helper/unwrapLPs') +const ADDRESSES = require('../helper/coreAssets.json') + +module.exports = { + ethereum: { + tvl: sumTokensExport({ + tokensAndOwners: [ + [ADDRESSES.ethereum.WSTETH, '0x972a53e3a9114f61b98921fb5b86c517e8f23fad'], + [ADDRESSES.ethereum.RETH, '0x7b6633c0cd81dc338688a528c0a3f346561f5ca3'], + [ADDRESSES.ethereum.sfrxETH, '0x36ce17a5c81e74dc111547f5dffbf40b8bf6b20a'], + ] + }) + } +} \ No newline at end of file diff --git a/projects/ate/index.js b/projects/ate/index.js new file mode 100644 index 00000000000..2ee6b6969a8 --- /dev/null +++ b/projects/ate/index.js @@ -0,0 +1,29 @@ +const { mergeExports } = require("../helper/utils") +const { yieldHelper, } = require("../helper/yieldHelper") + +const farm_arbi = '0x9373da81F82Aba62605a8A03950B9Aa188a02bF7' +const ate_arbi = '0xd5DA32Ad4C7510457C0e46Fa4332F75f6C4C4dC0' +const abis ={ + poolInfo: 'function poolInfo(uint256) view returns (address want, uint256 allocPoint, uint256 lastRewardBlock, uint256 accSushiPerShare, uint256 accAQUAPerShare, uint256 depositFee, uint256 withdrawFee, uint256 amount, uint256 reserve, address strat, address strat1)', +} + +const arbi_helper = yieldHelper({ + project: 'autoearn-finance', + chain: 'arbitrum', + masterchef: farm_arbi, + nativeToken: ate_arbi, + abis, +}) + +const farm_zk = '0x6d90D891A03C32d4082126D0CEe145f3bE62444A' +const ate_zk = '0x8E6D4473031f4B81E19B13C632933a913d4B4F8e' + +const zk_helper = yieldHelper({ + project: 'autoearn-finance-era', + chain: 'era', + masterchef: farm_zk, + nativeToken: ate_zk, + abis, +}) + +module.exports = mergeExports([arbi_helper, zk_helper]) \ No newline at end of file diff --git a/projects/athenafinance-io/index.js b/projects/athenafinance-io/index.js new file mode 100644 index 00000000000..b5b66e3400e --- /dev/null +++ b/projects/athenafinance-io/index.js @@ -0,0 +1,39 @@ +const { unwrapLPsAuto, nullAddress, sumTokensExport } = require('../helper/unwrapLPs') + +const masterchef = '0x652a63c4df14e29080Ab058d6f151aBa61F86c10' + +async function tvl(_, _b, _cb, { api, }) { + const pools = await api.fetchList({ lengthAbi: 'uint256:poolLength', itemAbi: 'function registeredToken(uint256) view returns (address)', target: masterchef }) + const poolInfo = await api.multiCall({ abi: 'function getPoolInfo(address) view returns ( uint256 emission, uint256 allocpoint, uint256 sizeOfPool, uint256 totalPoint)', calls: pools, target: masterchef }) + const poolInfo2 = await api.multiCall({ abi: 'function addressToPoolInfo(address) view returns ( address lpToken, uint256 allocPoint, uint256 lastRewardTimestamp, uint256 accATHPerShare, address rewarder, address helper, address locker)', calls: pools, target: masterchef }) + + const poolHelperData = [] + poolInfo2.forEach((data, index) => { + if (pools[index].toLowerCase() === '0xfc56eac0d0e53105f7a45a669baf662c0ee292ed') return; // ignore ATH token + if (pools[index].toLowerCase() === '0x724ccdcf3f77096963b8e0849dab3eb142b167a4') return; // ignore ATH LP token + if (data.helper === '0xeB27E1C356b173277bb75ACA3a3f8a0164Fa0ABa') { + api.add('0x724CcDcf3F77096963B8e0849dab3Eb142b167a4', poolInfo[index].sizeOfPool) + } else if (data.helper === nullAddress) { + api.add(pools[index], poolInfo[index].sizeOfPool) + } else { + poolHelperData.push({ + helper: data.helper, + balance: poolInfo[index].sizeOfPool + }) + } + }) + const depositToken = await api.multiCall({ abi: 'address:depositToken', calls: poolHelperData.map(i => i.helper) }) + depositToken.forEach((data, index) => api.add(data, poolHelperData[index].balance)) + + return unwrapLPsAuto({ api, }) +} + + +module.exports = { + doublecounted: true, + metis: { + tvl, + staking: sumTokensExport({ owner: '0xD481eD22a20708839aeB7f1d07E1d01cbc526184', tokens: ['0xA4eE142e34d0676Edc2b760DD0016003D99a4ceC'] }), + pool2: sumTokensExport({ owner: masterchef, tokens: ['0x724CcDcf3F77096963B8e0849dab3Eb142b167a4'], resolveLP: true, }), + } +} \ No newline at end of file diff --git a/projects/athos/index.js b/projects/athos/index.js new file mode 100644 index 00000000000..b141b08a12c --- /dev/null +++ b/projects/athos/index.js @@ -0,0 +1,14 @@ + +const { sumTokensExport } = require('../helper/unwrapLPs') + +module.exports = { + misrepresentedTokens: true, + moonbeam: { + tvl: () => ({}), + staking: sumTokensExport({ + chain: 'moonbeam', + owner: '0x2dfdb2e340eadb2e29117a2b31c139fe81c550a9', + tokens: ['0xcbabee0658725b5b21e1512244734a5d5c6b51d6',], + }), + }, +}; diff --git a/projects/atlantisloans/index.js b/projects/atlantisloans/index.js index d0c09348d3f..59bdac93ff0 100644 --- a/projects/atlantisloans/index.js +++ b/projects/atlantisloans/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { staking } = require("../helper/staking"); const { pool2 } = require("../helper/pool2"); const { compoundExports } = require("../helper/compound"); @@ -20,27 +21,35 @@ module.exports = { bsc: { pool2: pool2(lpVaultStakingContract_BNB, ALT_BUSD_CakeLP_BNB, "bsc"), staking: staking(vaultStakingContract_BNB, ATL, "bsc"), - ...compoundExports(comptroller, - "bsc", - "0x5A9A90983A369b6bB8F062f0AFe6219Ac01caF63", - "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c" - ), + // ...compoundExports(comptroller, + // "bsc", + // "0x5A9A90983A369b6bB8F062f0AFe6219Ac01caF63", + // ADDRESSES.bsc.WBNB + // ), + tvl: async () => ({}), + }, + // polygon: compoundExports(polygonComptroller, + // "polygon", + // "0xa65722af4957cef481edb4cb255f804dd36e8adc", + // ADDRESSES.polygon.WMATIC_2 + // ), + polygon: { + tvl: async () => ({}), }, - polygon: compoundExports(polygonComptroller, - "polygon", - "0xa65722af4957cef481edb4cb255f804dd36e8adc", - "0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270" - ), avax: compoundExports(avaxComptroller, "avax", "0x6bd2154fbc086cb43411966e0e72584196ccd065", - "0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7" + ADDRESSES.avax.WAVAX ), dogechain: compoundExports(dcComptroller, "dogechain", "0xbc46Dc817ce983CfD1B36cBc599031aCBEc2FDfe", - "0xb7ddc6414bf4f5515b52d8bdd69973ae205ff101" + ADDRESSES.dogechain.WWDOGE ), + hallmarks: [ + [Math.floor(new Date('2023-04-01') / 1e3), 'Team stops all comms, stole funds (?)'], + [Math.floor(new Date('2023-06-10') / 1e3), 'Governance Attack'], + ], methodology: "TVL is comprised of tokens deposited to the protocol as collateral, similar to Compound Finance and other lending protocols the borrowed tokens are not counted as TVL.", }; diff --git a/projects/atlas-fi/index.js b/projects/atlas-fi/index.js new file mode 100644 index 00000000000..ae5bc8a97cc --- /dev/null +++ b/projects/atlas-fi/index.js @@ -0,0 +1,34 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokens2 } = require("../helper/unwrapLPs") +const { sumTokensExport } = require("../helper/unknownTokens") +const VAULT = '0x3A93FCCcD2769579eFE03d6DeF2C4468F5F0bd38' +const FARM_PROXY = '0xca6aca5eabd9fac29404974e1a69a0b69c7f1ea2' + +async function tvl(_, _b, _cb, { api, }) { + return sumTokens2({ + api, + ownerTokens: [ + [[ + ADDRESSES.arbitrum.USDT, + '0xf6995955e4b0e5b287693c221f456951d612b628', + '0xee338313f022caee84034253174fa562495dcc15', + '0x8dc3312c68125a94916d62b97bb5d925f84d4ae0', + '0xd3204e4189becd9cd957046a8e4a643437ee0acc', + '0xf52f079af080c9fb5afca57dde0f8b83d49692a9', + ], VAULT], + [[ADDRESSES.arbitrum.ARB], FARM_PROXY] + ] + }) +} + +module.exports = { + methodology: 'Sums the total value locked of all strategies in Atlas', + hallmarks: [ + [1681776000, "Rug Pull"] + ], + arbitrum: { + tvl, + pool2: sumTokensExport({ useDefaultCoreAssets: true, owner: FARM_PROXY, tokens: ['0x4edaa03fc13f8f13c3290c3728f587760b12e381'], lps: ['0x4edaa03fc13f8f13c3290c3728f587760b12e381'] }), + staking: sumTokensExport({ useDefaultCoreAssets: true, owner: FARM_PROXY, tokens: ['0x296A0b8847BD4ED9af71a9ef238fa5Be0778B611'], lps: ['0x4edaa03fc13f8f13c3290c3728f587760b12e381'] }), + } +} diff --git a/projects/atlas-usv/api.js b/projects/atlas-usv/api.js new file mode 100644 index 00000000000..98969bb597c --- /dev/null +++ b/projects/atlas-usv/api.js @@ -0,0 +1,8 @@ +const index = require('./index') + +module.exports = { + polygon: { + tvl: () => 0, + staking: index.polygon.staking, + } +} \ No newline at end of file diff --git a/projects/atlas-usv/index.js b/projects/atlas-usv/index.js index 27925f7dffb..dea985804ef 100644 --- a/projects/atlas-usv/index.js +++ b/projects/atlas-usv/index.js @@ -1,9 +1,10 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { ohmTvl } = require("../helper/ohm"); const treasuryAddress = "0x71EF2894E23D7ea7Fd73a3558B3a0bA25689bC86"; module.exports = ohmTvl(treasuryAddress, [ //DAI - ["0x8f3cf7ad23cd3cadbd9735aff958023239c6a063", false], + [ADDRESSES.polygon.DAI, false], //FRAX ["0x104592a158490a9228070e0a8e5343b499e125d0", false], //SSX diff --git a/projects/atlendis/index.js b/projects/atlendis/index.js index 41fb982d4ca..6b326d26f78 100644 --- a/projects/atlendis/index.js +++ b/projects/atlendis/index.js @@ -1,6 +1,6 @@ const { GraphQLClient, gql } = require('graphql-request') const { transformPolygonAddress } = require('../helper/portedTokens'); -const { getBlock } = require('../helper/getBlock') +const { getBlock } = require('../helper/http') const sdk = require('@defillama/sdk') diff --git a/projects/atomic/index.js b/projects/atomic/index.js new file mode 100644 index 00000000000..2df5412b647 --- /dev/null +++ b/projects/atomic/index.js @@ -0,0 +1,35 @@ +const Lendings = [ + "0x561920028545985c60fb93d48717ff0070cb4e74", + "0xBAE99752dA245089698Bc1b5F0a14eAE91694FBc", + "0xc1b677039892C048f2eFb7E9C5da1B51fDE92504" +]; + +async function tvl(_, _1, _2, { api }) { + const balances = {}; + + const collateralBalance = await api.multiCall({ + abi: "uint256:totalSupplied", + calls: Lendings.map(i => ({ target: i })) + }); + + const lendingTokens = await api.multiCall({ + abi: "address:token", + calls: Lendings.map(i => ({ target: i })) + }); + + + for (let i = 0; i < collateralBalance.length; i++) { + balances[`arbitrum:${lendingTokens[i]}`] = collateralBalance[i]; + } + + return balances; +} + +module.exports = { + misrepresentedTokens: false, + arbitrum: { + tvl + } +}; + + diff --git a/projects/auctus/abi.json b/projects/auctus/abi.json index d3bfbb2ca59..f2af95d0b0c 100644 --- a/projects/auctus/abi.json +++ b/projects/auctus/abi.json @@ -1,54 +1,6 @@ { - "collateral": { - "inputs": [], - "name": "collateral", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "totalCollateral": { - "inputs": [], - "name": "totalCollateral", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "balance":{ - "inputs": [], - "name": "balance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "token": { - "inputs": [], - "name": "token", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } + "collateral": "address:collateral", + "totalCollateral": "uint256:totalCollateral", + "balance": "uint256:balance", + "token": "address:token" } \ No newline at end of file diff --git a/projects/auctus/index.js b/projects/auctus/index.js index e6347cb0ac6..300b5f3d750 100644 --- a/projects/auctus/index.js +++ b/projects/auctus/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') /*================================================== Modules ==================================================*/ @@ -6,12 +7,13 @@ const abi = require('./abi.json'); const { default: BigNumber } = require('bignumber.js'); + const { getLogs } = require('../helper/cache/getLogs') const START_BLOCK = 10104891; const FACTORY = '0x176b98ab38d1aE8fF3F30bF07f9B93E26F559C17'; const POOLS_FACTORY = '0xe28520DDB1b419Ac37eCDBB2c0F97c8Cf079CCC3'; const VAULTS = '0x2Ce43b4570Ad9DEAb8CFE6258B42DB7301e3b6C0'; - const ETHER_ADDRESS = '0x0000000000000000000000000000000000000000'; + const ETHER_ADDRESS = ADDRESSES.null; /*================================================== TVL @@ -26,39 +28,35 @@ const getUnderlyingAddressFromNewAcoPoolLogData = data => '0x' + data.substring(26, 66); const getStrikeAssetAddressFromNewAcoPoolLogData = data => '0x' + data.substring(26, 66); - async function tvl(timestamp, block) { + async function tvl(timestamp, block, _, { api }) { var logsPromises = await Promise.all([ - sdk.api.util.getLogs({ - keys: [], - toBlock: block, + getLogs({ + api, target: FACTORY, fromBlock: START_BLOCK, topic: 'NewAcoToken(address,address,bool,uint256,uint256,address,address)', }), - sdk.api.util.getLogs({ - keys: [], - toBlock: block, + getLogs({ + api, target: FACTORY, fromBlock: START_BLOCK, topic: 'NewAcoTokenData(address,address,bool,uint256,uint256,address,address,address)', }), - sdk.api.util.getLogs({ - keys: [], - toBlock: block, + getLogs({ + api, target: POOLS_FACTORY, fromBlock: START_BLOCK, topic: 'NewAcoPool(address,address,bool,address,address)', }), - sdk.api.util.getLogs({ - keys: [], - toBlock: block, + getLogs({ + api, target: VAULTS, fromBlock: START_BLOCK, topic: 'AcoVault(address,bool)', }) ]) - const logs = logsPromises[0].output; + const logs = logsPromises[0]; let acoOptionsAddresses = []; logs.forEach((log) => { @@ -66,7 +64,7 @@ acoOptionsAddresses.push(address) }); - const logs2 = logsPromises[1].output; + const logs2 = logsPromises[1]; logs2.forEach((log) => { const address = getTokenAddressFromNewAcoTokenLogData(log.data); acoOptionsAddresses.push(address) @@ -106,7 +104,7 @@ balances[colateralAddress] = existingBalance.plus(new BigNumber(result.output)).toFixed() }); - const newAcoPoolLogs = logsPromises[2].output; + const newAcoPoolLogs = logsPromises[2]; let acoPools = {}; newAcoPoolLogs.forEach((log) => { @@ -143,7 +141,7 @@ })) ); - const setVaultLog = logsPromises[3].output; + const setVaultLog = logsPromises[3]; let acoVaultsAddresses = []; setVaultLog.forEach((log) => { diff --git a/projects/augmented-finance/abi.json b/projects/augmented-finance/abi.json deleted file mode 100644 index f461f6d156a..00000000000 --- a/projects/augmented-finance/abi.json +++ /dev/null @@ -1,230 +0,0 @@ -[ - { - "inputs": [ - { - "internalType": "address", - "name": "user", - "type": "address" - } - ], - "name": "getReservesData", - "outputs": [ - { - "components": [ - { - "internalType": "address", - "name": "underlyingAsset", - "type": "address" - }, - { - "internalType": "address", - "name": "pricingAsset", - "type": "address" - }, - { - "internalType": "string", - "name": "name", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol", - "type": "string" - }, - { - "internalType": "uint256", - "name": "decimals", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "baseLTVasCollateral", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "reserveLiquidationThreshold", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "reserveLiquidationBonus", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "reserveFactor", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "usageAsCollateralEnabled", - "type": "bool" - }, - { - "internalType": "bool", - "name": "borrowingEnabled", - "type": "bool" - }, - { - "internalType": "bool", - "name": "stableBorrowRateEnabled", - "type": "bool" - }, - { - "internalType": "bool", - "name": "isActive", - "type": "bool" - }, - { - "internalType": "bool", - "name": "isFrozen", - "type": "bool" - }, - { - "internalType": "uint128", - "name": "liquidityIndex", - "type": "uint128" - }, - { - "internalType": "uint128", - "name": "variableBorrowIndex", - "type": "uint128" - }, - { - "internalType": "uint128", - "name": "liquidityRate", - "type": "uint128" - }, - { - "internalType": "uint128", - "name": "variableBorrowRate", - "type": "uint128" - }, - { - "internalType": "uint128", - "name": "stableBorrowRate", - "type": "uint128" - }, - { - "internalType": "uint40", - "name": "lastUpdateTimestamp", - "type": "uint40" - }, - { - "internalType": "address", - "name": "depositTokenAddress", - "type": "address" - }, - { - "internalType": "address", - "name": "stableDebtTokenAddress", - "type": "address" - }, - { - "internalType": "address", - "name": "variableDebtTokenAddress", - "type": "address" - }, - { - "internalType": "address", - "name": "strategy", - "type": "address" - }, - { - "internalType": "bool", - "name": "isExternalStrategy", - "type": "bool" - }, - { - "internalType": "uint256", - "name": "availableLiquidity", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalPrincipalStableDebt", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "averageStableRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalStableDebt", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "stableDebtLastUpdateTimestamp", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalScaledVariableDebt", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "priceInEth", - "type": "uint256" - } - ], - "internalType": "struct IUiPoolDataProvider.AggregatedReserveData[]", - "name": "", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "address", - "name": "underlyingAsset", - "type": "address" - }, - { - "internalType": "uint256", - "name": "scaledDepositTokenBalance", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "usageAsCollateralEnabledOnUser", - "type": "bool" - }, - { - "internalType": "uint256", - "name": "stableBorrowRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "scaledVariableDebt", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "principalStableDebt", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "stableBorrowLastUpdateTimestamp", - "type": "uint256" - } - ], - "internalType": "struct IUiPoolDataProvider.UserReserveData[]", - "name": "", - "type": "tuple[]" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -] \ No newline at end of file diff --git a/projects/augmented-finance/index.js b/projects/augmented-finance/index.js index 8c9db62fc0f..ff4618c8565 100644 --- a/projects/augmented-finance/index.js +++ b/projects/augmented-finance/index.js @@ -1,77 +1,36 @@ const sdk = require('@defillama/sdk'); -const abi = require('./abi.json'); - -const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000'; -const DATA_PROVIDERS = { - ETHEREUM: '0x8F5273c5aa638e946BC5dD2171Ae9E9184C75228', - BSC: '0xa450547F27F0947760C9C818d9fd2CD51DFA7441', - AVALANCHE: '0x483B76b13B14DB4fF49359aF9DF3A51F25FaB6a0', - XDAI: '0x75e5cF901f3A576F72AB6bCbcf7d81F1619C6a12', -}; - -/** - * Get TVL for chain - * Available chains: arbitrum, avax, fantom, polygon, xdai, bsc, ethereum - */ -function _tvlByChain(chainName, dataProviderAddress) { - return async function tvl(timestamp, ethBlock, chainBlocks) { - const block = chainBlocks[chainName]; - const transform = address => `${chainName}:${address}` - const {output: reservesData} = await sdk.api.abi.call({ - target: dataProviderAddress, - abi: abi.find(abi => abi.name === 'getReservesData'), - params: [ZERO_ADDRESS], - block, - chain: chainName, - }); - - const [reserves] = reservesData; - const totalSupply = await sdk.api.abi.multiCall({ - abi: 'erc20:totalSupply', - calls: reserves.map(reserve => ({target: reserve.depositTokenAddress})), - block, - chain: chainName, - }); - - let balances = {}; - totalSupply.output.forEach((call, index) => { - const tokenAddress = reserves[index].underlyingAsset; - const tokenBalance = call.output; - - sdk.util.sumSingleBalance(balances, transform(tokenAddress), tokenBalance); - }) - - if ('bsc:0x85EAC5Ac2F758618dFa09bDbe0cf174e7d574D5B' in balances) { - balances['tron'] = balances['bsc:0x85EAC5Ac2F758618dFa09bDbe0cf174e7d574D5B'] / 10 ** 18; - delete balances['bsc:0x85EAC5Ac2F758618dFa09bDbe0cf174e7d574D5B']; - } - if ('0x8E16bf47065Fe843A82f4399bAF5aBac4E0822B7' in balances) { - balances['filecoin'] = balances['0x8E16bf47065Fe843A82f4399bAF5aBac4E0822B7'] / 10 ** 18; - delete balances['0x8E16bf47065Fe843A82f4399bAF5aBac4E0822B7']; - } - - return balances; - } +const { nullAddress } = require('../helper/unwrapLPs') +const abi = { "inputs": [{ "internalType": "address", "name": "user", "type": "address" }], "name": "getReservesData", "outputs": [{ "components": [{ "internalType": "address", "name": "underlyingAsset", "type": "address" }, { "internalType": "address", "name": "pricingAsset", "type": "address" }, { "internalType": "string", "name": "name", "type": "string" }, { "internalType": "string", "name": "symbol", "type": "string" }, { "internalType": "uint256", "name": "decimals", "type": "uint256" }, { "internalType": "uint256", "name": "baseLTVasCollateral", "type": "uint256" }, { "internalType": "uint256", "name": "reserveLiquidationThreshold", "type": "uint256" }, { "internalType": "uint256", "name": "reserveLiquidationBonus", "type": "uint256" }, { "internalType": "uint256", "name": "reserveFactor", "type": "uint256" }, { "internalType": "bool", "name": "usageAsCollateralEnabled", "type": "bool" }, { "internalType": "bool", "name": "borrowingEnabled", "type": "bool" }, { "internalType": "bool", "name": "stableBorrowRateEnabled", "type": "bool" }, { "internalType": "bool", "name": "isActive", "type": "bool" }, { "internalType": "bool", "name": "isFrozen", "type": "bool" }, { "internalType": "uint128", "name": "liquidityIndex", "type": "uint128" }, { "internalType": "uint128", "name": "variableBorrowIndex", "type": "uint128" }, { "internalType": "uint128", "name": "liquidityRate", "type": "uint128" }, { "internalType": "uint128", "name": "variableBorrowRate", "type": "uint128" }, { "internalType": "uint128", "name": "stableBorrowRate", "type": "uint128" }, { "internalType": "uint40", "name": "lastUpdateTimestamp", "type": "uint40" }, { "internalType": "address", "name": "depositTokenAddress", "type": "address" }, { "internalType": "address", "name": "stableDebtTokenAddress", "type": "address" }, { "internalType": "address", "name": "variableDebtTokenAddress", "type": "address" }, { "internalType": "address", "name": "strategy", "type": "address" }, { "internalType": "bool", "name": "isExternalStrategy", "type": "bool" }, { "internalType": "uint256", "name": "availableLiquidity", "type": "uint256" }, { "internalType": "uint256", "name": "totalPrincipalStableDebt", "type": "uint256" }, { "internalType": "uint256", "name": "averageStableRate", "type": "uint256" }, { "internalType": "uint256", "name": "totalStableDebt", "type": "uint256" }, { "internalType": "uint256", "name": "stableDebtLastUpdateTimestamp", "type": "uint256" }, { "internalType": "uint256", "name": "totalScaledVariableDebt", "type": "uint256" }, { "internalType": "uint256", "name": "priceInEth", "type": "uint256" }], "internalType": "struct IUiPoolDataProvider.AggregatedReserveData[]", "name": "", "type": "tuple[]" }, { "components": [{ "internalType": "address", "name": "underlyingAsset", "type": "address" }, { "internalType": "uint256", "name": "scaledDepositTokenBalance", "type": "uint256" }, { "internalType": "bool", "name": "usageAsCollateralEnabledOnUser", "type": "bool" }, { "internalType": "uint256", "name": "stableBorrowRate", "type": "uint256" }, { "internalType": "uint256", "name": "scaledVariableDebt", "type": "uint256" }, { "internalType": "uint256", "name": "principalStableDebt", "type": "uint256" }, { "internalType": "uint256", "name": "stableBorrowLastUpdateTimestamp", "type": "uint256" }], "internalType": "struct IUiPoolDataProvider.UserReserveData[]", "name": "", "type": "tuple[]" }, { "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" } + +const config = { + ethereum: '0x8F5273c5aa638e946BC5dD2171Ae9E9184C75228', + bsc: '0xa450547F27F0947760C9C818d9fd2CD51DFA7441', + avax: '0x483B76b13B14DB4fF49359aF9DF3A51F25FaB6a0', + xdai: '0x75e5cF901f3A576F72AB6bCbcf7d81F1619C6a12', } -const ethereum = _tvlByChain('ethereum', DATA_PROVIDERS.ETHEREUM); -const bsc = _tvlByChain('bsc', DATA_PROVIDERS.BSC); -const avalanche = _tvlByChain('avax', DATA_PROVIDERS.AVALANCHE); -const xdai = _tvlByChain('xdai', DATA_PROVIDERS.XDAI); - module.exports = { - start: 13339609, // Oct-02-2021 11:33:05 AM +UTC - ethereum: { - tvl: ethereum, - }, - bsc: { - tvl: bsc, - }, - avax:{ - tvl: avalanche, + methodology: "Counts the tokens locked in the contracts to be used as collateral to borrow or to earn yield. Borrowed coins are not counted towards the TVL, so only the coins actually locked in the contracts are counted. There's multiple reasons behind this but one of the main ones is to avoid inflating the TVL through cycled lending.", +}; + +Object.keys(config).forEach(chain => { + const provider = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const balances = {} + const data = await api.call({ abi, target: provider, params: nullAddress }) + data[0].forEach(i => { + sdk.util.sumSingleBalance(balances, i.underlyingAsset, i.availableLiquidity, chain) + }) + return balances }, - xdai: { - tvl: xdai, + borrowed: async (_, _b, _cb, { api, }) => { + const balances = {} + const data = await api.call({ abi, target: provider, params: nullAddress }) + data[0].forEach(i => { + sdk.util.sumSingleBalance(balances, i.underlyingAsset, +i.totalPrincipalStableDebt + +i.totalScaledVariableDebt, chain) + }) + return balances }, - methodology: "Counts the tokens locked in the contracts to be used as collateral to borrow or to earn yield. Borrowed coins are not counted towards the TVL, so only the coins actually locked in the contracts are counted. There's multiple reasons behind this but one of the main ones is to avoid inflating the TVL through cycled lending.", -} + } +}) diff --git a/projects/augur/index.js b/projects/augur/index.js index c50490c14e8..b04181bee36 100644 --- a/projects/augur/index.js +++ b/projects/augur/index.js @@ -1,6 +1,7 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk'); -const dai = '0x6b175474e89094c44da98b954eedeac495271d0f' +const dai = ADDRESSES.ethereum.DAI const universe = '0x49244bd018ca9fd1f06ecc07b9e9de773246e5aa' const delegator = '0xd5524179cB7AE012f5B642C1D6D700Bbaa76B96b' @@ -16,7 +17,7 @@ async function tvl(timestamp, block) { }) return { - '0x0000000000000000000000000000000000000000': ethBalance.output, + [ADDRESSES.null]: ethBalance.output, [dai]: daiBalance.output } } diff --git a/projects/auguryfinance/abi.json b/projects/auguryfinance/abi.json index e72eca4ff96..746aa3595d9 100644 --- a/projects/auguryfinance/abi.json +++ b/projects/auguryfinance/abi.json @@ -1,54 +1,4 @@ { - "poolInfo": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "poolInfo", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "lpToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "allocPoint", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastRewardBlock", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accOmenPerShare", - "type": "uint256" - }, - { - "internalType": "uint16", - "name": "depositFeeBP", - "type": "uint16" - } - ], - "stateMutability": "view", - "type": "function" - }, - "poolLength": { - "inputs": [], - "name": "poolLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } + "poolInfo": "function poolInfo(uint256) view returns (address lpToken, uint256 allocPoint, uint256 lastRewardBlock, uint256 accOmenPerShare, uint16 depositFeeBP)", + "poolLength": "uint256:poolLength" } \ No newline at end of file diff --git a/projects/auguryfinance/index.js b/projects/auguryfinance/index.js index d94b0a28fe0..0693db6b8d8 100644 --- a/projects/auguryfinance/index.js +++ b/projects/auguryfinance/index.js @@ -1,5 +1,4 @@ const sdk = require("@defillama/sdk"); -const utils = require("../helper/utils"); const abi = require("./abi.json"); const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); const { transformPolygonAddress } = require("../helper/portedTokens"); @@ -76,52 +75,9 @@ const polygonTvl = async (timestamp, ethBlock, chainBlocks) => { return balances; }; -// ----- Treasury TVL ----- -const treasuryTvl = async (timestamp, ethBlock, chainBlocks) => { - const balances = {}; - - const DeveloperTeamWallet = "0xE2E26BAc2ff37A7aE219EcEF74C5A1Bf95d5f854"; - - /*** Tokens aren't in the file matic.json that exit in GitHub respository of the protocol ***/ - const amWMATIC = "0x8df3aad3a84da6b69a4da8aec3ea40d9091b2ac4"; - const OMEN = "0x76e63a3E7Ba1e2E61D3DA86a87479f983dE89a7E"; - const QUICK = "0x831753dd7087cac61ab5644b308642cc1c33dc13"; - - const tokens_polygon = ( - await utils.fetchURL( - "https://raw.githubusercontent.com/augury-finance/default-token-list/master/tokens/matic.json" - ) - ).data.map((tokenAddress) => tokenAddress.address).filter(token => token !== "0xaaAEBE6Fe48E54f431b0C390CfaF0b017d09D42d"); - - tokens_polygon.push(amWMATIC, OMEN, QUICK); - - const balanceTreasury = ( - await sdk.api.abi.multiCall({ - abi: 'erc20:balanceOf', - calls: tokens_polygon.map((tp) => ({ - target: tp, - params: DeveloperTeamWallet, - })), - chain: "polygon", - block: chainBlocks["polygon"], - }) - ).output.map((lp) => lp.output); - - for (let index = 0; index < tokens_polygon.length; index++) { - sdk.util.sumSingleBalance( - balances, - `polygon:${tokens_polygon[index]}`, - balanceTreasury[index] - ); - } - - return balances; -}; - module.exports = { methodology: 'MasterAugur(MasterChef) contract is used to pull LP token amounts. LP tokens are unwrapped and each token token balance is considered in the TVL sum.', polygon: { tvl: polygonTvl, - treasury: treasuryTvl }, }; diff --git a/projects/aura-finance/abi.json b/projects/aura-finance/abi.json index aa839176175..134196ea4fc 100644 --- a/projects/aura-finance/abi.json +++ b/projects/aura-finance/abi.json @@ -1,82 +1,6 @@ { - "poolLength": { - "inputs": [], - "name": "poolLength", - "outputs": [{ - "internalType": "uint256", - "name": "", - "type": "uint256" - }], - "stateMutability": "view", - "type": "function" - }, - "poolInfo": { - "inputs": [{ - "internalType": "uint256", - "name": "", - "type": "uint256" - }], - "name": "poolInfo", - "outputs": [{ - "internalType": "address", - "name": "lptoken", - "type": "address" - }, { - "internalType": "address", - "name": "token", - "type": "address" - }, { - "internalType": "address", - "name": "gauge", - "type": "address" - }, { - "internalType": "address", - "name": "crvRewards", - "type": "address" - }, { - "internalType": "address", - "name": "stash", - "type": "address" - }, { - "internalType": "bool", - "name": "shutdown", - "type": "bool" - }], - "stateMutability": "view", - "type": "function" - }, - "getPoolId": { - "inputs": [], - "name": "getPoolId", - "outputs": [{ - "internalType": "bytes32", - "name": "", - "type": "bytes32" - }], - "stateMutability": "view", - "type": "function" - }, - "getPoolTokens": { - "inputs": [{ - "internalType": "bytes32", - "name": "poolId", - "type": "bytes32" - }], - "name": "getPoolTokens", - "outputs": [{ - "internalType": "contract IERC20[]", - "name": "tokens", - "type": "address[]" - }, { - "internalType": "uint256[]", - "name": "balances", - "type": "uint256[]" - }, { - "internalType": "uint256", - "name": "lastChangeBlock", - "type": "uint256" - }], - "stateMutability": "view", - "type": "function" - } + "poolLength": "uint256:poolLength", + "poolInfo": "function poolInfo(uint256) view returns (address lptoken, address token, address gauge, address crvRewards, address stash, bool shutdown)", + "getPoolId": "function getPoolId() view returns (bytes32)", + "getPoolTokens": "function getPoolTokens(bytes32 poolId) view returns (address[] tokens, uint256[] balances, uint256 lastChangeBlock)" } \ No newline at end of file diff --git a/projects/aura-finance/index.js b/projects/aura-finance/index.js index 5c950bec3b8..fca63047ec3 100644 --- a/projects/aura-finance/index.js +++ b/projects/aura-finance/index.js @@ -1,10 +1,11 @@ +const { getLogs } = require('../helper/cache/getLogs') const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); const { staking } = require("../helper/staking"); -const BigNumber = require('bignumber.js') -const { unwrapBalancerPool } = require('../helper/unwrapLPs') +const { unwrapBalancerToken } = require('../helper/unwrapLPs') const AURA_BOOSTER = "0x7818A1DA7BD1E64c199029E86Ba244a9798eEE10" +const AURA_BOOSTER_2 = "0xA57b8d98dAE62B26Ec3bcC4a365338157060B234" const BALANCER_VAULT = "0xBA12222222228d8Ba445958a75a0704d566BF2C8" const addresses = { aura: "0xc0c293ce456ff0ed870add98a0828dd4d2903dbf", @@ -14,75 +15,86 @@ const addresses = { auraDelegate: "0xaF52695E1bB01A16D33D7194C28C42b10e0Dbec2", bal80eth20: "0x5c6Ee304399DBdB9C8Ef030aB642B10820DB8F56", }; -async function tvl(_, block) { - const poolLength = (await sdk.api.abi.call({ - target: AURA_BOOSTER, - abi: abi.poolLength, - block: block, - }) - ).output; - const pools = (await sdk.api.abi.multiCall({ - calls: Array.from({ length: Number(poolLength) }, (_, poolId) => ({ - target: AURA_BOOSTER, - params: poolId, - })), - abi: abi.poolInfo, - block: block, - })).output - const poolIds = (await sdk.api.abi.multiCall({ - calls: pools.map(pool => ({target: pool.output.lptoken})), - abi: abi.getPoolId, - block, - })).output; - const poolTokensInfo = (await sdk.api.abi.multiCall({ - calls: poolIds.map(poolId => ({target: BALANCER_VAULT, params: poolId.output})), - abi: abi.getPoolTokens, - block - })).output; - const balancesinStaking = (await sdk.api.abi.multiCall({ - calls: pools.map(pool => ({target: pool.output.token, params:pool.output.crvRewards })), - abi: 'erc20:balanceOf', - block - })).output; - const totalSupplies = (await sdk.api.abi.multiCall({ - calls: pools.map(pool => ({target: pool.output.lptoken})), - abi: 'erc20:totalSupply', - block - })).output; - let balances = {} - const { output: veBalTotalSupply } = await sdk.api.erc20.totalSupply({ target: addresses.veBal, block }) - const { output: veBalance } = await sdk.api.erc20.balanceOf({ target: addresses.veBal, owner: addresses.auraDelegate, block }) - const ratio = veBalance / veBalTotalSupply - const bal = await unwrapBalancerPool({ block, balancerPool: addresses.bal80eth20, owner: addresses.veBal, }) - Object.entries(bal).forEach(([token, value]) => { - const newValue = BigNumber(+value * ratio).toFixed(0) - sdk.util.sumSingleBalance(balances, token, newValue) + +async function tvl(_, block, _1, { api }) { + let pools = await Promise.all([AURA_BOOSTER, AURA_BOOSTER_2].map(i => api.fetchList({ target: i, itemAbi: abi.poolInfo, lengthAbi: abi.poolLength, }))) + pools = pools.flat() + const poolInputs = pools.map(pool => pool.lptoken) + const poolIds = await api.multiCall({ calls: poolInputs, abi: abi.getPoolId, permitFailure: true, }) + + + let failedCallIndices = poolIds.map((v, i) => [i, v]).filter(i => !i[1]).map(i => i[0]) + let newPoolIds = await api.multiCall({ calls: failedCallIndices.map(i => poolInputs[i]), abi: 'function POOL_ID() view returns (bytes32)', permitFailure: true, }) + newPoolIds.forEach((v, i) => { if (v) poolIds[failedCallIndices[i]] = v }) + + failedCallIndices = poolIds.map((v, i) => [i, v]).filter(i => !i[1]).map(i => i[0]) + const newLpTokens = await api.multiCall({ calls: failedCallIndices.map(i => poolInputs[i]), abi: 'address:lp_token', permitFailure: true, }) + newPoolIds = await api.multiCall({ calls: newLpTokens.map(i => ({ target: i })), abi: abi.getPoolId, permitFailure: true, }) + newPoolIds.forEach((v, i) => { if (v) poolIds[failedCallIndices[i]] = v }) + + + const poolTokensInfo = await api.multiCall({ calls: poolIds.map(poolId => ({ target: BALANCER_VAULT, params: poolId })), abi: abi.getPoolTokens, }) + const balancesinStaking = await api.multiCall({ calls: pools.map(pool => ({ target: pool.token, params: pool.crvRewards })), abi: 'erc20:balanceOf', }) + const totalSupplies = await api.multiCall({ calls: pools.map(pool => pool.lptoken), abi: 'erc20:totalSupply', }) + const { output: veBalTotalSupply } = await sdk.api.erc20.totalSupply({ target: addresses.veBal, block }) + const { output: veBalance } = await sdk.api.erc20.balanceOf({ target: addresses.veBal, owner: addresses.auraDelegate, block }) + const ratio = veBalance / veBalTotalSupply + const ratios = balancesinStaking.map((v, i) => +totalSupplies[i] > 0 ? v / totalSupplies[i] : 0) + const bal = await unwrapBalancerToken({ api, balancerToken: addresses.bal80eth20, owner: addresses.veBal, }) + Object.entries(bal).forEach(([token, value]) => { + api.add(token, +value * ratio, { skipChain: true, }) + }) + for (let [i, info] of poolTokensInfo.entries()) { + // // unwrapBalancerToken would be better here, but since crvRewards address holds aura-wrapped tokens, it won't work + // if (poolIds[i] == "0x3dd0843a028c86e0b760b1a76929d1c5ef93a2dd000200000000000000000249") { + // // Pool is 80BAL-20ETH/auraBAL, need to unwrap 80BAL-20ETH + // const unwrapped = await unwrapBalancerToken({ block: api.block, balancerPool: addresses.bal80eth20, owner: BALANCER_VAULT }) + // Object.entries(unwrapped).forEach(([token, balance]) => { + // api.add(token, balance * ratio) + // }) + // } else { + info.tokens.forEach((token, j) => { + api.add(token, info.balances[j] * ratios[i]) }) - for (let [i,info] of poolTokensInfo.entries()) { - // unwrapBalancerPool would be better here, but since crvRewards address holds aura-wrapped tokens, it won't work - const result = Object.assign.apply({}, info.output.tokens.map( (v, i) => ( {[v]: info.output.balances[i]} ) ) ); - const totalSupply = BigNumber(totalSupplies[i].output); - const stakedBalance = BigNumber(balancesinStaking[i].output); - const ratio = stakedBalance.div(totalSupply) - if (info.input.params[0] == "0x3dd0843a028c86e0b760b1a76929d1c5ef93a2dd000200000000000000000249") { - // Pool is 80BAL-20ETH/auraBAL, need to unwrap 80BAL-20ETH - const unwrapped = await unwrapBalancerPool({block, balancerPool: addresses.bal80eth20, owner:BALANCER_VAULT}) - Object.entries(unwrapped).forEach(([token, balance]) => { - balances[token] = BigNumber(balances[token] || 0).plus(BigNumber(balance).times(ratio)) - }) - } - Object.entries(result).forEach(([token, balance]) => { - balances[token] = BigNumber(balances[token] || 0).plus(BigNumber(balance).times(ratio)) - }) - } - return balances + // } + } +} +const config = { + arbitrum: { factory: '0x6817149cb753bf529565b4d023d7507ed2ff4bc0', fromBlock: 72942741, voterProxy: '0xc181edc719480bd089b94647c2dc504e2700a2b0'}, + optimism: { factory: '0xa523f47A933D5020b23629dDf689695AA94612Dc', fromBlock: 83239534, voterProxy: '0xc181edc719480bd089b94647c2dc504e2700a2b0'}, + polygon: { factory: '0x22625eedd92c81a219a83e1dc48f88d54786b017', fromBlock: 40687417, voterProxy: '0xC181Edc719480bd089b94647c2Dc504e2700a2B0'}, } + module.exports = { - timetravel: true, - methodology: "TVL of Aura Finance consists of the total deposited assets, protocol-controlled value via veBAL and vote-locked AURA (staking)", - ethereum: { - tvl, - staking: staking(addresses.auraLocker, addresses.aura) + methodology: "TVL of Aura Finance consists of the total deposited assets, protocol-controlled value via veBAL and vote-locked AURA (staking)", + ethereum: { + tvl, + staking: staking(addresses.auraLocker, addresses.aura) + } +} + +Object.keys(config).forEach(chain => { + const { factory, fromBlock, voterProxy, } = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const logs = await getLogs({ + api, + target: factory, + topics: ['0xaa98436d09d130af48de49867af8b723bbbebb0d737638b5fe8f1bf31bbb71c0'], + eventAbi: 'event GaugeCreated (address indexed gauge)', + onlyArgs: true, + fromBlock, + }) + + // const auraBalVault = '0x4EA9317D90b61fc28C418C247ad0CA8939Bbb0e9' + // const asset = await api.call({ abi: 'address:asset', target: auraBalVault }) + // const bal = await api.call({ abi: 'uint256:totalAssets', target: auraBalVault }) + // api.add(asset, bal) + const gauges = logs.map(log => log.gauge) + const tokens = await api.multiCall({ abi: 'address:lp_token', calls: gauges }) + const bals = await api.multiCall({ abi: 'erc20:balanceOf', calls: gauges.map(i => ({ target: i, params: voterProxy })) }) + api.addTokens(tokens, bals) } -} \ No newline at end of file + } +}) diff --git a/projects/auragi-finance/index.js b/projects/auragi-finance/index.js new file mode 100644 index 00000000000..9f8b9e44aa8 --- /dev/null +++ b/projects/auragi-finance/index.js @@ -0,0 +1,12 @@ +const { getUniTVL } = require('../helper/unknownTokens.js') + +module.exports = { + misrepresentedTokens: true, + arbitrum:{ + tvl: getUniTVL({ + useDefaultCoreAssets: true, + hasStablePools: true, + factory: '0xa36b55DBe8e83Eb69C686368cF93ABC8A238CC5f', + }), + }, +} diff --git a/projects/auraswap/index.js b/projects/auraswap/index.js index 87bf26e1744..21dce941f42 100644 --- a/projects/auraswap/index.js +++ b/projects/auraswap/index.js @@ -1,22 +1,13 @@ -const sdk = require("@defillama/sdk"); -const {calculateUniTvl} = require('../helper/calculateUniTvl.js'); +const { uniTvlExport } = require('../helper/calculateUniTvl.js'); const { staking } = require("../helper/staking.js"); const AURA_TOKEN = '0x1b7805e2829fd7D194DCc3078a4199b13c77E467' const MASTER_CHEF = '0x44Bb1a3E56Cb12b7B1a8E925f09A170e3646346d' const FACTORY_POLYGON = "0x015DE3ec460869eb5ceAe4224Dc7112ac0a39303"; - -async function polygonTvl(timestamp, block, chainBlocks) { - return calculateUniTvl(addr=>`polygon:${addr}`, chainBlocks['polygon'], 'polygon', FACTORY_POLYGON, 0, true); -} - - module.exports = { - timetravel: true, - doublecounted: false, - polygon:{ - tvl: polygonTvl, - staking: staking(MASTER_CHEF, AURA_TOKEN, "polygon"), + polygon: { + tvl: uniTvlExport(FACTORY_POLYGON, 'polygon', true), + staking: staking(MASTER_CHEF, AURA_TOKEN, "polygon"), }, } \ No newline at end of file diff --git a/projects/aurora-plus/index.js b/projects/aurora-plus/index.js index 01573ac9f43..394fc0166c5 100644 --- a/projects/aurora-plus/index.js +++ b/projects/aurora-plus/index.js @@ -1,6 +1,7 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { staking } = require("../helper/staking"); -const AURORA = "0x8bec47865ade3b172a928df8f990bc7f2a3b9f79"; +const AURORA = ADDRESSES.aurora.AURORA; const stakingContract = "0xf075c896cbbb625e7911e284cd23ee19bdccf299"; module.exports = { diff --git a/projects/auroraswap/index.js b/projects/auroraswap/index.js index 196621ab22b..e89758a348d 100644 --- a/projects/auroraswap/index.js +++ b/projects/auroraswap/index.js @@ -1,23 +1,11 @@ const { staking } = require("../helper/staking"); -const { calculateUniTvl } = require("../helper/calculateUniTvl"); +const { uniTvlExport } = require("../helper/calculateUniTvl"); const masterchefAddress = "0x35CC71888DBb9FfB777337324a4A60fdBAA19DDE"; const brlTokenAddress = "0x12c87331f086c3C926248f964f8702C0842Fd77F"; -const tvl = async (timestamp, ethBlock, chainBlocks) => { - const balances = await calculateUniTvl( - (addr) => `aurora:${addr}`, - chainBlocks.aurora, - "aurora", - "0xC5E1DaeC2ad401eBEBdd3E32516d90Ab251A3aA3", - 0, - true - ); - return balances; -}; - module.exports = { aurora: { - tvl, + tvl: uniTvlExport('0xC5E1DaeC2ad401eBEBdd3E32516d90Ab251A3aA3', 'aurora', true), staking: staking(masterchefAddress, brlTokenAddress, "aurora"), }, }; diff --git a/projects/autobark/index.js b/projects/autobark/index.js index 27dc8071a2b..76c3acd3db4 100644 --- a/projects/autobark/index.js +++ b/projects/autobark/index.js @@ -1,25 +1,13 @@ const { yieldHelper } = require("../helper/unknownTokens"); -const { get } = require('../helper/http') +const { getConfig } = require('../helper/cache') const chain = "dogechain"; -const tokenAPI = { - "type": "function", - "stateMutability": "view", - "outputs": [ - { - "type": "address", - "name": "", - "internalType": "contract IERC20" - } - ], - "name": "want", - "inputs": [] -} +const tokenAPI = "address:want" module.exports = { [chain]: { tvl: async (_, _b, { [chain]: block }) => { - const pools = await get('https://raw.githubusercontent.com/autobark-finance/autobark-app-pub/main/src/features/config/vault/dogechain_pools.js') + const pools = await getConfig('autobark','https://raw.githubusercontent.com/autobark-finance/autobark-app-pub/main/src/features/config/vault/dogechain_pools.js') const vaults = pools .split('\n') .filter(i => i.includes('earnedTokenAddress')) diff --git a/projects/autocoreDefi/index.js b/projects/autocoreDefi/index.js new file mode 100644 index 00000000000..2569487a270 --- /dev/null +++ b/projects/autocoreDefi/index.js @@ -0,0 +1,38 @@ +const { sumUnknownTokens } = require('../helper/unknownTokens') + +const config = { + core: { + vaults: [ + "0x3132CDD419820f0D00152b95267FA013783e1F27", + "0x88f95f59c0FC1e9857188218F23315ECe6f64CFe", + "0xF71552C9893BDFf01a4a2debaB80E21b6E0e9481", + "0x1D165E1D48177592943275750C7ABeB946D44a6e", + "0x11606ce0D44a62027F6EEb28db7483E5ecB1103f", + "0xe79E557bf863383EB666197e96e73ACEFBf71347", + "0x91C143ED78970a4C3830070c6c1FA38EEc9F8c6E", + "0xE891d51D278518e522148271b65ec3a534012389", + "0xc09849236c5De1317e9a957cF695642285A2A5E2", + "0x0dc152dDC49e0f872489297D6Df0ef3Bb5498FF2", + "0xBafA023c72112ecfc04E661bedb30d9A8e7e08ad", + "0x746f5530FBebDcf984F0D15637f0217eb7cDcE73", + "0x87c98004D1F819fB6354CeD704304a1394Ac1F16", + "0x5D884E045d8F74E3b600c359395A300515b6F574", + "0x1f0c2507C500F24fdd765Dc4025E5c5b40FC33c3" + ] + } +} + +module.exports = { +}; + +Object.keys(config).forEach(chain => { + const { vaults } = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const tokens = await api.multiCall({ abi: 'address:want', calls: vaults }) + const bals = await api.multiCall({ abi: 'uint256:balance', calls: vaults }) + api.addTokens(tokens, bals) + return sumUnknownTokens({ api , useDefaultCoreAssets: true, resolveLP: true, lps: tokens }) + } + } +}) \ No newline at end of file diff --git a/projects/autoearn/index.js b/projects/autoearn/index.js new file mode 100644 index 00000000000..2ee6b6969a8 --- /dev/null +++ b/projects/autoearn/index.js @@ -0,0 +1,29 @@ +const { mergeExports } = require("../helper/utils") +const { yieldHelper, } = require("../helper/yieldHelper") + +const farm_arbi = '0x9373da81F82Aba62605a8A03950B9Aa188a02bF7' +const ate_arbi = '0xd5DA32Ad4C7510457C0e46Fa4332F75f6C4C4dC0' +const abis ={ + poolInfo: 'function poolInfo(uint256) view returns (address want, uint256 allocPoint, uint256 lastRewardBlock, uint256 accSushiPerShare, uint256 accAQUAPerShare, uint256 depositFee, uint256 withdrawFee, uint256 amount, uint256 reserve, address strat, address strat1)', +} + +const arbi_helper = yieldHelper({ + project: 'autoearn-finance', + chain: 'arbitrum', + masterchef: farm_arbi, + nativeToken: ate_arbi, + abis, +}) + +const farm_zk = '0x6d90D891A03C32d4082126D0CEe145f3bE62444A' +const ate_zk = '0x8E6D4473031f4B81E19B13C632933a913d4B4F8e' + +const zk_helper = yieldHelper({ + project: 'autoearn-finance-era', + chain: 'era', + masterchef: farm_zk, + nativeToken: ate_zk, + abis, +}) + +module.exports = mergeExports([arbi_helper, zk_helper]) \ No newline at end of file diff --git a/projects/autoshark/abi.json b/projects/autoshark/abi.json index 9fb79215d69..587a192770f 100644 --- a/projects/autoshark/abi.json +++ b/projects/autoshark/abi.json @@ -1,20 +1,4 @@ { - "allPairsLength": { - "constant": true, - "inputs": [], - "name": "allPairsLength", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "allPairs": { - "constant": true, - "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "name": "allPairs", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "payable": false, - "stateMutability": "view", - "type": "function" - } -} + "allPairsLength": "uint256:allPairsLength", + "allPairs": "function allPairs(uint256) view returns (address)" +} \ No newline at end of file diff --git a/projects/avalaunch/index.js b/projects/avalaunch/index.js index ef0446ed520..fa3acf354c8 100644 --- a/projects/avalaunch/index.js +++ b/projects/avalaunch/index.js @@ -11,7 +11,7 @@ const farm = "0x6E125b68F0f1963b09add1b755049e66f53CC1EA"; async function tvl(){ return {}; -}; +} async function pool2(timestamp, ethBlock, chainBlocks){ const block = chainBlocks.avax; const lpLocked = await sdk.api.erc20.balanceOf({ @@ -26,7 +26,7 @@ async function pool2(timestamp, ethBlock, chainBlocks){ balance: lpLocked.output }], block, 'avax', addr=>`avax:${addr}`); return balances; -}; +} async function staking(timestamp, ethBlock, chainBlocks){ const block = chainBlocks.avax; const balances = await sdk.api.abi.multiCall({ @@ -42,7 +42,7 @@ async function staking(timestamp, ethBlock, chainBlocks){ staking[`avax:${xavaAddress}`] = balances.output.map(b => b.output).reduce((a, b) => Number(a) + Number(b), 0) return staking; -}; +} module.exports={ methodology: "Within pool2, it counts the XAVA-AVAX staked in the farm", diff --git a/projects/avatr/index.js b/projects/avatr/index.js new file mode 100644 index 00000000000..e73fd8cec0b --- /dev/null +++ b/projects/avatr/index.js @@ -0,0 +1,32 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokens2, nullAddress } = require("../helper/unwrapLPs"); +const { getLogs } = require("../helper/cache/getLogs"); +const { staking } = require("../helper/staking"); + +const FACTORY_CONTRACT = "0x498B8f1E767E2A32ab68C1301F1e98b59a34dA94"; +const WETH_ADDRESS = ADDRESSES.ethereum.WETH; + +async function tvl(timestamp, block, chainBlocks, { api }) { + const logs = await getLogs({ + api, + target: FACTORY_CONTRACT, + topics: ["0x489ab9065c597368f4a678fadcb323bf4c848713ea7d5a296d16ec97203eae83",], + eventAbi: "event StakingPoolDeployed(address indexed poolAddress,address indexed stakingToken,uint256 startTime,uint256 roundDurationInDays)", + onlyArgs: true, + fromBlock: 17102070, + }); + + const lsdAddresses = logs.map((i) => i.stakingToken === nullAddress ? WETH_ADDRESS : i.stakingToken); + const poolAddresses = logs.map((i) => i.poolAddress); + + return sumTokens2({ api, tokensAndOwners2: [lsdAddresses, poolAddresses] }); +} + +module.exports = { + hallmarks: [ + [1682726400, "Rug Pull"] + ], + ethereum: { + tvl, + }, +}; diff --git a/projects/avault/abi.json b/projects/avault/abi.json index a359f9b70ef..d8bcf324af7 100644 --- a/projects/avault/abi.json +++ b/projects/avault/abi.json @@ -1,71 +1,7 @@ { - "wantAddress": { - "inputs": [], - "name": "wantAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "wantLockedTotal": { - "inputs": [], - "name": "wantLockedTotal", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "name": { - "inputs": [], - "name": "name", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - "token0": { - "constant": true, - "inputs": [], - "name": "token0", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "token1": { - "constant": true, - "inputs": [], - "name": "token1", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } + "wantAddress": "address:wantAddress", + "wantLockedTotal": "uint256:wantLockedTotal", + "name": "string:name", + "token0": "address:token0", + "token1": "address:token1" } \ No newline at end of file diff --git a/projects/avault/index.js b/projects/avault/index.js index 2e3d235f266..a7a14d47391 100644 --- a/projects/avault/index.js +++ b/projects/avault/index.js @@ -1,41 +1,16 @@ const sdk = require("@defillama/sdk"); const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); const { getChainTransform, getFixBalances } = require("../helper/portedTokens"); -const utils = require("../helper/utils"); +const { getConfig } = require('../helper/cache') + const { vaultsBase } = require("./avault-vault-utils"); const url = "https://www.avault.network/media/get-vaults.json"; async function tvl(_, _b, chainBlocks) { const balances = {}; - const vaultsInfo = (await utils.fetchURL(url)).data; - // const vaultsInfo = { - // astr: { - // aAAA: "0x9a45b203Af044ADACceD4D95ca3cDa020E082c8A", - // aDotUsdc: "0x898BF9C743a436C9C3F332aF445aAd69c15b10b8", - // aDotAstr: "0xE66560C1B5FAaE4e4f77ba40F61F21F4ADbb6924", - // aMuuuAstr: "0x57D942953d416835F7B60bE2A8b49870cc7bcfe1", - // aKglAstr: "0xe7465336BaA2EfBe52e3e67a8B06a97630d76882", - // aLayAstr: "0xc59B9d3ECC93967e697accDbfe9EAB74bB3Fba22", - // aOusdUsdc: "0x40B18bc7AEE5A03515fCf241ad89d548899FB74f", - // aBaiUsdc: "0x5417F117E4A2283623B3b9A07Ec2B2f269d19A75", - // aBaiAstr: "0xC730151a27A4cE6a09d51cFaB115233C2E73D471", - // aNikaAstr: "0x13E01d7Da7b3F211C6972c331DA88c142dF571D8", - // aOruAstr: "0x8f0fD0A3b767a67E992F33063817A2d472EFf74f", - // aJpycAstr: "0x8d90E9C50Af206a2757e09B56160991Dd7548db9", - // aSdnAstr: "0x5F612d4155b1CEdE2a2cda61146834280f706B78", - // aMaticAstr: "0x7D7b744CB50Eb228fe23Bbb29bc5918c507180B7", - // aBnbAstr: "0x6B13DDF4d1E1F2E036619920746318fB79f9EA84", - // aBtcAstr: "0x945bC42819F4F612d07DaBd1d57F10Aac494405f", - // aUsdtAstr: "0x8964FAE92bb4b79D408e9Bd3d48e7C9EcaA5f163", - // aUsdcAstr: "0xDaD1D300E9a6f4f36AeD40213EF473Fd019704E9", - // aEthAstr: "0xDaac872a9098aC5620C9D8eaF2DD50FBABc50Bb1", - // aDaiUsdc: "0x81FbF3A32D600C65B9Df30404C2D372b6c9eE845", - // aBusdUsdc: "0x8552030E314cD15300f75AA93fA8133BB3340E6f", - // aUsdtUsdc: "0x41F97524B5E73575F3848E1983181c0622d10e41", - // }, - // }; + const vaultsInfo = (await getConfig('avault', url)) const chainArr = Object.keys(vaultsInfo); const chain = "astar"; - const chainLocal = chain === "astar" ? "astar" : chainArr[i]; + const chainLocal = chain; const fixBalances = await getFixBalances(chainLocal); const vaultAddressArr = Object.values(vaultsInfo[chainLocal]); const transformAddress = await getChainTransform(chainLocal); @@ -76,6 +51,6 @@ module.exports = { misrepresentedTokens: true, methodology: "Avault - The Best Yield Aggregator on ASTR Network", astar: { - tvl: tvl, + tvl, }, }; diff --git a/projects/avaware/abi.json b/projects/avaware/abi.json index ec36ac26edb..726842c352b 100644 --- a/projects/avaware/abi.json +++ b/projects/avaware/abi.json @@ -1,74 +1,5 @@ { - "poolCount": { - "type": "function", - "stateMutability": "view", - "outputs": [ - { - "type": "uint256", - "name": "", - "internalType": "uint256" - } - ], - "name": "poolCount", - "inputs": [] - }, - "getPool": { - "type": "function", - "stateMutability": "view", - "outputs": [ - { - "type": "tuple", - "name": "", - "internalType": "struct FarmPoolManager.Pool", - "components": [ - { - "type": "address", - "name": "pool", - "internalType": "address" - }, - { - "type": "string", - "name": "name", - "internalType": "string" - }, - { - "type": "uint256", - "name": "rewardAmount", - "internalType": "uint256" - }, - { - "type": "bool", - "name": "legacy", - "internalType": "bool" - }, - { - "type": "bool", - "name": "active", - "internalType": "bool" - } - ] - } - ], - "name": "getPool", - "inputs": [ - { - "type": "uint256", - "name": "id", - "internalType": "uint256" - } - ] - }, - "stakingToken": { - "type": "function", - "stateMutability": "view", - "outputs": [ - { - "type": "address", - "name": "", - "internalType": "contract IERC20" - } - ], - "name": "stakingToken", - "inputs": [] - } + "poolCount": "uint256:poolCount", + "getPool": "function getPool(uint256 id) view returns (tuple(address pool, string name, uint256 rewardAmount, bool legacy, bool active))", + "stakingToken": "address:stakingToken" } \ No newline at end of file diff --git a/projects/avaware/index.js b/projects/avaware/index.js index 380913ce6df..6dc0119e344 100644 --- a/projects/avaware/index.js +++ b/projects/avaware/index.js @@ -2,27 +2,17 @@ const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); const { sumTokens2 } = require("../helper/unwrapLPs"); -const { transformAvaxAddress } = require("../helper/portedTokens"); const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); const FarmPoolManager = "0x7ec4AeaeB57EcD237F35088D11C59525f7D631FE"; const treasuryAddress = "0x9300736E333233F515E585c26A5b868772392709"; const AVE = "0x78ea17559B3D2CF85a7F9C2C704eda119Db5E6dE"; -const malformedLPTokens = [ - '0x75AB49DfF2649b2c7C5d1519fBabA89Ea57a4ef6', - '0x2af262DD90bd2D124E95Fc778D9c85aA03734Ff2', - '0xE5403978fF8AD2B0a007F330f6235F7250F54a6C', - '0x91934e4fA7E2D25DF2FA132a4aAFEFE929751224', - '0xac2d6DBE97de8C0363FfCeA77b701c8Ffc4D2F3b', - '0x00EE200Df31b869a321B10400Da10b561F3ee60d', -].map(token => token.toLowerCase()) - /*** Staking of native token AVE TVL Portion ***/ const staking = async (timestamp, ethBlock, chainBlocks) => { const balances = {}; - const transformAddress = await transformAvaxAddress(); + const transformAddress = addr => 'avax:'+addr; await sumTokensAndLPsSharedOwners( balances, @@ -74,11 +64,10 @@ const avaxTvl = async (timestamp, ethBlock, chainBlocks) => { }) const toa = [] tokens.forEach(({ output, input: { target } }) => toa.push([output, target])) - return sumTokens2({ tokensAndOwners: toa, chain, block, resolveLP: true, }) + return sumTokens2({ tokensAndOwners: toa, chain, block, }) }; module.exports = { - timetravel: true, avax:{ staking, tvl: avaxTvl, diff --git a/projects/avely-finance-staking/index.js b/projects/avely-finance-staking/index.js new file mode 100644 index 00000000000..2c90a7a32ca --- /dev/null +++ b/projects/avely-finance-staking/index.js @@ -0,0 +1,59 @@ +const { + formQuery, + call +} = require('../helper/chain/zilliqa') + +const STZIL_CONTRACT_ADDRESS = 'zil1umc54ly88xjw4599gtq860le0qvsuwuj72s246' +const DECIMALS = 12 + +const tvlFields = { + + //'total_supply' contract field: it's total amount of minted stzil + //https://github.com/avely-finance/avely-contracts/blob/main/contracts/source/stzil.scilla#L355 + // [STZIL_CONTRACT_ADDRESS]: 'total_supply', + + //get 'totalstakeamount' contract field: it's total amount of zil, staked in Zilliqa native staking contract through StZIL contract + //https://github.com/avely-finance/avely-contracts/blob/main/contracts/source/stzil.scilla#L353 + 'zilliqa': 'totalstakeamount', +} + +async function tvl() { + const { api } = arguments[3] + const query = prepareQuery(tvlFields) + + const data = await call(query) + + data.forEach((response) => { + const { id, result } = response + if (!id || !result || !tvlFields[id] || !result[tvlFields[id]]) return + api.add(id, result[tvlFields[id]] / (10 ** DECIMALS), { skipChain: true}) + }) +} + +//prepare batch GetSmartContractSubState query +//https://dev.zilliqa.com/api/contract-related-methods/api-contract-get-smartcontract-substate/ +function prepareQuery(fields) { + const query = Object.entries(fields).map(([id, field]) => { + return formQuery({ + id: id, + params: [ + STZIL_CONTRACT_ADDRESS, + field, + [] + ] + }); + }); + + //console.log(query) + return query; +} + + +module.exports = { + zilliqa: { + tvl + }, + methodology: 'TVL represents the sum of stakes denominated in ZIL and staked in the native Zilliqa staking contract via the STZIL contract', + timetravel: false, +} + diff --git a/projects/avely-finance-swap/index.js b/projects/avely-finance-swap/index.js new file mode 100644 index 00000000000..22c8ce7e8df --- /dev/null +++ b/projects/avely-finance-swap/index.js @@ -0,0 +1,54 @@ +const BigNumber = require('bignumber.js') +const { + formQuery, + call +} = require('../helper/chain/zilliqa') + + +const ASWAP_CONTRACT_ADDRESS = 'zil1uxfzk4n9ef2t3f4c4939ludlvp349uwqdx32xt' +const STZIL_CONTRACT_ADDRESS = 'zil1umc54ly88xjw4599gtq860le0qvsuwuj72s246' +//seems Zilliqa API take address in legacy format as map key +const STZIL_CONTRACT_ADDRESS_LEGACY = '0xe6f14afc8739a4ead0a542c07d3ff978190e3b92' +const DECIMALS = 12 + +async function tvl() { + + //https://dev.zilliqa.com/api/contract-related-methods/api-contract-get-smartcontract-substate/ + const query = formQuery({ + id: "1", + params: [ + ASWAP_CONTRACT_ADDRESS, + 'pools', + [STZIL_CONTRACT_ADDRESS_LEGACY] + ] + }); + //console.log(query) + + const data = await call(query) + //console.log(data) + + //(* POOL token -> Pair{zil_reserve, token_reserve} *) + //https://github.com/avely-finance/avely-contracts/blob/main/contracts/source/aswap.scilla#L301 + const zil_reserve = data?.result?.pools[STZIL_CONTRACT_ADDRESS_LEGACY]?.arguments[0] + const token_reserve = data?.result?.pools[STZIL_CONTRACT_ADDRESS_LEGACY]?.arguments[1] + if (zil_reserve == undefined || token_reserve == undefined) { + return + } + + const balances = { + // [STZIL_CONTRACT_ADDRESS]: BigNumber(token_reserve).shiftedBy(DECIMALS * -1), + 'zilliqa': zil_reserve / 1e12, + } + //console.log(balances) + + return balances +} + +module.exports = { + zilliqa: { + tvl, + }, + methodology: 'TVL represents the state of the Aswap pool, which consists of a single liquidity pair: Zilliqa native token vs StZIL token.', + timetravel: false, + misrepresentedTokens: true, +} diff --git a/projects/axe/index.js b/projects/axe/index.js index 1f19c1a596b..92b63f35320 100644 --- a/projects/axe/index.js +++ b/projects/axe/index.js @@ -1,9 +1,10 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); const { staking } = require("../helper/staking.js"); const treasuryAddresses = ["0xa2039621Cc042567092fAaee89B03Ef959F89712"]; -const DAI = "0x6b175474e89094c44da98b954eedeac495271d0f"; -const USDC = "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"; +const DAI = ADDRESSES.ethereum.DAI; +const USDC = ADDRESSES.ethereum.USDC; const AXEStaking = "0x7f4d186b76a39a2da32804a8c35b3d04e0e174fd"; const AXE = "0x30AC8317DfB0ab4263CD8dB1C4F10749911B126C"; @@ -29,6 +30,9 @@ const AXE_DAI_POOL = "0xd34d3b648db688bee383022dd26a9027592b82d5"; } module.exports = { + hallmarks: [ + [1648765747, "Rug Pull"] + ], deadFrom: 1648765747, start: 1637036516, // 16 Nov 2021 ethereum: { diff --git a/projects/axial/abi.json b/projects/axial/abi.json index 65ebc58b9ba..2cddbfdb113 100644 --- a/projects/axial/abi.json +++ b/projects/axial/abi.json @@ -1,133 +1,10 @@ { - "getToken": { - "type": "function", - "stateMutability": "view", - "outputs": [ - { - "type": "address", - "name": "", - "internalType": "contract IERC20" - } - ], - "name": "getToken", - "inputs": [ - { - "type": "uint8", - "name": "index", - "internalType": "uint8" - } - ] - }, - "want": { - "type": "function", - "stateMutability": "view", - "outputs": [ - { - "type": "address", - "name": "", - "internalType": "address" - } - ], - "name": "want", - "inputs": [] - }, - "balanceOf": { - "type": "function", - "stateMutability": "view", - "outputs": [ - { - "type": "uint256", - "name": "", - "internalType": "uint256" - } - ], - "name": "balanceOf", - "inputs": [] - }, - "token": { - "type": "function", - "stateMutability": "view", - "outputs": [ - { - "type": "address", - "name": "", - "internalType": "contract IERC20" - } - ], - "name": "token", - "inputs": [] - }, - "balance": { - "type": "function", - "stateMutability": "view", - "outputs": [ - { - "type": "uint256", - "name": "", - "internalType": "uint256" - } - ], - "name": "balance", - "inputs": [] - }, - "poolLength": { - "type": "function", - "stateMutability": "view", - "outputs": [ - { - "type": "uint256", - "name": "pools", - "internalType": "uint256" - } - ], - "name": "poolLength", - "inputs": [] - }, - "poolInfo": { - "type": "function", - "stateMutability": "view", - "inputs": [{ - "internalType":"uint256", - "name":"", - "type":"uint256" - }], - "name": "poolInfo", - "outputs":[{ - "internalType":"contract IERC20", - "name":"lpToken", - "type":"address" - }, - { - "internalType":"uint256", - "name":"accAxialPerShare", - "type":"uint256" - }, - { - "internalType":"uint256", - "name":"lastRewardTimestamp", - "type":"uint256" - }, - { - "internalType":"uint256", - "name":"allocPoint", - "type":"uint256" - }, - { - "internalType":"contract IRewarder", - "name":"rewarder", - "type":"address" - } - ] - }, - "owner": { - "name": "owner", - "type": "function", - "stateMutability":"view", - "inputs": [], - "outputs": [{ - "internalType": "address", - "name": "", - "type": "address" - }] - } + "getToken": "function getToken(uint8 index) view returns (address)", + "want": "address:want", + "balanceOf": "uint256:balanceOf", + "token": "address:token", + "balance": "uint256:balance", + "poolLength": "uint256:poolLength", + "poolInfo": "function poolInfo(uint256) view returns (address lpToken, uint256 accAxialPerShare, uint256 lastRewardTimestamp, uint256 allocPoint, address rewarder)", + "owner": "address:owner" } \ No newline at end of file diff --git a/projects/axial/index.js b/projects/axial/index.js index ff572143785..14d1bc103b2 100644 --- a/projects/axial/index.js +++ b/projects/axial/index.js @@ -1,100 +1,24 @@ -const sdk = require('@defillama/sdk'); const abi = require('./abi.json'); -const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); -// node test.js projects/axial/index.js +const { sumTokensExport, sumTokens2 } = require("../helper/unwrapLPs"); const AXIAL_JLP_TOKEN = "0x5305A6c4DA88391F4A9045bF2ED57F4BF0cF4f62"; const AXIAL_MASTERCHEF_V3 = "0x958C0d0baA8F220846d3966742D4Fb5edc5493D3"; -async function getAxialVaultBalances(balances, vaults, block) { - await Promise.all(vaults.map(async (vault) => { - await sdk.api.abi.multiCall({ - calls: [0, 1, 2, 3].map(num => ({ - target: vault, - params: [num] - })), - abi: abi.getToken, - block, - chain: 'avax' - }).then(async tokens => { - await sdk.api.abi.multiCall({ - calls: tokens.output.filter(t => t.output != null).map(token => ({ - target: token.output, - params: [vault] - })), - abi: 'erc20:balanceOf', - block, - chain: 'avax' - }).then(tokenBalances => { - const balancesToAdd = {}; - sdk.util.sumMultiBalanceOf(balancesToAdd, tokenBalances); - Object.entries(balancesToAdd).forEach(balance => { - sdk.util.sumSingleBalance(balances, `avax:${balance[0]}`, balance[1]); - }); - }); - }); - })); +async function tvl(_timestamp, _ethereumBlock, chainBlocks, { api }) { + const pools = (await api.fetchList({ lengthAbi: abi.poolLength, itemAbi: abi.poolInfo, target: AXIAL_MASTERCHEF_V3})).map(i => i.lpToken) + const vaults = (await api.multiCall({ abi: abi.owner, calls: pools, permitFailure: true,})).filter(i => i) + const params = [0, 1, 2, 3,] + const calls = vaults.map(v => params.map(i => ({ target: v, params:[i]}))).flat() + const owners = calls.map(i => i.target) + const tokens = await api.multiCall({ abi: abi.getToken, calls, permitFailure: true, }) + const tokensAndOwners = tokens.map((t, i) => [t, owners[i]]).filter(i => i[0]) + return sumTokens2({ api, tokensAndOwners,}) } -async function getAxialJLPBalance(_timestamp, _ethereumBlock, chainBlocks) { - const balances = {} - const block = chainBlocks['avax']; - const axialBalance = (await sdk.api.abi.call({ - target: AXIAL_JLP_TOKEN, - params: [AXIAL_MASTERCHEF_V3], - block, - chain: 'avax', - abi: 'erc20:balanceOf' - })).output; - await unwrapUniswapLPs(balances, [{token: AXIAL_JLP_TOKEN, balance: axialBalance}], block, 'avax', (addr) => `avax:${addr}`); - return balances; -} - -async function getAxialPools(block) { - let vaults = []; - const poolLength = (await sdk.api.abi.call({ - target: AXIAL_MASTERCHEF_V3, - abi: abi.poolLength, - chain: 'avax', - block - })).output; - await sdk.api.abi.multiCall({ - calls: [...Array(Number(poolLength)).keys()].map(num => ({ - target: AXIAL_MASTERCHEF_V3, - params: num - })), - chain: 'avax', - abi: abi.poolInfo, - block - }).then(async pools => { - await sdk.api.abi.multiCall({ - calls: pools.output.map(pool => ({ - target: pool.output.lpToken - })), - chain: 'avax', - abi: abi.owner, - block - }).then(owners => { - vaults = owners.output.filter(e => e.output).map(e => e.output); - }); - }); - return vaults; -} - -async function tvl(_timestamp, _ethereumBlock, chainBlocks) { - const balances = {}; - const block = chainBlocks['avax']; - const vaults = await getAxialPools(chainBlocks.avax); - - await getAxialVaultBalances(balances, vaults, block); - return balances; -} - - module.exports = { methodology: "Our TVL is the value of the tokens within the Axial pools, and the Axial LP tokens within our rewards pools MasterChef", avax:{ tvl, - pool2: getAxialJLPBalance + pool2: sumTokensExport({ owner: AXIAL_MASTERCHEF_V3, tokens: [AXIAL_JLP_TOKEN]}) } } diff --git a/projects/axion/abi.json b/projects/axion/abi.json index 5c2b9f0143d..db495742f08 100644 --- a/projects/axion/abi.json +++ b/projects/axion/abi.json @@ -1,56 +1,4 @@ { - "getStatFields": { - "inputs": [], - "name": "getStatFields", - "outputs": [ - { - "components": [ - { - "internalType": "uint72", - "name": "totalStakedAmount", - "type": "uint72" - }, - { - "internalType": "uint72", - "name": "sharesTotalSupply", - "type": "uint72" - }, - { - "internalType": "uint72", - "name": "_gap", - "type": "uint72" - }, - { - "internalType": "uint40", - "name": "lastStakeId", - "type": "uint40" - } - ], - "internalType": "struct StakeBase.StatFields", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - "balanceOf": { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -} + "getStatFields": "function getStatFields() view returns (tuple(uint72 totalStakedAmount, uint72 sharesTotalSupply, uint72 _gap, uint40 lastStakeId))", + "balanceOf": "function balanceOf(address account) view returns (uint256)" +} \ No newline at end of file diff --git a/projects/axion/index.js b/projects/axion/index.js index a10d9fe664a..f4d47f5d8ff 100644 --- a/projects/axion/index.js +++ b/projects/axion/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); @@ -17,7 +18,7 @@ async function staking(timestamp, block, chainBlocks) { }; } -const BTC = "0x1bfd67037b42cf73acf2047067bd4f2c47d9bfd6"; +const BTC = ADDRESSES.polygon.WBTC; const VC = "0x660B71C03C15B24EFa800F2454540CD9011E40cB"; async function tvl(timestamp, block, chainBlocks) { const stats = await sdk.api.abi.call({ diff --git a/projects/aztec/abi.json b/projects/aztec/abi.json index a699cc857da..f8910c07375 100644 --- a/projects/aztec/abi.json +++ b/projects/aztec/abi.json @@ -1,8 +1,9 @@ { - "getSupportedAsset": {"inputs":[{"internalType":"uint256","name":"assetId","type":"uint256"}],"name":"getSupportedAsset","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}, - "getSupportedAssets": {"inputs":[],"name":"getSupportedAssets","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"}, - "getTotalDeposited": {"inputs":[],"name":"getTotalDeposited","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"}, - "getTotalFees": {"inputs":[],"name":"getTotalFees","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"}, - "getTotalPendingDeposit": {"inputs":[],"name":"getTotalPendingDeposit","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"}, - "getTotalWithdrawn": {"inputs":[],"name":"getTotalWithdrawn","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"} + "getSupportedAsset": "function getSupportedAsset(uint256 assetId) view returns (address)", + "getSupportedAssets": "address[]:getSupportedAssets", + "getSupportedAssetsLength": "uint256:getSupportedAssetsLength", + "getTotalDeposited": "uint256[]:getTotalDeposited", + "getTotalFees": "uint256[]:getTotalFees", + "getTotalPendingDeposit": "uint256[]:getTotalPendingDeposit", + "getTotalWithdrawn": "uint256[]:getTotalWithdrawn" } \ No newline at end of file diff --git a/projects/aztec/index.js b/projects/aztec/index.js index 3b7f0719f70..24aefc2b601 100644 --- a/projects/aztec/index.js +++ b/projects/aztec/index.js @@ -1,23 +1,27 @@ const sdk = require("@defillama/sdk") const abi = require('./abi.json'); const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') +const { eulerTokens } = require('../helper/tokenMapping') const aztecRollupProcessor = '0x737901bea3eeb88459df9ef1BE8fF3Ae1B42A2ba' const aztecConnect = '0xFF1F2B4ADb9dF6FC8eAFecDcbF96A2B351680455' -const connectAbi = {"inputs":[],"name":"getSupportedAssets","outputs":[{"internalType":"address[]","name":"","type":"address[]"},{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"} -async function tvl(_, block) { - // Get aztec supported assets - const { output: supportedAssets } = await sdk.api.abi.call({ target: aztecRollupProcessor, abi: abi['getSupportedAssets'], block, }) - const tokensAndOwners = ([nullAddress, ...supportedAssets]).map(i => ([i, aztecRollupProcessor])) - const { output: [supportedAssetsConnect] } = await sdk.api.abi.call({ target: aztecConnect, abi: connectAbi, block, }) - tokensAndOwners.push([nullAddress, aztecConnect]) - supportedAssetsConnect.map(i => tokensAndOwners.push([i, aztecConnect])) - return sumTokens2({ tokensAndOwners, block, }) +async function tvl(_, block) { + // Get aztec supported assets + const { output: supportedAssets } = await sdk.api.abi.call({ target: aztecRollupProcessor, abi: abi['getSupportedAssets'], block, }) + const tokensAndOwners = ([nullAddress, ...supportedAssets]).map(i => ([i, aztecRollupProcessor])) + const supportedAssetsConnect = await sdk.api2.abi.fetchList({ target: aztecConnect, lengthAbi: abi.getSupportedAssetsLength, itemAbi: abi.getSupportedAsset, block, }) + tokensAndOwners.push([nullAddress, aztecConnect]) + supportedAssetsConnect.map(i => tokensAndOwners.push([i, aztecConnect])) + return sumTokens2({ tokensAndOwners, block, blacklistedTokens: eulerTokens, }) } module.exports = { - methodology: "TVL of Aztec consists of ethereum and supported assets (DAI and renBTC at the moment) locked into the rollup processor", + hallmarks: [ + [Math.floor(new Date('2023-03-13') / 1e3), 'Euler was hacked'], + [Math.floor(new Date('2023-03-13') / 1e3), 'AztecConnect sunset announced'], + ], + methodology: "TVL of Aztec consists of ethereum and supported assets locked into the rollup processor", ethereum: { tvl, } diff --git a/projects/azuro/index.js b/projects/azuro/index.js index e831015fce9..3a7033c73fc 100644 --- a/projects/azuro/index.js +++ b/projects/azuro/index.js @@ -1,25 +1,41 @@ -const sdk = require("@defillama/sdk"); +const { getLogs } = require('../helper/cache/getLogs') +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokens2 } = require('../helper/unwrapLPs') - -const LPContract = '0xac004b512c33D029cf23ABf04513f1f380B3FD0a' -const token = '0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d' - -async function tvl(timestamp, ethBlock, chainBlocks) { - - const balance = await sdk.api.erc20.balanceOf({ - target: token, - owner: LPContract, - block: chainBlocks['xdai'], - chain: 'xdai' - }) - - return {['xdai:' + token]: balance.output}; +const config = { + polygon: { factory: '0xde3e9a39af548b5daa8365d30a5f6e7a7fa0203d', fromBlock: 38563568, }, + arbitrum: { factory: '0x752735c1a93fe359e7bac65f9981e7796e1039ef', fromBlock: 94336607, }, + xdai: { + factory: '0x8ea1a7241537f10fa73363fdc6380f3fc8619c03', fromBlock: 26026402, tokensAndOwners: [[ADDRESSES.xdai.WXDAI, '0xac004b512c33D029cf23ABf04513f1f380B3FD0a']], // v1 + }, } +async function tvl(timestamp, ethBlock, chainBlocks, { api }) { + return sumTokens2({ api, ...config[api.chain] }) +} module.exports = { - xdai:{ - tvl, - }, - methodology: `TVL is the total quantity of xDAI held on Liquidity pools’ smart-contracts.` + xdai: { tvl }, + polygon: { tvl }, + methodology: `TVL is the total amount of WXDAI and USDC held on Liquidity pools’ smart-contracts.` } + +Object.keys(config).forEach(chain => { + const { factory, fromBlock, tokensAndOwners = [] } = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const logs = await getLogs({ + api, + target: factory, + topics: ['0xbf48d8b8335478e764061b936181c0a7b273540bd6284da4d4791758e81fd51c'], + eventAbi: 'event NewPool(address indexed lp, address indexed core, string indexed coreType, address access)', + onlyArgs: true, + fromBlock, + }) + const lps = logs.map(i => i[0]) + const tokens = await api.multiCall({ abi: 'address:token', calls: lps }) + lps.forEach((lp, i) => tokensAndOwners.push([tokens[i], lp])) + return sumTokens2({ api, tokensAndOwners, permitFailure: true }) + } + } +}) \ No newline at end of file diff --git a/projects/babydogeswap/index.js b/projects/babydogeswap/index.js index bfa2b750d93..6155edb6a89 100644 --- a/projects/babydogeswap/index.js +++ b/projects/babydogeswap/index.js @@ -1,19 +1,21 @@ const { getUniTVL } = require('../helper/unknownTokens') const { staking } = require('../helper/staking') -const chain = 'bsc' const farmFactoryContract = '0x4693B62E5fc9c0a45F89D62e6300a03C85f43137' const babydogeTokenAddress = '0xc748673057861a797275CD8A068AbB95A902e8de' const stakingContract = '0xcecd3e7eadae1ad0c94f53bf6a2af188df1a90d0' module.exports = { methodology: 'Total TVL in all farms and BabyDoge staking pool', + misrepresentedTokens: true, bsc: { - staking: staking(stakingContract, babydogeTokenAddress, chain), + staking: staking(stakingContract, babydogeTokenAddress), tvl: getUniTVL({ - chain: chain, - useDefaultCoreAssets: false, - factory: farmFactoryContract + useDefaultCoreAssets: true, + factory: farmFactoryContract, + blacklistedTokens: [ + '0xe320df552e78d57e95cf1182b6960746d5016561' + ] }) }, } diff --git a/projects/babylon-finance/abi.json b/projects/babylon-finance/abi.json index 589f499301f..cf7c52eb43b 100644 --- a/projects/babylon-finance/abi.json +++ b/projects/babylon-finance/abi.json @@ -1,118 +1,5 @@ { - "getGardens": { - "name": "getGardens", - "inputs": [], - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address[]" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - "getGardenDetails": { - "inputs": [ - { - "internalType": "address", - "name": "_garden", - "type": "address" - } - ], - "name": "getGardenDetails", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - }, - { - "internalType": "string", - "name": "", - "type": "string" - }, - { - "internalType": "address[5]", - "name": "", - "type": "address[5]" - }, - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "bool[4]", - "name": "", - "type": "bool[4]" - }, - { - "internalType": "address[]", - "name": "", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "", - "type": "address[]" - }, - { - "internalType": "uint256[10]", - "name": "", - "type": "uint256[10]" - }, - { - "internalType": "uint256[10]", - "name": "", - "type": "uint256[10]" - }, - { - "internalType": "uint256[3]", - "name": "", - "type": "uint256[3]" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getCompleteStrategy": { - "inputs": [ - { - "internalType": "address", - "name": "_strategy", - "type": "address" - } - ], - "name": "getCompleteStrategy", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "string", - "name": "", - "type": "string" - }, - { - "internalType": "uint256[16]", - "name": "", - "type": "uint256[16]" - }, - { - "internalType": "bool[]", - "name": "", - "type": "bool[]" - }, - { - "internalType": "uint256[]", - "name": "", - "type": "uint256[]" - } - ], - "stateMutability": "view", - "type": "function" - } + "getGardens": "address[]:getGardens", + "getGardenDetails": "function getGardenDetails(address _garden) view returns (string, string, address[5], address, bool[4], address[], address[], uint256[10], uint256[10], uint256[3])", + "getCompleteStrategy": "function getCompleteStrategy(address _strategy) view returns (address, string, uint256[16], bool[], uint256[])" } \ No newline at end of file diff --git a/projects/babylon-finance/index.js b/projects/babylon-finance/index.js index ce4087f8f91..052152b42c5 100644 --- a/projects/babylon-finance/index.js +++ b/projects/babylon-finance/index.js @@ -33,7 +33,7 @@ async function tvl(timestamp, ethBlock, chainBlocks) { }) for (const gardenDetails of gardensDetails.output) { - if (gardensToIgnore.includes(gardenDetails.input.params[0])) { continue; }; + if (gardensToIgnore.includes(gardenDetails.input.params[0])) { continue; } log(gardenDetails.input.params[0], !!gardenDetails.output) const [gardenName, symbol, creators, reserveAsset, arr1, strategies, finalizedStrategies, voteParams, capitalArr, profits] = gardenDetails.output // const garden_principal = capitalArr[0] diff --git a/projects/babyswap/abi.json b/projects/babyswap/abi.json index 00ad3752ffb..dbd78ad4630 100644 --- a/projects/babyswap/abi.json +++ b/projects/babyswap/abi.json @@ -1,49 +1,4 @@ { - "poolInfo": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "poolInfo", - "outputs": [ - { - "internalType": "contract IBEP20", - "name": "lpToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "allocPoint", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastRewardBlock", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accCakePerShare", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "poolLength": { - "inputs": [], - "name": "poolLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } + "poolInfo": "function poolInfo(uint256) view returns (address lpToken, uint256 allocPoint, uint256 lastRewardBlock, uint256 accCakePerShare)", + "poolLength": "uint256:poolLength" } \ No newline at end of file diff --git a/projects/babyswap/index.js b/projects/babyswap/index.js index 77290fedb9d..d1a6999bda1 100644 --- a/projects/babyswap/index.js +++ b/projects/babyswap/index.js @@ -21,8 +21,8 @@ module.exports = { misrepresentedTokens: true, incentivized: true, bsc: { - tvl: getUniTVL({ factory: '0x86407bEa2078ea5f5EB5A52B2caA963bC1F889Da', chain: 'bsc', useDefaultCoreAssets: true }), - staking: staking(MasterChefContract, BABY, "bsc"), + tvl: getUniTVL({ factory: '0x86407bEa2078ea5f5EB5A52B2caA963bC1F889Da', useDefaultCoreAssets: true }), + staking: staking(MasterChefContract, BABY), } }; diff --git a/projects/backfinance/abi.json b/projects/backfinance/abi.json index 3eb43bf6188..0d2daa77393 100644 --- a/projects/backfinance/abi.json +++ b/projects/backfinance/abi.json @@ -1,132 +1,12 @@ { - "pairFactory": { - "inputs": [], - "name": "pairFactory", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "poolFactory": { - "inputs": [], - "name": "poolFactory", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getPools": { - "inputs": [], - "name": "getPools", - "outputs": [ - { - "internalType": "address[]", - "name": "", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - "supplyToken": { - "inputs": [], - "name": "supplyToken", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "totalBorrow": { - "inputs": [], - "name": "totalBorrow", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getPairs": { - "inputs": [], - "name": "getPairs", - "outputs": [ - { - "internalType": "address[]", - "name": "", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - "token0": { - "inputs": [], - "name": "token0", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "token1": { - "inputs": [], - "name": "token1", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "totalBorrowToken0": { - "inputs": [], - "name": "totalBorrowToken0", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "totalBorrowToken1": { - "inputs": [], - "name": "totalBorrowToken1", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } + "pairFactory": "address:pairFactory", + "poolFactory": "address:poolFactory", + "getPools": "address[]:getPools", + "supplyToken": "address:supplyToken", + "totalBorrow": "uint256:totalBorrow", + "getPairs": "address[]:getPairs", + "token0": "address:token0", + "token1": "address:token1", + "totalBorrowToken0": "uint256:totalBorrowToken0", + "totalBorrowToken1": "uint256:totalBorrowToken1" } \ No newline at end of file diff --git a/projects/bagel-finance/abi.json b/projects/bagel-finance/abi.json index 82810b79d6c..0627f1c4f3d 100644 --- a/projects/bagel-finance/abi.json +++ b/projects/bagel-finance/abi.json @@ -1,105 +1,5 @@ { - "balanceOf": { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "totalSupply": { - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "banks":{ - "constant":true, - "inputs":[ - { - "internalType":"address", - "name":"", - "type":"address" - } - ], - "name":"banks", - "outputs":[ - { - "internalType":"address", - "name":"tokenAddr", - "type":"address" - }, - { - "internalType":"address", - "name":"gTokenAddr", - "type":"address" - }, - { - "internalType":"bool", - "name":"isOpen", - "type":"bool" - }, - { - "internalType":"bool", - "name":"canDeposit", - "type":"bool" - }, - { - "internalType":"bool", - "name":"canWithdraw", - "type":"bool" - }, - { - "internalType":"uint256", - "name":"totalVal", - "type":"uint256" - }, - { - "internalType":"uint256", - "name":"totalDebt", - "type":"uint256" - }, - { - "internalType":"uint256", - "name":"totalDebtShare", - "type":"uint256" - }, - { - "internalType":"uint256", - "name":"totalReserve", - "type":"uint256" - }, - { - "internalType":"uint256", - "name":"lastInterestTime", - "type":"uint256" - }, - { - "internalType":"uint256", - "name":"tokenIdx", - "type":"uint256" - } - ], - "payable":false, - "stateMutability":"view", - "type":"function" - } -} + "balanceOf": "function balanceOf(address account) view returns (uint256)", + "totalSupply": "uint256:totalSupply", + "banks": "function banks(address) view returns (address tokenAddr, address gTokenAddr, bool isOpen, bool canDeposit, bool canWithdraw, uint256 totalVal, uint256 totalDebt, uint256 totalDebtShare, uint256 totalReserve, uint256 lastInterestTime, uint256 tokenIdx)" +} \ No newline at end of file diff --git a/projects/bagel-finance/index.js b/projects/bagel-finance/index.js index 8cf1bcaa60a..78510c9e788 100644 --- a/projects/bagel-finance/index.js +++ b/projects/bagel-finance/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); const BigNumber = require("bignumber.js"); @@ -5,13 +6,13 @@ const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); const bankAddress = "0x18C32E273D0F13D5b8268B3Bc5acD30f26A8F91a"; const tokens = [ - "0x55d398326f99059ff775485246999027b3197955", - "0xe9e7cea3dedca5984780bafc599bd69add087d56", - "0x7130d2a12b9bcbfae4f2634d864a1ee1ce3ead9c", - "0x2170ed0880ac9a755fd29b2688956bd959f933f8", + ADDRESSES.bsc.USDT, + ADDRESSES.bsc.BUSD, + ADDRESSES.bsc.BTCB, + ADDRESSES.bsc.ETH, "0x9c65ab58d8d978db963e63f2bfb7121627e3a739", "0x0e09fabb73bd3ade0a17ecc321fd13a19e81ce82", - "0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d", + ADDRESSES.bsc.USDC, "0xbb238fce6e2ee90781cd160c9c6eaf3a4cfad801", ]; @@ -135,7 +136,7 @@ const lps = [ ]; async function bnbTvl(bankAddress, block) { let balances = { - "0x0000000000000000000000000000000000000000": ( + [ADDRESSES.null]: ( await sdk.api.eth.getBalance({ target: bankAddress, block, chain: "bsc" }) ).output, }; @@ -186,8 +187,8 @@ async function tvl(timestamp, ethBlock, chainBlocks) { /// @dev bnb const bnbBalance = await bnbTvl(bankAddress, block); - balances[getBSCAddress("0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c")] = - BigNumber(bnbBalance["0x0000000000000000000000000000000000000000"]); + balances[getBSCAddress(ADDRESSES.bsc.WBNB)] = + BigNumber(bnbBalance[ADDRESSES.null]); const lpTotalSupplys = ( await sdk.api.abi.multiCall({ diff --git a/projects/baguette/index.js b/projects/baguette/index.js index b596685369b..445197101ff 100644 --- a/projects/baguette/index.js +++ b/projects/baguette/index.js @@ -3,6 +3,6 @@ const { getUniTVL } = require("../helper/unknownTokens") module.exports = { misrepresentedTokens: true, avax:{ - tvl: getUniTVL({ chain: 'avax', useDefaultCoreAssets: true, factory: '0x3587B8c0136c2C3605a9E5B03ab54Da3e4044b50', }), + tvl: getUniTVL({ useDefaultCoreAssets: true, factory: '0x3587B8c0136c2C3605a9E5B03ab54Da3e4044b50', }), }, } \ No newline at end of file diff --git a/projects/baker-guild-finance/index.js b/projects/baker-guild-finance/index.js index 27dbde62353..a1e3eb4c5ad 100644 --- a/projects/baker-guild-finance/index.js +++ b/projects/baker-guild-finance/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const {addFundsInMasterChef} = require("../helper/masterchef"); const {pool2BalanceFromMasterChefExports} = require("../helper/pool2"); @@ -13,10 +14,10 @@ const wsSPA= "0x89346b51a54263cf2e92da79b1863759efa68692"; const spa = "fantom:0x5602df4a94eb6c680190accfa2a475621e0ddbdc"; const translate = { - "0x8d11ec38a3eb5e956b052f67da8bdc9bef8abf3e":"0x6b175474e89094c44da98b954eedeac495271d0f", - "0x9879abdea01a879644185341f7af7d8343556b7a":"0x0000000000085d4780b73119b644ae5ecd22b376", - "0x9f47f313acfd4bdc52f4373b493eae7d5ac5b765":"avax:0x6e84a6216ea6dacc71ee8e6b0a5b7322eebc0fdd", - "0x511d35c52a3c244e7b8bd92c0c297755fbd89212":"avax:0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7" + [ADDRESSES.fantom.DAI]:ADDRESSES.ethereum.DAI, + "0x9879abdea01a879644185341f7af7d8343556b7a":ADDRESSES.ethereum.TUSD, + "0x9f47f313acfd4bdc52f4373b493eae7d5ac5b765":"avax:" + ADDRESSES.avax.JOE, + "0x511d35c52a3c244e7b8bd92c0c297755fbd89212":"avax:" + ADDRESSES.avax.WAVAX } async function tvl(timestamp, block, chainBlocks) { @@ -31,7 +32,7 @@ async function tvl(timestamp, block, chainBlocks) { const memo = (await sdk.api.abi.call({ target: wMEMO, params: [balances["fantom:0xddc0385169797937066bbd8ef409b5b3c0dfeb52"]], - abi:{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"wMEMOToMEMO","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}, + abi:'function wMEMOToMEMO(uint256 _amount) view returns (uint256)', block: chainBlocks.avax, chain: "avax", })).output; @@ -40,7 +41,7 @@ async function tvl(timestamp, block, chainBlocks) { const sSPA = (await sdk.api.abi.call({ target: wsSPA, params:[balances["fantom:0x89346b51a54263cf2e92da79b1863759efa68692"]], - abi: {"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"wOHMTosOHM","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}, + abi: 'function wOHMTosOHM(uint256 _amount) view returns (uint256)', block: chainBlocks.fantom, chain: "fantom" })).output; diff --git a/projects/bakeryswap/index.js b/projects/bakeryswap/index.js index 00a3dc8936b..f921f862ba9 100644 --- a/projects/bakeryswap/index.js +++ b/projects/bakeryswap/index.js @@ -6,6 +6,6 @@ const factory = "0x01bF7C66c6BD861915CdaaE475042d3c4BaE16A7"; module.exports = { bsc:{ staking: staking("6a8dbbfbb5a57d07d14e63e757fb80b4a7494f81", "0xE02dF9e3e622DeBdD69fb838bB799E3F168902c5", "bsc"), - tvl: uniTvlExport(factory, "bsc") + tvl: uniTvlExport(factory, "bsc", true) } }; diff --git a/projects/baksdao/index.js b/projects/baksdao/index.js index 8faf4638ab6..7cfcef74600 100644 --- a/projects/baksdao/index.js +++ b/projects/baksdao/index.js @@ -1,13 +1,14 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens, } = require('../helper/unwrapLPs') const { transformBscAddress, } = require('../helper/portedTokens'); const chain = 'bsc' const DEPOSIT_TOKENS = [ - '0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c', // wBnB - '0x2170Ed0880ac9A755fd29B2688956BD959F933F8', //ETH, - '0x55d398326f99059fF775485246999027B3197955', // USDT - '0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c', // BTC + ADDRESSES.bsc.WBNB, // wBnB + ADDRESSES.bsc.ETH, //ETH, + ADDRESSES.bsc.USDT, // USDT + ADDRESSES.bsc.BTCB, // BTC ] const DEPOSIT_CONTRACT = '0xe94286A3e83D66aB3bAF9840184a2E5680e9A7eC' diff --git a/projects/balanced/index.js b/projects/balanced/index.js index 54cf677c022..f2967a9cacf 100644 --- a/projects/balanced/index.js +++ b/projects/balanced/index.js @@ -1,7 +1,6 @@ const axios = require("axios"); -const BigNumber = require("bignumber.js"); -const pools = require("./pools"); -const { getQuoteAddress, getPoolTVL } = require("./utils"); +const sdk = require('@defillama/sdk') +const { get } = require('../helper/http') const icxApiEndpoint = 'https://ctz.solidwallet.io/api/v3'; const balancedDexContract = 'cxa0af3165c08318e988cb30993b3048335b94af6c'; @@ -28,31 +27,26 @@ async function icxCall(address, method, params) { async function getLoanTvl() { const totalCollateral = await icxCall(balancedLoansContract, 'getTotalCollateral'); - const bnUSDinLOOP = await icxCall(balancedOracleContract, 'getLastPriceInLoop', {symbol: 'bnUSD'}); + const bnUSDinLOOP = await icxCall(balancedOracleContract, 'getLastPriceInLoop', { symbol: 'bnUSD' }); const collateralTvl = parseInt(totalCollateral, 16) / bnUSDinLOOP; return collateralTvl; } async function getDexTvl() { - const prices = await require('./prices'); - const valuesLocked = await Promise.all(pools.map(async pool => { - const quoteAddress = getQuoteAddress(pool.quoteCurrencyKey); - const quoteDecimals = await icxCall(quoteAddress, 'decimals'); - const hexBalance = pool.id !== 1 ? - await icxCall(balancedDexContract, 'getPoolTotal', {'_id': pool.id.toString(), '_token': quoteAddress}) : - await icxCall(balancedDexContract, 'totalSupply', {'_id': '1'}); - - return getPoolTVL(hexBalance, quoteDecimals, prices[pool.quoteCurrencyKey], pool.id !== 1); - })) - - return valuesLocked.reduce((sum, value) => sum + value, 0); + const balances = {} + const pools = await get('https://balanced.icon.community/api/v1/pools') + pools.forEach(({ quote_liquidity, base_liquidity }) => { + sdk.util.sumSingleBalance(balances, 'tether', base_liquidity) + sdk.util.sumSingleBalance(balances, 'tether', quote_liquidity) + }) + return balances } async function getStabilityFundTvl() { const supportedTokens = await icxCall(stabilityFundContract, 'getAcceptedTokens'); const balances = await (supportedTokens && Promise.all(supportedTokens.map(async token => { - const hexBalance = await icxCall(token, 'balanceOf', {_owner: stabilityFundContract}); + const hexBalance = await icxCall(token, 'balanceOf', { _owner: stabilityFundContract }); const tokenDecimals = await icxCall(token, 'decimals'); const balance = parseInt(hexBalance, 16) / 10 ** parseInt(tokenDecimals, 16); return balance; @@ -61,15 +55,21 @@ async function getStabilityFundTvl() { return balances.reduce((sum, balance) => sum + balance, 0); } -async function fetch() { - const loanTvl = await getLoanTvl(); - const dexTvl = await getDexTvl(); - const stabilityFundTvl = await getStabilityFundTvl(); - const tvl = new BigNumber(loanTvl + dexTvl + stabilityFundTvl).toFixed(2); - return tvl; +async function tvl() { + const [stabilityFundTvl, loanTvl, dexTvl] = await Promise.all([ + getStabilityFundTvl(), + getLoanTvl(), + getDexTvl(), + ]) + sdk.util.sumSingleBalance(dexTvl, 'tether', stabilityFundTvl) + sdk.util.sumSingleBalance(dexTvl, 'tether', loanTvl) + return dexTvl } module.exports = { + misrepresentedTokens: true, methodology: 'TVL consists of liquidity on the DEX, deposits made to the lending program and the stability fund. Data is pulled from the ICX API "https://ctz.solidwallet.io/api/v3" and Balanced stats API "https://balanced.sudoblock.io/api/v1/docs', - fetch, + icon: { + tvl + }, }; diff --git a/projects/balanced/prices.js b/projects/balanced/prices.js index d0270c2a494..3264278b26f 100644 --- a/projects/balanced/prices.js +++ b/projects/balanced/prices.js @@ -5,7 +5,7 @@ const getTokenStats = async () => { return stats.data; } -module.exports = (async () => { +const getPrices = async () => { const tokenStats = await getTokenStats(); const tokens = tokenStats.tokens; @@ -22,4 +22,6 @@ module.exports = (async () => { 'USDS': USDSPrice, 'IUSDC': IUSDCPrice } -})(); +} + +module.exports = { getPrices }; diff --git a/projects/balancer-v1/index.js b/projects/balancer-v1/index.js new file mode 100644 index 00000000000..212b039d049 --- /dev/null +++ b/projects/balancer-v1/index.js @@ -0,0 +1,16 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { v1Tvl } = require('../helper/balancer') + +const blacklistedTokens = [ + "0xC011A72400E58ecD99Ee497CF89E3775d4bd732F", + ADDRESSES.ethereum.sUSD_OLD, + //self destructed + "0x00f109f744B5C918b13d4e6a834887Eb7d651535", "0x645F7dd67479663EE7a42feFEC2E55A857cb1833", "0x4922a015c4407F87432B179bb209e125432E4a2A", + "0xdA16D6F08F20249376d01a09FEBbAd395a246b2C", "0x9be4f6a2558f88A82b46947e3703528919CE6414", +] + +module.exports = { + ethereum:{ + tvl: v1Tvl('0x9424B1412450D0f8Fc2255FAf6046b98213B76Bd', 9562480, { blacklistedTokens }) + } +} diff --git a/projects/balancer/abi.json b/projects/balancer/abi.json deleted file mode 100644 index e8afeb6dcc0..00000000000 --- a/projects/balancer/abi.json +++ /dev/null @@ -1,18 +0,0 @@ - -{ - "getCurrentTokens": { - "constant": true, - "inputs": [], - "name": "getCurrentTokens", - "outputs": [ - { - "internalType": "address[]", - "name": "tokens", - "type": "address[]" - } - ], - "payable": false, - "type": "function" - } - -} diff --git a/projects/balancer/index.js b/projects/balancer/index.js index e0808535345..8da7f514fad 100644 --- a/projects/balancer/index.js +++ b/projects/balancer/index.js @@ -1,99 +1 @@ -const sdk = require('@defillama/sdk'); -const BigNumber = require("bignumber.js"); -const { GraphQLClient, gql } = require('graphql-request') -const { toUSDTBalances } = require('../helper/balances'); -const { getBlock } = require('../helper/getBlock'); -async function getTVL(subgraphName, block) { - // delayed by around 5 mins to allow subgraph to update - block -= 100; - var endpoint = `https://api.thegraph.com/subgraphs/name/balancer-labs/${subgraphName}` - var graphQLClient = new GraphQLClient(endpoint) - - var query = gql` - query get_tvl($block: Int) { - pools ( - orderBy: totalLiquidity - orderDirection:desc - block: { number: $block } - ){ - id - name - owner - address - totalLiquidity - } - } - `; - const results = await graphQLClient.request(query, { - block - }) - - results.pools.forEach(i => { - if (+i.totalLiquidity > 1e10) console.log('bad pool: ', i) - }) - return results.pools - .map(i => +i.totalLiquidity) - .filter(i => i < 1e10) // we filter out if liquidity is higher than 10B as it is unlikely/error - .reduce((acc, i) => acc + i, 0) -} - -async function getTVLFromPools(subgraphName, block) { - // delayed by around 5 mins to allow subgraph to update - block -= 100; - var endpoint = `https://api.thegraph.com/subgraphs/name/balancer-labs/${subgraphName}` - var graphQLClient = new GraphQLClient(endpoint) - - var query = gql` - query get_tvl($block: Int) { - pools ( - block: { number: $block } - orderBy: liquidity - orderDirection:desc - ) { - liquidity - name - publicSwap - tokens - } - } - `; - const results = await graphQLClient.request(query, { - block - }) - results.pools.forEach(i => { - if (+i.liquidity > 1e10) console.log('bad pool: ', i) - }) - return results.pools - .map(i => +i.liquidity) - .filter(i => i < 1e10) // we filter out if liquidity is higher than 10B as it is unlikely/error - .reduce((acc, i) => acc + i, 0) -} - -async function ethereum(timestamp, ethBlock) { - const [v1,v2] = await Promise.all([getTVLFromPools("balancer", ethBlock), getTVL("balancer-v2", ethBlock)]) - - return toUSDTBalances(BigNumber(v1).plus(v2)) -} - -async function polygon(timestamp, ethBlock, chainBlocks) { - return toUSDTBalances(await getTVL("balancer-polygon-v2", await getBlock(timestamp, "polygon", chainBlocks))) -} - -async function arbitrum(timestamp, ethBlock, chainBlocks) { - return toUSDTBalances(await getTVL("balancer-arbitrum-v2", await getBlock(timestamp, "arbitrum", chainBlocks))) -} - -module.exports = { - timetravel: true, - misrepresentedTokens: true, - methodology: `Balancer TVL is pulled from the Balancer subgraph and includes deposits made to Balancer v1 and v2 liquidity pools.`, - ethereum:{ - tvl: ethereum - }, - polygon:{ - tvl: polygon - }, - arbitrum:{ - tvl: arbitrum - }, -} +module.exports = require('./onchain') \ No newline at end of file diff --git a/projects/balancer/onchain.js b/projects/balancer/onchain.js index 7872f8e58b2..0009056f6e2 100644 --- a/projects/balancer/onchain.js +++ b/projects/balancer/onchain.js @@ -1,131 +1,35 @@ -const sdk = require('@defillama/sdk'); - -const { request, gql } = require("graphql-request"); -const { transformArbitrumAddress } = require('../helper/portedTokens') -const { requery } = require('../helper/requery') - -const abi = require('./abi'); -const ignored = ["0xC011A72400E58ecD99Ee497CF89E3775d4bd732F", "0x57Ab1E02fEE23774580C119740129eAC7081e9D3", // old synthetix -"0x00f109f744B5C918b13d4e6a834887Eb7d651535", "0x645F7dd67479663EE7a42feFEC2E55A857cb1833" // self destructed +const ADDRESSES = require('../helper/coreAssets.json') +const { onChainTvl } = require('../helper/balancer') +const { eulerTokens } = require('../helper/tokenMapping') + +const blacklistedTokens = [ + "0xC011A72400E58ecD99Ee497CF89E3775d4bd732F", + ADDRESSES.ethereum.sUSD_OLD, + //self destructed + "0x00f109f744B5C918b13d4e6a834887Eb7d651535", "0x645F7dd67479663EE7a42feFEC2E55A857cb1833", "0x4922a015c4407F87432B179bb209e125432E4a2A", + "0xdA16D6F08F20249376d01a09FEBbAd395a246b2C", "0x9be4f6a2558f88A82b46947e3703528919CE6414", "0xa7fd7d83e2d63f093b71c5f3b84c27cff66a7802", + "0xacfbe6979d58b55a681875fc9adad0da4a37a51b", "0xd6d9bc8e2b894b5c73833947abdb5031cc7a4894", + + ...eulerTokens ] const V2_ADDRESS = '0xBA12222222228d8Ba445958a75a0704d566BF2C8'; // shared by all networks -const subgraphs = { - ethereum: 'balancer-v2', - arbitrum: 'balancer-arbitrum-v2', - polygon: 'balancer-polygon-v2' -} - -async function v1(timestamp, block) { - let balances = { - '0x0000000000000000000000000000000000000000': '0', // ETH - }; - - let poolLogs = await sdk.api.util.getLogs({ - target: '0x9424B1412450D0f8Fc2255FAf6046b98213B76Bd', - topic: 'LOG_NEW_POOL(address,address)', - keys: ['topics'], - fromBlock: 9562480, - toBlock: block - }); - - let poolCalls = []; - - let pools = poolLogs.output.map((poolLog) => { - if (poolLog.topics) { - return `0x${poolLog.topics[2].slice(26)}` - } else { - return `0x${poolLog[2].slice(26)}` - } - }); - - const poolTokenData = (await sdk.api.abi.multiCall({ - calls: pools.map((poolAddress) => ({ target: poolAddress })), - abi: abi.getCurrentTokens, - })).output; - poolTokenData.forEach((poolToken) => { - let poolTokens = poolToken.output; - let poolAddress = poolToken.input.target; - - poolTokens.forEach((token) => { - if(ignored.includes(token)){ - return - } - poolCalls.push({ - target: token, - params: poolAddress, - }); - }) - }); - - let poolBalances = await sdk.api.abi.multiCall({ - block, - calls: poolCalls, - abi: 'erc20:balanceOf' - }); - - sdk.util.sumMultiBalanceOf(balances, poolBalances) - return balances +const config = { + ethereum: { fromBlock: 12272146, }, + polygon: { fromBlock: 15832990, }, + arbitrum: { fromBlock: 222832, }, + xdai: { fromBlock: 24821598, }, + polygon_zkevm: { fromBlock: 203079, }, + base: { fromBlock: 1196036, }, + avax: { fromBlock: 26386141, }, } -function v2(chain) { - return async (time, ethBlock, chainBlocks) => { - const block = chainBlocks[chain] - const balances = {} - const tokensApi = `https://api.thegraph.com/subgraphs/name/balancer-labs/${subgraphs[chain]}`; - const POOL_TOKENS = gql` - { - balancers { - pools { - tokens { - address - } - } - } - }`; - - const v2Tokens = await request(tokensApi, POOL_TOKENS, { - block, - }); - let tokenAddresses = []; - for (let i = 0; i < v2Tokens.balancers[0].pools.length; i++) { - for (let address of v2Tokens.balancers[0].pools[i].tokens) { - tokenAddresses.push(address.address) - } - } - tokenAddresses = [...new Set(tokenAddresses)] +module.exports = {}; - let v2Calls = tokenAddresses.map((address) => { - return { - target: address, - params: V2_ADDRESS - } - }); - let v2Balances = await sdk.api.abi.multiCall({ - block, - calls: v2Calls, - abi: 'erc20:balanceOf' - }); - await requery(v2Balances, chain, block, "erc20:balanceOf") - let transform = addr => `${chain}:${addr}` - if(chain === "arbitrum"){ - transform = await transformArbitrumAddress() - } - sdk.util.sumMultiBalanceOf(balances, v2Balances, true, transform) - - return balances; +Object.keys(config).forEach(chain => { + const { fromBlock } = config[chain] + module.exports[chain] = { + tvl: onChainTvl(V2_ADDRESS, fromBlock, { blacklistedTokens }) } -} - -module.exports = { - polygon:{ - tvl: v2("polygon") - }, - arbitrum:{ - tvl: v2("arbitrum") - }, - ethereum:{ - tvl: sdk.util.sumChainTvls([v1, v2("ethereum")]) - }, -} +}) diff --git a/projects/bamboodefi/index.js b/projects/bamboodefi/index.js index 8df47dcf193..89c86cad0d6 100644 --- a/projects/bamboodefi/index.js +++ b/projects/bamboodefi/index.js @@ -16,8 +16,6 @@ module.exports = { Object.keys(config).forEach(chain => { const { factory } = config[chain] module.exports[chain] = { - tvl: getUniTVL({ - factory, chain, useDefaultCoreAssets: true, - }) + tvl: getUniTVL({ factory, useDefaultCoreAssets: true, }) } }) diff --git a/projects/bancor/abi.json b/projects/bancor/abi.json index c7cd25c1e3d..021175289b3 100644 --- a/projects/bancor/abi.json +++ b/projects/bancor/abi.json @@ -1,71 +1,7 @@ { - "abiContractRegistryAddressOf": { - "inputs": [{ - "internalType": "bytes32", - "name": "_contractName", - "type": "bytes32" - }], - "name": "addressOf", - "outputs": [{ - "internalType": "address", - "name": "", - "type": "address" - }], - "stateMutability": "view", - "type": "function" - }, - "abiConverterRegistryGetPools": { - "inputs": [], - "name": "getLiquidityPools", - "outputs": [{ - "internalType": "address[]", - "name": "", - "type": "address[]" - }], - "stateMutability": "view", - "type": "function" - }, - "abiRegistryGetConvertersBySmartTokens": { - "inputs": [{ - "internalType": "address[]", - "name": "_smartTokens", - "type": "address[]" - }], - "name": "getConvertersBySmartTokens", - "outputs": [{ - "internalType": "contract IConverter[]", - "name": "", - "type": "address[]" - }], - "stateMutability": "view", - "type": "function" - }, - "abiConverterConnectorTokens": { - "inputs": [{ - "internalType": "uint256", - "name": "", - "type": "uint256" - }], - "name": "connectorTokens", - "outputs": [{ - "internalType": "contract IERC20Token", - "name": "", - "type": "address" - }], - "stateMutability": "view", - "type": "function" - }, - "liquidityPools": { - "inputs": [], - "name": "liquidityPools", - "outputs": [ - { - "internalType": "contract Token[]", - "name": "", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - } -} + "abiContractRegistryAddressOf": "function addressOf(bytes32 _contractName) view returns (address)", + "abiConverterRegistryGetPools": "address[]:getLiquidityPools", + "abiRegistryGetConvertersBySmartTokens": "function getConvertersBySmartTokens(address[] _smartTokens) view returns (address[])", + "abiConverterConnectorTokens": "function connectorTokens(uint256) view returns (address)", + "liquidityPools": "address[]:liquidityPools" +} \ No newline at end of file diff --git a/projects/bancor/index.js b/projects/bancor/index.js index 499ad191f52..d73bdfdd7e9 100644 --- a/projects/bancor/index.js +++ b/projects/bancor/index.js @@ -1,8 +1,9 @@ +const ADDRESSES = require('../helper/coreAssets.json') const abi = require('./abi.json'); const sdk = require('@defillama/sdk'); const { sumTokens } = require('../helper/unwrapLPs'); -const ethAddress = '0x0000000000000000000000000000000000000000'; +const ethAddress = ADDRESSES.null; const ethReserveAddresses = ['0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee']; async function generateCallsByBlockchain(block) { diff --git a/projects/bancor/v3.js b/projects/bancor/v3.js index 8cb6722c6b8..37fbea3109b 100644 --- a/projects/bancor/v3.js +++ b/projects/bancor/v3.js @@ -1,8 +1,9 @@ +const ADDRESSES = require('../helper/coreAssets.json') const abi = require('./abi.json'); const sdk = require('@defillama/sdk'); const { sumTokens } = require('../helper/unwrapLPs'); -const ethAddress = '0x0000000000000000000000000000000000000000'; +const ethAddress = ADDRESSES.null; const ethReserveAddresses = ['0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee']; const bancor = '0x1f573d6fb3f13d689ff844b4ce37794d79a7ff1c' diff --git a/projects/bank-of-chain/index.js b/projects/bank-of-chain/index.js index 48c2ee5ab97..c59769e96cf 100644 --- a/projects/bank-of-chain/index.js +++ b/projects/bank-of-chain/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') // const BigNumber = require("bignumber.js"); // const utils = require('../helper/utils'); // const { toUSDTBalances } = require('../helper/balances'); @@ -7,8 +8,8 @@ const risk_off_abi = require("./risk_off_vault_abi.json"); const RISK_OFF_USD_VAULT = "0x30D120f80D60E7b58CA9fFaf1aaB1815f000B7c3" const RISK_OFF_ETH_VAULT = "0x8f0Cb368C63fbEDF7a90E43fE50F7eb8B9411746" -const usdtAddress = "0xdac17f958d2ee523a2206206994597c13d831ec7"; -const ethAddress = '0x0000000000000000000000000000000000000000'; +const usdtAddress = ADDRESSES.ethereum.USDT; +const ethAddress = ADDRESSES.null; const chains = { ethereum: 1, diff --git a/projects/bank-of-chain/risk_off_vault_abi.json b/projects/bank-of-chain/risk_off_vault_abi.json index a478a2a5c2f..dda88359cae 100644 --- a/projects/bank-of-chain/risk_off_vault_abi.json +++ b/projects/bank-of-chain/risk_off_vault_abi.json @@ -1,15 +1,3 @@ { - "totalAssets":{ - "inputs": [], - "name": "totalAssets", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } + "totalAssets": "uint256:totalAssets" } \ No newline at end of file diff --git a/projects/bao-baskets/index.js b/projects/bao-baskets/index.js new file mode 100644 index 00000000000..ac8e32cc50e --- /dev/null +++ b/projects/bao-baskets/index.js @@ -0,0 +1,39 @@ +const sdk = require("@defillama/sdk"); +const { sumTokensExport, } = require("../helper/unwrapLPs"); +const { staking } = require("../helper/staking.js"); + +// veBao +const veBaoAddress = "0x8Bf70DFE40F07a5ab715F7e888478d9D3680a2B6"; +const baoAddress = "0xCe391315b414D4c7555956120461D21808A69F3A"; + +const basketTvl = async (_, _1, _2, { api }) => { + const baskets = [ + "0x5ee08f40b637417bcC9d2C51B62F4820ec9cF5D8", // bSTBL + ] + const supplies = await api.multiCall({ abi: 'uint256:totalSupply', calls: baskets}) + const amounts = await api.multiCall({ abi: 'function calcTokensForAmount(uint256 _amount) view returns (address[] tokens, uint256[] amounts)', calls: baskets.map((b, i) => ({ target: b, params: supplies[i]}))}) + const balances = {} + amounts.forEach(({ tokens, amounts}) => { + tokens.forEach((t, i) => sdk.util.sumSingleBalance(balances,t,amounts[i], api.chain)) + }) + return balances +} + +module.exports = { + start: 1640995200, // Jan 1 2022 00:00:00 GMT+0000 + ethereum: { + tvl: basketTvl, + pool2: sumTokensExport({ + tokensAndOwners: [ + ['0x8d7443530d6B03c35C9291F9E43b1D18B9cFa084', '0xe7f3a90AEe824a55B0F8969b6e29698966EE0191'], // Uni v2 gauge + ['0x7657Ceb382013f1Ce9Ac7b08Dd8db4F28D3a7538', '0x675F82DF9e2fC99F8E18D0134eDA68F9232c0Af9'], // curve bSTBL-DAI + ['0x0FaFaFD3C393ead5F5129cFC7e0E12367088c473', '0x0a39eE038AcA8363EDB6876d586c5c7B9336a562'], // curve baoUSD-3crv + ] + }), + staking: staking(veBaoAddress, baoAddress) + }, + hallmarks: [ + [1668898307, "baoV2 deployment"], + [1672272000, "baoV2 emission start"] + ] +}; \ No newline at end of file diff --git a/projects/bao-markets/index.js b/projects/bao-markets/index.js new file mode 100644 index 00000000000..d92caa764f2 --- /dev/null +++ b/projects/bao-markets/index.js @@ -0,0 +1,11 @@ +const { nullAddress, } = require("../helper/unwrapLPs"); +const { compoundExports } = require("../helper/compound"); + +// BaoMarkets +const comptroller = "0x0Be1fdC1E87127c4fe7C05bAE6437e3cf90Bf8d8"; + +const compoundTvl = compoundExports(comptroller, undefined, '0xf635fdf9b36b557bd281aa02fdfaebec04cd084a', nullAddress, undefined, undefined, { blacklistedTokens: ['0xe7a52262c1934951207c5fc7a944a82d283c83e5', '0xc0601094C0C88264Ba285fEf0a1b00eF13e79347', ]}) + +module.exports = { + ethereum: compoundTvl +}; \ No newline at end of file diff --git a/projects/bao-usd/index.js b/projects/bao-usd/index.js new file mode 100644 index 00000000000..5c711a5b08d --- /dev/null +++ b/projects/bao-usd/index.js @@ -0,0 +1,8 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport, } = require("../helper/unwrapLPs"); + +module.exports = { + ethereum: { + tvl: sumTokensExport({ tokens: [ADDRESSES.ethereum.DAI], owner: '0x720282bb7e721634c95f0933636de3171dc405de'}), + } +}; \ No newline at end of file diff --git a/projects/bao/abi.json b/projects/bao/abi.json index 337a552f281..78ec70a66f9 100644 --- a/projects/bao/abi.json +++ b/projects/bao/abi.json @@ -1,49 +1,4 @@ { - "poolInfo": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "poolInfo", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "lpToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "allocPoint", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastRewardBlock", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accBaoPerShare", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "poolLength": { - "inputs": [], - "name": "poolLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } + "poolInfo": "function poolInfo(uint256) view returns (address lpToken, uint256 allocPoint, uint256 lastRewardBlock, uint256 accBaoPerShare)", + "poolLength": "uint256:poolLength" } \ No newline at end of file diff --git a/projects/baoswap/index.js b/projects/baoswap/index.js new file mode 100644 index 00000000000..cf0d6f5724f --- /dev/null +++ b/projects/baoswap/index.js @@ -0,0 +1,3 @@ +const { uniTvlExport } = require('../helper/unknownTokens') + +module.exports = uniTvlExport('xdai', '0x45DE240fbE2077dd3e711299538A09854FAE9c9b', true) \ No newline at end of file diff --git a/projects/baptswap/index.js b/projects/baptswap/index.js new file mode 100644 index 00000000000..112e1562a59 --- /dev/null +++ b/projects/baptswap/index.js @@ -0,0 +1,9 @@ +const { dexExport } = require('../helper/chain/aptos') + +// fetch data from BaptSwap resource account +module.exports = dexExport({ + account: '0x2ad8f7e64c7bffcfe94d7dea84c79380942c30e13f1b12c7a89e98df91d0599b', + poolStr: 'swap::TokenPairMetadata', + token0Reserve: i => i.data.balance_x.value, + token1Reserve: i => i.data.balance_y.value, +}) \ No newline at end of file diff --git a/projects/barnbridge/index.js b/projects/barnbridge/index.js index 40de6d511e2..2115149ee74 100644 --- a/projects/barnbridge/index.js +++ b/projects/barnbridge/index.js @@ -1,187 +1,32 @@ -const sdk = require('@defillama/sdk'); -const BigNumber = require('bignumber.js'); -const { get } = require('../helper/http') +const { getLogs } = require('../helper/cache/getLogs') +const { getUniqueAddresses } = require('../helper/utils') -const syPoolAPIs = { - 'ethereum': 'https://api-v2.nz.barnbridge.com/api/smartyield/pools', - 'polygon': 'https://prod-poly-v2.api.nz.barnbridge.com/api/smartyield/pools', -} -const saPoolAPIs = { - 'ethereum': 'https://api-v2.nz.barnbridge.com/api/smartalpha/pools', - 'polygon': 'https://prod-poly-v2.api.nz.barnbridge.com/api/smartalpha/pools', - 'avax': 'https://prod-avalanche.api.nz.barnbridge.com/api/smartalpha/pools', - 'arbitrum': 'https://prod-arbitrum.api.nz.barnbridge.com/api/smartalpha/pools', - 'optimism': 'https://prod-optimistic.api.nz.barnbridge.com/api/smartalpha/pools', - 'bsc': 'https://prod-bsc.api.nz.barnbridge.com/api/smartalpha/pools', -} - -const STK_AAVE_ADDRESS = '0x4da27a545c0c5b758a6ba100e3a049001de870f5'; -const AAVE_ADDRESS = '0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9'; - -async function fetchSyPools(apiUrl) { - const { data } = await get(apiUrl) - return data -} - -async function fetchSaPools(apiUrl) { - const { data } = await get(apiUrl) - return data -} - -function syGetUnderlyingTotal(chain, smartYieldAddress, block) { - return sdk.api.abi.call({ - abi: { - name: "underlyingTotal", - type: "function", - stateMutability: "view", - constant: true, - payable: false, - inputs: [], - outputs: [ - { - name: "total", - type: "uint256", - internalType: "uint256", - }, - ], - }, - target: smartYieldAddress, - chain, - block, - }).then(({ output }) => new BigNumber(output)); -} - -function saGetEpochBalance(chain, smartAlphaAddress, block) { - return sdk.api.abi.call({ - abi: { - name: "epochBalance", - type: "function", - stateMutability: "view", - constant: true, - payable: false, - inputs: [], - outputs: [ - { - name: "balance", - type: "uint256", - internalType: "uint256", - }, - ], - }, - target: smartAlphaAddress, - chain, - block, - }).then(({ output }) => new BigNumber(output)); -} - -function saGetQueuedJuniorsUnderlyingIn(chain, smartAlphaAddress, block) { - return sdk.api.abi.call({ - abi: { - name: "queuedJuniorsUnderlyingIn", - type: "function", - stateMutability: "view", - constant: true, - payable: false, - inputs: [], - outputs: [ - { - name: "amount", - type: "uint256", - internalType: "uint256", - }, - ], - }, - target: smartAlphaAddress, - chain, - block, - }).then(({ output }) => new BigNumber(output)); -} - -function saGetQueuedSeniorsUnderlyingIn(chain, smartAlphaAddress, block) { - return sdk.api.abi.call({ - abi: { - name: "queuedSeniorsUnderlyingIn", - type: "function", - stateMutability: "view", - constant: true, - payable: false, - inputs: [], - outputs: [ - { - name: "amount", - type: "uint256", - internalType: "uint256", - }, - ], - }, - target: smartAlphaAddress, - chain, - block, - }).then(({ output }) => new BigNumber(output)); -} - -function resolveAddress(address) { - switch (address) { - case STK_AAVE_ADDRESS: - return AAVE_ADDRESS; - default: - return address; - } +const config = { + ethereum: { factory: '0xc67cb09d08521cD1dE6BAAC46824261eb1dB8800', fromBlock: 16828337, }, + arbitrum: { factory: '0xf878a060D4d51704B14e8f68B51185bF5DbFE3A1', fromBlock: 69857947, }, + optimism: { factory: '0x45c158E0ee76c76E525BaB941991268249e95331', fromBlock: 80641123, }, } module.exports = { - start: 1615564559, // Mar-24-2021 02:17:40 PM +UTC - doublecounted: true, - timetravel: false, - misrepresentedTokens: true, - hallmarks: [ - [1612789200, "BOND staking pool end"], - [1618228800, "Stablecoin pool end"], - [1617210000, "SMART Yield incentive program start"], - [1632330000, "SMART Yield incentive program end"], - [1664193600, "BOND/USDC rewards end"], - ], }; -const chains = ['ethereum', 'polygon', 'arbitrum', 'optimism', 'bsc', 'avax'] - -chains.forEach(chain => { +Object.keys(config).forEach(chain => { + const { factory, fromBlock, } = config[chain] module.exports[chain] = { - tvl: async (_, _t, { [chain]: block }) => { - const balances = {}; - - if (syPoolAPIs[chain]) { - // calculate TVL from SmartYield pools - const syPools = await fetchSyPools(syPoolAPIs[chain]); - - // calculate TVL from SmartYield pools - await Promise.all(syPools.map(async syPool => { - const { smartYieldAddress, underlyingAddress } = syPool; - const underlyingTotal = await syGetUnderlyingTotal(chain, smartYieldAddress, block); - - sdk.util.sumSingleBalance(balances, chain + ':' + resolveAddress(underlyingAddress), underlyingTotal.toFixed(0)); - })); - }; - if (chain in saPoolAPIs) { - // calculate TVL from SmartAlpha pools - const saPools = await fetchSaPools(saPoolAPIs[chain]); - - await Promise.all(saPools.map(async saPool => { - const { poolAddress, poolToken } = saPool; - const [epochBalance, queuedJuniorsUnderlyingIn, queuedSeniorsUnderlyingIn] = await Promise.all([ - saGetEpochBalance(chain, poolAddress, block), - saGetQueuedJuniorsUnderlyingIn(chain, poolAddress, block), - saGetQueuedSeniorsUnderlyingIn(chain, poolAddress, block), - ]); - - const underlyingTotal = epochBalance - .plus(queuedJuniorsUnderlyingIn) - .plus(queuedSeniorsUnderlyingIn); - sdk.util.sumSingleBalance(balances, chain + ':' + resolveAddress(poolToken.address), underlyingTotal.toFixed(0)); - })); - }; - - return balances; + tvl: async (_, _b, _cb, { api, }) => { + const logs = await getLogs({ + api, + target: factory, + topics: ['0x4f2ce4e40f623ca765fc0167a25cb7842ceaafb8d82d3dec26ca0d0e0d2d4896'], + eventAbi: 'event PoolCreated(address indexed controller, address provider)', + onlyArgs: true, + fromBlock, + }) + const providers = getUniqueAddresses(logs.map(i => i.provider)) + const tokens = await api.multiCall({ abi: 'address:underlying', calls: providers}) + const balances = await api.multiCall({ abi: 'uint256:underlyingBalance', calls: providers}) + api.addTokens(tokens, balances) + return api.getBalances() } } -}) \ No newline at end of file +}) diff --git a/projects/barnswap/index.js b/projects/barnswap/index.js index 72a523a1e5a..ad0e957ae47 100644 --- a/projects/barnswap/index.js +++ b/projects/barnswap/index.js @@ -5,7 +5,6 @@ module.exports = { muuchain: { tvl: getUniTVL({ factory: '0x058f3f7857d47326021451b6b67c3e92838a6edc', - chain: 'muuchain', useDefaultCoreAssets: true, }) }, diff --git a/projects/baryon/index.js b/projects/baryon/index.js index b6f1435d2df..326fd473442 100644 --- a/projects/baryon/index.js +++ b/projects/baryon/index.js @@ -4,7 +4,6 @@ module.exports = { bsc: { misrepresentedTokens: true, tvl: getUniTVL({ - chain: 'bsc', factory: '0x03879e2a3944fd601e7638dfcbc9253fb793b599', useDefaultCoreAssets: true, }) diff --git a/projects/based-finance/basedV2.js b/projects/based-finance/basedV2.js index a51eca85dcf..5b4b8b2f73d 100644 --- a/projects/based-finance/basedV2.js +++ b/projects/based-finance/basedV2.js @@ -1,38 +1,23 @@ -const sdk = require("@defillama/sdk"); +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens2, nullAddress, } = require("../helper/unwrapLPs"); const { stakings } = require("../helper/staking"); const chain = 'fantom' //BASED V2 -const obol = "0x1539C63037D95f84A5981F96e43850d1451b6216"; const smelt = "0x141FaA507855E56396EAdBD25EC82656755CD61e"; const BoardroomV2 = "0x8ff9eFB99D522fAC6a21363b7Ca54d25477637F6"; -const SmeltRewardPool = "0x66d1C92f2319C67DA822BAe1Ef33b2C85C391a7b"; -const usdc = "0x04068DA6C83AFCFA0e13ba15A6696662335D5B75"; -const usdcFtmLp = "0x2b4C76d0dc16BE1C31D4C1DC53bF9B45987Fc75c"; -const wftm = "0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83"; -const godNft = '0xc5777AD2250D7b12a3f2383afB4464b9E49bE297'; +const usdc = ADDRESSES.fantom.USDC; +const wftm = ADDRESSES.fantom.WFTM; const treasuryAddress = '0x0A10daD90b9C6FB8B87BFf3857A4B012890C53A5'; -const WFTM_SMELT_LP = '0x02e060a4b8453c5da554d66c2035e3163d453daa' -const WFTM_OBOL_LP = '0x47fce13359ac80cc1fc98d46688701b2bb54300c' //BASED V2 Twisted Nodes const shortNodes = "0xAEbfF260074782a3DfD8981352b44767A05fa2eD"; const mediumNodes = "0x525ca3877a78c6AE12292D0a55765775e3943379"; const longNodes = "0x62A2Ff4BcCC5dD5316C358cDF079EC5e5c0851fe"; -async function pool2(_, _b, {fantom: block }) { - return sumTokens2({ owner: SmeltRewardPool, tokens: [ - WFTM_SMELT_LP, - WFTM_OBOL_LP, - ], block, chain, }) -} - async function treasury(_, _b, { fantom: block }) { return sumTokens2({ owner: treasuryAddress, tokens: [ usdc, - WFTM_SMELT_LP, - WFTM_OBOL_LP, wftm, nullAddress, ], block, chain, }) @@ -41,9 +26,7 @@ async function treasury(_, _b, { fantom: block }) { module.exports = { fantom: { tvl: async () => ({}), - pool2, treasury, staking: stakings([BoardroomV2, shortNodes, mediumNodes, longNodes, ], smelt, "fantom"), }, -}; - +}; \ No newline at end of file diff --git a/projects/based-finance/index.js b/projects/based-finance/index.js index 093ead72b75..565b4f73fc7 100644 --- a/projects/based-finance/index.js +++ b/projects/based-finance/index.js @@ -1,75 +1,38 @@ -const sdk = require("@defillama/sdk"); -const { mergeExports } = require('../helper/utils') +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens2, } = require("../helper/unwrapLPs"); const { staking } = require("../helper/staking"); -const basedV2Exports = require('./basedV2') +const { getUniTVL } = require("../helper/unknownTokens") const chain = 'fantom' -const bshareRewardPoolAddress = "0xac0fa95058616d7539b6eecb6418a68e7c18a746"; const acropolisAddress = "0xe5009dd5912a68b0d7c6f874cd0b4492c9f0e5cd"; const treasuryAddress = "0xa0e0f462d66de459711bc721ce1fdcc3d9405831"; // Token Addresses const basedTokenAddress = "0x8d7d3409881b51466b483b11ea1b8a03cded89ae"; const bshareTokenAddress = "0x49c290ff692149a4e16611c694fded42c954ab7a"; -const tombAddress = "0x6c021ae822bea943b2e66552bde1d2696a53fbb7"; -const usdcAddress = "0x04068da6c83afcfa0e13ba15a6696662335d5b75"; -const usdtAddress = "0x049d68029688eAbF473097a2fC38ef61633A3C7A"; +const usdcAddress = ADDRESSES.fantom.USDC; +const usdtAddress = ADDRESSES.fantom.fUSDT; const maiAddress = "0xfB98B335551a418cD0737375a2ea0ded62Ea213b"; -const wftmAddress = "0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83"; -const tshareAddress = "0x4cdF39285D7Ca8eB3f090fDA0C069ba5F4145B37"; - -// LP Addresses -const basedTombLpAddress = "0xab2ddcbb346327bbdf97120b0dd5ee172a9c8f9e"; -const bshareFtmLpAddress = "0x6f607443dc307dcbe570d0ecff79d65838630b56"; -const basedBshareLpAddress = "0x5748b5Dd1f59342f85d170c48C427959c2f9f262"; -const basedMaiTSwapLpAddress = "0x7B5B3751550be4FF87aC6bda89533F7A0c9825B3"; -const basedTombTSwapLpAddress = "0x172BFaA8991A54ABD0b3EE3d4F8CBDab7046FF79"; -const basedUsdcTSwapLpAddress = "0x7c849a7E2cb08f09cf37482cc0A04ecB5891844a"; -const g3CrvAddress = "0xd02a30d33153877bc20e5721ee53dedee0422b2f"; -const crv3CryptoAddress = "0x58e57cA18B7A47112b877E31929798Cd3D703b0f"; - -const poolLPs = [ - basedTombLpAddress, - bshareFtmLpAddress, - basedBshareLpAddress, - basedMaiTSwapLpAddress, - basedTombTSwapLpAddress, - basedUsdcTSwapLpAddress, - g3CrvAddress, - crv3CryptoAddress, -]; +const wftmAddress = ADDRESSES.fantom.WFTM; const treasuryTokens = [ - basedBshareLpAddress, - basedMaiTSwapLpAddress, - basedTombTSwapLpAddress, - basedUsdcTSwapLpAddress, - g3CrvAddress, - crv3CryptoAddress, - tombAddress, usdcAddress, usdtAddress, - wftmAddress, - // basedTokenAddress, - // bshareTokenAddress, - tshareAddress, maiAddress, + wftmAddress, ]; -async function pool2(_, _b, {fantom: block }) { - return sumTokens2({ owner: bshareRewardPoolAddress, tokens: poolLPs, block, chain, }) -} - async function treasury(_, _b, { fantom: block }) { return sumTokens2({ owner: treasuryAddress, tokens: treasuryTokens, block, chain, }) } module.exports = { - methodology: "Pool2 deposits consist of BASED/TOMB, BSHARE/FTM LP, g3CRV (geist stable LP on Curve) receipt tokens while the staking TVL consists of the BSHARES tokens locked within the Acropolis contract. Treasury consists of deposit fees accumulated from genesis pools as well as g3CRV pool", + methodology: "Pool2 deposits consist of BASED/FTM LP, BSHARE/FTM LP, BBOND single stake pool while the staking TVL consists of the BSHARES tokens locked within the Acropolis contract. Treasury consists of accumulated revenue from native and non-native assets", fantom: { - tvl: async () => ({}), - pool2, + tvl: getUniTVL({ + factory: '0x407C47E3FDB7952Ee53aa232B5f28566A024A759', + useDefaultCoreAssets: true, + }), staking: staking(acropolisAddress, bshareTokenAddress, "fantom"), treasury }, @@ -77,4 +40,4 @@ module.exports = { module.exports.hallmarks = [ [Math.floor(new Date('2022-09-30')/1e3), 'Added Based V2'], -] +] \ No newline at end of file diff --git a/projects/baseswap/index.js b/projects/baseswap/index.js new file mode 100644 index 00000000000..0080ffa9b8f --- /dev/null +++ b/projects/baseswap/index.js @@ -0,0 +1,14 @@ +const { getUniTVL } = require('../helper/unknownTokens') +const BSWAP = "0x78a087d713Be963Bf307b18F2Ff8122EF9A63ae9"; +const FACTORY = "0xFDa619b6d20975be80A10332cD39b9a4b0FAa8BB" + +const dexTVL = getUniTVL({ factory: FACTORY, useDefaultCoreAssets: true, fetchBalances: true, }) + + +module.exports = { + misrepresentedTokens: true, + methodology: `Uses factory(${FACTORY}) address and whitelisted tokens address to find and price Liquidity Pool pairs. We also have our native token $ARX staking.`, + base: { + tvl: dexTVL, + } +}; diff --git a/projects/basilisk/index.js b/projects/basilisk/index.js new file mode 100644 index 00000000000..2dd0f26c6e0 --- /dev/null +++ b/projects/basilisk/index.js @@ -0,0 +1,9 @@ +const { compoundExports2 } = require('../helper/compound'); + +module.exports = { + era: compoundExports2({ + comptroller: '0x4085f99720e699106bc483dAb6CAED171EdA8D15', + cether: '0x1e8F1099a3fe6D2c1A960528394F4fEB8f8A288D', + fetchBalances: true, + }) +}; \ No newline at end of file diff --git a/projects/basketdao/index.js b/projects/basketdao/index.js index 8ac0f53601c..d249a096c6c 100644 --- a/projects/basketdao/index.js +++ b/projects/basketdao/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const {unwrapUniswapLPs} = require('../helper/unwrapLPs') const BigNumber = require('bignumber.js') @@ -7,11 +8,11 @@ const dpiEthToken = '0x4d5ef58aAc27d99935E5b6B4A6778ff292059991' const bDPISLP = '0x8d782C5806607E9AAFB2AC38c1DA3838Edf8BD03' const bDPIToken = '0x0309c98B1bffA350bcb3F9fB9780970CA32a5060' const masterChef = '0xDB9daa0a50B33e4fe9d0ac16a1Df1d335F96595e' -const weth = '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2' +const weth = ADDRESSES.ethereum.WETH const continuousMigrator = '0x3f436dE9ef3f07b770c4DB45F60f9f1d323Bbf36' const bmiToken = "0x0aC00355F80E289f53BF368C9Bdb70f5c114C44B"; -const daiToken = '0x6b175474e89094c44da98b954eedeac495271d0f' +const daiToken = ADDRESSES.ethereum.DAI async function tvl(timestamp, block) { let balances = {}; diff --git a/projects/bastion/abi.json b/projects/bastion/abi.json index 5a4dd94adb9..cb2a578197e 100644 --- a/projects/bastion/abi.json +++ b/projects/bastion/abi.json @@ -1,23 +1,3 @@ { - "balanceOfUnderlying": { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - } - ], - "name": "balanceOfUnderlying", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - } -} + "balanceOfUnderlying": "function balanceOfUnderlying(address owner) returns (uint256)" +} \ No newline at end of file diff --git a/projects/baton/index.js b/projects/baton/index.js new file mode 100644 index 00000000000..fb3a9a0170f --- /dev/null +++ b/projects/baton/index.js @@ -0,0 +1,42 @@ +const { getLogs } = require("../helper/cache/getLogs"); +const { nullAddress } = require("../helper/tokenMapping"); + +async function tvl(timestamp, blockHeight, _2, { api }) { + const batonFactory = "0xEB8D09235255b37fBC810df41Fa879225c04639a"; + + // get all the farms from the factory + const logs = await getLogs({ + api, + target: batonFactory, + topic: "FarmCreated(address,address,address,address,address,uint256,uint8)", + fromBlock: 17411300, + eventAbi: + "event FarmCreated(address farmAddress, address owner, address rewardsDistributor, address rewardsToken, address pairAddress, uint256 rewardsDuration, uint8 farmType)", + onlyArgs: true + }); + + // filter any farms where the reward token is not fractional nfts or the underlying pair is not paired with eth + let filteredLogs = logs.filter(i => i.farmType === 2) + const baseTokens = await api.multiCall({ abi: 'address:baseToken', calls: filteredLogs.map(i => i.pairAddress) }) + const filteredFarms = filteredLogs.filter((i, idx) => baseTokens[idx] = nullAddress) + + const farms = filteredFarms.map(i => i.farmAddress) + const pairs = filteredFarms.map(i => i.pairAddress) + const rewardTokens = filteredFarms.map(i => i.rewardsToken) + const totalSupplies = await api.multiCall({ abi: 'uint256:totalSupply', calls: farms }) + const prices = await api.multiCall({ abi: 'uint256:price', calls: rewardTokens }) + const baseTokenAmounts = (await api.multiCall({ abi: "function removeQuote(uint256) view returns (uint256,uint256)", calls: pairs.map((v, i) => ({ target: v, params: [totalSupplies[i]] })) })).map(i => i[0]) + const rewardBalances = (await api.multiCall({ abi: "erc20:balanceOf", calls: rewardTokens.map((v, i) => ({ target: v, params: [farms[i]] })) })) + baseTokenAmounts.forEach(i => api.add(nullAddress, i * 2)); + rewardBalances.forEach((v, i) => api.add(nullAddress, (prices[i] * v) / 1e18)); +} + +module.exports = { + misrepresentedTokens: true, + methodology: + "Sums the total staked in baton farms and the total amount of tokens deposited as yield farming rewards.", + start: 17411300, + ethereum: { + tvl + } +}; diff --git a/projects/baymax/index.js b/projects/baymax/index.js new file mode 100644 index 00000000000..9ac0673d503 --- /dev/null +++ b/projects/baymax/index.js @@ -0,0 +1,15 @@ +const {staking} = require('../helper/staking') +const { gmxExports } = require('../helper/gmx') + + +//Avalanche +const avalancheVault = '0x6De10cA248723Ea0B8c2dC72920C3B2bB417dAb4' +const avalancheStaking = '0x42526FaAf9400c08DA7CE713388eed29273d65dE' +const avalancheBAY = '0x18706c65b12595EDB43643214EacDb4F618DD166' + +module.exports = { + avax:{ + staking: staking(avalancheStaking, avalancheBAY), + tvl: gmxExports({ vault: avalancheVault, }) + } +}; diff --git a/projects/bayswap/index.js b/projects/bayswap/index.js new file mode 100644 index 00000000000..f87d419bd6e --- /dev/null +++ b/projects/bayswap/index.js @@ -0,0 +1,40 @@ +const { dexExport } = require('../helper/chain/sui'); + +const enrichPrefixZero = (type_) => { + const parts = type_.split('::'); + if (parts.length !== 3) { + return parts.join('::'); + } + if (parts[0].length === 65) { + parts[0] = '0x0' + parts[0].slice(2); + } + + return parts.join('::'); +}; + +const parsingPoolTypes = (types_) => { + const t = types_.substring(types_.lastIndexOf('<') + 1, types_.lastIndexOf('>')); + const slice = t.replaceAll(' ', '').split(','); + if (slice.length < 3) { + throw new Error('invalid pool type'); + } + + return { + coinXType: enrichPrefixZero(slice[0]), + coinYType: enrichPrefixZero(slice[1]), + curveType: enrichPrefixZero(slice[2]), + }; +}; + +const getTokens = (pool) => { + const {coinXType, coinYType} = parsingPoolTypes(pool.type) + return [coinXType, coinYType] +}; + +module.exports = dexExport({ + account: '0x72b55bab9064f458451ccf0157e2e0317bcd9b210476b9954081c44ee07b7702', + poolStr: 'liquidity_pool::LiquidityPool', + token0Reserve: i => i.fields.coin_x_reserve, + token1Reserve: i => i.fields.coin_y_reserve, + getTokens +}); diff --git a/projects/bchpad/index.js b/projects/bchpad/index.js index b1891fe0078..b1c5f67a594 100644 --- a/projects/bchpad/index.js +++ b/projects/bchpad/index.js @@ -1,10 +1,11 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens2 } = require('../helper/unwrapLPs') const chain = "smartbch" // token contracts const BPAD = "0x9192940099fDB2338B928DE2cad9Cd1525fEa881" -const CATS = "0x265bD28d79400D55a1665707Fa14A72978FA6043" +const CATS = ADDRESSES.smartbch._CATS // tvl pools const BPAD_POOL = "0xc39f046a0E2d081e2D01558269D1e3720D2D2EA1" // BPAD single asset pool, ended diff --git a/projects/beamer/index.js b/projects/beamer/index.js new file mode 100644 index 00000000000..b4947a33614 --- /dev/null +++ b/projects/beamer/index.js @@ -0,0 +1,31 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport, nullAddress } = require('../helper/unwrapLPs') + +const config = { + arbitrum: { + owner: '0x6d00f6994f36ec1a3bd008dbbc84dfa46a939001', + tokens: [ + nullAddress, + ADDRESSES.arbitrum.USDC, + ADDRESSES.optimism.DAI, + ] + }, + optimism: { + owner: '0x0b3c3dcf4c9db39b810f306e55cd14aed5c19c0b', + tokens: [ + nullAddress, + ADDRESSES.optimism.USDC, + ADDRESSES.optimism.DAI, + ] + } +} + +module.exports = { +}; + +Object.keys(config).forEach(chain => { + const { owner, tokens, } = config[chain] + module.exports[chain] = { + tvl: sumTokensExport({ tokens, owner, }) + } +}) \ No newline at end of file diff --git a/projects/beamex/index.js b/projects/beamex/index.js new file mode 100644 index 00000000000..5fa70476e30 --- /dev/null +++ b/projects/beamex/index.js @@ -0,0 +1,7 @@ +const { gmxExports } = require('../helper/gmx') + +module.exports = { + moonbeam: { + tvl: gmxExports({ vault: '0x73197B461eA369b36d5ee96A1C9f090Ef512be21', }) + }, +} \ No newline at end of file diff --git a/projects/beamswap-stableswap/index.js b/projects/beamswap-stableswap/index.js new file mode 100644 index 00000000000..76c6918a2b6 --- /dev/null +++ b/projects/beamswap-stableswap/index.js @@ -0,0 +1,25 @@ +const { sumTokens2 } = require('../helper/unwrapLPs') + +const abi = { + getTokens: "address[]:getTokens", +} + +async function tvl(_, _b, _2, { api }) { + const pools = [ + '0x8273De7090C7067f3aE1b6602EeDbd2dbC02C48f', // multichain 3 pool + '0x09A793cCa9D98b14350F2a767Eb5736AA6B6F921', // nomad 3 pool + ] + + const tokens = await api.multiCall({ + abi: abi.getTokens, calls: pools, + }) + + const ownerTokens = tokens.map((v, i) => [v, pools[i]]) + return sumTokens2({ api, ownerTokens, }) +} + +module.exports = { + moonbeam: { + tvl, + } +} diff --git a/projects/beamswap-v3/index.js b/projects/beamswap-v3/index.js new file mode 100644 index 00000000000..890183f7f80 --- /dev/null +++ b/projects/beamswap-v3/index.js @@ -0,0 +1,5 @@ +const { uniV3Export } = require('../helper/uniswapV3') + +module.exports = uniV3Export({ + moonbeam: { factory: '0xd118fa707147c54387b738f54838ea5dd4196e71', fromBlock: 3579833 }, +}) diff --git a/projects/beamswap/index.js b/projects/beamswap/index.js index 34080f68fe1..3685455e3eb 100644 --- a/projects/beamswap/index.js +++ b/projects/beamswap/index.js @@ -1,87 +1,21 @@ -const sdk = require('@defillama/sdk') +const ADDRESSES = require('../helper/coreAssets.json') const { getUniTVL } = require('../helper/unknownTokens') -const { sumTokens2 } = require('../helper/unwrapLPs') const { staking } = require('../helper/staking') -const GLINT_TOKEN = "0xcd3B51D98478D53F4515A306bE565c6EebeF1D58" +const GLINT_TOKEN = ADDRESSES.moonbeam.GLINT const SHARE_CONTRACT = "0x4204cAd97732282d261FbB7088e07557810A6408" -const chain = 'moonbeam' - -async function stablePoolTVL(_, _b, { [chain]: block }) { - const pools = [ - '0x8273De7090C7067f3aE1b6602EeDbd2dbC02C48f', // multichain 3 pool - '0x09A793cCa9D98b14350F2a767Eb5736AA6B6F921', // nomad 3 pool - ] - - let { output: lpTokens } = await sdk.api.abi.multiCall({ - abi: abi.getLpToken, - calls: pools.map(i => ({ target: i })), - chain, block, - }) - - lpTokens = lpTokens.map(i => i.output.toLowerCase()) - - const { output: tokens } = await sdk.api.abi.multiCall({ - abi: abi.getTokens, - calls: pools.map(i => ({ target: i })), - chain, block, - }) - - const toa = [] - tokens.forEach(res => { - res.output.forEach(t => { - if (lpTokens.includes(t.toLowerCase())) return; - toa.push([t, res.input.target]) - }) - }) - - return sumTokens2({ tokensAndOwners: toa, chain, block, }) -} const dexTVL = getUniTVL({ factory: "0x985BcA32293A7A496300a48081947321177a86FD", - chain: "moonbeam", useDefaultCoreAssets: true, }) - module.exports = { misrepresentedTokens: true, - timetravel: true, - incentivized: true, methodology: "Factory address (0x985BcA32293A7A496300a48081947321177a86FD) is used to find the LP pairs. TVL is equal to the liquidity on the AMM & Staking balance is equal to the amount of GLINT staked within the SHARE token contract(0x4204cAd97732282d261FbB7088e07557810A6408)", moonbeam: { - tvl: sdk.util.sumChainTvls([dexTVL, stablePoolTVL]), - staking: staking(SHARE_CONTRACT, GLINT_TOKEN, 'moonbeam') + tvl: dexTVL, + staking: staking(SHARE_CONTRACT, GLINT_TOKEN) }, }; - -const abi = { - getTokens: { - "inputs": [], - "name": "getTokens", - "outputs": [ - { - "internalType": "contract IERC20[]", - "name": "", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - getLpToken: { - "inputs": [], - "name": "getLpToken", - "outputs": [ - { - "internalType": "contract LPToken", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, -} \ No newline at end of file diff --git a/projects/bean/bean-utils.js b/projects/bean/bean-utils.js deleted file mode 100644 index 3ae7a98f655..00000000000 --- a/projects/bean/bean-utils.js +++ /dev/null @@ -1,100 +0,0 @@ -const sdk = require('@defillama/sdk'); -const BigNumber = require("bignumber.js"); - -const bean_abi = { - "totalDepositedBeans": { - "inputs": [], - "name": "totalDepositedBeans", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "totalDepositedLP": { - "inputs": [], - "name": "totalDepositedLP", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getTotalDeposited": { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "name": "getTotalDeposited", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, -}; - -const crv_abi = { - "crvLP_coins": { "stateMutability": "view", "type": "function", "name": "coins", "inputs": [{ "name": "arg0", "type": "uint256" }], "outputs": [{ "name": "", "type": "address" }], "gas": 3123 } -} - -// Adapted from /helper/unwrapLPs.js genericUnwrapCrv() because it seems -// it was written for Curve V1 and tried to calc the amount of tokens in the pool -// from the Curve Pool name. In Curve V2 the name can be changed and therefore -// the old way doesn't work anymore. -// Please specify how many coins are in the pool. -async function unwrapCrvSimple(balances, crvToken, lpBalance, block, chain, numTokens) { - const { output: resolvedCrvTotalSupply } = await sdk.api.erc20.totalSupply({ - target: crvToken, - chain, block - }) - - // don't add any balances if total supply of curve pool is 0 - // avoids error later when dividing by it - if(resolvedCrvTotalSupply === "0") return; - - const LP_tokens_count = numTokens; - const coins_indices = Array.from(Array(LP_tokens_count).keys()) - const coins = (await sdk.api.abi.multiCall({ - abi: crv_abi['crvLP_coins'], - calls: coins_indices.map(i => ({ params: [i] })), - target: crvToken, - chain, - block - })).output.map(c => c.output) - const crvLP_token_balances = await sdk.api.abi.multiCall({ - abi: 'erc20:balanceOf', - calls: coins.map(c => ({ - target: c, - params: crvToken, - })), - chain, - block - }) - - // Edit the balances to weigh with respect to the wallet holdings of the crv LP token - crvLP_token_balances.output.forEach(call => - call.output = BigNumber(call.output).times(lpBalance).div(resolvedCrvTotalSupply).toFixed(0) - ) - sdk.util.sumMultiBalanceOf(balances, crvLP_token_balances); -} - -module.exports = { - bean_abi, - unwrapCrvSimple, -} \ No newline at end of file diff --git a/projects/bean/index.js b/projects/bean/index.js index b6f91b006ff..c7743075b2d 100644 --- a/projects/bean/index.js +++ b/projects/bean/index.js @@ -1,7 +1,4 @@ -const sdk = require('@defillama/sdk'); -const utils = require('../helper/utils') const { sumTokens } = require('../helper/unwrapLPs'); -const { unwrapCrvSimple } = require ("./bean-utils.js"); const BEAN_DIA_ADDR = "0xC1E088fC1323b20BCBee9bd1B9fC9546db5624C5"; @@ -17,18 +14,10 @@ const BEAN_CRV_POOLS = [ { addr: "0xc9C32cd16Bf7eFB85Ff14e0c8603cc90F6F2eE49", numToken: 2 } ]; -async function staking0(time, block) { +async function staking(time, block) { const balances = {}; // add balance of siloed Beans - await sumTokens(balances, [[NEW_BEAN_TOKEN_ADDR,BEAN_TOKEN_ADDR, BEAN_DIA_ADDR]], block) - - return balances; -} - -async function staking1(time, block) { - const balances = {}; - // add balance of siloed Beans - await sumTokens(balances, [[NEW_BEAN_TOKEN_ADDR, BEAN_DIA_ADDR]], block) + await sumTokens(balances, [[NEW_BEAN_TOKEN_ADDR,BEAN_TOKEN_ADDR,],[NEW_BEAN_TOKEN_ADDR, BEAN_DIA_ADDR] ], block) return balances; } @@ -37,27 +26,15 @@ async function pool2(time, block) { const balances = {}; // add balance of siloed BEAN:ETH from uniswap pool - await sumTokens(balances, [[BEAN_ETH_ADDR, BEAN_DIA_ADDR]], block,) + const toa = [[BEAN_ETH_ADDR, BEAN_DIA_ADDR]] // add balances of all siloed curve pools // this is the block when SiloV2Facet with getTotalDeposited() was introduced if (block >= 14218934) { - await Promise.all(BEAN_CRV_POOLS.map(async (pool) => { - const lpBalance = (await sdk.api.abi.call({ - abi: 'erc20:balanceOf', - chain: 'ethereum', - target: pool.addr, - params: BEAN_DIA_ADDR, - block: block, - })).output; - // skip if there's a balance of 0 to avoid errors when curve pool doesn't exist yet in a block number - if(lpBalance !== "0") { - await unwrapCrvSimple(balances, pool.addr, lpBalance, block, "ethereum", pool.numToken); - } - })); + BEAN_CRV_POOLS.forEach(i => toa.push([i.addr, BEAN_DIA_ADDR])) } - return balances; + return sumTokens(balances, toa, block,) } module.exports={ @@ -67,9 +44,10 @@ module.exports={ ethereum: { tvl: async () => ({}), pool2, - staking: sdk.util.sumChainTvls([staking0,staking1]) + staking, }, hallmarks: [ - [1650153600, "Governance proposal hack"] + [1650153600, "Governance proposal hack"], + [1659602715, "Replant"] ] }; \ No newline at end of file diff --git a/projects/bearfinance/index.js b/projects/bearfinance/index.js index 0dd9c22c0fe..b1f1a185fd2 100644 --- a/projects/bearfinance/index.js +++ b/projects/bearfinance/index.js @@ -1,7 +1,8 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { masterchefExports } = require('../helper/unknownTokens') const BEAR_DAI_LP = "0x9e5719236e2ce62dc286ac89ae5a0fa142ae3aa8" -const DAI = '0x6b175474e89094c44da98b954eedeac495271d0f'; +const DAI = ADDRESSES.ethereum.DAI; module.exports = masterchefExports({ @@ -9,7 +10,7 @@ module.exports = masterchefExports({ useDefaultCoreAssets: true, masterchef: "0x16a06259725e4c7dFcE648f24D3443AfB96Aa0e5", nativeToken: "0x3b1a7770A8c97dCB21c18a2E18D60eF1B01d6DeC", - poolInfoABI: {"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"poolInfo","outputs":[{"internalType":"contract IERC20","name":"lpToken","type":"address"},{"internalType":"uint256","name":"allocPoint","type":"uint256"},{"internalType":"uint256","name":"lastRewardBlock","type":"uint256"},{"internalType":"uint256","name":"accBearPerShare","type":"uint256"}],"stateMutability":"view","type":"function"} + poolInfoABI: 'function poolInfo(uint256) view returns (address lpToken, uint256 allocPoint, uint256 lastRewardBlock, uint256 accBearPerShare)' }) module.exports.deadFrom = 1648765747 \ No newline at end of file diff --git a/projects/bearnfi/abi.json b/projects/bearnfi/abi.json index 024d9dd1e61..94579bcf58c 100644 --- a/projects/bearnfi/abi.json +++ b/projects/bearnfi/abi.json @@ -1,16 +1,4 @@ { - "wantAddress": { - "inputs": [], - "name": "wantAddress", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - "wantLockedTotal": { - "inputs": [], - "name": "wantLockedTotal", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - } -} + "wantAddress": "address:wantAddress", + "wantLockedTotal": "uint256:wantLockedTotal" +} \ No newline at end of file diff --git a/projects/bearnfi/index.js b/projects/bearnfi/index.js index 6ae1d6c9184..19af898bbaa 100644 --- a/projects/bearnfi/index.js +++ b/projects/bearnfi/index.js @@ -1,19 +1,19 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const { getUniTVL } = require('../helper/unknownTokens') const { compoundExports } = require('../helper/compound') +const { getConfig } = require('../helper/cache') const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); const { getChainTransform } = require("../helper/portedTokens"); const abi = require("./abi.json"); -const abiFork = require("../inverse/abi.json"); -const utils = require("../helper/utils"); const url = "https://api.bdollar.fi/api/bvault/get-vaults"; const BDEX_FACTORY = "0x2C358A7C62cdb9D554A65A86EEa034bc55D1E715"; const COMPTROLLER = "0xEEea0D4aAd990c4ede8e064A8Cb0A627B432EDa0"; -const wBNB = "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c"; +const wBNB = ADDRESSES.bsc.WBNB; const cBNB = "0xa3948b027f94ca195eac645746435aaa7eb555a7"; const chain = 'bsc' @@ -22,7 +22,7 @@ async function yieldTVL(timestamp, chainBlocks) { // --- bVaults & bDollar TVL section, all contract addresses grab from endpoint --- // --- Sections of boardroom is not considered in TVL (bDollar Shares related) --- - let vaultsInfo = (await utils.fetchURL(url)).data.data.vaultInfos; + let vaultsInfo = (await getConfig('bearn-fi', url)).data.vaultInfos; const keys = Object.keys(vaultsInfo); @@ -87,7 +87,6 @@ async function yieldTVL(timestamp, chainBlocks) { const cExports = compoundExports(COMPTROLLER, chain, cBNB, wBNB,) const dexTVL = getUniTVL({ - chain, factory: BDEX_FACTORY, useDefaultCoreAssets: true, }) diff --git a/projects/becoswap/index.js b/projects/becoswap/index.js index ccecce6b8f5..5429048c0ec 100644 --- a/projects/becoswap/index.js +++ b/projects/becoswap/index.js @@ -10,7 +10,6 @@ module.exports = { kardia: { staking: staking(masterChef, becoToken, "kardia"), tvl: getUniTVL({ - chain: 'kardia', useDefaultCoreAssets: true, factory: '0x58b54BCDF2aF8a70dD6433EB39b308148261bB49', }) diff --git a/projects/beefy/index.js b/projects/beefy/index.js index 1c9c16934d3..45d036bf390 100644 --- a/projects/beefy/index.js +++ b/projects/beefy/index.js @@ -2,6 +2,8 @@ const utils = require('../helper/utils'); const { toUSDTBalances } = require('../helper/balances'); let _response +const distressedAssets = ['aleth']; // Add any distressed asset names here + function fetchChain(chainId, staking) { return async () => { if (!_response) _response = utils.fetchURL('https://api.beefy.finance/tvl') @@ -10,6 +12,11 @@ function fetchChain(chainId, staking) { let tvl = 0; const chain = response.data[chainId]; for (const vault in chain) { + // Skip distressed assets + if (distressedAssets.some(asset => vault.includes(asset))) { + continue; + } + const isBIFI = vault.includes("bifi") if ((isBIFI && staking) || (!isBIFI && !staking)) { tvl += Number(chain[vault]); @@ -32,10 +39,13 @@ const chains = { heco: 128, polygon: 137, fantom: 250, + zksync: 324, metis: 1088, + polygon_zkevm: 1101, moonbeam: 1284, moonriver: 1285, kava: 2222, + canto: 7700, arbitrum: 42161, celo: 42220, oasis: 42262, diff --git a/projects/beekava/index.js b/projects/beekava/index.js new file mode 100644 index 00000000000..2cb09480f26 --- /dev/null +++ b/projects/beekava/index.js @@ -0,0 +1,20 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require('../helper/unknownTokens') + +const WkavaBeekLpAddress = "0x6F95ff58Cdbf17594882E7EF948687aC81c2fEE0"; + +const ERC20ContractWkavaAddress = ADDRESSES.kava.WKAVA; +const ERC20ContractBeekAddress = "0xb520e9C5123A450828c190cb6073583a5ecd0d74"; + +const POL_Pool_One = "0x00635507895D30801f60a2859990420013068ee0"; +const POL_Pool_Two = "0x339522a317E74ac1f7D4d8D9bDc3181a9801416E"; +const POL_Pool_Three = "0x8470991Ce998d336146104549A04690082f2B372"; +const owners = [POL_Pool_One, POL_Pool_Two, POL_Pool_Three,] + +module.exports = { + kava: { + tvl: sumTokensExport({ owners, tokens: [ERC20ContractWkavaAddress] }), + pool2: sumTokensExport({ owners, tokens: [WkavaBeekLpAddress], lps: [WkavaBeekLpAddress], useDefaultCoreAssets: true, }), + staking: sumTokensExport({ owners, tokens: [ERC20ContractBeekAddress], lps: [WkavaBeekLpAddress], useDefaultCoreAssets: true, }), + } +}; diff --git a/projects/beethovenx/index.js b/projects/beethovenx/index.js index 32fbd5559ec..4866706c1db 100644 --- a/projects/beethovenx/index.js +++ b/projects/beethovenx/index.js @@ -1,63 +1,10 @@ -const { request, gql } = require("graphql-request"); -const { toUSDTBalances } = require("../helper/balances"); -const { getBalancerSubgraphTvl } = require("../helper/balancer"); - -const backendGraphUrlFantom = "https://backend-v2.beets-ftm-node.com/graphql"; -const backendGraphUrlOptimism = - "https://backend-optimism-v2.beets-ftm-node.com/graphql"; - -const backendTvlGraphQuery = gql` - query get_tvl { - data: protocolMetrics { - totalLiquidity - } - }`; - -const backendLatestBlockQuery = gql` -query get_latest_block { - data: latestSyncedBlocks { - poolSyncBlock - } -}`; - -async function getLatestSyncedBlockFantom() { - const { data } = await request(backendGraphUrlFantom, backendLatestBlockQuery); - return data.poolSyncBlock; -} - -async function getLatestSyncedBlockOptimism() { - const { data } = await request(backendGraphUrlOptimism, backendLatestBlockQuery); - return data.poolSyncBlock; -} - -async function fantom(timestamp, ...params) { - if (Math.abs(timestamp - Date.now() / 1000) < 3600 / 2) { - const { data } = await request(backendGraphUrlFantom, backendTvlGraphQuery); - return toUSDTBalances(data.totalLiquidity); - } - return getBalancerSubgraphTvl( - "https://api.thegraph.com/subgraphs/name/beethovenxfi/beethovenx", - "fantom" - )(timestamp, ...params); -} - -async function optimism(timestamp, ...params) { - if (Math.abs(timestamp - Date.now() / 1000) < 3600 / 2) { - const { data } = await request(backendGraphUrlOptimism, backendTvlGraphQuery); - return toUSDTBalances(data.totalLiquidity); - } - return getBalancerSubgraphTvl( - "https://api.thegraph.com/subgraphs/name/beethovenxfi/beethovenx-optimism", - "optimism" - )(timestamp, ...params); -} +const { onChainTvl } = require("../helper/balancer"); module.exports = { - methodology: `BeethovenX TVL is pulled from the Balancer subgraph and on-chain. It includes deposits made to v2 liquidity pools.`, fantom: { - tvl: fantom, + tvl: onChainTvl('0x20dd72ed959b6147912c2e529f0a0c651c33c9ce', 16896080), }, optimism: { - tvl: optimism, + tvl: onChainTvl('0xBA12222222228d8Ba445958a75a0704d566BF2C8', 7003431), }, }; diff --git a/projects/behodler/index.js b/projects/behodler/index.js index fb56635b1ea..5965599a20f 100644 --- a/projects/behodler/index.js +++ b/projects/behodler/index.js @@ -1,5 +1,7 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { request, gql } = require("graphql-request"); const { toUSDTBalances } = require('../helper/balances'); +const { sumTokensExport } = require("../helper/unwrapLPs"); const graphUrl = 'https://api.thegraph.com/subgraphs/name/arrenv/behodler' const graphQuery = gql` @@ -28,9 +30,26 @@ async function tvl(timestamp, block) { } module.exports = { - misrepresentedTokens: true, methodology: `ERC20 tokens deposited as liquidity on the AMM. You can see this on https://analytics.behodler.io/#/, pulling the data from the 'arrenv/behodler' subgraph`, ethereum:{ - tvl, + tvl: sumTokensExport({ + owner: '0x1B8568FbB47708E9E9D31Ff303254f748805bF21', + tokens: [ + '0xaFEf0965576070D1608F374cb14049EefaD218Ec', + '0x4f5704D9D2cbCcAf11e70B34048d41A0d572993F', + ADDRESSES.ethereum.BAT, + '0x319eAd06eb01E808C80c7eb9bd77C5d8d163AddB', + '0xF047ee812b21050186f86106f6cABDfEc35366c6', + '0x155ff1A85F440EE0A382eA949f24CE4E0b751c65', + ADDRESSES.ethereum.MKR, + ADDRESSES.ethereum.LINK, + '0x4575f41308EC1483f3d399aa9a2826d74Da13Deb', + ADDRESSES.ethereum.DAI, + '0x93ED3FBe21207Ec2E8f2d3c3de6e058Cb73Bc04d', + '0x42476F744292107e34519F9c357927074Ea3F75D', + '0x890ff7533Ca0C44F33167FdEEeaB1cA7E690634F', + ], + resolveLP: true, + }), }, } \ No newline at end of file diff --git a/projects/belt/abi.json b/projects/belt/abi.json index f6085532974..87d3b9f1625 100644 --- a/projects/belt/abi.json +++ b/projects/belt/abi.json @@ -1,28 +1,4 @@ { - "calcPoolValueInToken": { - "inputs": [], - "name": "calcPoolValueInToken", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "token": { - "inputs": [], - "name": "token", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } + "calcPoolValueInToken": "uint256:calcPoolValueInToken", + "token": "address:token" } \ No newline at end of file diff --git a/projects/belt/index.js b/projects/belt/index.js index fd6b5f34ac6..b9e351d07a4 100644 --- a/projects/belt/index.js +++ b/projects/belt/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk') const abi = require('./abi.json') const { get } = require('../helper/http') @@ -6,9 +7,9 @@ const { toUSDTBalances } = require('../helper/balances'); // https://docs.belt.fi/contracts/contract-deployed-info const bscVaults = [ - '0x51bd63F240fB13870550423D208452cA87c44444', - '0xAA20E8Cb61299df2357561C2AC2e1172bC68bc25', - '0xa8Bb71facdd46445644C277F9499Dd22f6F0A30C', + ADDRESSES.bsc.beltBTC, + ADDRESSES.bsc.beltETH, + ADDRESSES.bsc.beltBNB, '0x9171Bf7c050aC8B4cf7835e51F7b4841DFB2cCD0', '0x55E1B1e49B969C018F2722445Cd2dD9818dDCC25', '0x7a59bf07D529A5FdBab67D597d63d7D5a83E61E5', @@ -56,7 +57,7 @@ async function getTvl(chain, block, address) { sdk.util.sumSingleBalance(balances, chain+':'+underlyingTokens.output[index].output, balance.output) }) - const beltInfo = await get('https://s.belt.fi/info/all.json') + const beltInfo = await get('https://ss.belt.fi/info/all.json') const lockedUSDT = beltInfo.info[chain.toUpperCase()].vaultPools.find(x => x.wantToken.toLowerCase() === tetherLP.toLowerCase()) const [ usdt, wantLocked ] = Object.entries(toUSDTBalances(lockedUSDT.wantLocked))[0] balances[usdt] = wantLocked @@ -74,7 +75,7 @@ function hecoTvl(timestamp, ethBlock, chainBlocks) { } async function klaytnTvl() { - const beltInfo = await get('https://s.belt.fi/info/all.json') + const beltInfo = await get('https://ss.belt.fi/info/all.json') var tvl = new BigNumber('0'); beltInfo.info.KLAYTN.vaults.forEach(vault =>{ @@ -88,7 +89,7 @@ async function klaytnTvl() { } async function getStaking(chain) { - const beltInfo = await get('https://s.belt.fi/info/all.json') + const beltInfo = await get('https://ss.belt.fi/info/all.json') const stakingInfo = beltInfo.info[chain.toUpperCase()].staking return toUSDTBalances(stakingInfo.tvl) @@ -96,7 +97,7 @@ async function getStaking(chain) { module.exports = { timetravel: false, - methodology: 'TVL includes the liquidity of all the Vaults, 3Tether LP and staking counts the BELT that has been staked in BSC. Data is pulled from:"https://s.belt.fi/info/all.json".', + methodology: 'TVL includes the liquidity of all the Vaults, 3Tether LP and staking counts the BELT that has been staked in BSC. Data is pulled from:"https://ss.belt.fi/info/all.json".', bsc: { tvl: bscTvl, staking: () => getStaking('bsc'), diff --git a/projects/beluga-dex/index.js b/projects/beluga-dex/index.js new file mode 100644 index 00000000000..258f7c6442c --- /dev/null +++ b/projects/beluga-dex/index.js @@ -0,0 +1,21 @@ +const { staking } = require("../helper/staking"); +const { sumTokens2 } = require('../helper/unwrapLPs') +const asssetsContract = "0xF6Eb0eE167e3b8a43E74999C47720140A9431448" + +async function tvl(timestamp, ethereumBlock, chainBlocks, { api }) { + const tokensAndOwners = await api.call({ + target: asssetsContract, + abi: "function getAssets() view returns (address[][])", + }) + return sumTokens2({ api, tokensAndOwners, }) +} + +module.exports = { + arbitrum:{ + tvl, + staking: staking( + "0x7fbdEb84D5966c1C325D8CB2E01593D74c9A41Cd", //vetoken + "0x09090e22118b375f2c7b95420c04414E4bf68e1A", //bela + ), + }, +}; diff --git a/projects/beluga-protocol/index.js b/projects/beluga-protocol/index.js index 1d9263cc29b..7585ba8932e 100644 --- a/projects/beluga-protocol/index.js +++ b/projects/beluga-protocol/index.js @@ -1,8 +1,9 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens2, } = require('../helper/solana') const tokens = { - usdt: 'Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB', - usdc: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v', + usdt: ADDRESSES.solana.USDT, + usdc: ADDRESSES.solana.USDC, } const pools = { diff --git a/projects/beluga/index.js b/projects/beluga/index.js index 2e4c42e0b8a..e107317fb81 100644 --- a/projects/beluga/index.js +++ b/projects/beluga/index.js @@ -1,31 +1,39 @@ -const axios = require("axios"); -const https = require("https"); -let _data; +const { getLogs } = require('../helper/cache/getLogs') +const sdk = require('@defillama/sdk') -const agent = new https.Agent({ - rejectUnauthorized: false, -}); +const config = { + fantom: { + factory: '0x83ae1aec3f9be3cf55db2f5d8acb09956dcdc233', + fromBlock: 33212099, + topic: '0x688da1863a5295d623a6e790e9bd1530833713e4656764558f6fda4ed9922900', + }, + polygon: { + factory: '0x0208086CC6d2e2792Ca66C5C85d4d8D04Ce7FeE4', + fromBlock: 21961980, + topic: '0x688da1863a5295d623a6e790e9bd1530833713e4656764558f6fda4ed9922900', + } +} -function fetch(chain) { - return async () => { - if (!_data) - _data = await axios.get("http://api.beluga.fi/tvl", { - httpsAgent: agent, - }); - let data = _data.data; +module.exports = {}; - return { - "usd-coin": data[chain], - }; - }; -} +Object.keys(config).forEach(chain => { + const { factory, fromBlock, topic, } = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const balances = {} + const data = await getLogs({ + api, + target: factory, + topics: [topic], + fromBlock, + eventAbi: 'event VaultDeployment(address vault, address strategy, string vaultType)', + }) -module.exports = { - timetravel: false, - polygon: { - tvl: fetch("Polygon"), - }, - fantom: { - tvl: fetch("Fantom"), - }, -}; + const vaults = data.map(i => i.args.vault) + const underlying = await api.multiCall({ abi: 'address:underlying', calls: vaults, }) + const bals = await api.multiCall({ abi: 'uint256:underlyingBalanceInVault', calls: vaults, }) + bals.forEach((a, i) => sdk.util.sumSingleBalance(balances, underlying[i], a, chain)) + return balances + } + } +}) \ No newline at end of file diff --git a/projects/bemo/index.js b/projects/bemo/index.js new file mode 100644 index 00000000000..a829af299bc --- /dev/null +++ b/projects/bemo/index.js @@ -0,0 +1,23 @@ +const BigNumber = require("bignumber.js"); +const { post } = require('../helper/http') + +module.exports = { + timetravel: false, + methodology: "stTon", + ton: { + tvl: async () => { + const requestBody = { + "address": "EQDNhy-nxYFgUqzfUzImBEP67JqsyMIcyk2S5_RwNNEYku0k", + "method": "get_full_data", + "stack": [] + } + const response = await post('https://toncenter.com/api/v2/runGetMethod', requestBody) + if (! response.ok) { + throw new Error("Unknown"); + } + const result = response.result + const tonTotalSupply = parseInt(result.stack[1][1], 16) + return {"coingecko:the-open-network": BigNumber(tonTotalSupply).div(1e9).toFixed(0)}; + } + } +} diff --git a/projects/benddao-ape-staking/index.js b/projects/benddao-ape-staking/index.js new file mode 100644 index 00000000000..5c6cde163c1 --- /dev/null +++ b/projects/benddao-ape-staking/index.js @@ -0,0 +1,65 @@ +const abi = require("../benddao/helper/abis"); +const address = require("../benddao/helper/address"); +const sdk = require("@defillama/sdk"); + +module.exports = { + ethereum: { + tvl: async (_, _b, _cb, { api }) => { + const balances = {}; + + const addressMap = address[api.chain]; + + const nftList = [addressMap.BAYC, addressMap.MAYC, addressMap.BAKC]; + + const [stakedTotal, apeCoinBalance, nftBalance] = await Promise.all([ + api.multiCall({ + calls: [ + // v1 + addressMap.BoundBAYC, + addressMap.BoundMAYC, + addressMap.BoundBAKC, + // v2 + addressMap.BendStakeManager, + addressMap.NftVault, + ], + target: addressMap.ApeCoinStaking, + abi: abi.ApeCoinStaking.stakedTotal, + }), + api.multiCall({ + calls: [ + // v1 + addressMap.BoundBAYC, + addressMap.BoundMAYC, + addressMap.BoundBAKC, + // v2 + addressMap.BendCoinPool, + addressMap.BendNftPool, + ], + target: addressMap.ApeCoin, + abi: "erc20:balanceOf", + }), + api.multiCall({ + calls: nftList.map((nft) => ({ + target: nft, + params: [addressMap.NftVault], + })), + abi: abi.ERC721.balanceOf, + }), + ]); + + stakedTotal.forEach((d) => + sdk.util.sumSingleBalance(balances, addressMap.ApeCoin, d, api.chain) + ); + + apeCoinBalance.forEach((d) => + sdk.util.sumSingleBalance(balances, addressMap.ApeCoin, d, api.chain) + ); + + nftBalance.forEach((d, i) => { + sdk.util.sumSingleBalance(balances, nftList[i], d, api.chain); + }); + + return balances; + }, + }, +}; diff --git a/projects/benddao/helper/abis/ApeCoinStaking.json b/projects/benddao/helper/abis/ApeCoinStaking.json new file mode 100644 index 00000000000..0e6db1278ec --- /dev/null +++ b/projects/benddao/helper/abis/ApeCoinStaking.json @@ -0,0 +1,4 @@ +{ + "apeCoin": "function apeCoin() external view returns (address)", + "stakedTotal": "function stakedTotal(address _address) external view returns (uint256)" +} diff --git a/projects/benddao/helper/abis/BNFTRegistry.json b/projects/benddao/helper/abis/BNFTRegistry.json new file mode 100644 index 00000000000..c1d3fb34b5b --- /dev/null +++ b/projects/benddao/helper/abis/BNFTRegistry.json @@ -0,0 +1,4 @@ +{ + "getBNFTAssetList": "function getBNFTAssetList() external view returns (address[] memory)", + "bNftProxys": "function bNftProxys(address) view returns (address)" +} diff --git a/projects/benddao/helper/abis/ERC721.json b/projects/benddao/helper/abis/ERC721.json new file mode 100644 index 00000000000..6db3f7d30ac --- /dev/null +++ b/projects/benddao/helper/abis/ERC721.json @@ -0,0 +1,3 @@ +{ + "balanceOf": "function balanceOf(address account) view returns (uint256)" +} diff --git a/projects/benddao/helper/abis/UiPoolDataProvider.json b/projects/benddao/helper/abis/UiPoolDataProvider.json index 4f3ce69427c..686d138eb6b 100644 --- a/projects/benddao/helper/abis/UiPoolDataProvider.json +++ b/projects/benddao/helper/abis/UiPoolDataProvider.json @@ -1,182 +1,4 @@ -[{ - "inputs": [ - { - "internalType": "contract ILendPoolAddressesProvider", - "name": "provider", - "type": "address" - } - ], - "name": "getSimpleReservesData", - "outputs": [ - { - "components": [ - { - "internalType": "address", - "name": "underlyingAsset", - "type": "address" - }, - { "internalType": "string", "name": "name", "type": "string" }, - { "internalType": "string", "name": "symbol", "type": "string" }, - { "internalType": "uint256", "name": "decimals", "type": "uint256" }, - { - "internalType": "uint256", - "name": "reserveFactor", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "borrowingEnabled", - "type": "bool" - }, - { "internalType": "bool", "name": "isActive", "type": "bool" }, - { "internalType": "bool", "name": "isFrozen", "type": "bool" }, - { - "internalType": "uint128", - "name": "liquidityIndex", - "type": "uint128" - }, - { - "internalType": "uint128", - "name": "variableBorrowIndex", - "type": "uint128" - }, - { - "internalType": "uint128", - "name": "liquidityRate", - "type": "uint128" - }, - { - "internalType": "uint128", - "name": "variableBorrowRate", - "type": "uint128" - }, - { - "internalType": "uint40", - "name": "lastUpdateTimestamp", - "type": "uint40" - }, - { - "internalType": "address", - "name": "bTokenAddress", - "type": "address" - }, - { - "internalType": "address", - "name": "debtTokenAddress", - "type": "address" - }, - { - "internalType": "address", - "name": "interestRateAddress", - "type": "address" - }, - { - "internalType": "uint256", - "name": "availableLiquidity", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalVariableDebt", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "priceInEth", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "variableRateSlope1", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "variableRateSlope2", - "type": "uint256" - } - ], - "internalType": "struct IUiPoolDataProvider.AggregatedReserveData[]", - "name": "", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" -}, { - "inputs": [ - { - "internalType": "contract ILendPoolAddressesProvider", - "name": "provider", - "type": "address" - } - ], - "name": "getSimpleNftsData", - "outputs": [ - { - "components": [ - { - "internalType": "address", - "name": "underlyingAsset", - "type": "address" - }, - { "internalType": "string", "name": "name", "type": "string" }, - { "internalType": "string", "name": "symbol", "type": "string" }, - { "internalType": "uint256", "name": "ltv", "type": "uint256" }, - { - "internalType": "uint256", - "name": "liquidationThreshold", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "liquidationBonus", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "redeemDuration", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "auctionDuration", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "redeemFine", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "redeemThreshold", - "type": "uint256" - }, - { "internalType": "bool", "name": "isActive", "type": "bool" }, - { "internalType": "bool", "name": "isFrozen", "type": "bool" }, - { - "internalType": "address", - "name": "bNftAddress", - "type": "address" - }, - { - "internalType": "uint256", - "name": "priceInEth", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalCollateral", - "type": "uint256" - } - ], - "internalType": "struct IUiPoolDataProvider.AggregatedNftData[]", - "name": "", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" -}] \ No newline at end of file + "getSimpleReservesData": "function getSimpleReservesData(address provider) view returns (tuple(address underlyingAsset, string name, string symbol, uint256 decimals, uint256 reserveFactor, bool borrowingEnabled, bool isActive, bool isFrozen, uint128 liquidityIndex, uint128 variableBorrowIndex, uint128 liquidityRate, uint128 variableBorrowRate, uint40 lastUpdateTimestamp, address bTokenAddress, address debtTokenAddress, address interestRateAddress, uint256 availableLiquidity, uint256 totalVariableDebt, uint256 priceInEth, uint256 variableRateSlope1, uint256 variableRateSlope2)[])", + "getSimpleNftsData": "function getSimpleNftsData(address provider) view returns (tuple(address underlyingAsset, string name, string symbol, uint256 ltv, uint256 liquidationThreshold, uint256 liquidationBonus, uint256 redeemDuration, uint256 auctionDuration, uint256 redeemFine, uint256 redeemThreshold, bool isActive, bool isFrozen, address bNftAddress, uint256 priceInEth, uint256 totalCollateral)[])" +} \ No newline at end of file diff --git a/projects/benddao/helper/abis/index.js b/projects/benddao/helper/abis/index.js index 15e82b5e833..cc67db36b6b 100644 --- a/projects/benddao/helper/abis/index.js +++ b/projects/benddao/helper/abis/index.js @@ -1,5 +1,11 @@ const UiPoolDataProvider = require("./UiPoolDataProvider.json"); +const ApeCoinStaking = require("./ApeCoinStaking.json"); +const BNFTRegistry = require("./BNFTRegistry.json"); +const ERC721 = require("./ERC721.json"); module.exports = { UiPoolDataProvider, + ApeCoinStaking, + BNFTRegistry, + ERC721, }; diff --git a/projects/benddao/helper/address.js b/projects/benddao/helper/address.js index 2f082ba1e00..32c0e519d48 100644 --- a/projects/benddao/helper/address.js +++ b/projects/benddao/helper/address.js @@ -1,12 +1,29 @@ -const UiPoolDataProvider = { - ethereum: "0x5250cCE48E43AB930e45Cc8E71C87Ca4B51244cf", -}; - -const LendPoolAddressProvider = { - ethereum: "0x24451F47CaF13B24f4b5034e1dF6c0E401ec0e46", -}; - +const ADDRESSES = require("../../helper/coreAssets.json"); module.exports = { - UiPoolDataProvider, - LendPoolAddressProvider, + ethereum: { + UiPoolDataProvider: "0x5250cCE48E43AB930e45Cc8E71C87Ca4B51244cf", + LendPoolAddressProvider: "0x24451F47CaF13B24f4b5034e1dF6c0E401ec0e46", + ApeCoinStaking: "0x5954aB967Bc958940b7EB73ee84797Dc8a2AFbb9", + VeBend: "0xd7e97172C2419566839Bf80DeeA46D22B1B2E06E", + Bend: "0x0d02755a5700414B26FF040e1dE35D337DF56218", + UniswapV2PairWETH: "0x336ef4e633b1117dca08c1a57f4139c62c32c935", + StakedBUNI: "0x647C509AF2A2b2294bB79fCE12DaEc8e7cf938f7", + Treasury: "0x472FcC65Fab565f75B1e0E861864A86FE5bcEd7B", + USDC: ADDRESSES.ethereum.USDC, + ApeCoin: "0x4d224452801ACEd8B2F0aebE155379bb5D594381", + BNFTRegistry: "0x79d922DD382E42A156bC0A354861cDBC4F09110d", + BendStakeManager: "0x9d1833becb105405a8305F775F0aF3157d12B33c", + NftVault: "0xaAa2DA255DF9Ee74C7075bCB6D81f97940908A5D", + BendCoinPool: "0x86862445f58F50382c421a7bceCBcd971cc25367", + BendNftPool: "0x9Da9571389BA2316ad98f695210aD5fB0363cDEd", + BAYC: "0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D", + MAYC: "0x60E4d786628Fea6478F785A6d7e704777c86a7c6", + BAKC: "0xba30E5F9Bb24caa003E9f2f0497Ad287FDF95623", + BoundBAYC: "0xDBfD76AF2157Dc15eE4e57F3f942bB45Ba84aF24", + BoundMAYC: "0x69f37e419bD1457d2a25ed3f5d418169caAe8D1F", + BoundBAKC: "0xcF2CC4994Fe9E411A6aDC30d0A11f20CD4D8d2aB", + StBAYC: "0x08f5F0126aF89B4fD5499E942891D904A027624B", + StMAYC: "0xc1ED28E4b4d8e284A41E7474CA5522b010f3A64F", + StBAKC: "0xf6d3B8098967dd349d0477F01C16E8864a832ac2", + }, }; diff --git a/projects/benddao/helper/index.js b/projects/benddao/helper/index.js index 0e9826573ac..d40d088365d 100644 --- a/projects/benddao/helper/index.js +++ b/projects/benddao/helper/index.js @@ -1,72 +1,86 @@ const sdk = require("@defillama/sdk"); -const { default: BigNumber } = require("bignumber.js"); +const { sumTokens2 } = require("../../helper/unwrapLPs"); const abi = require("./abis"); const address = require("./address"); -async function getTVL(balances, chain, timestamp, chainBlocks) { - const block = chainBlocks[chain]; +async function tvl(chain, timestamp, chainBlocks, { api }) { + const addressMap = address[api.chain]; - const [{ output: simpleReservesData }, { output: simpleNftsData }] = - await Promise.all([ - sdk.api.abi.call({ - target: address.UiPoolDataProvider[chain], - params: [address.LendPoolAddressProvider[chain]], - abi: abi.UiPoolDataProvider.find( - (a) => a.name === "getSimpleReservesData" - ), - block, - chain, - }), - sdk.api.abi.call({ - target: address.UiPoolDataProvider[chain], - params: [address.LendPoolAddressProvider[chain]], - abi: abi.UiPoolDataProvider.find((a) => a.name === "getSimpleNftsData"), - block, - chain, - }), - ]); + const [simpleReservesData, bnftAssetList] = await Promise.all([ + api.call({ + target: addressMap.UiPoolDataProvider, + params: [addressMap.LendPoolAddressProvider], + abi: abi.UiPoolDataProvider.getSimpleReservesData, + }), + api.call({ + target: addressMap.BNFTRegistry, + abi: abi.BNFTRegistry.getBNFTAssetList, + }), + ]); - simpleReservesData.forEach((d) => { - balances[d.underlyingAsset] = new BigNumber( - balances[d.underlyingAsset] || 0 - ).plus(d.availableLiquidity); + const bnftProxyList = await api.multiCall({ + calls: bnftAssetList, + target: addressMap.BNFTRegistry, + abi: abi.BNFTRegistry.bNftProxys, }); - simpleNftsData.forEach((d) => { - balances["ETHEREUM"] = new BigNumber(balances["ETHEREUM"] || 0).plus( - new BigNumber(d.totalCollateral).multipliedBy(d.priceInEth).shiftedBy(-18) - ); - }); + const toa = [ + ...bnftAssetList.map((bnftAsset, idx) => { + const bnftProxy = bnftProxyList[idx]; + return [bnftAsset, bnftProxy]; + }), + ...simpleReservesData.map((reserve) => [ + reserve.underlyingAsset, + reserve.bTokenAddress, + ]), + ]; + + const balances = await sumTokens2({ api, tokensAndOwners: toa }); + + // cause stNFT do not have price, it should use the underlying asset price + const stNFTMap = { + [addressMap.StBAYC.toLowerCase()]: addressMap.BAYC.toLowerCase(), + [addressMap.StMAYC.toLowerCase()]: addressMap.MAYC.toLowerCase(), + [addressMap.StBAKC.toLowerCase()]: addressMap.BAKC.toLowerCase(), + }; + + for (const asset in balances) { + const underlyingAsset = stNFTMap[asset]; + if (underlyingAsset) { + sdk.util.sumSingleBalance(balances, underlyingAsset, balances[asset]); + delete balances[asset]; + } + } return balances; } -async function getBorrowed(balances, chain, timestamp, chainBlocks) { - const block = chainBlocks[chain]; +async function borrowed(chain, timestamp, chainBlocks, { api }) { + const balances = {}; + const addressMap = address[api.chain]; - const [{ output: simpleReservesData }] = await Promise.all([ - sdk.api.abi.call({ - target: address.UiPoolDataProvider[chain], - params: [address.LendPoolAddressProvider[chain]], - abi: abi.UiPoolDataProvider.find( - (a) => a.name === "getSimpleReservesData" - ), - block, - chain, + const [simpleReservesData] = await Promise.all([ + api.call({ + target: addressMap.UiPoolDataProvider, + params: addressMap.LendPoolAddressProvider, + abi: abi.UiPoolDataProvider.getSimpleReservesData, }), ]); simpleReservesData.forEach((d) => { - balances[d.underlyingAsset] = new BigNumber( - balances[d.underlyingAsset] || 0 - ).plus(d.totalVariableDebt); + sdk.util.sumSingleBalance( + balances, + d.underlyingAsset, + d.totalVariableDebt, + api.chain + ); }); return balances; } module.exports = { - getTVL, - getBorrowed, + tvl, + borrowed, }; diff --git a/projects/benddao/index.js b/projects/benddao/index.js index c782962d1bf..2908f649698 100644 --- a/projects/benddao/index.js +++ b/projects/benddao/index.js @@ -1,22 +1,7 @@ const sdk = require("@defillama/sdk"); - -const { getTVL, getBorrowed } = require("./helper/index"); - -async function tvl(timestamp, block, chainBlocks) { - const balances = {}; - - await getTVL(balances, "ethereum", timestamp, chainBlocks); - - return balances; -} - -async function borrowed(timestamp, block, chainBlocks) { - const balances = {}; - - await getBorrowed(balances, "ethereum", timestamp, chainBlocks); - - return balances; -} +const { staking } = require("../helper/staking"); +const { tvl, borrowed } = require("./helper/index"); +const address = require("./helper/address"); module.exports = { timetravel: true, @@ -24,5 +9,7 @@ module.exports = { ethereum: { tvl, borrowed, + staking: staking(address.ethereum.VeBend, address.ethereum.Bend,), + pool2: staking(address.ethereum.StakedBUNI, address.ethereum.UniswapV2PairWETH,), }, -} +}; diff --git a/projects/benqi-staked-avax/index.js b/projects/benqi-staked-avax/index.js index ae6e073b355..fd2468f2231 100644 --- a/projects/benqi-staked-avax/index.js +++ b/projects/benqi-staked-avax/index.js @@ -1,8 +1,9 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const savaxAbi = require("./savax.json"); const SAVAX = "0x2b2C81e08f1Af8835a78Bb2A90AE924ACE0eA4bE"; -const WAVAX = "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7"; +const WAVAX = ADDRESSES.avax.WAVAX; const transformAddress = (addr) => `avax:${addr}`; @@ -24,4 +25,7 @@ module.exports={ tvl, }, methodology: "Counts staked AVAX tokens.", + hallmarks:[ + [1643199567, "Benqi SAVAX Launched"] + ], } diff --git a/projects/benqi-staked-avax/savax.json b/projects/benqi-staked-avax/savax.json index a4a159b309e..23ac13641cd 100644 --- a/projects/benqi-staked-avax/savax.json +++ b/projects/benqi-staked-avax/savax.json @@ -1,34 +1,4 @@ { - "totalPooledAvax": { - "inputs": [], - "name": "totalPooledAvax", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getSharesByPooledAvax": { - "inputs": [ - { - "internalType": "uint256", - "name": "avaxAmount", - "type": "uint256" - } - ], - "name": "getSharesByPooledAvax", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -} + "totalPooledAvax": "uint256:totalPooledAvax", + "getSharesByPooledAvax": "function getSharesByPooledAvax(uint256 avaxAmount) view returns (uint256)" +} \ No newline at end of file diff --git a/projects/benswap/index.js b/projects/benswap/index.js index 45b3b5f640c..5b6900b2274 100644 --- a/projects/benswap/index.js +++ b/projects/benswap/index.js @@ -1,10 +1,11 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk'); const { getUniTVL } = require('../helper/unknownTokens') const { stakingPricedLP } = require('../helper/staking') -const WBCH = "0x3743eC0673453E5009310C727Ba4eaF7b3a1cc04"; +const WBCH = ADDRESSES.smartbch.WBCH; const EBEN = "0x77CB87b57F54667978Eb1B199b28a0db8C8E1c0B"; -const FLEXUSD = "0x7b2B3C5308ab5b2a1d9a94d20D35CCDf61e05b72"; +const FLEXUSD = ADDRESSES.smartbch.flexUSD; const FACTORY = "0x8d973bAD782c1FFfd8FcC9d7579542BA7Dd0998D"; const MASTERBREEDER = "0xDEa721EFe7cBC0fCAb7C8d65c598b21B6373A2b6"; const EBEN_WBCH_LP = "0x0D4372aCc0503Fbcc7EB129e0De3283c348B82c3"; @@ -26,18 +27,18 @@ async function bchMasterChef(timestamp, ethBlock, {[CHAIN]: block}) { } } -const bchDexTvl = getUniTVL({ chain: 'smartbch', factory: FACTORY, useDefaultCoreAssets: true, }) +const bchDexTvl = getUniTVL({ factory: FACTORY, useDefaultCoreAssets: true, }) module.exports = { misrepresentedTokens: true, methodology: "Factory address (0x8d973bAD782c1FFfd8FcC9d7579542BA7Dd0998D) is used to find the LP pairs on smartBCH and Factory address (0x4dC6048552e2DC6Eb1f82A783E859157d40FA193) is used to find the liquidity of the pairs on BSC. TVL is equal to the liquidity on both AMMs plus the extra staking balance and masterchef pools.", smartbch: { tvl: sdk.util.sumChainTvls([bchDexTvl, bchMasterChef]), - masterchef: bchMasterChef, + // masterchef: bchMasterChef, staking: stakingPricedLP(MASTERBREEDER, EBEN, "smartbch", EBEN_WBCH_LP, COREASSETNAME), }, bsc: { - tvl: getUniTVL({ factory: '0x4dC6048552e2DC6Eb1f82A783E859157d40FA193', chain: 'bsc', useDefaultCoreAssets: true }), + tvl: getUniTVL({ factory: '0x4dC6048552e2DC6Eb1f82A783E859157d40FA193', useDefaultCoreAssets: true }), staking: stakingPricedLP("0x03245d87295cd0783e1f10a2ea54f9e80b726af8", "0x8173dda13fd405e5bca84bd7f64e58caf4810a32", "bsc", "0x4558e53328cddd5877b7348702c991f521aa35c0", "binancecoin", true), }, } diff --git a/projects/bent/bentBasePoolAbi.json b/projects/bent/bentBasePoolAbi.json index 800199ab999..8e9afcadd2e 100644 --- a/projects/bent/bentBasePoolAbi.json +++ b/projects/bent/bentBasePoolAbi.json @@ -1,16 +1,4 @@ { - "cvxPoolId": { - "inputs": [], - "name": "cvxPoolId", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - "lpToken": { - "inputs": [], - "name": "lpToken", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - } -} + "cvxPoolId": "uint256:cvxPoolId", + "lpToken": "address:lpToken" +} \ No newline at end of file diff --git a/projects/bent/constants.js b/projects/bent/constants.js index 5c5591cc7c1..45fa73b16bb 100644 --- a/projects/bent/constants.js +++ b/projects/bent/constants.js @@ -1,12 +1,13 @@ -const addressZero = "0x0000000000000000000000000000000000000000"; +const ADDRESSES = require('../helper/coreAssets.json') +const addressZero = ADDRESSES.null; const ethAddress = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"; -const wethAddress = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"; +const wethAddress = ADDRESSES.ethereum.WETH; const bentCVXAddress = "0x9E0441E084F5dB0606565737158aa6Ab6B970fE0"; -const CVXAddress = "0x4e3FBD56CD56c3e72c1403e103b45Db9da5B9D2B"; +const CVXAddress = ADDRESSES.ethereum.CVX; const pool2Address = "0xd564b2feec19df8f4d6cb52c0a4386d05a993583"; const sushiLpAddress = "0x5fa4370164a2fabeef159b893299d59ff5dc1e6d"; const bentAddress = "0x01597e397605bf280674bf292623460b4204c375"; -const daiAddress = "0x6b175474e89094c44da98b954eedeac495271d0f"; +const daiAddress = ADDRESSES.ethereum.DAI; const weBent = "0x04637d61F538911929ff96E755B589C014fD9ce2"; const bentPools = { diff --git a/projects/bent/curvePoolAbi.json b/projects/bent/curvePoolAbi.json index a2ce3b73f0b..015ad3d87b4 100644 --- a/projects/bent/curvePoolAbi.json +++ b/projects/bent/curvePoolAbi.json @@ -1,33 +1,4 @@ { - "coins": { - "constant": true, - "name": "coins", - "outputs": [ - { - "type": "address", - "name": "" - } - ], - "inputs": [ - { - "type": "uint256", - "name": "arg0" - } - ], - "stateMutability": "view", - "type": "function", - "gas": 2280 - }, - "get_dy": { - "stateMutability": "view", - "type": "function", - "name": "get_dy", - "inputs": [ - { "name": "i", "type": "int128" }, - { "name": "j", "type": "int128" }, - { "name": "dx", "type": "uint256" } - ], - "outputs": [{ "name": "", "type": "uint256" }], - "gas": 2110507 - } -} + "coins": "function coins(uint256 arg0) view returns (address) @2280", + "get_dy": "function get_dy(int128 i, int128 j, uint256 dx) view returns (uint256) @2110507" +} \ No newline at end of file diff --git a/projects/bent/curveRegistryAbi.json b/projects/bent/curveRegistryAbi.json index 0ee79f42b46..81c0c4030d2 100644 --- a/projects/bent/curveRegistryAbi.json +++ b/projects/bent/curveRegistryAbi.json @@ -1,18 +1,4 @@ { - "get_pool_from_lp_token": { - "stateMutability": "view", - "type": "function", - "name": "get_pool_from_lp_token", - "inputs": [{ "name": "arg0", "type": "address" }], - "outputs": [{ "name": "", "type": "address" }], - "gas": 2443 - }, - "get_coins": { - "stateMutability": "view", - "type": "function", - "name": "get_coins", - "inputs": [{ "name": "_pool", "type": "address" }], - "outputs": [{ "name": "", "type": "address[8]" }], - "gas": 12102 - } -} + "get_pool_from_lp_token": "function get_pool_from_lp_token(address arg0) view returns (address) @2443", + "get_coins": "function get_coins(address _pool) view returns (address[8]) @12102" +} \ No newline at end of file diff --git a/projects/bent/index.js b/projects/bent/index.js index a54b2303af9..1945309539b 100644 --- a/projects/bent/index.js +++ b/projects/bent/index.js @@ -39,133 +39,135 @@ async function tvl(timestamp, block) { ).dividedBy(10 ** 18); // Fetch balances of each of the pools - for (let poolIndex = 0; poolIndex < poolAddresses.length; poolIndex++) { - const poolAddress = poolAddresses[poolIndex]; - const masterChefPoolIndex = bentMasterChefPools.indexOf(poolAddress); - const isMasterChefPool = masterChefPoolIndex !== -1; - let poolSupply, poolLpToken; - - if (!isMasterChefPool) { - const results = ( - await Promise.all([ - sdk.api.erc20.totalSupply({ - target: poolAddress, - block, - }), - sdk.api.abi.call({ - target: poolAddress, - abi: basePoolAbi.lpToken, + await Promise.all(poolAddresses.map(async (_, poolIndex) => { + { + const poolAddress = poolAddresses[poolIndex]; + const masterChefPoolIndex = bentMasterChefPools.indexOf(poolAddress); + const isMasterChefPool = masterChefPoolIndex !== -1; + let poolSupply, poolLpToken; + + if (!isMasterChefPool) { + const results = ( + await Promise.all([ + sdk.api.erc20.totalSupply({ + target: poolAddress, + block, + }), + sdk.api.abi.call({ + target: poolAddress, + abi: basePoolAbi.lpToken, + block, + }), + ]) + ).map((p) => p.output.toLowerCase()); + poolSupply = results[0]; + poolLpToken = results[1]; + } else { + poolLpToken = poolAddress; + poolSupply = ( + await sdk.api.erc20.balanceOf({ + target: poolLpToken, + owner: bentMasterChefAddress, block, - }), - ]) - ).map((p) => p.output.toLowerCase()); - poolSupply = results[0]; - poolLpToken = results[1]; - } else { - poolLpToken = poolAddress; - poolSupply = ( - await sdk.api.erc20.balanceOf({ + }) + ).output; + } + + const lpTokenTotalSupply = ( + await sdk.api.erc20.totalSupply({ target: poolLpToken, - owner: bentMasterChefAddress, block, }) ).output; - } - - const lpTokenTotalSupply = ( - await sdk.api.erc20.totalSupply({ - target: poolLpToken, - block, - }) - ).output; - // Find the curve pool - let crvPoolAddr = ( - await sdk.api.abi.call({ - target: crvRegistry, - abi: curveRegistryAbi.get_pool_from_lp_token, - params: poolLpToken, - block, - }) - ).output; - - // Find the balance of the underlying coins in the curve pool - let coins = []; - if (crvPoolAddr !== addressZero) { - coins = ( + // Find the curve pool + let crvPoolAddr = ( await sdk.api.abi.call({ target: crvRegistry, - abi: curveRegistryAbi.get_coins, - params: crvPoolAddr, + abi: curveRegistryAbi.get_pool_from_lp_token, + params: poolLpToken, block, }) - ).output.filter((a) => a !== addressZero); - } else { - // Either use a manual mapping, or the pool is the lp token itself. - crvPoolAddr = crvPoolByLpTokenAddress[poolLpToken] || poolLpToken; - for (let i = 0, err = false; i < 8 && !err; i++) { - try { - let coin = ( - await sdk.api.abi.call({ - target: crvPoolAddr, - abi: curvePoolAbi.coins, - params: i, - }) - ).output; - coins.push(coin); - } catch (e) { - err = true; + ).output; + + // Find the balance of the underlying coins in the curve pool + let coins = []; + if (crvPoolAddr !== addressZero) { + coins = ( + await sdk.api.abi.call({ + target: crvRegistry, + abi: curveRegistryAbi.get_coins, + params: crvPoolAddr, + block, + }) + ).output.filter((a) => a !== addressZero); + } else { + // Either use a manual mapping, or the pool is the lp token itself. + crvPoolAddr = crvPoolByLpTokenAddress[poolLpToken] || poolLpToken; + for (let i = 0, err = false; i < 8 && !err; i++) { + try { + let coin = ( + await sdk.api.abi.call({ + target: crvPoolAddr, + abi: curvePoolAbi.coins, + params: i, + }) + ).output; + coins.push(coin); + } catch (e) { + err = true; + } } } - } - const includesEth = - coins.findIndex( - (addr) => - addr.toLowerCase() === ethAddress || - addr.toLowerCase() === wethAddress - ) !== -1; - - /** - * addr : balance for the curve pool - */ - let curvePoolBalances = ( - await sdk.api.abi.multiCall({ - calls: coins - .filter((addr) => addr.toLowerCase() !== ethAddress) - .map((coinAddr) => ({ - target: coinAddr, - params: crvPoolAddr, - })), - abi: "erc20:balanceOf", - block, - }) - ).output.reduce((curvePoolBalances, { success, input, output }) => { - if (!success) return curvePoolBalances; + const includesEth = + coins.findIndex( + (addr) => + addr.toLowerCase() === ethAddress || + addr.toLowerCase() === wethAddress + ) !== -1; + + /** + * addr : balance for the curve pool + */ + let curvePoolBalances = ( + await sdk.api.abi.multiCall({ + calls: coins + .filter((addr) => addr.toLowerCase() !== ethAddress) + .map((coinAddr) => ({ + target: coinAddr, + params: crvPoolAddr, + })), + abi: "erc20:balanceOf", + block, + }) + ).output.reduce((curvePoolBalances, { success, input, output }) => { + if (!success) return curvePoolBalances; - curvePoolBalances[input.target] = output; - return curvePoolBalances; - }, {}); + curvePoolBalances[input.target] = output; + return curvePoolBalances; + }, {}); - if (includesEth) { - var ethbal = await sdk.api.eth.getBalance({ - target: crvPoolAddr, - block, + if (includesEth) { + var ethbal = await sdk.api.eth.getBalance({ + target: crvPoolAddr, + block, + }); + curvePoolBalances[addressZero] = ethbal.output; + } + + // Calculate the share of the pool we have. + const poolShare = BigNumber(poolSupply).div(lpTokenTotalSupply); + const ourBalances = {}; + Object.keys(curvePoolBalances).forEach((coinAddr) => { + let poolBalance = curvePoolBalances[coinAddr]; + ourBalances[coinAddr] = new BigNumber(poolBalance) + .times(poolShare) + .toFixed(0); }); - curvePoolBalances[addressZero] = ethbal.output; + poolBalances.push(ourBalances); } - - // Calculate the share of the pool we have. - const poolShare = BigNumber(poolSupply).div(lpTokenTotalSupply); - const ourBalances = {}; - Object.keys(curvePoolBalances).forEach((coinAddr) => { - let poolBalance = curvePoolBalances[coinAddr]; - ourBalances[coinAddr] = new BigNumber(poolBalance) - .times(poolShare) - .toFixed(0); - }); - poolBalances.push(ourBalances); - } + })) const balances = poolBalances.reduce((overallBalances, poolBalances) => { Object.keys(poolBalances).forEach((tokenAddress) => { diff --git a/projects/bepro/index.js b/projects/bepro/index.js index 847690a7666..d05e900a42c 100644 --- a/projects/bepro/index.js +++ b/projects/bepro/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokensExport } = require('../helper/unwrapLPs') /** BEPRO Protocol is available on Moonbeam and Moonriver */ @@ -7,11 +8,11 @@ const config = { bountyNetworks: [] }, "moonriver": { - token: "0xCb4a593ce512D78162C58384f0b2Fd6e802c2c47", + token: ADDRESSES.moonriver.BEPRO, bountyNetworks: ["0x85dE589aDc4bC5F17075fcd603E8A0f7561d90C9"] }, "moonbeam": { - token: "0x4EdF8E0778967012D46968ceadb75436d0426f88", + token: ADDRESSES.moonbeam.BEPRO, registry: "0x34DD5F63437FdC20557a8C6dDAeA056d3661c5e0", bountyNetworks: ["0xa9938c8712552Fe0b5312547fA96Ad9f14d58d3C"] } diff --git a/projects/betafinance/index.js b/projects/betafinance/index.js index c3ab442e4ae..78cd314a2d5 100644 --- a/projects/betafinance/index.js +++ b/projects/betafinance/index.js @@ -1,48 +1,37 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); -const { get } = require("../helper/http"); +const { getConfig } = require('../helper/cache') const { sumTokens } = require("../helper/unwrapLPs"); const config = { ethereum: { bank: '0x972a785b390D05123497169a04c72dE652493BE1', collaterals: [ - "0xdac17f958d2ee523a2206206994597c13d831ec7", - "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", - "0x6b175474e89094c44da98b954eedeac495271d0f", - "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", + ADDRESSES.ethereum.USDT, + ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.DAI, + ADDRESSES.ethereum.WETH, ], poolURL: 'https://beta-reward-xvn33y7hlq-uc.a.run.app/beta_active_eth/reward_infos' }, avax: { bank: '0xf3a82ddd4fbf49a35eccf264997f82d40510f36b', collaterals: [ - "0xc7198437980c041c805a1edcba50c1ce5db95118", - "0xa7d7079b0fead91f3e65f86e8915cb59c1a4c664", - "0xd586e7f844cea2f87f50152665bcbc2c279d8d70", - "0x49d5c2bdffac6ce2bfdb6640f4f80f226bc10bab", - "0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7", + ADDRESSES.avax.USDT_e, + ADDRESSES.avax.USDC_e, + ADDRESSES.avax.DAI, + ADDRESSES.avax.WETH_e, + ADDRESSES.avax.WAVAX, ], poolURL: 'https://beta-reward-xvn33y7hlq-uc.a.run.app/beta_active_avax/reward_infos' } } -const underlyingABI = { - "inputs": [], - "name": "underlying", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" -} +const underlyingABI = "address:underlying" async function getPools(chain) { const url = config[chain].poolURL - return (await get(url)).pool_infos + return (await getConfig('beta-finance/'+chain, url)).pool_infos .filter(i => i.kind === 'BetaLendHandler') .map(i => i.address) } @@ -62,7 +51,6 @@ function setChainTVL(chain) { } } - module.exports = { methodology: "TVL is comprised of tokens deposited to the protocol as collateral, similar to Compound Finance and other lending protocols the borrowed tokens are not counted as TVL.", diff --git a/projects/betswirl/index.js b/projects/betswirl/index.js index 571afa015ea..3cae7d5da13 100644 --- a/projects/betswirl/index.js +++ b/projects/betswirl/index.js @@ -1,198 +1,23 @@ -const sdk = require("@defillama/sdk"); -const { sumTokens2 } = require('../helper/unwrapLPs') - -const banks = { - bsc: [ - [18371153, "0xC7130b9D454243BE816B7f5Ab09E7eF292b0c465"], - [Infinity, "0xF26E41e3714eFe1ff03b423f45DCc31a98C21867"], - ], - polygon: [ - [29120547, "0x72A5b0295EAaCC8c005Ec6a800cB9BECEd73DA0E"], - [Infinity, "0x1a54574CBAe9f8a4f9dd19d56687F2266d0C9d31"], - ], - avax: [[Infinity, "0x187De399100aA962F209Aa78621F5138ACA6111f"]], -}; - -function treasury(chain) { - return async (_timestamp, _block, {[chain]: block}) => { - // Get the Bank for the input block - const [, bankAddressOfBlock] = banks[chain].find( - ([bankLastBlock]) => (block || 999999999999) < bankLastBlock - ); - - // Retrieves all tokens from the Bank contract - const { output: tokens } = await sdk.api.abi.call({ - target: bankAddressOfBlock, - abi: { - inputs: [], - name: "getTokens", - outputs: [ - { - components: [ - { - internalType: "uint8", - name: "decimals", - type: "uint8", - }, - { - internalType: "address", - name: "tokenAddress", - type: "address", - }, - { - internalType: "string", - name: "name", - type: "string", - }, - { - internalType: "string", - name: "symbol", - type: "string", - }, - { - components: [ - { - internalType: "bool", - name: "allowed", - type: "bool", - }, - { - internalType: "uint16", - name: "balanceRisk", - type: "uint16", - }, - { - internalType: "address", - name: "partner", - type: "address", - }, - { - components: [ - { - internalType: "uint16", - name: "dividend", - type: "uint16", - }, - { - internalType: "uint16", - name: "referral", - type: "uint16", - }, - { - internalType: "uint16", - name: "partner", - type: "uint16", - }, - { - internalType: "uint16", - name: "treasury", - type: "uint16", - }, - { - internalType: "uint16", - name: "team", - type: "uint16", - }, - { - internalType: "uint256", - name: "dividendAmount", - type: "uint256", - }, - { - internalType: "uint256", - name: "partnerAmount", - type: "uint256", - }, - { - internalType: "uint256", - name: "treasuryAmount", - type: "uint256", - }, - { - internalType: "uint256", - name: "teamAmount", - type: "uint256", - }, - { - internalType: "uint256", - name: "referralAmount", - type: "uint256", - }, - { - internalType: "uint256", - name: "minPartnerTransferAmount", - type: "uint256", - }, - ], - internalType: "struct Bank.HouseEdgeSplit", - name: "houseEdgeSplit", - type: "tuple", - }, - { - internalType: "uint256", - name: "balanceReference", - type: "uint256", - }, - { - components: [ - { - internalType: "uint16", - name: "thresholdRate", - type: "uint16", - }, - { - internalType: "uint16", - name: "toTreasury", - type: "uint16", - }, - { - internalType: "uint16", - name: "toTeam", - type: "uint16", - }, - ], - internalType: "struct Bank.BalanceOverflow", - name: "balanceOverflow", - type: "tuple", - }, - ], - internalType: "struct Bank.Token", - name: "token", - type: "tuple", - }, - ], - internalType: "struct Bank.TokenMetadata[]", - name: "", - type: "tuple[]", - }, - ], - stateMutability: "view", - type: "function", - }, - block, - chain, - }); - - // Filter BetSwirl's governance token - const tokensWithoutBETS = tokens.filter((token) => token.symbol !== "BETS").map(i => i.tokenAddress) - return sumTokens2({ owner: bankAddressOfBlock, tokens: tokensWithoutBETS, chain, block, }) - }; -} +const { staking } = require('../helper/staking') +const { sumTokens2 } = require("../helper/unwrapLPs.js") module.exports = { - timetravel: true, - methodology: - "BetSwirl has no users TVL yet. However, it includes the bankrolls amounts (each tokens amount in the bank allowing players to bet).", - // The first Bank was deployed on Polygon at tx 0x6b99f617946d2f8c23adcd440cd3309d2da750e52d135853f38a0da11cdc3233 - start: 1648344312, // new Date(Date.UTC(2022, 2, 27, 1, 25, 12)).getTime() / 1e3, + methodology: "TVL counts BETS tokens or 8020 LP deposited on the Staking contracts.", + start: 1687715559, bsc: { - treasury: treasury("bsc"), - tvl: () => ({}), + staking: staking('0x20Df34eBe5dCB1082297A18BA8d387B55fB975a0', '0x94025780a1aB58868D9B2dBBB775f44b32e8E6e5'), }, polygon: { - treasury: treasury("polygon"), + staking: staking('0xA0D5F23dc9131597975afF96d293E5a7d0516665', '0x94025780a1aB58868D9B2dBBB775f44b32e8E6e5'), + }, + avax: { + staking: staking('0x9913EffA744B72385E537E092710072D21f8BC98', '0x94025780a1aB58868D9B2dBBB775f44b32e8E6e5'), }, - avax:{ - treasury: treasury("avax"), + arbitrum: { + staking: staking('0xA7Dd05a6CFC6e5238f04FD6E53D4eFa859B492e4', '0x94025780a1aB58868D9B2dBBB775f44b32e8E6e5'), + }, + ethereum: { + tvl: () => ({}), + pool2: (_, __, ___, { api }) => sumTokens2({ api, owners: ['0xaeaF7948C38973908fFA97c92F3384595d057135'], tokens: ['0x26cc136e9b8fd65466f193a8e5710661ed9a9827'] }), }, }; diff --git a/projects/bfx/index.js b/projects/bfx/index.js new file mode 100644 index 00000000000..b8cff8baf47 --- /dev/null +++ b/projects/bfx/index.js @@ -0,0 +1,14 @@ +const { staking } = require("../helper/staking"); +const { gmxExports } = require("../helper/gmx"); + +//bsc +const bscVault = "0xDDC99EE89f9556749e8e8916eEa5d3bBA8D6F13d"; +const bscStaking = "0x0F0b54d7446110210513295336E4A85dDA65e40D"; +const bscBFX = "0x491347561CEc563aD7D91135F92dBdC700277505"; + +module.exports = { + bsc: { + staking: staking(bscStaking, bscBFX), + tvl: gmxExports({ vault: bscVault }) + }, +}; diff --git a/projects/bhavish/index.js b/projects/bhavish/index.js new file mode 100644 index 00000000000..5e361a69dd8 --- /dev/null +++ b/projects/bhavish/index.js @@ -0,0 +1,23 @@ +const { nullAddress, sumTokensExport } = require('../helper/unwrapLPs') + +module.exports = { + polygon: { + tvl: sumTokensExport({ + tokensAndOwners: [ + [nullAddress, '0x83Bfcd4a0BF6f442CA62a6f68E7f6CecF5C01D1d'], + [nullAddress, '0x4A3ad4bB1A1b7CeE02E30F9f41d99985eA7A1E56'], + [nullAddress, '0xA59e8042b8199fB21913AE3b96178e15eF96bAc3'], + [nullAddress, '0x7768b73f95d5d5f77aad6cd3cD47591a6565F75D'], + [nullAddress, '0x747E2D83B5DaB11bD5351890D54e3944272aBDb9'], + [nullAddress, '0x3bc0D5A68f5b77497150cDbdB6f54DF64dD46Af2'], + ] + }), + }, + mantle: { + tvl: sumTokensExport({ + tokensAndOwners: [ + [nullAddress, '0xca0112597B795728d0aFC33dB2E3eD56D95F624d'], + ] + }), + } +} \ No newline at end of file diff --git a/projects/biconomy/index.js b/projects/biconomy/index.js index 896d9b41420..9992332667a 100644 --- a/projects/biconomy/index.js +++ b/projects/biconomy/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const { sumTokens2 } = require("../helper/unwrapLPs"); const { returnEthBalance } = require("../helper/utils") @@ -12,9 +13,9 @@ const config = { ], tokens: [ '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee', - '0x6b175474e89094c44da98b954eedeac495271d0f', - '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', - '0xdac17f958d2ee523a2206206994597c13d831ec7', + ADDRESSES.ethereum.DAI, + ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.USDT, ] }, polygon: { @@ -23,10 +24,10 @@ const config = { '0x2A5c2568b10A0E826BfA892Cf21BA7218310180b', ], tokens: [ - '0xc2132D05D31c914a87C6611C10748AEb04B58e8F', - '0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174', - '0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063', - '0x7ceb23fd6bc0add59e62ac25578270cff1b9f619', + ADDRESSES.polygon.USDT, + ADDRESSES.polygon.USDC, + ADDRESSES.polygon.DAI, + ADDRESSES.polygon.WETH_1, ] }, avax: { @@ -35,10 +36,10 @@ const config = { '0x2A5c2568b10A0E826BfA892Cf21BA7218310180b', ], tokens: [ - '0xc7198437980c041c805a1edcba50c1ce5db95118', - '0xa7d7079b0fead91f3e65f86e8915cb59c1a4c664', - '0xd586e7f844cea2f87f50152665bcbc2c279d8d70', - '0x49d5c2bdffac6ce2bfdb6640f4f80f226bc10bab', + ADDRESSES.avax.USDT_e, + ADDRESSES.avax.USDC_e, + ADDRESSES.avax.DAI, + ADDRESSES.avax.WETH_e, ] }, bsc: { @@ -47,9 +48,9 @@ const config = { '0x94D3E62151B12A12A4976F60EdC18459538FaF08', ], tokens: [ - '0x2170Ed0880ac9A755fd29B2688956BD959F933F8', - '0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d', - '0x55d398326f99059ff775485246999027b3197955', + ADDRESSES.bsc.ETH, + ADDRESSES.bsc.USDC, + ADDRESSES.bsc.USDT, ] }, optimism: { @@ -59,7 +60,7 @@ const config = { ], tokens: [ '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee', - '0x7f5c764cbc14f9669b88837ca1490cca17c31607', + ADDRESSES.optimism.USDC, ] }, arbitrum: { @@ -69,7 +70,7 @@ const config = { ], tokens: [ '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee', - '0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8', + ADDRESSES.arbitrum.USDC, ] }, } diff --git a/projects/bifi/index.js b/projects/bifi/index.js index df6f9c2d5f7..79096df0902 100644 --- a/projects/bifi/index.js +++ b/projects/bifi/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const { stakings } = require("../helper/staking"); const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') @@ -9,23 +10,23 @@ const ethPool = '0x13000c4a215efe7e414bb329b2f11c39bcf92d78'; const ethTokenPools = { 'usdt': { 'pool': '0x808c3ba97268dbf9695b1ec10729e09c7e67a9e3', - 'token': '0xdac17f958d2ee523a2206206994597c13d831ec7' + 'token': ADDRESSES.ethereum.USDT }, 'dai': { 'pool': '0xd76b7060f1b646fa14740ff6ac670a4f0a6fc5e3', - 'token': '0x6b175474e89094c44da98b954eedeac495271d0f' + 'token': ADDRESSES.ethereum.DAI }, 'link': { 'pool': '0x25567603eb61a4a49f27e433652b5b8940d10682', - 'token': '0x514910771af9ca656af840dff83e8264ecf986ca' + 'token': ADDRESSES.ethereum.LINK }, 'usdc': { 'pool': '0x128647690C7733593aA3Dd149EeBC5e256E79217', - 'token': '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48' + 'token': ADDRESSES.ethereum.USDC }, 'wbtc': { 'pool': '0x93948Aa8488F522d5b079AF84fe411FBCE476e9f', - 'token': '0x2260fac5e5542a773aa44fbcfedf7c193bc2c599' + 'token': ADDRESSES.ethereum.WBTC } } @@ -34,7 +35,7 @@ const bscPool = '0x170b6AA872166eC2F8515c2B855C34B6C7563c18' const bscTokenPools = { 'usdt': { 'pool': '0x2A29598cbc17BA112C8Fd0E07Fbf5402eF57E6b8', - 'token': '0x55d398326f99059ff775485246999027b3197955' + 'token': ADDRESSES.bsc.USDT }, 'dai': { 'pool': '0xB67C5433d234d656002f12664d15ab4b40666D9B', @@ -42,19 +43,19 @@ const bscTokenPools = { }, 'eth': { 'pool': '0xf86d8218BCC15874f5D25c191FdDd43F2334c3EB', - 'token': '0x2170ed0880ac9a755fd29b2688956bd959f933f8' + 'token': ADDRESSES.bsc.ETH }, 'usdc': { 'pool': '0xBA9De5a8FD91408826616f2d6d7470A11E34c9F0', - 'token': '0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d' + 'token': ADDRESSES.bsc.USDC }, 'btcb': { 'pool': '0x26d0E4707af1c1DAAd8e9BA21b99cDa7Fd24c40B', - 'token': '0x7130d2a12b9bcbfae4f2634d864a1ee1ce3ead9c' + 'token': ADDRESSES.bsc.BTCB }, 'busd': { 'pool': '0x829ED2a2BeF8b72e648f92CBF01587C7E12e8c1e', - 'token': '0xe9e7cea3dedca5984780bafc599bd69add087d56' + 'token': ADDRESSES.bsc.BUSD } } @@ -62,19 +63,19 @@ const avaxPool = '0x446881360d6d39779D292662fca9BC85C5789dB3' const avaxTokenPools = { 'eth': { 'pool': '0x8AbA88E8A4AB28319b782199cB17f0001EE67984', - 'token': '0x49D5c2BdFfac6CE2BFdB6640F4F80f226bc10bAB' + 'token': ADDRESSES.avax.WETH_e }, 'usdt': { 'pool': '0xE893233515b7D02dD4e3D888162d4C87Dc837943', - 'token': '0xc7198437980c041c805A1EDcbA50c1Ce5db95118' + 'token': ADDRESSES.avax.USDT_e }, 'usdc': { 'pool': '0x8385Ea36dD4BDC84B3F2ac718C332E18C1E42d36', - 'token': '0xA7D7079b0FEaD91F3e65f86E8915Cb59c1a4C664' + 'token': ADDRESSES.avax.USDC_e }, 'dai': { 'pool': '0x34DA42143b0c6E321CEb76931c637c12Bd865f7e', - 'token': '0xd586E7F844cEa2F87f50152665BCbc2C279D8d70' + 'token': ADDRESSES.avax.DAI }, 'wbtc': { 'pool': '0xc4D1e935F02A44D44985E6b1C0eE1ee616fC146a', @@ -86,27 +87,27 @@ const klayPool = '0x829fCFb6A6EeA9d14eb4C14FaC5B29874BdBaD13'; const klaytnTokenPools = { 'keth': { 'pool': '0x07970F9D979D8594B394fE12345211C376aDfF89', - 'token': '0x34d21b1e550d73cee41151c77f3c73359527a396' + 'token': ADDRESSES.klaytn.oETH }, 'kusdt': { 'pool': '0xe0e67b991d6b5CF73d8A17A10c3DE74616C1ec11', - 'token': '0xcee8faf64bb97a73bb51e115aa89c17ffa8dd167' + 'token': ADDRESSES.klaytn.oUSDT }, 'kdai': { 'pool': '0xE03487927e137526a2dB796A9B3b4048ab615043', - 'token': '0x5c74070fdea071359b86082bd9f9b3deaafbe32b' + 'token': ADDRESSES.klaytn.KDAI }, 'usdc': { 'pool': '0x808c707c53c3D30d0247e4b8D78AA0D8b75CAAE1', - 'token': '0x754288077d0ff82af7a5317c7cb8c444d421d103' + 'token': ADDRESSES.klaytn.oUSDC }, 'kwbtc': { 'pool': '0xa6aDE2e6c6F50a2d9b9C4b819e84b367F88C1598', - 'token': '0x16d0e1fbd024c600ca0380a4c5d57ee7a2ecbf9c' + 'token': ADDRESSES.klaytn.oWBTC }, 'kxrp': { 'pool': '0x4800577A71F68eD7ef4C09cFBe7fd6E066D5F0dA', - 'token': '0x9eaefb09fe4aabfbe6b1ca316a3c36afc83a393f' + 'token': ADDRESSES.klaytn.oXRP }, } @@ -116,7 +117,7 @@ async function eth(timestamp, block) { return sumTokens2({ block, tokensAndOwners: toa }) } -const wbtc = "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599" +const wbtc = ADDRESSES.ethereum.WBTC async function bitcoin(timestamp, ethBlock) { const tokenPool = { 'pool': '0x986Eb51E67e154901ff9B482835788B8f3054076', diff --git a/projects/bifrost-dex/api.js b/projects/bifrost-dex/api.js index 08f05b5a19a..db808b56fdf 100644 --- a/projects/bifrost-dex/api.js +++ b/projects/bifrost-dex/api.js @@ -1,9 +1,10 @@ const { ApiPromise, WsProvider } = require("@polkadot/api"); const BigNumber = require("bignumber.js"); +const sdk = require('@defillama/sdk') // node test.js projects/bifrost-dex/api.js -function formatToken(token) { +function formatToken(token, type) { switch (token) { case `{"Token":"RMRK"}`: return "RMRK"; @@ -19,7 +20,21 @@ function formatToken(token) { return "ZLK"; case `{"Stable":"KUSD"}`: return "KUSD"; - default : + case `{"Token2":"0"}`: + return type === "kusama" ? "USDT" : "DOT"; + case `{"Token2":"1"}`: + return type === "kusama" ? "KINT" : "GLMR"; + case `{"VToken2":"0"}`: + return "vDOT"; + case `{"VToken2":"4"}`: + return "vFIL"; + case `{"Token2":"4"}`: + return "FIL"; + case `{"VToken":"BNC"}`: + return "vBNC"; + case `{"VToken":"MOVR"}`: + return "vMOVR"; + default: return null; } } @@ -28,11 +43,17 @@ function formatTokenAmount(amount, tokenSymbol) { let decimals = 12; switch (tokenSymbol) { + case "USDT": + decimals = 6; + break; + + case "vDOT": case "DOT": case "RMRK": decimals = 10; break; + case "vBNC": case "BNC": case "KSM": case "KAR": @@ -41,7 +62,12 @@ function formatTokenAmount(amount, tokenSymbol) { break; case "ETH": case "ZLK": + case "vMOVR": + case "vGLMR": case "MOVR": + case "GLMR": + case "FIL": + case "vFIL": decimals = 18; break; } @@ -51,38 +77,79 @@ function formatTokenAmount(amount, tokenSymbol) { const tokenToCoingecko = { DOT: "polkadot", - BNC: "bifrost", + BNC: "bifrost-native-coin", KSM: "kusama", - KAR: "karura", MOVR: "moonriver", - KUSD: "tether", + GLMR: "moonbeam", + KUSD: "acala-dollar", ZLK: "zenlink-network-token", - RMRK: "rmrk", - ETH: "ethereum" + USDT: "tether", + FIL: "filecoin", }; async function tvl() { - const provider = new WsProvider("wss://bifrost-rpc.liebi.com/ws"); - const api = await ApiPromise.create(({ provider })); + const kusamaProvider = new WsProvider("wss://bifrost-rpc.liebi.com/ws"); + const kusamaApi = await ApiPromise.create(({ provider: kusamaProvider })); const totalLiquidity = {}; const totalLiquidityFormatted = {}; // Get swap tvl - const pools = await api.query.zenlinkProtocol.pairStatuses.entries(); - await Promise.all(pools.map(async (pool) => { + const kusamaPools = await kusamaApi.query.zenlinkProtocol.pairStatuses.entries(); + await Promise.all(kusamaPools.map(async (pool) => { + if (pool[1].toHuman()?.Trading?.pairAccount) { + const poolAccountTokens = await kusamaApi.query.tokens.accounts.entries(pool[1].toHuman()?.Trading?.pairAccount); + const poolTokens = poolAccountTokens.filter(item => !item[0].toHuman()[1].LPToken); + + if (!poolTokens[0]) return; + + let currentToken = formatToken(JSON.stringify(poolTokens[0][0].toHuman()[1]), "kusama"); + const isVtoken = currentToken.startsWith("v"); + let ratio = 1; + currentToken = isVtoken ? currentToken.slice(1) : currentToken; + + if (isVtoken) { + const tokenPool = await kusamaApi.query.vtokenMinting.tokenPool(currentToken === "BNC" ? { "native": currentToken } : { "token": currentToken }); + const totalIssuance = await kusamaApi.query.tokens.totalIssuance({ "vToken": currentToken }); + ratio = new BigNumber(tokenPool).div(totalIssuance).toNumber(); + } + + if (totalLiquidity[currentToken]) { + totalLiquidity[currentToken] = new BigNumber(totalLiquidity[currentToken]).plus(new BigNumber(poolTokens[0][1].toJSON().free).multipliedBy(2).multipliedBy(ratio)).toFixed().split(".")[0]; + } else { + totalLiquidity[currentToken] = new BigNumber(poolTokens[0][1].toJSON().free).multipliedBy(2).multipliedBy(ratio).toFixed().split(".")[0]; + } + } + })); + + const polkadotProvider = new WsProvider("wss://hk.p.bifrost-rpc.liebi.com/ws"); + const polkadotApi = await ApiPromise.create(({ provider: polkadotProvider })); + + const polkadotPools = await polkadotApi.query.zenlinkProtocol.pairStatuses.entries(); + await Promise.all(polkadotPools.map(async (pool) => { if (pool[1].toHuman()?.Trading?.pairAccount) { - const ttt = {}; - const poolAccountTokens = await api.query.tokens.accounts.entries(pool[1].toHuman()?.Trading?.pairAccount); + const poolAccountTokens = await polkadotApi.query.tokens.accounts.entries(pool[1].toHuman()?.Trading?.pairAccount); const poolTokens = poolAccountTokens.filter(item => !item[0].toHuman()[1].LPToken); - if(!poolTokens[0]) return; - const currentToken = formatToken(JSON.stringify(poolTokens[0][0].toHuman()[1])); - ttt[currentToken] = new BigNumber(poolTokens[0][1].toJSON().free).multipliedBy(2).toString(); + if (!poolTokens[0]) return; + + let currentToken = formatToken(JSON.stringify(poolTokens[0][0].toHuman()[1]), "polkadot"); + let ratio = 1; + sdk.log(currentToken, poolTokens[0][0].toHuman()) + if (!currentToken) return; + const isVtoken = currentToken.startsWith("v"); + currentToken = isVtoken ? currentToken.slice(1) : currentToken; + + if (isVtoken) { + const tokenPool = await polkadotApi.query.vtokenMinting.tokenPool({ "token2": poolTokens[0][0].toHuman()[1].VToken2 }); + const totalIssuance = await polkadotApi.query.tokens.totalIssuance({ "vToken2": poolTokens[0][0].toHuman()[1].VToken2 }); + ratio = new BigNumber(tokenPool).div(totalIssuance).toNumber(); + } + if (totalLiquidity[currentToken]) { - totalLiquidity[currentToken] = new BigNumber(totalLiquidity[currentToken]).plus(new BigNumber(poolTokens[0][1].toJSON().free).multipliedBy(2)).toString(); + totalLiquidity[currentToken] = new BigNumber(totalLiquidity[currentToken]).plus(new BigNumber(poolTokens[0][1].toJSON().free).multipliedBy(2).multipliedBy(ratio)).toFixed().split(".")[0]; } else { - totalLiquidity[currentToken] = new BigNumber(poolTokens[0][1].toJSON().free).multipliedBy(2).toString(); + totalLiquidity[currentToken] = new BigNumber(poolTokens[0][1].toJSON().free).multipliedBy(2).multipliedBy(ratio).toFixed().split(".")[0]; } } })); diff --git a/projects/bifrost-liquid-crowdloan/api.js b/projects/bifrost-liquid-crowdloan/api.js new file mode 100644 index 00000000000..5eb33f065d1 --- /dev/null +++ b/projects/bifrost-liquid-crowdloan/api.js @@ -0,0 +1,55 @@ +const { ApiPromise, WsProvider } = require("@polkadot/api"); + +// node test.js projects/bifrost-liquid-crowdloan/api.js + +function formatTokenAmount(amount, tokenSymbol) { + let decimals = 12; + switch (tokenSymbol) { + case "DOT": + decimals = 10; + break; + case "KSM": + decimals = 12; + break; + } + + return Number(amount / Number(10 ** decimals)); +} + +const tokenToCoingecko = { + DOT: "polkadot", + KSM: "kusama", +}; + + +async function tvl() { + const kusamaProvider = new WsProvider("wss://bifrost-rpc.liebi.com/ws"); + const kusamaApi = await ApiPromise.create(({ provider:kusamaProvider })); + + const polkadotProvider = new WsProvider("wss://hk.p.bifrost-rpc.liebi.com/ws"); + const polkadotApi = await ApiPromise.create(({ provider:polkadotProvider })); + + //Get Salp tvl + const vsKSM = (await kusamaApi.query.tokens.totalIssuance({ "vsToken": "KSM" })).toString(); + const vsDOT = (await polkadotApi.query.tokens.totalIssuance({ "vsToken2": "0" })).toString(); + + const totalLiquidity = {}; + totalLiquidity.KSM = vsKSM; + totalLiquidity.DOT = vsDOT; + + const totalLiquidityFormatted = {}; + for (const key in totalLiquidity) { + totalLiquidityFormatted[tokenToCoingecko[key]] = formatTokenAmount( + totalLiquidity[key], + key + ); + } + + return totalLiquidityFormatted; +} + +module.exports = { + timetravel: false, + methodology: "Minted vTokens from other chains (only calculate the underlying asset value)", + bifrost: { tvl } +}; \ No newline at end of file diff --git a/projects/bifrost-liquid-crowdloan/index.js b/projects/bifrost-liquid-crowdloan/index.js new file mode 100644 index 00000000000..2d761e335a7 --- /dev/null +++ b/projects/bifrost-liquid-crowdloan/index.js @@ -0,0 +1,6 @@ +const { getExports } = require('../helper/heroku-api') + +module.exports = { + timetravel: false, + ...getExports("bifrost-liquid-crowdloan", ['bifrost']) +} \ No newline at end of file diff --git a/projects/bifrost-staking/api.js b/projects/bifrost-staking/api.js index b461732a9f6..e8daa737da2 100644 --- a/projects/bifrost-staking/api.js +++ b/projects/bifrost-staking/api.js @@ -9,19 +9,17 @@ function formatTokenAmount(amount, tokenSymbol) { switch (tokenSymbol) { case "DOT": - case "RMRK": decimals = 10; break; case "BNC": case "KSM": - case "KAR": - case "KUSD": decimals = 12; break; case "ETH": - case "ZLK": + case "GLMR": case "MOVR": + case "FIL": decimals = 18; break; } @@ -31,41 +29,51 @@ function formatTokenAmount(amount, tokenSymbol) { const tokenToCoingecko = { DOT: "polkadot", - BNC: "bifrost", + BNC: "bifrost-native-coin", KSM: "kusama", - KAR: "karura", MOVR: "moonriver", - KUSD: "tether", - ZLK: "zenlink-network-token", - RMRK: "rmrk", - ETH: "ethereum" + GLMR: "moonbeam", + ETH: "ethereum", + FIL: "filecoin" }; +function formatToken(token) { + switch (token) { + case '0': + return "DOT"; + case '1': + return "GLMR"; + case '4': + return "FIL"; + default : + return null; + } +} + + async function tvl() { - const provider = new WsProvider("wss://bifrost-rpc.liebi.com/ws"); - const api = await ApiPromise.create(({ provider })); + const kusamaProvider = new WsProvider("wss://bifrost-rpc.liebi.com/ws"); + const kusamaApi = await ApiPromise.create(({ provider:kusamaProvider })); - // Get Salp tvl - const vsKSM = (await api.query.tokens.totalIssuance({ "vsToken": "KSM" })).toString(); - const vsDOT = (await api.query.tokens.totalIssuance({ "vsToken": "DOT" })).toString(); + const polkadotProvider = new WsProvider("wss://hk.p.bifrost-rpc.liebi.com/ws"); + const polkadotApi = await ApiPromise.create(({ provider:polkadotProvider })); const totalLiquidity = {}; - totalLiquidity.KSM = vsKSM; - totalLiquidity.DOT = vsDOT; - // Get vToken tvl (vKSM / vMOVR ) - const tokenPool = await api.query.vtokenMinting.tokenPool.entries(); + // Get kusama vToken tvl (vKSM / vMOVR / vBNC) + const kusamaTokenPool = await kusamaApi.query.vtokenMinting.tokenPool.entries(); + // Get polkadot vToken tvl (vDOT / vGLMR ) + const polkadotTokenPool = await polkadotApi.query.vtokenMinting.tokenPool.entries(); - await Promise.all(tokenPool.map(async (pool) => { + await Promise.all(kusamaTokenPool.map(async (pool) => { const token=pool[0].toHuman()[0].Token||pool[0].toHuman()[0].Native totalLiquidity[token]=new BigNumber(totalLiquidity[token]||0).plus(pool[1].toString()).toString() })); - // Get vETH tvl - const { output: totalSupply } = await sdk.api.erc20.totalSupply({ - target: '0xc3d088842dcf02c13699f936bb83dfbbc6f721ab' - }) - totalLiquidity["ETH"] = totalSupply; + await Promise.all(polkadotTokenPool.map(async (pool) => { + const token=formatToken(pool[0].toHuman()[0].Token2) + totalLiquidity[token]=new BigNumber(totalLiquidity[token]||0).plus(pool[1].toString()).toString() + })); const totalLiquidityFormatted = {}; for (const key in totalLiquidity) { diff --git a/projects/bifrost-staking/index.js b/projects/bifrost-staking/index.js index 3aef11bc97a..70e47cfb16f 100644 --- a/projects/bifrost-staking/index.js +++ b/projects/bifrost-staking/index.js @@ -1,6 +1,32 @@ +const BigNumber = require("bignumber.js") const { getExports } = require('../helper/heroku-api') +const { nullAddress } = require('../helper/unwrapLPs') module.exports = { timetravel: false, - ...getExports("bifrost-staking", ['bifrost']) -} \ No newline at end of file + bifrost: { + tvl: async () => { + const { bifrost } = getExports("bifrost-staking", ['bifrost']) + const tvl = await bifrost.tvl() + return { 'bifrost-native-coin': tvl['bifrost-native-coin'], polkadot: tvl.polkadot, kusama: tvl.kusama, moonbeam: tvl.moonbeam, moonriver: tvl.moonriver, } + } + }, + ethereum: { + tvl: async (_, _1, _2, { api }) => { + const vETH = await api.call({ target: '0x4bc3263eb5bb2ef7ad9ab6fb68be80e43b43801f', abi: 'uint256:totalSupply' }) + const contract_veth1 = await api.call({ target: '0xc3d088842dcf02c13699f936bb83dfbbc6f721ab', abi: 'uint256:totalSupply' }) + const contract_veth1_null_address_balance = await api.call({ target: '0xc3d088842dcf02c13699f936bb83dfbbc6f721ab', abi: 'erc20:balanceOf', params: '0x000000000000000000000000000000000000dEaD' }) + + return { + [nullAddress]: new BigNumber(vETH).plus(contract_veth1).minus(contract_veth1_null_address_balance).toString(), + } + } + }, + filecoin: { + tvl: async () => { + const { bifrost } = getExports("bifrost-staking", ['bifrost']) + const { filecoin } = await bifrost.tvl() + return { filecoin } + } + }, +} diff --git a/projects/bigdataprotocol/abi.json b/projects/bigdataprotocol/abi.json index 9f2d9aabafa..a3f8771ea5b 100644 --- a/projects/bigdataprotocol/abi.json +++ b/projects/bigdataprotocol/abi.json @@ -1,36 +1,3 @@ { - "poolInfo": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "poolInfo", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "lpToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "allocPoint", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastRewardBlock", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "rewardPerShare", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } + "poolInfo": "function poolInfo(uint256) view returns (address lpToken, uint256 allocPoint, uint256 lastRewardBlock, uint256 rewardPerShare)" } \ No newline at end of file diff --git a/projects/bigdataprotocol/index.js b/projects/bigdataprotocol/index.js index 30473d0204a..0d3246080de 100644 --- a/projects/bigdataprotocol/index.js +++ b/projects/bigdataprotocol/index.js @@ -1,57 +1,14 @@ -const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); const { staking } = require("../helper/staking"); const { addFundsInMasterChef } = require("../helper/masterchef"); -const { sumTokens2 } = require('../helper/unwrapLPs') const BDPMasterContract = "0x0De845955E2bF089012F682fE9bC81dD5f11B372"; const BDP = "0xf3dcbc6d72a4e1892f7917b7c43b74131df8480e"; -const BFactory = '0xbe0083053744ecb871510c88dc0f6b77da162706' const chain = 'ethereum' -const getCurrentTokensABI = { - "constant": true, - "inputs": [], - "name": "getCurrentTokens", - "outputs": [ - { - "name": "tokens", - "type": "address[]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" -} - -const ethTvl = async (_, block) => { - - - const logs = ( - await sdk.api.util.getLogs({ - keys: [], - toBlock: block, - target: BFactory, - fromBlock: 11105585, - topic: 'BPoolCreated(address,address)', - }) - ).output - - const pools = logs - .map((log) => `0x${log.topics[1].substring(26)}`) - - const { output: tokens } = await sdk.api.abi.multiCall({ - abi: getCurrentTokensABI, - calls: pools.map(i => ({ target: i })), - chain, block, - }) - +const ethTvl = async (_, block, _1, { api }) => { const balances = {}; - const toa = [] - - tokens.forEach(({ output, input: { target } }) => output.forEach(t => toa.push([t, target]))) - /*** BDP Seed Pools (Data Vault seccion) TVL portion ***/ await addFundsInMasterChef( balances, @@ -61,10 +18,7 @@ const ethTvl = async (_, block) => { addr => addr, abi.poolInfo, ); - - // console.log(toa.length) - - return sumTokens2({ balances, tokensAndOwners: toa, chain, block, }); + return balances }; module.exports = { @@ -72,7 +26,5 @@ module.exports = { staking: staking(BDPMasterContract, BDP), tvl: ethTvl, }, - methodology: `Counts liquidity on the Pools of Data Vault and Data Market seccions through BDPMaster Contract - and using Subgraph API 'https://subgraph.mainnet.bigdataprotocolmarket.com:8000/subgraphs/name/oceanprotocol/ocean-subgraph' - to pulling data` + methodology: `Counts liquidity in masterchef` } \ No newline at end of file diff --git a/projects/billion-happiness/index.js b/projects/billion-happiness/index.js index ecf205e2bbf..0e8a4bbbc4b 100644 --- a/projects/billion-happiness/index.js +++ b/projects/billion-happiness/index.js @@ -1,12 +1,13 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { pool2 } = require("../helper/pool2.js"); const { stakings, staking } = require("../helper/staking.js"); const bhcToken = "0x6fd7c98458a943f469E1Cf4eA85B173f5Cd342F4"; const masterchef = "0xC5c482a4Ed34b80B861B4e6Eb28664a46bd3eC8B"; //"Feeling Sweet Masterchef" const pool2LP = "0x851dB01B337Ee3E5Ab161ad04356816F09EA01dc"; // "Feeling Sweet" BHC-WBNB -const bhcTokenETHW = "0x0c9f28FBdFd79f7C00B805d8c63D053c146d282c"; +const bhcTokenETHW = ADDRESSES.ethpow.BHC; const BHC_ETHW = "0x899fED261A7df2761CF0b6f7556B80669D135802"; -const WETHW = "0x7Bf88d2c0e32dE92CdaF2D43CcDc23e8Edfd5990"; +const WETHW = ADDRESSES.ethpow.WETHW; const stakingPools = [ "0xa4712bd37cdE563bDfccCfa6DE5E5c2b1Da5572B", // "Feeling Playful" diff --git a/projects/binance-beth/index.js b/projects/binance-beth/index.js new file mode 100644 index 00000000000..48188c8f664 --- /dev/null +++ b/projects/binance-beth/index.js @@ -0,0 +1,15 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress } = require("../helper/unwrapLPs"); +const sdk = require('@defillama/sdk') + +module.exports = { + ethereum: { + tvl: async (timestamp) => { + const api = new sdk.ChainApi({ timestamp, chain: 'bsc' }) + await api.getBlock() + return { + [nullAddress]: await api.call({ target: ADDRESSES.bsc.BETH, abi: 'uint256:totalSupply'}) + } + } + } +} \ No newline at end of file diff --git a/projects/binance-staked-eth/index.js b/projects/binance-staked-eth/index.js new file mode 100644 index 00000000000..dc8631e48b4 --- /dev/null +++ b/projects/binance-staked-eth/index.js @@ -0,0 +1,16 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const sdk = require("@defillama/sdk") +const token = '0xa2E3356610840701BDf5611a53974510Ae27E2e1' + +module.exports = { + ethereum: { + tvl: async (_, block) => ({ + ["ethereum:" + ADDRESSES.null]: (await sdk.api.erc20.totalSupply({ target: token, block})).output + }) + }, + bsc: { + tvl: async (_, block, chainBlocks) => ({ + ["ethereum:" + ADDRESSES.null]: (await sdk.api.erc20.totalSupply({ target: token, chain:"bsc", block: chainBlocks.bsc})).output + }) + } +} diff --git a/projects/binance-us/index.js b/projects/binance-us/index.js new file mode 100644 index 00000000000..a259445b732 --- /dev/null +++ b/projects/binance-us/index.js @@ -0,0 +1,14 @@ +const { cexExports } = require('../helper/cex') + +const config = { + ethereum: { + owners: [ + '0x61189da79177950a7272c88c6058b96d4bcd6be2', + '0x34ea4138580435b5a521e460035edb19df1938c1', + '0xf60c2ea62edbfe808163751dd0d8693dcb30019c', + ], + }, +} + +module.exports = cexExports(config) +module.exports.methodology = 'This wallets where collect from etherscan labelling.' \ No newline at end of file diff --git a/projects/binance/config.js b/projects/binance/config.js index 465bd88df72..b063348ad47 100644 --- a/projects/binance/config.js +++ b/projects/binance/config.js @@ -1,14 +1,28 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { getUniqueAddresses } = require('../helper/utils') // taken from https://www.binance.com/en/blog/community/our-commitment-to-transparency-2895840147147652626 const assetList = [ ["BTC", "BTC", "34xp4vRoCGJym3xR7yCVPFHoCNxv4Twseo"], - ["BTC", "BTC", "3LYJfcfHPXYJreMsASk2jkn69LWEYKzexb"], + //["BTC", "BTC", "3LYJfcfHPXYJreMsASk2jkn69LWEYKzexb"], ["BTC", "BTC", "3M219KR5vEneNb47ewrPfWyb5jQ2DjxRP6"], + ["BTC", "BTC", "3LcgLHzTvjLKBixBvkKGiadtiw2GBSKKqH"], ["BTC", "BTC", "3JJmF63ifcamPLiAmLgG96RA599yNtY3EQ"], ["BTC", "BTC", "3HdGoUTbcztBnS7UzY4vSPYhwr424CiWAA"], + ["BTC", "BTC", "395vnFScKQ1ay695C6v7gf89UzoFpx3WuJ"], + //["BTC", "BTC", "3FrmCRcGKiTATfreBDM9F17yAUDoDsnWeA"], + ["BTC", "BTC", "3FHNBLobJnbCTFTVakh5TXmEneyf5PT61B"], + ["BTC", "BTC", "3LQUu4v9z6KNch71j7kbj8GPeAGUo1FW6a"], + ["BTC", "BTC", "3AeUiDpPPUrUBS377584sFCpx8KLfpX9Ry"], + ["BTC", "BTC", "3JFJPpH8Chwo7CDbyYQ4XcfgcjEP1FGRMJ"], + ["BTC", "BTC", "34HpHYiyQwg69gFmCq2BGHjF1DZnZnBeBP"], ["BTC", "BTC", "bc1qm34lsc65zpw79lxes69zkqmk6ee3ewf0j77s3h"], + // ["BTC", "BTC", "38Xnrq8MZiKmYmwobbYdZQ5nnCbX1qvQfE"], old wallet that moved 3.1b to new one + ["BTC", "BTC", "3EbJfpmFgufYtzW9UFvf1GAfm2ted1Rwnr"], + ["BTC", "BTC", "38DN2uFMZPiHLHJigfv4kWC9JWJrNnhLcn"], + ["BTC", "BTC", "3Qxak1CZhLyZ7GVckKphLURdLBCjMfz9bA"], + ["BTC", "BTC", "36zSLdRv1jyewjaC12fqK5fptn7PqewunL"], ["ETH", "ETH", "0xbe0eb53f46cd790cd13851d5eff43d12404d33e8"], ["ETH", "ETH", "0xf977814e90da44bfa03b6295a0616a897441acec"], ["ETH", "ETH", "0x5a52e96bacdabb82fd05763e25335261b270efcb"], @@ -18,14 +32,14 @@ const assetList = [ ["ETH", "ETH", "0xdfd5293d8e347dfe59e90efd55b2956a1343963d"], ["ETH", "ETH", "0x56eddb7aa87536c09ccc2793473599fd21a8b17f"], ["ETH", "ETH", "0x4976a4a02f38326660d17bf34b431dc6e2eb2327"], - ["USDC", "ETH", "0xa344c7aDA83113B3B56941F6e85bf2Eb425949f3"], + // ["USDC", "ETH", "0xa344c7aDA83113B3B56941F6e85bf2Eb425949f3"], ["USDC", "ETH", "0x28c6c06298d514db089934071355e5743bf21d60"], ["USDC", "ETH", "0x21a31ee1afc51d94c2efccaa2092ad1028285549"], ["USDC", "ETH", "0xdfd5293d8e347dfe59e90efd55b2956a1343963d"], ["USDC", "TRX", "TV6MuMXfmLbBqPZvBHdwFsDnQeVfnmiuSi"], - ["USDT", "ETH", "0x47ac0Fb4F2D84898e4D9E7b4DaB3C24507a6D503"], + // ["USDT", "ETH", "0x47ac0Fb4F2D84898e4D9E7b4DaB3C24507a6D503"], ["USDT", "ETH", "0xf977814e90da44bfa03b6295a0616a897441acec"], - ["USDT", "ETH", "0xa344c7aDA83113B3B56941F6e85bf2Eb425949f3"], + // ["USDT", "ETH", "0xa344c7aDA83113B3B56941F6e85bf2Eb425949f3"], ["USDT", "ETH", "0x28c6c06298d514db089934071355e5743bf21d60"], ["USDT", "ETH", "0x21a31ee1afc51d94c2efccaa2092ad1028285549"], ["USDT", "ETH", "0x56eddb7aa87536c09ccc2793473599fd21a8b17f"], @@ -34,47 +48,53 @@ const assetList = [ ["USDT", "ETH", "0x4976a4a02f38326660d17bf34b431dc6e2eb2327"], ["USDT", "TRX", "TMuA6YqfCeX8EhbfYEg5y7S4DqzSJireY9"], ["USDT", "TRX", "TWd4WrZ9wn84f5x1hZhL4DHvk738ns5jwb"], + ["USDC", "TRX", "TWd4WrZ9wn84f5x1hZhL4DHvk738ns5jwb"], + ["BUSD", "TRX", "TWd4WrZ9wn84f5x1hZhL4DHvk738ns5jwb"], + ["USDT", "TRX", "TJCo98saj6WND61g1uuKwJ9GMWMT9WkJFo"], ["USDT", "TRX", "TV6MuMXfmLbBqPZvBHdwFsDnQeVfnmiuSi"], + ["BUSD", "TRX", "TV6MuMXfmLbBqPZvBHdwFsDnQeVfnmiuSi"], ["USDT", "TRX", "TJDENsfBJs4RFETt1X1W8wMDc8M5XnJhCe"], ["USDT", "TRX", "TAzsQ9Gx8eqFNFSKbeXrbi45CuVPHzA8wr"], ["USDT", "TRX", "TQrY8tryqsYVCYS3MFbtffiPp2ccyn4STm"], ["USDT", "TRX", "TNXoiAJ3dct8Fjg4M9fkLFh9S2v9TXc32G"], + ["USDC", "TRX", "TNXoiAJ3dct8Fjg4M9fkLFh9S2v9TXc32G"], + ["BUSD", "TRX", "TNXoiAJ3dct8Fjg4M9fkLFh9S2v9TXc32G"], ["USDT", "TRX", "TYASr5UV6HEcXatwdFQfmLVUqQQQMUxHLS"], ["BUSD", "ETH", "0xf977814e90da44bfa03b6295a0616a897441acec"], - ["BUSD", "ETH", "0x47ac0Fb4F2D84898e4D9E7b4DaB3C24507a6D503"], + // ["BUSD", "ETH", "0x47ac0Fb4F2D84898e4D9E7b4DaB3C24507a6D503"], ["BUSD", "ETH", "0xbe0eb53f46cd790cd13851d5eff43d12404d33e8"], ["BUSD", "ETH", "0x5a52e96bacdabb82fd05763e25335261b270efcb"], - ["BUSD", "ETH", "0xa344c7aDA83113B3B56941F6e85bf2Eb425949f3"], + // ["BUSD", "ETH", "0xa344c7aDA83113B3B56941F6e85bf2Eb425949f3"], ["BUSD", "ETH", "0xdfd5293d8e347dfe59e90efd55b2956a1343963d"], ["BUSD", "ETH", "0x28c6c06298d514db089934071355e5743bf21d60"], ["BUSD", "ETH", "0x21a31ee1afc51d94c2efccaa2092ad1028285549"], - ["BNB", "BEP2", "bnb1edrs5cukhx060e02u98v9j8spum7vhuqg9ctxd"], + //["BNB", "BEP2", "bnb1edrs5cukhx060e02u98v9j8spum7vhuqg9ctxd"], ["BNB", "BEP2", "bnb142q467df6jun6rt5u2ar58sp47hm5f9wvz2cvg"], ["BNB", "BEP2", "bnb1u2agwjat20494fmc6jnuau0ls937cfjn4pjwtn"], ["BNB", "BEP2", "bnb1lsmt5a8vqqus5fwslx8pyyemgjtg4y6ugj308t"], ["BNB", "BEP2", "bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz"], - ["BNB", "BEP2", "bnb1jxfh2g85q3v0tdq56fnevx6xcxtcnhtsmcu64m"], + //["BNB", "BEP2", "bnb1jxfh2g85q3v0tdq56fnevx6xcxtcnhtsmcu64m"], ["BNB", "BEP2", "bnb1m5amny2gs3xdyta6pksmr43zu4727w24syyks7"], - ["BNB", "BEP2", "bnb1panyupy43sazh4dka6fg3s08909ejhqz4k23eg"], - ["BNB", "BEP2", "bnb1ymasdm96ld0v6s38ylvu0qsw0xmhdlhy47tpsg"], - ["BNB", "BEP2", "bnb1tdcrvgjl580p2qv77y0cu2ezk3c80039psx6sh"], - ["BNB", "BEP2", "bnb1e08c39tjpr5fvdh4cfhqmyclrh62ag45qmddud"], - ["BNB", "BEP2", "bnb1lq4s05lgat8d0qh275q0elt4m9rs760m0ryced"], - ["BNB", "BEP2", "bnb1t5fn9faqu5aanvexqu8dt9tah4jg20eun8gsee"], - ["BNB", "BEP2", "bnb1dkckvfuqv7fjl902cvuqmde27skk94kjp09j99"], - ["BNB", "BEP2", "bnb14u5qnp4peug4a6wlz327mx9xjd0xf6phe7ew8u"], - ["BNB", "BEP2", "bnb19fk9hqqlp8xcwrt0w35weyufnglp43hlthev3l"], - ["BNB", "BEP2", "bnb1uexf06gd94qsxdmqamk360d893dsrm8lvwyjsd"], - ["BNB", "BEP2", "bnb1uwdm6vrfvx43wqj8cj3h362kad0g0nrk3gumg8"], - ["BNB", "BEP2", "bnb1a5f0ghn3c2whfmz3z0wjggwcgsk2t26ynqn68x"], - ["BNB", "BEP2", "bnb1s3czyqxaf4hyt3rueg9gss08nfnvxjzy5qfu2p"], - ["BNB", "BEP2", "bnb1yud0r5kz3ctu07fwax3j753ueef6d0n0uxrx94"], - ["BNB", "BEP2", "bnb1fxk3lmfu2h0qhywdump0hvggg6prlge88f42n9"], - ["BNB", "BEP2", "bnb1erq4ykp99sm87tsrfg8mgjef350gqtzhsqwys6"], - ["BNB", "BEP2", "bnb1u70jtt2umum4ag3vcpw2h8v8levm47t0mtjwmh"], + // ["BNB", "BEP2", "bnb1panyupy43sazh4dka6fg3s08909ejhqz4k23eg"], + // ["BNB", "BEP2", "bnb1ymasdm96ld0v6s38ylvu0qsw0xmhdlhy47tpsg"], + // ["BNB", "BEP2", "bnb1tdcrvgjl580p2qv77y0cu2ezk3c80039psx6sh"], + // ["BNB", "BEP2", "bnb1e08c39tjpr5fvdh4cfhqmyclrh62ag45qmddud"], + // ["BNB", "BEP2", "bnb1lq4s05lgat8d0qh275q0elt4m9rs760m0ryced"], + // ["BNB", "BEP2", "bnb1t5fn9faqu5aanvexqu8dt9tah4jg20eun8gsee"], + // ["BNB", "BEP2", "bnb1dkckvfuqv7fjl902cvuqmde27skk94kjp09j99"], + // ["BNB", "BEP2", "bnb14u5qnp4peug4a6wlz327mx9xjd0xf6phe7ew8u"], + // ["BNB", "BEP2", "bnb19fk9hqqlp8xcwrt0w35weyufnglp43hlthev3l"], + // ["BNB", "BEP2", "bnb1uexf06gd94qsxdmqamk360d893dsrm8lvwyjsd"], + // ["BNB", "BEP2", "bnb1uwdm6vrfvx43wqj8cj3h362kad0g0nrk3gumg8"], + // ["BNB", "BEP2", "bnb1a5f0ghn3c2whfmz3z0wjggwcgsk2t26ynqn68x"], + // ["BNB", "BEP2", "bnb1s3czyqxaf4hyt3rueg9gss08nfnvxjzy5qfu2p"], + // ["BNB", "BEP2", "bnb1yud0r5kz3ctu07fwax3j753ueef6d0n0uxrx94"], + // ["BNB", "BEP2", "bnb1fxk3lmfu2h0qhywdump0hvggg6prlge88f42n9"], + // ["BNB", "BEP2", "bnb1erq4ykp99sm87tsrfg8mgjef350gqtzhsqwys6"], + // ["BNB", "BEP2", "bnb1u70jtt2umum4ag3vcpw2h8v8levm47t0mtjwmh"], ["BNB", "BEP2", "bnb1xrfwzlu9c5208lhtn7ywt0mjrhjh4nt4fjyqxy"], ["BNB", "BEP20", "0xf977814e90da44bfa03b6295a0616a897441acec"], - ["BNB", "BEP20", "0xBE0eB53F46cd790Cd13851d5EFf43D12404d33E8"], + // ["BNB", "BEP20", "0xBE0eB53F46cd790Cd13851d5EFf43D12404d33E8"], ["BNB", "BEP20", "0x5a52e96bacdabb82fd05763e25335261b270efcb"], ["BNB", "BEP20", "0x3c783c21a0383057d128bae431894a5c19f9cf06"], ["BNB", "BEP20", "0xdccf3b77da55107280bd850ea519df3705d1a75a"], @@ -89,15 +109,272 @@ const assetList = [ ["BNB", "BEP20", "0x1fbe2acee135d991592f167ac371f3dd893a508b"], ["BNB", "BEP20", "0xeb2d2f1b8c558a40207669291fda468e50c8a0bb"], ["BNB", "BEP20", "0xa180fe01b906a1be37be6c534a3300785b20d947"], + ["BUSD", "BEP20", "0xa180fe01b906a1be37be6c534a3300785b20d947"], + ["1INCH", "BEP20", "0xf977814e90da44bfa03b6295a0616a897441acec"], ["BNB", "ETH", "0xbe0eb53f46cd790cd13851d5eff43d12404d33e8"], - ["BNB", "ETH", "0xf977814e90da44bfa03b6295a0616a897441acec"] + ["BNB", "ETH", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["ETH", "ARB", "0xb38e8c17e38363af6ebdcb3dae12e0243582891d"], + ["ETH", "ARB", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["USDT", "AVAX", "0x4aefa39caeadd662ae31ab0ce7c8c2c9c0a013e8"], + ["USDC", "AVAX", "0x9f8c163cba728e99993abe7495f06c0a3c8ac8b9"], + ["BUSD", "AVAX", "0x9f8c163cba728e99993abe7495f06c0a3c8ac8b9"], + ["BUSD", "AVAX", "0x4aefa39caeadd662ae31ab0ce7c8c2c9c0a013e8"], + ["USDT", "AVAX", "0x9f8c163cba728e99993abe7495f06c0a3c8ac8b9"], + ["XRP", "BEP2", "bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz"], + ["DOT", "BEP2", "bnb1lsmt5a8vqqus5fwslx8pyyemgjtg4y6ugj308t"], + ["BUSD", "BEP2", "bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz"], + ["BTC", "BEP2", "bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz"], + ["XRP", "BEP2", "bnb1lsmt5a8vqqus5fwslx8pyyemgjtg4y6ugj308t"], + ["USDC", "BEP2", "bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz"], + ["BTC", "BEP2", "bnb1u2agwjat20494fmc6jnuau0ls937cfjn4pjwtn"], + ["CHZ", "BEP2", "bnb142q467df6jun6rt5u2ar58sp47hm5f9wvz2cvg"], + ["USDT", "BEP2", "bnb1u2agwjat20494fmc6jnuau0ls937cfjn4pjwtn"], + ["DOGE", "BEP2", "bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz"], + ["LTC", "BEP2", "bnb1u2agwjat20494fmc6jnuau0ls937cfjn4pjwtn"], + ["DOT", "BEP2", "bnb1u2agwjat20494fmc6jnuau0ls937cfjn4pjwtn"], + ["MATIC", "BEP2", "bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz"], + ["LINK", "BEP2", "bnb1u2agwjat20494fmc6jnuau0ls937cfjn4pjwtn"], + ["CHZ", "BEP2", "bnb1u2agwjat20494fmc6jnuau0ls937cfjn4pjwtn"], + ["XRP", "BEP2", "bnb1u2agwjat20494fmc6jnuau0ls937cfjn4pjwtn"], + ["ETH", "BEP2", "bnb1u2agwjat20494fmc6jnuau0ls937cfjn4pjwtn"], + ["ETH", "BEP2", "bnb1lsmt5a8vqqus5fwslx8pyyemgjtg4y6ugj308t"], + ["LINK", "BEP2", "bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz"], + ["CHZ", "BEP2", "bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz"], + ["WRX", "BEP2", "bnb1u2agwjat20494fmc6jnuau0ls937cfjn4pjwtn"], + ["WRX", "BEP2", "bnb142q467df6jun6rt5u2ar58sp47hm5f9wvz2cvg"], + ["BTC", "BEP2", "bnb1lsmt5a8vqqus5fwslx8pyyemgjtg4y6ugj308t"], + ["LTC", "BEP2", "bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz"], + ["USDT", "BEP2", "bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz"], + ["ETH", "BEP2", "bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz"], + ["DOT", "BEP20", "0x8894e0a0c962cb723c1976a4421c95949be2d4e3"], + ["BUSD", "BEP20", "0x8894e0a0c962cb723c1976a4421c95949be2d4e3"], + ["BTC", "BEP20", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["LINK", "BEP20", "0x5a52e96bacdabb82fd05763e25335261b270efcb"], + ["BTC", "ETH", "0x21a31ee1afc51d94c2efccaa2092ad1028285549"], + ["MASK", "BEP20", "0x5a52e96bacdabb82fd05763e25335261b270efcb"], + ["BTC", "ETH", "0xdfd5293d8e347dfe59e90efd55b2956a1343963d"], + ["MASK", "BEP20", "0x8894e0a0c962cb723c1976a4421c95949be2d4e3"], + ["BTC", "ETH", "0x28c6c06298d514db089934071355e5743bf21d60"], + ["DOT", "BEP20", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["USDT", "BEP20", "0xa180fe01b906a1be37be6c534a3300785b20d947"], + ["BUSD", "BEP20", "0x3c783c21a0383057d128bae431894a5c19f9cf06"], + ["1INCH", "BEP20", "0xe2fc31f816a9b94326492132018c3aecc4a93ae1"], + ["BUSD", "BEP20", "0x29bdfbf7d27462a2d115748ace2bd71a2646946c"], + ["CVP", "BEP20", "0x8894e0a0c962cb723c1976a4421c95949be2d4e3"], + ["SHIB", "BEP20", "0x8894e0a0c962cb723c1976a4421c95949be2d4e3"], + ["BUSD", "BEP20", "0xe2fc31f816a9b94326492132018c3aecc4a93ae1"], + ["BUSD", "BEP20", "0xdccf3b77da55107280bd850ea519df3705d1a75a"], + ["BUSD", "ETH", "0x9696f59e4d72e237be84ffd425dcad154bf96976"], + ["LTC", "BEP20", "0x8894e0a0c962cb723c1976a4421c95949be2d4e3"], + ["LINK", "BEP20", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["HFT", "BEP20", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["SHIB", "BEP20", "0xa180fe01b906a1be37be6c534a3300785b20d947"], + ["CHR", "BEP20", "0xe2fc31f816a9b94326492132018c3aecc4a93ae1"], + ["CHR", "ETH", "0x28c6c06298d514db089934071355e5743bf21d60"], + ["CHR", "ETH", "0x21a31ee1afc51d94c2efccaa2092ad1028285549"], + ["CHR", "ETH", "0xbe0eb53f46cd790cd13851d5eff43d12404d33e8"], + ["CHR", "ETH", "0xdfd5293d8e347dfe59e90efd55b2956a1343963d"], + ["USDT", "BEP20", "0x8894e0a0c962cb723c1976a4421c95949be2d4e3"], + ["CHZ", "ETH", "0xdfd5293d8e347dfe59e90efd55b2956a1343963d"], + ["SHIB", "BEP20", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["CHZ", "ETH", "0xbe0eb53f46cd790cd13851d5eff43d12404d33e8"], + ["CHZ", "ETH", "0x28c6c06298d514db089934071355e5743bf21d60"], + ["CHZ", "ETH", "0x21a31ee1afc51d94c2efccaa2092ad1028285549"], + ["1INCH", "BEP20", "0x8894e0a0c962cb723c1976a4421c95949be2d4e3"], + ["CRV", "ETH", "0x28c6c06298d514db089934071355e5743bf21d60"], + ["CVP", "BEP20", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["MASK", "BEP20", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["CRV", "ETH", "0xdfd5293d8e347dfe59e90efd55b2956a1343963d"], + ["CRV", "ETH", "0x21a31ee1afc51d94c2efccaa2092ad1028285549"], + ["CVP", "BEP20", "0xe2fc31f816a9b94326492132018c3aecc4a93ae1"], + ["CVP", "ETH", "0x21a31ee1afc51d94c2efccaa2092ad1028285549"], + ["USDC", "BEP20", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["CVP", "ETH", "0xdfd5293d8e347dfe59e90efd55b2956a1343963d"], + ["CVP", "ETH", "0x28c6c06298d514db089934071355e5743bf21d60"], + ["XRP", "BEP20", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["DOGE", "BEP20", "0xe2fc31f816a9b94326492132018c3aecc4a93ae1"], + ["USDT", "BEP20", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["CHR", "BEP20", "0x8894e0a0c962cb723c1976a4421c95949be2d4e3"], + ["MATIC", "BEP20", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["BTC", "BEP20", "0x8894e0a0c962cb723c1976a4421c95949be2d4e3"], + ["DOGE", "BEP20", "0xdccf3b77da55107280bd850ea519df3705d1a75a"], + ["DOGE", "BEP20", "0x8894e0a0c962cb723c1976a4421c95949be2d4e3"], + ["DOT", "BEP20", "0xe2fc31f816a9b94326492132018c3aecc4a93ae1"], + ["SOL", "BEP20", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["WRX", "BEP20", "0x8894e0a0c962cb723c1976a4421c95949be2d4e3"], + ["XRP", "BEP20", "0x5a52e96bacdabb82fd05763e25335261b270efcb"], + ["DOT", "ETH", "0x21a31ee1afc51d94c2efccaa2092ad1028285549"], + ["DOT", "ETH", "0xdfd5293d8e347dfe59e90efd55b2956a1343963d"], + ["DOT", "ETH", "0x28c6c06298d514db089934071355e5743bf21d60"], + ["ENJ", "ETH", "0x28c6c06298d514db089934071355e5743bf21d60"], + ["ENJ", "ETH", "0xbe0eb53f46cd790cd13851d5eff43d12404d33e8"], + ["HFT", "BEP20", "0x8894e0a0c962cb723c1976a4421c95949be2d4e3"], + ["ETH", "ETH", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["ETH", "BEP20", "0x8894e0a0c962cb723c1976a4421c95949be2d4e3"], + ["ETH", "BEP20", "0xe2fc31f816a9b94326492132018c3aecc4a93ae1"], + ["XRP", "BEP20", "0x8894e0a0c962cb723c1976a4421c95949be2d4e3"], + ["MATIC", "BEP20", "0x8894e0a0c962cb723c1976a4421c95949be2d4e3"], + ["CVP", "BEP20", "0x5a52e96bacdabb82fd05763e25335261b270efcb"], + ["DOGE", "BEP20", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["SOL", "BEP20", "0x8894e0a0c962cb723c1976a4421c95949be2d4e3"], + ["LTC", "BEP20", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["USDC", "BEP20", "0x8894e0a0c962cb723c1976a4421c95949be2d4e3"], + ["LINK", "BEP20", "0x8894e0a0c962cb723c1976a4421c95949be2d4e3"], + ["WRX", "BEP20", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["GRT", "ETH", "0x21a31ee1afc51d94c2efccaa2092ad1028285549"], + ["CHZ", "ETH", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["HFT", "BEP20", "0xe2fc31f816a9b94326492132018c3aecc4a93ae1"], + ["HFT", "ETH", "0x28c6c06298d514db089934071355e5743bf21d60"], + ["1INCH", "ETH", "0xdfd5293d8e347dfe59e90efd55b2956a1343963d"], + ["HFT", "ETH", "0xdfd5293d8e347dfe59e90efd55b2956a1343963d"], + ["HFT", "ETH", "0x21a31ee1afc51d94c2efccaa2092ad1028285549"], + ["LINK", "BEP20", "0xe2fc31f816a9b94326492132018c3aecc4a93ae1"], + ["LINK", "ETH", "0x21a31ee1afc51d94c2efccaa2092ad1028285549"], + ["MATIC", "ETH", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["LINK", "ETH", "0x28c6c06298d514db089934071355e5743bf21d60"], + ["LINK", "ETH", "0xdfd5293d8e347dfe59e90efd55b2956a1343963d"], + ["LINK", "ETH", "0xbe0eb53f46cd790cd13851d5eff43d12404d33e8"], + ["BTC", "ETH", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["MASK", "ETH", "0xdfd5293d8e347dfe59e90efd55b2956a1343963d"], + ["MASK", "ETH", "0x21a31ee1afc51d94c2efccaa2092ad1028285549"], + ["MASK", "ETH", "0x28c6c06298d514db089934071355e5743bf21d60"], + ["1INCH", "ETH", "0x5a52e96bacdabb82fd05763e25335261b270efcb"], + ["MATIC", "ETH", "0x21a31ee1afc51d94c2efccaa2092ad1028285549"], + ["MATIC", "ETH", "0x28c6c06298d514db089934071355e5743bf21d60"], + ["MATIC", "ETH", "0xdfd5293d8e347dfe59e90efd55b2956a1343963d"], + ["SHIB", "BEP20", "0x3c783c21a0383057d128bae431894a5c19f9cf06"], + ["SHIB", "BEP20", "0x161ba15a5f335c9f06bb5bbb0a9ce14076fbb645"], + ["MASK", "ETH", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["SHIB", "BEP20", "0x515b72ed8a97f42c568d6a143232775018f133c8"], + ["SHIB", "BEP20", "0x1fbe2acee135d991592f167ac371f3dd893a508b"], + ["SHIB", "BEP20", "0xe2fc31f816a9b94326492132018c3aecc4a93ae1"], + ["SHIB", "BEP20", "0xdccf3b77da55107280bd850ea519df3705d1a75a"], + ["SHIB", "BEP20", "0xbd612a3f30dca67bf60a39fd0d35e39b7ab80774"], + ["SHIB", "ETH", "0x4976a4a02f38326660d17bf34b431dc6e2eb2327"], + ["CVP", "ETH", "0x5a52e96bacdabb82fd05763e25335261b270efcb"], + ["SSV", "ETH", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["SSV", "ETH", "0x21a31ee1afc51d94c2efccaa2092ad1028285549"], + ["SSV", "ETH", "0x28c6c06298d514db089934071355e5743bf21d60"], + ["USDC", "BEP20", "0xe2fc31f816a9b94326492132018c3aecc4a93ae1"], + ["MATIC", "ETH", "0x5a52e96bacdabb82fd05763e25335261b270efcb"], + ["GRT", "ETH", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["DOT", "ETH", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["USDC", "ETH", "0x28c6c06298d514db089934071355e5743bf21d60"], + ["LINK", "ETH", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["1INCH", "ETH", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["1INCH", "ETH", "0xbe0eb53f46cd790cd13851d5eff43d12404d33e8"], + ["CHR", "ETH", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["1INCH", "ETH", "0x21a31ee1afc51d94c2efccaa2092ad1028285549"], + ["XRP", "ETH", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["USDT", "BEP20", "0xe2fc31f816a9b94326492132018c3aecc4a93ae1"], + ["USDT", "BEP20", "0xeb2d2f1b8c558a40207669291fda468e50c8a0bb"], + ["CRV", "ETH", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["BNB", "ETH", "0x28c6c06298d514db089934071355e5743bf21d60"], + ["CHR", "ETH", "0x5a52e96bacdabb82fd05763e25335261b270efcb"], + ["CVP", "ETH", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["XRP", "BEP20", "0xe2fc31f816a9b94326492132018c3aecc4a93ae1"], + ["HFT", "ETH", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["ENJ", "ETH", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["LTC", "LTC", "MWGTiJBNEQSfxTCrdC2VKEa55Lck27wr67"], + ["LTC", "LTC", "MLkNzCps6cXou2DELVfxDuRC4uZGwr397o"], + //["LTC", "LTC", "MRwsBPhSteTreKQrNE6BXU1U33PMsn8jCS"], + ["LTC", "LTC", "MBjKmoDwkuUbtnVd4vjymxjJx7Crca2s1z"], + ["LTC", "LTC", "MJwFHGandYUFJTTHHSXg3q6u7ge4af1n4N"], + ["LTC", "LTC", "MQd1fJwqBJvwLuyhr17PhEFx1swiqDbPQS"], + ["LTC", "LTC", "MSeDRiNoH5Afr9b9rNo837hYzpxBXXqMZf"], + ["LTC", "LTC", "M8T1B2Z97gVdvmfkQcAtYbEepune1tzGua"], + ["LTC", "LTC", "LZEjckteAtWrugbsy9zU8VHEZ4iUiXo9Nm"], + ["MATIC", "MATIC", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["USDT", "MATIC", "0xe7804c37c13166ff0b37f5ae0bb07a3aebb6e245"], + ["BUSD", "MATIC", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["MATIC", "MATIC", "0xe7804c37c13166ff0b37f5ae0bb07a3aebb6e245"], + ["USDC", "MATIC", "0xe7804c37c13166ff0b37f5ae0bb07a3aebb6e245"], + ["MATIC", "MATIC", "0x082489a616ab4d46d1947ee3f912e080815b08da"], + ["USDC", "MATIC", "0x082489a616ab4d46d1947ee3f912e080815b08da"], + ["USDT", "MATIC", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["BUSD", "MATIC", "0xe7804c37c13166ff0b37f5ae0bb07a3aebb6e245"], + ["ETH", "OP", "0xF977814e90dA44bFA03b6295A0616a897441aceC"], + ["ETH", "OP", "0xacd03d601e5bb1b275bb94076ff46ed9d753435a"], + ["BUSD", "OP", "0xacd03d601e5bb1b275bb94076ff46ed9d753435a"], + ["OP", "OP", "0xF977814e90dA44bFA03b6295A0616a897441aceC"], + ["OP", "OP", "0xacd03d601e5bb1b275bb94076ff46ed9d753435a"], + ["USDT", "OP", "0xacd03d601e5bb1b275bb94076ff46ed9d753435a"], + ["USDT", "OP", "0xF977814e90dA44bFA03b6295A0616a897441aceC"], + ["XRP", "XRP", "rNU4eAowPuixS5ZCWaRL72UUeKgxcKExpK"], + ["XRP", "XRP", "rs8ZPbYqgecRcDzQpJYAMhSxSi5htsjnza"], + ["XRP", "XRP", "rBtttd61FExHC68vsZ8dqmS3DfjFEceA1A"], + ["XRP", "XRP", "rDAE53VfMvftPB4ogpWGWvzkQxfht6JPxr"], + ["XRP", "XRP", "rEy8TFcrAPvhpKrwyrscNYyqBGUkE9hKaJ"], + ["USDT", "SOL", "5tzFkiKscXHK5ZXCGbXZxdw7gTjjD1mBwuoFbhUvuAi9"], + ["SOL", "SOL", "3yFwqXBfZY4jBVUafQ1YEXw189y2dN3V5KQq9uzBDy1E"], + ["USDC", "SOL", "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM"], + ["USDT", "SOL", "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM"], + ["SOL", "SOL", "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM"], + ["SOL", "SOL", "2ojv9BAiHUrvsm9gxDe7fJSzbNZSJcxZvf8dqmWGHG8S"], + ["USDC", "SOL", "5tzFkiKscXHK5ZXCGbXZxdw7gTjjD1mBwuoFbhUvuAi9"], + ["SOL", "SOL", "5tzFkiKscXHK5ZXCGbXZxdw7gTjjD1mBwuoFbhUvuAi9"], + ["DOT", "DOT", "1743nDTMZisPgBCYSAgkUn1kVG7MePc9rvMEjoRNf4ipVkF"], + ["DOT", "DOT", "1qnJN7FViy3HZaxZK9tGAA71zxHSBeUweirKqCaox4t8GT7"], + ["DOT", "DOT", "16ZL8yLyXv3V3L3z9ofR1ovFLziyXaN1DPq4yffMAZ9czzBD"], + //new chains + ["USDC", "ALGO", "MTCEM5YJJSYGW2RCXYXGE4SXLSPUUEJKQAWG2GUX6CNN72KQ3XPJCM6NOI"], + ["ALGO", "ALGO", "MTCEM5YJJSYGW2RCXYXGE4SXLSPUUEJKQAWG2GUX6CNN72KQ3XPJCM6NOI"], + ["USDC", "ALGO", "QYXDGS2XJJT7QNR6EJ2YHNZFONU6ROFM6BKTBNVT63ZXQ5OC6IYSPNDJ4U"], + ["ALGO", "ALGO", "QYXDGS2XJJT7QNR6EJ2YHNZFONU6ROFM6BKTBNVT63ZXQ5OC6IYSPNDJ4U"], + ["APT", "APT", "0xed8c46bec9dbc2b23c60568f822b95b87ea395f7e3fdb5e3adc0a30c55c0a60e"], + ["APT", "APT", "0xae1a6f3d3daccaf77b55044cea133379934bba04a11b9d0bbd643eae5e6e9c70"], + ["APT", "APT", "0xd91c64b777e51395c6ea9dec562ed79a4afa0cd6dad5a87b187c37198a1f855a"], + ["APT", "APT", "0x80174e0fe8cb2d32b038c6c888dd95c3e1560736f0d4a6e8bed6ae43b5c91f6f"], + ["APT", "APT", "0x5bd7de5c56d5691f32ea86c973c73fec7b1445e59736c97158020018c080bb00"], + //new tokens UNI + ["UNI", "BEP2", "bnb142q467df6jun6rt5u2ar58sp47hm5f9wvz2cvg"], + ["UNI", "BEP2", "bnb1u2agwjat20494fmc6jnuau0ls937cfjn4pjwtn"], + ["UNI", "BEP2", "bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz"], + ["UNI", "BEP2", "bnb1lsmt5a8vqqus5fwslx8pyyemgjtg4y6ugj308t"], + ["UNI", "ETH", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["UNI", "ETH", "0x21a31ee1afc51d94c2efccaa2092ad1028285549"], + ["UNI", "ETH", "0x5a52e96bacdabb82fd05763e25335261b270efcb"], + ["UNI", "ETH", "0xbe0eb53f46cd790cd13851d5eff43d12404d33e8"], + ["UNI", "ETH", "0xdfd5293d8e347dfe59e90efd55b2956a1343963d"], + ["UNI", "ETH", "0x28c6c06298d514db089934071355e5743bf21d60"], + //new token ARB + ["ARB", "ARB", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["ARB", "ARB", "0xb38e8c17e38363af6ebdcb3dae12e0243582891d"], + ["ARB", "ETH", "0x28c6c06298d514db089934071355e5743bf21d60"], + ["ARB", "ARB", "0xf92402bb795fd7cd08fb83839689db79099c8c9c"], + // ["USDC", "ETH", "0xf8d3e5fe8bb885325d98a751a30a1573e887a953"], removed 06/07/2023 + // ["USDC", "ETH", "0xeae7380dd4cef6fbd1144f49e4d1e6964258a4f4"], removed 06/07/2023 + // ["USDC", "ETH", "0x95e63f78bd2fd5ea8a0d58182f3d998558881fda"], removed 06/07/2023 + // ["USDC", "ETH", "0x39e2d89f4b4708077a48d75c5cf2ab059a4b3e48"], removed 06/07/2023 + // ["USDC", "ETH", "0x558a87a7c8b79ffb66a3d10a4a2de8c73a46707d"], removed 06/07/2023 + // ["USDC", "ETH", "0xf033bce292bcaaf998ca13755104a4b23c04af5c"], removed 06/07/2023 + ["LTC", "LTC", "LbmGksLBwtwRXyxeazCZqKiAHX6cWN2AzN"], + ["LTC", "LTC", "LhzEoDXHXASi4hSMxrKeVoSGrED9QsBpPq"], + ["LTC", "LTC", "MB8nnFMvR5cgvpzQ1QXTDVfUM91BcsLH3k"], + // ["USDC", "TRX", "TDjPeMNaRxoNMwENrdtNYmZt1YAfVVjp59"], removed 06/07/2023 + // ["USDC", "TRX", "TL6VgVKo6natQb6hW5Hy2jcyX5EHgmwXLE"], removed 06/07/2023 + ["BTC", "BTC", "1Pzaqw98PeRfyHypfqyEgg5yycJRsENrE7"], // new wallet https://twitter.com/binance/status/1670723088802283520 + ["BTC", "BTC", "39884E3j6KZj82FK4vcCrkUvWYL5MQaS3v"], // new wallet that got 3.1b + ["TUSD", "BEP2", "bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz"], + ["TUSD", "BEP20", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["TUSD", "BEP20", "0x8894e0a0c962cb723c1976a4421c95949be2d4e3"], + ["TUSD", "BEP20", "0xe2fc31f816a9b94326492132018c3aecc4a93ae1"], + ["TUSD", "ETH", "0x21a31ee1afc51d94c2efccaa2092ad1028285549"], + ["TUSD", "ETH", "0x28c6c06298d514db089934071355e5743bf21d60"], + ["TUSD", "ETH", "0xdfd5293d8e347dfe59e90efd55b2956a1343963d"], + ["TUSD", "ETH", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["TUSD", "ETH", "0x5a52e96bacdabb82fd05763e25335261b270efcb"], + ["TUSD", "TRX", "TNXoiAJ3dct8Fjg4M9fkLFh9S2v9TXc32G"], + ["TUSD", "TRX", "TV6MuMXfmLbBqPZvBHdwFsDnQeVfnmiuSi"], + ["TUSD", "TRX", "TWd4WrZ9wn84f5x1hZhL4DHvk738ns5jwb"], + ["TUSD", "TRX", "TJCo98saj6WND61g1uuKwJ9GMWMT9WkJFo"], ] function getAddresses(chain) { return assetList.filter(i => i[1] === chain).map(i => i[2]) } function getOwners(chain) { - const isCaseSensitive = ['BTC', 'TRX'].includes(chain) + const isCaseSensitive = ['BTC', 'TRX', 'SOL', 'XRP', 'LTC', 'DOT', 'ALGO'].includes(chain) return getUniqueAddresses(assetList.filter(i => i[1] === chain).map(i => i[2]), isCaseSensitive) } @@ -107,16 +384,50 @@ module.exports = { }, ethereum: { owners: getOwners('ETH'), + blacklistedTokens: [ + '0x9be89d2a4cd102d8fecc6bf9da793be995c22541', // BBTC + ADDRESSES.ethereum.BNB, // WBNB + ] }, bsc: { owners: getOwners('BEP20'), - tokens: ['0x0000000000000000000000000000000000000000',], + tokens: [ADDRESSES.null,], }, bep2: { geckoId: 'binancecoin', - owners: getAddresses('BEP2'), + owners: getAddresses('BEP2'), }, tron: { owners: getOwners('TRX'), - } -} + }, + avax: { + owners: getOwners('AVAX'), + }, + arbitrum: { + owners: getOwners('ARB'), + }, + litecoin: { + owners: getOwners('LTC') + }, + polygon: { + owners: getOwners('MATIC') + }, + optimism: { + owners: getOwners('OP') + }, + ripple: { + owners: getOwners('XRP') + }, + solana: { + owners: getOwners('SOL') + }, + polkadot: { + owners: getOwners('DOT') + }, + algorand: { + owners: getOwners('ALGO') + }, + aptos: { + owners: getOwners('APT') + }, +} \ No newline at end of file diff --git a/projects/binance/index.js b/projects/binance/index.js index 464da51b8d4..2a0b91fda17 100644 --- a/projects/binance/index.js +++ b/projects/binance/index.js @@ -1,3 +1,4 @@ const config = require('./config') const { cexExports, } = require('../helper/cex') module.exports = cexExports(config) +module.exports.methodology = 'We collect the wallets from this binance blog post https://www.binance.com/en/blog/community/our-commitment-to-transparency-2895840147147652626. We are not counting the Binance Recovery Fund wallet' \ No newline at end of file diff --git a/projects/bishares/abi.js b/projects/bishares/abi.js index 79d391a3196..700a3458fa6 100644 --- a/projects/bishares/abi.js +++ b/projects/bishares/abi.js @@ -1,28 +1,4 @@ module.exports = { - token: { - "inputs": [], - "name": "token", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - balance: { - "inputs": [], - "name": "balance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, + token: "address:token", + balance: "uint256:balance", } \ No newline at end of file diff --git a/projects/bishares/config.js b/projects/bishares/config.js index 2f90026ba5a..ea8301d2b21 100644 --- a/projects/bishares/config.js +++ b/projects/bishares/config.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') // data taken from // https://api.thegraph.com/subgraphs/name/toffick/bisharesfunds // https://api.thegraph.com/subgraphs/name/bisharesindexfund/bisharesfunds-ybf-fantom @@ -19,7 +20,7 @@ module.exports = { "0x259c0cf00f8710b473457314420114ae4c87cee5" ], [ - "0x82f0b8b456c1a451378467398982d4834b6829c1", + ADDRESSES.fantom.MIM, "0x259c0cf00f8710b473457314420114ae4c87cee5" ], [ @@ -67,7 +68,7 @@ module.exports = { "0xa55568847c5c5be3b6c59c6e57e74677591d900d" ], [ - "0x82f0b8b456c1a451378467398982d4834b6829c1", + ADDRESSES.fantom.MIM, "0xa55568847c5c5be3b6c59c6e57e74677591d900d" ], [ @@ -103,7 +104,7 @@ module.exports = { "0xab8ac08c597fb090b36eb514ba3f3a8b4a78aed1" ], [ - "0x82f0b8b456c1a451378467398982d4834b6829c1", + ADDRESSES.fantom.MIM, "0xab8ac08c597fb090b36eb514ba3f3a8b4a78aed1" ], [ @@ -135,7 +136,7 @@ module.exports = { "0xead77cdfeb1fe4672704ba322d63a3d2bdca2025" ], [ - "0x82f0b8b456c1a451378467398982d4834b6829c1", + ADDRESSES.fantom.MIM, "0xead77cdfeb1fe4672704ba322d63a3d2bdca2025" ], [ @@ -169,7 +170,7 @@ module.exports = { "0x10a520829c1e9631ef9e60e37eea3916092caa99" ], [ - "0x2170ed0880ac9a755fd29b2688956bd959f933f8", + ADDRESSES.bsc.ETH, "0x10a520829c1e9631ef9e60e37eea3916092caa99" ], [ @@ -177,7 +178,7 @@ module.exports = { "0x10a520829c1e9631ef9e60e37eea3916092caa99" ], [ - "0x7130d2a12b9bcbfae4f2634d864a1ee1ce3ead9c", + ADDRESSES.bsc.BTCB, "0x10a520829c1e9631ef9e60e37eea3916092caa99" ], [ @@ -189,7 +190,7 @@ module.exports = { "0x10a520829c1e9631ef9e60e37eea3916092caa99" ], [ - "0xe9e7cea3dedca5984780bafc599bd69add087d56", + ADDRESSES.bsc.BUSD, "0x10a520829c1e9631ef9e60e37eea3916092caa99" ], [ @@ -197,7 +198,7 @@ module.exports = { "0x28939911a862bd4e6b10e281f233a5e060114e0b" ], [ - "0x2170ed0880ac9a755fd29b2688956bd959f933f8", + ADDRESSES.bsc.ETH, "0x28939911a862bd4e6b10e281f233a5e060114e0b" ], [ @@ -253,7 +254,7 @@ module.exports = { "0x2a5f983706b6535ab5d69f003eb271ec44b5e839" ], [ - "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c", + ADDRESSES.bsc.WBNB, "0x2a5f983706b6535ab5d69f003eb271ec44b5e839" ], [ @@ -389,7 +390,7 @@ module.exports = { "0xfc02d63e44e71d4b8c81a436f19ce580eb7bfada" ], [ - "0x2170ed0880ac9a755fd29b2688956bd959f933f8", + ADDRESSES.bsc.ETH, "0xfc02d63e44e71d4b8c81a436f19ce580eb7bfada" ], [ @@ -405,7 +406,7 @@ module.exports = { "0xfc02d63e44e71d4b8c81a436f19ce580eb7bfada" ], [ - "0x7130d2a12b9bcbfae4f2634d864a1ee1ce3ead9c", + ADDRESSES.bsc.BTCB, "0xfc02d63e44e71d4b8c81a436f19ce580eb7bfada" ], [ diff --git a/projects/biswap-v3/index.js b/projects/biswap-v3/index.js new file mode 100644 index 00000000000..bed655ce7b6 --- /dev/null +++ b/projects/biswap-v3/index.js @@ -0,0 +1,24 @@ +const { sumTokens2 } = require('../helper/unwrapLPs') +const { getLogs } = require('../helper/cache/getLogs') + +const config = { + bsc: { factory: '0x7c3d53606f9c03e7f54abddffc3868e1c5466863', fromBlock: 29462097 }, +} + +Object.keys(config).forEach(chain => { + const { factory, fromBlock } = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const logs = await getLogs({ + api, + target: factory, + topics: ['0xe857b53ada03b8d88fd7546e77c34d3b68996e6ce330f0edee6e813b7daea099'], + eventAbi: 'event NewPool (address indexed tokenX, address indexed tokenY, uint16 indexed fee, uint24 pointDelta, address pool)', + onlyArgs: true, + fromBlock, + }) + const ownerTokens = logs.map(log => [[log.tokenX, log.tokenY], log.pool]) + return sumTokens2({ api, ownerTokens }) + } + } +}) \ No newline at end of file diff --git a/projects/biswap/index.js b/projects/biswap/index.js index 53e6d9591f6..ba24ee6ac93 100644 --- a/projects/biswap/index.js +++ b/projects/biswap/index.js @@ -35,8 +35,8 @@ const stakingPools = [ module.exports = { bsc: { - staking: stakings(stakingPools, BSW, 'bsc'), - tvl: getUniTVL({ chain: 'bsc', factory, }) + staking: stakings(stakingPools, BSW), + tvl: getUniTVL({ factory, useDefaultCoreAssets: true,}) }, hallmarks:[ [1651881600, "UST depeg"], diff --git a/projects/bitgert-swap/index.js b/projects/bitgert-swap/index.js index 38a5556efda..4a5a6de03ac 100644 --- a/projects/bitgert-swap/index.js +++ b/projects/bitgert-swap/index.js @@ -4,7 +4,6 @@ module.exports = { misrepresentedTokens: true, bitgert: { tvl: getUniTVL({ - chain: 'bitgert', factory: '0x456405E3d355ad27010Fd87e3c7cC8a2DcA372fD', useDefaultCoreAssets: true, }), diff --git a/projects/bitget/index.js b/projects/bitget/index.js new file mode 100644 index 00000000000..58bd333dc7e --- /dev/null +++ b/projects/bitget/index.js @@ -0,0 +1,98 @@ +const { cexExports } = require('../helper/cex') + +const config = { + bsc: { + owners: [ + '0x0639556F03714A74a5fEEaF5736a4A64fF70D206', + '0x149ded7438caf5e5bfdc507a6c25436214d445e1', + '0x3a7d1a8c3a8dc9d48a68e628432198a2ead4917c', + '0x97b9d2102a9a65a26e1ee82d59e42d1b73b68689' + ], + }, + ethereum: { + owners: [ + '0x0639556F03714A74a5fEEaF5736a4A64fF70D206', + '0x1Ae3739E17d8500F2b2D80086ed092596A116E0b', + '0x2bf7494111a59bD51f731DCd4873D7d71F8feEEC', + '0x31a36512d4903635b7dd6828a934c3915a5809be', + '0x461f6dCdd5Be42D41FE71611154279d87c06B406', + '0x5bdf85216ec1e38d6458c870992a69e38e03f7ef', + '0x97b9d2102a9a65a26e1ee82d59e42d1b73b68689', + '0x9E00816F61a709fa124D36664Cd7b6f14c13eE05', + '0xdFE4B89cf009BFfa33D9BCA1f19694FC2d4d943d', + '0xe2b406ec9227143a8830229eeb3eb6e24b5c60be', + '0xe6a421f24d330967a3af2f4cdb5c34067e7e4d75', + '0xe80623a9d41f2f05780d9cd9cea0f797fd53062a', + '0xf646d9B7d20BABE204a89235774248BA18086dae' + ] + }, + tron: { + owners: [ + 'TAa8e7U7seCy7NcZ52xYVQXXybFfwvsUxz', + 'TBXEdr2pD1tszUNAkVX18K7nie1MptkZ1y', + 'TBytnmJqL47n8bAP2NgPWfboXCwEUfEayv', + 'TFrRVZFoHty7scd2a1q6BDxPU5fyqiB4iR', + 'TGJagVsVg9QSePG5GreotgdefgaXPRo8SH', + 'TGZ959FTLRk8droUqDNgLxML1X9mEVej8q', + 'TYiQTHtgLo6KX6hYgbKLJsTbWK5hu9X5MG', + 'TZHW3PJe6VoyV8NWAaeukqWNRe3bVU7u8n', + ] + }, + bitcoin: { + owners: [ + '1FWQiwK27EnGXb6BiBMRLJvunJQZZPMcGd', + '1GDn5X4R5vjdSvFPrq1MJubXFkMHVcFJZv', + '3GbdoiTnQrJYatcr2nhq7MYASSCWEKmN6L', + '3HcSp9sR23w6MxeRrLqqyDzLqThtSMaypQ', + '3MdofQ2ouxom9MzC9kKazGUShoL5R3cVLG' + ] + }, + arbitrum: { + owners: [ + '0x0639556F03714A74a5fEEaF5736a4A64fF70D206', + '0x97b9d2102a9a65a26e1ee82d59e42d1b73b68689' + ] + }, + optimism: { + owners: [ + '0x0639556F03714A74a5fEEaF5736a4A64fF70D206', + '0x5bdf85216ec1e38d6458c870992a69e38e03f7ef', + '0x97b9d2102a9a65a26e1ee82d59e42d1b73b68689' + ] + }, + era: { + owners: [ + '0x97b9d2102a9a65a26e1ee82d59e42d1b73b68689' + ] + }, + fantom :{ + owners: ['0x5bdf85216ec1e38d6458c870992a69e38e03f7ef'] + }, + cronos: { + owners: ['0x0639556F03714A74a5fEEaF5736a4A64fF70D206'] + }, + avax: { + owners: [ + '0x0639556F03714A74a5fEEaF5736a4A64fF70D206', + '0x5bdf85216ec1e38d6458c870992a69e38e03f7ef' + ] + }, + polygon: { + owners: [ + '0x0639556F03714A74a5fEEaF5736a4A64fF70D206', + '0x5bdf85216ec1e38d6458c870992a69e38e03f7ef', + '0x97b9d2102a9a65a26e1ee82d59e42d1b73b68689' + ] + }, + ripple: { + owners: [ + 'r3AEihLNr81VYUf5PdfH5wLPqtJJyJs6yY', + 'rGDreBvnHrX1get7na3J4oowN19ny4GzFn' + ] + }, + solana: { + owners: ['A77HErqtfN1hLLpvZ9pCtu66FEtM8BveoaKbbMoZ4RiR'] + } +} + +module.exports = cexExports(config) \ No newline at end of file diff --git a/projects/bitindi-dex/index.js b/projects/bitindi-dex/index.js new file mode 100644 index 00000000000..2d9ae3663cf --- /dev/null +++ b/projects/bitindi-dex/index.js @@ -0,0 +1,2 @@ +const { uniTvlExport } = require('../helper/unknownTokens') +module.exports = uniTvlExport('bitindi', '0x87cef801D44D6eDa8106087e7676153c30e36950', true) \ No newline at end of file diff --git a/projects/bitindi/index.js b/projects/bitindi/index.js new file mode 100644 index 00000000000..33d2f742355 --- /dev/null +++ b/projects/bitindi/index.js @@ -0,0 +1,14 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { staking } = require('../helper/staking') +const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') + +module.exports = { + bsc: { + tvl: () => ({}), + staking: staking('0xf559BF9c0563Ed5322E7F493C02ea2275d68A367', '0x77fc65deda64f0cca9e3aea7b9d8521f4151882e', 'bsc'), + }, + bitindi: { + tvl: () => ({}), + staking: staking('0x140c312c8841B0a7152946C0Bc2BD343bA51bbcc', ADDRESSES.bitindi.WBNI, 'bitindi'), + }, +}; diff --git a/projects/bitlend/index.js b/projects/bitlend/index.js index 826aed932c3..94462458578 100644 --- a/projects/bitlend/index.js +++ b/projects/bitlend/index.js @@ -1,11 +1,12 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokensExport } = require('../helper/unwrapLPs') const CHAIN = 'bittorrent' // Tokens -const ETH = '0x1249C65AfB11D179FFB3CE7D4eEDd1D9b98AD006' -const USDC_T = '0x935faA2FCec6Ab81265B301a30467Bbc804b43d3' -const TRX = '0xEdf53026aeA60f8F75FcA25f8830b7e2d6200662' +const ETH = ADDRESSES.bittorrent.ETH +const USDC_T = ADDRESSES.bittorrent.USDC_t +const TRX = ADDRESSES.bittorrent.TRX // Bitlend Markets const bETH = '0xb65103C4B2Af563F9bBD8ad8CA8387d700673B6E' diff --git a/projects/bitmake/index.js b/projects/bitmake/index.js new file mode 100644 index 00000000000..2a4781423b9 --- /dev/null +++ b/projects/bitmake/index.js @@ -0,0 +1,13 @@ +const { cexExports } = require('../helper/cex') + +const config = { + bitcoin: { + // wallet provide by a bitmake team + owners: [ + "3F12ncAyx4VkfpvnS7ZxdpggFx4p9RKfVe", + ], + }, +} + +module.exports = cexExports(config) +module.exports.methodology = 'We are only tracking one BTC wallet. We dont have information regarding other wallets' \ No newline at end of file diff --git a/projects/bitvenus/index.js b/projects/bitvenus/index.js new file mode 100644 index 00000000000..af65a1bc5cd --- /dev/null +++ b/projects/bitvenus/index.js @@ -0,0 +1,41 @@ +const { cexExports } = require('../helper/cex') + +const config = { + ethereum: { + owners: [ + // '0xe43c53c466a282773f204df0b0a58fb6f6a88633', Old wallets + // '0x2b097741854eedeb9e5c3ef9d221fb403d8d8609', Old wallets + // '0x686b9202a36c09ce8aba8b49ae5f75707edec5fe', Old wallets + // '0xef7a2610a7c9cfb2537d68916b6a87fea8acfec3', Old wallets + '0x5631aa1fc1868703a962e2fd713dc02cad07c1db', + '0x4785e47ae7061632c2782384da28b9f68a5647a3', + '0x25Ee4Ce905Da85df8620cB82884adDf96A14498A', + '0xE1E5F8caCc6B9Ace0894Fe7ba467328587e60bE7' + ], + }, + bitcoin: { + owners: [ + // '3FdoFGYYcD1EU7ekrt2x2u2mFrjmxouMJG', + // '358pjjkYRG8exw2BKZnn7Q9s6SCb7wZEWN', + // '3C1ykoWkHBMZwmY8PUUMVxtJJSBkZBCtN8', + 'bc1qrm2a7u9xyeffvulm6e589qvesmt0v0rjxqfkhv', + 'bc1qvht34dma2uy23l9j862nnqr38a42kjr66e6lec' + + ] + }, + bsc: { + owners: [ + // '0xef7a2610a7c9cfb2537d68916b6a87fea8acfec3', + '0x4785e47aE7061632C2782384DA28B9F68a5647a3' + ] + }, + tron: { + owners: [ + 'TPbExxiw99nMsDfWVjaweSPkMVQfZSVVZj', + 'TSM8m5ADsMRySsWy7d4REX7FBXusMQCi6y' + ] + } +} + +module.exports = cexExports(config) +module.exports.methodology = 'This wallets where provide by BitVenus team on the 07/02/2023. *On the 14/07/2023 BitVenus team provided new wallets' \ No newline at end of file diff --git a/projects/black-whale/index.js b/projects/black-whale/index.js new file mode 100644 index 00000000000..a52a308a82f --- /dev/null +++ b/projects/black-whale/index.js @@ -0,0 +1,19 @@ +const { get } = require("../helper/http"); +const { sumTokens, endPoints } = require('../helper/chain/cosmos') + + +async function tvl() { + const { contracts: blackWhaleVaults } = await get(endPoints.kujira + "/cosmwasm/wasm/v1/code/21/contracts?pagination.limit=100"); + + const owners = [ + ...blackWhaleVaults, + ] + return sumTokens({ owners, chain: 'kujira' }) +} + +module.exports = { + doublecounted: false, + kujira: { + tvl, + }, +} \ No newline at end of file diff --git a/projects/blackbird-finance/index.js b/projects/blackbird-finance/index.js index be918dcc748..439f241e909 100644 --- a/projects/blackbird-finance/index.js +++ b/projects/blackbird-finance/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const {addFundsInMasterChef} = require("../helper/masterchef"); const {stakingUnknownPricedLP} = require("../helper/staking"); const {pool2BalanceFromMasterChefExports} = require("../helper/pool2"); @@ -6,11 +7,11 @@ const bird = "0x9A3d8759174f2540985aC83D957c8772293F8646"; const masterchef = "0xDF937094C6f2B757Dfd1265e5e1550Ea0055b27A"; const translate = { - "0xbed48612bc69fa1cab67052b42a95fb30c1bcfee": "0x95ad61b0a150d79219dcf64e1e6cc01f0b64c4ce", - "0x765277eebeca2e31912c9946eae1021199b39c61": "avax:0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7", - "0xb44a9b6905af7c801311e8f4e76932ee959c663c": "fantom:0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83", + [ADDRESSES.cronos.SHIB]: ADDRESSES.ethereum.INU, + [ADDRESSES.shiden.ETH]: "avax:" + ADDRESSES.avax.WAVAX, + [ADDRESSES.moonriver.USDT]: "fantom:" + ADDRESSES.fantom.WFTM, "0x9b8077c6590b560f1a9d60512648277d29b35a3b": "polygon:0x8a953cfe442c5e8855cc6c61b1293fa648bae472", - "0xc9baa8cfdde8e328787e29b4b078abf2dadc2055": "polygon:0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270", + [ADDRESSES.kcc.DAI]: "polygon:" + ADDRESSES.polygon.WMATIC_2, } async function tvl(timestamp, block, chainBlocks) { diff --git a/projects/blazestake/index.js b/projects/blazestake/index.js new file mode 100644 index 00000000000..6ddaf5ad9e5 --- /dev/null +++ b/projects/blazestake/index.js @@ -0,0 +1,15 @@ +const { getTokenSupply } = require("../helper/solana") + +async function tvl(_, _1, _2, { api }) { + const bSOL = 'bSo13r4TkiE4KumL71LsHTPpL2euBYLFx6h9HP3piy1' + const supply = await getTokenSupply(bSOL) + api.add(bSOL, supply * 1e9) +} + +module.exports = { + timetravel: false, + methodology: "bSOL total supply as it's equal to the SOL staked", + solana: { + tvl + }, +}; diff --git a/projects/blindex/index.js b/projects/blindex/index.js index f5026549e51..72bbfb23f8f 100644 --- a/projects/blindex/index.js +++ b/projects/blindex/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const abi = require("../helper/abis/blindex.json"); const { formatAddressChecksum } = require("../helper/formatAddressChecksum.js"); @@ -22,7 +23,7 @@ const chains = { coingeckoMapping: { prefix: "rsk", "0x542fda317318ebf1d3deaf76e0b632741a7e677d": "rootstock", // RSK's WRBTC - "0x1d931bf8656d795e50ef6d639562c5bd8ac2b78f": "ethereum", // RSK's ETHs + [ADDRESSES.rsk.ETHs]: "ethereum", // RSK's ETHs "0xb450ff06d950efa9a9c0ad63790c51971c1be885": "usd-coin", // RSK's BDUS - USD stable "0x99ac494badd0cba26143bd423e39a088591c7b09": "tether-eurt", // RSK's BDEU, - Euro stable "0xa4a8fb98a26e5314397170e5d12da8b73dc2ceb5": "pax-gold", // RSK's bXAU, - Gold stable @@ -215,7 +216,6 @@ const rsk = async function rskTvl(timestamp, ethBlock, chainblocks) { }; const dexTVL = getUniTVL({ - chain: 'rsk', factory: '0x5Af7cba7CDfE30664ab6E06D8D2210915Ef73c2E', useDefaultCoreAssets: true, }) diff --git a/projects/blizzard/abi.json b/projects/blizzard/abi.json index d62a0261ec3..e7a3d77aa80 100644 --- a/projects/blizzard/abi.json +++ b/projects/blizzard/abi.json @@ -1,41 +1,5 @@ { - "token": { - "type": "function", - "stateMutability": "view", - "outputs": [ - { - "type": "address", - "name": "", - "internalType": "contract IERC20" - } - ], - "name": "token", - "inputs": [] - }, - "balance": { - "type": "function", - "stateMutability": "view", - "outputs": [ - { - "type": "uint256", - "name": "", - "internalType": "uint256" - } - ], - "name": "balance", - "inputs": [] - }, - "want": { - "type": "function", - "stateMutability": "view", - "outputs": [ - { - "type": "address", - "name": "", - "internalType": "contract IERC20" - } - ], - "name": "want", - "inputs": [] - } + "token": "address:token", + "balance": "uint256:balance", + "want": "address:want" } \ No newline at end of file diff --git a/projects/blizzard/index.js b/projects/blizzard/index.js index 568e1a62ce1..e5c2d9a5056 100644 --- a/projects/blizzard/index.js +++ b/projects/blizzard/index.js @@ -1,19 +1,5 @@ const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); -const { staking } = require("../helper/staking"); -const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); -const { transformAvaxAddress } = require("../helper/portedTokens"); - -//Blizz Vault -const VaultBlizz = "0x37126BCaeF2b033011d7a68c3884eC294c965B3a"; -const BLIZZ = "0xB147656604217a03Fe2c73c4838770DF8d9D21B8"; -const WAVAX = "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7"; - -//Locked Vault -const VaultLockedBlizz = "0x7754cdd32BD47a6A857c1939740845905F5F9308"; - -//JOE Vault -const VaultJoe = "0x336e16b1f3A10048F38367B16808CF70e9e34E50"; const lpVaults = [ "0xE595C99b35f17408178097aFcF08DaE31DF0AD78", //PGL Vault PNG @@ -22,102 +8,23 @@ const lpVaults = [ "0x5806F70646832bfe5Dd11dF847832f9c268545c4", //JLP Vault JOE "0x3C6e6019337AeEb1E58dcab16473Bf05B92B7417", //PGL Vault PNG "0x18914D6691A5D9c43Db28a51Fb0c0891e73ae5b6", //USDC Vault - //"0xdc68EB4F1E603DA8909929bE74b68CBa943017c6", //JLP Vault JOE - //"0xD0659570B2De12F7814189c54f1316381F947329", //JLP Vault JOE + "0x336e16b1f3A10048F38367B16808CF70e9e34E50", ]; -const calcTvl = async (balances, chain, block, token, balance, vault) => { - const TokenOrWant = ( - await sdk.api.abi.call({ - abi: token, - target: vault, - chain, - block, - }) - ).output; - - const balanceOfvault = ( - await sdk.api.abi.call({ - abi: balance, - target: vault, - chain, - block, - }) - ).output; - - sdk.util.sumSingleBalance(balances, `avax:${TokenOrWant}`, balanceOfvault); -}; - -const avaxTvl = async (timestamp, ethBlock, chainBlocks) => { +const tvl = async (timestamp, ethBlock, chainBlocks, { api }) => { const balances = {}; - const wantOfVaults = ( - await sdk.api.abi.multiCall({ - abi: abi.want, - calls: lpVaults.map((vault) => ({ - target: vault, - })), - chain: "avax", - block: chainBlocks["avax"], - }) - ).output.map((w) => w.output); - - const balanceOfVaults = ( - await sdk.api.abi.multiCall({ - abi: abi.balance, - calls: lpVaults.map((vault) => ({ - target: vault, - })), - chain: "avax", - block: chainBlocks["avax"], - }) - ).output.map((w) => w.output); - - const lpPositions = []; - - for (let i = 0; i < lpVaults.length; i++) { - lpPositions.push({ - token: wantOfVaults[i], - balance: balanceOfVaults[i], - }); - } - - const transformAddress = await transformAvaxAddress(); - await unwrapUniswapLPs( - balances, - lpPositions, - chainBlocks["avax"], - "avax", - transformAddress - ); - - await calcTvl( - balances, - "avax", - chainBlocks["avax"], - abi.token, - abi.balance, - VaultLockedBlizz - ); - - await calcTvl( - balances, - "avax", - chainBlocks["avax"], - abi.want, - abi.balance, - VaultJoe - ); + const wantTokens = await api.multiCall({ abi: abi.want, calls: lpVaults}) + const balanceOfVaults = await api.multiCall({ abi: abi.balance, calls: lpVaults}) + wantTokens.forEach((token, i) => sdk.util.sumSingleBalance(balances,token,balanceOfVaults[i], api.chain)) - return balances; + return balances }; module.exports = { deadFrom: 1648765747, - misrepresentedTokens: true, avax:{ - tvl: avaxTvl, - staking: staking(VaultBlizz, BLIZZ, "avax"), + tvl, }, methodology: "We count liquidity on the Vaults through their contracts", }; diff --git a/projects/blockng/index.js b/projects/blockng/index.js index 168a988cec0..376ce4cc57c 100644 --- a/projects/blockng/index.js +++ b/projects/blockng/index.js @@ -1,27 +1,24 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumUnknownTokens, getUniTVL, sumTokensExport } = require('../helper/unknownTokens'); -const { stakingPricedLP, staking, } = require('../helper/staking') +const { staking, } = require('../helper/staking') const sdk = require('@defillama/sdk') const blockng = require('../helper/abis/blockng.json'); -const kashipairABI = require('../helper/abis/kashipair.json'); -const BigNumber = require('bignumber.js'); -const utils = require('../helper/utils'); const chain = 'smartbch' -const WBCH = "0x3743eC0673453E5009310C727Ba4eaF7b3a1cc04" -const LAW = "0x0b00366fBF7037E9d75E4A569ab27dAB84759302" -const lawUSD = "0xE1E655BE6F50344e6dd708c27BD8D66492d6ecAf" +const WBCH = ADDRESSES.smartbch.WBCH +const LAW = ADDRESSES.smartbch.LAW const coreAssets = [ WBCH, LAW, - '0x7b2B3C5308ab5b2a1d9a94d20D35CCDf61e05b72', // FlexUSD - '0xBc2F884680c95A02cea099dA2F524b366d9028Ba', // BlockNG pegged USDT + ADDRESSES.smartbch.flexUSD, // FlexUSD + ADDRESSES.smartbch.bcUSDT, // BlockNG pegged USDT ] const masterchefTvl = async (timestamp, ethBlock, { [chain]: block }) => { const toa = [ - ['0x0000000000000000000000000000000000000000', '0x896a8ddb5B870E431893EDa869feAA5C64f85978'], // BCH - ['0x24d8d5Cbc14FA6A740c3375733f0287188F8dF3b', '0x82112e12533A101cf442ee57899249C719dc3D4c'], // DAIQUIRI + [ADDRESSES.null, '0x896a8ddb5B870E431893EDa869feAA5C64f85978'], // BCH + [ADDRESSES.smartbch.DAIQUIRI, '0x82112e12533A101cf442ee57899249C719dc3D4c'], // DAIQUIRI ] return sumUnknownTokens({ chain, block, useDefaultCoreAssets: true, tokensAndOwners: toa, }); @@ -34,12 +31,6 @@ const pool2 = async (timestamp, ethBlock, { [chain]: block }) => { ['0x8e992c4c2c84e5d372ef9a933be06f34962e42f5', '0xf3F7dC16Cab45c946F04F3D2F965Ca6dCBDb3aae'], // lawUSD-flexUSD@BEN ['0xFEdfE67b179b2247053797d3b49d167a845a933e', '0x3D82b2D0927f528E708eC7680ae0088490A6d0C4'], // lawUSD-BCH@BEN ['0xd55a9a41666108d10d31baeeea5d6cdf3be6c5dd', '0xCee23c02B819e4B9b6E34753e3c0C7f21c4bC398'], // LAW-BCH@BEN - // ['0x8735628e1E5442B49A37F9751B0793C11014d1b6', '0x5227fDc4876677551c487C42893e282a1E4A9dDa'], // lawETPlawswapLP - // ['0x58B006A8380Cc4807b1d58C5a339A0E6f2338F1A', '0xc5E4c50f0d39E2A592419314D03880e541939d11'], // lawUsdfLawLpLawSwap - // ['0x7d43E5A766E9325E981ede2396B1b51Ff8A635Ed', '0xa9172f21D5BD0d60A1f4d6aa73DFC3173512Af0E'], // lawUsdflexUsdLpLawSwap - // ['0x43205613aD09aeF94fE0396F34c2C93eBc6D1b7E', '0xAfAca05002412b6200B2e24e3044E63713c9bcD3'], // lawUsdusdtLpLawSwap - // ['0xB82FF56E3E91c102a5dAf9Aa31BaE4c8c63F53A5', '0x5a6b3a1B16794D492Fa9B72092C94468ae74901D'], // lawUSD-bcBCH@LAWSWAP - // ['0x54AA3B2250A0e1f9852b4a489Fe1C20e7C71fd88', '0xE55dd317e8A4DaAB35dfEA7590518811947a4ADC'], // LAW-BCH@LAWSWAP ] return sumUnknownTokens({ chain, block, useDefaultCoreAssets: true, tokensAndOwners: toa, }); @@ -57,15 +48,12 @@ const lawswapFactory = '0x3A2643c00171b1EA6f6b6EaC77b1E0DdB02c3a62'.toLowerCase( const lawETP = "0x4ee06d0486ced674E75Ed9e521725580e8ffDA21" const LAW_LAWETP_PAIR = "0x8735628e1e5442b49a37f9751b0793c11014d1b6" const lawETP_POOL = "0x7B2B28a986E744D646F43b9b7e9F6f416a2a2BdA" // lawETP single asset pool -const lawEtpPool = stakingPricedLP(lawETP_POOL, lawETP, "smartbch", LAW_LAWETP_PAIR, "law", 18) // staking const LAW_RIGHTS = "0xe24Ed1C92feab3Bb87cE7c97Df030f83E28d9667" // DAO address -const daoStaking = staking(LAW_RIGHTS, LAW, "smartbch") const lawSwapTVL = getUniTVL({ - chain, factory: lawswapFactory, useDefaultCoreAssets: true, }) @@ -107,38 +95,6 @@ const civilBeams = async (_, _b, { [chain]: block }) => { return sumUnknownTokens({ chain, block, coreAssets, tokensAndOwners: toa, }); } -// borrows -const kashiPairs = [ - ["0x3F562957b199d6362B378dBa5e3b45EE6fe77779", WBCH, lawUSD], - ["0xd46e5a9Cd7A55Bf8d3582Ff66218aD3e63462506", LAW, lawUSD], -] - -const bentoBorrows = async (_, _b, { [chain]: block }) => { - const totalBorrow = kashipairABI.find(val => val.name === "totalBorrow"); - const totals = await Promise.all(kashiPairs.map(async (pair) => { - const total = (await sdk.api.abi.call({ - target: pair[0], - abi: totalBorrow, - chain, block, - })).output - return total.base - })) - const total = totals.reduce((sum, val) => BigNumber(sum).plus(val).toFixed(0), "0") - - // skip conversion assuming 1 lawUSD = 1 flexUSD - return {'tether': BigNumber(total).dividedBy(10 ** 18)} -} - - -// fetch punksTVL from an api endpoint, data is updated every 15 minutes -// Punk tvl is no longer counted, because we do not count nft value in any other protocol -const punksTVL = async () => { - const response = await utils.fetchURL(`https://raw.githubusercontent.com/BlockNG-Foundation/LawPunkMetaverse/master/punksTVL.json`) - const tvl = Number(response.data.totalPunkValueLockedInBch) / 1e18 - return { "bitcoin-cash": tvl } -} - - module.exports = { smartbch: { tvl: sdk.util.sumChainTvls([lawSwapTVL, masterchefTvl, ...bentoTVLs, ]), diff --git a/projects/blockswap/index.js b/projects/blockswap/index.js new file mode 100644 index 00000000000..2f1529fb82a --- /dev/null +++ b/projects/blockswap/index.js @@ -0,0 +1,88 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const sdk = require('@defillama/sdk'); + +const { GraphQLClient, gql } = require('graphql-request'); + +const ethAddress = ADDRESSES.null + +const lsd_subgraph = 'https://api.thegraph.com/subgraphs/name/stakehouse-dev/lsd' + +const stakehouse_subgraph = 'https://api.thegraph.com/subgraphs/name/stakehouse-dev/stakehouse-protocol' + +async function tvl(_, _1, _2, { api }) { + let balances = {}; + let query + let results + + const lsdGraphQLClient = new GraphQLClient(lsd_subgraph) + const stakehouseGraphQLClient = new GraphQLClient(stakehouse_subgraph) + + // Get the stakehouseAccounts and calculate the total staked ETH (for lifecyclestatus = 2)/minted dETH (for lifecyclestatus = 3) + query = gql`{ + stakehouseAccounts { + lifecycleStatus + totalDETHMinted + } + }` + results = await stakehouseGraphQLClient.request(query) + + let totalETHStakedAndMinted = 0 + for (let i = 0; i < results.stakehouseAccounts.length; i++) { + if (results.stakehouseAccounts[i].lifecycleStatus === "2") + totalETHStakedAndMinted += (32) * 10 ** 18 + else if (results.stakehouseAccounts[i].lifecycleStatus === "3") + totalETHStakedAndMinted += (Number(results.stakehouseAccounts[i].totalDETHMinted) + (8 * 10 ** 18)) + } + + // Get the LP balances for the idle ETH in Protected Staking and the Fees and MEV Pools + query = gql`{ + lptokens(where:{ + lifecycleStatus: "NOT_STAKED" + }) { + withdrawn + minted + } + }` + results = await lsdGraphQLClient.request(query) + + let totalIdleETHInPools = 0 + + for (let i = 0; i < results.lptokens.length; i++) + totalIdleETHInPools += (Number(results.lptokens[i].minted) - Number(results.lptokens[i].withdrawn)) + + // Get the idle ETH deposited by the validators still in the "WAITING_FOR_ETH" and "READY_TO_STAKE" status + query = gql`{ + lsdvalidators(where: { + status_in: ["WAITING_FOR_ETH", "READY_TO_STAKE"] + }) { + id + } + }` + results = await lsdGraphQLClient.request(query) + + let totalIdleETHFromValidators = (results.lsdvalidators.length) * 4 * 10 ** 18 + + // get remaining idle ETH from both giant pools + query = gql`{ + giantSavETHPools { + availableToStake + } + giantFeesAndMevPools { + availableToStake + } + }` + + results = await lsdGraphQLClient.request(query) + let totaIdleETHInGiantPools = Number(results.giantSavETHPools[0].availableToStake) + Number(results.giantFeesAndMevPools[0].availableToStake) + + await sdk.util.sumSingleBalance(balances, ethAddress, (totalETHStakedAndMinted + totalIdleETHFromValidators + totalIdleETHInPools + totaIdleETHInGiantPools), api.chain) + + return balances; +} + +module.exports = { + timetravel: false, + ethereum: { + tvl + } +}; \ No newline at end of file diff --git a/projects/blue-move-mart/index.js b/projects/blue-move-mart/index.js new file mode 100644 index 00000000000..7094ddf367e --- /dev/null +++ b/projects/blue-move-mart/index.js @@ -0,0 +1,31 @@ +const { aQuery } = require('../helper/chain/aptos') +const http = require('../helper/http') +const bluemoveCoinGecKoApi = 'https://api.coingecko.com/api/v3/simple/price?ids=aptos%2Captos%2Cbluemove&vs_currencies=usd'; +async function query(api) { + return http.get(`${api}`) +} + +module.exports = { + timetravel: false, + // methodology: "The total value locked is calculated by adding each value locked for each collection listed on the BlueMove NFT marketplace. The collection's value locked is calculated by the total NFT locked on the platform including listed and staked NFTs with the NFT collection floor price respectively", + methodology: "The total value locked is the value of the $MOVE coin that was staked into the BlueMove platform.", + aptos: { + staking: async () => { + + // Get MOVE price by calling CoinGecKo API + const {aptos, bluemove} = await query(bluemoveCoinGecKoApi); + const movePriceByAPT = bluemove.usd /aptos.usd; + // Get TVL from staking MOVE to receive MOVE + const { data: { total_moves_staking } } = await aQuery('/v1/accounts/0x400ffaf40b899bb14f883a16bed906b3977486a2bef4ad25e3e6ae0f9a3dde79/resource/0x9637eeb749cd50808be7d9bb2652af00971688d457feb002ec31af594cc77a2d::staking_move_earn_move::StakingData'); + // Get TVL from staking MOVE to receive NFTs + const { data } = await aQuery('/v1/accounts/0xb0879d35e9503c7cda8da6f9574cf00ab36c0704ea5b1a4d818472e093cdcee4/resource/0x352ad31333d08a45898a97a96f066ff4bfda2756c17239032c3bdd3825d1f0b0::staking_move_earn_nft::StakingData'); + // Calculate TVL + const total_moves_staking_earn_nft = data.total_moves_staking; + const staking_tvl = ((total_moves_staking)/1e8 + total_moves_staking_earn_nft/1e8) * movePriceByAPT; + return { + aptos: staking_tvl + } + }, + tvl: (async) => ({}), + } +} \ No newline at end of file diff --git a/projects/bluebit/abis.json b/projects/bluebit/abis.json index 2c05758de39..37509a280e4 100644 --- a/projects/bluebit/abis.json +++ b/projects/bluebit/abis.json @@ -1,26 +1,3 @@ { - "summary": { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "summary", - "outputs": [ - { - "internalType": "uint256", - "name": "tvl", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deposites", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -} + "summary": "function summary(address account) view returns (uint256 tvl, uint256 deposites)" +} \ No newline at end of file diff --git a/projects/bluebit/index.js b/projects/bluebit/index.js index 8e306c70550..dd1d64b3571 100644 --- a/projects/bluebit/index.js +++ b/projects/bluebit/index.js @@ -1,10 +1,11 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const abi = require("./abis.json"); const { staking } = require("../helper/staking"); const { toUSDTBalances } = require("../helper/balances"); -const { getBlock } = require("../helper/getBlock"); +const { getBlock } = require("../helper/http"); -const account = "0x0000000000000000000000000000000000000000"; +const account = ADDRESSES.null; const token = "0x4148d2Ce7816F0AE378d98b40eB3A7211E1fcF0D"; const veToken = "0xdf7C547f332351A86DB0D89a89799A7aB4eC9dEB"; diff --git a/projects/bluefin/index.js b/projects/bluefin/index.js new file mode 100644 index 00000000000..e79a019b13d --- /dev/null +++ b/projects/bluefin/index.js @@ -0,0 +1,9 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require('../helper/unwrapLPs') + +// https://dapi.api.arbitrum-prod.firefly.exchange/marketData/contractAddresses +module.exports = { + arbitrum: { + tvl: sumTokensExport({ tokens: [ADDRESSES.arbitrum.USDC], owner: '0x52b5471d04487fb85B39e3Ae47307f115fe8733F'}) + } +} \ No newline at end of file diff --git a/projects/bluemove-dex/index.js b/projects/bluemove-dex/index.js new file mode 100644 index 00000000000..4ec28198e69 --- /dev/null +++ b/projects/bluemove-dex/index.js @@ -0,0 +1,20 @@ +const { dexExport } = require('../helper/chain/sui') +const { mergeExports } = require('../helper/utils') + +module.exports = mergeExports([ + dexExport({ + account: '0x3f2d9f724f4a1ce5e71676448dc452be9a6243dac9c5b975a588c8c867066e92', + poolStr: '::swap::Pool', + token0Reserve: i => i.fields.reserve_x, + token1Reserve: i => i.fields.reserve_y, + eventType: "0xb24b6789e088b876afabca733bed2299fbc9e2d6369be4d1acfa17d8145454d9::swap::Created_Pool_Event", + eventTransform: i => i.pool_id + }), + dexExport({ + account: '0x5a7eca40df453efe6bb1feae99e5b8fc072d1252cbd1979eb187d625dc9b47c9', + poolStr: 'stable_swap::Stable_Pool', + token0Reserve: i => i.fields.token_x, + token1Reserve: i => i.fields.token_y, + isAMM: false, + }) +]) diff --git a/projects/blueshift/abi.json b/projects/blueshift/abi.json index 1d890805be5..549cf171455 100644 --- a/projects/blueshift/abi.json +++ b/projects/blueshift/abi.json @@ -1,134 +1,9 @@ { "BlueshiftRegistry": { - "getPortfolios": { - "inputs": [], - "name": "getPortfolios", - "outputs": [ - { - "components": [ - { - "internalType": "string", - "name": "name", - "type": "string" - }, - { - "internalType": "address", - "name": "contractAddress", - "type": "address" - }, - { - "internalType": "address", - "name": "baseTokenAddress", - "type": "address" - }, - { - "internalType": "address", - "name": "lpTokenAddress", - "type": "address" - }, - { - "internalType": "uint256", - "name": "lpTokenPrice", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalValue", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "tokenCount", - "type": "uint256" - }, - { - "components": [ - { - "internalType": "address", - "name": "tokenAddress", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "price", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "depositLimit", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "withdrawLimit", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "depositEMAPrice", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "withdrawEMAPrice", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "portfolioShare", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "targetWeight", - "type": "uint256" - } - ], - "internalType": "struct BlueshiftPortfolioAndPairRegistry.TokenInfo[]", - "name": "tokens", - "type": "tuple[]" - } - ], - "internalType": "struct BlueshiftPortfolioAndPairRegistry.PortfolioInfo[]", - "name": "", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - } + "getPortfolios": "function getPortfolios() view returns (tuple(string[] name, address[] contractAddress, address[] baseTokenAddress, address[] lpTokenAddress, uint256[] lpTokenPrice, uint256[] totalValue, uint256[] tokenCount, uint256[] baseTokenPriceCoefficient, tuple(address[] tokenAddress, uint256[] amount, uint256[] price, uint256[] depositLimit, uint256[] withdrawLimit, uint256[] depositEMAPrice, uint256[] withdrawEMAPrice, uint256[] portfolioShare, uint256[] targetWeight)[] tokens))" }, "BlueshiftEarning": { - "getAccDeposit": { - "inputs": [], - "name": "getAccDeposit", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getToken": { - "inputs": [], - "name": "getToken", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } + "getAccDeposit": "uint256:getAccDeposit", + "getToken": "address:getToken" } } \ No newline at end of file diff --git a/projects/blueshift/config.json b/projects/blueshift/config.json index 9974536e489..07d9d2bbf8b 100644 --- a/projects/blueshift/config.json +++ b/projects/blueshift/config.json @@ -1,12 +1,28 @@ { "registry": { - "milkomeda": "0x83E384d119adA05195Caca26396B8f56fdDA1c91", - "milkomeda_a1": "0xa2f7a17872C5A02097970De636EDa8a088aeC9ab", - "kava": "0xcfEE60ec5EB1e4e48593750A96c96E040eAB686A" + "milkomeda": "0xb42F2f37Dedf435F4916665d6B4c2cC643A17f14", + "milkomeda_a1": "0xa98C276d262Cc3Bf660189E2eBE74c4B8C18e50a", + "kava": "0x49399653f651A25924b3D8718276b5b4372577b1", + "polygon": "0x2080A319A4B11D097050722b6b65d09F754EdC83" }, "manualPool": { "milkomeda": "0xA4f0e3C80C77b347250B9D3999478E305FF814A4", "milkomeda_a1": "0x589E3Edd93A22FB316cff53eABA6BB958ff601cd", - "kava": "" + "kava": "0x7A60918Bd5c83Ef7e2ABA87D13e3FD704f6A77E1" + }, + "blueschain": { + "milkomeda": { + "reserve": "0xa2351AEA209ceB0ffeCd77149eC615335d7f513d", + "tokens": [ + "0xAE83571000aF4499798d1e3b0fA0070EB3A3E3F9", + "0x8c008BBA2Dd56b99f4A6aB276bE3a478cB075F0C" + ] + }, + "polygon": { + "reserve": "0x3abd79823C595C0778e51246c491126e77367b20", + "tokens": [ + "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270" + ] + } } } \ No newline at end of file diff --git a/projects/blueshift/index.js b/projects/blueshift/index.js index a1bdc63bd38..fd9b3427f85 100644 --- a/projects/blueshift/index.js +++ b/projects/blueshift/index.js @@ -1,66 +1,40 @@ -const sdk = require('@defillama/sdk'); -const { default: BigNumber } = require('bignumber.js'); -const { transformBalances } = require('../helper/portedTokens'); +const { sumTokens2 } = require('../helper/unwrapLPs') const abi = require('./abi.json'); -const config = require("./config.json"); - - -async function staking(chain, chainBlocks) { - const balances = {}; - - const value = (await sdk.api.abi.call({ - abi: abi.BlueshiftEarning.getAccDeposit, - chain: chain, - target: config.manualPool[chain], - params: [], - block: chainBlocks[chain], - })).output; - - const tokenAddress = (await sdk.api.abi.call({ - abi: abi.BlueshiftEarning.getToken, - chain: chain, - target: config.manualPool[chain], - params: [], - block: chainBlocks[chain], - })).output; - - sdk.util.sumSingleBalance(balances, tokenAddress, value); - return transformBalances(chain, balances) +const { registry, manualPool, blueschain, } = require("./config.json"); + +async function staking(_, _1, _2, { api }) { + const chain = api.chain + if (!manualPool[chain]) return {} + const value = await api.call({ abi: abi.BlueshiftEarning.getAccDeposit, target: manualPool[chain], }) + const tokenAddress = await api.call({ abi: abi.BlueshiftEarning.getToken, target: manualPool[chain], }) + api.add(tokenAddress, value) + return api.getBalances() } -async function tvl(chain, chainBlocks) { - const balances = {}; +async function tvl(_, _1, _2, { api }) { + const chain = api.chain + const { reserve, tokens } = blueschain[chain] ?? {} - const portfolios = (await sdk.api.abi.call({ - abi: abi.BlueshiftRegistry.getPortfolios, - chain: chain, - target: config.registry[chain], - params: [], - block: chainBlocks[chain], - })).output; + // Blueschain reserves + if (reserve) + await sumTokens2({ api, owner: reserve, tokens, }) - for (let portfolio of portfolios) { - const value = portfolio.totalValue; - sdk.util.sumSingleBalance(balances, portfolio.baseTokenAddress, value); + // Local reserves + if (registry[chain]) { + const portfolios = await api.call({ abi: abi.BlueshiftRegistry.getPortfolios, target: registry[chain], }) + + for (let i = 0; i < portfolios.contractAddress.length; ++i) + api.add(portfolios.baseTokenAddress[i], portfolios.totalValue[i]) } - return transformBalances(chain, balances) + return api.getBalances() } + module.exports = { methodology: 'Accumulates TVL of all Blueshift portfolios calculated in base tokens. Adds TVL of BLUES tokens staked in Blueshift yield pools.', - milkomeda: { - start: 2023331, - staking: (timestamp, block, chainBlocks) => staking('milkomeda', chainBlocks), - tvl: (timestamp, block, chainBlocks) => tvl('milkomeda', chainBlocks) - }, - milkomeda_a1: { - start: 1300, - staking: (timestamp, block, chainBlocks) => staking('milkomeda_a1', chainBlocks), - tvl: (timestamp, block, chainBlocks) => tvl('milkomeda_a1', chainBlocks) - }, - kava: { - start: 2499737, - tvl: (timestamp, block, chainBlocks) => tvl('kava', chainBlocks) - } }; + +Object.keys(registry).forEach(chain => { + module.exports[chain] = { tvl, staking } +}) diff --git a/projects/bluespade/index.js b/projects/bluespade/index.js new file mode 100644 index 00000000000..0bf9136b7ea --- /dev/null +++ b/projects/bluespade/index.js @@ -0,0 +1,22 @@ +const {staking} = require('../helper/staking') +const { gmxExports } = require('../helper/gmx') + +//Cronos +const cronosVault = '0x26e5FbFbfd38a27D5777C9C9CC5543e687E637D8'; +const cronosStaking = '0xbCCE1c2efDED06ee73183f8B20f03e452EF8495D'; +const cronosBLU = '0x1542bA4CA0fb6D1B4476a933B292002fd1959A52'; +//Polygon +const polygonVault = '0xd6f70237f501891C3E1634544F36E026250c2D3F' +const polygonStaking = '0xb710f0D97023340eB3faBC4259FEAdf3bBeDdf05' +const polygonBLU = '0x759d34685468604c695De301ad11A9418e2f1038' + +module.exports = { + cronos: { + staking: staking(cronosStaking, cronosBLU), + tvl: gmxExports({ vault: cronosVault, }) + }, + polygon:{ + staking: staking(polygonStaking, polygonBLU), + tvl: gmxExports({ vault: polygonVault, }) + } +}; diff --git a/projects/blur-finance/abi.js b/projects/blur-finance/abi.js index 365241bbc46..4a9cfe72360 100644 --- a/projects/blur-finance/abi.js +++ b/projects/blur-finance/abi.js @@ -1,69 +1,4 @@ module.exports = { - poolInfo2: { - "inputs": [ - { - "internalType": "uint256", - "name": "_pid", - "type": "uint256" - } - ], - "name": "poolInfo2", - "outputs": [ - { - "internalType": "address", - "name": "lpToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "allocPoint", - "type": "uint256" - }, - { - "internalType": "address", - "name": "strat0", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount0", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "share0", - "type": "uint256" - }, - { - "internalType": "address", - "name": "strat1", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount1", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "share1", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - poolLength: { - "inputs": [], - "name": "poolLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, + poolInfo2: "function poolInfo2(uint256 _pid) view returns (address lpToken, uint256 allocPoint, address strat0, uint256 amount0, uint256 share0, address strat1, uint256 amount1, uint256 share1)", + poolLength: "uint256:poolLength", } \ No newline at end of file diff --git a/projects/blur-finance/index.js b/projects/blur-finance/index.js index d1d39fccc17..35d1fb4b0da 100644 --- a/projects/blur-finance/index.js +++ b/projects/blur-finance/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk") const abi = require('./abi') const { getChainTransform } = require('../helper/portedTokens') @@ -8,9 +9,9 @@ let totalTvl const contract = '0xf300b9171aAb493F4584b8f5601d97E627AaB451' const blur = '0x4165084a6e5388ce53c9d9892f904a2712dd943a' -const wbnb = '0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c' +const wbnb = ADDRESSES.bsc.WBNB const sushi = '0x4165084A6e5388ce53c9D9892f904a2712Dd943A' -const busd = '0x66e428c3f67a68878562e79a0234c1f83c208770' +const busd = ADDRESSES.cronos.USDT async function gettotalTvl(block) { if (!totalTvl) totalTvl = getTVL() diff --git a/projects/blur-lend/index.js b/projects/blur-lend/index.js new file mode 100644 index 00000000000..0bc033ad332 --- /dev/null +++ b/projects/blur-lend/index.js @@ -0,0 +1,11 @@ +const { sumTokensExport } = require('../helper/unwrapLPs') + +const collateralProxy = "0x29469395eAf6f95920E59F858042f0e28D98a20B" + +module.exports = { + misrepresentedTokens: true, + methodology: 'TVL counts NFTs used as collateral to take out loans', + ethereum: { + tvl: sumTokensExport({ owners: [collateralProxy], resolveNFTs: true, }), + } +} diff --git a/projects/blur/index.js b/projects/blur/index.js new file mode 100644 index 00000000000..2b5e18af55b --- /dev/null +++ b/projects/blur/index.js @@ -0,0 +1,32 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const sdk = require('@defillama/sdk') + + +const blurBiddingAddr = "0x0000000000A39bb272e79075ade125fd351887Ac" + + +async function ethtvl(timestamp, block) { + + const ethBalance = await sdk.api.eth.getBalance({ + target: blurBiddingAddr, + block + }) + + return { + [ADDRESSES.null]: ethBalance.output, + + } +} + +module.exports = { + hallmarks: [ + [1676376000,"BLUR token launch"] + ], + timetravel: true, + misrepresentedTokens: false, + methodology: 'TVL counts ETH tokens in the Blur Bidding address:0x0000000000A39bb272e79075ade125fd351887Ac', + + ethereum: { + tvl: ethtvl + } +} diff --git a/projects/bmcc/index.js b/projects/bmcc/index.js index 0be0a4d624b..7cdd0664ed3 100644 --- a/projects/bmcc/index.js +++ b/projects/bmcc/index.js @@ -1,15 +1,21 @@ const { stakings } = require("../helper/staking"); const { pool2s } = require("../helper/pool2"); const token = "0xb6D8EE99D5d6cfe7D80b666e6fF5e74e3f72756b"; +// const omg = "0x1457438D5326a54ceE5b9398d9171eF8E0BC2DF7"; + const stakingContracts = [ - // stakingContract = + // stakingContract1 = "0xD5DBAeb18943ed04CD84Cd3378D67ea94Da0F043", + // stakingContract2 = + "0xf7b95c668a31eb448bc4dea5e48a0efbef2fb63b", // Lottery "0x74ec16b956678e337b88099b7bD0a234e79F60EF", ]; + const lockedContracts = [ //masterchef "0xAf3346DE11b838c4ea0D8E369486eB9BACeEEb02", + "0x65C9DaFddA01e1C81C671Dc20ec0c6341Fe3085e", "0x0c89c0407775dd89b12918b9c0aa42bf96518820", "0xa36037dC26C5C02e864eBA969A312320E6487269", ]; diff --git a/projects/bnpl-pay/index.js b/projects/bnpl-pay/index.js index 5946034a8e3..00f78c909d2 100644 --- a/projects/bnpl-pay/index.js +++ b/projects/bnpl-pay/index.js @@ -92,157 +92,12 @@ async function borrowed(_, block) { } const abi = { - bankingNodeCount: { - "inputs": [], - "name": "bankingNodeCount", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - bankingNodesList: { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "bankingNodesList", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - baseToken: { - "inputs": [], - "name": "baseToken", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - getCurrentLoansCount: { - "inputs": [], - "name": "getCurrentLoansCount", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - currentLoans: { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "currentLoans", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - idToLoan: { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "idToLoan", - "outputs": [ - { - "internalType": "address", - "name": "borrower", - "type": "address" - }, - { - "internalType": "bool", - "name": "interestOnly", - "type": "bool" - }, - { - "internalType": "uint256", - "name": "loanStartTime", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "loanAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "paymentInterval", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "interestRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "numberOfPayments", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "principalRemaining", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "paymentsMade", - "type": "uint256" - }, - { - "internalType": "address", - "name": "collateral", - "type": "address" - }, - { - "internalType": "uint256", - "name": "collateralAmount", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "isSlashed", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, + bankingNodeCount: "uint256:bankingNodeCount", + bankingNodesList: "function bankingNodesList(uint256) view returns (address)", + baseToken: "address:baseToken", + getCurrentLoansCount: "uint256:getCurrentLoansCount", + currentLoans: "function currentLoans(uint256) view returns (uint256)", + idToLoan: "function idToLoan(uint256) view returns (address borrower, bool interestOnly, uint256 loanStartTime, uint256 loanAmount, uint256 paymentInterval, uint256 interestRate, uint256 numberOfPayments, uint256 principalRemaining, uint256 paymentsMade, address collateral, uint256 collateralAmount, bool isSlashed)", } module.exports = { diff --git a/projects/bobagateway/abi.json b/projects/bobagateway/abi.json index bd3c3465f94..e4446099b60 100644 --- a/projects/bobagateway/abi.json +++ b/projects/bobagateway/abi.json @@ -1,56 +1,3 @@ { - "poolInfo": { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "poolInfo", - "outputs": [ - { - "internalType": "address", - "name": "l1TokenAddress", - "type": "address" - }, - { - "internalType": "address", - "name": "l2TokenAddress", - "type": "address" - }, - { - "internalType": "uint256", - "name": "userDepositAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastAccUserReward", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accUserReward", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accUserRewardPerShare", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accOwnerReward", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "startTime", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } + "poolInfo": "function poolInfo(address) view returns (address l1TokenAddress, address l2TokenAddress, uint256 userDepositAmount, uint256 lastAccUserReward, uint256 accUserReward, uint256 accUserRewardPerShare, uint256 accOwnerReward, uint256 startTime)" } \ No newline at end of file diff --git a/projects/bobagateway/index.js b/projects/bobagateway/index.js index add5a86f912..0f499efd727 100644 --- a/projects/bobagateway/index.js +++ b/projects/bobagateway/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const listTokens = require("./listTokens.json"); const abi = require("./abi.json"); @@ -12,8 +13,8 @@ const L1StakingTokens = [ const L2LiquidityPool = "0x3A92cA39476fF84Dc579C868D4D7dE125513B034"; const L2StakingTokens = [ - "0xe1E2ec9a85C607092668789581251115bCBD20de", //OMG on boba - "0xa18bF3994C0Cc6E3b63ac420308E5383f53120D7", //BOBA on boba + ADDRESSES.boba.OMG, //OMG on boba + ADDRESSES.boba.BOBA, //BOBA on boba ]; const calcTvl = async ( diff --git a/projects/bodhfinance/index.js b/projects/bodhfinance/index.js index 0a2767c6b3b..5e37a1b6923 100644 --- a/projects/bodhfinance/index.js +++ b/projects/bodhfinance/index.js @@ -1,6 +1,7 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { compoundExports } = require('../helper/compound') -const WETH = "0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000" +const WETH = ADDRESSES.metis.Metis const bETH = "0xe970c37243F3d0B2AeB041b855Ef6466CB140BcA" const unitroller = "0x97b491744587d05ca33e84bB18B61Df9B3986DcE" diff --git a/projects/bolide/index.js b/projects/bolide/index.js index 12475c6e5af..50e7555bf3f 100644 --- a/projects/bolide/index.js +++ b/projects/bolide/index.js @@ -5,36 +5,29 @@ const sdk = require('@defillama/sdk') const BigNumber = require("bignumber.js"); const VAULTS = { - STABLECOINS: '0xf1f25A26499B023200B3f9A30a8eCEE87b031Ee1', - ETH: '0x941ef9AaF3277052e2e6c737ae9a75b229A20988', - BTC: '0xed18f1CE58fED758C7937cC0b8BE66CB02Dc45c6', - ALTCOINS: '0x5d735e9ffE9664B80c405D16921912E5B989688C', + bsc: { + STABLECOINS: '0xf1f25A26499B023200B3f9A30a8eCEE87b031Ee1', + ETH: '0x941ef9AaF3277052e2e6c737ae9a75b229A20988', + BTC: '0xed18f1CE58fED758C7937cC0b8BE66CB02Dc45c6', + ALTCOINS: '0x5d735e9ffE9664B80c405D16921912E5B989688C', + }, + polygon: { + STABLECOINS: '0x0aF9F3297f34921Acd5Ac81970929964c9f3d0a7', + } } -const getTotalDepositABI = { - 'inputs': [], - 'name': 'getTotalDeposit', - 'outputs': [ - { - 'internalType': 'uint256', - 'name': '', - 'type': 'uint256' - } - ], - 'stateMutability': 'view', - 'type': 'function' -} +const getTotalDepositABI = 'uint256:getTotalDeposit' -async function tvl(ts, _block, chainBlocks) { +async function tvl(chain, ts, _block, chainBlocks) { let totalUsdt = new BigNumber(0); - for (const item of Object.values(VAULTS)) { + for (const item of Object.values(VAULTS[chain])) { const result = await sdk.api.abi.call({ target: item, abi: getTotalDepositABI, - block: chainBlocks.bsc, - chain: 'bsc' + block: chainBlocks[chain], + chain: chain }); if (result && result.output) { @@ -45,7 +38,7 @@ async function tvl(ts, _block, chainBlocks) { totalUsdt = totalUsdt.plus(usdt); } } - + return { [usdtAddress]: totalUsdt, }; @@ -53,8 +46,11 @@ async function tvl(ts, _block, chainBlocks) { module.exports = { bsc: { - tvl, + tvl: tvl.bind(this, 'bsc'), staking: staking('0x3782c47e62b13d579fe748946aef7142b45b2cf7', '0x766AFcf83Fd5eaf884B3d529b432CA27A6d84617', 'bsc'), pool2: pool2('0x3782c47e62b13d579fe748946aef7142b45b2cf7', '0x12c35ed2405bc70721584594723351bf5db6235c', 'bsc'), + }, + polygon: { + tvl: tvl.bind(this, 'polygon'), } } diff --git a/projects/bond-protocol/index.js b/projects/bond-protocol/index.js new file mode 100644 index 00000000000..c305b25ee8b --- /dev/null +++ b/projects/bond-protocol/index.js @@ -0,0 +1,37 @@ +const { getLogs } = require('../helper/cache/getLogs') +const { sumTokens2 } = require('../helper/unwrapLPs') + +const config = { + arbitrum: { factory: '0x007FE70dc9797C4198528aE43d8195ffF82Bdc95', fromBlock: 43273954, tellerFactory: '0x007f7735baf391e207e3aa380bb53c4bd9a5fed6', tellerBlock: 43273983, }, + ethereum: { factory: '0x007FE70dc9797C4198528aE43d8195ffF82Bdc95', fromBlock: 15998037, tellerFactory: '0x007f7735baf391e207e3aa380bb53c4bd9a5fed6', tellerBlock: 15998038, }, +} + +module.exports = { +}; + +Object.keys(config).forEach(chain => { + const { factory, fromBlock, tellerFactory, tellerBlock, } = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const tellerLogs = await getLogs({ + api, + target: tellerFactory, + topics: ['0xd5a20d99fad8d4fec2eae3eb7d21c0bebeaecce7cf87b698ddba05071e7bde27'], + eventAbi: 'event ERC1155BondTokenCreated (uint256 tokenId, address indexed underlying, uint48 indexed expiry)', + onlyArgs: true, + fromBlock: tellerBlock, + }) + const tellerTokens = tellerLogs.map(i => i.underlying) + const logs = await getLogs({ + api, + target: factory, + topics: ['0x4fd9a46575749d9ddf290fadaa5729fc640790e2b6360df8cc8af35e418dcec0'], + eventAbi: 'event ERC20BondTokenCreated (address bondToken, address indexed underlying, uint48 indexed expiry)', + onlyArgs: true, + fromBlock, + }) + const tokens = logs.map(i => i.underlying) + return sumTokens2({ api, ownerTokens: [[tokens, factory], [tellerTokens, tellerFactory]], }) + } + } +}) \ No newline at end of file diff --git a/projects/boneriumtech/index.js b/projects/boneriumtech/index.js new file mode 100644 index 00000000000..7523e99128f --- /dev/null +++ b/projects/boneriumtech/index.js @@ -0,0 +1,7 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports = { + bone: { + tvl: getUniTVL({ factory: '0x9e98c46825da5f6622eBFA0bc8d278c61b763802', useDefaultCoreAssets: true, }) + } +} \ No newline at end of file diff --git a/projects/bonkswap/index.js b/projects/bonkswap/index.js new file mode 100644 index 00000000000..a5d031dff50 --- /dev/null +++ b/projects/bonkswap/index.js @@ -0,0 +1,212 @@ +const { getProvider, sumTokens2, } = require('../helper/solana') +const { Program, } = require("@project-serum/anchor"); + +async function tvl() { + const provider = getProvider() + const program = new Program(idl, idl.metadata.address, provider) + const data = await program.account.pool.all() + return sumTokens2({ tokenAccounts: data.map(({account: i}) => [i.poolXAccount.toString(), i.poolYAccount.toString()]).flat()}) +} + +module.exports = { + timetravel: false, + solana: { tvl, }, +} + +const idl = { + version: '0.1.1', + name: 'bonkswap', + instructions: [], + accounts: [ + { + name: 'pool', + type: { + kind: 'struct', + fields: [ + { + name: 'tokenX', + type: 'publicKey' + }, + { + name: 'tokenY', + type: 'publicKey' + }, + { + name: 'poolXAccount', + type: 'publicKey' + }, + { + name: 'poolYAccount', + type: 'publicKey' + }, + { + name: 'admin', + type: 'publicKey' + }, + { + name: 'projectOwner', + type: 'publicKey' + }, + { + name: 'tokenXReserve', + type: { + defined: 'Token' + } + }, + { + name: 'tokenYReserve', + type: { + defined: 'Token' + } + }, + { + name: 'selfShares', + type: { + defined: 'Token' + } + }, + { + name: 'allShares', + type: { + defined: 'Token' + } + }, + { + name: 'buybackAmountX', + type: { + defined: 'Token' + } + }, + { + name: 'buybackAmountY', + type: { + defined: 'Token' + } + }, + { + name: 'projectAmountX', + type: { + defined: 'Token' + } + }, + { + name: 'projectAmountY', + type: { + defined: 'Token' + } + }, + { + name: 'mercantiAmountX', + type: { + defined: 'Token' + } + }, + { + name: 'mercantiAmountY', + type: { + defined: 'Token' + } + }, + { + name: 'lpAccumulatorX', + type: { + defined: 'FixedPoint' + } + }, + { + name: 'lpAccumulatorY', + type: { + defined: 'FixedPoint' + } + }, + { + name: 'constK', + type: { + defined: 'Product' + } + }, + { + name: 'price', + type: { + defined: 'FixedPoint' + } + }, + { + name: 'lpFee', + type: { + defined: 'FixedPoint' + } + }, + { + name: 'buybackFee', + type: { + defined: 'FixedPoint' + } + }, + { + name: 'projectFee', + type: { + defined: 'FixedPoint' + } + }, + { + name: 'mercantiFee', + type: { + defined: 'FixedPoint' + } + }, + { + name: 'farmCount', + type: 'u64' + }, + { + name: 'bump', + type: 'u8' + } + ] + } + }, + ], + types: [ + { + name: 'FixedPoint', + type: { + kind: 'struct', + fields: [ + { + name: 'v', + type: 'u128' + } + ] + } + }, + { + name: 'Token', + type: { + kind: 'struct', + fields: [ + { + name: 'v', + type: 'u64' + } + ] + } + }, + { + name: 'Product', + type: { + kind: 'struct', + fields: [ + { + name: 'v', + type: 'u128' + } + ] + } + }, + ], + errors: [], + metadata: { + address: 'BSwp6bEBihVLdqJRKGgzjcGLHkcTuzmSo1TQkHepzH8p', + } +} diff --git a/projects/bonqdao/index.js b/projects/bonqdao/index.js new file mode 100644 index 00000000000..a3633567f4f --- /dev/null +++ b/projects/bonqdao/index.js @@ -0,0 +1,77 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const sdk = require('@defillama/sdk'); +const { stakings } = require("../helper/staking"); +const TROVE_FACTORY_CONTRACT = '0x3bB7fFD08f46620beA3a9Ae7F096cF2b213768B3' +const ALBT = '0x00a8b738E453fFd858a7edf03bcCfe20412f0Eb0' // Ethereum version of AllianceBlock Token +const BEUR = '0x338Eb4d394a4327E5dB80d08628fa56EA2FD4B81'.toLowerCase() // BEUR Token pegged to the Euro +const BNQ = '0x91eFbe97e08D0ffC7d31381c032D05FAd8E25aAA' // BONQ Utility Token +const BNQ_STAKING_CONTRACT = '0xb1b72B3579b03dFdCfF3195486277605e55Cf703' +const BNQ_BEUR_UNIV3_POOL = '0xA96373C7a591fd21b86E0c9b8E156CC81E6cBb5e' +const TOKEN_COLLATERAL = [ + ADDRESSES.polygon.WMATIC_2, // WMATIC + ADDRESSES.polygon.USDC, // USDC + '0x35b2ece5b1ed6a7a99b83508f8ceeab8661e0632', // WALBT (Wrapped AllianceBlock Token) + ADDRESSES.polygon.WETH_1, // WETH + ADDRESSES.polygon.DAI, // DAI +] +const LP_COLLATERAL = [ + '0xa1dd21527c76bb1a3b667149e741a8b0f445fae2', // Arrakis Vault V1 BEUR/DAI + '0x388e289a1705fa7b8808ab13f0e0f865e2ff94ee' // Arrakis Vault V1 USDC/BEUR +] + +const abi = { + getUnderlyingBalances: 'function getUnderlyingBalances() public view returns (uint256 amount0Current, uint256 amount1Current)', + totalCollateral: 'function totalCollateral(address _token) external view returns (uint256)', +} + +async function getPairTVL(balances, contract, api) { + const [ + uBals, lpBal, totalSupply, token0, token1, + ] = await Promise.all([ + api.call({ abi: abi.getUnderlyingBalances, target: contract, }), + api.call({ target: TROVE_FACTORY_CONTRACT, params: contract, abi: abi.totalCollateral, }), + api.call({ target: contract, abi: 'erc20:totalSupply', }), + api.call({ abi: 'address:token0', target: contract, }), + api.call({ abi: 'address:token1', target: contract, }), + ]) + + const ratio = lpBal / totalSupply + if (token0.toLowerCase() !== BEUR) + sdk.util.sumSingleBalance(balances, token0, uBals[0] * ratio, api.chain) + if (token1.toLowerCase() !== BEUR) + sdk.util.sumSingleBalance(balances, token1, uBals[1] * ratio, api.chain) +} + +async function tvl(_, _1, _2, { api }) { + const balances = {}; + + const tokenUnderlying = await api.multiCall({ + target: TROVE_FACTORY_CONTRACT, + calls: TOKEN_COLLATERAL, + abi: abi.totalCollateral, + }); + tokenUnderlying.forEach((e, index) => { + // use ALBT price from Ethereum, WALBT not available on Coingecko + if (TOKEN_COLLATERAL[index] === '0x35b2ece5b1ed6a7a99b83508f8ceeab8661e0632') { + return sdk.util.sumSingleBalance(balances, ALBT, e); + } + return sdk.util.sumSingleBalance(balances, TOKEN_COLLATERAL[index], e, api.chain); + }) + + await Promise.all(LP_COLLATERAL.map(i => getPairTVL(balances, i, api))) + + return balances; +} + +module.exports = { + hallmarks: [ + [1675252800,"Oracle Hack"] + ], + methodology: 'Summation of the collateral deposited in BonqDAO Troves (personal lending vaults)', + start: 36884903, + polygon: { + tvl, + staking: stakings([BNQ_STAKING_CONTRACT], BNQ), + // pool2: stakings([BNQ_BEUR_UNIV3_POOL], [BEUR, BNQ]) + } +}; diff --git a/projects/bonsai-strike/index.js b/projects/bonsai-strike/index.js new file mode 100644 index 00000000000..dd5ce058702 --- /dev/null +++ b/projects/bonsai-strike/index.js @@ -0,0 +1,8 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require("../helper/unwrapLPs"); + +module.exports = { + bsc: { + tvl: sumTokensExport({ owners: ['0x01cEF5B79044E1CCd9b6Ad76c3d0985b5A33F769', '0x4b9d1cf13129a79d92bef13dac908e9ffc665ad8'], tokens: [ADDRESSES.bsc.WBNB]}), + } +}; \ No newline at end of file diff --git a/projects/boofinance/abi.json b/projects/boofinance/abi.json index eba3ed808fd..73f681f5427 100644 --- a/projects/boofinance/abi.json +++ b/projects/boofinance/abi.json @@ -1,49 +1,4 @@ { - "tokenList": { - "inputs": [], - "name": "tokenList", - "outputs": [ - { "internalType": "address[]", "name": "", "type": "address[]" } - ], - "stateMutability": "view", - "type": "function" - }, - "tokenParameters": { - "inputs": [{ "internalType": "address", "name": "", "type": "address" }], - "name": "tokenParameters", - "outputs": [ - { - "internalType": "contract IRewarder", - "name": "rewarder", - "type": "address" - }, - { - "internalType": "contract IBoofiStrategy", - "name": "strategy", - "type": "address" - }, - { - "internalType": "uint256", - "name": "lastRewardTime", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastCumulativeReward", - "type": "uint256" - }, - { "internalType": "uint256", "name": "storedPrice", "type": "uint256" }, - { - "internalType": "uint256", - "name": "accZBOOFIPerShare", - "type": "uint256" - }, - { "internalType": "uint256", "name": "totalShares", "type": "uint256" }, - { "internalType": "uint256", "name": "totalTokens", "type": "uint256" }, - { "internalType": "uint128", "name": "multiplier", "type": "uint128" }, - { "internalType": "uint16", "name": "withdrawFeeBP", "type": "uint16" } - ], - "stateMutability": "view", - "type": "function" - } -} + "tokenList": "address[]:tokenList", + "tokenParameters": "function tokenParameters(address) view returns (address rewarder, address strategy, uint256 lastRewardTime, uint256 lastCumulativeReward, uint256 storedPrice, uint256 accZBOOFIPerShare, uint256 totalShares, uint256 totalTokens, uint128 multiplier, uint16 withdrawFeeBP)" +} \ No newline at end of file diff --git a/projects/boofinance/index.js b/projects/boofinance/index.js index 2b93d439020..e63245dba66 100644 --- a/projects/boofinance/index.js +++ b/projects/boofinance/index.js @@ -1,9 +1,10 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); -const token0Abi = require("../helper/abis/token0.json"); -const token1Abi = require("../helper/abis/token1.json"); -const {unwrapUniswapLPs} = require("../helper/unwrapLPs"); -const {staking} = require("../helper/staking"); +const token0Abi = 'address:token0' +const token1Abi = 'address:token1' +const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); +const { staking } = require("../helper/staking"); const BigNumber = require("bignumber.js"); const boofi = "0xb00f1ad977a949a3ccc389ca1d1282a2946963b0"; @@ -11,123 +12,80 @@ const stakingAddress = "0x67712c62d1DEAEbDeF7401E59a9E34422e2Ea87c"; const hauntedHouse = "0xB178bD23876Dd9f8aA60E7FdB0A2209Fe2D7a9AB"; const transform = { - "0x4f60a160d8c2dddaafe16fcc57566db84d674bd6":"harmony:0x72cb10c6bfa5624dd07ef608027e366bd690048f", - "0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e":"avax:0xa7d7079b0fead91f3e65f86e8915cb59c1a4c664" + "0x4f60a160d8c2dddaafe16fcc57566db84d674bd6": "harmony:" + ADDRESSES.harmony.JEWEL, + [ADDRESSES.avax.USDC]: "avax:" + ADDRESSES.avax.USDC_e } -const joe = "0x6e84a6216ea6dacc71ee8e6b0a5b7322eebc0fdd"; -const xjoe = "0x57319d41f71e81f3c65f2a47ca4e001ebafd4f33"; +const joe = ADDRESSES.avax.JOE; +const xjoe = ADDRESSES.avax.xJOE; -async function calcTvl(block, chain, pool2) { - let balances = {}; - const tokenList = (await sdk.api.abi.call({ - target: hauntedHouse, - abi: abi.tokenList, - block, - chain - })).output; - const tokenBalances = (await sdk.api.abi.multiCall({ - calls: tokenList.map(p => ({ - target: hauntedHouse, - params: p - })), - abi: abi.tokenParameters, - block, - chain - })).output; - const symbols = (await sdk.api.abi.multiCall({ - calls: tokenList.map(p => ({ - target: p - })), - abi: "erc20:symbol", - block, - chain - })).output; - const token0Address = (await sdk.api.abi.multiCall({ - calls: tokenList.map(p => ({ - target: p, - })), - abi: token0Abi, - block, - chain - })).output; - const token1Address = (await sdk.api.abi.multiCall({ - calls: tokenList.map(p => ({ - target: p, - })), - abi: token1Abi, - block, - chain - })).output; - - let lpPositions = []; - for (let i = 0; i < tokenList.length; i++) { - let token = tokenList[i].toLowerCase(); - let balance = tokenBalances[i].output.totalShares; - let symbol = symbols[i].output; - let token0 = token0Address[i].output; - let token1 = token1Address[i].output; - if (token === boofi) continue; - if (pool2 && !symbol.endsWith("LP") && !symbol.endsWith("PGL")) continue; - if (!symbol.endsWith("LP") && !symbol.endsWith("PGL")) { - if (token === xjoe) { - const joeBalance = (await sdk.api.erc20.balanceOf({ - target: joe, - owner: xjoe, - block, - chain - })).output; - const xJoeSupply = (await sdk.api.erc20.totalSupply({ - target: xjoe, - block, - chain - })).output; - sdk.util.sumSingleBalance(balances, `avax:${joe}`, BigNumber(balance).times(joeBalance/xJoeSupply).toFixed(0)); - continue; - } - if (transform[token] !== undefined) { - token = transform[token]; - sdk.util.sumSingleBalance(balances, token, balance); - continue; - } - sdk.util.sumSingleBalance(balances, `${chain}:${token}`, balance); - continue; - } - token0 = token0.toLowerCase(); - token1 = token1.toLowerCase(); - if (pool2) { - if (token0 !== boofi && token1 !== boofi) continue; - } - else if (!pool2) { - if (token0 === boofi || token1 === boofi) continue; - } - lpPositions.push({ - token, - balance - }); +async function calcTvl(block, chain, pool2, api) { + let balances = {}; + const tokenList = (await api.call({ target: hauntedHouse, abi: abi.tokenList, })); + const tokenBalances = (await api.multiCall({ target: hauntedHouse, calls: tokenList, abi: abi.tokenParameters, })); + const symbols = (await api.multiCall({ calls: tokenList, abi: "erc20:symbol", })); + const token0Address = (await api.multiCall({ calls: tokenList, abi: token0Abi, permitFailure: true, })); + const token1Address = (await api.multiCall({ calls: tokenList, abi: token1Abi, permitFailure: true, })); + + let lpPositions = []; + for (let i = 0; i < tokenList.length; i++) { + let token = tokenList[i].toLowerCase(); + let balance = tokenBalances[i].totalShares; + let symbol = symbols[i]; + let token0 = token0Address[i] ?? ''; + let token1 = token1Address[i] ?? ''; + if (token === boofi) continue; + if (pool2 && !symbol.endsWith("LP") && !symbol.endsWith("PGL")) continue; + if (!symbol.endsWith("LP") && !symbol.endsWith("PGL")) { + if (token === xjoe) { + const joeBalance = (await api.call({ target: joe, params: xjoe, abi: 'erc20:balanceOf' })) + const xJoeSupply = (await api.call({ target: xjoe, abi: 'erc20:totalSupply' })) + sdk.util.sumSingleBalance(balances, `avax:${joe}`, balance * joeBalance / xJoeSupply); + continue; + } + if (transform[token] !== undefined) { + token = transform[token]; + sdk.util.sumSingleBalance(balances, token, balance); + continue; + } + sdk.util.sumSingleBalance(balances, `${chain}:${token}`, balance); + continue; + } + token0 = token0.toLowerCase(); + token1 = token1.toLowerCase(); + if (pool2) { + if (token0 !== boofi && token1 !== boofi) continue; + } + else if (!pool2) { + if (token0 === boofi || token1 === boofi) continue; } - await unwrapUniswapLPs(balances, lpPositions, block, chain, addr=>{ - addr = addr.toLowerCase(); - if (transform[addr] !== undefined) { - return transform[addr]; - } - return `avax:${addr}`; - }) - return balances; + lpPositions.push({ + token, + balance + }); + } + await unwrapUniswapLPs(balances, lpPositions, block, chain, addr => { + addr = addr.toLowerCase(); + if (transform[addr] !== undefined) { + return transform[addr]; + } + return `avax:${addr}`; + }) + return balances; } -async function tvl(timestamp, block, chainBlocks) { - return await calcTvl(chainBlocks.avax, "avax", false); +async function tvl(timestamp, block, chainBlocks, { api }) { + return await calcTvl(chainBlocks.avax, "avax", false, api); } -async function pool2(timestamp, block, chainBlocks) { - return await calcTvl(chainBlocks.avax, "avax", true); +async function pool2(timestamp, block, chainBlocks, { api }) { + return await calcTvl(chainBlocks.avax, "avax", true, api); } module.exports = { - avax:{ - tvl, - pool2, - staking: staking(stakingAddress, boofi, "avax") - } + avax: { + tvl, + pool2, + staking: staking(stakingAddress, boofi, "avax") + } } \ No newline at end of file diff --git a/projects/borgswap/abi.json b/projects/borgswap/abi.json index f12995c9081..b46dcd99914 100644 --- a/projects/borgswap/abi.json +++ b/projects/borgswap/abi.json @@ -1,139 +1,8 @@ { - "masterFarmerPoolInfo": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "poolInfo", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "lpToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "allocPoint", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastRewardBlock", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accBSCXPerShare", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "poolInfo": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "poolInfo", - "outputs": [ - { - "internalType": "contract IBEP20", - "name": "lpToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "allocPoint", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastRewardBlock", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accLqdrPerShare", - "type": "uint256" - }, - { - "internalType": "uint16", - "name": "depositFeeBP", - "type": "uint16" - } - ], - "stateMutability": "view", - "type": "function" - }, - "poolLength": { - "inputs": [], - "name": "poolLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "balanceOf": { - "inputs": [], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "lpToken": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "lpToken", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "strategies": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "strategies", - "outputs": [ - { - "internalType": "contract IStrategy", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } + "masterFarmerPoolInfo": "function poolInfo(uint256) view returns (address lpToken, uint256 allocPoint, uint256 lastRewardBlock, uint256 accBSCXPerShare)", + "poolInfo": "function poolInfo(uint256) view returns (address lpToken, uint256 allocPoint, uint256 lastRewardBlock, uint256 accLqdrPerShare, uint16 depositFeeBP)", + "poolLength": "uint256:poolLength", + "balanceOf": "uint256:balanceOf", + "lpToken": "function lpToken(uint256) view returns (address)", + "strategies": "function strategies(uint256) view returns (address)" } \ No newline at end of file diff --git a/projects/boringdao/index.js b/projects/boringdao/index.js index 871a0fb668f..0d7294520b4 100644 --- a/projects/boringdao/index.js +++ b/projects/boringdao/index.js @@ -20,7 +20,7 @@ function chainTvl(chain) { ], block) } return exports -}; +} const chainTVLObject = Object.keys(contracts) .reduce((agg, chain) => ({ ...agg, [chain]: chainTvl(chain) }), {}); diff --git a/projects/bourbon-dao/index.js b/projects/bourbon-dao/index.js index 37106ff3cac..0fc309816aa 100644 --- a/projects/bourbon-dao/index.js +++ b/projects/bourbon-dao/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const {ohmTvl} = require("../helper/ohm"); const whiskey = "0xce1ad4e2810e413e2e3684decc58a0bd01c907d9"; @@ -5,9 +6,9 @@ const stakingContract = "0x5e398c5da5353182aae7410fb824a1578fc518cb"; const treasury = "0x950d8c342bc6e0bcf9c1deb87d039947f35b3eb9"; const treasuryTokens = [ - ["0xe9e7cea3dedca5984780bafc599bd69add087d56", false], // BUSD - ["0x55d398326f99059ff775485246999027b3197955", false], // USDT - ["0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c", false], // WBNB + [ADDRESSES.bsc.BUSD, false], // BUSD + [ADDRESSES.bsc.USDT, false], // USDT + [ADDRESSES.bsc.WBNB, false], // WBNB ["0x96b6d5482313eecc031afeb2fb32da2ba7439ba2", true], // WHISKEY-BUSD CAKELP ] diff --git a/projects/bourbon/index.js b/projects/bourbon/index.js index 772903e7f7f..2b2521aa135 100644 --- a/projects/bourbon/index.js +++ b/projects/bourbon/index.js @@ -4,7 +4,6 @@ module.exports = { misrepresentedTokens: true, dogechain: { tvl: getUniTVL({ - chain: 'dogechain', useDefaultCoreAssets: true, factory: '0x6B09Aa7a03d918b08C8924591fc792ce9d80CBb5', }) diff --git a/projects/bow/index.js b/projects/bow/index.js new file mode 100644 index 00000000000..7c1f8895d3c --- /dev/null +++ b/projects/bow/index.js @@ -0,0 +1,21 @@ + +const { getConfig } = require("../helper/cache"); +const { sumTokens } = require('../helper/chain/cosmos') + + +async function tvl() { + const contracts = await getConfig("kujira/contracts", "https://raw.githubusercontent.com/Team-Kujira/kujira.js/master/src/resources/contracts.json"); + const bowPools = contracts["kaiyo-1"].bow.map(x => x.address) + const owners = [ + ...bowPools +] + + return await sumTokens({ owners, chain: 'kujira' }) +} + +module.exports = { + doublecounted: false, + kujira: { + tvl, + }, +} \ No newline at end of file diff --git a/projects/bprotocol/abi.json b/projects/bprotocol/abi.json index 9733ef6d6ec..d96aa587049 100644 --- a/projects/bprotocol/abi.json +++ b/projects/bprotocol/abi.json @@ -1,157 +1,11 @@ { - "cdpTvl": { - "constant": true, - "inputs": [ - { - "internalType": "contract BCdpManagerLike", - "name": "man", - "type": "address" - }, - { - "internalType": "uint256", - "name": "cdp", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "ilk", - "type": "bytes32" - } - ], - "name": "cdpTvl", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "cdpi": { - "constant": true, - "inputs": [ - { - "internalType": "contract BCdpManagerLike", - "name": "man", - "type": "address" - } - ], - "name": "cdpi", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "avatarLength": { - "constant": true, - "inputs": [], - "name": "avatarLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function", - "signature": "0x6a7d9ff9" - }, - "avatars": { - "constant": true, - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "avatars", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function", - "signature": "0x834d5fac" - }, - "getAllMarkets": { - "constant": true, - "inputs": [], - "name": "getAllMarkets", - "outputs": [ - { - "internalType": "contract CToken[]", - "name": "", - "type": "address[]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "balanceOfUnderlying": { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - } - ], - "name": "balanceOfUnderlying", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - "underlying": { - "constant": true, - "inputs": [], - "name": "underlying", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "bamms" : { - "inputs":[{"internalType":"uint256","name":"","type":"uint256"}], - "name":"bamms", - "outputs":[{"internalType":"address","name":"","type":"address"}], - "stateMutability":"view","type":"function" - }, - "getCompoundedLUSDDeposit" : { - "inputs":[{"internalType":"address","name":"_depositor","type":"address"}], - "name":"getCompoundedLUSDDeposit", - "outputs":[{"internalType":"uint256","name":"","type":"uint256"}], - "stateMutability":"view", - "type":"function" - } - -} + "cdpTvl": "function cdpTvl(address man, uint256 cdp, bytes32 ilk) view returns (uint256)", + "cdpi": "function cdpi(address man) view returns (uint256)", + "avatarLength": "uint256:avatarLength", + "avatars": "function avatars(uint256) view returns (address)", + "getAllMarkets": "address[]:getAllMarkets", + "balanceOfUnderlying": "function balanceOfUnderlying(address owner) returns (uint256)", + "underlying": "address:underlying", + "bamms": "function bamms(uint256) view returns (address)", + "getCompoundedLUSDDeposit": "function getCompoundedLUSDDeposit(address _depositor) view returns (uint256)" +} \ No newline at end of file diff --git a/projects/bprotocol/index.js b/projects/bprotocol/index.js index 02476b27f8e..8f5b6119651 100644 --- a/projects/bprotocol/index.js +++ b/projects/bprotocol/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') /*================================================== Modules ==================================================*/ @@ -22,17 +23,17 @@ const bKeeperAddress = "0xeaE019ef845A4Ffdb8829210De5D30aC6FbB5371"; const stabilityPoolAddress = "0x66017D22b0f8556afDd19FC67041899Eb65a21bb"; - const usdcEth = "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" - const usdcFantom = "0x04068DA6C83AFCFA0e13ba15A6696662335D5B75" - const usdcArbitrum = "0xff970a61a04b1ca14834a43f5de4533ebddb5cc8" + const usdcEth = ADDRESSES.ethereum.USDC + const usdcFantom = ADDRESSES.fantom.USDC + const usdcArbitrum = ADDRESSES.arbitrum.USDC - const daiEth = "0x6b175474e89094c44da98b954eedeac495271d0f" - const daiFantom = "0x8d11ec38a3eb5e956b052f67da8bdc9bef8abf3e" + const daiEth = ADDRESSES.ethereum.DAI + const daiFantom = ADDRESSES.fantom.DAI - const usdtEth = "0xdac17f958d2ee523a2206206994597c13d831ec7" - const usdtArbitrum = "0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9" + const usdtEth = ADDRESSES.ethereum.USDT + const usdtArbitrum = ADDRESSES.arbitrum.USDT - const fraxEth = "0x853d955aCEf822Db058eb8505911ED77F175b99e" + const fraxEth = ADDRESSES.ethereum.FRAX const usdcFantomBAMM = "0xEDC7905a491fF335685e2F2F1552541705138A3D" const daiFantomBAMM = "0x6d62d6Af9b82CDfA3A7d16601DDbCF8970634d22" @@ -58,7 +59,7 @@ ==================================================*/ async function compoundTvl(timestamp, block) { - if (block < cFirstBlock) return { '0x0000000000000000000000000000000000000000': '0' }; + if (block < cFirstBlock) return { [ADDRESSES.null]: '0' }; // number of accounts const { output: avatarLength } = await sdk.api.abi.call( @@ -101,7 +102,7 @@ // get the underlying token address const isCEth = cTokenAddress.toLowerCase() === "0x4ddc2d193948926d02f9b1fe9e1daa0718270ed5" const { output: token } = isCEth - ? { output: '0x0000000000000000000000000000000000000000' } // ETH has no underlying asset on Compound + ? { output: ADDRESSES.null } // ETH has no underlying asset on Compound : await sdk.api.abi.call( { block, @@ -141,7 +142,7 @@ } async function makerTvl(timestamp, block) { - if (block < mFirstBlock) return { '0x0000000000000000000000000000000000000000': '0' }; + if (block < mFirstBlock) return { [ADDRESSES.null]: '0' }; const cdpiRes = await sdk.api.abi.call( { @@ -166,13 +167,13 @@ let totalBalance = new BigNumber(0); ethBalances.forEach(balance => totalBalance = totalBalance.plus(new BigNumber(balance))); - const balances = { '0x0000000000000000000000000000000000000000': totalBalance.toString(10) }; + const balances = { [ADDRESSES.null]: totalBalance.toString(10) }; return balances } async function liquityTvl(timestamp, block) { - if (block < lFirstBlock) return { '0x5f98805A4E8be255a32880FDeC7F6728C6568bA0': '0' }; + if (block < lFirstBlock) return { [ADDRESSES.ethereum.LUSD]: '0' }; let totalBalance = new BigNumber(0); @@ -201,7 +202,7 @@ } // all balance is lusd - return {'0x5f98805A4E8be255a32880FDeC7F6728C6568bA0' : totalBalance.toString(10)} + return {[ADDRESSES.ethereum.LUSD]: totalBalance.toString(10)} } async function tvlEth(timestamp, block) { diff --git a/projects/brahmafi/batcher.json b/projects/brahmafi/batcher.json index e6d94c75a91..507f10c61e7 100644 --- a/projects/brahmafi/batcher.json +++ b/projects/brahmafi/batcher.json @@ -1,15 +1,3 @@ { - "pendingDeposit": { - "inputs": [], - "name": "pendingDeposit", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -} + "pendingDeposit": "uint256:pendingDeposit" +} \ No newline at end of file diff --git a/projects/brahmafi/erc4626.json b/projects/brahmafi/erc4626.json index b08601c512e..b92419174d9 100644 --- a/projects/brahmafi/erc4626.json +++ b/projects/brahmafi/erc4626.json @@ -1,28 +1,4 @@ { - "totalAssets": { - "inputs": [], - "name": "totalAssets", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "asset": { - "inputs": [], - "name": "asset", - "outputs": [ - { - "internalType": "contract ERC20", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } -} + "totalAssets": "uint256:totalAssets", + "asset": "address:asset" +} \ No newline at end of file diff --git a/projects/brahmafi/helper.js b/projects/brahmafi/helper.js index f8c71845cf8..2bc0378313e 100644 --- a/projects/brahmafi/helper.js +++ b/projects/brahmafi/helper.js @@ -26,7 +26,18 @@ const erc4626Vaults = [ }, ]; -const l1OnlyVaults = ["0xB3dA8d6Da3eDe239ccbF576cA0Eaa74D86f0e9D3"]; +const l1OnlyVaults = [ + { + address: "0xB3dA8d6Da3eDe239ccbF576cA0Eaa74D86f0e9D3", + isYieldGenerating: false, + chain: "ethereum", + }, + { + address: "0x4FE66bff98eFc030BdC86c733F481B089fb9DCFd", + isYieldGenerating: true, + chain: "polygon", + }, +]; const getTVLData = async (block) => { const vaultCalls = vaults.map((v) => ({ target: v.address })); @@ -83,27 +94,60 @@ const getVaultL1Funds = async (vault, wantToken, block) => { return totalExecutorFunds + +vaultBalance.output; }; -const getL1VaultOnlyFunds = async (block) => { - const vaultCalls = l1OnlyVaults.map((v) => ({ target: v })); +const getL1VaultOnlyFundsByChain = async (chain, block) => { + const vaults = l1OnlyVaults.filter(({ chain: _chain }) => chain === _chain); + + const vaultCalls = vaults.map(({ address }) => ({ target: address })); + + const yieldCalls = vaults + .filter(({ isYieldGenerating }) => isYieldGenerating) + .map(({ address }) => ({ target: address })); + const balances = {}; - const [_wantTokenAddresses, _totalVaultFunds] = await Promise.all([ + const [_vaultWantTokenAddresses, _totalVaultFunds] = await Promise.all([ sdk.api.abi.multiCall({ block, calls: vaultCalls, abi: vaultAbi.wantToken, + chain, }), sdk.api.abi.multiCall({ block, calls: vaultCalls, abi: vaultAbi.totalVaultFunds, + chain, }), ]).then((o) => o.map((it) => it.output)); + const [_yieldWantTokenAddresses, _lastEpochYields] = await Promise.all([ + sdk.api.abi.multiCall({ + block, + calls: yieldCalls, + abi: vaultAbi.wantToken, + chain, + }), + sdk.api.abi.multiCall({ + block, + calls: yieldCalls, + abi: vaultAbi.lastEpochYield, + chain, + }), + ]).then((o) => o.map((it) => it.output)); + + /// vault balances _totalVaultFunds.forEach((it, idx) => { sdk.util.sumSingleBalance( balances, - _wantTokenAddresses[idx].output, + _vaultWantTokenAddresses[idx].output, + it.output + ); + }); + /// last epoch yields + _lastEpochYields.forEach((it, idx) => { + sdk.util.sumSingleBalance( + balances, + _yieldWantTokenAddresses[idx].output, it.output ); }); @@ -167,5 +211,5 @@ module.exports = { getTVLData, getVaultL1Funds, getERC4626VaultFundsByChain, - getL1VaultOnlyFunds, + getL1VaultOnlyFundsByChain, }; diff --git a/projects/brahmafi/index.js b/projects/brahmafi/index.js index 65a273e45a0..05b5cf689df 100644 --- a/projects/brahmafi/index.js +++ b/projects/brahmafi/index.js @@ -3,7 +3,7 @@ const { getTVLData, getVaultL1Funds, getERC4626VaultFundsByChain, - getL1VaultOnlyFunds, + getL1VaultOnlyFundsByChain, } = require("./helper"); const { transformPolygonAddress } = require("../helper/portedTokens"); const MAX_BPS = 1e3; @@ -26,7 +26,7 @@ const ethTvl = async (_, block) => { sdk.util.sumSingleBalance(balances, wantToken, value.toFixed(0)); } - const l1OnlyVaultFunds = await getL1VaultOnlyFunds(block); + const l1OnlyVaultFunds = await getL1VaultOnlyFundsByChain("ethereum", block); for (const [wantToken, totalFunds] of Object.entries(l1OnlyVaultFunds)) { sdk.util.sumSingleBalance(balances, wantToken, totalFunds); @@ -40,9 +40,14 @@ const polygonTvl = async (_, _b, { polygon: block }) => { const transform = await transformPolygonAddress(); const vaultFunds = await getERC4626VaultFundsByChain("polygon", block); + const l1OnlyVaultFunds = await getL1VaultOnlyFundsByChain("polygon", block); + for (const { asset, funds } of vaultFunds) { sdk.util.sumSingleBalance(balances, transform(asset), funds); } + for (const [wantToken, totalFunds] of Object.entries(l1OnlyVaultFunds)) { + sdk.util.sumSingleBalance(balances, transform(wantToken), totalFunds); + } return balances; }; diff --git a/projects/brahmafi/tradeExecutor.json b/projects/brahmafi/tradeExecutor.json index f61a84d2fa3..708cc3faa55 100644 --- a/projects/brahmafi/tradeExecutor.json +++ b/projects/brahmafi/tradeExecutor.json @@ -1,20 +1,3 @@ { - "positionInWantToken": { - "inputs": [], - "name": "positionInWantToken", - "outputs": [ - { - "internalType": "uint256", - "name": "posValue", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastUpdatedBlock", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -} + "positionInWantToken": "function positionInWantToken() view returns (uint256 posValue, uint256 lastUpdatedBlock)" +} \ No newline at end of file diff --git a/projects/brahmafi/vault.json b/projects/brahmafi/vault.json index 6d7563849c5..1e54c69f041 100644 --- a/projects/brahmafi/vault.json +++ b/projects/brahmafi/vault.json @@ -1,47 +1,6 @@ { - "wantToken": { - "inputs": [], - "name": "wantToken", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "totalVaultFunds": { - "inputs": [], - "name": "totalVaultFunds", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "executorByIndex": { - "inputs": [ - { - "internalType": "uint256", - "name": "_index", - "type": "uint256" - } - ], - "name": "executorByIndex", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } + "wantToken": "address:wantToken", + "totalVaultFunds": "uint256:totalVaultFunds", + "executorByIndex": "function executorByIndex(uint256 _index) view returns (address)", + "lastEpochYield": "uint256:lastEpochYield" } diff --git a/projects/brainiac/index.js b/projects/brainiac/index.js index ecb4bfe6796..5ef9ecfb145 100644 --- a/projects/brainiac/index.js +++ b/projects/brainiac/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { compoundExports } = require('../helper/compound'); const { staking, sumTokensExport } = require('../helper/unknownTokens') @@ -19,7 +20,7 @@ const BRAINIAC_CKB_LP = '0xaa0f41e50dbfd8247fb397b1fffea1fea9f4e6d4' // params = comptroller , chain , brCKB , CKB module.exports = { - [chain]: compoundExports("0x5c68BDBba7151c486faCB66dc39b891030e46725", chain, "0x352d09567dE5A02415670723D09E006F623fE62e", "0x7538C85caE4E4673253fFd2568c1F1b48A71558a") + [chain]: compoundExports("0x5c68BDBba7151c486faCB66dc39b891030e46725", chain, "0x352d09567dE5A02415670723D09E006F623fE62e", ADDRESSES.godwoken_v1.pCKB) } module.exports[chain].staking = staking({ chain, useDefaultCoreAssets: true, owners: farms, tokens: [BRAINIAC], lps: [BRAINIAC_CKB_LP], }) diff --git a/projects/brewlabs/index.js b/projects/brewlabs/index.js new file mode 100644 index 00000000000..19854398771 --- /dev/null +++ b/projects/brewlabs/index.js @@ -0,0 +1,69 @@ +const { setCache } = require('../helper/cache') +const { sumUnknownTokens } = require('../helper/unknownTokens') +const { post } = require('../helper/http') +const sdk = require('@defillama/sdk') + +const chainsList = ["ethereum", "bsc", "polygon"]; +const api_endpoint = "https://api.nodes-brewlabs.info/api"; + +const chains = { + ethereum: 1, + bsc: 56, + polygon: 137, + cronos: 25, + fantom: 250, + avax: 43114, + bitgert: 32520, +}; +const blacklist = [ + "0x2f6ad7743924b1901a0771746152dde44c5f11de", + "0xfd6bc48f68136e7bf4ae1fb4b0c2e6911a50e18b", + "0xafbb5dafacea3cfe1001357449e2ea268e50f368", + "0x7db5af2b9624e1b3b4bb69d6debd9ad1016a58ac", +]; + +module.exports = { + timetravel: false, + misrepresentedTokens: true, +}; + +const data = { + pool2: {}, + staking: {}, +} + +async function getStakingPools(chain, poolType) { + if (!data[poolType][chain]) data[poolType][chain] = _getPools() + return data[poolType][chain] + + async function _getPools() { + const poolTypeStr = poolType === 'pool2' ? 'farms' : 'pools' + const pools = await post(`${api_endpoint}/${poolTypeStr}`, { chainId: chains[chain]}) + console.log(pools, `brewlabs ${chain} ${poolType} pools: ${pools.length}`) + setCache(`brewlabs/pools`, chain, pools) + return pools + } +} + +chainsList.forEach(chain => { + module.exports[chain] = { + // tvl: sdk.util.sumChainTvls([staking, pool2]), + tvl: () => 0, + pool2, + staking, + } +}) + +async function staking(_, _b, _cb, { api, }) { + const pools = await getStakingPools(api.chain, 'staking') + const tokensAndOwners = pools.map(i => ([i.stakingToken.address, i.contractAddress])) + return sumUnknownTokens({ api, tokensAndOwners, blacklist}) +} + +const poolInfoAbi = "function poolInfo(uint256) view returns (address lpToken, uint256, uint256, uint256, uint256, uint256, uint16, uint16)" + +async function pool2(_, _b, _cb, { api, }) { + const pools = (await getStakingPools(api.chain, 'pool2')) + const tokensAndOwners = pools.map((v, i) => ([v.lpAddress, v.contractAddress])) + return sumUnknownTokens({ api, tokensAndOwners, blacklist}) +} diff --git a/projects/bridge-mutual/abi.json b/projects/bridge-mutual/abi.json index fcc3914d18b..073067d8d61 100644 --- a/projects/bridge-mutual/abi.json +++ b/projects/bridge-mutual/abi.json @@ -1,71 +1,6 @@ { - "count": { - "inputs": [], - "name": "count", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "list": { - "inputs": [ - { - "internalType": "uint256", - "name": "offset", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "limit", - "type": "uint256" - } - ], - "name": "list", - "outputs": [ - { - "internalType": "address[]", - "name": "_policyBooksArr", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getShieldTokenAddress": { - "inputs": [ - { - "internalType": "address", - "name": "_policyBook", - "type": "address" - } - ], - "name": "getShieldTokenAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "virtualUsdtAccumulatedBalance": { - "inputs": [], - "name": "virtualUsdtAccumulatedBalance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -} + "count": "uint256:count", + "list": "function list(uint256 offset, uint256 limit) view returns (address[] _policyBooksArr)", + "getShieldTokenAddress": "function getShieldTokenAddress(address _policyBook) view returns (address)", + "virtualUsdtAccumulatedBalance": "uint256:virtualUsdtAccumulatedBalance" +} \ No newline at end of file diff --git a/projects/bridge-mutual/index.js b/projects/bridge-mutual/index.js index 0a8595a0ace..86d541ba070 100644 --- a/projects/bridge-mutual/index.js +++ b/projects/bridge-mutual/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); const { sumTokens2, sumTokensExport } = require('../helper/unwrapLPs') @@ -8,7 +9,7 @@ const config = { staking: ["0x81d73999fabec7e8355d76d1010afbe3068f08fa", "0x55978a6f6a4cfa00d5a8b442e93e42c025d0890c"], PolicyBookRegistry: "0xff13c3d2c7931e86e13c993a8cb02d68848f9613", ShieldMining: "0x6d6fCf279a63129797def89dBA82a65b3386497e", - usdt: "0xdac17f958d2ee523a2206206994597c13d831ec7", + usdt: ADDRESSES.ethereum.USDT, bmi: "0x725c263e32c72ddc3a19bea12c5a0479a81ee688", }, bsc: { @@ -16,7 +17,7 @@ const config = { staking: ["0x8be37f9bb9b09cf89774c103c52d1e660398a7b3"], PolicyBookRegistry: "0xab7c7356f706954c3c926a690e96c7b65fa76116", ShieldMining: "0xcc75bf59969e8362d064536fd941a541f81abe56", - usdt: "0x55d398326f99059fF775485246999027B3197955", + usdt: ADDRESSES.bsc.USDT, bmi: "0xb371f0eb8dfb3b47fdfc23bbcbc797954d3d4f23", }, polygon: { @@ -24,7 +25,7 @@ const config = { staking: ["0xcfdb12299c2d0111ae1cee23337e9156deabfbf5"], PolicyBookRegistry: "0xab7c7356f706954c3c926a690e96c7b65fa76116", ShieldMining: "0xde52f95ea3373fab1deefde56d35fa1dacd83e99", - usdt: "0xc2132d05d31c914a87c6611c10748aeb04b58e8f", + usdt: ADDRESSES.polygon.USDT, bmi: "0xa10facae1abac4fae6312c615a9c3fd56075be1a", }, } diff --git a/projects/bright-union/abi.json b/projects/bright-union/abi.json index 9dac06d2abf..11f18e61dd4 100644 --- a/projects/bright-union/abi.json +++ b/projects/bright-union/abi.json @@ -1,16 +1,3 @@ { - "totalTVL": { - "inputs": [], - "name": "totalTVL", - "outputs": [ - { - "internalType": "uint256", - "name": "_tvl", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function", - "constant": true - } -} + "totalTVL": "uint256:totalTVL" +} \ No newline at end of file diff --git a/projects/bright-union/index.js b/projects/bright-union/index.js index e97c8f88b83..854af6f884c 100644 --- a/projects/bright-union/index.js +++ b/projects/bright-union/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); const {staking} = require('../helper/staking') @@ -11,7 +12,7 @@ const BrightLPStaking = ["0x160c43821004Cb76C7e9727159dD64ab8468f61C"]; //UNIV2 const ETH_BRIGHT_UNIV2 = "0xf4835af5387fab6bbc59f496cbcfa92998469b7b"; -const DAI = "0x6b175474e89094c44da98b954eedeac495271d0f" +const DAI = ADDRESSES.ethereum.DAI async function tvl (timestamp, block) { return { diff --git a/projects/brightside/index.js b/projects/brightside/index.js new file mode 100644 index 00000000000..d2d2d91d7d9 --- /dev/null +++ b/projects/brightside/index.js @@ -0,0 +1,10 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports = { + misrepresentedTokens: true, + milkomeda_a1: { + tvl: getUniTVL({ + factory: '0x65be76efd12e7932bcd99acfefb8d531ec4f7e0d', useDefaultCoreAssets: true, + }) + }, +}; \ No newline at end of file diff --git a/projects/brinc/index.js b/projects/brinc/index.js index ab54b960016..4fdceccc955 100644 --- a/projects/brinc/index.js +++ b/projects/brinc/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { stakingPricedLP } = require('../helper/staking') const {sumTokensAndLPsSharedOwners} = require('../helper/unwrapLPs') const { transformArbitrumAddress } = require("../helper/portedTokens"); @@ -10,7 +11,7 @@ async function tvl(time, ethBlock, chainBlocks){ const balances = {}; const transformAddress = await transformArbitrumAddress(); await sumTokensAndLPsSharedOwners(balances, [ - ["0xda10009cbd5d07dd0cecc66161fc93d7c9000da1", false], //dai + [ADDRESSES.optimism.DAI, false], //dai ], [treasury], chainBlocks.arbitrum, "arbitrum", transformAddress) return balances diff --git a/projects/brine/index.js b/projects/brine/index.js new file mode 100644 index 00000000000..357951e7a19 --- /dev/null +++ b/projects/brine/index.js @@ -0,0 +1,18 @@ +const ADDRESSES = require("../helper/coreAssets.json"); +const { sumTokensExport } = require("../helper/unwrapLPs"); + +const contracts = ["0x1390f521A79BaBE99b69B37154D63D431da27A07"]; + +const tokens = [ + ADDRESSES.null, + ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.USDT, + ADDRESSES.ethereum.WBTC, + ADDRESSES.ethereum.MATIC, + '0xB50721BCf8d664c30412Cfbc6cf7a15145234ad1' +]; + +module.exports = { + start: 1685817000, + ethereum: { tvl: sumTokensExport({ owners: contracts, tokens, }) }, +}; diff --git a/projects/brise-swap/index.js b/projects/brise-swap/index.js index 2271e4dd50e..3945c1cd3e6 100644 --- a/projects/brise-swap/index.js +++ b/projects/brise-swap/index.js @@ -4,7 +4,6 @@ module.exports = { misrepresentedTokens: true, bitgert: { tvl: getUniTVL({ - chain: 'bitgert', factory: '0x1379a7f0bfc346d48508B4b162c37a4c43dd89dc', useDefaultCoreAssets: true, }), diff --git a/projects/brokkr/index.js b/projects/brokkr/index.js new file mode 100644 index 00000000000..b1f3ef28116 --- /dev/null +++ b/projects/brokkr/index.js @@ -0,0 +1,58 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokens2 } = require('../helper/unwrapLPs') +const INDEX_TOKEN_CONTRACT = { 'avax': '0xB0E2880D4429d10eF1956062B260aDf09557A1da' } +const USDC_TOKEN_CONTRACT = ADDRESSES.avax.USDC +const CALM_PORTFOLIO_CONTRACT = '0x2eAf73F8E6BCf606f56E5cf201756C1f0565C068' +const AMBITIOUS_PORTFOLIO_CONTRACT = '0x0294D02e9Fee4872e72697e9514aD0be671DB498' +const DCA_PORTFOLIO_CONTRACTS = { + 'avax': [ + "0xBbE9f28182163e767AA17072eDbeccD19DE12AE3", + "0xF96Df0DB82Ebec3F5e8043C26522608f09c68600", + "0x6e25e57B0Dc35eFe3688c2850568Ff59931d1182", + "0x53f14744F15365a0323B4FF0693E9190fFBE4B62", + "0xBAff4c732634b929033917E5dF30A52EFee554ff", + "0xf7df7AC55F06892f52Bfe62311434bC3B9647c89" + ] +} + +async function tvl(_, _1, _2, { api }) { + const indexToken = INDEX_TOKEN_CONTRACT[api.chain] + const dcas = DCA_PORTFOLIO_CONTRACTS[api.chain] + const ownerTokens = [] + if (indexToken) { + const tokens = await api.call({ abi: "address[]:allComponents", target: indexToken }) + ownerTokens.push([tokens, indexToken]) + } + if (dcas) { + const depositTokens = await api.multiCall({ abi: 'address:depositToken', calls: dcas }) + const eqTokenInfo = await api.multiCall({ abi: 'function equityValuation() view returns (tuple(uint256,uint256,address)[])', calls: dcas }) + eqTokenInfo.forEach((v, i) => { + const tokens = v.map(j => j[2]) + tokens.push(depositTokens[i]) + ownerTokens.push([tokens, dcas[i]]) + }) + } + if (api.chain == "avax") { + await addEquityValuationToBalances(CALM_PORTFOLIO_CONTRACT, api) + await addEquityValuationToBalances(AMBITIOUS_PORTFOLIO_CONTRACT, api) + } + return sumTokens2({ api, ownerTokens, }) +} + +async function addEquityValuationToBalances(address, api) { + var usdc_balance = await api.call({ + target: address, + abi: "function getEquityValuation(bool startIndex_, bool endIndex_) view returns (uint256)", + params: [true, false], + }) + api.add(USDC_TOKEN_CONTRACT, usdc_balance) +} + + +module.exports = { + start: 1554848955, // 04/09/2019 @ 10:29pm (UTC) + doublecounted: true, + avax: { + tvl, + } +}; \ No newline at end of file diff --git a/projects/bscstation/abi.json b/projects/bscstation/abi.json index 20381ef9356..eaeb66eebc0 100644 --- a/projects/bscstation/abi.json +++ b/projects/bscstation/abi.json @@ -1,15 +1,3 @@ { - "stakedToken": { - "inputs": [], - "name": "stakedToken", - "outputs": [ - { - "internalType": "contract ERC20", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } + "stakedToken": "address:stakedToken" } \ No newline at end of file diff --git a/projects/btcst/index.js b/projects/btcst/index.js index 1a723897286..7f3c3f51725 100644 --- a/projects/btcst/index.js +++ b/projects/btcst/index.js @@ -1,8 +1,8 @@ -const { staking, stakings } = require("../helper/staking"); +const ADDRESSES = require('../helper/coreAssets.json') +const { stakings } = require("../helper/staking"); const { transformBscAddress } = require("../helper/portedTokens"); const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); -const treasuryContract = "0xAd3784cD071602d6c9c2980d8e0933466C3F0a0a"; const BTCST = "0x78650B139471520656b9E7aA7A5e9276814a38e9"; const vaultContracts = [ @@ -22,7 +22,7 @@ const vaultContracts = [ const listOfTokens = [ //BTCB - "0x7130d2a12b9bcbfae4f2634d864a1ee1ce3ead9c", + ADDRESSES.bsc.BTCB, //sigmaBTC "0x2cd1075682b0fccaadd0ca629e138e64015ba11c", //sigmaDOGE @@ -31,10 +31,6 @@ const listOfTokens = [ "0xba2ae424d960c26247dd6c32edc70b295c744c43", ]; -async function Treasury(...params) { - return staking(treasuryContract, BTCST, "bsc")(...params); -} - async function bscTvl(chainBlocks) { const balances = {}; @@ -56,7 +52,6 @@ async function bscTvl(chainBlocks) { module.exports = { misrepresentedTokens: true, bsc: { - treasury: Treasury, staking: stakings(vaultContracts, BTCST, "bsc"), tvl: bscTvl, }, diff --git a/projects/bubbleswap-v2/index.js b/projects/bubbleswap-v2/index.js new file mode 100644 index 00000000000..9c46e6795ff --- /dev/null +++ b/projects/bubbleswap-v2/index.js @@ -0,0 +1,25 @@ +const { default: axios } = require('axios'); + +async function fetch(){ + + const response = await axios.get('https://api.bubbleswap.io/v2/backend/api/v1/tvl', { + headers: { + //I would prefer the user agengt to be set to something like axios, or DefiLlama, but our WAF only allows the bellow + 'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36' + } + }) + return response.data.data.sumTVL + +} + +module.exports = { + hedera: { + tvl: () => ({}), + }, + timetravel: false, + methodology: "Data is retrieved from the api at https://api.bubbleswap.io/", + hallmarks: [ + [1683288000, "V2 Launch"], + [Math.floor(new Date('2023-07-01')/1e3), 'Project shutdown'], + ] +} \ No newline at end of file diff --git a/projects/bubbleswap/index.js b/projects/bubbleswap/index.js index 7056bbef330..1d90435596e 100644 --- a/projects/bubbleswap/index.js +++ b/projects/bubbleswap/index.js @@ -1,34 +1,9 @@ -const { default: axios } = require('axios'); -async function fetch(){ - - const response = await axios.get('https://api.bubbleswap.io/analytics/api/v1/analytics/aggregate/liquidity/year', { - headers: { - //I would prefer the user agengt to be set to something like axios, or DefiLlama, but our WAF only allows the bellow - 'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36' - } - }); - - if(!response?.data?.ok - || !response?.data?.data - || !Array.isArray(response?.data?.data) - || !response?.data?.data?.length > 0) { - - return null; - - } - - const lastItem = response.data.data[response.data.data.length - 1]; - - if(isNaN(lastItem[1])){ - return null; - } - - return Number(lastItem[1]); - -} - module.exports = { - methodology: "Data is retrieved from the api at https://analytics.bubbleswap.io/", - timetravel: false, - fetch + fetch: () => 0, + timetravel: false, + methodology: "Data is retrieved from the api at https://api.bubbleswap.io", + hallmarks: [ + [1666569600, "Start V1 Rewards"], + [1683813600, "V1 Deprecation"], + ] } \ No newline at end of file diff --git a/projects/bucket-protocol/index.js b/projects/bucket-protocol/index.js new file mode 100644 index 00000000000..ced7ee1722f --- /dev/null +++ b/projects/bucket-protocol/index.js @@ -0,0 +1,26 @@ +const sui = require("../helper/chain/sui"); + +const MAINNET_PROTOCOL_ID = + "0x9e3dab13212b27f5434416939db5dec6a319d15b89a84fd074d03ece6350d3df"; + +async function tvl(_, _1, _2, { api }) { + const protocolFields = await sui.getDynamicFieldObjects({ + parent: MAINNET_PROTOCOL_ID, + }); + + const bucketList = protocolFields.filter((item) => + item.type.includes("Bucket") + ); + + for (const bucket of bucketList) { + const coin = bucket.type.split("<").pop()?.replace(">", "") ?? ""; + api.add(coin, bucket.fields.collateral_vault); + } +} + +module.exports = { + timetravel: false, + sui: { + tvl, + }, +}; diff --git a/projects/buffer/index.js b/projects/buffer/index.js index 4272b2f6b63..f95bfa69d43 100644 --- a/projects/buffer/index.js +++ b/projects/buffer/index.js @@ -1,32 +1,52 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { staking } = require("../helper/staking"); -const { sumTokens2, nullAddress, } = require("../helper/unwrapLPs"); +const { sumTokensExport } = require("../helper/unwrapLPs"); const tokens = { - IBFR: "0xa296aD1C47FE6bDC133f39555C1D1177BD51fBc5", BFR: "0x1A5B0aaF478bf1FDA7b934c76E7692D722982a6D", - USDC: "0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8" + USDC_ARB: ADDRESSES.arbitrum.USDC, + USDC_POLY: ADDRESSES.polygon.USDC, + ARB: ADDRESSES.arbitrum.ARB }; const contracts = { - ARBI_POOL: "0x37Cdbe3063002383B2018240bdAFE05127d36c3C", - ARBI_POOL_V2: "0x4d338bc1a2380752736718f49bd45d9a040fdff8", - ARBI_STAKING: "0x173817F33f1C09bCb0df436c2f327B9504d6e067", - BSC_STAKING: "0xE6C2cDD466Eb1Fa6bDFDb8af1BD072d4A57734C2", - BSC_POOL: "0x7338ee5535F1E0f1a210a6Ef6dB34f5357EB9860", -} + USDC_POOL_V1: "0x37Cdbe3063002383B2018240bdAFE05127d36c3C", + USDC_POOL_V2: "0x4d338bc1a2380752736718f49bd45d9a040fdff8", + USDC_POOL_V3: "0x6Ec7B10bF7331794adAaf235cb47a2A292cD9c7e", + USDC_POOL_V4: "0xfD9f8841C471Fcc55f5c09B8ad868BdC9eDeBDE1", + POLY_POOL_V1: "0x6FD5B386d8bed29b3b62C0856250cdD849b3564d", + ARB_POOL_V1: "0xaE0628C88EC6C418B3F5C005f804E905f8123833", + BFR_STAKING: "0x173817F33f1C09bCb0df436c2f327B9504d6e067" +}; module.exports = { - methodology: `Uniswap pool / USDC vault that acts as counterparty to all trades placed on the platform. Staking BFR for revenue share. No staking has any double counting`, - bsc: { - staking: staking(contracts.BSC_STAKING, tokens.IBFR, 'bsc'), - tvl: async (_, _b, {bsc: block}) => sumTokens2({ chain: 'bsc', block, tokens: [nullAddress], owner: contracts.BSC_POOL}), - }, arbitrum: { - staking: staking(contracts.ARBI_STAKING, tokens.BFR, 'arbitrum'), - tvl: async (_, _b, {arbitrum: block}) => sumTokens2({ chain: 'arbitrum', block, tokens: [tokens.USDC], owners: [contracts.ARBI_POOL, contracts.ARBI_POOL_V2]}), + staking: staking(contracts.BFR_STAKING, tokens.BFR), + tvl: sumTokensExport({ + tokens: [tokens.USDC_ARB, tokens.ARB], + owners: [ + contracts.USDC_POOL_V1, + contracts.USDC_POOL_V2, + contracts.USDC_POOL_V3, + contracts.ARB_POOL_V1, + contracts.USDC_POOL_V4 + ] + }) + }, + polygon: { + tvl: sumTokensExport({ + tokens: [tokens.USDC_POLY], + owners: [contracts.POLY_POOL_V1] + }) }, hallmarks: [ - [Math.floor(new Date('2022-09-29')/1e3), 'Migrate to Arbitrum'], - [Math.floor(new Date('2022-10-26')/1e3), 'Shifted to POL pool'], - ], + [Math.floor(new Date("2022-10-26") / 1e3), "Shifted to USDC POL pool"], + [ + Math.floor(new Date("2023-01-30") / 1e3), + "Opened USDC BLP pool to the public" + ], + [Math.floor(new Date("2023-02-22") / 1e3), "Added a USDC Pool on polygon"], + [Math.floor(new Date("2023-03-22") / 1e3), "Added ARB Pool"], + [Math.floor(new Date("2023-04-14") / 1e3), "Added USDC Protocol owned liquidity Pool"], + ] }; diff --git a/projects/bullionFX/index.js b/projects/bullionFX/index.js new file mode 100644 index 00000000000..4cabfa54185 --- /dev/null +++ b/projects/bullionFX/index.js @@ -0,0 +1,3 @@ +const { uniTvlExport } = require('../helper/unknownTokens') + +module.exports = uniTvlExport('ethereum', '0x5E7CfE3DB397d3DF3F516d79a072F4C2ae5f39bb') \ No newline at end of file diff --git a/projects/bullish/index.js b/projects/bullish/index.js deleted file mode 100644 index 6ebbd5c85eb..00000000000 --- a/projects/bullish/index.js +++ /dev/null @@ -1,20 +0,0 @@ -const { get_account_tvl } = require("../helper/chain/eos"); - -const accounts = [ - "bullishfunds", // deposit account - "j4obibe5lfv1", // cold account - "vbdoctdtpwb1", // withdraw account -]; - -// Bullish -// https://bullish.com -async function eos() { - return await get_account_tvl(accounts, [["eosio.token", "EOS", "eos"]]); -} - -module.exports = { - methodology: `Bullish TVL is achieved by querying token balances from Bullish funds account.`, - eos: { - tvl: eos - }, -} diff --git a/projects/bumper/index.js b/projects/bumper/index.js index 49c908e40e1..6c5b8024d70 100644 --- a/projects/bumper/index.js +++ b/projects/bumper/index.js @@ -1,22 +1,28 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk') -const USDC = "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" +const USDC = ADDRESSES.ethereum.USDC const contract = "0xBabeE6d5F6EDD301B5Fae591a0D61AB702b359d0" -const currentTvlAbi = {"inputs":[],"name":"currentTVL","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"} -async function tvl(time, block){ +async function tvl(time, block) { return { - [USDC]:(await sdk.api.abi.call({ + [USDC]: (await sdk.api.abi.call({ target: contract, block, - abi: currentTvlAbi + abi: 'uint256:currentTVL' })).output } } -module.exports={ +module.exports = { methodology: `Count the USDC that has been deposited on ${contract}`, - ethereum:{ + ethereum: { tvl, - masterchef: tvl }, -} \ No newline at end of file + hallmarks: [ + [1626264000, "LP Program Starts"], + [1634212800, "LP Program Ended"], + [1639656000, "Uniswap V3 Listing and Staking v1 Program starts"], + [1658318400, "Alpha Testing"], + [1677672000, "Uniswap V2 Listing and Liquidity Mining Program"], + ] +} diff --git a/projects/bunicorn/index.js b/projects/bunicorn/index.js index 1981e07cbd4..538e54a77b6 100644 --- a/projects/bunicorn/index.js +++ b/projects/bunicorn/index.js @@ -2,7 +2,6 @@ const BigNumber = require("bignumber.js"); const { toUSDTBalances } = require("../helper/balances"); const sdk = require("@defillama/sdk"); const { request, gql } = require("graphql-request"); - const tokenSubgraphUrl = "https://api.thegraph.com/subgraphs/name/bunicorndefi/buni-token"; const stableSubgraphUrl = @@ -12,23 +11,11 @@ const MASTERCHEF_CONTRACT_ADDRESS = "0xA12c974fE40ea825E66615bA0Dc4Fd19be4D7d24"; const graphTotalTokenTVLQuery = gql` - query GET_TOTAL_TOKEN_TVL($block: Int) { - bunis(where: { id: 1 }, block: { number: $block }) { - totalLiquidity - } - } +{\n bunis(where: {id: \"1\"}) {\n totalLiquidity\n }\n} `; const graphTotalStableTVLQuery = gql` - query GET_TOTAL_STABLE_TVL($block: Int) { - buniCornFactories( - where: { id: "0x86873f85bc12ce40321340392c0ff39c3bdb8d68" } - block: { number: $block } - ) { - id - totalLiquidityUSD - } - } +{\n buniCornFactories( where: {id: \"0x86873f85bc12ce40321340392c0ff39c3bdb8d68\"}) {\n id\n totalLiquidityUSD\n }\n\n} `; async function getTotalFarmTVL(timestamp, ethBlock, chainBlocks) { @@ -50,19 +37,16 @@ async function getTotalFarmTVL(timestamp, ethBlock, chainBlocks) { throw new Error("getTotalFarmTVL has exception:" + e.message); } } - async function getTotalTokenTVL(timestamp, ethBlock, chainBlocks) { try { const { bunis } = await request(tokenSubgraphUrl, graphTotalTokenTVLQuery, { block: chainBlocks.bsc, }); - return (bunis[0] && bunis[0].totalLiquidity) || 0; } catch (e) { throw new Error("getTotalTokenTVL has exception:" + e.message); } } - async function getTotalStableTVL(timestamp, ethBlock, chainBlocks) { try { const { buniCornFactories } = await request( @@ -72,7 +56,6 @@ async function getTotalStableTVL(timestamp, ethBlock, chainBlocks) { block: chainBlocks.bsc, } ); - return ( (buniCornFactories[0] && buniCornFactories[0].totalLiquidityUSD) || 0 ); @@ -80,16 +63,13 @@ async function getTotalStableTVL(timestamp, ethBlock, chainBlocks) { throw new Error("getTotalStableTVL has exception:" + e.message); } } - async function getTotalTVL(timestamp, ethBlock, chainBlocks) { const [tokensSummary, stableSummary] = await Promise.all([ getTotalTokenTVL(timestamp, ethBlock, chainBlocks), getTotalStableTVL(timestamp, ethBlock, chainBlocks), ]); - return toUSDTBalances(new BigNumber(tokensSummary).plus(stableSummary)); } - module.exports = { misrepresentedTokens: true, bsc: { diff --git a/projects/bunni/index.js b/projects/bunni/index.js new file mode 100644 index 00000000000..a27e1140f1c --- /dev/null +++ b/projects/bunni/index.js @@ -0,0 +1,66 @@ +const sdk = require('@defillama/sdk'); +const { getLogs } = require('../helper/cache/getLogs') + +const config = { + ethereum: { + lens: '0xb73f303472c4fd4ff3b9f59ce0f9b13e47fbfd19', + factory: '0xb5087f95643a9a4069471a28d32c569d9bd57fe4', + fromBlock: 15743582, + }, + arbitrum: { + lens: '0xb73f303472c4fd4ff3b9f59ce0f9b13e47fbfd19', + factory: '0xb5087f95643a9a4069471a28d32c569d9bd57fe4', + fromBlock: 30690986, + }, + optimism: { + lens: '0xb73f303472c4fd4ff3b9f59ce0f9b13e47fbfd19', + factory: '0xb5087f95643a9a4069471a28d32c569d9bd57fe4', + fromBlock: 29258949, + }, + polygon: { + lens: '0xb73f303472c4fd4ff3b9f59ce0f9b13e47fbfd19', + factory: '0xb5087f95643a9a4069471a28d32c569d9bd57fe4', + fromBlock: 34323928, + }, +} + +module.exports = { + doublecounted: true, + hallmarks: [ + [1674475200,"$oLIT Rewards Start"] + ], +}; + +const abi = 'function getReserves(tuple(address pool, int24 tickLower, int24 tickUpper) key) view returns (uint112 reserve0, uint112 reserve1)' +const eventAbi = 'event NewBunni (address indexed token, bytes32 indexed bunniKeyHash, address indexed pool, int24 tickLower, int24 tickUpper)' + +Object.keys(config).forEach(chain => { + const { lens, fromBlock, factory } = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const balances = {} + const logs = await getLogs({ + api, + target: factory, + topics: ['0xa633a76553e9d8d77256f9284d85ae2eb5e5ef445d9e5686e3e6270e2e8fd4a8'], + fromBlock, + eventAbi, + }) + const calls = logs.map(({ args: i }) => ({ params: [[i.pool, i.tickLower, i.tickUpper]] })) + const res = await api.multiCall({ abi, calls, target: lens }) + let tokenCalls = [] + let reserves = res.filter((val, i) => { + if (!(+val.reserve0 || +val.reserve1)) return; // ignore tokens without reserve + tokenCalls.push(logs[i].args.pool) + return val + }) + let token0s = await api.multiCall({ abi: 'address:token0', calls: tokenCalls }) + let token1s = await api.multiCall({ abi: 'address:token1', calls: tokenCalls }) + reserves.forEach(({ reserve0, reserve1 }, i) => { + sdk.util.sumSingleBalance(balances, token0s[i], reserve0, chain) + sdk.util.sumSingleBalance(balances, token1s[i], reserve1, chain) + }) + return balances + } + } +}) diff --git a/projects/bunny/abi.json b/projects/bunny/abi.json deleted file mode 100644 index b99c7d2b86b..00000000000 --- a/projects/bunny/abi.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "inputs": [ - { - "internalType": "address", - "name": "pool", - "type": "address" - } - ], - "name": "tvlOfPool", - "outputs": [ - { - "internalType": "uint256", - "name": "tvl", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" -} \ No newline at end of file diff --git a/projects/bunny/index.js b/projects/bunny/index.js index 8799f888620..2e3f262678c 100644 --- a/projects/bunny/index.js +++ b/projects/bunny/index.js @@ -1,7 +1,7 @@ const sdk = require('@defillama/sdk') -const abi = require('./abi.json') -const potABI = require('./pot_abi.json') -const leverageABI = require('./leverage_abi.json') +const abi = 'function tvlOfPool(address pool) view returns (uint256 tvl)' +const potABI = "uint256:totalValueInUSD" +const leverageABI = 'function getVaultState() view returns (tuple(uint256 balance, uint256 tvl, uint256 debtRatioLimit))' const BigNumber = require('bignumber.js') const dashboard = '0xb3C96d3C3d643c2318E4CDD0a9A48aF53131F5f4' diff --git a/projects/bunny/leverage_abi.json b/projects/bunny/leverage_abi.json deleted file mode 100644 index 9192bee0e8e..00000000000 --- a/projects/bunny/leverage_abi.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "inputs": [], - "name": "getVaultState", - "outputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "balance", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "tvl", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "debtRatioLimit", - "type": "uint256" - } - ], - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" -} \ No newline at end of file diff --git a/projects/bunny/pot_abi.json b/projects/bunny/pot_abi.json deleted file mode 100644 index 0c41dc7158f..00000000000 --- a/projects/bunny/pot_abi.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "inputs": [], - "name": "totalValueInUSD", - "outputs": [ - { - "internalType": "uint256", - "name": "valueInUSD", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" -} diff --git a/projects/bunnypark/index.js b/projects/bunnypark/index.js index 62dfd8ce8f8..df458fa9342 100644 --- a/projects/bunnypark/index.js +++ b/projects/bunnypark/index.js @@ -1,5 +1,5 @@ -const sdk = require("@defillama/sdk"); -const { addFundsInMasterChef } = require("../helper/masterchef"); +const { staking } = require('../helper/staking') +const { masterchefExports } = require('../helper/unknownTokens') const bp = "0xACB8f52DC63BB752a51186D1c55868ADbFfEe9C1"; const masterchef = "0x6148104d39924f071DF05eeb2f6AEB53F7b2EFE7"; @@ -7,34 +7,5 @@ const stakingPools = [ "0x8a8389D174081E585983DAB7189ea1Cf18F11896", "0xE051C61baBa59Fd9d184a26F15BE4361027c9916" ] -const poolInfo = {"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"poolInfo","outputs":[{"internalType":"contract IBEP20","name":"lpToken","type":"address"},{"internalType":"uint256","name":"lpSupply","type":"uint256"},{"internalType":"uint256","name":"allocPoint","type":"uint256"},{"internalType":"uint256","name":"lastRewardBlock","type":"uint256"},{"internalType":"uint256","name":"accBPPerShare","type":"uint256"}],"stateMutability":"view","type":"function"}; - -async function tvl(timestamp, block, chainBlocks) { - let balances = {}; - await addFundsInMasterChef(balances, masterchef, chainBlocks.bsc, "bsc", addr=>`bsc:${addr}`, poolInfo); - return balances; -} - -async function staking(timestamp, block, chainBlocks) { - let balances = {}; - let stakingBalance = (await sdk.api.abi.multiCall({ - calls: stakingPools.map(p => ({ - target: bp, - params: p - })), - abi: "erc20:balanceOf", - block : chainBlocks.bsc, - chain: "bsc" - })).output; - stakingBalance.forEach(e => { - sdk.util.sumSingleBalance(balances, `bsc:${bp}`, e.output); - }) - return balances; -} - -module.exports = { - bsc: { - tvl, - staking - } -} \ No newline at end of file +module.exports = masterchefExports({ chain: 'bsc', nativeToken: bp, masterchef, blacklistedTokens: ['0xe0f2df595207c392e13df940c7908a222b22747c'] }) +module.exports.bsc.staking = staking(stakingPools, bp) diff --git a/projects/burgerswap/abi.json b/projects/burgerswap/abi.json index 24637a69ff2..5cbec109bcb 100644 --- a/projects/burgerswap/abi.json +++ b/projects/burgerswap/abi.json @@ -1,103 +1,5 @@ { - "poolInfo": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "poolInfo", - "outputs": [ - { - "internalType": "uint256", - "name": "pid", - "type": "uint256" - }, - { - "internalType": "contract IERC20", - "name": "depositToken", - "type": "address" - }, - { - "internalType": "contract IERC20", - "name": "earnToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "allocPoint", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastUpdateBlock", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastRewardAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastEarnAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accRewardPerShare", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accEarnPerShare", - "type": "uint256" - }, - { - "internalType": "uint16", - "name": "tokenType", - "type": "uint16" - }, - { - "internalType": "bool", - "name": "added", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - "poolLength": { - "inputs": [], - "name": "poolLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getDepositTokenSupply": { - "inputs": [ - { - "internalType": "uint256", - "name": "_pid", - "type": "uint256" - } - ], - "name": "getDepositTokenSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } + "poolInfo": "function poolInfo(uint256) view returns (uint256 pid, address depositToken, address earnToken, uint256 allocPoint, uint256 lastUpdateBlock, uint256 lastRewardAmount, uint256 lastEarnAmount, uint256 accRewardPerShare, uint256 accEarnPerShare, uint16 tokenType, bool added)", + "poolLength": "uint256:poolLength", + "getDepositTokenSupply": "function getDepositTokenSupply(uint256 _pid) view returns (uint256)" } \ No newline at end of file diff --git a/projects/burgerswap/index.js b/projects/burgerswap/index.js index 1a0be7cfe3f..f48dd91cfe6 100644 --- a/projects/burgerswap/index.js +++ b/projects/burgerswap/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); const { getUniTVL } = require('../helper/unknownTokens') @@ -7,7 +8,7 @@ const stakingContract = "0x9154c2684aeF8d106babcB19Aa81d4FabF7581ec"; const BURGER = "0xae9269f27437f0fcbc232d39ec814844a51d6b8f"; const Factory = "0x8a1E9d3aEbBBd5bA2A64d3355A48dD5E9b511256"; -const WBNB = "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c"; +const WBNB = ADDRESSES.bsc.WBNB; const shackChef = "0x07dE034A0Fc0DA7a0bf703F6DcA7025bcD61BA3e"; diff --git a/projects/burrow.cash/index.js b/projects/burrow.cash/index.js index 5d70ed86c31..3951f06d8e8 100644 --- a/projects/burrow.cash/index.js +++ b/projects/burrow.cash/index.js @@ -18,7 +18,7 @@ function tvl(borrowed = false) { return balances; } -}; +} module.exports = { near: { diff --git a/projects/business-builders-nfts/index.js b/projects/business-builders-nfts/index.js new file mode 100644 index 00000000000..7c11f30ee6a --- /dev/null +++ b/projects/business-builders-nfts/index.js @@ -0,0 +1,21 @@ +const { sumTokensExport } = require("../helper/unknownTokens"); + +const METER_FTB_CONTRACT = "0x6cfe9adad5215195c1aa9755daed29360e6ab986"; +const METER_REWARDS_CONTRACT = "0x103ed6fb861a2651ff59f0852d3739c18d45cd9b"; +const METER_FTB_MTRG_CONTRACT = "0x88cdb3e764dedcc2e3a1642957ebd513765b252a"; + +const POLYGON_FTB_CONTRACT = "0xF305012EA754252184f1071C86ae99fAc5B40320"; +const POLYGON_REWARDS_CONTRACT = "0x0455e50b2822e6f3d8dc01246aca8378a8992466"; +const POLYGON_FTB_MATIC_CONTRACT = "0x1Df39b565652eACa24dfB16A07dcfe4d7f8f02c3"; + +module.exports = { + misrepresentedTokens: true, + meter: { + staking: sumTokensExport({ owner: METER_REWARDS_CONTRACT, tokens:[METER_FTB_CONTRACT,], useDefaultCoreAssets: true, lps: [METER_FTB_MTRG_CONTRACT] }), + }, + polygon: { + staking: sumTokensExport({ owner: POLYGON_REWARDS_CONTRACT, tokens:[POLYGON_FTB_CONTRACT,], useDefaultCoreAssets: true, lps: [POLYGON_FTB_MATIC_CONTRACT] }), + tvl: () => 0, + }, + methodology: `Staking: we include locked tokens on the rewards contracts as staking`, +}; diff --git a/projects/butternetwork/index.js b/projects/butternetwork/index.js new file mode 100644 index 00000000000..b482ea84d9f --- /dev/null +++ b/projects/butternetwork/index.js @@ -0,0 +1,66 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require('../helper/sumTokens') + +const config = { + bsc: { + mosContract: "0x630105189c7114667a7179aa57f07647a5f42b7f", + tokens: { + USDT: ADDRESSES.bsc.USDT, + USDC: ADDRESSES.bsc.USDC, + DAI: "0x1af3f329e8be154074d8769d1ffa4ee058b1dbc3", + ETH: ADDRESSES.bsc.ETH, + // MAP: "0x8105ECe4ce08B6B6449539A5db23e23b973DfA8f" + } + }, + polygon: { + mosContract: "0x630105189c7114667a7179aa57f07647a5f42b7f", + tokens: { + USDT: ADDRESSES.polygon.USDT, + USDC: ADDRESSES.polygon.USDC, + DAI: ADDRESSES.polygon.DAI, + ETH: ADDRESSES.polygon.WETH_1, + // MAP: "0xBAbceE78586d3e9E80E0d69601A17f983663Ba6a" + } + }, + ethereum: { + mosContract: "0x630105189c7114667a7179aa57f07647a5f42b7f", + tokens: { + USDT: ADDRESSES.ethereum.USDT, + USDC: ADDRESSES.ethereum.USDC, + DAI: ADDRESSES.ethereum.DAI, + ETH: ADDRESSES.ethereum.WETH, + // MAP: "0x9e976f211daea0d652912ab99b0dc21a7fd728e4" + } + }, + near: { + mosContract: "mos.mfac.butternetwork.near", + tokens: { + USDT: "dac17f958d2ee523a2206206994597c13d831ec7.factory.bridge.near", + USDC: "a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48.factory.bridge.near", + DAI: "6b175474e89094c44da98b954eedeac495271d0f.factory.bridge.near", + ETH: "aurora", + // MAP: "mapo.mfac.butternetwork.near" + } + }, + map: { + mosContract: "0x630105189c7114667a7179Aa57f07647a5f42B7F", + tokens: { + // USDT: "0x33daba9618a75a7aff103e53afe530fbacf4a3dd", + // USDC: ADDRESSES.map.USDC, + // DAI: "0xEdDfAac857cb94aE8A0347e2b1b06f21AA1AAeFA", + // ETH: ADDRESSES.map.ETH, + MAP: ADDRESSES.map.WMAPO + } + } +} + +module.exports = { + methodology: 'get the amount of token deposited in MOS contract on each supported chain.', +}; + +Object.keys(config).forEach(chain => { + const { mosContract, tokens } = config[chain] + module.exports[chain] = { + tvl:sumTokensExport({ owner: mosContract, tokens: Object.values(tokens), }) + } +}) \ No newline at end of file diff --git a/projects/butterswap/index.js b/projects/butterswap/index.js index d91431deed3..aa2548ee2dd 100644 --- a/projects/butterswap/index.js +++ b/projects/butterswap/index.js @@ -1,5 +1,5 @@ -const sdk = require("@defillama/sdk"); -const {calculateUniTvl} = require("../helper/calculateUniTvl"); +const {uniTvlExport} = require("../helper/unknownTokens"); +const {staking} = require("../helper/staking"); //HECO ADDRESSES const hecoFactory = "0x874D01CA682C9c26BA7E6D9f6F801d1a1fb49201"; @@ -12,73 +12,13 @@ const bscButter = "0x5eF7814f4cB17b38408F1F641e4b5b61c5D023a8"; const bscHButter = "0x2f3bca2631fff538b8a55207f6c2081457e229f7"; const bscChef = "0xa49f4CF57eaFE0098D398DF3eD3A7dF10EAaBfAB"; -async function hecoTvl(timestamp, block, chainBlocks) { - return await calculateUniTvl(addr=>{ - if (addr.toLowerCase() === "0x5545153ccfca01fbd7dd11c0b23ba694d9509a6f") { - return "0x6f259637dcd74c767781e37bc6133cd6a68aa161" - } - else if (addr.toLowerCase() === "0xdd86dd2dc0aca2a8f41a680fc1f88ec1b7fc9b09"){ - return "0x95ad61b0a150d79219dcf64e1e6cc01f0b64c4ce"; - } - else if (addr.toLowerCase() === "0x311bcb634a4111e6516d3899f9fbfbfe984f021a") { - return "0xb2e260f12406c401874ecc960893c0f74cd6afcd" - } - else if (addr.toLowerCase() === "0xdb11743fe8b129b49b11236e8a715004bdabe7e5") { - return "0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0" - } - else if (addr.toLowerCase() === "0x40280e26a572745b1152a54d1d44f365daa51618") { - return "bsc:0xba2ae424d960c26247dd6c32edc70b295c744c43" - } - else if (addr.toLowerCase() === "0x4f99d10e16972ff2fe315eee53a95fc5a5870ce3") { - return "bsc:0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c" - } - return `heco:${addr}` - }, chainBlocks.heco, "heco", hecoFactory, 0, true); -} - -async function bscTvl(timestamp, block, chainBlocks) { - return await calculateUniTvl(addr=>{ - addr = addr.toLowerCase(); - if (addr === "0x2f3bca2631fff538b8a55207f6c2081457e229f7" || addr === "0x5ef7814f4cb17b38408f1f641e4b5b61c5d023a8") { - return "heco:0xbf84214ea409a369774321727595f218889ed943" - } - return `bsc:${addr}` - }, chainBlocks.bsc, "bsc", bscFactory, 0, true); -} - -async function bscStaking(timestamp, block, chainBlocks) { - let balances = {}; - let stakingBalance = (await sdk.api.erc20.balanceOf({ - target: bscButter, - owner: bscChef, - block: chainBlocks.bsc, - chain: "bsc" - })).output; - sdk.util.sumSingleBalance(balances, `heco:${hecoButter}`, stakingBalance); - return balances; -} - -async function hecoStaking(timestamp, block, chainBlocks) { - let balances = {}; - let stakingBalance = (await sdk.api.erc20.balanceOf({ - target: hecoButter, - owner: hecoChef, - block: chainBlocks.heco, - chain: "heco" - })).output; - sdk.util.sumSingleBalance(balances, `heco:${hecoButter}`, stakingBalance); - return balances; -} - - - module.exports = { heco: { - tvl: hecoTvl, - staking: hecoStaking + tvl: uniTvlExport('heco', hecoFactory).heco.tvl, + staking: staking(hecoChef, hecoButter, 'heco'), }, bsc: { - tvl: bscTvl, - staking: bscStaking + tvl: uniTvlExport('bsc', bscFactory).bsc.tvl, + staking: staking(bscChef, bscButter, 'bsc'), }, } \ No newline at end of file diff --git a/projects/bwatch/index.js b/projects/bwatch/index.js index ee2ac7951e8..d9762ae3ba2 100644 --- a/projects/bwatch/index.js +++ b/projects/bwatch/index.js @@ -20,6 +20,9 @@ async function fetch() { } module.exports = { + mixin: { + fetch + }, fetch } diff --git a/projects/bxh/index.js b/projects/bxh/index.js index f5f89cad71b..6fba1b096d0 100644 --- a/projects/bxh/index.js +++ b/projects/bxh/index.js @@ -3,18 +3,18 @@ const { uniTvlExport } = require('../helper/calculateUniTvl'); module.exports = { heco: { - tvl: uniTvlExport('0xe0367ec2bd4ba22b1593e4fefcb91d29de6c512a', 'heco'), + tvl: uniTvlExport('0xe0367ec2bd4ba22b1593e4fefcb91d29de6c512a', 'heco', true), }, bsc: { - tvl: uniTvlExport('0x7897c32cbda1935e97c0b59f244747562d4d97c1', 'bsc'), + tvl: uniTvlExport('0x7897c32cbda1935e97c0b59f244747562d4d97c1', 'bsc', true), }, ethereum: { - tvl: uniTvlExport('0x8d0fCA60fDf50CFE65e3E667A37Ff3010D6d1e8d', 'ethereum'), + tvl: uniTvlExport('0x8d0fCA60fDf50CFE65e3E667A37Ff3010D6d1e8d', 'ethereum', true), }, avax: { - tvl: uniTvlExport('0xDeC9231b2492ccE6BA01376E2cbd2bd821150e8C', 'avax'), + tvl: uniTvlExport('0xDeC9231b2492ccE6BA01376E2cbd2bd821150e8C', 'avax', true), }, okexchain: { - tvl: uniTvlExport('0xff65bc42c10dcc73ac0924b674fd3e30427c7823', 'okexchain'), + tvl: uniTvlExport('0xff65bc42c10dcc73ac0924b674fd3e30427c7823', 'okexchain', true), }, }; // node test.js projects/bxh/index.js diff --git a/projects/bzx.js b/projects/bzx.js deleted file mode 100644 index e7c3100f165..00000000000 --- a/projects/bzx.js +++ /dev/null @@ -1,14 +0,0 @@ -const utils = require('./helper/utils'); - -/* * * * * * * * -* ==> Correct adapter needs to be created. -* -*****************/ -async function fetch() { - let staked = await utils.fetchURL('https://api.bzx.network/v1/vault-balance-usd?networks=bsc,eth,polygon') - return Number(staked.data.data.bsc.all) + Number(staked.data.data.eth.all) + Number(staked.data.data.polygon.all); -} - -module.exports = { - fetch -} diff --git a/projects/cache-gold/abis.js b/projects/cache-gold/abis.js index f401ac06fe6..e5f574d6830 100644 --- a/projects/cache-gold/abis.js +++ b/projects/cache-gold/abis.js @@ -1,21 +1,6 @@ const abis = {}; -abis.gramOz = [{ "inputs": [], "name": "getLatestPrice", "outputs": [{ "internalType": "int256", "name": "", "type": "int256" }], "stateMutability": "view", "type": "function" }]; - -abis.cacheGold = [{ - "constant": true, - "inputs": [], - "name": "totalCirculation", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }] +abis.gramOz = "int256:getLatestPrice" +abis.cacheGold = "uint256:totalCirculation" module.exports = abis \ No newline at end of file diff --git a/projects/cache-gold/index.js b/projects/cache-gold/index.js index 854b2d20206..ae5f2404e68 100644 --- a/projects/cache-gold/index.js +++ b/projects/cache-gold/index.js @@ -9,13 +9,13 @@ const { toUSDTBalances } = require('../helper/balances'); const circulatingBalance = (await sdk.api.abi.call({ block, target: cgt, - abi: abis.cacheGold.find(i => i.name === 'totalCirculation') + abi: abis.cacheGold })).output; const chainlinkAuGramPrice = (await sdk.api.abi.call({ block, target: chainLinkGoldGramConvertorPriceConsumer, - abi: abis.gramOz.find(i => i.name === 'getLatestPrice') + abi: abis.gramOz })).output; return toUSDTBalances(circulatingBalance*chainlinkAuGramPrice/1e16); diff --git a/projects/cafeswap/index.js b/projects/cafeswap/index.js index fc6d97fdd97..de587de9d34 100644 --- a/projects/cafeswap/index.js +++ b/projects/cafeswap/index.js @@ -13,7 +13,6 @@ const POLYGON_BREW_ADDRESS = "0xb5106A3277718eCaD2F20aB6b86Ce0Fee7A21F09"; module.exports = { bsc: { tvl: getUniTVL({ - chain: 'bsc', useDefaultCoreAssets: true, factory: BSC_DEX_FACTORY, }), @@ -21,7 +20,6 @@ module.exports = { }, polygon: { tvl: getUniTVL({ - chain: 'polygon', useDefaultCoreAssets: true, factory: POLYGON_DEX_FACTORY, }), diff --git a/projects/caffeinefund/index.js b/projects/caffeinefund/index.js deleted file mode 100644 index ae7edea73b8..00000000000 --- a/projects/caffeinefund/index.js +++ /dev/null @@ -1,16 +0,0 @@ -const { tombTvl } = require('../helper/tomb'); - -const cfn = "0x3873788Acb34a7d67e90F053da8598aEF76298c6"; -const cshare = "0x41160139986dFfE2011a07fbB5F4B316200A5419"; - -const boardroom = "0xf916Dc7bfEAd1cA29cB1aCE71D82dFF68Cc12291"; -const rewardPool = "0x803b87cC88B701E4F871939826944e1d0413747c"; - -const pool2lps = [ - "0x504183690063734eAAd4f53b77729266b28E3b60", - "0x190a83FdaC8560d0e6ED2ab00dDE62D648A46747" -] - -module.exports = { - ...tombTvl(cfn, cshare, rewardPool, boardroom, pool2lps, "avax", undefined, false, pool2lps[1]) -} \ No newline at end of file diff --git a/projects/cake-defi/index.js b/projects/cake-defi/index.js index 07cc03b5c16..da5cdbe6505 100644 --- a/projects/cake-defi/index.js +++ b/projects/cake-defi/index.js @@ -3,13 +3,19 @@ const { cexExports } = require('../helper/cex') const config = { ethereum: { owners: [ - '0x8b802fa7b71ea532187e432d9b87d24cc904243a', // https://blog.cakedefi.com/whats-new-with-our-lending-service/ + '0x94fa70d079d76279e1815ce403e9b985bccc82ac', ], }, bitcoin: { - owners: ['3HRPnc4SddsFjrLVTfuTZJ2kQhdyCaHT4G'] + owners: ['38pZuWUti3vSQuvuFYs8Lwbyje8cmaGhrT'] + }, + litecoin: { + owners: ['MLYQxJfnUfVqRwfYXjDJfmLbyA77hqzSXE'] } } module.exports = cexExports(config) -module.exports.methodology = 'As Cake DeFi is a CeDeFi platform, its assets associated to the staking nodes are not included for the purposes of the TVL calculation. In this case, there are approximately $85m in DFI chain (nodes), and around $5.98m in ETH chain (nodes) as of 28 November 2022. The calculation methodology are as follows: DFI: 9511 (nodes) * 20K (collateral per node) *$0.45 = $85.6M. ETH: 170 * 32 *$1100 = $5.98M. Cake DeFi publishes information on all its nodes on its Transparency page here: https://cakedefi.com/transparency.' \ No newline at end of file +module.exports.methodology = 'As Cake DeFi is a CeDeFi platform, its assets associated to the staking nodes are not included for the purposes of the TVL calculation. In this case, there are approximately $121.4M in DFI chain (nodes), and around $24.7M in ETH chain (nodes) as of 31 March 2023. The calculation methodology are as follows: DFI: 10846 (nodes) * 20K (collateral per node) *$0.56 = $121.4M. ETH: 430 * 32 *$1800 = $24.7M, We also do not track bitcoincash and doge chain. Cake DeFi publishes information on all its nodes on its Transparency page here: https://cakedefi.com/transparency.', +module.exports.hallmarks = [ + [1680516000, "Change Of Wallets"], +] \ No newline at end of file diff --git a/projects/cakedao/index.js b/projects/cakedao/index.js index b6668cea682..f306220cc06 100644 --- a/projects/cakedao/index.js +++ b/projects/cakedao/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { ohmTvl } = require("../helper/ohm"); const cakeStaking = "0xA3E4200CA1ac92331d529327E82d89C149CcD81C"; @@ -6,10 +7,10 @@ const cake = "0x4eb49a2f9a79053866fae806fac95a3ef5b92c05"; const treasury = "0x829D805F26E26aE6c2C6294B7fF9c0fE14d982Ac"; const treasuryTokens = [ ["0x130966628846bfd36ff31a822705796e8cb8c18d", false], // MIM - ["0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7", false], // WAVAX, - ["0xc7198437980c041c805a1edcba50c1ce5db95118", false], // USDT + [ADDRESSES.avax.WAVAX, false], // WAVAX, + [ADDRESSES.avax.USDT_e, false], // USDT ["0x50b7545627a5162f82a992c33b87adc75187b218", false], // WBTC - ["0x49d5c2bdffac6ce2bfdb6640f4f80f226bc10bab", false], // WETH + [ADDRESSES.avax.WETH_e, false], // WETH ["0x84d2fe6adace63407f4b6bd91ab9f782ba3cb420", true], // CAKE-MIM JLP ["0xb8df8111a74e5fd62b13dbbe59ddeb343fc91d4a", true] // CAKE-WAVAX JLP ] diff --git a/projects/cakewwap/index.js b/projects/cakewwap/index.js index 8a1a6caf324..a5cfce11c35 100644 --- a/projects/cakewwap/index.js +++ b/projects/cakewwap/index.js @@ -4,7 +4,6 @@ module.exports = { misrepresentedTokens: true, ethpow: { tvl: getUniTVL({ - chain: 'ethpow', useDefaultCoreAssets: true, factory: '0xe97352E2d3a4F418044a91533a2379dbd11b425d', }) diff --git a/projects/calculated-finance/index.js b/projects/calculated-finance/index.js new file mode 100644 index 00000000000..67ed812a2d4 --- /dev/null +++ b/projects/calculated-finance/index.js @@ -0,0 +1,16 @@ +const { get } = require("../helper/http"); +const { sumTokens, endPoints } = require('../helper/chain/cosmos') + + +async function tvl() { + const owners = [ + "kujira1e6fjnq7q20sh9cca76wdkfg69esha5zn53jjewrtjgm4nktk824stzyysu", + ] + return sumTokens({ owners, chain: 'kujira' }) +} + +module.exports = { + kujira: { + tvl, + }, +} \ No newline at end of file diff --git a/projects/camel-farm/index.js b/projects/camel-farm/index.js new file mode 100644 index 00000000000..62b5b0c57f2 --- /dev/null +++ b/projects/camel-farm/index.js @@ -0,0 +1,9 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { masterchefExports } = require('../helper/unknownTokens') + +module.exports = masterchefExports({ + chain: 'arbitrum', + masterchef: '0xceFDbfaf8E0f5b52F57c435dAD670554aF57EBFF', + nativeToken: '0xb5734ac76d44bdf32b8dd4331e5bfc3bf9989cda', + coreAssets: [ADDRESSES.arbitrum.WETH] +}) \ No newline at end of file diff --git a/projects/camelot-v2/index.js b/projects/camelot-v2/index.js new file mode 100644 index 00000000000..736a4682aab --- /dev/null +++ b/projects/camelot-v2/index.js @@ -0,0 +1,13 @@ + +const { uniV3Export } = require('../helper/uniswapV3') +const { mergeExports } = require('../helper/utils'); + +const export1 = uniV3Export({ + arbitrum: { factory: '0xd490f2f6990c0291597fd1247651b4e0dcf684dd', fromBlock: 75633510, isAlgebra: true, }, +}) + +const export2 = uniV3Export({ + arbitrum: { factory: '0x1a3c9B1d2F0529D97f2afC5136Cc23e58f1FD35B', fromBlock: 75633510, isAlgebra: true, }, +}) + +module.exports = mergeExports([export1, export2]); \ No newline at end of file diff --git a/projects/camelot/index.js b/projects/camelot/index.js index 1458b0bd9c1..060254dd457 100644 --- a/projects/camelot/index.js +++ b/projects/camelot/index.js @@ -1,9 +1,9 @@ -const { uniTvlExport } = require("../helper/calculateUniTvl"); +const { getUniTVL } = require("../helper/unknownTokens"); + module.exports = { - doublecounted: false, - timetravel: true, + misrepresentedTokens: true, start: 1669075200, arbitrum: { - tvl: uniTvlExport("0x6EcCab422D763aC031210895C81787E87B43A652", "arbitrum"), + tvl: getUniTVL({ factory: '0x6EcCab422D763aC031210895C81787E87B43A652', useDefaultCoreAssets: true,}), }, }; \ No newline at end of file diff --git a/projects/candycity/index.js b/projects/candycity/index.js index a7890d9e941..a9c913a1c33 100644 --- a/projects/candycity/index.js +++ b/projects/candycity/index.js @@ -1,10 +1,59 @@ +const sdk = require("@defillama/sdk"); +const BigNumber = require("bignumber.js"); +const { toUSDTBalances } = require('../helper/balances') +const { get } = require('../helper/http'); +const { staking, stakings } = require("../helper/staking"); const { getUniTVL } = require('../helper/unknownTokens') +const chainTvl = getUniTVL({ + factory: '0x84343b84EEd78228CCFB65EAdEe7659F246023bf', + useDefaultCoreAssets: true +}) + +const CANDY_TOKEN = '0x06C04B0AD236e7Ca3B3189b1d049FE80109C7977'; + +const CMC_API_URL = 'https://api.coinmarketcap.com/data-api/v3/cryptocurrency/market-pairs/latest?slug=bored-candy-city' + +const STAKING_CONTRACTS = [ + '0xDAf7c0e2882818b46c36AdBCe95399821Eca08F8', // masterchef + '0x8FEf43b1f3046F8f58A76c64aD01Bc8d82ff0ad1', // candy vault + '0xA46C4a3428a5E9B5C84A4457215D98BC8DC17AbB', // candy fixed nft staking pool + '0xCa207941946218126BD7BBe44C5d457753490b4A', // candy shared nft staking pool + '0x7CeA583ea310b3A8a72Ed42B3364aff16d24B3A2', // candy lock + '0xE56C1A8D4E90d82BA06F3f49efEc69f736a32070', // candy => wcro pool + '0xc568Ce4C714c5Ec819eA8F52596a6Fd9523A2B81', // candy => warz pool, +]; + +const VESTING_CONTRACTS = [ + '0x427f1230A547566a51F5Ffd5698BB65c06acA2D2', // candy vesting +] + +async function fetchTvl(timestamp, ethBlock, chainBlocks) { + let cmc_response = await get(CMC_API_URL) + const candyPrice = cmc_response.data.marketPairs[0].price + const balances = await stakings(STAKING_CONTRACTS, CANDY_TOKEN, "cronos")(timestamp, ethBlock, chainBlocks) + const candyBalances = Object.values(balances)[0] + + return toUSDTBalances(BigNumber(candyBalances).times(BigNumber(candyPrice)).div(1e18)); +} + +async function fetchVesting(timestamp, ethBlock, chainBlocks) { + let cmc_response = await get(CMC_API_URL) + const candyPrice = cmc_response.data.marketPairs[0].price + const balances = await stakings(VESTING_CONTRACTS, CANDY_TOKEN, "cronos")(timestamp, ethBlock, chainBlocks) + const candyBalances = Object.values(balances)[0] + + return toUSDTBalances(BigNumber(candyBalances).times(BigNumber(candyPrice)).div(1e18)); +} + module.exports = { misrepresentedTokens: true, methodology: - "Factory address (0x84343b84EEd78228CCFB65EAdEe7659F246023bf) is used to find the LP pairs. TVL is equal to the liquidity on the AMM.", + "Factory address (0x84343b84EEd78228CCFB65EAdEe7659F246023bf) is used to find the LP pairs. TVL is equal to the liquidity on the AMM and the candy tokens in the staking pools / vault / vesting contract / lock contract.", cronos: { - tvl: getUniTVL({ factory: '0x84343b84EEd78228CCFB65EAdEe7659F246023bf', chain: 'cronos', useDefaultCoreAssets: true }), + tvl: chainTvl, + staking: fetchTvl, + vesting: fetchVesting + }, }; // node test.js projects/crodex/index.js diff --git a/projects/canto-dex/index.js b/projects/canto-dex/index.js index 28ba40534cc..399ec064586 100644 --- a/projects/canto-dex/index.js +++ b/projects/canto-dex/index.js @@ -6,9 +6,9 @@ module.exports = { misrepresentedTokens: true, canto: { tvl: getUniTVL({ - chain: 'canto', factory: '0xE387067f12561e579C5f7d4294f51867E0c1cFba', useDefaultCoreAssets: true, + hasStablePools: true, }) } }; \ No newline at end of file diff --git a/projects/canto-forte/index.js b/projects/canto-forte/index.js index 4af5016dbdc..c3a3613a3d3 100644 --- a/projects/canto-forte/index.js +++ b/projects/canto-forte/index.js @@ -4,7 +4,6 @@ module.exports = { misrepresentedTokens: true, canto: { tvl: getUniTVL({ - chain: 'canto', factory: '0x759e390D946249c63e0A1d8a810C5A577a591719', useDefaultCoreAssets: true, }) diff --git a/projects/canto-lending/index.js b/projects/canto-lending/index.js index 0b80e5255d5..c7e02a89e34 100644 --- a/projects/canto-lending/index.js +++ b/projects/canto-lending/index.js @@ -1,8 +1,6 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { compoundExports } = require('../helper/compound') -const { unwrapLPsAuto } = require('../helper/unwrapLPs') -const { getTokenPrices } = require('../helper/unknownTokens') -const { getFixBalances } = require('../helper/portedTokens') const addresses = { CantoNoteLP: '0x1D20635535307208919f0b67c3B2065965A85aA9', @@ -11,54 +9,35 @@ const addresses = { NoteUSDCLP: '0x9571997a66D63958e1B3De9647C22bD6b9e7228c', CantoETHLP: '0x216400ba362d8FCE640085755e47075109718C8B', Comptroller: '0x5E23dC409Fc2F832f83CEc191E245A191a4bCc5C', - Note: '0x4e71A2E537B7f9D9413D3991D37958c0b5e1e503', - USDC: '0x80b5a32E4F032B2a058b4F29EC95EEfEEB87aDcd', - USDT: '0xd567B3d7B8FE3C79a1AD8dA978812cfC4Fa05e75', - ATOM: '0xecEEEfCEE421D8062EF8d6b4D814efe4dc898265', - ETH: '0x5FD55A1B9FC24967C4dB09C513C3BA0DFa7FF687', - WCANTO: '0x826551890Dc65655a0Aceca109aB11AbDbD7a07B', + Note: ADDRESSES.canto.NOTE, + USDC: ADDRESSES.functionx.WFX, + USDT: ADDRESSES.functionx.PUNDIX, + ATOM: ADDRESSES.functionx.USDT, + ETH: ADDRESSES.functionx.PURSE, + WCANTO: ADDRESSES.canto.WCANTO, CCANTO: '0xb65ec550ff356eca6150f733ba9b954b2e0ca488', + NOTE_WCANTO: '0x1d20635535307208919f0b67c3b2065965a85aa9', + ETH_WCANTO: '0x216400ba362d8fce640085755e47075109718c8b', + WCANT_ATOM: '0x30838619c55b787bafc3a4cd9aea851c1cfb7b19', + NOTE_USDC: '0x9571997a66d63958e1b3de9647c22bd6b9e7228c', + NOTE_USDT: '0x35db1f3a6a6f07f82c76fcc415db6cfb1a7df833', // PriceFeed: '0xa252eEE9BDe830Ca4793F054B506587027825a8e' } const chain = 'canto' const checkForLPTokens = i => /vAMM/.test(i) -const compoundData = compoundExports(addresses.Comptroller, chain, addresses.CCANTO, addresses.WCANTO, undefined, checkForLPTokens, { blacklistedTokens:[ addresses.Note ] }) +const compoundData = compoundExports(addresses.Comptroller, chain, addresses.CCANTO, addresses.WCANTO, undefined, checkForLPTokens, { blacklistedTokens:[ + addresses.Note, + addresses.NOTE_WCANTO, + addresses.ETH_WCANTO, + addresses.WCANT_ATOM, + addresses.NOTE_USDC, + addresses.NOTE_USDT, + ] }) module.exports = { hallmarks: [ [1661417246, "Remove canto dex LPs from tvl computation"] ], - misrepresentedTokens: true, - canto: { - tvl, borrowed, - } -} - -async function update(block, balances) { - const lps = Object.keys(addresses).filter(i => /LP$/.test(i)).map(i => addresses[i]) - lps.push(...Object.keys(balances)) - const { updateBalances, } = await getTokenPrices({ chain, block, lps, useDefaultCoreAssets: true, }) - updateBalances(balances) - return balances -} - -async function tvl(_, _b, cb) { - const block = cb[chain] - const balances = await compoundData.tvl(_, _b, cb) - // await unwrapLPsAuto({ balances, chain, block, }) - // await update(block, balances) - const fixBalances = await getFixBalances(chain) - fixBalances(balances) - return balances -} - -async function borrowed(_, _b, cb) { - const block = cb[chain] - const balances = await compoundData.borrowed(_, _b, cb) - // await unwrapLPsAuto({ balances, chain, block, }) - // await update(block, balances) - const fixBalances = await getFixBalances(chain) - fixBalances(balances) - return balances + canto: compoundData } diff --git a/projects/cantohm/index.js b/projects/cantohm/index.js new file mode 100644 index 00000000000..ffedffea922 --- /dev/null +++ b/projects/cantohm/index.js @@ -0,0 +1,30 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require("../helper/unknownTokens"); +const lps = [ + '0x2382994D8A15d2dd2aAE10561688Ef6cbe10CB8C', + '0x5d3B693C00140E0cA2826C4AbC9E38b2E8CCd8f2', + '0x1D20635535307208919f0b67c3B2065965A85aA9', +] + +module.exports = { + misrepresentedTokens: true, + canto: { + tvl: sumTokensExport({ + owner: '0xB8Ce90A08bdAdd3e6e6cD3173c0661FA94Aa81c5', + tokens: [ + ADDRESSES.canto.NOTE, + ADDRESSES.canto.WCANTO, + ...lps, + ], + useDefaultCoreAssets: true, + }), + staking: sumTokensExport({ + owner: '0x6bb55835407Aa076B9028Cd8498788659346828e', + tokens: [ + '0x533C0f08BE45eaaC821392B85E67Fb0c7DC2cab7', + ], + lps, + useDefaultCoreAssets: true, + }), + } +} diff --git a/projects/cantoswap/index.js b/projects/cantoswap/index.js index eb82c56658d..f2544d876bb 100644 --- a/projects/cantoswap/index.js +++ b/projects/cantoswap/index.js @@ -4,7 +4,6 @@ module.exports = { misrepresentedTokens: true, canto: { tvl: getUniTVL({ - chain: "canto", factory: "0x6eE19E5e5F1018c26bDa107cB2CCd9dA461A698c", useDefaultCoreAssets: true, }), diff --git a/projects/cap-v4/index.js b/projects/cap-v4/index.js new file mode 100644 index 00000000000..bd6f77f4738 --- /dev/null +++ b/projects/cap-v4/index.js @@ -0,0 +1,16 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport, nullAddress } = require('../helper/unwrapLPs') + +const vault = "0xba9736a3fc948f8c489a7e975114eaf2b7f1c3fc"; +const fundStore = "0xe00975A0D7def3FAE93832cc72D5ff50432fc857"; +const cap = "0x031d35296154279dc1984dcd93e392b1f946737b"; + +module.exports = { + arbitrum: { + tvl: sumTokensExport({ owners: [vault, fundStore], tokens: [ + nullAddress, + ADDRESSES.arbitrum.USDC,//USDC + ]}), + staking: sumTokensExport({ owners: [vault, fundStore], tokens: [cap]}) + }, +} diff --git a/projects/cap/index.js b/projects/cap/index.js index c72992826b8..8b16d2a118f 100644 --- a/projects/cap/index.js +++ b/projects/cap/index.js @@ -1,8 +1,7 @@ -const sdk = require('@defillama/sdk'); -const { default: BigNumber } = require('bignumber.js'); +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport, nullAddress, } = require('../helper/unwrapLPs') const contracts = { - "treasury": "0x283C41b726634fBD6B72aA22741B202DB7E56aaC", "treasuryV2": "0x1058AFe66BB5b79C295CCCE51016586949Bc4e8d", "trading1": "0x9BC357bc5b312AaCD41a84F3C687F031B8786853", "trading2": "0xA55Eee92a46A50A4C65908F28A0BE966D3e71633", @@ -12,75 +11,23 @@ const contracts = { "ethPool": "0xE0cCd451BB57851c1B2172c07d8b4A7c6952a54e", "usdcPool": "0x958cc92297e6F087f41A86125BA8E121F0FbEcF2", + "usdcPool2": "0xf16033d20adda47dc99ea291d0f4c4fef2ff47af", }; const cap = "0x031d35296154279dc1984dcd93e392b1f946737b"; -const weth = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"; -const usdc = "0xff970a61a04b1ca14834a43f5de4533ebddb5cc8"; - -async function tvl(_time, _ethBlock, chainBlocks) { - let balances = {}; - - balances[`arbitrum:${usdc}`] = (await sdk.api.erc20.balanceOf({ - target: usdc, - owner: contracts.usdcPool, - chain: 'arbitrum', - block: chainBlocks.arbitrum - })).output; - - const ethLocked = await sdk.api.eth.getBalances({ - targets: [ - contracts.trading1, - contracts.trading2, - contracts.trading3, - contracts.trading4, - contracts.ethPool - ], - chain: 'arbitrum', - block: chainBlocks.arbitrum - }); - - balances[weth] = ethLocked.output.reduce((total, item) => - BigNumber(item.balance).plus(total), 0).toFixed(0); - - return balances; -}; - -async function treasury(_time, _ethBlock, chainBlocks) { - let balances = {}; - balances[`arbitrum:${usdc}`] = (await sdk.api.erc20.balanceOf({ - target: usdc, - owner: contracts.treasury, - chain: 'arbitrum', - block: chainBlocks.arbitrum - })).output; - - const ethLocked = await sdk.api.eth.getBalances({ - targets: [contracts.treasury, contracts.treasuryV2], - chain: 'arbitrum', - block: chainBlocks.arbitrum - }); - - balances[weth] = ethLocked.output.reduce((total, item) => - BigNumber(item.balance).plus(total), 0).toFixed(0); - return balances; -}; - -async function staking(_time, _ethBlock, chainBlocks) { - const capLocked = (await sdk.api.erc20.balanceOf({ - target: cap, - owner: contracts.staking, - chain: 'arbitrum', - block: chainBlocks.arbitrum - })); - - return { [`arbitrum:${cap}`]: capLocked.output } -} +const usdc = ADDRESSES.arbitrum.USDC; module.exports = { methodology: "ETH locked on trading contracts", arbitrum: { - treasury, - staking, - tvl + staking: sumTokensExport({ owner: contracts.staking, tokens: [ cap ]}), + tvl: sumTokensExport({ tokensAndOwners: [ + [nullAddress, contracts.trading1], + [nullAddress, contracts.trading2], + [nullAddress, contracts.trading3], + [nullAddress, contracts.trading4], + [nullAddress, contracts.ethPool], + [usdc, contracts.usdcPool], + [usdc, contracts.usdcPool2], + ]}), } }; \ No newline at end of file diff --git a/projects/capitaldex/index.js b/projects/capitaldex/index.js index e4d13173db9..570e9c6f28f 100644 --- a/projects/capitaldex/index.js +++ b/projects/capitaldex/index.js @@ -5,7 +5,7 @@ module.exports = { methodology: "Factory address in Ethereum(0x03407772F5EBFB9B10Df007A2DD6FFf4EdE47B53) and in Curio(0xc36f5180b181f1b949e0ff4d65b258e0987f443f) is used to find the LP pairs. TVL is equal to the liquidity on the AMM.", ethereum: { - tvl: getUniTVL({ factory: '0x03407772F5EBFB9B10Df007A2DD6FFf4EdE47B53', chain: 'ethereum' }), + tvl: getUniTVL({ factory: '0x03407772F5EBFB9B10Df007A2DD6FFf4EdE47B53', useDefaultCoreAssets: true }), }, curio: { // tvl: getUniTVL({ factory: '0xc36f5180b181f1b949e0ff4d65b258e0987f443f', chain: 'curio', useDefaultCoreAssets: true }), diff --git a/projects/capricorn/index.js b/projects/capricorn/index.js index 604f4b86473..c74813e23b0 100644 --- a/projects/capricorn/index.js +++ b/projects/capricorn/index.js @@ -4,7 +4,6 @@ module.exports = { misrepresentedTokens: true, cube: { tvl: getUniTVL({ - chain: 'cube', useDefaultCoreAssets: true, factory: '0x33CB4150f3ADFCD92fbFA3309823A2a242bF280f', }) diff --git a/projects/carbon/index.js b/projects/carbon/index.js index 1fe2cf6856d..bc6d1aca9ff 100644 --- a/projects/carbon/index.js +++ b/projects/carbon/index.js @@ -1,9 +1,10 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const { staking } = require("../helper/staking"); const BigNumber = require("bignumber.js"); const stakingETHContract = "0x27F0408729dCC6A4672e1062f5003D2a07E4E10D"; -const WETH = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"; +const WETH = ADDRESSES.ethereum.WETH; const stakingCARBONContract = "0x2C5058325373d02Dfd6c08E48d91FcAf8fD49f45"; const CARBON = "0xfa42da1bd08341537a44a4ca9d236d1c00a98b40"; @@ -21,7 +22,7 @@ const lpAddresses = [ "0x89450F6C7d7f2c5971E9Ee28e94d8b199d17f673", ]; -const WETH_arb = "0x82af49447d8a07e3bd95bd0d56f35241523fbab1"; +const WETH_arb = ADDRESSES.arbitrum.WETH; const NYAN = "0xed3fb761414da74b74f33e5c5a1f78104b188dfc"; async function pool2(time, ethBlock, chainBlocks) { diff --git a/projects/carbondefi/index.js b/projects/carbondefi/index.js new file mode 100644 index 00000000000..ad46c9f01e5 --- /dev/null +++ b/projects/carbondefi/index.js @@ -0,0 +1,21 @@ +const { getLogs } = require('../helper/cache/getLogs') +const { sumTokens2 } = require('../helper/unwrapLPs') + +const controller = '0xC537e898CD774e2dCBa3B14Ea6f34C93d5eA45e1' + +async function tvl(_, _b, _cb, { api, }) { + const logs = await getLogs({ + api, + target: controller, + topic: 'PairCreated(uint128,address,address)', + eventAbi: 'event PairCreated(uint128 indexed pairId, address indexed token0, address indexed token1)', + onlyArgs: true, + fromBlock: 17087375, + }) + const tokens = logs.map(i => [i.token0, i.token1]).flat() + + return sumTokens2({ api, owner: controller, tokens, }) +} + + +module.exports = { ethereum: { tvl } } \ No newline at end of file diff --git a/projects/carbonswap/index.js b/projects/carbonswap/index.js index b1be7bdd5c8..418659b0a1a 100644 --- a/projects/carbonswap/index.js +++ b/projects/carbonswap/index.js @@ -1,12 +1,10 @@ const { getUniTVL } = require('../helper/unknownTokens') module.exports = { - timetravel: true, misrepresentedTokens: true, methodology: "Factory address (0x17854c8d5a41d5A89B275386E24B2F38FD0AfbDd) is used to find the LP pairs. TVL is equal to the liquidity on the AMM.", energyweb: { tvl: getUniTVL({ - chain: 'energyweb', factory: '0x17854c8d5a41d5A89B275386E24B2F38FD0AfbDd', useDefaultCoreAssets: true, }) diff --git a/projects/carmine-options/abi.js b/projects/carmine-options/abi.js new file mode 100644 index 00000000000..20cb0e9142b --- /dev/null +++ b/projects/carmine-options/abi.js @@ -0,0 +1,41 @@ +const abi = [ + { + "name": "get_all_lptoken_addresses", + "type": "function", + "inputs": [], + "outputs": [ + { + "name": "array_len", + "type": "felt" + }, + { + "name": "array", + "type": "felt*" + } + ], + "stateMutability": "view" + }, + { + "name": "get_underlying_token_address", + "type": "function", + "inputs": [ + { + "name": "lptoken_address", + "type": "felt" + } + ], + "outputs": [ + { + "name": "underlying_token_address_", + "type": "felt" + } + ], + "stateMutability": "view" + }, +]; + +const objAbi = {}; + +abi.forEach((i) => (objAbi[i.name] = i)); + +module.exports = objAbi; diff --git a/projects/carmine-options/api.js b/projects/carmine-options/api.js new file mode 100644 index 00000000000..71a21d4a5ec --- /dev/null +++ b/projects/carmine-options/api.js @@ -0,0 +1,31 @@ +// https://www.starknetjs.com/docs/API/contract + +const { call, multiCall, parseAddress, number, sumTokens, } = require("../helper/chain/starknet"); +const abi = require("./abi"); + +const amm = + "0x076dbabc4293db346b0a56b29b6ea9fe18e93742c73f12348c8747ecfc1050aa"; + +async function tvl(_, _1, _2, { api }) { + + let lpTokens = await call({ + abi: abi.get_all_lptoken_addresses, + target: amm, + }) + lpTokens = number.bigNumberishArrayToHexadecimalStringArray(lpTokens.array.toString().split(',')) + let underlyings = await multiCall({ + abi: abi.get_underlying_token_address, + target: amm, + calls: lpTokens.map((lpToken) => ({ + params: [parseAddress(lpToken)], + })), + }); + return sumTokens({ owner: amm, tokens: underlyings.map(parseAddress), api, }); +} + +module.exports = { + methodology: 'Sums the unlocked capital and position of each pool.', + starknet: { + tvl, + }, +}; diff --git a/projects/carmine-options/index.js b/projects/carmine-options/index.js new file mode 100644 index 00000000000..674e8c995c1 --- /dev/null +++ b/projects/carmine-options/index.js @@ -0,0 +1 @@ +module.exports = require('./api') \ No newline at end of file diff --git a/projects/carthage/index.js b/projects/carthage/index.js deleted file mode 100644 index 0109691d862..00000000000 --- a/projects/carthage/index.js +++ /dev/null @@ -1,38 +0,0 @@ -const { request, gql } = require("graphql-request"); -const { toUSDTBalances } = require('../helper/balances'); -const graphUrl = 'https://thegraph.cndlchain.com/subgraphs/name/ianlapham/uniswap-v3-test' - -const graphQuery = gql` -query get_tvl($block: Int, $number_gte: Int = 10) { - factory( - id: "0x5Bb7BAE25728e9e51c25466D2A15FaE97834FD95" - block: {number_gte: $number_gte} - ) { - totalValueLockedETHUntracked - totalValueLockedETH - totalValueLockedUSD - totalValueLockedUSDUntracked - } -} -`; - -async function tvl(timestamp, ethBlock, chainBlocks) { - const response = await request( - graphUrl, - graphQuery, - { - block:chainBlocks.cndl, - } - ); - - return toUSDTBalances(Number(response.factory.totalValueLockedUSD)); -} - -module.exports = { - misrepresentedTokens: true, - methodology: 'The Carthage subgraph and the Carthage factory contract address are used to obtain the balance held in every LP pair.', - candle:{ - tvl, - }, - start: 1612715300, // 7th-Feb-2021 -} diff --git a/projects/cashcow/abi.json b/projects/cashcow/abi.json index f7a4e8ba5e9..b15e07cf4b4 100644 --- a/projects/cashcow/abi.json +++ b/projects/cashcow/abi.json @@ -1,36 +1,3 @@ { - "poolInfo": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "poolInfo", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "lpToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "allocPoint", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastRewardBlock", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accCowPerShare", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } + "poolInfo": "function poolInfo(uint256) view returns (address lpToken, uint256 allocPoint, uint256 lastRewardBlock, uint256 accCowPerShare)" } \ No newline at end of file diff --git a/projects/cashcow/index.js b/projects/cashcow/index.js index a3cdee69f0f..9f662a787bd 100644 --- a/projects/cashcow/index.js +++ b/projects/cashcow/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const abi = require("./abi.json"); const { getCompoundV2Tvl, compoundExports } = require("../helper/compound"); const { transformBscAddress } = require("../helper/portedTokens"); @@ -5,7 +6,7 @@ const { addFundsInMasterChef } = require("../helper/masterchef"); const comptroller = "0x44f2A790aCB1bE42d3F7864e9F73762556eb895E"; const cBNB = "0xC819cCfA453C4b5D2B9c9fF7CF8017adE99CB9B1"; -const WBNBEquivalent = "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c"; +const WBNBEquivalent = ADDRESSES.bsc.WBNB; const stakingChef = "0xbfcaB1627c4fB86A055DE4B8a56D46e625F51C0B"; diff --git a/projects/cashio/index.js b/projects/cashio/index.js index ddfd1999bd6..2c3d5fb6a31 100644 --- a/projects/cashio/index.js +++ b/projects/cashio/index.js @@ -1,9 +1,10 @@ +const ADDRESSES = require('../helper/coreAssets.json') const SUNNY_POOLS = [{ "poolName": "quarry_saber_usdc_usdt", "relevantAccounts": { "sunnyPool": "3Zk1PhVap6mwrB9jZktucoSaMBa2whYSq8jtLew3tXbp", - "tokenAMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", - "tokenBMint": "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB", + "tokenAMint": ADDRESSES.solana.USDC, + "tokenBMint": ADDRESSES.solana.USDT, "tokenAReserve": "CfWX7o2TswwbxusJ4hCaPobu2jLCb1hfXuXJQjVq3jQF", "tokenBReserve": "EnTrdMMpdhugeH6Ban6gYZWXughWxKtVGfCwFn78ZmY3", "lpTokenSPL": "2poo1w1DL6yd2WNTCnNTzDqkC6MBXq7axo77P16yrBuf" diff --git a/projects/casinocronos/index.js b/projects/casinocronos/index.js new file mode 100644 index 00000000000..4c57fc6c777 --- /dev/null +++ b/projects/casinocronos/index.js @@ -0,0 +1,15 @@ +const { staking } = require('../helper/staking') +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports={ + misrepresentedTokens: true, + methodology: "Factory address (0x570aA1E0aa3d679Bc9DaAA47564ed3Daba1208FE) is used to find the LP pairs. TVL is equal to the liquidity on the AMM, while staking is the amount of CASINO tokens found in the Masterchef(0x81b5118bF8A720B19FEC6F3078d2b555790cb0AB).", + cronos: { + tvl: getUniTVL({ + factory: '0x570aA1E0aa3d679Bc9DaAA47564ed3Daba1208FE', + useDefaultCoreAssets: true, + + }), + staking: staking("0x81b5118bF8A720B19FEC6F3078d2b555790cb0AB", "0x95ac4a86c0677971c4125ACe494e3C17a87a4C61", 'cronos') + } +} \ No newline at end of file diff --git a/projects/cat-in-a-box/index.js b/projects/cat-in-a-box/index.js new file mode 100644 index 00000000000..2607de1a3a5 --- /dev/null +++ b/projects/cat-in-a-box/index.js @@ -0,0 +1,11 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require('../helper/unwrapLPs') + +module.exports = { + ethereum: { + tvl: sumTokensExport({ owners: [ + '0x7f0A0C7149a46Bf943cCd412da687144b49C6014', + '0x24146D1B3339Cf76b455dC42e71Ea5Cdff4aE0d7', + ], tokens: [ADDRESSES.ethereum.STETH]}) + } +} \ No newline at end of file diff --git a/projects/catsapes/index.js b/projects/catsapes/index.js new file mode 100644 index 00000000000..ba0e5aee2e7 --- /dev/null +++ b/projects/catsapes/index.js @@ -0,0 +1,10 @@ +const { masterchefExports } = require('../helper/unknownTokens') + + +const config = { + kava: { + SKILL_TOKEN_CONTRACT: '0x85602B00C9bd973B1Afb66EC140A62480CF812d3', + } +} + +module.exports = masterchefExports({ chain: 'kava', masterchef: config.kava.SKILL_TOKEN_CONTRACT, }) \ No newline at end of file diff --git a/projects/catsluck/index.js b/projects/catsluck/index.js index 00da69ce670..7f65e7755f3 100644 --- a/projects/catsluck/index.js +++ b/projects/catsluck/index.js @@ -1,5 +1,4 @@ const sdk = require('@defillama/sdk'); -const { getBlock } = require('../helper/getBlock'); const { default: BigNumber } = require('bignumber.js'); const CHAIN = "smartbch" @@ -30,35 +29,7 @@ const stakingPools = [ ] // "function info(address addr) external view returns (uint, uint, uint)"" -const poolInfoAbi = { - "inputs": [ - { - "internalType": "address", - "name": "addr", - "type": "address" - }, - ], - "name": "info", - "outputs": [ - { - "internalType": "uint", - "name": "totalBalance", - "type": "uint" - }, - { - "internalType": "uint", - "name": "totalShare", - "type": "uint" - }, - { - "internalType": "uint", - "name": "sharesAndLockUntil", - "type": "uint" - }, - ], - "stateMutability": "view", - "type": "function" - } +const poolInfoAbi = 'function info(address addr) view returns (uint256 totalBalance, uint256 totalShare, uint256 sharesAndLockUntil)' const tvl = async (timestamp, ethBlock, {[CHAIN]: block}) => { diff --git a/projects/caviar-v2/index.js b/projects/caviar-v2/index.js new file mode 100644 index 00000000000..798bffd0ba7 --- /dev/null +++ b/projects/caviar-v2/index.js @@ -0,0 +1,24 @@ +const { getLogs, } = require('../helper/cache/getLogs') +const { sumTokens2 } = require('../helper/unwrapLPs') + +async function tvl(_, _b, _cb, { api, }) { + const factory = '0xa16be8d32934a9aab272102ac4bb890481f4074e' + const logs = await getLogs({ + api, + target: factory, + topics: ['0x2e8b0eeead8b24c71386db9f08f074489fc7ceed52e7ee8a3ad4ab50b9c8c4f4'], + fromBlock: 16480338, + eventAbi: 'event Create(address indexed privatePool, uint256[] tokenIds, uint256 baseTokenAmount)', + onlyArgs: true, + }) + const pools = logs.map(i => i.privatePool) + const tokens = await api.multiCall({ abi: 'address:baseToken', calls: pools}) + const nfts = await api.multiCall({ abi: 'address:nft', calls: pools}) + const ownerTokens = pools.map((v, i) => [[tokens[i], nfts[i]], v]) + return sumTokens2({ ownerTokens, api}) +} + +module.exports = { + misrepresentedTokens: true, + ethereum: { tvl } +} \ No newline at end of file diff --git a/projects/caviar/index.js b/projects/caviar/index.js new file mode 100644 index 00000000000..d9e7879574e --- /dev/null +++ b/projects/caviar/index.js @@ -0,0 +1,27 @@ +const { getLogs, } = require('../helper/cache/getLogs') +const sdk = require('@defillama/sdk') +const { getUniqueAddresses } = require('../helper/utils') + +async function tvl(_, _b, _cb, { api, }) { + const factory = '0xa964d6e8d90e5cd12592a8ef2b1735dae9ba0840' + const logs = await getLogs({ + api, + target: factory, + topics: ['0x94e35d08a6788cb2901c35019eb1105f35dcfdac00943412ebe0236470ee420f'], + fromBlock: 16480338, + eventAbi: 'event Create (address indexed nft, address indexed baseToken, bytes32 indexed merkleRoot)', + onlyArgs: true, + }) + const calls = logs.map(i => ([i.nft, i.baseToken, i.merkleRoot])) + const pools = await api.multiCall({ abi: "function pairs(address, address, bytes32) view returns (address)", calls: calls.map(i => ({ params: i })), target: factory }) + let { output: balances } = await sdk.api.eth.getBalances({ block: _b, targets: getUniqueAddresses(pools) }) + balances = balances.reduce((agg, i) => agg + i.balance/1e18, 0) + return { + ethereum: balances * 2, + } +} + +module.exports = { + misrepresentedTokens: true, + ethereum: { tvl } +} \ No newline at end of file diff --git a/projects/cega/abi.json b/projects/cega/abi.json new file mode 100644 index 00000000000..eddc17011d5 --- /dev/null +++ b/projects/cega/abi.json @@ -0,0 +1,8 @@ +{ + "sumVaultUnderlyingAmounts": "uint256:sumVaultUnderlyingAmounts", + "queuedDepositsTotalAmount": "uint256:queuedDepositsTotalAmount", + "getProductNames": "string[]:getProductNames", + "products": "function products(string) view returns (address)", + "getLOVVaultMetadata": "function getLOVVaultMetadata(address productAddress, uint256 leverage) view returns (tuple(uint256 vaultStart, uint256 tradeDate, uint256 tradeExpiry, uint256 aprBps, uint256 tenorInDays, uint256 underlyingAmount, uint256 currentAssetAmount, uint256 totalCouponPayoff, uint256 vaultFinalPayoff, uint256 queuedWithdrawalsSharesAmount, uint256 queuedWithdrawalsCount, uint256 optionBarriersCount, uint256 leverage, address vaultAddress, uint8 vaultStatus, bool isKnockedIn, tuple(uint256 barrierBps, uint256 barrierAbsoluteValue, uint256 strikeBps, uint256 strikeAbsoluteValue, string asset, string oracleName, uint8 barrierType)[] optionBarriers)[])", + "getLOVProductQueuedDeposits": "function getLOVProductQueuedDeposits(address fcnProductAddress, uint256 leverage) view returns (uint256 totalQueuedDeposits)" +} \ No newline at end of file diff --git a/projects/cega/evm.js b/projects/cega/evm.js new file mode 100644 index 00000000000..dee221d9fed --- /dev/null +++ b/projects/cega/evm.js @@ -0,0 +1,96 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const abi = require("./abi.json"); + +const maxLeverage = 5; +const LOV_SUFFIX = "-lov"; +const config = { + ethereum: { CEGA_STATE: "0x0730AA138062D8Cc54510aa939b533ba7c30f26B", CEGA_PRODUCT_VIEWER: '0x31C73c07Dbd8d026684950b17dD6131eA9BAf2C4', usdcAddress: ADDRESSES.ethereum.USDC, }, + arbitrum: { CEGA_STATE: "0xc809B7F21250B1ce0a61b7Fb645AEf5CE7c1B5ed", CEGA_PRODUCT_VIEWER: '0x8c32a5d9f29da36ed68a9d454eda1b374795b6ca', usdcAddress: ADDRESSES.arbitrum.USDC, }, +} + +// Funds are not lent out +const FCN_PURE_OPTIONS_ADDRESSES = [ + '0x042021d59731d3fFA908c7c4211177137Ba362Ea', // supercharger + '0x56F00A399151EC74cf7bE8DC38225363E84975E6', // go fast + '0x784e3C592A6231D92046bd73508B3aAe3A7cc815', // insanic +]; + +// Funds are lent out 100% +const FCN_BOND_AND_OPTIONS_ADDRESSES = [ + '0xAB8631417271Dbb928169F060880e289877Ff158', // starboard + '0xcf81b51AecF6d88dF12Ed492b7b7f95bBc24B8Af', // autopilot + '0x80ec1c0da9bfBB8229A1332D40615C5bA2AbbEA8', // cruise control + '0x94C5D3C2fE4EF2477E562EEE7CCCF07Ee273B108', // genesis basket +]; + +async function getProducts(api) { + const { CEGA_STATE } = config[api.chain] + const productNames = await api.call({ target: CEGA_STATE, abi: abi.getProductNames, }) + const LOVProductNames = productNames.filter(v => v.includes(LOV_SUFFIX)) + return api.multiCall({ target: CEGA_STATE, abi: abi.products, calls: LOVProductNames }) +} + + +async function getSumFCNProductDeposits(fcnProducts, api) { + return api.multiCall({ calls: fcnProducts, abi: abi.sumVaultUnderlyingAmounts, }) +} + +async function getSumFCNProductQueuedDeposits(fcnProducts, api) { + return api.multiCall({ calls: fcnProducts, abi: abi.queuedDepositsTotalAmount, }) +} + +function getLOVCalls(lovProducts) { + const calls = [] + for (const product of lovProducts) + for (let i = 2; i < maxLeverage; i++) + calls.push([product, i]) + return calls.map(i => ({ params: i })) +} + +async function getSumLOVProductDeposits(lovProducts, api) { + const { CEGA_PRODUCT_VIEWER } = config[api.chain] + const calls = getLOVCalls(lovProducts) + return (await api.multiCall({ target: CEGA_PRODUCT_VIEWER, abi: abi.getLOVVaultMetadata, calls })).map(i => i.map(j => j.underlyingAmount)).flat() +} + +async function getSumLOVProductQueuedDeposits(lovProducts, api) { + const { CEGA_PRODUCT_VIEWER } = config[api.chain] + const calls = getLOVCalls(lovProducts) + return await api.multiCall({ target: CEGA_PRODUCT_VIEWER, abi: abi.getLOVProductQueuedDeposits, calls }) +} + +async function getEthereumTvl(_, _1, _2, { api }) { + const { usdcAddress } = config[api.chain] + const lovProducts = await getProducts(api); + const calls = [ + getSumLOVProductDeposits(lovProducts, api), + getSumLOVProductQueuedDeposits(lovProducts, api) + ] + if (api.chain === 'ethereum') { + calls.push(getSumFCNProductDeposits(FCN_PURE_OPTIONS_ADDRESSES, api), getSumFCNProductQueuedDeposits(FCN_PURE_OPTIONS_ADDRESSES, api)) + } + const results = await Promise.all(calls); + const sum = results.flat().flat().reduce((total, currentValue) => total + +currentValue, 0); + api.add(usdcAddress, sum) + return api.getBalances() +} + +async function getBorrowedTvl(_, _1, _2, { api }) { + const { usdcAddress } = config[api.chain] + const results = await Promise.all([ + getSumFCNProductDeposits(FCN_BOND_AND_OPTIONS_ADDRESSES, api), + getSumFCNProductQueuedDeposits(FCN_BOND_AND_OPTIONS_ADDRESSES, api), + ]); + const sum = results.flat().flat().reduce((total, currentValue) => total + +currentValue, 0); + api.add(usdcAddress, sum) +} + +module.exports = { + ethereum: { + tvl: getEthereumTvl, + borrowed: getBorrowedTvl, + }, + arbitrum: { + tvl: getEthereumTvl, + }, +} \ No newline at end of file diff --git a/projects/cega/index.js b/projects/cega/index.js index ec0b9e361ea..f6d5585f13f 100644 --- a/projects/cega/index.js +++ b/projects/cega/index.js @@ -1,67 +1,8 @@ -const { Program } = require("@project-serum/anchor"); -const { getProvider, sumTokens2, getTokenBalance, } = require("../helper/solana"); -const sdk = require('@defillama/sdk') -const idl = require("./idl.json"); -const MM_multisigs = [ - '0xBdaF8c2BAA14f322e1429Ae3869B005590Ea1FF8', - '0x0fEcA1Ff36AbA721BAEd6C6248b6745C88AF1dDF', - '0x1d14E27221F1b3c690Fc3cced827bEE4892d0698', - '0x60daD1DF74F20fd6d6C07e6FC6153078Cd14a57c', - '0xC6589ad1eed78c50f28249D743A585f7053e7D2C', -] - -const vaultMintAuthority = '4nhbsUdKEwVQXuYDotgdQHoMWW83GvjXENwLsf9QrRJT' -const usdcTokenSpl = 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v' - -async function tvl() { - const products = await getProducts() - const tokenAccounts = [] - products.forEach(({ account: i }) => { - if (!i.isActive || Buffer.from(i.productName).toString().trim().includes("demo")) return; - tokenAccounts.push(i.productUnderlyingTokenAccount.toString()) - }); - - return sumTokens2({ balances: { - ['solana:'+usdcTokenSpl]: await getMMbalance() - }, owner: vaultMintAuthority, tokens: [usdcTokenSpl], tokenAccounts, }); -} - -async function borrowed() { - const products = await getProducts() - const balances = {} - const usdcBalance = await getTokenBalance(usdcTokenSpl, vaultMintAuthority) - sdk.util.sumSingleBalance(balances, usdcTokenSpl, -1 * usdcBalance, 'solana') - sdk.util.sumSingleBalance(balances, usdcTokenSpl, -1 * await getMMbalance(), 'solana') - products.forEach(({ account: i }) => { - if (!i.isActive || Buffer.from(i.productName).toString().trim().includes("demo")) return; - sdk.util.sumSingleBalance(balances,i.underlyingMint.toString(),+i.underlyingAmount, 'solana') - }); - return balances -} - -async function getProducts() { - const provider = getProvider(); - const programId = "3HUeooitcfKX1TSCx2xEpg2W31n6Qfmizu7nnbaEWYzs"; - const program = new Program(idl, programId, provider); - return program.account.product.all(); - -} - -async function getMMbalance() { - const { output: bals } = await sdk.api.abi.multiCall({ - target: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', - abi: 'erc20:balanceOf', - calls: MM_multisigs.map(i => ({ params: i})), - }) - let total = 0 - bals.forEach(({ output: i}) => total += +i) - return total -} +const evm = require("./evm"); +const solana = require("./solana"); module.exports = { timetravel: false, - solana: { - tvl, - borrowed, - }, -}; + ...evm, + ...solana, +}; \ No newline at end of file diff --git a/projects/cega/solana.js b/projects/cega/solana.js new file mode 100644 index 00000000000..13b4579c5fd --- /dev/null +++ b/projects/cega/solana.js @@ -0,0 +1,65 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { Program } = require("@project-serum/anchor"); +const { getProvider} = require("../helper/solana"); +const sdk = require('@defillama/sdk') +const idl = require("./idl.json"); + +const usdcAddress = ADDRESSES.solana.USDC; +const PURE_OPTIONS_PRODUCTS = [ + 'insanic-2', + 'supercharger', + 'go-fast-2' +] + +const OPTIONS_AND_BONDS_PRODUCTS = [ + 'genesis-basket-2', + 'starboard', + 'cruise-control-2', + 'autopilot' +] + +async function getProducts() { + const provider = getProvider(); + const programId = "3HUeooitcfKX1TSCx2xEpg2W31n6Qfmizu7nnbaEWYzs"; + const program = new Program(idl, programId, provider); + return program.account.product.all(); +} + +async function getSolanaTvl() { + const balances = {}; + const products = await getProducts() + let totalAmount = 0; + products.forEach(({ account: i }) => { + const productName = Buffer.from(i.productName).toString().trim(); + if (!i.isActive || productName.includes("test")) return; + const underlyingAmount = i.underlyingAmount.toNumber(); + if(PURE_OPTIONS_PRODUCTS.includes(productName)){ + totalAmount += underlyingAmount; + } + }); + await sdk.util.sumSingleBalance(balances, usdcAddress, totalAmount, "solana"); + return balances; +} + +async function getBorrowedTvl() { + const balances = {}; + const products = await getProducts() + let totalAmount = 0; + products.forEach(({ account: i }) => { + const productName = Buffer.from(i.productName).toString().trim(); + if (!i.isActive || productName.includes("test")) return; + const underlyingAmount = i.underlyingAmount.toNumber(); + if(OPTIONS_AND_BONDS_PRODUCTS.includes(productName)){ + totalAmount += underlyingAmount; + } + }); + await sdk.util.sumSingleBalance(balances, usdcAddress, totalAmount, "solana"); + return balances; +} + +module.exports = { + solana: { + tvl: getSolanaTvl, + borrowed: getBorrowedTvl, + } +} \ No newline at end of file diff --git a/projects/celerbridge/index.js b/projects/celerbridge/index.js index 62b30c5d1cf..4ee0a323bf0 100644 --- a/projects/celerbridge/index.js +++ b/projects/celerbridge/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { chainExports } = require("../helper/exports"); const { sumTokens } = require("../helper/unwrapLPs"); const { getFixBalances } = require('../helper/portedTokens') @@ -25,7 +26,7 @@ config.setProvider("syscoin", new ethers.providers.StaticJsonRpcProvider( const liquidityBridgeContractsV2 = { // NOTE: Some chains have addresses before and after the liquidity bridge upgrade / migration arbitrum: [ - "0xdd90E5E87A2081Dcf0391920868eBc2FFB81a1aF", + ADDRESSES.astar.MATIC, "0x1619DE6B6B20eD217a58d00f37B9d47C7663feca", "0xFe31bFc4f7C9b69246a6dc0087D91a91Cb040f76", "0xEA4B1b0aa3C110c55f650d28159Ce4AD43a4a58b", @@ -41,7 +42,7 @@ const liquidityBridgeContractsV2 = { boba: ["0x841ce48F9446C8E281D3F1444cB859b4A6D0738C", '0x8db213bE5268a2b8B78Af08468ff1EA422073Da0', '0x4C882ec256823eE773B25b414d36F92ef58a7c0C'], bsc: [ "0x5d96d4287D1ff115eE50faC0526cf43eCf79bFc6", - "0xdd90E5E87A2081Dcf0391920868eBc2FFB81a1aF", + ADDRESSES.astar.MATIC, "0x78bc5Ee9F11d133A08b331C2e18fE81BE0Ed02DC", "0x11a0c9270D88C99e221360BCA50c2f6Fda44A980", ], @@ -55,7 +56,7 @@ const liquidityBridgeContractsV2 = { "0x7510792A3B1969F9307F3845CE88e39578f2bAE1", ], fantom: [ - "0x3795C36e7D12A8c252A20C5a7B455f7c57b60283", + ADDRESSES.astar.USDT, "0x374B8a9f3eC5eB2D97ECA84Ea27aCa45aa1C57EF", "0x7D91603E79EA89149BAf73C9038c51669D8F03E9", ], @@ -66,9 +67,9 @@ const liquidityBridgeContractsV2 = { moonbeam: ["0x841ce48F9446C8E281D3F1444cB859b4A6D0738C"], moonriver: ["0x841ce48F9446C8E281D3F1444cB859b4A6D0738C"], oasis: ["0x841ce48F9446C8E281D3F1444cB859b4A6D0738C"], - okexchain: ["0x6a2d262D56735DbA19Dd70682B39F6bE9a931D98"], + okexchain: [ADDRESSES.moonbeam.USDC], optimism: [ - "0x6De33698e9e9b787e09d3Bd7771ef63557E148bb", + ADDRESSES.astar.DAI, "0x9D39Fc627A6d9d9F8C831c16995b209548cc3401", "0xbCfeF6Bb4597e724D720735d32A9249E0640aA11", ], @@ -80,71 +81,70 @@ const liquidityBridgeContractsV2 = { rei: ["0x841ce48F9446C8E281D3F1444cB859b4A6D0738C"], shiden: ["0x841ce48F9446C8E281D3F1444cB859b4A6D0738C", "0xBB7684Cc5408F4DD0921E5c2Cadd547b8f1AD573",], syscoin: ["0x841ce48F9446C8E281D3F1444cB859b4A6D0738C", "0x1E6b1ceAF75936f153ABB7B65FBa57AbaE14e6CE"], - xdai: ["0x3795C36e7D12A8c252A20C5a7B455f7c57b60283"], + xdai: [ADDRESSES.astar.USDT], }; // Tokens added to the liquidity bridges, excluding Celer-Pegged tokens. const liquidityBridgeTokens = [ { // USDT - arbitrum: "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9", - aurora: "0x4988a896b1227218e4A686fdE5EabdcAbd91571f", - avax: "0xc7198437980c041c805A1EDcbA50c1Ce5db95118", - bsc: "0x55d398326f99059ff775485246999027b3197955", - ethereum: "0xdac17f958d2ee523a2206206994597c13d831ec7", - fantom: "0x049d68029688eabf473097a2fc38ef61633a3c7a", - heco: "0xa71edc38d189767582c38a3145b5873052c3e47a", - okexchain: "0x382bb369d343125bfb2117af9c149795c6c65c50", - optimism: "0x94b008aa00579c1307b0ef2c499ad98a8ce58e58", - polygon: "0xc2132d05d31c914a87c6611c10748aeb04b58e8f", - xdai: "0x4ECaBa5870353805a9F068101A40E0f32ed605C6", + arbitrum: ADDRESSES.arbitrum.USDT, + aurora: ADDRESSES.aurora.USDT_e, + avax: ADDRESSES.avax.USDT_e, + bsc: ADDRESSES.bsc.USDT, + ethereum: ADDRESSES.ethereum.USDT, + fantom: ADDRESSES.fantom.fUSDT, + heco: ADDRESSES.heco.USDT, + okexchain: ADDRESSES.okexchain.USDT, + optimism: ADDRESSES.optimism.USDT, + polygon: ADDRESSES.polygon.USDT, + xdai: ADDRESSES.xdai.USDT, }, { // USDC - arbitrum: "0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8", - aurora: "0xB12BFcA5A55806AaF64E99521918A4bf0fC40802", - avax: "0xA7D7079b0FEaD91F3e65f86E8915Cb59c1a4C664", - boba: "0x66a2A913e447d6b4BF33EFbec43aAeF87890FBbc", - bsc: "0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d", - ethereum: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", - fantom: "0x04068da6c83afcfa0e13ba15a6696662335d5b75", + arbitrum: ADDRESSES.arbitrum.USDC, + aurora: ADDRESSES.aurora.USDC_e, + avax: ADDRESSES.avax.USDC_e, + boba: ADDRESSES.boba.USDC, + bsc: ADDRESSES.bsc.USDC, + ethereum: ADDRESSES.ethereum.USDC, + fantom: ADDRESSES.fantom.USDC, harmony: "0x985458e523db3d53125813ed68c274899e9dfab4", - heco: "0x9362bbef4b8313a8aa9f0c9808b80577aa26b73b", - okexchain: "0xc946daf81b08146b1c7a8da2a851ddf2b3eaaf85", - optimism: "0x7f5c764cbc14f9669b88837ca1490cca17c31607", - polygon: "0x2791bca1f2de4661ed88a30c99a7a9449aa84174", - xdai: "0xDDAfbb505ad214D7b80b1f830fcCc89B60fb7A83", + heco: ADDRESSES.heco.USDC_HECO, + okexchain: ADDRESSES.okexchain.USDC, + optimism: ADDRESSES.optimism.USDC, + polygon: ADDRESSES.polygon.USDC, + xdai: ADDRESSES.xdai.USDC, }, { - // BUSD - ethereum: "0x4fabb145d64652a948d72533023f6e7a623c7c53", - bsc: "0xe9e7cea3dedca5984780bafc599bd69add087d56", + ethereum: ADDRESSES.ethereum.BUSD, + bsc: ADDRESSES.bsc.BUSD, }, { // DAI - avax: "0xd586E7F844cEa2F87f50152665BCbc2C279D8d70", + avax: ADDRESSES.avax.DAI, bsc: "0x1af3f329e8be154074d8769d1ffa4ee058b1dbc3", - ethereum: "0x6b175474e89094c44da98b954eedeac495271d0f", - optimism: "0xda10009cbd5d07dd0cecc66161fc93d7c9000da1", - polygon: "0x8f3cf7ad23cd3cadbd9735aff958023239c6a063", + ethereum: ADDRESSES.ethereum.DAI, + optimism: ADDRESSES.optimism.DAI, + polygon: ADDRESSES.polygon.DAI, }, { // WETH - arbitrum: "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1", - avax: "0x49D5c2BdFfac6CE2BFdB6640F4F80f226bc10bAB", - bsc: "0x2170ed0880ac9a755fd29b2688956bd959f933f8", - ethereum: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", + arbitrum: ADDRESSES.arbitrum.WETH, + avax: ADDRESSES.avax.WETH_e, + bsc: ADDRESSES.bsc.ETH, + ethereum: ADDRESSES.ethereum.WETH, fantom: "0x74b23882a30290451A17c44f4F05243b6b58C76d", - optimism: "0x4200000000000000000000000000000000000006", - polygon: "0x7ceb23fd6bc0add59e62ac25578270cff1b9f619", + optimism: ADDRESSES.tombchain.FTM, + polygon: ADDRESSES.polygon.WETH_1, }, { // WBTC - arbitrum: "0x2f2a2543b76a4166549f7aab2e75bef0aefc5b0f", + arbitrum: ADDRESSES.arbitrum.WBTC, avax: "0x50b7545627a5162F82A992c33b87aDc75187B218", - ethereum: "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599", + ethereum: ADDRESSES.ethereum.WBTC, fantom: "0x321162Cd933E2Be498Cd2267a90534A804051b11", - polygon: "0x1bfd67037b42cf73acf2047067bd4f2c47d9bfd6", + polygon: ADDRESSES.polygon.WBTC, }, { // DODO @@ -188,7 +188,7 @@ const liquidityBridgeTokens = [ }, { // BOBA - boba: "0xa18bF3994C0Cc6E3b63ac420308E5383f53120D7", + boba: ADDRESSES.boba.BOBA, ethereum: "0x42bbfa2e77757c645eeaad1655e0911a7553efbc", }, { @@ -204,7 +204,7 @@ const liquidityBridgeTokens = [ { // METIS ethereum: "0x9e32b13ce7f2e80a01932b42553652e053d6ed8e", - metis: "0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000", + metis: ADDRESSES.metis.Metis, }, { // CVP @@ -242,7 +242,7 @@ const liquidityBridgeTokens = [ // USX arbitrum: "0x641441c631e2F909700d2f41FD87F0aA6A6b4EDb", bsc: "0xb5102cee1528ce2c760893034a4603663495fd72", - ethereum: "0x0a5e677a6a24b2f1a2bf4f3bffc443231d2fdec8", + ethereum: ADDRESSES.ethereum.USX, optimism: "0xbfD291DA8A403DAAF7e5E9DC1ec0aCEaCd4848B9", polygon: "0xCf66EB3D546F0415b368d98A95EAF56DeD7aA752", }, @@ -318,9 +318,8 @@ const liquidityBridgeTokens = [ polygon: "0x08648471B5AAd25fEEeb853d6829048f3Fc37786", }, { - // iZi - arbitrum: "0x60D01EC2D5E98Ac51C8B4cF84DfCCE98D527c747", - bsc: "0x60D01EC2D5E98Ac51C8B4cF84DfCCE98D527c747", + arbitrum: ADDRESSES.bsc.iZi, + bsc: ADDRESSES.bsc.iZi, ethereum: "0x9ad37205d608B8b219e6a2573f922094CEc5c200", }, { @@ -364,13 +363,10 @@ const liquidityBridgeTokens = [ ethereum: "0xcA37530E7c5968627BE470081d1C993eb1dEaf90", }, { - // cUSD - celo: "0x765DE816845861e75A25fCA122bb6898B8B1282a", + celo: ADDRESSES.celo.cUSD, }, { - // WSYS - // origin: "syscoin:0xd3e822f3ef011Ca5f17D82C956D952D8d7C3A1BB", - syscoin: "0xd3e822f3ef011Ca5f17D82C956D952D8d7C3A1BB", + syscoin: ADDRESSES.syscoin.WSYS, bsc: "0x6822A778726CD2f0d4A1Cfaca2D04654e575cC82", ethereum: "0xF3C96924d85566C031ddc48DbC63B2d71da6D0f6", }, @@ -384,8 +380,7 @@ const liquidityBridgeTokens = [ ethereum: "0xa02120696c7b8fe16c09c749e4598819b2b0e915", }, { - // FRAX - ethereum: "0x853d955acef822db058eb8505911ed77f175b99e", + ethereum: ADDRESSES.ethereum.FRAX, }, { // FXS @@ -400,16 +395,13 @@ const liquidityBridgeTokens = [ bsc: "0x1fD991fb6c3102873ba68a4e6e6a87B3a5c10271", }, { - // BNB - bsc: "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c", + bsc: ADDRESSES.bsc.WBNB, }, { - // AVAX - avax: "0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7", + avax: ADDRESSES.avax.WAVAX, }, { - // FTM - fantom: "0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83", + fantom: ADDRESSES.fantom.WFTM, }, { // AMY @@ -436,9 +428,7 @@ const liquidityBridgeTokens = [ heco: "0x4668e0E7cC545De886aBF038067F81cD4DC0924b", }, { - // SDN - // origin: "shiden:0x0f933dc137d21ca519ae4c7e93f87a4c8ef365ef", - shiden: "0x0f933dc137d21ca519ae4c7e93f87a4c8ef365ef", + shiden: ADDRESSES.shiden.WSDN, }, { // CONV @@ -449,16 +439,13 @@ const liquidityBridgeTokens = [ avax: "0x4fbf0429599460d327bd5f55625e30e4fc066095", }, { - // MATIC - polygon: "0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270", + polygon: ADDRESSES.polygon.WMATIC_2, }, { - // AAVE - ethereum: "0x7Fc66500c84A76Ad7e9c93437bFc5Ac33E2DDaE9", + ethereum: ADDRESSES.ethereum.AAVE, }, { - // CRV - ethereum: "0xD533a949740bb3306d119CC777fa900bA034cd52", + ethereum: ADDRESSES.ethereum.CRV, }, { // AVG @@ -485,8 +472,7 @@ const liquidityBridgeTokens = [ boba: "0xCe055Ea4f29fFB8bf35E852522B96aB67Cbe8197", }, { - // LUSD - ethereum: "0x5f98805A4E8be255a32880FDeC7F6728C6568bA0", + ethereum: ADDRESSES.ethereum.LUSD, }, { // JONES diff --git a/projects/cells/index.js b/projects/cells/index.js new file mode 100644 index 00000000000..6cc7ec3d6d2 --- /dev/null +++ b/projects/cells/index.js @@ -0,0 +1,7 @@ +module.exports = { + bsc: { tvl: () => 0 }, + arbitrum: { tvl: () => 0 }, + hallmarks: [ + [Math.floor(new Date('2023-06-11') / 1e3), 'Project rugged'], + ], +} \ No newline at end of file diff --git a/projects/cemetery/index.js b/projects/cemetery/index.js index 3e5da335250..cf94ed96647 100644 --- a/projects/cemetery/index.js +++ b/projects/cemetery/index.js @@ -19,6 +19,9 @@ async function tvl(timestamp, block, chainBlocks) { module.exports = { methodology: "TVL includes all farms in MasterChef contract", + hallmarks: [ + [1646524800,"Rug Pull"] + ], fantom: { tvl, staking: staking(hauntchef, haunt, "fantom"), diff --git a/projects/cerberusdao/api.js b/projects/cerberusdao/api.js new file mode 100644 index 00000000000..b83e37f2502 --- /dev/null +++ b/projects/cerberusdao/api.js @@ -0,0 +1,8 @@ +const index = require('./index') + +module.exports = { + ethereum: { + tvl: () => 0, + staking: index.ethereum.staking, + } +} \ No newline at end of file diff --git a/projects/cerberusdao/index.js b/projects/cerberusdao/index.js index d034238e306..3c458fb001c 100644 --- a/projects/cerberusdao/index.js +++ b/projects/cerberusdao/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { ohmTvl } = require('../helper/ohm') const treasury = "0x56D595ea5591D264bc1Ef9E073aF66685F0bFD31" @@ -5,11 +6,11 @@ module.exports = { deadFrom: 1648765747, ...ohmTvl(treasury, [ //SHIB - ["0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE", false], + [ADDRESSES.ethereum.INU, false], //FLOKI ["0x43f11c02439e2736800433b4594994bd43cd066d", false], //WETH - ["0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", false], + [ADDRESSES.ethereum.WETH, false], //uniswap LP shib/weth ["0xb5b6c3816c66fa6bc5b189f49e5b088e2de5082a", true], ], "ethereum", "0x95deaF8dd30380acd6CC5E4E90e5EEf94d258854", "0x8a14897eA5F668f36671678593fAe44Ae23B39FB") diff --git a/projects/cesta/abi.json b/projects/cesta/abi.json index 316661ad3b9..09d3d4c314a 100644 --- a/projects/cesta/abi.json +++ b/projects/cesta/abi.json @@ -1,9 +1,3 @@ { - "getAllPoolInUSD": { - "inputs": [], - "name": "getAllPoolInUSD", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - } -} + "getAllPoolInUSD": "uint256:getAllPoolInUSD" +} \ No newline at end of file diff --git a/projects/cesta/index.js b/projects/cesta/index.js index fef0d9b66cc..832e897b16c 100644 --- a/projects/cesta/index.js +++ b/projects/cesta/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); @@ -8,7 +9,7 @@ async function avax(timestamp, block) { StableAvax: "0xfbE9613a6bd9d28ceF286b01357789b2b02E46f5", StableStable: "0xB103F669E87f67376FB9458A67226f2774a0B4FD", }; - let usd = "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"; + let usd = ADDRESSES.ethereum.USDC; let [DexAvaxTVL, DexStableTVL, StableAvaxTVL, StableStableTVL] = await Promise.all([ diff --git a/projects/cetus/index.js b/projects/cetus/index.js index b3654337955..63232ac61ba 100644 --- a/projects/cetus/index.js +++ b/projects/cetus/index.js @@ -1,8 +1,58 @@ -const { dexExport } = require('../helper/chain/aptos') +const { dexExport, getResources } = require('../helper/chain/aptos') +const sui = require('../helper/chain/sui') +const { transformDexBalances } = require('../helper/portedTokens') +const { PromisePool } = require('@supercharge/promise-pool') +const sdk = require('@defillama/sdk') + +async function tvl() { + let data = await getResources('0xa7f01413d33ba919441888637ca1607ca0ddcbfa3c0a9ddea64743aaa560e498') + const poolAddresses = data.find(i => i.type.includes('::factory::Pools')).data.data.data.map(i => i.value) + data = [] + await PromisePool + .withConcurrency(7) + .for(poolAddresses) + .process(addPool) + + return transformDexBalances({ chain: 'aptos', data }) + + async function addPool(poolAddr) { + const res = await getResources(poolAddr) + const val = res.find(i => i.type.includes('::pool::Pool')) + const [token0, token1] = val.type.split('::pool::Pool<')[1].replace('>', '').split(', ') + data.push({ + token0, + token1, + token0Bal: val.data.coin_a.value, + token1Bal: val.data.coin_b.value, + }) + } +} + +async function suiTVL() { + const { api } = arguments[3] + const poolObjectID = '0xf699e7f2276f5c9a75944b37a0c5b5d9ddfd2471bf6242483b03ab2887d198d0' + const { fields: { list: { fields: listObject } } } = await sui.getObject(poolObjectID) + const items = (await sui.getDynamicFieldObjects({ parent: listObject.id.id })).map(i => i.fields.value.fields.value) + const poolInfo = await sui.getObjects(items.map(i => i.fields.pool_id)) + poolInfo.forEach(({ type: typeStr, fields }) => { + const [coinA, coinB] = typeStr.replace('>', '').split('<')[1].split(', ') + api.add(coinA, fields.coin_a) + api.add(coinB, fields.coin_b) + }) +} module.exports = dexExport({ account: '0xec42a352cc65eca17a9fa85d0fc602295897ed6b8b8af6a6c79ef490eb8f9eba', poolStr: 'amm_swap::Pool<', token0Reserve: i => i.data.coin_a.value, token1Reserve: i => i.data.coin_b.value, -}) \ No newline at end of file +}) + +module.exports = { + aptos: { + tvl: sdk.util.sumChainTvls([module.exports.aptos.tvl, tvl]) + }, + sui: { + tvl: suiTVL, + } +} \ No newline at end of file diff --git a/projects/cexdex-stacking/index.js b/projects/cexdex-stacking/index.js new file mode 100644 index 00000000000..776be9cfc4d --- /dev/null +++ b/projects/cexdex-stacking/index.js @@ -0,0 +1,15 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require("../helper/unwrapLPs"); + +const token_USDC = ADDRESSES.telos.ETH; +const token_USDT = ADDRESSES.moonriver.USDT; +const masterchef = "0x451c3a3594aEB75EDcb13F132dc11D7d2972861A"; + +module.exports = { + kava: { + tvl: sumTokensExport({ + owner: masterchef, + tokens: [token_USDC, token_USDT] + }) + } +} diff --git a/projects/chainport/index.js b/projects/chainport/index.js index 636d7938107..003c2e0557a 100644 --- a/projects/chainport/index.js +++ b/projects/chainport/index.js @@ -1,34 +1,105 @@ -const { get } = require('../helper/http') -let _resposne +const ADDRESSES = require('../helper/coreAssets.json'); +const { sumTokensExport, nullAddress } = require("../helper/sumTokens"); -async function getStats() { - if (!_resposne) _resposne = get('https://api.chainport.io/api/tvl_per_chain') - return _resposne -} +//ETH -function fetchByNetwork(network_name) { - return async () => ({ - tether: +(await getStats())[network_name] - }) -} +const vault1eth = "0x894107b7b5051409f279e8300774b2f62febe057" +const vault2eth = "0xD2238E8c085E5059F8DFC52256530210bc7250F6" +const vault3eth = "0x7B8FDfCf79E72a9a8e656958647D139C0e16EA19" +const vault4eth = "0xfe83475880d3592833249baaacfec5ed51e29d82" +const vault5eth = "0x873089bC765a1C0AFAd48e34fCd305d17D81be87" +const vault6eth = "0x450aD18B4442ce2972Af2a7A12439984db4Afaf9" +const vault7eth = "0x763a0ca93af05ade98a52dc1e5b936b89bf8b89a" + +const portx = "0x104F3152D8ebFC3f679392977356962Ff36566aC" + +//BSC CHAIN + +const vault1bsc = "0x2cd90158baae285010a5ed7c549c2e5b4c0715f4"; +const vault2bsc = "0x873089bC765a1C0AFAd48e34fCd305d17D81be87" + +//Polygon + +const vault1poly= "0xc07cd7fcda887119bff8e1eed2256ad433bee125"; +const vault2poly = "0x873089bC765a1C0AFAd48e34fCd305d17D81be87" + +//Fantom -module.exports = { - timetravel: false, - misrepresentedTokens: true, - methodology: "assets in liquidity are counted as TVL", +const vault1ftm= "0xc30da5144d1b9f47ff86345fee14fe2da94c7203"; +const vault2ftm = "0x873089bC765a1C0AFAd48e34fCd305d17D81be87" + + +const config = { ethereum: { - tvl: fetchByNetwork('ETHEREUM') - }, - polygon: { - tvl: fetchByNetwork('POLYGON') + tokens: [ + nullAddress, + ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.WETH, + ADDRESSES.ethereum.USDT, + ADDRESSES.ethereum.BUSD, + "0x8B3870Df408fF4D7C3A26DF852D41034eDa11d81", + "0x0000000DE40dfa9B17854cBC7869D80f9F98D823", + // "0x42Baf1f659D765C65ADE5BB7E08eb2C680360d9d", //CORNOPIA + // "0xBb3A8FD6Ec4bF0FDc6Cd2739b1e41192D12B1873", OBI + "0x3496B523e5C00a4b4150D6721320CdDb234c3079", + "0x5F0bc16D50F72d10b719dBF6845DE2E599eb5624", + "0x7659CE147D0e714454073a5dd7003544234b6Aa0", + "0x80D55c03180349Fff4a229102F62328220A96444", + "0xD567B5F02b9073aD3a982a099a23Bf019FF11d1c", + "0x4674a4F24C5f63D53F22490Fb3A08eAAAD739ff8", + "0x2653891204F463fb2a2F4f412564b19e955166aE", + "0x43A96962254855F16b925556f9e97BE436A43448", + "0x4da0C48376C277cdBd7Fc6FdC6936DEE3e4AdF75", + "0x8E0fE2947752BE0d5ACF73aaE77362Daf79cB379", + "0xFe459828c90c0BA4bC8b42F5C5D44F316700B430" + ], + owners: [vault1eth, vault2eth, vault3eth, vault4eth, vault5eth, vault6eth, vault7eth], + ownTokens: [portx], }, bsc: { - tvl: fetchByNetwork('BSC') + tokens: [ + nullAddress, + "0x5B6bf0c7f989dE824677cFBD507D9635965e9cD3", + ADDRESSES.bsc.USDC, + ADDRESSES.bsc.BUSD, + ADDRESSES.bsc.BTCB, + ADDRESSES.bsc.WBNB, + "0xF93f6b686f4A6557151455189a9173735D668154" + ], + owners: [vault1bsc, vault2bsc], + }, + polygon: { + tokens: [ + nullAddress, + ADDRESSES.polygon.USDC, + ADDRESSES.polygon.BUSD, + ADDRESSES.polygon.USDT, + "0x04d80CdF20285d5Ac590BBAd97C887b9C6781774", + "0x0000000000004946c0e9F43F4Dee607b0eF1fA1c", + "0xa5Eb60CA85898f8b26e18fF7c7E43623ccbA772C" + ], + owners: [vault1poly, vault2poly], }, fantom: { - tvl: fetchByNetwork('FANTOM') + tokens: [ + nullAddress, + "0x40DF1Ae6074C35047BFF66675488Aa2f9f6384F3", + "0xdc301622e621166BD8E82f2cA0A26c13Ad0BE355" + ], + owners: [vault1ftm, vault2ftm], }, - hallmarks:[ - [1651881600, "UST depeg"], - ], + cardano: { + owners: [ + 'addr1xxcqzje930yw0hykwhf0a89l62dmjwqqpfzdsppf8rhv9rg2czf3yffs8ar450sw50w4xn3pxxwvkz25s4ygh7pjq23ql4slcu', // multi sig cold storage + 'addr1v9nygflpcedeg004tfghu9hdxhg29sv9550sdyvvu4gxepq5ps9ra', // hot bridge address 1 + 'addr1vxku68zc6wrewfkrdaduw2t8yj7nsh0z6mg8vwuxh7pwjxckzjkjq' // hot bridge address 2 + ], + } } + +Object.keys(config).forEach(chain => { + const {owners, tokens} = config[chain] + module.exports[chain] = { + tvl: sumTokensExport({ owners, tokens }) + } +}) \ No newline at end of file diff --git a/projects/chaintools/index.js b/projects/chaintools/index.js new file mode 100644 index 00000000000..79b1d943e7d --- /dev/null +++ b/projects/chaintools/index.js @@ -0,0 +1,18 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const YIELD_BOOSTER_ADDRESS = "0x9954B485E650E067BCAD654F66CD67DAC122123b"; +const YIELD_VAULT_ADDRESS = "0xce2C952B27FCc41F868BDC32c9411F0759378ED0"; +const MULTISIG_ADDRESS = "0xb0Df68E0bf4F54D06A4a448735D2a3d7D97A2222"; +const CTLS_ADDRESS = "0xE155F64B9aD8c81318c313196a60c72e72fD2cD1"; +const UNI_V3_POOL = "0xc53489F27F4d8A1cdceD3BFe397CAF628e8aBC13"; // we cant count liquidity on uni v3 as your tvl +const INCENTIVES_WALLET = "0x9318a070a16E25554f098c6930B506123b66E19d"; // this is EOA, whis is it included in tvl? +const COMPOUNDING_KEEPER_ADDRESS = "0x5648C24Ea7cFE703836924bF2080ceFa44A12cA8"; // this is EOA, whis is it included in tvl? + +const { sumTokensExport } = require('../helper/unwrapLPs') + +module.exports = { + methodology: "Total balances of the Uniswap V3 Pool plus protocol/user controlled balances (in WETH+ETH and CTLS)", + ethereum: { + tvl: sumTokensExport({ owners: [YIELD_VAULT_ADDRESS,], tokens: [ADDRESSES.ethereum.WETH, ADDRESSES.null, ], }), + staking: sumTokensExport({ owners: [YIELD_BOOSTER_ADDRESS, YIELD_VAULT_ADDRESS,], tokens: [CTLS_ADDRESS,], }), + }, +}; diff --git a/projects/chainxyz/index.js b/projects/chainxyz/index.js deleted file mode 100644 index 2815d98316c..00000000000 --- a/projects/chainxyz/index.js +++ /dev/null @@ -1,13 +0,0 @@ -const { stakings } = require('../helper/staking') - -const stakingContracts = [ - '0x23445c63FeEf8D85956dc0f19aDe87606D0e19A9', -] -const xcnToken = '0xA2cd3D43c775978A96BdBf12d733D5A1ED94fb18' - -module.exports = { - ethereum: { - staking: stakings(stakingContracts, xcnToken), - tvl: async () => ({}), - }, -} diff --git a/projects/changex/index.js b/projects/changex/index.js new file mode 100644 index 00000000000..708be7af618 --- /dev/null +++ b/projects/changex/index.js @@ -0,0 +1,29 @@ +const { staking } = require("../helper/staking"); +const { get } = require("../helper/http"); +const CHANGEX_TOKEN_CONTRACT_ETH = "0x7051faed0775f664a0286af4f75ef5ed74e02754"; +const CHANGEX_TOKEN_STAKING_CONTRACT_ETH = + "0x48309699c488ad207Dd9d228bBb013cF848a6e50"; +const CHANGEX_TOKEN_CONTRACT_HYDRA = "bd3c617d271b3467bd9b83dda73c9288de2fb0c9"; +const CHANGEX_TOKEN_STAKING_CONTRACT_HYDRA = + "72c9a79baa83e698bf1dbf44d26e5bdca2d2bab1"; + +async function tvl(_, _1, _2, { api }) { + const data = await get('https://explorer.hydrachain.org/7001/contract/'+CHANGEX_TOKEN_STAKING_CONTRACT_HYDRA) + return { + changex: data.qrc20Balances.find(i => i.addressHex === CHANGEX_TOKEN_CONTRACT_HYDRA)?.balance / 1e18 + } +} + +module.exports = { + timetravel: false, + ethereum: { + tvl: () => ({}), + staking: staking( + CHANGEX_TOKEN_STAKING_CONTRACT_ETH, + CHANGEX_TOKEN_CONTRACT_ETH + ), + }, + hydra: { + staking: tvl, + }, +}; diff --git a/projects/channels/abi.json b/projects/channels/abi.json index 539912138a8..5181f2371dc 100644 --- a/projects/channels/abi.json +++ b/projects/channels/abi.json @@ -1,147 +1,9 @@ { - "markets": { - "constant":true, - "inputs":[ - { - "name":"", - "type":"address" - } - ], - "name":"markets", - "outputs":[ - { - "name":"isSupported", - "type":"bool" - }, - { - "name":"blockNumber", - "type":"uint256" - }, - { - "name":"interestRateModel", - "type":"address" - }, - { - "name":"totalSupply", - "type":"uint256" - }, - { - "name":"supplyRateMantissa", - "type":"uint256" - }, - { - "name":"supplyIndex", - "type":"uint256" - }, - { - "name":"totalBorrows", - "type":"uint256" - }, - { - "name":"borrowRateMantissa", - "type":"uint256" - }, - { - "name":"borrowIndex", - "type":"uint256" - } - ], - "payable":false, - "stateMutability":"view", - "type":"function" - }, - "totalBorrows": { - "constant":true, - "inputs":[ - - ], - "name":"totalBorrows", - "outputs":[ - { - "name":"", - "type":"uint256" - } - ], - "payable":false, - "stateMutability":"view", - "type":"function" - }, - "borrowRatePerBlock": { - "constant":true, - "inputs":[ - - ], - "name":"borrowRatePerBlock", - "outputs":[ - { - "name":"", - "type":"uint256" - } - ], - "payable":false, - "stateMutability":"view", - "type":"function" - }, - "supplyRatePerBlock": { - "constant":true, - "inputs":[ - - ], - "name":"supplyRatePerBlock", - "outputs":[ - { - "name":"", - "type":"uint256" - } - ], - "payable":false, - "stateMutability":"view", - "type":"function" - }, - "underlying": { - "constant": true, - "inputs": [], - "name": "underlying", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function", - "signature": "0x6f307dc3" - }, - "getCash": { - "constant": true, - "inputs": [], - "name": "getCash", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "signature": "0x3b1d21a2", - "stateMutability": "view", - "type": "function" - }, - "getAllMarkets": { - "constant": true, - "inputs": [], - "name": "getAllMarkets", - "outputs": [ - { - "internalType": "contract CToken[]", - "name": "", - "type": "address[]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function", - "signature": "0xb0772d0b" - } -} + "markets": "function markets(address) view returns (bool isSupported, uint256 blockNumber, address interestRateModel, uint256 totalSupply, uint256 supplyRateMantissa, uint256 supplyIndex, uint256 totalBorrows, uint256 borrowRateMantissa, uint256 borrowIndex)", + "totalBorrows": "uint256:totalBorrows", + "borrowRatePerBlock": "uint256:borrowRatePerBlock", + "supplyRatePerBlock": "uint256:supplyRatePerBlock", + "underlying": "address:underlying", + "getCash": "uint256:getCash", + "getAllMarkets": "address[]:getAllMarkets" +} \ No newline at end of file diff --git a/projects/channels/index.js b/projects/channels/index.js index 5aa7a757373..63f235ca880 100644 --- a/projects/channels/index.js +++ b/projects/channels/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { compoundExports } = require('../helper/compound'); const comptroller = { @@ -12,8 +13,8 @@ const ceth = { } const native = { - bsc: "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c", - heco: "0x5545153ccfca01fbd7dd11c0b23ba694d9509a6f", + bsc: ADDRESSES.bsc.WBNB, + heco: ADDRESSES.heco.WHT, } module.exports = { diff --git a/projects/charmfinance/cubePoolAbi.json b/projects/charmfinance/cubePoolAbi.json index ba424f6bc41..5bb50318252 100644 --- a/projects/charmfinance/cubePoolAbi.json +++ b/projects/charmfinance/cubePoolAbi.json @@ -1,15 +1,3 @@ { - "poolBalance": { - "inputs": [], - "name": "poolBalance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -} + "poolBalance": "uint256:poolBalance" +} \ No newline at end of file diff --git a/projects/charmfinance/index.js b/projects/charmfinance/index.js index e6a0040eaeb..73243beaece 100644 --- a/projects/charmfinance/index.js +++ b/projects/charmfinance/index.js @@ -1,13 +1,15 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); -const axios = require("axios"); +const { getConfig } = require('../helper/cache') + const { sumTokens } = require('../helper/unwrapLPs') const vaultAbi = require("./vaultAbi.json"); const cubePoolAbi = require("./cubePoolAbi.json"); -const USDC = "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"; -const WBTC = "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599"; -const ETH = "0x0000000000000000000000000000000000000000"; +const USDC = ADDRESSES.ethereum.USDC; +const WBTC = ADDRESSES.ethereum.WBTC; +const ETH = ADDRESSES.null; const vaults = [ // Old alpha vault - v0 @@ -24,10 +26,10 @@ async function tvl(timestamp, block) { let balances = {}; const optionsContracts = ( - await axios.get( + await getConfig('charm-finance', "https://raw.githubusercontent.com/charmfinance/options-protocol/main/markets.yaml" ) - ).data; + ); const optionsContractsWithoutComments = optionsContracts .split('\n') @@ -59,9 +61,10 @@ async function tvl(timestamp, block) { }) return sumTokens(balances, tokensAndOwners, block) -}; +} module.exports = { + doublecounted: true, ethereum: { tvl, }, diff --git a/projects/charmfinance/vaultAbi.json b/projects/charmfinance/vaultAbi.json index 6c11bc01a90..42f9b9e00d9 100644 --- a/projects/charmfinance/vaultAbi.json +++ b/projects/charmfinance/vaultAbi.json @@ -1,46 +1,5 @@ { - "getTotalAmounts": { - "inputs": [], - "name": "getTotalAmounts", - "outputs": [ - { - "internalType": "uint256", - "name": "total0", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "total1", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "token0": { - "inputs": [], - "name": "token0", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "token1": { - "inputs": [], - "name": "token1", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } + "getTotalAmounts": "function getTotalAmounts() view returns (uint256 total0, uint256 total1)", + "token0": "address:token0", + "token1": "address:token1" } \ No newline at end of file diff --git a/projects/chee-finance/index.js b/projects/chee-finance/index.js index 1448ce46bbc..afd6c95ed49 100644 --- a/projects/chee-finance/index.js +++ b/projects/chee-finance/index.js @@ -1,11 +1,10 @@ -const {compoundExports, compoundExportsWithAsyncTransform} = require('../helper/compound') -const sdk = require("@defillama/sdk"); -const BigNumber = require("bignumber.js"); +const ADDRESSES = require('../helper/coreAssets.json') +const {compoundExports } = require('../helper/compound') module.exports={ hallmarks: [ ], - celo:compoundExports("0x9BD4Fd10b531ae07437676dfE3FA6f505032CB64", "celo", "0x9de4171EDc1F69EAD07f7595bD3beD62d9215532", "0x471EcE3750Da237f93B8E339c536989b8978a438"), - meter:compoundExports("0xcc0BfaD4e684023B18e0adfEcaEDd800D91dc8B5", "meter", "0xbF5cffE28d3CbA3376Cd02fF12eBECa43Bc3f14A", "0x160361ce13ec33C993b5cCA8f62B6864943eb083"), - bsc:compoundExports("0x0E00Ae24B84148ee93Ce2Cf4F52dE277C91B0B72", "bsc", "0x9437Ea5b08AC7f9dc553861dfE1AA77EE0F2aE69", "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c"), + celo:compoundExports("0x9BD4Fd10b531ae07437676dfE3FA6f505032CB64", "celo", "0x9de4171EDc1F69EAD07f7595bD3beD62d9215532", ADDRESSES.celo.CELO), + meter:compoundExports("0xcc0BfaD4e684023B18e0adfEcaEDd800D91dc8B5", "meter", "0xbF5cffE28d3CbA3376Cd02fF12eBECa43Bc3f14A", ADDRESSES.meter.WMTR), + bsc:compoundExports("0x0E00Ae24B84148ee93Ce2Cf4F52dE277C91B0B72", "bsc", "0x9437Ea5b08AC7f9dc553861dfE1AA77EE0F2aE69", ADDRESSES.bsc.WBNB), } \ No newline at end of file diff --git a/projects/cherryswap/index.js b/projects/cherryswap/index.js index 84c4855088a..be6b15d9b5a 100644 --- a/projects/cherryswap/index.js +++ b/projects/cherryswap/index.js @@ -1,7 +1,8 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { staking } = require('../helper/staking') const { getUniTVL } = require('../helper/unknownTokens') -const che = "0x8179d97eb6488860d816e3ecafe694a4153f216c" +const che = ADDRESSES.okexchain.CHE const cheStaking = "0x9Ab8BCf67fE8d8D2aD27D42Ec2A0fD5C206DAE60" module.exports = { @@ -10,7 +11,6 @@ module.exports = { staking: staking(cheStaking, che, "okexchain", "okexchain:" + che), tvl: getUniTVL({ factory: '0x709102921812b3276a65092fe79edfc76c4d4afe', - chain: 'okexchain', useDefaultCoreAssets: true, }) }, diff --git a/projects/chest-finance/index.js b/projects/chest-finance/index.js index b135fac5a91..8ddd3f400ac 100644 --- a/projects/chest-finance/index.js +++ b/projects/chest-finance/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens2, } = require("../helper/solana"); // SOL chest owner: https://solscan.io/account/3SGP67y3XAxZivaz2peNTxS6E44cQXErnEMyBXaCeT2n @@ -5,7 +6,7 @@ const SOL_chest_owner = "3SGP67y3XAxZivaz2peNTxS6E44cQXErnEMyBXaCeT2n"; const mSOL = "mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So"; const soETH = "2FPyTwcZLUg1MDrwsyoP4D6s1tM7hAkHYRjkNb5w6Pxk"; const BTC = "9n4nbM75f5Ui33ZbPYXn59EwSgE8CGsHtAeTH5YFeJ9E"; -const USDC = "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"; +const USDC = ADDRESSES.solana.USDC; const CASH = "CASHVDm2wsJXfhj6VWxb7GiMdoLc17Du7paH4bNr5woT"; async function solanaTVL() { diff --git a/projects/chfry/abi.json b/projects/chfry/abi.json index 1ffcd31b1d3..77c1a6b7b17 100644 --- a/projects/chfry/abi.json +++ b/projects/chfry/abi.json @@ -1,13 +1,3 @@ { - "getTotalDeposited": { - "inputs": [], - "name": "totalDeposited", - "outputs": [{ - "internalType": "uint256", - "name": "", - "type": "uint256" - }], - "stateMutability": "view", - "type": "function" - } + "getTotalDeposited": "uint256:totalDeposited" } \ No newline at end of file diff --git a/projects/chfry/index.js b/projects/chfry/index.js index 728181db318..0da57323d8d 100644 --- a/projects/chfry/index.js +++ b/projects/chfry/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const abi = require('./abi.json'); const BigNumber = require("bignumber.js"); @@ -12,9 +13,9 @@ const fryerContracts = [ "0x7E271Eb034dFc47B041ADf74b24Fb88E687abA9C", ] -const USDT = "0xdac17f958d2ee523a2206206994597c13d831ec7"; -const DAI = "0x6b175474e89094c44da98b954eedeac495271d0f"; -const USDC = "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"; +const USDT = ADDRESSES.ethereum.USDT; +const DAI = ADDRESSES.ethereum.DAI; +const USDC = ADDRESSES.ethereum.USDC; async function tvl(timestamp, block) { let balances = {}; diff --git a/projects/chickenswap/abi.json b/projects/chickenswap/abi.json index 6f18d7e1098..9a372851ed8 100644 --- a/projects/chickenswap/abi.json +++ b/projects/chickenswap/abi.json @@ -1,62 +1,5 @@ { - "poolInfo": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "poolInfo", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "lpToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "allocPoint", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastRewardBlock", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accChickenPerShare", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "token": { - "inputs": [], - "name": "token", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "balance": { - "inputs": [], - "name": "balance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } + "poolInfo": "function poolInfo(uint256) view returns (address lpToken, uint256 allocPoint, uint256 lastRewardBlock, uint256 accChickenPerShare)", + "token": "address:token", + "balance": "uint256:balance" } \ No newline at end of file diff --git a/projects/chocodoge/index.js b/projects/chocodoge/index.js index 4950129cb73..a6a90fbe163 100644 --- a/projects/chocodoge/index.js +++ b/projects/chocodoge/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { unknownTombs, sumTokensExport, } = require('../helper/unknownTokens') const chain = 'dogechain' @@ -24,9 +25,9 @@ module.exports = unknownTombs({ }) module.exports[chain].tvl = sumTokensExport({ chain, owner: genesisPool, tokens: [ - '0x7B4328c127B85369D9f82ca0503B000D09CF9180', + ADDRESSES.dogechain.DC, '0x68609eA0b8393258d0d7EF21401E1Cd3B00A714e', - '0x765277EebeCA2e31912C9946eAe1021199B39C61', - '0xB7ddC6414bf4F5515b52D8BdD69973Ae205ff101', + ADDRESSES.shiden.ETH, + ADDRESSES.dogechain.WWDOGE, ], useDefaultCoreAssets: true, }) module.exports.misrepresentedTokens = true diff --git a/projects/chronos/index.js b/projects/chronos/index.js new file mode 100644 index 00000000000..e92e057991b --- /dev/null +++ b/projects/chronos/index.js @@ -0,0 +1,10 @@ +const { getUniTVL } = require('../helper/unknownTokens') + + +module.exports = { + misrepresentedTokens: true, + methodology: `Uses factory(0xCe9240869391928253Ed9cc9Bcb8cb98CB5B0722) address to count liquidity in pools as TVL.`, + arbitrum: { + tvl: getUniTVL({ factory: '0xCe9240869391928253Ed9cc9Bcb8cb98CB5B0722', useDefaultCoreAssets: true, hasStablePools: true }), + } +}; diff --git a/projects/cian/index.js b/projects/cian/index.js index 572fc24ec59..474631f237f 100644 --- a/projects/cian/index.js +++ b/projects/cian/index.js @@ -1,22 +1,37 @@ -const { get } = require('../helper/http') +const { get } = require("../helper/http"); const { toUSDTBalances } = require("../helper/balances"); +async function fetchEthereum() { + const value = await get("https://data.cian.app/ethereum/api/v1/tvl"); + + return toUSDTBalances(value); +} + async function fetchAvax() { - const value = ( - await get("https://data.cian.app/tvl ") - ); + const value = await get("https://data.cian.app/tvl"); return toUSDTBalances(value); } async function fetchPolygon() { - const value = ( - await get("https://data.cian.app/polygon/api/v1/tvl") - ) + const value = await get("https://data.cian.app/polygon/api/v1/tvl"); + + return toUSDTBalances(value); +} + +async function fetchArbitrum() { + const value = await get("https://data.cian.app/arbitrum/api/v1/tvl"); return toUSDTBalances(value); } +async function fetchOptimism() { + const value = await get("https://data.cian.app/optimism/api/v1/tvl"); + + return toUSDTBalances(value); +} + + module.exports = { misrepresentedTokens: true, doublecounted: true, @@ -27,4 +42,13 @@ module.exports = { polygon: { tvl: fetchPolygon, }, + ethereum: { + tvl: fetchEthereum, + }, + arbitrum: { + tvl: fetchArbitrum, + }, + optimism: { + tvl: fetchOptimism, + }, }; diff --git a/projects/citadao/index.js b/projects/citadao/index.js new file mode 100644 index 00000000000..e05e4c8fce0 --- /dev/null +++ b/projects/citadao/index.js @@ -0,0 +1,20 @@ +const { staking } = require('../helper/staking') +const { unwrapUniswapV3NFTs } = require('../helper/unwrapLPs') + +async function tvl(_, _b, _cb, { api, }) { + return unwrapUniswapV3NFTs({ + owners: [ + '0xc8b1039928a98d7a272f6942d86814ed9d8f9f17', + '0x3f96c580436dd59404ba612bf6d8079dc10f6f7e', + '0xda62d109064138c14d45085b6e49568e1c0b4e23', + ] + }) +} + +module.exports = { + ethereum: { + tvl: () => 0, + pool2: tvl, + staking: staking('0x20891b408c35e0b7ece14df59f259be3c763f120', '0x3541a5c1b04adaba0b83f161747815cd7b1516bc'), + } +} diff --git a/projects/citrus/index.js b/projects/citrus/index.js new file mode 100644 index 00000000000..66c4689d55d --- /dev/null +++ b/projects/citrus/index.js @@ -0,0 +1,229 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { getProvider, } = require('../helper/solana'); +const { Program } = require("@project-serum/anchor"); +const { getConfig } = require('../helper/cache'); +const axios = require("axios"); + +let stats + +async function getStats() { + if (!stats) stats = fetchStats() + return stats + + async function getCollections() { + const collections = (await axios.get(`https://citrus.famousfoxes.com/citrus/allCollections`)).data; + const collectionsById = {}; + collections.map(c => { + collectionsById[c.id] = c; + }); + return collectionsById; + } + + async function fetchStats() { + const programId = 'JCFRaPv7852ESRwJJGRy2mysUMydXZgVVhrMLmExvmVp'; + const provider = getProvider(); + // const collectionsById = await getCollections(); + // const idl = await getConfig('citrus-idl', 'https://gist.githubusercontent.com/FoxyDev42/5f23cd03eab33e0d73f6f6227912451e/raw/03e68f7543dc4dd399d7b61e15881c1a6792eb4a/citrus-account.json'); + const program = new Program(idl, programId, provider) + const loans = await program.account.loan.all() + const activeLoans = loans.filter(loan => Object.keys(loan.account.status)[0] === 'active'); + const openOffers = loans.filter(loan => Object.keys(loan.account.status)[0] === 'waitingForBorrower'); + const activeLoansTotal = activeLoans.map(loan => loan.account.loanTerms.principal).reduce((a, b) => a.add(b)); + const openOffersTotal = openOffers.map(loan => loan.account.loanTerms.principal).reduce((a, b) => a.add(b)); + // const activeLoansNFTs = activeLoans.map(loan => loan.account.collectionConfig.toBase58()).reduce((a, b) => a + parseFloat(collectionsById[b]?.floor), 0); + // const tvl = openOffersTotal.toNumber() + activeLoansNFTs * 1e9; + const tvl = openOffersTotal.toNumber() + const borrowed = activeLoansTotal.toNumber(); + return { tvl, borrowed } + } +} + +const tvl = async () => { + return { ['solana:' + ADDRESSES.solana.SOL]: (await getStats()).tvl } +}; + +const borrowed = async () => { + return { ['solana:' + ADDRESSES.solana.SOL]: (await getStats()).borrowed } +} + +module.exports = { + timetravel: false, + methodology: 'TVL is amount of SOL available to be borrowed', + solana: { + tvl, + borrowed, + } +}; + +const idl = { + version: '0.1.0', + name: 'citrus', + instructions: [], + accounts: [ + { + name: 'loan', + type: { + kind: 'struct', + fields: [ + { + name: 'bump', + type: 'u8' + }, + { + name: 'lender', + type: 'publicKey' + }, + { + name: 'borrower', + type: 'publicKey' + }, + { + name: 'mint', + type: 'publicKey' + }, + { + name: 'collectionConfig', + type: 'publicKey' + }, + { + name: 'status', + type: { + defined: 'LoanStatus' + } + }, + { + name: 'loanTerms', + type: { + defined: 'LoanTerms' + } + }, + { + name: 'creationTime', + type: 'i64' + }, + { + name: 'startTime', + type: 'i64' + }, + { + name: 'endTime', + type: 'i64' + }, + { + name: 'fox', + type: 'bool' + }, + { + name: 'mortgage', + type: 'bool' + }, + { + name: 'private', + type: 'bool' + }, + { + name: 'offerType', + type: { + defined: 'OfferType' + } + }, + { + name: 'listingPrice', + type: 'u64' + }, + { + name: 'ltvTerms', + type: { + option: { + defined: 'LtvTerms' + } + } + } + ] + } + } + ], + types: [ + { + name: 'LoanTerms', + type: { + kind: 'struct', + fields: [ + { + name: 'apyBps', + type: 'u64' + }, + { + name: 'duration', + type: 'u64' + }, + { + name: 'principal', + type: 'u64' + } + ] + } + }, + { + name: 'LtvTerms', + type: { + kind: 'struct', + fields: [ + { + name: 'ltvBps', + type: 'u64' + }, + { + name: 'maxOffer', + type: 'u64' + } + ] + } + }, + { + name: 'LoanStatus', + type: { + kind: 'enum', + variants: [ + { + name: 'WaitingForBorrower' + }, + { + name: 'WaitingForLender' + }, + { + name: 'Active' + }, + { + name: 'Repaid' + }, + { + name: 'Defaulted' + }, + { + name: 'OnSale' + } + ] + } + }, + { + name: 'OfferType', + type: { + kind: 'enum', + variants: [ + { + name: 'Global' + }, + { + name: 'Mortgage' + }, + { + name: 'Borrow' + } + ] + } + } + ], + events: [], + errors: [] +}; \ No newline at end of file diff --git a/projects/citycoins/index.js b/projects/citycoins/index.js index 47547320fb7..30c82bc51e4 100644 --- a/projects/citycoins/index.js +++ b/projects/citycoins/index.js @@ -1,8 +1,4 @@ -const { get } = require('../helper/http') -const BigNumber = require('bignumber.js') -const sdk = require('@defillama/sdk') - -const STACKS_API = 'https://stacks-node-api.mainnet.stacks.co/extended/v1/address' +const { sumTokensExport, nullAddress } = require('../helper/sumTokens') const NYC_CONTRACT = 'SP2H8PY27SEZ03MWRKS5XABZYQN17ETGQS3527SA5.newyorkcitycoin-core-v1' const NYC_CONTRACT_V2 = 'SPSCWDV3RKV5ZRN1FQD84YE1NQFEDJ9R1F4DYQ11.newyorkcitycoin-core-v2' @@ -11,73 +7,17 @@ const MIAMI_CONTRACT_V2 = 'SP1H1733V5MZ3SZ9XRW9FKYGEZT0JDGEB8Y634C7R.miamicoin-c const MIAMI_CITY_WALLET = 'SM2MARAVW6BEJCD13YV2RHGYHQWT7TDDNMNRB1MVT' const NYC_CITY_WALLET = 'SM18VBF2QYAAHN57Q28E2HSM15F6078JZYZ2FQBCX' -async function tvl() { - const balances = {} - - await Promise.all([ - addStacks(NYC_CONTRACT, balances), - addStacks(MIAMI_CONTRACT, balances), - addStacks(NYC_CONTRACT_V2, balances), - addStacks(MIAMI_CONTRACT_V2, balances), - ]) - return balances -} - -async function staking() { - const balances = {} - - await Promise.all([ - addTokens(NYC_CONTRACT, balances), - addTokens(MIAMI_CONTRACT, balances), - addTokens(NYC_CONTRACT_V2, balances), - addTokens(MIAMI_CONTRACT_V2, balances), - ]) - return balances -} - -async function getStacksBalances(address) { - const url = `${STACKS_API}/${address}/balances` - return get(url) -} - -async function addStacks(address, balances) { - const stx_balance = (await getStacksBalances(address)).stx.balance - sdk.util.sumSingleBalance(balances, 'blockstack', BigNumber(stx_balance).div(1e6).toFixed(0)) -} - -async function addTokens(address, balances) { - const { - fungible_tokens - } = await getStacksBalances(address) - - const decimals = [MIAMI_CONTRACT_V2, NYC_CONTRACT_V2] ? 6 : 0 - - const tokenBalances = { - output: Object.keys(fungible_tokens) - .map(token => - ({ - input: { target: token }, - success: true, - output: BigNumber(fungible_tokens[token].balance / 10 ** decimals).toFixed(0) - })) - } - sdk.util.sumMultiBalanceOf(balances, tokenBalances, true, transformStacksToken) -} - -function transformStacksToken(token) { - token = token.split('::')[1] // take only the part after :: in the token string - - if (token === 'newyorkcitycoin') - return 'nycccoin' // I am guessing coingecko id for NYC city coin is 'nyccoin' hence this replacement - - return token -} - module.exports = { stacks: { - tvl, + tvl: sumTokensExport({ + owners: [NYC_CONTRACT, NYC_CONTRACT_V2, MIAMI_CONTRACT, MIAMI_CONTRACT_V2], + tokens: [nullAddress] + }), // treasury, Note: Treasury has been disabled upon team request since they view it as amount reserved for city governers and does not belong to team - staking, + staking: sumTokensExport({ + owners: [NYC_CONTRACT, NYC_CONTRACT_V2, MIAMI_CONTRACT, MIAMI_CONTRACT_V2], + blacklistedTokens: [nullAddress] + }), }, - methodology: 'Added STX tokens in addresses marked as city wallets as treasury. Added STX in contracts as TVL, and native tokens in it as staking' + methodology: 'Added STX in contracts as TVL, and native tokens in it as staking' }; \ No newline at end of file diff --git a/projects/claimswap-v2/index.js b/projects/claimswap-v2/index.js new file mode 100644 index 00000000000..cbd65db719e --- /dev/null +++ b/projects/claimswap-v2/index.js @@ -0,0 +1,12 @@ +const { sumTokens2 } = require("../helper/unwrapLPs") + +async function tvl(_, _b, _cb, { api, }) { + const pairs = await api.call({ abi: 'address[]:getAllPairs', target: '0x485eac14fafb515f16f87da5e4b59018546a335e' }) + const tokens = await Promise.all(pairs.map(p => api.fetchList({ target: p, lengthAbi: 'uint256:coin_length', itemAbi: 'function coins(uint256 i) view returns (address)' }))) + const ownerTokens = tokens.map((v, i) => [v, pairs[i]]) + return sumTokens2({ api, ownerTokens,}) +} + +module.exports = { + klaytn: { tvl } +} \ No newline at end of file diff --git a/projects/claimswap/index.js b/projects/claimswap/index.js index 567338ef633..2344b32afff 100644 --- a/projects/claimswap/index.js +++ b/projects/claimswap/index.js @@ -1,28 +1,12 @@ -const { get } = require('../helper/http') -const { toUSDTBalances } = require('../helper/balances'); +const { getUniTVL, } = require('../helper/unknownTokens'); +const { staking, } = require('../helper/staking'); -async function fetchLiquidity() { - const claimswapInfo = await get('https://data-api.claimswap.org/dashboard/allpool'); - let totalValue = 0; - for (const pool of claimswapInfo) { - totalValue = totalValue + pool.liquidity; - } - - return toUSDTBalances(totalValue.toFixed(2)); -} - -async function fetchCls() { - const claimswapInfo = await get('https://data-api.claimswap.org/dashboard/index'); - const clsValue = claimswapInfo.claPrice * claimswapInfo.totalClaStaked; - return toUSDTBalances(clsValue.toFixed(2)); -} module.exports = { - methodology: `Tvl counts the tokens locked on AMM pools and staking counts the CLA that has been staked. Data is pulled from the 'dashboard.claimswap.org'`, + methodology: `Tvl counts the tokens locked on AMM pools and staking counts the CLA that has been staked`, klaytn: { - tvl: fetchLiquidity, - staking: fetchCls, + tvl: getUniTVL({ factory: '0x3679c3766E70133Ee4A7eb76031E49d3d1f2B50c', useDefaultCoreAssets: true, }), + staking: staking('0x5f5dec0d6402408ee81f52ab985a9c665b6e6010', '0xcf87f94fd8f6b6f0b479771f10df672f99eada63'), }, misrepresentedTokens: true, - timetravel: false, } \ No newline at end of file diff --git a/projects/claystack/clayABIs/clayMain.json b/projects/claystack/clayABIs/clayMain.json index e474c64cd38..682f269918c 100644 --- a/projects/claystack/clayABIs/clayMain.json +++ b/projects/claystack/clayABIs/clayMain.json @@ -1,25 +1,3 @@ { - "funds": { - "inputs": [], - "name": "funds", - "outputs": [ - { - "internalType": "uint256", - "name": "currentDeposit", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "stakedDeposit", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accruedFees", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } + "funds": "function funds() view returns (uint256 currentDeposit, uint256 stakedDeposit, uint256 accruedFees)" } \ No newline at end of file diff --git a/projects/claystack/index.js b/projects/claystack/index.js index 96f0babb2c2..eb89a2fac4f 100644 --- a/projects/claystack/index.js +++ b/projects/claystack/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk'); const abi = require('./clayABIs/clayMain.json'); @@ -6,7 +7,7 @@ const clayAddresses = { }; const coinAddresses = { - matic: "0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0", + matic: ADDRESSES.ethereum.MATIC, }; async function getClayMaticTvl(_,block) { diff --git a/projects/clearpool/abi.json b/projects/clearpool/abi.json index c6180de78fb..bcacdee158b 100644 --- a/projects/clearpool/abi.json +++ b/projects/clearpool/abi.json @@ -1,15 +1,3 @@ { - "borrows": { - "inputs": [], - "name": "borrows", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -} + "borrows": "uint256:borrows" +} \ No newline at end of file diff --git a/projects/clearpool/index.js b/projects/clearpool/index.js index 36ecf403c3f..90df70d23ad 100644 --- a/projects/clearpool/index.js +++ b/projects/clearpool/index.js @@ -4,24 +4,25 @@ const sdk = require("@defillama/sdk"); const { sumTokens } = require("../helper/unwrapLPs"); const abi = require("./abi.json"); -const { get } = require('../helper/http') +const { getConfig } = require('../helper/cache') + const { stakings } = require('../helper/staking') +const { getLogs } = require('../helper/cache/getLogs') const PoolFactory = "0xde204e5a060ba5d3b63c7a4099712959114c2d48"; const START_BLOCK = 14443222; const polygonPoolURL = 'https://app.clearpool.finance/api/pools' -const ethereumTVL = async (timestamp, block, chainBlocks) => { +const ethereumTVL = async (timestamp, block, chainBlocks, { api }) => { const balances = {}; const Logs = ( - await sdk.api.util.getLogs({ + await getLogs({ + api, target: PoolFactory, topic: "PoolCreated(address,address,address)", - keys: [], fromBlock: START_BLOCK, - toBlock: block, }) - ).output; + ); const tokensAndOwners = []; for (let i = 0; i < Logs.length; i++) { const pool = "0x" + Logs[i].topics[1].substring(26, 66); @@ -32,17 +33,16 @@ const ethereumTVL = async (timestamp, block, chainBlocks) => { return balances; }; -const ethereumBorrowed = async (timestamp, block, chainBlocks) => { +const ethereumBorrowed = async (timestamp, block, _, { api }) => { const totalBorrowed = {}; const Logs = ( - await sdk.api.util.getLogs({ + await getLogs({ + api, target: PoolFactory, topic: "PoolCreated(address,address,address)", - keys: [], fromBlock: START_BLOCK, - toBlock: block, }) - ).output; + ); const pools = [] const tokens = [] @@ -67,7 +67,7 @@ const ethereumBorrowed = async (timestamp, block, chainBlocks) => { const polygonTvl = async (timestamp, _, { polygon: block }) => { const balances = {}; const chain = 'polygon' - const poolAllData = await get(polygonPoolURL) + const poolAllData = await getConfig('clearpool-polygon',polygonPoolURL) const poolData = poolAllData["137"] const tokensAndOwners = []; @@ -82,7 +82,7 @@ const polygonTvl = async (timestamp, _, { polygon: block }) => { const polygonBorrowed = async (timestamp, _, { polygon: block }) => { const chain = 'polygon' - const poolAllData = await get(polygonPoolURL) + const poolAllData = await getConfig('clearpool-polygon',polygonPoolURL) const poolData = poolAllData["137"] const totalBorrowed = {}; diff --git a/projects/clever-protocol/index.js b/projects/clever-protocol/index.js index 98dea1f6746..7d38e6c1120 100644 --- a/projects/clever-protocol/index.js +++ b/projects/clever-protocol/index.js @@ -6,7 +6,6 @@ module.exports = { misrepresentedTokens: true, dogechain: { tvl: getUniTVL({ - chain: 'dogechain', factory: FACTORY, useDefaultCoreAssets: true, }), diff --git a/projects/clever/abis/index.json b/projects/clever/abis/index.json index c20f77f0b8d..b07973bf606 100644 --- a/projects/clever/abis/index.json +++ b/projects/clever/abis/index.json @@ -1,109 +1,13 @@ { "curve": { - "coinsUint": { - "name": "coins", - "outputs": [ - { - "type": "address", - "name": "" - } - ], - "inputs": [ - { - "type": "uint256", - "name": "arg0" - } - ], - "stateMutability": "view", - "type": "function", - "gas": 2280 - }, - "coinsInt": { - "name": "coins", - "outputs": [ - { - "type": "address", - "name": "out" - } - ], - "inputs": [ - { - "type": "int128", - "name": "arg0" - } - ], - "constant": true, - "payable": false, - "type": "function", - "gas": 2190 - }, - "balances": { - "stateMutability": "view", - "type": "function", - "name": "balances", - "inputs": [ - { - "name": "arg0", - "type": "uint256" - } - ], - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "gas": 3123 - }, - "balancesOther": { - "name": "balances", - "outputs": [ - { - "type": "uint256", - "name": "" - } - ], - "inputs": [ - { - "type": "int128", - "name": "arg0" - } - ], - "constant": true, - "payable": false, - "type": "function", - "gas": 2340 - } + "coinsUint": "function coins(uint256 arg0) view returns (address) @2280", + "coinsInt": "function coins(int128 arg0) view returns (address out) @2190", + "balances": "function balances(uint256 arg0) view returns (uint256) @3123", + "balancesOther": "function balances(int128 arg0) view returns (uint256) @2340" }, "balancer": { - "getPoolTokens": { - "inputs": [ - { - "internalType": "bytes32", - "name": "poolId", - "type": "bytes32" - } - ], - "name": "getPoolTokens", - "outputs": [ - { - "internalType": "contract IERC20[]", - "name": "tokens", - "type": "address[]" - }, - { - "internalType": "uint256[]", - "name": "balances", - "type": "uint256[]" - }, - { - "internalType": "uint256", - "name": "lastChangeBlock", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } - } + "getPoolTokens": "function getPoolTokens(bytes32 poolId) view returns (address[] tokens, uint256[] balances, uint256 lastChangeBlock)" + }, + "getActiveYieldStrategies": "function getActiveYieldStrategies() view returns (uint256[] _indices, address[] _strategies, address[] _underlyingTokens, address[] _yieldTokens)", + "yieldStrategies": "function yieldStrategies(uint256) view returns (bool isActive, address strategy, address underlyingToken, address yieldToken, uint256 totalShare, uint256 activeYieldTokenAmount, uint256 harvestableYieldTokenAmount, uint256 expectedUnderlyingTokenAmount)" } \ No newline at end of file diff --git a/projects/clever/config.js b/projects/clever/config.js index fce58a1bd69..13640a8fccc 100644 --- a/projects/clever/config.js +++ b/projects/clever/config.js @@ -1,49 +1,62 @@ const tokens = { BalancerContract: '0xba12222222228d8ba445958a75a0704d566bf2c8' }; -const coins = {}; const pools = [ { - id: 'CLEV/ETH', name: 'CLEV/ETH', - coins: [ - coins.weth, - coins.clev, - ], fromPlatform: "Curve", addresses: { - poolAddress: '0x342D1C4Aa76EA6F5E5871b7f11A019a0eB713A4f', - token: '0x6C280dB098dB673d30d5B34eC04B6387185D3620', + lpToken: '0x6C280dB098dB673d30d5B34eC04B6387185D3620', gauge: '0x86e917ad6Cb44F9E6C8D9fA012acF0d0CfcF114f', }, }, { - id: 'clevCVX/CVX', name: 'clevCVX/CVX', - coins: [ - coins.cvx, - coins.clevCVX - ], fromPlatform: "Curve", addresses: { - poolAddress: '0xF9078Fb962A7D13F55d40d49C8AA6472aBD1A5a6', - token: '0xF9078Fb962A7D13F55d40d49C8AA6472aBD1A5a6', + lpToken: '0xF9078Fb962A7D13F55d40d49C8AA6472aBD1A5a6', gauge: '0xF758BE28E93672d1a8482BE15EAf21aa5450F979', }, }, { - id: 'clevCVX/CVX', + name: 'clevCVX/CVX', - coins: [ - coins.cvx, - coins.clevCVX, - ], fromPlatform: "Balancer", addresses: { - poolAddress: '0x69671c808c8f1c1490a4c9e0145884dfb5631378000200000000000000000392', - token: '0x69671c808c8f1c1490a4c9e0145884dfb5631378', + lpToken: '0xf9078fb962a7d13f55d40d49c8aa6472abd1a5a6', gauge: '0x9b02548De409D7aAeE228BfA3ff2bCa70e7a2fe8', }, }, + { + + name: 'abcCVX', + fromPlatform: "Curve", + addresses: { + lpToken: '0xDEC800C2b17c9673570FDF54450dc1bd79c8E359', + gauge: '0xc5022291cA8281745d173bB855DCd34dda67F2f0', + }, + }, +] +const clevers = [ + { + name: 'Frax-USDC', + indice: 1, + metaCleverAddress: '0xEB0ea9D24235aB37196111eeDd656D56Ce4F53b1', + }, + { + name: 'LUSDFraxBP', + indice: 0, + metaCleverAddress: '0xb2Fcee71b25B62baFE442c58AF58c42143673cC1', + }, + { + name: 'TUSDFraxBP', + indice: 0, + metaCleverAddress: '0xad4caC207A0BFEd10dF8A4FC6A28D377caC730E0', + }, + { + name: 'clevUSDFRAXBP', + indice: 0, + metaCleverAddress: '0x2C37F1DcEd208530A05B061A183d8937F686157e', + }, ] -module.exports = { pools, tokens }; \ No newline at end of file +module.exports = { pools, tokens, clevers }; \ No newline at end of file diff --git a/projects/clever/index.js b/projects/clever/index.js index 28ada243fa2..06279aee253 100644 --- a/projects/clever/index.js +++ b/projects/clever/index.js @@ -1,130 +1,50 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const commonAbi = require("./abis/index.json") -const { default: BigNumber } = require("bignumber.js"); -const { createIncrementArray, fetchURL } = require('../helper/utils'); const config = require("./config") -const lockCvxAddress = '0x96C68D861aDa016Ed98c30C810879F9df7c64154'; -const cvxAddress = "0x4e3FBD56CD56c3e72c1403e103b45Db9da5B9D2B"; +const lockCvxAddress = '0x96C68D861aDa016Ed98c30C810879F9df7c64154'; -async function farmTvl(balances, block) { - const { output: gaugeTotalSupplies } = await sdk.api.abi.multiCall({ +async function pool2(_, _1, _2, { api, balances = {}}) { + const gaugeTotalSupplies = await api.multiCall({ abi: 'erc20:totalSupply', calls: config.pools.map(i => ({ target: i.addresses.gauge })), - block, }) - const { output: lpTotalSupplies } = await sdk.api.abi.multiCall({ - abi: 'erc20:totalSupply', - calls: config.pools.map(i => ({ target: i.addresses.token })), - block, + gaugeTotalSupplies.forEach((item, i) => { + const lpToken = config.pools[i].addresses.lpToken + sdk.util.sumSingleBalance(balances, lpToken, item, api.chain) }) - - await Promise.all(config.pools.map(async (item, i) => { - const res = gaugeTotalSupplies.filter((itemSupply) => itemSupply.input.target.toLowerCase() == item.addresses.gauge.toLowerCase()) - const res1 = lpTotalSupplies.filter((itemSupply) => itemSupply.input.target.toLowerCase() == item.addresses.token.toLowerCase()) - let poolSupply = 0; - let totalSupply = 0; - if (res.length && res1.length) { - poolSupply = res[0].output - totalSupply = res1[0].output - } - await getTokenTvl(balances, item, poolSupply, totalSupply, block) - })) + return balances } -async function getTokenTvl(balances, poolData, poolSupply, totalSupply, block) { - const coinsLength = poolData.coins.length - const poolAddress = poolData.addresses.poolAddress - const fromPlatform = poolData.fromPlatform - if (fromPlatform.toLowerCase() == 'curve') { - const coinCalls = createIncrementArray(coinsLength).map(num => { - return { - target: poolAddress, - params: [num] - } - }); - let coins = await sdk.api.abi.multiCall({ - abi: commonAbi.curve.coinsUint, - calls: coinCalls, - block - }) - if (!coins.output[0].success) { - coins = await sdk.api.abi.multiCall({ - abi: commonAbi.curve.coinsInt, - calls: coinCalls, - block - }) - } - let coinBalances = [] - const tokens = coins.output.map(i => { - return i.output; - }) - let tempBalances = (await sdk.api.abi.multiCall({ - abi: commonAbi.curve.balances, - calls: tokens.map((item, index) => { - return { - target: poolAddress, - params: index - } - }), - block - })).output; - tempBalances.map((item, index) => { - coinBalances.push({ coin: tokens[index], balance: item.output }) - }) - coinBalances.map((coinBalance) => { - let coinAddress = coinBalance.coin.toLowerCase() - const balance = BigNumber(poolSupply * coinBalance.balance / totalSupply); - if (!balance.isZero()) { - sdk.util.sumSingleBalance(balances, coinAddress, balance.toFixed(0)) - } - }) - } else { - let balancerInfo = (await sdk.api.abi.call({ - abi: commonAbi.balancer.getPoolTokens, - target: config.tokens.BalancerContract, - params: [poolAddress], - block, - })).output - balancerInfo.tokens.map((coins, index) => { - let coinAddress = coins.toLowerCase() - let coinBalances = balancerInfo.balances[index] - const balance = BigNumber(poolSupply * coinBalances / totalSupply); - if (!balance.isZero()) { - sdk.util.sumSingleBalance(balances, coinAddress, balance.toFixed(0)) - } - }) - } - return balances +async function getClevers(balances, api) { + const yieldStrategiesInfos = await api.multiCall({ + abi: commonAbi.yieldStrategies, + calls: config.clevers.map(i => ({ target: i.metaCleverAddress, params: i.indice })), + }) + yieldStrategiesInfos.forEach((item, i) => { + const underlyingToken = item.underlyingToken + const underlying = item.expectedUnderlyingTokenAmount + sdk.util.sumSingleBalance(balances, underlyingToken, underlying, api.chain) + }) } -async function tvl(timestamp, block) { +async function tvl(timestamp, block, _, { api }) { let balances = {} - await farmTvl(balances, block) - const totalLockedGlobal = (await sdk.api.abi.call({ - target: lockCvxAddress, - block, - abi: { - "inputs": [], - "name": "totalLockedGlobal", - "outputs": [ - { - "internalType": "uint128", - "name": "", - "type": "uint128" - } - ], - "stateMutability": "view", - "type": "function" - } - })).output - if (!BigNumber(totalLockedGlobal).isZero()) { - sdk.util.sumSingleBalance(balances, cvxAddress, BigNumber(totalLockedGlobal).toFixed(0)) - } + const [totalLockedGlobal] = await Promise.all([ + api.call({ + target: lockCvxAddress, + abi: "uint128:totalLockedGlobal", + }), + getClevers(balances, api), + ]) + sdk.util.sumSingleBalance(balances, ADDRESSES.ethereum.CVX, totalLockedGlobal) return balances } + module.exports = { ethereum: { - tvl + tvl, + pool2, } } diff --git a/projects/clipper/index.js b/projects/clipper/index.js index d7eefb7154b..e16e47e7d26 100644 --- a/projects/clipper/index.js +++ b/projects/clipper/index.js @@ -1,7 +1,9 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokensAndLPsSharedOwners } = require('../helper/unwrapLPs') const { getChainTransform } = require('../helper/portedTokens') const sdk = require('@defillama/sdk') -const { get } = require('../helper/http') +const { getConfig } = require('../helper/cache') + const BigNumber = require('bignumber.js') const oldPools = { @@ -13,8 +15,9 @@ const chainConfig = { polygon: { chainId: 137, }, moonbeam: { chainId: 1284, }, optimism: { chainId: 10, }, + arbitrum: { chainId: 42161, }, } -const weth = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2" +const weth = ADDRESSES.ethereum.WETH const moonbeamGLMR = "moonbeam:0x0000000000000000000000000000000000000802" async function getChainData(chain) { @@ -25,7 +28,7 @@ async function getChainData(chain) { address: poolAddress }, assets - } = await get(`https://api.clipper.exchange/rfq/pool?chain_id=${chainId}`) + } = await getConfig('clipper/'+chain,`https://api.clipper.exchange/rfq/pool?chain_id=${chainId}`) return { poolAddress, assets: assets.map(({ address }) => address) diff --git a/projects/clober/abi.json b/projects/clober/abi.json new file mode 100644 index 00000000000..6edec0a4e17 --- /dev/null +++ b/projects/clober/abi.json @@ -0,0 +1,6 @@ +{ + "nonce":"uint256:nonce", + "market":"address:market", + "baseToken":"address:baseToken", + "quoteToken":"address:quoteToken" +} \ No newline at end of file diff --git a/projects/clober/index.js b/projects/clober/index.js new file mode 100644 index 00000000000..dd81310e7be --- /dev/null +++ b/projects/clober/index.js @@ -0,0 +1,56 @@ +const abi = require("./abi.json"); +const { ethers } = require("ethers"); +const { sumTokens2 } = require('../helper/unwrapLPs') + +const contractV1DeployedChainIds = [1, 137, 42161] +const contractV1_1DeployedChainIds = [137, 1101, 42161] + +function calculateSalt(chainId, nonce) { + return ethers.utils.solidityKeccak256(['uint256', 'uint256'], [chainId, nonce]) +} + +async function fetchTokenAddressesV1_0(api, chainId){ + if(!contractV1DeployedChainIds.includes(chainId)){ + return [] + } + return await api.fetchList({ + lengthAbi: abi.nonce, + itemAbi: "function computeTokenAddress(uint256) view returns (address)", + target: "0x93A43391978BFC0bc708d5f55b0Abe7A9ede1B91" + }) +} + +async function fetchTokenAddressesV1_1(api, chainId){ + if (!contractV1_1DeployedChainIds.includes(chainId)) { + return [] + } + const maxNonce = await api.call({ abi: abi.nonce, target: "0x24aC0938C010Fb520F1068e96d78E0458855111D" }) + return await api.multiCall({ + abi: "function computeTokenAddress(bytes32) view returns (address)", + calls: Array.from({length: maxNonce}, (_, i) => i ).map((i, v) => ({ target: "0x58ed1f4913e652baF17C154551bd8E9dbc73fC56", params: calculateSalt(chainId, v) })), + }) +} + +async function tvl(_, _b, _cb, { api }) { + const chainId = await api.getChainId() + let tokenAddresses = [...await fetchTokenAddressesV1_0(api, chainId), ...await fetchTokenAddressesV1_1(api, chainId)] + tokenAddresses = tokenAddresses.flat() + const markets = await api.multiCall({ abi: abi.market, calls: tokenAddresses }) + const base = await api.multiCall({ abi: abi.baseToken, calls: markets}) + const quote = await api.multiCall({ abi: abi.quoteToken, calls: markets}) + const tokens = [base, quote].flat() + const symbols = await api.multiCall({ abi: 'erc20:symbol', calls: tokens}) + const putTokens = tokens.filter((_, i) => symbols[i].includes('$') && symbols[i].endsWith('PUT')) + const ownerTokens = markets.map((v, i) => ([[base[i], quote[i]], v])) + const putQutes = await api.multiCall({ abi: abi.quoteToken, calls: putTokens}) + const putUnderlying = await api.multiCall({ abi: 'address:underlyingToken', calls: putTokens}) + putTokens.forEach((v, i) => ownerTokens.push([[putQutes[i], putUnderlying[i]], v])) + return sumTokens2({ api, ownerTokens, blacklistedTokens: putTokens, }) +} +module.exports = { + methodology: "TVL consists of assets deposited into market contracts", + ethereum: { tvl }, + polygon: { tvl }, + arbitrum: { tvl }, + polygon_zkevm: { tvl } +} \ No newline at end of file diff --git a/projects/cobraswap/index.js b/projects/cobraswap/index.js index 63019d166ea..6e34adb55ca 100644 --- a/projects/cobraswap/index.js +++ b/projects/cobraswap/index.js @@ -1,64 +1,5 @@ -const { calculateUniTvl } = require("../helper/calculateUniTvl"); -const sdk = require("@defillama/sdk"); -const { BigNumber } = require("bignumber.js"); +const { uniTvlExport } = require("../helper/unknownTokens"); const factory = "0x3165d94dd2f71381495cb897832de02710a0dce5"; -async function getCobraPrice(block) { - const chain = "bsc"; - - const busdBalance = (await sdk.api.erc20.balanceOf({ - target: "0xe9e7cea3dedca5984780bafc599bd69add087d56", - owner: "0x1011d0abd6fd3965d34a56f7c1789a19fdd9cf67", - block, - chain - })).output; - - const cobraBalance = (await sdk.api.erc20.balanceOf({ - target: "0x2c449ba613873e7b980faf2b686207d7bd205541", - owner: "0x1011d0abd6fd3965d34a56f7c1789a19fdd9cf67", - block, - chain - })).output; - - return busdBalance/cobraBalance; -} - -async function getViperPrice(block) { - const chain = "bsc"; - - const cobraBalance = (await sdk.api.erc20.balanceOf({ - target: "0x2c449ba613873e7b980faf2b686207d7bd205541", - owner: "0x77a6704a382e5cd8ac74a5994576989d9cede976", - block, - chain - })).output; - - const viperBalance = (await sdk.api.erc20.balanceOf({ - target: "0x7e080699d0f306dbae458b13ea6fa8bfd0efe752", - owner: "0x77a6704a382e5cd8ac74a5994576989d9cede976", - block, - chain - })).output; - - return cobraBalance/viperBalance; -} - -async function tvl(timestamp, block, chainBlocks) { - let balances = await calculateUniTvl(addr=>`bsc:${addr}`, chainBlocks.bsc, "bsc", factory, 9503477, true); - const cobraPrice = await getCobraPrice(chainBlocks.bsc); - const viperPrice = await getViperPrice(chainBlocks.bsc); - sdk.util.sumSingleBalance(balances, "bsc:0xe9e7cea3dedca5984780bafc599bd69add087d56", BigNumber(balances["bsc:0x2c449ba613873e7b980faf2b686207d7bd205541"]).times(cobraPrice).toFixed(0)); - delete balances["bsc:0x2c449ba613873e7b980faf2b686207d7bd205541"]; - sdk.util.sumSingleBalance(balances, "bsc:0xe9e7cea3dedca5984780bafc599bd69add087d56", BigNumber(balances["bsc:0x7e080699d0f306dbae458b13ea6fa8bfd0efe752"]).times(cobraPrice * viperPrice).toFixed(0)); - delete balances["bsc:0x7e080699d0f306dbae458b13ea6fa8bfd0efe752"]; - return balances; -} - -module.exports = { - misrepresentedTokens: true, - methodology: `Include liquidity in AMM pools`, - bsc:{ - tvl - } -} +module.exports = uniTvlExport('bsc', factory) diff --git a/projects/coconuts-finance/abi.json b/projects/coconuts-finance/abi.json index dadad296477..dda88359cae 100644 --- a/projects/coconuts-finance/abi.json +++ b/projects/coconuts-finance/abi.json @@ -1,16 +1,3 @@ { - "totalAssets" : - { - "gas": 4633, - "inputs": [], - "name": "totalAssets", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } + "totalAssets": "uint256:totalAssets" } \ No newline at end of file diff --git a/projects/coconuts-finance/index.js b/projects/coconuts-finance/index.js index 08b07ff886d..69fd9c5358a 100644 --- a/projects/coconuts-finance/index.js +++ b/projects/coconuts-finance/index.js @@ -1,70 +1,6 @@ -const sdk = require('@defillama/sdk'); -const utils = require('../helper/utils'); -const abi = require("./abi.json"); - - -function getAvaxTvl(timestamp, block, chainBlocks) { - return async () => { - let avaxResponse = await utils.fetchURL(`https://coconutsfinance-test.herokuapp.com/api/apys?network=43114`); - let balances = {} - let avaxData = await avaxResponse.data; - for (let i = 0; i < avaxData.length; i++) { - let token = avaxData[i].token - - const balance = (await sdk.api.abi.call({ - abi: abi.totalAssets, - chain: 'avax', - target: avaxData[i].addr, - block: chainBlocks.avax - })).output; - - sdk.util.sumSingleBalance(balances, `avax:${token}`, balance) - - } - - if (balances === 0) { - throw new Error('avax fetch error') - - } - return balances; - } -} - -function getPolygonTvl(timestamp, block, chainBlocks) { - return async () => { - let polyResponse = await utils.fetchURL(`https://coconutsfinance-test.herokuapp.com/api/apys?network=137`); - let balances = {} - let polyData = await polyResponse.data; - - for (let i = 0; i < polyData.length; i++) { - let token = polyData[i].token - - let balance = (await sdk.api.abi.call({ - abi: abi.totalAssets, - chain: 'polygon', - target: polyData[i].addr, - block - })).output; - - sdk.util.sumSingleBalance(balances, `polygon:${token}`, balance) - - } - - if (balances === 0) { - throw new Error(chainId) - - } - return balances; - } -} - module.exports = { avax: { - // tvl: getAvaxTvl() tvl: () => ({}) }, - // polygon: { - // tvl: getPolygonTvl() - // }, broken: 'Api is down' }; diff --git a/projects/coffin/index.js b/projects/coffin/index.js index 62c49acbc86..142116d8f6c 100644 --- a/projects/coffin/index.js +++ b/projects/coffin/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const { staking } = require("../helper/staking"); const { addFundsInMasterChef } = require("../helper/masterchef"); @@ -7,7 +8,7 @@ const MasterChefV1Contract = "0x155482Bd4e5128082D61a2384935D4BBDcb0E7a7"; const MasterChefV2Contract = "0x2447115E9Ba73bd2877821BF69E09259664a2bd5"; const stakingContract = "0x61Befe6E5f20217960bD8659cd3113CC1ca67d2F"; -const WFTM = "0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83"; +const WFTM = ADDRESSES.fantom.WFTM; const ftmTvl = async (timestamp, ethBlock, chainBlocks) => { diff --git a/projects/coindcx/index.js b/projects/coindcx/index.js index 92214b6ce52..f468fd8943b 100644 --- a/projects/coindcx/index.js +++ b/projects/coindcx/index.js @@ -86,14 +86,6 @@ const config = { 'addr1qy7f98r5ar2ayyst7lmm90tl630tsetygecz36vq33qmvevngs3w3w3mt4l3em80z5f9e64j0jj37hazql87nfmzrfqs3f7gum', 'addr1qyu9n5wtyufnp6vuhcak38tx4lw37znzkulat7s987xtv86xx265k42gtvuvkt4vyjjxgqn9wat2zmda3f7ns2pl2y2qwtgdav', 'addr1qyzrghamkktczv3wujrdqt243emzu49zu0z3vxw768kpy0fknd8whx6gnzwtg78yxfuxwu4z8k4zsk9rvx34sxalet5sgjcn56', - 'addr1v8xeul4sslt5xyeaa02vzgquwagv84t9xcjekauja5cz4ws8zuwgw', - 'addr1v90372c396d7w0cw3agseaj8vf4t8m9e3lwwc752jd30hyghzt9yh', - 'addr1v9h690lw5hpd37r4ngmlhf0y8wms394y4dlm0wa6nmann9qavq7y7', - 'addr1v9m8eq44qcqe40yz0jwcuc3vs9t7zr6ukz8ctvfkjma5dmqwkp0ey', - 'addr1vx47g9mejkukkspsp6jdjdzf2lmektye8w7n0cm9ukxvewgtdhjt3', - 'addr1vx824fl32wrgankldpnyt7txz0mel5d9cldfkus4xykl3uq3tw7d0', - 'addr1vy5dqjx4mtegqu6kx5gu6upkk96c8haf38eksj5tr8g5dacs3mfv2', - 'addr1vyzrghamkktczv3wujrdqt243emzu49zu0z3vxw768kpy0gyprm8q', ] }, ripple: { diff --git a/projects/coindrip/index.js b/projects/coindrip/index.js new file mode 100644 index 00000000000..1d717f2d35e --- /dev/null +++ b/projects/coindrip/index.js @@ -0,0 +1,19 @@ +const { toUSDTBalances } = require("../helper/balances"); +const { get } = require("../helper/http"); +const { sumTokensExport } = require('../helper/sumTokens') +const { getCoreAssets } = require('../helper/tokenMapping') + +const API_URL = "https://app.coindrip.finance/api/tvl"; + +async function tvl() { + const data = await get(API_URL); + return toUSDTBalances(data); +} + +module.exports = { + timetravel: false, + elrond: { + tvl: sumTokensExport({ owner: 'erd1qqqqqqqqqqqqqpgqqnm3x37972323nuv3l3kywev0n8q5n6gyc8qwljqz9', whitelistedTokens: getCoreAssets('elrond')}), + vesting: sumTokensExport({ owner: 'erd1qqqqqqqqqqqqqpgqqnm3x37972323nuv3l3kywev0n8q5n6gyc8qwljqz9', blacklistedTokens: getCoreAssets('elrond')}), + }, +}; \ No newline at end of file diff --git a/projects/coinscope/index.js b/projects/coinscope/index.js new file mode 100644 index 00000000000..fef26fb8afa --- /dev/null +++ b/projects/coinscope/index.js @@ -0,0 +1,45 @@ +const ADDRESSES = require('../helper/coreAssets.json') + +const { sumUnknownTokens } = require('../helper/unknownTokens') +module.exports = { + misrepresentedTokens: true, + methodology: "TVL is calculated by summing the values of LP tokens held in lockers for a specific network", +}; + +const lockerFactories = { + ethereum: "0x269D4d211CBc9845B006128717eE51b0D6524955", + bsc: "0x269D4d211CBc9845B006128717eE51b0D6524955", + polygon: "0x269D4d211CBc9845B006128717eE51b0D6524955", + avax: "0x269D4d211CBc9845B006128717eE51b0D6524955", + arbitrum: "0x269D4d211CBc9845B006128717eE51b0D6524955", + cronos: "0x269D4d211CBc9845B006128717eE51b0D6524955", + fantom: "0x269D4d211CBc9845B006128717eE51b0D6524955", + telos: "0x269D4d211CBc9845B006128717eE51b0D6524955", + harmony: "0x097f5E933306ad0EbB1c0027B223a3dd153520BE", +} + +Object.keys(lockerFactories).forEach(chain => { + const factory = lockerFactories[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + let fetchLength = 100 + let page = 0 + const tokensAndOwners = [] + let result + do { + result = await api.call({ + abi: abi.getTokens, + target: factory, + params: [true, page, fetchLength, ADDRESSES.null,], + }) + tokensAndOwners.push(...result.pageTokens.map(i => i.lockerAddresses.map(j => [i.tokenAddress, j]))) + ++page + } while (result.total === tokensAndOwners) + return sumUnknownTokens({ api, tokensAndOwners: tokensAndOwners.flat(), useDefaultCoreAssets: true }) + } + } +}) + +const abi = { + "getTokens": "function getTokens(bool lp, uint256 page, uint256 pageSize, address token) view returns (tuple(address tokenAddress, uint8 decimals, uint256 totalSupply, bool pair, string pairToken1Name, address pairToken1Address, string pairToken2Name, address pairToken2Address, address pairDexAddress, string tokenName, string tokenSymbol, uint256 totalAmountLocked, uint256 currentAmountLocked, address[] lockerAddresses)[] pageTokens, uint256 total)", +} \ No newline at end of file diff --git a/projects/coinswap/index.js b/projects/coinswap/index.js index e3985899c01..81d8c7719ba 100644 --- a/projects/coinswap/index.js +++ b/projects/coinswap/index.js @@ -7,7 +7,6 @@ module.exports = { methodology: 'TVL counts the liquidity of the DEX. The factory address(0xC2D8d27F3196D9989aBf366230a47384010440c0) is used to find every LP pair that has been created.', bsc: { tvl: getUniTVL({ - chain: 'bsc', factory, useDefaultCoreAssets: true, }), diff --git a/projects/coinwind/abi.json b/projects/coinwind/abi.json index f151a2e0e6f..2b700936e6e 100644 --- a/projects/coinwind/abi.json +++ b/projects/coinwind/abi.json @@ -1,241 +1,10 @@ { - "poolLength": { - "inputs": [], - "name": "poolLength", - "outputs": [{ - "internalType": "uint256", - "name": "", - "type": "uint256" - }], - "stateMutability": "view", - "type": "function" - }, - "poolInfo": { - "inputs": [{ - "internalType": "uint256", - "name": "", - "type": "uint256" - }], - "name": "poolInfo", - "outputs": [{ - "internalType": "address", - "name": "token", - "type": "address" - }, { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, { - "internalType": "uint256", - "name": "totalAmount", - "type": "uint256" - }, { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, { - "internalType": "uint256", - "name": "", - "type": "uint256" - }], - "stateMutability": "view", - "type": "function" - }, - "ethPoolInfo": { - "inputs": [{ - "internalType": "uint256", - "name": "", - "type": "uint256" - }], - "name": "poolInfo", - "outputs": [{ - "internalType": "address", - "name": "token", - "type": "address" - }, { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, { - "internalType": "uint256", - "name": "totalAmount", - "type": "uint256" - }, { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, { - "internalType": "uint256", - "name": "", - "type": "uint256" - }], - "stateMutability": "view", - "type": "function" - }, - "daoPoolInfo": { - "inputs": [{ - "internalType": "uint256", - "name": "", - "type": "uint256" - }], - "name": "poolInfo", - "outputs": [{ - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "totalSupply": { - "inputs": [], - "name": "totalSupply", - "outputs": [{ - "internalType": "uint256", - "name": "", - "type": "uint256" - }], - "stateMutability": "view", - "type": "function" - }, - "getReserves": { - "inputs": [], - "name": "getReserves", - "outputs": [{ - "internalType": "uint112", - "name": "_reserve0", - "type": "uint112" - }, { - "internalType": "uint112", - "name": "_reserve1", - "type": "uint112" - }, { - "internalType": "uint32", - "name": "_blockTimestampLast", - "type": "uint32" - }], - "stateMutability": "view", - "type": "function" - }, - "token0": { - "inputs": [], - "name": "token0", - "outputs": [{ - "internalType": "address", - "name": "", - "type": "address" - }], - "stateMutability": "view", - "type": "function" - }, - "token1": { - "inputs": [], - "name": "token1", - "outputs": [{ - "internalType": "address", - "name": "", - "type": "address" - }], - "stateMutability": "view", - "type": "function" - } -} + "poolLength": "uint256:poolLength", + "poolInfo": "function poolInfo(uint256) view returns (address token, uint256, uint256, uint256, uint256, uint256 totalAmount, uint256, uint256, uint256, uint256, uint256)", + "ethPoolInfo": "function poolInfo(uint256) view returns (address token, uint256, uint256, uint256, uint256 totalAmount, uint256, uint256, uint256, uint256, uint256, uint256)", + "daoPoolInfo": "function poolInfo(uint256) view returns (address token, uint256, uint256, uint256, uint256 totalAmount, uint256, uint256, uint256, uint256, uint256, uint256)", + "totalSupply": "uint256:totalSupply", + "getReserves": "function getReserves() view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast)", + "token0": "address:token0", + "token1": "address:token1" +} \ No newline at end of file diff --git a/projects/collectionxyz/index.js b/projects/collectionxyz/index.js new file mode 100644 index 00000000000..ad8c08cfbbc --- /dev/null +++ b/projects/collectionxyz/index.js @@ -0,0 +1,42 @@ +const { getLogs } = require('../helper/cache/getLogs'); +const { sumTokens2, nullAddress } = require('../helper/unwrapLPs'); + +const FACTORY_ADDRESS_1 = '0x03b51826a4868780db375ee27e5b0adaac5274ee'; +const FACTORY_ADDRESS_2 = '0x7a1D4c6E8edbd8a9314034356b29419e1b1B44f0'; +const START_BLOCK_1 = 16932638; +const START_BLOCK_2 = 17277832; +const EVENT_ABI = 'event NewPool (address indexed collection, address indexed poolAddress)'; +const TOPIC_HASH = '0x77948cb83ef3caff9ac13dfab1ea1f8a6875c98370287ce587f5dbc74cc5b6b0'; + +async function getPoolLogs(api, factory, startBlock) { + return await getLogs({ + api, + target: factory, + topics: [TOPIC_HASH], + eventAbi: EVENT_ABI, + onlyArgs: true, + fromBlock: startBlock, + }); +} + +async function getTotalValueLocked(_, _b, _cb, { api }) { + const logsFactory1 = await getPoolLogs(api, FACTORY_ADDRESS_1, START_BLOCK_1); + const logsFactory2 = await getPoolLogs(api, FACTORY_ADDRESS_2, START_BLOCK_2); + const allLogs = [...logsFactory1, ...logsFactory2]; + + api.log('Pool length: ', allLogs.length); + + const tokensAndOwners = allLogs.flatMap(log => [ + [log.collection, log.poolAddress], + [nullAddress, log.poolAddress] + ]); + + return sumTokens2({ api, tokensAndOwners }); +} + +module.exports = { + start: 16945809, + ethereum: { + tvl: getTotalValueLocked, + }, +}; diff --git a/projects/comb/index.js b/projects/comb/index.js index aed954f0260..14d8c3d12a7 100644 --- a/projects/comb/index.js +++ b/projects/comb/index.js @@ -1,17 +1,55 @@ -const utils = require('../helper/utils'); -const { toUSDTBalances } = require('../helper/balances'); +const { get } = require('../helper/http') const { staking } = require('../helper/staking'); +const sdk = require('@defillama/sdk') +const { unwrapLPsAuto, nullAddress } = require('../helper/unwrapLPs') -async function tvl() { - let tvl = 0; - const pools = await utils.fetchURL('https://comb-breakdown.herokuapp.com/pools'); - const vaults = await utils.fetchURL('https://comb-breakdown.herokuapp.com/vaults'); +const vaults = [ + '0xfcba43906259168ea610905e719e86f5b099391b', + '0x6b9c0b05744bbe6e3d8df8bea31a029a12f7c0eb', + '0x77ce0b0e9e629474c69a5d8d5fd9c3e6113dd058', +] +async function tvl(_, _1, _2, { api }) { + const balances = {} + let pools = await get('https://comb-breakdown.herokuapp.com/pools'); + const prices = {} + pools.forEach(i => { + if (i.asset) + prices['fantom:'+i.asset.toLowerCase()] = i.lpPrice/1e18 + }) - pools.data.forEach(pool => tvl += pool.tvl); - vaults.data.forEach(vault => tvl += vault.tvl); - return toUSDTBalances(tvl); + const token = await api.multiCall({ calls: vaults, abi: 'address:token', }) + const supply = await api.multiCall({ calls: vaults, abi: 'uint256:totalSupply', }) + const price = await api.multiCall({ calls: vaults, abi: 'uint256:getPricePerFullShare', }) + + + const masterchef = '0x6e547e6Ab873146eA1E4A12499b0e98Bc18Ea222' + let strategies = await api.fetchList({ + target: masterchef, + itemAbi: 'function strategies(uint256) view returns (address)', + lengthAbi: 'uint256:poolLength' + }) + strategies = strategies.filter(i => i !== nullAddress) + const token2 = await api.multiCall({ calls: strategies, abi: 'address:want', }) + const supply2 = await api.multiCall({ calls: strategies, abi: 'uint256:balanceOf', }) + + token.map((v, i) => { + sdk.util.sumSingleBalance(balances, v.toLowerCase(), supply[i] * price[i] / 1e18, api.chain) + }) + token2.map((v, i) => { + sdk.util.sumSingleBalance(balances, v.toLowerCase(), supply2[i], api.chain) + }) + + await unwrapLPsAuto({ api, balances }) + Object.entries(balances).forEach(([token, bal]) => { + if (prices[token]) { + sdk.util.sumSingleBalance(balances,'tether',prices[token] * bal) + delete balances[token] + } + }) + console.log(prices, balances) + return balances } module.exports = { diff --git a/projects/commodo/index.js b/projects/commodo/index.js new file mode 100644 index 00000000000..35064931579 --- /dev/null +++ b/projects/commodo/index.js @@ -0,0 +1,51 @@ +const { get } = require('../helper/http') +const { transformBalances } = require('../helper/portedTokens') +const { PromisePool } = require('@supercharge/promise-pool') +const sdk = require('@defillama/sdk') + +let data + +async function getData() { + if (!data) data = _getData() + return data + + async function _getData() { + const { assets } = await get('https://rest.comdex.one/comdex/asset/v1beta1/assets') + const assetMap = assets.reduce((a, i) => { + a[i.id] = i.denom + return a + }, {}) + const { pools } = await get('https://rest.comdex.one/comdex/lend/v1beta1/pools') + const balances = { + tvl: {}, + borrowed: {}, + } + + const calls = pools.map(({ pool_id, asset_data }) => { + return asset_data.map(({ asset_id }) => ([asset_id, pool_id])) + }).flat() + + await PromisePool + .withConcurrency(10) + .for(calls) + .process(addPool) + + return balances + + async function addPool([assetId, poolId]) { + const { PoolAssetLBMapping: { total_borrowed, total_lend } } = await get(`https://rest.comdex.one/comdex/lend/v1beta1/pool_asset_lb_mapping/${assetId}/${poolId}`) + const token = assetMap[assetId] + sdk.util.sumSingleBalance(balances.tvl, token, total_lend - total_borrowed) + sdk.util.sumSingleBalance(balances.borrowed, token, total_borrowed) + } + } +} + + +module.exports = { + timetravel: false, + comdex: { + tvl: async () => transformBalances('comdex', (await getData()).tvl), + borrowed: async () => transformBalances('comdex', (await getData()).borrowed), + } +} diff --git a/projects/complifi/abi.json b/projects/complifi/abi.json index 743f8585f07..89bed9c4bff 100644 --- a/projects/complifi/abi.json +++ b/projects/complifi/abi.json @@ -1,119 +1,6 @@ { - "getAllVaults": { - "inputs": [], - "name": "getAllVaults", - "outputs": [ - { - "internalType": "address[]", - "name": "", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function", - "constant": true - }, - "getVaultCollateral": { - "inputs":[], - "name":"collateralToken", - "outputs":[ - { - "internalType":"address", - "name":"", - "type":"address" - } - ], - "stateMutability":"view", - "type":"function", - "constant": true - }, - "getAllPools": { - "inputs": [], - "name": "getAllPools", - "outputs": [ - { - "internalType": "address[]", - "name": "", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function", - "constant": true - }, - "getConfig": { - "inputs": [], - "name": "getConfig", - "outputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "minExitAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "protocolFee", - "type": "uint256" - }, - { - "internalType": "address", - "name": "feeWallet", - "type": "address" - }, - { - "internalType": "contract IERC20", - "name": "collateralToken", - "type": "address" - }, - { - "internalType": "address", - "name": "collateralOracle", - "type": "address" - }, - { - "internalType": "contract IOracleIterator", - "name": "collateralOracleIterator", - "type": "address" - }, - { - "internalType": "contract IVolatilityEvolution", - "name": "volatilityEvolution", - "type": "address" - }, - { - "internalType": "contract IUnderlyingLiquidityValuer", - "name": "underlyingLiquidityValuer", - "type": "address" - }, - { - "internalType": "contract IExposure", - "name": "exposure", - "type": "address" - }, - { - "internalType": "contract IERC20MintedBurnable", - "name": "poolShare", - "type": "address" - }, - { - "internalType": "contract ITraderPortfolio", - "name": "traderPortfolio", - "type": "address" - }, - { - "internalType": "uint8", - "name": "collateralDecimals", - "type": "uint8" - } - ], - "internalType": "struct IPoolConfigTypes.PoolConfig", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - } -} + "getAllVaults": "address[]:getAllVaults", + "getVaultCollateral": "address:collateralToken", + "getAllPools": "address[]:getAllPools", + "getConfig": "function getConfig() view returns (tuple(uint256 minExitAmount, uint256 protocolFee, address feeWallet, address collateralToken, address collateralOracle, address collateralOracleIterator, address volatilityEvolution, address underlyingLiquidityValuer, address exposure, address poolShare, address traderPortfolio, uint8 collateralDecimals))" +} \ No newline at end of file diff --git a/projects/complus/index.js b/projects/complus/index.js index fdca047b026..85c0aa6cad6 100644 --- a/projects/complus/index.js +++ b/projects/complus/index.js @@ -3,15 +3,15 @@ const { getUniTVL } = require('../helper/unknownTokens') module.exports = { misrepresentedTokens: true, polygon: { - tvl: getUniTVL({ chain: 'polygon', useDefaultCoreAssets: true, factory: '0x973c934137dd687eca67bdd1c5a8b74286964ac6', }), + tvl: getUniTVL({ useDefaultCoreAssets: true, factory: '0x973c934137dd687eca67bdd1c5a8b74286964ac6', }), }, heco: { - tvl: getUniTVL({ chain: 'heco', useDefaultCoreAssets: true, factory: '0xc32cccf795940ca8491cd4f31161509db28ab719', }), + tvl: getUniTVL({ useDefaultCoreAssets: true, factory: '0xc32cccf795940ca8491cd4f31161509db28ab719', }), }, bsc: { - tvl: getUniTVL({ chain: 'bsc', useDefaultCoreAssets: true, factory: '0xdf97982bf70be91df4acd3d511c551f06a0d19ec', }), + tvl: getUniTVL({ useDefaultCoreAssets: true, factory: '0xdf97982bf70be91df4acd3d511c551f06a0d19ec', }), }, avax:{ - tvl: getUniTVL({ chain: 'avax', useDefaultCoreAssets: true, factory: '0x5c02e78a3969d0e64aa2cfa765acc1d671914ac0', }), + tvl: getUniTVL({ useDefaultCoreAssets: true, factory: '0x5c02e78a3969d0e64aa2cfa765acc1d671914ac0', }), }, } \ No newline at end of file diff --git a/projects/component/index.js b/projects/component/index.js index a4352aff1ff..c4da60879c6 100644 --- a/projects/component/index.js +++ b/projects/component/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const BigNumber = require("bignumber.js"); const {staking} = require("../helper/staking"); @@ -7,11 +8,11 @@ const ethStakingPool = "0x79876b5062160C107e02826371dD33c047CCF2de"; const translateToken = { '0xFe7ed09C4956f7cdb54eC4ffCB9818Db2D7025b8': "0x1456688345527be1f37e9e627da0837d6f08c925", - '0xFc8B2690F66B46fEC8B3ceeb95fF4Ac35a0054BC': "0x6b175474e89094c44da98b954eedeac495271d0f", + '0xFc8B2690F66B46fEC8B3ceeb95fF4Ac35a0054BC': ADDRESSES.ethereum.DAI, '0xDACD011A71f8c9619642bf482f1D4CeB338cfFCf': "0x1456688345527be1f37e9e627da0837d6f08c925", '0x3129aC70c738D398d1D74c87EAB9483FD56D16f8': "0x1456688345527be1f37e9e627da0837d6f08c925", - '0x8D11eC38a3EB5E956B052f67Da8Bdc9bef8Abf3E': "0x6b175474e89094c44da98b954eedeac495271d0f", - '0x82f0B8B456c1A451378467398982d4834b6829c1': "0x99d8a9c45b2eca8864373a26d1459e3dff1e17f3" + [ADDRESSES.fantom.DAI]: ADDRESSES.ethereum.DAI, + [ADDRESSES.fantom.MIM]: "0x99d8a9c45b2eca8864373a26d1459e3dff1e17f3" } const ethPools = [ @@ -19,8 +20,8 @@ const ethPools = [ { token: "0x49519631B404E06ca79C9C7b0dC91648D86F08db", underlying: [ - "0xdAC17F958D2ee523a2206206994597C13D831ec7", - "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", + ADDRESSES.ethereum.USDT, + ADDRESSES.ethereum.USDC, "0x1456688345527bE1f37E9e627DA0837D6f08C925" ] }, @@ -28,8 +29,8 @@ const ethPools = [ token: "0x6477960dd932d29518D7e8087d5Ea3D11E606068", underlying: [ "0x1456688345527bE1f37E9e627DA0837D6f08C925", - "0x6B175474E89094C44Da98b954EedeAC495271d0F", - "0x57Ab1ec28D129707052df4dF418D58a2D46d5f51" + ADDRESSES.ethereum.DAI, + ADDRESSES.ethereum.sUSD ] } ]; @@ -39,25 +40,25 @@ const xDaiPools = [ { token: "0x53De001bbfAe8cEcBbD6245817512F8DBd8EEF18", underlying: [ - "0xDDAfbb505ad214D7b80b1f830fcCc89B60fb7A83", + ADDRESSES.xdai.USDC, "0xFe7ed09C4956f7cdb54eC4ffCB9818Db2D7025b8", - "0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d" + ADDRESSES.xdai.WXDAI ] }, { token: "0xF82fc0ecBf3ff8e253a262447335d3d8A72CD028", underlying: [ "0xFc8B2690F66B46fEC8B3ceeb95fF4Ac35a0054BC", - "0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d" + ADDRESSES.xdai.WXDAI ] }, { token: "0xfbbd0F67cEbCA3252717E66c1Ed1E97ad8B06377", underlying: [ - "0xDDAfbb505ad214D7b80b1f830fcCc89B60fb7A83", + ADDRESSES.xdai.USDC, "0xFc8B2690F66B46fEC8B3ceeb95fF4Ac35a0054BC", "0xD10Cc63531a514BBa7789682E487Add1f15A51E2", - "0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d" + ADDRESSES.xdai.WXDAI ] } ] @@ -67,17 +68,17 @@ const bscPools = [ { token: "0xcf76a0ceDf50DA184FDef08A9d04E6829D7FefDF", underlying: [ - "0x55d398326f99059fF775485246999027B3197955", - "0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56", + ADDRESSES.bsc.USDT, + ADDRESSES.bsc.BUSD, "0xDACD011A71f8c9619642bf482f1D4CeB338cfFCf" ] }, { token: "0x3Bb6Bf6EcBC71f8f78D1Eec9c91de4f8Fd5C891c", underlying: [ - "0x55d398326f99059fF775485246999027B3197955", - "0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56", - "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d" + ADDRESSES.bsc.USDT, + ADDRESSES.bsc.BUSD, + ADDRESSES.bsc.USDC ] } ] @@ -87,8 +88,8 @@ const ftmPools = [ { token: "0xdDCA02Ddd94f97eeFE07fCcde780fD2FbDc85b23", underlying: [ - "0x8D11eC38a3EB5E956B052f67Da8Bdc9bef8Abf3E", - "0x04068DA6C83AFCFA0e13ba15A6696662335D5B75", + ADDRESSES.fantom.DAI, + ADDRESSES.fantom.USDC, "0x3129aC70c738D398d1D74c87EAB9483FD56D16f8" ] }, @@ -96,7 +97,7 @@ const ftmPools = [ token: "0x238139bF999f389063444e397cDfadF780ec57DB", underlying: [ "0xdc301622e621166BD8E82f2cA0A26c13Ad0BE355", - "0x82f0B8B456c1A451378467398982d4834b6829c1", + ADDRESSES.fantom.MIM, "0x3129aC70c738D398d1D74c87EAB9483FD56D16f8" ] } @@ -116,7 +117,7 @@ async function getTvlFromPools(balances, pools, block, chain) { for (let j in underlyingBalances) { if (underlyingBalances[j].input.target === "0xD10Cc63531a514BBa7789682E487Add1f15A51E2") { let bal = new BigNumber(underlyingBalances[j].output).div(10 ** 12).toFixed(0); - sdk.util.sumSingleBalance(balances, "xdai:0xDDAfbb505ad214D7b80b1f830fcCc89B60fb7A83", bal); + sdk.util.sumSingleBalance(balances, "xdai:" + ADDRESSES.xdai.USDC, bal); } else if (underlyingBalances[j].input.target in translateToken) { sdk.util.sumSingleBalance(balances, translateToken[underlyingBalances[j].input.target], underlyingBalances[j].output); diff --git a/projects/componentswap/index.js b/projects/componentswap/index.js new file mode 100644 index 00000000000..f8b1041e794 --- /dev/null +++ b/projects/componentswap/index.js @@ -0,0 +1,14 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport, } = require('../helper/unwrapLPs'); + +const TOKEN_CONTRACTS = [ + ADDRESSES.pulse.DAI, + ADDRESSES.pulse.USDC, + ADDRESSES.pulse.USDT, +] + +module.exports = { + pulse: { + tvl: sumTokensExport({ owner: '0x35C49cB4fa16C557968cF43e237674b38bf05327', tokens: TOKEN_CONTRACTS}) + }, +}; \ No newline at end of file diff --git a/projects/composable/index.js b/projects/composable/index.js index 27f22b25488..46e9157045a 100644 --- a/projects/composable/index.js +++ b/projects/composable/index.js @@ -1,41 +1,46 @@ -const {chainExports} = require('../helper/exports') -const { sumTokensAndLPsSharedOwners} = require('../helper/unwrapLPs') +const ADDRESSES = require('../helper/coreAssets.json') +const { chainExports } = require('../helper/exports') +const { sumTokensAndLPsSharedOwners } = require('../helper/unwrapLPs') const sdk = require('@defillama/sdk') const networks = { 'ethereum': ['0xef4439f0fae7db0b5ce88c155fc6af50f1b38728', [ - '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', //usdc - '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', // eth + ADDRESSES.ethereum.USDC, //usdc + ADDRESSES.ethereum.WETH, // eth '0xca3d75ac011bf5ad07a98d02f18225f9bd9a6bdf', // tricrypto ]], - 'arbitrum': ['0xEba8C2Bf0d1C9413543188fc42D7323690AED051',[ - '0xff970a61a04b1ca14834a43f5de4533ebddb5cc8', //usdc - '0x82af49447d8a07e3bd95bd0d56f35241523fbab1' //eth + 'arbitrum': ['0xEba8C2Bf0d1C9413543188fc42D7323690AED051', [ + ADDRESSES.arbitrum.USDC, //usdc + ADDRESSES.arbitrum.WETH //eth ]], - 'polygon': ['0xcd8e7322dc2659b1ec447e5d52fdd9c67e8c3c01',[ - '0x2791bca1f2de4661ed88a30c99a7a9449aa84174', //usdc - '0x7ceb23fd6bc0add59e62ac25578270cff1b9f619' //eth + 'polygon': ['0xcd8e7322dc2659b1ec447e5d52fdd9c67e8c3c01', [ + ADDRESSES.polygon.USDC, //usdc + ADDRESSES.polygon.WETH_1 //eth ]] } -const abi = [{"inputs":[],"name":"token","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}] +const abi = { + token: "address:token", + totalToken: "uint256:totalToken", +} + const rugPools = ['0x4a03ea61e543ec7141a3f90128b0c0c9514f8737', '0xf12da8470e2643ccb39a157e8577d9aa586a488f', '0x1941441d31809e9E1828Da0cE6d44175F657E215'] -function chainTvl(chain){ - return async (_time, ethBlock, chainBlocks)=>{ +function chainTvl(chain) { + return async (_time, ethBlock, chainBlocks) => { const balances = {} const [owner, tokens] = networks[chain] - await sumTokensAndLPsSharedOwners(balances, tokens.map(t=>[t, false]), [owner], chainBlocks[chain], chain, addr=>`${chain}:${addr}`) - if(chain === "ethereum"){ - for(const pool of rugPools){ + await sumTokensAndLPsSharedOwners(balances, tokens.map(t => [t, false]), [owner], chainBlocks[chain], chain, addr => `${chain}:${addr}`) + if (chain === "ethereum") { + for (const pool of rugPools) { const token = await sdk.api.abi.call({ target: pool, - abi: abi[0], + abi: abi.token, block: ethBlock }) const bal = await sdk.api.abi.call({ target: pool, - abi: abi[1], + abi: abi.totalToken, block: ethBlock }) sdk.util.sumSingleBalance(balances, token.output, bal.output) @@ -45,4 +50,4 @@ function chainTvl(chain){ } } -module.exports=chainExports(chainTvl, Object.keys(networks)) \ No newline at end of file +module.exports = chainExports(chainTvl, Object.keys(networks)) \ No newline at end of file diff --git a/projects/compound-onchain/abi.json b/projects/compound-onchain/abi.json index 539912138a8..5181f2371dc 100644 --- a/projects/compound-onchain/abi.json +++ b/projects/compound-onchain/abi.json @@ -1,147 +1,9 @@ { - "markets": { - "constant":true, - "inputs":[ - { - "name":"", - "type":"address" - } - ], - "name":"markets", - "outputs":[ - { - "name":"isSupported", - "type":"bool" - }, - { - "name":"blockNumber", - "type":"uint256" - }, - { - "name":"interestRateModel", - "type":"address" - }, - { - "name":"totalSupply", - "type":"uint256" - }, - { - "name":"supplyRateMantissa", - "type":"uint256" - }, - { - "name":"supplyIndex", - "type":"uint256" - }, - { - "name":"totalBorrows", - "type":"uint256" - }, - { - "name":"borrowRateMantissa", - "type":"uint256" - }, - { - "name":"borrowIndex", - "type":"uint256" - } - ], - "payable":false, - "stateMutability":"view", - "type":"function" - }, - "totalBorrows": { - "constant":true, - "inputs":[ - - ], - "name":"totalBorrows", - "outputs":[ - { - "name":"", - "type":"uint256" - } - ], - "payable":false, - "stateMutability":"view", - "type":"function" - }, - "borrowRatePerBlock": { - "constant":true, - "inputs":[ - - ], - "name":"borrowRatePerBlock", - "outputs":[ - { - "name":"", - "type":"uint256" - } - ], - "payable":false, - "stateMutability":"view", - "type":"function" - }, - "supplyRatePerBlock": { - "constant":true, - "inputs":[ - - ], - "name":"supplyRatePerBlock", - "outputs":[ - { - "name":"", - "type":"uint256" - } - ], - "payable":false, - "stateMutability":"view", - "type":"function" - }, - "underlying": { - "constant": true, - "inputs": [], - "name": "underlying", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function", - "signature": "0x6f307dc3" - }, - "getCash": { - "constant": true, - "inputs": [], - "name": "getCash", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "signature": "0x3b1d21a2", - "stateMutability": "view", - "type": "function" - }, - "getAllMarkets": { - "constant": true, - "inputs": [], - "name": "getAllMarkets", - "outputs": [ - { - "internalType": "contract CToken[]", - "name": "", - "type": "address[]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function", - "signature": "0xb0772d0b" - } -} + "markets": "function markets(address) view returns (bool isSupported, uint256 blockNumber, address interestRateModel, uint256 totalSupply, uint256 supplyRateMantissa, uint256 supplyIndex, uint256 totalBorrows, uint256 borrowRateMantissa, uint256 borrowIndex)", + "totalBorrows": "uint256:totalBorrows", + "borrowRatePerBlock": "uint256:borrowRatePerBlock", + "supplyRatePerBlock": "uint256:supplyRatePerBlock", + "underlying": "address:underlying", + "getCash": "uint256:getCash", + "getAllMarkets": "address[]:getAllMarkets" +} \ No newline at end of file diff --git a/projects/compound-onchain/index.js b/projects/compound-onchain/index.js index 3f88b0b7f00..0b340809c7e 100644 --- a/projects/compound-onchain/index.js +++ b/projects/compound-onchain/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk'); const abi = require('./abi.json'); @@ -8,19 +9,19 @@ const { lendingMarket } = require('../helper/methodologies') // cache some data const markets = [ { - underlying: '0x0D8775F648430679A709E98d2b0Cb6250d2887EF', + underlying: ADDRESSES.ethereum.BAT, symbol: 'BAT', decimals: 18, cToken: '0x6C8c6b02E7b2BE14d4fA6022Dfd6d75921D90E4E', }, { - underlying: '0x6B175474E89094C44Da98b954EedeAC495271d0F', + underlying: ADDRESSES.ethereum.DAI, symbol: 'DAI', decimals: 18, cToken: '0x5d3a536E4D6DbD6114cc1Ead35777bAB948E3643', }, { - underlying: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', + underlying: ADDRESSES.ethereum.WETH, symbol: 'WETH', decimals: 18, cToken: '0x4Ddc2D193948926D02f9B1fE9e1daa0718270ED5', @@ -32,19 +33,19 @@ const markets = [ cToken: '0x158079Ee67Fce2f58472A96584A73C7Ab9AC95c1', }, { - underlying: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', + underlying: ADDRESSES.ethereum.USDC, symbol: 'USDC', decimals: 6, cToken: '0x39AA39c021dfbaE8faC545936693aC917d5E7563', }, { - underlying: '0xdAC17F958D2ee523a2206206994597C13D831ec7', + underlying: ADDRESSES.ethereum.USDT, symbol: 'USDT', decimals: 6, cToken: '0xf650C3d88D12dB855b8bf7D11Be6C55A4e07dCC9', }, { - underlying: '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599', + underlying: ADDRESSES.ethereum.WBTC, symbol: 'WBTC', decimals: 8, cToken: '0xC11b1268C1A384e55C48c2391d8d480264A3A7F4',//cWBTC - legacy @@ -56,7 +57,7 @@ const markets = [ cToken: '0xB3319f5D18Bc0D84dD1b4825Dcde5d5f7266d407', }, { - underlying: '0x89d24A6b4CcB1B6fAA2625fE562bDD9a23260359', + underlying: ADDRESSES.ethereum.SAI, symbol: 'SAI', decimals: 18, cToken: '0xF5DCe57282A584D2746FaF1593d3121Fcac444dC', @@ -83,7 +84,7 @@ async function getMarkets(block) { } else { const markets = [{ cToken: CTOKEN_WETH, - underlying: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', //cETH => WETH + underlying: ADDRESSES.ethereum.WETH, //cETH => WETH }] const allCTokens = await getAllCTokens(block) @@ -170,7 +171,7 @@ async function tvl(timestamp, block) { module.exports = { hallmarks: [ [1632873600, "Comptroller vulnerability exploit"], - [1623715200, "Liquidity mining begins"] + [1592226000, "COMP distribution begins"] ], timetravel: true, ethereum: { diff --git a/projects/compound-onchain/v1Abi.json b/projects/compound-onchain/v1Abi.json index 2fb56407572..3147c0f0802 100644 --- a/projects/compound-onchain/v1Abi.json +++ b/projects/compound-onchain/v1Abi.json @@ -1,86 +1,5 @@ { - "getCollateralMarketsLength": { - "constant": true, - "inputs": [], - "name": "getCollateralMarketsLength", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "markets": { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - } - ], - "name": "markets", - "outputs": [ - { - "name": "isSupported", - "type": "bool" - }, - { - "name": "blockNumber", - "type": "uint256" - }, - { - "name": "interestRateModel", - "type": "address" - }, - { - "name": "totalSupply", - "type": "uint256" - }, - { - "name": "supplyRateMantissa", - "type": "uint256" - }, - { - "name": "supplyIndex", - "type": "uint256" - }, - { - "name": "totalBorrows", - "type": "uint256" - }, - { - "name": "borrowRateMantissa", - "type": "uint256" - }, - { - "name": "borrowIndex", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "collateralMarkets": { - "constant": true, - "inputs": [ - { - "name": "", - "type": "uint256" - } - ], - "name": "collateralMarkets", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } + "getCollateralMarketsLength": "uint256:getCollateralMarketsLength", + "markets": "function markets(address) view returns (bool isSupported, uint256 blockNumber, address interestRateModel, uint256 totalSupply, uint256 supplyRateMantissa, uint256 supplyIndex, uint256 totalBorrows, uint256 borrowRateMantissa, uint256 borrowIndex)", + "collateralMarkets": "function collateralMarkets(uint256) view returns (address)" } \ No newline at end of file diff --git a/projects/compound-v3/index.js b/projects/compound-v3/index.js index 7d0c8feeab4..137669d1c23 100644 --- a/projects/compound-v3/index.js +++ b/projects/compound-v3/index.js @@ -1,86 +1,17 @@ -const sdk = require("@defillama/sdk"); -const BigNumber = require("bignumber.js"); -const { lendingMarket } = require("../helper/methodologies"); -const { v3Abi } = require("./v3abi"); +const { compoundV3Exports } = require('../helper/compoundV3') +const markets = [ + "0xc3d688B66703497DAA19211EEdff47f25384cdc3", // USDC Market + '0xa17581a9e3356d9a858b789d68b4d866e593ae94', // ETH Market +] -const USDCV3 = "0xc3d688B66703497DAA19211EEdff47f25384cdc3"; - -async function v3Tvl(balances, block, borrowed) { - const numMarkets = +( - await sdk.api.abi.call({ - target: USDCV3, - block, - abi: v3Abi.find(({ name }) => name === "numAssets"), - }) - ).output; - - const markets = ( - await sdk.api.abi.multiCall({ - abi: v3Abi.find(({ name }) => name === "getAssetInfo"), - block, - calls: Array.from({ length: numMarkets }).map((_, i) => ({ - target: USDCV3, - params: i, - })), - }) - ).output.map(({ output }) => output.asset); - - const collateral = ( - await sdk.api.abi.multiCall({ - abi: "erc20:balanceOf", - block, - calls: [...markets, "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"].map((market) => ({ - target: market, - params: USDCV3, - })), - }) - ) - - const borrows = ( - await sdk.api.abi.call({ - target: USDCV3, - block, - abi: v3Abi.find(({ name }) => name === "totalBorrow"), - }) - ).output; - const borrowedToken = ( - await sdk.api.abi.call({ - target: USDCV3, - block, - abi: v3Abi.find(({ name }) => name === "baseToken"), - }) - ).output; - - if (borrowed) { - balances[borrowedToken] = BigNumber(balances[borrowedToken] || 0) - .plus(borrows) - .toFixed(); - } else { - sdk.util.sumMultiBalanceOf(balances, collateral) - } - - return balances; -} - -async function borrowed(timestamp, block) { - const balances = {}; - await v3Tvl(balances, block, true); - return balances; -} - -async function tvl(timestamp, block) { - let balances = {}; - - await v3Tvl(balances, block, false); - - return balances; -} - -module.exports = { - timetravel: true, +module.exports = compoundV3Exports({ ethereum: { - tvl, - borrowed, + markets, + }, + arbitrum: { + markets: ['0xA5EDBDD9646f8dFF606d7448e414884C7d905dCA'], }, - methodology: `${lendingMarket}. TVL is calculated by getting the market addresses from comptroller and calling the totalsCollaterals() on-chain method to get the amount of tokens locked in each of these addresses, then we get the price of each token from coingecko.`, -}; + polygon: { + markets:["0xF25212E676D1F7F89Cd72fFEe66158f541246445"], + } +}) \ No newline at end of file diff --git a/projects/compound-v3/v3abi.js b/projects/compound-v3/v3abi.js deleted file mode 100644 index 738cd537815..00000000000 --- a/projects/compound-v3/v3abi.js +++ /dev/null @@ -1,1059 +0,0 @@ -module.exports = { - v3Abi: [ - { - inputs: [ - { - components: [ - { internalType: "address", name: "governor", type: "address" }, - { internalType: "address", name: "pauseGuardian", type: "address" }, - { internalType: "address", name: "baseToken", type: "address" }, - { - internalType: "address", - name: "baseTokenPriceFeed", - type: "address", - }, - { - internalType: "address", - name: "extensionDelegate", - type: "address", - }, - { internalType: "uint64", name: "supplyKink", type: "uint64" }, - { - internalType: "uint64", - name: "supplyPerYearInterestRateSlopeLow", - type: "uint64", - }, - { - internalType: "uint64", - name: "supplyPerYearInterestRateSlopeHigh", - type: "uint64", - }, - { - internalType: "uint64", - name: "supplyPerYearInterestRateBase", - type: "uint64", - }, - { internalType: "uint64", name: "borrowKink", type: "uint64" }, - { - internalType: "uint64", - name: "borrowPerYearInterestRateSlopeLow", - type: "uint64", - }, - { - internalType: "uint64", - name: "borrowPerYearInterestRateSlopeHigh", - type: "uint64", - }, - { - internalType: "uint64", - name: "borrowPerYearInterestRateBase", - type: "uint64", - }, - { - internalType: "uint64", - name: "storeFrontPriceFactor", - type: "uint64", - }, - { - internalType: "uint64", - name: "trackingIndexScale", - type: "uint64", - }, - { - internalType: "uint64", - name: "baseTrackingSupplySpeed", - type: "uint64", - }, - { - internalType: "uint64", - name: "baseTrackingBorrowSpeed", - type: "uint64", - }, - { - internalType: "uint104", - name: "baseMinForRewards", - type: "uint104", - }, - { internalType: "uint104", name: "baseBorrowMin", type: "uint104" }, - { - internalType: "uint104", - name: "targetReserves", - type: "uint104", - }, - { - components: [ - { internalType: "address", name: "asset", type: "address" }, - { internalType: "address", name: "priceFeed", type: "address" }, - { internalType: "uint8", name: "decimals", type: "uint8" }, - { - internalType: "uint64", - name: "borrowCollateralFactor", - type: "uint64", - }, - { - internalType: "uint64", - name: "liquidateCollateralFactor", - type: "uint64", - }, - { - internalType: "uint64", - name: "liquidationFactor", - type: "uint64", - }, - { internalType: "uint128", name: "supplyCap", type: "uint128" }, - ], - internalType: "struct CometConfiguration.AssetConfig[]", - name: "assetConfigs", - type: "tuple[]", - }, - ], - internalType: "struct CometConfiguration.Configuration", - name: "config", - type: "tuple", - }, - ], - stateMutability: "nonpayable", - type: "constructor", - }, - { inputs: [], name: "Absurd", type: "error" }, - { inputs: [], name: "AlreadyInitialized", type: "error" }, - { inputs: [], name: "BadAsset", type: "error" }, - { inputs: [], name: "BadDecimals", type: "error" }, - { inputs: [], name: "BadDiscount", type: "error" }, - { inputs: [], name: "BadMinimum", type: "error" }, - { inputs: [], name: "BadPrice", type: "error" }, - { inputs: [], name: "BorrowCFTooLarge", type: "error" }, - { inputs: [], name: "BorrowTooSmall", type: "error" }, - { inputs: [], name: "InsufficientReserves", type: "error" }, - { inputs: [], name: "InvalidInt104", type: "error" }, - { inputs: [], name: "InvalidInt256", type: "error" }, - { inputs: [], name: "InvalidUInt104", type: "error" }, - { inputs: [], name: "InvalidUInt128", type: "error" }, - { inputs: [], name: "InvalidUInt64", type: "error" }, - { inputs: [], name: "LiquidateCFTooLarge", type: "error" }, - { inputs: [], name: "NegativeNumber", type: "error" }, - { inputs: [], name: "NoSelfTransfer", type: "error" }, - { inputs: [], name: "NotCollateralized", type: "error" }, - { inputs: [], name: "NotForSale", type: "error" }, - { inputs: [], name: "NotLiquidatable", type: "error" }, - { inputs: [], name: "Paused", type: "error" }, - { inputs: [], name: "SupplyCapExceeded", type: "error" }, - { inputs: [], name: "TimestampTooLarge", type: "error" }, - { inputs: [], name: "TooManyAssets", type: "error" }, - { inputs: [], name: "TooMuchSlippage", type: "error" }, - { inputs: [], name: "TransferInFailed", type: "error" }, - { inputs: [], name: "TransferOutFailed", type: "error" }, - { inputs: [], name: "Unauthorized", type: "error" }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "address", - name: "absorber", - type: "address", - }, - { - indexed: true, - internalType: "address", - name: "borrower", - type: "address", - }, - { - indexed: true, - internalType: "address", - name: "asset", - type: "address", - }, - { - indexed: false, - internalType: "uint256", - name: "collateralAbsorbed", - type: "uint256", - }, - { - indexed: false, - internalType: "uint256", - name: "usdValue", - type: "uint256", - }, - ], - name: "AbsorbCollateral", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "address", - name: "absorber", - type: "address", - }, - { - indexed: true, - internalType: "address", - name: "borrower", - type: "address", - }, - { - indexed: false, - internalType: "uint256", - name: "basePaidOut", - type: "uint256", - }, - { - indexed: false, - internalType: "uint256", - name: "usdValue", - type: "uint256", - }, - ], - name: "AbsorbDebt", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "address", - name: "buyer", - type: "address", - }, - { - indexed: true, - internalType: "address", - name: "asset", - type: "address", - }, - { - indexed: false, - internalType: "uint256", - name: "baseAmount", - type: "uint256", - }, - { - indexed: false, - internalType: "uint256", - name: "collateralAmount", - type: "uint256", - }, - ], - name: "BuyCollateral", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: "bool", - name: "supplyPaused", - type: "bool", - }, - { - indexed: false, - internalType: "bool", - name: "transferPaused", - type: "bool", - }, - { - indexed: false, - internalType: "bool", - name: "withdrawPaused", - type: "bool", - }, - { - indexed: false, - internalType: "bool", - name: "absorbPaused", - type: "bool", - }, - { - indexed: false, - internalType: "bool", - name: "buyPaused", - type: "bool", - }, - ], - name: "PauseAction", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "address", - name: "from", - type: "address", - }, - { - indexed: true, - internalType: "address", - name: "dst", - type: "address", - }, - { - indexed: false, - internalType: "uint256", - name: "amount", - type: "uint256", - }, - ], - name: "Supply", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "address", - name: "from", - type: "address", - }, - { - indexed: true, - internalType: "address", - name: "dst", - type: "address", - }, - { - indexed: true, - internalType: "address", - name: "asset", - type: "address", - }, - { - indexed: false, - internalType: "uint256", - name: "amount", - type: "uint256", - }, - ], - name: "SupplyCollateral", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "address", - name: "from", - type: "address", - }, - { indexed: true, internalType: "address", name: "to", type: "address" }, - { - indexed: false, - internalType: "uint256", - name: "amount", - type: "uint256", - }, - ], - name: "Transfer", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "address", - name: "from", - type: "address", - }, - { indexed: true, internalType: "address", name: "to", type: "address" }, - { - indexed: true, - internalType: "address", - name: "asset", - type: "address", - }, - { - indexed: false, - internalType: "uint256", - name: "amount", - type: "uint256", - }, - ], - name: "TransferCollateral", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "address", - name: "src", - type: "address", - }, - { indexed: true, internalType: "address", name: "to", type: "address" }, - { - indexed: false, - internalType: "uint256", - name: "amount", - type: "uint256", - }, - ], - name: "Withdraw", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "address", - name: "src", - type: "address", - }, - { indexed: true, internalType: "address", name: "to", type: "address" }, - { - indexed: true, - internalType: "address", - name: "asset", - type: "address", - }, - { - indexed: false, - internalType: "uint256", - name: "amount", - type: "uint256", - }, - ], - name: "WithdrawCollateral", - type: "event", - }, - { - anonymous: false, - inputs: [ - { indexed: true, internalType: "address", name: "to", type: "address" }, - { - indexed: false, - internalType: "uint256", - name: "amount", - type: "uint256", - }, - ], - name: "WithdrawReserves", - type: "event", - }, - { stateMutability: "payable", type: "fallback" }, - { - inputs: [ - { internalType: "address", name: "absorber", type: "address" }, - { internalType: "address[]", name: "accounts", type: "address[]" }, - ], - name: "absorb", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [{ internalType: "address", name: "account", type: "address" }], - name: "accrueAccount", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { internalType: "address", name: "manager", type: "address" }, - { internalType: "address", name: "asset", type: "address" }, - { internalType: "uint256", name: "amount", type: "uint256" }, - ], - name: "approveThis", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [{ internalType: "address", name: "account", type: "address" }], - name: "balanceOf", - outputs: [{ internalType: "uint256", name: "", type: "uint256" }], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "baseBorrowMin", - outputs: [{ internalType: "uint256", name: "", type: "uint256" }], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "baseMinForRewards", - outputs: [{ internalType: "uint256", name: "", type: "uint256" }], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "baseScale", - outputs: [{ internalType: "uint256", name: "", type: "uint256" }], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "baseToken", - outputs: [{ internalType: "address", name: "", type: "address" }], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "baseTokenPriceFeed", - outputs: [{ internalType: "address", name: "", type: "address" }], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "baseTrackingBorrowSpeed", - outputs: [{ internalType: "uint256", name: "", type: "uint256" }], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "baseTrackingSupplySpeed", - outputs: [{ internalType: "uint256", name: "", type: "uint256" }], - stateMutability: "view", - type: "function", - }, - { - inputs: [{ internalType: "address", name: "account", type: "address" }], - name: "borrowBalanceOf", - outputs: [{ internalType: "uint256", name: "", type: "uint256" }], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "borrowKink", - outputs: [{ internalType: "uint256", name: "", type: "uint256" }], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "borrowPerSecondInterestRateBase", - outputs: [{ internalType: "uint256", name: "", type: "uint256" }], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "borrowPerSecondInterestRateSlopeHigh", - outputs: [{ internalType: "uint256", name: "", type: "uint256" }], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "borrowPerSecondInterestRateSlopeLow", - outputs: [{ internalType: "uint256", name: "", type: "uint256" }], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { internalType: "address", name: "asset", type: "address" }, - { internalType: "uint256", name: "minAmount", type: "uint256" }, - { internalType: "uint256", name: "baseAmount", type: "uint256" }, - { internalType: "address", name: "recipient", type: "address" }, - ], - name: "buyCollateral", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [], - name: "decimals", - outputs: [{ internalType: "uint8", name: "", type: "uint8" }], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "extensionDelegate", - outputs: [{ internalType: "address", name: "", type: "address" }], - stateMutability: "view", - type: "function", - }, - { - inputs: [{ internalType: "uint8", name: "i", type: "uint8" }], - name: "getAssetInfo", - outputs: [ - { - components: [ - { internalType: "uint8", name: "offset", type: "uint8" }, - { internalType: "address", name: "asset", type: "address" }, - { internalType: "address", name: "priceFeed", type: "address" }, - { internalType: "uint64", name: "scale", type: "uint64" }, - { - internalType: "uint64", - name: "borrowCollateralFactor", - type: "uint64", - }, - { - internalType: "uint64", - name: "liquidateCollateralFactor", - type: "uint64", - }, - { - internalType: "uint64", - name: "liquidationFactor", - type: "uint64", - }, - { internalType: "uint128", name: "supplyCap", type: "uint128" }, - ], - internalType: "struct CometCore.AssetInfo", - name: "", - type: "tuple", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [{ internalType: "address", name: "asset", type: "address" }], - name: "getAssetInfoByAddress", - outputs: [ - { - components: [ - { internalType: "uint8", name: "offset", type: "uint8" }, - { internalType: "address", name: "asset", type: "address" }, - { internalType: "address", name: "priceFeed", type: "address" }, - { internalType: "uint64", name: "scale", type: "uint64" }, - { - internalType: "uint64", - name: "borrowCollateralFactor", - type: "uint64", - }, - { - internalType: "uint64", - name: "liquidateCollateralFactor", - type: "uint64", - }, - { - internalType: "uint64", - name: "liquidationFactor", - type: "uint64", - }, - { internalType: "uint128", name: "supplyCap", type: "uint128" }, - ], - internalType: "struct CometCore.AssetInfo", - name: "", - type: "tuple", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { internalType: "uint256", name: "utilization", type: "uint256" }, - ], - name: "getBorrowRate", - outputs: [{ internalType: "uint64", name: "", type: "uint64" }], - stateMutability: "view", - type: "function", - }, - { - inputs: [{ internalType: "address", name: "priceFeed", type: "address" }], - name: "getPrice", - outputs: [{ internalType: "uint256", name: "", type: "uint256" }], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "getReserves", - outputs: [{ internalType: "int256", name: "", type: "int256" }], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { internalType: "uint256", name: "utilization", type: "uint256" }, - ], - name: "getSupplyRate", - outputs: [{ internalType: "uint64", name: "", type: "uint64" }], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "getUtilization", - outputs: [{ internalType: "uint256", name: "", type: "uint256" }], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "governor", - outputs: [{ internalType: "address", name: "", type: "address" }], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { internalType: "address", name: "owner", type: "address" }, - { internalType: "address", name: "manager", type: "address" }, - ], - name: "hasPermission", - outputs: [{ internalType: "bool", name: "", type: "bool" }], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "initializeStorage", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [], - name: "isAbsorbPaused", - outputs: [{ internalType: "bool", name: "", type: "bool" }], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { internalType: "address", name: "", type: "address" }, - { internalType: "address", name: "", type: "address" }, - ], - name: "isAllowed", - outputs: [{ internalType: "bool", name: "", type: "bool" }], - stateMutability: "view", - type: "function", - }, - { - inputs: [{ internalType: "address", name: "account", type: "address" }], - name: "isBorrowCollateralized", - outputs: [{ internalType: "bool", name: "", type: "bool" }], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "isBuyPaused", - outputs: [{ internalType: "bool", name: "", type: "bool" }], - stateMutability: "view", - type: "function", - }, - { - inputs: [{ internalType: "address", name: "account", type: "address" }], - name: "isLiquidatable", - outputs: [{ internalType: "bool", name: "", type: "bool" }], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "isSupplyPaused", - outputs: [{ internalType: "bool", name: "", type: "bool" }], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "isTransferPaused", - outputs: [{ internalType: "bool", name: "", type: "bool" }], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "isWithdrawPaused", - outputs: [{ internalType: "bool", name: "", type: "bool" }], - stateMutability: "view", - type: "function", - }, - { - inputs: [{ internalType: "address", name: "", type: "address" }], - name: "liquidatorPoints", - outputs: [ - { internalType: "uint32", name: "numAbsorbs", type: "uint32" }, - { internalType: "uint64", name: "numAbsorbed", type: "uint64" }, - { internalType: "uint128", name: "approxSpend", type: "uint128" }, - { internalType: "uint32", name: "_reserved", type: "uint32" }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "numAssets", - outputs: [{ internalType: "uint8", name: "", type: "uint8" }], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { internalType: "bool", name: "supplyPaused", type: "bool" }, - { internalType: "bool", name: "transferPaused", type: "bool" }, - { internalType: "bool", name: "withdrawPaused", type: "bool" }, - { internalType: "bool", name: "absorbPaused", type: "bool" }, - { internalType: "bool", name: "buyPaused", type: "bool" }, - ], - name: "pause", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [], - name: "pauseGuardian", - outputs: [{ internalType: "address", name: "", type: "address" }], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { internalType: "address", name: "asset", type: "address" }, - { internalType: "uint256", name: "baseAmount", type: "uint256" }, - ], - name: "quoteCollateral", - outputs: [{ internalType: "uint256", name: "", type: "uint256" }], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "storeFrontPriceFactor", - outputs: [{ internalType: "uint256", name: "", type: "uint256" }], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { internalType: "address", name: "asset", type: "address" }, - { internalType: "uint256", name: "amount", type: "uint256" }, - ], - name: "supply", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { internalType: "address", name: "from", type: "address" }, - { internalType: "address", name: "dst", type: "address" }, - { internalType: "address", name: "asset", type: "address" }, - { internalType: "uint256", name: "amount", type: "uint256" }, - ], - name: "supplyFrom", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [], - name: "supplyKink", - outputs: [{ internalType: "uint256", name: "", type: "uint256" }], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "supplyPerSecondInterestRateBase", - outputs: [{ internalType: "uint256", name: "", type: "uint256" }], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "supplyPerSecondInterestRateSlopeHigh", - outputs: [{ internalType: "uint256", name: "", type: "uint256" }], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "supplyPerSecondInterestRateSlopeLow", - outputs: [{ internalType: "uint256", name: "", type: "uint256" }], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { internalType: "address", name: "dst", type: "address" }, - { internalType: "address", name: "asset", type: "address" }, - { internalType: "uint256", name: "amount", type: "uint256" }, - ], - name: "supplyTo", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [], - name: "targetReserves", - outputs: [{ internalType: "uint256", name: "", type: "uint256" }], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "totalBorrow", - outputs: [{ internalType: "uint256", name: "", type: "uint256" }], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "totalSupply", - outputs: [{ internalType: "uint256", name: "", type: "uint256" }], - stateMutability: "view", - type: "function", - }, - { - inputs: [{ internalType: "address", name: "", type: "address" }], - name: "totalsCollateral", - outputs: [ - { internalType: "uint128", name: "totalSupplyAsset", type: "uint128" }, - { internalType: "uint128", name: "_reserved", type: "uint128" }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "trackingIndexScale", - outputs: [{ internalType: "uint256", name: "", type: "uint256" }], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { internalType: "address", name: "dst", type: "address" }, - { internalType: "uint256", name: "amount", type: "uint256" }, - ], - name: "transfer", - outputs: [{ internalType: "bool", name: "", type: "bool" }], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { internalType: "address", name: "dst", type: "address" }, - { internalType: "address", name: "asset", type: "address" }, - { internalType: "uint256", name: "amount", type: "uint256" }, - ], - name: "transferAsset", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { internalType: "address", name: "src", type: "address" }, - { internalType: "address", name: "dst", type: "address" }, - { internalType: "address", name: "asset", type: "address" }, - { internalType: "uint256", name: "amount", type: "uint256" }, - ], - name: "transferAssetFrom", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { internalType: "address", name: "src", type: "address" }, - { internalType: "address", name: "dst", type: "address" }, - { internalType: "uint256", name: "amount", type: "uint256" }, - ], - name: "transferFrom", - outputs: [{ internalType: "bool", name: "", type: "bool" }], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [{ internalType: "address", name: "", type: "address" }], - name: "userBasic", - outputs: [ - { internalType: "int104", name: "principal", type: "int104" }, - { internalType: "uint64", name: "baseTrackingIndex", type: "uint64" }, - { internalType: "uint64", name: "baseTrackingAccrued", type: "uint64" }, - { internalType: "uint16", name: "assetsIn", type: "uint16" }, - { internalType: "uint8", name: "_reserved", type: "uint8" }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { internalType: "address", name: "", type: "address" }, - { internalType: "address", name: "", type: "address" }, - ], - name: "userCollateral", - outputs: [ - { internalType: "uint128", name: "balance", type: "uint128" }, - { internalType: "uint128", name: "_reserved", type: "uint128" }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [{ internalType: "address", name: "", type: "address" }], - name: "userNonce", - outputs: [{ internalType: "uint256", name: "", type: "uint256" }], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { internalType: "address", name: "asset", type: "address" }, - { internalType: "uint256", name: "amount", type: "uint256" }, - ], - name: "withdraw", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { internalType: "address", name: "src", type: "address" }, - { internalType: "address", name: "to", type: "address" }, - { internalType: "address", name: "asset", type: "address" }, - { internalType: "uint256", name: "amount", type: "uint256" }, - ], - name: "withdrawFrom", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { internalType: "address", name: "to", type: "address" }, - { internalType: "uint256", name: "amount", type: "uint256" }, - ], - name: "withdrawReserves", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { internalType: "address", name: "to", type: "address" }, - { internalType: "address", name: "asset", type: "address" }, - { internalType: "uint256", name: "amount", type: "uint256" }, - ], - name: "withdrawTo", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - ], -}; diff --git a/projects/concave/index.js b/projects/concave/index.js index a80c4dbc3fd..bccbfb656aa 100644 --- a/projects/concave/index.js +++ b/projects/concave/index.js @@ -1,16 +1,17 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk') const { ohmTvl } = require('../helper/ohm') -const { calculateUniTvl } = require('../helper/calculateUniTvl'); +const { uniTvlExport } = require('../helper/calculateUniTvl'); const { genericUnwrapCvx } = require('../helper/unwrapLPs'); // Treasury backing the CNV price, similar to OHM so using the ohm wrapper const treasury = '0x226e7af139a0f34c6771deb252f9988876ac1ced' -const etherAddress = '0x0000000000000000000000000000000000000000' +const etherAddress = ADDRESSES.null const cnv_token = '0x000000007a58f5f58e697e51ab0357bc9e260a04' -const stakingAddress = '0x0000000000000000000000000000000000000000' +const stakingAddress = ADDRESSES.null const treasuryTokens = [ - ['0x6b175474e89094c44da98b954eedeac495271d0f', false], //DAI + [ADDRESSES.ethereum.DAI, false], //DAI // ['0x0ab87046fBb341D058F17CBC4c1133F25a20a52f', false], //gOHM ] const gemSwap_factory = '0x066a5cb7ddc6d55384e2f6ca13d5dd2cd2685cbd' @@ -21,7 +22,7 @@ const cvxDOLA_3CRV_BaseRewardPool = '0x835f69e58087e5b6bffef182fe2bf959fe253c3c' async function tvl(timestamp, ethBlock, chainBlocks) { // Count TVL of amm - const balances = await calculateUniTvl(t=>t, ethBlock, 'ethereum', gemSwap_factory, 14300000, true); + const balances = {} // Get ether balance balances[etherAddress] = (await sdk.api.eth.getBalance({ target: treasury, ethBlock })).output @@ -30,10 +31,10 @@ async function tvl(timestamp, ethBlock, chainBlocks) { await genericUnwrapCvx(balances, treasury, cvxDOLA_3CRV_BaseRewardPool, ethBlock, 'ethereum') return balances -}; +} module.exports = ohmTvl(treasury, treasuryTokens, 'ethereum', stakingAddress, cnv_token, undefined, undefined, true) -module.exports.ethereum.tvl = sdk.util.sumChainTvls([tvl, module.exports.ethereum.tvl]) +module.exports.ethereum.tvl = sdk.util.sumChainTvls([tvl, module.exports.ethereum.tvl, uniTvlExport(gemSwap_factory, undefined, true)]) delete module.exports.ethereum.staking module.exports.methodology = 'Count the treasury assets backing the CNV price + LP assets in the AMM Gemswap' diff --git a/projects/concentrator/abis/AladdinAFXS.json b/projects/concentrator/abis/AladdinAFXS.json index 7ae39642667..43111bca20d 100644 --- a/projects/concentrator/abis/AladdinAFXS.json +++ b/projects/concentrator/abis/AladdinAFXS.json @@ -1,28 +1,4 @@ { - "totalAssets": { - "inputs": [], - "name": "totalAssets", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "totalSupply": { - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } + "totalAssets": "uint256:totalAssets", + "totalSupply": "uint256:totalSupply" } \ No newline at end of file diff --git a/projects/concentrator/abis/AladdinCRV.json b/projects/concentrator/abis/AladdinCRV.json index 3219b9bef96..cbf8202f88a 100644 --- a/projects/concentrator/abis/AladdinCRV.json +++ b/projects/concentrator/abis/AladdinCRV.json @@ -1,28 +1,4 @@ { - "totalUnderlying": { - "inputs": [], - "name": "totalUnderlying", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "totalSupply": { - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } + "totalUnderlying": "uint256:totalUnderlying", + "totalSupply": "uint256:totalSupply" } \ No newline at end of file diff --git a/projects/concentrator/abis/AladdinCVX.json b/projects/concentrator/abis/AladdinCVX.json new file mode 100644 index 00000000000..028ce20d0e7 --- /dev/null +++ b/projects/concentrator/abis/AladdinCVX.json @@ -0,0 +1,4 @@ +{ + "totalDebtToken": "uint256:totalDebtToken", + "totalCurveLpToken": "uint256:totalCurveLpToken" +} \ No newline at end of file diff --git a/projects/concentrator/abis/AladdinConvexVault.json b/projects/concentrator/abis/AladdinConvexVault.json index 67b175e1af1..07948508c12 100644 --- a/projects/concentrator/abis/AladdinConvexVault.json +++ b/projects/concentrator/abis/AladdinConvexVault.json @@ -1,71 +1,4 @@ { - "poolInfo": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "poolInfo", - "outputs": [ - { - "internalType": "uint128", - "name": "totalUnderlying", - "type": "uint128" - }, - { - "internalType": "uint128", - "name": "totalShare", - "type": "uint128" - }, - { - "internalType": "uint256", - "name": "accRewardPerShare", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "convexPoolId", - "type": "uint256" - }, - { - "internalType": "address", - "name": "lpToken", - "type": "address" - }, - { - "internalType": "address", - "name": "crvRewards", - "type": "address" - }, - { - "internalType": "uint256", - "name": "withdrawFeePercentage", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "platformFeePercentage", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "harvestBountyPercentage", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "pauseDeposit", - "type": "bool" - }, - { - "internalType": "bool", - "name": "pauseWithdraw", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - } + "poolInfo": "function poolInfo(uint256) view returns (uint128 totalUnderlying, uint128 totalShare, uint256 accRewardPerShare, uint256 convexPoolId, address lpToken, address crvRewards, uint256 withdrawFeePercentage, uint256 platformFeePercentage, uint256 harvestBountyPercentage, bool pauseDeposit, bool pauseWithdraw)", + "afraxETHPoolInfo": "function poolInfo(uint256) view returns (tuple(uint128 totalUnderlying, uint128 totalShare) supply, tuple(address token, address strategy, bool pauseDeposit, bool pauseWithdraw) strategy, tuple(uint128 rate, uint32 periodLength, uint48 lastUpdate, uint48 finishAt, uint256 accRewardPerShare) reward, tuple(uint32 withdrawFeeRatio, uint32 platformFeeRatio, uint32 harvestBountyRatio, uint160 reserved) fee)" } \ No newline at end of file diff --git a/projects/concentrator/abis/AladdinSdCRV.json b/projects/concentrator/abis/AladdinSdCRV.json new file mode 100644 index 00000000000..43111bca20d --- /dev/null +++ b/projects/concentrator/abis/AladdinSdCRV.json @@ -0,0 +1,4 @@ +{ + "totalAssets": "uint256:totalAssets", + "totalSupply": "uint256:totalSupply" +} \ No newline at end of file diff --git a/projects/concentrator/abis/abi.json b/projects/concentrator/abis/abi.json index 1559d8181eb..d095f017051 100644 --- a/projects/concentrator/abis/abi.json +++ b/projects/concentrator/abis/abi.json @@ -1,126 +1,8 @@ { - "poolInfo": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "poolInfo", - "outputs": [ - { - "internalType": "address", - "name": "lptoken", - "type": "address" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "address", - "name": "gauge", - "type": "address" - }, - { - "internalType": "address", - "name": "crvRewards", - "type": "address" - }, - { - "internalType": "address", - "name": "stash", - "type": "address" - }, - { - "internalType": "bool", - "name": "shutdown", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - "poolLength": { - "inputs": [], - "name": "poolLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "coinsUint": { - "name": "coins", - "outputs": [ - { - "type": "address", - "name": "" - } - ], - "inputs": [ - { - "type": "uint256", - "name": "arg0" - } - ], - "stateMutability": "view", - "type": "function", - "gas": 2280 - }, - "coinsInt": { - "name": "coins", - "outputs": [ - { - "type": "address", - "name": "out" - } - ], - "inputs": [ - { - "type": "int128", - "name": "arg0" - } - ], - "constant": true, - "payable": false, - "type": "function", - "gas": 2190 - }, - "underlying": { - "constant": true, - "inputs": [], - "name": "underlying", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "exchangeRateStored": { - "constant": true, - "inputs": [], - "name": "exchangeRateStored", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } + "poolInfo": "function poolInfo(uint256) view returns (address lptoken, address token, address gauge, address crvRewards, address stash, bool shutdown)", + "poolLength": "uint256:poolLength", + "coinsUint": "function coins(uint256 arg0) view returns (address) @2280", + "coinsInt": "function coins(int128 arg0) view returns (address out) @2190", + "underlying": "address:underlying", + "exchangeRateStored": "uint256:exchangeRateStored" } \ No newline at end of file diff --git a/projects/concentrator/config.js b/projects/concentrator/config.js index 1403f4e95c0..cc519583e5f 100644 --- a/projects/concentrator/config.js +++ b/projects/concentrator/config.js @@ -1,4 +1,3 @@ -const REFERENCE_ASSETS = {}; const coins = {}; module.exports = { @@ -15,565 +14,4 @@ module.exports = { } } ], - vaultConfig: [ - { - id: 'SUSDFRAXBP3CRV-f', - name: 'Curve.fi Factory USD Metapool: sUSDFRAXBP', - coins: [ - coins.SUSD, - coins.TUSD, - ], - addresses: { - swap: '0xe3c190c57b5959Ae62EfE3B6797058B76bA2f5eF', - lpToken: '0xe3c190c57b5959Ae62EfE3B6797058B76bA2f5eF' - } - }, - { - id: 'TUSD3CRV-f', - name: 'Curve.fi Factory USD Metapool: TrueUSD', - coins: [ - coins.crvFRAX, - coins.TUSD, - ], - addresses: { - swap: '0xEcd5e75AFb02eFa118AF914515D6521aaBd189F1', - lpToken: '0xEcd5e75AFb02eFa118AF914515D6521aaBd189F1' - } - }, - { - id: 'silofrax-f', - name: 'Curve.fi Factory Crypto Pool: SILO/FRAX', - coins: [ - coins.crvFRAX, - coins.TUSD, - ], - addresses: { - swap: '0x9a22cdb1ca1cdd2371cd5bb5199564c4e89465eb', - lpToken: '0x2302aaBe69e6E7A1b0Aa23aAC68fcCB8A4D2B460' - } - }, - { - id: 'TUSDFRAXBP3CRV-f', - name: 'Curve.fi Factory USD Metapool: TUSDFRAXBP', - coins: [ - coins.crvFRAX, - coins.TUSD, - ], - addresses: { - swap: '0x33baeDa08b8afACc4d3d07cf31d49FC1F1f3E893', - lpToken: '0x33baeDa08b8afACc4d3d07cf31d49FC1F1f3E893' - } - }, - { - id: 'cvxcrv', - name: 'cvxcrv', - coins: [ - coins.crv, - coins.cvxcrv, - ], - addresses: { - swap: '0x9D0464996170c6B9e75eED71c68B99dDEDf279e8', - lpToken: '0x9D0464996170c6B9e75eED71c68B99dDEDf279e8' - } - }, - { - id: 'ib3crv', - name: 'ib3crv', - coins: [ - coins.cyDai, - coins.cyUSDT, - coins.cyUSDC, - ], - addresses: { - swap: '0x2dded6da1bf5dbdf597c45fcfaa3194e53ecfeaf', - lpToken: '0x5282a4eF67D9C33135340fB3289cc1711c13638C' - } - }, - { - id: 'cvxfxs', - name: 'cvxfxs', - coins: [ - coins.fxs, - coins.fxs, - ], - addresses: { - swap: '0xd658A338613198204DCa1143Ac3F01A722b5d94A', - lpToken: '0xF3A43307DcAFa93275993862Aae628fCB50dC768' - } - }, - - { - id: 'steth', - name: 'steth', - coins: [ - coins.eth, - coins.steth, - ], - addresses: { - swap: '0xDC24316b9AE028F1497c275EB9192a3Ea0f67022', - lpToken: '0x06325440D014e39736583c165C2963BA99fAf14E', - }, - }, - - { - id: 'frax', - name: 'frax', - coins: [ - coins.frax, - coins.crv3pool - ], - addresses: { - swap: '0xd632f22692FaC7611d2AA1C0D552930D43CAEd3B', - lpToken: '0xd632f22692FaC7611d2AA1C0D552930D43CAEd3B', - }, - }, - - { - id: 'tricrypto2', - name: 'tricrypto2', - coins: [ - coins.usdt, - coins.wbtc, - coins.eth, - ], - addresses: { - swap: '0xD51a44d3FaE010294C616388b506AcdA1bfAAE46', - lpToken: '0xc4AD29ba4B3c580e6D59105FFf484999997675Ff', - }, - }, - - { - id: 'crveth', - name: 'crveth', - coins: [ - coins.eth, - coins.crv, - ], - addresses: { - swap: '0x8301AE4fc9c624d1D396cbDAa1ed877821D7C511', - lpToken: '0xEd4064f376cB8d68F770FB1Ff088a3d0F3FF5c4d', - }, - }, - - { - id: 'cvxeth', - name: 'cvxeth', - coins: [ - coins.eth, - coins.cvx, - ], - addresses: { - swap: '0xB576491F1E6e5E62f1d8F26062Ee822B40B0E0d4', - lpToken: '0x3A283D9c08E8b55966afb64C515f5143cf907611', - }, - }, - - { - id: 'crv3pool', - name: 'crv3pool', - coins: [ - coins.dai, - coins.usdc, - coins.usdt, - ], - addresses: { - swap: '0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7', - lpToken: '0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490', - }, - }, - - { - id: 'ust-wormhole', - name: 'ust-wormhole', - coins: [ - coins.ust, - coins.crv3pool - ], - addresses: { - swap: '0xCEAF7747579696A2F0bb206a14210e3c9e6fB269', - lpToken: '0xCEAF7747579696A2F0bb206a14210e3c9e6fB269', - }, - }, - - { - id: 'rocketpooleth', - name: 'rocketpooleth', - coins: [ - coins.rETH, - coins.wstETH, - ], - addresses: { - swap: '0x447Ddd4960d9fdBF6af9a790560d0AF76795CB08', - lpToken: '0x447Ddd4960d9fdBF6af9a790560d0AF76795CB08', - }, - }, - - { - id: 'ren', - name: 'ren', - coins: [ - coins.renbtc, - coins.wbtc - ], - addresses: { - swap: '0x93054188d876f558f4a66B2EF1d97d16eDf0895B', - lpToken: '0x49849C98ae39Fff122806C06791Fa73784FB3675', - }, - }, - - { - id: 'pusd', - name: 'pusd', - coins: [ - coins.pusd, - coins.crv3pool - ], - addresses: { - swap: '0x8EE017541375F6Bcd802ba119bdDC94dad6911A1', - lpToken: '0x8EE017541375F6Bcd802ba119bdDC94dad6911A1', - }, - }, - - { - id: 'susd', - name: 'susd', - coins: [ - coins.dai, - coins.usdc, - coins.usdt, - coins.SUSD - ], - addresses: { - swap: '0xA5407eAE9Ba41422680e2e00537571bcC53efBfD', - lpToken: '0xC25a3A3b969415c80451098fa907EC722572917F', - }, - }, - - { - id: 'seth', - name: 'seth', - coins: [ - coins.eth, - coins.seth - ], - addresses: { - swap: '0xc5424b857f758e906013f3555dad202e4bdb4567', - lpToken: '0xA3D87FffcE63B53E0d54fAa1cc983B7eB0b74A9c', - }, - }, - - { - id: 'sbtc', - name: 'sbtc', - coins: [ - coins.renBTC, - coins.wbtc, - coins.sBTC - ], - addresses: { - swap: '0x7fC77b5c7614E1533320Ea6DDc2Eb61fa00A9714', - lpToken: '0x075b1bb99792c9E1041bA13afEf80C91a1e70fB3', - }, - }, - { - id: 'fraxusdc', - name: 'fraxusdc', - coins: [ - coins.frax, - coins.usdc - ], - addresses: { - swap: '0xDcEF968d416a41Cdac0ED8702fAC8128A64241A2', - lpToken: '0x3175Df0976dFA876431C2E9eE6Bc45b65d3473CC', - }, - }, - - - { - id: 'mim', - name: 'mim', - coins: [ - coins.mim, - coins.crv3pool - ], - addresses: { - swap: '0x5a6A4D54456819380173272A5E8E9B9904BdF41B', - lpToken: '0x5a6A4D54456819380173272A5E8E9B9904BdF41B', - }, - }, - { - id: 'fpifrax', - name: 'fpifrax', - coins: [ - coins.frax, - coins.fpi - ], - addresses: { - swap: '0xf861483fa7E511fbc37487D91B6FAa803aF5d37c', - lpToken: '0x4704aB1fb693ce163F7c9D3A31b3FF4eaF797714', - }, - }, - - { - id: 'alusd', - name: 'alusd', - coins: [ - coins.alUSD, - coins.crv3pool - ], - addresses: { - swap: '0x43b4FdFD4Ff969587185cDB6f0BD875c5Fc83f8c', - lpToken: '0x43b4FdFD4Ff969587185cDB6f0BD875c5Fc83f8c', - }, - }, - - { - id: 'Compound', - name: 'Compound', - coins: [ - coins.cdai, - coins.cusdc - ], - addresses: { - swap: '0xA2B47E3D5c44877cca798226B7B8118F9BFb7A56', - lpToken: '0x845838DF265Dcd2c412A1Dc9e959c7d08537f8a2', - }, - }, - - { - id: 'dola', - name: 'dola', - coins: [ - coins.DOLA, - coins.crv3pool - ], - addresses: { - swap: '0xAA5A67c256e27A5d80712c51971408db3370927D', - lpToken: '0xAA5A67c256e27A5d80712c51971408db3370927D', - }, - }, - - { - id: 'busdv2', - name: 'busdv2', - coins: [ - coins.busd, - coins.crv3pool - ], - addresses: { - swap: '0x4807862AA8b2bF68830e4C8dc86D0e9A998e085a', - lpToken: '0x4807862AA8b2bF68830e4C8dc86D0e9A998e085a', - }, - }, - - { - id: 'eursusd', - name: 'eursusd', - coins: [ - coins.eth, - coins.usdc - ], - addresses: { - swap: '0x98a7F18d4E56Cfe84E3D081B40001B3d5bD3eB8B', - lpToken: '0x3D229E1B4faab62F621eF2F6A610961f7BD7b23B', - }, - }, - - { - id: 'alETH', - name: 'alETH', - coins: [ - coins.eth, - coins.eth - ], - addresses: { - swap: '0xC4C319E2D4d66CcA4464C0c2B32c9Bd23ebe784e', - lpToken: '0xC4C319E2D4d66CcA4464C0c2B32c9Bd23ebe784e', - }, - }, - - { - id: '3eur-pool', - name: '3eur-pool', - coins: [ - coins.agEUR, - coins.eurt, - coins.EURS - ], - addresses: { - swap: '0xb9446c4Ef5EBE66268dA6700D26f96273DE3d571', - lpToken: '0xb9446c4Ef5EBE66268dA6700D26f96273DE3d571', - }, - }, - - { - id: 'lusd', - name: 'lusd', - coins: [ - coins.lusd, - coins.crv3pool, - ], - addresses: { - swap: '0xEd279fDD11cA84bEef15AF5D39BB4d4bEE23F0cA', - lpToken: '0xEd279fDD11cA84bEef15AF5D39BB4d4bEE23F0cA', - }, - }, - - { - id: 'd3pool', - name: 'd3pool', - coins: [ - coins.frax, - coins.alUSD, - coins.fei, - ], - addresses: { - swap: '0xBaaa1F5DbA42C3389bDbc2c9D2dE134F5cD0Dc89', - lpToken: '0xBaaa1F5DbA42C3389bDbc2c9D2dE134F5cD0Dc89', - }, - }, - - { - id: 'musd', - name: 'musd', - coins: [ - coins.mUSD, - coins.crv3pool, - ], - addresses: { - swap: '0x8474DdbE98F5aA3179B3B3F5942D724aFcdec9f6', - lpToken: '0x1AEf73d49Dedc4b1778d0706583995958Dc862e6', - }, - }, - - { - id: 'tusd', - name: 'tusd', - coins: [ - coins.TUSD, - coins.crv3pool, - ], - addresses: { - swap: '0xecd5e75afb02efa118af914515d6521aabd189f1', - lpToken: '0xecd5e75afb02efa118af914515d6521aabd189f1', - }, - }, - - { - id: 'tusdfraxbp', - name: 'tusdfraxbp', - coins: [ - coins.TUSD, - coins.FRAXBP, - ], - addresses: { - swap: '0x33baeDa08b8afACc4d3d07cf31d49FC1F1f3E893', - lpToken: '0x33baeDa08b8afACc4d3d07cf31d49FC1F1f3E893', - }, - }, - - { - id: 'silofrax', - name: 'silofrax', - coins: [ - coins.SILO, - coins.frax, - ], - addresses: { - swap: '0x9a22CDB1CA1cdd2371cD5BB5199564C4E89465eb', - lpToken: '0x2302aaBe69e6E7A1b0Aa23aAC68fcCB8A4D2B460', - }, - }, - - { - id: 'alusdfraxbp', - name: 'alusdfraxbp', - coins: [ - coins.alUSD, - coins.FRAXBP, - ], - addresses: { - swap: '0xB30dA2376F63De30b42dC055C93fa474F31330A5', - lpToken: '0xB30dA2376F63De30b42dC055C93fa474F31330A5', - }, - }, - - { - id: 'busdfraxbp', - name: 'busdfraxbp', - coins: [ - coins.busd, - coins.FRAXBP, - ], - addresses: { - swap: '0x8fdb0bB9365a46B145Db80D0B1C5C5e979C84190', - lpToken: '0x8fdb0bB9365a46B145Db80D0B1C5C5e979C84190', - }, - }, - - { - id: 'susdfraxbp', - name: 'susdfraxbp', - coins: [ - coins.SUSD, - coins.FRAXBP, - ], - addresses: { - swap: '0xe3c190c57b5959Ae62EfE3B6797058B76bA2f5eF', - lpToken: '0xe3c190c57b5959Ae62EfE3B6797058B76bA2f5eF', - }, - }, - - { - id: 'lusdfraxbp', - name: 'lusdfraxbp', - coins: [ - coins.lusd, - coins.FRAXBP, - ], - addresses: { - swap: '0x497CE58F34605B9944E6b15EcafE6b001206fd25', - lpToken: '0x497CE58F34605B9944E6b15EcafE6b001206fd25', - }, - }, - - { - id: 'ETH-pETH', - name: 'ETH-pETH', - coins: [ - coins.eth, - coins.pETH, - ], - addresses: { - swap: '0x9848482da3Ee3076165ce6497eDA906E66bB85C5', - lpToken: '0x9848482da3Ee3076165ce6497eDA906E66bB85C5', - }, - }, - - { - id: 'ETH-frxETH', - name: 'ETH-frxETH', - coins: [ - coins.eth, - coins.frxETH, - ], - addresses: { - swap: '0xa1F8A6807c402E4A15ef4EBa36528A3FED24E577', - lpToken: '0xf43211935C781D5ca1a41d2041F397B8A7366C7A', - }, - }, - - { - id: 'ETH-cbETH', - name: 'ETH-cbETH', - coins: [ - coins.eth, - coins.cbETH, - ], - addresses: { - swap: '0x5FAE7E604FC3e24fd43A72867ceBaC94c65b404A', - lpToken: '0x5b6C539b224014A09B3388e51CaAA8e354c959C8', - }, - }, - ] } \ No newline at end of file diff --git a/projects/concentrator/index.js b/projects/concentrator/index.js index e404baacf4e..0397ffeee74 100644 --- a/projects/concentrator/index.js +++ b/projects/concentrator/index.js @@ -1,43 +1,34 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const abi = require('./abis/abi.json') const { default: BigNumber } = require("bignumber.js"); -const { toUSDTBalances } = require('../helper/balances'); const AladdinConvexVaultABI = require('./abis/AladdinConvexVault.json') const AladdinCRVABI = require('./abis/AladdinCRV.json') const AladdinAFXSABI = require('./abis/AladdinAFXS.json') -const { farmConfig, vaultConfig: configPools } = require('./config.js'); -const { createIncrementArray, fetchURL } = require('../helper/utils'); -const { sumTokens2 } = require('../helper/unwrapLPs') +const AladdinCVXABI = require('./abis/AladdinCVX.json') +const AladdinSdCRVABI = require('./abis/AladdinSdCRV.json') +const { farmConfig } = require('./config.js'); const concentratorVault = '0xc8fF37F7d057dF1BB9Ad681b53Fa4726f268E0e8'; const concentratorAcrv = '0x2b95A1Dcc3D405535f9ed33c219ab38E8d7e0884'; const concentratorAFXS = '0xDAF03D70Fe637b91bA6E521A32E1Fb39256d3EC9'; -const cvxcrvAddress = '0x62b9c7356a2dc64a1969e19c23e4f579f9810aa7'; +const concentratorAFrxETH = "0xb15Ad6113264094Fd9BF2238729410A07EBE5ABa"; +const cvxcrvAddress = ADDRESSES.ethereum.cvxCRV; +const concentratorAbcCVXAddress = '0xDEC800C2b17c9673570FDF54450dc1bd79c8E359'; +const concentratorAsdCRVAddress = "0x43E54C2E7b3e294De3A155785F52AB49d87B9922" const concentratorNewVault = '0x3Cf54F3A1969be9916DAD548f3C084331C4450b5'; -const usdtAddress = "0xdac17f958d2ee523a2206206994597c13d831ec7"; -const addressZero = "0x0000000000000000000000000000000000000000" -const ethAddress = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE"; -const wethAddress = "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"; +const concentratorAfxsVault = '0xD6E3BB7b1D6Fa75A71d48CFB10096d59ABbf99E1'; +const concentratorAfrxETHVault = '0x50B47c4A642231dbe0B411a0B2FBC1EBD129346D'; +const usdtAddress = ADDRESSES.ethereum.USDT; const aladdinBalancerLPGauge = '0x33e411ebE366D72d058F3eF22F1D0Cf8077fDaB0'; -const replacements = [ - "0x99d1Fa417f94dcD62BfE781a1213c092a47041Bc", - "0x9777d7E2b60bB01759D0E2f8be2095df444cb07E", - "0x1bE5d71F2dA660BFdee8012dDc58D024448A0A59", - "0x16de59092dAE5CcF4A1E6439D611fd0653f0Bd01", - "0xd6aD7a6750A7593E092a9B218d66C0A814a3436e", - "0x83f798e925BcD4017Eb265844FDDAbb448f1707D", - "0x73a052500105205d34Daf004eAb301916DA8190f" -].map(i => i.toLowerCase()) - -const tokensReplace = [ - ["0xFEEf77d3f69374f66429C91d732A244f074bdf74", "0x3432b6a60d23ca0dfca7761b7ab56459d9c964d0"], - ["0x3175Df0976dFA876431C2E9eE6Bc45b65d3473CC", "0x853d955aCEf822Db058eb8505911ED77F175b99e"], - ["0x836a808d4828586a69364065a1e064609f5078c7", "0x0000000000000000000000000000000000000000"], - ["0x5e8422345238f34275888049021821e8e08caa1f", "0x0000000000000000000000000000000000000000"], -] +const clevCVXAddress = "0xf05e58fCeA29ab4dA01A495140B349F8410Ba904" +const clevCVXCVXAddress = "0xF9078Fb962A7D13F55d40d49C8AA6472aBD1A5a6" +const sdCRVAddress = '0xD1b5651E55D4CeeD36251c61c50C889B36F6abB5' + +const chain = 'ethereum'; async function getBalancerLpTvl(balances, block) { const ctrLpTotalSupply = (await sdk.api.abi.call({ target: aladdinBalancerLPGauge, @@ -56,156 +47,113 @@ async function getFarmLpTvl(balances, block) { abi: 'erc20:totalSupply', params: [] })).output; - - const { output: totalSupplies } = await sdk.api.abi.call({ - target: farmData.addresses.lpToken, - block, - abi: 'erc20:totalSupply', - }) - await getTokenTvl(balances, farmConfig[0], ctrLpTotalSupply, totalSupplies, block) + sdk.util.sumSingleBalance(balances, farmData.addresses.lpToken, ctrLpTotalSupply, chain) } -async function tvl(timestamp, block) { +async function tvl(timestamp, block, _, { api }) { let balances = {} - await getBalancerLpTvl(balances, block) - await getFarmLpTvl(balances, block) - await getAFXSInfo(balances, block); - const acrvTotalUnderlying = (await sdk.api.abi.call({ - target: concentratorAcrv, - block, - abi: AladdinCRVABI.totalUnderlying, - })).output; - const acrvTotalSupply = (await sdk.api.abi.call({ - target: concentratorAcrv, - block, - abi: AladdinCRVABI.totalSupply, - params: [] - })).output; - const rate = acrvTotalSupply * 1 ? BigNumber(acrvTotalUnderlying).div(acrvTotalSupply) : 1 - const cvxcrvBalance = BigNumber(acrvTotalUnderlying).multipliedBy(rate) - sdk.util.sumSingleBalance(balances, cvxcrvAddress, BigNumber(cvxcrvBalance).toFixed(0)) - - const oldPoolLength = (await sdk.api.abi.call({ - target: concentratorVault, - abi: abi.poolLength, - block - })).output; - const newPoolLength = (await sdk.api.abi.call({ - target: concentratorNewVault, - abi: abi.poolLength, - block - })).output; - - await getVaultInfo(oldPoolLength, 'old', balances, block) - await getVaultInfo(newPoolLength, 'New', balances, block) - sdk.util.sumSingleBalance(balances, cvxcrvAddress, BigNumber(acrvTotalUnderlying).toFixed(0)) + await Promise.all([ + getBalancerLpTvl(balances, block), + getFarmLpTvl(balances, block), + getAFXSInfo(balances, block), + getAfrxETHInfo(balances, block), + getAbcCVXInfo(balances, block), + getAsdCRVInfo(balances, block), + getVaultInfo('old', balances, block), + getVaultInfo('New', balances, block), + getVaultInfo('afxs', balances, block), + getVaultInfo('afrxETH', balances, block), + addACRVbalance(balances, api), + ]) return balances } -async function getVaultInfo(poolLength, type, balances, block) { - const _target = type == 'New' ? concentratorNewVault : concentratorVault; - const paramsCalls = createIncrementArray(poolLength).map(i => ({ params: i })) - const { output: poolInfos } = await sdk.api.abi.multiCall({ - target: _target, - abi: AladdinConvexVaultABI.poolInfo, - calls: paramsCalls, - block, - }) - const { output: totalSupplies } = await sdk.api.abi.multiCall({ - abi: 'erc20:totalSupply', - calls: poolInfos.map(i => ({ target: i.output.lpToken })), - block, +async function addACRVbalance(balances, api) { + const acrvTotalUnderlying = await api.call({ + target: concentratorAcrv, + abi: AladdinCRVABI.totalUnderlying, }) + sdk.util.sumSingleBalance(balances, cvxcrvAddress, acrvTotalUnderlying, api.chain) - await Promise.all(poolInfos.map(async (_, i) => { - const poolInfo = poolInfos[i]; - const poolData = configPools.find(crvPool => crvPool.addresses.lpToken.toLowerCase() === poolInfo.output.lpToken.toLowerCase()) - - if (!poolData) { - console.log(`lp token(${poolInfo.output.lpToken}) not found in pre-defined list, assuming it is a swap address, coin length assumed to be 2`) - return; - } - const resolvedLPSupply = totalSupplies[i].output; - await getTokenTvl(balances, poolData, poolInfo.output.totalUnderlying, resolvedLPSupply, block) - })) } -async function getTokenTvl(balances, poolData, totalUnderlying, resolvedLPSupply, block) { - const coinsLength = poolData.coins.length - const swapAddress = poolData.addresses.swap - const coinCalls = createIncrementArray(coinsLength).map(num => { - return { - target: swapAddress, - params: [num] - } - }); - let coins = await sdk.api.abi.multiCall({ - abi: abi.coinsUint, - calls: coinCalls, - block - }) - if (!coins.output[0].success) { - coins = await sdk.api.abi.multiCall({ - abi: abi.coinsInt, - calls: coinCalls, - block - }) - } - let coinBalances = [] - let tokens = coins.output.map(i => { - return i.output; - }) - - if (swapAddress == '0x5FAE7E604FC3e24fd43A72867ceBaC94c65b404A') { - tokens = ['0x0000000000000000000000000000000000000000', '0xbe9895146f7af43049ca1c1ae358b0541ea49704'] - } - if (swapAddress == '0xf2f12B364F614925aB8E2C8BFc606edB9282Ba09') { - tokens = ['0x0000000000000000000000000000000000000000', '0xb3Ad645dB386D7F6D753B2b9C3F4B853DA6890B8'] +async function getVaultInfo(type, balances, block) { + let _target = concentratorVault; + let _abi = AladdinConvexVaultABI.poolInfo; + switch (type) { + case 'old': + _target = concentratorVault; + break; + case 'New': + _target = concentratorNewVault; + break; + case 'afxs': + _target = concentratorAfxsVault; + break; + case 'afrxETH': + _target = concentratorAfrxETHVault; + _abi = AladdinConvexVaultABI.afraxETHPoolInfo; + break; } - let tempBalances = await sumTokens2({ block, owner: swapAddress, tokens }) - Object.entries(tempBalances).forEach(([coin, balance]) => coinBalances.push({ coin, balance })) - coinBalances.map((coinBalance) => { - let coinAddress = coinBalance.coin.toLowerCase() - if (replacements.includes(coinAddress)) { - coinAddress = "0x6b175474e89094c44da98b954eedeac495271d0f" // dai - } - const fitlerToken = tokensReplace.filter((item) => item[0].toLowerCase() == coinAddress.toLowerCase()) - if (fitlerToken.length) { - coinAddress = fitlerToken[0][1] - } - const balance = BigNumber(totalUnderlying * coinBalance.balance / resolvedLPSupply); - if (!balance.isZero()) { - sdk.util.sumSingleBalance(balances, coinAddress, balance.toFixed(0)) + let poolInfo = await sdk.api2.abi.fetchList({ chain, block, lengthAbi: abi.poolLength, itemAbi: _abi, target: _target }) + poolInfo.forEach((item) => { + if (type == 'afrxETH') { + sdk.util.sumSingleBalance(balances, item.strategy.token, item.supply.totalUnderlying, chain) + } else { + sdk.util.sumSingleBalance(balances, item.lpToken, item.totalUnderlying, chain) } }) } async function getAFXSInfo(balances, block) { const cvxfxsCrvInfo = { - id: 'cvxfxs', - name: 'cvxfxs', - coins: [ - 'fxs', - 'fxs' - ], - addresses: { - swap: '0xd658A338613198204DCa1143Ac3F01A722b5d94A', - lpToken: '0xF3A43307DcAFa93275993862Aae628fCB50dC768' - } + lpToken: '0xF3A43307DcAFa93275993862Aae628fCB50dC768' } const aFXSTotalUnderlying = (await sdk.api.abi.call({ target: concentratorAFXS, block, abi: AladdinAFXSABI.totalAssets, })).output; - const { output: totalSupply } = await sdk.api.abi.call({ - abi: 'erc20:totalSupply', - target: cvxfxsCrvInfo.addresses.lpToken, - params: [], + + sdk.util.sumSingleBalance(balances, cvxfxsCrvInfo.lpToken, aFXSTotalUnderlying, chain) +} + +async function getAfrxETHInfo(balances, block) { + const ethFrxETHCrvInfo = { + lpToken: '0xf43211935C781D5ca1a41d2041F397B8A7366C7A' + } + const aFrxETHTotalUnderlying = (await sdk.api.abi.call({ + target: concentratorAFrxETH, block, - }) - await getTokenTvl(balances, cvxfxsCrvInfo, aFXSTotalUnderlying, totalSupply, block) + abi: AladdinAFXSABI.totalAssets, + })).output; + sdk.util.sumSingleBalance(balances, ethFrxETHCrvInfo.lpToken, aFrxETHTotalUnderlying, chain) } + +async function getAbcCVXInfo(balances, block) { + const totalClevCVXAmount = (await sdk.api.abi.call({ + target: concentratorAbcCVXAddress, + block, + abi: AladdinCVXABI.totalDebtToken, + })).output; + const totalCurveLpTokenAmount = (await sdk.api.abi.call({ + target: concentratorAbcCVXAddress, + block, + abi: AladdinCVXABI.totalCurveLpToken, + })).output; + sdk.util.sumSingleBalance(balances, clevCVXAddress, totalClevCVXAmount, chain) + sdk.util.sumSingleBalance(balances, clevCVXCVXAddress, totalCurveLpTokenAmount, chain) +} + +async function getAsdCRVInfo(balances, block) { + const asdCRVTotalUnderlying = (await sdk.api.abi.call({ + target: concentratorAsdCRVAddress, + block, + abi: AladdinSdCRVABI.totalAssets, + })).output; + sdk.util.sumSingleBalance(balances, sdCRVAddress, asdCRVTotalUnderlying, chain) +} + module.exports = { doublecounted: true, ethereum: { diff --git a/projects/concordex-io/index.js b/projects/concordex-io/index.js new file mode 100644 index 00000000000..39ab729a2a7 --- /dev/null +++ b/projects/concordex-io/index.js @@ -0,0 +1,15 @@ +const { post } = require('../helper/http') + +async function tvl(_, _b, _cb, { api, }) { + const body = {"jsonrpc":"2.0","method":"liquidity_pools_list","params":{"filter":{"sort":"EFFECTIVE_TVL","page":1,"is_desc":true,"search":"","limit":999}},"id":0} + const { result: { pools }} = await post('https://cdex-liquidity-pool.concordex.io/v1/rpc', body) + return { + tether: pools.reduce((acc, i) => acc + +i.tvl, 0) + } +} + +module.exports = { + misrepresentedTokens: true, + timetravel: false, + concordium: { tvl }, +} diff --git a/projects/cone/index.js b/projects/cone/index.js index 32b7f5ddfb9..e136ffa180d 100644 --- a/projects/cone/index.js +++ b/projects/cone/index.js @@ -3,8 +3,8 @@ const { getUniTVL } = require('../helper/unknownTokens.js') module.exports = { bsc:{ tvl: getUniTVL({ - chain: 'bsc', useDefaultCoreAssets: true, + hasStablePools: true, factory: '0x0EFc2D2D054383462F2cD72eA2526Ef7687E1016', }), }, diff --git a/projects/config/abis.js b/projects/config/abis.js deleted file mode 100644 index 83088d9b0fe..00000000000 --- a/projects/config/abis.js +++ /dev/null @@ -1,51 +0,0 @@ -let abis = {}; - -abis.minABI = [ - // balanceOf - { - constant: true, - inputs: [{ name: "_owner", type: "address" }], - name: "balanceOf", - outputs: [{ name: "balance", type: "uint256" }], - type: "function" - }, - // decimals - { - constant: true, - inputs: [], - name: "decimals", - outputs: [{ name: "", type: "uint8" }], - type: "function" - }, - //totalSupply - { - constant: true, - inputs: [], - name: "totalSupply", - outputs: [{ name: "", type: "uint256" }], - type: "function" - } -]; - -// Basic yearn vault abi -abis.minYvV2 = [ - // balanceOf - { - constant: true, - inputs: [{ name: "_owner", type: "address" }], - name: "balanceOf", - outputs: [{ name: "balance", type: "uint256" }], - type: "function" - }, - //pricePerShare - { - constant: true, - inputs: [], - name: "pricePerShare", - outputs: [{ name: "", type: "uint256" }], - type: "function" - } -]; -module.exports = { - abis -}; diff --git a/projects/config/bella/abis/bVault.js b/projects/config/bella/abis/bVault.js index c9aa90093dc..2ca1304656f 100644 --- a/projects/config/bella/abis/bVault.js +++ b/projects/config/bella/abis/bVault.js @@ -1,32 +1,4 @@ -module.exports = [ - { - "constant": true, - "inputs": [], - "name": "token", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "underlyingBalance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } -] +module.exports = { + "token": "address:token", + "underlyingBalance": "uint256:underlyingBalance" +} diff --git a/projects/config/boringdao/abis.js b/projects/config/boringdao/abis.js deleted file mode 100644 index 737686ea749..00000000000 --- a/projects/config/boringdao/abis.js +++ /dev/null @@ -1,9 +0,0 @@ - -let abis = {}; - -abis.tunnel = [{"inputs":[{"internalType":"contract IAddressResolver","name":"_addrResolver","type":"address"},{"internalType":"bytes32","name":"_oTokenKey","type":"bytes32"},{"internalType":"bytes32","name":"_tunnelKey","type":"bytes32"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"address","name":"proposer","type":"address"},{"indexed":false,"internalType":"string","name":"assetAddress","type":"string"}],"name":"BurnOToken","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"PledgeSuccess","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"RedeemSuccess","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"WithdrawUnlockSuccess","type":"event"},{"inputs":[],"name":"ADDRESS_BOOK","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"BOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"BORINGDAO","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"BURN_FEE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"BURN_FEE_INSURANCE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"BURN_FEE_PLEDGER","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEV_ADDRESS","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"FEE_POOL","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"INSURANCE_POOL","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"LIQUIDATION","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINT_FEE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINT_FEE_DEV","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINT_FEE_PLEDGER","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINT_FEE_TRUSTEE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"NETWORK_FEE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ORACLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PARAM_BOOK","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PLEDGE_RATE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PLEDGE_TOKEN","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SATELLITE_POOL_FACTORY","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TRUSTEE_FEE_POOL","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"borPledgeInfo","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"string","name":"assetAddress","type":"string"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"burnMiniLimit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"canIssueAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"issue","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"liquidate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"lockDuration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"lockInfo","outputs":[{"internalType":"uint256","name":"unlockTime","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"oTokenKey","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"pledge","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"pledgeRatio","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"redeem","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"redeemLockTxLimit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"setBurnMiniLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"duration","type":"uint256"}],"name":"setLockDuration","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"limit","type":"uint256"}],"name":"setRedeemLockTxLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"totalPledgeBOR","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalTVL","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalValuePledge","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"tunnelKey","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unpause","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"userLockAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"userLockLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdrawUnlock","outputs":[],"stateMutability":"nonpayable","type":"function"}] - - -module.exports = { - abis -} diff --git a/projects/config/cover/cover.js b/projects/config/cover/cover.js index 5ef75fcded8..06f0adefe8e 100644 --- a/projects/config/cover/cover.js +++ b/projects/config/cover/cover.js @@ -1,525 +1,14 @@ let abis = {}; -abis.cover = [ - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "newClaimNonce", - "type": "uint256" - } - ], - "name": "ClaimAccepted", - "type": "event" - }, - { - "inputs": [], - "name": "active", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_index", - "type": "uint256" - } - ], - "name": "activeCovers", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "activeCoversLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_collateral", - "type": "address" - }, - { - "internalType": "uint48", - "name": "_timestamp", - "type": "uint48" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "addCover", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_claimNonce", - "type": "uint256" - } - ], - "name": "claimDetails", - "outputs": [ - { - "internalType": "uint16", - "name": "_payoutNumerator", - "type": "uint16" - }, - { - "internalType": "uint16", - "name": "_payoutDenominator", - "type": "uint16" - }, - { - "internalType": "uint48", - "name": "_incidentTimestamp", - "type": "uint48" - }, - { - "internalType": "uint48", - "name": "_timestamp", - "type": "uint48" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "claimNonce", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "claimRedeemDelay", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "claimsLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_collateral", - "type": "address" - } - ], - "name": "collateralStatusMap", - "outputs": [ - { - "internalType": "uint8", - "name": "_status", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_index", - "type": "uint256" - } - ], - "name": "collaterals", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "collateralsLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_collateral", - "type": "address" - }, - { - "internalType": "uint48", - "name": "_expirationTimestamp", - "type": "uint48" - } - ], - "name": "coverMap", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint16", - "name": "_payoutNumerator", - "type": "uint16" - }, - { - "internalType": "uint16", - "name": "_payoutDenominator", - "type": "uint16" - }, - { - "internalType": "uint48", - "name": "_incidentTimestamp", - "type": "uint48" - }, - { - "internalType": "uint256", - "name": "_protocolNonce", - "type": "uint256" - } - ], - "name": "enactClaim", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint48", - "name": "_expirationTimestamp", - "type": "uint48" - } - ], - "name": "expirationTimestampMap", - "outputs": [ - { - "internalType": "bytes32", - "name": "_name", - "type": "bytes32" - }, - { - "internalType": "uint8", - "name": "_status", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_index", - "type": "uint256" - } - ], - "name": "expirationTimestamps", - "outputs": [ - { - "internalType": "uint48", - "name": "", - "type": "uint48" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "expirationTimestampsLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getProtocolDetails", - "outputs": [ - { - "internalType": "bytes32", - "name": "_name", - "type": "bytes32" - }, - { - "internalType": "bool", - "name": "_active", - "type": "bool" - }, - { - "internalType": "uint256", - "name": "_claimNonce", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_claimRedeemDelay", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_noclaimRedeemDelay", - "type": "uint256" - }, - { - "internalType": "address[]", - "name": "_collaterals", - "type": "address[]" - }, - { - "internalType": "uint48[]", - "name": "_expirationTimestamps", - "type": "uint48[]" - }, - { - "internalType": "address[]", - "name": "_allCovers", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "_allActiveCovers", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "name", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "noclaimRedeemDelay", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bool", - "name": "_active", - "type": "bool" - } - ], - "name": "setActive", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_claimRedeemDelay", - "type": "uint256" - } - ], - "name": "updateClaimRedeemDelay", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_collateral", - "type": "address" - }, - { - "internalType": "uint8", - "name": "_status", - "type": "uint8" - } - ], - "name": "updateCollateral", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint48", - "name": "_expirationTimestamp", - "type": "uint48" - }, - { - "internalType": "bytes32", - "name": "_expirationTimestampName", - "type": "bytes32" - }, - { - "internalType": "uint8", - "name": "_status", - "type": "uint8" - } - ], - "name": "updateExpirationTimestamp", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_noclaimRedeemDelay", - "type": "uint256" - } - ], - "name": "updateNoclaimRedeemDelay", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - } -] - +abis.cover = { + getProtocolDetails: "function getProtocolDetails() view returns (bytes32 _name, bool _active, uint256 _claimNonce, uint256 _claimRedeemDelay, uint256 _noclaimRedeemDelay, address[] _collaterals, uint48[] _expirationTimestamps, address[] _allCovers, address[] _allActiveCovers)", +} -abis.protocols = [{"inputs":[{"internalType":"address","name":"_protocolImplementation","type":"address"},{"internalType":"address","name":"_coverImplementation","type":"address"},{"internalType":"address","name":"_coverERC20Implementation","type":"address"},{"internalType":"address","name":"_governance","type":"address"},{"internalType":"address","name":"_treasury","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferCompleted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferInitiated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"protocolAddress","type":"address"}],"name":"ProtocolInitiation","type":"event"},{"inputs":[{"internalType":"bytes32","name":"_name","type":"bytes32"},{"internalType":"bool","name":"_active","type":"bool"},{"internalType":"address","name":"_collateral","type":"address"},{"internalType":"uint48[]","name":"_timestamps","type":"uint48[]"},{"internalType":"bytes32[]","name":"_timestampNames","type":"bytes32[]"}],"name":"addProtocol","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"claimManager","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"claimOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"coverERC20Implementation","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"coverImplementation","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAllProtocolAddresses","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_protocolName","type":"bytes32"},{"internalType":"uint48","name":"_timestamp","type":"uint48"},{"internalType":"address","name":"_collateral","type":"address"},{"internalType":"uint256","name":"_claimNonce","type":"uint256"},{"internalType":"bool","name":"_isClaimCovToken","type":"bool"}],"name":"getCovTokenAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_protocolName","type":"bytes32"},{"internalType":"uint48","name":"_timestamp","type":"uint48"},{"internalType":"address","name":"_collateral","type":"address"},{"internalType":"uint256","name":"_claimNonce","type":"uint256"}],"name":"getCoverAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_name","type":"bytes32"}],"name":"getProtocolAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_index","type":"uint256"}],"name":"getProtocolNameAndAddress","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"},{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getProtocolsLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getRedeemFees","outputs":[{"internalType":"uint16","name":"_numerator","type":"uint16"},{"internalType":"uint16","name":"_denominator","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"governance","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"protocolImplementation","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"protocols","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"redeemFeeDenominator","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"redeemFeeNumerator","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"treasury","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"updateClaimManager","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newImplementation","type":"address"}],"name":"updateCoverERC20Implementation","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newImplementation","type":"address"}],"name":"updateCoverImplementation","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_redeemFeeNumerator","type":"uint16"},{"internalType":"uint16","name":"_redeemFeeDenominator","type":"uint16"}],"name":"updateFees","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"updateGovernance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newImplementation","type":"address"}],"name":"updateProtocolImplementation","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"updateTreasury","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}] +abis.protocols = { + getAllProtocolAddresses: "address[]:getAllProtocolAddresses", +} module.exports = { abis } + diff --git a/projects/config/defisaver/abis.js b/projects/config/defisaver/abis.js index f04a70c4ed7..3415032db2d 100644 --- a/projects/config/defisaver/abis.js +++ b/projects/config/defisaver/abis.js @@ -1,25 +1,9 @@ module.exports = { - "AaveSubscriptions": { - "abi": [{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint128","name":"","type":"uint128"},{"indexed":false,"internalType":"uint128","name":"","type":"uint128"},{"indexed":false,"internalType":"uint128","name":"","type":"uint128"},{"indexed":false,"internalType":"uint128","name":"","type":"uint128"},{"indexed":false,"internalType":"bool","name":"","type":"bool"}],"name":"ParamUpdates","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"}],"name":"Subscribed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"}],"name":"Unsubscribed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"}],"name":"Updated","type":"event"},{"inputs":[],"name":"admin","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"changeIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"getHolder","outputs":[{"components":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint128","name":"minRatio","type":"uint128"},{"internalType":"uint128","name":"maxRatio","type":"uint128"},{"internalType":"uint128","name":"optimalRatioBoost","type":"uint128"},{"internalType":"uint128","name":"optimalRatioRepay","type":"uint128"},{"internalType":"bool","name":"boostEnabled","type":"bool"}],"internalType":"struct CompoundSubscriptions.CompoundHolder","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getSubscribers","outputs":[{"components":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint128","name":"minRatio","type":"uint128"},{"internalType":"uint128","name":"maxRatio","type":"uint128"},{"internalType":"uint128","name":"optimalRatioBoost","type":"uint128"},{"internalType":"uint128","name":"optimalRatioRepay","type":"uint128"},{"internalType":"bool","name":"boostEnabled","type":"bool"}],"internalType":"struct CompoundSubscriptions.CompoundHolder[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_page","type":"uint256"},{"internalType":"uint256","name":"_perPage","type":"uint256"}],"name":"getSubscribersByPage","outputs":[{"components":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint128","name":"minRatio","type":"uint128"},{"internalType":"uint128","name":"maxRatio","type":"uint128"},{"internalType":"uint128","name":"optimalRatioBoost","type":"uint128"},{"internalType":"uint128","name":"optimalRatioRepay","type":"uint128"},{"internalType":"bool","name":"boostEnabled","type":"bool"}],"internalType":"struct CompoundSubscriptions.CompoundHolder[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"isSubscribed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"kill","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_admin","type":"address"}],"name":"setAdminByAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_admin","type":"address"}],"name":"setAdminByOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"setOwnerByAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint128","name":"_minRatio","type":"uint128"},{"internalType":"uint128","name":"_maxRatio","type":"uint128"},{"internalType":"uint128","name":"_optimalBoost","type":"uint128"},{"internalType":"uint128","name":"_optimalRepay","type":"uint128"},{"internalType":"bool","name":"_boostEnabled","type":"bool"}],"name":"subscribe","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"subscribers","outputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint128","name":"minRatio","type":"uint128"},{"internalType":"uint128","name":"maxRatio","type":"uint128"},{"internalType":"uint128","name":"optimalRatioBoost","type":"uint128"},{"internalType":"uint128","name":"optimalRatioRepay","type":"uint128"},{"internalType":"bool","name":"boostEnabled","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"subscribersPos","outputs":[{"internalType":"uint256","name":"arrPos","type":"uint256"},{"internalType":"bool","name":"subscribed","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unsubscribe","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"unsubscribeByAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdrawStuckFunds","outputs":[],"stateMutability":"nonpayable","type":"function"}], - "networks": { - "1": { - "createdBlock": 10386357, - "address": "0xe08ff7a2badb634f0b581e675e6b3e583de086fc" - } - } - }, - "AaveLoanInfo": { - "abi": [{"inputs":[],"name":"AAVE_LENDING_POOL_ADDRESSES","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"AAVE_REFERRAL_CODE","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DISCOUNT_ADDR","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ETH_ADDR","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"NINETY_NINE_PERCENT_WEI","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SERVICE_FEE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WALLET_ADDR","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_tokens","type":"address[]"}],"name":"getCollFactors","outputs":[{"internalType":"uint256[]","name":"collFactors","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_tokenAddresses","type":"address[]"}],"name":"getFullTokensInfo","outputs":[{"components":[{"internalType":"address","name":"aTokenAddress","type":"address"},{"internalType":"address","name":"underlyingTokenAddress","type":"address"},{"internalType":"uint256","name":"supplyRate","type":"uint256"},{"internalType":"uint256","name":"borrowRate","type":"uint256"},{"internalType":"uint256","name":"totalSupply","type":"uint256"},{"internalType":"uint256","name":"availableLiquidity","type":"uint256"},{"internalType":"uint256","name":"totalBorrow","type":"uint256"},{"internalType":"uint256","name":"collateralFactor","type":"uint256"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"bool","name":"usageAsCollateralEnabled","type":"bool"}],"internalType":"struct AaveLoanInfo.TokenInfoFull[]","name":"tokens","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"getLoanData","outputs":[{"components":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint128","name":"ratio","type":"uint128"},{"internalType":"address[]","name":"collAddr","type":"address[]"},{"internalType":"address[]","name":"borrowAddr","type":"address[]"},{"internalType":"uint256[]","name":"collAmounts","type":"uint256[]"},{"internalType":"uint256[]","name":"borrowAmounts","type":"uint256[]"}],"internalType":"struct AaveLoanInfo.LoanData","name":"data","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_users","type":"address[]"}],"name":"getLoanDataArr","outputs":[{"components":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint128","name":"ratio","type":"uint128"},{"internalType":"address[]","name":"collAddr","type":"address[]"},{"internalType":"address[]","name":"borrowAddr","type":"address[]"},{"internalType":"uint256[]","name":"collAmounts","type":"uint256[]"},{"internalType":"uint256[]","name":"borrowAmounts","type":"uint256[]"}],"internalType":"struct AaveLoanInfo.LoanData[]","name":"loans","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_borrowAddress","type":"address"},{"internalType":"address","name":"_user","type":"address"}],"name":"getMaxBorrow","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_collateralAddress","type":"address"},{"internalType":"address","name":"_user","type":"address"}],"name":"getMaxCollateral","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_tokens","type":"address[]"}],"name":"getPrices","outputs":[{"internalType":"uint256[]","name":"prices","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"getRatio","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_users","type":"address[]"}],"name":"getRatios","outputs":[{"internalType":"uint256[]","name":"ratios","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"getSafetyRatio","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"},{"internalType":"address[]","name":"_tokens","type":"address[]"}],"name":"getTokenBalances","outputs":[{"internalType":"uint256[]","name":"balances","type":"uint256[]"},{"internalType":"uint256[]","name":"borrows","type":"uint256[]"},{"internalType":"bool[]","name":"enabledAsCollateral","type":"bool[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_tokenAddresses","type":"address[]"}],"name":"getTokensInfo","outputs":[{"components":[{"internalType":"address","name":"aTokenAddress","type":"address"},{"internalType":"address","name":"underlyingTokenAddress","type":"address"},{"internalType":"uint256","name":"collateralFactor","type":"uint256"},{"internalType":"uint256","name":"price","type":"uint256"}],"internalType":"struct AaveLoanInfo.TokenInfo[]","name":"tokens","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"_user","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"sendContractBalance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"_user","type":"address"}],"name":"sendFullContractBalance","outputs":[],"stateMutability":"nonpayable","type":"function"}], - "networks": { - "1": { - "createdBlock": 9927785, - "address": "0x1Df7A99Bb19a09C2FF53D3c9240073B30ea72Bfa" - } - } - }, "CompoundSubscriptions": { - "abi":[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint128","name":"","type":"uint128"},{"indexed":false,"internalType":"uint128","name":"","type":"uint128"},{"indexed":false,"internalType":"uint128","name":"","type":"uint128"},{"indexed":false,"internalType":"uint128","name":"","type":"uint128"},{"indexed":false,"internalType":"bool","name":"","type":"bool"}],"name":"ParamUpdates","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"}],"name":"Subscribed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"}],"name":"Unsubscribed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"}],"name":"Updated","type":"event"},{"constant":true,"inputs":[],"name":"admin","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"changeIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"getHolder","outputs":[{"components":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint128","name":"minRatio","type":"uint128"},{"internalType":"uint128","name":"maxRatio","type":"uint128"},{"internalType":"uint128","name":"optimalRatioBoost","type":"uint128"},{"internalType":"uint128","name":"optimalRatioRepay","type":"uint128"},{"internalType":"bool","name":"boostEnabled","type":"bool"}],"internalType":"struct CompoundSubscriptions.CompoundHolder","name":"","type":"tuple"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getSubscribers","outputs":[{"components":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint128","name":"minRatio","type":"uint128"},{"internalType":"uint128","name":"maxRatio","type":"uint128"},{"internalType":"uint128","name":"optimalRatioBoost","type":"uint128"},{"internalType":"uint128","name":"optimalRatioRepay","type":"uint128"},{"internalType":"bool","name":"boostEnabled","type":"bool"}],"internalType":"struct CompoundSubscriptions.CompoundHolder[]","name":"","type":"tuple[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"_page","type":"uint256"},{"internalType":"uint256","name":"_perPage","type":"uint256"}],"name":"getSubscribersByPage","outputs":[{"components":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint128","name":"minRatio","type":"uint128"},{"internalType":"uint128","name":"maxRatio","type":"uint128"},{"internalType":"uint128","name":"optimalRatioBoost","type":"uint128"},{"internalType":"uint128","name":"optimalRatioRepay","type":"uint128"},{"internalType":"bool","name":"boostEnabled","type":"bool"}],"internalType":"struct CompoundSubscriptions.CompoundHolder[]","name":"","type":"tuple[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"isSubscribed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_admin","type":"address"}],"name":"setAdminByAdmin","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_admin","type":"address"}],"name":"setAdminByOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"setOwnerByAdmin","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint128","name":"_minRatio","type":"uint128"},{"internalType":"uint128","name":"_maxRatio","type":"uint128"},{"internalType":"uint128","name":"_optimalBoost","type":"uint128"},{"internalType":"uint128","name":"_optimalRepay","type":"uint128"},{"internalType":"bool","name":"_boostEnabled","type":"bool"}],"name":"subscribe","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"subscribers","outputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint128","name":"minRatio","type":"uint128"},{"internalType":"uint128","name":"maxRatio","type":"uint128"},{"internalType":"uint128","name":"optimalRatioBoost","type":"uint128"},{"internalType":"uint128","name":"optimalRatioRepay","type":"uint128"},{"internalType":"bool","name":"boostEnabled","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"subscribersPos","outputs":[{"internalType":"uint256","name":"arrPos","type":"uint256"},{"internalType":"bool","name":"subscribed","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"unsubscribe","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"unsubscribeByAdmin","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}], - "networks": { + "abi": { + getSubscribers: "function getSubscribers() view returns (tuple(address user, uint128 minRatio, uint128 maxRatio, uint128 optimalRatioBoost, uint128 optimalRatioRepay, bool boostEnabled)[])", + }, + "networks": { "1": { "createdBlock": 8335635, "address": "0x52015effd577e08f498a0ccc11905925d58d6207" @@ -27,7 +11,9 @@ module.exports = { } }, "CompoundLoanInfo": { - "abi": [{"constant":true,"inputs":[],"name":"CETH_ADDRESS","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"COMPOUND_LOGGER","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"COMPOUND_ORACLE","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"COMPTROLLER","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"DISCOUNT_ADDRESS","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ETH_ADDRESS","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"SERVICE_FEE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"WALLET_ID","outputs":[{"internalType":"address payable","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"comp","outputs":[{"internalType":"contract ComptrollerInterface","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address[]","name":"_cTokens","type":"address[]"}],"name":"getCollFactors","outputs":[{"internalType":"uint256[]","name":"collFactors","type":"uint256[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"getLoanData","outputs":[{"components":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint128","name":"ratio","type":"uint128"},{"internalType":"address[]","name":"collAddr","type":"address[]"},{"internalType":"address[]","name":"borrowAddr","type":"address[]"},{"internalType":"uint256[]","name":"collAmounts","type":"uint256[]"},{"internalType":"uint256[]","name":"borrowAmounts","type":"uint256[]"}],"internalType":"struct CompoundLoanInfo.LoanData","name":"data","type":"tuple"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address[]","name":"_users","type":"address[]"}],"name":"getLoanDataArr","outputs":[{"components":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint128","name":"ratio","type":"uint128"},{"internalType":"address[]","name":"collAddr","type":"address[]"},{"internalType":"address[]","name":"borrowAddr","type":"address[]"},{"internalType":"uint256[]","name":"collAmounts","type":"uint256[]"},{"internalType":"uint256[]","name":"borrowAmounts","type":"uint256[]"}],"internalType":"struct CompoundLoanInfo.LoanData[]","name":"loans","type":"tuple[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_cBorrowAddress","type":"address"}],"name":"getMaxBorrow","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_cCollAddress","type":"address"}],"name":"getMaxCollateral","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address[]","name":"_cTokens","type":"address[]"}],"name":"getPrices","outputs":[{"internalType":"uint256[]","name":"prices","type":"uint256[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"getRatio","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address[]","name":"_users","type":"address[]"}],"name":"getRatios","outputs":[{"internalType":"uint256[]","name":"ratios","type":"uint256[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address[]","name":"_cTokenAddresses","type":"address[]"}],"name":"getTokensInfo","outputs":[{"components":[{"internalType":"address","name":"cTokenAddress","type":"address"},{"internalType":"address","name":"underlyingTokenAddress","type":"address"},{"internalType":"uint256","name":"collateralFactor","type":"uint256"},{"internalType":"uint256","name":"price","type":"uint256"}],"internalType":"struct CompoundLoanInfo.TokenInfo[]","name":"tokens","type":"tuple[]"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"oracle","outputs":[{"internalType":"contract CompoundOracle","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"}], + "abi": { + getLoanDataArr: "function getLoanDataArr(address[] _users) view returns (tuple(address user, uint128 ratio, address[] collAddr, address[] borrowAddr, uint256[] collAmounts, uint256[] borrowAmounts)[] loans)", + }, "networks": { "1": { "createdBlock": 8335635, @@ -36,7 +22,9 @@ module.exports = { } }, "McdSubscriptions": { - "abi":[{"constant":true,"inputs":[],"name":"WETH_ADDRESS","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CDAI_ADDRESS","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getSubscribers","outputs":[{"components":[{"name":"minRatio","type":"uint128"},{"name":"maxRatio","type":"uint128"},{"name":"optimalRatioBoost","type":"uint128"},{"name":"optimalRatioRepay","type":"uint128"},{"name":"owner","type":"address"},{"name":"cdpId","type":"uint256"},{"name":"boostEnabled","type":"bool"},{"name":"nextPriceEnabled","type":"bool"}],"name":"","type":"tuple[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"SAVINGS_LOGGER_ADDRESS","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"SAI_ADDRESS","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"changeIndex","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_cdpId","type":"uint256"}],"name":"getCdpHolder","outputs":[{"name":"subscribed","type":"bool"},{"components":[{"name":"minRatio","type":"uint128"},{"name":"maxRatio","type":"uint128"},{"name":"optimalRatioBoost","type":"uint128"},{"name":"optimalRatioRepay","type":"uint128"},{"name":"owner","type":"address"},{"name":"cdpId","type":"uint256"},{"name":"boostEnabled","type":"bool"},{"name":"nextPriceEnabled","type":"bool"}],"name":"","type":"tuple"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"PIP_INTERFACE_ADDRESS","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_owner","type":"address"}],"name":"setOwnerByAdmin","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"KYBER_ETH_ADDRESS","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"OTC_ADDRESS","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"DAI_ADDRESS","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"IDAI_ADDRESS","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_ilk","type":"bytes32"},{"name":"_cdpId","type":"uint256"}],"name":"getIlkInfo","outputs":[{"name":"ilk","type":"bytes32"},{"name":"art","type":"uint256"},{"name":"rate","type":"uint256"},{"name":"spot","type":"uint256"},{"name":"line","type":"uint256"},{"name":"dust","type":"uint256"},{"name":"mat","type":"uint256"},{"name":"par","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"spotter","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"GAS_TOKEN_INTERFACE_ADDRESS","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"vat","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"VOX_ADDRESS","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"MANAGER_ADDRESS","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"MONITOR_ADDRESS","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ETH2DAI_WRAPPER","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"manager","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"STUPID_EXCHANGE","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"subscribers","outputs":[{"name":"minRatio","type":"uint128"},{"name":"maxRatio","type":"uint128"},{"name":"optimalRatioBoost","type":"uint128"},{"name":"optimalRatioRepay","type":"uint128"},{"name":"owner","type":"address"},{"name":"cdpId","type":"uint256"},{"name":"boostEnabled","type":"bool"},{"name":"nextPriceEnabled","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_cdpId","type":"uint256"},{"name":"_minRatio","type":"uint128"},{"name":"_maxRatio","type":"uint128"},{"name":"_optimalBoost","type":"uint128"},{"name":"_optimalRepay","type":"uint128"},{"name":"_boostEnabled","type":"bool"},{"name":"_nextPriceEnabled","type":"bool"}],"name":"subscribe","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"MIGRATION_ACTIONS_PROXY","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"bytes32"}],"name":"minLimits","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"SPOTTER_ADDRESS","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"subscribersPos","outputs":[{"name":"arrPos","type":"uint256"},{"name":"subscribed","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"PROXY_REGISTRY_INTERFACE_ADDRESS","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"PROXY_ACTIONS","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"MKR_ADDRESS","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"FACTORY_ADDRESS","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_page","type":"uint256"},{"name":"_perPage","type":"uint256"}],"name":"getSubscribersByPage","outputs":[{"components":[{"name":"minRatio","type":"uint128"},{"name":"maxRatio","type":"uint128"},{"name":"optimalRatioBoost","type":"uint128"},{"name":"optimalRatioRepay","type":"uint128"},{"name":"owner","type":"address"},{"name":"cdpId","type":"uint256"},{"name":"boostEnabled","type":"bool"},{"name":"nextPriceEnabled","type":"bool"}],"name":"","type":"tuple[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_cdpId","type":"uint256"}],"name":"unsubscribeByAdmin","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"LOGGER_ADDRESS","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"SAVER_EXCHANGE_ADDRESS","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"MAKER_DAI_ADDRESS","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"DISCOUNT_ADDRESS","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_admin","type":"address"}],"name":"setAdminByAdmin","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"JUG_ADDRESS","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_cdpId","type":"uint256"}],"name":"unsubscribe","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"NEW_CDAI_ADDRESS","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"KYBER_WRAPPER","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"SUBSCRIPTION_ADDRESS","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"NEW_IDAI_ADDRESS","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"COMPOUND_DAI_ADDRESS","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_cdpId","type":"uint256"}],"name":"getOwner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UNISWAP_FACTORY","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"OASIS_WRAPPER","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"PETH_ADDRESS","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_cdpId","type":"uint256"}],"name":"getSubscribedInfo","outputs":[{"name":"","type":"bool"},{"name":"","type":"uint128"},{"name":"","type":"uint128"},{"name":"","type":"uint128"},{"name":"","type":"uint128"},{"name":"","type":"address"},{"name":"coll","type":"uint256"},{"name":"debt","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"KYBER_INTERFACE","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"VAT_ADDRESS","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"DAI_JOIN_ADDRESS","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ERC20_PROXY_0X","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"WALLET_ID","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"SOLO_MARGIN_ADDRESS","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UNISWAP_WRAPPER","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_admin","type":"address"}],"name":"setAdminByOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"saverProxy","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_ilk","type":"bytes32"},{"name":"_newRatio","type":"uint256"}],"name":"changeMinRatios","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"TUB_ADDRESS","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ETH_JOIN_ADDRESS","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"SCD_MCD_MIGRATION","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"admin","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"_saverProxy","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"cdpId","type":"uint256"}],"name":"Subscribed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"cdpId","type":"uint256"}],"name":"Unsubscribed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"cdpId","type":"uint256"}],"name":"Updated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"cdpId","type":"uint256"},{"indexed":false,"name":"","type":"uint128"},{"indexed":false,"name":"","type":"uint128"},{"indexed":false,"name":"","type":"uint128"},{"indexed":false,"name":"","type":"uint128"},{"indexed":false,"name":"boostEnabled","type":"bool"}],"name":"ParamUpdates","type":"event"}], + "abi":{ + getSubscribers: "function getSubscribers() view returns (tuple(uint128 minRatio, uint128 maxRatio, uint128 optimalRatioBoost, uint128 optimalRatioRepay, address owner, uint256 cdpId, bool boostEnabled, bool nextPriceEnabled)[])", + }, "networks": { "1": { "createdBlock": 8335635, @@ -45,7 +33,9 @@ module.exports = { } }, "MCDSaverProxy": { - "abi": [{"constant":true,"inputs":[],"name":"WETH_ADDRESS","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CDAI_ADDRESS","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"SAVINGS_LOGGER_ADDRESS","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"SAI_ADDRESS","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ETH_ILK","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"PIP_INTERFACE_ADDRESS","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"KYBER_ETH_ADDRESS","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"OTC_ADDRESS","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"DAI_ADDRESS","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"IDAI_ADDRESS","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"spotter","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_manager","type":"address"},{"name":"_cdpId","type":"uint256"}],"name":"getOwner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"GAS_TOKEN_INTERFACE_ADDRESS","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"vat","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"VOX_ADDRESS","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"MANAGER_ADDRESS","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_manager","type":"address"},{"name":"_cdpId","type":"uint256"},{"name":"_ilk","type":"bytes32"}],"name":"getCdpInfo","outputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"MONITOR_ADDRESS","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ETH2DAI_WRAPPER","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"manager","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"STUPID_EXCHANGE","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"SERVICE_FEE","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"SPOTTER_ADDRESS","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"PROXY_REGISTRY_INTERFACE_ADDRESS","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"MKR_ADDRESS","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"FACTORY_ADDRESS","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"LOGGER_ADDRESS","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"SAVER_EXCHANGE_ADDRESS","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"MAKER_DAI_ADDRESS","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"DISCOUNT_ADDRESS","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"JUG_ADDRESS","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"KYBER_WRAPPER","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"SUBSCRIPTION_ADDRESS","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"daiJoin","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"COMPOUND_DAI_ADDRESS","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"SAI_SAVER_PROXY","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UNISWAP_FACTORY","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"OASIS_WRAPPER","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"PETH_ADDRESS","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"KYBER_INTERFACE","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"VAT_ADDRESS","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"DAI_JOIN_ADDRESS","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"WALLET_ID","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"SOLO_MARGIN_ADDRESS","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"UNISWAP_WRAPPER","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"TUB_ADDRESS","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ETH_JOIN_ADDRESS","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"SCD_MCD_MIGRATION","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_cdpId","type":"uint256"},{"name":"_joinAddr","type":"address"},{"name":"_amount","type":"uint256"},{"name":"_minPrice","type":"uint256"},{"name":"_exchangeType","type":"uint256"},{"name":"_gasCost","type":"uint256"}],"name":"repay","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_cdpId","type":"uint256"},{"name":"_joinAddr","type":"address"},{"name":"_daiAmount","type":"uint256"},{"name":"_minPrice","type":"uint256"},{"name":"_exchangeType","type":"uint256"},{"name":"_gasCost","type":"uint256"}],"name":"boost","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_cdpId","type":"uint256"},{"name":"_ilk","type":"bytes32"}],"name":"getMaxCollateral","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_cdpId","type":"uint256"},{"name":"_ilk","type":"bytes32"}],"name":"getMaxDebt","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_ilk","type":"bytes32"}],"name":"getPrice","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_cdpId","type":"uint256"},{"name":"_ilk","type":"bytes32"}],"name":"getRatio","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_cdpId","type":"uint256"}],"name":"getCdpDetailedInfo","outputs":[{"name":"collateral","type":"uint256"},{"name":"debt","type":"uint256"},{"name":"price","type":"uint256"},{"name":"ilk","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"}], + "abi": { + getCdpDetailedInfo: "function getCdpDetailedInfo(uint256 _cdpId) view returns (uint256 collateral, uint256 debt, uint256 price, bytes32 ilk)", + }, "networks": { "42": { "createdBlock": 14500373, @@ -58,7 +48,9 @@ module.exports = { } }, "AaveSubscriptionsV2": { - "abi": [{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint128","name":"","type":"uint128"},{"indexed":false,"internalType":"uint128","name":"","type":"uint128"},{"indexed":false,"internalType":"uint128","name":"","type":"uint128"},{"indexed":false,"internalType":"uint128","name":"","type":"uint128"},{"indexed":false,"internalType":"bool","name":"","type":"bool"}],"name":"ParamUpdates","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"}],"name":"Subscribed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"}],"name":"Unsubscribed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"}],"name":"Updated","type":"event"},{"inputs":[],"name":"NAME","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"admin","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"changeIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"getHolder","outputs":[{"components":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint128","name":"minRatio","type":"uint128"},{"internalType":"uint128","name":"maxRatio","type":"uint128"},{"internalType":"uint128","name":"optimalRatioBoost","type":"uint128"},{"internalType":"uint128","name":"optimalRatioRepay","type":"uint128"},{"internalType":"bool","name":"boostEnabled","type":"bool"}],"internalType":"struct AaveSubscriptionsV2.AaveHolder","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getSubscribers","outputs":[{"components":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint128","name":"minRatio","type":"uint128"},{"internalType":"uint128","name":"maxRatio","type":"uint128"},{"internalType":"uint128","name":"optimalRatioBoost","type":"uint128"},{"internalType":"uint128","name":"optimalRatioRepay","type":"uint128"},{"internalType":"bool","name":"boostEnabled","type":"bool"}],"internalType":"struct AaveSubscriptionsV2.AaveHolder[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_page","type":"uint256"},{"internalType":"uint256","name":"_perPage","type":"uint256"}],"name":"getSubscribersByPage","outputs":[{"components":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint128","name":"minRatio","type":"uint128"},{"internalType":"uint128","name":"maxRatio","type":"uint128"},{"internalType":"uint128","name":"optimalRatioBoost","type":"uint128"},{"internalType":"uint128","name":"optimalRatioRepay","type":"uint128"},{"internalType":"bool","name":"boostEnabled","type":"bool"}],"internalType":"struct AaveSubscriptionsV2.AaveHolder[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"isSubscribed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"kill","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_admin","type":"address"}],"name":"setAdminByAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_admin","type":"address"}],"name":"setAdminByOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"setOwnerByAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint128","name":"_minRatio","type":"uint128"},{"internalType":"uint128","name":"_maxRatio","type":"uint128"},{"internalType":"uint128","name":"_optimalBoost","type":"uint128"},{"internalType":"uint128","name":"_optimalRepay","type":"uint128"},{"internalType":"bool","name":"_boostEnabled","type":"bool"}],"name":"subscribe","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"subscribers","outputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint128","name":"minRatio","type":"uint128"},{"internalType":"uint128","name":"maxRatio","type":"uint128"},{"internalType":"uint128","name":"optimalRatioBoost","type":"uint128"},{"internalType":"uint128","name":"optimalRatioRepay","type":"uint128"},{"internalType":"bool","name":"boostEnabled","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"subscribersPos","outputs":[{"internalType":"uint256","name":"arrPos","type":"uint256"},{"internalType":"bool","name":"subscribed","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unsubscribe","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"unsubscribeByAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdrawStuckFunds","outputs":[],"stateMutability":"nonpayable","type":"function"}], + "abi": { + getSubscribers: "function getSubscribers() view returns (tuple(address user, uint128 minRatio, uint128 maxRatio, uint128 optimalRatioBoost, uint128 optimalRatioRepay, bool boostEnabled)[])", + }, "networks": { "1": { "address": "0x6B25043BF08182d8e86056C6548847aF607cd7CD" @@ -66,7 +58,9 @@ module.exports = { } }, "AaveLoanInfoV2": { - "abi": [{"inputs":[],"name":"AAVE_REFERRAL_CODE","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"AUTOMATIC_SERVICE_FEE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"BOT_REGISTRY_ADDRESS","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DISCOUNT_ADDR","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ETH_ADDR","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MANUAL_SERVICE_FEE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"NINETY_NINE_PERCENT_WEI","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"STABLE_ID","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"VARIABLE_ID","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WALLET_ADDR","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WETH_ADDRESS","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_market","type":"address"},{"internalType":"address[]","name":"_tokens","type":"address[]"}],"name":"getCollFactors","outputs":[{"internalType":"uint256[]","name":"collFactors","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_market","type":"address"},{"internalType":"address[]","name":"_tokenAddresses","type":"address[]"}],"name":"getFullTokensInfo","outputs":[{"components":[{"internalType":"address","name":"aTokenAddress","type":"address"},{"internalType":"address","name":"underlyingTokenAddress","type":"address"},{"internalType":"uint256","name":"supplyRate","type":"uint256"},{"internalType":"uint256","name":"borrowRateVariable","type":"uint256"},{"internalType":"uint256","name":"borrowRateStable","type":"uint256"},{"internalType":"uint256","name":"totalSupply","type":"uint256"},{"internalType":"uint256","name":"availableLiquidity","type":"uint256"},{"internalType":"uint256","name":"totalBorrow","type":"uint256"},{"internalType":"uint256","name":"collateralFactor","type":"uint256"},{"internalType":"uint256","name":"liquidationRatio","type":"uint256"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"bool","name":"usageAsCollateralEnabled","type":"bool"},{"internalType":"bool","name":"borrowinEnabled","type":"bool"},{"internalType":"bool","name":"stableBorrowRateEnabled","type":"bool"}],"internalType":"struct AaveLoanInfoV2.TokenInfoFull[]","name":"tokens","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_market","type":"address"},{"internalType":"address","name":"_user","type":"address"}],"name":"getLoanData","outputs":[{"components":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint128","name":"ratio","type":"uint128"},{"internalType":"address[]","name":"collAddr","type":"address[]"},{"internalType":"address[]","name":"borrowAddr","type":"address[]"},{"internalType":"uint256[]","name":"collAmounts","type":"uint256[]"},{"internalType":"uint256[]","name":"borrowStableAmounts","type":"uint256[]"},{"internalType":"uint256[]","name":"borrowVariableAmounts","type":"uint256[]"}],"internalType":"struct AaveLoanInfoV2.LoanData","name":"data","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_market","type":"address"},{"internalType":"address[]","name":"_users","type":"address[]"}],"name":"getLoanDataArr","outputs":[{"components":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint128","name":"ratio","type":"uint128"},{"internalType":"address[]","name":"collAddr","type":"address[]"},{"internalType":"address[]","name":"borrowAddr","type":"address[]"},{"internalType":"uint256[]","name":"collAmounts","type":"uint256[]"},{"internalType":"uint256[]","name":"borrowStableAmounts","type":"uint256[]"},{"internalType":"uint256[]","name":"borrowVariableAmounts","type":"uint256[]"}],"internalType":"struct AaveLoanInfoV2.LoanData[]","name":"loans","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_market","type":"address"},{"internalType":"address[]","name":"_tokens","type":"address[]"}],"name":"getPrices","outputs":[{"internalType":"uint256[]","name":"prices","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_market","type":"address"},{"internalType":"address","name":"_user","type":"address"}],"name":"getRatio","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_market","type":"address"},{"internalType":"address[]","name":"_users","type":"address[]"}],"name":"getRatios","outputs":[{"internalType":"uint256[]","name":"ratios","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_market","type":"address"},{"internalType":"address","name":"_user","type":"address"}],"name":"getSafetyRatio","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_market","type":"address"},{"internalType":"address","name":"_user","type":"address"},{"internalType":"address[]","name":"_tokens","type":"address[]"}],"name":"getTokenBalances","outputs":[{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"borrowsStable","type":"uint256"},{"internalType":"uint256","name":"borrowsVariable","type":"uint256"},{"internalType":"uint256","name":"stableBorrowRate","type":"uint256"},{"internalType":"bool","name":"enabledAsCollateral","type":"bool"}],"internalType":"struct AaveLoanInfoV2.UserToken[]","name":"userTokens","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_market","type":"address"},{"internalType":"address[]","name":"_tokenAddresses","type":"address[]"}],"name":"getTokensInfo","outputs":[{"components":[{"internalType":"address","name":"aTokenAddress","type":"address"},{"internalType":"address","name":"underlyingTokenAddress","type":"address"},{"internalType":"uint256","name":"collateralFactor","type":"uint256"},{"internalType":"uint256","name":"price","type":"uint256"}],"internalType":"struct AaveLoanInfoV2.TokenInfo[]","name":"tokens","type":"tuple[]"}],"stateMutability":"view","type":"function"}], + "abi": { + getLoanDataArr: "function getLoanDataArr(address _market, address[] _users) view returns (tuple(address user, uint128 ratio, address[] collAddr, address[] borrowAddr, uint256[] collAmounts, uint256[] borrowStableAmounts, uint256[] borrowVariableAmounts)[] loans)", + }, "networks": { "1": { "address": "0xd0C9ADDABbA270493A6503e74E62794435c8F1D3" diff --git a/projects/config/ellipsis/abis.js b/projects/config/ellipsis/abis.js deleted file mode 100644 index 6f620d50e81..00000000000 --- a/projects/config/ellipsis/abis.js +++ /dev/null @@ -1,7 +0,0 @@ -let abis = {} -abis.main = [{"name":"TokenExchange","inputs":[{"name":"buyer","type":"address","indexed":true},{"name":"sold_id","type":"int128","indexed":false},{"name":"tokens_sold","type":"uint256","indexed":false},{"name":"bought_id","type":"int128","indexed":false},{"name":"tokens_bought","type":"uint256","indexed":false}],"anonymous":false,"type":"event"},{"name":"AddLiquidity","inputs":[{"name":"provider","type":"address","indexed":true},{"name":"token_amounts","type":"uint256[3]","indexed":false},{"name":"fees","type":"uint256[3]","indexed":false},{"name":"invariant","type":"uint256","indexed":false},{"name":"token_supply","type":"uint256","indexed":false}],"anonymous":false,"type":"event"},{"name":"RemoveLiquidity","inputs":[{"name":"provider","type":"address","indexed":true},{"name":"token_amounts","type":"uint256[3]","indexed":false},{"name":"fees","type":"uint256[3]","indexed":false},{"name":"token_supply","type":"uint256","indexed":false}],"anonymous":false,"type":"event"},{"name":"RemoveLiquidityOne","inputs":[{"name":"provider","type":"address","indexed":true},{"name":"token_amount","type":"uint256","indexed":false},{"name":"coin_amount","type":"uint256","indexed":false}],"anonymous":false,"type":"event"},{"name":"RemoveLiquidityImbalance","inputs":[{"name":"provider","type":"address","indexed":true},{"name":"token_amounts","type":"uint256[3]","indexed":false},{"name":"fees","type":"uint256[3]","indexed":false},{"name":"invariant","type":"uint256","indexed":false},{"name":"token_supply","type":"uint256","indexed":false}],"anonymous":false,"type":"event"},{"name":"CommitNewAdmin","inputs":[{"name":"deadline","type":"uint256","indexed":true},{"name":"admin","type":"address","indexed":true}],"anonymous":false,"type":"event"},{"name":"NewAdmin","inputs":[{"name":"admin","type":"address","indexed":true}],"anonymous":false,"type":"event"},{"name":"CommitNewFee","inputs":[{"name":"deadline","type":"uint256","indexed":true},{"name":"fee","type":"uint256","indexed":false},{"name":"admin_fee","type":"uint256","indexed":false}],"anonymous":false,"type":"event"},{"name":"NewFee","inputs":[{"name":"fee","type":"uint256","indexed":false},{"name":"admin_fee","type":"uint256","indexed":false}],"anonymous":false,"type":"event"},{"name":"RampA","inputs":[{"name":"old_A","type":"uint256","indexed":false},{"name":"new_A","type":"uint256","indexed":false},{"name":"initial_time","type":"uint256","indexed":false},{"name":"future_time","type":"uint256","indexed":false}],"anonymous":false,"type":"event"},{"name":"StopRampA","inputs":[{"name":"A","type":"uint256","indexed":false},{"name":"t","type":"uint256","indexed":false}],"anonymous":false,"type":"event"},{"stateMutability":"nonpayable","type":"constructor","inputs":[{"name":"_owner","type":"address"},{"name":"_coins","type":"address[3]"},{"name":"_pool_token","type":"address"},{"name":"_A","type":"uint256"},{"name":"_fee","type":"uint256"},{"name":"_admin_fee","type":"uint256"},{"name":"_fee_converter","type":"address"}],"outputs":[]},{"stateMutability":"view","type":"function","name":"A","inputs":[],"outputs":[{"name":"","type":"uint256"}],"gas":5106},{"stateMutability":"view","type":"function","name":"get_virtual_price","inputs":[],"outputs":[{"name":"","type":"uint256"}],"gas":1132771},{"stateMutability":"view","type":"function","name":"calc_token_amount","inputs":[{"name":"amounts","type":"uint256[3]"},{"name":"deposit","type":"bool"}],"outputs":[{"name":"","type":"uint256"}],"gas":4506209},{"stateMutability":"nonpayable","type":"function","name":"add_liquidity","inputs":[{"name":"amounts","type":"uint256[3]"},{"name":"min_mint_amount","type":"uint256"}],"outputs":[],"gas":6950840},{"stateMutability":"view","type":"function","name":"get_dy","inputs":[{"name":"i","type":"int128"},{"name":"j","type":"int128"},{"name":"dx","type":"uint256"}],"outputs":[{"name":"","type":"uint256"}],"gas":2672568},{"stateMutability":"view","type":"function","name":"get_dy_underlying","inputs":[{"name":"i","type":"int128"},{"name":"j","type":"int128"},{"name":"dx","type":"uint256"}],"outputs":[{"name":"","type":"uint256"}],"gas":2672270},{"stateMutability":"nonpayable","type":"function","name":"exchange","inputs":[{"name":"i","type":"int128"},{"name":"j","type":"int128"},{"name":"dx","type":"uint256"},{"name":"min_dy","type":"uint256"}],"outputs":[],"gas":2816580},{"stateMutability":"nonpayable","type":"function","name":"remove_liquidity","inputs":[{"name":"_amount","type":"uint256"},{"name":"min_amounts","type":"uint256[3]"}],"outputs":[],"gas":192419},{"stateMutability":"nonpayable","type":"function","name":"remove_liquidity_imbalance","inputs":[{"name":"amounts","type":"uint256[3]"},{"name":"max_burn_amount","type":"uint256"}],"outputs":[],"gas":6947760},{"stateMutability":"view","type":"function","name":"calc_withdraw_one_coin","inputs":[{"name":"_token_amount","type":"uint256"},{"name":"i","type":"int128"}],"outputs":[{"name":"","type":"uint256"}],"gas":1162},{"stateMutability":"nonpayable","type":"function","name":"remove_liquidity_one_coin","inputs":[{"name":"_token_amount","type":"uint256"},{"name":"i","type":"int128"},{"name":"min_amount","type":"uint256"}],"outputs":[],"gas":4022793},{"stateMutability":"nonpayable","type":"function","name":"ramp_A","inputs":[{"name":"_future_A","type":"uint256"},{"name":"_future_time","type":"uint256"}],"outputs":[],"gas":151582},{"stateMutability":"nonpayable","type":"function","name":"stop_ramp_A","inputs":[],"outputs":[],"gas":148300},{"stateMutability":"nonpayable","type":"function","name":"commit_new_fee","inputs":[{"name":"new_fee","type":"uint256"},{"name":"new_admin_fee","type":"uint256"}],"outputs":[],"gas":110158},{"stateMutability":"nonpayable","type":"function","name":"apply_new_fee","inputs":[],"outputs":[],"gas":96939},{"stateMutability":"nonpayable","type":"function","name":"revert_new_parameters","inputs":[],"outputs":[],"gas":21592},{"stateMutability":"nonpayable","type":"function","name":"commit_transfer_ownership","inputs":[{"name":"_owner","type":"address"}],"outputs":[],"gas":74330},{"stateMutability":"nonpayable","type":"function","name":"apply_transfer_ownership","inputs":[],"outputs":[],"gas":60407},{"stateMutability":"nonpayable","type":"function","name":"revert_transfer_ownership","inputs":[],"outputs":[],"gas":21682},{"stateMutability":"view","type":"function","name":"admin_balances","inputs":[{"name":"i","type":"uint256"}],"outputs":[{"name":"","type":"uint256"}],"gas":3178},{"stateMutability":"nonpayable","type":"function","name":"withdraw_admin_fees","inputs":[],"outputs":[],"gas":28794},{"stateMutability":"nonpayable","type":"function","name":"kill_me","inputs":[],"outputs":[],"gas":37665},{"stateMutability":"nonpayable","type":"function","name":"unkill_me","inputs":[],"outputs":[],"gas":21802},{"stateMutability":"view","type":"function","name":"coins","inputs":[{"name":"arg0","type":"uint256"}],"outputs":[{"name":"","type":"address"}],"gas":1887},{"stateMutability":"view","type":"function","name":"balances","inputs":[{"name":"arg0","type":"uint256"}],"outputs":[{"name":"","type":"uint256"}],"gas":1917},{"stateMutability":"view","type":"function","name":"fee","inputs":[],"outputs":[{"name":"","type":"uint256"}],"gas":1838},{"stateMutability":"view","type":"function","name":"admin_fee","inputs":[],"outputs":[{"name":"","type":"uint256"}],"gas":1868},{"stateMutability":"view","type":"function","name":"owner","inputs":[],"outputs":[{"name":"","type":"address"}],"gas":1898},{"stateMutability":"view","type":"function","name":"fee_converter","inputs":[],"outputs":[{"name":"","type":"address"}],"gas":1928},{"stateMutability":"view","type":"function","name":"initial_A","inputs":[],"outputs":[{"name":"","type":"uint256"}],"gas":1958},{"stateMutability":"view","type":"function","name":"future_A","inputs":[],"outputs":[{"name":"","type":"uint256"}],"gas":1988},{"stateMutability":"view","type":"function","name":"initial_A_time","inputs":[],"outputs":[{"name":"","type":"uint256"}],"gas":2018},{"stateMutability":"view","type":"function","name":"future_A_time","inputs":[],"outputs":[{"name":"","type":"uint256"}],"gas":2048},{"stateMutability":"view","type":"function","name":"admin_actions_deadline","inputs":[],"outputs":[{"name":"","type":"uint256"}],"gas":2078},{"stateMutability":"view","type":"function","name":"transfer_ownership_deadline","inputs":[],"outputs":[{"name":"","type":"uint256"}],"gas":2108},{"stateMutability":"view","type":"function","name":"future_fee","inputs":[],"outputs":[{"name":"","type":"uint256"}],"gas":2138},{"stateMutability":"view","type":"function","name":"future_admin_fee","inputs":[],"outputs":[{"name":"","type":"uint256"}],"gas":2168},{"stateMutability":"view","type":"function","name":"future_owner","inputs":[],"outputs":[{"name":"","type":"address"}],"gas":2198}] - - -module.exports = { - abis -} diff --git a/projects/config/finnexus/abis.js b/projects/config/finnexus/abis.js deleted file mode 100644 index de7cd066d3d..00000000000 --- a/projects/config/finnexus/abis.js +++ /dev/null @@ -1,6 +0,0 @@ -let abis = {}; - -abis.fnxOracle = [{"constant":true,"inputs":[{"internalType":"address","name":"asset","type":"address"}],"name":"getPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getTotalCollateral","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"}]; -module.exports = { - abis -} \ No newline at end of file diff --git a/projects/config/flamincome/abis.js b/projects/config/flamincome/abis.js deleted file mode 100644 index b0f174f5035..00000000000 --- a/projects/config/flamincome/abis.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = { - "VaultBaseline": [{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"available","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"balance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"controller","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"depositAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"earn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"governance","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"reserve","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"harvest","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"max","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"min","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"priceE18","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_controller","type":"address"}],"name":"setController","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_governance","type":"address"}],"name":"setGovernance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_min","type":"uint256"}],"name":"setMin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_shares","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawAll","outputs":[],"stateMutability":"nonpayable","type":"function"}] -} \ No newline at end of file diff --git a/projects/config/hakka/abi.json b/projects/config/hakka/abi.json index 825878f1910..d68cc38951d 100644 --- a/projects/config/hakka/abi.json +++ b/projects/config/hakka/abi.json @@ -1,80 +1,7 @@ { - "balanceOf": { - "constant": true, - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "totalSupply": { - "constant": true, - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "pancakeUserInfo": { - "inputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" }, - { "internalType": "address", "name": "", "type": "address" } - ], - "name": "userInfo", - "outputs": [ - { "internalType": "uint256", "name": "amount", "type": "uint256" }, - { "internalType": "uint256", "name": "rewardDebt", "type": "uint256" } - ], - "stateMutability": "view", - "type": "function" - }, - "alpacaUserInfo": { - "inputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" }, - { "internalType": "address", "name": "", "type": "address" } - ], - "name": "userInfo", - "outputs": [ - { "internalType": "uint256", "name": "amount", "type": "uint256" }, - { "internalType": "uint256", "name": "rewardDebt", "type": "uint256" }, - { "internalType": "uint256", "name": "bonusDebt", "type": "uint256" }, - { "internalType": "address", "name": "fundedBy", "type": "address" } - ], - "stateMutability": "view", - "type": "function" - }, - "beltUserInfo": { - "inputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" }, - { "internalType": "address", "name": "", "type": "address" } - ], - "name": "userInfo", - "outputs": [ - { "internalType": "uint256", "name": "shares", "type": "uint256" }, - { "internalType": "uint256", "name": "rewardDebt", "type": "uint256" } - ], - "stateMutability": "view", - "type": "function" - } - } - \ No newline at end of file + "balanceOf": "function balanceOf(address account) view returns (uint256)", + "totalSupply": "uint256:totalSupply", + "pancakeUserInfo": "function userInfo(uint256, address) view returns (uint256 amount, uint256 rewardDebt)", + "alpacaUserInfo": "function userInfo(uint256, address) view returns (uint256 amount, uint256 rewardDebt, uint256 bonusDebt, address fundedBy)", + "beltUserInfo": "function userInfo(uint256, address) view returns (uint256 shares, uint256 rewardDebt)" +} \ No newline at end of file diff --git a/projects/config/hodltree/addresses.js b/projects/config/hodltree/addresses.js index d28492a3117..f366254dfaf 100644 --- a/projects/config/hodltree/addresses.js +++ b/projects/config/hodltree/addresses.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../../helper/coreAssets.json') const { dexType, flashloan, @@ -32,7 +33,7 @@ const eth = [ contractType: lendBorrow.lender, address: '0xb3e1912fa5d9d219da8c65cda407cc998849428b', miscInfo: { - tokenIn: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2' + tokenIn: ADDRESSES.ethereum.WETH } }, { contractType: lendBorrow.borrower, @@ -55,11 +56,11 @@ const eth = [ address: '0x2e5a08c26cb22109e585784c4f99363bb3e199ab', miscInfo: { tokensIn: [ - '0x57Ab1ec28D129707052df4dF418D58a2D46d5f51', + ADDRESSES.ethereum.sUSD, '0x056Fd409E1d7A124BD7017459dFEa2F387b6d5Cd', - '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', - '0x6B175474E89094C44Da98b954EedeAC495271d0F', - '0x0000000000085d4780B73119b644AE5ecd22b376' + ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.DAI, + ADDRESSES.ethereum.TUSD ] } }] @@ -76,13 +77,13 @@ const eth = [ contractType: em.rp, address: '0xce596bf99d21e46fa91143c03d7a356682b67859', miscInfo: { - token: '0x57Ab1ec28D129707052df4dF418D58a2D46d5f51' + token: ADDRESSES.ethereum.sUSD } }, { contractType: em.vps, address: '0xb7ead8c418f3d03bc22dd538c22600abe7209e72', miscInfo: { - token: '0x57ab1ec28d129707052df4df418d58a2d46d5f51' + token: ADDRESSES.ethereum.sUSD } }, @@ -96,13 +97,13 @@ const eth = [ contractType: em.rp, address: '0x87B46E49681E08E3adDF8A90F6a1fb5183079033', miscInfo: { - token: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48' + token: ADDRESSES.ethereum.USDC } }, { contractType: em.vps, address: '0xcB72e764Ab46535aAD13cbF55b1F06cB15347A95', miscInfo: { - token: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48' + token: ADDRESSES.ethereum.USDC } }] } @@ -118,7 +119,7 @@ const polygon = [ contractType: lendBorrow.lender, address: '0x2F35d311fd2F0b0dA65FA268B86831279FB4fd98', miscInfo: { - tokenIn: '0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270' + tokenIn: ADDRESSES.polygon.WMATIC_2 } }, { contractType: lendBorrow.borrower, @@ -141,9 +142,9 @@ const polygon = [ address: '0xCAFDa65B1031535F1766C6b1E3b5efF5520c7C0f', miscInfo: { tokensIn: [ - '0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174', - '0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063', - '0xc2132D05D31c914a87C6611C10748AEb04B58e8F' + ADDRESSES.polygon.USDC, + ADDRESSES.polygon.DAI, + ADDRESSES.polygon.USDT ] } }] diff --git a/projects/config/indexed/abis.js b/projects/config/indexed/abis.js deleted file mode 100644 index 97bf945d48c..00000000000 --- a/projects/config/indexed/abis.js +++ /dev/null @@ -1,8 +0,0 @@ - -let abis = {}; -abis.main = [{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"src","type":"address"},{"indexed":true,"internalType":"address","name":"dst","type":"address"},{"indexed":false,"internalType":"uint256","name":"amt","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"newDenorm","type":"uint256"}],"name":"LOG_DENORM_UPDATED","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"desiredDenorm","type":"uint256"}],"name":"LOG_DESIRED_DENORM_SET","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":true,"internalType":"address","name":"tokenOut","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenAmountOut","type":"uint256"}],"name":"LOG_EXIT","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":true,"internalType":"address","name":"tokenIn","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenAmountIn","type":"uint256"}],"name":"LOG_JOIN","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"maxPoolTokens","type":"uint256"}],"name":"LOG_MAX_TOKENS_UPDATED","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"minimumBalance","type":"uint256"}],"name":"LOG_MINIMUM_BALANCE_UPDATED","type":"event"},{"anonymous":false,"inputs":[],"name":"LOG_PUBLIC_SWAP_ENABLED","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":true,"internalType":"address","name":"tokenIn","type":"address"},{"indexed":true,"internalType":"address","name":"tokenOut","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenAmountIn","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"tokenAmountOut","type":"uint256"}],"name":"LOG_SWAP","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"swapFee","type":"uint256"}],"name":"LOG_SWAP_FEE_UPDATED","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"desiredDenorm","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"minimumBalance","type":"uint256"}],"name":"LOG_TOKEN_ADDED","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"}],"name":"LOG_TOKEN_READY","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"}],"name":"LOG_TOKEN_REMOVED","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"src","type":"address"},{"indexed":true,"internalType":"address","name":"dst","type":"address"},{"indexed":false,"internalType":"uint256","name":"amt","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"VERSION_NUMBER","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"src","type":"address"},{"internalType":"address","name":"dst","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"dst","type":"address"},{"internalType":"uint256","name":"amt","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"whom","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"controller","type":"address"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"}],"name":"configure","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"dst","type":"address"},{"internalType":"uint256","name":"amt","type":"uint256"}],"name":"decreaseApproval","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"poolAmountIn","type":"uint256"},{"internalType":"uint256[]","name":"minAmountsOut","type":"uint256[]"}],"name":"exitPool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"uint256","name":"tokenAmountOut","type":"uint256"},{"internalType":"uint256","name":"maxPoolAmountIn","type":"uint256"}],"name":"exitswapExternAmountOut","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"uint256","name":"poolAmountIn","type":"uint256"},{"internalType":"uint256","name":"minAmountOut","type":"uint256"}],"name":"exitswapPoolAmountIn","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"extrapolatePoolValueFromToken","outputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"flashBorrow","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"getBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getController","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCurrentDesiredTokens","outputs":[{"internalType":"address[]","name":"tokens","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCurrentTokens","outputs":[{"internalType":"address[]","name":"tokens","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"getDenormalizedWeight","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getMaxPoolTokens","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"getMinimumBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getNumTokens","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"}],"name":"getSpotPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getSwapFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"getTokenRecord","outputs":[{"components":[{"internalType":"bool","name":"bound","type":"bool"},{"internalType":"bool","name":"ready","type":"bool"},{"internalType":"uint40","name":"lastDenormUpdate","type":"uint40"},{"internalType":"uint96","name":"denorm","type":"uint96"},{"internalType":"uint96","name":"desiredDenorm","type":"uint96"},{"internalType":"uint8","name":"index","type":"uint8"},{"internalType":"uint256","name":"balance","type":"uint256"}],"internalType":"struct IIndexPool.Record","name":"record","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTotalDenormalizedWeight","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"getUsedBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"gulp","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"dst","type":"address"},{"internalType":"uint256","name":"amt","type":"uint256"}],"name":"increaseApproval","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"tokens","type":"address[]"},{"internalType":"uint256[]","name":"balances","type":"uint256[]"},{"internalType":"uint96[]","name":"denorms","type":"uint96[]"},{"internalType":"address","name":"tokenProvider","type":"address"},{"internalType":"address","name":"unbindHandler","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"t","type":"address"}],"name":"isBound","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isPublicSwap","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"poolAmountOut","type":"uint256"},{"internalType":"uint256[]","name":"maxAmountsIn","type":"uint256[]"}],"name":"joinPool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"uint256","name":"tokenAmountIn","type":"uint256"},{"internalType":"uint256","name":"minPoolAmountOut","type":"uint256"}],"name":"joinswapExternAmountIn","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"uint256","name":"poolAmountOut","type":"uint256"},{"internalType":"uint256","name":"maxAmountIn","type":"uint256"}],"name":"joinswapPoolAmountOut","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"tokens","type":"address[]"},{"internalType":"uint96[]","name":"desiredDenorms","type":"uint96[]"},{"internalType":"uint256[]","name":"minimumBalances","type":"uint256[]"}],"name":"reindexTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"tokens","type":"address[]"},{"internalType":"uint96[]","name":"desiredDenorms","type":"uint96[]"}],"name":"reweighTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"maxPoolTokens","type":"uint256"}],"name":"setMaxPoolTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"minimumBalance","type":"uint256"}],"name":"setMinimumBalance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"swapFee","type":"uint256"}],"name":"setSwapFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"uint256","name":"tokenAmountIn","type":"uint256"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"uint256","name":"minAmountOut","type":"uint256"},{"internalType":"uint256","name":"maxPrice","type":"uint256"}],"name":"swapExactAmountIn","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"uint256","name":"maxAmountIn","type":"uint256"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"uint256","name":"tokenAmountOut","type":"uint256"},{"internalType":"uint256","name":"maxPrice","type":"uint256"}],"name":"swapExactAmountOut","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"dst","type":"address"},{"internalType":"uint256","name":"amt","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"src","type":"address"},{"internalType":"address","name":"dst","type":"address"},{"internalType":"uint256","name":"amt","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}] - - -module.exports = { - abis -} diff --git a/projects/config/keys.js b/projects/config/keys.js index 57e42db85cf..9d5be2d3bd2 100644 --- a/projects/config/keys.js +++ b/projects/config/keys.js @@ -1,40 +1,41 @@ +const ADDRESSES = require('../helper/coreAssets.json') let keys = { - '0x514910771af9ca656af840dff83e8264ecf986ca': 'chainlink', - '0x2260fac5e5542a773aa44fbcfedf7c193bc2c599': 'bitcoin', - '0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9': 'aave', - '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48': 'stable', - '0x0000000000085d4780B73119b644AE5ecd22b376': 'stable', - '0x0bc529c00c6401aef6d220be8c6ea1667f6ad93e': 'yearn-finance', //yfi + [ADDRESSES.ethereum.LINK]: 'chainlink', + [ADDRESSES.ethereum.WBTC]: 'bitcoin', + [ADDRESSES.ethereum.AAVE]: 'aave', + [ADDRESSES.ethereum.USDC]: 'stable', + [ADDRESSES.ethereum.TUSD]: 'stable', + [ADDRESSES.ethereum.YFI]: 'yearn-finance', '0x408e41876cccdc0f92210600ef50372656052a38': 'republic-protocol', //ren '0x80fB784B7eD66730e8b1DBd9820aFD29931aab03': 'ethlend', //lend - '0x4fabb145d64652a948d72533023f6e7a623c7c53': 'stable', //busd - '0xdac17f958d2ee523a2206206994597c13d831ec7': 'stable', //USDT - '0x6b175474e89094c44da98b954eedeac495271d0f': 'stable', //DAI - '0x9f8f72aa9304c8b593d555f12ef6589cc3a579a2': 'maker', //makerdao - '0xc011a73ee8576fb46f5e1c5751ca3b9fe0af2a6f': 'havven', //SNX + [ADDRESSES.ethereum.BUSD]: 'stable', + [ADDRESSES.ethereum.USDT]: 'stable', + [ADDRESSES.ethereum.DAI]: 'stable', + [ADDRESSES.ethereum.MKR]: 'maker', + [ADDRESSES.ethereum.SNX]: 'havven', '0x0f5d2fb29fb7d3cfee444a200298f468908cc942': 'decentraland', //MANA - '0x1f9840a85d5af5bf1d1762f925bdaddc4201f984': 'uniswap', //uni + [ADDRESSES.ethereum.UNI]: 'uniswap', '0xdd974d5c2e2928dea5f71b9825b8b646686bd200': 'kyber-network', //knc '0xf629cbd94d3791c9250152bd8dfbdf380e2a3b9c': 'enjincoin', //ENJ - '0x0d8775f648430679a709e98d2b0cb6250d2887ef': 'basic-attention-token', //BAT - '0x57ab1ec28d129707052df4df418d58a2d46d5f51': 'stable', //susd + [ADDRESSES.ethereum.BAT]: 'basic-attention-token', + [ADDRESSES.ethereum.sUSD]: 'stable', '0xe41d2489571d322189246dafa5ebde1f4699f498': '0x', //0x - '0xd533a949740bb3306d119cc777fa900ba034cd52': 'curve-dao-token', + [ADDRESSES.ethereum.CRV]: 'curve-dao-token', '0xc00e94cb662c3520282e6f5717214004a7f26888': 'compound-governance-token', '0x04fa0d235c4abf4bcf4787af4cf447de572ef828': 'uma', '0xd26114cd6ee289accf82350c8d8487fedb8a0c07': 'omisego', - '0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359': 'sai', - '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2': 'ethereum', + [ADDRESSES.ethereum.SAI]: 'sai', + [ADDRESSES.ethereum.WETH]: 'ethereum', '0x5d3a536e4d6dbd6114cc1ead35777bab948e3643': 'cdai', '0xbc396689893d065f41bc2c6ecbee5e0085233447': 'perpetual-protocol', '0x92e187a03b6cd19cb6af293ba17f2745fd2357d5': 'unit-protocol-duck', '0x2ba592f78db6436527729929aaf6c908497cb200': 'cream', '0x0ae055097c6d159879521c384f1d2123d1f195e6': 'xdai-stake', '0x1ceb5cb57c4d4e2b2433641b95dd330a33185a44': 'keep3rv1', - '0x4e15361fd6b4bb609fa63c81a2be19d873717870': 'fantom', - '0x6b3595068778dd592e39a122f4f5a5cf09c90fe2': 'sushi', + [ADDRESSES.ethereum.FTM]: 'fantom', + [ADDRESSES.ethereum.SUSHI]: 'sushi', '0x4688a8b1f292fdab17e9a90c8bc379dc1dbd8713': 'cover-protocol', '0x3472a5a71965499acd81997a54bba8d852c6e53d': 'badger-dao', '0xa3bed4e1c75d00fa6f4e5e6922db7261b5e9acd2': 'meta', diff --git a/projects/config/mantra-dao/contracts/lp-staking-contracts.js b/projects/config/mantra-dao/contracts/lp-staking-contracts.js index 84156d17dc2..9b9e96e592a 100644 --- a/projects/config/mantra-dao/contracts/lp-staking-contracts.js +++ b/projects/config/mantra-dao/contracts/lp-staking-contracts.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../../../helper/coreAssets.json') const lpStakingAssetsETH = [ // LABS-ETH UNI LP simple staking { @@ -5,7 +6,7 @@ const lpStakingAssetsETH = [ pairAddress: "0x2d9fd51e896ff0352cb6d697d13d04c2cb85ca83", token1: "0x2D9FD51E896Ff0352Cb6D697D13D04C2CB85CA83", price1: "labs-group", - token2: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", + token2: ADDRESSES.ethereum.WETH, price2: "weth", }, // LABS-ETH UNI LP staking with exit tollbooth @@ -14,7 +15,7 @@ const lpStakingAssetsETH = [ pairAddress: "0x2d9fd51e896ff0352cb6d697d13d04c2cb85ca83", token1: "0x2D9FD51E896Ff0352Cb6D697D13D04C2CB85CA83", price1: "labs-group", - token2: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", + token2: ADDRESSES.ethereum.WETH, price2: "weth", }, // MANTRA DAO OM-ETH LP staking @@ -23,7 +24,7 @@ const lpStakingAssetsETH = [ pairAddress: "0xe46935ae80e05cdebd4a4008b6ccaa36d2845370", token1: "0x3593D125a4f7849a1B059E64F4517A86Dd60c95d", price1: "mantra-dao", - token2: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", + token2: ADDRESSES.ethereum.WETH, price2: "weth", }, // ROYA-ETH LP staking @@ -32,7 +33,7 @@ const lpStakingAssetsETH = [ pairAddress: "0x6d9d2427cfa49e39b4667c4c3f627e56ae586f37", token1: "0x4Cd4c0eEDb2bC21f4e280d0Fe4C45B17430F94A9", price1: "royale", - token2: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", + token2: ADDRESSES.ethereum.WETH, price2: "weth", }, // BITE-ETH LP staking @@ -41,7 +42,7 @@ const lpStakingAssetsETH = [ pairAddress: "0x1f07f8e712659087914b96db4d6f6e4fee32285e", token1: "0x4eed0fa8de12d5a86517f214c2f11586ba2ed88d", price1: "dragonbite", - token2: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", + token2: ADDRESSES.ethereum.WETH, price2: "weth", }, // BITE-ETH LP staking w/ tollbooth @@ -50,14 +51,14 @@ const lpStakingAssetsETH = [ pairAddress: "0x1f07f8e712659087914b96db4d6f6e4fee32285e", token1: "0x4eed0fa8de12d5a86517f214c2f11586ba2ed88d", price1: "dragonbite", - token2: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", + token2: ADDRESSES.ethereum.WETH, price2: "weth", }, // BBANK-ETH LP staking { contract: "0x6406788d1CD4fdD823ef607A924c00a4244a841d", pairAddress: "0x2a182e532a379cb2c7f1b34ce3f76f3f7d3596f7", - token1: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", + token1: ADDRESSES.ethereum.WETH, price1: "weth", token2: "0xf4b5470523ccd314c6b9da041076e7d79e0df267", price2: "blockbank", @@ -68,7 +69,7 @@ const lpStakingAssetsETH = [ pairAddress: "0x4fc47579ecf6aa76677ee142b6b75faf9eeafba8", token1: "0x5eaa69b29f99c84fe5de8200340b4e9b4ab38eac", price1: "raze-network", - token2: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", + token2: ADDRESSES.ethereum.WETH, price2: "weth", }, // BCUBE-ETH LP staking @@ -77,7 +78,7 @@ const lpStakingAssetsETH = [ pairAddress: "0xc62bf2c79f34ff24e2f97982af4f064161ed8949", token1: "0x93c9175e26f57d2888c7df8b470c9eea5c0b0a93", price1: "b-cube-ai", - token2: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", + token2: ADDRESSES.ethereum.WETH, price2: "weth", }, ]; @@ -90,14 +91,14 @@ const lpStakingAssetsBSC = [ pairAddress: "0xC309a6d2F1537922E06f15aA2eb21CaA1b2eEDb6", token1: "0x4e6415a5727ea08aae4580057187923aec331227", price1: "refinable", - token2: "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c", + token2: ADDRESSES.bsc.WBNB, price2: "wbnb", }, // OM-BNB LP staking { contract: "0xcbf42ace1dbd895ffdcabc1b841488542626014d", pairAddress: "0x49837a48abde7c525bdc86d9acba39f739cbe22c", - token1: "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c", + token1: ADDRESSES.bsc.WBNB, price1: "wbnb", token2: "0xf78d2e7936f5fe18308a3b2951a93b6c4a41f5e2", price2: "mantra-dao", @@ -108,14 +109,14 @@ const lpStakingAssetsBSC = [ pairAddress: "0x0b49580278b403ca13055bf4d81b6b7aa85fd8b9", token1: "0x0e2b41ea957624a314108cc4e33703e9d78f4b3c", price1: "greenheart-cbd", - token2: "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c", + token2: ADDRESSES.bsc.WBNB, price2: "wbnb", }, // BBANK-BNB LP staking { contract: "0x1E8BC897bf03ebac570Df7e5526561f8a42eCe05", pairAddress: "0x538e61bd3258304e9970f4f2db37a217f60436e1", - token1: "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c", + token1: ADDRESSES.bsc.WBNB, price1: "wbnb", token2: "0xf4b5470523ccd314c6b9da041076e7d79e0df267", price2: "blockbank", @@ -126,7 +127,7 @@ const lpStakingAssetsBSC = [ pairAddress: "0xb8b4383b49d451bbea63bc4421466e1086da6f18", token1: "0x96058f8c3e16576d9bd68766f3836d9a33158f89", price1: "bondly", - token2: "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c", + token2: ADDRESSES.bsc.WBNB, price2: "wbnb", }, // MIST-BNB LP staking @@ -135,7 +136,7 @@ const lpStakingAssetsBSC = [ pairAddress: "0x5a26eb7c9c72140d01039eb172dcb8ec98d071bd", token1: "0x68e374f856bf25468d365e539b700b648bf94b67", price1: "mist", - token2: "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c", + token2: ADDRESSES.bsc.WBNB, price2: "wbnb", }, // ROSN-BNB LP staking @@ -144,7 +145,7 @@ const lpStakingAssetsBSC = [ pairAddress: "0x5548bd47293171d3bc1621edccd953bcc9b814cb", token1: "0x651Cd665bD558175A956fb3D72206eA08Eb3dF5b", price1: "roseon-finance", - token2: "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c", + token2: ADDRESSES.bsc.WBNB, price2: "wbnb", }, // MLT-BNB LP staking @@ -153,14 +154,14 @@ const lpStakingAssetsBSC = [ pairAddress: "0x560b96f81a2190ff6ac84ebfd17788bab3679cbc", token1: "0x4518231a8fdf6ac553b9bbd51bbb86825b583263", price1: "media-licensing-token", - token2: "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c", + token2: ADDRESSES.bsc.WBNB, price2: "wbnb", }, // L3P-BNB LP staking { contract: "0x3ba3E2f3cACcDbE3C56D3046FFe859cc9deE08a0", pairAddress: "0xB62c57Bda4C126E21A726e3D28734bfb1151231e", - token1: "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c", + token1: ADDRESSES.bsc.WBNB, price1: "wbnb", token2: "0xdeF1da03061DDd2A5Ef6c59220C135dec623116d", price2: "lepricon", @@ -173,7 +174,7 @@ const lpStakingAssetsPOLYGON = [ { contract: "0xCBf42Ace1dBD895FFDCaBC1b841488542626014d", pairAddress: "0xff2bbcb399ad50bbd06debadd47d290933ae1038", - token1: "0x7ceb23fd6bc0add59e62ac25578270cff1b9f619", + token1: ADDRESSES.polygon.WETH_1, price1: "weth", token2: "0xC3Ec80343D2bae2F8E680FDADDe7C17E71E114ea", price2: "mantra-dao", @@ -184,7 +185,7 @@ const lpStakingAssetsPOLYGON = [ pairAddress: "0x1dF661fC4319415a2f990bd5F49D5cA70EFDee1C", token1: "0x3f6b3595ecF70735D3f48D69b09C4E4506DB3F47", price1: "gamestation", - token2: "0x7ceb23fd6bc0add59e62ac25578270cff1b9f619", + token2: ADDRESSES.polygon.WETH_1, price2: "weth", }, ]; diff --git a/projects/config/n3rd/abis.js b/projects/config/n3rd/abis.js deleted file mode 100644 index 0e17de1dbd4..00000000000 --- a/projects/config/n3rd/abis.js +++ /dev/null @@ -1,178 +0,0 @@ -let minERC20 = [ - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -]; - -let minVault = [ - { - "inputs": [ - { - "internalType": "uint256", - "name": "_pid", - "type": "uint256" - } - ], - "name": "getLiquidityInfo", - "outputs": [ - { - "internalType": "uint256", - "name": "lpSupply", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "nerdAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalNerdAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "tokenAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalTokenAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lockedLP", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalLockedLP", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "poolInfo", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "allocPoint", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accNerdPerShare", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lockedPeriod", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "emergencyWithdrawable", - "type": "bool" - }, - { - "internalType": "uint256", - "name": "rewardsInThisEpoch", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "cumulativeRewardsSinceStart", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "startBlock", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "epochCalculationStartBlock", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "poolLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -]; - -let minRouter = [ - { - "inputs": [ - { - "internalType": "uint256", - "name": "amountIn", - "type": "uint256" - }, - { - "internalType": "address[]", - "name": "path", - "type": "address[]" - } - ], - "name": "getAmountsOut", - "outputs": [ - { - "internalType": "uint256[]", - "name": "amounts", - "type": "uint256[]" - } - ], - "stateMutability": "view", - "type": "function" - } -] - -module.exports = { - minERC20, - minVault, - minRouter -} diff --git a/projects/config/onx/constant.js b/projects/config/onx/constant.js index 419e9a7bc82..9b3c7b565cb 100644 --- a/projects/config/onx/constant.js +++ b/projects/config/onx/constant.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../../helper/coreAssets.json') const tokenAddresses = { onx: "0xe0ad1806fd3e7edf6ff52fdb822432e847411033", sOnx: "0xa99f0ad2a539b2867fcfea47f7e71f240940b47c", @@ -10,14 +11,14 @@ const tokenAddresses = { pool: "0x47F3E6C1Ef0cBe69502167095b592e61de108BaA", aethToken: "0xE95A203B1a91a908F9B9CE46459d101078c2c3cb", onsToken: "0xfC97C0c12438B6E4CF246cD831b02FeF4950DCAD", - daiToken: "0x6B175474E89094C44Da98b954EedeAC495271d0F", - fraxToken: "0x853d955acef822db058eb8505911ed77f175b99e", - usdcToken: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", + daiToken: ADDRESSES.ethereum.DAI, + fraxToken: ADDRESSES.ethereum.FRAX, + usdcToken: ADDRESSES.ethereum.USDC, aethPairEth: "0x6147805e1011417B93e5D693424a62A70d09d0E5", aethPairOns: "0x5022BbC26B3Bc8c8d2F1F7dB9ee3A2B4631b9b18", aethPairOne: "0x5BD4D1f8D46Ad6ae1e6b694eb64f7583C1cB1A74", oneVault: "0x3BdF1977d87EDAD8e0617efCEa958F6d43A4C30E", - wethToken: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + wethToken: ADDRESSES.ethereum.WETH, bondPairEth: "0xb17b1342579e4bce6b6e9a426092ea57d33843d9", sushiPairEth: "0xce84867c3c02b05dc570d0135103d3fb9cc19433", fantom: { diff --git a/projects/config/onx/ethereum/farmTvl.js b/projects/config/onx/ethereum/farmTvl.js index 4f2821066fa..8ef48b5f27e 100644 --- a/projects/config/onx/ethereum/farmTvl.js +++ b/projects/config/onx/ethereum/farmTvl.js @@ -1,5 +1,5 @@ const BigNumber = require('bignumber.js'); -const { ZERO, getTotalSupplyOf, } = require('../../../helper/ankr/utils');; +const { ZERO, getTotalSupplyOf, } = require('../../../helper/ankr/utils'); const sdk = require("@defillama/sdk") const getSymbolPrice = ( diff --git a/projects/config/onx/ethereum/farms.js b/projects/config/onx/ethereum/farms.js index dafd44cc643..414bd79bb8e 100644 --- a/projects/config/onx/ethereum/farms.js +++ b/projects/config/onx/ethereum/farms.js @@ -1,23 +1,20 @@ -const UniswapV2PairContractAbi = require('../../../helper/ankr/abis/UniswapV2Pair.json'); -const ERC20Abi = require('../../../helper/ankr/abis/ERC20.json'); +const ADDRESSES = require('../../../helper/coreAssets.json') const rawFarms = [ {//0 pid: 4, title: 'onxEthLp', address: '0x62f22A47e5D2F8b71cC44fD85863753618312f67', - abi: UniswapV2PairContractAbi, - isLpToken: true, - subTokenSymbol1: 'ONX', - subTokenSymbol2: 'WETH', - subTokenAddresses1: '0xe0ad1806fd3e7edf6ff52fdb822432e847411033', - subTokenAddresses2: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', + isLpToken: false, + subTokenSymbol1: 'UNI-V2', + subTokenSymbol2: 'UNI-V2', + subTokenAddresses1: '0x62f22A47e5D2F8b71cC44fD85863753618312f67', + subTokenAddresses2: '0x62f22A47e5D2F8b71cC44fD85863753618312f67', }, {//1 pid: 1, title: 'aETHc', address: '0xE95A203B1a91a908F9B9CE46459d101078c2c3cb', - abi: ERC20Abi, isLpToken: false, subTokenSymbol1: 'aETHc', subTokenSymbol2: 'aETHc', @@ -28,29 +25,26 @@ const rawFarms = [ pid: 0, title: 'ANKR', address: '0x8290333ceF9e6D528dD5618Fb97a76f268f3EDD4', - abi: ERC20Abi, isLpToken: false, subTokenSymbol1: 'ANKR', subTokenSymbol2: 'ANKR', subTokenAddresses1: '0xE95A203B1a91a908F9B9CE46459d101078c2c3cb', - subTokenAddresses2: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', + subTokenAddresses2: ADDRESSES.ethereum.USDC, }, {//3 title: 'onxEthSlpMulti', address: '0x0652687E87a4b8b5370b05bc298Ff00d205D9B5f', - abi: UniswapV2PairContractAbi, - isLpToken: true, - subTokenSymbol1: 'ONX', - subTokenSymbol2: 'WETH', - subTokenAddresses1: '0xe0ad1806fd3e7edf6ff52fdb822432e847411033', - subTokenAddresses2: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', + isLpToken: false, + subTokenSymbol1: 'SLP', + subTokenSymbol2: 'SLP', + subTokenAddresses1: '0x0652687E87a4b8b5370b05bc298Ff00d205D9B5f', + subTokenAddresses2: '0x0652687E87a4b8b5370b05bc298Ff00d205D9B5f', isCustomFarmContract: true, }, {//4 pid: 7, title: 'xSushi', address: '0x8798249c2E607446EfB7Ad49eC89dD1865Ff4272', - abi: ERC20Abi, isLpToken: false, subTokenSymbol1: 'xSushi', subTokenSymbol2: 'xSushi', @@ -61,7 +55,6 @@ const rawFarms = [ pid: 8, title: 'BOND', address: '0x0391d2021f89dc339f60fff84546ea23e337750f', - abi: ERC20Abi, isLpToken: false, subTokenSymbol1: 'BOND', subTokenSymbol2: 'BOND', @@ -72,12 +65,11 @@ const rawFarms = [ pid: 6, title: 'onxEthSlp', address: '0x0652687E87a4b8b5370b05bc298Ff00d205D9B5f', - abi: UniswapV2PairContractAbi, - isLpToken: true, - subTokenSymbol1: 'ONX', - subTokenSymbol2: 'WETH', - subTokenAddresses1: '0xe0ad1806fd3e7edf6ff52fdb822432e847411033', - subTokenAddresses2: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', + isLpToken: false, + subTokenSymbol1: 'SLP', + subTokenSymbol2: 'SLP', + subTokenAddresses1: '0x0652687E87a4b8b5370b05bc298Ff00d205D9B5f', + subTokenAddresses2: '0x0652687E87a4b8b5370b05bc298Ff00d205D9B5f', }, ]; diff --git a/projects/config/onx/ethereum/index.js b/projects/config/onx/ethereum/index.js index 8e673ec57cc..7cecaebc2a7 100644 --- a/projects/config/onx/ethereum/index.js +++ b/projects/config/onx/ethereum/index.js @@ -1,7 +1,6 @@ const BigNumber = require('bignumber.js'); const { toUSDTBalances } = require('./../../../helper/balances'); const sdk = require("@defillama/sdk"); -const onxContractAbi = require('../../../helper/ankr/abis/OnxPool.json'); const tokenAddresses = require('../constant'); const { getVautsTvl, getBalanceOf, getReserves } = require('../../../helper/ankr/utils'); const { ZERO, vaults } = require('./vaults'); @@ -33,7 +32,7 @@ const getEthereumBorrows = async () => { let { output: borrowsTvl } = await sdk.api.abi.call({ target: tokenAddresses.pool, - abi: onxContractAbi.find(i => i.name === 'totalBorrow') + abi: 'uint256:totalBorrow' }) borrowsTvl = new BigNumber(borrowsTvl).div(1e18); return toUSDTBalances(wethPrice.times(borrowsTvl)); @@ -123,11 +122,11 @@ const getOneVaultTvl = async (wethPrice, aethPrice, onsPrice) => { const getLendingTvl = async (wethPrice) => { let { output: totalStake } = await sdk.api.abi.call({ target: tokenAddresses.pool, - abi: onxContractAbi.find(i => i.name === 'totalStake') + abi: 'uint256:totalStake' }) let { output: totalBorrow } = await sdk.api.abi.call({ target: tokenAddresses.pool, - abi: onxContractAbi.find(i => i.name === 'totalPledge') + abi: 'uint256:totalPledge' }) return new BigNumber(totalBorrow).plus(totalStake).times(wethPrice).div(1e18); } diff --git a/projects/config/onx/fantom/index.js b/projects/config/onx/fantom/index.js index 1a76dcff80c..8505036c520 100644 --- a/projects/config/onx/fantom/index.js +++ b/projects/config/onx/fantom/index.js @@ -1,6 +1,5 @@ const tokenAddresses = require('../constant'); const BigNumber = require('bignumber.js'); -const UniswapV2PairContractAbi = require('../../../helper/ankr/abis/UniswapV2Pair.json'); const { ZERO, fromWei, getVautsTvl, } = require('../../../helper/ankr/utils'); const { vaults } = require('./vaults'); const { EXCHANGE_TYPE } = require('../vault'); @@ -30,7 +29,7 @@ const getReserves = async (pairAddress) => { const { output: { _reserve0, _reserve1, _blockTimestampLast } } = await sdk.api.abi.call({ chain: 'fantom', target: pairAddress, - abi: UniswapV2PairContractAbi.find(i => i.name === 'getReserves') + abi: 'function getReserves() view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast)' }) return { reserve0: _reserve0, reserve1: _reserve1, blockTimestampLast: _blockTimestampLast }; }; diff --git a/projects/config/piedao/abi/IBCP.json b/projects/config/piedao/abi/IBCP.json index 3c8359b41af..19e467e295d 100644 --- a/projects/config/piedao/abi/IBCP.json +++ b/projects/config/piedao/abi/IBCP.json @@ -1,15 +1,3 @@ -[ - { - "inputs": [], - "name": "getTokens", - "outputs": [ - { - "internalType": "address[]", - "name": "", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - } -] \ No newline at end of file +{ + "getTokens": "address[]:getTokens" +} \ No newline at end of file diff --git a/projects/config/piedao/abi/IPie.json b/projects/config/piedao/abi/IPie.json index 2a5e4fd6a84..3df655fc4d9 100644 --- a/projects/config/piedao/abi/IPie.json +++ b/projects/config/piedao/abi/IPie.json @@ -1,39 +1,4 @@ -[ - { - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "calcTokensForAmount", - "outputs": [ - { - "internalType": "address[]", - "name": "tokens", - "type": "address[]" - }, - { - "internalType": "uint256[]", - "name": "amounts", - "type": "uint256[]" - } - ], - "stateMutability": "view", - "type": "function" - } -] \ No newline at end of file +{ + "totalSupply": "uint256:totalSupply", + "calcTokensForAmount": "function calcTokensForAmount(uint256 _amount) view returns (address[] tokens, uint256[] amounts)" +} \ No newline at end of file diff --git a/projects/config/piedao/abi/IStakedToken.json b/projects/config/piedao/abi/IStakedToken.json index 98849881d73..3e6c8e5d739 100644 --- a/projects/config/piedao/abi/IStakedToken.json +++ b/projects/config/piedao/abi/IStakedToken.json @@ -1,17 +1,3 @@ -[ - { - "constant": true, - "inputs": [], - "name": "getFinalTokens", - "outputs": [ - { - "internalType": "address[]", - "name": "tokens", - "type": "address[]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } -] \ No newline at end of file +{ + "getFinalTokens": "address[]:getFinalTokens" +} \ No newline at end of file diff --git a/projects/config/piedao/abi/IStakingAll.json b/projects/config/piedao/abi/IStakingAll.json index d01a4eb040a..9dee9d34359 100644 --- a/projects/config/piedao/abi/IStakingAll.json +++ b/projects/config/piedao/abi/IStakingAll.json @@ -1,33 +1,4 @@ -[ - { - "inputs": [], - "name": "poolCount", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_poolId", - "type": "uint256" - } - ], - "name": "getPoolToken", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }] \ No newline at end of file +{ + "poolCount": "uint256:poolCount", + "getPoolToken": "function getPoolToken(uint256 _poolId) view returns (address)" +} \ No newline at end of file diff --git a/projects/config/piedao/abi/IStakingBalancer.json b/projects/config/piedao/abi/IStakingBalancer.json index c7a0cef9e66..e108fc2d5c1 100644 --- a/projects/config/piedao/abi/IStakingBalancer.json +++ b/projects/config/piedao/abi/IStakingBalancer.json @@ -1,17 +1,3 @@ -[ - { - "constant": true, - "inputs": [], - "name": "uni", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } -] \ No newline at end of file +{ + "uni": "address:uni" +} \ No newline at end of file diff --git a/projects/config/smoothy/abis.js b/projects/config/smoothy/abis.js index 1f8963ba117..408e5a45c20 100644 --- a/projects/config/smoothy/abis.js +++ b/projects/config/smoothy/abis.js @@ -1,90 +1,46 @@ +const ADDRESSES = require('../../helper/coreAssets.json') let abis = {}; -abis.smoothy = [ - { - "inputs": [], - "name": "_ntokens", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "bTokenIdx", - "type": "uint256" - } - ], - "name": "getTokenStats", - "outputs": [ - { - "internalType": "uint256", - "name": "softWeight", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "hardWeight", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "balance", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "decimals", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, -]; +abis.smoothy = { + _ntokens: "uint256:_ntokens", + getTokenStats: "function getTokenStats(uint256 bTokenIdx) view returns (uint256 softWeight, uint256 hardWeight, uint256 balance, uint256 decimals)", + }; abis.tokens = [ { symbol: "USDT", - address: "0xdac17f958d2ee523a2206206994597c13d831ec7", + address: ADDRESSES.ethereum.USDT, id: 0, decimals: 6, }, { symbol: "USDC", - address: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", + address: ADDRESSES.ethereum.USDC, id: 1, decimals: 6, }, { symbol: "DAI", - address: "0x6B175474E89094C44Da98b954EedeAC495271d0F", + address: ADDRESSES.ethereum.DAI, id: 2, decimals: 18, }, { symbol: "TUSD", - address: "0x0000000000085d4780B73119b644AE5ecd22b376", + address: ADDRESSES.ethereum.TUSD, id: 3, decimals: 18, }, { symbol: "sUSD", - address: "0x57ab1ec28d129707052df4df418d58a2d46d5f51", + address: ADDRESSES.ethereum.sUSD, id: 4, decimals: 18, }, { symbol: "BUSD", - address: "0x4fabb145d64652a948d72533023f6e7a623c7c53", + address: ADDRESSES.ethereum.BUSD, id: 5, decimals: 18, }, diff --git a/projects/config/uma/abis.js b/projects/config/uma/abis.js deleted file mode 100644 index 0bbd7915aba..00000000000 --- a/projects/config/uma/abis.js +++ /dev/null @@ -1,10 +0,0 @@ - -let abis = {}; - - -abis.uma = [{"inputs":[{"components":[{"internalType":"uint256","name":"expirationTimestamp","type":"uint256"},{"internalType":"uint256","name":"withdrawalLiveness","type":"uint256"},{"internalType":"address","name":"collateralAddress","type":"address"},{"internalType":"address","name":"finderAddress","type":"address"},{"internalType":"address","name":"tokenFactoryAddress","type":"address"},{"internalType":"address","name":"timerAddress","type":"address"},{"internalType":"bytes32","name":"priceFeedIdentifier","type":"bytes32"},{"internalType":"string","name":"syntheticName","type":"string"},{"internalType":"string","name":"syntheticSymbol","type":"string"},{"components":[{"internalType":"uint256","name":"rawValue","type":"uint256"}],"internalType":"struct FixedPoint.Unsigned","name":"minSponsorTokens","type":"tuple"},{"internalType":"uint256","name":"liquidationLiveness","type":"uint256"},{"components":[{"internalType":"uint256","name":"rawValue","type":"uint256"}],"internalType":"struct FixedPoint.Unsigned","name":"collateralRequirement","type":"tuple"},{"components":[{"internalType":"uint256","name":"rawValue","type":"uint256"}],"internalType":"struct FixedPoint.Unsigned","name":"disputeBondPct","type":"tuple"},{"components":[{"internalType":"uint256","name":"rawValue","type":"uint256"}],"internalType":"struct FixedPoint.Unsigned","name":"sponsorDisputeRewardPct","type":"tuple"},{"components":[{"internalType":"uint256","name":"rawValue","type":"uint256"}],"internalType":"struct FixedPoint.Unsigned","name":"disputerDisputeRewardPct","type":"tuple"}],"internalType":"struct Liquidatable.ConstructorParams","name":"params","type":"tuple"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"}],"name":"ContractExpired","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sponsor","type":"address"},{"indexed":true,"internalType":"uint256","name":"collateralAmount","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":true,"internalType":"address","name":"sponsor","type":"address"},{"indexed":true,"internalType":"address","name":"liquidator","type":"address"},{"indexed":false,"internalType":"address","name":"disputer","type":"address"},{"indexed":false,"internalType":"uint256","name":"liquidationId","type":"uint256"},{"indexed":false,"internalType":"bool","name":"disputeSucceeded","type":"bool"}],"name":"DisputeSettled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":false,"internalType":"uint256","name":"originalExpirationTimestamp","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"shutdownTimestamp","type":"uint256"}],"name":"EmergencyShutdown","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sponsor","type":"address"}],"name":"EndedSponsorPosition","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"FinalFeesPaid","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sponsor","type":"address"},{"indexed":true,"internalType":"address","name":"liquidator","type":"address"},{"indexed":true,"internalType":"uint256","name":"liquidationId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"tokensOutstanding","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"lockedCollateral","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"liquidatedCollateral","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"liquidationTime","type":"uint256"}],"name":"LiquidationCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sponsor","type":"address"},{"indexed":true,"internalType":"address","name":"liquidator","type":"address"},{"indexed":true,"internalType":"address","name":"disputer","type":"address"},{"indexed":false,"internalType":"uint256","name":"liquidationId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"disputeBondAmount","type":"uint256"}],"name":"LiquidationDisputed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":false,"internalType":"uint256","name":"withdrawalAmount","type":"uint256"},{"indexed":true,"internalType":"enum Liquidatable.Status","name":"liquidationStatus","type":"uint8"},{"indexed":false,"internalType":"uint256","name":"settlementPrice","type":"uint256"}],"name":"LiquidationWithdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sponsor","type":"address"}],"name":"NewSponsor","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sponsor","type":"address"},{"indexed":true,"internalType":"uint256","name":"collateralAmount","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"tokenAmount","type":"uint256"}],"name":"PositionCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sponsor","type":"address"},{"indexed":true,"internalType":"uint256","name":"collateralAmount","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"tokenAmount","type":"uint256"}],"name":"Redeem","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"regularFee","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"lateFee","type":"uint256"}],"name":"RegularFeesPaid","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"oldSponsor","type":"address"}],"name":"RequestTransferPosition","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"oldSponsor","type":"address"}],"name":"RequestTransferPositionCanceled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"oldSponsor","type":"address"},{"indexed":true,"internalType":"address","name":"newSponsor","type":"address"}],"name":"RequestTransferPositionExecuted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sponsor","type":"address"},{"indexed":true,"internalType":"uint256","name":"collateralAmount","type":"uint256"}],"name":"RequestWithdrawal","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sponsor","type":"address"},{"indexed":true,"internalType":"uint256","name":"collateralAmount","type":"uint256"}],"name":"RequestWithdrawalCanceled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sponsor","type":"address"},{"indexed":true,"internalType":"uint256","name":"collateralAmount","type":"uint256"}],"name":"RequestWithdrawalExecuted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":true,"internalType":"uint256","name":"collateralReturned","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"tokensBurned","type":"uint256"}],"name":"SettleExpiredPosition","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sponsor","type":"address"},{"indexed":true,"internalType":"uint256","name":"collateralAmount","type":"uint256"}],"name":"Withdrawal","type":"event"},{"inputs":[],"name":"cancelTransferPosition","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"cancelWithdrawal","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"collateralCurrency","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"collateralRequirement","outputs":[{"internalType":"uint256","name":"rawValue","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"contractState","outputs":[{"internalType":"enum PricelessPositionManager.ContractState","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"rawValue","type":"uint256"}],"internalType":"struct FixedPoint.Unsigned","name":"collateralAmount","type":"tuple"},{"components":[{"internalType":"uint256","name":"rawValue","type":"uint256"}],"internalType":"struct FixedPoint.Unsigned","name":"numTokens","type":"tuple"}],"name":"create","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sponsor","type":"address"},{"components":[{"internalType":"uint256","name":"rawValue","type":"uint256"}],"internalType":"struct FixedPoint.Unsigned","name":"minCollateralPerToken","type":"tuple"},{"components":[{"internalType":"uint256","name":"rawValue","type":"uint256"}],"internalType":"struct FixedPoint.Unsigned","name":"maxCollateralPerToken","type":"tuple"},{"components":[{"internalType":"uint256","name":"rawValue","type":"uint256"}],"internalType":"struct FixedPoint.Unsigned","name":"maxTokensToLiquidate","type":"tuple"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"createLiquidation","outputs":[{"internalType":"uint256","name":"liquidationId","type":"uint256"},{"components":[{"internalType":"uint256","name":"rawValue","type":"uint256"}],"internalType":"struct FixedPoint.Unsigned","name":"tokensLiquidated","type":"tuple"},{"components":[{"internalType":"uint256","name":"rawValue","type":"uint256"}],"internalType":"struct FixedPoint.Unsigned","name":"finalFeeBond","type":"tuple"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"cumulativeFeeMultiplier","outputs":[{"internalType":"uint256","name":"rawValue","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"rawValue","type":"uint256"}],"internalType":"struct FixedPoint.Unsigned","name":"collateralAmount","type":"tuple"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sponsor","type":"address"},{"components":[{"internalType":"uint256","name":"rawValue","type":"uint256"}],"internalType":"struct FixedPoint.Unsigned","name":"collateralAmount","type":"tuple"}],"name":"depositTo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"liquidationId","type":"uint256"},{"internalType":"address","name":"sponsor","type":"address"}],"name":"dispute","outputs":[{"components":[{"internalType":"uint256","name":"rawValue","type":"uint256"}],"internalType":"struct FixedPoint.Unsigned","name":"totalPaid","type":"tuple"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"disputeBondPct","outputs":[{"internalType":"uint256","name":"rawValue","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"disputerDisputeRewardPct","outputs":[{"internalType":"uint256","name":"rawValue","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"emergencyShutdown","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"expirationTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"expire","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"expiryPrice","outputs":[{"internalType":"uint256","name":"rawValue","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"finder","outputs":[{"internalType":"contract FinderInterface","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"sponsor","type":"address"}],"name":"getCollateral","outputs":[{"components":[{"internalType":"uint256","name":"rawValue","type":"uint256"}],"internalType":"struct FixedPoint.Unsigned","name":"collateralAmount","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCurrentTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"sponsor","type":"address"}],"name":"getLiquidations","outputs":[{"components":[{"internalType":"address","name":"sponsor","type":"address"},{"internalType":"address","name":"liquidator","type":"address"},{"internalType":"enum Liquidatable.Status","name":"state","type":"uint8"},{"internalType":"uint256","name":"liquidationTime","type":"uint256"},{"components":[{"internalType":"uint256","name":"rawValue","type":"uint256"}],"internalType":"struct FixedPoint.Unsigned","name":"tokensOutstanding","type":"tuple"},{"components":[{"internalType":"uint256","name":"rawValue","type":"uint256"}],"internalType":"struct FixedPoint.Unsigned","name":"lockedCollateral","type":"tuple"},{"components":[{"internalType":"uint256","name":"rawValue","type":"uint256"}],"internalType":"struct FixedPoint.Unsigned","name":"liquidatedCollateral","type":"tuple"},{"components":[{"internalType":"uint256","name":"rawValue","type":"uint256"}],"internalType":"struct FixedPoint.Unsigned","name":"rawUnitCollateral","type":"tuple"},{"internalType":"address","name":"disputer","type":"address"},{"components":[{"internalType":"uint256","name":"rawValue","type":"uint256"}],"internalType":"struct FixedPoint.Unsigned","name":"settlementPrice","type":"tuple"},{"components":[{"internalType":"uint256","name":"rawValue","type":"uint256"}],"internalType":"struct FixedPoint.Unsigned","name":"finalFee","type":"tuple"}],"internalType":"struct Liquidatable.LiquidationData[]","name":"liquidationData","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"liquidationLiveness","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"liquidations","outputs":[{"internalType":"address","name":"sponsor","type":"address"},{"internalType":"address","name":"liquidator","type":"address"},{"internalType":"enum Liquidatable.Status","name":"state","type":"uint8"},{"internalType":"uint256","name":"liquidationTime","type":"uint256"},{"components":[{"internalType":"uint256","name":"rawValue","type":"uint256"}],"internalType":"struct FixedPoint.Unsigned","name":"tokensOutstanding","type":"tuple"},{"components":[{"internalType":"uint256","name":"rawValue","type":"uint256"}],"internalType":"struct FixedPoint.Unsigned","name":"lockedCollateral","type":"tuple"},{"components":[{"internalType":"uint256","name":"rawValue","type":"uint256"}],"internalType":"struct FixedPoint.Unsigned","name":"liquidatedCollateral","type":"tuple"},{"components":[{"internalType":"uint256","name":"rawValue","type":"uint256"}],"internalType":"struct FixedPoint.Unsigned","name":"rawUnitCollateral","type":"tuple"},{"internalType":"address","name":"disputer","type":"address"},{"components":[{"internalType":"uint256","name":"rawValue","type":"uint256"}],"internalType":"struct FixedPoint.Unsigned","name":"settlementPrice","type":"tuple"},{"components":[{"internalType":"uint256","name":"rawValue","type":"uint256"}],"internalType":"struct FixedPoint.Unsigned","name":"finalFee","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minSponsorTokens","outputs":[{"internalType":"uint256","name":"rawValue","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"payRegularFees","outputs":[{"components":[{"internalType":"uint256","name":"rawValue","type":"uint256"}],"internalType":"struct FixedPoint.Unsigned","name":"totalPaid","type":"tuple"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"pfc","outputs":[{"components":[{"internalType":"uint256","name":"rawValue","type":"uint256"}],"internalType":"struct FixedPoint.Unsigned","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"positions","outputs":[{"components":[{"internalType":"uint256","name":"rawValue","type":"uint256"}],"internalType":"struct FixedPoint.Unsigned","name":"tokensOutstanding","type":"tuple"},{"internalType":"uint256","name":"withdrawalRequestPassTimestamp","type":"uint256"},{"components":[{"internalType":"uint256","name":"rawValue","type":"uint256"}],"internalType":"struct FixedPoint.Unsigned","name":"withdrawalRequestAmount","type":"tuple"},{"components":[{"internalType":"uint256","name":"rawValue","type":"uint256"}],"internalType":"struct FixedPoint.Unsigned","name":"rawCollateral","type":"tuple"},{"internalType":"uint256","name":"transferPositionRequestPassTimestamp","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"priceIdentifier","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rawLiquidationCollateral","outputs":[{"internalType":"uint256","name":"rawValue","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rawTotalPositionCollateral","outputs":[{"internalType":"uint256","name":"rawValue","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"rawValue","type":"uint256"}],"internalType":"struct FixedPoint.Unsigned","name":"numTokens","type":"tuple"}],"name":"redeem","outputs":[{"components":[{"internalType":"uint256","name":"rawValue","type":"uint256"}],"internalType":"struct FixedPoint.Unsigned","name":"amountWithdrawn","type":"tuple"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"remargin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"requestTransferPosition","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"rawValue","type":"uint256"}],"internalType":"struct FixedPoint.Unsigned","name":"collateralAmount","type":"tuple"}],"name":"requestWithdrawal","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"time","type":"uint256"}],"name":"setCurrentTime","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"settleExpired","outputs":[{"components":[{"internalType":"uint256","name":"rawValue","type":"uint256"}],"internalType":"struct FixedPoint.Unsigned","name":"amountWithdrawn","type":"tuple"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"sponsorDisputeRewardPct","outputs":[{"internalType":"uint256","name":"rawValue","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"timerAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenCurrency","outputs":[{"internalType":"contract ExpandedIERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalPositionCollateral","outputs":[{"components":[{"internalType":"uint256","name":"rawValue","type":"uint256"}],"internalType":"struct FixedPoint.Unsigned","name":"totalCollateral","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalTokensOutstanding","outputs":[{"internalType":"uint256","name":"rawValue","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newSponsorAddress","type":"address"}],"name":"transferPositionPassedRequest","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"rawValue","type":"uint256"}],"internalType":"struct FixedPoint.Unsigned","name":"collateralAmount","type":"tuple"}],"name":"withdraw","outputs":[{"components":[{"internalType":"uint256","name":"rawValue","type":"uint256"}],"internalType":"struct FixedPoint.Unsigned","name":"amountWithdrawn","type":"tuple"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"liquidationId","type":"uint256"},{"internalType":"address","name":"sponsor","type":"address"}],"name":"withdrawLiquidation","outputs":[{"components":[{"internalType":"uint256","name":"rawValue","type":"uint256"}],"internalType":"struct FixedPoint.Unsigned","name":"amountWithdrawn","type":"tuple"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawPassedRequest","outputs":[{"components":[{"internalType":"uint256","name":"rawValue","type":"uint256"}],"internalType":"struct FixedPoint.Unsigned","name":"amountWithdrawn","type":"tuple"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawalLiveness","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}] - - -module.exports = { - abis -} diff --git a/projects/config/wepiggy/abi.json b/projects/config/wepiggy/abi.json index 4a10a131bcb..da690787c4f 100644 --- a/projects/config/wepiggy/abi.json +++ b/projects/config/wepiggy/abi.json @@ -1,104 +1,8 @@ { - "decimals": - { - "constant": true, - "inputs": [], - "name": "decimals", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } - , - "getAllMarkets": - { - "constant": true, - "inputs": [], - "name": "getAllMarkets", - "outputs": [ - { - "internalType": "contract CToken[]", - "name": "", - "type": "address[]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } - , - "underlying": - { - "constant": true, - "inputs": [], - "name": "underlying", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } - , - "getCash": - { - "constant": true, - "inputs": [], - "name": "getCash", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } - , - "getUnderlyingPrice": - { - "constant": true, - "inputs": [ - { - "internalType": "address", - "name": "_pToken", - "type": "address" - } - ], - "name": "getUnderlyingPrice", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "oracle": - { - "inputs": [], - "name": "oracle", - "outputs": [ - { - "internalType": "contract IPriceOracle", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } -} + "decimals": "uint8:decimals", + "getAllMarkets": "address[]:getAllMarkets", + "underlying": "address:underlying", + "getCash": "uint256:getCash", + "getUnderlyingPrice": "function getUnderlyingPrice(address _pToken) view returns (uint256)", + "oracle": "address:oracle" +} \ No newline at end of file diff --git a/projects/conic-omnipool/index.js b/projects/conic-omnipool/index.js new file mode 100644 index 00000000000..c473908b1b5 --- /dev/null +++ b/projects/conic-omnipool/index.js @@ -0,0 +1,18 @@ +const sdk = require('@defillama/sdk') + +module.exports = { + doublecounted: true, + hallmarks: [ + [1689937200,"ETH Omnipool Hacked"] + ], + ethereum: { + tvl: async (_, _b, _cb, { api, }) => { + const balances = {} + const pools = await api.call({ abi: 'address[]:listPools', target: '0x013A3Da6591d3427F164862793ab4e388F9B587e' }) + const bals = await api.multiCall({ abi: 'uint256:totalUnderlying', calls: pools }) + const tokens = await api.multiCall({ abi: 'address:underlying', calls: pools }) + bals.forEach((v, i) => sdk.util.sumSingleBalance(balances,tokens[i],v, api.chain)) + return balances + } + } +} \ No newline at end of file diff --git a/projects/connext/abi.json b/projects/connext/abi.json index 38ab9178a7b..98c602c8362 100644 --- a/projects/connext/abi.json +++ b/projects/connext/abi.json @@ -1,16 +1,3 @@ { - "totalChannelToken": { - "constant": true, - "inputs": [], - "name": "totalChannelToken", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } -} + "totalChannelToken": "uint256:totalChannelToken" +} \ No newline at end of file diff --git a/projects/connext/index.js b/projects/connext/index.js index 255bdd20ff3..5fc14139b1d 100644 --- a/projects/connext/index.js +++ b/projects/connext/index.js @@ -1,48 +1,20 @@ -const { get } = require("../helper/http"); const { chainExports } = require("../helper/exports"); const { sumTokens2 } = require("../helper/unwrapLPs"); - -// Includes some chains that are not yet live -const chainNameToChainId = { - ethereum: 1, - bsc: 56, - boba: 288, - polygon: 137, - xdai: 100, - fantom: 250, - arbitrum: 42161, - avax: 43114, - optimism: 10, - fuse: 122, - moonbeam: 1284, - moonriver: 1285, - milkomeda: 2001, - celo: 42220, - aurora: 1313161554, - harmony: 1666600000, - cronos: 25, - evmos: 9001, - heco: 128, -}; - -let getContractsPromise +const { getConfig } = require('../helper/cache') // Taken from @connext/nxtp-contracts async function getContracts() { - if (!getContractsPromise) - getContractsPromise = get('https://raw.githubusercontent.com/connext/nxtp/v0.1.40/packages/contracts/deployments.json') - return getContractsPromise + return getConfig('connect/contracts', 'https://raw.githubusercontent.com/connext/monorepo/main/packages/deployments/contracts/deployments.json') } async function getDeployedContractAddress(chainId) { - const contracts = await getContracts() - const record = contracts[String(chainId)] || {} - const name = Object.keys(record)[0]; - if (!name) { - return undefined; - } - const contract = record[name]?.contracts?.TransactionManager; - return contract ? contract.address : undefined; + const allContracts = await getContracts() + const record = allContracts[chainId + ''] ?? [] + const contracts = (record ?? [])[0]?.contracts ?? {} + return [ + contracts.Connext?.address, + contracts.Connext_DiamondProxy?.address, + ].filter(i => i) } let getAssetsPromise @@ -50,21 +22,22 @@ let getAssetsPromise async function getAssetIds(chainId) { const url = "https://raw.githubusercontent.com/connext/chaindata/main/crossChain.json" if (!getAssetsPromise) - getAssetsPromise = get(url) + getAssetsPromise = getConfig('connect/assets/'+chainId, url) const data = await getAssetsPromise const chainData = data.find(item => item.chainId === chainId) || {} - return Object.keys(chainData.assetId || {}).map(id => id.toLowerCase()) + return Object.entries(chainData.assetId || {}).filter(i => i[0].length && !i[1].symbol.startsWith('next')).map(i => i[0]) } function chainTvl(chain) { - return async (time, ethBlock, { [chain]: block }) => { - const chainId = chainNameToChainId[chain] - const contractAddress = await getDeployedContractAddress(chainId) - if (!contractAddress) + return async (time, ethBlock,_, { api }) => { + + const chainId = api.chainId + const owners = await getDeployedContractAddress(chainId) + if (!owners.length) return {} const tokens = await getAssetIds(chainId) - return sumTokens2({ owner: contractAddress, tokens, chain, block, }) + return sumTokens2({ owners, tokens, api, }) }; } @@ -72,12 +45,14 @@ const chains = [ "ethereum", "bsc", "polygon", - "moonriver", - "fantom", "xdai", - "avax", "optimism", "arbitrum", + + // deprecated? + "moonriver", + "fantom", + "avax", "moonbeam", "fuse", "cronos", diff --git a/projects/connext/old.js b/projects/connext/old.js index b1f9a708d18..fb8ca757138 100644 --- a/projects/connext/old.js +++ b/projects/connext/old.js @@ -1,19 +1,20 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk'); const abi = require('./abi.json'); const BigNumber = require('bignumber.js') // V1 const hubAddress = '0xdfa6edAe2EC0cF1d4A60542422724A48195A5071'; -const tokenDenominationAddress = '0x6b175474e89094c44da98b954eedeac495271d0f'; +const tokenDenominationAddress = ADDRESSES.ethereum.DAI; //V3 const routers = ['0xe3cF69b86F274a14B87946bf641f11Ac837f4492', '0xe6887c0cc3c37cb2ee34Bc58AB258f36825CA910', '0xE540998865aFEB054021dc849Cc6191b8E09dC08', '0xC6C68811E75EfD86d012587849F1A1D30427361d'] -const ethereumTokens = ['0xdAC17F958D2ee523a2206206994597C13D831ec7', '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', '0x7D1AfA7B718fb893dB30A3aBc0Cfc608AaCfeBB0', '0x0f5d2fb29fb7d3cfee444a200298f468908cc942', '0x6b175474e89094c44da98b954eedeac495271d0f'] -const bscTokens = ['0x1AF3F329e8BE154074D8769D1FFa4eE058B1DBc3', '0x55d398326f99059fF775485246999027B3197955', '0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d'] +const ethereumTokens = [ADDRESSES.ethereum.USDT, ADDRESSES.ethereum.USDC, ADDRESSES.ethereum.MATIC, '0x0f5d2fb29fb7d3cfee444a200298f468908cc942', ADDRESSES.ethereum.DAI] +const bscTokens = ['0x1AF3F329e8BE154074D8769D1FFa4eE058B1DBc3', ADDRESSES.bsc.USDT, ADDRESSES.bsc.USDC] const polygonSettings = { nativeCoin: 'matic-network', tokens: [ { - address: '0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063', + address: ADDRESSES.polygon.DAI, coingeckoId: 'dai', }, { @@ -21,11 +22,11 @@ const polygonSettings = { coingeckoId: 'decentraland' }, { - address: '0xc2132D05D31c914a87C6611C10748AEb04B58e8F', + address: ADDRESSES.polygon.USDT, coingeckoId: 'tether' }, { - address: '0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174', + address: ADDRESSES.polygon.USDC, coingeckoId: 'usd-coin' } ] @@ -34,11 +35,11 @@ const xdaiSettings = { nativeCoin: 'dai', tokens: [ { - address: '0xDDAfbb505ad214D7b80b1f830fcCc89B60fb7A83', + address: ADDRESSES.xdai.USDC, coingeckoId: 'usd-coin' }, { - address: '0x4ECaBa5870353805a9F068101A40E0f32ed605C6', + address: ADDRESSES.xdai.USDT, coingeckoId: 'tether' }, ] diff --git a/projects/contango/index.js b/projects/contango/index.js new file mode 100644 index 00000000000..8119e60516d --- /dev/null +++ b/projects/contango/index.js @@ -0,0 +1,56 @@ +const { getLogs } = require("../helper/cache/getLogs") +const { sumTokens2 } = require('../helper/unwrapLPs') +const sdk = require('@defillama/sdk') + +const config = { + arbitrum: { + ladle: '0x93343c08e2055b7793a3336d659be348fc1b08f9', + fromBlock: 129978, + }, + ethereum: { + ladle: '0x30E7348163016B3b6E1621A3Cb40e8CF33CE97db', + fromBlock: 16074982, + }, +} + +module.exports = { +}; + +Object.keys(config).forEach(chain => { + const { ladle, fromBlock } = config[chain] + module.exports[chain] = { + tvl: async (timestamp, _b, chainBlocks, { api }) => { + const block = chainBlocks[chain] + const cauldron = await sdk.api2.abi.call({ + target: ladle, + abi: 'address:cauldron', + chain, block, + }) + + const logs = await getLogs({ + api, target: cauldron, fromBlock, + topic: 'IlkAdded(bytes6,bytes6)', eventAbi: abis.IlkAdded, + }) + const ilkIds = logs.map((log) => log.args.ilkId) + + const joins = await sdk.api2.abi.multiCall({ + target: ladle, + calls: ilkIds, + abi: abis.joins, + chain, block, + }) + const tokens = await sdk.api2.abi.multiCall({ + abi: 'address:asset', + calls: joins, + chain, block, + }) + const tokensAndOwners = joins.map((t, i) => ([tokens[i], t])) + return sumTokens2({ chain, block, tokensAndOwners, }) + } + } +}) + +const abis = { + joins: "function joins(bytes6) view returns (address)", + IlkAdded: "event IlkAdded(bytes6 indexed seriesId, bytes6 indexed ilkId)", +} \ No newline at end of file diff --git a/projects/convergence/index.js b/projects/convergence/index.js index ee0b65a19e6..41a945345b3 100644 --- a/projects/convergence/index.js +++ b/projects/convergence/index.js @@ -16,7 +16,6 @@ module.exports = { tvl: getUniTVL({ factory: MOONBEAM_FACTORY, useDefaultCoreAssets: true, - chain: 'moonbeam', }) } }; \ No newline at end of file diff --git a/projects/convex/abi.json b/projects/convex/abi.json index a75bc222d1b..e69d39d9b29 100644 --- a/projects/convex/abi.json +++ b/projects/convex/abi.json @@ -1,59 +1,4 @@ { - "poolInfo": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "poolInfo", - "outputs": [ - { - "internalType": "address", - "name": "lptoken", - "type": "address" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "address", - "name": "gauge", - "type": "address" - }, - { - "internalType": "address", - "name": "crvRewards", - "type": "address" - }, - { - "internalType": "address", - "name": "stash", - "type": "address" - }, - { - "internalType": "bool", - "name": "shutdown", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - "poolLength": { - "inputs": [], - "name": "poolLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } + "poolInfo": "function poolInfo(uint256) view returns (address lptoken, address token, address gauge, address crvRewards, address stash, bool shutdown)", + "poolLength": "uint256:poolLength" } \ No newline at end of file diff --git a/projects/convex/index.js b/projects/convex/index.js index b3d7d468fae..b45440ae196 100644 --- a/projects/convex/index.js +++ b/projects/convex/index.js @@ -1,15 +1,15 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const ABI = require('./abi.json') -const { fetchItemList } = require('../helper/utils') const { sumTokensExport } = require('../helper/unwrapLPs') const boosterAddress = "0xF403C135812408BFbE8713b5A23a04b3D48AAE31"; const staker = '0x989aeb4d175e16225e39e87d0d97a3360524ad80' -const cvxAddress = "0x4e3FBD56CD56c3e72c1403e103b45Db9da5B9D2B"; +const cvxAddress = ADDRESSES.ethereum.CVX; const cvxRewardsAddress = "0xCF50b810E57Ac33B91dCF525C6ddd9881B139332"; -const crvAddress = "0xd533a949740bb3306d119cc777fa900ba034cd52"; +const crvAddress = ADDRESSES.ethereum.CRV; -const arbiPoolInfoABI = { "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "name": "poolInfo", "outputs": [{ "internalType": "address", "name": "lptoken", "type": "address" }, { "internalType": "address", "name": "gauge", "type": "address" }, { "internalType": "address", "name": "rewards", "type": "address" }, { "internalType": "bool", "name": "shutdown", "type": "bool" }, { "internalType": "address", "name": "factory", "type": "address" }], "stateMutability": "view", "type": "function" } +const arbiPoolInfoABI = 'function poolInfo(uint256) view returns (address lptoken, address gauge, address rewards, bool shutdown, address factory)' async function tvl(chain, block) { const balances = {} @@ -35,26 +35,27 @@ async function tvl(chain, block) { abiPoolInfo = arbiPoolInfoABI } - let poolInfo = await fetchItemList({ chain, block, lengthAbi: ABI.poolLength, itemAbi: abiPoolInfo, target: boosterAddress }) - poolInfo = poolInfo.map(i => i.output); + let poolInfo = await sdk.api2.abi.fetchList({ chain, block, lengthAbi: ABI.poolLength, itemAbi: abiPoolInfo, target: boosterAddress }) const { output: gaugeBalances } = await sdk.api.abi.multiCall({ abi: 'erc20:balanceOf', - calls: poolInfo.map(i => ({ target: i.gauge, params: staker })), + calls: Array.from(new Set(poolInfo.map(p=>p.gauge))).map(i => ({ target: i, params: staker })), chain, block, }) - gaugeBalances.forEach(({ output }, i) => sdk.util.sumSingleBalance(balances, chain + ':' + poolInfo[i].lptoken, output)) + gaugeBalances.forEach(({ output, input }, i) => sdk.util.sumSingleBalance(balances, chain + ':' + poolInfo.find(p=>p.gauge.toLowerCase()===input.target.toLowerCase()).lptoken, output)) return balances } const chains = [ 'ethereum', 'arbitrum', + 'polygon', ] module.exports = { doublecounted: true, hallmarks: [ - [1651881600, "UST depeg"], + [1640164144, "cvxFXS Launched"], + [1651881600, "UST depeg"] ] }; @@ -64,4 +65,4 @@ chains.forEach(chain => { } }) -module.exports.ethereum.staking = sumTokensExport({ owner: cvxRewardsAddress, tokens: [cvxAddress] }) \ No newline at end of file +module.exports.ethereum.staking = sumTokensExport({ owner: cvxRewardsAddress, tokens: [cvxAddress] }) diff --git a/projects/convex/pools-crv.js b/projects/convex/pools-crv.js index 8f723d13e0f..06082a5be6e 100644 --- a/projects/convex/pools-crv.js +++ b/projects/convex/pools-crv.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const REFERENCE_ASSETS = {}; const coins = {}; @@ -761,7 +762,7 @@ module.exports = [{ referenceAsset: REFERENCE_ASSETS.EUR, oldAdditionalRewards: [{ name: 'SNX', - rewardTokenAddress: '0xC011a73ee8576Fb46F5E1c5751cA3B9Fe0af2a6F', + rewardTokenAddress: ADDRESSES.ethereum.SNX, rewardTokenDecimals: 18, rewardTokenCoingeckoId: 'havven', }], @@ -856,7 +857,7 @@ module.exports = [{ additionalRewards: [{ name: 'LDO', amountDataKey: 'ldoRewards', - rewardTokenAddress: '0x5a98fcbea516cf06857215779fd812ca3bef1b32', + rewardTokenAddress: ADDRESSES.ethereum.LIDO, rewardTokenDecimals: 18, rewardTokenCoingeckoId: 'lido-dao', }], diff --git a/projects/cookfinance/index.js b/projects/cookfinance/index.js index 4527f7e91e2..b47efc53a8e 100644 --- a/projects/cookfinance/index.js +++ b/projects/cookfinance/index.js @@ -34,21 +34,8 @@ const ethIndexes = [ "0x43633bDb2675aDaB99CE3059D734b92a1deDAb2b", // EDI ]; -const getComponentsABI = { - inputs: [], - name: "getComponents", - outputs: [{ internalType: "address[]", name: "", type: "address[]" }], - stateMutability: "view", - type: "function", -} - -const getCKsABI = { - inputs: [], - name: "getCKs", - outputs: [{ internalType: "address[]", name: "", type: "address[]" }], - stateMutability: "view", - type: "function", -} +const getComponentsABI = "address[]:getComponents" +const getCKsABI = "address[]:getCKs" async function getTvl({ chain, block, indices }) { const indexCalls = indices.map(i => ({ target: i })) diff --git a/projects/cookfinance/venusFinanceAbi.json b/projects/cookfinance/venusFinanceAbi.json index 3bec61f6de9..bf41dfa67d1 100644 --- a/projects/cookfinance/venusFinanceAbi.json +++ b/projects/cookfinance/venusFinanceAbi.json @@ -1,36 +1,4 @@ { - "underlying": { - "constant":true, - "inputs":[ - - ], - "name":"underlying", - "outputs":[ - { - "internalType":"address", - "name":"", - "type":"address" - } - ], - "payable":false, - "stateMutability":"view", - "type":"function" - }, - "exchangeRateStored": { - "constant":true, - "inputs":[ - - ], - "name":"exchangeRateStored", - "outputs":[ - { - "internalType":"uint256", - "name":"", - "type":"uint256" - } - ], - "payable":false, - "stateMutability":"view", - "type":"function" - } -} + "underlying": "address:underlying", + "exchangeRateStored": "uint256:exchangeRateStored" +} \ No newline at end of file diff --git a/projects/cookfinance/yieldyakAbi.json b/projects/cookfinance/yieldyakAbi.json index 2c5d6f56509..8abf8a7fbf2 100644 --- a/projects/cookfinance/yieldyakAbi.json +++ b/projects/cookfinance/yieldyakAbi.json @@ -1,20 +1,4 @@ { - "depositToken": { - "type": "function", - "stateMutability": "view", - "outputs": [ - { "type": "address", "name": "", "internalType": "contract IERC20" } - ], - "name": "depositToken", - "inputs": [] - }, - "getDepositTokensForShares": { - "type": "function", - "stateMutability": "view", - "outputs": [{ "type": "uint256", "name": "", "internalType": "uint256" }], - "name": "getDepositTokensForShares", - "inputs": [ - { "type": "uint256", "name": "amount", "internalType": "uint256" } - ] - } -} + "depositToken": "address:depositToken", + "getDepositTokensForShares": "function getDepositTokensForShares(uint256 amount) view returns (uint256)" +} \ No newline at end of file diff --git a/projects/core/index.js b/projects/core/index.js index f29e5b542b7..6409055e0ea 100644 --- a/projects/core/index.js +++ b/projects/core/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens2, nullAddress, } = require('../helper/unwrapLPs') // cVault UniV2 pairs @@ -16,15 +17,15 @@ const WCORE = '0x17B8c1A92B66b1CF3092C5d223Cb3a129023b669' // wCORE // ERC20 Tokens const COREDAO = '0xf66cd2f8755a21d3c8683a10269f795c0532dd58' // coreDAO -const DAI = '0x6B175474E89094C44Da98b954EedeAC495271d0F' // DAI +const DAI = ADDRESSES.ethereum.DAI // DAI const DELTA = '0x9EA3b5b4EC044b70375236A281986106457b20EF' // DELTA const FANNY = '0x8ad66f7e0e3e3dc331d3dbf2c662d7ae293c1fe0' // FANNY const CORE = '0x62359ed7505efc61ff1d56fef82158ccaffa23d7' // CORE const DELTA_RLP = '0xfcfc434ee5bff924222e084a8876eee74ea7cfba' // DELTA rLP -const WETH = '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2' // wETH -const USDC = '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48' -const USDT = "0xdac17f958d2ee523a2206206994597c13d831ec7" -const WBTC = "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599" +const WETH = ADDRESSES.ethereum.WETH // wETH +const USDC = ADDRESSES.ethereum.USDC +const USDT = ADDRESSES.ethereum.USDT +const WBTC = ADDRESSES.ethereum.WBTC // Ecosystem contracts const CORE_DEPLOYER = '0x5a16552f59ea34e44ec81e58b3817833e9fd5436' // CoreVault Deployer/Multisig @@ -85,6 +86,6 @@ module.exports = { tvl, treasury, staking, - ownTokens: ['CORE', 'CoreDAO', 'Delta', 'FANNY', 'Delta rLP', 'cBTC', 'cDAI'] + // ownTokens: ['CORE', 'CoreDAO', 'Delta', 'FANNY', 'Delta rLP', 'cBTC', 'cDAI'] } }; diff --git a/projects/coreswap/index.js b/projects/coreswap/index.js new file mode 100644 index 00000000000..6ab1aec4343 --- /dev/null +++ b/projects/coreswap/index.js @@ -0,0 +1,11 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports = { + misrepresentedTokens: true, + core: { + tvl: getUniTVL({ + useDefaultCoreAssets: true, + factory: '0x97814a1F542aFe7fd02de53926621b0D40e8Ad6C', + }) + } +} \ No newline at end of file diff --git a/projects/corgi/abi.js b/projects/corgi/abi.js index 365241bbc46..4a9cfe72360 100644 --- a/projects/corgi/abi.js +++ b/projects/corgi/abi.js @@ -1,69 +1,4 @@ module.exports = { - poolInfo2: { - "inputs": [ - { - "internalType": "uint256", - "name": "_pid", - "type": "uint256" - } - ], - "name": "poolInfo2", - "outputs": [ - { - "internalType": "address", - "name": "lpToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "allocPoint", - "type": "uint256" - }, - { - "internalType": "address", - "name": "strat0", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount0", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "share0", - "type": "uint256" - }, - { - "internalType": "address", - "name": "strat1", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount1", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "share1", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - poolLength: { - "inputs": [], - "name": "poolLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, + poolInfo2: "function poolInfo2(uint256 _pid) view returns (address lpToken, uint256 allocPoint, address strat0, uint256 amount0, uint256 share0, address strat1, uint256 amount1, uint256 share1)", + poolLength: "uint256:poolLength", } \ No newline at end of file diff --git a/projects/corgi/index.js b/projects/corgi/index.js index 0c79c40a01d..7b91d612e4b 100644 --- a/projects/corgi/index.js +++ b/projects/corgi/index.js @@ -1,100 +1,7 @@ -const sdk = require("@defillama/sdk") -const abi = require('./abi') -const { getChainTransform } = require('../helper/portedTokens') -const { getLPData, getTokenPrices } = require('../helper/unknownTokens') -const { stakingPricedLP, stakingUnknownPricedLP } = require('../helper/staking') -const { pool2s , pool2} = require("../helper/pool2"); -const chain = 'dogechain' -let totalTvl - -const contract = '0xEfB1E90eF4D9672843e01Cb9d691175CB9404b5C' -const cog = '0xA8Fc6EF0B48557596D4a75FF85a288A982606707' - -async function gettotalTvl(block) { - if (!totalTvl) totalTvl = getTVL() - return totalTvl - - async function getTVL() { - const transform = await getChainTransform(chain) - const balances = { - tvl: {}, - - - } - const { output: length } = await sdk.api.abi.call({ - target: contract, - abi: abi.poolLength, - chain, - block, - }) - - const calls = [] - for (let i = 0; i < length; i++) calls.push({ params: [i] }) - const { output: data } = await sdk.api.abi.multiCall({ - target: contract, - abi: abi.poolInfo2, - calls, - chain, - block, - }) - - const tempBalances = {} - const lps = [] - - data.forEach(({ output }) => { - const token = output.lpToken.toLowerCase() - const amount = output.amount0 - sdk.util.sumSingleBalance(tempBalances, token, amount) - lps.push(token) - }) - - - - - const pairs = await getLPData({ lps, chain, block }) - - const { updateBalances, } = await getTokenPrices({ lps: Object.keys(pairs), allLps: true, coreAssets: [], block, chain, minLPRatio: 0.001 }) - - Object.entries(tempBalances).forEach(([token, balance]) => { - if (pairs[token]) { - const { token0Address, token1Address } = pairs[token] - if (cog === token0Address || cog === token1Address) { - sdk.util.sumSingleBalance(balances.pool2, transform(token), balance) - return; - } - } - sdk.util.sumSingleBalance(balances.tvl, transform(token), balance) - }) - - await updateBalances(balances.tvl) - //await updateBalances(balances.pool2) - - return balances - } -} - -async function tvl(_, _b, { - [chain]: block -}) { - return (await gettotalTvl(block)).tvl -} -/* -async function pool2(_, _b, { - [chain]: block -}) { - return (await gettotalTvl(block)).pool2 -}*/ - - - - module.exports = { dogechain: { tvl: () => ({}), - // tvl: tvl, - // pool2: pool2(contract, '0xd9a09a130f73626a6f6526a575f8e23170186b42', 'dogechain', addr=>`dogechain:${addr}` ), - // staking: stakingUnknownPricedLP('0x69e1f7e60A83BF250E0a277f3711a1612279dD7E', cog, 'dogechain', '0xd9a09a130f73626a6f6526a575f8e23170186b42', addr=>`dogechain:${addr}`, 18 ), }, hallmarks: [ [1662859935, "Rug pull"], diff --git a/projects/cortexdao/index.js b/projects/cortexdao/index.js new file mode 100644 index 00000000000..93f325de22a --- /dev/null +++ b/projects/cortexdao/index.js @@ -0,0 +1,15 @@ +const { staking } = require("../helper/staking"); + +const cxdAddress = "0x5a56da75c50aa2733f5fa9a2442aaefcbc60b2e6"; +const stakingAddress = "0x6021D8e7537d68bCEC9A438b2C134c24Cbcc1ce3"; + +module.exports = { + ethereum: { + tvl: () => ({}), + staking: staking(stakingAddress, cxdAddress), + }, + hallmarks: [ + [1651881600, "UST depeg"], + [1678557600, "USDC depeg"], + ], +}; diff --git a/projects/counterstake/index.js b/projects/counterstake/index.js index 6e8544d69fe..3905909706c 100644 --- a/projects/counterstake/index.js +++ b/projects/counterstake/index.js @@ -10,8 +10,11 @@ const { fetchOswapAssets, fetchOswapExchangeRates, summingBaseAABalancesToTvl, -} = require('../helper/chain/obyte') - +} = require('../helper/chain/obyte'); +const utils = require('../helper/utils'); +const sdk = require('@defillama/sdk') +const { sumTokens2 } = require('../helper/unwrapLPs') +const { getConfig } = require('../helper/cache') async function bridgeTvl(timestamp, assetMetadata, exchangeRates) { const baseAABalances = await Promise.all([ @@ -64,14 +67,66 @@ async function totalObyteTvl(timestamp) { bridgeTvl(timestamp, assetMetadata, exchangeRates), pooledAssistantTvl(timestamp, assetMetadata, exchangeRates), governanceTvl(timestamp, assetMetadata, exchangeRates) - ]) + ]); return { - tether: tvls.reduce( (total, tvl) => total + tvl, 0) + tether: tvls.reduce((total, tvl) => total + tvl, 0) } } -// TODO add Ethereum, Polygon, BSC side of TVL +const totalTVLByEVMNetwork = async (_, _1, _2, { api }) => { + const bridges = await getConfig('counterstake/bridges', 'https://counterstake.org/api/bridges').then((data) => data.data); + const pooledAssistants = await getConfig('counterstake/poolStakes', 'https://counterstake.org/api/pooled_assistants').then((data) => data.data); + + const bridgeAasByChain = []; + const tokensAndOwners = [] + + bridges.forEach(({ home_network, foreign_network, export_aa, import_aa, stake_asset, home_asset }) => { + if (home_network.toLowerCase() === api.chain) { // export + tokensAndOwners.push([home_asset, export_aa]) + bridgeAasByChain.push(export_aa); + } else if (foreign_network.toLowerCase() === api.chain) { // import + tokensAndOwners.push([stake_asset, import_aa]) + bridgeAasByChain.push(import_aa); + } + }); + + pooledAssistants.filter(({ network }) => network.toLowerCase() === api.chain).forEach(({ assistant_aa, side, bridge_id }) => { + const bridge = bridges.find((bridge) => bridge.bridge_id === bridge_id); + + if (bridge) { + if (side === 'import') { + // stake asset + tokensAndOwners.push([bridge.stake_asset, assistant_aa]) + // imported asset + // tokensAndOwners.push([bridge.foreign_asset, assistant_aa]) + + } else { // export + tokensAndOwners.push([bridge.home_asset, assistant_aa]) + } + } + + }); + + const governanceAddresses = await api.multiCall({ + abi: 'address:governance', + calls: bridgeAasByChain, + }); + + const voteTokenAddresses = await api.multiCall({ + abi: 'address:votingTokenAddress', + calls: governanceAddresses, + }); + + bridgeAasByChain.forEach((_, index) => { + const voteTokenAddress = voteTokenAddresses[index]; + const governanceAddress = governanceAddresses[index]; + tokensAndOwners.push([voteTokenAddress, governanceAddress ]) + }); + + return sumTokens2({ api, tokensAndOwners}) +} + module.exports = { timetravel: false, doublecounted: false, @@ -82,5 +137,17 @@ module.exports = { "pooled assistant buffers and value stored for governance.", obyte: { tvl: totalObyteTvl + }, + ethereum: { + tvl: totalTVLByEVMNetwork + }, + bsc: { + tvl: totalTVLByEVMNetwork + }, + polygon: { + tvl: totalTVLByEVMNetwork + }, + kava: { + tvl: totalTVLByEVMNetwork } } diff --git a/projects/covo-finance/index.js b/projects/covo-finance/index.js new file mode 100644 index 00000000000..b675f27a81c --- /dev/null +++ b/projects/covo-finance/index.js @@ -0,0 +1,7 @@ +const { gmxExports } = require('../helper/gmx') + +module.exports = { + polygon: { + tvl: gmxExports({ vault: '0x22F688efeFB9c158De4FD62F2C9c08BF79542030', }) + }, +} diff --git a/projects/covo-v2/index.js b/projects/covo-v2/index.js new file mode 100644 index 00000000000..5e33071e655 --- /dev/null +++ b/projects/covo-v2/index.js @@ -0,0 +1,15 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport, nullAddress } = require('../helper/unwrapLPs') + +const fundStore = "0xED29cB1b164dd7EA1c5065E79a15dA31EC34327B"; +const covo = "0x681D3e1b54B3E1a338feB5B076cebf53a697d51F"; + +module.exports = { + polygon: { + tvl: sumTokensExport({ owners: [fundStore], tokens: [ + nullAddress, + ADDRESSES.polygon.USDC,//USDC + ]}), + staking: sumTokensExport({ owners: [fundStore], tokens: [covo]}) + }, +} diff --git a/projects/cowswap-cash/index.js b/projects/cowswap-cash/index.js new file mode 100644 index 00000000000..ee736bc1a69 --- /dev/null +++ b/projects/cowswap-cash/index.js @@ -0,0 +1,14 @@ +const { getUniTVL } = require('../helper/unknownTokens') +const { stakingPricedLP } = require('../helper/staking') + + +module.exports = { + misrepresentedTokens: true, + timetravel: false, + methodology: "The factory addresses are used to find the LP pairs on Smart BCH and Milkomeda. For Cardano we calculate the tokens on resting orders on the order book contracts. TVL is equal to the liquidity on the AMM plus the open orders in the order book", + smartbch: { + tvl: getUniTVL({ factory: '0x72cd8c0B5169Ff1f337E2b8F5b121f8510b52117', chain: 'smartbch', useDefaultCoreAssets: true }), + staking: stakingPricedLP("0x4856BB1a11AF5514dAA0B0DC8Ca630671eA9bf56", "0xc8E09AEdB3c949a875e1FD571dC4b3E48FB221f0", "smartbch", "0x599061437d8455df1f86d401FCC2211baaBC632D", "bitcoin-cash", false, 18) + }, + +} \ No newline at end of file diff --git a/projects/cozy-v2/index.js b/projects/cozy-v2/index.js new file mode 100644 index 00000000000..48aa5410dcf --- /dev/null +++ b/projects/cozy-v2/index.js @@ -0,0 +1,25 @@ +const { getLogs, getAddress } = require('../helper/cache/getLogs'); +const { sumTokens2 } = require('../helper/unwrapLPs'); + +const config = { + optimism: {factory: '0xdebe19b57e8b7eb6ea6ebea67b12153e011e6447', fromBlock: 96818459,}, +} + +module.exports = { +}; + +Object.keys(config).forEach(chain => { + const {factory, fromBlock} = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const logs = await getLogs({ + api, + target: factory, + topics: ['0x1bf8fff61a482f21edcb49226d708f5255b3e06bb9c6485892a057058b494790'], + fromBlock, + }) + const tokensAndOwners = logs.map(i => [i.topics[1], i.data].map(getAddress)) + return sumTokens2({ api, tokensAndOwners}) + } + } +}) \ No newline at end of file diff --git a/projects/cozy/index.js b/projects/cozy/index.js index ea995626fee..f9dba73acfe 100644 --- a/projects/cozy/index.js +++ b/projects/cozy/index.js @@ -1,8 +1,9 @@ +const ADDRESSES = require('../helper/coreAssets.json') const {compoundExports} = require('../helper/compound') const transform = addr=>{ if(addr==="0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE"){ - return "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2" + return ADDRESSES.ethereum.WETH } return addr } diff --git a/projects/crETH2/index.js b/projects/crETH2/index.js new file mode 100644 index 00000000000..f89a2a2bb6e --- /dev/null +++ b/projects/crETH2/index.js @@ -0,0 +1,10 @@ +const sdk = require("@defillama/sdk") +const token = '0x49d72e3973900a195a155a46441f0c08179fdb64' + +module.exports = { + ethereum: { + tvl: async (_, block) => ({ + ethereum: (await sdk.api.erc20.totalSupply({ target: token, block})).output/1e18 + }) + } +} \ No newline at end of file diff --git a/projects/crabada/index.js b/projects/crabada/index.js index e3694e48ff8..65dbb8985dd 100644 --- a/projects/crabada/index.js +++ b/projects/crabada/index.js @@ -1,51 +1,11 @@ const { staking } = require("../helper/staking"); -const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); -const { transformAvaxAddress } = require("../helper/portedTokens"); const stakingContract = "0xD2cd7a59Aa8f8FDc68d01b1e8A95747730b927d3"; const CRA = "0xa32608e873f9ddef944b24798db69d80bbb4d1ed"; -const treasuryContracts = [ - //mains treasury - "0x96DD95307295e2f72E6382Fc5130F1A8DB74042C", - // Breeding fees - "0x4e57A39Cac2499aBeafd3698F7164eCBFde008eE", - // Marketplace fees - "0x49F6fC3f882e2Cd915E38bA377f8e977c11e0F66", - // Tavern fees - "0x2BA9033E49EC1aa030fA46DE6d6793983945497E", -]; - -const lpTokens = [ - [CRA, false], - ["0xf693248F96Fe03422FEa95aC0aFbBBc4a8FdD172", false], //TUS - ["0x140CAc5f0e05cBEc857e65353839FddD0D8482C1", true], // WAVAX-CRA JLP - ["0x565d20BD591b00EAD0C927e4b6D7DD8A33b0B319", true], // WAVAX-TUS JLP - ["0x21889033414f652f0fD0e0f60a3fc0221d870eE4", true], // CRA-TUS JLP - ["0x134905461773eF228b66CEBd5E1FF06D7CC79B12", true], // TUS-CRAM JLP - ["0xa7d7079b0fead91f3e65f86e8915cb59c1a4c664", false] // USDC -]; - -async function Treasury(timestamp, chainBlocks) { - const balances = {}; - - const transformAddress = await transformAvaxAddress(); - await sumTokensAndLPsSharedOwners( - balances, - lpTokens, - treasuryContracts, - chainBlocks["avax"], - "avax", - transformAddress - ); - - return balances; -} - module.exports = { misrepresentedTokens: true, avax: { - treasury: Treasury, staking: staking(stakingContract, CRA, "avax"), tvl: () =>({}), }, diff --git a/projects/crafting/index.js b/projects/crafting/index.js index 3dc5511c0ba..de35652d112 100644 --- a/projects/crafting/index.js +++ b/projects/crafting/index.js @@ -1,8 +1,9 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); const contractStakingETH = "0x9353177049757A21f19a28C3055c03871e6428cf"; -const ETH = "0x0000000000000000000000000000000000000000"; +const ETH = ADDRESSES.null; const contractAddresses = [ //Staking Contract wbtc @@ -14,8 +15,8 @@ const contractAddresses = [ ]; const tokens = [ - "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599", - "0xdac17f958d2ee523a2206206994597c13d831ec7", + ADDRESSES.ethereum.WBTC, + ADDRESSES.ethereum.USDT, "0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D", ]; @@ -27,8 +28,8 @@ const contractAddresses_aurora = [ ]; const tokens_aurora = [ - "0x8BEc47865aDe3B172A928df8f990Bc7f2A3b9f79", - "0xC42C30aC6Cc15faC9bD938618BcaA1a1FaE8501d", + ADDRESSES.aurora.AURORA, + ADDRESSES.aurora.NEAR, ]; async function ethTvl(timestamp, block) { diff --git a/projects/cranium/index.js b/projects/cranium/index.js new file mode 100644 index 00000000000..436893e489d --- /dev/null +++ b/projects/cranium/index.js @@ -0,0 +1,13 @@ +const {staking} = require('../helper/staking') +const { gmxExports } = require('../helper/gmx') + +const arbitrumVault = '0x76cA86C73CE0F03eac0052C4FC5eacdb10D9663f'; +const arbitrumStaking = '0x2b402AeDd4ccC193DC2A50c281Fb8945ddaD9760'; +const arbitrumGMX = '0xfa5992A8A47aF7029e04eC6a95203AD3f301460b'; + +module.exports = { + fantom: { + staking: staking(arbitrumStaking, arbitrumGMX), + tvl: gmxExports({ vault: arbitrumVault, }) + } +} \ No newline at end of file diff --git a/projects/cream/cerc20.json b/projects/cream/cerc20.json index 539e90ab68f..a374cd8db91 100644 --- a/projects/cream/cerc20.json +++ b/projects/cream/cerc20.json @@ -1,62 +1,6 @@ { - "getCash": { - "constant": true, - "inputs": [], - "name": "getCash", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "underlying": { - "constant": true, - "inputs": [], - "name": "underlying", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "totalBorrows": { - "constant": true, - "inputs": [], - "name": "totalBorrows", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "totalReserves": { - "constant": true, - "inputs": [], - "name": "totalReserves", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } + "getCash": "uint256:getCash", + "underlying": "address:underlying", + "totalBorrows": "uint256:totalBorrows", + "totalReserves": "uint256:totalReserves" } \ No newline at end of file diff --git a/projects/cream/creth2.json b/projects/cream/creth2.json index c64600945a4..41916cd62c3 100644 --- a/projects/cream/creth2.json +++ b/projects/cream/creth2.json @@ -1,17 +1,3 @@ { - "accumulated": { - "constant": true, - "inputs": [], - "name": "accumulated", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } + "accumulated": "uint256:accumulated" } \ No newline at end of file diff --git a/projects/cream/index.js b/projects/cream/index.js index cc50d2e9f8e..8b8baf84c44 100644 --- a/projects/cream/index.js +++ b/projects/cream/index.js @@ -1,21 +1,23 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const utils = require("../helper/utils"); -const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); +const { unwrapUniswapLPs, nullAddress } = require("../helper/unwrapLPs"); const { getCompoundV2Tvl, compoundExports } = require("../helper/compound"); -const { transformBscAddress } = require('../helper/portedTokens') +const { transformBscAddress } = require('../helper/portedTokens') +const { getConfig } = require('../helper/cache') const abiCerc20 = require("./cerc20.json"); const abiCereth2 = require("./creth2.json"); const BigNumber = require("bignumber.js"); // -const wETH = "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"; +const wETH = ADDRESSES.ethereum.WETH; const CRETH2 = "0xcBc1065255cBc3aB41a6868c22d1f1C573AB89fd"; const crvIB = "0x27b7b1ad7288079A66d12350c828D3C00A6F07d7"; const replacements = { "0xe1237aA7f535b0CC33Fd973D66cBf830354D16c7": wETH, // yWETH -> WETH - //'0x27b7b1ad7288079A66d12350c828D3C00A6F07d7': '0x6b175474e89094c44da98b954eedeac495271d0f', // yearn: yCRV-IB -> DAI + //'0x27b7b1ad7288079A66d12350c828D3C00A6F07d7': ADDRESSES.ethereum.DAI, // yearn: yCRV-IB -> DAI "0x986b4AFF588a109c09B50A03f42E4110E29D353F": wETH, // yearn: yCRV/sETH "0xdCD90C7f6324cfa40d7169ef80b12031770B4325": wETH, // yearn: yCRV/stETH "0x9cA85572E6A3EbF24dEDd195623F188735A5179f": @@ -26,10 +28,10 @@ async function ethereumTvl(timestamp, block) { let balances = {}; let tokens_ethereum = ( - await utils.fetchURL( + await getConfig('cream/ethereum', "https://api.cream.finance/api/v1/crtoken?comptroller=eth" ) - ).data; + ); // --- Grab all the getCash values of crERC20 (Lending Contract Addresses) --- let cashValues = ( @@ -45,6 +47,7 @@ async function ethereumTvl(timestamp, block) { block, calls: tokens_ethereum.map((token) => ({ target: token.token_address })), abi: abiCerc20["underlying"], + permitFailure: true, }) ).output; @@ -54,7 +57,7 @@ async function ethereumTvl(timestamp, block) { // It's ETH sdk.util.sumSingleBalance( balances, - "0x0000000000000000000000000000000000000000", + ADDRESSES.null, cashVal.output ); } else if ( @@ -65,54 +68,35 @@ async function ethereumTvl(timestamp, block) { token: underlyings[idx].output, balance: cashVal.output, }); - } else if (underlyings[idx].output === crvIB) { - return; // https://twitter.com/0xngmi/status/1398565590856515585 + } else if (underlyings[idx].output === crvIB || underlyings[idx].output === CRETH2) { + return; // Exclude CRETH2 //https://twitter.com/0xngmi/status/1398565590856515585 } else { const token = replacements[underlyings[idx].output] || underlyings[idx].output; sdk.util.sumSingleBalance(balances, token, cashVal.output); } }); - await unwrapUniswapLPs(balances, lpPositions, block); - // --- Grab the accumulated on CRETH2 (ETH balance and update proper balances key) --- - const accumCRETH2 = ( - await sdk.api.abi.call({ - block, - target: CRETH2, - abi: abiCereth2["accumulated"], - }) - ).output; - - /* - In theory the ETH deposited in `0xcBc1065255cBc3aB41a6868c22d1f1C573AB89fd` mints CRETH2 which later, - but represents the same ETH portion, so we should deduct from the total value given by `accumulated()`` - the amount of ETH already deployed in the ethereum market place, otherwise it will account a certain % - twice. Only certain portion can be considered "idle" in the eth deposit contract to account again as extra - eth tvl - */ - const iddleInETHDepositContract = - BigNumber(accumCRETH2).minus(balances[CRETH2]); - - balances["0x0000000000000000000000000000000000000000"] = BigNumber(balances["0x0000000000000000000000000000000000000000"]).plus(iddleInETHDepositContract).toFixed(0); + await unwrapUniswapLPs(balances, lpPositions, block); + return balances; } -async function lending(block, chain, borrowed){ +async function lending(block, chain, borrowed) { let balances = {}; let tokens_bsc = ( - await utils.fetchURL( + await getConfig('cream/'+chain, `https://api.cream.finance/api/v1/crtoken?comptroller=${chain}` ) - ).data; + ); let cashValues = ( await sdk.api.abi.multiCall({ block, calls: tokens_bsc.map((token) => ({ target: token.token_address })), - abi: borrowed? abiCerc20.totalBorrows: abiCerc20["getCash"], + abi: borrowed ? abiCerc20.totalBorrows : abiCerc20["getCash"], chain, }) ).output; @@ -122,6 +106,7 @@ async function lending(block, chain, borrowed){ block, calls: tokens_bsc.map((token) => ({ target: token.token_address })), abi: abiCerc20["underlying"], + permitFailure: true, chain, }) ).output; @@ -134,10 +119,10 @@ async function lending(block, chain, borrowed){ token: underlyings[idx].output, balance: cashVal.output, }); - } else if (tokens_bsc[idx].symbol==="crBNB") { + } else if (tokens_bsc[idx].symbol === "crBNB") { sdk.util.sumSingleBalance( balances, - "bsc:0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c", + "bsc:" + ADDRESSES.bsc.WBNB, cashVal.output ); // BNB } else { @@ -160,7 +145,7 @@ const bscTvl = async (timestamp, ethBlock, chainBlocks) => { sdk.util.sumSingleBalance( balances, - "bsc:0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c", // -- Apparently it auto-merges balances (check on output) --- + "bsc:" + ADDRESSES.bsc.WBNB, // -- Apparently it auto-merges balances (check on output) --- BigNumber(bsc_staking_service.data.votingPower) .multipliedBy(10 ** 18) .toFixed(0) @@ -176,7 +161,7 @@ const bscBorrowed = async (timestamp, ethBlock, chainBlocks) => { module.exports = { hallmarks: [ - [1635292800,"Flashloan exploit"] + [1635292800, "Flashloan exploit"] ], timetravel: false, // bsc and fantom api's for staked coins can't be queried at historical points start: 1599552000, // 09/08/2020 @ 8:00am (UTC) @@ -186,8 +171,9 @@ module.exports = { bsc: { tvl: bscTvl, borrowed: bscBorrowed - //getCompoundV2Tvl("0x589de0f0ccf905477646599bb3e5c622c84cc0ba", "bsc", addr=>`bsc:${addr}`, "0x1Ffe17B99b439bE0aFC831239dDECda2A790fF3A", "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c", true), + //getCompoundV2Tvl("0x589de0f0ccf905477646599bb3e5c622c84cc0ba", "bsc", addr=>`bsc:${addr}`, "0x1Ffe17B99b439bE0aFC831239dDECda2A790fF3A", ADDRESSES.bsc.WBNB, true), }, - polygon:compoundExports("0x20ca53e2395fa571798623f1cfbd11fe2c114c24", "polygon"), - arbitrum:compoundExports("0xbadaC56c9aca307079e8B8FC699987AAc89813ee", "arbitrum"), + // ethereum:compoundExports("0x3d5BC3c8d13dcB8bF317092d84783c2697AE9258", "ethereum", "0xd06527d5e56a3495252a528c4987003b712860ee", nullAddress), + polygon: compoundExports("0x20ca53e2395fa571798623f1cfbd11fe2c114c24", "polygon"), + arbitrum: compoundExports("0xbadaC56c9aca307079e8B8FC699987AAc89813ee", "arbitrum"), }; diff --git a/projects/creamswap/abi.json b/projects/creamswap/abi.json index b1f088f188c..5b5c9fc806f 100644 --- a/projects/creamswap/abi.json +++ b/projects/creamswap/abi.json @@ -1,85 +1,7 @@ { - "getCurrentTokens": { - "constant": true, - "inputs": [], - "name": "getCurrentTokens", - "outputs": [ - { - "internalType": "address[]", - "name": "tokens", - "type": "address[]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "get_virtual_price": { - "constant": true, - "inputs": [], - "name": "get_virtual_price", - "outputs": [ - { - "type": "uint256", - "name": "out" - } - ], - "payable": false, - "signature": "0xbb7b8b80", - "stateMutability": "view", - "type": "function" - }, - "getPricePerFullShare": { - "constant": true, - "inputs": [], - "name": "getPricePerFullShare", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function", - "signature": "0x77c7b8fc" - }, - "balanceOfUnderlying": { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - } - ], - "name": "balanceOfUnderlying", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function", - "signature": "0x3af9e669" - }, - "underlying": { - "constant": true, - "inputs": [], - "name": "underlying", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } -} + "getCurrentTokens": "address[]:getCurrentTokens", + "get_virtual_price": "uint256:get_virtual_price", + "getPricePerFullShare": "uint256:getPricePerFullShare", + "balanceOfUnderlying": "function balanceOfUnderlying(address owner) returns (uint256)", + "underlying": "address:underlying" +} \ No newline at end of file diff --git a/projects/creamswap/index.js b/projects/creamswap/index.js index 34025181408..dcbbe23f00d 100644 --- a/projects/creamswap/index.js +++ b/projects/creamswap/index.js @@ -1,190 +1,189 @@ +const ADDRESSES = require('../helper/coreAssets.json') /*================================================== Modules ==================================================*/ - const sdk = require('@defillama/sdk'); - const abi = require('./abi.json'); - const BigNumber = require('bignumber.js'); +const sdk = require('@defillama/sdk'); +const abi = require('./abi.json'); +const BigNumber = require('bignumber.js'); +const { getLogs } = require('../helper/cache/getLogs') - /*================================================== - Settings - ==================================================*/ - - const wETH = '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2'; - const usdt = '0xdAC17F958D2ee523a2206206994597C13D831ec7'; - const yyCrv = '0x5dbcF33D8c2E976c6b560249878e6F1491Bca25c'; - const yETH = '0xe1237aA7f535b0CC33Fd973D66cBf830354D16c7'; - const crYFI = '0xCbaE0A83f4f9926997c8339545fb8eE32eDc6b76'; - const crCREAM = '0x892B14321a4FCba80669aE30Bd0cd99a7ECF6aC0'; - const cryUSD = '0x4EE15f44c6F0d8d1136c83EfD2e8E4AC768954c6'; - const CRETH2 = '0xcBc1065255cBc3aB41a6868c22d1f1C573AB89fd'; +/*================================================== +Settings +==================================================*/ + +const wETH = ADDRESSES.ethereum.WETH; +const usdt = ADDRESSES.ethereum.USDT; +const yyCrv = '0x5dbcF33D8c2E976c6b560249878e6F1491Bca25c'; +const yETH = '0xe1237aA7f535b0CC33Fd973D66cBf830354D16c7'; +const crYFI = '0xCbaE0A83f4f9926997c8339545fb8eE32eDc6b76'; +const crCREAM = '0x892B14321a4FCba80669aE30Bd0cd99a7ECF6aC0'; +const cryUSD = '0x4EE15f44c6F0d8d1136c83EfD2e8E4AC768954c6'; +const CRETH2 = '0xcBc1065255cBc3aB41a6868c22d1f1C573AB89fd'; /*================================================== TVL ==================================================*/ - function isCrToken(address) { - const crTokens = [crYFI, crCREAM, cryUSD]; - return crTokens.includes(address); - } - - async function tvl(timestamp, block) { - let balances = { - '0x0000000000000000000000000000000000000000': '0', // ETH - }; - - let poolLogs = (await Promise.all([ - sdk.api.util.getLogs({ - target: '0xf8062Eedf80D8D2527cE89435f670cb996aB4e54', +function isCrToken(address) { + const crTokens = [crYFI, crCREAM, cryUSD]; + return crTokens.includes(address); +} + +async function tvl(timestamp, block, _, { api }) { + let balances = { + [ADDRESSES.null]: '0', // ETH + }; + + let poolLogs = (await Promise.all([ + getLogs({ + api, + target: '0xf8062Eedf80D8D2527cE89435f670cb996aB4e54', + topic: 'LOG_NEW_POOL(address,address)', + fromBlock: 10815298, + }), + + block >= 11053389 ? + getLogs({ + api, + target: '0x136d6F80Bb3A853D151686BFED2c9309Aea6dDec', topic: 'LOG_NEW_POOL(address,address)', - keys: ['topics'], - fromBlock: 10815298, - toBlock: block - }), - - block >= 11053389 ? - sdk.api.util.getLogs({ - target: '0x136d6F80Bb3A853D151686BFED2c9309Aea6dDec', - topic: 'LOG_NEW_POOL(address,address)', - keys: ['topics'], - fromBlock: 11053389, - toBlock: block - }) : Promise.resolve({ output: [] }), - - block >= 11099537 ? - sdk.api.util.getLogs({ + fromBlock: 11053389, + }) : Promise.resolve( []), + + block >= 11099537 ? + getLogs({ + api, target: '0x0d3303Ffaf107cD732396570Bf07b2dbd79B619f', topic: 'LOG_NEW_POOL(address,address)', - keys: ['topics'], fromBlock: 11099537, - toBlock: block - }) : Promise.resolve({ output: []}) - ])).reduce((pools, subPools) => { - let p = pools; - p.output.push(...subPools.output); - return p; + }) : Promise.resolve([]) + ])).reduce((pools, subPools) => { + pools.push(...subPools); + return pools; + }, []) + + let poolCalls = []; + + let pools = poolLogs.map((poolLog) => { + return `0x${poolLog.topics[2].slice(26)}` + }); + + const poolTokenData = (await sdk.api.abi.multiCall({ + calls: pools.map((poolAddress) => ({ target: poolAddress })), + abi: abi.getCurrentTokens, + })).output; + + poolTokenData.forEach((poolToken) => { + let poolTokens = poolToken.output; + let poolAddress = poolToken.input.target; + + poolTokens.forEach((token) => { + poolCalls.push({ + target: token, + params: poolAddress, + }); }) - - let poolCalls = []; - - let pools = poolLogs.output.map((poolLog) => { - return `0x${poolLog[2].slice(26)}` - }); - - const poolTokenData = (await sdk.api.abi.multiCall({ - calls: pools.map((poolAddress) => ({ target: poolAddress })), - abi: abi.getCurrentTokens, - })).output; - - poolTokenData.forEach((poolToken) => { - let poolTokens = poolToken.output; - let poolAddress = poolToken.input.target; - - poolTokens.forEach((token) => { - poolCalls.push({ - target: token, - params: poolAddress, - }); - }) + }); + + let poolBalances = (await sdk.api.abi.multiCall({ + block, + calls: poolCalls, + abi: 'erc20:balanceOf' + })).output; + + poolBalances.forEach((balanceOf) => { + let balance = balanceOf.output; + let address = balanceOf.input.target; + + if (BigNumber(balance).toNumber() <= 0) { + return; + } + + balances[address] = BigNumber(balances[address] || 0).plus(balance).toFixed(); + }); + + let underlyingBalanceCalls = []; + let underlyingAddressCalls = []; + poolBalances.filter((poolBalance) => isCrToken(poolBalance.input.target)).forEach(pooBalance => { + underlyingBalanceCalls.push({ + target: pooBalance.input.target, + params: pooBalance.input.params, }); - - let poolBalances = (await sdk.api.abi.multiCall({ - block, - calls: poolCalls, - abi: 'erc20:balanceOf' - })).output; - - poolBalances.forEach((balanceOf) => { - let balance = balanceOf.output; - let address = balanceOf.input.target; - - if (BigNumber(balance).toNumber() <= 0) { - return; - } - - balances[address] = BigNumber(balances[address] || 0).plus(balance).toFixed(); - }); - - let underlyingBalanceCalls = []; - let underlyingAddressCalls = []; - poolBalances.filter((poolBalance) => isCrToken(poolBalance.input.target)).forEach(pooBalance => { - underlyingBalanceCalls.push({ - target: pooBalance.input.target, - params: pooBalance.input.params, - }); - underlyingAddressCalls.push({ - target: pooBalance.input.target, - params: [], - }) + underlyingAddressCalls.push({ + target: pooBalance.input.target, + params: [], }) + }) - let [underlyingBalances, underlyingAddress, yVaultPrices, yCrvPrice] = await Promise.all([ - sdk.api.abi.multiCall({ - block, - calls: underlyingBalanceCalls, - abi: abi['balanceOfUnderlying'] - }), - sdk.api.abi.multiCall({ - block, - calls: underlyingAddressCalls, - abi: abi['underlying'] - }), - sdk.api.abi.multiCall({ - block, - calls: [{target: yETH}, {target: yyCrv}], - abi: abi['getPricePerFullShare'], - }), - sdk.api.abi.call({ - block, - target: '0x45F783CCE6B7FF23B2ab2D70e416cdb7D6055f51', - params: [], - abi: abi['get_virtual_price'] - }) - ]); - - underlyingBalances = underlyingBalances.output; - underlyingAddress = underlyingAddress.output; - yVaultPrices = yVaultPrices.output; - yCrvPrice = yCrvPrice.output; - - // convert cTokens into underlying tokens - underlyingBalances.forEach((underlying, i) => { - let balance = underlying.output; - let address = underlyingAddress[i].output; - let cAddress = underlying.input.target; - balances[address] = balance; - delete balances[cAddress]; + let [underlyingBalances, underlyingAddress, yVaultPrices, yCrvPrice] = await Promise.all([ + sdk.api.abi.multiCall({ + block, + calls: underlyingBalanceCalls, + abi: abi['balanceOfUnderlying'], + permitFailure: true, + }), + sdk.api.abi.multiCall({ + block, + calls: underlyingAddressCalls, + abi: abi['underlying'] + }), + sdk.api.abi.multiCall({ + block, + calls: [{ target: yETH }, { target: yyCrv }], + abi: abi['getPricePerFullShare'], + }), + sdk.api.abi.call({ + block, + target: '0x45F783CCE6B7FF23B2ab2D70e416cdb7D6055f51', + params: [], + abi: abi['get_virtual_price'] }) - - // convert vault tokens into underlying values - poolBalances.forEach((balanceOf, i) => { - let balance = balanceOf.output; - let address = balanceOf.input.target; - - if (BigNumber(balance).toNumber() <= 0) { - return; - } - // assume CRETH2:ETH = 1:1 - if (address === CRETH2) { - balances[wETH] = BigNumber(balances[wETH] || 0).plus(balances[CRETH2]).toFixed(); - delete balances[CRETH2]; - } else if (address === yyCrv) { - const yyCrvCash = BigNumber(balance).multipliedBy(yCrvPrice).div(1e18).div(1e12).multipliedBy(yVaultPrices[1].output).div(1e18).integerValue(); - balances[usdt] = BigNumber(balances[usdt] || 0).plus(yyCrvCash).toFixed(); - delete balances[yyCrv]; - } else { - balances[address] = BigNumber(balances[address] || 0).plus(balance).toFixed(); - } - }); - return balances; - } + ]); + + underlyingBalances = underlyingBalances.output; + underlyingAddress = underlyingAddress.output; + yVaultPrices = yVaultPrices.output; + yCrvPrice = yCrvPrice.output; + + // convert cTokens into underlying tokens + underlyingBalances.forEach((underlying, i) => { + let balance = underlying.output; + let address = underlyingAddress[i].output; + let cAddress = underlying.input.target; + balances[address] = balance; + delete balances[cAddress]; + }) + + // convert vault tokens into underlying values + poolBalances.forEach((balanceOf, i) => { + let balance = balanceOf.output; + let address = balanceOf.input.target; + + if (BigNumber(balance).toNumber() <= 0) { + return; + } + // assume CRETH2:ETH = 1:1 + if (address === CRETH2) { + balances[wETH] = BigNumber(balances[wETH] || 0).plus(balances[CRETH2]).toFixed(); + delete balances[CRETH2]; + } else if (address === yyCrv) { + const yyCrvCash = BigNumber(balance).multipliedBy(yCrvPrice).div(1e18).div(1e12).multipliedBy(yVaultPrices[1].output).div(1e18).integerValue(); + balances[usdt] = BigNumber(balances[usdt] || 0).plus(yyCrvCash).toFixed(); + delete balances[yyCrv]; + } else { + balances[address] = BigNumber(balances[address] || 0).plus(balance).toFixed(); + } + }); + return balances; +} /*================================================== Exports ==================================================*/ - module.exports = { - start: 1599552000, // 09/08/2020 @ 8:00am (UTC) - ethereum: { tvl } - } +module.exports = { + start: 1599552000, // 09/08/2020 @ 8:00am (UTC) + ethereum: { tvl } +} diff --git a/projects/creditum/abi.json b/projects/creditum/abi.json index 08b40b97c1d..7c1d075b559 100644 --- a/projects/creditum/abi.json +++ b/projects/creditum/abi.json @@ -1,15 +1,3 @@ { - "token": { - "inputs": [], - "name": "token", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } + "token": "address:token" } \ No newline at end of file diff --git a/projects/creditum/helper.js b/projects/creditum/helper.js index 423e54fd0a4..3e70d309c53 100644 --- a/projects/creditum/helper.js +++ b/projects/creditum/helper.js @@ -1,7 +1,6 @@ const abi = require('./abi.json') const sdk = require('@defillama/sdk') const BigNumber = require('bignumber.js'); -const getPricePerShare = require('../helper/abis/getPricePerShare.json') async function handleYearnTokens(balances, tokens, owner, block, chain, transform) { let balance = ( @@ -20,7 +19,7 @@ async function handleYearnTokens(balances, tokens, owner, block, chain, transfor calls: tokens.map((p) => ({ target: p, })), - abi: getPricePerShare[1], + abi: "uint256:pricePerShare", block, chain, }) diff --git a/projects/creditum/index.js b/projects/creditum/index.js index 501c0fb0cff..8622d2cad5a 100644 --- a/projects/creditum/index.js +++ b/projects/creditum/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { stakingPricedLP } = require("../helper/staking"); const { sumTokensSharedOwners } = require("../helper/unwrapLPs"); const { pool2 } = require("../helper/pool2"); @@ -9,11 +10,11 @@ async function tvl(time, ethBlock, chainBlocks){ const chain = 'fantom' const block = chainBlocks[chain] const balances = {} - const transform = addr=> addr==="0x8d11ec38a3eb5e956b052f67da8bdc9bef8abf3e"?"0x6b175474e89094c44da98b954eedeac495271d0f":`${chain}:${addr}` + const transform = addr=> addr===ADDRESSES.fantom.DAI?[ADDRESSES.ethereum.DAI]:`${chain}:${addr}` await sumTokensSharedOwners(balances, [ - "0x04068da6c83afcfa0e13ba15a6696662335d5b75", - "0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83", - "0x8d11ec38a3eb5e956b052f67da8bdc9bef8abf3e", + ADDRESSES.fantom.USDC, + ADDRESSES.fantom.WFTM, + ADDRESSES.fantom.DAI, "0x321162Cd933E2Be498Cd2267a90534A804051b11", "0x74b23882a30290451A17c44f4F05243b6b58C76d" ], [lending], block, chain, transform) diff --git a/projects/credix/credix.json b/projects/credix/credix.json deleted file mode 100644 index db7013fd9c8..00000000000 --- a/projects/credix/credix.json +++ /dev/null @@ -1,185 +0,0 @@ -{ - "version": "2.0.1", - "name": "credix", - "instructions": [], - "accounts": [ - { - "name": "Deal", - "type": { - "kind": "struct", - "fields": [ - { - "name": "name", - "type": "string" - }, - { - "name": "borrower", - "type": "publicKey" - }, - { - "name": "amountWithdrawn", - "type": "u64" - }, - { - "name": "lateFeePercentage", - "type": { - "defined": "Fraction" - } - }, - { - "name": "earlyRedemptionFees", - "type": "u64" - }, - { - "name": "earlyRedemptionFeesRepaid", - "type": "u64" - }, - { - "name": "unusedField1", - "type": "u16" - }, - { - "name": "goLiveAt", - "type": "i64" - }, - { - "name": "createdAt", - "type": "i64" - }, - { - "name": "maxFundingDuration", - "type": "u8" - }, - { - "name": "slashInterestToPrincipal", - "type": "bool" - }, - { - "name": "slashPrincipalToInterest", - "type": "bool" - }, - { - "name": "unusedField2", - "type": { - "array": ["u8", 6] - } - }, - { - "name": "dealNumber", - "type": "u16" - }, - { - "name": "bump", - "type": "u8" - }, - { - "name": "lateFees", - "type": "u64" - }, - { - "name": "lateFeesRepaid", - "type": "u64" - }, - { - "name": "defaulted", - "type": "bool" - }, - { - "name": "trueWaterfall", - "type": "bool" - }, - { - "name": "openedAt", - "type": "i64" - }, - { - "name": "interestFee", - "type": { - "defined": "Fraction" - } - } - ] - } - }, - { - "name": "RepaymentSchedule", - "type": { - "kind": "struct", - "fields": [ - { - "name": "periodDuration", - "type": "u8" - }, - { - "name": "daysInYear", - "type": "u16" - }, - { - "name": "totalPeriods", - "type": "u16" - }, - { - "name": "periods", - "type": { - "vec": { - "defined": "RepaymentPeriod" - } - } - } - ] - } - } - ], - "types": [ - { - "name": "Fraction", - "type": { - "kind": "struct", - "fields": [ - { - "name": "numerator", - "type": "u32" - }, - { - "name": "denominator", - "type": "u32" - } - ] - } - }, - { - "name": "RepaymentPeriod", - "type": { - "kind": "struct", - "fields": [ - { - "name": "principal", - "type": "u64" - }, - { - "name": "interest", - "type": "u64" - }, - { - "name": "totalInterestExpected", - "type": "u64" - }, - { - "name": "totalPrincipalExpected", - "type": "u64" - }, - { - "name": "principalRepaid", - "type": "u64" - }, - { - "name": "interestRepaid", - "type": "u64" - } - ] - } - } - ], - "events": [], - "errors": [] -} diff --git a/projects/credix/index.js b/projects/credix/index.js index 54c1290b4e7..8557b9ccd38 100644 --- a/projects/credix/index.js +++ b/projects/credix/index.js @@ -1,17 +1,17 @@ -const BigNumber = require("bignumber.js"); +const ADDRESSES = require("../helper/coreAssets.json"); const { PublicKey } = require("@solana/web3.js"); -const { Program, utils } = require("@project-serum/anchor"); -const { getProvider, sumTokens2 } = require("../helper/solana"); +const { Program, utils,} = require("@project-serum/anchor"); +const { getProvider, sumTokens2, } = require("../helper/solana"); -const MAX_NUMBER_OF_ACCOUNT_INFOS = 99; -const MARKET_SEED = "credix-marketplace"; -const IDL = require("./credix.json"); -const USDC = 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v' +const MARKET_SEED_FINTECH = "credix-marketplace"; +const MARKET_SEED_RECEIVABLES = "receivables-factoring"; +const USDC = ADDRESSES.solana.USDC; const programId = new PublicKey("CRDx2YkdtYtGZXGHZ59wNv1EwKHQndnRc1gT4p8i2vPX"); -const encodeSeedString = (seedString) => Buffer.from(utils.bytes.utf8.encode(seedString)); +const encodeSeedString = (seedString) => + Buffer.from(utils.bytes.utf8.encode(seedString)); const constructProgram = (provider) => { - return new Program(IDL, programId, provider); + return new Program(idl, programId, provider); }; const findPDA = async (seeds) => { @@ -29,159 +29,182 @@ const findSigningAuthorityPDA = async (globalMarketSeed) => { return findPDA(seeds); }; -async function generateRepaymentSchedulePDA(deal) { - const marketAdress = await findGlobalMarketStatePDA(MARKET_SEED); - const seed = [ - marketAdress[0].toBuffer(), - deal.publicKey.toBuffer(), - encodeSeedString("repayment-schedule"), - ]; - return PublicKey.findProgramAddress(seed, programId); -} - -function periodIsRepaid(period) { - const principal = period.principal; - const principalRepaid = period.principalRepaid; - const interest = period.interest; - const interestRepaid = period.interestRepaid; - - return principal === principalRepaid && interest === interestRepaid; -} - -function isRepaid(schedule) { - return schedule.periods.every((period) => periodIsRepaid(period)); -} - -function openedAt(deal) { - const openedAt = deal.openedAt; - return openedAt.bitLength() > 53 ? null : openedAt.toNumber(); -} - -function goLiveAt(deal) { - const goLiveAt = deal.goLiveAt; - return goLiveAt.bitLength() > 53 ? null : goLiveAt.toNumber(); -} - -function status(deal, schedule) { - if (!schedule) { - return "NO SCHEDULE FOUND"; - } - if (deal.defaulted) { - return "DEFAULTED"; - } - - if (!openedAt(deal)) { - return "PENDING"; - } - - if (!goLiveAt(deal)) { - return "OPEN_FOR_FUNDING"; - } - - if (isRepaid(schedule)) { - return "CLOSED"; - } - - return "IN_PROGRESS"; -} - -function isInProgress(deal, schedule) { - const dealStatus = status(deal.account, schedule); - return dealStatus === "IN_PROGRESS"; -} - -function totalPrincipal(repaymentSchedule) { - return new BigNumber( - repaymentSchedule.periods[ - repaymentSchedule.periods.length - 1 - ].totalPrincipalExpected.toString() +async function tvl() { + // Fintech pool + const [signingAuthorityKeyFintech] = await findSigningAuthorityPDA( + MARKET_SEED_FINTECH ); -} -function principalRepaid(repaymentSchedule) { - const cumulPrincipalRepaid = repaymentSchedule.periods.reduce( - (acc, p) => acc.plus(new BigNumber(p.principalRepaid.toString())), - new BigNumber(0) + // Receivables factoring pool + const [signingAuthorityKeyReceivables] = await findSigningAuthorityPDA( + MARKET_SEED_RECEIVABLES ); - - return cumulPrincipalRepaid; -} - -function chunk(inputArray, perChunk) { - const result = inputArray.reduce((resultArray, item, index) => { - const chunkIndex = Math.floor(index / perChunk); - - if (!resultArray[chunkIndex]) { - resultArray[chunkIndex] = []; // start a new chunk - } - - resultArray[chunkIndex].push(item); - - return resultArray; - }, []); - - return result; + const tokens = await sumTokens2({ + tokensAndOwners: [ + [USDC, signingAuthorityKeyFintech], + [USDC, signingAuthorityKeyReceivables], + ], + }); + return tokens; } -async function fetchRepaymentScheduleForDeals(program, provider, deals) { - const pdaPromises = deals.map((d) => generateRepaymentSchedulePDA(d)); - const pdas = await Promise.all(pdaPromises); - const addresses = pdas.map((pda) => pda[0]); - const addressesChunks = chunk(addresses, MAX_NUMBER_OF_ACCOUNT_INFOS - 1); - const accountInfosChunks = await Promise.all( - addressesChunks.map((addressChunk) => { - const accInfos = - provider.connection.getMultipleAccountsInfo(addressChunk); - return accInfos; - }) - ); - const accountInfos = accountInfosChunks.flat(); +module.exports = { + timetravel: false, + solana: { + tvl, + borrowed, + }, +}; - const programVersions = accountInfos.map( - (accountInfo) => - accountInfo && - program.coder.accounts.decode("RepaymentSchedule", accountInfo.data) - ); - return programVersions; -} +async function borrowed(_, _b, _cb, { api, }) { + + const provider = getProvider(); + const program = constructProgram(provider); + const states = await program.account.globalMarketState.all(); -async function tvl() { - const [signingAuthorityKey] = await findSigningAuthorityPDA(MARKET_SEED); - return sumTokens2({ tokensAndOwners: [[USDC, signingAuthorityKey]] }); + states.forEach(({ account }) => { + api.add(account.baseTokenMint.toBase58(), account.poolOutstandingCredit.toString()) + }) } -async function borrowed() { +async function tvl1(_, _b, _cb, { api, }) { + const provider = getProvider(); const program = constructProgram(provider); - const allDeals = await program.account.deal.all(); - const allRepaymentSchedules = await fetchRepaymentScheduleForDeals( - program, - provider, - allDeals - ); - const inProgressSchedules = allDeals.map((deal, index) => { - const schedule = allRepaymentSchedules[index]; - const dealIsInProgress = isInProgress(deal, schedule); - return dealIsInProgress ? schedule : null; - }); + const states = await program.account.globalMarketState.all(); - const totalOutstandingCredit = inProgressSchedules - .filter((schedule) => schedule !== null) - .reduce((principalSum, schedule) => { - return principalSum - .plus(totalPrincipal(schedule)) - .minus(principalRepaid(schedule)); - }, new BigNumber(0)); - - return { - ['solana:' + USDC]: totalOutstandingCredit.toString() - }; + const tokenAccounts = states.map(({ account }) => account.treasuryPoolTokenAccount.toBase58()) + return sumTokens2({ tokenAccounts }) } -module.exports = { - timetravel: false, - solana: { - tvl, - borrowed, - }, -}; +const idl = { + version: '3.11.0', + name: 'credix', + instructions: [], + accounts: [{ + name: 'globalMarketState', + type: { + kind: 'struct', + fields: [ + { + name: 'baseTokenMint', + type: 'publicKey' + }, + { + name: 'lpTokenMint', + type: 'publicKey' + }, + { + name: 'poolOutstandingCredit', + docs: [ + 'The amount from senior tranche lent' + ], + type: 'u64' + }, + { + name: 'treasuryPoolTokenAccount', + type: 'publicKey' + }, + { + name: 'signingAuthorityBump', + type: 'u8' + }, + { + name: 'bump', + type: 'u8' + }, + { + name: 'credixFeePercentage', + type: { + defined: 'Fraction' + } + }, + { + name: 'withdrawalFee', + docs: [ + 'The fee charged for withdrawals' + ], + type: { + defined: 'Fraction' + } + }, + { + name: 'frozen', + type: 'bool' + }, + { + name: 'seed', + type: 'string' + }, + { + name: 'poolSizeLimitPercentage', + docs: [ + 'Maximum possible deposit limit in addition the pool outstanding credit', + 'pool_size_limit = pool_outstanding_credit + pool_size_limit_percentage * pool_outstanding_credit' + ], + type: { + defined: 'Fraction' + } + }, + { + name: 'withdrawEpochRequestSeconds', + type: 'u32' + }, + { + name: 'withdrawEpochRedeemSeconds', + type: 'u32' + }, + { + name: 'withdrawEpochAvailableLiquiditySeconds', + type: 'u32' + }, + { + name: 'latestWithdrawEpochIdx', + type: 'u32' + }, + { + name: 'latestWithdrawEpochEnd', + type: 'i64' + }, + { + name: 'lockedLiquidity', + type: 'u64' + }, + { + name: 'totalRedeemedBaseAmount', + type: 'u64' + }, + { + name: 'hasWithdrawEpochs', + type: 'bool' + }, + { + name: 'redeemAuthorityBump', + docs: [ + 'This is only used for wormhole related token transfer occurs.' + ], + type: 'u8' + } + ] + } + }], + types: [ + { + name: 'Fraction', + type: { + kind: 'struct', + fields: [ + { + name: 'numerator', + type: 'u32' + }, + { + name: 'denominator', + type: 'u32' + } + ] + } + }], + events: [], + errors: [ ] +} \ No newline at end of file diff --git a/projects/crescentswap/index.js b/projects/crescentswap/index.js new file mode 100644 index 00000000000..10eb3aea867 --- /dev/null +++ b/projects/crescentswap/index.js @@ -0,0 +1,6 @@ +const { uniV3Export } = require("../helper/uniswapV3"); + +module.exports = uniV3Export({ + arbitrum: { factory: "0x8219904A8683d06e38605276baCBf2D29aa764DD", fromBlock: 91137559, }, + base: { factory: "0x3539dA2AdB3f8311D203D334f25f7Bee604A5c50", fromBlock: 1979234, }, +}); diff --git a/projects/croblanc/abi.json b/projects/croblanc/abi.json index e1eebe018d3..791e6c848c4 100644 --- a/projects/croblanc/abi.json +++ b/projects/croblanc/abi.json @@ -1,41 +1,5 @@ { - "getFarms": { - "inputs": [], - "name": "getFarms", - "outputs": [ - { - "internalType": "address[]", - "name": "", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - "want": { - "inputs": [], - "name": "want", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "stakedWant": { - "inputs": [], - "name": "stakedWant", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } + "getFarms": "address[]:getFarms", + "want": "address:want", + "stakedWant": "uint256:stakedWant" } \ No newline at end of file diff --git a/projects/croblanc/index.js b/projects/croblanc/index.js index 6a0a6e28eb1..7cb747f4c93 100644 --- a/projects/croblanc/index.js +++ b/projects/croblanc/index.js @@ -1,13 +1,9 @@ const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); -const { staking } = require("../helper/staking"); const { pool2 } = require("../helper/pool2"); const { unwrapUniswapLPs, } = require("../helper/unwrapLPs"); const { getChainTransform } = require('../helper/portedTokens') -const treasury = "0xb20234c33337537111f4ab6f5EcaD400134aC143"; -const WCRO = "0x5c7f8a570d578ed84e63fdfa7b1ee72deae1ae23"; - const croblancAlpha = "0x52a87ef19e4a0E8cc70aE69D22bc8254bc6fa0F9"; const pool2Farm = "0x4c1EC4Bf75CdFAF9b172e94cc85b7a8eA647F267"; @@ -49,7 +45,6 @@ const cronosTvl = async (_, _b, chainBlocks) => { module.exports = { misrepresentedTokens: true, cronos: { - treasury: staking(treasury, WCRO, "cronos"), pool2: pool2(pool2Farm, WCRO_CROBLANC_CronaLP[0], "cronos"), tvl: cronosTvl, }, diff --git a/projects/cron-fi/index.js b/projects/cron-fi/index.js new file mode 100644 index 00000000000..d3fd46320d2 --- /dev/null +++ b/projects/cron-fi/index.js @@ -0,0 +1,25 @@ +const { getLogs } = require('../helper/cache/getLogs') +const { sumTokens2 } = require('../helper/unwrapLPs') + +const config = { + ethereum: { factory: '0xD64c9CD98949C07F3C85730a37c13f4e78f35E77', fromBlock: 17008730, } +} + +module.exports = {}; + +Object.keys(config).forEach(chain => { + const { factory, fromBlock } = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const logs = await getLogs({ + api, + target: factory, + topics: ['0xaeff84bd0403e2418c457955d4258f28133c5b304b671114fc854725bb098bee'], + eventAbi: 'event CronV1PoolCreated (address indexed pool, address indexed token0, address indexed token1, uint8 poolType)', + onlyArgs: true, + fromBlock, + }) + return sumTokens2({ api, ownerTokens: logs.map(i => [[i.token0, i.token1], i.pool]) }) + } + } +}) \ No newline at end of file diff --git a/projects/cronaswap/index.js b/projects/cronaswap/index.js index 6629b55b9bb..bd16746ac99 100644 --- a/projects/cronaswap/index.js +++ b/projects/cronaswap/index.js @@ -6,7 +6,6 @@ module.exports={ methodology: "Factory address (0x73A48f8f521EB31c55c0e1274dB0898dE599Cb11) is used to find the LP pairs. TVL is equal to the liquidity on the AMM, while staking is the amount of CRONA tokens found in the Masterchef(0x77ea4a4cF9F77A034E4291E8f457Af7772c2B254).", cronos: { tvl: getUniTVL({ - chain: 'cronos', factory: '0x73A48f8f521EB31c55c0e1274dB0898dE599Cb11', useDefaultCoreAssets: true, blacklist: [ diff --git a/projects/crosschainbridge/index.js b/projects/crosschainbridge/index.js index 4ae85c47eb1..e6049c92150 100644 --- a/projects/crosschainbridge/index.js +++ b/projects/crosschainbridge/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const BigNumber = require("bignumber.js"); @@ -32,13 +33,13 @@ const tokens = { TXL: "0x8eEF5a82E6Aa222a60F009ac18c24EE12dBf4b41", BRIDGE: "0x92868a5255c628da08f550a858a802f5351c5223", // Stablecoins - BUSD: "0x4Fabb145d64652a948d72533023f6E7A623C7C53", - DAI: "0x6b175474e89094c44da98b954eedeac495271d0f", - USDC: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", - USDT: "0xdac17f958d2ee523a2206206994597c13d831ec7", + BUSD: ADDRESSES.ethereum.BUSD, + DAI: ADDRESSES.ethereum.DAI, + USDC: ADDRESSES.ethereum.USDC, + USDT: ADDRESSES.ethereum.USDT, // Network Tokens - WETH: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", - WMATIC: "0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0", + WETH: ADDRESSES.ethereum.WETH, + WMATIC: ADDRESSES.ethereum.MATIC, // Further tokens BULK: "0xa143ac515dca260a46c742c7251ef3b268639593", DAX: "0x77e9618179820961ee99a988983bc9ab41ff3112", @@ -57,12 +58,12 @@ const tokens = { TXL: "0x1ffd0b47127fdd4097e54521c9e2c7f0d66aafc5", BRIDGE: "0x92868a5255c628da08f550a858a802f5351c5223", // Stablecoins - BUSD: "0xe9e7cea3dedca5984780bafc599bd69add087d56", + BUSD: ADDRESSES.bsc.BUSD, DAI: "0x1af3f329e8be154074d8769d1ffa4ee058b1dbc3", - USDC: "0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d", - USDT: "0x55d398326f99059fF775485246999027B3197955", + USDC: ADDRESSES.bsc.USDC, + USDT: ADDRESSES.bsc.USDT, // Network Tokens - WETH: "0x2170ed0880ac9a755fd29b2688956bd959f933f8", + WETH: ADDRESSES.bsc.ETH, WMATIC: "0xcc42724c6683b7e57334c4e856f4c9965ed682bd", // Further tokens ARNX: "0x0c37bcf456bc661c14d596683325623076d7e283", @@ -90,12 +91,12 @@ const tokens = { BRIDGE: "0x92868a5255c628da08f550a858a802f5351c5223", // Stablecoins BUSD: "0xdab529f40e671a1d4bf91361c21bf9f0c9712ab7", - DAI: "0x8f3cf7ad23cd3cadbd9735aff958023239c6a063", - USDC: "0x2791bca1f2de4661ed88a30c99a7a9449aa84174", - USDT: "0xc2132d05d31c914a87c6611c10748aeb04b58e8f", + DAI: ADDRESSES.polygon.DAI, + USDC: ADDRESSES.polygon.USDC, + USDT: ADDRESSES.polygon.USDT, // Network Tokens - WETH: "0x7ceb23fd6bc0add59e62ac25578270cff1b9f619", - WMATIC: "0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270", + WETH: ADDRESSES.polygon.WETH_1, + WMATIC: ADDRESSES.polygon.WMATIC_2, // Further tokens DAF: "0x2f0e07e881363bb1cdff32971b2f8c87ef8ff432", GFX: "0x65ad6a2288b2dd23e466226397c8f5d1794e58fc", @@ -106,17 +107,17 @@ const tokens = { // Project tokens BRIDGE: "0xC0367f9b1f84Ca8DE127226AC2A994EA4bf1e41b", // Stablecoins - USDC: "0xA7D7079b0FEaD91F3e65f86E8915Cb59c1a4C664", - USDT: "0xc7198437980c041c805a1edcba50c1ce5db95118", + USDC: ADDRESSES.avax.USDC_e, + USDT: ADDRESSES.avax.USDT_e, // Network Tokens - WETH: "0x49d5c2bdffac6ce2bfdb6640f4f80f226bc10bab", + WETH: ADDRESSES.avax.WETH_e, }, fantom: { // Project tokens BRIDGE: "0x92868A5255C628dA08F550a858A802f5351C5223", // Stablecoins - USDC: "0x04068DA6C83AFCFA0e13ba15A6696662335D5B75", - USDT: "0x049d68029688eabf473097a2fc38ef61633a3c7a", + USDC: ADDRESSES.fantom.USDC, + USDT: ADDRESSES.fantom.fUSDT, // Network Tokens WETH: "0x74b23882a30290451A17c44f4F05243b6b58C76d", } diff --git a/projects/croswap/index.js b/projects/croswap/index.js new file mode 100644 index 00000000000..983df3793d2 --- /dev/null +++ b/projects/croswap/index.js @@ -0,0 +1,47 @@ +const { staking } = require("../helper/staking"); +const { getLogs, getAddress } = require('../helper/cache/getLogs'); +const { transformDexBalances } = require("../helper/portedTokens"); +const { cachedGraphQuery } = require('../helper/cache') + +module.exports = { + misrepresentedTokens: true, +} + +async function tvl(_, _b, _cb, { api, }) { + const { factory, fromBlock } = config[api.chain] + let pools + + if (api.chain === 'cronos') { + const data = await cachedGraphQuery('croswap/cronos', 'https://graph.croswap.com/subgraphs/name/croswap/croswap-v2', `{ pairInfos { pair { id}}}`) + pools = data.pairInfos.map(i => i.pair.id) + } else { + + const logs = await getLogs({ + api, + target: factory, + topics: ['0x0d3648bd0f6ba80134a33ba9275ac585d9d315f0ad8355cddefde31afa28d0e9'], + fromBlock, + }) + pools = logs.map(i => getAddress(i.data.slice(0, 64 + 2))) + } + const token0s = await api.multiCall({ abi: 'address:token0', calls: pools }) + const token1s = await api.multiCall({ abi: 'address:token1', calls: pools }) + const reserves = await api.multiCall({ abi: 'function getReserves() view returns (uint112, uint112, uint32)', calls: pools }) + const data = reserves.map(([token0Bal, token1Bal], i) => ({ token0Bal, token1Bal, token1: token1s[i], token0: token0s[i] })) + return transformDexBalances({ ...api, data, }) +} + +const config = { + arbitrum: { factory: '0x8f6ecb066f2bfe31bf87e022c76f63bc4642d8bc', fromBlock: 82954506, stakingContracts: ['0x8e9DA87f58A8480dD6b8878Aa37144a5Fb2F122D'], cros: '0x780469101caBD2bFe4B596D98d4777C2a142e012' }, + cronos: { factory: '0x4ae2bd26e60741890edb9e5c7e984bb396ec26e3', fromBlock: 4807004, stakingContracts: ['0xedfe968033fd2b9a98371d052cd7f32a711e533a'], cros: '0x1Ba477CA252C0FF21c488d41759795E7E7812aB4' }, +} + +module.exports = { +}; + +Object.keys(config).forEach(chain => { + const { stakingContracts, cros, } = config[chain] + module.exports[chain] = { + tvl, staking: staking(stakingContracts, cros) + } +}) \ No newline at end of file diff --git a/projects/crowdswap/index.js b/projects/crowdswap/index.js new file mode 100644 index 00000000000..101bca241e5 --- /dev/null +++ b/projects/crowdswap/index.js @@ -0,0 +1,38 @@ +const { sumTokensExport, sumTokens2, } = require("../helper/unwrapLPs"); +const { getLogs, getAddress } = require('../helper/cache/getLogs'); + +const polygonStakingContracts = '0x3C868fe859eF46a133e032f22B443e6Efd617449'; +const bscStakingContracts = '0x21224834612ecaC194c4b877b49e7794f193d2A2'; +const CROWD = "0x483dd3425278C1f79F377f1034d9d2CaE55648B6"; +const BscCROWD = "0xA5d4B64a639d93b660cdA04D331374dA1108F8f5"; + +async function tvl(_, _b, _cb, { api, }) { + const { factory, fromBlock } = config[api.chain] + + const logs = await getLogs({ + api, + target: factory, + topics: ['0x0d3648bd0f6ba80134a33ba9275ac585d9d315f0ad8355cddefde31afa28d0e9'], + fromBlock, + }) + const pools = logs.map(i => getAddress(i.data.slice(0, 64 + 2))) + const token0s = await api.multiCall({ abi: 'address:token0', calls: pools }) + const token1s = await api.multiCall({ abi: 'address:token1', calls: pools }) + const tokensAndOwners = pools.map((pool, i) => [[token0s[i], pool], [token1s[i], pool]]).flat() + return sumTokens2({ api, tokensAndOwners }) +} + +const config = { + ethereum: { factory: '0xBeA843A2DC516c6F38F159a6a55e80Ec40Cf2286', fromBlock: 16882649, }, + arbitrum: { factory: '0x9ff74eea1e7f0f8ee437b70d68f7cdc1a1030642', fromBlock: 91681087, }, + polygon: { factory: '0xab7dac1daf712693539d770a967a9bc7ba47470c', fromBlock: 37984740, }, + bsc: { factory: '0x08f65111cb9b517b10e5c1e63cb2224467e7988a', fromBlock: 25927093, }, + era: { factory: '0x049D3809043d137591687170Fc323DBcDFe83283', fromBlock: 2714942, }, +} + +Object.keys(config).forEach(chain => { + module.exports[chain] = { tvl } +}) + +module.exports.polygon.staking = sumTokensExport({ owner: polygonStakingContracts, tokens: [CROWD] }) +module.exports.bsc.staking = sumTokensExport({ owner: bscStakingContracts, tokens: [BscCROWD] }) diff --git a/projects/crowfi/index.js b/projects/crowfi/index.js index aad481cbb44..2bb02842401 100644 --- a/projects/crowfi/index.js +++ b/projects/crowfi/index.js @@ -1,25 +1,6 @@ -const {calculateUniTvl} = require("../helper/calculateUniTvl"); +const {uniTvlExport} = require("../helper/unknownTokens"); const crow = "0x285c3329930a3fd3C7c14bC041d3E50e165b1517"; const factory = "0xDdcf30c1A85e5a60d85310d6b0D3952A75a00db4" -const translate = { - "0xfa9343c3897324496a05fc75abed6bac29f8a40f": "bsc:0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c", // BNB -} - -async function tvl (timestamp, block, chainBlocks) { - return await calculateUniTvl(addr=> { - addr = addr.toLowerCase() - if (translate[addr] !== undefined) { - return translate[addr]; - } - return `cronos:${addr}` - }, chainBlocks.cronos, "cronos", factory, 0, true); -} - -module.exports = { - methodology: "TVL in factory contract", - cronos: { - tvl - } -} \ No newline at end of file +module.exports = uniTvlExport ('cronos', factory, 'cronos') \ No newline at end of file diff --git a/projects/crown-finance/index.js b/projects/crown-finance/index.js index b4000e1f1b3..def99f5ec12 100644 --- a/projects/crown-finance/index.js +++ b/projects/crown-finance/index.js @@ -1,6 +1,9 @@ module.exports = { + hallmarks: [ + [1655582945, "Rug Pull"] + ], deadFrom: 1655582945, // we suspect that the project has rugged cronos: { tvl: () => ({}), diff --git a/projects/crust-finance/index.js b/projects/crust-finance/index.js new file mode 100644 index 00000000000..0436be8a00b --- /dev/null +++ b/projects/crust-finance/index.js @@ -0,0 +1,13 @@ +const { getUniTVL } = require("../helper/unknownTokens"); + +module.exports = { + misrepresentedTokens: true, + methodology: `Uses factory(0x62DbCa39067f99C9D788a253cB325c6BA50e51cE) address and whitelisted tokens address to find and price liquidity pool pairs`, + mantle: { + tvl: getUniTVL({ + factory: "0x62DbCa39067f99C9D788a253cB325c6BA50e51cE", + hasStablePools: true, + useDefaultCoreAssets: true, + }), + }, +}; diff --git a/projects/crv-usd/index.js b/projects/crv-usd/index.js new file mode 100644 index 00000000000..a0deab1cbdf --- /dev/null +++ b/projects/crv-usd/index.js @@ -0,0 +1,39 @@ +const { getLogs } = require('../helper/cache/getLogs') +const { sumTokens2 } = require('../helper/unwrapLPs') + +const config = { + ethereum: { + pools: [ + { factory: '0x818709b85052ddc521fae9c78737b27316337e3a', fromBlock: 17182152 }, + { factory: '0x30a2F3c3AA6D12C0a36Bed210dCF1B32EF6228Cc', fromBlock: 17187330 }, + { factory: '0xfa3e2db8eb6c646e0d24046c1a185934d41a8f7a', fromBlock: 17187330 }, + { factory: '0xC9332fdCB1C491Dcc683bAe86Fe3cb70360738BC', fromBlock: 17187330 }, + ] + }, +} + +module.exports = { +}; + + +Object.keys(config).forEach(chain => { + const { pools} = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const logs = await Promise.all(pools.map(getLogs_)) + + return sumTokens2({ api, tokensAndOwners: logs.flat().map(i => [i.collateral, i.amm]) }) + + async function getLogs_({ factory, fromBlock }) { + return getLogs({ + api, + target: factory, + topics: ['0xebbe0dfde9dde641808b7a803882653420f3a5b12bb405d238faed959e1e3aa3'], + eventAbi: 'event AddMarket (address indexed collateral, address controller, address amm, address monetary_policy, uint256 ix)', + onlyArgs: true, + fromBlock, + }) + } + } + } +}) diff --git a/projects/cryptex-finance/index.js b/projects/cryptex-finance/index.js index fe203c6f743..6b64a2ac244 100755 --- a/projects/cryptex-finance/index.js +++ b/projects/cryptex-finance/index.js @@ -1,6 +1,8 @@ -const sdk = require("@defillama/sdk"); -const { sumTokensSharedOwners} = require("../helper/unwrapLPs"); -const { staking } = require("../helper/staking"); +const { getLogs } = require('../helper/cache/getLogs') +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokens2, sumTokensExport, } = require("../helper/unwrapLPs"); +const { staking } = require('../helper/staking') +const { pool2 } = require('../helper/pool2') const ctxToken = "0x321c2fe4446c7c963dc41dd58879af648838f98d"; const factory = "0x70236b36f86AB4bd557Fe9934E1246537B472918"; @@ -15,20 +17,20 @@ const ethPool2s = [ "0x2A93167Ed63A31F35CA4788e2EB9fBd9fA6089D0", // CTX-WETH ] const ethVaults = [ - "0x717170b66654292dfbd89c39f5ae6753d2ac1381", // WETH VAULT - "0x443366a7a5821619D8d57405511E4fadD9964771", // DAI VAULT - // Hardmode Vaults - "0xc2Ba6B8E0EE3cf48B045D966F1dCda767df74833", // WETH VAULT - "0xA5b3Bb6e1f206624B3B8CE0c6A0f7614fd35Fa03", // DAI VAULT - "0xa8CcA36A624215a39D5af6854ac24868559424d3", // USDC VAULT - "0x2364536F4891Ed560A6728f4B36871de8176eE5c", // WBTC VAULT + "0x717170b66654292dfbd89c39f5ae6753d2ac1381", // WETH VAULT + "0x443366a7a5821619D8d57405511E4fadD9964771", // DAI VAULT + // Hardmode Vaults + "0xc2Ba6B8E0EE3cf48B045D966F1dCda767df74833", // WETH VAULT + "0xA5b3Bb6e1f206624B3B8CE0c6A0f7614fd35Fa03", // DAI VAULT + "0xa8CcA36A624215a39D5af6854ac24868559424d3", // USDC VAULT + "0x2364536F4891Ed560A6728f4B36871de8176eE5c", // WBTC VAULT ] const ethCollaterals = [ - "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", // WETH - "0x6B175474E89094C44Da98b954EedeAC495271d0F", // DAI - "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC - "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", // WBTC + ADDRESSES.ethereum.WETH, // WETH + ADDRESSES.ethereum.DAI, // DAI + ADDRESSES.ethereum.USDC, // USDC + ADDRESSES.ethereum.WBTC, // WBTC ] const optVaults = [ @@ -40,53 +42,35 @@ const optVaults = [ ] const optCollaterals = [ - "0x4200000000000000000000000000000000000006", // WETH - "0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1", // DAI + ADDRESSES.tombchain.FTM, // WETH + ADDRESSES.optimism.DAI, // DAI "0x350a791Bfc2C21F9Ed5d10980Dad2e2638ffa7f6", // LINK "0x8700dAec35aF8Ff88c16BdF0418774CB3D7599B4", // SNX "0x6fd9d7AD17242c41f7131d257212c54A0e816691" // UNI ] -async function ethTvl(timestamp, block) { - let balances = {}; - await sumTokensSharedOwners(balances, ethCollaterals, ethVaults, block); - return balances; -} - -async function optTvl(timestamp, block, chainBlocks) { - let balances = {}; - await sumTokensSharedOwners(balances, optCollaterals, optVaults, chainBlocks.optimism, "optimism"); - return balances; -} - -const treasuryAddress = "0xa54074b2cc0e96a43048d4a68472F7F046aC0DA8"; -const treasuryContents = [ - "0x321C2fE4446C7c963dc41Dd58879AF648838f98D", - "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48" -] -const optTreasury = "0x271901c3268D0959bbc9543DE4f073D3708C88F7"; - -async function treasury(timestamp, block) { - let balances = {}; - const ethBal = (await sdk.api.eth.getBalance({ - target: treasuryAddress, - block, - })).output; - sdk.util.sumSingleBalance(balances, "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", ethBal); - await sumTokensSharedOwners(balances, treasuryContents, [treasuryAddress], block); - return balances; -} - - module.exports = { methodology: "TVL includes collateral in vaults", ethereum: { - tvl: ethTvl, - pool2: staking(ethStakingContracts, ethPool2s), - staking: staking(factory, ctxToken), - treasury + tvl: sumTokensExport({ tokens: ethCollaterals, owners: ethVaults,}), + pool2: pool2(ethStakingContracts, ethPool2s), + staking: staking_, }, optimism: { - tvl: optTvl + tvl: sumTokensExport({ tokens: optCollaterals, owners: optVaults,}) } }; + +async function staking_(_, _b, _cb, { api, }) { + const logs = await getLogs({ + api, + target: factory, + topics: ['0x0976a62688d14faa8e35e63a7ada50f147ba1a0357f99182a596f9afea2502f4'], + eventAbi: 'event DelegatorCreated (address indexed delegator, address indexed delegatee)', + onlyArgs: true, + fromBlock: 13360296, + }) + const owners = [factory,] + logs.forEach(log => owners.push(log.delegator)) + return sumTokens2({ api, owners, tokens: [ctxToken] }) +} \ No newline at end of file diff --git a/projects/cryptex-v2/index.js b/projects/cryptex-v2/index.js new file mode 100644 index 00000000000..518f779f4cf --- /dev/null +++ b/projects/cryptex-v2/index.js @@ -0,0 +1,25 @@ +const config = { + arbitrum: { + collateralContract: '0xaf8ced28fce00abd30463d55da81156aa5aeeec2', + products: [ + '0xea281a4c70ee2ef5ce3ed70436c81c0863a3a75a', // TCAP LP + '0x4243b34374cfb0a12f184b92f52035d03d4f7056', // TCAP Short + '0x1cd33f4e6edeee8263aa07924c2760cf2ec8aad0', // TCAP Long + ] + } +} + +module.exports = { + doublecounted: true, +}; + +Object.keys(config).forEach(chain => { + const { collateralContract, products, } = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const token = await api.call({ abi: 'address:token', target: collateralContract }) + const bals = await api.multiCall({ abi: 'function collateral(address) view returns (uint256)', calls: products, target: collateralContract }) + bals.forEach(i => api.add(token, i)) + } + } +}) diff --git a/projects/cryptex/cryptex-config.js b/projects/cryptex/cryptex-config.js index 8d0ef598d9b..4aa6ca6f18d 100644 --- a/projects/cryptex/cryptex-config.js +++ b/projects/cryptex/cryptex-config.js @@ -1,18 +1,3 @@ -const chainIds = { - bsc: 56, - polygon: 137, - fantom: 250, - avax: 43114, - xdai: 100, - cronos: 25, - aurora: 1313161554, - moonriver: 1285, -} - -const chainNameById = Object.keys(chainIds).reduce((acc, key) => { - acc[chainIds[key]] = key; - return acc; -}, {}); const cryptexConfig = { crxToken: "0x97a30C692eCe9C317235d48287d23d358170FC40", @@ -22,328 +7,6 @@ const cryptexConfig = { }, } -const swaps = { - // BSC - pancakeswap: 'pancakeswap', - pancakeswapv2: 'pancakeswapv2', - apeswap: 'apeswap', - leonicornswap: 'leonicornswap', - knightswap: 'knightswap', - // FANTOM - spookyswap: 'spookyswap', - spiritswap: 'spiritswap', - darkknightswap: 'darkknightswap', - bombswap: 'bombswap', - // avax - pangolinswap: 'pangolinswap', - traderjoe: 'traderjoe', - // XDAI (Gnosis) - honeyswap: 'honeyswap', - // AURORA - auroraswap: 'auroraswap', - // CRONOS - cronaswap: 'cronaswap', - // CROSS-CHAINED - sushiswap: 'sushiswap', -} - -const swapConfigs = { - [chainIds.bsc]: { - [swaps.pancakeswap]: { - key: swaps.pancakeswap, - factory: '0xBCfCcbde45cE874adCB698cC183deBcF17952812', - }, - [swaps.pancakeswapv2]: { - key: swaps.pancakeswapv2, - factory: '0xcA143Ce32Fe78f1f7019d7d551a6402fC5350c73', - }, - [swaps.apeswap]: { - key: swaps.apeswap, - factory: '0x0841BD0B734E4F5853f0dD8d7Ea041c241fb0Da6', - }, - [swaps.leonicornswap]: { - key: swaps.leonicornswap, - factory: '0xeb10f4fe2a57383215646b4ac0da70f8edc69d4f', - }, - [swaps.knightswap]: { - key: swaps.knightswap, - factory: '0xf0bc2E21a76513aa7CC2730C7A1D6deE0790751f', - }, - }, - [chainIds.polygon]: { - [swaps.sushiswap]: { - key: swaps.sushiswap, - factory: '0xc35DADB65012eC5796536bD9864eD8773aBc74C4', - }, - [swaps.quickswap]: { - key: swaps.quickswap, - factory: '0x5757371414417b8c6caad45baef941abc7d3ab32', - }, - }, - [chainIds.xdai]: { - [swaps.sushiswap]: { - key: swaps.sushiswap, - factory: '0xc35DADB65012eC5796536bD9864eD8773aBc74C4', - }, - [swaps.honeyswap]: { - key: swaps.honeyswap, - factory: '0xA818b4F111Ccac7AA31D0BCc0806d64F2E0737D7', - } - }, - [chainIds.fantom]: { - [swaps.spiritswap]: { - key: swaps.spiritswap, - factory: '0xEF45d134b73241eDa7703fa787148D9C9F4950b0', - }, - [swaps.spookyswap]: { - key: swaps.spookyswap, - factory: '0x152ee697f2e276fa89e96742e9bb9ab1f2e61be3', - }, - [swaps.bombswap]: { - key: swaps.bombswap, - factory: '0xD9473A05b2edf4f614593bA5D1dBd3021d8e0Ebe', - }, - [swaps.darkknightswap]: { - key: swaps.darkknightswap, - factory: '0x7d82F56ea0820A9d42b01C3C28F1997721732218', - }, - }, - [chainIds.avax]: { - [swaps.pangolinswap]: { - key: swaps.pangolinswap, - factory: '0xefa94DE7a4656D787667C749f7E1223D71E9FD88', - }, - [swaps.traderjoe]: { - key: swaps.traderjoe, - factory: '0x9Ad6C38BE94206cA50bb0d90783181662f0Cfa10', - }, - }, - [chainIds.cronos]: { - [swaps.cronaswap]: { - key: swaps.cronaswap, - factory: '0x73A48f8f521EB31c55c0e1274dB0898dE599Cb11', - } - }, - [chainIds.aurora]: { - [swaps.auroraswap]: { - key: swaps.auroraswap, - factory: '0xC5E1DaeC2ad401eBEBdd3E32516d90Ab251A3aA3', - } - }, - [chainIds.moonriver]: { - [swaps.sushiswap]: { - key: swaps.sushiswap, - factory: '0xc35DADB65012eC5796536bD9864eD8773aBc74C4', - } - }, -} - -const chainConfigs = { - [chainIds.bsc]: { - vesting: { - address: '0x0B07f109E7A08Ad41F99d409329851E968AbD231', - deployBlock: 7134211, - }, - lockers: [{ - version: 1, - deployBlock: 5300329, - address: '0x7f5EF2cE9150ffE2796F62F1177fc6f22a527E5F', - swaps: [swaps.pancakeswap,], - },{ - version: 2, - deployBlock: 6966666, - address: '0xe0c3ab2c69d8b43d8B0D922aFa224A0AB6780dE1', - swaps: [swaps.pancakeswapv2,], - },{ - version: 3, - deployBlock: 7867793, - address: '0x6773Be587556ABeb401aa712958879787e9131F9', - swaps: [swaps.apeswap], - },{ - version: 3, - deployBlock: 12561149, - address: '0x6e28D5c3C1886F6DA95a5eF9F048bccac3aB7E83', - swaps: [swaps.leonicornswap,], - },{ - version: 3, - deployBlock: 13678367, - address: '0xa134d366110Fcd89ec504AC9c1eB2A1d715a8B9B', - swaps: [swaps.knightswap,], - },{ - version: 4, - deployBlock: 15335372, - address: '0x3853a94acD9002B1f87eDB9267bef0702b3D9283', - swaps: [ - swaps.pancakeswapv2, - swaps.apeswap, - swaps.leonicornswap, - swaps.knightswap, - ], - }], - }, - [chainIds.polygon]: { - vesting: { - address: '0x5F0D4Ec7293bB95E26Cc4f5bd0D95D39C5c8FD30', - deployBlock: 16477018, - }, - lockers: [{ - version: 3, - deployBlock: 15681470, - address: '0x698b50D22F6bc422162CaeDF75Ec29635a11A818', - swaps: [ - swaps.quickswap - ], - },{ - version: 3, - deployBlock: 15680659, - address: '0xE239138d6d6e3048B05401c226B777Cd0234cD92', - swaps: [ - swaps.sushiswap - ], - },{ - version: 4, - deployBlock: 25070018, - address: '0xBbd3660299f34D204d9aDf90acaD445ffACB4897', - swaps: [ - swaps.quickswap, - swaps.sushiswap, - ], - }] - }, - [chainIds.xdai]: { - vesting: { - address: '0x24fCd667e0C55aa39ebcc3783Dc6d1eb754fa912', - deployBlock: 17333151, - }, - lockers: [{ - version: 3, - deployBlock: 17315872, - address: '0xeB32a3290aBa8b5e2A5C67A29C8aDd2D2D590614', - swaps: [ - swaps.sushiswap, - ], - },{ - version: 3, - deployBlock: 17316077, - address: '0x8847A10864F0fBc309cC852A3e9850351bE4061e', - swaps: [ - swaps.honeyswap - ], - },{ - version: 4, - deployBlock: 20697471, - address: '0x17400E59dB1EBc0E12F11D65127d2F97a87709c4', - swaps: [ - swaps.sushiswap, - swaps.honeyswap - ], - }], - }, - [chainIds.fantom]: { - vesting: { - address: '0xd7BE08609bb6649fF30505c7b9Bb3D892763d0Aa', - deployBlock: 18279805, - }, - lockers: [{ - version: 3, - deployBlock: 23709374, - address: '0xB9486B932B9C6Dd14941101514f1B2a8224ec1D6', - swaps: [ - swaps.bombswap, - ], - },{ - version: 3, - deployBlock: 18268821, - address: '0xE239138d6d6e3048B05401c226B777Cd0234cD92', - swaps: [ - swaps.spookyswap, - ], - },{ - version: 3, - deployBlock: 18268978, - address: '0x698b50D22F6bc422162CaeDF75Ec29635a11A818', - swaps: [ - swaps.spiritswap, - ], - },{ - version: 3, - deployBlock: 25642123, - address: '0x668Ab0A9a7B46840695a94E0b9E533CFD4fE0e53', - swaps: [ - swaps.darkknightswap, - ], - },{ - version: 4, - deployBlock: 31298572, - address: '0x0DB68BEfbfcE88239068FAaA491d4Cb772dA6C7D', - swaps: [ - swaps.bombswap, - swaps.spookyswap, - swaps.spiritswap, - swaps.darkknightswap, - ], - },], - }, - [chainIds.avax]: { - vesting: { - address: '0xFC382EF71f861633e31A866e689d772c1B99780d', - deployBlock: 5218695, - }, - lockers: [{ - version: 3, - deployBlock: 5218223, - address: '0x942e3012AA6f57dcde038e4206387946Eafb5F4E', - swaps: [ - swaps.pangolinswap, - ], - },{ - version: 4, - deployBlock: 11063865, - address: '0x8d993129C4B426E72b23897B13Ce3dB471D1fd2D', - swaps: [ - swaps.pangolinswap, - swaps.traderjoe, - ], - },], - }, - [chainIds.aurora]: { - lockers: [{ - version: 4, - deployBlock: 59767920, - address: '0x942e3012AA6f57dcde038e4206387946Eafb5F4E', - swaps: [ - swaps.auroraswap, - ], - },], - }, - [chainIds.cronos]: { - lockers: [{ - version: 4, - deployBlock: 1643406, - address: '0xE239138d6d6e3048B05401c226B777Cd0234cD92', - swaps: [ - swaps.cronaswap, - ], - },], - }, - [chainIds.moonriver]: { - lockers: [{ - version: 4, - deployBlock: 1509384, - address: '0xE239138d6d6e3048B05401c226B777Cd0234cD92', - swaps: [ - swaps.sushiswap, - ], - },], - }, -} - - module.exports = { - chainIds, - chainNameById, cryptexConfig, - swaps, - swapConfigs, - chainConfigs, } \ No newline at end of file diff --git a/projects/cryptex/cryptex-helper.js b/projects/cryptex/cryptex-helper.js deleted file mode 100644 index c006c904c6e..00000000000 --- a/projects/cryptex/cryptex-helper.js +++ /dev/null @@ -1,104 +0,0 @@ -const sdk = require("@defillama/sdk"); -const token0 = require('../helper/abis/token0.json'); -const token1 = require('../helper/abis/token1.json'); -const getReserves = require('../helper/abis/getReserves.json'); -const factoryAbi = require('../helper/abis/factory.json'); - -const requery = async (results, chain, block, abi) => { - if (results.some(r => !r.success)) { - const failed = results.map((r, i) => [r, i]).filter(r => !r[0].success) - const newResults = await sdk.api.abi - .multiCall({ - abi, - chain, - calls: failed.map((f) => f[0].input), - block, - }).then(({ output }) => output); - failed.forEach((f, i) => { - results[f[1]] = newResults[i] - }) - } -} - -const getVestInstances = async (vestingAddress, chain, startBlock = 0, endBlock = 0) => { - let tokenAddresses; - - const logs = ( - await sdk.api.util.getLogs({ - keys: [], - chain, - fromBlock: startBlock, - toBlock: endBlock, - target: vestingAddress, - topic: 'OnTokenLock(uint256,address,address,address,uint256,uint256)' - }) - ).output; - - tokenAddresses = logs - .map((log) => { - if (typeof log === 'string') return log; - return { - token: `0x${log.topics[2].slice(26)}`, - instance: `0x${log.data.slice(64 - 40 + 2, 64 + 2)}`, - isLP: false, // TODO: detect if locked token is LP token - } - }) - - return tokenAddresses; -} - -const getLockerPairAddresses = async (lockerAddress, chain, startBlock = 0, endBlock = 0) => { - let pairAddresses; - - const logs = ( - await sdk.api.util.getLogs({ - keys: [], - chain, - fromBlock: startBlock, - toBlock: endBlock, - target: lockerAddress, - topic: 'OnTokenLock(uint256,address,address,uint256,uint256)', - }) - ).output; - - pairAddresses = logs - // sometimes the full log is emitted - .map((log) => - typeof log === 'string' ? log : `0x${log.topics[2].slice(26)}` - ) - // lowercase - .map((pairAddress) => pairAddress.toLowerCase()); - - return pairAddresses; -} - -const getSwapPairAddresses = async (factory, chain, useMulticall = false) => { - let pairAddresses; - const pairLength = (await sdk.api.abi.call({ - target: factory, - abi: factoryAbi.allPairsLength, - chain, - })).output - if (pairLength === null) { - throw new Error("allPairsLength() failed", factory) - } - const pairNums = Array.from(Array(Number(pairLength)).keys()) - const pairs = (await sdk.api.abi.multiCall({ - abi: factoryAbi.allPairs, - chain, - calls: pairNums.map(num => ({ - target: factory, - params: [num] - })), - })).output - await requery(pairs, chain, undefined, factoryAbi.allPairs); - pairAddresses = pairs.map(result => result.output.toLowerCase()); - - return pairAddresses; -} - -module.exports = { - getSwapPairAddresses, - getLockerPairAddresses, - getVestInstances -} \ No newline at end of file diff --git a/projects/cryptex/index.js b/projects/cryptex/index.js index 78c0a944fa5..622c2ceb7de 100644 --- a/projects/cryptex/index.js +++ b/projects/cryptex/index.js @@ -1,161 +1,13 @@ -const sdk = require("@defillama/sdk"); -// const erc20Abi = require("../helper/abis/erc20.json"); -// const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); +const { stakings } = require('../helper/staking') const { - chainIds, - chainNameById, cryptexConfig, - chainConfigs, } = require('./cryptex-config'); -const { getLockerPairAddresses, getVestInstances } = require('./cryptex-helper'); - -/* -const fetchTVLByLPLocker = async (locker, chainId, block) => { - const chainName = chainNameById[chainId]; - let balances = {}; - if (locker.address) { - - const pairs = await getLockerPairAddresses( - locker.address, - chainName, - locker.deployBlock, - block - ); - - const lpBalances = (await sdk.api.abi.multiCall({ - abi: erc20Abi.balanceOf, - chain: chainName, - calls: pairs.map(pair => ({ - target: pair, - params: [locker.address], - })) - })).output; - - let lpPositions = []; - - lpBalances.forEach((p) => { - lpPositions.push({ - balance: p.output, - token: p.input.target, - }); - }); - - await unwrapUniswapLPs( - balances, - lpPositions, - undefined, - chainName, - (addr) => `${chainName}:${addr}` - ); - } - - return balances; -} - -const fetchTVLByVestingLocker = async (vesting, chainId, block) => { - const chainName = chainNameById[chainId]; - let balances = {}; - if (vesting.address) { - const vestInstances = await getVestInstances( - vesting.address, - chainName, - vesting.deployBlock, - block - ); - - const instanceBalances = (await sdk.api.abi.multiCall({ - abi: erc20Abi.balanceOf, - chain: chainName, - calls: vestInstances.map(item => ({ - target: item.token, - params: [item.instance], - })) - })).output; - - instanceBalances.forEach((item) => { - sdk.util.sumSingleBalance(balances, `${chainName}:${item.input.target}`, item.output);; - }) - } - - return balances; -} - -const fetchTVL = (chainId) => { - return async (timestamp, ethBlock, chainBlocks) => { - const lockers = (chainConfigs[chainId]?.lockers || []); - const vesting = (chainConfigs[chainId]?.vesting || {}) - const chainName = chainNameById[chainId]; - const block = chainBlocks[chainName]; - const balances = {}; - - const vestingBalances = await fetchTVLByVestingLocker(vesting, chainId, block); - - Object.keys(vestingBalances).forEach((key) => { - sdk.util.sumSingleBalance(balances, key, vestingBalances[key]); - }); - - for (let i = 0; i < lockers.length; i++) { - const locker = lockers[i]; - const data = await fetchTVLByLPLocker(locker, chainId, block); - - Object.keys(data).forEach((key) => { - sdk.util.sumSingleBalance(balances, key, data[key]); - }); - } - - return balances; - - } -} -*/ -const fetchStaking = async (timestamp, block, chainBlocks) => { - let balances = {}; - - const v1Balance = (await sdk.api.erc20.balanceOf({ - target: cryptexConfig.crxToken, - owner: cryptexConfig.staking.V1, - chain: "bsc", - block: chainBlocks.bsc - })).output; - - const v2Balance = (await sdk.api.erc20.balanceOf({ - target: cryptexConfig.crxToken, - owner: cryptexConfig.staking.V2, - chain: "bsc", - block: chainBlocks.bsc - })).output; - - sdk.util.sumSingleBalance(balances, `bsc:${cryptexConfig.crxToken}`, v1Balance); - sdk.util.sumSingleBalance(balances, `bsc:${cryptexConfig.crxToken}`, v2Balance); - - return balances; -} - -// const excludedChains = [chainIds.bsc, chainIds.polygon]; -/* -const chainCalcs = Object.keys(chainIds).reduce((acc, key) => { - const chainId = chainIds[key]; - - // if (excludedChains.indexOf(chainId) !== -1) return acc; - - const calcs = { - tvl: fetchTVL(chainId), - } - - if (chainId === 56) { - calcs.staking = fetchStaking; - } - - acc[key] = calcs; - return acc; -}, {}); -*/ module.exports = { methodology: "TVL includes locked LP tokens and vested team tokens", bsc: { tvl: ()=>({}), - staking: fetchStaking + staking: stakings([cryptexConfig.staking.V1, cryptexConfig.staking.V2, ], cryptexConfig.crxToken) } }; \ No newline at end of file diff --git a/projects/crypto-com/index.js b/projects/crypto-com/index.js index 4e9d5fe0b88..0df01714333 100644 --- a/projects/crypto-com/index.js +++ b/projects/crypto-com/index.js @@ -9,6 +9,8 @@ const config = { 'bc1qr4dl5wa7kl8yu792dceg9z5knl2gkn220lk7a9', 'bc1q4c8n5t00jmj8temxdgcc3t32nkg2wjwz24lywv', '14m3sd9HCCFJW4LymahJCKMabAxTK4DAqW', + 'bc1qjqy709gqpse60hdsm2d2v0dzzu7yp5dej7fdrpl2x3taccvujq4s0vzsyd', + 'bc1qcdqj2smprre85c78d942wx5tauw5n7uw92r7wr' ], }, ethereum: { @@ -18,13 +20,60 @@ const config = { '0xcffad3200574698b78f32232aa9d63eabd290703', '0x7758e507850da48cd47df1fb5f875c23e3340c50', '0x46340b20830761efd32832a74d7169b29feb9758', + '0xf3b0073e3a7f747c7a38b36b805247b222c302a3', ], }, bsc: { - owners: ['0x72A53cDBBcc1b9efa39c834A540550e23463AAcB'] + owners: [ + '0x72A53cDBBcc1b9efa39c834A540550e23463AAcB', + '0xcffad3200574698b78f32232aa9d63eabd290703', + '0x7758e507850da48cd47df1fb5f875c23e3340c50', + '0xcffad3200574698b78f32232aa9d63eabd290703' + ] }, polygon: { - owners: ['0x72A53cDBBcc1b9efa39c834A540550e23463AAcB'] + owners: [ + '0x72A53cDBBcc1b9efa39c834A540550e23463AAcB', + '0xcffad3200574698b78f32232aa9d63eabd290703', + '0x6262998Ced04146fA42253a5C0AF90CA02dfd2A3', + '0x7758e507850da48cd47df1fb5f875c23e3340c50', + '0xcffad3200574698b78f32232aa9d63eabd290703' + ] + }, + arbitrum: { + owners: [ + '0xcffad3200574698b78f32232aa9d63eabd290703', + '0x6262998Ced04146fA42253a5C0AF90CA02dfd2A3', + '0x72A53cDBBcc1b9efa39c834A540550e23463AAcB', + '0x7758e507850da48cd47df1fb5f875c23e3340c50', + '0xcffad3200574698b78f32232aa9d63eabd290703' + ] + }, + avax: { + owners: [ + '0xcffad3200574698b78f32232aa9d63eabd290703', + '0x6262998Ced04146fA42253a5C0AF90CA02dfd2A3', + '0x72A53cDBBcc1b9efa39c834A540550e23463AAcB', + '0x7758e507850da48cd47df1fb5f875c23e3340c50', + '0xcffad3200574698b78f32232aa9d63eabd290703' + ] + }, + optimism: { + owners: [ + '0xcffad3200574698b78f32232aa9d63eabd290703', + '0x6262998Ced04146fA42253a5C0AF90CA02dfd2A3', + '0x72A53cDBBcc1b9efa39c834A540550e23463AAcB', + '0x7758e507850da48cd47df1fb5f875c23e3340c50', + '0xcffad3200574698b78f32232aa9d63eabd290703' + ] + }, + fantom: { + owners: [ + '0x6262998Ced04146fA42253a5C0AF90CA02dfd2A3', + '0x72A53cDBBcc1b9efa39c834A540550e23463AAcB', + '0x7758e507850da48cd47df1fb5f875c23e3340c50', + '0xcffad3200574698b78f32232aa9d63eabd290703' + ] } } diff --git a/projects/cryptoyieldfocus/abi.json b/projects/cryptoyieldfocus/abi.json deleted file mode 100644 index 6fe7751a732..00000000000 --- a/projects/cryptoyieldfocus/abi.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "type": "function", - "stateMutability": "view", - "outputs": [ - { - "type": "address", - "name": "lpToken", - "internalType": "contract IBEP20" - }, - { - "type": "uint256", - "name": "allocPoint", - "internalType": "uint256" - }, - { - "type": "uint256", - "name": "lastRewardBlock", - "internalType": "uint256" - }, - { - "type": "uint256", - "name": "accCyfPerShare", - "internalType": "uint256" - }, - { - "type": "uint16", - "name": "depositFeeBP", - "internalType": "uint16" - } - ], - "name": "poolInfo", - "inputs": [ - { - "type": "uint256", - "name": "", - "internalType": "uint256" - } - ] -} \ No newline at end of file diff --git a/projects/cryptoyieldfocus/index.js b/projects/cryptoyieldfocus/index.js index ddfdff68a18..d41be93634c 100644 --- a/projects/cryptoyieldfocus/index.js +++ b/projects/cryptoyieldfocus/index.js @@ -1,9 +1,5 @@ -const sdk = require("@defillama/sdk"); -const abi = require("./abi.json"); -const { transformAvaxAddress } = require("../helper/portedTokens"); +const abi = 'function poolInfo(uint256) view returns (address lpToken, uint256 allocPoint, uint256 lastRewardBlock, uint256 accCyfPerShare, uint16 depositFeeBP)'; const {addFundsInMasterChef} = require('../helper/masterchef') -const {staking} = require('../helper/staking') -const {sumTokensAndLPsSharedOwners} = require('../helper/unwrapLPs') const STAKING_CONTRACT = "0xaB0141F81b3129f03996D0679b81C07F6A24c435"; const cyf = "0x411491859864797792308723Fc417f11BbA18D1b" @@ -17,7 +13,7 @@ const pool2s = [ const avaxTvl = async (timestamp, ethBlock, chainBlocks) => { const balances = {}; - const transformAddress = await transformAvaxAddress(); + const transformAddress = addr => 'avax:'+addr; await addFundsInMasterChef(balances, STAKING_CONTRACT, chainBlocks.avax, 'avax', transformAddress, abi, [ cyf, ...pool2s @@ -26,20 +22,12 @@ const avaxTvl = async (timestamp, ethBlock, chainBlocks) => { return balances; }; -const pool2 = async (timestamp, ethBlock, chainBlocks) => { - const balances = {}; - - const transformAddress = await transformAvaxAddress(); - await sumTokensAndLPsSharedOwners(balances, pool2s.map(p=>[p, true]), [STAKING_CONTRACT], chainBlocks.avax, 'avax', transformAddress) - - return balances; -}; - module.exports = { + hallmarks: [ + [1631318400, "Rug Pull"] + ], avax:{ tvl: avaxTvl, - pool2, - staking: staking(STAKING_CONTRACT, cyf, 'avax', `avax:${cyf}`) }, methodology: "We add the tvl from the farming pools fetching from StakingContract", diff --git a/projects/crystl/index.js b/projects/crystl/index.js index e723bc7a3e2..1d122fb5263 100644 --- a/projects/crystl/index.js +++ b/projects/crystl/index.js @@ -32,19 +32,7 @@ const CHAIN_DATA = { }, }; -const wantLockedTotalABI = { - "inputs": [], - "name": "wantLockedTotal", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" -} +const wantLockedTotalABI = "uint256:wantLockedTotal" let _pools @@ -99,6 +87,9 @@ async function bsc(timestamp, block, chainBlocks) { } module.exports = { + hallmarks: [ + [1656590400,"Protocol End"] // https://crystlfinance.medium.com/wrapping-up-crystl-finance-4743287a6bf + ], polygon: { tvl: polygon, }, diff --git a/projects/cswap/index.js b/projects/cswap/index.js new file mode 100644 index 00000000000..7a6a0a544d4 --- /dev/null +++ b/projects/cswap/index.js @@ -0,0 +1,33 @@ +const { transformDexBalances } = require('../helper/portedTokens') +const { get } = require('../helper/http') + +module.exports = { + timetravel: false, + misrepresentedTokens: true, + comdex: { + tvl: async () => { + let page = 1 + let data = [] + let nextKey + + do { + const paginationKey = nextKey ? `pagination.key=${nextKey}` : '' + const api = `https://rest.comdex.one/comdex/liquidity/v1beta1/pools/1?${paginationKey}` + const { pagination, pools } = await get(api) + pools.forEach(i => { + if (!i.balances.base_coin || !i.balances.quote_coin) return; + data.push({ + token0: i.balances.base_coin.denom, + token1: i.balances.quote_coin.denom, + token0Bal: i.balances.base_coin.amount, + token1Bal: i.balances.quote_coin.amount, + }) + }) + page++ + nextKey = pagination.next_key + } while (nextKey) + + return transformDexBalances({ chain: 'comdex', data }) + } + } +} \ No newline at end of file diff --git a/projects/cubfinance/abi.json b/projects/cubfinance/abi.json index cfb52df0453..b5e15b2c10c 100644 --- a/projects/cubfinance/abi.json +++ b/projects/cubfinance/abi.json @@ -1,54 +1,6 @@ -{ - "wantLockedTotal": { - "inputs": [], - "name": "wantLockedTotal", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - "poolLength": { - "inputs": [], - "name": "poolLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "poolInfo": { - "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "name": "poolInfo", - "outputs": [ - { "internalType": "address", "name": "lpToken", "type": "address" }, - { "internalType": "uint256", "name": "allocPoint", "type": "uint256" }, - { - "internalType": "uint256", - "name": "lastRewardBlock", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accCubPerShare", - "type": "uint256" - }, - { "internalType": "unit16", "name": "depositFeeBP", "type": "uint16" } - ], - "stateMutability": "view", - "type": "function" - }, - - "balanceOf": { - "inputs": [{ "internalType": "address", "name": "", "type": "address" }], - "name": "balanceOf", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - } - } - - - \ No newline at end of file +{ + "wantLockedTotal": "uint256:wantLockedTotal", + "poolLength": "uint256:poolLength", + "poolInfo": "function poolInfo(uint256) view returns (address lpToken, uint256 allocPoint, uint256 lastRewardBlock, uint256 accCubPerShare, uint16 depositFeeBP)", + "balanceOf": "function balanceOf(address) view returns (uint256)" +} \ No newline at end of file diff --git a/projects/cubo/index.js b/projects/cubo/index.js index e97a1f95f82..be72a56dc38 100644 --- a/projects/cubo/index.js +++ b/projects/cubo/index.js @@ -1,79 +1,6 @@ -const { sumTokens, unwrapCrv, } = require('../helper/unwrapLPs') - -const chain = 'polygon' -const DAI = '0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063' - -const treasuryAddress = '0xb495ffc5acd7e2fd909c23c30d182e6719fbe9ec' -const oldDaoContract = '0xb05d0da5253e77a8ad37232e8235c712e10edee8' -const daoContract = '0xb8dc6634b7ac8ad3ae352ab92de51349e7b5e71c' - -async function polygon_tvl(timestamp, ethBlock, { polygon: block }) { - const daoTokens = [DAI,].map(token => [ - [token, oldDaoContract,], - [token, daoContract,], - ]).flat() - - const balances = {} - const transformPolygonAddress = addr => `${chain}:${addr}` - await sumTokens( - balances, - daoTokens, - block, - chain, - transformPolygonAddress - ) - return balances -} - -async function polygon_treasury(timestamp, ethBlock, { polygon: block }) { - - const DRAGON_QUICK = '0xf28164a485b0b2c90639e47b0f377b4a438a16b1' - const CUBO_TOKEN = '0x381d168DE3991c7413d46e3459b48A5221E3dfE4' - const MOO_CRV_TriCrypto = '0x5A0801BAd20B6c62d86C566ca90688A6b9ea1d3f' - const MOO_AM3CRV = '0xAA7C2879DaF8034722A0977f13c343aF0883E92e' - const AM3CRV = '0xe7a24ef0c5e95ffb0f6684b813a78f2a3ad7d171' - const CRV_TriCrypto = '0xdad97f7713ae9437fa9249920ec8507e5fbb23d' - - const UnwrapTokenMapping = [ - { from: MOO_AM3CRV, unwrapTo: AM3CRV }, - { from: AM3CRV, unwrapTo: AM3CRV }, - { from: MOO_CRV_TriCrypto, unwrapTo: CRV_TriCrypto }, - { from: CRV_TriCrypto, unwrapTo: CRV_TriCrypto }, - ].reduce((mapping, { from, unwrapTo }) => { - mapping[`${chain}:${from}`] = { type: 'crv', unwrapTo, } - return mapping - }, {}) - - const treasuryTokens = [DAI, DRAGON_QUICK, CUBO_TOKEN, MOO_CRV_TriCrypto, MOO_AM3CRV,].map(token => [token, treasuryAddress,]) - - const balances = {} - const transformPolygonAddress = addr => `${chain}:${addr}` - await sumTokens( - balances, - treasuryTokens, - block, - chain, - transformPolygonAddress - ) - - // Handle wrapped pools in balances - like curvePools, etc - for (let i = 0; i < 2; i++) { // since crvTriCrypto contains am3crv, unwrap twice - for (const token of Object.keys(balances)) { - if (Object.keys(UnwrapTokenMapping).includes(token) && balances[token] > 0) { - if (UnwrapTokenMapping[token].type === 'crv') { - await unwrapCrv(balances, UnwrapTokenMapping[token].unwrapTo, balances[token], block, chain, transformPolygonAddress) - } - delete balances[token]// Once unwrapped, remove from balance - } - } - } - return balances -} - module.exports = { polygon: { - tvl: polygon_tvl, - treasury: polygon_treasury, + tvl: () => 0, }, methodology: `TVL on polygon is sum of all collateralTokens (dai only atm) provided to mint nodes`, } diff --git a/projects/curve/abi.json b/projects/curve/abi.json index dcf331143bc..acdf49cea85 100644 --- a/projects/curve/abi.json +++ b/projects/curve/abi.json @@ -1,227 +1,18 @@ { - "get_registry": { - "name": "get_registry", - "outputs": [ - { - "type": "address", - "name": "" - } - ], - "inputs": [], - "stateMutability": "view", - "type": "function", - "gas": 1061 - }, - "pool_list": { - "stateMutability": "view", - "type": "function", - "name": "pool_list", - "inputs": [ - { - "name": "arg0", - "type": "uint256" - } - ], - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "gas": 2217 - }, - "pool_count": { - "stateMutability": "view", - "type": "function", - "name": "pool_count", - "inputs": [], - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "gas": 2138 - }, - "get_n_coins": { - "stableswap": { - "stateMutability": "view", - "type": "function", - "name": "get_n_coins", - "inputs": [ - { - "name": "_pool", - "type": "address" - } - ], - "outputs": [ - { - "name": "", - "type": "uint256[2]" - } - ], - "gas": 1521 - }, - "stableFactory": { - "stateMutability": "view", - "type": "function", - "name": "get_n_coins", - "inputs": [ - { - "name": "_pool", - "type": "address" - } - ], - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "gas": 2699 - }, - "crypto": { - "stateMutability": "view", - "type": "function", - "name": "get_n_coins", - "inputs": [ - { - "name": "_pool", - "type": "address" - } - ], - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "gas": 2834 - }, - "cryptoFactory": { - "stateMutability": "view", - "type": "function", - "name": "get_n_coins", - "inputs": [ - { - "name": "_pool", - "type": "address" - } - ], - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "gas": 2834 - } - }, - "get_coins": { - "stableswap": { - "stateMutability": "view", - "type": "function", - "name": "get_coins", - "inputs": [ - { - "name": "_pool", - "type": "address" - } - ], - "outputs": [ - { - "name": "", - "type": "address[8]" - } - ], - "gas": 12102 - }, - "stableFactory": { - "stateMutability": "view", - "type": "function", - "name": "get_coins", - "inputs": [ - { - "name": "_pool", - "type": "address" - } - ], - "outputs": [ - { - "name": "", - "type": "address[4]" - } - ], - "gas": 9164 - }, - "crypto": { - "stateMutability": "view", - "type": "function", - "name": "get_coins", - "inputs": [ - { - "name": "_pool", - "type": "address" - } - ], - "outputs": [ - { - "name": "", - "type": "address[8]" - } - ], - "gas": 22975 - }, - "cryptoFactory": { - "stateMutability": "view", - "type": "function", - "name": "get_coins", - "inputs": [ - { - "name": "_pool", - "type": "address" - } - ], - "outputs": [ - { - "name": "", - "type": "address[2]" - } - ] - } - }, - "get_id_info": { - "name": "get_id_info", - "outputs": [ - { - "type": "address", - "name": "addr" - }, - { - "type": "bool", - "name": "is_active" - }, - { - "type": "uint256", - "name": "version" - }, - { - "type": "uint256", - "name": "last_modified" - }, - { - "type": "string", - "name": "description" - } - ], - "inputs": [ - { - "type": "uint256", - "name": "arg0" - } - ], - "stateMutability": "view", - "type": "function", - "gas": 12168 - } + "get_registry": "address:get_registry", + "pool_list": "function pool_list(uint256 arg0) view returns (address) @2217", + "pool_count": "uint256:pool_count", + "get_id_info": "function get_id_info(uint256 arg0) view returns (address addr, bool is_active, uint256 version, uint256 last_modified, string description) @12168", + "get_n_coins": { + "stableswap": "function get_n_coins(address _pool) view returns (uint256[2]) @1521", + "stableFactory": "function get_n_coins(address _pool) view returns (uint256) @2699", + "crypto": "function get_n_coins(address _pool) view returns (uint256) @2834", + "cryptoFactory": "function get_n_coins(address _pool) view returns (uint256) @2834" + }, + "get_coins": { + "stableswap": "function get_coins(address _pool) view returns (address[8]) @12102", + "stableFactory": "function get_coins(address _pool) view returns (address[4]) @9164", + "crypto": "function get_coins(address _pool) view returns (address[8]) @22975", + "cryptoFactory": "function get_coins(address _pool) view returns (address[2])" + } } \ No newline at end of file diff --git a/projects/curve/contracts.json b/projects/curve/contracts.json index f59e77544aa..cd9d8028f1d 100644 --- a/projects/curve/contracts.json +++ b/projects/curve/contracts.json @@ -42,6 +42,7 @@ "gasTokenDummy": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", "wrapped": "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270", "metapoolBases": { + "am3CRVg": "0xe7a24ef0c5e95ffb0f6684b813a78f2a3ad7d171", "am3CRV": "0x19793b454d3afc7b454f206ffe95ade26ca6912c", "4eur-f": "0xad326c253a84e9805559b73a08724e11e49ca651" }, @@ -102,12 +103,17 @@ "3CRV": "0xc5cfada84e902ad92dd40194f0883ad49639b023" } }, + "celo": { + "registriesMapping": { + "stableFactory": "0x5277a0226d10392295e8d383e9724d6e416d6e6c" + } + }, "optimism": { "addressProvider": "0x0000000022D53366457F9d5E68Ec105046FC4383", "gasTokenDummy": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", "wrapped": "0x4200000000000000000000000000000000000006", "metapoolBases": { - "3CRV": "0x061b87122ed14b9526a813209c8a59a633257bab" + "3CRV": "0x1337bedc9d22ecbe766df105c9623922a27963ec" } }, "xdai": { diff --git a/projects/config/curve/abis.js b/projects/curve/historical/abis.js similarity index 58% rename from projects/config/curve/abis.js rename to projects/curve/historical/abis.js index 9892c32605f..e77735f7b87 100644 --- a/projects/config/curve/abis.js +++ b/projects/curve/historical/abis.js @@ -1,12 +1,19 @@ let abis = {}; +abis.compoundv1 = [{"name":"TokenExchange","inputs":[{"type":"address","name":"buyer","indexed":true},{"type":"int128","name":"sold_id","indexed":false},{"type":"uint256","name":"tokens_sold","indexed":false},{"type":"int128","name":"bought_id","indexed":false},{"type":"uint256","name":"tokens_bought","indexed":false}],"anonymous":false,"type":"event"},{"name":"TokenExchangeUnderlying","inputs":[{"type":"address","name":"buyer","indexed":true},{"type":"int128","name":"sold_id","indexed":false},{"type":"uint256","name":"tokens_sold","indexed":false},{"type":"int128","name":"bought_id","indexed":false},{"type":"uint256","name":"tokens_bought","indexed":false}],"anonymous":false,"type":"event"},{"name":"AddLiquidity","inputs":[{"type":"address","name":"provider","indexed":true},{"type":"uint256[2]","name":"token_amounts","indexed":false},{"type":"uint256[2]","name":"fees","indexed":false},{"type":"uint256","name":"invariant","indexed":false},{"type":"uint256","name":"token_supply","indexed":false}],"anonymous":false,"type":"event"},{"name":"RemoveLiquidity","inputs":[{"type":"address","name":"provider","indexed":true},{"type":"uint256[2]","name":"token_amounts","indexed":false},{"type":"uint256[2]","name":"fees","indexed":false},{"type":"uint256","name":"token_supply","indexed":false}],"anonymous":false,"type":"event"},{"name":"RemoveLiquidityImbalance","inputs":[{"type":"address","name":"provider","indexed":true},{"type":"uint256[2]","name":"token_amounts","indexed":false},{"type":"uint256[2]","name":"fees","indexed":false},{"type":"uint256","name":"invariant","indexed":false},{"type":"uint256","name":"token_supply","indexed":false}],"anonymous":false,"type":"event"},{"name":"CommitNewAdmin","inputs":[{"type":"uint256","name":"deadline","indexed":true,"unit":"sec"},{"type":"address","name":"admin","indexed":true}],"anonymous":false,"type":"event"},{"name":"NewAdmin","inputs":[{"type":"address","name":"admin","indexed":true}],"anonymous":false,"type":"event"},{"name":"CommitNewParameters","inputs":[{"type":"uint256","name":"deadline","indexed":true,"unit":"sec"},{"type":"uint256","name":"A","indexed":false},{"type":"uint256","name":"fee","indexed":false},{"type":"uint256","name":"admin_fee","indexed":false}],"anonymous":false,"type":"event"},{"name":"NewParameters","inputs":[{"type":"uint256","name":"A","indexed":false},{"type":"uint256","name":"fee","indexed":false},{"type":"uint256","name":"admin_fee","indexed":false}],"anonymous":false,"type":"event"},{"outputs":[],"inputs":[{"type":"address[2]","name":"_coins"},{"type":"address[2]","name":"_underlying_coins"},{"type":"address","name":"_pool_token"},{"type":"uint256","name":"_A"},{"type":"uint256","name":"_fee"}],"constant":false,"payable":false,"type":"constructor"},{"name":"get_virtual_price","outputs":[{"type":"uint256","name":"out"}],"inputs":[],"constant":true,"payable":false,"type":"function","gas":1084167},{"name":"calc_token_amount","outputs":[{"type":"uint256","name":"out"}],"inputs":[{"type":"uint256[2]","name":"amounts"},{"type":"bool","name":"deposit"}],"constant":true,"payable":false,"type":"function","gas":4239939},{"name":"add_liquidity","outputs":[],"inputs":[{"type":"uint256[2]","name":"amounts"},{"type":"uint256","name":"min_mint_amount"}],"constant":false,"payable":false,"type":"function","gas":6479997},{"name":"get_dy","outputs":[{"type":"uint256","name":"out"}],"inputs":[{"type":"int128","name":"i"},{"type":"int128","name":"j"},{"type":"uint256","name":"dx"}],"constant":true,"payable":false,"type":"function","gas":2543681},{"name":"get_dx","outputs":[{"type":"uint256","name":"out"}],"inputs":[{"type":"int128","name":"i"},{"type":"int128","name":"j"},{"type":"uint256","name":"dy"}],"constant":true,"payable":false,"type":"function","gas":2543687},{"name":"get_dy_underlying","outputs":[{"type":"uint256","name":"out"}],"inputs":[{"type":"int128","name":"i"},{"type":"int128","name":"j"},{"type":"uint256","name":"dx"}],"constant":true,"payable":false,"type":"function","gas":2543506},{"name":"get_dx_underlying","outputs":[{"type":"uint256","name":"out"}],"inputs":[{"type":"int128","name":"i"},{"type":"int128","name":"j"},{"type":"uint256","name":"dy"}],"constant":true,"payable":false,"type":"function","gas":2543512},{"name":"exchange","outputs":[],"inputs":[{"type":"int128","name":"i"},{"type":"int128","name":"j"},{"type":"uint256","name":"dx"},{"type":"uint256","name":"min_dy"}],"constant":false,"payable":false,"type":"function","gas":5184573},{"name":"exchange_underlying","outputs":[],"inputs":[{"type":"int128","name":"i"},{"type":"int128","name":"j"},{"type":"uint256","name":"dx"},{"type":"uint256","name":"min_dy"}],"constant":false,"payable":false,"type":"function","gas":5200817},{"name":"remove_liquidity","outputs":[],"inputs":[{"type":"uint256","name":"_amount"},{"type":"uint256[2]","name":"min_amounts"}],"constant":false,"payable":false,"type":"function","gas":153898},{"name":"remove_liquidity_imbalance","outputs":[],"inputs":[{"type":"uint256[2]","name":"amounts"},{"type":"uint256","name":"max_burn_amount"}],"constant":false,"payable":false,"type":"function","gas":6479708},{"name":"commit_new_parameters","outputs":[],"inputs":[{"type":"uint256","name":"amplification"},{"type":"uint256","name":"new_fee"},{"type":"uint256","name":"new_admin_fee"}],"constant":false,"payable":false,"type":"function","gas":146105},{"name":"apply_new_parameters","outputs":[],"inputs":[],"constant":false,"payable":false,"type":"function","gas":133512},{"name":"revert_new_parameters","outputs":[],"inputs":[],"constant":false,"payable":false,"type":"function","gas":21835},{"name":"commit_transfer_ownership","outputs":[],"inputs":[{"type":"address","name":"_owner"}],"constant":false,"payable":false,"type":"function","gas":74512},{"name":"apply_transfer_ownership","outputs":[],"inputs":[],"constant":false,"payable":false,"type":"function","gas":60568},{"name":"revert_transfer_ownership","outputs":[],"inputs":[],"constant":false,"payable":false,"type":"function","gas":21925},{"name":"withdraw_admin_fees","outputs":[],"inputs":[],"constant":false,"payable":false,"type":"function","gas":12831},{"name":"kill_me","outputs":[],"inputs":[],"constant":false,"payable":false,"type":"function","gas":37878},{"name":"unkill_me","outputs":[],"inputs":[],"constant":false,"payable":false,"type":"function","gas":22015},{"name":"coins","outputs":[{"type":"address","name":"out"}],"inputs":[{"type":"int128","name":"arg0"}],"constant":true,"payable":false,"type":"function","gas":2190},{"name":"underlying_coins","outputs":[{"type":"address","name":"out"}],"inputs":[{"type":"int128","name":"arg0"}],"constant":true,"payable":false,"type":"function","gas":2220},{"name":"balances","outputs":[{"type":"uint256","name":"out"}],"inputs":[{"type":"int128","name":"arg0"}],"constant":true,"payable":false,"type":"function","gas":2250},{"name":"A","outputs":[{"type":"uint256","name":"out"}],"inputs":[],"constant":true,"payable":false,"type":"function","gas":2081},{"name":"fee","outputs":[{"type":"uint256","name":"out"}],"inputs":[],"constant":true,"payable":false,"type":"function","gas":2111},{"name":"admin_fee","outputs":[{"type":"uint256","name":"out"}],"inputs":[],"constant":true,"payable":false,"type":"function","gas":2141},{"name":"owner","outputs":[{"type":"address","name":"out"}],"inputs":[],"constant":true,"payable":false,"type":"function","gas":2171},{"name":"admin_actions_deadline","outputs":[{"type":"uint256","unit":"sec","name":"out"}],"inputs":[],"constant":true,"payable":false,"type":"function","gas":2201},{"name":"transfer_ownership_deadline","outputs":[{"type":"uint256","unit":"sec","name":"out"}],"inputs":[],"constant":true,"payable":false,"type":"function","gas":2231},{"name":"future_A","outputs":[{"type":"uint256","name":"out"}],"inputs":[],"constant":true,"payable":false,"type":"function","gas":2261},{"name":"future_fee","outputs":[{"type":"uint256","name":"out"}],"inputs":[],"constant":true,"payable":false,"type":"function","gas":2291},{"name":"future_admin_fee","outputs":[{"type":"uint256","name":"out"}],"inputs":[],"constant":true,"payable":false,"type":"function","gas":2321},{"name":"future_owner","outputs":[{"type":"address","name":"out"}],"inputs":[],"constant":true,"payable":false,"type":"function","gas":2351}]; + abis.abiNew = [{"name":"TokenExchange","inputs":[{"type":"address","name":"buyer","indexed":true},{"type":"int128","name":"sold_id","indexed":false},{"type":"uint256","name":"tokens_sold","indexed":false},{"type":"int128","name":"bought_id","indexed":false},{"type":"uint256","name":"tokens_bought","indexed":false}],"anonymous":false,"type":"event"},{"name":"TokenExchangeUnderlying","inputs":[{"type":"address","name":"buyer","indexed":true},{"type":"int128","name":"sold_id","indexed":false},{"type":"uint256","name":"tokens_sold","indexed":false},{"type":"int128","name":"bought_id","indexed":false},{"type":"uint256","name":"tokens_bought","indexed":false}],"anonymous":false,"type":"event"},{"name":"AddLiquidity","inputs":[{"type":"address","name":"provider","indexed":true},{"type":"uint256[2]","name":"token_amounts","indexed":false},{"type":"uint256[2]","name":"fees","indexed":false},{"type":"uint256","name":"invariant","indexed":false},{"type":"uint256","name":"token_supply","indexed":false}],"anonymous":false,"type":"event"},{"name":"RemoveLiquidity","inputs":[{"type":"address","name":"provider","indexed":true},{"type":"uint256[2]","name":"token_amounts","indexed":false},{"type":"uint256[2]","name":"fees","indexed":false},{"type":"uint256","name":"token_supply","indexed":false}],"anonymous":false,"type":"event"},{"name":"RemoveLiquidityOne","inputs":[{"type":"address","name":"provider","indexed":true},{"type":"uint256","name":"token_amount","indexed":false},{"type":"uint256","name":"coin_amount","indexed":false},{"type":"uint256","name":"token_supply","indexed":false}],"anonymous":false,"type":"event"},{"name":"RemoveLiquidityImbalance","inputs":[{"type":"address","name":"provider","indexed":true},{"type":"uint256[2]","name":"token_amounts","indexed":false},{"type":"uint256[2]","name":"fees","indexed":false},{"type":"uint256","name":"invariant","indexed":false},{"type":"uint256","name":"token_supply","indexed":false}],"anonymous":false,"type":"event"},{"name":"CommitNewAdmin","inputs":[{"type":"uint256","name":"deadline","indexed":true},{"type":"address","name":"admin","indexed":true}],"anonymous":false,"type":"event"},{"name":"NewAdmin","inputs":[{"type":"address","name":"admin","indexed":true}],"anonymous":false,"type":"event"},{"name":"CommitNewFee","inputs":[{"type":"uint256","name":"deadline","indexed":true},{"type":"uint256","name":"fee","indexed":false},{"type":"uint256","name":"admin_fee","indexed":false}],"anonymous":false,"type":"event"},{"name":"NewFee","inputs":[{"type":"uint256","name":"fee","indexed":false},{"type":"uint256","name":"admin_fee","indexed":false}],"anonymous":false,"type":"event"},{"name":"RampA","inputs":[{"type":"uint256","name":"old_A","indexed":false},{"type":"uint256","name":"new_A","indexed":false},{"type":"uint256","name":"initial_time","indexed":false},{"type":"uint256","name":"future_time","indexed":false}],"anonymous":false,"type":"event"},{"name":"StopRampA","inputs":[{"type":"uint256","name":"A","indexed":false},{"type":"uint256","name":"t","indexed":false}],"anonymous":false,"type":"event"},{"outputs":[],"inputs":[{"type":"address","name":"_owner"},{"type":"address[2]","name":"_coins"},{"type":"address","name":"_pool_token"},{"type":"address","name":"_base_pool"},{"type":"uint256","name":"_A"},{"type":"uint256","name":"_fee"},{"type":"uint256","name":"_admin_fee"}],"stateMutability":"nonpayable","type":"constructor"},{"name":"A","outputs":[{"type":"uint256","name":""}],"inputs":[],"stateMutability":"view","type":"function","gas":5199},{"name":"A_precise","outputs":[{"type":"uint256","name":""}],"inputs":[],"stateMutability":"view","type":"function","gas":5161},{"name":"get_virtual_price","outputs":[{"type":"uint256","name":""}],"inputs":[],"stateMutability":"view","type":"function","gas":992460},{"name":"calc_token_amount","outputs":[{"type":"uint256","name":""}],"inputs":[{"type":"uint256[2]","name":"amounts"},{"type":"bool","name":"is_deposit"}],"stateMutability":"view","type":"function","gas":3938567},{"name":"add_liquidity","outputs":[{"type":"uint256","name":""}],"inputs":[{"type":"uint256[2]","name":"amounts"},{"type":"uint256","name":"min_mint_amount"}],"stateMutability":"nonpayable","type":"function","gas":6136485},{"name":"get_dy","outputs":[{"type":"uint256","name":""}],"inputs":[{"type":"int128","name":"i"},{"type":"int128","name":"j"},{"type":"uint256","name":"dx"}],"stateMutability":"view","type":"function","gas":2390018},{"name":"get_dy_underlying","outputs":[{"type":"uint256","name":""}],"inputs":[{"type":"int128","name":"i"},{"type":"int128","name":"j"},{"type":"uint256","name":"dx"}],"stateMutability":"view","type":"function","gas":2393224},{"name":"exchange","outputs":[{"type":"uint256","name":""}],"inputs":[{"type":"int128","name":"i"},{"type":"int128","name":"j"},{"type":"uint256","name":"dx"},{"type":"uint256","name":"min_dy"}],"stateMutability":"nonpayable","type":"function","gas":2617039},{"name":"exchange_underlying","outputs":[{"type":"uint256","name":""}],"inputs":[{"type":"int128","name":"i"},{"type":"int128","name":"j"},{"type":"uint256","name":"dx"},{"type":"uint256","name":"min_dy"}],"stateMutability":"nonpayable","type":"function","gas":2631854},{"name":"remove_liquidity","outputs":[{"type":"uint256[2]","name":""}],"inputs":[{"type":"uint256","name":"_amount"},{"type":"uint256[2]","name":"min_amounts"}],"stateMutability":"nonpayable","type":"function","gas":163158},{"name":"remove_liquidity_imbalance","outputs":[{"type":"uint256","name":""}],"inputs":[{"type":"uint256[2]","name":"amounts"},{"type":"uint256","name":"max_burn_amount"}],"stateMutability":"nonpayable","type":"function","gas":6136334},{"name":"calc_withdraw_one_coin","outputs":[{"type":"uint256","name":""}],"inputs":[{"type":"uint256","name":"_token_amount"},{"type":"int128","name":"i"}],"stateMutability":"view","type":"function","gas":4389},{"name":"remove_liquidity_one_coin","outputs":[{"type":"uint256","name":""}],"inputs":[{"type":"uint256","name":"_token_amount"},{"type":"int128","name":"i"},{"type":"uint256","name":"_min_amount"}],"stateMutability":"nonpayable","type":"function","gas":3826262},{"name":"ramp_A","outputs":[],"inputs":[{"type":"uint256","name":"_future_A"},{"type":"uint256","name":"_future_time"}],"stateMutability":"nonpayable","type":"function","gas":151894},{"name":"stop_ramp_A","outputs":[],"inputs":[],"stateMutability":"nonpayable","type":"function","gas":148655},{"name":"commit_new_fee","outputs":[],"inputs":[{"type":"uint256","name":"new_fee"},{"type":"uint256","name":"new_admin_fee"}],"stateMutability":"nonpayable","type":"function","gas":110491},{"name":"apply_new_fee","outputs":[],"inputs":[],"stateMutability":"nonpayable","type":"function","gas":97272},{"name":"revert_new_parameters","outputs":[],"inputs":[],"stateMutability":"nonpayable","type":"function","gas":21925},{"name":"commit_transfer_ownership","outputs":[],"inputs":[{"type":"address","name":"_owner"}],"stateMutability":"nonpayable","type":"function","gas":74663},{"name":"apply_transfer_ownership","outputs":[],"inputs":[],"stateMutability":"nonpayable","type":"function","gas":60740},{"name":"revert_transfer_ownership","outputs":[],"inputs":[],"stateMutability":"nonpayable","type":"function","gas":22015},{"name":"admin_balances","outputs":[{"type":"uint256","name":""}],"inputs":[{"type":"uint256","name":"i"}],"stateMutability":"view","type":"function","gas":3511},{"name":"withdraw_admin_fees","outputs":[],"inputs":[],"stateMutability":"nonpayable","type":"function","gas":9232},{"name":"donate_admin_fees","outputs":[],"inputs":[],"stateMutability":"nonpayable","type":"function","gas":74995},{"name":"kill_me","outputs":[],"inputs":[],"stateMutability":"nonpayable","type":"function","gas":38028},{"name":"unkill_me","outputs":[],"inputs":[],"stateMutability":"nonpayable","type":"function","gas":22165},{"name":"coins","outputs":[{"type":"address","name":""}],"inputs":[{"type":"uint256","name":"arg0"}],"stateMutability":"view","type":"function","gas":2250},{"name":"balances","outputs":[{"type":"uint256","name":""}],"inputs":[{"type":"uint256","name":"arg0"}],"stateMutability":"view","type":"function","gas":2280},{"name":"fee","outputs":[{"type":"uint256","name":""}],"inputs":[],"stateMutability":"view","type":"function","gas":2201},{"name":"admin_fee","outputs":[{"type":"uint256","name":""}],"inputs":[],"stateMutability":"view","type":"function","gas":2231},{"name":"owner","outputs":[{"type":"address","name":""}],"inputs":[],"stateMutability":"view","type":"function","gas":2261},{"name":"token","outputs":[{"type":"address","name":""}],"inputs":[],"stateMutability":"view","type":"function","gas":2291},{"name":"base_pool","outputs":[{"type":"address","name":""}],"inputs":[],"stateMutability":"view","type":"function","gas":2321},{"name":"base_virtual_price","outputs":[{"type":"uint256","name":""}],"inputs":[],"stateMutability":"view","type":"function","gas":2351},{"name":"base_cache_updated","outputs":[{"type":"uint256","name":""}],"inputs":[],"stateMutability":"view","type":"function","gas":2381},{"name":"base_coins","outputs":[{"type":"address","name":""}],"inputs":[{"type":"uint256","name":"arg0"}],"stateMutability":"view","type":"function","gas":2520},{"name":"initial_A","outputs":[{"type":"uint256","name":""}],"inputs":[],"stateMutability":"view","type":"function","gas":2441},{"name":"future_A","outputs":[{"type":"uint256","name":""}],"inputs":[],"stateMutability":"view","type":"function","gas":2471},{"name":"initial_A_time","outputs":[{"type":"uint256","name":""}],"inputs":[],"stateMutability":"view","type":"function","gas":2501},{"name":"future_A_time","outputs":[{"type":"uint256","name":""}],"inputs":[],"stateMutability":"view","type":"function","gas":2531},{"name":"admin_actions_deadline","outputs":[{"type":"uint256","name":""}],"inputs":[],"stateMutability":"view","type":"function","gas":2561},{"name":"transfer_ownership_deadline","outputs":[{"type":"uint256","name":""}],"inputs":[],"stateMutability":"view","type":"function","gas":2591},{"name":"future_fee","outputs":[{"type":"uint256","name":""}],"inputs":[],"stateMutability":"view","type":"function","gas":2621},{"name":"future_admin_fee","outputs":[{"type":"uint256","name":""}],"inputs":[],"stateMutability":"view","type":"function","gas":2651},{"name":"future_owner","outputs":[{"type":"address","name":""}],"inputs":[],"stateMutability":"view","type":"function","gas":2681}] abis.abisBTC = [{"name":"TokenExchange","inputs":[{"type":"address","name":"buyer","indexed":true},{"type":"int128","name":"sold_id","indexed":false},{"type":"uint256","name":"tokens_sold","indexed":false},{"type":"int128","name":"bought_id","indexed":false},{"type":"uint256","name":"tokens_bought","indexed":false}],"anonymous":false,"type":"event"},{"name":"AddLiquidity","inputs":[{"type":"address","name":"provider","indexed":true},{"type":"uint256[3]","name":"token_amounts","indexed":false},{"type":"uint256[3]","name":"fees","indexed":false},{"type":"uint256","name":"invariant","indexed":false},{"type":"uint256","name":"token_supply","indexed":false}],"anonymous":false,"type":"event"},{"name":"RemoveLiquidity","inputs":[{"type":"address","name":"provider","indexed":true},{"type":"uint256[3]","name":"token_amounts","indexed":false},{"type":"uint256[3]","name":"fees","indexed":false},{"type":"uint256","name":"token_supply","indexed":false}],"anonymous":false,"type":"event"},{"name":"RemoveLiquidityOne","inputs":[{"type":"address","name":"provider","indexed":true},{"type":"uint256","name":"token_amount","indexed":false},{"type":"uint256","name":"coin_amount","indexed":false}],"anonymous":false,"type":"event"},{"name":"RemoveLiquidityImbalance","inputs":[{"type":"address","name":"provider","indexed":true},{"type":"uint256[3]","name":"token_amounts","indexed":false},{"type":"uint256[3]","name":"fees","indexed":false},{"type":"uint256","name":"invariant","indexed":false},{"type":"uint256","name":"token_supply","indexed":false}],"anonymous":false,"type":"event"},{"name":"CommitNewAdmin","inputs":[{"type":"uint256","name":"deadline","indexed":true,"unit":"sec"},{"type":"address","name":"admin","indexed":true}],"anonymous":false,"type":"event"},{"name":"NewAdmin","inputs":[{"type":"address","name":"admin","indexed":true}],"anonymous":false,"type":"event"},{"name":"CommitNewFee","inputs":[{"type":"uint256","name":"deadline","indexed":true,"unit":"sec"},{"type":"uint256","name":"fee","indexed":false},{"type":"uint256","name":"admin_fee","indexed":false}],"anonymous":false,"type":"event"},{"name":"NewFee","inputs":[{"type":"uint256","name":"fee","indexed":false},{"type":"uint256","name":"admin_fee","indexed":false}],"anonymous":false,"type":"event"},{"name":"RampA","inputs":[{"type":"uint256","name":"old_A","indexed":false},{"type":"uint256","name":"new_A","indexed":false},{"type":"uint256","name":"initial_time","indexed":false,"unit":"sec"},{"type":"uint256","name":"future_time","indexed":false,"unit":"sec"}],"anonymous":false,"type":"event"},{"name":"StopRampA","inputs":[{"type":"uint256","name":"A","indexed":false},{"type":"uint256","name":"t","indexed":false,"unit":"sec"}],"anonymous":false,"type":"event"},{"outputs":[],"inputs":[{"type":"address[3]","name":"_coins"},{"type":"address","name":"_pool_token"},{"type":"uint256","name":"_A"},{"type":"uint256","name":"_fee"}],"constant":false,"payable":false,"type":"constructor"},{"name":"A","outputs":[{"type":"uint256","name":""}],"inputs":[],"constant":true,"payable":false,"type":"function","gas":5227},{"name":"get_virtual_price","outputs":[{"type":"uint256","name":""}],"inputs":[],"constant":true,"payable":false,"type":"function","gas":1150488},{"name":"calc_token_amount","outputs":[{"type":"uint256","name":""}],"inputs":[{"type":"uint256[3]","name":"amounts"},{"type":"bool","name":"deposit"}],"constant":true,"payable":false,"type":"function","gas":4526955},{"name":"add_liquidity","outputs":[],"inputs":[{"type":"uint256[3]","name":"amounts"},{"type":"uint256","name":"min_mint_amount"}],"constant":false,"payable":false,"type":"function","gas":6972762},{"name":"get_dy","outputs":[{"type":"uint256","name":""}],"inputs":[{"type":"int128","name":"i"},{"type":"int128","name":"j"},{"type":"uint256","name":"dx"}],"constant":true,"payable":false,"type":"function","gas":2687932},{"name":"get_dy_underlying","outputs":[{"type":"uint256","name":""}],"inputs":[{"type":"int128","name":"i"},{"type":"int128","name":"j"},{"type":"uint256","name":"dx"}],"constant":true,"payable":false,"type":"function","gas":2687745},{"name":"exchange","outputs":[],"inputs":[{"type":"int128","name":"i"},{"type":"int128","name":"j"},{"type":"uint256","name":"dx"},{"type":"uint256","name":"min_dy"}],"constant":false,"payable":false,"type":"function","gas":5499133},{"name":"remove_liquidity","outputs":[],"inputs":[{"type":"uint256","name":"_amount"},{"type":"uint256[3]","name":"min_amounts"}],"constant":false,"payable":false,"type":"function","gas":196975},{"name":"remove_liquidity_imbalance","outputs":[],"inputs":[{"type":"uint256[3]","name":"amounts"},{"type":"uint256","name":"max_burn_amount"}],"constant":false,"payable":false,"type":"function","gas":6972281},{"name":"calc_withdraw_one_coin","outputs":[{"type":"uint256","name":""}],"inputs":[{"type":"uint256","name":"_token_amount"},{"type":"int128","name":"i"}],"constant":true,"payable":false,"type":"function","gas":15405},{"name":"remove_liquidity_one_coin","outputs":[],"inputs":[{"type":"uint256","name":"_token_amount"},{"type":"int128","name":"i"},{"type":"uint256","name":"min_amount"}],"constant":false,"payable":false,"type":"function","gas":4044074},{"name":"ramp_A","outputs":[],"inputs":[{"type":"uint256","name":"_future_A"},{"type":"uint256","unit":"sec","name":"_future_time"}],"constant":false,"payable":false,"type":"function","gas":151937},{"name":"stop_ramp_A","outputs":[],"inputs":[],"constant":false,"payable":false,"type":"function","gas":148697},{"name":"commit_new_fee","outputs":[],"inputs":[{"type":"uint256","name":"new_fee"},{"type":"uint256","name":"new_admin_fee"}],"constant":false,"payable":false,"type":"function","gas":110521},{"name":"apply_new_fee","outputs":[],"inputs":[],"constant":false,"payable":false,"type":"function","gas":97220},{"name":"revert_new_parameters","outputs":[],"inputs":[],"constant":false,"payable":false,"type":"function","gas":21955},{"name":"commit_transfer_ownership","outputs":[],"inputs":[{"type":"address","name":"_owner"}],"constant":false,"payable":false,"type":"function","gas":74632},{"name":"apply_transfer_ownership","outputs":[],"inputs":[],"constant":false,"payable":false,"type":"function","gas":60688},{"name":"revert_transfer_ownership","outputs":[],"inputs":[],"constant":false,"payable":false,"type":"function","gas":22045},{"name":"withdraw_admin_fees","outputs":[],"inputs":[],"constant":false,"payable":false,"type":"function","gas":17565},{"name":"kill_me","outputs":[],"inputs":[],"constant":false,"payable":false,"type":"function","gas":37998},{"name":"unkill_me","outputs":[],"inputs":[],"constant":false,"payable":false,"type":"function","gas":22135},{"name":"coins","outputs":[{"type":"address","name":""}],"inputs":[{"type":"int128","name":"arg0"}],"constant":true,"payable":false,"type":"function","gas":2310},{"name":"balances","outputs":[{"type":"uint256","name":""}],"inputs":[{"type":"int128","name":"arg0"}],"constant":true,"payable":false,"type":"function","gas":2340},{"name":"fee","outputs":[{"type":"uint256","name":""}],"inputs":[],"constant":true,"payable":false,"type":"function","gas":2171},{"name":"admin_fee","outputs":[{"type":"uint256","name":""}],"inputs":[],"constant":true,"payable":false,"type":"function","gas":2201},{"name":"owner","outputs":[{"type":"address","name":""}],"inputs":[],"constant":true,"payable":false,"type":"function","gas":2231},{"name":"initial_A","outputs":[{"type":"uint256","name":""}],"inputs":[],"constant":true,"payable":false,"type":"function","gas":2261},{"name":"future_A","outputs":[{"type":"uint256","name":""}],"inputs":[],"constant":true,"payable":false,"type":"function","gas":2291},{"name":"initial_A_time","outputs":[{"type":"uint256","unit":"sec","name":""}],"inputs":[],"constant":true,"payable":false,"type":"function","gas":2321},{"name":"future_A_time","outputs":[{"type":"uint256","unit":"sec","name":""}],"inputs":[],"constant":true,"payable":false,"type":"function","gas":2351},{"name":"admin_actions_deadline","outputs":[{"type":"uint256","unit":"sec","name":""}],"inputs":[],"constant":true,"payable":false,"type":"function","gas":2381},{"name":"transfer_ownership_deadline","outputs":[{"type":"uint256","unit":"sec","name":""}],"inputs":[],"constant":true,"payable":false,"type":"function","gas":2411},{"name":"future_fee","outputs":[{"type":"uint256","name":""}],"inputs":[],"constant":true,"payable":false,"type":"function","gas":2441},{"name":"future_admin_fee","outputs":[{"type":"uint256","name":""}],"inputs":[],"constant":true,"payable":false,"type":"function","gas":2471},{"name":"future_owner","outputs":[{"type":"address","name":""}],"inputs":[],"constant":true,"payable":false,"type":"function","gas":2501}]; +abis.cTokens = [{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"spender","type":"address"},{"name":"amount","type":"uint256"}],"name":"approve","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"repayAmount","type":"uint256"}],"name":"repayBorrow","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"reserveFactorMantissa","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"account","type":"address"}],"name":"borrowBalanceCurrent","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"exchangeRateStored","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"src","type":"address"},{"name":"dst","type":"address"},{"name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"borrower","type":"address"},{"name":"repayAmount","type":"uint256"}],"name":"repayBorrowBehalf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"pendingAdmin","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"owner","type":"address"}],"name":"balanceOfUnderlying","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"getCash","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"newComptroller","type":"address"}],"name":"_setComptroller","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalBorrows","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"comptroller","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"reduceAmount","type":"uint256"}],"name":"_reduceReserves","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"initialExchangeRateMantissa","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"accrualBlockNumber","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"underlying","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"totalBorrowsCurrent","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"redeemAmount","type":"uint256"}],"name":"redeemUnderlying","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalReserves","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"account","type":"address"}],"name":"borrowBalanceStored","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"mintAmount","type":"uint256"}],"name":"mint","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"accrueInterest","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"dst","type":"address"},{"name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"borrowIndex","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"supplyRatePerBlock","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"liquidator","type":"address"},{"name":"borrower","type":"address"},{"name":"seizeTokens","type":"uint256"}],"name":"seize","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"newPendingAdmin","type":"address"}],"name":"_setPendingAdmin","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"exchangeRateCurrent","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"account","type":"address"}],"name":"getAccountSnapshot","outputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"borrowAmount","type":"uint256"}],"name":"borrow","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"redeemTokens","type":"uint256"}],"name":"redeem","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"owner","type":"address"},{"name":"spender","type":"address"}],"name":"allowance","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"_acceptAdmin","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"newInterestRateModel","type":"address"}],"name":"_setInterestRateModel","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"interestRateModel","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"borrower","type":"address"},{"name":"repayAmount","type":"uint256"},{"name":"cTokenCollateral","type":"address"}],"name":"liquidateBorrow","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"admin","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"borrowRatePerBlock","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"newReserveFactorMantissa","type":"uint256"}],"name":"_setReserveFactor","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"isCToken","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"underlying_","type":"address"},{"name":"comptroller_","type":"address"},{"name":"interestRateModel_","type":"address"},{"name":"initialExchangeRateMantissa_","type":"uint256"},{"name":"name_","type":"string"},{"name":"symbol_","type":"string"},{"name":"decimals_","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"name":"interestAccumulated","type":"uint256"},{"indexed":false,"name":"borrowIndex","type":"uint256"},{"indexed":false,"name":"totalBorrows","type":"uint256"}],"name":"AccrueInterest","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"minter","type":"address"},{"indexed":false,"name":"mintAmount","type":"uint256"},{"indexed":false,"name":"mintTokens","type":"uint256"}],"name":"Mint","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"redeemer","type":"address"},{"indexed":false,"name":"redeemAmount","type":"uint256"},{"indexed":false,"name":"redeemTokens","type":"uint256"}],"name":"Redeem","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"borrower","type":"address"},{"indexed":false,"name":"borrowAmount","type":"uint256"},{"indexed":false,"name":"accountBorrows","type":"uint256"},{"indexed":false,"name":"totalBorrows","type":"uint256"}],"name":"Borrow","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"payer","type":"address"},{"indexed":false,"name":"borrower","type":"address"},{"indexed":false,"name":"repayAmount","type":"uint256"},{"indexed":false,"name":"accountBorrows","type":"uint256"},{"indexed":false,"name":"totalBorrows","type":"uint256"}],"name":"RepayBorrow","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"liquidator","type":"address"},{"indexed":false,"name":"borrower","type":"address"},{"indexed":false,"name":"repayAmount","type":"uint256"},{"indexed":false,"name":"cTokenCollateral","type":"address"},{"indexed":false,"name":"seizeTokens","type":"uint256"}],"name":"LiquidateBorrow","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"oldPendingAdmin","type":"address"},{"indexed":false,"name":"newPendingAdmin","type":"address"}],"name":"NewPendingAdmin","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"oldAdmin","type":"address"},{"indexed":false,"name":"newAdmin","type":"address"}],"name":"NewAdmin","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"oldComptroller","type":"address"},{"indexed":false,"name":"newComptroller","type":"address"}],"name":"NewComptroller","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"oldInterestRateModel","type":"address"},{"indexed":false,"name":"newInterestRateModel","type":"address"}],"name":"NewMarketInterestRateModel","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"oldReserveFactorMantissa","type":"uint256"},{"indexed":false,"name":"newReserveFactorMantissa","type":"uint256"}],"name":"NewReserveFactor","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"admin","type":"address"},{"indexed":false,"name":"reduceAmount","type":"uint256"},{"indexed":false,"name":"newTotalReserves","type":"uint256"}],"name":"ReservesReduced","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"error","type":"uint256"},{"indexed":false,"name":"info","type":"uint256"},{"indexed":false,"name":"detail","type":"uint256"}],"name":"Failure","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":true,"name":"spender","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"Approval","type":"event"}]; + + abis.yTokens = [{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"constant":true,"inputs":[],"name":"aave","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"aaveToken","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"approveToken","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"apr","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"balance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"balanceAave","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"balanceCompound","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"balanceCompoundInToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"balanceDydx","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"balanceFulcrum","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"balanceFulcrumInToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"calcPoolValueInToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"compound","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"dToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"deposit","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"dydx","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"fulcrum","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getAave","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getAaveCore","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getPricePerFullShare","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"isOwner","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"pool","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"provider","outputs":[{"internalType":"enum yTUSD.Lender","name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"rebalance","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"recommend","outputs":[{"internalType":"enum yTUSD.Lender","name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"renounceOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_new_APR","type":"address"}],"name":"set_new_APR","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_new_COMPOUND","type":"address"}],"name":"set_new_COMPOUND","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"_new_DTOKEN","type":"uint256"}],"name":"set_new_DTOKEN","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"supplyAave","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"supplyCompound","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"supplyDydx","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"supplyFulcrum","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"token","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"_shares","type":"uint256"}],"name":"withdraw","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}] + + module.exports = { abis -} +} \ No newline at end of file diff --git a/projects/curve/historical/index.js b/projects/curve/historical/index.js new file mode 100644 index 00000000000..f08307340c1 --- /dev/null +++ b/projects/curve/historical/index.js @@ -0,0 +1,254 @@ +const ADDRESSES = require('../../helper/coreAssets.json') +const { Web3 } = require('web3'); +const BigNumber = require("bignumber.js"); +const axios = require("axios"); +const web3 = new Web3(`https://eth.llamarpc.com`); +const abis = require('./abis.js') +const { toUSDTBalances } = require('../../helper/balances') + + +let swaps = [ + { + 'name': 'tbtc', + 'address': '0xc25099792e9349c7dd09759744ea681c7de2cb66', + 'coins': [0], + 'type': 'btc', + 'abi': abis.abis.abiNew + }, + { + 'name': 'hbtc', + 'address': '0x4CA9b3063Ec5866A4B82E437059D2C43d1be596F', + 'coins': [0], + 'type': 'btc', + 'abi': abis.abis.abiNew + }, + { + 'name': 'sbtc', + 'address': '0x7fC77b5c7614E1533320Ea6DDc2Eb61fa00A9714', + 'coins': [0,1,2], + 'type': 'btc', + 'abi': abis.abis.abisBTC + }, + { + 'name': 'ren', + 'address': '0x93054188d876f558f4a66B2EF1d97d16eDf0895B', + 'coins': [0,1], + 'type': 'btc', + 'abi': abis.abis.abisBTC + }, + { + 'name': 'rsv', + 'address': '0xC18cC39da8b11dA8c3541C598eE022258F9744da', + 'coins': [0], + 'type': 1, + 'abi': abis.abis.abiNew + }, + { + 'name': 'musd', + 'address': '0x8474DdbE98F5aA3179B3B3F5942D724aFcdec9f6', + 'coins': [0], + 'type': 1, + 'abi': abis.abis.abiNew + }, + { + 'name': 'linkusd', + 'address': '0xE7a24EF0C5e95Ffb0f6684b813A78F2a3AD7D171', + 'coins': [0], + 'type': 1, + 'abi': abis.abis.abiNew + }, + { + 'name': 'usdn', + 'address': '0x0f9cb53Ebe405d49A0bbdBD291A65Ff571bC83e1', + 'coins': [0], + 'type': 1, + 'abi': abis.abis.abiNew + }, + { + 'name': 'usdk', + 'address': '0x3E01dD8a5E1fb3481F0F589056b428Fc308AF0Fb', + 'coins': [0], + 'type': 1, + 'abi': abis.abis.abiNew + }, + { + 'name': 'gusd', + 'address': '0x4f062658EaAF2C1ccf8C8e36D6824CDf41167956', + 'coins': [0], + 'type': 1, + 'abi': abis.abis.abiNew + }, + { + 'name': 'compoundv1', + 'address': '0xA2B47E3D5c44877cca798226B7B8118F9BFb7A56', + 'coins': [0,1], + 'type': 'compound', + 'abi': abis.abis.compoundv1 + }, + { + 'name': 'usdtPool', + 'address': '0x52EA46506B9CC5Ef470C5bf89f17Dc28bB35D85C', + 'coins': [0,1,2], + 'type': 'compound', + 'abi': abis.abis.compoundv1 + }, + { + 'name': 'YPool', + 'address': '0x45F783CCE6B7FF23B2ab2D70e416cdb7D6055f51', + 'coins': [0,1,2,3], + 'type': 'yToken', + 'abi': abis.abis.compoundv1 + }, + { + 'name': 'PAX', + 'address': '0x06364f10B501e868329afBc005b3492902d6C763', + 'coins': [0,1,2,3], + 'type': 'yToken', + 'abi': abis.abis.compoundv1 + }, + { + 'name': 'BUSD', + 'address': '0x79a8C46DeA5aDa233ABaFFD40F3A0A2B1e5A4F27', + 'coins': [0,1,2,3], + 'type': 'yToken', + 'abi': abis.abis.compoundv1 + }, + { + 'name': 'sUSD', + 'address': '0xA5407eAE9Ba41422680e2e00537571bcC53efBfD', + 'coins': [0,1,2,3], + 'type': 1, + 'abi': abis.abis.abisBTC + }, + { + 'name': '3Pool', + 'address': '0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7', + 'coins': [0,1,2], + 'type': 1, + 'abi': abis.abis.abiNew + }, + { + 'name': 'DUSD', + 'address': '0x8038C01A0390a8c547446a0b2c18fc9aEFEcc10c', + 'coins': [0], + 'type': 1, + 'abi': abis.abis.abiNew + }, + + + +] + +let coinDecimals = [ + { + '0x8dAEBADE922dF735c38C80C7eBD708Af50815fAa': '18', + '0x0316EB71485b0Ab14103307bf65a021042c6d380': '18', + '0xEB4C2781e4ebA804CE9a9803C67d0893436bB27D': '8', + [ADDRESSES.ethereum.WBTC]: '8', + '0xfE18be6b3Bd88A2D2A7f928d00292E7a9963CfC6': '18', + '0x196f4727526eA7FB1e17b2071B3d8eAA38486988': '18', + '0xe2f2a5C287993345a840Db3B0845fbC70f5935a5': '18', + '0x0E2EC54fC0B509F445631Bf4b91AB8168230C752': '18', //linkusd + '0x674C6Ad92Fd080e4004b2312b45f796a192D27a0': '18', //USDN + '0x1c48f86ae57291F7686349F12601910BD8D470bb': '18', //USDK + '0x056Fd409E1d7A124BD7017459dFEa2F387b6d5Cd': '2', //GUSD + '0x39AA39c021dfbaE8faC545936693aC917d5E7563': '8', //cUSD + '0x5d3a536E4D6DbD6114cc1Ead35777bAB948E3643': '8', //cDAI + [ADDRESSES.ethereum.USDT]: '6', //USDT + '0x73a052500105205d34Daf004eAb301916DA8190f': '18', //yTUSD + '0xd6aD7a6750A7593E092a9B218d66C0A814a3436e': '6', ///yUSDC + '0x16de59092dAE5CcF4A1E6439D611fd0653f0Bd01': '18', ///yDAI + '0x83f798e925BcD4017Eb265844FDDAbb448f1707D': '6', ///yUSDT + '0x8E870D67F660D95d5be530380D0eC0bd388289E1': '18', //PAX + '0x9777d7E2b60bB01759D0E2f8be2095df444cb07E': '6', ///ycUSDC + '0x99d1Fa417f94dcD62BfE781a1213c092a47041Bc': '18', ///ycDAI + '0x1bE5d71F2dA660BFdee8012dDc58D024448A0A59': '6', ///ycUSDT + '0x04bC0Ab673d88aE9dbC9DA2380cB6B79C4BCa9aE': '18', //Y2busd + '0x26EA744E5B887E5205727f55dFBE8685e3b21951': '6', ///y2USDC + '0xC2cB1040220768554cf699b0d863A3cd4324ce32': '18', ///y2DAI + '0xE6354ed5bC4b393a5Aad09f21c46E101e692d447': '6', ///y2USDT + [ADDRESSES.ethereum.sUSD]: '18', //sUSD + [ADDRESSES.ethereum.DAI]: '18', //DAI + [ADDRESSES.ethereum.USDC]: '6', //USDC + '0x5BC25f649fc4e26069dDF4cF4010F9f706c23831': '18', //dusd + [ADDRESSES.ethereum.TUSD]: '18' + } +] + +async function tvlFunc(timestamp, block) { + var price_feed = await axios.get(`https://coins.llama.fi/prices/historical/${timestamp}/${["bitcoin","cdai","compound-usd-coin"].map(c=>"coingecko:"+c).join(',')}`) + var tvl = 0; + var btcTVL = 0; + await Promise.all( + swaps.map(async item => { + var details = {}; + await Promise.all( + item.coins.map(async i => { + try{ + const poolAmount = await calc(item, i, price_feed, block); + if (item.type == 'btc') { + btcTVL += parseFloat(poolAmount); + } else { + tvl += parseFloat(poolAmount ) + } + } catch(e){ + console.log(item.name, i, "failed") + } + }) + ) + }) + ) + + tvl = (price_feed.data.coins['coingecko:bitcoin'].price * btcTVL) + tvl + return toUSDTBalances(tvl); +} + +async function getVirtualPrice(abi, contract, block) { + var dacontract = new web3.eth.Contract(abi, contract) + dacontract.defaultBlock = block; + var virtualPrice = await dacontract.methods.getPricePerFullShare().call(); + return virtualPrice; +} + + + + + +async function calc(item, i, price_feed, block) { + var dacontract = new web3.eth.Contract(item.abi, item.address) + dacontract.defaultBlock = block + var balances = await dacontract.methods.balances(i).call(); + var coins = await dacontract.methods.coins(i).call(); + + + var poolAmount = await new BigNumber(balances).div(10 ** coinDecimals[0][coins]).toFixed(2); + + let multiplier; + if (item.type == 'compound') { + multiplier = 1; + if (coins === '0x39AA39c021dfbaE8faC545936693aC917d5E7563') { + multiplier = price_feed.data.coins['coingecko:compound-usd-coin'].price; + } + if (coins === '0x5d3a536E4D6DbD6114cc1Ead35777bAB948E3643') { + multiplier = price_feed.data.coins['coingecko:cdai'].price; + } + poolAmount = poolAmount * multiplier; + } + + if (item.type == 'yToken') { + multiplier = 1; + if (coins !== '0x8E870D67F660D95d5be530380D0eC0bd388289E1') { // PAX exception + multiplier = await getVirtualPrice(abis.abis.yTokens, coins, block) + multiplier = await new BigNumber(multiplier).div(10 ** 18).toFixed(4); + } + poolAmount = poolAmount * multiplier; + } + + return poolAmount; +} + + + +module.exports = { + ethereum:{tvlFunc} +} diff --git a/projects/curve/index.js b/projects/curve/index.js index 510ee6bb244..ac61aed4614 100644 --- a/projects/curve/index.js +++ b/projects/curve/index.js @@ -1,14 +1,15 @@ -const { unwrapYearn, sumTokensSharedOwners } = require("../helper/unwrapLPs"); +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensSharedOwners, nullAddress, sumTokens2, } = require("../helper/unwrapLPs"); const { getChainTransform } = require("../helper/portedTokens"); +const { getCache } = require("../helper/http"); +const { getUniqueAddresses } = require("../helper/utils"); const { staking } = require("../helper/staking.js"); -const BigNumber = require("bignumber.js"); const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); -const creamAbi = require("../helper/abis/cream.json"); +const erc20Abi = require("../helper/abis/erc20.json"); const contracts = require("./contracts.json"); -const { requery } = require("../helper/requery"); -const { get } = require('../helper/http') -const { getBlock } = require("../helper/getBlock"); +const { getLogs } = require('../helper/cache/getLogs') + const chains = [ "ethereum", //-200M "polygon", //-40M @@ -19,6 +20,7 @@ const chains = [ "optimism", //-6M "xdai", //G "moonbeam", + "celo", "kava" ]; // Object.keys(contracts); const registryIds = { @@ -27,236 +29,97 @@ const registryIds = { crypto: 5, cryptoFactory: 6 }; - -async function getPools(block, chain) { - const registries = (await sdk.api.abi.multiCall({ - block, - chain, - calls: Object.values(registryIds).map(r => ({ - params: r - })), - target: contracts[chain].addressProvider, - abi: abi.get_id_info - })).output.map(r => r.output.addr); - - const poolCounts = (await sdk.api.abi.multiCall({ - block, - chain, - calls: registries.map(r => ({ - target: r - })), - abi: abi.pool_count - })).output; - - const pools = {}; - for (let i = 0; i < Object.values(registryIds).length; i++) { - pools[Object.keys(registryIds)[i]] = (await sdk.api.abi.multiCall({ - calls: [...Array(Number(poolCounts[i].output)).keys()].map(n => ({ - target: poolCounts[i].input.target, - params: [n] - })), - block, - chain, - abi: abi.pool_list - })).output; - } - - let allPools = {}; - Object.entries(pools).map(([key, list]) => { - pools[key] = list.filter(p => { - if (allPools[p.output] === undefined) { - allPools[p.output] = true; - return true; - } else { - return false; - } - }); - }); - - return pools; +const decimalsCache = {} +const nameCache = {} + +async function getDecimals(chain, token) { + token = token.toLowerCase() + const key = chain + '-' + token + if (!decimalsCache[key]) decimalsCache[key] = sdk.api.erc20.decimals(token, chain) + return decimalsCache[key] } -function aggregateBalanceCalls(coins, nCoins, poolList, registry) { - let calls = []; - if (registry == "cryptoFactory") { - coins.map((coin, i) => - [...Array(Number(coin.output.length)).keys()].map(n => - calls.push({ - params: [poolList[i].output], - target: coin.output[n] - }) - ) - ); - } else { - coins.map((coin, i) => - [...Array(Number(nCoins[i].output[0])).keys()].map(n => - calls.push({ - params: [poolList[i].output], - target: coin.output[n] - }) - ) - ); - } - return calls; -} - -async function fixGasTokenBalances(poolBalances, block, chain) { - for (let i = 0; i < poolBalances.output.length; i++) { - if ( - poolBalances.output[i].success == false && - poolBalances.output[i].input.target.toLowerCase() == - contracts[chain].gasTokenDummy - ) { - const ethBalance = (await sdk.api.eth.getBalance({ - target: poolBalances.output[i].input.params[0], - block, - chain - })).output; - poolBalances.output[i].success = true; - poolBalances.output[i].output = ethBalance; - poolBalances.output[i].input.target = contracts[chain].wrapped; - } - } +const gasTokens = [ + '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee', + ADDRESSES.null, +] + +async function getNames(chain, tokens) { + tokens = tokens.map(i => i.toLowerCase()) + const mapping = {} + const missing = [] + tokens.forEach(i => { + const key = chain + '-' + i + if (key === 'ethereum-0x6b8734ad31d42f5c05a86594314837c416ada984') mapping[i] = '' + else if (nameCache[key] || gasTokens.includes(i)) mapping[i] = nameCache[key] + else missing.push(i) + }) + + const res = await sdk.api2.abi.multiCall({ + abi: erc20Abi.name, + calls: missing, + chain, + permitFailure: true, + }) + res.forEach((name, i) => { + const key = chain + '-' + missing[i] + nameCache[key] = name ?? '' + mapping[missing[i]] = nameCache[key] + }) + + return mapping } -async function fixWrappedTokenBalances(balances, block, chain, transform) { - if ("yearnTokens" in contracts[chain]) { - for (let token of Object.values(contracts[chain].yearnTokens)) { - if (token in balances) { - await unwrapYearn(balances, token, block, chain, transform); - } - } - } +const registryIdsReverse = Object.fromEntries(Object.entries(registryIds).map(i => i.reverse())) - if ("creamTokens" in contracts[chain]) { - const creamTokens = Object.values(contracts[chain].creamTokens); - await unwrapCreamTokens(balances, block, chain, creamTokens, transform); - } - - if ("sdTokens" in contracts[chain]) { - await unwrapSdTokens(balances, contracts[chain].sdTokens, chain); - } - - const stDOT = "moonbeam:0xfa36fe1da08c89ec72ea1f0143a35bfd5daea108"; - if (stDOT in balances) { - balances["bsc:0x7083609fce4d1d8dc0c979aab8c869ea2c873402"] = BigNumber( - balances[stDOT] - ) - .times(1e8) - .toFixed(0); - delete balances[stDOT]; - } +async function getPool({ chain, block, registry }) { + const data = await sdk.api2.abi.fetchList({ chain, block, target: registry, itemAbi: abi.pool_list, lengthAbi: abi.pool_count, withMetadata: true, }) + return data.filter(i => i.output) } -async function unwrapCreamTokens( - balances, - block, - chain, - creamTokens, - transform -) { - const [exchangeRates, underlyingTokens] = await Promise.all([ - sdk.api.abi.multiCall({ - calls: creamTokens.map(t => ({ - target: t - })), - abi: creamAbi.exchangeRateStored, - block, - chain - }), - sdk.api.abi.multiCall({ - calls: creamTokens.map(t => ({ - target: t - })), - abi: creamAbi.underlying, - block, - chain - }) - ]); - for (let i = 0; i < creamTokens.length; i++) { - if (!(creamTokens[i] in balances)) continue; - const underlying = underlyingTokens.output[i].output; - const balance = BigNumber(balances[creamTokens[i]]) - .times(exchangeRates.output[i].output) - .div(1e18) - .toFixed(0); - sdk.util.sumSingleBalance(balances, transform(underlying), balance); - delete balances[creamTokens[i]]; - delete balances[`${chain}:${creamTokens[i]}`]; - } +function getRegistryType(registryId) { + if (!registryIdsReverse[registryId]) throw new Error('Unknown registry id: ' + registryId) + return registryIdsReverse[registryId] } -function deleteMetapoolBaseBalances(balances, chain) { - for (let token of Object.values(contracts[chain].metapoolBases)) { - if (!(token in balances || `${chain}:${token}` in balances)) continue; - delete balances[token]; - delete balances[`${chain}:${token}`]; +async function getPools(block, chain) { + let { registriesMapping } = contracts[chain] + if (!registriesMapping) { + registriesMapping = {}; + (await sdk.api.abi.multiCall({ + block, chain, + calls: Object.values(registryIds).map(r => ({ params: r })), + target: contracts[chain].addressProvider, + abi: abi.get_id_info + })).output + .filter(r => r.output.addr !== nullAddress) + .forEach(({ input: { params: [registryId] }, output: { addr } }) => registriesMapping[getRegistryType(registryId)] = addr) } -} - -function mapGaugeTokenBalances(calls, chain) { - const mapping = { - // token listed in coins() mapped to gauge token held in contract - //"0xe7a24ef0c5e95ffb0f6684b813a78f2a3ad7d171": "0x19793b454d3afc7b454f206ffe95ade26ca6912c", // maybe not? 4 0s poly - "0x7f90122bf0700f9e7e1f688fe926940e8839f353": { - to: "0xbf7e49483881c76487b0989cd7d9a8239b20ca41", - pools: [], - chains: [] - }, // need a pool conditional - only for (1) ['0x30dF229cefa463e991e29D42DB0bae2e122B2AC7'] - "0x1337bedc9d22ecbe766df105c9623922a27963ec": { - to: "0x5b5cfe992adac0c9d48e05854b2d91c73a003858", - pools: [], - chains: ["avax"] - }, - "0x27e611fd27b276acbd5ffd632e5eaebec9761e40": { - to: "0x8866414733F22295b7563f9C5299715D2D76CAf4", - pools: [], - chains: ["fantom"] - }, - "0xd02a30d33153877bc20e5721ee53dedee0422b2f": { - to: "0xd4f94d0aaa640bbb72b5eec2d85f6d114d81a88e", - pools: [], - chains: ["fantom"] - } - }; + const poolList = {} + await Promise.all(Object.entries(registriesMapping).map(async ([registry, addr]) => { + poolList[registry] = await getPool({ chain, block, registry: addr }) + })) - return calls.map(function (c) { - let target = c.target; - if ( - c.target.toLowerCase() in mapping && - (mapping[c.target.toLowerCase()].pools.includes( - c.params[0].toLowerCase() - ) || - mapping[c.target.toLowerCase()].chains.includes(chain)) - ) { - target = mapping[c.target.toLowerCase()].to; - } - return { target, params: c.params }; - }); + return poolList } -async function unwrapSdTokens(balances, sdTokens, chain) { - const apiData = (await get("https://lockers.stakedao.org/api/lockers") - ).map(t => ({ - address: t.tokenReceipt.address.toLowerCase(), - usdPrice: t.tokenPriceUSD, - decimals: t.tokenReceipt.decimals - })); - - for (let token of Object.values(sdTokens)) { - if (token in balances) { - const tokenInfo = apiData.filter(t => t.address == token)[0]; - - sdk.util.sumSingleBalance( - balances, - "usd-coin", - balances[token] * tokenInfo.usdPrice / 10 ** tokenInfo.decimals - ); - delete balances[token]; - delete balances[`${chain}:{token}`]; +function aggregateBalanceCalls({ coins, nCoins, wrapped }) { + const toa = [] + coins.map(({ input, output }, i) => { + const owner = input.params[0] + const addToken = t => { + if (t.toLowerCase() === wrapped.toLowerCase()) + toa.push([nullAddress, owner]) + toa.push([t, owner]) } - } + if (!Object.keys(nCoins).length) + output.forEach(token => addToken(token)) + else + for (let index = 0; index < nCoins[i].output[0]; index++) + addToken(output[index]) + }) + return toa; } async function handleUnlistedFxTokens(balances, chain) { @@ -265,8 +128,8 @@ async function handleUnlistedFxTokens(balances, chain) { for (let token of tokens) { if (token.address in balances) { const [rate, { output: decimals }] = await Promise.all([ - get(`https://api.exchangerate.host/convert?from=${token.currency}&to=USD`), - sdk.api.erc20.decimals(token.address, chain) + getCache(`https://api.exchangerate.host/convert?from=${token.currency}&to=USD`), + getDecimals(chain, token.address) ]); sdk.util.sumSingleBalance( @@ -282,74 +145,83 @@ async function handleUnlistedFxTokens(balances, chain) { return; } -async function unwrapPools( - balances, - block, - chain, - transform, - poolList, - registry -) { - const [{ output: nCoins }, { output: coins }] = await Promise.all([ - sdk.api.abi.multiCall({ - calls: poolList.map(p => ({ - target: p.input.target, - params: [p.output] - })), - block, - chain, - abi: abi.get_n_coins[registry] - }), - sdk.api.abi.multiCall({ - calls: poolList.map(p => ({ - target: p.input.target, - params: p.output - })), - block, - chain, - abi: abi.get_coins[registry] - }) - ]); - - let calls = aggregateBalanceCalls(coins, nCoins, poolList, registry); - calls = mapGaugeTokenBalances(calls, chain); - - let poolBalances = await sdk.api.abi.multiCall({ - calls, - block, - chain, - abi: "erc20:balanceOf" - }); - requery(poolBalances, chain, block, "erc20:balanceOf"); - await fixGasTokenBalances(poolBalances, block, chain); +async function unwrapPools({ poolList, registry, chain, block }) { + if (!poolList.length) return; + const registryAddress = poolList[0].input.target + + const callParams = { target: registryAddress, calls: poolList.map(i => ({ params: i.output })), chain, block, } + const { output: coins } = await sdk.api.abi.multiCall({ ...callParams, abi: abi.get_coins[registry] }) + let nCoins = {} + if (registry !== 'cryptoFactory') + nCoins = (await sdk.api.abi.multiCall({ ...callParams, abi: abi.get_n_coins[registry] })).output + + let { wrapped = '', metapoolBases = {}, blacklist = [] } = contracts[chain] + wrapped = wrapped.toLowerCase() + let calls = aggregateBalanceCalls({ coins, nCoins, wrapped }); + const allTokens = getUniqueAddresses(calls.map(i => i[0])) + const tokenNames = await getNames(chain, allTokens) + const blacklistedTokens = [...blacklist, ...(Object.values(metapoolBases))] + Object.entries(tokenNames).forEach(([token, name]) => { + if ((name ?? '').startsWith('Curve.fi ')) { + sdk.log(chain, 'blacklisting', name) + blacklistedTokens.push(token) + } + }) + return { tokensAndOwners: calls, blacklistedTokens } +} - sdk.util.sumMultiBalanceOf(balances, poolBalances, false, transform); +const blacklists = { + ethereum: ['0x6b8734ad31d42f5c05a86594314837c416ada984', '0x95ECDC6caAf7E4805FCeF2679A92338351D24297', '0x5aa00dce91409b58b6a1338639b9daa63eb22be7', '0xEf1385D2b5dc6D14d5fecB86D53CdBefeCA20fcC', '0xf939E0A03FB07F59A73314E73794Be0E57ac1b4E', '0x29b41fe7d754b8b43d4060bb43734e436b0b9a33'], + arbitrum: ['0x3aef260cb6a5b469f970fae7a1e233dbd5939378'], +} - await fixWrappedTokenBalances(balances, block, chain, transform); - await handleUnlistedFxTokens(balances, chain); - deleteMetapoolBaseBalances(balances, chain); +const config = { + ethereum: { + plainFactoryConfig: [ + { plainFactory: '0x528baca578523855a64ee9c276826f934c86a54c', fromBlock: 17182168 }, + { plainFactory: '0x0145fd99f1dd6e2491e44fca608c481c9c5b97a9', fromBlock: 17182168 }, + ] + }, +} - return balances; -} // node test.js projects/curve/index.js +async function addPlainFactoryConfig({ api, tokensAndOwners, plainFactoryConfig = [] }) { + return Promise.all(plainFactoryConfig.map(async ({ plainFactory, fromBlock }) => { + const logs = await getLogs({ + api, + target: plainFactory, + topics: ['0xb8f6972d6e56d21c47621efd7f02fe68f07a17c999c42245b3abd300f34d61eb'], + eventAbi: 'event PlainPoolDeployed(address[4] coins, uint256 A, uint256 fee, address deployer, address pool)', + onlyArgs: true, + fromBlock, + }) + logs.forEach(log => { + log.coins.forEach((coin, i) => { + if (i > 1 && coin === nullAddress) return; + tokensAndOwners.push([coin, log.pool]) + }) + }) + })) +} function tvl(chain) { - return async (_t, _e, chainBlocks) => { + const { plainFactoryConfig = [] } = config[chain] ?? {} + return async (_t, _e, { [chain]: block }, { api }) => { let balances = {}; const transform = await getChainTransform(chain); - const poolList = await getPools(chainBlocks[chain], chain); - const block = await getBlock(_t, chain, chainBlocks, true); - - for (let registry of Object.keys(poolList)) { - await unwrapPools( - balances, - block, - chain, - transform, - poolList[registry], - registry - ); - } - + const poolLists = await getPools(block, chain); + const promises = [] + + for (const [registry, poolList] of Object.entries(poolLists)) + promises.push(unwrapPools({ poolList, registry, chain, block })) + + const res = (await Promise.all(promises)).filter(i => i) + const tokensAndOwners = res.map(i => i.tokensAndOwners).flat() + const blacklistedTokens = res.map(i => i.blacklistedTokens).flat() + if (blacklists[chain]) + blacklistedTokens.push(...blacklists[chain]) + await addPlainFactoryConfig({ api, tokensAndOwners, plainFactoryConfig }) + await sumTokens2({ balances, chain, block, tokensAndOwners, transformAddress: transform, blacklistedTokens }) + await handleUnlistedFxTokens(balances, chain); return balances; }; } @@ -359,60 +231,46 @@ const chainTypeExports = chains => { (obj, chain) => ({ ...obj, [chain]: { tvl: tvl(chain) } }), {} ); - exports.ethereum["staking"] = staking( - contracts.ethereum.veCRV, - contracts.ethereum.CRV - ); - - exports.harmony = { - tvl: async (ts, ethB, chainB) => { - if (ts > 1655989200) { - // harmony hack - return {}; - } - const block = await getBlock(ts, "harmony", chainB, true); - const balances = {}; - await sumTokensSharedOwners( - balances, - [ - "0xef977d2f931c1978db5f6747666fa1eacb0d0339", - "0x3c2b8be99c50593081eaa2a724f0b8285f5aba8f" - ], - ["0xC5cfaDA84E902aD92DD40194f0883ad49639b023"], - block, - "harmony", - addr => `harmony:${addr}` - ); - return balances; - } - }; - exports.kava = { - tvl: async (ts, ethB, chainB) => { - const block = await getBlock(ts, "kava", chainB, true); - const balances = {}; - await sumTokensSharedOwners( - balances, - [ - "0x765277EebeCA2e31912C9946eAe1021199B39C61", - "0xB44a9B6905aF7c801311e8F4E76932ee959c663C", - "0xfA9343C3897324496A05fC75abeD6bAC29f8A40f" - ], - ["0x7A0e3b70b1dB0D6CA63Cac240895b2D21444A7b9"], - block, - "kava", - addr => `kava:${addr}` - ); - return balances; - } - }; - exports.hallmarks = [ - [1597446675, "CRV Launch"], - [1621213201, "Convex Launch"], - [1642374675, "MIM depeg"], - [1651881600, "UST depeg"], - [1654822801, "stETH depeg"] - ]; return exports; }; module.exports = chainTypeExports(chains); + + +module.exports.ethereum["staking"] = staking( + contracts.ethereum.veCRV, + contracts.ethereum.CRV +); + +module.exports.harmony = { + tvl: async (ts, ethB, chainB) => { + if (ts > 1655989200) { + // harmony hack + return {}; + } + const block = chainB.harmony + const balances = {}; + await sumTokensSharedOwners( + balances, + [ + "0xef977d2f931c1978db5f6747666fa1eacb0d0339", + "0x3c2b8be99c50593081eaa2a724f0b8285f5aba8f" + ], + ["0xC5cfaDA84E902aD92DD40194f0883ad49639b023"], + block, + "harmony", + addr => `harmony:${addr}` + ); + return balances; + } +}; + +module.exports.hallmarks = [ + [1597446675, "CRV Launch"], + [1621213201, "Convex Launch"], + [1642374675, "MIM depeg"], + [1651881600, "UST depeg"], + [1654822801, "stETH depeg"], + [1667692800, "FTX collapse"], + [1690715622, "Reentrancy hack"] +]; diff --git a/projects/cvi/index.js b/projects/cvi/index.js index 4ec1acd2779..7e1ca8a1c28 100644 --- a/projects/cvi/index.js +++ b/projects/cvi/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const { staking, stakings } = require("../helper/staking"); const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); @@ -34,9 +35,9 @@ const platformLiquidityContracts = [ "0xe6e5220291CF78b6D93bd1d08D746ABbC115C64b", ]; -const USDT = "0xdac17f958d2ee523a2206206994597c13d831ec7"; -const WETH = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"; -const USDC = "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"; +const USDT = ADDRESSES.ethereum.USDT; +const WETH = ADDRESSES.ethereum.WETH; +const USDC = ADDRESSES.ethereum.USDC; const ETHVOL_USDC_UNIV2 = "0x197e99bD87F98DFde461afE3F706dE36c9635a5D"; const WETH_COTI_UNIV2 = "0xA2b04F8133fC25887A436812eaE384e32A8A84F2"; @@ -60,8 +61,8 @@ const platformLiquidityContracts_polygon = [ //liquidty Mining CVOL-USDC "0xEA7b8DC5615e049417C80C795eA652556971c423", ]; -const USDT_Polygon = "0xc2132d05d31c914a87c6611c10748aeb04b58e8f"; -const USDC_Polygon = "0x2791bca1f2de4661ed88a30c99a7a9449aa84174"; +const USDT_Polygon = ADDRESSES.polygon.USDT; +const USDC_Polygon = ADDRESSES.polygon.USDC; const CVOL_USDC_QLP = "0x1dd0095a169e8398448A8e72f15A1868d99D9348"; /*** Arbitrum Addresses ***/ @@ -114,6 +115,22 @@ async function polygonTvl(timestamp, block, chainBlocks) { return balances; } +async function arbiTvl(_, _b, _cb, { api, }) { + const balances = {} + const vaults = [ + '0xfdeb59a2b4891ea17610ee38665249acc9fcc506', + ] + const tokens = await api.multiCall({ + abi: 'address:token', + calls: vaults, + }) + const totalBalance = await api.multiCall({ + abi: 'function totalBalance() view returns (uint256 balance, uint256 usdcPlatformLiquidity, uint256 intrinsicDEXVolTokenBalance, uint256 volTokenPositionBalance, uint256 dexUSDCAmount, uint256 dexVolTokensAmount)', + calls: vaults, + }) + tokens.forEach((t, i) => sdk.util.sumSingleBalance(balances, t, totalBalance[i].balance, api.chain)) + return balances +} module.exports = { misrepresentedTokens: true, @@ -133,6 +150,7 @@ module.exports = { }, arbitrum: { staking: staking(stakingContract_arbitrum, GOVI_arbitrum, "arbitrum", GOVI), + tvl: arbiTvl, }, methodology: "Counts liquidity on the Platforms and Staking seccions through Platfrom and Staking Contracts", diff --git a/projects/cybertime/abi.json b/projects/cybertime/abi.json index f87e493ddd9..6fcb468e36e 100644 --- a/projects/cybertime/abi.json +++ b/projects/cybertime/abi.json @@ -1,36 +1,3 @@ { - "poolInfo": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "poolInfo", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "lpToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "allocPoint", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastRewardBlock", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accCTFPerShare", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } + "poolInfo": "function poolInfo(uint256) view returns (address lpToken, uint256 allocPoint, uint256 lastRewardBlock, uint256 accCTFPerShare)" } \ No newline at end of file diff --git a/projects/cyclefinance/abi.json b/projects/cyclefinance/abi.json index a32ab6f017a..184e0f6aa23 100644 --- a/projects/cyclefinance/abi.json +++ b/projects/cyclefinance/abi.json @@ -1,41 +1,5 @@ { - "LPtoken": { - "type": "function", - "stateMutability": "view", - "outputs": [ - { - "type": "address", - "name": "", - "internalType": "address" - } - ], - "name": "LPtoken", - "inputs": [] - }, - "balanceLPinSystem": { - "type": "function", - "stateMutability": "view", - "outputs": [ - { - "type": "uint256", - "name": "", - "internalType": "uint256" - } - ], - "name": "balanceLPinSystem", - "inputs": [] - }, - "stakingToken": { - "type": "function", - "stateMutability": "view", - "outputs": [ - { - "type": "address", - "name": "", - "internalType": "contract IERC20" - } - ], - "name": "stakingToken", - "inputs": [] - } + "LPtoken": "address:LPtoken", + "balanceLPinSystem": "uint256:balanceLPinSystem", + "stakingToken": "address:stakingToken" } \ No newline at end of file diff --git a/projects/cyclefinance/index.js b/projects/cyclefinance/index.js index 2b4caec2f91..3ebec8e7a93 100644 --- a/projects/cyclefinance/index.js +++ b/projects/cyclefinance/index.js @@ -1,8 +1,6 @@ const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); -const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); -const { transformAvaxAddress } = require("../helper/portedTokens"); -const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); +const { sumTokens2 } = require("../helper/unwrapLPs"); const coreRewards = "0xE006716Ae6cAA486d77084C1cca1428fb99c877B"; const avaxRewards = "0x6140D3ED2426cbB24f07D884106D9018d49d9101"; @@ -12,9 +10,6 @@ const vaults = [ //Pangolin Rewards AVAX/PNG "0xccB42c29285754f441Dc6A4461De011efCD09F75", - //Pangolin Rewards AVAX/ETH (closed) - //"0xfB6e16A64ccC23848eB2951B1068a27B1d06791d", - //Gondola Rewards AVAX/GDL "0x47de256F890d3707aad74A89C6b532eEAaAe54BA", @@ -27,39 +22,18 @@ const vaults = [ //Olive Rewards AVAX/OLIVE "0xCD1eee22a0Ec06f5D169753cc1B1CC0C57513B24", - //Baguette Rewards WAVAX/BAG (closed) - //"0x8D6D3131B7d01F4acE7c74E7EA999d301524B9F8", - - //Pangolin Rewards AVAX/VSO (closed) - //"0x1e8864b21C980AaB05F3566B74aB1Aa9ec7dE948", - - //Pangolin Rewards PNG/VSO (closed) - //"0xbD87717eAAE4F13dD5b55734a46fA49C519f9404", - //Avaware Rewards AVAX/AVE "0x950bF2fb93c4Cb8CaBc7A08eb8A70Ea3c4A2bcC2", - //Olive Rewards AVAX/HUSKY (closed) - //"0x661FD8d23433E38f009FBc1e79910Fc0cAb2bC6D", - //Trader Joe Rewards AVAX/JOE "0xB19bFa46148636C97B0C00A68B24647f60C1995D", - //Trader Joe Rewards AVAX/ETH (closed) - //"0xe10F1567f0354F3d7394CaA42B4e30d0f19AF907", - //Trader Joe Rewards AVAX/SNOB "0x16aB820ABB64BcE04d15de945c18c0CC31822514", - //Trader Joe Rewards DAI/USDT (closed) - //"0x36EBd37960F37Ffb8EDDc6165b304dbB362Cd112", - //Olive Rewards AVAX/CYCLE "0x01181D0E43c1A77f111C7968BE5B7e40F1D6e106", - //Trader Joe Rewards AVAX/SHERPA (closed) - //"0xE80504EF78403AD1753b7DE62653c09c0f9de584", - //Avaware Rewards AVE/CYCLE "0x4762baf391Ca1A18f71320a6A09bCD2067EA32cA", @@ -78,9 +52,6 @@ const vaults = [ //Trader Joe Rewards AVAX/WETH.e "0xc2C215d9263592665993eEfc77976e70590f0DF1", - //Trader Joe Rewards DAI.e/USDT.e (Closed) - //"0x313b8d1ca1aAfae10273cdfCFA083b9a0E272d0E", - //Pangolin Rewards AVAX/DAI.e "0x4Fbb4C6dBD68A609780C79A18C04e5Ac52dD622C", @@ -116,36 +87,13 @@ const vaults = [ ]; /*** Staking of native token CYCLE and CYCLE/AVAX LP TVL Portion ***/ -const staking = async (timestamp, ethBlock, chainBlocks) => { - const balances = {}; - - const staking_lpToken = ( - await sdk.api.abi.call({ +const staking = async (timestamp, ethBlock, chainBlocks, { api }) => { + const staking_lpToken = + await api.call({ abi: abi.stakingToken, target: coreRewards, - chain: "avax", - block: chainBlocks["avax"], }) - ).output; - - const cycleLpOrTokens = [ - [staking_lpToken, true], - [CYCLE, false], - ]; - - const transformAddress = await transformAvaxAddress(); - - for (const lpOrToken of cycleLpOrTokens) { - await sumTokensAndLPsSharedOwners( - balances, - [lpOrToken], - (lpOrToken[1] == true) ? [coreRewards] : [avaxRewards], - chainBlocks["avax"], - "avax", - transformAddress - ); - } - return balances; + return sumTokens2({ api, tokens: [CYCLE, staking_lpToken], owners: [coreRewards, avaxRewards]}) }; /*** vaults TVL portion ***/ @@ -174,24 +122,10 @@ const avaxTvl = async (timestamp, ethBlock, chainBlocks) => { }) ).output.map((lpb) => lpb.output); - const lpPositions = []; for (let index = 0; index < vaults.length; index++) { - lpPositions.push({ - token: lpTokens[index], - balance: lpTokens_bal[index], - }); + sdk.util.sumSingleBalance(balances,lpTokens[index],lpTokens_bal[index], 'avax') } - const transformAddress = await transformAvaxAddress(); - - await unwrapUniswapLPs( - balances, - lpPositions, - chainBlocks["avax"], - "avax", - transformAddress - ); - return balances; }; diff --git a/projects/cyclone/index.js b/projects/cyclone/index.js index e55c6af9938..b2a8f087d46 100644 --- a/projects/cyclone/index.js +++ b/projects/cyclone/index.js @@ -1,11 +1,11 @@ +const ADDRESSES = require('../helper/coreAssets.json') const contracts = require("./contracts.json"); const { pool2 } = require("./../helper/pool2"); const { staking } = require(".././helper/staking.js"); const { - sumLPWithOnlyOneTokenOtherThanKnown, sumTokens2, nullAddress + sumTokens2, nullAddress, } = require("./../helper/unwrapLPs"); - -const wiotx = "0xA00744882684C3e4747faEFD68D283eA44099D03"; +const {sumTokensExport} = require("./../helper/unknownTokens"); function tvl(chain, gasToken) { return async (timestamp, block, chainBlocks) => { @@ -25,57 +25,23 @@ function tvl(chain, gasToken) { }; } -async function iotexPool2(timestamp, block, chainBlocks) { - block = chainBlocks.iotex - const balances = {}; - let a = await sumLPWithOnlyOneTokenOtherThanKnown( - balances, - contracts.iotex.pool2.token, - contracts.iotex.pool2.address, - "0x4d7b88403aa2f502bf289584160db01ca442426c", - block, - "iotex" - ); - return { iotex: balances[wiotx] / 10 ** 18 }; -} - module.exports = { iotex: { tvl: tvl("iotex", "iotex"), - pool2: iotexPool2, - staking: staking( - contracts.iotex.staking.address, - contracts.iotex.staking.token, - "iotex", - "cyclone-protocol", - 18 - ), + pool2: sumTokensExport({ owner: contracts.iotex.pool2.address, tokens: [contracts.iotex.pool2.token], }), + staking: staking(contracts.iotex.staking.address, contracts.iotex.staking.token, "iotex", "cyclone-protocol", 18), }, ethereum: { - tvl: tvl("ethereum", "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"), - pool2: pool2( - contracts.ethereum.pool2.address, - contracts.ethereum.pool2.token, - "ethereum" - ), + tvl: tvl("ethereum", ADDRESSES.ethereum.WETH), + pool2: pool2(contracts.ethereum.pool2.address, contracts.ethereum.pool2.token, "ethereum"), }, bsc: { - tvl: tvl("bsc", "bsc:0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c"), + tvl: tvl("bsc", "bsc:" + ADDRESSES.bsc.WBNB), pool2: pool2(contracts.bsc.pool2.address, contracts.bsc.pool2.token, "bsc"), - staking: staking( - contracts.bsc.staking.address, - contracts.bsc.staking.token, - "bsc", - "cyclone-protocol", - 18 - ), + staking: staking(contracts.bsc.staking.address, contracts.bsc.staking.token, "bsc", "cyclone-protocol", 18), }, polygon: { - tvl: tvl("polygon", "polygon:0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270"), - pool2: pool2( - contracts.polygon.pool2.address, - contracts.polygon.pool2.token, - "polygon" - ), + tvl: tvl("polygon", "polygon:" + ADDRESSES.polygon.WMATIC_2), + pool2: pool2(contracts.polygon.pool2.address, contracts.polygon.pool2.token,), }, }; diff --git a/projects/cypher-trade/idl.json b/projects/cypher-trade/idl.json new file mode 100644 index 00000000000..426f77e8b10 --- /dev/null +++ b/projects/cypher-trade/idl.json @@ -0,0 +1,2625 @@ +{ + "version": "3.0.0", + "name": "cypher", + "instructions": [], + "accounts": [ + { + "name": "CacheAccount", + "type": { + "kind": "struct", + "fields": [ + { + "name": "authority", + "docs": [ + "the authority of the cache" + ], + "type": "publicKey" + }, + { + "name": "caches", + "docs": [ + "the price caches, we have enough space here for more oracle maps than ever needed", + "assuming that oracle products accounts actually get reused" + ], + "type": { + "array": [ + { + "defined": "Cache" + }, + 512 + ] + } + } + ] + } + }, + { + "name": "Clearing", + "type": { + "kind": "struct", + "fields": [ + { + "name": "bumpSeed", + "type": { + "array": [ + "u8", + 1 + ] + } + }, + { + "name": "clearingType", + "docs": [ + "the type of the clearing" + ], + "type": { + "defined": "ClearingType" + } + }, + { + "name": "padding1", + "type": { + "array": [ + "u8", + 6 + ] + } + }, + { + "name": "clearingNumberSeed", + "type": { + "array": [ + "u8", + 1 + ] + } + }, + { + "name": "padding2", + "type": { + "array": [ + "u8", + 7 + ] + } + }, + { + "name": "authority", + "docs": ["the clearing's authority" + ], + "type": "publicKey" + }, + { + "name": "feeMint", + "docs": [ + "the mint of the token used to calculate fee tiers" + ], + "type": "publicKey" + }, + { + "name": "padding3", + "type": { + "array": [ + "u64", + 4 + ] + } + }, + { + "name": "feeTiers", + "docs": [ + "the fee tiers" + ], + "type": { + "array": [ + { + "defined": "FeeTier" + }, + 10 + ] + } + }, + { + "name": "config", + "docs": [ + "the config of the clearing" + ], + "type": { + "defined": "ClearingConfig" + } + } + ] + } + }, + { + "name": "Whitelist", + "type": { + "kind": "struct", + "fields": [ + { + "name": "clearing", + "docs": [ + "the corresponding clearing" + ], + "type": "publicKey" + }, + { + "name": "authority", + "docs": ["the clearing's authority" + ], + "type": "publicKey" + }, + { + "name": "accountOwner", + "docs": [ + "the account owner" + ], + "type": "publicKey" + }, + { + "name": "account", + "docs": [ + "the actual cypher account" + ], + "type": "publicKey" + }, + { + "name": "status", + "docs": [ + "whitelist status", + "i.e, when a whitelist status is revoked, the authority of the clearing should be able", + "to suspend a cypher account" + ], + "type": { + "defined": "WhitelistStatus" + } + }, + { + "name": "padding1", + "type": { + "array": [ + "u8", + 7 + ] + } + } + ] + } + }, + { + "name": "FuturesMarket", + "type": { + "kind": "struct", + "fields": [ + { + "name": "inner", + "docs": [ + "the inner structure which contains all relevant agnostic orderbook related public keys and fields" + ], + "type": { + "defined": "AgnosticMarket" + } + }, + { + "name": "idoAuthority", + "docs": [ + "the ido authority of the market, if applicable" + ], + "type": "publicKey" + }, + { + "name": "underlyingMint", + "docs": [ + "the mint of the underlying token this derivative market may physically deliver" + ], + "type": "publicKey" + }, + { + "name": "padding1", + "type": { + "array": [ + "u64", + 8 + ] + } + }, + { + "name": "tokenSupply", + "docs": [ + "the supply of the derivative token", + "i.e in the case of a market being for physical delivery of the underlying asset", + "the token supply should be equal to the amount of tokens available for delivery" + ], + "type": "u64" + }, + { + "name": "activatesAt", + "docs": [ + "timestamp at which the market becomes active" + ], + "type": "u64" + }, + { + "name": "expiresAt", + "docs": [ + "timestamp at which the market expires" + ], + "type": "u64" + }, + { + "name": "positionsCount", + "docs": [ + "number of open positions in this market" + ], + "type": "u64" + }, + { + "name": "marketPrice", + "docs": [ + "the twap price" + ], + "type": "i128" + }, + { + "name": "totalBorrows", + "docs": [ + "the total amount of borrows of the derivative" + ], + "type": "u64" + }, + { + "name": "totalPurchased", + "docs": [ + "the total amount of purchased tokens in the case of a pre-ido market" + ], + "type": "u64" + }, + { + "name": "padding2", + "type": { + "array": [ + "u64", + 2 + ] + } + }, + { + "name": "totalRaised", + "docs": ["the total amount of quote token that is available for the pre-ido token project's team to be collected" + ], + "type": "i128" + } + ] + } + }, + { + "name": "PerpetualMarket", + "type": { + "kind": "struct", + "fields": [ + { + "name": "inner", + "docs": [ + "the inner structure which contains all relevant agnostic orderbook related public keys and fields" + ], + "type": { + "defined": "AgnosticMarket" + } + }, + { + "name": "longFunding", + "docs": [ + "the long funding" + ], + "type": "i128" + }, + { + "name": "shortFunding", + "docs": [ + "the short funding" + ], + "type": "i128" + }, + { + "name": "lastFundingUpdate", + "docs": [ + "the timestamp of the last funding update" + ], + "type": "u64" + }, + { + "name": "impactQuantity", + "docs": [ + "the impact quantity used when getting bids and asks to calculate book mid price" + ], + "type": "u64" + }, + { + "name": "padding1", + "type": { + "array": [ + "u64", + 10 + ] + } + }, + { + "name": "minFunding", + "docs": [ + "the minimum funding rate for this market, in percentage" + ], + "type": "i8" + }, + { + "name": "maxFunding", + "docs": [ + "the maximum funding rate for this market, in percentage" + ], + "type": "i8" + }, + { + "name": "padding2", + "type": { + "array": [ + "u8", + 6 + ] + } + } + ] + } + }, + { + "name": "OracleProducts", + "type": { + "kind": "struct", + "fields": [ + { + "name": "productsType", + "docs": [ + "the products type" + ], + "type": { + "defined": "ProductsType" + } + }, + { + "name": "padding", + "type": { + "array": [ + "u8", + 7 + ] + } + }, + { + "name": "symbol", + "docs": [ + "the symbol of the underlying token that this oracle products account is responsible for", + "", + "this is used as a PDA for the oracle products account to more easily derive this account and see if it exists so it is properly reused" + ], + "type": { + "array": [ + "u8", + 32 + ] + } + }, + { + "name": "maxConfidenceInterval", + "docs": [ + "the maximum confidence interval for the oracle price" + ], + "type": "f64" + }, + { + "name": "futuresMarket", + "docs": [ + "the futures market associated with this oracle products account" + ], + "type": "publicKey" + }, + { + "name": "perpMarket", + "docs": [ + "the perp market associated with this oracle products account" + ], + "type": "publicKey" + }, + { + "name": "tokenMint", + "docs": [ + "the token mint associated with this oracle products account" + ], + "type": "publicKey" + }, + { + "name": "products", + "docs": [ + "the product accounts" + ], + "type": { + "vec": { + "array": [ + "u8", + 32 + ] + } + } + }, + { + "name": "weights", + "docs": [ + "the weights of the products" + ], + "type": { + "vec": "u16" + } + } + ] + } + }, + { + "name": "OracleStub", + "type": { + "kind": "struct", + "fields": [ + { + "name": "symbol", + "docs": [ + "the symbol of the underlying token that this oracle stub provides a feed for" + ], + "type": { + "array": [ + "u8", + 32 + ] + } + }, + { + "name": "price", + "docs": [ + "The oracle price" + ], + "type": "i128" + } + ] + } + }, + { + "name": "OrdersAccount", + "type": { + "kind": "struct", + "fields": [ + { + "name": "orderCount", + "docs": [ + "number of orders" + ], + "type": "u8" + }, + { + "name": "padding", + "type": { + "array": [ + "u8", + 7 + ] + } + }, + { + "name": "authority", + "docs": ["the account's authority" + ], + "type": "publicKey" + }, + { + "name": "market", + "docs": ["the account's authority" + ], + "type": "publicKey" + }, + { + "name": "masterAccount", + "docs": [ + "the master account pubkey" + ], + "type": "publicKey" + }, + { + "name": "makerBaseVolume", + "docs": [ + "the accumulated maker base token volume" + ], + "type": "u64" + }, + { + "name": "makerQuoteVolume", + "docs": [ + "the accumulated maker quote token volume" + ], + "type": "u64" + }, + { + "name": "takerBaseVolume", + "docs": [ + "the accumulated taker base token volume" + ], + "type": "u64" + }, + { + "name": "takerQuoteVolume", + "docs": [ + "the accumulated taker quote token volume" + ], + "type": "u64" + }, + { + "name": "baseTokenFree", + "docs": [ + "the amount of base token free" + ], + "type": { + "array": [ + "u64", + 24 + ] + } + }, + { + "name": "baseTokenLocked", + "docs": [ + "the amount of base token locked" + ], + "type": { + "array": [ + "u64", + 24 + ] + } + }, + { + "name": "quoteTokenFree", + "docs": [ + "the amount of quote token free" + ], + "type": { + "array": [ + "u64", + 24 + ] + } + }, + { + "name": "quoteTokenLocked", + "docs": [ + "the amount of quote token locked in orders" + ], + "type": { + "array": [ + "u64", + 24 + ] + } + }, + { + "name": "openOrders", + "docs": [ + "the open orders in this account" + ], + "type": { + "array": [ + { + "defined": "OpenOrder" + }, + 128 + ] + } + } + ] + } + }, + { + "name": "PoolNode", + "type": { + "kind": "struct", + "fields": [ + { + "name": "cacheIndex", + "docs": [ + "the index of the cache for the pool that this node belongs to" + ], + "type": "u16" + }, + { + "name": "vaultSignerSeed", + "docs": [ + "the bump seed" + ], + "type": { + "array": [ + "u8", + 1 + ] + } + }, + { + "name": "nodeNumber", + "docs": [ + "the number of the node, also used as a seed for the pool node pda" + ], + "type": "u8" + }, + { + "name": "operatingStatus", + "type": { + "defined": "OperatingStatus" + } + }, + { + "name": "padding1", + "type": { + "array": [ + "u8", + 11 + ] + } + }, + { + "name": "selfAddress", + "docs": ["the pool node's address, used as a seed for the vault signer" + ], + "type": "publicKey" + }, + { + "name": "authority", + "docs": [ + "the authority over this account" + ], + "type": "publicKey" + }, + { + "name": "cache", + "docs": [ + "the cache account" + ], + "type": "publicKey" + }, + { + "name": "pool", + "docs": [ + "the pool this node belongs to" + ], + "type": "publicKey" + }, + { + "name": "tokenMint", + "docs": ["the node's token mint" + ], + "type": "publicKey" + }, + { + "name": "tokenVault", + "docs": ["the node's token vault" + ], + "type": "publicKey" + }, + { + "name": "vaultSigner", + "docs": ["the node's vault signer" + ], + "type": "publicKey" + }, + { + "name": "deposits", + "docs": [ + "the amount of deposits" + ], + "type": "i128" + }, + { + "name": "borrows", + "docs": [ + "the amount of borrows" + ], + "type": "i128" + }, + { + "name": "accumBorrows", + "docs": [ + "accumulated borrows" + ], + "type": "i128" + }, + { + "name": "accumRepays", + "docs": [ + "accumulated repays" + ], + "type": "i128" + }, + { + "name": "protocolFees", + "docs": [ + "protocol fees accumulated so far" + ], + "type": "u64" + }, + { + "name": "padding2", + "type": { + "array": [ + "u64", + 1 + ] + } + } + ] + } + }, + { + "name": "Pool", + "type": { + "kind": "struct", + "fields": [ + { + "name": "bumpSeed", + "docs": [ + "the bump seed" + ], + "type": { + "array": [ + "u8", + 1 + ] + } + }, + { + "name": "operatingStatus", + "docs": ["the pool's operating status" + ], + "type": { + "defined": "OperatingStatus" + } + }, + { + "name": "padding1", + "type": { + "array": [ + "u8", + 14 + ] + } + }, + { + "name": "poolName", + "docs": [ + "the name of the pool, which is also used as a seed" + ], + "type": { + "array": [ + "u8", + 32 + ] + } + }, + { + "name": "config", + "docs": [ + "the pool config" + ], + "type": { + "defined": "PoolConfig" + } + }, + { + "name": "authority", + "docs": [ + "the authority over this account" + ], + "type": "publicKey" + }, + { + "name": "tokenMint", + "docs": [ + "the address of the token mint this pool represents" + ], + "type": "publicKey" + }, + { + "name": "padding2", + "type": { + "array": [ + "u64", + 4 + ] + } + }, + { + "name": "oracleProducts", + "docs": [ + "the oracle products account" + ], + "type": "publicKey" + }, + { + "name": "dexMarket", + "docs": [ + "the dex market for this pool" + ], + "type": "publicKey" + }, + { + "name": "cache", + "docs": [ + "the price cache account" + ], + "type": "publicKey" + }, + { + "name": "padding3", + "type": { + "array": [ + "u64", + 8 + ] + } + }, + { + "name": "deposits", + "docs": [ + "the amount of deposits across all nodes" + ], + "type": "i128" + }, + { + "name": "borrows", + "docs": [ + "the amount of borrows across all nodes" + ], + "type": "i128" + }, + { + "name": "depositIndex", + "docs": [ + "the deposit index" + ], + "type": "i128" + }, + { + "name": "borrowIndex", + "docs": [ + "the borrow index" + ], + "type": "i128" + }, + { + "name": "accumDepositInterestPayment", + "docs": [ + "accumulated deposit interest payments denominated in quote currency" + ], + "type": "i128" + }, + { + "name": "accumBorrowInterestPayment", + "docs": [ + "accumulated borrow interest payments denominated in quote currency" + ], + "type": "i128" + }, + { + "name": "indexUpdatedAt", + "docs": [ + "timestamp of the last index update" + ], + "type": "u64" + }, + { + "name": "protocolFees", + "docs": [ + "protocol fees accumulated so far" + ], + "type": "u64" + }, + { + "name": "insuranceFund", + "docs": [ + "the insurance fund for this pool" + ], + "type": "u64" + }, + { + "name": "padding4", + "type": { + "array": [ + "u64", + 12 + ] + } + }, + { + "name": "nodes", + "type": { + "array": [ + { + "defined": "NodeInfo" + }, + 24 + ] + } + } + ] + } + }, + { + "name": "PriceHistory", + "type": { + "kind": "struct", + "fields": [ + { + "name": "market", + "docs": [ + "market this price history is for" + ], + "type": "publicKey" + }, + { + "name": "data", + "docs": [ + "array of price infos." + ], + "type": { + "array": [ + { + "defined": "PriceWithTs" + }, + 14400 + ] + } + }, + { + "name": "config", + "type": { + "defined": "PriceHistoryConfig" + } + }, + { + "name": "longerHead", + "docs": [ + "head of prices for longer time horizon." + ], + "type": "u16" + }, + { + "name": "shorterHead", + "docs": [ + "head of prices for shorter time horizon." + ], + "type": "u16" + }, + { + "name": "tail", + "docs": [ + "tail of prices(most recently added price)." + ], + "type": "u16" + }, + { + "name": "padding1", + "type": "u16" + }, + { + "name": "padding2", + "type": { + "array": [ + "u64", + 8 + ] + } + } + ] + } + }, + { + "name": "CypherAccount", + "type": { + "kind": "struct", + "fields": [ + { + "name": "bumpSeed", + "docs": [ + "the bump seed" + ], + "type": { + "array": [ + "u8", + 1 + ] + } + }, + { + "name": "accountNumberSeed", + "docs": [ + "the account number seed" + ], + "type": { + "array": [ + "u8", + 1 + ] + } + }, + { + "name": "accountType", + "docs": [ + "the account type" + ], + "type": { + "defined": "AccountType" + } + }, + { + "name": "feeTier", + "docs": [ + "the fee tier of this account" + ], + "type": "u8" + }, + { + "name": "padding", + "type": { + "array": [ + "u8", + 12 + ] + } + }, + { + "name": "clearing", + "docs": [ + "the clearing this account belongs to" + ], + "type": "publicKey" + }, + { + "name": "authority", + "docs": ["the account's authority, should match sub accounts authority" + ], + "type": "publicKey" + }, + { + "name": "delegate", + "docs": ["the account's delegate" + ], + "type": "publicKey" + }, + { + "name": "subAccountCaches", + "docs": [ + "the sub account cache" + ], + "type": { + "array": [ + { + "defined": "SubAccountCache" + }, + 24 + ] + } + }, + { + "name": "updatedAt", + "docs": [ + "slot of the last account update" + ], + "type": "u64" + }, + { + "name": "padding2", + "type": { + "array": [ + "u8", + 8 + ] + } + } + ] + } + }, + { + "name": "CypherSubAccount", + "type": { + "kind": "struct", + "fields": [ + { + "name": "bumpSeed", + "docs": [ + "the bump seed" + ], + "type": { + "array": [ + "u8", + 1 + ] + } + }, + { + "name": "accountNumberSeed", + "docs": [ + "the account number seed" + ], + "type": { + "array": [ + "u8", + 1 + ] + } + }, + { + "name": "marginingType", + "docs": [ + "the margining type of this account" + ], + "type": { + "defined": "SubAccountMargining" + } + }, + { + "name": "padding", + "type": { + "array": [ + "u8", + 13 + ] + } + }, + { + "name": "accountAlias", + "docs": [ + "the alias of the account" + ], + "type": { + "array": [ + "u8", + 32 + ] + } + }, + { + "name": "clearing", + "docs": [ + "the associated clearing" + ], + "type": "publicKey" + }, + { + "name": "masterAccount", + "docs": [ + "the master account" + ], + "type": "publicKey" + }, + { + "name": "authority", + "docs": [ + "the authority" + ], + "type": "publicKey" + }, + { + "name": "delegate", + "docs": [ + "the delegate" + ], + "type": "publicKey" + }, + { + "name": "updatedAt", + "docs": [ + "the slot of the last update of this account" + ], + "type": "u64" + }, + { + "name": "claimableRewards", + "docs": [ + "the amount of claimable liquidity mining rewards" + ], + "type": "u64" + }, + { + "name": "padding2", + "type": { + "array": [ + "u64", + 7 + ] + } + }, + { + "name": "padding3", + "type": { + "array": [ + "u8", + 8 + ] + } + }, + { + "name": "positions", + "docs": [ + "the positions of this sub account" + ], + "type": { + "array": [ + { + "defined": "PositionSlot" + }, + 24 + ] + } + } + ] + } + } + ], + "types": [ + { + "name": "Cache", + "type": { + "kind": "struct", + "fields": [ + { + "name": "oracleProducts", + "docs": [ + "the oracle products account that is used to derive this price feed" + ], + "type": "publicKey" + }, + { + "name": "oraclePrice", + "docs": [ + "the latest price" + ], + "type": "i128" + }, + { + "name": "marketPrice", + "docs": [ + "the twap price for the futures market" + ], + "type": "i128" + }, + { + "name": "updatedAt", + "docs": [ + "the slot at which this cache was last updated" + ], + "type": "u64" + }, + { + "name": "padding1", + "type": { + "array": [ + "u8", + 8 + ] + } + }, + { + "name": "depositIndex", + "docs": [ + "the deposit index of the spot token" + ], + "type": "i128" + }, + { + "name": "borrowIndex", + "docs": [ + "the borrow index of the spot token" + ], + "type": "i128" + }, + { + "name": "spotInitAssetWeight", + "docs": [ + "the init asset weight of the spot token" + ], + "type": "u8" + }, + { + "name": "spotMaintAssetWeight", + "docs": [ + "the maint asset weight of the spot token" + ], + "type": "u8" + }, + { + "name": "spotInitLiabWeight", + "docs": [ + "the init liab weight of the spot token" + ], + "type": "u8" + }, + { + "name": "spotMaintLiabWeight", + "docs": [ + "the maint liab weight of the spot token" + ], + "type": "u8" + }, + { + "name": "futuresInitAssetWeight", + "docs": [ + "the init asset weight of the futures position" + ], + "type": "u8" + }, + { + "name": "futuresMaintAssetWeight", + "docs": [ + "the maint asset weight of the futures position" + ], + "type": "u8" + }, + { + "name": "futuresInitLiabWeight", + "docs": [ + "the init liab weight of the futures position" + ], + "type": "u8" + }, + { + "name": "futuresMaintLiabWeight", + "docs": [ + "the maint liab weight of the futures position" + ], + "type": "u8" + }, + { + "name": "perpInitAssetWeight", + "docs": [ + "the init asset weight of the perp position" + ], + "type": "u8" + }, + { + "name": "perpMaintAssetWeight", + "docs": [ + "the maint asset weight of the perp position" + ], + "type": "u8" + }, + { + "name": "perpInitLiabWeight", + "docs": [ + "the init liab weight of the perp position" + ], + "type": "u8" + }, + { + "name": "perpMaintLiabWeight", + "docs": [ + "the maint liab weight of the perp position" + ], + "type": "u8" + }, + { + "name": "decimals", + "docs": [ + "the decimals of the spl token traded on the spot market and available for deposit" + ], + "type": "u8" + }, + { + "name": "futuresDecimals", + "docs": [ + "the decimals of derivative asset for futures markets" + ], + "type": "u8" + }, + { + "name": "perpDecimals", + "docs": [ + "the decimals of derivative asset for perpetual markets" + ], + "type": "u8" + }, + { + "name": "padding2", + "type": { + "array": [ + "u8", + 1 + ] + } + } + ] + } + }, + { + "name": "FeeTier", + "type": { + "kind": "struct", + "fields": [ + { + "name": "balance", + "docs": [ + "the balance necessary" + ], + "type": "u64" + }, + { + "name": "makerBps", + "docs": [ + "the maker fee in bps", + "i.e, this value should be zero whenever the maker rebate is supposed to be positive" + ], + "type": "u8" + }, + { + "name": "takerBps", + "docs": [ + "the taker fee in bps" + ], + "type": "u8" + }, + { + "name": "rebateBps", + "docs": [ + "the maker rebate in bps", + "i.e this value should only be positive whenever the maker rate itself is zero" + ], + "type": "u8" + }, + { + "name": "tier", + "docs": [ + "the tier identifier, should start at 1" + ], + "type": "u8" + }, + { + "name": "padding1", + "type": { + "array": [ + "u8", + 4 + ] + } + } + ] + } + }, + { + "name": "ClearingConfig", + "type": { + "kind": "struct", + "fields": [ + { + "name": "maintMargin", + "docs": [ + "the maintenance margin" + ], + "type": "u8" + }, + { + "name": "initMargin", + "docs": [ + "the initialization margin" + ], + "type": "u8" + }, + { + "name": "targetMargin", + "docs": [ + "the target margin used by liquidators" + ], + "type": "u8" + }, + { + "name": "liqLiqorFee", + "docs": [ + "the liquidation fee bonus for the liquidator" + ], + "type": "u8" + }, + { + "name": "liqInsuranceFee", + "docs": [ + "the liquidation fee for the insurance fund" + ], + "type": "u8" + }, + { + "name": "padding1", + "type": { + "array": [ + "u8", + 3 + ] + } + } + ] + } + }, + { + "name": "MarketConfig", + "type": { + "kind": "struct", + "fields": [ + { + "name": "signerSeeds", + "docs": [ + "the signer seeds for this account" + ], + "type": { + "array": [ + "u8", + 1 + ] + } + }, + { + "name": "marketType", + "docs": [ + "the type of this market" + ], + "type": { + "defined": "MarketType" + } + }, + { + "name": "settlementType", + "docs": [ + "the type of delivery for this market in case it is a futures market" + ], + "type": { + "defined": "SettlementType" + } + }, + { + "name": "isActive", + "docs": [ + "whether the market is active", + "i.e, in the case of a market being for physical delivery of the underlying asset", + "the market cannot become active until the vault of the underlying asset being delivered has", + "a balance equivalent to the token supply of the derivative asset" + ], + "type": "bool" + }, + { + "name": "cacheIndex", + "docs": [ + "the cache index for this market" + ], + "type": "u16" + }, + { + "name": "initAssetWeight", + "docs": ["the init asset weight of the pool's positions for margin calculations" + ], + "type": "u8" + }, + { + "name": "initLiabWeight", + "docs": ["the init liability weight of the pool's positions for margin calculations" + ], + "type": "u8" + }, + { + "name": "maintAssetWeight", + "docs": ["the maint asset weight of the pool's positions for margin calculations" + ], + "type": "u8" + }, + { + "name": "maintLiabWeight", + "docs": ["the maint liability weight of the pool's positions for margin calculations" + ], + "type": "u8" + }, + { + "name": "decimals", + "docs": ["the decimals used for the target oracle price of this pool's asset" + ], + "type": "u8" + }, + { + "name": "operatingStatus", + "docs": [ + "the operating status of the market" + ], + "type": { + "defined": "OperatingStatus" + } + }, + { + "name": "padding", + "type": { + "array": [ + "u8", + 4 + ] + } + } + ] + } + }, + { + "name": "LiquidityMiningInfo", + "type": { + "kind": "struct", + "fields": [ + { + "name": "tokenMint", + "docs": [ + "the token mint of the token being used for rewards" + ], + "type": "publicKey" + }, + { + "name": "rate", + "docs": [ + "the rate that is used to convert liquidity points to the LM reward token" + ], + "type": "i128" + }, + { + "name": "maxDepthBps", + "docs": [ + "max depth on the book in bps" + ], + "type": "i128" + }, + { + "name": "periodStart", + "docs": [ + "timestamp of the start of the liquidity mining incentive period" + ], + "type": "u64" + }, + { + "name": "targetPeriodLength", + "docs": [ + "target time length for a liquidity mining period" + ], + "type": "u64" + }, + { + "name": "tokensLeft", + "docs": [ + "tokens left for this period." + ], + "type": "u64" + }, + { + "name": "tokensPerPeriod", + "docs": [ + "total amount of tokens allocated for a given period" + ], + "type": "u64" + }, + { + "name": "minRateAdj", + "docs": [ + "the minimum rate adjustment" + ], + "type": "u64" + }, + { + "name": "maxRateAdj", + "docs": [ + "the maximum rate adjusment" + ], + "type": "u64" + }, + { + "name": "sizeCutoff", + "docs": [ + "the size cut off for rewards" + ], + "type": "u64" + }, + { + "name": "tokenDecimals", + "docs": [ + "the decimals of the token being rewarded" + ], + "type": "u8" + }, + { + "name": "padding1", + "type": { + "array": [ + "u8", + 7 + ] + } + } + ] + } + }, + { + "name": "AgnosticMarket", + "type": { + "kind": "struct", + "fields": [ + { + "name": "config", + "docs": [ + "the config of the market" + ], + "type": { + "defined": "MarketConfig" + } + }, + { + "name": "marketName", + "docs": [ + "the name of the market, which is also used as a seed" + ], + "type": { + "array": [ + "u8", + 32 + ] + } + }, + { + "name": "orderbook", + "docs": [ + "the order book for this market" + ], + "type": "publicKey" + }, + { + "name": "bids", + "docs": [ + "the bids account for this market" + ], + "type": "publicKey" + }, + { + "name": "asks", + "docs": [ + "the asks account for this market" + ], + "type": "publicKey" + }, + { + "name": "eventQueue", + "docs": [ + "the asks account for this market" + ], + "type": "publicKey" + }, + { + "name": "authority", + "docs": [ + "the authority of the market" + ], + "type": "publicKey" + }, + { + "name": "priceHistory", + "docs": [ + "the price history account for on-chain twap" + ], + "type": "publicKey" + }, + { + "name": "oracleProducts", + "docs": [ + "the oracle products account" + ], + "type": "publicKey" + }, + { + "name": "padding1", + "type": { + "array": [ + "u64", + 8 + ] + } + }, + { + "name": "cache", + "docs": [ + "the cache account" + ], + "type": "publicKey" + }, + { + "name": "quotePool", + "docs": [ + "the quote pool" + ], + "type": "publicKey" + }, + { + "name": "padding2", + "type": { + "array": [ + "u64", + 8 + ] + } + }, + { + "name": "padding3", + "type": { + "array": [ + "u64", + 2 + ] + } + }, + { + "name": "baseVolume", + "docs": ["the market's total historical volume in base token" + ], + "type": "u64" + }, + { + "name": "quoteVolume", + "docs": ["the market's total historical volume in quote token" + ], + "type": "u64" + }, + { + "name": "liquidityMiningInfo", + "docs": [ + "the current liquidity mining parameters" + ], + "type": { + "defined": "LiquidityMiningInfo" + } + }, + { + "name": "minBaseOrderSize", + "docs": ["the market's minimum allowed order size in base token amount" + ], + "type": "u64" + }, + { + "name": "tickSize", + "docs": [ + "the tick size of the market" + ], + "type": "u64" + }, + { + "name": "baseMultiplier", + "docs": [ + "the base currency multiplier" + ], + "type": "u64" + }, + { + "name": "quoteMultiplier", + "docs": [ + "the quote currency multiplier" + ], + "type": "u64" + }, + { + "name": "protocolFees", + "docs": [ + "the currently accumulated trading fees" + ], + "type": "u64" + }, + { + "name": "insuranceFund", + "docs": [ + "the curently accumulated insurance fund for this market" + ], + "type": "u64" + }, + { + "name": "maxBaseOrderSize", + "docs": [ + "the maximum order base size for non-postOnly orders" + ], + "type": "u64" + }, + { + "name": "maxQuoteOrderSize", + "docs": [ + "the maximum order quote size for non-postOnly orders" + ], + "type": "u64" + }, + { + "name": "padding4", + "type": { + "array": [ + "u64", + 8 + ] + } + } + ] + } + }, + { + "name": "OpenOrder", + "type": { + "kind": "struct", + "fields": [ + { + "name": "side", + "docs": [ + "the side of the order" + ], + "type": { + "defined": "Side" + } + }, + { + "name": "subAccountIdx", + "docs": [ + "the sub account idx" + ], + "type": "u8" + }, + { + "name": "orderType", + "docs": [ + "the type of the order" + ], + "type": { + "defined": "DerivativeOrderType" + } + }, + { + "name": "padding", + "type": { + "array": [ + "u8", + 5 + ] + } + }, + { + "name": "timestamp", + "docs": [ + "the timestamp that the order was posted" + ], + "type": "u64" + }, + { + "name": "clientOrderId", + "docs": ["the client's order id" + ], + "type": "u64" + }, + { + "name": "orderId", + "docs": [ + "the order id after being posted on the book" + ], + "type": "u128" + } + ] + } + }, + { + "name": "NodeInfo", + "type": { + "kind": "struct", + "fields": [ + { + "name": "poolNode", + "docs": ["the node's pubkey" + ], + "type": "publicKey" + }, + { + "name": "nodeVault", + "docs": ["the node's vault pubkey" + ], + "type": "publicKey" + }, + { + "name": "deposits", + "docs": [ + "the deposits in the node" + ], + "type": "i128" + }, + { + "name": "borrows", + "docs": [ + "the borrows in the node" + ], + "type": "i128" + }, + { + "name": "padding", + "type": { + "array": [ + "u64", + 4 + ] + } + } + ] + } + }, + { + "name": "PoolConfig", + "type": { + "kind": "struct", + "fields": [ + { + "name": "optimalUtil", + "docs": [ + "optimal utilization ratio for this token" + ], + "type": "u16" + }, + { + "name": "optimalApr", + "docs": [ + "optimal apr for this token" + ], + "type": "u16" + }, + { + "name": "maxApr", + "docs": [ + "maximum apr for this token" + ], + "type": "u16" + }, + { + "name": "cacheIndex", + "docs": [ + "the index of this pool in the cache" + ], + "type": "u16" + }, + { + "name": "decimals", + "docs": [ + "the decimals of the spl token mint associated with the pool" + ], + "type": "u8" + }, + { + "name": "initAssetWeight", + "docs": ["the init asset weight of the pool's positions for margin calculations" + ], + "type": "u8" + }, + { + "name": "initLiabWeight", + "docs": ["the init liability weight of the pool's positions for margin calculations" + ], + "type": "u8" + }, + { + "name": "maintAssetWeight", + "docs": ["the maint asset weight of the pool's positions for margin calculations" + ], + "type": "u8" + }, + { + "name": "maintLiabWeight", + "docs": ["the maint liability weight of the pool's positions for margin calculations" + ], + "type": "u8" + }, + { + "name": "padding2", + "type": { + "array": [ + "u8", + 3 + ] + } + }, + { + "name": "padding3", + "type": { + "array": [ + "u64", + 2 + ] + } + } + ] + } + }, + { + "name": "PriceHistoryConfig", + "type": { + "kind": "struct", + "fields": [ + { + "name": "longerTimeHorizon", + "type": "u64" + }, + { + "name": "shorterTimeHorizon", + "type": "u64" + }, + { + "name": "priceCollectionTick", + "type": "u64" + } + ] + } + }, + { + "name": "PriceWithTs", + "type": { + "kind": "struct", + "fields": [ + { + "name": "price", + "type": "i128" + }, + { + "name": "timestamp", + "type": "u64" + } + ] + } + }, + { + "name": "SubAccountCache", + "type": { + "kind": "struct", + "fields": [ + { + "name": "assetsValue", + "docs": [ + "the value of the assets of this account" + ], + "type": "i128" + }, + { + "name": "liabilitiesValue", + "docs": [ + "the value of the liabilities of this account" + ], + "type": "i128" + }, + { + "name": "cRatio", + "docs": [ + "the margin c-ratio of this sub account" + ], + "type": "i128" + }, + { + "name": "updatedAt", + "docs": [ + "slot of the last cache update" + ], + "type": "u64" + }, + { + "name": "margining", + "docs": [ + "the sub account margining" + ], + "type": { + "defined": "SubAccountMargining" + } + }, + { + "name": "padding", + "type": { + "array": [ + "u8", + 7 + ] + } + }, + { + "name": "subAccount", + "docs": [ + "the sub account" + ], + "type": "publicKey" + }, + { + "name": "padding2", + "type": { + "array": [ + "u64", + 4 + ] + } + } + ] + } + }, + { + "name": "PositionSlot", + "type": { + "kind": "struct", + "fields": [ + { + "name": "spot", + "docs": [ + "the spot position" + ], + "type": { + "defined": "SpotPosition" + } + }, + { + "name": "derivative", + "docs": [ + "the derivative position" + ], + "type": { + "defined": "DerivativePosition" + } + } + ] + } + }, + { + "name": "SpotPosition", + "type": { + "kind": "struct", + "fields": [ + { + "name": "tokenMint", + "docs": [ + "the token mint that this position pertains to" + ], + "type": "publicKey" + }, + { + "name": "position", + "docs": [ + "the position denominated in the base token","if this value is negative then the outstanding position is a short, otherwise it's a long" + ], + "type": "i128" + }, + { + "name": "openOrdersCache", + "docs": [ + "the open orders cache" + ], + "type": { + "defined": "OpenOrdersCache" + } + }, + { + "name": "cacheIndex", + "docs": [ + "the index of this position in the cache" + ], + "type": "u16" + }, + { + "name": "padding", + "type": { + "array": [ + "u8", + 6 + ] + } + } + ] + } + }, + { + "name": "DerivativePosition", + "type": { + "kind": "struct", + "fields": [ + { + "name": "market", + "docs": [ + "the public key of the market that this position pertains to" + ], + "type": "publicKey" + }, + { + "name": "basePosition", + "docs": [ + "the position denominated in the base token","if this value is negative then the outstanding position is a short, otherwise it's a long" + ], + "type": "i128" + }, + { + "name": "openOrdersCache", + "docs": [ + "the open orders cache" + ], + "type": { + "defined": "OpenOrdersCache" + } + }, + { + "name": "longFundingSettled", + "docs": [ + "the long funding that has been settled for this position" + ], + "type": "i128" + }, + { + "name": "shortFundingSettled", + "docs": [ + "the short funding that has been settled for this position" + ], + "type": "i128" + }, + { + "name": "cacheIndex", + "docs": [ + "the index of this position in the cache" + ], + "type": "u16" + }, + { + "name": "marketType", + "docs": [ + "the type of market of this position", + "", + "this is necessary in order to fetch the appropriate weights" + ], + "type": { + "defined": "MarketType" + } + }, + { + "name": "padding", + "type": { + "array": [ + "u8", + 5 + ] + } + } + ] + } + }, + { + "name": "OpenOrdersCache", + "type": { + "kind": "struct", + "fields": [ + { + "name": "coinTotal", + "docs": [ + "total amount of native base tokens in the open orders account, includes locked and free tokens" + ], + "type": "u64" + }, + { + "name": "coinFree", + "docs": [ + "amount of free native base tokens in the open orders account" + ], + "type": "u64" + }, + { + "name": "pcTotal", + "docs": [ + "total amount of native quote tokens in the open orders account, includes locked and free tokens" + ], + "type": "u64" + }, + { + "name": "pcFree", + "docs": [ + "amount of free native quote tokens in the open orders account" + ], + "type": "u64" + }, + { + "name": "referrerRebatesAccrued", + "docs": [ + "the amount of referrer rebates accrued, in native quote token" + ], + "type": "u64" + } + ] + } + }, + { + "name": "OrderType", + "type": { + "kind": "enum", + "variants": [ + { + "name": "Limit" + }, + { + "name": "ImmediateOrCancel" + }, + { + "name": "PostOnly" + } + ] + } + }, + { + "name": "DerivativeOrderType", + "type": { + "kind": "enum", + "variants": [ + { + "name": "Limit" + }, + { + "name": "ImmediateOrCancel" + }, + { + "name": "FillOrKill" + }, + { + "name": "PostOnly" + } + ] + } + }, + { + "name": "Side", + "type": { + "kind": "enum", + "variants": [ + { + "name": "Bid" + }, + { + "name": "Ask" + } + ] + } + }, + { + "name": "ClearingType", + "type": { + "kind": "enum", + "variants": [ + { + "name": "Public" + }, + { + "name": "Private" + } + ] + } + }, + { + "name": "WhitelistStatus", + "type": { + "kind": "enum", + "variants": [ + { + "name": "Pending" + }, + { + "name": "Active" + }, + { + "name": "Revoked" + } + ] + } + }, + { + "name": "MarketType", + "docs": [ + "market types" + ], + "type": { + "kind": "enum", + "variants": [ + { + "name": "Default" + }, + { + "name": "PairFuture" + }, + { + "name": "PerpetualFuture" + }, + { + "name": "PreIDO" + }, + { + "name": "IndexFuture" + } + ] + } + }, + { + "name": "SettlementType", + "docs": [ + "settlement types for futures markets" + ], + "type": { + "kind": "enum", + "variants": [ + { + "name": "CashSettled" + }, + { + "name": "PhysicalDelivery" + } + ] + } + }, + { + "name": "ProductsType", + "type": { + "kind": "enum", + "variants": [ + { + "name": "Stub" + }, + { + "name": "Pyth" + }, + { + "name": "Switchboard" + } + ] + } + }, + { + "name": "SubAccountMargining", + "type": { + "kind": "enum", + "variants": [ + { + "name": "Cross" + }, + { + "name": "Isolated" + } + ] + } + }, + { + "name": "AccountType", + "type": { + "kind": "enum", + "variants": [ + { + "name": "Regular" + }, + { + "name": "Whitelisted" + } + ] + } + }, + { + "name": "OperatingStatus", + "type": { + "kind": "enum", + "variants": [ + { + "name": "Active" + }, + { + "name": "ReduceOnly" + }, + { + "name": "CancelOnly" + }, + { + "name": "Halted" + } + ] + } + } + ], + "events": [], + "errors": [] +} \ No newline at end of file diff --git a/projects/cypher-trade/index.js b/projects/cypher-trade/index.js new file mode 100644 index 00000000000..3aeacaabae7 --- /dev/null +++ b/projects/cypher-trade/index.js @@ -0,0 +1,19 @@ + +const { Program } = require("@project-serum/anchor"); +const { getProvider, sumTokens2, } = require("../helper/solana"); +const idl = require('./idl.json') + +async function tvl() { + const provider = getProvider() + const program = new Program(idl, 'CYPH3o83JX6jY6NkbproSpdmQ5VWJtxjfJ5P8veyYVu3', provider) + const pools = await program.account.pool.all() + const tokenAccounts = pools.map(({ account }) => { + return account.nodes.map(i => i.nodeVault.toString()).filter(i => i !== '11111111111111111111111111111111') + }).flat() + return sumTokens2({ tokenAccounts}) +} + +module.exports = { + timetravel: false, + solana: { tvl, }, +} diff --git a/projects/czodiac/abi-chef-czb.json b/projects/czodiac/abi-chef-czb.json new file mode 100644 index 00000000000..6e82ec9f0a0 --- /dev/null +++ b/projects/czodiac/abi-chef-czb.json @@ -0,0 +1,4 @@ +{ + "poolInfo": "function poolInfo(uint256) view returns (address lpToken, uint256 allocPoint, uint256 lastRewardBlock, uint256 accCzbPerShare)", + "poolLength": "uint256:poolLength" +} diff --git a/projects/czodiac/abi-chef-czf.json b/projects/czodiac/abi-chef-czf.json new file mode 100644 index 00000000000..abb0641c509 --- /dev/null +++ b/projects/czodiac/abi-chef-czf.json @@ -0,0 +1,4 @@ +{ + "poolInfo": "function poolInfo(uint256) view returns (address lpToken, uint256 allocPoint, uint256 lastRewardBlock, uint256 accCzfPerShare)", + "poolLength": "uint256:poolLength" +} diff --git a/projects/czodiac/index.js b/projects/czodiac/index.js new file mode 100644 index 00000000000..e2ae2466529 --- /dev/null +++ b/projects/czodiac/index.js @@ -0,0 +1,37 @@ +const { masterChefExports, } = require("../helper/masterchef"); +const { mergeExports, } = require("../helper/utils"); +const { staking, } = require("../helper/staking") +const abiChefCzb = require("./abi-chef-czb.json"); +const abiChefCzf = require("./abi-chef-czf.json"); + + +const czr = "0x5cd0c2C744caF04cda258Efc6558A3Ed3defE97b"; + +const czf = "0x7c1608C004F20c3520f70b924E2BfeF092dA0043"; +const chefCzf = "0xba968e7Ac9879eE5b0248e0CdBF0e4e82771C62D"; +const czb = "0xD963b2236D227a0302E19F2f9595F424950dc186"; +const chefCzb = "0xDe06B35D763b6d73128B1185b778402B667fe071"; + +const czrPoolWrappers = [ + "0xd06217a2d18c2b26fae3e649cd2de133f573ab43", + "0x003cccc78ebe57c6dcd57e4c49b24d7dec074893", + "0x989d7c902c1c33af1a6018b6f2713c49c5052677", + "0xf24ee6519c14d60e8b97ef802f5fac53d323e7fc", + "0x770Ca266f6eFf94880e60D4276fE708FF498a61F", + "0xBeFE5F7c282c9Cb5A333892E2e600b28d80699c7", + "0x39e18C777A3FfC6B2Bc9B0485486E54DFBFEF165", + "0x2cfc10F03570C05713bEF29006ec018Cd4de8E51" +] + +module.exports = mergeExports([ + masterChefExports(chefCzf, "bsc", czf, false, abiChefCzf.poolInfo), + masterChefExports(chefCzb, "bsc", czb, true, abiChefCzb.poolInfo), + { + bsc: { + staking: staking( + czrPoolWrappers, + czr, + 'bsc') + } + } +]); \ No newline at end of file diff --git a/projects/dam-finance/index.js b/projects/dam-finance/index.js new file mode 100644 index 00000000000..e0be38c63a9 --- /dev/null +++ b/projects/dam-finance/index.js @@ -0,0 +1,14 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require('../helper/unwrapLPs') +const ethCollateralJoins = ["0xB1fbcD7415F9177F5EBD3d9700eD5F15B476a5Fe"] + +module.exports = { + methodology: 'Currently counting the USDC that DAM Finance has locked up, but will add more collateral types and multiple chains in the future', + start: 16375673, // LMCV Deployment Block + ethereum: { + tvl: sumTokensExport({ + tokens: [ADDRESSES.ethereum.USDC], + owners: ethCollateralJoins + }) + } +}; \ No newline at end of file diff --git a/projects/damm-finance/index.js b/projects/damm-finance/index.js index c1857b71114..3325faabd29 100644 --- a/projects/damm-finance/index.js +++ b/projects/damm-finance/index.js @@ -1,6 +1,7 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { compoundExports } = require('../helper/compound') -const WETH = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2" +const WETH = ADDRESSES.ethereum.WETH const bETH = "0xe970c37243F3d0B2AeB041b855Ef6466CB140BcA" const unitroller = "0x4F96AB61520a6636331a48A11eaFBA8FB51f74e4" diff --git a/projects/damx/index.js b/projects/damx/index.js new file mode 100644 index 00000000000..f13a1e5ce22 --- /dev/null +++ b/projects/damx/index.js @@ -0,0 +1,14 @@ +const { staking } = require("../helper/staking"); +const { gmxExports } = require("../helper/gmx"); + +//Fantom +const fantomVault = "0xD093eeE7c968CEef2df96cA9949eba1a1A9b2306"; +const fantomStaking = "0xECef79f974182f4E9c168E751101F23686Bdc6dF"; +const fantomDMX = "0x0Ec581b1f76EE71FB9FEefd058E0eCf90EBAb63E"; + +module.exports = { + fantom: { + staking: staking(fantomStaking, fantomDMX), + tvl: gmxExports({ vault: fantomVault }) + } +}; diff --git a/projects/daolama/borrowed.js b/projects/daolama/borrowed.js new file mode 100644 index 00000000000..ac273577018 --- /dev/null +++ b/projects/daolama/borrowed.js @@ -0,0 +1,17 @@ +const sdk = require("@defillama/sdk"); +const { transformBalances } = require("../helper/portedTokens"); +const { get } = require('../helper/http'); +const ADDRESSES = require('../helper/coreAssets.json'); +const { BASE_API_URL } = require("./constants"); +const nullAddress = ADDRESSES.null; + +async function borrowed(chain, timestamp, chainBlocks, { api }) { + const balances = {}; + const result = await get(`${BASE_API_URL}/api/v1/analytics/borrowed`); + sdk.util.sumSingleBalance(balances, nullAddress, result.value, api.chain); + return transformBalances(api.chain, balances); +} + +module.exports = { + borrowed, +} diff --git a/projects/daolama/constants.js b/projects/daolama/constants.js new file mode 100644 index 00000000000..9e4e7075370 --- /dev/null +++ b/projects/daolama/constants.js @@ -0,0 +1,4 @@ +module.exports = { + BASE_API_URL: 'https://api.daolama.co', + POOL_ADDRESS: 'EQAwsDboFl_iGuaflNn5959HOamenkvQEQDwakO55CY2SGB8' +} diff --git a/projects/daolama/index.js b/projects/daolama/index.js new file mode 100644 index 00000000000..26d3f534bfe --- /dev/null +++ b/projects/daolama/index.js @@ -0,0 +1,12 @@ +const { tvl } = require('./tvl'); +const { borrowed } = require('./borrowed'); + +module.exports = { + methodology: 'Counts the pool size as the TVL. Borrowed coins are not counted towards the TVL.', + timetravel: false, + misrepresentedTokens: true, + ton: { + tvl, + borrowed, + } +} diff --git a/projects/daolama/tvl.js b/projects/daolama/tvl.js new file mode 100644 index 00000000000..ad7f92ebd7c --- /dev/null +++ b/projects/daolama/tvl.js @@ -0,0 +1,17 @@ +const sdk = require("@defillama/sdk"); +const { get } = require("../helper/http"); +const { transformBalances } = require("../helper/portedTokens"); +const ADDRESSES = require("../helper/coreAssets.json"); +const { POOL_ADDRESS } = require("./constants"); +const nullAddress = ADDRESSES.null; + +async function tvl(chain, timestamp, chainBlocks, { api }) { + const balances = {}; + const balance = await get(`https://toncenter.com/api/v2/getAddressBalance?address=${encodeURIComponent(POOL_ADDRESS)}`) + sdk.util.sumSingleBalance(balances, nullAddress, balance.result, api.chain); + return transformBalances(api.chain, balances); +} + +module.exports = { + tvl, +} diff --git a/projects/daomaker-swap/index.js b/projects/daomaker-swap/index.js index da9b24c4a92..74c23d97f8b 100644 --- a/projects/daomaker-swap/index.js +++ b/projects/daomaker-swap/index.js @@ -4,7 +4,7 @@ module.exports = { misrepresentedTokens: false, bsc: { tvl: getUniTVL({ - factory: '0x940BEb635cbEeC04720AC97FADb97205676e6aa4', chain: 'bsc', useDefaultCoreAssets: false, + factory: '0x940BEb635cbEeC04720AC97FADb97205676e6aa4', useDefaultCoreAssets: false, }) }, }; \ No newline at end of file diff --git a/projects/daomaker/index.js b/projects/daomaker/index.js index 1fe0c87355c..c3cac78b94b 100644 --- a/projects/daomaker/index.js +++ b/projects/daomaker/index.js @@ -1,7 +1,8 @@ const sdk = require("@defillama/sdk"); const { stakings } = require("../helper/staking"); const { sumTokens2 } = require('../helper/unwrapLPs') -const { get } = require('../helper/http') +const { getConfig } = require('../helper/cache') + const contracts = require("./contracts.json"); const chainIds = { @@ -17,7 +18,7 @@ let vestingData, stakingData async function getVestingData() { if (!vestingData) - vestingData = get('https://api.daomaker.com/get-all-vesting-contracts') + vestingData = getConfig('daomaker/vesting', 'https://api.daomaker.com/get-all-vesting-contracts') return vestingData } @@ -28,7 +29,7 @@ function filterDuplicates(toa) { async function getStakingData() { if (!stakingData) - stakingData = get('https://api.daomaker.com/get-all-farms') + stakingData = getConfig('daomaker/staking', 'https://api.daomaker.com/get-all-farms') return stakingData } @@ -40,7 +41,7 @@ function vesting(chain) { .forEach(i => toa.push([i.token_address, i.vesting_smart_contract_address])) return sumTokens2({ chain, block, tokensAndOwners: filterDuplicates(toa) }) }; -}; +} function staking(chain) { return async (timestamp, _, { [chain]: block }) => { const toa = [] @@ -51,7 +52,7 @@ function staking(chain) { }) return sumTokens2({ chain, block, tokensAndOwners: filterDuplicates(toa) }) }; -}; +} const chainTVLObject = contracts.chains.reduce( (agg, chain) => ({ diff --git a/projects/daoventures/abi.json b/projects/daoventures/abi.json index 739beacba91..1cc9fc8ac3e 100644 --- a/projects/daoventures/abi.json +++ b/projects/daoventures/abi.json @@ -1,25 +1,5 @@ { - "getAllPoolInUSD": { - "inputs": [], - "name": "getAllPoolInUSD", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - "getAllPoolInUSDProxy": { - "inputs": [ - { "internalType": "bool", "name": "includeVestedILV", "type": "bool" } - ], - "name": "getAllPoolInUSD", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - "getTotalValueInPool": { - "inputs": [], - "name": "getTotalValueInPool", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - } -} + "getAllPoolInUSD": "uint256:getAllPoolInUSD", + "getAllPoolInUSDProxy": "function getAllPoolInUSD(bool includeVestedILV) view returns (uint256)", + "getTotalValueInPool": "uint256:getTotalValueInPool" +} \ No newline at end of file diff --git a/projects/daoventures/index.js b/projects/daoventures/index.js index 72ef2206846..dbeeffc32ef 100644 --- a/projects/daoventures/index.js +++ b/projects/daoventures/index.js @@ -65,7 +65,6 @@ async function tvl(timestamp, ethereumBlock, chainBlocks) { for (const prop in result) { balances += result[prop]; } - //await unwrapYearn(balances); return { "usd-coin": balances }; } diff --git a/projects/darkauto/abi.json b/projects/darkauto/abi.json index 3bb91f3dfc6..cc4d761525d 100644 --- a/projects/darkauto/abi.json +++ b/projects/darkauto/abi.json @@ -1,72 +1,5 @@ { - "poolLength": { - "inputs": [], - "name": "poolLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "wantLockedTotal": { - "inputs": [], - "name": "wantLockedTotal", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "poolInfo": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "poolInfo", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "want", - "type": "address" - }, - { - "internalType": "uint256", - "name": "allocPoint", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastRewardTime", - "type": "uint256" - }, - { - "internalType": "address", - "name": "strategy", - "type": "address" - }, - { - "internalType": "uint256", - "name": "earlyWithdrawFee", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "earlyWithdrawTime", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } + "poolLength": "uint256:poolLength", + "wantLockedTotal": "uint256:wantLockedTotal", + "poolInfo": "function poolInfo(uint256) view returns (address want, uint256 allocPoint, uint256 lastRewardTime, address strategy, uint256 earlyWithdrawFee, uint256 earlyWithdrawTime)" } \ No newline at end of file diff --git a/projects/darkcrypto/abi.json b/projects/darkcrypto/abi.json index e8abaa83bae..cc025528803 100644 --- a/projects/darkcrypto/abi.json +++ b/projects/darkcrypto/abi.json @@ -1,102 +1,7 @@ { - "poolLength": { - "inputs": [], - "name": "poolLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "token0": { - "constant": true, - "inputs": [], - "name": "token0", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "token1": { - "constant": true, - "inputs": [], - "name": "token1", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "wantLockedTotal": { - "inputs": [], - "name": "wantLockedTotal", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "poolInfo": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "poolInfo", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "want", - "type": "address" - }, - { - "internalType": "uint256", - "name": "allocPoint", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastRewardTime", - "type": "uint256" - }, - { - "internalType": "address", - "name": "strategy", - "type": "address" - }, - { - "internalType": "uint256", - "name": "earlyWithdrawFee", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "earlyWithdrawTime", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } + "poolLength": "uint256:poolLength", + "token0": "address:token0", + "token1": "address:token1", + "wantLockedTotal": "uint256:wantLockedTotal", + "poolInfo": "function poolInfo(uint256) view returns (address want, uint256 allocPoint, uint256 lastRewardTime, address strategy, uint256 earlyWithdrawFee, uint256 earlyWithdrawTime)" } \ No newline at end of file diff --git a/projects/darkcrypto/index.js b/projects/darkcrypto/index.js index 0475f0fed94..f746a0f20e9 100644 --- a/projects/darkcrypto/index.js +++ b/projects/darkcrypto/index.js @@ -1,64 +1,12 @@ -const { addFundsInMasterChef } = require("../helper/masterchef"); const { stakingUnknownPricedLP } = require("../helper/staking"); -const { pool2BalanceFromMasterChef } = require("../helper/pool2"); const farmUtils = require("./farm-utils"); const vaultUtils = require("./vault-utils") const sdk = require("@defillama/sdk"); -const dark = "0x83b2AC8642aE46FC2823Bc959fFEB3c1742c48B5"; const sky = "0x9D3BBb0e988D9Fb2d55d07Fe471Be2266AD9c81c"; -const krx = "0xf0681bb7088ac68a62909929554aa22ad89a21fb"; -const krx_usdc = "0x9504a7cEd300B2C79e64FC63f368fC27011Fe916"; -const masterchefDark = "0x28d81863438F25b6EC4c9DA28348445FC5E44196"; const boardroom = "0x2e7d17ABCb9a2a40ec482B2ac9a9F811c12Bf630"; -async function tvl(timestamp, block, chainBlocks) { - let balances = await vaultUtils.vaultLocked(block, "cronos"); - //DARK POOL - await addFundsInMasterChef( - balances, - masterchefDark, - chainBlocks.cronos, - "cronos", - (addr) => `cronos:${addr}`, - undefined, - [dark, krx], - true, - true, - dark, - ); -/* - //get staking KRX token - let krxBalance = await stakingUnknownPricedLP( - masterchefDark, - krx, - "cronos", - krx_usdc - )(timestamp, block, chainBlocks); - sdk.util.sumSingleBalance( - balances, - "cronos:0xc21223249CA28397B4B6541dfFaEcC539BfF0c59", - krxBalance["cronos:0xc21223249CA28397B4B6541dfFaEcC539BfF0c59"] - ); - - - - //BoardRoom - let boardroomBalance = await stakingUnknownPricedLP( - boardroom, - sky, - "cronos", - "0xaA0845EE17e4f1D4F3A8c22cB1e8102baCf56a77" - )(timestamp, block, chainBlocks); - sdk.util.sumSingleBalance( - balances, - "cronos:0x5C7F8A570d578ED84E63fdFA7b1eE72dEae1AE23", - boardroomBalance["cronos:0x5C7F8A570d578ED84E63fdFA7b1eE72dEae1AE23"] - );*/ - - return balances; -} async function pool2(timestamp, block, chainBlocks) { // SKY POOL const farmTvl = await farmUtils.farmLocked(chainBlocks["cronos"]); @@ -81,15 +29,15 @@ async function pool2(timestamp, block, chainBlocks) { return balances; } -async function vault(timestamp, block, chainBlocks){ - return await vaultUtils.vaultLocked(chainBlocks.cronos, 'cronos') +async function vault(timestamp, block, chainBlocks, { api }){ + return vaultUtils.vaultLocked(api) } module.exports = { doublecounted: true, cronos: { tvl:vault, - pool2: pool2, + pool2, staking: stakingUnknownPricedLP( boardroom, sky, diff --git a/projects/darkcrypto/vault-utils.js b/projects/darkcrypto/vault-utils.js index b709769256c..c3068fc3956 100644 --- a/projects/darkcrypto/vault-utils.js +++ b/projects/darkcrypto/vault-utils.js @@ -1,152 +1,13 @@ const VAULT_ADDR = "0x66D586eae9B30CD730155Cb7fb361e79D372eA2a" -const sdk = require("@defillama/sdk"); -const BigNumber = require("bignumber.js"); +const { sumUnknownTokens } = require('../helper/unknownTokens') const abi = require("./abi.json") -const farmLPBalance = async ( - chain, - block, - lpToken, - lpLocked, - token0, - token1, - pid -) => { - const balances = ( - await sdk.api.abi.multiCall({ - abi: "erc20:balanceOf", - calls: [ - { - target: token0, - params: [lpToken], - }, - { - target: token1, - params: [lpToken], - } - ], - block, - chain: chain, - }) - ).output; - const lpTotalSuply = ( - await sdk.api.abi.call({ - target: lpToken, - abi: "erc20:totalSupply", - chain: chain, - block, - }) - ).output; - const token0Locked = (lpLocked * balances[0].output) / lpTotalSuply; - const token1Locked = (lpLocked * balances[1].output) / lpTotalSuply; - const unknowPricePid = [0, 1]; - let whiteListToken = ["0x97749c9B61F878a880DfE312d2594AE07AEd7656"] - whiteListToken = whiteListToken.map(addr=>addr.toLowerCase()) - if (unknowPricePid.includes(pid)) { - if(whiteListToken.includes(token0.toLowerCase())){ - return [ - { token: `${chain}:${token0}`, locked: new BigNumber(token0Locked || 0).multipliedBy(2) }, - ] - } - return [ - { token: `${chain}:${token1}`, locked: new BigNumber(token1Locked || 0).multipliedBy(2) }, - ] - } - - return [ - { token: `${chain}:${token0}`, locked: token0Locked }, - { token: `${chain}:${token1}`, locked: token1Locked }, - ]; -}; - - - -const vaultLocked = async (block, chain) => { - const balances = {}; - const { output: poolLength } = await sdk.api.abi.call({ - abi: abi["poolLength"], - target: VAULT_ADDR, - chain, - }) - let arr = [] - for (let i = 0; i < poolLength; i++) { - arr.push(i) - } - - let poolInfos = - await sdk.api.abi.multiCall({ - abi: abi["poolInfo"], - calls: arr.map(pid => { - return { - target: VAULT_ADDR, - params: [pid] - } - }), - block, - chain: chain, - }) - .then(d => d.output).then(d => d.map(poolInfo => poolInfo.output)); - // console.log(poolInfos) - let wanLockedTotals = - await sdk.api.abi.multiCall({ - abi: abi["wantLockedTotal"], - calls: poolInfos.map(poolInfo => { - return { - target: poolInfo.strategy, - params: [] - } - }), - block, - chain: chain, - }) - .then(d => d.output).then(d => d.map(lock => lock.output)); - let token0Infos = - await sdk.api.abi.multiCall({ - abi: abi["token0"], - calls: poolInfos.map(poolInfo => { - return { - target: poolInfo.want, - params: [] - } - }), - block, - chain: chain, - }) - .then(d => d.output).then(d => d.map(lock => lock.output)); - let token1Infos = - await sdk.api.abi.multiCall({ - abi: abi["token1"], - calls: poolInfos.map(poolInfo => { - return { - target: poolInfo.want, - params: [] - } - }), - block, - chain: chain, - }) - .then(d => d.output).then(d => d.map(lock => lock.output)); - const promises = arr.map((i) => { - return farmLPBalance( - "cronos", - block, - poolInfos[i].want, - wanLockedTotals[i], - token0Infos[i], - token1Infos[i], - i - ); - }); - const data = await Promise.all(promises); - data.forEach((farm) => { - farm.forEach((item) => { - balances[item.token] = new BigNumber(balances[item.token] || 0) - .plus(item.locked || 0) - .toFixed(0); - }); - }); - - return balances; +const vaultLocked = async (api) => { + const poolInfos = await api.fetchList({ lengthAbi: abi.poolLength, itemAbi: abi.poolInfo, target: VAULT_ADDR }) + let wanLockedTotals = await api.multiCall({ abi: abi.wantLockedTotal, calls: poolInfos.map(i => i.strategy), }) + const wants = poolInfos.map(i => i.want) + api.addTokens(wants, wanLockedTotals) + return sumUnknownTokens({ api, useDefaultCoreAssets: true, resolveLP: true,}) }; module.exports = { vaultLocked, diff --git a/projects/darkness/index.js b/projects/darkness/index.js index c6c2e95d9a1..ac1f3dce8ca 100644 --- a/projects/darkness/index.js +++ b/projects/darkness/index.js @@ -1,83 +1,42 @@ -const { GraphQLClient, gql } = require('graphql-request') -const { toUSDTBalances } = require('../helper/balances'); -const { getBlock } = require('../helper/getBlock'); -const { stakingPricedLP } = require("../helper/staking"); -const { addFundsInMasterChef } = require("../helper/masterchef"); -const { farmLPBalance } = require("./utils"); - +const ADDRESSES = require('../helper/coreAssets.json') const masterChef = "0x63Df75d039f7d7A8eE4A9276d6A9fE7990D7A6C5"; -const d3usd = "0x36B17c6719e09d98bB020608E9F79a0647d50A70"; const ness = "0xe727240728c1a5f95437b8b50afdd0ea4ae5f0c8"; const nessroom = "0xA93248C548Ac26152F3b4F201C9101f4e032074e"; -const ness_cro = "0xbfAAB211C3ea99A2Db682fbc1D9a999861dCba2D"; - -async function getLiquidity(block) { - // delayed by around 5 mins to allow subgraph to update - block -= 25; - var endpoint = `https://subgraph.darkness.finance/subgraphs/name/cronos/swapprod` - var graphQLClient = new GraphQLClient(endpoint) - var query = gql` - query get_tvl($block: Int) { - balancers( - first: 5, - block: { number: $block } - ) { - totalLiquidity, - totalSwapVolume - } - } - `; - const results = await graphQLClient.request(query, { - block - }) - return results.balancers[0].totalLiquidity; -} - -async function tvl(timestamp, block, chainBlocks) { - let balances = toUSDTBalances(await getLiquidity(await getBlock(timestamp, "cronos", chainBlocks))); - - //Farm MEERKAT-LP on mm.finance - await addFundsInMasterChef( - balances, - masterChef, - chainBlocks.cronos, - "cronos", - (addr) => `cronos:${addr}`, - undefined, - [d3usd, ness], //Ignore D3USD because it has been counted in liquidity. - true, - true, - ness, - ); - - return balances; -} - -async function pool2(timestamp, block, chainBlocks) { - block = chainBlocks.cronos - const cro = "0x5C7F8A570d578ED84E63fdFA7b1eE72dEae1AE23"; - return farmLPBalance( - 'cronos', - block, - masterChef, - ness_cro, - cro, - ness, - ); -} +const { sumTokensExport } = require('../helper/unknownTokens'); module.exports = { - methodology: `DarkNess TVL is pulled from the DarkNess subgraph and MEERKAT-LP (on mm.finance) locked in MasterChef (0x63Df75d039f7d7A8eE4A9276d6A9fE7990D7A6C5) , excluded D3USD that has been counted in liquidity`, cronos: { - tvl: tvl, - pool2: pool2, - staking: stakingPricedLP( - nessroom, - ness, - "cronos", - ness_cro, - "darkness-share" - ), + tvl: sumTokensExport({ + owner: '0x92631e0e84ff01853ef1bb88fc9c9f7d1e1af1ca', + tokens: [ + '0x5c7f8a570d578ed84e63fdfa7b1ee72deae1ae23', + '0xf2001b145b43032aaf5ee2884e456ccd805f677d', + ADDRESSES.cronos.USDC, + '0x6582c738660bf0701f05b04dce3c4e5fcfcda47a', + ADDRESSES.cronos.USDT, + '0x83b2ac8642ae46fc2823bc959ffeb3c1742c48b5', + ADDRESSES.cronos.WBTC, + '0x9d3bbb0e988d9fb2d55d07fe471be2266ad9c81c', + '0x1ecaf6a3551e5822f142c9689d8f36a9b5f68217', + '0xfa202a63234a7089eddbfeee83c378ba248f0e9a', + ], + }), + pool2: sumTokensExport({ + owner: masterChef, + tokens: [ + '0xbfaab211c3ea99a2db682fbc1d9a999861dcba2d', + '0x8c183c81a5ae3e7a46ecaac17c4bf27a6a40bbe8', + '0xa4aa24b8e855052071df60e174219e6c8fee45a3', + '0xd9debaab797cb92c257b2988aafa92c728b124e6', + ], + useDefaultCoreAssets: true, + }), + staking: sumTokensExport({ + owner: nessroom, + tokens: [ness], + lps: ['0xd9debaab797cb92c257b2988aafa92c728b124e6'], + useDefaultCoreAssets: true, + }), } }; diff --git a/projects/darkness/utils.js b/projects/darkness/utils.js deleted file mode 100644 index a2f4fe0cbe0..00000000000 --- a/projects/darkness/utils.js +++ /dev/null @@ -1,51 +0,0 @@ -const sdk = require('@defillama/sdk'); -const BigNumber = require('bignumber.js'); -const farmLPBalance = async ( - chain, - block, - masterChef, - lpToken, - token0, - token1, - ) => { - const balances = ( - await sdk.api.abi.multiCall({ - abi: 'erc20:balanceOf', - calls: [ - { - target: token0, - params: [lpToken], - }, - { - target: token1, - params: [lpToken], - }, - { - target: lpToken, - params: [masterChef], - }, - ], - block, - chain: chain, - }) - ).output; - - const lpTotalSuply = ( - await sdk.api.abi.call({ - target: lpToken, - abi: 'erc20:totalSupply', - chain: chain, - block, - }) - ).output; - const token0Locked = new BigNumber(balances[2].output * balances[0].output).div(new BigNumber(lpTotalSuply)); - const token1Locked = new BigNumber(balances[2].output * balances[1].output).div(new BigNumber(lpTotalSuply)); - const result = {}; - result[`${chain}:${token0}`] = token0Locked.toFixed(0); - result[`${chain}:${token1}`] = token1Locked.toFixed(0); - return result; - }; - - module.exports = { - farmLPBalance, - }; \ No newline at end of file diff --git a/projects/darumadao/index.js b/projects/darumadao/index.js index 1f49f58c47a..d1400661599 100644 --- a/projects/darumadao/index.js +++ b/projects/darumadao/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk") const { default: BigNumber } = require("bignumber.js") const { toUSDTBalances } = require('../helper/balances') @@ -5,7 +6,7 @@ const { toUSDTBalances } = require('../helper/balances') const chain = 'godwoken' const STAKING_ADDRESS = '0x31A7D9c604C87F7aA490A350Ef8DF170dC2233AA' const DRM_ADDRESS = '0x81E60A955DC8c4d25535C358fcFE979351d102B5' -const USDC_ADDRESS = '0xc3b946c53e2e62200515d284249f2a91d9df7954' +const USDC_ADDRESS = ADDRESSES.godwoken.USDC const DRM_USDC_LP_ADDRESS = '0x268aaeed47d031751db1cbba50930fe2991f0ed0' async function tvl(ts, _block, chainBlocks) { diff --git a/projects/davos-protocol/index.js b/projects/davos-protocol/index.js new file mode 100644 index 00000000000..9b077e3ad9a --- /dev/null +++ b/projects/davos-protocol/index.js @@ -0,0 +1,20 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport, } = require('../helper/unknownTokens') + +module.exports = { + methodology: 'The total amount of ankrMATIC in the vault', + polygon: { + tvl: sumTokensExport({ chain: 'polygon', owner: '0x5E851dC1f56A05Bb6d3C053FA756304a5171C345', tokens: [ + '0x0E9b89007eEE9c958c0EDA24eF70723C2C93dD58', // ankrMATIC + ] }), + }, + ethereum: { + tvl: sumTokensExport({ chain: 'ethereum', owners: ['0x97f0BdaDbfAA05a1944fFbA862b3336a175056cF', '0xc7b219a9A8e246f9C4d4A1c7d4a371F0840ff724', '0x0730BA2252670Cd71580dadf471f3E137592e800', '0xb396b31599333739A97951b74652c117BE86eE1D', '0x7281d1bCcbe34574Ee6507b3f4816AFBe85A2e3d'], tokens: [ + ADDRESSES.ethereum.WSTETH, + ADDRESSES.ethereum.RETH, + '0x9ee91f9f426fa633d227f7a9b000e28b9dfd8599', //stmatic + ADDRESSES.ethereum.sfrxETH, + ADDRESSES.ethereum.MATIC + ] }), + } +} diff --git a/projects/daytona-finance/index.js b/projects/daytona-finance/index.js new file mode 100644 index 00000000000..99afa2778de --- /dev/null +++ b/projects/daytona-finance/index.js @@ -0,0 +1,10 @@ +const { masterchefExports } = require("../helper/unknownTokens"); + +module.exports = masterchefExports({ + chain: "pulse", + masterchef: "0xAc6fBc06C8c0477ba8fc117adb52881c1Cc580dA", + nativeTokens: ["0x9F8182aD65c53Fd78bd07648a1b3DDcB675c6772"], + useDefaultCoreAssets: true, + poolInfoABI: "function poolInfo(uint256) view returns (address)", + getToken: (i) => i, +}); diff --git a/projects/dbx-finance/index.js b/projects/dbx-finance/index.js new file mode 100644 index 00000000000..9de7567c70f --- /dev/null +++ b/projects/dbx-finance/index.js @@ -0,0 +1,8 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports = { + misrepresentedTokens: true, + arbitrum: { + tvl: getUniTVL({ factory: '0x41755a88d4ab443d5d8ef73ec64dd3df71fb5559', useDefaultCoreAssets: true, }), + } +} diff --git a/projects/ddex/index.js b/projects/ddex/index.js index 26e649e3915..7af4ef51511 100644 --- a/projects/ddex/index.js +++ b/projects/ddex/index.js @@ -1,8 +1,10 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk'); const { nullAddress, sumTokens2 } = require('../helper/unwrapLPs') const { createIncrementArray, getUniqueAddresses } = require('../helper/utils') + const ddexMarginContractAddress = '0x241e82c79452f51fbfc89fac6d912e021db1a3b7' -const SAI = '0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359' +const SAI = ADDRESSES.ethereum.SAI async function tvl(timestamp, block) { const tokens = [] @@ -29,67 +31,6 @@ module.exports = { } const abis = { - getMarket: { - "constant": true, - "inputs": [ - { - "name": "marketID", - "type": "uint16" - } - ], - "name": "getMarket", - "outputs": [ - { - "components": [ - { - "name": "baseAsset", - "type": "address" - }, - { - "name": "quoteAsset", - "type": "address" - }, - { - "name": "liquidateRate", - "type": "uint256" - }, - { - "name": "withdrawRate", - "type": "uint256" - }, - { - "name": "auctionRatioStart", - "type": "uint256" - }, - { - "name": "auctionRatioPerBlock", - "type": "uint256" - }, - { - "name": "borrowEnable", - "type": "bool" - } - ], - "name": "market", - "type": "tuple" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - getAllMarketsCount: { - "constant": true, - "inputs": [], - "name": "getAllMarketsCount", - "outputs": [ - { - "name": "count", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, + getMarket: "function getMarket(uint16 marketID) view returns (tuple(address baseAsset, address quoteAsset, uint256 liquidateRate, uint256 withdrawRate, uint256 auctionRatioStart, uint256 auctionRatioPerBlock, bool borrowEnable) market)", + getAllMarketsCount: "uint256:getAllMarketsCount", } \ No newline at end of file diff --git a/projects/debets/getPoolInfo.json b/projects/debets/getPoolInfo.json deleted file mode 100644 index f9250fc1c7f..00000000000 --- a/projects/debets/getPoolInfo.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "name": "getPoolInfo", - "outputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "freeAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "frozenAmount", - "type": "uint256" - } - ], - "internalType": "struct PoolType.PoolInfo", - "name": "poolInfo", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - } \ No newline at end of file diff --git a/projects/debets/index.js b/projects/debets/index.js index b2c53a8dda5..197d25b8deb 100644 --- a/projects/debets/index.js +++ b/projects/debets/index.js @@ -1,37 +1,61 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); -const getPoolInfo = require("./getPoolInfo.json"); +const getPoolInfo = + "function getPoolInfo(address token) view returns (tuple(uint256 freeAmount, uint256 frozenAmount) poolInfo)"; -const chain = 'polygon' -const FACTORY_ADDRESS = "0xcE214f6a877747495106B5e55533f3e23D290DBd" +// polygon +const factory_address_polygon = "0xcE214f6a877747495106B5e55533f3e23D290DBd"; -const tokens = Object.values({ - POLYGON_WMATIC: "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270", - POLYGON_WETH: "0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619", - POLYGON_WBTC: "0x1BFD67037B42Cf73acF2047067bd4F2C47D9BfD6", - POLYGON_USDC: "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174", - POLYGON_USDT: "0xc2132D05D31c914a87C6611C10748AEb04B58e8F", - POLYGON_DAI: "0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063", +const polygon_tokens = Object.values({ + POLYGON_WMATIC: ADDRESSES.polygon.WMATIC_2, + POLYGON_WETH: ADDRESSES.polygon.WETH_1, + POLYGON_WBTC: ADDRESSES.polygon.WBTC, + POLYGON_USDC: ADDRESSES.polygon.USDC, + POLYGON_USDT: ADDRESSES.polygon.USDT, + POLYGON_DAI: ADDRESSES.polygon.DAI, POLYGON_XEN: "0x2AB0e9e4eE70FFf1fB9D67031E44F6410170d00e", -}) +}); -async function tvl(_, _b, {[chain]: block}) { - const balances = {} - const transform = i => `${chain}:${i}` - const { output } = await sdk.api.abi.multiCall({ - target: FACTORY_ADDRESS, - abi: getPoolInfo, - calls: tokens.map(i => ({ params: [i]})), - chain, block, - }) - output.forEach(({ output }, i) => { - sdk.util.sumSingleBalance(balances, transform(tokens[i]), output.freeAmount) - sdk.util.sumSingleBalance(balances, transform(tokens[i]), output.frozenAmount) - }) - return balances +// fantom +const factory_address_fantom = "0x069C55f2DDb434fF67055977dbeB9e9FE8a2F25E"; + +const fantom_tokens = Object.values({ + FANTOM_WFTM: ADDRESSES.fantom.WFTM, + FANTOM_XEN: "0xeF4B763385838FfFc708000f884026B8c0434275", +}); + +function chain_tvl(chain, factory, tokens) { + return async function (_, _b, { [chain]: block }) { + const balances = {}; + const transform = (i) => `${chain}:${i}`; + const { output } = await sdk.api.abi.multiCall({ + target: factory, + abi: getPoolInfo, + calls: tokens.map((i) => ({ params: [i] })), + chain, + block, + }); + output.forEach(({ output }, i) => { + sdk.util.sumSingleBalance( + balances, + transform(tokens[i]), + output.freeAmount + ); + sdk.util.sumSingleBalance( + balances, + transform(tokens[i]), + output.frozenAmount + ); + }); + return balances; + }; } module.exports = { polygon: { - tvl, + tvl: chain_tvl("polygon", factory_address_polygon, polygon_tokens), + }, + fantom: { + tvl: chain_tvl("fantom", factory_address_fantom, fantom_tokens), }, }; diff --git a/projects/debridge/index.js b/projects/debridge/index.js index c3d894f6a37..085f7fe0beb 100644 --- a/projects/debridge/index.js +++ b/projects/debridge/index.js @@ -1,4 +1,5 @@ -const { get } = require('../helper/http') +const { getConfig } = require('../helper/cache') + const { chainExports } = require('../helper/exports'); const { sumTokens } = require("../helper/unwrapLPs"); @@ -18,7 +19,7 @@ function chainTvl(chain) { const transformAddress = id=>`${chain}:${id}`; const url = `${http_api_url}?chainId=${chainIds[chain]}`; - const debridge_response = await get(url); + const debridge_response = await getConfig('debridge/'+chain,url); // console.log(debridge_response) const tokensAndOwners = debridge_response .filter(t => !t.tokenName.startsWith('deBridge ')) diff --git a/projects/debtdao/index.js b/projects/debtdao/index.js new file mode 100644 index 00000000000..8f7d5ae3f6e --- /dev/null +++ b/projects/debtdao/index.js @@ -0,0 +1,92 @@ +const { getLogs } = require('../helper/cache/getLogs') +const { sumTokens2 } = require('../helper/unwrapLPs') + +const config = { + ethereum: { + moduleFactory: '0x00A3699F677C252CA32B887F9f66621920D392f8', + moduleFactoryStart: 16970379, + lineFactory: '0xc9ef6509a09b92043cedce689dfaa760048abd7f', + lineFactoryStart: 16970396, + }, + // xdai: { + // moduleFactory: '0x00A3699F677C252CA32B887F9f66621920D392f8', + // moduleFactoryStart: 27253390, + // lineFactory: '0xc9ef6509a09b92043cedce689dfaa760048abd7f', + // lineFactoryStart: 27253485, + // }, +} + +module.exports = { +}; + +Object.keys(config).forEach(chain => { + const { moduleFactory, moduleFactoryStart, lineFactory, lineFactoryStart, } = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const ownerTokens = [] + const escrowLogs = await getLogs({ + api, + target: moduleFactory, + topics: ['0x795112e1546f70e94f47252ccd7189f90d711b2e6557885dc3def7b589c7f7ac'], + eventAbi: 'event DeployedEscrow (address indexed deployedAt, uint32 indexed minCRatio, address indexed oracle, address owner)', + onlyArgs: true, + fromBlock: moduleFactoryStart, + }) + const lineLogs = await getLogs({ + api, + target: lineFactory, + topics: ['0xc043ebb31424e42a4ec1454f0de8a7ab9ba0443b8b556c538484c873ae8e64b5'], + eventAbi: 'event DeployedSecuredLine (address indexed deployedAt, address indexed escrow, address indexed spigot, address swapTarget, uint8 revenueSplit)', + onlyArgs: true, + fromBlock: lineFactoryStart, + }) + + await Promise.all(escrowLogs.map(async (log) => { + const escrow = log.deployedAt + const tokenLogs = await getLogs({ + api, + target: escrow, + topic: 'EnableCollateral(address)', + eventAbi: 'event EnableCollateral(address indexed token)', + onlyArgs: true, + fromBlock: moduleFactoryStart, + }) + ownerTokens.push([tokenLogs.map(i => i.token), escrow]) + })) + await Promise.all(lineLogs.map(async (log) => { + const target = log.deployedAt + const counts = await api.call({ abi: "function counts() view returns (uint256, uint256)", target }) + const calls = [] + for (let i = 0; i < counts[0]; i++) calls.push(i) + const proposals = await api.multiCall({ abi: "function ids(uint256) view returns (bytes32)", calls, target }) + const credits = await api.multiCall({ abi: "function credits(bytes32) view returns (uint256 deposit, uint256 principal, uint256 interestAccrued, uint256 interestRepaid, uint8 decimals, address token, address lender, bool isOpen)", calls: proposals, target }) + ownerTokens.push([credits.map(i => i.token), target]) + })) + return sumTokens2({ api, ownerTokens }) + }, + borrowed: async (_, _b, _cb, { api, }) => { + const lineLogs = await getLogs({ + api, + target: lineFactory, + topics: ['0xc043ebb31424e42a4ec1454f0de8a7ab9ba0443b8b556c538484c873ae8e64b5'], + eventAbi: 'event DeployedSecuredLine (address indexed deployedAt, address indexed escrow, address indexed spigot, address swapTarget, uint8 revenueSplit)', + onlyArgs: true, + fromBlock: lineFactoryStart, + }) + + await Promise.all(lineLogs.map(async (log) => { + const target = log.deployedAt + const counts = await api.call({ abi: "function counts() view returns (uint256, uint256)", target }) + const calls = [] + for (let i = 0; i < counts[0]; i++) calls.push(i) + const proposals = await api.multiCall({ abi: "function ids(uint256) view returns (bytes32)", calls, target }) + const credits = await api.multiCall({ abi: "function credits(bytes32) view returns (uint256 deposit, uint256 principal, uint256 interestAccrued, uint256 interestRepaid, uint8 decimals, address token, address lender, bool isOpen)", calls: proposals, target }) + credits.map(i => { + api.add(i.token, i.principal) + // api.add(i.token, i.interestAccrued) + // api.add(i.token, i.interestRepaid * -1) + }) + })) + } + } +}) \ No newline at end of file diff --git a/projects/decubate/index.js b/projects/decubate/index.js index 0cafc436822..b18c12bf431 100644 --- a/projects/decubate/index.js +++ b/projects/decubate/index.js @@ -1,7 +1,7 @@ const sdk = require("@defillama/sdk"); const DCBToken = "0xEAc9873291dDAcA754EA5642114151f3035c67A2"; -const stakingPool = "0x22B551fE288c93A3Ac9172aD998A1D9ce1A882e5"; +const stakingPool = "0xD1748192aE1dB982be2FB8C3e6d893C75330884a"; async function staking (timestamp, block, chainBlocks) { let balances = {}; @@ -24,4 +24,4 @@ module.exports = { staking }, -} \ No newline at end of file +} diff --git a/projects/dedust/index.js b/projects/dedust/index.js new file mode 100644 index 00000000000..0d504ed2c0d --- /dev/null +++ b/projects/dedust/index.js @@ -0,0 +1,22 @@ +const { get } = require('../helper/http') +const { transformDexBalances } = require('../helper/portedTokens') + +module.exports = { + misrepresentedTokens: true, + timetravel: false, + ton: { + tvl: async () => { + const pools = await get('https://api.dedust.io/v1/pools') + + return transformDexBalances({ + chain: 'ton', + data: pools.map(i => ({ + token0: i.left_token_root, + token1: i.right_token_root, + token0Bal: i.left_token_reserve, + token1Bal: i.right_token_reserve, + })) + }) + } + } +} diff --git a/projects/deepbook-sui/index.js b/projects/deepbook-sui/index.js new file mode 100644 index 00000000000..b3442194670 --- /dev/null +++ b/projects/deepbook-sui/index.js @@ -0,0 +1,23 @@ +const { toUSDTBalances } = require('../helper/balances') +const { get } = require('../helper/http') + +async function tvl(ts) { + const {data} = await get('https://49490zsfv2.execute-api.us-east-1.amazonaws.com/sui/deepbook?interval=hour&timeFrame=1&dataType=tvl') + return toUSDTBalances(findClosestTvl(data, ts)) +} + +module.exports = { + timetravel: false, + misrepresentedTokens: true, + sui: { + tvl + } +} + +function findClosestTvl(data, ts) { + ts = ts * 1000 + data.forEach(i => i.ts = new Date(i.timestamp)) + data = data.filter(i => i.ts < ts && (ts -i.ts) < 86400000) // filter for recent tvl but less than day old + data.sort((a, b) => b.ts - a.ts) + return data[0].tvl +} \ No newline at end of file diff --git a/projects/deeplock/abi.json b/projects/deeplock/abi.json index a3bd02d6f59..2c8275c5675 100644 --- a/projects/deeplock/abi.json +++ b/projects/deeplock/abi.json @@ -1,67 +1,5 @@ { - "depositId": { - "inputs": [], - "name": "depositId", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "lockedToken": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "lockedToken", - "outputs": [ - { - "internalType": "address", - "name": "tokenAddress", - "type": "address" - }, - { - "internalType": "address", - "name": "withdrawalAddress", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "unlockTime", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "withdrawn", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - "symbol": { - "inputs": [], - "name": "symbol", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - } + "depositId": "uint256:depositId", + "lockedToken": "function lockedToken(uint256) view returns (address tokenAddress, address withdrawalAddress, uint256 tokenAmount, uint256 unlockTime, bool withdrawn)", + "symbol": "string:symbol" } \ No newline at end of file diff --git a/projects/deeplock/apiCache.js b/projects/deeplock/apiCache.js index b5e149c817a..dd607136600 100644 --- a/projects/deeplock/apiCache.js +++ b/projects/deeplock/apiCache.js @@ -2,9 +2,10 @@ const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); const { pool2s } = require("../helper/pool2"); const { getUniqueAddresses } = require('../helper/utils') -const { vestingHelper, getCache, setCache, } = require("../helper/cache"); +const { getCache, setCache, } = require("../helper/cache") +const { vestingHelper, } = require("../helper/unknownTokens") -const project = 'deeplock' +const project = 'bulky/deeplock' const deepLockLockerContractV1 = "0x10dD7FD1Bf3753235068ea757f2018dFef94B257"; const deepLockLockerContractV2 = "0x3f4D6bf08CB7A003488Ef082102C2e6418a4551e"; @@ -50,7 +51,7 @@ const bscTvl = async (ts, _b, { bsc: block }) => { ].map(i => i.toLowerCase()) const chain = 'bsc' - const cache = getCache(project, chain) || { vaults: {} } + const cache = await getCache(project, chain) || { vaults: {} } const balances = {} const contracts = [ deepLockLockerContractV1, @@ -67,7 +68,7 @@ const bscTvl = async (ts, _b, { bsc: block }) => { allBalances.forEach(balance => { Object.entries(balance).forEach(([token, val]) => sdk.util.sumSingleBalance(balances, token, val)) }) - setCache(project, chain, cache) + await setCache(project, chain, cache) delete balances['bsc:0x60de5f9386b637fe97af1cc05f25548e9baaee19'] // remove deeplock token from tvl calculation delete balances['bsc:0x64f36701138f0e85cc10c34ea535fdbadcb54147'] // remove Anon INU - incorrect price diff --git a/projects/deerfi/abi.json b/projects/deerfi/abi.json index 4463131a399..16723cbc1a2 100644 --- a/projects/deerfi/abi.json +++ b/projects/deerfi/abi.json @@ -1,68 +1,6 @@ { - "allPools": { - "constant": true, - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "allPools", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "allPoolsLength": { - "constant": true, - "inputs": [], - "name": "allPoolsLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "token": { - "constant": true, - "inputs": [], - "name": "token", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "reserve": { - "constant": true, - "inputs": [], - "name": "reserve", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } + "allPools": "function allPools(uint256) view returns (address)", + "allPoolsLength": "uint256:allPoolsLength", + "token": "address:token", + "reserve": "uint256:reserve" } \ No newline at end of file diff --git a/projects/defenderfinance/index.js b/projects/defenderfinance/index.js new file mode 100644 index 00000000000..97d6ab832cc --- /dev/null +++ b/projects/defenderfinance/index.js @@ -0,0 +1,24 @@ +const { pool2s } = require("../helper/pool2"); + +const SWDB_TOKEN = "0xc91324601B20ea0e238B63c9fAfca18d32600722"; + +const farmContractsBSC = [ + //Share Rewards Pool + "0xDFfD5c4FA736f696ebdbbB68ff1D5a4Ca0E70d48", +]; + +const lpPairContractsBSC = [ + //SWDB_ETH_LP + "0x4a931BD6Ab3ab804ae392223C5920426C153DA25", + //SHARE_WBNB_LP + "0x3f344fcA3EB75a745878355E065b58B4EfDE2575" +] + +module.exports = { + bsc: { + pool2: pool2s(farmContractsBSC, lpPairContractsBSC), + tvl: () => 0, + }, + methodology: + "Counts liquidity on the Farms through Defender Finance Contracts", +}; diff --git a/projects/defi-basket/abi.json b/projects/defi-basket/abi.json deleted file mode 100644 index afc8cce4e11..00000000000 --- a/projects/defi-basket/abi.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "inputs": [], - "name": "tokenCounter", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" -} diff --git a/projects/defi-basket/api.js b/projects/defi-basket/api.js new file mode 100644 index 00000000000..b94b845549e --- /dev/null +++ b/projects/defi-basket/api.js @@ -0,0 +1,43 @@ +const { sumTokens2 } = require('../helper/unwrapLPs') +const { covalentGetTokens } = require('../helper/http') +const { PromisePool } = require('@supercharge/promise-pool') + +const factory = '0xee13c86ee4eb1ec3a05e2cc3ab70576f31666b3b' +const blacklistedTokens = [ + '0x0b91b07beb67333225a5ba0259d55aee10e3a578', // MNEP +] + +async function tvl(_, _1,_2, { api }) { + const wallets = await api.multiCall({ + itemAbi: abis.walletOf, + lengthAbi: abis.tokenCounter, + target: factory, + }) + const tokensAndOwners = [] + const { errors } = await PromisePool + .withConcurrency(31) + .for(wallets) + .process(addWallet) + + if (errors && errors.length) + throw errors[0] + + return sumTokens2({ tokensAndOwners, api, blacklistedTokens, }); + + async function addWallet(wallet) { + (await covalentGetTokens(wallet, 'polygon')).forEach(i => tokensAndOwners.push([i, wallet])) + } +} + +module.exports = { + timetravel: false, + methodology: "The TVL is calculated by summing the value of all assets that are in the wallets deployed by the DeFiBasket contract.", + polygon: { + tvl + }, +} + +const abis = { + tokenCounter: "uint256:tokenCounter", + walletOf: "function walletOf(uint256 nftId) view returns (address)", +} diff --git a/projects/defi-basket/index.js b/projects/defi-basket/index.js index 856dc81a41f..0164468ffef 100644 --- a/projects/defi-basket/index.js +++ b/projects/defi-basket/index.js @@ -1,62 +1,24 @@ -const sdk = require('@defillama/sdk') -const { sumTokens2 } = require('../helper/unwrapLPs') -const { getParamCalls, log } = require('../helper/utils') -const { get } = require('../helper/http') -const { PromisePool } = require('@supercharge/promise-pool') - -const chain = 'polygon' -const block = undefined -const factory = '0xee13c86ee4eb1ec3a05e2cc3ab70576f31666b3b' -const blacklistedTokens = [ - '0x0b91b07beb67333225a5ba0259d55aee10e3a578', // MNEP -] - -async function getTokens(address) { - return ( - await get(`https://api.covalenthq.com/v1/137/address/${address}/balances_v2/?&key=ckey_72cd3b74b4a048c9bc671f7c5a6`)) - .data.items.filter(i => +i.balance > 0).map((t) => t.contract_address); -} +const { post } = require('../helper/http') async function tvl() { - const { output: tokenCount } = await sdk.api.abi.call({ - target: factory, - abi: abis.tokenCounter, - chain, block, - }) - let { output: wallets } = await sdk.api.abi.multiCall({ - target: factory, - abi: abis.walletOf, - calls: getParamCalls(tokenCount), - chain, block, - }) - wallets = wallets.map(i => i.output) - log(chain, wallets.length) - const tokensAndOwners = [] - const { errors } = await PromisePool - .withConcurrency(31) - .for(wallets) - .process(addWallet) - - if (errors && errors.length) - throw errors[0] - - log(chain, 'fetching balances count', tokensAndOwners.length) - return sumTokens2({ tokensAndOwners, chain, block, blacklistedTokens, }); - - async function addWallet(wallet) { - (await getTokens(wallet)).forEach(i => tokensAndOwners.push([i, wallet])) + const body = {"pageIndex":0,"sortBy":"pnl","nameQuery":"","filterValue":10,"nftIds":null,"filterCategory":[]} + let tether = 0 + let res + do { + res = await post('https://www.usepicnic.com/api/get-portfolios', body) + res.portfolios.forEach(i => tether += i.value) + body.pageIndex += 1 + } while(res.pagination.hasNext) + return { + tether } } module.exports = { timetravel: false, + misrepresentedTokens: true, methodology: "The TVL is calculated by summing the value of all assets that are in the wallets deployed by the DeFiBasket contract.", polygon: { tvl }, } - -const abis = { - tokenCounter: {"inputs":[],"name":"tokenCounter","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}, - walletOf: {"inputs":[{"internalType":"uint256","name":"nftId","type":"uint256"}],"name":"walletOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}, -} \ No newline at end of file diff --git a/projects/defi-swap/index.js b/projects/defi-swap/index.js index 270c1eaeeb7..e2b4294eb8c 100644 --- a/projects/defi-swap/index.js +++ b/projects/defi-swap/index.js @@ -1,8 +1,9 @@ const { getUniTVL } = require('../helper/unknownTokens') module.exports = { + misrepresentedTokens: true, start: 1599523200, // Tuesday, 8 September 2020 00:00:00 ethereum: { - tvl: getUniTVL({ factory: '0x9DEB29c9a4c7A88a3C0257393b7f3335338D9A9D'}) + tvl: getUniTVL({ factory: '0x9DEB29c9a4c7A88a3C0257393b7f3335338D9A9D', useDefaultCoreAssets: true }), }, } diff --git a/projects/defibox/index.js b/projects/defibox/index.js index 89846504a73..95b9d7a2270 100644 --- a/projects/defibox/index.js +++ b/projects/defibox/index.js @@ -1,62 +1,69 @@ const axios = require("axios"); const utils = require("../helper/utils"); -const {get_account_tvl} = require('../helper/chain/eos') const {lendingMarket} = require("../helper/methodologies") -const eosEndpoint = "https://dapp.defibox.io/api/" -const bscEndpoint = "https://bsc.defibox.io/api/" +const endpoint = (chain) => `https://${chain}.defibox.io/api/` async function eos() { - const swap = await utils.fetchURL(eosEndpoint + "swap/get24HInfo") - const lend = await utils.fetchURL(eosEndpoint + "lend/getGlobalOpenPositionStat") - const usn = await utils.fetchURL(eosEndpoint + "st/open/getGlobalOpenStat") - const tvl = lend.data.data.practicalBalance - lend.data.data.totalBorrowsVariable + // lend TVL - usn.data.globalOpenStat.totalMortgage // usn (stable token) TVL + const swap = await utils.fetchURL(endpoint("eos") + "swap/get24HInfo"); + const lend = await utils.postURL(endpoint("eos") + "lend/getGlobalOpenPositionStat") + const usn = await utils.postURL(endpoint("eos") + "st/open/getGlobalOpenStat") + const bal = await utils.fetchURL(endpoint("eos") + "bal/get24HInfo"); + const vault = await utils.postURL(endpoint("eos") + "vault/getVaultStat"); + + // Calculate TVL (in $EOS value) + const eos = Number(swap.data.data.eosBalance) * 2; // swap TVL (dual sided 50/50 AMM pool) + + // Calculate TVL (in $USDT value) + const lend_tvl = Number(lend.data.data.practicalBalance) - Number(lend.data.data.totalBorrowsVariable); // lending protocol (deposits - borrowed assets) + const usn_tvl = Number(usn.data.globalOpenStat.totalMortgage) // USN (over-collaterized stable token) + const bal_tvl = Number(bal.data.data.balUsdtBalance) // balance protocol TVL (total in USDT value) + const vault_tvl = Number(vault.data.data) // vault protocol TVL (time deposit EOS & USDT valued in $USD) + const tether = lend_tvl + usn_tvl + bal_tvl + vault_tvl; + return { - tether: tvl, - eos: swap.data.data.eosBalance * 2, // swap TVL + tether, + eos, } } async function borrowed() { - const lend = await utils.fetchURL(eosEndpoint + "lend/getGlobalOpenPositionStat") - const tvl = lend.data.data.totalBorrowsVariable // lend TVL + const lend = await utils.postURL(endpoint("eos") + "lend/getGlobalOpenPositionStat") + const tether = Number(lend.data.data.totalBorrowsVariable) // total TVL that is borrowed from lend protocol - return { - tether: tvl, - } + return {tether}; } async function wax() { - const tokens = [ - ["eosio.token", "WAX", "wax"], - ["alien.worlds", "TLM", "alien-worlds"], - // ["e.rplanet", "AETHER", null], // no CoinGecko price support - // ["e.rplanet", "RDAO", null], // no CoinGecko price support - // ["prospectorsw", "PGL", null], // no CoinGecko price support - ]; - return get_account_tvl("swap.box", tokens, "wax"); + const swap = await utils.fetchURL(endpoint("wax") + "swap/get24HInfo"); + const wax = Number(swap.data.data.waxBalance) * 2; // swap TVL (dual sided 50/50 AMM pool) + + return { + wax, + } } async function bsc() { - const swap = await axios.default.post(bscEndpoint + "swap/get24HInfo", {}, { headers: { chainid: 56 }}) + const swap = await axios.post(endpoint("bsc") + "swap/get24HInfo", {}, {headers: {chainid: 56}}); + const wbnb = Number(swap.data.data.wbnb_balance) * 2; // swap TVL (dual sided 50/50 AMM pool) + return { - tether: swap.data.data.usd_balance, - binancecoin: swap.data.data.wbnb_balance, + wbnb, } } module.exports = { - methodology: `${lendingMarket}. Defibox TVL is achieved by making a call to its API: https://dapp.defibox.io/api/.`, + methodology: `${lendingMarket}. Defibox TVL is achieved by making a call to its API: https://.defibox.io/api/.`, timetravel: false, + misrepresentedTokens: true, eos: { tvl: eos, borrowed, }, - bsc: { - tvl: bsc - }, wax: { tvl: wax }, + bsc: { + tvl: bsc + } } diff --git a/projects/defichain-loans/api.js b/projects/defichain-loans/api.js new file mode 100644 index 00000000000..387ae389c28 --- /dev/null +++ b/projects/defichain-loans/api.js @@ -0,0 +1,6 @@ +const { getExports } = require('../helper/heroku-api') + +module.exports = { + timetravel: false, + ...getExports("defichain-loans", ['defichain']), +} \ No newline at end of file diff --git a/projects/defichain-loans.js b/projects/defichain-loans/index.js similarity index 78% rename from projects/defichain-loans.js rename to projects/defichain-loans/index.js index c712a493d97..97d0fa086da 100644 --- a/projects/defichain-loans.js +++ b/projects/defichain-loans/index.js @@ -1,6 +1,6 @@ -const { get } = require('./helper/http') -const { log } = require('./helper/utils') -const { transformBalances } = require('./helper/portedTokens') +const { get } = require('../helper/http') +const { log } = require('../helper/utils') +const { transformBalances } = require('../helper/portedTokens') const sdk = require('@defillama/sdk') async function tvl() { @@ -12,11 +12,11 @@ async function tvl() { let endpoint = baseURI if (next) endpoint += '&next=' + next - log('fetchin: ', ++page) + log('fetchin: ', ++page, next) const res = await get(endpoint) next = res.page?.next - res.data.forEach(({ collateralAmounts, loanAmounts, }) => { + res.data.forEach(({ collateralAmounts = [], loanAmounts = [], }) => { collateralAmounts.forEach(({ amount, symbol }) => { sdk.util.sumSingleBalance(balances, symbol, +amount) }) diff --git a/projects/defichain-staking.js b/projects/defichain-staking.js deleted file mode 100644 index f0f926f5d5e..00000000000 --- a/projects/defichain-staking.js +++ /dev/null @@ -1,11 +0,0 @@ -const utils = require('./helper/utils'); - -async function fetch() { - const { data } = await utils.fetchURL('https://ocean.defichain.com/v0/mainnet/stats') - return data.data.tvl.masternodes; -} - -module.exports = { - methodology: "Liquidity on the Staking", - fetch -} diff --git a/projects/defidollar/abi.json b/projects/defidollar/abi.json index e75d4fcb2ca..6b6d3fd9e9a 100644 --- a/projects/defidollar/abi.json +++ b/projects/defidollar/abi.json @@ -1,35 +1,4 @@ { - "pricePerShare": { - "inputs": [], - "name": "pricePerShare", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "yCrvDistribution": { - "constant": true, - "inputs": [], - "name": "yCrvDistribution", - "outputs": [ - { - "internalType": "uint256", - "name": "here", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "total", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } -} + "pricePerShare": "uint256:pricePerShare", + "yCrvDistribution": "function yCrvDistribution() view returns (uint256 here, uint256 total)" +} \ No newline at end of file diff --git a/projects/defidollar/index.js b/projects/defidollar/index.js index 4f819b2196f..bc9c933bc21 100644 --- a/projects/defidollar/index.js +++ b/projects/defidollar/index.js @@ -33,6 +33,9 @@ async function tvl(_timestamp, block) { } module.exports = { + hallmarks: [ + [1641600000, "Possible exploit, contracts paused"] + ], ethereum:{ tvl }, diff --git a/projects/defiedge/index.js b/projects/defiedge/index.js new file mode 100644 index 00000000000..dba0ab92cdd --- /dev/null +++ b/projects/defiedge/index.js @@ -0,0 +1,40 @@ +const { graphQuery } = require('../helper/http') + +const endpoint = "https://api.defiedge.io/graphql"; +const query = ` + query Stats($network: [Network!] $dex: [Dex!] = [Uniswap, Apeswap, Pancakeswap, Arbidex, Sushiswap]) { + stats(network: $network, dex: $dex) { + totalValueManaged + } + } + `; + +async function tvl() { + const { api } = arguments[3] + let tvl = 0 + const { dexes, network } = config[api.chain] + for (const dex of dexes) { + const results = await graphQuery(endpoint, query, { network: [network], dex: [dex] }) + tvl += results.stats.totalValueManaged + } + + return { "usd-coin": tvl}; +} + +module.exports = { + doublecounted: true, + timetravel: false, + misrepresentedTokens: true, +}; + +const config = { + ethereum: { dexes: ["Uniswap",], network: "mainnet",}, + bsc: { dexes: ["Uniswap", "Apeswap", "Pancakeswap",], network: "bsc",}, + arbitrum: { dexes: ["Uniswap", "Arbidex", "Sushiswap"], network: "arbitrum",}, + optimism: { dexes: ["Uniswap",], network: "optimism",}, + polygon: { dexes: ["Uniswap",], network: "polygon",}, +} + +Object.keys(config).forEach(chain => { + module.exports[chain] = { tvl } +}) \ No newline at end of file diff --git a/projects/defifranc/getEntireSystemColl.abi.json b/projects/defifranc/getEntireSystemColl.abi.json deleted file mode 100644 index 091696af713..00000000000 --- a/projects/defifranc/getEntireSystemColl.abi.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "inputs": [ - { - "internalType": "address", - "name": "_asset", - "type": "address" - } - ], - "name": "getEntireSystemColl", - "outputs": [ - { - "internalType": "uint256", - "name": "entireSystemColl", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" -} diff --git a/projects/defifranc/index.js b/projects/defifranc/index.js index 593fc8eb005..6a7a887e788 100644 --- a/projects/defifranc/index.js +++ b/projects/defifranc/index.js @@ -1,10 +1,10 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); -const getEntireSystemCollAbi = require("./getEntireSystemColl.abi.json"); const { staking } = require('../helper/staking') const Collaterals = { - ETH: "0x0000000000000000000000000000000000000000", - wBTC: "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599"// + ETH: ADDRESSES.null, + wBTC: ADDRESSES.ethereum.WBTC// } const TROVE_MANAGER_ADDRESS = "0x99838142189adE67c1951f9c57c3333281334F7F"; // deposits in native ETH and wBTC @@ -17,17 +17,17 @@ async function tvl(_, block, chainBlocks) { const balances = {} const calls = Object.values(Collaterals).map(token => ({ params: [token] })) const { output } = await sdk.api.abi.multiCall({ - calls, block, chain: 'ethereum', target: TROVE_MANAGER_ADDRESS, abi: getEntireSystemCollAbi, + calls, block, chain: 'ethereum', target: TROVE_MANAGER_ADDRESS, abi: "function getEntireSystemColl(address _asset) view returns (uint256 entireSystemColl)", }) output.forEach(({ input: { params: [token] }, output }) => { - if (token.toLowerCase() === '0x2260fac5e5542a773aa44fbcfedf7c193bc2c599') // Fix wBTC balance + if (token.toLowerCase() === ADDRESSES.ethereum.WBTC) // Fix wBTC balance output /= 1e10 sdk.util.sumSingleBalance(balances, token, output) }) return balances; -}; +} module.exports = { ethereum: { diff --git a/projects/defihalal/index.js b/projects/defihalal/index.js index b2a3ee5ca40..a7bd51a86ca 100644 --- a/projects/defihalal/index.js +++ b/projects/defihalal/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const {getLiquityTvl} = require('../helper/liquity') //USDH TOKEN ADDRESS ON POLYGON MAINNET @@ -6,6 +7,6 @@ const USDH_TOKEN_ADDRESS = "0x92B27abe3C96d3B1266f881b3B0886e68645F51F"; module.exports = { methodology: "Deposited Matic and USDH, USDH is not listed on CoinGecko and has been replaced with TUSD", polygon:{ - tvl: getLiquityTvl("0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270", "0xd8a3e8c70091d6231a63e671a6ce8ea44e143d24", "polygon") + tvl: getLiquityTvl(ADDRESSES.polygon.WMATIC_2, "0xd8a3e8c70091d6231a63e671a6ce8ea44e143d24", "polygon") } }; diff --git a/projects/defikingdoms/index.js b/projects/defikingdoms/index.js index 485053d0f13..49bced43b00 100644 --- a/projects/defikingdoms/index.js +++ b/projects/defikingdoms/index.js @@ -1,12 +1,16 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { staking } = require("../helper/staking"); const { getUniTVL } = require("../helper/unknownTokens"); -const factory = "0x9014B937069918bd319f80e8B3BB4A2cf6FAA5F7" module.exports = { harmony: { - tvl: getUniTVL({ factory, chain: 'harmony', useDefaultCoreAssets: true, }), - staking: staking("0xa9ce83507d872c5e1273e745abcfda849daa654f", "0x72cb10c6bfa5624dd07ef608027e366bd690048f", "harmony"), + tvl: getUniTVL({ factory: '0x9014B937069918bd319f80e8B3BB4A2cf6FAA5F7', chain: 'harmony', useDefaultCoreAssets: true }), + staking: staking(ADDRESSES.harmony.xJEWEL, ADDRESSES.harmony.JEWEL, "harmony"), + }, + klaytn: { + tvl: getUniTVL({ factory: '0x36fAE766e51f17F8218C735f58426E293498Db2B', chain: 'klaytn', useDefaultCoreAssets: true }), + staking: staking("0xaa8548665bcc12c202d5d0c700093123f2463ea6", "0x30c103f8f5a3a732dfe2dce1cc9446f545527b43", "klaytn"), }, hallmarks:[ [1655991120, "Horizon bridge Hack $100m"], diff --git a/projects/defil/abi.json b/projects/defil/abi.json deleted file mode 100644 index 53d0ded2f54..00000000000 --- a/projects/defil/abi.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "constant": true, - "inputs": [], - "name": "totalBorrows", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" -} \ No newline at end of file diff --git a/projects/defil/index.js b/projects/defil/index.js index 020b24161e7..44e78b40a56 100644 --- a/projects/defil/index.js +++ b/projects/defil/index.js @@ -4,7 +4,7 @@ const { getChainTransform } = require('../helper/portedTokens'); const { staking } = require("../helper/staking.js"); const { pool2 } = require('../helper/pool2'); const contracts = require('./contracts.json'); -const abi = require('./abi.json'); +const abi = "uint256:totalBorrows" function tvl(chain) { return async (timestamp, block, chainBlocks) => { @@ -44,8 +44,8 @@ function tvl(chain) { token: tokens[i].address } ); - }; - }; + } + } delete balances[contracts.ethereum.tokens.DFL.address]; @@ -59,7 +59,7 @@ function tvl(chain) { return balances; }; -}; +} function borrowed(chain) { return async (timestamp, block, chainBlocks) => { return { @@ -72,7 +72,7 @@ function borrowed(chain) { })).output }; }; -}; +} module.exports = { bsc: { tvl: tvl('bsc'), diff --git a/projects/defily-dex/index.js b/projects/defily-dex/index.js new file mode 100644 index 00000000000..8ebc8cb1a59 --- /dev/null +++ b/projects/defily-dex/index.js @@ -0,0 +1,15 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +const config = { + onus: '0xf57578DD26422e80ab4051165Fb64DA1F25E740A', +} + +module.exports = { + misrepresentedTokens: true, +}; + +Object.keys(config).forEach(chain => { + module.exports[chain] = { + tvl: getUniTVL({ useDefaultCoreAssets: true, factory: config[chain], }) + } +}) diff --git a/projects/defilyio/index.js b/projects/defilyio/index.js index b49d50571f1..eca2a2ca3fb 100644 --- a/projects/defilyio/index.js +++ b/projects/defilyio/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const utils = require("../helper/utils"); const { staking } = require("../helper/staking"); @@ -6,12 +7,14 @@ const stakingContract_KARDIA = "0x0245a1f57Ee84b55Cf489Eb5F3d27355014e57f8"; const stakingContract_Harmony = "0x3b441bf2522927BCf41c1c24786E7a8E9a56B234"; const DFL = "0xD675fF2B0ff139E14F86D87b7a6049ca7C66d76e"; -const DFL_Harmony = "0xfea7a6a0b346362bf88a9e4a88416b77a57d6c2a"; +const DFL_Harmony = ADDRESSES.arbitrum.MIM; const fetch = async () => { + return 0 + /* const tvl = (await utils.fetchURL("https://api.defily.io/v1/statistics")).data .payload.totalValueLocked.total; - return tvl; + return tvl; */ }; module.exports = { diff --git a/projects/defimaster/index.js b/projects/defimaster/index.js new file mode 100644 index 00000000000..b9f286e6f70 --- /dev/null +++ b/projects/defimaster/index.js @@ -0,0 +1,29 @@ +const sdk = require("@defillama/sdk"); +const { unwrapLPsAuto } = require("../helper/unwrapLPs"); + +const abi = { + "poolLength": "uint256:poolLength", + "poolInfo": "function poolInfo(uint256) view returns (address lpToken, uint256 allocPoint, uint256 lastRewardTimestamp, uint256 accSushiPerShare, bool isVault)" +} + +async function tvl(_, _b, _cb, { api, }) { + const balances = {} + const pools = (await api.fetchList({ lengthAbi: abi.poolLength, itemAbi: abi.poolInfo, target: chefArbitrum })).map(i => i.lpToken) + const symbols = await api.multiCall({ abi: 'erc20:symbol', calls: pools }) + const vaults = pools.filter((_, i) => /_ZLP$/.test(symbols[i])) + const underlying = await api.multiCall({ abi: 'address:UNDERLYING', calls: vaults }) + const bals = await api.multiCall({ abi: 'uint256:totalHoldings', calls: vaults }) + bals.forEach((v, i) => sdk.util.sumSingleBalance(balances,underlying[i],v, api.chain)) + await unwrapLPsAuto({ api, balances}) + return balances +} + +const chefArbitrum = "0x2F9805038114B9DDcf99316a5b4Db2eC820322D3"; + +module.exports = { + methodology: `Total value in MasterChef`, + misrepresentedTokens: true, + arbitrum: { + tvl, + }, +} diff --git a/projects/definer/abi.json b/projects/definer/abi.json index a139eaede0b..fbc61613194 100644 --- a/projects/definer/abi.json +++ b/projects/definer/abi.json @@ -1,194 +1,12 @@ { - "global:tokenInfoRegistry": { - "constant": true, - "inputs": [], - "name": "tokenInfoRegistry", - "outputs": [ - { - "internalType": "contract TokenRegistry", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "global:bank": { - "constant": true, - "inputs": [], - "name": "bank", - "outputs": [ - { - "internalType": "contract Bank", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "tokenRegistry:getTokens": { - "constant": true, - "inputs": [], - "name": "getTokens", - "outputs": [ - { - "internalType": "address[]", - "name": "", - "type": "address[]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "tokenRegistry:getCToken": { - "constant": true, - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - } - ], - "name": "getCToken", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "bank:getPoolAmount": { - "constant": true, - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - } - ], - "name": "getPoolAmount", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "bank:getTokenState": { - "constant": true, - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - } - ], - "name": "getTokenState", - "outputs": [ - { - "internalType": "uint256", - "name": "deposits", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "loans", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "collateral", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "bank:getCapitalUtilizationRatio": { - "constant": true, - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - } - ], - "name": "getCapitalUtilizationRatio", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "bank:getCapitalCompoundRatio": { - "constant": true, - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - } - ], - "name": "getCapitalCompoundRatio", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "ctoken:supplyRatePerBlock": { - "constant": true, - "inputs": [], - "name": "supplyRatePerBlock", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function", - "signature": "0xae9d70b0" - }, - "ctoken:borrowRatePerBlock": { - "constant": true, - "inputs": [], - "name": "borrowRatePerBlock", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function", - "signature": "0xf8f9da28" - } + "global:tokenInfoRegistry": "address:tokenInfoRegistry", + "global:bank": "address:bank", + "tokenRegistry:getTokens": "address[]:getTokens", + "tokenRegistry:getCToken": "function getCToken(address _token) view returns (address)", + "bank:getPoolAmount": "function getPoolAmount(address _token) view returns (uint256)", + "bank:getTokenState": "function getTokenState(address _token) view returns (uint256 deposits, uint256 loans, uint256 collateral)", + "bank:getCapitalUtilizationRatio": "function getCapitalUtilizationRatio(address _token) view returns (uint256)", + "bank:getCapitalCompoundRatio": "function getCapitalCompoundRatio(address _token) view returns (uint256)", + "ctoken:supplyRatePerBlock": "uint256:supplyRatePerBlock", + "ctoken:borrowRatePerBlock": "uint256:borrowRatePerBlock" } \ No newline at end of file diff --git a/projects/definer/index.js b/projects/definer/index.js index 7a8446368eb..1fdb8d05122 100644 --- a/projects/definer/index.js +++ b/projects/definer/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); @@ -149,7 +150,7 @@ const utility = { }) ).output; - let zeroCTokenAddress = "0x0000000000000000000000000000000000000000"; + let zeroCTokenAddress = ADDRESSES.null; cToken.forEach((item) => { allTokenObj[item.input.params[0]] = item.output === zeroCTokenAddress ? "" : item.output; diff --git a/projects/defirex/index.js b/projects/defirex/index.js index f140054481a..07f22d27331 100644 --- a/projects/defirex/index.js +++ b/projects/defirex/index.js @@ -1,21 +1,22 @@ -const { tokenHolderBalances } = require('../helper/tokenholders') +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport, nullAddress, } = require('../helper/unwrapLPs') module.exports = { - ethereum: { - tvl: tokenHolderBalances([ - { - tokens: ['0xdac17f958d2ee523a2206206994597c13d831ec7' /*USDT*/, '0x6b175474e89094c44da98b954eedeac495271d0f'/*DAI*/], - holders: '0xb942ca22e0eb0f2524F53f999aE33fD3B2D58E3E', // Strategy controller contract - checkETHBalance: true, - }, - { - tokens: ['0x5d3a536E4D6DbD6114cc1Ead35777bAB948E3643'/*cDAI*/, '0x4ddc2d193948926d02f9b1fe9e1daa0718270ed5'/*cETH*/], - holders: '0x0BCbAb2FeCC30B7341132B4Ebb36d352E035f1bD', // Wallet strategy contract with user funds deposited in Compound - }, - { - tokens: ['0x6b175474e89094c44da98b954eedeac495271d0f' /*DAI*/], - holders: '0x65D4853d663CeE114A0aA1c946E95479C53e78c2', // user rewards in DAI token - }] - ), - } + ethereum: { + tvl: sumTokensExport({ + ownerTokens: [ + { + tokens: [nullAddress, ADDRESSES.ethereum.USDT /*USDT*/, ADDRESSES.ethereum.DAI/*DAI*/], + holders: '0xb942ca22e0eb0f2524F53f999aE33fD3B2D58E3E', // Strategy controller contract + }, + { + tokens: ['0x5d3a536E4D6DbD6114cc1Ead35777bAB948E3643'/*cDAI*/, '0x4ddc2d193948926d02f9b1fe9e1daa0718270ed5'/*cETH*/], + holders: '0x0BCbAb2FeCC30B7341132B4Ebb36d352E035f1bD', // Wallet strategy contract with user funds deposited in Compound + }, + { + tokens: [ADDRESSES.ethereum.DAI /*DAI*/], + holders: '0x65D4853d663CeE114A0aA1c946E95479C53e78c2', // user rewards in DAI token + }].map(i => [i.tokens, i.holders]) + }), + } } \ No newline at end of file diff --git a/projects/defiyieldprotocol/index.js b/projects/defiyieldprotocol/index.js index 9f9c81503ca..fdffde9b53e 100644 --- a/projects/defiyieldprotocol/index.js +++ b/projects/defiyieldprotocol/index.js @@ -1,5 +1,4 @@ -const { tokenHolderBalances } = require('../helper/tokenholders') -const { sumTokensAndLPsSharedOwners } = require('../helper/unwrapLPs') +const { sumTokensExport, nullAddress, } = require('../helper/unwrapLPs') const contractFarms = { ethereum: [ @@ -83,78 +82,49 @@ const lps = { ] } -function transform(chain) { - return (addr) => { - if (addr === dyp) { - return dyp - } - return chain + ':' + addr - } -} - -function staking(chain) { - return async (time, ethBlock, chainBlocks) => { - const balances = {} - await sumTokensAndLPsSharedOwners(balances, [[dyp, false]], contractFarms[chain], chainBlocks[chain], chain, transform(chain)) - return balances - } -} - -function pool2(chain) { - return async (time, ethBlock, chainBlocks) => { - const balances = {} - await sumTokensAndLPsSharedOwners(balances, lps[chain].map(lp => [lp, true]), contractFarms[chain], chainBlocks[chain], chain, transform(chain)) - return balances - } -} - module.exports = { start: 1619654324, // Apr-28-2021 23:58:44 PM +UTC - avax:{ - staking: staking("avax"), - pool2: pool2("avax"), - }, - bsc: { - staking: staking("bsc"), - pool2: pool2("bsc"), - }, ethereum: { - staking: staking("ethereum"), - pool2: pool2("ethereum"), - tvl: tokenHolderBalances([ - { - tokens: [ - '0x4Ddc2D193948926D02f9B1fE9e1daa0718270ED5', // cETH Token - '0xccF4429DB6322D5C611ee964527D42E5d685DD6a', // cWBTC Token - '0xf650C3d88D12dB855b8bf7D11Be6C55A4e07dCC9', // cUSDT Token - '0x39AA39c021dfbaE8faC545936693aC917d5E7563', // cUSDC Token - '0x5d3a536E4D6DbD6114cc1Ead35777bAB948E3643', // cDAI Token - ], - holders: [ - '0x01de5bCe5C5Ee4F92e8f4183f6F4E4f12f9a86cd', // cETH Vault 3 Days Lock - '0x3e488684c40D63Ff2b9963DFBb805Bbb3Da9b1c6', // cETH Vault 30 Days Lock - '0x480c83Be2694BFB91F40d951424330c9123b9066', // cETH Vault 60 Days Lock - '0xdC68450BfE4E16d74B20c44DdA83662cF2F5F0c0', // cETH Vault 90 Days Lock - '0xe5c5a452A0f7B2d5266010Bf167A7Ee2eDF54533', // cWBTC Vault 3 Days Lock - '0x8Ae8eC53712017EeB3378Ee112082D57da98E792', // cWBTC Vault 30 Days Lock - '0x2D4b96e3C6176E833c013088aEcC7640af977e20', // cWBTC Vault 60 Days Lock - '0xb95Ec2cB2D61d12c86a05e0c995d007Aec8f2850', // cWBTC Vault 90 Days Lock - '0x18d2a323675BbE1f9d03e273a186Aea8ADf7f5c5', // cUSDT Vault 3 Days Lock - '0xfB55dcc985517d111C65004f0EAabC1f6CE23cF1', // cUSDT Vault 30 Days Lock - '0x8CE610eC56cE3ad3678C426f0Dfc965568Db6DdC', // cUSDT Vault 60 Days Lock - '0x7CCFF41652eD12278E02E18de06d40Aaf5F1769B', // cUSDT Vault 90 Days Lock - '0x94226Ae99C786b2830d27aC6e8fCdb4b0c4cc73a', // cUSDC Vault 3 Days Lock - '0xaaC6814a1aCFE8F7Ea1f718148daC614d5323c85', // cUSDC Vault 30 Days Lock - '0xe19328D2A528B765E30f9BC47faBb81e0f510ea9', // cUSDC Vault 60 Days Lock - '0xE728874B81Bd0b7a9c3505949935e67D0e7136aD', // cUSDC Vault 90 Days Lock - '0x8c1d0FD28b5FEac7f5521d05D53d7E1560A7CBCC', // cDAI Vault 30 Days Lock - '0xF73baaC19eEEB7C4B7Cc211F3eDF88BB9F1d40f9', // cDAI Vault 30 Days Lock - '0x8Fb2c9F8c07FaCf0aF442a1900cD2Cfe1940971B', // cDAI Vault 60 Days Lock - '0x8ad8e5FA0f2781dA3327275049B5469275A1042E', // cDAI Vault 90 Days Lock - ], - checkETHBalance: true, - } - ]), + tvl: sumTokensExport({ + tokens: [ + nullAddress, + '0x4Ddc2D193948926D02f9B1fE9e1daa0718270ED5', // cETH Token + '0xccF4429DB6322D5C611ee964527D42E5d685DD6a', // cWBTC Token + '0xf650C3d88D12dB855b8bf7D11Be6C55A4e07dCC9', // cUSDT Token + '0x39AA39c021dfbaE8faC545936693aC917d5E7563', // cUSDC Token + '0x5d3a536E4D6DbD6114cc1Ead35777bAB948E3643', // cDAI Token + ], + owners: [ + '0x01de5bCe5C5Ee4F92e8f4183f6F4E4f12f9a86cd', // cETH Vault 3 Days Lock + '0x3e488684c40D63Ff2b9963DFBb805Bbb3Da9b1c6', // cETH Vault 30 Days Lock + '0x480c83Be2694BFB91F40d951424330c9123b9066', // cETH Vault 60 Days Lock + '0xdC68450BfE4E16d74B20c44DdA83662cF2F5F0c0', // cETH Vault 90 Days Lock + '0xe5c5a452A0f7B2d5266010Bf167A7Ee2eDF54533', // cWBTC Vault 3 Days Lock + '0x8Ae8eC53712017EeB3378Ee112082D57da98E792', // cWBTC Vault 30 Days Lock + '0x2D4b96e3C6176E833c013088aEcC7640af977e20', // cWBTC Vault 60 Days Lock + '0xb95Ec2cB2D61d12c86a05e0c995d007Aec8f2850', // cWBTC Vault 90 Days Lock + '0x18d2a323675BbE1f9d03e273a186Aea8ADf7f5c5', // cUSDT Vault 3 Days Lock + '0xfB55dcc985517d111C65004f0EAabC1f6CE23cF1', // cUSDT Vault 30 Days Lock + '0x8CE610eC56cE3ad3678C426f0Dfc965568Db6DdC', // cUSDT Vault 60 Days Lock + '0x7CCFF41652eD12278E02E18de06d40Aaf5F1769B', // cUSDT Vault 90 Days Lock + '0x94226Ae99C786b2830d27aC6e8fCdb4b0c4cc73a', // cUSDC Vault 3 Days Lock + '0xaaC6814a1aCFE8F7Ea1f718148daC614d5323c85', // cUSDC Vault 30 Days Lock + '0xe19328D2A528B765E30f9BC47faBb81e0f510ea9', // cUSDC Vault 60 Days Lock + '0xE728874B81Bd0b7a9c3505949935e67D0e7136aD', // cUSDC Vault 90 Days Lock + '0x8c1d0FD28b5FEac7f5521d05D53d7E1560A7CBCC', // cDAI Vault 30 Days Lock + '0xF73baaC19eEEB7C4B7Cc211F3eDF88BB9F1d40f9', // cDAI Vault 30 Days Lock + '0x8Fb2c9F8c07FaCf0aF442a1900cD2Cfe1940971B', // cDAI Vault 60 Days Lock + '0x8ad8e5FA0f2781dA3327275049B5469275A1042E', // cDAI Vault 90 Days Lock + ], + }), } } + +Object.keys(contractFarms).forEach(chain => { + const owners = contractFarms[chain] + const tokens = lps[chain] + if (!module.exports[chain]) module.exports[chain] = {} + module.exports[chain].pool2 = sumTokensExport({ tokens, owners, resolveLP: chain === 'bsc' }) + module.exports[chain].staking = sumTokensExport({ tokens: [dyp], owners, }) +}) \ No newline at end of file diff --git a/projects/deflex/index.js b/projects/deflex/index.js new file mode 100644 index 00000000000..0430aadb4c0 --- /dev/null +++ b/projects/deflex/index.js @@ -0,0 +1,33 @@ +const {searchAccountsAll} = require('../helper/chain/algorand') +const sdk = require('@defillama/sdk') +const {transformBalances} = require("../helper/portedTokens"); + +async function tvl() { + const balances = {} + let escrowAccounts = await searchAccountsAll({appId: 949209670, limit: 1000}) + const assetInIdKey = Buffer.from((new TextEncoder()).encode('asset_in_id')).toString('base64') + const amountInKey = Buffer.from((new TextEncoder()).encode('amount_in')).toString('base64') + escrowAccounts.forEach((account) => { + const localStates = account['apps-local-state'] + localStates.forEach((localState) => { + if (!('key-value' in localState)) { + return + } + let limitOrderState = {} + for (let j = 0; j < localState['key-value'].length; j++) { + const keyValue = localState['key-value'][j] + limitOrderState[keyValue['key']] = keyValue['value'] + } + const assetInId = limitOrderState[assetInIdKey]['uint'] + sdk.util.sumSingleBalance(balances, assetInId > 0 ? assetInId : 1, limitOrderState[amountInKey]['uint']) + }) + }) + return transformBalances('algorand', balances) +} + +module.exports = { + timetravel: false, + algorand: { + tvl, + } +} \ No newline at end of file diff --git a/projects/defrost/abi.json b/projects/defrost/abi.json deleted file mode 100644 index 548202a2556..00000000000 --- a/projects/defrost/abi.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "totalSupply": { - "constant": true, - "inputs": [], - "name": "getTvl", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } -} diff --git a/projects/defrost/index.js b/projects/defrost/index.js index 29ac439dace..2dda30ff1a8 100644 --- a/projects/defrost/index.js +++ b/projects/defrost/index.js @@ -1,61 +1,71 @@ const sdk = require('@defillama/sdk'); -const BigNumber = require('bignumber.js'); +const { sumTokens2, nullAddress } = require('../helper/unwrapLPs'); -const abi = require('./abi'); -const {gql, request} = require('graphql-request') -const {getApiTvl} = require('../helper/historicalApi') -const avaxpool = '0x34f2fe77a14afac8a7b7f18ed1e3b2c5a1e0ccbc'; - -const url = "https://api.thegraph.com/subgraphs/name/jeffqg123/defrost-finance-mainnet" +async function tvl(_, _b, _cb, { api, }) { + const balances = await tvlV1(api) + return tvlV2(api, balances) +} -async function avax(timestamp) { - return getApiTvl(timestamp, async ()=>{ - const data = await request(url, gql` - { - entityLp2H2OColUsdTvls(first: 1, orderBy: TimeStamp, orderDirection: desc) { - id - TimeStamp - UsdValue - __typename - } - }`) - return data.entityLp2H2OColUsdTvls[0].UsdValue / 1e4 - }, async ()=>{ - const data = await request(url, gql` - { - entityLp2H2OColUsdTvls(first: 1000, orderBy: TimeStamp, orderDirection: asc) { - id - TimeStamp - UsdValue - __typename - } - }`) - return data.entityLp2H2OColUsdTvls.map(t=>({ - date: t.TimeStamp, - totalLiquidityUSD: t.UsdValue/1e4, - })) +async function tvlV1(api, balances = {}) { + let vaults = await api.call({ abi: 'address[]:getAllVaults', target: '0xbaa97b771260cf74b52e721ffe0d461512199cf1' }) + const tokensAndOwners = [] + let collateralTokens = await api.multiCall({ abi: 'address:collateralToken', calls: vaults, }) + const updatedData = collateralTokens.reduce((acc, token, i) => { + if (token === nullAddress) tokensAndOwners.push([token, vaults[i]]) + else { + acc.vaults.push(vaults[i]) + acc.tokens.push(token) + } + return acc + }, { tokens: [], vaults: []}) + collateralTokens = updatedData.tokens + vaults = updatedData.vaults + const collateralNames = await api.multiCall({ abi: 'string:name', calls: collateralTokens, }) + const sTokens = [] + const sTokens2 = [] + collateralNames.forEach((name, i) => { + if (name && name.startsWith('Super ')) { + if (name.includes('Benqi')) + sTokens.push(collateralTokens[i]) + else + sTokens2.push(collateralTokens[i]) + } + else + tokensAndOwners.push([collateralTokens[i], vaults[i]]) }) + const collateralTokens2 = await api.multiCall({ abi: 'address:underlying', calls: sTokens, }) + const collateralTokens3 = await api.multiCall({ abi: 'address:stakeToken', calls: sTokens2, }) + collateralTokens2.forEach((t, i) => tokensAndOwners.push([t, sTokens[i]])) + collateralTokens3.forEach((t, i) => tokensAndOwners.push([t, sTokens2[i]])) + return sumTokens2({ api, balances, tokensAndOwners, }) } -async function staking(time, ethBlock, chainBlocks){ - const stk = await sdk.api.abi.call({ +async function tvlV2(api, balances = {}) { + const leveragePools = await api.call({ abi: 'function getAllLeveragePool() view returns (address[])', target: '0xdc8c63dfc31325aea8cb37ecec1a760bbb5b43e7' }) + const collateralTokens = await api.multiCall({ abi: 'address:underlying', calls: leveragePools, }) + return sumTokens2({ balances, tokensAndOwners: collateralTokens.map((t, i) => ([t, leveragePools[i]])), api }) +} + +async function staking(_, _b, _cb, { api, }) { + const stk = await api.call({ target: "0x1e93b54AC156Ac2FC9714B91Fa10f1b65e2daFD9", - block: chainBlocks.avax, - chain: "avax", - abi: {"constant":true,"inputs":[],"name":"totalStaked","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"} + abi: "uint256:totalStaked" }) return { - "avax:0x47eb6f7525c1aa999fbc9ee92715f5231eb1241d": stk.output + "avax:0x47eb6f7525c1aa999fbc9ee92715f5231eb1241d": stk } } module.exports = { doublecounted: true, - start: 6965653, - avax:{ - tvl: avax, + start: 6965653, + avax: { + tvl, staking - } + }, + hallmarks: [ + [Math.floor(new Date('2022-12-24') / 1e3), 'Both v1 & v2 exploited'], + ], }; diff --git a/projects/defyswap/index.js b/projects/defyswap/index.js index 7a863f385b8..b1457bad445 100644 --- a/projects/defyswap/index.js +++ b/projects/defyswap/index.js @@ -1,20 +1,21 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { getUniTVL } = require('../helper/unknownTokens') const { stakingUnknownPricedLP } = require("../helper/staking.js"); const factory = "0xAffdbEAE1ec595cba4C262Bdb52A6083aEc2e2a6"; const masterchef = "0x53e986884c55c9AEDB7f003583f350EE789505D0"; -const ftm = "0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83"; +const ftm = ADDRESSES.fantom.WFTM; const dfy = "0x84b0b7718f8480a9eda3133fd385d7edf2b1d1c4"; const whitelist = [ dfy, - "0x04068da6c83afcfa0e13ba15a6696662335d5b75", + ADDRESSES.fantom.USDC, "0x321162cd933e2be498cd2267a90534a804051b11", ]; module.exports = { misrepresentedTokens: true, echelon: { - tvl: getUniTVL({ chain: 'echelon', useDefaultCoreAssets: true, factory: '0xdBE4CC36D0C19858d8cc7c5030593E9922aC680D' }) + tvl: () => ({}), }, fantom: { tvl: getUniTVL({ factory, chain: 'fantom', useDefaultCoreAssets: true }), diff --git a/projects/degenerative/index.js b/projects/degenerative/index.js index 39f1acfc6f9..7c8cb194dea 100644 --- a/projects/degenerative/index.js +++ b/projects/degenerative/index.js @@ -1,14 +1,15 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk') -const axios = require('axios') +const { getConfig } = require('../helper/cache') const collaterals = { - 'WETH': '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', - 'USDC': '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48' + 'WETH': ADDRESSES.ethereum.WETH, + 'USDC': ADDRESSES.ethereum.USDC } async function tvl(timestamp, block) { - const assetsRaw = await axios.get('https://raw.githubusercontent.com/yam-finance/synths-sdk/master/src/assets.json') - const assets = Object.values(assetsRaw.data).map(b=>Object.values(b)).flat().flat() + const assetsRaw = await getConfig('degenerative', 'https://raw.githubusercontent.com/yam-finance/synths-sdk/master/src/assets.json') + const assets = Object.values(assetsRaw).map(b=>Object.values(b)).flat().flat() const balances = {} const collateralBalances = await sdk.api.abi.multiCall({ abi: 'erc20:balanceOf', diff --git a/projects/degenhaus/index.js b/projects/degenhaus/index.js index 91a9fd8ecfc..7bf9482d371 100644 --- a/projects/degenhaus/index.js +++ b/projects/degenhaus/index.js @@ -1,18 +1,11 @@ -const {calculateUniTvl} = require('../helper/calculateUniTvl.js') -const {transformFantomAddress} = require('../helper/portedTokens.js') -const {staking, stakingPricedLP} = require('../helper/staking') +const {uniTvlExport} = require('../helper/calculateUniTvl.js') +const {stakingPricedLP} = require('../helper/staking') const factory = '0xA01C3d760738c79e10334408aE59684Aa36B1131' -async function tvl(_timestamp, _ethBlock, chainBlocks){ - const transform = await transformFantomAddress(); - - const balances = await calculateUniTvl(transform, chainBlocks['fantom'], 'fantom', factory, 3795376, true); - return balances -} module.exports = { fantom:{ - tvl, + tvl: uniTvlExport(factory, 'fantom', true), staking: stakingPricedLP("0x72A7A3770B4BC999026F3663F1534581E0c59f2a", "0xd948efcc99be419ca9bdace89b2bec31edf13adb", 'fantom', "0x1758d21f2915583f49cc2b3e583df3e55f0dd2c0", "fantom") }, } diff --git a/projects/dehive/abi.json b/projects/dehive/abi.json index 7d43f9c2edd..dc64d452a84 100644 --- a/projects/dehive/abi.json +++ b/projects/dehive/abi.json @@ -1,216 +1,13 @@ { - "poolInfo": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "poolInfo", - "outputs": [ - { - "internalType": "address", - "name": "assetToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "lastRewardBlock", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "poolSupply", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "paused", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - "totalSupply": { - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "balanceOf": { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getUnderlyingsAmountsFromClusterAmount": { - "inputs": [ - { - "internalType": "uint256", - "name": "_clusterAmount", - "type": "uint256" - } - ], - "name": "getUnderlyingsAmountsFromClusterAmount", - "outputs": [ - { - "internalType": "uint256[]", - "name": "", - "type": "uint256[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getUnderlyings": { - "inputs": [], - "name": "getUnderlyings", - "outputs": [ - { - "internalType": "address[]", - "name": "", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - "impulseMultiPoolInfo": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "poolInfo", - "outputs": [ - { - "internalType": "address", - "name": "assetToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "lastRewardBlock", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "poolSupply", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "paused", - "type": "bool" - }, - { - "internalType": "address", - "name": "strategy", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "wantLockedTotal": { - "inputs": [], - "name": "wantLockedTotal", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "listUnderlying": { - "inputs": [], - "name": "listUnderlying", - "outputs": [ - { - "internalType": "address[]", - "name": "", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - "wantPriceInUnderlying": { - "inputs": [ - { - "internalType": "uint256", - "name": "_wantAmt", - "type": "uint256" - } - ], - "name": "wantPriceInUnderlying", - "outputs": [ - { - "internalType": "uint256[]", - "name": "", - "type": "uint256[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - "wantPriceInUsd": { - "inputs": [ - { - "internalType": "uint256", - "name": "_wantAmt", - "type": "uint256" - } - ], - "name": "wantPriceInUsd", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "usdToken": { - "inputs": [], - "name": "usdToken", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } -} + "poolInfo": "function poolInfo(uint256) view returns (address assetToken, uint256 lastRewardBlock, uint256 poolSupply, bool paused)", + "totalSupply": "uint256:totalSupply", + "balanceOf": "function balanceOf(address account) view returns (uint256)", + "getUnderlyingsAmountsFromClusterAmount": "function getUnderlyingsAmountsFromClusterAmount(uint256 _clusterAmount) view returns (uint256[])", + "getUnderlyings": "address[]:getUnderlyings", + "impulseMultiPoolInfo": "function poolInfo(uint256) view returns (address assetToken, uint256 lastRewardBlock, uint256 poolSupply, bool paused, address strategy)", + "wantLockedTotal": "uint256:wantLockedTotal", + "listUnderlying": "address[]:listUnderlying", + "wantPriceInUnderlying": "function wantPriceInUnderlying(uint256 _wantAmt) view returns (uint256[])", + "wantPriceInUsd": "function wantPriceInUsd(uint256 _wantAmt) view returns (uint256)", + "usdToken": "address:usdToken" +} \ No newline at end of file diff --git a/projects/dehive/assetsInfo.js b/projects/dehive/assetsInfo.js index 77df35f2c34..c68fa859450 100644 --- a/projects/dehive/assetsInfo.js +++ b/projects/dehive/assetsInfo.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') // Auto generated at 9-2-2022 16:14 module.exports = { 'ethereum' : [ @@ -16,7 +17,7 @@ module.exports = { dhvToken: '0x62Dc4817588d53a056cBbD18231d91ffCcd34b2A', underlying: [ '0x62Dc4817588d53a056cBbD18231d91ffCcd34b2A', // DHV - '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', // WETH + ADDRESSES.ethereum.WETH, // WETH ], isPool2: true, poolId: 0 @@ -72,8 +73,8 @@ module.exports = { lpAddress: '0x4A35582a710E1F4b2030A3F826DA20BfB6703C09', // QCK-WETH-DAI dhvToken: '0x5fCB9de282Af6122ce3518CDe28B7089c9F97b26', underlying: [ - '0x7ceb23fd6bc0add59e62ac25578270cff1b9f619', // WETH - '0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063', // DAI + ADDRESSES.polygon.WETH_1, // WETH + ADDRESSES.polygon.DAI, // DAI ], poolId: 1 }, @@ -86,7 +87,7 @@ module.exports = { // lpAddress: '0x1F1E4c845183EF6d50E9609F16f6f9cAE43BC9Cb', // QCK-USDC-QUICK // dhvToken: '0x5fCB9de282Af6122ce3518CDe28B7089c9F97b26', // underlying: [ - // '0x2791bca1f2de4661ed88a30c99a7a9449aa84174', // USDC + // ADDRESSES.polygon.USDC, // USDC // '0x831753DD7087CaC61aB5644b308642cc1c33Dc13', // QUICK // ], // poolId: 2 @@ -100,7 +101,7 @@ module.exports = { // lpAddress: '0xE89faE1B4AdA2c869f05a0C96C87022DaDC7709a', // QCK-MAI-USDT // dhvToken: '0x5fCB9de282Af6122ce3518CDe28B7089c9F97b26', // underlying: [ - // '0xc2132D05D31c914a87C6611C10748AEb04B58e8F', // USDT + // ADDRESSES.polygon.USDT, // USDT // '0xa3fa99a148fa48d14ed51d610c367c61876997f1', // MAI // ], // poolId: 4 @@ -114,7 +115,7 @@ module.exports = { dhvToken: '0x5fCB9de282Af6122ce3518CDe28B7089c9F97b26', underlying: [ '0x2C89bbc92BD86F8075d1DEcc58C7F4E0107f286b', // AVAX - '0x7ceb23fd6bc0add59e62ac25578270cff1b9f619', // WETH + ADDRESSES.polygon.WETH_1, // WETH ], poolId: 5 }, @@ -126,8 +127,8 @@ module.exports = { lpAddress: '0xc4e595acDD7d12feC385E5dA5D43160e8A0bAC0E', // SUSHI-WMATIC-WETH dhvToken: '0x5fCB9de282Af6122ce3518CDe28B7089c9F97b26', underlying: [ - '0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270', // WMATIC - '0x7ceb23fd6bc0add59e62ac25578270cff1b9f619', // WETH + ADDRESSES.polygon.WMATIC_2, // WMATIC + ADDRESSES.polygon.WETH_1, // WETH ], poolId: 6 }, @@ -140,7 +141,7 @@ module.exports = { dhvToken: '0x5fCB9de282Af6122ce3518CDe28B7089c9F97b26', underlying: [ '0x172370d5Cd63279eFa6d502DAB29171933a610AF', // CRV - '0x7ceb23fd6bc0add59e62ac25578270cff1b9f619', // WETH + ADDRESSES.polygon.WETH_1, // WETH ], poolId: 7 }, @@ -153,7 +154,7 @@ module.exports = { dhvToken: '0x5fCB9de282Af6122ce3518CDe28B7089c9F97b26', underlying: [ '0x50B728D8D964fd00C2d0AAD81718b71311feF68a', // SNX - '0x7ceb23fd6bc0add59e62ac25578270cff1b9f619', // WETH + ADDRESSES.polygon.WETH_1, // WETH ], poolId: 8 }, @@ -165,7 +166,7 @@ module.exports = { lpAddress: '0xf69e93771F11AECd8E554aA165C3Fe7fd811530c', // SUSHI-WMATIC-GHST dhvToken: '0x5fCB9de282Af6122ce3518CDe28B7089c9F97b26', underlying: [ - '0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270', // WMATIC + ADDRESSES.polygon.WMATIC_2, // WMATIC '0x385eeac5cb85a38a9a07a70c73e0a3271cfb54a7', // GHST ], poolId: 9 @@ -201,7 +202,7 @@ module.exports = { dhvToken: '0x58759dd469ae5631c42cf8a473992335575b58d7', underlying: [ '0x58759dd469ae5631c42cf8a473992335575b58d7', // DHV - '0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56', // BUSD + ADDRESSES.bsc.BUSD, // BUSD ], isPool2: true, poolId: 0 @@ -215,7 +216,7 @@ module.exports = { dhvToken: '0x58759dd469ae5631c42cf8a473992335575b58d7', underlying: [ '0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82', // CAKE - '0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56', // BUSD + ADDRESSES.bsc.BUSD, // BUSD ], poolId: 0 }, @@ -227,8 +228,8 @@ module.exports = { lpAddress: '0xEc6557348085Aa57C72514D67070dC863C0a5A8c', // PANCAKE-BUSDT-USDC dhvToken: '0x58759dd469ae5631c42cf8a473992335575b58d7', underlying: [ - '0x55d398326f99059fF775485246999027B3197955', // BUSDT - '0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d', // BUSDC + ADDRESSES.bsc.USDT, // BUSDT + ADDRESSES.bsc.USDC, // BUSDC ], poolId: 1 }, @@ -240,8 +241,8 @@ module.exports = { lpAddress: '0x16b9a82891338f9bA80E2D6970FddA79D1eb0daE', // PANCAKE-BUSDT-WBNB dhvToken: '0x58759dd469ae5631c42cf8a473992335575b58d7', underlying: [ - '0x55d398326f99059fF775485246999027B3197955', // BUSDT - '0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c', // WBNB + ADDRESSES.bsc.USDT, // BUSDT + ADDRESSES.bsc.WBNB, // WBNB ], poolId: 2 }, @@ -254,7 +255,7 @@ module.exports = { dhvToken: '0x58759dd469ae5631c42cf8a473992335575b58d7', underlying: [ '0xcF6BB5389c92Bdda8a3747Ddb454cB7a64626C63', // XVS - '0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c', // WBNB + ADDRESSES.bsc.WBNB, // WBNB ], poolId: 3 }, @@ -267,7 +268,7 @@ module.exports = { dhvToken: '0x58759dd469ae5631c42cf8a473992335575b58d7', underlying: [ '0x8F0528cE5eF7B51152A59745bEfDD91D97091d2F', // ALPACA - '0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56', // BUSD + ADDRESSES.bsc.BUSD, // BUSD ], poolId: 4 }, @@ -280,7 +281,7 @@ module.exports = { dhvToken: '0x58759dd469ae5631c42cf8a473992335575b58d7', underlying: [ '0xF8A0BF9cF54Bb92F17374d9e9A321E6a111a51bD', // LINK - '0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c', // WBNB + ADDRESSES.bsc.WBNB, // WBNB ], poolId: 5 }, @@ -293,7 +294,7 @@ module.exports = { dhvToken: '0x58759dd469ae5631c42cf8a473992335575b58d7', underlying: [ '0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82', // CAKE - '0x55d398326f99059fF775485246999027B3197955', // BUSDT + ADDRESSES.bsc.USDT, // BUSDT ], poolId: 6 }, @@ -306,7 +307,7 @@ module.exports = { dhvToken: '0x58759dd469ae5631c42cf8a473992335575b58d7', underlying: [ '0x67ee3Cb086F8a16f34beE3ca72FAD36F7Db929e2', // DODO - '0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c', // WBNB + ADDRESSES.bsc.WBNB, // WBNB ], poolId: 7 }, @@ -319,7 +320,7 @@ module.exports = { dhvToken: '0x58759dd469ae5631c42cf8a473992335575b58d7', underlying: [ '0x603c7f932ED1fc6575303D8Fb018fDCBb0f39a95', // BANANA - '0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c', // WBNB + ADDRESSES.bsc.WBNB, // WBNB ], poolId: 8 }, @@ -332,7 +333,7 @@ module.exports = { dhvToken: '0x58759dd469ae5631c42cf8a473992335575b58d7', underlying: [ '0x603c7f932ED1fc6575303D8Fb018fDCBb0f39a95', // BANANA - '0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56', // BUSD + ADDRESSES.bsc.BUSD, // BUSD ], poolId: 9 }, @@ -345,7 +346,7 @@ module.exports = { dhvToken: '0x58759dd469ae5631c42cf8a473992335575b58d7', underlying: [ '0x4B0F1812e5Df2A09796481Ff14017e6005508003', // TWT - '0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c', // WBNB + ADDRESSES.bsc.WBNB, // WBNB ], poolId: 10 }, @@ -358,7 +359,7 @@ module.exports = { dhvToken: '0x58759dd469ae5631c42cf8a473992335575b58d7', underlying: [ '0x1CE0c2827e2eF14D5C4f29a091d735A204794041', // AVAX - '0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c', // WBNB + ADDRESSES.bsc.WBNB, // WBNB ], poolId: 11 }, @@ -387,7 +388,7 @@ module.exports = { dhvToken: '0xFbdd194376de19a88118e84E279b977f165d01b8', underlying: [ '0xFbdd194376de19a88118e84E279b977f165d01b8', // DHV - '0xe91d153e0b41518a2ce8dd3d7944fa863463a97d', // WXDAI + ADDRESSES.xdai.WXDAI, // WXDAI ], isPool2: true, poolId: 1 diff --git a/projects/dehive/index.js b/projects/dehive/index.js index 1fdea348f81..b4d448f0386 100644 --- a/projects/dehive/index.js +++ b/projects/dehive/index.js @@ -178,48 +178,50 @@ async function chainTvl(chain, chainBlocks, exportType) { const tvl = {}; const transform = addr => `${chain}:${addr}` const block = chainBlocks[chain] - for (const staking of assetsInfo[chain]) { - let calculateTvlFunction = undefined; - switch (staking.tvl) { - case "stakingTvl": - calculateTvlFunction = stakingTvl; - break; - case "stakingDhvTvl": - calculateTvlFunction = stakingDhvTvl; - break; - case "lpStakingTvl": - calculateTvlFunction = lpStakingTvl; - break; - case "crvStakingTvl": - calculateTvlFunction = crvStakingTvl; - break; - case "clusterTvl": - calculateTvlFunction = clusterTvl; - break; - case "impulseStakingTvl": - calculateTvlFunction = impulseStakingTvl; - break; - default: - console.log('unknown tvl type', JSON.stringify(staking, null,4)); - continue; - } - if ( - (staking.tvl === "stakingDhvTvl" && exportType !== EXPORT_TYPE_DHV_STAKING) - || (staking.tvl !== "stakingDhvTvl" && exportType === EXPORT_TYPE_DHV_STAKING) - || (staking.tvl === "lpStakingTvl" && exportType === EXPORT_TYPE_POOL2 && (staking.isPool2 !== true)) - || (staking.tvl === "lpStakingTvl" && exportType !== EXPORT_TYPE_POOL2 && (staking.isPool2 === true)) - ) { - continue; - } - const tvls = await calculateTvlFunction(chain, staking.meta, block); - if (typeof tvls === 'string') { - sdk.util.sumSingleBalance(tvl, transform(staking.meta.tokenAddress), tvls) - } else { - for (let i = 0; i < tvls.length; i++) { - sdk.util.sumSingleBalance(tvl, transform(tvls[i][0]), tvls[i][1]) + await Promise.all(assetsInfo[chain].map(async (staking) => { + { + let calculateTvlFunction = undefined; + switch (staking.tvl) { + case "stakingTvl": + calculateTvlFunction = stakingTvl; + break; + case "stakingDhvTvl": + calculateTvlFunction = stakingDhvTvl; + break; + case "lpStakingTvl": + calculateTvlFunction = lpStakingTvl; + break; + case "crvStakingTvl": + calculateTvlFunction = crvStakingTvl; + break; + case "clusterTvl": + calculateTvlFunction = clusterTvl; + break; + case "impulseStakingTvl": + calculateTvlFunction = impulseStakingTvl; + break; + default: + console.log('unknown tvl type', JSON.stringify(staking, null, 4)); + return; + } + if ( + (staking.tvl === "stakingDhvTvl" && exportType !== EXPORT_TYPE_DHV_STAKING) + || (staking.tvl !== "stakingDhvTvl" && exportType === EXPORT_TYPE_DHV_STAKING) + || (staking.tvl === "lpStakingTvl" && exportType === EXPORT_TYPE_POOL2 && (staking.isPool2 !== true)) + || (staking.tvl === "lpStakingTvl" && exportType !== EXPORT_TYPE_POOL2 && (staking.isPool2 === true)) + ) { + return; + } + const tvls = await calculateTvlFunction(chain, staking.meta, block); + if (typeof tvls === 'string') { + sdk.util.sumSingleBalance(tvl, transform(staking.meta.tokenAddress), tvls) + } else { + for (let i = 0; i < tvls.length; i++) { + sdk.util.sumSingleBalance(tvl, transform(tvls[i][0]), tvls[i][1]) + } } } - } + })) return tvl } diff --git a/projects/delta/index.js b/projects/delta/index.js index 0ad1c29a8ac..e0ad89e1b9a 100644 --- a/projects/delta/index.js +++ b/projects/delta/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const BigNumber = require("bignumber.js"); const { staking } = require("../helper/staking"); @@ -7,7 +8,7 @@ const rebasingContract = "0xfcfC434ee5BfF924222e084a8876Eee74Ea7cfbA"; const DELTA_WETH_SLP = "0x1498bd576454159Bb81B5Ce532692a8752D163e8"; const DELTA = "0x9EA3b5b4EC044b70375236A281986106457b20EF"; -const WETH = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"; +const WETH = ADDRESSES.ethereum.WETH; async function Pool2(timestamp, block) { const balances = {}; diff --git a/projects/deltaprime/abis/getAllOwnedAssetsAbi.json b/projects/deltaprime/abis/getAllOwnedAssetsAbi.json new file mode 100644 index 00000000000..962ba6aba4f --- /dev/null +++ b/projects/deltaprime/abis/getAllOwnedAssetsAbi.json @@ -0,0 +1,13 @@ +{ + "inputs": [], + "name": "getAllOwnedAssets", + "outputs": [ + { + "internalType": "bytes32[]", + "name": "result", + "type": "bytes32[]" + } + ], + "stateMutability": "view", + "type": "function" +} \ No newline at end of file diff --git a/projects/deltaprime/index.js b/projects/deltaprime/index.js new file mode 100644 index 00000000000..b8a46e12d98 --- /dev/null +++ b/projects/deltaprime/index.js @@ -0,0 +1,132 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const sdk = require('@defillama/sdk'); +const { ethers } = require("ethers"); +const { sumTokens2 } = require('../helper/unwrapLPs') +const { getLogs } = require('../helper/cache/getLogs') + +const VFDepositTokenBalanceAbi = "function depositTokenBalance(address owner) view returns (uint256)" +const VFDepositTokenBalanceAutoAbi = "function balanceOf(address owner) view returns (uint256)" +const getAllOwnedAssetsAbi = require('./abis/getAllOwnedAssetsAbi.json'); +const getPoolHelperAbi = "function getPoolInfo(address _address) view returns (tuple(uint256 pid, bool isActive, address token, address lp, uint256 sizeLp, address receipt, uint256 size, address rewards_addr, address helper))" +const getStakingPositionsAbi = "function getStakedPositions() view returns (tuple(address asset, bytes32 symbol, bytes32 identifier, bytes4 balanceSelector, bytes4 unstakeSelector)[])" + +const assetToAddressMapping = require('./mappings/assetToAddressMapping.json') + +const USDC_POOL_TUP_CONTRACT = '0x2323dAC85C6Ab9bd6a8B5Fb75B0581E31232d12b'; +const USDT_POOL_TUP_CONTRACT = '0xd222e10D7Fe6B7f9608F14A8B5Cf703c74eFBcA1'; +const WAVAX_POOL_TUP_CONTRACT = '0xD26E504fc642B96751fD55D3E68AF295806542f5'; +const BTC_POOL_TUP_CONTRACT = '0x475589b0Ed87591A893Df42EC6076d2499bB63d0'; +const ETH_POOL_TUP_CONTRACT = '0xD7fEB276ba254cD9b34804A986CE9a8C3E359148'; + +const SMART_LOANS_FACTORY_TUP = '0x3Ea9D480295A73fd2aF95b4D96c2afF88b21B03D'; +const VF_MAINSTAKING_CONTRACT = "0x8B3d9F0017FA369cD8C164D0Cc078bf4cA588aE5"; + +async function tvl(timestamp, block, chainBlocks, { api }) { + const logs = await getLogs({ + api, + target: SMART_LOANS_FACTORY_TUP, + topics: ['0x3c5330cb261eae74426865a348927ace59eae441485c71a110df598f825b6369'], + fromBlock: 23431194, + }) + sdk.log('#accounts', logs.length) + + const tokensAndOwners = [ + [assetToAddressMapping.USDC, USDC_POOL_TUP_CONTRACT], + [assetToAddressMapping.USDT, USDT_POOL_TUP_CONTRACT], + [assetToAddressMapping.AVAX, WAVAX_POOL_TUP_CONTRACT], + [assetToAddressMapping.BTC, BTC_POOL_TUP_CONTRACT], + [assetToAddressMapping.ETH, ETH_POOL_TUP_CONTRACT], + ] + + const accounts = logs.map(i => `0x${i.topics[1].slice(26)}`) + const positions = await api.multiCall({ abi: getStakingPositionsAbi, calls: accounts }) + const ownedAssets = await api.multiCall({ abi: getAllOwnedAssetsAbi, calls: accounts }) + const vectorTokens = {} + const vectorAutoTokens = {} + accounts.forEach((o, i) => { + ownedAssets[i].forEach(tokenStr => { + tokenStr = ethers.utils.parseBytes32String(tokenStr) + const token = assetToAddressMapping[tokenStr] + if (!token) throw new Error('Missing asset mapping for: ' + tokenStr) + tokensAndOwners.push([token, o]) + }) + positions[i].forEach(({ asset, identifier }) => { + asset = asset.toLowerCase() + if(ethers.utils.parseBytes32String(identifier).toLowerCase().includes("auto")){ + if (!vectorAutoTokens[asset]) vectorAutoTokens[asset] = [] + vectorAutoTokens[asset].push(o) + }else{ + if (!vectorTokens[asset]) vectorTokens[asset] = [] + vectorTokens[asset].push(o) + } + }) + }) + + const balances = await sumTokens2({ api, tokensAndOwners: tokensAndOwners }) + await Promise.all(Object.entries(vectorTokens).map(([token, accounts]) => addVectorVaultBalances({ api, balances, accounts, token }))) + await Promise.all(Object.entries(vectorAutoTokens).map(([token, accounts]) => addVectorVaultBalancesAuto({ api, balances, accounts, token }))) + return balances; +} + +function translatePlatypusLPToBaseToken(token){ + // Platypus USDC Asset (LP-USDC) -> USDC + if(token === "0x06f01502327de1c37076bea4689a7e44279155e9"){ + token = ADDRESSES.avax.USDC; + } + return token; +} + +// VectorFinance autocompounding vaults +async function addVectorVaultBalancesAuto({ balances, accounts, api, token }) { + const helper = await api.call({ + abi: getPoolHelperAbi, + target: VF_MAINSTAKING_CONTRACT, + params: [token], + }) + const compounder = await api.call({ + abi: 'function compounder() view returns(address)', + target: helper.helper, + params: [] + }) + const totalDeposits = await api.call({ + abi: 'function totalDeposits() view returns(uint256)', + target: compounder, + params: [] + }) + const totalSupply = await api.call({ + abi: 'function totalSupply() view returns(uint256)', + target: compounder, + params: [] + }) + const shareRatio = totalDeposits / totalSupply; + let bals = await api.multiCall({ abi: VFDepositTokenBalanceAutoAbi, calls: accounts, target: compounder }) + bals = bals.map(el => el * shareRatio); + + token = translatePlatypusLPToBaseToken(token); + + bals.forEach(i => sdk.util.sumSingleBalance(balances, token, i, api.chain)) + return balances +} + +// VectorFinance manual vaults +async function addVectorVaultBalances({ balances, accounts, api, token }) { + const helper = await api.call({ + abi: getPoolHelperAbi, + target: VF_MAINSTAKING_CONTRACT, + params: [token], + }) + if (helper.helper.toLowerCase() === '0x9AB2B763798124F81E95419aC9b77a4fB480742D'.toLowerCase()) return balances; + const bals = await api.multiCall({ abi: VFDepositTokenBalanceAbi, calls: accounts, target: helper.helper }) + + bals.forEach(i => sdk.util.sumSingleBalance(balances, token, i, api.chain)) + return balances +} + +module.exports = { + methodology: 'Counts TVL of DeltaPrime\'s lending pools and individual PrimeAccount contracts\'', + start: + 24753316, + avax: { + tvl, + } +} diff --git a/projects/deltaprime/mappings/assetToAddressMapping.json b/projects/deltaprime/mappings/assetToAddressMapping.json new file mode 100644 index 00000000000..3bd2b801b92 --- /dev/null +++ b/projects/deltaprime/mappings/assetToAddressMapping.json @@ -0,0 +1,46 @@ +{ + "AVAX": "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7", + "USDC": "0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e", + "sAVAX": "0x2b2C81e08f1Af8835a78Bb2A90AE924ACE0eA4bE", + "ETH": "0x49d5c2bdffac6ce2bfdb6640f4f80f226bc10bab", + "BTC": "0x152b9d0FdC40C096757F570A51E494bd4b943E50", + "USDT": "0x9702230a8ea53601f5cd2dc00fdbc13d4df4a8c7", + "EUROC": "0xC891EB4cbdEFf6e073e859e987815Ed1505c2ACD", + "GMX": "0x62edc0692BD897D2295872a9FFCac5425011c661", + "QI": "0x8729438eb15e2c8b576fcc6aecda6a148776c0f5", + "PNG": "0x60781C2586D68229fde47564546784ab3fACA982", + "PTP": "0x22d4002028f537599bE9f666d1c4Fa138522f9c8", + "JOE": "0x6e84a6216ea6dacc71ee8e6b0a5b7322eebc0fdd", + "gmdUSDC": "0x33f0a866d9024d44de2E0602f4C9B94755944B6F", + "gmdWAVAX": "0x13AF25f924056d4D4668705C33aB9b70D505050e", + "gmdBTCb": "0x8fe3024351B9a51a3439183e940c2aF3994DD52F", + "gmdWETHe": "0xE28c95e9EB0f6D16b05D265cAa4BcEE9E5C2e625", + "YY_AAVE_AVAX": "0xaAc0F2d0630d1D09ab2B5A400412a4840B866d95", + "YY_PTP_sAVAX": "0xb8f531c0d3c53B1760bcb7F57d87762Fd25c4977", + "YY_GLP": "0x9f637540149f922145c06e1aa3f38dcDc32Aff5C", + "PNG_AVAX_USDC_LP": "0x0e0100ab771e9288e0aa97e11557e6654c3a9665", + "PNG_AVAX_USDT_LP": "0xe3ba3d5e3f98eeff5e9eddd5bd20e476202770da", + "PNG_AVAX_ETH_LP": "0x7c05d54fc5cb6e4ad87c6f5db3b807c94bb89c52", + "TJ_AVAX_USDC_LP": "0xf4003F4efBE8691B60249E6afbD307aBE7758adb", + "TJ_AVAX_USDT_LP": "0xbb4646a764358ee93c2a9c4a147d5aDEd527ab73", + "TJ_AVAX_ETH_LP": "0xFE15c2695F1F920da45C30AAE47d11dE51007AF9", + "TJ_AVAX_BTC_LP": "0x2fd81391e30805cc7f2ec827013ce86dc591b806", + "TJ_AVAX_sAVAX_LP": "0x4b946c91c2b1a7d7c40fb3c130cdfbaf8389094d", + "YY_PNG_AVAX_USDC_LP": "0xC0cd58661b68e10b49D3Bec4bC5E44e7A7c20656", + "YY_PNG_AVAX_ETH_LP": "0xFCD2050E213cC54db2c9c99632AC870574FbC261", + "YY_TJ_AVAX_USDC_LP": "0xDEf94a13fF31FB6363f1e03bF18fe0F59Db83BBC", + "YY_TJ_AVAX_ETH_LP": "0x5219558ee591b030E075892acc41334A1694fd8A", + "YY_TJ_AVAX_sAVAX_LP": "0x22EDe03f1115666CF05a4bAfafaEe8F43D42cD56", + "MOO_TJ_AVAX_USDC_LP": "0x7E5bC7088aB3Da3e7fa1Aa7ceF1dC73F5B00681c", + "GLP": "0x9e295B5B976a184B14aD8cd72413aD846C299660", + "DAIe": "0xd586E7F844cEa2F87f50152665BCbc2C279D8d70", + "USDCe": "0xA7D7079b0FEaD91F3e65f86E8915Cb59c1a4C664", + "USDT.e": "0xc7198437980c041c805A1EDcbA50c1Ce5db95118", + "WBTCe": "0x50b7545627a5162F82A992c33b87aDc75187B218", + "crvUSDBTCETH": "0x1daB6560494B04473A0BE3E7D83CF3Fdf3a51828", + "SHLB_AVAX-USDC_B": "0x668530302c6ecc4ebe693ec877b79300ac72527c", + "SHLB_BTC.b-AVAX_B": "0x536d7e7423e8fb799549caf574cfa12aae95ffcd", + "SHLB_JOE-AVAX_B": "0x89547441489262feb5cee346fdacb9037c2574db", + "SHLB_EUROC-USDC_V2_1_B": "0x638f969675822dfae4566b44d0f2a11362fbed52", + "SHLB_USDT.e-USDt_C": "0x9f44e67ba256c18411bb041375e572e3dd11fa72" +} \ No newline at end of file diff --git a/projects/deltatheta/factory.abi.js b/projects/deltatheta/factory.abi.js index 12f49017865..103d9b9f62f 100644 --- a/projects/deltatheta/factory.abi.js +++ b/projects/deltatheta/factory.abi.js @@ -1,34 +1,4 @@ module.exports = { - pairsLength: { - inputs: [], - name: 'pairsLength', - outputs: [ - { - internalType: 'uint16', - name: '', - type: 'uint16', - }, - ], - stateMutability: 'view', - type: 'function', - }, - pairsList: { - inputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - name: 'pairsList', - outputs: [ - { - internalType: 'address', - name: '', - type: 'address', - }, - ], - stateMutability: 'view', - type: 'function', - }, + pairsLength: "uint16:pairsLength", + pairsList: "function pairsList(uint256) view returns (address)", }; diff --git a/projects/deltatheta/index.js b/projects/deltatheta/index.js index 8b2c699fb19..f5bd9fc63dd 100644 --- a/projects/deltatheta/index.js +++ b/projects/deltatheta/index.js @@ -3,10 +3,11 @@ const { transformBscAddress, transformPolygonAddress, } = require('../helper/portedTokens'); -const { getTokens } = require('../helper/getTokens'); +const { covalentGetTokens } = require('../helper/http'); // Delta.theta Factory ABI (for needed calls) const factoryABI = require('./factory.abi'); +const { sumTokens2 } = require('../helper/unwrapLPs'); // Delta.theta Factory Address (On all chains) const FACTORY_ADDRESS = '0x000000000092126dc1bcec881165f92169733106'; @@ -16,8 +17,6 @@ const range = (n) => Array.from({ length: n }, (_, i) => i); // TVL function generator (for BSC & POLYGON chains) function tvl(chain) { - const balances = {}; - return async (_, __, chainBlocks) => { // Prepare transform function for the selected chain const transform = await ( @@ -46,40 +45,20 @@ function tvl(chain) { requery: true })).output const pairs = pairsOutput.map(result => result.output.toLowerCase()) + console.log(chain, pairs) + const toa = [] await Promise.all(range(pairsLength).map( async (i) => { // Parse tokens list for each of pair addresses - const tokens = await getTokens(pairs[i], chain); - - // Parse all balances - const balancesOutput = (await sdk.api.abi.multiCall({ - abi: 'erc20:balanceOf', - chain, - calls: tokens.map((token) => ({ - target: token, - params: [pairs[i]] - })), - block: chainBlocks[chain], - requery: true, - })); - - // Sum all balances - await sdk.util.sumMultiBalanceOf( - balances, - balancesOutput, - true, - transform, - ); - } - )); + const tokens = await covalentGetTokens(pairs[i], chain); + tokens.forEach(t => toa.push([t, pairs[i]])) + })); - return balances; + return sumTokens2({ chain, block: chainBlocks[chain], tokensAndOwners: toa, }); }; } module.exports = { - timetravel: true, - misrepresentedTokens: false, methodology: 'Parsing the balances of all tokens on the pair addresses of decentralized exchange Delta.theta', start: 0, bsc: { diff --git a/projects/demeter/index.js b/projects/demeter/index.js index ffdbdeee1bb..c7adf3de827 100644 --- a/projects/demeter/index.js +++ b/projects/demeter/index.js @@ -1,10 +1,13 @@ const { get } = require('../helper/http') async function fetch() { - let results = await get('https://farming-api.cerestoken.io/get-supply-data'); + let results = await get('https://api.deotoken.com/api/demeter/supply-data'); return results.tvl; } module.exports = { + sora: { + fetch + }, fetch } \ No newline at end of file diff --git a/projects/demodyfi/index.js b/projects/demodyfi/index.js index 40598173db4..0cf6579008f 100644 --- a/projects/demodyfi/index.js +++ b/projects/demodyfi/index.js @@ -1,7 +1,8 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { getUniTVL } = require('../helper/unknownTokens') const sdk = require("@defillama/sdk"); const BigNumber = require("bignumber.js"); -const wGLMR = "0x5f6c5C2fB289dB2228d159C69621215e354218d7"; +const wGLMR = ADDRESSES.moonbeam.WGLMR; const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); const { transformBscAddress } = require("../helper/portedTokens"); @@ -38,7 +39,7 @@ async function dmodEthereumStakingPool(timestamp, block, chainBlocks) { await sdk.api.abi.call({ abi: "erc20:balanceOf", chain: "ethereum", - target: "0x5f6c5c2fb289db2228d159c69621215e354218d7", + target: ADDRESSES.moonbeam.WGLMR, params: ["0x024D59Ac0Bb03dEd28B9A16cd50B3d242B43a683"], block }) @@ -50,7 +51,7 @@ async function dmodEthereumStakingPool(timestamp, block, chainBlocks) { await sdk.api.abi.call({ abi: "erc20:decimals", chain: "ethereum", - target: "0x5f6c5c2fb289db2228d159c69621215e354218d7", + target: ADDRESSES.moonbeam.WGLMR, params: [], block }) diff --git a/projects/depth/index.js b/projects/depth/index.js index 9e27c0a9594..0012181abac 100644 --- a/projects/depth/index.js +++ b/projects/depth/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk'); const formalDeposit = { @@ -326,7 +327,7 @@ async function getTokenPrice(contractAddress) { target: "0xED7d5F38C79115ca12fe6C0041abb22F0A06C300", abi: mdexRouter['getAmountsIn'], chain: "heco", - params: [1e8, ['0xa71edc38d189767582c38a3145b5873052c3e47a', underlyingCoinsAddress.output]], + params: [1e8, [ADDRESSES.heco.USDT, underlyingCoinsAddress.output]], }); return getAmountsIn.output[0] / Math.pow(10, 26 - 18) @@ -362,7 +363,7 @@ async function getPrice(contractAddress,dc) { target: "0xED7d5F38C79115ca12fe6C0041abb22F0A06C300", abi: mdexRouter['getAmountsOut'], chain: "heco", - params: [1e8, [contractAddress,'0xa71edc38d189767582c38a3145b5873052c3e47a']], + params: [1e8, [contractAddress,ADDRESSES.heco.USDT]], }); return getAmountsIn.output[1] / Math.pow(10, 26 - dc) @@ -419,7 +420,7 @@ async function getBnbPrice() { target: "0x10ed43c718714eb63d5aa57b78b54704e256024e", abi: mdexRouter['getAmountsOut'], chain: "bsc", - params: [1e8, ["0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c","0x55d398326f99059ff775485246999027b3197955"]], + params: [1e8, [ADDRESSES.bsc.WBNB,ADDRESSES.bsc.USDT]], }); return getAmountsIn.output[1] / Math.pow(10, 26 - 18) } diff --git a/projects/deri/abi.json b/projects/deri/abi.json index c002e1ac919..aa80a5da50c 100644 --- a/projects/deri/abi.json +++ b/projects/deri/abi.json @@ -1,60 +1,5 @@ { - "getLengths": { - "inputs": [], - "name": "getLengths", - "outputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" }, - { "internalType": "uint256", "name": "", "type": "uint256" } - ], - "stateMutability": "view", - "type": "function" - }, - "getBToken": { - "inputs": [ - { "internalType": "uint256", "name": "bTokenId", "type": "uint256" } - ], - "name": "getBToken", - "outputs": [ - { - "components": [ - { - "internalType": "address", - "name": "bTokenAddress", - "type": "address" - }, - { - "internalType": "address", - "name": "swapperAddress", - "type": "address" - }, - { - "internalType": "address", - "name": "oracleAddress", - "type": "address" - }, - { "internalType": "uint256", "name": "decimals", "type": "uint256" }, - { "internalType": "int256", "name": "discount", "type": "int256" }, - { "internalType": "int256", "name": "liquidity", "type": "int256" }, - { "internalType": "int256", "name": "pnl", "type": "int256" }, - { - "internalType": "int256", - "name": "cumulativePnl", - "type": "int256" - } - ], - "internalType": "struct IPerpetualPool.BTokenInfo", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - "v3Liquidity": { - "inputs": [], - "name": "liquidity", - "outputs": [{ "internalType": "int256", "name": "", "type": "int256" }], - "stateMutability": "view", - "type": "function" - } -} + "getLengths": "function getLengths() view returns (uint256, uint256)", + "getBToken": "function getBToken(uint256 bTokenId) view returns (tuple(address bTokenAddress, address swapperAddress, address oracleAddress, uint256 decimals, int256 discount, int256 liquidity, int256 pnl, int256 cumulativePnl))", + "v3Liquidity": "int256:liquidity" +} \ No newline at end of file diff --git a/projects/deri/index.js b/projects/deri/index.js index 7079cfd908b..5174dc0b717 100644 --- a/projects/deri/index.js +++ b/projects/deri/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const { transformPolygonAddress } = require("../helper/portedTokens"); const abi = require("./abi"); @@ -97,16 +98,16 @@ async function v3Pool( let bscContracts = { a: { - bTokenSymbol: "0x4fabb145d64652a948d72533023f6e7a623c7c53", + bTokenSymbol: ADDRESSES.ethereum.BUSD, pool: "0x66f501dda450C8978c4A1115D7b2A7FAa7702F05", }, b: { - bTokenSymbol: "0xe9e7cea3dedca5984780bafc599bd69add087d56", + bTokenSymbol: ADDRESSES.bsc.BUSD, pool: "0x574022307e60bE1f07da6Ec1cB8fE23d426e5831", lite: true, }, everlastingOption: { - bTokenSymbol: "0xe9e7cea3dedca5984780bafc599bd69add087d56", + bTokenSymbol: ADDRESSES.bsc.BUSD, pool: "0x08aD0E0b4458183758fC5b9b6D27c372965fB780", lite: true, }, @@ -116,28 +117,28 @@ let bscContracts = { lite: true, }, option: { - bTokenSymbol: "0xe9e7cea3dedca5984780bafc599bd69add087d56", + bTokenSymbol: ADDRESSES.bsc.BUSD, pool: "0x243681B8Cd79E3823fF574e07B2378B8Ab292c1E", v3: true, }, futureMain: { - bTokenSymbol: "0xe9e7cea3dedca5984780bafc599bd69add087d56", + bTokenSymbol: ADDRESSES.bsc.BUSD, pool: "0x4ad5cb09171275A4F4fbCf348837c63a91ffaB04", v3: true, }, futureInno: { - bTokenSymbol: "0xe9e7cea3dedca5984780bafc599bd69add087d56", + bTokenSymbol: ADDRESSES.bsc.BUSD, pool: "0xD2D950e338478eF7FeB092F840920B3482FcaC40", v3: true, }, }; let polygonContracts = { a: { - bTokenSymbol: "0xc2132d05d31c914a87c6611c10748aeb04b58e8f", + bTokenSymbol: ADDRESSES.polygon.USDT, pool: "0x4Db087225C920Bec55B2dCEAa629BDc5782623D9", }, b: { - bTokenSymbol: "0xc2132d05d31c914a87c6611c10748aeb04b58e8f", + bTokenSymbol: ADDRESSES.polygon.USDT, pool: "0xA8769A4Fb0Ca82eb474448B1683DCA3c79798B69", lite: true, }, @@ -148,11 +149,20 @@ let polygonContracts = { }, }; -let arbitrumContracts = { - futureMain: { - bTokenSymbol: "0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8", - pool: "0xDE3447Eb47EcDf9B5F90E7A6960a14663916CeE8", - v3: true, +let config = { + arbitrum: { + futureMain: { + bTokenSymbol: ADDRESSES.arbitrum.USDC, + pool: "0xDE3447Eb47EcDf9B5F90E7A6960a14663916CeE8", + v3: true, + }, + }, + era: { + futureMain: { + bTokenSymbol: ADDRESSES.era.USDC, + pool: "0x9F63A5f24625d8be7a34e15477a7d6d66e99582e", + v3: true, + }, }, }; async function bsc(timestamp, ethBlock, chainBlocks) { @@ -214,14 +224,15 @@ async function polygon(timestamp, ethBlock, chainBlocks) { } return balances; } -async function arbitrum(timestamp, ethBlock, chainBlocks) { +async function tvl(timestamp, ethBlock, chainBlocks, { api }) { let balances = {}; - const transform = (a) => `arbitrum:${a}`; - for (let [key, contract] of Object.entries(arbitrumContracts)) { + const contracts = config[api.chain] + const transform = (a) => `${api.chain}:${a}`; + for (let [key, contract] of Object.entries(contracts)) { if (contract.v3 === true) { await v3Pool( - chainBlocks["arbitrum"], - "arbitrum", + api.block, + api.chain, contract.pool, contract.bTokenSymbol, balances, @@ -234,6 +245,7 @@ async function arbitrum(timestamp, ethBlock, chainBlocks) { } // node test.js projects/deri/index.js module.exports = { + misrepresentedTokens: true, bsc: { tvl: bsc, }, @@ -241,6 +253,9 @@ module.exports = { tvl: polygon, }, arbitrum: { - tvl: arbitrum, + tvl, + }, + era: { + tvl, }, }; diff --git a/projects/deribit/index.js b/projects/deribit/index.js index 24933e70012..0cc893762af 100644 --- a/projects/deribit/index.js +++ b/projects/deribit/index.js @@ -42,3 +42,4 @@ const config = { } module.exports = cexExports(config) +module.exports.methodology = 'This wallets where collect from here https://insights.deribit.com/exchange-updates/deribit-wallet-holdings/' diff --git a/projects/deridex/index.js b/projects/deridex/index.js new file mode 100644 index 00000000000..20af05f2bd3 --- /dev/null +++ b/projects/deridex/index.js @@ -0,0 +1,37 @@ +const sdk = require('@defillama/sdk') +const { toUSDTBalances } = require("../helper/balances"); +const { getAppGlobalState, } = require("../helper/chain/algorand") +const { appDictionary, marketStrings } = require('./utils') + + +async function tvl() { + let balance = 0 + + for (let [perpName, data] of Object.entries(appDictionary)) { + const state = await getAppGlobalState(data.appId) + const a1state = await getAppGlobalState(state[marketStrings.a1_mkt]) + const a2state = await getAppGlobalState(state[marketStrings.a2_mkt]) + const oracle = await getAppGlobalState(data.oracle) + const a1Supply = state[marketStrings.total_a1_supply] / (10 ** data.a1d) + const a1Baer = a1state[marketStrings.basset_exchange_rate] / (1e9) + const price = oracle[marketStrings.latest_price] / (1e6) + const a2Supply = state[marketStrings.total_a2_supply] / (10 ** data.a2d) + const a2Baer = a2state[marketStrings.basset_exchange_rate] / (1e9) + balance += a1Supply * a1Baer * price + balance += a2Supply * a2Baer + } + return toUSDTBalances(balance) +} + +module.exports = { + hallmarks: [ + [1675900800, "Project shuts down"] + ], + timetravel: false, + doublecounted: true, + misrepresentedTokens: true, + methodology: "Gathers the total USD value of all assets supplied", + algorand: { + tvl + } +} \ No newline at end of file diff --git a/projects/deridex/utils.js b/projects/deridex/utils.js new file mode 100644 index 00000000000..83ab6e1b14e --- /dev/null +++ b/projects/deridex/utils.js @@ -0,0 +1,26 @@ +const marketStrings = { + total_a1_borrowed: "ta1b", + total_a1_supply: "ta1s", + a1_mkt: "a1mk", + total_a2_borrowed: "ta2b", + total_a2_supply: "ta2s", + a2_mkt: "a2mk", + basset_exchange_rate: "baer", + latest_price: "latest_price", +} + +const appDictionary = { + "ALGO/STBL2": { + "appId": 994412935, + "a1": "ALGO", + "a1d": 6, + "a2": "STBL2", + "a2d": 6, + "oracle": 531724540 + }, +} + +module.exports = { + marketStrings, + appDictionary, +} \ No newline at end of file diff --git a/projects/derify/index.js b/projects/derify/index.js new file mode 100644 index 00000000000..74b92c2dd15 --- /dev/null +++ b/projects/derify/index.js @@ -0,0 +1,8 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { staking } = require('../helper/staking') + +module.exports = { + bsc: { + tvl: staking('0x75777494496f6250DdB9A1B96a6203e219d3698f', ADDRESSES.bsc.BUSD) + } +} diff --git a/projects/derivadex/index.js b/projects/derivadex/index.js index 60b5f42a0eb..f41ed3fcdee 100644 --- a/projects/derivadex/index.js +++ b/projects/derivadex/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') /*================================================== Modules ==================================================*/ @@ -13,14 +14,14 @@ const addressList = ["0x6fb8aa6fc6f27e591423009194529ae126660027"]; //TODO: DYNAMICALLY FETCH const tokenAddresses = [ - "0xdac17f958d2ee523a2206206994597c13d831ec7", //usdtAddress: + ADDRESSES.ethereum.USDT, //usdtAddress: "0xf650c3d88d12db855b8bf7d11be6c55a4e07dcc9", //cusdtAddress: - "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", //usdcAddress: + ADDRESSES.ethereum.USDC, //usdcAddress: "0x39aa39c021dfbae8fac545936693ac917d5e7563", //cusdcAddress: "0xdf574c24545e5ffecb9a659c229253d4111d87e1", //husdAddress "0x056fd409e1d7a124bd7017459dfea2f387b6d5cd", //gusdAddress - // "0x0000000000000000000000000000000000000000", // ausdtAddress: - // "0x0000000000000000000000000000000000000000", //ausdcAddress: + // ADDRESSES.null, // ausdtAddress: + // ADDRESSES.null, //ausdcAddress: ]; /*================================================== diff --git a/projects/deversifi/index.js b/projects/deversifi/index.js index 2a47c3f6605..995e9b6a371 100644 --- a/projects/deversifi/index.js +++ b/projects/deversifi/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const {nullAddress, sumTokens2} = require('../helper/unwrapLPs') const sdk = require('@defillama/sdk') @@ -12,60 +13,60 @@ const contracts = { const listedTokens = [ nullAddress, - '0xdac17f958d2ee523a2206206994597c13d831ec7', - '0x6B175474E89094C44Da98b954EedeAC495271d0F', + ADDRESSES.ethereum.USDT, + ADDRESSES.ethereum.DAI, '0xd26114cd6EE289AccF82350c8d8487fedB8A0C07', '0x940a2db1b7008b6c776d4faaca729d6d4a4aa551', - '0x0bc529c00C6401aEF6D220BE8C6Ea1667F6Ad93e', - '0x9f8f72aa9304c8b593d555f12ef6589cc3a579a2', - '0x2260fac5e5542a773aa44fbcfedf7c193bc2c599', + ADDRESSES.ethereum.YFI, + ADDRESSES.ethereum.MKR, + ADDRESSES.ethereum.WBTC, '0xe41d2489571d322189246dafa5ebde1f4699f498', '0xcc80c051057b774cd75067dc48f8987c4eb97a5e', - '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', + ADDRESSES.ethereum.USDC, '0x419d0d8bdd9af5e606ae2232ed285aff190e711b', '0x93ed3fbe21207ec2e8f2d3c3de6e058cb73bc04d', - '0x0bc529c00C6401aEF6D220BE8C6Ea1667F6Ad93e', + ADDRESSES.ethereum.YFI, '0xba100000625a3754423978a60c9317c58a424e3d', - '0x1f9840a85d5af5bf1d1762f925bdaddc4201f984', + ADDRESSES.ethereum.UNI, '0xc00e94cb662c3520282e6f5717214004a7f26888', '0xec67005c4e498ec7f55e092bd1d35cbc47c91892', - '0x0d8775f648430679a709e98d2b0cb6250d2887ef', - '0x514910771af9ca656af840dff83e8264ecf986ca', + ADDRESSES.ethereum.BAT, + ADDRESSES.ethereum.LINK, '0x93ed3fbe21207ec2e8f2d3c3de6e058cb73bc04d', - '0xc011a73ee8576fb46f5e1c5751ca3b9fe0af2a6f', - '0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9', + ADDRESSES.ethereum.SNX, + ADDRESSES.ethereum.AAVE, '0xeef9f339514298c6a857efcfc1a762af84438dee', '0xa117000000f279d81a1d3cc75430faa017fa5a2e', '0x1494ca1f11d487c2bbe4543e90080aeba4ba3c2b', '0xf650c3d88d12db855b8bf7d11be6c55a4e07dcc9', - '0x5a98fcbea516cf06857215779fd812ca3bef1b32', + ADDRESSES.ethereum.LIDO, '0xdddddd4301a082e62e84e43f474f044423921918', '0xaaaebe6fe48e54f431b0c390cfaf0b017d09d42d', - '0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0', + ADDRESSES.ethereum.MATIC, '0x0a0e3bfd5a8ce610e735d4469bc1b3b130402267', - '0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE', - '0xD533a949740bb3306d119CC777fa900bA034cd52', + ADDRESSES.ethereum.INU, + ADDRESSES.ethereum.CRV, '0x03ab458634910aad20ef5f1c8ee96f1d6ac54919', '0x0391d2021f89dc339f60fff84546ea23e337750f', - '0x2e9d63788249371f1dfc918a52f8d799f4a38c94', + ADDRESSES.ethereum.TOKE, '0x33349b282065b0284d756f0577fb39c158f935e6', '0x767fe9edc9e0df98e07454847909b5e959d7ca0e', '0x25f8087ead173b73d6e8b84329989a8eea16cf73', '0xdddd0e38d30dd29c683033fa0132f868597763ab', - '0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0', - '0x6b3595068778dd592e39a122f4f5a5cf09c90fe2' + ADDRESSES.ethereum.WSTETH, + ADDRESSES.ethereum.SUSHI ]; const arbitrumTokens = [ nullAddress, - '0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8', - '0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9', - '0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1' + ADDRESSES.arbitrum.USDC, + ADDRESSES.arbitrum.USDT, + ADDRESSES.optimism.DAI ]; const polygonTokens = [ nullAddress, - '0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174', - '0xc2132D05D31c914a87C6611C10748AEb04B58e8F', - '0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063' + ADDRESSES.polygon.USDC, + ADDRESSES.polygon.USDT, + ADDRESSES.polygon.DAI ]; async function tvl(timestamp, block){ diff --git a/projects/devil-finance/index.js b/projects/devil-finance/index.js index 5cd816d263b..627b6ae5924 100644 --- a/projects/devil-finance/index.js +++ b/projects/devil-finance/index.js @@ -6,7 +6,7 @@ function tvl(type) { return { tether: response[type] }; }; -}; +} module.exports = { misrepresentedTokens: true, @@ -17,3 +17,5 @@ module.exports = { staking: tvl("native"), }, }; + +module.exports.fantom = { tvl: () => 0} \ No newline at end of file diff --git a/projects/dexfinance/abi.js b/projects/dexfinance/abi.js index 95e6d6b72f8..51d8ff4a1c6 100644 --- a/projects/dexfinance/abi.js +++ b/projects/dexfinance/abi.js @@ -1,18 +1,5 @@ const ETF_ABI = { - 'getCurrentTokens': { - "inputs": [], - "name": "getCurrentTokens", - "outputs": [ - { - "internalType": "address[]", - "name": "tokens", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function", - "constant": true - }, + 'getCurrentTokens':"address[]:getCurrentTokens" } diff --git a/projects/dexfinance/index.js b/projects/dexfinance/index.js index 7290ff688f1..c133c7cfbc5 100644 --- a/projects/dexfinance/index.js +++ b/projects/dexfinance/index.js @@ -1,9 +1,11 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const BigNumber = require("bignumber.js"); const { ETF_ABI, } = require('./abi'); const { sumTokens2, sumTokensExport, } = require('../helper/unwrapLPs') const REGULATION_STAKING_POOL = '0xd69db827939e26511068aa2bf742e7463b292190' +const REWARD_POOL = '0x4c7371a351a465c38dc129e4d084b9b8aef14041' const FARM = '0xcc180bfa5d2c3ac191758b721c9bbbb263b3fd1c' const TREASURY = '0xa5f3d6a33c5a5bcdff8f81c88ca00f457b699e0f' @@ -16,46 +18,11 @@ const TOKENS = { DEXSHARE: '0xf4914e6d97a75f014acfcf4072f11be5cffc4ca6', DEXIRA: '0x147e07976e1ae78287c33aafaab87760d32e50a5', WDEX_DEXSHARE: '0x6647047433df4cfc9912d092fd155b9d972a4a85', - BNB: '0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c', + BNB: ADDRESSES.bsc.WBNB, }; -const commonCallOptions = { - chain: 'bsc', - decimals: 18 -} - -async function getWdexDexsharePrice(dexIraPrice, dexSharePrice) { - const [ - { output: wdexTotalSupply }, - { output: balanceDexIra }, - { output: balanceDexShare }, - ] = await Promise.all([ - sdk.api.erc20.totalSupply({ - target: TOKENS.WDEX_DEXSHARE, - owner: FARM, - ...commonCallOptions - }), - sdk.api.erc20.balanceOf({ - target: TOKENS.DEXIRA, - owner: TOKENS.WDEX_DEXSHARE, - ...commonCallOptions, - decimals: 9 - }), - sdk.api.erc20.balanceOf({ - target: TOKENS.DEXSHARE, - owner: TOKENS.WDEX_DEXSHARE, - ...commonCallOptions - }) - ]) - - const balanceDexIraInUsd = dexIraPrice * balanceDexIra; - const balanceDexShareInUsd = dexSharePrice * balanceDexShare; - - return (balanceDexIraInUsd + balanceDexShareInUsd) / wdexTotalSupply; -} - const chain = 'bsc' -async function tvl(_, _b, { bsc: block}) { +async function tvl(_, _b, { bsc: block }) { const { output: tokens } = await sdk.api.abi.call({ target: ETF_INDEX_POOL, abi: ETF_ABI['getCurrentTokens'], @@ -64,24 +31,24 @@ async function tvl(_, _b, { bsc: block}) { }) const balances = await sumTokens2({ chain, block, tokens, owner: ETF_INDEX_POOL, }) return balances -} +} -async function farmWDEX_DEXSHARE(_, _b, { bsc: block}) { +async function farmWDEX_DEXSHARE(_, _b, { bsc: block }) { const [ { output: bal }, { output: iraBal }, { output: shareBal }, { output: totalSupply }, ] = await Promise.all([ - sdk.api.abi.call({ chain, block, abi: 'erc20:balanceOf', target: TOKENS.WDEX_DEXSHARE, params: FARM}), - sdk.api.abi.call({ chain, block, abi: 'erc20:balanceOf', target: TOKENS.DEXIRA, params: TOKENS.WDEX_DEXSHARE}), + sdk.api.abi.call({ chain, block, abi: 'erc20:balanceOf', target: TOKENS.WDEX_DEXSHARE, params: FARM }), + sdk.api.abi.call({ chain, block, abi: 'erc20:balanceOf', target: TOKENS.DEXIRA, params: TOKENS.WDEX_DEXSHARE }), sdk.api.abi.call({ chain, block, abi: 'erc20:balanceOf', target: TOKENS.DEXSHARE, params: TOKENS.WDEX_DEXSHARE }), sdk.api.abi.call({ chain, block, abi: 'erc20:totalSupply', target: TOKENS.WDEX_DEXSHARE, }), ]) - const ratio = bal/totalSupply + const ratio = bal / totalSupply const balances = {} - sdk.util.sumSingleBalance(balances, 'bsc:'+TOKENS.DEXIRA, BigNumber(iraBal * ratio).toFixed(0)) - sdk.util.sumSingleBalance(balances, 'bsc:'+TOKENS.DEXSHARE, BigNumber(shareBal * ratio).toFixed(0)) + sdk.util.sumSingleBalance(balances, 'bsc:' + TOKENS.DEXIRA, BigNumber(iraBal * ratio).toFixed(0)) + sdk.util.sumSingleBalance(balances, 'bsc:' + TOKENS.DEXSHARE, BigNumber(shareBal * ratio).toFixed(0)) return balances } @@ -89,14 +56,18 @@ module.exports = { bsc: { tvl, pool2: sdk.util.sumChainTvls([ - sumTokensExport({ chain, tokens: [TOKENS.USDEX_USDC_LP, TOKENS.DEXSHARE_BNB_LP, ], owner: FARM, }), + sumTokensExport({ chain, tokens: [TOKENS.USDEX_USDC_LP, TOKENS.DEXSHARE_BNB_LP,], owner: FARM, }), farmWDEX_DEXSHARE ]), - treasury: sumTokensExport({ chain, tokens: [ - TOKENS.DEXIRA_BNB_LP, - TOKENS.DEXSHARE_BNB_LP, - TOKENS.USDEX_USDC_LP, - ], owner: TREASURY, }), - staking: sumTokensExport({ chain, tokensAndOwners: [[TOKENS.DEXSHARE, REGULATION_STAKING_POOL,], ], }), - } + staking: sumTokensExport({ + chain, tokensAndOwners: [ + [TOKENS.DEXSHARE, REGULATION_STAKING_POOL,], + [TOKENS.DEXSHARE, REWARD_POOL,], + ], + }), + }, + hallmarks: [ + [1671483600, "DexEtf Launch"], + [1671656400, "DexVaults Launch"], + ], }; \ No newline at end of file diff --git a/projects/dexilla/index.js b/projects/dexilla/index.js new file mode 100644 index 00000000000..697f812e448 --- /dev/null +++ b/projects/dexilla/index.js @@ -0,0 +1,54 @@ +const { sumTokens2 } = require('../helper/unwrapLPs') + +const config = { + era: { + exchanges: [ + '0xCA2eE260BFA64D8Fb01B1cd75615aAa42D528214', + '0x588450db6e3586Ec0468a7Bb36f1d5f3BbbE2084', + '0x0DE31204e919D71f0E7b9E5766950e99f1017826', + '0x16412BE389278B81594027E77FF9b61b2d200caa', + '0xE0D2833D9ED879D16BfC1cEc3573293770b8abBB', + '0x66831746E2F5a3CfC2A6E2b9eB5Ea8b7dd78Ee6A', + ], + }, + optimism: { + exchanges: [ + '0x189c3f9dcAfe968Be3620cC58274E7c5DF057C7c', + '0x68D05405472C4f0c254A47922Dba9dbC4CFf2bD9', + '0x8F1F6751236855391BbBEDBf4Bf5AD7e383E6e50', + '0xb0BE48F722a8AD727b99064EE18b715e9757e959', + '0x2d10b03854e970d3772434FF1133BCb3E59Ca4b8', + '0x2BF9D7e4173B882335b464e2fB38f5b57768ab61', + '0x44F1C33ED3bf77A5883cBEce1c1b34E71425CE84', + ], + }, + arbitrum: { + exchanges: [ + '0x8ea13d1a455e5c5b425a6fc7260a01265d4c4673', + '0x8C9DBB80f12D0425eAf127FCC1D92FB21Cb4CE4C', + '0x66A724fa0CEB8adfa064afEf5102A2e04E4264c6', + '0x5dD2a1C1Fb25E30928C901a28Ceaf53E59B606dD', + ], + }, + base:{ + exchanges: [ + '0x3F7F51983fb95084a5cb73EB2F28757Bd8bb65E3', + ], + } +} + +module.exports = { + methodology: 'TVL counts the ERC20 tokens on the exchange contracts.', + start: 1685610580, // June 1, 2023 @ 9:09:40 (UTC +0) +} + +Object.keys(config).forEach(chain => { + const { exchanges } = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const baseTokens = await api.multiCall({ abi: 'address:baseToken', calls: exchanges}) + const quoteTokens = await api.multiCall({ abi: 'address:quoteToken', calls: exchanges}) + return sumTokens2({ api, tokensAndOwners: exchanges.map((v, i) => [[baseTokens[i], v], [quoteTokens[i], v ]]).flat()}) + } + } +}) diff --git a/projects/dexio-protocol/index.js b/projects/dexio-protocol/index.js new file mode 100644 index 00000000000..a75d6797c84 --- /dev/null +++ b/projects/dexio-protocol/index.js @@ -0,0 +1,13 @@ +const { staking } = require('../helper/staking') + +module.exports = { + methodology: 'TVL counts staked DEXI coins on the platform itself. CoinGecko is used to find the price of tokens in USD.', + polygon: { + tvl:() => 0, + staking: staking(["0x6e17539F792A31F39cEEc0BcaB4079032523e3c7","0x233a2901EB51380E7Bf30fA3D31d4c326471B489","0x0C693035837C52Da8c2A4505bdf0f2aC43f9909C","0xA17c08d8FC00481A937ecE7FDF5C94082bdFFE17"], '0x65ba64899c2c7dbfdb5130e42e2cc56de281c78b') + }, + kava: { + tvl:() => 0, + staking: staking(["0xB8e29c001E41Bc3A3dF7E1A549bdd898640189F5","0x732Bb01c38b7092eB554A7779ad5F7BCd3430266","0x5a4C7C9d3126C57CDDc7856dfA085e5B775ce212","0x6FA2d43f7D766Fd9b2990426a06Bb24B4FBcE959"], '0xd22a58f79e9481d1a88e00c343885a588b34b68b') + }, +}; diff --git a/projects/dexit-swap/index.js b/projects/dexit-swap/index.js new file mode 100644 index 00000000000..d67935e32bf --- /dev/null +++ b/projects/dexit-swap/index.js @@ -0,0 +1,5 @@ + +const { uniTvlExport } = require('../helper/unknownTokens') +module.exports = uniTvlExport('dexit', '0xed7e00862c73eF3a53f33d785c62d312Cc8827d2') + +module.exports.dexit.tvl = () => ({}) \ No newline at end of file diff --git a/projects/dexpad/abis.js b/projects/dexpad/abis.js index cdb523e6c69..ff1c2097654 100644 --- a/projects/dexpad/abis.js +++ b/projects/dexpad/abis.js @@ -1,74 +1,8 @@ -const getNumLockedTokens = { - "inputs": [], - "name": "getNumLockedTokens", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" -} - -const lockedTokensLength = { - "inputs": [], - "name": "lockedTokensLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" -} - -const getLockedTokenAtIndex = { - "inputs": [ - { - "internalType": "uint256", - "name": "_index", - "type": "uint256" - } - ], - "name": "getLockedTokenAtIndex", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" -} - - -const lockedToken = { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "lockedTokens", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" -} - - +const getNumLockedTokens = "uint256:getNumLockedTokens" +const lockedTokensLength = "uint256:lockedTokensLength" +const getLockedTokenAtIndex = 'function getLockedTokenAtIndex(uint256 _index) view returns (address)' +const lockedToken = 'function lockedTokens(uint256) view returns (address)' module.exports = { getLockedTokenAtIndex, diff --git a/projects/dexpad/api.js b/projects/dexpad/api.js index 3cfe712bd6f..e0fc574719d 100644 --- a/projects/dexpad/api.js +++ b/projects/dexpad/api.js @@ -6,4 +6,7 @@ module.exports = { timetravel: false, misrepresentedTokens: true, ...getExports("dexpad", chainKeys), -} \ No newline at end of file +} + +module.exports = indexExports +module.exports.misrepresentedTokens = true diff --git a/projects/dexpad/apiCache.js b/projects/dexpad/apiCache.js index 71a952b63a8..330efc66dbc 100644 --- a/projects/dexpad/apiCache.js +++ b/projects/dexpad/apiCache.js @@ -1,9 +1,10 @@ const { polygonContractData, avalancheContractData, cronosContractData, kavaContractData } = require('./config') -const { vestingHelper, getCache, setCache, } = require("../helper/cache"); + const { getCache, setCache, } = require("../helper/cache") + const { vestingHelper, } = require("../helper/unknownTokens") const sdk = require('@defillama/sdk') -const project = 'dexpad' +const project = 'bulky/dexpad' function tvl(args) { return async (timestamp, ethBlock, chainBlocks) => { @@ -12,7 +13,7 @@ function tvl(args) { const chain = args[i].chain const contract = args[i].contract let block = chainBlocks[chain] - const cache = getCache(project, chain) || {} + const cache = await getCache(project, chain) || {} if (!cache[contract]) cache[contract] = { tokens: [], lastTotalDepositId: 0 } const cCache = cache[contract] const calls = [] @@ -57,7 +58,7 @@ function tvl(args) { tokens, cache, }) - setCache(project, chain, cache) + await setCache(project, chain, cache) for (const [token, balance] of Object.entries(balances)) sdk.util.sumSingleBalance(totalBalances, token, balance) diff --git a/projects/dexswap-arbi/index.js b/projects/dexswap-arbi/index.js new file mode 100644 index 00000000000..8b46b8d8fe9 --- /dev/null +++ b/projects/dexswap-arbi/index.js @@ -0,0 +1,8 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports = { + misrepresentedTokens: true, + arbitrum: { + tvl: getUniTVL({ factory: '0x3E40739d8478c58f9B973266974C58998D4F9e8b', useDefaultCoreAssets: true, }), + } +} diff --git a/projects/dexter-tezos/index.js b/projects/dexter-tezos/index.js new file mode 100644 index 00000000000..2aecf25d306 --- /dev/null +++ b/projects/dexter-tezos/index.js @@ -0,0 +1,18 @@ +const { sumTokensExport } = require('../helper/sumTokens') + +module.exports = { + tezos: { + tvl: sumTokensExport({ + owners: [ + 'KT1Puc9St8wdNoGtLiD2WXaHbWU7styaxYhD', + 'KT1Tr2eG3eVmPRbymrbU2UppUmKjFPXomGG9', + 'KT1DrJV8vhkdLEj76h1H9Q4irZDqAkMPo1Qf', + 'KT1BGQR7t4izzKZ7eRodKWTodAsM23P38v7N', + 'KT1Xf2Cwwwh67Ycu7E9yd3UhsABQC4YZPkab', + 'KT1AbYeDbjjcAnV1QK7EZUUdqku77CdkTuv6', + 'KT19c8n5mWrqpxMcR3J687yssHxotj88nGhZ', + 'KT1PDrBE59Zmxnb8vXRgRAG1XmvTMTs5EDHU', + ] + }), + } +} \ No newline at end of file diff --git a/projects/dexter/index.js b/projects/dexter/index.js new file mode 100644 index 00000000000..8a2a774e92d --- /dev/null +++ b/projects/dexter/index.js @@ -0,0 +1,49 @@ +const {GraphQLClient, gql} = require('graphql-request'); +const {toUSDTBalances} = require("../helper/balances"); + +const dexterSubgraphEndpoint = "https://api.core-1.dexter.zone/v1/graphql"; +const dexterVaultAddr = "persistence1k8re7jwz6rnnwrktnejdwkwnncte7ek7gt29gvnl3sdrg9mtnqkstujtpg"; + +const currentTvlOp = gql` + query defillama_current_tvl($vault: String, $date: date) { + tvl: pool_daily_closing_data_aggregate(where: {vault_address: {_eq: $vault}, date: {_eq: $date}}) { + aggregate { + sum { + liquidity + } + } + } + } +`; + +async function getTvlAtTime(timestamp) { + const date = new Date(timestamp * 1000); + const dateStr = `${date.getUTCFullYear()}-${date.getUTCMonth() + 1}-${date.getUTCDate()}`; + + const graphQLClient = new GraphQLClient(dexterSubgraphEndpoint); + const results = await graphQLClient.request(currentTvlOp, { + "vault": dexterVaultAddr, + "date": dateStr + }); + + return results.tvl.aggregate.sum.liquidity; +} + +async function tvl(timestamp) { + const currentTVL = await getTvlAtTime(timestamp); + + // return the liquidity for prev day, if none exists for current day + const liquidity = currentTVL ? currentTVL : await getTvlAtTime(timestamp - 86400); + + return toUSDTBalances(liquidity); +} + +module.exports = { + timetravel: true, + misrepresentedTokens: true, + methodology: `Counts the liquidity on all AMM pools`, + start: 1679788800, // "2023-03-26" UTC + persistence: { + tvl + } +}; // node test.js projects/dexter/index.js diff --git a/projects/dextf/abis/getPositions.json b/projects/dextf/abis/getPositions.json deleted file mode 100644 index 055f1020f38..00000000000 --- a/projects/dextf/abis/getPositions.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "inputs": [], - "name": "getPositions", - "outputs": [ - { - "components": [ - { - "internalType": "address", - "name": "component", - "type": "address" - }, - { - "internalType": "address", - "name": "module", - "type": "address" - }, - { - "internalType": "int256", - "name": "unit", - "type": "int256" - }, - { - "internalType": "uint8", - "name": "positionState", - "type": "uint8" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "internalType": "struct ISetToken.Position[]", - "name": "", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" -} diff --git a/projects/dextf/abis/getReserves.json b/projects/dextf/abis/getReserves.json deleted file mode 100644 index e3f6fcc11d8..00000000000 --- a/projects/dextf/abis/getReserves.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "constant": true, - "inputs": [], - "name": "getReserves", - "outputs": [ - { - "internalType": "uint112", - "name": "_reserve0", - "type": "uint112" - }, - { - "internalType": "uint112", - "name": "_reserve1", - "type": "uint112" - }, - { - "internalType": "uint32", - "name": "_blockTimestampLast", - "type": "uint32" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" -} diff --git a/projects/dextf/abis/getSets.json b/projects/dextf/abis/getSets.json deleted file mode 100644 index 2a0787e11fa..00000000000 --- a/projects/dextf/abis/getSets.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "inputs": [], - "name": "getSets", - "outputs": [ - { - "internalType": "address[]", - "name": "", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" -} diff --git a/projects/dextf/abis/totalSupply.json b/projects/dextf/abis/totalSupply.json deleted file mode 100644 index 33dd41d1ce2..00000000000 --- a/projects/dextf/abis/totalSupply.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" -} diff --git a/projects/dextf/index.js b/projects/dextf/index.js index f34ad231a39..aeeee078523 100644 --- a/projects/dextf/index.js +++ b/projects/dextf/index.js @@ -1,45 +1,10 @@ -/*================================================== - Modules - ==================================================*/ - - const TVLV1 = require('./v1'); - const TVLV2 = require('./v2'); - - const BigNumber = require('bignumber.js'); - -/*================================================== - TVL - ==================================================*/ - - async function tvl(timestamp, block) { - const [v1, v2] = await Promise.all([ - TVLV1(timestamp, block), TVLV2(timestamp, block)]); - - const tokenAddresses = new Set(Object.keys(v1).concat(Object.keys(v2))); - - const balances = ( - Array - .from(tokenAddresses) - .reduce((accumulator, tokenAddress) => { - const v1Balance = new BigNumber(v1[tokenAddress] || '0'); - const v2Balance = new BigNumber(v2[tokenAddress] || '0'); - - accumulator[tokenAddress] = v1Balance.plus(v2Balance).toFixed(0); - - return accumulator - }, {}) - ); - - delete balances['0xa9859874e1743a32409f75bb11549892138bba1e']; // removing IETH because the balance was 8637200000 at ts: 1608768000 which resulted in the DexTF tvl being $6698B - - return balances; - } - -/*================================================== - Exports - ==================================================*/ - - module.exports = { - start: 1595853825, // 27/07/2020 @ 12:43:45am (UTC) - ethereum: { tvl } - } +const TVLV1 = require('./v1'); +const tvlV2 = require('./v2'); +const sdk = require('@defillama/sdk'); + +module.exports = { + start: 1595853825, // 27/07/2020 @ 12:43:45am (UTC) + ethereum: { tvl: sdk.util.sumChainTvls([TVLV1, tvlV2]) }, + avax: { tvl: tvlV2 }, + era: { tvl: tvlV2 } +} \ No newline at end of file diff --git a/projects/dextf/v1.js b/projects/dextf/v1.js index 30e685c9fb0..77de8b5ef36 100644 --- a/projects/dextf/v1.js +++ b/projects/dextf/v1.js @@ -1,88 +1,9 @@ -const sdk = require('@defillama/sdk'); -const BigNumber = require('bignumber.js'); +const { sumTokens2 } = require('../helper/unwrapLPs') +const { covalentGetTokens } = require('../helper/http') -const axios = require('axios'); - -/*================================================== -Settings -==================================================*/ -const vaultAddress = "0x86C077092018077Df34FF44D5D7d3f9A2DF03bEf"; - -const cTokenDecimalScale = BigNumber("10").pow(18); -const cTokensMap = { - '0x4Ddc2D193948926D02f9B1fE9e1daa0718270ED5': '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', // cETH: WETH - '0x5d3a536E4D6DbD6114cc1Ead35777bAB948E3643': '0x6B175474E89094C44Da98b954EedeAC495271d0F', // cDAI: DAI - '0xC11b1268C1A384e55C48c2391d8d480264A3A7F4' : '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599' // cWBTC: WBTC -} - -/*================================================== - TVL - ==================================================*/ +const vaultAddress = "0x86C077092018077Df34FF44D5D7d3f9A2DF03bEf" module.exports = async function tvl(timestamp, block) { - - // Fetch list of token supported by the protocol - let tokensList = []; - let response = await axios.get('https://api.dextf.com/dp/assets', { - }); - for (var i = 0; i < response.data.assets.length; i++) { - tokensList.push(response.data.assets[i].contract); - } - - - let balances = {}; - - // Vault Asset Balances - let balanceOfResults = await sdk.api.abi.multiCall({ - block, - calls: tokensList.map((token) => { - return { - target: token, - params: vaultAddress - } - }), - abi: 'erc20:balanceOf' - }); - - // cToken Exchange Rates - let cTokenConversionRatesMap = (await sdk.api.abi.multiCall({ - block, - calls: Object.keys(cTokensMap).map((cToken) => { - return { - target: cToken - } - }), - abi: { - "constant": true, - "type": "function", - "inputs": [], - "name": "exchangeRateStored", - "outputs": [ - { - "name":"", - "type":"uint256" - } - ] - } - })).output.reduce(function(map, object) { - map[object.input.target] = object.output; - return map; - }, {}); - - // Compute Balances - balanceOfResults.output.forEach((balanceOf) => { - let address = balanceOf.input.target - - if (address in cTokensMap) { - let addressOfUnderlying = cTokensMap[address]; - let conversionRate = BigNumber(cTokenConversionRatesMap[address]); - let balanceOfUnderlying = BigNumber(balanceOf.output).times(conversionRate).div(cTokenDecimalScale); - - balances[addressOfUnderlying] = BigNumber(balances[addressOfUnderlying] || 0).plus(balanceOfUnderlying || 0).toFixed(); - } else { - balances[address] = BigNumber(balances[address] || 0).plus(balanceOf.output || 0).toFixed(); - } - }); - - return balances; + const tokens = await covalentGetTokens(vaultAddress) + return sumTokens2({ block, owner: vaultAddress, tokens,}) }; diff --git a/projects/dextf/v2.js b/projects/dextf/v2.js index 9b9398a6877..33203e31467 100644 --- a/projects/dextf/v2.js +++ b/projects/dextf/v2.js @@ -1,134 +1,29 @@ -const sdk = require('@defillama/sdk'); -const BigNumber = require('bignumber.js'); - - -const SUPPLY_SCALE = BigNumber("10").pow(18) const START_BLOCK = 12783638; -const EXTERNAL_POSITION = '1'; - -const getSets = require('./abis/getSets.json'); -const getPositions = require('./abis/getPositions.json'); -const totalSupply = require('./abis/totalSupply.json'); -const getReserves = require('./abis/getReserves.json'); - -const pairAddresses = { - '0xBb2b8038a1640196FbE3e38816F3e67Cba72D940': [ - '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599', - '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2' - ], - '0xA478c2975Ab1Ea89e8196811F51A7B7Ade33eB11': [ - '0x6B175474E89094C44Da98b954EedeAC495271d0F', - '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2' - ], -}; - -/*================================================== - TVL - ==================================================*/ - -module.exports = async function tvl(timestamp, block) { - let balances = {}; - - if (block <= START_BLOCK) { - return balances; - } - - const setAddresses = (await sdk.api.abi - .call({ - abi: getSets, - target: '0xE0CF093Ce6649Ef94fe46726745346AFc25214D8', - block, - })).output; - - let supplies = (await sdk.api.abi.multiCall({ - abi: totalSupply, - block, - calls: setAddresses.map((setAddress) => { - return { - target: setAddress, - } - }), - })).output; - - let positionsForSets = (await sdk.api.abi.multiCall({ - abi: getPositions, - block, - calls: setAddresses.map((setAddress) => { - return { - target: setAddress, - } - }), - })).output; - - let uniswapPositions = {}; - positionsForSets.forEach(function(positionForSet, i) { - const setSupply = BigNumber(supplies[i].output); - positionForSet.output.forEach((position) => { - const componentAddress = position[0]; - const positionUnits = BigNumber(position[2]); - - const isExternalPosition = position[3] == EXTERNAL_POSITION; - if (isExternalPosition) { - uniswapPositions[componentAddress] = BigNumber(uniswapPositions[componentAddress] || 0).plus((positionUnits).times(setSupply)).toFixed(); - } else { - balances[componentAddress] = BigNumber(balances[componentAddress] || 0).plus((positionUnits).times(setSupply).div(SUPPLY_SCALE)).toFixed(); - } - }); - }); - - const reserves = (await sdk.api.abi - .multiCall({ - abi: getReserves, - calls: Object.keys(uniswapPositions).map((pairAddress) => ({ - target: pairAddress, - })), - block, - })).output; - - let reserveSupplies = (await sdk.api.abi.multiCall({ - abi: totalSupply, - block, - calls: Object.keys(uniswapPositions).map((pairAddress) => { - return { - target: pairAddress, - } - }), - })).output; - - reserves.forEach(function(reserve, i) { - const pairAddress = reserve.input.target; - const tokenPair = pairAddresses[pairAddress]; - const setSupplyRatio = new BigNumber(uniswapPositions[pairAddress]).div(new BigNumber(reserveSupplies[i].output)).div(SUPPLY_SCALE); +const { sumTokens2 } = require('../helper/unwrapLPs'); - // handle reserve0 - if (tokenPair[0]) { - const reserve0 = new BigNumber(reserve.output['0']); - if (!reserve0.isZero()) { - const existingBalance = new BigNumber( - balances[tokenPair[0]] || '0' - ); +const config = { + ethereum: { factory: '0xE0CF093Ce6649Ef94fe46726745346AFc25214D8', }, + avax: { factory: '0xEC143bb9FEE95B7726bF49108f085D02816e53eA', }, + era: { factory: '0x44E12D14b63806A817B1AA6886215caA6aa136a7', }, +} - balances[tokenPair[0]] = existingBalance - .plus(reserve0.times(setSupplyRatio)) - .toFixed() - } - } +module.exports = async function tvl(timestamp, block, _, { api }) { + if (block <= START_BLOCK) + return {}; - // handle reserve1 - if (tokenPair[1]) { - const reserve1 = new BigNumber(reserve.output['1']); + const { factory } = config[api.chain] - if (!reserve1.isZero()) { - const existingBalance = new BigNumber( - balances[tokenPair[1]] || '0' - ); + const sets = await api.call({ + target: factory, + abi: 'address[]:getSets', + }) - balances[tokenPair[1]] = existingBalance - .plus(reserve1.times(setSupplyRatio)) - .toFixed() - } - } - }); + const components = await api.multiCall({ + abi: 'address[]:getComponents', + calls: sets, + }) - return balances; + const toa = [] + components.forEach((tokens, i) => toa.push(...tokens.map(t => ([t, sets[i]])))) + return sumTokens2({ api, tokensAndOwners: toa }) }; diff --git a/projects/dforce/abi.json b/projects/dforce/abi.json index 3b8019d0e1d..78e231a39ad 100644 --- a/projects/dforce/abi.json +++ b/projects/dforce/abi.json @@ -1,190 +1,13 @@ { - "getBaseData": { - "constant": false, - "inputs": [], - "name": "getBaseData", - "outputs": [{ - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - "balanceOfUnderlying":{ - "inputs": [ - { - "internalType": "address", - "name": "_account", - "type": "address" - } - ], - "name": "balanceOfUnderlying", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "balanceOf":{ - "constant": true, - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "totalSupply":{ - "constant": true, - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "exchangeRateCurrent":{ - "inputs": [], - "name": "exchangeRateCurrent", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "underlying":{ - "inputs": [], - "name": "underlying", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getUnderlyingPrice":{ - "inputs": [ - { - "internalType": "address", - "name": "_asset", - "type": "address" - } - ], - "name": "getUnderlyingPrice", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getAlliTokens": { - "inputs": [], - "name": "getAlliTokens", - "outputs": [ - { - "internalType": "address[]", - "name": "_alliTokens", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - "isiToken":{ - "inputs": [], - "name": "isiToken", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "pure", - "type": "function" - }, - "getCurrentExchangeRate": { - "inputs": [], - "name": "getCurrentExchangeRate", - "outputs": [ - { - "internalType": "uint256", - "name": "_exchangeRate", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "oracle": - { - "inputs": [], - "name": "priceOracle", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } -} + "getBaseData": "function getBaseData() returns (uint256, uint256, uint256, uint256, uint256)", + "balanceOfUnderlying": "function balanceOfUnderlying(address _account) view returns (uint256)", + "balanceOf": "function balanceOf(address account) view returns (uint256)", + "totalSupply": "uint256:totalSupply", + "exchangeRateCurrent": "uint256:exchangeRateCurrent", + "underlying": "address:underlying", + "getUnderlyingPrice": "function getUnderlyingPrice(address _asset) view returns (uint256)", + "getAlliTokens": "address[]:getAlliTokens", + "isiToken": "bool:isiToken", + "getCurrentExchangeRate": "uint256:getCurrentExchangeRate", + "oracle": "address:priceOracle" +} \ No newline at end of file diff --git a/projects/dforce/index.js b/projects/dforce/index.js index 8ffc345c333..8a3d4ed8b11 100644 --- a/projects/dforce/index.js +++ b/projects/dforce/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk'); const BigNumber = require('bignumber.js'); @@ -13,11 +14,11 @@ /*================================================== Ethereum Settings ==================================================*/ -const DAI = "0x6B175474E89094C44Da98b954EedeAC495271d0F"; +const DAI = ADDRESSES.ethereum.DAI; const PAX = "0x8E870D67F660D95d5be530380D0eC0bd388289E1"; -const TUSD = "0x0000000000085d4780B73119b644AE5ecd22b376"; -const USDC = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"; -const USDT = "0xdAC17F958D2ee523a2206206994597C13D831ec7"; +const TUSD = ADDRESSES.ethereum.TUSD; +const USDC = ADDRESSES.ethereum.USDC; +const USDT = ADDRESSES.ethereum.USDT; const USDx = "0xeb269732ab75A6fD61Ea60b06fE994cD32a83549"; /*================================================== @@ -38,10 +39,10 @@ const goldxProtocol = "0x355C665e101B9DA58704A8fDDb5FeeF210eF20c0"; // GOLDx /*================================================== BSC Settings ==================================================*/ -const BSC_BUSD = "0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56"; +const BSC_BUSD = ADDRESSES.bsc.BUSD; const BSC_DAI = "0x1AF3F329e8BE154074D8769D1FFa4eE058B1DBc3"; -const BSC_USDC = "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d"; -const BSC_USDT = "0x55d398326f99059fF775485246999027B3197955"; +const BSC_USDC = ADDRESSES.bsc.USDC; +const BSC_USDT = ADDRESSES.bsc.USDT; let oracles = { @@ -51,7 +52,8 @@ let oracles = { optimism: "0x4f9312A21F8853384E0f6141F3F9fB855d860161", polygon: "0x9E8B68E17441413b26C2f18e741EAba69894767c", avax: "0x5237d212F9BbC83d91c2cbd810D2b07808d94f08", - kava: "0xe04cea4d02261923769D79Dd24D188C2cB29dB4A" + kava: "0xe04cea4d02261923769D79Dd24D188C2cB29dB4A", + conflux: "0xfd3868B848B5D9eD3583938B4db4746415bD43a3" }; let allControllers = { @@ -72,6 +74,7 @@ let allControllers = { polygon: ["0x52eaCd19E38D501D006D2023C813d7E37F025f37"], avax: ["0x078ad8d6faeD9DAeE55f5d446C80E0C81230DE6b"], kava: ["0xFBf64A8cAEA1D641affa185f850dbBF90d5c84dC"], + conflux: ["0xA377eCF53253275125D0a150aF195186271f6a56"] }; let yieldMarkets = { @@ -140,6 +143,9 @@ const excludeAlliTokens = { ], kava: [ "0x9787af345e765a3fbf0f881c49f8a6830d94a514" // iUSX + ], + conflux: [ + "0x6f87b39a2e36F205706921d81a6861B655db6358" // iUSX ] }; @@ -147,12 +153,13 @@ const excludeAlliTokens = { const dfStakingPools = "0x41602ccf9b1F63ea1d0Ab0F0A1D2F4fd0da53f60"; const USXs = { - "ethereum": "0x0a5e677a6a24b2f1a2bf4f3bffc443231d2fdec8", + "ethereum": ADDRESSES.ethereum.USX, "bsc": "0xb5102cee1528ce2c760893034a4603663495fd72", "arbitrum": "0x641441c631e2f909700d2f41fd87f0aa6a6b4edb", "polygon": "0xCf66EB3D546F0415b368d98A95EAF56DeD7aA752", "avax": "0x853ea32391AaA14c112C645FD20BA389aB25C5e0", - "kava": "0xDb0E1e86B01c4ad25241b1843E407Efc4D615248", + "kava": ADDRESSES.kava.USX, + "conflux": "0x422a86f57b6b6F1e557d406331c25EEeD075E7aA" }; async function getDFStakingValue(block) { @@ -273,6 +280,6 @@ module.exports = { ...chainTvl("ethereum"), staking, }, - ...generalizedChainExports(chainTvl, ["bsc", "arbitrum", "optimism", "polygon", "avax", "kava"]), + ...generalizedChainExports(chainTvl, ["bsc", "arbitrum", "optimism", "polygon", "avax", "kava", "conflux"]), start: 1564165044, // Jul-27-2019 02:17:24 AM +UTC } diff --git a/projects/dfx/contracts.json b/projects/dfx/contracts.json deleted file mode 100644 index 99ba3fcf566..00000000000 --- a/projects/dfx/contracts.json +++ /dev/null @@ -1,128 +0,0 @@ -{ - "usdc": { - "ethereum": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", - "polygon": "0x2791bca1f2de4661ed88a30c99a7a9449aa84174" - }, - "ethereum": [ - { - "address": "0xa6c0cbcaebd93ad3c6c94412ec06aaa37870216d", - "token": "0xcadc0acd4b445166f12d2c07eac6e2544fbe2eef" - }, - { - "address": "0x1a4ffe0dcbdb4d551cfca61a5626afd190731347", - "token": "0xdb25f211ab05b1c97d595516f45794528a807ad8" - }, - { - "address": "0x2bab29a12a9527a179da88f422cdaaa223a90bd5", - "token": "0x70e8de73ce538da2beed35d14187f6959a8eca96" - }, - { - "address": "0xdD39379AB7C93b9bAAE29E6eC03795d0bC99a889", - "token": "0xebf2096e01455108badcbaf86ce30b6e5a72aa52" - }, - { - "address": "0xE9669516e09f5710023566458F329cCE6437AaaC", - "token": "0xda446fad08277b4d2591536f204e018f32b6831c", - "currency": "NZDS" - }, - { - "address": "0xC574A613A3900e4314da13eB2287f13689A5b64D", - "token": "0x2c537e5624e4af88a7ae4060c022609376c8d0eb", - "currency": "TRYb" - }, - { - "address": "0x66310ec13f36CAf5532c32B4359760592Db835Ab", - "token": "0x1aBaEA1f7C830bD89Acc67eC4af516284b1bC33c", - "currency": "EUROC" - }, - { - "address": "0x57BC10876fEbdC57f0ABb8C82ffAE600eEcc03A2", - "token": "0xC08512927D12348F6620a698105e1BAac6EcD911", - "currency": "GYEN" - }, - { - "address": "0xF3d7AA346965656E7c65FB4135531e0C2270AF83", - "token": "0xcadc0acd4b445166f12d2c07eac6e2544fbe2eef" - }, - { - "address": "0x9a6c7ae10eb82a0d7dc3c296ecbc2e2bdc53e80b", - "token": "0x70e8de73ce538da2beed35d14187f6959a8eca96" - }, - { - "address": "0x46161158b1947d9149e066d6d31af1283b2d377c", - "token": "0xebf2096e01455108badcbaf86ce30b6e5a72aa52" - }, - { - "address": "0x764a5A29f982D3513e76fe07dF2034821fBdba72", - "token": "0xda446fad08277b4d2591536f204e018f32b6831c", - "currency": "NZDS" - }, - { - "address": "0xcF3c8f51DE189C8d5382713B716B133e485b99b7", - "token": "0x2c537e5624e4af88a7ae4060c022609376c8d0eb", - "currency": "TRYb" - }, - { - "address": "0x477658494c3541ba272a7120176d77674a0183ba", - "token": "0x1aBaEA1f7C830bD89Acc67eC4af516284b1bC33c", - "currency": "EUROC" - }, - { - "address": "0x63cb0f59b7e67c7d4cb96214ca456597d85c587d", - "token": "0xC08512927D12348F6620a698105e1BAac6EcD911", - "currency": "GYEN" - } - ], - "polygon": [ - { - "address": "0x288Ab1b113C666Abb097BB2bA51B8f3759D7729e", - "token": "0x5d146d8b1dacb1ebba5cb005ae1059da8a1fbf57", - "currency": "CADC" - }, - { - "address": "0xB72d390E07F40D37D42dfCc43E954Ae7c738Ad44", - "token": "0xe111178a87a3bff0c8d18decba5798827539ae99", - "currency": "EURS" - }, - { - "address": "0x8e3e9cB46E593Ec0CaF4a1Dcd6DF3A79a87b1fd7", - "token": "0x769434dca303597c8fc4997bf3dab233e961eda2", - "currency": "XSGD" - }, - { - "address": "0xea75cd0b12a8b48f5bddad37ceb15f8cb3d2cc75", - "token": "0x4fb71290ac171e1d144f7221d882becac7196eb5", - "currency": "TRYb" - }, - { - "address": "0x931d6a6cc3f992beee80a1a14a6530d34104b000", - "token": "0xeafe31cd9e8e01c8f0073a2c974f728fb80e9dce", - "currency": "NZDs" - }, - { - "address": "0xbe9fa3E654A1bf8fe740E9d930D595f31Fce1aE2", - "token": "0x9de41aFF9f55219D5bf4359F167d1D0c772A396D", - "currency": "CADC" - }, - { - "address": "0x7e4a73278d6e578af34faaaba76ed29583ac0341", - "token": "0xe111178a87a3bff0c8d18decba5798827539ae99", - "currency": "EURS" - }, - { - "address": "0x8c6eb8c26f166f87b4f886ce07116a823805602c", - "token": "0xDC3326e71D45186F113a2F448984CA0e8D201995", - "currency": "XSGD" - }, - { - "address": "0x17f8ddcea03a8972559a8d32874e144c87baf5b6", - "token": "0x4fb71290ac171e1d144f7221d882becac7196eb5", - "currency": "TRYb" - }, - { - "address": "0xefac71536feBE220D0Bb5128AeBBD1e3df2a1e67", - "token": "0xeafe31cd9e8e01c8f0073a2c974f728fb80e9dce", - "currency": "NZDs" - } - ] -} diff --git a/projects/dfx/index.js b/projects/dfx/index.js index ce0b926380e..1c7c14db363 100644 --- a/projects/dfx/index.js +++ b/projects/dfx/index.js @@ -1,50 +1,34 @@ -const sdk = require("@defillama/sdk"); -const { transformPolygonAddress } = require("../helper/portedTokens"); -const contracts = require('./contracts.json'); - -// node test.js projects/dfx/index.js -function tvl(chain) { - return async (timestamp, block, chainBlocks) => { - const transform = - chain == "polygon" ? await transformPolygonAddress() : (a) => a; - const balances = {}; - - const [tokenBalances, usdcBalances] = await Promise.all([ - sdk.api.abi.multiCall({ - calls: contracts[chain].map((c) => ({ - target: c.token, - params: [c.address], - })), - abi: "erc20:balanceOf", - block: chainBlocks[chain], - chain, - }), - - sdk.api.abi.multiCall({ - calls: contracts[chain].map((c) => ({ - target: contracts.usdc[chain], - params: [c.address], - })), - abi: "erc20:balanceOf", - block: chainBlocks[chain], - chain, - }), - ]); - - await Promise.all([ - sdk.util.sumMultiBalanceOf(balances, tokenBalances, true, transform), - sdk.util.sumMultiBalanceOf(balances, usdcBalances, true, transform), - ]); - - return balances; - }; -}; +const { getLogs } = require('../helper/cache/getLogs') +const { sumTokens2 } = require('../helper/unwrapLPs') module.exports = { - ethereum: { - tvl: tvl("ethereum"), - }, - polygon: { - tvl: tvl("polygon"), - }, + hallmarks: [[1667955600, "Hack"]], }; + +const config = { + arbitrum: { factory: "0x9544995B5312B26acDf09e66E699c34310b7c856", fromBlock: 65832059 }, + ethereum: { factory: "0x9adeac3b6d29d9d5e543b8579e803a7cce72c9cd", fromBlock: 16607851 }, + polygon: { factory: "0x3591040cE5dF8828b3Ed4Ec39D030F832d43fD53", fromBlock: 39183403 }, +} + +Object.keys(config).forEach(chain => { + const { factory, fromBlock } = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const logs = await getLogs({ + api, + target: factory, + topics: ['0xe7a19de9e8788cc07c144818f2945144acd6234f790b541aa1010371c8b2a73b'], + eventAbi: 'event NewCurve (address indexed caller, bytes32 indexed id, address indexed curve)', + onlyArgs: true, + fromBlock, + }) + let pools = logs.map(log => log.curve) + if (chain === 'arbitrum') pools = pools.slice(1) + const calls = pools.map(pool => [{ target: pool, params: 0 }, { target: pool, params: 1 }]).flat() + const tokens = await api.multiCall({ abi: 'function numeraires(uint256) view returns (address)', calls }) + const tokensAndOwners = tokens.map((token, i) => [token, pools[Math.floor(i / 2)]]) + return sumTokens2({ api, tokensAndOwners, }) + } + } +}) \ No newline at end of file diff --git a/projects/dfyn/index.js b/projects/dfyn/index.js index e6f26845228..55f632af215 100644 --- a/projects/dfyn/index.js +++ b/projects/dfyn/index.js @@ -3,7 +3,6 @@ const { getUniTVL } = require('../helper/unknownTokens') module.exports = { polygon:{ tvl: getUniTVL({ - chain: 'polygon', factory: '0xE7Fb3e833eFE5F9c441105EB65Ef8b261266423B', useDefaultCoreAssets: true, }), @@ -11,14 +10,12 @@ module.exports = { okexchain:{ tvl: getUniTVL({ factory: '0xE7Fb3e833eFE5F9c441105EB65Ef8b261266423B', - chain: 'okexchain', useDefaultCoreAssets: true, }), }, fantom:{ tvl: getUniTVL({ factory: '0xd9820a17053d6314B20642E465a84Bf01a3D64f5', - chain: 'fantom', useDefaultCoreAssets: true, }), }, diff --git a/projects/diamond-unibot-v2/index.js b/projects/diamond-unibot-v2/index.js new file mode 100644 index 00000000000..d4fd33284e8 --- /dev/null +++ b/projects/diamond-unibot-v2/index.js @@ -0,0 +1,79 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { getLogs, getAddress } = require("../helper/cache/getLogs"); +const { sumTokens2 } = require("../helper/unwrapLPs"); +const config = { + arbitrum: { + lendingPools: [ + [ + ADDRESSES.arbitrum.WETH, + "0xedd1efa76fe59e9106067d824b89b59157c5223c", + ], // WETH + [ + ADDRESSES.arbitrum.USDC, + "0xFEaDE428e2Fe0F547d560B540a7617087505538B", + ], // USDC + [ + ADDRESSES.arbitrum.ARB, + "0x4d5043d90f13ac2E6318B3aF9C3423A5224b920C", + ], // ARB + ], + vaults: [ + [ + [ + ADDRESSES.arbitrum.USDC, // USDC + ADDRESSES.arbitrum.GMX, // GMX + ADDRESSES.arbitrum.ARB, // ARB + ], + "0x8610D60f5329B0560c8F0CEb80175F342fe943F3", // vault + ], + ], + fromBlock: 49135720, + }, + polygon: { + lendingPools: [ + [ + ADDRESSES.polygon.WETH_1, + "0x8610D60f5329B0560c8F0CEb80175F342fe943F3", + ], // WETH + [ + ADDRESSES.polygon.WMATIC_2, + "0xEdD1efA76fe59e9106067D824b89B59157C5223C", + ], // WMATIC + ], + vaults: [ + [ + [ + ADDRESSES.polygon.USDC, // USDC + ADDRESSES.polygon.WETH_1, // WETH + ], + "0xD576bE0d3CC1c0184d1ea3F1778A4A9Dec523859", // vault + ], + ], + fromBlock: 49135720, + } +} + +async function tvl(_, _b, _cb, { api }) { + const { vaults, lendingPools, fromBlock, } = config[api.chain] + + const logs = await getLogs({ + api, fromBlock, + target: "0x8a908ec03e2610fa8dcaec93bb010560780ec860", + topics: ["0x647c6c21d1279361153a5cf7618a50b9573a9729986f26d91c8a7e6501750f6f",], + }); + + const pools = logs.map((i) => getAddress(i.topics[1])); + const wantTokens = logs.map((i) => getAddress(i.data)); + + await sumTokens2({ api, owners: pools, resolveUniV3: true }); + const tokensAndOwners = wantTokens.map((i, idx) => [i, pools[idx]]); + tokensAndOwners.push(...lendingPools) + vaults.forEach(([tokens, vault]) => tokens.forEach(i => tokensAndOwners.push([i, vault]))) + return sumTokens2({ api, tokensAndOwners }); +} + +module.exports = { + doublecounted: true, + arbitrum: { tvl }, + polygon: { tvl }, +} diff --git a/projects/diamond/abi.json b/projects/diamond/abi.json index 1ae20357401..20a07648574 100644 --- a/projects/diamond/abi.json +++ b/projects/diamond/abi.json @@ -1,151 +1,7 @@ { - "totalAsset": { - "inputs": [], - "name": "totalAsset", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "totalAssets": { - "inputs": [], - "name": "totalAssets", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getCash": { - "inputs": [], - "name": "getCash", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "balanceOf": { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getPositionInfo": { - "inputs": [ - { - "internalType": "uint256", - "name": "_positionId", - "type": "uint256" - } - ], - "name": "getPositionInfo", - "outputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "positionId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "borrowId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "amount0", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "amount1", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "fee", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "positionValue", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "debtValue", - "type": "uint256" - }, - { - "internalType": "int24", - "name": "upperTick", - "type": "int24" - }, - { - "internalType": "int24", - "name": "lowerTick", - "type": "int24" - }, - { - "internalType": "uint256", - "name": "wantAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "reserveAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "stopLossUpperPrice", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "stopLossLowerPrice", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "positionCreateTimestamp", - "type": "uint256" - } - ], - "internalType": "struct PositionInfo", - "name": "info", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - } -} + "totalAsset": "uint256:totalAsset", + "totalAssets": "uint256:totalAssets", + "getCash": "uint256:getCash", + "balanceOf": "function balanceOf(address account) view returns (uint256)", + "getPositionInfo": "function getPositionInfo(uint256 _positionId) view returns (tuple(uint256 positionId, uint256 borrowId, uint256 amount0, uint256 amount1, uint256 fee, uint256 positionValue, uint256 debtValue, int24 upperTick, int24 lowerTick, uint256 wantAmount, uint256 reserveAmount, uint256 stopLossUpperPrice, uint256 stopLossLowerPrice, uint256 positionCreateTimestamp) info)" +} \ No newline at end of file diff --git a/projects/diamond/index.js b/projects/diamond/index.js index a8ba516d97c..c2fb34ce3d4 100644 --- a/projects/diamond/index.js +++ b/projects/diamond/index.js @@ -1,26 +1,28 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); const { sumTokens2 } = require('../helper/unwrapLPs') const { get } = require('../helper/http') +const { getConfig } = require('../helper/cache') // Ethereum const ETH_BULL_VAULT = "0xad48a8261b0690c71b70115035eb14afd9a43242"; // Optimism const BASIS_TRADING_VAULT = "0xD576bE0d3CC1c0184d1ea3F1778A4A9Dec523859"; -const OPT_USDC = "0x7F5c764cBc14f9669B88837ca1490cCa17c31607"; +const OPT_USDC = ADDRESSES.optimism.USDC; // Arbitrum const DMO_LENDING_POOL = "0x4c51FF6AF2EfC679A08C5A7377Bce18050f86CcB"; const DMO_FACTORY = "0xcd8d2e1fa4132749220ffeec165285ee33028d59"; const DMO_FARM = "0x4a127cB6806E869bf61A6de9db76dabE46A837D3"; const DMO_FARM_ACTION = "0x4Ec4e76c11E2182918a80822df114DB03048388b"; -const ARB_WETH = "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1"; -const ARB_USDC = "0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8"; +const ARB_WETH = ADDRESSES.arbitrum.WETH; +const ARB_USDC = ADDRESSES.arbitrum.USDC; async function ethTvl(_, block) { return { - 'ethereum:0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2': ( + ['ethereum:' + ADDRESSES.ethereum.WETH]: ( await sdk.api.abi.call({ target: ETH_BULL_VAULT, block, @@ -45,7 +47,7 @@ async function optTvl(_, _b,{ optimism: block}) { } async function getOpenPositionIds() { - const response = await get( + const response = await getConfig('diamond/arbi-open-positions', "https://0dtklop9zj.execute-api.ap-northeast-1.amazonaws.com/stag/open_positions?limit=500" ) diff --git a/projects/diffusionfi/index.js b/projects/diffusionfi/index.js index 24c69ab423f..527a62e8884 100644 --- a/projects/diffusionfi/index.js +++ b/projects/diffusionfi/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { getUniTVL } = require('../helper/unknownTokens') const { stakingUnknownPricedLP } = require("../helper/staking"); @@ -7,6 +8,6 @@ module.exports = { "Factory address (0x6abdda34fb225be4610a2d153845e09429523cd2) is used to find the LP pairs. TVL is equal to the liquidity on the AMM.", evmos: { tvl: getUniTVL({ factory: '0x6abdda34fb225be4610a2d153845e09429523cd2', chain: 'evmos', useDefaultCoreAssets: true }), - staking: stakingUnknownPricedLP('0x75aeE82a16BD1fB98b11879af93AB7CE055f66Da', '0x3f75ceabcdfed1aca03257dc6bdc0408e2b4b026', "evmos", "0x5b575e84e4921A93D57301cB75C9635BA12D50e2") + staking: stakingUnknownPricedLP('0x75aeE82a16BD1fB98b11879af93AB7CE055f66Da', ADDRESSES.evmos.DIFF, "evmos", "0x5b575e84e4921A93D57301cB75C9635BA12D50e2") }, }; // node test.js projects/diffusionfi/index.js \ No newline at end of file diff --git a/projects/dinoexchange/index.js b/projects/dinoexchange/index.js index d767b3b9781..e3f567e9045 100644 --- a/projects/dinoexchange/index.js +++ b/projects/dinoexchange/index.js @@ -1,18 +1,13 @@ -const {calculateUniTvl} = require('../helper/calculateUniTvl.js'); +const {uniTvlExport} = require('../helper/calculateUniTvl.js'); const { staking } = require("../helper/staking.js"); const DINO_TOKEN = '0xf317932ee2c30fa5d0e14416775977801734812d' const MASTER_DINO = '0x26CB55795Cff07Df3a1Fa9Ad0f51d6866a80943b' const FACTORY_DINO = "0x35E9455c410EacD6B4Dc1D0ca3144031f6251Dc2"; -async function bscTvl(timestamp, block, chainBlocks) { - var rs = calculateUniTvl(addr=>`bsc:${addr}`, chainBlocks['bsc'], 'bsc', FACTORY_DINO, 0, true); - return rs; -} - module.exports = { bsc:{ - tvl: bscTvl, - staking: staking(MASTER_DINO, DINO_TOKEN, "bsc") + tvl: uniTvlExport(FACTORY_DINO, 'bsc', true), + staking: staking(MASTER_DINO, DINO_TOKEN) }, } \ No newline at end of file diff --git a/projects/dinosaur-finance/index.js b/projects/dinosaur-finance/index.js new file mode 100644 index 00000000000..ee0068e0121 --- /dev/null +++ b/projects/dinosaur-finance/index.js @@ -0,0 +1,31 @@ +const sdk = require('@defillama/sdk') + +const vaults = [ + "0xd93567C2634e907c1AA0D91A6d514dFf0491e0dC", + "0x75b44D326fDfFe3889f9B26d166DF44E938824ce", + "0x1A53a7C19b29df3e94c0559Ea41BDF5A8e9A88DD", +] + +async function tvl(_, _b, _c, { api }) { + const balances = {} + + const tokens = await api.multiCall({ abi: "uint256:balance", calls: vaults, }) + const lps = await api.multiCall({ abi: "address:want", calls: vaults, }) + + tokens.forEach((data, i) => { + sdk.util.sumSingleBalance(balances, lps[i], data, api.chain) + }) + + return balances + +} + +module.exports = { + hallmarks: [ + [1675814400, "Rug Pull"] + ], + arbitrum: { + tvl, + } +} + diff --git a/projects/dinosaureggs/index.js b/projects/dinosaureggs/index.js index 8b57d0a592f..dc33f218955 100644 --- a/projects/dinosaureggs/index.js +++ b/projects/dinosaureggs/index.js @@ -1,11 +1,7 @@ -const {calculateUniTvl} = require("../helper/calculateUniTvl"); +const {uniTvlExport} = require("../helper/calculateUniTvl"); const factory = "0x73d9f93d53505cb8c4c7f952ae42450d9e859d10"; -const bscTvl = async (timestamp, ethBlock, chainBlocks) => { - return calculateUniTvl(addr=>`bsc:${addr}`, chainBlocks.bsc, "bsc", factory, 0, true); -}; - module.exports = { - bsc: { tvl: bscTvl } + bsc: { tvl: uniTvlExport(factory, 'bsc', true) } }; diff --git a/projects/dinoswap/abi.json b/projects/dinoswap/abi.json index 5b8b9064dc4..dd346a161be 100644 --- a/projects/dinoswap/abi.json +++ b/projects/dinoswap/abi.json @@ -1,49 +1,4 @@ { - "poolInfo": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "poolInfo", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "lpToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "allocPoint", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastRewardBlock", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accDinoPerShare", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "poolLength": { - "inputs": [], - "name": "poolLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -} + "poolInfo": "function poolInfo(uint256) view returns (address lpToken, uint256 allocPoint, uint256 lastRewardBlock, uint256 accDinoPerShare)", + "poolLength": "uint256:poolLength" +} \ No newline at end of file diff --git a/projects/dinoswap/index.js b/projects/dinoswap/index.js index 504283ec068..49852da56e0 100644 --- a/projects/dinoswap/index.js +++ b/projects/dinoswap/index.js @@ -1,8 +1,9 @@ +const ADDRESSES = require('../helper/coreAssets.json') const abi = require("./abi.json"); const {masterChefExports} = require('../helper/masterchef'); const MASTERCHEF_CONTRACT = "0x1948abC5400Aa1d72223882958Da3bec643fb4E5"; -const token = "0xAa9654BECca45B5BDFA5ac646c939C62b527D394"; +const token = ADDRESSES.polygon.DINO; module.exports = { misrepresentedTokens: true, diff --git a/projects/dinotopia/abi.json b/projects/dinotopia/abi.json new file mode 100644 index 00000000000..fa91e9331c0 --- /dev/null +++ b/projects/dinotopia/abi.json @@ -0,0 +1,8 @@ +{ + "bank": { + "usableBnbBalance": "uint256:usableCollateralBalance" + }, + "multiFeeDistribution": { + "totalSupply": "uint256:totalSupply" + } +} \ No newline at end of file diff --git a/projects/dinotopia/index.js b/projects/dinotopia/index.js new file mode 100644 index 00000000000..af8b7150c90 --- /dev/null +++ b/projects/dinotopia/index.js @@ -0,0 +1,32 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const Abis = require("./abi.json"); +const { sumTokensExport, sumUnknownTokens, } = require('../helper/unknownTokens') + +const Contracts = { + bsc: { + wbnb: ADDRESSES.bsc.WBNB, + brx: "0xe550c560a895d043E5EEd2bC7eC8A8e46c2408D6", + fossil: "0xfE8FFB60a2B6d46102caa35739Be465E600D0f5E", + bank: "0xF90c0b409001b97067c539693754008456f6C265", + multiFeeDistribution: "0xd1f2467b2E2cb7bABc5CE8a947A294f216D93F90", + chef: "0xF59e1568cb5FA1cdf1f4233D738D802A90c64B5E", + lps: [ + "0x9bB50fE7E33C15405f94978A5bb88F8544847007", // FOSSIL_BNB_LP + "0x5Ff686208DFe12D35761fe9C74396852303BC377", // BRX_BNB_LP + ], + }, +}; + +async function calcBscStakingTvl(timestamp, ethBlock, chainBlocks, {api}) { + const bscStakingData = await api.call({ target: Contracts.bsc.multiFeeDistribution, abi: Abis.multiFeeDistribution.totalSupply, }); + api.add(Contracts.bsc.fossil, bscStakingData) + return sumUnknownTokens({ api, useDefaultCoreAssets: true, lps: Contracts.bsc.lps, }) +} + +module.exports = { + bsc: { + tvl: sumTokensExport({ owner: Contracts.bsc.bank, tokens: [Contracts.bsc.wbnb] }), + pool2: sumTokensExport({ owner: Contracts.bsc.chef, tokens: Contracts.bsc.lps, useDefaultCoreAssets: true, }), + staking: calcBscStakingTvl, + }, +}; \ No newline at end of file diff --git a/projects/diosfinance/index.js b/projects/diosfinance/index.js index 60ee93cfd4a..77b30053dd3 100644 --- a/projects/diosfinance/index.js +++ b/projects/diosfinance/index.js @@ -1,10 +1,11 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { ohmTvl } = require("../helper/ohm"); const dios = "0x08eEcF5d03bDA3dF2467F6AF46b160c24D931DE7"; const diosStaking = "0x36c8a6E7436EDd850752E09539a519a369D95096"; const treasury = "0x98eE3F3629aCFA6fDDB49028C494030E5dFA349a"; -const busd = "0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56"; +const busd = ADDRESSES.bsc.BUSD; const diosBusdLP = "0x2D7A5e9d85F62ADbaea9d48B11F5947F3AC57FC8"; module.exports = { diff --git a/projects/direct-exchange/index.js b/projects/direct-exchange/index.js new file mode 100644 index 00000000000..f0ee9967356 --- /dev/null +++ b/projects/direct-exchange/index.js @@ -0,0 +1,7 @@ +const { getUniTVL } = require('../helper/unknownTokens') +module.exports = { + misrepresentedTokens: true, + kava: { + tvl: getUniTVL({ factory: '0xcE08c3d20Ff00a9Cf0D28922768bD606592B5D4C', fetchBalances: true, useDefaultCoreAssets: true, }) + }, +} diff --git a/projects/djed-alliance/abi.json b/projects/djed-alliance/abi.json new file mode 100644 index 00000000000..cd51a2c3c94 --- /dev/null +++ b/projects/djed-alliance/abi.json @@ -0,0 +1,5 @@ +{ + "Djed": { + "reserve": "function R(uint256 cpa) view returns (uint256 balance)" + } +} \ No newline at end of file diff --git a/projects/djed-alliance/config.json b/projects/djed-alliance/config.json new file mode 100644 index 00000000000..a3a6b9ecdc2 --- /dev/null +++ b/projects/djed-alliance/config.json @@ -0,0 +1,10 @@ +{ + "djedAddress": { + "milkomeda": "0x67A30B399F5Ed499C1a6Bc0358FA6e42Ea4BCe76", + "milkomeda_a1": "0x..." + }, + "reserveTokenAddress": { + "milkomeda": "0xAE83571000aF4499798d1e3b0fA0070EB3A3E3F9", + "milkomeda_a1": "0x..." + } +} \ No newline at end of file diff --git a/projects/djed-alliance/index.js b/projects/djed-alliance/index.js new file mode 100644 index 00000000000..523cd3d1fb1 --- /dev/null +++ b/projects/djed-alliance/index.js @@ -0,0 +1,37 @@ +const sdk = require('@defillama/sdk'); +const utils = require('../helper/utils'); +const { sumTokensExport } = require("../helper/chain/cardano"); +const { transformBalances } = require('../helper/portedTokens'); + +const abi = require('./abi.json'); +const config = require("./config.json"); + +async function tvl(chain, chainBlocks) { + const balances = {}; + + const reserve = (await sdk.api.abi.call({ + abi: abi.Djed.reserve, chain: chain, target: config.djedAddress[chain], params: [ 0 ], block: chainBlocks[chain], + })).output; + + sdk.util.sumSingleBalance(balances, config.reserveTokenAddress[chain], reserve); // Using WADA address instead of mADA + return transformBalances(chain, balances); +} + +async function ergotvl() { + const {data: { confirmed }} = await utils.fetchURL('https://api.ergoplatform.com/api/v1/addresses/MUbV38YgqHy7XbsoXWF5z7EZm524Ybdwe5p9WDrbhruZRtehkRPT92imXer2eTkjwPDfboa1pR3zb3deVKVq3H7Xt98qcTqLuSBSbHb7izzo5jphEpcnqyKJ2xhmpNPVvmtbdJNdvdopPrHHDBbAGGeW7XYTQwEeoRfosXzcDtiGgw97b2aqjTsNFmZk7khBEQywjYfmoDc9nUCJMZ3vbSspnYo3LarLe55mh2Np8MNJqUN9APA6XkhZCrTTDRZb1B4krgFY1sVMswg2ceqguZRvC9pqt3tUUxmSnB24N6dowfVJKhLXwHPbrkHViBv1AKAJTmEaQW2DN1fRmD9ypXxZk8GXmYtxTtrj3BiunQ4qzUCu1eGzxSREjpkFSi2ATLSSDqUwxtRz639sHM6Lav4axoJNPCHbY8pvuBKUxgnGRex8LEGM8DeEJwaJCaoy8dBw9Lz49nq5mSsXLeoC4xpTUmp47Bh7GAZtwkaNreCu74m9rcZ8Di4w1cmdsiK1NWuDh9pJ2Bv7u3EfcurHFVqCkT3P86JUbKnXeNxCypfrWsFuYNKYqmjsix82g9vWcGMmAcu5nagxD4iET86iE2tMMfZZ5vqZNvntQswJyQqv2Wc6MTh4jQx1q2qJZCQe4QdEK63meTGbZNNKMctHQbp3gRkZYNrBtxQyVtNLR8xEY8zGp85GeQKbb37vqLXxRpGiigAdMe3XZA4hhYPmAAU5hpSMYaRAjtvvMT3bNiHRACGrfjvSsEG9G2zY5in2YWz5X9zXQLGTYRsQ4uNFkYoQRCBdjNxGv6R58Xq74zCgt19TxYZ87gPWxkXpWwTaHogG1eps8WXt8QzwJ9rVx6Vu9a5GjtcGsQxHovWmYixgBU8X9fPNJ9UQhYyAWbjtRSuVBtDAmoV1gCBEPwnYVP5GCGhCocbwoYhZkZjFZy6ws4uxVLid3FxuvhWvQrVEDYp7WRvGXbNdCbcSXnbeTrPMey1WPaXX/balance/total'); + return { ergo: confirmed.nanoErgs / 1e9 }; +} + +module.exports = { + methodology: 'The TVL of each Djed deployment is the reserve belonging to the deployment. The TVL within a given blockchain is the sum of the TVLs of all known Djed deployments within that blockchain. The total TVL is the sum of the Djed TVLs on all blockchains.', + /*ergo:{ //has its own listing under sigmaUSD + tvl: ergotvl + },*/ + cardano: { + tvl: sumTokensExport({ owner: 'addr1z9s3v9vyyctzr4xagvrayw87yvzre6qcq7qw2uvqfznf92qm5kjdmrpmng059yellupyvwgay2v0lz6663swmds7hp0q2jjlf4', tokens: ['lovelace']}), + }, + /*milkomeda: { + start: 10440400, + tvl: (timestamp, block, chainBlocks) => tvl('milkomeda', chainBlocks) + },*/ +}; diff --git a/projects/dmmexchange/abi.json b/projects/dmmexchange/abi.json deleted file mode 100644 index 8606c1c2c5f..00000000000 --- a/projects/dmmexchange/abi.json +++ /dev/null @@ -1,78 +0,0 @@ -{ - "allPools": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "allPools", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "allPoolsLength": { - "inputs": [], - "name": "allPoolsLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "token0": { - "inputs": [], - "name": "token0", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "token1": { - "inputs": [], - "name": "token1", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getReserves": { - "inputs": [], - "name": "getReserves", - "outputs": [ - { - "internalType": "uint112", - "name": "_reserve0", - "type": "uint112" - }, - { - "internalType": "uint112", - "name": "_reserve1", - "type": "uint112" - } - ], - "stateMutability": "view", - "type": "function" - } -} \ No newline at end of file diff --git a/projects/dmmexchange/index.js b/projects/dmmexchange/index.js deleted file mode 100644 index 18776a21c81..00000000000 --- a/projects/dmmexchange/index.js +++ /dev/null @@ -1,69 +0,0 @@ -const sdk = require("@defillama/sdk"); -const abi = require("./abi.json"); - -const factory = "0x833e4083B7ae46CeA85695c4f7ed25CDAd8886dE"; - -const ethTvl = async (timestamp, ethBlock, chainBlocks) => { - const balances = {}; - - const poolLength = Number( - ( - await sdk.api.abi.call({ - target: factory, - abi: abi.allPoolsLength, - block: ethBlock, - }) - ).output - ); - - const allPoolNums = Array.from(Array(poolLength).keys()); - - const poolAddresses = ( - await sdk.api.abi.multiCall({ - abi: abi.allPools, - calls: allPoolNums.map((num) => ({ - target: factory, - params: [num], - })), - block: ethBlock, - }) - ).output.map((el) => el.output); - - for (let i = 0; i < poolAddresses.length; i++) { - const token0 = ( - await sdk.api.abi.call({ - target: poolAddresses[i], - abi: abi.token0, - block: ethBlock, - }) - ).output; - - const token1 = ( - await sdk.api.abi.call({ - target: poolAddresses[i], - abi: abi.token1, - block: ethBlock, - }) - ).output; - - const getReserves = ( - await sdk.api.abi.call({ - target: poolAddresses[i], - abi: abi.getReserves, - block: ethBlock, - }) - ).output; - - sdk.util.sumSingleBalance(balances, token0, getReserves[0]); - - sdk.util.sumSingleBalance(balances, token1, getReserves[1]); - } - - return balances; -}; - -module.exports = { - ethereum: { - tvl: ethTvl, - }, -}; diff --git a/projects/dmusk/index.js b/projects/dmusk/index.js index 8fe45804c52..9ba6b50815b 100644 --- a/projects/dmusk/index.js +++ b/projects/dmusk/index.js @@ -9,7 +9,6 @@ module.exports = { misrepresentedTokens: true, dogechain: { tvl: getUniTVL({ - chain, factory: '0x4e5E0739231A3BdE1c51188aCfEabC19983541E6', useDefaultCoreAssets: true, }) diff --git a/projects/dnadollar/abi.json b/projects/dnadollar/abi.json index e1044c32ee1..6e0f5ce4808 100644 --- a/projects/dnadollar/abi.json +++ b/projects/dnadollar/abi.json @@ -1,41 +1,3 @@ { - "poolInfo": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "poolInfo", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "allocPoint", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastRewardTime", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accDSharePerShare", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "isStarted", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - } + "poolInfo": "function poolInfo(uint256) view returns (address token, uint256 allocPoint, uint256 lastRewardTime, uint256 accDSharePerShare, bool isStarted)" } \ No newline at end of file diff --git a/projects/dnadollar/index.js b/projects/dnadollar/index.js index f9f467c639d..7e31143336c 100644 --- a/projects/dnadollar/index.js +++ b/projects/dnadollar/index.js @@ -1,14 +1,14 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); -const { staking } = require("../helper/staking"); const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); const treasuryContract = "0x1420287565FD5Ebec8FbD720c17Cd911600449d3"; const FundDAO = "0x3e1Aa19FA59c9B474f6d2F37976a84DeD64af4Bf"; -const USDT = "0x66e428c3f67a68878562e79a0234c1f83c208770"; -const USDC = "0xc21223249ca28397b4b6541dffaecc539bff0c59"; +const USDT = ADDRESSES.cronos.USDT; +const USDC = ADDRESSES.cronos.USDC; const USDC_DSHARE_meerkatLP = "0xFe0F0d50175789C1F69B41dB797cc9ABd8Ab0120"; const DShareRewardPool = "0x1A4bb8E03C35e2B672A0fcE18cab920aa023d7FC"; @@ -103,7 +103,6 @@ async function cronosTvl(timestamp, chainBlocks) { module.exports = { misrepresentedTokens: true, cronos: { - treasury: staking(treasuryContract, DNA, "cronos"), staking: Staking, pool2: pool2, tvl: cronosTvl, diff --git a/projects/dodo/index.js b/projects/dodo/index.js index 6665afc1874..a5652b9d099 100644 --- a/projects/dodo/index.js +++ b/projects/dodo/index.js @@ -1,5 +1,5 @@ const { request, gql } = require("graphql-request"); -const { getBlock } = require('../helper/getBlock') +const { getBlock } = require('../helper/http') const sdk = require('@defillama/sdk') const graphEndpoints = { @@ -64,6 +64,8 @@ Object.keys(graphEndpoints).forEach(chain => { '0x738076a6cb6c30d906bcb2e9ba0e0d9a58b3292e', // SRSB is absuredly priced '0x95e7c70b58790a1cbd377bc403cd7e9be7e0afb1', // YSL is absuredly priced '0x2b1e9ded77ff8ecd81f71ffc5751622e6f1291c3', // error querying balance + '0x272c2CF847A49215A3A1D4bFf8760E503A06f880', // abnb LP mispriced + '0xd4ca5c2aff1eefb0bea9e9eab16f88db2990c183', // XRPC ].map(i => i.toLowerCase()) allPairs.forEach(pair => { diff --git a/projects/dogecompounder/index.js b/projects/dogecompounder/index.js index 3fc5a313337..101e2edad40 100644 --- a/projects/dogecompounder/index.js +++ b/projects/dogecompounder/index.js @@ -1,29 +1,17 @@ const { yieldHelper } = require("../helper/unknownTokens"); -const { get } = require('../helper/http') +const { getConfig } = require('../helper/cache') const chain = "dogechain"; -const tokenAPI = { - "type": "function", - "stateMutability": "view", - "outputs": [ - { - "type": "address", - "name": "", - "internalType": "contract IERC20" - } - ], - "name": "want", - "inputs": [] -} +const tokenAPI = "address:want" module.exports = { [chain]: { tvl: async (_, _b, { [chain]: block }) => { - const pools = await get('https://raw.githubusercontent.com/DogeCompounder/DogeCompounderApi/main/doge_vaults.json'); + const pools = await getConfig('dogecompounder-dogechain', 'https://raw.githubusercontent.com/DogeCompounder/DogeCompounderApi/main/doge_vaults.json'); const vaults = []; - for(var i = 0; i < pools.length; i++){ + for(var i = 0; i < pools.length; i++) vaults.push(pools[i].earnedTokenAddress); - } + return yieldHelper({ vaults, chain, block, tokenAPI, useDefaultCoreAssets: true, }) } } diff --git a/projects/dogedollar/index.js b/projects/dogedollar/index.js new file mode 100644 index 00000000000..2cebc693c7e --- /dev/null +++ b/projects/dogedollar/index.js @@ -0,0 +1,15 @@ +const { sumTokensExport, nullAddress, } = require("../helper/unwrapLPs"); + +const DJED_ADDR = '0xA99ef299CdA10AC4Ec974370778fbd27Cfb5CF61' + +module.exports = { + methodology: 'finds the DOGE balance of the DJED instance backing the stablecoin, aswell as the fallback stablecoin balance', + start: 14576300, + dogechain: { + tvl: sumTokensExport({ + tokensAndOwners: [ + [nullAddress, DJED_ADDR], + ] + }), + } +}; diff --git a/projects/dogeswap-org/api.js b/projects/dogeswap-org/api.js new file mode 100644 index 00000000000..7e8c86b9c81 --- /dev/null +++ b/projects/dogeswap-org/api.js @@ -0,0 +1,8 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports = { + misrepresentedTokens: true, + dogechain: { + tvl: getUniTVL({ factory: '0xD27D9d61590874Bf9ee2a19b27E265399929C9C3', useDefaultCoreAssets: true, queryBatched: 700 }) + } +} \ No newline at end of file diff --git a/projects/dogeswap-org/index.js b/projects/dogeswap-org/index.js index cd759fa9c9a..ab6454761cd 100644 --- a/projects/dogeswap-org/index.js +++ b/projects/dogeswap-org/index.js @@ -1,13 +1,7 @@ -const { getUniTVL } = require('../helper/unknownTokens') +const { getExports } = require('../helper/heroku-api') module.exports = { + timetravel: false, misrepresentedTokens: true, - dogechain: { - tvl: getUniTVL({ - chain: 'dogechain', - useDefaultCoreAssets: true, - factory: '0xD27D9d61590874Bf9ee2a19b27E265399929C9C3', - fetchInChunks: 500, - }) - } + ...getExports("dogeswap-org", ['dogechain']), } diff --git a/projects/dogewhale/index.js b/projects/dogewhale/index.js new file mode 100644 index 00000000000..35993ad8eb7 --- /dev/null +++ b/projects/dogewhale/index.js @@ -0,0 +1,14 @@ +const DW_TOKEN_CONTRACT = '0x43adc41cf63666ebb1938b11256f0ea3f16e6932'; +const DOGE = '0xbA2aE424d960c26247Dd6c32edC70B295c744C43'; +const SHIB = '0x2859e4544C4bB03966803b044A93563Bd2D0DD4D'; +const FLOKI = '0xfb5B838b6cfEEdC2873aB27866079AC55363D37E'; +const { sumTokensExport } = require("../helper/unwrapLPs"); + +module.exports = { + bsc: { + tvl: sumTokensExport({ + owner: DW_TOKEN_CONTRACT, + tokens: [DOGE, SHIB, FLOKI] + }), + } +}; \ No newline at end of file diff --git a/projects/doglands-swap/index.js b/projects/doglands-swap/index.js new file mode 100644 index 00000000000..3882cc3fe95 --- /dev/null +++ b/projects/doglands-swap/index.js @@ -0,0 +1,11 @@ + +module.exports = { + methodology: "Count TVL as liquidity on the dex", + misrepresentedTokens: true, + dogechain: { + tvl: () => 0 + }, + hallmarks: [ + [Math.floor(new Date('2023-01-20')/1e3), 'Project rugged'], + ], +} \ No newline at end of file diff --git a/projects/dogmoney/index.js b/projects/dogmoney/index.js index c973d58bbf4..77455c0901b 100644 --- a/projects/dogmoney/index.js +++ b/projects/dogmoney/index.js @@ -8,10 +8,9 @@ module.exports = { misrepresentedTokens: true, dogechain: { tvl: getUniTVL({ - chain: 'dogechain', useDefaultCoreAssets: true, factory: FACTORY, }), - staking: staking({ owner: xDOGMONEY, tokens: [ DOGMONEY ], chain: 'dogechain', lps: ['0x9ab710cd0bfbee60e14115d19c76213c4d4b1687'], useDefaultCoreAssets: true, }) + staking: staking({ owner: xDOGMONEY, tokens: [ DOGMONEY ], lps: ['0x9ab710cd0bfbee60e14115d19c76213c4d4b1687'], useDefaultCoreAssets: true, }) } } \ No newline at end of file diff --git a/projects/dokidoki/index.js b/projects/dokidoki/index.js index 128207d446d..e851b81d454 100644 --- a/projects/dokidoki/index.js +++ b/projects/dokidoki/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const { unwrapUniswapLPs, sumTokens2 } = require("../helper/unwrapLPs"); @@ -42,11 +43,11 @@ const ethPool2LPs = [ const ethPools = [ { pool: "0xb3a2AF499aF8f717BB3431968f8e0b038C975686", - token: "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", + token: ADDRESSES.ethereum.WBTC, }, // WBTC { pool: "0xde846827cE3022EcD5eFD6ed316a2dEf9AB299B8", - token: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + token: ADDRESSES.ethereum.WETH, }, // WETH ]; diff --git a/projects/dolomite/dolomite-margin.json b/projects/dolomite/dolomite-margin.json index a7eb0a54d25..18891d2dfbb 100644 --- a/projects/dolomite/dolomite-margin.json +++ b/projects/dolomite/dolomite-margin.json @@ -1,66 +1,9 @@ { - "getNumMarkets": { - "constant": true, - "inputs": [], - "name": "getNumMarkets", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "getMarketTokenAddress": { - "constant": true, - "inputs": [ - { - "internalType": "uint256", - "name": "marketId", - "type": "uint256" - } - ], - "name": "getMarketTokenAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "getMarketPrice": { - "constant": true, - "inputs": [ - { - "internalType": "uint256", - "name": "marketId", - "type": "uint256" - } - ], - "name": "getMarketPrice", - "outputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "internalType": "struct Monetary.Price", - "name": "", - "type": "tuple" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } + "getNumMarkets": "uint256:getNumMarkets", + "getMarketTokenAddress": "function getMarketTokenAddress(uint256 marketId) view returns (address)", + "getMarketPrice": "function getMarketPrice(uint256 marketId) view returns (tuple(uint256 value))", + "getMarketTotalPar": "function getMarketTotalPar(uint256 marketId) view returns (tuple(uint128 borrow, uint128 supply))", + "getMarketCurrentIndex": "function getMarketCurrentIndex(uint256 marketId) view returns (tuple(uint96 borrow, uint96 supply, uint32 lastUpdate))", + "getName": "function name() view returns (string)", + "getUnderlying": "function UNDERLYING_TOKEN() view returns (address)" } diff --git a/projects/dolomite/index.js b/projects/dolomite/index.js index 719f5268d28..abc38744043 100644 --- a/projects/dolomite/index.js +++ b/projects/dolomite/index.js @@ -1,54 +1,39 @@ -const sdk = require('@defillama/sdk'); -const { sumTokens2 } = require('../helper/unwrapLPs') -const { getNumMarkets, getMarketTokenAddress } = require('./dolomite-margin.json'); - -const dolomiteMargin = '0x6bd780e7fdf01d77e4d475c821f1e7ae05409072'; - -const contracts = [dolomiteMargin]; - -async function getTokens(chain, block) { - const { output: tokenCount } = await sdk.api.abi.call({ - target: contracts[0], - abi: getNumMarkets, - chain: chain, - block: block, - params: [], - }); - - const tokenCalls = [] - for (let i = 0; i < Number(tokenCount); i++) { - tokenCalls.push({ - target: dolomiteMargin, - params: [i], - }); +const { + getNumMarkets, + getMarketTokenAddress, + getMarketTotalPar, +} = require("./dolomite-margin.json"); + +const dolomiteMargin = "0x6bd780e7fdf01d77e4d475c821f1e7ae05409072"; + +async function getTokensAndBalances(api, supplyOrBorrow) { + const tokens = await api.fetchList({ lengthAbi: getNumMarkets, itemAbi: getMarketTokenAddress, target: dolomiteMargin }) + const underlyingTokens = await api.multiCall({ abi: 'address:UNDERLYING_TOKEN', calls: tokens, permitFailure: true, }) + let bals + if (supplyOrBorrow === 'supply') { + bals = await api.multiCall({ abi: 'erc20:balanceOf', calls: tokens.map(i => ({ target: i, params: dolomiteMargin })), }) + + } else { + const res = await api.fetchList({ lengthAbi: getNumMarkets, itemAbi: getMarketTotalPar, target: dolomiteMargin }) + bals = res.map(i => i.borrow) } - - const { output: tokensResult } = await sdk.api.abi.multiCall({ - chain, - block, - abi: getMarketTokenAddress, - calls: tokenCalls, + tokens.forEach((v, i) => { + api.add(underlyingTokens[i] ?? v, bals[i]) }) - - return tokensResult.map(tokenResult => tokenResult.output) } -async function tvl (timestamp, ethereumBlock, blocksToKeys) { - const chain = 'arbitrum'; - const block = blocksToKeys[chain] - - const tokens = await getTokens(chain, block); +async function tvl(timestamp, ethereumBlock, blocksToKeys, { api }) { + return getTokensAndBalances(api, "supply"); +} - return sumTokens2({ - tokens, - chain, - block, - owner: dolomiteMargin, - }) +async function borrowed(timestamp, ethereumBlock, blocksToKeys, { api }) { + return getTokensAndBalances(api, "borrow"); } module.exports = { start: 1664856000, // 10/4/2022 @ 00:00am (UTC) - arbitrum: { tvl }, - hallmarks:[] + arbitrum: { + tvl, + borrowed + }, }; diff --git a/projects/domfi/abi.js b/projects/domfi/abi.js index b3ad652595c..c881560bead 100644 --- a/projects/domfi/abi.js +++ b/projects/domfi/abi.js @@ -1,47 +1,7 @@ -const address = { - "internalType": "address", - "name": "", - "type": "address" -}; - -const erc20Address = { - "internalType": "contract IERC20", - "name": "", - "type": "address" -}; - module.exports = { - "LongShortPair.collateralToken": { - "type": "function", - "name": "collateralToken", - "stateMutability": "view", - "inputs": [], - "outputs": [erc20Address], - }, - - "LongShortPair.longToken": { - "type": "function", - "name": "longToken", - "stateMutability": "view", - "inputs": [], - "outputs": [erc20Address], - }, - - "LongShortPair.shortToken": { - "type": "function", - "name": "shortToken", - "stateMutability": "view", - "inputs": [], - "outputs": [erc20Address], - }, - - "UniswapFactory.getPair": { - "type": "function", - "name": "getPair", - "constant": true, - "stateMutability": "view", - "inputs": [address, address], - "outputs": [address], - } -}; \ No newline at end of file + "LongShortPair.collateralToken": "address:collateralToken", + "LongShortPair.longToken": "address:longToken", + "LongShortPair.shortToken": "address:shortToken", + "UniswapFactory.getPair": "function getPair(address, address) view returns (address)", +} \ No newline at end of file diff --git a/projects/domfi/registry.js b/projects/domfi/registry.js index 290a7da0b17..7ad610ecfeb 100644 --- a/projects/domfi/registry.js +++ b/projects/domfi/registry.js @@ -1,5 +1,6 @@ +const ADDRESSES = require('../helper/coreAssets.json') -const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000"; +const ZERO_ADDRESS = ADDRESSES.null; const Chain = { ETHEREUM: 'ethereum', @@ -8,9 +9,9 @@ const Chain = { } const usdc = { - [Chain.ETHEREUM]: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", - [Chain.POLYGON]: "0x2791bca1f2de4661ed88a30c99a7a9449aa84174", - [Chain.BOBA]: "0x66a2A913e447d6b4BF33EFbec43aAeF87890FBbc", + [Chain.ETHEREUM]: ADDRESSES.ethereum.USDC, + [Chain.POLYGON]: ADDRESSES.polygon.USDC, + [Chain.BOBA]: ADDRESSES.boba.USDC, } const lsps = { diff --git a/projects/donkey/abi.json b/projects/donkey/abi.json index bf98e1aa8de..019dd6deccb 100644 --- a/projects/donkey/abi.json +++ b/projects/donkey/abi.json @@ -1,30 +1,4 @@ { - "underlying": { - "constant": true, - "inputs": [], - "name": "underlying", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "getAllMarkets": { - "constant": true, - "inputs": [], - "name": "getAllMarkets", - "outputs": [ - { - "name": "", - "type": "address[]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } + "underlying": "address:underlying", + "getAllMarkets": "address[]:getAllMarkets" } \ No newline at end of file diff --git a/projects/donkey/index.js b/projects/donkey/index.js index 6fd59746ace..16110fd4f77 100644 --- a/projects/donkey/index.js +++ b/projects/donkey/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk'); const { getChainTransform } = require('../helper/portedTokens') const abi = require('./abi.json') @@ -21,7 +22,7 @@ const stakings = [ ] const DONKEY_TOKEN = '0x4576E6825B462b6916D2a41E187626E9090A92c6' -const ETH = "0x0000000000000000000000000000000000000000"; +const ETH = ADDRESSES.null; async function staking(timestamp, block) { const balances = {} diff --git a/projects/dooar/index.js b/projects/dooar/index.js index 2f689e51b67..d2837739a8f 100644 --- a/projects/dooar/index.js +++ b/projects/dooar/index.js @@ -6,7 +6,6 @@ module.exports = { bsc: { tvl: getUniTVL({ factory: '0x1e895bFe59E3A5103e8B7dA3897d1F2391476f3c', - chain: 'bsc', useDefaultCoreAssets: true }) }, diff --git a/projects/doorainu/index.js b/projects/doorainu/index.js new file mode 100644 index 00000000000..917e1f800ba --- /dev/null +++ b/projects/doorainu/index.js @@ -0,0 +1,8 @@ +const { masterchefExports } = require('../helper/unknownTokens') + +module.exports = masterchefExports({ + chain: 'arbitrum', + useDefaultCoreAssets: true, + masterchef: '0xc98d9f2AD12D9813e1f76139b7ba7b84a1d2a878', + nativeToken: '0xb7ffA0D35597d2e166384fc88Ed746a4c74be001', +}) diff --git a/projects/dopex/abi.json b/projects/dopex/abi.json index a006fc58672..e7350069fa7 100644 --- a/projects/dopex/abi.json +++ b/projects/dopex/abi.json @@ -1,66 +1,6 @@ { - "currentEpoch": { - "inputs": [], - "name": "currentEpoch", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "totalEpochDeposits": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "totalEpochDeposits", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getLpPrice": { - "inputs": [], - "name": "getLpPrice", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "vbnbToBnb": { - "inputs": [ - { - "internalType": "uint256", - "name": "vbnbAmount", - "type": "uint256" - } - ], - "name": "vbnbToBnb", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } + "currentEpoch": "uint256:currentEpoch", + "totalEpochDeposits": "function totalEpochDeposits(uint256) view returns (uint256)", + "getLpPrice": "uint256:getLpPrice", + "vbnbToBnb": "function vbnbToBnb(uint256 vbnbAmount) view returns (uint256)" } \ No newline at end of file diff --git a/projects/dopex/index.js b/projects/dopex/index.js index 83ce03f5e1e..4a8c4550cac 100644 --- a/projects/dopex/index.js +++ b/projects/dopex/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); const { staking } = require("../helper/staking"); @@ -37,9 +38,9 @@ const slpStakingRewards = [ const ssovs = [ ["0xbB741dC1A519995eac67Ec1f2bfEecbe5C02f46e", "0x6C2C06790b3E3E3c38e12Ee22F8183b37a13EE55"], ["0x6A1142681b74fbeA5dEA07258f573484D80e4435", "0x32eb7902d4134bf98a28b963d26de779af92a212"], - ["0x2c9C1E9b4BDf6Bf9CB59C77e0e8C0892cE3A9d5f", "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1"], + ["0x2c9C1E9b4BDf6Bf9CB59C77e0e8C0892cE3A9d5f", ADDRESSES.arbitrum.WETH], ["0x54552CB564F4675bCEda644e47dE3E35D1c88E1b", "0x8D9bA570D6cb60C7e3e0F31343Efe75AB8E65FB1"], - ["0x5bE3c77ED3Cd42fc2c702C9fcd665f515862B0AE", "0xfc5A1A6EB076a2C7aD06eD22C90d7E710E35ad0a"], + ["0x5bE3c77ED3Cd42fc2c702C9fcd665f515862B0AE", ADDRESSES.arbitrum.GMX], ]; const crvPools = [ @@ -111,7 +112,7 @@ async function crvTvls(balances, crvPools, block, chain) { for (let i = 0; i < crvPools.length; i++) { const balance = BigNumber(Number(lpPrices) / 1e18).times(Number(totalEpochDeposits[i].output)).div(1e12).toFixed(0); - sdk.util.sumSingleBalance(balances, "0xdac17f958d2ee523a2206206994597c13d831ec7", balance); + sdk.util.sumSingleBalance(balances, ADDRESSES.ethereum.USDT, balance); } } @@ -141,7 +142,7 @@ async function bscTvl(timestamp, block, chainBlocks) { chain: "bsc" })).output; - sdk.util.sumSingleBalance(balances, "bsc:0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c", bnbAmount); + sdk.util.sumSingleBalance(balances, "bsc:" + ADDRESSES.bsc.WBNB, bnbAmount); delete balances["bsc:0xa07c5b74c9b40447a954e1466938b865b6bbea36"]; return balances; @@ -149,7 +150,7 @@ async function bscTvl(timestamp, block, chainBlocks) { // AVAX Addresses const avaxSsovs = [ - ["0x5540FEa353dF6302611DA1d57988104e43A4B6b6", "0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7"] + ["0x5540FEa353dF6302611DA1d57988104e43A4B6b6", ADDRESSES.avax.WAVAX] ]; async function avaxTvl(timestamp, block, chainBlocks) { diff --git a/projects/dopplefinance/index.js b/projects/dopplefinance/index.js index fa28e18510a..2338cf6a446 100644 --- a/projects/dopplefinance/index.js +++ b/projects/dopplefinance/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens2 } = require('../helper/unwrapLPs') const assetsOnExchange = { @@ -5,35 +6,35 @@ const assetsOnExchange = { // * KUSD '0x940Ff63e82d15fb47371BFE5a4ed7D7D183dE1A5', // * BUSD - "0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56", + ADDRESSES.bsc.BUSD, // * USDT - "0x55d398326f99059fF775485246999027B3197955", + ADDRESSES.bsc.USDT, // * USDC - "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d", + ADDRESSES.bsc.USDC, // * DAI "0x1AF3F329e8BE154074D8769D1FFa4eE058B1DBc3", // * UST "0x23396cF899Ca06c4472205fC903bDB4de249D6fC", // * BTCB - "0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c", + ADDRESSES.bsc.BTCB, // * renBTC '0xfCe146bF3146100cfe5dB4129cf6C82b0eF4Ad8c', // * USDN '0x03ab98f5dc94996F8C33E15cD4468794d12d41f9', // * TUSD - '0x14016E85a25aeb13065688cAFB43044C2ef86784', + ADDRESSES.bsc.BTUSD, // * DOLLY "0xfF54da7CAF3BC3D34664891fC8f3c9B6DeA6c7A5" ], fantom: [ // * USDC - '0x04068da6c83afcfa0e13ba15a6696662335d5b75', + ADDRESSES.fantom.USDC, // * fUSDT - '0x049d68029688eabf473097a2fc38ef61633a3c7a', + ADDRESSES.fantom.fUSDT, // * DAI - '0x8d11ec38a3eb5e956b052f67da8bdc9bef8abf3e', + ADDRESSES.fantom.DAI, // * MIM - '0x82f0b8b456c1a451378467398982d4834b6829c1', + ADDRESSES.fantom.MIM, ], harmony: [ // * KUSD @@ -66,7 +67,7 @@ async function bscTVL(_, _b, { bsc: block }) { '0x830e287ac5947b1c0da865dfb3afd7cdf7900464', ] const toa = [ - ['0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d', '0xa275769Fb6fF34A1a01C8CE61D0182f5d36AD27A',], // USDC collateral for minting KUSD + [ADDRESSES.bsc.USDC, '0xa275769Fb6fF34A1a01C8CE61D0182f5d36AD27A',], // USDC collateral for minting KUSD ] assetsOnExchange.bsc.forEach(t => pools.forEach(o => toa.push([t, o]))) return sumTokens2({ tokensAndOwners: toa, chain, block, }) diff --git a/projects/dotdot/index.js b/projects/dotdot/index.js index b8c23c77461..12dd3c075c2 100644 --- a/projects/dotdot/index.js +++ b/projects/dotdot/index.js @@ -1,124 +1,203 @@ -const { fetchItemList } = require('../helper/utils'); -const { pool2 } = require('../helper/pool2') -const { staking } = require('../helper/staking') -const { transformBalances } = require('../helper/portedTokens') -const sdk = require('@defillama/sdk') -const chain = 'bsc' +const ADDRESSES = require('../helper/coreAssets.json') +const { pool2 } = require("../helper/pool2"); +const { staking } = require("../helper/staking"); +const { transformBalances } = require("../helper/portedTokens"); +const sdk = require("@defillama/sdk"); +const chain = "bsc"; -const epsLPStaking = '0x5b74c99aa2356b4eaa7b85dc486843edff8dfdbe' -const proxy = '0xd4d01c4367ed2d4ab5c2f734d640f7ffe558e8a8' +const epsLPStaking = "0x5b74c99aa2356b4eaa7b85dc486843edff8dfdbe"; +const proxy = "0xd4d01c4367ed2d4ab5c2f734d640f7ffe558e8a8"; async function tvl(_, _b, { bsc: block }) { - let addresses = (await fetchItemList({ target: epsLPStaking, chain, block, itemAbi: abis.registeredTokens, lengthAbi: abis.poolLength })).map(i => i.output) - const calls = addresses.map(i => ({ params: [i, proxy] })) + let addresses = (await sdk.api2.abi.fetchList({ + withMetadata: true, + target: epsLPStaking, + chain, + block, + itemAbi: abis.registeredTokens, + lengthAbi: abis.poolLength + })).map(i => i.output); + const calls = addresses.map(i => ({ params: [i, proxy] })); const { output: bals } = await sdk.api.abi.multiCall({ target: epsLPStaking, abi: abis.userInfo, - calls, chain, block, - }) - const { output: totalSupplies } = await sdk.api.abi.multiCall({ chain, block, calls: addresses.map(i => ({ target: i })), abi: 'erc20:totalSupply' }) - const ratios = totalSupplies.map((supply, i) => +bals[i].output.depositAmount ? bals[i].output.depositAmount / supply.output : 0) - const balances = {} - await Promise.all(addresses.map((token, i) => resolveEpsLP({ ratio: ratios[i], token, block, balances, tokenBalance: bals[i].output.depositAmount, totalSupply: totalSupplies[i].output}))) - await fixVal3EPS(block, balances) - return transformBalances(chain, balances) + calls, + chain, + block + }); + const { output: totalSupplies } = await sdk.api.abi.multiCall({ + chain, + block, + calls: addresses.map(i => ({ target: i })), + abi: "erc20:totalSupply" + }); + const ratios = totalSupplies.map( + (supply, i) => + +bals[i].output.depositAmount + ? bals[i].output.depositAmount / supply.output + : 0 + ); + const balances = {}; + await Promise.all( + addresses.map((token, i) => + resolveEpsLP({ + ratio: ratios[i], + token, + block, + balances, + tokenBalance: bals[i].output.depositAmount + }) + ) + ); + await fixVal3EPS(block, balances); + return transformBalances(chain, balances); } async function fixVal3EPS(block, balances) { - const val3EPSKey = 'bsc:0x5b5bd8913d766d005859ce002533d4838b0ebbb5' - const balance = balances[val3EPSKey] - delete balances[val3EPSKey] + const val3EPSKey = "0x5b5bd8913d766d005859ce002533d4838b0ebbb5"; + const balance = balances[val3EPSKey]; + delete balances[val3EPSKey]; const { output: supply } = await sdk.api.abi.call({ - target: '0x5b5bd8913d766d005859ce002533d4838b0ebbb5', - abi: 'erc20:totalSupply', - chain, block, - }) - const ratio = balance/supply - const params = '0x19EC9e3F7B21dd27598E7ad5aAe7dC0Db00A806d' // minter + target: "0x5b5bd8913d766d005859ce002533d4838b0ebbb5", + abi: "erc20:totalSupply", + chain, + block + }); + const ratio = balance / supply; + const params = "0x19EC9e3F7B21dd27598E7ad5aAe7dC0Db00A806d"; // minter const { output } = await sdk.api.abi.multiCall({ - abi: 'erc20:balanceOf', + abi: "erc20:balanceOf", calls: [ - {params, target: '0xaed19dab3cd68e4267aec7b2479b1ed2144ad77f'}, - {params, target: '0xa6fdea1655910c504e974f7f1b520b74be21857b'}, - {params, target: '0x5f7f6cb266737b89f7af86b30f03ae94334b83e9'}, + { params, target: ADDRESSES.bsc.valBUSD }, + { params, target: ADDRESSES.bsc.valUSDC }, + { params, target: ADDRESSES.bsc.valUSDT } ], - chain, block, - }) + chain, + block + }); output.forEach(i => { - sdk.util.sumSingleBalance(balances,i.input.target,i.output * ratio,chain) - }) + sdk.util.sumSingleBalance(balances, i.input.target, i.output * ratio); + }); } -async function resolveEpsLP({ block, balances, token, ratio, tokenBalance, totalSupply }) { - if (token.toLowerCase() === '0xaf4de8e872131ae328ce21d909c74705d3aaf452') { - sdk.util.sumSingleBalance(balances,'0xe9e7cea3dedca5984780bafc599bd69add087d56',tokenBalance, 'bsc') // store 3EPS as BUSD - return +async function resolveEpsLP({ + block, + balances, + token, + ratio, + tokenBalance +}) { + if (token.toLowerCase() === "0xaf4de8e872131ae328ce21d909c74705d3aaf452") { + sdk.util.sumSingleBalance( + balances, + ADDRESSES.bsc.BUSD, + tokenBalance + ); // store 3EPS as BUSD + return; } - if (token.toLowerCase() === '0x5b5bd8913d766d005859ce002533d4838b0ebbb5') { - sdk.util.sumSingleBalance(balances,'0x5b5bd8913d766d005859ce002533d4838b0ebbb5',tokenBalance, 'bsc') - return + if (token.toLowerCase() === "0x5b5bd8913d766d005859ce002533d4838b0ebbb5") { + sdk.util.sumSingleBalance( + balances, + "0x5b5bd8913d766d005859ce002533d4838b0ebbb5", + tokenBalance + ); + return; } - const blacklist = ['0xf71a0bcc3ef8a8c5a28fc1bc245e394a8ce124ec', '0xaF4dE8E872131AE328Ce21D909C74705d3Aaf452'].map(i => i.toLowerCase()) + const blacklist = [ + "0xf71a0bcc3ef8a8c5a28fc1bc245e394a8ce124ec", + "0xaF4dE8E872131AE328Ce21D909C74705d3Aaf452" + ].map(i => i.toLowerCase()); if (blacklist.includes(token.toLowerCase())) return; if (ratio === 0 || isNaN(ratio)) return; + let factory; + let minter; try { - const [ - { output: factory }, - { output: minter }, - ] = await Promise.all([ - sdk.api.abi.call({ target: token, abi: abis.factory, chain, block, }), - sdk.api.abi.call({ target: token, abi: abis.minter, chain, block, }), - ]) - if (['0x8433533c5B67C4E18FA06935f73891B28a10932b'.toLowerCase(), '0x9f494C121A932F9Ed575c6c96F885E51Ec6B367b'.toLowerCase()].includes(factory.toLowerCase())) { - const { output: coins } = await sdk.api.abi.call({ - target: factory, - abi: { "stateMutability": "view", "type": "function", "name": "get_coins", "inputs": [{ "name": "_pool", "type": "address" }], "outputs": [{ "name": "", "type": "address[2]" }] }, - chain, block, - params: minter, - }) - const { output: bal } = await sdk.api.abi.call({ - target: factory, - abi: { "stateMutability": "view", "type": "function", "name": "get_balances", "inputs": [{ "name": "_pool", "type": "address" }], "outputs": [{ "name": "", "type": "uint256[2]" }] }, - chain, block, - params: minter, - }) - bal.forEach((val, i) => sdk.util.sumSingleBalance(balances, coins[i].toLowerCase(), val * ratio, chain)) - return; - } - if (['0xa5d748a3234A81120Df7f23c9Ea665587dc8d871'.toLowerCase(), '0x41871A4c63d8Fae4855848cd1790ed237454A5C4'.toLowerCase(), '0xf65BEd27e96a367c61e0E06C54e14B16b84a5870'.toLowerCase()].includes(factory.toLowerCase())) { - const { output: coins } = await sdk.api.abi.call({ - target: factory, - abi: { "stateMutability": "view", "type": "function", "name": "get_coins", "inputs": [{ "name": "_pool", "type": "address" }], "outputs": [{ "name": "", "type": "address[4]" }] }, - chain, block, - params: minter, - }) - const { output: bal } = await sdk.api.abi.call({ - target: factory, - abi: { "stateMutability": "view", "type": "function", "name": "get_balances", "inputs": [{ "name": "_pool", "type": "address" }], "outputs": [{ "name": "", "type": "uint256[4]" }] }, - chain, block, - params: minter, - }) - bal.forEach((val, i) => sdk.util.sumSingleBalance(balances, coins[i].toLowerCase(), val * ratio, chain)) - return; - } - throw new Error('Token not resolved '+token) - - } catch (e) { console.error(e) } + factory = (await sdk.api.abi.call({ target: token, abi: abis.factory, chain, block })).output + } catch { + console.log('TRYING OTHER ABI') + factory = (await sdk.api.abi.call({ target: token, abi: abis.factory2, chain, block })).output + } + try { + minter = (await sdk.api.abi.call({ target: token, abi: abis.minter, chain, block })).output + } catch { + console.log('no minter') + return + } + // node test.js projects/dotdot/index.js + if ( + [ + "0x8433533c5B67C4E18FA06935f73891B28a10932b".toLowerCase(), + "0x9f494C121A932F9Ed575c6c96F885E51Ec6B367b".toLowerCase() + ].includes(factory.toLowerCase()) + ) { + const { output: coins } = await sdk.api.abi.call({ + target: factory, + abi: 'function get_coins(address _pool) view returns (address[2])', + chain, + block, + params: minter + }); + const { output: bal } = await sdk.api.abi.call({ + target: factory, + abi: 'function get_balances(address _pool) view returns (uint256[2])', + chain, + block, + params: minter + }); + bal.forEach((val, i) => + sdk.util.sumSingleBalance(balances, coins[i].toLowerCase(), val * ratio) + ); + return; + } + if ( + [ + "0xa5d748a3234A81120Df7f23c9Ea665587dc8d871".toLowerCase(), + "0x41871A4c63d8Fae4855848cd1790ed237454A5C4".toLowerCase(), + "0xf65BEd27e96a367c61e0E06C54e14B16b84a5870".toLowerCase() + ].includes(factory.toLowerCase()) + ) { + const { output: coins } = await sdk.api.abi.call({ + target: factory, + abi: 'function get_coins(address _pool) view returns (address[4])', + chain, + block, + params: minter + }); + const { output: bal } = await sdk.api.abi.call({ + target: factory, + abi: 'function get_balances(address _pool) view returns (uint256[4])', + chain, + block, + params: minter + }); + bal.forEach((val, i) => + sdk.util.sumSingleBalance(balances, coins[i].toLowerCase(), val * ratio) + ); + } } module.exports = { bsc: { tvl, - pool2: pool2('0xe8bcccb79b66e49e7f95d576049cf4b23fdbc256', '0xc19956eca8a3333671490ef6d6d4329df049dddd', chain), - staking: staking('0x51133c54b7bb6cc89dac86b73c75b1bf98070e0d', '0x84c97300a190676a19D1E13115629A11f8482Bd1', chain), + pool2: pool2( + "0xe8bcccb79b66e49e7f95d576049cf4b23fdbc256", + "0xc19956eca8a3333671490ef6d6d4329df049dddd", + chain + ), + staking: staking( + "0x51133c54b7bb6cc89dac86b73c75b1bf98070e0d", + "0x84c97300a190676a19D1E13115629A11f8482Bd1", + chain + ) } -} +}; const abis = { - poolLength: { "inputs": [], "name": "poolLength", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, - registeredTokens: { "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "name": "registeredTokens", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, - factory: { "inputs": [], "name": "factory", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, - minter: { "inputs": [], "name": "minter", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, - getNCoins: { "stateMutability": "view", "type": "function", "name": "get_n_coins", "inputs": [{ "name": "_pool", "type": "address" }], "outputs": [{ "name": "", "type": "uint256" }], "gas": 2894 }, - userInfo: { "inputs": [{ "internalType": "address", "name": "", "type": "address" }, { "internalType": "address", "name": "", "type": "address" }], "name": "userInfo", "outputs": [{ "internalType": "uint256", "name": "depositAmount", "type": "uint256" }, { "internalType": "uint256", "name": "adjustedAmount", "type": "uint256" }, { "internalType": "uint256", "name": "rewardDebt", "type": "uint256" }, { "internalType": "uint256", "name": "claimable", "type": "uint256" }], "stateMutability": "view", "type": "function" }, - getLpToken: { "stateMutability": "view", "type": "function", "name": "get_lp_token", "inputs": [{ "name": "arg0", "type": "address" }], "outputs": [{ "name": "", "type": "address" }], "gas": 4058 }, -} \ No newline at end of file + poolLength: "uint256:poolLength", + registeredTokens: "function registeredTokens(uint256) view returns (address)", + factory: "address:factory", + factory2: "address:factory", + minter: "address:minter", + getNCoins: "function get_n_coins(address _pool) view returns (uint256) @2894", + userInfo: "function userInfo(address, address) view returns (uint256 depositAmount, uint256 adjustedAmount, uint256 rewardDebt, uint256 claimable)", + getLpToken: "function get_lp_token(address arg0) view returns (address) @4058", +} diff --git a/projects/dotoracle/index.js b/projects/dotoracle/index.js index ab4c3e57fb2..979e146a078 100644 --- a/projects/dotoracle/index.js +++ b/projects/dotoracle/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { nullAddress, sumTokens2 } = require('../helper/unwrapLPs') const { staking} = require('../helper/staking') @@ -9,13 +10,13 @@ const config = { ], tokens: { eth: nullAddress, - usdc: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', - usdt: '0xdac17f958d2ee523a2206206994597c13d831ec7', - DAI: '0x6b175474e89094c44da98b954eedeac495271d0f', - frax: '0x853d955acef822db058eb8505911ed77f175b99e', + usdc: ADDRESSES.ethereum.USDC, + usdt: ADDRESSES.ethereum.USDT, + DAI: ADDRESSES.ethereum.DAI, + frax: ADDRESSES.ethereum.FRAX, fxs: '0x3432b6a60d23ca0dfca7761b7ab56459d9c964d0', - maker: '0x9f8f72aa9304c8b593d555f12ef6589cc3a579a2', - aave: '0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9', + maker: ADDRESSES.ethereum.MKR, + aave: ADDRESSES.ethereum.AAVE, } }, avax: { @@ -33,7 +34,7 @@ const config = { ], tokens: { bsc: nullAddress, - busd: '0xe9e7cea3dedca5984780bafc599bd69add087d56', + busd: ADDRESSES.bsc.BUSD, } }, okexchain: { diff --git a/projects/double/abis.json b/projects/double/abis.json index 8bc3d8666df..97b37f291f5 100644 --- a/projects/double/abis.json +++ b/projects/double/abis.json @@ -1,103 +1,8 @@ { - "locked": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "locked", - "outputs": [ - { - "internalType": "int128", - "name": "amount", - "type": "int128" - }, - { - "internalType": "uint256", - "name": "end", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "totalBalances": { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "totalBalances", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "allPairsLength": { - "inputs": [], - "name": "allPairsLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "allPairs": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "allPairs", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "token0": { - "inputs": [], - "name": "token0", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "token1": { - "inputs": [], - "name": "token1", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } + "locked": "function locked(uint256) view returns (int128 amount, uint256 end)", + "totalBalances": "function totalBalances(address) view returns (uint256)", + "allPairsLength": "uint256:allPairsLength", + "allPairs": "function allPairs(uint256) view returns (address)", + "token0": "address:token0", + "token1": "address:token1" } \ No newline at end of file diff --git a/projects/double/index.js b/projects/double/index.js index 19bfe5e1afd..d3bb83837e4 100644 --- a/projects/double/index.js +++ b/projects/double/index.js @@ -19,7 +19,7 @@ async function staking(timestamp, block, chainBlocks) { chain: 'bsc' })).output.amount }; -}; +} function tvl(pool2 = false) { return async (timestamp, block, chainBlocks) => { @@ -80,7 +80,7 @@ function tvl(pool2 = false) { excludedTokens.includes(pairAddresses[i].output.toLowerCase()) ) { continue; - }; + } if (excludedTokens.includes(token0s.output[i].output.toLowerCase()) || excludedTokens.includes(token1s.output[i].output.toLowerCase())) { pool2Positions.push({ @@ -92,8 +92,8 @@ function tvl(pool2 = false) { balance: pairBalances[i].output, token: pairAddresses[i].output }); - }; - }; + } + } await unwrapUniswapLPs( balances, @@ -105,7 +105,7 @@ function tvl(pool2 = false) { return balances; }; -}; +} module.exports = { doublecounted: true, diff --git a/projects/doveswap-v3/index.js b/projects/doveswap-v3/index.js new file mode 100644 index 00000000000..b7195d302b9 --- /dev/null +++ b/projects/doveswap-v3/index.js @@ -0,0 +1,5 @@ +const { uniV3Export } = require('../helper/uniswapV3') + +module.exports = uniV3Export({ + polygon_zkevm: { factory: '0xde474db1fa59898bc91314328d29507acd0d593c', fromBlock: 99323, }, +}) \ No newline at end of file diff --git a/projects/doveswap/index.js b/projects/doveswap/index.js new file mode 100644 index 00000000000..8efd1c77235 --- /dev/null +++ b/projects/doveswap/index.js @@ -0,0 +1,3 @@ +const { uniTvlExport } = require('../helper/unknownTokens') + +module.exports = uniTvlExport('polygon_zkevm', '0xeA2709fCD78141976803C3aecA23eCEa3Cb9cb41') diff --git a/projects/dpex/index.js b/projects/dpex/index.js new file mode 100644 index 00000000000..6b1cded7e9e --- /dev/null +++ b/projects/dpex/index.js @@ -0,0 +1,7 @@ + +const { gmxExports } = require('../helper/gmx') +module.exports = { + polygon: { + tvl: gmxExports({ vault: '0x24AfB3B27156E71e68e292E4aD71Db827F83f05C', }) + } +} \ No newline at end of file diff --git a/projects/drachma-exchange/index.js b/projects/drachma-exchange/index.js index a3b33e48cbb..13ba76064cd 100644 --- a/projects/drachma-exchange/index.js +++ b/projects/drachma-exchange/index.js @@ -1,19 +1,10 @@ -const { sumTokens2, } = require("../helper/solana"); - -async function tvl() { - return sumTokens2({ - tokensAndOwners: [ - ['Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB', 'J1bMZJc4aj6RZVTf5vjDBwrwgoRAnvttkhU4TviuqrtL'], - ['EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v', 'J1bMZJc4aj6RZVTf5vjDBwrwgoRAnvttkhU4TviuqrtL'], - ['USDH1SM1ojwWUga67PGrgFWUHibbjqMvuMaDkRJTgkX', 'J1bMZJc4aj6RZVTf5vjDBwrwgoRAnvttkhU4TviuqrtL'], - ] - }) -} - module.exports = { + hallmarks: [ + [1660392000,"Rug Pull"] + ], methodology: "drachma exchange TVL is computed by looking at the balances of the accounts holding the tokens backing the drachma vault user. The data comes from https://drachma.exchange/pool.", solana: { - tvl + tvl: () => 0 }, }; diff --git a/projects/drachma/index.js b/projects/drachma/index.js index 1cc907fc245..a4fa920a2a9 100644 --- a/projects/drachma/index.js +++ b/projects/drachma/index.js @@ -13,20 +13,20 @@ const { tvl: drachmaTvl, borrowed: drachmaBorrowed } = compoundExports( //tvl for drachma app function tvl(chain) { - return async (timestamp, block, chainBlocks) => { + return async (timestamp, block, chainBlocks, { api }) => { const toa = [] toa.push(...contracts[chain].map(c => ([c.token, c.address]))) toa.push(...contracts[chain].map(c => ([contracts.usdc[chain], c.address]))) - return sumTokens2({ chain, tokensAndOwners: toa, block: chainBlocks[chain], resolveLP: true, }) + return sumTokens2({ chain, tokensAndOwners: toa, api, resolveLP: true, }) }; -}; +} module.exports = { - timetravel: true, - incentivized: true, - misrepresentedTokens: true, metis: { tvl: sdk.util.sumChainTvls([drachmaTvl, tvl("metis")]), borrowed: drachmaBorrowed, }, }; + + +module.exports.metis = { tvl: tvl("metis") } \ No newline at end of file diff --git a/projects/dracula/index.js b/projects/dracula/index.js new file mode 100644 index 00000000000..bd5f0612eb9 --- /dev/null +++ b/projects/dracula/index.js @@ -0,0 +1,7 @@ +const { uniTvlExport } = require("../helper/calculateUniTvl.js"); + +module.exports = { + era: { + tvl: uniTvlExport("0x68e03D7B8B3F9669750C1282AD6d36988f4FE18e", "era", undefined, undefined, { hasStablePools: true, useDefaultCoreAssets: false, }), + }, +}; diff --git a/projects/droplit-money/index.js b/projects/droplit-money/index.js new file mode 100644 index 00000000000..befaedc127a --- /dev/null +++ b/projects/droplit-money/index.js @@ -0,0 +1,18 @@ +const { tombTvl } = require("../helper/tomb"); + +const lit = "0x79B2bc95344eFe31cb6a7B0Cf8A843a5eE125dFf"; +const gds = "0x5Abf65C1d152244c6Bd4ad0a5eB92DB00e403BdB"; +const boardroom = "0x9D76Db596D281897F3ce842475b7BD6Ea2580b4b"; +const rewardPool = "0x79D7c1a12c4dE91C487A87602478C5bc19b3aa7c"; +const lps = [ + "0xa1E137dED898058af3a09caC599D50D1D3ac0ABc", // GDS-BUSD LP + "0x4F8b3ee2421cac4743356e8207209eFf34B51ebe", // LIT-BUSD LP + "0x851b0a2514A56dD780480ab47268794E3d3D947D", // LIT-GDS LP + "0x7661D626b4c588157960724528a8f3C4a1de5F36", // LIT-WBNB LP +]; + +module.exports = { + misrepresentedTokens: true, + ...tombTvl(lit, gds, rewardPool, boardroom,lps,"bsc",undefined,false , "0xa1E137dED898058af3a09caC599D50D1D3ac0ABc" + ), +}; diff --git a/projects/drops/index.js b/projects/drops/index.js index 0087353a869..409bd05a7d5 100644 --- a/projects/drops/index.js +++ b/projects/drops/index.js @@ -1,7 +1,7 @@ -const { usdCompoundExports } = require("../helper/compound") +const { compoundExports2 } = require("../helper/compound") const { mergeExports, } = require("../helper/utils") const { staking, } = require("../helper/staking") -const { pool2, } = require("../helper/pool2") +const { pool2, } = require("../helper/pool2"); const tokensAddress = { masterchef: "0x8A78011bf2c42df82cC05F198109Ea024B554df9", @@ -10,32 +10,30 @@ const tokensAddress = { lp: '0x00aa1c57e894c4010fe44cb840ae56432d7ea1d1', }; -module.exports = mergeExports([{ - ethereum: { - staking: staking(tokensAddress.masterchef, tokensAddress.drop), - pool2: pool2(tokensAddress.masterchef, tokensAddress.lp), - } -}, { - ethereum: { - staking: staking(tokensAddress.masterchef, tokensAddress.ndr), - } -}, -{ - ethereum: usdCompoundExports("0x7312a3bc8733b068989ef44bac6344f07cfcde7f", undefined, '0x05231980914B702083B9Ac08002325654F6eb95B'), -}, -{ - ethereum: usdCompoundExports("0x79b56CB219901DBF42bB5951a0eDF27465F96206", undefined, '0x4aE7413182849D062B72518928a4b2DE87F0e411'), -}, -{ - ethereum: usdCompoundExports("0xB70FB69a522ed8D4613C4C720F91F93a836EE2f5", undefined, '0xD72929e284E8bc2f7458A6302bE961B91bccB339'), -}, -{ - ethereum: usdCompoundExports("0x9dEb56b9DD04822924B90ad15d01EE50415f8bC7", undefined, '0x0a1EF7feD1B691253F9367daf682BA08A9D2fD9C'), -}, -{ - ethereum: usdCompoundExports("0x3903E6EcD8bc610D5a01061B1Dc31affD21F81C6", undefined, '0x588C13e685e44B22DC6647937481C816E5FeE086'), -}, -{ - ethereum: usdCompoundExports("0x896b8019f5ea3caaAb23cDA0A09B405ed8361E8b", undefined, '0x777ECcD3fCf4FfA3b12f45a384852608DF2619a0'), -}, +const UniControllers = [ + ["0x7312a3bc8733b068989ef44bac6344f07cfcde7f", '0x05231980914B702083B9Ac08002325654F6eb95B',], + ["0x79b56CB219901DBF42bB5951a0eDF27465F96206", '0x4aE7413182849D062B72518928a4b2DE87F0e411',], + ["0xB70FB69a522ed8D4613C4C720F91F93a836EE2f5", '0xD72929e284E8bc2f7458A6302bE961B91bccB339',], + ["0x9dEb56b9DD04822924B90ad15d01EE50415f8bC7", '0x0a1EF7feD1B691253F9367daf682BA08A9D2fD9C',], + ["0x3903E6EcD8bc610D5a01061B1Dc31affD21F81C6", '0x588C13e685e44B22DC6647937481C816E5FeE086',], + ["0x896b8019f5ea3caaAb23cDA0A09B405ed8361E8b", '0x777ECcD3fCf4FfA3b12f45a384852608DF2619a0',], +].map(([comptroller, cether]) => ({ ethereum: compoundExports2({ comptroller, cether, blacklistedTokens: [tokensAddress.drop] }) })) + +module.exports = mergeExports([ + ...UniControllers, + { + ethereum: { + staking: staking(tokensAddress.masterchef, tokensAddress.drop), + pool2: pool2(tokensAddress.masterchef, tokensAddress.lp), + } + }, { + ethereum: { + staking: staking(tokensAddress.masterchef, tokensAddress.ndr), + } + }, ]) + +module.exports.hallmarks = [ + [1651702080, "Drops DAO launch"], + [1653086700, "DOP staking"], +] \ No newline at end of file diff --git a/projects/dsu-money/index.js b/projects/dsu-money/index.js new file mode 100644 index 00000000000..cb047b6c10c --- /dev/null +++ b/projects/dsu-money/index.js @@ -0,0 +1,17 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require('../helper/unwrapLPs') + +module.exports = { + ethereum: { + tvl: sumTokensExport({ tokensAndOwners: [ + [ADDRESSES.ethereum.USDC, '0xaef566ca7e84d1e736f999765a804687f39d9094'], + [ADDRESSES.ethereum.USDC, '0xD05aCe63789cCb35B9cE71d01e4d632a0486Da4B'], + ['0x39aa39c021dfbae8fac545936693ac917d5e7563', '0xD05aCe63789cCb35B9cE71d01e4d632a0486Da4B'], + ]}) + }, + arbitrum: { + tvl: sumTokensExport({ tokensAndOwners: [ + [ADDRESSES.arbitrum.USDC, '0x0d49c416103cbd276d9c3cd96710db264e3a0c27'], + ]}) + } +} diff --git a/projects/dual/idl.json b/projects/dual/idl.json index baaec2d7191..28e3d42e7f9 100644 --- a/projects/dual/idl.json +++ b/projects/dual/idl.json @@ -1,343 +1,7 @@ { "version": "0.1.0", "name": "dual_market", - "instructions": [ - { - "name": "initPremiumAccount", - "accounts": [ - { - "name": "authority", - "isMut": true, - "isSigner": true - }, - { - "name": "premiumUsdcTokenAccount", - "isMut": true, - "isSigner": false - }, - { - "name": "usdcMint", - "isMut": false, - "isSigner": false - }, - { - "name": "systemProgram", - "isMut": false, - "isSigner": false - }, - { - "name": "tokenProgram", - "isMut": false, - "isSigner": false - }, - { - "name": "rent", - "isMut": false, - "isSigner": false - } - ], - "args": [] - }, - { - "name": "depositPremiums", - "accounts": [ - { - "name": "authority", - "isMut": true, - "isSigner": true - }, - { - "name": "premiumUsdcTokenAccount", - "isMut": true, - "isSigner": false - }, - { - "name": "userUsdcTokenAccount", - "isMut": true, - "isSigner": false - }, - { - "name": "tokenProgram", - "isMut": false, - "isSigner": false - }, - { - "name": "systemProgram", - "isMut": false, - "isSigner": false - } - ], - "args": [ - { - "name": "amount", - "type": "u64" - } - ] - }, - { - "name": "initDip", - "accounts": [ - { - "name": "authority", - "isMut": true, - "isSigner": true - }, - { - "name": "vaultMint", - "isMut": true, - "isSigner": false - }, - { - "name": "optionMint", - "isMut": true, - "isSigner": false - }, - { - "name": "vaultSplTokenAccount", - "isMut": true, - "isSigner": false - }, - { - "name": "splMint", - "isMut": false, - "isSigner": false - }, - { - "name": "vaultUsdcTokenAccount", - "isMut": true, - "isSigner": false - }, - { - "name": "usdcMint", - "isMut": false, - "isSigner": false - }, - { - "name": "dipState", - "isMut": true, - "isSigner": false - }, - { - "name": "systemProgram", - "isMut": false, - "isSigner": false - }, - { - "name": "tokenProgram", - "isMut": false, - "isSigner": false - }, - { - "name": "rent", - "isMut": false, - "isSigner": false - } - ], - "args": [ - { - "name": "strike", - "type": "u64" - }, - { - "name": "expiration", - "type": "u64" - } - ] - }, - { - "name": "deposit", - "accounts": [ - { - "name": "authority", - "isMut": true, - "isSigner": true - }, - { - "name": "userSplTokenAccount", - "isMut": true, - "isSigner": false - }, - { - "name": "vaultSplTokenAccount", - "isMut": true, - "isSigner": false - }, - { - "name": "userVaultTokenAccount", - "isMut": true, - "isSigner": false - }, - { - "name": "vaultTokenMint", - "isMut": true, - "isSigner": false - }, - { - "name": "premiumTokenAccount", - "isMut": true, - "isSigner": false - }, - { - "name": "userUsdcTokenAccount", - "isMut": true, - "isSigner": false - }, - { - "name": "optionTokenMint", - "isMut": true, - "isSigner": false - }, - { - "name": "mmOptionTokenAccount", - "isMut": true, - "isSigner": false - }, - { - "name": "pythPrice", - "isMut": false, - "isSigner": false - }, - { - "name": "dipState", - "isMut": false, - "isSigner": false - }, - { - "name": "systemProgram", - "isMut": false, - "isSigner": false - }, - { - "name": "tokenProgram", - "isMut": false, - "isSigner": false - } - ], - "args": [ - { - "name": "amount", - "type": "u64" - } - ] - }, - { - "name": "withdraw", - "accounts": [ - { - "name": "authority", - "isMut": true, - "isSigner": true - }, - { - "name": "userSplTokenAccount", - "isMut": true, - "isSigner": false - }, - { - "name": "vaultSplTokenAccount", - "isMut": true, - "isSigner": false - }, - { - "name": "userVaultTokenAccount", - "isMut": true, - "isSigner": false - }, - { - "name": "vaultTokenMint", - "isMut": true, - "isSigner": false - }, - { - "name": "vaultUsdcTokenAccount", - "isMut": true, - "isSigner": false - }, - { - "name": "userUsdcTokenAccount", - "isMut": true, - "isSigner": false - }, - { - "name": "dipState", - "isMut": false, - "isSigner": false - }, - { - "name": "systemProgram", - "isMut": false, - "isSigner": false - }, - { - "name": "tokenProgram", - "isMut": false, - "isSigner": false - } - ], - "args": [] - }, - { - "name": "exerciseOption", - "accounts": [ - { - "name": "authority", - "isMut": true, - "isSigner": true - }, - { - "name": "vaultUsdcTokenAccount", - "isMut": true, - "isSigner": false - }, - { - "name": "mmUsdcTokenAccount", - "isMut": true, - "isSigner": false - }, - { - "name": "mmOptionTokenAccount", - "isMut": true, - "isSigner": false - }, - { - "name": "optionMint", - "isMut": true, - "isSigner": false - }, - { - "name": "mmSplTokenAccount", - "isMut": true, - "isSigner": false - }, - { - "name": "vaultSplTokenAccount", - "isMut": true, - "isSigner": false - }, - { - "name": "dipState", - "isMut": false, - "isSigner": false - }, - { - "name": "tokenProgram", - "isMut": false, - "isSigner": false - }, - { - "name": "systemProgram", - "isMut": false, - "isSigner": false - } - ], - "args": [ - { - "name": "amount", - "type": "u64" - } - ] - } - ], + "instructions": [], "accounts": [ { "name": "DIPState", @@ -396,88 +60,7 @@ } } ], - "errors": [ - { - "code": 6000, - "name": "TokensStillLocked", - "msg": "Tokens are still locked until contract expiration" - }, - { - "code": 6001, - "name": "DepositExpired", - "msg": "The expiration for the attempted deposit has already happened" - }, - { - "code": 6002, - "name": "ExerciseExpired", - "msg": "The expiration for the attempted exercise has already happened" - }, - { - "code": 6003, - "name": "IncorrectAddressForOption", - "msg": "Attempted to send options to an account not owned by protocol" - }, - { - "code": 6004, - "name": "WrongLSOMint", - "msg": "LSO Mint computed and the argument do not match" - }, - { - "code": 6005, - "name": "IncorrectMM", - "msg": "Wrong MM when trying to deposit" - }, - { - "code": 6006, - "name": "InvalidToken", - "msg": "Unexpected token" - }, - { - "code": 6007, - "name": "InvalidCaller", - "msg": "Invalid Caller" - }, - { - "code": 6008, - "name": "InvalidUsdc", - "msg": "Invalid usdc" - }, - { - "code": 6009, - "name": "InvalidSpl", - "msg": "Invalid spl" - }, - { - "code": 6010, - "name": "WrongAuthority", - "msg": "The signer of transaction did not match user accounts" - }, - { - "code": 6011, - "name": "DIPSPLVault", - "msg": "Failed SPL vault check on DIP" - }, - { - "code": 6012, - "name": "DIPVaultMint", - "msg": "Failed vault mint check on DIP" - }, - { - "code": 6013, - "name": "DIPOptionMint", - "msg": "Failed option mint check on DIP" - }, - { - "code": 6014, - "name": "PythAddress", - "msg": "Invalid pyth address" - }, - { - "code": 6015, - "name": "DIPAddress", - "msg": "Invalid dip address" - } - ], + "errors": [], "metadata": { "address": "DiPbvUUJkDhV9jFtQsDFnMEMRJyjW5iS6NMwoySiW8ki" } diff --git a/projects/dual/index.js b/projects/dual/index.js index 65bb44b46c9..cf0656a03cb 100644 --- a/projects/dual/index.js +++ b/projects/dual/index.js @@ -1,20 +1,45 @@ -const { PublicKey, } = require("@solana/web3.js"); +const { PublicKey } = require("@solana/web3.js"); +const anchor = require("@project-serum/anchor"); const { getConnection, sumTokens2, readBigUInt64LE, } = require("../helper/solana"); async function tvl() { const connection = getConnection(); const dualProgramID = new PublicKey("DiPbvUUJkDhV9jFtQsDFnMEMRJyjW5iS6NMwoySiW8ki"); - let programAccounts = await connection.getProgramAccounts(dualProgramID); + let programAccounts = await connection.getProgramAccounts(dualProgramID, { + filters: [{ + dataSize: 260 + }] + }); - const tokenAccounts = programAccounts - .filter(i => i.account.data.length === 260) + const dipTokenAccounts = programAccounts .map(i => parseDipState(i.account.data)) - .map(i => JSON.parse(JSON.stringify(i))) .map(i => [i.vaultSpl, i.vaultUsdc]) .flat() - return sumTokens2({ tokenAccounts }) + const stakingOptionsProgramID = new PublicKey("4yx1NJ4Vqf2zT1oVLk4SySBhhDJXmXFt88ncm4gPxtL7"); + let stakingOptionsAccounts = await connection.getProgramAccounts(stakingOptionsProgramID, { + filters: [{ + dataSize: 1150 + }] + }); + + const soTokenAccounts = stakingOptionsAccounts + .map(i => parseSoState(i.account.data)) + .map(i => i.vault) + + const gsoProgramID = new PublicKey("DuALd6fooWzVDkaTsQzDAxPGYCnLrnWamdNNTNxicdX8"); + let gsoAccounts = await connection.getProgramAccounts(gsoProgramID, { + filters: [{ + dataSize: 1000 + }] + }); + const gsoTokenAccounts = gsoAccounts + .map(i => gsoVault(i.pubkey)) + + const tokenAccounts = dipTokenAccounts.concat(soTokenAccounts).concat(gsoTokenAccounts); + + return sumTokens2({ tokenAccounts, allowError: true, }) } function parseDipState(buf) { @@ -46,6 +71,40 @@ function parseDipState(buf) { }; } +function parseSoState(buf) { + const numNameBytes = Number(buf.readUInt8(8)); + // Prefix is 4 bytes + const soName = String.fromCharCode.apply(String, buf.slice(8 + 4, 8 + 4 + numNameBytes)); + const offset = 26 + 32 + 8 + 4 + numNameBytes; + const baseMint = new PublicKey(buf.slice(offset, offset + 32)); + + const vault = PublicKey.findProgramAddressSync( + [ + Buffer.from(anchor.utils.bytes.utf8.encode("so-vault")), + Buffer.from(anchor.utils.bytes.utf8.encode(soName)), + baseMint.toBuffer(), + ], + new PublicKey("4yx1NJ4Vqf2zT1oVLk4SySBhhDJXmXFt88ncm4gPxtL7") + )[0].toBase58(); + + return { + soName, + baseMint, + vault, + }; +} + +function gsoVault(pubkey) { + const vault = PublicKey.findProgramAddressSync( + [ + Buffer.from(anchor.utils.bytes.utf8.encode("base-vault")), + (new PublicKey(pubkey)).toBuffer(), + ], + new PublicKey("DuALd6fooWzVDkaTsQzDAxPGYCnLrnWamdNNTNxicdX8") + )[0].toBase58(); + return vault; +} + module.exports = { misrepresentedTokens: true, timetravel: false, diff --git a/projects/dubble-exchange/index.js b/projects/dubble-exchange/index.js new file mode 100644 index 00000000000..90f0e199ce4 --- /dev/null +++ b/projects/dubble-exchange/index.js @@ -0,0 +1,14 @@ +const VAULT_CONTRACT = "0xD522395dfD017F47a932D788eC7CB058aDBbc783"; +const ADDRESSES = require('../helper/coreAssets.json') + +async function tvl(timestamp, block, chainBlocks, { api }) { + const bal = await api.call({ abi: 'uint256:checkBalance', target: VAULT_CONTRACT }) + api.add(ADDRESSES.arbitrum.USDC, bal) +} + +module.exports = { + misrepresentedTokens: true, + arbitrum: { + tvl + } +}; diff --git a/projects/duckydefi/index.js b/projects/duckydefi/index.js index df4fe890fe4..0c23ad6ae28 100644 --- a/projects/duckydefi/index.js +++ b/projects/duckydefi/index.js @@ -5,6 +5,6 @@ const duckyFactory = "0x796E38Bb00f39a3D39ab75297D8d6202505f52e2"; module.exports = { cronos: { - tvl: uniTvlExport(duckyFactory, "cronos") + tvl: uniTvlExport(duckyFactory, "cronos", true) } } diff --git a/projects/duet/abis/collateral-reader.json b/projects/duet/abis/collateral-reader.json index 37326e5f037..e08089101f0 100644 --- a/projects/duet/abis/collateral-reader.json +++ b/projects/duet/abis/collateral-reader.json @@ -1,31 +1,3 @@ { - "depositVaultValues": { - "inputs": [ - { - "internalType": "address[]", - "name": "_vaults", - "type": "address[]" - }, - { - "internalType": "bool", - "name": "_dp", - "type": "bool" - } - ], - "name": "depositVaultValues", - "outputs": [ - { - "internalType": "uint256[]", - "name": "amounts", - "type": "uint256[]" - }, - { - "internalType": "uint256[]", - "name": "values", - "type": "uint256[]" - } - ], - "stateMutability": "view", - "type": "function" - } -} + "depositVaultValues": "function depositVaultValues(address[] _vaults, bool _dp) view returns (uint256[] amounts, uint256[] values)" +} \ No newline at end of file diff --git a/projects/duet/abis/ebcake-reader.json b/projects/duet/abis/ebcake-reader.json new file mode 100644 index 00000000000..be7fbc9922d --- /dev/null +++ b/projects/duet/abis/ebcake-reader.json @@ -0,0 +1,3 @@ +{ + "extendableBondGroupInfo": "function extendableBondGroupInfo(string calldata groupName_) external view returns ( uint256 allEbStacked, uint256 ebCommonPriceAsUsd, uint256 duetSideAPR, uint256 underlyingSideAPR, uint256 faceUsdValue)" +} diff --git a/projects/duet/abis/pro-pool.json b/projects/duet/abis/pro-pool.json new file mode 100644 index 00000000000..0468a81a913 --- /dev/null +++ b/projects/duet/abis/pro-pool.json @@ -0,0 +1,3 @@ +{ + "liquidity": "function liquidity() view returns (int256)" +} diff --git a/projects/duet/arbitrum.js b/projects/duet/arbitrum.js new file mode 100644 index 00000000000..8e43d214688 --- /dev/null +++ b/projects/duet/arbitrum.js @@ -0,0 +1,9 @@ +const proPoolABI = require("./abis/pro-pool.json"); +const PRO_POOL_CONTRACT = "0xdE57c591de8B3675C43fB955725b62e742b1c0B4"; + +async function fetch(_, _1, _2, { api }) { + const proPoolTvl = await api.call({ abi: proPoolABI.liquidity, target: PRO_POOL_CONTRACT }) + return { 'usd-coin': proPoolTvl / 1e18 }; +} + +module.exports = fetch; diff --git a/projects/duet/bsc.js b/projects/duet/bsc.js new file mode 100644 index 00000000000..6d5a49769d6 --- /dev/null +++ b/projects/duet/bsc.js @@ -0,0 +1,68 @@ +const { getConfig } = require("../helper/cache"); +const collateralReaderContractABI = require("./abis/collateral-reader.json"); +const ebcakeReaderContractABI = require("./abis/ebcake-reader.json"); +const { getUniqueAddresses } = require('../helper/utils') + +const BigNumber = require("bignumber.js"); +const { sumTokens2 } = require("../helper/unwrapLPs"); +const { staking } = require("../helper/staking"); + +const TOKEN_LIST_URL = "https://app.duet.finance/tokens.json"; +const COLLATERAL_READER_CONTRACT = "0xFfB8FD0E5eA13bb71401B19e00f9F934746f0b7A"; +const DUET = '0x95EE03e1e2C5c4877f9A298F1C0D6c98698FAB7B' + +async function getEBCakeTvl(api) { + const EBCAKE_READER_CONTRACT = "0x243F8da5893E534CBd25220b6E277420dd9dE77B"; + const ret = await api.call({ + abi: ebcakeReaderContractABI.extendableBondGroupInfo, + target: EBCAKE_READER_CONTRACT, + params: ["yearly"] + }); + api.add('0x0e09fabb73bd3ade0a17ecc321fd13a19e81ce82', ret.allEbStacked) +} + +async function tvl(_, _1, _2, { api }) { + const ret = await getConfig("duet-fi", TOKEN_LIST_URL); + const vaultList = []; + for (const token of ret) { + if (!token.vaults || token.vaults.length < 1) { + continue; + } + vaultList.push(...token.vaults); + } + const uniqueVaults = getUniqueAddresses(vaultList + .filter((vault) => vault.dAssetsType !== "DASSETS") + .map((vault) => vault.vaultAddress && vault.vaultAddress.trim()) + .filter(i => i)) + + const tokensAndOwners = [] + const underlyings = await api.multiCall({ abi: 'address:underlying', calls: uniqueVaults }) + const underlyingMap = uniqueVaults.reduce((acc, v, i) =>{ + acc[v] = underlyings[i] + return acc + }, {}) + const pairs = await api.multiCall({ abi: 'address:pair', calls: uniqueVaults, permitFailure: true, }) + const maybeIsSingle = uniqueVaults.filter((v, i) => { + if (!pairs[i]) return true + tokensAndOwners.push([pairs[i], underlyingMap[v]]) + }) + const tokens = await api.multiCall({ abi: 'address:underlyingToken', calls: maybeIsSingle, permitFailure: true, }) + maybeIsSingle.forEach((v, i) => { + if (!tokens[i]) return; + tokensAndOwners.push([tokens[i], underlyingMap[v]]) + }) + // api.add('tether', (await getEBCakeTvl(api)) / 1e8, { skipChain: true }) + + await getEBCakeTvl(api) + return sumTokens2({ tokensAndOwners, api, resolveLP: true, blacklistedTokens: [DUET]}) + + // const tokenTvls = await api.multiCall({ abi: collateralReaderContractABI.depositVaultValues, target: COLLATERAL_READER_CONTRACT, calls: uniqueVaults.map(i => ({ params: [[i], false] })) }) + // api.add('tether', (await getEBCakeTvl(api)) / 1e8, { skipChain: true }) + // tokenTvls.forEach(v => { + // if (v) api.add('tether', v[1][0] / 1e8, { skipChain: true }) + // }) +} + +module.exports = { + tvl, staking: staking('0x29fd5bdca277eb5b8c31314e259c7feabd1badd4', DUET) +} diff --git a/projects/duet/index.js b/projects/duet/index.js index f60a7c46f9a..69ab0e1b160 100644 --- a/projects/duet/index.js +++ b/projects/duet/index.js @@ -1,56 +1,7 @@ -const axios = require("axios"); -const BigNumber = require("bignumber.js"); -const sdk = require("@defillama/sdk"); -const collateralReaderContractABI = require("./abis/collateral-reader.json"); - -const COLLATERAL_READER_CONTRACT = "0xFfB8FD0E5eA13bb71401B19e00f9F934746f0b7A"; -const TOKEN_LIST_URL = "https://app.duet.finance/tokens-v0.json"; - -async function fetch() { - const ret = await axios.get(TOKEN_LIST_URL); - const tokens = ret.data; - const vaultList = []; - for (const token of tokens) { - if (!token.vaults || token.vaults.length < 1) { - continue; - } - vaultList.push(...token.vaults); - } - const uniqueVaults = new Set( - vaultList - .filter((vault) => vault.displayPosition !== "DASSETS") - .map((vault) => vault.vaultAddress && vault.vaultAddress.trim()) - .filter(Boolean) - ); - - const tokenTvls = await Promise.all( - [...uniqueVaults].map(async (vault) => { - try { - return ( - await sdk.api.abi.call({ - abi: collateralReaderContractABI.depositVaultValues, - chain: "bsc", - target: COLLATERAL_READER_CONTRACT, - params: [[vault], false], - }) - ).output[1][0]; - } catch (e) { - return null; - } - }) - ); - - return tokenTvls - .filter(Boolean) - .reduce( - (previous, current) => new BigNumber(previous).plus(current), - new BigNumber(0) - ) - .div(Math.pow(10, 8)); -} +const bsc = require('./bsc') +const arbitrum = require('./arbitrum') module.exports = { - methodology: - "TVL is the sum of the USD value of all tokens in the staking pool", - fetch, + bsc, + arbitrum: { tvl: arbitrum }, }; diff --git a/projects/dxsale/abis.js b/projects/dxsale/abis.js index e4f2b71a69e..8e782608a38 100644 --- a/projects/dxsale/abis.js +++ b/projects/dxsale/abis.js @@ -1,200 +1,9 @@ -const getStorageLPLockDataV33 ={ - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "AllLockRecord", - "outputs": [ - { - "internalType": "uint256", - "name": "createdOn", - "type": "uint256" - }, - { - "internalType": "address", - "name": "lockOwner", - "type": "address" - }, - { - "internalType": "address", - "name": "lockedLPTokens", - "type": "address" - }, - { - "internalType": "uint256", - "name": "lockTime", - "type": "uint256" - }, - { - "internalType": "address", - "name": "lpLockContract", - "type": "address" - }, - { - "internalType": "bool", - "name": "locked", - "type": "bool" - }, - { - "internalType": "string", - "name": "logo", - "type": "string" - }, - { - "internalType": "uint256", - "name": "lockedAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "countID", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "exists", - "type": "bool" - }, - { - "internalType": "address", - "name": "token0Addr", - "type": "address" - }, - { - "internalType": "address", - "name": "token1Addr", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" -} - -const getStorageLockCountV33 = { - inputs: [], - name: "lockerIDCount", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", -}; - -const getLockCountPerContractV3 = { - inputs: [], - name: "lockerNumberOpen", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", -}; - -const getLockerWalletWithIdV3 = { - inputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - name: "LockerRecord", - outputs: [ - { - internalType: "address", - name: "", - type: "address", - }, - ], - stateMutability: "view", - type: "function", -}; - -const getLockerLPDataV3 = { - inputs: [ - { - internalType: "address", - name: "", - type: "address", - }, - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - name: "DXLOCKERLP", - outputs: [ - { - internalType: "bool", - name: "exists", - type: "bool", - }, - { - internalType: "bool", - name: "locked", - type: "bool", - }, - { - internalType: "string", - name: "logo", - type: "string", - }, - { - internalType: "uint256", - name: "lockedAmount", - type: "uint256", - }, - { - internalType: "uint256", - name: "lockedTime", - type: "uint256", - }, - { - internalType: "uint256", - name: "startTime", - type: "uint256", - }, - { - internalType: "address", - name: "lpAddress", - type: "address", - }, - ], - stateMutability: "view", - type: "function", -}; - -const getLockerPerWalletV3 = { - inputs: [ - { - internalType: "address", - name: "", - type: "address", - }, - ], - name: "UserLockerCount", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", -}; +const getStorageLPLockDataV33 ='function AllLockRecord(uint256) view returns (uint256 createdOn, address lockOwner, address lockedLPTokens, uint256 lockTime, address lpLockContract, bool locked, string logo, uint256 lockedAmount, uint256 countID, bool exists, address token0Addr, address token1Addr)' +const getStorageLockCountV33 = "uint256:lockerIDCount"; +const getLockCountPerContractV3 = "uint256:lockerNumberOpen" +const getLockerWalletWithIdV3 = 'function LockerRecord(uint256) view returns (address)'; +const getLockerLPDataV3 = 'function DXLOCKERLP(address, uint256) view returns (bool exists, bool locked, string logo, uint256 lockedAmount, uint256 lockedTime, uint256 startTime, address lpAddress)'; +const getLockerPerWalletV3 = 'function UserLockerCount(address) view returns (uint256)'; module.exports = { getStorageLPLockDataV33, diff --git a/projects/dxsale/api.js b/projects/dxsale/api.js index 1e0a5713ba5..a1e654b0180 100644 --- a/projects/dxsale/api.js +++ b/projects/dxsale/api.js @@ -3,6 +3,9 @@ const indexExports = require('./index') const chainKeys = Object.keys(indexExports).filter(chain => typeof indexExports[chain] === 'object' && indexExports[chain].tvl) module.exports = { + hallmarks: [ + // [Math.floor(new Date('2023-03-13') / 1e3), 'Fixed bug that inflated tvl'], +], timetravel: false, misrepresentedTokens: true, ...getExports("dxsale", chainKeys), diff --git a/projects/dxsale/apiCache.js b/projects/dxsale/apiCache.js index 7ea4217622d..845eec7c261 100644 --- a/projects/dxsale/apiCache.js +++ b/projects/dxsale/apiCache.js @@ -16,6 +16,10 @@ const { moonriverArchives, milkomedaArchives, smartbchArchives, + dogeArchives, + dexitArchives, + coreDaoArchives, + bitgertArchives, } = require("./config"); const { getStorageLPLockDataV33, @@ -25,16 +29,17 @@ const { getLockerLPDataV3, getStorageLockCountV33, } = require("./abis"); -const { sumUnknownTokens, vestingHelper, getCache, setCache, } = require("../helper/cache"); +const { getCache, setCache, } = require("../helper/cache") +const { vestingHelper, sumUnknownTokens, } = require("../helper/unknownTokens") -const project = 'dxsale' +const project = 'bulky/dxsale' function getTVLTotal(args) { return async (timestamp, ethBlock, chainBlocks) => { let balances = {}; const chain = args.chain; const block = chainBlocks[chain]; - const cache = getCache(project, chain) || {} + const cache = await getCache(project, chain) || {} if (!cache.v3LPData) cache.v3LPData = [] if (!cache.lockContracts) cache.lockContracts = {} @@ -44,7 +49,7 @@ function getTVLTotal(args) { for (const lock of args.locks) await addlockLPs(lock) - setCache(project, chain, cache) + await setCache(project, chain, cache) return balances; async function addlockLPs(lockContract) { @@ -143,7 +148,7 @@ function getTVLTotal(args) { lpData.forEach(({ output: { lockedLPTokens, lpLockContract } }) => cache.v3LPData.push([lockedLPTokens, lpLockContract])) } - const tempBalances = await sumUnknownTokens({ chain, block, tokensAndOwners: cache.v3LPData, useDefaultCoreAssets: true, balances, cache, }) + const tempBalances = await sumUnknownTokens({ chain, block, tokensAndOwners: cache.v3LPData, useDefaultCoreAssets: true, cache, }) Object.entries(tempBalances).forEach(([token, bal]) => sdk.util.sumSingleBalance(balances, token, bal)) } @@ -199,4 +204,18 @@ module.exports = { smartbch: { tvl: getTVLTotal(smartbchArchives), }, + dogechain: { + tvl: getTVLTotal(dogeArchives), + }, + dexit: { + tvl: getTVLTotal(dexitArchives), + }, + core: { + tvl: getTVLTotal(coreDaoArchives), + }, + bitgert: { + tvl: getTVLTotal(bitgertArchives), + } }; + +module.exports.dexit.tvl = () => ({}) diff --git a/projects/dxsale/config.js b/projects/dxsale/config.js index d5d1cd52b7e..9bf4a73bdb3 100644 --- a/projects/dxsale/config.js +++ b/projects/dxsale/config.js @@ -131,7 +131,6 @@ const LockerV33 = { // "0xFEE2A3f4329e9A1828F46927bD424DB2C1624985", ], }, - heco: { tokenStorage: ["0x983b00a2C3d8925cEDfC9f3eb5Df1aE121Ff6B9F"], lpStorage: ["0xFEE2A3f4329e9A1828F46927bD424DB2C1624985"], @@ -144,6 +143,22 @@ const LockerV33 = { tokenStorage: ["0x983b00a2C3d8925cEDfC9f3eb5Df1aE121Ff6B9F"], lpStorage: ["0x6E573D464416a81A9F82207F1dFD6a42e4b21066"], }, + bitgert: { + tokenStorage: ["0x5AB541B972Acab91f0E5E7d30fCB4fe8e81b9Fa7"], + lpStorage: ["0x16AAF57c5b3170a143A6A2DDfe897e8a2bDd8FD1"], + }, + dexit: { + tokenStorage: ["0x17e8c87d4de42fc143507B7c45Da2e6F2af7F24F"], + lpStorage: ["0x0dDdD88aff5b7082BEf86923cf19BAd1ffb4EC8C"], + }, + coreDao: { + tokenStorage: ["0x17e8c87d4de42fc143507B7c45Da2e6F2af7F24F"], + lpStorage: ["0x0dDdD88aff5b7082BEf86923cf19BAd1ffb4EC8C"], + }, + doge: { + tokenStorage: ["0x17e8c87d4de42fc143507B7c45Da2e6F2af7F24F"], + lpStorage: ["0x0dDdD88aff5b7082BEf86923cf19BAd1ffb4EC8C"], + }, }; const protocolPairs = { @@ -273,6 +288,34 @@ const milkomedaArchives = { storageLiquidityLocks: LockerV33.milkomeda.lpStorage, }; +const bitgertArchives = { + chain: "bitgert", + locks: [], + storageTokenLocks: LockerV33.bitgert.tokenStorage, + storageLiquidityLocks: LockerV33.bitgert.lpStorage, +}; + +const dexitArchives = { + chain: "dexit", + locks: [], + storageTokenLocks: LockerV33.dexit.tokenStorage, + storageLiquidityLocks: LockerV33.dexit.lpStorage, +}; + +const coreDaoArchives = { + chain: "core", + locks: [], + storageTokenLocks: LockerV33.coreDao.tokenStorage, + storageLiquidityLocks: LockerV33.coreDao.lpStorage, +}; + +const dogeArchives = { + chain: "dogechain", + locks: [], + storageTokenLocks: LockerV33.doge.tokenStorage, + storageLiquidityLocks: LockerV33.doge.lpStorage, +}; + module.exports = { milkomedaArchives, smartbchArchives, @@ -290,4 +333,8 @@ module.exports = { avaxArchives, xdaiArchives, fantomArchives, + bitgertArchives, + dexitArchives, + coreDaoArchives, + dogeArchives, }; diff --git a/projects/dxsale/index.js b/projects/dxsale/index.js index ce3f0bdbff3..b13f4b6ad42 100644 --- a/projects/dxsale/index.js +++ b/projects/dxsale/index.js @@ -16,6 +16,10 @@ const { moonriverArchives, milkomedaArchives, smartbchArchives, + dogeArchives, + dexitArchives, + coreDaoArchives, + bitgertArchives, } = require("./config"); const { getStorageLPLockDataV33, @@ -116,7 +120,7 @@ function getTVLTotal(args) { lpData.forEach(({ output: { lockedLPTokens, lpLockContract } }) => tokensAndOwners.push([lockedLPTokens, lpLockContract])) } - const tempBalances = await sumUnknownTokens({ chain, block, tokensAndOwners, useDefaultCoreAssets: true, balances, }) + const tempBalances = await sumUnknownTokens({ chain, block, tokensAndOwners, useDefaultCoreAssets: true, }) Object.entries(tempBalances).forEach(([token, bal]) => sdk.util.sumSingleBalance(balances, token, bal)) } @@ -172,4 +176,18 @@ module.exports = { smartbch: { tvl: getTVLTotal(smartbchArchives), }, + dogechain: { + tvl: getTVLTotal(dogeArchives), + }, + dexit: { + tvl: getTVLTotal(dexitArchives), + }, + core: { + tvl: getTVLTotal(coreDaoArchives), + }, + bitgert: { + tvl: getTVLTotal(bitgertArchives), + } }; + +module.exports.dexit.tvl = () => ({}) \ No newline at end of file diff --git a/projects/dyad/index.js b/projects/dyad/index.js new file mode 100644 index 00000000000..e3fd5854153 --- /dev/null +++ b/projects/dyad/index.js @@ -0,0 +1,23 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const sdk = require("@defillama/sdk"); + + +async function tvl(_timestamp, block) { + return { + [ADDRESSES.null]: ( + await sdk.api.eth.getBalance({ + target: "0xdc400bbe0b8b79c07a962ea99a642f5819e3b712", + block, + }) + ).output, + }; +} + +module.exports = { + ethereum: { + tvl, + }, +}; + + + diff --git a/projects/dydx/index.js b/projects/dydx/index.js index 0e173d45b1e..eb26b94f880 100644 --- a/projects/dydx/index.js +++ b/projects/dydx/index.js @@ -1,7 +1,6 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk'); - const BigNumber = require("bignumber.js"); - const contracts = [ '0x5199071825CC1d6cd019B0D7D42B08106f6CF16D', '0x1e0447b19bb6ecfdae1e4ae1694b0c3659614e4e', @@ -9,10 +8,10 @@ ]; const tokens = [ - '0x89d24A6b4CcB1B6fAA2625fE562bDD9a23260359', - '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', - '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', - '0x6B175474E89094C44Da98b954EedeAC495271d0F' + ADDRESSES.ethereum.SAI, + ADDRESSES.ethereum.WETH, + ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.DAI ]; async function tvl (timestamp, block) { diff --git a/projects/dynastyswap-xyz/index.js b/projects/dynastyswap-xyz/index.js new file mode 100644 index 00000000000..448503aa1bf --- /dev/null +++ b/projects/dynastyswap-xyz/index.js @@ -0,0 +1,8 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports = { + misrepresentedTokens: true, + pulse: { + tvl: getUniTVL({ factory: '0x7abcEc2e35505aF1720431A6c414067717342B1F', useDefaultCoreAssets: true, fetchBalances: true, }), + }, +}; // node test.js projects/pulsex/index.js \ No newline at end of file diff --git a/projects/dypius/index.js b/projects/dypius/index.js new file mode 100644 index 00000000000..f7025dbb844 --- /dev/null +++ b/projects/dypius/index.js @@ -0,0 +1,86 @@ +const { stakings } = require("../helper/staking"); + +const stakingContractsBSC = [ + // stakingContract1 = + "0x7c82513b69c1b42c23760cfc34234558119a3399", + // stakingContract2 = + "0xef9e50A19358CCC8816d9BC2c2355aea596efd06", + // stakingContract3 = + "0xa9efab22cCbfeAbB6dc4583d81421e76342faf8b", + // stakingContract4 = + "0xfc4493E85fD5424456f22135DB6864Dd4E4ED662", + // stakingContract5 = + "0xaF411BF994dA1435A3150B874395B86376C5f2d5", + // stakingContract6 = + "0xf13aDbEb27ea9d9469D95e925e56a1CF79c06E90", + // stakingContract7 = + "0x160fF3c4A6E9Aa8E4271aa71226Cc811BFEf7ED9", + // stakingContract8 = + "0x4C04E53f9aAa17fc2C914694B4Aae57a9d1bE445", + // stakingContract9 = + "0x58366902082B90Fca01bE07D929478bD48AcFB19", + +]; + +const stakingContractsETH = [ + // stakingContract1 = + "0x50014432772b4123D04181727C6EdEAB34F5F988", + // stakingContract2 = + "0x9eA966B4023049BFF858BB5E698ECfF24EA54c4A", + // stakingContract3 = + "0xD4bE7a106ed193BEe39D6389a481ec76027B2660", + // stakingContract4 = + "0x3fAb09ACAeDDAF579d7a72c24Ef3e9EB1D2975c4", + // stakingContract5 = + "0xa4da28B8e42680916b557459D338aF6e2D8d458f", + // stakingContract6 = + "0x8A30Be7B2780b503ff27dBeaCdecC4Fe2587Af5d", + // stakingContract7 = + "0x44bEd8ea3296bda44870d0Da98575520De1735d4", + // stakingContract8 = + "0xeb7dd6b50db34f7ff14898d0be57a99a9f158c4d", + ]; + +const stakingContractsAVAX = [ + // stakingContract1 = + "0xaF411BF994dA1435A3150B874395B86376C5f2d5", + // stakingContract2 = + "0x8f28110325a727f70B64bffEbf2B9dc94B932452", + // stakingContract3 = + "0xd13bdC0c9a9931cF959739631B1290b6BEE0c018", + // stakingContract4 = + "0x5536E02336771CFa0317D4B6a042f3c38749535e", + // stakingContract5 = + "0x1A4fd0E9046aeD92B6344F17B0a53969F4d5309B", + // stakingContract6 = + "0x5566B51a1B7D5E6CAC57a68182C63Cb615cAf3f9", + // stakingContract7 = + "0xb1875eeBbcF4456188968f439896053809698a8B", + // stakingContract8 = + "0x16429e51A64B7f88D4C018fbf66266A693df64b3", + // stakingContract9 = + "0xF035ec2562fbc4963e8c1c63f5c473D9696c59E3", + // stakingContract10 = + "0x6eb643813f0b4351b993f98bdeaef6e0f79573e9", +]; + +const DYP = "0x961C8c0B1aaD0c0b10a51FeF6a867E3091BCef17"; + +module.exports = { + misrepresentedTokens: true, + bsc: { + staking: stakings(stakingContractsBSC, DYP), + tvl: (async) => ({}), + }, + ethereum: { + staking: stakings(stakingContractsETH, DYP), + tvl: (async) => ({}), + }, + avax: { + staking: stakings(stakingContractsAVAX, DYP), + tvl: (async) => ({}), + }, + + methodology: "Counts liquidity on the DYP staking contracts", + +}; \ No newline at end of file diff --git a/projects/dyson-money/index.js b/projects/dyson-money/index.js new file mode 100644 index 00000000000..69ae31abaf6 --- /dev/null +++ b/projects/dyson-money/index.js @@ -0,0 +1,78 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { staking } = require('../helper/staking') +const { sumTokens2 } = require('../helper/unwrapLPs'); +const utils = require('../helper/utils'); +const { toUSDTBalances } = require('../helper/balances'); + +const sphere_token = "0x62F594339830b90AE4C084aE7D223fFAFd9658A7" +const ylSPHEREvault = "0x4Af613f297ab00361D516454E5E46bc895889653" + +async function polygonTvl(timestamp, block, chainBlocks) { + let balances = {}; + + // add tokens in ylSPHERE vault + await sumTokens2({ + balances, + owners: [ylSPHEREvault], + tokens: [ + ADDRESSES.polygon.WMATIC_2, + ADDRESSES.polygon.USDC, + ADDRESSES.polygon.WETH_1, + ADDRESSES.polygon.USDT, + ADDRESSES.polygon.WBTC, + "0x172370d5Cd63279eFa6d502DAB29171933a610AF" + ], + chain: 'polygon', + block: chainBlocks.polygon + }) + + // calculate TVL for polygon from API + const dysonTvl = await fetchChain(137)() + for (const [token, balance] of Object.entries(dysonTvl)) { + balances[token] = (balances[token] || 0) + balance + } + return balances; +} + +let _response + +function fetchChain(chainId) { + return async () => { + if (!_response) _response = utils.fetchURL('https://api.dyson.money/tvl') + const response = await _response; + + let tvl = 0; + const chain = response.data[chainId]; + for (const vault in chain) { + tvl += Number(chain[vault]); + } + + if (tvl === 0) { + throw new Error(`chain ${chainId} tvl is 0`) + } + + return toUSDTBalances(tvl); + } +} + +module.exports = { + doublecounted: true, + misrepresentedTokens: false, + methodology: "TVL is calculated by summing the liquidity in the Uniswap V3 pools.", + polygon: { + tvl: polygonTvl, + staking: staking(ylSPHEREvault, sphere_token, "polygon") + }, + optimism: { + tvl: fetchChain(10), + }, + arbitrum: { + tvl: fetchChain(42161), + }, + bsc: { + tvl: fetchChain(56) + }, + avax: { + tvl: fetchChain(43114) + } +}; diff --git a/projects/dystopia/index.js b/projects/dystopia/index.js index 7b74ccc5b70..fcce6568b2d 100644 --- a/projects/dystopia/index.js +++ b/projects/dystopia/index.js @@ -1,7 +1,13 @@ -const {uniTvlExport} = require('../helper/calculateUniTvl.js') +const {getUniTVL} = require('../helper/unknownTokens') module.exports = { + misrepresentedTokens: true, polygon:{ - tvl: uniTvlExport("0x1d21Db6cde1b18c7E47B0F7F42f4b3F68b9beeC9", "polygon"), + tvl: getUniTVL({ + factory: '0x1d21Db6cde1b18c7E47B0F7F42f4b3F68b9beeC9', + useDefaultCoreAssets: true, + hasStablePools: true, + }) }, } + diff --git a/projects/earnifty/abis/vault.json b/projects/earnifty/abis/vault.json index 7a52f2f13ad..b3db7ee12c8 100644 --- a/projects/earnifty/abis/vault.json +++ b/projects/earnifty/abis/vault.json @@ -1,13 +1 @@ -{ - "inputs": [], - "name": "balance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" -} \ No newline at end of file +"uint256:balance" \ No newline at end of file diff --git a/projects/earnifty/index.js b/projects/earnifty/index.js index 07391127251..bc54e714028 100644 --- a/projects/earnifty/index.js +++ b/projects/earnifty/index.js @@ -29,7 +29,7 @@ async function tvl(timestamp, block, chainBlocks) { ); } return balances; -}; +} module.exports = { diff --git a/projects/ease/index.js b/projects/ease/index.js index dd3b9ec7d1a..a85cd890980 100644 --- a/projects/ease/index.js +++ b/projects/ease/index.js @@ -1,7 +1,7 @@ const sdk = require('@defillama/sdk'); -const axios = require("axios"); const { default: BigNumber } = require('bignumber.js'); const { stakings } = require("../helper/staking"); +const { getConfig } = require('../helper/cache') const VAULT_LIST_URL = 'https://devapi.ease.org/api/v1/vaults'; const EASE = "0xEa5eDef1287AfDF9Eb8A46f9773AbFc10820c61c"; @@ -16,58 +16,28 @@ const STAKING_CONTRACTS = [ const RCA_SHIELD = { abis: { - uBalance: { - constant: true, - inputs: [], - name: "uBalance", - outputs: [{ internalType: "uint256", name: "", type: "uint256" }], - payable: false, - stateMutability: "view", - type: "function", - }, + uBalance: "uint256:uBalance" }, }; const ARNXM_VAULT = { abis: { - aum: { - constant: true, - inputs: [], - name: "aum", - outputs: [{ internalType: "uint256", name: "aumTotal", type: "uint256" }], - payable: false, - stateMutability: "view", - type: "function", - }, + aum: "uint256:aum", }, address: "0x1337DEF1FC06783D4b03CB8C1Bf3EBf7D0593FC4", } -async function tvl(_, block) { +async function tvl(_, block, _1, { api }) { //get TVL of Uninsurance vaults - let resp = await axios.get(VAULT_LIST_URL); - let vaults = resp.data - const balances = {}; - const { output: bal } = await sdk.api.abi.multiCall({ - abi: RCA_SHIELD.abis.uBalance, - calls: vaults.map(i => ({ target: i.address })), - block, - }) - bal.forEach(({ output}, i) => { - const { decimals, token, address } = vaults[i] - const fixDecimals = 10 ** (decimals - token.decimals) - sdk.util.sumSingleBalance(balances, token.address, BigNumber( output / fixDecimals).toFixed(0)); - }) - + let resp = await getConfig('ease', VAULT_LIST_URL); + let vaults = resp.map(i => i.address.toLowerCase()).filter(i => i !== '0x8f247eb2d71beeacdf212f8bc748f09cdf7144c0') + const bals = await api.multiCall({ abi: 'uint256:uBalance', calls: vaults }) + const tokens = await api.multiCall({ abi: 'address:uToken', calls: vaults }) + const decimals = await api.multiCall({ abi: 'erc20:decimals', calls: tokens }) + api.addTokens(tokens, bals.map((v, i) => v / 10 ** (18 - decimals[i]))) //get TVL of arNXM vault - const { output: balNXM } = await sdk.api.abi.call({ - target: ARNXM_VAULT.address, - abi: ARNXM_VAULT.abis.aum, - block, - }); - sdk.util.sumSingleBalance(balances, NXM, balNXM) - - return balances; + const balNXM = await api.call({ target: ARNXM_VAULT.address, abi: ARNXM_VAULT.abis.aum, }); + api.add(NXM, balNXM) } module.exports = { diff --git a/projects/eazyswap/index.js b/projects/eazyswap/index.js new file mode 100644 index 00000000000..6dbb1f61f11 --- /dev/null +++ b/projects/eazyswap/index.js @@ -0,0 +1,15 @@ +const { getUniTVL, sumTokensExport } = require('../helper/unknownTokens') +const EAZY_TOKEN = "0x6cF99BAA0a4d079F960216d08cf9a1Bc7e4dd37C"; +module.exports = { + misrepresentedTokens: true, + methodology: "Factory address (0xbeE82c502eC48a962510Aa4505595259C3ba631f) is used to find the LP pairs. TVL is equal to the liquidity on the AMM. Staking balance is equal to the balance of $EAZY in $xEAZY contract", + pulse: { + tvl: getUniTVL({ factory: '0xbeE82c502eC48a962510Aa4505595259C3ba631f', useDefaultCoreAssets: true }), + staking: sumTokensExport({ + owners: ['0x23E1Be43887641E8c0EB9938FaB9D6539438115a'], + tokens: [EAZY_TOKEN], + }) + } +}; + + diff --git a/projects/echidna/abi.json b/projects/echidna/abi.json index 9e480d8e7dc..32aba370fc3 100644 --- a/projects/echidna/abi.json +++ b/projects/echidna/abi.json @@ -1,120 +1,8 @@ { - "userInfo": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "userInfo", - "outputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "rewardDebt", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "poolLength": { - "inputs": [], - "name": "poolLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "poolInfo": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "poolInfo", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "lpToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "allocPoint", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastRewardTimestamp", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accPtpPerShare", - "type": "uint256" - }, - { - "internalType": "contract IRewarder", - "name": "rewarder", - "type": "address" - }, - { - "internalType": "uint256", - "name": "sumOfFactors", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accPtpPerFactorShare", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "totalSupply": { - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "underlyingBalance": {"inputs":[],"name":"underlyingTokenBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}, - "underlyingToken": { - "inputs": [], - "name": "underlyingToken", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } + "userInfo": "function userInfo(uint256, address) view returns (uint256 amount, uint256 rewardDebt)", + "poolLength": "uint256:poolLength", + "poolInfo": "function poolInfo(uint256) view returns (address lpToken, uint256 allocPoint, uint256 lastRewardTimestamp, uint256 accPtpPerShare, address rewarder, uint256 sumOfFactors, uint256 accPtpPerFactorShare)", + "totalSupply": "uint256:totalSupply", + "underlyingBalance": "uint256:underlyingTokenBalance", + "underlyingToken": "address:underlyingToken" } \ No newline at end of file diff --git a/projects/echidna/index.js b/projects/echidna/index.js index a48a6640a75..d40aaa5831e 100644 --- a/projects/echidna/index.js +++ b/projects/echidna/index.js @@ -1,6 +1,5 @@ const sdk = require("@defillama/sdk"); const { default: BigNumber } = require("bignumber.js"); -const { transformAvaxAddress } = require("../helper/portedTokens"); const abi = require("./abi.json"); const depositor = '0xC204501F33eC40B8610BB2D753Dd540Ec6EA2646'; const { pool2s } = require("../helper/pool2"); @@ -67,19 +66,19 @@ async function addMasterchefFunds(balances, masterChef, block, transform){ transform(underlyingToken[i].output), BigNumber(userInfo[i].output.amount).times(underlyingBalance[i].output).div(totalSupply[i].output).toFixed(0) ); - }; + } } async function tvl(timestamp, ethBlock, chainBlocks) { const balances = {}; - const transform = await transformAvaxAddress(); + const transform = addr => 'avax:'+addr; const block = chainBlocks.avax await addMasterchefFunds(balances, "0xb0523f9f473812fb195ee49bc7d2ab9873a98044", block, transform) await addMasterchefFunds(balances, "0x68c5f4374228BEEdFa078e77b5ed93C28a2f713E", block, transform) const vePTPRate = await sdk.api.abi.call({ target: '0x5857019c749147EEE22b1Fe63500F237F3c1B692', - abi: {"inputs":[],"name":"generationRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}, + abi: 'uint256:generationRate', block: block, chain: "avax" }) @@ -93,7 +92,7 @@ async function tvl(timestamp, ethBlock, chainBlocks) { })).output).div(vePTPRate.output).times(1e12).toFixed(0); return balances; -}; +} const pool2LPs = ["0x218e6A0AD170460F93eA784FbcC92B57DF13316E","0xc8898e2eEE8a1d08742bb3173311697966451F61"] @@ -101,7 +100,7 @@ module.exports = { doublecounted: true, avax: { tvl, - pool2: pool2s(["0xc9AA91645C3a400246B9D16c8d648F5dcEC6d1c8"], pool2LPs, "avax", addr=>`avax:${addr}`), - staking: staking("0x721C2c768635D2b0147552861a0D8FDfde55C032","0xeb8343D5284CaEc921F035207ca94DB6BAaaCBcd", "avax") + pool2: pool2s(["0xc9AA91645C3a400246B9D16c8d648F5dcEC6d1c8"], pool2LPs), + staking: staking("0x721C2c768635D2b0147552861a0D8FDfde55C032","0xeb8343D5284CaEc921F035207ca94DB6BAaaCBcd") } }; \ No newline at end of file diff --git a/projects/echodex/index.js b/projects/echodex/index.js new file mode 100644 index 00000000000..47eec9b7c35 --- /dev/null +++ b/projects/echodex/index.js @@ -0,0 +1,6 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports = { + misrepresentedTokens: true, + linea: { tvl: getUniTVL({ factory: '0x6D1063F2187442Cc9adbFAD2f55A96B846FCB399', useDefaultCoreAssets: true, fetchBalances: true }), }, +} diff --git a/projects/echswap/index.js b/projects/echswap/index.js index 83a8b908927..751dcffd946 100644 --- a/projects/echswap/index.js +++ b/projects/echswap/index.js @@ -2,7 +2,10 @@ const { getUniTVL } = require('../helper/unknownTokens') module.exports = { misrepresentedTokens: true, + hallmarks: [ + [1671062400, "Rug Pull"] + ], echelon: { - tvl: getUniTVL({ chain: 'echelon', useDefaultCoreAssets: true, factory: '0xaFd37A86044528010d0E70cDc58d0A9B5Eb03206' }) + tvl: () => ({}), } } \ No newline at end of file diff --git a/projects/ecodefi/babyRouterAbi.json b/projects/ecodefi/babyRouterAbi.json index 6713d0c4c5f..006d61628fb 100644 --- a/projects/ecodefi/babyRouterAbi.json +++ b/projects/ecodefi/babyRouterAbi.json @@ -1 +1,3 @@ -{"getAmountsOut":{"inputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"address[]","name":"path","type":"address[]"}],"name":"getAmountsOut","outputs":[{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"stateMutability":"view","type":"function"}} +{ + "getAmountsOut": "function getAmountsOut(uint256 amountIn, address[] path) view returns (uint256[] amounts)" +} \ No newline at end of file diff --git a/projects/ecodefi/index.js b/projects/ecodefi/index.js index f9c1d8a36c0..8d4487abc80 100644 --- a/projects/ecodefi/index.js +++ b/projects/ecodefi/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk'); const BigNumber = require('bignumber.js'); const stakingAbi = require('./stakingAbi.json'); @@ -20,7 +21,7 @@ let BabySwapRouter = { } let USDT = { - "bsc": "0x55d398326f99059fF775485246999027B3197955", // USDT in BSC + "bsc": ADDRESSES.bsc.USDT, // USDT in BSC } /*================================================== TVL diff --git a/projects/ecodefi/stakingAbi.json b/projects/ecodefi/stakingAbi.json index 256e671af3d..d53b0b9ee94 100644 --- a/projects/ecodefi/stakingAbi.json +++ b/projects/ecodefi/stakingAbi.json @@ -1 +1,3 @@ -{"total_deposited":{"constant":true,"inputs":[],"name":"total_deposited","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"}} +{ + "total_deposited": "uint256:total_deposited" +} \ No newline at end of file diff --git a/projects/eigenlayer/index.js b/projects/eigenlayer/index.js new file mode 100644 index 00000000000..8e0ed8e7999 --- /dev/null +++ b/projects/eigenlayer/index.js @@ -0,0 +1,34 @@ +const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') +const { getLogs } = require('../helper/cache/getLogs') + +async function tvl(_, _b, _cb, { api, }) { + const logs = await getLogs({ + api, + target: '0x858646372CC42E1A627fcE94aa7A7033e7CF075A', + topic: 'StrategyAddedToDepositWhitelist(address)', + eventAbi: "event StrategyAddedToDepositWhitelist(address strategy)", + onlyArgs: true, + fromBlock: 17445564, + }) + const podLogs = await getLogs({ + api, + target: '0x91E677b07F7AF907ec9a428aafA9fc14a0d3A338', + topics: ['0x21c99d0db02213c32fff5b05cf0a718ab5f858802b91498f80d82270289d856a'], + eventAbi: "event PodDeployed (address indexed eigenPod, address indexed podOwner)", + onlyArgs: true, + fromBlock: 17445564, + }) + const strategies = logs.map(log => log.strategy) + const pods = podLogs.map(log => log.eigenPod) + const restakedStatus = await api.multiCall({ abi: 'bool:hasRestaked', calls: pods }) + restakedStatus.filter(i => i).forEach(() => api.add(nullAddress, 32 * 1e18)) + const tokens = await api.multiCall({ abi: 'address:underlyingToken', calls: strategies }) + return sumTokens2({ api, tokensAndOwners2: [tokens, strategies] }) +} + +// https://github.com/Layr-Labs/eigenlayer-contracts/blob/master/script/output/M1_deployment_mainnet_2023_6_9.json +module.exports = { + ethereum: { + tvl, + }, +} \ No newline at end of file diff --git a/projects/eklipse/index.js b/projects/eklipse/index.js index 5a6a8d6d2cd..e67d2091f27 100644 --- a/projects/eklipse/index.js +++ b/projects/eklipse/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk') const BigNumber = require('bignumber.js') const { getChainTransform, getFixBalances, } = require('../helper/portedTokens') @@ -7,7 +8,7 @@ const vaults = require('./vaults') const chain = 'klaytn' const EKL_TOKEN = '0x807c4e063eb0ac21e8eef7623a6ed50a8ede58ca' const STAKING_ADDRESS = '0xD067C3b871ee9E07BA4205A8F96c182baBBA6c58' -const USDT_TOKEN = '0xceE8FAF64bB97a73bb51E115Aa89C17FfA8dD167' +const USDT_TOKEN = ADDRESSES.klaytn.oUSDT const POOL2_ADDRESS = '0x625ae9043e8730c4a1e30b36838502fb90e1d3c2' const USDT_PAIR = '0x219ee5d76593f5bd639125b6411a17d309e3ad31' const KLAY_PAIR = '0x5db231ac93faaad876155dc0853bb11a2f4b0fb2' @@ -15,23 +16,23 @@ const W_KLAY_ADDRESS = '0xd7a4d10070a4f7bc2a015e78244ea137398c3b74' const TOKENS = { kDAI: { - address: '0x5c74070fdea071359b86082bd9f9b3deaafbe32b', + address: ADDRESSES.klaytn.KDAI, decimal: 18 }, kBUSD: { - address: '0x210bc03f49052169d5588a52c317f71cf2078b85', + address: ADDRESSES.klaytn.oBUSD, decimal: 18 }, kUSDC: { decimal: 6, - address: '0x754288077d0ff82af7a5317c7cb8c444d421d103' + address: ADDRESSES.klaytn.oUSDC }, KSD: { - address: '0x4fa62f1f404188ce860c8f0041d6ac3765a72e67', + address: ADDRESSES.klaytn.KSD, decimal: 18 }, KASH: { - address: '0xce40569d65106c32550626822b91565643c07823', + address: ADDRESSES.klaytn.KASH, decimal: 18 }, EKL: { @@ -40,15 +41,15 @@ const TOKENS = { }, kUSDT: { decimal: 6, - address: '0xcee8faf64bb97a73bb51e115aa89c17ffa8dd167' + address: ADDRESSES.klaytn.oUSDT }, pUSD: { decimal: 18, - address: '0x168439b5eebe8c83db9eef44a0d76c6f54767ae4' + address: ADDRESSES.klaytn.pUSD }, USDK: { decimal: 18, - address: '0xd2137fdf10bd9e4e850c17539eb24cfe28777753' + address: ADDRESSES.klaytn.USDK } } diff --git a/projects/elasticswap/index.js b/projects/elasticswap/index.js index 2bb94051983..eee57828e35 100644 --- a/projects/elasticswap/index.js +++ b/projects/elasticswap/index.js @@ -1,22 +1,11 @@ const sdk = require("@defillama/sdk"); const { stakings } = require("../helper/staking") const { sumTokens2 } = require('../helper/unwrapLPs') +const { getLogs } = require('../helper/cache/getLogs') -const BaseTokenAbi = { - inputs: [], - name: "baseToken", - outputs: [{ internalType: "address", name: "", type: "address" }], - stateMutability: "view", - type: "function", -}; +const BaseTokenAbi = "address:baseToken" -const QuoteTokenAbi = { - inputs: [], - name: "quoteToken", - outputs: [{ internalType: "address", name: "", type: "address" }], - stateMutability: "view", - type: "function", -}; +const QuoteTokenAbi = "address:quoteToken" // addresses grabbed from https://docs.elasticswap.org/resources/deployments const config = { @@ -40,6 +29,9 @@ const config = { } module.exports = { + hallmarks: [ + [1670889600,"Price Oracle Attack"] + ], methodology: "TVL of Elastic Swap consists of liquidity pools and native token staking. Data fetched from on-chain.", }; @@ -47,21 +39,19 @@ module.exports = { Object.keys(config).forEach(chain => { const { startBlock, factory, stakingPools, ticToken, } = config[chain] module.exports[chain] = { - tvl: async (_, _b, { [chain]: block }) => { + tvl: async (_, _b, { [chain]: block }, { api }) => { let { pairAddresses = [] } = config[chain] if (startBlock) { pairAddresses = [] const logs = ( - await sdk.api.util.getLogs({ - keys: [], - toBlock: block, + await getLogs({ + api, target: factory, fromBlock: startBlock, - chain, topic: 'NewExchange(address,address)', }) - ).output + ) for (let log of logs) pairAddresses.push(`0x${log.topics[2].substr(-40)}`.toLowerCase()) diff --git a/projects/electrikfinance/abi/addressBook.json b/projects/electrikfinance/abi/addressBook.json deleted file mode 100644 index 370632f18a6..00000000000 --- a/projects/electrikfinance/abi/addressBook.json +++ /dev/null @@ -1,144 +0,0 @@ -[ - { - "inputs": [ - { - "internalType": "address", - "name": "_poolStat", - "type": "address" - }, - { - "internalType": "address", - "name": "_vault", - "type": "address" - }, - { - "internalType": "bool", - "name": "_isActive", - "type": "bool" - } - ], - "name": "addAddressBook", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address[]", - "name": "_poolStats", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "_vaults", - "type": "address[]" - }, - { - "internalType": "bool[]", - "name": "_isActives", - "type": "bool[]" - } - ], - "name": "addAddressBookBulk", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "addressInfo", - "outputs": [ - { - "internalType": "address", - "name": "poolStat", - "type": "address" - }, - { - "internalType": "address", - "name": "vault", - "type": "address" - }, - { - "internalType": "bool", - "name": "isActive", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "addressLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_index", - "type": "uint256" - } - ], - "name": "getTvl", - "outputs": [ - { - "internalType": "uint256", - "name": "tvl", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "initilize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_index", - "type": "uint256" - }, - { - "internalType": "address", - "name": "_poolStat", - "type": "address" - }, - { - "internalType": "address", - "name": "_vault", - "type": "address" - }, - { - "internalType": "bool", - "name": "_isActive", - "type": "bool" - } - ], - "name": "updateAddressBook", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } -] diff --git a/projects/electrikfinance/abi/poolstat.json b/projects/electrikfinance/abi/poolstat.json deleted file mode 100644 index c49b0de7a2e..00000000000 --- a/projects/electrikfinance/abi/poolstat.json +++ /dev/null @@ -1,81 +0,0 @@ -[ - { - "inputs": [ - { - "internalType": "address", - "name": "vaultAddress", - "type": "address" - } - ], - "name": "tvl", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "vaultAddress", - "type": "address" - } - ], - "name": "apr", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function", - "constant": true - }, - { - "inputs": [ - { - "internalType": "address", - "name": "vaultAddress", - "type": "address" - } - ], - "name": "getPricePerLP", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function", - "constant": true - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_lp", - "type": "address" - } - ], - "name": "_getPricePerLP", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function", - "constant": true - } -] diff --git a/projects/electrikfinance/index.js b/projects/electrikfinance/index.js index a15006b719d..3a36a53bbfc 100644 --- a/projects/electrikfinance/index.js +++ b/projects/electrikfinance/index.js @@ -1,33 +1,14 @@ -const sdk = require("@defillama/sdk") -const chain = 'klaytn' -const addressBookAbi = require("./abi/addressBook.json"); const { toUSDTBalances } = require("../helper/balances"); const addressBook = "0x380814144fA550B83A2Be6367c71e60660494cAa"; -async function klaytn(ts, _block, chainBlocks) { - const block = chainBlocks[chain] - let klaytnTVL = 0; - - const { output: poolLength } = await sdk.api.abi.call({ - chain, block, - target: addressBook, - abi: addressBookAbi.find(i => i.name === 'addressLength') - }) - - const calls = [] - for (let i = 0; i < poolLength; i++) - calls.push({ params: i}) - - const { output: tvl } = await sdk.api.abi.multiCall({ - chain, block, +async function klaytn(ts, _block, chainBlocks, { api }) { + const data = await api.fetchList({ + lengthAbi: 'uint256:addressLength', + itemAbi: 'function getTvl(uint256 _index) view returns (uint256 tvl)', target: addressBook, - abi: addressBookAbi.find(i => i.name === 'getTvl'), - calls - }) - - tvl.forEach(i => klaytnTVL += Number(i.output)) - - klaytnTVL = klaytnTVL / 1e18; + permitFailure: true, + }) + let klaytnTVL = data.reduce((a, i) => a + i/1e18, 0) return toUSDTBalances(klaytnTVL); } module.exports = { diff --git a/projects/elementfi/abi.json b/projects/elementfi/abi.json index 619c8bcc14d..9cbff9b98a9 100644 --- a/projects/elementfi/abi.json +++ b/projects/elementfi/abi.json @@ -1,75 +1,7 @@ { - "underlying": { - "inputs": [], - "name": "underlying", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "tranche": { - "inputs": [], - "name": "tranche", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "valueSupplied": { - "inputs": [], - "name": "valueSupplied", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getPoolId": { - "inputs": [], - "name": "getPoolId", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getPoolTokens": { - "inputs": [ - { "internalType": "bytes32", "name": "poolId", "type": "bytes32" } - ], - "name": "getPoolTokens", - "outputs": [ - { - "internalType": "contract IERC20[]", - "name": "tokens", - "type": "address[]" - }, - { "internalType": "uint256[]", "name": "balances", "type": "uint256[]" }, - { - "internalType": "uint256", - "name": "lastChangeBlock", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } + "underlying": "address:underlying", + "tranche": "address:tranche", + "valueSupplied": "uint256:valueSupplied", + "getPoolId": "function getPoolId() view returns (bytes32)", + "getPoolTokens": "function getPoolTokens(bytes32 poolId) view returns (address[] tokens, uint256[] balances, uint256 lastChangeBlock)" } \ No newline at end of file diff --git a/projects/elementfi/index.js b/projects/elementfi/index.js index 3b92e8a6845..a600ce884f4 100644 --- a/projects/elementfi/index.js +++ b/projects/elementfi/index.js @@ -1,130 +1,102 @@ const sdk = require("@defillama/sdk"); const abi = require('./abi.json'); const bn = require('bignumber.js') +const { getLogs } = require('../helper/cache/getLogs') -const { unwrapCrv } = require('../helper/unwrapLPs') const trancheFactoryAddress = "0x62F161BF3692E4015BefB05A03a94A40f520d1c0"; const ccpFactory = '0xb7561f547F3207eDb42A6AfA42170Cd47ADD17BD'; const balVault = '0xBA12222222228d8Ba445958a75a0704d566BF2C8' const wps = [ - '0xD5D7bc115B32ad1449C6D0083E43C87be95F2809', - '0xDe620bb8BE43ee54d7aa73f8E99A7409Fe511084', - '0x67F8FCb9D3c463da05DE1392EfDbB2A87F8599Ea', - '0xF94A7Df264A2ec8bCEef2cFE54d7cA3f6C6DFC7a', - '0xE54B3F5c444a801e61BECDCa93e74CdC1C4C1F90', - '0x2D6e3515C8b47192Ca3913770fa741d3C4Dac354', - '0xd16847480D6bc218048CD31Ad98b63CC34e5c2bF', - '0x7320d680Ca9BCE8048a286f00A79A2c9f8DCD7b3', - '0x9e030b67a8384cbba09D5927533Aa98010C87d91' + '0xD5D7bc115B32ad1449C6D0083E43C87be95F2809', + '0xDe620bb8BE43ee54d7aa73f8E99A7409Fe511084', + '0x67F8FCb9D3c463da05DE1392EfDbB2A87F8599Ea', + '0xF94A7Df264A2ec8bCEef2cFE54d7cA3f6C6DFC7a', + '0xE54B3F5c444a801e61BECDCa93e74CdC1C4C1F90', + '0x2D6e3515C8b47192Ca3913770fa741d3C4Dac354', + '0xd16847480D6bc218048CD31Ad98b63CC34e5c2bF', + '0x7320d680Ca9BCE8048a286f00A79A2c9f8DCD7b3', + '0x9e030b67a8384cbba09D5927533Aa98010C87d91' ] -async function tvl(timestamp, block) { - let balances = {}; - let tranches = []; +async function tvl(timestamp, block, _, { api }) { + let balances = {}; - const trancheLogs = (await sdk.api.util.getLogs({ - target: trancheFactoryAddress, - topic: 'TrancheCreated(address,address,uint256)', - keys: [], - fromBlock: 12685765, - toBlock: block, - })).output; + const tranches = (await getLogs({ + target: trancheFactoryAddress, + topic: 'TrancheCreated(address,address,uint256)', + fromBlock: 12685765, api + })).map(i => `0x${i.topics[1].substr(-40).toLowerCase()}`) + const underlying = await api.multiCall({ + abi: abi['underlying'], + calls: tranches, + }) + const valueSupplied = await api.multiCall({ + abi: abi['valueSupplied'], + calls: tranches, + }) + underlying.forEach((t, i) => sdk.util.sumSingleBalance(balances, t, valueSupplied[i])) - for (let log of trancheLogs) { - let tranche = `0x${log.topics[1].substr(-40)}` - tranches.push(tranche.toLowerCase()); - let underlying = (await sdk.api.abi.call({ - block, - target: tranche, - abi: abi['underlying'] - })).output; - let valueSupplied = (await sdk.api.abi.call({ - block, - target: tranche, - abi: abi['valueSupplied'] - })).output; - balances[underlying.toLowerCase()] = balances[underlying.toLowerCase()] ? new bn(balances[underlying.toLowerCase()]).plus(valueSupplied) : valueSupplied - }; - // wp tvl - for (let wp of wps) { - try { - let poolId = (await sdk.api.abi.call({ - block, - target: wp, - abi: abi['getPoolId'], - })).output; - - let poolTokens = (await sdk.api.abi.call({ - block, - target: balVault, - abi: abi['getPoolTokens'], - params: poolId - })).output; - - for (let i = 0; i < poolTokens.tokens.length; i++) { - let token = poolTokens.tokens[i]; - let tranche; - try { - tranche = (await sdk.api.abi.call({ - block, - target: token, - abi: abi['tranche'] - })).output; - } catch (e) { - } - if (tranche && tranches.indexOf(tranche.toLowerCase()) >= 0) { - continue; - } - - balances[token.toLowerCase()] = balances[token.toLowerCase()] ? new bn(balances[token.toLowerCase()]).plus(poolTokens.balances[i]) : poolTokens.balances[i]; - } - } catch (e) { - console.log(e) - } + // wp tvl + await Promise.all(wps.map(async wp => { + try { + let poolId = (await sdk.api.abi.call({ + block, + target: wp, + abi: abi['getPoolId'], + })).output; + + let poolTokens = (await sdk.api.abi.call({ + block, + target: balVault, + abi: abi['getPoolTokens'], + params: poolId + })).output; + const names = await api.multiCall({ abi: 'string:name', calls: poolTokens.tokens }) + for (let i = 0; i < poolTokens.tokens.length; i++) { + let token = poolTokens.tokens[i]; + if (names[i].startsWith('Element Yield Token')) + return; + + balances[token.toLowerCase()] = balances[token.toLowerCase()] ? new bn(balances[token.toLowerCase()]).plus(poolTokens.balances[i]) : poolTokens.balances[i]; + } + } catch (e) { + console.log(e) } - // // // cc tvl - let ccLogs = (await sdk.api.util - .getLogs({ - keys: [], - toBlock: block, - target: ccpFactory, - fromBlock: 12686198, - topic: 'PoolCreated(address)', - })).output; - - for (let log of ccLogs) { - if (block < log.blockNumber) continue; - let cc = `0x${log.topics[1].substr(-40)}`; - let poolId = (await sdk.api.abi.call({ - block, - target: cc, - abi: abi['getPoolId'], - })).output; + })) - let poolTokens = (await sdk.api.abi.call({ - block, - target: balVault, - abi: abi['getPoolTokens'], - params: poolId - })).output; + // // // cc tvl + let cc = (await getLogs({ + api, + target: ccpFactory, + fromBlock: 12686198, + topic: 'PoolCreated(address)', + })).map(i => `0x${i.topics[1].substr(-40)}`); - for (let i = 0; i < poolTokens.tokens.length; i++) { - let token = poolTokens.tokens[i]; - if (tranches.indexOf(token.toLowerCase()) >= 0) { - continue; - } - - balances[token.toLowerCase()] = balances[token.toLowerCase()] ? new bn(balances[token.toLowerCase()]).plus(poolTokens.balances[i]) : poolTokens.balances[i]; - } + await Promise.all(cc.map(async i => { + const poolId = await api.call({ + target: i, + abi: abi['getPoolId'], + }) + const poolTokens = await api.call({ + target: balVault, + abi: abi['getPoolTokens'], + params: poolId + }) + + for (let i = 0; i < poolTokens.tokens.length; i++) { + let token = poolTokens.tokens[i]; + if (tranches.indexOf(token.toLowerCase()) >= 0) { + continue; + } + sdk.util.sumSingleBalance(balances, token, poolTokens.balances[i]) } - for (let [token, balance] of Object.entries(balances)) { - await unwrapCrv(balances, token, balance, block); - }; - return balances; + })) + + return balances; } -module.exports = { - ethereum: { tvl }, - }; \ No newline at end of file +module.exports = { + ethereum: { tvl }, +}; \ No newline at end of file diff --git a/projects/elephantdex/index.js b/projects/elephantdex/index.js index 77faf4e2970..f997d4c2c6f 100644 --- a/projects/elephantdex/index.js +++ b/projects/elephantdex/index.js @@ -3,7 +3,6 @@ const { getUniTVL } = require("../helper/unknownTokens"); module.exports = { harmony: { tvl: getUniTVL({ - chain: 'harmony', useDefaultCoreAssets: true, factory: '0x0Dea90EC11032615E027664D2708BC292Bbd976B', }) diff --git a/projects/elephantmoney/index.js b/projects/elephantmoney/index.js index b34343108b3..d4a7bc710f2 100644 --- a/projects/elephantmoney/index.js +++ b/projects/elephantmoney/index.js @@ -1,8 +1,9 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const { stakings } = require("../helper/staking"); const contracts = { - BUSD: '0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56', + BUSD: ADDRESSES.bsc.BUSD, TRUNK: '0xdd325C38b12903B727D16961e61333f4871A70E0', treasury: '0xCb5a02BB3a38e92E591d323d6824586608cE8cE4', LP_TRUNK: '0xf15A72B15fC4CAeD6FaDB1ba7347f6CCD1E0Aede', @@ -21,7 +22,7 @@ async function tvl(timestamp, block, chainBlocks) { block: chainBlocks.bsc, chain: 'bsc' })).output }; -}; +} module.exports = { bsc: { diff --git a/projects/elkfinance/index.js b/projects/elkfinance/index.js index dfece2e1780..3e1141c7258 100644 --- a/projects/elkfinance/index.js +++ b/projects/elkfinance/index.js @@ -26,7 +26,7 @@ const factories = { } function chainTvl(chain) { - return getUniTVL({ chain, factory: factories[chain], useDefaultCoreAssets: true, }) + return getUniTVL({ chain, factory: factories[chain], useDefaultCoreAssets: true, blacklistedTokens: ['0xa9536b9c75a9e0fae3b56a96ac8edf76abc91978'] }) } const chainExports = getChainExports(chainTvl, Object.keys(factories)) diff --git a/projects/ellipisis-phoenix/index.js b/projects/ellipisis-phoenix/index.js new file mode 100644 index 00000000000..de7fc653afa --- /dev/null +++ b/projects/ellipisis-phoenix/index.js @@ -0,0 +1,26 @@ +const { sumTokens2, getConnection, decodeAccount, } = require('../helper/solana') +const { PublicKey } = require('@solana/web3.js') + +async function tvl() { + const program = new PublicKey('PhoeNiXZ8ByJGLkxNfZRnkUfjvmuYqLR89jjFHGqdXY') + const connection = getConnection(); + const accounts0 = await connection.getProgramAccounts(program, { + filters: [{ + dataSize: 445536 + }] + }) + const accounts1 = await connection.getProgramAccounts(program, { + filters: [{ + dataSize: 1723488 + }] + }) + const accounts = [...accounts0, ...accounts1] + const tokenAccounts = accounts.map(i => decodeAccount('phoenix', i.account)) + .map(i => [i.baseParams.vaultKey, i.quoteParams.vaultKey]).flat() + return sumTokens2({ tokenAccounts, }) +} + +module.exports = { + timetravel: false, + solana: { tvl }, +} diff --git a/projects/ellipsis/abi.json b/projects/ellipsis/abi.json index d563933a3af..a4d9c4b9912 100644 --- a/projects/ellipsis/abi.json +++ b/projects/ellipsis/abi.json @@ -1,79 +1,7 @@ { - "balancesBasePool": { - "stateMutability": "view", - "type": "function", - "name": "balances", - "inputs": [ - { - "name": "arg0", - "type": "uint256" - } - ], - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "gas": 1917 - }, - "balancesMetaPool": { - "stateMutability": "view", - "type": "function", - "name": "balances", - "inputs": [ - { - "name": "arg0", - "type": "uint256" - } - ], - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "gas": 1977 - }, - "lockedSupply": { - "inputs": [], - "name": "lockedSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "totalSupply": { - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "totalSupplyLP": { - "constant": true, - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } -} + "balancesBasePool": "function balances(uint256 arg0) view returns (uint256) @1917", + "balancesMetaPool": "function balances(uint256 arg0) view returns (uint256) @1977", + "lockedSupply": "uint256:lockedSupply", + "totalSupply": "uint256:totalSupply", + "totalSupplyLP": "uint256:totalSupply" +} \ No newline at end of file diff --git a/projects/ellipsis/index.js b/projects/ellipsis/index.js index 9ba13e78f04..fc52ba1d7ad 100644 --- a/projects/ellipsis/index.js +++ b/projects/ellipsis/index.js @@ -1,51 +1,17 @@ -const { get } = require('../helper/http'); const sdk = require('@defillama/sdk') const chain = 'bsc' const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') const { PromisePool } = require('@supercharge/promise-pool') +const { getConfig } = require('../helper/cache') const abis = { - wrapped_coins: { - "stateMutability": "view", - "type": "function", - "name": "wrapped_coins", - "inputs": [ - { - "name": "arg0", - "type": "uint256" - } - ], - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "gas": 3345 - }, - coins: { - "stateMutability": "view", - "type": "function", - "name": "coins", - "inputs": [ - { - "name": "arg0", - "type": "uint256" - } - ], - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "gas": 3375 - }, + wrapped_coins: 'function wrapped_coins(uint256 arg0) view returns (address) @3345', + coins: 'function coins(uint256 arg0) view returns (address) @3375' } async function tvl(_, _b, { [chain]: block }) { const tokensAndOwners = [] - const poolInfo = await get('https://api.ellipsis.finance/api/getPoolsCrypto') + const poolInfo = await getConfig('ellipsis', 'https://api.ellipsis.finance/api/getPoolsCrypto') const wrappedCoinPools = [ '0xab499095961516f058245c1395f9c0410764b6cd', '0x245e8bb5427822fb8fd6ce062d8dd853fbcfabf5', @@ -91,7 +57,6 @@ async function tvl(_, _b, { [chain]: block }) { } -const lockedSupply = { "inputs": [], "name": "lockedSupply", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" } const stakingContract = "0x4076cc26efee47825917d0fec3a79d0bb9a6bb5c" const eps = "0xa7f552078dcc247c2684336020c03648500c6d9f" async function staking(time, ethBlock, chainBlocks) { @@ -99,7 +64,7 @@ async function staking(time, ethBlock, chainBlocks) { target: stakingContract, block: chainBlocks.bsc, chain: 'bsc', - abi: lockedSupply + abi: 'uint256:lockedSupply' }) return { ["bsc:" + eps]: locked.output diff --git a/projects/ellipsis/onchain.js b/projects/ellipsis/onchain.js index 96d2583617d..871613c77eb 100644 --- a/projects/ellipsis/onchain.js +++ b/projects/ellipsis/onchain.js @@ -1,7 +1,9 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const axios = require('axios'); const { unwrapUniswapLPs } = require('../helper/unwrapLPs'); const abi = require('./abi.json'); +const { getConfig } = require('../helper/cache') function getBSCAddress(address) { @@ -10,9 +12,9 @@ function getBSCAddress(address) { // list of missing tokens const replaceable = { - "0x049d68029688eAbF473097a2fC38ef61633A3C7A": "0xdac17f958d2ee523a2206206994597c13d831ec7", //fUSDT -> USDT + [ADDRESSES.fantom.fUSDT]: ADDRESSES.ethereum.USDT, //fUSDT -> USDT '0xeD28A457A5A76596ac48d87C0f577020F6Ea1c4C': '0x5228a22e72ccc52d415ecfd199f99d0665e7733b', //pBTC -> pBTC on ETH - '0x54261774905f3e6E9718f2ABb10ed6555cae308a': '0x2260fac5e5542a773aa44fbcfedf7c193bc2c599', //anyBTC -> WBTC + '0x54261774905f3e6E9718f2ABb10ed6555cae308a': ADDRESSES.ethereum.WBTC, //anyBTC -> WBTC '0x03ab98f5dc94996f8c33e15cd4468794d12d41f9': '0x674c6ad92fd080e4004b2312b45f796a192d27a0', //USDN -> USDN on ETH }; @@ -27,7 +29,7 @@ async function tvl(timestamp, block, chainBlocks) { let balances = {}; - let allPools = (await axios.get(endpoint)).data.data + let allPools = (await getConfig('ellipsis-onchain', endpoint)) const basePools = allPools.basePools const metaPools = allPools.metaPools diff --git a/projects/elysia/index.js b/projects/elysia/index.js index 2a451242e78..155e55ff198 100644 --- a/projects/elysia/index.js +++ b/projects/elysia/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const { stakings } = require("../helper/staking"); const { sumTokensExport, } = require('../helper/unwrapLPs') @@ -6,10 +7,10 @@ const addresses = { elfi: "0x4da34f8264cb33a5c9f17081b9ef5ff6091116f4", el: "0x2781246fe707bb15cee3e5ea354e2154a2877b16", elStaking: "0x3F0c3E32bB166901AcD0Abc9452a3f0c5b8B2C9D", - dai: "0x6b175474e89094c44da98b954eedeac495271d0f", - usdt: "0xdac17f958d2ee523a2206206994597c13d831ec7", - busd: "0x4fabb145d64652a948d72533023f6e7a623c7c53", - usdc: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", + dai: ADDRESSES.ethereum.DAI, + usdt: ADDRESSES.ethereum.USDT, + busd: ADDRESSES.ethereum.BUSD, + usdc: ADDRESSES.ethereum.USDC, elfiStaking: [ "0xb41bcd480fbd986331eeed516c52e447b50dacb4", "0xCD668B44C7Cf3B63722D5cE5F655De68dD8f2750", @@ -28,7 +29,7 @@ const moneyPools = { [addresses.usdt, '0xe0bda8e3a27e889837ae37970fe97194453ee79c'], [addresses.usdc, '0x3fea4cc5a03e372ac9cded96bd07795ac9034d71'], ], - bsc: [['0xe9e7cea3dedca5984780bafc599bd69add087d56', '0x5bb4d02a0ba38fb8b916758f11d9b256967a1f7f']] + bsc: [[ADDRESSES.bsc.BUSD, '0x5bb4d02a0ba38fb8b916758f11d9b256967a1f7f']] } function borrowed(chain) { diff --git a/projects/emberswap/index.js b/projects/emberswap/index.js index 9ea85d2b93c..8a81e4d5039 100644 --- a/projects/emberswap/index.js +++ b/projects/emberswap/index.js @@ -1,9 +1,10 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { getUniTVL } = require('../helper/unknownTokens') const { stakingPricedLP } = require('../helper/staking') const EMBER = "0x6BAbf5277849265b6738e75AEC43AEfdde0Ce88D"; const VAULT = "0xFFbE92fDA81f853bcf00d3c7686d5DAd5A6600bB"; -const WBCH = "0x3743eC0673453E5009310C727Ba4eaF7b3a1cc04"; +const WBCH = ADDRESSES.smartbch.WBCH; const FACTORY = "0xE62983a68679834eD884B9673Fb6aF13db740fF0"; const EMBER_WBCH_PAIR = "0x52c656FaF57DCbDdDd47BCbA7b2ab79e4c232C28" diff --git a/projects/embr/index.js b/projects/embr/index.js index f34b43edd47..88066309392 100644 --- a/projects/embr/index.js +++ b/projects/embr/index.js @@ -1,20 +1,7 @@ -const { sumTokensExport } = require('../helper/unwrapLPs') +const { onChainTvl } = require('../helper/balancer') module.exports = { - avax:{ - tvl: sumTokensExport({ - chain: 'avax', - owner: '0xad68ea482860cd7077a5d0684313dd3a9bc70fbb', - tokens: [ - '0xc7198437980c041c805a1edcba50c1ce5db95118', - '0xa7d7079b0fead91f3e65f86e8915cb59c1a4c664', - '0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7', - '0x130966628846bfd36ff31a822705796e8cb8c18d', - '0x78ea17559b3d2cf85a7f9c2c704eda119db5e6de', - '0xd586e7f844cea2f87f50152665bcbc2c279d8d70', - '0xc38f41a296a4493ff429f1238e030924a1542e50', - '0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e', - ] - }) + avax: { + tvl: onChainTvl('0xad68ea482860cd7077a5d0684313dd3a9bc70fbb', 8169253) }, } \ No newline at end of file diff --git a/projects/emdx/index.js b/projects/emdx/index.js index b399c7a0548..e52c9404e68 100644 --- a/projects/emdx/index.js +++ b/projects/emdx/index.js @@ -1,9 +1,10 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokensExport } = require('../helper/unwrapLPs') const ark = "0x3B065b08AAe6e29972058096cfA77E196590784a" const insuranceFund = "0x80ce46804010C03387a13E27729c5FBb6a309105" const clearingHouse = "0xBFB083840b0507670b92456264164E5fecd0430B" -const usdcAvalanche = "0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E" +const usdcAvalanche = ADDRESSES.avax.USDC module.exports = { avax: { diff --git a/projects/emiswap/index.js b/projects/emiswap/index.js index c70b967ffe8..21ce74b0b76 100644 --- a/projects/emiswap/index.js +++ b/projects/emiswap/index.js @@ -1,92 +1,33 @@ -const sdk = require("@defillama/sdk") -const { post } = require('../helper/http') -const { toUSDTBalances } = require('../helper/balances') -const { sumTokens } = require("../helper/unwrapLPs") -const { getChainTransform, getFixBalances } = require("../helper/portedTokens") +const { sumTokens2 } = require("../helper/unwrapLPs") const abi = require("../mooniswap/abi.json") - -const query = factory => `query emiswapFactories { emiswapFactories(where: {id: "${factory}"}) { id totalLiquidityUSD }}` +const { staking } = require('../helper/staking') const chainConfig = { - ethereum: { - factory: '0x1771dff85160768255F0a44D20965665806cBf48', - url: 'https://api.thegraph.com/subgraphs/name/lombardi22/emiswap8' - }, - kcc: { - factory: '0x945316F2964ef5C6C84921b435a528DD1790E93a', - url: 'https://thegraph.kcc.network/subgraphs/name/emiswap/emiswap1' - }, - polygon: { - factory: '0x23c1b313152e276e0CF61665dc3AC160b3c5aB19', - url: 'https://api.thegraph.com/subgraphs/name/lombardi22/polygon', - }, - shiden: { - factory: '0x7449314B698f918E98c76279B5570613b243eECf', - url: 'https://shiden-graph.emiswap.com/subgraphs/name/shiden', - }, - avax: { - factory: '0xaD6b9b31832A88Bb59dB4ACD820F8df2CfA84f0f', - }, - astar: { - factory: '0xb4BcA5955F26d2fA6B57842655d7aCf2380Ac854', - }, - aurora: { - factory: '0x979e5d41595263f6Dfec4F4D48419C555B80D95c', - url: 'https://api.thegraph.com/subgraphs/name/lombardi22/aurora', - }, + ethereum: { factory: '0x1771dff85160768255F0a44D20965665806cBf48', }, + kcc: { factory: '0x945316F2964ef5C6C84921b435a528DD1790E93a', }, + polygon: { factory: '0x23c1b313152e276e0CF61665dc3AC160b3c5aB19', }, + shiden: { factory: '0x7449314B698f918E98c76279B5570613b243eECf', }, + avax: { factory: '0xaD6b9b31832A88Bb59dB4ACD820F8df2CfA84f0f', }, + astar: { factory: '0xb4BcA5955F26d2fA6B57842655d7aCf2380Ac854', }, + aurora: { factory: '0x979e5d41595263f6Dfec4F4D48419C555B80D95c', }, } - -const moduleExports = {} - -Object.keys(chainConfig).forEach(chain => { - const { factory, url } = chainConfig[chain] - async function tvl() { - const body = { query: query(factory), operationName: "emiswapFactories", variables: {} } - const response = await post(url, body) - return toUSDTBalances(response.data.emiswapFactories[0].totalLiquidityUSD) - } - - async function computeTvl(ts, _block, chainBlocks) { - const balances = {} - const block = chainBlocks[chain] - const transformAddress = await getChainTransform(chain) - const fixBalances = await getFixBalances(chain) - - const getAllpools = (await sdk.api.abi.call({ abi: abi.getAllPools, target: factory, block, chain, })).output - const getTokens = (await sdk.api.abi.multiCall({ abi: abi.getTokens, calls: getAllpools.map(pool => ({ target: pool })), block, chain, })).output - const tokensAndOwners = [] - getTokens.forEach(({ output: tokens }, i) => { - const owner = getAllpools[i] - tokens.forEach(token => tokensAndOwners.push([token, owner])) - }) - - await sumTokens(balances, tokensAndOwners, block, chain, transformAddress) - fixBalances(balances) - return balances - } - - moduleExports[chain] = { tvl: url ? tvl : computeTvl } -}) const eswToken = "0x5a75a093747b72a0e14056352751edf03518031d"; const stakingPool = "0xe094E3E16e813a40E2d6cC4b89bfeAe0142044e1"; -async function ethStaking(timestamp, block) { - let balances = {}; - - let { output: balance } = await sdk.api.erc20.balanceOf({ - target: eswToken, - owner: stakingPool, - block, - }); - sdk.util.sumSingleBalance(balances, eswToken, balance); - - return balances; -} - -moduleExports.ethereum.staking = ethStaking module.exports = { methodology: "ETH and KCC TVL are the total liquidity from the LPs according to the subgraph. Staking TVL would be ESW value in the staking pool.", - ...moduleExports -}; \ No newline at end of file +}; + +Object.keys(chainConfig).forEach(chain => { + const { factory } = chainConfig[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const pools = await api.call({ target: factory, abi: abi.getAllPools, }) + const tokens = await api.multiCall({ calls: pools, abi: abi.getTokens, }) + return sumTokens2({ api, ownerTokens: pools.map((v, i) => [tokens[i], v]) }) + } + } +}) +module.exports.ethereum.staking = staking(stakingPool, eswToken) \ No newline at end of file diff --git a/projects/empiredex/index.js b/projects/empiredex/index.js index 450b2f5d928..26b6e2254eb 100644 --- a/projects/empiredex/index.js +++ b/projects/empiredex/index.js @@ -3,33 +3,32 @@ const { getUniTVL } = require("../helper/unknownTokens") module.exports = { misrepresentedTokens: true, bsc: { - tvl: getUniTVL({ chain: 'bsc', factory: '0x06530550A48F990360DFD642d2132354A144F31d', useDefaultCoreAssets: true, }), + tvl: getUniTVL({ factory: '0x06530550A48F990360DFD642d2132354A144F31d', useDefaultCoreAssets: true, }), }, cronos: { - tvl: getUniTVL({ chain: 'cronos', factory: '0x06530550A48F990360DFD642d2132354A144F31d', useDefaultCoreAssets: true, }), + tvl: getUniTVL({ factory: '0x06530550A48F990360DFD642d2132354A144F31d', useDefaultCoreAssets: true, }), }, xdai: { - tvl: getUniTVL({ chain: 'xdai', factory: '0x06530550A48F990360DFD642d2132354A144F31d', useDefaultCoreAssets: true, }), + tvl: getUniTVL({ factory: '0x06530550A48F990360DFD642d2132354A144F31d', useDefaultCoreAssets: true, }), }, polygon: { - tvl: getUniTVL({ chain: 'polygon', factory: '0x06530550A48F990360DFD642d2132354A144F31d', useDefaultCoreAssets: true, }), + tvl: getUniTVL({ factory: '0x06530550A48F990360DFD642d2132354A144F31d', useDefaultCoreAssets: true, }), }, fantom: { - tvl: getUniTVL({ chain: 'fantom', factory: '0x06530550A48F990360DFD642d2132354A144F31d', useDefaultCoreAssets: true, }), + tvl: getUniTVL({ factory: '0x06530550A48F990360DFD642d2132354A144F31d', useDefaultCoreAssets: true, }), }, avax: { - tvl: getUniTVL({ chain: 'avax', factory: '0x06530550A48F990360DFD642d2132354A144F31d', useDefaultCoreAssets: true, }), + tvl: getUniTVL({ factory: '0x06530550A48F990360DFD642d2132354A144F31d', useDefaultCoreAssets: true, }), }, ethereum: { - tvl: getUniTVL({ chain: 'ethereum', factory: '0xd674b01E778CF43D3E6544985F893355F46A74A5', useDefaultCoreAssets: true, }), + tvl: getUniTVL({ factory: '0xd674b01E778CF43D3E6544985F893355F46A74A5', useDefaultCoreAssets: true, }), }, kava: { - tvl: getUniTVL({ - factory: '0x06530550A48F990360DFD642d2132354A144F31d', - chain: 'kava', - useDefaultCoreAssets: true, - }), + tvl: getUniTVL({ factory: '0x06530550A48F990360DFD642d2132354A144F31d', useDefaultCoreAssets: true, }), }, - + empire: { + tvl: getUniTVL({ factory: '0x06530550A48F990360DFD642d2132354A144F31d', useDefaultCoreAssets: true, }), + }, + methodology: "Factory address(0x06530550A48F990360DFD642d2132354A144F31d) is used to find the LP pairs. TVL is equal to the liquidity on the AMM.", }; diff --git a/projects/empyreal/index.js b/projects/empyreal/index.js new file mode 100644 index 00000000000..cd4f3855723 --- /dev/null +++ b/projects/empyreal/index.js @@ -0,0 +1,21 @@ +const { unknownTombs } = require("../helper/unknownTokens"); + +const emp = "0x0DDCE00654f968DeD59A444da809F2B234047aB1"; +const firm = "0x368F6d735F3Fc8Aa0568D2B7aB275cB828B79709"; +const horizon = "0x71d2009460383c970c08b0e37cc8f029bce5bbcd"; +const rewardPool = "0x15084E92785027D4D4918CAbfa11281fC15bF9AC"; +const lps = [ + "0x87e65159edafae4bb1ccd0c94c7ec9427409b370", // FIRM-USDC LP + "0x06675843400F2267060ee886C9088fF498f7c8eC", // EMP-egARB + "0x400ebc22c31bedcdab38a6b27963912df71840ed", +] + +module.exports = unknownTombs({ + token: emp, + shares: [firm], + masonry: [horizon], + rewardPool: [rewardPool], + chain: 'arbitrum', + lps, + useDefaultCoreAssets: true, +}) diff --git a/projects/empyrean/index.js b/projects/empyrean/index.js index 55722ae9d62..9abb86fc6ce 100644 --- a/projects/empyrean/index.js +++ b/projects/empyrean/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { staking } = require("../helper/staking"); const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); @@ -5,7 +6,7 @@ const empyreanStaking = "0xD080CBc2885c64510923Ac6F5c8896011f86a6aF"; const EMPYR = "0xE9F226a228Eb58d408FdB94c3ED5A18AF6968fE1"; const treasuryAddress = "0x4606f4e6D43d501b86Fc583f44ae27097A1F9EA7"; -const USDC = "0xB12BFcA5A55806AaF64E99521918A4bf0fC40802"; +const USDC = ADDRESSES.aurora.USDC_e; const EMPYR_USDC_TLP = "0x6e46c69FE35eF5BB78D7f35d92645C74245a6567"; /*** Bonds TVL Portion (Treasury) *** diff --git a/projects/energyfi/index.js b/projects/energyfi/index.js index 0771cf78c63..c72ae4e3793 100644 --- a/projects/energyfi/index.js +++ b/projects/energyfi/index.js @@ -4,7 +4,6 @@ module.exports = { misrepresentedTokens: true, moonbeam: { tvl: getUniTVL({ - chain: 'moonbeam', useDefaultCoreAssets: true, factory: '0x7c7EaEa389d958BB37a3fd08706Ca884D53Dc1F3', }) diff --git a/projects/ennead/index.js b/projects/ennead/index.js new file mode 100644 index 00000000000..b98b11c2dfa --- /dev/null +++ b/projects/ennead/index.js @@ -0,0 +1,51 @@ +const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') +const { sumTokensExport } = require('../helper/unknownTokens') +const { staking, } = require("../helper/staking"); +const lensAbi = require("./ramsesLens.json"); + +// Ramses contracts +const ramsesLens = '0xAAA68f40515bCcd8e407EBB4dBdF5046D105621e'; +const nfpManager = '0xAA277CB7914b7e5514946Da92cb9De332Ce610EF'; + +// Ennead contracts +// arbi +const neadRam = '0x40301951Af3f80b8C1744ca77E55111dd3c1dba1'; +const neadStake = '0x7D07A61b8c18cb614B99aF7B90cBBc8cD8C72680'; +const lpDepositor = '0x1863736c768f232189F95428b5ed9A51B0eCcAe5'; +const neadNfpDepositor = '0xe99ead648Fb2893d1CFA4e8Fe8B67B35572d2581'; +// avax +const neadStake_avax = '0xe99ead39204bd394e56502A3ad56d7061EE6B1c7'; +const neadSnek = '0xe99ead9519239F3eAad9339292d8A399739Cd55d'; +const neadSnekLp = '0x82360748aC3D7045812c6783f355b41193d3492E'; +const snekView = '0xe99eadc22747c95c658f41a02F1c6C2CcAefA757'; +const booster = '0xe99ead683Dcf1eF0C7F6612be5098BC5fDF4998d'; + +async function arbiTvl(timestamp, block, chainBlocks, { api }) { + let poolsAddresses = await api.call({ target: ramsesLens, abi: lensAbi.allPools, }) + let gauges = await api.multiCall({ target: ramsesLens, calls: poolsAddresses, abi: lensAbi.gaugeForPool, }) + poolsAddresses = poolsAddresses.filter((_, i) => gauges[i] !== nullAddress) + gauges = gauges.filter(gauge => gauge !== nullAddress) + const bals = await api.multiCall({ abi: 'erc20:balanceOf', calls: gauges.map(i => ({ target: i, params: lpDepositor}))}) + api.addTokens(poolsAddresses, bals) + await sumTokens2({ api, uniV3nftsAndOwners: [[nfpManager, neadNfpDepositor],], resolveLP: true, }) +} + +async function avaxTvl(timestamp, block, chainBlocks, { api }) { + const poolsAddresses = await api.call({ target: snekView, abi: lensAbi.allActivePools, }) + const gauges = await api.call({ target: snekView, abi: lensAbi.allGauges, }) + const bals = await api.multiCall({ abi: 'erc20:balanceOf', calls: gauges.map(i => ({ target: i, params: booster}))}) + api.addTokens(poolsAddresses, bals) + return sumTokens2({ api, resolveLP: true, }) +} + +module.exports = { + misrepresentedTokens: true, + arbitrum: { + staking: staking(neadStake, neadRam), + tvl: arbiTvl, + }, + avax: { + staking: sumTokensExport({ owner: neadStake_avax, tokens: [neadSnek], lps: [neadSnekLp], useDefaultCoreAssets: true, }), + tvl: avaxTvl + } +}; \ No newline at end of file diff --git a/projects/ennead/ramsesLens.json b/projects/ennead/ramsesLens.json new file mode 100644 index 00000000000..2686073867a --- /dev/null +++ b/projects/ennead/ramsesLens.json @@ -0,0 +1,7 @@ +{ + "allPools": "function allPools() view returns (address[])", + "gaugeForPool": "function gaugeForPool(address) view returns (address)", + "allActivePools": "function allActivePools() view returns (address[])", + "allGauges": "function allGauges() view returns (address[])", + "allStakingPositionsOf": "function allStakingPositionsOf(address) view returns (tuple(address gauge, uint256 balance, uint256 derivedBalance, tuple(address token, uint256 earned)[] userRewards)[] rewardsData)" +} \ No newline at end of file diff --git a/projects/enosys-bridge/index.js b/projects/enosys-bridge/index.js new file mode 100644 index 00000000000..2013c011449 --- /dev/null +++ b/projects/enosys-bridge/index.js @@ -0,0 +1,7 @@ +const { sumTokensExport } = require('../helper/unwrapLPs') +const ADDRESSES = require('../helper/coreAssets.json') + +module.exports = { + xdc: { tvl: sumTokensExport({ owner: '0xd5308a4bb2d7121a26d0bd11257245f0efda2bc4', tokens: [ADDRESSES.xdc.WXDC] }) }, + ethereum: { tvl: sumTokensExport({ owner: '0xb3902647015c17fc3c2f5ca5f5cb68bbf2d9b1e2', tokens: [ADDRESSES.ethereum.USDT] }) }, +} \ No newline at end of file diff --git a/projects/ensuro/index.js b/projects/ensuro/index.js new file mode 100644 index 00000000000..3eb3881ec3f --- /dev/null +++ b/projects/ensuro/index.js @@ -0,0 +1,54 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokens2 } = require('../helper/unwrapLPs') + +const addressBook = { + polygon: { + usdc: ADDRESSES.polygon.USDC, + aave_v3_usdc: "0x625E7708f30cA75bfd92586e17077590C60eb4cD", // aPolUSDC + aave_v2_usdc: "0x1a13F4Ca1d028320A707D99520AbFefca3998b7F", // amUSDC + reserves: [ + // eTokens + {name: "eToken Junior Koala", address: "0x8d2Ee82c4172B2138B06b8037d769cBfAf9C0274"}, + {name: "eToken Senior", address: "0x55bAe6690d46EA94D7F05DF7c80A85E322421fB6"}, + {name: "eToken Innov Zone", address: "0x1C48Accaf6f8106883AA1973A45F02525652DEfC"}, + {name: "eToken Junior Koala BMA", address: "0xBC33c283A37d46ABA17BC5F8C27b27242688DeC6"}, + {name: "eToken Senior BMA", address: "0xF383eF2D31E1d4a19B3e04ca2937DB6A8DA9f229"}, + {name: "eToken Junior Spot", address: "0x6229D78658305a301E177f9dAEa3a0799fd1528C"}, + {name: "eToken Junior Revo", address: "0x6A0e61C757e384eB1E4A2b94F7E02E68e4b4515e"}, + {name: "eToken Junior StormStrong", address: "0xE36D6585F0c200195b196C66644C519e7674b476"}, + // PremiumsAccounts + {name: "PremiumsAccount Koala", address: "0xCCf5C404d32eB6E777088AB13837a1b8dCBA9328"}, + {name: "PremiumsAccount Innov Zone", address: "0x4f43B8F252887F814ED689346fdb5Bd266394520"}, + {name: "PremiumsAccount Koala BMA", address: "0xc1A74eaC52a195E54E0cd672A9dAB023292C6100"}, + {name: "PremiumsAccount StormStrong", address: "0x06347eA3dA6a5B44eEAe3B8F4a65992Ae073e6F4"}, + {name: "PremiumsAccount Revo", address: "0x47f35B4876138b5d96FfDed1e46aE6b58E6e7B31"}, + {name: "PremiumsAccount Spot", address: "0x42118Df6EBb18346ca425f1c67AC739E95aD9358"}, + ], + v1: { + pool: "0xF7ED72430bEA07D8dB6eC264603811381F5af8e0", + asset_manager: "0x09d9Dd252659a497F3525F257e204E7192beF132", + } + } +}; + +async function tvl(_timestamp, _block, _blocksOthers, { api }) { + const addresses = addressBook[api.chain]; + const ownerTokens = addresses.reserves.map(i => [[addresses.usdc, addresses.aave_v3_usdc], i.address]) + + if (addresses.v1) { + ownerTokens.push([[addresses.usdc], addresses.v1.pool]) + ownerTokens.push([[addresses.aave_v2_usdc], addresses.v1.asset_manager]) + } + return sumTokens2({ api, ownerTokens, }); +} + +module.exports = { + methodology: `Sums the USDC amounts (both liquid and invested in AAVE) of the different protocol reserves (https://docs.ensuro.co/product-docs/smart-contracts/reserves).`, + polygon: { + tvl + }, + start: 1643673600, + hallmarks: [ + [1669852800, "Ensuro V2 Launch"] + ] +}; diff --git a/projects/enterdao/index.js b/projects/enterdao/index.js index 67081799263..0be631aa3ce 100644 --- a/projects/enterdao/index.js +++ b/projects/enterdao/index.js @@ -1,10 +1,11 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); const StakingContract = "0x3F148612315AaE2514AC630D6FAf0D94B8Cd8E33"; const USDC_ENTR_SUSHI_LP = "0x83b546e10917432a722444672504f0d459472171"; const yieldFarms = [ - "0x6b3595068778dd592e39a122f4f5a5cf09c90fe2", //SUSHI + ADDRESSES.ethereum.SUSHI, //SUSHI "0xbb0e17ef65f82ab018d8edd776e8dd940327b28b", //AXS "0x0391D2021f89DC339F60Fff84546EA23E337750f", //BOND "0x0f5d2fb29fb7d3cfee444a200298f468908cc942", //MANA diff --git a/projects/entities/a16z-cold.js b/projects/entities/a16z-cold.js new file mode 100644 index 00000000000..58642a2fb01 --- /dev/null +++ b/projects/entities/a16z-cold.js @@ -0,0 +1,14 @@ +const { cexExports } = require('../helper/cex') + +const config = { + ethereum: { + owners: [ + "0x7D325A9C8F10758188641FE91cFD902499edC782", + "0x2B1Ad6184a6B0fac06bD225ed37C2AbC04415fF4", + "0x05E793cE0C6027323Ac150F6d45C2344d28B6019", //14k MKR staking + "0x0f50D31B3eaefd65236dd3736B863CfFa4c63C4E" + ], + }, +} + +module.exports = cexExports(config) \ No newline at end of file diff --git a/projects/entities/akg-ventures.js b/projects/entities/akg-ventures.js new file mode 100644 index 00000000000..9bee71c5249 --- /dev/null +++ b/projects/entities/akg-ventures.js @@ -0,0 +1,12 @@ +const { cexExports } = require('../helper/cex') + +const config = { + ethereum: { + owners: [ + "0x19a504b1096aE59624105E737B22F5943B1a4846", + + ], + }, +} + +module.exports = cexExports(config) \ No newline at end of file diff --git a/projects/entities/animoca-brands.js b/projects/entities/animoca-brands.js new file mode 100644 index 00000000000..ffce59fb8c4 --- /dev/null +++ b/projects/entities/animoca-brands.js @@ -0,0 +1,12 @@ +const { cexExports } = require('../helper/cex') + +const config = { + ethereum: { + owners: [ + "0xd6AF301A8770659c1Dc880843db4d1aaA01048b4", + "0xE929c67Db94f5b1541FB241eB3E5CbC6468c37e6", //binance deposited account + ], + }, +} + +module.exports = cexExports(config) \ No newline at end of file diff --git a/projects/entities/arca.js b/projects/entities/arca.js new file mode 100644 index 00000000000..3a88c096408 --- /dev/null +++ b/projects/entities/arca.js @@ -0,0 +1,22 @@ +const { cexExports } = require('../helper/cex') + +const config = { + ethereum: { + owners: [ + "0x23A5eFe19Aa966388E132077d733672cf5798C03", //1.6m wANT staking + "0xa66f8Db3B8F1e4c79e52ac89Fec052811F4dbd19", // 20,189.10 GMX staked + "0xe05A884D4653289916D54Ce6aE0967707c519879" + ], + }, + polygon: { + owners: [ + "0xa66f8Db3B8F1e4c79e52ac89Fec052811F4dbd19", + ], + }, + arbitrum: { + owners: [ + "0xa66f8Db3B8F1e4c79e52ac89Fec052811F4dbd19", + ], + }, +} +module.exports = cexExports(config) \ No newline at end of file diff --git a/projects/entities/axia8-venture.js b/projects/entities/axia8-venture.js new file mode 100644 index 00000000000..5bd34c5bece --- /dev/null +++ b/projects/entities/axia8-venture.js @@ -0,0 +1,17 @@ +const { cexExports } = require('../helper/cex') + +const config = { + ethereum: { + owners: [ + "0x717821AAe2A45C5c5c5bcDa7A8662cD3df2385E5", + + ], + }, + bsc: { + owners: [ + "0x717821AAe2A45C5c5c5bcDa7A8662cD3df2385E5", + ], + }, +} + +module.exports = cexExports(config) \ No newline at end of file diff --git a/projects/entities/binance-labs.js b/projects/entities/binance-labs.js new file mode 100644 index 00000000000..24f8d7b6738 --- /dev/null +++ b/projects/entities/binance-labs.js @@ -0,0 +1,12 @@ +const { cexExports } = require('../helper/cex') + +const config = { + ethereum: { + owners: [ + "0xfad531c62757cf18391E48Ee0959ab9ba106deCc", + + ], + }, +} + +module.exports = cexExports(config) \ No newline at end of file diff --git a/projects/entities/block-one.js b/projects/entities/block-one.js new file mode 100644 index 00000000000..f21dc32d1f2 --- /dev/null +++ b/projects/entities/block-one.js @@ -0,0 +1,12 @@ +const { cexExports } = require('../helper/cex') + +const config = { + ethereum: { + owners: [ + "0x24eaeCf1784c3bf9b01E011976E3D7ba917e2219", //binance deposited account + "0x2997A7a817e4b7ff60082b948a49fDAEfc042E4e" + ], + }, +} + +module.exports = cexExports(config) \ No newline at end of file diff --git a/projects/entities/blockchain-capital.js b/projects/entities/blockchain-capital.js new file mode 100644 index 00000000000..b08e4bf1beb --- /dev/null +++ b/projects/entities/blockchain-capital.js @@ -0,0 +1,14 @@ +const { cexExports } = require('../helper/cex') + +const config = { + ethereum: { + owners: [ + "0x598Dbe6738E0AcA4eAbc22feD2Ac737dbd13Fb8F", + "0x3744DA57184575064838BBc87A0FC791F5E39eA2", + "0x702caCafA54B88e9c54449563Fb2e496e85c78b7" + + ], + }, +} + +module.exports = cexExports(config) \ No newline at end of file diff --git a/projects/entities/chain-capital.js b/projects/entities/chain-capital.js new file mode 100644 index 00000000000..b4a544351ce --- /dev/null +++ b/projects/entities/chain-capital.js @@ -0,0 +1,22 @@ +const { cexExports } = require('../helper/cex') + +const config = { + ethereum: { + owners: [ + "0x4cF9faf73714b65B98557c822B6B514dfDa0E339", + "0x2489146cf124A6900bA46c6F76f18eC76d5068b9" + ], + }, + polygon: { + owners: [ + "0x4cF9faf73714b65B98557c822B6B514dfDa0E339", + ], + }, + bsc: { + owners: [ + "0x2489146cf124A6900bA46c6F76f18eC76d5068b9" + ], + }, +} + +module.exports = cexExports(config) \ No newline at end of file diff --git a/projects/entities/coin98-venture.js b/projects/entities/coin98-venture.js new file mode 100644 index 00000000000..c09aff9559b --- /dev/null +++ b/projects/entities/coin98-venture.js @@ -0,0 +1,28 @@ +const { cexExports } = require('../helper/cex') + +const config = { + ethereum: { + owners: [ + "0xFcbf806792f06d9c78E50B3737E1a22cfC36a942", + "0x9413Da1bC1797179e5D019A9420cEEc44680A4bf" + ], + }, + bsc: { + owners: [ + "0x9413Da1bC1797179e5D019A9420cEEc44680A4bf", + '0xFcbf806792f06d9c78E50B3737E1a22cfC36a942' + ], + }, + arbitrum: { + owners: [ + "0x9413Da1bC1797179e5D019A9420cEEc44680A4bf", + ], + }, + polygon: { + owners: [ + "0x9413Da1bC1797179e5D019A9420cEEc44680A4bf", + ], + }, +} + +module.exports = cexExports(config) \ No newline at end of file diff --git a/projects/entities/defiance-capital.js b/projects/entities/defiance-capital.js new file mode 100644 index 00000000000..92043e314d7 --- /dev/null +++ b/projects/entities/defiance-capital.js @@ -0,0 +1,32 @@ +const { cexExports } = require('../helper/cex') + +const config = { + ethereum: { + owners: [ + "0x7E4B4DC22111B84594d9b7707A8DCFFd793D477A", + "0xE97eb050Fa3e677e79E4ebEe7EF9c9c7D026377D", + "0x1E138759baED8a1139376a475Bf7f08053ACA016", + "0xdD709cAE362972cb3B92DCeaD77127f7b8D58202", + "0x9B5ea8C719e29A5bd0959FaF79C9E5c8206d0499" + + ], + }, + arbitrum: { + owners: [ + "0x7E4B4DC22111B84594d9b7707A8DCFFd793D477A", + ], + }, + avax: { + owners: [ + "0x7E4B4DC22111B84594d9b7707A8DCFFd793D477A", + ], + }, + bsc: { + owners: [ + "0x7E4B4DC22111B84594d9b7707A8DCFFd793D477A", + "0xdD709cAE362972cb3B92DCeaD77127f7b8D58202" + ], + }, +} + +module.exports = cexExports(config) \ No newline at end of file diff --git a/projects/entities/delphi-digital.js b/projects/entities/delphi-digital.js new file mode 100644 index 00000000000..3e2938aa339 --- /dev/null +++ b/projects/entities/delphi-digital.js @@ -0,0 +1,22 @@ +const { cexExports } = require('../helper/cex') + +const config = { + ethereum: { + owners: [ + "0x5Ca29DC4845b8cB19CCF335337b774749C7Bb617", + "0x4181805C36ad6B1b2aDb43D0b0615d676ACBF9b4", + ], + }, + bsc: { + owners: [ + "0x4181805C36ad6B1b2aDb43D0b0615d676ACBF9b4" + ], + }, + avax: { + owners: [ + "0x4181805C36ad6B1b2aDb43D0b0615d676ACBF9b4" + ], + }, +} + +module.exports = cexExports(config) \ No newline at end of file diff --git a/projects/entities/digital-finance-group.js b/projects/entities/digital-finance-group.js new file mode 100644 index 00000000000..88a171642b0 --- /dev/null +++ b/projects/entities/digital-finance-group.js @@ -0,0 +1,22 @@ +const { cexExports } = require('../helper/cex') + +const config = { + ethereum: { + owners: [ + "0xEaf3B28A87D498530cDC7f0700E70502CF896D3f", + "0x90FFFbbdf770eFB530d950C24bf56a292CDab3F7", + "0xC71BaF5d8667FfF515246811a4f61350D26A191F", + "0x36822AD3f4dF3E49EB042AFE74e43551d3c3Adba" + ], + }, + bsc: { + owners: [ + "0xEaf3B28A87D498530cDC7f0700E70502CF896D3f", + "0x2C20E739552cd0BEAF523930BAAD7754C426C962", + "0x36822AD3f4dF3E49EB042AFE74e43551d3c3Adba", + "0xC71BaF5d8667FfF515246811a4f61350D26A191F" + ], + }, +} + +module.exports = cexExports(config) \ No newline at end of file diff --git a/projects/entities/dragonfly-capital.js b/projects/entities/dragonfly-capital.js new file mode 100644 index 00000000000..ab3e8939e83 --- /dev/null +++ b/projects/entities/dragonfly-capital.js @@ -0,0 +1,18 @@ +const { cexExports } = require('../helper/cex') + +const config = { + ethereum: { + owners: [ + "0xB953E202C5E51C7C010E80402a63C02f37F14059", //1.9m$ in cega protocol + // "0xe4A2410e158a790463ba1b2c98693061f5A3A9EF", old wallet not sure if related + // "0x30BDC51A48272F96480921ea280448695D2B5d6F", old wallet not sure if related + "0x221E3c87A034E79Dd16d64762a1B20FB71594F46", + "0xF410dC5Ff862BfD36111aD492123280dDB23D495", + // "0xEC4b615C8aBfB491cD4227b165A1e389DB5e8286", old wallet not sure if related + "0xB93994e2efCAed3E88C538F68eC6A2587C3E2ebF", + "0x002A5dc50bbB8d5808e418Aeeb9F060a2Ca17346" + ], + }, +} + +module.exports = cexExports(config) \ No newline at end of file diff --git a/projects/entities/fbg-capital.js b/projects/entities/fbg-capital.js new file mode 100644 index 00000000000..bbeb547dfa0 --- /dev/null +++ b/projects/entities/fbg-capital.js @@ -0,0 +1,18 @@ +const { cexExports } = require('../helper/cex') + +const config = { + ethereum: { + owners: [ + "0xe25397734a184053cF382E5C4e32cA7eF8335F31", + "0x7c04A698855d1ECF9610636a1d7AFf8E03331fa5", + "0xb079F40dd951d842f688275100524c09bEf9b4E2" + ], + }, + avax: { + owners: [ + "0xe25397734a184053cF382E5C4e32cA7eF8335F31" + ], + }, +} + +module.exports = cexExports(config) \ No newline at end of file diff --git a/projects/entities/fenbushi-capital.js b/projects/entities/fenbushi-capital.js new file mode 100644 index 00000000000..cf891120209 --- /dev/null +++ b/projects/entities/fenbushi-capital.js @@ -0,0 +1,18 @@ +const { cexExports } = require('../helper/cex') + +const config = { + ethereum: { + owners: [ + "0xCef1B4Bf8F05F623A2A688b56d9dA679D302EBa7", + "0x5963efF631bf3d28b68388909e2404AA6dB1e7a8" // binance deposited account + + ], + }, + arbitrum: { + owners: [ + "0xCef1B4Bf8F05F623A2A688b56d9dA679D302EBa7" + ], + }, +} + +module.exports = cexExports(config) \ No newline at end of file diff --git a/projects/entities/framework-ventures.js b/projects/entities/framework-ventures.js new file mode 100644 index 00000000000..7f966027618 --- /dev/null +++ b/projects/entities/framework-ventures.js @@ -0,0 +1,11 @@ +const { cexExports } = require('../helper/cex') + +const config = { + ethereum: { + owners: [ + "0x681148725731F213b0187A3CBeF215C291D85a3E", + ], + }, +} + +module.exports = cexExports(config) \ No newline at end of file diff --git a/projects/entities/genesis-trading.js b/projects/entities/genesis-trading.js new file mode 100644 index 00000000000..b81ca876135 --- /dev/null +++ b/projects/entities/genesis-trading.js @@ -0,0 +1,25 @@ +const { cexExports } = require('../helper/cex') + +const config = { + ethereum: { + owners: [ + "0x35b517039f75df2469Af8A329b75DfE215b33790", + "0x16ADa39D140699D9a1934F05DdCf78612f342b3e", + "0x7a59384e2bD2D75fb3e83c486b61921fa517EB27", + "0x2095feFc0cf268E58087A43DBf9733532eD51B25", + "0xF65D8e83396e66340743D852db8eb116BeC0027a", + "0xBF4731191af7029f7D669D3e337a0063D1E008a3", + "0x6d21266DfcF5541BEE9F67c4837AAa72b3BF9303", + "0xd628f7c481c7Dd87F674870BEc5D7A311Fb1D9A2", + "0xaF641E29C4730530d9428A37C5934B00a73624A9", + "0x7DC47f4C227e22DA6C81fCB4c253d1DC18BeC4A3" + ], + }, + avax: { + owners: [ + "0xd628f7c481c7dd87f674870bec5d7a311fb1d9a2", + ], + }, +} + +module.exports = cexExports(config) \ No newline at end of file diff --git a/projects/entities/id-capital.js b/projects/entities/id-capital.js new file mode 100644 index 00000000000..bf2e8dfb902 --- /dev/null +++ b/projects/entities/id-capital.js @@ -0,0 +1,34 @@ +const { cexExports } = require('../helper/cex') + +const config = { + ethereum: { + owners: [ + "0xC3ad72Bf4721fdF448c970f2F8E303c57588B73c", + "0xbFC94A95d4448C802E848C68fdD2FC0fEE4a876E" + ], + }, + polygon: { + owners: [ + "0xC3ad72Bf4721fdF448c970f2F8E303c57588B73c", + "0xbFC94A95d4448C802E848C68fdD2FC0fEE4a876E" + ], + }, + bsc: { + owners: [ + "0xC3ad72Bf4721fdF448c970f2F8E303c57588B73c", + "0xbFC94A95d4448C802E848C68fdD2FC0fEE4a876E" + ], + }, + avax: { + owners: [ + "0xC3ad72Bf4721fdF448c970f2F8E303c57588B73c", + ], + }, + arbitrum: { + owners: [ + "0xC3ad72Bf4721fdF448c970f2F8E303c57588B73c", + ], + }, +} + +module.exports = cexExports(config) \ No newline at end of file diff --git a/projects/entities/jump-capital.js b/projects/entities/jump-capital.js new file mode 100644 index 00000000000..bc480ed7afb --- /dev/null +++ b/projects/entities/jump-capital.js @@ -0,0 +1,25 @@ + +const { cexExports } = require('../helper/cex') + +const config = { + ethereum: { + owners: [ + "0xCB8EFB0c065071E4110932858A84365A80C8feF0" + + ], + }, + avax: { + owners: [ + "0xCB8EFB0c065071E4110932858A84365A80C8feF0" + + ], + }, + bsc: { + owners: [ + "0xCB8EFB0c065071E4110932858A84365A80C8feF0" + + ], + }, +} + +module.exports = cexExports(config) \ No newline at end of file diff --git a/projects/entities/mechanism-capital.js b/projects/entities/mechanism-capital.js new file mode 100644 index 00000000000..032dee922f4 --- /dev/null +++ b/projects/entities/mechanism-capital.js @@ -0,0 +1,13 @@ +const { cexExports } = require('../helper/cex') + +const config = { + ethereum: { + owners: [ + "0x6Af3D183d225725d975C5EaA08D442dd01Aad8fF", + "0x953a50bd2daAa852A4Bc3E58b3AcFb95EA4E82D2", + "0x1366Dcf0f0178802Be85d405BBeA8026EC0876c4" // binance deposited account + ], + }, +} + +module.exports = cexExports(config) \ No newline at end of file diff --git a/projects/entities/mt-gox.js b/projects/entities/mt-gox.js new file mode 100644 index 00000000000..3adb8f92247 --- /dev/null +++ b/projects/entities/mt-gox.js @@ -0,0 +1,14 @@ +const { cexExports } = require('../helper/cex') + +const config = { + bitcoin: { + owners: [ + "bc1qa5wkgaew2dkv56kfvj49j0av5nml45x9ek9hz6", //https://www.reddit.com/r/CryptoCurrency/comments/li1fw7/btc_silkroad_stash_seized_nov_2020_by_the_feds/ + 'bc1qmxjefnuy06v345v6vhwpwt05dztztmx4g3y7wp', + 'bc1qf2yvj48mzkj7uf8lc2a9sa7w983qe256l5c8fs', + 'bc1qe7nk2nlnjewghgw4sgm0r89zkjzsurda7z4rdg' + ], + }, +} + +module.exports = cexExports(config) \ No newline at end of file diff --git a/projects/entities/multi-chain-capital.js b/projects/entities/multi-chain-capital.js new file mode 100644 index 00000000000..f345ba0ea67 --- /dev/null +++ b/projects/entities/multi-chain-capital.js @@ -0,0 +1,31 @@ +const { cexExports } = require('../helper/cex') + +const config = { + ethereum: { + owners: [ + "0xfbf335f8224a102e22abe78d78cc52dc95e074fa" //2.6m$ on convex + ], + }, + bsc: { + owners: [ + "0xFBf335f8224a102e22abE78D78CC52dc95e074Fa", + ], + }, + fantom: { + owners: [ + "0xFBf335f8224a102e22abE78D78CC52dc95e074Fa", + ], + }, + optimism: { + owners: [ + "0xFBf335f8224a102e22abE78D78CC52dc95e074Fa", + ], + }, + avax: { + owners: [ + "0xFBf335f8224a102e22abE78D78CC52dc95e074Fa", + ], + }, +} + +module.exports = cexExports(config) \ No newline at end of file diff --git a/projects/entities/ngc-ventures.js b/projects/entities/ngc-ventures.js new file mode 100644 index 00000000000..22f732c1cde --- /dev/null +++ b/projects/entities/ngc-ventures.js @@ -0,0 +1,31 @@ +const { cexExports } = require('../helper/cex') + +const config = { + ethereum: { + owners: [ + "0x53F470A909d7CE7f35e62f4470fD440B1eD5D8CD", + ], + }, + arbitrum: { + owners: [ + "0x53F470A909d7CE7f35e62f4470fD440B1eD5D8CD", + ], + }, + bsc: { + owners: [ + "0x53F470A909d7CE7f35e62f4470fD440B1eD5D8CD", + ], + }, + polygon: { + owners: [ + "0x53F470A909d7CE7f35e62f4470fD440B1eD5D8CD", + ], + }, + avax: { + owners: [ + "0x53F470A909d7CE7f35e62f4470fD440B1eD5D8CD", + ], + }, +} + +module.exports = cexExports(config) \ No newline at end of file diff --git a/projects/entities/pantera-capital.js b/projects/entities/pantera-capital.js new file mode 100644 index 00000000000..11a1f6c5146 --- /dev/null +++ b/projects/entities/pantera-capital.js @@ -0,0 +1,12 @@ +const { cexExports } = require('../helper/cex') + +const config = { + ethereum: { + owners: [ + "0x12ca45FEd7998ba0E56f52D678823A508BA9A99E", + "0x5789C571552b4820BfA64eFB6F0CaD80fD2A9Bca" + ], + }, +} + +module.exports = cexExports(config) \ No newline at end of file diff --git a/projects/entities/paradigm-capital.js b/projects/entities/paradigm-capital.js new file mode 100644 index 00000000000..d70a67f182f --- /dev/null +++ b/projects/entities/paradigm-capital.js @@ -0,0 +1,15 @@ +const { cexExports } = require('../helper/cex') + +const config = { + ethereum: { + owners: [ + "0x11577a8a5baf1e25b9a2d89f39670f447d75c3cd", + "0xCA8d6F69D8f32516a109Df68B623452cc9f5E64d", + "0x917B3ACa2142Dd136fa106229990EA4D02763A83", + "0x09F82Ccd6baE2AeBe46bA7dd2cf08d87355ac430", + '0x820fb25352BB0c5E03E07AFc1d86252fFD2F0A18', //LIDO TOKENS + ], + }, +} + +module.exports = cexExports(config) \ No newline at end of file diff --git a/projects/entities/plutus-vc.js b/projects/entities/plutus-vc.js new file mode 100644 index 00000000000..b14fd8ea902 --- /dev/null +++ b/projects/entities/plutus-vc.js @@ -0,0 +1,16 @@ +const { cexExports } = require('../helper/cex') + +const config = { + ethereum: { + owners: [ + "0x3105889390F894F8ee1d3f8f75E2c4dde57735bA" + ], + }, + bsc: { + owners: [ + "0x3105889390F894F8ee1d3f8f75E2c4dde57735bA" + ], + }, +} + +module.exports = cexExports(config) \ No newline at end of file diff --git a/projects/entities/polychain-capital.js b/projects/entities/polychain-capital.js new file mode 100644 index 00000000000..9e513bd9273 --- /dev/null +++ b/projects/entities/polychain-capital.js @@ -0,0 +1,13 @@ +const { cexExports } = require('../helper/cex') + +const config = { + ethereum: { + owners: [ + "0xBcd5000F5c522856E710c5d274bb672B2f2EefBf", + "0x53c286E0AbE87c9e6d4d95ebE62ceaFa4aFCE849" + ], + }, + +} + +module.exports = cexExports(config) \ No newline at end of file diff --git a/projects/entities/silkroad-fbifunds.js b/projects/entities/silkroad-fbifunds.js new file mode 100644 index 00000000000..3adb8f92247 --- /dev/null +++ b/projects/entities/silkroad-fbifunds.js @@ -0,0 +1,14 @@ +const { cexExports } = require('../helper/cex') + +const config = { + bitcoin: { + owners: [ + "bc1qa5wkgaew2dkv56kfvj49j0av5nml45x9ek9hz6", //https://www.reddit.com/r/CryptoCurrency/comments/li1fw7/btc_silkroad_stash_seized_nov_2020_by_the_feds/ + 'bc1qmxjefnuy06v345v6vhwpwt05dztztmx4g3y7wp', + 'bc1qf2yvj48mzkj7uf8lc2a9sa7w983qe256l5c8fs', + 'bc1qe7nk2nlnjewghgw4sgm0r89zkjzsurda7z4rdg' + ], + }, +} + +module.exports = cexExports(config) \ No newline at end of file diff --git a/projects/entropyfi/abi.json b/projects/entropyfi/abi.json index 5e46cf64f1a..ab7927c5f80 100644 --- a/projects/entropyfi/abi.json +++ b/projects/entropyfi/abi.json @@ -1,72 +1,7 @@ { - "allPools": { - "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "name": "allPools", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - "allPoolsLength": { - "inputs": [], - "name": "allPoolsLength", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - "aToken": { - "inputs": [], - "name": "aToken", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - "poolTokensInfo": { - "inputs": [], - "name": "poolTokensInfo", - "outputs": [ - { "internalType": "address", "name": "longToken", "type": "address" }, - { "internalType": "address", "name": "shortToken", "type": "address" }, - { "internalType": "address", "name": "sponsorToken", "type": "address" } - ], - "stateMutability": "view", - "type": "function" - }, - "status": { - "inputs": [], - "name": "status", - "outputs": [ - { - "internalType": "bool", - "name": "isShortLastRoundWinner", - "type": "bool" - }, - { "internalType": "bool", "name": "isFirstUser", "type": "bool" }, - { "internalType": "bool", "name": "isFirstRound", "type": "bool" }, - { "internalType": "uint256", "name": "gameRound", "type": "uint256" }, - { - "internalType": "uint256", - "name": "durationOfGame", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "durationOfBidding", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastUpdateTimestamp", - "type": "uint256" - }, - { "internalType": "int256", "name": "initialPrice", "type": "int256" }, - { "internalType": "int256", "name": "endPrice", "type": "int256" }, - { - "internalType": "enum ILosslessV2Pool.PoolStatus", - "name": "currState", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - } -} + "allPools": "function allPools(uint256) view returns (address)", + "allPoolsLength": "uint256:allPoolsLength", + "aToken": "address:aToken", + "poolTokensInfo": "function poolTokensInfo() view returns (address longToken, address shortToken, address sponsorToken)", + "status": "function status() view returns (bool isShortLastRoundWinner, bool isFirstUser, bool isFirstRound, uint256 gameRound, uint256 durationOfGame, uint256 durationOfBidding, uint256 lastUpdateTimestamp, int256 initialPrice, int256 endPrice, uint8 currState)" +} \ No newline at end of file diff --git a/projects/enzyme/index.js b/projects/enzyme/index.js index 8a4564982c2..5c08572d058 100644 --- a/projects/enzyme/index.js +++ b/projects/enzyme/index.js @@ -1,4 +1,4 @@ -const { get } = require('../helper/http') +const { getConfig } = require('../helper/cache') const { sumTokens } = require('../helper/unwrapLPs') const cwADA_ETH = '0x64875aaa68d1d5521666c67d692ee0b926b08b2f' const cwADA_POLY = 'polygon:0x64875aaa68d1d5521666c67d692ee0b926b08b2f' @@ -6,7 +6,7 @@ const cwDOGE_ETH = '0xf9e293d5d793ddc1ae4f778761e0b3e4aa7cf2dd' const cwDOGE_POLY = 'polygon:0x9bd9ad490dd3a52f096d229af4483b94d63be618' async function getData() { - return get('https://app.enzyme.finance/api/v1/network-asset-balances?network=ethereum') + return getConfig('enzyme', 'https://app.enzyme.finance/api/v1/network-asset-balances?network=ethereum') } async function tvl(ts, block) { diff --git a/projects/eoswap/index.js b/projects/eoswap/index.js new file mode 100644 index 00000000000..0794c363611 --- /dev/null +++ b/projects/eoswap/index.js @@ -0,0 +1,8 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports = { + misrepresentedTokens: true, + eos_evm: { + tvl: getUniTVL({ factory: '0xC0C6CCC0E73fcA8904596D558B73e0918A35018b', useDefaultCoreAssets: true, }) + } +} \ No newline at end of file diff --git a/projects/epsylon/abi.json b/projects/epsylon/abi.json index 69b6adba53f..dda88359cae 100644 --- a/projects/epsylon/abi.json +++ b/projects/epsylon/abi.json @@ -1,15 +1,3 @@ { - "totalAssets": { - "inputs": [], - "name": "totalAssets", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -} + "totalAssets": "uint256:totalAssets" +} \ No newline at end of file diff --git a/projects/epsylon/index.js b/projects/epsylon/index.js index 2a0b75871b9..a4d23ebe7fe 100644 --- a/projects/epsylon/index.js +++ b/projects/epsylon/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); const { default: BigNumber } = require("bignumber.js"); @@ -5,8 +6,8 @@ const { default: BigNumber } = require("bignumber.js"); const USDC_VAULT = "0x756d09263483dC5A6A0023bb80933db2C680703E"; const USDC_2_VAULT = "0x69e475b67052987707E953b684c7d437e15AC511"; const WFTM_VAULT = "0x22c538c1EeF31B662b71D5C8DB47847d30784976"; -const USDC = "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"; -const WFTM = "0x4e15361fd6b4bb609fa63c81a2be19d873717870"; +const USDC = ADDRESSES.ethereum.USDC; +const WFTM = ADDRESSES.ethereum.FTM; async function tvl() { let balances = {}; diff --git a/projects/equilibre/index.js b/projects/equilibre/index.js new file mode 100644 index 00000000000..12095f6c8dd --- /dev/null +++ b/projects/equilibre/index.js @@ -0,0 +1,10 @@ +const { getUniTVL } = require('../helper/cache/uniswap.js') +const { staking } = require('../helper/staking') + +module.exports = { + misrepresentedTokens: true, + kava: { + tvl: getUniTVL({ useDefaultCoreAssets: true, factory: '0xA138FAFc30f6Ec6980aAd22656F2F11C38B56a95', hasStablePools: true, }), + staking: staking("0x35361C9c2a324F5FB8f3aed2d7bA91CE1410893A", "0xE1da44C0dA55B075aE8E2e4b6986AdC76Ac77d73"), + }, +} \ No newline at end of file diff --git a/projects/equilibria/index.js b/projects/equilibria/index.js new file mode 100644 index 00000000000..eef4aa78494 --- /dev/null +++ b/projects/equilibria/index.js @@ -0,0 +1,96 @@ +const sdk = require("@defillama/sdk"); +const { sumTokensExport } = require("../helper/unwrapLPs"); + +const contracts = { + ethereum: { + boosterAddress: "0x4D32C8Ff2fACC771eC7Efc70d6A8468bC30C26bF", + staker: "0x64627901dAdb46eD7f275fD4FC87d086cfF1e6E3", + eqbAddress: "0xfE80D611c6403f70e5B1b9B722D2B3510B740B2B", + eqbRewardsAddress: "0xd8967B2B15b3CDF96039b7407813B4037f73ec27", + pendleAddress: "0x808507121b80c02388fad14726482e061b8da827", + }, + arbitrum: { + boosterAddress: "0x4D32C8Ff2fACC771eC7Efc70d6A8468bC30C26bF", + staker: "0x64627901dAdb46eD7f275fD4FC87d086cfF1e6E3", + eqbRewardsAddress: "0x70f61901658aAFB7aE57dA0C30695cE4417e72b9", + pendleAddress: "0x0c880f6761F1af8d9Aa9C466984b80DAb9a8c9e8", + }, +}; + +async function tvl(chain, block) { + const balances = {}; + + if (chain === "ethereum") { + const pendleLocked = await sdk.api2.abi.call({ + target: "0x4f30A9D41B80ecC5B94306AB4364951AE3170210", + params: contracts[chain].staker, + abi: "erc20:balanceOf", + block, + }); + sdk.util.sumSingleBalance( + balances, + contracts[chain].pendleAddress, + pendleLocked + ); + } + + const poolLength = await sdk.api2.abi.call({ + chain, + block, + target: contracts[chain].boosterAddress, + abi: "function poolLength() view returns (uint256)", + }); + + const poolInfos = await Promise.all( + Array.from(Array(Number(poolLength)).keys()).map((params) => + sdk.api2.abi.call({ + chain, + block, + target: contracts[chain].boosterAddress, + params, + abi: "function poolInfo(uint256) view returns (address market, address token, address rewardPool, bool shutdown)", + }) + ) + ); // multicall fails here + + const { output: gaugeBalances } = await sdk.api.abi.multiCall({ + abi: "erc20:balanceOf", + calls: Array.from(new Set(poolInfos.map((p) => p.market))).map((i) => ({ + target: i, + params: contracts[chain].staker, + })), + chain, + block, + }); + + gaugeBalances.forEach(({ output, input }, i) => + sdk.util.sumSingleBalance( + balances, + chain + + ":" + + poolInfos.find( + (p) => p.market.toLowerCase() === input.target.toLowerCase() + ).market, + output + ) + ); + + return balances; +} + +const chains = ["ethereum", "arbitrum"]; + +module.exports = { + doublecounted: true, +}; + +chains.forEach((chain) => { + module.exports[chain] = { + tvl: async (_, _b, { [chain]: block }) => tvl(chain, block), + }; +}); + +module.exports.ethereum.staking = sumTokensExport({ + owner: contracts.ethereum.eqbRewardsAddress, + tokens: [contracts.ethereum.eqbAddress], +}); diff --git a/projects/equilibrium/api.js b/projects/equilibrium/api.js new file mode 100644 index 00000000000..d5ec233bdf9 --- /dev/null +++ b/projects/equilibrium/api.js @@ -0,0 +1,97 @@ +const { ApiPromise, WsProvider } = require("@polkadot/api"); +const BN = require("bn.js"); + +const capitalize = (str) => str.slice(0, 1).toUpperCase() + str.slice(1); + +const currencyFromU64 = (u64) => { + const bytes = []; + let num = typeof u64 === "number" ? new BN(u64) : u64; + do { + bytes.unshift(num.modn(256)); + num = num.divn(256); + } while (num.gtn(0)); + return capitalize(Buffer.from(bytes).toString("utf8")); +}; + +const u64FromCurrency = (currency) => { + const buf = Buffer.from(currency.toLowerCase()); + const size = buf.length; + return buf.reduce((val, digit, i) => val + Math.pow(256, size - 1 - i) * digit, 0); +}; + +const ASSETS = { + // Do not incluede Eq token in product TVL + "Eq": "", + "Aca": "Acala", + "Bnb": "binancecoin", + "Bnc": "bifrost-native-coin", + "Cru": "crust-network", + "Dot": "polkadot", + "Eqd": "", + "Lit": "Litentry ", + "Pha": "Phala", + "Astr": "Astar", + "Busd": "binance-usd", + "Glmr": "Moonbeam", + "Ibtc": "Bitcoin", + "Intr": "Interlay", + "Lpt0": "", + "Lpt1": "", + "Para": "parallel-finance", + "Usdt": "tether", + "Xdot": "polkadot", + "Cd613": "polkadot", + "Cd714": "polkadot", + "Cd815": "polkadot", + "Eqdot": "polkadot", + "Mxeth": "ethereum", + "Xdot2": "polkadot", + "Xdot3": "polkadot", + "Mxusdc": "usd-coin", + "Mxwbtc": "wrapped-bitcoin", +}; + +const PRECISION = 1_000_000_000n; + +async function tvl() { + const provider = new WsProvider("wss://node.pol.equilibrium.io/"); + const api = await ApiPromise.create({ provider }); + + const assets = (await api.query.eqAssets.assets()).unwrap(); + + const queries = assets.map(({ id }) => { + return [api.query.eqAggregates.totalUserGroups, ["Balances", { 0: id }]]; + }); + + const balances = await api.queryMulti(queries); + + const eqDotPrice = (await api.query.oracle.pricePoints(u64FromCurrency("eqdot"))).unwrap().price.toNumber() + / (await api.query.oracle.pricePoints(u64FromCurrency("dot"))).unwrap().price.toNumber(); + + const accuracy = 10000; + + const result = assets.reduce((acc, { id }, i) => { + const symbol = currencyFromU64(id) + const coiungekoAsset = ASSETS[symbol]; + if (coiungekoAsset) + { + let amount = Number(balances[i].collateral.toBigInt() * BigInt(accuracy) / PRECISION) / accuracy; + + // eqDot staking token + if (symbol == "Eqdot") + { + amount *= eqDotPrice; + } + acc[coiungekoAsset] = (acc[coiungekoAsset] ?? 0) + amount; + } + return acc; + }, {}); + + console.log(JSON.stringify(result)); + + return result; +} + +module.exports = { + equilibrium: {tvl}, +} \ No newline at end of file diff --git a/projects/equilibrium/index.js b/projects/equilibrium/index.js index 6e714ba071f..52f805a0899 100644 --- a/projects/equilibrium/index.js +++ b/projects/equilibrium/index.js @@ -1,28 +1,6 @@ -const { get_account_tvl } = require("../helper/chain/eos"); - -const accounts = [ - "eosdtcntract", // EOS collateral - "eosdtpbtcpos", // PBTC collateral - "eosdtstfund1", // Stability Fund - "eosdtstfund2", // Stability Fund - "eosdtstfund3", // Stability Fund -] - -const tokens = [ - ["btc.ptokens", "PBTC", "ptokens-btc"], - ["eosio.token", "EOS", "eos"] -]; - -// Equilibrium -// https://eosdt.com -// https://equilibrium.io -async function eos() { - return await get_account_tvl(accounts, tokens); -} +const { getExports } = require('../helper/heroku-api') module.exports = { - methodology: `Equilibrium TVL is achieved by querying token balances from EOSDT stable token smart contracts.`, - eos: { - tvl: eos - }, -} + timetravel: false, + ...getExports("equilibrium", ['equilibrium']) +} \ No newline at end of file diff --git a/projects/equito-finance/index.js b/projects/equito-finance/index.js new file mode 100644 index 00000000000..25c3c7de99a --- /dev/null +++ b/projects/equito-finance/index.js @@ -0,0 +1,38 @@ +const ADDRESSES = require("../helper/coreAssets.json"); +const { sumTokensExport } = require("../helper/sumTokens"); + +// Addresses +const ALGO_VAULT1 = + "XYE5SU66M6JV24REYQJMXUMIWK54X5I6TWYP25RIA3NH7YEEY6UPPWM3RY"; +const ETH_VAULT1 = "0x274af57Cc969cA96980BA043332D4fb79F496708"; +const BSC_VAULT1 = "0x9Aa09a1D7ACD6Bb7b4bB5ae4c6F91279E78502a8"; + +const ALGO_VAULT2 = + "56CF35MFZHMCWTVJZLNBTP62UJKFRRKW47GTSOVATZONVEZ6ASSWRWOOHM"; +const ETH_VAULT2 = "0x4d753245f273e119Be944Ae180A17DfE35258e1e"; +const BSC_VAULT2 = "0x7aFeCFABBA462121262D81d764e289aB77966aec"; + +// Tokens +const ETH_PSYOP = "0xaa07810aE08575921c476Ff088bc949da43e4964"; + +module.exports = { + hallmarks: [ + [1671724719, "Start of bridge"], + [1683547217, "Ethereum, Binance vaults deployed"], + ], + methodology: + "TVL counts native tokens locked in EquitoFinance bridge vaults.", + algorand: { tvl: sumTokensExport({ owners: [ALGO_VAULT1, ALGO_VAULT2] }) }, + ethereum: { + tvl: sumTokensExport({ + owners: [ETH_VAULT1, ETH_VAULT2], + tokens: [ADDRESSES.null, ADDRESSES.ethereum.INU, ETH_PSYOP], + }), + }, + bsc: { + tvl: sumTokensExport({ + owners: [BSC_VAULT1, BSC_VAULT2], + tokens: [ADDRESSES.null], + }), + }, +}; diff --git a/projects/equity/index.js b/projects/equity/index.js new file mode 100644 index 00000000000..ac9a5fa9678 --- /dev/null +++ b/projects/equity/index.js @@ -0,0 +1,9 @@ +// Equity - Central Vaults +const { gmxExports } = require("../helper/gmx"); + +module.exports = { + fantom: { + //tvl: gmxExports({ vault: '0x9e4105f9e2284532474f69e65680e440f4c91cb8' }), // Vault #1 - Disabled + tvl: gmxExports({ vault: '0x0Fb84ADB9c16D28b92c09c382CaadbDdD8e354c4' }), // Vault #2 + }, +}; diff --git a/projects/erasure/abi.json b/projects/erasure/abi.json index ae521055b41..3f3edb755ed 100644 --- a/projects/erasure/abi.json +++ b/projects/erasure/abi.json @@ -1,42 +1,4 @@ { - "getInstanceCount": { - "constant": true, - "inputs": [], - "name": "getInstanceCount", - "outputs": [ - { - "name": "count", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "getPaginatedInstances": { - "constant": true, - "inputs": [ - { - "internalType": "uint256", - "name": "startIndex", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "endIndex", - "type": "uint256" - } - ], - "name": "getPaginatedInstances", - "outputs": [ - { - "internalType": "address[]", - "name": "instances", - "type": "address[]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } -} + "getInstanceCount": "uint256:getInstanceCount", + "getPaginatedInstances": "function getPaginatedInstances(uint256 startIndex, uint256 endIndex) view returns (address[] instances)" +} \ No newline at end of file diff --git a/projects/erasure/index.js b/projects/erasure/index.js index 237cf190ff2..d2d19e78711 100644 --- a/projects/erasure/index.js +++ b/projects/erasure/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') /*================================================== Modules ==================================================*/ @@ -22,7 +23,7 @@ const tokenAddresses = [ '0x1776e1F26f98b1A5dF9cD347953a26dd3Cb46671', // NMR - '0x6B175474E89094C44Da98b954EedeAC495271d0F' // DAI + ADDRESSES.ethereum.DAI // DAI ] /*================================================== diff --git a/projects/ergodex/index.js b/projects/ergodex/index.js deleted file mode 100644 index 2e4c4247e1c..00000000000 --- a/projects/ergodex/index.js +++ /dev/null @@ -1,12 +0,0 @@ -const utils = require("../helper/utils"); - -const api_ergo = "https://api.ergodex.io/v1/amm/platform/stats?"; - -async function fetch() { - const data = (await utils.fetchURL(api_ergo)).data.tvl; - return data.value / 10 ** data.units.currency.decimals; -} - -module.exports = { - fetch, -}; diff --git a/projects/ergopad/index.js b/projects/ergopad/index.js index df62b8fdf60..bf427343285 100644 --- a/projects/ergopad/index.js +++ b/projects/ergopad/index.js @@ -1,40 +1,16 @@ -const utils = require('../helper/utils'); - -async function staking() { - const { data: { 'Total amount staked': totalStaked } } = await utils.fetchURL('https://api.ergopad.io/staking/status/'); - const price = await getErgopadPrice() - return { - ergo: totalStaked * price - } -} - -async function getErgopadPrice() { - const { data: { lockedX, lockedY, } } = await utils.fetchURL('https://api.ergodex.io/v1/amm/pool/d7868533f26db1b1728c1f85c2326a3c0327b57ddab14e41a2b77a5d4c20f4b2/stats'); - let ergQuantity, padQunatity - - const ergId = '0000000000000000000000000000000000000000000000000000000000000000' - if (lockedX.id === ergId) { - ergQuantity = getQuantity(lockedX) - padQunatity = getQuantity(lockedY) - } else { - ergQuantity = getQuantity(lockedY) - padQunatity = getQuantity(lockedX) - } - - function getQuantity({ amount, decimals }) { - return amount / 10 ** decimals - } - - return ergQuantity / padQunatity - -} +const { sumTokensExport } = require('../helper/sumTokens') module.exports = { - misrepresentedTokens: true, timetravel: false, ergo: { tvl: () => ({}), - staking + staking: sumTokensExport({ + owners: [ + '3eiC8caSy3jiCxCmdsiFNFJ1Ykppmsmff2TEpSsXY1Ha7xbpB923Uv2midKVVkxL3CzGbSS2QURhbHMzP9b9rQUKapP1wpUQYPpH8UebbqVFHJYrSwM3zaNEkBkM9RjjPxHCeHtTnmoun7wzjajrikVFZiWurGTPqNnd1prXnASYh7fd9E2Limc2Zeux4UxjPsLc1i3F9gSjMeSJGZv3SNxrtV14dgPGB9mY1YdziKaaqDVV2Lgq3BJC9eH8a3kqu7kmDygFomy3DiM2hYkippsoAW6bYXL73JMx1tgr462C4d2PE7t83QmNMPzQrD826NZWM2c1kehWB6Y1twd5F9JzEs4Lmd2qJhjQgGg4yyaEG9irTC79pBeGUj98frZv1Aaj6xDmZvM22RtGX5eDBBu2C8GgJw3pUYr3fQuGZj7HKPXFVuk3pSTQRqkWtJvnpc4rfiPYYNpM5wkx6CPenQ39vsdeEi36mDL8Eww6XvyN4cQxzJFcSymATDbQZ1z8yqYSQeeDKF6qCM7ddPr5g5fUzcApepqFrGNg7MqGAs1euvLGHhRk7UoeEpofFfwp3Km5FABdzAsdFR9', + 'BxjSQHD1hqQFUXbXatkn46YUxM6wVsLkT5HNXJe1N1n3dM2c7X8BtgnLqszJuxoRTnzXzrCrmEjPyLxqstcnW7YkQJ9m7QTmhChBYt1hAFcTWiyVMdaiYYFtxr7qfXKcjsadtfusNhS63ZddciC3wogjrfSE3U2Fy9dhrrKStUVzWhTP22ZuwdDPv8F88WVtdLsu24bbHsv2ntXZJGhvdKnvJL83kJWs9XV582sqUBqX7kL2A5qp6T2Jxgt3gLxcZ99JhUG99YtRsmpuwb94TE5KVTESWA6cD8EdReTbP1kwW77rnJyNfj8KUsy1j7AZuNBUsVBc3oLV4GxYFDvaTNEyNBmGY3dEe8k7UKjUSnqCmYH2QM2cmhtPEdT6UBR9sS4h4YFiGsRHiybjuTSaBUPrzhJ12ESKf8jcaNna9rYprzm8ZnfwNEQFtPJyKfCoJjbwkfsAEirsMcyU3VjPAvKJ2mtu7A3WwXViBSfwUgdCnWkEhdPCRPueAXfN38JXG8HjJeZTPi3VtgcnFobg8Zjp1XtRkTaoj6i4BgyfwCft3sCYgBgmNjXhtFuuozpCiAXWyGMMs5rhJL6FzXsJWiTSML96LdshFnhoPRPi8FXVooURKztnqJowFcpLApL2ou2jfeC4iaxKgtd6zDR6ikFVXMsipVHmBrhan9dheUPnfjeXz9WVPmGLmVkrxnVv', + '5ASYVJ2w8tH3bDMmDvjvgX76HQen4rcvoHku32GsL9js8THW6rduV5VDy8Diue6rRQfp4DRTs4P9bd4vjQY9mmE94A473YeANVps31i76HD88Xk3oeuMgWSgAPuTncfYG1hYHvyT9N7RECUYb64Hs8b2kuvUksccZ841k1vYTmhzseiAFEC59PPnfxxJ4EL9MJ6oHSfwwJBYaZHjmH5eCPkXbJZhGwnTb6bFXvCGGucjDXhmiDPSXGUU49U3r8gN2eTnbh5Dz5mh9eSudUGf7N1fWtT3asz1uruMcdYeNFptD2jFNz6MDTqajZjSEw5guvAmvZAYnfiXwRW8yQyqbd5GcwiuiaPybcGThdf5TLhYxrNeTr1eLn7d1A1RGvySo8dz9vHNrzsK4Zd8HGK4ofhE4kwepyNbYWJY9XbfKVZxqtmLTUHwheNwiJ7cQSCcQUFyMZwAKmjuXdPrVZ9AftFc5gkdqdaC82ya8oMhsbHBV68yorJbp4yyXs8qjaegUfEb4TEZ4L9NsTTsKZxfHB2GypBmssJ6gHGEongQWnca3zqSV9A55SGwbvMQrrkrnvAe9UVsK1h6XwzBj41vF2faVp7Sfp5noqJi9jZjobiCTYA344RW6dNpGS2YpxNzrZtxvyVhmyF9Tms7nSTUMpbF4L', + '5ASYVJ2w8tH3bDQx5ZLz6rZUdokD1kmTXSRZ8GfrsAUW4vqy9eg5omtTYVzY22ibHANf7GgSc2E5FiThgo8qXzWpU3RDLohN277hksbAf9yykajXbYPUaXUeMPfSXbS1GdE4y2GoYKaXHR3H57MV5CDZE58YteqWe3XVXzmMvj1192AD7UZ1N6nguRfjgijxEWTrLq2ZrykjRAut2JBGYHanAKn46tYWW3chpxNosXG7ZW2ShDzKju2ttHhfxeZVMBydryuoEya5E9KVagjsfa9E2qPUdLpbh8enppVWcwoQ4GF1ktgzSX32QbfKhfpD23iWQixThUbcCca14FjXDt94GVFPuhAT5tQyiKen863Cq5eRAEgsQ7otX6pWa32Q28sxSF9Az4abwiJKNbFhbhb3cDCs6A45ZnW6aB6AkfwTJSAZ2ZzqqG7LXT4HdxNpdmiwno9sJWxPf2PC4vRhVqBPdxxyCgoodjyutf4UuinSCibhfqdhUJLc1JM8zX9UcD699mChgUZoKE8kXD4soVGSgQD3qfGXC6RP7n8dtowArNLm3H5QJ3EobDCbEgECLHFaHN2BPwwWscAt5eejKeFvkp3CuQ3mqFW7vfQG4n9tTLnshj8cjxnpkBdfFKC83sW8A3AoZAX4K1UrhndfLSFh4w', + ] + }) }, - methodology: `Ergopad TVL is achieved by making a call to its API: https://ergopad.io/api/blockchain/tvl/d71693c49a84fbbecd4908c94813b46514b18b67a99952dc1e6e4791556de413 and consists of both staked ergopad tokens.` } diff --git a/projects/eris-protocol/index.js b/projects/eris-protocol/index.js index b8849fdc9fd..e8ffe72bfed 100644 --- a/projects/eris-protocol/index.js +++ b/projects/eris-protocol/index.js @@ -1,57 +1,204 @@ -const { queryContract } = require("../helper/chain/terra"); +const { + queryContract: queryContractCosmos, + getBalance, + getBalance2, +} = require("../helper/chain/cosmos"); // For testing run // node test.js projects/eris-protocol/index.js const config = { - terra2_hub: - "terra10788fkzah89xrdm27zkj5yvhj9x3494lxawzm5qq3vvxcqz2yzaqyd3enk", - terra2_farms: [ - "terra1lv2cscvakmtaahj8a6kw43zaefzemydwaswrf38sn2s2depv0wls6ut57q", - "terra1r0ykpvttzxdx573hypmmdzq4g8e2k5cf5ur0rrjhp6mxrux9rmaq9xw9ff", - "terra1c6vzxwfcfur2fg08n3nhtdlaxpmjd5wk9nztv8fjgfsjgagtghzsfftutt", - "terra1xskgvsew6u6nmfwv2mc58m4hscr77xw884x65fuxup8ewvvvuyysr5k3lj", - "terra1q3q88nyhn7a206djjk40xespszrwg26s8j5fswfgsv6cyu8qlsmsncmppe", - "terra1qv5pklpnqmugqfehsytakk7tj2fsw4kt69xn2gvaq0edsynm9c7qnjecq2", - "terra1c98f5dg90cyx5uklezsvac46e4c3msq3ghktkmeksyahytsvuh0q438m6c", - "terra129jsdzd9nm7ywuyr0hlxs3zqm7jle00vtl4akf4wuke4yr5zs82qafcm4n", - ], - terra2_coinGeckoMap: { - "ibc/B3504E092456BA618CC28AC671A71FB08C6CA0FD0BE7C8A5B5A3E2DD933CC9E4": - "usd-coin", - "ibc/CBF67A2BCF6CAE343FDF251E510C8E18C361FC02B23430C121116E0811835DEF": - "tether", - terra1nsuqsk6kh58ulczatwev87ttq2z6r3pusulg9r24mfj2fvtzd4uq3exn26: - "astroport-fi", - uluna: "terra-luna-2", + terra2: { + coinGeckoId: "terra-luna-2", + coinGeckoIdAmp: "eris-amplified-luna", + hub: "terra10788fkzah89xrdm27zkj5yvhj9x3494lxawzm5qq3vvxcqz2yzaqyd3enk", + arbVault: + "terra1r9gls56glvuc4jedsvc3uwh6vj95mqm9efc7hnweqxa2nlme5cyqxygy5m", + voteEscrow: + "terra1ep7exp42jjtwgjly36y4vgylz82fplnjwpkz95wljzwfald8zwwqggsdzz", + ampToken: + "terra1ecgazyd0waaj3g7l9cmy5gulhxkps2gmxu9ghducvuypjq68mq2s5lvsct", + farms: [ + "terra1lv2cscvakmtaahj8a6kw43zaefzemydwaswrf38sn2s2depv0wls6ut57q", + "terra1r0ykpvttzxdx573hypmmdzq4g8e2k5cf5ur0rrjhp6mxrux9rmaq9xw9ff", + "terra1c6vzxwfcfur2fg08n3nhtdlaxpmjd5wk9nztv8fjgfsjgagtghzsfftutt", + "terra1xskgvsew6u6nmfwv2mc58m4hscr77xw884x65fuxup8ewvvvuyysr5k3lj", + "terra1q3q88nyhn7a206djjk40xespszrwg26s8j5fswfgsv6cyu8qlsmsncmppe", + "terra1qv5pklpnqmugqfehsytakk7tj2fsw4kt69xn2gvaq0edsynm9c7qnjecq2", + "terra1c98f5dg90cyx5uklezsvac46e4c3msq3ghktkmeksyahytsvuh0q438m6c", + "terra129jsdzd9nm7ywuyr0hlxs3zqm7jle00vtl4akf4wuke4yr5zs82qafcm4n", + "terra1v4gh6nrps2yjdzqct5m7mwqkfusxgghjvd7sy5dsndsyy86pfyasum2qh5", + "terra1g0g5ehu2lvdrta9m62yggaa6x375lz5t5zas3xnzmna7kx74szlsw20es6", + "terra1l4phwrfqyg9l0vzlqcxn0vmnjd45rp5gx620zc2updpc9peazteqfk3y2p", + ], + coinGeckoMap: { + "ibc/B3504E092456BA618CC28AC671A71FB08C6CA0FD0BE7C8A5B5A3E2DD933CC9E4": + "usd-coin", + "ibc/CBF67A2BCF6CAE343FDF251E510C8E18C361FC02B23430C121116E0811835DEF": + "tether", + terra1nsuqsk6kh58ulczatwev87ttq2z6r3pusulg9r24mfj2fvtzd4uq3exn26: + "astroport-fi", + uluna: "terra-luna-2", + terra1ecgazyd0waaj3g7l9cmy5gulhxkps2gmxu9ghducvuypjq68mq2s5lvsct: + "eris-amplified-luna", + }, + }, + terra: { + coinGeckoId: "terra-luna", + hub: "terra1zmf49p3wl7ck2cwer7kghzumfpwhfqk6x893ah", + }, + kujira: { + coinGeckoId: "kujira", + hub: "kujira1n3fr5f56r2ce0s37wdvwrk98yhhq3unnxgcqus8nzsfxvllk0yxquurqty", + voteEscrow: + "kujira1mxzfcxpn6cjx4u9zln6ttxuc6fuw6g0cettd6nes74vrt2f22h4q3j5cdz", + ampToken: + "factory/kujira1n3fr5f56r2ce0s37wdvwrk98yhhq3unnxgcqus8nzsfxvllk0yxquurqty/ampKUJI", + }, + juno: { + coinGeckoId: "juno-network", + hub: "juno17cya4sw72h4886zsm2lk3udxaw5m8ssgpsl6nd6xl6a4ukepdgkqeuv99x", + }, + migaloo: { + coinGeckoId: "white-whale", + hub: "migaloo1436kxs0w2es6xlqpp9rd35e3d0cjnw4sv8j3a7483sgks29jqwgshqdky4", + voteEscrow: + "migaloo1hntfu45etpkdf8prq6p6la9tsnk3u3muf5378kds73c7xd4qdzysuv567q", + ampToken: + "factory/migaloo1436kxs0w2es6xlqpp9rd35e3d0cjnw4sv8j3a7483sgks29jqwgshqdky4/ampWHALE", + // currently not running due to node simulation gas issues + arbVault: + "migaloo1ey4sn2mkmhew4pdrzk90l9acluvas25qlhuvsfgssw42ugz8yjlqx92j9l", + }, + osmosis: { + coinGeckoId: "osmosis", + hub: "osmo1dv8wz09tckslr2wy5z86r46dxvegylhpt97r9yd6qc3kyc6tv42qa89dr9", + voteEscrow: + "osmo1vcg9a7zwfeuqwtkya5l34tdgzxnafdzpe22ahphd02uwed43wnfs3wtf8a", + ampToken: + "factory/osmo1dv8wz09tckslr2wy5z86r46dxvegylhpt97r9yd6qc3kyc6tv42qa89dr9/ampOSMO", + }, + injective: { + coinGeckoId: "injective-protocol", + hub: "inj1cdwt8g7nxgtg2k4fn8sj363mh9ahkw2qt0vrnc", + voteEscrow: "inj1yp0lgxq460ked0egtzyj2nck3mdhr8smfmteh5", + ampToken: "factory/inj1cdwt8g7nxgtg2k4fn8sj363mh9ahkw2qt0vrnc/ampINJ", + decimals: 18, + }, + neutron: { + farms: [ + "neutron1h4ehzx3j92jv4tkgjy3k2qphh5863l68cyep7vaf83fj6k89l4lqjfyh77", + "neutron1sfmpf84xacu2la88zzsgende2jjlczswdmhzn7jh6tuhn43jl86q6d0vhj", + "neutron1smam4j5cypw2vp7un3q8w68sg97zq9s2c95ukwsmpsl2jh4xwzdskxm6az", + "neutron188xz8cg4uqk4ssg9tcf3q2764ar8ev0jr8qpx2qspchul98ykzuqx58r50", + ], + coinGeckoMap: { + "ibc/F082B65C88E4B6D5EF1DB243CDA1D331D002759E938A0F5CD3FFDC5D53B3E349": + "usd-coin", + "ibc/57503D7852EF4E1899FE6D71C5E81D7C839F76580F86F21E39348FC2BC9D7CE2": + "tether", + "ibc/5751B8BCDA688FD0A8EC0B292EEF1CDEAB4B766B63EC632778B196D317C40C3A": + "astroport-fi", + untrn: "neutron-3", + "ibc/C4CFF46FD6DE35CA4CF4CE031E643C8FDC9BA4B99AE598E9B0ED98FE3A2319F9": + "cosmos", + }, + }, + chihuahua: { + coinGeckoId: "chihuahua-token", + hub: "chihuahua1nktfhalzvtx82kyn4dh6l8htcl0prfpnu380a39zj52nzu3j467qqg23ry", }, - terra_hub: "terra1zmf49p3wl7ck2cwer7kghzumfpwhfqk6x893ah", }; -async function terra2Tvl() { - let results = await Promise.all([ - hub2Tvl(), - ...config.terra2_farms.map(farm2Tvl), - ]); +async function getState(chain, contract) { + if (!contract) { + return {}; + } + return queryContractCosmos({ + contract, + chain, + data: { state: {} }, + }); +} - return merge(results); +async function tvlHub(chain, state) { + let chainConfig = config[chain]; + let coinGeckoId = chainConfig.coinGeckoId; + + state ||= await getState(chain, chainConfig.hub); + + let tvl = + +(state.tvl_uluna ?? state.tvl_utoken ?? 0) / getDecimalFactor(chainConfig); + return { + [coinGeckoId]: tvl, + }; } -async function hub2Tvl() { - const res = await queryContract({ - isTerra2: true, - contract: config.terra2_hub, - data: { state: {} }, - }); +function getDecimalFactor(chainConfig) { + let decimals = chainConfig.decimals ?? 6; + return Math.pow(10, decimals); +} + +async function tvlArbVault(chain) { + let chainConfig = config[chain]; + let coinGeckoId = chainConfig.coinGeckoId; + + if (!chainConfig.arbVault) { + return {}; + } + const res = await getState(chain, chainConfig.arbVault); + + let tvl = +(res.balances.tvl_utoken ?? 0) / getDecimalFactor(chainConfig); return { - "terra-luna-2": +res.tvl_uluna / 1e6, + [coinGeckoId]: tvl, }; } -async function farm2Tvl(farm) { - const res = await queryContract({ - isTerra2: true, +async function tvlAmpGovernance(chain, state) { + let chainConfig = config[chain]; + + if (!chainConfig.ampToken) { + return {}; + } + + let isTokenFactory = chainConfig.ampToken.startsWith("factory"); + + let ampAmount = 0; + + if (isTokenFactory) { + let balances = await getBalance2({ + owner: chainConfig.voteEscrow, + token: isTokenFactory, + chain, + }); + + ampAmount = +(balances[chainConfig.ampToken] ?? 0); + } else { + ampAmount = await getBalance({ + owner: chainConfig.voteEscrow, + token: chainConfig.ampToken, + chain, + }); + } + + if (chainConfig.coinGeckoIdAmp) { + return { + [chainConfig.coinGeckoIdAmp]: ampAmount / getDecimalFactor(chainConfig), + }; + } else { + state ||= await getState(chain, chainConfig.hub); + let amount = + (ampAmount / getDecimalFactor(chainConfig)) * +state.exchange_rate; + return { + [chainConfig.coinGeckoId]: amount, + }; + } +} + +async function farm2Tvl(chain, farm) { + const res = await queryContractCosmos({ + chain: chain, contract: farm, data: { state: {} }, }); @@ -70,8 +217,8 @@ async function farm2Tvl(farm) { amount: +res.locked_assets[1].amount, }; - token1.coinGeckoId = getCoinGeckoId(token1.denom); - token2.coinGeckoId = getCoinGeckoId(token2.denom); + token1.coinGeckoId = getCoinGeckoId(chain, token1.denom); + token2.coinGeckoId = getCoinGeckoId(chain, token2.denom); let results = []; if (token1.coinGeckoId) { @@ -92,8 +239,13 @@ async function farm2Tvl(farm) { return merge(results); } -function getCoinGeckoId(denom) { - return config.terra2_coinGeckoMap[denom]; +function getCoinGeckoId(chain, denom) { + return config[chain].coinGeckoMap[denom]; +} + +async function mergePromises(elements) { + let results = await Promise.all(elements); + return merge(results); } function merge(elements) { @@ -110,22 +262,36 @@ function merge(elements) { }, {}); } -async function terraTvl() { - const res = await queryContract({ - isTerra2: false, - contract: config.terra_hub, - data: { state: {} }, - }); - - return { - "terra-luna": +res.tvl_uluna / 1e6, - }; +async function productsTvl(chain) { + let chainConfig = config[chain]; + try { + let state = await getState(chain, chainConfig.hub); + return await mergePromises([ + tvlHub(chain, state), + tvlAmpGovernance(chain, state), + tvlArbVault(chain).catch((a) => ({})), + ...(chainConfig.farms ?? []).map((farm) => farm2Tvl(chain, farm)), + ]); + } catch (error) { + let url = error?.response?.config?.url; + if (url) { + console.log("Issue calling", error?.response?.config?.url); + } + throw error; + } } module.exports = { timetravel: false, misrepresentedTokens: false, methodology: "Liquid Staking and Arbitrage Protocol", - terra2: { tvl: terra2Tvl }, - terra: { tvl: terraTvl }, + terra2: { tvl: () => productsTvl("terra2") }, + terra: { tvl: () => productsTvl("terra") }, + kujira: { tvl: () => productsTvl("kujira") }, + juno: { tvl: () => productsTvl("juno") }, + migaloo: { tvl: () => productsTvl("migaloo") }, + injective: { tvl: () => productsTvl("injective") }, + osmosis: { tvl: () => productsTvl("osmosis") }, + neutron: { tvl: () => productsTvl("neutron") }, + chihuahua: { tvl: () => productsTvl("chihuahua") }, }; diff --git a/projects/esdt-market/index.js b/projects/esdt-market/index.js new file mode 100644 index 00000000000..e61424d0faa --- /dev/null +++ b/projects/esdt-market/index.js @@ -0,0 +1,8 @@ +const { sumTokensExport } = require('../helper/sumTokens') + +module.exports = { + timetravel: false, + elrond: { + tvl: sumTokensExport({ chain: 'elrond', owner: 'erd1qqqqqqqqqqqqqpgqr8z5hkwek0pmytcvla86qjusn4hkufjlrp8s7hhkjk', }) + } +} \ No newline at end of file diff --git a/projects/ester/abi.json b/projects/ester/abi.json index 38f9629b95b..a7b6dcf79ff 100644 --- a/projects/ester/abi.json +++ b/projects/ester/abi.json @@ -1,116 +1,7 @@ { - "poolInfoStaking": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "poolInfo", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "allocPoint", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastRewardTime", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accESTPerShare", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "poolInfo": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "poolInfo", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "want", - "type": "address" - }, - { - "internalType": "uint256", - "name": "allocPoint", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastRewardTime", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accESTPerShare", - "type": "uint256" - }, - { - "internalType": "address", - "name": "strat", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "poolLength": { - "inputs": [], - "name": "poolLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "wantLockedTotal": { - "inputs": [], - "name": "wantLockedTotal", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "symbol": { - "constant": true, - "inputs": [], - "name": "symbol", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } + "poolInfoStaking": "function poolInfo(uint256) view returns (address token, uint256 allocPoint, uint256 lastRewardTime, uint256 accESTPerShare)", + "poolInfo": "function poolInfo(uint256) view returns (address want, uint256 allocPoint, uint256 lastRewardTime, uint256 accESTPerShare, address strat)", + "poolLength": "uint256:poolLength", + "wantLockedTotal": "uint256:wantLockedTotal", + "symbol": "string:symbol" } \ No newline at end of file diff --git a/projects/etcswap/index.js b/projects/etcswap/index.js index 1d70984a77b..74dce7673e0 100644 --- a/projects/etcswap/index.js +++ b/projects/etcswap/index.js @@ -5,7 +5,6 @@ module.exports = { "Factory address (0x0307cd3d7da98a29e6ed0d2137be386ec1e4bc9c) is used to find the LP pairs. TVL is equal to the liquidity on the AMM.", ethereumclassic: { tvl: getUniTVL({ - chain: 'ethereumclassic', factory: '0x0307cd3d7da98a29e6ed0d2137be386ec1e4bc9c', useDefaultCoreAssets: true, }) diff --git a/projects/eternalFinance/helper.js b/projects/eternalFinance/helper.js new file mode 100644 index 00000000000..83a252145c6 --- /dev/null +++ b/projects/eternalFinance/helper.js @@ -0,0 +1,12 @@ +const moduleAddress = '0x25a64579760a4c64be0d692327786a6375ec80740152851490cfd0b53604cf95'; +const resourceAddress = '0x25a64579760a4c64be0d692327786a6375ec80740152851490cfd0b53604cf95'; + +function getTypeArgs(struct) { + return struct.split('<')[1].split('>')[0].split(', '); +} + +module.exports = { + getTypeArgs, + moduleAddress, + resourceAddress, +} \ No newline at end of file diff --git a/projects/eternalFinance/index.js b/projects/eternalFinance/index.js new file mode 100644 index 00000000000..82b44ef0a22 --- /dev/null +++ b/projects/eternalFinance/index.js @@ -0,0 +1,19 @@ +const { lyfTvl } = require("./lyf"); +const { lendingTvl } = require("./lending"); +const sdk = require('@defillama/sdk') + +async function tvl() { + const lyf = await lyfTvl(); + const lending = await lendingTvl(); + const balances = {} + sdk.util.mergeBalances(balances, lyf) + sdk.util.mergeBalances(balances, lending) + return balances +} + +module.exports = { + timetravel: false, + aptos: { + tvl, + } +} \ No newline at end of file diff --git a/projects/eternalFinance/lending.js b/projects/eternalFinance/lending.js new file mode 100644 index 00000000000..939cc40bdc0 --- /dev/null +++ b/projects/eternalFinance/lending.js @@ -0,0 +1,27 @@ +const sdk = require("@defillama/sdk"); +const { getResource, coreTokens } = require("../helper/chain/aptos"); +const { transformBalances } = require("../helper/portedTokens"); +const { moduleAddress, resourceAddress } = require("./helper"); + +const vaultInfoStruct = `${moduleAddress}::vault::Vaults`; + +async function lendingTvl() { + /// @dev get vault info resources + const { vaults } = await getResource(resourceAddress, vaultInfoStruct); + const balances = {}; + vaults.data.forEach((vault) => { + const token = vault.key; + const balance = vault.value.balance; + + const isCoreAsset = coreTokens.includes(token); + if (isCoreAsset) { + sdk.util.sumSingleBalance(balances, token, balance); + } + }); + + return transformBalances('aptos', balances); +} + +module.exports = { + lendingTvl, +} \ No newline at end of file diff --git a/projects/eternalFinance/lyf.js b/projects/eternalFinance/lyf.js new file mode 100644 index 00000000000..7cd7bf258ef --- /dev/null +++ b/projects/eternalFinance/lyf.js @@ -0,0 +1,77 @@ +const sdk = require("@defillama/sdk"); +const { default: BigNumber } = require("bignumber.js"); +const { getResource, coreTokens } = require("../helper/chain/aptos"); +const { transformBalances } = require("../helper/portedTokens"); +const { getPancakeReserveAndLpSupply } = require("./pancake"); +const { getTypeArgs, moduleAddress, resourceAddress } = require("./helper"); + +const allPoolsStruct = `${moduleAddress}::pancake_wmasterchef::AllPools`; + +function deserializeLyfPool(pools) { + /// @dev extract the token types in all pools + const lpPools = {}; + pools.data.forEach(pool => { + const [tokenX, tokenY] = getTypeArgs(pool.key); + lpPools[pool.key] = { + tokenX, + tokenY, + lpName: pool.key, + lpAmount: pool.value.amount, + }; + }); + + return lpPools; +} + +function calculateLyfPoolTokens(lyfPools) { + const balances = {}; + Object.keys(lyfPools).map((key) => { + const pool = lyfPools[key]; + const { lpAmount, lpSupply, reserveX, reserveY, tokenX, tokenY } = pool; + + const share = new BigNumber(lpAmount).div(lpSupply); + const balanceX = share.multipliedBy(pool.reserveX).toFixed(0); + const balanceY = share.multipliedBy(pool.reserveY).toFixed(0); + lyfPools[key] = { + ...pool, + balanceX, + balanceY, + } + + const isCoreAssetX = coreTokens.includes(tokenX); + const isCoreAssetY = coreTokens.includes(tokenY); + const nonNeglibleReserves = reserveX !== '0' && reserveY !== '0'; + /// @dev calculate total core assets + if (isCoreAssetX && isCoreAssetY) { + sdk.util.sumSingleBalance(balances, tokenX, balanceX); + sdk.util.sumSingleBalance(balances, tokenY, balanceY); + } else if (isCoreAssetX) { + sdk.util.sumSingleBalance(balances, tokenX, balanceX); + if (nonNeglibleReserves) { + sdk.util.sumSingleBalance(balances, tokenX, balanceX); + } + } else if (isCoreAssetY) { + sdk.util.sumSingleBalance(balances, tokenY, balanceY); + if (nonNeglibleReserves) { + sdk.util.sumSingleBalance(balances, tokenY, balanceY); + } + } + }) + + return balances; +} + +async function lyfTvl() { + /// @dev get pool resources + const { pools } = await getResource(resourceAddress, allPoolsStruct); + const allLyfPools = deserializeLyfPool(pools); + await getPancakeReserveAndLpSupply(allLyfPools); + const balances = calculateLyfPoolTokens(allLyfPools); + const tvl = await transformBalances('aptos', balances); + + return tvl; +} + +module.exports = { + lyfTvl, +} diff --git a/projects/eternalFinance/pancake.js b/projects/eternalFinance/pancake.js new file mode 100644 index 00000000000..2152de4aecf --- /dev/null +++ b/projects/eternalFinance/pancake.js @@ -0,0 +1,43 @@ +const { getResources } = require("../helper/chain/aptos"); +const { getTypeArgs } = require("./helper"); + +const pancakeModuleAddress = '0xc7efb4076dbe143cbcd98cfaaa929ecfc8f299203dfff63b95ccb6bfe19850fa'; +const pancakeTokenPairReservePrefix = `${pancakeModuleAddress}::swap::TokenPairReserve<`; +const pancakeLpCoinInfoPrefix = `0x1::coin::CoinInfo<${pancakeModuleAddress}::swap::LPToken<`; + +function getLpTokenAddress(t0, t1) { + return `${pancakeModuleAddress}::swap::LPToken<${t0}, ${t1}>` +} + +/// @dev fetch all pancakeswap pool and map with lyf pool +async function getPancakeReserveAndLpSupply(lyfPools) { + const resources = await getResources(pancakeModuleAddress); + resources.forEach(({type, data}) => { + if (type.slice(0, pancakeTokenPairReservePrefix.length) === pancakeTokenPairReservePrefix) { + /// @dev get token reserves + const [tx, ty] = getTypeArgs(type); + const lpAddress = getLpTokenAddress(tx, ty); + if (lyfPools[lpAddress]) { + lyfPools[lpAddress] = { + ...lyfPools[lpAddress], + reserveX: data.reserve_x, + reserveY: data.reserve_y, + } + } + } else if (type.slice(0, pancakeLpCoinInfoPrefix.length) === pancakeLpCoinInfoPrefix) { + /// @dev extract total lp supply + const [tx, ty] = getTypeArgs(`<${type.split(pancakeLpCoinInfoPrefix)[1]}`); + const lpAddress = getLpTokenAddress(tx, ty); + if (lyfPools[lpAddress]) { + lyfPools[lpAddress] = { + ...lyfPools[lpAddress], + lpSupply: data.supply.vec?.[0].integer.vec?.[0].value || '0', + } + } + } + }) +} + +module.exports = { + getPancakeReserveAndLpSupply, +} diff --git a/projects/ethalend/abi.json b/projects/ethalend/abi.json index ec30bbb2f55..995231be9db 100644 --- a/projects/ethalend/abi.json +++ b/projects/ethalend/abi.json @@ -1,4 +1,4 @@ { - "underlying":{"inputs":[],"name":"underlying","outputs":[{"internalType":"contract IERC20Detailed","name":"","type":"address"}],"stateMutability":"view","type":"function"}, - "calcTotalValue": {"inputs":[],"name":"calcTotalValue","outputs":[{"internalType":"uint256","name":"underlyingAmount","type":"uint256"}],"stateMutability":"view","type":"function"} + "underlying": "address:underlying", + "calcTotalValue": "uint256:calcTotalValue" } \ No newline at end of file diff --git a/projects/ethalend/index.js b/projects/ethalend/index.js index 638c3e6a8e9..d3b4da469be 100644 --- a/projects/ethalend/index.js +++ b/projects/ethalend/index.js @@ -1,12 +1,14 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk') const abi = require('./abi.json') const { unwrapUniswapLPs } = require('../helper/unwrapLPs') const { staking } = require('../helper/staking') const { pool2 } = require('../helper/pool2') -const { fetchURL } = require('../helper/utils') +const { getConfig } = require('../helper/cache') + const { gql, request } = require('graphql-request') const { default: BigNumber } = require('bignumber.js') -const { getBlock } = require('../helper/getBlock') +const { getBlock } = require('../helper/http') /* const vaults = [ @@ -50,18 +52,19 @@ async function tvl(chain, block, chainId) { const globalData = (await request("https://api.thegraph.com/subgraphs/name/ethalend/etha-v1", globalDataQuery, { block: block - 100 })).globalDatas await Promise.all(globalData.filter(v => v.type === "lending").map(async v => { if (v.address === "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee") { - v.address = "0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270" + v.address = ADDRESSES.polygon.WMATIC_2 } const decimals = await sdk.api.erc20.decimals(v.address, chain) sdk.util.sumSingleBalance(balances, chain + ':' + v.address, BigNumber(v.totalUnderlying).times(10 ** decimals.output).toFixed(0)) })) } - let vaults = (await fetchURL("https://ethalend.com/vaults/vaultInfo")).data.data.filter(i => i.chainId === chainId).map(v => v.strategyAddress).filter(i => i) + let vaults = (await getConfig('ethalend', "https://ethalend.com/vaults/vaultInfo")).data.filter(i => i.chainId === chainId).map(v => v.strategyAddress).filter(i => i) vaults = Array.from(new Set(vaults)) // remove duplicates const [underlyings, totals] = await Promise.all([abi.underlying, abi.calcTotalValue].map(abi => sdk.api.abi.multiCall({ abi, block, chain, + permitFailure: true, calls: vaults.map(v => ({ target: v })) }))) const lpPositions = [] diff --git a/projects/ether-fi/index.js b/projects/ether-fi/index.js new file mode 100644 index 00000000000..8c9ec590184 --- /dev/null +++ b/projects/ether-fi/index.js @@ -0,0 +1,14 @@ +const { nullAddress } = require("../helper/unwrapLPs"); +const sdk = require('@defillama/sdk') + +module.exports = { + ethereum: { + tvl: async (timestamp) => { + const api = new sdk.ChainApi({ timestamp, chain: 'optimism' }) + await api.getBlock() + return { + [nullAddress]: await api.call({ target: '0x6329004E903B7F420245E7aF3f355186f2432466', abi: 'uint256:getTvl'}) + } + } + } +} diff --git a/projects/etherberry/index.js b/projects/etherberry/index.js new file mode 100644 index 00000000000..4c2921668d5 --- /dev/null +++ b/projects/etherberry/index.js @@ -0,0 +1,34 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokens2, nullAddress } = require("../helper/unwrapLPs"); +const { getLogs } = require("../helper/cache/getLogs"); +const { pool2 } = require("../helper/pool2"); + +const FACTORY_CONTRACT = "0x09cA2dF4956720aB75c55313a7c83A63286fDd42"; +const WETH_ADDRESS = ADDRESSES.arbitrum.WETH; +const BERRY_ETH_LP_ADDRESS = "0x6eF6eCD8AC5626525383d72AfaA9a7e7e39C0959"; +const BERRY_ETH_STAKING_POOL = "0xcA4319D51472D7111fa3A103b07fc08fC8b20655"; + +async function tvl(timestamp, block, chainBlocks, { api }) { + const logs = await getLogs({ + api, + target: FACTORY_CONTRACT, + topics: ["0x489ab9065c597368f4a678fadcb323bf4c848713ea7d5a296d16ec97203eae83",], + eventAbi: "event StakingPoolDeployed(address indexed poolAddress,address indexed stakingToken,uint256 startTime,uint256 roundDurationInDays)", + onlyArgs: true, + fromBlock: 93557929, + }); + + const lsdAddresses = logs.map((i) => i.stakingToken === nullAddress ? WETH_ADDRESS : i.stakingToken); + const poolAddresses = logs.map((i) => i.poolAddress); + + return sumTokens2({ api, tokensAndOwners2: [lsdAddresses, poolAddresses], blacklistedTokens: [BERRY_ETH_LP_ADDRESS], }); +} + +module.exports = { + arbitrum: { + methodology: + "TVL of Staked ETH & LSD tokens, with pool2 including value of staked BERRY/ETH Uniswap-V2 LP tokens", + tvl, + pool2: pool2([BERRY_ETH_STAKING_POOL], [BERRY_ETH_LP_ADDRESS]), + }, +}; diff --git a/projects/ethichub/index.js b/projects/ethichub/index.js index b4821545dfc..cdb3f2eb90f 100644 --- a/projects/ethichub/index.js +++ b/projects/ethichub/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk'); const { transformCeloAddress } = require('../helper/portedTokens'); const { pool2 } = require("../helper/pool2"); @@ -13,7 +14,7 @@ const MINIMICE_ETH = '0x21320683556BB718c8909080489F598120C554D9'; const ORIGINATOR_BRAZIL = '0x3B61CD481Be3BA62a9a544c49d6C09FCb804d0e3'; const ORIGINATOR_HONDURAS = '0x7435C0232A69270D19F8E4010571175c3f1dd955'; // Celo -const ETHIX_TOKEN_CELO = '0x9995cc8F20Db5896943Afc8eE0ba463259c931ed'; +const ETHIX_TOKEN_CELO = ADDRESSES.celo.ETHIX; const COLLATERAL_RESERVE_CELO = '0xA14B1D7E28C4F9518eb7757ddeE35a18423e1567'; const STAKED_ETHIX_CELO = '0xCb16E29d0B667BaD7266E5d0Cd59b711b6273C6B'; const MINIMICE_CELO = '0x0f497a790429685a3CfD43b841865Ee185378ff0'; diff --git a/projects/ethos/index.js b/projects/ethos/index.js new file mode 100644 index 00000000000..5bb56ca4edf --- /dev/null +++ b/projects/ethos/index.js @@ -0,0 +1,22 @@ +const { unwrapBalancerToken } = require("../helper/unwrapLPs") + +async function tvl(_, _b, _cb, { api, }) { + const ADMIN_ADDR = '0xd584a5e956106db2fe74d56a0b14a9d64be8dc93' + const CONFIG_ADDR = await api.call({ abi: 'address:collateralConfig', target: ADMIN_ADDR }) + const collaterals = await api.call({ abi: 'address[]:getAllowedCollaterals', target: CONFIG_ADDR }) + const ACTIVE_POOL = await api.call({ abi: 'address:activePool', target: ADMIN_ADDR }) + const bals = await api.multiCall({ abi: 'function getEntireSystemColl(address) view returns (uint256)', target: ADMIN_ADDR, calls: collaterals }) + api.addTokens(collaterals, bals) +} + +async function pool2(_, _b, _cb, { api, }) { + return unwrapBalancerToken({ ...api, balancerToken: '0xd20f6F1D8a675cDCa155Cb07b5dC9042c467153f', owner: '0x9425b96462b1940e7563cd765464300f6a774805'}) + +} +module.exports = { + methodology: `TVL is fetched from the Ethos Reserve subgraph and the Byte Masons token price api.`, + optimism: { + tvl, + pool2, + }, +} diff --git a/projects/ethwswap/index.js b/projects/ethwswap/index.js index b57a7727b76..e840b9fcdda 100644 --- a/projects/ethwswap/index.js +++ b/projects/ethwswap/index.js @@ -4,7 +4,6 @@ module.exports = { misrepresentedTokens: true, ethpow: { tvl: getUniTVL({ - chain: 'ethpow', useDefaultCoreAssets: true, factory: '0x78376072F4945b2A5450B1A6B41a85ff20034527', }) diff --git a/projects/ethx/index.js b/projects/ethx/index.js new file mode 100644 index 00000000000..5af72e18cbd --- /dev/null +++ b/projects/ethx/index.js @@ -0,0 +1,13 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { staking } = require('../helper/staking') + +module.exports = { + ethereum: { + tvl: staking('0x7b0Eff0C991F0AA880481FdFa5624Cb0BC9b10e1', [ + ADDRESSES.null, + ADDRESSES.ethereum.STETH, + '0x5E8422345238F34275888049021821E8E08CAa1f', + ADDRESSES.ethereum.RETH, + ]), + } +} \ No newline at end of file diff --git a/projects/euler/abi.json b/projects/euler/abi.json deleted file mode 100644 index 0a2424faf18..00000000000 --- a/projects/euler/abi.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "underlyingToAssetConfig": {"inputs":[{"internalType":"address","name":"underlying","type":"address"}],"name":"underlyingToAssetConfig","outputs":[{"components":[{"internalType":"address","name":"eTokenAddress","type":"address"},{"internalType":"bool","name":"borrowIsolated","type":"bool"},{"internalType":"uint32","name":"collateralFactor","type":"uint32"},{"internalType":"uint32","name":"borrowFactor","type":"uint32"},{"internalType":"uint24","name":"twapWindow","type":"uint24"}],"internalType":"struct Storage.AssetConfig","name":"","type":"tuple"}],"stateMutability":"view","type":"function"}, - "getEnteredMarkets": {"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getEnteredMarkets","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"} -} \ No newline at end of file diff --git a/projects/euler/index.js b/projects/euler/index.js index c31391f9300..ac677a77285 100644 --- a/projects/euler/index.js +++ b/projects/euler/index.js @@ -1,64 +1,43 @@ -const { sumTokens } = require("../helper/unwrapLPs"); -const { GraphQLClient, gql } = require("graphql-request"); -const sdk = require("@defillama/sdk"); +const { getLogs } = require('../helper/cache/getLogs') +const { sumTokens2 } = require('../helper/unwrapLPs') -const contracts = { - euler: "0x27182842E098f60e3D576794A5bFFb0777E025d3", - markets: "0xE5d0A7A3ad358792Ba037cB6eE375FfDe7Ba2Cd1", - markets_proxy: "0x3520d5a913427E6F0D6A83E07ccD4A4da316e4d3", -}; - -// Graphql endpoint to query markets -const graphql_url = - "https://api.thegraph.com/subgraphs/name/euler-xyz/euler-mainnet"; - -const markets_query = gql` - query { - eulerMarketStores { - markets { - id - totalBorrows - } - } - } -`; - -const graphQLClient = new GraphQLClient(graphql_url); - -async function getMarkets() { - const markets = await graphQLClient.request(markets_query); - return markets.eulerMarketStores[0].markets; -} - -async function tvlEthereum(timestamp, ethBlock) { - const markets = await getMarkets(); - const markets_underlyings = markets.map((market) => market.id); - - // use markets_underlyings or markets_underlyings_nographql - const tokensAndOwners = markets_underlyings.map((underlying) => [ - underlying, - contracts.euler, - ]); - return sumTokens({}, tokensAndOwners, ethBlock); -} - -async function borrowedEthereum() { - const borrowed = {}; - const markets = await getMarkets(); - markets.forEach((market) => { - borrowed[market.id] = market.totalBorrows; - }); - return borrowed; -} module.exports = { - hallmarks: [ - [1654387200,"Whale Deposit"] - ], + hallmarks: [[1654387200, "Whale Deposit"], + [1667865600, "FTX collapse"], + [Math.floor(new Date('2023-03-13') / 1e3), 'Protocol was hacked'],], methodology: `TVL is supply balance minus borrows the euler contract. Borrows are pulled from the subgraph.`, ethereum: { - tvl: tvlEthereum, - borrowed: borrowedEthereum, - // staking: staking(EULstaking, EUL), + tvl, + borrowed: () => 0, }, }; + +async function tvl(_, _b, _cb, { api, }) { + const EULER = '0x27182842e098f60e3d576794a5bffb0777e025d3' + const logs = await getLogs({ + api, + target: EULER, + topics: ['0x2ece124509c63be11a6985ae00b93c8cb8f8d8898f6e5239fc9e38bc71909667'], + fromBlock: 13687582, + eventAbi: 'event MarketActivated (address indexed underlying, address indexed eToken, address indexed dToken)', + onlyArgs: true, + }) + + return sumTokens2({ api, owner: EULER, tokens: logs.map(i => i.underlying)}) +} + +async function borrowed(_, _b, _cb, { api, }) { + const EULER = '0x27182842e098f60e3d576794a5bffb0777e025d3' + const logs = await getLogs({ + api, + target: EULER, + topics: ['0x2ece124509c63be11a6985ae00b93c8cb8f8d8898f6e5239fc9e38bc71909667'], + fromBlock: 13687582, + eventAbi: 'event MarketActivated (address indexed underlying, address indexed eToken, address indexed dToken)', + onlyArgs: true, + }) + const bals = await api.multiCall({ abi: 'erc20:totalSupply', calls: logs.map(i => i.dToken)}) + api.addTokens(logs.map(i => i.underlying.toLowerCase()), bals) + delete api.getBalances()["ethereum:0x31c8eacbffdd875c74b94b077895bd78cf1e64a3"] +} diff --git a/projects/everestdao/index.js b/projects/everestdao/index.js index 863fb48d11a..a127db13e1a 100644 --- a/projects/everestdao/index.js +++ b/projects/everestdao/index.js @@ -1,75 +1,6 @@ -const sdk = require("@defillama/sdk"); -const BigNumber = require('bignumber.js') -const { stakings } = require("../helper/staking"); -const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); -const { transformAvaxAddress } = require("../helper/portedTokens"); - -const stakingContracts = [ - //pEVRT - "0x451D00AF6E751537a9A2cFF40CdFB1119cd1fA7d", - //pEVRT Farm - "0x13B2e894E3e7D60c0E084ab5Cc47552d7cfE40C4", -]; -const EVRT = "0x3ACa5545e76746A3Fe13eA66B24BC0eBcC51E6b4"; -const pEVRT = "0x451D00AF6E751537a9A2cFF40CdFB1119cd1fA7d"; - -const pool2Contracts = [ - //EVRT/LYD Contract - "0xE34E22bC053D529c649EA3808Bbc1caA43687cdb", - //EVRT/AVAX Contract - "0xD81Bbd31D6dA2b0D52f8c02B276940Be9423c1d3", - //EVRT/AVAX Contract - "0x6f34201abc4fFAA2d3C86563Bc603bc3c0BD8f7f", - //EVRT/AVAX Contract - "0xbA6B26AE795C68770A86C6D020e952B60a48da5f", -]; -const pool2Lps = [ - //EVRT/LYD Lydia-LP - "0x3b4656d0e149686fad8d1568898beed1e2d16998", - //EVRT/AVAX Lydia-LP - "0x26bbbf5104f99dd1d6e61ff54980e78edcb0ba29", - //EVRT/AVAX JLP - "0xfda31e6c2bae47f9e7bd9f42933ace1d28ff537b", - //EVRT/AVAX PGL - "0x7ece5fc08050f8007188897c578483aabd953bc2", -]; - -async function Staking(chainBlocks) { - const balances = {}; - - let transformAddress = await transformAvaxAddress(); - - await sumTokensAndLPsSharedOwners( - balances, - [[EVRT, false]], - stakingContracts, - chainBlocks["avax"], - "avax", - transformAddress - ); - - const balancepEVRT = ( - await sdk.api.abi.call({ - abi: 'erc20:balanceOf', - target: pEVRT, - params: stakingContracts[1], - chain: "avax", - block: chainBlocks["avax"], - }) - ).output; - - const totalBalance = BigNumber(balancepEVRT * 1.3403).toFixed(0) - - sdk.util.sumSingleBalance(balances, `avax:${EVRT}`, totalBalance); - - return balances; -} - module.exports = { deadFrom: 1648765747, avax: { - staking: Staking, - pool2: stakings(pool2Contracts, pool2Lps, "avax"), tvl: async () => ({}), }, methodology: diff --git a/projects/everlend/index.js b/projects/everlend/index.js index 21ed7a4ddfa..e941a1e3710 100644 --- a/projects/everlend/index.js +++ b/projects/everlend/index.js @@ -1,15 +1,9 @@ -const { get } = require('../helper/http') - -async function fetch() { - const response = await get('https://api.everlend.finance/api/v1/info') - - return response.tvl; -} +// token vault: GV2MntTz56GmbzvKLYfM3T54KjSgW1fc71kFAeFfrYxC module.exports = { timetravel: false, - solana: { - fetch - }, - fetch, -}; + solana: { tvl: () => 0, }, + hallmarks: [ + [Math.floor(new Date('2023-02-01')/1e3), 'Product is winding down'], + ], +} diff --git a/projects/everrise/abi.json b/projects/everrise/abi.json index 233571df927..0cc12b20bd1 100644 --- a/projects/everrise/abi.json +++ b/projects/everrise/abi.json @@ -1,148 +1,5 @@ { - "everRiseAddress": { - "inputs": [], - "name": "everRiseAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getStats": { - "inputs": [], - "name": "getStats", - "outputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "reservesBalance", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "liquidityToken", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "liquidityCoin", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "staked", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "aveMultiplier", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "rewards", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "volumeTransfers", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "volumeBuy", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "volumeSell", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "volumeTrade", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "bridgeVault", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "tokenPriceCoin", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "coinPriceStable", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "tokenPriceStable", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "marketCap", - "type": "uint256" - }, - { - "internalType": "uint128", - "name": "blockNumber", - "type": "uint128" - }, - { - "internalType": "uint32", - "name": "holders", - "type": "uint32" - }, - { - "internalType": "uint8", - "name": "tokenDecimals", - "type": "uint8" - }, - { - "internalType": "uint8", - "name": "coinDecimals", - "type": "uint8" - }, - { - "internalType": "uint8", - "name": "stableDecimals", - "type": "uint8" - }, - { - "internalType": "uint8", - "name": "multiplierDecimals", - "type": "uint8" - } - ], - "internalType": "struct EverRiseStaked.Stats", - "name": "stats", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - "wrappedCoinAddress": { - "inputs": [], - "name": "wrappedCoinAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } + "everRiseAddress": "address:everRiseAddress", + "getStats": "function getStats() view returns (tuple(uint256 reservesBalance, uint256 liquidityToken, uint256 liquidityCoin, uint256 staked, uint256 aveMultiplier, uint256 rewards, uint256 volumeTransfers, uint256 volumeBuy, uint256 volumeSell, uint256 volumeTrade, uint256 bridgeVault, uint256 tokenPriceCoin, uint256 coinPriceStable, uint256 tokenPriceStable, uint256 marketCap, uint128 blockNumber, uint32 holders, uint8 tokenDecimals, uint8 coinDecimals, uint8 stableDecimals, uint8 multiplierDecimals) stats)", + "wrappedCoinAddress": "address:wrappedCoinAddress" } \ No newline at end of file diff --git a/projects/everrise/index.js b/projects/everrise/index.js index c89b56b2a7c..9a11a8d5e05 100644 --- a/projects/everrise/index.js +++ b/projects/everrise/index.js @@ -1,21 +1,24 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk'); const http = require('../helper/http'); +const { getConfig } = require('../helper/cache') const BigNumber = require("bignumber.js"); -const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); +const { unwrapUniswapLPs, nullAddress, sumTokens2 } = require("../helper/unwrapLPs"); const { getChainTransform } = require("../helper/portedTokens"); -const getPairFactory = require('../helper/abis/getPair.json') +const getPairFactory = 'function getPair(address, address) view returns (address)' -const zeroAddress = '0x0000000000000000000000000000000000000000' +const zeroAddress = ADDRESSES.null const BRIDGE_CONTROLLER = '0x0Dd4A86077dC53D5e4eAE6332CB3C5576Da51281'; -const RESERVES = ['0x78b939518f51b6da10afb3c3238Dd04014e00057', - '0x3776B8C349BC9Af202E4D98Af163D59cA56d2fC5']; +const RESERVES = [ + // '0x78b939518f51b6da10afb3c3238Dd04014e00057', + '0x3776B8C349BC9Af202E4D98Af163D59cA56d2fC5']; const TOKEN = '0xC17c30e98541188614dF99239cABD40280810cA3'; const STAKE_HOLDING_API = 'https://app.everrise.com/bridge/api/v1/stats' const EVEROWN_DAO_API = 'https://app.everrise.com/prod/api/v1/contracts/active' const chainConfig = { ethereum: { chainId: '1', - WCoin: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', + WCoin: ADDRESSES.ethereum.WETH, lpFactory: '0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f', LPs: [ { @@ -24,14 +27,14 @@ const chainConfig = { }, // RISE-ETH ], reserveTokens: [ - "0xdAC17F958D2ee523a2206206994597C13D831ec7", // USDT - "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", // USDC - TOKEN, + ADDRESSES.ethereum.USDT, // USDT + ADDRESSES.ethereum.USDC, // USDC + // TOKEN, ], }, bsc: { chainId: '56', - WCoin: '0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c', + WCoin: ADDRESSES.bsc.WBNB, lpFactory: '0xcA143Ce32Fe78f1f7019d7d551a6402fC5350c73', LPs: [ { @@ -40,15 +43,15 @@ const chainConfig = { }, // RISE-BNB ], reserveTokens: [ - "0x55d398326f99059fF775485246999027B3197955", // USDT - "0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d", // USDC - "0xe9e7cea3dedca5984780bafc599bd69add087d56", // BUSD - TOKEN, + ADDRESSES.bsc.USDT, // USDT + ADDRESSES.bsc.USDC, // USDC + ADDRESSES.bsc.BUSD, // BUSD + // TOKEN, ], }, polygon: { chainId: '137', - WCoin: '0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270', + WCoin: ADDRESSES.polygon.WMATIC_2, lpFactory: '0x5757371414417b8C6CAad45bAeF941aBc7d3Ab32', LPs: [ { @@ -57,14 +60,14 @@ const chainConfig = { }, // RISE-MATIC ], reserveTokens: [ - "0xc2132D05D31c914a87C6611C10748AEb04B58e8F", // USDT - "0x2791bca1f2de4661ed88a30c99a7a9449aa84174", // USDC - TOKEN, + ADDRESSES.polygon.USDT, // USDT + ADDRESSES.polygon.USDC, // USDC + // TOKEN, ], }, avax: { chainId: '43114', - WCoin: '0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7', + WCoin: ADDRESSES.avax.WAVAX, lpFactory: '0x9Ad6C38BE94206cA50bb0d90783181662f0Cfa10', LPs: [ { @@ -73,14 +76,14 @@ const chainConfig = { }, // RISE-AVAX ], reserveTokens: [ - "0xc2132D05D31c914a87C6611C10748AEb04B58e8F", // USDT - "0x2791bca1f2de4661ed88a30c99a7a9449aa84174", // USDC - TOKEN, + ADDRESSES.avax.USDt, // USDT + ADDRESSES.avax.USDC, // USDC + // TOKEN, ], }, fantom: { chainId: '250', - WCoin: '0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83', + WCoin: ADDRESSES.fantom.WFTM, lpFactory: '0x152eE697f2E276fA89E96742e9bB9aB1F2E61bE3', LPs: [ { @@ -89,116 +92,52 @@ const chainConfig = { }, // RISE-FTM ], reserveTokens: [ - "0x04068da6c83afcfa0e13ba15a6696662335d5b75", // USDC - TOKEN, + ADDRESSES.fantom.USDC, // USDC + // TOKEN, ], }, } -async function staking(timestamp, block, chainId, chain, token) { - - const stakedAmounts = await ((await fetch(STAKE_HOLDING_API)).json()); - - let stakedAmount = 0; - for (let i = 0, ul = stakedAmounts.length; i < ul; i++) { - if (stakedAmounts[i].id === chainId) { - stakedAmount = BigNumber(stakedAmounts[i].amount).multipliedBy(BigNumber(10).pow(18)); - } - } - - return stakedAmount; -} - const chainExports = {} let daoLockerClients = null Object.keys(chainConfig).forEach(chain => { const chainData = chainConfig[chain] - async function tvl(ts, _block, chainBlocks) { - let balances = {} - const block = chainBlocks[chain] - const transformAddress = await getChainTransform(chain) - - const results = (await sdk.api.eth.getBalances({ - targets: [TOKEN, BRIDGE_CONTROLLER, ...RESERVES], - chain, block - })) - - for (const c of results.output) - sdk.util.sumSingleBalance(balances, transformAddress(zeroAddress), c.balance) - - // Get reserve token balances - let migrateBalances = ( - await sdk.api.abi.multiCall({ - calls: RESERVES.map((reserve) => (chainConfig[chain].reserveTokens.map((token) => ({ - target: token, - params: reserve, - })))).flat(1), - abi: "erc20:balanceOf", - block, chain, - }) - ).output; - - migrateBalances.forEach((i) => { - // Only include positive balances - if (i.output > 0) - balances[i.input.target] = i.output - }); + async function tvl(ts, _block, chainBlocks, { api }) { + const tokensAndOwners = [ + [nullAddress, TOKEN], + ...RESERVES.map(i => [nullAddress, i]) + ] + chainConfig[chain].reserveTokens.forEach(t => RESERVES.forEach(o => tokensAndOwners.push([t, o]))) - await everOwnClients(balances, chain, block, transformAddress) + await sumTokens2({ api, tokensAndOwners }) + await everOwnClients(api) - return balances + return api.getBalances() } - async function everOwnClients(balances, chain, block, transformAddress) { - daoLockerClients = daoLockerClients || await http.get(EVEROWN_DAO_API) - + async function everOwnClients(api) { + daoLockerClients = daoLockerClients || await getConfig('everrise/tvl', EVEROWN_DAO_API) + let clients = daoLockerClients[chainData.chainId] || [] // Don't include self as that's pool2 clients = clients.filter(t => t.contractAddress.toLowerCase() !== TOKEN.toLowerCase()) if (clients.length > 0) { const clientMapping = {} - + clients.forEach(client => { clientMapping[client.contractAddress.toLowerCase()] = client.everOwnLocker }) - - const lPTokens = ( - await sdk.api.abi.multiCall({ - abi: getPairFactory, - calls: clients.map((client) => ({ - target: chainData.lpFactory, - params: [client.contractAddress, chainData.WCoin], - })), - chain: chain, - block: block, - }) - ).output - - let lpPositions = []; - let lpBalances = ( - await sdk.api.abi.multiCall({ - calls: lPTokens.map((p) => ({ - target: p.output, - params: clientMapping[p.input.params[0].toLowerCase()], - })), - abi: "erc20:balanceOf", - block, chain, - }) - ).output - - lpBalances.forEach((i) => { - if (i.output > 0) { - lpPositions.push({ - balance: i.output, - token: i.input.target, - }); - } - }) - - await unwrapUniswapLPs(balances, lpPositions, block, chain, transformAddress) + const calls = clients.map((client) => ({ + target: chainData.lpFactory, + params: [client.contractAddress.toLowerCase(), chainData.WCoin], + })) + + const lPTokens = (await api.multiCall({ abi: getPairFactory, calls, })) + const tokensAndOwners = lPTokens.map((v, i) => [v, clients[i].everOwnLocker]) + return sumTokens2({ api, tokensAndOwners, resolveLP: true, }) } } @@ -225,7 +164,7 @@ Object.keys(chainConfig).forEach(chain => { token: i.input.target, }); }); - await unwrapUniswapLPs(balances, lpPositions, block, chain, transformAddress); + await unwrapUniswapLPs(balances, lpPositions, block, chain, transformAddress); return balances } diff --git a/projects/evmoswap/index.js b/projects/evmoswap/index.js index d4870fb253a..ccb4b70a36f 100644 --- a/projects/evmoswap/index.js +++ b/projects/evmoswap/index.js @@ -1,13 +1,14 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk'); const { getChainTransform} = require("../helper/portedTokens") const { getUniTVL } = require('../helper/unknownTokens') const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); -const madDAI = "0x63743ACF2c7cfee65A5E356A4C4A005b586fC7AA" -const madUSDC = "0x51e44FfaD5C2B122C8b635671FCC8139dc636E82" -const madUSDT = "0x7FF4a56B32ee13D7D4D405887E0eA37d61Ed919e" -const madWETH = "0x5842C5532b61aCF3227679a8b1BD0242a41752f2" -const madWBTC = "0xF80699Dc594e00aE7bA200c7533a07C1604A106D" +const madDAI = ADDRESSES.evmos.DAI +const madUSDC = ADDRESSES.evmos.USDC +const madUSDT = ADDRESSES.evmos.USDT +const madWETH = ADDRESSES.evmos.WETH +const madWBTC = ADDRESSES.evmos.WBTC //////////////////////////// UNI AMM //////////////////////////////////// const evmoswapTvl = getUniTVL({ factory: '0xF24E36e53628C3086493B9EfA785ab9DD85232EB', chain: 'evmos', useDefaultCoreAssets: true }) diff --git a/projects/evolutionland/index.js b/projects/evolutionland/index.js index aaed0d5b5eb..daab37b011c 100644 --- a/projects/evolutionland/index.js +++ b/projects/evolutionland/index.js @@ -1,37 +1,6 @@ -const BigNumber = require('bignumber.js') -const sdk = require('@defillama/sdk') +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokens2 } = require('../helper/unwrapLPs') - -const gold = { - "ethereum": "0x358dBA28848cca268BA8a76B65E5b3eF9Ef92238", - "heco": "0xFB371c8B99ba0b239E66E0a66bB6296b00dCD09f", - "polygon": "0x56746a8099a7e6D962802A23e01FeDdc1282cDAe", - "crab": "0x701A7d67B824D1Bc713FC5E77bE1C475Ec93106d", -} -const wood = { - "ethereum": "0xD4B784Ae5c12153D11Ca55853d832D2a2D514a08", - "heco": "0xcA3749C8C3aF04278D596a3fBe461481B6aa1b01", - "polygon": "0xe97C7F83ec91E29569f1a08De95ad3Bb0e8B6B3A", - "crab": "0xbA91F2d6d78953881A912f3DF71a541cD30eb980", -} -const hoo = { - "ethereum": "0x19E22a73A046f19eCB51a46ACe4cA7A4bB7c20c6", - "heco": "0x56746a8099a7e6D962802A23e01FeDdc1282cDAe", - "polygon": "0x81989cD57271565DBFfe9807E917Afc098B30c9A", - "crab": "0x54Eb408696E6b3Cc1795Caaf53B22F38F24200Fa", -} -const fire = { - "ethereum": "0x8469A695D70033EcD170c82BE1253842162AA77e", - "heco": "0xe97C7F83ec91E29569f1a08De95ad3Bb0e8B6B3A", - "polygon": "0x8216981a3eF2b45C705119644D0D48AcF7d14472", - "crab": "0xEd969c03e8881371754231FE1C8f1D4fE4AF2082", -} -const sioo = { - "ethereum": "0x1320994fA466E19F17b143995999C7275EAe50E1", - "heco": "0x81989cD57271565DBFfe9807E917Afc098B30c9A", - "polygon": "0x2D8822a54fe8966891cEF3aC5A29d3B916393739", - "crab": "0x9AC045F4B69C2DB58fDF70D4bEF8228ef5A2C5a8", -} const ring = { "ethereum": "0x9469D013805bFfB7D3DEBe5E7839237e535ec483", "heco": "0x15e65456310ecb216B51EfBd8a1dBf753353DcF9", @@ -39,10 +8,10 @@ const ring = { "crab": "0x7399Ea6C9d35124d893B8d9808930e9d3F211501", } const weth = { - "ethereum": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", - "heco": "0x5545153CCFcA01fbd7Dd11C0b23ba694D9509A6F", - "polygon": "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270", - "crab": "0x2D2b97EA380b0185e9fDF8271d1AFB5d2Bf18329", + "ethereum": ADDRESSES.ethereum.WETH, + "heco": ADDRESSES.heco.WHT, + "polygon": ADDRESSES.polygon.WMATIC_2, + "crab": ADDRESSES.crab.WCRAB, } const lpGOLD = { @@ -82,186 +51,15 @@ const lpETH = { "crab": "0xF157c9393255Db1728bC6483c3545Ca8a1655a0F", } -async function crabTvl(timestamp, blocks) { - let block = blocks["crab"]; - - if (block === undefined) { - block = (await sdk.api.util.lookupBlock(timestamp, { chain: "crab" })) - .block; - } - const lps = [ - { - "target": ring.crab, - "params": lpGOLD.crab - }, - { - "target": ring.crab, - "params": lpWOOD.crab - }, - { - "target": ring.crab, - "params": lpHOO.crab - }, - { - "target": ring.crab, - "params": lpFIRE.crab - }, - { - "target": ring.crab, - "params": lpSIOO.crab - }, - { - "target": ring.crab, - "params": lpETH.crab - }, - ] - let balances = await stakingBalanceTvl(timestamp, block, "crab", lps) - balances[ring.ethereum] = balances[ring.crab] + '000000000' - delete balances[ring.crab] - return balances -} - -async function polygonTvl(timestamp, blocks) { - let block = blocks["polygon"]; - - if (block === undefined) { - block = (await sdk.api.util.lookupBlock(timestamp, { chain: "polygon" })) - .block; - } - const lps = [ - { - "target": ring.polygon, - "params": lpGOLD.polygon - }, - { - "target": ring.polygon, - "params": lpWOOD.polygon - }, - { - "target": ring.polygon, - "params": lpHOO.polygon - }, - { - "target": ring.polygon, - "params": lpFIRE.polygon - }, - { - "target": ring.polygon, - "params": lpSIOO.polygon - }, - { - "target": ring.polygon, - "params": lpETH.polygon - }, - ] - let balances = await stakingBalanceTvl(timestamp, block, "polygon", lps) - balances[ring.ethereum] = balances[ring.polygon] - delete balances[ring.polygon] - return balances +async function tvl(_, _b, _cb, { api, }) { + const owners = [lpETH].map(i => i[api.chain]) + const balances = await sumTokens2({ api, owners, tokens: [weth[api.chain]] }) + const owners1 = [lpGOLD, lpWOOD, lpHOO, lpFIRE, lpSIOO, lpETH].map(i => i[api.chain]) + return sumTokens2({ balances, api, owners: owners1, tokens: [ring[api.chain]], transformAddress: i => ring.ethereum }) } -async function hecoTvl(timestamp, blocks) { - let block = blocks["heco"]; +module.exports = {}; - if (block === undefined) { - block = (await sdk.api.util.lookupBlock(timestamp, { chain: "heco" })) - .block; - } - const lps = [ - { - "target": ring.heco, - "params": lpGOLD.heco - }, - { - "target": ring.heco, - "params": lpWOOD.heco - }, - { - "target": ring.heco, - "params": lpHOO.heco - }, - { - "target": ring.heco, - "params": lpFIRE.heco - }, - { - "target": ring.heco, - "params": lpSIOO.heco - }, - { - "target": ring.heco, - "params": lpETH.heco - }, - ] - let balances = await stakingBalanceTvl(timestamp, block, "heco", lps) - balances[ring.ethereum] = balances[ring.heco] - delete balances[ring.heco] - return balances -} - -async function ethTvl(timestamp, blocks) { - let block = blocks["ethereum"]; - - const lps = [ - { - "target": ring.ethereum, - "params": lpGOLD.ethereum - }, - { - "target": ring.ethereum, - "params": lpWOOD.ethereum - }, - { - "target": ring.ethereum, - "params": lpHOO.ethereum - }, - { - "target": ring.ethereum, - "params": lpFIRE.ethereum - }, - { - "target": ring.ethereum, - "params": lpSIOO.ethereum - }, - { - "target": ring.ethereum, - "params": lpETH.ethereum - }, - { - "target": weth.ethereum, - "params": lpETH.ethereum - }, - ] - return await stakingBalanceTvl(timestamp, block, "ethereum", lps) -} - -async function stakingBalanceTvl(timestamp, block, chain, lps) { - - const balancesOfResult = await sdk.api.abi.multiCall({ - calls: lps.map((lp) => ({ - target: lp.target, - params: lp.params - })), - abi: 'erc20:balanceOf', - block, - chain - }) - let balances = {} - sdk.util.sumMultiBalanceOf(balances, balancesOfResult); - return balances -} - -module.exports = { - ethereum: { - tvl: ethTvl - }, - heco: { - tvl: hecoTvl - }, - polygon: { - tvl: polygonTvl - }, - crab: { - tvl: crabTvl - }, -} +['ethereum', 'polygon', 'heco', 'crab'].forEach(chain => { + module.exports[chain] = { tvl } +}) \ No newline at end of file diff --git a/projects/evolve/abi.js b/projects/evolve/abi.js index e7590ae38fd..b4ae3ad259f 100644 --- a/projects/evolve/abi.js +++ b/projects/evolve/abi.js @@ -1,110 +1,7 @@ -module.exports = { - - allLendingPools: { - "constant": true, - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "allLendingPools", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - allLendingPoolsLength: { - "constant": true, - "inputs": [], - "name": "allLendingPoolsLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - getLendingPool: { - "constant": true, - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "getLendingPool", - "outputs": [ - { - "internalType": "bool", - "name": "initialized", - "type": "bool" - }, - { - "internalType": "uint24", - "name": "lendingPoolId", - "type": "uint24" - }, - { - "internalType": "address", - "name": "collateral", - "type": "address" - }, - { - "internalType": "address", - "name": "borrowable0", - "type": "address" - }, - { - "internalType": "address", - "name": "borrowable1", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - underlying: { - "constant": true, - "inputs": [], - "name": "underlying", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - totalBorrows: { - "constant": true, - "inputs": [], - "name": "totalBorrows", - "outputs": [ - { - "internalType": "uint112", - "name": "", - "type": "uint112" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, +module.exports ={ + allLendingPools: "function allLendingPools(uint256) view returns (address)", + allLendingPoolsLength: "uint256:allLendingPoolsLength", + getLendingPool: "function getLendingPool(address) view returns (bool initialized, uint24 lendingPoolId, address collateral, address borrowable0, address borrowable1)", + underlying: "address:underlying", + totalBorrows: "function totalBorrows() view returns (uint112)", } \ No newline at end of file diff --git a/projects/evolve/index.js b/projects/evolve/index.js index a02d7cde4b3..e2e4dc67df4 100644 --- a/projects/evolve/index.js +++ b/projects/evolve/index.js @@ -8,4 +8,4 @@ const config = { module.exports = {} -tarotHelper(module.exports, config) +tarotHelper(module.exports, config, { tarotSymbol: 'vEvolve'}) diff --git a/projects/exactly/.prettierrc b/projects/exactly/.prettierrc new file mode 100644 index 00000000000..963354f2316 --- /dev/null +++ b/projects/exactly/.prettierrc @@ -0,0 +1,3 @@ +{ + "printWidth": 120 +} diff --git a/projects/exactly/index.js b/projects/exactly/index.js new file mode 100644 index 00000000000..e03d76c5ae7 --- /dev/null +++ b/projects/exactly/index.js @@ -0,0 +1,95 @@ +const sdk = require("@defillama/sdk"); + +module.exports = { + methodology: + "Counts the tokens locked in the contracts to be used as collateral to borrow or to earn yield. Borrowed coins are not counted towards the TVL, so only the coins actually locked in the contracts are counted. There are multiple reasons behind this but one of the main ones is to avoid inflating the TVL through cycled lending.", +}; + +/** @type {Record} */ +const config = { + ethereum: { + auditor: "0x310A2694521f75C7B2b64b5937C16CE65C3EFE01", + start: 15_868_410, + }, + optimism: { + auditor: "0xaEb62e6F27BC103702E7BC879AE98bceA56f027E", + start: 78_310_663, + } +}; + +Object.entries(config).forEach(([chain, { auditor, start }]) => { + module.exports[chain] = { + start, + /** @type {(timestamp: number, block: number, chainBlocks: Record, { api: ChainApi }) => Promise} */ + tvl: async (_, __, ___, { api }) => { + /** @type {Balances} */ + const balances = {}; + const data = await markets(api, auditor); + data.forEach(([asset, totalAssets, totalFloatingBorrowAssets, fixedPools]) => { + sdk.util.sumSingleBalance(balances, asset, totalAssets, chain); + sdk.util.sumSingleBalance(balances, asset, -1 * +totalFloatingBorrowAssets, chain); + fixedPools.forEach(({ borrowed, supplied }) => { + sdk.util.sumSingleBalance(balances, asset, supplied, chain); + sdk.util.sumSingleBalance(balances, asset, -1 * +borrowed, chain); + }); + }); + return balances; + }, + /** @type {(timestamp: number, block: number, chainBlocks: Record, { api: ChainApi }) => Promise} */ + borrowed: async (_, __, ___, { api }) => { + /** @type {Balances} */ + const balances = {}; + const data = await markets(api, auditor); + data.forEach(([asset, , totalFloatingBorrowAssets, fixedPools]) => { + sdk.util.sumSingleBalance(balances, asset, totalFloatingBorrowAssets, chain); + fixedPools.forEach(({ borrowed }) => { + sdk.util.sumSingleBalance(balances, asset, borrowed, chain); + }); + }); + return balances; + }, + }; +}); + +const INTERVAL = 86_400 * 7 * 4; + +/** @type {(api: ChainApi, auditor: string) => Promise<[string, string, string, FixedPool[]][]>} */ +async function markets(api, auditor) { + /** @type {string[]} */ + const markets = await api.call({ abi: abis.allMarkets, target: auditor }); + const timestamp = api.timestamp ?? 0; + + /** @type {string[][]} */ + const [asset, totalAssets, totalFloatingBorrowAssets, maxFuturePools] = await Promise.all( + ["asset", "totalAssets", "totalFloatingBorrowAssets", "maxFuturePools"].map((key) => + api.multiCall({ abi: abis[key], calls: markets }) + ) + ); + const maxPools = maxFuturePools.reduce((max, n) => Math.max(max, +n), 0); + const minMaturity = timestamp - (timestamp % INTERVAL) - INTERVAL * (maxPools - 1); + const maturities = [...Array(2 * maxPools)].map((_, i) => minMaturity + INTERVAL * i); + /** @type {FixedPool[]} */ + const fixedPools = await api.multiCall({ + abi: abis.fixedPools, + calls: markets.flatMap((target) => maturities.map((params) => ({ target, params }))), + }); + return markets.map((_, i) => [ + asset[i], + totalAssets[i], + totalFloatingBorrowAssets[i], + fixedPools.slice(i * maturities.length, (i + 1) * maturities.length), + ]); +} + +const abis = { + allMarkets: "function allMarkets() view returns (address[])", + asset: "function asset() view returns (address)", + fixedPools: "function fixedPools(uint256) view returns ((uint256 borrowed, uint256 supplied, uint256, uint256))", + maxFuturePools: "function maxFuturePools() view returns (uint8)", + totalAssets: "function totalAssets() view returns (uint256)", + totalFloatingBorrowAssets: "function totalFloatingBorrowAssets() view returns (uint256)", +}; + +/** @typedef {import("@defillama/sdk").ChainApi} ChainApi */ +/** @typedef {import("@defillama/sdk/build/types").Balances} Balances */ +/** @typedef {{ borrowed: string, supplied: string }} FixedPool */ diff --git a/projects/excalibur/index.js b/projects/excalibur/index.js index 285b4a69633..11de2b1a525 100644 --- a/projects/excalibur/index.js +++ b/projects/excalibur/index.js @@ -1,16 +1,7 @@ const {uniTvlExport} = require('../helper/calculateUniTvl') -function transformFantomAddress(addr){ - return ((addr) => { - if(addr === "0x846e4d51d7e2043c1a87e0ab7490b93fb940357b"){ // UST address - return 'ethereum:0xa693b19d2931d498c5b318df961919bb4aee87a5' - } - return `fantom:${addr}`; - }) -} - module.exports={ fantom:{ - tvl: uniTvlExport("0x08b3CCa975a82cFA6f912E0eeDdE53A629770D3f", "fantom", transformFantomAddress) + tvl: uniTvlExport("0x08b3CCa975a82cFA6f912E0eeDdE53A629770D3f", "fantom", true) } } diff --git a/projects/exinpool/index.js b/projects/exinpool/index.js index c27abc9c6ac..ffea908bb4c 100644 --- a/projects/exinpool/index.js +++ b/projects/exinpool/index.js @@ -14,5 +14,8 @@ async function fetch() { } module.exports = { + mixin: { + fetch + }, fetch } diff --git a/projects/exinswap/index.js b/projects/exinswap/index.js index 53d9b952fbe..44e321f7efe 100644 --- a/projects/exinswap/index.js +++ b/projects/exinswap/index.js @@ -14,5 +14,8 @@ async function fetch() { } module.exports = { + mixin: { + fetch + }, fetch } \ No newline at end of file diff --git a/projects/exit10-fi/index.js b/projects/exit10-fi/index.js new file mode 100644 index 00000000000..c423d159d3a --- /dev/null +++ b/projects/exit10-fi/index.js @@ -0,0 +1,19 @@ +const { sumTokensExport } = require('../helper/unwrapLPs') + +const config = { + ethereum: { + uniV3Holders: ['0xBFD697f71159Ed85eb1A7fE3520Ad8e5d61017fB'], + }, + arbitrum: { + uniV3Holders: ['0x6aC7197B8C41F8C72a82c49fb219be8ec421dbb0'], + }, +} + +module.exports = {}; + +Object.keys(config).forEach(chain => { + const { uniV3Holders } = config[chain] + module.exports[chain] = { + tvl: sumTokensExport({ owners: uniV3Holders, resolveUniV3: true, }) + } +}) \ No newline at end of file diff --git a/projects/exodia/index.js b/projects/exodia/index.js index d0f9aab0056..496b19b8b17 100644 --- a/projects/exodia/index.js +++ b/projects/exodia/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens } = require("../helper/unwrapLPs"); const sdk = require('@defillama/sdk'); const { transformFantomAddress } = require("../helper/portedTokens"); @@ -9,8 +10,8 @@ const wsexod = "0xe992C5Abddb05d86095B18a158251834D616f0D1" const gohm = "0x91fa20244fb509e8289ca630e5db3e9166233fdc" const mai = "0xfb98b335551a418cd0737375a2ea0ded62ea213b" const treasury = "0x6a654d988eebcd9ffb48ecd5af9bd79e090d8347" -const dai = "0x8d11ec38a3eb5e956b052f67da8bdc9bef8abf3e" -const wftm = "0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83" +const dai = ADDRESSES.fantom.DAI +const wftm = ADDRESSES.fantom.WFTM const beetsvault = "0x20dd72Ed959b6147912C2e529F0a0C651c33c9ce" const poolid = "0xa216aa5d67ef95dde66246829c5103c7843d1aab000100000000000000000112" @@ -21,7 +22,7 @@ function compareAddresses(a, b) { const getPoolTokens = async (block) => { const poolTokens = (await sdk.api.abi.call({ target: beetsvault, - abi: {"inputs":[{"internalType":"bytes32","name":"poolId","type":"bytes32"}],"name":"getPoolTokens","outputs":[{"internalType":"contract IERC20[]","name":"tokens","type":"address[]"},{"internalType":"uint256[]","name":"balances","type":"uint256[]"},{"internalType":"uint256","name":"lastChangeBlock","type":"uint256"}],"stateMutability":"view","type":"function"}, + abi: 'function getPoolTokens(bytes32 poolId) view returns (address[] tokens, uint256[] balances, uint256 lastChangeBlock)', params: poolid, block, chain: 'fantom', diff --git a/projects/extra/index.js b/projects/extra/index.js new file mode 100644 index 00000000000..8bef68cf25d --- /dev/null +++ b/projects/extra/index.js @@ -0,0 +1,44 @@ +const { getLogs } = require('../helper/cache/getLogs') +const { sumTokens2 } = require('../helper/unwrapLPs') + +const config = { + optimism: { factory: '0xbb505c54d71e9e599cb8435b4f0ceec05fc71cbd', fromBlock: 96265067, vaultFactory: '0x155620a2e6a9392c754b73296d9655061525729b', positionViewer: '0xf9cfb8a62f50e10adde5aa888b44cf01c5957055' }, +} + +module.exports = {}; + +const getVaultAbi = "function getVault(uint256 vaultId) view returns (tuple(address gauge, address pair, address token0, address token1, bool stable, bool paused, bool frozen, bool borrowingEnabled, bool liquidateWithTWAP, uint16 maxLeverage, uint16 premiumMaxLeverage, uint16 maxPriceDiff, uint16 liquidateDebtRatio, uint16 withdrawFeeRate, uint16 compoundFeeRate, uint16 liquidateFeeRate, uint16 rangeStopFeeRate, uint16 protocolFeeRate, uint256 premiumRequirement, uint256 protocolFee0Accumulated, uint256 protocolFee1Accumulated, uint256 minInvestValue, uint256 minSwapAmount0, uint256 minSwapAmount1, uint256 totalLp, uint256 totalLpShares, uint256 premiumUtilizationOfReserve0, uint256 debtLimit0, uint256 debtPositionId0, uint256 debtTotalShares0, uint256 premiumUtilizationOfReserve1, uint256 debtLimit1, uint256 debtPositionId1, uint256 debtTotalShares1))" + + +Object.keys(config).forEach(chain => { + const { factory, fromBlock, vaultFactory, positionViewer, } = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const logs = await getLogs({ + api, + target: factory, + topics: ['0x857d20297bde4478f678d3aafbfdf7fbfc90a4200b62eb053a32b2c50335676f'], + eventAbi: 'event InitReserve (address indexed reserve, address indexed eTokenAddress, address stakingAddress, uint256 id)', + onlyArgs: true, + fromBlock, + }) + + const vaultLogs = await getLogs({ + api, + target: vaultFactory, + topics: ['0xc0a8c0f282890a3da41a2183a1e9a1988888e8d8a0a39d933d42b0418e626250'], + fromBlock, + }) + + const calls = [] + for (let i = 1; i <= vaultLogs.length; i++) calls.push(i) + + const data = await api.multiCall({ target: positionViewer, abi: getVaultAbi, calls }) + data.forEach(({ pair, totalLp }) => api.add(pair, totalLp)) + + const tokensAndOwners = logs.map(i => [i.reserve, i.eTokenAddress]) + + return sumTokens2({ api, tokensAndOwners, resolveLP: true, }) + } + } +}) \ No newline at end of file diff --git a/projects/ezkalibur/index.js b/projects/ezkalibur/index.js new file mode 100644 index 00000000000..2b61648181f --- /dev/null +++ b/projects/ezkalibur/index.js @@ -0,0 +1,15 @@ +const { getUniTVL } = require("../helper/unknownTokens"); +const { stakingPricedLP } = require("../helper/staking"); + +const xSWORD = '0x11ef47783740B3F0c9736D54BE8eF8953C3Ead99' +const SWORD_TOKEN = '0x240f765Af2273B0CAb6cAff2880D6d8F8B285fa4' +const SWORD_WETH_LP = '0xc8b6b3a4d2d8428ef3a940eac1e32a7ddadcb0f1' + +module.exports = { + misrepresentedTokens: true, + start: 1686309181, + era: { + tvl: getUniTVL({ factory: '0x15C664A62086c06D43E75BB3fddED93008B8cE63', useDefaultCoreAssets: true,fetchBalances: true, }), + staking: stakingPricedLP(xSWORD,SWORD_TOKEN,'era',SWORD_WETH_LP,'weth') + }, +}; \ No newline at end of file diff --git a/projects/fabric/index.js b/projects/fabric/index.js index fd71c04fdaa..7472b6e13f2 100644 --- a/projects/fabric/index.js +++ b/projects/fabric/index.js @@ -1,22 +1,3 @@ -const sdk = require("@defillama/sdk"); -const utils = require("../helper/utils"); -const { toUSDTBalances } = require("../helper/balances"); - -const API_url = "https://api.fsynth.io/.netlify/functions/pools"; - -async function solonaTvl() { - let totalLiquidityUSD = 0; - - (await utils.fetchURL(API_url)).data.data - .filter((x) => x.hasEnded === false) - .map((sup) => sup.liquidity) - .forEach(function (sup) { - totalLiquidityUSD += sup; - }); - - return toUSDTBalances(totalLiquidityUSD); -} - module.exports = { timetravel: false, solana: { diff --git a/projects/factor-v2/index.js b/projects/factor-v2/index.js new file mode 100644 index 00000000000..dc4521416f1 --- /dev/null +++ b/projects/factor-v2/index.js @@ -0,0 +1,26 @@ +const { getLogs } = require('../helper/cache/getLogs') + +const config = { + arbitrum: { factory: '0x6b3e693b436510c430ffbb6b5ca6c8248022f1cd', fromBlock: 112324705 }, +} + +Object.keys(config).forEach(chain => { + const { factory, fromBlock, } = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const logs = await getLogs({ + api, + target: factory, + topics: ['0xc66cfbda93c132fbda8600e8032ce13d18d0db1d139e72d677d5556e0acf9484'], + eventAbi: 'event VaultCreated (address indexed vault, address strategy, string name, string symbol, uint256 approval)', + onlyArgs: true, + fromBlock, + }) + const vaults = logs.map(log => log.vault) + const tokens = await api.multiCall({ abi: 'address:asset', calls: vaults }) + const bals = await api.multiCall({ abi: 'uint256:assetBalance', calls: vaults }) + // console.table(vaults.map((v, i) => ({ vault: v, token: tokens[i], bal: bals[i] }))) + api.addTokens(tokens, bals) + } + } +}) \ No newline at end of file diff --git a/projects/factor/index.js b/projects/factor/index.js new file mode 100644 index 00000000000..4bbc739b2d3 --- /dev/null +++ b/projects/factor/index.js @@ -0,0 +1,27 @@ +const { staking } = require("../helper/staking"); +const { sumTokens2 } = require('../helper/unwrapLPs'); +const { cachedGraphQuery } = require('../helper/cache'); + +const FCTR = "0x6dD963C510c2D2f09d5eDdB48Ede45FeD063Eb36" +const veFCTR = "0xA032082B08B2EF5A6C3Ea80DaEac58300F68FB73" + +async function tvl(timestamp, block, chainBlocks, { api }) { + const endpoint = 'https://api.thegraph.com/subgraphs/name/yanuar-ar/factor-arbitrum' + const res = await cachedGraphQuery('factor-v1', endpoint, `{vaultGeneses { id }}`) + const indices = res.vaultGeneses.map(v => v.id) + const uBalances = await api.multiCall({ abi: 'uint256[]:underlyingAssetsBalance', calls: indices }) + const calls = [] + uBalances.forEach((v, i) => { + v.forEach((_, j) => calls.push({ target: indices[i], params: j })) + }) + const uData = await api.multiCall({ abi: 'function underlyingAssets(uint256) view returns (address,uint256,uint256)', calls }) + const tokensAndOwners = uData.map((v, i) => [v[0], calls[i].target]) + await sumTokens2({ api, tokensAndOwners }) +} + +module.exports = { + arbitrum: { + tvl, + staking: staking(veFCTR, FCTR) + } +} diff --git a/projects/fairyswap-v2/index.js b/projects/fairyswap-v2/index.js new file mode 100644 index 00000000000..cb51c5296ef --- /dev/null +++ b/projects/fairyswap-v2/index.js @@ -0,0 +1,8 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports = { + methodology: `Uses factory(0xA2DD9611675927281070dB095599D31a8D4a007A) address and whitelisted tokens address to find and price Liquidity Pool pairs`, + findora: { + tvl: getUniTVL({ factory: '0xA2DD9611675927281070dB095599D31a8D4a007A', chain: 'findora', useDefaultCoreAssets: true, }), + }, +}; \ No newline at end of file diff --git a/projects/fantOHM/BalancerVaultBeets.json b/projects/fantOHM/BalancerVaultBeets.json index 80676f46fbd..9d147ed162a 100644 --- a/projects/fantOHM/BalancerVaultBeets.json +++ b/projects/fantOHM/BalancerVaultBeets.json @@ -1,31 +1,3 @@ { - "getPoolTokens" : { - "inputs": [ - { - "internalType": "bytes32", - "name": "poolId", - "type": "bytes32" - } - ], - "name": "getPoolTokens", - "outputs": [ - { - "internalType": "contract IERC20[]", - "name": "tokens", - "type": "address[]" - }, - { - "internalType": "uint256[]", - "name": "balances", - "type": "uint256[]" - }, - { - "internalType": "uint256", - "name": "lastChangeBlock", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } + "getPoolTokens": "function getPoolTokens(bytes32 poolId) view returns (address[] tokens, uint256[] balances, uint256 lastChangeBlock)" } \ No newline at end of file diff --git a/projects/fantOHM/BalancerWeightedPoolBeets.json b/projects/fantOHM/BalancerWeightedPoolBeets.json index 2b67081b99e..7e8058d689a 100644 --- a/projects/fantOHM/BalancerWeightedPoolBeets.json +++ b/projects/fantOHM/BalancerWeightedPoolBeets.json @@ -1,15 +1,3 @@ { - "totalSupply" : { - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } + "totalSupply": "uint256:totalSupply" } \ No newline at end of file diff --git a/projects/fantOHM/MasterChefBeets.json b/projects/fantOHM/MasterChefBeets.json index bb4e16c9bf6..7201e83a7e4 100644 --- a/projects/fantOHM/MasterChefBeets.json +++ b/projects/fantOHM/MasterChefBeets.json @@ -1,55 +1,4 @@ { - "userInfo" : { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "userInfo", - "outputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "rewardDebt", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "pendingBeets" : { - "inputs": [ - { - "internalType": "uint256", - "name": "_pid", - "type": "uint256" - }, - { - "internalType": "address", - "name": "_user", - "type": "address" - } - ], - "name": "pendingBeets", - "outputs": [ - { - "internalType": "uint256", - "name": "pending", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -} + "userInfo": "function userInfo(uint256, address) view returns (uint256 amount, uint256 rewardDebt)", + "pendingBeets": "function pendingBeets(uint256 _pid, address _user) view returns (uint256 pending)" +} \ No newline at end of file diff --git a/projects/fantOHM/api.js b/projects/fantOHM/api.js new file mode 100644 index 00000000000..606277d1561 --- /dev/null +++ b/projects/fantOHM/api.js @@ -0,0 +1,4 @@ +const index = require('./index') +const { ohmStaking } = require('../helper/treasury') + +module.exports = ohmStaking(index) \ No newline at end of file diff --git a/projects/fantOHM/index.js b/projects/fantOHM/index.js index fc8eb1c9876..8744e8ae8d0 100644 --- a/projects/fantOHM/index.js +++ b/projects/fantOHM/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const {staking} = require("../helper/staking"); const {sumTokensAndLPsSharedOwners} = require("../helper/unwrapLPs"); @@ -32,8 +33,8 @@ const masterChefContract = "0x4897EB3257A5391d80B2f73FB0748CCd4150b586"; // Moonriver TVL should consist of - treasury value and investments on gnosis safe // const movr_transforms = { - "0x748134b5f553f2bcbd78c6826de99a70274bdeb3": "ethereum:0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", // USDC - "0xe936caa7f6d9f5c9e907111fcaf7c351c184cda7": "ethereum:0xdac17f958d2ee523a2206206994597c13d831ec7", // USDT + "0x748134b5f553f2bcbd78c6826de99a70274bdeb3": "ethereum:" + ADDRESSES.ethereum.USDC, // USDC + "0xe936caa7f6d9f5c9e907111fcaf7c351c184cda7": "ethereum:" + ADDRESSES.ethereum.USDT, // USDT "0xfa1fbb8ef55a4855e5688c0ee13ac3f202486286": "fantom:0xfa1FBb8Ef55A4855E5688C0eE13aC3f202486286", // FHM } @@ -61,8 +62,8 @@ async function moonriverTvl(timestamp, block, chainBlocks) { // Fantom TVL should consist of - treasury value and investments on gnosis safe // const fantom_transforms = { - "0x8d11ec38a3eb5e956b052f67da8bdc9bef8abf3e": "0x6b175474e89094c44da98b954eedeac495271d0f", // DAI - "0x04068DA6C83AFCFA0e13ba15A6696662335D5B75": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC + [ADDRESSES.fantom.DAI]: ADDRESSES.ethereum.DAI, // DAI + [ADDRESSES.fantom.USDC]: ADDRESSES.ethereum.USDC, // USDC } async function fantomTvl(timestamp, _, {fantom: block}) { @@ -70,33 +71,33 @@ async function fantomTvl(timestamp, _, {fantom: block}) { // treasury value await sumTokensAndLPsSharedOwners(balances, [ - ["0x8d11ec38a3eb5e956b052f67da8bdc9bef8abf3e", false], // DAI - ["0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83", false], // wFTM - ["0x6fc9383486c163fa48becdec79d6058f984f62ca", false], // USDB - ["0x04068DA6C83AFCFA0e13ba15A6696662335D5B75", false], // USDC + [ADDRESSES.fantom.DAI, false], // DAI + [ADDRESSES.fantom.WFTM, false], // wFTM + // ["0x6fc9383486c163fa48becdec79d6058f984f62ca", false], // USDB + [ADDRESSES.fantom.USDC, false], // USDC ["0xd77fc9c4074b56ecf80009744391942fbfddd88b", true], // DAI/FHM ], [fantomTreasuryContract], block, "fantom", addr => (fantom_transforms[addr.toLowerCase()] ? fantom_transforms[addr.toLowerCase()] : `fantom:${addr}`)) // treasury values await Promise.all([ - balanceOfStablePool(fantomTreasuryContract, "0xD5E946b5619fFf054c40D38c976f1d06C1e2fA82", "fantom:0x6fc9383486c163fa48becdec79d6058f984f62ca", "fantom:0x8d11ec38a3eb5e956b052f67da8bdc9bef8abf3e", balances, block), // USDB-DAI stable pool + balanceOfStablePool(fantomTreasuryContract, "0xD5E946b5619fFf054c40D38c976f1d06C1e2fA82", "fantom:0x6fc9383486c163fa48becdec79d6058f984f62ca", "fantom:" + ADDRESSES.fantom.DAI, balances, block), // USDB-DAI stable pool ]); // investments await Promise.all([ - balanceOf(fantomGnosisContract, "0x6fc9383486c163fa48becdec79d6058f984f62ca", "fantom:0x6fc9383486c163fa48becdec79d6058f984f62ca", balances, block), // USDB - balanceOf(fantomGnosisContract, "0x8D11eC38a3EB5E956B052f67Da8Bdc9bef8Abf3E", "0x6b175474e89094c44da98b954eedeac495271d0f", balances, block), // DAI + // balanceOf(fantomGnosisContract, "0x6fc9383486c163fa48becdec79d6058f984f62ca", "fantom:0x6fc9383486c163fa48becdec79d6058f984f62ca", balances, block), // USDB + balanceOf(fantomGnosisContract, ADDRESSES.fantom.DAI, ADDRESSES.ethereum.DAI, balances, block), // DAI beetsFtm_BeetsLp(fantohmDaoDeployerWallet, balances, block), // beets/wftm LP lqdrFtm_BeetsLp(fantohmDaoDeployerWallet, balances, block), // lqdr/wftm LP ]); // usdbalance.com await Promise.all([ - balanceOf(ftmTradfi3mContract, "0x6fc9383486c163fa48becdec79d6058f984f62ca", "fantom:0x6fc9383486c163fa48becdec79d6058f984f62ca", balances, block), // USDB - balanceOf(ftmTradfi6mContract, "0x6fc9383486c163fa48becdec79d6058f984f62ca", "fantom:0x6fc9383486c163fa48becdec79d6058f984f62ca", balances, block), // USDB + // balanceOf(ftmTradfi3mContract, "0x6fc9383486c163fa48becdec79d6058f984f62ca", "fantom:0x6fc9383486c163fa48becdec79d6058f984f62ca", balances, block), // USDB + // balanceOf(ftmTradfi6mContract, "0x6fc9383486c163fa48becdec79d6058f984f62ca", "fantom:0x6fc9383486c163fa48becdec79d6058f984f62ca", balances, block), // USDB - balanceOfStablePool(masterChefContract, "0xD5E946b5619fFf054c40D38c976f1d06C1e2fA82", "fantom:0x6fc9383486c163fa48becdec79d6058f984f62ca", "fantom:0x8d11ec38a3eb5e956b052f67da8bdc9bef8abf3e", balances, block), // USDB-DAI stable pool + balanceOfStablePool(masterChefContract, "0xD5E946b5619fFf054c40D38c976f1d06C1e2fA82", "fantom:0x6fc9383486c163fa48becdec79d6058f984f62ca", "fantom:" + ADDRESSES.fantom.DAI, balances, block), // USDB-DAI stable pool ]); return balances; @@ -111,21 +112,21 @@ async function ethTvl(timestamp, block, chainBlocks) { // investments await Promise.all([ balanceOf(ethGnosisContract, "0xd2877702675e6cEb975b4A1dFf9fb7BAF4C91ea9", "ethereum:0xd2877702675e6cEb975b4A1dFf9fb7BAF4C91ea9", balances, block, "ethereum"), // wLUNA - balanceOf(ethGnosisContract, "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", "ethereum:0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", balances, block, "ethereum"), // wBTC - balanceOf(ethGnosisContract, "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", "ethereum:0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", balances, block, "ethereum"), // wETH - balanceOf(ethGnosisContract, "0x7D1AfA7B718fb893dB30A3aBc0Cfc608AaCfeBB0", "ethereum:0x7D1AfA7B718fb893dB30A3aBc0Cfc608AaCfeBB0", balances, block, "ethereum"), // MATIC + balanceOf(ethGnosisContract, ADDRESSES.ethereum.WBTC, "ethereum:" + ADDRESSES.ethereum.WBTC, balances, block, "ethereum"), // wBTC + balanceOf(ethGnosisContract, ADDRESSES.ethereum.WETH, "ethereum:" + ADDRESSES.ethereum.WETH, balances, block, "ethereum"), // wETH + balanceOf(ethGnosisContract, ADDRESSES.ethereum.MATIC, "ethereum:" + ADDRESSES.ethereum.MATIC, balances, block, "ethereum"), // MATIC balanceOf(ethGnosisContract, "0x940a2db1b7008b6c776d4faaca729d6d4a4aa551", "ethereum:0x940a2db1b7008b6c776d4faaca729d6d4a4aa551", balances, block, "ethereum"), // DUSK ]); // usdbalance.com await Promise.all([ - balanceOf(ethGnosisContract, "0x02B5453D92B730F29a86A0D5ef6e930c4Cf8860B", "fantom:0x6fc9383486c163fa48becdec79d6058f984f62ca", balances, block, "ethereum"), // USDB - balanceOf(ethGnosisContract, "0x6b175474e89094c44da98b954eedeac495271d0f", "ethereum:0x6b175474e89094c44da98b954eedeac495271d0f", balances, block, "ethereum"), // DAI + // balanceOf(ethGnosisContract, "0x02B5453D92B730F29a86A0D5ef6e930c4Cf8860B", "fantom:0x6fc9383486c163fa48becdec79d6058f984f62ca", balances, block, "ethereum"), // USDB + balanceOf(ethGnosisContract, ADDRESSES.ethereum.DAI, "ethereum:" + ADDRESSES.ethereum.DAI, balances, block, "ethereum"), // DAI - balanceOf(ethTreasuryContract, "0x02B5453D92B730F29a86A0D5ef6e930c4Cf8860B", "fantom:0x6fc9383486c163fa48becdec79d6058f984f62ca", balances, block, "ethereum"), // USDB + // balanceOf(ethTreasuryContract, "0x02B5453D92B730F29a86A0D5ef6e930c4Cf8860B", "fantom:0x6fc9383486c163fa48becdec79d6058f984f62ca", balances, block, "ethereum"), // USDB - balanceOf(ethTradfi3mContract, "0x02B5453D92B730F29a86A0D5ef6e930c4Cf8860B", "fantom:0x6fc9383486c163fa48becdec79d6058f984f62ca", balances, block, "ethereum"), // USDB - balanceOf(ethTradfi6mContract, "0x02B5453D92B730F29a86A0D5ef6e930c4Cf8860B", "fantom:0x6fc9383486c163fa48becdec79d6058f984f62ca", balances, block, "ethereum"), // USDB + // balanceOf(ethTradfi3mContract, "0x02B5453D92B730F29a86A0D5ef6e930c4Cf8860B", "fantom:0x6fc9383486c163fa48becdec79d6058f984f62ca", balances, block, "ethereum"), // USDB + // balanceOf(ethTradfi6mContract, "0x02B5453D92B730F29a86A0D5ef6e930c4Cf8860B", "fantom:0x6fc9383486c163fa48becdec79d6058f984f62ca", balances, block, "ethereum"), // USDB ]); return balances; @@ -141,7 +142,7 @@ async function bobaTvl(timestamp, block, chainBlocks) { const balance = (await sdk.api.erc20.balanceOf({ chain: "boba", block: chainBlocks.boba, - target: "0xa18bf3994c0cc6e3b63ac420308e5383f53120d7", + target: ADDRESSES.boba.BOBA, owner: fantohmDaoDeployerWallet, })).output; @@ -200,7 +201,7 @@ async function beetsFtm_BeetsLp(owner, balances, block) { const poolId = "0xcde5a11a4acb4ee4c805352cec57e236bdbc3837000200000000000000000019"; const beets = "0xF24Bcf4d1e507740041C9cFd2DddB29585aDCe1e"; - const wftm = "0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83"; + const wftm = ADDRESSES.fantom.WFTM; const fBeetsBalance = (await sdk.api.abi.call({ chain: "fantom", @@ -255,7 +256,7 @@ async function lqdrFtm_BeetsLp(owner, balances, block) { const lqdr = "0x10b620b2dbAC4Faa7D7FFD71Da486f5D44cd86f9"; const beets = "0xF24Bcf4d1e507740041C9cFd2DddB29585aDCe1e"; - const wftm = "0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83"; + const wftm = ADDRESSES.fantom.WFTM; const lqdrFtmBalance = (await sdk.api.abi.call({ chain: "fantom", diff --git a/projects/fantOHM/index.json b/projects/fantOHM/index.json index c2719ce93d5..a8829c01748 100644 --- a/projects/fantOHM/index.json +++ b/projects/fantOHM/index.json @@ -1,15 +1,3 @@ { - "index": { - "inputs": [], - "name": "index", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -} + "index": "uint256:index" +} \ No newline at end of file diff --git a/projects/fantasm/abi.json b/projects/fantasm/abi.json index 99d24260334..8e5110ae2d4 100644 --- a/projects/fantasm/abi.json +++ b/projects/fantasm/abi.json @@ -1,35 +1,11 @@ { "bank": { - "usableFtmBalance": { - "inputs": [], - "name": "usableCollateralBalance", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - } + "usableFtmBalance": "uint256:usableCollateralBalance" }, "bankV1": { - "usableFtmBalance": { - "inputs": [], - "name": "usableFtmBalance", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - } + "usableFtmBalance": "uint256:usableFtmBalance" }, "multiFeeDistribution": { - "totalSupply": { - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } + "totalSupply": "uint256:totalSupply" } } diff --git a/projects/fantasm/index.js b/projects/fantasm/index.js index 5c4db4a0cf3..07121d26eab 100644 --- a/projects/fantasm/index.js +++ b/projects/fantasm/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const Abis = require("./abi.json"); const sdk = require("@defillama/sdk"); const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); @@ -5,7 +6,7 @@ const { staking } = require("../helper/staking"); const Contracts = { fantomV1: { - wftm: "0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83", + wftm: ADDRESSES.fantom.WFTM, fsm: "0xaa621D2002b5a6275EF62d7a065A865167914801", bank: "0x880672AB1d46D987E5d663Fc7476CD8df3C9f937", multiFeeDistribution: "0x348634Ea9367690383716FbCa8f225366bbC5966", @@ -17,7 +18,7 @@ const Contracts = { ], }, fantom: { - wftm: "0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83", + wftm: ADDRESSES.fantom.WFTM, fxm: "0x132b56763C0e73F95BeCA9C452BadF89802ba05e", bank: "0xa3B99CdFdDe2216AfB1D58D6108cC93fea413A76", multiFeeDistribution: "0xC4510604504Fd50f64499fF6186AEf1F740dE38B", diff --git a/projects/farmersonly/abi.js b/projects/farmersonly/abi.js index e18e48a6fa2..42b962834a2 100644 --- a/projects/farmersonly/abi.js +++ b/projects/farmersonly/abi.js @@ -1,56 +1,5 @@ module.exports = { - poolLength: { - "type": "function", - "stateMutability": "view", - "outputs": [ - { - "name": "", - "type": "uint256", - "internalType": "uint256" - } - ], - "name": "poolLength", - "inputs": [], - "constant": true, - "signature": "0x081e3eda" - }, - poolInfo: { - "name": "poolInfo", - "type": "function", - "outputs": [ - { - "type": "address", - "internalType": "contract IERC20", - "name": "want" - }, - { - "type": "address", - "internalType": "address", - "name": "strat" - } - ], - "stateMutability": "view", - "inputs": [ - { - "type": "uint256", - "name": "", - "internalType": "uint256" - } - ], - "constant": true, - "signature": "0x1526fe27" - }, - wantLockedTotal: { - "inputs": [], - "name": "wantLockedTotal", - "stateMutability": "view", - "outputs": [ - { - "name": "", - "type": "uint256", - "internalType": "uint256" - } - ], - "type": "function" - }, + poolLength: "uint256:poolLength", + poolInfo: "function poolInfo(uint256) view returns (address want, address strat)", + wantLockedTotal: "uint256:wantLockedTotal", } \ No newline at end of file diff --git a/projects/farmersonly/index.js b/projects/farmersonly/index.js index 80939400c8a..1d2c0420c42 100644 --- a/projects/farmersonly/index.js +++ b/projects/farmersonly/index.js @@ -11,7 +11,6 @@ const vaultChef = '0x2914646e782cc36297c6639734892927b3b6fe56' const chain = 'harmony' const dexTVL = getUniTVL({ - chain: 'harmony', factory: '0xfa53b963a39621126bf45f647f813952cd3c5c66', useDefaultCoreAssets: true, }) diff --git a/projects/farmhero/abi.json b/projects/farmhero/abi.json index 18f10920143..a8569ad9ea2 100644 --- a/projects/farmhero/abi.json +++ b/projects/farmhero/abi.json @@ -1,74 +1,5 @@ { - "poolInfo": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "poolInfo", - "outputs": [ - { - "internalType": "address", - "name": "want", - "type": "address" - }, - { - "internalType": "enum HeroFarmV3.PoolType", - "name": "poolType", - "type": "uint8" - }, - { - "internalType": "uint256", - "name": "allocPoint", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastRewardTime", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accHEROPerShare", - "type": "uint256" - }, - { - "internalType": "address", - "name": "strat", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "poolLength": { - "inputs": [], - "name": "poolLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "symbol": { - "constant": true, - "inputs": [], - "name": "symbol", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } + "poolInfo": "function poolInfo(uint256) view returns (address want, uint8 poolType, uint256 allocPoint, uint256 lastRewardTime, uint256 accHEROPerShare, address strat)", + "poolLength": "uint256:poolLength", + "symbol": "string:symbol" } \ No newline at end of file diff --git a/projects/fatex/index.js b/projects/fatex/index.js index d26064b626a..6408047a842 100644 --- a/projects/fatex/index.js +++ b/projects/fatex/index.js @@ -11,7 +11,6 @@ module.exports = { polygon: { tvl: getUniTVL({ factory: FACTORY_CONTRACT, - chain: 'polygon', useDefaultCoreAssets: true, }), staking: stakingUnknownPricedLP(X_FATE_TOKEN, FATE_TOKEN, 'polygon', FATE_USDC_PAIR_TOKEN) diff --git a/projects/fathom-dex/index.js b/projects/fathom-dex/index.js new file mode 100644 index 00000000000..921bfb37c6e --- /dev/null +++ b/projects/fathom-dex/index.js @@ -0,0 +1,8 @@ +const { getUniTVL } = require("../helper/unknownTokens"); + +module.exports = { + misrepresentedTokens: true, + xdc: { + tvl: getUniTVL({ factory: "0x9fAb572F75008A42c6aF80b36Ab20C76a38ABc4B", useDefaultCoreAssets: true, }), + }, +}; \ No newline at end of file diff --git a/projects/fcondex/index.js b/projects/fcondex/index.js new file mode 100644 index 00000000000..73c66369fff --- /dev/null +++ b/projects/fcondex/index.js @@ -0,0 +1,11 @@ +const { getUniTVL } = require("../helper/unknownTokens"); +module.exports = { + misrepresentedTokens: true, + mantle: { + tvl: getUniTVL({ + factory: "0x3eF942017d51BA257c4B61BE2f8f641209C8b341", + useDefaultCoreAssets: true, + fetchBalanes: true, + }), + }, +}; diff --git a/projects/fdoge/index.js b/projects/fdoge/index.js index 7003938ba6f..88bb0528be0 100644 --- a/projects/fdoge/index.js +++ b/projects/fdoge/index.js @@ -11,6 +11,9 @@ const pool2LPs = [ module.exports = { deadFrom: 1648765747, + hallmarks: [ + [1645488000, "Rug Pull"] + ], misrepresentedTokens: true, ...tombTvl(token, shares, rewardPool, masonry, pool2LPs, "fantom", undefined, false, pool2LPs[1]) } diff --git a/projects/feederfinance/index.js b/projects/feederfinance/index.js index f41983bc26e..d0f283fe4fb 100644 --- a/projects/feederfinance/index.js +++ b/projects/feederfinance/index.js @@ -1,25 +1,22 @@ const { yieldHelper } = require('../helper/yieldHelper') const { pool2 } = require('../helper/pool2') const { staking } = require('../helper/staking') -const sdk = require('@defillama/sdk') const abis = { - poolLength: {"inputs":[],"name":"vaultsLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}, + poolLength: "uint256:vaultsLength", poolInfo: {"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"vaultInfo","outputs":[{"internalType":"address","name":"vault","type":"address"},{"internalType":"uint256","name":"blockNumber","type":"uint256"},{"internalType":"uint256","name":"createdAt","type":"uint256"}],"stateMutability":"view","type":"function"}, - wantLockedTotal: {"inputs":[],"name":"tokenBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}, - want: {"inputs":[],"name":"want","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"}, + wantLockedTotal: "uint256:tokenBalance", + want: "address:want", } -const getPoolIds = i => i.output.vault +const getPoolIds = i => i.vault -async function getTokens({ chain, block, poolInfos, }) { +async function getTokens({ api, poolInfos, }) { const poolIds = poolInfos.map(getPoolIds) - const { output: tokenRes } = await sdk.api.abi.multiCall({ + return api.multiCall({ abi: abis.want, - calls: poolIds.map(i => ({ target: i})), - chain, block, + calls: poolIds, }) - return tokenRes.map(i => i.output) } module.exports = yieldHelper({ diff --git a/projects/fei/index.js b/projects/fei/index.js index 070e85f9857..384a0f4e621 100644 --- a/projects/fei/index.js +++ b/projects/fei/index.js @@ -1,7 +1,8 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const { sumTokensAndLPsSharedOwners } = require('../helper/unwrapLPs') -const weth = '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2' +const weth = ADDRESSES.ethereum.WETH async function tvl(timestamp, block) { const balances = {} @@ -47,7 +48,7 @@ async function tvl(timestamp, block) { ] await sumTokensAndLPsSharedOwners(balances, [ ['0x94b0a3d511b6ecdb17ebf877278ab030acb0a878', true], // FEI-ETH Uni V2 LP (NOTE: this counts both FEI and ETH, but only the FEI doesn't count as PCV) - ['0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84', false], // stETH + [ADDRESSES.ethereum.STETH, false], // stETH ['0x030ba81f1c18d280636f32af80b9aad02cf0854e', false], // aWETH ['0x4ddc2d193948926d02f9b1fe9e1daa0718270ed5', false], // cETH ['0x5d3a536E4D6DbD6114cc1Ead35777bAB948E3643', false], // cDAI diff --git a/projects/fenrirfinance/index.js b/projects/fenrirfinance/index.js index 5c70dfd2a3f..c4b9cbd3180 100644 --- a/projects/fenrirfinance/index.js +++ b/projects/fenrirfinance/index.js @@ -1,10 +1,11 @@ +const ADDRESSES = require('../helper/coreAssets.json') const {fullCoumpoundExports} = require('../helper/compound'); const replace = { - "0x250632378e573c6be1ac2f97fcdf00515d0aa91b": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", // beth->weth - "0xfb6115445bff7b52feb98650c87f44907e58f802": "0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9", // aave + [ADDRESSES.bsc.BETH]: ADDRESSES.ethereum.WETH, // beth->weth + "0xfb6115445bff7b52feb98650c87f44907e58f802": ADDRESSES.ethereum.AAVE, // aave } -module.exports = fullCoumpoundExports("0x56b4B49f31517be8DacC2ED471BCc20508A0e29D", "bsc", "0x444ADC2D487090A660ebFdDd934d0E962410d8Cc", "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c", addr=>{ +module.exports = fullCoumpoundExports("0x56b4B49f31517be8DacC2ED471BCc20508A0e29D", "bsc", "0x444ADC2D487090A660ebFdDd934d0E962410d8Cc", ADDRESSES.bsc.WBNB, addr=>{ return replace[addr.toLowerCase()] || `bsc:${addr}` }) diff --git a/projects/ferro/index.js b/projects/ferro/index.js index af2fcbcfd83..e34a9adb036 100644 --- a/projects/ferro/index.js +++ b/projects/ferro/index.js @@ -1,7 +1,9 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens2 } = require('../helper/unwrapLPs') const SWAP_3FER_ADDR = '0xe8d13664a42B338F009812Fa5A75199A865dA5cD'; const SWAP_2FER_ADDR = '0xa34C0fE36541fB085677c36B4ff0CCF5fa2B32d6'; +const SWAP_LCRO_WCRO_ADDRESSES = '0x1578C5CF4f8f6064deb167d1eeAD15dF43185afa'; const chain = 'cronos' const tokens = { @@ -10,15 +12,23 @@ const tokens = { SWAP_3FER_ADDR, ], // USDC - "0xc21223249CA28397B4B6541dfFaEcC539BfF0c59": [ + [ADDRESSES.cronos.USDC]: [ SWAP_3FER_ADDR, SWAP_2FER_ADDR, ], // USDT - "0x66e428c3f67a68878562e79A0234c1F83c208770": [ + [ADDRESSES.cronos.USDT]: [ SWAP_3FER_ADDR, SWAP_2FER_ADDR, ], + // LCRO + "0x9fae23a2700feecd5b93e43fdbc03c76aa7c08a6": [ + SWAP_LCRO_WCRO_ADDRESSES, + ], + // WCRO + "0x5C7F8A570d578ED84E63fdFA7b1eE72dEae1AE23": [ + SWAP_LCRO_WCRO_ADDRESSES, + ], }; async function tvl(timestamp, ethBlock, {cronos: block}) { @@ -34,4 +44,4 @@ module.exports = { cronos: { tvl, } -} +} \ No newline at end of file diff --git a/projects/fiatdao/abi.json b/projects/fiatdao/abi.json index d12522b30d8..c5bb61c36ae 100644 --- a/projects/fiatdao/abi.json +++ b/projects/fiatdao/abi.json @@ -1,107 +1,8 @@ { - "underlierToken": { - "inputs": [], - "name": "underlierToken", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "underlierScale": { - "inputs": [], - "name": "underlierScale", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "token": { - "inputs": [], - "name": "token", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "tokenScale": { - "inputs": [], - "name": "tokenScale", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "fairPrice": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "net", - "type": "bool" - }, - { - "internalType": "bool", - "name": "face", - "type": "bool" - } - ], - "name": "fairPrice", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "balanceOf": { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "uint256", - "name": "id", - "type": "uint256" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } + "underlierToken": "address:underlierToken", + "underlierScale": "uint256:underlierScale", + "token": "address:token", + "tokenScale": "uint256:tokenScale", + "fairPrice": "function fairPrice(uint256, bool net, bool face) view returns (uint256)", + "balanceOf": "function balanceOf(address account, uint256 id) view returns (uint256)" } \ No newline at end of file diff --git a/projects/fiatdao/index.js b/projects/fiatdao/index.js index cee1961cb82..8c9c9e7e6fd 100644 --- a/projects/fiatdao/index.js +++ b/projects/fiatdao/index.js @@ -1,15 +1,17 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk") const { default: BigNumber } = require("bignumber.js") const abi = require('./abi.json') const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs") -const { fetchURL } = require("../helper/utils") +const { getConfig } = require('../helper/cache') + const STAKING_CONTRACT = "0xe98ae8cD25CDC06562c29231Db339d17D02Fd486" const STAKING_NFT = "0xE9F9936a639809e766685a436511eac3Fb1C85bC" const RGT = "0xD291E7a03283640FDc51b121aC401383A46cC623" -const YFI = "0x0bc529c00C6401aEF6D220BE8C6Ea1667F6Ad93e" -const MKR = "0x9f8f72aa9304c8b593d555f12ef6589cc3a579a2" +const YFI = ADDRESSES.ethereum.YFI +const MKR = ADDRESSES.ethereum.MKR const BOND = "0x0391D2021f89DC339F60Fff84546EA23E337750f" const UMA = "0x04Fa0d235C4abf4BcF4787aF4CF447DE572eF828" const GOHM = "0x0ab87046fbb341d058f17cbc4c1133f25a20a52f" @@ -17,7 +19,7 @@ const WSOHM = "0xca76543cf381ebbb277be79574059e32108e3e65" const WSOHM_FDT_SLP = "0x2e30e758b3950dd9afed2e21f5ab82156fbdbbba" const FDT_GOHM = "0x75b02b9889536B617d57D08c1Ccb929c523945C1" -const LUSD = '0x5f98805a4e8be255a32880fdec7f6728c6568ba0' +const LUSD = ADDRESSES.ethereum.LUSD const LUSD3CRV = '0xEd279fDD11cA84bEef15AF5D39BB4d4bEE23F0cA' function resolveUnderlier(underlier) { @@ -58,14 +60,14 @@ async function tvl(timestamp, block) { if (block && block < 14928955 ) return {}; const balances = {}; - const metadata = (await fetchURL('https://raw.githubusercontent.com/fiatdao/changelog/main/metadata/metadata-mainnet.json')).data + const metadata = (await getConfig('fiatdao', 'https://raw.githubusercontent.com/fiatdao/changelog/main/metadata/metadata-mainnet.json')) const allVaults = Object.keys(metadata) const { output: tokensAll } = await sdk.api.abi.multiCall({ abi: abi.token, calls: allVaults.map(i => ({ target: i })), block, }) const tokens = [] const vaults = [] tokensAll.forEach(({ output, input: { target } }) => { - if (output !== '0x0000000000000000000000000000000000000000') { + if (output !== ADDRESSES.null) { vaults.push(target) tokens.push(output) } diff --git a/projects/filda/abi.json b/projects/filda/abi.json index 539912138a8..5181f2371dc 100644 --- a/projects/filda/abi.json +++ b/projects/filda/abi.json @@ -1,147 +1,9 @@ { - "markets": { - "constant":true, - "inputs":[ - { - "name":"", - "type":"address" - } - ], - "name":"markets", - "outputs":[ - { - "name":"isSupported", - "type":"bool" - }, - { - "name":"blockNumber", - "type":"uint256" - }, - { - "name":"interestRateModel", - "type":"address" - }, - { - "name":"totalSupply", - "type":"uint256" - }, - { - "name":"supplyRateMantissa", - "type":"uint256" - }, - { - "name":"supplyIndex", - "type":"uint256" - }, - { - "name":"totalBorrows", - "type":"uint256" - }, - { - "name":"borrowRateMantissa", - "type":"uint256" - }, - { - "name":"borrowIndex", - "type":"uint256" - } - ], - "payable":false, - "stateMutability":"view", - "type":"function" - }, - "totalBorrows": { - "constant":true, - "inputs":[ - - ], - "name":"totalBorrows", - "outputs":[ - { - "name":"", - "type":"uint256" - } - ], - "payable":false, - "stateMutability":"view", - "type":"function" - }, - "borrowRatePerBlock": { - "constant":true, - "inputs":[ - - ], - "name":"borrowRatePerBlock", - "outputs":[ - { - "name":"", - "type":"uint256" - } - ], - "payable":false, - "stateMutability":"view", - "type":"function" - }, - "supplyRatePerBlock": { - "constant":true, - "inputs":[ - - ], - "name":"supplyRatePerBlock", - "outputs":[ - { - "name":"", - "type":"uint256" - } - ], - "payable":false, - "stateMutability":"view", - "type":"function" - }, - "underlying": { - "constant": true, - "inputs": [], - "name": "underlying", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function", - "signature": "0x6f307dc3" - }, - "getCash": { - "constant": true, - "inputs": [], - "name": "getCash", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "signature": "0x3b1d21a2", - "stateMutability": "view", - "type": "function" - }, - "getAllMarkets": { - "constant": true, - "inputs": [], - "name": "getAllMarkets", - "outputs": [ - { - "internalType": "contract CToken[]", - "name": "", - "type": "address[]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function", - "signature": "0xb0772d0b" - } -} + "markets": "function markets(address) view returns (bool isSupported, uint256 blockNumber, address interestRateModel, uint256 totalSupply, uint256 supplyRateMantissa, uint256 supplyIndex, uint256 totalBorrows, uint256 borrowRateMantissa, uint256 borrowIndex)", + "totalBorrows": "uint256:totalBorrows", + "borrowRatePerBlock": "uint256:borrowRatePerBlock", + "supplyRatePerBlock": "uint256:supplyRatePerBlock", + "underlying": "address:underlying", + "getCash": "uint256:getCash", + "getAllMarkets": "address[]:getAllMarkets" +} \ No newline at end of file diff --git a/projects/filda/index.js b/projects/filda/index.js index 308a4fca045..ce4e00009be 100644 --- a/projects/filda/index.js +++ b/projects/filda/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk'); const abi = require('./abi.json'); @@ -34,12 +35,12 @@ async function getUnderlying(block, cToken) { function transformAddress(token) { if (token === '0x6f259637dcd74c767781e37bc6133cd6a68aa161') { return token - } else if (token === '0x3D760a45D0887DFD89A2F5385a236B29Cb46ED2a') { - return '0x6b175474e89094c44da98b954eedeac495271d0f';//DAI => DAI - } else if (token === '0x9362Bbef4B8313A8Aa9f0c9808B80577Aa26B73B') { - return '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48';//USDC => USDC - } else if (token === "0x5eE41aB6edd38cDfB9f6B4e6Cf7F75c87E170d98") { - return "0x0000000000085d4780b73119b644ae5ecd22b376" //TUSD + } else if (token === ADDRESSES.heco.DAI_HECO) { + return ADDRESSES.ethereum.DAI;//DAI => DAI + } else if (token === ADDRESSES.heco.USDC_HECO) { + return ADDRESSES.ethereum.USDC;//USDC => USDC + } else if (token === ADDRESSES.heco.TUSD) { + return ADDRESSES.ethereum.TUSD //TUSD } else { return 'heco:' + token } @@ -137,4 +138,9 @@ module.exports = { polygon: compoundExports("0xfBE0f3A3d1405257Bd69691406Eafa73f5095723", "polygon"), arbitrum: compoundExports("0xF67EF5E77B350A81DcbA5430Bc8bE876eDa8D591", "arbitrum"), elastos: compoundExportsWithDifferentBase("0xE52792E024697A6be770e5d6F1C455550265B2CD", "elastos", "elastos"), + kava: compoundExportsWithDifferentBase("0xD2CBE89a36df2546eebc71766264e0F306d38196", "kava", "kava"), + bittorrent: compoundExportsWithDifferentBase("0xE52792E024697A6be770e5d6F1C455550265B2CD", "bittorrent", "bittorrent"), + hallmarks: [ + [Math.floor(new Date('2023-04-24')/1e3), 'Protocol was hacked'], + ], }; diff --git a/projects/filet/abi.js b/projects/filet/abi.js new file mode 100644 index 00000000000..45f869d9025 --- /dev/null +++ b/projects/filet/abi.js @@ -0,0 +1,7 @@ +const filetFVMAbi = "function minePoolMap(uint256) view returns (tuple(address tokenAddress, uint256 expireType, uint256 actionType, uint256 canSell, address[] minerList, uint256 stakingPrice, uint256 tokenRate, uint256 FILRate, uint256 tokenPrecision, uint256 miniPurchaseAmount, uint256 hasSoldOutToken) mPool, bool isEntity)" +const filetBSCAbi = "function minePoolMap(uint256) view returns (tuple(address tokenInterface, address tokenAddress, uint256 expireType, uint256 actionType, tuple(uint256 canSell, uint256 canNotSell) maxMiningPower, address earlyRedeemFundAccount, address redeemFundAccount, address minerAccount, uint256 stakingPrice, uint256 tokenRate, uint256 FILRate, uint256 tokenPrecision, address recievePaymentAccount, uint256 miniPurchaseAmount, uint256 hasSoldOutToken, uint256 lockInterval, uint256[] poolThredhold, uint256[] serviceFeePercent) mPool, bool isEntity)" +const FiletBSCCurrentAbi = "function minePoolMap(uint256) view returns (tuple(address tokenInterface, address tokenAddress, uint256 expireType, uint256 actionType, tuple(uint256 canSell, uint256 canNotSell) maxMiningPower, address earlyRedeemFundAccount, address redeemFundAccount, address profitFundAccount, address minerAccount, uint256 stakingPrice, uint256 tokenRate, uint256 FILRate, uint256 tokenPrecision, address recievePaymentAccount, uint256 miniPurchaseAmount, uint256 maxPurchaseAmount, uint256 hasSoldOutToken, uint256 lockInterval, uint256[] poolThredhold, uint256[] serviceFeePercent, uint256 lendhubExtraRatio) mPool, bool isEntity)" + +module.exports = { + filetFVMAbi, filetBSCAbi, FiletBSCCurrentAbi +} \ No newline at end of file diff --git a/projects/filet/index.js b/projects/filet/index.js index 75a18923ede..3b17ce993dd 100644 --- a/projects/filet/index.js +++ b/projects/filet/index.js @@ -1,10 +1,91 @@ -const { get } = require('../helper/http') -async function fetch() { - const resp = await get('https://www.filet.finance/pledge/ext/tx/pledgeTxAll') - return resp.data.tvl; +const abi = require("./abi.js") +const { fetchURL } = require('../helper/utils') + + +const BigNumber = require("bignumber.js") +const { getExports } = require('../helper/heroku-api') +const { nullAddress } = require("../helper/tokenMapping"); +const { get } = require("../helper/http"); +const {utils} = require("ethers"); + +//bsc staking con +const filetStakingCon_BSC = "0x9c821defD3BBb07C5c786C3bB039051364Fa6F39"; +const filetStakingConFlexible_BSC = "0xE989ef3118C685603B86123569340438ab670505"; +//bsc FILE con +const filetFILECon_BSC = "0xA8F19840e08dC3f134FF45062b953a2B14E02F5A" +const filetStorageCon_FVM = "0xFca90089d63D099c80A4ae91edCdfC904c2afa8e"; +const filetNativeCon = "0xBfd5BB742940a5b059710F4d1216db1F1287F4e0"; + +const filetStakingCon_HECO = "0x62C7aaCdCCEc32A2E33d5fa535B374f8a4a42566"; +const filetStakingConFlexible_HECO = "0x64F23Eb153D7496Fc31C1b38a41068995354773E" + +const poolOnFVM180 = 4010 +const poolOnFVM360 = 4011 + +// filet +const filetAPI = "https://api.filet.finance/pledge/ext/tx/pledgeTxAll" +const minerList = "https://api.filet.finance/pledge/pool/querySpList" +const { sumTokens2 } = require('../helper/unwrapLPs') + + +const getMinersList = async () => { + const resp = await get(minerList) + return resp.data.map(({minerId}) => { + + let bytes = Buffer.alloc(20); + bytes.writeUint8(0xff, 0); + bytes.writeBigUint64BE(BigInt(minerId), 12); + return utils.getAddress('0x' + bytes.toString('hex')); + }); } +// + module.exports = { - fetch, -}; + timetravel: false, + heco: { + tvl: async (_, _1, _2, { api}) => { + const tvlData = await fetchURL(filetAPI) + return { + ["filecoin"]: new BigNumber(tvlData.data.data.hecoTvl), + } + } + }, + bsc: { + tvl: async (_, _1, _2, { api}) => { + + const tvlData = await fetchURL(filetAPI) + return { + ["filecoin"]: new BigNumber(tvlData.data.data.bscTvl), + } + + } + }, + filecoin: { + tvl: async (_, _1, _2, { api }) => { + + const filetMpool180 = await api.call({ target: filetStorageCon_FVM, abi: abi.filetFVMAbi, params:[poolOnFVM180] }); + const filetMpool360 = await api.call({ target: filetStorageCon_FVM, abi: abi.filetFVMAbi, params:[poolOnFVM360] }); + + const filetNative_hasSoldOutToken = await api.call({ target: filetNativeCon, abi: "uint256:hasSoldOutToken", params:[] }); + api.add(nullAddress, filetMpool180.mPool.hasSoldOutToken) + api.add(nullAddress, filetMpool360.mPool.hasSoldOutToken ) + api.add(nullAddress, filetNative_hasSoldOutToken ) + + // getMinersList + const minerList = await getMinersList(); + let balances = await sumTokens2({ owner: filetStorageCon_FVM, tokens:[nullAddress], api, }); + return sumTokens2({balances, api, owners: minerList, tokens: [nullAddress]}); + }, + }, + mixin: { + tvl: async (_, _1, _2, { api }) => { + const tvlData = await fetchURL(filetAPI) + console.log("tvlData:",tvlData.data.data.mixinTvl) + return { + ["filecoin"]: new BigNumber(tvlData.data.data.mixinTvl), + } + } + } +} diff --git a/projects/fin/index.js b/projects/fin/index.js new file mode 100644 index 00000000000..61e7ca3a453 --- /dev/null +++ b/projects/fin/index.js @@ -0,0 +1,27 @@ +const { getConfig } = require("../helper/cache"); +const { sumTokens, } = require('../helper/chain/cosmos'); + +async function tvl() { + const contracts = await getConfig("kujira/contracts", "https://raw.githubusercontent.com/Team-Kujira/kujira.js/master/src/resources/contracts.json"); + const blacklist = [ + 'kujira1hs95lgvuy0p6jn4v7js5x8plfdqw867lsuh5xv6d2ua20jprkgesw2pujt', + 'kujira1gl8js9zn7h9u2h37fx7qg8xy65jrk9t4zpa6s7j5hdlanud2uwxshqq67m' + ] + let owners = [ + ...contracts["kaiyo-1"].fin.map(x => x.address), + ] + + owners = owners.filter(item => { + return !blacklist.includes(item); + }) + + return sumTokens({ owners, chain: 'kujira' }) +} + +module.exports = { + timetravel: false, + kujira: { + tvl, + }, +} + diff --git a/projects/finext-finance/index.js b/projects/finext-finance/index.js new file mode 100644 index 00000000000..957cdcb3546 --- /dev/null +++ b/projects/finext-finance/index.js @@ -0,0 +1,15 @@ +const ADDRESSES = require('../helper/coreAssets.json') + +const { sumTokensExport } = require('../helper/unwrapLPs') + +const FINX = "0xb6943825E461C6d8f2DDF17307C0571972f169FB"; +const GENESIS_POOL = "0x0711c9f411FFc4Fe331256E83ee8C910a997A16a"; +const USDC = ADDRESSES.arbitrum.USDC; +const WETH = ADDRESSES.arbitrum.WETH; + +module.exports = { + methodology: "Calculator USDC and WETH staked to genesis pool contract", + arbitrum: { + tvl: sumTokensExport({ owner: GENESIS_POOL, tokens: [USDC, WETH]}) + }, +} diff --git a/projects/finnexus/index.js b/projects/finnexus/index.js index 1efa55877ec..e64e540448e 100644 --- a/projects/finnexus/index.js +++ b/projects/finnexus/index.js @@ -1,10 +1,11 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokensExport } = require('../helper/unwrapLPs') const config = { ethereum: [ // ['0xef9cd7882c067686691b6ff49e650b43afbbcc6b', '0x919a35A4F40c479B3319E3c3A2484893c06fd7de'], - ['0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', '0xff60d81287BF425f7B2838a61274E926440ddAa6'], - ['0xdac17f958d2ee523a2206206994597c13d831ec7', '0xff60d81287BF425f7B2838a61274E926440ddAa6'], - ['0x853d955acef822db058eb8505911ed77f175b99e', '0x6f88e8fbF5311ab47527f4Fb5eC10078ec30ab10'], + [ADDRESSES.ethereum.USDC, '0xff60d81287BF425f7B2838a61274E926440ddAa6'], + [ADDRESSES.ethereum.USDT, '0xff60d81287BF425f7B2838a61274E926440ddAa6'], + [ADDRESSES.ethereum.FRAX, '0x6f88e8fbF5311ab47527f4Fb5eC10078ec30ab10'], ], wan: [ // ['0xC6F4465A6a521124C8e3096B62575c157999D361', '0xe96E4d6075d1C7848bA67A6850591a095ADB83Eb'], @@ -12,8 +13,8 @@ const config = { ], bsc: [ // ['0xdfd9e2a17596cad6295ecffda42d9b6f63f7b5d5', '0xf2E1641b299e60a23838564aAb190C52da9c9323'], - ['0xe9e7cea3dedca5984780bafc599bd69add087d56', '0xA3f70ADd496D2C1c2C1Be5514A5fcf0328337530'], - ['0x55d398326f99059fF775485246999027B3197955', '0xA3f70ADd496D2C1c2C1Be5514A5fcf0328337530'], + [ADDRESSES.bsc.BUSD, '0xA3f70ADd496D2C1c2C1Be5514A5fcf0328337530'], + [ADDRESSES.bsc.USDT, '0xA3f70ADd496D2C1c2C1Be5514A5fcf0328337530'], ], } diff --git a/projects/fire/index.js b/projects/fire/index.js index 4343a8ae94e..9c32a5a1f6c 100644 --- a/projects/fire/index.js +++ b/projects/fire/index.js @@ -26,7 +26,7 @@ const config = { }, cardano: { owners: [ - 'addr1q8wz6tfmp9yaeuy6xyamwrg4eg9hknu2pfyxwh0uhfcpa9wjyjpuv567rtwkxvt88mms37rxtgnxjnhrx65njr8cvmfqxzqye2', + // 'addr1q8wz6tfmp9yaeuy6xyamwrg4eg9hknu2pfyxwh0uhfcpa9wjyjpuv567rtwkxvt88mms37rxtgnxjnhrx65njr8cvmfqxzqye2', 'addr1qxmsmmjh668w66h4xjvrkyl8wkqcpdnpkn5qhv9yuendnfa0stadpn6g73vwrjs06udq2rnmlpr9twejzdrd7nghk5msus5aqd', ] } diff --git a/projects/firebird/index.js b/projects/firebird/index.js index a40b604b606..702b458c15b 100644 --- a/projects/firebird/index.js +++ b/projects/firebird/index.js @@ -1,31 +1,19 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk') -const {calculateUniTvl} = require('../helper/calculateUniTvl.js') -const {transformPolygonAddress} = require('../helper/portedTokens') +const {uniTvlExport} = require('../helper/calculateUniTvl.js') +const { sumTokens2 } = require('../helper/unwrapLPs') const FACTORY = '0x5De74546d3B86C8Df7FEEc30253865e1149818C8'; const stablePool = "0x01C9475dBD36e46d1961572C8DE24b74616Bae9e" -const stablePoolTokens = ['0xc2132d05d31c914a87c6611c10748aeb04b58e8f', '0x2791bca1f2de4661ed88a30c99a7a9449aa84174', '0x8f3cf7ad23cd3cadbd9735aff958023239c6a063'] +const stablePoolTokens = [ADDRESSES.polygon.USDT, ADDRESSES.polygon.USDC, ADDRESSES.polygon.DAI] async function tvl(_, ethBlock, chainBlocks) { - const transformPolygon = await transformPolygonAddress()// addr=>`polygon:${addr}` const block = chainBlocks['polygon'] const chain = 'polygon' - - const balances = await calculateUniTvl(transformPolygon, block, chain, FACTORY, 0, true) - const stablePoolBalances = await sdk.api.abi.multiCall({ - abi: 'erc20:balanceOf', - calls: stablePoolTokens.map(t=>({ - target: t, - params: stablePool - })), - chain, - block - }) - sdk.util.sumMultiBalanceOf(balances, stablePoolBalances, true, transformPolygon) - return balances -}; + return sumTokens2({ chain, block, owner: stablePool, tokens: stablePoolTokens, }) +} module.exports = { methodology: "Includes liquidity on all the pools on the uniswap fork plus the liquidity in the 3FBird stableswap pool", - polygon: { tvl }, + polygon: { tvl: sdk.util.sumChainTvls([tvl, uniTvlExport(FACTORY, 'polygon', true)]) }, }; diff --git a/projects/firebot/index.js b/projects/firebot/index.js new file mode 100644 index 00000000000..1063d28b069 --- /dev/null +++ b/projects/firebot/index.js @@ -0,0 +1,29 @@ +const { sumTokensExport } = require('../helper/unknownTokens') +const { sumTokensExport: ogSumExport } = require('../helper/unwrapLPs') + +const FBX_TOKEN_CONTRACT = '0xD125443F38A69d776177c2B9c041f462936F8218'; +const FIRE_VAULT_CONTRACT = '0x960d43BE128585Ca45365CD74a7773B9d814dfBE'; +const EP_TOKEN_CONTRACT = '0x60Ed6aCEF3a96F8CDaF0c0D207BbAfA66e751af2'; +const FBX_LP = '0xcffbfa978ac3fb10e829ca6b763c307daafe8a77' +const EP_FBX_LP = '0x41D9DE53EBF26F766229E42Aa02904eB2495E397' + +module.exports = { + polygon: { + tvl: () => 0, + staking: sumTokensExport({ + tokensAndOwners: [ + [EP_TOKEN_CONTRACT, EP_TOKEN_CONTRACT], + [FBX_TOKEN_CONTRACT, FIRE_VAULT_CONTRACT], + ], + lps: [EP_FBX_LP], + coreAssets: [FBX_TOKEN_CONTRACT], + restrictTokenRatio: 100, + }), + pool2: ogSumExport({ + tokensAndOwners: [ + [FBX_LP, '0x92a9180af33531A5d78d81D90AFc0523dc6c62c9'], + ], + }), + }, + methodology: 'Counts the number of FBX and EP tokens in the Vault contracts.' +}; diff --git a/projects/firedao/abi.json b/projects/firedao/abi.json index ffd0c7ce189..4f168ac4e8a 100644 --- a/projects/firedao/abi.json +++ b/projects/firedao/abi.json @@ -1,68 +1,6 @@ { - "want": { - "constant": true, - "inputs": [], - "name": "want", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "balanceOf": { - "constant": true, - "inputs": [], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "vaults": { - "constant": true, - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "vaults", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "balance": { - "constant": true, - "inputs": [], - "name": "balance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } + "want": "address:want", + "balanceOf": "uint256:balanceOf", + "vaults": "function vaults(address) view returns (address)", + "balance": "uint256:balance" } \ No newline at end of file diff --git a/projects/flair-dex/index.js b/projects/flair-dex/index.js new file mode 100644 index 00000000000..77dbe379d8a --- /dev/null +++ b/projects/flair-dex/index.js @@ -0,0 +1,13 @@ +const { getUniTVL } = require("../helper/unknownTokens"); + +module.exports = { + misrepresentedTokens: true, + methodology: `Uses factory(0x634e02EB048eb1B5bDDc0CFdC20D34503E9B362d) address and whitelisted tokens address to find and price liquidity pool pairs`, + avax: { + tvl: getUniTVL({ + factory: "0x634e02EB048eb1B5bDDc0CFdC20D34503E9B362d", + hasStablePools: true, + useDefaultCoreAssets: true, + }), + }, +}; diff --git a/projects/flare-loans/index.js b/projects/flare-loans/index.js index e8b74a65388..be641a55001 100644 --- a/projects/flare-loans/index.js +++ b/projects/flare-loans/index.js @@ -1,16 +1,12 @@ -const sdk = require('@defillama/sdk') - -async function tvl(time, ethB, {songbird: block}){ - return { - "songbird": Number( - (await sdk.api.erc20.balanceOf({target: "0x02f0826ef6aD107Cfc861152B32B52fD11BaB9ED", owner: "0xFa21A4ABD1a58CefAB79CFd597aCcc314403eE9f", block, chain:'songbird'})).output - )/1e18 - } -} +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require('../helper/unwrapLPs') module.exports={ - methodology: "We count all WSGB on 0xFa21A4ABD1a58CefAB79CFd597aCcc314403eE9f, which is backing the stablecoin", + methodology: "We count all WSGB on 0xFa21A4ABD1a58CefAB79CFd597aCcc314403eE9f and all EXFI on 0x4595fc96262057f9b0d4276ff04de8f2f44e612e, which are backing the stablecoin", songbird: { - tvl + tvl: sumTokensExport({chain: 'songbird', tokensAndOwners: [ + [ADDRESSES.songbird.WSGB, '0xFa21A4ABD1a58CefAB79CFd597aCcc314403eE9f'], + [ADDRESSES.songbird.EXFI,'0x4595fc96262057f9b0d4276ff04de8f2f44e612e'] + ]}) } } \ No newline at end of file diff --git a/projects/flareWatermelon/index.js b/projects/flareWatermelon/index.js new file mode 100644 index 00000000000..16f9a663f70 --- /dev/null +++ b/projects/flareWatermelon/index.js @@ -0,0 +1,14 @@ +const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') + +const contract = "0x4d86Aa688ba56e1971Baf8C2CBCb44D980587894" + +async function tvl(time, ethBlock, { flare: block }) { + return sumTokens2({ tokens: [nullAddress], owner: contract, block, chain: 'flare', }) +} + +module.exports = { + methodology: `We count the FLR on ${contract}`, + flare: { + tvl + } +} \ No newline at end of file diff --git a/projects/flarefarm/index.js b/projects/flarefarm/index.js index ab180a72bf3..bd5a66bcf26 100644 --- a/projects/flarefarm/index.js +++ b/projects/flarefarm/index.js @@ -1,18 +1,36 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumUnknownTokens } = require("../helper/unknownTokens"); -const WSGB = '0x02f0826ef6aD107Cfc861152B32B52fD11BaB9ED' -const CANARY_DOLLAR = '0x70Ad7172EF0b131A1428D0c1F66457EB041f2176' +const { staking } = require('../helper/staking') +const WSGB = ADDRESSES.songbird.WSGB +const CANARY_DOLLAR = ADDRESSES.songbird.CAND + const EXFI = ADDRESSES.songbird.EXFI; + const SFIN = ADDRESSES.songbird.SFIN; const chain = 'songbird' async function farmTvl(timestamp, ethblock, { [chain]: block }) { const tokens = [ - [WSGB, "0x6BA0F675EB2f169D15764D5cf10C4EF0e9e059f2"], - ["0xC348F894d0E939FE72c467156E6d7DcbD6f16e21", "0xc9231AB30b2B39c1f7f79132D7a44bBF0F8144B0"], - [CANARY_DOLLAR, "0x32b36B0A8B74Ac9212946a99e0af727848D5A3A1"], + [WSGB, "0x6BA0F675EB2f169D15764D5cf10C4EF0e9e059f2"], + [EXFI, "0xc9231AB30b2B39c1f7f79132D7a44bBF0F8144B0"], + [CANARY_DOLLAR, "0x32b36B0A8B74Ac9212946a99e0af727848D5A3A1"], ["0xC6D2f9e21bcD963B42D85379581003be1146b3Aa", "0x02785B7CE6Eb9A5858561DDAB64cCBE5c478b730"], ["0x07852D5C7fd1d630Dd79148A195aaAF72241680D", "0x50756c69CAC800a3fA03d130721CDa02Aa0fEF69"], ["0xb5bf334b8cc30b8b13fc035d171d77a217aab091", "0x864201b2227Ee23f0875c5D3Fc49F4F0ec59aC19"], ["0x47c830e141234d029d953df39b13d7728eb9f2d4", "0x921E8f58cF517d289c01BCBE800c2d31838c1a28"], + [EXFI, "0xad72C1483bBAB54B7f4e0024f6D4b437a69DA48b"], + [EXFI, "0xbEDfFd817383147616131ED38B7030277609d8B7"], + [EXFI, "0x6FD8A1a58645aaB92Aa6858b42a8dd985714fE15"], + [EXFI, "0x7e48Db2b486Cf90150421cBdcA401B86833F5333"], + ["0x47C830E141234d029D953dF39B13d7728eB9f2d4", "0xc387818C274a365D973AAb8287498350757D7b1f"], + ['0xB5BF334B8Cc30B8B13fc035d171D77A217aaB091','0x53Fb520ea993C58dB5035b3a00FABB0dc8fE3CA4'], + ['0x47C830E141234d029D953dF39B13d7728eB9f2d4','0xb4bD741343727EcBdACDE37124D869104b0AcAf8'], + ['0xC6D2f9e21bcD963B42D85379581003be1146b3Aa','0x1d1FAD6faAFc6a5Cd6652fFA7BA43F9E4fa75C0d'], + [EXFI, '0xD02C3e166223EE78F4d0ae99F5396142b48D97FE'], + [WSGB, '0x745d8896629842ef8E44D269f89A7A873086A6F2'], + [EXFI, "0x61128b44C299b0f7a752BF6278f44f1EcefD9109"], + ['0x3233642aCf7664a69c33e5a6FFAb321608d7A65f','0xF81B465C562ED3f54Aea772D8A56FAF93884ea2E'], + [EXFI, "0x3B346b0b091fA8813f60Cd6e81b95b63375e22f5"], + ['0xc41aA3ac0e6efcb780cd4696E7eC3B8193BB46E1', "0xa275DD75C1182055C7039b839cC0Da017c78933a"] ]; return sumUnknownTokens({ tokensAndOwners: tokens, chain, block, useDefaultCoreAssets: true, }) @@ -22,22 +40,23 @@ async function pool2(timestamp, ethblock, { [chain]: block }) { const tokens = [ ["0xcd15c231b8a0bae40bd7938ae5ea8e43f1e9a15f", "0x0732f6B4aBE5dB2127E671E4B218d340b6af169c"], ["0xcd15c231b8a0bae40bd7938ae5ea8e43f1e9a15f", "0x3b343A6FC05B699F48CBe6FF127C0af8e2aA9EEE"], + ["0xcd15c231b8a0bae40bd7938ae5ea8e43f1e9a15f", "0x782BdE5353FAcFab1eBeC1803f2a575346193B30"], ["0x48195ca4d228ce487ae2ae1335b017a95493ade6", "0xc5478a1d5914cF9D0Ee20Da21459502eCb7E1646"], + ["0x48195ca4d228ce487ae2ae1335b017a95493ade6", "0x9185D70f17eC13897D780601708b1b1F36A75d32"], + ["0xcd15c231b8a0bae40bd7938ae5ea8e43f1e9a15f", "0xD262AFf2Bb76f05cf470a7D935E717eEbA8ef799"], + ["0x5D4e155CA27e8DAd4E4aceE48F83B6E0E4AFEec0", "0x2379FD47f100828382fFeaF26381Ba6608f7Bf73"], + ["0x5D4e155CA27e8DAd4E4aceE48F83B6E0E4AFEec0", "0xC1ecfEA1148f9506FF10E9Ecf76F40884b4987Cc"], + ["0xcd15c231b8a0bae40bd7938ae5ea8e43f1e9a15f", "0xDa78E41813Cc2468bAA74ad3E84b35b7FedF42bD"] ] return sumUnknownTokens({ tokensAndOwners: tokens, chain, block, useDefaultCoreAssets: true, }) -}; -async function staking(timestamp, ethblock, { [chain]: block }) { - const tokens = [ - ['0x0D94e59332732D18CF3a3D457A8886A2AE29eA1B', '0x554742076743b366504972F86609d64fd18BDC34'] - ] - return sumUnknownTokens({ tokensAndOwners: tokens, chain, block, useDefaultCoreAssets: true, lps: ['0x48195Ca4D228ce487AE2AE1335B017a95493Ade6'] }) -}; +} module.exports = { + misrepresentedTokens: true, methodology: `Gets token balance from the smart contract address holding the user deposits. These addresses are are labele "tokensAndOwners". SFIN staked to earn more SFIN is labeles as "staking" category`, songbird: { tvl: farmTvl, pool2, - staking, + staking: staking(['0x554742076743b366504972F86609d64fd18BDC34', '0xd0dbAFF52224C0882cfaf1765f347Cb5e4364FA1'], SFIN), } }; \ No newline at end of file diff --git a/projects/flarex/index.js b/projects/flarex/index.js index ded295142f1..1872fac04d3 100644 --- a/projects/flarex/index.js +++ b/projects/flarex/index.js @@ -6,7 +6,7 @@ const v2 =getUniTVL({ factory: '0x7a39408809441814469A8Fb3F5CFea1aA2774fB6', cha module.exports={ misrepresentedTokens: true, - methodology: "Factory address (0x0eAC91966b12b81db18f59D8e893b9ccef7e2c30) is used to find the LP pairs. TVL is equal to the liquidity on the AMM.", + methodology: "Factory address (0x7a39408809441814469A8Fb3F5CFea1aA2774fB6) is used to find the LP pairs. TVL is equal to the liquidity on the AMM.", songbird: { tvl:sdk.util.sumChainTvls([v1,v2]) } diff --git a/projects/flashstake-old/index.js b/projects/flashstake-old/index.js index c9cac47aa65..25dfe370179 100644 --- a/projects/flashstake-old/index.js +++ b/projects/flashstake-old/index.js @@ -1,24 +1,18 @@ -const { request, gql } = require("graphql-request"); -const { toUSDTBalances } = require("../helper/balances"); -const graphUrl = - "https://api.thegraph.com/subgraphs/name/blockzerohello/flash-stake-stats-v2-subgraph"; -const graphQuery = gql` - query get_tvl($block: Int) { - flashFactories(block: { number: $block }) { - totalVolumeUSD - totalLiquidityUSD - } - } -`; -async function tvl(timestamp, block) { - const { flashFactories } = await request(graphUrl, graphQuery, { - block, - }); - const usdTvl = Number(flashFactories[0].totalLiquidityUSD); - return toUSDTBalances(usdTvl); +const { getLogs } = require('../helper/cache/getLogs') + +async function tvl(timestamp, block, _, { api }) { + const logs = await getLogs({ + api, + target: '0xb0aeae6e204bd95911ead25263d7078954fb7fb0', + topics: ['0x4f2ce4e40f623ca765fc0167a25cb7842ceaafb8d82d3dec26ca0d0e0d2d4896'], + eventAbi: 'event PoolCreated (address pool, address token)', + onlyArgs: true, + fromBlock: 12030855, + }) + return api.sumTokens({ tokensAndOwners: logs.map(log => [log.token, log.pool]) }) } + module.exports = { - misrepresentedTokens: true, ethereum: { tvl, }, diff --git a/projects/flashstake/abi.json b/projects/flashstake/abi.json deleted file mode 100644 index 0a3b4753189..00000000000 --- a/projects/flashstake/abi.json +++ /dev/null @@ -1,116 +0,0 @@ -{ - "totalLockedAmount": { - "inputs": [], - "name": "totalLockedAmount", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getPrincipalBalance": { - "inputs": [], - "name": "getPrincipalBalance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getYieldBalance": { - "inputs": [], - "name": "getYieldBalance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "stakingTokenAddress": { - "inputs": [], - "name": "stakingTokenAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "totalSupply": { - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "token0": { - "inputs": [], - "name": "token0", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "token1": { - "inputs": [], - "name": "token1", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getReserves": { - "inputs": [], - "name": "getReserves", - "outputs": [ - { - "internalType": "uint112", - "name": "", - "type": "uint112" - }, - { - "internalType": "uint112", - "name": "", - "type": "uint112" - }, - { - "internalType": "uint32", - "name": "", - "type": "uint32" - } - ], - "stateMutability": "view", - "type": "function" - } -} diff --git a/projects/flashstake/index.js b/projects/flashstake/index.js index c9c983200c0..3e2cc6bb58b 100644 --- a/projects/flashstake/index.js +++ b/projects/flashstake/index.js @@ -1,306 +1,76 @@ -const abi = require("./abi.json"); const sdk = require('@defillama/sdk'); -const { GraphQLClient, gql } = require('graphql-request') -const { getBlock } = require('../helper/getBlock'); -const { log } = require('../helper/utils'); -const { get } = require('../helper/http') - -// This will get underlying token for a given UNI-LP pool address and amount of -// LP tokens. -async function getUnderlyingTokens(chain, block, poolAddress, amount) { - let output = {}; - - // Retrieve the total LP token supply - let totalSupply = await sdk.api.abi.call({ - target: poolAddress, - abi: abi['totalSupply'], - block: block, - chain: chain, - }); - totalSupply = totalSupply['output']; - - // Determine what % is owned - const percentageOwned = Number(amount) / Number(totalSupply); - - // Retrieve token0 and token1 balances - const reserves = await sdk.api.abi.call({ - target: poolAddress, - abi: abi['getReserves'], - block: block, - chain: chain, - }); - - let token0Address = await sdk.api.abi.call({ - target: poolAddress, - abi: abi['token0'], - block: block, - chain: chain, - }); - token0Address = String(token0Address['output']).toLowerCase(); - let token1Address = await sdk.api.abi.call({ - target: poolAddress, - abi: abi['token1'], - block: block, - chain: chain, - }); - token1Address = String(token1Address['output']).toLowerCase(); - - const token0Balance = Number(reserves['output'][0]) * percentageOwned; - const token1Balance = Number(reserves['output'][1]) * percentageOwned; - - if (!(token0Address in output)) { - output[token0Address] = 0; - } - output[token0Address] = token0Balance; - - if (!(token1Address in output)) { - output[token1Address] = 0; - } - output[token1Address] = token1Balance; - - return output; -} - -// This will determine how many LP tokens (FLASH/WETH) are locked in the -// FlashBackLM contracts. -function getPool2(chainObject) { - - const chain = chainObject['chain']; - - return async (_, _b, { [chain]: block }) => { - let balances = {}; - - // If null, skip - if(chainObject['flashBackLM'] == null) { - return balances; - } - - const contractAddresses = chainObject['flashBackLM']['addresses']; - - // Iterate over all above contract addresses - for(let i = 0; i < contractAddresses.length; i++) { - - // Retrieve the staking token address - let stakingTokenAddress = await sdk.api.abi.call({ - target: contractAddresses[i], - abi: abi['stakingTokenAddress'], - block: block, - chain: chain, - }); - stakingTokenAddress = stakingTokenAddress['output']; - - // Retrieve the total number of LP tokens locked - const totalLPLocked = await sdk.api.abi.call({ - target: contractAddresses[i], - abi: abi['totalLockedAmount'], - block: block, - chain: chain, - }); - - if (!(stakingTokenAddress in balances)) { - balances[stakingTokenAddress] = 0; - } - balances[stakingTokenAddress] += Number(totalLPLocked['output']); - } - log("getPool2", chain, block, balances); - - // ============== - // Resolve the underlying assets from the LP token - // ============== - let newBalances = {}; - for(let i = 0; i < Object.keys(balances).length; i++) { - if (Object.keys(balances)[i] === undefined) { - break; - } - - // Retrieve underlying tokens - const underlyingTokens = await getUnderlyingTokens( - chain, - block, - Object.keys(balances)[i], - balances[Object.keys(balances)[i]] - ); - - for(let j = 0; j < Object.keys(underlyingTokens).length; j++) { - const formattedAddress = chain + ":" + Object.keys(underlyingTokens)[j]; - - if (!(formattedAddress in newBalances)) { - newBalances[formattedAddress] = 0; - } - newBalances[formattedAddress] += underlyingTokens[Object.keys(underlyingTokens)[j]]; - } - } - balances = newBalances; - - return balances; - } +const { staking } = require('../helper/staking') +// const { getLogs } = require('../helper/cache/getLogs') +const { getConfig } = require('../helper/cache') + +const config = { + ethereum: { protocol: '0x78b2d65dd1d3d9fb2972d7ef467261ca101ec2b9', fromBlock: 15233959, }, + optimism: { protocol: '0x78b2d65dd1d3d9fb2972d7ef467261ca101ec2b9', fromBlock: 31242674, }, + arbitrum: { protocol: '0x78b2d65dd1d3d9fb2972d7ef467261ca101ec2b9', fromBlock: 68227883, }, } +let configData -// This will determine how many Flash tokens are locked in the FlashBack -// contracts. -function getStaking(chainObject) { - - const chain = chainObject['chain']; - - return async (_, _b, { [chain]: block }) => { - block = await getBlock(_, chain, { [chain]: block }); - - // If null, skip - const contractAddress = chainObject['flashBackStakingAddress']; - if(contractAddress == null) { - log(chain, block, "Staking contract N/A, skipping"); - return {}; - } - - let stakingTokenAddress = await sdk.api.abi.call({ - target: contractAddress, - abi: abi['stakingTokenAddress'], - block: block, - chain: chain, - }); - stakingTokenAddress = stakingTokenAddress['output']; - - let totalFlashLocked = await sdk.api.abi.call({ - target: contractAddress, - abi: abi['totalLockedAmount'], - block: block, - chain: chain, - }); - totalFlashLocked = totalFlashLocked['output']; - - // Format the output to the expected format - const formattedAddress = chain + ":" + stakingTokenAddress; - let out = {}; - out[formattedAddress] = totalFlashLocked; - log("getStaking", chain, block, formattedAddress, totalFlashLocked, out); - - return out; - } -} - -// This will determine the total TVL for the Flashstake Protocol by iterating -// over all registered strategies. -function getTVL(chainObject) { - - const chain = chainObject['chain']; - - return async (_, _b, { [chain]: block }) => { - let balances = {}; - - // Flashstake is a decentralised protocol which can result in anyone making a - // strategy and reporting fake numbers. The following API is provided by - // Flashstake DAO and serves as a master list of reviewed/approved strategies - const whitelistedStrategiesEndpoint = "https://api.flashstake.io/helper/whitelistedStrategies"; - let whitelistedStrategies = await get(whitelistedStrategiesEndpoint); - - block = await getBlock(_, chain, { [chain]: block }) - 50 - - // If null, skip - let endpoint = chainObject['endpoint']; - if(endpoint == null) { - return {}; - } - - // Retrieve all the supported strategies via subgraph - const graphQLClient = new GraphQLClient(endpoint) - const query = gql` - query Query($block: Int) { - strategies(first: 1000, block: {number: $block}) { - id - principalTokenAddress - } - } - `; - - // Retrieve and iterate over all strategies - const results = await graphQLClient.request(query, {"block": block}); - - for(let i = 0; i < results['strategies'].length; i++) { - const strategyContractAddress = results['strategies'][i]['id']; - const principalTokenAddress = results['strategies'][i]['principalTokenAddress']; - - // Ensure the strategy address is whitelisted - if(!(String(strategyContractAddress).toLowerCase() in whitelistedStrategies[chain])) { - log("Skipping non-whitelisted strategy", strategyContractAddress); - continue; - } - - // Retrieve the total amount staked by users - const totalPrincipalStaked = await sdk.api.abi.call({ - target: strategyContractAddress, - abi: abi['getPrincipalBalance'], - block: block, - chain: chain, - }); - - // Retrieve the total yield generated and currently locked in the contract - const totalYieldBalance = await sdk.api.abi.call({ - target: strategyContractAddress, - abi: abi['getYieldBalance'], - block: block, - chain: chain, - }); - - // Add these two together - // Add this to the final balances dict - // Note: There can be more than one strategy with the same principal token - const formattedAddress = chain + ":" + principalTokenAddress; - if (!(formattedAddress in balances)) { - balances[formattedAddress] = 0; - } - balances[formattedAddress] += Number(totalPrincipalStaked['output']) + (Number(totalYieldBalance['output'])); - } - - log("getTVL", chain, block, balances); - return balances; - } +async function getData() { + if(!configData) configData = getConfig('flashstake', 'https://api.flashstake.io/helper/whitelistedStrategies') + return configData } module.exports = { - misrepresentedTokens: false, - timetravel: true, + doublecounted: true, start: 1659312000, hallmarks: [ [1659312000, "Protocol Launch"], - [1666641600, "Optimism Deployment"] + [1666641600, "Optimism Launch"], + [1674604800, "Flash Capacitor Launch"], + [1676484000, "Flido Launch"], + [1680022800, "Arbitrum Launch"], + [1684443600, "Rocket Pool Launch"] ] }; -// Define all the chain related information -const chains = [ - { - "chain": "ethereum", - "endpoint": "https://api.thegraph.com/subgraphs/name/blockzerolabs/flashstake-subgraph", - "flashTokenAddress": "0xb1f1f47061a7be15c69f378cb3f69423bd58f2f8", - "flashBackStakingAddress": "0xb89494ab70001a2f25372b5e962046908188feea", - "flashBackLM": { - "principalTokenAddress": "0xb1c33de7a914f4d9ba293a055822cbc6e662a698", - "addresses": [ - "0xcb1205ac28693beda01e0b66e9b4d06231609bfd", - "0x57d551a18aae2c9de6977425f1df34dcd5db4977", - ] + +Object.keys(config).forEach(chain => { + // const { fromBlock, protocol, } = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const balances = {} + // const logs = await getLogs({ + // api, + // fromBlock, + // topics: ['0xc775f148b1505cf5c3c3158b3bd09e79026cae37c17f0851eff0cac3a39027fb'], + // target: protocol, + // eventAbi: 'event StrategyRegistered(address indexed strategy, address indexed principal, address indexed _fTokenAddress)', + // }) + const data = await getData() + const strategy = Object.keys(data[chain]) + const [ + principal, + bals, + bals2, + ] = await Promise.all([ + api.multiCall({ abi: 'address:getPrincipalAddress', calls: strategy}), + api.multiCall({ abi: 'uint256:getPrincipalBalance', calls: strategy}), + api.multiCall({ abi: 'uint256:getYieldBalance', calls: strategy}), + ]) + bals.forEach((bal, i) => sdk.util.sumSingleBalance(balances,principal[i],bal, api.chain)) + bals2.forEach((bal, i) => sdk.util.sumSingleBalance(balances,principal[i],bal, api.chain)) + return balances } - }, - { - "chain": "optimism", - "endpoint": "https://api.thegraph.com/subgraphs/name/blockzerolabs/flashstake-subgraph-optimism", - "flashTokenAddress": "0x86bea60374f220de9769b2fef2db725bc1cdd335", - "flashBackStakingAddress": null, - "flashBackLM": null } -]; -// Iterate over all the chains we are interested in -for(let i = 0; i < chains.length; i++) { - // Take the chain name - const chainName = chains[i]['chain']; + if (chain === 'ethereum') { + module.exports.ethereum.pool2 = staking([ + "0xcb1205ac28693beda01e0b66e9b4d06231609bfd", + "0x57d551a18aae2c9de6977425f1df34dcd5db4977", + ], '0xb1c33de7a914f4d9ba293a055822cbc6e662a698') + module.exports.ethereum.staking = staking("0xb89494ab70001a2f25372b5e962046908188feea", '0xb1f1f47061a7be15c69f378cb3f69423bd58f2f8') + } - // Retrieve chain related info and add to exports using - // chain name as key - module.exports[chainName] = { - tvl: getTVL(chains[i]), - pool2: getPool2(chains[i]), - staking: getStaking(chains[i]), + if (chain === 'arbitrum') { + module.exports.arbitrum.pool2 = staking([ + "0xee376e38198E42f7fABf03856039805a45292014", + "0x1426CAcb9accb1C6E763C9aFdBa81f69eA076DC4", + ], '0xBC57A6567A0655B1e2805961FC4F20e6a1ff55BD') } -} +}) diff --git a/projects/flatcoin/index.js b/projects/flatcoin/index.js new file mode 100644 index 00000000000..7955bcdcc18 --- /dev/null +++ b/projects/flatcoin/index.js @@ -0,0 +1,11 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require('../helper/unwrapLPs') + +const owner = 'TV8ndiKP98SF537BM9XvEbzkY2TerXNzEs' +const token = ADDRESSES.tron.USDT + +module.exports = { + tron: { + tvl: sumTokensExport({tokensAndOwners: [[token, owner]], }), + }, +} diff --git a/projects/float-capital/abi.json b/projects/float-capital/abi.json index d4375cb3f7f..b4f0aae209e 100644 --- a/projects/float-capital/abi.json +++ b/projects/float-capital/abi.json @@ -1,17 +1,3 @@ { - "exchangeRateStored": { - "constant": true, - "inputs": [], - "name": "exchangeRateStored", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } + "exchangeRateStored": "uint256:exchangeRateStored" } \ No newline at end of file diff --git a/projects/float-capital/index.js b/projects/float-capital/index.js index 8fbca25f0d7..35632c7c60a 100644 --- a/projects/float-capital/index.js +++ b/projects/float-capital/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens, unwrapCreamTokens } = require("../helper/unwrapLPs"); const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); @@ -18,12 +19,12 @@ const avaults = [ "0x47a21F14794b6229cc2a1ddfe4498C9e48f1C16c", ]; const avDAI = "0x47afa96cdc9fab46904a55a6ad4bf6660b53c38a"; -const DAI = "0xd586e7f844cea2f87f50152665bcbc2c279d8d70"; +const DAI = ADDRESSES.avax.DAI; const transforms = { "0x47afa96cdc9fab46904a55a6ad4bf6660b53c38a": - "0x6b175474e89094c44da98b954eedeac495271d0f", // avDAI - "0xd586e7f844cea2f87f50152665bcbc2c279d8d70": - "0x6b175474e89094c44da98b954eedeac495271d0f", // DAI + ADDRESSES.ethereum.DAI, // avDAI + [ADDRESSES.avax.DAI]: + ADDRESSES.ethereum.DAI, // DAI }; async function polyTvl(time, ethBlock, chainBlocks) { diff --git a/projects/float/abi.json b/projects/float/abi.json index 56c2c4ddea8..2db08afdb70 100644 --- a/projects/float/abi.json +++ b/projects/float/abi.json @@ -1,15 +1,3 @@ { - "stakeToken": { - "inputs": [], - "name": "stakeToken", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } -} + "stakeToken": "address:stakeToken" +} \ No newline at end of file diff --git a/projects/flokifi-locker/index.js b/projects/flokifi-locker/index.js new file mode 100644 index 00000000000..14f1b7407b4 --- /dev/null +++ b/projects/flokifi-locker/index.js @@ -0,0 +1,60 @@ +const { getConfig, getCache, setCache, } = require('../helper/cache'); +const { sumUnknownTokens, getLPList, } = require("../helper/cache/sumUnknownTokens"); +// const { unwrapUniswapV3NFTs } = require("../helper/unwrapLPs"); + +const project = 'flokifi-locker' + +const chains = { + 'ethereum': 1, + 'bsc': 56, + 'arbitrum': 42161, + 'optimism': 10, + 'polygon': 137, + 'fantom': 250, + 'avax': 43114, + 'okexchain': 66, + 'kcc': 321, + 'cronos': 25, + 'evmos': 9001, + 'dogechain': 2000 +} + +async function fetch(chainId) { + const response = await getConfig(`${project}/${chainId}`, 'https://api.flokifi.com/tokens/vault-pairs-tvl?chainId=' + chainId); + return response.tokensAndVaults; +} + +function splitPairs(pairs) { + let uniV3NFTHolders = []; + const tokensAndOwners = []; + for (let i = 0; i < pairs.length; i++) { + const pair = pairs[i]; + if (pair.isV3) uniV3NFTHolders.push(pair.vaultAddress.toLowerCase()) + else tokensAndOwners.push([pair.tokenAddress.toLowerCase(), pair.vaultAddress]); + } + uniV3NFTHolders = [...new Set(uniV3NFTHolders)]; // remove duplicates + return { tokensAndOwners, uniV3NFTHolders }; +} + +async function tvl(_, _b, _2, { api }) { + const chain = api.chain + const pairs = await fetch(chains[chain]); + let cache = getCache(project, chain) || {} + const { tokensAndOwners, uniV3NFTHolders } = splitPairs(pairs); + let lpList = await getLPList({ lps: tokensAndOwners.map(i => i[0]), ...api, cache, api, }) + // if (uniV3NFTHolders.length) + // await unwrapUniswapV3NFTs({ balances, owners: uniV3NFTHolders, chain, block }); + const balances = await sumUnknownTokens({ + tokensAndOwners: tokensAndOwners.filter(i => lpList.includes(i[0])), + api, useDefaultCoreAssets: true, + }); + await setCache(project, chain, cache) + + return balances; +} + +Object.keys(chains).forEach(chain => { + module.exports[chain] = { tvl } +}) + +module.exports.misrepresentedTokens = true \ No newline at end of file diff --git a/projects/floor-dao/api.js b/projects/floor-dao/api.js new file mode 100644 index 00000000000..606277d1561 --- /dev/null +++ b/projects/floor-dao/api.js @@ -0,0 +1,4 @@ +const index = require('./index') +const { ohmStaking } = require('../helper/treasury') + +module.exports = ohmStaking(index) \ No newline at end of file diff --git a/projects/floor-dao/index.js b/projects/floor-dao/index.js index f8ced6b7377..92baadf74a1 100644 --- a/projects/floor-dao/index.js +++ b/projects/floor-dao/index.js @@ -1,60 +1,44 @@ -const { ohmTvl } = require('../helper/ohm') +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokens2, sumTokensExport, } = require('../helper/unwrapLPs') const sdk = require("@defillama/sdk"); -const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); -const BigNumber = require('bignumber.js'); // https://docs.floor.xyz/fundamentals/treasury -// Tokens in treasury -const WETH = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2' -const PUNK = '0x269616d549d7e8eaa82dfb17028d0b212d11232a' -const xPUNK = '0x08765c76c758da951dc73d3a8863b34752dd76fb' -const PUNKWETH = '0x0463a06fbc8bf28b3f120cd1bfc59483f099d332' -const xPUNKWETH = '0xfb2f1c0e0086bcef24757c3b9bfe91585b1a280f' +const WETH = ADDRESSES.ethereum.WETH +const USDC = ADDRESSES.ethereum.USDC +const NFTX_LP_STAKING = '0x688c3e4658b5367da06fd629e41879beab538e37' const treasury = '0x91E453f442d25523F42063E1695390e325076ca2' -const stakingAddress = '0x759c6de5bca9ade8a1a2719a31553c4b7de02539' -const FLOOR = '0xf59257E961883636290411c11ec5Ae622d19455e' -const treasuryTokens = [ - [WETH, false], [PUNK, false], [xPUNK, false], // WETH, PUNK and xPUNK - [PUNKWETH, true], // PUNK-ETH SLP -] -module.exports = ohmTvl(treasury, treasuryTokens, 'ethereum', stakingAddress, FLOOR) -module.exports.methodology = 'Using ohmTvl for staking and treasury core TVL, and adding xPUNK and xPUNKWETH balances using 1:1 mapping with PUNK and PUNK-WETH sushi LP' +const floorTreasury2 = "0xa9d93a5cca9c98512c8c56547866b1db09090326"; +const stakingAddress = '0x759c6de5bca9ade8a1a2719a31553c4b7de02539' +const FLOOR = '0xf59257E961883636290411c11ec5Ae622d19455e' -const tvl = module.exports.ethereum.tvl -const transform = a => `ethereum:${a}` -module.exports.ethereum.tvl = async (time, ethBlock, chainBlocks) => { - // Get OHM default TVL balances - const balances = await tvl(time, ethBlock, chainBlocks) - - // Replace xPUNK by PUNK which is 1:1 - balances[transform(PUNK)] = BigNumber(balances[transform(PUNK)]).plus(BigNumber(balances[transform(xPUNK)])).toFixed(0) - balances[transform(xPUNK)] = 0 +module.exports.methodology = 'Using ohmTvl for staking and treasury core TVL, and adding xPUNK and xPUNKWETH balances using 1:1 mapping with PUNK and PUNK-WETH sushi LP' - // Unwrap xPUNKWETH which is 1:1 with PUNK-WETH Sushi LP - const {output: xPUNKWETH_bal} = await sdk.api.abi.call({ - target: xPUNKWETH, - params: [treasury], - abi: 'erc20:balanceOf', - ethBlock, - chain: 'ethereum' +module.exports = { + ethereum: { + tvl: async (_, block) => { + const vaults = [0, 24, 27, 298, 392,] + const stakingInfo = await sdk.api2.abi.multiCall({ + target: NFTX_LP_STAKING, + abi: abis.vaultStakingInfo, + calls: vaults.map(i => ({ params: i})), + block, + }) + const stakingBalances = await sdk.api2.abi.multiCall({ + target: NFTX_LP_STAKING, + abi: abis.balanceOf, + calls: vaults.map(i => ({ params: [i, treasury]})), + block, }) - const lpPositions = [{ - token: PUNKWETH, - balance: xPUNKWETH_bal, - }] - await unwrapUniswapLPs( balances, lpPositions, ethBlock, "ethereum", transform ); - return balances + const balances = {} + stakingBalances.forEach((bal,i) => sdk.util.sumSingleBalance(balances,stakingInfo[i][0],bal)) + return sumTokens2({ balances, block, owners: [treasury, floorTreasury2], tokens: [WETH, USDC], resolveLP: true, }) + }, + staking: sumTokensExport({owner: stakingAddress, tokens: [FLOOR]}) + } } - -/* -const dao_treasury = '0xA9d93A5cCa9c98512C8C56547866b1db09090326' -module.exports.ethereum.treasury = async (time, ethBlock, chainBlocks) => { - const balances = {} - await sumTokens(balances, [[FLOOR, dao_treasury]], ethBlock, "ethereum", transform) - // const univ3_Positions = [] - // await unwrapUniswapV3LPs(balances, univ3_Positions, ethBlock, 'ethereum', transform) - return balances -} -*/ \ No newline at end of file +const abis = { + vaultStakingInfo: "function vaultStakingInfo(uint256) view returns (address stakingToken, address rewardToken)", + balanceOf: "function balanceOf(uint256 vaultId, address addr) view returns (uint256)", +} \ No newline at end of file diff --git a/projects/florence-finance/index.js b/projects/florence-finance/index.js new file mode 100644 index 00000000000..87bfbd4f88d --- /dev/null +++ b/projects/florence-finance/index.js @@ -0,0 +1,21 @@ + +const FACTORY_CONTRACT_ETH = "0xD6348E8EacE62Eb3Eb77fBbA8D8c363e375fC455"; +const EURS_CONTRACT_ETH= "0xdb25f211ab05b1c97d595516f45794528a807ad8"; + +async function borrowed(_, _1, _2, { api }) { + // Get all vaults + const vaultIds = await api.call({ + abi: "function getLoanVaultIds() external view returns (string[])", + target: FACTORY_CONTRACT_ETH + }) + const vaultContracts = await api.multiCall({ abi: "function getLoanVault (string loanVaultId) external view returns (address)", target: FACTORY_CONTRACT_ETH, calls: vaultIds }) + const loans = await api.multiCall({ abi: "function loansOutstanding() external view returns (uint256)", calls: vaultContracts}) + // Take the sum of all vault tokens in terms of EURS (1 Loan Vault Token = 1 EURS Statis) on the platform | 18-2 = 16 atomic units (LV-EURS + loans.forEach((val, i) => api.add(EURS_CONTRACT_ETH, val / 1e16)) +} + +module.exports = { + start: 16077400, + methodology: "Data is retrieved on-chain by taking the total sum of all loans outstanding (dominated in EURS Statis) from all platform vaults.", + ethereum: { borrowed, tvl: () => ({}) } +} diff --git a/projects/flowx-finance/index.js b/projects/flowx-finance/index.js new file mode 100644 index 00000000000..03c6d8d5abf --- /dev/null +++ b/projects/flowx-finance/index.js @@ -0,0 +1,28 @@ +const sui = require("../helper/chain/sui"); + +async function suiTVL() { + const { api } = arguments[3]; + + const poolInfo = ( + await sui.getDynamicFieldObjects({ + parent: + "0xd15e209f5a250d6055c264975fee57ec09bf9d6acdda3b5f866f76023d1563e6", + }) + ).map((i) => i.fields.value.fields); + poolInfo.forEach(({ reserve_x, reserve_y }) => { + api.add( + reserve_x.type.replace(">", "").split("<")[1], + reserve_x.fields.balance + ); + api.add( + reserve_y.type.replace(">", "").split("<")[1], + reserve_y.fields.balance + ); + }); +} + +module.exports = { + sui: { + tvl: suiTVL, + }, +}; diff --git a/projects/fluidity-money/index.js b/projects/fluidity-money/index.js new file mode 100644 index 00000000000..bc6b358e3cd --- /dev/null +++ b/projects/fluidity-money/index.js @@ -0,0 +1,26 @@ +const { sumTokens2 } = require("../helper/unwrapLPs"); +const ATOKENS_ETHEREUM = ['0x028171bCA77440897B824Ca71D1c56caC55b68A3', '0x101cc05f4A51C0319f570d5E146a8C625198e636', '0xd4937682df3C8aEF4FE912A96A74121C0829E664']; +const APOOL_ETHEREUM = ['0xFC66c25dbDb0606e7F9cA1d2754Eb0A0f8306dA9', '0x5E88f6dc0aa126FA28A137B24d0B4d7231352a0B', '0xB7a2930e66D84Da74CdcFE4f97FaE9fC8f1114e8']; +const ATOKENS_ARBITRUM = ['0x6ab707Aca953eDAeFBc4fD23bA73294241490620', '0x625E7708f30cA75bfd92586e17077590C60eb4cD', '0x82E64f49Ed5EC1bC6e43DAD4FC8Af9bb3A2312EE', '0x724dc807b04555b71ed48a6896b6f41593b8c637']; +const APOOL_ARBITRUM = ['0xad7e2165FEa1d29030dF806cE4d530fa7a44511B', '0x23E7f09Fae0933db01420173726d18Dae809022C', '0xB7D37C5b15CDF29265C20668c20cD78586c423A8', '0x91beB5C41dF001175b588C9510327D53f278972A']; +const COMPOUND_ETHEREUM = [ + ['0xf650C3d88D12dB855b8bf7D11Be6C55A4e07dCC9', '0x372025203D25589eC3aDAd82652De78eC76fFabC'], + ['0x39AA39c021dfbaE8faC545936693aC917d5E7563', '0xE87Adc9D382Eee54C1eDE017D6E5C1324D59F457'], +]; +async function tvl_eth(timestamp, block, chainBlocks, { api }) { + await sumTokens2({ api, tokensAndOwners: COMPOUND_ETHEREUM }) + await sumTokens2({ api, tokensAndOwners2: [ATOKENS_ETHEREUM, APOOL_ETHEREUM] }) +} + +async function tvl_arb(timestamp, block, chainBlocks, { api }) { + await sumTokens2({ api, tokensAndOwners2: [ATOKENS_ARBITRUM, APOOL_ARBITRUM] }) +} + +module.exports = { + ethereum: { + tvl: tvl_eth, + }, + arbitrum: { + tvl: tvl_arb, + } +}; // node test.js projects/fluidity-money/index.js \ No newline at end of file diff --git a/projects/fluidtokens/index.js b/projects/fluidtokens/index.js index 9f2ffdc62ea..7ac1e750fae 100644 --- a/projects/fluidtokens/index.js +++ b/projects/fluidtokens/index.js @@ -1,10 +1,15 @@ -const { getAddressesUTXOs, getTxsMetadata, getTxsRedeemers } = require("../helper/chain/cardano/blockfrost"); -const { PromisePool } = require('@supercharge/promise-pool') +const { + getAddressesUTXOs, + getTxsMetadata, + getTxsRedeemers, +} = require("../helper/chain/cardano/blockfrost"); +const { PromisePool } = require("@supercharge/promise-pool"); +const { get } = require("../helper/http"); const smartContractAddress = "addr1wxzqzlncct5g0686c07lyuq3q3j2a0t8l88uwdznw99k9asz6z0hq"; -const tvl = async () => { +const tvl_onchain = async () => { let utxos = await getAddressesUTXOs(smartContractAddress); let utxosWithRedeemer = []; // Only the UTXO with redeemer have actually been taken and are and active loan @@ -12,24 +17,22 @@ const tvl = async () => { const { errors } = await PromisePool.withConcurrency(10) .for(utxos) .process(async (utxo) => { - const redeemer = await getTxsRedeemers(utxo.tx_hash) - if (redeemer.length > 0) utxosWithRedeemer.push(utxo) - }) + const redeemer = await getTxsRedeemers(utxo.tx_hash); + if (redeemer.length > 0) utxosWithRedeemer.push(utxo); + }); - if (errors && errors.length) - throw errors[0] + if (errors && errors.length) throw errors[0]; let loanDetails = []; const { errors: errors1 } = await PromisePool.withConcurrency(10) .for(utxosWithRedeemer) .process(async (utxo) => { - const details = await getTxsMetadata(utxo.tx_hash) - loanDetails.push(details[0].json_metadata) - }) + const details = await getTxsMetadata(utxo.tx_hash); + loanDetails.push(details[0].json_metadata); + }); - if (errors1 && errors1.length) - throw errors1[0] + if (errors1 && errors1.length) throw errors1[0]; const TVL = loanDetails.reduce((x, y) => { return x + parseInt(y.AMOUNT); @@ -39,11 +42,80 @@ const tvl = async () => { }; }; +async function tvl() { + const dataOffers = await get("https://api.fluidtokens.com/get-available-collection-offers"); + let SC_offers_tvl = 0; + + dataOffers.forEach((i) => { + SC_offers_tvl += parseInt(i.offerData.loanAmnt); + }); + + const repay_tvl = parseInt(await get("https://api.fluidtokens.com/get-total-available-repayments")); + + const pools_tvl= parseInt(await get("https://api.fluidtokens.com/get-total-available-pools")); + return { + cardano: (SC_offers_tvl+repay_tvl+pools_tvl) / 1e6, + }; +} + + +async function borrowed( + ts //timestamp in seconds +) { + const data = await get("https://api.fluidtokens.com/get-active-loans"); + let SC1_tvl = 0; + let SC2_tvl = 0; + + const timeNow = ts * 1e3; + data + .filter((i) => { + //select SC1 active inputs + return i.SCversion == 1 && i.timeToEndLoan >= timeNow; + }) + .forEach((i) => { + SC1_tvl += +i.loanData.AMOUNT; + }); + data + .filter((i) => { + //select SC2 inputs + return i.SCversion == 2; + }) + .filter((x) => { + return ( + //filter by active loans + x.activeLoanData.lendDate + + x.loanRequestData.loanDuration * + 3.6 * + 1e6 /* hours in milliseconds */ >= + timeNow + ); + }) + .forEach((x) => { + SC2_tvl += parseInt(x.loanRequestData.loanAmnt); + }); + + const dataOffers = await get("https://api.fluidtokens.com/get-available-collection-offers"); + let SC_offers_tvl = 0; + + dataOffers.forEach((i) => { + SC_offers_tvl += parseInt(i.offerData.loanAmnt); + }); + + return { + cardano: (SC1_tvl + SC2_tvl) / 1e6, + }; +} module.exports = { + methodology: "Count active loaned out ADA as tvl", timetravel: false, cardano: { tvl, + borrowed, }, + hallmarks: [ + [Math.floor(new Date("2023-01-01") / 1e3), "Count only active loans"], + [Math.floor(new Date("2023-06-27") / 1e3), "ADA loaned out is counted under borrowed"], + ], }; diff --git a/projects/fluity/getEntireSystemColl.abi.json b/projects/fluity/getEntireSystemColl.abi.json deleted file mode 100644 index 15a2c6c04b3..00000000000 --- a/projects/fluity/getEntireSystemColl.abi.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "inputs": [], - "name": "getEntireSystemColl", - "outputs": [ - { - "internalType": "uint256", - "name": "entireSystemColl", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" -} \ No newline at end of file diff --git a/projects/fluity/index.js b/projects/fluity/index.js index 6c1e352b766..97621c18829 100644 --- a/projects/fluity/index.js +++ b/projects/fluity/index.js @@ -1,24 +1,10 @@ -const sdk = require("@defillama/sdk"); -const getEntireSystemCollAbi = require("./getEntireSystemColl.abi.json") +const ADDRESSES = require('../helper/coreAssets.json') const { getLiquityTvl } = require("../helper/liquity"); -const BNB_ADDRESS = '0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c'; +const BNB_ADDRESS = ADDRESSES.bsc.WBNB; // TroveManager has a record of total system collateral const TROVE_MANAGER_ADDRESS = "0xe041c4099C0d6dcfC52C56A556EE4289D2E4b7C5"; -/* -async function tvl(_, block, chainBlocks) { - const balance = ( - await sdk.api.abi.call({ - target: TROVE_MANAGER_ADDRESS, - abi: getEntireSystemCollAbi, - block: chainBlocks['bsc'], - chain: 'bsc' - }) - ).output; - return { [BNB_ADDRESS]: balance }; -} -*/ module.exports = { bsc: { tvl: getLiquityTvl(BNB_ADDRESS,TROVE_MANAGER_ADDRESS,"bsc") diff --git a/projects/flux-exchange/index.js b/projects/flux-exchange/index.js new file mode 100644 index 00000000000..25fe65e5617 --- /dev/null +++ b/projects/flux-exchange/index.js @@ -0,0 +1,23 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { staking } = require("../helper/staking"); +const { gmxExports } = require("../helper/gmx"); + +const FTMVault = "0xc050733A325eEe50E544AcCbD38F6DACEd60ea6D"; +const FTMStaking = "0x136F1bD4Bb930cD931Ed30310142c2f03a946AC0"; +const WFTM = ADDRESSES.fantom.WFTM; + +// ZKSYNC +const zkSyncVault = "0x09Aa1138dfdfF855Df18DDAf08e92186D213700e"; +const zkSyncStaking = "0xFae2784FaE4D47316B487Bc0087a7C78D4809753"; +const WETH = ADDRESSES.era.WETH; + +module.exports = { + fantom: { + staking: staking(FTMStaking, WFTM), + tvl: gmxExports({ vault: FTMVault }) + }, + era: { + staking: staking(zkSyncStaking, WETH), + tvl: gmxExports({ vault: zkSyncVault }) + } +}; \ No newline at end of file diff --git a/projects/flux/index.js b/projects/flux/index.js index 54bd53dbd19..742dba09dc0 100644 --- a/projects/flux/index.js +++ b/projects/flux/index.js @@ -6,35 +6,12 @@ const config = { okexchain: { reportContract: '0xfE8d959e0bE8B4e1D53382C691575344abD43F46' }, polygon: { reportContract: '0x6233CbDf22dAC3f9aa74f7aCb88E9F286782f46B' }, // heco: { reportContract: '0x9CA69bb48ef2f4DA6a9351BeB50984DB263BF839' }, - conflux: { reportContract: 'cfx:acdbw8nv9bf8x5sdzje4rhffsrxxknmxhjxcnnf7m8' }, arbitrum: { reportContract: '0x6233CbDf22dAC3f9aa74f7aCb88E9F286782f46B' }, ethereum: { reportContract: '0x02DC57283fB5ebB5442839010013F5771F16078D' }, conflux: { reportContract: '0x6233CbDf22dAC3f9aa74f7aCb88E9F286782f46B' } } -const getFluxTVLDetail = { - "inputs": [], - "name": "getFluxTVLDetail", - "outputs": [ - { - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalBorrow", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalStaked", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" -} +const getFluxTVLDetail = 'function getFluxTVLDetail() view returns (uint256 totalSupply, uint256 totalBorrow, uint256 totalStaked)' module.exports = { misrepresentedTokens: true, diff --git a/projects/fluxbeam-xyz/index.js b/projects/fluxbeam-xyz/index.js new file mode 100644 index 00000000000..9270f3b8d92 --- /dev/null +++ b/projects/fluxbeam-xyz/index.js @@ -0,0 +1,24 @@ +const { getConnection, decodeAccount, sumTokens2 } = require('../helper/solana') +const sdk = require('@defillama/sdk') +const { PublicKey } = require("@solana/web3.js") + +async function tvl(_, _1, _2, { api }) { + const connection = getConnection() + + const programPublicKey = new PublicKey('FLUXubRmkEi2q6K3Y9kBPg9248ggaZVsoSFhtJHSrm1X') + const programAccounts = await connection.getProgramAccounts(programPublicKey, { + filters: [{ dataSize: 324 } ] + }); + sdk.log('#pools', programAccounts.length) + + const tokenAccounts = programAccounts.map((account) => { + const i = decodeAccount('fluxbeam', account.account) + return [i.tokenAccountA, i.tokenAccountB] + }).flat().map(i => i.toString()) + return sumTokens2({ tokenAccounts }) +} + +module.exports = { + timetravel: false, + solana: { tvl, }, +} diff --git a/projects/fluxfinance/index.js b/projects/fluxfinance/index.js new file mode 100644 index 00000000000..d8c8cfbc06b --- /dev/null +++ b/projects/fluxfinance/index.js @@ -0,0 +1,9 @@ +const { lendingMarket } = require("../helper/methodologies"); +const { compoundExports, } = require("../helper/compound"); + +const comptroller = "0x95Af143a021DF745bc78e845b54591C53a8B3A51"; + +module.exports = { + methodology: `${lendingMarket}. TVL is calculated by getting the market addresses from comptroller and calling the getCash() on-chain method to get the amount of tokens locked in each of these addresses, then we get the price of each token from coingecko.`, + ethereum: compoundExports(comptroller, "ethereum"), +}; diff --git a/projects/fndzdao/index.js b/projects/fndzdao/index.js index afbc0d23935..3fde7a46341 100644 --- a/projects/fndzdao/index.js +++ b/projects/fndzdao/index.js @@ -1,12 +1,13 @@ const { sumTokens2 } = require('../helper/unwrapLPs') const { staking } = require('../helper/staking') const { get } = require('../helper/http') +const { getConfig } = require('../helper/cache') const sdk = require('@defillama/sdk') const chain = 'bsc' -const getTrackedAssetsAbi = {"inputs":[],"name":"getTrackedAssets","outputs":[{"internalType":"address[]","name":"trackedAssets_","type":"address[]"}],"stateMutability":"view","type":"function"} +const getTrackedAssetsAbi = "address[]:getTrackedAssets" async function tvl(_, _b, {[chain]: block }) { - const res = await get('https://api.fndz.io/tvl') + const res = await getConfig('fndzdao', 'https://api.fndz.io/tvl') const vaults = res.result.chains[0].vault_addresses; const { output: tokens } = await sdk.api.abi.multiCall({ abi: getTrackedAssetsAbi, diff --git a/projects/fodl/abi.json b/projects/fodl/abi.json index 83c28fb9f42..b4c99b67af8 100644 --- a/projects/fodl/abi.json +++ b/projects/fodl/abi.json @@ -1,87 +1,4 @@ { - "getPositionsMetadata":{ - "inputs": [ - { - "internalType": "address[]", - "name": "positions", - "type": "address[]" - } - ], - "name": "getPositionsMetadata", - "outputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "supplyAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "borrowAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "collateralUsageFactor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "principalValue", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "positionValue", - "type": "uint256" - }, - { - "internalType": "address", - "name": "positionAddress", - "type": "address" - }, - { - "internalType": "address", - "name": "platformAddress", - "type": "address" - }, - { - "internalType": "address", - "name": "supplyTokenAddress", - "type": "address" - }, - { - "internalType": "address", - "name": "borrowTokenAddress", - "type": "address" - } - ], - "internalType": "struct SimplePositionMetadata[]", - "name": "assetsData", - "type": "tuple[]" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - "tokenByIndex":{ - "inputs":[ - { - "internalType":"uint256", - "name":"", - "type":"uint256" - } - ], - "name":"tokenByIndex", - "outputs":[ - { - "internalType":"address", - "name":"", - "type":"address" - } - ], - "stateMutability":"view", - "type":"function" - } - } \ No newline at end of file + "getPositionsMetadata": "function getPositionsMetadata(address[] positions) returns (tuple(uint256 supplyAmount, uint256 borrowAmount, uint256 collateralUsageFactor, uint256 principalValue, uint256 positionValue, address positionAddress, address platformAddress, address supplyTokenAddress, address borrowTokenAddress)[] assetsData)", + "tokenByIndex": "function tokenByIndex(uint256) view returns (address)" +} \ No newline at end of file diff --git a/projects/folks-finance/index.js b/projects/folks-finance/index.js index 5078bb0252e..484e2de9687 100644 --- a/projects/folks-finance/index.js +++ b/projects/folks-finance/index.js @@ -1,78 +1,20 @@ const { toUSDTBalances } = require("../helper/balances"); -const { getAppGlobalState } = require("../helper/chain/algorand"); - -const { pools,} = require("./constants"); -const { getPrices } = require("./prices"); - -let pricesCache, borrowedCache - -async function getCachedPrices() { - if (!pricesCache) pricesCache = getPrices() - return pricesCache -} - -async function getTotalPoolDepositsUsd(prices) { - const promises = pools.map(async (pool) => { - const state = await getAppGlobalState(pool.appId); - const totalDeposits = state.total_deposits - const numericDeposits = isNaN(Number(totalDeposits)) - ? 0 - : Number(totalDeposits); - const depositAmountUsd = numericDeposits * prices[pool.assetId]; - - return depositAmountUsd; - }); - - const depositsAmountUsd = await Promise.all(promises); - const totalDepositsUsd = depositsAmountUsd.reduce((a, b) => a + b, 0); - - return totalDepositsUsd; -} +const { v1TvlUsd, v1BorrowedBalancesUsd } = require("./v1"); +const { v2BorrowedBalancesUsd, v2TvlUsd } = require("./v2"); /* Get total deposits */ async function tvl() { - const prices = await getCachedPrices(); + const v1Tvl = await v1TvlUsd(); + const v2Tvl = await v2TvlUsd(); - const [ - depositsAmountUsd, - borrowsAmountUsd, - ] = await Promise.all([ - getTotalPoolDepositsUsd(prices), - borrowed(), - ]); - - return toUSDTBalances( - depositsAmountUsd - borrowsAmountUsd - ); -} - -/* Get total borrows */ -async function borrowed() { - if (!borrowedCache) borrowedCache = _borrowed() - return borrowedCache - - async function _borrowed() { - const prices = await getCachedPrices(); - - const promises = pools.map(async (pool) => { - const state = await getAppGlobalState(pool.appId); - const borrowAmount = state.total_borrows - const numericBorrowAmount = isNaN(Number(borrowAmount)) - ? 0 - : Number(borrowAmount); - const borrowAmountUsd = numericBorrowAmount * prices[pool.assetId]; - - return borrowAmountUsd; - }); - - const borrowsAmountUsd = await Promise.all(promises); - const totalBorrowsUsd = borrowsAmountUsd.reduce((a, b) => a + b, 0); - return totalBorrowsUsd; - } + return toUSDTBalances(v1Tvl + v2Tvl); } async function borrowedBalances() { - return toUSDTBalances(await borrowed()); + const v1BorrowedBalances = await v1BorrowedBalancesUsd(); + const v2BorrowedBalances = await v2BorrowedBalancesUsd(); + + return toUSDTBalances(v1BorrowedBalances + v2BorrowedBalances); } module.exports = { diff --git a/projects/folks-finance/constants.js b/projects/folks-finance/v1/constants.js similarity index 98% rename from projects/folks-finance/constants.js rename to projects/folks-finance/v1/constants.js index 04c3fbe0acc..99b36d48df7 100644 --- a/projects/folks-finance/constants.js +++ b/projects/folks-finance/v1/constants.js @@ -123,7 +123,7 @@ const pools = [ }, ]; -const oracleAppId = 793269965; +const oracleAppId = 956833333; const oracleAdapterAppId = 751277258; const oracleDecimals = 14; const tinymanValidatorAppId = 552635992; diff --git a/projects/folks-finance/v1/index.js b/projects/folks-finance/v1/index.js new file mode 100644 index 00000000000..1556c8f164b --- /dev/null +++ b/projects/folks-finance/v1/index.js @@ -0,0 +1,71 @@ +const { getAppGlobalState } = require("../../helper/chain/algorand"); + +const { pools } = require("./constants"); +const { getPrices } = require("./prices"); + +let pricesCache, borrowedCache; + +async function getCachedPrices() { + if (!pricesCache) pricesCache = getPrices(); + return pricesCache; +} + +async function getTotalPoolDepositsUsd(prices) { + const promises = pools.map(async (pool) => { + const state = await getAppGlobalState(pool.appId); + const totalDeposits = state.total_deposits; + const numericDeposits = isNaN(Number(totalDeposits)) + ? 0 + : Number(totalDeposits); + const depositAmountUsd = numericDeposits * prices[pool.assetId]; + + return depositAmountUsd; + }); + + const depositsAmountUsd = await Promise.all(promises); + const totalDepositsUsd = depositsAmountUsd.reduce((a, b) => a + b, 0); + + return totalDepositsUsd; +} + +/* Get total deposits */ +async function tvl() { + const prices = await getCachedPrices(); + + const [depositsAmountUsd, borrowsAmountUsd] = await Promise.all([ + getTotalPoolDepositsUsd(prices), + borrowed(), + ]); + + return depositsAmountUsd - borrowsAmountUsd; +} + +/* Get total borrows */ +async function borrowed() { + if (!borrowedCache) borrowedCache = _borrowed(); + return borrowedCache; + + async function _borrowed() { + const prices = await getCachedPrices(); + + const promises = pools.map(async (pool) => { + const state = await getAppGlobalState(pool.appId); + const borrowAmount = state.total_borrows; + const numericBorrowAmount = isNaN(Number(borrowAmount)) + ? 0 + : Number(borrowAmount); + const borrowAmountUsd = numericBorrowAmount * prices[pool.assetId]; + + return borrowAmountUsd; + }); + + const borrowsAmountUsd = await Promise.all(promises); + const totalBorrowsUsd = borrowsAmountUsd.reduce((a, b) => a + b, 0); + return totalBorrowsUsd; + } +} + +module.exports = { + v1TvlUsd: tvl, + v1BorrowedBalancesUsd: borrowed, +}; diff --git a/projects/folks-finance/prices.js b/projects/folks-finance/v1/prices.js similarity index 96% rename from projects/folks-finance/prices.js rename to projects/folks-finance/v1/prices.js index 0b92c6276d7..5599ce32b40 100644 --- a/projects/folks-finance/prices.js +++ b/projects/folks-finance/v1/prices.js @@ -1,4 +1,7 @@ -const { lookupAccountByID, lookupApplications } = require("../helper/chain/algorand"); +const { + lookupAccountByID, + lookupApplications, +} = require("../../helper/chain/algorand"); const { oracleAppId, oracleAdapterAppId, @@ -13,7 +16,7 @@ const { parseOracleValue, parseOracleAdapterValue, calcLPPrice, -} = require("./utils"); +} = require("../utils"); async function getTinymanLPPrice(validatorAppId, poolAddress, p0, p1) { const res = await lookupAccountByID(poolAddress); diff --git a/projects/folks-finance/v2/constants.js b/projects/folks-finance/v2/constants.js new file mode 100644 index 00000000000..34f404a4d1e --- /dev/null +++ b/projects/folks-finance/v2/constants.js @@ -0,0 +1,61 @@ +const pools = [ + // ALGO + { + appId: 971368268, + assetId: 0, + }, + // gALGO + { + appId: 971370097, + assetId: 793124631, + }, + // USDC + { + appId: 971372237, + assetId: 31566704, + }, + // USDt + { + appId: 971372700, + assetId: 312769, + }, + // goBTC + { + appId: 971373361, + assetId: 386192725, + }, + // goETH + { + appId: 971373611, + assetId: 386195940, + }, + // Opul + { + appId: 1044267181, + assetId: 287867876, + }, + // Gard + { + appId: 1060585819, + assetId: 684649988, + }, + // WBTC + { + appId: 1067289273, + assetId: 1058926737, + }, + // WETH + { + appId: 1067289481, + assetId: 887406851, + }, +]; + +const oracleAppId = 1040271396; +const oracleDecimals = 14; + +module.exports = { + pools, + oracleAppId, + oracleDecimals, +}; diff --git a/projects/folks-finance/v2/index.js b/projects/folks-finance/v2/index.js new file mode 100644 index 00000000000..5524ebf84e5 --- /dev/null +++ b/projects/folks-finance/v2/index.js @@ -0,0 +1,78 @@ +const { getAppState, getParsedValueFromState } = require("../utils"); +const { pools } = require("./constants"); +const { getCachedPrices } = require("./prices"); + +function parseUint64s(base64Value) { + const value = Buffer.from(base64Value, "base64").toString("hex"); + + // uint64s are 8 bytes each + const uint64s = []; + for (let i = 0; i < value.length; i += 16) { + uint64s.push(BigInt("0x" + value.slice(i, i + 16))); + } + return uint64s; +} + +async function retrievePoolInfo({ poolAppId, poolAssetId }) { + const state = await getAppState(poolAppId); + + if (state === undefined) + return { + depositsUsd: 0, + borrowsUsd: 0, + }; + + const prices = await getCachedPrices(); + const price = prices[poolAssetId]; + if (price === undefined) return { depositsUsd: 0, borrowsUsd: 0 }; + + const varBor = parseUint64s(String(getParsedValueFromState(state, "v"))); + const stblBor = parseUint64s(String(getParsedValueFromState(state, "s"))); + const interest = parseUint64s(String(getParsedValueFromState(state, "i"))); + + const variableBorrowAmountUsd = Number(varBor[3]) * price; + const stableBorrowAmountUsd = Number(stblBor[8]) * price; + const borrowsAmountUsd = variableBorrowAmountUsd + stableBorrowAmountUsd; + const depositsAmountUsd = Number(interest[3]) * price; + + // combine + return { + depositsUsd: depositsAmountUsd, + borrowsUsd: borrowsAmountUsd, + }; +} + +async function getPoolsInfo() { + const promises = pools.map(async (pool) => + retrievePoolInfo({ poolAppId: pool.appId, poolAssetId: pool.assetId }) + ); + const poolsInfo = await Promise.all(promises); + + return poolsInfo.reduce( + (acc, poolInfo) => { + acc.totalDepositsUsd += poolInfo.depositsUsd; + acc.totalBorrowsUsd += poolInfo.borrowsUsd; + return acc; + }, + { totalDepositsUsd: 0, totalBorrowsUsd: 0 } + ); +} + +/* Get total deposits */ +async function tvl() { + const { totalDepositsUsd, totalBorrowsUsd } = await getPoolsInfo(); + + return totalDepositsUsd - totalBorrowsUsd; +} + +/* Get total borrows */ +async function borrows() { + const { totalBorrowsUsd } = await getPoolsInfo(); + + return totalBorrowsUsd; +} + +module.exports = { + v2TvlUsd: tvl, + v2BorrowedBalancesUsd: borrows, +}; diff --git a/projects/folks-finance/v2/prices.js b/projects/folks-finance/v2/prices.js new file mode 100644 index 00000000000..20766ca93fa --- /dev/null +++ b/projects/folks-finance/v2/prices.js @@ -0,0 +1,92 @@ +const { oracleAppId, oracleDecimals } = require("./constants"); +const { + getAppState, + getParsedValueFromState, + fromIntToBytes8Hex, + parseOracleValue, +} = require("../utils"); + +function decodeUint64(data, decodingMode = "safe") { + if ( + decodingMode !== "safe" && + decodingMode !== "mixed" && + decodingMode !== "bigint" + ) { + throw new Error(`Unknown decodingMode option: ${decodingMode}`); + } + + if (data.byteLength === 0 || data.byteLength > 8) { + throw new Error( + `Data has unacceptable length. Expected length is between 1 and 8, got ${data.byteLength}` + ); + } + + // insert 0s at the beginning if data is smaller than 8 bytes + const padding = Buffer.allocUnsafe(8 - data.byteLength); + padding.fill(0); + + const buf = Buffer.concat([padding, Buffer.from(data)]); + + const num = buf.readBigUInt64BE(); + const isBig = num > Number.MAX_SAFE_INTEGER; + + if (decodingMode === "safe") { + if (isBig) { + throw new Error( + `Integer exceeds maximum safe integer: ${num.toString()}. Try decoding with "mixed" or "safe" decodingMode.` + ); + } + return Number(num); + } + + if (decodingMode === "mixed" && !isBig) { + return Number(num); + } + + return num; +} + +let pricesCache; + +async function getCachedPrices() { + if (!pricesCache) pricesCache = getPrices(); + return pricesCache; +} + +/* Get prices from oracle */ +async function getPrices() { + const oracleState = await getAppState(oracleAppId); + + const prices = {}; + + // get the assets for which we need to retrieve their prices + const assets = oracleState + .filter(({ key }) => { + // remove non asset ids global state + key = Buffer.from(key, "base64").toString("utf8"); + return ( + key !== "updater_addr" && + key !== "admin" && + key !== "tinyman_validator_app_id" + ); + }) + .map(({ key }) => { + // convert key to asset id + return decodeUint64(Buffer.from(key, "base64"), "safe"); + }); + + // retrieve asset prices + assets.forEach((assetId) => { + const assetPrice = parseOracleValue( + String( + getParsedValueFromState(oracleState, fromIntToBytes8Hex(assetId), "hex") + ) + ); + + prices[assetId] = Number(assetPrice) / 10 ** oracleDecimals; + }); + + return prices; +} + +module.exports = { getCachedPrices }; diff --git a/projects/folks-galgo/index.js b/projects/folks-galgo/index.js index 8b34e5b2758..56702c1ba14 100644 --- a/projects/folks-galgo/index.js +++ b/projects/folks-galgo/index.js @@ -6,7 +6,6 @@ const gAlgo3Assetd = 694432641 module.exports = { timetravel: false, - doublecounted: true, algorand: { tvl: async () => { const infos = await Promise.all([gAlgoAssetId, gAlgo3Assetd].map(getAssetInfo)) diff --git a/projects/folks-xalgo/index.js b/projects/folks-xalgo/index.js new file mode 100644 index 00000000000..b7822c40423 --- /dev/null +++ b/projects/folks-xalgo/index.js @@ -0,0 +1,14 @@ +const { getAssetInfo } = require("../helper/chain/algorand"); + +const xAlgoAssetId = 1134696561; + +module.exports = { + timetravel: false, + algorand: { + tvl: async () => { + const info = await getAssetInfo(xAlgoAssetId); + const total = info.circulatingSupply / 10 ** info.decimals; + return { algorand: total }; + }, + }, +}; diff --git a/projects/foodcourt/index.js b/projects/foodcourt/index.js index 2f967780ff2..ef20f699f04 100644 --- a/projects/foodcourt/index.js +++ b/projects/foodcourt/index.js @@ -6,14 +6,12 @@ module.exports = { misrepresentedTokens: true, bsc: { tvl: getUniTVL({ - chain: 'bsc', factory: '0xc801C7980c8C7900Bc898B1F38392b235fF64097', useDefaultCoreAssets: true, }), }, reichain: { tvl: getUniTVL({ - chain: 'reichain', factory: '0xC437190E5c4F85EbBdE74c86472900b323447603', useDefaultCoreAssets: true, }), diff --git a/projects/footballmanager/index.js b/projects/footballmanager/index.js new file mode 100644 index 00000000000..95baeb9c8f2 --- /dev/null +++ b/projects/footballmanager/index.js @@ -0,0 +1,15 @@ +const { masterchefExports, } = require("../helper/unknownTokens") + +module.exports = masterchefExports({ + chain: 'arbitrum', + masterchef: '0x7c9a900a82a252d833ebc222421d6e13dcc09269', + nativeToken: '0xBFCAd87Eb74E5855D72808aBa3d7DD2d790FFEfD', + useDefaultCoreAssets: true, + poolInfoABI: "function poolInfo(uint256) view returns (address lpToken, uint256, uint256, uint256)" +}) + +module.exports = { + arbitrum: { + tvl: () => 0 + } +} \ No newline at end of file diff --git a/projects/forcedao/abi.json b/projects/forcedao/abi.json deleted file mode 100644 index 5053eb3ad59..00000000000 --- a/projects/forcedao/abi.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "underlyingBalanceWithInvestment": { - "constant": true, - "inputs": [], - "name": "underlyingBalanceWithInvestment", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } -} \ No newline at end of file diff --git a/projects/forcedao/index.js b/projects/forcedao/index.js index 8b6c9c8ed7e..e69de29bb2d 100644 --- a/projects/forcedao/index.js +++ b/projects/forcedao/index.js @@ -1,65 +0,0 @@ -const sdk = require("@defillama/sdk"); -const { request, gql } = require("graphql-request"); -const abi = require('./abi.json') -const {unwrapCrv, unwrapUniswapLPs} = require('../helper/unwrapLPs') - -const graphUrl = 'https://api.thegraph.com/subgraphs/name/axejintao/delta-dao' -const graphQuery = gql` -query GET_VAULTS($block: Int) { - vaults( - block: { number: $block } - ) { - id - name - token { - id - } - } -} -`; - -async function tvl(timestamp, block) { - let balances = {}; - - const {vaults} = (await request( - graphUrl, - graphQuery, - { - block, - } - )) //.filter(vault=>!vault.name.startsWith('DELTA')) - - const lockedTokens = (await sdk.api.abi.multiCall({ - abi: abi['underlyingBalanceWithInvestment'], - calls: vaults.map(vault=>({ - target: vault.id - })), - block - })).output - const lpPositions = [] - await Promise.all(lockedTokens.map(async call=>{ - const vault = vaults.find(vault=>vault.id===call.input.target.toLowerCase()); - const underlyingTokenBalance = call.output - if(vault.name.endsWith('3Crv')){ - await unwrapCrv(balances, vault.token.id, underlyingTokenBalance, block) - } else if(vault.name.endsWith('SLP')){ - lpPositions.push({ - token: vault.token.id, - balance: underlyingTokenBalance - }) - } else { - sdk.util.sumSingleBalance(balances, vault.token.id, underlyingTokenBalance) - } - })) - await unwrapUniswapLPs(balances, lpPositions, block) - return balances -} - - -module.exports = { - start: 0, // WRONG! - ethereum: { - tvl, - }, - broken: 'Api is down and the project is winding down: https://forcedao.medium.com/winding-down-and-redistribution-8ed28220101b, ' -} \ No newline at end of file diff --git a/projects/forge-sx-dex/index.js b/projects/forge-sx-dex/index.js new file mode 100644 index 00000000000..f22a590975e --- /dev/null +++ b/projects/forge-sx-dex/index.js @@ -0,0 +1,7 @@ +const { getUniTVL } = require("../helper/unknownTokens"); + +module.exports = { + arbitrum: { + tvl: getUniTVL({ factory: '0x2f0a2b314eecc6ba33b3dd4f46816a2196c8af3a', useDefaultCoreAssets: true, }) + } +} \ No newline at end of file diff --git a/projects/forge/index.js b/projects/forge/index.js new file mode 100644 index 00000000000..87379df927c --- /dev/null +++ b/projects/forge/index.js @@ -0,0 +1,5 @@ +const { uniV3Export } = require('../helper/uniswapV3') + +module.exports = uniV3Export({ + evmos: { factory: '0xf544365e7065966f190155F629cE0182fC68Eaa2', fromBlock: 12367456, }, +}) \ No newline at end of file diff --git a/projects/forgesx/index.js b/projects/forgesx/index.js new file mode 100644 index 00000000000..952f6a7c8db --- /dev/null +++ b/projects/forgesx/index.js @@ -0,0 +1,12 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require('../helper/unwrapLPs') +const FORGE_SOL = '0x4938D2016e7446a24b07635611bD34289Df42ECb' +const USDC_TOKEN = ADDRESSES.arbitrum.USDC + +module.exports = { + methodology: 'counts the number of USDC tokens deposited as collateral in the Forge.sol contract.', + start: 1680643295, + arbitrum: { + tvl: sumTokensExport({ owner: FORGE_SOL, tokens: [USDC_TOKEN]}), + } +}; \ No newline at end of file diff --git a/projects/forta/index.js b/projects/forta/index.js new file mode 100644 index 00000000000..3974efb36f4 --- /dev/null +++ b/projects/forta/index.js @@ -0,0 +1,8 @@ +const { sumTokensExport } = require('../helper/unwrapLPs') + +module.exports = { + polygon: { + tvl: () => 0, + staking: sumTokensExport({ owner: '0xd2863157539b1d11f39ce23fc4834b62082f6874', tokens: ['0x9ff62d1fc52a907b6dcba8077c2ddca6e6a9d3e1'] }) + } +} \ No newline at end of file diff --git a/projects/forthewin/index.js b/projects/forthewin/index.js new file mode 100644 index 00000000000..ab3b1179839 --- /dev/null +++ b/projects/forthewin/index.js @@ -0,0 +1,20 @@ +const { get } = require("../helper/http"); + +async function tvl() { + const data = await get( + "https://api.forthewin.network/mainnet/tokens/liquidity/TOTAL/1" + ); + return { + tether: data.data[0] + }; +} + +module.exports = { + hallmarks: [], + methodology: `TVL is obtained by making calls to the Forthewin Network API.`, + misrepresentedTokens: true, + timetravel: false, + neo: { + tvl + } +}; diff --git a/projects/fortress-lending/index.js b/projects/fortress-lending/index.js index e3deefa9fe2..e6eb037d6f4 100644 --- a/projects/fortress-lending/index.js +++ b/projects/fortress-lending/index.js @@ -1,7 +1,8 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const { compoundExports } = require("../helper/compound"); -const {tvl:lendingTvl, borrowed} = compoundExports("0x67340bd16ee5649a37015138b3393eb5ad17c195", "bsc", "0xE24146585E882B6b59ca9bFaaaFfED201E4E5491", "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c") +const {tvl:lendingTvl, borrowed} = compoundExports("0x67340bd16ee5649a37015138b3393eb5ad17c195", "bsc", "0xE24146585E882B6b59ca9bFaaaFfED201E4E5491", ADDRESSES.bsc.WBNB) module.exports = { timetravel: true, diff --git a/projects/fortress/api.js b/projects/fortress/api.js new file mode 100644 index 00000000000..c96db138dea --- /dev/null +++ b/projects/fortress/api.js @@ -0,0 +1,9 @@ +const index = require('./index') + +module.exports = { + avax: { + tvl: () => 0, + staking: index.avax.staking, + } +} + diff --git a/projects/fortress/index.js b/projects/fortress/index.js index 2fa0f73c643..d398d87ac62 100644 --- a/projects/fortress/index.js +++ b/projects/fortress/index.js @@ -1,8 +1,9 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { ohmTvl } = require("../helper/ohm"); const treasuryAddress = "0xb8e8d2E97C5F4594F65CCe0f5888C641C7A3a056"; module.exports = ohmTvl(treasuryAddress, [ - ["0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7", false], + [ADDRESSES.avax.WAVAX, false], ["0x130966628846bfd36ff31a822705796e8cb8c18d", false], ["0x3e5f198b46f3de52761b02d4ac8ef4ceceac22d6", true], ["0x2a91134162e2da1394df9e5e64608109d73ed3a0", true], diff --git a/projects/fortube/abi.json b/projects/fortube/abi.json index a06b60e98e7..3f8abc76845 100644 --- a/projects/fortube/abi.json +++ b/projects/fortube/abi.json @@ -1,189 +1,10 @@ { - "getCollateralMarketsLength": { - "constant": true, - "inputs": [], - "name": "getCollateralMarketsLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "collateralTokens": { - "constant": true, - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "collateralTokens", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "mkts": { - "constant": true, - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "mkts", - "outputs": [ - { - "internalType": "uint256", - "name": "accrualBlockNumber", - "type": "uint256" - }, - { - "internalType": "int256", - "name": "supplyRate", - "type": "int256" - }, - { - "internalType": "int256", - "name": "demondRate", - "type": "int256" - }, - { - "internalType": "contract IInterestRateModel", - "name": "irm", - "type": "address" - }, - { - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "supplyIndex", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalBorrows", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "borrowIndex", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalReserves", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minPledgeRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "liquidationDiscount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "decimals", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "underlying": { - "constant": true, - "inputs": [], - "name": "underlying", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getAllMarkets": { - "constant": true, - "payable": false, - "inputs": [], - "name": "getAllMarkets", - "outputs": [ - { - "internalType": "contract IFToken[]", - "name": "", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - "APR": { - "constant": true, - "payable": false, - "inputs": [], - "name": "APR", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "APY": { - "constant": true, - "payable": false, - "inputs": [], - "name": "APY", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "totalBorrows": { - "constant": true, - "payable": false, - "inputs": [], - "name": "totalBorrows", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -} - + "getCollateralMarketsLength": "uint256:getCollateralMarketsLength", + "collateralTokens": "function collateralTokens(uint256) view returns (address)", + "mkts": "function mkts(address) view returns (uint256 accrualBlockNumber, int256 supplyRate, int256 demondRate, address irm, uint256 totalSupply, uint256 supplyIndex, uint256 totalBorrows, uint256 borrowIndex, uint256 totalReserves, uint256 minPledgeRate, uint256 liquidationDiscount, uint256 decimals)", + "underlying": "address:underlying", + "getAllMarkets": "address[]:getAllMarkets", + "APR": "uint256:APR", + "APY": "uint256:APY", + "totalBorrows": "uint256:totalBorrows" +} \ No newline at end of file diff --git a/projects/fortube/index.js b/projects/fortube/index.js index 8997a25358c..c148c435f9f 100644 --- a/projects/fortube/index.js +++ b/projects/fortube/index.js @@ -1,233 +1,46 @@ - const sdk = require("@defillama/sdk"); - - const abi = require("./abi.json"); - const BigNumber = require("bignumber.js"); - const axios = require("axios") - const {unwrapUniswapLPs} = require('../helper/unwrapLPs') - // const {getBlock} = require('../helper/getBlock') - const {toUSDTBalances} = require('../helper/balances') - - const ForTube = "0xE48BC2Ba0F2d2E140382d8B5C8f261a3d35Ed09C"; - const ForTubeV2 = "0x936E6490eD786FD0e0f0C1b1e4E1540b9D41F9eF"; - const EthAddress = "0x0000000000000000000000000000000000000000"; - const EthAddressV2 = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE"; - const V2BLOCK = 10808868; - - async function getCollateralMarketsLength(block) { - return ( - await sdk.api.abi.call({ - block, - target: ForTube, - params: [], - abi: abi["getCollateralMarketsLength"], +const abi = require("./abi.json"); +const { nullAddress, sumTokens2 } = require('../helper/unwrapLPs') + +const ForTube = "0xE48BC2Ba0F2d2E140382d8B5C8f261a3d35Ed09C"; +const ForTubeV2 = "0x936E6490eD786FD0e0f0C1b1e4E1540b9D41F9eF"; + +const config = { + ethereum: '0x936E6490eD786FD0e0f0C1b1e4E1540b9D41F9eF', + bsc: '0xc78248D676DeBB4597e88071D3d889eCA70E5469', + okexchain: '0x33d6D5F813BF78163901b1e72Fb1fEB90E72fD72', + iotex: '0xF8C5965BfBAE9c429F91BA357d930Ed78ffd4cF9', + polygon: '0x4Ac2735652944FE5C3dD95807287643502e5dE51', +} + +module.exports = { +}; + +Object.keys(config).forEach(chain => { + const owner = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const markets = await api.call({ + abi: abi.getAllMarkets, + target: owner, }) - ).output; - } - - // returns [addresses] - async function getErc20Assets(block) { - let erc20Assets = []; - let calls = []; - let length = await getCollateralMarketsLength(block); - for (var i = 0; i < length; i++) { - calls.push({ - target: ForTube, - params: i, - }); - } - let erc20AssetResults = await sdk.api.abi.multiCall({ - block, - calls: calls, - abi: abi["collateralTokens"], - }); - erc20AssetResults.output.forEach((result) => { - if (result.output != EthAddress) { - erc20Assets.push(result.output); - } - }); - - return erc20Assets; - } - - async function allUnderlyingMarkets(block) { - let fTokens = await getAllMarkets(block); - let erc20AssetsV2 = []; - let underlyings = await sdk.api.abi.multiCall({ - block, - calls: fTokens.map((fToken) => ({ - target: fToken, - params: [], - })), - abi: abi['underlying'] - }); - - underlyings.output.forEach((result) => { - if (result.output != EthAddressV2) { - erc20AssetsV2.push(result.output); + const erc20AssetsV2 = await api.multiCall({ + abi: abi.underlying, + calls: markets, + }) + const toa = erc20AssetsV2.map(i => ([i, owner])) + toa.push([nullAddress, owner]) + + if (chain === 'ethereum') { + const erc20Assets = await api.fetchList({ + itemAbi: abi.collateralTokens, + lengthAbi: abi.getCollateralMarketsLength, + target: ForTube, + }) + toa.push([nullAddress, ForTube]) + erc20Assets.forEach(i => toa.push([i, ForTubeV2])) } - }); - return erc20AssetsV2; - } - - async function getAllMarkets(block) { - return (await sdk.api.abi.call({ - block, - target: ForTubeV2, - abi: abi['getAllMarkets'], - })).output; - } - - async function eth(timestamp, block) { - let balances = {}; - let erc20Assets = await getErc20Assets(block); - - // Get erc20 assets locked - let balanceOfResults = await sdk.api.abi.multiCall({ - block, - calls: erc20Assets.map((asset) => ({ - target: asset, - params: ForTube, - })), - abi: "erc20:balanceOf", - }); - - //add ETH tvl - balances[EthAddress] = ( - await sdk.api.eth.getBalance({ target: ForTube, block }) - ).output; - - //10808868 is First Deposit Tx blockNumber in ForTube V2 - if (block > V2BLOCK) { - const ethBalance2 = (await sdk.api.eth.getBalance({ target: ForTubeV2, block })).output; - balances[EthAddress] = BigNumber(balances[EthAddress]).plus(ethBalance2).toFixed(); - - let erc20AssetsV2 = await allUnderlyingMarkets(block); - let balanceOfResultsV2 = await sdk.api.abi.multiCall({ - block, - calls: erc20AssetsV2.map((assetV2) => ({ - target: assetV2, - params: ForTubeV2, - })), - abi: "erc20:balanceOf", - }); - - sdk.util.sumMultiBalanceOf(balances, balanceOfResultsV2); + + return sumTokens2({ api, tokensAndOwners: toa }) } - - sdk.util.sumMultiBalanceOf(balances, balanceOfResults); - - return balances; - } - - async function unwrapVaultLP(balances, vaultAddress, amount, block){ - const underlyingToken = await sdk.api.abi.call({ - target: vaultAddress, - block, - chain: 'bsc', - abi: {"inputs":[],"name":"token","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"} - }) - await unwrapUniswapLPs(balances, [{ - token: underlyingToken.output, - balance: amount // Not really, but pricePerShare ~= 1 - }], block, 'bsc', addr=>`bsc:${addr}`) - } - - const fortubeCollateralBsc = "0xc78248D676DeBB4597e88071D3d889eCA70E5469" - const wbnb = "bsc:0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c" - async function bsc(_timestamp, _ethBlock, chainBlocks){ - const balances = {} - const markets = await axios.get("https://api.for.tube/api/v1/bank/public/chain/BSC-Inno/markets") - - const tokens = markets.data.data.map((val)=>val.token_address) - const tokenBalances = await sdk.api.abi.multiCall({ - abi: 'erc20:balanceOf', - chain: 'bsc', - block: chainBlocks['bsc'], - calls: tokens.map(token=>({ - target: token, - params: [fortubeCollateralBsc] - })) - }) - const unwrapCalls = [] - tokenBalances.output.map((call, idx)=>{ - const token = call.input.target - if(token === "0xbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"){ - return - } - const symbol = markets.data.data[idx].token_symbol - if(symbol.startsWith('v')){ - if(symbol === "v4Belt" || symbol === "v3EPS"){ - sdk.util.sumSingleBalance(balances, '0x4fabb145d64652a948d72533023f6e7a623c7c53', call.output) // BUSD - } else { - unwrapCalls.push(unwrapVaultLP(balances, token, call.output, chainBlocks['bsc'])) - } - }else { - sdk.util.sumSingleBalance(balances, 'bsc:'+token, call.output) - } - }) - await Promise.all(unwrapCalls) - // console.log('call') - const bnbCollateral = await sdk.api.eth.getBalance({ - target: fortubeCollateralBsc, - chain: 'bsc', - block: chainBlocks['bsc'] - }) - sdk.util.sumSingleBalance(balances, wbnb, bnbCollateral.output) - return balances - } - - /* - const okexPool = "0x33d6d5f813bf78163901b1e72fb1feb90e72fd72" - async function okexchain(timestamp, _ethBlock, chainBlocks){ - const markets = await axios.get("https://api.for.tube/api/v1/bank/public/chain/OEC-Inno/markets") - const tokenBalances = await sdk.api.abi.multiCall({ - abi: 'erc20:balanceOf', - chain: 'okexchain', - block: await getBlock(timestamp, 'okexchain', chainBlocks), - calls: markets.data.data.map(token=>({ - target: token.token_address, - params: [okexPool] - })) - }) - const balances = {} - sdk.util.sumMultiBalanceOf(balances, tokenBalances, d=>`okexchain:${d}`) - return balances - } - */ - async function okexchain(_timestamp, _ethBlock, chainBlocks){ - const markets = await axios.get("https://api.for.tube/api/v1/bank/public/chain/OEC-Inno/markets") - const usdCollateral = markets.data.data.reduce((acc, val)=> acc + val.token_price * val.global_token_reserved, 0) - return toUSDTBalances(usdCollateral) } - async function iotexchain(_timestamp, _ethBlock, chainBlocks){ - const markets = await axios.get("https://api.for.tube/api/v1/bank/public/chain/IoTeX-Inno/markets") - const usdCollateral = markets.data.data.reduce((acc, val)=> acc + val.token_price * val.global_token_reserved, 0) - return toUSDTBalances(usdCollateral) - } - async function polygonchain(_timestamp, _ethBlock, chainBlocks){ - const markets = await axios.get("https://api.for.tube/api/v1/bank/public/chain/Polygon-Inno/markets") - const usdCollateral = markets.data.data.reduce((acc, val)=> acc + val.token_price * val.global_token_reserved, 0) - return toUSDTBalances(usdCollateral) - } - - module.exports = { - methodology: "4belt and 3EPS are replaced by BUSD", - start: 1596384000, // 2020/8/3 00:00:00 +UTC - bsc: { - tvl: bsc - }, - ethereum: { - tvl: eth - }, - okexchain: { - tvl: okexchain - }, - iotex: { - tvl: iotexchain - }, - polygon: { - tvl: polygonchain - }, - - }; - +}) diff --git a/projects/fortunedao/api.js b/projects/fortunedao/api.js new file mode 100644 index 00000000000..3ff57ec34ea --- /dev/null +++ b/projects/fortunedao/api.js @@ -0,0 +1,8 @@ +const index = require('../fortunedao.js') + +module.exports = { + cronos: { + tvl: () => 0, + staking: index.cronos.staking, + } +} \ No newline at end of file diff --git a/projects/fpi/index.js b/projects/fpi/index.js new file mode 100644 index 00000000000..90a3ccf3c99 --- /dev/null +++ b/projects/fpi/index.js @@ -0,0 +1,22 @@ +const ADDRESSES = require('../helper/coreAssets.json') + +const frax = ADDRESSES.ethereum.FRAX +const fxs = "0x3432b6a60d23ca0dfca7761b7ab56459d9c964d0" + +async function tvl(_, _b, _cb, { api, erc20 }){ + const balances = {} + // owner 0x6a7efa964cf6d9ab3bc3c47ebddb853a8853c502 + const lpOwned = await api.call({ abi: "function totalBalanceOf(address) view returns (uint256)", target:"0x7287488f8df7dddc5f373142d4827aaf92aac845", params: ["0x921852ba77cbceaa29e986e45ef2207f6e664df2"] }) + const supply = await api.call({ abi: "function totalSupply() view returns (uint256)", target:"0xdb7cbbb1d5d5124f86e92001c9dfdc068c05801d" }) + const fraxInPool = await api.call({ abi: "function balanceOf(address) view returns (uint256)", params:["0xf861483fa7e511fbc37487d91b6faa803af5d37c"], target: frax }) + balances[frax] = lpOwned/supply * fraxInPool + balances[fxs] = await api.call({ abi: "function balanceOf(address) view returns (uint256)", params:["0x6a7efa964cf6d9ab3bc3c47ebddb853a8853c502"], target: fxs }) + + return balances +} + +module.exports={ + ethereum:{ + tvl + } +} \ No newline at end of file diff --git a/projects/fractal-protocol/index.js b/projects/fractal-protocol/index.js index 814161a625f..370f575696b 100644 --- a/projects/fractal-protocol/index.js +++ b/projects/fractal-protocol/index.js @@ -1,97 +1,158 @@ -const sdk = require('@defillama/sdk') -const { userInfo } = require('../pendle/abi.json') +const ADDRESSES = require('../helper/coreAssets.json') +const { userInfo } = require('../pendle/abi.json'); const { sumTokens2 } = require('../helper/unwrapLPs') -const FRACTAL_VAULT_CONTRACT = '0x3EAa4b3e8967c02cE1304C1EB35e8C5409838DFC'; -const YIELD_RESERVE = '0xbA83B569e99B6afc2f2BfE5124460Be6f36a4a56'; + +//Fractal Addresses ETH +const FRACTAL_VAULT_CONTRACT_ETH = '0x3EAa4b3e8967c02cE1304C1EB35e8C5409838DFC'; +const FRACTAL_YIELD_RESERVE_ETH = '0xbA83B569e99B6afc2f2BfE5124460Be6f36a4a56'; + +//Token Addresses ETH +const USDC_ETH = ADDRESSES.ethereum.USDC; + +//Fractal Addreses ARB +const FRACTAL_VAULT_CONTRACT_ARB = '0x80e1a981285181686a3951B05dEd454734892a09' +const FRACTAL_YIELD_RESERVE_ARB = '0x7d7068fB0398906C693DBFc425584FD5b58c4B60' +const FRACTAL_CHRONOS_POOL = '0x468B6e0f89fa727A47d9512021050797B4875D6d' +const FRACTAL_CAMELOT_POOL = '0xf011B036934b58A619D2822d90ecd726126Efdf2' +const FRACTAL_CAMELOT_NITRO_POOL = '0x5d209809d3284309cC34B9D092f88fFc690de6c2' + +//Token Addresses Arb +const USDC_ARB = ADDRESSES.arbitrum.USDC +const USDF_ARB = '0xae48b7C8e096896E32D53F10d0Bf89f82ec7b987' + +//Fractal Addresses All Chains +const FRACTAL_FIREBLOCKS_OWNER = '0x931250786dFd106B1E63C7Fd8f0d854876a45200' + +//Other Addresses +const CHRONOS_GAUGE = '0xDb1759d287d13b409fA80505b623e48cB9cc44Fc' + +//Loans ETH +const ETH_LOANS = [ + '0x60f5A25DfdaBc3BfB3702bCB0142213CEaF1e89a' +] + +//Loans AVAX +const AVAX_LOANS = [ + '0x9297c3B0Eb3DB1Cc72E99cF641CE418a2c3791D9', + '0x1952ae434FA8B5E9c9a1374951e5fd9ae7BD75C7', + '0x9C7629E3bAD32631F3977eF7710415158208E057', + '0x3f2ebE04329B96CBfF6E9911c64fC0c1Fc609d9C', + '0x337dBC3d0C948F8Ef516F6678C3D63d11300Dc10', + '0x595b16Aab6E43664Bf5F2DF0E34fEF1A8e7a2692' +] + +const abis = { + getTokenPrice: "uint256:getTokenPrice", + exchangeRateStored: "uint256:exchangeRateStored", + getVirtualPrice: "uint256:getVirtualPrice", + principalToken: "address:principalToken", + lockedLiquidityOf: "function lockedLiquidityOf(address account) view returns (uint256)", + getDebt: "function getDebt() view returns (uint256 interestDebtAmount, uint256 grossDebtAmount, uint256 principalDebtAmount, uint256 interestOwed, uint256 applicableLateFee, uint256 netDebtAmount, uint256 daysSinceFunding, uint256 currentBillingCycle, uint256 minPaymentAmount, uint256 maxPaymentAmount)", + userInfo: "function userInfo(address account) view returns (uint256 totalDepositAmount, uint256 rewardDebtToken1, uint256 rewardDebtToken2, uint256 pendingRewardsToken1, uint256 pendingRewardsToken2)" +} + +// Define the function +async function getLoanDebt(loans, api) { + const loanDebts = await api.multiCall({ abi: abis.getDebt, calls: loans }) + loanDebts.map((loanDebt) => api.add(USDC_ETH, loanDebt.principalDebtAmount, { skipChain: true })) + return api.getBalances() +} + +const getEthTvl = async (_, ethBlock, __, { api }) => { + return sumTokens2({ owners: [FRACTAL_YIELD_RESERVE_ETH, FRACTAL_VAULT_CONTRACT_ETH], tokens: [USDC_ETH,], api }) +}; + +const getEthLoans = async (_, ethBlock, __, { api }) => { + return getLoanDebt(ETH_LOANS, api) +} + +const getArbTvl = async (_, _b, { arbitrum: block }, { api }) => { + // const usdfPrice = await api.call({ target: FRACTAL_VAULT_CONTRACT_ARB, abi: abis.getTokenPrice, }) + + const [ + chronosLpBalance, usdcBalanceChronosPool, usdfBalanceChronosPool, usdcBalanceCamelotPool, usdfBalanceCamelotPool, + ] = await api.multiCall({ + abi: 'erc20:balanceOf', calls: [ + { target: CHRONOS_GAUGE, params: FRACTAL_FIREBLOCKS_OWNER }, + { target: USDC_ARB, params: FRACTAL_CHRONOS_POOL }, + { target: USDF_ARB, params: FRACTAL_CHRONOS_POOL }, + { target: USDC_ARB, params: FRACTAL_CAMELOT_POOL }, + { target: USDF_ARB, params: FRACTAL_CAMELOT_POOL }, + ] + }) + + const camelotUserInfo = await api.call({ + target: FRACTAL_CAMELOT_NITRO_POOL, + abi: abis.userInfo, + params: FRACTAL_FIREBLOCKS_OWNER, + }) + + const [ + chronosLpTokenSupply, camelotLpTokenSupply, + ] = await api.multiCall({ + abi: 'erc20:totalSupply', calls: [ + FRACTAL_CHRONOS_POOL, FRACTAL_CAMELOT_POOL, + ] + }) + + api.add(USDC_ARB, usdcBalanceChronosPool * chronosLpBalance / chronosLpTokenSupply) + api.add(USDC_ARB, usdcBalanceCamelotPool * camelotUserInfo.totalDepositAmount / camelotLpTokenSupply) + // api.add(USDF_ARB, usdfBalanceChronosPool * chronosLpBalance / chronosLpTokenSupply) + // api.add(USDF_ARB, usdfBalanceCamelotPool * camelotUserInfo.totalDepositAmount / camelotLpTokenSupply) + + return sumTokens2({ api, tokens: [USDC_ARB], owners: [FRACTAL_YIELD_RESERVE_ARB, FRACTAL_VAULT_CONTRACT_ARB] }) +}; + +const getAvaxTvl = async (_, _b, { avax: block }, { api }) => { + const strategy = '0x9fea225c7953869e68b8228d2c90422d905e5117' + const nUSDLP = '0xCA87BF3ec55372D9540437d7a86a7750B42C02f4' + const nUSDSwap = '0xed2a7edd7413021d440b09d654f3b87712abab66' + const synapseMiniChef = '0x3a01521f8e7f012eb37eaaf1cb9490a5d9e18249' + const { amount } = await api.call({ + target: synapseMiniChef, params: [1, strategy], + abi: userInfo, + }) + const price = await api.call({ + target: nUSDSwap, abi: abis.getVirtualPrice, + }) + const synapseBalance = amount * price / 1e36 + + return { tether: synapseBalance } +} + +const getAvaxLoans = async (_, _b, { avax: block }, { api }) => { + return getLoanDebt(AVAX_LOANS, api) +} + +const getPolygonTvl = async (_, _b, { polygon: block }, { api }) => { + const strategy = '0x894cB5e24DDdD9ececb27831647ae869541Af28F' + const nUSDLP = '0x7479e1bc2f2473f9e78c89b4210eb6d55d33b645' + const nUSDSwap = '0x85fcd7dd0a1e1a9fcd5fd886ed522de8221c3ee5' + const synapseMiniChef = '0x7875af1a6878bda1c129a4e2356a3fd040418be5' + const { amount } = await api.call({ + target: synapseMiniChef, params: [1, strategy], + abi: userInfo, + }) + const price = await api.call({ + target: nUSDSwap, abi: abis.getVirtualPrice, + }) + return { tether: amount * price / 1e36 } +} + module.exports = { - misrepresentedTokens: true, ethereum: { - tvl: async (_, block) => { - const convexStakingWrapper_tUSD = '0x00Ec5E23B203B8aE16d55C7F601d1c67e45D826c' - const franUnifiedFarm_tUSD = '0xb324b2bd8a3dc55b04111e84d5cce0c3771f8889' - const convexStakingWrapper_alUSD = '0x0def0fac24dead04e2f4b49b5fb50b10478e2fa6' - const franUnifiedFarm_alUSD = '0x711d650cd10df656c2c28d375649689f137005fa' - const { output: tUSDBal } = await sdk.api.abi.call({ - target: franUnifiedFarm_tUSD, params: convexStakingWrapper_tUSD, - abi: abis.lockedLiquidityOf, block, - }) - const { output: alUSDBal } = await sdk.api.abi.call({ - target: franUnifiedFarm_alUSD, params: convexStakingWrapper_alUSD, - abi: abis.lockedLiquidityOf, block, - }) - const { output: convexTUSD } = await sdk.api.erc20.balanceOf({ - target: '0x4a744870fd705971c8c00ac510eac2206c93d5bb', owner: '0xFD1D1339Dbc24496D70DBF7912c07aE2EF71bC2d', block, - }) - const balances = { - '0xB30dA2376F63De30b42dC055C93fa474F31330A5': alUSDBal, - '0x33baeDa08b8afACc4d3d07cf31d49FC1F1f3E893': tUSDBal, - '0x10BE382cfAB53e0aBD093D6801B5e95C6Aedb715': convexTUSD, - } - return sumTokens2({ balances, owners: [FRACTAL_VAULT_CONTRACT, YIELD_RESERVE,], tokens: ['0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48'], block, }) - }, - borrowed: async (_, block) => { - const loanContract = '0xf0e3020934450152308e4a84a3c4a5801fcb8d29' - const { output: token } = await sdk.api.abi.call({ block, target: loanContract, abi: abis.principalToken }) - const { output: debt } = await sdk.api.abi.call({ block, target: loanContract, abi: abis.getDebt }) - return { - [token]: debt.principalDebtAmount, - } - } + tvl: getEthTvl, + borrowed: getEthLoans + }, + arbitrum: { + tvl: getArbTvl }, avax: { - tvl: async (_, _b, { avax: block }) => { - const chain = 'avax' - const strategy = '0x9fea225c7953869e68b8228d2c90422d905e5117' - const nUSDLP = '0xCA87BF3ec55372D9540437d7a86a7750B42C02f4' - const nUSDSwap = '0xed2a7edd7413021d440b09d654f3b87712abab66' - const synapseMiniChef = '0x3a01521f8e7f012eb37eaaf1cb9490a5d9e18249' - const { output: { amount } } = await sdk.api.abi.call({ - target: synapseMiniChef, params: [1, strategy], - abi: userInfo, chain, block, - }) - const { output: price } = await sdk.api.abi.call({ - target: nUSDSwap, abi: abis.getVirtualPrice, chain, block, - }) - return { tether: amount * price / 1e36 } - } + tvl: getAvaxTvl, + borrowed: getAvaxLoans }, polygon: { - tvl: async (_, _b, { polygon: block }) => { - const chain = 'polygon' - const strategy = '0x894cB5e24DDdD9ececb27831647ae869541Af28F' - const nUSDLP = '0x7479e1bc2f2473f9e78c89b4210eb6d55d33b645' - const nUSDSwap = '0x85fcd7dd0a1e1a9fcd5fd886ed522de8221c3ee5' - const synapseMiniChef = '0x7875af1a6878bda1c129a4e2356a3fd040418be5' - const { output: { amount } } = await sdk.api.abi.call({ - target: synapseMiniChef, params: [1, strategy], - abi: userInfo, chain, block, - }) - const { output: price } = await sdk.api.abi.call({ - target: nUSDSwap, abi: abis.getVirtualPrice, chain, block, - }) - return { tether: amount * price / 1e36 } - } - }, - moonriver: { - tvl: async (_, _b, { moonriver: block }) => { - const chain = 'moonriver' - const muSDCToken = '0xd0670aee3698f66e2d4daf071eb9c690d978bfa8' - const { output: mUSDC } = await sdk.api.erc20.balanceOf({ target: muSDCToken, chain, block, owner: '0x3Bc4D91B0dEdC1e8E93B356a7572f51815fe843B' }) - const { output: exchangeRate } = await sdk.api.abi.call({ - target: muSDCToken, abi: abis.exchangeRateStored, chain, block, - }) - return { - tether: mUSDC/1e8 * exchangeRate/1e16 - } - } - }, -} - -const abis = { - exchangeRateStored: {"constant":true,"inputs":[],"name":"exchangeRateStored","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"}, - getVirtualPrice: {"inputs":[],"name":"getVirtualPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}, - principalToken: {"inputs":[],"name":"principalToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}, - lockedLiquidityOf: { "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], "name": "lockedLiquidityOf", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, - getDebt: {"inputs":[],"name":"getDebt","outputs":[{"internalType":"uint256","name":"interestDebtAmount","type":"uint256"},{"internalType":"uint256","name":"grossDebtAmount","type":"uint256"},{"internalType":"uint256","name":"principalDebtAmount","type":"uint256"},{"internalType":"uint256","name":"interestOwed","type":"uint256"},{"internalType":"uint256","name":"applicableLateFee","type":"uint256"},{"internalType":"uint256","name":"netDebtAmount","type":"uint256"},{"internalType":"uint256","name":"daysSinceFunding","type":"uint256"},{"internalType":"uint256","name":"currentBillingCycle","type":"uint256"},{"internalType":"uint256","name":"minPaymentAmount","type":"uint256"},{"internalType":"uint256","name":"maxPaymentAmount","type":"uint256"}],"stateMutability":"view","type":"function"}, -} + tvl: getPolygonTvl + } +}; diff --git a/projects/frakt/index.js b/projects/frakt/index.js index 557c2485d87..19e438ad8c1 100644 --- a/projects/frakt/index.js +++ b/projects/frakt/index.js @@ -1,6 +1,7 @@ -const { getProvider, getSolBalances, tokens, } = require('../helper/solana') +const ADDRESSES = require('../helper/coreAssets.json') +const { getProvider, getSolBalances, } = require('../helper/solana') const { Program, } = require("@project-serum/anchor"); -const { get, } = require('../helper/http') +const { getConfig } = require('../helper/cache') let data @@ -12,7 +13,7 @@ async function getData() { async function getAllData() { const programId = 'A66HabVL3DzNzeJgcHYtRRNW1ZRMKwBfrdSR4kLsZ9DJ' const provider = getProvider() - const idl = await get('https://raw.githubusercontent.com/frakt-solana/frakt-sdk/master/src/loans/idl/nft_lending_v2.json') + const idl = await getConfig('frakt-idl', 'https://raw.githubusercontent.com/frakt-solana/frakt-sdk/master/src/loans/idl/nft_lending_v2.json') const program = new Program(idl, programId, provider) const pbPools = await program.account.priceBasedLiquidityPool.all() const liquidityPools = await program.account.liquidityPool.all() @@ -31,11 +32,11 @@ async function getData() { } const tvl = async () => { - return { [tokens.solana]: (await getData()).tvl } + return { ['solana:' + ADDRESSES.solana.SOL]: (await getData()).tvl } }; const borrowed = async () => { - return { [tokens.solana]: (await getData()).borrowed } + return { ['solana:' + ADDRESSES.solana.SOL]: (await getData()).borrowed } } module.exports = { diff --git a/projects/frax-swap/index.js b/projects/frax-swap/index.js index 8d28e1b0c12..aaffa8e7ebe 100644 --- a/projects/frax-swap/index.js +++ b/projects/frax-swap/index.js @@ -1,23 +1,9 @@ const { getUniTVL } = require('../helper/unknownTokens') const sdk = require("@defillama/sdk") -const fx = (chain, factory1, factory2) => ({ +const fx = (chain, ...factories) => ({ [chain]: { - tvl: factory2 === undefined ? - getUniTVL({ - chain, - factory: factory1, - }) - : sdk.util.sumChainTvls([ - getUniTVL({ - chain, - factory: factory1, - }), - getUniTVL({ - chain, - factory: factory2, - }), - ]) + tvl: sdk.util.sumChainTvls(factories.map(factory => getUniTVL({ factory }))) }, }) @@ -28,13 +14,12 @@ https://facts.frax.finance/pools/0x247b71D57Ac80883364599ad5c9D74ea5EDc8660 (2k */ module.exports = { - misrepresentedTokens: true, ...fx("ethereum", "0xb076b06f669e682609fb4a8c6646d2619717be4b", "0x43ec799eadd63848443e2347c49f5f52e8fe0f6f"), - ...fx("arbitrum", "0x5Ca135cB8527d76e932f34B5145575F9d8cbE08E"), - ...fx("avax", "0x5Ca135cB8527d76e932f34B5145575F9d8cbE08E"), - ...fx("bsc", "0xa007a9716dba05289df85A90d0Fd9D39BEE808dE"), + ...fx("arbitrum", "0x5Ca135cB8527d76e932f34B5145575F9d8cbE08E", "0x8374A74A728f06bEa6B7259C68AA7BBB732bfeaD"), + ...fx("avax", "0x5Ca135cB8527d76e932f34B5145575F9d8cbE08E", "0xf77ca9B635898980fb219b4F4605C50e4ba58afF"), + ...fx("bsc", "0xa007a9716dba05289df85A90d0Fd9D39BEE808dE", "0xf89e6CA06121B6d4370f4B196Ae458e8b969A011"), ...fx("dogechain", "0x67b7DA7c0564c6aC080f0A6D9fB4675e52E6bF1d"), - ...fx("fantom", "0xF55C563148cA0c0F1626834ec1B8651844D76792"), - ...fx("moonbeam", "0x5Ca135cB8527d76e932f34B5145575F9d8cbE08E"), - ...fx("polygon", "0xc2544A32872A91F4A553b404C6950e89De901fdb"), -}; \ No newline at end of file + ...fx("fantom", "0xF55C563148cA0c0F1626834ec1B8651844D76792", "0xDc745E09fC459aDC295E2e7baACe881354dB7F64"), + ...fx("moonbeam", "0x5Ca135cB8527d76e932f34B5145575F9d8cbE08E", "0x51f9DBEd76f5Dcf209817f641b549aa82F35D23F"), + ...fx("polygon", "0xc2544A32872A91F4A553b404C6950e89De901fdb", "0x54F454D747e037Da288dB568D4121117EAb34e79"), +}; diff --git a/projects/fraxfinance/abi.json b/projects/fraxfinance/abi.json deleted file mode 100644 index dc63849c5a3..00000000000 --- a/projects/fraxfinance/abi.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "usdValueInVault": { - "inputs": [], - "name": "usdValueInVault", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "collatDollarBalance": { - "inputs": [], - "name": "collatDollarBalance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "borrowed_frax": { - "inputs": [], - "name": "borrowed_frax", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -} \ No newline at end of file diff --git a/projects/fraxfinance/index.js b/projects/fraxfinance/index.js index 1010a770d5e..0bc23dc4264 100644 --- a/projects/fraxfinance/index.js +++ b/projects/fraxfinance/index.js @@ -1,41 +1,15 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); -const abi = require("./abi.json"); -const BigNumber = require("bignumber.js"); -const { staking, stakings } = require("../helper/staking"); -const { sumTokens } = require("../helper/unwrapLPs"); +const { staking, } = require("../helper/staking"); +const { sumTokens2, nullAddress, } = require("../helper/unwrapLPs"); -const USDC = "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"; +const USDC = ADDRESSES.ethereum.USDC; const FXS = "0x3432b6a60d23ca0dfca7761b7ab56459d9c964d0"; - -const FEI3CRVs = [ - "0x70F55767B11c047C8397285E852919F5f6c8DC60", - "0xE4BD0461AE7fdc76c61CE286a80c9B55d83B204a", -]; - -const contractAddresses = [ - //FRAX3CRV - "0x49ee75278820f409ecd67063D8D717B38d66bd71", - //CURVE_AMO - "0x72170Cdc48C33a6AE6B3E83CD387ca3Fb9105da2", - //FRAX_AMO_MINTER - "0xcf37B62109b537fa0Cb9A90Af4CA72f6fb85E241", - //LENDING_AMO - "0x9507189f5B6D820cd93d970d67893006968825ef", - //MANUAL_AMO - "0x1Be588641Fb28Eb8C2A51f1129707FB1E2683f5a", - //USDC_POOL_V1 - "0x3C2982CA260e870eee70c423818010DfeF212659", - //USDC_POOL_V2 - "0x1864Ca3d47AaB98Ee78D11fc9DCC5E7bADdA1c0d", - //USDC_POOL_V3 - "0x2fE065e6FFEf9ac95ab39E5042744d695F560729", - //INVESTOR_COLLATERAL_POOL - "0xEE5825d5185a1D512706f9068E69146A54B6e076", - //INVESTOR_AMO_V2 - "0xB8315Af919729c823B2d996B1A6DDE381E7444f1", -]; +const FRAX_3CRV = '0xd632f22692fac7611d2aa1c0d552930d43caed3b' +const T_3CRV = '0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490' const veFXS_StakingContract = "0xc8418aF6358FFddA74e09Ca9CC3Fe03Ca6aDC5b0"; +const INVESTOR_AMO = '0xb1748c79709f4ba2dd82834b8c82d4a505003f27' const POOL_STAKING_CONTRACTS = [ "0xD875628B942f8970De3CcEaf6417005F68540d4f", @@ -54,116 +28,164 @@ const LP_ADDRESSES = [ "0xecBa967D84fCF0405F6b32Bc45F4d36BfDBB2E81", ]; -const treasuryContracts = [ - "0x63278bF9AcdFC9fA65CFa2940b89A34ADfbCb4A1", - "0x8D4392F55bC76A046E443eb3bab99887F4366BB0", - "0xa95f86fE0409030136D6b82491822B3D70F890b3", - "0x9AA7Db8E488eE3ffCC9CdFD4f2EaECC8ABeDCB48", - "0x874a873e4891fB760EdFDae0D26cA2c00922C404", -]; +async function get3CRVRatio(api) { + const [ + frax3crvSupply, + bal_3crv, + ] = await Promise.all([ + api.call({ abi: 'erc20:totalSupply', target: FRAX_3CRV, }), + api.call({ abi: 'erc20:balanceOf', target: T_3CRV, params: FRAX_3CRV, }), + ]) + return bal_3crv / frax3crvSupply +} -const ethereumTvl = async (timestamp, block) => { - let balances = {}; +async function addFrax3CRV(api, balances) { + const vault = '0x49ee75278820f409ecd67063D8D717B38d66bd71' + const [ + frax3crvBal, + ratio3CRV, + ] = await Promise.all([ + api.call({ abi: 'uint256:FRAX3CRVInVault', target: vault }), + get3CRVRatio(api), + ]) + sdk.util.sumSingleBalance(balances, T_3CRV, ratio3CRV * frax3crvBal, api.chain) +} - // --- CurveMetapoolLockerAMOs USDC TVL --- - const usdValueInVault = ( - await sdk.api.abi.multiCall({ - calls: FEI3CRVs.map((addr) => ({ target: addr })), - abi: abi.usdValueInVault, - block, - }) - ).output.map((value) => value.output); - - usdValueInVault.forEach((value) => { - sdk.util.sumSingleBalance( - balances, - USDC, - BigNumber(value) - .dividedBy(10 ** 12) - .toFixed(0) - ); - }); - - // --- USDC POOLs + AMOs + FRAX3CRV and FEI3CRVs --- - const usdcTvls = ( - await sdk.api.abi.multiCall({ - calls: contractAddresses.map((addr) => ({ target: addr })), - abi: abi.collatDollarBalance, - block, - }) - ).output.map((response) => response.output); - - usdcTvls.forEach((usdcTvl) => { - sdk.util.sumSingleBalance( - balances, - USDC, - BigNumber(usdcTvl) - .dividedBy(10 ** 12) - .toFixed(0) - ); - }); - - return balances; -}; +async function addyFrax3CRV(api, balances) { + const vault = '0x72170Cdc48C33a6AE6B3E83CD387ca3Fb9105da2' + const yFRAX3CRV = '0xB4AdA607B9d6b2c9Ee07A275e9616B84AC560139' + const [ + yfrax3crvBal, + pricePerShare, + ratio3CRV, + ] = await Promise.all([ + api.call({ abi: 'uint256:yvCurveFRAXBalance', target: vault }), + api.call({ abi: 'uint256:pricePerShare', target: yFRAX3CRV }), + get3CRVRatio(api), + ]) + sdk.util.sumSingleBalance(balances, T_3CRV, yfrax3crvBal * ratio3CRV * (pricePerShare / 1e18), api.chain) + return sumTokens2({ balances, api, owner: vault, tokens: [USDC] }) +} -// Fantom -const contractAddressesFantom = [ - //Spirit/Ola Lending AMO Fantom - "0x8dbc48743a05A6e615D9C39aEBf8C2b157aa31eA", - //Scream Lending AMO Fantom - "0x51E6D09d5A1EcF8BE035BBCa82F77BfeC3c7672A", - //SpiritSwap Liquidity AMO Fantom - "0x48F0856e0E2D06fBCed5FDA10DD69092a500646B", -]; +async function addCvxFRAX_BP(api, balances) { + const convexFRAXBP = '0x7e880867363A7e321f5d260Cade2B0Bb2F717B02' + const crvFRAX = '0x3175Df0976dFA876431C2E9eE6Bc45b65d3473CC' + const crvFRAXPool = '0xdcef968d416a41cdac0ed8702fac8128a64241a2' + const [ + cvxFraxBal, + usdcBal, + poolSupply, + ] = await Promise.all([ + + api.call({ abi: 'erc20:balanceOf', target: convexFRAXBP, params: INVESTOR_AMO }), + api.call({ abi: 'erc20:balanceOf', target: USDC, params: crvFRAXPool }), + api.call({ abi: 'erc20:totalSupply', target: crvFRAX }), + ]) + sdk.util.sumSingleBalance(balances, USDC, usdcBal * cvxFraxBal / poolSupply, api.chain) +} -const fantomTvl = async (timestamp, ethBlock, chainBlocks) => { - const balances = {}; - const chain = "fantom" - const block = chainBlocks[chain] - // --- AMO's --- - const usdcTvls = ( - await sdk.api.abi.multiCall({ - calls: contractAddressesFantom.map((addr) => ({ target: addr })), - abi: abi.borrowed_frax, - block, - chain, - }) - ).output.map((response) => response.output); - - usdcTvls.forEach((usdcTvl) => { - sdk.util.sumSingleBalance( - balances, - USDC, - BigNumber(usdcTvl) - .dividedBy(10 ** 12) // // Convert to 6 decimal USDC values - .toFixed(0) - ); - }); - - // --- Liquidity staking --- - - // Curve FRAX2Pool - await sumTokens(balances, [ - ["0x8866414733f22295b7563f9c5299715d2d76caf4", "0x7a656b342e14f745e2b164890e88017e27ae7320"], - ["0x04068da6c83afcfa0e13ba15a6696662335d5b75", "0xbea9f78090bdb9e662d8cb301a00ad09a5b756e9"] - ], block, chain, addr => addr === "0x8866414733f22295b7563f9c5299715d2d76caf4" ? "0x6b175474e89094c44da98b954eedeac495271d0f" : `${chain}:${addr}`) - - return balances; +async function addCvxFXSFRAX_BP(api, balances) { + const userAccount = '0x2AA609715488B09EFA93883759e8B089FBa11296' + const vault = '0x963f487796d54d2f27ba6f3fbe91154ca103b199' + const crvFRAX = '0x3175Df0976dFA876431C2E9eE6Bc45b65d3473CC' + const crvFRAXPool = '0xdcef968d416a41cdac0ed8702fac8128a64241a2' + const [ + cvxFraxBal, + usdcBal, + poolSupply, + ] = await Promise.all([ + api.call({ abi: 'function lockedLiquidityOf(address) view returns (uint256)', target: vault, params: userAccount }), + api.call({ abi: 'erc20:balanceOf', target: USDC, params: crvFRAXPool }), + api.call({ abi: 'erc20:totalSupply', target: crvFRAX }), + ]) + sdk.util.sumSingleBalance(balances, USDC, usdcBal * cvxFraxBal / poolSupply, api.chain) } + +async function addUSDCPools(api, balances) { + return sumTokens2({ + balances, api, owners: [ + '0x3C2982CA260e870eee70c423818010DfeF212659', + '0x1864Ca3d47AaB98Ee78D11fc9DCC5E7bADdA1c0d', + '0x2fE065e6FFEf9ac95ab39E5042744d695F560729', + ], tokens: [USDC] + }) +} + +async function addAMOMinter(api, balances) { + const amoMinter = '0xcf37B62109b537fa0Cb9A90Af4CA72f6fb85E241' + let allAMOAddresses = await api.call({ target: amoMinter, abi: 'address[]:allAMOAddresses' }) + const amos = allAMOAddresses.filter(i => i !== nullAddress) + const blacklist = new Set([ + '0x66635DC1EdEfF19e839f152a67278151Aa6e1B61', // aave AMO + INVESTOR_AMO, + ].map(i => i.toLowerCase())) + const dollBallAbi = 'function dollarBalances() view returns (uint256 frax_val_e18, uint256 collat_val_e18)' + const res = await api.multiCall({ abi: dollBallAbi, calls: amos.filter(i => blacklist.has(i.toLowerCase())) }) + const table = [] + res.forEach((v, i) => { + table.push([amos[i], Number(v.collat_val_e18 / 1e24).toFixed(3)]) + sdk.util.sumSingleBalance(balances, USDC, v.collat_val_e18 / 1e12, api.chain) + }) + table.sort((a, b) => +b[1] - +a[1]) + console.log(amos.length) + console.table(table) + +} + +async function addInvestorAMO(api, balances) { + return sumTokens2({ + balances, + api, owner: INVESTOR_AMO, + tokens: Object.values({ + Synapse: '0x0f2d719407fdbeff09d87557abb7232601fd9f29', + 'Wrapped BTC': ADDRESSES.ethereum.WBTC, + 'USD Coin': ADDRESSES.ethereum.USDC, + 'PAX': '0x8e870d67f660d95d5be530380d0ec0bd388289e1', + ZigZag: '0xc91a71a1ffa3d8b22ba615ba1b9c01b2bbbf55ad', + 'Governance OHM': '0x0ab87046fbb341d058f17cbc4c1133f25a20a52f', + 'Aave interest bearing USDC': '0xbcca60bb61934080951369a648fb03df4f96263c', + Perpetual: '0xbc396689893d065f41bc2c6ecbee5e0085233447', + Hop: '0xc5102fe9359fd9a28f877a67e36b0f050d81a3cc', + 'Ethereum Name Service': '0xc18360217d8f7ab5e7c516566761ea12ce7f9d72', + 'Curve.fi DAI/USDC/USDT': '0x6c3f90f043a72fa612cbac8115ee7e52bde6e490', + 'Saddle DAO': '0xf1dc500fde233a4055e25e5bbf516372bc4f6871', + Ether: nullAddress, + TrueUSD: ADDRESSES.ethereum.TUSD, + 'Gelato Network Token': '0x15b7c0c907e4c6b9adaaaabc300c08991d6cea05', + 'Staked Aave': '0x4da27a545c0c5b758a6ba100e3a049001de870f5', + 'Convex Token': ADDRESSES.ethereum.CVX, + 'Curve DAO Token': ADDRESSES.ethereum.CRV, + 'Bend Token': '0x0d02755a5700414b26ff040e1de35d337df56218', + 'Binance USD': ADDRESSES.ethereum.BUSD, + 'Alchemix USD': '0xbc6da0fe9ad5f3b0d58160288917aa56653660e9', + 'Staked CvxCrv': '0xaa0c3f5f7dfd688c6e646f66cd2a6b66acdbe434', + }), + }) +} + +const ethereumTvl = async (timestamp, block, _, { api }) => { + let balances = {}; + + await Promise.all([ + addFrax3CRV(api, balances), + addyFrax3CRV(api, balances), + addUSDCPools(api, balances), + addInvestorAMO(api, balances), + addCvxFXSFRAX_BP(api, balances), + ]) + return balances +}; + module.exports = { doublecounted: true, - misrepresentedTokens: true, ethereum: { staking: staking(veFXS_StakingContract, FXS), pool2: staking(POOL_STAKING_CONTRACTS, LP_ADDRESSES), tvl: ethereumTvl, }, - fantom: { - tvl: fantomTvl - }, - hallmarks:[ + hallmarks: [ [1651881600, "UST depeg"], ], methodology: diff --git a/projects/fraxlend/abi.json b/projects/fraxlend/abi.json index 5e01e0a93bb..703d522c04f 100644 --- a/projects/fraxlend/abi.json +++ b/projects/fraxlend/abi.json @@ -1,5 +1,5 @@ { - "collateralContract": {"inputs":[],"name":"collateralContract","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"}, - "getAllPairAddresses": {"inputs":[],"name":"getAllPairAddresses","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"}, - "totalCollateral": {"inputs":[],"name":"totalCollateral","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"} - } \ No newline at end of file + "collateralContract": "address:collateralContract", + "getAllPairAddresses": "address[]:getAllPairAddresses", + "totalCollateral": "uint256:totalCollateral" +} \ No newline at end of file diff --git a/projects/fraxlend/index.js b/projects/fraxlend/index.js index 6f3b87fc640..86df2b95b80 100644 --- a/projects/fraxlend/index.js +++ b/projects/fraxlend/index.js @@ -1,42 +1,23 @@ +const ADDRESSES = require('../helper/coreAssets.json') const abi = require("./abi.json"); -const sdk = require('@defillama/sdk'); - +const { sumTokens2 } = require('../helper/unwrapLPs') const REGISTRY_ADDR = "0xD6E9D27C75Afd88ad24Cd5EdccdC76fd2fc3A751" -const chain = 'ethereum' -async function tvl(timestamp, block, chainBlocks) { - -const { output: pairs } = await sdk.api.abi.call({ - target: REGISTRY_ADDR, - abi: abi['getAllPairAddresses'], - }) - - const { output: tokens } = await sdk.api.abi.multiCall({ - abi: abi.collateralContract, - calls: pairs.map(i => ({ target: i })), - chain, block, - }) - - const { output: camounts } = await sdk.api.abi.multiCall({ - abi: abi.totalCollateral, - calls: pairs.map(i => ({ target: i })), - chain, block, - }) - - const balances = {} - tokens.forEach((res, i)=>{ - sdk.util.sumSingleBalance(balances, res.output, camounts[i].output) - }) - - return balances +async function tvl(timestamp, block, chainBlocks, { api }) { + const pairs = await api.call({ target: REGISTRY_ADDR, abi: abi['getAllPairAddresses'], }) + const tokens = await api.multiCall({ abi: abi.collateralContract, calls: pairs }) + return sumTokens2({ api, tokensAndOwners: tokens.map((v, i) => [v, pairs[i]]) }) +} +async function borrowed(timestamp, block, chainBlocks, { api }) { + const pairs = await api.call({ target: REGISTRY_ADDR, abi: abi['getAllPairAddresses'], }) + const bals = await api.multiCall({ abi: 'function totalBorrow() view returns (uint128 amount, uint128 shares)', calls: pairs }) + bals.forEach(bal => api.add(ADDRESSES.ethereum.FRAX, bal.amount)) } module.exports = { - timetravel: true, methodology: 'Gets the pairs from the REGISTRY_ADDRESS and adds the collateral amounts from each pair', - misrepresentedTokens: false, ethereum: { - tvl + tvl, borrowed, }, } \ No newline at end of file diff --git a/projects/freebie/index.js b/projects/freebie/index.js new file mode 100644 index 00000000000..eb950c1b396 --- /dev/null +++ b/projects/freebie/index.js @@ -0,0 +1,24 @@ +const { getTokenPrices } = require('../helper/unknownTokens') +const sdk = require("@defillama/sdk"); +const { staking } = require('../helper/staking') + +const token = '0x9bedce29f79076b21dd04958a9fd4b22f63fd86d' + +async function frbVault(_, _b, _cb, { api, }) { + const balances = { + ['avax:'+token]: await api.call({ abi: 'uint256:balanceVault', target: token, }) + } + const { updateBalances } = await getTokenPrices({ ...api, useDefaultCoreAssets: true, lps: ['0xa862ff4a1d2393818dbdbfbeb33bf5e35e9156f0'], allLps: true, }) + updateBalances(balances) + return balances +} + +const stakedFRB = staking("0xcc2F243FA7bBcab3BD951E8aE40730173af88b83", "0x9BedCE29F79076b21DD04958a9Fd4B22F63fD86D", "avax") + +module.exports = { + misrepresentedTokens: true, + avax: { + tvl: () => 0, + staking: sdk.util.sumChainTvls([frbVault,stakedFRB]) + } +}; diff --git a/projects/frfi/index.js b/projects/frfi/index.js index 85681b9d017..275930bd8b6 100644 --- a/projects/frfi/index.js +++ b/projects/frfi/index.js @@ -1,17 +1,22 @@ const { fetchURL } = require("../helper/utils"); const { toUSDTBalances } = require("../helper/balances"); -const tvl = async () => { +const tvl = (chain) => async () => { + return {} + /* const response = await fetchURL( - "https://backend-api-prod.frfi.io/autofarm?chainId=56&$limit=100" + `https://backend-api-prod.frfi.io/autofarm?chainId=${chain}&$limit=100` ); const data = response?.data?.data; const result = data?.reduce((acc, item) => acc + (item?.strategyTVL ?? 0), 0) ?? 0; - return toUSDTBalances(result); + return toUSDTBalances(result); */ }; module.exports = { timetravel: false, - bsc: { tvl }, + bsc: { tvl: tvl('56') }, + polygon: { tvl: tvl('137') }, + ethereum: { tvl: tvl('1') }, + kava: { tvl: tvl('2222') }, }; diff --git a/projects/frigg-eco/abi/primaryRouter.json b/projects/frigg-eco/abi/primaryRouter.json deleted file mode 100644 index a53eed9ec4d..00000000000 --- a/projects/frigg-eco/abi/primaryRouter.json +++ /dev/null @@ -1,36 +0,0 @@ -[ - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "tokenData", - "outputs": [ - { - "internalType": "address", - "name": "issuer", - "type": "address" - }, - { - "internalType": "uint256", - "name": "issuancePrice", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "expiryPrice", - "type": "uint256" - }, - { - "internalType": "address", - "name": "issuanceTokenAddress", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } -] \ No newline at end of file diff --git a/projects/frigg-eco/index.js b/projects/frigg-eco/index.js index e407431c7ac..956fd66e045 100644 --- a/projects/frigg-eco/index.js +++ b/projects/frigg-eco/index.js @@ -1,5 +1,4 @@ const sdk = require('@defillama/sdk'); -const abi = require('./abi/primaryRouter.json') const ROUTER_ADDRESS = "0x96418df8b474e90e49183cc23fa41e4ad8b0ddbe" const bonds = [ @@ -16,7 +15,7 @@ async function tvl(_, block) { ] = await Promise.all([ sdk.api.abi.multiCall({ block, - abi: abi.find(i => i.name === 'tokenData'), + abi: 'function tokenData(address) view returns (address issuer, uint256 issuancePrice, uint256 expiryPrice, address issuanceTokenAddress)', target: ROUTER_ADDRESS, calls: bonds.map(i => ({ params: i})) }), diff --git a/projects/friktion/index.js b/projects/friktion/index.js index cdb67e43ceb..bc5f02b0e86 100644 --- a/projects/friktion/index.js +++ b/projects/friktion/index.js @@ -20,7 +20,7 @@ async function tvl() { throw new Error("Unexpected shape of friktionShapshot"); } - if (!friktionSnapshot.totalTvlUSD || friktionSnapshot.totalTvlUSD < 1000000) { + if (!friktionSnapshot.totalTvlUSD || friktionSnapshot.totalTvlUSD < 1000) { console.log(friktionSnapshot); throw new Error("Unexpected totalTvlUSD"); } @@ -29,6 +29,9 @@ async function tvl() { } module.exports = { + hallmarks:[ + [1674838800, "Sunset Protocol"] + ], timetravel: false, methodology: "TVL is scraped from the window.friktionSnapshot variable in app.friktion.fi and saved to the GitHub repo at Friktion-Labs/mainnet-tvl-snapshots. The data is the same as what is displayed on the app", diff --git a/projects/fringe/pit-abi.json b/projects/fringe/pit-abi.json index 09e90b67857..38204dbb2a3 100644 --- a/projects/fringe/pit-abi.json +++ b/projects/fringe/pit-abi.json @@ -1,95 +1,7 @@ { - "getProjectTokensLength": { - "inputs": [], - "name": "projectTokensLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getLendingTokensLength": { - "inputs": [], - "name": "lendingTokensLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getProjectTokenByIndex": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "projectTokens", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getLendingTokenByIndex": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "lendingTokens", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getLendingTokenInfo": { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "lendingTokenInfo", - "outputs": [ - { - "internalType": "bool", - "name": "isListed", - "type": "bool" - }, - { - "internalType": "bool", - "name": "isPaused", - "type": "bool" - }, - { - "internalType": "contract BLendingToken", - "name": "bLendingToken", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } -} + "getProjectTokensLength": "uint256:projectTokensLength", + "getLendingTokensLength": "uint256:lendingTokensLength", + "getProjectTokenByIndex": "function projectTokens(uint256) view returns (address)", + "getLendingTokenByIndex": "function lendingTokens(uint256) view returns (address)", + "getLendingTokenInfo": "function lendingTokenInfo(address) view returns (bool isListed, bool isPaused, address bLendingToken)" +} \ No newline at end of file diff --git a/projects/frogge-fi/index.js b/projects/frogge-fi/index.js new file mode 100644 index 00000000000..e4dade6ae1c --- /dev/null +++ b/projects/frogge-fi/index.js @@ -0,0 +1,8 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports = { + misrepresentedTokens: true, + eos_evm: { + tvl: getUniTVL({ factory: '0xe725dDEBfc425b9AfF7e4fcA094ac9f4dcA35C89', useDefaultCoreAssets: true, }) + } +} diff --git a/projects/froggy-protocol/index.js b/projects/froggy-protocol/index.js new file mode 100644 index 00000000000..c902b2be3c5 --- /dev/null +++ b/projects/froggy-protocol/index.js @@ -0,0 +1,26 @@ +const { yieldHelper, } = require("../helper/yieldHelper") + +const masterchef = '0x6c8eE277A958751c97e8d0AFfEbbB8478bC755ce' +const froggy = '0x5217483171b2550C74234C583620C355b74b3095' + +module.exports = yieldHelper({ + project: 'froggy-ink', + chain: 'era', + masterchef: masterchef, + nativeToken: froggy, + abis: { + poolInfo: 'function poolInfo(uint256) view returns (address want, uint256 , uint256 , uint256 , uint256 , uint256 , uint256 , uint256 amount, uint256 , address strat)', + poolLength: 'function poolLength() view returns (uint256)', + getReservesABI: 'function getReserves() view returns (uint112 _reserve0, uint112 _reserve1)', + }, + useDefaultCoreAssets: true, +}) + +module.exports = { + era: { + tvl: () => ({}), + }, + hallmarks: [ + [Math.floor(new Date('2023-06-15')/1e3), 'Rug Pull ?'], + ], +} \ No newline at end of file diff --git a/projects/frostfinance/abi.json b/projects/frostfinance/abi.json index 01808a38043..5602fe73e03 100644 --- a/projects/frostfinance/abi.json +++ b/projects/frostfinance/abi.json @@ -1,54 +1,4 @@ { - "poolInfo": { - "type": "function", - "stateMutability": "view", - "outputs": [ - { - "type": "address", - "name": "lpToken", - "internalType": "contract IERC20" - }, - { - "type": "uint256", - "name": "allocPoint", - "internalType": "uint256" - }, - { - "type": "uint256", - "name": "lastRewardBlock", - "internalType": "uint256" - }, - { - "type": "uint256", - "name": "accTUNDRAPerShare", - "internalType": "uint256" - }, - { - "type": "uint16", - "name": "withdrawFeeBP", - "internalType": "uint16" - } - ], - "name": "poolInfo", - "inputs": [ - { - "type": "uint256", - "name": "", - "internalType": "uint256" - } - ] - }, - "poolLength": { - "type": "function", - "stateMutability": "view", - "outputs": [ - { - "type": "uint256", - "name": "", - "internalType": "uint256" - } - ], - "name": "poolLength", - "inputs": [] - } + "poolInfo": "function poolInfo(uint256) view returns (address lpToken, uint256 allocPoint, uint256 lastRewardBlock, uint256 accTUNDRAPerShare, uint16 withdrawFeeBP)", + "poolLength": "uint256:poolLength" } \ No newline at end of file diff --git a/projects/frostfinance/index.js b/projects/frostfinance/index.js index 77ce8b54880..e7c0f01d0ea 100644 --- a/projects/frostfinance/index.js +++ b/projects/frostfinance/index.js @@ -3,7 +3,6 @@ const abi = require("./abi.json"); const { staking } = require("../helper/staking"); const { pool2BalanceFromMasterChefExports } = require("../helper/pool2"); const { addFundsInMasterChef } = require("../helper/masterchef"); -const { transformAvaxAddress } = require("../helper/portedTokens"); const masterChefTUNDRA = "0x87f1b38D0C158abe2F390E5E3482FDb97bC8D0C5"; const TUNDRA = "0x21c5402C3B7d40C89Cc472C9dF5dD7E51BbAb1b1"; @@ -17,7 +16,7 @@ const DUNE = "0x314f3bee25e49ea4bcea9a3d1321c74c95f10eab"; async function avaxTvl(timestamp, block, chainBlocks) { const balances = {}; - const transformAddress = await transformAvaxAddress(); + const transformAddress = addr => 'avax:'+addr await addFundsInMasterChef( balances, diff --git a/projects/fstswap/index.js b/projects/fstswap/index.js index 629e3bfb298..2923ab98af8 100644 --- a/projects/fstswap/index.js +++ b/projects/fstswap/index.js @@ -5,7 +5,6 @@ module.exports = { bsc: { tvl: getUniTVL({ factory: '0x9A272d734c5a0d7d84E0a892e891a553e8066dce', - chain: 'bsc', useDefaultCoreAssets: true }) }, diff --git a/projects/ftmguru/index.js b/projects/ftmguru/index.js deleted file mode 100644 index afe016856c7..00000000000 --- a/projects/ftmguru/index.js +++ /dev/null @@ -1,99 +0,0 @@ -const sdk = require("@defillama/sdk") -const ITVL = [ - { - "inputs": [], - "name": "pool2", //POOL2 TVL : 1e18 === 1 USD - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "staking", //STAKING TVL : 1e18 === 1 USD - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "tvl", //GLOABL TVL : 1e18 === 1 USD - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "usd", //On-chain USD Reference Token - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } -] -const tvlGuru = "0x0786c3a78f5133F08C1c70953B8B10376bC6dCad"; //On-Chain Universal TVL Finder -const USD = "fantom:0x04068DA6C83AFCFA0e13ba15A6696662335D5B75"; //same as abi.call({target:tvlGuru,abi:ITVL[3]}) -//NOTE: USD===fantom:USDC is used explicitly to reduce EVM calls by this adapter. It makes this process faster. -async function pool2(timestamp,block) { - let _pool2 = await sdk.api.abi.call({ - target: tvlGuru, - abi: ITVL[0], - block: block, - chain: 'fantom' - }); - let balances={} - balances[USD]=(Number(_pool2.output)/1e12).toFixed(0) - return balances; -} -async function staking(timestamp,block) { - let _staking = await sdk.api.abi.call({ - target: tvlGuru, - abi: ITVL[1], - block: block, - chain: 'fantom' - }); - let balances={} - balances[USD]=(Number(_staking.output)/1e12).toFixed(0) - return balances; -} -async function tvl(timestamp,block) { - let _tvl = await sdk.api.abi.call({ - target: tvlGuru, - abi: ITVL[2], - block: block, - chain: 'fantom' - }); - let balances={} - balances[USD]=(Number(_tvl.output)/1e12).toFixed(0) - return balances; -} -module.exports = { - methodology: "USD-denominated value aggregation of most Locked assets held across ftm.guru's contracts, powered by direct on-chain storage of quantity, pools and prices using ftm.guru's Universal TVL Finder Tool (tvlGuru.sol). More detailed documentation of TVL is available at https://ftm.guru/rawdata/tvl", - fantom: { - pool2: pool2, - staking: staking, - tvl: tvl - }, -} diff --git a/projects/fujidao-v2/index.js b/projects/fujidao-v2/index.js new file mode 100644 index 00000000000..b91df7b9210 --- /dev/null +++ b/projects/fujidao-v2/index.js @@ -0,0 +1,95 @@ +const { getLogs } = require('../helper/cache/getLogs') + +const config = { + ethereum: [ + { borrowFactory: '0x24E72207a078558BF9018dcF97D7f580E79B9221', borrowStartBlock: 17690796 }, + ], + xdai: [ + { borrowFactory: '0xBeaa4b2cE11cc2F8a059341DaD422814B66d1aD0', borrowStartBlock: 28448319 }, + { borrowFactory: '0xeAcb50131a46a7b8C750c03ba336f2632fDb0344', borrowStartBlock: 28911067 }, + ], + arbitrum: [ + { borrowFactory: '0x2855666fbc5f526269b1f5dc73dfc8e11acb67f1', borrowStartBlock: 101069692 }, + { borrowFactory: '0x2bb069a248Ba1c62062143462AE7bDB5C4360E3d', borrowStartBlock: 110400709 }, + ], + optimism: [ + { borrowFactory: '0xC377e6e13426739f14E411dD88Af8056e2DcabA4', borrowStartBlock: 105577184 }, + { borrowFactory: '0x1cbf7f06c04226488B4D5b2d5EA5C8B965130500', borrowStartBlock: 106780843 }, + ], + polygon: [ + { borrowFactory: '0x157A03942e4F88c0357e4Afc1da46E9Cc12DB1D5', borrowStartBlock: 43896122 }, + { borrowFactory: '0x6Ed2428624da78cfE2daeC70BE171D1752cDEfF8', borrowStartBlock: 44986739 }, + ], +} + +module.exports = { + doublecounted: true, +}; + +Object.keys(config).forEach(chain => { + const factories = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + let logs = []; + for (let i = 0; i < factories.length; i++) { + const { borrowFactory, borrowStartBlock } = factories[i]; + const interlogs = await getLogs({ + api, + target: borrowFactory, + topics: ['0x89d38637357ca536d5c3f7cfcf4738f465b8b6bf51af92d02cb9fa8eb093f368'], + eventAbi: 'event DeployBorrowingVault (address indexed vault, address indexed asset, address indexed debtAsset, string name, string symbol, bytes32 salt)', + onlyArgs: true, + fromBlock: borrowStartBlock, + extraKey: 'borrow-vault' + }) + interlogs.forEach(log => { + logs.push(log); + }) + } + const vaults = logs.map(log => log.vault) + const assets = logs.map(log => log.asset) + const debtAssets = logs.map(log => log.debtAsset) + const bals = await api.multiCall({ abi: 'uint256:totalAssets', calls: vaults }) + const debtBals = await api.multiCall({ abi: 'uint256:totalDebt', calls: vaults, permitFailure: true, }) + bals.forEach((bal, i) => { + if (!debtBals[i]) { + if (+bal === 0) return; + throw new Error(`No debt balance for ${vaults[i]}`) + } + api.add(assets[i], bal) + api.add(debtAssets[i], debtBals[i] * -1) + }) + return api.getBalances() + }, + borrowed: async (_, _b, _cb, { api, }) => { + let logs = []; + for (let i = 0; i < factories.length; i++) { + const { borrowFactory, borrowStartBlock } = factories[i]; + const interlogs = await getLogs({ + api, + target: borrowFactory, + topics: ['0x89d38637357ca536d5c3f7cfcf4738f465b8b6bf51af92d02cb9fa8eb093f368'], + eventAbi: 'event DeployBorrowingVault (address indexed vault, address indexed asset, address indexed debtAsset, string name, string symbol, bytes32 salt)', + onlyArgs: true, + fromBlock: borrowStartBlock, + extraKey: 'borrow-vault' + }) + interlogs.forEach(log => { + logs.push(log); + }) + } + const vaults = logs.map(log => log.vault) + const debtAssets = logs.map(log => log.debtAsset) + const bals = await api.multiCall({ abi: 'uint256:totalAssets', calls: vaults }) + const debtBals = (await api.multiCall({ abi: 'uint256:totalDebt', calls: vaults, permitFailure: true, })) + bals.forEach((bal, i) => { + if (!debtBals[i]) { + if (+bal === 0) return; + throw new Error(`No debt balance for ${vaults[i]}`) + } + api.add(debtAssets[i], debtBals[i]) + }) + return api.getBalances() + } + } +}) \ No newline at end of file diff --git a/projects/fujidao/abi.json b/projects/fujidao/abi.json index 50fe2983340..c8c85b799a5 100644 --- a/projects/fujidao/abi.json +++ b/projects/fujidao/abi.json @@ -1,21 +1,3 @@ { - "totalSupply": { - "inputs": [ - { - "internalType": "uint256", - "name": "_assetID", - "type": "uint256" - } - ], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } + "totalSupply": "function totalSupply(uint256 _assetID) view returns (uint256)" } \ No newline at end of file diff --git a/projects/fujidao/index.js b/projects/fujidao/index.js index 58485150b91..946cfd5c9a1 100644 --- a/projects/fujidao/index.js +++ b/projects/fujidao/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const {sumTokens} = require('../helper/unwrapLPs'); const abi = require('./abi.json'); const sdk = require('@defillama/sdk'); @@ -8,11 +9,11 @@ const {polygonContracts} = require('./polygon'); const {arbitrumContracts} = require('./arbitrum'); const {optimismContracts} = require('./optimism'); -const weth = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"; -const wbtc = "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599"; -const ftm = "0x4E15361FD6b4BB609Fa63C81A2be19d873717870"; -const matic = '0x7D1AfA7B718fb893dB30A3aBc0Cfc608AaCfeBB0'; -const usdc= "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"; +const weth = ADDRESSES.ethereum.WETH; +const wbtc = ADDRESSES.ethereum.WBTC; +const ftm = ADDRESSES.ethereum.FTM; +const matic = ADDRESSES.ethereum.MATIC; +const usdc= ADDRESSES.ethereum.USDC; const marketsupply = async (contract, block, chain) => { return await sdk.api.abi.multiCall( diff --git a/projects/fulcrom/index.js b/projects/fulcrom/index.js new file mode 100644 index 00000000000..1a891cae558 --- /dev/null +++ b/projects/fulcrom/index.js @@ -0,0 +1,26 @@ +const { sumTokens2 } = require('../helper/unwrapLPs') + +const VAULT_ADDR = '0x8C7Ef34aa54210c76D6d5E475f43e0c11f876098'; + +function fulExports({ vault, }) { + return async (ts, _block, _, { api }) => { + const tokenAddresses = await api.fetchList({ + target: vault, + lengthAbi: abis.whitelistedTokenCount, + itemAbi: abis.whitelistedTokens, + }) + + return sumTokens2({ api, owner: vault, tokens: tokenAddresses, }) + } +} + +const abis = { + whitelistedTokenCount: 'uint256:whitelistedTokenCount', + whitelistedTokens: 'function whitelistedTokens(uint256) view returns (address)' +} + +module.exports = { + cronos: { + tvl: fulExports({ vault: VAULT_ADDR, }), + } +} diff --git a/projects/funbear/index.js b/projects/funbear/index.js new file mode 100644 index 00000000000..51238b72db6 --- /dev/null +++ b/projects/funbear/index.js @@ -0,0 +1,19 @@ +const FUNB = 'ethereum:0xd86c0b9b686f78a7a5c3780f03e700dbbad40e01'; +const stakeContractAddresses = { + unlockedStake: '0x1C4f227A2c7F62f88a7907cBF027403603A81A64', + yearlyStake: '0xb991FAeF710f2ae699c425a92482Fc5D3Ae0cCD7', +} + +async function staking(timestamp, block, chainBlocks, { api }) { + const supplies = await api.multiCall({ abi: 'erc20:totalSupply', calls: Object.values(stakeContractAddresses) }) + supplies.forEach(i => api.add(FUNB, i, { skipChain: true })) + return api.getBalances() +} + +module.exports = { + methodology: 'TVL counts staked FUNB coins on the platform itself.', + kava: { + tvl: () => 0, + staking, + } +}; diff --git a/projects/fundex/index.js b/projects/fundex/index.js new file mode 100644 index 00000000000..881cddffc68 --- /dev/null +++ b/projects/fundex/index.js @@ -0,0 +1,22 @@ +const { sumTokens2 } = require('../helper/unwrapLPs') + +const config = { + optimism: '0x043c26c2afae80e1c8aa7d341f6f725f4fa9183b', + arbitrum: '0x7b5B4c5e381c7Dc116BF9dA8dDd1c96a3bd6C1cb', + kava: '0xF28EFDEc09D15c6e206Ba15E7B4Ce13326d0ca90', +} + +module.exports = { + hallmarks: [ + [1680134400, "Rugpull"] + ] +}; + +Object.keys(config).forEach(chain => { module.exports[chain] = {tvl} }) + +async function tvl(_, _b, _cb, { api, }) { + const factory = config[api.chain] + const tokens = await api.call({ abi: 'address[]:getTokens', target: factory }) + const owners = await api.multiCall({ abi: 'function assetOf(address) view returns (address)', target: factory, calls: tokens }) + return sumTokens2({ api, tokensAndOwners: tokens.map((t, i) => ([t, owners[i]])) }) +} diff --git a/projects/fusefi/olalending.js b/projects/fusefi/olalending.js index 4df9a0af77f..8949841c7be 100644 --- a/projects/fusefi/olalending.js +++ b/projects/fusefi/olalending.js @@ -1,10 +1,10 @@ -const {usdCompoundExports} = require('../helper/compound'); +const { usdCompoundExports } = require('../helper/compound'); const unitroller_fuse = "0x26a562B713648d7F3D1E1031DCc0860A4F3Fa340" const abis = { - oracle: {"constant":true,"inputs":[],"name":"getRegistry","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"}, - underlyingPrice: {"constant":true,"inputs":[{"internalType":"address","name":"cToken","type":"address"}],"name":"getPriceForUnderling","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"}, + oracle: "address:getRegistry", + underlyingPrice: "function getPriceForUnderling(address cToken) view returns (uint256)", } -module.exports=usdCompoundExports(unitroller_fuse, "fuse", "0x025B0ff0920298e087308F3b2de0CF6399685909", abis) \ No newline at end of file +module.exports = usdCompoundExports(unitroller_fuse, "fuse", "0x025B0ff0920298e087308F3b2de0CF6399685909", abis) \ No newline at end of file diff --git a/projects/fusefi/swap.js b/projects/fusefi/swap.js index 28e7fde6cd2..f86527ed8f3 100644 --- a/projects/fusefi/swap.js +++ b/projects/fusefi/swap.js @@ -3,7 +3,6 @@ const { getUniTVL } = require('../helper/unknownTokens'); module.exports = { tvl: getUniTVL({ factory: '0x1998E4b0F1F922367d8Ec20600ea2b86df55f34E', - chain: 'fuse', useDefaultCoreAssets: true, }) } diff --git a/projects/fusion/index.js b/projects/fusion/index.js index e5bbcfb9b46..5224723c116 100644 --- a/projects/fusion/index.js +++ b/projects/fusion/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') // Set Helpers const { stakings } = require("../helper/staking"); @@ -7,7 +8,7 @@ const { mergeExports } = require("../helper/utils"); // Set NULL, Factories -const nullAddress = "0x0000000000000000000000000000000000000000"; +const nullAddress = ADDRESSES.null; const dexFactory = "0x9550b0c83AD5a58898cD4267987Af67e7E52bF55"; // 87, 250 const dexFactoryClassic = "0x9fAEd210e14F95a15b89C0D09D1a55519aC2F26d"; // 61 @@ -19,8 +20,8 @@ const sntClassic = "0x5D33f65Cc32CAB4065074E8fb1c08Df727e7F7cB"; // 61 // Set NUSD Addresses -const nusdNovaNetwork = "0x1F5396f254EE25377A5C1b9c6BfF5f44e9294fFF"; // 87 -const nusdFantom = "0xC5cd01e988cD0794E05ab80F2BCdbDF13cE08BD3"; // 250 +const nusdNovaNetwork = ADDRESSES.nova.NUSD; // 87 +const nusdFantom = ADDRESSES.fantom.nUSD; // 250 const nusdClassic = "0xab1E9D7551c1B161cedf96AeaC66b95bc5cCd7d4"; // 61 // Set Staking Protocols @@ -37,8 +38,8 @@ const incomeStakingClassic = "0xb6B824D46B3Bd0698E5180bDb010a2C2bf012e1d"; // 61 // Set Farm Addresses -const yieldFarms = 0x00501ed66d67b1127809e54395f064e256b75b23; // 87, 250 -const yieldFarmsClassic = 0x9599ceBf169A1F3503996CBf90deA38C515ddd54; // 61 +const yieldFarms = "0x00501ed66d67b1127809e54395f064e256b75b23"; // 87, 250 +const yieldFarmsClassic = "0x9599ceBf169A1F3503996CBf90deA38C515ddd54"; // 61 // Calculate TVL @@ -48,7 +49,6 @@ const dexTVL = { nova: { tvl: getUniTVL({ factory: dexFactory, - chain: "nova", useDefaultCoreAssets: true, }), }, @@ -57,7 +57,6 @@ const dexTVL = { fantom: { tvl: getUniTVL({ factory: dexFactory, - chain: "fantom", useDefaultCoreAssets: true, }), }, @@ -66,7 +65,6 @@ const dexTVL = { ethereumclassic: { tvl: getUniTVL({ factory: dexFactoryClassic, - chain: "ethereumclassic", useDefaultCoreAssets: true, }), }, diff --git a/projects/fusionx-fi/index.js b/projects/fusionx-fi/index.js new file mode 100644 index 00000000000..5c28a365896 --- /dev/null +++ b/projects/fusionx-fi/index.js @@ -0,0 +1,10 @@ +const { getUniTVL } = require("../helper/unknownTokens"); +module.exports = { + misrepresentedTokens: true, + mantle: { + tvl: getUniTVL({ + factory: "0xe5020961fa51ffd3662cdf307def18f9a87cce7c", + useDefaultCoreAssets: true, + }), + }, +}; diff --git a/projects/fusionx-v3/index.js b/projects/fusionx-v3/index.js new file mode 100644 index 00000000000..ff3f1093c31 --- /dev/null +++ b/projects/fusionx-v3/index.js @@ -0,0 +1,5 @@ +const { uniV3Export } = require('../helper/uniswapV3') + +module.exports = uniV3Export({ + mantle: { factory: '0x530d2766D1988CC1c000C8b7d00334c14B69AD71', fromBlock: 2646 }, +}) diff --git a/projects/future-swap/index.js b/projects/future-swap/index.js new file mode 100644 index 00000000000..09b8e465e00 --- /dev/null +++ b/projects/future-swap/index.js @@ -0,0 +1,35 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require("../helper/unwrapLPs") +const { sumUnknownTokens } = require("../helper/unknownTokens") + +const FindoraStableCoins = { + BNB_BUSD: ADDRESSES.findora.BUSD_b, + BNB_USDT: ADDRESSES.findora.USDT_b, + ETHEREUM_USDC: ADDRESSES.findora.USDC_e, + ETHEREUM_USDT: ADDRESSES.findora.USDT_e, +}; + +const FutureSwapContracts = { + USDF: "0x7cdA16774fA183212889d7221fffF29f8b7e664b", + Farm: "0x2EC17007a70d2e37DBCEB4EEa05c2e5a5e6B73cA", +}; + +const abiPools = `function getPools() view returns (tuple(address lpToken, uint256 allocPoint, uint256 lastRewardTime, uint256 accRewardPerShare)[])`; + +async function farmStakings(timestamp, block, _, { api }) { + const pools = await api.call({ target: FutureSwapContracts.Farm, abi: abiPools, }) + + return sumUnknownTokens({ api, tokens: pools.map(i => i.lpToken), owner: FutureSwapContracts.Farm, blacklistedTokens: [FutureSwapContracts.USDF], resolveLP: true, useDefaultCoreAssets: true, }) +} + +module.exports = { + findora: { + start: 1677029212, // 2023-02-22 01:26:52 UTC + methodology: `Sum of liqudities backed USDF; and tokens values staked in the FutureSwap Farm.`, + tvl: sumTokensExport({ + owner: FutureSwapContracts.USDF, + tokens: Object.values(FindoraStableCoins), + }), + staking: farmStakings, + }, +}; diff --git a/projects/futureswap/index.js b/projects/futureswap/index.js index a5f0b7e6fc0..d4cf03ead53 100644 --- a/projects/futureswap/index.js +++ b/projects/futureswap/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens2 } = require('../helper/unwrapLPs') async function tvl(timestamp, block) { @@ -9,8 +10,8 @@ async function tvl(timestamp, block) { ]; const tokens = [ - "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", - "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", + ADDRESSES.ethereum.WETH, + ADDRESSES.ethereum.USDC, ]; return sumTokens2({ block, tokens, owners: contracts }) } @@ -23,9 +24,9 @@ async function arbitrum(timestamp, _, { arbitrum: block }) { ]; const tokens = [ - "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1", - "0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8", - "0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f", + ADDRESSES.arbitrum.WETH, + ADDRESSES.arbitrum.USDC, + ADDRESSES.arbitrum.WBTC, ]; return sumTokens2({ block, tokens, owners: contracts, chain: 'arbitrum' }) } @@ -38,9 +39,9 @@ async function avax(timestamp, _, { avax: block }) { ]; const tokens = [ - '0x6e84a6216eA6dACC71eE8E6b0a5B7322EEbC0fDd', - '0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E', - '0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7', + ADDRESSES.avax.JOE, + ADDRESSES.avax.USDC, + ADDRESSES.avax.WAVAX, ]; return sumTokens2({ block, tokens, owners: contracts, chain: 'avax',}) } diff --git a/projects/fuzzfinance/index.js b/projects/fuzzfinance/index.js index 23245b0b8e5..0f4d72a4b17 100644 --- a/projects/fuzzfinance/index.js +++ b/projects/fuzzfinance/index.js @@ -1,57 +1,10 @@ -// const { request, gql } = require("graphql-request"); const sdk = require("@defillama/sdk"); -// const { toUSDTBalances } = require('../helper/balances'); -const { calculateUniTvl } = require("../helper/calculateUniTvl"); -const { getFixBalances } = require("../helper/portedTokens"); +const { uniTvlExport } = require("../helper/calculateUniTvl"); const fuzz = "0x984b969a8e82f5ce1121ceb03f96ff5bb3f71fee"; const factory = "0x5245d2136dc79Df222f00695C0c29d0c4d0E98A6"; const masterchef = "0x847b46ed6c3df75e34a0496ef148b89bf5eb41b1"; -// const graphUrl = 'https://graph.fuzz.fi/subgraphs/name/fuzzfinance/fuzzswap' -// const graphQuery = gql` -// query get_tvl($block: Int) { -// uniswapFactory( -// id: "0x5245d2136dc79Df222f00695C0c29d0c4d0E98A6", -// block: { number: $block } -// ) { -// totalLiquidityUSD -// }, -// } -// `; - -async function tvl(timestamp, block, chainBlocks) { - // const {block} = await sdk.api.util.lookupBlock(timestamp,{ - // chain: 'harmony' - // }) - // const response = await request( - // graphUrl, - // graphQuery, - // { - // block, - // } - // ); - - // const usdTvl = Number(response.uniswapFactory.totalLiquidityUSD) - - // return toUSDTBalances(usdTvl) - let balances = await calculateUniTvl( - (addr) => { - if (addr === "0x224e64ec1bdce3870a6a6c777edd450454068fec") { - return "0xa47c8bf37f92abed4a126bda807a7b7498661acd"; - } - return `harmony:${addr}`; - }, - chainBlocks.harmony, - "harmony", - factory, - 0, - true - ); - (await getFixBalances('harmony'))(balances); - return balances; -} - async function staking(timestamp, block, chainBlocks) { let balances = {}; let balance = ( @@ -69,7 +22,7 @@ async function staking(timestamp, block, chainBlocks) { module.exports = { methodology: `Counts the tokens locked on AMM pools from the factory contract.`, harmony: { - tvl, + tvl: uniTvlExport(factory, 'harmony', true), staking, }, }; diff --git a/projects/fvm/index.js b/projects/fvm/index.js new file mode 100644 index 00000000000..3dfbc9e99fe --- /dev/null +++ b/projects/fvm/index.js @@ -0,0 +1,12 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports = { + misrepresentedTokens: true, + fantom: { + tvl: getUniTVL({ + factory: '0x472f3C3c9608fe0aE8d702f3f8A2d12c410C881A', + useDefaultCoreAssets: true, + hasStablePools: true, + }) + } +} diff --git a/projects/fxdx/index.js b/projects/fxdx/index.js new file mode 100644 index 00000000000..21aabc73263 --- /dev/null +++ b/projects/fxdx/index.js @@ -0,0 +1,14 @@ +const sdk = require('@defillama/sdk') +const { gmxExports } = require("../helper/gmx") +const { sumTokensExport, nullAddress } = require('../helper/unwrapLPs') + +const optimismvault = "0x10235996C4DAbCE8430a71Cbc06571bd475A1d0C"; +const customWETH = '0xd158b0f013230659098e58b66b602dff8f7ff120' +const wethTvl = sumTokensExport({ owner: customWETH, tokens: [nullAddress]}) +const gmxTVL = gmxExports({ vault: optimismvault, blacklistedTokens: [customWETH] }) + +module.exports = { + optimism: { + tvl: sdk.util.sumChainTvls([gmxTVL, wethTvl]), + }, +}; diff --git a/projects/fxswap/index.js b/projects/fxswap/index.js index f3627936308..c0b9732830e 100644 --- a/projects/fxswap/index.js +++ b/projects/fxswap/index.js @@ -4,7 +4,7 @@ module.exports = { misrepresentedTokens: true, functionx: { tvl: getUniTVL({ - factory: '0x9E229BE3812228454499FAf771b296bedFe8c904', chain: 'functionx', useDefaultCoreAssets: true, + factory: '0x9E229BE3812228454499FAf771b296bedFe8c904', useDefaultCoreAssets: true, }) }, }; diff --git a/projects/gaia-dao/index.js b/projects/gaia-dao/index.js index 5f38e2835c3..2b922a6cc5a 100644 --- a/projects/gaia-dao/index.js +++ b/projects/gaia-dao/index.js @@ -1,12 +1,13 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { ohmTvl } = require("../helper/ohm"); const gaia = "0x9f6aEDcA032b1092E08b848FC9D6F29139370837"; const stakingAdd = "0x89884B045Ed93067b28C2554a9CB877a41a8fA73"; const treasury = "0x15E5A559e67Cb6CAB391821635B351D43E2371b2"; const treasuryTokens = [ - ["0xa7d7079b0fead91f3e65f86e8915cb59c1a4c664", false], // USDC - ["0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7", false], // WAVAX - ["0x49d5c2bdffac6ce2bfdb6640f4f80f226bc10bab", false], // WETH + [ADDRESSES.avax.USDC_e, false], // USDC + [ADDRESSES.avax.WAVAX, false], // WAVAX + [ADDRESSES.avax.WETH_e, false], // WETH ["0x6Ca7AAc252FeD4894132Ae6E6d96bFc739d9FC3a", true] // GAIA USDC JLP ]; diff --git a/projects/galador-io/index.js b/projects/galador-io/index.js new file mode 100644 index 00000000000..8d3f6eb0644 --- /dev/null +++ b/projects/galador-io/index.js @@ -0,0 +1,8 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports = { + misrepresentedTokens: true, + mantle: { + tvl: getUniTVL({ factory: '0x6F602b6F11F174c627813262fA713F334ca20aA6', fetchBalances: true, useDefaultCoreAssets: true }), + }, +}; \ No newline at end of file diff --git a/projects/galatea/index.js b/projects/galatea/index.js index fa519fd4535..e43e5904d2b 100644 --- a/projects/galatea/index.js +++ b/projects/galatea/index.js @@ -1,35 +1,11 @@ /*** This Protocol seems hacked/rugged. It's a case for study and analyze ***/ -const utils = require("../helper/utils"); - -const api_galatea = "https://api.galatea.cash/api"; async function fetch() { - // var tvl = (await utils.fetchURL(api_galatea)).data.tvl; return 0; } -async function pool2() { - var pool2 = (await utils.fetchURL(api_galatea)).data.networks.map( - (p) => p.stats.pools - ); - return pool2; -} - -async function staking() { - var staking = (await utils.fetchURL(api_galatea)).data.networks.map( - (p) => p.stats.boardroom.tvl - ); - return staking; - } - module.exports = { deadFrom: 1648765747, - // pool2: { - // fetch: pool2, - // }, - // staking: { - // fetch: staking, - // }, fetch, }; diff --git a/projects/galaxygoggle/index.js b/projects/galaxygoggle/index.js index 4f3ef052046..68016dc7c2b 100644 --- a/projects/galaxygoggle/index.js +++ b/projects/galaxygoggle/index.js @@ -1,59 +1,18 @@ -const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); const { staking } = require("../helper/staking"); const GgStaking = "0xBD79c01140CeE7040f8F5E935B72e13540a801b6" const gg = "0xF2F7CE610a091B94d41D69f4fF1129434a82E2f0" -// https://app.galaxygoggle.money/#/bonds -const treasury = "0xD5F922e23693e552793fE0431F9a95ba67A60A23" -const dao = "0xDEEdd1646984F9372Cc9D3d7E13AC1606cC2B548" -const mim = "0x130966628846BFd36ff31a822705796e8cb8C18D" -const wavax = "0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7" -const joe = "0x6e84a6216ea6dacc71ee8e6b0a5b7322eebc0fdd" - -async function tvl(timestamp, block, chainBlocks) { - const balances = {}; - - await sumTokensAndLPsSharedOwners( - balances, - [ - [mim, false], - [wavax, false], - [joe, false], - ["0xe9E8d6b6ce6D94Fc9d724711e80784Ec096949Fc", true], // mim-gg - ], - [treasury, dao], - chainBlocks.avax, - 'avax', - addr=>`avax:${addr}` - ); - - return balances; -} - const bscGG = "0xcAf23964Ca8db16D816eB314a56789F58fE0e10e"; -const bscTreasury = "0xF76C9753507B3Df0867EB02D86d07C6fFcEecaf1"; const bscStaking = "0x97209Cf7a6FccC388eEfF85b35D858756f31690d"; -const treasuryTokensBSC = [ - ["0xe9e7cea3dedca5984780bafc599bd69add087d56", false], // BUSD - ["0x13Cf29b3F58f777dDeD38278F7d938401f6b260c", true] // GG-BUSD -] - -async function bscTvl(timestamp, block, chainBlocks) { - let balances = {}; - await sumTokensAndLPsSharedOwners(balances, treasuryTokensBSC, [bscTreasury], chainBlocks.bsc, "bsc", addr=>`bsc:${addr}`); - balances[`avax:${gg}`] = balances["bsc:0xcaf23964ca8db16d816eb314a56789f58fe0e10e"] || 0; - delete balances["bsc:0xcaf23964ca8db16d816eb314a56789f58fe0e10e"]; - return balances; -} module.exports = { avax:{ - tvl, + tvl: () => 0, staking: staking(GgStaking, gg, "avax") }, bsc: { - tvl: bscTvl, + tvl: () => 0, staking: staking(bscStaking, bscGG, "bsc", `avax:${gg}`) }, methodology: diff --git a/projects/gale/index.js b/projects/gale/index.js index 7b598c2ad28..a893ac975aa 100644 --- a/projects/gale/index.js +++ b/projects/gale/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { staking } = require("../helper/staking"); const config = { @@ -6,7 +7,7 @@ const config = { tokenContract: "0x627E86E9eC832b59018Bf91456599e752288Aa97", liquidityContract: "0x1fC3152de89b0c6c36F0d330b7Be369d6dDB219F", vaultContract: "0x973Abe726E3e37bbD8501B2D8909Fa59535Babdd", - busd: '0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56', + busd: ADDRESSES.bsc.BUSD, } } @@ -15,7 +16,6 @@ module.exports = { misrepresentedTokens: false, bsc: { tvl: () => ({}), - treasury: staking(config.bsc.vaultContract, config.bsc.busd, "bsc"), staking: staking(config.bsc.windmillContract, config.bsc.tokenContract, "bsc"), }, methodology: diff --git a/projects/gale/windmillABI.json b/projects/gale/windmillABI.json index 54d82fd1c59..df47a3059a3 100644 --- a/projects/gale/windmillABI.json +++ b/projects/gale/windmillABI.json @@ -1,15 +1,3 @@ { - "totalBurned": { - "inputs": [], - "name": "totalBurned", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -} + "totalBurned": "uint256:totalBurned" +} \ No newline at end of file diff --git a/projects/galoswap/index.js b/projects/galoswap/index.js new file mode 100644 index 00000000000..65a3e9dac41 --- /dev/null +++ b/projects/galoswap/index.js @@ -0,0 +1,10 @@ +const { getUniTVL } = require('../helper/unknownTokens'); +const sdk = require("@defillama/sdk"); + +module.exports = { + misrepresentedTokens: true, + era: { + tvl: getUniTVL({ factory: '0x48E571C645bbeD451b7C58650E643F534fCaB693', useDefaultCoreAssets: true, hasStablePools: true }), + }, + methodology: "Counts liquidity in pools", +}; \ No newline at end of file diff --git a/projects/gambit-financial/index.js b/projects/gambit-financial/index.js new file mode 100644 index 00000000000..cc06448b27a --- /dev/null +++ b/projects/gambit-financial/index.js @@ -0,0 +1,15 @@ +const { sumTokensExport } = require('../helper/unwrapLPs') +const ADDRESSES = require('../helper/coreAssets.json') + +module.exports = { + bsc: { + tvl: sumTokensExport({ owner: '0xc73A8DcAc88498FD4b4B1b2AaA37b0a2614Ff67B', tokens: [ + ADDRESSES.bsc.BUSD, + ADDRESSES.bsc.BTCB, + ADDRESSES.bsc.ETH, + ADDRESSES.bsc.WBNB, + ADDRESSES.bsc.USDC, + ADDRESSES.bsc.USDT, + ]}) + }, +} diff --git a/projects/gambit/index.js b/projects/gambit/index.js new file mode 100644 index 00000000000..29c47248412 --- /dev/null +++ b/projects/gambit/index.js @@ -0,0 +1,12 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require("../helper/unwrapLPs"); + +const SimpleGToken = "0x0729e806f57CE71dA4464c6B2d313E517f41560b"; // SimpleGToken + +module.exports = { + methodology: `Count the USDC that has been deposited on Gambit`, + era: { + tvl: sumTokensExport({ owner: SimpleGToken, tokens: [ADDRESSES.era.USDC], }), + }, +}; + diff --git a/projects/gamblefi/index.js b/projects/gamblefi/index.js index ee792ca0fc3..43a1c637863 100644 --- a/projects/gamblefi/index.js +++ b/projects/gamblefi/index.js @@ -36,13 +36,7 @@ async function tvl(timestamp, ethBlock, chainBlocks) { const betslip = await sdk.api.abi.call({ target: wBETSLIP, - abi: { - inputs: [{ internalType: "uint256", name: "_amount", type: "uint256" }], - name: "wBTSToBTS", - outputs: [{ internalType: "uint256", name: "", type: "uint256" }], - stateMutability: "view", - type: "function", - }, + abi: 'function wBTSToBTS(uint256 _amount) view returns (uint256)', chain: "cronos", block: chainBlocks.cronos, params: [balances[wbetslipAddress]], diff --git a/projects/gamutexchange/abi.js b/projects/gamutexchange/abi.js new file mode 100644 index 00000000000..fa59f8ad1a4 --- /dev/null +++ b/projects/gamutexchange/abi.js @@ -0,0 +1,6 @@ +const factory = require("./factory.json"); + +module.exports = { + getPoolTokensAndBalances: "function getPoolTokensAndBalances() view returns (address[] tokens, uint256[] balances)", + ...factory, +}; diff --git a/projects/gamutexchange/factory.json b/projects/gamutexchange/factory.json new file mode 100644 index 00000000000..098fbbf00ba --- /dev/null +++ b/projects/gamutexchange/factory.json @@ -0,0 +1,4 @@ +{ + "allPools": "function allPools(uint256) view returns (address)", + "allPoolsLength": "uint256:allPoolsLength" +} \ No newline at end of file diff --git a/projects/gamutexchange/getTVL.js b/projects/gamutexchange/getTVL.js new file mode 100644 index 00000000000..6311d09af20 --- /dev/null +++ b/projects/gamutexchange/getTVL.js @@ -0,0 +1,96 @@ +const swapAbi = require("./abi"); +const { + transformBalances, + transformDexBalances, +} = require("../helper/portedTokens"); +const { getCoreAssets } = require("../helper/tokenMapping"); +const sdk = require("@defillama/sdk"); + +function getTVL({ + chain, + coreAssets, + blacklist = [], + factory, + blacklistedTokens, + useDefaultCoreAssets = false, + abis = {}, +}) { + if (!coreAssets && useDefaultCoreAssets) coreAssets = getCoreAssets(chain); + blacklist = (blacklistedTokens || blacklist).map((i) => i.toLowerCase()); + + const abi = { ...swapAbi, ...abis }; + factory = factory.toLowerCase(); + + return async (ts, _block, { [chain]: block }) => { + let ca = { pairs: [], token0s: [], token1s: [] }; + const length = await sdk.api2.abi.call({ + abi: abi.allPoolsLength, + target: factory, + chain, + block, + }); + sdk.log(chain, " No. of pairs: ", length); + const pairCalls = []; + for (let i = 0; i < length; i++) pairCalls.push(i); + + const calls = await sdk.api2.abi.multiCall({ + block, + chain, + abi: abi.allPools, + calls: pairCalls, + target: factory, + }); + + const tokenData = await sdk.api2.abi.multiCall({ + abi: abi.getPoolTokensAndBalances, + chain, + block, + calls, + }); + + const t0 = [], + t1 = [], + re = []; + tokenData.forEach((item, index) => { + t0.push(item[0][0]); + t1.push(item[0][1]); + re.push({ _reserve0: item[1][0], _reserve1: item[1][1] }); + }); + + ca.pairs.push(...calls); + ca.token0s.push(...t0); + ca.token1s.push(...t1); + + if (coreAssets) { + const data = []; + re.forEach(({ _reserve0, _reserve1 }, i) => { + data.push({ + token0: ca.token0s[i], + token1: ca.token1s[i], + token1Bal: _reserve1, + token0Bal: _reserve0, + }); + }); + return transformDexBalances({ + chain, + data, + coreAssets, + blacklistedTokens: blacklist, + }); + } + + const balances = {}; + const blacklistedSet = new Set(blacklist); + re.forEach(({ _reserve0, _reserve1 }, i) => { + if (!blacklistedSet.has(ca.token0s[i].toLowerCase())) + sdk.util.sumSingleBalance(balances, ca.token0s[i], _reserve0); + if (!blacklistedSet.has(ca.token1s[i].toLowerCase())) + sdk.util.sumSingleBalance(balances, ca.token1s[i], _reserve1); + }); + return transformBalances(chain, balances); + }; +} + +module.exports = { + getTVL, +}; diff --git a/projects/gamutexchange/index.js b/projects/gamutexchange/index.js new file mode 100644 index 00000000000..33859f77c18 --- /dev/null +++ b/projects/gamutexchange/index.js @@ -0,0 +1,14 @@ +const { getTVL } = require("./getTVL"); + +const chain = "kava"; + +module.exports = { + misrepresentedTokens: true, + kava: { + tvl: getTVL({ + chain, + factory: "0xbD4C56E952c238389AEE995E1ed504cA646D199B", + useDefaultCoreAssets: true, + }), + }, +}; diff --git a/projects/garbi/index.js b/projects/garbi/index.js new file mode 100644 index 00000000000..dbc191675e4 --- /dev/null +++ b/projects/garbi/index.js @@ -0,0 +1,74 @@ +const sdk = require('@defillama/sdk') +const { stakings } = require('../helper/staking') +const GARBI = '0x5fd71280b6385157b291b9962f22153fc9e79000' + +async function tvl(_, _b, _cb, { api, }) { + const balances = {} + + const singleFarms = [ + '0x12a7144114354f319bba86acd8d17e912dd4634d', + '0x6baeb427e39da7550bff5b638686e1e39f327554', + ] + + const farmTokens = await api.multiCall({ abi: 'address:want', calls: singleFarms }) + const farmBal = await api.multiCall({ abi: 'uint256:totalShare', calls: singleFarms }) + + farmTokens.forEach((v, i) => sdk.util.sumSingleBalance(balances, v, farmBal[i], api.chain)) + + const pools = [ + '0xb68b1c9a7dc9a437d6ee597ae31d80005206a919', + '0x3d5ddde5b8790cc294d03433bbe9cad194c002a5', + '0x4685befdc633a4067e65d422520e99c34c09b4d2', + '0x26cf5ba5b29f23f20fa82ba684f15e1eb5bf4874', + ] + + const base = await api.multiCall({ abi: 'address:base', calls: pools }) + const bDecimals = await api.multiCall({ abi: 'erc20:decimals', calls: base }) + const tokens = await api.multiCall({ abi: 'address:token', calls: pools }) + const tDecimals = await api.multiCall({ abi: 'erc20:decimals', calls: tokens }) + const reserves = await api.multiCall({ abi: 'function getTotalReserve() returns (uint256, uint256)', calls: pools }) + + reserves.forEach(([baseBal, tokenBal], i) => { + if (tDecimals[i] !== bDecimals[i]) { + baseBal = baseBal / (10 ** (18 - bDecimals[i])) + tokenBal = tokenBal / (10 ** (18 - tDecimals[i])) + } + sdk.util.sumSingleBalance(balances, base[i], baseBal, api.chain) + sdk.util.sumSingleBalance(balances, tokens[i], tokenBal, api.chain) + }) + + const repoList = [ + '0x08E4983dA044AA8a8D3121913Ee0d368A3ff9aE4', + '0x9E9C654ce87C0bB58D5df7835AC69A202A1deb9b', + '0xa9D63685d81D29bF8D74c122380dF98A7C0a00a2' + ] + + + const repos = await api.multiCall({ abi: 'function getCapacityByToken() returns (uint256)', calls: repoList }) + const repoTokens = await api.multiCall({ abi: 'address:base', calls: repoList }) + const repoTokenDecimals = await api.multiCall({ abi: 'erc20:decimals', calls: repoTokens }) + + repos.forEach((repoTokenBal, i) => { + repoTokenBal = repoTokenBal / (10 ** (18 - repoTokenDecimals[i])); + sdk.util.sumSingleBalance(balances, repoTokens[i], repoTokenBal, api.chain) + }) + + return balances +} + +const stakingContracts = [ + // stakingContract1 = + "0xa8d4324b1fc6442fd47414c809f4b54bfc3babc6", + // stakingContract2 + "0x1fb501f09a99844e9c9b4598e50010986f6b17b2", + // stakingContract3 + "0xfb66e862693c0676ac44e436d11c43ecda198eca" +]; + +module.exports = { + doublecounted: true, + arbitrum: { + tvl, + staking: stakings(stakingContracts, GARBI) + } +} \ No newline at end of file diff --git a/projects/garble-money/index.js b/projects/garble-money/index.js new file mode 100644 index 00000000000..fc68b907fb7 --- /dev/null +++ b/projects/garble-money/index.js @@ -0,0 +1,15 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport, nullAddress, } = require('../helper/sumTokens') + +module.exports = { + tron: { + tvl: sumTokensExport({ + tokensAndOwners: [ + [nullAddress, 'TCdY8kA7XsZ5UUw8jEgbVRbS2MVttrY9AC'], + [ADDRESSES.tron.USDT, 'TYaaJsD44isGwQUbvHNuii8nAnTKSxPcND'], + [ADDRESSES.tron.USDD, 'TWupFtHWnURhDNrWBfB2tK3zD4uALurBgk'], + [ADDRESSES.tron.JM, 'TK76Z1mJQHN98WsuUUKeDZnNhwRsj6p5wo'], + ] + }), + }, +}; diff --git a/projects/gard/index.js b/projects/gard/index.js index 2017e77d033..e7c2cb1cfae 100644 --- a/projects/gard/index.js +++ b/projects/gard/index.js @@ -1,6 +1,5 @@ -const { searchAccountsAll, } = require("../helper/chain/algorand"); -const { sumTokens, tokens, getAppGlobalState, } = require('../helper/chain/algorand') +const { searchAccountsAll, sumTokens, tokens, getAppGlobalState, } = require('../helper/chain/algorand') const { transformBalances } = require('../helper/portedTokens') const chain = 'algorand' diff --git a/projects/gardensdao/index.js b/projects/gardensdao/index.js index 79de5cffc37..2c27b67ad87 100644 --- a/projects/gardensdao/index.js +++ b/projects/gardensdao/index.js @@ -7,17 +7,7 @@ const SUBGRAPH_GARDENS_XDAI = "https://api.thegraph.com/subgraphs/name/1hive/gardens-xdai"; -const balanceAbi = { - "constant": true, - "inputs": [ - { "internalType": "address", "name": "_token", "type": "address" } - ], - "name": "balance", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" -} +const balanceAbi = 'function balance(address _token) view returns (uint256)' const ALL_ORGS_GQL = gql` @@ -92,10 +82,11 @@ async function tvl(timestamp, _block, { xdai: block }) { const { output } = await sdk.api.abi.multiCall({ abi: balanceAbi, calls, chain, block, + permitFailure: true, }) output.forEach(({ input, output }) => { - sdk.util.sumSingleBalance(balances, input.params[0].toLowerCase(), output) + if (output) sdk.util.sumSingleBalance(balances, input.params[0].toLowerCase(), output) }) const tokens = Object.keys(balances) diff --git a/projects/garuda-staking/index.js b/projects/garuda-staking/index.js new file mode 100644 index 00000000000..bffa81f7049 --- /dev/null +++ b/projects/garuda-staking/index.js @@ -0,0 +1,9 @@ +const { nullAddress } = require("../helper/unwrapLPs"); + +module.exports = { + ethereum: { + tvl: async (_, _1, _2, { api }) => ({ + [nullAddress]: await api.call({ target: '0x3802c218221390025bceabbad5d8c59f40eb74b8', abi: 'uint256:totalSupply'}) + }) + } +} \ No newline at end of file diff --git a/projects/gate-io/index.js b/projects/gate-io/index.js index ee3b36769f7..0955b769b95 100644 --- a/projects/gate-io/index.js +++ b/projects/gate-io/index.js @@ -59,6 +59,18 @@ const config = { '0xc882b111a75c0c657fc507c04fbfcd2cc984f071', ] }, + era: { + owners: [ + '0x0d0707963952f2fba59dd06f2b425ace40b492fe', + '0x1c4b70a3968436b9a0a9cf5205c787eb81bb558c', + '0x234ee9e35f8e9749a002fc42970d570db716453b', + '0x925206b8a707096Ed26ae47C84747fE0bb734F59', + '0xD793281182A0e3E023116004778F45c29fc14F19', + '0xc882b111a75c0c657fc507c04fbfcd2cc984f071', + '0x85FAa6C1F2450b9caEA300838981C2e6E120C35c', + '0xeb01f8cdae433e7b55023ff0b2da44c4c712dce2', + ] + }, bitcoin: { owners: [ '14kmvhQrWrNEHbrSKBySj4qHGjemDtS3SF', diff --git a/projects/gearbox/abi.json b/projects/gearbox/abi.json index 22e2e154fc3..56d8f3d468c 100644 --- a/projects/gearbox/abi.json +++ b/projects/gearbox/abi.json @@ -1,460 +1,33 @@ { - "getContractsRegister": { - "inputs": [], - "name": "getContractsRegister", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - "getPoolsCount": { - "inputs": [], - "name": "getPoolsCount", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - "getPools": { - "inputs": [], - "name": "getPools", - "outputs": [ - { "internalType": "address[]", "name": "", "type": "address[]" } - ], - "stateMutability": "view", - "type": "function" - }, - "availableLiquidity": { - "inputs": [], - "name": "availableLiquidity", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - "totalBorrowed": { - "inputs": [], - "name": "totalBorrowed", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - "underlyingToken": { - "inputs": [], - "name": "underlyingToken", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - "getDataCompressor": { - "inputs": [], - "name": "getDataCompressor", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - "getCreditManagersList": { - "inputs": [], - "name": "getCreditManagersList", - "outputs": [ - { - "components": [ - { "internalType": "address", "name": "addr", "type": "address" }, - { - "internalType": "address", - "name": "underlying", - "type": "address" - }, - { "internalType": "address", "name": "pool", "type": "address" }, - { "internalType": "bool", "name": "isWETH", "type": "bool" }, - { "internalType": "bool", "name": "canBorrow", "type": "bool" }, - { - "internalType": "uint256", - "name": "borrowRate", - "type": "uint256" - }, - { "internalType": "uint256", "name": "minAmount", "type": "uint256" }, - { "internalType": "uint256", "name": "maxAmount", "type": "uint256" }, - { - "internalType": "uint256", - "name": "maxLeverageFactor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "availableLiquidity", - "type": "uint256" - }, - { - "internalType": "address[]", - "name": "collateralTokens", - "type": "address[]" - }, - { - "components": [ - { - "internalType": "address", - "name": "allowedContract", - "type": "address" - }, - { - "internalType": "address", - "name": "adapter", - "type": "address" - } - ], - "internalType": "struct ContractAdapter[]", - "name": "adapters", - "type": "tuple[]" - }, - { - "internalType": "uint256[]", - "name": "liquidationThresholds", - "type": "uint256[]" - }, - { "internalType": "uint8", "name": "version", "type": "uint8" }, - { - "internalType": "address", - "name": "creditFacade", - "type": "address" - }, - { - "internalType": "address", - "name": "creditConfigurator", - "type": "address" - }, - { "internalType": "bool", "name": "isDegenMode", "type": "bool" }, - { "internalType": "address", "name": "degenNFT", "type": "address" }, - { - "internalType": "bool", - "name": "isIncreaseDebtForbidden", - "type": "bool" - }, - { - "internalType": "uint256", - "name": "forbiddenTokenMask", - "type": "uint256" - }, - { - "internalType": "uint8", - "name": "maxEnabledTokensLength", - "type": "uint8" - }, - { "internalType": "uint16", "name": "feeInterest", "type": "uint16" }, - { - "internalType": "uint16", - "name": "feeLiquidation", - "type": "uint16" - }, - { - "internalType": "uint16", - "name": "liquidationDiscount", - "type": "uint16" - }, - { - "internalType": "uint16", - "name": "feeLiquidationExpired", - "type": "uint16" - }, - { - "internalType": "uint16", - "name": "liquidationDiscountExpired", - "type": "uint16" - } - ], - "internalType": "struct CreditManagerData[]", - "name": "result", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, + "getContractsRegister": "address:getContractsRegister", + "getPoolsCount": "uint256:getPoolsCount", + "getPools": "address[]:getPools", + "availableLiquidity": "uint256:availableLiquidity", + "totalBorrowed": "uint256:totalBorrowed", + "underlyingToken": "address:underlyingToken", + "getDataCompressor": "address:getDataCompressor", + "getCreditManagersList": "function getCreditManagersList() view returns (tuple(address addr, address underlying, address pool, bool isWETH, bool canBorrow, uint256 borrowRate, uint256 minAmount, uint256 maxAmount, uint256 maxLeverageFactor, uint256 availableLiquidity, address[] collateralTokens, tuple(address allowedContract, address adapter)[] adapters, uint256[] liquidationThresholds, uint8 version, address creditFacade, address creditConfigurator, bool isDegenMode, address degenNFT, bool isIncreaseDebtForbidden, uint256 forbiddenTokenMask, uint8 maxEnabledTokensLength, uint16 feeInterest, uint16 feeLiquidation, uint16 liquidationDiscount, uint16 feeLiquidationExpired, uint16 liquidationDiscountExpired)[] result)", + "calcTotalValue": "function calcTotalValue(address creditAccount) view returns (uint256 total)", "filtersV1": [ - { - "inputs": [], - "name": "creditFilter", - "outputs": [ - { - "internalType": "contract ICreditFilter", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "remainingFunds", - "type": "uint256" - } - ], - "name": "CloseCreditAccount", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "onBehalfOf", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "creditAccount", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "borrowAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "referralCode", - "type": "uint256" - } - ], - "name": "OpenCreditAccount", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - } - ], - "name": "RepayCreditAccount", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "oldOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "TransferAccount", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "liquidator", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "remainingFunds", - "type": "uint256" - } - ], - "name": "LiquidateCreditAccount", - "type": "event" - } + "function creditFilter() view returns (address addr)", + "event CloseCreditAccount(address indexed owner, address indexed to, uint256 remainingFunds)", + "event OpenCreditAccount(address indexed sender, address indexed onBehalfOf, address indexed creditAccount, uint256 amount, uint256 borrowAmount, uint256 referralCode)", + "event RepayCreditAccount(address indexed owner, address indexed to)", + "event TransferAccount(address indexed oldOwner, address indexed newOwner)", + "event LiquidateCreditAccount(address indexed owner, address indexed liquidator, uint256 remainingFunds)" ], "filtersV2": [ - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "onBehalfOf", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "creditAccount", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "borrowAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint16", - "name": "referralCode", - "type": "uint16" - } - ], - "name": "OpenCreditAccount", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "borrower", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - } - ], - "name": "CloseCreditAccount", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "borrower", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "liquidator", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "remainingFunds", - "type": "uint256" - } - ], - "name": "LiquidateCreditAccount", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "oldOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "TransferAccount", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "borrower", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "liquidator", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "remainingFunds", - "type": "uint256" - } - ], - "name": "LiquidateExpiredCreditAccount", - "type": "event" - } + "event OpenCreditAccount(address indexed onBehalfOf, address indexed creditAccount, uint256 borrowAmount, uint16 referralCode)", + "event CloseCreditAccount(address indexed borrower, address indexed to)", + "event LiquidateCreditAccount(address indexed borrower, address indexed liquidator, address indexed to, uint256 remainingFunds)", + "event TransferAccount(address indexed oldOwner, address indexed newOwner)", + "event LiquidateExpiredCreditAccount(address indexed borrower, address indexed liquidator, address indexed to, uint256 remainingFunds)" ], - "calcTotalValue": { - "inputs": [ - { "internalType": "address", "name": "creditAccount", "type": "address" } - ], - "name": "calcTotalValue", - "outputs": [ - { "internalType": "uint256", "name": "total", "type": "uint256" } - ], - "stateMutability": "view", - "type": "function" - } -} + "creditManagerV2": [ + "function creditFacade() view returns (address addr)", + "event NewConfigurator(address indexed newConfigurator)" + ], + "creditConfiguratorV2": [ + "event CreditFacadeUpgraded(address indexed newCreditFacade)" + ] +} \ No newline at end of file diff --git a/projects/gearbox/events.js b/projects/gearbox/events.js index a8dcaf42a5a..49d5ec104eb 100644 --- a/projects/gearbox/events.js +++ b/projects/gearbox/events.js @@ -1,48 +1,99 @@ -const { api } = require("@defillama/sdk"); -const { providers } = require("@defillama/sdk/build/general"); +const { api, api2 } = require("@defillama/sdk"); const { Contract, BigNumber } = require("ethers"); +const sdk = require('@defillama/sdk') const abi = require("./abi.json"); -const getV2CAs = async (creditFacade, block) => { +function getProvider(network) { + const chainApi = new sdk.ChainApi(network) + return chainApi.provider +} + +const getV2CAs = async (creditManager, block) => { const eventsByDate = []; const accounts = new Set(); + const cm = new Contract( + creditManager, + abi["creditManagerV2"], + getProvider("ethereum") + ); + const creditFacade = await cm.creditFacade(); + + const ccAddrs = ( + await cm.queryFilter( + { + address: creditManager, + topics: [cm.interface.getEventTopic("NewConfigurator")], + }, + undefined + ) + ).map((e) => e.args.newConfigurator); + + const cfAddrs = []; + + for (let cca of ccAddrs) { + const cc = new Contract( + cca, + abi["creditConfiguratorV2"], + getProvider("ethereum") + ); + + const cfs = ( + await cc.queryFilter( + { + address: cca, + topics: [cc.interface.getEventTopic("CreditFacadeUpgraded")], + }, + undefined + ) + ).map((e) => e.args.newCreditFacade); + + cfAddrs.push(...cfs); + } + const addToEvents = (e, address, operation) => { eventsByDate.push({ time: e.blockNumber * 100000 + e.logIndex, address, operation, + ca: e.args.creditAccount ? e.args.creditAccount : null, + cf: creditFacade, }); }; - const cf = new Contract( - creditFacade, - abi["filtersV2"], - providers["ethereum"] - ); - - const topics = { - OpenCreditAccount: cf.interface.getEventTopic("OpenCreditAccount"), - CloseCreditAccount: cf.interface.getEventTopic("CloseCreditAccount"), - LiquidateCreditAccount: cf.interface.getEventTopic( - "LiquidateCreditAccount" - ), - LiquidateExpiredCreditAccount: cf.interface.getEventTopic( - "LiquidateExpiredCreditAccount" - ), - TransferAccount: cf.interface.getEventTopic("TransferAccount"), - }; - - const logs = ( - await cf.queryFilter( - { - address: creditFacade, - topics: [Object.values(topics)], - }, - undefined - ) - ).map((log) => cf.interface.parseLog(log)); + const logs = []; + + for (let cfAddr of cfAddrs) { + const cf = new Contract(cfAddr, abi["filtersV2"], getProvider("ethereum")) + + const topics = { + OpenCreditAccount: cf.interface.getEventTopic("OpenCreditAccount"), + CloseCreditAccount: cf.interface.getEventTopic("CloseCreditAccount"), + LiquidateCreditAccount: cf.interface.getEventTopic( + "LiquidateCreditAccount" + ), + LiquidateExpiredCreditAccount: cf.interface.getEventTopic( + "LiquidateExpiredCreditAccount" + ), + TransferAccount: cf.interface.getEventTopic("TransferAccount"), + }; + const l = ( + await cf.queryFilter( + { + address: cfAddr, + topics: [Object.values(topics)], + }, + undefined + ) + ).map((log) => ({ + ...cf.interface.parseLog(log), + blockNumber: log.blockNumber, + logIndex: log.logIndex, + })); + + logs.push(...l); + } logs.forEach((log) => { switch (log.name) { @@ -63,7 +114,7 @@ const getV2CAs = async (creditFacade, block) => { eventsByDate .sort((a, b) => { - return a.time > b.time ? 1 : -1; + return a.time - b.time; }) .forEach((e) => { if (e.operation === "add") { @@ -75,9 +126,10 @@ const getV2CAs = async (creditFacade, block) => { const openCAs = Array.from(accounts.values()).map( (borrower) => - logs.find( - (log) => log.args.onBehalfOf && log.args.onBehalfOf === borrower - ).args.creditAccount + logs + .sort((a, b) => b.blockNumber - a.blockNumber) + .find((log) => log.args.onBehalfOf && log.args.onBehalfOf === borrower) + .args.creditAccount ); const { output: totalValue } = await api.abi.multiCall({ @@ -89,13 +141,18 @@ const getV2CAs = async (creditFacade, block) => { block, }); - return totalValue - .map((t) => t.output) - .reduce((a, c) => a.add(BigNumber.from(c)), BigNumber.from("0")) - .toString(); + return totalValue[0] + ? totalValue + .map((t) => t.output) + .reduce((a, c) => a.add(BigNumber.from(c)), BigNumber.from("0")) + .toString() + : "0"; }; const getV1CAs = async (creditManager, block) => { + if (creditManager === "0x4C6309fe2085EfE7A0Cfb426C16Ef3b41198cCE3") { + return "0"; + } const eventsByDate = []; const accounts = new Set(); @@ -110,7 +167,7 @@ const getV1CAs = async (creditManager, block) => { const cm = new Contract( creditManager, abi["filtersV1"], - providers["ethereum"] + getProvider("ethereum") ); const cf = await cm.creditFilter(); @@ -132,7 +189,11 @@ const getV1CAs = async (creditManager, block) => { }, undefined ) - ).map((log) => cm.interface.parseLog(log)); + ).map((log) => ({ + ...cm.interface.parseLog(log), + blockNumber: log.blockNumber, + logIndex: log.logIndex, + })); logs.forEach((log) => { switch (log.name) { @@ -152,7 +213,7 @@ const getV1CAs = async (creditManager, block) => { }); eventsByDate .sort((a, b) => { - return a.time > b.time ? 1 : -1; + return a.time - b.time; }) .forEach((e) => { if (e.operation === "add") { @@ -169,19 +230,18 @@ const getV1CAs = async (creditManager, block) => { ).args.creditAccount ); - const { output: totalValue } = await api.abi.multiCall({ + const totalValue = await api2.abi.multiCall({ abi: abi["calcTotalValue"], - calls: openCAs.map((addr) => ({ - target: cf, - params: [addr], - })), + target: cf, + calls: openCAs.filter( + (i) => i !== "0xaBBd655b3791175113c1f1146D3B369494A2b815" + ), // filtered out address throwing error block, }); return totalValue - .map((t) => t.output) .reduce((a, c) => a.add(BigNumber.from(c)), BigNumber.from("0")) .toString(); }; -module.exports = { getV1CAs, getV2CAs }; +module.exports = { getV1CAs, getV2CAs }; \ No newline at end of file diff --git a/projects/gearbox/index.js b/projects/gearbox/index.js index 56f29be8c3e..11e8fd95bb5 100644 --- a/projects/gearbox/index.js +++ b/projects/gearbox/index.js @@ -1,6 +1,5 @@ const sdk = require("@defillama/sdk"); -const { sumTokensExport, sumTokens2 } = require("../helper/unwrapLPs.js"); -const { tokensBare: tokens } = require("../helper/tokenMapping"); +const { sumTokens2 } = require("../helper/unwrapLPs.js"); const abi = require("./abi.json"); const { getV2CAs, getV1CAs } = require("./events"); @@ -28,7 +27,9 @@ const getPoolAddrs = async (block) => { const { output: poolsUnderlying } = await sdk.api.abi.multiCall({ abi: abi["underlyingToken"], - calls: pools.map((pool) => ({ target: pool })), + calls: pools + .filter((p) => p != "0xB8cf3Ed326bB0E51454361Fb37E9E8df6DC5C286") // RM wstETH pool + .map((pool) => ({ target: pool })), block, }); const tokensAndOwners = poolsUnderlying.map((t) => [ @@ -36,18 +37,7 @@ const getPoolAddrs = async (block) => { t.input.target, ]); - // Fetch ba;anes of tokens available to fetch - // const { output: totalBorrowed } = await sdk.api.abi.multiCall({ - // abi: abi["availableLiquidity"], - // calls: pools.map((pool) => ({ target: pool })), - // block, - // }); - - const poolBalances = {}; - // totalBorrowed.forEach(({ output }, i) => - // sdk.util.sumSingleBalance(poolBalances, poolsUnderlying[i].output, output) - // ); - + let poolBalances = {}; return { tokensAndOwners, poolBalances }; }; @@ -78,7 +68,7 @@ const getV2TVL = async (block) => { // Get all CA Balances const caValues = await Promise.all( - creditManagers.map((cm) => getV2CAs(cm.creditFacade, block)) + creditManagers.map((cm) => getV2CAs(cm.addr, block)) ); return creditManagers.map((cm, i) => ({ @@ -112,16 +102,17 @@ const getV1TVL = async (block) => { const tvl = async (timestamp, block) => { // Pool TVL (Current token balances) const { poolBalances, tokensAndOwners } = await getPoolAddrs(block); + // V1 CreditAccounts TVL + const v1Balances = await getV1TVL(block); // V2 CreditAccounts TVL in USD const v2Balances = await getV2TVL(block); - // V1 CreditAccounts TVL - const v1Balances = await getV1TVL(block); - [...v1Balances, ...v2Balances].forEach(i => { - sdk.util.sumSingleBalance(poolBalances,i.token,i.bal) - tokensAndOwners.push([i.token, i.addr]) - }) + // Merge all balances for each token + [...v1Balances, ...v2Balances].forEach((i) => { + sdk.util.sumSingleBalance(poolBalances, i.token, i.bal); + tokensAndOwners.push([i.token, i.addr]); + }); return sumTokens2({ balances: poolBalances, @@ -131,19 +122,10 @@ const tvl = async (timestamp, block) => { }; module.exports = { + hallmarks: [[1666569600, "LM begins"]], ethereum: { tvl, - treasury: sumTokensExport({ - owner: "0x7b065Fcb0760dF0CEA8CFd144e08554F3CeA73D1", - tokens: [ - tokens.weth, - tokens.wbtc, - tokens.usdc, - tokens.dai, - "0x7f39c581f595b53c5cb19bd0b3f8da6c935e2ca0", // wseth - ], - }), }, methodology: `Retrieves the tokens in each Gearbox pool (WETH/DAI/WBTC/USDC/wstETH) & value of all Credit Accounts (V1 & V2) denominated in the underlying token.`, misrepresentedTokens: true, -}; +}; \ No newline at end of file diff --git a/projects/geist/index.js b/projects/geist/index.js index 491cb2b8028..7596e5a3d75 100644 --- a/projects/geist/index.js +++ b/projects/geist/index.js @@ -33,6 +33,6 @@ module.exports = { pool2: pool2(stakingContractPool2, GEIST_WFTM_spLP, "fantom"), }, hallmarks:[ - [1665090175, "BSC Bridge exploit"] + [1665090175, "BSC Bridge hacker deposits coins"] ], }; diff --git a/projects/gemswap/index.js b/projects/gemswap/index.js new file mode 100644 index 00000000000..49c8d251942 --- /dev/null +++ b/projects/gemswap/index.js @@ -0,0 +1,14 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports = { + hallmarks: [ + [1681430400,"Rug Pull"] + ], + misrepresentedTokens: true, + era: { + tvl: getUniTVL({ + factory: '0x065c8703132F2A38Be3d2dbF7Be6BE455930560c', + useDefaultCoreAssets: true, + }) + }, +}; \ No newline at end of file diff --git a/projects/genesis/abi.json b/projects/genesis/abi.json index 316067c0372..f163c37aeda 100644 --- a/projects/genesis/abi.json +++ b/projects/genesis/abi.json @@ -1,41 +1,3 @@ { - "poolInfo": { - "type":"function", - "stateMutability":"view", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "lpToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "allocPoint", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastRewardBlock", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accGenesisPerShare", - "type": "uint256" - }, - { - "internalType": "uint16", - "name": "depositFeeBP", - "type": "uint16" - } - ], - "name":"poolInfo", - "inputs":[ - { - "type":"uint256", - "name":"", - "internalType":"uint256" - } - ] - } -} + "poolInfo": "function poolInfo(uint256) view returns (address lpToken, uint256 allocPoint, uint256 lastRewardBlock, uint256 accGenesisPerShare, uint16 depositFeeBP)" +} \ No newline at end of file diff --git a/projects/genesys/index.js b/projects/genesys/index.js index cc37f179afd..eeee8769f9e 100644 --- a/projects/genesys/index.js +++ b/projects/genesys/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const {addFundsInMasterChef} = require("../helper/masterchef"); const {pool2Exports} = require("../helper/pool2"); const {staking} = require("../helper/staking") @@ -15,8 +16,8 @@ async function tvl(timestamp, block, chainBlocks) { let balances = {}; await addFundsInMasterChef(balances, masterchef, chainBlocks.fantom, "fantom", addr=>{ addr = addr.toLowerCase(); - if (addr === "0x8d11ec38a3eb5e956b052f67da8bdc9bef8abf3e") { - return "0x6b175474e89094c44da98b954eedeac495271d0f" + if (addr === ADDRESSES.fantom.DAI) { + return ADDRESSES.ethereum.DAI } return `fantom:${addr}` }, undefined, ignore); diff --git a/projects/genius-yield/index.js b/projects/genius-yield/index.js new file mode 100644 index 00000000000..acf99924304 --- /dev/null +++ b/projects/genius-yield/index.js @@ -0,0 +1,17 @@ +const { sumTokensExport, } = require('../helper/chain/cardano') + +const gens = 'dda5fdb1002f7389b33e036b6afee82a8189becb6cba852e8b79b4fb0014df1047454e53' +const nmkr = '5dac8536653edc12f6f5e1045d8164b9f59998d3bdc300fc928434894e4d4b52' +const ntx = 'edfd7a1d77bcb8b884c474bdc92a16002d1fb720e454fa6e993444794e5458' +const emp = '6c8642400e8437f737eb86df0fc8a8437c760f48592b1ba8f5767e81456d706f7761' +const gensx = 'fbae99b8679369079a7f6f0da14a2cf1c2d6bfd3afdf3a96a64ab67a0014df1047454e5358' + +const owner = 'addr1w8r99sv75y9tqfdzkzyqdqhedgnef47w4x7y0qnyts8pznq87e4wh' + +module.exports = { + timetravel: false, + cardano: { + staking: sumTokensExport({ owner, tokens: [gens, nmkr, ntx, emp, gensx]}), + tvl: () => ({}) + } +}; diff --git a/projects/genius/genius-abi.json b/projects/genius/genius-abi.json new file mode 100644 index 00000000000..164f70954b6 --- /dev/null +++ b/projects/genius/genius-abi.json @@ -0,0 +1,4 @@ +{ + "basicLockedSupply": "function basicLockedSupply() view returns (uint256)", + "advLockedSupply": "function advLockedSupply() view returns (uint256)" +} diff --git a/projects/genius/genius-stability-abi.json b/projects/genius/genius-stability-abi.json new file mode 100644 index 00000000000..40c117a97b7 --- /dev/null +++ b/projects/genius/genius-stability-abi.json @@ -0,0 +1,3 @@ +{ + "totalSettledGenitos": "function totalSettledGenitos() view returns (uint256)" +} diff --git a/projects/genius/index.js b/projects/genius/index.js new file mode 100644 index 00000000000..ea96901d1a8 --- /dev/null +++ b/projects/genius/index.js @@ -0,0 +1,108 @@ +const ADDRESSES = require('../helper/coreAssets.json') +/* Genius staking operates on two models: +* - Direct staking with GENI token. +* - Policy: Basic (basicLockedMinersSupply()) +* Lower APR, no penalties for early or late end staking. +* - Policy: Advanced (advLockedMinersSupply()) +* Higher APR, penalties for early or late end staking. +* - Debt based staking with deposited collateral +* Collateral deposits enables GENI borrow. +* GENI is locked back in the pool when the collateral debt is settled +* Locked GENI are waiting for collateral to be settled for it. +* While it's waiting it is generating yield. +* +* `Staking` and `mining` are used interchangeably in Genius +* +* Genius TVL is the sum of all locked supported collateral in the debt pool +* The list of supported collateral is provided. +* +* */ +const sdk = require("@defillama/sdk"); +const { sumTokens2, nullAddress, } = require('../helper/unwrapLPs') + +const geniusAbi = require("./genius-abi.json"); +const stabilityAbi = require("./genius-stability-abi.json"); + +/* Genius staking contract*/ +const GENIUS_CONTRACT = "0x444444444444C1a66F394025Ac839A535246FCc8"; +/* Genius stability pool / debt contract*/ +const STABILITY_POOL = "0xDCA692d433Fe291ef72c84652Af2fe04DA4B4444"; + +/* Native currencies and ERC-20 tokens approved for collateral*/ +const STABILITY_POOL_COLLATERAL_ADDRESSES = { + "bsc": { + "BUSD": ADDRESSES.bsc.BUSD, + "BNB": nullAddress, + }, + "ethereum": { + "DAI": ADDRESSES.ethereum.DAI, + "ETH": nullAddress, + }, + "avax": { + "USDC": ADDRESSES.avax.USDC, + "AVAX": nullAddress, + }, + "polygon": { + "DAI": ADDRESSES.polygon.DAI, + "MATIC": nullAddress, + }, + "pulse": { + "DAI": ADDRESSES.pulse.DAI, + "PLS": nullAddress + } +}; + +async function tvl(_, _1, _2, { api }) { + return sumTokens2({ api, owner: STABILITY_POOL, tokens: Object.values(STABILITY_POOL_COLLATERAL_ADDRESSES[api.chain])}) +} + +async function staking(_, _1, _2, { api }) { + // return sumTokens2({ api, owner: STABILITY_POOL, tokens: [GENIUS_CONTRACT]}) + const balances = {}; + /* Collect Basic miner locked */ + const basicLockedMinersSupply = await api.call({ + target: GENIUS_CONTRACT, + abi: geniusAbi.basicLockedSupply + }); + /* Collect Advanced miner locked */ + const advLockedMinersSupply = await api.call({ + target: GENIUS_CONTRACT, + abi: geniusAbi.advLockedSupply + }); + /* Collect settled GENI in stability pool (locked waiting for collateral return) */ + const totalSettledGenitos = await api.call({ + target: STABILITY_POOL, + abi: stabilityAbi.totalSettledGenitos + }); + sdk.util.sumSingleBalance(balances, GENIUS_CONTRACT, basicLockedMinersSupply); + sdk.util.sumSingleBalance(balances, GENIUS_CONTRACT, advLockedMinersSupply); + sdk.util.sumSingleBalance(balances, GENIUS_CONTRACT, totalSettledGenitos); + return balances; +} + +module.exports = { + methodology: +`Staking: counts the number of GENI tokens locked in Basic and Advanced miners per chain. +TVL: counts total number of value locked of all collateral tokens and native in the debt pool per chain. +`, + ethereum: { + staking, + tvl + }, + bsc: { + staking, + tvl + }, + polygon: { + staking, + tvl + }, + avax: { + staking, + tvl + }, + pulse: { + staking, + tvl + }, +}; diff --git a/projects/genshiro/api.js b/projects/genshiro/api.js index dfb01c29f5e..ac573fa4966 100644 --- a/projects/genshiro/api.js +++ b/projects/genshiro/api.js @@ -263,7 +263,7 @@ const ASSETS = [ const PRECISION = new BN(1_000_000_000); async function tvl() { - const provider = new WsProvider("wss://node.genshiro.io"); + const provider = new WsProvider("wss://node5.genshiro.io"); const api = await ApiPromise.create({ provider, types }); const queries = ASSETS.map(({ code }) => { diff --git a/projects/genshiro/index.js b/projects/genshiro/index.js index ea2ed9934e2..e940d249d94 100644 --- a/projects/genshiro/index.js +++ b/projects/genshiro/index.js @@ -2,5 +2,8 @@ const { getExports } = require('../helper/heroku-api') module.exports = { timetravel: false, - ...getExports("genshiro", ['genshiro']) + // ...getExports("genshiro", ['genshiro']), + genshiro: { + tvl: async () => ({}), + } } \ No newline at end of file diff --git a/projects/geode/abis/avax/DWP.json b/projects/geode/abis/avax/DWP.json deleted file mode 100644 index e9dd7d49304..00000000000 --- a/projects/geode/abis/avax/DWP.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "abi": [ - { - "inputs": [ - { - "internalType": "uint8", - "name": "index", - "type": "uint8" - } - ], - "name": "getTokenBalance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } - ] -} diff --git a/projects/geode/abis/avax/Portal.json b/projects/geode/abis/avax/Portal.json deleted file mode 100644 index 5d39456e669..00000000000 --- a/projects/geode/abis/avax/Portal.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "address": "0x4fe8C658f268842445Ae8f95D4D6D8Cfd356a8C8", - "abi": [ - { - "inputs": [ - { - "internalType": "uint256", - "name": "_type", - "type": "uint256" - } - ], - "name": "getIdsByType", - "outputs": [ - { - "internalType": "uint256[]", - "name": "", - "type": "uint256[]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_id", - "type": "uint256" - } - ], - "name": "planetWithdrawalPool", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } - ] -} diff --git a/projects/geode/abis/avax/gAVAX.json b/projects/geode/abis/avax/gAVAX.json deleted file mode 100644 index 60035a05246..00000000000 --- a/projects/geode/abis/avax/gAVAX.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "address": "0x6026a85e11bd895c934af02647e8c7b4ea2d9808", - "abi": [ - { - "inputs": [ - { - "internalType": "uint256", - "name": "id", - "type": "uint256" - } - ], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_id", - "type": "uint256" - } - ], - "name": "pricePerShare", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } - ] -} diff --git a/projects/geode/index.js b/projects/geode/index.js index 3f4b509dbda..5d2de65fc08 100644 --- a/projects/geode/index.js +++ b/projects/geode/index.js @@ -1,11 +1,10 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const BigNumber = require("bignumber.js"); -const PORTAL = require("./abis/avax/Portal.json"); -const gAVAX = require("./abis/avax/gAVAX.json"); -const DWP = require("./abis/avax/DWP.json"); - -const transformAddress = (addr) => `avax:${addr}`; +const PORTAL = { + address: "0x4fe8C658f268842445Ae8f95D4D6D8Cfd356a8C8" +}; async function avax(timestamp, ethBlock, chainBlocks) { const chain = "avax"; @@ -18,7 +17,7 @@ async function avax(timestamp, ethBlock, chainBlocks) { block: block, target: PORTAL.address, params: planetType, - abi: PORTAL.abi.find((abi) => abi.name === "getIdsByType"), + abi: 'function getIdsByType(uint256 _type) view returns (uint256[])', chain, }) ).output; @@ -30,8 +29,8 @@ async function avax(timestamp, ethBlock, chainBlocks) { calls: planetIds.map((id) => ({ params: id, })), - target: gAVAX.address, - abi: gAVAX.abi.find((abi) => abi.name === "totalSupply"), + target: "0x6026a85e11bd895c934af02647e8c7b4ea2d9808", + abi: "function totalSupply(uint256 id) view returns (uint256)", chain, }) ).output; @@ -42,8 +41,8 @@ async function avax(timestamp, ethBlock, chainBlocks) { calls: planetIds.map((id) => ({ params: id, })), - target: gAVAX.address, - abi: gAVAX.abi.find((abi) => abi.name === "pricePerShare"), + target: "0x6026a85e11bd895c934af02647e8c7b4ea2d9808", + abi: "function pricePerShare(uint256 _id) view returns (uint256)", chain, }) ).output; @@ -56,7 +55,7 @@ async function avax(timestamp, ethBlock, chainBlocks) { params: id, })), target: PORTAL.address, - abi: PORTAL.abi.find((abi) => abi.name === "planetWithdrawalPool"), + abi: 'function planetWithdrawalPool(uint256 _id) view returns (address)', chain, }) ).output; @@ -68,7 +67,7 @@ async function avax(timestamp, ethBlock, chainBlocks) { target: dwpOfId.output, params: 0, })), - abi: DWP.abi.find((abi) => abi.name === "getTokenBalance"), + abi: 'function getTokenBalance(uint8 index) view returns (uint256)', chain, }) ).output; @@ -80,7 +79,7 @@ async function avax(timestamp, ethBlock, chainBlocks) { }, 0); return { - "avax:0x0000000000000000000000000000000000000000": TotalBalance + ["avax:" + ADDRESSES.null]: TotalBalance }; } diff --git a/projects/gfs/index.js b/projects/gfs/index.js index 126a9ee0fe3..d012c7a63fc 100644 --- a/projects/gfs/index.js +++ b/projects/gfs/index.js @@ -1,8 +1,9 @@ +const ADDRESSES = require('../helper/coreAssets.json') const contracts = require("./contracts.json"); const { sumLPWithOnlyOneToken } = require("./../helper/unwrapLPs"); const iotx = "0x6fb3e0a217407efff7ca062d46c26e5d60a14d69"; -const wiotx = "0xA00744882684C3e4747faEFD68D283eA44099D03"; +const wiotx = ADDRESSES.iotex.WIOTX; function pool2(chain, gasToken) { return async (timestamp, _, {[chain]: block}) => { diff --git a/projects/gft/index.js b/projects/gft/index.js index 8f4e59060df..7dbbbad2016 100644 --- a/projects/gft/index.js +++ b/projects/gft/index.js @@ -1,10 +1,11 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const contracts = require("./contracts.json"); const { sumLPWithOnlyOneToken } = require("./../helper/unwrapLPs"); const BigNumber = require("bignumber.js"); const iotx = "0x6fb3e0a217407efff7ca062d46c26e5d60a14d69"; -const wiotx = "0xA00744882684C3e4747faEFD68D283eA44099D03"; +const wiotx = ADDRESSES.iotex.WIOTX; const gfsBonusStackPool = "0x4346a618c2e3fd4cfa821e91216eaf927bd46ddd"; const gfs = "0x5d0f4ca481fd725c9bc6b415c0ce5b3c3bd726cf"; diff --git a/projects/ghast/index.js b/projects/ghast/index.js new file mode 100644 index 00000000000..35abcaeb6d4 --- /dev/null +++ b/projects/ghast/index.js @@ -0,0 +1,29 @@ +const { sumTokens2 } = require('../helper/unwrapLPs') + +const config = { + arbitrum: { + lendingPools: { + BTC: '0x711b36a726486bd910a819eb7930e60a1afcac7b', + USDC: '0xb8bc618e49201B68C1D594aA458aeBFF22B03c35', + WETH: '0x5d99d1d2e9f3a5f3d8f5dd5ce533b3635590c384', + } + } +} + +Object.keys(config).forEach(chain => { + const { lendingPools } = config[chain] + const pools = Object.values(lendingPools) + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const tokens = await api.multiCall({ abi: 'address:TOKEN', calls: pools}) + const gmdTokens = await api.multiCall({ abi: 'address:gmdTOKEN', calls: pools}) + const ownerTokens = pools.map((v, i) => [[tokens[i],gmdTokens[i],], v]) + return sumTokens2({ api, ownerTokens, }) + }, + /* borrowed: async (_, _b, _cb, { api, }) => { + const tokens = await api.multiCall({ abi: 'address:gmdTOKEN', calls: pools}) + const bals = await api.multiCall({ abi: 'uint256:totalBorrows', calls: pools}) + api.addTokens(tokens, bals) + }, */ + } +}) \ No newline at end of file diff --git a/projects/ghost/index.js b/projects/ghost/index.js new file mode 100644 index 00000000000..e1cd7484fcd --- /dev/null +++ b/projects/ghost/index.js @@ -0,0 +1,41 @@ +const { + queryContracts, + queryContract, +} = require("../helper/chain/cosmos"); +const { getConfig } = require("../helper/cache"); + +async function tvl(_, _1, _2, { api }) { + const chain = api.chain + const contracts = await getConfig("kujira/contracts", "https://raw.githubusercontent.com/Team-Kujira/kujira.js/master/src/resources/contracts.json"); + const vaultContracts = contracts["kaiyo-1"].ghostVault.map(x => x.address) + const marketContracts = contracts["kaiyo-1"].ghostMarket.map(x => x.address) + for (const contract of vaultContracts) { + const { deposited, borrowed } = await queryContract({ contract, chain, data: { status: {} } }) + const { denom } = await queryContract({ contract, chain, data: { config: {} } }) + api.add(denom, deposited - borrowed) + } + + for (const contract of marketContracts) { + const { deposited } = await queryContract({ contract, chain, data: { status: {} } }) + const { collateral_denom } = await queryContract({ contract, chain, data: { config: {} } }) + api.add(collateral_denom, deposited) + } +} + +async function borrowed(_, _1, _2, { api }) { + const chain = api.chain + const vaultContracts = await queryContracts({ chain, codeId: 106 }); + for (const contract of vaultContracts) { + const { borrowed } = await queryContract({ contract, chain, data: { status: {} } }) + const { denom } = await queryContract({ contract, chain, data: { config: {} } }) + api.add(denom, borrowed) + } +} + +module.exports = { + timetravel: false, + kujira: { + tvl, + borrowed, + }, +}; diff --git a/projects/gizadao/index.js b/projects/gizadao/index.js index e336680bf83..f5832bba8a0 100644 --- a/projects/gizadao/index.js +++ b/projects/gizadao/index.js @@ -1,13 +1,14 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { ohmTvl } = require('../helper/ohm') const transforms = { - "0x8d11ec38a3eb5e956b052f67da8bdc9bef8abf3e": "0x6b175474e89094c44da98b954eedeac495271d0f", // DAI + [ADDRESSES.fantom.DAI]: ADDRESSES.ethereum.DAI, // DAI } const treasury = "0x6e273a49Ba8F77d03C0CF5a190f226DcA7D46E9F" module.exports = ohmTvl(treasury, [ //DAI - ["0x8d11ec38a3eb5e956b052f67da8bdc9bef8abf3e", false], + [ADDRESSES.fantom.DAI, false], //spirit LP ["0x9026711a2097252a198e6602a052117eaa5f3cab", true], //spirit LP diff --git a/projects/glacier-finance/index.js b/projects/glacier-finance/index.js new file mode 100644 index 00000000000..0eef46a93db --- /dev/null +++ b/projects/glacier-finance/index.js @@ -0,0 +1,10 @@ +const { getUniTVL } = require("../helper/unknownTokens"); +const { staking, stakingPricedLP } = require('../helper/staking'); + +module.exports = { + misrepresentedTokens: true, + avax: { + tvl: getUniTVL({ factory: '0xaC7B7EaC8310170109301034b8FdB75eCa4CC491', useDefaultCoreAssets: true, hasStablePools: true }), + staking: stakingPricedLP("0xed1eE3f892fe8a13A9BE02F92E8FB7410AA84739", "0x3712871408a829C5cd4e86DA1f4CE727eFCD28F6", "avax", "0x2071a39da7450d68e4f4902774203df208860da2", "avalanche-2"), + }, +}; diff --git a/projects/glif/index.js b/projects/glif/index.js new file mode 100644 index 00000000000..195fead9a62 --- /dev/null +++ b/projects/glif/index.js @@ -0,0 +1,34 @@ +const { BigNumber } = require("@ethersproject/bignumber"); +const { nullAddress } = require("../helper/tokenMapping"); +const { get } = require("../helper/http"); + +const INFINITY_POOL_CONTRACT = "0x43dAe5624445e7679D16a63211c5ff368681500c"; // pool address +const totalAssetsABI = "function totalAssets() view returns (uint256)"; +const totalBorrowedABI = "function totalBorrowed() view returns (uint256)"; + +module.exports = { + methodology: + "The GLIF Pools protocol is a liquid staking protocol for Filecoin that requires borrowers to collateralize FIL in order to borrow for their storage providing operation. This TVL calculation adds the total amount of FIL staked into the protocol, and the total amount of locked FIL collateral by borrowers, to arrive at TVL.", + filecoin: { + tvl: async (_, _1, _2, { api }) => { + const [totalAssets, totalLockedByMiners] = await Promise.all([ + api.call({ abi: totalAssetsABI, target: INFINITY_POOL_CONTRACT }), + // this call is too costly to perform on chain in this environment, + // we wrapped the locked miners collateral in a server that derives the information directly on-chain + // but serves it in a more efficient manner to not overload defillama frontend + // github repo: https://github.com/glifio/pools-metrics + get("https://pools-metrics.vercel.app/api/v0/miner-collaterals"), + ]); + + const totalAssetsBN = BigNumber.from(totalAssets); + const totalLockedByMinersBN = BigNumber.from( + totalLockedByMiners.totalMinerCollaterals + ); + // then we add the totalLockedByMiners to the totalAssets, to account for the FIL locked by miners as borrow collateral + // this gets our tvl in attoFIL (wei denominated) without double counting + const tvl = totalAssetsBN.add(totalLockedByMinersBN).toString(); + + api.add(nullAddress, tvl); + }, + }, +}; diff --git a/projects/glitter-finance/index.js b/projects/glitter-finance/index.js index f533f7f1106..10fbbb5e50a 100644 --- a/projects/glitter-finance/index.js +++ b/projects/glitter-finance/index.js @@ -1,51 +1,10 @@ - +const ADDRESSES = require('../helper/coreAssets.json') //Solana Helpers -const { - sumTokens2, -} = require("../helper/solana"); - -//Algorand Helpers -const axios = require('axios') -const axiosObj = axios.create({ - baseURL: 'https://algoindexer.algoexplorerapi.io', - timeout: 300000, -}) - +const { sumTokensExport, } = require("../helper/sumTokens") //addresses const SOLANA_VAULT = "7xCU4nvqu3Nz3BBQckKzibp3kBav4xbkuqQ3WM9CBHdJ"; const ALGO_VAULT = "R7VCOR74LCUIFH5WKCCMZOS7ADLSDBQJ42YURFPDT3VGYTVNBNG7AIYTCQ"; -//TVL Calculations: -async function solana_tvl() { - return sumTokens2({ solOwners: [SOLANA_VAULT]}) -} -async function algorand_tvl() { - - const tvlResult = {}; - - //Get algo balance from Algo Vault - const algo_account = await getAlgoBalance(ALGO_VAULT); - var amount_algo = 0; - - //Ensure that the response is valid & set amount - if (algo_account && algo_account.account && algo_account.account.amount) { - amount_algo = algo_account.account.amount / 1000000; //Amount returned in microAlgos - } - - if (!tvlResult["algorand"]) { - tvlResult["algorand"] = Number(amount_algo); - } else { - tvlResult["algorand"] += Number(amount_algo); - } - - return tvlResult; -} - -async function getAlgoBalance(address) { - const response = (await axiosObj.get(`/v2/accounts/${address}`)) - return response.data -} - module.exports = { hallmarks: [ [1661337600, "SPL Vault Migration (V2 Expansion)"], @@ -53,6 +12,6 @@ module.exports = { timetravel: false, methodology: "TVL counts tokens and native assets locked in Glitter-Finance bridge vaults. CoinGecko is used to find the price of tokens in USD.", - solana: { tvl: solana_tvl }, - algorand: { tvl: algorand_tvl}, + solana: { tvl: sumTokensExport({ solOwners: [SOLANA_VAULT], }) }, + algorand: { tvl: sumTokensExport({ owners: [ALGO_VAULT] }) }, }; \ No newline at end of file diff --git a/projects/gmcash/abi.json b/projects/gmcash/abi.json new file mode 100644 index 00000000000..1695a7e2cdf --- /dev/null +++ b/projects/gmcash/abi.json @@ -0,0 +1,5 @@ +{ + "poolInfo": "function poolInfo(uint256) view returns (address token, uint256 allocPoint, uint256 accGmcPerShare, bool isStarted)", + "poolLength": "uint256:poolLength" +} + diff --git a/projects/gmcash/index.js b/projects/gmcash/index.js new file mode 100644 index 00000000000..1ecfdeb0628 --- /dev/null +++ b/projects/gmcash/index.js @@ -0,0 +1,25 @@ +const { masterchefExports, sumTokensExport, } = require('../helper/unknownTokens'); +const { mergeExports } = require("../helper/utils"); + +const masterChefCASH = "0xa4De1bCf1CBFc0d675c7a49Cd7d6aD132a35F15d"; +const CASH = "0x654C908305021b2eaF881cEe774ECe1D2BCac5fc"; + +const masterChefSHARE = "0x18ac4eB45E3eE74bDeD0B97E0D08f2A3ca992F7e"; +const SHARE = "0x0f96d8c1277BD75A251238af952A7A99Db1320E3"; + +const boardroom = "0x9D0047E9D09245cb18d2D3Ec7D48515A067086B1" +const nativeTokens = [CASH, SHARE] +const chain = 'arbitrum' + +const lps = [ + '0x694c9e9d7778e2a9e4a0dc7d112141b130ebacd3', + '0x85c4afd95c8dcea58fa608e34bf344a54647f84b', +] + +module.exports = mergeExports([ + masterchefExports({ chain, nativeTokens, masterchef: masterChefCASH, useDefaultCoreAssets: true, lps, }), + masterchefExports({ chain, nativeTokens, masterchef: masterChefSHARE, useDefaultCoreAssets: true, lps, }), + { + arbitrum: { staking: sumTokensExport({ owner: boardroom, tokens: nativeTokens, lps, })} + } +]) \ No newline at end of file diff --git a/projects/gmd/index.js b/projects/gmd/index.js index cbc6638257c..7148a96e563 100644 --- a/projects/gmd/index.js +++ b/projects/gmd/index.js @@ -1,32 +1,57 @@ const sdk = require("@defillama/sdk"); const { staking } = require("../helper/staking"); -const chain = 'arbitrum'; -const abi = {"inputs":[],"name":"GLPinVault","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"} -const vault = "0xA7Ce4434A29549864a46fcE8662fD671c06BA49a"; -const stakingAdd = "0x8A19F6BC381caf24C7122296AA51047105924074"; -const GMDaddress = "0x4945970EfeEc98D393b4b979b9bE265A3aE28A8B"; -const stakedGLPaddress = "0x1aDDD80E6039594eE970E5872D247bf0414C8903"; -const GLP_ADDRESS = "0x4277f8F2c384827B5273592FF7CeBd9f2C1ac258"; - -const Tvl = async (timestamp, ethBlock, { arbitrum: block }) => { + +const abi = 'uint256:totalUSDvaults'; + +const arbitrum_vault = "0xA7Ce4434A29549864a46fcE8662fD671c06BA49a"; +const arbitrum_vault2 = "0x8080B5cE6dfb49a6B86370d6982B3e2A86FBBb08"; +const arbitrum_staking = "0x48c81451d1fddeca84b47ff86f91708fa5c32e93"; +const arbitrum_GMD = "0x4945970EfeEc98D393b4b979b9bE265A3aE28A8B"; +const arbitrum_esGMD = "0x49E050dF648E9477c7545fE1779B940f879B787A"; + +const avax_vault = "0x5517c5F22177BcF7b320A2A5daF2334344eFb38C" +const avax_staking = "0x4f2c414b76fd9cd45c000af7a449ade4125740ce"; +const avax_GMD = "0x1FE70939c2cEc8F31E8F7729442658586B469972"; +const avax_esGMD = "0xeE788a8b015376eC0185e1e40140af03029C8763"; + +const calculateTvl = async (vaults, chain, block) => { const balances = {}; - const { output: vaultBalance } = await sdk.api.abi.call({ - target: vault, + const bals = await sdk.api2.abi.multiCall({ abi, - chain, block, - }) + calls: vaults, + chain, + block, + }); + + bals.forEach((i) => + sdk.util.sumSingleBalance(balances, 'tether', i / 1e18, 'coingecko') + ); - sdk.util.sumSingleBalance(balances, GLP_ADDRESS, vaultBalance, chain); - return balances -} + return balances; +}; module.exports = { - methodology: "staked gmd + vault balance", - arbitrum: { - staking: staking(stakingAdd, GMDaddress, "arbitrum"), - tvl: Tvl, - }, - }; + misrepresentedTokens: true, + methodology: 'staked gmd + vault balance', + arbitrum: { + staking: staking(arbitrum_staking, [arbitrum_esGMD, arbitrum_GMD]), + tvl: async (ts, _, { arbitrum: block }) => + calculateTvl( + [arbitrum_vault, arbitrum_vault2], + 'arbitrum', + block + ), + }, + avax: { + staking: staking(avax_staking, [avax_esGMD, avax_GMD]), + tvl: async (ts, _, { avax: block }) => + calculateTvl( + [avax_vault], + 'avax', + block + ), + }, +}; + - diff --git a/projects/gmx/index.js b/projects/gmx/index.js index 7212fd95d1c..155699ddc35 100644 --- a/projects/gmx/index.js +++ b/projects/gmx/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const {staking} = require('../helper/staking') const { gmxExports } = require('../helper/gmx') @@ -5,7 +6,7 @@ const { gmxExports } = require('../helper/gmx') // const arbitrumApiEndpoint = 'https://gmx-server-mainnet.uw.r.appspot.com/tokens' const arbitrumVault = '0x489ee077994B6658eAfA855C308275EAd8097C4A'; const arbitrumStaking = '0x908C4D94D34924765f1eDc22A1DD098397c59dD4'; -const arbitrumGMX = '0xfc5A1A6EB076a2C7aD06eD22C90d7E710E35ad0a'; +const arbitrumGMX = ADDRESSES.arbitrum.GMX; //Avalanche // const avalancheApiEndpoint = 'https://gmx-avax-server.uc.r.appspot.com/tokens' const avalancheVault = '0x9ab2De34A33fB459b538c43f251eB825645e8595' @@ -15,10 +16,14 @@ const avalancheGMX = '0x62edc0692BD897D2295872a9FFCac5425011c661' module.exports = { arbitrum: { staking: staking(arbitrumStaking, arbitrumGMX, "arbitrum", "gmx", 18), - tvl: gmxExports({ chain: 'arbitrum', vault: arbitrumVault, }) + tvl: gmxExports({ vault: arbitrumVault, }) }, avax:{ staking: staking(avalancheStaking, avalancheGMX, "avax", "gmx", 18), - tvl: gmxExports({ chain: 'avax', vault: avalancheVault, }) - } + tvl: gmxExports({ vault: avalancheVault, }) + }, + hallmarks:[ + [1641556800, "Avalanche GMX Launch"] + ], + }; diff --git a/projects/gnd-protocol/index.js b/projects/gnd-protocol/index.js new file mode 100644 index 00000000000..7646744ba9e --- /dev/null +++ b/projects/gnd-protocol/index.js @@ -0,0 +1,16 @@ +const { sumTokens2 } = require('../helper/unwrapLPs') +const { staking } = require('../helper/staking') + +async function tvl(_, _b, _cb, { api, }) { + const farm = '0xd8769d8826149b137af488b1e9ac0e3afdbc058a' + await sumTokens2({ api, owner: farm, resolveUniV3: true, }) + const tokens = Object.keys(api.getBalances()).map(i => i.replace(/arbitrum:/gi, '')) + return sumTokens2({ api, owner: farm, tokens, }) + +} +module.exports = { + arbitrum: { + tvl, + staking: staking('0x535ec56479892d9C02fe2Bb86CeBF7ed62E81131', ['0x40ea7f6d6964413d4a26a0a268542dae9f55768e', '0x40ea7f6d6964413d4a26a0a268542dae9f55768e']) + } +} \ No newline at end of file diff --git a/projects/gnosis/conditional-token.js b/projects/gnosis/conditional-token.js deleted file mode 100644 index 310f400cd29..00000000000 --- a/projects/gnosis/conditional-token.js +++ /dev/null @@ -1,73 +0,0 @@ -/*================================================== - Modules -==================================================*/ - -const { api: { abi, util } } = require('@defillama/sdk'); - -/*================================================== - Settings -==================================================*/ - -const START_BLOCK = 8623608; -const PROTOCOL_ADDRESS = '0xc59b0e4de5f1248c1140964e0ff287b192407e0c'; -const TOKENS_TO_IGNORE = new Set(); - -/*================================================== - Helper Functions -==================================================*/ - -const getTokenAddressFromLogData = data => '0x' + data.substring(26, 66); - -const getCallDataOfErc20Token = (tokenAddress, atThisBlock) => - ({ - target: tokenAddress, - params: PROTOCOL_ADDRESS, - abi: 'erc20:balanceOf', - block: atThisBlock, - }); - - -/*================================================== - Main -==================================================*/ - -async function tvl(_, block) { - // Snag all token addresses that have been listed on Gnosis Conditional Token - const { output: events } = await util.getLogs({ - keys: [], - toBlock: block, - target: PROTOCOL_ADDRESS, - fromBlock: START_BLOCK, - topic: "PositionSplit(address,address,bytes32,bytes32,uint256[],uint256)", - }); - - // 1. Reduce all TokenListing logs into an array of token addresses from the log data - // 2. Remove any tokens we want to ignore as denoted top of file - // 3. Format to pipe into erc20:balanceOf multiCall - const tokenList = events.reduce((acc, { data }) => { - const tokenAddress = getTokenAddressFromLogData(data); - if (TOKENS_TO_IGNORE.has(tokenAddress)) return acc; - // add it to de-dupe - TOKENS_TO_IGNORE.add(tokenAddress); - const tokenWithCallData = getCallDataOfErc20Token(tokenAddress, block); - return acc.concat(tokenWithCallData) - }, []); - - // [0] Batch call all ERC20 balances from the Gnosis Conditional Token contract - // [1] Resolve initial ethBalance promise - const balances = await abi.multiCall({ - block, - abi: 'erc20:balanceOf', - calls: tokenList - }); - - return balances; -} - -/*================================================== - Exports -==================================================*/ - -module.exports = { - tvl, -} diff --git a/projects/gnosis/index.js b/projects/gnosis/index.js index f8acca1a7f2..d4faac58b02 100644 --- a/projects/gnosis/index.js +++ b/projects/gnosis/index.js @@ -1,98 +1,36 @@ -/*================================================== - Modules -==================================================*/ +const ADDRESSES = require('../helper/coreAssets.json') -const { api: { abi, util }, util: utilBase } = require('@defillama/sdk'); -const { tvl: conditionalTokenTvl } = require('./conditional-token') - -/*================================================== - Settings -==================================================*/ - -const START_BLOCK = 9340147; -const PROTOCOL_ADDRESS = '0x6F400810b62df8E13fded51bE75fF5393eaa841F'; -/* -* Tokens on GP to ignore -[ - 0x7cac16770dd5f2a59859a395a492224f05a846b6: "oETH Put $200 29/05/2020", - 0x57ab1e02fee23774580c119740129eac7081e9d3: "broken sUSD proxy" -] -*/ -const TOKENS_TO_IGNORE = new Set(['0x7cac16770dd5f2a59859a395a492224f05a846b6', '0x57ab1e02fee23774580c119740129eac7081e9d3', '0xc011a72400e58ecd99ee497cf89e3775d4bd732f']); - -/*================================================== - Helper Functions -==================================================*/ - -const getTokenAddressFromLogData = data => '0x' + data.substring(26, 66); - -const getCallDataOfErc20Token = (tokenAddress, atThisBlock) => - ({ - target: tokenAddress, - params: PROTOCOL_ADDRESS, - abi: 'erc20:balanceOf', - block: atThisBlock, - }); - -/*================================================== - Main -==================================================*/ - -async function tvl(_, block) { - // Start promised TVL of Conditional Token - const promisedConditionalTokenTvl = conditionalTokenTvl(_, block) - - // Snag all token addresses that have been listed on GP - const { output: events } = await util.getLogs({ - keys: [], - toBlock: block, - target: PROTOCOL_ADDRESS, - fromBlock: START_BLOCK, - topic: 'TokenListing(address,uint16)', - }); - - // 1. Reduce all TokenListing logs into an array of token addresses from the log data - // 2. Remove any tokens we want to ignore as denoted top of file - // 3. Format to pipe into erc20:balanceOf multiCall - const tokenList = - events - .reduce((acc, { data }) => { - const tokenAddress = getTokenAddressFromLogData(data) - if (TOKENS_TO_IGNORE.has(tokenAddress)) return acc - - const tokenWithCallData = getCallDataOfErc20Token(tokenAddress, block) - return acc.concat(tokenWithCallData) - }, []); - - // Batch call all ERC20 balances from the G-Protocol & resolve conditionalToken balance promise - const [protocolErc20Balances, conditionalTokenErc20Balances] = await Promise.all([ - abi.multiCall({ - block, - abi: 'erc20:balanceOf', - calls: tokenList - }), - promisedConditionalTokenTvl, - ]) - - const combinedErc20Balances = { - output: protocolErc20Balances.output.concat(conditionalTokenErc20Balances.output) - } - - const balances = { - // GP only accepts WETH - '0x0000000000000000000000000000000000000000': '0', - }; - - utilBase.sumMultiBalanceOf(balances, combinedErc20Balances); - - return balances; -} - -/*================================================== - Exports -==================================================*/ +const { sumTokensExport } = require('../helper/unwrapLPs') +const sdk = require('@defillama/sdk') module.exports = { start: 1579811423, // Thu, 23 Jan 2020 20:30:23 GMT - ethereum: { tvl, } + ethereum: { tvl: sdk.util.sumChainTvls([ + '0xc59b0e4de5f1248c1140964e0ff287b192407e0c', + '0x6f400810b62df8e13fded51be75ff5393eaa841f', + ].map(addTvl)), } }; + +function addTvl(owner) { + const tokens = [ + ADDRESSES.ethereum.WETH, + ADDRESSES.ethereum.DAI, + ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.GNO, + ADDRESSES.ethereum.YFI, + ADDRESSES.ethereum.sUSD, + ADDRESSES.ethereum.UNI, + '0xa1d65E8fB6e87b60FECCBc582F7f97804B725521', + '0xc00e94cb662c3520282e6f5717214004a7f26888', + ADDRESSES.ethereum.LINK, + ADDRESSES.ethereum.SUSHI, + '0x22eEab2f980E8ed7824f8EA548C9595564a0F0e4', + '0xe2f2a5c287993345a840db3b0845fbc70f5935a5', + ADDRESSES.ethereum.TUSD, + ADDRESSES.ethereum.USDT, + '0x0b38210ea11411557c13457D4dA7dC6ea731B88a', + '0x84cA8bc7997272c7CfB4D0Cd3D55cd942B3c9419', + ] + + return sumTokensExport({ owner, tokens, }) +} diff --git a/projects/goblin/abi.json b/projects/goblin/abi.json index 4e29e618a66..da1e948a365 100644 --- a/projects/goblin/abi.json +++ b/projects/goblin/abi.json @@ -1,46 +1,3 @@ -{ - "poolInfo": { - "type": "function", - "stateMutability": "view", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "lpToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "allocPoint", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastRewardTime", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accgoblinPerShare", - "type": "uint256" - }, - { - "internalType": "uint16", - "name": "depositFeeBP", - "type": "uint16" - }, - { - "internalType": "uint256", - "name": "lpSupply", - "type": "uint256" - } - ], - "name": "poolInfo", - "inputs": [ - { - "type": "uint256", - "name": "", - "internalType": "uint256" - } - ] - } -} +{ + "poolInfo": "function poolInfo(uint256) view returns (address lpToken, uint256 allocPoint, uint256 lastRewardTime, uint256 accgoblinPerShare, uint16 depositFeeBP, uint256 lpSupply)" +} \ No newline at end of file diff --git a/projects/goblinscash/api.js b/projects/goblinscash/api.js new file mode 100644 index 00000000000..988beab608d --- /dev/null +++ b/projects/goblinscash/api.js @@ -0,0 +1,8 @@ +const index = require('./index') + +module.exports = { + smartbch: { + tvl: () => 0, + staking: index.smartbch.staking, + } +} \ No newline at end of file diff --git a/projects/goblinscash/index.js b/projects/goblinscash/index.js index 2f1b27e7728..b72b8959c93 100644 --- a/projects/goblinscash/index.js +++ b/projects/goblinscash/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumUnknownTokens } = require('../helper/unknownTokens') const { stakingPricedLP } = require("../helper/staking"); @@ -5,7 +6,7 @@ const goblinStaking = "0x48B8aCe692ad8BD2E3139C65bFf7d28c048F8f00"; const GOB = "0x56381cB87C8990971f3e9d948939e1a95eA113a3"; const treasuryAddress = "0x259D4CBA522A15AA5Db641D0E06d6f7Aa040D89f"; -const flexUSD = "0x7b2B3C5308ab5b2a1d9a94d20D35CCDf61e05b72"; +const flexUSD = ADDRESSES.smartbch.flexUSD; const GOB_flexUSD_MLP = "0xC20A4f3012bA2Df47544d4926B19604Fa777FB01"; const GOB_BCH_MLP = "0x86b0fd64234a747681f0235b6cc5fe04a4d95b31"; const chain = "smartbch" diff --git a/projects/gogocoin/index.js b/projects/gogocoin/index.js index 601d20ff8e4..3a19f7d9c2f 100644 --- a/projects/gogocoin/index.js +++ b/projects/gogocoin/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk'); const { transformPolygonAddress @@ -14,7 +15,7 @@ const GOVERNANCE_STAKING_CONTRACT = '0xd46206003FfB72Fe5FEB04373328C62e2bF864f9' const LP_TOKEN_USDC = '0xe33Dd0C0534189b66B9872425189399e2B9c169D' const LP_STAKING_CONTRACT = '0x5dc4ffc0f9c2261dcaae7f69e1a8837afbd577bc' const GOGOCOIN = '0xdD2AF2E723547088D3846841fbDcC6A8093313d6' -const USDC = '0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174' +const USDC = ADDRESSES.polygon.USDC const chain = 'polygon' async function chainTVL(timestamp, block, chainBlocks) { @@ -23,24 +24,14 @@ async function chainTVL(timestamp, block, chainBlocks) { const USDCPool = await sdk.api.abi.call({ target: USDC_POOL_STAKING_CONTRACT, - abi: { - "inputs": [], - "name": "totalSupply", - "outputs": [{ - "internalType": "uint256", - "name": "", - "type": "uint256" - }], - "stateMutability": "view", - "type": "function" - }, + abi: "uint256:totalSupply", chain: chain, block: chainBlocks[chain] }) sdk.util.sumSingleBalance(balances, transform(USDC), USDCPool.output) return balances -}; +} async function stakingX(timestamp, block, chainBlocks) { const balances = {} @@ -48,17 +39,7 @@ async function stakingX(timestamp, block, chainBlocks) { const totalGOGOLocked = await sdk.api.abi.call({ target: GOVERNANCE_STAKING_CONTRACT, - abi: { - "inputs": [], - "name": "getTotalLockedGogo", - "outputs": [{ - "internalType": "uint256", - "name": "", - "type": "uint256" - }], - "stateMutability": "view", - "type": "function" - }, + abi: "uint256:getTotalLockedGogo", chain: chain, block: chainBlocks[chain] }) @@ -66,7 +47,7 @@ async function stakingX(timestamp, block, chainBlocks) { sdk.util.sumSingleBalance(balances, transform(GOGOCOIN), totalGOGOLocked.output) return balances -}; +} async function pool2X(...args) { const transform = await transformPolygonAddress(); diff --git a/projects/gogopool/index.js b/projects/gogopool/index.js new file mode 100644 index 00000000000..ea7a4d75d30 --- /dev/null +++ b/projects/gogopool/index.js @@ -0,0 +1,12 @@ +async function tvl(_, _b, _cb, { api, }) { + const ggAVAX = '0xA25EaF2906FA1a3a13EdAc9B9657108Af7B703e3' + const token = await api.call({ abi: 'address:asset', target: ggAVAX }) + const bal= await api.call({ abi: 'uint256:totalAssets', target: ggAVAX }) + api.add(token, bal) +} + +module.exports = { + avax: { + tvl, + } +} \ No newline at end of file diff --git a/projects/goldbank/index.js b/projects/goldbank/index.js new file mode 100644 index 00000000000..bc8ad244898 --- /dev/null +++ b/projects/goldbank/index.js @@ -0,0 +1,13 @@ +const { compoundExports } = require("../helper/compound"); +const unitroller = "0x537A09Fd99Fc7eF737d297cDEeAB3b7f9602308c"; + +module.exports = { + hallmarks: [ + [Math.floor(new Date('2023-06-11') / 1e3), 'Project rugged'], + ], + methodology: + "Same as Compound Finance, we just count all the tokens supplied (not borrowed money) on the lending markets", + arbitrum: { + ...compoundExports(unitroller, "arbitrum"), + }, +}; \ No newline at end of file diff --git a/projects/goldfinch/abi.json b/projects/goldfinch/abi.json index bceb1500e41..868971d5c41 100644 --- a/projects/goldfinch/abi.json +++ b/projects/goldfinch/abi.json @@ -1,57 +1,5 @@ { - "totalLoansOutstanding": { - "inputs": [], - "name": "totalLoansOutstanding", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "pools": { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "pools", - "outputs": [ - { - "internalType": "uint256", - "name": "totalMinted", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalPrincipalRedeemed", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "created", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - "assets": { - "inputs": [], - "name": "assets", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -} + "totalLoansOutstanding": "uint256:totalLoansOutstanding", + "pools": "function pools(address) view returns (uint256 totalMinted, uint256 totalPrincipalRedeemed, bool created)", + "assets": "uint256:assets" +} \ No newline at end of file diff --git a/projects/goldfinch/index.js b/projects/goldfinch/index.js index 8aa792fd683..1c8f50ee7c0 100644 --- a/projects/goldfinch/index.js +++ b/projects/goldfinch/index.js @@ -1,28 +1,29 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const { sumTokens } = require("../helper/unwrapLPs"); const abi = require("./abi.json"); const BigNumber = require("bignumber.js"); +const { getLogs } = require('../helper/cache/getLogs') const seniorPoolAddress = "0x8481a6EbAf5c7DABc3F7e09e44A89531fd31F822"; const gfFactoryAddress = "0xd20508E1E971b80EE172c73517905bfFfcBD87f9"; const poolTokensAddress = "0x57686612C601Cb5213b01AA8e80AfEb24BBd01df"; const V2_START = 13097274; -const USDC = "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"; +const USDC = ADDRESSES.ethereum.USDC; let _trancheAddresses -const getTranchedPoolAddresses = async (ethBlock) => { +const getTranchedPoolAddresses = async (api) => { if (!_trancheAddresses) _trancheAddresses = _get() return _trancheAddresses async function _get() { - const logs = await sdk.api.util.getLogs({ + const logs = await getLogs({ target: gfFactoryAddress, - keys: [], + api, fromBlock: V2_START, - toBlock: ethBlock, topic: "PoolCreated(address,address)", }); - return logs.output.map((l) => "0x" + l.topics[1].substr(26)); + return logs.map((l) => "0x" + l.topics[1].substr(26)); } }; @@ -30,10 +31,10 @@ const getTranchedPoolAddresses = async (ethBlock) => { * This metric represents DeFiLlama's "base" definition of Total Value Locked. It includes * only USDC balances in the protocol (that is, in the `SeniorPool` and in all `TranchedPool`s). */ -const tvl = async (timestamp, ethBlock) => { +const tvl = async (timestamp, ethBlock, _, { api, }) => { const balances = {}; - const tranchedPoolAddresses = await getTranchedPoolAddresses(ethBlock); + const tranchedPoolAddresses = await getTranchedPoolAddresses(api); await sumTokens( balances, @@ -57,7 +58,7 @@ const tvl = async (timestamp, ethBlock) => { * Only the `SeniorPool` has a writedown mechanic -- which is reflected in this metric (via * `SeniorPool.assets()`). */ -const borrowed = async (_, ethBlock) => { +const borrowed = async (_, ethBlock, _1, { api }) => { const _seniorPoolUsdcBalances = {}; await sumTokens( _seniorPoolUsdcBalances, @@ -68,7 +69,7 @@ const borrowed = async (_, ethBlock) => { const balances = {}; - const tranchedPoolAddresses = await getTranchedPoolAddresses(ethBlock); + const tranchedPoolAddresses = await getTranchedPoolAddresses(api); const poolStats = ( await sdk.api.abi.multiCall({ diff --git a/projects/goledo/index.js b/projects/goledo/index.js new file mode 100644 index 00000000000..b623c146a49 --- /dev/null +++ b/projects/goledo/index.js @@ -0,0 +1,22 @@ +const { aaveV2Export } = require('../helper/aave'); +const { staking } = require('../helper/unknownTokens') + +const stakingContract = "0x7d236c0486c9579507C67B36d175990CAb5100fC"; +const stakedToken = "0xa4B59aA3De2af57959C23E2c9c89a2fCB408Ce6A"; + +const stakingContractPool2 = "0x80161779e4d5EcBC33918ca37f7F263DDc480017"; +const stakedToken_WrappedCurrency_spLP = "0x93D4Be3C0B11fe52818cD96A5686Db1E21D749ce"; +const lendingpool = "0x9aeba63d77d25c95dadd057db74741517862f360"; + +module.exports = { + methodology: + `Counts the tokens locked in the contracts to be used as collateral to borrow or to earn yield. Borrowed coins are not counted towards the TVL, so only the coins actually locked in the contracts are counted. There's multiple reasons behind this but one of the main ones is to avoid inflating the TVL through cycled lending.. TVL is calculated by getting the market addresses from comptroller and calling the getCash() on-chain method to get the amount of tokens locked in each of these addresses, then we get the price of each token from coingecko. To view the Borrowed amounts along with the currently liquidity, click the 'Borrowed' check box`, + conflux: { + ...aaveV2Export(lendingpool), + staking: staking({ owner: stakingContract, tokens: [stakedToken], lps: [stakedToken_WrappedCurrency_spLP], useDefaultCoreAssets: true, }), + pool2: staking({ owner: stakingContractPool2, tokens: [stakedToken_WrappedCurrency_spLP], lps: [stakedToken_WrappedCurrency_spLP], useDefaultCoreAssets: true, }), + }, + hallmarks:[ + [1671415334, "Goledo Creation timestamp"] + ], +}; diff --git a/projects/golff-finance/abi.json b/projects/golff-finance/abi.json deleted file mode 100644 index ed49c12da21..00000000000 --- a/projects/golff-finance/abi.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "token": { - "inputs": [], - "name": "token", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "totalDeposit":{ - "inputs": [], - "name": "totalDeposit", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -} \ No newline at end of file diff --git a/projects/golff-finance/index.js b/projects/golff-finance/index.js index 65d3e521824..6d20691a587 100644 --- a/projects/golff-finance/index.js +++ b/projects/golff-finance/index.js @@ -1,7 +1,4 @@ -const sdk = require('@defillama/sdk') const { default: axios } = require('axios') -const { getBlock } = require('../helper/getBlock') -const abi = require('./abi.json') const { toUSDTBalances } = require("../helper/balances"); const chainIds = { diff --git a/projects/goober/abis.js b/projects/goober/abis.js index b69b1ed8060..bfc5b2e7225 100644 --- a/projects/goober/abis.js +++ b/projects/goober/abis.js @@ -1,24 +1,8 @@ module.exports = { artGobblers: { - gooBalance: { - inputs: [{ internalType: "address", name: "user", type: "address" }], - name: "gooBalance", - outputs: [{ internalType: "uint256", name: "", type: "uint256" }], - stateMutability: "view", - type: "function", - }, + gooBalance: "function gooBalance(address user) view returns (uint256)", }, goober: { - reserves: { - inputs: [], - name: "getReserves", - outputs: [ - { internalType: "uint256", name: "_gooReserve", type: "uint256" }, - { internalType: "uint256", name: "_gobblerReserve", type: "uint256" }, - { internalType: "uint32", name: "_blockTimestampLast", type: "uint32" }, - ], - stateMutability: "view", - type: "function", - }, + reserves: "function getReserves() view returns (uint256 _gooReserve, uint256 _gobblerReserve, uint32 _blockTimestampLast)", }, }; diff --git a/projects/good-ghosting/index.js b/projects/good-ghosting/index.js index 364113dda74..62d1d315f18 100644 --- a/projects/good-ghosting/index.js +++ b/projects/good-ghosting/index.js @@ -1,93 +1,49 @@ -const sdk = require("@defillama/sdk"); -const { getChainTransform } = require("../helper/portedTokens"); -const axios = require("axios"); +const { sumTokens2 } = require('../helper/unwrapLPs') +const { getConfig } = require("../helper/cache"); + const apiUrl = "https://goodghosting-api.com/v1/games"; const chainIdMap = { ethereum: 1, polygon: 137, celo: 42220, + base: 8453, }; const contractVersions = { - v200: ["2.0.0", "2.0.1"], + v200: ["2.0"], v001: "0.0.1", v002: "0.0.2", v003: "0.0.3", }; -const isV2Game = (contractVersion) => - contractVersions.v200.includes(contractVersion); - -function tvl(chain) { - return async (timestamp, ethBlock, chainBlocks) => { - const gameData = await axios.get(apiUrl).then((resp) => resp.data); +const isV2Game = (contractVersion) => { + const baseContractVersion = contractVersion.slice(0, 3); - const balances = {}; - const transform = await getChainTransform(chain); + if (contractVersions.v200.indexOf(baseContractVersion) !== -1) { + return true; + } + return false; +} - const calls = Object.values(gameData) - .filter((game) => game.networkId == chainIdMap[chain]) +async function tvl(_, _b, _cb, { api, }) { + const gameData = await getConfig("good-ghosting", apiUrl) + const ownerTokens = [] + Object.values(gameData) + .filter((game) => game.networkId == chainIdMap[api.chain]) .map((game) => { - const gameParams = [ - { - target: game.depositTokenAddress, - params: [game.id], - }, - { - target: game.liquidityTokenAddress, - params: [game.id], - }, - ]; - - if (isV2Game(game.contractVersion)) { - gameParams.push({ - target: game.depositTokenAddress, - params: [game.strategyController.toLowerCase()], - }); + const tokens = [game.depositTokenAddress, game.liquidityTokenAddress, game.gaugeLiquidityTokenAddress].filter(i => i) + ownerTokens.push([tokens, game.id]) - gameParams.push({ - target: game.liquidityTokenAddress, - params: [game.strategyController.toLowerCase()], - }); - } - return gameParams; + if (isV2Game(game.contractVersion)) + ownerTokens.push([tokens, game.strategyController]) }) - .flat(); - - const gameContractBalances = await sdk.api.abi.multiCall({ - calls, - abi: "erc20:balanceOf", - chain, - }); - - sdk.util.sumMultiBalanceOf( - balances, - gameContractBalances, - false, - transform - ); - - //fix decimal issue with celo tokens - for (const representation of ["celo-dollar", "celo", "celo-euro"]) { - if (balances[representation] !== undefined) { - balances[representation] = Number(balances[representation]) / 1e18; - } - } - - return balances; - }; + return sumTokens2({ api, ownerTokens}) } module.exports = { - timetravel: true, - misrepresentedTokens: false, - methodology: - "counts the amount of interest bearing tokens owned by the smart game contract", - polygon: { - tvl: tvl("polygon"), - }, - celo: { - tvl: tvl("celo"), - }, + methodology: "counts the amount of interest bearing tokens owned by the smart game contract", + polygon: { tvl }, + celo: { tvl }, + base: {tvl} }; diff --git a/projects/gooddollar/abi.json b/projects/gooddollar/abi.json index 62fae6bcd65..aed721a93cf 100644 --- a/projects/gooddollar/abi.json +++ b/projects/gooddollar/abi.json @@ -1,28 +1,4 @@ { - "currentPriceDAI": { - "inputs": [], - "name": "currentPriceDAI", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "totalDelegated": { - "type": "function", - "stateMutability": "view", - "outputs": [ - { - "type": "uint256", - "name": "", - "internalType": "uint256" - } - ], - "name": "totalDelegated", - "inputs": [] - } -} \ No newline at end of file + "currentPriceDAI": "uint256:currentPriceDAI", + "totalDelegated": "uint256:totalDelegated" +} \ No newline at end of file diff --git a/projects/gooddollar/index.js b/projects/gooddollar/index.js index 4d223dc1dea..7691240746b 100644 --- a/projects/gooddollar/index.js +++ b/projects/gooddollar/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const abi = require('./abi.json'); const BigNumber = require("bignumber.js"); @@ -5,7 +6,7 @@ const { sumTokens } = require("../helper/unwrapLPs"); const tokens = { aUSDC: "0xbcca60bb61934080951369a648fb03df4f96263c", - DAI: "0x6b175474e89094c44da98b954eedeac495271d0f", + DAI: ADDRESSES.ethereum.DAI, cDAI: "0x5d3a536E4D6DbD6114cc1Ead35777bAB948E3643", Gfuse: "0x495d133B938596C9984d462F007B676bDc57eCEC", // GoodDollar on Fuse FUSE: "0x970b9bb2c0444f5e81e9d0efb84c8ccdcdcaf84d", // Fuse on Mainnet @@ -31,7 +32,7 @@ async function eth(timestamp, ethBlock) { ], ethBlock) return balances; -}; +} async function fuseStaking(timestamp, ethBlock, chainBlocks) { const gdStaked = (await sdk.api.erc20.balanceOf({ @@ -57,30 +58,6 @@ async function fuseStaking(timestamp, ethBlock, chainBlocks) { return balances; } -async function fuseTreasury(timestamp, ethBlock, chainBlocks) { - const gdInCommunitySafe = (await sdk.api.erc20.balanceOf({ - target: tokens.Gfuse, - chain: 'fuse', - owner: COMMUNITY_SAFE, - block: chainBlocks['fuse'] - })).output; - - const gdInFuseStaking = (await sdk.api.erc20.balanceOf({ - target: tokens.Gfuse, - chain: 'fuse', - owner: FUSE_STAKING, - block: chainBlocks['fuse'] - })).output; - - const gdTotal = BigNumber(gdInCommunitySafe).plus(gdInFuseStaking); - let gdInDAI = await convertGoodDollarsToDai(gdTotal, ethBlock); - - const balances = {}; - sdk.util.sumSingleBalance(balances, tokens.DAI, Number(gdInDAI)); - - return balances; -} - // Required until GoodDollar lists on CoinGecko async function convertGoodDollarsToDai(gdAmount, ethBlock) { const gdPriceInDAI = (await sdk.api.abi.call({ @@ -116,6 +93,5 @@ module.exports = { fuse: { staking: fuseStaking, tvl: () => ({}), - treasury: fuseTreasury }, } \ No newline at end of file diff --git a/projects/goodentry/index.js b/projects/goodentry/index.js new file mode 100644 index 00000000000..b5836e0447b --- /dev/null +++ b/projects/goodentry/index.js @@ -0,0 +1,50 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const abi = require('../helper/abis/aave.json'); + +const addressesProviderRegistry = '0x01b76559D512Fa28aCc03630E8954405BcBB1E02'; +const balanceOfAbi = "function balanceOf(address account) view returns (uint256)"; +const getLpAbi = "function getLendingPool() view returns (address)"; +const getReserveDataAbi = "function getReserveData(address asset) view returns (uint256 reserveConfigurationMap, uint128 liquidityIndex, uint128 variableBorrowIndex, uint128 currentLiquidityRate, uint128 currentVariableBorrowRate, uint128 currentStableBorrowRate, uint40 lastUpdateTimestamp, address aTokenAddress, address stableDebtTokenAddress, address variableDebtTokenAddress, address interestRateStrategyAddress, uint8 id)"; +const getUnderlyingAbi = "function getTokenAmounts(uint amount) external view returns (uint token0Amount, uint token1Amount)"; +const token0Abi = "function TOKEN0() view returns (address token, uint8 decimals)"; +const token1Abi = "function TOKEN1() view returns (address token, uint8 decimals)"; + +// Aave helper doesnt recognize tokenized Uniswap positions, need to manually + +async function tvl(timestamp, ethBlock, _, { api }) { + const addressesProviders = await api.call({ target: addressesProviderRegistry, abi: abi["getAddressesProvidersList"], }) + const validAddressesProviders = addressesProviders.filter((ap) => ap != ADDRESSES.null) + const lendingPools = await api.multiCall({ calls: validAddressesProviders, abi: getLpAbi, }) + const aTokens = await api.multiCall({ calls: lendingPools, abi: abi["getReservesList"], }) + + const ge = {} + lendingPools.forEach((v, i) => { + ge[v] = { aTokens: aTokens[i] } + }) + + await Promise.all( + Object.keys(ge).map(async (pool) => { + const aTokens = ge[pool].aTokens; + const aTokenAddresses = (await api.multiCall({ abi: getReserveDataAbi, calls: aTokens, target: pool })).map(i => i.aTokenAddress) + const bals = (await api.multiCall({ abi: balanceOfAbi, calls: aTokenAddresses.map((v, i) => ({ target: aTokens[i], params: v })) })) + const underlyings = await api.multiCall({ abi: getUnderlyingAbi, calls: aTokens.map((v, i) => ({ target: v, params: bals[i] })), permitFailure: true, }) + const token0s = await api.multiCall({ abi: token0Abi, calls: aTokens, permitFailure: true, }) + const token1s = await api.multiCall({ abi: token1Abi, calls: aTokens, permitFailure: true, }) + underlyings.forEach((v, i) => { + if (v) { + api.add(token0s[i].token, v.token0Amount) + api.add(token1s[i].token, v.token1Amount) + } else { + api.add(aTokens[i], bals[i]) + } + }) + }) + ) +} + + +module.exports = { + methodology: + "Counts the tokens locked in the contracts to be used as collateral to borrow or to earn yield. Borrowed coins are not counted towards the TVL, so only the coins actually locked in the contracts are counted. There's multiple reasons behind this but one of the main ones is to avoid inflating the TVL through cycled lending", + arbitrum: { tvl, } +}; diff --git a/projects/gplx/index.js b/projects/gplx/index.js new file mode 100644 index 00000000000..1d18f4a4033 --- /dev/null +++ b/projects/gplx/index.js @@ -0,0 +1,10 @@ +const { gmxExports } = require('../helper/gmx') + +module.exports = { + hallmarks: [ + [1687320000, "Token supply compromise"] + ], + pulse:{ + tvl: gmxExports({ vault: '0xC2311efFE60b0dC2491148Ff1bd46F08D64ADC98', }) + } +}; \ No newline at end of file diff --git a/projects/grappa-finance/grappa-ethereum.js b/projects/grappa-finance/grappa-ethereum.js new file mode 100644 index 00000000000..aebc101cb4c --- /dev/null +++ b/projects/grappa-finance/grappa-ethereum.js @@ -0,0 +1,20 @@ +const { sumTokens2, } = require('../helper/unwrapLPs') + +const START_BLOCK = 16555738; // grappa deployment block +const grappa = '0xe5fc332620c8ba031d697bd45f377589f633a255'; + +module.exports = async function ethereumTvl(timestamp, block, _1, { api }) { + if (block < START_BLOCK) return {} + // get all tokens + const numTokens = await api.call({ abi: 'function lastAssetId() view returns (uint8)', target: grappa }) + let params = [] + for (let id = 1; id <= numTokens; id++) params.push(id) + const tokens = await api.multiCall({ abi: 'function assets(uint8) view returns (address)', calls: params, target: grappa }) + // get all owners + const numEngines = await api.call({ abi: 'function lastEngineId() view returns (uint8)', target: grappa }) + params = [] + for (let id = 1; id <= numEngines; id++) params.push(id) + let owners = await api.multiCall({ abi: 'function engines(uint8) view returns (address)', calls: params, target: grappa }) + + return sumTokens2({ tokens: tokens, owners, api }) +} \ No newline at end of file diff --git a/projects/grappa-finance/index.js b/projects/grappa-finance/index.js new file mode 100644 index 00000000000..756cf41fd3d --- /dev/null +++ b/projects/grappa-finance/index.js @@ -0,0 +1,12 @@ +const ethereumTvl = require('./grappa-ethereum'); + +module.exports = { + ethereum: { + start: 1675468800, + tvl: ethereumTvl, + }, + hallmarks: [ + [1677196800, "Hashnote vault launch"], + ] +} + \ No newline at end of file diff --git a/projects/grave/index.js b/projects/grave/index.js index 9f039d3a321..559c5d3f711 100644 --- a/projects/grave/index.js +++ b/projects/grave/index.js @@ -1,6 +1,5 @@ -const sdk = require("@defillama/sdk"); +const ADDRESSES = require('../helper/coreAssets.json') const { stakingPricedLP } = require("../helper/staking"); -const { transformAvaxAddress } = require("../helper/portedTokens"); const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); const { pool2Exports } = require("../helper/pool2"); @@ -16,13 +15,13 @@ const gShareAvaxLp = "0xae427ad7a54f5490ef76b3bde3663b0e45c7a102" async function atvl(timestamp, block, chainBlocks) { const balances = {}; - const transform = await transformAvaxAddress(); + const transform = addr => 'avax:'+addr; await sumTokensAndLPsSharedOwners( balances, [ - ["0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7", false], - ["0xA7D7079b0FEaD91F3e65f86E8915Cb59c1a4C664", false], - ["0x6e84a6216eA6dACC71eE8E6b0a5B7322EEbC0fDd", false], + [ADDRESSES.avax.WAVAX, false], + [ADDRESSES.avax.USDC_e, false], + [ADDRESSES.avax.JOE, false], ["0x070092b3A985f9E5424351D68730c9A318ad96eb", false], ], @@ -34,7 +33,7 @@ async function atvl(timestamp, block, chainBlocks) { return balances; -}; +} const pool2LPs = [ graveAvaxLp, diff --git a/projects/gravis-finance/index.js b/projects/gravis-finance/index.js index 19b4088601c..777f2204735 100644 --- a/projects/gravis-finance/index.js +++ b/projects/gravis-finance/index.js @@ -4,23 +4,20 @@ module.exports = { misrepresentedTokens: true, bsc: { tvl: getUniTVL({ - chain: 'bsc', factory: '0x4a3b76860c1b76f0403025485de7bfa1f08c48fd', useDefaultCoreAssets: true, }), }, polygon: { - tvl: getUniTVL({ - chain: 'polygon', - factory: '0x17c1d25d5a2d833c266639de5fbe8896bdbeb234', - useDefaultCoreAssets: true, - }), + tvl: getUniTVL({ + factory: '0x17c1d25d5a2d833c266639de5fbe8896bdbeb234', + useDefaultCoreAssets: true, + }), + }, + heco: { + tvl: getUniTVL({ + factory: '0x4a3B76860C1b76f0403025485DE7bfa1F08C48fD', + useDefaultCoreAssets: true, + }), }, -heco: { -tvl: getUniTVL({ -chain: 'heco', -factory: '0x4a3B76860C1b76f0403025485DE7bfa1F08C48fD', -useDefaultCoreAssets: true, -}), -}, }; \ No newline at end of file diff --git a/projects/gravita-protocol/index.js b/projects/gravita-protocol/index.js new file mode 100644 index 00000000000..64be6b783b8 --- /dev/null +++ b/projects/gravita-protocol/index.js @@ -0,0 +1,28 @@ +const { sumTokens2 } = require("../helper/unwrapLPs"); + +const ADMIN_CONTRACT_ADDRESS = "0xf7Cc67326F9A1D057c1e4b110eF6c680B13a1f53"; + +/** + * Returns an array of addresses containing the collateral tokens accepted by the platform. + */ +async function _getCollateralAddresses(api) { + return api.call({ + abi: "function getValidCollateral() external view returns (address[])", + target: ADMIN_CONTRACT_ADDRESS, + }); +} + +async function tvl(_, _1, _2, { api }) { + const collAddresses = await _getCollateralAddresses(api); + const pool = await api.call({ abi: 'address:activePool', target: ADMIN_CONTRACT_ADDRESS}) + return sumTokens2({ api, tokens: collAddresses, owner: pool}) +} + +module.exports = { + methodology: + "Adds up the total value locked as collateral on the Gravita platform", + start: 1684256400, // Tuesday, May 15, 2023 17:00 GMT + ethereum: { + tvl, + }, +}; diff --git a/projects/gravity-bridge/index.js b/projects/gravity-bridge/index.js new file mode 100644 index 00000000000..af4c607773b --- /dev/null +++ b/projects/gravity-bridge/index.js @@ -0,0 +1,80 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { getBalance2 } = require("../helper/chain/cosmos.js"); +const { sumTokensExport } = require('../helper/unwrapLPs') + +const erc20Contracts = [ + + ADDRESSES.ethereum.USDC, // USDC + ADDRESSES.ethereum.USDT, // USDT + ADDRESSES.ethereum.WBTC, // WBTC + ADDRESSES.ethereum.WETH, // WETH + ADDRESSES.ethereum.WSTETH, // wstETH + "0xEa5A82B35244d9e5E48781F00b11B14E627D2951", // ATOM + "0xd2877702675e6cEb975b4A1dFf9fb7BAF4C91ea9", // WLUNC + "0xfB5c6815cA3AC72Ce9F5006869AE67f18bF77006", // pSTAKE + "0x45804880De22913dAFE09f4980848ECE6EcbAf78", // PAXG + "0xc0a4Df35568F116C370E6a6A6022Ceb908eedDaC", // UMEE + "0x44017598f2AF1bD733F9D87b5017b4E7c1B28DDE", // stkATOM + "0x817bbDbC3e8A1204f3691d14bB44992841e3dB35", // CUDOS + "0x467719aD09025FcC6cF6F8311755809d45a5E5f3", // AXL + "0x77E06c9eCCf2E797fd462A92B6D7642EF85b0A44", // WTAO + ADDRESSES.ethereum.INU, // SHIB + "0x35a532d376FFd9a705d0Bb319532837337A398E7", // WDOGE + "0x93581991f68DBaE1eA105233b67f7FA0D6BDeE7b", // WEVMOS + ADDRESSES.ethereum.LINK, // LINK + "0xa670d7237398238DE01267472C6f13e5B8010FD1", // SOMM + "0xd3E4Ba569045546D09CF021ECC5dFe42b1d7f6E4", // MNW + "0xd23Ed8cA350CE2631F7EcDC5E6bf80D0A1DeBB7B", // PLQ + "0x07baC35846e5eD502aA91AdF6A9e7aA210F2DcbE", // EROWAN + "0xA0b73E1Ff0B80914AB6fe0444E65848C4C34450b", // CRO + "0xe28b3B32B6c345A34Ff64674606124Dd5Aceca30", // INJ + "0x4c11249814f11b9346808179Cf06e71ac328c1b5", // ORAI + ADDRESSES.ethereum.BUSD, // BUSD + "0x147faF8De9d8D8DAAE129B187F0D02D819126750", // GEO + ADDRESSES.ethereum.STETH, // stETH + "0xD8912C10681D8B21Fd3742244f44658dBA12264E", // PLU + "0x4f6103BAd230295baCF30f914FDa7D4273B7F585", // KI + "0xed0d5747A9AB03a75fBfEC3228cd55848245B75d", // NGM + ADDRESSES.ethereum.MATIC, // MATIC + "0x892A6f9dF0147e5f079b0993F486F9acA3c87881", //xFUND + ADDRESSES.ethereum.FRAX, //FRAX + "0xaea46A60368A7bD060eec7DF8CBa43b7EF41Ad85", //FET + "0x467719aD09025FcC6cF6F8311755809d45a5E5f3", //AXL + "0x2B89bF8ba858cd2FCee1faDa378D5cd6936968Be", //WSCRT + ADDRESSES.ethereum.BUSD, //BUSD + "0x4c11249814f11b9346808179Cf06e71ac328c1b5", //ORAI + "0xa693B19d2931d498c5B318dF961919BB4aee87a5", //WUST + "0xBA11D00c5f74255f56a5E366F4F77f5A186d7f55", //BAND + "0x4547254E6E3195cE57Bc50352193A25c2F4B8FCf", //STARS + "0x7bE48633D86AA9821284B01030b8a3F9B06eA876", //HUAHUA + "0x6982508145454Ce325dDbE47a25d4ec3d2311933", //PEPE + "0xd2877702675e6cEb975b4A1dFf9fb7BAF4C91ea9", //WLUNC + "0x43373AE537945085Ee1001928E96204034bF55e6", //USDC2 + "0x76C4A2B59523eaE19594c630aAb43288dBB1463f", //IRIS + +]; + +const GRAVITY_BRIDGE_CONTRACT = "0xa4108aa1ec4967f8b52220a4f7e94a8201f2d906"; + +module.exports = { + methodology: 'Counts the tokens locked in the Gravity Bridge contract on Ethereum chain.', + start: 13798211, + ethereum: { + tvl: sumTokensExport({ owner: GRAVITY_BRIDGE_CONTRACT, tokens: erc20Contracts, }), + }, + gravitybridge: { + tvl, + } +}; + +async function tvl(_, _b, _cb, { api, }) { + const bals = await getBalance2({ chain: 'gravitybridge', owner: 'gravity16n3lc7cywa68mg50qhp847034w88pntqzx3ksm'}) + Object.entries(bals).forEach(([key, val]) => { + if (key.startsWith('gravity0x')) { + // these tokens are already counted on ethereum side + // api.add(key.replace('gravity', ''), val, { skipChain: true}) + } else { + api.add(key, val) + } + }) +} \ No newline at end of file diff --git a/projects/gravity-finance/index.js b/projects/gravity-finance/index.js index b7ffc1fa21c..340b7ca7447 100644 --- a/projects/gravity-finance/index.js +++ b/projects/gravity-finance/index.js @@ -1,27 +1,9 @@ -const {calculateUniTvl} = require('../helper/calculateUniTvl.js'); -const {transformPolygonAddress} = require('../helper/portedTokens'); - -async function tvl(_, block, chainBlocks) { - const transformPolygon = await transformPolygonAddress(); - block = chainBlocks['polygon']; - - const balances = await calculateUniTvl( - transformPolygon, - block, - 'polygon', - '0x3ed75AfF4094d2Aaa38FaFCa64EF1C152ec1Cf20', - 18134755, - true - ); - - return balances; -}; +const {uniTvlExport} = require('../helper/calculateUniTvl.js'); module.exports = { methodology: `Counts the liquidity on all AMM pools. We get the TVL by first fetching all the PairCreated() events emitted by the factory contract in order to get all the pairs and then we get the amount of tokens on each pair by calling getReserves() on that pair's contract. Once we have the total amount locked of each token we just price them using coingecko, and, if coingecko doesn't have the price of one of the tokens we just exclude that token from the TVL.`, polygon: { - tvl + tvl: uniTvlExport('0x3ed75AfF4094d2Aaa38FaFCa64EF1C152ec1Cf20', 'polygon', true), } }; -// node test.js projects/gravity-finance/index.js diff --git a/projects/greenhouse/index.js b/projects/greenhouse/index.js index a31a164fe9b..d1dd57b5892 100644 --- a/projects/greenhouse/index.js +++ b/projects/greenhouse/index.js @@ -8,7 +8,7 @@ async function tvl (timestamp, ethBlock, chainBlocks) { const transformAddress = await getChainTransform(chain); await addFundsInMasterChef(balances, MASTERCHEF, chainBlocks[chain], chain, transformAddress); return balances; -}; +} module.exports = { polygon: { tvl, }, diff --git a/projects/gridex/index.js b/projects/gridex/index.js new file mode 100644 index 00000000000..576048cb3da --- /dev/null +++ b/projects/gridex/index.js @@ -0,0 +1,48 @@ +const { sumTokens2 } = require("../helper/unwrapLPs"); +const { getLogs } = require("../helper/cache/getLogs"); +const { stakings } = require("../helper/staking"); + +const stakingContract = ["0x035E9062286FD19460B3E22970ebB5691EED2C25"]; +const GDX = ["0x2F27118E3D2332aFb7d165140Cf1bB127eA6975d"]; + +module.exports = { + methodology: `Counts the tokens locked on order book grid`, + hallmarks: [ + [1672531200, "GDX Airdrop #1"], + [1677628800, "GDX Airdrop #2"], + [1678838400, "Maker Rewards Launch"], + [1679616000, "GDX Airdrop #3"], + [1682294400, "GDX Staking Launch"], + [1682550000, "GDX Airdrop #4"], + ], +}; + +const config = { + arbitrum: { + factory: "0x32d1F0Dce675902f89D72251DB4AB1d728efa19c", + fromBlock: 64404349, + }, +}; + +Object.keys(config).forEach((chain) => { + const { factory, fromBlock } = config[chain]; + module.exports[chain] = { + tvl: async (_, _b, _cb, { api }) => { + const logs = await getLogs({ + api, + target: factory, + topics: [ + "0xfe23981920c53fdfe858f29ee2c426fb8bf164162938c157cdf27bac46fccab7", + ], + eventAbi: + "event GridCreated (address indexed token0, address indexed token1, int24 indexed resolution, address grid)", + onlyArgs: true, + fromBlock, + }); + + const ownerTokens = logs.map((i) => [[i.token0, i.token1], i.grid]); + return sumTokens2({ api, ownerTokens }); + }, + staking: stakings(stakingContract, GDX), + }; +}); diff --git a/projects/grim/config.json b/projects/grim/config.json new file mode 100644 index 00000000000..75945207568 --- /dev/null +++ b/projects/grim/config.json @@ -0,0 +1,538 @@ +{ + "telos": [ + "0x5E9054c2eeCB9Dd9BC5818E9aE314070c92a9Dbb", + "0x8cAC1868B06A6B53181E497611c8496a96D72A8c", + "0x4Dc1B8dEee2aA42b2e6eC2c6C53d7f7D3fac3e9A", + "0x60DC3d4a7866E1F2802Fc851aC2AF12da4D65Cf1", + "0xB3e34c8046AFC1F7dE0F6f2C0d3140647AD58b30", + "0x6272593eEE38eC7F7F80f971250F39F34FE839ab", + "0x7AfB0Bc08873219d2b8F4Ee44312102e0a1A91d5", + "0xD52C0c24F47D06C5c3Bf41A610d7b591980e201c", + "0x69FE9896f7653BB1961bfCE4D01F3416f59f803E", + "0xaa5eE9cFc6c53419845867d5c4fE361c59D2a9bc", + "0x37CE0654FA0A5D7720b488f18B7c11f5b721BEC3", + "0x9a8d575B3f1Fc91Db2F29c4E87E48F528A3510B9", + "0x0Be694BBA360a5c375622aAf9e31EE82a95b680B", + "0xEcb20d5691E4eac894F4BD8f2A84b2c76BD49f67", + "0xFB65Af3cF542E356C16065467937BF90BB7B54BB", + "0xEC45eDc98243f9DaB8E8C738Aa51910075A0d90F", + "0x87EFdAe3fE46a861ec96fD5ffB5e4C5DDc8f9e79", + "0xeDb1A44fCBC18B0bc8998112b9a987E417bbb23b", + "0xF9c03F4042d4A5F2807A93381A8F7d68e93FD9B2", + "0x173630Ff7c7763DbcD9B38b03c2870B5d51dDB80", + "0xB0c5d5b4a59Ac769f54114D836e1530991da3863", + "0x9F8F4Ffe23Ff4bD7D64F82e60B046002dDCB6684", + "0x4b742d7f8E6E6911a9674EBB00cD6DEEf3091Afa", + "0xdf86120116F04E004f7EDF9B67e40452e08D5774" + ], + "polygon": [ + "0xEfA6e06B557ECF6b328bFffC361D559F4476c26b", + "0xa12e5A6f7968AE09a28e88D978Cae050751C06A5", + "0xBcDd8E50e2109cea403c9a7b88cdBD4c6F8F2045", + "0x00187581AAD2bf25724774676a6B22021Fe8b0C9", + "0x7F37f76d390eCFf2e9832C83fA70c1A1a53C40d8", + "0xbf5953bA9CD32c44e19795c17bC50Ff7369759e5", + "0x553F75622cF944b85f17Be3B53Cd17CE40798984", + "0x289Eb918eaD4cddaeCDE64f946569115E01Ba958", + "0x94118a1752cE651e8e4Ea21620C4da46D8f143d4" + ], + "fantom": [ + "0x54369163e3dE8D993A93f45946DFdadFED1E7Eb4", + "0x5a1d96F0ee43167B58234Bb81e008d3892639f0a", + "0x8Cf9E920AEF195C8D9024269699D762b0685C89c", + "0x6ab4a69a6E43D50f265F0619962F989B6615b7BC", + "0x3ae73a25532be8a67bAa2Cf2aDB765d63443d80D", + "0xAc38fB48A022971112019a40f2AcbB5b77bFB891", + "0x3e2e5AEf7Cea5606204d79616D0cdf8D5AcE385e", + "0x23869f49B5093aaaD5EDaF839B2C37707216b741", + "0x26CE39D79C3F13c6131B8B45577C87f9bB562857", + "0xB92D48c8896965c6eA7a04725F08564A2313D101", + "0x8410903237F9929146dcE683e7921CEA50547689", + "0x053365e9aeB14424a58c14117FEb6D760c0384e9", + "0x7964cd13E81F3B72d9E24FeA428772C29048f715", + "0x7d5196ed6F7E30B43297d5356ba31f3DE7a66827", + "0x66334e72Ba358b79cC2EBd0282c1d8949BFC7564", + "0x61f5d294D71Be47BB0Cb1C2430ECE5605EBA3734", + "0x4Bd6372d9b6e76ef55268b03e80C35b5BF743B62", + "0x40c3C7E16c5faFBAcD2F4f6A58858850d59a5a8e", + "0x30D89125F2b90942Ad77a7631481E0B49f449c13", + "0xb2cf157bA7B44922B30732ba0E98B95913c266A4", + "0xfD6DDdf0C9e6C5a7A518e6Cbfbc222cb2991a2B3", + "0x462aDf50aE6195f46430177450CdFB6eC742A0E5", + "0xf990AC8242FdB9De467A6e5E2b01CC08dC654717", + "0xD94C7DEd80CfA4650Dc61Ab483AF74df0d96f745", + "0x4edC791ddE70914B2C9179934ECaedFd539e1b0c", + "0xb6662bb1b66B75bE8A0cecFe5af08A1DcD46Cf82", + "0xc6493cE516CD3586bB77b41E1A410c6d8B0A305B", + "0x91B7c20330321095668Af86Fa746A7F1852fB190", + "0x6Cec287a3bF06b0d142777B2514FA419910BBC26", + "0x937576F8D178c2ea422b71016800916a1770c439", + "0x60Eba06eD584D1F1bd6620905Da36332D85422e6", + "0x104Bc733788AF33E674a676a227d273806AD958d", + "0xa3e348136D9F8A14300380225756BA6eAF40265d", + "0x18B19e727016409d7f76B0414A84c216Acd99185", + "0x2174f2aB95368B668971f0Ec015F82392d3ceAc1", + "0x6AbAb058747283B3E95BD987AB83B95e689Be3eE", + "0xfBBb8aeB8865fd776485Fd45bc96665E239c908a", + "0x21a5484D889DdEBCb9d192b5B96A794CA4147c91", + "0x7e8D2d029199a86950c733CbbC6d8160Cd21486C", + "0x883D002b2147CE081894f74a846F81FF97b141c2", + "0x10149fDf20A92822a5cBAf21eF9a4484238769F2", + "0x3E4Ea4d16233A5D5236739a8fe632b6b5848DA9e", + "0x54788611767AF25f0De57411354F111B5D9C6DEf", + "0xec0965D89C9E237b9BF0c8f6ed1e09314f5097E0", + "0xa0E9d69249E6AF75779EaB029d1ea3BaA7F2b381", + "0x9200Ac9C17EF8Ad1Ea16fDc63B8460e1F10d8eF4", + "0x9B30315e701945eBB855326f53335F717E4921d2", + "0xE1F9d163C2Fc5761a2860ae590E748BBEfAf39dA", + "0x9f68852dD559484e6BE2d034CEBfBF5d62B54449", + "0xc68048525bfC1a49910e740424399E10eef6dff9", + "0x829C25Bb47f35C02150E2cBBD0C962E5b7B02687", + "0x7f0f5C79b64d0544549c8FfDA52576d00963B15E", + "0x5253ea466157a498d195E1aDB3e19a6F5a97dEfb", + "0xc53103820Bbbeb0BE0592022C3d4d806D07F8610", + "0x43b99CC4384b3F0B384e81D8db2C763fBD6fd314", + "0x127Da0f069bc55410E551bf574438E757Df695dc", + "0x3cfdD338061fEE8523c75e372fc7D88033141eC4", + "0xBc9cad78f31F213A7a91C6f7C589081983398733", + "0xeC6F0E53597fb2e6d4b1a2B48743D52B662CDa24", + "0xbF1fB5E256c7C8D262e866EF20beFc72eD9fA633", + "0x3d9f39Bb535650b04d4B5Eb23bbA8609C117a695", + "0x3FB82257BBBA5A56aE748f1e1BE8A06127D45069", + "0x67769663Ea046dD2F3747827755ADd1694eff9d5", + "0xe30d25c275dA2cb8a8911BFB7cE9e59E227F80E0", + "0xD2752EB1794C4a1b7891feF1e1376B9C9c2FB2DA", + "0x56AFfc8EB077182157e90106B7924e089E86adcD", + "0xeC649a0Fc3D6af24d21ae9059DA1FFF4c9e6E727", + "0x94118a1752cE651e8e4Ea21620C4da46D8f143d4", + "0xe0BA4Bd9211e840e3B7b8B46816f247484916fE2", + "0xa21dD344EA44306e32582EB372B1e91B196e62FB", + "0xEA751A395725E54251308AE2DC5741E5EB4Bb5D0", + "0x67c35B10BB74e035EE062bbCa570c42B11893c71", + "0xa8D2Bee3C6FBc33c77814C208A420A3A8862c09B", + "0x77B76f8a50b4Beb89210E1e6194299243F334B03", + "0xEd83EFF17258cbB2d2a22579D1B001A8e9ae2e83", + "0xd70755B67dE0DeDC0fa749D47fF59ff61bB46933", + "0xdFE426842d07957c9e661794822dB12adc20b856", + "0xeDb1A44fCBC18B0bc8998112b9a987E417bbb23b", + "0xc9e80a3b7D26FF46b8A2F22D4a09E94f42e33039", + "0x126905C4708E55759A63F97D4D47c9E94FcEcB24", + "0x203166db0B7bdDa7a04440c7A0C1E8a8eEd0f11f", + "0xF9cDc12e329247639AC20fC2a2B9CCcAB0d85A4e", + "0xD82d0Cd391b8A1DEa50B9b4E79F02AA66Ee4BeDE", + "0x43691B5a3099365a32644c4216d9EA65cCD41B51", + "0x61373471A5CFaA25C3C7c291d8dc9b45989a8886", + "0x26D27a565865133c8Be4b7B28A1633B4D61bA852", + "0x73f0a7723c193C365Ae413D419EfD6E8e618Bbfe", + "0xb2229CC7a41CC7e5c3564982Cd48B06afFB49a09", + "0x97Fe4cFAeeCA2d0Cb54d8c88bD2D951eEb0C8Da4", + "0x1Bfe85c94bE740C9A8bd4423CfC03EdaB01E17D1", + "0x450b1f5D7872797A5704b1DBdc4042e22E28A495", + "0x6f5362bCAd5F3028FFb9D4575ef17D3e02AaE84b", + "0xe31d2Dba9ec60D0aE5653E967775D7113F75f3bF", + "0x207EC95A4d29b0AEAc7806f3B9FDd39Ce14b5Ff9", + "0x7a1467bb7026baD391d191D49a8B22D0c1E1DDF5", + "0xe9831B5A49D0193002ef4289E8a500438D26EdcC", + "0x341292523DFC4c46300B578D8E7825a83F092a09", + "0x2CeC649c9B5373dA72eF384A8c8340eFfAdcEaE2", + "0x6300ad0C0f0658caFB4D54688aeC30566f71A631", + "0x1A15885096CFE677E2Cd36e64A5FD4f8Fe7e96E1", + "0x8aD0A5159812A3A091E52F0Ee1FDFB8808Be238A", + "0x39768e3055399f05838Fd119eda229655610428b", + "0x373070fAaC2C75eE58Fda6f951a68494219dCda2", + "0x10CA611E52EAeA024535344BD3e1d651b9FaC184", + "0x8B0717362e7ddAf29d38235EB512Fd25C7A1E068", + "0x32C761d3B89e1878753279A4852a919950d448B9", + "0xb76F8dB409F3fe3F0cAA8E4922eEa6896a1A6171", + "0x71cb11349C43b482F654E5F38DC0331B3dD991FB", + "0x0626BE90ed887BC23AF94b546b49CF49521fE0d8", + "0x6c825D8AC98B98f7Ce2d4122154ece3f14188975", + "0x4080D6A1c828456aC4a9AdC8B60df6F4DE942B25", + "0x02392c98D9460DbfD564C04cFC6621d349B90C79", + "0x17cD27740580eA4F5773d4aa50D9E93579b02Dd5", + "0x4F25b50fd0aC12169323c07B693ad9aad6771670", + "0x259a7B98b07e0A8e3d51062901827F50D1462485", + "0x315E0B4C53EDE4DD721C8aad67794678595693F7", + "0x86B9e162C777ea108e7df6461Dd2644cA3A5fe32", + "0xd9F87DeC7dE788BcFc808Cd1c309dB37D977ACCA", + "0x15800c351a38d56d012189f21231e170c48a9764", + "0x86f50144077A62e2b2dd8514B3F06a7bC416eaE6", + "0xA74C821C224A85559c5bba7B76147bBcffEE32f4", + "0x7172A3F5453f453a6D0fb77327ae9209CFC5B519", + "0xd924B1adb80bf30fA49e54EAF9631cFFbBF29fc5", + "0x553899EAf7627bD4DDe54939F5d7791cc0986a9e", + "0xA74e3842b68a71789c8861F418d4F7c61b5f4f61", + "0x4096a34E71045d7B46205dBcf537a4bABD1fbA4B", + "0x89133D25aA5a1d935C5143A3Fc129E7FBdDc9F2c", + "0x0c2AEd118c234aB8adA5a268600FCde97211E9E0", + "0x35B04ADBa055f93AfB55C4aDcb1733E027007dC0", + "0x0b9A63D20dC2F104494FdCd9EdBd7e40d572f349", + "0xE315E491676170e2bE9ebAb022892b500e88E01b", + "0x10aA9E9446ed31B75df5B7F301235A7C5087b711", + "0x4Ea0C774620de22650F15f8f62B333780381DfDD", + "0xDFB65caDda2101a7B6c0B90D296d6A9c1B724A14", + "0x940C9Ba3113fcF75B87Dd46eB03DD023fc600816", + "0x0385131a643d2Eb15765297E0b48207aadbb0A5A", + "0x9883D89F48f0B4A88039cac78eD2A3081A66c2DC", + "0x2f5e44871ccbe7F53e4a812dF76e6417A2b36665", + "0xBabEC3e43C72b85741DEe9F3b6e98af83DF62FEc", + "0x8f4ce599b7A6c647913D7Ef111295d3a4bC8c006", + "0x19F823835650524571B2Efd83971Dc827ab7364A", + "0xe524fB2ad520aF3eD9Dce6D8Ea6E81b6752beFb2", + "0xBB0e625446F7519677db2aa0B5fc9949940b3D3b", + "0xe45C42ED2fa8bC48317c75227a91D8B49198FeD3", + "0x6B889C90D0Bfb856857a83ed02214A02FEE7fA46", + "0x0Cdb6366D8aE177AA273a866865baF4e058cdeB9", + "0x70b07305d17ad51ac8A81eaeDbbc2dA5DB12Fa84", + "0x3579a2711862e561973CbF28bC492b167CEBb8CF", + "0xf44b9aBCc5100DC22B33ac719c632bd1EEC5274d", + "0xDD8ed6392AF61e76BF3f17132A071756fDd094eE", + "0x8d008Aa4FF29733Bf09032cfd45979cE63c71969", + "0x55EcC8387232729ace7b15cD4EB55aaBF392F154", + "0xF20Cd3f92B99B4Bdc21b3C2ED7608267d4089abf", + "0x2487568947Dd2d03292a7F2Bd59485AaC8F00Afc", + "0x2Cb16567F59560C8F818B2Aa5d4b3fE7ab72d6dD", + "0x8208EBc031aBA6e13E7277cea54b42b7Ff6269DE", + "0x5e0c0d6EB53E35BA899b81fdb950ccCB0afAADcc", + "0x530578de626D4F3FDD716affe2e9bEd31A3b54A1", + "0xd1144236E50D257Cc23dA09d514aE4F8eC5C3607", + "0x2561b21335aE1223c61676F73e62d139f1bC88ef", + "0x946669cCBf544D35D272A04289A9AA55E19c1520", + "0x01F62c0FdB59bD820AdB0B45Ddb239a7e7EfCD20", + "0xBBcAD6595590EFB8c4b091298619919A7a51Cf7F", + "0x2D5B68eCdb083E26441EB73C16B86e0E7680DA66", + "0xCa88601ca582F5FA7AfBA26ECc47383E6B1770C2", + "0xA99Bc656A29993C05E6bCafd19A5D4c697277E1B", + "0xEeC83505C7136b4AE8bA9819222f3755A2A8cEF7", + "0xC7d681D00CF8f0C31a8ca9636E1f7058E4a465A4", + "0x6837701b116C74072deE9D8a26B62707b72e3329", + "0xb7754aE3b8044eC15CFe3491201288f1295D40d1", + "0x449A4000d69e46326B938185FfA2a7438A0Ba44b", + "0x99DF7acF2d2A8249B7F2Be131e9911903E0Bfc38", + "0x52614De8e8e2cD217de8AFC63c464205CbDEfE48", + "0x8Ed73DC3Bccc840C43E283740331371e6faC5E88", + "0xB2d955761fB9d481a3A42F17546211447E364DB6", + "0x5bCf5D988A373Bbd591D292F689f5D43d3FDA377", + "0x796Eb8E202ff1c1Db58B1716474e5f7562B07Aac", + "0x551CfDC850427E10522881E3BAe34ee256aCB65e", + "0xf97bd1cE45BF292e1588d4F0f2F7174CC2c81690", + "0x8302a17FC82Ab4Bc7BFa9595372fc89439b413D4", + "0x78292feeac11A682483aDD73660868466b3DC66D", + "0x23C424D3492f809DC3BC473918B12D4F914E97D8", + "0xa028F33b854F58Be522A24E57C32b9226aBD4dd8", + "0xb546841A83d1e3c10E814B280419c33a9e5B7c09", + "0xCAFc0bbeec46292689D881e6dFD02656FeFDBC8a", + "0x2a3CAfeaa0d6ccAe2c99bA285B1c1D3Cf3e8e3e0", + "0xbA1cB80d6Fd52e3174B9DaA0f7752eBe4773500B", + "0x485EFB09b1cddf8750f1abB96c712305D5d7d22a", + "0x3F36BA3a1C951122c59fe8e2EEa9F25D8cd266a2", + "0x9F8230c74E0F8E3c82505eEC20dDB4bd37Fbe7e9", + "0x5Cdd4df7C06a570C2733b2621F65bccc030D22fb", + "0x094Da2a7aa92Db16979F8c740a000F017C78E586", + "0x4db4F7eB136b78a21F6a49FAB2a07AC5454358D2", + "0x534d07b6d997d56d526bB0568F5c0a0875fA7491", + "0xe72bEeDEBc22042B3c054C9d985EF70F3F21C07F", + "0x4B4AC2115c7be54858341A357438089C360D0391", + "0x42443f195F8b0E25150E48965cDa520fDEEf1EC6", + "0x52A6ED8Af9a7587CD7c8097e55Ab51EA167FD1d5", + "0xE75a233bc8d59873CD5a443A7A7a14a18f80de04", + "0xfBdfabdEE0b082f92944cBf7321D901010a05Ff6", + "0x727f490Bd0fD299B98e6118Dbe3762c60241145d", + "0xeCe1E1a00159e831786337a0369eddeb41b44ce3", + "0xC44454116b12424c3CEF37CB4Cd314Be393F4414", + "0xaa6e92d650CD1008423f9502413cD3EB382E80bF", + "0xaaC80725AF8d74B5dCD0462B54bE6959faa49106", + "0x52eca7b8a6681d3541D44677CB7bf6436efaB104", + "0x43309fFccF1ecB86273f363c04b43Da25f2B9211", + "0xf18913fA8a97f703895aFe8102c06EC48a32E543", + "0xd8dC5856143d20A1C4534EAc565805BB23f88e71", + "0x666110FEF0cCee100CD154931aa1349312cb6C86", + "0x19AC1DA1172696c10bE21a3FE8E2f917913Fa2CE", + "0xccB4A945974316E21e333D1d2e81740831caD5Fc", + "0x8594c9e8Fdfe9Fa9D725cC4894E28484675C0894", + "0xa7793ea1aD45Be33EFA1Ea3C7d4ddD6746bc2176", + "0xd60055f132862dcF3Ed08880D8E11c1650BFb5c8", + "0x8C6d98751B4f6a6727F9dFd9670B3978A5762ac5", + "0x29e15bDAE0C0375A4412A83E9f95F7DfD0643Bc5", + "0x2B4a0737e3664A38597118D140E95D56cA022d97", + "0x5707742Df139ec717348E2eBa519891a6F523DD3", + "0x4A7D10BaF5207e866D4667314227123CEF785A01", + "0x48D681d5B9ED09DE4ee2453F26f6973D70611763", + "0xbce9282fe66b7Fc1B7823B884d97492D37530a36", + "0x55b7c199Bac27abbC5ec20B3c3f84d64878e3759", + "0xc98B1FeB7C339f29ca26182e820C9b09A588eAEe", + "0x0B28F99AB08151a751a6B2d5784e68F0796e36e0", + "0x3c50858ba3b778b6dbbe0b034f7ab23dcda37468", + "0xD6B7c1135D62f6EDF2F1d1Af003f3e6baD7deB00", + "0x66AF592fB516b1d8d337B2295B1D6Bade22cb681", + "0x84b106BE2A1b2781d3D560e8304c4197B6F2B40F", + "0xd6F57998B71A8FfE4cb085Ff015f40f75aD5a79E", + "0xE72B57B0c7567a5bE542F6B5ffF1BcB591D7B251", + "0x336dd54Acef3E913D5B59cb2e6fa139e528E8c58", + "0xaF01fC708f1d9bfc07DBcC74590afD005F551AF9", + "0x95c1A7Bc770E33dC1A9AB093a5Ca618Ff96852Fb", + "0x351e0322A75D96F2072c54E22f6013ED76F55FbC", + "0x5c695cf06CC40f0e4692ad4D0b096eF7C4b7ff00", + "0x50ADF00864c443a95253AD3C9ba90E6c0232881B", + "0xE2de4D4d19f6712f0d2836b477c311B627C96565", + "0x1C4C0040c99c0CAe55a66B028ae6644585d10094", + "0x29d237174Fe36eC20c3894251335ca2254b4C4C7", + "0x9cc639E3935b7650439212EC88946580292b5D09", + "0x6b654b20C5fb665d51DEDae98E421EBb0C0348b3", + "0x88249D5728492FFaD4Fb12B0539C9B88A05C3b41", + "0xcE677B9121Ed80429855376F4187bcc24D69dBe7", + "0x922615E9CD49bEf0dcdcdA5a3D650A300fae7d2a", + "0x22cA92B6Ce964c6E64A21Dc15198253231251dA0", + "0x522564885EB8d2b7bDc55Ee289563e1d5b09e8A9", + "0xAc2eAfdBDA2ca4d264A276Ca715081FB7c5fE2AA", + "0x31C5420cB9de6F5A317Efe7c10ab1bC440536dfc", + "0x0e1C794Fb817a20246439C093EBB41321729058a", + "0x8f8854b7782E190912adb538DCecd88fCC8e0909", + "0x01d17C8038cb21A43AFE1da372119A4e18717aFF", + "0x7A1885eC42597B1783dD5754c7a42AE60a5202E1", + "0x6a8673dAF590871198fe073B09D8a3fEAc73Bd3e", + "0x3bdF1D7723bCb1B544b137d3b0C8c38336e06621", + "0x3815a4883b1050D274AFeAf73FAfa41c47941C38", + "0x44a5B6be893cf8071A83aF8c8d81587C09422867", + "0x42A34bDCF4edf2B73Af56803e10654c65aDa3DCe", + "0x47A38879E95B271f8E6DA29006e619aE11eD5A1D", + "0xb1A7c9EcA5079D8Fa7073FB4B0A1150FA67dbf63", + "0x2B6e966230dfD7312979BB754f379c172dc39994", + "0x8bc41d77d5CbD1c7d8F7833Ba08dB5e559D53098", + "0x4ed0c0D87Ed8d52Bda0FfC5eEc393486eF09E8E6", + "0x2DCC96c2ff52E8BA8728C171A581EcE8665Cd34A", + "0x95a272b0672d85330baB132272A36D381F80Af98", + "0x93a2B600aD0dFE4Ba5b464DE30D164D1827F71c7", + "0x61f97F988FAB7c18c61c42d12e2D77612D5eb852", + "0x95dB548c3b9Ec3b310c4667BB6B4c490A5445A0e", + "0x48873b66d6Ec8ed753E1eFc733dA141c87772E5D", + "0x75F38c244dcf0C9214a1a75a423b10e896E1b2eB", + "0x92F9800229eb401106bbF273ECfE7F324620C5E8", + "0x3f24344DDc1C4b0A1D0D6d25260d50E6cF43c975", + "0x92eD2703e4EBC9363b894c645359bCCA5C1950A6", + "0xfa40006daBf692ccC12a5374352509D479f8dFA1", + "0xF1933ABb109bE140c03116aE2774Cf34c3A0eb39", + "0xC31E5c0a413Db0359765F3F88ef1052f802d9ed2", + "0x045A61547d592ea8e394607e601ec81167dDB2bd", + "0x3EF9c9e59dE3F53392dD75e1d0604b3cF85620D4", + "0xa5d08837b1160E83563de264551AFc0273C34B75", + "0x33177e16213d23CbB30e18C0011F5536943AbC83", + "0x75D1Bd5c18c7c4C9362Cd1A845C8c543E27c9f69", + "0x15B83d1A952ce0aCd31C57CA27a288217893991D", + "0x3c6870b4990c8dA73eF18eF25ce34432Cf127554", + "0x9b6F180AaDdF31fe0167aE931c9988548349Fb0D", + "0x39d61795F74377A2Bb69eeF09832c08263C25cc9", + "0x6D26C46086838602E398b0b660871FB961542433", + "0xA350c82529dFdc4Bd8C40086e5aBFd2C00f405a8", + "0xBFb23Ed072c442442f0f049Aa030885483517d36", + "0xD68Bf8eCbA2bc0002F0A8C6cDBE19283b7064C3A", + "0x234eadBA601E874fcED396758875f146992Cf72B", + "0x04aD31904B7cc9d84e6d924972146ABbeB22909b", + "0x420A8E998BC2cc0df14ec8DCf4076aE560B3Ed68", + "0xbCB81BFe71478d182eE612CF71Cb8b68DEC5E84A", + "0xB08a10588E5A8e89f0FaEBfFd18f0AC9eb984022", + "0x2a8d600aa656102Df55017fBA42e404a365bEb4b", + "0xBb381e6d0F3ed77bD47ecB7e9f5C21b800B3a9C6", + "0xbB398185E4b1587F666db8913Aa039fe1663Fd23", + "0xbD76310784908874E0F1f7DfcF2A8fB02594bE6F", + "0x7A729a3B63b9360C4939f8232235801b506c7240", + "0xbCAe8d211969279Eb1e07930e7da4670fe0c10e7", + "0x82D666B8113b7f4dBA99A7982518D6f4d50e771f", + "0xf34E317438C1F6fe863128bD43AB416203c7Cc0F", + "0xF447B93c108d50dc7D52593cB753702A283319aE", + "0xEf52fA3F031235289bd3088ef37c0c9471F99338", + "0x6c9a53d7BdA34815A80cCB6d239142354F39c232", + "0xCe4c5530A150FdB155F02cE42c8791234Bd93688", + "0x3a1FC65e730e3f00a43c58d3770D8a9a38aFEAa5", + "0x4Bc563ead4469C453d526ad603E5223e5B3EDfE4", + "0x24E68643e173BE75C9847ACE5B1aB02Ff2d347B3", + "0x6b6F8CfdF536C71Cc0820387259f181026E964ad", + "0x117325Ad73BFb95e6653baAc3114EF2Ec2f142C4", + "0xAF68D39a0AE64b88AE39A7531A54131946db380E", + "0xFA1054Bb918727B36008CCA64978CD83db230ae0", + "0xc094897bcf7aF2943f439E20ED3A7DcBd7b1C843", + "0xCF3Dfe76608bC47038bB47813081689Fc9a18299", + "0x739b2ea6824Ad2d5D1aF230E9fbc13FBb2E4746a", + "0x1DDE0476FA03c89CD4797169db7034231375F164", + "0xD67C2c733D9cAe58353c49A33Af6DDC206fCee9c", + "0x30B133b801cC60D0676b4c22E961E1718DE15ac9", + "0xf4F4fFCDDAe6B7a1B5B2e0d8eA0Dfd27F013D830", + "0xAF1986Efa7080f4546c2750f08f8Eb0BC714cdb8", + "0xE7D0a4950f44D845846Dd0BA499401ef9E6C310d", + "0x75831D954222abC150359D7A6ee495895Daa26f7", + "0xA321473aE338dd6B83BD20BAeB4D31fBBf1ff34C", + "0x95373F5C8A4FdFf72Cc9E9E0c0eB3b77eF10Ebec", + "0x5086D9849CdB2529a8E1cdB5AfC467aC5018A97d", + "0x89d5410F417858576197d6659D6680b532de7cAD", + "0x1473807Bb1F4328AD27b99d7846C9Df0bB7D46A0", + "0xA2186e410F61Bf1B5f84DD0b11AF281E55825264", + "0xAAfE784942216c8cA73cb0305d6d756B64c56bE2", + "0x4272955b14A1982dc90bec2fa9026941B318809f", + "0xACE58eF4c8350a20Db8cf2f7A452057f809F942F", + "0xe476e01732779Cd1c14b6E084Eb6D7abd10E4815", + "0x8D3c7311497489eBAcF0822f185779A5C7056F8b", + "0xD76f809CDEE95E8961E185003384315191E4F391", + "0x18ef2B849789a2BC790230A8280a6C899C791397", + "0xBac80a35E86fB2c31FfaFC12dF70cfc032D2fA5E", + "0x991C2C63ABfaA999B1Cb5Cb4B05237BCfcD3E1d8", + "0xcf256e5e665ae67ecd921da7b8c983427036c769", + "0xab3c0ab53ccc8d19a93fb331579ad98101f2bd14", + "0xafdb6f52bfacf17c676873115f50f2d3ebaef771", + "0x2Bf3b14711bDc8739e65D188d48E004645C9ed41", + "0x9E58c1F325f8D1Ba6a43E808588d67Ae6b4b6d34", + "0xe08B10E92D22339785038a494E39e98A62104A91", + "0x5B51dFF90Fe87E22A9170ddB74A979bEcEd880dB", + "0xD2B0009B3a222dF065d9DE766f2b2E01bC2a9825", + "0x6D04758840C946f0BFDB98599AdA4F0f68dE2247", + "0xf8b25F0D1Cfa1cbC3dD13c8a871643D14B81e7A4", + "0x5a06B00442E8bb2F1D7E8A191a27e0455369e9ca", + "0xF2D657a80C0246D81dF0ee02Aa3799b1cCc3F251", + "0x20Ed528e8fdbDCa16423f89dDcc848FfDbF2C14d", + "0xb157A23429fB6CaF15BE8aFA001c409C21A121c2", + "0x5bd1bcA04AE6F64842C4B8bd04fb464Fb7925195", + "0xAAE38D7D9987415Ee7502d2579092c559f1E767E", + "0x6518DCa3565fb7f6328284A6fb167968BA38BAE2", + "0x55A53C8491A3CCFB8084CB4Ea48884478c57346c", + "0xcc359d3C834760E587B579607fA3351dc4253e60", + "0xEe237BC2973963d5ADC121c542E2e508A049c18D", + "0xd835e8182372416E87bD904544501F485D6687cE", + "0xa7739978e6c7DA30D858e636ad2aCea4e912f482", + "0xd226F4F0a217A73035746E657b292c88EeE7daF3", + "0xc6595CEcD11f91517c7774357A0a824472b850D5", + "0x39475a68B88415B17324d06676B550A83BF2C70b", + "0x4636E1B72076732b16ea99DE639692Ea05a34893", + "0x3ED98536D5971D4EAC1881ffc8AbDDa2E2bc2ab4", + "0xA3Af04BaA3e418c4cE64DB8bC2d6FBCb1265f824", + "0x34dC8f8136E62B9323FB434D11CE26bAeFaaD3C3", + "0xAef0652343C154662F17D8b7AA86d2b2DE01D012", + "0x62b16eBF03C5aA31aF040a4C31D2d6b67107d92e", + "0x561078c9521519a71B512FBECa07F6C06AfE2e9b", + "0xc17f3e0cc8f8c270F9665d287fceAEeb228062F7", + "0x40FcDfB0d8f1c3B70745e5d6f62611783B22Ae0F", + "0x3aDb0D0F7569D7934ebB21088031D7663427EbC0", + "0x88e2641212047313d5AE5c01E4EaB4A2eAfBbC28", + "0x08B3361d3f0d51BB7D02894b3496ed771ca811e6", + "0xd1bE0B3c6F71adcF173bF3bD38AD260569B1Ed37", + "0x039C681B4CD27243e79C447BAEa6103f4c7A18e2", + "0x3eFfEc22EF5705a0Db035FE98E55df8b0D1F5076", + "0x6086765f5eaB32E5673629d8A33D5d28671182D4", + "0x8054A73E9e641E465d92CAA16B5Fd4a214C46Be3", + "0x46EebF35206BD1D0e11e89c5AB10b5Fd9DC759B6", + "0x1F72FbbB85591Edf28C73bE614f2F83381bbB95b", + "0x3DE1633fBc6A7B7CDe144f2A805A1c68ae5048f4", + "0xcec7b076BA94378d03e13D5898F9EF0f41394BEE", + "0xdA65AEDCE13c13a98dF8b872Af3596Bd22bC26E3", + "0xb7145dE7F5537D07D7Cc3410691D105566A5E434", + "0x18C5C07a9F68c82de678470a9E9306Ffc3e9Ced6", + "0x26f47811f74f67e0Dc00494406685d07A3255C96", + "0x8582267c3a2bb11fCcF1eBB1c9Af128e94B024E0", + "0x48eF177C15d091A038176cD262638bE999E138D6", + "0x40F7E873Ebefa5BB762341a8DD63f06d9A332D56", + "0x0d5Ecb27D1574E3B574d6D8c93C628d17348c99B", + "0x52692fF7230Bb3a11B77B09a63682F6Ef4d43B1c", + "0x177Bd708eB4880d2f0e0E319F48BF1308CFe6494", + "0x55BcAe2D9797184b30D0480A1F6aC3763AEdd9a5", + "0xFDc10560bd833B763352C481f5785Dd69C803429", + "0xC7abe55e5532ddA1943bbe5A94bD837dcd96e233", + "0xCce2E2ea6169449715D1B3E74c776335Cece21d6", + "0x7216e8395C37aE8A17665Aaeb8563ef81d6041A8", + "0x662bDd5cb8Aefc78361C653117Fd9a0f896e0246", + "0xfd5E8252d377f20dc53ABDc12B7A21704CC8A566", + "0xf17C4842D9b52C733a127591296B26FaA8F0d30b", + "0xCC0C4D49E2b104a24b6b6c35660fE8e5AEe1bA47", + "0x3a5138Cd818913169E6a5506a39ff1B0A18cA880", + "0x99e76A57337192B70BeC637e75fdd60251AC7Fb9", + "0x613dcbc575034eB8dbBF3FD5AF90697C241F4C73", + "0xEddA6eEd092736B15610767C6d3D7a1D2FCCb5EF", + "0xE7d661aCa8752Ac8A3C7dA51e4D8C468FeA0a76e", + "0xDe0A2585f0b2Fe4DE98C56DAF53389dDe8C315d2", + "0x9E6f53c29870C436F4eDC200714713549ADA274f", + "0x7BE6c15780390aa8335b356693d82411Fc26B6d9", + "0x45A3cac1d1620B28b8bED91d1bc0Eaf0323916A1", + "0x184bcF123cFF6af3F5Bb39BEE3E2a882c1497d6a", + "0x5cB9f1A5A184f56DE000B5Cf7492F1839451a742", + "0x1B589B49A02960973C8A1C2F5ab6e56023a6bbca", + "0x8F73C2eB80a0A6E83C6d74161f4872d5B9076A1C", + "0xaA4d006b4062650Ab4824f5E44187F10dbc6F100", + "0xc10c76ab2fcc743b783378ad5c192ade0ad70912", + "0x5fe9F73b79106f78552d3D846776300b9aDDd535" + ], + "kava": [ + "0xE9dfDD6Db5577504630aF0d59F6DA0fE58A7A543", + "0xA58580B3Ee8997A6F351b558Ba66785AFC9cF4aD", + "0xA066F4f1B3326a24EE88e0703b480E47fA28617c", + "0xD468F11f00133f843152eFE796094cF7da3C0CeF", + "0x144779e1D5d2177084e8DC58C703C7683a41c8Ad", + "0xC1D17E608236b7338c91ef6909Ed5631823d0631", + "0x83A369A0D21cCcC9594B35eA2EDb578737e2125E", + "0xfB8eDeD3e963C1Ba0e5215DB124848400C7a69dA" + ], + "arbitrum": [ + "0xC536FEDe5427cbF80A891eCABA1F4A67104c6bBf", + "0xAA23927C9ae3061517a6AD63d2F97E40d0357638", + "0x6b66F96cA6f9b27B87682c3FA6D628d509a550D9", + "0x4e3569d91F08402a6215cfA80E2CaA646d704242", + "0xCdE69123119036D088Ef45c6A28C4cECa697f52F", + "0xCfFfE2214D71835b23b8EFCB53253C56F2E4F86C", + "0xacC52DB471106b0cb4681958B9c40A2067C9F4b1", + "0x2228E92aF2bE0adeb69Fa5DF677E442BEf9a1343", + "0x77922ECD7618a4cEE460d2e45836827f1A35dee7", + "0xD6Ce8A5021C7731119Bb7ac714408ba38eFE450A", + "0xcc4373Ff112Bc16e56Fc57C4c75b90EaD04A16a9", + "0xC37b270a403057F3Fac0BEe873D72F8AdE086a3b", + "0x155fFdab92888d2600c1ff4cEBe9dB88f546890f", + "0xD71aA46F14e8CD63a18E3BBe778752D2a5E0cDD2", + "0xF3466b8dB66A3Fc6bb7cA22E3029E3f3F9f247AB", + "0xfe71D131b449e854bA6b3173ada393D41e58275f", + "0xf07355A90b03bfbf262CfBdB5DcABA6B6D77B23f", + "0x93f4f49411284636215C4CCf9120EC9C573a4235", + "0x7692a071Ab5267656333635e97E65b6F2734421E", + "0x1D8308b7cD5eD3762E0871EC2ef6b5b7d5DcDc47", + "0xc93E5392e1F2de59c822FB105AB10d75A547C895", + "0x488F3e4582cAaf0417b1051174861235726fbAb4", + "0x13AaeDC6d4Fb37Ebb71EC5612BfCC64Ff352E948", + "0x4dfC3Cc8275e71ecB9C060e0358044910Ecd572A", + "0x114Bc9fb8c6A0a92348C0Fb59a0ec3984a469b39", + "0x43AbE4df66235Cd8F11F8ef7931ca5330EC32c80", + "0xdD35cd7Bf20e22bbf6DF92221618202259e88661", + "0x15dF484c8caE85c895AcDD9198c3c01FEcd18938", + "0x622502B553AEaCC6D82d39f6AbedAb877B502ed9", + "0x6375B4C1eF33FE9A2dD4EFf936812f93c330134e", + "0x0bcACf155ceB5F5a3A8a61049934E3D79E65c13B", + "0x7c98B83925ea2574E688808Bc1cfB1F82F3Af559", + "0x0289dfF687B38b04eaE6887D1CB68a9F08B3e4f5", + "0xF4771304A5C01E5267b4E8Bc964042485ACaE5D8", + "0x48C0069565e2265b2D5586F762577DE38dc7778D", + "0x9E89e79DF8fEb31EB0d529586201A5541978CbE5", + "0x5E173F6Bf035cFf25029dee6003e8CC18Ac65D7e" + ], + "avax": [ + "0xdFE426842d07957c9e661794822dB12adc20b856", + "0x9aBE7c2062780e7ff8cd9E48bddc54c44107bB62", + "0x852e297f5fD64bB97da1Ce0eDfFB807dDe6f3296", + "0xF9cDc12e329247639AC20fC2a2B9CCcAB0d85A4e", + "0x6D254E5a833A62119631A75A52bEE7c9fb131199", + "0x9495651be0CAE17125091E86DdEf35C4D46085E7", + "0xe7EAbBF65BE5ecFf390124e0FABf15048C4442F5", + "0xFB65Af3cF542E356C16065467937BF90BB7B54BB", + "0xBA3D12D3a11ec109504518c7C284f39fD1626B6D", + "0x87EFdAe3fE46a861ec96fD5ffB5e4C5DDc8f9e79", + "0xf7afb8BBB576E883a6f8fA178b01d9D1E6233635", + "0xF57b11637EeE8e199A1CeE403F0A9efe0B9c968f", + "0x992804e457CBa7EC1f08c8EEE2536eE4a5c38304", + "0xc9dbE91fa4306208dFa092eCc6C1952AfF964bb3", + "0x507f9CB0A7269602588c184BcEB2e0Fdb1bA62Ce", + "0xc33e491BF463F410eF530DB307c384CE4Fa5B52B", + "0xc03edF8e71170985b0E7217C530BBEab83396F32", + "0xD468F11f00133f843152eFE796094cF7da3C0CeF", + "0xEA1A8b0D746b7ab2479655fB49ddFe9381b6d96C", + "0xCD2d3dF9b116E4f8A40271aD3838cDc581B20405", + "0xBa5702F3B09F9DD43b6915D67F5f98AfA2c4ef14", + "0xa638BC40082C2233a9285580d9176E7c0784e7A8", + "0x91bABb9e0CBdc9E7b6B04c03B8DC15E1Da92E143", + "0x7848B2163f0BE2Fc7c855021a8f0A59b2697934A", + "0x7B13baABa686990746153B08D420002Aa6eA2d75", + "0x81e9C6F53aD8576Ba9D73DEad9D48be91151d3da", + "0x8c0e385725070491F42f2b453559C478d9825763" + ] +} \ No newline at end of file diff --git a/projects/grim/index.js b/projects/grim/index.js index 1e553b79d3c..637772c25f8 100644 --- a/projects/grim/index.js +++ b/projects/grim/index.js @@ -1,28 +1,14 @@ -const utils = require('../helper/utils'); - -async function fetch() { - const response = await utils.fetchURL('https://api.grim.finance/tvl'); - - let tvl = 0; - for (const chainId in response.data) { - const chain = response.data[chainId]; - - for (const vault in chain) { - tvl += chain[vault]; +const { sumTokens2 } = require('../helper/unwrapLPs') +const config = require('./config.json') + +Object.keys(config).forEach(chain => { + const pools = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const tokens = await api.multiCall({ abi: 'address:want', calls: pools}) + const bals = await api.multiCall({ abi: 'uint256:balance', calls: pools}) + api.addTokens(tokens, bals) + return sumTokens2({ api, resolveLP: true, }) } } - if(tvl === 0){ - throw new Error("TVL for grim finance cannot be 0") - } - - return tvl; -} - -module.exports = { - hallmarks: [ - [1639785600, "Reentrancy attack"] -], - timetravel: false, - methodology: 'TVL data is pulled from the Grim Finance API "https://api.grim.finance/tvl".', - fetch, -} +}) \ No newline at end of file diff --git a/projects/grizzly-trade/index.js b/projects/grizzly-trade/index.js new file mode 100644 index 00000000000..e2f16a31bf5 --- /dev/null +++ b/projects/grizzly-trade/index.js @@ -0,0 +1,7 @@ +const { gmxExports } = require('../helper/gmx') + +module.exports = { + bsc: { + tvl: gmxExports({ vault: '0x606E4922b259fe28c10e6731e8317705AA1e253B', }) + }, +} \ No newline at end of file diff --git a/projects/grizzlyfi/index.js b/projects/grizzlyfi/index.js index 16578e456be..0a3f3a5d22f 100644 --- a/projects/grizzlyfi/index.js +++ b/projects/grizzlyfi/index.js @@ -1,17 +1,23 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); -const { transformBscAddress } = require("../helper/portedTokens"); const { stakings } = require("../helper/staking"); -const { pool2 } = require("../helper/pool2"); -const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); - -const abi = { - inputs: [], - name: "grizzlyStrategyDeposits", - outputs: [{ internalType: "uint256", name: "", type: "uint256" }], - stateMutability: "view", - type: "function" -}; -const hives = [ +const { unwrapLPsAuto } = require("../helper/unwrapLPs"); +const { BigNumber } = require("bignumber.js"); + +const abiGrizzly = "uint256:grizzlyStrategyDeposits" +const abiStandard = "uint256:standardStrategyDeposits" +const abiStable = "uint256:stablecoinStrategyDeposits" +const abiFarm = "uint256:totalDeposits" +const abiYearn = "uint256:totalAssets" +const abiV3 = "function getUnderlyingBalances() view returns (uint256, uint256)" + +const lpReservesAbi = 'function balances(uint256 index) view returns (uint256)' +const tokenAbi = 'function coins(uint256 index) view returns (address)' +const lpSuppliesAbi = "uint256:totalSupply" +const transformAddress = i => 'bsc:' + i + +const pcsHives = [ + // PCS hives { hive: "0xDa0Ae0710b080AC64e72Fa3eC44203F27750F801", token: "0x58F876857a02D6762E0101bb5C46A8c1ED44Dc16" @@ -39,64 +45,201 @@ const hives = [ { hive: "0x6fc2FEed99A97105B988657f9917B771CD809f40", token: "0xF45cd219aEF8618A92BAa7aD848364a158a24F33" - } + }, + // Biswap hives + { + hive: "0x0286A72F055A425af9096b187bf7f88e9f7D96A9", + token: "0x8840C6252e2e86e545deFb6da98B2a0E26d8C1BA" + }, + { + hive: "0xB07a180735657a92d8e2b77D213bCBE5ab819089", + token: "0xa987f0b7098585c735cD943ee07544a84e923d1D" + }, + { + hive: "0xe178eaDBcb4A64476B8E4673D99192C25ef1B42e", + token: "0x63b30de1A998e9E64FD58A21F68D323B9BcD8F85" + }, ]; -async function tvl(timestamp, block, chainBlocks) { - const balances = {}; - block = chainBlocks.bsc; - - const [{ output: bnbBalance }, { output: hiveBalances }] = await Promise.all([ - sdk.api.eth.getBalance({ - target: "0x1022a84f347fc1E6D47128E5364C9Aa1f43a2630", - block: chainBlocks.bsc, - chain: "bsc" - }), - sdk.api.abi.multiCall({ - calls: hives.map(h => ({ target: h.hive })), - abi, - chain: "bsc", - block - }) - ]); - - const lpPositions = hiveBalances.map((b, i) => ({ - balance: b.output, - token: hives[i].token - })); - - await unwrapUniswapLPs( - balances, - lpPositions, - block, - "bsc", - await transformBscAddress() - ); - - sdk.util.sumSingleBalance( - balances, - "bsc:0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c", - bnbBalance - ); +const farms = [ + { + hive: "0x3641676bFe07F07DD2f79244BcdBb751f95F67Ca", + token: "0x2b702b4e676b51f98c6b4af1b2cafd6a9fc2a3e0" + }, + { + hive: "0xF530B259fFf408aaB2B02aa60dd6fe48FCDC2FC9", + token: "0x352008bf4319c3b7b8794f1c2115b9aa18259ebb" + }, +] + +const stableHives = [ + { + hive: "0x7Bf5005F9a427cB4a3274bFCf36125cE979F77cb", + token: "0x36842f8fb99d55477c0da638af5ceb6bbf86aa98", + swap: "0x169f653a54acd441ab34b73da9946e2c451787ef" + }, + { + hive: "0x7E5762A7D68Fabcba39349229014c59Db6dc5eB0", + token: "0xee1bcc9f1692e81a281b3a302a4b67890ba4be76", + swap: "0x3efebc418efb585248a0d2140cfb87afcc2c63dd" + }, + { + hive: "0xCCf6356C96Eadd2702fe6f5Ef99B1C0a3966EDf7", + token: "0x1a77c359d0019cd8f4d36b7cdf5a88043d801072", + swap: "0xc2f5b9a3d9138ab2b74d581fc11346219ebf43fe" + }, +] +const yearnHives = [ + // Thena hives + { + hive: "0x5Aa6dd6bA3091ba151B4E5c0C0c4f06335e91482", + token: "0xa97e46dc17e2b678e5f049a2670fae000b57f05e" + }, + { + hive: "0x38b2f5038F70b8A4a54A2CC8d35d85Cc5f0794e4", + token: "0xc8da40f8a354530f04ce2dde98ebc2960a9ea449" + }, + { + hive: "0x3dF96fE4E92f38F7C931fA5A00d1f644D1c60dbF", + token: "0x075e794f631ee81df1aadb510ac6ec8803b0fa35" + }, + { + hive: "0x9Ce89aba449135539A61C57665547444a92784aB", + token: "0x3c552e8ac4473222e3d794adecfa432eace85929" + }, + { + hive: "0xc750432473eABE034e84d373CB92f16e6EB0d273", + token: "0x3ec80a1f547ee6fd5d7fc0dc0c1525ff343d087c" + }, + { + hive: "0xf01F9e8A5C6B9Db49e851e8d72B70569042F0e1C", + token: "0x63db6ba9e512186c2faadacef342fb4a40dc577c" + }, + { + hive: "0xF7DE4A13669CB33D54b59f35FE71dFcD67e4635E", + token: "0x34b897289fccb43c048b2cea6405e840a129e021" + } +] + +const pcsV3 = [ + { + hive: "0x25223015ee4dbaf9525ddd43797cae1dcd83f6b5", + token0: ADDRESSES.bsc.USDT, + token1: ADDRESSES.bsc.BUSD + }, + { + hive: "0x9eab3bf245da9b6d8705b1a906ee228382c38f93", + token0: ADDRESSES.bsc.USDT, + token1: ADDRESSES.bsc.USDC + }, + { + hive: "0x76ab668d93135bcd64df8e4a7ab9dd05fac4cdbf", + token0: ADDRESSES.bsc.USDC, + token1: ADDRESSES.bsc.BUSD + } +] + +async function tvl(timestamp, block, chainBlocks, { api }) { + const balances = api.getBalances(); + + const getHive = i => i.hive + + const [hiveBalancesGrizzly, + hiveBalancesStandard, + hiveBalancesStable, + stableHiveBalancesGrizzly, + stableHiveBalancesStandard, + stableHiveBalancesStable, + farmBalances, + yearnBalances, + pcsV3Balances] = await Promise.all([ + api.multiCall({ calls: pcsHives.map(getHive), abi: abiGrizzly, }), + api.multiCall({ calls: pcsHives.map(getHive), abi: abiStandard, }), + api.multiCall({ calls: pcsHives.map(getHive), abi: abiStable, }), + api.multiCall({ calls: stableHives.map(getHive), abi: abiGrizzly, }), + api.multiCall({ calls: stableHives.map(getHive), abi: abiStandard, }), + api.multiCall({ calls: stableHives.map(getHive), abi: abiStable, }), + api.multiCall({ calls: farms.map(getHive), abi: abiFarm, }), + api.multiCall({ calls: yearnHives.map(getHive), abi: abiYearn, }), + api.multiCall({ calls: pcsV3.map(getHive), abi: abiV3, }), + ]); + + hiveBalancesGrizzly.map((b, i) => { + const token = pcsHives[i].token + api.add(token, b) + api.add(token, hiveBalancesStandard[i]) + api.add(token, hiveBalancesStable[i]) + }); + + const lpPositionsStable = stableHiveBalancesGrizzly.map((b, i) => { + const grizzly = new BigNumber(b); + const standard = new BigNumber(stableHiveBalancesStandard[i]); + const stable = new BigNumber(stableHiveBalancesStable[i]); + + return { + balance: grizzly.plus(standard).plus(stable).toString(), + token: stableHives[i].token, + swap: stableHives[i].swap + } + }); + + farmBalances.forEach((b, i) => api.add(farms[i].token, b)); + yearnBalances.forEach((b, i) => api.add(yearnHives[i].token, b)); + + pcsV3Balances.forEach((b, i) => { + api.add(pcsV3[i].token0, b[0]) + api.add(pcsV3[i].token1, b[1]) + }); + + await unwrapStablePcsLPs(balances, lpPositionsStable, api) + await unwrapLPsAuto({ ...api, balances, }) return balances; } +async function unwrapStablePcsLPs(balances, lpPositions, api) { + lpPositions = lpPositions.filter(i => +i.balance > 0) + const swaps = lpPositions.map(i => i.swap) + + const [ + lpReserves0, + lpReserves1, + lpSupplies, + tokens0, + tokens1, + ] = await Promise.all([ + api.multiCall({ abi: lpReservesAbi, calls: swaps.map(i => ({ target: i, params: [0] })) }), + api.multiCall({ abi: lpReservesAbi, calls: swaps.map(i => ({ target: i, params: [1] })) }), + api.multiCall({ abi: lpSuppliesAbi, calls: lpPositions.map(i => i.token), }), + api.multiCall({ abi: tokenAbi, calls: swaps.map(i => ({ target: i, params: [0] })), }), + api.multiCall({ abi: tokenAbi, calls: swaps.map(i => ({ target: i, params: [1] })), }), + ]) + + + lpPositions.map((lpPosition, i) => { + const token0 = tokens0[i].toLowerCase() + const token1 = tokens1[i].toLowerCase() + const supply = lpSupplies[i] + const _reserve0 = lpReserves0[i] + const _reserve1 = lpReserves1[i] + + const token0Balance = BigNumber(lpPosition.balance).times(BigNumber(_reserve0)).div(BigNumber(supply)) + sdk.util.sumSingleBalance(balances, transformAddress(token0), token0Balance.toFixed(0)) + const token1Balance = BigNumber(lpPosition.balance).times(BigNumber(_reserve1)).div(BigNumber(supply)) + sdk.util.sumSingleBalance(balances, transformAddress(token1), token1Balance.toFixed(0)) + }) +} + module.exports = { + misrepresentedTokens: true, bsc: { tvl, - pool2: pool2( - "0xF530B259fFf408aaB2B02aa60dd6fe48FCDC2FC9", - "0x352008bf4319c3B7B8794f1c2115B9Aa18259EBb", - "bsc" - ), staking: stakings( [ - "0x6F42895f37291ec45f0A307b155229b923Ff83F1", + "0x6F42895f37291ec45f0A307b155229b923Ff83F1", "0xB80287c110a76e4BbF0315337Dbc8d98d7DE25DB" ], "0xa045e37a0d1dd3a45fefb8803d22457abc0a728a", - "bsc" ) } }; diff --git a/projects/groprotocol/abi.json b/projects/groprotocol/abi.json index dfb6747415e..43111bca20d 100644 --- a/projects/groprotocol/abi.json +++ b/projects/groprotocol/abi.json @@ -1,28 +1,4 @@ { - "totalAssets": { - "inputs": [], - "name": "totalAssets", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "totalSupply": { - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -} + "totalAssets": "uint256:totalAssets", + "totalSupply": "uint256:totalSupply" +} \ No newline at end of file diff --git a/projects/groprotocol/helpers.js b/projects/groprotocol/helpers.js deleted file mode 100644 index 4cf25f4860d..00000000000 --- a/projects/groprotocol/helpers.js +++ /dev/null @@ -1,236 +0,0 @@ -const sdk = require("@defillama/sdk"); -const BigNumber = require("bignumber.js"); - -const lpReservesAbi = { - constant: true, - inputs: [], - name: "getReserves", - outputs: [ - { internalType: "uint112", name: "_reserve0", type: "uint112" }, - { internalType: "uint112", name: "_reserve1", type: "uint112" }, - { internalType: "uint32", name: "_blockTimestampLast", type: "uint32" }, - ], - payable: false, - stateMutability: "view", - type: "function", -}; -const lpSuppliesAbi = { - constant: true, - inputs: [], - name: "totalSupply", - outputs: [{ internalType: "uint256", name: "", type: "uint256" }], - payable: false, - stateMutability: "view", - type: "function", -}; -const token0Abi = { - constant: true, - inputs: [], - name: "token0", - outputs: [{ internalType: "address", name: "", type: "address" }], - payable: false, - stateMutability: "view", - type: "function", -}; -const token1Abi = { - constant: true, - inputs: [], - name: "token1", - outputs: [{ internalType: "address", name: "", type: "address" }], - payable: false, - stateMutability: "view", - type: "function", -}; - -/* lpPositions:{ - balance, - token -}[] -*/ -async function unwrapUniswapLPs( - balances, - lpPositions, - block, - chain = "ethereum", - transformAddress = (addr) => addr, - excludeTokensRaw = [], - retry = false -) { - const excludeTokens = excludeTokensRaw.map((addr) => addr.toLowerCase()); - const lpTokenCalls = lpPositions.map((lpPosition) => ({ - target: lpPosition.token, - })); - const lpReserves = sdk.api.abi.multiCall({ - block, - abi: lpReservesAbi, - calls: lpTokenCalls, - chain, - }); - const lpSupplies = sdk.api.abi.multiCall({ - block, - abi: lpSuppliesAbi, - calls: lpTokenCalls, - chain, - }); - const tokens0 = sdk.api.abi.multiCall({ - block, - abi: token0Abi, - calls: lpTokenCalls, - chain, - }); - const tokens1 = sdk.api.abi.multiCall({ - block, - abi: token1Abi, - calls: lpTokenCalls, - chain, - }); - if (retry) { - await Promise.all( - [ - [lpReserves, lpReservesAbi], - [lpSupplies, lpSuppliesAbi], - [tokens0, token0Abi], - [tokens1, token1Abi], - ].map(async (call) => { - await requery(await call[0], chain, block, call[1]); - }) - ); - } - await Promise.all( - lpPositions.map(async (lpPosition) => { - try { - const lpToken = lpPosition.token; - const token0 = (await tokens0).output - .find((call) => call.input.target === lpToken) - .output.toLowerCase(); - const token1 = (await tokens1).output - .find((call) => call.input.target === lpToken) - .output.toLowerCase(); - const supply = (await lpSupplies).output.find( - (call) => call.input.target === lpToken - ).output; - const { _reserve0, _reserve1 } = (await lpReserves).output.find( - (call) => call.input.target === lpToken - ).output; - if (!excludeTokens.includes(token0)) { - const token0Balance = BigNumber(lpPosition.balance) - .times(BigNumber(_reserve0)) - .div(BigNumber(supply)); - sdk.util.sumSingleBalance( - balances, - await transformAddress(token0), - token0Balance.toFixed(0) - ); - } - if (!excludeTokens.includes(token1)) { - const token1Balance = BigNumber(lpPosition.balance) - .times(BigNumber(_reserve1)) - .div(BigNumber(supply)); - sdk.util.sumSingleBalance( - balances, - await transformAddress(token1), - token1Balance.toFixed(0) - ); - } - } catch (e) { - console.log( - `Failed to get data for LP token at ${lpPosition.token} on chain ${chain}` - ); - throw e; - } - }) - ); -} - -const crvPools = { - // PWRD-3CRV - "0xbcb91e689114b9cc865ad7871845c95241df4105": { - swapContract: "0x001C249c09090D79Dc350A286247479F08c7aaD7", - underlyingTokens: [ - "0xf0a93d4994b3d98fb5e3a2f90dbc2d69073cb86b", - "0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490", - ], - }, -}; - -async function unwrapCrvLPs( - balances, - lpPositions, - block, - chain = "ethereum", - transformAddress = (addr) => addr, - excludeTokens = [] -) { - await Promise.all( - lpPositions.map(async (lp) => { - try { - await unwrapCrv( - balances, - lp.token, - lp.balance, - block, - chain, - transformAddress, - excludeTokens - ); - } catch (e) { - console.log( - `Failed to get data for LP token at ${lp.token} on chain ${chain}` - ); - throw e; - } - }) - ); -} - -async function unwrapCrv( - balances, - crvToken, - balance3Crv, - block, - chain = "ethereum", - transformAddress = (addr) => addr, - excludeTokensRaw = [] -) { - const excludeTokens = excludeTokensRaw.map((t) => t.toLowerCase()); - if (crvPools[crvToken.toLowerCase()] === undefined) { - return; - } - const underlyingTokens = crvPools[crvToken.toLowerCase()].underlyingTokens; - const crvTotalSupply = sdk.api.erc20.totalSupply({ - target: crvToken, - block, - chain, - }); - const underlyingSwapTokens = ( - await sdk.api.abi.multiCall({ - calls: underlyingTokens.map((token) => ({ - target: token, - params: [crvToken], - })), - block, - chain, - abi: "erc20:balanceOf", - }) - ).output; - const resolvedCrvTotalSupply = (await crvTotalSupply).output; - underlyingSwapTokens.forEach((call) => { - if (excludeTokens.includes(call.input.target.toLowerCase())) { - return; - } - const underlyingBalance = BigNumber(call.output || 0) - .times(balance3Crv) - .div(resolvedCrvTotalSupply); - sdk.util.sumSingleBalance( - balances, - transformAddress(call.input.target), - underlyingBalance.toFixed(0) - ); - }); -} - -module.exports = { - unwrapCrv, - unwrapCrvLPs, - unwrapUniswapLPs, -}; diff --git a/projects/groprotocol/index.js b/projects/groprotocol/index.js index 077297aecbe..aaa8a6958be 100644 --- a/projects/groprotocol/index.js +++ b/projects/groprotocol/index.js @@ -1,9 +1,8 @@ +const ADDRESSES = require('../helper/coreAssets.json') // Adapter for Gro Protocol : https://gro.xyz const sdk = require("@defillama/sdk"); -const { sumBalancerLps } = require("../helper/unwrapLPs"); -const { unwrapUniswapLPs, unwrapCrvLPs } = require("./helpers"); -const { transformAvaxAddress } = require("../helper/portedTokens"); +const { sumTokens2, } = require("../helper/unwrapLPs"); const groTokenAbi = require("./abi.json"); const { stakings } = require("../helper/staking"); @@ -14,180 +13,80 @@ const GVT = "0x3ADb04E127b9C0a5D36094125669d4603AC52a0c"; // Protocol token repr const PWRD = "0xf0a93d4994b3d98fb5e3a2f90dbc2d69073cb86b"; // Protocol token representing share of assets, fully count // Gro Protocol LP Pool Addresses -const PO_SS_GRO = "0x3Ec8798B81485A254928B70CDA1cf0A2BB0B74D7"; // Count only if staked const P1_UNI_GRO_GVT = "0x2ac5bC9ddA37601EDb1A5E29699dEB0A5b67E9bB"; // Count non-GVT assets and only if staked const P2_UNI_GRO_USDC = "0x21C5918CcB42d20A2368bdCA8feDA0399EbfD2f6"; // Count only if staked -const P3_SS_GVT = "0x3ADb04E127b9C0a5D36094125669d4603AC52a0c"; // Ignore as GVT already counted const P4_CRV_PWRD_TCRV = "0xbcb91E689114B9Cc865AD7871845C95241Df4105"; // Count non-PWRD assets and only if staked const P5_BAL_GRO_WETH = "0x702605f43471183158938c1a3e5f5a359d7b31ba"; // Count only if staked -// Other Token Addresses -const TCRV = "0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490"; // Count if staked -const DAI = "0x6B175474E89094C44Da98b954EedeAC495271d0F"; // Count if staked -const USDC = "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"; // Count if staked -const USDT = "0xdAC17F958D2ee523a2206206994597C13D831ec7"; // Count if staked -const WETH = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"; // Count if staked - // Contract Addresses const GROTokenStaker1 = "0x001C249c09090D79Dc350A286247479F08c7aaD7"; const GROTokenStaker2 = "0x2E32bAd45a1C29c1EA27cf4dD588DF9e68ED376C"; -async function tvl(timestamp, ethBlock) { +async function tvl(timestamp, ethBlock, _, { api }) { let balances = {}; - const crvLpPositions = []; - - if (timestamp < 1633046400) { - // Before 01-10-2021 - // Prior to this point no pools and no pricing on Coingecko so use 18 decimal DAI as a $1.00 proxy - - for (const token of [PWRD, GVT]) { - const current = await sdk.api.abi.call({ - target: token, - abi: groTokenAbi["totalAssets"], - block: ethBlock, - }); - // Treat amounts as if in DAI. Calls to totalAssets() return USD amount - sdk.util.sumSingleBalance(balances, DAI, current.output); - } - } else { - // On or after 01-10-2021 - // Can output PWRD and GVT balances directly as Coingecko can price the tokens - - // Assets held within PWRD and GVT directly - for (const token of [PWRD, GVT]) { - const current = await sdk.api.abi.call({ - target: token, - abi: groTokenAbi["totalSupply"], - block: ethBlock, - }); - sdk.util.sumSingleBalance(balances, token, current.output); - } - - // Assets held in staking pools (not counting any PWRD or GVT assets as these are already counted) - - // P3_SS_GVT - GVT already accounted for - // P4_CRV_PWRD_TCRV - const p4a = await sdk.api.erc20.balanceOf({ - target: P4_CRV_PWRD_TCRV, - owner: GROTokenStaker1, - block: ethBlock, + // Assets held within PWRD and GVT directly + for (const token of [PWRD, GVT]) { + const current = await api.call({ + target: token, + abi: groTokenAbi["totalSupply"], }); - crvLpPositions.push({ token: P4_CRV_PWRD_TCRV, balance: p4a.output }); - - // P4_CRV_PWRD_TCRV - const p4b = await sdk.api.erc20.balanceOf({ - target: P4_CRV_PWRD_TCRV, - owner: GROTokenStaker2, - block: ethBlock, - }); - crvLpPositions.push({ token: P4_CRV_PWRD_TCRV, balance: p4b.output }); - - await unwrapCrvLPs( - balances, - crvLpPositions, - ethBlock, - "ethereum", - undefined, - [PWRD] - ); // Excludes already counted PWRD amount + sdk.util.sumSingleBalance(balances, token, current); } - return balances; -} -async function pool2(timestamp, ethBlock) { - let balances = {}; - balances = await tokenStaker(timestamp, ethBlock, balances, GROTokenStaker1); - return await tokenStaker(timestamp, ethBlock, balances, GROTokenStaker2); + return balances } -async function tokenStaker(timestamp, ethBlock, balances, GROTokenStaker) { - const uniLpPositions = []; - const balLpPositions = []; - // P1_UNI_GRO_GVT - // P2_UNI_GRO_USDC - const p1 = ( - await sdk.api.erc20.balanceOf({ - target: P1_UNI_GRO_GVT, - owner: GROTokenStaker, - block: ethBlock, - }) - ).output; - uniLpPositions.push({ token: P1_UNI_GRO_GVT, balance: p1 }); - - const p2 = ( - await sdk.api.erc20.balanceOf({ - target: P2_UNI_GRO_USDC, - owner: GROTokenStaker, - block: ethBlock, - }) - ).output; - uniLpPositions.push({ token: P2_UNI_GRO_USDC, balance: p2 }); - await unwrapUniswapLPs( - balances, - uniLpPositions, - ethBlock, - "ethereum", - undefined, - [GVT] - ); // Excludes already counted GVT amount - // P5_BAL_GRO_WETH - if (timestamp > 1633392000) { - // On or after 05-10-2021, P5 pool available - const p5 = await sdk.api.erc20.balanceOf({ - target: P5_BAL_GRO_WETH, - owner: GROTokenStaker, - block: ethBlock, - }); - balLpPositions.push({ P5_BAL_GRO_WETH, p5 }); - - await sumBalancerLps( - balances, - [[P5_BAL_GRO_WETH, GROTokenStaker, true]], - ethBlock, - "ethereum", - (addr) => addr.toLowerCase(addr) - ); - } - return balances; +async function pool2(timestamp, ethBlock, _, { api }) { + return sumTokens2({ + api, + owners: [GROTokenStaker1,GROTokenStaker2 ], + tokens: [ + P4_CRV_PWRD_TCRV, + P1_UNI_GRO_GVT, + P2_UNI_GRO_USDC, + P5_BAL_GRO_WETH, + P5_BAL_GRO_WETH, + ], + }) } const labs = [ { // USDC vault: "0x57DaED1ee021BE9991F5d30CF494b6B09B5B449E", - baseToken: "0xA7D7079b0FEaD91F3e65f86E8915Cb59c1a4C664", + baseToken: ADDRESSES.avax.USDC_e, }, { // DAI vault: "0x5E57E11483A3F60A76af3045303604522059dA2a", - baseToken: "0xd586E7F844cEa2F87f50152665BCbc2C279D8d70", + baseToken: ADDRESSES.avax.DAI, }, { // USDT vault: "0x471F4B4b9A97F82C3a25b034B33A8E306eE9Beb5", - baseToken: "0xc7198437980c041c805A1EDcbA50c1Ce5db95118", + baseToken: ADDRESSES.avax.USDT_e, }, { // USDC vault: "0x2Eb05cfFA24309b9aaf300392A4D8Db745d4E592", - baseToken: "0xA7D7079b0FEaD91F3e65f86E8915Cb59c1a4C664", + baseToken: ADDRESSES.avax.USDC_e, }, { // DAI vault: "0x6063597B9356B246E706Fd6A48C780F897e3ef55", - baseToken: "0xd586E7F844cEa2F87f50152665BCbc2C279D8d70", + baseToken: ADDRESSES.avax.DAI, }, { // USDT vault: "0x6EF44077a1F5e10cDfcCc30EFb7dCdb1d5475581", - baseToken: "0xc7198437980c041c805A1EDcbA50c1Ce5db95118", + baseToken: ADDRESSES.avax.USDT_e, }, ]; -async function avaxTvl(timestamp, _, {avax: block}) { +async function avaxTvl(timestamp, _, { avax: block }) { let balances = {}; - const transform = await transformAvaxAddress(); + const transform = addr => 'avax:'+addr const totalAssets = ( await sdk.api.abi.multiCall({ calls: labs.map((l) => ({ target: l.vault })), @@ -210,10 +109,10 @@ async function avaxTvl(timestamp, _, {avax: block}) { module.exports = { ethereum: { pool2, - staking: stakings([ GROTokenStaker1, GROTokenStaker2 ], GRO), + staking: stakings([GROTokenStaker1, GROTokenStaker2], GRO), tvl, }, - avax:{ + avax: { tvl: avaxTvl, }, start: 1622204347, // 28-05-2021 12:19:07 (UTC) diff --git a/projects/groveswap/index.js b/projects/groveswap/index.js new file mode 100644 index 00000000000..4367ef66bc6 --- /dev/null +++ b/projects/groveswap/index.js @@ -0,0 +1,16 @@ +const { getUniTVL } = require('../helper/unknownTokens') +const { stakingUnknownPricedLP } = require('../helper/staking') + +module.exports = { + misrepresentedTokens: true, + bsc: { + tvl: getUniTVL({ useDefaultCoreAssets: true, factory: '0x0ed713989f421ff6f702b2e4e1c93b1bb9002119', }), + staking: stakingUnknownPricedLP('0x9db65123aa185811e50f8b626a7d4799c39ea4d5', '0xf33893de6eb6ae9a67442e066ae9abd228f5290c', 'bsc', '0xe27f915a8a9ca6c31b193311ae76b8738b926d17'), + }, + ethereum: { + tvl: getUniTVL({ useDefaultCoreAssets: true, factory: '0x6c565c5bbdc7f023cae8a2495105a531caac6e54', }), + }, + grove: { + tvl: getUniTVL({ useDefaultCoreAssets: true, factory: '0x401e7e28e0C679E1a3242ac6CD93C9c56208A260', }), + } +} \ No newline at end of file diff --git a/projects/growth-defi.js b/projects/growth-defi.js deleted file mode 100644 index 63afc2d69bf..00000000000 --- a/projects/growth-defi.js +++ /dev/null @@ -1,29 +0,0 @@ -const axios = require("axios"); - -async function fetch() { - const query = ` - { - totalValueLocked(id: 1) { - totalValueLockedUSD - } - } - `; - - const options = { - method: "post", - url: "https://api.thegraph.com/subgraphs/name/growthdefi/growth-defi", - data: { - query, - }, - }; - - const response = await axios(options); - - const tvl = response.data.data.totalValueLocked.totalValueLockedUSD; - - return parseFloat(tvl); -} - -module.exports = { - fetch -} diff --git a/projects/growthdefi/abi.json b/projects/growthdefi/abi.json index d8c2245ec4c..c257b74be8e 100644 --- a/projects/growthdefi/abi.json +++ b/projects/growthdefi/abi.json @@ -1,156 +1,8 @@ { - "poolInfo": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "poolInfo", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "lpToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "allocPoint", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastRewardBlock", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accCakePerShare", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "poolLength": { - "inputs": [], - "name": "poolLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "symbol": { - "inputs": [], - "name": "symbol", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - "reserveToken": { - "inputs": [], - "name": "reserveToken", - "outputs": [ - { - "internalType": "address", - "name": "_reserveToken", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "totalReserve": { - "inputs": [], - "name": "totalReserve", - "outputs": [ - { - "internalType": "uint256", - "name": "_totalReserve", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "state": { - "inputs": [], - "name": "state", - "outputs": [ - { - "internalType": "address", - "name": "_masterChef", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_pid", - "type": "uint256" - }, - { - "internalType": "address", - "name": "_rewardToken", - "type": "address" - }, - { - "internalType": "address", - "name": "_routingToken", - "type": "address" - }, - { - "internalType": "address", - "name": "_reserveToken", - "type": "address" - }, - { - "internalType": "address", - "name": "_treasury", - "type": "address" - }, - { - "internalType": "address", - "name": "_collector", - "type": "address" - }, - { - "internalType": "address", - "name": "_exchange", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_minimalGulpFactor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_forceGulpRatio", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_performanceFee", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "_emergencyMode", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - } + "poolInfo": "function poolInfo(uint256) view returns (address lpToken, uint256 allocPoint, uint256 lastRewardBlock, uint256 accCakePerShare)", + "poolLength": "uint256:poolLength", + "symbol": "string:symbol", + "reserveToken": "address:reserveToken", + "totalReserve": "uint256:totalReserve", + "state": "function state() view returns (address _masterChef, uint256 _pid, address _rewardToken, address _routingToken, address _reserveToken, address _treasury, address _collector, address _exchange, uint256 _minimalGulpFactor, uint256 _forceGulpRatio, uint256 _performanceFee, bool _emergencyMode)" } \ No newline at end of file diff --git a/projects/growthdefi/abis/belt.json b/projects/growthdefi/abis/belt.json index c7d3c34ad58..5440edfe92d 100644 --- a/projects/growthdefi/abis/belt.json +++ b/projects/growthdefi/abis/belt.json @@ -1,83 +1,7 @@ { - "totalSupply": { - "name": "totalSupply", - "outputs": [ - { - "type": "uint256", - "name": "out" - } - ], - "inputs": [], - "constant": true, - "payable": false, - "type": "function" - }, - "balances": { - "name": "balances", - "outputs": [ - { - "type": "uint256", - "name": "out" - } - ], - "inputs": [ - { - "type": "int128", - "name": "arg0" - } - ], - "constant": true, - "payable": false, - "type": "function" - }, - "coins": { - "name": "coins", - "outputs": [ - { - "type": "address", - "name": "out" - } - ], - "inputs": [ - { - "type": "int128", - "name": "arg0" - } - ], - "constant": true, - "payable": false, - "type": "function" - }, - "sharesToAmount": { - "inputs": [ - { - "internalType": "uint256", - "name": "_shares", - "type": "uint256" - } - ], - "name": "sharesToAmount", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "token": { - "inputs": [], - "name": "token", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } + "totalSupply": "uint256:totalSupply", + "balances": "function balances(int128 arg0) view returns (uint256 out)", + "coins": "function coins(int128 arg0) view returns (address out)", + "sharesToAmount": "function sharesToAmount(uint256 _shares) view returns (uint256)", + "token": "address:token" } \ No newline at end of file diff --git a/projects/growthdefi/abis/clqdr.json b/projects/growthdefi/abis/clqdr.json index 0095497c0ed..3ea13f77ea0 100644 --- a/projects/growthdefi/abis/clqdr.json +++ b/projects/growthdefi/abis/clqdr.json @@ -1,15 +1,3 @@ { - "totalReserve": { - "inputs": [], - "name": "totalReserve", - "outputs": [ - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } + "totalReserve": "uint256:totalReserve" } \ No newline at end of file diff --git a/projects/growthdefi/abis/psm.json b/projects/growthdefi/abis/psm.json index b3c329a3eab..f8c5fb22ef4 100644 --- a/projects/growthdefi/abis/psm.json +++ b/projects/growthdefi/abis/psm.json @@ -1,15 +1,3 @@ { - "peggedToken": { - "inputs": [], - "name": "peggedToken", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } + "peggedToken": "address:peggedToken" } \ No newline at end of file diff --git a/projects/growthdefi/index.js b/projects/growthdefi/index.js index 6c6f63d6802..1d1bb56c540 100644 --- a/projects/growthdefi/index.js +++ b/projects/growthdefi/index.js @@ -1,14 +1,7 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); const clqdr = require("./abis/clqdr.json"); -const psm = require("./abis/psm.json"); -const { staking } = require("../helper/staking"); - -const { - transformBscAddress, - transformAvaxAddress, - transformFantomAddress, -} = require("../helper/portedTokens"); const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); const GRO_BSC = "0x336ed56d8615271b38ecee6f4786b55d0ee91b96"; @@ -63,11 +56,11 @@ const morChainsNonStk = { const transformFrom = async (chain) => { if (chain === "bsc") { - return transformBscAddress(); + return addr => 'bsc:'+addr } else if (chain === "avax") { - return transformAvaxAddress(); + return addr => 'avax:'+addr } else { - return transformFantomAddress(); + return addr => 'fantom:'+addr } }; @@ -298,8 +291,8 @@ const psmConfig = { }; const stableConfig = { - avax: ["0xA7D7079b0FEaD91F3e65f86E8915Cb59c1a4C664"], - bsc: ["0xe9e7cea3dedca5984780bafc599bd69add087d56"], + avax: [ADDRESSES.avax.USDC_e], + bsc: [ADDRESSES.bsc.BUSD], fantom: [], }; @@ -310,9 +303,9 @@ const autoGem = { }; const DAI = { - avax: "0xd586E7F844cEa2F87f50152665BCbc2C279D8d70", + avax: ADDRESSES.avax.DAI, bsc: "0x1af3f329e8be154074d8769d1ffa4ee058b1dbc3", - fantom: "0x8d11ec38a3eb5e956b052f67da8bdc9bef8abf3e", + fantom: ADDRESSES.fantom.DAI, }; //*** PSM staked portion as product of GrowthDefi Protocol ***// diff --git a/projects/gumball/index.js b/projects/gumball/index.js new file mode 100644 index 00000000000..6f46cbd72da --- /dev/null +++ b/projects/gumball/index.js @@ -0,0 +1,71 @@ +const { sumTokens2 } = require("../helper/unwrapLPs"); +const { getTokenPrices } = require("../helper/unknownTokens"); +const sdk = require('@defillama/sdk') + +const abi = { + gbtPrice: "uint256:currentPrice", + deployLength: "function totalDeployed() view returns (uint256)", + baseToken: "function BASE_TOKEN() view returns (address base_token)", + deployInfo: "function deployInfo(uint256) view returns(address gbt, address gnft, address xgbt, bool allowed)" +} + +const GumballFactoryContractArbitrum = '0xf5cfBaF55036264B902D9ae55A114d9A22c42750' + +async function token0CallFn({ api, calls }) { + return calls.map(i => ({ + input: i, + output: i.target + })) +} +async function token1CallFn({ api, calls }) { + return api.multiCall({ abi: abi.baseToken, calls, withMetadata: true, }) +} +async function reservesCallFn({ api, calls }) { + const baseBals = await api.multiCall({ abi: 'uint256:baseBal', calls, }) + const gbtBals = await api.multiCall({ abi: 'uint256:gbtBal', calls, }) + return baseBals.map((val, i) => { + const reserves = [gbtBals[i], val] + reserves._reserve0 = reserves[0] + reserves._reserve1 = reserves[1] + return { + input: calls[i], + output: reserves, + } + }) +} + +async function tvl(_, _b, _cb, { api, }) { + let items = await api.fetchList({ itemAbi: abi.deployInfo, lengthAbi: abi.deployLength, target: GumballFactoryContractArbitrum }) + items = items.filter(i => i.allowed) + // let prices = await api.multiCall({ abi: abi.gbtPrice, calls: items.map(i => i.gbt) }) + let baseTokens = await api.multiCall({ abi: abi.baseToken, calls: items.map(i => i.gbt) }) + const lps = items.map(i => i.gbt) + const nftCalls = items.map(i => ({ target: i.gnft, params: i.xgbt })) + const { balances, updateBalances, } = await getTokenPrices({ + chain: api.chain, block: api.block, useDefaultCoreAssets: true, + allLps: true, lps, token0CallFn, token1CallFn, reservesCallFn, + }) + const nftBalances = await api.multiCall({ abi: 'erc20:balanceOf', calls: nftCalls, }) + nftBalances.forEach((val, i) => { + sdk.util.sumSingleBalance(balances, items[i].gbt.toLowerCase(), val, api.chain) + }) + const toa = [] + items.forEach((val, i) => { + const owners = [val.xgbt] + owners.forEach(o => { + toa.push([baseTokens[i], o]) + toa.push([val.gbt, o]) + }) + }) + + await sumTokens2({ api, tokensAndOwners: toa, balances, }) + await updateBalances(balances) + return balances +} + +module.exports = { + arbitrum: { + tvl, + }, + methodology: 'Value of base token * 2 (nfts in pools are valued equal to base tokens in pool) + staked nft tokens' +} \ No newline at end of file diff --git a/projects/gxypad/index.js b/projects/gxypad/index.js new file mode 100644 index 00000000000..64cf72344b3 --- /dev/null +++ b/projects/gxypad/index.js @@ -0,0 +1,11 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports = { + misrepresentedTokens: true, + era: { + tvl: getUniTVL({ + factory: '0xdCBA2077FE5261753AB29Cc886Bd5CFe1786a7D6', + useDefaultCoreAssets: true, + }) + }, +}; \ No newline at end of file diff --git a/projects/gyroscope/index.js b/projects/gyroscope/index.js new file mode 100644 index 00000000000..89f84e68323 --- /dev/null +++ b/projects/gyroscope/index.js @@ -0,0 +1,43 @@ +const { transformBalances } = require('../helper/portedTokens') +const sdk = require('@defillama/sdk') + +const GYRO_POOL_ADDRESSES = [ + "0x17f1ef81707811ea15d9ee7c741179bbe2a63887", + "0x97469e6236bd467cd147065f77752b00efadce8a", + "0xdac42eeb17758daa38caf9a3540c808247527ae3", + "0xf0ad209e2e969eaaa8c882aac71f02d8a047d5c2", + "0xfa9ee04a5545d8e0a26b30f5ca5cbecd75ea645f", + "0xee278d943584dd8640eaf4cc6c7a5c80c0073e85" +] + +async function tvl(_, _b, _cb, { api, }) { + const balances = {} + + const poolIds = await api.multiCall({ + abi: 'function getPoolId() view returns (bytes32)', + calls: GYRO_POOL_ADDRESSES, + }) + + const vault = await api.call({ + target: GYRO_POOL_ADDRESSES[0], + abi: 'address:getVault', + }) + const data = await api.multiCall({ + abi: 'function getPoolTokens(bytes32 poolId) view returns (address[] tokens, uint256[] balances, uint256 lastChangeBlock)', + calls: poolIds, + target: vault + }) + + data.forEach(i => { + i.tokens.forEach((t, j) => sdk.util.sumSingleBalance(balances,t,i.balances[j])) + }) + + return transformBalances(api.chain, balances) +} + +module.exports = { + methodology: 'sum of all the tokens locked in CLPs', + polygon: { + tvl + } +} \ No newline at end of file diff --git a/projects/gysr/index.js b/projects/gysr/index.js index 4264c701890..ae614ad9691 100644 --- a/projects/gysr/index.js +++ b/projects/gysr/index.js @@ -1,5 +1,6 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { request, gql } = require("graphql-request"); -const { getBlock } = require('../helper/getBlock') +const { getBlock } = require('../helper/http') const { toUSDTBalances } = require('../helper/balances'); @@ -7,7 +8,7 @@ const graphUrlMainnet = "https://api.thegraph.com/subgraphs/name/gysr-io/gysr"; const graphUrlPolygon = "https://api.thegraph.com/subgraphs/name/gysr-io/gysr-polygon"; const graphQuery = gql` query GET_TVL($block: Int) { - platform(id: "0x0000000000000000000000000000000000000000", block: { number: $block }) { + platform(id: "${ADDRESSES.null}", block: { number: $block }) { tvl } } @@ -35,7 +36,7 @@ async function polygon(_, ethBlock, chainBlocks) { graphUrlPolygon, graphQuery, { - block + block: block - 200 } ); diff --git a/projects/hadesswap/index.js b/projects/hadesswap/index.js index 9d1c7837635..527578196e4 100644 --- a/projects/hadesswap/index.js +++ b/projects/hadesswap/index.js @@ -1,13 +1,10 @@ -const { getUniTVL } = require('../helper/unknownTokens') - module.exports = { timetravel: false, misrepresentedTokens: true, + hallmarks: [ + [Math.floor(new Date('2023-06-01')/1e3), 'Chain is abandoned'], + ], polis: { - tvl: getUniTVL({ - chain: 'polis', - factory: '0x4523ad2e05c455d0043910c84c83236a6c98b40b', - useDefaultCoreAssets: true, - }) + tvl: () => 0 }, } diff --git a/projects/hadouken-fi-dex/index.js b/projects/hadouken-fi-dex/index.js new file mode 100644 index 00000000000..93e8eaa056e --- /dev/null +++ b/projects/hadouken-fi-dex/index.js @@ -0,0 +1,22 @@ +const { sumTokens2 } = require('../helper/unwrapLPs') +const { cachedGraphQuery } = require("../helper/cache") + +const endpoint = "https://graph-multi-http-hadouken.hadouken.finance/subgraphs/name/balancer-mainnet" + +const query = `query { + tokens { id name symbol } +}` + +async function tvl(_, _b, _cb, { api, }) { + const { tokens } = await cachedGraphQuery('haduken-fi-dex', endpoint, query) + return sumTokens2({ + api, owner: '0x4f8bdf24826ebcf649658147756115ee867b7d63', tokens: tokens + .filter(i => !i.symbol.startsWith('HDK-')) + .map(i => i.id) + }) +} + +module.exports = { + methodology: "sum of token value in vault excluding the hadouken wrapped tokens", + godwoken_v1: { tvl } +} \ No newline at end of file diff --git a/projects/hadouken-fi-lending/index.js b/projects/hadouken-fi-lending/index.js new file mode 100644 index 00000000000..e7a80719676 --- /dev/null +++ b/projects/hadouken-fi-lending/index.js @@ -0,0 +1,5 @@ +const { aaveExports } = require('../helper/aave'); + +module.exports = { + godwoken_v1: aaveExports('godwoken_v1', '0x10797360711178183455cCa40533FfB62a17C60f') +}; \ No newline at end of file diff --git a/projects/hakuswap/index.js b/projects/hakuswap/index.js index 3257f773435..995be403a6c 100644 --- a/projects/hakuswap/index.js +++ b/projects/hakuswap/index.js @@ -1,27 +1,14 @@ -const sdk = require("@defillama/sdk"); -const { calculateUniTvl } = require("../helper/calculateUniTvl"); + +const { uniTvlExport } = require("../helper/calculateUniTvl"); const { stakingUnknownPricedLP } = require("../helper/staking"); const FACTORY_ADDRESS = "0x2Db46fEB38C57a6621BCa4d97820e1fc1de40f41"; const HAKU_TOKEN_ADDRESS = "0x695Fa794d59106cEbd40ab5f5cA19F458c723829"; const XHAKU_ADDRESS = "0xa95C238B5a72f481f6Abd50f951F01891130b441"; -async function avalancheTvl(timestamp, block, chainBlocks) { - let balances = await calculateUniTvl( - (addr) => `avax:${addr}`, - chainBlocks.avax, - "avax", - FACTORY_ADDRESS, - 0, - true - ); - return balances; -} - - module.exports = { avax:{ - tvl: avalancheTvl, + tvl: uniTvlExport(FACTORY_ADDRESS, 'avax', true), staking: stakingUnknownPricedLP(XHAKU_ADDRESS, HAKU_TOKEN_ADDRESS, "avax", "0x7943Acd42c41a345841cB22Bd846794a22d8682d") }, misrepresentedTokens: true, diff --git a/projects/halodao/index.js b/projects/halodao/index.js index 352ccaa6a61..ba2fb4b4194 100644 --- a/projects/halodao/index.js +++ b/projects/halodao/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const { staking } = require("../helper/staking.js"); const { sumTokens2 } = require('../helper/unwrapLPs') @@ -13,7 +14,7 @@ const wrnbwPolyPool = "0xc104e54803abA12f7a171a49DDC333Da39f47193"; // ETH Pool 2 pool RNBW-ETH const rnbwUniPool = { lpToken: "0x3E8E036Ddfd310B0838d3CC881A9fa827778845D", - token0: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", + token0: ADDRESSES.ethereum.WETH, token1: "0xe94b97b6b43639e238c851a7e693f50033efd75c", }; @@ -22,25 +23,25 @@ const ethPools = [ // USDC:XSGD lpToken: "0x64DCbDeb83e39f152B7Faf83E5E5673faCA0D42A", token0: "0x70e8de73ce538da2beed35d14187f6959a8eca96", - token1: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", + token1: ADDRESSES.ethereum.USDC, }, { // USDC:TCAD lpToken: "0xE15E50fF9d52beC41D53d3173F2ed40834D455f4", token0: "0x00000100F2A2bd000715001920eB70D229700085", - token1: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", + token1: ADDRESSES.ethereum.USDC, }, { // USDC:TAUD lpToken: "0x11816335DEe6763e2A7B6080b2b2980Eac7F85E4", token0: "0x00006100F7090010005F1bd7aE6122c3C2CF0090", - token1: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", + token1: ADDRESSES.ethereum.USDC, }, { // USDC:TGBP lpToken: "0x2ED09E2961D72659E4002ba8C2BaDfedC7db19B7", token0: "0x00000000441378008ea67f4284a57932b1c000a5", - token1: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", + token1: ADDRESSES.ethereum.USDC, }, ]; @@ -49,25 +50,25 @@ const polyPools = [ //xSGD:USDC lpToken: "0x8123C64D6607412C7Ac9E880f12245ef22558b14", token0: "0x769434dca303597c8fc4997bf3dab233e961eda2", - token1: "0x2791bca1f2de4661ed88a30c99a7a9449aa84174", + token1: ADDRESSES.polygon.USDC, }, { //wTCAD:USDC lpToken: "0xaEad273bc7E17DD6951ceD3264B1dBa8A19114C2", token0: "0x6d3cC56DFC016151eE2613BdDe0e03Af9ba885CC", - token1: "0x2791bca1f2de4661ed88a30c99a7a9449aa84174", + token1: ADDRESSES.polygon.USDC, }, { //wTAUD:USDC lpToken: "0x95AB308bE1e209eB6FfdD3279B5ea71D365AD30B", token0: "0xe4F7761b541668f88d04fe9F2E9DF10CA613aEf7", - token1: "0x2791bca1f2de4661ed88a30c99a7a9449aa84174", + token1: ADDRESSES.polygon.USDC, }, { //wTGBP:USDC lpToken: "0xbF772a745533f6bAd97C58D2cb6B241eF7487242", token0: "0x81A123f10C78216d32F8655eb1A88B5E9A3e9f2F", - token1: "0x2791bca1f2de4661ed88a30c99a7a9449aa84174", + token1: ADDRESSES.polygon.USDC, }, ]; @@ -75,21 +76,21 @@ const arbiPools = [ { //fxPHP-USDC lpToken: "0x90b48bb20048786b167473dfeec443142d043cf7", - token0: "0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8", + token0: ADDRESSES.arbitrum.USDC, token1: "0x3d147cD9aC957B2a5F968dE9d1c6B9d0872286a0", }, { //fxAUD-USDC lpToken: "0xd5ad9eed5c5f28d83933779cd7e677e112991f51", - token0: "0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8", + token0: ADDRESSES.arbitrum.USDC, token1: "0x7E141940932E3D13bfa54B224cb4a16510519308", }, ]; //Converts Polygon tokens to ETH tokens cause CoinGecko const tokenConvert = { - "0x2791bca1f2de4661ed88a30c99a7a9449aa84174": - "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", // USDC + [ADDRESSES.polygon.USDC]: + ADDRESSES.ethereum.USDC, // USDC }; async function calcTvl(pools, block, chain) { diff --git a/projects/hamburger/index.js b/projects/hamburger/index.js new file mode 100644 index 00000000000..648dc4f1390 --- /dev/null +++ b/projects/hamburger/index.js @@ -0,0 +1,8 @@ +const { getUniTVL } = require('../helper/unknownTokens.js') + +module.exports = { + misrepresentedTokens: true, + arbitrum: { + tvl: getUniTVL({ factory: '0x989CF6bFA8997E8A01Fa07F3009392d1C734c719', useDefaultCoreAssets: true, hasStablePools: true, }), + }, +} diff --git a/projects/handlefi-fxpreps/index.js b/projects/handlefi-fxpreps/index.js index 8aea310ceab..9efd4ec9d6c 100644 --- a/projects/handlefi-fxpreps/index.js +++ b/projects/handlefi-fxpreps/index.js @@ -35,7 +35,7 @@ const fxTokens = { module.exports = { misrepresentedTokens: true, arbitrum: { - tvl: async (_, _b, cb) => { + tvl: async (_, _b, cb, { api }) => { const fxConfig = [] const tokens = [] @@ -45,7 +45,7 @@ module.exports = { const label = `${chain}:${token.toLowerCase()}` fxConfig.push({ token, label, oracle: oracles[key] }) }) - const balances = await(gmxExports({ chain, vault: perpsVault, })(_, _b, cb)) + const balances = await(gmxExports({ vault: perpsVault, })(_, _b, cb, { api })) const block = cb[chain] const calls = fxConfig.map(i => ({ target: i.oracle })) const { output: price } = await sdk.api.abi.multiCall({ @@ -73,17 +73,5 @@ module.exports = { }; const abis = { - latestAnswer: { - "inputs": [], - "name": "latestAnswer", - "outputs": [ - { - "internalType": "int256", - "name": "", - "type": "int256" - } - ], - "stateMutability": "view", - "type": "function" - } + latestAnswer: "int256:latestAnswer" } \ No newline at end of file diff --git a/projects/handlefi/abi.json b/projects/handlefi/abi.json index 8e758ed6322..d9651e07a73 100644 --- a/projects/handlefi/abi.json +++ b/projects/handlefi/abi.json @@ -1,94 +1,6 @@ { - "rari_dir.pools":{ - "inputs":[ - { - "internalType":"uint256", - "name":"", - "type":"uint256" - } - ], - "name":"pools", - "outputs":[ - { - "internalType":"string", - "name":"name", - "type":"string" - }, - { - "internalType":"address", - "name":"creator", - "type":"address" - }, - { - "internalType":"address", - "name":"comptroller", - "type":"address" - }, - { - "internalType":"uint256", - "name":"blockPosted", - "type":"uint256" - }, - { - "internalType":"uint256", - "name":"timestampPosted", - "type":"uint256" - } - ], - "stateMutability":"view", - "type":"function" - }, - "comptroller.getAllMarkets":{ - "constant":true, - "inputs":[ - - ], - "name":"getAllMarkets", - "outputs":[ - { - "internalType":"contract CToken[]", - "name":"", - "type":"address[]" - } - ], - "payable":false, - "stateMutability":"view", - "type":"function" - }, - "comptroller.underlying":{ - "constant":true, - "inputs":[ - - ], - "name":"underlying", - "outputs":[ - { - "internalType":"address", - "name":"", - "type":"address" - } - ], - "payable":false, - "stateMutability":"view", - "type":"function", - "signature":"0x6f307dc3" - }, - "comptroller.getCash":{ - "constant":true, - "inputs":[ - - ], - "name":"getCash", - "outputs":[ - { - "internalType":"uint256", - "name":"", - "type":"uint256" - } - ], - "payable":false, - "stateMutability":"view", - "type":"function", - "signature":"0x3b1d21a2" - } + "rari_dir.pools": "function pools(uint256) view returns (string name, address creator, address comptroller, uint256 blockPosted, uint256 timestampPosted)", + "comptroller.getAllMarkets": "address[]:getAllMarkets", + "comptroller.underlying": "address:underlying", + "comptroller.getCash": "uint256:getCash" } \ No newline at end of file diff --git a/projects/handlefi/index.js b/projects/handlefi/index.js index 3f1fcc87914..3af9a05cf02 100644 --- a/projects/handlefi/index.js +++ b/projects/handlefi/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk") const { sumTokens2 } = require("../helper/unwrapLPs") const {pool2 } = require("../helper/pool2") @@ -8,7 +9,7 @@ const chain = 'arbitrum' // Arbitrum TVL const transformArbitrumAddress = addr => `arbitrum:${addr}` const treasuryContract = "0x5710B75A0aA37f4Da939A61bb53c519296627994" -const WETH_arbitrum = "0x82af49447d8a07e3bd95bd0d56f35241523fbab1" +const WETH_arbitrum = ADDRESSES.arbitrum.WETH const FOREX_arbitrum = "0xDb298285FE4C5410B05390cA80e8Fbe9DE1F259B" const treasuryTokens = [WETH_arbitrum, ] const perpsVault = "0x1785e8491e7e9d771b2A6E9E389c25265F06326A" diff --git a/projects/hashdaofinance/index.js b/projects/hashdaofinance/index.js new file mode 100644 index 00000000000..28dd4708df5 --- /dev/null +++ b/projects/hashdaofinance/index.js @@ -0,0 +1,45 @@ +const { sumTokens2 } = require("../helper/unwrapLPs"); +const { sumTokensExport } = require("../helper/unknownTokens") +const { staking } = require('../helper/staking') + +const config = { + arbitrum: { + contract: '0x90d11b8de2b30a84cB7e6cf6188581Ec08b1Bf82', + lp: '0x8dC6EFD57A13B7ba3ff7824c9708DB24d3190703', + chef: '0xb557c071BAe7DC3aa2366Cd0FC0477B45Eb696f1', + vHash: '0x958882fda110febd41536e45034bebff2a815006', + hash: '0x2e80259c9071b6176205ff5f5eb6f7ec8361b93f', + }, + optimism: { + contract: '0xF96aad4942D8A0394158Fd960003397690fB795D', + lp: '0xb426aE40E43be57215ba7DAA06Cbc5d48eD35Dcf', + chef: '0xEAB4C6C26A1F296E8E0033ffB817D5311C51299d', + vHash: '0x9D66c32E137E618BEE9669Ae096FD59ba925AaA5', + hash: '0x2e80259c9071b6176205ff5f5eb6f7ec8361b93f', + isPool2: true, + }, + bsc: { + contract: '0x882105478F2193001f8Fed8399aF93f31CC42F85', + lp: '0xc970cdEBe5cF52eA416C5160Dc64A17Db134feE9', + chef: '0x2b9c8B76176957A0448279Da9B8cDEbE94Becd19', + vHash: '0xb557c071BAe7DC3aa2366Cd0FC0477B45Eb696f1', + hash: '0xb4e0E46cC733106F8f5B9845e2011B128A1EA39a', + isPool2: true, + }, +} + +Object.keys(config).forEach(chain => { + const { contract, lp, chef, hash, vHash, isPool2,} = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const owners = await api.call({ target: contract, abi: "function getAllPools() public view returns(address[] memory list)" }) + const tokens = await api.multiCall({ abi: "function getPoolTokens(address _pool) public view returns(address[] memory list)", target: contract, calls: owners }) + return sumTokens2({ api, ownerTokens: tokens.map((v, i) => [v, owners[i]]), }) + } + } + if (chef && lp) + module.exports[chain].pool2 = isPool2 ? sumTokensExport({ owner: chef, tokens: [lp], useDefaultCoreAssets: true, }) : staking(chef, lp) + + if (hash && vHash) + module.exports[chain].staking = staking(vHash, hash, undefined, 'arbitrum:'+config.arbitrum.hash) +}) \ No newline at end of file diff --git a/projects/hashflow/index.js b/projects/hashflow/index.js index ab5fd2b8058..5c68e60201a 100644 --- a/projects/hashflow/index.js +++ b/projects/hashflow/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { get } = require('../helper/http') const { chainExports } = require('../helper/exports'); const { sumTokens } = require("../helper/unwrapLPs"); @@ -15,7 +16,7 @@ const chainIds = { let dataCacheUpdating async function updateDataCache() { - const null_addr = '0x0000000000000000000000000000000000000000'; + const null_addr = ADDRESSES.null; const allChainData = {} for (const chain of Object.keys(chainIds)) { diff --git a/projects/hashking/index.js b/projects/hashking/index.js new file mode 100644 index 00000000000..036bf811bad --- /dev/null +++ b/projects/hashking/index.js @@ -0,0 +1,13 @@ +const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') + +module.exports = { + filecoin: { + tvl: async (_, _1, _2, { api }) => { + const owner = '0xe012f3957226894b1a2a44b3ef5070417a069dc2' + const validators = await api.call({ target: owner, abi: 'function beneficiarys() public view returns (address [] memory)'}) + const bals = await api.multiCall({ abi: 'uint256:totalStakingFil', calls: validators}) + bals.forEach(i => api.add(nullAddress, i)) + return sumTokens2({ api, owners: [owner], tokens: [nullAddress]}) + } + } +} \ No newline at end of file diff --git a/projects/hashmix/index.js b/projects/hashmix/index.js new file mode 100644 index 00000000000..baadd361e7c --- /dev/null +++ b/projects/hashmix/index.js @@ -0,0 +1,58 @@ +const POOL = "0x587A7eaE9b461ad724391Aa7195210e0547eD11d"; +const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') +const { get } = require("../helper/http"); +const BigNumber = require("bignumber.js"); +// const { sdk } = require("@defillama/sdk"); + +// async function tvl(_, _1, _2, { api }) { +// const totalBorrows = await api.call({ target: POOL, abi: "uint256:totalBorrows", }); +// const totalReserves = await api.call({ target: POOL, abi: "uint256:totalReserves", }); +// api.add(nullAddress, totalBorrows) +// api.add(nullAddress, totalReserves * -1) + +// return sumTokens2({ api, owner: POOL, tokens: [nullAddress]}); +// } + +async function tvl(_, _1, _2, { api }) { + + let tvl = await get("https://fvm.hashmix.org/fevmapi/tvl"); + // let b = new BigNumber.BigNumber("337036288533616233281756"); + + api.add(nullAddress, tvl.data) + + return sumTokens2({ api, owner: POOL, tokens: [nullAddress] }); + + // const balances = {}; + // const bal = await sdk.api2.eth.getBalance({ target: POOL, chain: api.chain, decimals: api.decimals }); + // const totalBorrows = await sdk.api2.abi.call({ + // target: POOL, + // abi: "uint256:totalBorrows", + // chain: api.chain, + // }); + // const totalReserves = await sdk.api2.abi.call({ + // target: POOL, + // abi: "uint256:totalReserves", + // chain: api.chain, + // }); + + + // let b = new BigNumber.BigNumber(bal.output); + // b = b.plus(new BigNumber.BigNumber(totalBorrows)).minus(new BigNumber.BigNumber(totalReserves)); + + // sdk.util.sumSingleBalance( + // balances, + // nullAddress, + // b.toFixed(0), + // api.chain + // ); + + // return balances; +} + +module.exports = { + methodology: + "HashMix FIL Liquid Staking Protocol is a decentralized staking protocol on Filecoin, connecting FIL holders and miners in the ecosystem.", + filecoin: { + tvl, + }, +}; diff --git a/projects/hatom-lending/index.js b/projects/hatom-lending/index.js new file mode 100644 index 00000000000..adb9a9cb6db --- /dev/null +++ b/projects/hatom-lending/index.js @@ -0,0 +1,42 @@ +const { sumTokens, call, } = require('../helper/chain/elrond') +const { cachedGraphQuery } = require('../helper/cache') +const { nullAddress } = require('../helper/tokenMapping') + +async function getMoneyMarkets() { + const { queryMoneyMarket: res } = await cachedGraphQuery('hatom-TVLLendingProtocolQuery', 'https://mainnet-api.hatom.com/graphql', ` + query QueryMoneyMarket { + queryMoneyMarket { + address + underlying { + name + decimals + id + } + } + } + `) + res.forEach(i => { + if (i.underlying.id === 'EGLD') i.underlying.id = nullAddress + }) + return res +} + +const tvl = async () => { + const moneyMarkets = await getMoneyMarkets() + return sumTokens({ owners: moneyMarkets.map(i => i.address), }) +}; + +const borrowed = async (_, _1, _2, { api }) => { + const moneyMarkets = await getMoneyMarkets() + const tokens = moneyMarkets.map(i => i.underlying.id) + const bals = await Promise.all(moneyMarkets.map(i => call({ target: i.address, abi: 'getTotalBorrows', responseTypes: ['number'] }))) + api.addTokens(tokens, bals) +}; + +module.exports = { + timetravel: false, + elrond: { + tvl, + borrowed, + }, +}; diff --git a/projects/hatom-liquid-staking/index.js b/projects/hatom-liquid-staking/index.js new file mode 100644 index 00000000000..db9ff8b7bca --- /dev/null +++ b/projects/hatom-liquid-staking/index.js @@ -0,0 +1,14 @@ +const { call, } = require("../helper/chain/elrond"); + +const ADDRESSES = require('../helper/coreAssets.json'); + +const tvl = async () => { + return { ['elrond:' + ADDRESSES.null]: await call({ target: 'erd1qqqqqqqqqqqqqpgq4gzfcw7kmkjy8zsf04ce6dl0auhtzjx078sslvrf4e', abi: 'getCashReserve', responseTypes: ['number'] }) } +}; + +module.exports = { + timetravel: false, + elrond: { + tvl, + }, +}; diff --git a/projects/hats-v2/index.js b/projects/hats-v2/index.js new file mode 100644 index 00000000000..cb1bce34465 --- /dev/null +++ b/projects/hats-v2/index.js @@ -0,0 +1,25 @@ +const { sumTokens2 } = require("../helper/unwrapLPs"); + +const config = { + ethereum: { masterchef: '0xc570c434ba30a2fa5c07e590833246e18aa6b0a3',}, + polygon: { masterchef: '0xa80d0a371f4d37afcc55188233bb4ad463af9e48',}, + bsc: { masterchef: '0xd978eb90eb1b11213e320f4e6e910eb98d8df1e4',}, + arbitrum: { masterchef: '0xa80d0a371f4d37afcc55188233bb4ad463af9e48',}, + optimism: { masterchef: '0xa80d0a371f4d37afcc55188233bb4ad463af9e48',}, +} + +Object.keys(config).forEach(chain => { + const { masterchef } = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const vaults = await api.fetchList({ lengthAbi: 'uint256:getNumberOfVaults', itemAbi: 'function hatVaults(uint256) view returns (address)', target: masterchef}) + const tokens = await api.multiCall({ abi: 'address:asset', calls: vaults}) + const tokensAndOwners = [] + tokens.forEach((token, i) => { + tokensAndOwners.push([token, vaults[i]]) + tokensAndOwners.push([token, masterchef]) + }) + return sumTokens2({ api, tokensAndOwners,}) + } + } +}) \ No newline at end of file diff --git a/projects/hats/index.js b/projects/hats/index.js new file mode 100644 index 00000000000..78e438c6072 --- /dev/null +++ b/projects/hats/index.js @@ -0,0 +1,12 @@ +const { sumTokens2 } = require('../helper/unwrapLPs') +const abi = require('../helper/abis/masterchef.json') + +const vault = '0x571f39d351513146248AcafA9D0509319A327C4D' // vault address +module.exports = { + ethereum: { + tvl: async (_, _1, _2, { api }) => { + const info = await api.fetchList({ lengthAbi: abi.poolLength, itemAbi: abi.poolInfo, target: vault}) + return sumTokens2({ api, owner: vault, tokens: info.map(i => i.lpToken)}) + } + } +} \ No newline at end of file diff --git a/projects/hawksight/index.js b/projects/hawksight/index.js new file mode 100644 index 00000000000..d7b253f4e68 --- /dev/null +++ b/projects/hawksight/index.js @@ -0,0 +1,17 @@ +const { fetchURL } = require('../helper/utils') +const { sumTokens2 } = require('../helper/solana') + + +async function tvl() { + const res = await fetchURL('https://api.hawksight.co/data/hawksight_tvl') + return {'usd': res.data} +} + +module.exports = { + timetravel: false, + methodology: 'Sums the total value locked of all strategies in Hawksight', + solana: { + tvl, + staking: () => sumTokens2({ tokenAccounts: ['2eFeetCpZJprr67F2dToT52BbSkdeqKZT6hmVdVG14eU']}) + } +} \ No newline at end of file diff --git a/projects/hebeswap/index.js b/projects/hebeswap/index.js index 757f4d3e58f..efb2c6426e8 100644 --- a/projects/hebeswap/index.js +++ b/projects/hebeswap/index.js @@ -1,12 +1,10 @@ const { getUniTVL } = require('../helper/unknownTokens') module.exports={ - timetravel: true, misrepresentedTokens: true, methodology: "Factory address (0x09fafa5eecbc11C3e5d30369e51B7D9aab2f3F53) is used to find the LP pairs. TVL is equal to the liquidity on the AMM.", ethereumclassic: { tvl: getUniTVL({ - chain: 'ethereumclassic', factory: '0x09fafa5eecbc11C3e5d30369e51B7D9aab2f3F53', useDefaultCoreAssets: true, }) diff --git a/projects/hectagon/index.js b/projects/hectagon/index.js index 9ac185a5c2b..71eef4b6fba 100644 --- a/projects/hectagon/index.js +++ b/projects/hectagon/index.js @@ -1,7 +1,8 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { staking } = require('../helper/staking'); const { sumTokens2 } = require('../helper/unwrapLPs') -const BUSD_ADDRESS = "0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56"; +const BUSD_ADDRESS = ADDRESSES.bsc.BUSD; const gHECTA = '0x7d31ed03c2442f9ffc4f22d90772ee1f32fa9b0d' const chain = 'bsc' const HECTA_ADDRESS = "0x343915085b919fbd4414F7046f903d194c6F60EE"; diff --git a/projects/hector-lendng/index.js b/projects/hector-lendng/index.js new file mode 100644 index 00000000000..1d2e58ad232 --- /dev/null +++ b/projects/hector-lendng/index.js @@ -0,0 +1,7 @@ + +const { compoundExports } = require("../helper/compound"); +const { nullAddress } = require("../helper/tokenMapping"); + +module.exports = { + fantom: compoundExports('0x56644FA0fCfA09b2a04F659E499847611A8AD176', 'fantom', '0xbb2d100865d4286c94D72d78523747abf84669E9', nullAddress) +}; \ No newline at end of file diff --git a/projects/hector/abi.json b/projects/hector/abi.json index ec2b48f6c82..597588d24eb 100644 --- a/projects/hector/abi.json +++ b/projects/hector/abi.json @@ -1,52 +1,6 @@ { - "userInfo": { - "inputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" }, - { "internalType": "address", "name": "", "type": "address" } - ], - "name": "userInfo", - "outputs": [ - { "internalType": "uint256", "name": "amount", "type": "uint256" }, - { "internalType": "uint256", "name": "rewardDebt", "type": "uint256" }, - { - "internalType": "uint256", - "name": "boostMultiplier", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "want": { - "inputs": [], - "name": "want", - "outputs": [ - { "internalType": "contract IERC20", "name": "", "type": "address" } - ], - "stateMutability": "view", - "type": "function" - }, - "lpToken": { - "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "name": "lpToken", - "outputs": [ - { "internalType": "contract IBEP20", "name": "", "type": "address" } - ], - "stateMutability": "view", - "type": "function" - }, - "poolInfo": { - "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "name": "poolInfo", - "outputs": [ - { "internalType": "address", "name": "lptoken", "type": "address" }, - { "internalType": "address", "name": "token", "type": "address" }, - { "internalType": "address", "name": "gauge", "type": "address" }, - { "internalType": "address", "name": "crvRewards", "type": "address" }, - { "internalType": "address", "name": "stash", "type": "address" }, - { "internalType": "bool", "name": "shutdown", "type": "bool" } - ], - "stateMutability": "view", - "type": "function" - } -} + "userInfo": "function userInfo(uint256, address) view returns (uint256 amount, uint256 rewardDebt, uint256 boostMultiplier)", + "want": "address:want", + "lpToken": "function lpToken(uint256) view returns (address)", + "poolInfo": "function poolInfo(uint256) view returns (address lptoken, address token, address gauge, address crvRewards, address stash, bool shutdown)" +} \ No newline at end of file diff --git a/projects/hector/api.js b/projects/hector/api.js new file mode 100644 index 00000000000..606277d1561 --- /dev/null +++ b/projects/hector/api.js @@ -0,0 +1,4 @@ +const index = require('./index') +const { ohmStaking } = require('../helper/treasury') + +module.exports = ohmStaking(index) \ No newline at end of file diff --git a/projects/hector/contracts.json b/projects/hector/contracts.json index 7de841fa981..086be839c28 100644 --- a/projects/hector/contracts.json +++ b/projects/hector/contracts.json @@ -1,76 +1,37 @@ { "tokenHolders": { - "ethereum": [ - { - "address": "0x4bfb33d65f4167ebe190145939479227e7bf2cb0", - "chain": "ethereum" - }, - { - "address": "0x8a43e670619973944cb573bb23688c24cc0b5131", - "chain": "ethereum" - } - ], - "fantom": [ - { - "address": "0xcb54ea94191b280c296e6ff0e37c7e76ad42dc6a", - "chain": "fantom" - }, - { - "address": "0x677d6ec74fa352d4ef9b1886f6155384acd70d90", - "chain": "fantom" - }, - { - "address": "0x8a43e670619973944cb573bb23688c24cc0b5131", - "chain": "fantom" - }, - { - "address": "0xbe4b73f5caff476ed0cdb4c043236fce81f4dc6c", - "chain": "fantom" - }, - { - "address": "0x35796ce4ed757075d346c1bc374d67628fadcbb1", - "chain": "fantom" - } - ], - "bsc": [ - { - "address": "0x3cdf52cc28d21c5b7b91d7065fd6dfe6d426fcc5", - "chain": "bsc" - }, - { - "address": "0x8a43e670619973944cb573bb23688c24cc0b5131", - "chain": "bsc" - } - ] - }, - "chainMap": { "ethereum": { - "chainId": 1, - "gasToken": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", - "wrappedGasToken": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2" + "blacklistedTokens": [ + ], + "owners": [ + "0x4bfb33d65f4167ebe190145939479227e7bf2cb0", + "0x8a43e670619973944cb573bb23688c24cc0b5131" + ] }, "fantom": { - "chainId": 250, - "gasToken": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", - "wrappedGasToken": "fantom:0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83" + "blacklistedTokens": [ + "0x5C4FDfc5233f935f20D2aDbA572F770c2E377Ab0", + "0x74e23df9110aa9ea0b6ff2faee01e740ca1c642e" + ], + "owners": [ + "0xcb54ea94191b280c296e6ff0e37c7e76ad42dc6a", + "0x677d6ec74fa352d4ef9b1886f6155384acd70d90", + "0x8a43e670619973944cb573bb23688c24cc0b5131", + "0xbe4b73f5caff476ed0cdb4c043236fce81f4dc6c", + "0x35796ce4ed757075d346c1bc374d67628fadcbb1" + ] }, "bsc": { - "chainId": 56, - "gasToken": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", - "wrappedGasToken": "bsc:0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c" + "blacklistedTokens": [ + "0xe98803E5cE78Cf8AAD43267d9852A4057423Cb1d", + "0x80d209227cf0a64e1fcbe62c7a80b8e691f0ef4d", + "0x1d6cbdc6b29c6afbae65444a1f65ba9252b8ca83", + "0x638eebe886b0e9e7c6929e69490064a6c94d204d" + ], + "owners": [ + "0x3cdf52cc28d21c5b7b91d7065fd6dfe6d426fcc5", + "0x8a43e670619973944cb573bb23688c24cc0b5131" + ] } - }, - "uniLPs": { - "fantom": [ - "0xbc0eecda2d8141e3a26d2535c57cadcb1095bca9", - "0x41d88635029c4402bf9914782ae55c412f8f2142" - ] - }, - "curveLPs": { - "fantom": ["0x24699312cb27c26cfc669459d670559e5e44ee60"], - "ethereum": [ - "0x3a283d9c08e8b55966afb64c515f5143cf907611", - "0xed4064f376cb8d68f770fb1ff088a3d0f3ff5c4d" - ] } -} +} \ No newline at end of file diff --git a/projects/hector/index.js b/projects/hector/index.js index 2ecfee876a1..832893cab3d 100644 --- a/projects/hector/index.js +++ b/projects/hector/index.js @@ -1,281 +1,51 @@ -const axios = require("axios"); -const sdk = require("@defillama/sdk"); -const { GraphQLClient, gql } = require("graphql-request"); -const { - sumMultiBalanceOf, - sumSingleBalance -} = require("@defillama/sdk/build/generalUtil"); -const { getChainTransform } = require("../helper/portedTokens"); +const { staking } = require('../helper/staking') const contracts = require("./contracts.json"); -const { default: BigNumber } = require("bignumber.js"); -const { toUSDTBalances } = require("../helper/balances"); -const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); -const { unwrapCrv } = require("../helper/resolveCrvTokens"); +const { sumTokens2, unwrapLPsAuto } = require("../helper/unwrapLPs"); const abi = require("./abi.json"); const { genericUnwrapCvx } = require("../helper/unwrapLPs"); +const { covalentGetTokens } = require('../helper/http') -async function walletBalances(chain, block, balances, transform) { - const response = (await Promise.all( - contracts.tokenHolders[chain].map(c => - axios.get( - `https://api.covalenthq.com/v1/${contracts.chainMap[c.chain] - .chainId}/address/${c.address}/balances_v2/?&key=ckey_72cd3b74b4a048c9bc671f7c5a6` - ) - ) - )).map(a => a.data.data.items); - - const calls = []; - response.map((c, i) => { - calls.push( - ...c.map(t => ({ - target: t.contract_address, - params: [contracts.tokenHolders[chain][i].address] - })) - ); - }); - - const [gasBalances, erc20Balances] = await Promise.all([ - sdk.api.eth.getBalances({ - targets: calls - .filter(c => c.target == contracts.chainMap[chain].gasToken) - .map(c => c.params[0]), - block, - chain - }), - sdk.api.abi.multiCall({ - abi: "erc20:balanceOf", - calls: calls.filter(c => c.target != contracts.chainMap[chain].gasToken), - block, - chain - }) - ]); - - sumMultiBalanceOf(balances, erc20Balances, true, transform); - sumSingleBalance( - balances, - contracts.chainMap[chain].wrappedGasToken, - gasBalances.output - .reduce((a, b) => a.plus(new BigNumber(b.balance)), new BigNumber("0")) - .toFixed(0) - ); +async function walletBalances(api) { + const { owners = [], blacklistedTokens } = contracts.tokenHolders[api.chain] + const tokens = await Promise.all(owners.map(i => covalentGetTokens(i, api.chain))) + return sumTokens2({ api, ownerTokens: owners.map((v, i) => [tokens[i], v]), blacklistedTokens, resolveLP: false, }) } -async function deployedBalances(chain, block, balances, transform) { - switch (chain) { +async function deployedBalances(api) { + switch (api.chain) { case "bsc": - await getPancakeDeposits( - chain, - block, - "0xa5f8c5dbd5f286960b9d90548680ae5ebff07652", - [2, 4, 14], - "0x3cdf52cc28d21c5b7b91d7065fd6dfe6d426fcc5", - balances, - transform - ); - return; - case "fantom": - await getBeefyDeposits( - chain, - block, - [ - "0x8b92de822b121761a3caf894627a09a9f87864c0", - "0xf723ae5478b1f03ca88c204f1ae5498d3576b78f" - ], - balances - ); - return; + return getPancakeDeposits(api, "0xa5f8c5dbd5f286960b9d90548680ae5ebff07652", [2, 4, 14], "0x3cdf52cc28d21c5b7b91d7065fd6dfe6d426fcc5",); case "ethereum": - await getConvexDeposits( - chain, - block, - "0xf403c135812408bfbe8713b5a23a04b3d48aae31", - [61, 64], - "0x4bfb33d65f4167ebe190145939479227e7bf2cb0", - balances - ); - return; + return getConvexDeposits(api, "0xf403c135812408bfbe8713b5a23a04b3d48aae31", [61, 64], "0x4bfb33d65f4167ebe190145939479227e7bf2cb0",); } } -async function getBeefyDeposits(chain, block, targets, balances) { - const wants = (await sdk.api.abi.multiCall({ - calls: targets.map(t => ({ - target: t - })), - block, - abi: abi.want, - chain - })).output; - - wants.map(t => { - balances[`${chain}:${t.output.toLowerCase()}`] = - balances[`${chain}:${t.input.target}`]; - delete balances[`${chain}:${t.input.target}`]; - }); +async function getConvexDeposits(api, target, poolIds, owner,) { + let poolInfos = await api.multiCall({ abi: abi.poolInfo, target, calls: poolIds, }) + return Promise.all(poolInfos.map(i => genericUnwrapCvx(api.getBalances(), owner, i.crvRewards, api.block, api.chain))) } -async function getConvexDeposits( - chain, - block, - target, - poolIds, - owner, - balances -) { - let poolInfos = (await sdk.api.abi.multiCall({ - abi: abi.poolInfo, - target, - calls: poolIds.map(i => ({ - params: [i] - })), - chain, - block - })).output; - for (let i = 0; i < poolInfos.length; i++) { - await genericUnwrapCvx( - balances, - owner, - poolInfos[i].output.crvRewards, - block, - chain - ); - } -} -async function getPancakeDeposits( - chain, - block, - target, - poolIds, - owner, - balances, - transform -) { - const [{ output: balance }, { output: lpToken }] = await Promise.all([ - sdk.api.abi.multiCall({ - abi: abi.userInfo, - target, - calls: poolIds.map(i => ({ - params: [i, owner] - })), - chain, - block - }), - sdk.api.abi.multiCall({ - abi: abi.lpToken, - target, - calls: poolIds.map(i => ({ - params: [i] - })), - chain, - block - }) +async function getPancakeDeposits(api, target, poolIds, owner,) { + const [balance, lpToken] = await Promise.all([ + api.multiCall({ abi: abi.userInfo, target, calls: poolIds.map(i => ({ params: [i, owner] })), }), + api.multiCall({ abi: abi.lpToken, target, calls: poolIds, }) ]); - - lpToken.map((t, i) => { - sumSingleBalance(balances, transform(t.output), balance[i].output.amount); - }); -} -async function hectorBank() { - var endpoint = - "https://api.thegraph.com/subgraphs/name/hectordao-hec/hector-dao"; - var graphQLClient = new GraphQLClient(endpoint); - - var query = gql` - query { - protocolMetrics(first: 1, orderBy: timestamp, orderDirection: desc) { - bankSupplied - } - } - `; - const results = await graphQLClient.request(query) - const balance = +results.protocolMetrics[0].bankSupplied - (await borrowed()); - return toUSDTBalances(balance); + lpToken.forEach((v, i) => api.add(v, balance[i].amount)) } -async function borrowed() { - var endpoint = - "https://api.thegraph.com/subgraphs/name/hectordao-hec/hector-dao"; - var graphQLClient = new GraphQLClient(endpoint); - - var query = gql` - query { - protocolMetrics(first: 1, orderBy: timestamp, orderDirection: desc) { - bankBorrowed - } - } - `; - const results = await graphQLClient.request(query) - - return results.protocolMetrics[0].bankBorrowed; -} -async function unwrap(balances, chain, block, transform) { - if (chain in contracts.uniLPs) { - await unwrapUniswapLPs( - balances, - contracts.uniLPs[chain].map(l => ({ - balance: balances[`${chain}:${l}`], - token: l - })), - block, - chain, - transform - ); - } - if (chain in contracts.curveLPs) { - for (let token of contracts.curveLPs[chain]) { - await unwrapCrv( - balances, - token, - balances[`${chain}:${token}`], - block, - chain, - transform - ); - } - } -} -function tvl(chain) { - return async (t, b, chainBlocks) => { - let balances = {}; - const block = chainBlocks[chain]; - const transform = await getChainTransform(chain); - - await walletBalances(chain, block, balances, transform); - await deployedBalances(chain, block, balances, transform); - await unwrap(balances, chain, block, transform); - - delete balances["fantom:0x74e23df9110aa9ea0b6ff2faee01e740ca1c642e"]; - delete balances["bsc:0x1d6cbdc6b29c6afbae65444a1f65ba9252b8ca83"]; - delete balances["fantom:0x5c4fdfc5233f935f20d2adba572f770c2e377ab0"]; - delete balances["bsc:0x638eebe886b0e9e7c6929e69490064a6c94d204d"]; - - return balances; - }; -} -const staking = async () => { - var endpoint = - "https://api.thegraph.com/subgraphs/name/hectordao-hec/hector-dao"; - var graphQLClient = new GraphQLClient(endpoint); - - var query = gql` - query { - protocolMetrics(first: 1, orderBy: timestamp, orderDirection: desc) { - totalValueLocked - } - } - `; - const results = await graphQLClient.request(query) - return toUSDTBalances(+results.protocolMetrics[0].totalValueLocked); -}; module.exports = { - timetravel: false, - misrepresentedTokens: true, - ethereum: { - tvl: tvl("ethereum") - }, + ethereum: { tvl, }, fantom: { - tvl: sdk.util.sumChainTvls([tvl("fantom"), hectorBank]), - staking + tvl, + staking: staking('0xd12930c8deedafd788f437879cba1ad1e3908cc5', '0x5C4FDfc5233f935f20D2aDbA572F770c2E377Ab0') }, - bsc: { - tvl: tvl("bsc") - } + bsc: { tvl, } }; + +async function tvl(_, _b, _cb, { api, }) { + const calls = [ + walletBalances(api), + deployedBalances(api), + ] + await Promise.all(calls) + + await unwrapLPsAuto({ api, }) +} diff --git a/projects/hedgefarm/index.js b/projects/hedgefarm/index.js index 29c1b6dac7a..6e27b474d85 100644 --- a/projects/hedgefarm/index.js +++ b/projects/hedgefarm/index.js @@ -1,39 +1,32 @@ const sdk = require("@defillama/sdk") -const { pool2 } = require("../helper/pool2"); -const { stakings } = require("../helper/staking"); -const { getCompoundV2Tvl } = require("../helper/compound"); -const ALPHA1_CONTRACT = '0xdE4133f0CFA1a61Ba94EC64b6fEde4acC1fE929E'; -const USDC = '0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E' +const vaults = [ + '0xdE4133f0CFA1a61Ba94EC64b6fEde4acC1fE929E', // ALPHA1_V1_CONTRACT + '0x60908a71fbc9027838277f9f98e458bef2a201da', // ALPHA1_V2_CONTRACT +] +const v2Vaults = [ + '0x3C390b91Fc2f248E75Cd271e2dAbF7DcC955B1A3', // ALPHA2_CONTRACT +] -const abi = { - inputs: [], - name: "totalBalance", - outputs: [{ internalType: "uint256", name: "", type: "uint256" }], - stateMutability: "view", - type: "function" -}; +const ALPHA1_ABI = "uint256:totalBalance"; +const ALPHA2_ABI = "uint256:getLastUpdatedModulesBalance"; -async function tvl(timestamp, block, chainBlocks) { +async function tvl(timestamp, block, chainBlocks, { api }) { + const [tokenv1, tokenv2, balv1, balv2] = await Promise.all([ + api.multiCall({ abi: 'address:token', calls: vaults }), + api.multiCall({ abi: 'address:baseToken', calls: v2Vaults, }), + api.multiCall({ abi: ALPHA1_ABI, calls: vaults, }), + api.multiCall({ abi: ALPHA2_ABI, calls: v2Vaults, }), + ]) const balances = {}; - - const totalBalance = (await sdk.api.abi.call({ - abi: abi, - chain: 'avax', - target: ALPHA1_CONTRACT, - params: [], - block: chainBlocks['avax'], - })).output; - - await sdk.util.sumSingleBalance(balances, `avax:${USDC}`, totalBalance) + tokenv1.forEach((v, i) => sdk.util.sumSingleBalance(balances, v, balv1[i], api.chain)) + tokenv2.forEach((v, i) => sdk.util.sumSingleBalance(balances, v, balv2[i], api.chain)) return balances; } module.exports = { - timetravel: true, - misrepresentedTokens: false, - methodology: 'Gets the total balance in the Alpha #1 contract from IOU total supply and price per share.', + methodology: 'Gets the total balance in the Alpha #1 contract from IOU total supply and price per share and in the Smart Farmooor (Alpha #2) from the total balance.', start: 21220270, avax: { tvl, diff --git a/projects/hedgehog/index.js b/projects/hedgehog/index.js new file mode 100644 index 00000000000..9091f1478a0 --- /dev/null +++ b/projects/hedgehog/index.js @@ -0,0 +1,18 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const WETH = ADDRESSES.ethereum.WETH; +const USDC = ADDRESSES.ethereum.USDC; +const OSQTH = "0xf1B99e3E573A1a9C5E6B2Ce818b617F0E664E86B"; + +const VAULT_MATH = "0x2b1cb93B8fe1B6fB3810Ab294D681865421C4E37"; + +async function tvl(timestamp, block, _, { api }) { + const fundBalances = await api.call({ abi: 'function getTotalAmounts() view returns (uint256, uint256, uint256)', target: VAULT_MATH }) + api.addTokens([WETH, USDC, OSQTH], fundBalances) +} + +module.exports = { + doublecounted: true, + methodology: + "Counts the amount of wETH, USDC & oSQTH in the strategy-controlled pools and treasury", + ethereum: { tvl, }, +}; diff --git a/projects/hegic/index.js b/projects/hegic/index.js index 6e967058b00..0154a468d4b 100644 --- a/projects/hegic/index.js +++ b/projects/hegic/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const { token } = require("@project-serum/anchor/dist/cjs/utils"); const { sumTokens } = require("../helper/unwrapLPs"); @@ -10,10 +11,10 @@ const poolsV8888 = { }; const tokens = { - ETH: "0x0000000000000000000000000000000000000000", - WBTC: "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599", - WETH: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", - USDC: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", + ETH: ADDRESSES.null, + WBTC: ADDRESSES.ethereum.WBTC, + WETH: ADDRESSES.ethereum.WETH, + USDC: ADDRESSES.ethereum.USDC, HEGIC: "0x584bc13c7d411c00c01a62e8019472de68768430", }; @@ -22,7 +23,7 @@ const arbitrum = { hergePayoff: "0x822C0E3aFbCfbD166833F44AD82f28354a57cf28", hergeOperationalTreasury: "0xec096ea6eB9aa5ea689b0CF00882366E92377371", HEGIC: "0x431402e8b9de9aa016c743880e04e517074d8cec", - USDC: "0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8", + USDC: ADDRESSES.arbitrum.USDC, hardcoreStakeAndCover: "0x60898dfA3C6e8Ba4998B5f3be25Fb0b0b69d5D5d", hardcoreOperationalTreasury: "0xB0F9F032158510cd4a926F9263Abc86bAF7b4Ab3", }; @@ -83,5 +84,5 @@ module.exports = { arbitrum: { tvl: arbiTvl, }, - methodology: `TVL for Hegic is calculated using the Eth and WBTC deposited for liquidity`, + methodology: `TVL for Hegic is calculated using the HEGIC tokens deposited into Stake & Cover pool on Arbitrum and pools liquidity in USDC, ETH and WBTC`, }; diff --git a/projects/helio-money/index.js b/projects/helio-money/index.js index 82904f79769..2a5f63479f6 100644 --- a/projects/helio-money/index.js +++ b/projects/helio-money/index.js @@ -1,10 +1,26 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokensExport, } = require('../helper/unknownTokens') module.exports = { methodology: 'count the amount of ankr BNB in the vault', + hallmarks: [ + [1669939200, "aBNBc exploit"], + //[1670544000,"aBNBc to AnkrBNB swap & HAY buyback"] + ], bsc: { - tvl: sumTokensExport({ chain: 'bsc', owner: '0x25b21472c073095bebC681001Cbf165f849eEe5E', tokens: [ - '0xE85aFCcDaFBE7F2B096f268e31ccE3da8dA2990A', // ankrBNB - ] }), + tvl: + sumTokensExport({ + tokensAndOwners: [ + //ankrBNB + ['0x52F24a5e03aee338Da5fd9Df68D2b6FAe1178827', '0x25b21472c073095bebC681001Cbf165f849eEe5E'], + [ADDRESSES.null, '0x25b21472c073095bebC681001Cbf165f849eEe5E'], + //stkBNB + ['0xc2E9d07F66A89c44062459A47a0D2Dc038E4fb16', '0x98CB81d921B8F5020983A46e96595471Ad4E60Be'], + //snBNB + ['0xB0b84D294e0C75A6abe60171b70edEb2EFd14A1B', '0x6F28FeC449dbd2056b76ac666350Af8773E03873'], + //BNBx + ['0x1bdd3Cf7F79cfB8EdbB955f20ad99211551BA275', '0x6ae7073d801a74eE753F19323DF320C8F5Fe2DbC'] + ] + }) } } diff --git a/projects/heliosprime/abi.json b/projects/heliosprime/abi.json index b63b3cb6c95..54ef09b97a1 100644 --- a/projects/heliosprime/abi.json +++ b/projects/heliosprime/abi.json @@ -1,3 +1,3 @@ { - "getComponents":{"inputs":[],"name":"getComponents","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"} + "getComponents": "address[]:getComponents" } \ No newline at end of file diff --git a/projects/heliosprime/index.js b/projects/heliosprime/index.js index d24979a1943..869446e715a 100644 --- a/projects/heliosprime/index.js +++ b/projects/heliosprime/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const { staking } = require("../helper/staking"); const { pool2 } = require("../helper/pool2"); @@ -5,7 +6,7 @@ const {getComponents} = require('./abi.json'); const { sumTokens } = require("../helper/unwrapLPs"); const CoverageContract = "0x69c316563414d091c57C7Ec098523e43Baa5E175"; -const USDT = "0xdac17f958d2ee523a2206206994597c13d831ec7"; +const USDT = ADDRESSES.ethereum.USDT; const EDP = "0x7633da43dfd4ee5a5da99740f077ca9d97aa0d0e" const StakingContract_BMI = "0xDfB820b95EEE42A858f50BEfbF834D2d24621153"; diff --git a/projects/heliswap/index.js b/projects/heliswap/index.js index 1112023c4c3..a6c26debbd9 100644 --- a/projects/heliswap/index.js +++ b/projects/heliswap/index.js @@ -2,8 +2,7 @@ const axios = require("axios"); const urlConfigs = { graphQLUrl: "https://heliswap-prod-362307.oa.r.appspot.com/query", - tokenListUrl: - "https://heliswap.infura-ipfs.io/ipfs/QmTkk1Cmvh3D8cQHKf4P8WovwRzSABWrDjo4a8gGxXKUrT", + tokenListUrl: "https://heliswap-api.ey.r.appspot.com/tokens/whitelisted/", }; const axiosConfig = { @@ -12,19 +11,10 @@ const axiosConfig = { }; const getWhitelistedTokenAddresses = async () => { - let tokens = []; - const response = await axios(urlConfigs.tokenListUrl); - const { - data: { tokens: whitelistedTokens }, - } = response; - - tokens = - whitelistedTokens.length > 0 - ? whitelistedTokens.map((token) => token.address) - : []; + const { data: whitelistedTokens } = response; - return tokens; + return whitelistedTokens; }; const tvl = async () => { @@ -54,7 +44,7 @@ const tvl = async () => { data: { data: { poolsConsistingOf }} } = await axios(requestObject); - totalTVL = poolsConsistingOf.reduce((acc, pool) => (isNaN(+pool.tvl)) ? acc : acc + +pool.tvl, 0) + totalTVL = poolsConsistingOf.reduce((acc, pool) => (isNaN(+pool.tvl) || +pool.tvl > 1e8) ? acc : acc + +pool.tvl, 0) return { tether: totalTVL }; }; diff --git a/projects/helmetinsure/index.js b/projects/helmetinsure/index.js index 134dcd089d0..081efa5352c 100644 --- a/projects/helmetinsure/index.js +++ b/projects/helmetinsure/index.js @@ -1,5 +1,5 @@ -const { blockQuery } = require('../helper/graph') -const { getBlock } = require('../helper/getBlock') +const ADDRESSES = require('../helper/coreAssets.json') +const { blockQuery } = require('../helper/http') const sdk = require('@defillama/sdk') const { gql } = require('graphql-request') const CHAIN_POLYGON = 'polygon' @@ -13,7 +13,7 @@ const THEGARPH_API = { function transform(str) { switch (str) { case "bsc:0xaf90e457f4359adcc8b37e8df8a27a1ff4c3f561": // SHIB - return "0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE" + return ADDRESSES.ethereum.INU case "bsc:0xf218184af829cf2b0019f8e6f0b2423498a36983": // MATH return "0x08d967bb0134f2d07f7cfb6e246680c53927dd30" case "bsc:0xbd2949f67dcdc549c6ebe98696449fa79d988a9f": @@ -24,8 +24,7 @@ function transform(str) { } function fetch(chain) { - return async (ts, _, chainBlocks) => { - const block = await getBlock(ts, chain, chainBlocks) + return async (ts, _, chainBlocks, { api }) => { var endpoint = THEGARPH_API[chain] var query = gql` query tvl($block: Int){ @@ -41,7 +40,7 @@ function fetch(chain) { } } `; - const results = await blockQuery(endpoint, query, block, 1000) + const results = await blockQuery(endpoint, query, { api, blockCatchupLimit: 2000, }) const { options } = results const data = options.flatMap(o => { diff --git a/projects/helper/aave.js b/projects/helper/aave.js index 8dcd4f48ac6..744a360af3a 100644 --- a/projects/helper/aave.js +++ b/projects/helper/aave.js @@ -1,7 +1,10 @@ +const { getLogs } = require('./cache/getLogs') +const ADDRESSES = require('./coreAssets.json') const sdk = require('@defillama/sdk'); const { default: BigNumber } = require('bignumber.js'); const abi = require('./abis/aave.json'); -const { getChainTransform, getFixBalances, } = require('../helper/portedTokens') +const { getChainTransform, getFixBalancesSync, } = require('../helper/portedTokens') +const { sumTokens2 } = require('../helper/unwrapLPs') async function getV2Reserves(block, addressesProviderRegistry, chain, dataHelperAddress, abis = {}) { let validProtocolDataHelpers @@ -29,7 +32,7 @@ async function getV2Reserves(block, addressesProviderRegistry, chain, dataHelper validProtocolDataHelpers = protocolDataHelpers.filter( (helper) => - helper.output !== "0x0000000000000000000000000000000000000000" + helper.output !== ADDRESSES.null ).map(p => p.output); } else { validProtocolDataHelpers = dataHelperAddress @@ -72,59 +75,204 @@ async function getV2Reserves(block, addressesProviderRegistry, chain, dataHelper async function getTvl(balances, block, chain, v2Atokens, v2ReserveTokens, transformAddress) { const balanceOfUnderlying = await sdk.api.abi.multiCall({ - calls: v2Atokens.map((aToken, index) => ({ - target: v2ReserveTokens[index], - params: aToken, - })), - abi: "erc20:balanceOf", - block, - chain - }); + calls: v2Atokens.map((aToken, index) => ({ + target: v2ReserveTokens[index], + params: aToken, + })), + abi: "erc20:balanceOf", + block, + chain + }); sdk.util.sumMultiBalanceOf(balances, balanceOfUnderlying, true, transformAddress) } async function getBorrowed(balances, block, chain, v2ReserveTokens, dataHelper, transformAddress, v3 = false) { const reserveData = await sdk.api.abi.multiCall({ - calls: v2ReserveTokens.map((token) => ({ - target: dataHelper, - params: [token], - })), - abi: v3 ? abi.getTotalDebt : abi.getHelperReserveData, - block, - chain - }); + calls: v2ReserveTokens.map((token) => ({ + target: dataHelper, + params: [token], + })), + abi: v3 ? abi.getTotalDebt : abi.getHelperReserveData, + block, + chain + }); - reserveData.output.forEach((data, idx)=>{ - const quantity = v3 ? data.output : BigNumber(data.output.totalVariableDebt).plus(data.output.totalStableDebt).toFixed(0) - sdk.util.sumSingleBalance(balances, transformAddress(data.input.params[0]), quantity) - }) + reserveData.output.forEach((data, idx) => { + const quantity = v3 ? data.output : BigNumber(data.output.totalVariableDebt).plus(data.output.totalStableDebt).toFixed(0) + sdk.util.sumSingleBalance(balances, transformAddress(data.input.params[0]), quantity) + }) } -function aaveChainTvl(chain, addressesProviderRegistry, transformAddressRaw, dataHelperAddresses, borrowed, v3 = false, { abis = {}} = {}) { - return async (timestamp, ethBlock, {[chain]: block}) => { +function aaveChainTvl(chain, addressesProviderRegistry, transformAddressRaw, dataHelperAddresses, borrowed, v3 = false, { abis = {}, oracle, blacklistedTokens = [], } = {}) { + return async (timestamp, ethBlock, { [chain]: block }) => { const balances = {} - const transformAddress = transformAddressRaw || await getChainTransform(chain) - const fixBalances = await getFixBalances(chain) - const [v2Atokens, v2ReserveTokens, dataHelper] = await getV2Reserves(block, addressesProviderRegistry, chain, dataHelperAddresses, abis) - if(borrowed){ + const { transformAddress, fixBalances, v2Atokens, v2ReserveTokens, dataHelper, updateBalances } = await getData({ oracle, chain, block, addressesProviderRegistry, dataHelperAddresses, transformAddressRaw, abis, }) + if (borrowed) { await getBorrowed(balances, block, chain, v2ReserveTokens, dataHelper, transformAddress, v3); } else { await getTvl(balances, block, chain, v2Atokens, v2ReserveTokens, transformAddress); } + if (updateBalances) updateBalances(balances) fixBalances(balances) + Object.keys(balances).forEach((key) => { + if (!blacklistedTokens.length) return; + if (blacklistedTokens.some(i => new RegExp(i, 'gi').test(key))) { + delete balances[key] + } + }) return balances } } -function aaveExports(chain, addressesProviderRegistry, transform = undefined, dataHelpers = undefined){ +function aaveExports(chain, addressesProviderRegistry, transform = undefined, dataHelpers = undefined, { oracle, abis, v3 = false, blacklistedTokens = [] } = {}) { return { - tvl: aaveChainTvl(chain, addressesProviderRegistry, transform, dataHelpers, false), - borrowed: aaveChainTvl(chain, addressesProviderRegistry, transform, dataHelpers, true) + tvl: aaveChainTvl(chain, addressesProviderRegistry, transform, dataHelpers, false, v3, { oracle, abis, blacklistedTokens, }), + borrowed: aaveChainTvl(chain, addressesProviderRegistry, transform, dataHelpers, true, v3, { oracle, abis, }) } } + module.exports = { aaveChainTvl, getV2Reserves, getTvl, aaveExports, getBorrowed, + aaveV2Export, +} + +const cachedData = {} + +async function getData({ oracle, chain, block, addressesProviderRegistry, dataHelperAddresses, transformAddressRaw, abis, }) { + let dataHelperAddressesStr + if (dataHelperAddresses && dataHelperAddresses.length) dataHelperAddressesStr = dataHelperAddresses.join(',') + const key = `${chain}-${block}-${addressesProviderRegistry}-${dataHelperAddresses}-${oracle}` + if (!cachedData[key]) cachedData[key] = _getData() + return cachedData[key] + + async function _getData() { + sdk.log('get aava metadata:', key) + + const transformAddress = transformAddressRaw || await getChainTransform(chain) + const fixBalances = await getFixBalancesSync(chain) + const [v2Atokens, v2ReserveTokens, dataHelper] = await getV2Reserves(block, addressesProviderRegistry, chain, dataHelperAddresses, abis) + let updateBalances + + if (oracle) { + const params = { chain, block, target: oracle, } + const [ + baseCurrency, baseCurrencyUnit, prices, + ] = await Promise.all([ + sdk.api2.abi.call({ ...params, abi: oracleAbis.BASE_CURRENCY, }), + sdk.api2.abi.call({ ...params, abi: oracleAbis.BASE_CURRENCY_UNIT, }), + sdk.api2.abi.call({ ...params, abi: oracleAbis.getAssetsPrices, params: [v2ReserveTokens], }), + ]) + + const baseToken = transformAddress(baseCurrency) + updateBalances = balances => { + v2ReserveTokens.map(i => `${chain}:${i.toLowerCase()}`).forEach((token, i) => { + if (!balances[token]) return; + const balance = balances[token] * prices[i] / baseCurrencyUnit + delete balances[token] + sdk.util.sumSingleBalance(balances, baseToken, balance) + }) + return balances + } + } + + return { transformAddress, fixBalances, v2Atokens, v2ReserveTokens, dataHelper, updateBalances, } + } +} + +const oracleAbis = { + BASE_CURRENCY: "address:BASE_CURRENCY", + BASE_CURRENCY_UNIT: "uint256:BASE_CURRENCY_UNIT", + getAssetsPrices: "function getAssetsPrices(address[] assets) view returns (uint256[])", +} + +function aaveV2Export(registry, { useOracle = false, baseCurrency, baseCurrencyUnit, abis = {}, fromBlock, } = {}) { + + async function tvl(_, _b, _c, { api }) { + const data = await getReservesData(api) + const tokensAndOwners = data.map(i => ([i.underlying, i.aTokenAddress])) + if (!useOracle) + return sumTokens2({ tokensAndOwners, api }) + const balances = {} + const res = await api.multiCall({ abi: 'erc20:balanceOf', calls: tokensAndOwners.map(i => ({ target: i[0], params: i[1] })) }) + res.forEach((v, i) => { + sdk.util.sumSingleBalance(balances, data[i].currency, v * data[i].price, api.chain) + }) + return balances + } + + async function borrowed(_, _b, _c, { api }) { + const balances = {} + const data = await getReservesData(api) + const supplyVariable = await api.multiCall({ + abi: 'erc20:totalSupply', + calls: data.map(i => i.variableDebtTokenAddress), + }) + const supplyStable = await api.multiCall({ + abi: 'erc20:totalSupply', + calls: data.map(i => i.stableDebtTokenAddress), + }) + data.forEach((i, idx) => { + let value = +supplyVariable[idx] + +supplyStable[idx] + if (useOracle) { + sdk.util.sumSingleBalance(balances, i.currency, value * i.price, api.chain) + } else { + sdk.util.sumSingleBalance(balances, i.underlying, value, api.chain) + } + }) + return balances + } + + async function getReservesData(api) { + if (fromBlock) return getReservesDataFromBlock(api) + const tokens = await api.call({ abi: abiv2.getReservesList, target: registry }) + const data = await api.multiCall({ abi: abis.getReserveData ?? abiv2.getReserveData, calls: tokens, target: registry, }) + data.forEach((v, i) => v.underlying = tokens[i]) + if (useOracle) { + let currency = baseCurrency + let unit = baseCurrencyUnit + + const addressProvider = await api.call({ abi: abiv2.getAddressesProvider, target: registry }) + const oracle = await api.call({ abi: abiv2.getPriceOracle, target: addressProvider }) + + if (!currency) currency = await api.call({ abi: abiv2.BASE_CURRENCY, target: oracle }) + if (!unit) unit = await api.call({ abi: abiv2.BASE_CURRENCY_UNIT, target: oracle }) + + const decimals = await api.multiCall({ abi: 'erc20:decimals', calls: tokens }) + // const currencyDecimal = await api.call({ abi: 'erc20:decimals', target: currency }) + const currencyDecimal = 18 + const prices = await api.call({ abi: abiv2.getAssetsPrices, target: oracle, params: [tokens] }) + prices.forEach((v, i) => { + data[i].price = (v / unit )/ (10 ** (decimals[i] - currencyDecimal)) + data[i].currency = currency + }) + } + return data + } + + async function getReservesDataFromBlock(api) { + const logs = await getLogs({ + api, + target: registry, + topics: ['0x3a0ca721fc364424566385a1aa271ed508cc2c0949c2272575fb3013a163a45f'], + fromBlock, + eventAbi: 'event ReserveInitialized (address indexed underlying, address indexed aTokenAddress, address stableDebtTokenAddress, address variableDebtTokenAddress, address interestRateStrategyAddress)', + onlyArgs: true, + }) + return logs + } + + const abiv2 = { + getReservesList: "address[]:getReservesList", + getAddressesProvider: "address:getAddressesProvider", + BASE_CURRENCY: "address:BASE_CURRENCY", + BASE_CURRENCY_UNIT: "uint256:BASE_CURRENCY_UNIT", + getPriceOracle: "address:getPriceOracle", + getAssetsPrices: "function getAssetsPrices(address[]) view returns (uint256[])", + getReserveData: "function getReserveData(address asset) view returns (tuple(tuple(uint256 data) configuration, uint128 liquidityIndex, uint128 variableBorrowIndex, uint128 currentLiquidityRate, uint128 currentVariableBorrowRate, uint128 currentStableBorrowRate, uint40 lastUpdateTimestamp, address aTokenAddress, address stableDebtTokenAddress, address variableDebtTokenAddress, address interestRateStrategyAddress, uint8 id))", + } + + return { tvl, borrowed, } } \ No newline at end of file diff --git a/projects/helper/abis/aave.json b/projects/helper/abis/aave.json index e1f8e5f378d..b1d21bc3aae 100644 --- a/projects/helper/abis/aave.json +++ b/projects/helper/abis/aave.json @@ -1,521 +1,17 @@ { - "getTotalDebt": { - "inputs": [ - { - "internalType": "address", - "name": "asset", - "type": "address" - } - ], - "name": "getTotalDebt", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getReservesList": { - "inputs": [], - "name": "getReservesList", - "outputs": [ - { - "internalType": "address[]", - "name": "", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getAMMReserveData": { - "inputs": [ - { - "internalType": "address", - "name": "asset", - "type": "address" - } - ], - "name": "getReserveData", - "outputs": [ - { - "components": [ - { - "components": [ - { - "internalType": "uint256", - "name": "data", - "type": "uint256" - } - ], - "internalType": "struct DataTypes.ReserveConfigurationMap", - "name": "configuration", - "type": "tuple" - }, - { - "internalType": "uint128", - "name": "liquidityIndex", - "type": "uint128" - }, - { - "internalType": "uint128", - "name": "variableBorrowIndex", - "type": "uint128" - }, - { - "internalType": "uint128", - "name": "currentLiquidityRate", - "type": "uint128" - }, - { - "internalType": "uint128", - "name": "currentVariableBorrowRate", - "type": "uint128" - }, - { - "internalType": "uint128", - "name": "currentStableBorrowRate", - "type": "uint128" - }, - { - "internalType": "uint40", - "name": "lastUpdateTimestamp", - "type": "uint40" - }, - { - "internalType": "address", - "name": "aTokenAddress", - "type": "address" - }, - { - "internalType": "address", - "name": "stableDebtTokenAddress", - "type": "address" - }, - { - "internalType": "address", - "name": "variableDebtTokenAddress", - "type": "address" - }, - { - "internalType": "address", - "name": "interestRateStrategyAddress", - "type": "address" - }, - { - "internalType": "uint8", - "name": "id", - "type": "uint8" - } - ], - "internalType": "struct DataTypes.ReserveData", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getCurrentTokens": { - "constant": true, - "inputs": [], - "name": "getCurrentTokens", - "outputs": [ - { - "internalType": "address[]", - "name": "tokens", - "type": "address[]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "getReserveData": { - "constant": true, - "inputs": [ - { - "internalType": "address", - "name": "_reserve", - "type": "address" - } - ], - "name": "getReserveData", - "outputs": [ - { - "internalType": "uint256", - "name": "totalLiquidity", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "availableLiquidity", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalBorrowsStable", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalBorrowsVariable", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "liquidityRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "variableBorrowRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "stableBorrowRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "averageStableBorrowRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "utilizationRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "liquidityIndex", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "variableBorrowIndex", - "type": "uint256" - }, - { - "internalType": "address", - "name": "aTokenAddress", - "type": "address" - }, - { - "internalType": "uint40", - "name": "lastUpdateTimestamp", - "type": "uint40" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "getReserveConfigurationData": { - "constant": true, - "inputs": [ - { - "internalType": "address", - "name": "_reserve", - "type": "address" - } - ], - "name": "getReserveConfigurationData", - "outputs": [ - { - "internalType": "uint256", - "name": "ltv", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "liquidationThreshold", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "liquidationBonus", - "type": "uint256" - }, - { - "internalType": "address", - "name": "interestRateStrategyAddress", - "type": "address" - }, - { - "internalType": "bool", - "name": "usageAsCollateralEnabled", - "type": "bool" - }, - { - "internalType": "bool", - "name": "borrowingEnabled", - "type": "bool" - }, - { - "internalType": "bool", - "name": "stableBorrowRateEnabled", - "type": "bool" - }, - { - "internalType": "bool", - "name": "isActive", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "getReserves": { - "constant": true, - "inputs": [], - "name": "getReserves", - "outputs": [ - { - "internalType": "address[]", - "name": "", - "type": "address[]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "getAddressesProvidersList": { - "inputs": [], - "name": "getAddressesProvidersList", - "outputs": [ - { - "internalType": "address[]", - "name": "", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getAddress": { - "inputs": [ - { - "internalType": "bytes32", - "name": "id", - "type": "bytes32" - } - ], - "name": "getAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getAllATokens": { - "inputs": [], - "name": "getAllATokens", - "outputs": [ - { - "components": [ - { - "internalType": "string", - "name": "symbol", - "type": "string" - }, - { - "internalType": "address", - "name": "tokenAddress", - "type": "address" - } - ], - "internalType": "struct AaveProtocolDataProvider.TokenData[]", - "name": "", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getUnderlying": { - "inputs": [], - "name": "UNDERLYING_ASSET_ADDRESS", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getReserveDataV2": { - "inputs": [ - { - "internalType": "address", - "name": "asset", - "type": "address" - } - ], - "name": "getReserveData", - "outputs": [ - { - "internalType": "uint256", - "name": "availableLiquidity", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalStableDebt", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalVariableDebt", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "liquidityRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "variableBorrowRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "stableBorrowRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "averageStableBorrowRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "liquidityIndex", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "variableBorrowIndex", - "type": "uint256" - }, - { - "internalType": "uint40", - "name": "lastUpdateTimestamp", - "type": "uint40" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getBPool": { - "inputs": [], - "name": "bPool", - "outputs": [ - { - "internalType": "contract IBPool", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getHelperReserveData": { - "inputs": [ - { - "internalType": "address", - "name": "asset", - "type": "address" - } - ], - "name": "getReserveData", - "outputs": [ - { - "internalType": "uint256", - "name": "availableLiquidity", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalStableDebt", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalVariableDebt", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "liquidityRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "variableBorrowRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "stableBorrowRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "averageStableBorrowRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "liquidityIndex", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "variableBorrowIndex", - "type": "uint256" - }, - { - "internalType": "uint40", - "name": "lastUpdateTimestamp", - "type": "uint40" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getReserveTotalBorrows": { - "constant": true, - "inputs": [ - { - "internalType": "address", - "name": "_reserve", - "type": "address" - } - ], - "name": "getReserveTotalBorrows", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } + "getTotalDebt": "function getTotalDebt(address asset) view returns (uint256)", + "getReservesList": "address[]:getReservesList", + "getAMMReserveData": "function getReserveData(address asset) view returns (tuple(tuple(uint256 data) configuration, uint128 liquidityIndex, uint128 variableBorrowIndex, uint128 currentLiquidityRate, uint128 currentVariableBorrowRate, uint128 currentStableBorrowRate, uint40 lastUpdateTimestamp, address aTokenAddress, address stableDebtTokenAddress, address variableDebtTokenAddress, address interestRateStrategyAddress, uint8 id))", + "getCurrentTokens": "address[]:getCurrentTokens", + "getReserveData": "function getReserveData(address _reserve) view returns (uint256 totalLiquidity, uint256 availableLiquidity, uint256 totalBorrowsStable, uint256 totalBorrowsVariable, uint256 liquidityRate, uint256 variableBorrowRate, uint256 stableBorrowRate, uint256 averageStableBorrowRate, uint256 utilizationRate, uint256 liquidityIndex, uint256 variableBorrowIndex, address aTokenAddress, uint40 lastUpdateTimestamp)", + "getReserveConfigurationData": "function getReserveConfigurationData(address _reserve) view returns (uint256 ltv, uint256 liquidationThreshold, uint256 liquidationBonus, address interestRateStrategyAddress, bool usageAsCollateralEnabled, bool borrowingEnabled, bool stableBorrowRateEnabled, bool isActive)", + "getReserves": "address[]:getReserves", + "getAddressesProvidersList": "address[]:getAddressesProvidersList", + "getAddress": "function getAddress(bytes32 id) view returns (address)", + "getAllATokens": "function getAllATokens() view returns (tuple(string symbol, address tokenAddress)[])", + "getUnderlying": "address:UNDERLYING_ASSET_ADDRESS", + "getReserveDataV2": "function getReserveData(address asset) view returns (uint256 availableLiquidity, uint256 totalStableDebt, uint256 totalVariableDebt, uint256 liquidityRate, uint256 variableBorrowRate, uint256 stableBorrowRate, uint256 averageStableBorrowRate, uint256 liquidityIndex, uint256 variableBorrowIndex, uint40 lastUpdateTimestamp)", + "getBPool": "address:bPool", + "getHelperReserveData": "function getReserveData(address asset) view returns (uint256 availableLiquidity, uint256 totalStableDebt, uint256 totalVariableDebt, uint256 liquidityRate, uint256 variableBorrowRate, uint256 stableBorrowRate, uint256 averageStableBorrowRate, uint256 liquidityIndex, uint256 variableBorrowIndex, uint40 lastUpdateTimestamp)", + "getReserveTotalBorrows": "function getReserveTotalBorrows(address _reserve) view returns (uint256)" } \ No newline at end of file diff --git a/projects/helper/abis/balancer.json b/projects/helper/abis/balancer.json index c9dc509b42c..2e6197a9c0d 100644 --- a/projects/helper/abis/balancer.json +++ b/projects/helper/abis/balancer.json @@ -1,85 +1,7 @@ { - "getPoolTokens": { - "inputs": [ - { - "internalType": "bytes32", - "name": "poolId", - "type": "bytes32" - } - ], - "name": "getPoolTokens", - "outputs": [ - { - "internalType": "contract IERC20[]", - "name": "tokens", - "type": "address[]" - }, - { - "internalType": "uint256[]", - "name": "balances", - "type": "uint256[]" - }, - { - "internalType": "uint256", - "name": "lastChangeBlock", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getPoolId": { - "inputs": [], - "name": "getPoolId", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getVault": { - "inputs": [], - "name": "getVault", - "outputs": [ - { - "internalType": "contract IVault", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "bPool": { - "inputs": [], - "name": "bPool", - "outputs": [ - { - "internalType": "contract IBPool", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getCurrentTokens": { - "constant": true, - "inputs": [], - "name": "getCurrentTokens", - "outputs": [ - { - "internalType": "address[]", - "name": "tokens", - "type": "address[]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } + "getPoolTokens": "function getPoolTokens(bytes32 poolId) view returns (address[] tokens, uint256[] balances, uint256 lastChangeBlock)", + "getPoolId": "function getPoolId() view returns (bytes32)", + "getVault": "address:getVault", + "bPool": "address:bPool", + "getCurrentTokens": "address[]:getCurrentTokens" } \ No newline at end of file diff --git a/projects/helper/abis/blindex.json b/projects/helper/abis/blindex.json index b6b4c9cf25b..3ee9c7df2da 100644 --- a/projects/helper/abis/blindex.json +++ b/projects/helper/abis/blindex.json @@ -1,92 +1,8 @@ { - "bdstable_pools_array": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "bdstable_pools_array", - "outputs": [ - { - "internalType": "address payable", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getBdStablesPoolsLength": { - "inputs": [], - "name": "getBdStablesPoolsLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getBDStablePoolCollateral": { - "inputs": [], - "name": "collateral_token", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getBDStable": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "bdstables", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getBdStablesLength": { - "inputs": [], - "name": "getBdStablesLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getBDXPriceUsdD12": { - "inputs": [], - "name": "BDX_price_d12", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -} + "bdstable_pools_array": "function bdstable_pools_array(uint256) view returns (address)", + "getBdStablesPoolsLength": "uint256:getBdStablesPoolsLength", + "getBDStablePoolCollateral": "address:collateral_token", + "getBDStable": "function bdstables(uint256) view returns (address)", + "getBdStablesLength": "uint256:getBdStablesLength", + "getBDXPriceUsdD12": "uint256:BDX_price_d12" +} \ No newline at end of file diff --git a/projects/helper/abis/blockng.json b/projects/helper/abis/blockng.json index 996f6b79f7a..ef90ca5bb64 100644 --- a/projects/helper/abis/blockng.json +++ b/projects/helper/abis/blockng.json @@ -1,108 +1,4 @@ { - "getPoolInfo": { - "inputs": [ - { - "internalType": "contract IVoter", - "type": "address" - }, - { - "internalType": "address", - "type": "address" - }, - { - "internalType": "uint256", - "type": "uint256" - }, - { - "internalType": "uint256", - "type": "uint256" - } - ], - "name": "getPoolInfo", - "outputs": [ - { - "components": [ - { - "internalType": "address", - "name": "lpTokenAddress", - "type": "address" - }, - { - "internalType": "address", - "name": "subTokenAddress", - "type": "address" - }, - { - "internalType": "string", - "name": "subTokenSymbol", - "type": "string" - }, - { - "internalType": "address", - "name": "dexFactory", - "type": "address" - }, - { - "internalType": "address", - "name": "gaugeAddress", - "type": "address" - }, - { - "internalType": "uint256", - "name": "gaugeTotalSupply", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lpPrice", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "gaugeAPR", - "type": "uint256" - }, - { - "internalType": "address", - "name": "bribeAddress", - "type": "address" - }, - { - "internalType": "int256", - "name": "weights", - "type": "int256" - }, - { - "internalType": "uint256", - "name": "punkId", - "type": "uint256" - } - ], - "internalType": "struct LawDaoLen.BEAM[]", - "name": "beams", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - "numberOfPool": { - "inputs": [ - { - "internalType": "contract IVoter", - "name": "voter", - "type": "address" - } - ], - "name": "numberOfPool", - "outputs": [ - { - "internalType": "uint256", - "name": "len", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } + "getPoolInfo": "function getPoolInfo(address, address, uint256, uint256) view returns (tuple(address lpTokenAddress, address subTokenAddress, string subTokenSymbol, address dexFactory, address gaugeAddress, uint256 gaugeTotalSupply, uint256 lpPrice, uint256 gaugeAPR, address bribeAddress, int256 weights, uint256 punkId)[] beams)", + "numberOfPool": "function numberOfPool(address voter) view returns (uint256 len)" } \ No newline at end of file diff --git a/projects/helper/abis/chainlink.json b/projects/helper/abis/chainlink.json deleted file mode 100644 index f6f54c92371..00000000000 --- a/projects/helper/abis/chainlink.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "latestAnswer": { - "inputs": [], - "name": "latestAnswer", - "outputs": [ - { - "internalType": "int256", - "name": "", - "type": "int256" - } - ], - "stateMutability": "view", - "type": "function" - } -} diff --git a/projects/helper/abis/compound.json b/projects/helper/abis/compound.json index 299d80799b0..6ad80ad72db 100644 --- a/projects/helper/abis/compound.json +++ b/projects/helper/abis/compound.json @@ -1,183 +1,12 @@ { - "markets": { - "constant":true, - "inputs":[ - { - "name":"", - "type":"address" - } - ], - "name":"markets", - "outputs":[ - { - "name":"isSupported", - "type":"bool" - }, - { - "name":"blockNumber", - "type":"uint256" - }, - { - "name":"interestRateModel", - "type":"address" - }, - { - "name":"totalSupply", - "type":"uint256" - }, - { - "name":"supplyRateMantissa", - "type":"uint256" - }, - { - "name":"supplyIndex", - "type":"uint256" - }, - { - "name":"totalBorrows", - "type":"uint256" - }, - { - "name":"borrowRateMantissa", - "type":"uint256" - }, - { - "name":"borrowIndex", - "type":"uint256" - } - ], - "payable":false, - "stateMutability":"view", - "type":"function" - }, - "totalBorrows": { - "constant":true, - "inputs":[ - - ], - "name":"totalBorrows", - "outputs":[ - { - "name":"", - "type":"uint256" - } - ], - "payable":false, - "stateMutability":"view", - "type":"function" - }, - "borrowRatePerBlock": { - "constant":true, - "inputs":[ - - ], - "name":"borrowRatePerBlock", - "outputs":[ - { - "name":"", - "type":"uint256" - } - ], - "payable":false, - "stateMutability":"view", - "type":"function" - }, - "supplyRatePerBlock": { - "constant":true, - "inputs":[ - - ], - "name":"supplyRatePerBlock", - "outputs":[ - { - "name":"", - "type":"uint256" - } - ], - "payable":false, - "stateMutability":"view", - "type":"function" - }, - "underlying": { - "constant": true, - "inputs": [], - "name": "underlying", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function", - "signature": "0x6f307dc3" - }, - "getCash": { - "constant": true, - "inputs": [], - "name": "getCash", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "signature": "0x3b1d21a2", - "stateMutability": "view", - "type": "function" - }, - "getAllMarkets": { - "constant": true, - "inputs": [], - "name": "getAllMarkets", - "outputs": [ - { - "internalType": "contract CToken[]", - "name": "", - "type": "address[]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function", - "signature": "0xb0772d0b" - }, - "getUnderlyingPrice": - { - "constant": true, - "inputs": [ - { - "internalType": "address", - "name": "_pToken", - "type": "address" - } - ], - "name": "getUnderlyingPrice", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "oracle": - { - "inputs": [], - "name": "oracle", - "outputs": [ - { - "internalType": "contract IPriceOracle", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } -} + "markets": "function markets(address) view returns (bool isSupported, uint256 blockNumber, address interestRateModel, uint256 totalSupply, uint256 supplyRateMantissa, uint256 supplyIndex, uint256 totalBorrows, uint256 borrowRateMantissa, uint256 borrowIndex)", + "totalBorrows": "uint256:totalBorrows", + "borrowRatePerBlock": "uint256:borrowRatePerBlock", + "supplyRatePerBlock": "uint256:supplyRatePerBlock", + "underlying": "address:underlying", + "getCash": "uint256:getCash", + "isCToken": "boolean:isCToken", + "getAllMarkets": "address[]:getAllMarkets", + "getUnderlyingPrice": "function getUnderlyingPrice(address _pToken) view returns (uint256)", + "oracle": "address:oracle" +} \ No newline at end of file diff --git a/projects/helper/abis/cream.json b/projects/helper/abis/cream.json index 0ef3b82e5f8..bf41dfa67d1 100644 --- a/projects/helper/abis/cream.json +++ b/projects/helper/abis/cream.json @@ -1,32 +1,4 @@ { - "underlying": { - "constant": true, - "inputs": [], - "name": "underlying", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "exchangeRateStored": { - "constant": true, - "inputs": [], - "name": "exchangeRateStored", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } + "underlying": "address:underlying", + "exchangeRateStored": "uint256:exchangeRateStored" } \ No newline at end of file diff --git a/projects/helper/abis/dodo.json b/projects/helper/abis/dodo.json index 3c96e622dfc..a7e8072fa0f 100644 --- a/projects/helper/abis/dodo.json +++ b/projects/helper/abis/dodo.json @@ -1,28 +1,4 @@ { - "_BASE_TOKEN_": { - "inputs": [], - "name": "_BASE_TOKEN_", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "_QUOTE_TOKEN_": { - "inputs": [], - "name": "_QUOTE_TOKEN_", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } + "_BASE_TOKEN_": "address:_BASE_TOKEN_", + "_QUOTE_TOKEN_": "address:_QUOTE_TOKEN_" } \ No newline at end of file diff --git a/projects/helper/abis/erc20.json b/projects/helper/abis/erc20.json index 15be39c0574..afbcc0c269c 100644 --- a/projects/helper/abis/erc20.json +++ b/projects/helper/abis/erc20.json @@ -1,34 +1,5 @@ { - "balanceOf": { - "inputs": [ - { "internalType": "address", "name": "account", "type": "address" } - ], - "name": "balanceOf", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - "symbol": { - "type": "function", - "stateMutability": "view", - "payable": false, - "outputs": [{ "type": "string", "name": "" }], - "name": "symbol", - "inputs": [], - "constant": true - }, - "name": { - "type": "function", - "stateMutability": "view", - "payable": false, - "outputs": [ - { - "type": "string", - "name": "" - } - ], - "name": "name", - "inputs": [], - "constant": true - } -} + "balanceOf": "function balanceOf(address account) view returns (uint256)", + "symbol": "string:symbol", + "name": "string:name" +} \ No newline at end of file diff --git a/projects/helper/abis/factory.json b/projects/helper/abis/factory.json index 7f6c371f696..d18345c456e 100644 --- a/projects/helper/abis/factory.json +++ b/projects/helper/abis/factory.json @@ -1,20 +1,7 @@ { - "allPairs": { - "constant": true, - "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "name": "allPairs", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "allPairsLength": { - "constant": true, - "inputs": [], - "name": "allPairsLength", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - } -} + "allPairs": "function allPairs(uint256) view returns (address)", + "token0": "address:token0", + "token1": "address:token1", + "getReserves": "function getReserves() view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast)", + "allPairsLength": "uint256:allPairsLength" +} \ No newline at end of file diff --git a/projects/helper/abis/getEntireSystemColl.abi.json b/projects/helper/abis/getEntireSystemColl.abi.json deleted file mode 100644 index 15a2c6c04b3..00000000000 --- a/projects/helper/abis/getEntireSystemColl.abi.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "inputs": [], - "name": "getEntireSystemColl", - "outputs": [ - { - "internalType": "uint256", - "name": "entireSystemColl", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" -} \ No newline at end of file diff --git a/projects/helper/abis/getPair.json b/projects/helper/abis/getPair.json deleted file mode 100644 index 6d838800d77..00000000000 --- a/projects/helper/abis/getPair.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "constant": true, - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "getPair", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" -} \ No newline at end of file diff --git a/projects/helper/abis/getPricePerShare.json b/projects/helper/abis/getPricePerShare.json deleted file mode 100644 index 92340766c0e..00000000000 --- a/projects/helper/abis/getPricePerShare.json +++ /dev/null @@ -1,31 +0,0 @@ -[ - { - "constant": true, - "inputs": [], - "name": "getPricePerFullShare", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function", - "signature": "0x77c7b8fc" - }, - { - "name": "pricePerShare", - "outputs": [ - { - "type": "uint256", - "name": "" - } - ], - "inputs": [], - "stateMutability": "view", - "type": "function", - "gas": 12412 - } -] \ No newline at end of file diff --git a/projects/helper/abis/getReserves.json b/projects/helper/abis/getReserves.json deleted file mode 100644 index e3f6fcc11d8..00000000000 --- a/projects/helper/abis/getReserves.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "constant": true, - "inputs": [], - "name": "getReserves", - "outputs": [ - { - "internalType": "uint112", - "name": "_reserve0", - "type": "uint112" - }, - { - "internalType": "uint112", - "name": "_reserve1", - "type": "uint112" - }, - { - "internalType": "uint32", - "name": "_blockTimestampLast", - "type": "uint32" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" -} diff --git a/projects/helper/abis/kashipair.json b/projects/helper/abis/kashipair.json deleted file mode 100644 index 16b576049ce..00000000000 --- a/projects/helper/abis/kashipair.json +++ /dev/null @@ -1,20 +0,0 @@ -[ - { - "inputs": [], - "name": "totalBorrow", - "outputs": [ - { - "internalType": "uint128", - "name": "elastic", - "type": "uint128" - }, - { - "internalType": "uint128", - "name": "base", - "type": "uint128" - } - ], - "stateMutability": "view", - "type": "function" - } -] \ No newline at end of file diff --git a/projects/helper/abis/kslp.js b/projects/helper/abis/kslp.js index 4e94a93efa7..5672ceaa031 100644 --- a/projects/helper/abis/kslp.js +++ b/projects/helper/abis/kslp.js @@ -1,52 +1,7 @@ module.exports = { - getCurrentPool: { - "constant": true, - "inputs": [], - "name": "getCurrentPool", - "outputs": [ - { - "internalType": "uint256", - "name": "_reserve0", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_reserve1", - "type": "uint256" - }, - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - tokenA: { - "constant": true, - "inputs": [], - "name": "tokenA", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - tokenB: { - "constant": true, - "inputs": [], - "name": "tokenB", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, + getPoolCount: 'uint256:getPoolCount', + pools: 'function pools(uint256) view returns (address)', + getCurrentPool: "function getCurrentPool() view returns (uint256 _reserve0, uint256 _reserve1)", + tokenA: "address:tokenA", + tokenB: "address:tokenB", } \ No newline at end of file diff --git a/projects/helper/abis/masterchef.json b/projects/helper/abis/masterchef.json index fdb8dcde093..d753ca9013d 100644 --- a/projects/helper/abis/masterchef.json +++ b/projects/helper/abis/masterchef.json @@ -1,35 +1,4 @@ { - "poolInfo": { - "type": "function", - "stateMutability": "view", - "outputs": [ - { - "type": "address", - "name": "lpToken", - "internalType": "contract IERC20" - }, - { "type": "uint256", "name": "allocPoint", "internalType": "uint256" }, - { - "type": "uint256", - "name": "lastRewardBlock", - "internalType": "uint256" - }, - { - "type": "uint256", - "name": "accFishPerShare", - "internalType": "uint256" - }, - { "type": "uint16", "name": "depositFeeBP", "internalType": "uint16" } - ], - "name": "poolInfo", - "inputs": [{ "type": "uint256", "name": "", "internalType": "uint256" }] - }, - "poolLength": { - "type": "function", - "stateMutability": "view", - "outputs": [{ "type": "uint256", "name": "", "internalType": "uint256" }], - "name": "poolLength", - "inputs": [] - } - } - \ No newline at end of file + "poolInfo": "function poolInfo(uint256) view returns (address lpToken, uint256 allocPoint, uint256 lastRewardBlock, uint256 accFishPerShare, uint16 depositFeeBP)", + "poolLength": "uint256:poolLength" +} \ No newline at end of file diff --git a/projects/helper/abis/morpho.json b/projects/helper/abis/morpho.json index b10bc049fcb..7c74c4bf062 100644 --- a/projects/helper/abis/morpho.json +++ b/projects/helper/abis/morpho.json @@ -1,82 +1,17 @@ { "cToken": { - "underlying": { - "constant": true, - "inputs": [], - "name": "underlying", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } + "underlying": "address:underlying" }, "morphoLens": { - "getAllMarkets": { - "inputs": [], - "name": "getAllMarkets", - "outputs": [ - { - "internalType": "address[]", - "name": "marketsCreated", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getTotalMarketSupply": { - "inputs": [ - { - "internalType": "address", - "name": "_poolTokenAddress", - "type": "address" - } - ], - "name": "getTotalMarketSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "p2pSupplyAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "poolSupplyAmount", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getTotalMarketBorrow": { - "inputs": [ - { - "internalType": "address", - "name": "_poolTokenAddress", - "type": "address" - } - ], - "name": "getTotalMarketBorrow", - "outputs": [ - { - "internalType": "uint256", - "name": "p2pBorrowAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "poolBorrowAmount", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } + "getAllMarkets": "address[]:getAllMarkets", + "getTotalMarketSupply": "function getTotalMarketSupply(address _poolTokenAddress) view returns (uint256 p2pSupplyAmount, uint256 poolSupplyAmount)", + "getTotalMarketBorrow": "function getTotalMarketBorrow(address _poolTokenAddress) view returns (uint256 p2pBorrowAmount, uint256 poolBorrowAmount)" + }, + "morphoAaveV3": { + "marketsCreated": "address[]:marketsCreated", + "market": "function market(address underlying) returns (tuple( tuple(uint128 poolIndex, uint128 p2pIndex) supply, tuple(uint128 poolIndex, uint128 p2pIndex) borrow) indexes, tuple( tuple(uint256 scaledDelta, uint256 scaledP2PTotal) supply, tuple(uint256 scaledDelta, uint256 scaledP2PTotal) borrow) deltas, address underlying, tuple( bool isP2PDisabled, bool isSupplyPaused, bool isSupplyCollateralPaused, bool isBorrowPaused, bool isWithdrawPaused, bool isWithdrawCollateralPaused, bool isRepayPaused, bool isLiquidateCollateralPaused, bool isLiquidateBorrowPaused, bool isDeprecated) pauseStatues, bool isCollateral, address variableDebtToken, uint32 lastUpdateTimestamp, uint16 reserveFactor, uint16 p2pIndexCursor, address aToken, address stableDebtToken, uint256 idleSupply)" + }, + "pool": { + } } \ No newline at end of file diff --git a/projects/helper/abis/symbol.json b/projects/helper/abis/symbol.json deleted file mode 100644 index 663f412929f..00000000000 --- a/projects/helper/abis/symbol.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "constant": true, - "inputs": [], - "name": "symbol", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" -} \ No newline at end of file diff --git a/projects/helper/abis/token.json b/projects/helper/abis/token.json deleted file mode 100644 index 3c00d06d029..00000000000 --- a/projects/helper/abis/token.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "inputs": [], - "name": "token", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" -} diff --git a/projects/helper/abis/token0.json b/projects/helper/abis/token0.json deleted file mode 100644 index eefbeb998a3..00000000000 --- a/projects/helper/abis/token0.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "constant": true, - "inputs": [], - "name": "token0", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" -} diff --git a/projects/helper/abis/token1.json b/projects/helper/abis/token1.json deleted file mode 100644 index cccef25f486..00000000000 --- a/projects/helper/abis/token1.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "constant": true, - "inputs": [], - "name": "token1", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" -} diff --git a/projects/helper/abis/underlying.json b/projects/helper/abis/underlying.json deleted file mode 100644 index 9b4ef1c9019..00000000000 --- a/projects/helper/abis/underlying.json +++ /dev/null @@ -1,14 +0,0 @@ - - { - "inputs": [], - "name": "underlying", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } \ No newline at end of file diff --git a/projects/helper/abis/uniswap.js b/projects/helper/abis/uniswap.js new file mode 100644 index 00000000000..35ff8f01654 --- /dev/null +++ b/projects/helper/abis/uniswap.js @@ -0,0 +1,4 @@ + +const factory = require('./factory.json'); + +module.exports = factory \ No newline at end of file diff --git a/projects/helper/abis/userInfo.json b/projects/helper/abis/userInfo.json deleted file mode 100644 index 27e9048a1ad..00000000000 --- a/projects/helper/abis/userInfo.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "inputs": [{ - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "userInfo", - "outputs": [{ - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "rewardDebt", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" -} diff --git a/projects/helper/acala/api.js b/projects/helper/acala/api.js index f62a1ce98ce..bf05f501c56 100644 --- a/projects/helper/acala/api.js +++ b/projects/helper/acala/api.js @@ -145,7 +145,7 @@ async function getTokenPrices({ api, chain = '' }) { let baseAsset = mapping.assets[0].assetId let quoteAsset = mapping.assets[1].assetId let baseAmount, quoteAmount - + if (data) { baseAmount = +data.baseAmount quoteAmount = +data.quoteAmount @@ -154,19 +154,19 @@ async function getTokenPrices({ api, chain = '' }) { baseAmount = +lpTokenPoolsReverse[i].quoteAmount } - const coreToken1 = coreAssets.includes(''+baseAsset) - const coreToken2 = coreAssets.includes(''+quoteAsset) + const coreToken1 = coreAssets.includes('' + baseAsset) + const coreToken2 = coreAssets.includes('' + quoteAsset) if (coreToken1 && coreToken2) { - prices[lpAssetId] = { ...geckoMapping[baseAsset], price: baseAmount * 2 /totalSupplies[lpAssetId] } + prices[lpAssetId] = { ...geckoMapping[baseAsset], price: baseAmount * 2 / totalSupplies[lpAssetId] } sdk.util.sumSingleBalance(balances, baseAsset, baseAmount) sdk.util.sumSingleBalance(balances, quoteAsset, quoteAmount) } else if (coreToken1) { - prices[lpAssetId] = { ...geckoMapping[baseAsset], price: baseAmount * 2 /totalSupplies[lpAssetId] } - prices[quoteAsset] = { ...geckoMapping[baseAsset], price: baseAmount / quoteAmount } + prices[lpAssetId] = { ...geckoMapping[baseAsset], price: baseAmount * 2 / totalSupplies[lpAssetId] } + prices[quoteAsset] = { ...geckoMapping[baseAsset], price: baseAmount / quoteAmount } sdk.util.sumSingleBalance(balances, baseAsset, baseAmount * 2) } else if (coreToken2) { - prices[lpAssetId] = { ...geckoMapping[quoteAsset], price: quoteAmount * 2 /totalSupplies[lpAssetId] } - prices[baseAsset] = { ...geckoMapping[quoteAsset], price: quoteAmount / baseAmount } + prices[lpAssetId] = { ...geckoMapping[quoteAsset], price: quoteAmount * 2 / totalSupplies[lpAssetId] } + prices[baseAsset] = { ...geckoMapping[quoteAsset], price: quoteAmount / baseAmount } sdk.util.sumSingleBalance(balances, quoteAsset, quoteAmount * 2) } else { sdk.util.sumSingleBalance(balances, baseAsset, baseAmount) @@ -204,10 +204,10 @@ const geckoMappings = { ACA: 'acala', DOT: 'polkadot', AUSD: 'acala-dollar', - LDOT: 'liquid-staking-dot', + // LDOT: 'liquid-staking-dot', // coingecko delisted it }, liquidCrowdloan: { - 13: 'liquid-crowdloan-dot', + // 13: 'liquid-crowdloan-dot', // coingecko delisted it } }, karura: { @@ -241,8 +241,10 @@ async function addTokenBalance({ balances, amount, chain, tokenArg, api, wallet, if (chain === 'acala' && tokenJson.foreignAsset === 3) return; const price = await wallet.getPrice(token) - if (price) + if (price) { + sdk.log('Adding token value in USD (in millions), amount: ', forceToCurrencyName(tokenArg), amount.times(price).toNumber() / 1e6, amount.toNumber()/1e6,) sdk.util.sumSingleBalance(balances, 'tether', amount.times(price).toNumber()) + } } module.exports = { diff --git a/projects/helper/acala/dex-staking.js b/projects/helper/acala/dex-staking.js index ad58febf4b2..c73626dfb96 100644 --- a/projects/helper/acala/dex-staking.js +++ b/projects/helper/acala/dex-staking.js @@ -1,4 +1,5 @@ const { FixedPointNumber, forceToCurrencyName } = require("@acala-network/sdk-core"); +const { getAPI, getWallet } = require('./api') async function dexStaking(chain){ const api = await getAPI(chain) @@ -6,7 +7,7 @@ async function dexStaking(chain){ const data = await api.query.rewards.poolInfos.entries(); let total = FixedPointNumber.ZERO; const filterData = data.filter(([token]) => { - return token.toHuman()[0].hasOwnProperty('Dex'); + return token.toHuman()[0].Dex }); for (let i = 0; i < filterData.length; i++) { diff --git a/projects/helper/ankr/abis/AethToken.json b/projects/helper/ankr/abis/AethToken.json deleted file mode 100644 index cd3ac401092..00000000000 --- a/projects/helper/ankr/abis/AethToken.json +++ /dev/null @@ -1,293 +0,0 @@ -[ - { - "constant": true, - "inputs": [], - "name": "name", - "outputs": [ - { - "name": "", - "type": "string" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "guy", - "type": "address" - }, - { - "name": "wad", - "type": "uint256" - } - ], - "name": "approve", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "src", - "type": "address" - }, - { - "name": "dst", - "type": "address" - }, - { - "name": "wad", - "type": "uint256" - } - ], - "name": "transferFrom", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "wad", - "type": "uint256" - } - ], - "name": "withdraw", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "decimals", - "outputs": [ - { - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "symbol", - "outputs": [ - { - "name": "", - "type": "string" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "dst", - "type": "address" - }, - { - "name": "wad", - "type": "uint256" - } - ], - "name": "transfer", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [], - "name": "deposit", - "outputs": [], - "payable": true, - "stateMutability": "payable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - }, - { - "name": "", - "type": "address" - } - ], - "name": "allowance", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "payable": true, - "stateMutability": "payable", - "type": "fallback" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "src", - "type": "address" - }, - { - "indexed": true, - "name": "guy", - "type": "address" - }, - { - "indexed": false, - "name": "wad", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "src", - "type": "address" - }, - { - "indexed": true, - "name": "dst", - "type": "address" - }, - { - "indexed": false, - "name": "wad", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "dst", - "type": "address" - }, - { - "indexed": false, - "name": "wad", - "type": "uint256" - } - ], - "name": "Deposit", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "src", - "type": "address" - }, - { - "indexed": false, - "name": "wad", - "type": "uint256" - } - ], - "name": "Withdrawal", - "type": "event" - }, - { - "inputs": [], - "name": "ratio", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -] - diff --git a/projects/helper/ankr/abis/ERC20.json b/projects/helper/ankr/abis/ERC20.json deleted file mode 100644 index be242206d89..00000000000 --- a/projects/helper/ankr/abis/ERC20.json +++ /dev/null @@ -1,347 +0,0 @@ -[ - { - "inputs": [], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipTransferred", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "spender", - "type": "address" - } - ], - "name": "allowance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "approve", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "decimals", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "subtractedValue", - "type": "uint256" - } - ], - "name": "decreaseAllowance", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "addedValue", - "type": "uint256" - } - ], - "name": "increaseAllowance", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "mintTo", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "name", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "renounceOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "symbol", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "transfer", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "transferFrom", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } -] \ No newline at end of file diff --git a/projects/helper/ankr/abis/OnsToken.json b/projects/helper/ankr/abis/OnsToken.json deleted file mode 100644 index bc849fc724a..00000000000 --- a/projects/helper/ankr/abis/OnsToken.json +++ /dev/null @@ -1,602 +0,0 @@ -[ - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousGovernor", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newGovernor", - "type": "address" - } - ], - "name": "GovernorshipTransferred", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "governor_", - "type": "address" - } - ], - "name": "__Governable_init_unchained", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "governor_", - "type": "address" - }, - { - "internalType": "address", - "name": "vault_", - "type": "address" - }, - { - "internalType": "address", - "name": "onsFarm", - "type": "address" - }, - { - "internalType": "address", - "name": "offering", - "type": "address" - }, - { - "internalType": "address", - "name": "timelock", - "type": "address" - } - ], - "name": "__ONS_init", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "onsFarm", - "type": "address" - }, - { - "internalType": "address", - "name": "offering", - "type": "address" - }, - { - "internalType": "address", - "name": "timelock", - "type": "address" - } - ], - "name": "__ONS_init_unchained", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "vault_", - "type": "address" - } - ], - "name": "__VaultERC20_init_unchained", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "spender", - "type": "address" - } - ], - "name": "allowance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "approve", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "acct", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amt", - "type": "uint256" - } - ], - "name": "burn_", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "decimals", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "subtractedValue", - "type": "uint256" - } - ], - "name": "decreaseAllowance", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "addr", - "type": "address" - } - ], - "name": "getConfig", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "getConfig", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "index", - "type": "uint256" - } - ], - "name": "getConfig", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "governor", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "addedValue", - "type": "uint256" - } - ], - "name": "increaseAllowance", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "acct", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amt", - "type": "uint256" - } - ], - "name": "mint_", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "name", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "renounceGovernorship", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "setConfig", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "addr", - "type": "address" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "setConfig", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "index", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "setConfig", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "symbol", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "transfer", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "transferFrom", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "transferFrom_", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newGovernor", - "type": "address" - } - ], - "name": "transferGovernorship", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } -] \ No newline at end of file diff --git a/projects/helper/ankr/abis/OnxPool.json b/projects/helper/ankr/abis/OnxPool.json deleted file mode 100644 index d579355d449..00000000000 --- a/projects/helper/ankr/abis/OnxPool.json +++ /dev/null @@ -1,41 +0,0 @@ -[ - { - "inputs": [], - "name": "totalBorrow", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalStake", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalPledge", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -] \ No newline at end of file diff --git a/projects/helper/ankr/abis/OnxToken.json b/projects/helper/ankr/abis/OnxToken.json deleted file mode 100644 index 23f1cac0b15..00000000000 --- a/projects/helper/ankr/abis/OnxToken.json +++ /dev/null @@ -1,384 +0,0 @@ -[ - { - "inputs": [ - { - "internalType": "address", - "name": "_exchange", - "type": "address" - }, - { - "internalType": "address", - "name": "_treasury", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipTransferred", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "spender", - "type": "address" - } - ], - "name": "allowance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "approve", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "decimals", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "subtractedValue", - "type": "uint256" - } - ], - "name": "decreaseAllowance", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "exchangeAirdropCampaign", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "addedValue", - "type": "uint256" - } - ], - "name": "increaseAllowance", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "mintTo", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "name", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "renounceOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "symbol", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "transfer", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "transferFrom", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "treasuryAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } -] \ No newline at end of file diff --git a/projects/helper/ankr/abis/QuickswapPool.json b/projects/helper/ankr/abis/QuickswapPool.json deleted file mode 100644 index 809791babe5..00000000000 --- a/projects/helper/ankr/abis/QuickswapPool.json +++ /dev/null @@ -1,345 +0,0 @@ -[ - { "inputs": [], "payable": false, "stateMutability": "nonpayable", "type": "constructor" }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "owner", "type": "address" }, - { "indexed": true, "internalType": "address", "name": "spender", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "sender", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "amount0", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "amount1", "type": "uint256" }, - { "indexed": true, "internalType": "address", "name": "to", "type": "address" } - ], - "name": "Burn", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "sender", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "amount0", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "amount1", "type": "uint256" } - ], - "name": "Mint", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "sender", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "amount0In", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "amount1In", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "amount0Out", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "amount1Out", "type": "uint256" }, - { "indexed": true, "internalType": "address", "name": "to", "type": "address" } - ], - "name": "Swap", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": false, "internalType": "uint112", "name": "reserve0", "type": "uint112" }, - { "indexed": false, "internalType": "uint112", "name": "reserve1", "type": "uint112" } - ], - "name": "Sync", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "from", "type": "address" }, - { "indexed": true, "internalType": "address", "name": "to", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" } - ], - "name": "Transfer", - "type": "event" - }, - { - "constant": true, - "inputs": [], - "name": "DOMAIN_SEPARATOR", - "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "MINIMUM_LIQUIDITY", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "PERMIT_TYPEHASH", - "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { "internalType": "address", "name": "", "type": "address" }, - { "internalType": "address", "name": "", "type": "address" } - ], - "name": "allowance", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { "internalType": "address", "name": "spender", "type": "address" }, - { "internalType": "uint256", "name": "value", "type": "uint256" } - ], - "name": "approve", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [{ "internalType": "address", "name": "", "type": "address" }], - "name": "balanceOf", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [{ "internalType": "address", "name": "to", "type": "address" }], - "name": "burn", - "outputs": [ - { "internalType": "uint256", "name": "amount0", "type": "uint256" }, - { "internalType": "uint256", "name": "amount1", "type": "uint256" } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "decimals", - "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "factory", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getReserves", - "outputs": [ - { "internalType": "uint112", "name": "_reserve0", "type": "uint112" }, - { "internalType": "uint112", "name": "_reserve1", "type": "uint112" }, - { "internalType": "uint32", "name": "_blockTimestampLast", "type": "uint32" } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { "internalType": "address", "name": "_token0", "type": "address" }, - { "internalType": "address", "name": "_token1", "type": "address" } - ], - "name": "initialize", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "kLast", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [{ "internalType": "address", "name": "to", "type": "address" }], - "name": "mint", - "outputs": [{ "internalType": "uint256", "name": "liquidity", "type": "uint256" }], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "name", - "outputs": [{ "internalType": "string", "name": "", "type": "string" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [{ "internalType": "address", "name": "", "type": "address" }], - "name": "nonces", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { "internalType": "address", "name": "owner", "type": "address" }, - { "internalType": "address", "name": "spender", "type": "address" }, - { "internalType": "uint256", "name": "value", "type": "uint256" }, - { "internalType": "uint256", "name": "deadline", "type": "uint256" }, - { "internalType": "uint8", "name": "v", "type": "uint8" }, - { "internalType": "bytes32", "name": "r", "type": "bytes32" }, - { "internalType": "bytes32", "name": "s", "type": "bytes32" } - ], - "name": "permit", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "price0CumulativeLast", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "price1CumulativeLast", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [{ "internalType": "address", "name": "to", "type": "address" }], - "name": "skim", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { "internalType": "uint256", "name": "amount0Out", "type": "uint256" }, - { "internalType": "uint256", "name": "amount1Out", "type": "uint256" }, - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "bytes", "name": "data", "type": "bytes" } - ], - "name": "swap", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "symbol", - "outputs": [{ "internalType": "string", "name": "", "type": "string" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [], - "name": "sync", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "token0", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "token1", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "totalSupply", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "value", "type": "uint256" } - ], - "name": "transfer", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { "internalType": "address", "name": "from", "type": "address" }, - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "value", "type": "uint256" } - ], - "name": "transferFrom", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - } -] diff --git a/projects/helper/ankr/abis/QuickswapVault.json b/projects/helper/ankr/abis/QuickswapVault.json deleted file mode 100644 index faec382e381..00000000000 --- a/projects/helper/ankr/abis/QuickswapVault.json +++ /dev/null @@ -1,292 +0,0 @@ -[ - { "inputs": [], "stateMutability": "nonpayable", "type": "constructor" }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "owner", "type": "address" }, - { "indexed": true, "internalType": "address", "name": "spender", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "beneficiary", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "Deposit", - "type": "event" - }, - { - "anonymous": false, - "inputs": [{ "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" }], - "name": "Invest", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "from", "type": "address" }, - { "indexed": true, "internalType": "address", "name": "to", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" } - ], - "name": "Transfer", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "beneficiary", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "Withdraw", - "type": "event" - }, - { - "inputs": [ - { "internalType": "address", "name": "owner", "type": "address" }, - { "internalType": "address", "name": "spender", "type": "address" } - ], - "name": "allowance", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "spender", "type": "address" }, - { "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "approve", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], - "name": "balanceOf", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "controller", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "decimals", - "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "spender", "type": "address" }, - { "internalType": "uint256", "name": "subtractedValue", "type": "uint256" } - ], - "name": "decreaseAllowance", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [{ "internalType": "uint256", "name": "amount", "type": "uint256" }], - "name": "deposit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "amount", "type": "uint256" }, - { "internalType": "address", "name": "holder", "type": "address" } - ], - "name": "depositFor", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { "inputs": [], "name": "doHardWork", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [], - "name": "governance", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "spender", "type": "address" }, - { "internalType": "uint256", "name": "addedValue", "type": "uint256" } - ], - "name": "increaseAllowance", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "_storage", "type": "address" }, - { "internalType": "address", "name": "_underlying", "type": "address" } - ], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "_storage", "type": "address" }], - "name": "initializeControllableInit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "_store", "type": "address" }], - "name": "initializeGovernableInit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "_underlying", "type": "address" }, - { "internalType": "uint256", "name": "_underlyingUnit", "type": "uint256" } - ], - "name": "initializeVaultStorage", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "name", - "outputs": [{ "internalType": "string", "name": "", "type": "string" }], - "stateMutability": "view", - "type": "function" - }, - { "inputs": [], "name": "rebalance", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [ - { "internalType": "uint256", "name": "_fee", "type": "uint256" }, - { "internalType": "uint256", "name": "_feeMax", "type": "uint256" } - ], - "name": "setKeepFee", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "_store", "type": "address" }], - "name": "setStorage", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "_strategy", "type": "address" }], - "name": "setStrategy", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { "inputs": [], "name": "stakeQuickFarm", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [], - "name": "strategy", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "symbol", - "outputs": [{ "internalType": "string", "name": "", "type": "string" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalSupply", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "recipient", "type": "address" }, - { "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "transfer", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "sender", "type": "address" }, - { "internalType": "address", "name": "recipient", "type": "address" }, - { "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "transferFrom", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "treasury", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "underlying", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "underlyingBalanceInVault", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "underlyingBalanceWithInvestment", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "holder", "type": "address" }], - "name": "underlyingBalanceWithInvestmentForHolder", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "underlyingUnit", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "uint256", "name": "numberOfShares", "type": "uint256" }], - "name": "withdraw", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { "inputs": [], "name": "withdrawAll", "outputs": [], "stateMutability": "nonpayable", "type": "function" } -] diff --git a/projects/helper/ankr/abis/SOnxToken.json b/projects/helper/ankr/abis/SOnxToken.json deleted file mode 100644 index 2b6c6a3b97f..00000000000 --- a/projects/helper/ankr/abis/SOnxToken.json +++ /dev/null @@ -1,322 +0,0 @@ -[ - { - "inputs": [ - { - "internalType": "contract IERC20", - "name": "_onx", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "spender", - "type": "address" - } - ], - "name": "allowance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "approve", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "decimals", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "subtractedValue", - "type": "uint256" - } - ], - "name": "decreaseAllowance", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "enter", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "addedValue", - "type": "uint256" - } - ], - "name": "increaseAllowance", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_share", - "type": "uint256" - } - ], - "name": "leave", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "name", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "onx", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "symbol", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "transfer", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "transferFrom", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - } -] \ No newline at end of file diff --git a/projects/helper/ankr/abis/SpookyswapPool.json b/projects/helper/ankr/abis/SpookyswapPool.json deleted file mode 100644 index 134942794cd..00000000000 --- a/projects/helper/ankr/abis/SpookyswapPool.json +++ /dev/null @@ -1,285 +0,0 @@ -[ - { "inputs": [], "stateMutability": "nonpayable", "type": "constructor" }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "owner", "type": "address" }, - { "indexed": true, "internalType": "address", "name": "spender", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "sender", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "amount0", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "amount1", "type": "uint256" }, - { "indexed": true, "internalType": "address", "name": "to", "type": "address" } - ], - "name": "Burn", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "sender", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "amount0", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "amount1", "type": "uint256" } - ], - "name": "Mint", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "sender", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "amount0In", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "amount1In", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "amount0Out", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "amount1Out", "type": "uint256" }, - { "indexed": true, "internalType": "address", "name": "to", "type": "address" } - ], - "name": "Swap", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": false, "internalType": "uint112", "name": "reserve0", "type": "uint112" }, - { "indexed": false, "internalType": "uint112", "name": "reserve1", "type": "uint112" } - ], - "name": "Sync", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "from", "type": "address" }, - { "indexed": true, "internalType": "address", "name": "to", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" } - ], - "name": "Transfer", - "type": "event" - }, - { - "inputs": [], - "name": "DOMAIN_SEPARATOR", - "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "MINIMUM_LIQUIDITY", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "PERMIT_TYPEHASH", - "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "", "type": "address" }, - { "internalType": "address", "name": "", "type": "address" } - ], - "name": "allowance", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "spender", "type": "address" }, - { "internalType": "uint256", "name": "value", "type": "uint256" } - ], - "name": "approve", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "", "type": "address" }], - "name": "balanceOf", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "to", "type": "address" }], - "name": "burn", - "outputs": [ - { "internalType": "uint256", "name": "amount0", "type": "uint256" }, - { "internalType": "uint256", "name": "amount1", "type": "uint256" } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "decimals", - "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "factory", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getReserves", - "outputs": [ - { "internalType": "uint112", "name": "_reserve0", "type": "uint112" }, - { "internalType": "uint112", "name": "_reserve1", "type": "uint112" }, - { "internalType": "uint32", "name": "_blockTimestampLast", "type": "uint32" } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "_token0", "type": "address" }, - { "internalType": "address", "name": "_token1", "type": "address" } - ], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "kLast", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "to", "type": "address" }], - "name": "mint", - "outputs": [{ "internalType": "uint256", "name": "liquidity", "type": "uint256" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "name", - "outputs": [{ "internalType": "string", "name": "", "type": "string" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "", "type": "address" }], - "name": "nonces", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "owner", "type": "address" }, - { "internalType": "address", "name": "spender", "type": "address" }, - { "internalType": "uint256", "name": "value", "type": "uint256" }, - { "internalType": "uint256", "name": "deadline", "type": "uint256" }, - { "internalType": "uint8", "name": "v", "type": "uint8" }, - { "internalType": "bytes32", "name": "r", "type": "bytes32" }, - { "internalType": "bytes32", "name": "s", "type": "bytes32" } - ], - "name": "permit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "price0CumulativeLast", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "price1CumulativeLast", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "to", "type": "address" }], - "name": "skim", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "amount0Out", "type": "uint256" }, - { "internalType": "uint256", "name": "amount1Out", "type": "uint256" }, - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "bytes", "name": "data", "type": "bytes" } - ], - "name": "swap", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "symbol", - "outputs": [{ "internalType": "string", "name": "", "type": "string" }], - "stateMutability": "view", - "type": "function" - }, - { "inputs": [], "name": "sync", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [], - "name": "token0", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "token1", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalSupply", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "value", "type": "uint256" } - ], - "name": "transfer", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "from", "type": "address" }, - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "value", "type": "uint256" } - ], - "name": "transferFrom", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - } -] diff --git a/projects/helper/ankr/abis/SpookyswapVault.json b/projects/helper/ankr/abis/SpookyswapVault.json deleted file mode 100644 index b87a3f1de04..00000000000 --- a/projects/helper/ankr/abis/SpookyswapVault.json +++ /dev/null @@ -1,277 +0,0 @@ -[ - { "inputs": [], "stateMutability": "nonpayable", "type": "constructor" }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "owner", "type": "address" }, - { "indexed": true, "internalType": "address", "name": "spender", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "beneficiary", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "Deposit", - "type": "event" - }, - { - "anonymous": false, - "inputs": [{ "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" }], - "name": "Invest", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "from", "type": "address" }, - { "indexed": true, "internalType": "address", "name": "to", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" } - ], - "name": "Transfer", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "beneficiary", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "Withdraw", - "type": "event" - }, - { - "inputs": [ - { "internalType": "address", "name": "owner", "type": "address" }, - { "internalType": "address", "name": "spender", "type": "address" } - ], - "name": "allowance", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "spender", "type": "address" }, - { "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "approve", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], - "name": "balanceOf", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "controller", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "decimals", - "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "spender", "type": "address" }, - { "internalType": "uint256", "name": "subtractedValue", "type": "uint256" } - ], - "name": "decreaseAllowance", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [{ "internalType": "uint256", "name": "amount", "type": "uint256" }], - "name": "deposit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "amount", "type": "uint256" }, - { "internalType": "address", "name": "holder", "type": "address" } - ], - "name": "depositFor", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { "inputs": [], "name": "doHardWork", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [], - "name": "governance", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "spender", "type": "address" }, - { "internalType": "uint256", "name": "addedValue", "type": "uint256" } - ], - "name": "increaseAllowance", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "_storage", "type": "address" }, - { "internalType": "address", "name": "_underlying", "type": "address" } - ], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "_storage", "type": "address" }], - "name": "initializeControllableInit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "_store", "type": "address" }], - "name": "initializeGovernableInit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "_underlying", "type": "address" }, - { "internalType": "uint256", "name": "_underlyingUnit", "type": "uint256" } - ], - "name": "initializeVaultStorage", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "name", - "outputs": [{ "internalType": "string", "name": "", "type": "string" }], - "stateMutability": "view", - "type": "function" - }, - { "inputs": [], "name": "rebalance", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [{ "internalType": "address", "name": "_store", "type": "address" }], - "name": "setStorage", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "_strategy", "type": "address" }], - "name": "setStrategy", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { "inputs": [], "name": "stakeBooFarm", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { "inputs": [], "name": "stakeExternalRewards", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { "inputs": [], "name": "stakeXBoo", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [], - "name": "strategy", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "symbol", - "outputs": [{ "internalType": "string", "name": "", "type": "string" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalSupply", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "recipient", "type": "address" }, - { "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "transfer", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "sender", "type": "address" }, - { "internalType": "address", "name": "recipient", "type": "address" }, - { "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "transferFrom", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "underlying", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "underlyingBalanceInVault", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "underlyingBalanceWithInvestment", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "holder", "type": "address" }], - "name": "underlyingBalanceWithInvestmentForHolder", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "underlyingUnit", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "uint256", "name": "numberOfShares", "type": "uint256" }], - "name": "withdraw", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { "inputs": [], "name": "withdrawAll", "outputs": [], "stateMutability": "nonpayable", "type": "function" } -] diff --git a/projects/helper/ankr/abis/SushiswapPool.json b/projects/helper/ankr/abis/SushiswapPool.json deleted file mode 100644 index 134942794cd..00000000000 --- a/projects/helper/ankr/abis/SushiswapPool.json +++ /dev/null @@ -1,285 +0,0 @@ -[ - { "inputs": [], "stateMutability": "nonpayable", "type": "constructor" }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "owner", "type": "address" }, - { "indexed": true, "internalType": "address", "name": "spender", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "sender", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "amount0", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "amount1", "type": "uint256" }, - { "indexed": true, "internalType": "address", "name": "to", "type": "address" } - ], - "name": "Burn", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "sender", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "amount0", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "amount1", "type": "uint256" } - ], - "name": "Mint", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "sender", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "amount0In", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "amount1In", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "amount0Out", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "amount1Out", "type": "uint256" }, - { "indexed": true, "internalType": "address", "name": "to", "type": "address" } - ], - "name": "Swap", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": false, "internalType": "uint112", "name": "reserve0", "type": "uint112" }, - { "indexed": false, "internalType": "uint112", "name": "reserve1", "type": "uint112" } - ], - "name": "Sync", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "from", "type": "address" }, - { "indexed": true, "internalType": "address", "name": "to", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" } - ], - "name": "Transfer", - "type": "event" - }, - { - "inputs": [], - "name": "DOMAIN_SEPARATOR", - "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "MINIMUM_LIQUIDITY", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "PERMIT_TYPEHASH", - "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "", "type": "address" }, - { "internalType": "address", "name": "", "type": "address" } - ], - "name": "allowance", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "spender", "type": "address" }, - { "internalType": "uint256", "name": "value", "type": "uint256" } - ], - "name": "approve", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "", "type": "address" }], - "name": "balanceOf", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "to", "type": "address" }], - "name": "burn", - "outputs": [ - { "internalType": "uint256", "name": "amount0", "type": "uint256" }, - { "internalType": "uint256", "name": "amount1", "type": "uint256" } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "decimals", - "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "factory", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getReserves", - "outputs": [ - { "internalType": "uint112", "name": "_reserve0", "type": "uint112" }, - { "internalType": "uint112", "name": "_reserve1", "type": "uint112" }, - { "internalType": "uint32", "name": "_blockTimestampLast", "type": "uint32" } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "_token0", "type": "address" }, - { "internalType": "address", "name": "_token1", "type": "address" } - ], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "kLast", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "to", "type": "address" }], - "name": "mint", - "outputs": [{ "internalType": "uint256", "name": "liquidity", "type": "uint256" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "name", - "outputs": [{ "internalType": "string", "name": "", "type": "string" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "", "type": "address" }], - "name": "nonces", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "owner", "type": "address" }, - { "internalType": "address", "name": "spender", "type": "address" }, - { "internalType": "uint256", "name": "value", "type": "uint256" }, - { "internalType": "uint256", "name": "deadline", "type": "uint256" }, - { "internalType": "uint8", "name": "v", "type": "uint8" }, - { "internalType": "bytes32", "name": "r", "type": "bytes32" }, - { "internalType": "bytes32", "name": "s", "type": "bytes32" } - ], - "name": "permit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "price0CumulativeLast", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "price1CumulativeLast", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "to", "type": "address" }], - "name": "skim", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "amount0Out", "type": "uint256" }, - { "internalType": "uint256", "name": "amount1Out", "type": "uint256" }, - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "bytes", "name": "data", "type": "bytes" } - ], - "name": "swap", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "symbol", - "outputs": [{ "internalType": "string", "name": "", "type": "string" }], - "stateMutability": "view", - "type": "function" - }, - { "inputs": [], "name": "sync", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [], - "name": "token0", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "token1", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalSupply", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "value", "type": "uint256" } - ], - "name": "transfer", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "from", "type": "address" }, - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "value", "type": "uint256" } - ], - "name": "transferFrom", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - } -] diff --git a/projects/helper/ankr/abis/SushiswapVault.json b/projects/helper/ankr/abis/SushiswapVault.json deleted file mode 100644 index 7200fb5207e..00000000000 --- a/projects/helper/ankr/abis/SushiswapVault.json +++ /dev/null @@ -1,280 +0,0 @@ -[ - { "inputs": [], "stateMutability": "nonpayable", "type": "constructor" }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "owner", "type": "address" }, - { "indexed": true, "internalType": "address", "name": "spender", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "beneficiary", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "Deposit", - "type": "event" - }, - { - "anonymous": false, - "inputs": [{ "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" }], - "name": "Invest", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "from", "type": "address" }, - { "indexed": true, "internalType": "address", "name": "to", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" } - ], - "name": "Transfer", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "beneficiary", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "Withdraw", - "type": "event" - }, - { - "inputs": [ - { "internalType": "address", "name": "owner", "type": "address" }, - { "internalType": "address", "name": "spender", "type": "address" } - ], - "name": "allowance", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "spender", "type": "address" }, - { "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "approve", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], - "name": "balanceOf", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "controller", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "decimals", - "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "spender", "type": "address" }, - { "internalType": "uint256", "name": "subtractedValue", "type": "uint256" } - ], - "name": "decreaseAllowance", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [{ "internalType": "uint256", "name": "amount", "type": "uint256" }], - "name": "deposit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "amount", "type": "uint256" }, - { "internalType": "address", "name": "holder", "type": "address" } - ], - "name": "depositFor", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { "inputs": [], "name": "doHardWork", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { "inputs": [], "name": "doHardWorkSOnx", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { "inputs": [], "name": "doHardWorkXSushi", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [], - "name": "governance", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "spender", "type": "address" }, - { "internalType": "uint256", "name": "addedValue", "type": "uint256" } - ], - "name": "increaseAllowance", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "_storage", "type": "address" }, - { "internalType": "address", "name": "_underlying", "type": "address" } - ], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "_storage", "type": "address" }], - "name": "initializeControllableInit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "_store", "type": "address" }], - "name": "initializeGovernableInit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "_underlying", "type": "address" }, - { "internalType": "uint256", "name": "_underlyingUnit", "type": "uint256" } - ], - "name": "initializeVaultStorage", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "name", - "outputs": [{ "internalType": "string", "name": "", "type": "string" }], - "stateMutability": "view", - "type": "function" - }, - { "inputs": [], "name": "rebalance", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [{ "internalType": "address", "name": "_store", "type": "address" }], - "name": "setStorage", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "_strategy", "type": "address" }], - "name": "setStrategy", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { "inputs": [], "name": "stakeOnsenFarm", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { "inputs": [], "name": "stakeOnx", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { "inputs": [], "name": "stakeOnxFarm", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { "inputs": [], "name": "stakeSushiBar", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [], - "name": "strategy", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "symbol", - "outputs": [{ "internalType": "string", "name": "", "type": "string" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalSupply", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "recipient", "type": "address" }, - { "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "transfer", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "sender", "type": "address" }, - { "internalType": "address", "name": "recipient", "type": "address" }, - { "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "transferFrom", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "underlying", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "underlyingBalanceInVault", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "underlyingBalanceWithInvestment", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "holder", "type": "address" }], - "name": "underlyingBalanceWithInvestmentForHolder", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "underlyingUnit", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "uint256", "name": "numberOfShares", "type": "uint256" }], - "name": "withdraw", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { "inputs": [], "name": "withdrawAll", "outputs": [], "stateMutability": "nonpayable", "type": "function" } -] diff --git a/projects/helper/ankr/abis/TraderJoePool.json b/projects/helper/ankr/abis/TraderJoePool.json deleted file mode 100644 index 134942794cd..00000000000 --- a/projects/helper/ankr/abis/TraderJoePool.json +++ /dev/null @@ -1,285 +0,0 @@ -[ - { "inputs": [], "stateMutability": "nonpayable", "type": "constructor" }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "owner", "type": "address" }, - { "indexed": true, "internalType": "address", "name": "spender", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "sender", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "amount0", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "amount1", "type": "uint256" }, - { "indexed": true, "internalType": "address", "name": "to", "type": "address" } - ], - "name": "Burn", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "sender", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "amount0", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "amount1", "type": "uint256" } - ], - "name": "Mint", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "sender", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "amount0In", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "amount1In", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "amount0Out", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "amount1Out", "type": "uint256" }, - { "indexed": true, "internalType": "address", "name": "to", "type": "address" } - ], - "name": "Swap", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": false, "internalType": "uint112", "name": "reserve0", "type": "uint112" }, - { "indexed": false, "internalType": "uint112", "name": "reserve1", "type": "uint112" } - ], - "name": "Sync", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "from", "type": "address" }, - { "indexed": true, "internalType": "address", "name": "to", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" } - ], - "name": "Transfer", - "type": "event" - }, - { - "inputs": [], - "name": "DOMAIN_SEPARATOR", - "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "MINIMUM_LIQUIDITY", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "PERMIT_TYPEHASH", - "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "", "type": "address" }, - { "internalType": "address", "name": "", "type": "address" } - ], - "name": "allowance", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "spender", "type": "address" }, - { "internalType": "uint256", "name": "value", "type": "uint256" } - ], - "name": "approve", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "", "type": "address" }], - "name": "balanceOf", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "to", "type": "address" }], - "name": "burn", - "outputs": [ - { "internalType": "uint256", "name": "amount0", "type": "uint256" }, - { "internalType": "uint256", "name": "amount1", "type": "uint256" } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "decimals", - "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "factory", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getReserves", - "outputs": [ - { "internalType": "uint112", "name": "_reserve0", "type": "uint112" }, - { "internalType": "uint112", "name": "_reserve1", "type": "uint112" }, - { "internalType": "uint32", "name": "_blockTimestampLast", "type": "uint32" } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "_token0", "type": "address" }, - { "internalType": "address", "name": "_token1", "type": "address" } - ], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "kLast", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "to", "type": "address" }], - "name": "mint", - "outputs": [{ "internalType": "uint256", "name": "liquidity", "type": "uint256" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "name", - "outputs": [{ "internalType": "string", "name": "", "type": "string" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "", "type": "address" }], - "name": "nonces", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "owner", "type": "address" }, - { "internalType": "address", "name": "spender", "type": "address" }, - { "internalType": "uint256", "name": "value", "type": "uint256" }, - { "internalType": "uint256", "name": "deadline", "type": "uint256" }, - { "internalType": "uint8", "name": "v", "type": "uint8" }, - { "internalType": "bytes32", "name": "r", "type": "bytes32" }, - { "internalType": "bytes32", "name": "s", "type": "bytes32" } - ], - "name": "permit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "price0CumulativeLast", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "price1CumulativeLast", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "to", "type": "address" }], - "name": "skim", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "amount0Out", "type": "uint256" }, - { "internalType": "uint256", "name": "amount1Out", "type": "uint256" }, - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "bytes", "name": "data", "type": "bytes" } - ], - "name": "swap", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "symbol", - "outputs": [{ "internalType": "string", "name": "", "type": "string" }], - "stateMutability": "view", - "type": "function" - }, - { "inputs": [], "name": "sync", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [], - "name": "token0", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "token1", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalSupply", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "value", "type": "uint256" } - ], - "name": "transfer", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "from", "type": "address" }, - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "value", "type": "uint256" } - ], - "name": "transferFrom", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - } -] diff --git a/projects/helper/ankr/abis/TraderJoeVault.json b/projects/helper/ankr/abis/TraderJoeVault.json deleted file mode 100644 index 51b7412f6d2..00000000000 --- a/projects/helper/ankr/abis/TraderJoeVault.json +++ /dev/null @@ -1,284 +0,0 @@ -[ - { "inputs": [], "stateMutability": "nonpayable", "type": "constructor" }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "owner", "type": "address" }, - { "indexed": true, "internalType": "address", "name": "spender", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "beneficiary", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "Deposit", - "type": "event" - }, - { - "anonymous": false, - "inputs": [{ "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" }], - "name": "Invest", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "from", "type": "address" }, - { "indexed": true, "internalType": "address", "name": "to", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" } - ], - "name": "Transfer", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "beneficiary", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "Withdraw", - "type": "event" - }, - { - "inputs": [ - { "internalType": "address", "name": "owner", "type": "address" }, - { "internalType": "address", "name": "spender", "type": "address" } - ], - "name": "allowance", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "spender", "type": "address" }, - { "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "approve", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], - "name": "balanceOf", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "controller", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "decimals", - "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "spender", "type": "address" }, - { "internalType": "uint256", "name": "subtractedValue", "type": "uint256" } - ], - "name": "decreaseAllowance", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [{ "internalType": "uint256", "name": "amount", "type": "uint256" }], - "name": "deposit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "amount", "type": "uint256" }, - { "internalType": "address", "name": "holder", "type": "address" } - ], - "name": "depositFor", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { "inputs": [], "name": "doHardWork", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [], - "name": "governance", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "spender", "type": "address" }, - { "internalType": "uint256", "name": "addedValue", "type": "uint256" } - ], - "name": "increaseAllowance", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "_storage", "type": "address" }, - { "internalType": "address", "name": "_underlying", "type": "address" } - ], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "_storage", "type": "address" }], - "name": "initializeControllableInit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "_store", "type": "address" }], - "name": "initializeGovernableInit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "_underlying", "type": "address" }, - { "internalType": "uint256", "name": "_underlyingUnit", "type": "uint256" } - ], - "name": "initializeVaultStorage", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "name", - "outputs": [{ "internalType": "string", "name": "", "type": "string" }], - "stateMutability": "view", - "type": "function" - }, - { "inputs": [], "name": "rebalance", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [ - { "internalType": "uint256", "name": "_fee", "type": "uint256" }, - { "internalType": "uint256", "name": "_feeMax", "type": "uint256" } - ], - "name": "setKeepFee", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "_store", "type": "address" }], - "name": "setStorage", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "_strategy", "type": "address" }], - "name": "setStrategy", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "strategy", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "symbol", - "outputs": [{ "internalType": "string", "name": "", "type": "string" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalSupply", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "recipient", "type": "address" }, - { "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "transfer", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "sender", "type": "address" }, - { "internalType": "address", "name": "recipient", "type": "address" }, - { "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "transferFrom", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "underlying", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "underlyingBalanceInVault", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "underlyingBalanceWithInvestment", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "holder", "type": "address" }], - "name": "underlyingBalanceWithInvestmentForHolder", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "underlyingUnit", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "uint256", "name": "numberOfShares", "type": "uint256" }], - "name": "withdraw", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { "inputs": [], "name": "withdrawAll", "outputs": [], "stateMutability": "nonpayable", "type": "function" } -] diff --git a/projects/helper/ankr/abis/UniswapV2Pair.json b/projects/helper/ankr/abis/UniswapV2Pair.json deleted file mode 100644 index 53582c1ed68..00000000000 --- a/projects/helper/ankr/abis/UniswapV2Pair.json +++ /dev/null @@ -1,713 +0,0 @@ -[ - { - "inputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount0", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount1", - "type": "uint256" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - } - ], - "name": "Burn", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount0", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount1", - "type": "uint256" - } - ], - "name": "Mint", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount0In", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount1In", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount0Out", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount1Out", - "type": "uint256" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - } - ], - "name": "Swap", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint112", - "name": "reserve0", - "type": "uint112" - }, - { - "indexed": false, - "internalType": "uint112", - "name": "reserve1", - "type": "uint112" - } - ], - "name": "Sync", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "constant": true, - "inputs": [], - "name": "DOMAIN_SEPARATOR", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "MINIMUM_LIQUIDITY", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "PERMIT_TYPEHASH", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "allowance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "approve", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "to", - "type": "address" - } - ], - "name": "burn", - "outputs": [ - { - "internalType": "uint256", - "name": "amount0", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "amount1", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "decimals", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "factory", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getReserves", - "outputs": [ - { - "internalType": "uint112", - "name": "_reserve0", - "type": "uint112" - }, - { - "internalType": "uint112", - "name": "_reserve1", - "type": "uint112" - }, - { - "internalType": "uint32", - "name": "_blockTimestampLast", - "type": "uint32" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "_token0", - "type": "address" - }, - { - "internalType": "address", - "name": "_token1", - "type": "address" - } - ], - "name": "initialize", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "kLast", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "to", - "type": "address" - } - ], - "name": "mint", - "outputs": [ - { - "internalType": "uint256", - "name": "liquidity", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "name", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "nonces", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - }, - { - "internalType": "uint8", - "name": "v", - "type": "uint8" - }, - { - "internalType": "bytes32", - "name": "r", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "s", - "type": "bytes32" - } - ], - "name": "permit", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "price0CumulativeLast", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "price1CumulativeLast", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "to", - "type": "address" - } - ], - "name": "skim", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "uint256", - "name": "amount0Out", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "amount1Out", - "type": "uint256" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "swap", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "symbol", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [], - "name": "sync", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "token0", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "token1", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "transfer", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "transferFrom", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - } -] diff --git a/projects/helper/ankr/abis/activePool.json b/projects/helper/ankr/abis/activePool.json deleted file mode 100644 index 5a4554fe299..00000000000 --- a/projects/helper/ankr/abis/activePool.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "inputs": [], - "name": "activePool", - "outputs": [ - { - "internalType": "contract IActivePool", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" -} \ No newline at end of file diff --git a/projects/helper/ankr/abis/wethAddress.json b/projects/helper/ankr/abis/wethAddress.json deleted file mode 100644 index e58bb9cd722..00000000000 --- a/projects/helper/ankr/abis/wethAddress.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "inputs": [], - "name": "wethAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" -} \ No newline at end of file diff --git a/projects/helper/ankr/chainAddresses.js b/projects/helper/ankr/chainAddresses.js index 60cc8a83fb8..6f2fdbb2fe8 100644 --- a/projects/helper/ankr/chainAddresses.js +++ b/projects/helper/ankr/chainAddresses.js @@ -1,8 +1,9 @@ +const ADDRESSES = require('../coreAssets.json') const coinAddresses = { - weth: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", //Ethereum - ftm: "0x4e15361fd6b4bb609fa63c81a2be19d873717870", //Fantom - matic: "0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0", //Matic - dot: "0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0", //DOT + weth: ADDRESSES.ethereum.WETH, //Ethereum + ftm: ADDRESSES.ethereum.FTM, //Fantom + matic: ADDRESSES.ethereum.MATIC, //Matic + dot: ADDRESSES.ethereum.MATIC, //DOT avax: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", //Avalanche }; diff --git a/projects/helper/ankr/prices/binance.js b/projects/helper/ankr/prices/binance.js deleted file mode 100644 index e699c675f50..00000000000 --- a/projects/helper/ankr/prices/binance.js +++ /dev/null @@ -1,12 +0,0 @@ -const { fetchURL } = require("../../utils"); - -const getBinancePrice = async (symbol) => { - const response = await fetchURL( - `https://api.binance.com/api/v3/ticker/price?symbol=${symbol}` - ); - return response?.data?.price; -}; - -module.exports = { - getBinancePrice, -}; diff --git a/projects/helper/ankr/utils.js b/projects/helper/ankr/utils.js index 016af4fe75a..2c658b9cfdd 100644 --- a/projects/helper/ankr/utils.js +++ b/projects/helper/ankr/utils.js @@ -1,8 +1,6 @@ const BigNumber = require('bignumber.js'); const { toUSDTBalances } = require('../balances'); -const vaultABI = require('./abis/TraderJoeVault.json'); const sdk = require("@defillama/sdk") -const UniswapV2PairContractAbi = require('./abis/UniswapV2Pair.json'); const ZERO = new BigNumber(0); @@ -16,21 +14,19 @@ const fromWei = (v) => { }; const getVautsTvl = async (vaults, getPrice) => { - const vaultsMap = await Promise.all(vaults.map((item) => { - return new Promise(async (resolve) => { - const { vault, chain } = item - let { output: underlyingBalanceWithInvestment } = await sdk.api.abi.call({ - chain, - target: vault, - abi: vaultABI.find(i => i.name === 'underlyingBalanceWithInvestment') - }) + const vaultsMap = await Promise.all(vaults.map(async (item) => { + const { vault, chain } = item + let { output: underlyingBalanceWithInvestment } = await sdk.api.abi.call({ + chain, + target: vault, + abi: 'uint256:underlyingBalanceWithInvestment' + }) - underlyingBalanceWithInvestment = new BigNumber(underlyingBalanceWithInvestment); + underlyingBalanceWithInvestment = new BigNumber(underlyingBalanceWithInvestment); - const usd = await getPrice(item); + const usd = await getPrice(item); - resolve(usd.multipliedBy(underlyingBalanceWithInvestment)); - }) + return usd.multipliedBy(underlyingBalanceWithInvestment) })); return toUSDTBalances(vaultsMap.reduce((acc, item) => acc.plus(item), new BigNumber(ZERO))); } @@ -50,7 +46,7 @@ const formatDecimal = (value, decimal = 18, numPoint = 4, precision = 2) => { const getReserves = async (pairAddress) => { const { output: { _reserve0, _reserve1, _blockTimestampLast } } = await sdk.api.abi.call({ target: pairAddress, - abi: UniswapV2PairContractAbi.find(i => i.name === 'getReserves') + abi: 'function getReserves() view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast)' }) return { reserve0: _reserve0, reserve1: _reserve1, blockTimestampLast: _blockTimestampLast }; }; @@ -63,7 +59,7 @@ const getTotalSupplyOf = async (contract, chain) => { const getBalanceOf = async (account, contract) => { const { output } = await sdk.api.erc20.balanceOf({ target: contract, owner: account, }) - return new BigNumber(output); + return new BigNumber(output); }; module.exports = { diff --git a/projects/helper/balancer.js b/projects/helper/balancer.js index 6b1250e6b69..e673c9385a5 100644 --- a/projects/helper/balancer.js +++ b/projects/helper/balancer.js @@ -1,32 +1,55 @@ -const { request, gql } = require("graphql-request"); -const { getBlock } = require("../helper/getBlock"); -const { toUSDTBalances } = require("../helper/balances"); +const { sumTokens2 } = require('./unwrapLPs'); +const { getLogs } = require('./cache/getLogs') -const graphQuery = gql` -query get_tvl($block: Int) { - balancers( - first: 5, - block: { number: $block } - ) { - totalLiquidity, - } +function onChainTvl(vault, fromBlock, { blacklistedTokens = [], preLogTokens = [] } = {}) { + return async (_, _1, _2, { api }) => { + const logs = await getLogs({ + api, + target: vault, + topics: ['0x3c13bc30b8e878c53fd2a36b679409c073afd75950be43d8858768e956fbc20e'], + fromBlock, + eventAbi: 'event PoolRegistered(bytes32 indexed poolId, address indexed poolAddress, uint8 specialization)', + onlyArgs: true, + extraKey: 'PoolRegistered', + }) + const logs2 = await getLogs({ + api, + target: vault, + topics: ['0xf5847d3f2197b16cdcd2098ec95d0905cd1abdaf415f07bb7cef2bba8ac5dec4'], + fromBlock, + eventAbi: 'event TokensRegistered(bytes32 indexed poolId, address[] tokens, address[] assetManagers)', + onlyArgs: true, + extraKey: 'TokensRegistered', + }) + + const tokens = logs2.map(i => i.tokens).flat() + tokens.push(...preLogTokens) + const pools = logs.map(i => i.poolAddress) + blacklistedTokens = [...blacklistedTokens, ...pools] + + return sumTokens2({ api, owner: vault, tokens, blacklistedTokens, }) + } } -`; -function getBalancerSubgraphTvl(graphUrl, chain) { - return async (timestamp, ethereumBlock, chainBlocks) => { - const block = await getBlock(timestamp, chain, chainBlocks) - const { balancers } = await request( - graphUrl, - graphQuery, - { - block - } - ); - return toUSDTBalances(balancers[0].totalLiquidity) - } +function v1Tvl(bPoolFactory, fromBlock, { blacklistedTokens = [] } = {}) { + return async (_, _1, _2, { api }) => { + let poolLogs = await getLogs({ + target: bPoolFactory, + topic: 'LOG_NEW_POOL(address,address)', + fromBlock, + api, + eventAbi: 'event LOG_NEW_POOL (address indexed caller, address indexed pool)', + onlyArgs: true, + }) + + const pools = poolLogs.map(i => i.pool) + const tokens = await api.multiCall({ abi: "address[]:getCurrentTokens", calls: pools }) + const ownerTokens = tokens.map((v, i) => [v, pools[i]]) + return sumTokens2({ api, ownerTokens, blacklistedTokens: [...blacklistedTokens, ...pools,] }) + } } module.exports = { - getBalancerSubgraphTvl -}; \ No newline at end of file + onChainTvl, + v1Tvl, +}; diff --git a/projects/helper/balances.js b/projects/helper/balances.js index 3f3b60d07b0..3e51e086769 100644 --- a/projects/helper/balances.js +++ b/projects/helper/balances.js @@ -1,6 +1,7 @@ +const ADDRESSES = require('./coreAssets.json') const BigNumber = require("bignumber.js"); -const usdtAddress = "0xdac17f958d2ee523a2206206994597c13d831ec7"; +const usdtAddress = ADDRESSES.ethereum.USDT; const toUSDT = (value, times = 1e6) => BigNumber(value).times(times).toFixed(0); diff --git a/projects/helper/cache.js b/projects/helper/cache.js index a5c51c56d2c..7ce6fc4d554 100644 --- a/projects/helper/cache.js +++ b/projects/helper/cache.js @@ -1,403 +1,114 @@ -const path = require('path') -const fs = require('fs') -const sdk = require('@defillama/sdk'); -const { default: BigNumber } = require('bignumber.js') - - -const symbol = require('./abis/symbol.json') -const token0 = require('./abis/token0.json'); -const token1 = require('./abis/token1.json'); -const kslpABI = require('./abis/kslp.js'); -const getReserves = require('./abis/getReserves.json'); - -const { getChainTransform, stripTokenHeader, getFixBalances, getFixBalancesSync, } = require('./portedTokens') -const { requery, } = require('./getUsdUniTvl') -const { getCoreAssets } = require('./tokenMapping') -const { sumTokens2, nullAddress, } = require('./unwrapLPs') -const { isLP, getUniqueAddresses, DEBUG_MODE, sliceIntoChunks, sleep, log } = require('./utils') - -const cacheFolder = process.env.CACHE_FOLDER || path.join(__dirname + '../../../../cache') - -function getCache(project, chain) { - const file = path.join(cacheFolder, `${project}-${chain}.json`) - if (fs.existsSync(file)) - return JSON.parse(fs.readFileSync(file)) - return {} +const aws = require('aws-sdk') +const sdk = require('@defillama/sdk') +const Bucket = "tvl-adapter-cache"; +const axios = require('axios') +const graphql = require('./utils/graphql') + +function getKey(project, chain) { + return `cache/${project}/${chain}.json` } -function setCache(project, chain, cache) { - const file = path.join(cacheFolder, `${project}-${chain}.json`) - fs.writeFileSync(file, JSON.stringify(cache)) +function getLink(project, chain) { + return `https://${Bucket}.s3.eu-central-1.amazonaws.com/${getKey(project, chain)}` } +async function getCache(project, chain, { _ } = {}) { + const Key = getKey(project, chain) -async function vestingHelper({ - coreAssets = [], owner, tokens, chain = 'ethereum', block, restrictTokenRatio, blacklist = [], skipConversion = false, onlyLPs, minLPRatio, - log_coreAssetPrices = [], log_minTokenValue = 1e6, useDefaultCoreAssets = false, cache = {}, -}) { - if (!coreAssets.length && useDefaultCoreAssets) - coreAssets = getCoreAssets(chain) - - tokens = getUniqueAddresses(tokens) - blacklist = getUniqueAddresses(blacklist) - tokens = tokens.filter(t => !blacklist.includes(t)) - const chunks = sliceIntoChunks(tokens, 4000) - const finalBalances = {} - for (let i = 0; i < chunks.length; i++) { - log('resolving for %s/%s of total tokens: %s (chain: %s)', i + 1, chunks.length, tokens.length, chain) - let lps = await getLPList({ lps: chunks[i], chain, block, cache }) // we count only LP tokens for vesting protocols - const balances = await sumTokens2({ chain, block, owner, tokens: lps }) - const lpBalances = {} - Object.entries(balances).forEach(([token, bal]) => { - if (bal && bal !== 0) - lpBalances[stripTokenHeader(token)] = bal - else - delete balances[token] - }) - lps = lps.filter(lp => lpBalances[lp]) // we only care about LPs that are still locked in the protocol, we can ignore withdrawn LPs - const { updateBalances } = await getTokenPrices({ cache, coreAssets, lps, allLps: true, chain, block, restrictTokenRatio, blacklist, log_coreAssetPrices, log_minTokenValue, minLPRatio }) - await updateBalances(balances, { skipConversion, onlyLPs }) - Object.entries(balances).forEach(([token, bal]) => sdk.util.sumSingleBalance(finalBalances, token, bal)) - if (i > 3 && i % 2 === 0) await sleep(1000) + try { + const { data: json } = await axios.get(getLink(project, chain)) + return json + } catch (e) { + sdk.log('failed to fetch data from s3 bucket:', Key) + // sdk.log(e) + return {} } - const fixBalances = getFixBalancesSync(chain) - fixBalances(finalBalances) - return finalBalances } -async function getLPList({ lps, chain, block, lpFilter = isLP, cache, }) { - if (!cache.symbol) cache.symbol = {} - lps = lps.filter(i => i) - const callArgs = lps.filter(i => !cache.symbol[i]).map(t => ({ target: t })); - (await sdk.api.abi.multiCall({ calls: callArgs, abi: symbol, block, chain })).output - .forEach(i => cache.symbol[i.input.target] = i.output) - return lps.filter(i => lpFilter(cache.symbol[i], i, chain)) -} - - -async function getTokenPrices({ - block, - chain = 'ethereum', - abis = {}, // if some protocol uses custom abi instead of standard one - useDefaultCoreAssets = false, // use pre-defined list - coreAssets = [], // list of tokens that can used as base token to price unknown tokens against (Note: order matters, is there are two LPs for a token, the core asset with a lower index is used) - blacklist = [], // list of tokens to ignore/blacklist - whitelist = [], // if set, tvl/price is computed only for these tokens - lps = [], // list of token addresses (all need not be LPs, code checks and filters out non LPs) - transformAddress, // function for transforming token address to coingecko friendly format - allLps = false, // if set true, assumes all tokens provided as lps are lps and skips validation/filtering - minLPRatio = 0.5, // if a token pool has less that this percent of core asset tokens compared to a token pool with max tokens for a given core asset, this token pool is not used for price calculation - restrictTokenRatio = 10, // while computing tvl, an unknown token value can max be x times the pool value, default 100 times pool value - log_coreAssetPrices = [], - log_minTokenValue = 1e6, // log only if token value is higer than this value, now minimum is set as 1 million - lpFilter, // override the default logic for checking if an address is LP based on it's symbol - cache = {}, -}) { - if (!cache.pairData) cache.pairData = {} - let counter = 0 - if (!transformAddress) - transformAddress = await getChainTransform(chain) - - if (!coreAssets.length && useDefaultCoreAssets) - coreAssets = getCoreAssets(chain) - - coreAssets = coreAssets.map(i => i.toLowerCase()) - blacklist = blacklist.map(i => i.toLowerCase()) - whitelist = whitelist.map(i => i.toLowerCase()) - lps = getUniqueAddresses(lps) - const pairAddresses = allLps ? lps : await getLPList({ lps, chain, block, lpFilter, cache }) - const toCall = (pairAddress) => ({ target: pairAddress, }) - const pairCalls = pairAddresses.map(toCall) - const pairs = cache.pairData; - const token0Calls = pairAddresses.filter(i => !pairs[i] || !pairs[i].token0Address).map(toCall) - const token1Calls = pairAddresses.filter(i => !pairs[i] || !pairs[i].token1Address).map(toCall) - - - let token0Addresses, token1Addresses, reserves - - [token0Addresses, token1Addresses, reserves] = await Promise.all([ - sdk.api.abi.multiCall({ abi: abis.token0ABI || token0, chain, calls: token0Calls, block, }).then(({ output }) => output), - sdk.api.abi.multiCall({ abi: abis.token1ABI || token1, chain, calls: token1Calls, block, }).then(({ output }) => output), - sdk.api.abi.multiCall({ abi: abis.getReservesABI || getReserves, chain, calls: pairCalls, block, }).then(({ output }) => output), - ]); - await requery(token0Addresses, chain, block, token0); - await requery(token1Addresses, chain, block, token1); - await requery(reserves, chain, block, getReserves); - - - // add token0Addresses - token0Addresses.forEach((token0Address) => { - const tokenAddress = token0Address.output.toLowerCase(); - - const pairAddress = token0Address.input.target.toLowerCase(); - pairs[pairAddress] = { - ...(pairs[pairAddress] || {}), - token0Address: tokenAddress, - } - }); - - // add token1Addresses - token1Addresses.forEach((token1Address) => { - const tokenAddress = token1Address.output.toLowerCase(); - const pairAddress = token1Address.input.target.toLowerCase(); - pairs[pairAddress] = { - ...(pairs[pairAddress] || {}), - token1Address: tokenAddress, - } - }); - - const prices = {} - const pairBalances = {} - - for (let i = 0; i < reserves.length; i++) { - const pairAddress = reserves[i].input.target.toLowerCase(); - const pair = pairs[pairAddress]; - pairBalances[pairAddress] = {} - const token0Address = pair.token0Address.toLowerCase() - const token1Address = pair.token1Address.toLowerCase() - const reserveAmounts = reserves[i].output - if (coreAssets.includes(token0Address) && coreAssets.includes(token1Address)) { - sdk.util.sumSingleBalance(pairBalances[pairAddress], token0Address, Number(reserveAmounts[0])) - sdk.util.sumSingleBalance(pairBalances[pairAddress], token1Address, Number(reserveAmounts[1])) - } else if (coreAssets.includes(token0Address)) { - sdk.util.sumSingleBalance(pairBalances[pairAddress], token0Address, Number(reserveAmounts[0]) * 2) - if (!blacklist.includes(token1Address) && (!whitelist.length || whitelist.includes(token1Address))) { - setPrice(prices, token1Address, reserveAmounts[0], reserveAmounts[1], token0Address) - } - } else if (coreAssets.includes(token1Address)) { - if (!reserveAmounts) log('missing reserves', pairAddress) - sdk.util.sumSingleBalance(pairBalances[pairAddress], token1Address, Number(reserveAmounts[1]) * 2) - if (!blacklist.includes(token0Address) && (!whitelist.length || whitelist.includes(token0Address))) { - setPrice(prices, token0Address, reserveAmounts[1], reserveAmounts[0], token1Address) - } - } else { - const isWhitelistedToken0 = !blacklist.includes(token0Address) - const isWhitelistedToken1 = !blacklist.includes(token1Address) - if (isWhitelistedToken0 && isWhitelistedToken1) { - sdk.util.sumSingleBalance(pairBalances[pairAddress], token0Address, Number(reserveAmounts[0])) - sdk.util.sumSingleBalance(pairBalances[pairAddress], token1Address, Number(reserveAmounts[1])) - } else if (isWhitelistedToken0) { - sdk.util.sumSingleBalance(pairBalances[pairAddress], token0Address, Number(reserveAmounts[0]) * 2) - } else if (isWhitelistedToken1) { - sdk.util.sumSingleBalance(pairBalances[pairAddress], token1Address, Number(reserveAmounts[1]) * 2) - } - } - } - - // set price of tokens that are not directly paired against core assets but with tokens that are paired against core tokens - - for (let i = 0; i < reserves.length; i++) { - const pairAddress = reserves[i].input.target.toLowerCase(); - const pair = pairs[pairAddress]; - const token0Address = pair.token0Address.toLowerCase() - const token1Address = pair.token1Address.toLowerCase() - const reserveAmounts = reserves[i].output - if ((coreAssets.includes(token0Address) && coreAssets.includes(token1Address)) - || coreAssets.includes(token0Address) - || coreAssets.includes(token1Address) - ) { // ignore these cases as tokens are already taken care of here - } else { - const isWhitelistedToken0 = !blacklist.includes(token0Address) - const isWhitelistedToken1 = !blacklist.includes(token1Address) - if (isWhitelistedToken0 && prices[token0Address] && !prices[token1Address]) { - pairBalances[pairAddress] = {} - const [coreTokenAmountInLP, tokenPrice, coreAsset,] = prices[token0Address] - const newCoreAmount = coreTokenAmountInLP * tokenPrice / 10 // we are diluting the amount of core tokens intentionally - const newTokenAmount = reserveAmounts[1] / 10 // also divided by 10 to keep price steady - // setPrice(prices, token1Address, newCoreAmount, newTokenAmount, coreAsset) - sdk.util.sumSingleBalance(pairBalances[pairAddress], token0Address, Number(reserveAmounts[0]) * 2) - } else if (isWhitelistedToken1 && prices[token1Address] && !prices[token0Address]) { - pairBalances[pairAddress] = {} - const [coreTokenAmountInLP, tokenPrice, coreAsset,] = prices[token1Address] - const newCoreAmount = coreTokenAmountInLP * tokenPrice / 10 // we are diluting the amount of core tokens intentionally - const newTokenAmount = reserveAmounts[0] / 10 // also divided by 10 to keep price steady - // setPrice(prices, token0Address, newCoreAmount, newTokenAmount, coreAsset) - sdk.util.sumSingleBalance(pairBalances[pairAddress], token1Address, Number(reserveAmounts[1]) * 2) - } - } - } - - if (!lpFilter && customLPHandlers[chain]) { // we want to handle custom LPs but dont want to end up in recorsive loop, hence this check - for (const customOptions of Object.values(customLPHandlers[chain])) { - const options = { ...arguments[0], ...customOptions } - const { prices: customPrices, pairBalances: customPairBalances, pairs: customPairs } = await getTokenPrices(options) - // add custom LP data to existing data - Object.entries(customPairs).forEach(([key, value]) => pairs[key] = value) - Object.entries(customPrices).forEach(([key, value]) => prices[key] = value) - Object.entries(customPairBalances).forEach(([key, value]) => pairBalances[key] = value) - } - } - - filterPrices(prices) - const balances = {} - Object.keys(pairBalances).forEach(key => addBalances(pairBalances[key], balances, { pairAddress: key })) - const fixBalances = getFixBalancesSync(chain) - fixBalances(balances) +async function setCache(project, chain, cache, { + ContentType = 'application/json', + ACL = 'public-read' +} = {}) { - return { - pairs, - updateBalances, - pairBalances, - prices, - balances, - } + const Key = getKey(project, chain) - function setPrice(prices, address, coreAmount, tokenAmount, coreAsset) { - if (prices[address] !== undefined) { - const currentCoreAmount = prices[address][0] - const currentCoreAsset = prices[address][2] - // core asset higher on the list has higher preference - if (coreAssets.indexOf(currentCoreAmount) < coreAssets.indexOf(coreAsset)) return; - if ((currentCoreAsset === coreAsset) && coreAmount < currentCoreAmount) return; - } - if (Number(tokenAmount) > 0) - prices[address] = [Number(coreAmount), Number(coreAmount) / Number(tokenAmount), coreAsset, +Number(tokenAmount)] - } + try { + await new aws.S3() + .upload({ + Bucket, Key, + Body: JSON.stringify(cache), + ACL, ContentType, + }).promise(); - function getAssetPrice(asset) { - const assetIndex = coreAssets.indexOf(asset.toLowerCase()) - if (assetIndex === -1 || !log_coreAssetPrices[assetIndex]) return 1 / 1e18 - return log_coreAssetPrices[assetIndex] + } catch (e) { + sdk.log('failed to write data to s3 bucket: ', Key) + // sdk.log(e) } +} - async function updateBalances(balances, { resolveLP = true, skipConversion = false, onlyLPs = false, } = {}) { - let lpAddresses = [] // if some of the tokens in balances are LP tokens, we resolve those as well - log('---updating balances-----') - const finalBalances = onlyLPs ? {} : balances - counter = 0 - Object.entries(balances).forEach(([address, amount = 0]) => { - const token = stripTokenHeader(address) - const price = prices[token]; - if (pairBalances[token]) { - lpAddresses.push(token) - return; - } - if (!price || skipConversion) return; - let tokenAmount = price[1] * +amount - const coreAsset = price[2] - const tokensInLP = price[3] - const coreTokenAmountInLP = price[0] - const maxAllowedAmount = coreTokenAmountInLP * restrictTokenRatio - // if (DEBUG_MODE && tokenAmount * getAssetPrice(coreAsset) > log_minTokenValue) - // log(`[converting balances] token vaule (in millions): ${(tokenAmount * getAssetPrice(coreAsset) / 1e6).toFixed(4)}, token value higher than pool: ${+amount > +tokensInLP} token: ${token} counter: ${++counter}`) - - if (tokenAmount > maxAllowedAmount) {// use token amount in pool if balances amount is higher than amount in pool - log(`[converting balances] Value to LP ratio: ${tokenAmount / tokensInLP} token: ${token} counter: ${++counter}`) - sdk.util.sumSingleBalance(balances, transformAddress(coreAsset), BigNumber(maxAllowedAmount).toFixed(0)) - balances[address] = BigNumber((tokenAmount - maxAllowedAmount) / price[1]).toFixed(0) - } else { - sdk.util.sumSingleBalance(balances, transformAddress(coreAsset), BigNumber(tokenAmount).toFixed(0)) - delete balances[address] - } - }) - - if (!resolveLP) { - fixBalances(balances) - return balances - } - - if (lpAddresses.length) { - const totalBalances = (await sdk.api.abi.multiCall({ - abi: 'erc20:totalSupply', calls: lpAddresses.map(i => ({ target: i })), block, chain - })).output - - totalBalances.forEach((item) => { - const token = item.input.target - const address = transformAddress(token) - const ratio = +item.output > 0 ? (+(balances[address]) || 0) / +item.output : 0 - addBalances(pairBalances[token], finalBalances, { ratio, pairAddress: token, skipConversion, }) - delete balances[address] - }) +const configCache = {} + +async function getConfig(project, endpoint) { + if (!project || !endpoint) throw new Error('Missing parameters') + const key = 'config-cache' + const cacheKey = getKey(key, project) + if (!configCache[cacheKey]) configCache[cacheKey] = _getConfig() + return configCache[cacheKey] + + async function _getConfig() { + try { + const { data: json } = await axios.get(endpoint) + await setCache(key, project, json) + return json + } catch (e) { + // sdk.log(e) + sdk.log(project, 'tryng to fetch from cache, failed to fetch data from endpoint:', endpoint) + return getCache(key, project) } - - fixBalances(finalBalances) - return finalBalances } +} - function addBalances(balances, finalBalances, { skipConversion = false, pairAddress, ratio = 1 }) { - if (ratio > 1) { - console.log(`There is bug in the code. Pair address: ${pairAddress}, ratio: ${ratio}`) - ratio = 1 +async function configPost(project, endpoint, data) { + if (!project || !endpoint) throw new Error('Missing parameters') + const key = 'config-cache' + const cacheKey = getKey(key, project) + if (!configCache[cacheKey]) configCache[cacheKey] = _configPost() + return configCache[cacheKey] + + async function _configPost() { + try { + const { data: json } = await axios.post(endpoint, data) + await setCache(key, project, json) + return json + } catch (e) { + // sdk.log(e) + sdk.log(project, 'tryng to fetch from cache, failed to fetch data from endpoint:', endpoint) + return getCache(key, project) } - Object.entries(balances).forEach(([address, amount = 0]) => { - const price = prices[address]; - // const price = undefined; // NOTE: this is disabled till, we add a safeguard to limit LP manipulation to inflate token price, like mimimum core asset liquidity to be 10k - if (price && !skipConversion) { - const coreTokenAmountInLP = price[0] - const coreAsset = price[2] - const tokensInLP = price[3] - let tokenAmount = price[1] * +amount - const maxAllowedAmount = coreTokenAmountInLP * restrictTokenRatio - // if (DEBUG_MODE && tokenAmount * getAssetPrice(coreAsset) * ratio > log_minTokenValue) - // console.log(`[resolve LP balance] token vaule (in millions): ${(tokenAmount * getAssetPrice(coreAsset) * ratio / 1e6).toFixed(4)}, token value higher than pool: ${+amount > +tokensInLP} LP Address: ${pairAddress} token: ${address} ratio: ${ratio} counter: ${++counter}`) - - if (tokenAmount > maxAllowedAmount) {// use token amount in pool if balances amount is higher than amount in pool - log(`[converting balances] Value to LP ratio: ${tokenAmount / tokensInLP} LP Address: ${pairAddress} ratio: ${ratio} token: ${address} counter: ${++counter}`) - sdk.util.sumSingleBalance(balances, transformAddress(coreAsset), BigNumber(maxAllowedAmount * ratio).toFixed(0)) - } else { - sdk.util.sumSingleBalance(balances, transformAddress(coreAsset), BigNumber(tokenAmount * ratio).toFixed(0)) - } - } else { - if ((DEBUG_MODE && coreAssets.includes(address)) && (+amount * getAssetPrice(address) * ratio > log_minTokenValue)) - console.log(`[resolve LP balance] token vaule (in millions): ${(+amount * getAssetPrice(address) * ratio / 1e6).toFixed(4)}, LP Address: ${pairAddress} core token: ${address} ratio: ${ratio} counter: ${++counter}`) - sdk.util.sumSingleBalance(finalBalances, transformAddress(address), BigNumber(+amount * ratio).toFixed(0)) - } - }) - } - - // If we fetch prices from pools with low liquidity, the value of tokens can be absurdly high, so we set a threshold that if we are using a core asset to determine price, - // the amount of said core asset in a pool from which price is fetched must be at least 0.5% of the amount of core asset tokens in pool with highest core asset tokens - function filterPrices(prices) { - const maxCoreTokens = {} - Object.values(prices).forEach(([amount, _, coreAsset]) => { - if (!maxCoreTokens[coreAsset] || maxCoreTokens[coreAsset] < +amount) - maxCoreTokens[coreAsset] = +amount - }) - - Object.keys(prices).forEach(token => { - const priceArry = prices[token] - const [amount, _, coreAsset] = priceArry - if (!maxCoreTokens[coreAsset]) throw new Error('there is bug in the code') - const lpRatio = +amount * 100 / maxCoreTokens[coreAsset] - if (lpRatio < minLPRatio) delete prices[token] // current pool has less than 0.5% of tokens compared to pool with highest number of core tokens - }) } } -async function sumUnknownTokens({ tokensAndOwners = [], - coreAssets = [], owner, tokens, chain = 'ethereum', block, restrictTokenRatio, blacklist = [], skipConversion = false, onlyLPs, minLPRatio, - log_coreAssetPrices = [], log_minTokenValue = 1e6, owners = [], lps = [], useDefaultCoreAssets = false, cache = {}, -}) { - if (!coreAssets.length && useDefaultCoreAssets) - coreAssets = getCoreAssets(chain) - blacklist = getUniqueAddresses(blacklist) - if (!tokensAndOwners.length) - if (owners.length) - tokensAndOwners = owners.map(o => tokens.map(t => [t, o])).flat() - else if (owner) - tokensAndOwners = tokens.map(t => [t, owner]) - tokensAndOwners = tokensAndOwners.filter(t => !blacklist.includes(t[0])) - const balances = await sumTokens2({ chain, block, tokensAndOwners, skipFixBalances: true, }) - const { updateBalances, } = await getTokenPrices({ cache, coreAssets, lps: [...tokensAndOwners.map(t => t[0]), ...lps,], chain, block, restrictTokenRatio, blacklist, log_coreAssetPrices, log_minTokenValue, minLPRatio }) - await updateBalances(balances, { skipConversion, onlyLPs }) - const fixBalances = await getFixBalances(chain) - fixBalances(balances) - return balances -} -const customLPHandlers = { - klaytn: { - kslp: { - lpFilter: (symbol, addr, chain) => chain === 'klaytn' && symbol === 'KSLP', - abis: { - getReservesABI: kslpABI.getCurrentPool, - token0ABI: kslpABI.tokenA, - token1ABI: kslpABI.tokenB, - }, +async function cachedGraphQuery(project, endpoint, query, { variables } = {}) { + if (!project || !endpoint) throw new Error('Missing parameters') + const key = 'config-cache' + const cacheKey = getKey(key, project) + if (!configCache[cacheKey]) configCache[cacheKey] = _cachedGraphQuery() + return configCache[cacheKey] + + async function _cachedGraphQuery() { + try { + const json = await graphql.request(endpoint, query, { variables }) + await setCache(key, project, json) + return json + } catch (e) { + // sdk.log(e) + sdk.log(project, 'tryng to fetch from cache, failed to fetch data from endpoint:', endpoint) + return getCache(key, project) } } } module.exports = { - getCache, setCache, vestingHelper, getTokenPrices, sumUnknownTokens, + getCache, setCache, getConfig, configPost, cachedGraphQuery, } \ No newline at end of file diff --git a/projects/helper/cache/compound.js b/projects/helper/cache/compound.js new file mode 100644 index 00000000000..e02d048fef4 --- /dev/null +++ b/projects/helper/cache/compound.js @@ -0,0 +1,74 @@ + +const sdk = require('@defillama/sdk'); +const abi = require('../abis/compound.json'); +const { nullAddress, unwrapLPsAuto } = require('../unwrapLPs'); +const { requery } = require("../requery"); +const { getCache, setCache } = require("../cache"); +const { getChainTransform, getFixBalancesSync, } = require('../portedTokens'); +const { usdtAddress } = require('../balances'); +const agoraAbi = require("../../agora/abi.json"); + +const project = 'compound' +const getKey = (chain, addr) => `${chain}/${addr}` + +function compoundExports(comptroller, { blacklistedTokens = [], resolveLps = false, transformAdress, abis = {}} = {}) { + let response + abis = { ...abi, ...abis } + + async function _getCompoundV2Tvl(api) { + if (!response) response = _internal() + return response + + async function _internal() { + const balances = { + tvl: {}, + borrowed: {}, + } + const chain = api.chain ?? 'ethereum' + blacklistedTokens = blacklistedTokens.map(i => i.toLowerCase()) + if (!transformAdress) transformAdress = await getChainTransform(chain) + const fixBalances = getFixBalancesSync(chain) + + let markets = await api.call({ + target: comptroller, + abi: abis.getAllMarkets, + }) + + let underlying = await api.multiCall({ + abi: abis.underlying, + calls: markets, + }) + let borrowed = await api.multiCall({ + abi: abis.totalBorrows, + calls: markets, + }) + let values = await api.multiCall({ + abi: abis.getCash, + calls: markets, + }) + underlying = underlying.map((token, i) => { + if (!token || token === '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee') token = nullAddress + token = transformAdress(token) + sdk.util.sumSingleBalance(balances.tvl,token,values[i]) + sdk.util.sumSingleBalance(balances.borrowed,token,borrowed[i]) + }) + + balances.tvl = fixBalances(balances.tvl) + balances.borrowed = fixBalances(balances.borrowed) + + return balances + } + } + + return { + tvl: async (_, _1, _2, { api }) => (await _getCompoundV2Tvl(api)).tvl, + borrowed: async (_, _1, _2, { api }) => (await _getCompoundV2Tvl(api)).borrowed, + } +} + + +module.exports = { + compoundExports, +}; + + diff --git a/projects/helper/cache/getLogs.js b/projects/helper/cache/getLogs.js new file mode 100644 index 00000000000..59451142503 --- /dev/null +++ b/projects/helper/cache/getLogs.js @@ -0,0 +1,100 @@ + +const { getCache, setCache, } = require('../cache'); +const sdk = require('@defillama/sdk') +const ethers = require("ethers") + +const cacheFolder = 'logs' + +async function getLogs({ target, + topic, keys = [], fromBlock, toBlock, topics, + api, eventAbi, onlyArgs = false, extraKey, skipCache = false, }) { + if (!api) throw new Error('Missing sdk api object!') + if (!target) throw new Error('Missing target!') + if (!fromBlock) throw new Error('Missing fromBlock!') + await api.getBlock() + const block = api.block + const chain = api.chain ?? 'ethereum' + if (!toBlock) toBlock = block + if (!toBlock) throw new Error('Missing fromBlock!') + + let iface + + if (eventAbi) { + iface = new ethers.utils.Interface([eventAbi]) + if (typeof eventAbi === 'object') + sdk.log(iface.format(ethers.utils.FormatTypes.full)) + } + + target = target.toLowerCase() + const key = extraKey ? `${chain}/${target}-${extraKey}` : `${chain}/${target}` + + let cache = await _getCache(key) + let response + + // if no new data nees to be fetched + if (cache.fromBlock && cache.toBlock > toBlock) + response = cache.logs.filter(i => i.blockNumber < toBlock && i.blockNumber >= fromBlock) + else + response = await fetchLogs() + + if (!eventAbi) return response + + return response.map((log) => { + const res = iface.parseLog(log) + if (onlyArgs) return res.args + res.topics = log.topics.map(i => `0x${i.slice(26)}`) + return res + }) + + async function fetchLogs() { + cache.fromBlock = fromBlock + fromBlock = cache.toBlock ?? fromBlock + + const logs = (await sdk.api.util.getLogs({ + chain, target, topic, keys, topics, fromBlock, toBlock, + })).output + + cache.logs.push(...logs) + cache.toBlock = toBlock + + const logIndices = new Set() + + // remove possible duplicates + cache.logs = cache.logs.filter(i => { + let key = i.transactionHash + i.logIndex + if (!i.hasOwnProperty('logIndex') || !i.hasOwnProperty('transactionHash')) { + sdk.log(i) + throw new Error('Missing crucial field') + } + if (logIndices.has(key)) return false + logIndices.add(key) + return true + }) + + if (!skipCache) + await setCache(cacheFolder, key, cache) + + return cache.logs + } + + async function _getCache(key) { + const defaultRes = { + logs: [] + } + + if (skipCache) return defaultRes + + let cache = await getCache(cacheFolder, key) + // set initial structure if it is missing / reset if from block is moved to something older + if (!cache.logs || fromBlock < cache.fromBlock) { + return defaultRes + } + + return cache + } +} + +module.exports = { + getLogs, + getAddress: s => "0x" + s.slice(26, 66), +} \ No newline at end of file diff --git a/projects/helper/cache/sumUnknownTokens.js b/projects/helper/cache/sumUnknownTokens.js new file mode 100644 index 00000000000..c7dae15a2fb --- /dev/null +++ b/projects/helper/cache/sumUnknownTokens.js @@ -0,0 +1,402 @@ +const sdk = require('@defillama/sdk'); +const { default: BigNumber } = require('bignumber.js') + +const symbol = 'string:symbol' +const token0 = 'address:token0' +const token1 = 'address:token1' +const kslpABI = require('../abis/kslp.js'); +const getReserves = 'function getReserves() view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast)' + +const { getChainTransform, stripTokenHeader, getFixBalances, getFixBalancesSync, } = require('../portedTokens') +const { getCoreAssets } = require('../tokenMapping') +const { sumTokens2, nullAddress, } = require('../unwrapLPs') +const { isLP, getUniqueAddresses, log } = require('../utils') + +async function getLPData({ + block, + chain = 'ethereum', + lps = [], // list of token addresses (all need not be LPs, code checks and filters out non LPs) + allLps = false, // if set true, assumes all tokens provided as lps are lps and skips validation/filtering + abis = {}, + lpFilter = isLP, +}) { + lps = getUniqueAddresses(lps) + const pairAddresses = allLps ? lps : await getLPList({ lps, chain, block, lpFilter, }) + const pairCalls = pairAddresses.map((pairAddress) => ({ target: pairAddress, })) + let token0Addresses, token1Addresses + + [token0Addresses, token1Addresses] = await Promise.all([ + sdk.api.abi.multiCall({ abi: abis.token0ABI || token0, chain, calls: pairCalls, block, }).then(({ output }) => output), + sdk.api.abi.multiCall({ abi: abis.token1ABI || token1, chain, calls: pairCalls, block, }).then(({ output }) => output), + ]); + const pairs = {}; + // add token0Addresses + token0Addresses.forEach((token0Address) => + pairs[token0Address.input.target] = { + token0Address: token0Address.output.toLowerCase(), + } + ) + token1Addresses.forEach((token1Address) => { + if (!pairs[token1Address.input.target]) pairs[token1Address.input.target] = {} + pairs[token1Address.input.target].token1Address = token1Address.output.toLowerCase() + }) + return pairs +} + +async function getLPList({ lps, chain, block, lpFilter = isLP, cache = {}, }) { + lps = lps.filter(i => i !== nullAddress) + if (!cache.symbol) cache.symbol = {} + lps = lps.filter(i => i) + const callArgs = lps.filter(i => !cache.symbol[i]).map(t => ({ target: t })); + (await sdk.api.abi.multiCall({ calls: callArgs, abi: symbol, block, chain, permitFailure: true, })).output + .forEach(i => cache.symbol[i.input.target] = i.output) + return lps.filter(i => lpFilter(cache.symbol[i], i, chain)) +} + +async function getTokenPrices({ + block, + chain = 'ethereum', + abis = {}, // if some protocol uses custom abi instead of standard one + useDefaultCoreAssets = false, // use pre-defined list + coreAssets = [], // list of tokens that can used as base token to price unknown tokens against (Note: order matters, is there are two LPs for a token, the core asset with a lower index is used) + blacklist = [], // list of tokens to ignore/blacklist + whitelist = [], // if set, tvl/price is computed only for these tokens + lps = [], // list of token addresses (all need not be LPs, code checks and filters out non LPs) + transformAddress, // function for transforming token address to coingecko friendly format + allLps = false, // if set true, assumes all tokens provided as lps are lps and skips validation/filtering + minLPRatio = 0.5, // if a token pool has less that this percent of core asset tokens compared to a token pool with max tokens for a given core asset, this token pool is not used for price calculation + restrictTokenRatio = 10, // while computing tvl, an unknown token value can max be x times the pool value, default 100 times pool value + log_coreAssetPrices = [], + log_minTokenValue = 1e6, // log only if token value is higer than this value, now minimum is set as 1 million + lpFilter, // override the default logic for checking if an address is LP based on it's symbol + token0CallFn, + token1CallFn, + reservesCallFn, + cache = {}, +}) { + const api = new sdk.ChainApi({ block, chain, }) + if (!cache.pairData) cache.pairData = {} + let counter = 0 + if (!transformAddress) + transformAddress = await getChainTransform(chain) + + if (!coreAssets.length && useDefaultCoreAssets) + coreAssets = getCoreAssets(chain) + + coreAssets = coreAssets.map(i => i.toLowerCase()) + blacklist = blacklist.map(i => i.toLowerCase()) + whitelist = whitelist.map(i => i.toLowerCase()) + lps = getUniqueAddresses(lps) + const pairAddresses = allLps ? lps : await getLPList({ lps, chain, block, lpFilter, cache }) + const toCall = (pairAddress) => ({ target: pairAddress, }) + const pairCalls = pairAddresses.map(toCall) + const pairs = cache.pairData; + const token0Calls = pairAddresses.filter(i => !pairs[i] || !pairs[i].token0Address).map(toCall) + const token1Calls = pairAddresses.filter(i => !pairs[i] || !pairs[i].token1Address).map(toCall) + + + let token0Addresses, token1Addresses, reserves + + if (token0CallFn) { + token0Addresses = token0CallFn({ chain, block, calls: token0Calls, api, }) + } else { + token0Addresses = api.multiCall({ abi: abis.token0ABI || token0, chain, calls: token0Calls, block, withMetadata: true, }) + } + + if (token1CallFn) { + token1Addresses = token1CallFn({ chain, block, calls: token1Calls, api }) + } else { + token1Addresses = api.multiCall({ abi: abis.token1ABI || token1, chain, calls: token1Calls, block, withMetadata: true, }) + } + + if (reservesCallFn) { + reserves = reservesCallFn({ chain, block, calls: pairCalls, api, }) + } else { + reserves = api.multiCall({ abi: abis.getReservesABI || getReserves, chain, calls: pairCalls, block, withMetadata: true, }) + } + + [token0Addresses, token1Addresses, reserves] = await Promise.all([token0Addresses, token1Addresses, reserves]); + + // add token0Addresses + token0Addresses.forEach((token0Address) => { + const tokenAddress = token0Address.output.toLowerCase(); + + const pairAddress = token0Address.input.target.toLowerCase(); + pairs[pairAddress] = { + ...(pairs[pairAddress] || {}), + token0Address: tokenAddress, + } + }); + + // add token1Addresses + token1Addresses.forEach((token1Address) => { + const tokenAddress = token1Address.output.toLowerCase(); + const pairAddress = token1Address.input.target.toLowerCase(); + pairs[pairAddress] = { + ...(pairs[pairAddress] || {}), + token1Address: tokenAddress, + } + }); + + const prices = {} + const pairBalances = {} + + for (let i = 0; i < reserves.length; i++) { + const pairAddress = reserves[i].input.target.toLowerCase(); + const pair = pairs[pairAddress]; + pairBalances[pairAddress] = {} + const token0Address = pair.token0Address.toLowerCase() + const token1Address = pair.token1Address.toLowerCase() + const reserveAmounts = reserves[i].output + if (coreAssets.includes(token0Address) && coreAssets.includes(token1Address)) { + sdk.util.sumSingleBalance(pairBalances[pairAddress], token0Address, Number(reserveAmounts[0])) + sdk.util.sumSingleBalance(pairBalances[pairAddress], token1Address, Number(reserveAmounts[1])) + } else if (coreAssets.includes(token0Address)) { + sdk.util.sumSingleBalance(pairBalances[pairAddress], token0Address, Number(reserveAmounts[0]) * 2) + if (!blacklist.includes(token1Address) && (!whitelist.length || whitelist.includes(token1Address))) { + setPrice(prices, token1Address, reserveAmounts[0], reserveAmounts[1], token0Address) + } + } else if (coreAssets.includes(token1Address)) { + if (!reserveAmounts) log('missing reserves', pairAddress) + sdk.util.sumSingleBalance(pairBalances[pairAddress], token1Address, Number(reserveAmounts[1]) * 2) + if (!blacklist.includes(token0Address) && (!whitelist.length || whitelist.includes(token0Address))) { + setPrice(prices, token0Address, reserveAmounts[1], reserveAmounts[0], token1Address) + } + } else { + const isWhitelistedToken0 = !blacklist.includes(token0Address) + const isWhitelistedToken1 = !blacklist.includes(token1Address) + if (isWhitelistedToken0 && isWhitelistedToken1) { + sdk.util.sumSingleBalance(pairBalances[pairAddress], token0Address, Number(reserveAmounts[0])) + sdk.util.sumSingleBalance(pairBalances[pairAddress], token1Address, Number(reserveAmounts[1])) + } else if (isWhitelistedToken0) { + sdk.util.sumSingleBalance(pairBalances[pairAddress], token0Address, Number(reserveAmounts[0]) * 2) + } else if (isWhitelistedToken1) { + sdk.util.sumSingleBalance(pairBalances[pairAddress], token1Address, Number(reserveAmounts[1]) * 2) + } + } + } + + // set price of tokens that are not directly paired against core assets but with tokens that are paired against core tokens + + for (let i = 0; i < reserves.length; i++) { + const pairAddress = reserves[i].input.target.toLowerCase(); + const pair = pairs[pairAddress]; + const token0Address = pair.token0Address.toLowerCase() + const token1Address = pair.token1Address.toLowerCase() + const reserveAmounts = reserves[i].output + if ((coreAssets.includes(token0Address) && coreAssets.includes(token1Address)) + || coreAssets.includes(token0Address) + || coreAssets.includes(token1Address) + ) { // ignore these cases as tokens are already taken care of here + } else { + const isWhitelistedToken0 = !blacklist.includes(token0Address) + const isWhitelistedToken1 = !blacklist.includes(token1Address) + if (isWhitelistedToken0 && prices[token0Address] && !prices[token1Address]) { + pairBalances[pairAddress] = {} + const [coreTokenAmountInLP, tokenPrice, coreAsset,] = prices[token0Address] + const newCoreAmount = coreTokenAmountInLP * tokenPrice / 10 // we are diluting the amount of core tokens intentionally + const newTokenAmount = reserveAmounts[1] / 10 // also divided by 10 to keep price steady + // setPrice(prices, token1Address, newCoreAmount, newTokenAmount, coreAsset) + sdk.util.sumSingleBalance(pairBalances[pairAddress], token0Address, Number(reserveAmounts[0]) * 2) + } else if (isWhitelistedToken1 && prices[token1Address] && !prices[token0Address]) { + pairBalances[pairAddress] = {} + const [coreTokenAmountInLP, tokenPrice, coreAsset,] = prices[token1Address] + const newCoreAmount = coreTokenAmountInLP * tokenPrice / 10 // we are diluting the amount of core tokens intentionally + const newTokenAmount = reserveAmounts[0] / 10 // also divided by 10 to keep price steady + // setPrice(prices, token0Address, newCoreAmount, newTokenAmount, coreAsset) + sdk.util.sumSingleBalance(pairBalances[pairAddress], token1Address, Number(reserveAmounts[1]) * 2) + } + } + } + + if (!lpFilter && customLPHandlers[chain]) { // we want to handle custom LPs but dont want to end up in recorsive loop, hence this check + for (const customOptions of Object.values(customLPHandlers[chain])) { + const options = { ...arguments[0], ...customOptions } + const { prices: customPrices, pairBalances: customPairBalances, pairs: customPairs } = await getTokenPrices(options) + // add custom LP data to existing data + Object.entries(customPairs).forEach(([key, value]) => pairs[key] = value) + Object.entries(customPrices).forEach(([key, value]) => prices[key] = value) + Object.entries(customPairBalances).forEach(([key, value]) => pairBalances[key] = value) + } + } + + filterPrices(prices) + const balances = {} + Object.keys(pairBalances).forEach(key => addBalances(pairBalances[key], balances, { pairAddress: key })) + const fixBalances = getFixBalancesSync(chain) + fixBalances(balances) + + return { + pairs, + updateBalances, + pairBalances, + prices, + balances, + } + + function setPrice(prices, address, coreAmount, tokenAmount, coreAsset) { + if (prices[address] !== undefined) { + const currentCoreAmount = prices[address][0] + const currentCoreAsset = prices[address][2] + // core asset higher on the list has higher preference + if (coreAssets.indexOf(currentCoreAmount) < coreAssets.indexOf(coreAsset)) return; + if ((currentCoreAsset === coreAsset) && coreAmount < currentCoreAmount) return; + } + if (Number(tokenAmount) > 0) + prices[address] = [Number(coreAmount), Number(coreAmount) / Number(tokenAmount), coreAsset, +Number(tokenAmount)] + } + + function getAssetPrice(asset) { + const assetIndex = coreAssets.indexOf(asset.toLowerCase()) + if (assetIndex === -1 || !log_coreAssetPrices[assetIndex]) return 1 / 1e18 + return log_coreAssetPrices[assetIndex] + } + + async function updateBalances(balances, { resolveLP = true, skipConversion = false, onlyLPs = false, } = {}) { + let lpAddresses = [] // if some of the tokens in balances are LP tokens, we resolve those as well + log('---updating balances-----') + const finalBalances = onlyLPs ? {} : balances + counter = 0 + Object.entries(balances).forEach(([address, amount = 0]) => { + const token = stripTokenHeader(address) + const price = prices[token]; + if (pairBalances[token]) { + lpAddresses.push(token) + return; + } + if (!price || skipConversion) return; + let tokenAmount = price[1] * +amount + const coreAsset = price[2] + const tokensInLP = price[3] + const coreTokenAmountInLP = price[0] + const maxAllowedAmount = coreTokenAmountInLP * restrictTokenRatio + // if (tokenAmount * getAssetPrice(coreAsset) > log_minTokenValue) + // sdk.log(`[converting balances] token vaule (in millions): ${(tokenAmount * getAssetPrice(coreAsset) / 1e6).toFixed(4)}, token value higher than pool: ${+amount > +tokensInLP} token: ${token} counter: ${++counter}`) + + if (tokenAmount > maxAllowedAmount) {// use token amount in pool if balances amount is higher than amount in pool + log(`[converting balances] Value to LP ratio: ${tokenAmount / tokensInLP} token: ${token} counter: ${++counter}`) + sdk.util.sumSingleBalance(balances, transformAddress(coreAsset), BigNumber(maxAllowedAmount).toFixed(0)) + balances[address] = BigNumber((tokenAmount - maxAllowedAmount) / price[1]).toFixed(0) + } else { + sdk.util.sumSingleBalance(balances, transformAddress(coreAsset), BigNumber(tokenAmount).toFixed(0)) + delete balances[address] + } + }) + + if (!resolveLP) { + fixBalances(balances) + return balances + } + + if (lpAddresses.length) { + const totalBalances = (await sdk.api.abi.multiCall({ + abi: 'erc20:totalSupply', calls: lpAddresses.map(i => ({ target: i })), block, chain + })).output + + totalBalances.forEach((item) => { + const token = item.input.target + const address = transformAddress(token) + const ratio = +item.output > 0 ? (+(balances[address]) || 0) / +item.output : 0 + addBalances(pairBalances[token], finalBalances, { ratio, pairAddress: token, skipConversion, }) + delete balances[address] + }) + } + + fixBalances(finalBalances) + return finalBalances + } + + function addBalances(balances, finalBalances, { skipConversion = false, pairAddress, ratio = 1 }) { + if (ratio > 1) { + console.log(`There is bug in the code. Pair address: ${pairAddress}, ratio: ${ratio}`) + ratio = 1 + } + Object.entries(balances).forEach(([address, amount = 0]) => { + const price = prices[address]; + // const price = undefined; // NOTE: this is disabled till, we add a safeguard to limit LP manipulation to inflate token price, like mimimum core asset liquidity to be 10k + if (price && !skipConversion) { + const coreTokenAmountInLP = price[0] + const coreAsset = price[2] + const tokensInLP = price[3] + let tokenAmount = price[1] * +amount + const maxAllowedAmount = coreTokenAmountInLP * restrictTokenRatio + // if (tokenAmount * getAssetPrice(coreAsset) * ratio > log_minTokenValue) + // sdk.log(`[resolve LP balance] token vaule (in millions): ${(tokenAmount * getAssetPrice(coreAsset) * ratio / 1e6).toFixed(4)}, token value higher than pool: ${+amount > +tokensInLP} LP Address: ${pairAddress} token: ${address} ratio: ${ratio} counter: ${++counter}`) + + if (tokenAmount > maxAllowedAmount) {// use token amount in pool if balances amount is higher than amount in pool + log(`[converting balances] Value to LP ratio: ${tokenAmount / tokensInLP} LP Address: ${pairAddress} ratio: ${ratio} token: ${address} counter: ${++counter}`) + sdk.util.sumSingleBalance(balances, transformAddress(coreAsset), BigNumber(maxAllowedAmount * ratio).toFixed(0)) + } else { + sdk.util.sumSingleBalance(balances, transformAddress(coreAsset), BigNumber(tokenAmount * ratio).toFixed(0)) + } + } else { + if ((coreAssets.includes(address)) && (+amount * getAssetPrice(address) * ratio > log_minTokenValue)) + sdk.log(`[resolve LP balance] token vaule (in millions): ${(+amount * getAssetPrice(address) * ratio / 1e6).toFixed(4)}, LP Address: ${pairAddress} core token: ${address} ratio: ${ratio} counter: ${++counter}`) + sdk.util.sumSingleBalance(finalBalances, transformAddress(address), BigNumber(+amount * ratio).toFixed(0)) + } + }) + } + + // If we fetch prices from pools with low liquidity, the value of tokens can be absurdly high, so we set a threshold that if we are using a core asset to determine price, + // the amount of said core asset in a pool from which price is fetched must be at least 0.5% of the amount of core asset tokens in pool with highest core asset tokens + function filterPrices(prices) { + const maxCoreTokens = {} + Object.values(prices).forEach(([amount, _, coreAsset]) => { + if (!maxCoreTokens[coreAsset] || maxCoreTokens[coreAsset] < +amount) + maxCoreTokens[coreAsset] = +amount + }) + + Object.keys(prices).forEach(token => { + const priceArry = prices[token] + const [amount, _, coreAsset] = priceArry + if (!maxCoreTokens[coreAsset]) throw new Error('there is bug in the code') + const lpRatio = +amount * 100 / maxCoreTokens[coreAsset] + if (lpRatio < minLPRatio) delete prices[token] // current pool has less than 0.5% of tokens compared to pool with highest number of core tokens + }) + } +} + +async function sumUnknownTokens({ api, tokensAndOwners = [], balances, + coreAssets = [], owner, tokens, chain = 'ethereum', block, restrictTokenRatio, blacklist = [], skipConversion = false, onlyLPs, minLPRatio, + log_coreAssetPrices = [], log_minTokenValue = 1e6, owners = [], lps = [], useDefaultCoreAssets = false, cache = {}, resolveLP = false, abis, +}) { + if (api) { + chain = api.chain ?? chain + block = api.block ?? block + if (!balances) balances = api.getBalances() + } else if (!balances) { + balances = {} + } + if (!coreAssets.length && useDefaultCoreAssets) + coreAssets = getCoreAssets(chain) + blacklist = getUniqueAddresses(blacklist) + if (!tokensAndOwners.length) + if (owners.length) + tokensAndOwners = owners.map(o => tokens.map(t => [t, o])).flat() + else if (owner) + tokensAndOwners = tokens.map(t => [t, owner]) + tokensAndOwners = tokensAndOwners.filter(t => !blacklist.includes(t[0])) + await sumTokens2({ api, balances, chain, block, tokensAndOwners, skipFixBalances: true, resolveLP, }) + const { updateBalances, } = await getTokenPrices({ cache, coreAssets, lps: [...tokensAndOwners.map(t => t[0]), ...lps,], chain, block, restrictTokenRatio, blacklist, log_coreAssetPrices, log_minTokenValue, minLPRatio, abis, }) + await updateBalances(balances, { skipConversion, onlyLPs }) + const fixBalances = await getFixBalances(chain) + fixBalances(balances) + return balances +} + +const customLPHandlers = { + klaytn: { + kslp: { + lpFilter: (symbol, addr, chain) => chain === 'klaytn' && symbol === 'KSLP', + abis: { + getReservesABI: kslpABI.getCurrentPool, + token0ABI: kslpABI.tokenA, + token1ABI: kslpABI.tokenB, + }, + } + } +} + +module.exports = { + getTokenPrices, sumUnknownTokens, getLPData, getLPList, +} \ No newline at end of file diff --git a/projects/helper/cache/uniswap.js b/projects/helper/cache/uniswap.js new file mode 100644 index 00000000000..933eda835e5 --- /dev/null +++ b/projects/helper/cache/uniswap.js @@ -0,0 +1,160 @@ + +const uniswapAbi = require('../abis/uniswap') +const { getCache, setCache, } = require('../cache'); +const { transformBalances, transformDexBalances, } = require('../portedTokens') +const { getCoreAssets, normalizeAddress, } = require('../tokenMapping') +const { sliceIntoChunks, sleep } = require('../utils') +const sdk = require('@defillama/sdk') + +const cacheFolder = 'uniswap-forks' + +function getUniTVL({ coreAssets, blacklist = [], factory, blacklistedTokens, + useDefaultCoreAssets = false, + fetchBalances = false, + abis = {}, + chain: _chain = 'ethereum', + queryBatched = 0, + waitBetweenCalls, + hasStablePools = false, + stablePoolSymbol = 'sAMM', +}) { + + let updateCache = false + + const abi = { ...uniswapAbi, ...abis } + + return async (_, _b, cb, { api, chain } = {}) => { + + if (!chain) + chain = _chain + factory = normalizeAddress(factory, chain) + blacklist = (blacklistedTokens || blacklist).map(i => normalizeAddress(i, chain)) + const key = `${factory}-${chain}` + + if (!coreAssets && useDefaultCoreAssets) + coreAssets = getCoreAssets(chain) + + let cache = await _getCache(cacheFolder, key, api) + + const _oldPairInfoLength = cache.pairs.length + const length = await api.call({ abi: abi.allPairsLength, target: factory, }) + sdk.log(chain, ' No. of pairs: ', length) + sdk.log('cached info', cache.pairs.length) + const pairCalls = [] + for (let i = _oldPairInfoLength; i < length; i++) + pairCalls.push(i) + + const calls = await api.multiCall({ abi: abi.allPairs, calls: pairCalls, target: factory }) + + const [ + token0s, token1s + ] = await Promise.all([ + api.multiCall({ abi: abi.token0, calls }), + api.multiCall({ abi: abi.token1, calls }), + ]) + let symbols + if (hasStablePools) { + symbols = await api.multiCall({ abi: 'erc20:symbol', calls, }) + cache.symbols.push(...symbols) + } + + cache.pairs.push(...calls) + cache.token0s.push(...token0s) + cache.token1s.push(...token1s) + + updateCache = updateCache || cache.pairs.length > _oldPairInfoLength + + if (updateCache) + await setCache(cacheFolder, key, cache) + + if (cache.pairs.length > length) + cache.pairs = cache.pairs.slice(0, length) + + let reserves = [] + if (queryBatched) { + const batchedCalls = sliceIntoChunks(cache.pairs, queryBatched) + for (const calls of batchedCalls) { + reserves.push(...await api.multiCall({ abi: abi.getReserves, calls })) + if (waitBetweenCalls) await sleep(waitBetweenCalls) + } + } else if (fetchBalances) { + const calls = [] + cache.pairs.forEach((owner, i) => { + calls.push({ target: cache.token0s[i], params: owner }) + calls.push({ target: cache.token1s[i], params: owner }) + }) + const bals = await api.multiCall({ abi: 'erc20:balanceOf', calls, }) + for (let i = 0; i < bals.length; i++) { + reserves.push({ _reserve0: bals[i], _reserve1: bals[i + 1] }) + i++ + } + } else + reserves = await api.multiCall({ abi: abi.getReserves, calls: cache.pairs }) + + + const balances = {} + if (coreAssets) { + const data = [] + reserves.forEach(({ _reserve0, _reserve1 }, i) => { + if (hasStablePools && cache.symbols[i].startsWith(stablePoolSymbol)) { + sdk.log('found stable pool: ', stablePoolSymbol) + sdk.util.sumSingleBalance(balances, cache.token0s[i], _reserve0) + sdk.util.sumSingleBalance(balances, cache.token1s[i], _reserve1) + } else { + data.push({ + token0: cache.token0s[i], + token1: cache.token1s[i], + token1Bal: _reserve1, + token0Bal: _reserve0, + }) + } + }) + return transformDexBalances({ balances, chain, data, coreAssets, blacklistedTokens: blacklist }) + } + + const blacklistedSet = new Set(blacklist) + reserves.forEach(({ _reserve0, _reserve1 }, i) => { + if (!blacklistedSet.has(cache.token0s[i].toLowerCase())) sdk.util.sumSingleBalance(balances, cache.token0s[i], _reserve0) + if (!blacklistedSet.has(cache.token1s[i].toLowerCase())) sdk.util.sumSingleBalance(balances, cache.token1s[i], _reserve1) + }) + + return transformBalances(chain, balances) + } + + async function _getCache(cacheFolder, key, api) { + let cache = await getCache(cacheFolder, key) + if (cache.pairs) { + for (let i = 0; i < cache.pairs.length; i++) { + if (!cache.pairs[i]) { + cache.pairs[i] = await api.call({ abi: abi.allPairsLength, target: factory, params: i }) + updateCache = true + } + let pair = cache.pairs[i] + if (!cache.token0s[i]) { + cache.token0s[i] = await api.call({ abi: abi.token0, target: pair }) + updateCache = true + } + if (!cache.token1s[i]) { + cache.token1s[i] = await api.call({ abi: abi.token1, target: pair }) + updateCache = true + } + } + // if (cache.pairs.includes(null) || cache.token0s.includes(null) || cache.token1s.includes(null)) + // cache.pairs = undefined + } + + if (!cache.pairs || (hasStablePools && (!cache.symbols || !cache.symbols.length))) { + cache = { + pairs: [], + token0s: [], + token1s: [], + symbols: [], + } + } + return cache + } +} + +module.exports = { + getUniTVL +} \ No newline at end of file diff --git a/projects/helper/cache/vestingHelper.js b/projects/helper/cache/vestingHelper.js new file mode 100644 index 00000000000..f64477caf7d --- /dev/null +++ b/projects/helper/cache/vestingHelper.js @@ -0,0 +1,46 @@ +const sdk = require('@defillama/sdk'); + +const { stripTokenHeader, getFixBalancesSync, } = require('../portedTokens') +const { getCoreAssets } = require('../tokenMapping') +const { sumTokens2, } = require('../unwrapLPs') +const { getUniqueAddresses, sliceIntoChunks, sleep, log } = require('../utils') +const { getTokenPrices, getLPList } = require('./sumUnknownTokens') + +async function vestingHelper({ + coreAssets = [], owner, tokens, chain = 'ethereum', block, restrictTokenRatio, blacklist = [], skipConversion = false, onlyLPs, minLPRatio, + log_coreAssetPrices = [], log_minTokenValue = 1e6, useDefaultCoreAssets = false, cache = {}, +}) { + if (!coreAssets.length && useDefaultCoreAssets) + coreAssets = getCoreAssets(chain) + + tokens = getUniqueAddresses(tokens) + blacklist = getUniqueAddresses(blacklist) + tokens = tokens.filter(t => !blacklist.includes(t)) + const chunkSize = chain === 'polygon' ? 250 : 500 // polygon has a lower gas limit + const chunks = sliceIntoChunks(tokens, chunkSize) + const finalBalances = {} + for (let i = 0; i < chunks.length; i++) { + log('resolving for %s/%s of total tokens: %s (chain: %s)', i + 1, chunks.length, tokens.length, chain) + let lps = await getLPList({ lps: chunks[i], chain, block, cache }) // we count only LP tokens for vesting protocols + const balances = await sumTokens2({ chain, block, owner, tokens: lps }) + const lpBalances = {} + Object.entries(balances).forEach(([token, bal]) => { + if (bal && bal !== 0) + lpBalances[stripTokenHeader(token)] = bal + else + delete balances[token] + }) + lps = lps.filter(lp => lpBalances[lp]) // we only care about LPs that are still locked in the protocol, we can ignore withdrawn LPs + const { updateBalances } = await getTokenPrices({ cache, coreAssets, lps, allLps: true, chain, block, restrictTokenRatio, blacklist, log_coreAssetPrices, log_minTokenValue, minLPRatio }) + await updateBalances(balances, { skipConversion, onlyLPs }) + Object.entries(balances).forEach(([token, bal]) => sdk.util.sumSingleBalance(finalBalances, token, bal)) + if (i > 3 && i % 2 === 0) await sleep(1000) + } + const fixBalances = getFixBalancesSync(chain) + fixBalances(finalBalances) + return finalBalances +} + +module.exports = { + vestingHelper, +} \ No newline at end of file diff --git a/projects/helper/calculateUniTvl.js b/projects/helper/calculateUniTvl.js index cccc0a5d998..e44f04d00b1 100644 --- a/projects/helper/calculateUniTvl.js +++ b/projects/helper/calculateUniTvl.js @@ -1,170 +1,10 @@ -const BigNumber = require('bignumber.js'); -const sdk = require('@defillama/sdk'); -const token0 = require('./abis/token0.json'); -const token1 = require('./abis/token1.json'); -const getReserves = require('./abis/getReserves.json'); -const factoryAbi = require('./abis/factory.json'); -const { getChainTransform, getFixBalances } = require('./portedTokens') +const { getUniTVL } = require('./cache/uniswap') -async function calculateUniTvl(getAddress, block, chain, FACTORY, START_BLOCK, useMulticall = false, abis = { - getReserves -}) { - let pairAddresses; - if (useMulticall) { - const pairLength = (await sdk.api.abi.call({ - target: FACTORY, - abi: factoryAbi.allPairsLength, - chain, - block - })).output - if (pairLength === null) { - throw new Error("allPairsLength() failed") - } - const pairNums = Array.from(Array(Number(pairLength)).keys()) - const pairs = (await sdk.api.abi.multiCall({ - abi: factoryAbi.allPairs, - chain, - calls: pairNums.map(num => ({ - target: FACTORY, - params: [num] - })), - block, - requery: true - })).output - pairAddresses = pairs.map(result => result.output.toLowerCase()) - } else { - const logs = ( - await sdk.api.util - .getLogs({ - keys: [], - toBlock: block, - chain, - target: FACTORY, - fromBlock: START_BLOCK, - topic: 'PairCreated(address,address,address,uint256)', - }) - ).output; - - pairAddresses = logs - // sometimes the full log is emitted - .map((log) => - typeof log === 'string' ? log : `0x${log.data.slice(64 - 40 + 2, 64 + 2)}` - ) - // lowercase - .map((pairAddress) => pairAddress.toLowerCase()); - } - - const [token0Addresses, token1Addresses, reserves] = await Promise.all([ - sdk.api.abi - .multiCall({ - abi: token0, - chain, - calls: pairAddresses.map((pairAddress) => ({ - target: pairAddress, - })), - block, - requery: true - }) - .then(({ output }) => output), - sdk.api.abi - .multiCall({ - abi: token1, - chain, - calls: pairAddresses.map((pairAddress) => ({ - target: pairAddress, - })), - block, - requery: true - }) - .then(({ output }) => output), - sdk.api.abi - .multiCall({ - abi: abis.getReserves, - chain, - calls: pairAddresses.map((pairAddress) => ({ - target: pairAddress, - })), - block, - requery: true - }).then(({ output }) => output), - ]); - - const pairs = {}; - // add token0Addresses - token0Addresses.forEach((token0Address) => { - const tokenAddress = token0Address.output.toLowerCase(); - - const pairAddress = token0Address.input.target.toLowerCase(); - pairs[pairAddress] = { - token0Address: getAddress(tokenAddress), - } - }); - - // add token1Addresses - token1Addresses.forEach((token1Address) => { - const tokenAddress = token1Address.output.toLowerCase(); - const pairAddress = token1Address.input.target.toLowerCase(); - pairs[pairAddress] = { - ...(pairs[pairAddress] || {}), - token1Address: getAddress(tokenAddress), - } - }); - - const balances = reserves.reduce((accumulator, reserve, i) => { - const pairAddress = reserve.input.target.toLowerCase(); - const pair = pairs[pairAddress] || {}; - - // handle reserve0 - if (pair.token0Address) { - const reserve0 = new BigNumber(reserve.output['0']); - if (!reserve0.isZero()) { - const existingBalance = new BigNumber( - accumulator[pair.token0Address] || '0' - ); - - accumulator[pair.token0Address] = existingBalance - .plus(reserve0) - .toFixed() - } - } - - // handle reserve1 - if (pair.token1Address) { - const reserve1 = new BigNumber(reserve.output['1']); - - if (!reserve1.isZero()) { - const existingBalance = new BigNumber( - accumulator[pair.token1Address] || '0' - ); - - accumulator[pair.token1Address] = existingBalance - .plus(reserve1) - .toFixed() - } - } - - return accumulator - }, {}); - - if (['cronos'].includes(chain)) - (await getFixBalances(chain))(balances); - - return balances -}; - -function uniTvlExport(factory, chain, transformAddressOriginal = undefined, abis) { - return async (timestamp, _ethBlock, {[chain]: block}) => { - let transformAddress; - if (transformAddressOriginal === undefined) { - transformAddress = await getChainTransform(chain); - } else { - transformAddress = await transformAddressOriginal() - } - return calculateUniTvl(transformAddress, block, chain, factory, 0, true, abis) - } +function uniTvlExport(factory, chain, useDefaultCoreAssets = false, abis, options = {}) { + if (useDefaultCoreAssets) options.useDefaultCoreAssets = true + return getUniTVL({ chain, factory, abis, ...options }) } module.exports = { - calculateUniTvl, uniTvlExport, }; diff --git a/projects/helper/cex.js b/projects/helper/cex.js index 0a8b62f2e81..ec7e42bf1a9 100644 --- a/projects/helper/cex.js +++ b/projects/helper/cex.js @@ -1,5 +1,4 @@ -const { tokensBare, } = require('./tokenMapping') -const { log } = require('./utils') +const ADDRESSES = require('./coreAssets.json') const { nullAddress } = require('./unwrapLPs') const { sumTokensExport } = require('../helper/sumTokens') const sdk = require('@defillama/sdk') @@ -7,15 +6,15 @@ const sdk = require('@defillama/sdk') const defaultTokens = { ethereum: [ nullAddress, - tokensBare.usdt, - tokensBare.usdc, - tokensBare.link, - tokensBare.dai, - tokensBare.wbtc, - '0x0000000000085d4780B73119b644AE5ecd22b376', // TUSD - '0x4fabb145d64652a948d72533023f6e7a623c7c53', // BUSD - '0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0', // MATIC - '0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE', // SHIBA INU + ADDRESSES.ethereum.USDT, + ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.LINK, + ADDRESSES.ethereum.DAI, + ADDRESSES.ethereum.WBTC, + ADDRESSES.ethereum.TUSD, // TUSD + ADDRESSES.ethereum.BUSD, // BUSD + ADDRESSES.ethereum.MATIC, // MATIC + ADDRESSES.ethereum.INU, // SHIBA INU '0xa0b73e1ff0b80914ab6fe0444e65848c4c34450b', // CRO '0x9be89d2a4cd102d8fecc6bf9da793be995c22541', // BBTC '0x7a58c0be72be218b41c608b7fe7c5bb630736c71', // PEOPLE @@ -24,12 +23,12 @@ const defaultTokens = { '0x111111111117dc0aa78b770fa6a738034120c302', // 1INCH '0x3597bfd533a99c9aa083587b074434e61eb0a258', // DENT '0x8a2279d4a90b6fe1c4b30fa660cc9f926797baa2', // CHR - '0x5a98fcbea516cf06857215779fd812ca3bef1b32', // LIDO - '0x9f8f72aa9304c8b593d555f12ef6589cc3a579a2', // MKR - '0xd533a949740bb3306d119cc777fa900ba034cd52', // CRV + ADDRESSES.ethereum.LIDO, // LIDO + ADDRESSES.ethereum.MKR, // MKR + ADDRESSES.ethereum.CRV, // CRV '0x92d6c1e31e14520e676a687f0a93788b716beff5', // DYDX - '0x4e15361fd6b4bb609fa63c81a2be19d873717870', // FTM - '0x6b3595068778dd592e39a122f4f5a5cf09c90fe2', // SUSHI + ADDRESSES.ethereum.FTM, // FTM + ADDRESSES.ethereum.SUSHI, // SUSHI '0x15d4c048f83bd7e37d49ea4c83a07267ec4203da', // GALA '0x3845badade8e6dff049820680d1f14bd3903a5d0', // SAND '0x0f5d2fb29fb7d3cfee444a200298f468908cc942', // MANA @@ -41,8 +40,8 @@ const defaultTokens = { '0xc18360217d8f7ab5e7c516566761ea12ce7f9d72', // ENS '0x45804880de22913dafe09f4980848ece6ecbaf78', // PAXG '0xf411903cbc70a74d22900a5de66a2dda66507255', // VRA - '0x1f9840a85d5af5bf1d1762f925bdaddc4201f984', // UNI - '0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9', // AAVE + ADDRESSES.ethereum.UNI, // UNI + ADDRESSES.ethereum.AAVE, // AAVE '0xc944e90c64b2c07662a292be6244bdf05cda44a7', // GRT '0x4a220e6096b25eadb88358cb44068a3248254675', // QNT '0xf34960d9d60be18cC1D5Afc1A6F012A723a28811', // KCS @@ -59,41 +58,87 @@ const defaultTokens = { '0xC581b735A1688071A1746c968e0798D642EDE491', //EURO-T '0x4da27a545c0c5b758a6ba100e3a049001de870f5', //aAAVE '0xa06bc25b5805d5f8d82847d191cb4af5a3e873e0', //aLINK - '0xae7ab96520de3a18e5e111b5eaab095312d7fe84', //stETH + ADDRESSES.ethereum.STETH, //stETH '0x9ee91f9f426fa633d227f7a9b000e28b9dfd8599', //STmatic '0xc00e94cb662c3520282e6f5717214004a7f26888', //COMP '0x1c48f86ae57291f7686349f12601910bd8d470bb', //USDK + '0x4691937a7508860f876c9c0a2a617e7d9e945d4b', // WOO + '0x19de6b897ed14a376dda0fe53a5420d2ac828a28', // BGB bitget token + '0x0316EB71485b0Ab14103307bf65a021042c6d380', // HBTC (Houbi BTC) https://explorer.btc.com/btc/address/12qTdZHx6f77aQ74CPCZGSY47VaRwYjVD8 / https://www.htokens.finance/en-us/assets + '0x6be61833fc4381990e82d7d4a9f4c9b3f67ea941', // HTB (Hotbit cex token) + '0x75231f58b43240c9718dd58b4967c5114342a86c', // OKB (OKX cex token) + '0x2af5d2ad76741191d15dfe7bf6ac92d4bd912ca3', // LEO (bitfinex cex token) + ADDRESSES.ethereum.BNB, // WBNB + '0xb62132e35a6c13ee1ee0f84dc5d40bad8d815206', // NEXO ,(Nexo cex token) + '0x1ceb5cb57c4d4e2b2433641b95dd330a33185a44', //kp3r + '0xcf0c122c6b73ff809c693db761e7baebe62b6a2e', //FLOKI ETH CHAIN + '0x11eef04c884e24d9b7b4760e7476d06ddf797f36', //MX TOKEN, mecx exchange token + '0xa4be4cDC552891a6702E1aE9645EF445179a4463', //FON + '0x356A5160F2B34BC8d88FB084745465eBBbed0174', //invi + '0x9813037ee2218799597d83D4a5B6F3b6778218d9', //bone + '0xf3b9569F82B18aEf890De263B84189bd33EBe452',//caw + '0x04abeda201850ac0124161f037efd70c74ddc74c',//nest + '0x9d71CE49ab8A0E6D2a1e7BFB89374C9392FD6804',//nvir + '0x5b649C07E7Ba0a1C529DEAabEd0b47699919B4a2',//sgt + '0x4385328cc4d643ca98dfea734360c0f596c83449', + '0xbc396689893d065f41bc2c6ecbee5e0085233447', //perp + '0xd7c49cee7e9188cca6ad8ff264c1da2e69d4cf3b', //NXM + '0xaaef88cea01475125522e117bfe45cf32044e238', // GF + '0x949d48eca67b17269629c7194f4b727d4ef9e5d6', // MC + '0xbb0e17ef65f82ab018d8edd776e8dd940327b28b', // AXS + '0x3432b6a60d23ca0dfca7761b7ab56459d9c964d0', // FXS + '0xd417144312dbf50465b1c641d016962017ef6240',// cqt + '0xcb84d72e61e383767c4dfeb2d8ff7f4fb89abc6e', //VEGA + '0xcccd1ba9f7acd6117834e0d28f25645decb1736a', //ecox ], tron: [ nullAddress, - 'TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t', // USDT - 'TEkxiTehnzSmSe2XqrBj4w32RUN966rdz8', // USDC + ADDRESSES.tron.USDT, // USDT + ADDRESSES.tron.USDC, // USDC + 'TFptbWaARrWTX5Yvy3gNG5Lm8BmhPx82Bt', //wbt + ADDRESSES.tron.TUSD ], polygon: [ nullAddress, - '0xc2132d05d31c914a87c6611c10748aeb04b58e8f', // USDT - '0x0000000000000000000000000000000000001010', // WMATIC - '0x7ceb23fd6bc0add59e62ac25578270cff1b9f619', // WETH + ADDRESSES.polygon.USDT, // USDT + ADDRESSES.polygon.WMATIC_1, // WMATIC + ADDRESSES.polygon.WETH_1, // WETH + ADDRESSES.polygon.QUICK, // QUICK + ADDRESSES.polygon.WBTC, //WBTC + ADDRESSES.polygon.USDC, //USDC + ADDRESSES.polygon.DAI, //DAI + '0x2AB0e9e4eE70FFf1fB9D67031E44F6410170d00e', //xen + '0x0169ec1f8f639b32eec6d923e24c2a2ff45b9dd6', //ALGB ], algorand: [], - solana: [], + solana: [ + ADDRESSES.solana.USDC, // USDC + ADDRESSES.solana.USDT, // USDT + ], bsc: [ nullAddress, - '0x7130d2a12b9bcbfae4f2634d864a1ee1ce3ead9c', // BTCB - '0x2170ed0880ac9a755fd29b2688956bd959f933f8', // BTCE + ADDRESSES.bsc.BTCB, // BTCB + ADDRESSES.bsc.ETH, // BTCE '0xfd5840cd36d94d7229439859c0112a4185bc0255', // vUSDT - '0x250632378e573c6be1ac2f97fcdf00515d0aa91b', // BETH + ADDRESSES.bsc.BETH, // BETH '0x95c78222b3d6e262426483d42cfa53685a67ab9d', // vBUSD '0x7083609fce4d1d8dc0c979aab8c869ea2c873402', // BDOT '0x0e09fabb73bd3ade0a17ecc321fd13a19e81ce82', // CAKE - '0x55d398326f99059ff775485246999027b3197955', // BUSDT - '0xe9e7cea3dedca5984780bafc599bd69add087d56', // BUSD + ADDRESSES.bsc.USDT, // BUSDT + ADDRESSES.bsc.BUSD, // BUSD '0x1d2f0da169ceb9fc7b3144628db156f3f6c60dbe', // BXRP - '0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d', // B-USDC - '0x14016e85a25aeb13065688cafb43044c2ef86784', // B-TUSD + ADDRESSES.bsc.USDC, // B-USDC + ADDRESSES.bsc.BTUSD, // B-TUSD '0x2859e4544c4bb03966803b044a93563bd2d0dd4d', // SHIB - '0x3ee2200efb3400fabb9aacf31297cbdd1d435d47', //ADA - + '0x3ee2200efb3400fabb9aacf31297cbdd1d435d47', // ADA + '0x4691937a7508860f876c9c0a2a617e7d9e945d4b', // WOO + '0xc748673057861a797275CD8A068AbB95A902e8de', // BabyDoge + '0xAC51066d7bEC65Dc4589368da368b212745d63E8', // ALICE + '0xfb5B838b6cfEEdC2873aB27866079AC55363D37E', // FLOKI + '0x352Cb5E19b12FC216548a2677bD0fce83BaE434B', // BTT + '0xAD29AbB318791D579433D831ed122aFeAf29dcfe', // FTM + '0x02ff5065692783374947393723dba9599e59f591',// yoshi + ADDRESSES.bsc.TUSD, //TUSD ], eos: [ ["eosio.token", "EOS", "eos"], @@ -101,25 +146,29 @@ const defaultTokens = { ], arbitrum: [ nullAddress, - '0xff970a61a04b1ca14834a43f5de4533ebddb5cc8', // USDC - '0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9', // USDT - '0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1', // DAI + ADDRESSES.arbitrum.USDC, // USDC + ADDRESSES.arbitrum.USDT, // USDT + ADDRESSES.optimism.DAI, // DAI + '0x09e18590e8f76b6cf471b3cd75fe1a1a9d2b2c2b' //aidoge + ], avax: [ nullAddress, - '0x9702230a8ea53601f5cd2dc00fdbc13d4df4a8c7', // USDT - '0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E', // USDC - '0xd586E7F844cEa2F87f50152665BCbc2C279D8d70', // DAI + ADDRESSES.avax.USDt, // USDT + ADDRESSES.avax.USDC, // USDC + ADDRESSES.avax.DAI, // DAI + '0xabc9547b534519ff73921b1fba6e672b5f58d083', // WOO + ADDRESSES.avax.USDC_e, //USDC.e ], near: [ 'usdt.tether-token.near', ], optimism: [ nullAddress, - '0x4200000000000000000000000000000000000042', //OP - '0x94b008aa00579c1307b0ef2c499ad98a8ce58e58', //USDT - '0x7F5c764cBc14f9669B88837ca1490cCa17c31607', //USDC - '0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1' // DAI + ADDRESSES.optimism.OP, //OP + ADDRESSES.optimism.USDT, //USDT + ADDRESSES.optimism.USDC, //USDC + ADDRESSES.optimism.DAI // DAI ], } @@ -129,17 +178,17 @@ function cexExports(config) { timetravel: false, } chains.forEach(chain => { - let { tokensAndOwners, owners, tokens } = config[chain] + let { tokensAndOwners, owners, tokens, blacklistedTokens, } = config[chain] if (!tokensAndOwners && !tokens) { tokens = defaultTokens[chain] if (!tokens) { - log(chain, 'Missing default token list, counting only native token balance',) + // log(chain, 'Missing default token list, counting only native token balance',) tokens = [nullAddress] } } - const options = { ...config[chain], owners, tokens, chain } + const options = { ...config[chain], owners, tokens, chain, blacklistedTokens, } if (chain === 'solana') options.solOwners = owners exportObj[chain] = { tvl: sumTokensExport(options) } }) @@ -154,4 +203,4 @@ function cexExports(config) { module.exports = { cexExports, -} +} \ No newline at end of file diff --git a/projects/helper/chain/algorand.js b/projects/helper/chain/algorand.js index 9b0e1f980aa..949dd5a9aec 100644 --- a/projects/helper/chain/algorand.js +++ b/projects/helper/chain/algorand.js @@ -3,19 +3,19 @@ const axios = require('axios') const { getApplicationAddress } = require('./algorandUtils/address') const { RateLimiter } = require("limiter"); -const { fixBalancesTokens } = require('../tokenMapping') -const { getFixBalancesSync } = require('../portedTokens') +const coreAssets = require('../coreAssets.json') +const ADDRESSES = coreAssets const sdk = require('@defillama/sdk'); const { default: BigNumber } = require('bignumber.js'); const stateCache = {} const accountCache = {} const assetCache = {} -const geckoMapping = fixBalancesTokens.algorand +const geckoMapping = Object.values(coreAssets.algorand) const axiosObj = axios.create({ - baseURL: 'https://algoindexer.algoexplorerapi.io', + baseURL: "https://mainnet-idx.algonode.cloud", timeout: 300000, -}) +}); const indexerLimiter = new RateLimiter({ tokensPerInterval: 10, interval: "second" }); @@ -27,9 +27,10 @@ async function lookupAccountByID(accountId) { return (await axiosObj.get(`/v2/accounts/${accountId}`)).data } -async function searchAccounts({ appId, limit = 1000, nexttoken, }) { +async function searchAccounts({ appId, limit = 1000, nexttoken, searchParams, }) { const response = (await axiosObj.get('/v2/accounts', { params: { + ...searchParams, 'application-id': appId, limit, next: nexttoken, @@ -39,11 +40,11 @@ async function searchAccounts({ appId, limit = 1000, nexttoken, }) { } -async function searchAccountsAll({ appId, limit = 1000 }) { +async function searchAccountsAll({ appId, limit = 1000, searchParams = {} }) { const accounts = [] let nexttoken do { - const res = await searchAccounts({ appId, limit, nexttoken, }) + const res = await searchAccounts({ appId, limit, nexttoken, searchParams, }) nexttoken = res['next-token'] accounts.push(...res.accounts) } while (nexttoken) @@ -55,22 +56,23 @@ const withLimiter = (fn, tokensToRemove = 1) => async (...args) => { return fn(...args); } -async function sumTokens({ owner, owners = [], tokens = [], token, balances = {}, blacklistedTokens = [], tinymanLps = [], blacklistOnLpAsWell = false, }) { +async function sumTokens({ owner, owners = [], tokens = [], token, balances = {}, blacklistedTokens = [], tinymanLps = [], blacklistOnLpAsWell = false, tokensAndOwners = [], }) { if (owner) owners = [owner] if (token) tokens = [token] + if (tokensAndOwners.length) owners = tokensAndOwners.map(i => i[1]) const accounts = await Promise.all(owners.map(getAccountInfo)) - accounts.forEach(({ assets }) => { + accounts.forEach(({ assets }, i) => { + if (tokensAndOwners.length) tokens = [tokensAndOwners[i][0]] assets.forEach(i => { if (!tokens.length || tokens.includes(i['asset-id'])) if (!blacklistedTokens.length || !blacklistedTokens.includes(i['asset-id'])) - sdk.util.sumSingleBalance(balances, i['asset-id'], BigNumber(i.amount).toFixed(0)) + sdk.util.sumSingleBalance(balances, i['asset-id'], BigNumber(i.amount).toFixed(0), 'algorand') }) }) if (tinymanLps.length) { await Promise.all(tinymanLps.map(([lp, unknown]) => resolveTinymanLp({ balances, lpId: lp, unknownAsset: unknown, blacklistedTokens: blacklistOnLpAsWell ? blacklistedTokens : [] }))) } - const fixBalances = getFixBalancesSync('algorand') - return fixBalances(balances) + return balances } async function getAssetInfo(assetId) { @@ -89,7 +91,7 @@ async function getAssetInfo(assetId) { } async function resolveTinymanLp({ balances, lpId, unknownAsset, blacklistedTokens, }) { - const lpBalance = balances[lpId] + const lpBalance = balances['algorand:'+lpId] if (lpBalance && lpBalance !== '0') { const lpInfo = await getAssetInfo(lpId) let ratio = lpBalance / lpInfo.circulatingSupply @@ -98,16 +100,17 @@ async function resolveTinymanLp({ balances, lpId, unknownAsset, blacklistedToken Object.keys(lpInfo.assets).forEach((token) => { if (!blacklistedTokens.length || !blacklistedTokens.includes(token)) if (token !== unknownAsset) - sdk.util.sumSingleBalance(balances, token, BigNumber(lpInfo.assets[token].amount * ratio).toFixed(0)) + sdk.util.sumSingleBalance(balances, token, BigNumber(lpInfo.assets[token].amount * ratio).toFixed(0), 'algorand') }) } else { Object.keys(lpInfo.assets).forEach((token) => { if (!blacklistedTokens.length || !blacklistedTokens.includes(token)) - sdk.util.sumSingleBalance(balances, token, BigNumber(lpInfo.assets[token].amount * ratio).toFixed(0)) + sdk.util.sumSingleBalance(balances, token, BigNumber(lpInfo.assets[token].amount * ratio).toFixed(0), 'algorand') }) } } delete balances[lpId] + delete balances['algorand:'+lpId] return balances } @@ -130,10 +133,18 @@ async function getAccountInfo(accountId) { const tokens = { usdc: 31566704, + usdt: 312769, + wBtc: 1058926737, + wEth: 887406851, + wBtcGoBtcLp: 1058934626, + wEthGoEthLp: 1058935051, + usdtGoUsdLp: 1081978679, goUsd: 672913181, usdcGoUsdLp: 885102318, gard: 684649988, -} + gold$: 246516580, + silver$: 246519683, +}; // store all asset ids as string Object.keys(tokens).forEach(t => tokens[t] = '' + tokens[t]) @@ -161,12 +172,11 @@ async function getPriceFromAlgoFiLP(lpAssetId, unknownAssetId) { const unknownAssetQuantity = lpInfo.reserveInfo.assets.find(i => i['asset-id'] === '' + unknownAssetId).amount for (const i of lpInfo.reserveInfo.assets) { const id = i['asset-id'] - if (geckoMapping[id]) { - const { coingeckoId, decimals } = geckoMapping[id] + if (geckoMapping.includes(id)) { return { price: i.amount / unknownAssetQuantity, - geckoId: coingeckoId, - decimals, + geckoId: 'algorand:'+id, + decimals: 0, } } } @@ -186,4 +196,4 @@ module.exports = { searchAccounts: withLimiter(searchAccounts), getAppGlobalState: getAppGlobalState, getPriceFromAlgoFiLP, -} +} \ No newline at end of file diff --git a/projects/helper/chain/aptos.js b/projects/helper/chain/aptos.js index fb806ee4f82..d820b393e8e 100644 --- a/projects/helper/chain/aptos.js +++ b/projects/helper/chain/aptos.js @@ -2,23 +2,43 @@ const sdk = require('@defillama/sdk') const http = require('../http') -const { fixBalancesTokens } = require('../tokenMapping') +const { getEnv } = require('../env') +const coreTokensAll = require('../coreAssets.json') const { transformBalances } = require('../portedTokens') const { log, getUniqueAddresses } = require('../utils') -const coreTokens = Object.keys(fixBalancesTokens.aptos) +const coreTokens = Object.values(coreTokensAll.aptos) -const endpoint = process.env.APTOS_RPC || "https://aptos-mainnet.pontem.network" +const endpoint = () => getEnv('APTOS_RPC') async function aQuery(api) { - return http.get(`${endpoint}${api}`) + return http.get(`${endpoint()}${api}`) } async function getResources(account) { - return http.get(`${endpoint}/v1/accounts/${account}/resources`) + const data = [] + let lastData + let cursor + do { + let url = `${endpoint()}/v1/accounts/${account}/resources?limit=9999` + if (cursor) url += '&start=' + cursor + const res = await http.getWithMetadata(url) + lastData = res.data + data.push(...lastData) + sdk.log('fetched resource length', lastData.length) + cursor = res.headers['x-aptos-cursor'] + } while (lastData.length === 9999) + return data } + +async function getResource(account, key) { + let url = `${endpoint()}/v1/accounts/${account}/resource/${key}` + const { data } = await http.get(url) + return data +} + async function getCoinInfo(address) { if (address === '0x1') return { data: { decimals: 8, name: 'Aptos' } } - return http.get(`${endpoint}/v1/accounts/${address}/resource/0x1::coin::CoinInfo%3C${address}::coin::T%3E`) + return http.get(`${endpoint()}/v1/accounts/${address}/resource/0x1::coin::CoinInfo%3C${address}::coin::T%3E`) } function dexExport({ @@ -74,12 +94,42 @@ async function sumTokens({ balances = {}, owners = [] }) { return transformBalances('aptos', balances) } +async function getTableData({ table, data }) { + const response = await http.post(`${endpoint()}/v1/tables/${table}/item`, data) + return response +} + +async function function_view({ functionStr, type_arguments = [], args = [] }) { + const response = await http.post(`${endpoint()}/v1/view`, { "function": functionStr, "type_arguments": type_arguments, arguments:args }) + return response +} + +function hexToString(hexString) { + if (hexString.startsWith('0x')) hexString = hexString.slice(2); + const byteLength = hexString.length / 2; + const byteArray = new Uint8Array(byteLength); + + for (let i = 0; i < byteLength; i++) { + const hexByte = hexString.substr(i * 2, 2); + byteArray[i] = parseInt(hexByte, 16); + } + + const decoder = new TextDecoder('utf-8'); + const stringValue = decoder.decode(byteArray); + + return stringValue +} + module.exports = { - endpoint, + endpoint: endpoint(), dexExport, aQuery, getCoinInfo, getResources, + getResource, coreTokens, sumTokens, + getTableData, + function_view, + hexToString, }; diff --git a/projects/helper/chain/bitcoin.js b/projects/helper/chain/bitcoin.js index 264296bfd7c..b2a8563aebd 100644 --- a/projects/helper/chain/bitcoin.js +++ b/projects/helper/chain/bitcoin.js @@ -1,23 +1,47 @@ const sdk = require('@defillama/sdk') const { get } = require('../http') +const { getEnv } = require('../env') -const url = addr => 'https://blockstream.info/api/address/'+addr +const url = addr => 'https://blockstream.info/api/address/' + addr + +const delay = 3 * 60 * 60 // 3 hours +const balancesNow = { + +} + +async function getBalanceNow(addr) { + if (balancesNow[addr]) return balancesNow[addr] -async function getBalance(addr) { const { chain_stats: { funded_txo_sum, spent_txo_sum, - }} = await get(url(addr)) - - return (funded_txo_sum - spent_txo_sum) /1e8 + } } = await get(url(addr)) + balancesNow[addr] = (funded_txo_sum - spent_txo_sum) / 1e8 + return balancesNow[addr] } -async function sumTokens({ balances = {}, owners = {}}) { - const bitBals = await Promise.all(owners.map(getBalance)) - sdk.util.sumSingleBalance(balances,'bitcoin',bitBals.reduce((a, i) => a+i, 0)) +async function sumTokens({ balances = {}, owners = [], timestamp }) { + const bitBals = [] + for (const addr of owners) + bitBals.push(await getBalance(addr, timestamp)) + sdk.util.sumSingleBalance(balances, 'bitcoin', bitBals.reduce((a, i) => a + i, 0)) return balances } +async function getBalance(addr, timestamp) { + const now = Date.now() / 1e3 + let balance = await getBalanceNow(addr) + + if (!timestamp || (now - timestamp) < delay) return balance + + let endpoint = `https://btc.getblock.io/${getEnv('GETBLOCK_KEY')}/mainnet/blockbook/api/v2/balancehistory/${addr}?fiatcurrency=btc&groupBy=86400&from=${timestamp}` + + const response = await get(endpoint) + response.forEach(({ sent, received }) => balance += sent / 1e8 - received / 1e8) + sdk.log('bitcoin balance', addr, balance) + return balance +} + module.exports = { sumTokens -} \ No newline at end of file +} diff --git a/projects/helper/chain/cardano.js b/projects/helper/chain/cardano.js index a54ba1d06a9..7a9244ae755 100644 --- a/projects/helper/chain/cardano.js +++ b/projects/helper/chain/cardano.js @@ -1,24 +1,105 @@ -const axios = require("axios"); const sdk = require('@defillama/sdk') +const { post } = require('../http') +const { getUniqueAddresses, nullAddress } = require('../tokenMapping') +const { getAssets, getAddressesUTXOs, } = require('./cardano/blockfrost') +const { PromisePool } = require('@supercharge/promise-pool') + +async function getAda(address) { + const amount = await getAssets(address) + return amount.find(i => i.unit === 'lovelace')?.quantity ?? 0 +} async function getAdaInAddress(address) { - return axios.post("https://api.koios.rest/api/v0/address_info", { - "_addresses": [ - address - ] - }).then(r => r.data[0].balance / 1e6) + return (await getAda(address)) / 1e6 +} + +async function getTokenBalance(token, owner) { + const assets = await getAssets(owner) + return assets.find(i => i.unit === token)?.quantity ?? 0 } async function sumTokens({ owners, balances = {} }) { - const { data } = await axios.post("https://api.koios.rest/api/v0/address_info", { - "_addresses": owners - }) - for (const { balance } of data) + + const { results, errors } = await PromisePool.withConcurrency(4) + .for(owners) + .process(getAda) + + if (errors && errors.length) + throw errors[0] + + for (const balance of results) sdk.util.sumSingleBalance(balances, 'cardano', balance / 1e6) return balances } +async function getTokenPrice(address) { + const endpoint = 'https://monorepo-mainnet-prod.minswap.org/graphql?TopPools' + const { data: { topPools: [pool] } } = await post(endpoint, { + "query": "query TopPools($asset: String, $favoriteLps: [InputAsset!], $limit: Int, $offset: Int, $sortBy: TopPoolsSortInput) { topPools( asset: $asset favoriteLps: $favoriteLps limit: $limit offset: $offset sortBy: $sortBy ) { assetA { currencySymbol tokenName ...allMetadata } assetB { currencySymbol tokenName ...allMetadata } reserveA reserveB lpAsset { currencySymbol tokenName } totalLiquidity reserveADA }} fragment allMetadata on Asset { metadata { name ticker decimals }}", + "variables": { + "asset": address, + "offset": 0, + "limit": 20, + "sortBy": { + "column": "TVL", + "type": "DESC" + } + } + }) + if (pool.assetA.metadata) throw new Error('It is not paired against cardano') + if (+pool.reserveA < 1e9) return 0 // less than 1000 ADA in pool, return price as 0 + return pool.reserveA / pool.reserveB // price in cardano +} + +async function sumTokens2({ owners = [], balances = {}, owner, tokens = [], blacklistedTokens = [], scripts = [] }) { + if (owner) owners = [owner] + tokens = tokens.map(i => i === nullAddress ? 'lovelace': i) + owners = getUniqueAddresses(owners, 'cardano') + blacklistedTokens = getUniqueAddresses(blacklistedTokens, 'cardano') + tokens = getUniqueAddresses(tokens, 'cardano') + const { results, errors } = await PromisePool.withConcurrency(4) + .for(owners) + .process(getAssets) + + if (errors && errors.length) + throw errors[0] + + + const { results: resultsUTXOs, errors: errorsUTXOs } = await PromisePool.withConcurrency(2) + .for(scripts) + .process(getAddressesUTXOs) + + if (errorsUTXOs && errorsUTXOs.length) + throw errorsUTXOs[0] + + resultsUTXOs.flat().map(addBalances) + results.map(addBalances) + return balances + + function addBalances(bals) { + if (bals.amount) bals = bals.amount + bals.forEach(({ unit, quantity }) => { + if (+quantity < 10) { + // sdk.log('Ignoring: ', unit, quantity) + return; + } + const isWhitelisted = !tokens.length || tokens.includes(unit) + const isBlacklisted = blacklistedTokens.includes(unit) + if (!isBlacklisted && isWhitelisted) sdk.util.sumSingleBalance(balances, unit, quantity, 'cardano') + }) + } +} + +function sumTokensExport({ owners, balances, owner, tokens, blacklistedTokens, scripts }) { + return async () => sumTokens2({ owners, balances, owner, tokens, blacklistedTokens, scripts }) +} + + module.exports = { getAdaInAddress, sumTokens, + getTokenBalance, + getTokenPrice, + sumTokens2, + sumTokensExport, } \ No newline at end of file diff --git a/projects/helper/chain/cardano/blockfrost.js b/projects/helper/chain/cardano/blockfrost.js index 9c00e39ffd8..eb6d0d8b438 100644 --- a/projects/helper/chain/cardano/blockfrost.js +++ b/projects/helper/chain/cardano/blockfrost.js @@ -3,7 +3,7 @@ const axios = require('axios') const axiosObj = axios.create({ baseURL: 'https://cardano-mainnet.blockfrost.io/api/v0', headers: { - 'project_id': 'mainnet9mqP0lhGpRfqcUnVjOFaTSK67Z9UdZMM', + 'project_id': 'mai'+'nnetcxT8VaeCgVMzMTSe'+'zZijWlVkyh6XytpS', 'Content-Type': 'application/json' }, timeout: 300000, @@ -38,7 +38,6 @@ async function assetsAddresses(address) { }) response = response.data addresses.push(...response) - console.log(addresses.length, response.length) page++ } while (response.length) return addresses @@ -55,7 +54,6 @@ async function addressesUtxosAssetAll(address, asset) { }) response = response.data addresses.push(...response) - console.log(addresses.length, response.length) page++ } while (response.length) return addresses diff --git a/projects/helper/chain/cardano/index.js b/projects/helper/chain/cardano/index.js index c23e0671057..5dee9cb3c3f 100644 --- a/projects/helper/chain/cardano/index.js +++ b/projects/helper/chain/cardano/index.js @@ -3,7 +3,7 @@ const axios = require('axios') const axiosObj = axios.create({ baseURL: 'https://cardano-mainnet.blockfrost.io/api/v0', headers: { - 'project_id': 'mainnet9mqP0lhGpRfqcUnVjOFaTSK67Z9UdZMM', + 'project_id': 'mai'+'nnetcxT8Vae'+'CgVMzMTSezZijWlVkyh6XytpS', 'Content-Type': 'application/json' }, timeout: 300000, diff --git a/projects/helper/chain/cosmos.js b/projects/helper/chain/cosmos.js index 487e4456755..65de317ef8d 100644 --- a/projects/helper/chain/cosmos.js +++ b/projects/helper/chain/cosmos.js @@ -1,168 +1,224 @@ -const axios = require('axios') -const { default: BigNumber } = require("bignumber.js") -const sdk = require('@defillama/sdk') -const { transformBalances } = require('../portedTokens') -const { PromisePool } = require('@supercharge/promise-pool') -const { log } = require('../utils') - +const axios = require("axios"); +const { default: BigNumber } = require("bignumber.js"); +const sdk = require("@defillama/sdk"); +const { transformBalances } = require("../portedTokens"); +const { PromisePool } = require("@supercharge/promise-pool"); +const { log } = require("../utils"); + +// where to find chain info +// https://proxy.atomscan.com/chains.json // https://cosmos-chain.directory/chains/cosmoshub // https://cosmos-chain.directory/chains const endPoints = { - crescent: 'https://mainnet.crescent.network:1317', - osmosis: 'https://lcd.osmosis.zone', - cosmos: 'https://cosmoshub-lcd.stakely.io', - kujira: 'https://lcd.kaiyo.kujira.setten.io', -} + crescent: "https://mainnet.crescent.network:1317", + osmosis: "https://lcd.osmosis.zone", + cosmos: "https://cosmoshub-lcd.stakely.io", + kujira: "https://rest.cosmos.directory/kujira", + comdex: "https://rest.comdex.one", + terra: "https://rest.cosmos.directory/terra", + terra2: "https://rest.cosmos.directory/terra2", + umee: "https://umee-api.polkachu.com", + orai: "https://lcd.orai.io", + juno: "https://lcd-juno.cosmostation.io", + cronos: "https://lcd-crypto-org.cosmostation.io", + chihuahua: "https://rest.cosmos.directory/chihuahua", + injective: "https://lcd-injective.whispernode.com:443", + migaloo: "https://migaloo-api.polkachu.com", + fxcore: "https://fx-rest.functionx.io", + xpla: "https://dimension-lcd.xpla.dev", + kava: "https://api2.kava.io", + neutron: "https://rest-kralum.neutron-1.neutron.org", + quasar: "https://quasar-api.polkachu.com", + gravitybridge: "https://rest.cosmos.directory/gravitybridge", +}; const chainSubpaths = { - crescent: 'crescent', -} + crescent: "crescent", + comdex: "comdex", + umee: "umee", + kava: "kava", +}; function getEndpoint(chain) { - if (!endPoints[chain]) - throw new Error('Chain not found') - return endPoints[chain] + if (!endPoints[chain]) throw new Error("Chain not found: " + chain); + return endPoints[chain]; } async function query(url, block, chain) { - block = undefined - let endpoint = `${getEndpoint(chain)}/wasm/${url}` + block = undefined; + let endpoint = `${getEndpoint(chain)}/wasm/${url}`; if (block !== undefined) { - endpoint += `&height=${block - (block % 100)}` + endpoint += `&height=${block - (block % 100)}`; } - return (await axios.get(endpoint)).data.result + console.log(endpoint); + return (await axios.get(endpoint)).data.result; } async function queryV1Beta1({ chain, paginationKey, block, url } = {}) { - const subpath = chainSubpaths[chain] || 'cosmos' - let endpoint = `${getEndpoint(chain)}/${subpath}/${url}` + const subpath = chainSubpaths[chain] || "cosmos"; + let endpoint = `${getEndpoint(chain)}/${subpath}/${url}`; if (block !== undefined) { - endpoint += `?height=${block - (block % 100)}` + endpoint += `?height=${block - (block % 100)}`; } if (paginationKey) { - const paginationQueryParam = `pagination.key=${paginationKey}` + const paginationQueryParam = `pagination.key=${paginationKey}`; if (block === undefined) { - endpoint += "?" + endpoint += "?"; } else { - endpoint += "&" + endpoint += "&"; } - endpoint += paginationQueryParam + endpoint += paginationQueryParam; } - return (await axios.get(endpoint)).data + return (await axios.get(endpoint)).data; +} + +async function getTokenBalance({ token, owner, block, chain }) { + let denom = token.native_token?.denom; + if (denom) return getDenomBalance({ denom, owner, block, chain }); + token = token.token.contract_addr; + return getBalance({ token, owner, block, chain }); +} + +function getToken(token) { + let denom = token.native_token?.denom; + return denom ? denom : token.token.contract_addr; } async function getBalance({ token, owner, block, chain } = {}) { - const data = await query(`contracts/${token}/store?query_msg={"balance":{"address":"${owner}"}}`, block, chain) - return Number(data.balance) + const data = await queryContract({ + contract: token, + block, + chain, + data: { + balance: { address: owner }, + }, + }); + + return Number(data.balance); } async function getDenomBalance({ denom, owner, block, chain } = {}) { - let endpoint = `${getEndpoint(chain)}/bank/balances/${owner}` + let endpoint = `${getEndpoint(chain)}/bank/balances/${owner}`; if (block !== undefined) { - endpoint += `?height=${block - (block % 100)}` + endpoint += `?height=${block - (block % 100)}`; } - const data = (await axios.get(endpoint)).data.result + const data = (await axios.get(endpoint)).data.result; - const balance = data.find(balance => balance.denom === denom); - return balance ? Number(balance.amount) : 0 + const balance = data.find((balance) => balance.denom === denom); + return balance ? Number(balance.amount) : 0; } async function getBalance2({ balances = {}, owner, block, chain } = {}) { - const subpath = chainSubpaths[chain] || 'cosmos' - let endpoint = `${getEndpoint(chain)}/${subpath}/bank/v1beta1/balances/${owner}?pagination.limit=1000` + const subpath = chainSubpaths[chain] || "cosmos"; + let endpoint = `${getEndpoint( + chain + )}/${subpath}/bank/v1beta1/balances/${owner}?pagination.limit=1000`; if (block) { - endpoint += `?height=${block - (block % 100)}` + endpoint += `?height=${block - (block % 100)}`; } - const { data: { balances: data } } = await axios.get(endpoint) + const { + data: { balances: data }, + } = await axios.get(endpoint); for (const { denom, amount } of data) - sdk.util.sumSingleBalance(balances, denom, amount) - return balances + sdk.util.sumSingleBalance(balances, denom, amount); + return balances; } // LP stuff async function totalSupply({ token, block, chain } = {}) { - const data = await query(`contracts/${token}/store?query_msg={"token_info":{}}`, block, chain) - return data.total_supply + const data = await query( + `contracts/${token}/store?query_msg={"token_info":{}}`, + block, + chain + ); + return data.total_supply; } async function lpMinter({ token, block, chain } = {}) { - const data = await query(`contracts/${token}/store?query_msg={"minter":{}}`, block, chain) - return data.minter + const data = await query( + `contracts/${token}/store?query_msg={"minter":{}}`, + block, + chain + ); + return data.minter; } async function queryContract({ contract, chain, data }) { - if (typeof data !== 'string') data = JSON.stringify(data) - data = Buffer.from(data).toString('base64') - return (await axios.get(`${getEndpoint(chain)}/cosmwasm/wasm/v1/contract/${contract}/smart/${data}`)).data.data -} - -function getAssetInfo(asset) { - return [asset.info.native_token?.denom ?? asset.info.token?.contract_addr, Number(asset.amount)] -} - -async function unwrapLp({ balances, lpBalance, lpToken, block, chain } = {}) { - const pair = await lpMinter({ token: lpToken, chain, block, }) - const { assets, total_share } = await query(`contracts/${pair}/store?query_msg={"pool":{}}`, block); - const [token0, amount0] = getAssetInfo(assets[0]) - const [token1, amount1] = getAssetInfo(assets[1]) - balances[token0] = (balances[token0] ?? 0) + (amount0 * lpBalance / total_share) - balances[token1] = (balances[token1] ?? 0) + (amount1 * lpBalance / total_share) + if (typeof data !== "string") data = JSON.stringify(data); + data = Buffer.from(data).toString("base64"); + return ( + await axios.get( + `${getEndpoint(chain)}/cosmwasm/wasm/v1/contract/${contract}/smart/${data}` + ) + ).data.data; } -async function queryContractStore({ contract, queryParam, block, chain = false, }) { - if (typeof queryParam !== 'string') queryParam = JSON.stringify(queryParam) - const url = `contracts/${contract}/store?query_msg=${queryParam}` - return query(url, block, chain) +async function queryContracts({ chain, codeId }) { + return ( + await axios.get( + `${getEndpoint(chain)}/cosmwasm/wasm/v1/code/${codeId}/contracts` + ) + ).data.contracts; } -function sumSingleBalance(balances, token, balance, price) { - const { coingeckoId, label, decimals = 0, } = tokenMapping[token] || {} - - if (coingeckoId || (label && price)) { - token = coingeckoId || 'terrausd' - - if (decimals) - balance = BigNumber(balance).shiftedBy(-1 * decimals) - - if (!coingeckoId) - balance = balance.multipliedBy(BigNumber(price)) // convert the value to UST - - if (!balances[token]) - balances[token] = BigNumber(0) - else if (typeof balances[token] === 'string') - balances[token] = BigNumber(balances[token]).shiftedBy(-1 * decimals) - - balances[token] = balances[token].plus(balance) - return - } - - sdk.util.sumSingleBalance(balances, token, balance) - return balances +function getAssetInfo(asset) { + return [ + asset.info.native_token?.denom ?? asset.info.token?.contract_addr, + Number(asset.amount), + ]; } -async function sumTokens({ balances = {}, owners = [], chain, }) { - log(chain, 'fetching balances for ', owners.length) - let parallelLimit = 25 +async function unwrapLp({ balances, lpBalance, lpToken, block, chain } = {}) { + const pair = await lpMinter({ token: lpToken, chain, block }); + const { assets, total_share } = await query( + `contracts/${pair}/store?query_msg={"pool":{}}`, + block + ); + const [token0, amount0] = getAssetInfo(assets[0]); + const [token1, amount1] = getAssetInfo(assets[1]); + balances[token0] = + (balances[token0] ?? 0) + (amount0 * lpBalance) / total_share; + balances[token1] = + (balances[token1] ?? 0) + (amount1 * lpBalance) / total_share; +} + +async function queryContractStore({ + contract, + queryParam, + block, + chain = false, +}) { + if (typeof queryParam !== "string") queryParam = JSON.stringify(queryParam); + const url = `contracts/${contract}/store?query_msg=${queryParam}`; + return query(url, block, chain); +} + +async function sumTokens({ balances = {}, owners = [], chain, owner }) { + if (owner) owners = [owner] + log(chain, "fetching balances for ", owners.length); + let parallelLimit = 25; const { errors } = await PromisePool.withConcurrency(parallelLimit) .for(owners) - .process(async (owner) => getBalance2({ balances, owner, chain, })) + .process(async (owner) => getBalance2({ balances, owner, chain })); - if (errors && errors.length) - throw errors[0] - return transformBalances(chain, balances) + if (errors && errors.length) throw errors[0]; + return transformBalances(chain, balances); } module.exports = { endPoints, totalSupply, getBalance, + getBalance2, getDenomBalance, unwrapLp, query, queryV1Beta1, queryContractStore, - sumSingleBalance, queryContract, + queryContracts, sumTokens, -} + getTokenBalance, + getToken, +}; diff --git a/projects/helper/chain/elrond.js b/projects/helper/chain/elrond.js index 9c1ebcccf0e..c489ccff681 100644 --- a/projects/helper/chain/elrond.js +++ b/projects/helper/chain/elrond.js @@ -1,70 +1,93 @@ -const { get, graphQuery } = require('../http') -const { getCoreAssets, tokens: TOKENS } = require('../tokenMapping') +const ADDRESSES = require('../coreAssets.json') +const { get } = require('../http') const { transformBalances } = require('../portedTokens') const sdk = require('@defillama/sdk') -const chain = 'elrond' +const { post } = require('../http') +const { getEnv } = require('../env') -const API_HOST = 'https://api.elrond.com' -const MAIAR_GRAPH = 'https://graph.maiar.exchange/graphql' -const unknownTokenList = ["CYBER-489c1c", "CPA-97530a"] -let prices +const call = async ({ target, abi, params = [], responseTypes = [] }) => { + const data = await post(getEnv('MULTIVERSX_RPC') + '/query', { scAddress: target, funcName: abi, args: params, }) -async function getTokenPrices() { - if (!prices) prices = _getPrices() - return prices + const response = data.returnData.map(parseResponses) + return responseTypes.length === 1 ? response[0] : response - async function _getPrices() { - const query = `{ - tokens (identifiers: ${JSON.stringify(unknownTokenList)}){ - price - decimals - derivedEGLD - identifier - } - }` - const { tokens } = await graphQuery(MAIAR_GRAPH, query) - const res = {} - tokens.forEach(i => res[i.identifier] = i.derivedEGLD * 1e18/(10 ** i.decimals)) - return res + // https://github.com/multiversx/mx-sdk-js-core/blob/main/src/smartcontracts/resultsParser.ts + function parseResponses(item, idx) { + const buffer = Buffer.from(item || "", "base64") + switch (responseTypes[idx]) { + case 'number': return parseNumber(buffer) + default: throw new Error('Unknown/unsupported data type') + } } -} + + function parseNumber(buffer) { + // https://github.com/juanelas/bigint-conversion/blob/master/src/ts/index.ts#L63 + buffer = new Uint8Array(buffer) + let bits = 8n + + let ret = 0n + for (const i of buffer.values()) { + const bi = BigInt(i) + ret = (ret << bits) + bi + } + return ret.toString() + } +}; + +const chain = 'elrond' async function getElrondBalance(address) { - const { data: { account: { balance } } } = await get(`${API_HOST}/address/${address}`) + const { data: { account: { balance } } } = await get(`${getEnv('MULTIVERSX_RPC')}/address/${address}`) return balance } +const nullAddress = ADDRESSES.null -async function getTokens({ address, balances = {}, tokens = [], blacklistedTokens = [] }) { - const prices = await getTokenPrices() - const coreAssets = new Set(getCoreAssets('elrond')) - const res = await get(`${API_HOST}/accounts/${address}/tokens?size=1000`) +async function getTokens({ address, balances = {}, tokens = [], blacklistedTokens = [], whitelistedTokens = [], }) { + const res = await get(`${getEnv('MULTIVERSX_RPC')}/accounts/${address}/tokens?size=1000`) res.filter(i => i.type === 'FungibleESDT') .forEach(i => { const token = i.identifier if (tokens.length && !tokens.includes(token)) return; // sum only whitelistedTokens + if (whitelistedTokens.length && !whitelistedTokens.includes(token)) return; // sum only whitelistedTokens if (blacklistedTokens.includes(token)) return; // skip blacklisted tokens - if (!coreAssets.has(token)) { - if (i.valueUsd) - return sdk.util.sumSingleBalance(balances, TOKENS.usdt, i.valueUsd * 1e6) - - if (prices[token]) - return sdk.util.sumSingleBalance(balances, TOKENS.null, (prices[token] * i.balance).toFixed(0), chain) - } - return sdk.util.sumSingleBalance(balances, token, i.balance / (10 ** i.decimals), chain) + return sdk.util.sumSingleBalance(balances, token, i.balance, chain) }) return balances } -async function sumTokens({ owners = [], tokens = [], balances = {}, blacklistedTokens = [], }) { - await Promise.all(owners.map(i => getTokens({ address: i, balances, tokens, blacklistedTokens, }))) - if (!tokens.length || tokens.includes(TOKENS.null)) +async function sumTokens({ owners = [], tokens = [], balances = {}, blacklistedTokens = [], tokensAndOwners = [], whitelistedTokens = [] }) { + if (tokensAndOwners.length) { + await Promise.all(tokensAndOwners.map(([token, owner]) => sumTokens({ owners: [owner], tokens: [token], balances, blacklistedTokens, whitelistedTokens, }))) + return balances + } + + await Promise.all(owners.map(i => getTokens({ address: i, balances, tokens, blacklistedTokens, whitelistedTokens, }))) + if (!tokens.length || tokens.includes(nullAddress)) await Promise.all(owners.map(async i => { const bal = await getElrondBalance(i) - sdk.util.sumSingleBalance(balances, TOKENS.null, bal, chain) + sdk.util.sumSingleBalance(balances, nullAddress, bal, chain) })) return transformBalances(chain, balances) } +async function getNFTs(address) { + const res = await get(`${getEnv('MULTIVERSX_RPC')}/accounts/${address}/nfts?size=1000`) + return res +} + +async function getTokenData(token) { + const data = await get(`https://api.multiversx.com/tokens/${token}`) + return data +} + +async function sumTokensExport(...args) { + return () => sumTokens(...args) +} + module.exports = { sumTokens, + call, + getNFTs, + getTokenData, + sumTokensExport, } \ No newline at end of file diff --git a/projects/helper/chain/ergo.js b/projects/helper/chain/ergo.js new file mode 100644 index 00000000000..1ca8efd45ec --- /dev/null +++ b/projects/helper/chain/ergo.js @@ -0,0 +1,45 @@ +const ADDRESSES = require('../coreAssets.json') +const axios = require("axios") +const sdk = require('@defillama/sdk') +const chain = 'ergo' + +const API_HOST = 'https://api.ergoplatform.com/api/v1' + +const nullAddress = ADDRESSES.null + +async function queryTree({ address, params = {}}) { + const { data } = await axios.get(`${API_HOST}/boxes/unspent/byErgoTree/${address}`, { + params, + }) + return data +} + +async function getTokens({ address, balances = {}, tokens = [], blacklistedTokens = [] }) { + const { data: { confirmed: { nanoErgs, tokens: tokenData}}} = await axios.get(`${API_HOST}/addresses/${address}/balance/total`) + tokenData.push({ tokenId: nullAddress, amount: nanoErgs ?? 0 }) + tokenData.forEach(({ tokenId, amount }) => { + if (tokens.length && !tokens.includes(tokenId)) return; // sum only whitelistedTokens + if (blacklistedTokens.includes(tokenId)) return; // skip blacklisted tokens + sdk.util.sumSingleBalance(balances, tokenId, amount, chain) + }) +} + +async function sumTokens({ owners = [], tokens = [], balances = {}, blacklistedTokens = [], tokensAndOwners = [], owner,}) { + if (owner) owners = [owner] + if (tokensAndOwners.length) { + await Promise.all(tokensAndOwners.map(([token, owner]) => sumTokens({ owners: [owner], tokens: [token], balances, blacklistedTokens, }))) + return balances + } + + await Promise.all(owners.map(i => getTokens({ address: i, balances, tokens, blacklistedTokens, }))) + return balances +} + +function sumTokensExport(args) { + return () => sumTokens(args) +} + +module.exports = { + sumTokens, + sumTokensExport, +} \ No newline at end of file diff --git a/projects/helper/chain/hbar.js b/projects/helper/chain/hbar.js index 59e6fc10c8b..bd45b00ac9a 100644 --- a/projects/helper/chain/hbar.js +++ b/projects/helper/chain/hbar.js @@ -10,6 +10,11 @@ async function getHBARBalance(address, timestamp) { return response.balances[0].balance } +async function getCurrentBlock() { + const { blocks: [{ number }]} = await http.get(HBAR_API_V1+'/blocks?limit=1&order=desc') + return number +} + async function addHBarBalance({ balances = {}, address, timestamp }) { let balance = await getHBARBalance(address, timestamp) balance = BigNumber(balance).shiftedBy(-1 * 8).toFixed(0) @@ -25,5 +30,6 @@ async function sumTokens({ balances = {}, owners = [], timestamp }) { module.exports = { addHBarBalance, - sumTokens + sumTokens, + getCurrentBlock, } \ No newline at end of file diff --git a/projects/helper/chain/injective.js b/projects/helper/chain/injective.js index 53b08d0531f..e0a674aea84 100644 --- a/projects/helper/chain/injective.js +++ b/projects/helper/chain/injective.js @@ -1,5 +1,5 @@ const { getNetworkInfo, Network } = require('@injectivelabs/networks') -const { protoObjectToJson, IndexerGrpcSpotApi, IndexerGrpcDerivativesApi } = require('@injectivelabs/sdk-ts') +const { protoObjectToJson, IndexerGrpcSpotApi, IndexerGrpcDerivativesApi, } = require('@injectivelabs/sdk-ts') const { sliceIntoChunks } = require('../utils') let clients = {} @@ -14,9 +14,9 @@ function getClient(type = TYPES.SPOT) { if (!clients[type]) { const network = getNetworkInfo(Network.Mainnet) if (type === TYPES.SPOT) - clients[type] = new IndexerGrpcSpotApi(network.exchangeWeb3GatewayApi); + clients[type] = new IndexerGrpcSpotApi(network.indexerApi); else if (type === TYPES.DERIVATIVES) - clients[type] = new IndexerGrpcDerivativesApi(network.exchangeWeb3GatewayApi) + clients[type] = new IndexerGrpcDerivativesApi(network.indexerApi) else throw new Error('Unknown type') } @@ -32,7 +32,7 @@ async function getOrders({ type = TYPES.SPOT, marketIds }) { const chunks = sliceIntoChunks(marketIds, 20) const response = [] for (const chunk of chunks) - response.push(...await getClient(type).fetchOrderbooks(chunk)) + response.push(...await getClient(type).fetchOrderbooksV2(chunk)) return response } @@ -42,4 +42,4 @@ module.exports = { p2j, getMarkets, getOrders, -} \ No newline at end of file +} diff --git a/projects/helper/chain/libre.js b/projects/helper/chain/libre.js new file mode 100644 index 00000000000..32743bbe9da --- /dev/null +++ b/projects/helper/chain/libre.js @@ -0,0 +1,94 @@ +const { get, post, } = require('../http') +const CHAIN_RPC = 'https://lb.libre.org'; +const API_URL = 'https://dashboard-api.libre.org'; + +async function getTableRows({ + json = true, + code, + scope, + table, + lower_bound = '', + upper_bound = '', + index_position = 1, + key_type = '', + limit = -1, + reverse = false, + show_payer = false, +}) { + const data = await post( + `${CHAIN_RPC}/v1/chain/get_table_rows`, + { + json, + code, + scope, + table, + lower_bound, + upper_bound, + index_position, + key_type, + limit, + reverse, + show_payer, + } + ); + return data; +} + +async function getFullTable({ + code, + scope, + table, + lower_bound, + upper_bound, +}) { + let { rows, more, next_key } = await getTableRows({ + code, + scope, + table, + lower_bound, + upper_bound, + limit: -1 + }) + + if (more) { + rows = rows.concat(await getFullTable({ + code, + scope, + table, + lower_bound: next_key, + upper_bound + })) + } + + return rows +} + +async function getCurrencyBalance(code, account, symbol) { + const data = await post( + CHAIN_RPC + '/v1/chain/get_currency_balance', + JSON.stringify({ + code, + account, + symbol + }) + ); + return data; +} + +async function getExchangeRates() { + return get(`${API_URL}/exchange-rates`); +} + +async function getTokenUSDPrice(tokenSymbol) { + tokenSymbol = tokenSymbol.toUpperCase(); + const tokens = getExchangeRates(); + return tokens[tokenSymbol]; +} + +module.exports = { + getTableRows, + getFullTable, + getTokenUSDPrice, + getExchangeRates, + getCurrencyBalance, +} \ No newline at end of file diff --git a/projects/helper/chain/litecoin.js b/projects/helper/chain/litecoin.js index 092c830d881..f24b942d5b7 100644 --- a/projects/helper/chain/litecoin.js +++ b/projects/helper/chain/litecoin.js @@ -1,10 +1,13 @@ const sdk = require('@defillama/sdk') const { get } = require('../http') -const url = addr => 'https://chainz.cryptoid.info/ltc/api.dws?q=getbalance&a=' + addr +// const url = addr => 'https://chainz.cryptoid.info/ltc/api.dws?q=getbalance&a=' + addr +const url = addr => 'https://ltc.tokenview.io/api/address/balancetrend/ltc/' + addr async function getBalance(addr) { - return get(url(addr)) + // return get(url(addr)) + const {data} = await get(url(addr)) + return +Object.values(data[0])[0] } async function sumTokens({ balances = {}, owners = [] }) { diff --git a/projects/helper/chain/near.js b/projects/helper/chain/near.js index b36ee8c4f05..4076476ac80 100644 --- a/projects/helper/chain/near.js +++ b/projects/helper/chain/near.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../coreAssets.json') const axios = require("axios") const { default: BigNumber } = require("bignumber.js") const sdk = require('@defillama/sdk') @@ -16,7 +17,8 @@ const endpoint = "https://rpc.mainnet.near.org" const tokenMapping = { 'wrap.near': { name: 'near', decimals: 24, }, 'meta-pool.near': { name: 'staked-near', decimals: 24, }, - 'linear-protocol.near': { name: 'linear-protocol', decimals: 24, }, + [ADDRESSES.near.LINA]: { name: 'linear-protocol', decimals: 24, }, + "storage.herewallet.near": { name: 'here-staking', decimals: 24, }, 'usn': { name: 'usn', decimals: 18, }, 'aurora': { name: 'ethereum', decimals: 18, }, 'token.skyward.near': { name: 'skyward-finance', decimals: 18, }, @@ -33,11 +35,11 @@ const tokenMapping = { // '6b175474e89094c44da98b954eedeac495271d0f.factory.bridge.near': { name: 'dai', decimals: 18 }, // 'a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48.factory.bridge.near': { name: 'usd-coin', decimals: 6 }, // 'dac17f958d2ee523a2206206994597c13d831ec7.factory.bridge.near': { name: 'tether', decimals: 6 }, - // '2260fac5e5542a773aa44fbcfedf7c193bc2c599.factory.bridge.near': { name: '0x2260fac5e5542a773aa44fbcfedf7c193bc2c599', decimals: 0 }, + // '2260fac5e5542a773aa44fbcfedf7c193bc2c599.factory.bridge.near': { name: ADDRESSES.ethereum.WBTC, decimals: 0 }, // 'aaaaaa20d9e0e2461697782ef11675f668207961.factory.bridge.near': { name: 'aurora-near', decimals: 18 }, - 'token.burrow.near': { name: 'burrow', decimals: 18 }, - 'token.paras.near': { name: 'paras', decimals: 18 }, - 'token.pembrock.near': { name: 'pembrock', decimals: 18 }, + [ADDRESSES.near.BURROW]: { name: 'burrow', decimals: 18 }, + [ADDRESSES.near.PARAS]: { name: 'paras', decimals: 18 }, + [ADDRESSES.near.PEMBROCK]: { name: 'pembrock', decimals: 18 }, 'token.sweat': { name: 'sweatcoin', decimals: 18 }, 'v2-nearx.stader-labs.near': { name: 'stader-nearx', decimals: 24 }, } diff --git a/projects/helper/chain/obyte.js b/projects/helper/chain/obyte.js index 1b8b2eef259..99d1aa4f9c3 100644 --- a/projects/helper/chain/obyte.js +++ b/projects/helper/chain/obyte.js @@ -1,5 +1,8 @@ const utils = require('../utils') +const OBYTE_HUB_ENDPOINT = "https://obyte.org/api"; +const TOKEN_REGISTRY_AA_ADDRESS = "O6H6ZIFI57X3PLTYHOCVYPP5A553CYFQ"; + /** * @param {number} timestamp - unix timestamp in seconds from epoch of the moment in time for which the balances are requested * @param {string} address - the Obyte address of the base AA for which the balances are fetched @@ -240,11 +243,40 @@ async function fetchOstableExchangeRatesInUSD() { } } +function getAaStateVars(address, var_prefix) { + return utils.postURL(`${OBYTE_HUB_ENDPOINT}/get_aa_state_vars`, { address, var_prefix })?.then(({ data }) => data?.data); +} + +function executeGetter(address, getter, args) { + return utils.postURL(`${OBYTE_HUB_ENDPOINT}/execute_getter`, { address, getter, args })?.then(({ data }) => data?.data?.result); +} + +function getBalances(addresses) { + return utils.postURL(`${OBYTE_HUB_ENDPOINT}/get_balances`, { addresses })?.then(({ data }) => data?.data); +} + +async function getDecimalsByAsset(asset) { + if (asset === 'base' || asset === 'GBYTE') return 9; + + const descHash = await getAaStateVars(TOKEN_REGISTRY_AA_ADDRESS, `current_desc_${asset}`).then(vars => vars?.[`current_desc_${asset}`]); + + if (descHash) { + return getAaStateVars(TOKEN_REGISTRY_AA_ADDRESS, `decimals_${descHash}`).then(vars => vars?.[`decimals_${descHash}`] ?? 0); + } else { + return 0; + } +} + module.exports = { fetchBaseAABalances, fetchOswapExchangeRates, fetchOswapAssets, fetchOstableAssets, fetchOstableExchangeRatesInUSD, - summingBaseAABalancesToTvl + summingBaseAABalancesToTvl, + getAaStateVars, + executeGetter, + fetchOswapV2Assets, + getDecimalsByAsset, + getBalances } diff --git a/projects/helper/chain/proton.js b/projects/helper/chain/proton.js index 4d039ddf2c7..587f1182fff 100644 --- a/projects/helper/chain/proton.js +++ b/projects/helper/chain/proton.js @@ -1,5 +1,5 @@ const { get, post, } = require('../http') -const CHAIN_RPC = 'https://proton.greymass.com'; +const CHAIN_RPC = 'https://proton.eoscafeblock.com'; const SWAP_CONTRACT = 'proton.swaps'; const ORACLES_CONTRACT = 'oracles'; diff --git a/projects/helper/chain/stacks-api.js b/projects/helper/chain/stacks-api.js new file mode 100644 index 00000000000..e61045874e9 --- /dev/null +++ b/projects/helper/chain/stacks-api.js @@ -0,0 +1,33 @@ +const stacks = require('@stacks/transactions') +const { StacksMainnet } = require('@stacks/network') + +const { bufferCVFromString, callReadOnlyFunction, uintCV, principalCV, } = stacks +let network + +const senderAddress = 'ST2F4BK4GZH6YFBNHYDDGN4T1RKBA7DA1BJZPJEJJ' + +function getNetwork() { + if (!network) + network = new StacksMainnet() + return network +} + +async function call({ target, abi, inputArgs = [], }) { + const [contractAddress, contractName] = target.split('.') + const network = getNetwork() + const result = await callReadOnlyFunction({ network, contractAddress, contractName, functionName: abi, functionArgs: inputArgs.map(toClairty), senderAddress}); + return stacks.cvToValue(result) + + function toClairty(arg) { + switch (arg.type) { + case 'string': return bufferCVFromString(arg.value) + case 'number': return uintCV(arg.value) + case 'principal': return principalCV(arg.value) + default: throw new Error(`Unknown type ${arg.type}`) + } + } +} + +module.exports = { + call, +} diff --git a/projects/helper/chain/stacks.js b/projects/helper/chain/stacks.js new file mode 100644 index 00000000000..04989fd2cf7 --- /dev/null +++ b/projects/helper/chain/stacks.js @@ -0,0 +1,50 @@ +const { get, } = require('../http') +const { nullAddress } = require('../tokenMapping') +const sdk = require('@defillama/sdk') +const chain = 'stacks' + +const STACKS_API = 'https://stacks-node-api.mainnet.stacks.co/extended/v1/address' + +async function getStacksBalances(address) { + const url = `${STACKS_API}/${address}/balances` + return get(url) +} + +async function addStacks(address, balances = {}) { + const stx_balance = (await getStacksBalances(address)).stx.balance + sdk.util.sumSingleBalance(balances, nullAddress, stx_balance, chain) + return balances +} + +async function addTokens(address, { balances = {}, tokens = [], blacklistedTokens = [] }) { + const { + fungible_tokens, stx, + } = await getStacksBalances(address) + + if ((!tokens.length || tokens.includes(nullAddress)) && (!blacklistedTokens.length || !blacklistedTokens.includes(nullAddress))) + sdk.util.sumSingleBalance(balances, nullAddress, stx.balance, chain) + + Object.keys(fungible_tokens) + .filter(token => { + if (tokens.length && !tokens.includes(token)) return false + if (blacklistedTokens.length && blacklistedTokens.includes(token)) return false + return true + }) + .forEach(token => sdk.util.sumSingleBalance(balances, token, fungible_tokens[token].balance, chain)) +} + +async function sumTokens({ owner, owners = [], tokens = [], balances = {}, blacklistedTokens = [], tokensAndOwners = [] }) { + if (tokensAndOwners.length) { + await Promise.all(tokensAndOwners.map(([token, owner]) => addTokens(owner, { tokens: [token], balances, blacklistedTokens, }))) + return balances + } + if (owner) owners = [owner] + + await Promise.all(owners.map(i => addTokens(i, { balances, tokens, blacklistedTokens, }))) + return balances +} + +module.exports = { + sumTokens, + addStacks, +} \ No newline at end of file diff --git a/projects/helper/chain/starknet.js b/projects/helper/chain/starknet.js new file mode 100644 index 00000000000..80d16363e0b --- /dev/null +++ b/projects/helper/chain/starknet.js @@ -0,0 +1,100 @@ +// https://www.starknetjs.com/docs/API/contract +const { getUniqueAddresses} = require('../tokenMapping') +const { Provider, Contract, validateAndParseAddress, number, } = require('starknet') +const { PromisePool } = require('@supercharge/promise-pool') + +let provider + +function getProvider() { + if (!provider) + provider = new Provider({ + sequencer: { + network: 'mainnet-alpha' + } + }) + return provider +} + +async function call({ abi, target, params = [], allAbi = [] }) { + if ((params || params === 0) && !Array.isArray(params)) + params = [params] + const contract = new Contract([abi, ...allAbi, ], target, getProvider()) + const response = await contract[abi.name](...params) + if (abi.outputs.length === 1) return response[0] + return response +} + +async function multiCall({ abi: rootAbi, target: rootTarget, calls = [], allAbi = [] }) { + calls = calls.map((callArgs) => { + if (typeof callArgs !== 'object') { + if (!rootTarget) return { target: callArgs, abi: rootAbi, allAbi, } + return { target: rootTarget, params: callArgs, abi: rootAbi, allAbi, } + } + const { target, params, abi } = callArgs + return { target: target || rootTarget, params, abi: abi || rootAbi } + }) + + const { results, errors } = await PromisePool.withConcurrency(7) + .for(calls) + .process(async (args, i) => ([i, await call(args)])) + + if (errors && errors.length) + throw errors[0] + + results.sort(([a], [b]) => a -b) // workaround for Promise Pool fucking up the order + return results.map(i => i[1]) +} + +const balanceOfABI = { + "name": "balanceOf", + "type": "function", + "inputs": [ + { + "name": "account", + "type": "felt" + } + ], + "outputs": [ + { + "name": "balance", + "type": "Uint256" + } + ], + "stateMutability": "view" +} + + +async function sumTokens({ owner, owners = [], tokens = [], tokensAndOwners = [], blacklistedTokens = [], token, api, }) { + if (token) tokens = [token] + if (owner) owners = [owner] + + owners = getUniqueAddresses(owners, 'starknet') + blacklistedTokens = getUniqueAddresses(blacklistedTokens, 'starknet') + + if (!tokensAndOwners.length) { + if (!owners.length && owner) + owners = [owner] + + tokensAndOwners = tokens.map(t => owners.map(o => ([t, o]))).flat() + } + + tokensAndOwners = getUniqueToA(tokensAndOwners, 'starknet') + tokensAndOwners = tokensAndOwners.filter(i => !blacklistedTokens.includes(i[0])) + const res = await multiCall({ abi: balanceOfABI, calls: tokensAndOwners.map(i => ({ target: i[0], params: i[1]}))}) + res.forEach((v, i) => api.add(tokensAndOwners[i][0], +v)) + + + function getUniqueToA(toa, chain) { + toa = toa.map(i => i.join('¤')) + return getUniqueAddresses(toa, chain).map(i => i.split('¤')) + } +} + +module.exports = { + getProvider, + call, + multiCall, + parseAddress: validateAndParseAddress, + sumTokens, + number, +} \ No newline at end of file diff --git a/projects/helper/chain/sui.js b/projects/helper/chain/sui.js new file mode 100644 index 00000000000..a90941f0f24 --- /dev/null +++ b/projects/helper/chain/sui.js @@ -0,0 +1,143 @@ + +const sdk = require('@defillama/sdk') + +const http = require('../http') +const { getEnv } = require('../env') +const { transformDexBalances } = require('../portedTokens') +const { sliceIntoChunks } = require('../utils') + +//https://docs.sui.io/sui-jsonrpc + +const endpoint = () => getEnv('SUI_RPC') + +async function getObject(objectId) { + return (await call('sui_getObject', [objectId, { + "showType": true, + "showOwner": true, + "showContent": true, + }])).content +} + +async function queryEvents({ eventType, transform = i => i }) { + let filter = {} + if (eventType) filter.MoveEventType = eventType + const items = [] + let cursor = null + do { + const { data , nextCursor, hasNextPage } = await call('suix_queryEvents', [filter, cursor], { withMetadata: true, }) + cursor = hasNextPage ? nextCursor : null + items.push(...data) + } while (cursor) + return items.map(i => i.parsedJson).map(transform) +} + +async function getObjects(objectIds) { + if (objectIds.length > 49) { + const chunks = sliceIntoChunks(objectIds, 49) + const res = [] + for (const chunk of chunks) res.push(...(await getObjects(chunk))) + return res + } + const { + result + } = await http.post(endpoint(), { + jsonrpc: "2.0", id: 1, method: 'sui_multiGetObjects', params: [objectIds, { + "showType": true, + "showOwner": true, + "showContent": true, + }], + }) + return objectIds.map(i => result.find(j => j.data.objectId === i)?.data?.content) +} + +async function getDynamicFieldObject(parent, id) { + return (await call('suix_getDynamicFieldObject', [parent, { + "type": "0x2::object::ID", + "value": id + }])).content +} + +async function getDynamicFieldObjects({ parent, cursor = null, limit = 48, items = [], idFilter = i => i, addedIds = new Set() }) { + const { + result: { data, hasNextPage, nextCursor } + } = await http.post(endpoint(), { jsonrpc: "2.0", id: 1, method: 'suix_getDynamicFields', params: [parent, cursor, limit], }) + sdk.log('[sui] fetched items length', data.length, hasNextPage, nextCursor) + const fetchIds = data.filter(idFilter).map(i => i.objectId).filter(i => !addedIds.has(i)) + fetchIds.forEach(i => addedIds.add(i)) + const objects = await getObjects(fetchIds) + items.push(...objects) + if (!hasNextPage) return items + return getDynamicFieldObjects({ parent, cursor: nextCursor, items, limit, idFilter, addedIds }) +} + +async function call(method, params, { withMetadata = false} = {}) { + if (!Array.isArray(params)) params = [params] + const { + result + } = await http.post(endpoint(), { jsonrpc: "2.0", id: 1, method, params, }) + return withMetadata ? result : result.data +} + +async function multiCall(calls) { + return Promise.all(calls.map(i => call(...i))) +} + + +function dexExport({ + account, + poolStr, + token0Reserve = i => i.fields.coin_x_reserve, + token1Reserve = i => i.fields.coin_y_reserve, + getTokens = i => i.type.split('<')[1].replace('>', '').split(', '), + isAMM = true, + eventType, + eventTransform, +}) { + return { + timetravel: false, + misrepresentedTokens: true, + sui: { + tvl: async (_, _1, _2, { api }) => { + const data = [] + let pools + if (!eventType) { + pools = await getDynamicFieldObjects({ parent: account, idFilter: i => poolStr ? i.objectType.includes(poolStr) : i }) + } else { + pools = await queryEvents({ eventType, transform: eventTransform }) + pools = await getObjects(pools) + } + sdk.log(`[sui] Number of pools: ${pools.length}`) + pools.forEach(i => { + const [token0, token1] = getTokens(i) + if (isAMM) { + data.push({ + token0, + token1, + token0Bal: token0Reserve(i), + token1Bal: token1Reserve(i), + }) + } else { + api.add(token0, token0Reserve(i)) + api.add(token1, token1Reserve(i)) + } + }) + + if (!isAMM) return api.getBalances() + + return transformDexBalances({ chain: 'sui', data }) + } + } + } +} + +module.exports = { + endpoint: endpoint(), + call, + multiCall, + getObject, + getObjects, + queryEvents, + getDynamicFieldObject, + getDynamicFieldObjects, + dexExport, +}; diff --git a/projects/helper/chain/terra.js b/projects/helper/chain/terra.js deleted file mode 100644 index 23e877d2a90..00000000000 --- a/projects/helper/chain/terra.js +++ /dev/null @@ -1,164 +0,0 @@ -const axios = require('axios') -const { default: BigNumber } = require("bignumber.js") -const sdk = require('@defillama/sdk') - -function getEndpoint(isTerra2 = false) { - if (!isTerra2) - return process.env["TERRA_RPC"] || 'https://lcd.terra.dev' - return process.env["TERRA2_RPC"] || 'https://phoenix-lcd.terra.dev' -} - -async function query(url, block, isTerra2 = false) { - block = undefined - let endpoint = `${getEndpoint(isTerra2)}/wasm/${url}` - if (block !== undefined) { - endpoint += `&height=${block - (block % 100)}` - } - return (await axios.get(endpoint)).data.result -} - -const fetchAssets = async (path) => { - return (await axios.get(`https://assets.terra.money${path}`)) -} - -async function queryV1Beta1(url, paginationKey, block, { isTerra2 = false } = {}) { - let endpoint = `${getEndpoint(isTerra2)}/cosmos/${url}` - if (block !== undefined) { - endpoint += `?height=${block - (block % 100)}` - } - if (paginationKey) { - const paginationQueryParam = `pagination.key=${paginationKey}` - if (block === undefined) { - endpoint += "?" - } else { - endpoint += "&" - } - endpoint += paginationQueryParam - } - return (await axios.get(endpoint)).data -} - - -async function getBalance(token, owner, block, { isTerra2 = false } = {}) { - const data = await query(`contracts/${token}/store?query_msg={"balance":{"address":"${owner}"}}`, block, isTerra2) - return Number(data.balance) -} - -async function getDenomBalance(denom, owner, block, { isTerra2 = false } = {}) { - let endpoint = `${getEndpoint(isTerra2)}/bank/balances/${owner}` - if (block !== undefined) { - endpoint += `?height=${block - (block % 100)}` - } - const data = (await axios.get(endpoint)).data.result - - const balance = data.find(balance => balance.denom === denom); - return balance ? Number(balance.amount) : 0 -} - - -// LP stuff -async function totalSupply(token, block, { isTerra2 = false } = {}) { - const data = await query(`contracts/${token}/store?query_msg={"token_info":{}}`, block, isTerra2) - return data.total_supply -} - -async function lpMinter(token, block, { isTerra2 = false } = {}) { - const data = await query(`contracts/${token}/store?query_msg={"minter":{}}`, block, isTerra2) - return data.minter -} -async function queryContract({ contract, isTerra2 = false, data }) { - if (typeof data !== 'string') data = JSON.stringify(data) - data = Buffer.from(data).toString('base64') - - if(!isTerra2) { - let path = `${getEndpoint(isTerra2)}/terra/wasm/v1beta1/contracts/${contract}/store?query_msg=${data}`; - let result = await axios.get(path) - return (result).data.query_result - } - - return (await axios.get(`${getEndpoint(isTerra2)}/cosmwasm/wasm/v1/contract/${contract}/smart/${data}`)).data.data -} - -function getAssetInfo(asset) { - return [asset.info.native_token?.denom ?? asset.info.token?.contract_addr, Number(asset.amount)] -} - -async function unwrapLp(balances, lpToken, lpBalance, block, { isTerra2 = false } = {}) { - const pair = await lpMinter(lpToken) - const { assets, total_share } = await query(`contracts/${pair}/store?query_msg={"pool":{}}`, block); - const [token0, amount0] = getAssetInfo(assets[0]) - const [token1, amount1] = getAssetInfo(assets[1]) - balances[token0] = (balances[token0] ?? 0) + (amount0 * lpBalance / total_share) - balances[token1] = (balances[token1] ?? 0) + (amount1 * lpBalance / total_share) -} - -const tokenMapping = { - 'terra1xfsdgcemqwxp4hhnyk4rle6wr22sseq7j07dnn': { label: 'KIJU', decimals: 6, }, - 'terra188w26t95tf4dz77raftme8p75rggatxjxfeknw': { label: 'sKIJU', decimals: 6, }, - 'terra15k5r9r8dl8r7xlr29pry8a9w7sghehcnv5mgp6': { coingeckoId: 'lunaverse', decimals: 6, }, - 'terra1cl7whtrqmz5ldr553q69qahck8xvk80fm33qjx': { label: 'ALTO', decimals: 6, }, - 'terra1dy9kmlm4anr92e42mrkjwzyvfqwz66un00rwr5': { coingeckoId: 'valkyrie-protocol', decimals: 6, }, - 'terra14z56l0fp2lsf86zy3hty2z47ezkhnthtr9yq76': { coingeckoId: 'anchor-protocol', decimals: 6, }, - 'terra15gwkyepfc6xgca5t5zefzwy42uts8l2m4g40k6': { coingeckoId: 'mirror-protocol', decimals: 6, }, - 'terra17y9qkl8dfkeg4py7n0g5407emqnemc3yqk5rup': { coingeckoId: 'stader-lunax', decimals: 6, }, - 'terra1hzh9vpxhsk8253se0vv5jj6etdvxu3nv8z07zu': { coingeckoId: 'anchorust', decimals: 6, }, - 'terra1kc87mu460fwkqte29rquh4hc20m54fxwtsx7gp': { coingeckoId: 'bonded-luna', decimals: 6, }, - 'uluna': { coingeckoId: 'terra-luna', decimals: 6, }, - 'uusd': { coingeckoId: 'terrausd', decimals: 6, }, - 'terra1dzhzukyezv0etz22ud940z7adyv7xgcjkahuun': { coingeckoId: 'anchor-beth-token', decimals: 6, }, - 'terra1z3e2e4jpk4n0xzzwlkgcfvc95pc5ldq0xcny58': { coingeckoId: 'avalanche-2', decimals: 6, }, - 'terra1nef5jf6c7js9x6gkntlehgywvjlpytm7pcgkn4': { label: 'LOOP', decimals: 6, }, - 'terra1vwz7t30q76s7xx6qgtxdqnu6vpr3ak3vw62ygk': { coingeckoId: 'luart', decimals: 6, }, - 'terra1xj49zyqrwpv5k928jwfpfy2ha668nwdgkwlrg3': { coingeckoId: 'astroport', decimals: 6, }, -} - -const TOKEN_LIST = Object.keys(tokenMapping).reduce((agg, key) => { - const { coingeckoId, label } = tokenMapping[key] - agg[coingeckoId || label] = key - return agg -}, {}) - -async function queryContractStore({ contract, queryParam, block, isTerra2= false, }) { - if (typeof queryParam !== 'string') queryParam = JSON.stringify(queryParam) - const url = `contracts/${contract}/store?query_msg=${queryParam}` - return query(url, block, isTerra2) -} - -function sumSingleBalance(balances, token, balance, price) { - const { coingeckoId, label, decimals = 0, } = tokenMapping[token] || {} - - if (coingeckoId || (label && price)) { - token = coingeckoId || 'terrausd' - - if (decimals) - balance = BigNumber(balance).shiftedBy(-1 * decimals) - - if (!coingeckoId) - balance = balance.multipliedBy(BigNumber(price)) // convert the value to UST - - if (!balances[token]) - balances[token] = BigNumber(0) - else if (typeof balances[token] === 'string') - balances[token] = BigNumber(balances[token]).shiftedBy(-1 * decimals) - - balances[token] = balances[token].plus(balance) - return - } - - sdk.util.sumSingleBalance(balances, token, balance) - return balances -} - -module.exports = { - totalSupply, - getBalance, - getDenomBalance, - unwrapLp, - query, - queryV1Beta1, - fetchAssets, - queryContractStore, - sumSingleBalance, - queryContract, - TOKEN_LIST, -} diff --git a/projects/helper/chain/tezos.js b/projects/helper/chain/tezos.js index f8c3eb68495..49718444976 100644 --- a/projects/helper/chain/tezos.js +++ b/projects/helper/chain/tezos.js @@ -1,13 +1,12 @@ +const ADDRESSES = require('../coreAssets.json') const http = require('../http') const sdk = require('@defillama/sdk') -const { getFixBalancesSync, } = require('../portedTokens') -const { default: BigNumber } = require('bignumber.js') const { PromisePool } = require('@supercharge/promise-pool') -const { log } = require('../utils') const RPC_ENDPOINT = 'https://api.tzkt.io' -const usdtAddressTezos = 'KT1XnTn74bUtxHfDtBmm2bGZAQfhPbvKWR8o' +const usdtAddressTezos = ADDRESSES.tezos.USDt +const transformAddressDefault = t => 'tezos:' + t const tokenBlacklist = [ 'KT18quSVkqhbJS38d5sbRAEkXd5GoNqmAoro', @@ -21,24 +20,23 @@ const tokenBlacklist = [ 'KT1JXxK3bd39ayLiiBdKm2cdReYnVSG3bkzK', 'KT1FR9ij18K3dDExgFMBs7ppxfdGYzHiPo7c', 'KT1GhX6MzTHKcjkMTg1mwCPzam12HRjsp6Sf', - 'KT1C9X9s5rpVJGxwVuHEVBLYEdAQ1Qw8QDjH' + 'KT1C9X9s5rpVJGxwVuHEVBLYEdAQ1Qw8QDjH', + 'KT18fp5rcTW7mbWDmzFwjLDUhs5MeJmagDSZ-16', ] -async function getTokenBalances(account, includeTezosBalance = true) { +async function getTokenBalances(account, includeTezosBalance = true, { balances = {}, transformAddress = transformAddressDefault } = {}) { const response = await http.get(`${RPC_ENDPOINT}/v1/tokens/balances?account=${account}&sort.desc=balance&offset=0&limit=40&select=balance,token.id%20as%20id,token.contract%20as%20contract,token.tokenId%20as%20token_id`) - const balances = response.reduce((agg, item) => { + response.forEach((item) => { let token = item.contract.address if (item.token_id !== '0') token += '-' + item.token_id if (!tokenBlacklist.includes(token)) - agg[token] = item.balance - return agg - }, {}) + sdk.util.sumSingleBalance(balances, transformAddress(token), item.balance) + }) if (includeTezosBalance) - balances['tezos'] = await getTezosBalance(account) + sdk.util.sumSingleBalance(balances, transformAddress('tezos'), await getTezosBalance(account)) - if (balances.tezos === 0) delete balances.tezos return balances } @@ -64,15 +62,11 @@ async function getBigMapById(id, limit = 1000, offset = 0, key, value) { } async function addDexPosition({ balances = {}, account, transformAddress }) { - if (!transformAddress) transformAddress = t => 'tezos:' + t - const tokenBalances = await getTokenBalances(account) - Object.keys(tokenBalances).forEach(token => sdk.util.sumSingleBalance(balances, transformAddress(token), tokenBalances[token])) - return balances + return getTokenBalances(account, true, { balances, transformAddress }) } -async function resolveLPPosition({ balances = {}, owner, lpToken, transformAddress, ignoreList = [] }) { - if (!transformAddress) transformAddress = t => 'tezos:' + t - const LPBalances = await getTokenBalances(owner) +async function resolveLPPosition({ balances = {}, owner, lpToken, transformAddress = transformAddressDefault, ignoreList = [] }) { + const LPBalances = await getTokenBalances(owner, false, { transformAddress: i => i }) if (!LPBalances[lpToken]) return balances const data = await getStorage(lpToken) const admin = data.admin || data.exchangeAddress @@ -81,10 +75,10 @@ async function resolveLPPosition({ balances = {}, owner, lpToken, transformAddre if (ignoreList.includes(admin)) return balances - const tokenBalances = await getTokenBalances(admin) - const ownershipRatio = BigNumber(LPBalances[lpToken]).dividedBy(total_supply) + const tokenBalances = await getTokenBalances(admin, false, { transformAddress: i => i }) + const ownershipRatio = LPBalances[lpToken] / total_supply Object.keys(tokenBalances).forEach(token => { - const balance = BigNumber(tokenBalances[token]).multipliedBy(ownershipRatio).toFixed(0) + const balance = tokenBalances[token] * ownershipRatio sdk.util.sumSingleBalance(balances, transformAddress(token), balance) }) return balances @@ -94,8 +88,7 @@ async function sumTokens({ owners = [], balances = {}, includeTezos = false }) { const { errors } = await PromisePool.withConcurrency(10) .for(owners) .process(async item => { - const balance = await getTokenBalances(item, includeTezos) - Object.entries(balance).forEach(([token, bal]) => sdk.util.sumSingleBalance(balances, token, bal)) + await getTokenBalances(item, includeTezos, { balances }) }) if (errors && errors.length) @@ -104,59 +97,8 @@ async function sumTokens({ owners = [], balances = {}, includeTezos = false }) { return balances } - async function sumTokens2({ owners = [], balances = {}, includeTezos = false }) { - await sumTokens({ owners, balances, includeTezos }) - return convertBalances(balances) -} - -function fetchPrice() { - return http.get('https://api.teztools.io/token/prices') -} - - -let pricePromise - -async function getPrices() { - if (!pricePromise) pricePromise = fetchPrice() - const { contracts: pricesArray } = await pricePromise - const priceObj = {} - pricesArray.forEach(p => { - let label = p.tokenAddress - if (p.hasOwnProperty('tokenId') && p.tokenId !== 0) label += '-' + p.tokenId - priceObj[label] = p - }) - return priceObj -} - -async function convertBalances(balances) { - const prices = await getPrices() - const fixTezosBalances = getFixBalancesSync('tezos') - balances = fixTezosBalances(balances) - Object.entries(balances).forEach(([key, balance]) => { - const token = key.replace('tezos:', '') - if (!prices[token]) - return; - delete balances[key] - - const { decimals, usdValue, } = prices[token] - if (!usdValue || !decimals) return; - const bal = BigNumber(+balance * usdValue / 10 ** decimals).toFixed(0) - const inMillions = bal / 1e6 - if (inMillions > 0.2) log(inMillions, decimals, balance, usdValue, token) - balances.tether = BigNumber(+(balances.tether || 0) + +bal).toFixed(0) - }) - - return balances -} - -async function getLPs(dex) { - if (!pricePromise) pricePromise = fetchPrice() - const { contracts } = await pricePromise - const LPs = {} - for (const { pairs } of contracts) - pairs.filter(p => p.dex === dex).forEach(p => LPs[p.address] = p) - return Object.keys(LPs) + return sumTokens({ owners, balances, includeTezos }) } module.exports = { @@ -165,10 +107,8 @@ module.exports = { sumTokens2, getStorage, sumTokens, - convertBalances, getTokenBalances, addDexPosition, resolveLPPosition, - getLPs, getBigMapById, } diff --git a/projects/helper/chain/ton.js b/projects/helper/chain/ton.js new file mode 100644 index 00000000000..6a7d6e0d2da --- /dev/null +++ b/projects/helper/chain/ton.js @@ -0,0 +1,10 @@ +const { get } = require('../http') + +async function getTonBalance(addr) { + const res = await get(`https://tonapi.io/v1/account/getInfo?account=${addr}`) + return res.balance +} + +module.exports = { + getTonBalance, +} \ No newline at end of file diff --git a/projects/helper/chain/tron.js b/projects/helper/chain/tron.js index 3edda1f7ba9..02f07792cd4 100644 --- a/projects/helper/chain/tron.js +++ b/projects/helper/chain/tron.js @@ -1,166 +1,10 @@ -const axios = require('axios') -const BigNumber = require('bignumber.js') -const ethers = require('ethers') -const sdk = require('@defillama/sdk') -const { getUniqueAddresses, } = require('../utils') const { get, } = require('../http') -const { transformBalances, } = require('../portedTokens') -const { toHex } = require('tron-format-address') -const axiosObj = axios.create({ - baseURL: 'https://api.trongrid.io/', - headers: { - 'TRON-PRO-API-KEY': 'b5681c79-7e8e-4dcc-a290-86b4eb95157b', - 'Content-Type': 'application/json' - }, - timeout: 300000, -}) -const AbiCoder = ethers.utils.AbiCoder; -const ADDRESS_PREFIX_REGEX = /^(41)/; -const ADDRESS_PREFIX = "41"; -const accountData = { +async function getStakedTron(account) { + const data = await get(`https://apilist.tronscan.org/api/vote?candidate=${account}`) + return data.totalVotes } -async function getAccountDetails(account) { - if (!accountData[account]) - accountData[account] = get('https://apilist.tronscan.org/api/account?address=' + account) - return accountData[account] -} - -function encodeParams(inputs) { - let typesValues = inputs - let parameters = '' - - if (typesValues.length == 0) - return parameters - const abiCoder = new AbiCoder(); - let types = []; - const values = []; - - for (let i = 0; i < typesValues.length; i++) { - let { type, value } = typesValues[i]; - if (type == 'address') - value = value.replace(ADDRESS_PREFIX_REGEX, '0x'); - else if (type == 'address[]') - value = value.map(v => toHex(v).replace(ADDRESS_PREFIX_REGEX, '0x')); - types.push(type); - values.push(value); - } - - return abiCoder.encode(types, values).replace(/^(0x)/, ''); -} - -function decodeParams(types, output, ignoreMethodHash) { - - if (!output || typeof output === 'boolean') { - ignoreMethodHash = output; - output = types; - } - - if (ignoreMethodHash && output.replace(/^0x/, '').length % 64 === 8) - output = '0x' + output.replace(/^0x/, '').substring(8); - - const abiCoder = new AbiCoder(); - - if (output.replace(/^0x/, '').length % 64) - throw new Error('The encoded string is not valid. Its length must be a multiple of 64.'); - return abiCoder.decode(types, output).reduce((obj, arg, index) => { - if (types[index] == 'address') - arg = ADDRESS_PREFIX + arg.substr(2).toLowerCase(); - obj.push(arg); - return obj; - }, []); -} - -// api reference: https://developers.tron.network/reference -const owner_address = 'TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t' - -async function unverifiedCall(contract, functionSelector, parameter) { - var body = { - owner_address: owner_address, - contract_address: contract, - function_selector: functionSelector, - parameter: encodeParams(parameter), - visible: true, - }; - const axiosResponse = await axiosObj.post('/wallet/triggerconstantcontract', body) - return BigNumber("0x" + axiosResponse.data['constant_result'][0]) -} - -async function getUnverifiedTokenBalance(token, account) { - const data = await getAccountDetails(account) - const bal = data.trc20token_balances.find(i => i.tokenId === token)?.balance ?? 0 - return BigNumber(bal) -} - -async function getTokenDecimals(token, account) { - const data = await getAccountDetails(account) - return data.trc20token_balances.find(i => i.tokenId === token)?.tokenDecimal ?? 0 -} - -async function getTokenBalance(token, account) { - const [balance, decimals] = await Promise.all([ - getUnverifiedTokenBalance(token, account), - getTokenDecimals(token, account) - ]); - return Number(balance.toString()) / (10 ** decimals) -} - -async function getTrxBalance(account) { - const data = await getAccountDetails(account) - return data.balance + (data.totalFrozen || 0) -} - -const nullAddress = '0x0000000000000000000000000000000000000000' -const gasTokens = [nullAddress, '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee'] - -async function sumTokens({ - balances = {}, - tokensAndOwners = [], - tokens = [], - owners = [], - owner, - blacklistedTokens = [], -}) { - if (!tokensAndOwners.length) { - tokens = getUniqueAddresses(tokens, true) - owners = getUniqueAddresses(owners, true) - if (owner) tokensAndOwners = tokens.map(t => [t, owner]) - if (owners.length) tokensAndOwners = tokens.map(t => owners.map(o => [t, o])).flat() - } - tokensAndOwners = tokensAndOwners.filter(([token]) => !blacklistedTokens.includes(token)) - tokensAndOwners = getUniqueToA(tokensAndOwners) - - let tronBalanceInputs = [] - - tokensAndOwners = tokensAndOwners.filter(i => { - const token = i[0] - if (token !== nullAddress && !gasTokens.includes(token)) - return true - tronBalanceInputs.push(i[1]) - return false - }) - tronBalanceInputs = getUniqueAddresses(tronBalanceInputs, true) - - if (tronBalanceInputs.length) { - const bals = await Promise.all(tronBalanceInputs.map(getTrxBalance)) - bals.forEach(balance => sdk.util.sumSingleBalance(balances, nullAddress, balance)) - } - - const results = await Promise.all(tokensAndOwners.map(i => getUnverifiedTokenBalance(i[0], i[1]))) - - results.forEach((bal, i) => sdk.util.sumSingleBalance(balances, 'tron:' + tokensAndOwners[i][0], bal.toFixed(0))) - return transformBalances('tron', balances) - - function getUniqueToA(toa) { - toa = toa.map(i => i.join('-')) - return getUniqueAddresses(toa, true).map(i => i.split('-')) - } -} - module.exports = { - getTokenBalance, - getTrxBalance, - unverifiedCall, - sumTokens, + getStakedTron, } diff --git a/projects/helper/chain/waves.js b/projects/helper/chain/waves.js new file mode 100644 index 00000000000..30fd46c1e4b --- /dev/null +++ b/projects/helper/chain/waves.js @@ -0,0 +1,72 @@ +const axios = require('axios') +const API_HOST = "https://nodes.wavesnodes.com/"; // https://docs.waves.tech/en/waves-node/node-api/#api-of-pool-of-public-nodes + +const axiosObj = axios.create({ + baseURL: API_HOST, + headers: { + "User-Agent": "defillama", + "Content-Type": "application/json", + }, + timeout: 10000, +}); + +/** + * Get detailed information about a given asset. [See fields descriptions](https://docs.waves.tech/en/blockchain/token/#custom-token-parameters) + * @param {string} assetId - Asset ID base58 encoded + * @returns {{ + * assetId: string, + * issueHeight: number, + * issueTimestamp: number, + * issuer: string, + * issuerPublicKey: string, + * name: string, + * description: string, + * decimals: number, + * reissuable: boolean, + * quantity: number, + * scripted: boolean, + * minSponsoredAssetFee: number, + * originTransactionId: string + * }} Asset details + */ +async function assetDetails(assetId) { + const response = await axiosObj.get(`/assets/details/${assetId}`); + return response.data; +} + +/** + * Evaluates the provided expression, taking into account the deployed dApp contract + * @param {string} contract - Address of the deployed dApp contract + * @returns {{ + * address: string, + * expr: number, + * result: { type: string, value: string} + * }} Evaluated data + */ +async function scriptEvaluate(contract, expr) { + const response = await axiosObj.post(`/utils/script/evaluate/${contract}`, { + expr, + }); + return response.data; +} + +/** + * Read account data entries by a given key + * @param {string} address - Address base58 encoded + * @param {string} key - Data key + * @returns {{ + * key: string, + * type: string, + * value: any + * }} Data value + */ +async function data(address, key) { + const response = await axiosObj.get(`/addresses/data/${address}/${key}`); + return response.data; +} + +module.exports = { + assetDetails, + scriptEvaluate, + data, +}; diff --git a/projects/helper/chain/wavesAdapter.js b/projects/helper/chain/wavesAdapter.js index 4b1995b7e46..ae1d2efbed1 100644 --- a/projects/helper/chain/wavesAdapter.js +++ b/projects/helper/chain/wavesAdapter.js @@ -1,24 +1,34 @@ -const {getApiTvl} = require('../historicalApi') -const {fetchURL} = require('../utils') +const { getApiTvl } = require('../historicalApi') +const { fetchURL } = require('../utils') -const MINUTE = 60*1000 +const MINUTE = 60 * 1000 +const host = 'https://tvl.waves.tech/api/v1/history' -function wavesAdapter(endpoint, calcTvl){ +function wavesAdapter(uri, calcTvl) { + const endpoint = host + uri return async (time) => { - return getApiTvl(time, async()=>{ - const data = (await fetchURL(`${endpoint}?limit=1000&since=${time*1e3-10*MINUTE}`)).data - const last = data[data.length-1] + return getApiTvl(time, async () => { + const data = (await fetchURL(`${endpoint}?limit=1000&since=${time * 1e3 - 10 * MINUTE}`)).data + const last = data[data.length - 1] return calcTvl(last) - }, async()=>{ - const data = (await fetchURL(`${endpoint}?limit=1000&since=${time*1e3-6*60*MINUTE}`)).data - return data.map(item=>({ - date: item.createdAt/1e3, + }, async () => { + const data = (await fetchURL(`${endpoint}?limit=1000&since=${time * 1e3 - 6 * 60 * MINUTE}`)).data + return data.map(item => ({ + date: item.createdAt / 1e3, totalLiquidityUSD: calcTvl(item) })) }) } } -module.exports={ - wavesAdapter +function wavesExport(uri, calcTvl = item => item.totalLocked) { + return { + misrepresentedTokens: true, + timetravel: false, + waves: { tvl: wavesAdapter(uri, calcTvl) } + } +} + +module.exports = { + wavesAdapter, wavesExport, } \ No newline at end of file diff --git a/projects/helper/chains.json b/projects/helper/chains.json index 9826e45efe8..9cbc34087b8 100644 --- a/projects/helper/chains.json +++ b/projects/helper/chains.json @@ -1,171 +1,229 @@ [ - "ethereum", - "bsc", - "polygon", - "fantom", + "acala", + "algorand", + "aptos", "arbitrum", - "cronos", - "harmony", - "avax", - "heco", - "moonriver", - "solana", - "xdai", - "lamden", - "optimism", + "arbitrum_nova", + "astar", "aurora", - "okexchain", - "terra", - "eos", - "moonbeam", - "metis", - "iotex", - "celo", + "avax", + "base", + "bifrost", + "binance", + "bitcoin", + "bitcoincash", + "bitgert", + "bitindi", + "bittorrent", "boba", - "kcc", - "klaytn", - "oasis", - "staking", - "smartbch", - "fuse", - "tron", - "shiden", - "stacks", - "telos", + "boba_avax", + "boba_bnb", + "borrowed", + "bone", + "bsc", + "bytomsidechain", + "callisto", + "candle", + "canto", + "carbon", "cardano", - "pool2", - "algorand", - "near", - "kadena", - "kardia", - "songbird", + "celo", + "chihuahua", + "clover", + "clv", + "comdex", + "concordium", + "conflux", + "core", + "cosmos", + "coti", + "crab", + "crescent", + "cronos", "csc", - "wax", - "syscoin", - "velas", - "rsk", - "astar", + "cube", + "curio", + "defichain", + "dexit", + "dfk", + "doge", + "dogechain", + "echelon", "elastos", - "tomochain", - "theta", - "gochain", - "binance", - "polkadot", - "kusama", + "elrond", + "empire", + "energi", "energyweb", - "borrowed", - "wan", - "hpb", - "tezos", - "ontology", - "bitcoin", - "curio", - "hoo", + "enuls", + "eos", + "eos_evm", + "equilibrium", + "era", "ergo", - "conflux", - "polis", - "kava", - "ronin", - "liquidchain", - "elrond", - "neo", - "nahmii", - "ultra", - "proton", - "thundercore", - "ubiq", - "callisto", - "cosmos", - "palm", + "ethereum", "ethereumclassic", - "thorchain", + "ethpow", "everscale", - "icon", - "bittorrent", - "vechain", - "waves", - "vite", - "vive", - "meter", - "zilliqa", + "evmos", + "europa", + "fantom", + "findora", + "filecoin", + "flare", + "flow", + "functionx", + "fuse", + "fusion", + "genshiro", + "gochain", "godwoken", "godwoken_v1", - "zksync", - "zyx", + "goerli", + "gravitybridge", + "grove", + "harmony", + "heco", + "hedera", + "heiko", + "hoo", + "hpb", + "hydra", + "icon", + "icp", + "injective", + "interlay", + "iotex", + "juno", + "kadena", + "kardia", "karura", + "kava", + "kcc", + "kekchain", + "kintsugi", + "klaytn", + "kujira", + "kusama", + "lachain", + "lamden", + "lbry", + "libre", + "linea", + "liquidchain", + "litecoin", + "loop", + "lukso", + "lung", + "mantle", + "map", + "meta", + "meter", + "metis", + "migaloo", "milkomeda", "milkomeda_a1", - "evmos", - "dfk", - "crab", - "clover", - "hedera", - "rei", - "hydra", - "findora", + "mixin", + "moonbeam", + "moonriver", + "multivac", + "muuchain", + "nahmii", + "near", + "neo", + "neo3", + "neon_evm", + "neutron", + "nova", + "nuls", + "oasis", + "oas", + "obyte", + "okexchain", + "omax", + "ontology", + "ontology_evm", + "onus", + "optimism", + "ore", + "orai", "osmosis", - "bitgert", + "ozone", + "palette", + "palm", + "parallel", + "persistence", + "pgn", + "pokt", + "polis", + "polkadot", + "polygon", + "polygon_zkevm", + "pool2", + "posi", + "proton", + "pulse", + "quicksilver", + "quasar", "reef", - "bitcoincash", - "doge", - "litecoin", + "regen", + "rei", + "reichain", + "ripple", + "rollux", + "ronin", + "rsk", + "rvn", + "rpg", "secret", + "shiden", + "sifchain", + "smartbch", + "solana", + "songbird", "sora", - "candle", - "bifrost", + "stacks", "stafi", - "lachain", - "coti", - "obyte", - "carbon", - "neo3", - "energi", - "palette", - "bytomsidechain", + "staking", "starcoin", - "fusion", - "reichain", - "ontology_evm", - "terra2", - "clv", - "echelon", - "multivac", + "stargaze", + "starknet", "stellar", + "step", + "stride", + "sui", "sx", - "lbry", - "rvn", - "ore", - "acala", - "genshiro", - "flow", - "icp", - "nova", - "parallel", - "heiko", - "canto", - "dogechain", - "kintsugi", - "kujira", - "posi", - "arbitrum_nova", - "ripple", - "ultron", - "interlay", - "crescent", - "juno", + "syscoin", + "telos", + "tenet", + "terra", + "terra2", + "tezos", + "theta", + "thorchain", + "thundercore", + "tlchain", "tombchain", + "tomochain", + "ton", + "tron", + "ubiq", + "ultra", + "ultron", + "umee", + "vechain", + "velas", "vision", - "functionx", + "vite", + "vive", + "wan", + "waves", + "wax", + "wemix", + "xdai", "xdc", - "ethpow", - "cube", - "aptos", - "injective", - "kekchain", - "mixin", - "stride", - "muuchain", - "step", - "sifchain", - "defichain" + "xpla", + "zeniq", + "zilliqa", + "zksync", + "zyx" ] diff --git a/projects/helper/compound.js b/projects/helper/compound.js index 181fa6e9270..d819e42f83d 100644 --- a/projects/helper/compound.js +++ b/projects/helper/compound.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('./coreAssets.json') const sdk = require('@defillama/sdk'); const abi = require('./abis/compound.json'); @@ -6,6 +7,7 @@ const { requery } = require("./requery"); const { getChainTransform, getFixBalances, } = require('./portedTokens'); const { usdtAddress } = require('./balances'); const agoraAbi = require("./../agora/abi.json"); +const { sumTokens2, nullAddress, unwrapLPsAuto, } = require('./unwrapLPs') // ask comptroller for all markets array async function getAllCTokens(comptroller, block, chain, allMarketsAbi = abi['getAllMarkets']) { return (await sdk.api.abi.call({ @@ -18,7 +20,7 @@ async function getAllCTokens(comptroller, block, chain, allMarketsAbi = abi['get } // returns [{cToken, underlying}] -async function getMarkets(comptroller, block, chain, cether, cetheEquivalent, blacklist = [], abis={}) { +async function getMarkets(comptroller, block, chain, cether, cetheEquivalent, blacklist = [], abis = {}) { const marketKey = `${chain}:${comptroller}:${block}` if (!marketsCache[marketKey]) marketsCache[marketKey] = _getMarkets() @@ -36,11 +38,11 @@ async function getMarkets(comptroller, block, chain, cether, cetheEquivalent, bl return; } if (cToken === '0x4Ddc2D193948926D02f9B1fE9e1daa0718270ED5'.toLowerCase()) { - markets.push({ underlying: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', cToken }) //cETH => WETH + markets.push({ underlying: ADDRESSES.ethereum.WETH, cToken }) //cETH => WETH return; } if (cToken === '0x5C0401e81Bc07Ca70fAD469b451682c0d747Ef1c'.toLowerCase() && chain === 'avax') { - markets.push({ underlying: '0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7', cToken }) + markets.push({ underlying: ADDRESSES.avax.WAVAX, cToken }) return; } if (['0xd2ec53e8dd00d204d3d9313af5474eb9f5188ef6', '0x0aeadb9d4c6a80462a47e87e76e487fa8b9a37d7'].includes(cToken) && chain === 'rsk') { @@ -89,7 +91,7 @@ async function unwrapPuffTokens(balances, lpPositions, block) { const newLpPositions = []; for (let i = 0; i < lpPositions.length; i++) { newLpPositions.push({ balance: lpPositions[i].balance * pricePerShare[i].output / 10 ** 18, token: underlying[i].output }) - }; + } await unwrapUniswapLPs( balances, @@ -97,24 +99,33 @@ async function unwrapPuffTokens(balances, lpPositions, block) { block, 'metis' ); -}; +} let marketsCache = {} -function getCompoundV2Tvl(comptroller, chain = "ethereum", transformAdress, - cether = "0x4Ddc2D193948926D02f9B1fE9e1daa0718270ED5", cetheEquivalent = "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", +function getCompoundV2Tvl(comptroller, chain, transformAdress, + cether = "0x4Ddc2D193948926D02f9B1fE9e1daa0718270ED5", cetheEquivalent = ADDRESSES.ethereum.WETH, borrowed = false, checkForLPTokens = undefined, { + fetchBalances = false, blacklistedTokens = [], - abis = { - getAllMarkets: abi['getAllMarkets'] - } + abis = {}, + resolveLPs = true, } = {}) { + abis = { ...abi, ...abis } blacklistedTokens = blacklistedTokens.map(i => i.toLowerCase()) - return async (timestamp, ethBlock, {[chain]: block}) => { + return async (timestamp, ethBlock, _, { api = undefined } = {}) => { + if (!api) { + api = new sdk.ChainApi({ chain, }) + } + chain = api.chain + const block = api.block if (!transformAdress) transformAdress = await getChainTransform(chain) let balances = {}; - let markets = await getMarkets(comptroller, block, chain, cether, cetheEquivalent, blacklistedTokens, abis); + let markets = await getMarkets(comptroller, block, chain, cether, cetheEquivalent, blacklistedTokens, abis) + if (!borrowed && fetchBalances) { + return sumTokens2({ api, tokensAndOwners: markets.map(i => [i.underlying, i.cToken]), blacklistedTokens, }) + } const cTokenCalls = markets.map(market => ({ target: market.cToken, })) @@ -123,7 +134,7 @@ function getCompoundV2Tvl(comptroller, chain = "ethereum", transformAdress, block, chain, calls: cTokenCalls, - abi: borrowed ? abi.totalBorrows : abi['getCash'], + abi: borrowed ? abis.totalBorrows : abis.getCash, }); let symbols; @@ -160,6 +171,9 @@ function getCompoundV2Tvl(comptroller, chain = "ethereum", transformAdress, } else if (lpPositions.length > 0) { await unwrapUniswapLPs(balances, lpPositions, block, chain, transformAdress) } + + if (resolveLPs) return unwrapLPsAuto({ balances, block, chain, abis}) + return balances; } } @@ -179,6 +193,7 @@ async function getOracle(block, chain, comptroller, oracleAbi) { } async function getUnderlyingDecimalsMultiple(block, chain, marketData, cether) { + marketData = marketData.filter(i => i.underlying) const response = {} const calls = marketData.map(i => ({ target: i.underlying })) const { output: decimals } = await sdk.api.abi.multiCall({ @@ -186,10 +201,12 @@ async function getUnderlyingDecimalsMultiple(block, chain, marketData, cether) { abi: "erc20:decimals", block, chain, + permitFailure: true, }) - decimals.forEach(({ output}, i) => { - response[marketData[i].cToken] = output + decimals.forEach(({ output }, i) => { + if (output !== null) + response[marketData[i].cToken] = output }) return response @@ -228,12 +245,13 @@ function getCompoundUsdTvl(comptroller, chain, cether, borrowed, abis = { underlyingPrice: abi['getUnderlyingPrice'], getAllMarkets: abi['getAllMarkets'] }, { - blacklist = [] + blacklist = [], + cetheEquivalent = undefined, } = {}) { - return async (timestamp, ethBlock, {[chain]: block}) => { + return async (timestamp, ethBlock, { [chain]: block }) => { let tvl = new BigNumber('0'); blacklist = blacklist.map(i => i.toLowerCase()) - const marketData = await getMarkets(comptroller, block, chain, cether, undefined, blacklist, abis) + const marketData = await getMarkets(comptroller, block, chain, cether, cetheEquivalent, blacklist, abis) let allMarkets = marketData.map(i => i.cToken); // allMarkets = allMarkets.filter(token => !blacklist.includes(token.toLowerCase())) // taken care of by getMarkets let oracle = await getOracle(block, chain, comptroller, abis.oracle); @@ -243,7 +261,7 @@ function getCompoundUsdTvl(comptroller, chain, cether, borrowed, abis = { allMarkets.forEach(token => { let amount = new BigNumber(amounts[token]); - let decimals = decimalsAll[token]; + let decimals = decimalsAll[token] ?? 0; let locked = amount.div(10 ** decimals); let underlyingPrice = new BigNumber(underlyingPrices[token]).div(10 ** (18 + 18 - decimals)) tvl = tvl.plus(locked.times(underlyingPrice)); @@ -252,25 +270,25 @@ function getCompoundUsdTvl(comptroller, chain, cether, borrowed, abis = { } } -function compoundExports(comptroller, chain, cether, cetheEquivalent, transformAdressRaw, checkForLPTokens, { blacklistedTokens = [] } = {}) { +function compoundExports(comptroller, chain, cether, cetheEquivalent, transformAdressRaw, checkForLPTokens, { blacklistedTokens = [], fetchBalances, abis = {}, resolveLPs=true } = {}) { if (cether !== undefined && cetheEquivalent === undefined) { throw new Error("You need to define the underlying for native cAsset") } return { - tvl: getCompoundV2Tvl(comptroller, chain, transformAdressRaw, cether, cetheEquivalent, false, checkForLPTokens, { blacklistedTokens }), - borrowed: getCompoundV2Tvl(comptroller, chain, transformAdressRaw, cether, cetheEquivalent, true, checkForLPTokens, { blacklistedTokens }) + tvl: getCompoundV2Tvl(comptroller, chain, transformAdressRaw, cether, cetheEquivalent, false, checkForLPTokens, { blacklistedTokens, fetchBalances, abis, resolveLPs }), + borrowed: getCompoundV2Tvl(comptroller, chain, transformAdressRaw, cether, cetheEquivalent, true, checkForLPTokens, { blacklistedTokens, fetchBalances, abis, resolveLPs }) } } -function compoundExportsWithAsyncTransform(comptroller, chain, cether, cetheEquivalent, transformAdressConstructor) { +function compoundExportsWithAsyncTransform(comptroller, chain, cether, cetheEquivalent, options) { return { tvl: async (...args) => { const transformAddress = await getChainTransform(chain) - return getCompoundV2Tvl(comptroller, chain, transformAddress, cether, cetheEquivalent)(...args) + return getCompoundV2Tvl(comptroller, chain, transformAddress, cether, cetheEquivalent, false, undefined, options)(...args) }, borrowed: async (...args) => { const transformAddress = await getChainTransform(chain) - return getCompoundV2Tvl(comptroller, chain, transformAddress, cether, cetheEquivalent, true)(...args) + return getCompoundV2Tvl(comptroller, chain, transformAddress, cether, cetheEquivalent, true, undefined, options)(...args) }, } } @@ -311,9 +329,14 @@ function compoundExportsWithDifferentBase(comptroller, chain, token) { } } +function compoundExports2({ comptroller, chain, cether, cetheEquivalent = nullAddress, transformAdressRaw, checkForLPTokens, blacklistedTokens = [], fetchBalances = true, abis = {} }) { + return compoundExports(comptroller, chain, cether, cetheEquivalent, transformAdressRaw, checkForLPTokens, { blacklistedTokens, fetchBalances, abis, }) +} + module.exports = { getCompoundV2Tvl, compoundExports, + compoundExports2, getCompoundUsdTvl, compoundExportsWithAsyncTransform, fullCoumpoundExports, diff --git a/projects/helper/compoundV3.js b/projects/helper/compoundV3.js new file mode 100644 index 00000000000..35ac14c2c3e --- /dev/null +++ b/projects/helper/compoundV3.js @@ -0,0 +1,42 @@ +const sdk = require("@defillama/sdk"); +const { lendingMarket } = require("./methodologies"); +const { sumTokens2 } = require('./unwrapLPs') + +module.exports = { + compoundV3Exports: config => { + const abi = { + numAssets: 'uint8:numAssets', + getAssetInfo: "function getAssetInfo(uint8 i) view returns (tuple(uint8 offset, address asset, address priceFeed, uint64 scale, uint64 borrowCollateralFactor, uint64 liquidateCollateralFactor, uint64 liquidationFactor, uint128 supplyCap))", + } + + const exportsObj = { + methodology: `${lendingMarket}. TVL is calculated by getting the market addresses from comptroller and calling the totalsCollaterals() on-chain method to get the amount of tokens locked in each of these addresses, then we get the price of each token from coingecko.`, + }; + Object.keys(config).forEach(chain => { + const { markets } = config[chain] + + async function borrowed(timestamp, block, _, { api }) { + const balances = {} + const tokens = await api.multiCall({ abi: 'address:baseToken', calls: markets }) + const bals = await api.multiCall({ abi: 'uint256:totalBorrow', calls: markets }) + bals.forEach((v, i) => sdk.util.sumSingleBalance(balances, tokens[i], v, api.chain)) + return balances + } + + async function tvl(timestamp, block, _, { api }) { + const toa = [] + await Promise.all(markets.map(async (m, i) => { + const items = await api.fetchList({ lengthAbi: abi.numAssets, itemAbi: abi.getAssetInfo, target: m }) + const tokens = items.map(i => i.asset) + const baseToken = await api.call({ abi: 'address:baseToken', target: m }) + tokens.push(baseToken) + toa.push([tokens, m]) + })) + return sumTokens2({ api, ownerTokens: toa }) + } + exportsObj[chain] = { tvl, borrowed } + }) + return exportsObj + } +}; + diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index 7c75b965086..714a50dad61 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -1,1161 +1,1350 @@ { - "ethereum": [ - "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", - "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", - "0x514910771af9ca656af840dff83e8264ecf986ca", - "0x1f9840a85d5af5bf1d1762f925bdaddc4201f984", - "0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9", - "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599", - "0xc011a73ee8576fb46f5e1c5751ca3b9fe0af2a6f", - "0x0bc529c00c6401aef6d220be8c6ea1667f6ad93e", - "0x6b175474e89094c44da98b954eedeac495271d0f", - "0x3aada3e213abf8529606924d8d1c55cbdc70bf74", - "0xc834fa996fa3bec7aad3693af486ae53d8aa8b50", - "0xfeef77d3f69374f66429c91d732a244f074bdf74", - "0xb8c77482e45f1f44de1745f52c74426c631bdd52", - "0xeb637a9ab6be83c7f8c79fdaa62e1043b65534f0", - "0x18084fba666a33d37592fa2633fd49a74dd93a88", - "0xef779cf3d260dbe6177b30ff08b10db591a6dd9c", - "0x42ef9077d8e79689799673ae588e046f8832cb95", - "0xd3d13a578a53685b4ac36a1bab31912d2b2a2f36", - "0x94671a3cee8c7a12ea72602978d1bb84e920efb2", - "0x2fc6e9c1b2c07e18632efe51879415a580ad22e1", - "0xeff721eae19885e17f5b80187d6527aad3ffc8de", - "0xdc0b02849bb8e0f126a216a2840275da829709b0", - "0x15a629f0665a3eb97d7ae9a7ce7abf73aeb79415", - "0x808d3e6b23516967ceae4f17a5f9038383ed5311", - "0xf49764c9c5d644ece6ae2d18ffd9f1e902629777", - "0xd3b5d9a561c293fb42b446fe7e237daa9bf9aa84", - "0xadf15ec41689fc5b6dca0db7c53c9bfe7981e655", - "0xc7d9c108d4e1dd1484d3e2568d7f74bfd763d356", - "0x65f7ba4ec257af7c55fd5854e5f6356bbd0fb8ec", - "0x0a5e677a6a24b2f1a2bf4f3bffc443231d2fdec8", - "0x2163383c1f4e74fe36c50e6154c7f18d9fd06d6f", - "0xf6b1c627e95bfc3c1b4c9b825a032ff0fbf3e07d", - "0xa80505c408c4defd9522981cd77e026f5a49fe63", - "0x97fe22e7341a0cd8db6f6c021a24dc8f4dad855f", - "0x0f83287ff768d1c1e17a42f44d644d7f22e8ee1d", - "0x9fcf418b971134625cdf38448b949c8640971671", - "0x8751d4196027d4e6da63716fa7786b5174f04c15", - "0xf56b164efd3cfc02ba739b719b6526a6fa1ca32a", - "0xb1c9bc94acd2fae6aabf4ffae4429b93512a81d2", - "0x5067006f830224960fb419d7f25a3a53e9919bb0", - "0x2e9d63788249371f1dfc918a52f8d799f4a38c94", - "0x6b3595068778dd592e39a122f4f5a5cf09c90fe2" - ], - "fantom": [ - "0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83", - "0x04068da6c83afcfa0e13ba15a6696662335d5b75", - "0x049d68029688eabf473097a2fc38ef61633a3c7a", - "0x8d11ec38a3eb5e956b052f67da8bdc9bef8abf3e", - "0x82f0b8b456c1a451378467398982d4834b6829c1", - "0x658b0c7613e890ee50b8c4bc6a3f41ef411208ad", - "0xbf07093ccd6adfc3deb259c557b61e94c1f66945", - "0x0a03d2c1cfca48075992d810cc69bd9fe026384a", - "0x97927abfe1abbe5429cbe79260b290222fc9fbba", - "0x6dfe2aaea9daadadf0865b661b53040e842640f8", - "0x920786cff2a6f601975874bb24c63f0115df7dc8", - "0x49c68edb7aebd968f197121453e41b8704acde0c", - "0x7345a537a975d9ca588ee631befddfef34fd5e8f", - "0xdbf31df14b66535af65aac99c32e9ea844e14501", - "0x4a89338a2079a01edbf5027330eac10b615024e5", - "0xc0d9784fdba39746919bbf236eb73bc015fd351d", - "0xe3a486c1903ea794eed5d5fa0c9473c7d7708f40", - "0x8cc97b50fe87f31770bcdcd6bc8603bc1558380b", - "0x95bf7e307bc1ab0ba38ae10fc27084bc36fcd605", - "0xc5cd01e988cd0794e05ab80f2bcdbdf13ce08bd3", - "0x7f620d7d0b3479b1655cefb1b0bc67fb0ef4e443" - ], - "csc": [ - "0xe6f8988d30614afe4f7124b76477add79c665822", - "0x398dca951cd4fc18264d995dcd171aa5debda129" - ], - "avax": [ - "0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7", - "0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e", - "0xc7198437980c041c805a1edcba50c1ce5db95118", - "0x9702230a8ea53601f5cd2dc00fdbc13d4df4a8c7", - "0x152b9d0fdc40c096757f570a51e494bd4b943e50", - "0xa7d7079b0fead91f3e65f86e8915cb59c1a4c664", - "0x49d5c2bdffac6ce2bfdb6640f4f80f226bc10bab", - "0x6e84a6216ea6dacc71ee8e6b0a5b7322eebc0fdd", - "0x008e26068b3eb40b443d3ea88c1ff99b789c10f7", - "0xaf2c034c764d53005cc6cbc092518112cbd652bb", - "0x57319d41f71e81f3c65f2a47ca4e001ebafd4f33", - "0x574679ec54972cf6d705e0a71467bb5bb362919d", - "0x2f28add68e59733d23d5f57d94c31fb965f835d0", - "0xf04d3a8eb17b832fbebf43610e94bdc4fd5cf2dd", - "0x1b156c5c75e9df4caab2a5cc5999ac58ff4f9090", - "0xd795d70ec3c7b990ffed7a725a18be5a9579c3b9", - "0xb6767518b205ea8b312d2ef4d992a2a08c2f2416", - "0xaf9f33df60ca764307b17e62dde86e9f7090426c", - "0x808d5f0a62336917da14fa9a10e9575b1040f71c", - "0x0665ef3556520b21368754fb644ed3ebf1993ad4", - "0x90a424754ad0d72cebd440faba18cdc362bfe70a", - "0x9debca6ea3af87bf422cea9ac955618ceb56efb4" - ], - "bsc": [ - "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c", - "0xe9e7cea3dedca5984780bafc599bd69add087d56", - "0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d", - "0x55d398326f99059ff775485246999027b3197955", - "0x2170ed0880ac9a755fd29b2688956bd959f933f8", - "0x23c5d1164662758b3799103effe19cc064d897d6", - "0xaec945e04baf28b135fa7c640f624f8d90f1c3a6", - "0x055dab90880613a556a5ae2903b2682f8a5b8d27", - "0x2d0e75b683e8b56243b429b24f2b08bcc1ffd8da", - "0xd32d01a43c869edcd1117c640fbdcfcfd97d9d65", - "0x702b3f41772e321aaccdea91e1fcef682d21125d", - "0x0feadcc3824e7f3c12f40e324a60c23ca51627fc", - "0x46d502fac9aea7c5bc7b13c8ec9d02378c33d36f", - "0xf83849122f769a0a7386df183e633607c890f6c0", - "0x1f534d2b1ee2933f1fdf8e4b63a44b2249d77eaf", - "0x9a3321e1acd3b9f6debee5e042dd2411a1742002", - "0xe1c110e1b1b4a1ded0caf3e42bfbdbb7b5d7ce1c", - "0xb7f8cd00c5a06c0537e2abff0b58033d02e5e094", - "0xa35d95872d8eb056eb2cbd67d25124a6add7455e", - "0x0cf8e180350253271f4b917ccfb0accc4862f262", - "0x6ded0f2c886568fb4bb6f04f179093d3d167c9d7", - "0x2f28add68e59733d23d5f57d94c31fb965f835d0", - "0xaf6162dc717cfc8818efc8d6f46a41cf7042fcba", - "0x30807d3b851a31d62415b8bb7af7dca59390434a", - "0xce86f7fcd3b40791f63b86c3ea3b8b355ce2685b", - "0xbb9858603b1fb9375f6df972650343e985186ac5", - "0xc5fb6476a6518dd35687e0ad2670cb8ab5a0d4c5", - "0xaed19dab3cd68e4267aec7b2479b1ed2144ad77f", - "0xa6fdea1655910c504e974f7f1b520b74be21857b", - "0x5f7f6cb266737b89f7af86b30f03ae94334b83e9", - "0x532197ec38756b9956190b845d99b4b0a88e4ca9", - "0x6d1b7b59e3fab85b7d3a3d86e505dd8e349ea7f3", - "0x42586ef4495bb512a86cf7496f6ef85ae7d69a64", - "0x60d01ec2d5e98ac51c8b4cf84dfcce98d527c747", - "0x0a3bb08b3a15a19b4de82f8acfc862606fb69a2d", - "0xa8bb71facdd46445644c277f9499dd22f6f0a30c", - "0x9cb73f20164e399958261c289eb5f9846f4d1404", - "0x51bd63f240fb13870550423d208452ca87c44444", - "0xaa20e8cb61299df2357561c2ac2e1172bc68bc25", - "0x13ab6739368a4e4abf24695bf52959224367391f", - "0xd7d069493685a581d27824fc46eda46b7efc0063", - "0x7c9e73d4c71dae564d41f78d56439bb4ba87592f", - "0x158da805682bdc8ee32d52833ad41e74bb951e59", - "0x08fc9ba2cac74742177e0afc3dc8aed6961c24e7", - "0xbff4a34a4644a113e8200d7f1d79b3555f723afe", - "0x3282d2a151ca00bfe7ed17aa16e42880248cd3cd", - "0xf1be8ecc990cbcb90e166b71e368299f0116d421", - "0xea7a82e0bc636667ab5c65623cd1438370620c3e", - "0x8b04e56a8cd5f4d465b784ccf564899f30aaf88c", - "0x6a46d878401f46b4c7f665f065e0667580e031ec", - "0xa4ef4b0b23c1fc81d3f9ecf93510e64f58a4a016", - "0x37dfacfaeda801437ff648a1559d73f4c40aacb7", - "0x71be881e9c5d4465b3fff61e89c6f3651e69b5bb", - "0x316622977073bbc3df32e7d2a9b3c77596a0a603", - "0x5b1a9850f55d9282a7c4bf23a2a21b050e3beb2f", - "0xdcecf0664c33321ceca2effce701e710a2d28a3f", - "0x1ddcaa4ed761428ae348befc6718bcb12e63bfaa", - "0x4268b8f0b87b6eae5d897996e6b845ddbd99adf3" - ], - "polygon": [ - "0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270", - "0x2791bca1f2de4661ed88a30c99a7a9449aa84174", - "0xc2132d05d31c914a87c6611c10748aeb04b58e8f", - "0x8f3cf7ad23cd3cadbd9735aff958023239c6a063", - "0x7ceb23fd6bc0add59e62ac25578270cff1b9f619", - "0x4535e52cdf3ab787b379b7b72b5990767e6747e4", - "0x22a31bd4cb694433b6de19e0acc2899e553e9481", - "0x60d01ec2d5e98ac51c8b4cf84dfcce98d527c747", - "0xaa9654becca45b5bdfa5ac646c939c62b527d394", - "0x2f28add68e59733d23d5f57d94c31fb965f835d0", - "0x9fffb2f49adfc231b44ddcff3ffcf0e81b06430a", - "0xf04d3a8eb17b832fbebf43610e94bdc4fd5cf2dd", - "0x8eb3771a43a8c45aabe6d61ed709ece652281dc9", - "0x613a489785c95afeb3b404cc41565ccff107b6e0", - "0x1ddcaa4ed761428ae348befc6718bcb12e63bfaa", - "0x794baab6b878467f93ef17e2f2851ce04e3e34c8", - "0x282d8efce846a88b159800bd4130ad77443fa1a1", - "0x769434dca303597c8fc4997bf3dab233e961eda2", - "0x6d3cc56dfc016151ee2613bdde0e03af9ba885cc", - "0xe4f7761b541668f88d04fe9f2e9df10ca613aef7", - "0x81a123f10c78216d32f8655eb1a88b5e9a3e9f2f", - "0xaf12f8ec3f8c711d15434b63f9d346224c1c4666", - "0xc5b57e9a1e7914fda753a88f24e5703e617ee50c", - "0xf826a91e8de52bc1baf40d88203e572dc2551aa3", - "0x28cead9e4ff96806c79f4189ef28fc61418e2216", - "0xfc40a4f89b410a1b855b5e205064a38fc29f5eb5", - "0x4c28f48448720e9000907bc2611f73022fdce1fa", - "0x6cacfaf65b1b1f9979acf463a393a112d0980982", - "0x14743e1c6f812154f7ecc980d890f0f5234103e7", - "0x5c4b7ccbf908e64f32e12c6650ec0c96d717f03f" - ], - "xdai": [ - "0xe91d153e0b41518a2ce8dd3d7944fa863463a97d", - "0xddafbb505ad214d7b80b1f830fccc89b60fb7a83", - "0x9c58bacc331c9aa871afd802db6379a98e80cedb", - "0x6a023ccd1ff6f2045c3309768ead9e68f978f6e1", - "0x4ecaba5870353805a9f068101a40e0f32ed605c6", - "0x44fa8e6f47987339850636f88629646662444217", - "0x4537e328bf7e4efa29d05caea260d7fe26af9d74", - "0x7122d7661c4564b7c6cd4878b06766489a6028a2", - "0x8e5bbbb09ed1ebde8674cda39a0c169401db4252", - "0xec3f3e6d7907acda3a7431abd230196cda3fbb19" - ], - "okexchain": [ - "0xc946daf81b08146b1c7a8da2a851ddf2b3eaaf85", - "0x8f8526dbfd6e38e3d8307702ca8469bae6c56c15", - "0x382bb369d343125bfb2117af9c149795c6c65c50", - "0x54e4622dc504176b3bb432dccaf504569699a7ff", - "0xef71ca2ee68f45b9ad6f72fbdb33d707b872315c", - "0xdf54b6c6195ea4d948d03bfd818d365cf175cfc2", - "0xab0d1578216a545532882e420a8c61ea07b00b12", - "0x8179d97eb6488860d816e3ecafe694a4153f216c", - "0xe1c110e1b1b4a1ded0caf3e42bfbdbb7b5d7ce1c" - ], - "heco": [ - "0x5545153ccfca01fbd7dd11c0b23ba694d9509a6f", - "0xb6f4c418514dd4680f76d5caa3bb42db4a893acb", - "0xhecozzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz", - "0xe1c110e1b1b4a1ded0caf3e42bfbdbb7b5d7ce1c", - "0x3d760a45d0887dfd89a2f5385a236b29cb46ed2a", - "0x9362bbef4b8313a8aa9f0c9808b80577aa26b73b", - "0xce0a5ca134fb59402b723412994b30e02f083842", - "0x1ee8382be3007bd9249a89f636506284ddef6cc0", - "0x40280e26a572745b1152a54d1d44f365daa51618", - "0x5ee41ab6edd38cdfb9f6b4e6cf7f75c87e170d98", - "0xa2f3c2446a3e20049708838a779ff8782ce6645a", - "0x843af718ef25708765a8e0942f89edeae1d88df0", - "0x90e8896b12a92d51cd213b681c2cad83a9a6bd49" - ], - "hoo": [ - "0x3eff9d389d13d6352bfb498bcf616ef9b1beac87" - ], - "harmony": [ - "0x72cb10c6bfa5624dd07ef608027e366bd690048f", - "0xd74433b187cf0ba998ad9be3486b929c76815215", - "0xcF664087a5bB0237a0BAd6742852ec6c8d69A27a", - "0x0dd740db89b9fda3baadf7396ddad702b6e8d6f5" - ], - "optimism": [ - "0x4200000000000000000000000000000000000006", - "0x5029c236320b8f15ef0a657054b84d90bfbeded3", - "0x121ab82b49b2bc4c7901ca46b8277962b4350204", - "0x35d48a789904e9b15705977192e5d95e2af7f1d3", - "0xcb8fa9a76b8e203d8c3797bf438d8fb81ea3326a", - "0x67ccea5bb16181e7b4109c9c2143c24a1c2205be", - "0x2e3d870790dc77a83dd1d18184acc7439a53f475", - "0x0b5740c6b4a97f90ef2f0220651cca420b868ffb", - "0x8c6f28f2f1a3c87f0f938b96d27520d9751ec8d9", - "0xc5db22719a06418028a40a9b5e9a7c02959d0d08", - "0xe405de8f52ba7559f9df3c368500b6e6ae6cee49", - "0x298b9b95708152ff6968aafd889c6586e9169f1d" - ], - "moonriver": [ - "0x98878b06940ae243284ca214f92bb71a2b032b8a", - "0xf50225a84382c74cbdea10b0c176f71fc3de0c4d", - "0xb44a9b6905af7c801311e8f4e76932ee959c663c", - "0xe3f5a90f9cb311505cd691a46596599aa1a0ad7d", - "0x639a647fbe20b6c8ac19e48e2de44ea792c62c5c", - "0xe1c110e1b1b4a1ded0caf3e42bfbdbb7b5d7ce1c", - "0xe3c7487eb01c74b73b7184d198c7fbf46b34e5af", - "0xcb4a593ce512d78162c58384f0b2fd6e802c2c47" - ], - "moonbeam": [ - "0xacc15dc74880c9944775448304b263d191c6077f", - "0x818ec0a7fe18ff94269904fced6ae3dae6d6dc0b", - "0x0e358838ce72d5e61e0018a2ffac4bec5f4c88d2", - "0xa649325aa7c5093d12d6f98eb4378deae68ce23f", - "0xcd3b51d98478d53f4515a306be565c6eebef1d58", - "0x322e86852e492a7ee17f28a78c663da38fb33bfb", - "0x8f552a71efe5eefc207bf75485b356a0b3f01ec9", - "0xdfa46478f9e5ea86d57387849598dbfb2e964b02", - "0x8e70cd5b4ff3f62659049e74b6649c6603a0e594", - "0x30d2a9f5fdf90ace8c17952cbb4ee48a55d916a7", - "0x1dc78acda13a8bc4408b207c9e48cdbc096d95e0", - "0xc234a67a4f840e61ade794be47de455361b52413", - "0x1d4c2a246311bb9f827f4c768e277ff5787b7d7e", - "0x5f6c5c2fb289db2228d159c69621215e354218d7", - "0x931715fee2d06333043d11f658c8ce934ac61d0c", - "0xffffffffea09fb06d082fd1275cd48b191cbcd1d", - "0xab3f0245b83feb11d15aaffefd7ad465a59817ed", - "0xe57ebd2d67b462e9926e04a8e33f01cd0d64346d", - "0x692c57641fc054c2ad6551ccc6566eba599de1ba", - "0x81ecac0d6be0550a00ff064a4f9dd2400585fe9c", - "0x6a2d262d56735dba19dd70682b39f6be9a931d98", - "0x6959027f7850adf4916ff5fdc898d958819e5375", - "0x4edf8e0778967012d46968ceadb75436d0426f88" - ], - "arbitrum": [ - "0x82af49447d8a07e3bd95bd0d56f35241523fbab1", - "0x2f2a2543b76a4166549f7aab2e75bef0aefc5b0f", - "0xff970a61a04b1ca14834a43f5de4533ebddb5cc8", - "0xf97f4df75117a78c1a5a0dbb814af92458539fb4", - "0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9", - "0x09ad12552ec45f82be90b38dfe7b06332a680864", - "0xfea7a6a0b346362bf88a9e4a88416b77a57d6c2a", - "0xdbf31df14b66535af65aac99c32e9ea844e14501", - "0x9ef758ac000a354479e538b8b2f01b917b8e89e7", - "0x31635a2a3892daec7c399102676e344f55d20da7", - "0x4a717522566c7a09fd2774ccedc5a8c43c5f9fd2", - "0x2913e812cf0dcca30fb28e6cac3d2dcff4497688", - "0x289ba1701c2f088cf0faf8b3705246331cb8a839", - "0x61a1ff55c5216b636a294a07d77c6f4df10d3b56", - "0x93c15cd7de26f07265f0272e0b831c5d7fab174f" - ], - "fuse": [ - "0x0be9e53fd7edac9f859882afdda116645287c629", - "0x620fd5fa44be6af63715ef4e65ddfa0387ad13f5", - "0xa722c13135930332eb3d749b2f0906559d2c5b99", - "0x94ba7a27c7a95863d1bdc7645ac2951e0cca06ba", - "0xfadbbf8ce7d5b7041be672561bba99f79c532e10", - "0x43b17749b246fd2a96de25d9e4184e27e09765b0", - "0x0000000000000000000000000000000000000000" - ], - "evmos": [ - "0xd4949664cd82660aae99bedc034a0dea8a0bd517", - "0x51e44ffad5c2b122c8b635671fcc8139dc636e82", - "0x8d395affc1767141387fff45af88a074614e7ccf", - "0xb1a8c961385b01c3aa782fba73e151465445d319", - "0xe46910336479f254723710d57e7b683f3315b22b", - "0x63743acf2c7cfee65a5e356a4c4a005b586fc7aa", - "0x7ff4a56b32ee13d7d4d405887e0ea37d61ed919e", - "0xb72a7567847aba28a2819b855d7fe679d4f59846", - "0x5842c5532b61acf3227679a8b1bd0242a41752f2", - "0xf80699dc594e00ae7ba200c7533a07c1604a106d", - "0x28ec4b29657959f4a5052b41079fe32919ec3bd3", - "0xe03494d0033687543a80c9b1ca7d6237f2ea8bd8", - "0x3f75ceabcdfed1aca03257dc6bdc0408e2b4b026" - ], - "oasis": [ - "0x3223f17957ba502cbe71401d55a0db26e5f7c68f", - "0x4bf769b05e832fcdc9053fffbc78ca889acb5e1e", - "0x6cb9750a92643382e020ea9a170abb83df05f30b", - "0xdc19a122e268128b5ee20366299fc7b5b199c8e3", - "0x94fbffe5698db6f54d6ca524dbe673a7729014be", - "0x80a16016cc4a2e6a2caca8a4a498b1699ff0f844", - "0x21c718c22d52d0f3a789b752d4c2fd5908a8a733", - "0x5c78a65ad6d0ec6618788b6e8e211f31729111ca", - "0x9e832cae5d19e7ff2f0d62881d1e33bb16ac9bdc", - "0x6ab6d61428fde76768d7b45d8bfeec19c6ef91a8", - "0xe8a638b3b7565ee7c5eb9755e58552afc87b94dd", - "0x81ecac0d6be0550a00ff064a4f9dd2400585fe9c" - ], - "kcc": [ - "0xe3f5a90f9cb311505cd691a46596599aa1a0ad7d", - "0x4a81704d8c16d9fb0d7f61b747d0b5a272badf14", - "0xe1c110e1b1b4a1ded0caf3e42bfbdbb7b5d7ce1c", - "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", - "0x639a647fbe20b6c8ac19e48e2de44ea792c62c5c", - "0xc9baa8cfdde8e328787e29b4b078abf2dadc2055", - "0x218c3c3d49d0e7b37aff0d8bb079de36ae61a4c0", - "0xf55af137a98607f7ed2efefa4cd2dfe70e4253b1", - "0x4446fc4eb47f2f6586f9faab68b3498f86c07521", - "0x2ca48b4eea5a731c2b54e7c3944dbdb87c0cfb6f", - "0x0039f574ee5cc39bdd162e9a88e3eb1f111baf48", - "0x980a5afef3d17ad98635f6c5aebcbaeded3c3430", - "0xfa93c12cd345c658bc4644d1d4e1b9615952258c", - "0x00ee2d494258d6c5a30d6b6472a09b27121ef451" - ], - "metis": [ - "0xdeaddeaddeaddeaddeaddeaddeaddeaddead0000", - "0x75cb093e4d61d2a2e65d8e0bbb01de8d89b53481", - "0xbb06dca3ae6887fabf931640f67cab3e3a16f4dc", - "0x420000000000000000000000000000000000000a", - "0x5801d0e1c7d977d78e4890880b8e579eb4943276", - "0xea32a96608495e54156ae48931a7c20f0dcc1a21", - "0x2692be44a6e38b698731fddf417d060f0d20a0cb", - "0xa5b55ab1daf0f8e1efc0eb1931a957fd89b918f4", - "0x12d84f1cfe870ca9c9df9785f8954341d7fbb249", - "0xe253e0cea0cdd43d9628567d097052b33f98d611", - "0xa9109271abcf0c4106ab7366b4edb34405947eed", - "0x4651b38e7ec14bb3db731369bfe5b08f2466bd0a", - "0xfe282af5f9eb59c30a3f78789eeffa704188bdd4", - "0x6ab6d61428fde76768d7b45d8bfeec19c6ef91a8", - "0x4b9d2923d875edf43980bf5ddddede3fb20fc742", - "0x67c10c397dd0ba417329543c1a40eb48aaa7cd00", - "0x226d8bfb4da78ddc5bd8fd6c1532c58e88f9fd34" - ], - "celo": [ - "0x471ece3750da237f93b8e339c536989b8978a438", - "0x765de816845861e75a25fca122bb6898b8b1282a", - "0x9995cc8f20db5896943afc8ee0ba463259c931ed", - "0x7d00cd74ff385c955ea3d79e47bf06bd7386387d", - "0x918146359264c492bd6934071c6bd31c854edbc3", - "0xe273ad7ee11dcfaa87383ad5977ee1504ac07568", - "0x37f750b7cc259a2f741af45294f6a16572cf5cad", - "0x2a3684e9dc20b857375ea04235f2f7edbe818fa7", - "0xb70e0a782b058bfdb0d109a3599bec1f19328e36", - "0xcd7d7ff64746c1909e44db8e95331f9316478817", - "0x93db49be12b864019da9cb147ba75cdc0506190e", - "0xcfffe0c89a779c09df3df5624f54cdf7ef5fdd5d", - "0xbaab46e28388d2779e6e31fd00cf0e5ad95e327b", - "0x122013fd7df1c6f636a5bb8f03108e876548b455", - "0xe919f65739c26a42616b7b8eedc6b5524d1e3ac4", - "0xed193c4e69f591e42398ef54dea65aa1bb02835c", - "0x90ca507a5d4458a4c6c6249d186b6dcb02a5bccd", - "0x02de4766c272abc10bc88c220d214a26960a7e92", - "0x32a9fe697a32135bfd313a6ac28792dae4d9979d", - "0x66803fb87abd4aac3cbb3fad7c3aa01f6f3fb207" - ], - "boba": [ - "0xdeaddeaddeaddeaddeaddeaddeaddeaddead0000", - "0xa18bf3994c0cc6e3b63ac420308e5383f53120d7", - "0x66a2a913e447d6b4bf33efbec43aaef87890fbbc", - "0x5de1677344d3cb0d7d465c10b72a8f60699c062d", - "0xf74195bb8a5cf652411867c5c2c5b8c2a402be35", - "0x461d52769884ca6235b685ef2040f47d30c94eb5", - "0x7562f525106f5d54e891e005867bf489b5988cd9", - "0xd203de32170130082896b4111edf825a4774c18e", - "0xdc0486f8bf31df57a952bcd3c1d3e166e3d9ec8b", - "0xe1e2ec9a85c607092668789581251115bcbd20de", - "0x2f28add68e59733d23d5f57d94c31fb965f835d0", - "0xf04d3a8eb17b832fbebf43610e94bdc4fd5cf2dd" - ], - "findora": [ - "0xabc979788c7089b516b8f2f1b5ceabd2e27fd78b", - "0x008a628826e9470337e0cd9c0c944143a83f32f3", - "0x93edfa31d7ac69999e964dac9c25cd6402c75db3", - "0xda33ef1a7b48bebbf579ee86dfa735a9529c4950", - "0xe80eb4a234f718edc5b76bb442653827d20ebb2d", - "0x07efa82e00e458ca3d53f2cd5b162e520f46d911", - "0x0000000000000000000000000000000000001000", - "0x2e8079e0fe49626af8716fc38adea6799065d7f7", - "0x0632baa26299c9972ed4d9affa3fd057a72252ff" - ], - "milkomeda": [ - "0xae83571000af4499798d1e3b0fa0070eb3a3e3f9", - "0x80a16016cc4a2e6a2caca8a4a498b1699ff0f844", - "0x8d50a024b2f5593605d3ce8183ca8969226fcbf8", - "0x6ab6d61428fde76768d7b45d8bfeec19c6ef91a8", - "0x3795c36e7d12a8c252a20c5a7b455f7c57b60283", - "0x7f27352d5f83db87a5a3e00f4b07cc2138d8ee52", - "0x5950f9b6ef36f3127ea66799e64d0ea1f5fdb9d1", - "0x41eafc40cd5cb904157a10158f73ff2824dc1339", - "0xab58da63dfdd6b97eaab3c94165ef6f43d951fb2", - "0x5a955fddf055f2de3281d99718f5f1531744b102", - "0x48aeb7584ba26d3791f06fba360db435b3d7a174", - "0x42110a5133f91b49e32b671db86e2c44edc13832", - "0x4bf769b05e832fcdc9053fffbc78ca889acb5e1e", - "0x8c008bba2dd56b99f4a6ab276be3a478cb075f0c" - ], - "bittorrent": [ - "0xdb28719f7f938507dbfe4f0eae55668903d34a15", - "0x935faa2fcec6ab81265b301a30467bbc804b43d3", - "0x8d193c6efa90bcff940a98785d1ce9d093d3dc8a", - "0x17f235fd5974318e4e2a5e37919a209f7c37a6d1", - "0xae17940943ba9440540940db0f1877f101d39e8b", - "0xedf53026aea60f8f75fca25f8830b7e2d6200662", - "0x1249c65afb11d179ffb3ce7d4eedd1d9b98ad006", - "0xe887512ab8bc60bcc9224e1c3b5be68e26048b8b", - "0xe467f79e9869757dd818dfb8535068120f6bcb97", - "0x9888221fe6b5a2ad4ce7266c7826d2ad74d40ccf", - "0xca424b845497f7204d9301bd13ff87c0e2e86fcf", - "0x9b5f27f6ea9bbd753ce3793a07cba3c74644330d", - "0x23181f21dea5936e24163ffaba4ea3b316b57f3c" - ], - "klaytn": [ - "0xd7a4d10070a4f7bc2a015e78244ea137398c3b74", - "0x5388ce775de8f7a69d17fd5caa9f7dbfee65dfce", - "0x02cbe46fb8a1f579254a9b485788f2d86cad51aa", - "0x078db7827a5531359f6cb63f62cfa20183c4f10c", - "0x6270b58be569a7c0b8f47594f191631ae5b2c86c", - "0x0268dbed3832b87582b1fa508acf5958cbb1cd74", - "0xd6dab4cff47df175349e6e7ee2bf7c40bb8c05a3", - "0x168439b5eebe8c83db9eef44a0d76c6f54767ae4", - "0x4fa62f1f404188ce860c8f0041d6ac3765a72e67", - "0xce40569d65106c32550626822b91565643c07823", - "0x210bc03f49052169d5588a52c317f71cf2078b85", - "0xdcbacf3f7a069922e677912998c8d57423c37dfa", - "0xcd6f29dc9ca217d0973d3d21bf58edd3ca871a86", - "0xe4f05a66ec68b54a58b17c22107b02e0232cc817", - "0x5c74070fdea071359b86082bd9f9b3deaafbe32b", - "0x754288077d0ff82af7a5317c7cb8c444d421d103", - "0xcee8faf64bb97a73bb51e115aa89c17ffa8dd167", - "0x16d0e1fbd024c600ca0380a4c5d57ee7a2ecbf9c", - "0x34d21b1e550d73cee41151c77f3c73359527a396", - "0xff3e7cf0c007f919807b32b30a4a9e7bd7bc4121", - "0xf6f6b8bd0ac500639148f8ca5a590341a97de0de", - "0x9eaefb09fe4aabfbe6b1ca316a3c36afc83a393f", - "0xc6a2ad8cc6e4a7e08fc37cc5954be07d499e7654", - "0x98a8345bb9d3dda9d808ca1c9142a28f6b0430e1", - "0x981846be8d2d697f4dfef6689a161a25ffbab8f9", - "0x608792deb376cce1c9fa4d0e6b7b44f507cffa6a", - "0x5c13e303a62fc5dedf5b52d66873f2e59fedadc2", - "0xcb2c7998696ef7a582dfd0aafadcd008d03e791a", - "0xac9c1e4787139af4c751b1c0fadfb513c44ed833", - "0xe2765f3721dab5f080cf14ace661529e1ab9ade7", - "0x45830b92443a8f750247da2a76c85c70d0f1ebf3", - "0xfaa03a2ac2d1b8481ec3ff44a0152ea818340e6d", - "0x2b72d65941e657c1305b65fa330ffdde7b397239", - "0x61fbbfd5416c45f297a8e69ba113789c75f8841c", - "0x2eadfda6d830547b5168ba88c13d24156a026ce5", - "0x98aedff55dcc2e7a7d1899b325d1680527dd2742", - "0x2ff5371dad5c6ef76d55213b7c5a519f6654ba17", - "0xe9a88c33abf71c902f7581321d05e6516cbca761" - ], - "nova": [ - "0x657a66332a65b535da6c5d67b8cd1d410c161a08", - "0x1f5396f254ee25377a5c1b9c6bff5f44e9294fff", - "0x0000000000000000000000000000000000000000" - ], - "aurora": [ - "0xc9bdeed33cd01541e1eed10f90519d2c06fe3feb", - "0xb12bfca5a55806aaf64e99521918a4bf0fc40802", - "0x4988a896b1227218e4a686fde5eabdcabd91571f", - "0xc42c30ac6cc15fac9bd938618bcaa1a1fae8501d", - "0x8bec47865ade3b172a928df8f990bc7f2a3b9f79", - "0xda2585430fef327ad8ee44af8f1f989a2a91a3d2", - "0x07379565cd8b0cae7c60dc78e7f601b34af2a21c", - "0x42cc1cbf253f89be6814a0f59f745b40b69b6220", - "0xd5e98caeb396dabe5a102bb9256b552944e3401f", - "0x274d83086c356e0cfc75933fbf838ca10a7e8274" - ], - "dfk": [ - "0xccb93dabd71c8dad03fc4ce5559dc3d89f67a260", - "0x77f2656d04e158f915bc22f07b779d94c1dc47ff", - "0x0ab87046fbb341d058f17cbc4c1133f25a20a52f", - "0x2df041186c844f8a2e2b63f16145bc6ff7d23e25" - ], - "cronos": [ - "0x5c7f8a570d578ed84e63fdfa7b1ee72deae1ae23", - "0xc21223249ca28397b4b6541dffaecc539bff0c59", - "0x062e66477faf219f25d27dced647bf57c3107d52", - "0x654bac3ec77d6db497892478f854cf6e8245dca9", - "0x66e428c3f67a68878562e79a0234c1f83c208770", - "0xe243ccab9e66e6cf1215376980811ddf1eb7f689", - "0x87efb3ec1576dec8ed47e58b832bedcd86ee186e", - "0xca2503482e5d6d762b524978f400f03e38d5f962", - "0x45c135c1cdce8d25a3b729a28659561385c52671", - "0x39a65a74dc5a778ff93d1765ea51f57bc49c81b3", - "0xbed48612bc69fa1cab67052b42a95fb30c1bcfee", - "0xb888d8dd1733d72681b30c00ee76bde93ae7aa93", - "0x02dccaf514c98451320a9365c5b46c61d3246ff3" - ], - "velas": [ - "0xc579d1f3cf86749e05cd06f7ade17856c2ce3126", - "0xe41c4324dcbd2926481101f8580d13930aff8a75", - "0x85219708c49aa701871ad330a94ea0f41dff24ca", - "0x6ab0b8c1a35f9f4ce107ccbd05049cb1dbd99ec5", - "0x639a647fbe20b6c8ac19e48e2de44ea792c62c5c", - "0x2b8e9cd44c9e09d936149549a8d207c918ecb5c4", - "0xc9b3aa6e91d70f4ca0988d643ca2bb93851f3de4", - "0xe2c120f188ebd5389f71cf4d9c16d05b62a58993", - "0x01445c31581c354b7338ac35693ab2001b50b9ae", - "0xc111c29a988ae0c0087d97b33c6e6766808a3bd3", - "0x300a8be53b4b5557f48620d578e7461e3b927dd0", - "0x525bd1f949ffa2a0c5820f3b6fe61bb897466ff7", - "0x9b6fbf0ea23faf0d77b94d5699b44062e5e747ac", - "0xe3f5a90f9cb311505cd691a46596599aa1a0ad7d", - "0x8d9fb713587174ee97e91866050c383b5cee6209", - "0x3611fbfb06ffbcef9afb210f6ace86742e6c14a4" - ], - "telos": [ - "0xd102ce6a4db07d247fcc28f366a623df0938ca9e", - "0xfa9343c3897324496a05fc75abed6bac29f8a40f", - "0xf390830df829cf22c53c8840554b98eafc5dcbc2", - "0x818ec0a7fe18ff94269904fced6ae3dae6d6dc0b", - "0xefaeee334f0fd1712f9a8cc375f427d9cdd40d73", - "0x017043607270ecbb440e20b0f0bc5e760818b3d8" - ], - "reichain": [ - "0xf8ab4aaf70cef3f3659d3f466e35dc7ea10d4a5d", - "0xdd2bb4e845bd97580020d8f9f58ec95bf549c3d9" - ], - "solana": [ - "So11111111111111111111111111111111111111112", - "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", - "9EaLkQrbjmbbuZG9Wdpo8qfNUEjHATJFSycEmw6f1rGX", - "6LNeTYMqtNm1pBFN8PfhQaoLyegAH8GD32WmHU9erXKN", - "EjmyN6qEC1Tf1JxiG1ae7UTJhUxSwk1TCWNWqxWV4J6o", - "eqKJTf1Do4MDPyKisMYqVaUFpkEFAs3riGF3ceDH2Ca", - "FCqfQSujuPxy6V42UvafBhsysWtEq1vhjfMN1PUbgaxA", - "DdFPRnccQqLD4zCHrBqdY95D6hvw6PLWp9DEXj1fLCL9", - "8Yv9Jz4z7BUHP68dz8E8m3tMe6NKgpMUKn8KVqrPA6Fr", - "Grk6b4UMRWkgyq4Y6S1BnNRF4hRgtnMFp7Sorkv6Ez4u", - "8XSsNvaKU9FDhYWAv7Yc7qSNwuJSzVrXBNEk7AFiWF69", - "8qJSyQprMC57TWKaYEmetUR3UUiTP2M3hXdcvFhkZdmv", - "E77cpQ4VncGmcAXX16LHFFzNBEBb2U7Ar7LBmZNfCgwL", - "Bn113WT6rbdgwrm12UJtnmNqGqZjY4it2WoUQuQopFVn", - "FwEHs3kJEdMa2qZHv7SgzCiFXUQPEycEXksfBkwmS8gj", - "5RpUwQ8wtdPCZHhu6MERp2RGrpobsbZ6MH5dDHkUjs2", - "PUhuAtMHsKavMTwZsLaDeKy2jb7ciETHJP7rhbKLJGY" - ], - "astar": [ - "0xaeaaf0e2c81af264101b9129c00f4440ccf0f720", - "0x81ecac0d6be0550a00ff064a4f9dd2400585fe9c", - "0xad543f18cff85c77e140e3e5e3c3392f6ba9d5ca", - "0x7f27352d5f83db87a5a3e00f4b07cc2138d8ee52", - "0x75364d4f779d0bd0facd9a218c67f87dd9aff3b4", - "0xdd90e5e87a2081dcf0391920868ebc2ffb81a1af", - "0x6a2d262d56735dba19dd70682b39f6be9a931d98", - "0x3795c36e7d12a8c252a20c5a7b455f7c57b60283", - "0xde2578edec4669ba7f41c5d5d2386300bcea4678", - "0xffffffffffffffffffffffffffffffffffffffff", - "0x6de33698e9e9b787e09d3bd7771ef63557e148bb", - "0xcdb32eed99aa19d39e5d6ec45ba74dc4afec549f", - "0xc5bcac31cf55806646017395ad119af2441aee37", - "0x6df98e5fbff3041105cb986b9d44c572a43fcd22", - "0x29f6e49c6e3397c3a84f715885f9f233a441165c", - "0x257f1a047948f73158dadd03eb84b34498bcdc60", - "0xc4335b1b76fa6d52877b3046eca68f6e708a27dd", - "0x430d50963d9635bbef5a2ff27bd0bddc26ed691f", - "0x19574c3c8fafc875051b665ec131b7e60773d2c9", - "0xe511ed88575c57767bafb72bfd10775413e3f2b0", - "0xecc867de9f5090f55908aaa1352950b9eed390cd", - "0xb361dad0cc1a03404b650a69d9a5adb5af8a531f", - "0xc404e12d3466accb625c67dbab2e1a8a457def3c", - "0x4dd9c468a44f3fef662c35c1e9a6108b70415c2c", - "0xdbd71969ac2583a9a20af3fb81fe9c20547f30f3", - "0x9914bff0437f914549c673b34808af6020e2b453", - "0x347e53263f8fb843ec605a1577ec7c8c0cac7a58", - "0x02dac4898b2c2ca9d50ff8d6a7726166cf7bcfd0", - "0x4bf769b05e832fcdc9053fffbc78ca889acb5e1e", - "0xb7ab962c42a8bb443e0362f58a5a43814c573ffb", - "0x733ebcc6df85f8266349defd0980f8ced9b45f35", - "0x5271d85ce4241b310c0b34b7c2f1f036686a6d7c", - "0x431d5dff03120afa4bdf332c61a6e1766ef37bdb" - ], - "cardano": [ - "ada" - ], - "functionx": [ - "0x80b5a32e4f032b2a058b4f29ec95eefeeb87adcd", - "0xd567b3d7b8fe3c79a1ad8da978812cfc4fa05e75", - "0x5fd55a1b9fc24967c4db09c513c3ba0dfa7ff687", - "0xeceeefcee421d8062ef8d6b4d814efe4dc898265" - ], - "clv": [ - "0x6d6ad95425fcf315c39fa6f3226471d4f16f27b3", - "0x1376c97c5c512d2d6f9173a9a3a016b6140b4536", - "0xa1c3767c93e7b51ecb445fdbae1494dfc654e524", - "0x30bebbc0b6b357945ac30660e025c1532b9c7804", - "0xf91193a62879279d6b8f209f89b6418e3c0e5cbf", - "0x4a52f069cb00905d996a0d7b811d78e60b4cb09e" - ], - "tron": [ - "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t", - "TEkxiTehnzSmSe2XqrBj4w32RUN966rdz8" - ], - "lachain": [ - "0x3a898d596840c6b6b586d722bfadcc8c4761bf41" - ], - "theta": [ - "0x4dc08b15ea0e10b96c41aec22fab934ba15c983e" - ], - "zyx": [ - "0xc9e1aea009b0bae9141f3dc7523fb42fd48c8656" - ], - "ubiq": [ - "0x1fa6a37c64804c0d797ba6bc1955e50068fbf362" - ], - "cosmos": [ - "uatom" - ], - "terra2": [ - "uluna", - "terra1nsuqsk6kh58ulczatwev87ttq2z6r3pusulg9r24mfj2fvtzd4uq3exn26" - ], - "crescent": [ - "ubcre", - "ucre" - ], - "osmosis": [ - "uion" - ], - "kujira": [ - "ukuji", - "factory/kujira1qk00h5atutpsv900x202pxx42npjr9thg58dnqpa72f2p7m2luase444a7/uusk" - ], - "injective": [ - "inj" - ], - "near": [ - "token.jumbo_exchange.near", - "token.paras.near", - "marmaj.tkn.near", - "linear-protocol.near", - "token.pembrock.near", - "token.burrow.near", - "token.marmaj.near" - ], - "multivac": [ - "0x8e321596267a4727746b2f48bc8736db5da26977" - ], - "tomochain": [ - "0xb1f66997a5760428d3a87d68b90bfe0ae64121cc" - ], - "ethereumclassic": [ - "0x82a618305706b14e7bcf2592d4b9324a366b6dad", - "0x1953cab0e5bfa6d4a9bad6e05fd46c1cc6527a5a", - "0x35e9a89e43e45904684325970b2e2d258463e072" - ], - "cube": [ - "0x9d3f61338d6eb394e378d28c1fd17d5909ac6591", - "0x57eea49ec1087695274a9c4f341e414eb64328c2", - "0x040ea5c10e6ba4badb6c433a365ccc4968697230", - "0x79f1520268a20c879ef44d169a4e3812d223c6de", - "0x00f0d8595797943c12605cd59bc0d9f63d750ccf", - "0x3a1f6e3e6f26e92bb0d07841eb68f8e84f39751e", - "0xee9801669c6138e84bd50deb500827b776777d28" - ], - "elastos": [ - "0x517e9e5d46c1ea8ab6f78677d6114ef47f71f6c4", - "0x9f1d0ed4e041c503bd487e5dc9fc935ab57f9a57" - ], - "energyweb": [ - "0x6b3bd0478df0ec4984b168db0e12a539cc0c83cd" - ], - "milkomeda_a1": [ - "0xaf86e6c5fd9daf53e5100ed38bab2572609fca27", - "0xbc31960a049fe10297ed8432fb61dd734fead4ea", - "0x32564ae38e5dbf316958ce25a6ad2a2249ebcc2d", - "0x522b61755b5ff8176b2931da7bf1a5f9414eb710", - "0xc9baa8cfdde8e328787e29b4b078abf2dadc2055" - ], - "ultron": [ - "0x3a4f06431457de873b588846d139ec0d86275d54", - "0x2318bf5809a72aabadd15a3453a18e50bbd651cd", - "0xd2b86a80a8f30b83843e247a50ecdc8d843d87dd", - "0xc7cac85c1779d2b8ada94effff49a4754865e2e4", - "0x97fdd294024f50c388e39e73f1705a35cfe87656", - "0x3c4e0fded74876295ca36f62da289f69e3929cc4" - ], - "bitgert": [ - "0x0eb9036cbe0f052386f36170c6b07ef0a0e3f710", - "0xc3b730dd10a7e9a69204bdf6cb5a426e4f1f09e3", - "0x11203a00a9134db8586381c4b2fca0816476b3fd" - ], - "echelon": [ - "0xadee5159f4f82a35b9068a6c810bdc6c599ba6a8" - ], - "rei": [ - "0x2545af3d8b11e295bb7aedd5826021ab54f71630", - "0x988a631caf24e14bb77ee0f5ca881e8b5dcfcec7", - "0x8059e671be1e76f8db5155bf4520f86acfdc5561", - "0x5b07f2582d0cc26e400d56266aebb201c93560ed" - ], - "tombchain": [ - "0xdeaddeaddeaddeaddeaddeaddeaddeaddead0000", - "0x4200000000000000000000000000000000000108", - "0x4200000000000000000000000000000000000006", - "0x4200000000000000000000000000000000000101", - "0x4200000000000000000000000000000000000100", - "0x4200000000000000000000000000000000000109" - ], - "rsk": [ - "0x542fda317318ebf1d3deaf76e0b632741a7e677d", - "0x967f8799af07df1534d48a95a5c9febe92c53ae0", - "0x1d931bf8656d795e50ef6d639562c5bd8ac2b78f" - ], - "polis": [ - "0x6fc851b8d66116627fb1137b9d5fe4e2e1bea978" - ], - "kekchain": [ - "0x71ec0cb8f7dd4f4c5bd4204015c4c287fbdaa04a", - "0x54bd9d8d758ac3717b37b7dc726877a23aff1b89" - ], - "aptos": [ - "0x1::aptos_coin::AptosCoin", - "0x5e156f1207d0ebfa19a9eeff00d62a282278fb8719f4fab3a586a0a2c0fffbea::coin::T", - "0xa2eda21a58856fda86451436513b867c97eecb4ba099da5775520e0f7492e852::coin::T", - "0xae478ff7d83ed072dbc5e264250e67ef58f57c99d89b447efd8a0a2e8b2be76e::coin::T", - "0xcc8a89c8dce9693d354449f1f73e60e14e347417854f029db5bc8e7454008abb::coin::T", - "0xc91d826e29a3183eb3b6f6aa3a722089fdffb8e9642b94c5fcd4c48d035c0080::coin::T", - "0x1000000fa32d122c18a6a31c009ce5e71674f22d06a581bb0a15575e6addadcc::usda::USDA", - "0xf22bede237a07e121b56d91a491eb7bcdfd1f5907926a9e58338f964a01b17fa::asset::USDC", - "0xf22bede237a07e121b56d91a491eb7bcdfd1f5907926a9e58338f964a01b17fa::asset::USDT", - "0xf22bede237a07e121b56d91a491eb7bcdfd1f5907926a9e58338f964a01b17fa::asset::WETH", - "0xdd89c0e695df0692205912fb69fc290418bed0dbe6e4573d744a6d5e6bab6c13::coin::T", - "0x84d7aeef42d38a5ffc3ccef853e1b82e4958659d16a7de736a29c55fbbeb0114::staked_aptos_coin::StakedAptosCoin", - "0xd11107bdf0d6d7040c6c0bfbdecb6545191fdf13e8d8d259952f53e1713f61b5::staked_coin::StakedAptos", - "0x8d87a65ba30e09357fa2edea2c80dbac296e5dec2b18287113500b902942929d::celer_coin_manager::BnbCoin", - "0x8d87a65ba30e09357fa2edea2c80dbac296e5dec2b18287113500b902942929d::celer_coin_manager::BusdCoin", - "0x8d87a65ba30e09357fa2edea2c80dbac296e5dec2b18287113500b902942929d::celer_coin_manager::UsdcCoin", - "0x8d87a65ba30e09357fa2edea2c80dbac296e5dec2b18287113500b902942929d::celer_coin_manager::UsdtCoin", - "0x8d87a65ba30e09357fa2edea2c80dbac296e5dec2b18287113500b902942929d::celer_coin_manager::DaiCoin", - "0x8d87a65ba30e09357fa2edea2c80dbac296e5dec2b18287113500b902942929d::celer_coin_manager::WethCoin", - "0x8d87a65ba30e09357fa2edea2c80dbac296e5dec2b18287113500b902942929d::celer_coin_manager::WbtcCoin" - ], - "dogechain": [ - "0xb7ddc6414bf4f5515b52d8bdd69973ae205ff101", - "0x7b4328c127b85369d9f82ca0503b000d09cf9180", - "0x765277eebeca2e31912c9946eae1021199b39c61", - "0x639a647fbe20b6c8ac19e48e2de44ea792c62c5c", - "0xb44a9b6905af7c801311e8f4e76932ee959c663c", - "0xe3f5a90f9cb311505cd691a46596599aa1a0ad7d", - "0xfa9343c3897324496a05fc75abed6bac29f8a40f", - "0xf27ee99622c3c9b264583dacb2cce056e194494f", - "0x97513e975a7fa9072c72c92d8000b0db90b163c5", - "0x332730a4f6e03d9c55829435f10360e13cfa41ff", - "0xa649325aa7c5093d12d6f98eb4378deae68ce23f", - "0xb12c13e66ade1f72f71834f2fc5082db8c091358", - "0xdc42728b0ea910349ed3c6e1c9dc06b5fb591f98", - "0x85c2d3bebffd83025910985389ab8ad655abc946", - "0xb3306f03595490e5cc3a1b1704a5a158d3436ffc", - "0x9f4614e4ea4a0d7c4b1f946057ec030bee416cbb", - "0x7f8e71dd5a7e445725f0ef94c7f01806299e877a", - "0xd0c6179c43c00221915f1a61f8ec06a5aa32f9ec", - "0x10d70831f9c3c11c5fe683b2f1be334503880db6", - "0x1fc532187b4848d2f9c564531b776a4f8e11201d", - "0x7264610a66eca758a8ce95cf11ff5741e1fd0455" - ], - "canto": [ - "0x826551890dc65655a0aceca109ab11abdbd7a07b", - "0x80b5a32e4f032b2a058b4f29ec95eefeeb87adcd", - "0xd567b3d7b8fe3c79a1ad8da978812cfc4fa05e75", - "0x4e71a2e537b7f9d9413d3991d37958c0b5e1e503", - "0x5fd55a1b9fc24967c4db09c513c3ba0dfa7ff687", - "0xeceeefcee421d8062ef8d6b4d814efe4dc898265" - ], - "ontology_evm": [ - "0xd8bc24cfd45452ef2c8bc7618e32330b61f2691b" - ], - "algorand": [ - "1", - "163650", - "312769", - "2751733", - "6547014", - "27165954", - "31566704", - "137020565", - "137594422", - "226701642", - "230946361", - "239444645", - "283820866", - "287867876", - "297995609", - "300208676", - "342889824", - "386192725", - "386195940", - "403499324", - "441139422", - "444035862", - "463554836", - "465865291", - "470842789", - "511484048", - "559219992", - "571576867", - "607591690", - "657291910", - "663905154", - "684649988", - "692085161", - "700965019", - "724480511", - "744665252", - "792313023", - "793124631", - "841126810", - "871930188" - ], - "shiden": [ - "0x0f933dc137d21ca519ae4c7e93f87a4c8ef365ef", - "0xfa9343c3897324496a05fc75abed6bac29f8a40f", - "0x818ec0a7fe18ff94269904fced6ae3dae6d6dc0b", - "0x735abe48e8782948a37c7765ecb76b98cde97b0f", - "0x722377a047e89ca735f09eb7cccab780943c4cb4", - "0xb4bca5955f26d2fa6b57842655d7acf2380ac854", - "0x765277eebeca2e31912c9946eae1021199b39c61", - "0x332730a4f6e03d9c55829435f10360e13cfa41ff", - "0x65e66a61d0a8f1e686c2d6083ad611a10d84d97a" - ], - "tezos": [ - "tezos", - "KT1UpeXdK6AJbX58GJ92pLZVCucn2DR8Nu4b", - "KT1VYsVfmobT7rsMVivvZ4J8i3bPiqz12NaH", - "KT1GRSvLoikDsXujKgZPsGLX8k8VvR2Tq95b", - "KT1SjXiUX63QvdNMcM2m492f7kuf8JxXRLp4", - "KT1Ha4yFVeyzw6KRAdkzq6TxDHB97KG4pZe8", - "KT1JkoE42rrMBP9b2oDhbx6EUr26GcySZMUH", - "KT18fp5rcTW7mbWDmzFwjLDUhs5MeJmagDSZ-19", - "KT18fp5rcTW7mbWDmzFwjLDUhs5MeJmagDSZ-17", - "KT18fp5rcTW7mbWDmzFwjLDUhs5MeJmagDSZ-11", - "KT18fp5rcTW7mbWDmzFwjLDUhs5MeJmagDSZ-10", - "KT18fp5rcTW7mbWDmzFwjLDUhs5MeJmagDSZ-1", - "KT18fp5rcTW7mbWDmzFwjLDUhs5MeJmagDSZ-20", - "KT18fp5rcTW7mbWDmzFwjLDUhs5MeJmagDSZ-5", - "KT19DUSZw7mfeEATrbWVPHRrWNVbNnmfFAE6", - "KT1TgmD7kXQzofpuc9VbTRMdZCS2e6JDuTtc", - "KT1TwzD6zV3WeJ39ukuqxcfK2fJCnhvrdN1X", - "KT19at7rQUvyjxnZ2fBv7D9zc8rkyG7gAoU8", - "KT18fp5rcTW7mbWDmzFwjLDUhs5MeJmagDSZ", - "KT18fp5rcTW7mbWDmzFwjLDUhs5MeJmagDSZ-18", - "KT1K9gCRgaLRFKTErYt1wVxA3Frb9FjasjTV", - "KT1LN4LPSqTMS7Sd2CJw4bbDGRkMv2t68Fy9", - "KT1XRPEPXbZK25r3Htzp2o1x7xdMMmfocKNW", - "KT1PWx2mnDueood7fEmfbBDKx1D9BAnnXitn", - "KT1XRPEPXBZK25R3HTZP2O1X7XDMMMFOCKNW-0", - "KT1Xobej4mc6XgEjDoJoHtTKgbD1ELMvcQuL", - "KT1XRPEPXbZK25r3Htzp2o1x7xdMMmfocKNW-2", - "KT1UsSfaXyqcjSVPeiD7U1bWgKy3taYN7NWY", - "KT1UsSfaXyqcjSVPeiD7U1bWgKy3taYN7NWY-0", - "KT1UsSfaXyqcjSVPeiD7U1bWgKy3taYN7NWY-1", - "KT1UsSfaXyqcjSVPeiD7U1bWgKy3taYN7NWY-2", - "KT1UsSfaXyqcjSVPeiD7U1bWgKy3taYN7NWY-3", - "KT1UsSfaXyqcjSVPeiD7U1bWgKy3taYN7NWY-4", - "KT1UsSfaXyqcjSVPeiD7U1bWgKy3taYN7NWY-5", - "KT1UsSfaXyqcjSVPeiD7U1bWgKy3taYN7NWY-6", - "KT1UsSfaXyqcjSVPeiD7U1bWgKy3taYN7NWY-7", - "KT1XnTn74bUtxHfDtBmm2bGZAQfhPbvKWR8o", - "KT1F1mn2jbqQCJcsNgYKVAQjvenecNMY2oPK", - "KT193D4vozYnhGJQVtw7CoxxqphqUEEwK6Vb", - "KT1ErKVqEhG9jxXgUG2KGLW3bNM7zXHX8SDF", - "KT1AFA2mwNUMNd4SsujE1YYp29vd8BZejyKW", - "KT1XTxpQvo7oRCqp85LikEZgAZ22uDxhbWJv", - "KT1A5P4ejnLix13jtadsfV9GCnXLMNnab8UT", - "KT1XPFjZqCULSnqfKaaYy8hJjeY63UNSGwXg", - "KT1BHCumksALJQJ8q8to2EPigPW6qpyTr7Ng", - "KT1LRboPna9yQY9BrjtQYDS1DVxhKESK4VVd", - "KT1REEb5VxWRjcHm5GzDMwErMmNFftsE5Gpf", - "KT1AEfeckNbdEYwaMKkytBwPJPycz7jdSGea", - "KT1BB1uMwVvJ1M3vVHXWALs1RWdgTp1rnXTR", - "KT19y6R8x53uDKiM46ahgguS6Tjqhdj2rSzZ" - ], - "hpb": [ - "0xbe05ac1fb417c9ea435b37a9cecd39bc70359d31" - ], - "godwoken": [ - "0xe934f463d026d97f6ce0a10215d0ac4224f0a930", - "0xc3b946c53e2e62200515d284249f2a91d9df7954", - "0xa21b19d660917c1de263ad040ba552737cfcef50", - "0x07a388453944bb54be709ae505f14aeb5d5cbb2c", - "0x5c30d9396a97f2279737e63b2bf64cc823046591", - "0x7818fa4c71dc3b60049fb0b6066f18ff8c720f33", - "0x3f8d2b24c6fa7b190f368c3701ffcb2bd919af37" - ], - "godwoken_v1": [ - "0xc296f806d15e97243a08334256c705ba5c5754cd", - "0x7538c85cae4e4673253ffd2568c1f1b48a71558a", - "0x9e858a7aaedf9fdb1026ab1f77f627be2791e98a", - "0xbadb9b25150ee75bb794198658a4d0448e43e528", - "0x82455018f2c32943b3f12f4e59d0da2faf2257ef", - "0xef2439e020509259fa603c34b35a81ffe676cfb4", - "0xb66954619363145a05ef835547449eb9050d82f6", - "0x186181e225dc1ad85a4a94164232bd261e351c33", - "0xfa307cfdea89dc197a346c338a98ac85d517af6e", - "0xdff2facdfe47c1d5b51f18231f900949f1d5988f", - "0x53bb26dc8c5efc6c95c37155aca487d1d043436a", - "0x2c9fc6087875646112f66a3c92fef2d158faa76e", - "0x317f8d18fb16e49a958becd0ea72f8e153d25654", - "0x8e019acb11c7d17c26d334901fa2ac41c1f44d50", - "0x3c790b38f466514ffcb4230e7b2334e52b64c942", - "0xcd7bc9fc617a4f82ec1c8359d1c8610b90e3b44c", - "0x1c428a6539a40ec5bb481631266a51cd19b233b1", - "0xb44a9b6905af7c801311e8f4e76932ee959c663c", - "0x765277eebeca2e31912c9946eae1021199b39c61", - "0xe3f5a90f9cb311505cd691a46596599aa1a0ad7d", - "0xfa9343c3897324496a05fc75abed6bac29f8a40f" - ], - "waves": [ - "5UYBPpq4WoU5n4MwpFkgJnW3Fq4B1u3ukpK33ik4QerR", - "DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p", - "Atqv59EYzjFGuitKVnMRk6H8FukjoV3ktPorbEys25on", - "474jTeYx2r2Va35794tCScAXWJG9hU2HcgxzMowaZUnu", - "34N9YcEETLWn93qYQ64EsP1x89tSruJU44RrEMSXXEPJ", - "8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS", - "WAVES", - "2Fh9m3dNQXycHdnytEaETN3P1gDT7ij5U4HjMqQBeaqN", - "4GZH8rk5vDmMXJ81Xqfm3ovFaczqMnQ11r7aELiNxWBV", - "3KhNcHo4We1G5EWps7b1e5DTdLgWDzctc8S6ynu37KAb", - "GVxGPBtgVWMW1wHiFnfaCakbJ6sKgZgowJgW5Dqrd7JH", - "HcHacFH51pY91zjJa3ZiUVWBww54LnsL4EP3s7hVGo9L", - "4YmM7mj3Av4DPvpNpbtK4jHbpzYDcZuY6UUnYpqTbzLj", - "6QUVF8nVVVvM7do7JT2eJ5o5ehnZgXUg13ysiB9JiQrZ", - "7TMu26hAs7B2oW6c5sfx45KSZT7GQA3TZNYuCav8Dcqt", - "E4rss7qLUcawCvD2uMrbLeTMPGkX15kS3okWCbUhLNKL", - "HLckRcg7hJ3Syf3PrGftFijKqQMJipf81WY3fwvHCJbe", - "8zUYbdB8Q6mDhpcXYv52ji8ycfj4SDX4gJXS7YY3dA4R", - "8DLiYZjo3UUaRBTHU7Ayoqg4ihwb6YH1AfXrrhdjQ7K1", - "47cyc68FWJszCWEwMWVsD9CadjS2M1XtgANuRGbEW8UH", - "2bbGhKo5C31iEiB4CwGuqMYwjD7gCA9eXmm51fe2v8vT", - "BLRxWVJWaVuR2CsCoTvTw2bDZ3sQLeTbCofcJv7dP5J4", - "A1uMqYTzBdakuSNDv7CruWXP8mRZ4EkHwmip2RCauyZH", - "2thtesXvnVMcCnih9iZbJL3d2NQZMfzENJo8YFj6r5jU", - "2GBgdhqMjUPqreqPziXvZFSmDiQVrxNuGxR1z7ZVsm4Z", - "Aug9ccbPApb1hxXSue8fHuvbyMf1FV1BYBtLUuS5LZnU", - "ATQdLbehsMrmHZLNFhUm1r6s14NBT5JCFcSJGpaMrkAr", - "8YyrMfuBdZ5gtMWkynLTveRvGb6LJ4Aff9rpz46UUMW", - "EfwRV6MuUCGgAUchdsF4dDFnSpKrDW3UYshdaDy4VBeB", - "5zoDNRdwVXwe7DveruJGxuJnqo7SYhveDeKb8ggAuC34", - "DSbbhLsSTeDg5Lsiufk2Aneh3DjVqJuPr2M9uU1gwy5p", - "4LHHvYGNKJUg5hj65aGD5vgScvCBmLpdRFtjokvCjSL8", - "6nSpVyNH7yM69eg446wrQR94ipbbcmZMU1ENPwanC97g", - "Ehie5xYpeN8op1Cctc6aGUrqx8jq3jtf1DSjXDbfm7aT", - "7LMV3s1J4dKpMQZqge5sKYoFkZRLojnnU49aerqos4yg", - "9sQutD5HnRvjM1uui5cVC4w9xkMPAfYEV8ymug3Mon2Y", - "DHgwrRvVyqJsepd32YbBqUeDH4GJ1N984X8QoekjgH8J", - "HZk1mbfuJpmxU1Fs4AX5MWLVYtctsNcg6e2C6VKqK8zk", - "6XtHjpXbs9RRJP2Sr9GUyVqzACcby9TkThHXnjVC5CDJ" - ], - "songbird": [ - "0x02f0826ef6ad107cfc861152b32b52fd11bab9ed", - "0x70ad7172ef0b131a1428d0c1f66457eb041f2176", - "0xc348f894d0e939fe72c467156e6d7dcbd6f16e21" - ], - "energi": [ - "0x7a86173daa4fda903c9a4c0517735a7d34b9ec39", - "0xa55f26319462355474a9f2c8790860776a329aa4" - ], - "nahmii": [ - "0x4200000000000000000000000000000000000006", - "0x595dba438a1bf109953f945437c1584319515d88" - ], - "curio": [ - "0x134ebab7883dfa9d04d20674dd8a8a995fb40ced" - ], - "gochain": [ - "0xcc237fa0a4b80ba47992d102352572db7b96a6b5", - "0x97a19ad887262d7eca45515814cdef75acc4f713", - "0x67bbb47f6942486184f08a671155fcfa6cad8d71" - ], - "smartbch": [ - "0x3743ec0673453e5009310c727ba4eaf7b3a1cc04", - "0x0b00366fbf7037e9d75e4a569ab27dab84759302", - "0x7b2b3c5308ab5b2a1d9a94d20d35ccdf61e05b72", - "0x24d8d5cbc14fa6a740c3375733f0287188f8df3b", - "0xbc2f884680c95a02cea099da2f524b366d9028ba", - "0x265bd28d79400d55a1665707fa14a72978fa6043", - "0x9192940099fdb2338b928de2cad9cd1525fea881" - ], - "palm": [ - "0x4c1f6fcbd233241bf2f4d02811e3bf8429bc27b8", - "0x726138359c17f1e56ba8c4f737a7caf724f6010b" - ], - "syscoin": [ - "0xd3e822f3ef011ca5f17d82c956d952d8d7c3a1bb", - "0x2bf9b864cdc97b08b6d79ad4663e71b8ab65c45c", - "0x7c598c96d02398d89fbcb9d41eab3df0c16f227d", - "0x922d641a426dcffaef11680e5358f34d97d112e1" - ], - "vision": [ - "0x1db6cdc620388a0b6046b20cd59503a0839adcff", - "0x79ffbc4fff98b821d59dbd7b33f91a2783006b6f" - ], - "kava": [ - "0xc86c7c0efbd6a49b35e8714c5f59d99de09a225b", - "0xfa9343c3897324496a05fc75abed6bac29f8a40f", - "0xb44a9b6905af7c801311e8f4e76932ee959c663c", - "0x818ec0a7fe18ff94269904fced6ae3dae6d6dc0b", - "0x765277eebeca2e31912c9946eae1021199b39c61", - "0x7c598c96d02398d89fbcb9d41eab3df0c16f227d", - "0xe3f5a90f9cb311505cd691a46596599aa1a0ad7d", - "0x332730a4f6e03d9c55829435f10360e13cfa41ff", - "0x65e66a61d0a8f1e686c2d6083ad611a10d84d97a", - "0xc13791da84f43525189456cfe2026c60d3b7f706" - ], - "sx": [ - "0xaa99be3356a11ee92c3f099bd7a038399633566f", - "0xa173954cc4b1810c0dbdb007522adbc182dab380", - "0xe2aa35c2039bd0ff196a6ef99523cc0d3972ae3e", - "0xfa6f64dfbad14e6883321c2f756f5b22ff658f9c", - "0x53813cd4acd7145a716b4686b195511fa93e4cb7", - "0x7dc31a2fcbfbad1ed4519111fd33f78316bcbc81" - ], - "meter": [ - "0x5729cb3716a315d0bde3b5e489163bf8b9659436", - "0x160361ce13ec33c993b5cca8f62b6864943eb083", - "0xd86e243fc0007e6226b07c9a50c9d70d78299eb5", - "0x6abaedab0ba368f1df52d857f24154cc76c8c972", - "0x24aa189dfaa76c671c279262f94434770f557c35", - "0x75fd6f7edcc5e7a8100ead3d29ccd844153ef0f3", - "0x5fa41671c48e3c951afc30816947126ccc8c162e" - ], - "callisto": [ - "0xf5ad6f6edec824c7fd54a66d241a227f6503ad3a", - "0xbf6c50889d3a620eb42c0f188b65ade90de958c4", - "0xccc766f97629a4e14b3af8c91ec54f0b5664a69f", - "0xcc208c32cc6919af5d8026dab7a3ec7a57cd1796", - "0xccde29903e621ca12df33bb0ad9d1add7261ace9", - "0x9fae2529863bd691b4a7171bdfcf33c7ebb10a65" - ], - "thundercore": [ - "0x413cefea29f2d07b8f2acfa69d92466b9535f717", - "0x4f3c8e20942461e2c3bdd8311ac57b0c222f2b82", - "0x6576bb918709906dcbfdceae4bb1e6df7c8a1077", - "0x22e89898a04eaf43379beb70bf4e38b1faf8a31e", - "0xbeb0131d95ac3f03fd15894d0ade5dbf7451d171" - ], - "conflux": [ - "0x14b2d3bc65e74dae1030eafd8ac30c533c976a9b", - "0x1f545487c62e5acfea45dcadd9c627361d1616d8", - "0xa47f43de2f9623acb395ca4905746496d2014d57", - "0x6963efed0ab40f6c3d7bda44a05dcf1437c44372 ", - "0xfe97e85d13abd9c1c33384e796f10b73905637ce" - ], - "muuchain": [ - "0x875358f6194d7c622d6355455f3137cceb2955c4" - ], - "iotex": [ - "0xa00744882684c3e4747faefd68d283ea44099d03", - "0x3fe04320885e6124231254c802004871be681218", - "0xe1ce1c0fa22ec693baca6f5076bcdc4d0183de1c", - "0x6fbcdc1169b5130c59e72e51ed68a84841c98cd1", - "0x3cdb7c48e70b854ed2fa392e21687501d84b3afc", - "0x3b2bf2b523f54c4e454f08aa286d03115aff326c", - "0xc04da3a99d17135857bb937d2fbb321d3b6c6a81", - "0x42c9255d5e522e83b16ea11a3ba04c2d3afca079", - "0x037346e5a5722957ac2cab6ceb8c74fc18cea91d", - "0x84abcb2832be606341a50128aeb1db43aa017449", - "0xacee9b11cd4b3f57e58880277ac72c8c41abe4e4", - "0x62a9d987cbf4c45a550deed5b57b200d7a319632", - "0x1cbad85aa66ff3c12dc84c5881886eeb29c1bb9b", - "0xd6070ae98b8069de6b494332d1a1a81b6179d960", - "0xec690cdd448e3cbb51ed135df72301c3265a8f80", - "0x4d7b88403aa2f502bf289584160db01ca442426c", - "0x0258866edaf84d6081df17660357ab20a07d0c80", - "0xc7b93720f73b037394ce00f954f849ed484a3dea", - "0x17df9fbfc1cdab0f90eddc318c4f6fcada730cf2", - "0x4752456e00def6025c77b55a88a2f8a1701f92f9", - "0x490cfbf9b9c43633ddd1968d062996227ef438a9", - "0x97e6c48867fdc391a8dfe9d169ecd005d1d90283", - "0x86702a7f8898b172de396eb304d7d81207127915", - "0x8e66c0d6b70c0b23d39f4b21a1eac52bba8ed89a", - "0x176cb5113b4885b3a194bd69056ac3fe37a4b95c", - "0x99b2b0efb56e62e36960c20cd5ca8ec6abd5557a" - ], - "ronin": [ - "0xe514d9deb7966c8be0ca922de8a064264ea6bcd4", - "0x97a9107c1793bc407d6f527b77e7fff4d812bece", - "0xa8754b9fa15fc18bb59458815510e40a12cd2014", - "0xc99a6a985ed2cac1ef41640596c5a5f9f4e19ef5", - "0x0b7007c13325c48911f73a2dad5fa5dcbf808adc" - ], - "arbitrum_nova": [ - "0x722e8bdd2ce80a4422e880164f2079488e115365", - "0xda10009cbd5d07dd0cecc66161fc93d7c9000da1", - "0x52484e1ab2e2b22420a25c20fa49e173a26202cd", - "0x750ba8b76187092b0d1e87e28daaf484d1b5273b" - ], - "ethpow": [ - "ethereum:0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", - "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", - "0x0c9f28fbdfd79f7c00b805d8c63d053c146d282c", - "0x7bf88d2c0e32de92cdaf2d43ccdc23e8edfd5990", - "0x11bbb41b3e8baf7f75773db7428d5acee25fec75", - "0x8a496486f4c7cb840555bc2be327cba1447027c3", - "0x5df101f56ea643e06066392d266e9f4366b9186d", - "0xaf3ccfd9b59b36628cc2f659a09d6440795b2520", - "0x312b15d6d531ea0fe91ddd212db8c0f37e4cc698", - "0x2ad7868ca212135c6119fd7ad1ce51cfc5702892", - "0x34a9c05b638020a07bb153bf624c8763bf8b4a86", - "0xbd1563046a90f18127fd39f3481fd8d6ab22877f", - "0xf61eb8999f2f222f425d41da4c2ff4b6d8320c87", - "0x4bbd68d8b1f25ae7b460e3347c637fe9e7338e0c", - "0x25de68ef588cb0c2c8f3537861e828ae699cd0db", - "0x0b35d852dcb8b59eb1e8d3182ebad4e96e2df8f0" - ], - "xdc": [ - "0xd4b5f10d61916bd6e0860144a91ac658de8a1437", - "0x951857744785e80e2de051c32ee7b25f9c458c42", - "0x36726235dadbdb4658d33e62a249dca7c4b2bc68", - "0x5d5f074837f5d4618b3916ba74de1bf9662a3fed", - "0xd04275e2fd2875beaade6a80b39a75d4fe267df6", - "0xff7412ea7c8445c46a8254dfb557ac1e48094391" - ], - "kardia": [ - "0xaf984e23eaa3e7967f3c5e007fbe397d8566d23d", - "0x92364ec610efa050d296f1eeb131f2139fb8810e", - "0x2eddba8b949048861d2272068a94792275a51658" - ] -} \ No newline at end of file + "null": "0x0000000000000000000000000000000000000000", + "ethereum": { + "WETH": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", + "WSTETH": "0x7f39c581f595b53c5cb19bd0b3f8da6c935e2ca0", + "STETH": "0xae7ab96520de3a18e5e111b5eaab095312d7fe84", + "sfrxETH": "0xac3e018457b222d93114458476f3e3416abbe38f", + "USDC": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", + "LINK": "0x514910771af9ca656af840dff83e8264ecf986ca", + "MATIC": "0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0", + "BAT": "0x0d8775f648430679a709e98d2b0cb6250d2887ef", + "RETH": "0xae78736cd615f374d3085123a210448e74fc6393", + "USDT": "0xdac17f958d2ee523a2206206994597c13d831ec7", + "UNI": "0x1f9840a85d5af5bf1d1762f925bdaddc4201f984", + "AAVE": "0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9", + "WBTC": "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599", + "SNX": "0xc011a73ee8576fb46f5e1c5751ca3b9fe0af2a6f", + "YFI": "0x0bc529c00c6401aef6d220be8c6ea1667f6ad93e", + "DAI": "0x6b175474e89094c44da98b954eedeac495271d0f", + "SAI": "0x89d24A6b4CcB1B6fAA2625fE562bDD9a23260359", + "cvxFXS": "0xfeef77d3f69374f66429c91d732a244f074bdf74", + "cvxCRV": "0x62B9c7356A2Dc64a1969e19C23e4f579F9810Aa7", + "vlCVX": "0x72a19342e8f1838460ebfccef09f6585e32db86e", + "CVX": "0x4e3FBD56CD56c3e72c1403e103b45Db9da5B9D2B", + "FRAX": "0x853d955aCEf822Db058eb8505911ED77F175b99e", + "BNB": "0xb8c77482e45f1f44de1745f52c74426c631bdd52", + "tBTC": "0x18084fba666a33d37592fa2633fd49a74dd93a88", + "USX": "0x0a5e677a6a24b2f1a2bf4f3bffc443231d2fdec8", + "SAFE": "0x5aFE3855358E112B5647B952709E6165e1c1eEEe", + "TOKE": "0x2e9d63788249371f1dfc918a52f8d799f4a38c94", + "TUSD": "0x0000000000085d4780B73119b644AE5ecd22b376", + "BUSD": "0x4fabb145d64652a948d72533023f6e7a623c7c53", + "INU": "0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE", + "LIDO": "0x5a98fcbea516cf06857215779fd812ca3bef1b32", + "MKR": "0x9f8f72aa9304c8b593d555f12ef6589cc3a579a2", + "CRV": "0xd533a949740bb3306d119cc777fa900ba034cd52", + "FTM": "0x4e15361fd6b4bb609fa63c81a2be19d873717870", + "GNO": "0x6810e776880C02933D47DB1b9fc05908e5386b96", + "LUSD": "0x5f98805A4E8be255a32880FDeC7F6728C6568bA0", + "sUSD_OLD": "0x57ab1e02fee23774580c119740129eac7081e9d3", + "sUSD": "0x57Ab1ec28D129707052df4dF418D58a2D46d5f51", + "SUSHI": "0x6b3595068778dd592e39a122f4f5a5cf09c90fe2" + }, + "fantom": { + "WFTM": "0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83", + "USDC": "0x04068da6c83afcfa0e13ba15a6696662335d5b75", + "fUSDT": "0x049d68029688eabf473097a2fc38ef61633a3c7a", + "DAI": "0x8d11ec38a3eb5e956b052f67da8bdc9bef8abf3e", + "MIM": "0x82f0b8b456c1a451378467398982d4834b6829c1", + "renBTC": "0xdbf31df14b66535af65aac99c32e9ea844e14501", + "cUSD": "0xe3a486c1903ea794eed5d5fa0c9473c7d7708f40", + "anyUSDC": "0x95bf7e307bc1ab0ba38ae10fc27084bc36fcd605", + "nUSD": "0xc5cd01e988cd0794e05ab80f2bcdbdf13ce08bd3", + "nICE": "0x7f620d7d0b3479b1655cefb1b0bc67fb0ef4e443" + }, + "csc": { + "WCET": "0xe6f8988d30614afe4f7124b76477add79c665822", + "USDT": "0x398dca951cd4fc18264d995dcd171aa5debda129" + }, + "europa": { + "USDP": "0x73d22d8a2D1f59Bf5Bcf62cA382481a2073FAF58", + "WBTC": "0xcb011E86DF014a46F4e3AC3F3cbB114A4EB80870", + "SKL": "0xE0595a049d02b7674572b0d59cd4880Db60EDC50", + "ETHC": "0xD2Aaa00700000000000000000000000000000000", + "USDT": "0x1c0491E3396AD6a35f061c62387a95d7218FC515", + "USDC": "0x5F795bb52dAC3085f578f4877D450e2929D2F13d", + "DAI": "0xD05C4be5f3be302d376518c9492EC0147Fa5A718" + }, + "avax": { + "WAVAX": "0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7", + "USDC": "0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e", + "DAI": "0xd586E7F844cEa2F87f50152665BCbc2C279D8d70", + "USDT_e": "0xc7198437980c041c805a1edcba50c1ce5db95118", + "USDt": "0x9702230a8ea53601f5cd2dc00fdbc13d4df4a8c7", + "BTC_b": "0x152b9d0fdc40c096757f570a51e494bd4b943e50", + "USDC_e": "0xa7d7079b0fead91f3e65f86e8915cb59c1a4c664", + "WETH_e": "0x49d5c2bdffac6ce2bfdb6640f4f80f226bc10bab", + "JOE": "0x6e84a6216ea6dacc71ee8e6b0a5b7322eebc0fdd", + "ZERO": "0x008e26068b3eb40b443d3ea88c1ff99b789c10f7", + "qiAVAX": "0xaf2c034c764d53005cc6cbc092518112cbd652bb", + "xJOE": "0x57319d41f71e81f3c65f2a47ca4e001ebafd4f33", + "LVTX": "0x574679ec54972cf6d705e0a71467bb5bb362919d", + "sUSDC": "0x2f28add68e59733d23d5f57d94c31fb965f835d0", + "sBUSD": "0xf04d3a8eb17b832fbebf43610e94bdc4fd5cf2dd" + }, + "bsc": { + "WBNB": "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c", + "BTCB": "0x7130d2a12b9bcbfae4f2634d864a1ee1ce3ead9c", + "BETH": "0x250632378e573c6be1ac2f97fcdf00515d0aa91b", + "BUSD": "0xe9e7cea3dedca5984780bafc599bd69add087d56", + "BTUSD": "0x14016e85a25aeb13065688cafb43044c2ef86784", + "USDC": "0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d", + "USDT": "0x55d398326f99059ff775485246999027b3197955", + "ETH": "0x2170ed0880ac9a755fd29b2688956bd959f933f8", + "AURA": "0x23c5d1164662758b3799103effe19cc064d897d6", + "C98": "0xaec945e04baf28b135fa7c640f624f8d90f1c3a6", + "NMX": "0xd32d01a43c869edcd1117c640fbdcfcfd97d9d65", + "sUSDC": "0x2f28add68e59733d23d5f57d94c31fb965f835d0", + "MAHA": "0xce86f7fcd3b40791f63b86c3ea3b8b355ce2685b", + "valBUSD": "0xaed19dab3cd68e4267aec7b2479b1ed2144ad77f", + "valUSDC": "0xa6fdea1655910c504e974f7f1b520b74be21857b", + "valUSDT": "0x5f7f6cb266737b89f7af86b30f03ae94334b83e9", + "SPICE": "0x42586ef4495bb512a86cf7496f6ef85ae7d69a64", + "iZi": "0x60d01ec2d5e98ac51c8b4cf84dfcce98d527c747", + "iUSD": "0x0a3bb08b3a15a19b4de82f8acfc862606fb69a2d", + "beltBNB": "0xa8bb71facdd46445644c277f9499dd22f6f0a30c", + "Belt4": "0x9cb73f20164e399958261c289eb5f9846f4d1404", + "beltBTC": "0x51bd63f240fb13870550423d208452ca87c44444", + "beltETH": "0xaa20e8cb61299df2357561c2ac2e1172bc68bc25", + "YGG": "0x13ab6739368a4e4abf24695bf52959224367391f", + "IVN": "0x6a46d878401f46b4c7f665f065e0667580e031ec", + "ankrBNB": "0xe85afccdafbe7f2b096f268e31cce3da8da2990a", + "aBNBb": "0xbb1aa6e59e5163d8722a122cd66eba614b59df0d", + "TUSD": "0x40af3827f39d0eacbf4a168f8d4ee67c121d11c9" + }, + "polygon": { + "WMATIC": "0xfd28c7cea3c50a060cb4c0059e453c6d4dd9829d", + "WMATIC_1": "0x0000000000000000000000000000000000001010", + "WMATIC_2": "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270", + "MATICX": "0xfa68FB4628DFF1028CFEc22b4162FCcd0d45efb6", + "USDC": "0x2791bca1f2de4661ed88a30c99a7a9449aa84174", + "QUICK": "0xb5c064f955d8e7f38fe0460c556a72987494ee17", + "WBTC": "0x1bfd67037b42cf73acf2047067bd4f2c47d9bfd6", + "USDT": "0xc2132d05d31c914a87c6611c10748aeb04b58e8f", + "DAI": "0x8f3cf7ad23cd3cadbd9735aff958023239c6a063", + "WETH": "0x6cacfaf65b1b1f9979acf463a393a112d0980982", + "WETH_1": "0x7ceb23fd6bc0add59e62ac25578270cff1b9f619", + "WSTETH": "0x03b54A6e9a984069379fae1a4fC4dBAE93B3bCCD", + "DINO": "0xaa9654becca45b5bdfa5ac646c939c62b527d394", + "sUSDC": "0x2f28add68e59733d23d5f57d94c31fb965f835d0", + "sBUSD": "0xf04d3a8eb17b832fbebf43610e94bdc4fd5cf2dd", + "RADIO": "0x613a489785c95afeb3b404cc41565ccff107b6e0", + "YIN": "0x794baab6b878467f93ef17e2f2851ce04e3e34c8", + "BNB": "0x5c4b7ccbf908e64f32e12c6650ec0c96d717f03f", + "BUSD": "0x9c9e5fd8bbc25984b178fdce6117defa39d2db39", + "WORK": "0x6002410dda2fb88b4d0dc3c1d562f7761191ea80" + }, + "xdai": { + "WXDAI": "0xe91d153e0b41518a2ce8dd3d7944fa863463a97d", + "USDC": "0xddafbb505ad214d7b80b1f830fccc89b60fb7a83", + "GNO": "0x9c58bacc331c9aa871afd802db6379a98e80cedb", + "WETH": "0x6a023ccd1ff6f2045c3309768ead9e68f978f6e1", + "USDT": "0x4ecaba5870353805a9f068101a40e0f32ed605c6", + "DAI": "0x44fa8e6f47987339850636f88629646662444217", + "UNI": "0x4537e328bf7e4efa29d05caea260d7fe26af9d74", + "MATIC": "0x7122d7661c4564b7c6cd4878b06766489a6028a2", + "WBTC": "0x8e5bbbb09ed1ebde8674cda39a0c169401db4252", + "ETHIX": "0xec3f3e6d7907acda3a7431abd230196cda3fbb19", + "DAI_1": "0x678df3415fc31947da4324ec63212874be5a82f8" + }, + "okexchain": { + "USDC": "0xc946daf81b08146b1c7a8da2a851ddf2b3eaaf85", + "WOKT": "0x8f8526dbfd6e38e3d8307702ca8469bae6c56c15", + "USDT": "0x382bb369d343125bfb2117af9c149795c6c65c50", + "BTCK": "0x54e4622dc504176b3bb432dccaf504569699a7ff", + "ETHK": "0xef71ca2ee68f45b9ad6f72fbdb33d707b872315c", + "OKB": "0xdf54b6c6195ea4d948d03bfd818d365cf175cfc2", + "CHE": "0x8179d97eb6488860d816e3ecafe694a4153f216c", + "ELK": "0xe1c110e1b1b4a1ded0caf3e42bfbdbb7b5d7ce1c" + }, + "heco": { + "WHT": "0x5545153ccfca01fbd7dd11c0b23ba694d9509a6f", + "BETH": "0xb6f4c418514dd4680f76d5caa3bb42db4a893acb", + "ELK": "0xe1c110e1b1b4a1ded0caf3e42bfbdbb7b5d7ce1c", + "DAI_HECO": "0x3d760a45d0887dfd89a2f5385a236b29cb46ed2a", + "USDC_HECO": "0x9362bbef4b8313a8aa9f0c9808b80577aa26b73b", + "COMP": "0xce0a5ca134fb59402b723412994b30e02f083842", + "DOGE": "0x40280e26a572745b1152a54d1d44f365daa51618", + "TUSD": "0x5ee41ab6edd38cdfb9f6b4e6cf7f75c87e170d98", + "XRP": "0xa2f3c2446a3e20049708838a779ff8782ce6645a", + "USDT": "0xa71edc38d189767582c38a3145b5873052c3e47a", + "ADA": "0x843af718ef25708765a8e0942f89edeae1d88df0" + }, + "hoo": { + "wHOO": "0x3eff9d389d13d6352bfb498bcf616ef9b1beac87" + }, + "harmony": { + "JEWEL": "0x72cb10c6bfa5624dd07ef608027e366bd690048f", + "MIS": "0xd74433b187cf0ba998ad9be3486b929c76815215", + "WONE": "0xcf664087a5bb0237a0bad6742852ec6c8d69a27a", + "xJEWEL": "0xa9ce83507d872c5e1273e745abcfda849daa654f", + "AVAX": "0xb12c13e66ade1f72f71834f2fc5082db8c091358", + "VIPER": "0xea589e93ff18b1a1f1e9bac7ef3e86ab62addc79" + }, + "optimism": { + "OP": "0x4200000000000000000000000000000000000042", + "WETH": "0x121ab82b49b2bc4c7901ca46b8277962b4350204", + "WETH_1": "0x4200000000000000000000000000000000000006", + "BitANT": "0x5029c236320b8f15ef0a657054b84d90bfbeded3", + "FEI": "0x35d48a789904e9b15705977192e5d95e2af7f1d3", + "alUSD": "0xcb8fa9a76b8e203d8c3797bf438d8fb81ea3326a", + "FXS": "0x67ccea5bb16181e7b4109c9c2143c24a1c2205be", + "FRAX": "0x2e3d870790dc77a83dd1d18184acc7439a53f475", + "gOHM": "0x0b5740c6b4a97f90ef2f0220651cca420b868ffb", + "sUSD": "0x8c6f28f2f1a3c87f0f938b96d27520d9751ec8d9", + "sETH": "0xe405de8f52ba7559f9df3c368500b6e6ae6cee49", + "USDT": "0x94b008aa00579c1307b0ef2c499ad98a8ce58e58", + "USDC": "0x7F5c764cBc14f9669B88837ca1490cCa17c31607", + "DAI": "0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1" + }, + "moonriver": { + "WMOVR": "0xe3c7487eb01c74b73b7184d198c7fbf46b34e5af", + "USDT": "0xb44a9b6905af7c801311e8f4e76932ee959c663c", + "USDC": "0xe3f5a90f9cb311505cd691a46596599aa1a0ad7d", + "ETH": "0x639a647fbe20b6c8ac19e48e2de44ea792c62c5c", + "ELK": "0xe1c110e1b1b4a1ded0caf3e42bfbdbb7b5d7ce1c", + "BEPRO": "0xcb4a593ce512d78162c58384f0b2fd6e802c2c47" + }, + "moonbeam": { + "WGLMR": "0x5f6c5c2fb289db2228d159c69621215e354218d7", + "USDC": "0x6a2d262d56735dba19dd70682b39f6be9a931d98", + "STELLA": "0x0e358838ce72d5e61e0018a2ffac4bec5f4c88d2", + "BUSD": "0x692c57641fc054c2ad6551ccc6566eba599de1ba", + "GLINT": "0xcd3b51d98478d53f4515a306be565c6eebef1d58", + "FRAX": "0x322e86852e492a7ee17f28a78c663da38fb33bfb", + "MAI": "0xdfa46478f9e5ea86d57387849598dbfb2e964b02", + "USDT": "0x81ecac0d6be0550a00ff064a4f9dd2400585fe9c", + "WETH": "0x6959027f7850adf4916ff5fdc898d958819e5375", + "WBTC": "0xe57ebd2d67b462e9926e04a8e33f01cd0d64346d", + "MOVR": "0x1d4c2a246311bb9f827f4c768e277ff5787b7d7e", + "xcUSDT": "0xffffffffea09fb06d082fd1275cd48b191cbcd1d", + "BEPRO": "0x4edf8e0778967012d46968ceadb75436d0426f88", + "stDOT": "0xfa36fe1da08c89ec72ea1f0143a35bfd5daea108" + }, + "arbitrum": { + "WETH": "0x82af49447d8a07e3bd95bd0d56f35241523fbab1", + "WBTC": "0x2f2a2543b76a4166549f7aab2e75bef0aefc5b0f", + "DAI": "0xda10009cbd5d07dd0cecc66161fc93d7c9000da1", + "USDC": "0xff970a61a04b1ca14834a43f5de4533ebddb5cc8", + "USDC_CIRCLE": "0xaf88d065e77c8cC2239327C5EDb3A432268e5831", + "LINK": "0xf97f4df75117a78c1a5a0dbb814af92458539fb4", + "USDT": "0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9", + "ARBY": "0x09ad12552ec45f82be90b38dfe7b06332a680864", + "ARB": "0x912ce59144191c1204e64559fe8253a0e49e6548", + "MIM": "0xfea7a6a0b346362bf88a9e4a88416b77a57d6c2a", + "renBTC": "0xdbf31df14b66535af65aac99c32e9ea844e14501", + "DFL": "0x31635a2a3892daec7c399102676e344f55d20da7", + "FEI": "0x4a717522566c7a09fd2774ccedc5a8c43c5f9fd2", + "nUSD": "0x2913e812cf0dcca30fb28e6cac3d2dcff4497688", + "LPT": "0x289ba1701c2f088cf0faf8b3705246331cb8a839", + "APEX": "0x61a1ff55c5216b636a294a07d77c6f4df10d3b56", + "LIQD": "0x93c15cd7de26f07265f0272e0b831c5d7fab174f", + "fsGLP": "0x1addd80e6039594ee970e5872d247bf0414c8903", + "fGLP": "0x4e971a87900b931ff39d1aad67697f49835400b6", + "GMX": "0xfc5A1A6EB076a2C7aD06eD22C90d7E710E35ad0a", + "plvGLP": "0x5326e71ff593ecc2cf7acae5fe57582d6e74cff1" + }, + "fuse": { + "WFUSE": "0x0be9e53fd7edac9f859882afdda116645287c629", + "USDC": "0x620fd5fa44be6af63715ef4e65ddfa0387ad13f5", + "WETH": "0xa722c13135930332eb3d749b2f0906559d2c5b99", + "DAI": "0x94ba7a27c7a95863d1bdc7645ac2951e0cca06ba", + "USDT": "0xfadbbf8ce7d5b7041be672561bba99f79c532e10", + "KNC": "0x43b17749b246fd2a96de25d9e4184e27e09765b0", + "null": "0x0000000000000000000000000000000000000000" + }, + "evmos": { + "WEVMOS": "0xd4949664cd82660aae99bedc034a0dea8a0bd517", + "STEVMOS": "0x2c68d1d6ab986ff4640b51e1f14c716a076e44c4", + "STATOM": "0xb5124fa2b2cf92b2d469b249433ba1c96bdf536d", + "ATOM": "0xc5e00d3b04563950941f7137b5afa3a534f0d6d6", + "STRIDE": "0x8fa78ceb7f04118ec6d06aac37ca854691d8e963", + "axlRETH": "0xe60ce2dfa6d4ad37ade1dcb7ac4d6c3a093b3a7e", + "USDT_CEL": "0xb72a7567847aba28a2819b855d7fe679d4f59846", + "AXL_WETH": "0x50de24b3f0b3136c50fa8a3b8ebc8bd80a269ce5", + "USDC": "0x51e44ffad5c2b122c8b635671fcc8139dc636e82", + "tBTC": "0x8d395affc1767141387fff45af88a074614e7ccf", + "renBTC": "0xb1a8c961385b01c3aa782fba73e151465445d319", + "ceUSDC": "0xe46910336479f254723710d57e7b683f3315b22b", + "DAI": "0x63743acf2c7cfee65a5e356a4c4a005b586fc7aa", + "USDT": "0x7ff4a56b32ee13d7d4d405887e0ea37d61ed919e", + "ceUSDT": "0xb72a7567847aba28a2819b855d7fe679d4f59846", + "WETH": "0x5842c5532b61acf3227679a8b1bd0242a41752f2", + "WBTC": "0xf80699dc594e00ae7ba200c7533a07c1604a106d", + "FRAX": "0xe03494d0033687543a80c9b1ca7d6237f2ea8bd8", + "DIFF": "0x3f75ceabcdfed1aca03257dc6bdc0408e2b4b026", + "AXL_USDC": "0x15c3eb3b621d1bff62cba1c9536b7c1ae9149b57" + }, + "oasis": { + "WETH": "0x3223f17957ba502cbe71401d55a0db26e5f7c68f", + "ceUSDT": "0x4bf769b05e832fcdc9053fffbc78ca889acb5e1e", + "USDT": "0x6ab6d61428fde76768d7b45d8bfeec19c6ef91a8", + "USDC": "0xe8a638b3b7565ee7c5eb9755e58552afc87b94dd", + "wROSE": "0x21c718c22d52d0f3a789b752d4c2fd5908a8a733", + "WROSE": "0x5c78a65ad6d0ec6618788b6e8e211f31729111ca", + "TULIP": "0x9e832cae5d19e7ff2f0d62881d1e33bb16ac9bdc", + "ceUSDC": "0x81ecac0d6be0550a00ff064a4f9dd2400585fe9c" + }, + "kcc": { + "BUSD": "0xe3f5a90f9cb311505cd691a46596599aa1a0ad7d", + "KUS": "0x4a81704d8c16d9fb0d7f61b747d0b5a272badf14", + "ELK": "0xe1c110e1b1b4a1ded0caf3e42bfbdbb7b5d7ce1c", + "BNB": "0x639a647fbe20b6c8ac19e48e2de44ea792c62c5c", + "DAI": "0xc9baa8cfdde8e328787e29b4b078abf2dadc2055", + "WBTC": "0x218c3c3d49d0e7b37aff0d8bb079de36ae61a4c0", + "ETH": "0xf55af137a98607f7ed2efefa4cd2dfe70e4253b1", + "WKCS": "0x4446fc4eb47f2f6586f9faab68b3498f86c07521", + "MJT": "0x2ca48b4eea5a731c2b54e7c3944dbdb87c0cfb6f", + "USDT": "0x0039f574ee5cc39bdd162e9a88e3eb1f111baf48", + "USDC": "0x980a5afef3d17ad98635f6c5aebcbaeded3c3430", + "BTCK": "0xfa93c12cd345c658bc4644d1d4e1b9615952258c", + "sKCS": "0x00ee2d494258d6c5a30d6b6472a09b27121ef451" + }, + "metis": { + "Metis": "0xdeaddeaddeaddeaddeaddeaddeaddeaddead0000", + "WMETIS": "0x71802e8f394bb9d05a1b8e9d0562917609fd7325", + "m_USDT": "0xbb06dca3ae6887fabf931640f67cab3e3a16f4dc", + "WETH": "0x420000000000000000000000000000000000000a", + "m_USDC": "0xea32a96608495e54156ae48931a7c20f0dcc1a21", + "BNB": "0x2692be44a6e38b698731fddf417d060f0d20a0cb", + "WBTC": "0xa5b55ab1daf0f8e1efc0eb1931a957fd89b918f4", + "BUSD": "0x12d84f1cfe870ca9c9df9785f8954341d7fbb249", + "rAVAX": "0xe253e0cea0cdd43d9628567d097052b33f98d611", + "rFTM": "0xa9109271abcf0c4106ab7366b4edb34405947eed", + "DAI": "0x4651b38e7ec14bb3db731369bfe5b08f2466bd0a", + "RELAY": "0xfe282af5f9eb59c30a3f78789eeffa704188bdd4", + "FTM": "0x6ab6d61428fde76768d7b45d8bfeec19c6ef91a8", + "MATIC": "0x4b9d2923d875edf43980bf5ddddede3fb20fc742", + "SYN": "0x67c10c397dd0ba417329543c1a40eb48aaa7cd00", + "BORING": "0x226d8bfb4da78ddc5bd8fd6c1532c58e88f9fd34", + "m_WBTC": "0x433e43047b95cb83517abd7c9978bdf7005e9938", + "m_AAVE": "0xd1f0a4e5444eed0fbcd6624dcef7ef33043e6168" + }, + "celo": { + "CELO": "0x471ece3750da237f93b8e339c536989b8978a438", + "cUSD": "0x765de816845861e75a25fca122bb6898b8b1282a", + "ETHIX": "0x9995cc8f20db5896943afc8ee0ba463259c931ed", + "mCELO": "0x7d00cd74ff385c955ea3d79e47bf06bd7386387d", + "mcUSD": "0x918146359264c492bd6934071c6bd31c854edbc3", + "mCEUR": "0xe273ad7ee11dcfaa87383ad5977ee1504ac07568", + "USDC": "0x2a3684e9dc20b857375ea04235f2f7edbe818fa7", + "aaUSDC": "0xb70e0a782b058bfdb0d109a3599bec1f19328e36", + "asUSDC": "0xcd7d7ff64746c1909e44db8e95331f9316478817", + "cUSDC": "0x93db49be12b864019da9cb147ba75cdc0506190e", + "cUSDT": "0xcfffe0c89a779c09df3df5624f54cdf7ef5fdd5d", + "WBTC": "0xbaab46e28388d2779e6e31fd00cf0e5ad95e327b", + "WETH": "0x66803fb87abd4aac3cbb3fad7c3aa01f6f3fb207", + "atUST": "0xed193c4e69f591e42398ef54dea65aa1bb02835c", + "DAI": "0x90ca507a5d4458a4c6c6249d186b6dcb02a5bccd", + "NCT": "0x02de4766c272abc10bc88c220d214a26960a7e92", + "cMCO2": "0x32a9fe697a32135bfd313a6ac28792dae4d9979d", + "USDT": "0x617f3112bf5397d0467d315cc709ef968d9ba546" + }, + "boba": { + "WETH": "0xd203de32170130082896b4111edf825a4774c18e", + "BOBA": "0xa18bf3994c0cc6e3b63ac420308e5383f53120d7", + "USDC": "0x66a2a913e447d6b4bf33efbec43aaef87890fbbc", + "USDT": "0x5de1677344d3cb0d7d465c10b72a8f60699c062d", + "DAI": "0xf74195bb8a5cf652411867c5c2c5b8c2a402be35", + "BUSD": "0x461d52769884ca6235b685ef2040f47d30c94eb5", + "FRAX": "0x7562f525106f5d54e891e005867bf489b5988cd9", + "WBTC": "0xdc0486f8bf31df57a952bcd3c1d3e166e3d9ec8b", + "OMG": "0xe1e2ec9a85c607092668789581251115bcbd20de", + "sUSDC": "0x2f28add68e59733d23d5f57d94c31fb965f835d0", + "sBUSD": "0xf04d3a8eb17b832fbebf43610e94bdc4fd5cf2dd" + }, + "findora": { + "WBNB_b": "0xabc979788c7089b516b8f2f1b5ceabd2e27fd78b", + "WETH_b": "0x008a628826e9470337e0cd9c0c944143a83f32f3", + "USDT_b": "0x93edfa31d7ac69999e964dac9c25cd6402c75db3", + "USDC_b": "0xda33ef1a7b48bebbf579ee86dfa735a9529c4950", + "BUSD_b": "0xe80eb4a234f718edc5b76bb442653827d20ebb2d", + "WBTC_b": "0x07efa82e00e458ca3d53f2cd5b162e520f46d911", + "FRA": "0x0000000000000000000000000000000000001000", + "USDC_e": "0x2e8079e0fe49626af8716fc38adea6799065d7f7", + "USDT_e": "0x0632baa26299c9972ed4d9affa3fd057a72252ff" + }, + "milkomeda": { + "WADA": "0xae83571000af4499798d1e3b0fa0070eb3a3e3f9", + "USDT": "0xab58da63dfdd6b97eaab3c94165ef6f43d951fb2", + "WBTC": "0x48aeb7584ba26d3791f06fba360db435b3d7a174", + "BNB": "0x7f27352d5f83db87a5a3e00f4b07cc2138d8ee52", + "WETH": "0x5950f9b6ef36f3127ea66799e64d0ea1f5fdb9d1", + "DAI": "0x41eafc40cd5cb904157a10158f73ff2824dc1339", + "USDC": "0x5a955fddf055f2de3281d99718f5f1531744b102", + "sUSDC": "0x42110a5133f91b49e32b671db86e2c44edc13832", + "BUSD": "0x4bf769b05e832fcdc9053fffbc78ca889acb5e1e", + "BLUES": "0x8c008bba2dd56b99f4a6ab276be3a478cb075f0c" + }, + "bittorrent": { + "USDT_t": "0xdb28719f7f938507dbfe4f0eae55668903d34a15", + "USDC_t": "0x935faa2fcec6ab81265b301a30467bbc804b43d3", + "WBTT": "0x23181f21dea5936e24163ffaba4ea3b316b57f3c", + "USDD_t": "0x17f235fd5974318e4e2a5e37919a209f7c37a6d1", + "USDC_e": "0xae17940943ba9440540940db0f1877f101d39e8b", + "TRX": "0xedf53026aea60f8f75fca25f8830b7e2d6200662", + "ETH": "0x1249c65afb11d179ffb3ce7d4eedd1d9b98ad006", + "USDT_e": "0xe887512ab8bc60bcc9224e1c3b5be68e26048b8b", + "KNC_e": "0xe467f79e9869757dd818dfb8535068120f6bcb97", + "WBTC_e": "0x9888221fe6b5a2ad4ce7266c7826d2ad74d40ccf", + "USDC_b": "0xca424b845497f7204d9301bd13ff87c0e2e86fcf", + "USDT_b": "0x9b5f27f6ea9bbd753ce3793a07cba3c74644330d" + }, + "klaytn": { + "WKLAY": "0x57d1a61e4fd09fbf16e35b04959e94dcf2032974", + "BORA": "0x02cbe46fb8a1f579254a9b485788f2d86cad51aa", + "DAI": "0xcb2c7998696ef7a582dfd0aafadcd008d03e791a", + "USDC": "0x608792deb376cce1c9fa4d0e6b7b44f507cffa6a", + "USDT": "0x5c13e303a62fc5dedf5b52d66873f2e59fedadc2", + "pUSD": "0x168439b5eebe8c83db9eef44a0d76c6f54767ae4", + "KSD": "0x4fa62f1f404188ce860c8f0041d6ac3765a72e67", + "KASH": "0xce40569d65106c32550626822b91565643c07823", + "oBUSD": "0x210bc03f49052169d5588a52c317f71cf2078b85", + "WBTC": "0x981846be8d2d697f4dfef6689a161a25ffbab8f9", + "WETH": "0x98a8345bb9d3dda9d808ca1c9142a28f6b0430e1", + "KDAI": "0x5c74070fdea071359b86082bd9f9b3deaafbe32b", + "oUSDC": "0x754288077d0ff82af7a5317c7cb8c444d421d103", + "oUSDT": "0xcee8faf64bb97a73bb51e115aa89c17ffa8dd167", + "oWBTC": "0x16d0e1fbd024c600ca0380a4c5d57ee7a2ecbf9c", + "oETH": "0x34d21b1e550d73cee41151c77f3c73359527a396", + "oXRP": "0x9eaefb09fe4aabfbe6b1ca316a3c36afc83a393f", + "KSP": "0xc6a2ad8cc6e4a7e08fc37cc5954be07d499e7654", + "WBNB": "0xac9c1e4787139af4c751b1c0fadfb513c44ed833", + "BUSD": "0xe2765f3721dab5f080cf14ace661529e1ab9ade7", + "WAVAX": "0x45830b92443a8f750247da2a76c85c70d0f1ebf3", + "SOL": "0xfaa03a2ac2d1b8481ec3ff44a0152ea818340e6d", + "aUSDC_Wormhole_": "0x2b72d65941e657c1305b65fa330ffdde7b397239", + "aUSDC": "0x61fbbfd5416c45f297a8e69ba113789c75f8841c", + "aUSDT": "0x2eadfda6d830547b5168ba88c13d24156a026ce5", + "aUSDT_Wormhole_": "0x98aedff55dcc2e7a7d1899b325d1680527dd2742", + "aDAI": "0x2ff5371dad5c6ef76d55213b7c5a519f6654ba17", + "aDAI_Wormhole_": "0xe9a88c33abf71c902f7581321d05e6516cbca761", + "USDK": "0xd2137fdf10bd9e4e850c17539eb24cfe28777753", + "NPT": "0xe06597d02a2c3aa7a9708de2cfa587b128bd3815" + }, + "nova": { + "NUSD": "0x1f5396f254ee25377a5c1b9c6bff5f44e9294fff" + }, + "aurora": { + "WETH": "0x274d83086c356e0cfc75933fbf838ca10a7e8274", + "USDC_e": "0xb12bfca5a55806aaf64e99521918a4bf0fc40802", + "USDT_e": "0x4988a896b1227218e4a686fde5eabdcabd91571f", + "NEAR": "0xc42c30ac6cc15fac9bd938618bcaa1a1fae8501d", + "AURORA": "0x8bec47865ade3b172a928df8f990bc7f2a3b9f79", + "FRAX": "0xda2585430fef327ad8ee44af8f1f989a2a91a3d2", + "nUSD": "0x07379565cd8b0cae7c60dc78e7f601b34af2a21c", + "sUSDC": "0x42cc1cbf253f89be6814a0f59f745b40b69b6220", + "sBUSD": "0xd5e98caeb396dabe5a102bb9256b552944e3401f" + }, + "dfk": { + "WJEWEL": "0xccb93dabd71c8dad03fc4ce5559dc3d89f67a260", + "xJEWEL": "0x77f2656d04e158f915bc22f07b779d94c1dc47ff", + "FTM": "0x2df041186c844f8a2e2b63f16145bc6ff7d23e25" + }, + "cronos": { + "WCRO": "0xca2503482e5d6d762b524978f400f03e38d5f962", + "USDC": "0xc21223249ca28397b4b6541dffaecc539bff0c59", + "WBTC": "0x062e66477faf219f25d27dced647bf57c3107d52", + "SVN": "0x654bac3ec77d6db497892478f854cf6e8245dca9", + "USDT": "0x66e428c3f67a68878562e79a0234c1f83c208770", + "CRX": "0xe243ccab9e66e6cf1215376980811ddf1eb7f689", + "TUSD": "0x87efb3ec1576dec8ed47e58b832bedcd86ee186e", + "ALI": "0x45c135c1cdce8d25a3b729a28659561385c52671", + "AKT": "0x39a65a74dc5a778ff93d1765ea51f57bc49c81b3", + "SHIB": "0xbed48612bc69fa1cab67052b42a95fb30c1bcfee", + "ATOM": "0xb888d8dd1733d72681b30c00ee76bde93ae7aa93", + "ELON": "0x02dccaf514c98451320a9365c5b46c61d3246ff3" + }, + "velas": { + "WVLX": "0xe41c4324dcbd2926481101f8580d13930aff8a75", + "ETH": "0x85219708c49aa701871ad330a94ea0f41dff24ca", + "_MATIC": "0x6ab0b8c1a35f9f4ce107ccbd05049cb1dbd99ec5", + "WBTC": "0x639a647fbe20b6c8ac19e48e2de44ea792c62c5c", + "_BNB": "0x2b8e9cd44c9e09d936149549a8d207c918ecb5c4", + "FTM": "0xc9b3aa6e91d70f4ca0988d643ca2bb93851f3de4", + "USDC": "0xe2c120f188ebd5389f71cf4d9c16d05b62a58993", + "USDT": "0x01445c31581c354b7338ac35693ab2001b50b9ae", + "BUSD": "0xc111c29a988ae0c0087d97b33c6e6766808a3bd3", + "BAMBOO": "0x300a8be53b4b5557f48620d578e7461e3b927dd0", + "_AVAX": "0x525bd1f949ffa2a0c5820f3b6fe61bb897466ff7", + "SWAPZ": "0x9b6fbf0ea23faf0d77b94d5699b44062e5e747ac", + "DAI": "0xe3f5a90f9cb311505cd691a46596599aa1a0ad7d", + "SCAR": "0x8d9fb713587174ee97e91866050c383b5cee6209", + "ADA": "0x3611fbfb06ffbcef9afb210f6ace86742e6c14a4" + }, + "telos": { + "WTLOS": "0xd102ce6a4db07d247fcc28f366a623df0938ca9e", + "WTLOS_1": "0xdc2393dc10734bf153153038943a5deb42b209cd", + "ETH": "0xfa9343c3897324496a05fc75abed6bac29f8a40f", + "WBTC": "0xf390830df829cf22c53c8840554b98eafc5dcbc2", + "USDC": "0x818ec0a7fe18ff94269904fced6ae3dae6d6dc0b", + "USDT": "0xefaeee334f0fd1712f9a8cc375f427d9cdd40d73", + "STLOS": "0xb4b01216a5bc8f1c8a33cd990a1239030e60c905", + "sBUSD": "0x017043607270ecbb440e20b0f0bc5e760818b3d8" + }, + "reichain": { + "BNB": "0xf8ab4aaf70cef3f3659d3f466e35dc7ea10d4a5d", + "kBUSD": "0xdd2bb4e845bd97580020d8f9f58ec95bf549c3d9" + }, + "solana": { + "SOL": "So11111111111111111111111111111111111111112", + "BONK": "DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263", + "USDC": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", + "USDT": "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB", + "pSOL": "9EaLkQrbjmbbuZG9Wdpo8qfNUEjHATJFSycEmw6f1rGX", + "APT": "6LNeTYMqtNm1pBFN8PfhQaoLyegAH8GD32WmHU9erXKN", + "DAI": "EjmyN6qEC1Tf1JxiG1ae7UTJhUxSwk1TCWNWqxWV4J6o", + "apUSDC": "eqKJTf1Do4MDPyKisMYqVaUFpkEFAs3riGF3ceDH2Ca", + "USDCbs": "FCqfQSujuPxy6V42UvafBhsysWtEq1vhjfMN1PUbgaxA", + "aeUSDC": "DdFPRnccQqLD4zCHrBqdY95D6hvw6PLWp9DEXj1fLCL9", + "aaUSDC": "8Yv9Jz4z7BUHP68dz8E8m3tMe6NKgpMUKn8KVqrPA6Fr", + "afUSDC": "Grk6b4UMRWkgyq4Y6S1BnNRF4hRgtnMFp7Sorkv6Ez4u", + "abUSDC": "8XSsNvaKU9FDhYWAv7Yc7qSNwuJSzVrXBNEk7AFiWF69", + "USDTbs": "8qJSyQprMC57TWKaYEmetUR3UUiTP2M3hXdcvFhkZdmv", + "abUSDT": "E77cpQ4VncGmcAXX16LHFFzNBEBb2U7Ar7LBmZNfCgwL", + "aeUSDT": "Bn113WT6rbdgwrm12UJtnmNqGqZjY4it2WoUQuQopFVn", + "aaUSDT": "FwEHs3kJEdMa2qZHv7SgzCiFXUQPEycEXksfBkwmS8gj", + "BUSDbs": "5RpUwQ8wtdPCZHhu6MERp2RGrpobsbZ6MH5dDHkUjs2" + }, + "astar": { + "WASTR": "0xecc867de9f5090f55908aaa1352950b9eed390cd", + "WETH": "0x81ecac0d6be0550a00ff064a4f9dd2400585fe9c", + "WBTC": "0xad543f18cff85c77e140e3e5e3c3392f6ba9d5ca", + "BNB": "0x7f27352d5f83db87a5a3e00f4b07cc2138d8ee52", + "SDN": "0x75364d4f779d0bd0facd9a218c67f87dd9aff3b4", + "MATIC": "0xdd90e5e87a2081dcf0391920868ebc2ffb81a1af", + "USDC": "0x6a2d262d56735dba19dd70682b39f6be9a931d98", + "USDT": "0x3795c36e7d12a8c252a20c5a7b455f7c57b60283", + "nativeUSDT": "0xffffffff000000000000000000000001000007c0", + "ARSW": "0xde2578edec4669ba7f41c5d5d2386300bcea4678", + "DOT": "0xffffffffffffffffffffffffffffffffffffffff", + "DAI": "0x6de33698e9e9b787e09d3bd7771ef63557e148bb", + "MUUU": "0xc5bcac31cf55806646017395ad119af2441aee37", + "NIKA": "0x6df98e5fbff3041105cb986b9d44c572a43fcd22", + "oUSD": "0x29f6e49c6e3397c3a84f715885f9f233a441165c", + "KGL": "0x257f1a047948f73158dadd03eb84b34498bcdc60", + "LAY": "0xc4335b1b76fa6d52877b3046eca68f6e708a27dd", + "lUSDT": "0x430d50963d9635bbef5a2ff27bd0bddc26ed691f", + "nASTR": "0xe511ed88575c57767bafb72bfd10775413e3f2b0", + "lUSDC": "0xc404e12d3466accb625c67dbab2e1a8a457def3c", + "lDAI": "0x4dd9c468a44f3fef662c35c1e9a6108b70415c2c", + "aBaiUsdc": "0xdbd71969ac2583a9a20af3fb81fe9c20547f30f3", + "aDaiUsdc": "0x9914bff0437f914549c673b34808af6020e2b453", + "aBusdUsdc": "0x347e53263f8fb843ec605a1577ec7c8c0cac7a58", + "aUsdtUsdc": "0x02dac4898b2c2ca9d50ff8d6a7726166cf7bcfd0", + "BUSD": "0x4bf769b05e832fcdc9053fffbc78ca889acb5e1e", + "lBUSD": "0xb7ab962c42a8bb443e0362f58a5a43814c573ffb", + "BAI": "0x733ebcc6df85f8266349defd0980f8ced9b45f35", + "ATID": "0x5271d85ce4241b310c0b34b7c2f1f036686a6d7c", + "JPYC": "0x431d5dff03120afa4bdf332c61a6e1766ef37bdb", + "aUSD": "0xffffffff00000000000000010000000000000001" + }, + "cardano": { + "ADA": "ADA" + }, + "functionx": { + "WFX": "0x80b5a32e4f032b2a058b4f29ec95eefeeb87adcd", + "PUNDIX": "0xd567b3d7b8fe3c79a1ad8da978812cfc4fa05e75", + "PURSE": "0x5fd55a1b9fc24967c4db09c513c3ba0dfa7ff687", + "USDT": "0xeceeefcee421d8062ef8d6b4d814efe4dc898265" + }, + "clv": { + "WCLV": "0x1376c97c5c512d2d6f9173a9a3a016b6140b4536", + "WETH": "0xa1c3767c93e7b51ecb445fdbae1494dfc654e524", + "WBTC": "0x30bebbc0b6b357945ac30660e025c1532b9c7804", + "USDT": "0xf91193a62879279d6b8f209f89b6418e3c0e5cbf", + "USDC": "0x4a52f069cb00905d996a0d7b811d78e60b4cb09e" + }, + "tron": { + "null": "0x0000000000000000000000000000000000000000", + "USDT": "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t", + "USDC": "TEkxiTehnzSmSe2XqrBj4w32RUN966rdz8", + "USDD": "TPYmHEhy5n8TCEfYGqW2rPxsghSfzghPDn", + "JM": "TVHH59uHVpHzLDMFFpUgCx2dNAQqCzPhcR", + "JST": "TCFLL5dx5ZJdKnWuesXxi1VPwjLVmWZZy9", + "BTC": "TN3W4H6rK2ce4vX9YnFQHwKENnHjoxb3m9", + "LTC": "TR3DLthpnDdCGabhVDbD3VMsiJoCXY3bZd", + "DOGE": "THbVQp8kMjStKNnf2iCY6NEzThKMK5aBHg", + "SUN": "TSSMHYeV2uE9qYH95DqyoCuNCzEL1NvU3S", + "SUN_1": "TKkeiboTkxXKJpbmVFbv4a8ov5rAfRDMf9", + "WBTT": "TKfjV9RNKJJCqPvBtK8L7Knykh7DNWvnYt", + "BUSD": "TMz2SWatiAtZVVcH2ebpsbVtYwUPT9EdjH", + "WTRX": "TNUC9Qb1rRpS5CbWLmNMxXBjyFoydXjWFR", + "BTT": "TAFjULxiVgT4qWk6UZwjqwZXTSaGaqnVp4", + "TUSD": "TUpMhErZL2fhh4sVNULAbNKLokS4GjC1F4", + "USDJ": "TMwFHYXLJaRUPeW6421aqXL4ZEzPRFGkGT", + "ETH": "THb4CqiFdwNHsWsQCs4JhzwjMWys4aqCbF" + }, + "lachain": { + "wLA": "0x3a898d596840c6b6b586d722bfadcc8c4761bf41" + }, + "theta": { + "WTFUEL": "0x4dc08b15ea0e10b96c41aec22fab934ba15c983e", + "TDROP": "0x1336739b05c7ab8a526d40dcc0d04a826b5f8b03" + }, + "zyx": { + "WZYX": "0xc9e1aea009b0bae9141f3dc7523fb42fd48c8656" + }, + "ubiq": { + "WUBQ": "0x1fa6a37c64804c0d797ba6bc1955e50068fbf362" + }, + "cosmos": { + "ATOM": "uatom" + }, + "terra2": { + "LUNA": "uluna", + "ASTRO": "terra1nsuqsk6kh58ulczatwev87ttq2z6r3pusulg9r24mfj2fvtzd4uq3exn26" + }, + "terra": { + "LUNA": "uluna", + "UST": "uusd" + }, + "crescent": { + "BCRE": "ubcre", + "CRE": "ucre" + }, + "orai": { + "ORAI": "orai", + "USDT": "orai12hzjxfh77wl572gdzct2fxv2arxcwh6gykc7qh" + }, + "juno": { + "JUNO": "ujuno" + }, + "osmosis": { + "ION": "uion" + }, + "kujira": { + "KUJI": "ukuji", + "USK": "factory/kujira1qk00h5atutpsv900x202pxx42npjr9thg58dnqpa72f2p7m2luase444a7/uusk" + }, + "injective": { + "INJ": "inj", + "ATOM": "ibc/C4CFF46FD6DE35CA4CF4CE031E643C8FDC9BA4B99AE598E9B0ED98FE3A2319F9", + "USDT": "factory/inj14ejqjyq8um4p3xfqj74yld5waqljf88f9eneuk/inj1q6zlut7gtkzknkk773jecujwsdkgq882akqksk" + }, + "comdex": { + "CMDX": "ucmdx", + "CMST": "ucmst" + }, + "near": { + "JUMBO": "token.jumbo_exchange.near", + "PARAS": "token.paras.near", + "LINA": "linear-protocol.near", + "PEMBROCK": "token.pembrock.near", + "BURROW": "token.burrow.near" + }, + "multivac": { + "WMTV": "0x8e321596267a4727746b2f48bc8736db5da26977", + "USDT": "0x2f9c74d3c42023c533437c9ee743d4a6329e78df", + "USDC": "0xea1199d50ee09fa8062fd9da3d55c6f90c1babd2" + }, + "tomochain": { + "WTOMO": "0xb1f66997a5760428d3a87d68b90bfe0ae64121cc" + }, + "ethereumclassic": { + "WETC": "0x82A618305706B14e7bcf2592D4B9324A366b6dAd" + }, + "cube": { + "WCUBE": "0x9d3f61338d6eb394e378d28c1fd17d5909ac6591", + "ETH": "0x57eea49ec1087695274a9c4f341e414eb64328c2", + "BTC": "0x040ea5c10e6ba4badb6c433a365ccc4968697230", + "USDT": "0x79f1520268a20c879ef44d169a4e3812d223c6de", + "USDC": "0x00f0d8595797943c12605cd59bc0d9f63d750ccf", + "DAI": "0x3a1f6e3e6f26e92bb0d07841eb68f8e84f39751e", + "O3": "0xee9801669c6138e84bd50deb500827b776777d28" + }, + "elastos": { + "WELA": "0x517e9e5d46c1ea8ab6f78677d6114ef47f71f6c4", + "bnbBUSD": "0x9f1d0ed4e041c503bd487e5dc9fc935ab57f9a57" + }, + "energyweb": { + "WEWT": "0x6b3bd0478df0ec4984b168db0e12a539cc0c83cd" + }, + "milkomeda_a1": { + "WALGO": "0xaf86e6c5fd9daf53e5100ed38bab2572609fca27", + "USDC": "0x2421db204968a367cc2c866cd057fa754cb84edf", + "USDt": "0x32564ae38e5dbf316958ce25a6ad2a2249ebcc2d", + "USDT": "0xfa9343c3897324496a05fc75abed6bac29f8a40f", + "BLUES": "0xc9baa8cfdde8e328787e29b4b078abf2dadc2055", + "BUSD": "0x8dc0dfa2aec0d4410c8c60c5f9cd0cd37b05a06a", + "DAI": "0x150d2421e09eea31beaa68b7a248700eeceda87a" + }, + "ultron": { + "wULX": "0x3a4f06431457de873b588846d139ec0d86275d54", + "wULX_1": "0xb1183357745d3fd7d291e42a2c4b478cdb5710c6", + "wETH": "0x2318bf5809a72aabadd15a3453a18e50bbd651cd", + "wBTC": "0xd2b86a80a8f30b83843e247a50ecdc8d843d87dd", + "BUSD": "0xc7cac85c1779d2b8ada94effff49a4754865e2e4", + "uUSDT": "0x97fdd294024f50c388e39e73f1705a35cfe87656", + "uUSDC": "0x3c4e0fded74876295ca36f62da289f69e3929cc4" + }, + "bitgert": { + "WBRISE": "0x0eb9036cbe0f052386f36170c6b07ef0a0e3f710", + "LUNG": "0xc3b730dd10a7e9a69204bdf6cb5a426e4f1f09e3", + "YPC": "0x11203a00a9134db8586381c4b2fca0816476b3fd" + }, + "echelon": { + "WECH": "0xadee5159f4f82a35b9068a6c810bdc6c599ba6a8" + }, + "rei": { + "WREI": "0x2545af3d8b11e295bb7aedd5826021ab54f71630", + "USDT": "0x988a631caf24e14bb77ee0f5ca881e8b5dcfcec7", + "WBTC": "0x8059e671be1e76f8db5155bf4520f86acfdc5561", + "fWETH": "0x5b07f2582d0cc26e400d56266aebb201c93560ed" + }, + "tombchain": { + "TOMB": "0xdeaddeaddeaddeaddeaddeaddeaddeaddead0000", + "LIF3": "0x4200000000000000000000000000000000000108", + "FTM": "0x4200000000000000000000000000000000000006", + "TSHARE": "0x4200000000000000000000000000000000000101", + "USDC": "0x4200000000000000000000000000000000000100", + "LSHARE": "0x4200000000000000000000000000000000000109" + }, + "rsk": { + "WRBTC": "0x967f8799af07df1534d48a95a5c9febe92c53ae0", + "ETHs": "0x1d931bf8656d795e50ef6d639562c5bd8ac2b78f" + }, + "polis": { + "WPOLIS": "0x6fc851b8d66116627fb1137b9d5fe4e2e1bea978" + }, + "kekchain": { + "wKEK": "0x54bd9d8d758ac3717b37b7dc726877a23aff1b89" + }, + "aptos": { + "APT": "0x1::aptos_coin::AptosCoin", + "USDC": "0x5e156f1207d0ebfa19a9eeff00d62a282278fb8719f4fab3a586a0a2c0fffbea::coin::T", + "USDT": "0xa2eda21a58856fda86451436513b867c97eecb4ba099da5775520e0f7492e852::coin::T", + "WBTC": "0xae478ff7d83ed072dbc5e264250e67ef58f57c99d89b447efd8a0a2e8b2be76e::coin::T", + "ETH": "0xcc8a89c8dce9693d354449f1f73e60e14e347417854f029db5bc8e7454008abb::coin::T", + "USDC_1": "0xc91d826e29a3183eb3b6f6aa3a722089fdffb8e9642b94c5fcd4c48d035c0080::coin::T", + "USDA": "0x1000000fa32d122c18a6a31c009ce5e71674f22d06a581bb0a15575e6addadcc::usda::USDA", + "USDC_2": "0xf22bede237a07e121b56d91a491eb7bcdfd1f5907926a9e58338f964a01b17fa::asset::USDC", + "USDT_2": "0xf22bede237a07e121b56d91a491eb7bcdfd1f5907926a9e58338f964a01b17fa::asset::USDT", + "WETH": "0xf22bede237a07e121b56d91a491eb7bcdfd1f5907926a9e58338f964a01b17fa::asset::WETH", + "SOL": "0xdd89c0e695df0692205912fb69fc290418bed0dbe6e4573d744a6d5e6bab6c13::coin::T", + "ST_APT": "0x84d7aeef42d38a5ffc3ccef853e1b82e4958659d16a7de736a29c55fbbeb0114::staked_aptos_coin::StakedAptosCoin", + "ST_APT2": "0xd11107bdf0d6d7040c6c0bfbdecb6545191fdf13e8d8d259952f53e1713f61b5::staked_coin::StakedAptos", + "CELER_BNB": "0x8d87a65ba30e09357fa2edea2c80dbac296e5dec2b18287113500b902942929d::celer_coin_manager::BnbCoin", + "CELER_BUSD": "0x8d87a65ba30e09357fa2edea2c80dbac296e5dec2b18287113500b902942929d::celer_coin_manager::BusdCoin", + "CELER_USDC": "0x8d87a65ba30e09357fa2edea2c80dbac296e5dec2b18287113500b902942929d::celer_coin_manager::UsdcCoin", + "CELER_USDT": "0x8d87a65ba30e09357fa2edea2c80dbac296e5dec2b18287113500b902942929d::celer_coin_manager::UsdtCoin", + "CELER_DAI": "0x8d87a65ba30e09357fa2edea2c80dbac296e5dec2b18287113500b902942929d::celer_coin_manager::DaiCoin", + "CELER_ETH": "0x8d87a65ba30e09357fa2edea2c80dbac296e5dec2b18287113500b902942929d::celer_coin_manager::WethCoin", + "CELER_WBTC": "0x8d87a65ba30e09357fa2edea2c80dbac296e5dec2b18287113500b902942929d::celer_coin_manager::WbtcCoin" + }, + "dogechain": { + "WWDOGE": "0xb7ddc6414bf4f5515b52d8bdd69973ae205ff101", + "DC": "0x7b4328c127b85369d9f82ca0503b000d09cf9180", + "USDC": "0x85c2d3bebffd83025910985389ab8ad655abc946", + "DAI": "0xb3306f03595490e5cc3a1b1704a5a158d3436ffc", + "ETH": "0xb44a9b6905af7c801311e8f4e76932ee959c663c", + "USDT": "0x7f8e71dd5a7e445725f0ef94c7f01806299e877a", + "WBTC": "0xd0c6179c43c00221915f1a61f8ec06a5aa32f9ec", + "FRAX": "0x10d70831f9c3c11c5fe683b2f1be334503880db6", + "BUSD": "0x332730a4f6e03d9c55829435f10360e13cfa41ff", + "BNB": "0x1fc532187b4848d2f9c564531b776a4f8e11201d", + "QUICK": "0xb12c13e66ade1f72f71834f2fc5082db8c091358", + "MATIC": "0xdc42728b0ea910349ed3c6e1c9dc06b5fb591f98", + "WETH": "0x9f4614e4ea4a0d7c4b1f946057ec030bee416cbb" + }, + "canto": { + "WCANTO": "0x826551890dc65655a0aceca109ab11abdbd7a07b", + "USDC": "0x80b5a32e4f032b2a058b4f29ec95eefeeb87adcd", + "USDT": "0xd567b3d7b8fe3c79a1ad8da978812cfc4fa05e75", + "NOTE": "0x4e71a2e537b7f9d9413d3991d37958c0b5e1e503", + "ETH": "0x5fd55a1b9fc24967c4db09c513c3ba0dfa7ff687", + "ATOM": "0xeceeefcee421d8062ef8d6b4d814efe4dc898265", + "cINU": "0x7264610a66eca758a8ce95cf11ff5741e1fd0455" + }, + "ontology_evm": { + "WONG": "0xd8bc24cfd45452ef2c8bc7618e32330b61f2691b" + }, + "algorand": { + "XET": "283820866", + "SMILE": "300208676", + "ALGF": "463554836", + "GOMINT": "441139422", + "STKE": "511484048", + "YLDY": "226701642", + "COSG": "571576867", + "PBTC": "744665252", + "USDC": "31566704", + "HDL": "137594422", + "VEST": "700965019", + "CCT": "657291910", + "BUY": "137020565", + "STBL": "841126810", + "STBL_1": "465865291", + "GOBTC": "386192725", + "ARCC": "163650", + "ZONE": "444035862", + "PLANETS": "27165954", + "GALGO": "793124631", + "GOETH": "386195940", + "OPUL": "287867876", + "B3X": "663905154", + "OCTO": "559219992", + "MCAU": "6547014", + "RIO": "2751733", + "BOARD": "342889824", + "ALGO": "1", + "XGLI": "607591690", + "NXS": "403499324", + "ADAO": "692085161", + "DEFLY": "470842789", + "CHOICE": "297995609", + "USDT": "312769", + "GARD": "684649988" + }, + "shiden": { + "WSDN": "0x0f933dc137d21ca519ae4c7e93f87a4c8ef365ef", + "USDC": "0xfa9343c3897324496a05fc75abed6bac29f8a40f", + "USDT": "0x818ec0a7fe18ff94269904fced6ae3dae6d6dc0b", + "JPYC": "0x735abe48e8782948a37c7765ecb76b98cde97b0f", + "STND": "0x722377a047e89ca735f09eb7cccab780943c4cb4", + "ETH": "0x765277eebeca2e31912c9946eae1021199b39c61", + "BNB": "0x332730a4f6e03d9c55829435f10360e13cfa41ff", + "BUSD": "0x65e66a61d0a8f1e686c2d6083ad611a10d84d97a" + }, + "tezos": { + "USDtz": "KT1LN4LPSqTMS7Sd2CJw4bbDGRkMv2t68Fy9", + "CTez": "KT1SjXiUX63QvdNMcM2m492f7kuf8JxXRLp4", + "UP": "KT1TgmD7kXQzofpuc9VbTRMdZCS2e6JDuTtc", + "KALAM": "KT1A5P4ejnLix13jtadsfV9GCnXLMNnab8UT", + "wWBTC": "KT18fp5rcTW7mbWDmzFwjLDUhs5MeJmagDSZ-19", + "wMATIC": "KT18fp5rcTW7mbWDmzFwjLDUhs5MeJmagDSZ-11", + "MYH": "KT1BB1uMwVvJ1M3vVHXWALs1RWdgTp1rnXTR", + "kUSD": "KT1K9gCRgaLRFKTErYt1wVxA3Frb9FjasjTV", + "USDT_e": "KT1UsSfaXyqcjSVPeiD7U1bWgKy3taYN7NWY-3", + "PXL": "KT1F1mn2jbqQCJcsNgYKVAQjvenecNMY2oPK", + "WBTC_e": "KT1UsSfaXyqcjSVPeiD7U1bWgKy3taYN7NWY-1", + "kDAO": "KT1JkoE42rrMBP9b2oDhbx6EUr26GcySZMUH", + "STKR": "KT1AEfeckNbdEYwaMKkytBwPJPycz7jdSGea", + "wXTZ": "KT1VYsVfmobT7rsMVivvZ4J8i3bPiqz12NaH", + "MATIC_e": "KT1UsSfaXyqcjSVPeiD7U1bWgKy3taYN7NWY-4", + "hDAO": "KT1AFA2mwNUMNd4SsujE1YYp29vd8BZejyKW", + "WRAP": "KT1LRboPna9yQY9BrjtQYDS1DVxhKESK4VVd", + "wBUSD": "KT18fp5rcTW7mbWDmzFwjLDUhs5MeJmagDSZ-1", + "USDt": "KT1XnTn74bUtxHfDtBmm2bGZAQfhPbvKWR8o", + "ETHtz": "KT19at7rQUvyjxnZ2fBv7D9zc8rkyG7gAoU8", + "wUSDC": "KT18fp5rcTW7mbWDmzFwjLDUhs5MeJmagDSZ-17", + "QUIPU": "KT193D4vozYnhGJQVtw7CoxxqphqUEEwK6Vb", + "wWETH": "KT18fp5rcTW7mbWDmzFwjLDUhs5MeJmagDSZ-20", + "USDC_e": "KT1UsSfaXyqcjSVPeiD7U1bWgKy3taYN7NWY-2", + "PLENTY": "KT1GRSvLoikDsXujKgZPsGLX8k8VvR2Tq95b", + "wUSDT": "KT18fp5rcTW7mbWDmzFwjLDUhs5MeJmagDSZ-18", + "wDAI": "KT18fp5rcTW7mbWDmzFwjLDUhs5MeJmagDSZ-5", + "SMAK": "KT1TwzD6zV3WeJ39ukuqxcfK2fJCnhvrdN1X", + "LINK_e": "KT1UsSfaXyqcjSVPeiD7U1bWgKy3taYN7NWY-5", + "DOGA": "KT1Ha4yFVeyzw6KRAdkzq6TxDHB97KG4pZe8", + "WETH_e": "KT1UsSfaXyqcjSVPeiD7U1bWgKy3taYN7NWY", + "INSTA": "KT19y6R8x53uDKiM46ahgguS6Tjqhdj2rSzZ", + "GIF": "KT1XTxpQvo7oRCqp85LikEZgAZ22uDxhbWJv", + "UNO": "KT1ErKVqEhG9jxXgUG2KGLW3bNM7zXHX8SDF", + "uUSD": "KT1XRPEPXbZK25r3Htzp2o1x7xdMMmfocKNW", + "YOU": "KT1Xobej4mc6XgEjDoJoHtTKgbD1ELMvcQuL", + "USDS": "KT1REEb5VxWRjcHm5GzDMwErMmNFftsE5Gpf", + "tzBTC": "KT1PWx2mnDueood7fEmfbBDKx1D9BAnnXitn", + "BUSD": "KT1UsSfaXyqcjSVPeiD7U1bWgKy3taYN7NWY-7", + "DAI": "KT1UsSfaXyqcjSVPeiD7U1bWgKy3taYN7NWY-6", + "PAUL": "KT19DUSZw7mfeEATrbWVPHRrWNVbNnmfFAE6", + "XTZ": "tezos", + "XTZ_1": "KT1UpeXdK6AJbX58GJ92pLZVCucn2DR8Nu4b", + "LINK": "KT18fp5rcTW7mbWDmzFwjLDUhs5MeJmagDSZ-10", + "AAVE": "KT18fp5rcTW7mbWDmzFwjLDUhs5MeJmagDSZ", + "WBTC": "KT1XRPEPXbZK25r3Htzp2o1x7xdMMmfocKNW-2", + "UUSD": "KT1XRPEPXBZK25R3HTZP2O1X7XDMMMFOCKNW-0", + "ETH": "KT1UsSfaXyqcjSVPeiD7U1bWgKy3taYN7NWY-0" + }, + "hpb": { + "WHPB": "0xbe05ac1fb417c9ea435b37a9cecd39bc70359d31" + }, + "godwoken": { + "WCKB": "0xe934f463d026d97f6ce0a10215d0ac4224f0a930", + "USDC": "0xc3b946c53e2e62200515d284249f2a91d9df7954", + "USDC_bsc": "0xa21b19d660917c1de263ad040ba552737cfcef50", + "USDT": "0x07a388453944bb54be709ae505f14aeb5d5cbb2c", + "USDT_bsc": "0x5c30d9396a97f2279737e63b2bf64cc823046591", + "WBTC_eth": "0x7818fa4c71dc3b60049fb0b6066f18ff8c720f33", + "BTCB_bsc": "0x3f8d2b24c6fa7b190f368c3701ffcb2bd919af37" + }, + "godwoken_v1": { + "WCKB": "0xc296f806d15e97243a08334256c705ba5c5754cd", + "pCKB": "0x7538c85cae4e4673253ffd2568c1f1b48a71558a", + "ETH": "0x9e858a7aaedf9fdb1026ab1f77f627be2791e98a", + "BNB_bsc": "0xbadb9b25150ee75bb794198658a4d0448e43e528", + "WBTC_eth": "0x82455018f2c32943b3f12f4e59d0da2faf2257ef", + "BTCB_bsc": "0xef2439e020509259fa603c34b35a81ffe676cfb4", + "WETH": "0xb66954619363145a05ef835547449eb9050d82f6", + "USDC": "0xe3f5a90f9cb311505cd691a46596599aa1a0ad7d", + "USDC_bsc": "0xfa307cfdea89dc197a346c338a98ac85d517af6e", + "USDT_bsc": "0xdff2facdfe47c1d5b51f18231f900949f1d5988f", + "DAI": "0x765277eebeca2e31912c9946eae1021199b39c61", + "USDT": "0xfa9343c3897324496a05fc75abed6bac29f8a40f", + "BUSD": "0xcd7bc9fc617a4f82ec1c8359d1c8610b90e3b44c", + "WBTC": "0xb44a9b6905af7c801311e8f4e76932ee959c663c" + }, + "waves": { + "BNB": "5UYBPpq4WoU5n4MwpFkgJnW3Fq4B1u3ukpK33ik4QerR", + "BUSD": "8DLiYZjo3UUaRBTHU7Ayoqg4ihwb6YH1AfXrrhdjQ7K1", + "SWOP": "Ehie5xYpeN8op1Cctc6aGUrqx8jq3jtf1DSjXDbfm7aT", + "MKR": "E4rss7qLUcawCvD2uMrbLeTMPGkX15kS3okWCbUhLNKL", + "VIRES": "DSbbhLsSTeDg5Lsiufk2Aneh3DjVqJuPr2M9uU1gwy5p", + "ENJ": "EfwRV6MuUCGgAUchdsF4dDFnSpKrDW3UYshdaDy4VBeB", + "BTC": "8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS", + "DAI": "8zUYbdB8Q6mDhpcXYv52ji8ycfj4SDX4gJXS7YY3dA4R", + "WEST": "4LHHvYGNKJUg5hj65aGD5vgScvCBmLpdRFtjokvCjSL8", + "FTM": "4GZH8rk5vDmMXJ81Xqfm3ovFaczqMnQ11r7aELiNxWBV", + "ATOM": "47cyc68FWJszCWEwMWVsD9CadjS2M1XtgANuRGbEW8UH", + "CRO": "HLckRcg7hJ3Syf3PrGftFijKqQMJipf81WY3fwvHCJbe", + "YFI": "BLRxWVJWaVuR2CsCoTvTw2bDZ3sQLeTbCofcJv7dP5J4", + "APE": "2GBgdhqMjUPqreqPziXvZFSmDiQVrxNuGxR1z7ZVsm4Z", + "CRV": "3KhNcHo4We1G5EWps7b1e5DTdLgWDzctc8S6ynu37KAb", + "USDC": "6XtHjpXbs9RRJP2Sr9GUyVqzACcby9TkThHXnjVC5CDJ", + "LINK": "2bbGhKo5C31iEiB4CwGuqMYwjD7gCA9eXmm51fe2v8vT", + "AAVE": "7TMu26hAs7B2oW6c5sfx45KSZT7GQA3TZNYuCav8Dcqt", + "NSBT": "6nSpVyNH7yM69eg446wrQR94ipbbcmZMU1ENPwanC97g", + "WBTC": "5zoDNRdwVXwe7DveruJGxuJnqo7SYhveDeKb8ggAuC34", + "MANA": "Aug9ccbPApb1hxXSue8fHuvbyMf1FV1BYBtLUuS5LZnU", + "SHIB": "GVxGPBtgVWMW1wHiFnfaCakbJ6sKgZgowJgW5Dqrd7JH", + "FTT": "2Fh9m3dNQXycHdnytEaETN3P1gDT7ij5U4HjMqQBeaqN", + "UNI": "4YmM7mj3Av4DPvpNpbtK4jHbpzYDcZuY6UUnYpqTbzLj", + "SAND": "8YyrMfuBdZ5gtMWkynLTveRvGb6LJ4Aff9rpz46UUMW", + "MATIC": "HcHacFH51pY91zjJa3ZiUVWBww54LnsL4EP3s7hVGo9L", + "GRT": "A1uMqYTzBdakuSNDv7CruWXP8mRZ4EkHwmip2RCauyZH", + "ENNO": "7LMV3s1J4dKpMQZqge5sKYoFkZRLojnnU49aerqos4yg", + "ETH": "474jTeYx2r2Va35794tCScAXWJG9hU2HcgxzMowaZUnu", + "LTC": "HZk1mbfuJpmxU1Fs4AX5MWLVYtctsNcg6e2C6VKqK8zk", + "WX": "Atqv59EYzjFGuitKVnMRk6H8FukjoV3ktPorbEys25on", + "AXS": "ATQdLbehsMrmHZLNFhUm1r6s14NBT5JCFcSJGpaMrkAr", + "USDN": "DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p", + "UST": "2thtesXvnVMcCnih9iZbJL3d2NQZMfzENJo8YFj6r5jU", + "LUNA": "6QUVF8nVVVvM7do7JT2eJ5o5ehnZgXUg13ysiB9JiQrZ", + "USDT": "34N9YcEETLWn93qYQ64EsP1x89tSruJU44RrEMSXXEPJ", + "WAVES": "WAVES" + }, + "songbird": { + "WSGB": "0x02f0826ef6ad107cfc861152b32b52fd11bab9ed", + "CAND": "0x70ad7172ef0b131a1428d0c1f66457eb041f2176", + "SFIN": "0x0D94e59332732D18CF3a3D457A8886A2AE29eA1B", + "EXFI": "0xc348f894d0e939fe72c467156e6d7dcbd6f16e21" + }, + "energi": { + "WNRG": "0xa55f26319462355474a9f2c8790860776a329aa4" + }, + "nahmii": { + "ETH": "0x4200000000000000000000000000000000000006", + "NII": "0x595dba438a1bf109953f945437c1584319515d88" + }, + "curio": { + "CGT": "0x134ebab7883dfa9d04d20674dd8a8a995fb40ced" + }, + "gochain": { + "WGO": "0xcc237fa0a4b80ba47992d102352572db7b96a6b5", + "USDC": "0x97a19ad887262d7eca45515814cdef75acc4f713", + "FAST": "0x67bbb47f6942486184f08a671155fcfa6cad8d71" + }, + "smartbch": { + "WBCH": "0x3743ec0673453e5009310c727ba4eaf7b3a1cc04", + "LAW": "0x0b00366fbf7037e9d75e4a569ab27dab84759302", + "flexUSD": "0x7b2b3c5308ab5b2a1d9a94d20d35ccdf61e05b72", + "DAIQUIRI": "0x24d8d5cbc14fa6a740c3375733f0287188f8df3b", + "bcUSDT": "0xbc2f884680c95a02cea099da2f524b366d9028ba", + "_CATS": "0x265bd28d79400d55a1665707fa14a72978fa6043" + }, + "palm": { + "DAI": "0x4c1f6fcbd233241bf2f4d02811e3bf8429bc27b8", + "WETH": "0x726138359c17f1e56ba8c4f737a7caf724f6010b" + }, + "syscoin": { + "WSYS": "0xd3e822f3ef011ca5f17d82c956d952d8d7c3a1bb", + "USDC": "0x2bf9b864cdc97b08b6d79ad4663e71b8ab65c45c", + "ETH": "0x7c598c96d02398d89fbcb9d41eab3df0c16f227d", + "USDT": "0x922d641a426dcffaef11680e5358f34d97d112e1" + }, + "vision": { + "USDT": "0x1db6cdc620388a0b6046b20cd59503a0839adcff", + "VBTC": "0x4dE4B92C12dD4584873e72447573382C41da5597", + "VETH": "0x9261Bb697FE632dd4746c78406E955123085Bf4C", + "VBNB": "0xf6515Ce2ab3482C84Daaef961793bdFa3266b8ad", + "WVS": "0x79ffbc4fff98b821d59dbd7b33f91a2783006b6f" + }, + "kava": { + "WKAVA": "0xc86c7c0efbd6a49b35e8714c5f59d99de09a225b", + "USDC": "0xfa9343c3897324496a05fc75abed6bac29f8a40f", + "USDT": "0xb44a9b6905af7c801311e8f4e76932ee959c663c", + "USDt": "0x919C1c267BC06a7039e03fcc2eF738525769109c", + "WBTC": "0x818ec0a7fe18ff94269904fced6ae3dae6d6dc0b", + "DAI": "0x765277eebeca2e31912c9946eae1021199b39c61", + "SUSHI": "0x7c598c96d02398d89fbcb9d41eab3df0c16f227d", + "ETH": "0xe3f5a90f9cb311505cd691a46596599aa1a0ad7d", + "BUSD": "0x332730a4f6e03d9c55829435f10360e13cfa41ff", + "BNB": "0x65e66a61d0a8f1e686c2d6083ad611a10d84d97a", + "WETH": "0xc13791da84f43525189456cfe2026c60d3b7f706", + "USDk": "0x472402d47da0587c1cf515dafbafc7bce6223106", + "axlUSDC": "0xeb466342c4d449bc9f53a865d5cb90586f405215", + "axlUSDT": "0x7f5373ae26c3e8ffc4c77b7255df7ec1a9af52a6", + "axlDAI": "0x5c7e299cf531eb66f2a1df637d37abb78e6200c7", + "KFT": "0xa0eeda2e3075092d66384fe8c91a1da4bca21788", + "USX": "0xdb0e1e86b01c4ad25241b1843e407efc4d615248", + "kBRISE": "0xea616011e5ac9a5b91e22cac59b4ec6f562b83f9" + }, + "sx": { + "WSX": "0xaa99be3356a11ee92c3f099bd7a038399633566f", + "WETH": "0xa173954cc4b1810c0dbdb007522adbc182dab380", + "USDC": "0xe2aa35c2039bd0ff196a6ef99523cc0d3972ae3e", + "WMATIC": "0xfa6f64dfbad14e6883321c2f756f5b22ff658f9c", + "DAI": "0x53813cd4acd7145a716b4686b195511fa93e4cb7", + "SHARK": "0x7dc31a2fcbfbad1ed4519111fd33f78316bcbc81" + }, + "meter": { + "MTRG": "0x228ebbee999c6a7ad74a6130e81b12f9fe237ba3", + "WMTR": "0x160361ce13ec33c993b5cca8f62b6864943eb083", + "USDC_eth": "0xd86e243fc0007e6226b07c9a50c9d70d78299eb5", + "MTR": "0x6abaedab0ba368f1df52d857f24154cc76c8c972", + "BUSD_bsc": "0x24aa189dfaa76c671c279262f94434770f557c35", + "TFUEL": "0x75fd6f7edcc5e7a8100ead3d29ccd844153ef0f3", + "USDT_eth": "0x5fa41671c48e3c951afc30816947126ccc8c162e" + }, + "callisto": { + "WCLO": "0xf5ad6f6edec824c7fd54a66d241a227f6503ad3a", + "BUSDT": "0xbf6c50889d3a620eb42c0f188b65ade90de958c4", + "ccETC": "0xccc766f97629a4e14b3af8c91ec54f0b5664a69f", + "ccETH": "0xcc208c32cc6919af5d8026dab7a3ec7a57cd1796", + "ccBNB": "0xccde29903e621ca12df33bb0ad9d1add7261ace9", + "SOY": "0x9fae2529863bd691b4a7171bdfcf33c7ebb10a65" + }, + "thundercore": { + "null": "0x0000000000000000000000000000000000000000", + "WTT": "0x413cefea29f2d07b8f2acfa69d92466b9535f717", + "TT_USDT": "0x4f3c8e20942461e2c3bdd8311ac57b0c222f2b82", + "TT_ETH": "0x6576bb918709906dcbfdceae4bb1e6df7c8a1077", + "TT_USDC": "0x22e89898a04eaf43379beb70bf4e38b1faf8a31e", + "TT_BUSD": "0xbeb0131d95ac3f03fd15894d0ade5dbf7451d171" + }, + "conflux": { + "WCFX": "0x14b2d3bc65e74dae1030eafd8ac30c533c976a9b", + "USDC": "0x6963efed0ab40f6c3d7bda44a05dcf1437c44372", + "USDT": "0xfe97e85d13abd9c1c33384e796f10b73905637ce", + "WBTC": "0x1f545487c62e5acfea45dcadd9c627361d1616d8", + "ETH": "0xa47f43de2f9623acb395ca4905746496d2014d57" + }, + "muuchain": { + "WMUU": "0x875358f6194d7c622d6355455f3137cceb2955c4" + }, + "iotex": { + "WIOTX": "0xa00744882684c3e4747faefd68d283ea44099d03", + "ELK": "0xe1ce1c0fa22ec693baca6f5076bcdc4d0183de1c", + "ioUSDT": "0x6fbcdc1169b5130c59e72e51ed68a84841c98cd1", + "USDT_matic": "0x3cdb7c48e70b854ed2fa392e21687501d84b3afc", + "ioUSDC": "0x3b2bf2b523f54c4e454f08aa286d03115aff326c", + "USDC_matic": "0xc04da3a99d17135857bb937d2fbb321d3b6c6a81", + "USDT_b": "0x42c9255d5e522e83b16ea11a3ba04c2d3afca079", + "USDC_b": "0x037346e5a5722957ac2cab6ceb8c74fc18cea91d", + "BUSD_bsc": "0x84abcb2832be606341a50128aeb1db43aa017449", + "ioBUSD": "0xacee9b11cd4b3f57e58880277ac72c8c41abe4e4", + "DAI_matic": "0x62a9d987cbf4c45a550deed5b57b200d7a319632", + "ioDAI": "0x1cbad85aa66ff3c12dc84c5881886eeb29c1bb9b", + "anyXIM": "0xd6070ae98b8069de6b494332d1a1a81b6179d960", + "XIM": "0xec690cdd448e3cbb51ed135df72301c3265a8f80", + "CYC": "0x4d7b88403aa2f502bf289584160db01ca442426c", + "ioETH": "0x0258866edaf84d6081df17660357ab20a07d0c80", + "ioWBTC": "0xc7b93720f73b037394ce00f954f849ed484a3dea", + "GFT": "0x17df9fbfc1cdab0f90eddc318c4f6fcada730cf2", + "METX": "0x4752456e00def6025c77b55a88a2f8a1701f92f9", + "iMAGIC": "0x490cfbf9b9c43633ddd1968d062996227ef438a9", + "BNB_bsc": "0x97e6c48867fdc391a8dfe9d169ecd005d1d90283", + "ZOOM": "0x86702a7f8898b172de396eb304d7d81207127915", + "WMATIC": "0x8e66c0d6b70c0b23d39f4b21a1eac52bba8ed89a", + "CIOTX": "0x99b2b0efb56e62e36960c20cd5ca8ec6abd5557a" + }, + "ronin": { + "WRON": "0xe514d9deb7966c8be0ca922de8a064264ea6bcd4", + "AXS": "0x97a9107c1793bc407d6f527b77e7fff4d812bece", + "SLP": "0xa8754b9fa15fc18bb59458815510e40a12cd2014", + "WETH": "0xc99a6a985ed2cac1ef41640596c5a5f9f4e19ef5", + "USDC": "0x0b7007c13325c48911f73a2dad5fa5dcbf808adc" + }, + "arbitrum_nova": { + "WETH": "0x722e8bdd2ce80a4422e880164f2079488e115365", + "DAI": "0xda10009cbd5d07dd0cecc66161fc93d7c9000da1", + "USDT": "0x52484e1ab2e2b22420a25c20fa49e173a26202cd", + "USDC": "0x750ba8b76187092b0d1e87e28daaf484d1b5273b" + }, + "ethpow": { + "WETH": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", + "BHC": "0x0c9f28fbdfd79f7c00b805d8c63d053c146d282c", + "WETHW": "0x7bf88d2c0e32de92cdaf2d43ccdc23e8edfd5990", + "USDC": "0x25de68ef588cb0c2c8f3537861e828ae699cd0db", + "USDT": "0x2ad7868ca212135c6119fd7ad1ce51cfc5702892", + "WBTC": "0x4bbd68d8b1f25ae7b460e3347c637fe9e7338e0c", + "ETH": "0x34a9c05b638020a07bb153bf624c8763bf8b4a86", + "DAI": "0x0b35d852dcb8b59eb1e8d3182ebad4e96e2df8f0", + "BNB": "0xbd1563046a90f18127fd39f3481fd8d6ab22877f", + "BUSD": "0xf61eb8999f2f222f425d41da4c2ff4b6d8320c87" + }, + "xdc": { + "xUSDT": "0xd4b5f10d61916bd6e0860144a91ac658de8a1437", + "WXDC": "0x951857744785e80e2de051c32ee7b25f9c458c42", + "XSP": "0x36726235dadbdb4658d33e62a249dca7c4b2bc68", + "SRX": "0x5d5f074837f5d4618b3916ba74de1bf9662a3fed", + "USNOTA": "0xd04275e2fd2875beaade6a80b39a75d4fe267df6", + "PLI": "0xff7412ea7c8445c46a8254dfb557ac1e48094391" + }, + "kardia": { + "WKAI": "0xaf984e23eaa3e7967f3c5e007fbe397d8566d23d", + "USDT": "0x551a5dcac57c66aa010940c2dcff5da9c53aa53b", + "KUSD_T": "0x92364ec610efa050d296f1eeb131f2139fb8810e" + }, + "empire": { + "USDC": "0xc61a71c75ed4742dcae74b8cac27a37d46fc6751" + }, + "boba_bnb": { + "USDC": "0x9f98f9f312d23d078061962837042b8918e6aff2", + "BOBA": "0x4200000000000000000000000000000000000006", + "BNB": "0x4200000000000000000000000000000000000023" + }, + "boba_avax": { + "USDC_e": "0x126969743a6d300bab08f303f104f0f7dbafbe20", + "WBOBA": "0x26c319b7b2cf823365414d082698c8ac90cbba63", + "AVAX": "0x4200000000000000000000000000000000000023" + }, + "omax": { + "WOMAX": "0xfebabc6a9b2ec46d6357879b8bf39b593f11a5b9" + }, + "wemix": { + "WWEMIX": "0x7d72b22a74a216af4a002a1095c8c707d6ec1c5f", + "WEMIX_": "0x8e81fcc2d4a3baa0ee9044e0d7e36f59c9bba9c1", + "KLAY": "0x461d52769884ca6235b685ef2040f47d30c94eb5", + "ETH": "0x765277EebeCA2e31912C9946eAe1021199B39C61", + "USDC": "0xe3f5a90f9cb311505cd691a46596599aa1a0ad7d" + }, + "tlchain": { + "WTLC": "0x422b6cdf97c750a0edcddc39c88f25379e59e96e" + }, + "zeniq": { + "WZENIQ": "0x74dc1c4ec10abe9f5c8a3eabf1a90b97cdc3ead8" + }, + "dexit": { + "WDXT": "0x414b8baf9950c87804cf7e23bb43a58ae7e1e202" + }, + "step": { + "WFITFI": "0xb58a9d5920af6ac1a9522b0b10f55df16686d1b6", + "USDC": "0xe3f5a90f9cb311505cd691a46596599aa1a0ad7d", + "USDT": "0xfa9343c3897324496a05fc75abed6bac29f8a40f", + "ETH": "0x818ec0a7fe18ff94269904fced6ae3dae6d6dc0b", + "BNB": "0xefaeee334f0fd1712f9a8cc375f427d9cdd40d73" + }, + "flare": { + "WFLR": "0x1d80c49bbbcd1c0911346656b529df9e5c2f783d" + }, + "ibc": { + "JUNO": "EFF323CC632EC4F747C61BCE238A758EFDB7699C3226565F7C20DA06509D59A5", + "JUNO_1": "167E3D88D71B7D2F6308D3EF93FC3DD51932B2D9672D72B71418F61CBC5F5717", + "AXL_2": "C0E66D1C81D8AAF0E6896E05190FDFBC222367148F86AC3EA679C28327A763CD", + "STRD": "3FDD002A3A4019B05A33D324B2F29748E77AF501BEA5C96D1F28B2D6755F9F25", + "BNB": "DADB399E742FCEE71853E98225D13E44E90292852CD0033DF5CABAB96F80B833", + "AXLWETH": "F1806958CA98757B91C3FA1573ECECD24F6FA3804F074A6977658914A49E65A3", + "AKT": "799FDD409719A1122586A629AE8FCA17380351A51C1F47A80A1B8E7F2A491098", + "HUA": "E7807A46C0B7B44B350DA58F51F278881B863EC4DCA94635DAB39E52C30766CB", + "ATOM": "961FA3E54F5DCCA639F37A7C45F7BBE41815579EF1513B5AFBEFCFEB8F256352", + "ATOM_1": "C4CFF46FD6DE35CA4CF4CE031E643C8FDC9BA4B99AE598E9B0ED98FE3A2319F9", + "ATOM_2": "27394FB092D2ECCD56123C74F36E4C1F926001CEADA9CA97EA622B25F41E5EB2", + "USDC": "B3504E092456BA618CC28AC671A71FB08C6CA0FD0BE7C8A5B5A3E2DD933CC9E4", + "USDC_1": "E1616E7C19EA474C565737709A628D6F8A23FF9D3E9A7A6871306CF5E0A5341E", + "GRAV": "C950356239AD2A205DE09FDF066B1F9FF19A7CA7145EA48A5B19B76EE47E52F7", + "SCRT": "A358D7F19237777AF6D8AD0E0F53268F8B18AE8A53ED318095C14D6D7F3B2DB5", + "AXL": "903A61A498756EA560B85A85132D3AEE21B5DEDD41213725D22ABF276EA6945E", + "AXL_1": "C01154C2547F4CB10A985EA78E7CD4BA891C1504360703A37E1D7043F06B5E1F", + "DOT": "624BA9DD171915A2B9EA70F69638B2CEA179959850C1A586F6C485498F29EDD4", + "DOT_1": "B37E4D9FB5B30F3E1E20A4B2DE2A005E584C5C822C44527546556AE2470B4539", + "ETH": "1B38805B1C75352B28169284F96DF56BDEBD9E8FAC005BDCC8CF0378C82AA8E7", + "CMST": "9EC8A1701813BB7B73BFED2496009ABB2C8BF187E6CDFA788D77F68E08BC05CD", + "OSMO": "EA7DF7F779C7F14E07172E5713E07356B55F01496CA649DDE46CF8FBF1A8466D", + "OSMO_1": "47BD209179859CDE4A2806763D7189B6E6FE13A17880FE2B42DE1E6C1E329E23", + "OSMO_2": "0471F1C4E7AFD3F07702BEF6DC365268D64570F7C1FDC98EA6098DD6DE59817B", + "INJ": "5A76568E079A31FA12165E4559BA9F1E9D4C97F9C2060B538C84DCD503815E30", + "XPRT": "B786E7CBBF026F6F15A8DA248E0F18C62A0F7A70CB2DABD9239398C8B5150ABB", + "G-USDC": "CD01034D6749F20AAC5330EF4FD8B8CA7C40F7527AB8C4A302FBD2A070852EE1", + "STARS": "987C17B11ABC2B20019178ACE62929FE9840202CE79498E29FE8E5CB02B7C0A4", + "STARS_1": "4F393C3FCA4190C0A6756CE7F6D897D5D1BE57D6CCB80D0BC87393566A7B6602", + "CMDX": "3607EB5B5E64DD1C0E12E07F077FF470D5BC4706AFCBC98FE1BA960E5AE4CE07", + "CMDX_1": "EA3E1640F9B1532AB129A571203A0B9F789A7F14BB66E350DCBFA18E1A1931F0", + "EVMOS": "F3AA7EF362EC5E791FE78A0F4CCC69FEE1F9A7485EB1A8CAB3F6601C00522F10", + "EVMOS_1": "16618B7F7AC551F48C057A13F4CA5503693FBFF507719A85BC6876B8BD75F821", + "LUNA": "DA59C009A0B3B95E0549E6BF7B075C8239285989FF457A8EDDBB56F10B2A6986", + "AXLUSDC": "BFF0D3805B50D93E2FA5C0B2DDF7E0B30A631076CD80BC12A48C0E95404B4A41", + "AXLUSDC_1": "EAC38D55372F38F1AFD68DF7FE9EF762DCF69F26520643CF3F9D292A738D8034", + "AXLUSDC_2": "295548A78785A1007F232DE286149A6FF512F180AF5657780FC89C009E2C348F", + "UST": "B448C0CA358B958301D328CCDC5D5AD642FC30A6D3AE106FF721DB315F3DDE5C", + "UST_1": "6F4968A73F90CF7DE6394BF937D6DF7C7D162D74D839C13F53B41157D315E05F", + "G-WETH": "DBF5FA602C46392DE9F4796A0FC7D02F3A8A3D32CA3FAA50B761D4AA6F619E95", + "LUNA_1": "4627AD2524E3E0523047E35BB76CC90E37D9D57ACF14F0FCBCEB2480705F3CB8", + "LUNC": "B8AF5D92165F35AB31F3FC7C7B444B9D240760FA5D406C49D24862BD0284E395", + "IST": "CA1261224952DF089EFD363D8DBB30A8AB6D8CD181E60EE9E68E432F8DE14FE3", + "USDT": "CBF67A2BCF6CAE343FDF251E510C8E18C361FC02B23430C121116E0811835DEF", + "USDT_1": "F2331645B9683116188EF36FC04A809C28BD36B54555E8705A37146D0182F045", + "ATOM_3": "27394FB092D2ECCD56123C74F36E4C1F926001CEADA9CA97EA622B25F41E5EB2", + "AKT_1": "799FDD409719A1122586A629AE8FCA17380351A51C1F47A80A1B8E7F2A491098", + "LUNA_2": "B8AF5D92165F35AB31F3FC7C7B444B9D240760FA5D406C49D24862BD0284E395", + "OSMO_3": "0471F1C4E7AFD3F07702BEF6DC365268D64570F7C1FDC98EA6098DD6DE59817B", + "UST_2": "B448C0CA358B958301D328CCDC5D5AD642FC30A6D3AE106FF721DB315F3DDE5C", + "AXL_USDC_1": "F082B65C88E4B6D5EF1DB243CDA1D331D002759E938A0F5CD3FFDC5D53B3E349", + "BLD": "11F940BCDFD7CFBFD7EDA13F25DA95D308286D441209D780C9863FD4271514EB" + }, + "starknet": { + "DAI": "0x00da114221cb83fa859dbdb4c44beeaa0bb37c7537ad5ae66fe5e0efd20e6eb3", + "USDC": "0x053c91253bc9682c04929ca02ed00b3e423f6710d2ee7e0d5ebb06f3ecf368a8", + "USDT": "0x068f5c6a61780768455de69077e07e89787839bf8166decfbf92b645209c0fb8", + "WBTC": "0x03fe2b97c1fd336e750087d68b9b867997fd64a2661ff3ca5a7c771641e8e7ac", + "ETH": "0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7" + }, + "ton": { + "TON": "0x0000000000000000000000000000000000000000", + "TON_1": "EQDQoc5M3Bh8eWFephi9bClhevelbZZvWhkqdo80XuY_0qXv", + "TON_2": "Ef8zMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzM0vF", + "TON_3": "EQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAM9c", + "USDC": "EQC61IQRl0_la95t27xhIpjxZt32vl1QQVF2UgTNuvD18W-4", + "USDT": "EQC_1YoM8RBixN95lz7odcF3Vrkc_N8Ne7gQi7Abtlet_Efi", + "ETH": "EQAW42HutyDem98Be1f27PoXobghh81umTQ-cGgaKVmRLS7-" + }, + "defichain": { + "DFI": "DFI", + "DUSD": "DUSD", + "ETH": "ETH", + "BTC": "BTC", + "USDC": "USDC", + "USDT": "USDT" + }, + "elrond": { + "WEGLD": "WEGLD-bd4d79", + "USDC": "USDC-c76f1f" + }, + "bitindi": { + "WBNI": "0x15E162205421dc3A47b15A1A740FbF5EAbB77921" + }, + "core": { + "WCORE": "0x40375c92d9faf44d2f9db9bd9ba41a3317a2404f", + "USDT": "0x900101d06a7426441ae63e9ab3b9b0f63be145f1", + "USDC": "0xa4151b2b3e269645181dccf2d426ce75fcbdeca9" + }, + "crab": { + "WCRAB": "0x2d2b97ea380b0185e9fdf8271d1afb5d2bf18329" + }, + "lung": { + "WLUNG": "0xf51666bcb4b787df919395258fb1d9556f4e357b" + }, + "loop": { + "WLOOP": "0x3936D20a39eD4b0d44EaBfC91757B182f14A38d5" + }, + "rpg": { + "WRPG": "0x71d9cfd1b7adb1e8eb4c193ce6ffbe19b4aee0db", + "USDT": "0x8e8816a1747fddc5f8b45d2e140a425d3788f659" + }, + "map": { + "BUSD": "0x35bf4004c3fc9f509259d4942da6bae3669e1db1", + "WMAPO": "0x13cb04d4a5dfb6398fc5ab005a6c84337256ee23", + "USDC": "0x9f722b2cb30093f766221fd0d37964949ed66918", + "ETH": "0x05ab928d446d8ce6761e368c8e7be03c3168a9ec" + }, + "bone": { + "WBONE": "0xcda1fa23ff3b9b7172be82237bf662efb69437e9" + }, + "era": { + "WETH": "0x5aea5775959fbc2557cc8789bc1bf90a239d9a91", + "USDC": "0x3355df6d4c9c3035724fd0e3914de96a5a83aaf4", + "WBTC": "0xBBeB516fb02a01611cBBE0453Fe3c580D7281011", + "USDT": "0x493257fD37EDB34451f62EDf8D2a0C418852bA4C", + "BUSD": "0x2039bb4116B4EFc145Ec4f0e2eA75012D6C0f181" + }, + "polygon_zkevm": { + "WETH": "0x4F9A0e7FD2Bf6067db6994CF12E4495Df938E6e9", + "USDC": "0xA8CE8aee21bC2A48a5EF670afCc9274C7bbbC035" + }, + "eos_evm": { + "WEOS": "0xc00592aA41D32D137dC480d9f6d0Df19b860104F", + "ETH": "0x922d641a426dcffaef11680e5358f34d97d112e1", + "USDC": "0x765277eebeca2e31912c9946eae1021199b39c61", + "USDT": "0xfa9343c3897324496a05fc75abed6bac29f8a40f", + "WBTC": "0xefaeee334f0fd1712f9a8cc375f427d9cdd40d73" + }, + "oas": { + "WOAS": "0x5200000000000000000000000000000000000001" + }, + "enuls": { + "WNULS": "0x217dffF57E3b855803CE88a1374C90759Ea071bD" + }, + "sui": { + "USDC": "0x5d4b302506645c37ff133b98c4b50a5ae14841659738d6d733d59d0d217a93bf::coin::COIN", + "CELO": "0xa198f3be41cda8c07b3bf3fee02263526e535d682499806979a111e88a5a8d0f::coin::COIN", + "WMATIC": "0xdbe380b13a6d0f5cdedd58de8f04625263f113b3f9db32b3e1983f49e2841676::coin::COIN", + "BNB": "0xb848cce11ef3a8f62eccea6eb5b35a12c4c2b1ee1af7755d02d7bd6218e8226f::coin::COIN", + "WETH": "0xaf8cd5edc19c4512f4259f0bee101a40d41ebed738ade5874359610ef8eeced5::coin::COIN", + "USDT": "0xc060006111016b8a020ad5b33834984a437aaa7d3c74c18e09a95d48aceab08c::coin::COIN", + "WBTC": "0x027792d9fed7f9844eb4839566001bb6f6cb4804f66aa2da6fe1ee242d896881::coin::COIN", + "WAVAX": "0x1e8b532cca6569cab9f9b9ebc73f8c13885012ade714729aa3b450e0339ac766::coin::COIN", + "WFTM": "0x6081300950a4f1e2081580e919c210436a1bed49080502834950d31ee55a2396::coin::COIN", + "WGLMR": "0x66f87084e49c38f76502d17f87d17f943f183bb94117561eb573e075fdc5ff75::coin::COIN", + "SOL": "0xb7844e289a8410e50fb3ca48d69eb9cf29e27d223ef90353fe1bd8e27ff8f3f8::coin::COIN", + "USDC_SOL": "0xb231fcda8bbddb31f2ef02e6161444aec64a514e2c89279584ac9806ce9cf037::coin::COIN", + "USDC_ARB": "0xe32d3ebafa42e6011b87ef1087bbc6053b499bf6f095807b9013aff5a6ecd7bb::coin::COIN", + "USDC_BNB": "0x909cba62ce96d54de25bec9502de5ca7b4f28901747bbf96b76c2e63ec5f1cba::coin::COIN", + "SUI": "0x2::sui::SUI" + }, + "grove": { + "WGRV": "0xE85f139488c689038028a3EB8fC38dcC29D4C340" + }, + "fxcore": { + "FX": "FX", + "USDT": "usdt" + }, + "xpla": { + "XPLA": "axpla" + }, + "chihuahua": { + "HUAHUA": "uhuahua" + }, + "filecoin": { + "WFIL": "0xce5805cf6c84f71d2897f632e0aa60d2430ccd2a", + "USDT": "0x422849B355039bC58F2780cc4854919fC9cfaF94" + }, + "pulse": { + "WPLS": "0xa1077a294dde1b09bb078844df40758a5d0f9a27", + "ETH": "0x02dcdd04e3f455d838cd1249292c58f3b79e3c3c", + "USDC": "0x15D38573d2feeb82e7ad5187aB8c1D52810B1f07", + "USDT": "0x0Cb6F5a34ad42ec934882A05265A7d5F59b51A2f", + "HEX": "0x2b591e99afe9f32eaa6214f7b7629768c40eeb39", + "DAI": "0xefd766ccb38eaf1dfd701853bfce31359239f305" + }, + "onus": { + "WONUS": "0x4c761e48d1e735af551cc38abcbdce1d7faac6e4", + "BUSD": "0xdfB5E8a4AC08E46258A12AbE737bba5D8c452508", + "BNB": "0xbdce8c50c1e6f6501c2af8232d2d76ec75cda51d", + "USDT": "0xff276c6bca1f66fd54a8915e830735d6ab0c7b09", + "BTC": "0x935765ad27a1af00f73097c998a9fb721d2d7790", + "ETH": "0xb4373ebb073a4dcba47e567d075a9583fa3c763e" + }, + "stacks": { + "WSTX": "SP1Z92MPDQEWZXW36VX71Q25HKF5K2EPCJ304F275.wstx-token-v4a", + "WBTC": "SP3DX3H4FEYZJZ586MFBS25ZW3HZDMEW92260R2PR.Wrapped-Bitcoin::wrapped-bitcoin" + }, + "neon_evm": { + "WNEON": "0xb14760c064a1b9eaf9ec5a8a421971e40a51b59c" + }, + "tenet": { + "WTENET": "0xd6cb8a253e12893b0cf39ca78f7d858652cca1fe" + }, + "mantle": { + "WMNT": "0x78c1b0c915c4faa5fffa6cabf0219da63d7f4cb8", + "WETH": "0xdeaddeaddeaddeaddeaddeaddeaddeaddead1111", + "USDT": "0x201eba5cc46d216ce6dc03f6a759e8e766e956ae", + "USDC": "0x09Bc4E0D864854c6aFB6eB9A9cdF58aC190D0dF9" + }, + "linea": { + "WETH": "0xe5D7C2a44FfDDf6b295A15c148167daaAf5Cf34f" + }, + "base": { + "WETH": "0x4200000000000000000000000000000000000006" + } +} diff --git a/projects/helper/curvePools.js b/projects/helper/curvePools.js index 3457dee958d..4c4cd6f354b 100644 --- a/projects/helper/curvePools.js +++ b/projects/helper/curvePools.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('./coreAssets.json') module.exports = { // Curve.fi Factory USD Metapool: moUSD '0x162b21ba1a90dd9384c615192fa4053217d2a8db': { @@ -32,7 +33,7 @@ module.exports = { // val3PS '0x5b5bd8913d766d005859ce002533d4838b0ebbb5': { swapContract: '0x19ec9e3f7b21dd27598e7ad5aae7dc0db00a806d', - underlyingTokens: ['0xaed19dab3cd68e4267aec7b2479b1ed2144ad77f', '0xa6fdea1655910c504e974f7f1b520b74be21857b', '0x5f7f6cb266737b89f7af86b30f03ae94334b83e9'], + underlyingTokens: [ADDRESSES.bsc.valBUSD, ADDRESSES.bsc.valUSDC, ADDRESSES.bsc.valUSDT], }, // ARTHu3PS '0xb38b49bae104bbb6a82640094fd61b341a858f78': { @@ -42,37 +43,37 @@ module.exports = { // 3EPS '0xaf4de8e872131ae328ce21d909c74705d3aaf452': { swapContract: '0x160caed03795365f3a589f10c379ffa7d75d4e76', - underlyingTokens: ['0xe9e7cea3dedca5984780bafc599bd69add087d56', '0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d', '0x55d398326f99059ff775485246999027b3197955'], + underlyingTokens: [ADDRESSES.bsc.BUSD, ADDRESSES.bsc.USDC, ADDRESSES.bsc.USDT], }, '0x6c3f90f043a72fa612cbac8115ee7e52bde6e490': { swapContract: '0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7', - underlyingTokens: ['0xdac17f958d2ee523a2206206994597c13d831ec7', '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', '0x6b175474e89094c44da98b954eedeac495271d0f'], + underlyingTokens: [ADDRESSES.ethereum.USDT, ADDRESSES.ethereum.USDC, ADDRESSES.ethereum.DAI], }, '0x075b1bb99792c9e1041ba13afef80c91a1e70fb3': { swapContract: '0x7fC77b5c7614E1533320Ea6DDc2Eb61fa00A9714', - underlyingTokens: ['0xeb4c2781e4eba804ce9a9803c67d0893436bb27d', '0x2260fac5e5542a773aa44fbcfedf7c193bc2c599', '0xfe18be6b3bd88a2d2a7f928d00292e7a9963cfc6'], + underlyingTokens: ['0xeb4c2781e4eba804ce9a9803c67d0893436bb27d', ADDRESSES.ethereum.WBTC, '0xfe18be6b3bd88a2d2a7f928d00292e7a9963cfc6'], }, // Nerve '0xf2511b5e4fb0e5e2d123004b672ba14850478c14': { swapContract: '0x1B3771a66ee31180906972580adE9b81AFc5fCDc', - underlyingTokens: ['0xe9e7cea3dedca5984780bafc599bd69add087d56', '0x55d398326f99059ff775485246999027b3197955', '0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d'], + underlyingTokens: [ADDRESSES.bsc.BUSD, ADDRESSES.bsc.USDT, ADDRESSES.bsc.USDC], }, // DOP-LP BSC '0x9116f04092828390799514bac9986529d70c3791': { swapContract: '0x5162f992EDF7101637446ecCcD5943A9dcC63A8A', underlyingTokens: [ '0x1AF3F329e8BE154074D8769D1FFa4eE058B1DBc3', - '0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56', - '0x55d398326f99059fF775485246999027B3197955', - '0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d' + ADDRESSES.bsc.BUSD, + ADDRESSES.bsc.USDT, + ADDRESSES.bsc.USDC ], }, // DOP-2P-LP BSC '0x124166103814e5a033869c88e0f40c61700fca17': { swapContract: '0x449256e20ac3ed7F9AE81c2583068f7508d15c02', underlyingTokens: [ - '0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56', - '0x55d398326f99059fF775485246999027B3197955' + ADDRESSES.bsc.BUSD, + ADDRESSES.bsc.USDT ], }, // DOP-UST-LP BSC @@ -80,16 +81,16 @@ module.exports = { swapContract: '0x830e287ac5947B1C0DA865dfB3Afd7CdF7900464', underlyingTokens: [ '0x23396cF899Ca06c4472205fC903bDB4de249D6fC', - '0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56', - '0x55d398326f99059fF775485246999027B3197955' + ADDRESSES.bsc.BUSD, + ADDRESSES.bsc.USDT ], }, // DOP-3P-LP BSC '0xaa5509ce0ecea324bff504a46fc61eb75cb68b0c': { swapContract: '0x61f864a7dFE66Cc818a4Fd0baabe845323D70454', underlyingTokens: [ - '0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56', - '0x55d398326f99059fF775485246999027B3197955', + ADDRESSES.bsc.BUSD, + ADDRESSES.bsc.USDT, '0xfF54da7CAF3BC3D34664891fC8f3c9B6DeA6c7A5' ], }, @@ -97,18 +98,18 @@ module.exports = { '0xb0f0983b32352a1cfaec143731ddd8a5f6e78b1f': { swapContract: '0x3ED4b2070E3DB5eF5092F504145FB8150CfFE5Ea', underlyingTokens: [ - '0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56', - '0x55d398326f99059fF775485246999027B3197955', - '0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d' + ADDRESSES.bsc.BUSD, + ADDRESSES.bsc.USDT, + ADDRESSES.bsc.USDC ], }, // IS3USD Polygon '0xb4d09ff3dA7f9e9A2BA029cb0A81A989fd7B8f17': { swapContract: '0x837503e8A8753ae17fB8C8151B8e6f586defCb57', underlyingTokens: [ - '0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063', - '0xc2132D05D31c914a87C6611C10748AEb04B58e8F', - '0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174' + ADDRESSES.polygon.DAI, + ADDRESSES.polygon.USDT, + ADDRESSES.polygon.USDC ] }, // am3CRV Polygon @@ -124,10 +125,10 @@ module.exports = { '0xc25a3a3b969415c80451098fa907ec722572917f': { swapContract: '0xA5407eAE9Ba41422680e2e00537571bcC53efBfD', underlyingTokens: [ - '0xdac17f958d2ee523a2206206994597c13d831ec7', - '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', - '0x6b175474e89094c44da98b954eedeac495271d0f', - '0x57ab1ec28d129707052df4df418d58a2d46d5f51' + ADDRESSES.ethereum.USDT, + ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.DAI, + ADDRESSES.ethereum.sUSD, ] }, // renBTC Eth @@ -135,27 +136,27 @@ module.exports = { swapContract: '0x93054188d876f558f4a66B2EF1d97d16eDf0895B', underlyingTokens: [ '0xeb4c2781e4eba804ce9a9803c67d0893436bb27d', - '0x2260fac5e5542a773aa44fbcfedf7c193bc2c599' + ADDRESSES.ethereum.WBTC ] }, // lusd Eth '0xed279fdd11ca84beef15af5d39bb4d4bee23f0ca': { swapContract: '0xed279fdd11ca84beef15af5d39bb4d4bee23f0ca', underlyingTokens: [ - '0x5f98805A4E8be255a32880FDeC7F6728C6568bA0', + ADDRESSES.ethereum.LUSD, '0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490' ] }, // steCRV Eth '0x06325440d014e39736583c165c2963ba99faf14e': { swapContract: '0xdc24316b9ae028f1497c275eb9192a3ea0f67022', - underlyingTokens: ['0xae7ab96520de3a18e5e111b5eaab095312d7fe84'] + underlyingTokens: [ADDRESSES.ethereum.STETH] }, // fraxCRV Eth '0xd632f22692fac7611d2aa1c0d552930d43caed3b': { swapContract: '0xd632f22692fac7611d2aa1c0d552930d43caed3b', underlyingTokens: [ - '0x853d955acef822db058eb8505911ed77f175b99e', + ADDRESSES.ethereum.FRAX, '0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490' ] }, @@ -169,7 +170,7 @@ module.exports = { swapContract: '0xC2d95EEF97Ec6C17551d45e77B590dc1F9117C67', underlyingTokens: [ '0x5c2ed810328349100A66B82b78a1791B101C9D61', - '0xDBf31dF14B66535aF65AaC99C32e9eA844e14501' + ADDRESSES.fantom.renBTC ] }, // tricryptoCRV v1 Polygon @@ -213,8 +214,8 @@ module.exports = { '0xd7d4a4c67e9c1f5a913bc38e87e228f4b8820e8a': { swapContract: '0xCF97190fAAfea63523055eBd139c008cdb4468eB', underlyingTokens: [ - '0xd586E7F844cEa2F87f50152665BCbc2C279D8d70', - '0xc7198437980c041c805a1edcba50c1ce5db95118' + ADDRESSES.avax.DAI, + ADDRESSES.avax.USDT_e ] }, // gondolaYAKPool Avax @@ -229,8 +230,8 @@ module.exports = { '0x4dc5a6308338e540aa97faab7fd2e03876075413': { swapContract: '0x4b941276eb39d114c89514791d073a085acba3c0', underlyingTokens: [ - '0xc7198437980c041c805a1edcba50c1ce5db95118', - '0xa7d7079b0fead91f3e65f86e8915cb59c1a4c664' + ADDRESSES.avax.USDT_e, + ADDRESSES.avax.USDC_e ] }, // av3CRV Avax @@ -246,17 +247,17 @@ module.exports = { '0x2dd7c9371965472e5a5fd28fbe165007c61439e1': { swapContract: '0x2dd7C9371965472E5A5fD28fbE165007c61439E1', underlyingTokens: [ - '0x82f0B8B456c1A451378467398982d4834b6829c1', - '0x049d68029688eAbF473097a2fC38ef61633A3C7A', - '0x04068DA6C83AFCFA0e13ba15A6696662335D5B75' + ADDRESSES.fantom.MIM, + ADDRESSES.fantom.fUSDT, + ADDRESSES.fantom.USDC ] }, // Dai-Usdc Fantom '0x27e611fd27b276acbd5ffd632e5eaebec9761e40': { swapContract: '0x27E611FD27b276ACbd5Ffd632E5eAEBEC9761E40', underlyingTokens: [ - '0x04068DA6C83AFCFA0e13ba15A6696662335D5B75', - '0x8D11eC38a3EB5E956B052f67Da8Bdc9bef8Abf3E' + ADDRESSES.fantom.USDC, + ADDRESSES.fantom.DAI ] }, // gDai-gUSDC-gUSDT Fantom @@ -274,14 +275,14 @@ module.exports = { underlyingTokens: [ '0x74b23882a30290451A17c44f4F05243b6b58C76d', '0x321162Cd933E2Be498Cd2267a90534A804051b11', - '0x049d68029688eAbF473097a2fC38ef61633A3C7A' + ADDRESSES.fantom.fUSDT ] }, // btc-renbtc Fantom '0x5b5cfe992adac0c9d48e05854b2d91c73a003858': { swapContract: '0x3eF6A01A0f81D6046290f3e2A8c5b843e738E604', underlyingTokens: [ - '0xDBf31dF14B66535aF65AaC99C32e9eA844e14501', + ADDRESSES.fantom.renBTC, '0x321162Cd933E2Be498Cd2267a90534A804051b11' ] }, @@ -289,8 +290,8 @@ module.exports = { '0xaea2e71b631fa93683bcf256a8689dfa0e094fcd': { swapContract: '0xaea2e71b631fa93683bcf256a8689dfa0e094fcd', underlyingTokens: [ - '0xc7198437980c041c805a1edcba50c1ce5db95118', - '0xa7d7079b0fead91f3e65f86e8915cb59c1a4c664', + ADDRESSES.avax.USDT_e, + ADDRESSES.avax.USDC_e, '0x130966628846bfd36ff31a822705796e8cb8c18d', ] }, @@ -328,7 +329,7 @@ module.exports = { '0xcee60cfa923170e4f8204ae08b4fa6a3f5656f3a': { swapContract: '0xF178C0b5Bb7e7aBF4e12A4838C7b7c5bA2C623c0', underlyingTokens: [ - '0x514910771AF9Ca656af840dff83E8264EcF986CA', + ADDRESSES.ethereum.LINK, '0xbBC455cb4F1B9e4bFC4B73970d360c8f032EfEE6', ], }, @@ -364,7 +365,7 @@ module.exports = { }, '0x50b0d9171160d6eb8aa39e090da51e7e078e81c4': { swapContract: '0x50b0d9171160d6eb8aa39e090da51e7e078e81c4', - underlyingTokens: ['0xC011a73ee8576Fb46F5E1c5751cA3B9Fe0af2a6F'] + underlyingTokens: [ADDRESSES.ethereum.SNX] }, '0xcaf8703f8664731ced11f63bb0570e53ab4600a9': { swapContract: '0xcaf8703f8664731ced11f63bb0570e53ab4600a9', @@ -380,7 +381,7 @@ module.exports = { }, '0x0437ac6109e8a366a1f4816edf312a36952db856': { swapContract: '0x0437ac6109e8a366a1f4816edf312a36952db856', - underlyingTokens: ['0x6B3595068778DD592e39A122f4f5a5cF09C90fE2'] + underlyingTokens: [ADDRESSES.ethereum.SUSHI] }, '0x9001a452d39a8710d27ed5c2e10431c13f5fba74': { swapContract: '0x9001a452d39a8710d27ed5c2e10431c13f5fba74', diff --git a/projects/helper/dexpad.js b/projects/helper/dexpad.js index 829e1d53ab1..def2795bf5e 100644 --- a/projects/helper/dexpad.js +++ b/projects/helper/dexpad.js @@ -1,9 +1,9 @@ +const ADDRESSES = require('./coreAssets.json') const BigNumber = require("bignumber.js"); const sdk = require("@defillama/sdk"); const { unwrapUniswapLPs } = require("./unwrapLPs"); -const symbol = require("./abis/symbol.json"); -const getPairFactory = require("./abis/getPair.json"); +const getPairFactory = 'function getPair(address, address) view returns (address)' const { isLP } = require("./utils"); const { getChainTransform, getFixBalances } = require("./portedTokens"); @@ -103,7 +103,7 @@ async function generateWhitelistedPairs(trackedTokens, factory, block, chain) { basePairs.forEach(pair => { if (pair.success) { const basePair = pair.output.toLowerCase(); - if (basePair != "0x0000000000000000000000000000000000000000") + if (basePair != ADDRESSES.null) whitelistedBasePairs.add(basePair); } }); @@ -130,7 +130,7 @@ async function getTokensAndLPsTrackedValue( const [tokenSymbols, tokenBalances] = await Promise.all([ sdk.api.abi .multiCall({ - abi: symbol, + abi: 'string:symbol', chain, calls: tokens.map(token => ({ target: token diff --git a/projects/helper/env.js b/projects/helper/env.js new file mode 100644 index 00000000000..d1cd406d5c5 --- /dev/null +++ b/projects/helper/env.js @@ -0,0 +1,39 @@ +const BOOL_KEYS = [ + 'HISTORICAL', + 'LLAMA_DEBUG_MODE', +] + +const DEFAULTS = { + COVALENT_KEY: 'ckey_72cd3b74b4a048c9bc671f7c5a6', + SOLANA_RPC: 'https://try-rpc.mainnet.solana.blockdaemon.tech', + APTOS_RPC: 'https://aptos-mainnet.pontem.network', + SUI_RPC: 'https://fullnode.mainnet.sui.io/', + MULTIVERSX_RPC: 'https://api.multiversx.com', + PGN_RPC: 'https://rpc.publicgoods.network', +} + +const ENV_KEYS = [ + ...BOOL_KEYS, + ...Object.keys(DEFAULTS), + 'GETBLOCK_KEY', + 'LOFTY_API', + 'OLYMPUS_GRAPH_API_KEY', + 'SUMMER_HISTORY_ENDPOINT', + 'SUMMER_AJNA_ENDPOINT', + 'SUMMER_CONFIRMED_VAULTS_ENDPOINT', +] + +Object.keys(DEFAULTS).forEach(i => { + if (!process.env[i]) process.env[i] = DEFAULTS[i] // this is done to set the chain RPC details in @defillama/sdk +}) + + +function getEnv(key) { + if (!ENV_KEYS.includes(key)) throw new Error(`Unknown env key: ${key}`) + const value = process.env[key] ?? DEFAULTS[key] + return BOOL_KEYS.includes(key) ? !!value : value +} + +module.exports = { + getEnv, +} \ No newline at end of file diff --git a/projects/helper/erc4626.js b/projects/helper/erc4626.js new file mode 100644 index 00000000000..145f12a4a60 --- /dev/null +++ b/projects/helper/erc4626.js @@ -0,0 +1,18 @@ + +async function sumERC4626Vaults({ api, vaults, abi = {} }) { + const tokens = await api.multiCall({ abi: abi.asset ?? 'address:asset', calls: vaults}) + const bals = await api.multiCall({ abi: abi.balance ?? 'uint256:totalAssets', calls: vaults}) + api.addTokens(tokens, bals) + return api.getBalances() +} + +function sumERC4626VaultsExport({ vaults, ...options}) { + return async (timestamp, ethBlock, chainBlocks, { api }) => { + return sumERC4626Vaults({ ...options, api, vaults }) + } +} + +module.exports = { + sumERC4626Vaults, + sumERC4626VaultsExport, +} \ No newline at end of file diff --git a/projects/helper/getBlock.js b/projects/helper/getBlock.js deleted file mode 100644 index 3e805e1d113..00000000000 --- a/projects/helper/getBlock.js +++ /dev/null @@ -1,19 +0,0 @@ -const sdk = require('@defillama/sdk') -const { get } = require('./http') - -async function getBlock(timestamp, chain, chainBlocks, undefinedOk = false) { - if (chainBlocks[chain] !== undefined || (process.env.HISTORICAL === undefined && undefinedOk)) { - return chainBlocks[chain] - } else { - if(chain === "celo"){ - return Number((await get("https://explorer.celo.org/api?module=block&action=getblocknobytime×tamp=" + timestamp + "&closest=before")).result.blockNumber); - } else if(chain === "moonriver") { - return Number((await get(`https://blockscout.moonriver.moonbeam.network/api?module=block&action=getblocknobytime×tamp=${timestamp}&closest=before`)).result.blockNumber); - } - return sdk.api.util.lookupBlock(timestamp, { chain }).then(blockData => blockData.block) - } -} - -module.exports = { - getBlock, -}; \ No newline at end of file diff --git a/projects/helper/getTokens.js b/projects/helper/getTokens.js deleted file mode 100644 index 4773fd80e96..00000000000 --- a/projects/helper/getTokens.js +++ /dev/null @@ -1,16 +0,0 @@ -const axios = require('axios') - -const chainIds = { - 'ethereum': 1, - 'bsc': 56, - 'polygon': 137 -} - -async function getTokens(address, chain = "ethereum"){ - const allTokens = (await axios.get(`https://api.covalenthq.com/v1/${chainIds[chain]}/address/${address}/balances_v2/?&key=ckey_72cd3b74b4a048c9bc671f7c5a6`)).data.data.items.filter(t=>t.contract_address !== "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"); - return allTokens.map(token=>token.contract_address); -} - -module.exports = { - getTokens -} diff --git a/projects/helper/getUniFactory.js b/projects/helper/getUniFactory.js deleted file mode 100644 index b0a6c1e243c..00000000000 --- a/projects/helper/getUniFactory.js +++ /dev/null @@ -1,20 +0,0 @@ -const sdk = require('@defillama/sdk') - -const router = "0x3881e447F439891dC106Da7bca0007B319eeB74D"; -const chain = 'gochain'; - -async function getFactory(){ - const factory = await sdk.api.abi.call({ - target: router, - chain, - abi: {"inputs":[],"name":"factory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}, - }) - const wrappedToken = await sdk.api.abi.call({ - target: router, - chain, - abi: {"inputs":[],"name":"WETH","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}, - }) - // console.log("factory", factory.output) - // console.log("wrapped token", wrappedToken.output) -} -// getFactory() \ No newline at end of file diff --git a/projects/helper/getUniSubgraphTvl.js b/projects/helper/getUniSubgraphTvl.js index 8c188ac08d0..a0fcfbb4dea 100644 --- a/projects/helper/getUniSubgraphTvl.js +++ b/projects/helper/getUniSubgraphTvl.js @@ -1,7 +1,6 @@ const { request, gql } = require("graphql-request"); const { toUSDTBalances } = require('../helper/balances'); -const { getBlock } = require('../helper/getBlock'); -const { blockQuery } = require('./graph') +const { blockQuery, getBlock, } = require('./http') function getChainTvl(graphUrls, factoriesName = "uniswapFactories", tvlName = "totalLiquidityUSD", blockCatchupLimit = 500) { const graphQuery = gql` @@ -14,14 +13,15 @@ query get_tvl($block: Int) { } `; return (chain) => { - return async (timestamp, ethBlock, chainBlocks) => { - const block = await getBlock(timestamp, chain, chainBlocks) + return async (_, _b, _cb, { api }) => { + await api.getBlock() + const block = api.block let uniswapFactories if (!blockCatchupLimit) { uniswapFactories = (await request(graphUrls[chain], graphQuery, { block, }))[factoriesName]; } else { - uniswapFactories = (await blockQuery(graphUrls[chain], graphQuery, block, blockCatchupLimit))[factoriesName]; + uniswapFactories = (await blockQuery(graphUrls[chain], graphQuery, { api, blockCatchupLimit, }))[factoriesName]; } const usdTvl = Number(uniswapFactories[0][tvlName]) diff --git a/projects/helper/getUsdUniTvl.js b/projects/helper/getUsdUniTvl.js deleted file mode 100644 index bd3b460eb2e..00000000000 --- a/projects/helper/getUsdUniTvl.js +++ /dev/null @@ -1,40 +0,0 @@ -const sdk = require('@defillama/sdk'); - -async function requery(results, chain, block, abi) { - if (results.some(r => !r.success)) { - const failed = results.map((r, i) => [r, i]).filter(r => !r[0].success) - const newResults = await sdk.api.abi - .multiCall({ - abi, - chain, - calls: failed.map((f) => f[0].input), - block, - }).then(({ output }) => output); - failed.forEach((f, i) => { - results[f[1]] = newResults[i] - }) - } -} - -function sum(balances, token, amount) { - if (balances[token] === undefined) { - balances[token] = 0 - } - balances[token] += Number(amount) -} - -function setPrice(prices, address, coreAmount, tokenAmount) { - if (prices[address] !== undefined) { - const currentCoreAmount = prices[address][0] - if (coreAmount < currentCoreAmount) { - return - } - } - prices[address] = [Number(coreAmount), Number(coreAmount) / Number(tokenAmount)] -} - -module.exports = { - requery, - setPrice, - sum -}; diff --git a/projects/helper/gmx.js b/projects/helper/gmx.js index 41e7d087e4f..07295c3c566 100644 --- a/projects/helper/gmx.js +++ b/projects/helper/gmx.js @@ -1,59 +1,21 @@ const { sumTokens2 } = require('./unwrapLPs') -const { getParamCalls, } = require('./utils') -const sdk = require('@defillama/sdk') -function gmxExports({ chain, vault, }) { - return async (ts, _block, { [chain]: block }) => { - const { output: numTokens } = await sdk.api.abi.call({ +function gmxExports({ vault, blacklistedTokens = [], abis = {} }) { + abis = { ...defaultAbis, ...abis} + return async (ts, _block, _, { api }) => { + const tokenAddresses = await api.fetchList({ target: vault, - abi: abis.allWhitelistedTokensLength, - chain, block, + lengthAbi: abis.allWhitelistedTokensLength, + itemAbi: abis.allWhitelistedTokens, }) - - const { output: tokenAddresses } = await sdk.api.abi.multiCall({ - target: vault, - abi: abis.allWhitelistedTokens, - calls: getParamCalls(numTokens), - chain, block, - }) - - return sumTokens2({ owner: vault, tokens: tokenAddresses.map(i => i.output), chain, block,}) + + return sumTokens2({ api, owner: vault, tokens: tokenAddresses, blacklistedTokens, }) } } -const abis = { - "allWhitelistedTokensLength":{ - "inputs": [], - "name": "allWhitelistedTokensLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "allWhitelistedTokens": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "allWhitelistedTokens", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, +const defaultAbis = { + allWhitelistedTokensLength: 'uint256:allWhitelistedTokensLength', + allWhitelistedTokens: 'function allWhitelistedTokens(uint256) view returns (address)' } module.exports = { diff --git a/projects/helper/graph.js b/projects/helper/graph.js deleted file mode 100644 index 525812ac0ff..00000000000 --- a/projects/helper/graph.js +++ /dev/null @@ -1,24 +0,0 @@ -const { GraphQLClient, } = require('graphql-request') -const { log } = require('./utils') - -async function blockQuery(endpoint, query, block, blockCatchupLimit = 200) { - const graphQLClient = new GraphQLClient(endpoint) - try { - const results = await graphQLClient.request(query, { block }) - return results - } catch (e) { - if (!block) throw e - const errorString = e.toString() - const isBlockCatchupIssue = /Failed to decode.*block.number.*has only indexed up to block number \d+/.test(errorString) - if (!isBlockCatchupIssue) throw e - const indexedBlockNumber = +errorString.match(/indexed up to block number (\d+) /)[1] - log('We have indexed only upto ', indexedBlockNumber, 'requested block: ', block) - if (block - blockCatchupLimit > indexedBlockNumber) - throw e - return graphQLClient.request(query, { block: indexedBlockNumber }) - } -} - -module.exports = { - blockQuery -} diff --git a/projects/helper/http.js b/projects/helper/http.js index d96359c1a31..09a9bb3eb27 100644 --- a/projects/helper/http.js +++ b/projects/helper/http.js @@ -1,35 +1,134 @@ const axios = require("axios") -const { request } = require("graphql-request") -const COVALENT_KEY = 'ckey_72cd3b74b4a048c9bc671f7c5a6' +const { request, GraphQLClient, } = require("graphql-request") +const sdk = require('@defillama/sdk') +const { getEnv } = require('./env') +const { getCache: cGetCache, setCache } = require('./cache') + +const chainIds = { + 'ethereum': 1, + 'optimism': 10, + 'bsc': 56, + 'polygon': 137, + 'arbitrum': 42161, + 'fantom': 250, + 'avax': 43114, +} + +const getCacheData = {} + +async function getCache(endpoint) { + if (!getCacheData[endpoint]) getCacheData[endpoint] = get(endpoint) + return getCacheData[endpoint] +} + +async function getBlock(timestamp, chain, chainBlocks, undefinedOk = false) { + if (chainBlocks[chain] || (!getEnv('HISTORICAL') && undefinedOk)) { + return chainBlocks[chain] + } else { + if (chain === "celo") { + return Number((await get("https://explorer.celo.org/api?module=block&action=getblocknobytime×tamp=" + timestamp + "&closest=before")).result.blockNumber); + } else if (chain === "moonriver") { + return Number((await get(`https://blockscout.moonriver.moonbeam.network/api?module=block&action=getblocknobytime×tamp=${timestamp}&closest=before`)).result.blockNumber); + } + return sdk.api.util.lookupBlock(timestamp, { chain }).then(blockData => blockData.block) + } +} async function get(endpoint) { return (await axios.get(endpoint)).data } +async function getWithMetadata(endpoint) { + return axios.get(endpoint) +} + async function post(endpoint, body) { return (await axios.post(endpoint, body)).data } -async function graphQuery(endpoint, graphQuery, params = {}) { +async function graphQuery(endpoint, graphQuery, params = {}, { timestamp, chain, chainBlocks, useBlock = false } = {}) { + if (useBlock && !params.block) + params.block = await getBlock(timestamp, chain, chainBlocks) return request(endpoint, graphQuery, params) } async function covalentGetTokens(address, chain = 'ethereum') { - let chainId - switch(chain) { - case 'ethereum': chainId = 1; break; - case 'bsc': chainId = 56; break; - default: throw new Error('Missing chain to chain id mapping!!!') + let chainId = chainIds[chain] + if (!chainId) throw new Error('Missing chain to chain id mapping:' + chain) + if (!address) throw new Error('Missing adddress') + + const timeNow = +Date.now() + const THREE_DAYS = 3 * 24 * 3600 * 1000 + const project = 'covalent-cache' + const key = `${address}/${chain}` + const cache = (await cGetCache(project, key)) ?? {} + if (!cache.timestamp || (cache.timestamp + THREE_DAYS) < timeNow) { + cache.data = await _covalentGetTokens() + cache.timestamp = timeNow + await setCache(project, key, cache) + } + + return cache.data + + async function _covalentGetTokens() { + const { + data: { items } + } = await get(`https://api.covalenthq.com/v1/${chainId}/address/${address}/balances_v2/?&key=${getEnv('COVALENT_KEY')}`) + let table = {} + items + .filter(i => +i.balance > 0) + .forEach(i => table[i.contract_name || 'null'] = i.contract_address) + return items + .filter(i => +i.balance > 0) + .map(i => i.contract_address.toLowerCase()) + } +} + +async function blockQuery(endpoint, query, { api, blockCatchupLimit = 500, }) { + const graphQLClient = new GraphQLClient(endpoint) + await api.getBlock() + const block = api.block + try { + const results = await graphQLClient.request(query, { block }) + return results + } catch (e) { + if (!block) throw e + const errorString = e.toString() + const isBlockCatchupIssue = /Failed to decode.*block.number.*has only indexed up to block number \d+/.test(errorString) + if (!isBlockCatchupIssue) throw e + const indexedBlockNumber = +errorString.match(/indexed up to block number (\d+) /)[1] + sdk.log('We have indexed only upto ', indexedBlockNumber, 'requested block: ', block) + if (block - blockCatchupLimit > indexedBlockNumber) + throw e + return graphQLClient.request(query, { block: indexedBlockNumber }) } - const { - data: { items } - } = await get(`https://api.covalenthq.com/v1/${chainId}/address/${address}/balances_v2/?&key=${COVALENT_KEY}`) - return items +} + +async function graphFetchById({ endpoint, query, params = {}, api, options: { useBlock = false, safeBlockLimit = 100 } = {} }) { + if (useBlock && !params.block) + params.block = await api.getBlock() - safeBlockLimit + + let data = [] + let lastId = "" + let response; + do { + const res = await request(endpoint, query, { ...params, lastId }) + Object.keys(res).forEach(key => response = res[key]) + data.push(...response) + lastId = response[response.length - 1]?.id + sdk.log(data.length, response.length) + } while (lastId) + return data } module.exports = { get, + getCache, post, + blockQuery, graphQuery, covalentGetTokens, -} \ No newline at end of file + graphFetchById, + getBlock, + getWithMetadata, +} diff --git a/projects/helper/koyo.js b/projects/helper/koyo.js index 92727781be9..86d547182a9 100644 --- a/projects/helper/koyo.js +++ b/projects/helper/koyo.js @@ -1,42 +1,21 @@ const sdk = require("@defillama/sdk"); -const { requery } = require("./requery"); -const { fetchURL } = require("./utils"); +const { getConfig } = require('../helper/cache') + const BigNumber = require("bignumber.js"); const { usdtAddress, toUSDT } = require("./balances"); -const koyoStableSwapVirtualPriceABI = { - stateMutability: "view", - type: "function", - name: "get_virtual_price", - inputs: [], - outputs: [ - { - name: "", - type: "uint256", - }, - ], -}; +const koyoStableSwapVirtualPriceABI = "uint256:get_virtual_price" -/** - * @description This function presumes that passed LP Tokens are from USD based stable pools. - * @param {Object.} balances - * @param {string[]} lpTokens - * @param {string[]} owners - * @param {number[]} block - * @param {string} [chain="boba"] - * @param {*} transformAddress - */ async function sumKoyoLPTokens( balances, lpTokens, owners, block, chain = "boba", - transformAddress = (addr) => addr ) { const { - data: { data: pools }, - } = await fetchURL(`https://api.exchange.koyo.finance/pools/raw/${chain}`); + data: pools + } = await getConfig('koyo/'+chain, `https://api.exchange.koyo.finance/pools/raw/${chain}`); const lpToSwap = Object.fromEntries( Object.entries(pools) .filter(([k]) => !["generatedTime"].includes(k)) @@ -71,8 +50,6 @@ async function sumKoyoLPTokens( chain, }); - await requery(balanceOfTokens, chain, block, "erc20:balanceOf"); - balanceOfTokens.output.forEach((result) => { const token = result.input.target.toLowerCase(); const balance = result.output; diff --git a/projects/helper/liquity.js b/projects/helper/liquity.js index 9c0cd6ac914..f6622f316b1 100644 --- a/projects/helper/liquity.js +++ b/projects/helper/liquity.js @@ -1,24 +1,13 @@ const sdk = require("@defillama/sdk"); -const getEntireSystemCollAbi = require("./abis/getEntireSystemColl.abi.json"); - -const TUSD = "0x0000000000085d4780b73119b644ae5ecd22b376" function getLiquityTvl(ETH_ADDRESS, TROVE_MANAGER_ADDRESS, chain) { return async (_, ethBlock, chainBlocks) => { const block = chainBlocks[chain] - /*const stabilityPoolLusdTvl = ( - await sdk.api.erc20.balanceOf({ - target: LUSD_TOKEN_ADDRESS, - owner: STABILITY_POOL_ADDRESS, - block, - chain, - }) - ).output;*/ const troveEthTvl = ( await sdk.api.abi.call({ target: TROVE_MANAGER_ADDRESS, - abi: getEntireSystemCollAbi, + abi: "uint256:getEntireSystemColl", block, chain, }) @@ -26,7 +15,6 @@ function getLiquityTvl(ETH_ADDRESS, TROVE_MANAGER_ADDRESS, chain) { return { [chain+':'+ETH_ADDRESS]: troveEthTvl, - //[useTusd? TUSD : chain+':'+LUSD_TOKEN_ADDRESS]: stabilityPoolLusdTvl, }; } } diff --git a/projects/helper/masterchef.js b/projects/helper/masterchef.js index 5f008a4efe2..b4bf0c70a5f 100644 --- a/projects/helper/masterchef.js +++ b/projects/helper/masterchef.js @@ -1,11 +1,11 @@ const sdk = require('@defillama/sdk'); const abi = require('./abis/masterchef.json') const { unwrapUniswapLPs, unwrapLPsAuto, isLP } = require('./unwrapLPs') -const tokenAbi = require("./abis/token.json"); -const token0Abi = require("./abis/token0.json"); -const token1Abi = require("./abis/token1.json"); -const getReservesAbi = require("./abis/getReserves.json"); -const userInfoAbi = require("./abis/userInfo.json"); +const tokenAbi = 'address:token' +const token0Abi = 'address:token0' +const token1Abi = 'address:token1' +const getReservesAbi = 'function getReserves() view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast)' +const userInfoAbi = 'function userInfo(uint256, address) view returns (uint256 amount, uint256 rewardDebt)' const { default: BigNumber } = require('bignumber.js'); const { getChainTransform, getFixBalances } = require('../helper/portedTokens'); @@ -43,6 +43,7 @@ async function getSymbolsAndBalances(masterChef, block, chain, poolInfo) { })), abi: 'erc20:symbol', chain, + permitFailure: true, }), sdk.api.abi.multiCall({ block, @@ -52,6 +53,7 @@ async function getSymbolsAndBalances(masterChef, block, chain, poolInfo) { })), abi: 'erc20:balanceOf', chain, + permitFailure: true, }) ]) return [symbols, tokenBalances] @@ -272,7 +274,7 @@ function masterChefExports(masterChef, chain, stakingTokenRaw, tokenIsOnCoingeck Object.values(balances).map(fixBalances) } return balances - }; + } function getTvlPromise(key) { return async (ts, _block, chainBlocks) => { @@ -287,13 +289,13 @@ function masterChefExports(masterChef, chain, stakingTokenRaw, tokenIsOnCoingeck [chain]: { staking: getTvlPromise("staking"), pool2: getTvlPromise("pool2"), - masterchef: getTvlPromise("tvl"), + // masterchef: getTvlPromise("tvl"), tvl: getTvlPromise("tvl"), } }; } -const standardPoolInfoAbi = { "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "name": "poolInfo", "outputs": [{ "internalType": "contract IERC20", "name": "lpToken", "type": "address" }, { "internalType": "uint256", "name": "allocPoint", "type": "uint256" }, { "internalType": "uint256", "name": "lastRewardBlock", "type": "uint256" }, { "internalType": "uint256", "name": "accWeVEPerShare", "type": "uint256" }], "stateMutability": "view", "type": "function" } +const standardPoolInfoAbi = 'function poolInfo(uint256) view returns (address lpToken, uint256 allocPoint, uint256 lastRewardBlock, uint256 accWeVEPerShare)' async function getUserMasterChefBalances({ balances = {}, masterChefAddress, userAddres, block, chain = 'ethereum', transformAddress, excludePool2 = false, onlyPool2 = false, pool2Tokens= [], poolInfoABI = abi.poolInfo, getLPAddress = null }) { if (!transformAddress) diff --git a/projects/helper/nft.js b/projects/helper/nft.js new file mode 100644 index 00000000000..dc16b8f2499 --- /dev/null +++ b/projects/helper/nft.js @@ -0,0 +1,45 @@ +const sdk = require('@defillama/sdk') +const whitelistedNFTs = require('./whitelistedNfts.js') +const { getUniqueAddresses } = require('./utils') + +const { AB_COLLECTIONS, AB_OLD_COLLECTIONS } = whitelistedNFTs +const ART_BLOCKS = '0xa7d8d9ef8D8Ce8992Df33D8b8CF4Aebabd5bD270'.toLowerCase() +const ART_BLOCKS_OLD = '0x059edd72cd353df5106d2b9cc5ab83a52287ac3a'.toLowerCase() + +async function sumArtBlocks({ balances = {}, api, owner, owners = [] }) { + if (owner) owners = [owner] + if (!owners.length) return balances + owners = getUniqueAddresses(owners) + let nftIds = (await api.multiCall({ abi: 'function tokensOfOwner(address) view returns (uint256[])', calls: owners, target: ART_BLOCKS, })).flat() + const nftIds_old = (await api.multiCall({ abi: 'function tokensOfOwner(address) view returns (uint256[])', calls: owners, target: ART_BLOCKS_OLD, })).flat() + + addIds(nftIds, AB_COLLECTIONS) + addIds(nftIds_old, AB_OLD_COLLECTIONS) + + return balances + + function addIds(ids, collections) { + if (!ids.length) return; + collections.map(i => { + const [_, start, end] = i.split(':') + return { label: i, start: +start, end: +end } + }).forEach(({ label, start, end}) => { + ids.forEach((id) => { + id = +id + if (id >= start && id <= end) sdk.util.sumSingleBalance(balances, label, 1, api.chain) + }) + }) + + } +} + +function isArtBlocks(collectionAddress) { + collectionAddress = collectionAddress.toLowerCase() + return [ART_BLOCKS, ART_BLOCKS_OLD].includes(collectionAddress) +} + +module.exports = { + sumArtBlocks, + isArtBlocks, + whitelistedNFTs, +} \ No newline at end of file diff --git a/projects/helper/pact.js b/projects/helper/pact.js index 76e20e42121..4189b965902 100644 --- a/projects/helper/pact.js +++ b/projects/helper/pact.js @@ -4,7 +4,7 @@ const { prepareExecCmd } = require('./utils/pact') async function fetchLocal(localCmd, apiHost) { if (!apiHost) throw new Error(`Pact.fetch.local(): No apiHost provided`); - const { pactCode, meta, networkId } = localCmd + const { pactCode, meta = mkMeta("", "", 0, 0, 0, 0), networkId } = localCmd const cmd = prepareExecCmd(pactCode, meta, networkId); const res = await post(`${apiHost}/api/v1/local`, cmd) return res; diff --git a/projects/helper/pool2.js b/projects/helper/pool2.js index 012c8a8de78..83a28acee23 100644 --- a/projects/helper/pool2.js +++ b/projects/helper/pool2.js @@ -4,18 +4,20 @@ const { default: BigNumber } = require('bignumber.js') const { unwrapUniswapLPs, sumTokensAndLPsSharedOwners, sumTokensAndLPs, unwrapUniswapV3NFTs, sumTokensExport, } = require('./unwrapLPs'); const { getFixBalancesSync } = require('../helper/portedTokens') const masterchefAbi = require("./abis/masterchef.json") -const token0Abi = require("./abis/token0.json") -const token1Abi = require("./abis/token1.json") +const token0Abi = 'address:token0' +const token1Abi = 'address:token1' const { isLP, getPoolInfo } = require('./masterchef') -function pool2(stakingContract, lpToken, chain = "ethereum", transformAddress) { +function pool2(stakingContract, lpToken, chain, transformAddress) { if (!Array.isArray(stakingContract)) stakingContract = [stakingContract] if (!Array.isArray(lpToken)) lpToken = [lpToken] return pool2s(stakingContract, lpToken, chain,transformAddress ) } function pool2s(stakingContracts, lpTokens, chain = "ethereum", transformAddress = undefined) { - return async (_timestamp, _ethBlock, {[chain]: block }) => { + return async (_timestamp, _ethBlock, _, { api }) => { + chain = api.chain ?? chain + const block = api.block const balances = {} let transform = transformAddress if (transform === undefined) { diff --git a/projects/helper/portedTokens.js b/projects/helper/portedTokens.js index f7fa6842c78..47fac2291bc 100644 --- a/projects/helper/portedTokens.js +++ b/projects/helper/portedTokens.js @@ -1,4 +1,3 @@ -const utils = require("../helper/utils"); const sdk = require("@defillama/sdk"); const BigNumber = require("bignumber.js"); const { @@ -7,63 +6,14 @@ const { stripTokenHeader, transformTokens, fixBalancesTokens, - unsupportedGeckoChains, ibcChains, + distressedAssts, } = require('./tokenMapping') async function transformFantomAddress() { return transformChainAddress(transformTokens.fantom, "fantom") } -function compareAddresses(a, b) { - return a.toLowerCase() === b.toLowerCase(); -} - -async function transformAvaxAddress() { - const [ - bridgeTokensOld, - bridgeTokensNew, - bridgeTokenDetails - ] = await Promise.all([ - utils.fetchURL( - "https://raw.githubusercontent.com/0xngmi/bridge-tokens/main/data/penultimate.json" - ), - utils - .fetchURL( - "https://raw.githubusercontent.com/ava-labs/avalanche-bridge-resources/main/avalanche_contract_address.json" - ) - .then(r => Object.entries(r.data)), - utils.fetchURL( - "https://raw.githubusercontent.com/ava-labs/avalanche-bridge-resources/main/token_list.json" - ) - ]); - return addr => { - const map = transformTokens.avax; - if (map[addr.toLowerCase()]) return map[addr.toLowerCase()] - const srcToken = bridgeTokensOld.data.find(token => - compareAddresses(token["Avalanche Token Address"], addr) - ); - if ( - srcToken !== undefined && - srcToken["Ethereum Token Decimals"] === - srcToken["Avalanche Token Decimals"] - ) { - return srcToken["Ethereum Token Address"]; - } - const newBridgeToken = bridgeTokensNew.find(token => - compareAddresses(addr, token[1]) - ); - if (newBridgeToken !== undefined) { - const tokenName = newBridgeToken[0].split(".")[0]; - const tokenData = bridgeTokenDetails.data[tokenName]; - if (tokenData !== undefined) { - return tokenData.nativeContractAddress; - } - } - return `avax:${addr}`; - }; -} - async function transformBscAddress() { return transformChainAddress(transformTokens.bsc, "bsc") } @@ -77,53 +27,17 @@ async function transformCeloAddress() { } async function transformOptimismAddress() { - const bridge = (await utils.fetchURL( - "https://static.optimism.io/optimism.tokenlist.json" - )).data.tokens; - - const mapping = transformTokens.optimism - - return addr => { - addr = addr.toLowerCase(); - - if (mapping[addr]) return mapping[addr]; - - const dstToken = bridge.find( - token => compareAddresses(addr, token.address) && token.chainId === 10 - ); - if (dstToken !== undefined) { - const srcToken = bridge.find( - token => dstToken.logoURI === token.logoURI && token.chainId === 1 - ); - if (srcToken !== undefined) { - return srcToken.address; - } - } - return `optimism:${addr}`; - }; + return transformChainAddress(transformTokens.optimism, "optimism") } async function transformArbitrumAddress() { - const bridge = (await utils.fetchURL( - "https://bridge.arbitrum.io/token-list-42161.json" - )).data.tokens; - const mapping = transformTokens.arbitrum - - return addr => { - addr = addr.toLowerCase(); - if (mapping[addr]) return mapping[addr]; - const dstToken = bridge.find(token => - compareAddresses(addr, token.address) - ); - if (dstToken && dstToken.extensions) { - return dstToken.extensions.bridgeInfo[1].tokenAddress; - } - return `arbitrum:${addr}`; - }; + return transformChainAddress(transformTokens.arbitrum, "arbitrum") } async function transformInjectiveAddress() { return addr => { + if (addr.includes('ibc/')) return addr.replace(/.*ibc\//, 'ibc/').replace(/\//g, ':') + addr = addr.replace(/\//g, ':') if (addr.startsWith('peggy0x')) return `ethereum:${addr.replace('peggy', '')}` return `injective:${addr}`; @@ -131,7 +45,7 @@ async function transformInjectiveAddress() { } function fixBalances(balances, mapping, { chain, } = {}) { - const removeUnmapped = unsupportedGeckoChains.includes(chain) // TODO: fix server-side, remove this + const removeUnmapped = false Object.keys(balances).forEach(token => { let tokenKey = stripTokenHeader(token, chain) @@ -178,9 +92,7 @@ const chainTransforms = { fantom: transformFantomAddress, bsc: transformBscAddress, polygon: transformPolygonAddress, - avax: transformAvaxAddress, optimism: transformOptimismAddress, - arbitrum: transformArbitrumAddress, injective: transformInjectiveAddress, }; @@ -191,6 +103,7 @@ function transformChainAddress( ) { return addr => { + if (distressedAssts.has(addr.toLowerCase())) return 'ethereum:0xbad' if (['solana'].includes(chain)) { return mapping[addr] ? mapping[addr] : `${chain}:${addr}` } @@ -217,14 +130,22 @@ async function getChainTransform(chain) { return transformChainAddress(transformTokens[chain], chain) return addr => { - addr = normalizeAddress(addr, chain) + if (addr.includes('ibc/')) return addr.replace(/.*ibc\//, 'ibc/').replace(/\//g, ':') + if (addr.startsWith('coingecko:')) return addr + if (addr.startsWith(chain + ':') || addr.startsWith('ibc:')) return addr + if (distressedAssts.has(addr.toLowerCase())) return 'ethereum:0xbad' + + addr = normalizeAddress(addr, chain).replace(/\//g, ':') const chainStr = `${chain}:${addr}` + if ([...ibcChains, 'ton', 'defichain', 'waves'].includes(chain)) return chainStr + if (chain === 'cardano' && addr === 'ADA') return 'coingecko:cardano' if (chain === 'near' && addr.endsWith('.near')) return chainStr + if (chain === 'tron' && addr.startsWith('T')) return chainStr + if (chain === 'stacks' && addr.startsWith('SP')) return chainStr if (chain === 'tezos' && addr.startsWith('KT1')) return chainStr - if (ibcChains.includes(chain) && addr.startsWith('ibc/')) return chainStr if (chain === 'terra2' && addr.startsWith('terra1')) return chainStr if (chain === 'algorand' && /^\d+$/.test(addr)) return chainStr - if (addr.startsWith('0x') || ['solana'].includes(chain)) return chainStr + if (addr.startsWith('0x') || ['solana', 'kava'].includes(chain)) return chainStr return addr }; } @@ -240,7 +161,7 @@ async function transformBalances(chain, balances) { return balances } -async function transformDexBalances({ chain, data, balances = {}, restrictTokenRatio = 10, withMetadata = false, blacklistedTokens = [], coreTokens }) { +async function transformDexBalances({ chain, data, balances = {}, restrictTokenRatio = 5, withMetadata = false, blacklistedTokens = [], coreTokens }) { if (!coreTokens) coreTokens = new Set(getCoreAssets(chain)) @@ -255,6 +176,7 @@ async function transformDexBalances({ chain, data, balances = {}, restrictTokenR i.token1Bal = +i.token1Bal priceToken(i) }) + // sdk.log(prices) data.forEach(addTokens) updateBalances(balances) @@ -270,8 +192,8 @@ async function transformDexBalances({ chain, data, balances = {}, restrictTokenR } function addTokens({ token0, token0Bal, token1, token1Bal }) { - const isCoreToken0 = coreTokens.has(token0) - const isCoreToken1 = coreTokens.has(token1) + const isCoreToken0 = coreTokens.has(token0.replace('ibc/', '')) + const isCoreToken1 = coreTokens.has(token1.replace('ibc/', '')) if ((isCoreToken0 && isCoreToken1) || (!isCoreToken0 && !isCoreToken1)) { sdk.util.sumSingleBalance(balances, token0, token0Bal) sdk.util.sumSingleBalance(balances, token1, token1Bal) @@ -283,8 +205,8 @@ async function transformDexBalances({ chain, data, balances = {}, restrictTokenR } function updateBalances(balances) { - Object.entries(balances).forEach(([token, bal]) => { - bal = +bal + Object.entries(balances).forEach(([token]) => { + let bal = +balances[token] // this is safer as token balance might change while looping when two entries for same token exist const tokenKey = normalizeAddress(token, chain) if (!prices[tokenKey]) return; const priceObj = prices[tokenKey] @@ -320,16 +242,16 @@ async function transformDexBalances({ chain, data, balances = {}, restrictTokenR coreToken, coreTokenBal, tokensInCorePool: tokenBal, - convertableTokenAmount: coreTokenBal * restrictTokenRatio, + convertableTokenAmount: tokenBal * restrictTokenRatio, price: coreTokenBal / tokenBal } return; } const priceObj = prices[token] - priceObj.convertableTokenAmount += coreTokenBal * restrictTokenRatio + priceObj.convertableTokenAmount += tokenBal * restrictTokenRatio if (tokenBal > priceObj.tokensInCorePool) { // i.e current pool has more liquidity - priceObj.tokensInCorePool = coreTokenBal + priceObj.tokensInCorePool = tokenBal priceObj.coreToken = coreToken priceObj.coreTokenBal = coreTokenBal priceObj.price = coreTokenBal / tokenBal @@ -343,7 +265,6 @@ module.exports = { transformFantomAddress, transformBscAddress, transformPolygonAddress, - transformAvaxAddress, transformOptimismAddress, transformArbitrumAddress, transformCeloAddress, diff --git a/projects/helper/resolveCrvTokens.js b/projects/helper/resolveCrvTokens.js deleted file mode 100644 index 2aeecaa62e5..00000000000 --- a/projects/helper/resolveCrvTokens.js +++ /dev/null @@ -1,202 +0,0 @@ - -const sdk = require('@defillama/sdk') -const BigNumber = require('bignumber.js') - -const curvePoolsPartial = require('../convex/pools-crv') -const abi = require('../concentrator/abis/abi.json') -const AladdinCRVABI = require('../concentrator/abis/AladdinCRV.json') -const crvPools = require('./curvePools') - -const replacements = [ - '0x99d1Fa417f94dcD62BfE781a1213c092a47041Bc', - '0x9777d7E2b60bB01759D0E2f8be2095df444cb07E', - '0x1bE5d71F2dA660BFdee8012dDc58D024448A0A59', - '0x16de59092dAE5CcF4A1E6439D611fd0653f0Bd01', - '0xd6aD7a6750A7593E092a9B218d66C0A814a3436e', - '0x83f798e925BcD4017Eb265844FDDAbb448f1707D', - '0x73a052500105205d34Daf004eAb301916DA8190f' -] - -const curvePools = [ - { - assets: 'Curve.fi Factory USD Metapool: moUSD', - isLendingPool: true, - coins: ['0x60d55f02a771d515e077c9c2403a1ef324885cec', '0x27f8d03b3a2196956ed754badc28d73be8830a6e', '0x1a13f4ca1d028320a707d99520abfefca3998b7f'], - addresses: { - swap: '0x445fe580ef8d70ff569ab36e80c647af338db351', - lpToken: '0xe7a24ef0c5e95ffb0f6684b813a78f2a3ad7d171', - gauge: '0x19793b454d3afc7b454f206ffe95ade26ca6912c', - }, - } -] - -const gaugeLPMapping = {} - -Object.keys(crvPools).forEach(key => crvPools[key.toLowerCase()] = crvPools[key]) - -const curveLPMapping = [...curvePoolsPartial, ...curvePools].reduce((accum, poolData) => { - accum[poolData.addresses.lpToken.toLowerCase()] = poolData - if (poolData.addresses.gauge) { - const gaugeToken = poolData.addresses.gauge.toLowerCase() - gaugeLPMapping[gaugeToken] = poolData.addresses.lpToken - accum[gaugeToken] = poolData - } - return accum -}, {}) - - -async function unwrapCrvKnown(balances, crvToken, lpBalance, block, chain = 'ethereum', transformAddress = (addr) => addr, excludeTokensRaw = []) { - crvToken = stripChainHeader(crvToken).toLowerCase() - const excludeTokens = excludeTokensRaw.map(addr => addr.toLowerCase()) - if (crvPools[crvToken] === undefined) - return; - - const crvSwapContract = crvPools[crvToken].swapContract - const underlyingTokens = crvPools[crvToken].underlyingTokens - const crvTotalSupply = sdk.api.erc20.totalSupply({ - target: crvToken, - block, - chain - }) - const underlyingSwapTokens = (await sdk.api.abi.multiCall({ - calls: underlyingTokens.map(token => ({ - target: token, - params: [crvSwapContract] - })), - block, - chain, - abi: 'erc20:balanceOf' - })).output - - // steth and seth case where balanceOf not applicable on ETH balance - if (crvToken.toLowerCase() === '0x06325440d014e39736583c165c2963ba99faf14e' || crvToken.toLowerCase() === '0xa3d87fffce63b53e0d54faa1cc983b7eb0b74a9c') { - underlyingSwapTokens[0].output = underlyingSwapTokens[0].output * 2 - } - - const resolvedCrvTotalSupply = (await crvTotalSupply).output - underlyingSwapTokens.forEach(call => { - if (excludeTokens.includes(call.input.target.toLowerCase())) return; - const underlyingBalance = BigNumber(call.output).times(lpBalance).div(resolvedCrvTotalSupply) - sdk.util.sumSingleBalance(balances, transformAddress(call.input.target), underlyingBalance.toFixed(0)) - }) -} - -const cGaugeMapping = { - avax: { - '0x5b5cfe992adac0c9d48e05854b2d91c73a003858': '0x1337BedC9D22ecbe766dF105c9623922A27963EC', - }, - polygon: { - '0x19793b454d3afc7b454f206ffe95ade26ca6912c': '0xe7a24ef0c5e95ffb0f6684b813a78f2a3ad7d171', - } -} -Object.values(cGaugeMapping).forEach(mapping => Object.keys(mapping).forEach(key => mapping[key.toLowerCase()] = mapping[key])) - -async function unwrapCrv(balances, crvToken, lpBalance, block, chain = 'ethereum', transformAddress = (addr) => addr) { - crvToken = stripChainHeader(crvToken).toLowerCase() - const gaugeMap = cGaugeMapping[chain] || {} - if (gaugeMap[crvToken]) crvToken = gaugeMap[crvToken] - - if (crvPools[crvToken]) return unwrapCrvKnown(...arguments) - - const poolData = curveLPMapping[crvToken] - - if (!poolData) return balances - const swapAddress = poolData.addresses.swap - - const coinCalls = [...Array(Number(poolData.coins.length)).keys()].map(num => { - return { - target: swapAddress, - params: [num] - } - }) - - const coinsUint = sdk.api.abi.multiCall({ - abi: abi.coinsUint, - calls: coinCalls, - block, chain, - }) - - const coinsInt = sdk.api.abi.multiCall({ - abi: abi.coinsInt, - calls: coinCalls, - block, chain, - }) - - let coins = await coinsUint - if (!coins.output[0].success) { - coins = await coinsInt - } - const coinBalances = await sdk.api.abi.multiCall({ - abi: 'erc20:balanceOf', - calls: coins.output.map(coin => ({ - target: coin.output, - params: [swapAddress] - })), - block, chain, - }) - const totalSupply = (await sdk.api.abi.call({ - target: gaugeLPMapping[crvToken] ? gaugeLPMapping[crvToken] : crvToken, - block, - chain, - abi: AladdinCRVABI.totalSupply, - params: [] - })).output - - await Promise.all(coinBalances.output.map(async (coinBalance, index) => { - let coinAddress = coins.output[index].output - if (replacements.includes(coinAddress)) { - coinAddress = '0x6b175474e89094c44da98b954eedeac495271d0f' // dai - } - if (coinBalance.input.target === '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE') { - coinBalance = await sdk.api.eth.getBalance({ - target: coinBalance.input.params[0], - block, chain, - }) - coinAddress = '0x0000000000000000000000000000000000000000' - } - - const balance = BigNumber(lpBalance).times(coinBalance.output).div(totalSupply) - if (!balance.isZero()) { - sdk.util.sumSingleBalance(balances, transformAddress(coinAddress), balance.toFixed(0)) - } - })) - - return balances -} - -function stripChainHeader(token) { - return token.indexOf(':') > -1 ? token.split(':')[1] : token -} - - -function getCrvTokens(balances) { - return Object.keys(balances) - .filter(isCrvToken) - .map(token => ({ token, balance: balances[token] })) - - function isCrvToken(token) { - token = stripChainHeader(token).toLowerCase() - return crvPools[token] || curveLPMapping[token] - } -} - -async function resolveCrvTokens(balances, block, chain = 'ethereum', transformAddress = (addr) => addr) { - let crvTokens = getCrvTokens(balances) - let count = 0 - while (crvTokens.length && count < 6) { - crvTokens.forEach(({ token }) => delete balances[token]) - await Promise.all(crvTokens.map(({ token, balance }) => - unwrapCrv(balances, token, balance, block, chain, transformAddress))) - crvTokens = getCrvTokens(balances) - count++ - } - - if (crvTokens.length) - console.log('unresolved crv tokens:', crvTokens) - return balances -} - -module.exports = { - unwrapCrv, - resolveCrvTokens, -} \ No newline at end of file diff --git a/projects/helper/saddle.js b/projects/helper/saddle.js new file mode 100644 index 00000000000..afb3451c1a7 --- /dev/null +++ b/projects/helper/saddle.js @@ -0,0 +1,33 @@ +const { sumTokens2 } = require('./unwrapLPs') +const { getLogs } = require('./cache/getLogs') + +const swapStorageABI = "function swapStorage() view returns (uint256 initialA, uint256 futureA, uint256 initialATime, uint256 futureATime, uint256 swapFee, uint256 adminFee, address lpToken, address feeCollector)" +function saddleExports(config) { + const exports = {} + + Object.keys(config).forEach(chain => { + const { factory, fromBlock } = config[chain] + exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const logs = await getLogs({ + api, + target: factory, + topics: ['0x0838512b7934222cec571cf3fde1cf3e9e864bbc431bd5d1ef4d9ed3079093d9'], + fromBlock, + eventAbi: 'event NewSwapPool (address indexed deployer, address swapAddress, address[] pooledTokens)', + onlyArgs: true, + }) + + const blacklistedTokens = (await api.multiCall({ abi: swapStorageABI, calls: logs.map(i => i.swapAddress)})).map(i => i.lpToken) + return sumTokens2({ api, ownerTokens: logs.map(i => [i.pooledTokens, i.swapAddress]), blacklistedTokens, }) + } + } + }) + + + return exports +} + +module.exports = { + saddleExports, +}; diff --git a/projects/helper/solana.js b/projects/helper/solana.js index a417604f55a..e7e2a773128 100644 --- a/projects/helper/solana.js +++ b/projects/helper/solana.js @@ -1,25 +1,30 @@ +const ADDRESSES = require('./coreAssets.json') const axios = require("axios"); const http = require('./http') +const { getEnv } = require('./env') const { transformBalances: transformBalancesOrig, transformDexBalances, } = require('./portedTokens.js') -const { tokens } = require('./tokenMapping') +const { getUniqueAddresses } = require('./tokenMapping') const { Connection, PublicKey, Keypair } = require("@solana/web3.js") const { AnchorProvider: Provider, Wallet, } = require("@project-serum/anchor"); const { sleep, sliceIntoChunks, log, } = require('./utils') const { decodeAccount } = require('./utils/solana/layout') const sdk = require('@defillama/sdk') -const tokenMapping = tokens -const blacklistedTokens = [ +const blacklistedTokens_default = [ 'CowKesoLUaHSbAMaUxJUj7eodHHsaLsS65cy8NFyRDGP', + '674PmuiDtgKx3uKuJ1B16f9m5L84eFvNwj3xDMvHcbo7', // $WOOD + 'SNSNkV9zfG5ZKWQs6x4hxvBRV6s8SqMfSGCtECDvdMd', // SNS + 'A7rqejP8LKN8syXMr4tvcKjs2iJ4WtZjXNs1e6qP3m9g', // ZION + '2HeykdKjzHKGm2LKHw8pDYwjKPiFEoXAz74dirhUgQvq', // SAO ] let connection, provider -const endpoint = process.env.SOLANA_RPC || "https://rpc.ankr.com/solana" // or "https://solana-api.projectserum.com/" +const endpoint = () => getEnv('SOLANA_RPC') function getConnection() { - if (!connection) connection = new Connection(endpoint) + if (!connection) connection = new Connection(endpoint()) return connection } @@ -41,7 +46,7 @@ async function getSolBalances(accounts) { const tokenBalances = [] const chunks = sliceIntoChunks(accounts, 99) for (let chunk of chunks) { - const bal = await axios.post(endpoint, chunk.map(formBody)) + const bal = await axios.post(endpoint(), chunk.map(formBody)) tokenBalances.push(...bal.data) } return tokenBalances.reduce((a, i) => a + i.result.value, 0) @@ -54,7 +59,7 @@ async function getSolBalance(account) { const TOKEN_LIST_URL = "https://cdn.jsdelivr.net/gh/solana-labs/token-list@main/src/tokens/solana.tokenlist.json" async function getTokenSupply(token) { - const tokenSupply = await axios.post(endpoint, { + const tokenSupply = await axios.post(endpoint(), { jsonrpc: "2.0", id: 1, method: "getTokenSupply", @@ -66,15 +71,16 @@ async function getTokenSupply(token) { async function getGeckoSolTokens() { const tokens = await getTokenList() const tokenSet = new Set() - tokens.filter(i => i.extensions?.coingeckoId).forEach(i => tokenSet.add(i.address)) + tokens.filter(i => i.extensions?.coingeckoId && i.chainId === 101).forEach(i => tokenSet.add(i.address)) return tokenSet } -async function getSolTokenMap() { - const tokenList = await getTokenList() - let map = {} - tokenList.forEach(i => map[i.address] = i) - return map + +async function getValidGeckoSolTokens() { + const tokens = await getTokenList() + const tokenSet = new Set() + tokens.filter(i => i.extensions?.coingeckoId && i.chainId === 101 && !i.name.includes('(Wormhole v1)')).forEach(i => tokenSet.add(i.address)) + return tokenSet } async function getTokenDecimals(tokens) { @@ -82,7 +88,7 @@ async function getTokenDecimals(tokens) { const res = {} const chunks = sliceIntoChunks(tokens, 99) for (const chunk of chunks) { - const tokenSupply = await axios.post(endpoint, calls(chunk)) + const tokenSupply = await axios.post(endpoint(), calls(chunk)) tokenSupply.data.forEach(({ id, result }) => res[id] = result.value.decimals) } return res @@ -101,7 +107,7 @@ function formTokenBalanceQuery(token, account) { } } async function getTokenBalance(token, account) { - const tokenBalance = await axios.post(endpoint, formTokenBalanceQuery(token, account)); + const tokenBalance = await axios.post(endpoint(), formTokenBalanceQuery(token, account)); return tokenBalance.data.result.value.reduce( (total, account) => total + account.account.data.parsed.info.tokenAmount.uiAmount, @@ -111,8 +117,11 @@ async function getTokenBalance(token, account) { async function getTokenBalances(tokensAndAccounts) { const body = tokensAndAccounts.map(([token, account]) => formTokenBalanceQuery(token, account)) - const tokenBalances = await axios.post(endpoint, body); + const tokenBalances = await axios.post(endpoint(), body); const balances = {} + tokenBalances.data.forEach((v, i )=> { + if (!v.result) console.log(v, tokensAndAccounts[i]) + } ) tokenBalances.data.forEach(({ result: { value } }) => { value.forEach(({ account: { data: { parsed: { info: { mint, tokenAmount: { amount } } } } } }) => { sdk.util.sumSingleBalance(balances, mint, amount) @@ -121,7 +130,7 @@ async function getTokenBalances(tokensAndAccounts) { return balances } -async function getTokenAccountBalances(tokenAccounts, { individual = false, chunkSize = 99 } = {}) { +async function getTokenAccountBalances(tokenAccounts, { individual = false, chunkSize = 99, allowError = false, } = {}) { log('total token accounts: ', tokenAccounts.length) const formBody = account => ({ method: "getAccountInfo", jsonrpc: "2.0", params: [account, { encoding: "jsonParsed", commitment: "confirmed" }], id: account }) const balancesIndividual = [] @@ -129,7 +138,7 @@ async function getTokenAccountBalances(tokenAccounts, { individual = false, chun const chunks = sliceIntoChunks(tokenAccounts, chunkSize) for (const chunk of chunks) { const body = chunk.map(formBody) - const data = await axios.post(endpoint, body); + const data = await axios.post(endpoint(), body); data.data.forEach(({ result: { value } }, i) => { if (!value || !value.data.parsed) { if (tokenAccounts[i].toString() === '11111111111111111111111111111111') { @@ -137,6 +146,7 @@ async function getTokenAccountBalances(tokenAccounts, { individual = false, chun return; } console.log(data.data.map(i => i.result.value)[i], tokenAccounts[i].toString()) + if (allowError) return; } const { data: { parsed: { info: { mint, tokenAmount: { amount } } } } } = value sdk.util.sumSingleBalance(balances, mint, amount) @@ -154,7 +164,7 @@ async function getTokenAccountBalances(tokenAccounts, { individual = false, chun async function getTokenAccountBalance(account) { const tokenBalance = await axios.post( - endpoint, + endpoint(), { jsonrpc: "2.0", id: 1, @@ -200,7 +210,7 @@ async function getMultipleAccountsRaw(accountsArray) { const res = [] const chunks = sliceIntoChunks(accountsArray, 99) for (const chunk of chunks) { - const accountsInfo = await axios.post(endpoint, { + const accountsInfo = await axios.post(endpoint(), { jsonrpc: "2.0", id: 1, method: "getMultipleAccounts", @@ -280,7 +290,7 @@ function exportDexTVL(DEX_PROGRAM_ID, getTokenAccounts) { } const coreTokens = await getGeckoSolTokens() - return transformDexBalances({ chain: 'solana', data, blacklistedTokens, coreTokens, }) + return transformDexBalances({ chain: 'solana', data, blacklistedTokens: blacklistedTokens_default, coreTokens, }) } async function _getTokenAccounts() { @@ -301,13 +311,6 @@ function exportDexTVL(DEX_PROGRAM_ID, getTokenAccounts) { } } -async function getSaberPools() { - return http.get('https://registry.saber.so/data/llama.mainnet.json') -} -async function getQuarryData() { - return http.get('https://raw.githubusercontent.com/QuarryProtocol/rewarder-list-build/master/mainnet-beta/tvl.json') -} - async function sumTokens2({ balances = {}, tokensAndOwners = [], @@ -317,15 +320,18 @@ async function sumTokens2({ tokenAccounts = [], solOwners = [], blacklistedTokens = [], + allowError = false, }) { if (!tokensAndOwners.length) { if (owner) tokensAndOwners = tokens.map(t => [t, owner]) if (owners.length) tokensAndOwners = tokens.map(t => owners.map(o => [t, o])).flat() } + blacklistedTokens.push(...blacklistedTokens_default) tokensAndOwners = tokensAndOwners.filter(([token]) => !blacklistedTokens.includes(token)) if (tokensAndOwners.length) { + tokensAndOwners = getUnique(tokensAndOwners) log('total balance queries: ', tokensAndOwners.length) const chunks = sliceIntoChunks(tokensAndOwners, 99) for (const chunk of chunks) { @@ -338,21 +344,32 @@ async function sumTokens2({ } if (tokenAccounts.length) { - const tokenBalances = await getTokenAccountBalances(tokenAccounts) - return transformBalances({ tokenBalances, balances, }) + tokenAccounts = getUniqueAddresses(tokenAccounts, 'solana') + const tokenBalances = await getTokenAccountBalances(tokenAccounts, { allowError }) + await transformBalances({ tokenBalances, balances, }) } if (solOwners.length) { const solBalance = await getSolBalances(solOwners) - sdk.util.sumSingleBalance(balances, tokenMapping.solana, solBalance) + sdk.util.sumSingleBalance(balances, 'solana:' + ADDRESSES.solana.SOL, solBalance) } + blacklistedTokens.forEach(i => delete balances['solana:'+i]) + return balances async function _sumTokens(tokensAndAccounts) { const tokenBalances = await getTokenBalances(tokensAndAccounts) return transformBalances({ tokenBalances, balances, }) } + + function getUnique(tokensAndOwners) { + const set = new Set() + tokensAndOwners.forEach(i => { + set.add(i.join('$')) + }) + return [...set].map(i => i.split('$')) + } } async function transformBalances({ tokenBalances, balances = {}, }) { @@ -374,8 +391,7 @@ function readBigUInt64LE(buffer, offset) { } module.exports = { - endpoint, - tokens, + endpoint: endpoint(), getTokenSupply, getTokenBalance, getTokenAccountBalance, @@ -388,8 +404,6 @@ module.exports = { exportDexTVL, getProvider, getConnection, - getSaberPools, - getQuarryData, sumTokens2, getTokenBalances, transformBalances, @@ -398,7 +412,7 @@ module.exports = { getGeckoSolTokens, getTokenAccountBalances, getTokenList, - getSolTokenMap, readBigUInt64LE, decodeAccount, + getValidGeckoSolTokens, }; diff --git a/projects/helper/staking.js b/projects/helper/staking.js index e56449d9028..594ff8295c5 100644 --- a/projects/helper/staking.js +++ b/projects/helper/staking.js @@ -1,20 +1,26 @@ const sdk = require('@defillama/sdk'); -const getReserves = require('./abis/getReserves.json'); -const token0Abi = require('./abis/token0.json'); -const token1Abi = require('./abis/token1.json'); +const getReserves = 'function getReserves() view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast)' +const token0Abi = 'address:token0' +const token1Abi = 'address:token1' const { default: BigNumber } = require('bignumber.js'); const { getChainTransform, getFixBalances, } = require('./portedTokens') const { sumTokens2 } = require('../helper/unwrapLPs') -function staking(stakingContract, stakingToken, chain = "ethereum", transformedTokenAddress = undefined, decimals = undefined) { +function staking(stakingContract, stakingToken, _chain = "ethereum", transformedTokenAddress = undefined, decimals = undefined) { if (!Array.isArray(stakingContract)) stakingContract = [stakingContract] if (!Array.isArray(stakingToken)) stakingToken = [stakingToken] - return stakings(stakingContract, stakingToken, chain, transformedTokenAddress, decimals) + return stakings(stakingContract, stakingToken, _chain, transformedTokenAddress, decimals) } -function stakings(stakingContracts, stakingToken, chain = "ethereum", transformedTokenAddress = undefined, decimals = undefined) { - return async (timestamp, _ethBlock, {[chain]: block}) => { +function stakings(stakingContracts, stakingToken, _chain = "ethereum", transformedTokenAddress = undefined, decimals = undefined) { + return async (_, _b, cb, { chain, block } = {}) => { + + if (!chain) { + chain = _chain + block = cb[chain] + } + if (!Array.isArray(stakingToken)) stakingToken = [stakingToken] let transformAddress = transformedTokenAddress if (typeof transformedTokenAddress === 'string') transformAddress = i => transformedTokenAddress diff --git a/projects/helper/streamingHelper.js b/projects/helper/streamingHelper.js index 6d8f36a651e..0b440f0b24a 100644 --- a/projects/helper/streamingHelper.js +++ b/projects/helper/streamingHelper.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('./coreAssets.json') let stableTokens = ['USDC', 'USDT', 'DAI', 'WETH', 'WFTM', 'WGLMR', 'WBNB', 'WAVAX', 'JCHF', 'JEUR', 'WBTC', 'AGDAI', 'JPYC', 'MIMATIC', 'WXDAI', 'EURS', 'JGBP', 'CNT', 'USD+', 'AMUSDC', 'RAI', 'SLP', 'SDAM3CRV', 'AMDAI', 'TUSD', 'RAI', 'UNI-V2', 'SLP', 'ScUSDC', 'cUSDC', 'iDAI', 'FTM', 'yUSDC', 'cDAI', 'MATIC', 'UST', 'stETH', 'USD', 'mUSD', 'iUSDC', 'aDAI', 'AGEUR', 'BCT', 'WMATIC', @@ -15,68 +16,68 @@ function isWhitelistedToken(symbol, address, isVesting) { const stableTokenAddresses = [ // native token - '0x0000000000000000000000000000000000000000', + ADDRESSES.null, // metis - '0xEA32A96608495e54156Ae48931A7c20f0dcc1a21', - '0x12D84f1CFe870cA9C9dF9785f8954341d7fbb249', + ADDRESSES.metis.m_USDC, + ADDRESSES.metis.BUSD, // avax - '0xd586E7F844cEa2F87f50152665BCbc2C279D8d70', - '0xA7D7079b0FEaD91F3e65f86E8915Cb59c1a4C664', - '0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E', + ADDRESSES.avax.DAI, + ADDRESSES.avax.USDC_e, + ADDRESSES.avax.USDC, '0x0f577433Bf59560Ef2a79c124E9Ff99fCa258948', // xdai - '0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d', - '0x4ECaBa5870353805a9F068101A40E0f32ed605C6', + ADDRESSES.xdai.WXDAI, + ADDRESSES.xdai.USDT, '0x91f8490eC27cbB1b2FaEdd29c2eC23011d7355FB', // fantom - '0x8D11eC38a3EB5E956B052f67Da8Bdc9bef8Abf3E', + ADDRESSES.fantom.DAI, '0x6Fc9383486c163fA48becdEC79d6058f984f62cA', - '0x04068DA6C83AFCFA0e13ba15A6696662335D5B75', - '0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83', + ADDRESSES.fantom.USDC, + ADDRESSES.fantom.WFTM, // ethereum - '0x6B175474E89094C44Da98b954EedeAC495271d0F', - '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', - '0xdAC17F958D2ee523a2206206994597C13D831ec7', - '0x853d955aCEf822Db058eb8505911ED77F175b99e', + ADDRESSES.ethereum.DAI, + ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.USDT, + ADDRESSES.ethereum.FRAX, '0xe2f2a5C287993345a840Db3B0845fbC70f5935a5', - '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', + ADDRESSES.ethereum.WETH, // polygon - '0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063', - '0xc2132D05D31c914a87C6611C10748AEb04B58e8F', - '0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174', + ADDRESSES.polygon.DAI, + ADDRESSES.polygon.USDT, + ADDRESSES.polygon.USDC, '0xC2DbaAEA2EfA47EBda3E572aa0e55B742E408BF6', - '0x0000000000000000000000000000000000001010', + ADDRESSES.polygon.WMATIC_1, '0x4198A31A98dB56b48AEBa6103F7C23679B9794F3', // bsc '0x1AF3F329e8BE154074D8769D1FFa4eE058B1DBc3', - '0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56', - '0x55d398326f99059fF775485246999027B3197955', - '0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d', + ADDRESSES.bsc.BUSD, + ADDRESSES.bsc.USDT, + ADDRESSES.bsc.USDC, // arbitrum - '0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1', - '0x82aF49447D8a07e3bd95BD0d56f35241523fBab1', + ADDRESSES.optimism.DAI, + ADDRESSES.arbitrum.WETH, '0x662d0f9Ff837A51cF89A1FE7E0882a906dAC08a3', - '0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8', + ADDRESSES.arbitrum.USDC, '0x64343594Ab9b56e99087BfA6F2335Db24c2d1F17', - '0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9', + ADDRESSES.arbitrum.USDT, // optimism - '0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1', - '0x7F5c764cBc14f9669B88837ca1490cCa17c31607', + ADDRESSES.optimism.DAI, + ADDRESSES.optimism.USDC, // meter - '0x6ABAEDAB0Ba368F1DF52D857f24154CC76c8c972', - '0xD86e243FC0007e6226B07c9A50C9d70D78299EB5', - '0x24aA189DfAa76c671c279262F94434770F557c35', - '0x5Fa41671c48e3C951AfC30816947126CCC8C162e', + ADDRESSES.meter.MTR, + ADDRESSES.meter.USDC_eth, + ADDRESSES.meter.BUSD_bsc, + ADDRESSES.meter.USDT_eth, '0x687A6294D0D6d63e751A059bf1ca68E4AE7B13E2', ].map(i => i.toLowerCase()) diff --git a/projects/helper/sumTokens.js b/projects/helper/sumTokens.js index 2f8694ce48a..79e40ad52c8 100644 --- a/projects/helper/sumTokens.js +++ b/projects/helper/sumTokens.js @@ -1,12 +1,11 @@ const { ibcChains, getUniqueAddresses} = require('./tokenMapping') -const { log, } = require('./utils') const { get, post, } = require('./http') -const { sumTokens2: sumTokensEVM, } = require('./unwrapLPs') +const { sumTokens2: sumTokensEVM, nullAddress, } = require('./unwrapLPs') const sdk = require('@defillama/sdk') const helpers = { - "tron": require("./chain/tron"), "eos": require("./chain/eos"), + "ergo": require("./chain/ergo"), "elrond": require("./chain/elrond"), "cardano":require("./chain/cardano"), "algorand":require("./chain/algorand"), @@ -20,6 +19,7 @@ const helpers = { "litecoin":require("./chain/litecoin"), "polkadot":require("./chain/polkadot"), "hedera":require("./chain/hbar"), + "stacks":require("./chain/stacks"), } const geckoMapping = { @@ -41,18 +41,19 @@ async function getBalance(chain, account) { } function sumTokensExport(options) { - const {chain} = options - if (!chain) throw new Error('Missing chain info') - return async (timestamp, _b, {[chain]: block}) => sumTokens({ timestamp, block, ...options}) + return async (_, _b, _cb, { api }) => sumTokens({ ...api, api, ...options}) } async function sumTokens(options) { - let { chain, owner, owners = [], tokens = [], tokensAndOwners = [], blacklistedTokens = [], balances = {}, token, } = options + let { chain, owner, owners = [], tokens = [], tokensAndOwners = [], blacklistedTokens = [], balances = {}, token, api } = options + if (api && !specialChains.includes(chain)) { + chain = api.chain + } if (token) tokens = [token] if (owner) owners = [owner] - if (!helpers[chain] && !specialChains.includes(chain)) + if (!ibcChains.includes(chain) && !helpers[chain] && !specialChains.includes(chain)) return sumTokensEVM(options) owners = getUniqueAddresses(owners, chain) @@ -77,6 +78,7 @@ async function sumTokens(options) { if(helper) { switch(chain) { + case 'cardano': case 'solana': return helper.sumTokens2(options) case 'eos': return helper.get_account_tvl(owners, tokens, 'eos') case 'tezos': options.includeTezos = true; break; @@ -105,6 +107,7 @@ async function getRippleBalance(account) { } module.exports = { + nullAddress, sumTokensExport, sumTokens, } diff --git a/projects/helper/sushi-trident.js b/projects/helper/sushi-trident.js index eaaae933a1d..41f35e8d6ec 100644 --- a/projects/helper/sushi-trident.js +++ b/projects/helper/sushi-trident.js @@ -51,51 +51,9 @@ function getTridentTVL({ chain, factory}) { // taken from https://github.com/pangea-protocol/pangea-core/tree/main/deployments/abis const abis = { - totalPoolsCount: { - "inputs": [], - "name": "totalPoolsCount", - "outputs": [ - { - "internalType": "uint256", - "name": "total", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - getPoolAddress: { - "inputs": [ - { - "internalType": "uint256", - "name": "idx", - "type": "uint256" - } - ], - "name": "getPoolAddress", - "outputs": [ - { - "internalType": "address", - "name": "pool", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - getAssets: { - "inputs": [], - "name": "getAssets", - "outputs": [ - { - "internalType": "address[]", - "name": "assets", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, + totalPoolsCount: "uint256:totalPoolsCount", + getPoolAddress: "function getPoolAddress(uint256 idx) view returns (address pool)", + getAssets: "address[]:getAssets", } module.exports = { diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 22d0cb52b5c..6a5f2c0bd91 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -1,6 +1,8 @@ +let coreAssets = require('./coreAssets.json') +const ADDRESSES = coreAssets +const nullAddress = ADDRESSES.null -const coreAssets = require('./coreAssets.json') -const nullAddress = '0x0000000000000000000000000000000000000000' +coreAssets = JSON.parse(JSON.stringify(coreAssets)) // Multichain bridge info: https://bridgeapi.anyswap.exchange/v2/serverInfo/all // IBC info - https://github.com/PulsarDefi/IBC-Cosmos/blob/main/ibc_data.json @@ -11,1343 +13,45 @@ const nullAddress = '0x0000000000000000000000000000000000000000' // Alexar info: https://api.axelarscan.io/cross-chain/tvl // coingecko coins: https://api.coingecko.com/api/v3/coins/list?include_platform=true // gravity bridge for IBC: https://api.mintscan.io/v2/assets/gravity-bridge +// carbon: https://api-insights.carbon.network/info/denom_gecko_map +// orbit brige: https://bridge.orbitchain.io/open/v1/api/monitor/rawTokenList -const unsupportedGeckoChains = ['aptos', 'terra2', 'terra', 'kujira'] -const ibcChains = ['terra', 'terra2', 'crescent', 'osmosis', 'kujira', 'stargaze', 'juno', 'injective', 'cosmos', ] -const caseSensitiveChains = [...ibcChains, 'solana', 'tezos', 'algorand', 'aptos', 'near', 'bitcoin', 'waves', 'tron', 'litecoin', 'polkadot', 'ripple', 'elrond', ] +const ibcChains = ['ibc', 'terra', 'terra2', 'crescent', 'osmosis', 'kujira', 'stargaze', 'juno', 'injective', 'cosmos', 'comdex', 'stargaze', 'umee', 'orai', 'persistence', 'fxcore', 'neutron', 'quasar', 'chihuahua',] +const caseSensitiveChains = [...ibcChains, 'solana', 'tezos', 'ton', 'algorand', 'aptos', 'near', 'bitcoin', 'waves', 'tron', 'litecoin', 'polkadot', 'ripple', 'elrond', 'cardano', 'stacks', 'sui', 'ergo',] -const tokens = { - null: nullAddress, - solana: 'solana:So11111111111111111111111111111111111111112', - dai: 'ethereum:0x6b175474e89094c44da98b954eedeac495271d0f', - usdt: 'ethereum:0xdac17f958d2ee523a2206206994597c13d831ec7', - usdc: 'ethereum:0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', - ethereum: 'ethereum:' + nullAddress, - weth: 'ethereum:0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', - busd: 'bsc:0xe9e7cea3dedca5984780bafc599bd69add087d56', - bsc: 'bsc:' + nullAddress, - bnb: 'bsc:0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c', - link: 'ethereum:0x514910771af9ca656af840dff83e8264ecf986ca', - wbtc: 'ethereum:0x2260fac5e5542a773aa44fbcfedf7c193bc2c599', -} -const tokensBare = {} -for (const [label, value] of Object.entries(tokens)) - tokensBare[label] = value.split(':')[1] +const distressedAssts = new Set(Object.values({ + CRK: '0x065de42e28e42d90c2052a1b49e7f83806af0e1f', + aBNBc: ADDRESSES.bsc.ankrBNB, + aBNBb: ADDRESSES.bsc.aBNBb, + XRPC: '0xd4ca5c2aff1eefb0bea9e9eab16f88db2990c183', + YAKU: 'NGK3iHqqQkyRZUj4uhJDQqEyKKcZ7mdawWpqwMffM3s' +}).map(i => i.toLowerCase())) const transformTokens = { ethereum: { - "0xFEEf77d3f69374f66429C91d732A244f074bdf74": "0x3432b6a60d23ca0dfca7761b7ab56459d9c964d0", // CVX FXS token - "0xb8c77482e45f1f44de1745f52c74426c631bdd52": tokens.bnb, // BNB - "0xeb637a9ab6be83c7f8c79fdaa62e1043b65534f0": "heco:0xcbd6cb9243d8e3381fea611ef023e17d1b7aedf0", // BXH - "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee": tokens.ethereum, // ETH -> WETH - "0x18084fbA666a33d37592fA2633fD49a74DD93a88": "0x8dAEBADE922dF735c38C80C7eBD708Af50815fAa", //tBTC - "0xef779cf3d260dbe6177b30ff08b10db591a6dd9c": "0x0000000000085d4780B73119b644AE5ecd22b376", // kUSD - "0x42ef9077d8e79689799673ae588e046f8832cb95": "0x0000000000085d4780B73119b644AE5ecd22b376", //fUSD - "0xd3d13a578a53685b4ac36a1bab31912d2b2a2f36": tokens.ethereum, // tWETH - "0x94671a3cee8c7a12ea72602978d1bb84e920efb2": "0x853d955aCEf822Db058eb8505911ED77F175b99e", // tFRAX - "0x2fc6e9c1b2c07e18632efe51879415a580ad22e1": "0x6bea7cfef803d1e3d5f7c0103f7ded065644e197", // tGAMMA - "0xeff721eae19885e17f5b80187d6527aad3ffc8de": "0xc011a73ee8576fb46f5e1c5751ca3b9fe0af2a6f", // tSNX - "0xdc0b02849bb8e0f126a216a2840275da829709b0": "0x4104b135dbc9609fc1a9490e61369036497660c8", // tAPW - "0x15a629f0665a3eb97d7ae9a7ce7abf73aeb79415": "0x9C4A4204B79dd291D6b6571C5BE8BbcD0622F050", // tTCR - "0x808d3e6b23516967ceae4f17a5f9038383ed5311": "0xc770EEfAd204B5180dF6a14Ee197D99d808ee52d", // tFOX - "0xf49764c9c5d644ece6ae2d18ffd9f1e902629777": "0x6B3595068778DD592e39A122f4f5a5cF09C90fE2", // tSUSHI - "0xd3b5d9a561c293fb42b446fe7e237daa9bf9aa84": "0xdBdb4d16EdA451D0503b854CF79D55697F90c8DF", // tALCX - "0xadf15ec41689fc5b6dca0db7c53c9bfe7981e655": "0x3432B6A60D23Ca0dFCa7761B7ab56459D9C964D0", // tFXS - "0xc7d9c108d4e1dd1484d3e2568d7f74bfd763d356": "0x0000000000085d4780B73119b644AE5ecd22b376", // XSTUSD - "0x65f7ba4ec257af7c55fd5854e5f6356bbd0fb8ec": "0x92d6c1e31e14520e676a687f0a93788b716beff5", // sDYDX - "0x0a5e677a6a24b2f1a2bf4f3bffc443231d2fdec8": "bsc:0xb5102cee1528ce2c760893034a4603663495fd72", // USX - "0x2163383C1F4E74fE36c50E6154C7F18d9Fd06d6f": "avax:0x75739a693459f33b1fbcc02099eea3ebcf150cbe", // Elasticswap token - "0x36f8d0d0573ae92326827c4a82fe4ce4c244cab6": "ethereum:0x028171bCA77440897B824Ca71D1c56caC55b68A3", // Morpho-Aave Dai Stablecoin - }, - fantom: { - // WFTM && FTM - "0xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx": "0x4e15361fd6b4bb609fa63c81a2be19d873717870", - "0x658b0c7613e890ee50b8c4bc6a3f41ef411208ad": tokens.ethereum, // fETH - // moo tokens - "0xbf07093ccd6adfc3deb259c557b61e94c1f66945": "fantom:0xd6070ae98b8069de6b494332d1a1a81b6179d960", - "0x0a03d2c1cfca48075992d810cc69bd9fe026384a": tokens.ethereum, - "0x97927abfe1abbe5429cbe79260b290222fc9fbba": tokens.wbtc, - "0x6dfe2aaea9daadadf0865b661b53040e842640f8": tokens.link, - "0x920786cff2a6f601975874bb24c63f0115df7dc8": tokens.dai, - "0x49c68edb7aebd968f197121453e41b8704acde0c": "fantom:0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83", - // update below to binspirit when it lists on coingecko - "0x7345a537a975d9ca588ee631befddfef34fd5e8f": "fantom:0x5Cc61A78F164885776AA610fb0FE1257df78E59B", - - "0xdbf31df14b66535af65aac99c32e9ea844e14501": "0xeb4c2781e4eba804ce9a9803c67d0893436bb27d", // RenBTC - "0x4a89338a2079a01edbf5027330eac10b615024e5": "fantom:0xad84341756bf337f5a0164515b1f6f993d194e1f", // USDL - "0xc0d9784fdba39746919bbf236eb73bc015fd351d": "fantom:0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83", // FTML - "0xe3a486c1903ea794eed5d5fa0c9473c7d7708f40": "fantom:0xad84341756bf337f5a0164515b1f6f993d194e1f", // cUSD (revenent finance) - "0x8cc97b50fe87f31770bcdcd6bc8603bc1558380b": "cronos:0x0804702a4e749d39a35fde73d1df0b1f1d6b8347", // single - "0x95bf7e307bc1ab0ba38ae10fc27084bc36fcd605": tokens.usdc, - "0xc5cd01e988cd0794e05ab80f2bcdbdf13ce08bd3": tokens.usdc, // nUSD -> USDC - "0x7f620d7d0b3479b1655cefb1b0bc67fb0ef4e443": "fantom:0xf16e81dce15b08f326220742020379b855b87df9", // nICE -> ICE - }, - csc: { - [nullAddress]: 'ethereum:0x081f67afa0ccf8c7b17540767bbe95df2ba8d97f', - '0xE6f8988d30614afE4F7124b76477Add79c665822': 'ethereum:0x081f67afa0ccf8c7b17540767bbe95df2ba8d97f', - }, - avax: { - "0xaf2c034c764d53005cc6cbc092518112cbd652bb": "avax:0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7", - "0x9dEbca6eA3af87Bf422Cea9ac955618ceb56EfB4": "avax:0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7", - "0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7": "avax:0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7", - "0x57319d41f71e81f3c65f2a47ca4e001ebafd4f33": "avax:0x6e84a6216ea6dacc71ee8e6b0a5b7322eebc0fdd", - "0xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx": "avax:0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7", - "0x574679ec54972cf6d705e0a71467bb5bb362919d": "avax:0x5817d4f0b62a59b17f75207da1848c2ce75e7af4", - "0x2f28add68e59733d23d5f57d94c31fb965f835d0": tokens.usdc, // sUSDC(Avalanche) -> USDC(Ethereum) - "0xf04d3a8eb17b832fbebf43610e94bdc4fd5cf2dd": tokens.busd, // sBUSD(Avalanche) -> BUSD(BSC) - "0x1b156c5c75e9df4caab2a5cc5999ac58ff4f9090": "avax:0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7", - "0xd795d70ec3c7b990ffed7a725a18be5a9579c3b9": "avax:0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e", - "0xb6767518b205ea8b312d2ef4d992a2a08c2f2416": "avax:0xc7198437980c041c805a1edcba50c1ce5db95118", - "0xaf9f33df60ca764307b17e62dde86e9f7090426c": "avax:0xd586e7f844cea2f87f50152665bcbc2c279d8d70", - "0x808d5f0a62336917da14fa9a10e9575b1040f71c": "avax:0x60781c2586d68229fde47564546784ab3faca982", - "0x0665ef3556520b21368754fb644ed3ebf1993ad4": "0x6c3f90f043a72fa612cbac8115ee7e52bde6e490", - // update below to binspirit when it lists on coingecko - "0x90a424754ad0d72cebd440faba18cdc362bfe70a": "heco:0xcbd6cb9243d8e3381fea611ef023e17d1b7aedf0", // BXH - }, - bsc: { - "0x0000000000000000000000000000000000000000": tokens.bnb, // BNB -> WBNB - "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee": tokens.bnb, // BNB -> WBNB - "0xb7f8cd00c5a06c0537e2abff0b58033d02e5e094": "0x8e870d67f660d95d5be530380d0ec0bd388289e1", // PAX - "0xa35d95872d8eb056eb2cbd67d25124a6add7455e": "0x123", // 2030FLOKI returns nonsense TVL - "0x6ded0f2c886568fb4bb6f04f179093d3d167c9d7": "0x09ce2b746c32528b7d864a1e3979bd97d2f095ab", // DFL - "0x2f28add68e59733d23d5f57d94c31fb965f835d0": tokens.usdc, // sUSDC(BSC) -> USDC(Ethereum) - "0xce86f7fcd3b40791f63b86c3ea3b8b355ce2685b": "0xb4d930279552397bba2ee473229f89ec245bc365", // MahaDao - "0xbb9858603b1fb9375f6df972650343e985186ac5": "bsc:0xc087c78abac4a0e900a327444193dbf9ba69058e", // Treat staked BUSD-USDC Staked APE-LP as LP Token - "0xc5fb6476a6518dd35687e0ad2670cb8ab5a0d4c5": "bsc:0x2e707261d086687470b515b320478eb1c88d49bb", // Treat staked BUSD-USDT Staked APE-LP as LP Token - "0x532197ec38756b9956190b845d99b4b0a88e4ca9": "0x1614f18fc94f47967a3fbe5ffcd46d4e7da3d787", // PAID - "0x6d1b7b59e3fab85b7d3a3d86e505dd8e349ea7f3": "heco:0xcbd6cb9243d8e3381fea611ef023e17d1b7aedf0", // BXH - "0x42586ef4495bb512a86cf7496f6ef85ae7d69a64": "polygon:0x66e8617d1df7ab523a316a6c01d16aa5bed93681", // SPICE - "0x60d01ec2d5e98ac51c8b4cf84dfcce98d527c747": "0x9ad37205d608b8b219e6a2573f922094cec5c200", // iZi - "0x0a3bb08b3a15a19b4de82f8acfc862606fb69a2d": "0x0a3bb08b3a15a19b4de82f8acfc862606fb69a2d", // iUSD - "0xa8bb71facdd46445644c277f9499dd22f6f0a30c": tokens.bnb, //beltBNB -> wbnb - "0x9cb73f20164e399958261c289eb5f9846f4d1404": "bsc:0x55d398326f99059ff775485246999027b3197955", // 4belt -> usdt - "0x51bd63f240fb13870550423d208452ca87c44444": "bsc:0x7130d2a12b9bcbfae4f2634d864a1ee1ce3ead9c", //beltBTC-> - "0xaa20e8cb61299df2357561c2ac2e1172bc68bc25": "bsc:0x2170ed0880ac9a755fd29b2688956bd959f933f8", //beltETH-> - "0x13ab6739368a4e4abf24695bf52959224367391f": "0x25f8087ead173b73d6e8b84329989a8eea16cf73", //YGG - // ib tokens - "0xd7d069493685a581d27824fc46eda46b7efc0063": tokens.bnb, //ibBNB - "0x7c9e73d4c71dae564d41f78d56439bb4ba87592f": tokens.busd, //ibBUSD - "0x158da805682bdc8ee32d52833ad41e74bb951e59": tokens.busd, //ibUSDT - "0x08fc9ba2cac74742177e0afc3dc8aed6961c24e7": "bsc:0x7130d2a12b9bcbfae4f2634d864a1ee1ce3ead9c", //ibBTCB - "0xbff4a34a4644a113e8200d7f1d79b3555f723afe": tokens.ethereum, //ibETH - "0x3282d2a151ca00bfe7ed17aa16e42880248cd3cd": "0x0000000000085d4780b73119b644ae5ecd22b376", //ibTUSD - "0xf1be8ecc990cbcb90e166b71e368299f0116d421": "bsc:0x8f0528ce5ef7b51152a59745befdd91d97091d2f", //ibALPACA - // "0x250632378E573c6Be1AC2f97Fcdf00515d0Aa91B": tokens.ethereum, // BETH->WETH - }, - polygon: { - "0x60d01ec2d5e98ac51c8b4cf84dfcce98d527c747": "0x9ad37205d608b8b219e6a2573f922094cec5c200", // IZI - "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee": "0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0", // - "0x2f28add68e59733d23d5f57d94c31fb965f835d0": tokens.usdc, // sUSDC(Polygon) -> USDC(Ethereum) - "0x9fffb2f49adfc231b44ddcff3ffcf0e81b06430a": tokens.dai, // moUSD(Polygon) -> DAI - "0xf04d3a8eb17b832fbebf43610e94bdc4fd5cf2dd": tokens.busd, // sBUSD(Polygon) -> BUSD(BSC) - "0x8eb3771a43a8c45aabe6d61ed709ece652281dc9": "avax:0xA7D7079b0FEaD91F3e65f86E8915Cb59c1a4C664", // sUSDC.e(Polygon) -> USDC.e(Avalanche) - "0x1ddcaa4ed761428ae348befc6718bcb12e63bfaa": tokens.usdc, // deUSDC - "0x794baab6b878467f93ef17e2f2851ce04e3e34c8": "0x794baab6b878467f93ef17e2f2851ce04e3e34c8", // Yin - "0x282d8efce846a88b159800bd4130ad77443fa1a1": "0x967da4048cd07ab37855c090aaf366e4ce1b9f48", //ocean - "0x769434dca303597c8fc4997bf3dab233e961eda2": "0x70e8de73ce538da2beed35d14187f6959a8eca96", // xSGD - "0x6d3cC56DFC016151eE2613BdDe0e03Af9ba885CC": "0x00000100F2A2bd000715001920eB70D229700085", // wTCAD - "0xe4F7761b541668f88d04fe9F2E9DF10CA613aEf7": "0x00006100F7090010005F1bd7aE6122c3C2CF0090", // wTAUD - "0x81A123f10C78216d32F8655eb1A88B5E9A3e9f2F": "0x00000000441378008ea67f4284a57932b1c000a5", // wTGBP - "0xf826a91e8de52bc1baf40d88203e572dc2551aa3": "bsc:0x6421531af54c7b14ea805719035ebf1e3661c44a", // LEO - "0x28cead9e4ff96806c79f4189ef28fc61418e2216": "bsc:0x1633b7157e7638c4d6593436111bf125ee74703f", // SPS - }, - xdai: { - "0x0000000000000000000000000000000000000000": tokens.dai, - }, - okexchain: { - "0xe1c110e1b1b4a1ded0caf3e42bfbdbb7b5d7ce1c": "avax:0xe1c110e1b1b4a1ded0caf3e42bfbdbb7b5d7ce1c" - }, - heco: { - "0xb6f4c418514dd4680f76d5caa3bb42db4a893acb": "bsc:0x250632378e573c6be1ac2f97fcdf00515d0aa91b", - "0xhecozzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz": "0x6f259637dcd74c767781e37bc6133cd6a68aa161", - "0xe1c110e1b1b4a1ded0caf3e42bfbdbb7b5d7ce1c": "avax:0xe1c110e1b1b4a1ded0caf3e42bfbdbb7b5d7ce1c", - "0x3D760a45D0887DFD89A2F5385a236B29Cb46ED2a": tokens.dai, - "0x9362Bbef4B8313A8Aa9f0c9808B80577Aa26B73B": tokens.usdc, - "0xCe0A5CA134fb59402B723412994B30E02f083842": "0xc00e94cb662c3520282e6f5717214004a7f26888", - "0x1Ee8382bE3007Bd9249a89f636506284DdEf6Cc0": "0x35a532d376ffd9a705d0bb319532837337a398e7", - "0x40280e26a572745b1152a54d1d44f365daa51618": "bsc:0xba2ae424d960c26247dd6c32edc70b295c744c43", - "0x5ee41ab6edd38cdfb9f6b4e6cf7f75c87e170d98": "0x0000000000085d4780b73119b644ae5ecd22b376", - "0xA2F3C2446a3E20049708838a779Ff8782cE6645a": "bsc:0x1d2f0da169ceb9fc7b3144628db156f3f6c60dbe", // XRP - "0x843Af718EF25708765a8E0942F89edEae1D88DF0": "bsc:0x3ee2200efb3400fabb9aacf31297cbdd1d435d47" // ADA - }, - harmony: { - "0xa9ce83507d872c5e1273e745abcfda849daa654f": "harmony:0xa9ce83507d872c5e1273e745abcfda849daa654f", - "0xb12c13e66ade1f72f71834f2fc5082db8c091358": "avax:0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7", //avax - "0xed0b4b0f0e2c17646682fc98ace09feb99af3ade": "0x123", // RVRS has rubbish price, setting it as 0 - "0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1": tokens.dai // DAI - }, - optimism: { - "0x121ab82b49B2BC4c7901CA46B8277962b4350204": tokens.ethereum, // synapse WETH -> WETH - "0x35D48A789904E9b15705977192e5d95e2aF7f1D3": "0x956f47f50a910163d8bf957cf5846d573e7f87ca", // FEI - "0x67CCEA5bb16181E7b4109c9c2143c24a1c2205Be": "0x3432b6a60d23ca0dfca7761b7ab56459d9c964d0", // FRAX Share - "0x2E3D870790dC77A83DD1d18184Acc7439A53f475": "0x853d955acef822db058eb8505911ed77f175b99e", // FRAX - "0x0b5740c6b4a97f90eF2F0220651Cca420B868FfB": "0x0ab87046fbb341d058f17cbc4c1133f25a20a52f", // gOHM - - // optimismSynths - "0xc5db22719a06418028a40a9b5e9a7c02959d0d08": "0xbbc455cb4f1b9e4bfc4b73970d360c8f032efee6", - "0x298b9b95708152ff6968aafd889c6586e9169f1d": "0xfe18be6b3bd88a2d2a7f928d00292e7a9963cfc6" - }, - moonriver: { - "0xe1c110e1b1b4a1ded0caf3e42bfbdbb7b5d7ce1c": "avax:0xe1c110e1b1b4a1ded0caf3e42bfbdbb7b5d7ce1c", - "0xE3C7487Eb01C74b73B7184D198c7fBF46b34E5AF": "moonriver:0x98878B06940aE243284CA214f92Bb71a2b032B8A", - }, - moonbeam: { - '0x322E86852e492a7Ee17f28a78c663da38FB33bfb': '0x853d955aCEf822Db058eb8505911ED77F175b99e', // frax - '0x8f552a71EFE5eeFc207Bf75485b356A0b3f01eC9': tokens.usdc, // usdc.mad - '0x8e70cD5B4Ff3f62659049e74b6649c6603A0E594': tokens.usdc, // usdt.mad - '0x1DC78Acda13a8BC4408B207c9E48CDBc096D95e0': tokens.wbtc, // wtbc.mad - '0xc234A67a4F840E61adE794be47de455361b52413': tokens.dai, // dai.mad - '0x1d4C2a246311bB9f827F4C768e277FF5787B7D7E': 'moonriver:0x98878b06940ae243284ca214f92bb71a2b032b8a', // movr - '0x0000000000000000000000000000000000000000': 'moonbeam:0xacc15dc74880c9944775448304b263d191c6077f', // GLMR -> WGLMR - '0x5f6c5C2fB289dB2228d159C69621215e354218d7': 'moonbeam:0xacc15dc74880c9944775448304b263d191c6077f', // GLMR -> WGLMR - '0x931715FEE2d06333043d11F658C8CE934aC61D0c': tokens.usdc, // usdc.wh - '0xFFFFFFfFea09FB06d082fd1275CD48b191cbCD1d': tokens.usdc, // xc usdt (native) - '0xab3f0245B83feB11d15AAffeFD7AD465a59817eD': tokens.ethereum, // eth.wh - '0xE57eBd2d67B462E9926e04a8e33f01cD0D64346D': tokens.wbtc, // wtbc.wh - '0x692C57641fc054c2Ad6551Ccc6566EbA599de1BA': '0x4Fabb145d64652a948d72533023f6E7A623C7C53', // busd.wh - }, - arbitrum: { - "0x09ad12552ec45f82be90b38dfe7b06332a680864": "polygon:0xc3fdbadc7c795ef1d6ba111e06ff8f16a20ea539", // ADDy - "0xDBf31dF14B66535aF65AaC99C32e9eA844e14501": "0xeb4c2781e4eba804ce9a9803c67d0893436bb27d", // renBTC - "0x9ef758ac000a354479e538b8b2f01b917b8e89e7": "polygon:0x3dc7b06dd0b1f08ef9acbbd2564f8605b4868eea", // XDO - "0x31635A2a3892dAeC7C399102676E344F55d20Da7": "0x09ce2b746c32528b7d864a1e3979bd97d2f095ab", // DeFIL - "0x4a717522566c7a09fd2774ccedc5a8c43c5f9fd2": "0x956f47f50a910163d8bf957cf5846d573e7f87ca", // FEI - "0x2913e812cf0dcca30fb28e6cac3d2dcff4497688": tokens.dai, // nUSD - "0x61a1ff55c5216b636a294a07d77c6f4df10d3b56": "0x52a8845df664d76c69d2eea607cd793565af42b8", // APEX - }, - fuse: { - "0x0000000000000000000000000000000000000000": "0x970b9bb2c0444f5e81e9d0efb84c8ccdcdcaf84d", // FUSE - "0x0be9e53fd7edac9f859882afdda116645287c629": "0x970b9bb2c0444f5e81e9d0efb84c8ccdcdcaf84d", // FUSE - "0x620fd5fa44BE6af63715Ef4E65DDFA0387aD13F5": tokens.usdc, // USDC - "0x94Ba7A27c7A95863d1bdC7645AC2951E0cca06bA": tokens.dai, // DAI - "0xFaDbBF8Ce7D5b7041bE672561bbA99f79c532e10": tokens.usdc, // USDT - "0xa722c13135930332Eb3d749B2F0906559D2C5b99": tokens.ethereum, // WETH - "0x43b17749b246fd2a96de25d9e4184e27e09765b0": "0xdefa4e8a7bcba345f687a2f1456f5edd9ce97202" // KYC - }, - evmos: { - "0x51e44FfaD5C2B122C8b635671FCC8139dc636E82": tokens.usdc, // madUSDC - "0x8d395AfFC1767141387ffF45aF88a074614E7Ccf": "0x18084fba666a33d37592fa2633fd49a74dd93a88", // tBTCv2 - "0xb1a8C961385B01C3aA782fba73E151465445D319": "0xeb4c2781e4eba804ce9a9803c67d0893436bb27d", // renBTC - "0xe46910336479F254723710D57e7b683F3315b22B": tokens.usdc, // ceUSDC - "0x63743ACF2c7cfee65A5E356A4C4A005b586fC7AA": tokens.dai, // DAI - "0x7FF4a56B32ee13D7D4D405887E0eA37d61Ed919e": tokens.usdc, // madUSDT - "0xb72A7567847abA28A2819B855D7fE679D4f59846": tokens.usdc, // ceUSDT - "0x5842C5532b61aCF3227679a8b1BD0242a41752f2": tokens.ethereum, // WETH - "0xF80699Dc594e00aE7bA200c7533a07C1604A106D": tokens.wbtc, // WBTC - "0x28eC4B29657959F4A5052B41079fe32919Ec3Bd3": "0x853d955aCEf822Db058eb8505911ED77F175b99e", // madFRAX - "0xE03494D0033687543a80c9B1ca7D6237F2EA8BD8": "0x853d955aCEf822Db058eb8505911ED77F175b99e" // FRAX - }, - oasis: { - "0x3223f17957ba502cbe71401d55a0db26e5f7c68f": tokens.ethereum, //WETH - "0x4bf769b05e832fcdc9053fffbc78ca889acb5e1e": tokens.usdc, // USDT - "0x6cb9750a92643382e020ea9a170abb83df05f30b": tokens.usdc, // USDT - "0xdc19a122e268128b5ee20366299fc7b5b199c8e3": tokens.usdc, // USDT wormhole - "0x94fbffe5698db6f54d6ca524dbe673a7729014be": tokens.usdc, // USDC - }, - kcc: { - "0xe1c110e1b1b4a1ded0caf3e42bfbdbb7b5d7ce1c": "avax:0xe1c110e1b1b4a1ded0caf3e42bfbdbb7b5d7ce1c", - }, - metis: { - "0x0000000000000000000000000000000000000000": "0x9e32b13ce7f2e80a01932b42553652e053d6ed8e", // METIS - "0x75cb093e4d61d2a2e65d8e0bbb01de8d89b53481": "0x9e32b13ce7f2e80a01932b42553652e053d6ed8e", // METIS - "0x5801d0e1c7d977d78e4890880b8e579eb4943276": "bsc:0x5801d0e1c7d977d78e4890880b8e579eb4943276", - "0x2692be44a6e38b698731fddf417d060f0d20a0cb": tokens.bnb, - "0x12d84f1cfe870ca9c9df9785f8954341d7fbb249": tokens.busd, // bUSD - "0xE253E0CeA0CDD43d9628567d097052B33F98D611": "avax:0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7", // wAVAX - "0xa9109271abcf0c4106ab7366b4edb34405947eed": "fantom:0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83", // wFTM - "0x6aB6d61428fde76768D7b45D8BFeec19c6eF91A8": "bsc:0xad29abb318791d579433d831ed122afeaf29dcfe", - "0x4b9D2923D875edF43980BF5dddDEde3Fb20fC742": "bsc:0xcc42724c6683b7e57334c4e856f4c9965ed682bd", - "0x67c10c397dd0ba417329543c1a40eb48aaa7cd00": "0x0f2d719407fdbeff09d87557abb7232601fd9f29", //SYN - "0x226d8bfb4da78ddc5bd8fd6c1532c58e88f9fd34": "0xbc19712feb3a26080ebf6f2f7849b417fdd792ca", // BoringDAO - }, - boba: { - "0x0000000000000000000000000000000000000000": tokens.ethereum, // WETH - "0xd203De32170130082896b4111eDF825a4774c18E": tokens.ethereum, // synapse wETH - "0xf74195bb8a5cf652411867c5c2c5b8c2a402be35": tokens.dai, // DAI - "0x461d52769884ca6235B685EF2040F47d30C94EB5": tokens.busd, // BUSD - "0x7562f525106f5d54e891e005867bf489b5988cd9": "0x853d955acef822db058eb8505911ed77f175b99e", // FRAX - "0x2f28add68e59733d23d5f57d94c31fb965f835d0": tokens.usdc, // sUSDC(Boba) -> USDC(Ethereum) - "0xf04d3a8eb17b832fbebf43610e94bdc4fd5cf2dd": tokens.busd // sBUSD(Boba) -> BUSD(BSC) - }, - findora: { - "0xABc979788c7089B516B8F2f1b5cEaBd2E27Fd78b": tokens.bnb, // BNB token - "0x008A628826E9470337e0Cd9c0C944143A83F32f3": "bsc:0x2170ed0880ac9a755fd29b2688956bd959f933f8", // ETH token - "0x93EDFa31D7ac69999E964DAC9c25Cd6402c75DB3": "bsc:0x55d398326f99059ff775485246999027b3197955", // USDT token - "0xdA33eF1A7b48beBbF579eE86DFA735a9529C4950": "bsc:0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d", // USDC token - "0xE80EB4a234f718eDc5B76Bb442653827D20Ebb2d": tokens.busd, // BUSD token - "0x07EfA82E00E458ca3D53f2CD5B162e520F46d911": "bsc:0x7130d2a12b9bcbfae4f2634d864a1ee1ce3ead9c" // WBTC token - }, - milkomeda: { - "0x5950F9B6EF36f3127Ea66799e64D0ea1f5fdb9D1": tokens.ethereum, // WETH - "0x41eAFC40CD5Cb904157A10158F73fF2824dC1339": tokens.dai, // DAI - "0xab58DA63DFDd6B97EAaB3C94165Ef6f43d951fb2": tokens.usdc, // USDT - "0x48AEB7584BA26D3791f06fBA360dB435B3d7A174": tokens.wbtc, // WBTC - "0x42110A5133F91B49E32B671Db86E2C44Edc13832": tokens.usdc, // sUSDC(Milkomeda) -> USDC - }, - bittorrent: { - "0xdb28719f7f938507dbfe4f0eae55668903d34a15": tokens.usdc, // USDT - "0x935faa2fcec6ab81265b301a30467bbc804b43d3": tokens.usdc, // USDC - "0x8d193c6efa90bcff940a98785d1ce9d093d3dc8a": "0xc669928185dbce49d2230cc9b0979be6dc797957", // BTT - "0x17f235fd5974318e4e2a5e37919a209f7c37a6d1": "0x0c10bf8fcb7bf5412187a595ab97a3609160b5c6", // USDD - "0xae17940943ba9440540940db0f1877f101d39e8b": tokens.usdc, // USDC - "0x1249c65afb11d179ffb3ce7d4eedd1d9b98ad006": tokens.ethereum, // WETH - "0xe887512ab8bc60bcc9224e1c3b5be68e26048b8b": tokens.usdc, // USDT - "0xe467f79e9869757dd818dfb8535068120f6bcb97": "0xdefa4e8a7bcba345f687a2f1456f5edd9ce97202", // KNC - "0x9888221fe6b5a2ad4ce7266c7826d2ad74d40ccf": tokens.wbtc // WBTC - }, - klaytn: { - "0x5388ce775de8f7a69d17fd5caa9f7dbfee65dfce": "0x4576E6825B462b6916D2a41E187626E9090A92c6", // Donkey - "0x0268dbed3832b87582b1fa508acf5958cbb1cd74": "bsc:0xf258f061ae2d68d023ea6e7cceef97962785c6c1", // IJM - "0xd6dAb4CfF47dF175349e6e7eE2BF7c40Bb8C05A3": tokens.usdc, // USDT - "0x168439b5eebe8c83db9eef44a0d76c6f54767ae4": tokens.dai, // pUSD - "0xce40569d65106c32550626822b91565643c07823": tokens.dai, // KASH - "0x210bc03f49052169d5588a52c317f71cf2078b85": tokens.busd, // kBUSD - }, - nova: { - "0x0000000000000000000000000000000000000000": "fantom:0x69D17C151EF62421ec338a0c92ca1c1202A427EC", // SNT - "0x657a66332a65b535da6c5d67b8cd1d410c161a08": "fantom:0x69D17C151EF62421ec338a0c92ca1c1202A427EC", // SNT - "0x1f5396f254ee25377a5c1b9c6bff5f44e9294fff": "fantom:0x04068da6c83afcfa0e13ba15a6696662335d5b75", // USDC - }, - aurora: { - "0x0000000000000000000000000000000000000000": tokens.ethereum, // Aurora gas -> WETH - "0xda2585430fef327ad8ee44af8f1f989a2a91a3d2": "0x853d955aCEf822Db058eb8505911ED77F175b99e", // FRAX - "0x07379565cd8b0cae7c60dc78e7f601b34af2a21c": tokens.dai, // nUSD -> DAI - "0x42cc1cbf253f89be6814a0f59f745b40b69b6220": "polygon:0x2791bca1f2de4661ed88a30c99a7a9449aa84174", // sUSDC(Aurora) -> USDC(Polygon) - "0xd5e98caeb396dabe5a102bb9256b552944e3401f": tokens.busd, // sBUSD(Aurora) -> BUSD(BSC) - "0x274d83086C356E0cFc75933FBf838CA10A7E8274": tokens.ethereum, - }, - cronos: { - "0x87EFB3ec1576Dec8ED47e58B832bEdCd86eE186e": "0x0000000000085d4780B73119b644AE5ecd22b376", - }, - velas: { - "0xe41c4324dCbD2926481101f8580D13930AFf8A75": "velas:0xc579D1f3CF86749E05CD06f7ADe17856c2CE3126", // WVLX - "0xc9b3aA6E91d70f4ca0988D643Ca2bB93851F3de4": "fantom:0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83", // FTM - "0x300a8be53b4b5557f48620d578e7461e3b927dd0": "0xf56842af3b56fd72d17cb103f92d027bba912e89", // BAMBOO - "0x9b6fbF0ea23faF0d77B94d5699B44062e5E747Ac": "bsc:0xd522a1dce1ca4b138dda042a78672307eb124cc2", // SWAPZ - "0x8d9fB713587174Ee97e91866050c383b5cEE6209": "bsc:0x8d9fb713587174ee97e91866050c383b5cee6209" // SCAR - }, - telos: { - "0x0000000000000000000000000000000000000000": "0xdeaddeaddeaddeaddeaddeaddeaddeaddead0000", // WETH - "0x017043607270ecbb440e20b0f0bc5e760818b3d8": tokens.busd, // sBUSD(Aurora) -> BUSD(BSC) - }, - reichain: { - "0xDD2bb4e845Bd97580020d8F9F58Ec95Bf549c3D9": tokens.busd, // killswitch busd -> busd token - "0xf8ab4aaf70cef3f3659d3f466e35dc7ea10d4a5d": tokens.bnb // killswitch bnb -> bnb token - }, - solana: { - "9EaLkQrbjmbbuZG9Wdpo8qfNUEjHATJFSycEmw6f1rGX": tokens.solana, - }, + '0xe0b469cb3eda0ece9e425cfeda4df986a55ea9f8': ADDRESSES.ethereum.WETH, + [ADDRESSES.ethereum.vlCVX]: ADDRESSES.ethereum.CVX, + }, + // Sample Code + // cronos: { + // "0x065de42e28e42d90c2052a1b49e7f83806af0e1f": "0x123", // CRK token is mispriced + // [ADDRESSES.cronos.TUSD]: ADDRESSES.ethereum.TUSD, + // }, } - const ibcMappings = { - // from crescent - 'ibc/CA1261224952DF089EFD363D8DBB30A8AB6D8CD181E60EE9E68E432F8DE14FE3': { coingeckoId: 'inter-stable-token', decimals: 6, }, - 'ibc/5A76568E079A31FA12165E4559BA9F1E9D4C97F9C2060B538C84DCD503815E30': { coingeckoId: 'injective-protocol', decimals: 18, }, - "ibc/6F4968A73F90CF7DE6394BF937D6DF7C7D162D74D839C13F53B41157D315E05F": { coingeckoId: "terrausd", decimals: 6, }, - "ibc/C4CFF46FD6DE35CA4CF4CE031E643C8FDC9BA4B99AE598E9B0ED98FE3A2319F9": { coingeckoId: "cosmos", decimals: 6, }, - "ibc/4627AD2524E3E0523047E35BB76CC90E37D9D57ACF14F0FCBCEB2480705F3CB8": { coingeckoId: "terra-luna", decimals: 6, }, - "ibc/C950356239AD2A205DE09FDF066B1F9FF19A7CA7145EA48A5B19B76EE47E52F7": { coingeckoId: "graviton", decimals: 6, }, - "ibc/DBF5FA602C46392DE9F4796A0FC7D02F3A8A3D32CA3FAA50B761D4AA6F619E95": { coingeckoId: "gravity-bridge-weth", decimals: 18, }, - "ibc/CD01034D6749F20AAC5330EF4FD8B8CA7C40F7527AB8C4A302FBD2A070852EE1": { coingeckoId: "gravity-bridge-usdc", decimals: 6, }, - "ibc/F1806958CA98757B91C3FA1573ECECD24F6FA3804F074A6977658914A49E65A3": { coingeckoId: "axlweth", decimals: 18, }, - "ibc/BFF0D3805B50D93E2FA5C0B2DDF7E0B30A631076CD80BC12A48C0E95404B4A41": { coingeckoId: "axlusdc", decimals: 6, }, - "ibc/11F940BCDFD7CFBFD7EDA13F25DA95D308286D441209D780C9863FD4271514EB": { coingeckoId: "agoric", decimals: 6, }, - // - "ibc/295548A78785A1007F232DE286149A6FF512F180AF5657780FC89C009E2C348F": { coingeckoId: "axlusdc", decimals: 6, }, - 'ibc/27394FB092D2ECCD56123C74F36E4C1F926001CEADA9CA97EA622B25F41E5EB2': { coingeckoId: 'cosmos', decimals: 6, }, - 'ibc/799FDD409719A1122586A629AE8FCA17380351A51C1F47A80A1B8E7F2A491098': { coingeckoId: 'akash-network', decimals: 6, }, - 'ibc/B8AF5D92165F35AB31F3FC7C7B444B9D240760FA5D406C49D24862BD0284E395': { coingeckoId: 'terra-luna', decimals: 6, }, - 'ibc/DA59C009A0B3B95E0549E6BF7B075C8239285989FF457A8EDDBB56F10B2A6986': { coingeckoId: 'terra-luna', decimals: 6, }, - 'ibc/0471F1C4E7AFD3F07702BEF6DC365268D64570F7C1FDC98EA6098DD6DE59817B': { coingeckoId: 'osmosis', decimals: 6, }, - 'ibc/47BD209179859CDE4A2806763D7189B6E6FE13A17880FE2B42DE1E6C1E329E23': { coingeckoId: 'osmosis', decimals: 6, }, - 'ibc/F3AA7EF362EC5E791FE78A0F4CCC69FEE1F9A7485EB1A8CAB3F6601C00522F10': { coingeckoId: 'evmos', decimals: 18, }, - 'ibc/EFF323CC632EC4F747C61BCE238A758EFDB7699C3226565F7C20DA06509D59A5': { coingeckoId: 'juno-network', decimals: 6, }, - 'ibc/B448C0CA358B958301D328CCDC5D5AD642FC30A6D3AE106FF721DB315F3DDE5C': { coingeckoId: 'terrausd', decimals: 6, }, - 'ibc/A358D7F19237777AF6D8AD0E0F53268F8B18AE8A53ED318095C14D6D7F3B2DB5': { coingeckoId: 'secret', decimals: 6, }, - 'ibc/1B38805B1C75352B28169284F96DF56BDEBD9E8FAC005BDCC8CF0378C82AA8E7': { coingeckoId: 'ethereum', decimals: 18, }, - 'ibc/4F393C3FCA4190C0A6756CE7F6D897D5D1BE57D6CCB80D0BC87393566A7B6602': { coingeckoId: 'stargaze', decimals: 6, }, - 'ibc/987C17B11ABC2B20019178ACE62929FE9840202CE79498E29FE8E5CB02B7C0A4': { coingeckoId: 'stargaze', decimals: 6, }, - 'ibc/3607EB5B5E64DD1C0E12E07F077FF470D5BC4706AFCBC98FE1BA960E5AE4CE07': { coingeckoId: 'comdex', decimals: 6, }, - 'ibc/EA3E1640F9B1532AB129A571203A0B9F789A7F14BB66E350DCBFA18E1A1931F0': { coingeckoId: 'comdex', decimals: 6, }, - 'ibc/F2331645B9683116188EF36FC04A809C28BD36B54555E8705A37146D0182F045': { coingeckoId: 'tether', decimals: 6, }, - 'ibc/CBF67A2BCF6CAE343FDF251E510C8E18C361FC02B23430C121116E0811835DEF': { coingeckoId: 'tether', decimals: 6, }, - 'ibc/B3504E092456BA618CC28AC671A71FB08C6CA0FD0BE7C8A5B5A3E2DD933CC9E4': { coingeckoId: 'usd-coin', decimals: 6, }, - 'ibc/903A61A498756EA560B85A85132D3AEE21B5DEDD41213725D22ABF276EA6945E': { coingeckoId: 'axelar', decimals: 6, }, - 'ibc/C01154C2547F4CB10A985EA78E7CD4BA891C1504360703A37E1D7043F06B5E1F': { coingeckoId: 'axelar', decimals: 6, }, - // from injective - 'ibc/E7807A46C0B7B44B350DA58F51F278881B863EC4DCA94635DAB39E52C30766CB': { coingeckoId: 'chihuahua-token', decimals: 6, }, - 'ibc/16618B7F7AC551F48C057A13F4CA5503693FBFF507719A85BC6876B8BD75F821': { coingeckoId: 'evmos', decimals: 18, }, - 'ibc/B786E7CBBF026F6F15A8DA248E0F18C62A0F7A70CB2DABD9239398C8B5150ABB': { coingeckoId: 'persistence', decimals: 6, }, - 'ibc/624BA9DD171915A2B9EA70F69638B2CEA179959850C1A586F6C485498F29EDD4': { coingeckoId: 'polkadot', decimals: 10, }, - 'ibc/3FDD002A3A4019B05A33D324B2F29748E77AF501BEA5C96D1F28B2D6755F9F25': { coingeckoId: 'stride', decimals: 6, }, + // Sample Code + // 'ibc/CA1261224952DF089EFD363D8DBB30A8AB6D8CD181E60EE9E68E432F8DE14FE3': { coingeckoId: 'inter-stable-token', decimals: 6, }, + // 'ibc/5A76568E079A31FA12165E4559BA9F1E9D4C97F9C2060B538C84DCD503815E30': { coingeckoId: 'injective-protocol', decimals: 18, }, } const fixBalancesTokens = { - astar: { - [nullAddress]: { coingeckoId: "astar", decimals: 18, }, - "0xcdb32eed99aa19d39e5d6ec45ba74dc4afec549f": { coingeckoId: "orcus-oru", decimals: 18, }, - "0xc5bcac31cf55806646017395ad119af2441aee37": { coingeckoId: "muuu", decimals: 18, }, - "0x6df98e5fbff3041105cb986b9d44c572a43fcd22": { coingeckoId: "alnair-finance-nika", decimals: 18, }, - "0x29F6e49c6E3397C3A84F715885F9F233A441165C": { coingeckoId: "origin-dollar", decimals: 18, }, - "0xdd90e5e87a2081dcf0391920868ebc2ffb81a1af": { coingeckoId: "wmatic", decimals: 18, }, - "0x257f1a047948f73158dadd03eb84b34498bcdc60": { coingeckoId: "kagla-finance", decimals: 18, }, - "0xc4335b1b76fa6d52877b3046eca68f6e708a27dd": { coingeckoId: "starlay-finance", decimals: 18, }, - "0xde2578edec4669ba7f41c5d5d2386300bcea4678": { coingeckoId: "arthswap", decimals: 18, }, - "0x81ECac0D6Be0550A00FF064a4f9dd2400585FE9c": { coingeckoId: "ethereum", decimals: 18, }, - "0x7f27352d5f83db87a5a3e00f4b07cc2138d8ee52": { coingeckoId: "binancecoin", decimals: 18, }, - "0x75364D4F779d0Bd0facD9a218c67f87dD9Aff3b4": { coingeckoId: "shiden", decimals: 18, }, - "0xad543f18cff85c77e140e3e5e3c3392f6ba9d5ca": { coingeckoId: "bitcoin", decimals: 8, }, - "0x3795C36e7D12A8c252A20C5a7B455f7c57b60283": { coingeckoId: "tether", decimals: 6, }, - "0x430D50963d9635bBef5a2fF27BD0bDDc26ed691F": { coingeckoId: "tether", decimals: 6, }, - "0x19574c3c8fafc875051b665ec131b7e60773d2c9": { coingeckoId: "astar", decimals: 18, }, - "0xE511ED88575C57767BAfb72BfD10775413E3F2b0": { coingeckoId: "astar", decimals: 18, },// nASTR - "0xAeaaf0e2c81Af264101B9129C00F4440cCF0F720": { coingeckoId: "astar", decimals: 18, }, - "0xEcC867DE9F5090F55908Aaa1352950b9eed390cD": { coingeckoId: "astar", decimals: 18, }, - "0xb361DAD0Cc1a03404b650A69d9a5ADB5aF8A531F": { coingeckoId: "emiswap", decimals: 18, }, - "0xC404E12D3466acCB625c67dbAb2E1a8a457DEf3c": { coingeckoId: "usd-coin", decimals: 6, }, // interest bearing USDC - "0x6a2d262D56735DbA19Dd70682B39F6bE9a931D98": { coingeckoId: "usd-coin", decimals: 6, }, - "0x6De33698e9e9b787e09d3Bd7771ef63557E148bb": { coingeckoId: "dai", decimals: 18, }, - "0x4dd9c468A44F3FEF662c35c1E9a6108B70415C2c": { coingeckoId: "dai", decimals: 18, }, - "0xDBd71969aC2583A9A20Af3FB81FE9C20547f30F3": { coingeckoId: "dai", decimals: 18, }, // aBaiUsdc - "0x9914Bff0437f914549c673B34808aF6020e2B453": { coingeckoId: "dai", decimals: 18, }, // aDaiUsdc - "0x347e53263F8fb843EC605A1577eC7C8c0cAC7a58": { coingeckoId: "dai", decimals: 18, }, // aBusdUsdc - "0x02Dac4898B2c2cA9D50fF8D6a7726166CF7bCFD0": { coingeckoId: "dai", decimals: 18, }, // aUsdtUsdc - "0x4Bf769b05E832FCdc9053fFFBC78Ca889aCb5E1E": { coingeckoId: "binance-usd", decimals: 18, }, - "0xb7aB962c42A8Bb443e0362f58a5A43814c573FFb": { coingeckoId: "binance-usd", decimals: 18, }, - "0x733ebcC6DF85f8266349DEFD0980f8Ced9B45f35": { coingeckoId: "bai-stablecoin", decimals: 18, }, // BAI - "0x5271D85CE4241b310C0B34b7C2f1f036686A6d7C": { coingeckoId: "astriddao-token", decimals: 18, }, // ATID - "0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF": { coingeckoId: "polkadot", decimals: 10, }, - "0x431D5dfF03120AFA4bDf332c61A6e1766eF37BDB": { coingeckoId: "jpy-coin", decimals: 18, }, - }, - arbitrum: { - "0x93C15cd7DE26f07265f0272E0b831C5D7fAb174f": { coingeckoId: "liquid-finance", decimals: 18, }, - }, - cardano: { - "ADA": { coingeckoId: "cardano", decimals: 0, }, - }, - defichain: { - "DFI": { coingeckoId: "defichain", decimals: 0, }, - "DUSD": { coingeckoId: "decentralized-usd", decimals: 0, }, - "ETH": { coingeckoId: "ethereum", decimals: 0, }, - "BTC": { coingeckoId: "bitcoin", decimals: 0, }, - "USDC": { coingeckoId: "usd-coin", decimals: 0, }, - "USDT": { coingeckoId: "tether", decimals: 0, }, - }, - step: { - '0xb58a9d5920af6ac1a9522b0b10f55df16686d1b6': { coingeckoId: "step-app-fitfi", decimals: 18, }, - '0xe3f5a90f9cb311505cd691a46596599aa1a0ad7d': { coingeckoId: "usd-coin", decimals: 6, }, - '0xfa9343c3897324496a05fc75abed6bac29f8a40f': { coingeckoId: "tether", decimals: 6, }, - '0x818ec0a7fe18ff94269904fced6ae3dae6d6dc0b': { coingeckoId: "ethereum", decimals: 18, }, - '0xefaeee334f0fd1712f9a8cc375f427d9cdd40d73': { coingeckoId: "binancecoin", decimals: 18, }, - }, - velas: { - "0x3611Fbfb06ffBcEf9Afb210f6Ace86742e6c14a4": { coingeckoId: "cardano", decimals: 6, }, - }, - functionx: { - [nullAddress]: { coingeckoId: "fx-coin", decimals: 18 }, - "0x80b5a32E4F032B2a058b4F29EC95EEfEEB87aDcd": { coingeckoId: "fx-coin", decimals: 18, }, - "0xd567b3d7b8fe3c79a1ad8da978812cfc4fa05e75": { coingeckoId: "pundi-x-2", decimals: 18, }, - "0x5fd55a1b9fc24967c4db09c513c3ba0dfa7ff687": { coingeckoId: "pundi-x-purse", decimals: 18, }, - "0xeceeefcee421d8062ef8d6b4d814efe4dc898265": { coingeckoId: "tether", decimals: 6, }, - }, - clv: { - "0x6d6ad95425fcf315c39fa6f3226471d4f16f27b3": { coingeckoId: "clover-finance", decimals: 18, }, - "0x1376C97C5c512d2d6F9173A9A3A016B6140b4536": { coingeckoId: "clover-finance", decimals: 18, }, - "0xA1c3767c93E7B51EcB445fDbae1494DfC654e524": { coingeckoId: "ethereum", decimals: 18, }, - "0x30bEBbC0b6b357945AC30660E025C1532B9C7804": { coingeckoId: "wrapped-bitcoin", decimals: 8, }, - "0xF91193A62879279d6b8f209f89b6418e3C0e5CBf": { coingeckoId: "tether", decimals: 6, }, - "0x4A52F069Cb00905d996A0d7B811D78e60b4cB09E": { coingeckoId: "usd-coin", decimals: 6, }, - }, - avax: { - "0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7": { coingeckoId: "avalanche-2", decimals: 18, }, - "0x9dEbca6eA3af87Bf422Cea9ac955618ceb56EfB4": { coingeckoId: "avalanche-2", decimals: 18, }, - }, - tron: { - [nullAddress]: { coingeckoId: "tron", decimals: 6, }, - "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t": { coingeckoId: "tether", decimals: 6, }, - "TEkxiTehnzSmSe2XqrBj4w32RUN966rdz8": { coingeckoId: "usd-coin", decimals: 6, }, - }, - lachain: { - "0x3a898D596840C6B6b586d722bFAdCC8c4761BF41": { coingeckoId: "latoken", decimals: 18, }, - }, - theta: { - [nullAddress]: { coingeckoId: "theta-token", decimals: 18, }, - "0x4dc08b15ea0e10b96c41aec22fab934ba15c983e": { coingeckoId: "theta-fuel", decimals: 18, }, - "0x1336739b05c7ab8a526d40dcc0d04a826b5f8b03": { coingeckoId: "thetadrop", decimals: 18, }, + // Sample Code + ozone: { + // '0x83048f0bf34feed8ced419455a4320a735a92e9d': { coingeckoId: "ozonechain", decimals: 18 }, // was mapped to wrong chain }, telos: { - "0xD102cE6A4dB07D247fcc28F366A623Df0938CA9E": { coingeckoId: "telos", decimals: 18, }, - }, - zyx: { - "0xc9e1aea009b0bae9141f3dc7523fb42fd48c8656": { coingeckoId: "zyx", decimals: 18, }, - }, - ubiq: { - "0x1fa6a37c64804c0d797ba6bc1955e50068fbf362": { coingeckoId: "ubiq", decimals: 18, }, - }, - findora: { - [nullAddress]: { coingeckoId: "findora", decimals: 18, }, - "0x0000000000000000000000000000000000001000": { coingeckoId: "findora", decimals: 18, }, - "0x2e8079e0fe49626af8716fc38adea6799065d7f7": { coingeckoId: "usd-coin", decimals: 6, }, - "0x0632baa26299c9972ed4d9affa3fd057a72252ff": { coingeckoId: "tether", decimals: 6, }, - }, - cosmos: { - "uatom": { coingeckoId: "cosmos", decimals: 6, }, - }, - terra2: { - "uluna": { coingeckoId: "terra-luna-2", decimals: 6, }, - "terra1nsuqsk6kh58ulczatwev87ttq2z6r3pusulg9r24mfj2fvtzd4uq3exn26": { coingeckoId: "astroport-fi", decimals: 6, }, - }, - crescent: { - // token info - https://apigw-v2.crescent.network/asset/info - "ubcre": { coingeckoId: "liquid-staking-crescent", decimals: 6, }, - "ucre": { coingeckoId: "crescent-network", decimals: 6, }, - }, - osmosis: { - "uion": { coingeckoId: "ion", decimals: 6, }, - }, - kujira: { - "ukuji": { coingeckoId: "kujira", decimals: 6, }, - "factory/kujira1qk00h5atutpsv900x202pxx42npjr9thg58dnqpa72f2p7m2luase444a7/uusk": { coingeckoId: "usk", decimals: 6, }, - }, - injective: { - "inj": { coingeckoId: "injective-protocol", decimals: 18, }, - }, - solana: { - "6LNeTYMqtNm1pBFN8PfhQaoLyegAH8GD32WmHU9erXKN": { coingeckoId: "aptos", decimals: 8, }, - "EjmyN6qEC1Tf1JxiG1ae7UTJhUxSwk1TCWNWqxWV4J6o": { coingeckoId: tokens.dai, decimals: -10, }, - "eqKJTf1Do4MDPyKisMYqVaUFpkEFAs3riGF3ceDH2Ca": { coingeckoId: tokens.usdc, decimals: 0, }, - "FCqfQSujuPxy6V42UvafBhsysWtEq1vhjfMN1PUbgaxA": { coingeckoId: tokens.usdc, decimals: 2, }, - "DdFPRnccQqLD4zCHrBqdY95D6hvw6PLWp9DEXj1fLCL9": { coingeckoId: tokens.usdc, decimals: 3, }, - "8Yv9Jz4z7BUHP68dz8E8m3tMe6NKgpMUKn8KVqrPA6Fr": { coingeckoId: tokens.usdc, decimals: 3, }, - "Grk6b4UMRWkgyq4Y6S1BnNRF4hRgtnMFp7Sorkv6Ez4u": { coingeckoId: tokens.usdc, decimals: 3, }, - "8XSsNvaKU9FDhYWAv7Yc7qSNwuJSzVrXBNEk7AFiWF69": { coingeckoId: tokens.usdc, decimals: 3, }, - "8qJSyQprMC57TWKaYEmetUR3UUiTP2M3hXdcvFhkZdmv": { coingeckoId: tokens.usdt, decimals: 2, }, - "E77cpQ4VncGmcAXX16LHFFzNBEBb2U7Ar7LBmZNfCgwL": { coingeckoId: tokens.usdt, decimals: 3, }, - "Bn113WT6rbdgwrm12UJtnmNqGqZjY4it2WoUQuQopFVn": { coingeckoId: tokens.usdt, decimals: 3, }, - "FwEHs3kJEdMa2qZHv7SgzCiFXUQPEycEXksfBkwmS8gj": { coingeckoId: tokens.usdt, decimals: 3, }, - "5RpUwQ8wtdPCZHhu6MERp2RGrpobsbZ6MH5dDHkUjs2": { coingeckoId: tokens.busd, decimals: -10, }, - "PUhuAtMHsKavMTwZsLaDeKy2jb7ciETHJP7rhbKLJGY": { coingeckoId: 'usn', decimals: 9, }, - }, - harmony: { - "0x799a4202c12ca952cB311598a024C80eD371a41e": { coingeckoId: "harmony", decimals: 18, }, - "0xcF664087a5bB0237a0BAd6742852ec6c8d69A27a": { coingeckoId: "harmony", decimals: 18, }, - "0xa9ce83507d872c5e1273e745abcfda849daa654f": { coingeckoId: "xjewel", decimals: 18, }, - "0xea589e93ff18b1a1f1e9bac7ef3e86ab62addc79": { coingeckoId: "viper", decimals: 18, }, - }, - bsc: { - "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee": { coingeckoId: "binancecoin", decimals: 18, }, - "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c": { coingeckoId: "binancecoin", decimals: 18, }, - "0xEa7A82E0Bc636667AB5c65623cd1438370620c3E": { coingeckoId: "binancecoin", decimals: 18, }, - "0x8b04E56A8cd5f4D465b784ccf564899F30Aaf88C": { coingeckoId: "anchorust", decimals: 6, }, - "0x6A46d878401F46B4C7f665f065E0667580e031ec": { coingeckoId: "investin", decimals: 18, }, - "0xa4eF4b0B23C1fc81d3f9ecF93510e64f58A4A016": { coingeckoId: "1million-nfts", decimals: 18, }, - "0x37dfACfaeDA801437Ff648A1559d73f4C40aAcb7": { coingeckoId: "apyswap", decimals: 18, }, - "0x71be881e9c5d4465b3fff61e89c6f3651e69b5bb": { coingeckoId: "brz", decimals: 4, }, // BRZ Token - "0x316622977073bbc3df32e7d2a9b3c77596a0a603": { coingeckoId: "brz", decimals: 18, }, // jarvis synthetic BRL - "0x5b1a9850f55d9282a7c4bf23a2a21b050e3beb2f": { coingeckoId: "brz", decimals: 4, }, // BRZ - "0xdcecf0664c33321ceca2effce701e710a2d28a3f": { coingeckoId: "tether", decimals: 18, }, - "0x1ddcaa4ed761428ae348befc6718bcb12e63bfaa": { coingeckoId: "usd-coin", decimals: 18, }, // Debridge USDC - "0x4268b8f0b87b6eae5d897996e6b845ddbd99adf3": { coingeckoId: "usd-coin", decimals: 6, }, // alexar USDC - "0xE85aFCcDaFBE7F2B096f268e31ccE3da8dA2990A": { coingeckoId: "aBnBc-bad", decimals: 6, }, // HOTFIX: map aBnBc token to undefined - "0xbb1aa6e59e5163d8722a122cd66eba614b59df0d": { coingeckoId: "aBnBb-bad", decimals: 6, }, // HOTFIX: map aBnBb token to undefined - }, - oasis: { - "0x21c718c22d52d0f3a789b752d4c2fd5908a8a733": { coingeckoId: "oasis-network", decimals: 18, }, - "0x5C78A65AD6D0eC6618788b6E8e211F31729111Ca": { coingeckoId: "oasis-network", decimals: 18, }, - "0x9e832CaE5d19e7ff2f0D62881D1E33bb16Ac9bdc": { coingeckoId: "oasis-network", decimals: 18, }, - "0x3223f17957Ba502cbe71401D55A0DB26E5F7c68F": { coingeckoId: "ethereum", decimals: 18, }, - "0x6aB6d61428fde76768D7b45D8BFeec19c6eF91A8": { coingeckoId: "tether", decimals: 6, }, - "0x80A16016cC4A2E6a2CACA8a4a498b1699fF0f844": { coingeckoId: "usd-coin", decimals: 6, }, - "0xe8a638b3b7565ee7c5eb9755e58552afc87b94dd": { coingeckoId: "usd-coin", decimals: 6, }, - "0x81ecac0d6be0550a00ff064a4f9dd2400585fe9c": { coingeckoId: "usd-coin", decimals: 6, }, // USDC celer - }, - celo: { - "0x7d00cd74ff385c955ea3d79e47bf06bd7386387d": { coingeckoId: "mcelo", decimals: 18, }, - "0x918146359264c492bd6934071c6bd31c854edbc3": { coingeckoId: "mceur", decimals: 18, }, - "0xe273ad7ee11dcfaa87383ad5977ee1504ac07568": { coingeckoId: "moola-celo-dollars", decimals: 18, }, - "0x37f750B7cC259A2f741AF45294f6a16572CF5cAd": { coingeckoId: "usd-coin", decimals: 6, }, - "0x2a3684e9dc20b857375ea04235f2f7edbe818fa7": { coingeckoId: "usd-coin", decimals: 6, }, - "0xb70e0a782b058bfdb0d109a3599bec1f19328e36": { coingeckoId: "usd-coin", decimals: 18, }, - "0xcd7d7ff64746c1909e44db8e95331f9316478817": { coingeckoId: "usd-coin", decimals: 18, }, - "0x93db49be12b864019da9cb147ba75cdc0506190e": { coingeckoId: "usd-coin", decimals: 18, }, - "0xcfffe0c89a779c09df3df5624f54cdf7ef5fdd5d": { coingeckoId: "tether", decimals: 18, }, - "0x617f3112bf5397d0467d315cc709ef968d9ba546": { coingeckoId: "tether", decimals: 6, }, - "0xBAAB46E28388d2779e6E31Fd00cF0e5Ad95E327B": { coingeckoId: "wrapped-bitcoin", decimals: 8, }, - "0x122013fd7df1c6f636a5bb8f03108e876548b455": { coingeckoId: "ethereum", decimals: 18, }, - "0xe919f65739c26a42616b7b8eedc6b5524d1e3ac4": { coingeckoId: "ethereum", decimals: 18, }, - "0xed193c4e69f591e42398ef54dea65aa1bb02835c": { coingeckoId: "terrausd", decimals: 18, }, - "0x90ca507a5d4458a4c6c6249d186b6dcb02a5bccd": { coingeckoId: "dai", decimals: 18, }, - "0x02de4766c272abc10bc88c220d214a26960a7e92": { coingeckoId: "toucan-protocol-nature-carbon-tonne", decimals: 18, }, - "0x32a9fe697a32135bfd313a6ac28792dae4d9979d": { coingeckoId: "moss-carbon-credit", decimals: 18, }, - "0x66803fb87abd4aac3cbb3fad7c3aa01f6f3fb207": { coingeckoId: "ethereum", decimals: 18, }, - }, - kcc: { - [nullAddress]: { coingeckoId: "kucoin-shares", decimals: 18, }, - "0x4446fc4eb47f2f6586f9faab68b3498f86c07521": { coingeckoId: "kucoin-shares", decimals: 18, }, - "0x2ca48b4eea5a731c2b54e7c3944dbdb87c0cfb6f": { coingeckoId: "mojitoswap", decimals: 18, }, - "0x0039f574ee5cc39bdd162e9a88e3eb1f111baf48": { coingeckoId: "tether", decimals: 18, }, - "0x980a5afef3d17ad98635f6c5aebcbaeded3c3430": { coingeckoId: "usd-coin", decimals: 18, }, - "0xe3f5a90f9cb311505cd691a46596599aa1a0ad7d": { coingeckoId: "binance-usd", decimals: 18, }, - "0xfa93c12cd345c658bc4644d1d4e1b9615952258c": { coingeckoId: "bitcoin", decimals: 18, }, // BTC-K - "0x639a647fbe20b6c8ac19e48e2de44ea792c62c5c": { coingeckoId: "binancecoin", decimals: 18, }, - "0x00ee2d494258d6c5a30d6b6472a09b27121ef451": { coingeckoId: "staked-kcs", decimals: 18, }, - }, - near: { - "token.jumbo_exchange.near": { coingeckoId: "jumbo-exchange", decimals: 18 }, - "token.paras.near": { coingeckoId: "paras", decimals: 18 }, - "marmaj.tkn.near": { coingeckoId: "marmaj", decimals: 18 }, - "linear-protocol.near": { coingeckoId: "linear-protocol", decimals: 24 }, - "token.pembrock.near": { coingeckoId: "pembrock", decimals: 18 }, - "token.burrow.near": { coingeckoId: "burrow", decimals: 18 }, - "token.marmaj.near": { coingeckoId: "marmaj", decimals: 18 }, - }, - cronos: { - "0x0000000000000000000000000000000000000000": { coingeckoId: "crypto-com-chain", decimals: 18, }, - "0xca2503482e5D6D762b524978f400f03E38d5F962": { coingeckoId: "crypto-com-chain", decimals: 18, }, - "0x45c135c1cdce8d25a3b729a28659561385c52671": { coingeckoId: "alethea-artificial-liquid-intelligence-token", decimals: 18 }, - "0x39a65a74dc5a778ff93d1765ea51f57bc49c81b3": { coingeckoId: "akash-network", decimals: 6 }, - "0xbed48612bc69fa1cab67052b42a95fb30c1bcfee": { coingeckoId: "shiba-inu", decimals: 18 }, - // "0x1a8e39ae59e5556b56b76fcba98d22c9ae557396": { coingeckoId: "dogecoin", decimals: 8 }, - "0xb888d8dd1733d72681b30c00ee76bde93ae7aa93": { coingeckoId: "cosmos", decimals: 6 }, - "0x02dccaf514c98451320a9365c5b46c61d3246ff3": { coingeckoId: "dogelon-mars", decimals: 18 }, - }, - multivac: { - "0x8E321596267a4727746b2F48BC8736DB5Da26977": { coingeckoId: "multivac", decimals: 18, }, - }, - tomochain: { - "0xB1f66997A5760428D3a87D68b90BfE0aE64121cC": { coingeckoId: "tomochain", decimals: 18, }, - }, - csc: { - "0x398dcA951cD4fc18264d995DCD171aa5dEbDa129": { coingeckoId: "tether", decimals: 18, }, - }, - ethereumclassic: { - [nullAddress]: { coingeckoId: "ethereum-classic", decimals: 18, }, - "0x82A618305706B14e7bcf2592D4B9324A366b6dAd": { coingeckoId: "ethereum-classic", decimals: 18, }, - "0x1953cab0E5bFa6D4a9BaD6E05fD46C1CC6527a5a": { coingeckoId: "ethereum-classic", decimals: 18, }, - "0x35e9A89e43e45904684325970B2E2d258463e072": { coingeckoId: "ethereum-classic", decimals: 18, } + [ADDRESSES.telos.WTLOS_1]: { coingeckoId: "telos", decimals: 18 }, }, - klaytn: { - [nullAddress]: { coingeckoId: "klay-token", decimals: 18 }, // Wrapped KLAY - "0xd7a4d10070a4f7bc2a015e78244ea137398c3b74": { coingeckoId: "klay-token", decimals: 18 }, // Wrapped KLAY - "0xff3e7cf0c007f919807b32b30a4a9e7bd7bc4121": { coingeckoId: "klay-token", decimals: 18 }, // Wrapped KLAY - "0xe4f05a66ec68b54a58b17c22107b02e0232cc817": { coingeckoId: "klay-token", decimals: 18 }, // Wrapped KLAY - "0xf6f6b8bd0ac500639148f8ca5a590341a97de0de": { coingeckoId: "klay-token", decimals: 18 }, // Wrapped KLAY - "0x9eaefb09fe4aabfbe6b1ca316a3c36afc83a393f": { coingeckoId: "ripple", decimals: 6 }, - "0xd6dab4cff47df175349e6e7ee2bf7c40bb8c05a3": { coingeckoId: "tether", decimals: 6 }, - "0xc6a2ad8cc6e4a7e08fc37cc5954be07d499e7654": { coingeckoId: "klayswap-protocol", decimals: 18 }, // KLAYSWAP - "0x98a8345bb9d3dda9d808ca1c9142a28f6b0430e1": { coingeckoId: "ethereum", decimals: 18 }, - "0x981846be8d2d697f4dfef6689a161a25ffbab8f9": { coingeckoId: "wrapped-bitcoin", decimals: 8 }, - "0x608792deb376cce1c9fa4d0e6b7b44f507cffa6a": { coingeckoId: "usd-coin", decimals: 6 }, - "0x5c13e303a62fc5dedf5b52d66873f2e59fedadc2": { coingeckoId: "tether", decimals: 6 }, - "0xcb2c7998696ef7a582dfd0aafadcd008d03e791a": { coingeckoId: "dai", decimals: 18 }, - "0xac9c1e4787139af4c751b1c0fadfb513c44ed833": { coingeckoId: "binancecoin", decimals: 18 }, - "0xe2765f3721dab5f080cf14ace661529e1ab9ade7": { coingeckoId: "binance-usd", decimals: 18 }, - "0x45830b92443a8f750247da2a76c85c70d0f1ebf3": { coingeckoId: "avalanche-2", decimals: 18 }, - "0xfAA03A2AC2d1B8481Ec3fF44A0152eA818340e6d": { coingeckoId: "solana", decimals: 18 }, - "0x2b72d65941e657c1305b65fa330ffdde7b397239": { coingeckoId: "aave-usdc", decimals: 6 }, - "0x61fbbfd5416c45f297a8e69ba113789c75f8841c": { coingeckoId: "aave-usdc", decimals: 6 }, - "0x2eadfda6d830547b5168ba88c13d24156a026ce5": { coingeckoId: "aave-usdt", decimals: 6 }, - "0x98aedff55dcc2e7a7d1899b325d1680527dd2742": { coingeckoId: "aave-usdt", decimals: 6 }, - "0x2ff5371dad5c6ef76d55213b7c5a519f6654ba17": { coingeckoId: "aave-dai", decimals: 18 }, - "0xe9a88c33abf71c902f7581321d05e6516cbca761": { coingeckoId: "aave-dai", decimals: 18 }, - "0xd2137fdf10bd9e4e850c17539eb24cfe28777753": { coingeckoId: "krome-stablecoin-bad", decimals: 18 }, - }, - evmos: { - "0x3F75ceabcdfed1aca03257dc6bdc0408e2b4b026": { coingeckoId: "diffusion", decimals: 18 }, - "0xd4949664cd82660aae99bedc034a0dea8a0bd517": { coingeckoId: "evmos", decimals: 18 }, - }, - hoo: { - [nullAddress]: { coingeckoId: "hoo-token", decimals: 18 }, - "0x3eff9d389d13d6352bfb498bcf616ef9b1beac87": { coingeckoId: "hoo-token", decimals: 18 }, - }, - cube: { - [nullAddress]: { coingeckoId: "cube-network", decimals: 18 }, - "0x9d3f61338d6eb394e378d28c1fd17d5909ac6591": { coingeckoId: "cube-network", decimals: 18 }, - // o3 swap bridged tokens - "0x57EeA49Ec1087695274A9c4f341e414eb64328c2": { coingeckoId: "ethereum", decimals: 18 }, - "0x040eA5C10e6BA4Badb6c433A365cCC4968697230": { coingeckoId: "bitcoin", decimals: 18 }, - "0x79F1520268A20c879EF44d169A4E3812D223C6de": { coingeckoId: "tether", decimals: 18 }, - "0x00f0D8595797943c12605cD59bc0D9f63D750cCf": { coingeckoId: "usd-coin", decimals: 18 }, - "0x3a1F6e3E6F26E92bB0D07841EB68F8E84f39751E": { coingeckoId: "dai", decimals: 18 }, - "0xEe9801669C6138E84bD50dEB500827b776777d28": { coingeckoId: "o3-swap", decimals: 18 }, - - }, - elastos: { - [nullAddress]: { coingeckoId: "elastos", decimals: 18 }, - "0x517e9e5d46c1ea8ab6f78677d6114ef47f71f6c4": { coingeckoId: "elastos", decimals: 18 }, - "0x9f1d0ed4e041c503bd487e5dc9fc935ab57f9a57": { coingeckoId: "binance-usd", decimals: 18 }, - }, - energyweb: { - "0x6b3bd0478DF0eC4984b168Db0E12A539Cc0c83cd": { coingeckoId: "energy-web-token", decimals: 18 }, - }, - milkomeda: { - "0xAE83571000aF4499798d1e3b0fA0070EB3A3E3F9": { coingeckoId: "cardano", decimals: 18 }, - "0x4bf769b05e832fcdc9053fffbc78ca889acb5e1e": { coingeckoId: "binance-usd", decimals: 18 }, - "0x8c008BBA2Dd56b99f4A6aB276bE3a478cB075F0C": { coingeckoId: "blueshift", decimals: 18 } // BLUES - }, - milkomeda_a1: { - [nullAddress]: { coingeckoId: "algorand", decimals: 18 }, - "0xaF86E6c5Fd9dAf53e5100ed38BaB2572609fCA27": { coingeckoId: "algorand", decimals: 18 }, - "0xBc31960A049Fe10297Ed8432Fb61DD734fEAd4ea": { coingeckoId: "usd-coin", decimals: 6 }, // USDC - "0x32564ae38E5DBf316958CE25A6aD2A2249EbCc2D": { coingeckoId: "tether", decimals: 6 }, // USDt - "0x522B61755b5FF8176B2931DA7bF1a5F9414Eb710": { coingeckoId: "tether", decimals: 6 }, // ceUSDT - "0xc9BAA8cfdDe8E328787E29b4B078abf2DaDc2055": { coingeckoId: "blueshift", decimals: 18 } // BLUES - }, - ultron: { - [nullAddress]: { coingeckoId: "ultron", decimals: 18 }, - "0x3a4f06431457de873b588846d139ec0d86275d54": { coingeckoId: "ultron", decimals: 18 }, - "0x2318bf5809a72aabadd15a3453a18e50bbd651cd": { coingeckoId: "ethereum", decimals: 18 }, - "0xd2b86a80a8f30b83843e247a50ecdc8d843d87dd": { coingeckoId: "bitcoin", decimals: 18 }, - "0xc7cac85c1779d2b8ada94effff49a4754865e2e4": { coingeckoId: "binance-usd", decimals: 18 }, - "0x97fdd294024f50c388e39e73f1705a35cfe87656": { coingeckoId: "tether", decimals: 6 }, - "0x3c4e0fded74876295ca36f62da289f69e3929cc4": { coingeckoId: "usd-coin", decimals: 6 }, - }, - bittorrent: { - "0xca424b845497f7204d9301bd13ff87c0e2e86fcf": { coingeckoId: "usd-coin", decimals: 18 }, - "0x9b5f27f6ea9bbd753ce3793a07cba3c74644330d": { coingeckoId: "tether", decimals: 18 }, - "0x23181f21dea5936e24163ffaba4ea3b316b57f3c": { coingeckoId: 'bittorrent', decimals: 18, }, - "0xedf53026aea60f8f75fca25f8830b7e2d6200662": { coingeckoId: 'tron', decimals: 6, }, - }, - bitgert: { - [nullAddress]: { coingeckoId: "bitrise-token", decimals: 18, }, - "0x0eb9036cbE0f052386f36170c6b07eF0a0E3f710": { coingeckoId: "bitrise-token", decimals: 18, }, - "0xc3b730dd10a7e9a69204bdf6cb5a426e4f1f09e3": { coingeckoId: "lunagens", decimals: 18 }, - "0x11203a00a9134db8586381c4b2fca0816476b3fd": { coingeckoId: "youngparrot", decimals: 18 }, - }, - echelon: { - [nullAddress]: { coingeckoId: "echelon", decimals: 18, }, - "0xadEE5159f4f82a35B9068A6c810bdc6c599Ba6a8": { coingeckoId: "echelon", decimals: 18, }, - }, - rei: { - "0x2545af3d8b11e295bb7aedd5826021ab54f71630": { coingeckoId: "rei-network", decimals: 18, }, - "0x988a631caf24e14bb77ee0f5ca881e8b5dcfcec7": { coingeckoId: "tether", decimals: 6, }, - "0x8059e671be1e76f8db5155bf4520f86acfdc5561": { coingeckoId: "wrapped-bitcoin", decimals: 8 }, - "0x5B07F2582d0Cc26E400D56266aeBB201c93560eD": { coingeckoId: "ethereum", decimals: 18 }, - }, - tombchain: { - "0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000": { coingeckoId: "tomb", decimals: 18, }, - "0x4200000000000000000000000000000000000108": { coingeckoId: "lif3", decimals: 18, }, - "0x4200000000000000000000000000000000000006": { coingeckoId: "fantom", decimals: 18, }, - "0x4200000000000000000000000000000000000101": { coingeckoId: "tomb-shares", decimals: 18, }, - "0x4200000000000000000000000000000000000100": { coingeckoId: "usd-coin", decimals: 6, }, - "0x4200000000000000000000000000000000000109": { coingeckoId: "lif3-lshare", decimals: 18, }, - }, - rsk: { - "0x967f8799af07df1534d48a95a5c9febe92c53ae0": { coingeckoId: "rootstock", decimals: 18, }, - "0x542fda317318ebf1d3deaf76e0b632741a7e677d": { coingeckoId: "rootstock", decimals: 18, }, - "0x1d931bf8656d795e50ef6d639562c5bd8ac2b78f": { coingeckoId: "ethereum", decimals: 18, }, - }, - polis: { - "0x6fc851b8d66116627fb1137b9d5fe4e2e1bea978": { coingeckoId: "polis", decimals: 18, }, - }, - kekchain: { - [nullAddress]: { coingeckoId: "kekchain", decimals: 18, }, - "0x71ec0cb8f7dd4f4c5bd4204015c4c287fbdaa04a": { coingeckoId: "kekchain", decimals: 18, }, - "0x54Bd9D8d758AC3717B37b7DC726877a23afF1B89": { coingeckoId: "kekchain", decimals: 18, }, - }, - aptos: { - "0x1::aptos_coin::AptosCoin": { coingeckoId: "aptos", decimals: 8, }, - "0x5e156f1207d0ebfa19a9eeff00d62a282278fb8719f4fab3a586a0a2c0fffbea::coin::T": { coingeckoId: "usd-coin", decimals: 6, }, // usdc on eth via wormhole - "0xa2eda21a58856fda86451436513b867c97eecb4ba099da5775520e0f7492e852::coin::T": { coingeckoId: "tether", decimals: 6, }, // via wormhole - "0xae478ff7d83ed072dbc5e264250e67ef58f57c99d89b447efd8a0a2e8b2be76e::coin::T": { coingeckoId: "wrapped-bitcoin", decimals: 8 }, // via wormhole - "0xcc8a89c8dce9693d354449f1f73e60e14e347417854f029db5bc8e7454008abb::coin::T": { coingeckoId: "ethereum", decimals: 8, }, // via wormhole - "0xc91d826e29a3183eb3b6f6aa3a722089fdffb8e9642b94c5fcd4c48d035c0080::coin::T": { coingeckoId: "usd-coin", decimals: 6, }, // usdc on solana via wormhole - "0x1000000fa32d122c18a6a31c009ce5e71674f22d06a581bb0a15575e6addadcc::usda::USDA": { coingeckoId: "usd-coin", decimals: 6, }, // USD-A - "0xf22bede237a07e121b56d91a491eb7bcdfd1f5907926a9e58338f964a01b17fa::asset::USDC": { coingeckoId: "usd-coin", decimals: 6, }, // via LayerZero - "0xf22bede237a07e121b56d91a491eb7bcdfd1f5907926a9e58338f964a01b17fa::asset::USDT": { coingeckoId: "tether", decimals: 6, }, // via LayerZero - "0xf22bede237a07e121b56d91a491eb7bcdfd1f5907926a9e58338f964a01b17fa::asset::WETH": { coingeckoId: "ethereum", decimals: 6, }, // via LayerZero - "0xdd89c0e695df0692205912fb69fc290418bed0dbe6e4573d744a6d5e6bab6c13::coin::T": { coingeckoId: "solana", decimals: 8, }, - "0x84d7aeef42d38a5ffc3ccef853e1b82e4958659d16a7de736a29c55fbbeb0114::staked_aptos_coin::StakedAptosCoin": { coingeckoId: "aptos", decimals: 8, }, // tortuga staked aptos - "0xd11107bdf0d6d7040c6c0bfbdecb6545191fdf13e8d8d259952f53e1713f61b5::staked_coin::StakedAptos": { coingeckoId: "aptos", decimals: 8, }, // ditto staked aptos - "0x8d87a65ba30e09357fa2edea2c80dbac296e5dec2b18287113500b902942929d::celer_coin_manager::BnbCoin": { coingeckoId: "binancecoin", decimals: 8, }, // Celer - "0x8d87a65ba30e09357fa2edea2c80dbac296e5dec2b18287113500b902942929d::celer_coin_manager::BusdCoin": { coingeckoId: "binance-usd", decimals: 8, }, // Celer - "0x8d87a65ba30e09357fa2edea2c80dbac296e5dec2b18287113500b902942929d::celer_coin_manager::UsdcCoin": { coingeckoId: "usd-coin", decimals: 6, }, // Celer - "0x8d87a65ba30e09357fa2edea2c80dbac296e5dec2b18287113500b902942929d::celer_coin_manager::UsdtCoin": { coingeckoId: "tether", decimals: 6, }, // Celer - "0x8d87a65ba30e09357fa2edea2c80dbac296e5dec2b18287113500b902942929d::celer_coin_manager::DaiCoin": { coingeckoId: "dai", decimals: 8, }, // Celer - "0x8d87a65ba30e09357fa2edea2c80dbac296e5dec2b18287113500b902942929d::celer_coin_manager::WethCoin": { coingeckoId: "ethereum", decimals: 8, }, // Celer - "0x8d87a65ba30e09357fa2edea2c80dbac296e5dec2b18287113500b902942929d::celer_coin_manager::WbtcCoin": { coingeckoId: "wrapped-bitcoin", decimals: 8, }, // Celer - }, - dogechain: { - [nullAddress]: { coingeckoId: "dogecoin", decimals: 18, }, - "0xB7ddC6414bf4F5515b52D8BdD69973Ae205ff101": { coingeckoId: "dogecoin", decimals: 18, }, - "0x7b4328c127b85369d9f82ca0503b000d09cf9180": { coingeckoId: "dogechain", decimals: 18, }, - // all multichain bridged tokens - "0x765277EebeCA2e31912C9946eAe1021199B39C61": { coingeckoId: "usd-coin", decimals: 6, }, - "0x639A647fbe20b6c8ac19E48E2de44ea792c62c5C": { coingeckoId: "dai", decimals: 18, }, - "0xB44a9B6905aF7c801311e8F4E76932ee959c663C": { coingeckoId: "ethereum", decimals: 18, }, - "0xE3F5a90F9cb311505cd691a46596599aA1A0AD7D": { coingeckoId: "tether", decimals: 6, }, - "0xfA9343C3897324496A05fC75abeD6bAC29f8A40f": { coingeckoId: "wrapped-bitcoin", decimals: 8, }, - "0xf27Ee99622C3C9b264583dACB2cCE056e194494f": { coingeckoId: "frax", decimals: 18, }, - "0x97513e975a7fA9072c72C92d8000B0dB90b163c5": { coingeckoId: "frax-share", decimals: 18, }, - "0x332730a4F6E03D9C55829435f10360E13cfA41Ff": { coingeckoId: "binance-usd", decimals: 18, }, - "0xa649325aa7c5093d12d6f98eb4378deae68ce23f": { coingeckoId: "binancecoin", decimals: 18, }, - "0xb12c13e66AdE1F72f71834f2FC5082Db8C091358": { coingeckoId: "quickswap", decimals: 18, }, - "0xDC42728B0eA910349ed3c6e1c9Dc06b5FB591f98": { coingeckoId: "matic-network", decimals: 18, }, - // all synapse bridged tokens - "0x85C2D3bEBffD83025910985389aB8aD655aBC946": { coingeckoId: "usd-coin", decimals: 6, }, - "0xB3306f03595490e5cC3a1b1704a5a158D3436ffC": { coingeckoId: "dai", decimals: 18, }, - "0x9F4614E4Ea4A0D7c4B1F946057eC030beE416cbB": { coingeckoId: "ethereum", decimals: 18, }, - "0x7f8e71DD5A7e445725F0EF94c7F01806299e877A": { coingeckoId: "tether", decimals: 6, }, - "0xD0c6179c43C00221915f1a61f8eC06A5Aa32F9EC": { coingeckoId: "wrapped-bitcoin", decimals: 8, }, - "0x10D70831f9C3c11c5fe683b2f1Be334503880DB6": { coingeckoId: "frax", decimals: 18, }, - "0x1fC532187B4848d2F9c564531b776A4F8e11201d": { coingeckoId: "binancecoin", decimals: 18, }, - "0x7264610A66EcA758A8ce95CF11Ff5741E1fd0455": { coingeckoId: "canto-inu", decimals: 18, }, - }, - canto: { - [nullAddress]: { coingeckoId: "canto", decimals: 18, }, - '0x826551890Dc65655a0Aceca109aB11AbDbD7a07B': { coingeckoId: "canto", decimals: 18, }, - "0x80b5a32e4f032b2a058b4f29ec95eefeeb87adcd": { coingeckoId: "usd-coin", decimals: 6, }, - "0xd567B3d7B8FE3C79a1AD8dA978812cfC4Fa05e75": { coingeckoId: "tether", decimals: 6, }, - "0x4e71A2E537B7f9D9413D3991D37958c0b5e1e503": { coingeckoId: "note", decimals: 18, }, - "0x5FD55A1B9FC24967C4dB09C513C3BA0DFa7FF687": { coingeckoId: "ethereum", decimals: 18, }, - "0xeceeefcee421d8062ef8d6b4d814efe4dc898265": { coingeckoId: "cosmos", decimals: 6, }, - }, - ontology_evm: { - "0xd8bc24cfd45452ef2c8bc7618e32330b61f2691b": { coingeckoId: "ong", decimals: 18, }, - }, - algorand: { - 1: { coingeckoId: "algorand", decimals: 6, }, - 312769: { coingeckoId: "tether", decimals: 6, }, - 31566704: { coingeckoId: "usd-coin", decimals: 6, }, - 692085161: { coingeckoId: "algodao", decimals: 6, }, - 724480511: { coingeckoId: "algodex", decimals: 6, }, - 463554836: { coingeckoId: "algofund", decimals: 6, }, - 230946361: { coingeckoId: "algogems", decimals: 6, }, - 441139422: { coingeckoId: "algomint", decimals: 6, }, - 465865291: { coingeckoId: "algostable", decimals: 6, }, - 841126810: { coingeckoId: "algostable", decimals: 6, }, - 511484048: { coingeckoId: "algostake", decimals: 2, }, - 163650: { coingeckoId: "arcc", decimals: 6, }, - 663905154: { coingeckoId: "bnext-b3x", decimals: 6, }, - 342889824: { coingeckoId: "board", decimals: 6, }, - 871930188: { coingeckoId: "bring", decimals: 6, }, - 137020565: { coingeckoId: "buying", decimals: 2, }, - 657291910: { coingeckoId: "carbon-credit", decimals: 0, }, - 297995609: { coingeckoId: "choice-coin", decimals: 2, }, - 571576867: { coingeckoId: "cosmic-champs", decimals: 6, }, - 470842789: { coingeckoId: "defly", decimals: 6, }, - 684649988: { coingeckoId: "gard", decimals: 6, }, - 607591690: { coingeckoId: "glitter-finance", decimals: 6, }, - 386192725: { coingeckoId: "gobtc", decimals: 8, }, - 386195940: { coingeckoId: "goeth", decimals: 8, }, - 793124631: { coingeckoId: "governance-algo", decimals: 6, }, - 137594422: { coingeckoId: "headline", decimals: 6, }, - 239444645: { coingeckoId: "kaafila", decimals: 0, }, - 6547014: { coingeckoId: "meld-gold", decimals: 5, }, - 403499324: { coingeckoId: "nexus-asa", decimals: 0, }, - 559219992: { coingeckoId: "octorand", decimals: 6, }, - 287867876: { coingeckoId: "opulous", decimals: 10, }, - 27165954: { coingeckoId: "planetwatch", decimals: 6, }, - 744665252: { coingeckoId: "ptokens-btc-2", decimals: 8, }, - 2751733: { coingeckoId: "realio-network", decimals: 7, }, - 300208676: { coingeckoId: "smile-coin", decimals: 6, }, - 700965019: { coingeckoId: "vestige", decimals: 6, }, - 792313023: { coingeckoId: "wrapped-sol", decimals: 9, }, - 283820866: { coingeckoId: "xfinite-entertainment-token", decimals: 9, }, - 226701642: { coingeckoId: "yieldly", decimals: 6, }, - 444035862: { coingeckoId: "zone", decimals: 6, }, - }, - shiden: { - "0x0f933dc137d21ca519ae4c7e93f87a4c8ef365ef": { coingeckoId: "shiden", decimals: 18 }, - "0xb4BcA5955F26d2fA6B57842655d7aCf2380Ac854": { coingeckoId: "emiswap", decimals: 18 }, - "0x765277EebeCA2e31912C9946eAe1021199B39C61": { coingeckoId: "ethereum", decimals: 18 }, - "0x332730a4f6e03d9c55829435f10360e13cfa41ff": { coingeckoId: "binancecoin", decimals: 18 }, - "0x65e66a61d0a8f1e686c2d6083ad611a10d84d97a": { coingeckoId: "binance-usd", decimals: 18 }, - "0x722377a047e89ca735f09eb7cccab780943c4cb4": { coingeckoId: "standard-protocol", decimals: 18 } - }, - tezos: { - // KT1PWx2mnDueood7fEmfbBDKx1D9BAnnXitn: { coingeckoId: "tzbtc", decimals: 8 }, - tezos: { coingeckoId: "tezos", decimals: 0 }, - 'KT1UpeXdK6AJbX58GJ92pLZVCucn2DR8Nu4b': { coingeckoId: "tezos", decimals: 6 }, - 'KT1VYsVfmobT7rsMVivvZ4J8i3bPiqz12NaH': { coingeckoId: "tezos", decimals: 6 }, - KT1GRSvLoikDsXujKgZPsGLX8k8VvR2Tq95b: { coingeckoId: "plenty-dao", decimals: 18 }, - KT1SjXiUX63QvdNMcM2m492f7kuf8JxXRLp4: { coingeckoId: "tezos", decimals: 6 }, // this is ctez, ideally should be valued higher - KT1Ha4yFVeyzw6KRAdkzq6TxDHB97KG4pZe8: { coingeckoId: "dogami", decimals: 5 }, - KT1JkoE42rrMBP9b2oDhbx6EUr26GcySZMUH: { coingeckoId: "kolibri-dao", decimals: 18 }, - "KT18fp5rcTW7mbWDmzFwjLDUhs5MeJmagDSZ-19": { coingeckoId: "wrapped-bitcoin", decimals: 8 }, - "KT18fp5rcTW7mbWDmzFwjLDUhs5MeJmagDSZ-17": { coingeckoId: "usd-coin", decimals: 6 }, - "KT18fp5rcTW7mbWDmzFwjLDUhs5MeJmagDSZ-11": { coingeckoId: "matic-network", decimals: 18 }, - "KT18fp5rcTW7mbWDmzFwjLDUhs5MeJmagDSZ-10": { coingeckoId: "chainlink", decimals: 18 }, - "KT18fp5rcTW7mbWDmzFwjLDUhs5MeJmagDSZ-1": { coingeckoId: "binance-usd", decimals: 18 }, - "KT18fp5rcTW7mbWDmzFwjLDUhs5MeJmagDSZ-20": { coingeckoId: "ethereum", decimals: 18 }, - "KT18fp5rcTW7mbWDmzFwjLDUhs5MeJmagDSZ-5": { coingeckoId: "dai", decimals: 18 }, - "KT19DUSZw7mfeEATrbWVPHRrWNVbNnmfFAE6": { coingeckoId: "paul-token", decimals: 18 }, - "KT1TgmD7kXQzofpuc9VbTRMdZCS2e6JDuTtc": { coingeckoId: "upsorber", decimals: 0 }, - "KT1TwzD6zV3WeJ39ukuqxcfK2fJCnhvrdN1X": { coingeckoId: "smartlink", decimals: 3 }, - "KT19at7rQUvyjxnZ2fBv7D9zc8rkyG7gAoU8": { coingeckoId: "ethtez", decimals: 18 }, - KT18fp5rcTW7mbWDmzFwjLDUhs5MeJmagDSZ: { coingeckoId: "aave", decimals: 18 }, - "KT18fp5rcTW7mbWDmzFwjLDUhs5MeJmagDSZ-18": { coingeckoId: "tether", decimals: 6 }, - KT1K9gCRgaLRFKTErYt1wVxA3Frb9FjasjTV: { coingeckoId: "kolibri-usd", decimals: 18 }, - KT1LN4LPSqTMS7Sd2CJw4bbDGRkMv2t68Fy9: { coingeckoId: "usdtez", decimals: 6 }, - KT1XRPEPXbZK25r3Htzp2o1x7xdMMmfocKNW: { coingeckoId: "youves-uusd", decimals: 12 }, - KT1PWx2mnDueood7fEmfbBDKx1D9BAnnXitn: { coingeckoId: "bitcoin", decimals: 8 }, // TODO: tzBTC is not coingecko, so marking it as btc - 'KT1XRPEPXBZK25R3HTZP2O1X7XDMMMFOCKNW-0': { coingeckoId: "youves-uusd", decimals: 12 }, - // 'KT1XRPEPXbZK25r3Htzp2o1x7xdMMmfocKNW-1': { coingeckoId: 'youves-you-defi', decimals: 12, }, //uDEFI token - update gecko id here after adding in coin geckp - KT1Xobej4mc6XgEjDoJoHtTKgbD1ELMvcQuL: { coingeckoId: "youves-you-governance", decimals: 12 }, - "KT1XRPEPXbZK25r3Htzp2o1x7xdMMmfocKNW-2": { coingeckoId: "wrapped-bitcoin", decimals: 12 }, // youves BTC - KT1UsSfaXyqcjSVPeiD7U1bWgKy3taYN7NWY: { coingeckoId: "ethereum", decimals: 18 }, // plenty bridge - "KT1UsSfaXyqcjSVPeiD7U1bWgKy3taYN7NWY-0": { coingeckoId: "ethereum", decimals: 18 }, // plenty bridge - "KT1UsSfaXyqcjSVPeiD7U1bWgKy3taYN7NWY-1": { coingeckoId: "wrapped-bitcoin", decimals: 8 }, // plenty bridge - "KT1UsSfaXyqcjSVPeiD7U1bWgKy3taYN7NWY-2": { coingeckoId: "usd-coin", decimals: 6 }, // plenty bridge - "KT1UsSfaXyqcjSVPeiD7U1bWgKy3taYN7NWY-3": { coingeckoId: "tether", decimals: 6 }, // plenty bridge - "KT1UsSfaXyqcjSVPeiD7U1bWgKy3taYN7NWY-4": { coingeckoId: "matic-network", decimals: 18 }, // plenty bridge - "KT1UsSfaXyqcjSVPeiD7U1bWgKy3taYN7NWY-5": { coingeckoId: "chainlink", decimals: 18 }, // plenty bridge - "KT1UsSfaXyqcjSVPeiD7U1bWgKy3taYN7NWY-6": { coingeckoId: "dai", decimals: 18 }, // plenty bridge - "KT1UsSfaXyqcjSVPeiD7U1bWgKy3taYN7NWY-7": { coingeckoId: "binance-usd", decimals: 18 }, // plenty bridge - "KT1XnTn74bUtxHfDtBmm2bGZAQfhPbvKWR8o": { coingeckoId: "tether", decimals: 6 }, // usdt on tezos - "KT1F1mn2jbqQCJcsNgYKVAQjvenecNMY2oPK": { coingeckoId: "pixelpotus", decimals: 6 }, - "KT193D4vozYnhGJQVtw7CoxxqphqUEEwK6Vb": { coingeckoId: "quipuswap-governance-token", decimals: 6 }, - "KT1ErKVqEhG9jxXgUG2KGLW3bNM7zXHX8SDF": { coingeckoId: "unobtanium-tezos", decimals: 9 }, - "KT1AFA2mwNUMNd4SsujE1YYp29vd8BZejyKW": { coingeckoId: "hic-et-nunc-dao", decimals: 6 }, - "KT1XTxpQvo7oRCqp85LikEZgAZ22uDxhbWJv": { coingeckoId: "gif-dao", decimals: 9 }, - "KT1A5P4ejnLix13jtadsfV9GCnXLMNnab8UT": { coingeckoId: "kalamint", decimals: 10 }, - "KT1XPFjZqCULSnqfKaaYy8hJjeY63UNSGwXg": { coingeckoId: "crunchy-dao", decimals: 8 }, - "KT1BHCumksALJQJ8q8to2EPigPW6qpyTr7Ng": { coingeckoId: "crunchy-network", decimals: 8 }, - "KT1LRboPna9yQY9BrjtQYDS1DVxhKESK4VVd": { coingeckoId: "wrap-governance-token", decimals: 8 }, - "KT1REEb5VxWRjcHm5GzDMwErMmNFftsE5Gpf": { coingeckoId: "stableusd", decimals: 6 }, - "KT1AEfeckNbdEYwaMKkytBwPJPycz7jdSGea": { coingeckoId: "staker-dao", decimals: 18 }, - "KT1BB1uMwVvJ1M3vVHXWALs1RWdgTp1rnXTR": { coingeckoId: "moneyhero", decimals: 8 }, - "KT19y6R8x53uDKiM46ahgguS6Tjqhdj2rSzZ": { coingeckoId: "instaraise", decimals: 9 }, - }, - hpb: { - "0xBE05Ac1FB417c9EA435b37a9Cecd39Bc70359d31": { coingeckoId: "high-performance-blockchain", decimals: 18 } - }, - godwoken: { - "0xe934f463d026d97f6ce0a10215d0ac4224f0a930": { coingeckoId: "nervos-network", decimals: 18, }, // Wrapped CKB - "0xC3b946c53E2e62200515d284249f2a91d9DF7954": { coingeckoId: "usd-coin", decimals: 6, }, // Wrapped USDC (ForceBridge from Ethereum) - "0xA21B19d660917C1DE263Ad040Ba552737cfcEf50": { coingeckoId: "usd-coin", decimals: 18, }, // Wrapped USDC (ForceBridge from BSC) - "0x07a388453944bB54BE709AE505F14aEb5d5cbB2C": { coingeckoId: "tether", decimals: 6, }, // Wrapped USDT (ForceBridge from Ethereum) - "0x5C30d9396a97f2279737E63B2bf64CC823046591": { coingeckoId: "tether", decimals: 18, }, // Wrapped USDT (ForceBridge from BSC) - "0x7818FA4C71dC3b60049FB0b6066f18ff8c720f33": { coingeckoId: "bitcoin", decimals: 8, }, // Wrapped BTC (ForceBridge from Ethereum) - "0x3f8d2b24C6fa7b190f368C3701FfCb2bd919Af37": { coingeckoId: "bitcoin", decimals: 18, }, // Wrapped BTC (ForceBridge from BSC) - }, - godwoken_v1: { - "0xc296f806d15e97243a08334256c705ba5c5754cd": { coingeckoId: "nervos-network", decimals: 18, }, // Wrapped CKB - "0x7538c85cae4e4673253ffd2568c1f1b48a71558a": { coingeckoId: "nervos-network", decimals: 18, }, // pCKB - "0x9E858A7aAEDf9FDB1026Ab1f77f627be2791e98A": { coingeckoId: "ethereum", decimals: 18, }, // ETH (via Forcebridge from ETH) - "0xbadb9b25150ee75bb794198658a4d0448e43e528": { coingeckoId: "binancecoin", decimals: 18, }, // BNB (via Forcebridge from BSC) - "0x82455018f2c32943b3f12f4e59d0da2faf2257ef": { coingeckoId: "wrapped-bitcoin", decimals: 8, }, // WBTC (via Forcebridge from ETH) - "0xef2439e020509259fa603c34b35a81ffe676cfb4": { coingeckoId: "wrapped-bitcoin", decimals: 18, }, // BTCB (via Forcebridge from BSC) - "0xB66954619363145a05eF835547449EB9050d82f6": { coingeckoId: "ethereum", decimals: 18, }, // WETH (Via Celer CBridge From ETH) - "0x186181e225dc1Ad85a4A94164232bD261e351C33": { coingeckoId: "usd-coin", decimals: 6, }, // USDC (via Forcebridge from ETH - "0xfa307cfdea89dc197a346c338a98ac85d517af6e": { coingeckoId: "usd-coin", decimals: 18, }, // USDC (via Forcebridge from BSC - "0xdff2facdfe47c1d5b51f18231f900949f1d5988f": { coingeckoId: "tether", decimals: 18, }, // USDT (via Forcebridge from BSC - "0x53bB26dc8C5EFC6c95C37155aCa487d1D043436a": { coingeckoId: "usd-coin", decimals: 6, }, // USDC (Via Celer CBridge From ETH) - "0x2c9Fc6087875646112f66a3C92fEF2d158FAa76e": { coingeckoId: "dai", decimals: 18, }, // DAI (via Forcebridge from ETH) - "0x317F8d18FB16E49a958Becd0EA72f8E153d25654": { coingeckoId: "dai", decimals: 18, }, // Dai (Via Celer CBridge From ETH) - "0x8E019acb11C7d17c26D334901fA2ac41C1f44d50": { coingeckoId: "tether", decimals: 6, }, // USDT (via Forcebridge from ETH) - "0x3c790b38f466514ffCB4230e7B2334e52B64c942": { coingeckoId: "tether", decimals: 6, }, // USDT (Via Celer CBridge From ETH) - "0xcD7bC9fC617a4F82eC1c8359D1C8610B90e3B44C": { coingeckoId: "binance-usd", decimals: 18, }, // BUSD (Via Celer CBridge From BSC) - "0x1C428a6539A40eC5Bb481631266a51cd19b233B1": { coingeckoId: "bitcoin", decimals: 8, }, // Wrapped BTC (Celer CBridge from ETH) - "0xB44a9B6905aF7c801311e8F4E76932ee959c663C": { coingeckoId: "bitcoin", decimals: 8, }, // Wrapped BTC (MultiChain Bridge from ETH) - "0x765277EebeCA2e31912C9946eAe1021199B39C61": { coingeckoId: "dai", decimals: 18, }, // DAI (via Multichain Bridge from ETH) - "0xE3F5a90F9cb311505cd691a46596599aA1A0AD7D": { coingeckoId: "usd-coin", decimals: 6, }, // USDC (via Multichain Bridge from ETH) - "0xfA9343C3897324496A05fC75abeD6bAC29f8A40f": { coingeckoId: "tether", decimals: 6, }, // USDT (via Multichain Bridge from ETH) - - - }, - waves: { - "5UYBPpq4WoU5n4MwpFkgJnW3Fq4B1u3ukpK33ik4QerR": { coingeckoId: "binancecoin", decimals: 8 }, - DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p: { coingeckoId: "neutrino", decimals: 6 }, - Atqv59EYzjFGuitKVnMRk6H8FukjoV3ktPorbEys25on: { coingeckoId: "waves-exchange", decimals: 8 }, - "474jTeYx2r2Va35794tCScAXWJG9hU2HcgxzMowaZUnu": { coingeckoId: "ethereum", decimals: 8 }, - "34N9YcEETLWn93qYQ64EsP1x89tSruJU44RrEMSXXEPJ": { coingeckoId: "tether", decimals: 6 }, - "8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS": { coingeckoId: "bitcoin", decimals: 8 }, - WAVES: { coingeckoId: "waves", decimals: 8 }, - "2Fh9m3dNQXycHdnytEaETN3P1gDT7ij5U4HjMqQBeaqN": { coingeckoId: "ftx-token", decimals: 8 }, - "4GZH8rk5vDmMXJ81Xqfm3ovFaczqMnQ11r7aELiNxWBV": { coingeckoId: "fantom", decimals: 8 }, - "3KhNcHo4We1G5EWps7b1e5DTdLgWDzctc8S6ynu37KAb": { coingeckoId: "curve-dao-token", decimals: 8 }, - GVxGPBtgVWMW1wHiFnfaCakbJ6sKgZgowJgW5Dqrd7JH: { coingeckoId: "shiba-inu", decimals: 2 }, - HcHacFH51pY91zjJa3ZiUVWBww54LnsL4EP3s7hVGo9L: { coingeckoId: "matic-network", decimals: 8 }, - "4YmM7mj3Av4DPvpNpbtK4jHbpzYDcZuY6UUnYpqTbzLj": { coingeckoId: "uniswap", decimals: 8 }, - "6QUVF8nVVVvM7do7JT2eJ5o5ehnZgXUg13ysiB9JiQrZ": { coingeckoId: "terra-luna", decimals: 8 }, - "7TMu26hAs7B2oW6c5sfx45KSZT7GQA3TZNYuCav8Dcqt": { coingeckoId: "aave", decimals: 8 }, - E4rss7qLUcawCvD2uMrbLeTMPGkX15kS3okWCbUhLNKL: { coingeckoId: "maker", decimals: 8 }, - HLckRcg7hJ3Syf3PrGftFijKqQMJipf81WY3fwvHCJbe: { coingeckoId: "crypto-com-chain", decimals: 8 }, - "8zUYbdB8Q6mDhpcXYv52ji8ycfj4SDX4gJXS7YY3dA4R": { coingeckoId: "dai", decimals: 6 }, - "8DLiYZjo3UUaRBTHU7Ayoqg4ihwb6YH1AfXrrhdjQ7K1": { coingeckoId: "binance-usd", decimals: 6 }, - "47cyc68FWJszCWEwMWVsD9CadjS2M1XtgANuRGbEW8UH": { coingeckoId: "cosmos", decimals: 8 }, - "2bbGhKo5C31iEiB4CwGuqMYwjD7gCA9eXmm51fe2v8vT": { coingeckoId: "chainlink", decimals: 8 }, - BLRxWVJWaVuR2CsCoTvTw2bDZ3sQLeTbCofcJv7dP5J4: { coingeckoId: "yearn-finance", decimals: 8 }, - A1uMqYTzBdakuSNDv7CruWXP8mRZ4EkHwmip2RCauyZH: { coingeckoId: "the-graph", decimals: 8 }, - "2thtesXvnVMcCnih9iZbJL3d2NQZMfzENJo8YFj6r5jU": { coingeckoId: "terrausd", decimals: 6 }, - "2GBgdhqMjUPqreqPziXvZFSmDiQVrxNuGxR1z7ZVsm4Z": { coingeckoId: "apecoin", decimals: 8 }, - Aug9ccbPApb1hxXSue8fHuvbyMf1FV1BYBtLUuS5LZnU: { coingeckoId: "decentraland", decimals: 8 }, - ATQdLbehsMrmHZLNFhUm1r6s14NBT5JCFcSJGpaMrkAr: { coingeckoId: "axie-infinity", decimals: 8 }, - "8YyrMfuBdZ5gtMWkynLTveRvGb6LJ4Aff9rpz46UUMW": { coingeckoId: "the-sandbox", decimals: 8 }, - EfwRV6MuUCGgAUchdsF4dDFnSpKrDW3UYshdaDy4VBeB: { coingeckoId: "enjincoin", decimals: 8 }, - "5zoDNRdwVXwe7DveruJGxuJnqo7SYhveDeKb8ggAuC34": { coingeckoId: "wrapped-bitcoin", decimals: 8 }, - DSbbhLsSTeDg5Lsiufk2Aneh3DjVqJuPr2M9uU1gwy5p: { coingeckoId: "vires-finance", decimals: 8 }, - // 'C1iWsKGqLwjHUndiQ7iXpdmPum9PeCDFfyXBdJJosDRS': { coingeckoId: 'duck-egg', decimals: 8, }, // fix this with right coin gecko id - "4LHHvYGNKJUg5hj65aGD5vgScvCBmLpdRFtjokvCjSL8": { coingeckoId: "waves-enterprise", decimals: 8 }, - // 'HEB8Qaw9xrWpWs8tHsiATYGBWDBtP2S7kcPALrMu43AS': { coingeckoId: 'puzzle', decimals: 8, }, // fix this with right coin gecko id - // 'D4TPjtzpsDEJFS1pUAkvh1tJJJMNWGcSrds9sveBoQka': { coingeckoId: 'race', decimals: 8, }, - // '3UHgFQECoynwC3iunYBnbhzmcCzC5gVnVZMv8Yw1bneK': { coingeckoId: 'east', decimals: 8, }, - "6nSpVyNH7yM69eg446wrQR94ipbbcmZMU1ENPwanC97g": { coingeckoId: "neutrino-system-base-token", decimals: 8 }, - // 'DUk2YTxhRoAqMJLus4G2b3fR8hMHVh6eiyFx5r29VR6t': { coingeckoId: 'neutrino eur', decimals: 8, }, - Ehie5xYpeN8op1Cctc6aGUrqx8jq3jtf1DSjXDbfm7aT: { coingeckoId: "swop", decimals: 6 }, - "7LMV3s1J4dKpMQZqge5sKYoFkZRLojnnU49aerqos4yg": { coingeckoId: "enno-cash", decimals: 8 }, - "9sQutD5HnRvjM1uui5cVC4w9xkMPAfYEV8ymug3Mon2Y": { coingeckoId: "signaturechain", decimals: 8 }, - DHgwrRvVyqJsepd32YbBqUeDH4GJ1N984X8QoekjgH8J: { coingeckoId: "waves-community-token", decimals: 2 }, - // 'AbunLGErT5ctzVN8MVjb4Ad9YgjpubB8Hqb17VxzfAck': { coingeckoId: 'Waves World', decimals: 0, }, - HZk1mbfuJpmxU1Fs4AX5MWLVYtctsNcg6e2C6VKqK8zk: { coingeckoId: "litecoin", decimals: 8 }, - "6XtHjpXbs9RRJP2Sr9GUyVqzACcby9TkThHXnjVC5CDJ": { coingeckoId: "usd-coin", decimals: 6 } - }, - songbird: { - "0x02f0826ef6aD107Cfc861152B32B52fD11BaB9ED": { coingeckoId: "songbird", decimals: 18 }, - "0xC348F894d0E939FE72c467156E6d7DcbD6f16e21": { coingeckoId: "flare-finance", decimals: 18 }, - "0x70Ad7172EF0b131A1428D0c1F66457EB041f2176": { coingeckoId: "canary-dollar", decimals: 18 } - }, - energi: { - "0x7A86173daa4fDA903c9A4C0517735a7d34B9EC39": { coingeckoId: "energi", decimals: 18 }, - "0xa55f26319462355474a9f2c8790860776a329aa4": { coingeckoId: "energi", decimals: 18 } - }, - nahmii: { - "0x4200000000000000000000000000000000000006": { coingeckoId: "ethereum", decimals: 18 }, - "0x595DBA438a1bf109953F945437c1584319515d88": { coingeckoId: "nahmii", decimals: 15 } - }, - curio: { - "0x134EbAb7883dFa9D04d20674dd8A8A995fB40Ced": { coingeckoId: "curio-governance", decimals: 18 }, - }, - gochain: { - "0xcC237fa0A4B80bA47992d102352572Db7b96A6B5": { coingeckoId: "gochain", decimals: 18 }, - "0x97a19aD887262d7Eca45515814cdeF75AcC4f713": { coingeckoId: "usd-coin", decimals: 6 }, - "0x67bBB47f6942486184f08a671155FCFA6cAd8d71": { coingeckoId: "fast-finance", decimals: 18 }, - }, - dfk: { - "0xCCb93dABD71c8Dad03Fc4CE5559dC3D89F67a260": { coingeckoId: "defi-kingdoms", decimals: 18 }, - "0x77f2656d04E158f915bC22f07B779D94c1DC47Ff": { coingeckoId: "xjewel", decimals: 18 }, - "0x0ab87046fBb341D058F17CBC4c1133F25a20a52f": { coingeckoId: "governance-ohm", decimals: 18 }, - "0x2Df041186C844F8a2e2b63F16145Bc6Ff7d23E25": { coingeckoId: "fantom", decimals: 18 }, - // "0xb57b60debdb0b8172bb6316a9164bd3c695f133a": { coingeckoId: "avalanche-2", decimals: 18 }, - // "0x3ad9dfe640e1a9cc1d9b0948620820d975c3803a": { coingeckoId: "usd-coin", decimals: 18 }, - }, - smartbch: { - [nullAddress]: { coingeckoId: "bitcoin-cash", decimals: 18 }, - "0x3743ec0673453e5009310c727ba4eaf7b3a1cc04": { coingeckoId: "bitcoin-cash", decimals: 18 }, - "0x0b00366fBF7037E9d75E4A569ab27dAB84759302": { coingeckoId: "law", decimals: 18 }, - "0x7b2B3C5308ab5b2a1d9a94d20D35CCDf61e05b72": { coingeckoId: "flex-usd", decimals: 18 }, - "0x24d8d5Cbc14FA6A740c3375733f0287188F8dF3b": { coingeckoId: "tropical-finance", decimals: 18 }, - "0xBc2F884680c95A02cea099dA2F524b366d9028Ba": { coingeckoId: "tether", decimals: 18 }, - "0x265bD28d79400D55a1665707Fa14A72978FA6043": { coingeckoId: "cashcats", decimals: 2 }, - "0x9192940099fDB2338B928DE2cad9Cd1525fEa881": { coingeckoId: "bchpad", decimals: 18 }, - }, - palm: { - "0x4c1f6fcbd233241bf2f4d02811e3bf8429bc27b8": { coingeckoId: "dai", decimals: 18 }, - "0x726138359c17f1e56ba8c4f737a7caf724f6010b": { coingeckoId: "ethereum", decimals: 18 } - }, - syscoin: { - "0xd3e822f3ef011Ca5f17D82C956D952D8d7C3A1BB": { coingeckoId: "syscoin", decimals: 18 } - }, - vision: { - "0x1Db6Cdc620388a0b6046B20CD59503a0839AdCFF": { coingeckoId: "tether", decimals: 18 }, - "0x79ffbC4fff98b821D59dbD7B33f91a2783006b6f": { coingeckoId: "vision-metaverse", decimals: 6 } - }, - kava: { - [nullAddress]: { coingeckoId: "kava", decimals: 18 }, - "0xc86c7C0eFbd6A49B35E8714C5f59D99De09A225b": { coingeckoId: "kava", decimals: 18 }, - "0x332730a4F6E03D9C55829435f10360E13cfA41Ff": { coingeckoId: "binance-usd", decimals: 18 }, - "0x65e66a61D0a8F1e686C2D6083ad611a10D84D97A": { coingeckoId: "binancecoin", decimals: 18 }, - "0xfA9343C3897324496A05fC75abeD6bAC29f8A40f": { coingeckoId: "usd-coin", decimals: 6 }, - "0xB44a9B6905aF7c801311e8F4E76932ee959c663C": { coingeckoId: "tether", decimals: 6 }, - "0x818ec0A7Fe18Ff94269904fCED6AE3DaE6d6dC0b": { coingeckoId: "bitcoin", decimals: 8 }, - "0xE3F5a90F9cb311505cd691a46596599aA1A0AD7D": { coingeckoId: "ethereum", decimals: 18 }, - "0x765277EebeCA2e31912C9946eAe1021199B39C61": { coingeckoId: "dai", decimals: 18 }, - "0xc13791DA84f43525189456CfE2026C60D3B7F706": { coingeckoId: "kava", decimals: 18 }, - "0x7c598c96d02398d89fbcb9d41eab3df0c16f227d": { coingeckoId: "sushi", decimals: 18 }, - }, - sx: { - "0xaa99bE3356a11eE92c3f099BD7a038399633566f": { coingeckoId: "sx-network", decimals: 18 }, - "0xA173954Cc4b1810C0dBdb007522ADbC182DaB380": { coingeckoId: "ethereum", decimals: 18 }, - "0xe2aa35C2039Bd0Ff196A6Ef99523CC0D3972ae3e": { coingeckoId: "usd-coin", decimals: 6 }, - "0xfa6F64DFbad14e6883321C2f756f5B22fF658f9C": { coingeckoId: "matic-network", decimals: 18 }, - "0x53813CD4aCD7145A716B4686b195511FA93e4Cb7": { coingeckoId: "dai", decimals: 18 }, - "0x7Dc31a2FCBfbAd1ed4519111Fd33f78316BcBC81": { coingeckoId: "shark", decimals: 18 } - }, - meter: { - [nullAddress]: { coingeckoId: "meter", decimals: 18 }, - "0x5729cb3716a315d0bde3b5e489163bf8b9659436": { coingeckoId: "meter", decimals: 18 }, - "0x160361ce13ec33c993b5cca8f62b6864943eb083": { coingeckoId: "meter", decimals: 18 }, - "0xd86e243fc0007e6226b07c9a50c9d70d78299eb5": { coingeckoId: "usd-coin", decimals: 6 }, - "0x6abaedab0ba368f1df52d857f24154cc76c8c972": { coingeckoId: "meter-stable", decimals: 18 }, - "0x24aa189dfaa76c671c279262f94434770f557c35": { coingeckoId: "binance-usd", decimals: 18 }, - "0x75fd6f7edcc5e7a8100ead3d29ccd844153ef0f3": { coingeckoId: "theta-fuel", decimals: 18 }, - "0x5fa41671c48e3c951afc30816947126ccc8c162e": { coingeckoId: "tether", decimals: 6 } - }, - callisto: { - "0xF5AD6F6EDeC824C7fD54A66d241a227F6503aD3a": { coingeckoId: "callisto", decimals: 18 }, - "0xbf6c50889d3a620eb42c0f188b65ade90de958c4": { coingeckoId: "tether", decimals: 18 }, - "0xccc766f97629a4e14b3af8c91ec54f0b5664a69f": { coingeckoId: "ethereum-classic", decimals: 18 }, - "0xcc208c32cc6919af5d8026dab7a3ec7a57cd1796": { coingeckoId: "ethereum", decimals: 18 }, - "0xccde29903e621ca12df33bb0ad9d1add7261ace9": { coingeckoId: "binancecoin", decimals: 18 }, - "0x9FaE2529863bD691B4A7171bDfCf33C7ebB10a65": { coingeckoId: "soy-finance", decimals: 18 }, - }, - thundercore: { - "0x413cefea29f2d07b8f2acfa69d92466b9535f717": { coingeckoId: "thunder-token", decimals: 18 }, - "0x4f3c8e20942461e2c3bdd8311ac57b0c222f2b82": { coingeckoId: "tether", decimals: 6 }, - "0x6576bb918709906dcbfdceae4bb1e6df7c8a1077": { coingeckoId: "ethereum", decimals: 18 }, - "0x22e89898a04eaf43379beb70bf4e38b1faf8a31e": { coingeckoId: "usd-coin", decimals: 6 }, - "0xbeb0131d95ac3f03fd15894d0ade5dbf7451d171": { coingeckoId: "binance-usd", decimals: 18 }, - }, - conflux: { - "0x14b2d3bc65e74dae1030eafd8ac30c533c976a9b": { coingeckoId: "conflux-token", decimals: 18 }, - "0x1f545487c62e5acfea45dcadd9c627361d1616d8": { coingeckoId: "wrapped-bitcoin", decimals: 18 }, - "0xa47f43de2f9623acb395ca4905746496d2014d57": { coingeckoId: "ethereum", decimals: 18 }, - "0x6963efed0ab40f6c3d7bda44a05dcf1437c44372 ": { coingeckoId: "usd-coin", decimals: 18, }, - "0xfe97e85d13abd9c1c33384e796f10b73905637ce": { coingeckoId: "tether", decimals: 18, }, - }, - ethereum: { - "0xf6b1c627e95bfc3c1b4c9b825a032ff0fbf3e07d": { coingeckoId: "jpyc", decimals: 18 }, - "0xa80505c408C4DEFD9522981cD77e026f5a49FE63": { coingeckoId: "neuy", decimals: 18 }, - "0x97fe22e7341a0cd8db6f6c021a24dc8f4dad855f": { coingeckoId: "jarvis-synthetic-british-pound", decimals: 18 }, - "0x0f83287ff768d1c1e17a42f44d644d7f22e8ee1d": { coingeckoId: "upper-swiss-franc", decimals: 18 }, - "0x9fcf418b971134625cdf38448b949c8640971671": { coingeckoId: "tether-eurt", decimals: 18 }, - "0x8751d4196027d4e6da63716fa7786b5174f04c15": { coingeckoId: "wrapped-bitcoin", decimals: 18 }, - "0xf56b164efd3cfc02ba739b719b6526a6fa1ca32a": { coingeckoId: "curio-governance", decimals: 18 }, - "0xb1c9bc94aCd2fAE6aABf4ffae4429B93512a81D2": { coingeckoId: "ariadne", decimals: 18 }, - "0x5067006f830224960fb419d7f25a3a53e9919bb0": { coingeckoId: "smartpad-2", decimals: 18 }, - "0x2e9d63788249371f1dfc918a52f8d799f4a38c94": { coingeckoId: "tokemak", decimals: 18 }, - "0x6b3595068778dd592e39a122f4f5a5cf09c90fe2": { coingeckoId: "sushi", decimals: 18 }, - }, - moonbeam: { - // celer bridge - "0x81ecac0d6be0550a00ff064a4f9dd2400585fe9c": { coingeckoId: "tether", decimals: 6 }, - "0x6a2d262d56735dba19dd70682b39f6be9a931d98": { coingeckoId: "usd-coin", decimals: 6 }, - "0x6959027f7850adf4916ff5fdc898d958819e5375": { coingeckoId: "ethereum", decimals: 18 }, - "0x4edf8e0778967012d46968ceadb75436d0426f88": { coingeckoId: "bepro-network", decimals: 18 }, - }, - moonriver: { - "0xcb4a593ce512d78162c58384f0b2fd6e802c2c47": { coingeckoId: "bepro-network", decimals: 18 }, - }, - muuchain: { - "0x875358f6194d7c622d6355455f3137cceb2955c4": { coingeckoId: "muu-inu", decimals: 18 }, - }, - iotex: { - [nullAddress]: { coingeckoId: "iotex", decimals: 18 }, - '0xA00744882684C3e4747faEFD68D283eA44099D03': { coingeckoId: "iotex", decimals: 18 }, - "0x3fe04320885e6124231254c802004871be681218": { coingeckoId: "mcn-ventures", decimals: 18 }, - "0xe1ce1c0fa22ec693baca6f5076bcdc4d0183de1c": { coingeckoId: "elk-finance", decimals: 18 }, - "0x6fbcdc1169b5130c59e72e51ed68a84841c98cd1": { coingeckoId: "tether", decimals: 6 }, - "0x3cdb7c48e70b854ed2fa392e21687501d84b3afc": { coingeckoId: "tether", decimals: 6 }, - "0x3b2bf2b523f54c4e454f08aa286d03115aff326c": { coingeckoId: "usd-coin", decimals: 6 }, - "0xc04da3a99d17135857bb937d2fbb321d3b6c6a81": { coingeckoId: "usd-coin", decimals: 6 }, - "0x42C9255D5e522e83B16ea11a3BA04c2D3AfCA079": { coingeckoId: "tether", decimals: 18 }, - "0x037346E5a5722957Ac2cAb6ceb8c74fC18Cea91D": { coingeckoId: "usd-coin", decimals: 18 }, - '0x84abcb2832be606341a50128aeb1db43aa017449': { coingeckoId: "binance-usd", decimals: 18 }, - '0xacee9b11cd4b3f57e58880277ac72c8c41abe4e4': { coingeckoId: "iobusd", decimals: 18 }, - '0x62a9d987cbf4c45a550deed5b57b200d7a319632': { coingeckoId: "dai", decimals: 18 }, - '0x1CbAd85Aa66Ff3C12dc84C5881886EEB29C1bb9b': { coingeckoId: "dai", decimals: 18 }, - '0xd6070ae98b8069de6b494332d1a1a81b6179d960': { coingeckoId: "xdollar-stablecoin", decimals: 18 }, - '0xec690cdd448e3cbb51ed135df72301c3265a8f80': { coingeckoId: "xdollar-stablecoin", decimals: 18 }, - '0x4d7b88403aa2f502bf289584160db01ca442426c': { coingeckoId: "cyclone-protocol", decimals: 18 }, - '0x0258866edaf84d6081df17660357ab20a07d0c80': { coingeckoId: "ethereum", decimals: 18 }, - '0xc7b93720f73b037394ce00f954f849ed484a3dea': { coingeckoId: "wrapped-btcoin", decimals: 8 }, - '0x17df9fbfc1cdab0f90eddc318c4f6fcada730cf2': { coingeckoId: "game-fantasy-token", decimals: 18 }, - '0x4752456e00def6025c77b55a88a2f8a1701f92f9': { coingeckoId: "metanyx", decimals: 18 }, - '0x490cfbf9b9c43633ddd1968d062996227ef438a9': { coingeckoId: "imagictoken", decimals: 18 }, - '0x97e6c48867fdc391a8dfe9d169ecd005d1d90283': { coingeckoId: "binancecoin", decimals: 18 }, - '0x86702a7f8898b172de396eb304d7d81207127915': { coingeckoId: "zoomswap", decimals: 18 }, - '0x8e66c0d6b70c0b23d39f4b21a1eac52bba8ed89a': { coingeckoId: "matic-network", decimals: 18 }, - '0x176CB5113b4885B3a194Bd69056AC3fE37A4b95c': { coingeckoId: "parrot-egg", decimals: 18 }, - '0x99b2b0efb56e62e36960c20cd5ca8ec6abd5557a': { coingeckoId: "crosschain-iotx", decimals: 18 }, - }, - polygon: { - '0xfc40a4f89b410a1b855b5e205064a38fc29f5eb5': { coingeckoId: "rusd", decimals: 18 }, - '0x4c28f48448720e9000907bc2611f73022fdce1fa': { coingeckoId: "matic-network", decimals: 18 }, - '0x6CAcfaF65b1B1f9979aCF463a393A112D0980982': { coingeckoId: "matic-network", decimals: 18 }, - "0x14743e1c6f812154f7ecc980d890f0f5234103e7": { coingeckoId: "apyswap", decimals: 18, }, - '0x5c4b7ccbf908e64f32e12c6650ec0c96d717f03f': { coingeckoId: "binancecoin", decimals: 18 }, - }, - heco: { - "0x90e8896b12a92D51CD213b681C2CaD83A9a6bD49": { coingeckoId: "apyswap", decimals: 18, }, - }, - ronin: { - '0xe514d9deb7966c8be0ca922de8a064264ea6bcd4': { coingeckoId: "ronin", decimals: 18 }, - '0x97a9107c1793bc407d6f527b77e7fff4d812bece': { coingeckoId: "axie-infinity", decimals: 18 }, - '0xa8754b9fa15fc18bb59458815510e40a12cd2014': { coingeckoId: "smooth-love-potion", decimals: 0 }, - '0xc99a6a985ed2cac1ef41640596c5a5f9f4e19ef5': { coingeckoId: "ethereum", decimals: 18 }, - '0x0b7007c13325c48911f73a2dad5fa5dcbf808adc': { coingeckoId: "usd-coin", decimals: 6 }, - }, - arbitrum_nova: { - [nullAddress]: { coingeckoId: "ethereum", decimals: 18 }, - '0x722E8BdD2ce80A4422E880164f2079488e115365': { coingeckoId: "ethereum", decimals: 18 }, - '0xda10009cbd5d07dd0cecc66161fc93d7c9000da1': { coingeckoId: "dai", decimals: 18 }, - '0x52484e1ab2e2b22420a25c20fa49e173a26202cd': { coingeckoId: "tether", decimals: 6 }, - '0x750ba8b76187092b0d1e87e28daaf484d1b5273b': { coingeckoId: "usd-coin", decimals: 6 }, - }, - ethpow: { - [nullAddress]: { coingeckoId: "ethereum-pow-iou", decimals: 18 }, - '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2': { coingeckoId: "ethereum-pow-iou", decimals: 18 }, - '0x0c9f28FBdFd79f7C00B805d8c63D053c146d282c': { coingeckoId: "billionhappiness", decimals: 18 }, - '0x7bf88d2c0e32de92cdaf2d43ccdc23e8edfd5990': { coingeckoId: "ethereum-pow-iou", decimals: 18 }, - - // Multichain - '0x11bbB41B3E8baf7f75773DB7428d5AcEe25FEC75': { coingeckoId: "usd-coin", decimals: 6 }, - '0x8a496486f4c7cb840555bc2be327cba1447027c3': { coingeckoId: "tether", decimals: 6 }, - '0x5df101f56ea643e06066392d266e9f4366b9186d': { coingeckoId: "wrapped-bitcoin", decimals: 8 }, - '0xaf3ccfd9b59b36628cc2f659a09d6440795b2520': { coingeckoId: "ethereum", decimals: 18 }, - '0x312b15d6d531ea0fe91ddd212db8c0f37e4cc698': { coingeckoId: "dai", decimals: 18 }, - - // chainge - '0x2ad7868ca212135c6119fd7ad1ce51cfc5702892': { coingeckoId: "tether", decimals: 6 }, - '0x34a9c05b638020a07bb153bf624c8763bf8b4a86': { coingeckoId: "ethereum", decimals: 18 }, - '0xbd1563046a90f18127fd39f3481fd8d6ab22877f': { coingeckoId: "binancecoin", decimals: 18 }, - '0xf61eb8999f2f222f425d41da4c2ff4b6d8320c87': { coingeckoId: "binance-usd", decimals: 18 }, - '0x4bbd68d8b1f25ae7b460e3347c637fe9e7338e0c': { coingeckoId: "wrapped-bitcoin", decimals: 8 }, - '0x25de68ef588cb0c2c8f3537861e828ae699cd0db': { coingeckoId: "usd-coin", decimals: 6 }, - '0x0b35d852dcb8b59eb1e8d3182ebad4e96e2df8f0': { coingeckoId: "dai", decimals: 18 }, - }, - xdc: { - '0xD4B5f10D61916Bd6E0860144a91Ac658dE8a1437': { coingeckoId: "tether", decimals: 6 }, - // '0xc6ae1db6c66d909f7bfeeeb24f9adb8620bf9dbf': { coingeckoId: "usd-coin", decimals: 6 }, - // '0x1289f70b8a16797cccbfcca8a845f36324ac9f8b': { coingeckoId: "ethereum", decimals: 18 }, - [nullAddress]: { coingeckoId: "xdce-crowd-sale", decimals: 18 }, - '0x951857744785e80e2de051c32ee7b25f9c458c42': { coingeckoId: "xdce-crowd-sale", decimals: 18 }, - '0x36726235dadbdb4658d33e62a249dca7c4b2bc68': { coingeckoId: "xswap-protocol", decimals: 18 }, - '0x5d5f074837f5d4618b3916ba74de1bf9662a3fed': { coingeckoId: "storx", decimals: 18 }, - '0xd04275e2fd2875beaade6a80b39a75d4fe267df6': { coingeckoId: "nota", decimals: 6 }, - '0xff7412ea7c8445c46a8254dfb557ac1e48094391': { coingeckoId: "plugin", decimals: 18 }, - }, - elrond: { - [nullAddress]: { coingeckoId: "coingecko:elrond-erd-2", decimals: 18 }, - "AERO-458bbf": { coingeckoId: "coingecko:aerovek-aviation", decimals: 0 }, - "KOSON-5dd4fa": { coingeckoId: "coingecko:age-of-zalmoxis-koson", decimals: 0 }, - "ASH-a642d1": { coingeckoId: "coingecko:ashswap", decimals: 0 }, - "BSK-baa025": { coingeckoId: "coingecko:beskar", decimals: 0 }, - "BHAT-c1fde3": { coingeckoId: "coingecko:bhnetwork", decimals: 0 }, - "CRT-52decf": { coingeckoId: "coingecko:cantina-royale", decimals: 0 }, - "CTP-298075": { coingeckoId: "coingecko:captain-planet", decimals: 0 }, - "CHECKR-60108b": { coingeckoId: "coingecko:checkerchain", decimals: 0 }, - "CYC-b4ed61": { coingeckoId: "coingecko:cyc-lock", decimals: 0 }, - "LPAD-84628f": { coingeckoId: "coingecko:erdlaunchpad", decimals: 0 }, - "EVLD-43f56f": { coingeckoId: "coingecko:evoload", decimals: 0 }, - "FITY-73f8fc": { coingeckoId: "coingecko:fity", decimals: 0 }, - "ISET-84e55e": { coingeckoId: "coingecko:isengard-nft-marketplace", decimals: 0 }, - "ITHEUM-df6f26": { coingeckoId: "coingecko:itheum", decimals: 0 }, - "erd1hmfwpvsqn8ktzw3dqd0ltpcyfyasgv8mr9w0qecnmpexyp280y8q47ca9d": { coingeckoId: "coingecko:jexchange", decimals: 0 }, - "KRO-df97ec": { coingeckoId: "coingecko:krogan", decimals: 0 }, - "LAND-40f26f": { coingeckoId: "coingecko:landboard", decimals: 0 }, - "QWT-46ac01": { coingeckoId: "coingecko:qowatt", decimals: 0 }, - "SUPER-507aa6": { coingeckoId: "coingecko:superciety", decimals: 0 }, - "TLC-1a2357": { coingeckoId: "coingecko:tlchain", decimals: 0 }, - "UPARK-982dd6": { coingeckoId: "coingecko:upark", decimals: 0 }, - "erd1qqqqqqqqqqqqqpgq3ahw8fctzfnwgvq2g4hjsqzkkvgl9ksr2jps646dnj": { coingeckoId: "coingecko:vital-network", decimals: 0 }, - "WEGLD-bd4d79": { coingeckoId: "coingecko:wrapped-elrond", decimals: 0 }, - "MEX-455c57": { coingeckoId: "coingecko:maiar-dex", decimals: 0 }, - } -} - -const nftPriceFeeds = { - ethereum: [ - { // Art Blocks - token: "0x059EDD72Cd353dF5106D2B9cC5ab83a52287aC3a", - oracle: "0xEbF67AB8cFF336D3F609127E8BbF8BD6DD93cd81", - }, - { // Azuki - token: "0xed5af388653567af2f388e6224dc7c4b3241c544", - oracle: "0xA9cdBbDE36803af377735233e6BD261cDA5aD11d", - }, - { // BAKC - token: "0xba30E5F9Bb24caa003E9f2f0497Ad287FDF95623", - oracle: "0x17297f67e84b4fD7301161398F87a7f22a44DA7f", - }, - { // BAYC - token: "0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d", - oracle: "0x0CA05B24795eb4f5bA5237e1D4470048cc0fE235", - }, - { // Beanz - token: "0x306b1ea3ecdf94aB739F1910bbda052Ed4A9f949", - oracle: "0x5524b79F4E2D1289fcCc8Aa78eaE34D8C6daBE37", - }, - { // CloneX - token: "0x49cf6f5d44e70224e2e23fdcdd2c053f30ada28b", - oracle: "0x13E6C463BEC76873E4e63ce5169e9a95b7e06801", - }, - { // Cool Cats - token: "0x1A92f7381B9F03921564a437210bB9396471050C", - oracle: "0xB9D28F5a83f00c2558f7CBd8f10252D39cF15AE4", - }, - { // Cryptoadz - token: "0x1CB1A5e65610AEFF2551A50f76a87a7d3fB649C6", - oracle: "0x3c8D79D378366c9f118109B87edEdB448C6EfbbA", - }, - { // Cryptodickbutts - token: "0x42069ABFE407C60cf4ae4112bEDEaD391dBa1cdB", - oracle: "0x22Ab04060Bb1891b84F19334076B051240BA92E1", - }, - { // Cryptopunks - token: "0xb7f7f6c52f2e2fdb1963eab30438024864c313f6", - oracle: "0x35f08E1b5a18F1F085AA092aAed10EDd47457484", - }, - { // Cyberbrokers - token: "0x892848074ddeA461A15f337250Da3ce55580CA85", - oracle: "0x2d6696be4fce9c6707dea0c328a7842aea80ed51", - }, - { // Decentraland - token: "0xF87E31492Faf9A91B02Ee0dEAAd50d51d56D5d4d", - oracle: "0xf0294D938624859Ea5705C6F4Cb2436cc840d04b", - }, - { // Digidaigaku - token: "0xd1258DB6Ac08eB0e625B75b371C023dA478E94A9", - oracle: "0x071FE3f051cA7D41fF1Cd08A94368B0d0703f9b1", - }, - { // Doodles - token: "0x8a90cab2b38dba80c64b7734e58ee1db38b8992e", - oracle: "0x68Ff67118F778Bd158DA8D49B156aC5Ad9d8c4Ed", - }, - { // Forgotten Rune Wizards Cult - token: "0x521f9C7505005CFA19A8E5786a9c3c9c9F5e6f42", - oracle: "0x4da2765FFCFC0eEd625F450B9A1A1C89c919DbE8", - }, - { // Goblin Town - token: "0xbCe3781ae7Ca1a5e050Bd9C4c77369867eBc307e", - oracle: "0x11a67a301b80BC9b8cC0A5826b84876fb8542CaF", - }, - { // LobsterDAO - token: "0x026224A2940bFE258D0dbE947919B62fE321F042", - oracle: "0xd2fa1CAcF83C9889f215d0492BFceE717D149a6e", - }, - { // MAYC - token: "0x60e4d786628fea6478f785a6d7e704777c86a7c6", - oracle: "0xE6A7b525609bF47889ac9d0e964ebB640750a01C", - }, - { // Meebits - token: "0x7bd29408f11d2bfc23c34f18275bbf23bb716bc7", - oracle: "0x29Ea94760f211A338eCef4a31F09d8Cef1795755", - }, - { // Milady - token: "0x5Af0D9827E0c53E4799BB226655A1de152A425a5", - oracle: "0xf04205d907aD314c717EFec0d2D3d97626130E19", - }, - { // Moonbirds - token: "0x23581767a106ae21c074b2276d25e5c3e136a68b", - oracle: "0x16De3b3D1620675D7BD240abEf4CE4F119462Bbd", - }, - { // Nouns - token: "0x9c8ff314c9bc7f6e59a9d9225fb22946427edc03", - oracle: "0x363B6E3648847B988B7C8E3A306e0881BdEE24Bd", - }, - { // Otherdeed - token: "0x34d85c9CDeB23FA97cb08333b511ac86E1C4E258", - oracle: "0xAa6128fAdBd64aAd55d2A235827d976508649509", - }, - { // Pudgy Penguins - token: "0xbd3531da5cf5857e7cfaa92426877b022e612cf8", - oracle: "0xaC9962D846D431254C7B3Da3AA12519a1E2Eb5e7", - }, - { // Sandbox Land - token: "0x5cc5b05a8a13e3fbdb0bb9fccd98d38e50f90c38", - oracle: "0xa62b4828a9f4b2e3cba050c6befdd8f0a0056af4", - }, - { // VeeFriends - token: "0xa3aee8bce55beea1951ef834b99f3ac60d1abeeb", - oracle: "0x94360bfC0Fc7191D6195395351b1fb8e03Cd0c24", - }, - { // World of Women - token: "0xe785e82358879f061bc3dcac6f0444462d4b5330", - oracle: "0x9996adBA1BA04635f2567210fA42e1ff185E201F", - }, - ] } ibcChains.forEach(chain => fixBalancesTokens[chain] = { ...ibcMappings, ...(fixBalancesTokens[chain] || {}) }) @@ -1373,34 +77,137 @@ for (const [chain, mapping] of Object.entries(fixBalancesTokens)) normalizeMapping(mapping, chain) for (const [chain, mapping] of Object.entries(coreAssets)) - coreAssets[chain] = mapping.map(i => stripTokenHeader(i, chain)) + coreAssets[chain] = Object.values(mapping).map(i => stripTokenHeader(i, chain)) -function getCoreAssets(chain) { +function getCoreAssets(chain = 'ethereum') { const tokens = [ coreAssets[chain] || [], Object.keys(transformTokens[chain] || {}), Object.keys(fixBalancesTokens[chain] || {}), ].flat() - return getUniqueAddresses(tokens, chain) + let addresses = getUniqueAddresses(tokens, chain) + if (ibcChains.includes(chain)) addresses.push(...coreAssets.ibc) + if (anyswapTokenBlacklist[chain]) addresses = addresses.filter(i => !anyswapTokenBlacklist[chain].includes(i)) + return addresses } -function normalizeAddress(address, chain) { +function normalizeAddress(address, chain, extractChain = false) { + if (!chain && extractChain && address.includes(':')) chain = address.split(':')[0] if (caseSensitiveChains.includes(chain)) return address return address.toLowerCase() } function stripTokenHeader(token, chain) { - if (chain === 'aptos') return token.replace(/^aptos\:/, '') + if (chain === 'aptos') return token.replace(/^aptos:/, '') token = normalizeAddress(token, chain); if (chain && !token.startsWith(chain)) return token; return token.indexOf(":") > -1 ? token.split(":")[1] : token; } +const eulerTokens = [ + "0x1b808f49add4b8c6b5117d9681cf7312fcf0dc1d", + "0xe025e3ca2be02316033184551d4d3aa22024d9dc", + "0xeb91861f8a4e1c12333f42dce8fb0ecdc28da716", + "0x4d19f33948b99800b6113ff3e83bec9b537c85d2", + "0x5484451a88a35cd0878a1be177435ca8a0e4054e", + "0x64ad6d2472de5ddd3801fb4027c96c3ee7a7ee82", + // 4626 wrapped eTokens + "0x60897720aa966452e8706e74296b018990aec527", + "0x3c66B18F67CA6C1A71F829E2F6a0c987f97462d0", + "0x4169Df1B7820702f566cc10938DA51F6F597d264", + "0xbd1bd5c956684f7eb79da40f582cbe1373a1d593", +] + +const anyswapTokenBlacklist = { + ethereum: [ADDRESSES.ethereum.FTM], + fantom: [ + ADDRESSES.fantom.anyUSDC, + ADDRESSES.fantom.fUSDT, + ADDRESSES.fantom.USDC, + ADDRESSES.fantom.fUSDT, + ADDRESSES.fantom.DAI, + ADDRESSES.fantom.MIM, + ADDRESSES.fantom.nICE + ], + harmony: [ADDRESSES.harmony.AVAX], + kcc: [ + ADDRESSES.moonriver.USDC, + ADDRESSES.moonriver.ETH, + ADDRESSES.kcc.DAI, + ADDRESSES.kcc.WBTC + ], + moonriver: [ + ADDRESSES.moonriver.USDT, + ADDRESSES.moonriver.USDC, + ADDRESSES.moonriver.ETH + ], + arbitrum: [ADDRESSES.arbitrum.MIM], + shiden: [ + ADDRESSES.telos.ETH, + ADDRESSES.telos.USDC, + ADDRESSES.shiden.JPYC, + ADDRESSES.shiden.ETH, + ADDRESSES.dogechain.BUSD, + ADDRESSES.shiden.BUSD + ], + telos: [ + ADDRESSES.telos.ETH, + ADDRESSES.telos.WBTC, + ADDRESSES.telos.USDC, + ADDRESSES.telos.USDT + ], + syscoin: [ + ADDRESSES.syscoin.USDC, + ADDRESSES.syscoin.ETH, + ADDRESSES.syscoin.USDT + ], + boba: [ADDRESSES.boba.BUSD], + velas: [ + ADDRESSES.moonriver.ETH, + ADDRESSES.moonriver.USDC + ], + dogechain: [ + ADDRESSES.moonriver.USDT, + ADDRESSES.dogechain.BUSD, + ADDRESSES.dogechain.MATIC + ], + kava: [ + ADDRESSES.telos.ETH, + ADDRESSES.moonriver.USDT, + ADDRESSES.telos.USDC, + ADDRESSES.shiden.ETH, + ADDRESSES.syscoin.ETH, + ADDRESSES.moonriver.USDC, + ADDRESSES.dogechain.BUSD + ], + step: [ + ADDRESSES.moonriver.USDC, + ADDRESSES.telos.ETH, + ADDRESSES.telos.USDC, + ADDRESSES.telos.USDT + ], + godwoken_v1: [ + ADDRESSES.moonriver.USDC, + ADDRESSES.shiden.ETH, + ADDRESSES.telos.ETH, + ADDRESSES.moonriver.USDT + ], + milkomeda_a1: [ADDRESSES.telos.ETH], + wemix: [ + ADDRESSES.boba.BUSD, + ADDRESSES.shiden.ETH, + ADDRESSES.moonriver.USDC + ], + eos_evm: [ + ADDRESSES.syscoin.USDT, + ADDRESSES.shiden.ETH, + ADDRESSES.telos.ETH, + ADDRESSES.telos.USDT + ] +} + module.exports = { - tokens, - tokensBare, - nftPriceFeeds, - unsupportedGeckoChains, + nullAddress, caseSensitiveChains, transformTokens, fixBalancesTokens, @@ -1409,4 +216,6 @@ module.exports = { ibcChains, stripTokenHeader, getUniqueAddresses, -} \ No newline at end of file + distressedAssts, + eulerTokens, +} diff --git a/projects/helper/tokenholders.js b/projects/helper/tokenholders.js deleted file mode 100644 index e752224b7b9..00000000000 --- a/projects/helper/tokenholders.js +++ /dev/null @@ -1,58 +0,0 @@ -const { sumTokens } = require('./unwrapLPs') -const sdk = require('@defillama/sdk') - - -const WETH = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2" - -function normalizeArray(arrayOrString){ - if(Array.isArray(arrayOrString)){ - return arrayOrString - }else { - return [arrayOrString] - } -} - -function tokenHolderBalances(tokenHolderMap, chain = 'ethereum') { - return async (timestamp, block, chainBlocks) => { - if (chain !== 'ethereum') block = chainBlocks[chain] - const tokensAndHolders = [] - let ethHolders = [] - for (const group of tokenHolderMap) { - const holders = normalizeArray(group.holders); - const tokens = normalizeArray(group.tokens) - if (group.checkETHBalance === true) { - ethHolders = ethHolders.concat(holders) - } - tokens.forEach(token => { - holders.forEach(holder => { - tokensAndHolders.push([token, holder]) - }) - }) - } - - const balances = {}; - await sumTokens(balances, tokensAndHolders, block, chain); - if (ethHolders.length > 0) { - const ethBalances = await sdk.api.eth.getBalances({ - targets: ethHolders, - block, - chain, - }) - let nativeToken = WETH - switch (chain) { - case 'bsc': nativeToken = 'bsc:0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c'; break; // wbnb - case 'polygon': nativeToken = '0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0'; break; // matic - case 'xdai': nativeToken = '0x6b175474e89094c44da98b954eedeac495271d0f'; break; // xdai - case 'avax': nativeToken = 'avax:0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7'; break; // avax - } - ethBalances.output.forEach(ethBal => { - sdk.util.sumSingleBalance(balances, nativeToken, ethBal.balance) - }) - } - return balances - } -} - -module.exports = { - tokenHolderBalances -} \ No newline at end of file diff --git a/projects/helper/tomb.js b/projects/helper/tomb.js index a4c17a21e81..ba6f784d496 100644 --- a/projects/helper/tomb.js +++ b/projects/helper/tomb.js @@ -1,8 +1,8 @@ const { staking, stakingUnknownPricedLP } = require("./staking"); const { pool2Exports } = require("./pool2"); const sdk = require("@defillama/sdk"); -const token0Abi = require("./abis/token0.json"); -const token1Abi = require("./abis/token1.json"); +const token0Abi = 'address:token0' +const token1Abi = 'address:token1' const { default: BigNumber } = require("bignumber.js"); function tombTvl(token, share, rewardPool, masonry, pool2LPs, chain = "ethereum", transform = undefined, tokensOnCoingecko = true, lpWithShare = undefined) { diff --git a/projects/helper/treasury.js b/projects/helper/treasury.js new file mode 100644 index 00000000000..c8c22f74c83 --- /dev/null +++ b/projects/helper/treasury.js @@ -0,0 +1,88 @@ +const ADDRESSES = require('./coreAssets.json') +const { sumTokensExport, nullAddress, } = require('../helper/sumTokens') +const { covalentGetTokens } = require('./http') +const axios = require("axios") + +const ARB = ADDRESSES.arbitrum.ARB; + +function treasuryExports(config) { + const chains = Object.keys(config) + const exportObj = { } + chains.forEach(chain => { + let { ownTokenOwners = [], ownTokens = [], owners = [], fetchTokens = false, tokens = [], blacklistedTokens = [] } = config[chain] + if (chain === 'solana') config[chain].solOwners = owners + if (chain === 'solana') config[chain].solOwners = owners + const tvlConfig = { ...config[chain] } + tvlConfig.blacklistedTokens = [...ownTokens, ...blacklistedTokens] + if(fetchTokens === true){ + exportObj[chain] = { tvl: async (_, _b, _cb, { api }) => { + const tokens = await Promise.all(owners.map(address=>covalentGetTokens(address, chain))) + const uniqueTokens = new Set([...config[chain].tokens, ...tokens.flat()]) + tvlConfig.tokens = Array.from(uniqueTokens) + return sumTokensExport(tvlConfig)(_, _b, _cb, api) + }} + } else { + if (chain === 'arbitrum') { + tvlConfig.tokens = [...tokens, ARB] + } + exportObj[chain] = { tvl: sumTokensExport(tvlConfig) } + } + + if (ownTokens.length > 0) { + const { solOwners, ...otherOptions } = config[chain] + const options = { ...otherOptions, owners: [...owners, ...ownTokenOwners], tokens: ownTokens, chain, uniV3WhitelistedTokens: ownTokens} + exportObj[chain].ownTokens = sumTokensExport(options) + } + }) + return exportObj +} + +async function getComplexTreasury(owners){ + const networks = ["ethereum", "polygon", "optimism", "gnosis", "binance-smart-chain", "fantom", "avalanche", "arbitrum", + "celo", "harmony", "moonriver", "bitcoin", "cronos", "aurora", "evmos"] + const data = await axios.get(`https://api.zapper.xyz/v2/balances/apps?${owners.map(a=>`addresses=${a}`).join("&")}&${networks.map(a=>`networks=${a}`).join("&")}`, { + headers:{ + Authorization: `Basic ${btoa(process.env.ZAPPER_API_KEY)}` + } + }) + let sum = 0 + data.data.forEach(d=>{ + sum+=d.balanceUSD + }) + return sum +} + +function ohmStaking(exports) { + const dummyTvl = () => ({}) + const newExports = {} + Object.entries(exports).forEach(([chain, value]) => { + if (typeof value === 'object' && typeof value.tvl === 'function') { + newExports[chain] = { ...value, tvl: dummyTvl} + } else { + newExports[chain] = value + } + }) + return newExports +} + +function ohmTreasury(exports) { + const dummyTvl = () => ({}) + const newExports = {} + Object.entries(exports).forEach(([chain, value]) => { + if (typeof value === 'object' && typeof value.staking === 'function') { + newExports[chain] = { ...value,} + delete newExports[chain].staking + } else { + newExports[chain] = value + } + }) + return newExports +} + +module.exports = { + nullAddress, + treasuryExports, + getComplexTreasury, + ohmTreasury, + ohmStaking, +} diff --git a/projects/helper/uniswapV3.js b/projects/helper/uniswapV3.js new file mode 100644 index 00000000000..1075b062b8c --- /dev/null +++ b/projects/helper/uniswapV3.js @@ -0,0 +1,84 @@ +const { sumTokens2 } = require('./unwrapLPs') +const { getLogs } = require('./cache/getLogs') +const { request, } = require('graphql-request') + +const uniswapConfig = { + eventAbi: 'event PoolCreated(address indexed token0, address indexed token1, uint24 indexed fee, int24 tickSpacing, address pool)', + topics: ['0x783cca1c0412dd0d695e784568c96da2e9c22ff989357a2e8b1d9b2b4e6b7118'], +} + +const algebraConfig = { + eventAbi: 'event Pool (address indexed token0, address indexed token1, address pool)', + topics: ['0x91ccaa7a278130b65168c3a0c8d3bcae84cf5e43704342bd3ec0b59e59c036db'], +} + +function uniV3Export(config) { + const exports = {} + + Object.keys(config).forEach(chain => { + let { factory: target, fromBlock, topics, eventAbi, isAlgebra, blacklistedTokens = [] } = config[chain] + if (!topics) topics = isAlgebra ? algebraConfig.topics : uniswapConfig.topics + if (!eventAbi) eventAbi = isAlgebra ? algebraConfig.eventAbi : uniswapConfig.eventAbi + + exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const logs = await getLogs({ + api, + target, + topics, + fromBlock, + eventAbi, + onlyArgs: true, + }) + + return sumTokens2({ api, ownerTokens: logs.map(i => [[i.token0, i.token1], i.pool]), blacklistedTokens, permitFailure: logs.length > 5000 }) + } + } + }) + + + return exports +} + +function uniV3GraphExport({ blacklistedTokens = [], graphURL }) { + return async (_, _b, _cb, { api }) => { + const size = 1000 + let lastId = '' + let pools + + const graphQueryPagedWithBlock = ` + query poolQuery($lastId: String, $block: Int) { + pools(block: { number: $block } first:${size} where: {id_gt: $lastId totalValueLockedUSD_gt: 100}) { + id + token0 { id } + token1 { id } + } + } + ` + const graphQueryPagedWithoutBlock = ` + query poolQuery($lastId: String) { + pools(first:${size} where: {id_gt: $lastId totalValueLockedUSD_gt: 100}) { + id + token0 { id } + token1 { id } + } + } + ` + const graphQueryPaged = api.block ? graphQueryPagedWithBlock : graphQueryPagedWithoutBlock + + do { + const params = { lastId, block: api.block } + const res = await request(graphURL, graphQueryPaged, params); + pools = res.pools + const tokensAndOwners = pools.map(i => ([[i.token0.id, i.id], [i.token1.id, i.id]])).flat() + await sumTokens2({ api, tokensAndOwners, blacklistedTokens }) + lastId = pools[pools.length - 1]?.id + } while (pools.length === size) + } +} + + +module.exports = { + uniV3Export, + uniV3GraphExport, +} diff --git a/projects/helper/unknownTokens.js b/projects/helper/unknownTokens.js index 9dcd1fa18b6..8eb44efb5bc 100644 --- a/projects/helper/unknownTokens.js +++ b/projects/helper/unknownTokens.js @@ -1,429 +1,13 @@ const sdk = require('@defillama/sdk'); -const symbol = require('./abis/symbol.json') -const token0 = require('./abis/token0.json'); -const token1 = require('./abis/token1.json'); const masterchefAbi = require('./abis/masterchef.json') -const getReserves = require('./abis/getReserves.json'); -const kslpABI = require('./abis/kslp.js'); -const { getChainTransform, stripTokenHeader, getFixBalances, transformBalances, transformDexBalances, } = require('./portedTokens') -const { requery, } = require('./getUsdUniTvl') +const { getChainTransform, getFixBalances, transformBalances, } = require('./portedTokens') const { getCoreAssets } = require('./tokenMapping') const { sumTokens, sumTokens2, nullAddress, } = require('./unwrapLPs') -const { isLP, getUniqueAddresses, DEBUG_MODE, sliceIntoChunks, sleep, log } = require('./utils') -const factoryAbi = require('./abis/factory.json'); -const { default: BigNumber } = require('bignumber.js') - -const customLPHandlers = { - klaytn: { - kslp: { - lpFilter: (symbol, addr, chain) => chain === 'klaytn' && symbol === 'KSLP', - abis: { - getReservesABI: kslpABI.getCurrentPool, - token0ABI: kslpABI.tokenA, - token1ABI: kslpABI.tokenB, - }, - } - } -} - -async function getLPData({ - block, - chain = 'ethereum', - lps = [], // list of token addresses (all need not be LPs, code checks and filters out non LPs) - allLps = false, // if set true, assumes all tokens provided as lps are lps and skips validation/filtering - abis = {}, - lpFilter = isLP, -}) { - lps = getUniqueAddresses(lps) - const pairAddresses = allLps ? lps : await getLPList({ lps, chain, block, lpFilter, }) - const pairCalls = pairAddresses.map((pairAddress) => ({ target: pairAddress, })) - let token0Addresses, token1Addresses - - [token0Addresses, token1Addresses] = await Promise.all([ - sdk.api.abi.multiCall({ abi: abis.token0ABI || token0, chain, calls: pairCalls, block, }).then(({ output }) => output), - sdk.api.abi.multiCall({ abi: abis.token1ABI || token1, chain, calls: pairCalls, block, }).then(({ output }) => output), - ]); - await requery(token0Addresses, chain, block, token0); - await requery(token1Addresses, chain, block, token1); - const pairs = {}; - // add token0Addresses - token0Addresses.forEach((token0Address) => - pairs[token0Address.input.target] = { - token0Address: token0Address.output.toLowerCase(), - } - ) - token1Addresses.forEach((token1Address) => { - if (!pairs[token1Address.input.target]) pairs[token1Address.input.target] = {} - pairs[token1Address.input.target].token1Address = token1Address.output.toLowerCase() - }) - return pairs -} - -async function getLPList({ lps, chain, block, lpFilter = isLP, }) { - lps = lps.filter(i => i !== nullAddress) - const callArgs = lps.map(t => ({ target: t })) - let symbols = (await sdk.api.abi.multiCall({ calls: callArgs, abi: symbol, block, chain })).output - symbols = symbols.filter(item => lpFilter(item.output, item.input.target, chain)) - // log(symbols.filter(item => item.output !== 'Cake-LP').map(i => `token: ${i.input.target} Symbol: ${i.output}`).join('\n')) - log('LP symbols:', getUniqueAddresses(symbols.map(i => i.output)).join(', ')) - return symbols.map(item => item.input.target.toLowerCase()) -} - -async function getTokenPrices({ - block, - chain = 'ethereum', - abis = {}, // if some protocol uses custom abi instead of standard one - useDefaultCoreAssets = false, // use pre-defined list - coreAssets = [], // list of tokens that can used as base token to price unknown tokens against (Note: order matters, is there are two LPs for a token, the core asset with a lower index is used) - blacklist = [], // list of tokens to ignore/blacklist - whitelist = [], // if set, tvl/price is computed only for these tokens - lps = [], // list of token addresses (all need not be LPs, code checks and filters out non LPs) - transformAddress, // function for transforming token address to coingecko friendly format - allLps = false, // if set true, assumes all tokens provided as lps are lps and skips validation/filtering - minLPRatio = 0.5, // if a token pool has less that this percent of core asset tokens compared to a token pool with max tokens for a given core asset, this token pool is not used for price calculation - restrictTokenRatio = 10, // while computing tvl, an unknown token value can max be x times the pool value, default 100 times pool value - log_coreAssetPrices = [], - log_minTokenValue = 1e6, // log only if token value is higer than this value, now minimum is set as 1 million - lpFilter, // override the default logic for checking if an address is LP based on it's symbol -}) { - let counter = 0 - if (!transformAddress) - transformAddress = await getChainTransform(chain) - - if (!coreAssets.length && useDefaultCoreAssets) - coreAssets = getCoreAssets(chain) - - coreAssets = coreAssets.map(i => i.toLowerCase()) - blacklist = blacklist.map(i => i.toLowerCase()) - whitelist = whitelist.map(i => i.toLowerCase()) - lps = getUniqueAddresses(lps) - const pairAddresses = allLps ? lps : await getLPList({ lps, chain, block, lpFilter }) - const pairCalls = pairAddresses.map((pairAddress) => ({ target: pairAddress, })) - - let token0Addresses, token1Addresses, reserves - - [token0Addresses, token1Addresses, reserves] = await Promise.all([ - sdk.api.abi.multiCall({ abi: abis.token0ABI || token0, chain, calls: pairCalls, block, }).then(({ output }) => output), - sdk.api.abi.multiCall({ abi: abis.token1ABI || token1, chain, calls: pairCalls, block, }).then(({ output }) => output), - sdk.api.abi.multiCall({ abi: abis.getReservesABI || getReserves, chain, calls: pairCalls, block, }).then(({ output }) => output), - ]); - await requery(token0Addresses, chain, block, token0); - await requery(token1Addresses, chain, block, token1); - await requery(reserves, chain, block, getReserves); - - - const pairs = {}; - // add token0Addresses - token0Addresses.forEach((token0Address) => { - const tokenAddress = token0Address.output.toLowerCase(); - - const pairAddress = token0Address.input.target.toLowerCase(); - pairs[pairAddress] = { - token0Address: tokenAddress, - } - }); - - // add token1Addresses - token1Addresses.forEach((token1Address) => { - const tokenAddress = token1Address.output.toLowerCase(); - const pairAddress = token1Address.input.target.toLowerCase(); - pairs[pairAddress] = { - ...(pairs[pairAddress] || {}), - token1Address: tokenAddress, - } - }); - - const prices = {} - const pairBalances = {} - const pairBalances2 = [] - - for (let i = 0; i < reserves.length; i++) { - const pairAddress = reserves[i].input.target.toLowerCase(); - const pair = pairs[pairAddress]; - pairBalances[pairAddress] = {} - const token0Address = pair.token0Address.toLowerCase() - const token1Address = pair.token1Address.toLowerCase() - const reserveAmounts = reserves[i].output - pairBalances2.push({ - token0:token0Address, - token1:token1Address, - token0Bal: reserveAmounts[0], - token1Bal: reserveAmounts[1], - }) - if (coreAssets.includes(token0Address) && coreAssets.includes(token1Address)) { - sdk.util.sumSingleBalance(pairBalances[pairAddress], token0Address, Number(reserveAmounts[0])) - sdk.util.sumSingleBalance(pairBalances[pairAddress], token1Address, Number(reserveAmounts[1])) - } else if (coreAssets.includes(token0Address)) { - sdk.util.sumSingleBalance(pairBalances[pairAddress], token0Address, Number(reserveAmounts[0]) * 2) - if (!blacklist.includes(token1Address) && (!whitelist.length || whitelist.includes(token1Address))) { - setPrice(prices, token1Address, reserveAmounts[0], reserveAmounts[1], token0Address) - } - } else if (coreAssets.includes(token1Address)) { - if (!reserveAmounts) log('missing reserves', pairAddress) - sdk.util.sumSingleBalance(pairBalances[pairAddress], token1Address, Number(reserveAmounts[1]) * 2) - if (!blacklist.includes(token0Address) && (!whitelist.length || whitelist.includes(token0Address))) { - setPrice(prices, token0Address, reserveAmounts[1], reserveAmounts[0], token1Address) - } - } else { - const isWhitelistedToken0 = !blacklist.includes(token0Address) - const isWhitelistedToken1 = !blacklist.includes(token1Address) - if (isWhitelistedToken0 && isWhitelistedToken1) { - sdk.util.sumSingleBalance(pairBalances[pairAddress], token0Address, Number(reserveAmounts[0])) - sdk.util.sumSingleBalance(pairBalances[pairAddress], token1Address, Number(reserveAmounts[1])) - } else if (isWhitelistedToken0) { - sdk.util.sumSingleBalance(pairBalances[pairAddress], token0Address, Number(reserveAmounts[0]) * 2) - } else if (isWhitelistedToken1) { - sdk.util.sumSingleBalance(pairBalances[pairAddress], token1Address, Number(reserveAmounts[1]) * 2) - } - } - } - - // set price of tokens that are not directly paired against core assets but with tokens that are paired against core tokens - - for (let i = 0; i < reserves.length; i++) { - const pairAddress = reserves[i].input.target.toLowerCase(); - const pair = pairs[pairAddress]; - const token0Address = pair.token0Address.toLowerCase() - const token1Address = pair.token1Address.toLowerCase() - const reserveAmounts = reserves[i].output - if ((coreAssets.includes(token0Address) && coreAssets.includes(token1Address)) - || coreAssets.includes(token0Address) - || coreAssets.includes(token1Address) - ) { // ignore these cases as tokens are already taken care of here - } else { - const isWhitelistedToken0 = !blacklist.includes(token0Address) - const isWhitelistedToken1 = !blacklist.includes(token1Address) - if (isWhitelistedToken0 && prices[token0Address] && !prices[token1Address]) { - pairBalances[pairAddress] = {} - const [coreTokenAmountInLP, tokenPrice, coreAsset,] = prices[token0Address] - const newCoreAmount = coreTokenAmountInLP * tokenPrice / 10 // we are diluting the amount of core tokens intentionally - const newTokenAmount = reserveAmounts[1] / 10 // also divided by 10 to keep price steady - // setPrice(prices, token1Address, newCoreAmount, newTokenAmount, coreAsset) - sdk.util.sumSingleBalance(pairBalances[pairAddress], token0Address, Number(reserveAmounts[0]) * 2) - } else if (isWhitelistedToken1 && prices[token1Address] && !prices[token0Address]) { - pairBalances[pairAddress] = {} - const [coreTokenAmountInLP, tokenPrice, coreAsset,] = prices[token1Address] - const newCoreAmount = coreTokenAmountInLP * tokenPrice / 10 // we are diluting the amount of core tokens intentionally - const newTokenAmount = reserveAmounts[0] / 10 // also divided by 10 to keep price steady - // setPrice(prices, token0Address, newCoreAmount, newTokenAmount, coreAsset) - sdk.util.sumSingleBalance(pairBalances[pairAddress], token1Address, Number(reserveAmounts[1]) * 2) - } - } - } - - if (!lpFilter && customLPHandlers[chain]) { // we want to handle custom LPs but dont want to end up in recorsive loop, hence this check - for (const customOptions of Object.values(customLPHandlers[chain])) { - const options = { ...arguments[0], ...customOptions } - const { prices: customPrices, pairBalances: customPairBalances, pairs: customPairs } = await getTokenPrices(options) - // add custom LP data to existing data - Object.entries(customPairs).forEach(([key, value]) => pairs[key] = value) - Object.entries(customPrices).forEach(([key, value]) => prices[key] = value) - Object.entries(customPairBalances).forEach(([key, value]) => pairBalances[key] = value) - } - } - - filterPrices(prices) - const balances = {} - Object.keys(pairBalances).forEach(key => addBalances(pairBalances[key], balances, { pairAddress: key })) - const fixBalances = await getFixBalances(chain) - fixBalances(balances) - - return { - pairs, - updateBalances, - pairBalances, - prices, - balances, - pairBalances2, - } - - function setPrice(prices, address, coreAmount, tokenAmount, coreAsset) { - if (prices[address] !== undefined) { - const currentCoreAmount = prices[address][0] - const currentCoreAsset = prices[address][2] - // core asset higher on the list has higher preference - if (coreAssets.indexOf(currentCoreAmount) < coreAssets.indexOf(coreAsset)) return; - if ((currentCoreAsset === coreAsset) && coreAmount < currentCoreAmount) return; - } - if (Number(tokenAmount) > 0) - prices[address] = [Number(coreAmount), Number(coreAmount) / Number(tokenAmount), coreAsset, +Number(tokenAmount)] - } - - function getAssetPrice(asset) { - const assetIndex = coreAssets.indexOf(asset.toLowerCase()) - if (assetIndex === -1 || !log_coreAssetPrices[assetIndex]) return 1 / 1e18 - return log_coreAssetPrices[assetIndex] - } - - async function updateBalances(balances, { resolveLP = true, skipConversion = false, onlyLPs = false, } = {}) { - let lpAddresses = [] // if some of the tokens in balances are LP tokens, we resolve those as well - log('---updating balances-----') - const finalBalances = onlyLPs ? {} : balances - counter = 0 - Object.entries(balances).forEach(([address, amount = 0]) => { - const token = stripTokenHeader(address) - const price = prices[token]; - if (pairBalances[token]) { - lpAddresses.push(token) - return; - } - if (!price || skipConversion) return; - let tokenAmount = price[1] * +amount - const coreAsset = price[2] - const tokensInLP = price[3] - const coreTokenAmountInLP = price[0] - const maxAllowedAmount = coreTokenAmountInLP * restrictTokenRatio - // if (DEBUG_MODE && tokenAmount * getAssetPrice(coreAsset) > log_minTokenValue) - // log(`[converting balances] token vaule (in millions): ${(tokenAmount * getAssetPrice(coreAsset) / 1e6).toFixed(4)}, token value higher than pool: ${+amount > +tokensInLP} token: ${token} counter: ${++counter}`) - - if (tokenAmount > maxAllowedAmount) {// use token amount in pool if balances amount is higher than amount in pool - log(`[converting balances] Value to LP ratio: ${tokenAmount / tokensInLP} token: ${token} counter: ${++counter}`) - sdk.util.sumSingleBalance(balances, transformAddress(coreAsset), BigNumber(maxAllowedAmount).toFixed(0)) - balances[address] = BigNumber((tokenAmount - maxAllowedAmount) / price[1]).toFixed(0) - } else { - sdk.util.sumSingleBalance(balances, transformAddress(coreAsset), BigNumber(tokenAmount).toFixed(0)) - delete balances[address] - } - }) - - if (!resolveLP) { - fixBalances(balances) - return balances - } - - if (lpAddresses.length) { - const totalBalances = (await sdk.api.abi.multiCall({ - abi: 'erc20:totalSupply', calls: lpAddresses.map(i => ({ target: i })), block, chain - })).output - - totalBalances.forEach((item) => { - const token = item.input.target - const address = transformAddress(token) - const ratio = +item.output > 0 ? (+(balances[address]) || 0) / +item.output : 0 - addBalances(pairBalances[token], finalBalances, { ratio, pairAddress: token, skipConversion, }) - delete balances[address] - }) - } - - fixBalances(finalBalances) - return finalBalances - } - - - function addBalances(balances, finalBalances, { skipConversion = false, pairAddress, ratio = 1 }) { - if (ratio > 1) { - console.log(`There is bug in the code. Pair address: ${pairAddress}, ratio: ${ratio}`) - ratio = 1 - } - Object.entries(balances).forEach(([address, amount = 0]) => { - const price = prices[address]; - // const price = undefined; // NOTE: this is disabled till, we add a safeguard to limit LP manipulation to inflate token price, like mimimum core asset liquidity to be 10k - if (price && !skipConversion) { - const coreTokenAmountInLP = price[0] - const coreAsset = price[2] - const tokensInLP = price[3] - let tokenAmount = price[1] * +amount - const maxAllowedAmount = coreTokenAmountInLP * restrictTokenRatio - // if (DEBUG_MODE && tokenAmount * getAssetPrice(coreAsset) * ratio > log_minTokenValue) - // console.log(`[resolve LP balance] token vaule (in millions): ${(tokenAmount * getAssetPrice(coreAsset) * ratio / 1e6).toFixed(4)}, token value higher than pool: ${+amount > +tokensInLP} LP Address: ${pairAddress} token: ${address} ratio: ${ratio} counter: ${++counter}`) - - if (tokenAmount > maxAllowedAmount) {// use token amount in pool if balances amount is higher than amount in pool - log(`[converting balances] Value to LP ratio: ${tokenAmount / tokensInLP} LP Address: ${pairAddress} ratio: ${ratio} token: ${address} counter: ${++counter}`) - sdk.util.sumSingleBalance(balances, transformAddress(coreAsset), BigNumber(maxAllowedAmount * ratio).toFixed(0)) - } else { - sdk.util.sumSingleBalance(balances, transformAddress(coreAsset), BigNumber(tokenAmount * ratio).toFixed(0)) - } - } else { - if ((DEBUG_MODE && coreAssets.includes(address)) && (+amount * getAssetPrice(address) * ratio > log_minTokenValue)) - console.log(`[resolve LP balance] token vaule (in millions): ${(+amount * getAssetPrice(address) * ratio / 1e6).toFixed(4)}, LP Address: ${pairAddress} core token: ${address} ratio: ${ratio} counter: ${++counter}`) - sdk.util.sumSingleBalance(finalBalances, transformAddress(address), BigNumber(+amount * ratio).toFixed(0)) - } - }) - } - - // If we fetch prices from pools with low liquidity, the value of tokens can be absurdly high, so we set a threshold that if we are using a core asset to determine price, - // the amount of said core asset in a pool from which price is fetched must be at least 0.5% of the amount of core asset tokens in pool with highest core asset tokens - function filterPrices(prices) { - const maxCoreTokens = {} - Object.values(prices).forEach(([amount, _, coreAsset]) => { - if (!maxCoreTokens[coreAsset] || maxCoreTokens[coreAsset] < +amount) - maxCoreTokens[coreAsset] = +amount - }) - - Object.keys(prices).forEach(token => { - const priceArry = prices[token] - const [amount, _, coreAsset] = priceArry - if (!maxCoreTokens[coreAsset]) throw new Error('there is bug in the code') - const lpRatio = +amount * 100 / maxCoreTokens[coreAsset] - if (lpRatio < minLPRatio) delete prices[token] // current pool has less than 0.5% of tokens compared to pool with highest number of core tokens - }) - } -} - -function getUniTVL({ chain = 'ethereum', coreAssets = [], blacklist = [], whitelist = [], factory, transformAddress, - minLPRatio = 1, - log_coreAssetPrices = [], log_minTokenValue = 1e6, - withMetaData = false, - skipPair = [], - useDefaultCoreAssets = false, - abis = {}, - restrictTokenRatio, // while computing tvl, an unknown token value can max be x times the pool value, default 100 times pool value - fetchInChunks = 0, // if there are too many pairs, we might want to query in batches to avoid multicall failing and crashing - version = '1', -}) { - if (!coreAssets.length && useDefaultCoreAssets) { - coreAssets = getCoreAssets(chain) - } - const isVersion2 = version === '2' - if (fetchInChunks && isVersion2) { - throw new Error ('Not yet supported!') - } - - return async (ts, _block, { [chain]: block }) => { - - // get factory from LP - // console.log(await sdk.api.abi.call({ target: '0x463e451d05f84da345d641fbaa3129693ce13816', abi: { "inputs": [], "name": "factory", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, chain, block, })) - let pairAddresses; - const pairLength = (await sdk.api.abi.call({ target: factory, abi: abis.allPairsLength || factoryAbi.allPairsLength, chain, block })).output - if (pairLength === null) - throw new Error("allPairsLength() failed") - - log(chain, ' No. of pairs: ', pairLength) - - let pairNums = Array.from(Array(Number(pairLength)).keys()) - if (skipPair.length) pairNums = pairNums.filter(i => !skipPair.includes(i)) - - if (fetchInChunks === 0) { - let pairs = (await sdk.api.abi.multiCall({ abi: abis.allPairs || factoryAbi.allPairs, chain, calls: pairNums.map(num => ({ target: factory, params: [num] })), block })).output - await requery(pairs, chain, block, factoryAbi.allPairs); - - pairAddresses = pairs.map(result => result.output.toLowerCase()) - const response = await getTokenPrices({ - block, chain, coreAssets, blacklist, lps: pairAddresses, transformAddress, whitelist, allLps: true, - minLPRatio, log_coreAssetPrices, log_minTokenValue, restrictTokenRatio, abis, - }) - if (isVersion2) return transformDexBalances({ chain, data: response.pairBalances2, }) - return withMetaData ? response : response.balances - } else { - let i = 0 - const allBalances = {} - const chunks = sliceIntoChunks(pairNums, fetchInChunks) - for (const chunk of chunks) { - log(`fetching ${++i} of ${chunks.length}`) - let pairs = (await sdk.api.abi.multiCall({ abi: factoryAbi.allPairs, chain, calls: chunk.map(num => ({ target: factory, params: [num] })), block })).output - await requery(pairs, chain, block, factoryAbi.allPairs); - pairAddresses = pairs.map(result => result.output.toLowerCase()) - const { balances } = await getTokenPrices({ - block, chain, coreAssets, blacklist, lps: pairAddresses, transformAddress, whitelist, allLps: true, - minLPRatio, log_coreAssetPrices, log_minTokenValue, restrictTokenRatio, abis, - }) - Object.entries(balances).forEach(([token, value]) => sdk.util.sumSingleBalance(allBalances, token, value)) - } - return allBalances - } - } -} +const { vestingHelper } = require('./cache/vestingHelper') +const { getTokenPrices, sumUnknownTokens, getLPData, } = require('./cache/sumUnknownTokens') +const { getUniTVL } = require('./cache/uniswap') +const { getUniqueAddresses, } = require('./utils') function unknownTombs({ token = [], shares = [], rewardPool = [], masonry = [], lps, chain = "ethereum", coreAssets = [], useDefaultCoreAssets = false, }) { @@ -487,11 +71,12 @@ function unknownTombs({ token = [], shares = [], rewardPool = [], masonry = [], } } -function pool2({ stakingContract, lpToken, chain = "ethereum", transformAddress, coreAssets = [], useDefaultCoreAssets = false, }) { +function pool2({ stakingContract, lpToken, chain, transformAddress, coreAssets = [], useDefaultCoreAssets = false, }) { if (!coreAssets.length && useDefaultCoreAssets) coreAssets = getCoreAssets(chain) - return async (_timestamp, _ethBlock, chainBlocks) => { + return async (_timestamp, _ethBlock, chainBlocks, { api }) => { + if (!chain) chain = api.chain const block = chainBlocks[chain] if (!transformAddress) transformAddress = await getChainTransform(chain) @@ -507,84 +92,24 @@ function pool2({ stakingContract, lpToken, chain = "ethereum", transformAddress, } function sumTokensExport({ tokensAndOwners = [], - coreAssets = [], owner, tokens, chain = 'ethereum', restrictTokenRatio, blacklist = [], skipConversion = false, onlyLPs, minLPRatio, - log_coreAssetPrices = [], log_minTokenValue = 1e6, owners = [], lps = [], useDefaultCoreAssets = false, + coreAssets = [], owner, tokens, restrictTokenRatio, blacklist = [], skipConversion = false, onlyLPs, minLPRatio, + log_coreAssetPrices = [], log_minTokenValue = 1e6, owners = [], lps = [], useDefaultCoreAssets = false, abis, }) { - return (_, _b, { [chain]: block }) => sumUnknownTokens({ tokensAndOwners, coreAssets, owner, tokens, chain, block, restrictTokenRatio, blacklist, skipConversion, log_coreAssetPrices, log_minTokenValue, owners, lps, useDefaultCoreAssets, }) -} - -async function vestingHelper({ - coreAssets = [], owner, tokens, chain = 'ethereum', block, restrictTokenRatio, blacklist = [], skipConversion = false, onlyLPs, minLPRatio, - log_coreAssetPrices = [], log_minTokenValue = 1e6, useDefaultCoreAssets = false, -}) { - if (!coreAssets.length && useDefaultCoreAssets) - coreAssets = getCoreAssets(chain) - - tokens = getUniqueAddresses(tokens) - blacklist = getUniqueAddresses(blacklist) - tokens = tokens.filter(t => !blacklist.includes(t)) - const chunks = sliceIntoChunks(tokens, 2000) - const finalBalances = {} - for (let i = 0; i < chunks.length; i++) { - log('resolving for %s/%s of total tokens: %s (chain: %s)', i + 1, chunks.length, tokens.length, chain) - let lps = await getLPList({ lps: chunks[i], chain, block }) // we count only LP tokens for vesting protocols - const balances = await sumTokens2({ chain, block, owner, tokens: lps }) - const lpBalances = {} - Object.entries(balances).forEach(([token, bal]) => { - if (bal && bal !== 0) - lpBalances[stripTokenHeader(token)] = bal - else - delete balances[token] - }) - lps = lps.filter(lp => lpBalances[lp]) // we only care about LPs that are still locked in the protocol, we can ignore withdrawn LPs - const { updateBalances } = await getTokenPrices({ coreAssets, lps, allLps: true, chain, block, restrictTokenRatio, blacklist, log_coreAssetPrices, log_minTokenValue, minLPRatio }) - await updateBalances(balances, { skipConversion, onlyLPs }) - Object.entries(balances).forEach(([token, bal]) => sdk.util.sumSingleBalance(finalBalances, token, bal)) - if (i !== 0 && i % 2 === 0) await sleep(3000) - } - const fixBalances = await getFixBalances(chain) - fixBalances(finalBalances) - return finalBalances -} - -async function sumUnknownTokens({ tokensAndOwners = [], balances = {}, - coreAssets = [], owner, tokens, chain = 'ethereum', block, restrictTokenRatio, blacklist = [], skipConversion = false, onlyLPs, minLPRatio, - log_coreAssetPrices = [], log_minTokenValue = 1e6, owners = [], lps = [], useDefaultCoreAssets = false, -}) { - if (!coreAssets.length && useDefaultCoreAssets) - coreAssets = getCoreAssets(chain) - blacklist = getUniqueAddresses(blacklist) - if (!tokensAndOwners.length) - if (owners.length) - tokensAndOwners = owners.map(o => tokens.map(t => [t, o])).flat() - else if (owner) - tokensAndOwners = tokens.map(t => [t, owner]) - tokensAndOwners = tokensAndOwners.filter(t => !blacklist.includes(t[0])) - await sumTokens2({ balances, chain, block, tokensAndOwners, skipFixBalances: true, }) - const { updateBalances, } = await getTokenPrices({ coreAssets, lps: [...tokensAndOwners.map(t => t[0]), ...lps,], chain, block, restrictTokenRatio, blacklist, log_coreAssetPrices, log_minTokenValue, minLPRatio }) - await updateBalances(balances, { skipConversion, onlyLPs }) - const fixBalances = await getFixBalances(chain) - fixBalances(balances) - return balances + return (_, _b, _cb, { api }) => sumUnknownTokens({ api, tokensAndOwners, onlyLPs, minLPRatio, coreAssets, owner, tokens, restrictTokenRatio, blacklist, skipConversion, log_coreAssetPrices, log_minTokenValue, owners, lps, useDefaultCoreAssets, abis, }) } function staking({ tokensAndOwners = [], - coreAssets = [], owner, tokens, chain = 'ethereum', restrictTokenRatio, blacklist = [], skipConversion = false, onlyLPs, minLPRatio, + coreAssets = [], owner, tokens, restrictTokenRatio, blacklist = [], skipConversion = false, onlyLPs, minLPRatio, log_coreAssetPrices = [], log_minTokenValue = 1e6, owners = [], lps = [], useDefaultCoreAssets = false, }) { - if (!coreAssets.length && useDefaultCoreAssets) - coreAssets = getCoreAssets(chain) - blacklist = getUniqueAddresses(blacklist) - if (!tokensAndOwners.length) - if (owners.length) - tokensAndOwners = owners.map(o => tokens.map(t => [t, o])).flat() - else if (owner) - tokensAndOwners = tokens.map(t => [t, owner]) - tokensAndOwners = tokensAndOwners.filter(t => !blacklist.includes(t[0])) - - return async (_, _b, { [chain]: block }) => { - const balances = await sumTokens2({ chain, block, tokensAndOwners }) + + return async (_, _b, _cb, { api, chain = 'ethereum', block, }) => { + if (!coreAssets.length && useDefaultCoreAssets) + coreAssets = getCoreAssets(chain) + + const balances = await sumTokens2({ api, owner, tokensAndOwners, owners, tokens, blacklistedTokens: blacklist, }) const { updateBalances, pairBalances, prices, } = await getTokenPrices({ coreAssets, lps: [...tokensAndOwners.map(t => t[0]), ...lps,], chain, block, restrictTokenRatio, blacklist, log_coreAssetPrices, log_minTokenValue, minLPRatio }) + // sdk.log(prices, pairBalances, balances) await updateBalances(balances, { skipConversion, onlyLPs }) const fixBalances = await getFixBalances(chain) fixBalances(balances) @@ -595,13 +120,13 @@ function staking({ tokensAndOwners = [], function masterchefExports({ chain, masterchef, coreAssets = [], nativeTokens = [], lps = [], nativeToken, poolInfoABI = masterchefAbi.poolInfo, poolLengthAbi = masterchefAbi.poolLength, getToken = output => output.lpToken, blacklistedTokens = [], useDefaultCoreAssets = false, }) { if (!coreAssets.length && useDefaultCoreAssets) coreAssets = getCoreAssets(chain) - let allTvl + let allTvl = {} if (nativeToken) nativeTokens.push(nativeToken) nativeTokens = getUniqueAddresses(nativeTokens) async function getAllTVL(block) { - if (!allTvl) allTvl = getTVL() - return allTvl + if (!allTvl[block]) allTvl[block] = getTVL() + return allTvl[block] async function getTVL() { const transform = await getChainTransform(chain) @@ -628,7 +153,7 @@ function masterchefExports({ chain, masterchef, coreAssets = [], nativeTokens = const tokens = data.map(({ output }) => getToken(output).toLowerCase()) const tokenLPs = [...tokens].filter(i => !nativeTokens.includes(i)) - const tempBalances = await sumTokens2({ chain, block, owner: masterchef, tokens, transformAddress: a => a, blacklistedTokens }) + const tempBalances = await sumTokens2({ chain, block, owner: masterchef, tokens, transformAddress: a => a, blacklistedTokens, skipFixBalances: true, }) nativeTokens.forEach(nativeToken => { if (tempBalances[nativeToken]) sdk.util.sumSingleBalance(balances.staking, transform(nativeToken), tempBalances[nativeToken]) delete tempBalances[nativeToken] @@ -676,33 +201,8 @@ function masterchefExports({ chain, masterchef, coreAssets = [], nativeTokens = } const yieldApis = { - balance: { - "inputs": [], - "name": "balance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - token: { - "type": "function", - "stateMutability": "view", - "outputs": [ - { - "type": "address", - "name": "", - "internalType": "contract IERC20" - } - ], - "name": "token", - "inputs": [] - } + balance: "uint256:balance", + token: "address:token", } async function yieldHelper({ chain = 'ethereum', block, coreAssets = [], blacklist = [], whitelist = [], vaults = [], transformAddress, @@ -734,10 +234,10 @@ async function yieldHelper({ chain = 'ethereum', block, coreAssets = [], blackli return transformBalances(chain, balances) } -function uniTvlExport(chain, factory) { +function uniTvlExport(chain, factory, options = {}) { return { misrepresentedTokens: true, - [chain]: { tvl: getUniTVL({ chain, factory, useDefaultCoreAssets: true })} + [chain]: { tvl: getUniTVL({ chain, factory, useDefaultCoreAssets: true, ...options }) } } } diff --git a/projects/helper/unwrapLPs.js b/projects/helper/unwrapLPs.js index bad59792968..ffe169255a8 100644 --- a/projects/helper/unwrapLPs.js +++ b/projects/helper/unwrapLPs.js @@ -1,138 +1,23 @@ +const ADDRESSES = require('./coreAssets.json') const sdk = require("@defillama/sdk"); const BigNumber = require("bignumber.js"); -const token0 = require('./abis/token0.json') -const symbol = require('./abis/symbol.json') -const { getPoolTokens, getPoolId, bPool, getCurrentTokens, getVault: getBalancerVault, } = require('./abis/balancer.json') -const getPricePerShare = require('./abis/getPricePerShare.json') -const underlyingABI = require('./abis/underlying.json') +const token0 = 'address:token0' +const symbol = 'string:symbol' +const { getPoolTokens, getPoolId, bPool, getCurrentTokens, } = require('./abis/balancer.json') const { requery } = require('./requery') const { getChainTransform, getFixBalances } = require('./portedTokens') +const { getUniqueAddresses, normalizeAddress } = require('./tokenMapping') const creamAbi = require('./abis/cream.json') -const { unwrapCrv, resolveCrvTokens } = require('./resolveCrvTokens') -const activePoolAbi = require('./ankr/abis/activePool.json') -const wethAddressAbi = require('./ankr/abis/wethAddress.json'); -const { isLP, DEBUG_MODE, getUniqueAddresses, log, } = require('./utils') -const wildCreditABI = require('../wildcredit/abi.json') - -const yearnVaults = { - // yvToken: underlying, eg yvYFI:YFI - // ycDAI - "0x99d1fa417f94dcd62bfe781a1213c092a47041bc": "0x6b175474e89094c44da98b954eedeac495271d0f", - // ycUSDC - "0x9777d7e2b60bb01759d0e2f8be2095df444cb07e": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", - // ycUSDT - "0x1be5d71f2da660bfdee8012ddc58d024448a0a59": "0xdac17f958d2ee523a2206206994597c13d831ec7", - // yDAI - "0xc2cb1040220768554cf699b0d863a3cd4324ce32": "0x6b175474e89094c44da98b954eedeac495271d0f", - // yUSDT - "0xe6354ed5bc4b393a5aad09f21c46e101e692d447": "0xdac17f958d2ee523a2206206994597c13d831ec7", - // yUSDC - "0xd6ad7a6750a7593e092a9b218d66c0a814a3436e": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", - // yUSDT - "0x83f798e925bcd4017eb265844fddabb448f1707d": "0xdac17f958d2ee523a2206206994597c13d831ec7", - // yvYFI v2 - "0xe14d13d8b3b85af791b2aadd661cdbd5e6097db1": "0x0bc529c00c6401aef6d220be8c6ea1667f6ad93e", - // yvWETH v2 - "0xa258c4606ca8206d8aa700ce2143d7db854d168c": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", - // yvWETH v1 - "0xa9fe4601811213c340e850ea305481aff02f5b28": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", - // yvUSDT v2 - "0x7da96a3891add058ada2e826306d812c638d87a7": "0xdac17f958d2ee523a2206206994597c13d831ec7", - // yvUSDC v2 - "0x5f18c75abdae578b483e5f43f12a39cf75b973a9": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", - // yvUSDC - "0xa354f35829ae975e850e23e9615b11da1b3dc4de": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", - // yvWBTC - "0xa696a63cc78dffa1a63e9e50587c197387ff6c7e": "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599", - // yv1INCH - "0xb8c3b7a2a618c552c23b1e4701109a9e756bab67": "0x111111111117dc0aa78b770fa6a738034120c302", - // yvDAI - "0x19d3364a399d251e894ac732651be8b0e4e85001": "0x6B175474E89094C44Da98b954EedeAC495271d0F", - // yvDAI - "0xacd43e627e64355f1861cec6d3a6688b31a6f952": "0x6B175474E89094C44Da98b954EedeAC495271d0F", - // yvDAI - "0xda816459f1ab5631232fe5e97a05bbbb94970c95": "0x6B175474E89094C44Da98b954EedeAC495271d0F", - // yvDAI - "0x16de59092dae5ccf4a1e6439d611fd0653f0bd01": "0x6B175474E89094C44Da98b954EedeAC495271d0F", - // yvSNX - "0xf29ae508698bdef169b89834f76704c3b205aedf": "0xC011a73ee8576Fb46F5E1c5751cA3B9Fe0af2a6F", - // yvUNI - "0xfbeb78a723b8087fd2ea7ef1afec93d35e8bed42": "0x1f9840a85d5af5bf1d1762f925bdaddc4201f984", - // yvLINK - "0x671a912c10bba0cfa74cfc2d6fba9ba1ed9530b2": "0x514910771af9ca656af840dff83e8264ecf986ca", - // yvCurve Aave 3pool - "0x39caf13a104ff567f71fd2a4c68c026fdb6e740b": "0xFd2a8fA60Abd58Efe3EeE34dd494cD491dC14900", - // yvcrvSTETH - "0xdcd90c7f6324cfa40d7169ef80b12031770b4325": "0x06325440d014e39736583c165c2963ba99faf14e", - // yvcrvIB - "0x27b7b1ad7288079a66d12350c828d3c00a6f07d7": "0x5282a4ef67d9c33135340fb3289cc1711c13638c", - // yvYFI FTM - "0x2c850cced00ce2b14aa9d658b7cad5df659493db": "0x29b0Da86e484E1C0029B56e817912d778aC0EC69", - // yvDAI FTM - "0x637ec617c86d24e421328e6caea1d92114892439": "0x8D11eC38a3EB5E956B052f67Da8Bdc9bef8Abf3E", - // yvETH FTM - "0xce2fc0bdc18bd6a4d9a725791a3dee33f3a23bb7": "0x74b23882a30290451A17c44f4F05243b6b58C76d", - // yvWBTC FTM - "0xd817a100ab8a29fe3dbd925c2eb489d67f758da9": "0x321162Cd933E2Be498Cd2267a90534A804051b11", - // yvMIM FTM - "0x0a0b23d9786963de69cb2447dc125c49929419d8": "0x82f0b8b456c1a451378467398982d4834b6829c1", - // yvUSDC FTM - "0xef0210eb96c7eb36af8ed1c20306462764935607": "0x04068da6c83afcfa0e13ba15a6696662335d5b75", - // yvWFTM FTM - "0x0dec85e74a92c52b7f708c4b10207d9560cefaf0": "0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83", - // yvUSDT FTM - "0x148c05caf1bb09b5670f00d511718f733c54bc4c": "0x049d68029688eAbF473097a2fC38ef61633A3C7A" -} -async function unwrapYearn(balances, yToken, block, chain = "ethereum", transformAddress = (addr) => addr, fetchUnderlying) { - let underlying = yearnVaults[yToken.toLowerCase()]; - if (!underlying) { - if (!fetchUnderlying) return; - const { output: _underlying } = await sdk.api.abi.call({ - target: yToken, - abi: underlyingABI, - chain, block, - }) - underlying = _underlying - } +const { isLP, log, } = require('./utils') +const { sumArtBlocks, whitelistedNFTs, } = require('./nft') +const wildCreditABI = require('../wildcredit/abi.json'); +const { covalentGetTokens, get } = require("./http"); +const { sliceIntoChunks } = require('@defillama/sdk/build/util'); - // console.log('underinglin found', underlying) - - const tokenKey = chain == 'ethereum' ? yToken : `${chain}:${yToken}` - if (!balances[tokenKey]) return; - - let pricePerShare - let decimals - try { - pricePerShare = await sdk.api.abi.call({ - target: yToken, - abi: getPricePerShare[1], - block: block, - chain: chain - }); - decimals = (await sdk.api.erc20.decimals(underlying, chain)).output - } catch (e) { - console.log('Failing to get price per share for %s, trying getPricePerFullShare', yToken) - } - if (pricePerShare == undefined) { - pricePerShare = await sdk.api.abi.call({ - target: yToken, - abi: getPricePerShare[0], - block: block, - chain: chain - }); - decimals = 18 - }; - - const newBalance = BigNumber(balances[tokenKey]).times(pricePerShare.output).div(10 ** decimals) - const oldBalance = BigNumber(balances[transformAddress(underlying)] || 0) - balances[transformAddress(underlying)] = oldBalance.plus(newBalance).toFixed(0) - delete balances[tokenKey]; -}; - -const lpReservesAbi = { "constant": true, "inputs": [], "name": "getReserves", "outputs": [{ "internalType": "uint112", "name": "_reserve0", "type": "uint112" }, { "internalType": "uint112", "name": "_reserve1", "type": "uint112" }, { "internalType": "uint32", "name": "_blockTimestampLast", "type": "uint32" }], "payable": false, "stateMutability": "view", "type": "function" } -const lpSuppliesAbi = { "constant": true, "inputs": [], "name": "totalSupply", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "payable": false, "stateMutability": "view", "type": "function" } -const token0Abi = { "constant": true, "inputs": [], "name": "token0", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "payable": false, "stateMutability": "view", "type": "function" } -const token1Abi = { "constant": true, "inputs": [], "name": "token1", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "payable": false, "stateMutability": "view", "type": "function" } +const lpReservesAbi = 'function getReserves() view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast)' +const lpSuppliesAbi = "uint256:totalSupply" +const token0Abi = "address:token0" +const token1Abi = "address:token1" /* lpPositions:{ balance, @@ -142,197 +27,54 @@ const token1Abi = { "constant": true, "inputs": [], "name": "token1", "outputs": async function unwrapUniswapLPs(balances, lpPositions, block, chain = 'ethereum', transformAddress = null, excludeTokensRaw = [], retry = false, uni_type = 'standard',) { if (!transformAddress) transformAddress = await getChainTransform(chain) + const api = new sdk.ChainApi({ chain, block }) lpPositions = lpPositions.filter(i => +i.balance > 0) const excludeTokens = excludeTokensRaw.map(addr => addr.toLowerCase()) - const lpTokenCalls = lpPositions.map(lpPosition => ({ - target: lpPosition.token - })) - const lpReserves = sdk.api.abi.multiCall({ - block, - abi: lpReservesAbi, - calls: lpTokenCalls, - chain - }) - const lpSupplies = sdk.api.abi.multiCall({ - block, - abi: lpSuppliesAbi, - calls: lpTokenCalls, - chain - }) - const tokens0 = sdk.api.abi.multiCall({ - block, - abi: token0Abi, - calls: lpTokenCalls, - chain - }) - const tokens1 = sdk.api.abi.multiCall({ - block, - abi: token1Abi, - calls: lpTokenCalls, - chain - }) - if (retry) { - await Promise.all([ - [lpReserves, lpReservesAbi], - [lpSupplies, lpSuppliesAbi], - [tokens0, token0Abi], - [tokens1, token1Abi] - ].map(async call => { - await requery(await call[0], chain, block, call[1]) - })) + const lpTokenCalls = lpPositions.map(i => i.token) + const [ + lpReserves, lpSupplies, tokens0, tokens1, + ] = await Promise.all([ + uni_type === 'standard' ? api.multiCall({ abi: lpReservesAbi, calls: lpTokenCalls, }) : null, + api.multiCall({ abi: lpSuppliesAbi, calls: lpTokenCalls, }), + api.multiCall({ abi: token0Abi, calls: lpTokenCalls, }), + api.multiCall({ abi: token1Abi, calls: lpTokenCalls, }), + ]) + let gelatoPools, gToken0Bals, gToken1Bals + if (uni_type === 'gelato') { + gelatoPools = await api.multiCall({ abi: gelatoPoolsAbi, calls: lpTokenCalls, }) + gToken1Bals = await api.multiCall({ abi: 'erc20:balanceOf', calls: gelatoPools.map((v, i) => ({ target: tokens0[i], params: v })), }) + gToken0Bals = await api.multiCall({ abi: 'erc20:balanceOf', calls: gelatoPools.map((v, i) => ({ target: tokens1[i], params: v })), }) } - await Promise.all(lpPositions.map(async lpPosition => { - try { - let token0, token1, supply - const lpToken = lpPosition.token - const token0_ = (await tokens0).output.find(call => call.input.target === lpToken) - const token1_ = (await tokens1).output.find(call => call.input.target === lpToken) - const supply_ = (await lpSupplies).output.find(call => call.input.target === lpToken) - - token0 = token0_.output.toLowerCase() - token1 = token1_.output.toLowerCase() - supply = supply_.output - // console.log(token0_, supply_, token1_, lpToken) - - if (supply === "0") { - return - } + lpPositions.map((lpPosition, i) => { + const token0 = tokens0[i].toLowerCase() + const token1 = tokens1[i].toLowerCase() + const supply = lpSupplies[i] - let _reserve0, _reserve1 - if (uni_type === 'standard') { - ({ _reserve0, _reserve1 } = (await lpReserves).output.find(call => call.input.target === lpToken).output) - } - else if (uni_type === 'gelato') { - const gelatoPools = sdk.api.abi.multiCall({ - block, - abi: gelatoPoolsAbi, - calls: lpTokenCalls, - chain - }); - const gelatoPool = (await gelatoPools).output.find(call => call.input.target === lpToken).output - const [{ output: _reserve0_ }, { output: _reserve1_ }] = (await Promise.all([ - sdk.api.erc20.balanceOf({ - target: token0, - owner: gelatoPool, - block, - chain - }) - , sdk.api.erc20.balanceOf({ - target: token1, - owner: gelatoPool, - block, - chain - }) - ])) - _reserve0 = _reserve0_ - _reserve1 = _reserve1_ - } - - if (!excludeTokens.includes(token0)) { - const token0Balance = BigNumber(lpPosition.balance).times(BigNumber(_reserve0)).div(BigNumber(supply)) - sdk.util.sumSingleBalance(balances, await transformAddress(token0), token0Balance.toFixed(0)) - } - if (!excludeTokens.includes(token1)) { - const token1Balance = BigNumber(lpPosition.balance).times(BigNumber(_reserve1)).div(BigNumber(supply)) - sdk.util.sumSingleBalance(balances, await transformAddress(token1), token1Balance.toFixed(0)) - } - } catch (e) { - if (DEBUG_MODE) console.error(e) - console.log(`Failed to get data for LP token at ${lpPosition.token} on chain ${chain}`) - throw e + if (supply === "0") { + return } - })) -} - - -// Mostly similar to unwrapGelatoLPs with only edits being gelatoToken0ABI, same for token1 and balances of tokens which are actually held by the contract which address is given by the read pool method -/* lpPositions:{ - balance, - token -}[] -*/ -const gelatoPoolsAbi = { "inputs": [], "name": "pool", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" } -async function unwrapGelatoLPs(balances, lpPositions, block, chain = 'ethereum', transformAddress = (addr) => addr, excludeTokensRaw = [], retry = false) { - const excludeTokens = excludeTokensRaw.map(addr => addr.toLowerCase()) - const lpTokenCalls = lpPositions.map(lpPosition => ({ - target: lpPosition.token - })) - const lpReserves = sdk.api.abi.multiCall({ - block, - abi: lpReservesAbi, - calls: lpTokenCalls, - chain - }) - const lpSupplies = sdk.api.abi.multiCall({ - block, - abi: lpSuppliesAbi, - calls: lpTokenCalls, - chain - }) - const tokens0 = sdk.api.abi.multiCall({ - block, - abi: token0Abi, - calls: lpTokenCalls, - chain - }) - const tokens1 = sdk.api.abi.multiCall({ - block, - abi: token1Abi, - calls: lpTokenCalls, - chain - }) + let _reserve0, _reserve1 + if (uni_type === 'standard') { + _reserve0 = lpReserves[i]._reserve0 + _reserve1 = lpReserves[i]._reserve1 + } else if (uni_type === 'gelato') { + _reserve0 = gToken0Bals[i] + _reserve1 = gToken1Bals[i] + } - // Different bit - if (retry) { - await Promise.all([ - [lpReserves, lpReservesAbi], - [lpSupplies, lpSuppliesAbi], - [tokens0, token0Abi], - [tokens1, token1Abi] - ].map(async call => { - await requery(await call[0], chain, block, call[1]) - })) - } - await Promise.all(lpPositions.map(async lpPosition => { - try { - const lpToken = lpPosition.token - const token0 = (await tokens0).output.find(call => call.input.target === lpToken).output.toLowerCase() - const token1 = (await tokens1).output.find(call => call.input.target === lpToken).output.toLowerCase() - const supply = (await lpSupplies).output.find(call => call.input.target === lpToken).output - - // Different bits - const gelatoPool = (await gelatoPools).output.find(call => call.input.target === lpToken).output - const [{ output: _reserve0 }, { output: _reserve1 }] = (await Promise.all([ - sdk.api.erc20.balanceOf({ - target: token0, - owner: gelatoPool, - block, - chain - }) - , sdk.api.erc20.balanceOf({ - target: token1, - owner: gelatoPool, - block, - chain - }) - ])) - - if (!excludeTokens.includes(token0)) { - const token0Balance = BigNumber(lpPosition.balance).times(BigNumber(_reserve0)).div(BigNumber(supply)) - sdk.util.sumSingleBalance(balances, await transformAddress(token0), token0Balance.toFixed(0)) - } - if (!excludeTokens.includes(token1)) { - const token1Balance = BigNumber(lpPosition.balance).times(BigNumber(_reserve1)).div(BigNumber(supply)) - sdk.util.sumSingleBalance(balances, await transformAddress(token1), token1Balance.toFixed(0)) - } - } catch (e) { - console.log(`Failed to get data for LP token at ${lpPosition.token} on chain ${chain}`) - throw e + const ratio = lpPosition.balance / supply + if (!excludeTokens.includes(token0)) { + sdk.util.sumSingleBalance(balances, transformAddress(token0), ratio * _reserve0) } - })) + if (!excludeTokens.includes(token1)) { + sdk.util.sumSingleBalance(balances, transformAddress(token1), ratio * _reserve1) + } + }) } +const gelatoPoolsAbi = 'address:pool' + // Unwrap the tokens that are LPs and directly add the others // To be used when you don't know which tokens are LPs and which are not async function addTokensAndLPs(balances, tokens, amounts, block, chain = "ethereum", transformAddress = id => id) { @@ -447,7 +189,9 @@ async function sumLPWithOnlyOneTokenOtherThanKnown(balances, lpToken, owner, tok } await sumLPWithOnlyOneToken(balances, lpToken, owner, listedToken, block, chain, transformAddress) } -async function unwrapUniswapV3NFTs({ balances = {}, nftsAndOwners = [], block, chain = 'ethereum', transformAddress, owner, nftAddress, owners }) { + +const PANCAKE_NFT_ADDRESS = '0x46A15B0b27311cedF172AB29E4f4766fbE7F4364' +async function unwrapUniswapV3NFTs({ balances = {}, nftsAndOwners = [], block, chain = 'ethereum', owner, nftAddress, owners, blacklistedTokens = [], whitelistedTokens = [], }) { if (!nftsAndOwners.length) { if (!nftAddress) switch (chain) { @@ -455,21 +199,26 @@ async function unwrapUniswapV3NFTs({ balances = {}, nftsAndOwners = [], block, c case 'polygon': case 'optimism': case 'arbitrum': nftAddress = '0xC36442b4a4522E871399CD717aBDD847Ab11FE88'; break; + case 'bsc': nftAddress = [PANCAKE_NFT_ADDRESS, '0x7b8a01b39d58278b5de7e48c8449c9f4f5170613']; break; + case 'evmos': nftAddress = '0x5fe5daaa011673289847da4f76d63246ddb2965d'; break; default: throw new Error('missing default uniswap nft address') } - if (!owners && owner) + if ((!owners || !owners.length) && owner) owners = [owner] - owners = getUniqueAddresses(owners) - nftsAndOwners = owners.map(o => [nftAddress, o]) + owners = getUniqueAddresses(owners, chain) + if (Array.isArray(nftAddress)) + nftsAndOwners = nftAddress.map(nft => owners.map(o => [nft, o])).flat() + else + nftsAndOwners = owners.map(o => [nftAddress, o]) } - await Promise.all(nftsAndOwners.map(([nftAddress, owner]) => unwrapUniswapV3NFT({ balances, owner, nftAddress, block, chain, transformAddress }))) + await Promise.all(nftsAndOwners.map(([nftAddress, owner]) => unwrapUniswapV3NFT({ balances, owner, nftAddress, block, chain, blacklistedTokens, whitelistedTokens, }))) return balances } -async function unwrapUniswapV3NFT({ balances, owner, nftAddress, block, chain = 'ethereum', transformAddress }) { - if (!transformAddress) - transformAddress = await getChainTransform(chain) +async function unwrapUniswapV3NFT({ balances, owner, nftAddress, block, chain = 'ethereum', blacklistedTokens = [], whitelistedTokens = [], }) { + blacklistedTokens = getUniqueAddresses(blacklistedTokens, chain) + whitelistedTokens = getUniqueAddresses(whitelistedTokens, chain) const nftPositions = (await sdk.api.erc20.balanceOf({ target: nftAddress, owner, block, chain })).output const factory = (await sdk.api.abi.call({ target: nftAddress, abi: wildCreditABI.factory, block, chain })).output @@ -534,11 +283,18 @@ async function unwrapUniswapV3NFT({ balances, owner, nftAddress, block, chain = amount1 = liquidity * (sb - sa) } - sdk.util.sumSingleBalance(balances, transformAddress(token0), new BigNumber(amount0).toFixed(0)) - sdk.util.sumSingleBalance(balances, transformAddress(token1), new BigNumber(amount1).toFixed(0)) + addToken({ balances, token: token0, amount: amount0, chain, blacklistedTokens, whitelistedTokens }) + addToken({ balances, token: token1, amount: amount1, chain, blacklistedTokens, whitelistedTokens }) } } +function addToken({ balances, token, amount, chain, blacklistedTokens = [], whitelistedTokens = [] }) { + const addr = normalizeAddress(token, chain) + if (blacklistedTokens.length && blacklistedTokens.includes(addr)) return; + if (whitelistedTokens.length && !whitelistedTokens.includes(addr)) return; + sdk.util.sumSingleBalance(balances, token, amount, chain) +} + /* tokens [ [token, owner, isLP] - eg ["0xaaa", "0xbbb", true] @@ -619,32 +375,42 @@ async function sumBalancerLps(balances, tokensAndOwners, block, chain, transform }) } -const nullAddress = '0x0000000000000000000000000000000000000000' -const gasTokens = [nullAddress, '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee'] +async function getTrxBalance(account) { + const data = await get('https://apilist.tronscan.org/api/account?address=' + account) + return data.balance + (data.totalFrozen || 0) +} + +const nullAddress = ADDRESSES.null +const gasTokens = [nullAddress, '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee', '0xbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb'] /* tokensAndOwners [ [token, owner] - eg ["0xaaa", "0xbbb"] ] */ -async function sumTokens(balances = {}, tokensAndOwners, block, chain = "ethereum", transformAddress, { resolveCrv = false, resolveLP = false, resolveYearn = false, unwrapAll = false, blacklistedLPs = [], skipFixBalances = false, abis = {}, } = {}) { +async function sumTokens(balances = {}, tokensAndOwners, block, chain = "ethereum", transformAddress, { resolveLP = false, unwrapAll = false, blacklistedLPs = [], skipFixBalances = false, abis = {}, permitFailure = false } = {}) { if (!transformAddress) transformAddress = await getChainTransform(chain) let ethBalanceInputs = [] tokensAndOwners = tokensAndOwners.filter(i => { - const token = i[0].toLowerCase() + const token = normalizeAddress(i[0], chain) if (token !== nullAddress && !gasTokens.includes(token)) return true ethBalanceInputs.push(i[1]) return false }) - ethBalanceInputs = getUniqueAddresses(ethBalanceInputs) + ethBalanceInputs = getUniqueAddresses(ethBalanceInputs, chain) if (ethBalanceInputs.length) { - const { output: ethBalances } = await sdk.api.eth.getBalances({ targets: ethBalanceInputs, chain, block }) - ethBalances.forEach(({ balance }) => sdk.util.sumSingleBalance(balances, transformAddress(nullAddress), balance)) + if (chain === "tron") { + const ethBalances = await Promise.all(ethBalanceInputs.map(getTrxBalance)) + ethBalances.forEach(balance => sdk.util.sumSingleBalance(balances, transformAddress(nullAddress), balance)) + } else { + const { output: ethBalances } = await sdk.api.eth.getBalances({ targets: ethBalanceInputs, chain, block }) + ethBalances.forEach(({ balance }) => sdk.util.sumSingleBalance(balances, transformAddress(nullAddress), balance)) + } } const balanceOfTokens = await sdk.api.abi.multiCall({ @@ -652,19 +418,20 @@ async function sumTokens(balances = {}, tokensAndOwners, block, chain = "ethereu target: t[0], params: t[1] })), + permitFailure, abi: 'erc20:balanceOf', block, chain }) - balanceOfTokens.output.forEach((result, idx) => { + balanceOfTokens.output.forEach((result) => { const token = transformAddress(result.input.target) - const balance = BigNumber(result.output) - try { - balances[token] = BigNumber(balances[token] || 0).plus(balance).toFixed(0) - } catch (e) { - console.log(token, balance, balances[token]) - throw e + let balance = BigNumber(result.output) + if (result.output === null || isNaN(+result.output)) { + sdk.log('failed for', token, balance, balances[token]) + if (permitFailure) balance = BigNumber(0) + else throw new Error('Unable to fetch balance for: ' + result.input.target) } + balances[token] = BigNumber(balances[token] || 0).plus(balance).toFixed(0) }) Object.entries(balances).forEach(([token, value]) => { @@ -674,14 +441,6 @@ async function sumTokens(balances = {}, tokensAndOwners, block, chain = "ethereu if (resolveLP || unwrapAll) await unwrapLPsAuto({ balances, block, chain, transformAddress, blacklistedLPs, abis, }) - if (resolveCrv || unwrapAll) - await resolveCrvTokens(balances, block, chain, transformAddress) - - if (resolveYearn || unwrapAll) { - await Promise.all(Object.keys(balances).map(token => unwrapYearn(balances, stripTokenHeader(token), block, chain, transformAddress))) - await resolveCrvTokens(balances, block, chain, transformAddress) - } - if (!skipFixBalances && ['astar', 'harmony', 'kava', 'thundercore', 'klaytn', 'evmos'].includes(chain)) { const fixBalances = await getFixBalances(chain) fixBalances(balances) @@ -725,80 +484,16 @@ async function unwrapCreamTokens(balances, tokensAndOwners, block, chain = "ethe }) } -const crv_abi = { - "crvLP_coins": { "stateMutability": "view", "type": "function", "name": "coins", "inputs": [{ "name": "arg0", "type": "uint256" }], "outputs": [{ "name": "", "type": "address" }], "gas": 3123 } -} -const tokenToPoolMapping = { - "0x3a283d9c08e8b55966afb64c515f5143cf907611": "0xb576491f1e6e5e62f1d8f26062ee822b40b0e0d4", - "0xed4064f376cb8d68f770fb1ff088a3d0f3ff5c4d": "0x8301ae4fc9c624d1d396cbdaa1ed877821d7c511" -} -async function genericUnwrapCrv(balances, crvToken, lpBalance, block, chain) { - const { output: resolvedCrvTotalSupply } = await sdk.api.erc20.totalSupply({ - target: crvToken, - chain, block - }) - - // Get Curve LP token balances - // A while-loop would need a try-catch because sending error when idx > tokens_count - const { output: crv_symbol } = await sdk.api.abi.call({ - abi: 'erc20:symbol', - target: crvToken, - chain, - block - }) - - const LP_tokens_count = ['3Crv'].includes(crv_symbol) ? 3 : 2 - const coins_indices = Array.from(Array(LP_tokens_count).keys()) - const coins = (await sdk.api.abi.multiCall({ - abi: crv_abi['crvLP_coins'], - calls: coins_indices.map(i => ({ params: [i] })), - target: tokenToPoolMapping[crvToken.toLowerCase()] || crvToken, - chain, - block - })).output.map(c => c.output.toLowerCase()) - const crvLP_token_balances = await sdk.api.abi.multiCall({ - abi: 'erc20:balanceOf', - calls: coins.map(c => ({ - target: c, - params: tokenToPoolMapping[crvToken.toLowerCase()] || crvToken, - })), - chain, - block - }) - - const transform = await getChainTransform(chain) - const wrappedGasToken = transform('0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee') - if (coins.includes(wrappedGasToken)) { - const gasTokenBalance = (await sdk.api.eth.getBalance({ - target: tokenToPoolMapping[crvToken.toLowerCase()] || crvToken, - block, - chain - })).output - crvLP_token_balances.output.push({ - output: gasTokenBalance, - input: { - target: wrappedGasToken - }, - success: true - }) - } - - // Edit the balances to weigh with respect to the wallet holdings of the crv LP token - crvLP_token_balances.output.forEach(call => - call.output = BigNumber(call.output).times(lpBalance).div(resolvedCrvTotalSupply).toFixed(0) - ) - sdk.util.sumMultiBalanceOf(balances, crvLP_token_balances); -} - const cvx_abi = { - "cvxBRP_pid": { "inputs": [], "name": "pid", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, - "cvxBRP_balanceOf": { "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], "name": "balanceOf", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, - "cvxBRP_earned": { "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], "name": "earned", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, - "cvxBRP_rewards": { "inputs": [{ "internalType": "address", "name": "", "type": "address" }], "name": "rewards", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, - "cvxBRP_userRewardPerTokenPaid": { "inputs": [{ "internalType": "address", "name": "", "type": "address" }], "name": "userRewardPerTokenPaid", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, - "cvxBRP_stakingToken": { "inputs": [], "name": "stakingToken", "outputs": [{ "internalType": "address", "name": "stakingToken", "type": "address" }], "stateMutability": "view", "type": "function" }, - "cvxBooster_poolInfo": { "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "name": "poolInfo", "outputs": [{ "internalType": "address", "name": "lptoken", "type": "address" }, { "internalType": "address", "name": "token", "type": "address" }, { "internalType": "address", "name": "gauge", "type": "address" }, { "internalType": "address", "name": "crvRewards", "type": "address" }, { "internalType": "address", "name": "stash", "type": "address" }, { "internalType": "bool", "name": "shutdown", "type": "bool" }], "stateMutability": "view", "type": "function" } + cvxBRP_pid: "uint256:pid", + cvxBRP_balanceOf: "function balanceOf(address account) view returns (uint256)", + cvxBRP_earned: "function earned(address account) view returns (uint256)", + cvxBRP_rewards: "function rewards(address) view returns (uint256)", + cvxBRP_userRewardPerTokenPaid: "function userRewardPerTokenPaid(address) view returns (uint256)", + cvxBRP_stakingToken: "address:stakingToken", + cvxBooster_poolInfo: "function poolInfo(uint256) view returns (address lptoken, address token, address gauge, address crvRewards, address stash, bool shutdown)", } + const cvxBoosterAddress = "0xF403C135812408BFbE8713b5A23a04b3D48AAE31"; async function genericUnwrapCvx(balances, holder, cvx_BaseRewardPool, block, chain) { // Compute the balance of the treasury of the CVX position and unwrap @@ -826,10 +521,39 @@ async function genericUnwrapCvx(balances, holder, cvx_BaseRewardPool, block, cha chain, block: block, }) - await genericUnwrapCrv(balances, crvPoolInfo.lptoken, cvx_LP_bal, block, chain) + sdk.util.sumSingleBalance(balances, crvPoolInfo.lptoken, cvx_LP_bal, chain) + return balances } -async function unwrapLPsAuto({ balances, block, chain = "ethereum", transformAddress, excludePool2 = false, onlyPool2 = false, pool2Tokens = [], blacklistedLPs = [], abis = {}, }) { +async function genericUnwrapCvxDeposit({ api, owner, token, balances }) { + if (!balances) balances = await api.getBalances() + const [bal, cToken] = await api.batchCall([ + { target: token, params: owner, abi: 'erc20:balanceOf' }, + { target: token, abi: 'address:curveToken' }, + ]) + sdk.util.sumSingleBalance(balances, cToken, bal, api.chain) + return balances +} + +async function genericUnwrapCvxRewardPool({ api, owner, pool, balances }) { + if (!balances) balances = await api.getBalances() + const [bal, cToken] = await api.batchCall([ + { target: pool, params: owner, abi: 'erc20:balanceOf' }, + { target: pool, abi: 'address:stakingToken' }, + ]) + sdk.util.sumSingleBalance(balances, cToken, bal, api.chain) + return balances +} + +async function unwrapLPsAuto({ api, balances, block, chain = "ethereum", transformAddress, excludePool2 = false, onlyPool2 = false, pool2Tokens = [], blacklistedLPs = [], abis = {}, }) { + if (api) { + chain = api.chain ?? chain + block = api.block ?? block + if (!balances) balances = api.getBalances() + } else { + api = new sdk.ChainApi({ chain, block }) + } + if (!transformAddress) transformAddress = await getChainTransform(chain) @@ -843,8 +567,11 @@ async function unwrapLPsAuto({ balances, block, chain = "ethereum", transformAdd delete balances[key] return; } - if (chain === 'ethereum' && key.indexOf(':') > -1) return; // token is transformed, probably not an LP - if (chain !== 'ethereum' && !key.startsWith(chain + ':')) return; // token is transformed, probably not an LP + if (chain === 'ethereum') { + if (!key.startsWith(chain + ':') && !key.startsWith('0x')) return; // token is transformed, probably not an LP + } else if (!key.startsWith(chain + ':')) { + return;// token is transformed, probably not an LP + } const token = stripTokenHeader(key) if (!/^0x/.test(token)) return; // if token is not an eth address, we ignore it tokens.push({ output: token }) @@ -856,7 +583,7 @@ async function unwrapLPsAuto({ balances, block, chain = "ethereum", transformAdd async function _addTokensAndLPs(balances, tokens, amounts) { const symbols = (await sdk.api.abi.multiCall({ - calls: tokens.map(t => ({ target: t.output })), abi: symbol, block, chain + calls: tokens.map(t => ({ target: t.output })), abi: symbol, block, chain, permitFailure: true, })).output const lpBalances = [] symbols.forEach(({ output }, idx) => { @@ -925,66 +652,94 @@ function stripTokenHeader(token) { return token.indexOf(':') > -1 ? token.split(':')[1] : token } -async function unwrapTroves({ balances = {}, chain = 'ethereum', block, troves = [], transformAddress }) { - const troveCalls = troves.map(target => ({ target })) - if (!transformAddress) - transformAddress = await getChainTransform(chain) - const [{ output: activePools }, { output: tokens }] = await Promise.all([ - sdk.api.abi.multiCall({ - block, - abi: activePoolAbi, - calls: troveCalls, - chain - }), - sdk.api.abi.multiCall({ - block, - abi: wethAddressAbi, - calls: troveCalls, - chain - }) - ]) - - const tokensAndOwners = [] - - for (let i = 0; i < troves.length; i++) { - tokensAndOwners.push([tokens[i].output || nullAddress, activePools[i].output ]) - } - - await sumTokens(balances, tokensAndOwners, block, chain, transformAddress, { resolveCrv: true, resolveLP: true, resolveYearn: true }) - return balances -} - async function sumTokens2({ - balances = {}, + balances, tokensAndOwners = [], + tokensAndOwners2 = [], + ownerTokens = [], tokens = [], owners = [], owner, block, chain = 'ethereum', transformAddress, - resolveCrv = false, resolveLP = false, - resolveYearn = false, unwrapAll = false, blacklistedLPs = [], blacklistedTokens = [], skipFixBalances = false, abis = {}, + api, + resolveUniV3 = false, + uniV3WhitelistedTokens = [], + uniV3nftsAndOwners = [], + resolveArtBlocks = false, + resolveNFTs = false, + permitFailure = false, + fetchCoValentTokens = false, }) { + if (api) { + chain = api.chain ?? chain + block = api.block ?? block + if (!balances) balances = api.getBalances() + } else if (!balances) { + balances = {} + } + + if (resolveArtBlocks || resolveNFTs) { + if (!api) throw new Error('Missing arg: api') + await sumArtBlocks({ balances, api, owner, owners, }) + } + + if (fetchCoValentTokens) { + if (!api) throw new Error('Missing arg: api') + if (!owners || !owners.length) owners = [owner] + const cTokens = (await Promise.all(owners.map(i => covalentGetTokens(i, api.chain)))).flat() + tokens = [...cTokens, ...tokens] + console.log('cTokens', cTokens.length) + } + + if (resolveNFTs) { + if (!api) throw new Error('Missing arg: api') + if (!owners || !owners.length) owners = [owner] + const nftTokens = (await Promise.all(owners.map(i => covalentGetTokens(i, api.chain)))).flat() + return sumTokens2({ balances, api, owners, tokens: [...nftTokens, ...tokens, ...(whitelistedNFTs[api.chain] || [])], }) + } + if (!tokensAndOwners.length) { - tokens = getUniqueAddresses(tokens) - owners = getUniqueAddresses(owners) + tokens = getUniqueAddresses(tokens, chain) + owners = getUniqueAddresses(owners, chain) if (owner) tokensAndOwners = tokens.map(t => [t, owner]) if (owners.length) tokensAndOwners = tokens.map(t => owners.map(o => [t, o])).flat() + if (ownerTokens.length) { + ownerTokens.map(([tokens, owner]) => { + if (typeof owner !== 'string') throw new Error('invalid config', owner) + if (!Array.isArray(tokens)) throw new Error('invalid config', tokens) + tokens.forEach(t => tokensAndOwners.push([t, owner])) + }) + } + if (tokensAndOwners2.length) { + const [_tokens, _owners] = tokensAndOwners2 + _tokens.forEach((v, i) => tokensAndOwners.push([v, _owners[i]])) + } } - blacklistedTokens = blacklistedTokens.map(t => t.toLowerCase()) - tokensAndOwners = tokensAndOwners.map(([t, o]) => [t.toLowerCase(), o]).filter(([token]) => !blacklistedTokens.includes(token)) + if (resolveUniV3 || uniV3nftsAndOwners.length) + await unwrapUniswapV3NFTs({ balances, chain, block, owner, owners, blacklistedTokens, whitelistedTokens: uniV3WhitelistedTokens, nftsAndOwners: uniV3nftsAndOwners, }) + + blacklistedTokens = blacklistedTokens.map(t => normalizeAddress(t, chain)) + tokensAndOwners = tokensAndOwners.map(([t, o]) => [normalizeAddress(t, chain), o]).filter(([token]) => !blacklistedTokens.includes(token)) tokensAndOwners = getUniqueToA(tokensAndOwners) log(chain, 'summing tokens', tokensAndOwners.length) - await sumTokens(balances, tokensAndOwners, block, chain, transformAddress, { resolveCrv, resolveLP, resolveYearn, unwrapAll, blacklistedLPs, skipFixBalances: true, abis, }) + if (chain === 'tron') { + const tokensAndOwnersChunks = sliceIntoChunks(tokensAndOwners, 3) + for (const toa of tokensAndOwnersChunks) { + await sumTokens(balances, toa, block, chain, transformAddress, { resolveLP, unwrapAll, blacklistedLPs, skipFixBalances: true, abis, permitFailure, }) + } + } else { + await sumTokens(balances, tokensAndOwners, block, chain, transformAddress, { resolveLP, unwrapAll, blacklistedLPs, skipFixBalances: true, abis, permitFailure, }) + } if (!skipFixBalances) { const fixBalances = await getFixBalances(chain) @@ -995,51 +750,101 @@ async function sumTokens2({ function getUniqueToA(toa) { toa = toa.map(i => i.join('-')) - return getUniqueAddresses(toa).map(i => i.split('-')) + return getUniqueAddresses(toa, chain).map(i => i.split('-')) } } -function sumTokensExport({ balances, tokensAndOwners, tokens, owner, owners, chain = 'ethereum', transformAddress, unwrapAll, resolveLP, blacklistedLPs, blacklistedTokens, skipFixBalances }) { - return async (_, _b, { [chain]: block }) => sumTokens2({ balances, tokensAndOwners, tokens, owner, owners, chain, block, transformAddress, unwrapAll, resolveLP, blacklistedLPs, blacklistedTokens, skipFixBalances }) +function sumTokensExport({ balances, tokensAndOwners, tokensAndOwners2, tokens, owner, owners, transformAddress, unwrapAll, resolveLP, blacklistedLPs, blacklistedTokens, skipFixBalances, ownerTokens, resolveUniV3, resolveArtBlocks, resolveNFTs, fetchCoValentTokens, ...args }) { + return async (_, _b, _cb, { api }) => sumTokens2({ api, balances, tokensAndOwners, tokensAndOwners2, tokens, owner, owners, transformAddress, unwrapAll, resolveLP, blacklistedLPs, blacklistedTokens, skipFixBalances, ownerTokens, resolveUniV3, resolveArtBlocks, resolveNFTs, fetchCoValentTokens, ...args,}) } -async function unwrapBalancerToken({ chain, block, balancerToken, owner, balances = {} }) { - const { output: lpTokens } = await sdk.api.erc20.balanceOf({ target: balancerToken, owner, chain, block, }) - const { output: lpSupply } = await sdk.api.erc20.totalSupply({ target: balancerToken, chain, block, }) - const { output: underlyingPool } = await sdk.api.abi.call({ target: balancerToken, abi: bPool, chain, block, }) - const { output: underlyingTokens } = await sdk.api.abi.call({ target: underlyingPool, abi: getCurrentTokens, chain, block, }) - +async function unwrapBalancerToken({ api, chain, block, balancerToken, owner, balances = {}, isBPool = false, isV2 = true }) { + if (!api) { + api = new sdk.ChainApi({ chain, block, }) + } + const [lpSupply, lpTokens] = await api.batchCall([ + { abi: 'erc20:totalSupply', target: balancerToken }, + { abi: 'erc20:balanceOf', target: balancerToken, params: owner }, + ]) + if (+lpTokens === 0) return balances const ratio = lpTokens / lpSupply - const tempBalances = await sumTokens2({ owner: underlyingPool, tokens: underlyingTokens, chain, block, }) - for (const [token, value] of Object.entries(tempBalances)) { - const newValue = BigNumber(value * ratio).toFixed(0) - sdk.util.sumSingleBalance(balances, token, newValue) + + if (isV2) { + const poolId = await api.call({ abi: 'function getPoolId() view returns (bytes32)', target: balancerToken }) + const vault = await api.call({ abi: 'address:getVault', target: balancerToken }) + const [tokens, bals] = await api.call({ abi: 'function getPoolTokens(bytes32) view returns (address[], uint256[],uint256)', target: vault, params: poolId }) + tokens.forEach((v, i) => { + sdk.util.sumSingleBalance(balances, v, bals[i] * ratio, api.chain) + }) + } else { + let underlyingPool = balancerToken + if (!isBPool) + underlyingPool = await api.call({ target: balancerToken, abi: bPool, }) + + const underlyingTokens = await api.call({ target: underlyingPool, abi: getCurrentTokens, }) + + const tempBalances = await sumTokens2({ owner: underlyingPool, tokens: underlyingTokens, api, }) + for (const [token, value] of Object.entries(tempBalances)) { + const newValue = BigNumber(value * ratio).toFixed(0) + sdk.util.sumSingleBalance(balances, token, newValue) + } } return balances } -async function unwrapBalancerPool({ chain = 'ethereum', block, balancerPool, owner, balances = {} }) { - const { output: vault } = await sdk.api.abi.call({ target: balancerPool, abi: getBalancerVault, chain, block, }) - const { output: poolId } = await sdk.api.abi.call({ target: balancerPool, abi: getPoolId, chain, block, }) - const { output: poolTokens } = await sdk.api.abi.call({ target: vault, params: [poolId], abi: getPoolTokens, chain, block, }) - const transform = await getChainTransform(chain) +async function unwrapMakerPositions({ api, blacklistedTokens = [], whitelistedTokens = [], owner, skipDebt = false }) { + const vaultIds = [] + const chain = api.chain + if (chain && chain !== 'ethereum') throw new Error('Maker protocol not found in chain') + blacklistedTokens = getUniqueAddresses(blacklistedTokens, chain) + whitelistedTokens = getUniqueAddresses(whitelistedTokens, chain) + // taken from https://maker.defiexplore.com/api/users/0x849d52316331967b6ff1198e5e32a0eb168d039d?orderTx=DESC&order=DESC&sortBy=debt + // https://docs.makerdao.com/smart-contract-modules/proxy-module/cdp-manager-detailed-documentation + const PROXY_REGISTRY = '0x4678f0a6958e4D2Bc4F1BAF7Bc52E8F3564f3fE4' + const ds_proxy = await api.call({ abi: 'function proxies(address) view returns (address)', target: PROXY_REGISTRY, params: owner }) + const CDP_MANAGER = '0x5ef30b9986345249bc32d8928b7ee64de9435e39' + const ILK_REGISTRY = '0x5a464C28D19848f44199D003BeF5ecc87d090F87' + const vaultCount = await api.call({ abi: 'function count(address) view returns (uint256)', target: CDP_MANAGER, params: ds_proxy }) + if (vaultCount < 1) return api.getBalances() + vaultIds.push(await api.call({ abi: 'function first(address) view returns (uint256)', target: CDP_MANAGER, params: ds_proxy })) + for (let i = 0; i < vaultCount - 1; i++) { + const [_, nextId] = await api.call({ abi: 'function list(uint256) view returns (uint256,uint256)', target: CDP_MANAGER, params: vaultIds[i] }) + vaultIds.push(nextId) + } + const ilks = await api.multiCall({ abi: 'function ilks(uint256) view returns (bytes32)', calls: vaultIds, target: CDP_MANAGER }) + const urns = await api.multiCall({ abi: 'function urns(uint256) view returns (address)', calls: vaultIds, target: CDP_MANAGER }) + let collaterals = await api.multiCall({ abi: 'function gem(bytes32) view returns (address)', calls: ilks, target: ILK_REGISTRY }) + const vat = await api.call({ abi: 'address:vat', target: CDP_MANAGER }) + const cdpData = await api.multiCall({ abi: 'function urns(bytes32, address) view returns (uint256 collateralBal, uint256 debt)', calls: urns.map((v, i) => ({ params: [ilks[i], v] })), target: vat }) + collaterals = collaterals.map(i => normalizeAddress(i, chain)) + cdpData.forEach(({ collateralBal, debt }, i) => { + if (!skipDebt) + api.add(ADDRESSES.ethereum.DAI, debt * -1) + const collateral = collaterals[i] + if (blacklistedTokens.length && blacklistedTokens.includes(collateral, chain)) return; + if (whitelistedTokens.length && !whitelistedTokens.includes(collateral, chain)) return; + api.add(collateral, collateralBal) + }) + return api.getBalances() +} - const { output: lpTokens } = await sdk.api.erc20.balanceOf({ target: balancerPool, owner, chain, block, }) - const { output: lpSupply } = await sdk.api.erc20.totalSupply({ target: balancerPool, chain, block, }) +async function unwrap4626Tokens({ api, tokensAndOwners, }) { + const tokens = tokensAndOwners.map(i => i[0]) + const bals = await api.multiCall({ abi: 'erc20:balanceOf', calls: tokensAndOwners.map(i => ({ target: i[0], params: i[1] })), }) + const assets = await api.multiCall({ abi: 'address:asset', calls: tokens, }) + api.addTokens(assets, bals) + return api.getBalances() +} - const ratio = lpTokens / lpSupply - const { tokens, balances: bal, } = poolTokens - tokens.forEach((token, i) => { - const newValue = BigNumber(+bal[i] * ratio).toFixed(0) - sdk.util.sumSingleBalance(balances, transform(token), newValue) - }) - return balances +async function unwrapConvexRewardPools({ api, tokensAndOwners }) { + const bals = await api.multiCall({ abi: 'erc20:balanceOf', calls: tokensAndOwners.map(([t, o]) => ({ target: t, params: o })) }) + const tokens = await api.multiCall({ abi: 'address:stakingToken', calls: tokensAndOwners.map(i => i[0]) }) + api.addTokens(tokens, bals) + return api.getBalances() } module.exports = { - unwrapYearn, - unwrapCrv, unwrapUniswapLPs, unwrapUniswapV3NFTs, addTokensAndLPs, @@ -1051,15 +856,16 @@ module.exports = { sumLPWithOnlyOneToken, sumTokensSharedOwners, sumLPWithOnlyOneTokenOtherThanKnown, - unwrapGelatoLPs, - genericUnwrapCrv, genericUnwrapCvx, unwrapLPsAuto, - unwrapTroves, isLP, nullAddress, sumTokens2, unwrapBalancerToken, - unwrapBalancerPool, sumTokensExport, + genericUnwrapCvxDeposit, + genericUnwrapCvxRewardPool, + unwrapMakerPositions, + unwrap4626Tokens, + unwrapConvexRewardPools, } diff --git a/projects/helper/utils.js b/projects/helper/utils.js index 30356ec8e53..b97c5129d20 100644 --- a/projects/helper/utils.js +++ b/projects/helper/utils.js @@ -1,7 +1,9 @@ +const ADDRESSES = require('./coreAssets.json') const BigNumber = require("bignumber.js"); const axios = require("axios"); const sdk = require('@defillama/sdk') const http = require('./http') +const { getEnv } = require('./env') const erc20 = require('./abis/erc20.json') async function returnBalance(token, address, block, chain) { @@ -17,34 +19,6 @@ async function returnEthBalance(address) { return parseFloat(ethAmount); } -async function getPrices(object) { - var stringFetch = ''; - for (var key in object[0]) { - if (object[0][key] != 'stable') { - if (stringFetch.length > 0) { - stringFetch = stringFetch + ',' + object[0][key]; - } else { - stringFetch = object[0][key]; - } - } - } - return fetchURL(`https://api.coingecko.com/api/v3/simple/price?ids=${stringFetch}&vs_currencies=usd&include_market_cap=true&include_24hr_vol=true&include_24hr_change=true`) -} - -async function getPricesFromContract(object) { - var contractFetch = '' - for (var key in object) { - if (object[key]) { - if (contractFetch.length > 0) { - contractFetch = contractFetch + ',' + object[key]; - } else { - contractFetch = object[key]; - } - } - } - return fetchURL(`https://api.coingecko.com/api/v3/simple/token_price/ethereum?contract_addresses=${contractFetch}&vs_currencies=usd&include_market_cap=true&include_24hr_vol=true&include_24hr_change=true`) -} - async function fetchURL(url) { return axios.get(url) } @@ -65,30 +39,43 @@ function getParamCalls(length) { return createIncrementArray(length).map(i => ({ params: i })) } -const LP_SYMBOLS = ['SLP', 'spLP', 'JLP', 'OLP', 'SCLP', 'DLP', 'MLP', 'MSLP', 'ULP', 'TLP', 'HMDX', 'YLP', 'SCNRLP', 'PGL', 'GREEN-V2', 'PNDA-V2', 'vTAROT', 'vEvolve', 'TETHYSLP', 'BAO-V2', 'DINO-V2', 'DFYNLP', 'LavaSwap', 'RLP', 'ZDEXLP', 'lawSWAPLP', 'ELP',] +const LP_SYMBOLS = ['SLP', 'spLP', 'JLP', 'OLP', 'SCLP', 'DLP', 'MLP', 'MSLP', 'ULP', 'TLP', 'HMDX', 'YLP', 'SCNRLP', 'PGL', 'GREEN-V2', 'PNDA-V2', 'vTAROT', 'vEvolve', 'TETHYSLP', 'BAO-V2', 'DINO-V2', 'DFYNLP', 'LavaSwap', 'RLP', 'ZDEXLP', 'lawSWAPLP', 'ELP', 'ICELP', 'LFG_LP', 'KoffeeMug'] const blacklisted_LPS = [ '0xb3dc4accfe37bd8b3c2744e9e687d252c9661bc7', '0xf146190e4d3a2b9abe8e16636118805c628b94fe', '0xCC8Fa225D80b9c7D42F96e9570156c65D6cAAa25', '0xaee4164c1ee46ed0bbc34790f1a3d1fc87796668', + '0x93669cfce302c9971169f8106c850181a217b72b', ].map(i => i.toLowerCase()) function isLP(symbol, token, chain) { // console.log(symbol, chain, token) if (!symbol) return false - if (token && blacklisted_LPS.includes(token.toLowerCase())) return false - if (chain === 'bsc' && ['OLP', 'DLP', 'MLP', 'LP'].includes(symbol)) return false - if (chain === 'bsc' && ['WLP', 'FstLP', 'BLP',].includes(symbol)) return true + if (token && blacklisted_LPS.includes(token.toLowerCase()) || symbol.includes('HOP-LP-')) return false + if (chain === 'bsc' && ['OLP', 'DLP', 'MLP', 'LP', 'Stable-LP'].includes(symbol)) return false + if (chain === 'bsc' && ['WLP', 'FstLP', 'BLP', 'DsgLP'].includes(symbol)) return true + if (chain === 'pulse' && ['PLP', 'PLT'].includes(symbol)) return true if (chain === 'avax' && ['ELP', 'EPT', 'CRL', 'YSL', 'BGL', 'PLP'].includes(symbol)) return true if (chain === 'ethereum' && ['SSLP'].includes(symbol)) return true + if (chain === 'polygon' && ['WLP', 'FLP'].includes(symbol)) return true if (chain === 'moonriver' && ['HBLP'].includes(symbol)) return true if (chain === 'ethpow' && ['LFG_LP'].includes(symbol)) return true + if (chain === 'aurora' && ['wLP'].includes(symbol)) return true + if (chain === 'oasis' && ['LPT'].includes(symbol)) return true + if (chain === 'wan' && ['WSLP'].includes(symbol)) return true + if (chain === 'polygon' && ['MbtLP'].includes(symbol)) return true if (chain === 'ethereum' && ['SUDO-LP'].includes(symbol)) return false if (chain === 'dogechain' && ['DST-V2'].includes(symbol)) return true if (chain === 'harmony' && ['HLP'].includes(symbol)) return true - if (chain === 'fantom' && ['HLP'].includes(symbol)) return true + if (chain === 'klaytn' && ['NLP'].includes(symbol)) return true + if (chain === 'fantom' && ['HLP', 'WLP'].includes(symbol)) return true + if (chain === 'era' && /(cSLP|sSLP)$/.test(symbol)) return true // for syncswap if (chain === 'songbird' && ['FLRX', 'OLP'].includes(symbol)) return true + if (chain === 'arbitrum' && ['DXS', 'ZLP',].includes(symbol)) return true if (chain === 'metis' && ['NLP', 'ALP'].includes(symbol)) return true // Netswap/Agora LP Token + if (chain === 'optimism' && /(-ZS)/.test(symbol)) return true + if (chain === 'arbitrum' && /^(crAMM|vrAMM)-/.test(symbol)) return true // ramses LP + if (chain === 'bsc' && /(-APE-LP-S)/.test(symbol)) return false if (['fantom', 'nova',].includes(chain) && ['NLT'].includes(symbol)) return true let label @@ -96,14 +83,14 @@ function isLP(symbol, token, chain) { label = 'Blackisting this LP because of unsupported abi' if (label) { - if (DEBUG_MODE) console.log(label, token, symbol) + sdk.log(label, token, symbol) return false } const isLPRes = LP_SYMBOLS.includes(symbol) || /(UNI-V2|vAMM|sAMM)/.test(symbol) || symbol.split(/\W+/).includes('LP') - if (DEBUG_MODE && isLPRes && !['UNI-V2', 'Cake-LP'].includes(symbol)) - console.log(chain, symbol, token) + if (isLPRes && !['UNI-V2', 'Cake-LP'].includes(symbol)) + sdk.log(chain, symbol, token) return isLPRes } @@ -161,13 +148,8 @@ function getUniqueAddresses(addresses, isCaseSensitive = false) { return [...set] } -const DEBUG_MODE = !!process.env.LLAMA_DEBUG_MODE - -function log(...args) { - if (DEBUG_MODE) { - console.log(...args); - } -} +const DEBUG_MODE = () => getEnv('LLAMA_DEBUG_MODE') +const log = sdk.log function sliceIntoChunks(arr, chunkSize = 100) { const res = []; @@ -188,8 +170,8 @@ function stripTokenHeader(token) { return token.indexOf(":") > -1 ? token.split(":")[1] : token; } -async function diplayUnknownTable({ tvlResults = {}, tvlBalances = {}, storedKey = 'ethereum', log = false, tableLabel = 'Unrecognized tokens' }) { - if (!DEBUG_MODE && !log) return; +async function diplayUnknownTable({ tvlResults = {}, tvlBalances = {}, storedKey = 'ethereum', tableLabel = 'Unrecognized tokens' }) { + if (!DEBUG_MODE()) return; const balances = {} storedKey = storedKey.split('-')[0] Object.entries(tvlResults.tokenBalances).forEach(([label, balance]) => { @@ -199,10 +181,15 @@ async function diplayUnknownTable({ tvlResults = {}, tvlBalances = {}, storedKey if (balances[token] === '0') delete balances[token] }) - return debugBalances({ balances, chain: storedKey, log, tableLabel, withETH: false, }) + try { + await debugBalances({ balances, chain: storedKey, log, tableLabel, withETH: false, }) + } catch (e) { + // console.log(e) + log('failed to fetch prices for', balances) + } } -const nullAddress = '0x0000000000000000000000000000000000000000' +const nullAddress = ADDRESSES.null async function getSymbols(chain, tokens) { tokens = tokens.filter(i => i.includes('0x')).map(i => i.slice(i.indexOf('0x'))).filter(i => i !== nullAddress) const calls = tokens.map(i => ({ target: i })) @@ -232,14 +219,20 @@ async function getDecimals(chain, tokens) { } async function debugBalances({ balances = {}, chain, log = false, tableLabel = '', withETH = true }) { - if (!DEBUG_MODE && !log) return; + if (!DEBUG_MODE() && !log) return; if (!Object.keys(balances).length) return; const labelMapping = {} const tokens = [] const ethTokens = [] Object.keys(balances).forEach(label => { - const token = stripTokenHeader(label) + let token = stripTokenHeader(label) + if (chain === 'tron') { + token = label.slice(5) + tokens.push(token) + labelMapping[label] = token + return + } if (!token.startsWith('0x')) return; if (!label.startsWith(chain)) ethTokens.push(token) @@ -253,47 +246,27 @@ async function debugBalances({ balances = {}, chain, log = false, tableLabel = ' return; } + const api = new sdk.ChainApi({ chain }) - const { output: symbols } = await sdk.api.abi.multiCall({ - abi: 'erc20:symbol', - calls: tokens.map(i => ({ target: i })), - chain, - }) - const { output: decimals } = await sdk.api.abi.multiCall({ - abi: 'erc20:decimals', - calls: tokens.map(i => ({ target: i })), - chain, - }) - - const { output: name } = await sdk.api.abi.multiCall({ - abi: erc20.name, - calls: tokens.map(i => ({ target: i })), - chain, - }) + const symbols = await api.multiCall({ abi: 'erc20:symbol', calls: tokens, permitFailure: true, }) + const decimals = await api.multiCall({ abi: 'erc20:decimals', calls: tokens, permitFailure: true, }) + let name = await api.multiCall({ abi: erc20.name, calls: tokens, permitFailure: true, }) + name = name.map(i => i && i.length > 50 ? i.slice(0, 50) + '...' : i) let symbolsETH, nameETH if (withETH) { - symbolsETH = await sdk.api.abi.multiCall({ - abi: 'erc20:symbol', - calls: ethTokens.map(i => ({ target: i })), - }) - - nameETH = await sdk.api.abi.multiCall({ - abi: erc20.name, - calls: ethTokens.map(i => ({ target: i })), - }) - - symbolsETH = symbolsETH.output - nameETH = nameETH.output + const ethApi = new sdk.ChainApi() + symbolsETH = await ethApi.multiCall({ abi: 'erc20:symbol', calls: ethTokens, permitFailure: true, }) + nameETH = await ethApi.multiCall({ abi: erc20.name, calls: ethTokens, permitFailure: true, }) } - let symbolMapping = symbols.reduce((a, i) => ({ ...a, [i.input.target]: i.output }), {}) - let decimalsMapping = decimals.reduce((a, i) => ({ ...a, [i.input.target]: i.output }), {}) - let nameMapping = name.reduce((a, i) => ({ ...a, [i.input.target]: i.output }), {}) + let symbolMapping = symbols.reduce((a, i, y) => ({ ...a, [tokens[y]]: i }), {}) + let decimalsMapping = decimals.reduce((a, i, y) => ({ ...a, [tokens[y]]: i }), {}) + let nameMapping = name.reduce((a, i, y) => ({ ...a, [tokens[y]]: i }), {}) if (withETH) { - symbolMapping = symbolsETH.reduce((a, i) => ({ ...a, [i.input.target]: i.output }), symbolMapping) - nameMapping = nameETH.reduce((a, i) => ({ ...a, [i.input.target]: i.output }), nameMapping) + symbolMapping = symbolsETH.reduce((a, i, y) => ({ ...a, [ethTokens[y]]: i }), symbolMapping) + nameMapping = nameETH.reduce((a, i, y) => ({ ...a, [ethTokens[y]]: i }), nameMapping) } const logObj = [] Object.entries(balances).forEach(([label, balance]) => { @@ -311,32 +284,25 @@ async function debugBalances({ balances = {}, chain, log = false, tableLabel = ' console.table(logObj) } -async function fetchItemList({ chain, block, lengthAbi, itemAbi, target }) { - const { output: length } = await sdk.api.abi.call({ - target, - abi: lengthAbi, - chain, block, - }) - const { output: data } = await sdk.api.abi.multiCall({ - target, - abi: itemAbi, - calls: getParamCalls(length), - chain, block, - }) - - return data +function once(func) { + let previousResponse + let called = false + function wrapped(...args) { + if (called) return previousResponse + called = true + previousResponse = func(...args) + return previousResponse + } + return wrapped } module.exports = { - DEBUG_MODE, log, createIncrementArray, fetchURL, postURL, - getPrices, returnBalance, returnEthBalance, - getPricesFromContract, isLP, mergeExports, getBalance, @@ -349,5 +315,5 @@ module.exports = { getSymbols, getDecimals, getParamCalls, - fetchItemList, + once, } diff --git a/projects/helper/utils/graphql.js b/projects/helper/utils/graphql.js new file mode 100644 index 00000000000..88400d8efae --- /dev/null +++ b/projects/helper/utils/graphql.js @@ -0,0 +1,8 @@ +const axios = require("axios"); + +async function request(endpoint, query, { variables, withMetadata = false } = {}) { + const { data: result } = await axios.post(endpoint, { query, variables }) + return withMetadata ? result : result.data +} + +module.exports = { request } \ No newline at end of file diff --git a/projects/helper/utils/pact.js b/projects/helper/utils/pact.js index b924b3828cb..2c9de0da5b7 100644 --- a/projects/helper/utils/pact.js +++ b/projects/helper/utils/pact.js @@ -1,6 +1,6 @@ const blake = require("blakejs") -function prepareExecCmd(pactCode, meta = mkMeta("", "", 0, 0, 0, 0), networkId) { +function prepareExecCmd(pactCode, meta, networkId) { const cmdJSON = { networkId, payload: { diff --git a/projects/helper/utils/solana/layout.js b/projects/helper/utils/solana/layout.js index d52e1839752..bf14f62c905 100644 --- a/projects/helper/utils/solana/layout.js +++ b/projects/helper/utils/solana/layout.js @@ -1,405 +1,13 @@ -const { deserializeUnchecked } = require('borsh'); -const BufferLayout = require("buffer-layout"); const { PublicKey } = require("@solana/web3.js"); -const BN = require("bn.js"); -const { struct, u8, u16, seq } = BufferLayout - -const publicKey = (property = "publicKey") => { - const publicKeyLayout = BufferLayout.blob(32, property); - - const _decode = publicKeyLayout.decode.bind(publicKeyLayout); - const _encode = publicKeyLayout.encode.bind(publicKeyLayout); - - publicKeyLayout.decode = (buffer, offset) => { - const data = _decode(buffer, offset); - return new PublicKey(data); - }; - - publicKeyLayout.encode = (key, buffer, offset) => - _encode(key.toBuffer(), buffer, offset); - - return publicKeyLayout; -}; - -/** - * Layout for a 64bit unsigned value - */ -const uint64 = (property = "uint64") => { - const layout = BufferLayout.blob(8, property); - - const _decode = layout.decode.bind(layout); - const _encode = layout.encode.bind(layout); - - layout.decode = (buffer, offset) => { - const data = _decode(buffer, offset); - return new BN( - [...data] - .reverse() - .map((i) => `00${i.toString(16)}`.slice(-2)) - .join(""), - 16 - ); - }; - - layout.encode = (num, buffer, offset) => { - const a = num.toArray().reverse(); - let b = Buffer.from(a); - if (b.length !== 8) { - const zeroPad = Buffer.alloc(8); - b.copy(zeroPad); - b = zeroPad; - } - return _encode(b, buffer, offset); - }; - - return layout; -}; - -const u64 = uint64 - -const uint128 = (property = "uint128") => { - const layout = BufferLayout.blob(16, property); - - const _decode = layout.decode.bind(layout); - const _encode = layout.encode.bind(layout); - - layout.decode = (buffer, offset) => { - const data = _decode(buffer, offset); - return new BN( - [...data] - .reverse() - .map((i) => `00${i.toString(16)}`.slice(-2)) - .join(""), - 16 - ); - }; - - layout.encode = (num, buffer, offset) => { - const a = num.toArray().reverse(); - let b = Buffer.from(a); - if (b.length !== 16) { - const zeroPad = Buffer.alloc(16); - b.copy(zeroPad); - b = zeroPad; - } - - return _encode(b, buffer, offset); - }; - - return layout; -}; -const LastUpdateLayout = BufferLayout.struct( - [uint64("slot"), BufferLayout.u8("stale")], - "lastUpdate" -); - -const ReserveLayout = BufferLayout.struct([ - BufferLayout.u8("version"), - - LastUpdateLayout, - - publicKey("lendingMarket"), - - BufferLayout.struct( - [ - publicKey("mintPubkey"), - BufferLayout.u8("mintDecimals"), - publicKey("supplyPubkey"), - // @FIXME: oracle option - // TODO: replace u32 option with generic equivalent - // BufferLayout.u32('oracleOption'), - publicKey("pythOracle"), - publicKey("switchboardOracle"), - uint64("availableAmount"), - uint128("borrowedAmountWads"), - uint128("cumulativeBorrowRateWads"), - uint128("marketPrice"), - ], - "liquidity" - ), - - BufferLayout.struct( - [ - publicKey("mintPubkey"), - uint64("mintTotalSupply"), - publicKey("supplyPubkey"), - ], - "collateral" - ), - - BufferLayout.struct( - [ - BufferLayout.u8("optimalUtilizationRate"), - BufferLayout.u8("loanToValueRatio"), - BufferLayout.u8("liquidationBonus"), - BufferLayout.u8("liquidationThreshold"), - BufferLayout.u8("minBorrowRate"), - BufferLayout.u8("optimalBorrowRate"), - BufferLayout.u8("maxBorrowRate"), - BufferLayout.struct( - [ - uint64("borrowFeeWad"), - uint64("flashLoanFeeWad"), - BufferLayout.u8("hostFeePercentage"), - ], - "fees" - ), - uint64("depositLimit"), - uint64("borrowLimit"), - publicKey("feeReceiver"), - ], - "config" - ), - - BufferLayout.blob(256, "padding"), -]); - -const ReserveLayoutLarix = BufferLayout.struct( - [ - BufferLayout.u8('version'), - - LastUpdateLayout, - - publicKey('lendingMarket'), - - BufferLayout.struct( - [ - publicKey('mintPubkey'), - BufferLayout.u8('mintDecimals'), - publicKey('supplyPubkey'), - publicKey('feeReceiver'), - BufferLayout.u8("usePythOracle"), - publicKey('params_1'), - publicKey("params_2"), - uint64('availableAmount'), - uint128('borrowedAmountWads'), - uint128('cumulativeBorrowRateWads'), - uint128('marketPrice'), - uint128('ownerUnclaimed'), - ], - 'liquidity', - ), - - BufferLayout.struct( - [ - publicKey('mintPubkey'), - uint64('mintTotalSupply'), - publicKey('supplyPubkey'), - ], - 'collateral' - ), - - BufferLayout.struct( - [ - BufferLayout.u8('optimalUtilizationRate'), - BufferLayout.u8('loanToValueRatio'), - BufferLayout.u8('liquidationBonus'), - BufferLayout.u8('liquidationThreshold'), - BufferLayout.u8('minBorrowRate'), - BufferLayout.u8('optimalBorrowRate'), - BufferLayout.u8('maxBorrowRate'), - BufferLayout.struct( - // TODO: fix flash loan fee wad - [ - uint64('borrowFeeWad'), - uint64('borrowInterestFeeWad'), - uint64("flashLoanFeeWad"), - BufferLayout.u8('hostFeePercentage'), - BufferLayout.u8('hostFeeReceiverCount'), - BufferLayout.blob(32 * 5, 'hostFeeReceivers'), - ], - 'fees', - ), - BufferLayout.u8("depositPaused"), - BufferLayout.u8("borrowPaused"), - BufferLayout.u8("liquidationPaused"), - ], - 'config' - ), - BufferLayout.struct( - [ - publicKey("unCollSupply"), - uint128('lTokenMiningIndex'), - uint128('borrowMiningIndex'), - uint64("totalMiningSpeed"), - uint64("kinkUtilRate"), - ], - 'bonus' - ), - BufferLayout.u8("reentry"), - uint64("depositLimit"), - BufferLayout.u8("isLP"), - BufferLayout.blob(239, 'padding'), - ], -); - -const MintLayout = BufferLayout.struct([ - BufferLayout.u32('mintAuthorityOption'), - publicKey("mintAuthority"), - uint64('supply'), - BufferLayout.u8("decimals"), - BufferLayout.u8("isInitialized"), - BufferLayout.u32("freezeAuthorityOption"), - publicKey("freezeAuthority"), -]); - -const AccountLayout = BufferLayout.struct([ - publicKey('mint'), - publicKey('owner'), - uint64('amount'), - BufferLayout.u32('delegateOption'), - publicKey('delegate'), - BufferLayout.u8('state'), - BufferLayout.u32('isNativeOption'), - uint64('isNative'), - uint64('delegatedAmount'), - BufferLayout.u32('closeAuthorityOption'), - publicKey('closeAuthority'), -]); - -const TokenSwapLayout = BufferLayout.struct([ - BufferLayout.u8("version"), - BufferLayout.u8("isInitialized"), - BufferLayout.u8("bumpSeed"), - publicKey("tokenProgramId"), - publicKey("tokenAccountA"), - publicKey("tokenAccountB"), - publicKey("tokenPool"), - publicKey("mintA"), - publicKey("mintB"), - publicKey("feeAccount"), - BufferLayout.blob(8, "tradeFeeNumerator"), - BufferLayout.blob(8, "tradeFeeDenominator"), - BufferLayout.blob(8, "ownerTradeFeeNumerator"), - BufferLayout.blob(8, "ownerTradeFeeDenominator"), - BufferLayout.blob(8, "ownerWithdrawFeeNumerator"), - BufferLayout.blob(8, "ownerWithdrawFeeDenominator"), - BufferLayout.blob(8, "hostFeeNumerator"), - BufferLayout.blob(8, "hostFeeDenominator"), - BufferLayout.u8("curveType"), - publicKey("curveParameters"), -]) - -function U64F64(property = "u64F64") { - - const layout = BufferLayout.blob(16, property); - - const _decode = layout.decode.bind(layout); - const _encode = layout.encode.bind(layout); - - layout.decode = (buffer, offset) => { - const raw = new BN(_decode(buffer, offset), 10, 'le'); - - return raw / Math.pow(2, 64); - }; - - layout.encode = (key, buffer, offset) => - _encode(key.toBuffer(), buffer, offset); - - return layout; -} - -const INVESTIN_FUND_DATA = struct([ - u8('is_initialized'), - u8('number_of_active_investments'), - u8('no_of_investments'), - u8('signer_nonce'), - u8('no_of_margin_positions'), - u8('no_of_assets'), - u16('position_count'), - - u8('version'), - u8('is_private'), - u16('fund_v3_index'), - seq(u8(), 4, 'padding'), - - u64('min_amount'), - U64F64('min_return'), - U64F64('performance_fee_percentage'), - U64F64('total_amount'), - U64F64('prev_performance'), - - u64('amount_in_router'), - U64F64('performance_fee'), - publicKey('manager_account'), - publicKey('fund_pda'), - seq( - struct([ - u8('is_active'), - seq(u8(),3,'index'), - u8('mux'), - u8('is_on_mango'), - seq(u8(), 2, 'padding'), - u64('balance'), - u64('debt'), - publicKey('vault') - ]), - 8, 'tokens' - ), - seq(publicKey(), 10, 'investors'), - - struct([ - publicKey('mango_account'), - seq(u8(),3,'perp_markets'), - u8('padding'), - u8('deposit_index'), - u8('markets_active'), - u8('deposits_active'), - u8('xpadding'), - seq(u64(), 2, 'investor_debts'), - seq(u8('padding'), 24), - ],'mango_positions'), - - - struct([ - u8('is_active'), - u8('is_split'), - u8('hop'), - u8('count'), - u8('token_in_slot'), - u8('token_out_slot'), - seq(u8('padding'), 2), - - publicKey('token_in'), - publicKey('token_out'), - u64('amount_in'), - u64('min_amount_out'), - ],'guard'), - - seq( - struct([ - u64('price'), - u64('max_base_quantity'), - u64('max_quote_quantity'), - u64('client_order_id'), - u64('expiry_timestamp'), - u8('is_repost_processing'), - u8('perp_market_id'), - u8('side'), - u8('reduce_only'), - u8('limit'), - seq(u8(),3,'padding'), - ]), - 2, 'limit_orders' - ), - - struct([ - u64('last_updated'), - publicKey('volt_vault_id'), - u64('total_value_in_ul'), - u64('fc_token_balance'), - u64('ul_token_balance'), - u64('fc_token_debt'), - u64('ul_debt'), - u8('ul_token_slot'), - u8('is_active'), - seq(u8('padding'), 6), - ],'friktion_vault'), - - seq(u8(), 1864, 'migration_additonal_padding'), -]) +const { parseLido, parseLidoValidatorList } = require('./layouts/lido') +const { parsePhoenix } = require('./layouts/phoenix-dex') +const { RAYDIUM_LIQUIDITY_STATE_LAYOUT_CLMM, RAYDIUM_STABLE_STATE_LAYOUT_V1, } = require('./layouts/raydium-layout') +const { INVESTIN_FUND_DATA, } = require('./layouts/investin-layout') +const { MARKET_STATE_LAYOUT_V3, } = require('./layouts/openbook-layout') +const { ReserveLayout, ReserveLayoutLarix, MintLayout, AccountLayout, TokenSwapLayout, } = require('./layouts/mixed-layout') +// console.log(RAYDIUM_LIQUIDITY_STATE_LAYOUT_CLMM.span, 'RAYDIUM_LIQUIDITY_STATE_LAYOUT_CLMM') const parseReserve = (info) => { const pubkey = PublicKey.default @@ -428,286 +36,29 @@ const defaultParseLayout = Layout => info => { return Layout.decode(buffer); } -class Lido { - constructor(data) { - Object.assign(this, data); - } -} - -class SeedRange { - constructor(data) { - Object.assign(this, data); - } -} - -class Validator { - constructor(data) { - Object.assign(this, data); - } -} - -class PubKeyAndEntry { - constructor(data) { - Object.assign(this, data); - } -} - -class PubKeyAndEntryMaintainer { - constructor(data) { - Object.assign(this, data); - } -} - -class RewardDistribution { - constructor(data) { - Object.assign(this, data); - } -} - -class FeeRecipients { - constructor(data) { - Object.assign(this, data); - } -} - -class Validators { - constructor(data) { - Object.assign(this, data); - } -} - -class Maintainers { - constructor(data) { - Object.assign(this, data); - } -} - -class ExchangeRate { - constructor(data) { - Object.assign(this, data); - } -} - -class Metrics { - constructor(data) { - Object.assign(this, data); - } -} - -class LamportsHistogram { - constructor(data) { - Object.assign(this, data); - } -} - -class WithdrawMetric { - constructor(data) { - Object.assign(this, data); - } -} - -const schema = new Map([ - [ - ExchangeRate, - { - kind: 'struct', - fields: [ - ['computed_in_epoch', 'u64'], - ['st_sol_supply', 'u64'], - ['sol_balance', 'u64'], - ], - }, - ], - [ - LamportsHistogram, - { - kind: 'struct', - fields: [ - ['counts1', 'u64'], - ['counts2', 'u64'], - ['counts3', 'u64'], - ['counts4', 'u64'], - ['counts5', 'u64'], - ['counts6', 'u64'], - ['counts7', 'u64'], - ['counts8', 'u64'], - ['counts9', 'u64'], - ['counts10', 'u64'], - ['counts11', 'u64'], - ['counts12', 'u64'], - ['total', 'u64'], - ], - }, - ], - [ - WithdrawMetric, - { - kind: 'struct', - fields: [ - ['total_st_sol_amount', 'u64'], - ['total_sol_amount', 'u64'], - ['count', 'u64'], - ], - }, - ], - [ - Metrics, - { - kind: 'struct', - fields: [ - ['fee_treasury_sol_total', 'u64'], - ['fee_validation_sol_total', 'u64'], - ['fee_developer_sol_total', 'u64'], - ['st_sol_appreciation_sol_total', 'u64'], - ['fee_treasury_st_sol_total', 'u64'], - ['fee_validation_st_sol_total', 'u64'], - ['fee_developer_st_sol_total', 'u64'], - ['deposit_amount', LamportsHistogram], - ['withdraw_amount', WithdrawMetric], - ], - }, - ], - [ - SeedRange, - { - kind: 'struct', - fields: [ - ['begin', 'u64'], - ['end', 'u64'], - ], - }, - ], - [ - Validator, - { - kind: 'struct', - fields: [ - ['fee_credit', 'u64'], - ['fee_address', 'u256'], - ['stake_seeds', SeedRange], - ['unstake_seeds', SeedRange], - ['stake_accounts_balance', 'u64'], - ['unstake_accounts_balance', 'u64'], - ['active', 'u8'], - ], - }, - ], - [ - PubKeyAndEntry, - { - kind: 'struct', - fields: [ - ['pubkey', 'u256'], - ['entry', Validator], - ], - }, - ], - [ - PubKeyAndEntryMaintainer, - { - kind: 'struct', - fields: [ - ['pubkey', 'u256'], - ['entry', [0]], - ], - }, - ], - [ - RewardDistribution, - { - kind: 'struct', - fields: [ - ['treasury_fee', 'u32'], - ['validation_fee', 'u32'], - ['developer_fee', 'u32'], - ['st_sol_appreciation', 'u32'], - ], - }, - ], - [ - FeeRecipients, - { - kind: 'struct', - fields: [ - ['treasury_account', 'u256'], - ['developer_account', 'u256'], - ], - }, - ], - [ - Validators, - { - kind: 'struct', - fields: [ - ['entries', [PubKeyAndEntry]], - ['maximum_entries', 'u32'], - ], - }, - ], - [ - Maintainers, - { - kind: 'struct', - fields: [ - ['entries', [PubKeyAndEntryMaintainer]], - ['maximum_entries', 'u32'], - ], - }, - ], - [ - Lido, - { - kind: 'struct', - fields: [ - ['lido_version', 'u8'], - - ['manager', 'u256'], - - ['st_sol_mint', 'u256'], - - ['exchange_rate', ExchangeRate], - - ['sol_reserve_authority_bump_seed', 'u8'], - ['stake_authority_bump_seed', 'u8'], - ['mint_authority_bump_seed', 'u8'], - ['rewards_withdraw_authority_bump_seed', 'u8'], - - ['reward_distribution', RewardDistribution], - - ['fee_recipients', FeeRecipients], - - ['metrics', Metrics], - - ['validators', Validators], - - ['maintainers', Maintainers], - ], - }, - ], -]); - -const Layouts = { - lido: Lido, -} - const customDecoders = { reserve: parseReserve, + lido: parseLido, + lidoValidatorList: parseLidoValidatorList, mint: defaultParseLayout(MintLayout), account: defaultParseLayout(AccountLayout), tokenSwap: defaultParseLayout(TokenSwapLayout), larixReserve: defaultParseLayout(ReserveLayoutLarix), investinFund: defaultParseLayout(INVESTIN_FUND_DATA), + openbook: defaultParseLayout(MARKET_STATE_LAYOUT_V3), + // raydiumLPv4: defaultParseLayout(RAYDIUM_LIQUIDITY_STATE_LAYOUT_V4), + raydiumCLMM: defaultParseLayout(RAYDIUM_LIQUIDITY_STATE_LAYOUT_CLMM), + raydiumLPStable: defaultParseLayout(RAYDIUM_STABLE_STATE_LAYOUT_V1), + fluxbeam: defaultParseLayout(TokenSwapLayout), + phoenix: parsePhoenix, } function decodeAccount(layout, accountInfo) { if (!accountInfo.data) throw new Error('Missing account data') if (customDecoders[layout]) return customDecoders[layout](accountInfo) - if (!Layouts[layout]) throw new Error('Layout not found') - return deserializeUnchecked(schema, Layouts[layout], accountInfo.data); + throw new Error('Layout not found: ' + layout) } module.exports = { - Layouts, - schema, decodeAccount, } \ No newline at end of file diff --git a/projects/helper/utils/solana/layouts/investin-layout.js b/projects/helper/utils/solana/layouts/investin-layout.js new file mode 100644 index 00000000000..3e8fe2799c9 --- /dev/null +++ b/projects/helper/utils/solana/layouts/investin-layout.js @@ -0,0 +1,129 @@ +const { + struct, s32, u8, u16, seq, blob, Layout, bits, u32, publicKey, uint64, u64, uint128, u128, BufferLayout, +} = require('./layout-base') +const BN = require("bn.js"); + +function U64F64(property = "u64F64") { + + const layout = BufferLayout.blob(16, property); + + const _decode = layout.decode.bind(layout); + const _encode = layout.encode.bind(layout); + + layout.decode = (buffer, offset) => { + const raw = new BN(_decode(buffer, offset), 10, 'le'); + + return raw / Math.pow(2, 64); + }; + + layout.encode = (key, buffer, offset) => + _encode(key.toBuffer(), buffer, offset); + + return layout; +} + +const INVESTIN_FUND_DATA = struct([ + u8('is_initialized'), + u8('number_of_active_investments'), + u8('no_of_investments'), + u8('signer_nonce'), + u8('no_of_margin_positions'), + u8('no_of_assets'), + u16('position_count'), + + u8('version'), + u8('is_private'), + u16('fund_v3_index'), + seq(u8(), 4, 'padding'), + + u64('min_amount'), + U64F64('min_return'), + U64F64('performance_fee_percentage'), + U64F64('total_amount'), + U64F64('prev_performance'), + + u64('amount_in_router'), + U64F64('performance_fee'), + publicKey('manager_account'), + publicKey('fund_pda'), + seq( + struct([ + u8('is_active'), + seq(u8(), 3, 'index'), + u8('mux'), + u8('is_on_mango'), + seq(u8(), 2, 'padding'), + u64('balance'), + u64('debt'), + publicKey('vault') + ]), + 8, 'tokens' + ), + seq(publicKey(), 10, 'investors'), + + struct([ + publicKey('mango_account'), + seq(u8(), 3, 'perp_markets'), + u8('padding'), + u8('deposit_index'), + u8('markets_active'), + u8('deposits_active'), + u8('xpadding'), + seq(u64(), 2, 'investor_debts'), + seq(u8('padding'), 24), + ], 'mango_positions'), + + + struct([ + u8('is_active'), + u8('is_split'), + u8('hop'), + u8('count'), + u8('token_in_slot'), + u8('token_out_slot'), + seq(u8('padding'), 2), + + publicKey('token_in'), + publicKey('token_out'), + u64('amount_in'), + u64('min_amount_out'), + ], 'guard'), + + seq( + struct([ + u64('price'), + u64('max_base_quantity'), + u64('max_quote_quantity'), + u64('client_order_id'), + u64('expiry_timestamp'), + u8('is_repost_processing'), + u8('perp_market_id'), + u8('side'), + u8('reduce_only'), + u8('limit'), + seq(u8(), 3, 'padding'), + ]), + 2, 'limit_orders' + ), + + struct([ + u64('last_updated'), + publicKey('volt_vault_id'), + u64('total_value_in_ul'), + u64('fc_token_balance'), + u64('ul_token_balance'), + u64('fc_token_debt'), + u64('ul_debt'), + u8('ul_token_slot'), + u8('is_active'), + seq(u8('padding'), 6), + ], 'friktion_vault'), + + seq(u8(), 1864, 'migration_additonal_padding'), +]) + + +module.exports = { + INVESTIN_FUND_DATA, +} + diff --git a/projects/helper/utils/solana/layouts/layout-base.js b/projects/helper/utils/solana/layouts/layout-base.js new file mode 100644 index 00000000000..cc1f069786b --- /dev/null +++ b/projects/helper/utils/solana/layouts/layout-base.js @@ -0,0 +1,95 @@ + +const BufferLayout = require("buffer-layout"); +const { PublicKey } = require("@solana/web3.js"); +const BN = require("bn.js"); +const { struct, s32, u8, u16, seq, blob, Layout, bits, u32, } = BufferLayout + +const publicKey = (property = "publicKey") => { + const publicKeyLayout = BufferLayout.blob(32, property); + + const _decode = publicKeyLayout.decode.bind(publicKeyLayout); + const _encode = publicKeyLayout.encode.bind(publicKeyLayout); + + publicKeyLayout.decode = (buffer, offset) => { + const data = _decode(buffer, offset); + return new PublicKey(data); + }; + + publicKeyLayout.encode = (key, buffer, offset) => + _encode(key.toBuffer(), buffer, offset); + + return publicKeyLayout; +}; + +/** + * Layout for a 64bit unsigned value + */ +const uint64 = (property = "uint64") => { + const layout = BufferLayout.blob(8, property); + + const _decode = layout.decode.bind(layout); + const _encode = layout.encode.bind(layout); + + layout.decode = (buffer, offset) => { + const data = _decode(buffer, offset); + return new BN( + [...data] + .reverse() + .map((i) => `00${i.toString(16)}`.slice(-2)) + .join(""), + 16 + ); + }; + + layout.encode = (num, buffer, offset) => { + const a = num.toArray().reverse(); + let b = Buffer.from(a); + if (b.length !== 8) { + const zeroPad = Buffer.alloc(8); + b.copy(zeroPad); + b = zeroPad; + } + return _encode(b, buffer, offset); + }; + + return layout; +}; + +const u64 = uint64 + +const uint128 = (property = "uint128") => { + const layout = BufferLayout.blob(16, property); + + const _decode = layout.decode.bind(layout); + const _encode = layout.encode.bind(layout); + + layout.decode = (buffer, offset) => { + const data = _decode(buffer, offset); + return new BN( + [...data] + .reverse() + .map((i) => `00${i.toString(16)}`.slice(-2)) + .join(""), + 16 + ); + }; + + layout.encode = (num, buffer, offset) => { + const a = num.toArray().reverse(); + let b = Buffer.from(a); + if (b.length !== 16) { + const zeroPad = Buffer.alloc(16); + b.copy(zeroPad); + b = zeroPad; + } + + return _encode(b, buffer, offset); + }; + + return layout; +}; +const u128 = uint128 + +module.exports = { + struct, s32, u8, u16, seq, blob, Layout, bits, u32, publicKey, uint64, u64, uint128, u128, BufferLayout, +} \ No newline at end of file diff --git a/projects/helper/utils/solana/layouts/lido.js b/projects/helper/utils/solana/layouts/lido.js new file mode 100644 index 00000000000..3d64f179d7e --- /dev/null +++ b/projects/helper/utils/solana/layouts/lido.js @@ -0,0 +1,249 @@ + +// info taken from https://github.com/lidofinance/solido-sdk +const { deserializeUnchecked } = require('borsh') + +class Lido { + constructor(data) { + Object.assign(this, data); + } +} + +class RewardDistribution { + constructor(data) { + Object.assign(this, data); + } +} + +class FeeRecipients { + constructor(data) { + Object.assign(this, data); + } +} + +class ExchangeRate { + constructor(data) { + Object.assign(this, data); + } +} + +class Metrics { + constructor(data) { + Object.assign(this, data); + } +} + +class LamportsHistogram { + constructor(data) { + Object.assign(this, data); + } +} + +class WithdrawMetric { + constructor(data) { + Object.assign(this, data); + } +} + +class ListHeader { + constructor(data) { + Object.assign(this, data); + } +} + +class SeedRange { + constructor(data) { + Object.assign(this, data); + } +} + +class ValidatorClass { + constructor(data) { + Object.assign(this, data); + } +} + +class AccountList { + constructor(data) { + Object.assign(this, data); + } +} + + +const accountInfoV2Scheme = new Map([ + [ + ExchangeRate, + { + kind: 'struct', + fields: [ + ['computed_in_epoch', 'u64'], + ['st_sol_supply', 'u64'], + ['sol_balance', 'u64'], + ], + }, + ], + [ + LamportsHistogram, + { + kind: 'struct', + fields: [ + ['counts1', 'u64'], + ['counts2', 'u64'], + ['counts3', 'u64'], + ['counts4', 'u64'], + ['counts5', 'u64'], + ['counts6', 'u64'], + ['counts7', 'u64'], + ['counts8', 'u64'], + ['counts9', 'u64'], + ['counts10', 'u64'], + ['counts11', 'u64'], + ['counts12', 'u64'], + ['total', 'u64'], + ], + }, + ], + [ + WithdrawMetric, + { + kind: 'struct', + fields: [ + ['total_st_sol_amount', 'u64'], + ['total_sol_amount', 'u64'], + ['count', 'u64'], + ], + }, + ], + [ + Metrics, + { + kind: 'struct', + fields: [ + ['fee_treasury_sol_total', 'u64'], + ['fee_validation_sol_total', 'u64'], + ['fee_developer_sol_total', 'u64'], + ['st_sol_appreciation_sol_total', 'u64'], + ['fee_treasury_st_sol_total', 'u64'], + ['fee_validation_st_sol_total', 'u64'], + ['fee_developer_st_sol_total', 'u64'], + ['deposit_amount', LamportsHistogram], + ['withdraw_amount', WithdrawMetric], + ], + }, + ], + [ + RewardDistribution, + { + kind: 'struct', + fields: [ + ['treasury_fee', 'u32'], + ['developer_fee', 'u32'], + ['st_sol_appreciation', 'u32'], + ], + }, + ], + [ + FeeRecipients, + { + kind: 'struct', + fields: [ + ['treasury_account', [32]], + ['developer_account', [32]], + ], + }, + ], + [ + Lido, + { + kind: 'struct', + fields: [ + ['account_type', 'u8'], + + ['lido_version', 'u8'], + + ['manager', [32]], + + ['st_sol_mint', [32]], + + ['exchange_rate', ExchangeRate], + + ['sol_reserve_account_bump_seed', 'u8'], + ['stake_authority_bump_seed', 'u8'], + ['mint_authority_bump_seed', 'u8'], + + ['reward_distribution', RewardDistribution], + + ['fee_recipients', FeeRecipients], + + ['metrics', Metrics], + + ['validator_list', [32]], + + ['maintainer_list', [32]], + + ['max_commission_percentage', 'u8'], + ], + }, + ], +]); + +const validatorsSchema = new Map([ + [ + ListHeader, + { + kind: 'struct', + fields: [ + ['account_type', 'u8'], + ['lido_version', 'u8'], + ['max_entries', 'u32'], + ], + }, + ], + [ + SeedRange, + { + kind: 'struct', + fields: [ + ['begin', 'u64'], + ['end', 'u64'], + ], + }, + ], + [ + ValidatorClass, + { + kind: 'struct', + fields: [ + ['vote_account_address', [32]], + ['stake_seeds', SeedRange], + ['unstake_seeds', SeedRange], + ['stake_accounts_balance', 'u64'], + ['unstake_accounts_balance', 'u64'], + ['effective_stake_balance', 'u64'], + ['active', 'u8'], + ], + }, + ], + [ + AccountList, + { + kind: 'struct', + fields: [ + ['header', ListHeader], + ['entries', [ValidatorClass]], + ], + }, + ], +]) + +function parseLido(accountInfo) { + return deserializeUnchecked(accountInfoV2Scheme, Lido, accountInfo.data,); +} + +function parseLidoValidatorList(accountInfo) { + return deserializeUnchecked(validatorsSchema, AccountList, accountInfo.data,); +} + +module.exports = { + parseLido, + parseLidoValidatorList, +} \ No newline at end of file diff --git a/projects/helper/utils/solana/layouts/mixed-layout.js b/projects/helper/utils/solana/layouts/mixed-layout.js new file mode 100644 index 00000000000..92b0b6f71cd --- /dev/null +++ b/projects/helper/utils/solana/layouts/mixed-layout.js @@ -0,0 +1,201 @@ +const { + struct, s32, u8, u16, seq, blob, Layout, bits, u32, publicKey, uint64, u64, uint128, u128, BufferLayout, +} = require('./layout-base') + +const LastUpdateLayout = BufferLayout.struct( + [uint64("slot"), BufferLayout.u8("stale")], + "lastUpdate" +); + +const ReserveLayout = BufferLayout.struct([ + BufferLayout.u8("version"), + + LastUpdateLayout, + + publicKey("lendingMarket"), + + BufferLayout.struct( + [ + publicKey("mintPubkey"), + BufferLayout.u8("mintDecimals"), + publicKey("supplyPubkey"), + // @FIXME: oracle option + // TODO: replace u32 option with generic equivalent + // BufferLayout.u32('oracleOption'), + publicKey("pythOracle"), + publicKey("switchboardOracle"), + uint64("availableAmount"), + uint128("borrowedAmountWads"), + uint128("cumulativeBorrowRateWads"), + uint128("marketPrice"), + ], + "liquidity" + ), + + BufferLayout.struct( + [ + publicKey("mintPubkey"), + uint64("mintTotalSupply"), + publicKey("supplyPubkey"), + ], + "collateral" + ), + + BufferLayout.struct( + [ + BufferLayout.u8("optimalUtilizationRate"), + BufferLayout.u8("loanToValueRatio"), + BufferLayout.u8("liquidationBonus"), + BufferLayout.u8("liquidationThreshold"), + BufferLayout.u8("minBorrowRate"), + BufferLayout.u8("optimalBorrowRate"), + BufferLayout.u8("maxBorrowRate"), + BufferLayout.struct( + [ + uint64("borrowFeeWad"), + uint64("flashLoanFeeWad"), + BufferLayout.u8("hostFeePercentage"), + ], + "fees" + ), + uint64("depositLimit"), + uint64("borrowLimit"), + publicKey("feeReceiver"), + ], + "config" + ), + + BufferLayout.blob(256, "padding"), +]); + +const ReserveLayoutLarix = BufferLayout.struct( + [ + BufferLayout.u8('version'), + + LastUpdateLayout, + + publicKey('lendingMarket'), + + BufferLayout.struct( + [ + publicKey('mintPubkey'), + BufferLayout.u8('mintDecimals'), + publicKey('supplyPubkey'), + publicKey('feeReceiver'), + BufferLayout.u8("usePythOracle"), + publicKey('params_1'), + publicKey("params_2"), + uint64('availableAmount'), + uint128('borrowedAmountWads'), + uint128('cumulativeBorrowRateWads'), + uint128('marketPrice'), + uint128('ownerUnclaimed'), + ], + 'liquidity', + ), + + BufferLayout.struct( + [ + publicKey('mintPubkey'), + uint64('mintTotalSupply'), + publicKey('supplyPubkey'), + ], + 'collateral' + ), + + BufferLayout.struct( + [ + BufferLayout.u8('optimalUtilizationRate'), + BufferLayout.u8('loanToValueRatio'), + BufferLayout.u8('liquidationBonus'), + BufferLayout.u8('liquidationThreshold'), + BufferLayout.u8('minBorrowRate'), + BufferLayout.u8('optimalBorrowRate'), + BufferLayout.u8('maxBorrowRate'), + BufferLayout.struct( + // TODO: fix flash loan fee wad + [ + uint64('borrowFeeWad'), + uint64('borrowInterestFeeWad'), + uint64("flashLoanFeeWad"), + BufferLayout.u8('hostFeePercentage'), + BufferLayout.u8('hostFeeReceiverCount'), + BufferLayout.blob(32 * 5, 'hostFeeReceivers'), + ], + 'fees', + ), + BufferLayout.u8("depositPaused"), + BufferLayout.u8("borrowPaused"), + BufferLayout.u8("liquidationPaused"), + ], + 'config' + ), + BufferLayout.struct( + [ + publicKey("unCollSupply"), + uint128('lTokenMiningIndex'), + uint128('borrowMiningIndex'), + uint64("totalMiningSpeed"), + uint64("kinkUtilRate"), + ], + 'bonus' + ), + BufferLayout.u8("reentry"), + uint64("depositLimit"), + BufferLayout.u8("isLP"), + BufferLayout.blob(239, 'padding'), + ], +); + +const MintLayout = BufferLayout.struct([ + BufferLayout.u32('mintAuthorityOption'), + publicKey("mintAuthority"), + uint64('supply'), + BufferLayout.u8("decimals"), + BufferLayout.u8("isInitialized"), + BufferLayout.u32("freezeAuthorityOption"), + publicKey("freezeAuthority"), +]); + +const AccountLayout = BufferLayout.struct([ + publicKey('mint'), + publicKey('owner'), + uint64('amount'), + BufferLayout.u32('delegateOption'), + publicKey('delegate'), + BufferLayout.u8('state'), + BufferLayout.u32('isNativeOption'), + uint64('isNative'), + uint64('delegatedAmount'), + BufferLayout.u32('closeAuthorityOption'), + publicKey('closeAuthority'), +]); + +const TokenSwapLayout = BufferLayout.struct([ + BufferLayout.u8("version"), + BufferLayout.u8("isInitialized"), + BufferLayout.u8("bumpSeed"), + publicKey("tokenProgramId"), + publicKey("tokenAccountA"), + publicKey("tokenAccountB"), + publicKey("tokenPool"), + publicKey("mintA"), + publicKey("mintB"), + publicKey("feeAccount"), + BufferLayout.blob(8, "tradeFeeNumerator"), + BufferLayout.blob(8, "tradeFeeDenominator"), + BufferLayout.blob(8, "ownerTradeFeeNumerator"), + BufferLayout.blob(8, "ownerTradeFeeDenominator"), + BufferLayout.blob(8, "ownerWithdrawFeeNumerator"), + BufferLayout.blob(8, "ownerWithdrawFeeDenominator"), + BufferLayout.blob(8, "hostFeeNumerator"), + BufferLayout.blob(8, "hostFeeDenominator"), + BufferLayout.u8("curveType"), + publicKey("curveParameters"), +]) + + +module.exports = { + ReserveLayout, ReserveLayoutLarix, MintLayout, AccountLayout, TokenSwapLayout, +} + diff --git a/projects/helper/utils/solana/layouts/openbook-layout.js b/projects/helper/utils/solana/layouts/openbook-layout.js new file mode 100644 index 00000000000..13295c6a4ee --- /dev/null +++ b/projects/helper/utils/solana/layouts/openbook-layout.js @@ -0,0 +1,96 @@ +const { + struct, s32, u8, u16, seq, blob, Layout, bits, u32, publicKey, uint64, u64, uint128, u128, +} = require('./layout-base') + + +class WideBits extends Layout { + constructor(property) { + super(8, property); + this._lower = bits(u32(), false); + this._upper = bits(u32(), false); + } + + addBoolean(property) { + if (this._lower.fields.length < 32) { + this._lower.addBoolean(property); + } else { + this._upper.addBoolean(property); + } + } + + decode(b, offset = 0) { + const lowerDecoded = this._lower.decode(b, offset); + const upperDecoded = this._upper.decode(b, offset + this._lower.span); + return { ...lowerDecoded, ...upperDecoded }; + } + + encode(src, b, offset = 0) { + return ( + this._lower.encode(src, b, offset) + + this._upper.encode(src, b, offset + this._lower.span) + ); + } +} + +const ACCOUNT_FLAGS_LAYOUT = new WideBits(); +ACCOUNT_FLAGS_LAYOUT.addBoolean('initialized'); +ACCOUNT_FLAGS_LAYOUT.addBoolean('market'); +ACCOUNT_FLAGS_LAYOUT.addBoolean('openOrders'); +ACCOUNT_FLAGS_LAYOUT.addBoolean('requestQueue'); +ACCOUNT_FLAGS_LAYOUT.addBoolean('eventQueue'); +ACCOUNT_FLAGS_LAYOUT.addBoolean('bids'); +ACCOUNT_FLAGS_LAYOUT.addBoolean('asks'); + +function accountFlagsLayout(property = 'accountFlags') { + return ACCOUNT_FLAGS_LAYOUT.replicate(property); +} + +const MARKET_STATE_LAYOUT_V3 = struct([ + blob(5), + + accountFlagsLayout('accountFlags'), + + publicKey('ownAddress'), + + u64('vaultSignerNonce'), + + publicKey('baseMint'), + publicKey('quoteMint'), + + publicKey('baseVault'), + u64('baseDepositsTotal'), + u64('baseFeesAccrued'), + + publicKey('quoteVault'), + u64('quoteDepositsTotal'), + u64('quoteFeesAccrued'), + + u64('quoteDustThreshold'), + + publicKey('requestQueue'), + publicKey('eventQueue'), + + publicKey('bids'), + publicKey('asks'), + + u64('baseLotSize'), + u64('quoteLotSize'), + + u64('feeRateBps'), + + u64('referrerRebatesAccrued'), + + publicKey('authority'), + publicKey('pruneAuthority'), + publicKey('consumeEventsAuthority'), + + blob(992), + + blob(7), +]); + + +module.exports = { + MARKET_STATE_LAYOUT_V3, +} + diff --git a/projects/helper/utils/solana/layouts/phoenix-dex.js b/projects/helper/utils/solana/layouts/phoenix-dex.js new file mode 100644 index 00000000000..9df740147d2 --- /dev/null +++ b/projects/helper/utils/solana/layouts/phoenix-dex.js @@ -0,0 +1,37 @@ +const { + struct, s32, u8, u16, seq, blob, Layout, bits, u32, publicKey, uint64, u64, uint128, u128, +} = require('./layout-base') + +const TOKEN_PARAMS = [ + u32('decimals'), + u32('vaultBump'), + publicKey('mintKey'), + publicKey('vaultKey'), +] + +// https://github.com/Ellipsis-Labs/phoenix-sdk/blob/4663c670bb8951b4cbf5a062c54de5cd638b231c/typescript/phoenix-sdk/src/types/MarketHeader.ts#L35 +const MARKET_STATE_HEADER = struct([ + + u64('discriminant'), + u64('status'), + + struct([ + u64('bidsSize'), + u64('asksSize'), + u64('numSeats'), + ], 'marketSizeParams'), + struct(TOKEN_PARAMS, 'baseParams'), + u64('baseLotSize'), + struct(TOKEN_PARAMS, 'quoteParams'), + u64('quoteLotSize'), +]); + +const parsePhoenix = (account) => { + const { data } = account; + const buffer = Buffer.from(data.slice(0, MARKET_STATE_HEADER.span)); + return MARKET_STATE_HEADER.decode(buffer); +} + +module.exports = { + parsePhoenix, +} \ No newline at end of file diff --git a/projects/helper/utils/solana/layouts/raydium-layout.js b/projects/helper/utils/solana/layouts/raydium-layout.js new file mode 100644 index 00000000000..07190779ecb --- /dev/null +++ b/projects/helper/utils/solana/layouts/raydium-layout.js @@ -0,0 +1,187 @@ +const { + struct, s32, u8, u16, seq, blob, Layout, bits, u32, publicKey, uint64, u64, uint128, u128, +} = require('./layout-base') + +const RAYDIUM_LIQUIDITY_STATE_LAYOUT_V4 = struct([ + u64("status"), + u64("nonce"), + u64("maxOrder"), + u64("depth"), + u64("baseDecimal"), + u64("quoteDecimal"), + u64("state"), + u64("resetFlag"), + u64("minSize"), + u64("volMaxCutRatio"), + u64("amountWaveRatio"), + u64("baseLotSize"), + u64("quoteLotSize"), + u64("minPriceMultiplier"), + u64("maxPriceMultiplier"), + u64("systemDecimalValue"), + u64("minSeparateNumerator"), + u64("minSeparateDenominator"), + u64("tradeFeeNumerator"), + u64("tradeFeeDenominator"), + u64("pnlNumerator"), + u64("pnlDenominator"), + u64("swapFeeNumerator"), + u64("swapFeeDenominator"), + u64("baseNeedTakePnl"), + u64("quoteNeedTakePnl"), + u64("quoteTotalPnl"), + u64("baseTotalPnl"), + u128("quoteTotalDeposited"), + u128("baseTotalDeposited"), + u128("swapBaseInAmount"), + u128("swapQuoteOutAmount"), + u64("swapBase2QuoteFee"), + u128("swapQuoteInAmount"), + u128("swapBaseOutAmount"), + u64("swapQuote2BaseFee"), + // amm vault + publicKey("baseVault"), + publicKey("quoteVault"), + // mint + publicKey("baseMint"), + publicKey("quoteMint"), + publicKey("lpMint"), + // market + publicKey("openOrders"), + publicKey("marketId"), + publicKey("marketProgramId"), + publicKey("targetOrders"), + publicKey("withdrawQueue"), + publicKey("lpVault"), + publicKey("owner"), + // true circulating supply without lock up + u64("lpReserve"), + seq(u64(), 3, "padding"), +]) + +const RAYDIUM_REWARD_INFO = struct([ + u8("rewardState"), + u64("openTime"), + u64("endTime"), + u64("lastUpdateTime"), + u128("emissionsPerSecondX64"), + u64("rewardTotalEmissioned"), + u64("rewardClaimed"), + publicKey("tokenMint"), + publicKey("tokenVault"), + publicKey("creator"), + u128("rewardGrowthGlobalX64"), +]) + +const RAYDIUM_LIQUIDITY_STATE_LAYOUT_CLMM = struct([ + blob(8), + u8("bump"), + publicKey("ammConfig"), + publicKey("creator"), + publicKey("mintA"), + publicKey("mintB"), + publicKey("vaultA"), + publicKey("vaultB"), + publicKey("observationId"), + u8("mintDecimalsA"), + u8("mintDecimalsB"), + u16("tickSpacing"), + u128("liquidity"), + u128("sqrtPriceX64"), + s32("tickCurrent"), + u16("observationIndex"), + u16("observationUpdateDuration"), + u128("feeGrowthGlobalX64A"), + u128("feeGrowthGlobalX64B"), + u64("protocolFeesTokenA"), + u64("protocolFeesTokenB"), + + u128("swapInAmountTokenA"), + u128("swapOutAmountTokenB"), + u128("swapInAmountTokenB"), + u128("swapOutAmountTokenA"), + + u8("status"), + + seq(u8(), 7, ""), + + seq(RAYDIUM_REWARD_INFO, 3, "rewardInfos"), + seq(u64(), 16, 'tickArrayBitmap'), + + u64("totalFeesTokenA"), + u64("totalFeesClaimedTokenA"), + u64("totalFeesTokenB"), + u64("totalFeesClaimedTokenB"), + + u64("fundFeesTokenA"), + u64("fundFeesTokenB"), + + u64("startTime"), + + seq(u64(), 15 * 4 - 3, "padding"), +]) + +const RAYDIUM_STABLE_STATE_LAYOUT_V1 = struct([ + u64("accountType"), + u64("status"), + u64("nonce"), + u64("maxOrder"), + u64("depth"), + u64("baseDecimal"), + u64("quoteDecimal"), + u64("state"), + u64("resetFlag"), + u64("minSize"), + u64("volMaxCutRatio"), + u64("amountWaveRatio"), + u64("baseLotSize"), + u64("quoteLotSize"), + u64("minPriceMultiplier"), + u64("maxPriceMultiplier"), + u64("systemDecimalsValue"), + u64("abortTradeFactor"), + u64("priceTickMultiplier"), + u64("priceTick"), + // Fees + u64("minSeparateNumerator"), + u64("minSeparateDenominator"), + u64("tradeFeeNumerator"), + u64("tradeFeeDenominator"), + u64("pnlNumerator"), + u64("pnlDenominator"), + u64("swapFeeNumerator"), + u64("swapFeeDenominator"), + // OutPutData + u64("baseNeedTakePnl"), + u64("quoteNeedTakePnl"), + u64("quoteTotalPnl"), + u64("baseTotalPnl"), + u64("poolOpenTime"), + u64("punishPcAmount"), + u64("punishCoinAmount"), + u64("orderbookToInitTime"), + u128("swapBaseInAmount"), + u128("swapQuoteOutAmount"), + u128("swapQuoteInAmount"), + u128("swapBaseOutAmount"), + u64("swapQuote2BaseFee"), + u64("swapBase2QuoteFee"), + + publicKey("baseVault"), + publicKey("quoteVault"), + publicKey("baseMint"), + publicKey("quoteMint"), + publicKey("lpMint"), + + publicKey("modelDataAccount"), + publicKey("openOrders"), + publicKey("marketId"), + publicKey("marketProgramId"), + publicKey("targetOrders"), + publicKey("owner"), + seq(u64("padding"), 64, "padding"), +]) + +module.exports = { + RAYDIUM_LIQUIDITY_STATE_LAYOUT_CLMM, RAYDIUM_STABLE_STATE_LAYOUT_V1, +} \ No newline at end of file diff --git a/projects/helper/whitelistedExportKeys.json b/projects/helper/whitelistedExportKeys.json index 0fe3c0213df..8aa6014b200 100644 --- a/projects/helper/whitelistedExportKeys.json +++ b/projects/helper/whitelistedExportKeys.json @@ -8,7 +8,6 @@ "timetravel", "borrowed", "start", - "masterchef", "doublecounted", "treasury", "hallmarks", diff --git a/projects/helper/whitelistedNfts.js b/projects/helper/whitelistedNfts.js new file mode 100644 index 00000000000..a53389c888c --- /dev/null +++ b/projects/helper/whitelistedNfts.js @@ -0,0 +1,97 @@ +// Tokens added to this list must have a Chainlink price oracle so that they can be priced. +// They must also implement the abi balanceOf(address) so the number of tokens owned +// by an EOA can be counted. +const ethereum = [ + // Chromie Squiggle + // '0x059edd72cd353df5106d2b9cc5ab83a52287ac3a', + + // Bored Ape Kennel Club + '0xba30e5f9bb24caa003e9f2f0497ad287fdf95623', + + // Azuki + '0xed5af388653567af2f388e6224dc7c4b3241c544', + + // CyberBrokers + '0x892848074ddea461a15f337250da3ce55580ca85', + + // Meebits + '0x7bd29408f11d2bfc23c34f18275bbf23bb716bc7', + + // Wrapped Cryptopunks + '0xb7f7f6c52f2e2fdb1963eab30438024864c313f6', + + // Mutant Ape Yacht Club + '0x60e4d786628fea6478f785a6d7e704777c86a7c6', + + // VeeFriends + '0xa3aee8bce55beea1951ef834b99f3ac60d1abeeb', + + // Doodles + '0x8a90cab2b38dba80c64b7734e58ee1db38b8992e', + + // goblintown.wtf + '0xbce3781ae7ca1a5e050bd9c4c77369867ebc307e', + + // Cool Cats + '0x1a92f7381b9f03921564a437210bb9396471050c', + + // Forgotten Runes Wizards Cult + '0x521f9c7505005cfa19a8e5786a9c3c9c9f5e6f42', + + // Nouns + '0x9c8ff314c9bc7f6e59a9d9225fb22946427edc03', + + // LobsterDAO + '0x026224a2940bfe258d0dbe947919b62fe321f042', + + // Milady Maker + '0x5af0d9827e0c53e4799bb226655a1de152a425a5', + + // CloneX + '0x49cf6f5d44e70224e2e23fdcdd2c053f30ada28b', + + // Otherdeed for Otherside + '0x34d85c9cdeb23fa97cb08333b511ac86e1c4e258', + + // MoonBirds + '0x23581767a106ae21c074b2276d25e5c3e136a68b', + + // World of Women + '0xe785e82358879f061bc3dcac6f0444462d4b5330', + + // Pudgy Penguins + '0xbd3531da5cf5857e7cfaa92426877b022e612cf8', + + // CrypToadz + '0x1cb1a5e65610aeff2551a50f76a87a7d3fb649c6', + + // CryptoDickbutts + '0x42069abfe407c60cf4ae4112bedead391dba1cdb', + + // Bored Ape Yacht Club + '0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d', + + // DigiDaigaku Genesis + '0xd1258db6ac08eb0e625b75b371c023da478e94a9', + + // Decentraland + '0xf87e31492faf9a91b02ee0deaad50d51d56d5d4d', + + // Sandbox's LANDs + '0x5cc5b05a8a13e3fbdb0bb9fccd98d38e50f90c38', + + // BEANZ + '0x306b1ea3ecdf94ab739f1910bbda052ed4a9f949', + + // Wrapped Ether rock + '0xa3f5998047579334607c47a6a2889bf87a17fc02', +].map(i => i.toLowerCase()) + +const AB_OLD_COLLECTIONS = ["0x059edd72cd353df5106d2b9cc5ab83a52287ac3a:0:999999","0x059edd72cd353df5106d2b9cc5ab83a52287ac3a:1000000:1999999","0x059edd72cd353df5106d2b9cc5ab83a52287ac3a:2000000:2999999"] +const AB_COLLECTIONS = ["0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:78000000:78999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:13000000:13999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:163000000:163999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:159000000:159999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:23000000:23999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:138000000:138999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:143000000:143999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:129000000:129999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:173000000:173999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:215000000:215999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:53000000:53999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:119000000:119999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:204000000:204999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:98000000:98999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:304000000:304999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:8000000:8999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:121000000:121999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:282000000:282999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:137000000:137999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:100000000:100999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:7000000:7999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:255000000:255999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:22000000:22999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:131000000:131999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:233000000:233999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:147000000:147999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:145000000:145999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:12000000:12999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:72000000:72999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:141000000:141999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:28000000:28999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:64000000:64999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:76000000:76999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:74000000:74999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:27000000:27999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:11000000:11999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:114000000:114999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:118000000:118999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:367000000:367999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:89000000:89999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:95000000:95999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:162000000:162999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:139000000:139999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:112000000:112999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:3000000:3999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:116000000:116999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:334000000:334999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:59000000:59999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:40000000:40999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:29000000:29999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:37000000:37999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:35000000:35999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:4000000:4999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:120000000:120999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:214000000:214999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:39000000:39999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:225000000:225999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:117000000:117999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:130000000:130999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:17000000:17999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:41000000:41999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:108000000:108999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:62000000:62999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:172000000:172999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:164000000:164999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:232000000:232999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:152000000:152999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:21000000:21999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:103000000:103999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:250000000:250999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:134000000:134999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:228000000:228999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:9000000:9999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:10000000:10999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:73000000:73999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:135000000:135999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:113000000:113999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:77000000:77999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:339000000:339999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:104000000:104999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:16000000:16999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:333000000:333999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:206000000:206999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:328000000:328999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:267000000:267999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:19000000:19999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:174000000:174999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:149000000:149999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:25000000:25999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:63000000:63999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:209000000:209999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:281000000:281999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:144000000:144999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:284000000:284999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:368000000:368999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:140000000:140999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:142000000:142999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:341000000:341999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:68000000:68999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:96000000:96999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:32000000:32999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:253000000:253999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:203000000:203999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:189000000:189999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:301000000:301999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:124000000:124999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:337000000:337999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:133000000:133999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:86000000:86999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:371000000:371999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:90000000:90999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:217000000:217999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:122000000:122999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:191000000:191999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:330000000:330999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:364000000:364999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:123000000:123999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:106000000:106999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:294000000:294999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:30000000:30999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:136000000:136999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:26000000:26999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:109000000:109999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:50000000:50999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:261000000:261999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:227000000:227999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:146000000:146999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:42000000:42999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:102000000:102999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:84000000:84999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:309000000:309999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:125000000:125999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:165000000:165999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:101000000:101999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:110000000:110999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:160000000:160999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:105000000:105999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:57000000:57999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:18000000:18999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:65000000:65999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:126000000:126999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:52000000:52999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:92000000:92999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:321000000:321999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:226000000:226999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:31000000:31999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:20000000:20999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:313000000:313999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:14000000:14999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:51000000:51999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:320000000:320999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:70000000:70999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:180000000:180999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:34000000:34999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:127000000:127999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:167000000:167999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:48000000:48999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:256000000:256999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:15000000:15999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:83000000:83999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:336000000:336999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:44000000:44999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:99000000:99999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:289000000:289999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:67000000:67999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:6000000:6999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:156000000:156999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:56000000:56999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:344000000:344999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:69000000:69999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:150000000:150999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:276000000:276999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:5000000:5999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:296000000:296999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:97000000:97999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:157000000:157999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:260000000:260999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:212000000:212999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:47000000:47999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:36000000:36999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:329000000:329999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:66000000:66999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:234000000:234999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:91000000:91999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:49000000:49999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:356000000:356999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:93000000:93999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:75000000:75999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:38000000:38999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:46000000:46999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:82000000:82999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:350000000:350999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:88000000:88999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:326000000:326999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:111000000:111999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:351000000:351999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:340000000:340999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:24000000:24999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:107000000:107999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:85000000:85999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:196000000:196999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:272000000:272999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:318000000:318999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:71000000:71999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:87000000:87999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:79000000:79999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:319000000:319999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:33000000:33999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:45000000:45999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:188000000:188999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:338000000:338999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:55000000:55999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:208000000:208999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:216000000:216999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:54000000:54999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:132000000:132999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:60000000:60999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:230000000:230999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:171000000:171999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:153000000:153999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:58000000:58999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:94000000:94999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:366000000:366999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:370000000:370999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:81000000:81999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:353000000:353999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:358000000:358999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:346000000:346999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:178000000:178999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:310000000:310999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:312000000:312999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:154000000:154999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:80000000:80999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:43000000:43999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:151000000:151999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:317000000:317999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:354000000:354999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:169000000:169999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:323000000:323999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:314000000:314999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:331000000:331999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:283000000:283999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:222000000:222999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:362000000:362999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:280000000:280999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:265000000:265999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:161000000:161999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:166000000:166999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:347000000:347999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:311000000:311999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:292000000:292999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:235000000:235999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:115000000:115999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:197000000:197999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:61000000:61999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:200000000:200999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:158000000:158999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:205000000:205999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:316000000:316999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:231000000:231999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:343000000:343999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:248000000:248999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:291000000:291999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:355000000:355999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:279000000:279999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:335000000:335999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:277000000:277999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:285000000:285999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:361000000:361999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:213000000:213999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:365000000:365999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:288000000:288999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:286000000:286999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:324000000:324999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:357000000:357999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:264000000:264999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:270000000:270999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:246000000:246999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:332000000:332999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:293000000:293999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:242000000:242999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:185000000:185999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:307000000:307999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:273000000:273999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:275000000:275999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:278000000:278999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:349000000:349999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:229000000:229999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:263000000:263999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:373000000:373999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:308000000:308999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:258000000:258999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:220000000:220999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:207000000:207999999","0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270:359000000:359999999"] + +module.exports = { + ethereum, + AB_OLD_COLLECTIONS, + AB_COLLECTIONS, +}; diff --git a/projects/helper/yieldHelper.js b/projects/helper/yieldHelper.js index 7ad08d7a136..452e56237ed 100644 --- a/projects/helper/yieldHelper.js +++ b/projects/helper/yieldHelper.js @@ -1,8 +1,8 @@ +const ADDRESSES = require('./coreAssets.json') const abi = require("../tenfinance/abi.json") -const { getParamCalls, getUniqueAddresses, log, } = require('../helper/utils') -const { getLPData, } = require('../helper/unknownTokens') -const { getChainTransform, getFixBalancesSync, } = require('../helper/portedTokens') +const { getUniqueAddresses, } = require('../helper/utils') +const { getLPData, getTokenPrices } = require('../helper/unknownTokens') const sdk = require('@defillama/sdk') const { unwrapLPsAuto } = require("./unwrapLPs") @@ -19,85 +19,101 @@ function yieldHelper({ poolFilter, getPoolIds, getTokens, + getTokenBalances, + useDefaultCoreAssets = false, + getPoolsFn, }) { blacklistedTokens = getUniqueAddresses(blacklistedTokens) - nativeTokens = getUniqueAddresses(blacklistedTokens) + if (nativeToken) nativeTokens.push(nativeToken) + nativeTokens = getUniqueAddresses(nativeTokens) if (!project) throw new Error('Missing project name') - if (nativeToken) nativeTokens = [nativeToken] - async function getAllTVL(block) { - const key = `${project}-${chain}-${block}` + async function getAllTVL(api) { + const key = `${project}-${chain}-${api.block}` if (!allData[key]) allData[key] = _getAllTVL() return allData[key] async function _getAllTVL() { - const transform = await getChainTransform(chain) - const fixBalances = getFixBalancesSync(chain) + const transform = i => `${chain}:${i.toLowerCase()}` const balances = { tvl: {}, pool2: {}, + staking: {}, } - const { output: poolLength } = await sdk.api.abi.call({ - target: masterchef, - abi: abis.poolLength || abi.poolLength, - chain, block, - }) - - log('Pool length: ', poolLength) - - let { output: poolInfos } = await sdk.api.abi.multiCall({ - target: masterchef, - calls: getParamCalls(poolLength), - abi: abis.poolInfo || abi.poolInfo, - chain, block, - }) + let poolInfos + if (getPoolsFn) { + poolInfos = await getPoolsFn(api) + } else { + poolInfos = await api.fetchList({ + lengthAbi: abis.poolLength || abi.poolLength, + itemAbi: abis.poolInfo || abi.poolInfo, + target: masterchef, + }) + } - let _poolFilter = ({ output }) => !blacklistedTokens.includes(output.want.toLowerCase()) && !blacklistedTokens.includes(output.strat.toLowerCase()) - let _getPoolIds = i => i.output.strat + let _poolFilter = i => !blacklistedTokens.includes(i.want.toLowerCase()) && !blacklistedTokens.includes(i.strat?.toLowerCase()) && i.strat !== ADDRESSES.null + let _getPoolIds = i => i.strat if (getPoolIds) _getPoolIds = getPoolIds if (poolFilter) _poolFilter = poolFilter poolInfos = poolInfos.filter(_poolFilter) const poolIds = poolInfos.map(_getPoolIds) - - const { output: lockedTotals } = await sdk.api.abi.multiCall({ - abi: abis.wantLockedTotal || abi.wantLockedTotal, - calls: poolIds.map(i => ({ target: i})), - chain, block, - }) + let lockedTotals + + if (getTokenBalances) { + lockedTotals = await getTokenBalances({ api, poolInfos, poolIds, }) + } else { + lockedTotals = await api.multiCall({ + abi: abis.wantLockedTotal || abi.wantLockedTotal, + calls: poolIds, + }) + } let tokens - if (getTokens) tokens = await getTokens({ poolInfos, chain, block, }) - else tokens = poolInfos.map(i => i.output.want.toLowerCase()) - const pairInfos = await getLPData({ chain, block, lps: tokens, }) + if (getTokens) { + tokens = await getTokens({ poolInfos, api }) + } + else tokens = poolInfos.map(i => i.want.toLowerCase()) + const pairInfos = await getLPData({ lps: tokens, ...api, abis, }) + const blacklistedSet = new Set(...(blacklistedTokens.map(i => i.toLowerCase()))) tokens.forEach((token, i) => { - if (pairInfos[token] && + if (nativeTokens.includes(token)) { + sdk.util.sumSingleBalance(balances.staking, transform(token), lockedTotals[i]) + } else if (pairInfos[token] && (nativeTokens.includes(pairInfos[token].token0Address) || nativeTokens.includes(pairInfos[token].token1Address)) ) { - sdk.util.sumSingleBalance(balances.pool2, transform(token), lockedTotals[i].output) + sdk.util.sumSingleBalance(balances.pool2, transform(token), lockedTotals[i]) } else { - sdk.util.sumSingleBalance(balances.tvl, transform(token), lockedTotals[i].output) + if (!blacklistedSet.has(token.toLowerCase())) + sdk.util.sumSingleBalance(balances.tvl, transform(token), lockedTotals[i]) } }) await Promise.all([ - unwrapLPsAuto({ balances: balances.tvl, chain, block, transformAddress: transform, }), - unwrapLPsAuto({ balances: balances.pool2, chain, block, transformAddress: transform, }), + unwrapLPsAuto({ api, balances: balances.tvl, transformAddress: transform, abis, }), + unwrapLPsAuto({ api, balances: balances.pool2, transformAddress: transform, abis, }), ]) - fixBalances(balances.tvl) - fixBalances(balances.pool2) + const lps = Object.keys(pairInfos) + if (lps.length && useDefaultCoreAssets) { + const { updateBalances } = await getTokenPrices({ lps, ...api, abis, useDefaultCoreAssets, }) + balances.tvl = await updateBalances(balances.tvl) + balances.pool2 = await updateBalances(balances.pool2) + balances.staking = await updateBalances(balances.staking) + } return balances } } return { + misrepresentedTokens: useDefaultCoreAssets, [chain]: { - tvl: async (_, _b, { [chain]: block }) => (await getAllTVL(block)).tvl, - pool2: async (_, _b, { [chain]: block }) => (await getAllTVL(block)).pool2, + tvl: async (_, _b, _cb, { api }) => (await getAllTVL(api)).tvl, + pool2: async (_, _b, _cb, { api }) => (await getAllTVL(api)).pool2, + staking: async (_, _b, _cb, { api }) => (await getAllTVL(api)).staking, } } } diff --git a/projects/heraswap/index.js b/projects/heraswap/index.js new file mode 100644 index 00000000000..485c0d0d803 --- /dev/null +++ b/projects/heraswap/index.js @@ -0,0 +1,8 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports = { + misrepresentedTokens: true, + onus: { + tvl: getUniTVL({ factory: '0x6CD368495D90b9Ba81660e2b35f7Ea2AcE2B8cD6', useDefaultCoreAssets: true }), + } +} \ No newline at end of file diff --git a/projects/here-staking/index.js b/projects/here-staking/index.js new file mode 100644 index 00000000000..e0d77de7150 --- /dev/null +++ b/projects/here-staking/index.js @@ -0,0 +1,16 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { call } = require('../helper/chain/near') + +async function tvl() { + const here_balance = await call("storage.herewallet.near", 'ft_total_supply', {}); + return { + near: (here_balance / 1e24) + }; +} + +module.exports = { + near: { + tvl + }, + timetravel: false, +}; \ No newline at end of file diff --git a/projects/hermes-protocol/index.js b/projects/hermes-protocol/index.js index 18fd020429b..d1a24e441e3 100644 --- a/projects/hermes-protocol/index.js +++ b/projects/hermes-protocol/index.js @@ -2,8 +2,9 @@ const {uniTvlExport} = require('../helper/calculateUniTvl.js') const { staking } = require('../helper/staking') module.exports = { + misrepresentedTokens: true, metis:{ - tvl: uniTvlExport("0x633a093C9e94f64500FC8fCBB48e90dd52F6668F", "metis"), + tvl: uniTvlExport("0x633a093C9e94f64500FC8fCBB48e90dd52F6668F", "metis", undefined, undefined, { hasStablePools: true, useDefaultCoreAssets: true, }), staking: staking("0xa4C546c8F3ca15aa537D2ac3f62EE808d915B65b", "0xb27bbeaaca2c00d6258c3118bab6b5b6975161c8","metis"), }, } diff --git a/projects/hermes/abi.json b/projects/hermes/abi.json index aec92ca258c..f1669f797da 100644 --- a/projects/hermes/abi.json +++ b/projects/hermes/abi.json @@ -1,110 +1,7 @@ { - "poolInfo": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "poolInfo", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "lpToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "allocPoint", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastRewardBlock", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accIrisPerShare", - "type": "uint256" - }, - { - "internalType": "uint16", - "name": "depositFeeBP", - "type": "uint16" - }, - { - "internalType": "uint256", - "name": "lpSupply", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "balance": { - "inputs": [], - "name": "balance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "balanceof": { - "constant": true, - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "token0": { - "constant": true, - "inputs": [], - "name": "token0", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "token1": { - "constant": true, - "inputs": [], - "name": "token1", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } -} + "poolInfo": "function poolInfo(uint256) view returns (address lpToken, uint256 allocPoint, uint256 lastRewardBlock, uint256 accIrisPerShare, uint16 depositFeeBP, uint256 lpSupply)", + "balance": "uint256:balance", + "balanceof": "function balanceOf(address) view returns (uint256)", + "token0": "address:token0", + "token1": "address:token1" +} \ No newline at end of file diff --git a/projects/hermes/index.js b/projects/hermes/index.js index 1850dde22b0..c76c3ad21a8 100644 --- a/projects/hermes/index.js +++ b/projects/hermes/index.js @@ -9,13 +9,11 @@ module.exports = { harmony: { tvl: getUniTVL({ factory: '0xfe5e54a8e28534fffe89b9cfddfd18d3a90b42ca', - chain: 'harmony', useDefaultCoreAssets: true, }), staking: staking({ owners: ['0x28a4e128f823b1b3168f82f64ea768569a25a37f', '0x8812420fb6e5d971c969ccef2275210ab8d014f0'], tokens: ['0xba4476a302f5bc1dc4053cf79106dc43455904a3'], - chain: 'harmony', useDefaultCoreAssets: true, lps: ['0x8604197eb7123888b551fe78a8828b895608d093'], }), diff --git a/projects/hex/abi.json b/projects/hex/abi.json index c187635be16..4bdfc254c54 100644 --- a/projects/hex/abi.json +++ b/projects/hex/abi.json @@ -1,3 +1,3 @@ { - "globalInfo":{"constant":true,"inputs":[],"name":"globalInfo","outputs":[{"internalType":"uint256[13]","name":"","type":"uint256[13]"}],"payable":false,"stateMutability":"view","type":"function"} + "globalInfo": "function globalInfo() view returns (uint256[13])" } \ No newline at end of file diff --git a/projects/hex/index.js b/projects/hex/index.js index 7e62ef710c2..8a84d9e9a39 100644 --- a/projects/hex/index.js +++ b/projects/hex/index.js @@ -1,7 +1,8 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk") const abi = require('./abi.json') -const HEX = "0x2b591e99afe9f32eaa6214f7b7629768c40eeb39" +const HEX = ADDRESSES.pulse.HEX async function staking(timestamp, block){ const globalInfo = await sdk.api.abi.call({ target: HEX, diff --git a/projects/hexal/index.js b/projects/hexal/index.js index f655c43f03a..043012525d5 100644 --- a/projects/hexal/index.js +++ b/projects/hexal/index.js @@ -1,15 +1,16 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { ohmTvl } = require("../helper/ohm"); const treasury = "0xC06A7e21289E35eA94cE67C0f7AfAD4e972117D8"; const stakingContract = "0x2f6A0D592f7F24D71c4EcA815c94d43AbE190fc3"; const hexal = "0x57612d60b415ad812da9a7cf5672084796a4ab81"; const treasuryTokens = [ - ["0xe9e7cea3dedca5984780bafc599bd69add087d56", false], - ["0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d", false], + [ADDRESSES.bsc.BUSD, false], + [ADDRESSES.bsc.USDC, false], ["0x0e09fabb73bd3ade0a17ecc321fd13a19e81ce82", false], ["0x1af3f329e8be154074d8769d1ffa4ee058b1dbc3", false], - ["0x55d398326f99059ff775485246999027b3197955", false], - ["0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c", false], + [ADDRESSES.bsc.USDT, false], + [ADDRESSES.bsc.WBNB, false], ["0xc94364d0ffd3c015689f55e167ac359eb93c617e", true] ] diff --git a/projects/hfione/abi.json b/projects/hfione/abi.json index fc416c996e9..d316a6bc06a 100644 --- a/projects/hfione/abi.json +++ b/projects/hfione/abi.json @@ -1,28 +1,4 @@ { - "token": { - "inputs": [], - "name": "token", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "totalSupply": { - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -} + "token": "address:token", + "totalSupply": "uint256:totalSupply" +} \ No newline at end of file diff --git a/projects/hidden-hand/index.js b/projects/hidden-hand/index.js new file mode 100644 index 00000000000..8f9deeb7afd --- /dev/null +++ b/projects/hidden-hand/index.js @@ -0,0 +1,84 @@ +const { sumTokens2 } = require('../helper/unwrapLPs') +const { cachedGraphQuery } = require('../helper/cache') + +const protocol_contracts = { + ethereum: { + v1: { + distributor: "0x0b139682d5c9df3e735063f46fb98c689540cf3a", + vault: "0x9DDb2da7Dd76612e0df237B89AF2CF4413733212", + }, + v2: { + distributor: "0xa9b08B4CeEC1EF29EdEC7F9C94583270337D6416", + vault: "0xE00fe722e5bE7ad45b1A16066E431E47Df476CeC", + harvester: "0xd23aa7EdF42CD3Fc4CD391faAbc0c207B1c86542", + }, + }, + optimism: { + v1: { + distributor: "0x0b139682d5c9df3e735063f46fb98c689540cf3a", + vault: "0x9DDb2da7Dd76612e0df237B89AF2CF4413733212", + }, + v2: { + distributor: "0x7354BB6842E421773E7b78f8875A1B85991677c0", + vault: "0xa9b08B4CeEC1EF29EdEC7F9C94583270337D6416", + harvester: "0x4573F58461acd1a6C743d9CDE34A142Ca18B6873", + }, + }, + arbitrum: { + v2: { + distributor: "0x0A390DE04B7717B078CF5c8A7Eb891130d4a843b", + vault: "0x8d89593c199Cb763bDEF04529F978f82503E4669", + harvester: "0xcA795Dc6f668add4801D2B92cF36C8FBcBEb8Ac4", + }, + }, +}; + +const subgraphs = { + ethereum: { + v1: "https://api.thegraph.com/subgraphs/name/albuquerque-rafael/hidden-hand", + v2: "https://api.thegraph.com/subgraphs/name/albuquerque-rafael/hidden-hand-v2", + }, + optimism: { + v1: "https://api.thegraph.com/subgraphs/name/albuquerque-rafael/hidden-hand-v1-optimism", + v2: "https://api.thegraph.com/subgraphs/name/albuquerque-rafael/hidden-hand-v2-optimism", + }, + arbitrum: { + v2: "https://api.thegraph.com/subgraphs/name/albuquerque-rafael/hidden-hand-v2-arbitrum", + }, +}; + +async function getTokens(chain, version) { + const graphQuery = ` + { + tokens { + address + } + } + `; + + const { tokens } = await cachedGraphQuery(`hidden-hand/${chain}-${version}`, subgraphs[chain][version], graphQuery); + const addresses = tokens.map((token) => token.address); + + return addresses; +} + +async function tvl(ts, block, _, { api }) { + const { chain } = api + const ownerTokens = [] + + for (const version of Object.keys(protocol_contracts[chain])) { + const tokens = await getTokens(chain, version); + for (const owner of Object.values(protocol_contracts[chain][version])) { + ownerTokens.push([tokens, owner]) + } + } + + return sumTokens2({ api, ownerTokens, permitFailure: true, }); +} + +module.exports = { + methodology: `Sums bribe tokens deposited on Hidden Hand Reward Distributors, Bribe Vaults and Harvester contracts.`, + ethereum: { tvl }, + optimism: { tvl }, + arbitrum: { tvl }, +}; diff --git a/projects/hippowswap/index.js b/projects/hippowswap/index.js index cd4a8637973..b05c5fd65da 100644 --- a/projects/hippowswap/index.js +++ b/projects/hippowswap/index.js @@ -4,7 +4,6 @@ module.exports = { misrepresentedTokens: true, ethpow: { tvl: getUniTVL({ - chain: 'ethpow', useDefaultCoreAssets: true, factory: '0x8cF9A887e53be909C221A2708E72898546dAB7Cc', }) diff --git a/projects/hiveswap/index.js b/projects/hiveswap/index.js new file mode 100644 index 00000000000..a885a86089a --- /dev/null +++ b/projects/hiveswap/index.js @@ -0,0 +1,3 @@ +const { uniTvlExport } = require("../helper/unknownTokens") + +module.exports = uniTvlExport('map', '0x29c3d087302e3fCb75F16175A09E4C39119459B2') \ No newline at end of file diff --git a/projects/hodl/index.js b/projects/hodl/index.js index e51dd5ccc43..b0edb7951e1 100644 --- a/projects/hodl/index.js +++ b/projects/hodl/index.js @@ -19,5 +19,8 @@ async function fetch() { } module.exports = { + mixin: { + fetch + }, fetch } diff --git a/projects/holdr-fi/index.js b/projects/holdr-fi/index.js new file mode 100644 index 00000000000..1e387f592e9 --- /dev/null +++ b/projects/holdr-fi/index.js @@ -0,0 +1,7 @@ +const { onChainTvl } = require('../helper/balancer') + +module.exports = { + aurora: { + tvl: onChainTvl('0x364d44dFc31b3d7b607797B514348d57Ad0D784E', 78113009) + }, +} \ No newline at end of file diff --git a/projects/holdstation/index.js b/projects/holdstation/index.js new file mode 100644 index 00000000000..b3998098a40 --- /dev/null +++ b/projects/holdstation/index.js @@ -0,0 +1,15 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokens2 } = require("../helper/unwrapLPs"); + +const vault = "0xaf08a9d918f16332F22cf8Dc9ABE9D9E14DdcbC2"; +const usdc = ADDRESSES.era.USDC; + +async function tvl(_, _b, _cb, { api }) { + return sumTokens2({ api, tokens: [usdc], owners: [vault] }); +} + +module.exports = { + era: { + tvl, + }, +}; diff --git a/projects/homecoin/abi.json b/projects/homecoin/abi.json index f1904fbbccf..caf6e6be1cf 100644 --- a/projects/homecoin/abi.json +++ b/projects/homecoin/abi.json @@ -1,40 +1,3 @@ { - "getContractData": { - "inputs": [], - "name": "getContractData", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -} + "getContractData": "function getContractData() view returns (address, address, uint256, uint256, uint256, uint256)" +} \ No newline at end of file diff --git a/projects/homecoin/index.js b/projects/homecoin/index.js index 0e0f8555321..5d912559f5f 100644 --- a/projects/homecoin/index.js +++ b/projects/homecoin/index.js @@ -1,10 +1,11 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const { sumTokens } = require("../helper/unwrapLPs"); const abi = require("./abi.json"); const BigNumber = require("bignumber.js"); const HOME = "0xb8919522331C59f5C16bDfAA6A121a6E03A91F62"; -const USDC = "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"; +const USDC = ADDRESSES.ethereum.USDC; const HOME_START = 13313474 /** diff --git a/projects/honeyswap/index.js b/projects/honeyswap/index.js index e1d8500a758..5d94a36f0cb 100644 --- a/projects/honeyswap/index.js +++ b/projects/honeyswap/index.js @@ -4,7 +4,6 @@ module.exports = { misrepresentedTokens: true, xdai: { tvl: getUniTVL({ - chain: 'xdai', factory: '0xa818b4f111ccac7aa31d0bcc0806d64f2e0737d7', useDefaultCoreAssets: true, blacklist: [ @@ -20,7 +19,6 @@ module.exports = { }, polygon: { tvl: getUniTVL({ - chain: 'polygon', factory: '0x03daa61d8007443a6584e3d8f85105096543c19c', useDefaultCoreAssets: true, blacklist: ['0x8db0a6d1b06950b4e81c4f67d1289fc7b9359c7f'] diff --git a/projects/honkswap/index.js b/projects/honkswap/index.js index b4628b5635d..b3ecdb1906e 100644 --- a/projects/honkswap/index.js +++ b/projects/honkswap/index.js @@ -1,7 +1,8 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { getUniTVL } = require('../helper/unknownTokens') const HONK = "0xF2d4D9c65C2d1080ac9e1895F6a32045741831Cd"; -const WBCH = "0x3743eC0673453E5009310C727Ba4eaF7b3a1cc04"; +const WBCH = ADDRESSES.smartbch.WBCH; const FACTORY = "0x34D7ffF45108De08Ca9744aCdf2e8C50AAC1C73C"; module.exports = { diff --git a/projects/hop/index.js b/projects/hop/index.js index c151f17dd5a..cf62bfc65d9 100644 --- a/projects/hop/index.js +++ b/projects/hop/index.js @@ -1,42 +1,30 @@ -const sdk = require('@defillama/sdk') -const { getChainTransform } = require('../helper/portedTokens') const { chainExports } = require('../helper/exports') const { default: axios } = require('axios') +const { sumTokens2 } = require('../helper/unwrapLPs') +const { getConfig } = require('../helper/cache') + +const chainMapping = { + xdai: 'gnosis', + arbitrum_nova: 'nova' +} +const getChainKey = chain => chainMapping[chain] ?? chain + // node test.js projects/hop/index.js -const WETH = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2" function chainTvl(chain) { - return async (timestamp, ethBlock, {[chain]: block}) => { - const balances = {} - let transform = await getChainTransform(chain) - const tokens = await axios('https://raw.githubusercontent.com/hop-protocol/hop/develop/packages/core/build/addresses/mainnet.json') - for (const tokenConstants of Object.values(tokens.data.bridges)) { - const chainConstants = (chain == 'xdai' ? tokenConstants['gnosis'] : tokenConstants[chain]) - if (chainConstants === undefined) { + return async (_, _b, {[chain]: block}) => { + const toa = [] + const { bridges, bonders } = await getConfig('hop-protocol', 'https://raw.githubusercontent.com/hop-protocol/hop/develop/packages/core/build/addresses/mainnet.json') + for (const tokenConstants of Object.values(bridges)) { + const chainConstants = tokenConstants[getChainKey(chain)] + if (chainConstants === undefined) continue - } let token = chainConstants.l2CanonicalToken ?? chainConstants.l1CanonicalToken; let bridge = chainConstants.l2SaddleSwap ?? chainConstants.l1Bridge; - let amount; - if (token === "0x0000000000000000000000000000000000000000" && chain === "ethereum") { - token = WETH - amount = await sdk.api.eth.getBalance({ - target: bridge, - block, - chain - }) - } else { - amount = await sdk.api.erc20.balanceOf({ - target: token, - owner: bridge, - block, - chain - }) - } - sdk.util.sumSingleBalance(balances, transform(token), amount.output) + toa.push([token, bridge]) } if (chain === "ethereum") { - for (const bonder of Object.entries(tokens.data.bonders)) { + for (const bonder of Object.entries(bonders)) { const tokenName = bonder[0] let contractList = [] for (let i of Object.values(bonder[1])) { @@ -49,26 +37,13 @@ function chainTvl(chain) { } } for (const contract of contractList) { - if (tokenName === "ETH") { - const amount = await sdk.api.eth.getBalance({ - target: contract, - block, - }) - sdk.util.sumSingleBalance(balances, WETH, amount.output) - } else { - const token = tokens.data.bridges[tokenName].ethereum.l1CanonicalToken - const amount = await sdk.api.erc20.balanceOf({ - target: token, - owner: contract, - block, - }) - sdk.util.sumSingleBalance(balances, token, amount.output) - } + const token = bridges[tokenName].ethereum.l1CanonicalToken + toa.push([token, contract]) } } } - return balances + return sumTokens2({ chain, tokensAndOwners: toa, block, }) } } -module.exports = chainExports(chainTvl, ['ethereum', 'xdai', 'polygon', 'optimism', 'arbitrum']) \ No newline at end of file +module.exports = chainExports(chainTvl, ['ethereum', 'polygon', 'optimism', 'arbitrum', ...Object.keys(chainMapping)]) \ No newline at end of file diff --git a/projects/hope-swap/index.js b/projects/hope-swap/index.js new file mode 100644 index 00000000000..1c8fabe0c41 --- /dev/null +++ b/projects/hope-swap/index.js @@ -0,0 +1,8 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports = { + misrepresentedTokens: true, + ethereum: { + tvl: getUniTVL({ factory: '0x26F53fbADeEb777fb2A122dC703433d79241b64e', useDefaultCoreAssets: true, fetchBalances: true }), + }, +}; \ No newline at end of file diff --git a/projects/hopswap/index.js b/projects/hopswap/index.js index 67d318847bf..076eaf43384 100644 --- a/projects/hopswap/index.js +++ b/projects/hopswap/index.js @@ -5,7 +5,6 @@ module.exports = { cronos: { tvl: getUniTVL({ factory: '0x918cefF586C00c1fa4726Dc50697172fd87df8e9', - chain: 'cronos', useDefaultCoreAssets: true }) }, diff --git a/projects/hord-fi/index.js b/projects/hord-fi/index.js new file mode 100644 index 00000000000..34995631feb --- /dev/null +++ b/projects/hord-fi/index.js @@ -0,0 +1,10 @@ +const { get } = require('../helper/http') +module.exports = { + timetravel: false, + ethereum: { + tvl: async () => { + const { stats } = await get('https://api.hord.app/validators/stats/latest') + return { ethereum: stats.total_eth_staked } + } + } +} \ No newline at end of file diff --git a/projects/horizon/collateral.js b/projects/horizon/collateral.js index a9d20813109..55544343ac6 100644 --- a/projects/horizon/collateral.js +++ b/projects/horizon/collateral.js @@ -1,5 +1,5 @@ const { request, gql } = require("graphql-request"); -const { getBlock } = require('../helper/getBlock'); +const { getBlock } = require('../helper/http'); const graph_endpoint = 'https://api.thegraph.com/subgraphs/name/rout-horizon/bsc15-issuance' const graphQuery = gql` diff --git a/projects/horizondex/index.js b/projects/horizondex/index.js new file mode 100644 index 00000000000..3ae6099763e --- /dev/null +++ b/projects/horizondex/index.js @@ -0,0 +1,12 @@ +const { uniV3Export } = require("../helper/uniswapV3"); + +module.exports = uniV3Export({ + linea: { + factory: "0x9Fe607e5dCd0Ea318dBB4D8a7B04fa553d6cB2c5", + fromBlock: 1150, + }, + base: { + factory: "0x07AceD5690e09935b1c0e6E88B772d9440F64718", + fromBlock: 2053334, + }, +}); diff --git a/projects/hotbit/index.js b/projects/hotbit/index.js new file mode 100644 index 00000000000..1d37046092c --- /dev/null +++ b/projects/hotbit/index.js @@ -0,0 +1,82 @@ +const { cexExports } = require('../helper/cex') + +const config = { + bsc: { + owners: [ + '0xC7029E939075F48fa2D5953381660c7d01570171', + '0xb18fbfe3d34fdc227eb4508cde437412b6233121', + '0x768f2a7ccdfde9ebdfd5cea8b635dd590cb3a3f1', + ], + }, + ethereum: { + owners: [ + '0x562680a4dc50ed2f14d75bf31f494cfe0b8d10a1', + '0xb18fbfe3d34fdc227eb4508cde437412b6233121', + '0x768f2a7ccdfde9ebdfd5cea8b635dd590cb3a3f1' + ] + }, + tron: { + owners: [ + 'TS9b9boewmB6tq874PnVZrKPf4NZw9qHPi', + 'TFPqi7KTRwi2tihwS5dp1QomHowp1x2f45', + ] + }, + bitcoin: { + owners: ['1MiFZMJkFMhMrubjjo6f5oEhh7XgSwXWgp'] + }, + ripple: { + owners: ['rJKBidE4Av6ZaFTBcAucZXCpU7QvNXyfpT'] + }, + arbitrum: { + owners: [ + '0xd690a9DfD7e4B02898Cdd1a9E50eD1fd7D3d3442', + '0x768f2a7ccdfde9ebdfd5cea8b635dd590cb3a3f1', + '0xb18fbfe3d34fdc227eb4508cde437412b6233121' + ] + }, + avax: { + owners: [ + '0x6C2e8d4F73f6A129843d1b3D2ACAFF1DB22E3366', + '0x768f2a7ccdfde9ebdfd5cea8b635dd590cb3a3f1', + '0xb18fbfe3d34fdc227eb4508cde437412b6233121' + ] + }, + polygon: { + owners: [ + '0xb34ed85bc0b9da2fa3c5e5d2f4b24f8ee96ce4e9', + '0x768f2a7ccdfde9ebdfd5cea8b635dd590cb3a3f1', + '0xb18fbfe3d34fdc227eb4508cde437412b6233121' + ] + }, + optimism: { + owners: [ + '0xfa6cf22527d88270eea37f45af1808adbf3c1b17', + '0xb18fbfe3d34fdc227eb4508cde437412b6233121', + '0x768f2a7ccdfde9ebdfd5cea8b635dd590cb3a3f1' + + ] + }, + fantom: { + owners: [ + '0xc62A0781934744E05927ceABB94a3043CdCfEA89', + '0x768f2a7ccdfde9ebdfd5cea8b635dd590cb3a3f1', + '0xb18fbfe3d34fdc227eb4508cde437412b6233121' + ] + }, + eos:{ + owners: [ + 'hotbitioeoss', + 'hotbitioeos2' + ] + }, + cronos: { + owners: [ + '0x768f2a7ccdfde9ebdfd5cea8b635dd590cb3a3f1', + '0x4b81c7Ff6912856AFBb40ACb32084A41F019B433', + '0xb18fbfe3d34fdc227eb4508cde437412b6233121' + ] + } +} + +module.exports = cexExports(config) +module.exports.methodology = 'We have collect this wallets from Hotbit Team on the 14/12/22 and added more on the 09/02/2023. We are not counting money in defi Protocols. In this case around $3.1m in Curve (Ethereum chain), around $1.1m in Convex, $1.6m in BendDAO, $960k in PancakeSwap (BSC Chain), $650k in Beefy, $230K in AutoFarm. We are also not counting around $622km in the Telcoin (Polygon) and $516k in Sandbox. We are also not counting around $975k in Wonderland (Avax) and $385k on Homora V2. We are also not counting $624k in Alpaca Finance (Fantom). We may also not count a few small token balances and other small amounts in defi Protocols. This data was collected on 19/04/23' \ No newline at end of file diff --git a/projects/hotfries/index.js b/projects/hotfries/index.js index 3d7a35cc067..d81e6f3e81e 100644 --- a/projects/hotfries/index.js +++ b/projects/hotfries/index.js @@ -1,7 +1,8 @@ +const ADDRESSES = require('../helper/coreAssets.json') const {staking} = require('../helper/staking') module.exports={ bsc:{ - tvl: staking("0x849741B79bc1618b46CF9ec600E94E771DEde601", "0xe9e7cea3dedca5984780bafc599bd69add087d56", "bsc") + tvl: staking("0x849741B79bc1618b46CF9ec600E94E771DEde601", ADDRESSES.bsc.BUSD, "bsc") } } \ No newline at end of file diff --git a/projects/houdiniswap/index.js b/projects/houdiniswap/index.js new file mode 100644 index 00000000000..837ba71d33f --- /dev/null +++ b/projects/houdiniswap/index.js @@ -0,0 +1,15 @@ +const { stakings } = require("../helper/staking") + +module.exports={ + ethereum:{ + tvl:()=>({}), + staking: stakings([ + "0x488B813ED84aB52857cA90ade050f8ca126bEda6", + "0xf9FA02cC165dBd70fF34d27b5AC9E0AE6D74D756", + "0xE42aDCB4B9F2e3E6acb70399c420Cb6D6795B09d", + "0xE3507B38342CCB9Aa03E5AF2deA6C1F54351F553", + "0xf7E1edF3E4EC64360aFB739EBD2c0F40A5CC57D3", + "0x979a7307Dd7Ba386b52F08a9A35a26807affbCC9" + ], "0x888cea2bbdd5d47a4032cf63668d7525c74af57a") + } +} \ No newline at end of file diff --git a/projects/hpdex/index.js b/projects/hpdex/index.js index 0d693c961da..2a4b8f45495 100644 --- a/projects/hpdex/index.js +++ b/projects/hpdex/index.js @@ -6,7 +6,6 @@ module.exports = { hpb: { tvl: getUniTVL({ factory: "0xE1d563BcFD4E2a5A9ce355CC8631421186521aAA", - chain: "hpb", useDefaultCoreAssets: true, }) } diff --git a/projects/hubble-exchange/index.js b/projects/hubble-exchange/index.js index 0c9353c4c26..659c0ec06b2 100644 --- a/projects/hubble-exchange/index.js +++ b/projects/hubble-exchange/index.js @@ -1,9 +1,10 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens2 } = require('../helper/unwrapLPs') const chain = 'avax' const toa = [ - ['0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e', '0x5c6fc0aaf35a55e7a43fff45575380bcedb5cbc2'], // USDC used for HUSD minting - ['0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7', '0x7648675ca85dfb9e2f9c764ebc5e9661ef46055d'], // AVAX used as collateral - ['0x49D5c2BdFfac6CE2BFdB6640F4F80f226bc10bAB', '0x7648675ca85dfb9e2f9c764ebc5e9661ef46055d'], // WETH used as collateral + [ADDRESSES.avax.USDC, '0x5c6fc0aaf35a55e7a43fff45575380bcedb5cbc2'], // USDC used for HUSD minting + [ADDRESSES.avax.WAVAX, '0x7648675ca85dfb9e2f9c764ebc5e9661ef46055d'], // AVAX used as collateral + [ADDRESSES.avax.WETH_e, '0x7648675ca85dfb9e2f9c764ebc5e9661ef46055d'], // WETH used as collateral ] module.exports = { diff --git a/projects/hubble/index.js b/projects/hubble/index.js index ae4bebcb163..4ea4c00f838 100644 --- a/projects/hubble/index.js +++ b/projects/hubble/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens2 } = require("../helper/solana"); const ignoreBadTokens = true; @@ -9,7 +10,7 @@ async function tvl() { SRM: 'SRMuApVNdxXokk5GT7XD5cUUgXMBCoAz2LHeuAoKWRt', RAY: '4k3Dyjzvzp8eMZWUXbBCjEvwSkkk59S5iCNLY3QrkX6R', FTT: 'AGFEad2et2ZJif9jaGpdMixQqvW5i81aBdvKe7PHNfz3', - WSOL: 'So11111111111111111111111111111111111111112', + WSOL: ADDRESSES.solana.SOL, MSOL: 'mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So', stSOL: '7dHbWXmci3dT8UFYWYZweBLXgycu7Y3iL6trKn1Y7ARj', LDO: 'HZRCwxP2Vq9PCpPXooayhJ2bxTpo5xfpQrwB1svh332p', @@ -18,7 +19,7 @@ async function tvl() { const collateralTokensAndOwners = Object.values(collateralTokens).map((mint) => [mint, collateralVaultAuthority]) const psmTokens = { - USDC: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v' + USDC: ADDRESSES.solana.USDC } const psmVaultAuthority = '8WrqMitrgjzfqaPJ5PK6X3VT6B1Z8rDgQQny2aWwvJ8q' const psmTokensAndOwners = Object.values(psmTokens).map((mint) => [mint, psmVaultAuthority]) diff --git a/projects/huckleberry/index.js b/projects/huckleberry/index.js index 7fa6b864fe8..60367430d57 100644 --- a/projects/huckleberry/index.js +++ b/projects/huckleberry/index.js @@ -3,7 +3,6 @@ const { getUniTVL } = require('../helper/unknownTokens') const dexTVL = getUniTVL({ factory: '0x017603C8f29F7f6394737628a93c57ffBA1b7256', - chain: 'moonriver', useDefaultCoreAssets: true, }) @@ -15,6 +14,6 @@ module.exports = { tvl: dexTVL, }, clv: { - tvl: getUniTVL({ factory: '0x4531e148b55d89212E219F612A459fC65f657d7d', chain: 'clv', useDefaultCoreAssets: true }), + tvl: getUniTVL({ factory: '0x4531e148b55d89212E219F612A459fC65f657d7d', useDefaultCoreAssets: true }), }, } \ No newline at end of file diff --git a/projects/hummus/constants.js b/projects/hummus/constants.js index 0e2d384483f..6b780dd5b46 100644 --- a/projects/hummus/constants.js +++ b/projects/hummus/constants.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') /** * lp token addresses */ @@ -14,12 +15,12 @@ const USD2_MAI_LP = "0x3Eaa426861a283F0E46b6411aeB3C3608B090E0e"; /** * token addresses */ -const mUSDC = "0xEA32A96608495e54156Ae48931A7c20f0dcc1a21"; -const mUSDT = "0xbB06DCA3AE6887fAbF931640f67cab3e3a16F4dC"; +const mUSDC = ADDRESSES.metis.m_USDC; +const mUSDT = ADDRESSES.metis.m_USDT; const mDAI = "0x4c078361FC9BbB78DF910800A991C7c3DD2F6ce0"; const mBUSD = "0xb809cda0c2f79f43248C32b5DcB09d5cD26BbF10" -const DAI = "0x4651B38e7ec14BB3db731369BFE5B08F2466Bd0A"; // deprecated -const MAI = "0xdFA46478F9e5EA86d57387849598dbFB2e964b02" +const DAI = ADDRESSES.metis.DAI; // deprecated +const MAI = ADDRESSES.moonbeam.MAI module.exports = { mBUSD: { diff --git a/projects/hundredfinance/index.js b/projects/hundredfinance/index.js index 82aec864961..54510aaca7d 100644 --- a/projects/hundredfinance/index.js +++ b/projects/hundredfinance/index.js @@ -1,17 +1,18 @@ +const ADDRESSES = require('../helper/coreAssets.json') const {compoundExports, compoundExportsWithAsyncTransform} = require('../helper/compound') const sdk = require("@defillama/sdk"); const BigNumber = require("bignumber.js"); const comptroller = "0x0f390559f258eb8591c8e31cf0905e97cf36ace2" -const usdcEth = "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" -const usdcFantom = "0x04068DA6C83AFCFA0e13ba15A6696662335D5B75" -const usdcArbitrum = "0xff970a61a04b1ca14834a43f5de4533ebddb5cc8" +const usdcEth = ADDRESSES.ethereum.USDC +const usdcFantom = ADDRESSES.fantom.USDC +const usdcArbitrum = ADDRESSES.arbitrum.USDC -const daiEth = "0x6b175474e89094c44da98b954eedeac495271d0f" -const daiFantom = "0x8d11ec38a3eb5e956b052f67da8bdc9bef8abf3e" +const daiEth = ADDRESSES.ethereum.DAI +const daiFantom = ADDRESSES.fantom.DAI -const usdtEth = "0xdac17f958d2ee523a2206206994597c13d831ec7" -const usdtArbitrum = "0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9" +const usdtEth = ADDRESSES.ethereum.USDT +const usdtArbitrum = ADDRESSES.arbitrum.USDT const usdcFantomBAMM = "0xEDC7905a491fF335685e2F2F1552541705138A3D" const daiFantomBAMM = "0x6d62d6Af9b82CDfA3A7d16601DDbCF8970634d22" @@ -60,14 +61,16 @@ function tvlWithBamm() { module.exports={ hallmarks: [ - [1647302400, "Reentrancy attack"] + [1647302400, "Reentrancy attack"], + [1681541920, "Protocol hacked (oc Optimism)"], + ], - ethereum:compoundExports(comptroller, "ethereum", "0xfCD8570AD81e6c77b8D252bEbEBA62ed980BD64D", "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"), - arbitrum:tvlWithBamm(comptroller, "arbitrum", "0x8e15a22853A0A60a0FBB0d875055A8E66cff0235", "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1"), - fantom:tvlWithBamm(comptroller, "fantom", "0xfCD8570AD81e6c77b8D252bEbEBA62ed980BD64D", "0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83"), - harmony:compoundExportsWithAsyncTransform(comptroller, "harmony", "0xbb93C7F378B9b531216f9aD7b5748be189A55807", "0xcf664087a5bb0237a0bad6742852ec6c8d69a27a"), + ethereum:compoundExports(comptroller, "ethereum", "0xfCD8570AD81e6c77b8D252bEbEBA62ed980BD64D", ADDRESSES.ethereum.WETH), + arbitrum:tvlWithBamm(comptroller, "arbitrum", "0x8e15a22853A0A60a0FBB0d875055A8E66cff0235", ADDRESSES.arbitrum.WETH), + fantom:tvlWithBamm(comptroller, "fantom", "0xfCD8570AD81e6c77b8D252bEbEBA62ed980BD64D", ADDRESSES.fantom.WFTM), + harmony:compoundExportsWithAsyncTransform(comptroller, "harmony", "0xbb93C7F378B9b531216f9aD7b5748be189A55807", ADDRESSES.harmony.WONE), moonriver:compoundExportsWithAsyncTransform("0x7d166777bd19a916c2edf5f1fc1ec138b37e7391", "moonriver", "0xd6fcBCcfC375c2C61d7eE2952B329DcEbA2D4e10", "0x98878b06940ae243284ca214f92bb71a2b032b8a"), - xdai:compoundExportsWithAsyncTransform("0x6bb6ebCf3aC808E26545d59EA60F27A202cE8586", "xdai", "0x6eDCB931168C9F7C20144f201537c0243b19dCA4", "0xe91d153e0b41518a2ce8dd3d7944fa863463a97d"), - polygon:compoundExportsWithAsyncTransform("0xedba32185baf7fef9a26ca567bc4a6cbe426e499", "polygon", "0xEbd7f3349AbA8bB15b897e03D6c1a4Ba95B55e31", "0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270"), - optimism:compoundExportsWithAsyncTransform(comptroller, "optimism", "0xE8F12f5492Ec28609D2932519456b7436d6c93bD", "0x4200000000000000000000000000000000000006"), + xdai:compoundExportsWithAsyncTransform("0x6bb6ebCf3aC808E26545d59EA60F27A202cE8586", "xdai", "0x6eDCB931168C9F7C20144f201537c0243b19dCA4", ADDRESSES.xdai.WXDAI), + polygon:compoundExportsWithAsyncTransform("0xedba32185baf7fef9a26ca567bc4a6cbe426e499", "polygon", "0xEbd7f3349AbA8bB15b897e03D6c1a4Ba95B55e31", ADDRESSES.polygon.WMATIC_2), + optimism:compoundExportsWithAsyncTransform("0x5a5755E1916F547D04eF43176d4cbe0de4503d5d", "optimism", "0x1A61A72F5Cf5e857f15ee502210b81f8B3a66263", ADDRESSES.tombchain.FTM), } diff --git a/projects/hunnyfinance/abi.json b/projects/hunnyfinance/abi.json index f0a1eb49c8d..048f7d2e793 100644 --- a/projects/hunnyfinance/abi.json +++ b/projects/hunnyfinance/abi.json @@ -1,28 +1,4 @@ { - "stakingToken": { - "inputs": [], - "name": "stakingToken", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "balance": { - "inputs": [], - "name": "balance", - "outputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } + "stakingToken": "address:stakingToken", + "balance": "uint256:balance" } \ No newline at end of file diff --git a/projects/hunnyfinance/index.js b/projects/hunnyfinance/index.js index 51ceb1db88e..0e040bb768b 100644 --- a/projects/hunnyfinance/index.js +++ b/projects/hunnyfinance/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); const { unwrapUniswapLPs, sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); @@ -53,10 +54,10 @@ const dao = "0x650eC6f59b64AcAC97A33C1F2F34c646659FF8b4" const loveStaking = "0x31dd9Be51cC7A96359cAaE6Cb4f5583C89D81985" const treasury = "0x631Fb1f772b8A20e775D1d4F3F87BfCaBA317527"; const treasuryTokens = [ - ["0xe9e7cea3dedca5984780bafc599bd69add087d56", false], // BUSD + [ADDRESSES.bsc.BUSD, false], // BUSD ["0x9e8Ae3a26536582823Ef82c155B69637a4A753F8", true], // LOVE-BUSD Cake-LP - ["0x55d398326f99059fF775485246999027B3197955", false], // USDT - ["0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c", false], // WBNB + [ADDRESSES.bsc.USDT, false], // USDT + [ADDRESSES.bsc.WBNB, false], // WBNB ["0x0e09fabb73bd3ade0a17ecc321fd13a19e81ce82", false], // CAKE ["0x565b72163f17849832a692a3c5928cc502f46d69", false], // HUNNY ] diff --git a/projects/huobi/index.js b/projects/huobi/index.js index 930ee55c8de..b9c5b0d2beb 100644 --- a/projects/huobi/index.js +++ b/projects/huobi/index.js @@ -8,6 +8,7 @@ const config = { '1KVpuCfhftkzJ67ZUegaMuaYey7qni7pPj', //These 3 addresses has 48,555 #Bitcoin. This is only less than 3% of the total high value assets we have, including btc, usd, stablecoins, T-bills.. According to Justin Sun https://twitter.com/justinsuntron/status/1590311559242612743 '14XKsv8tT6tt8P8mfDQZgNF8wtN5erNu5D', + '1LXzGrDQqKqVBqxfGDUyhC6rTRBN5s8Sbj' ], }, ethereum: { @@ -54,7 +55,10 @@ const config = { }, eos: { owners: ['vuniyuoxoeub'], - } + }, + ripple: { + owners: ['rKUDvXFJMFu65LqPTH3Yfpii4rbKT9bSQT'], + }, } module.exports = cexExports(config) diff --git a/projects/hxro-network/index.js b/projects/hxro-network/index.js new file mode 100644 index 00000000000..3ae36f637de --- /dev/null +++ b/projects/hxro-network/index.js @@ -0,0 +1,24 @@ +const { sumTokens2 } = require('../helper/solana') +const sdk = require('@defillama/sdk') + +async function staking() { + const esHRXOKey = 'solana:CPwspzHc4bKtBQGNRhpRG9v3qRiPLWP28GrfZepwmBSz' + const balances = await sumTokens2({ + tokenAccounts: [ + '6kU9EA8ApkD3eCYjoR3e8MkJzvjcVb8nTFUQhGKMjA7r', + 'DB8v2eyqQXueoSLYNFoxoBv1DFr7XuhMLtwPUEcrM5KP', + ] + }) + + if (balances[esHRXOKey]) { + sdk.util.sumSingleBalance(balances, 'HxhWkVpk5NS4Ltg5nij2G671CKXFRKPK8vy271Ub4uEK', balances[esHRXOKey], 'solana') + delete balances[esHRXOKey] + } + return balances +} + +module.exports = { + solana: { + tvl: () => 0, staking, + } +} diff --git a/projects/hydradex-v3/api.js b/projects/hydradex-v3/api.js new file mode 100644 index 00000000000..4645e338140 --- /dev/null +++ b/projects/hydradex-v3/api.js @@ -0,0 +1,7 @@ +const { getExports } = require('../helper/heroku-api') + +module.exports = { + timetravel: false, + misrepresentedTokens: true, + ...getExports("hydradex-v3", ['hydra']), +} diff --git a/projects/hydradex-v3/index.js b/projects/hydradex-v3/index.js new file mode 100644 index 00000000000..f55e95c5814 --- /dev/null +++ b/projects/hydradex-v3/index.js @@ -0,0 +1,27 @@ +const { blockQuery } = require('../helper/http') +const { getBlock } = require('../hydradex/getHydraV3SubgraphTvl') + +async function tvl(timestamp) { + const endpoint = 'https://graph.hydradex.org/subgraphs/name/v3-subgraph' + const block = +(await getBlock('https://graph.hydradex.org/subgraphs/name/blocklytics/ethereum-blocks', timestamp)) + const query = `query ($block: Int){ + factories (block: { number: $block }) { + totalValueLockedUSD + } + }` + const { factories: [{ totalValueLockedUSD }] } = await blockQuery(endpoint, query, { + api: { + getBlock: () => block, + block + } + }) + return { tether: +totalValueLockedUSD } +} + +module.exports = { + misrepresentedTokens: true, + methodology: "We count liquidity on the dex, pulling data from subgraph", + hydra: { + tvl, + }, +}; diff --git a/projects/hydradex/api.js b/projects/hydradex/api.js index 9b31da47f1c..9a1b91f36f6 100644 --- a/projects/hydradex/api.js +++ b/projects/hydradex/api.js @@ -1,3 +1,5 @@ + +const hydraExport = require('../hydradex.js') const { getExports } = require('../helper/heroku-api') module.exports = { diff --git a/projects/hydradex/getHydraV3SubgraphTvl.js b/projects/hydradex/getHydraV3SubgraphTvl.js new file mode 100644 index 00000000000..2f0373bde20 --- /dev/null +++ b/projects/hydradex/getHydraV3SubgraphTvl.js @@ -0,0 +1,22 @@ +const { graphQuery, } = require("../helper/http"); + +const HOURS_12 = 12 * 3600 + +async function getBlock(endpoint, timestamp) { + const params = { + timestamp_from: timestamp - HOURS_12 * 2, + timestamp_to: timestamp + HOURS_12 * 2, + } + const query = `query ($timestamp_to: Int, $timestamp_from: Int){ + blocks (orderBy: "timestamp" first:1 orderDirection: "desc" where: { timestamp_lte: $timestamp_to timestamp_gte: $timestamp_from}) { + timestamp + number + } + }` + const { blocks } = await graphQuery(endpoint, query, params) + return blocks[0].number +} + +module.exports = { + getBlock, +}; diff --git a/projects/hyperjump/index.js b/projects/hyperjump/index.js index 55e24e810d6..04222bb0f83 100644 --- a/projects/hyperjump/index.js +++ b/projects/hyperjump/index.js @@ -11,21 +11,18 @@ module.exports = { bsc: { tvl: getUniTVL({ factory: FACTORY.bsc, - chain: 'bsc', useDefaultCoreAssets: true, }), }, fantom: { tvl: getUniTVL({ factory: FACTORY.fantom, - chain: 'fantom', useDefaultCoreAssets: true, }), }, metis: { tvl: getUniTVL({ factory: FACTORY.metis, - chain: 'metis', useDefaultCoreAssets: true, }), }, diff --git a/projects/hyperliquid/index.js b/projects/hyperliquid/index.js new file mode 100644 index 00000000000..69d940c35d4 --- /dev/null +++ b/projects/hyperliquid/index.js @@ -0,0 +1,8 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require("../helper/unwrapLPs"); + +module.exports = { + arbitrum: { + tvl: sumTokensExport({ owner: '0xc67e9efdb8a66a4b91b1f3731c75f500130373a4', tokens: [ADDRESSES.arbitrum.USDC] }) + } +} \ No newline at end of file diff --git a/projects/iTrustfinance/abi.json b/projects/iTrustfinance/abi.json index a7dab2cb7ec..7e8058d689a 100644 --- a/projects/iTrustfinance/abi.json +++ b/projects/iTrustfinance/abi.json @@ -1,15 +1,3 @@ { - "totalSupply": { - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } + "totalSupply": "uint256:totalSupply" } \ No newline at end of file diff --git a/projects/iTrustfinance/index.js b/projects/iTrustfinance/index.js index c709ae2d43d..3b82c128a94 100644 --- a/projects/iTrustfinance/index.js +++ b/projects/iTrustfinance/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); @@ -22,7 +23,7 @@ const erc20Tokens = [ //IDLE "0x875773784Af8135eA0ef43b5a374AaD105c5D39e", //WETH - "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", + ADDRESSES.ethereum.WETH, //VISR "0xf938424f7210f31df2aee3011291b658f872e91e", //BOND diff --git a/projects/ibcx/index.js b/projects/ibcx/index.js new file mode 100644 index 00000000000..f56f733457d --- /dev/null +++ b/projects/ibcx/index.js @@ -0,0 +1,42 @@ +const axios = require('axios') + +const contractAddresses = [ + "osmo1yhd9tzp09d833u7ray4pc6wwp72aewtt2xwakszn3lzlf2klnlwscjwhxt", // uibcx + "osmo1fw7wc4x7leyf3keud4zdhdnyaanw0sajudg5sgnr93ydjhzmxk6sx84rxe", + "osmo1xqw2sl9zk8a6pch0csaw78n4swg5ws8t62wc5qta4gnjxfqg6v2qcs243k", // stIBCX + "osmo1fd33mtk06awg0v2hhd6djcjvvzcv90s8u03qujcjnlu87wm65xjs305mr4", + "osmo1w2dqd98hzu4ydku5hhv3f0gc468jdlayrqeqedrjxwrq62m7yekqrgvlyu", + "osmo14klwqgkmackvx2tqa0trtg69dmy0nrg4ntq4gjgw2za4734r5seqjqm4gm", +] + +async function tvl() { + const { api } = arguments[3] + for (const contractAddress of contractAddresses) { + const contractBalances = (await axios.get(`https://lcd.osmosis.zone/cosmos/bank/v1beta1/balances/${contractAddress}`)).data.balances + for (const coin of contractBalances) { + // stUMEE not be listed on coingecko so we convert stUMEE to the corresponding amount of UMEE base on pool stUMEE/UMEE + if (coin.denom == "ibc/02F196DA6FD0917DD5FEA249EE61880F4D941EE9059E7964C5C9B50AF103800F") { + const spotPrice = (await axios.get(`https://lcd.osmosis.zone/osmosis/gamm/v2/pools/1035/prices?base_asset_denom=ibc/67795E528DF67C5606FC20F824EA39A6EF55BA133F4DC79C90A8C47A0901E17C"e_asset_denom=${coin.denom}`)).data.spot_price + coin.denom = "ibc/67795E528DF67C5606FC20F824EA39A6EF55BA133F4DC79C90A8C47A0901E17C" // UMEE + coin.amount = coin.amount * spotPrice + } + // stEVMOS not be listed on coingecko so we convert stEVMOS to the corresponding amount of EVMOS base on pool stEVMOS/EVMOS + if (coin.denom == "ibc/C5579A9595790017C600DD726276D978B9BF314CF82406CE342720A9C7911A01") { + const spotPrice = (await axios.get(`https://lcd.osmosis.zone/osmosis/gamm/v2/pools/922/prices?base_asset_denom=ibc/6AE98883D4D5D5FF9E50D7130F1305DA2FFA0C652D1DD9C123657C6B4EB2DF8A"e_asset_denom=${coin.denom}`)).data.spot_price + coin.denom = "ibc/6AE98883D4D5D5FF9E50D7130F1305DA2FFA0C652D1DD9C123657C6B4EB2DF8A" // EVMOS + coin.amount = coin.amount * spotPrice + } + api.add(coin.denom, coin.amount) + } + + } +} + +module.exports = { + timetravel: false, + misrepresentedTokens: true, + methodology: "Total TVL on vaults", + osmosis: { + tvl, + }, +} \ No newline at end of file diff --git a/projects/ice-dao/index.js b/projects/ice-dao/index.js index 58a8facb74c..09c22e9df51 100644 --- a/projects/ice-dao/index.js +++ b/projects/ice-dao/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { ohmTvl } = require("../helper/ohm"); const treasuryAddress = "0x935AEf514141B0CA32849e9686d22CB8b6f1dCAF"; @@ -5,7 +6,7 @@ module.exports = ohmTvl(treasuryAddress, [ //MIM ["0x130966628846bfd36ff31a822705796e8cb8c18d", false], //WAVAX - ["0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7", false], + [ADDRESSES.avax.WAVAX, false], // ICY MIM JLP ["0x453B5415Fe883f15686A5fF2aC6FF35ca6702628", true], // MEMO diff --git a/projects/icecreamswap/index.js b/projects/icecreamswap/index.js index 732fe5c2290..17f13c17f26 100644 --- a/projects/icecreamswap/index.js +++ b/projects/icecreamswap/index.js @@ -1,10 +1,41 @@ const { getUniTVL, } = require('../helper/unknownTokens') -const chain = 'bitgert' -const factory = '0x9E6d21E759A7A288b80eef94E4737D313D31c13f' module.exports = { misrepresentedTokens: true, bitgert: { - tvl: getUniTVL({ chain, factory, useDefaultCoreAssets: true, version: '2', }), + tvl: getUniTVL({ + factory: '0x9E6d21E759A7A288b80eef94E4737D313D31c13f', + useDefaultCoreAssets: true, + }), + }, + xdc: { + tvl: getUniTVL({ + factory: '0x9E6d21E759A7A288b80eef94E4737D313D31c13f', + useDefaultCoreAssets: true, + }) + }, + fuse: { + tvl: getUniTVL({ + factory: '0x9E6d21E759A7A288b80eef94E4737D313D31c13f', + useDefaultCoreAssets: true, + }) + }, + dogechain: { + tvl: getUniTVL({ + factory: '0x9E6d21E759A7A288b80eef94E4737D313D31c13f', + useDefaultCoreAssets: true, + }) + }, + core: { + tvl: getUniTVL({ + factory: '0x9E6d21E759A7A288b80eef94E4737D313D31c13f', + useDefaultCoreAssets: true, + }) + }, + telos: { + tvl: getUniTVL({ + factory: '0x9E6d21E759A7A288b80eef94E4737D313D31c13f', + useDefaultCoreAssets: true, + }) }, }; diff --git a/projects/ichifarm/abi.json b/projects/ichifarm/abi.json index a1d345a48b7..30284047ebf 100644 --- a/projects/ichifarm/abi.json +++ b/projects/ichifarm/abi.json @@ -1,280 +1,19 @@ { - "oneTokenCount": { - "inputs": [], - "name": "oneTokenCount", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "oneTokenAtIndex": { - "inputs": [ - { - "internalType": "uint256", - "name": "index", - "type": "uint256" - } - ], - "name": "oneTokenAtIndex", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "assetCount": { - "inputs": [], - "name": "assetCount", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "assetAtIndex": { - "inputs": [ - { - "internalType": "uint256", - "name": "index", - "type": "uint256" - } - ], - "name": "assetAtIndex", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "token0": { - "inputs": [], - "name": "token0", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "token1": { - "inputs": [], - "name": "token1", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getTotalAmounts": { - "inputs": [], - "name": "getTotalAmounts", - "outputs": [ - { - "internalType": "uint256", - "name": "total0", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "total1", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "allVaults": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "allVaults", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "collateralTokenAtIndex": { - "inputs": [ - { - "internalType": "uint256", - "name": "index", - "type": "uint256" - } - ], - "name": "collateralTokenAtIndex", - "outputs": [ - { - "internalType": "address", - "name": "module", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "collateralTokenCount": { - "inputs": [], - "name": "collateralTokenCount", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "pool": { - "inputs": [], - "name": "pool", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "foreignTokenAtIndex": { - "inputs": [ - { - "internalType": "uint256", - "name": "index", - "type": "uint256" - } - ], - "name": "foreignTokenAtIndex", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "foreignTokenCount": { - "inputs": [], - "name": "foreignTokenCount", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "moduleCount": { - "inputs": [], - "name": "moduleCount", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "moduleAtIndex": { - "inputs": [ - { - "internalType": "uint256", - "name": "index", - "type": "uint256" - } - ], - "name": "moduleAtIndex", - "outputs": [ - { - "internalType": "address", - "name": "module", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "modules": { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "modules", - "outputs": [ - { - "internalType": "string", - "name": "name", - "type": "string" - }, - { - "internalType": "string", - "name": "url", - "type": "string" - }, - { - "internalType": "enum InterfaceCommon.ModuleType", - "name": "moduleType", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - "owner": { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } + "oneTokenCount": "uint256:oneTokenCount", + "oneTokenAtIndex": "function oneTokenAtIndex(uint256 index) view returns (address)", + "assetCount": "uint256:assetCount", + "assetAtIndex": "function assetAtIndex(uint256 index) view returns (address)", + "token0": "address:token0", + "token1": "address:token1", + "getTotalAmounts": "function getTotalAmounts() view returns (uint256 total0, uint256 total1)", + "allVaults": "function allVaults(uint256) view returns (address)", + "collateralTokenAtIndex": "function collateralTokenAtIndex(uint256 index) view returns (address module)", + "collateralTokenCount": "uint256:collateralTokenCount", + "pool": "address:pool", + "foreignTokenAtIndex": "function foreignTokenAtIndex(uint256 index) view returns (address)", + "foreignTokenCount": "uint256:foreignTokenCount", + "moduleCount": "uint256:moduleCount", + "moduleAtIndex": "function moduleAtIndex(uint256 index) view returns (address module)", + "modules": "function modules(address) view returns (string name, string url, uint8 moduleType)", + "owner": "address:owner" } \ No newline at end of file diff --git a/projects/ichifarm/index.js b/projects/ichifarm/index.js index f9b7eef4444..9d491c42b5f 100644 --- a/projects/ichifarm/index.js +++ b/projects/ichifarm/index.js @@ -1,233 +1,117 @@ -const sdk = require("@defillama/sdk"); +const { getLogs } = require('../helper/cache/getLogs') +const ADDRESSES = require('../helper/coreAssets.json') const { stakings } = require("../helper/staking"); -const { transformBalances } = require('../helper/portedTokens') const abi = require("./abi.json"); -const { createIncrementArray } = require('../helper/utils'); -const { sumTokens2, unwrapUniswapV3NFTs } = require('../helper/unwrapLPs'); -const { GraphQLClient, gql } = require('graphql-request'); - +const { sumTokens2, } = require('../helper/unwrapLPs'); const ichiLegacy = "0x903bEF1736CDdf2A537176cf3C64579C3867A881"; const ichi = "0x111111517e4929D3dcbdfa7CCe55d30d4B6BC4d6"; const xIchi = "0x70605a6457B0A8fBf1EEE896911895296eAB467E"; -const tokenFactory = "0xD0092632B9Ac5A7856664eeC1abb6E3403a6A36a"; const farmContract = "0x275dFE03bc036257Cd0a713EE819Dbd4529739c8"; const ichiLending = "0xaFf95ac1b0A78Bd8E4f1a2933E373c66CC89C0Ce"; -const unilps = [ - // SLP - "0x9cD028B1287803250B1e226F0180EB725428d069", - // UNI-V2 lP - "0xd07D430Db20d2D7E0c4C11759256adBCC355B20C" -] const poolWithTokens = [ // BANCOR ["0x4a2F0Ca5E03B2cF81AebD936328CF2085037b63B", ["0x903bEF1736CDdf2A537176cf3C64579C3867A881", "0x1F573D6Fb3F13d689FF844B4cE37794d79a7FF1C"]], // ONE INCH ["0x1dcE26F543E591c27717e25294AEbbF59AD9f3a5", ["0x903bEF1736CDdf2A537176cf3C64579C3867A881", "0x111111111117dC0aa78b770fA6A738034120C302"]], // BALANCER - ["0x58378f5F8Ca85144ebD8e1E5e2ad95B02D29d2BB", ["0x903bEF1736CDdf2A537176cf3C64579C3867A881", "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"]] + ["0x58378f5F8Ca85144ebD8e1E5e2ad95B02D29d2BB", ["0x903bEF1736CDdf2A537176cf3C64579C3867A881", ADDRESSES.ethereum.WETH]] ] -const graphUrl = { - 'ethereum': 'https://api.thegraph.com/subgraphs/name/ichi-org/v1', - 'polygon': 'https://api.thegraph.com/subgraphs/name/ichi-org/polygon-v1' -} - -const graphQuery = gql` -query { - ichiVaults { - id - tokenA - tokenB - } -} -`; - -async function getVaultsByGraph(chain = 'ethereum') { - const graphQLClient = new GraphQLClient(graphUrl[chain]); - - const data = await graphQLClient.request(graphQuery); - - const vaults = []; - data.ichiVaults.forEach( v => vaults.push({address: v.id, tokenA: v.tokenA, tokenB: v.tokenB})); - - return vaults; -} - -async function vaultBalances(block, chain = 'ethereum', oneTokenList){ - const vaults = await getVaultsByGraph(chain) - - const poolsCalls = vaults.map(i => ({ target: i.address })) - - const { output: vaultBalances } = await sdk.api.abi.multiCall({ - abi: abi.getTotalAmounts, - calls: poolsCalls, - chain, block, - }) - - const balances = {} - vaultBalances.forEach((data, i) => { - addBalance(vaults[i].tokenA, data.output.total0) - addBalance(vaults[i].tokenB, data.output.total1) - }) - - return balances; - - function addBalance(token, balance) { - if (oneTokenList.includes(token.toLowerCase())) - return; - sdk.util.sumSingleBalance(balances, token, balance) - } -} - -const oneFactory = { - 'ethereum': '0xD0092632B9Ac5A7856664eeC1abb6E3403a6A36a', - 'polygon': '0x101eB16BdbA37979a771c86e1CAAfbaDbABfc879' -} - -async function oneTokenBalances(block, chain='ethereum') { - - // get list of all oneTokens in system - const { output: oneTokenCount } = await sdk.api.abi.call({ - target: oneFactory[chain], - abi: abi.oneTokenCount, - chain, block, - }) - - const oneTokenParams = createIncrementArray(oneTokenCount).map(i => ({ params: i })) - const { output: oneTokens } = await sdk.api.abi.multiCall({ - target: oneFactory[chain], - abi: abi.oneTokenAtIndex, - calls: oneTokenParams, - chain, block, - }) - - const oneTokenList = oneTokens.map(i => ( i.output.toLowerCase() )) - - // get list of all tokens in the system - const { output: foreignTokenCount } = await sdk.api.abi.call({ - target: oneFactory[chain], - abi: abi.foreignTokenCount, - chain, block, - }) - - const foreignTokenParams = createIncrementArray(foreignTokenCount).map(i => ({ params: i})) - const { output: foreignTokens } = await sdk.api.abi.multiCall({ - target: oneFactory[chain], - abi: abi.foreignTokenAtIndex, - calls: foreignTokenParams, - chain, block, - }) - - const foreignTokenList = foreignTokens.map(i => (i.output)) - - // ICHI is not admited as foreign token to polygon oneToken Factory but it is used to back oneToken treasury - if (chain == 'polygon') { - foreignTokenList.push(ichi) - } - - // get list of all strategies in the system - const { output: moduleCount } = await sdk.api.abi.call({ - target: oneFactory[chain], - abi: abi.moduleCount, - chain, block, - }) - - const strategyParams = createIncrementArray(moduleCount).map(i => ({ params: i})) - const { output: moduleAtIndex } = await sdk.api.abi.multiCall({ - target: oneFactory[chain], - abi: abi.moduleAtIndex, - calls: strategyParams, - chain, block, - }) - - const modulesList = moduleAtIndex.map(i => ( {params: i.output })) - - const { output: moduleDetails } = await sdk.api.abi.multiCall({ - target: oneFactory[chain], - abi: abi.modules, - calls: modulesList, - chain, block, - }) - - const strategiesList = [] - moduleDetails.forEach((data, i) => { - if (data.output.moduleType == 2) { //modeuleType 2 are strategies - strategiesList.push(modulesList[i].params) - } - }) - - // get list of all owners of oneTokens - const ownerCalls = oneTokens.map(i => ( { target: i.output })) - const { output: oneTokenOwners } = await sdk.api.abi.multiCall({ - abi: abi.owner, - calls: ownerCalls, - chain, block, - }) - - const oneTokenOwnersList = oneTokenOwners.map(i => (i.output)) - - // create large list of tokens and owners list; - // owners are all onetokens, strategies, and owners of onetokens - // tokens are all tokens in the system but will exclude onetokens in the strategies - - const toa = [] - - oneTokenList.forEach( oneToken => foreignTokenList.forEach( foreignToken => toa.push([foreignToken, oneToken]))) - strategiesList.forEach( strategy => foreignTokenList.forEach( foreignToken => toa.push([foreignToken, strategy]))) - oneTokenOwnersList.forEach( owner => foreignTokenList.forEach( foreignToken => toa.push([foreignToken, owner]))) - - const balances = await sumTokens2({ tokensAndOwners: toa, block, chain, blacklistedTokens: oneTokenList }) - - const uniV3NFTHolders = [...strategiesList, ...oneTokenOwnersList] - - await unwrapUniswapV3NFTs({ balances, owners: uniV3NFTHolders, chain, block }) - - return { balances, oneTokenList }; -} - -async function tvl(timestamp, block) { - - const { balances, oneTokenList } = await oneTokenBalances(block) - - const vBalances = await vaultBalances(block, undefined, oneTokenList) - - for(var token in vBalances) - sdk.util.sumSingleBalance(balances, token, vBalances[token]) - - return balances -} - -async function polygonTvl(_, _b, { polygon: block }){ - const chain = 'polygon' - - const { balances, oneTokenList } = await oneTokenBalances(block, chain) - - const vBalances = await vaultBalances(block, chain, oneTokenList) - const vBalancesTransformed = await transformBalances(chain,vBalances) - for(var token in vBalancesTransformed) - sdk.util.sumSingleBalance(balances, token, vBalancesTransformed[token]) - - return balances; -} - module.exports = { methodology: "Tokens deposited to mint oneTokens excluding oneTokens , Vault deposits", misrepresentedTokens: true, + doublecounted: true, +} // node test.js projects/ichifarm/index.js + +const defaultEvent = 'event ICHIVaultCreated (address indexed sender, address ichiVault, address tokenA, bool allowTokenA, address tokenB, bool allowTokenB, uint24 fee, uint256 count)' +const defaultTopic = '0xde147f43b6837f282eee187234c866cf001806167325f3ea883e36bed0c16a20' + +const config = { ethereum: { - tvl, - pool2: async (_, block) => { - const toa = [ - ['0x9cd028b1287803250b1e226f0180eb725428d069', farmContract], - ['0xd07d430db20d2d7e0c4c11759256adbcc355b20c', farmContract], - ] - poolWithTokens.forEach(([o, tokens]) => tokens.forEach(t => toa.push([t, o]))) - return sumTokens2({ tokensAndOwners: toa, block, resolveLP: true, }) - }, - staking: stakings([xIchi, ichiLending] , ichiLegacy) + vaultConfigs: [ + { factory: '0x5a40DFaF8C1115196A1CDF529F97122030F26112', fromBlock: 13671610, }, + ], + oneFactory: '0xD0092632B9Ac5A7856664eeC1abb6E3403a6A36a', + }, + arbitrum: { + vaultConfigs: [ + { factory: '0xfBf38920cCbCFF7268Ad714ae5F9Fad6dF607065', fromBlock: 102858581, }, + ], + }, + bsc: { + vaultConfigs: [ + { factory: '0xbBB97d634460DACCA0d41E249510Bb741ef46ad3', fromBlock: 29702590, }, + ], }, polygon: { - tvl: polygonTvl + vaultConfigs: [ + { factory: '0x2d2c72c4dc71aa32d64e5142e336741131a73fc0', fromBlock: 25697834, }, + { factory: '0xb2f44D8545315cDd0bAaB4AC7233218b932a5dA7', fromBlock: 44370370, }, // v2-retro + ], + oneFactory: '0x101eB16BdbA37979a771c86e1CAAfbaDbABfc879', + }, +} + +Object.keys(config).forEach(chain => { + const { vaultConfigs = [], oneFactory } = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const blacklistedTokens = [] + if (oneFactory) { + const oneTokens = await api.fetchList({ lengthAbi: abi.oneTokenCount, itemAbi: abi.oneTokenAtIndex, target: oneFactory }) + const oneTokenOwners = await api.multiCall({ abi: abi.owner, calls: oneTokens }) + const foreignTokens = await api.fetchList({ lengthAbi: abi.foreignTokenCount, itemAbi: abi.foreignTokenAtIndex, target: oneFactory }) + const modulesList = await api.fetchList({ lengthAbi: abi.moduleCount, itemAbi: abi.moduleAtIndex, target: oneFactory }) + const moduleDetails = await api.multiCall({ abi: abi.modules, calls: modulesList, target: oneFactory }) + + const strategiesList = [] + moduleDetails.forEach((data, i) => { + if (data.moduleType == 2) { //modeuleType 2 are strategies + strategiesList.push(modulesList[i]) + } + }) + if (api.chain === 'polygon') { + foreignTokens.push(ichi) + } + + blacklistedTokens.push(...oneTokens.map(i => i.toLowerCase())) + await sumTokens2({ api, tokens: foreignTokens, owners: [oneTokens, strategiesList].flat(), blacklistedTokens }) + const uniV3NFTHolders = [...strategiesList, ...oneTokenOwners] + + await sumTokens2({ api, owners: uniV3NFTHolders, resolveUniV3: true, blacklistedTokens, }) + } + + for (const { factory, fromBlock, topic = defaultTopic, eventAbi = defaultEvent } of vaultConfigs) { + const logs = await getLogs({ + api, + target: factory, + topics: [topic], + eventAbi: eventAbi, + onlyArgs: true, + fromBlock, + }) + const vaultBalances = await api.multiCall({ abi: abi.getTotalAmounts, calls: logs.map(l => l.ichiVault) }) + vaultBalances.forEach((b, i) => { + const { tokenA, tokenB } = logs[i] + if (!blacklistedTokens.includes(tokenA.toLowerCase())) api.add(tokenA, b.total0) + if (!blacklistedTokens.includes(tokenB.toLowerCase())) api.add(tokenB, b.total1) + }) + } + + return api.getBalances() + } } -} // node test.js projects/ichifarm/index.js \ No newline at end of file +}) + +module.exports.ethereum.pool2 = async (_, block) => { + const toa = [ + ['0x9cd028b1287803250b1e226f0180eb725428d069', farmContract], + ['0xd07d430db20d2d7e0c4c11759256adbcc355b20c', farmContract], + ] + poolWithTokens.forEach(([o, tokens]) => tokens.forEach(t => toa.push([t, o]))) + return sumTokens2({ tokensAndOwners: toa, block, }) +} + +module.exports.ethereum.staking = stakings([xIchi, ichiLending], ichiLegacy) diff --git a/projects/icpswap/index.js b/projects/icpswap/index.js new file mode 100644 index 00000000000..e0cfff7225b --- /dev/null +++ b/projects/icpswap/index.js @@ -0,0 +1,28 @@ + +const { get } = require('../helper/http') +const { toUSDTBalances } = require('../helper/balances') +const { PromisePool } = require('@supercharge/promise-pool') + +module.exports = { + misrepresentedTokens: true, + icp: { tvl }, +} + +async function tvl() { + let tvl = 0 + let pairs = await get('https://uvevg-iyaaa-aaaak-ac27q-cai.raw.ic0.app/pairs') + if (typeof pairs === 'string') pairs = JSON.parse(pairs.replace('},]', '}]')) + + const { errors } = await PromisePool.withConcurrency(15) + .for(pairs) + .process(async ({ pool_id }) => { + const res = await get(`https://uvevg-iyaaa-aaaak-ac27q-cai.raw.ic0.app/pool_tvl?poolId=${pool_id}&limit=1`) + if (res.length > 0) + tvl += +res[0].tvlUSD + }) + + if (errors && errors.length) + throw errors[0] + + return toUSDTBalances(tvl) +} diff --git a/projects/ideamarket/abi.json b/projects/ideamarket/abi.json deleted file mode 100644 index ffd41e9ffa7..00000000000 --- a/projects/ideamarket/abi.json +++ /dev/null @@ -1 +0,0 @@ -{"inputs":[],"name":"getTotalDaiReserves","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"} \ No newline at end of file diff --git a/projects/ideamarket/index.js b/projects/ideamarket/index.js index 83860fc655e..8ecc1adfe4e 100644 --- a/projects/ideamarket/index.js +++ b/projects/ideamarket/index.js @@ -1,13 +1,13 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk') -const getTotalDaiReserves = require('./abi.json') const stateContract = "0x4e908F706f8935f10C101Ea3D7B2DEfc78df284e" -const dai = "0x6b175474e89094c44da98b954eedeac495271d0f" +const dai = ADDRESSES.ethereum.DAI async function tvl(timestamp, ethBlock, chainBlocks) { const daiDeposited = await sdk.api.abi.call({ target: stateContract, - abi: getTotalDaiReserves, + abi: 'uint256:getTotalDaiReserves', block: chainBlocks.arbitrum, chain: "arbitrum" }) diff --git a/projects/idex/index.js b/projects/idex/index.js index f97323a8595..5934dddce88 100644 --- a/projects/idex/index.js +++ b/projects/idex/index.js @@ -1,10 +1,11 @@ +const ADDRESSES = require('../helper/coreAssets.json') /*================================================== Modules ==================================================*/ const { covalentGetTokens, get } = require("../helper/http") const { sumTokens2 } = require("../helper/unwrapLPs") -const { getUniqueAddresses } = require("../helper/utils") +const { getConfig } = require('../helper/cache') const IDEX_ETHEREUM_CUSTODY_CONTRACT = "0xE5c405C5578d84c5231D3a9a29Ef4374423fA0c2"; const IDEX_POLYGON_CUSTODY_CONTRACT = "0x3bcc4eca0a40358558ca8d1bcd2d1dbde63eb468"; @@ -14,12 +15,12 @@ const IDEX_POLYGON_CUSTODY_CONTRACT = "0x3bcc4eca0a40358558ca8d1bcd2d1dbde63eb46 ==================================================*/ async function tvl(_timestamp, block, chain) { - let tokens = ['0x0000000000000000000000000000000000000000'] + let tokens = [ADDRESSES.null] let owner switch (chain) { case 'polygon': - const assets = await get('https://api-matic.idex.io/v1/assets') + const assets = await getConfig('idex/polygon','https://api-matic.idex.io/v1/assets') assets.forEach(t => tokens.push(t.contractAddress)) owner = IDEX_POLYGON_CUSTODY_CONTRACT break; @@ -27,7 +28,6 @@ async function tvl(_timestamp, block, chain) { owner = IDEX_ETHEREUM_CUSTODY_CONTRACT const ethAssets = await covalentGetTokens(owner) ethAssets - .map(t => t.contract_address.toLowerCase()) .filter(t => t !== '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee' && t !== '0x7b0c06043468469967dba22d1af33d77d44056c8') .forEach(t => tokens.push(t)) break; @@ -35,9 +35,7 @@ async function tvl(_timestamp, block, chain) { throw new Error('Unknown chain ' + chain); } - tokens = getUniqueAddresses(tokens) const res = await sumTokens2({ chain, block, tokens, owner }) - console.log(chain, res) return res } diff --git a/projects/idle/abi.json b/projects/idle/abi.json deleted file mode 100644 index 82eb9ffea90..00000000000 --- a/projects/idle/abi.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "tokenPrice": { - "constant": true, - "inputs": [], - "name": "tokenPrice", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "token": { - "constant": true, - "inputs": [], - "name": "token", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "getContractValue": { - "inputs": [], - "name": "getContractValue", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -} \ No newline at end of file diff --git a/projects/idle/index.js b/projects/idle/index.js index ec69a608edd..4f336a5c540 100644 --- a/projects/idle/index.js +++ b/projects/idle/index.js @@ -1,116 +1,164 @@ -const abi = require('./abi.json') -const sdk = require('@defillama/sdk') -const { chainExports } = require('../helper/exports') -const { default: BigNumber } = require('bignumber.js') +const { sumTokens2 } = require('../helper/unwrapLPs') +const { eulerTokens } = require('../helper/tokenMapping') +const { getLogs } = require('../helper/cache/getLogs') +const BigNumber = require("bignumber.js"); const contracts = { - ethereum:[ - '0xC8E6CA6E96a326dC448307A5fDE90a0b21fd7f80', // idleWETHYield - '0x5C960a3DCC01BE8a0f49c02A8ceBCAcf5D07fABe', // idleRAIYield - '0xb2d5CB72A621493fe83C6885E4A776279be595bC', // idleFEIYield - '0x3fe7940616e5bc47b0775a0dccf6237893353bb4', // idleDAIYield - '0x78751b12da02728f467a44eac40f5cbc16bd7934', // idleDAIYieldV3 - '0x5274891bEC421B39D23760c04A6755eCB444797C', // idleUSDCYield - '0x12B98C621E8754Ae70d0fDbBC73D6208bC3e3cA6', // idleUSDCYieldV3 - '0xF34842d05A1c888Ca02769A633DF37177415C2f8', // idleUSDTYield - '0x63D27B3DA94A9E871222CB0A32232674B02D2f2D', // idleUSDTYieldV3 - '0xf52cdcd458bf455aed77751743180ec4a595fd3f', // idleSUSDYield - '0xe79e177d2a5c7085027d7c64c8f271c81430fc9b', // idleSUSDYieldV3 - '0xc278041fDD8249FE4c1Aad1193876857EEa3D68c', // idleTUSDYield - '0x51C77689A9c2e8cCBEcD4eC9770a1fA5fA83EeF1', // idleTUSDYieldV3 - '0x8C81121B15197fA0eEaEE1DC75533419DcfD3151', // idleWBTCYield - '0xD6f279B7ccBCD70F8be439d25B9Df93AEb60eC55', // idleWBTCYieldV3 - '0xa14ea0e11121e6e951e87c66afe460a00bcd6a16', // idleDAISafe - '0x1846bdfDB6A0f5c473dEc610144513bd071999fB', // idleDAISafeV3 - '0x3391bc034f2935ef0e1e41619445f998b2680d35', // idleUSDCSafe - '0xcDdB1Bceb7a1979C6caa0229820707429dd3Ec6C', // idleUSDCSafeV3 - '0x28fAc5334C9f7262b3A3Fe707e250E01053e07b5', // idleUSDTSafe - '0x42740698959761baf1b06baa51efbd88cb1d862b' // idleUSDTSafeV3 - ], - polygon:[ - "0x8a999F5A3546F8243205b2c0eCb0627cC10003ab", // idleDAIYield - "0x1ee6470CD75D5686d0b2b90C0305Fa46fb0C89A1", // idleUSDCYield - "0xfdA25D931258Df948ffecb66b5518299Df6527C4" // idleWETHYield - ] + ethereum: { + v1: [ + '0xC8E6CA6E96a326dC448307A5fDE90a0b21fd7f80', // idleWETHYield + '0x5C960a3DCC01BE8a0f49c02A8ceBCAcf5D07fABe', // idleRAIYield + '0xb2d5CB72A621493fe83C6885E4A776279be595bC', // idleFEIYield + '0x3fe7940616e5bc47b0775a0dccf6237893353bb4', // idleDAIYield + '0x5274891bEC421B39D23760c04A6755eCB444797C', // idleUSDCYield + '0xF34842d05A1c888Ca02769A633DF37177415C2f8', // idleUSDTYield + '0xf52cdcd458bf455aed77751743180ec4a595fd3f', // idleSUSDYield + '0xc278041fDD8249FE4c1Aad1193876857EEa3D68c', // idleTUSDYield + '0x8C81121B15197fA0eEaEE1DC75533419DcfD3151', // idleWBTCYield + '0xDc7777C771a6e4B3A82830781bDDe4DBC78f320e', // idleUSDCBB + '0xfa3AfC9a194BaBD56e743fA3b7aA2CcbED3eAaad' // idleUSDTBB + ], + v3: [ + '0x78751b12da02728f467a44eac40f5cbc16bd7934', // idleDAIYieldV3 + '0x12B98C621E8754Ae70d0fDbBC73D6208bC3e3cA6', // idleUSDCYieldV3 + '0x63D27B3DA94A9E871222CB0A32232674B02D2f2D', // idleUSDTYieldV3 + '0xe79e177d2a5c7085027d7c64c8f271c81430fc9b', // idleSUSDYieldV3 + '0x51C77689A9c2e8cCBEcD4eC9770a1fA5fA83EeF1', // idleTUSDYieldV3 + '0xD6f279B7ccBCD70F8be439d25B9Df93AEb60eC55', // idleWBTCYieldV3 + '0x1846bdfDB6A0f5c473dEc610144513bd071999fB', // idleDAISafeV3 + '0xcDdB1Bceb7a1979C6caa0229820707429dd3Ec6C', // idleUSDCSafeV3 + '0x42740698959761baf1b06baa51efbd88cb1d862b', // idleUSDTSafeV3 + ], + safe: [ + '0x28fAc5334C9f7262b3A3Fe707e250E01053e07b5', // idleUSDTSafe + '0x3391bc034f2935ef0e1e41619445f998b2680d35', // idleUSDCSafe + '0xa14ea0e11121e6e951e87c66afe460a00bcd6a16', // idleDAISafe + ], + cdos: [ + "0xF87ec7e1Ee467d7d78862089B92dd40497cBa5B8", // MATIC + "0xDcE26B2c78609b983cF91cCcD43E238353653b0E", // IdleCDO_clearpool_DAI + ] + }, + polygon: { + v1: [ + "0x8a999F5A3546F8243205b2c0eCb0627cC10003ab", // idleDAIYield + "0x1ee6470CD75D5686d0b2b90C0305Fa46fb0C89A1", // idleUSDCYield + "0xfdA25D931258Df948ffecb66b5518299Df6527C4" // idleWETHYield + ] + } } -const trancheContracts = [ - "0xd0DbcD556cA22d3f3c142e9a3220053FD7a247BC", // DAI - "0x77648a2661687ef3b05214d824503f6717311596", // FEI - "0x34dcd573c5de4672c8248cd12a99f875ca112ad8", // stETH - "0x70320A388c6755Fc826bE0EF9f98bcb6bCCc6FeA", // mUSD - "0x4ccaf1392a17203edab55a1f2af3079a8ac513e7", // FRAX3CRV - "0x151e89e117728ac6c93aae94c621358b0ebd1866", // MIM3CRV - "0x7ecfc031758190eb1cb303d8238d553b1d4bc8ef", // steCRV - "0x008c589c471fd0a13ac2b9338b69f5f7a1a843e1", // ALUSD3CRV - "0x858F5A3a5C767F8965cF7b77C51FD178C4A92F05", // 3EUR - "0x16d88C635e1B439D8678e7BAc689ac60376fBfA6", // MUSD3CRV - "0xF87ec7e1Ee467d7d78862089B92dd40497cBa5B8", // MATIC - "0xf324Dca1Dc621FCF118690a9c6baE40fbD8f09b7", // PBTCCRV - "0xf5a3d259bfe7288284bd41823ec5c8327a314054", // IdleCDO_euler_USDC - "0x46c1f702a6aad1fd810216a5ff15aab1c62ca826", // IdleCDO_euler_DAI - "0xD5469DF8CA36E7EaeDB35D428F28E13380eC8ede", // IdleCDO_euler_USDT - "0x2398Bc075fa62Ee88d7fAb6A18Cd30bFf869bDa4", // IdleCDO_euler_AGEUR - "0xDBCEE5AE2E9DAf0F5d93473e08780C9f45DfEb93", // IdleCDO_clearpool_wintermute_USDC - "0xDBd47989647Aa73f4A88B51f2B5Ff4054De1276a", // IdleCDO_clearpool_folkvang_USDC - "0xDcE26B2c78609b983cF91cCcD43E238353653b0E", // IdleCDO_clearpool_DAI - "0x4bC5E595d2e0536Ea989a7a9741e9EB5c3CAea33", // IdleCDO_ribbon_folkvang_USDC - "0xf6B692CC9A5421E4C66D32511d65F94c64fbD043", // IdleCDO_ribbon_wintermute_USDC - "0xc8c64CC8c15D9aa1F4dD40933f3eF742A7c62478", // IdleCDO_ribbon_DAI - "0x1f5A97fB665e295303D2F7215bA2160cc5313c8E", // IdleCDO_truefi_USDC -]; - -const trancheTokenUnderlying = { - "0x6b175474e89094c44da98b954eedeac495271d0f":"0x6b175474e89094c44da98b954eedeac495271d0f", // DAI - "0x956f47f50a910163d8bf957cf5846d573e7f87ca":"0x956f47f50a910163d8bf957cf5846d573e7f87ca", // FEI - "0xae7ab96520de3a18e5e111b5eaab095312d7fe84":"0xae7ab96520de3a18e5e111b5eaab095312d7fe84", // stETH - "0xe2f2a5c287993345a840db3b0845fbc70f5935a5":"0xe2f2a5c287993345a840db3b0845fbc70f5935a5", // mUSD - "0xd632f22692fac7611d2aa1c0d552930d43caed3b":"0xd632f22692fac7611d2aa1c0d552930d43caed3b", // FRAX3CRV - "0x5a6a4d54456819380173272a5e8e9b9904bdf41b":"0x5a6a4d54456819380173272a5e8e9b9904bdf41b", // MIM3CRV - "0x06325440d014e39736583c165c2963ba99faf14e":"0x06325440d014e39736583c165c2963ba99faf14e", // steCRV - "0x43b4fdfd4ff969587185cdb6f0bd875c5fc83f8c":"0x43b4fdfd4ff969587185cdb6f0bd875c5fc83f8c", // ALUSD3CRV - "0xb9446c4ef5ebe66268da6700d26f96273de3d571":"0xb9446c4ef5ebe66268da6700d26f96273de3d571", // 3EUR - "0x1aef73d49dedc4b1778d0706583995958dc862e6":"0x1aef73d49dedc4b1778d0706583995958dc862e6", // MUSD3CRV - "0xc9467e453620f16b57a34a770c6bcebece002587":"0xc9467e453620f16b57a34a770c6bcebece002587", // PBTCCRV - "0x1a7e4e63778b4f12a199c062f3efdd288afcbce8":"0x1a7e4e63778b4f12a199c062f3efdd288afcbce8", // AGEUR - "0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0":"0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0", // MATIC - "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48":"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", // USDC -}; +const trancheConfig = { + ethereum: { + factory: '0x3c9916bb9498f637e2fa86c2028e26275dc9a631', + fromBlock: 13244388, + }, +} +const getCurrentAllocationsABI = 'function getCurrentAllocations() returns (address[] tokenAddresses, uint256[] amounts, uint256 total)' +async function tvl(time, ethBlock, chainBlocks, { api }) { + const { v1 = [], v3 = [], safe = [], cdos = [] } = contracts[api.chain] + const balances = {} + const ownerTokens = [] + + const [tokenAllocations, allTokens, token, tokenV3, tokenSafe, allocations] = await Promise.all([ + api.multiCall({ abi: getCurrentAllocationsABI, calls: v3 }), + api.multiCall({ abi: 'address[]:getAllAvailableTokens', calls: v1 }), + api.multiCall({ abi: 'address:token', calls: v1 }), + api.multiCall({ abi: 'address:token', calls: v3 }), + api.multiCall({ abi: 'address:token', calls: safe }), + api.multiCall({ abi: 'uint256[]:getAllocations', calls: safe }), + ]) + + const calls = allocations.map((allo, i) => allo.map((_, j) => ({ target: safe[i], params: [j] }))).flat() + const aSafeTokens = await api.multiCall({ abi: 'function allAvailableTokens(uint256) view returns (address)', calls }) + aSafeTokens.forEach((v, i) => ownerTokens.push([[v], calls[i].target])) + tokenSafe.forEach((v, i) => ownerTokens.push([[v], safe[i]])) + + // Load tokens decimals + const callsDecimals = token.map( t => ({ target: t, params: [] }) ) + const decimalsResults = await api.multiCall({abi: 'erc20:decimals', calls: callsDecimals}) + const tokensDecimals = decimalsResults.reduce( (tokensDecimals, decimals, i) => { + const call = callsDecimals[i] + tokensDecimals[call.target] = decimals + return tokensDecimals + }, {}) + + const trancheTokensMapping = {} + const blacklistedTokens = [...eulerTokens] + + const { factory, fromBlock } = trancheConfig[api.chain] ?? {} + if (factory) { + const logs = await getLogs({ + api, + target: factory, + topics: ['0xcfed305fd6d1aebca7d8ef4978868c2fe10910ee8dd94c3be048a9591f37429f'], + eventAbi: 'event CDODeployed(address proxy)', + onlyArgs: true, + fromBlock, + }) + cdos.push(...logs.map(i => i.proxy)) + + const [strategyToken, token, aatrances, bbtrances, aaprices, bbprices] = await Promise.all(['address:strategyToken', "address:token", "address:AATranche", "address:BBTranche", "uint256:priceAA", "uint256:priceBB"].map(abi => api.multiCall({ abi, calls: cdos }))) + blacklistedTokens.push(...cdos) + blacklistedTokens.push(...aatrances) + blacklistedTokens.push(...bbtrances) -function chainTvl(chain){ - return async (time, ethBlock, chainBlocks)=>{ - const block = chainBlocks[chain]; - const calls = { - chain, - block, - calls: contracts[chain].map(c=>({target:c})) - }; - const [tokenPrice, token, supply] = await Promise.all([abi.tokenPrice, abi.token, "erc20:totalSupply"].map(abi=> - sdk.api.abi.multiCall({ - abi, - ...calls, - })) - ); - const balances = {}; - tokenPrice.output.forEach((price, i)=>{ - sdk.util.sumSingleBalance(balances, chain+":"+ token.output[i].output, - BigNumber(price.output).times(supply.output[i].output).div(1e18).toFixed(0)) + // Get CDOs contract values + const contractValue = await api.multiCall({ abi: 'uint256:getContractValue', calls: cdos }) + cdos.forEach((cdo, i) => { + const tokenDecimals = tokensDecimals[token[i]] || 18 + trancheTokensMapping[aatrances[i]] = { + token: token[i], + decimals: tokenDecimals, + price: BigNumber(aaprices[i]).div(`1e${tokenDecimals}`).toFixed() + } + trancheTokensMapping[bbtrances[i]] = { + token: token[i], + decimals: tokenDecimals, + price: BigNumber(bbprices[i]).div(`1e${tokenDecimals}`).toFixed() + } + // Get CDOs underlying tokens balances + balances[token[i]] = BigNumber(balances[token[i]] || 0).plus(BigNumber(contractValue[i] || 0)) }) - if (chain==="ethereum"){ - const [contractValue, trancheToken] = await Promise.all([abi.getContractValue, abi.token].map(abi=> - sdk.api.abi.multiCall({ - abi, - block, chain, - calls: trancheContracts.map(c=>({target:c})) - })) - ); - - contractValue.output.forEach((value, i)=>{ - sdk.util.sumSingleBalance(balances, chain+":"+ trancheTokenUnderlying[trancheToken.output[i].output.toLowerCase()], value.output) - }) - } - return balances; } + + const trancheTokensBalancesCalls = [] + + allTokens.forEach((tokens, i) => { + tokens.push(token[i]) + const blackListedTrancheTokens = tokens.filter( blacklistedToken => blacklistedTokens.includes(blacklistedToken) && trancheTokensMapping[blacklistedToken] ).forEach( trancheToken => { + trancheTokensBalancesCalls.push({ target: trancheToken, params: [v1[i]] }) + }) + ownerTokens.push([tokens, v1[i]]) + }) + + tokenAllocations.forEach((tokens, i) => { + tokens.tokenAddresses.push(tokenV3[i]) + ownerTokens.push([tokens.tokenAddresses, v3[i]]) + }) + + // Process tranche tokens BY balances + if (trancheTokensBalancesCalls.length){ + const trancheTokensBalancesResults = await api.multiCall({ abi: 'erc20:balanceOf', calls: trancheTokensBalancesCalls }) + trancheTokensBalancesResults.forEach( (trancheTokenBalance, i) => { + const trancheToken = trancheTokensBalancesCalls[i].target + const decimals = trancheTokensMapping[trancheToken].decimals + const trancheTokenPrice = trancheTokensMapping[trancheToken].price || 1 + const underlyingToken = trancheTokensMapping[trancheToken].token + const underlyingTokenBalance = BigNumber(trancheTokenBalance || 0).times(trancheTokenPrice).div(`1e18`).times(`1e${decimals}`).toFixed(0) + balances[underlyingToken] = BigNumber(balances[underlyingToken] || 0).plus(underlyingTokenBalance) + }) + } + + return sumTokens2({ api, balances, ownerTokens, blacklistedTokens, }) } -module.exports=chainExports(chainTvl, Object.keys(contracts)) \ No newline at end of file +module.exports = { + hallmarks: [ + [Math.floor(new Date('2023-03-13') / 1e3), 'Euler was hacked'], + ], +}; + +Object.keys(contracts).forEach(chain => { + module.exports[chain] = { tvl } +}) \ No newline at end of file diff --git a/projects/ifpool/abis.json b/projects/ifpool/abis.json deleted file mode 100644 index f94f18c0627..00000000000 --- a/projects/ifpool/abis.json +++ /dev/null @@ -1,50 +0,0 @@ -[ - { - "inputs": [ - { - "internalType": "address", - "name": "validator", - "type": "address" - } - ], - "name": "getValidatorInfo", - "outputs": [ - { - "internalType": "address payable", - "name": "", - "type": "address" - }, - { - "internalType": "enum Validators.Status", - "name": "", - "type": "uint8" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "address[]", - "name": "", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }] \ No newline at end of file diff --git a/projects/ifpool/index.js b/projects/ifpool/index.js index bd4a827f565..6716432b65b 100644 --- a/projects/ifpool/index.js +++ b/projects/ifpool/index.js @@ -1,7 +1,7 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); -const abis = require("./abis.json"); -const validatorContract = "0x0000000000000000000000000000000000001000"; +const validatorContract = ADDRESSES.findora.FRA; const validatorAddress = "0xb0dC7A676Ab09868eBef78E16e6AEA9e79F0f9Cf"; const CHAIN = "csc"; @@ -11,7 +11,7 @@ async function coinexTVL(timestamp, _, chainBlocks) { chain: CHAIN, block: block, target: validatorContract, - abi: abis.find((abi) => abi.name === "getValidatorInfo"), + abi: 'function getValidatorInfo(address validator) view returns (address, uint8, uint256, uint256, uint256, uint256, address[])', params: [validatorAddress], }); diff --git a/projects/ignite-finance/abi.json b/projects/ignite-finance/abi.json index 07ebfebffa7..33ee85858cd 100644 --- a/projects/ignite-finance/abi.json +++ b/projects/ignite-finance/abi.json @@ -1,79 +1,6 @@ { - "markdown": { - "inputs": [ - { - "internalType": "address", - "name": "_pair", - "type": "address" - } - ], - "name": "markdown", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function", - "constant": true - }, - "valuation": { - "inputs": [ - { - "internalType": "address", - "name": "_pair", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount_", - "type": "uint256" - } - ], - "name": "valuation", - "outputs": [ - { - "internalType": "uint256", - "name": "_value", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function", - "constant": true - }, - "getCurrentPool": { - "constant": true, - "inputs": [], - "name": "getCurrentPool", - "outputs": [ - { - "name": "", - "type": "uint256" - }, - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "circulatingSupply": { - "inputs": [], - "name": "circulatingSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function", - "constant": true - } - } \ No newline at end of file + "markdown": "function markdown(address _pair) view returns (uint256)", + "valuation": "function valuation(address _pair, uint256 amount_) view returns (uint256 _value)", + "getCurrentPool": "function getCurrentPool() view returns (uint256, uint256)", + "circulatingSupply": "uint256:circulatingSupply" +} \ No newline at end of file diff --git a/projects/illuminate-fi/index.js b/projects/illuminate-fi/index.js new file mode 100644 index 00000000000..b541fe96994 --- /dev/null +++ b/projects/illuminate-fi/index.js @@ -0,0 +1,43 @@ +const { getLogs } = require('../helper/cache/getLogs') +const { sumTokens2 } = require('../helper/unwrapLPs') + +async function tvl(_, _b, _cb, { api, }) { + const market = '0xcd1d02fda51cd24123e857ce94e4356d5c073b3f' + const createMarketLogs = await getLogs({ + api, + target: market, + topics: ['0xb02abdc1b2e46d6aa310c4e8bcab63f9ec42f82c0bba87fefe442f2b21d60871'], + eventAbi: 'event CreateMarket (address indexed underlying, uint256 indexed maturity, address[9] tokens, address element, address apwine)', + onlyArgs: true, + fromBlock: 16973041, + }) + const calls = createMarketLogs.map(i => ({ params: [i.underlying, +i.maturity] })) + const pools = await api.multiCall({ abi: 'function pools(address, uint256) view returns (address)', calls, target: market }) + + // Get the TVL of the base (using the shares token balance) - this counts the amount of base tokens locked in the AMM + const baseTokens = await api.multiCall({ abi: 'address:baseToken', calls: pools }) + const sharesTokens = await api.multiCall({ abi: 'address:sharesToken', calls: pools }) + const ownerTokens = pools.map((v, i) => [[baseTokens[i], sharesTokens[i]], v]) + await sumTokens2({ api, ownerTokens, }) + + // Get the TVL of the PTs - this counts the value of the iPTs lent out + const principalTokens = await api.multiCall({ abi: 'address:fyToken', calls: pools }) + const principalTokenDecimals = await api.multiCall({ abi: 'uint256:decimals', calls: pools }) + const oneCalls = principalTokenDecimals.map((v, i) => ({ params: 10 ** v, target: pools[i] })) + let principalTokenPrices = await api.multiCall({ abi: 'function sellFYTokenPreview(uint128) view returns (uint128)', calls: oneCalls, permitFailure: true }) + let i = 0 + for (const pt of principalTokenPrices) { + if (!pt) { + principalTokenPrices[i] = await api.call({ abi: 'function unwrapPreview(uint256) view returns (uint256)', ...oneCalls[i] }) + } + i++ + } + const principalTokenSupplies = await api.multiCall({ abi: 'erc20:totalSupply', calls: principalTokens }) + + principalTokenSupplies.forEach((supply, i) => api.add(baseTokens[i], supply * +principalTokenPrices[i] / 10 ** principalTokenDecimals[i])) +} + +module.exports = { + doublecounted: true, + ethereum: { tvl } +} \ No newline at end of file diff --git a/projects/illuvium/index.js b/projects/illuvium/index.js index bf075b9fb9d..f891a372101 100644 --- a/projects/illuvium/index.js +++ b/projects/illuvium/index.js @@ -1,47 +1,30 @@ -const {sumTokensAndLPs} = require('../helper/unwrapLPs') +const { api } = require("@defillama/sdk") -const slp = "0x6a091a3406E0073C3CD6340122143009aDac0EDa" -const ilvstk = "0x25121EDDf746c884ddE4619b573A7B10714E2a36" -const ilv = "0x767fe9edc9e0df98e07454847909b5e959d7ca0e" -const slpstk = "0x8B4d8443a0229349A9892D4F7CbE89eF5f843F72" -const snxstk = "0x9898d72c2901D09E72A426d1c24b6ab90eB100e7" -const snx = "0xc011a73ee8576fb46f5e1c5751ca3b9fe0af2a6f" -const axsstk = "0x099A3B242dceC87e729cEfc6157632d7D5F1c4ef" -const axs = "0xbb0e17ef65f82ab018d8edd776e8dd940327b28b" +const { staking } = require("../helper/staking") -async function getTvl(tokens, block){ - const balances = {} - await sumTokensAndLPs(balances, tokens, block) +const ILV_POOL_V2_ADDRESS = "0x7f5f854FfB6b7701540a00C69c4AB2De2B34291D" +const ILV_TOKEN_ADDRESS = "0x767FE9EDC9E0dF98E07454847909b5E959D7ca0E" +const SLP_TOKEN_ADDRESS = "0x6a091a3406E0073C3CD6340122143009aDac0EDa" +const LP_POOL_V1_ADDRESS = "0x8B4d8443a0229349A9892D4F7CbE89eF5f843F72" +const LP_POOL_V2_ADDRESS = "0xe98477bDc16126bB0877c6e3882e3Edd72571Cc2" - return balances -} - -async function staking(timestamp, block) { - return getTvl([ - [ilv, ilvstk], - ], block) -} - -async function pool2(timestamp, block) { - return getTvl([ - [slp, slpstk, true], - ], block) -} +async function ilvStaking() { + const { output: ilvPoolTvl } = await api.abi.call({ + abi: "function getTotalReserves() view returns (uint256 totalReserves)", + target: ILV_POOL_V2_ADDRESS, + }) -async function tvl(timestamp, block) { - return getTvl([ - [snx, snxstk], - [axs, axsstk] - ], block) + return { + [ILV_TOKEN_ADDRESS]: ilvPoolTvl, + } } module.exports = { timetravel: true, - methodology: `Counts the tokens staked on the flash pools, currently SNX on 0x9898d72c2901D09E72A426d1c24b6ab90eB100e7 and AXS on 0x099A3B242dceC87e729cEfc6157632d7D5F1c4ef - pool2 are the SLP tokens locked on 0x8B4d8443a0229349A9892D4F7CbE89eF5f843F72 and staking are the ILV tokens on 0x25121EDDf746c884ddE4619b573A7B10714E2a36`, + methodology: `Based on ILV reserves in the ILVPool contract and SLP in SushiLPPool contracts.`, ethereum:{ - tvl, - pool2, - staking + tvl: () => 0, + pool2: staking([LP_POOL_V1_ADDRESS, LP_POOL_V2_ADDRESS], SLP_TOKEN_ADDRESS), + staking: ilvStaking, }, } \ No newline at end of file diff --git a/projects/immortal/api.js b/projects/immortal/api.js new file mode 100644 index 00000000000..a2a6e489abd --- /dev/null +++ b/projects/immortal/api.js @@ -0,0 +1,8 @@ +const index = require('./index') + +module.exports = { + celo: { + tvl: () => 0, + staking: index.celo.staking, + } +} \ No newline at end of file diff --git a/projects/immortal/index.js b/projects/immortal/index.js index fe36dad803f..ff0a7601f9a 100644 --- a/projects/immortal/index.js +++ b/projects/immortal/index.js @@ -1,13 +1,12 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { ohmTvl } = require("../helper/ohm"); const immo = "0xE685d21b7B0FC7A248a6A8E03b8Db22d013Aa2eE"; const stakingContract = "0xA02F4e8dE9A226E8f2F2fe27B9b207fC85CFEED2"; const treasury = "0xe2adCd126b4275cD75e72Ff7ddC8cF7e43fc13D4"; const tokens = [ - ["0x918146359264C492BD6934071c6Bd31C854EDBc3", false], // CUSD + [ADDRESSES.celo.mcUSD, false], // CUSD ["0x7d63809EBF83EF54c7CE8dEd3591D4E8Fc2102eE", true] // IMMO-CUSD ] -module.exports = { - ...ohmTvl(treasury, tokens, "celo", stakingContract, immo) -} +module.exports =ohmTvl(treasury, tokens, "celo", stakingContract, immo) diff --git a/projects/immutablex/index.js b/projects/immutablex/index.js new file mode 100644 index 00000000000..b13c4128c7c --- /dev/null +++ b/projects/immutablex/index.js @@ -0,0 +1,17 @@ +const ADDRESSES = require('../helper/coreAssets.json'); +const { sumTokensExport } = require('../helper/sumTokens'); + +const owners = [ + '0x5FDCCA53617f4d2b9134B29090C87D01058e27e9', +]; + +const tokens = [ + ADDRESSES.null, + ADDRESSES.ethereum.USDC, + "0xeD35af169aF46a02eE13b9d79Eb57d6D68C1749e", // OMI + "0xccC8cb5229B0ac8069C51fd58367Fd1e622aFD97", // GODS +]; + +module.exports = { + ethereum: { tvl: sumTokensExport({ owners, tokens }) }, +}; diff --git a/projects/impact-market/index.js b/projects/impact-market/index.js index 98d8d9866b8..cfcb95a47cb 100644 --- a/projects/impact-market/index.js +++ b/projects/impact-market/index.js @@ -1,7 +1,8 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk') const PACTTokenAddress = "0x46c9757C5497c5B1f2eb73aE79b6B67D119B0B58" -const CELOTokenAddress = "0x471EcE3750Da237f93B8E339c536989b8978a438" +const CELOTokenAddress = ADDRESSES.celo.CELO const ARITokenAddress = "0x20677d4f3d0F08e735aB512393524A3CfCEb250C" const pactDelegatorContract = "0x8f8BB984e652Cb8D0aa7C9D6712Ec2020EB1BAb4" diff --git a/projects/impermax/index.js b/projects/impermax/index.js index cf6ba22fac2..4adaba8650f 100644 --- a/projects/impermax/index.js +++ b/projects/impermax/index.js @@ -1,7 +1,7 @@ const { staking } = require('../helper/staking') const { request, gql } = require("graphql-request"); const { toUSDTBalances } = require('../helper/balances'); -const { getBlock } = require('../helper/getBlock'); +const { getBlock } = require('../helper/http'); const xIMX = "0x363b2deac84f0100d63c7427335f8350f596bf59"; const IMX = "0x7b35ce522cb72e4077baeb96cb923a5529764a00"; @@ -10,7 +10,7 @@ function offset(chain) { case 'ethereum': return 100 case 'polygon': - return 500 + return 1000 case 'arbitrum': return 2000 case 'moonriver': @@ -19,8 +19,8 @@ function offset(chain) { return 800 case 'fantom': return 1500 - }; -}; + } +} function getChainTvl(graphUrls, factoriesName = "uniswapFactories", tvlName = "totalLiquidityUSD") { const graphQuery = gql` @@ -52,7 +52,7 @@ function getChainTvl(graphUrls, factoriesName = "uniswapFactories", tvlName = "t return toUSDTBalances(tvl); }; }; -}; +} const subgraphs = { @@ -61,9 +61,16 @@ const subgraphs = { 'impermax-finance/impermax-x-uniswap-v2-polygon', 'impermax-finance/impermax-x-uniswap-v2-polygon-v2', ], - 'arbitrum': ['impermax-finance/impermax-x-uniswap-v2-arbitrum'], + 'arbitrum': [ + 'impermax-finance/impermax-x-uniswap-v2-arbitrum', + 'impermax-finance/impermax-arbitrum-v2', + 'impermax-finance/impermax-arbitrum-solv2', + ], 'moonriver': ['impermax-finance/impermax-x-uniswap-v2-moonriver'], - 'avax': ['impermax-finance/impermax-x-uniswap-v2-avalanche'], + 'avax': [ + 'impermax-finance/impermax-x-uniswap-v2-avalanche', + 'impermax-finance/impermax-avalanche-v2', + ], 'fantom': ['impermax-finance/impermax-x-uniswap-v2-fantom'], } @@ -80,7 +87,7 @@ module.exports = { }, ethereum: { tvl: chainTvl('ethereum'), - staking: staking(xIMX, IMX, 'ethereum') + //staking: staking(xIMX, IMX, 'ethereum') }, avax: { tvl: chainTvl('avax') @@ -94,4 +101,4 @@ module.exports = { fantom: { tvl: chainTvl('fantom') }, -}; \ No newline at end of file +}; diff --git a/projects/impossiblefi/index.js b/projects/impossiblefi/index.js index cdf88497c10..5714025be8c 100644 --- a/projects/impossiblefi/index.js +++ b/projects/impossiblefi/index.js @@ -2,8 +2,7 @@ const { stakings } = require("../helper/staking"); const sdk = require('@defillama/sdk') const { getUniTVL } = require('../helper/unknownTokens') -const getReservesABI = { "inputs": [], "name": "getReserves", "outputs": [{ "internalType": "uint256", "name": "_reserve0", "type": "uint256" }, { "internalType": "uint256", "name": "_reserve1", "type": "uint256" }], "stateMutability": "view", "type": "function" } - +const getReserves = 'function getReserves() view returns (uint256 _reserve0, uint256 _reserve1)' const stakingAddresses = [ "0x1d37f1e6f0cce814f367d2765ebad5448e59b91b", "0x1aBd0067f60513F152ff14E9cD26a62c820d022C", @@ -30,7 +29,7 @@ const config = { Object.keys(config).forEach(chain => { const { factories = [], factoriesWithDiffABI = [] } = config[chain] const exports = [ - ...factoriesWithDiffABI.map(factory => getUniTVL({ chain, factory, useDefaultCoreAssets: false, abis: { getReservesABI } })), + ...factoriesWithDiffABI.map(factory => getUniTVL({ chain, factory, useDefaultCoreAssets: false, abis: { getReserves } })), ...factories.map(factory => getUniTVL({ chain, factory, useDefaultCoreAssets: false })), ] module.exports[chain] = { diff --git a/projects/inbuilt-finance/index.js b/projects/inbuilt-finance/index.js new file mode 100644 index 00000000000..c50b8bac679 --- /dev/null +++ b/projects/inbuilt-finance/index.js @@ -0,0 +1,20 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require("../helper/unwrapLPs"); + +const token_USDC = ADDRESSES.telos.ETH; +const token_USDT = ADDRESSES.moonriver.USDT; +const token_Knit_KFT = ADDRESSES.kava.KFT; +const masterchef = "0x68DB81eAB568174D54F3fd0d9e035eDe9AAEd3e2"; + +module.exports = { + kava: { + tvl: sumTokensExport({ + owner: masterchef, + tokens: [token_USDC, token_USDT, ] + }), + staking: sumTokensExport({ + owner: masterchef, + tokens: [token_Knit_KFT] + }) + } +} diff --git a/projects/increment-swap/index.js b/projects/increment-swap/index.js index 4967ba1d0e9..532c2b41546 100644 --- a/projects/increment-swap/index.js +++ b/projects/increment-swap/index.js @@ -8,19 +8,14 @@ async function tvl() { const { data: tvls } = await fetchURL( "https://app.increment.fi/info/tvl" ); - return tvls.DexTVL; + return { + tether: tvls.DexTVL + }; } -async function fetch() { - const { data: tvls } = await fetchURL( - "https://app.increment.fi/info/tvl" - ); - return tvls.DexTVL; -} - module.exports = { + misrepresentedTokens: true, methodology: "Counting the tokens locked in SwapPair AMM pools, pulling the data from the https://app.increment.fi/infos ", flow: { - fetch: tvl, + tvl, }, - fetch, }; diff --git a/projects/indexcoop/index.js b/projects/indexcoop/index.js index 00d2868da05..cd168d8a821 100644 --- a/projects/indexcoop/index.js +++ b/projects/indexcoop/index.js @@ -1,4 +1,6 @@ -const sdk = require("@defillama/sdk"); +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokens2 } = require('../helper/unwrapLPs') +const sdk = require("@defillama/sdk") const dpiAddress = "0x1494ca1f11d487c2bbe4543e90080aeba4ba3c2b"; const ethFliAddress = "0xaa6e8127831c9de45ae56bb1b0d4d4da6e5665bd"; @@ -9,7 +11,11 @@ const bedAddress = "0x2aF1dF3AB0ab157e1E2Ad8F88A7D04fbea0c7dc6"; const dataAddress = "0x33d63Ba1E57E54779F7dDAeaA7109349344cf5F1"; const gmiAddress = "0x47110d43175f7f2c2425e7d15792acc5817eb44f"; const icethAddress = "0x7c07f7abe10ce8e33dc6c5ad68fe033085256a84"; -const tokens = [ +const dsETH = "0x341c05c0E9b33C0E38d64de76516b2Ce970bB3BE"; +const aaveDebtToken = "0xf63b34710400cad3e044cffdcab00a0f32e33ecf"; +const USDC = ADDRESSES.ethereum.USDC +const gtcETH = '0x36c833Eed0D376f75D1ff9dFDeE260191336065e' +const sets = [ dpiAddress, ethFliAddress, mviAddress, @@ -18,23 +24,23 @@ const tokens = [ bedAddress, dataAddress, gmiAddress, - icethAddress + icethAddress, + dsETH, + gtcETH, ]; -async function tvl(timestamp, block) { - const calls = tokens.map((token) => ({ - target: token, - })); - const totalSupplies = await sdk.api.abi.multiCall({ - block, - calls, - abi: "erc20:totalSupply", - }); - const balances = {}; - sdk.util.sumMultiBalanceOf(balances, totalSupplies); - return balances; +async function tvl(timestamp, block, _, { api }) { + const tokens = await api.multiCall({ abi: 'address[]:getComponents', calls: sets }) + const toa = [] + sets.forEach((o, i) => toa.push([tokens[i], o])) + toa.push([[aaveDebtToken], icethAddress]) + const balances = await sumTokens2({ api, ownerTokens: toa, blacklistedTokens: sets }) + const usdcDebt = await api. multiCall({abi:"function borrowBalanceStored(address account) view returns (uint256)", target: "0x39aa39c021dfbae8fac545936693ac917d5e7563", calls:[ethFliAddress, btcFliAddress]}) + usdcDebt.forEach(i => sdk.util.sumSingleBalance(balances,USDC,i * -1, api.chain)) + return balances } + module.exports = { ethereum: { tvl, diff --git a/projects/indexed/index.js b/projects/indexed/index.js index 826174471ae..97b389135e5 100644 --- a/projects/indexed/index.js +++ b/projects/indexed/index.js @@ -1,33 +1,23 @@ -const { request, gql } = require("graphql-request"); -const { toUSDTBalances } = require('../helper/balances'); - -const graphUrl = 'https://api.thegraph.com/subgraphs/name/indexed-finance/indexed' -const graphQuery = gql` -query get_indexes($block: Int) { - indexPools( - block: { number: $block } - ) { - name - totalValueLockedUSD - } -} -`; - -async function tvl(timestamp, block) { - const { indexPools } = await request( - graphUrl, - graphQuery, - { - block, - } - ); - const usdTvl = indexPools.reduce((total, p) => total + Number(p.totalValueLockedUSD), 0) - - return toUSDTBalances(usdTvl) +const { getLogs } = require('../helper/cache/getLogs') +const { sumTokens2 } = require('../helper/unwrapLPs') +async function tvl(_, _b, _cb, { api, }) { + const logs = await getLogs({ + api, + target: '0x592f70cE43a310D15fF59BE1460F38Ab6DF3Fe65', + topics: ['0x3c9399222fcd8c810cad2570e37d7b31aed4013fbfb296e5de17c0935d4159e7'], + eventAbi: 'event NewPool (address pool, address controller, bytes32 implementationID)', + onlyArgs: true, + fromBlock: 11371951, + }) + const pools = logs.map(i => i.pool) + const tokens = await api.multiCall({ abi: 'address[]:getCurrentTokens', calls: pools }) + return sumTokens2({ api, ownerTokens: pools.map((v, i) => [tokens[i], v]) }) } module.exports = { - misrepresentedTokens: true, ethereum: { tvl }, - start: 0, // WRONG! + hallmarks: [ + [Math.floor(new Date('2021-10-14')/1e3), 'Protocol was hacked'], + [Math.floor(new Date('2023-03-20')/1e3), 'Balancing arbitrage'], + ], } \ No newline at end of file diff --git a/projects/infinitypad/index.js b/projects/infinitypad/index.js index 3716eec02b9..babd48c2814 100644 --- a/projects/infinitypad/index.js +++ b/projects/infinitypad/index.js @@ -2,31 +2,19 @@ const sdk = require("@defillama/sdk"); const { stakings, staking, } = require("../helper/staking"); const { getChainTransform } = require("../helper/portedTokens"); const contracts = require("./contracts.json"); -const axios = require("axios"); +const { getConfig } = require('../helper/cache'); +const { sumTokens2 } = require("../helper/unwrapLPs"); -async function fetchBalances(exports, contracts, transform, chainBlocks, chain) { - if (!contracts[chain]) return 0; - - const balances = await sdk.api.abi.multiCall({ - calls: Object.keys(contracts[chain]).map(c => ({ - target: contracts[chain][c].tokenAddress, - params: [ contracts[chain][c].tokenHolder ] - })), - abi: "erc20:balanceOf", - block: chainBlocks[chain], - chain - }); - - sdk.util.sumMultiBalanceOf(exports, balances, false, transform); -}; +async function fetchBalances(api, contracts) { + const data = contracts[api.chain] + if (!data) return api.getBalances(); + return sumTokens2({ api, tokensAndOwners: Object.values(data).map(c => ([c.tokenAddress, c.tokenHolder])), blacklistedTokens: ['0x3dde01a467f99e58f996de835058c767a3edd2ac']}) +} // node test.js projects/infinitypad/index.js function tvl(chain) { - return async (timestamp, block, chainBlocks) => { - const balances = {}; - const transform = await getChainTransform(chain); - - const vestingContracts = (await axios.get("https://api.infinitypad.com/get-all-vesting-contracts")).data; + return async (timestamp, block, chainBlocks, { api }) => { + const vestingContracts = (await getConfig('infinitypad', "https://api.infinitypad.com/get-all-vesting-contracts")); const clientVesting = {}; for (const vestingContract of vestingContracts) { if (!clientVesting[vestingContract.chain_name]) { @@ -38,32 +26,22 @@ function tvl(chain) { }; } - await fetchBalances( - balances, - clientVesting, - transform, - chainBlocks, - chain - ); - - return balances; + return fetchBalances(api, clientVesting) }; -}; +} const chainTVLObject = contracts.chains.reduce( - (agg, chain) => ({ ...agg, [chain]: {tvl: tvl(chain) }}), {} + (agg, chain) => ({ ...agg, [chain]: { tvl: tvl(chain) } }), {} ); chainTVLObject.bsc.staking = stakings( - [ contracts.stakingContractBsc ], + [contracts.stakingContractBsc], contracts.stakingTokenBsc, - "bsc" ); chainTVLObject.bsc.pool2 = staking( - [ contracts.stakingContractBsc ], - [ contracts.stakingTokenLp ], - 'bsc' + [contracts.stakingContractBsc], + [contracts.stakingTokenLp], ); module.exports = { diff --git a/projects/infy/index.js b/projects/infy/index.js index eee098fc6c4..5a30ffef977 100644 --- a/projects/infy/index.js +++ b/projects/infy/index.js @@ -1,12 +1,13 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens2 } = require('../helper/unwrapLPs') async function tvlPolygon(time, ethB, { polygon: block }) { const escrows = ["0xCf311a6606c909Cc5E048FE1f3FF1e63dEec6a26", "0x4fF4C17F24d03Faf9d5097D7E71310AeF71a0f70", "0x9C5dA47ED0281aF302ED1E77a1B961ed980d5385"] const tokens = [ - "0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619", //weth - "0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063", //dai - "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174", //usdc - "0xc2132D05D31c914a87C6611C10748AEb04B58e8F", //usdt + ADDRESSES.polygon.WETH_1, //weth + ADDRESSES.polygon.DAI, //dai + ADDRESSES.polygon.USDC, //usdc + ADDRESSES.polygon.USDT, //usdt "0x2e1AD108fF1D8C782fcBbB89AAd783aC49586756", //tusd ] return sumTokens2({ owners: escrows, tokens, chain: 'polygon', block, }) @@ -19,10 +20,10 @@ async function tvlKava(time, ethB, { kava: block }) { "0xEc12AB0306A3bbDa93aACC2BE931F8A8343bCEA3" ] const tokens = [ - "0xE3F5a90F9cb311505cd691a46596599aA1A0AD7D", //weth - "0x765277EebeCA2e31912C9946eAe1021199B39C61", //dai - "0xfA9343C3897324496A05fC75abeD6bAC29f8A40f", //usdc - "0xB44a9B6905aF7c801311e8F4E76932ee959c663C", //usdt + ADDRESSES.moonriver.USDC, //weth + ADDRESSES.shiden.ETH, //dai + ADDRESSES.telos.ETH, //usdc + ADDRESSES.moonriver.USDT, //usdt ] return sumTokens2({ owners: escrows, tokens, chain: 'kava', block, }) } diff --git a/projects/injective/index.js b/projects/injective/index.js index 4db5e769215..b3a9626f82b 100644 --- a/projects/injective/index.js +++ b/projects/injective/index.js @@ -1,30 +1,32 @@ -const { sumTokensExport } = require('../helper/unwrapLPs') -const { tokensBare: tokens } = require('../helper/tokenMapping') +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require('../helper/unwrapLPs') const newHolder = '0xf955c57f9ea9dc8781965feae0b6a2ace2bad6f3' module.exports = { ethereum: { - tvl: sumTokensExport({ owner: newHolder, tokens: [ - tokens.weth, - tokens.dai, - tokens.usdc, - tokens.usdt, - tokens.link, - tokens.wbtc , - '0xaaef88cea01475125522e117bfe45cf32044e238', - '0x4a220e6096b25eadb88358cb44068a3248254675', - '0xde4c5a791913838027a2185709e98c5c6027ea63', - '0x92d6c1e31e14520e676a687f0a93788b716beff5', - '0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984', - '0xBB0E17EF65F82Ab018d8EDd776e8DD940327B28b', - '0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84', - '0x4d224452801ACEd8B2F0aebE155379bb5D594381', - '0x7D1AfA7B718fb893dB30A3aBc0Cfc608AaCfeBB0', - '0x7Fc66500c84A76Ad7e9c93437bFc5Ac33E2DDaE9', - '0xC011a73ee8576Fb46F5E1c5751cA3B9Fe0af2a6F', - '0x45804880De22913dAFE09f4980848ECE6EcbAf78', - '0x6B3595068778DD592e39A122f4f5a5cF09C90fE2', - '0xc944E90C64B2c07662A292be6244BDf05Cda44a7', - ]}) + tvl: sumTokensExport({ + owner: newHolder, tokens: [ + ADDRESSES.ethereum.WETH, + ADDRESSES.ethereum.DAI, + ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.USDT, + ADDRESSES.ethereum.LINK, + ADDRESSES.ethereum.WBTC, + '0xaaef88cea01475125522e117bfe45cf32044e238', + '0x4a220e6096b25eadb88358cb44068a3248254675', + '0xde4c5a791913838027a2185709e98c5c6027ea63', + '0x92d6c1e31e14520e676a687f0a93788b716beff5', + ADDRESSES.ethereum.UNI, + '0xBB0E17EF65F82Ab018d8EDd776e8DD940327B28b', + ADDRESSES.ethereum.STETH, + '0x4d224452801ACEd8B2F0aebE155379bb5D594381', + ADDRESSES.ethereum.MATIC, + ADDRESSES.ethereum.AAVE, + ADDRESSES.ethereum.SNX, + '0x45804880De22913dAFE09f4980848ECE6EcbAf78', + ADDRESSES.ethereum.SUSHI, + '0xc944E90C64B2c07662A292be6244BDf05Cda44a7' + ] + }) } } diff --git a/projects/ink-protocol/index.js b/projects/ink-protocol/index.js index 9575c7e4cd2..f81a89d0706 100644 --- a/projects/ink-protocol/index.js +++ b/projects/ink-protocol/index.js @@ -15,7 +15,7 @@ async function tvl() { module.exports = { methodology: 'TVL counts the UST that users deposited into Ink Protocol', terra: { - tvl + tvl: () => ({}), }, hallmarks:[ [1651881600, "UST depeg"], diff --git a/projects/insrt_finance/index.js b/projects/insrt_finance/index.js new file mode 100644 index 00000000000..ecf863c740b --- /dev/null +++ b/projects/insrt_finance/index.js @@ -0,0 +1,30 @@ +const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') + +const fidenzavault = '0xfCEed70c8E9f38A0c3A0062D40d0Ab06493063a1' +const rockvault = '0x185B6B13Be7cEfa99262AF1F78ae87213E4DDD3d' +const baycvault2 = '0x417c53C3B63a03aeb614b7b625ae84Cfc7eecD1c' +const squigglevault = '0x5D40A087cec071cd3b8A7AF4B45b3D56D6c3f952' +const penguvault = '0x8facab18b9f4cd1a9f90876290c9bfa238cd4e45' +const miladyvault = '0x861ff455dcd810895cb4050460e4b6a47fec3304' +const insrtVaults = [ fidenzavault, rockvault, baycvault2, squigglevault, penguvault, miladyvault ] +const vaulttokens = [nullAddress, '0xa3f5998047579334607c47a6a2889bf87a17fc02', '0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d', '0xbd3531da5cf5857e7cfaa92426877b022e612cf8', '0x524cab2ec69124574082676e6f654a18df49a048', '0x062e691c2054de82f28008a8ccc6d7a1c8ce060d', '0x5Af0D9827E0c53E4799BB226655A1de152A425a5' ] + +async function tvl(_, _b, _cb, { api, }) { + await vaultTvl(api, [punkvault, baycvault, ]) + return sumTokens2({ api, owners: insrtVaults , tokens: vaulttokens, resolveArtBlocks: true, }) +} + +// ERC721 Vaults +const punkvault = "0x70993a6dfe0ef2d5253d6498c18d815a6c139163" +const baycvault = "0x6d0c967b6e24ae33c015595aaa2303001af4055d" + +async function vaultTvl(api, vaults) { + const colls = await api.multiCall({ abi: 'address:collection', calls: vaults}) + const ids = await api.multiCall({ abi: 'uint256[]:ownedTokenIds', calls: vaults}) + api.addTokens(colls,ids.map(i=> i.length)) +} + +module.exports = { + methodology: `Value of all the NFTs held by the insrt finance's vaults`, + ethereum: { tvl } +} \ No newline at end of file diff --git a/projects/insurace/abi.json b/projects/insurace/abi.json index 51e52589770..9839e0f456c 100644 --- a/projects/insurace/abi.json +++ b/projects/insurace/abi.json @@ -1,21 +1,3 @@ { - "getStakedAmountPT": { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - } - ], - "name": "getStakedAmountPT", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } + "getStakedAmountPT": "function getStakedAmountPT(address _token) view returns (uint256)" } \ No newline at end of file diff --git a/projects/insurace/index.js b/projects/insurace/index.js index 3c4cebb06a5..cbd0b055ded 100644 --- a/projects/insurace/index.js +++ b/projects/insurace/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk'); const abi = require('./abi.json'); @@ -5,6 +6,7 @@ const BigNumber = require('bignumber.js'); const axios = require("axios"); const polygonPools = require('./polygonPools.json') const avalanchePools = require('./avalanchePools.json') +const { getConfig } = require('../helper/cache') async function eth(timestamp, ethBlock) { @@ -15,7 +17,7 @@ async function eth(timestamp, ethBlock) { if (ethBlock < 12301500) { throw new Error("Not yet deployed") } - const { data } = await axios.get("https://files.insurace.io/public/defipulse/pools.json"); + const data = await getConfig('insurace/ethereum', "https://files.insurace.io/public/defipulse/pools.json"); const pools = data.pools; const { output: _tvlList } = await sdk.api.abi.multiCall({ @@ -32,7 +34,7 @@ async function eth(timestamp, ethBlock) { _tvlList.forEach((element) => { let address = element.input.params[0].toLowerCase(); if (address == "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee") { - address = "0x0000000000000000000000000000000000000000"; + address = ADDRESSES.null; } let balance = element.output; if (BigNumber(balance).toNumber() <= 0) { @@ -59,7 +61,7 @@ async function bsc(timestamp, ethBlock, chainBlocks){ if (bscBlock < 8312474) { throw new Error("Not yet deployed") } - const { data } = await axios.get("https://files.insurace.io/public/defipulse/bscPools.json"); + const data = await getConfig('insurace/bsc', "https://files.insurace.io/public/defipulse/bscPools.json"); const pools = data.pools; const { output: _tvlList } = await sdk.api.abi.multiCall({ @@ -77,7 +79,7 @@ async function bsc(timestamp, ethBlock, chainBlocks){ _tvlList.forEach((element) => { let address = element.input.params[0].toLowerCase(); if (address == "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee") { - address = "bsc:0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c"; + address = "bsc:" + ADDRESSES.bsc.WBNB; }else if (address == "0x3192ccddf1cdce4ff055ebc80f3f0231b86a7e30") { address = "0x544c42fbb96b39b21df61cf322b5edc285ee7429"; }else{ @@ -109,7 +111,7 @@ async function polygon(timestamp, ethBlock, chainBlocks) { _tvlList.forEach((element) => { let address = element.input.params[0].toLowerCase(); if(address === "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"){ - address = "0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270" + address = ADDRESSES.polygon.WMATIC_2 } let balance = element.output; sdk.util.sumSingleBalance(balances, 'polygon:'+address, balance) @@ -135,7 +137,7 @@ async function avax(timestamp, ethBlock, chainBlocks) { _tvlList.forEach((element) => { let address = element.input.params[0].toLowerCase(); if(address === "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"){ - address = "0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7" + address = ADDRESSES.avax.WAVAX } let balance = element.output; sdk.util.sumSingleBalance(balances, address===INSUR?INSUR:'avax:'+address, balance) diff --git a/projects/insuredao/abi.json b/projects/insuredao/abi.json deleted file mode 100644 index 408560cca1f..00000000000 --- a/projects/insuredao/abi.json +++ /dev/null @@ -1,104 +0,0 @@ -{ - "balanceOf": { - "constant": true, - "inputs": [{ "name": "_owner", "type": "address" }], - "name": "balanceOf", - "outputs": [{ "name": "balance", "type": "uint256" }], - "type": "function" - }, - "count": { - "inputs": [], - "name": "count", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "list": { - "inputs": [ - { - "internalType": "uint256", - "name": "offset", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "limit", - "type": "uint256" - } - ], - "name": "list", - "outputs": [ - { - "internalType": "address[]", - "name": "_policyBooksArr", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getShieldTokenAddress": { - "inputs": [ - { - "internalType": "address", - "name": "_policyBook", - "type": "address" - } - ], - "name": "getShieldTokenAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "virtualUsdtAccumulatedBalance": { - "inputs": [], - "name": "virtualUsdtAccumulatedBalance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "valueAll": { - "inputs": [], - "name": "valueAll", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "supply": { - "inputs": [], - "name": "supply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -} diff --git a/projects/insuredao/index.js b/projects/insuredao/index.js index 9e49d90b9bf..110466914c0 100644 --- a/projects/insuredao/index.js +++ b/projects/insuredao/index.js @@ -1,85 +1,26 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); -const abi = require("./abi.json"); -const { sumTokens, sumTokensAndLPs, unwrapCrv, unwrapUniswapLPs, genericUnwrapCvx, } = require('../helper/unwrapLPs'); - -const chain = "ethereum"; +const { sumTokensAndLPs, } = require('../helper/unwrapLPs'); // addresses pools -const usdc = "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"; +const usdc = ADDRESSES.ethereum.USDC; const insure = "0xd83AE04c9eD29d6D3E6Bf720C71bc7BeB424393E"; -const Vault = "0x131fb74c6fede6d6710ff224e07ce0ed8123f144"; -const optimismVault = "0xCa1FeE73b00c221966E5f25226402146BdffE259"; -const astarVault = "0x190dA1B9fA124BD872e9166bA3c7Dd656A11E8F8"; - const VotingEscrow = "0x3dc07E60ecB3d064d20c386217ceeF8e3905916b"; const vlINSURE = "0xA12ab76a82D118e33682AcB242180B4cc0d19E29"; const uni = "0x1b459aec393d604ae6468ae3f7d7422efa2af1ca"; const uniStaking = "0xf57882cf186db61691873d33e3511a40c3c7e4da"; -// =================== GET ETH usdc BALANCES =================== // -async function tvl(timestamp, block) { - let balances = {}; - - const vusdcBalances = ( - await sdk.api.abi.call({ - target: Vault, - abi: abi["valueAll"], - chain: chain, - block: block, - }) - ).output; - sdk.util.sumSingleBalance(balances, usdc, vusdcBalances); - - return balances; -} - -// =================== GET Optimism usdc BALANCES =================== // -async function optimismtvl(timestamp, _, { optimism: block }) { - let balances = {}; - - const vusdcBalances = ( - await sdk.api.abi.call({ - target: optimismVault, - abi: abi["valueAll"], - chain: "optimism", - block: block, - }) - ).output; - sdk.util.sumSingleBalance(balances, usdc, vusdcBalances); - - return balances; -} - -// =================== GET astar usdc BALANCES =================== // -async function astartvl(timestamp, _, { astar: block }) { - let balances = {}; - - const vusdcBalances = ( - await sdk.api.abi.call({ - target: astarVault, - abi: abi["valueAll"], - chain: "astar", - block: block, - }) - ).output; - sdk.util.sumSingleBalance(balances, usdc, vusdcBalances); - - return balances; -} - // =================== GET INSURE BALANCES =================== // -async function staking(timestamp, block) { +async function staking(_, block) { let balances = {}; - const veinsureBalances = ( await sdk.api.abi.call({ target: VotingEscrow, - abi: abi["supply"], - chain: chain, + abi: 'uint256:supply', block: block, }) ).output; @@ -88,8 +29,7 @@ async function staking(timestamp, block) { await sdk.api.abi.call({ target: insure, params: vlINSURE, - abi: abi["balanceOf"], - chain: chain, + abi: 'erc20:balanceOf', block: block, }) ).output; @@ -100,8 +40,7 @@ async function staking(timestamp, block) { return balances; } - -async function pool2(timestamp, block) { +async function pool2(_, block) { const balances = {} await sumTokensAndLPs(balances, [ [uni, uniStaking, true] @@ -109,16 +48,29 @@ async function pool2(timestamp, block) { return balances } +const config = { + ethereum: '0x131fb74c6fede6d6710ff224e07ce0ed8123f144', + arbitrum: '0x968C9718f420d5D4275C610C5c217598a6ade9f9', + optimism: '0x54F23d2fdC1E17D349B1Eb14d869fa4deD6A6D2b', + astar: '0x190dA1B9fA124BD872e9166bA3c7Dd656A11E8F8', +} + module.exports = { - ethereum: { - tvl: tvl, - staking: staking, - pool2: pool2, - }, - optimism: { - tvl: optimismtvl, - }, - astar: { - tvl: astartvl, - } + misrepresentedTokens: true, }; + +Object.keys(config).forEach(chain => { + const vault = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const bal = await api.call({ + target: vault, + abi: 'uint256:valueAll', + }) + return { [usdc]: bal} + } + } +}) + +module.exports.ethereum.staking = staking +module.exports.ethereum.pool2 = pool2 diff --git a/projects/insuredefi/abi.json b/projects/insuredefi/abi.json index fa644c02675..5a9ba21a185 100644 --- a/projects/insuredefi/abi.json +++ b/projects/insuredefi/abi.json @@ -1,49 +1,6 @@ { - "totalPledge": { - "inputs": [], - "name": "totalPledge", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - "totalStake": { - "inputs": [], - "name": "totalStake", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - "totalSupply": { - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "balanceOf": { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } - -} + "totalPledge": "uint256:totalPledge", + "totalStake": "uint256:totalStake", + "totalSupply": "uint256:totalSupply", + "balanceOf": "function balanceOf(address account) view returns (uint256)" +} \ No newline at end of file diff --git a/projects/integral/abis/sizeGetReserves.json b/projects/integral/abis/sizeGetReserves.json deleted file mode 100644 index 8e6b8c7f1f1..00000000000 --- a/projects/integral/abis/sizeGetReserves.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "constant": true, - "inputs": [], - "name": "getReserves", - "outputs": [ - { - "internalType": "uint112", - "name": "reserve0", - "type": "uint112" - }, - { - "internalType": "uint112", - "name": "reserve1", - "type": "uint112" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" -} \ No newline at end of file diff --git a/projects/integral/index.js b/projects/integral/index.js index 8f033964cbb..e9f64327e03 100644 --- a/projects/integral/index.js +++ b/projects/integral/index.js @@ -1,12 +1,10 @@ -const sdk = require('@defillama/sdk') const { getUniTVL } = require('../helper/unknownTokens') -const getReservesABI = require('./abis/sizeGetReserves.json') +const getReserves = 'function getReserves() view returns (uint112 _reserve0, uint112 _reserve1)' -const fiveTVL = getUniTVL({ factory: '0x673662e97b05e001816c380ba5a628d2e29f55d1' }) -const sizeTVL = getUniTVL({ factory: '0xC480b33eE5229DE3FbDFAD1D2DCD3F3BAD0C56c6', abis: { getReservesABI } }) +const sizeTVL = getUniTVL({ factory: '0xC480b33eE5229DE3FbDFAD1D2DCD3F3BAD0C56c6', abis: { getReserves } }) +const sizeTVLArbi = getUniTVL({ factory: '0x717EF162cf831db83c51134734A15D1EBe9E516a', abis: { getReserves } }) module.exports = { - ethereum: { - tvl: sdk.util.sumChainTvls([fiveTVL, sizeTVL]) - }, + ethereum: { tvl: sizeTVL }, + arbitrum: { tvl: sizeTVLArbi }, }; diff --git a/projects/intercroneswap/index.js b/projects/intercroneswap/index.js new file mode 100644 index 00000000000..d03be82b2c6 --- /dev/null +++ b/projects/intercroneswap/index.js @@ -0,0 +1,29 @@ +const sdk = require('@defillama/sdk') +const { getUniTVL } = require('../helper/unknownTokens.js') + +const TRON_FACTORY_V2 = 'TPvaMEL5oY2gWsJv7MDjNQh2dohwvwwVwx' +const TRON_FACTORY_V1 = 'TJL9Tj2rf5WPUkaYMzbvWErn6M8wYRiHG7' +const factories = { + bsc: "0xFa51B0746eb96deBC619Fd2EA88d5D8B43BD8230", + bittorrent: "0x0cEE0dFb5C680e3CcAA46FA28D5057f204E24F0a", +} + +function chainTvl(chain) { + module.exports[chain] = { + tvl: getUniTVL({ factory: factories[chain], useDefaultCoreAssets: true, }) + } +} + +module.exports = { + timetravel: false, + misrepresentedTokens: true +} + +Object.keys(factories).map(chainTvl) + +module.exports.tron = { + tvl: sdk.util.sumChainTvls([ + getUniTVL({ factory: TRON_FACTORY_V1, useDefaultCoreAssets: true, }), + getUniTVL({ factory: TRON_FACTORY_V2, useDefaultCoreAssets: true, }), + ]) +} \ No newline at end of file diff --git a/projects/interest-protocol/index.js b/projects/interest-protocol/index.js new file mode 100644 index 00000000000..084c407d8bf --- /dev/null +++ b/projects/interest-protocol/index.js @@ -0,0 +1,16 @@ +const { dexExport } = require('../helper/chain/sui'); + +const getTokens = (pool) => { + const type = pool.type.split('Pool'); + const poolArgs = type[1]; + const tokens = poolArgs.split(','); + return [tokens[1].trim(), tokens[2].split('>')[0].trim()]; +}; + +module.exports = dexExport({ + account: '0x108779144605a44e4b5447118b711f0b17adf6168cc9b08551d33daca58098e3', + poolStr: 'core::Pool', + token0Reserve: i => i.fields.balance_x, + token1Reserve: i => i.fields.balance_y, + getTokens +}); \ No newline at end of file diff --git a/projects/interport-finance/index.js b/projects/interport-finance/index.js new file mode 100644 index 00000000000..def75747fb5 --- /dev/null +++ b/projects/interport-finance/index.js @@ -0,0 +1,26 @@ +const { sumTokens2 } = require('../helper/unwrapLPs'); +const { staking } = require('../helper/staking'); + +const usdtVault = '0xEc8DDCb498b44C35EFaD7e5e43E0Caf6D16A66E8'; +const usdcVault = '0x5b45B414c6CD2a3341bE70Ba22BE786b0124003F'; +const defaultVaults = [usdtVault, usdcVault]; +const config = { + era: { vaults: ['0xc724832c5ed81599aE3E4EBC0eC4f87A285B5838'] }, +} + +module.exports = { + methodology: 'Interport TVL is calculated by summing the USDT and USDC balance of the vaults contracts, ITP token balance in the ITP Revenue Share contract and LP token balance in the LP Revenue Share contract.', +}; + +['ethereum', 'avax', 'bsc', 'fantom', 'arbitrum', 'polygon', 'polygon_zkevm', 'era'].forEach(chain => { + module.exports[chain] = { + tvl: async (_, _1, _2, { api }) => { + const vaults = config[chain]?.vaults || defaultVaults + const tokens = await api.multiCall({ abi: 'address:asset', calls: vaults }) + return sumTokens2({ api, tokensAndOwners2: [tokens, vaults]}) + } + } +}); + +module.exports.ethereum.staking = staking('0x5DC6796Adc2420BD0f48e05f70f34B30F2AaD313', '0x2b1D36f5B61AdDAf7DA7ebbd11B35FD8cfb0DE31') +module.exports.ethereum.pool2 = staking('0x5F51A04c271C395994F156172cDe451a0188Ca75', '0x152E2502c22F73a7493df8B856836efBc69E3718') diff --git a/projects/inuswap/index.js b/projects/inuswap/index.js index 0a20aeec9aa..1cb8565c425 100644 --- a/projects/inuswap/index.js +++ b/projects/inuswap/index.js @@ -5,9 +5,11 @@ const { const chain = 'dogechain' module.exports = { + hallmarks: [ + [1663200000, "Rug Pull"] + ], dogechain: { tvl: getUniTVL({ - chain, useDefaultCoreAssets: true, factory: '0xbDe460e12B5dcD955e70da8889754958113E988a', }), diff --git a/projects/invar-finance/abis.js b/projects/invar-finance/abis.js index 4e80506b159..32a3ea6fe44 100644 --- a/projects/invar-finance/abis.js +++ b/projects/invar-finance/abis.js @@ -1,42 +1,7 @@ const abis = {}; -abis.balanceOf = { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "uint256", - "name": "id", - "type": "uint256" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" -}; +abis.balanceOf = 'function balanceOf(address account, uint256 id) view returns (uint256)'; -abis.SellingPrice = { - "inputs": [], - "name": "SellingPrice", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" -} +abis.SellingPrice = "uint256:SellingPrice" module.exports = abis \ No newline at end of file diff --git a/projects/invar-finance/index.js b/projects/invar-finance/index.js index a2f8b4f7583..a9098077817 100644 --- a/projects/invar-finance/index.js +++ b/projects/invar-finance/index.js @@ -1,8 +1,9 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const abis = require("./abis.js"); const BigNumber = require("bignumber.js"); -const USDC_ADDRESS = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"; +const USDC_ADDRESS = ADDRESSES.ethereum.USDC; const RE_NFT = "0x502818ec5767570F7fdEe5a568443dc792c4496b"; const INVARIA2222 = "0x10a92B12Da3DEE9a3916Dbaa8F0e141a75F07126"; diff --git a/projects/inverse-finance-firm/abi.json b/projects/inverse-finance-firm/abi.json new file mode 100644 index 00000000000..6213ec3f2d3 --- /dev/null +++ b/projects/inverse-finance-firm/abi.json @@ -0,0 +1,6 @@ +{ + "balance": "uint:balance", + "collateral": "address:collateral", + "CreateEscrow": "event CreateEscrow(address indexed user, address escrow)", + "AddMarket": "event AddMarket(address indexed market)" +} \ No newline at end of file diff --git a/projects/inverse-finance-firm/index.js b/projects/inverse-finance-firm/index.js new file mode 100644 index 00000000000..a6bad2bfe7c --- /dev/null +++ b/projects/inverse-finance-firm/index.js @@ -0,0 +1,48 @@ + +const abi = require("./abi.json"); +const { getLogs } = require('../helper/cache/getLogs') +const { sumTokens2 } = require('../helper/unwrapLPs') +const sdk = require("@defillama/sdk") + +// Firm +const firmStart = 16159015; +const DBR = '0xAD038Eb671c44b853887A7E32528FaB35dC5D710'; + +async function tvl(timestamp, block, _, { api }) { + const logs = await getLogs({ + api, + target: DBR, + topics: ['0xc3dfb88ee5301cecf05761fb2728064e5b641524346ae69b9ba80394631bf11f'], + fromBlock: firmStart, + eventAbi: abi.AddMarket, + }) + + const markets = logs.map(i => i.args.market); + let escrows = await Promise.all( + markets.map(async m => { + const logs = await getLogs({ + api, + target: m, + topic: "CreateEscrow(address,address)", + fromBlock: firmStart, + eventAbi: abi.CreateEscrow, + }) + return logs.map(i => i.args.escrow) + }) + ); + escrows = escrows.flat() + const tokens = await api.multiCall({ abi: 'address:token', calls: escrows}) + const tokenBalances = await api.multiCall({ abi: 'uint256:balance', calls: escrows}) + const balances = {} + tokens.forEach((t,i)=>{ + sdk.util.sumSingleBalance(balances, t, tokenBalances[i]) + }) + return balances +} + +module.exports = { + methodology: "Get collateral balances from users personal escrows", + hallmarks: [], + start: 1670701200, // Dec 10 2022 + ethereum: { tvl } +}; diff --git a/projects/inverse/abi.json b/projects/inverse/abi.json index 89cc8eb5ead..83c0cf02b34 100644 --- a/projects/inverse/abi.json +++ b/projects/inverse/abi.json @@ -1,76 +1,7 @@ { - "getAllMarkets": { - "constant": true, - "inputs": [], - "name": "getAllMarkets", - "outputs": [ - { - "internalType": "contract CToken[]", - "name": "", - "type": "address[]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function", - "signature": "0xb0772d0b" - }, - "underlying": { - "constant": true, - "inputs": [], - "name": "underlying", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function", - "signature": "0x6f307dc3" - }, - "getCash": { - "constant": true, - "inputs": [], - "name": "getCash", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "signature": "0x3b1d21a2", - "stateMutability": "view", - "type": "function" - }, - "totalSupply": { - "constant": true, - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "supply": { - "constant": true, - "inputs": [], - "name": "supply", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } -} + "getAllMarkets": "address[]:getAllMarkets", + "underlying": "address:underlying", + "getCash": "uint256:getCash", + "totalSupply": "uint256:totalSupply", + "supply": "uint256:supply" +} \ No newline at end of file diff --git a/projects/inverse/index.js b/projects/inverse/index.js index 82b7a1dd123..65aeaeb5824 100644 --- a/projects/inverse/index.js +++ b/projects/inverse/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); @@ -9,11 +10,11 @@ const anchorStart = 11915867; const comptroller = "0x4dcf7407ae5c07f8681e1659f626e114a7667339"; const ignore = ["0x7Fcb7DAC61eE35b3D4a51117A7c58D53f0a8a670"]; // anDOLA will be counted through the stabilizer const anETH = "0x697b4acAa24430F254224eB794d2a85ba1Fa1FB8"; -const wETH = "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"; +const wETH = ADDRESSES.ethereum.WETH; // Stabilizer const stabilizer = "0x7eC0D931AFFBa01b77711C2cD07c76B970795CDd"; -const dai = "0x6B175474E89094C44Da98b954EedeAC495271d0F"; +const dai = ADDRESSES.ethereum.DAI; // Vaults const vaults = [ @@ -48,6 +49,7 @@ async function getAllUnderlying(block, tokens) { }) ), abi: abi["underlying"], + permitFailure: true, }) ).output; @@ -203,7 +205,8 @@ async function tvl(timestamp, block) { module.exports = { methodology: "DOLA curve metapool replaced by DOLA", hallmarks: [ - [1648771200, "INV price hack"] + [1648771200, "INV price hack"], + [1655380800, "Inverse Frontier Deprecated",] ], start: 1607731200, // Dec 12 2020 00:00:00 GMT+0000 ethereum: { tvl } diff --git a/projects/invictus/index.js b/projects/invictus/index.js index c6b954e3ff8..d1ce0d9e038 100644 --- a/projects/invictus/index.js +++ b/projects/invictus/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { getTokenAccountBalance, getTokenBalance } = require('../helper/solana') async function staking() { @@ -10,7 +11,7 @@ async function staking() { const treasury = "6qfyGvoUqGB6AQ7xLc4pVwFNdgJSbAMkTtKkBXhLRiV1" async function tvl() { const [usdc,] = await Promise.all([ - "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", //usdc + ADDRESSES.solana.USDC, //usdc ].map(t => getTokenBalance(t, treasury))) return { "usd-coin": usdc, diff --git a/projects/iotube/index.js b/projects/iotube/index.js index 41432eb30b3..bda759defea 100644 --- a/projects/iotube/index.js +++ b/projects/iotube/index.js @@ -1,229 +1,25 @@ -const { request, gql } = require("graphql-request"); +const { sumTokens2 } = require('../helper/unwrapLPs') -const apiURL = "https://smart-graph.iotex.me/iotube/graphql"; - -const query = gql` - query ( - $iotexTokens: [String!]! - $ethTokens: [String!]! - $bscTokens: [String!]! - $polygonTokens: [String!]! - ) { - iotex: IoTeX { - chainId - CIOTX: ERC20(address: ["0x99B2B0eFb56E62E36960c20cD5ca8eC6ABD5557A"]) { - address - symbol - decimals - totalSupply - balance: market_cap - } - CYC: ERC20(address: ["0x4d7b88403aa2f502bf289584160db01ca442426c"]) { - address - symbol - decimals - totalSupply - balance: market_cap - } - Tokens: ERC20(address: $iotexTokens) { - address - symbol - decimals - totalSupply - balance: market_cap - } - TokenSafe: ERC20( - address: ["0xa00744882684c3e4747faefd68d283ea44099d03"] - ) { - address - symbol - decimals - balance: balanceUSD(account: "0xc4a29a94f12be03033daa4e6ce9b9678c26275a2") - } - } - ethereum: ETH { - chainId - CYC: ERC20(address: ["0x8861cfF2366C1128fd699B68304aD99a0764Ef9a"]) { - address - symbol - decimals - totalSupply - balance: market_cap - } - TokenSafe: ERC20(address: $ethTokens) { - address - symbol - decimals - balance: balanceUSD(account: "0xc2e0f31d739cb3153ba5760a203b3bd7c27f0d7a") - } - } - bsc: BSC { - chainId - CIOTX: ERC20(address: ["0x2aaF50869739e317AB80A57Bf87cAA35F5b60598"]) { - address - symbol - decimals - totalSupply - balance: market_cap - } - CYC: ERC20(address: ["0x810ee35443639348adbbc467b33310d2ab43c168"]) { - address - symbol - decimals - totalSupply - balance: market_cap - } - TokenSafe: ERC20(address: $bscTokens) { - address - symbol - decimals - balance: balanceUSD(account: "0xfbe9a4138afdf1fa639a8c2818a0c4513fc4ce4b") - } - } - polygon: Polygon { - chainId - CIOTX: ERC20(address: ["0x300211Def2a644b036A9bdd3e58159bb2074d388"]) { - address - symbol - decimals - totalSupply - balance: market_cap - } - CYC: ERC20(address: ["0xcFb54a6D2dA14ABeCD231174FC5735B4436965D8"]) { - address - symbol - decimals - totalSupply - balance: market_cap - - } - TokenSafe: ERC20(address: $polygonTokens) { - address - symbol - decimals - balance: balanceUSD(account: "0xa239f03cda98a7d2aaaa51e7bf408e5d73399e45") - } - } - } -`; - -const variables = { - iotexTokens: [ - "0x0258866edaf84d6081df17660357ab20a07d0c80", - "0xc7b93720f73b037394ce00f954f849ed484a3dea", - "0xacee9b11cd4b3f57e58880277ac72c8c41abe4e4", - "0xedeefaca6a1581fe2349cdfc3083d4efa8188e55", - "0x2a6003e4b618ff3457a4a2080d028b0249b51c80", - "0x6fbCdc1169B5130C59E72E51Ed68A84841C98cd1", - "0x3B2bf2b523f54C4E454F08Aa286D03115aFF326c", - "0x1CbAd85Aa66Ff3C12dc84C5881886EEB29C1bb9b", - "0x97e6c48867fdc391a8dfe9d169ecd005d1d90283", - "0x84abcb2832be606341a50128aeb1db43aa017449", - "0x42C9255D5e522e83B16ea11a3BA04c2D3AfCA079", - "0x037346E5a5722957Ac2cAb6ceb8c74fC18Cea91D", - "0x0bDF82F276309E2efd4947Ee8E0A248b2726E8Df", - "0x8e66c0d6b70c0b23d39f4b21a1eac52bba8ed89a", - "0x653656f84381e8a359a268f3002621bbb14c62f8", - "0x7f0ad63c902c67b1fa1b1102b0daffb889f5d5cb", - "0x62a9d987cbf4c45a550deed5b57b200d7a319632", - "0x3cdb7c48e70b854ed2fa392e21687501d84b3afc", - "0xc04da3a99d17135857bb937d2fbb321d3b6c6a81", - "0x295ebb8c782e186bcb70d9a8124053043d1adf5c", - "0xe46ba98a87dca989725e9a2389975c0bbbb8f985", - "0xaadc74127109d944e36cbd70f71fc5f0c921fc6c", - "0x0499a3ec965136bea01e4350113a2105724785dc", - "0x28873cEA8c26F603b15937f9985A888C5DA5Fd90", - "0xc1B58620aD839383c662BFe80dB4514344DeC6d7", - ], - ethTokens: [ - "0x6fb3e0a217407efff7ca062d46c26e5d60a14d69", - "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", - "0x6fb3e0a217407efff7ca062d46c26e5d60a14d69", - "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599", - "0x8861cfF2366C1128fd699B68304aD99a0764Ef9a", - "0x4Fabb145d64652a948d72533023f6E7A623C7C53", - "0x1f9840a85d5af5bf1d1762f925bdaddc4201f984", - "0x45804880de22913dafe09f4980848ece6ecbaf78", - "0xdAC17F958D2ee523a2206206994597C13D831ec7", - "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", - "0x6b175474e89094c44da98b954eedeac495271d0f", - "0xD227c3e4f3F8dE94180269eF9DC221a6efc1F4C4", - "0xf79deaBc1406a3AD07c70877fBaEb90777B77E68", - ], - bscTokens: [ - "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c", - "0xe9e7cea3dedca5984780bafc599bd69add087d56", - "0x810ee35443639348adbbc467b33310d2ab43c168", - "0x2aaF50869739e317AB80A57Bf87cAA35F5b60598", - "0x55d398326f99059ff775485246999027b3197955", - "0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d", - "0x7e544f2fEDDc69b1cB12555779c824CFe100ee34", - "0x049Dd7532148826CdE956c7B45fec8c30b514052", - "0x049Dd7532148826CdE956c7B45fec8c30b514052", - "0xab951271F025D93c278516e3d131e017e8a3089D", - ], - polygonTokens: [ - "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270", - "0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619", - "0x1BFD67037B42Cf73acF2047067bd4F2C47D9BfD6", - "0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063", - "0xc2132D05D31c914a87C6611C10748AEb04B58e8F", - "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174", - "0x0b3F868E0BE5597D5DB7fEB59E1CADBb0fdDa50a", - "0x831753DD7087CaC61aB5644b308642cc1c33Dc13", - "0xD6DF932A45C0f255f85145f286eA0b292B21C90B", - "0xcFb54a6D2dA14ABeCD231174FC5735B4436965D8", - "0x300211Def2a644b036A9bdd3e58159bb2074d388", - ], -}; -let cache = null; - -const loadTvl = async () => { - const result = cache - ? cache - : await request(apiURL, query, variables).then( - (res) => { - Object.entries(res).forEach(([k, v]) => { - res[k] = [ - ...(v.CIOTX?.filter((i) => i.balance > 0).map((i) => - Number(i.balance) - ) || []), - ...(v.Tokens?.filter((i) => i.balance > 0).map((i) => - Number(i.balance) - ) || []), - ...(v.CYC?.filter((i) => i.balance > 0).map((i) => - Number(i.balance) - ) || []), - ...(v.TokenSafe?.filter((i) => i.balance > 0).map((i) => - Number(i.balance) - ) || []), - ].reduce((acc, i) => acc + i, 0) - if (!cache) cache = {}; - cache[res] = res[k]; - }); - return res; - } - ); - return result; -}; - -const allChains = ["iotex", "ethereum", "bsc", "polygon"].reduce((p, c) => { - p[c] = { - fetch: async () => { - const tvl = await loadTvl(); - return tvl[c]; - }, - }; - return p; -}, {}); +const config = { + ethereum: { tokenSafe: '0xc2e0f31d739cb3153ba5760a203b3bd7c27f0d7a', tokenList: '0x7c0bef36e1b1cbeb1f1a5541300786a7b608aede', }, + iotex: { tokenSafe: '0xc4a29a94f12be03033daa4e6ce9b9678c26275a2', tokenList: '0x59caeb8dc448df0e070b803062cfd9351ad39390', }, + bsc: { tokenSafe: '0xFBe9A4138AFDF1fA639a8c2818a0C4513fc4CE4B', tokenList: '0x0d793F4D4287265B9bdA86b7a4083193E8743b34', }, + polygon: { tokenSafe: '0xA239F03Cda98A7d2AaAA51e7bF408e5d73399e45', tokenList: '0xDe9395d2f4940aA501f9a27B98592589D14Bb0f7', }, +} module.exports = { - ...allChains, - fetch: async () => { - const tvl = await loadTvl(); - return Object.values(tvl).reduce((acc, i) => acc + i, 0) - }, - hallmarks:[ + hallmarks: [ [1651881600, "UST depeg"], ], }; + +Object.keys(config).forEach(chain => { + const { tokenList, tokenSafe, } = config[chain] + module.exports[chain] = { + tvl: async (_0, _b, _cb, { api, }) => { + const [_, tokens] = await api.call({ abi: 'function getActiveItems(uint256 offset, uint8 limit) view returns (uint256 count, address[] items)', target: tokenList, params: [0, 99] }) + return sumTokens2({ api, tokens, owner: tokenSafe }) + } + } +}) + diff --git a/projects/ip/index.js b/projects/ip/index.js index 6cd82aae90e..2921426354e 100644 --- a/projects/ip/index.js +++ b/projects/ip/index.js @@ -1,161 +1,73 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk'); +const { sumTokens2 } = require('../helper/unwrapLPs') const {lendingMarket} = require('../helper/methodologies') const VaultController = "0x4aaE9823Fb4C70490F1d802fC697F3ffF8D5CbE3" -const vaultSummaryAbi = { - "inputs": - [ - { - "internalType": "uint96", - "name": "start", - "type": "uint96" - }, - { - "internalType": "uint96", - "name": "stop", - "type": "uint96" - } - ], - "name": "vaultSummaries", - "outputs": - [ - { - "components": - [ - { - "internalType": "uint96", - "name": "id", - "type": "uint96" - }, - { - "internalType": "uint192", - "name": "borrowingPower", - "type": "uint192" - }, - { - "internalType": "uint192", - "name": "vaultLiability", - "type": "uint192" - }, - { - "internalType": "address[]", - "name": "tokenAddresses", - "type": "address[]" - }, - { - "internalType": "uint256[]", - "name": "tokenBalances", - "type": "uint256[]" - } - ], - "internalType": "struct IVaultController.VaultSummary[]", - "name": "", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" -} +const vaultSummaryAbi = 'function vaultSummaries(uint96 start, uint96 stop) view returns (tuple(uint96 id, uint192 borrowingPower, uint192 vaultLiability, address[] tokenAddresses, uint256[] tokenBalances)[])' -const tokens = { - "WETH": { - address: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', - symbol: 'WETH', - decimals: 18, +const cappedTokens = { + "0x5aC39Ed42e14Cf330A864d7D1B82690B4D1B9E61": { + address: ADDRESSES.ethereum.MATIC, + symbol: 'MATIC', }, - "USDC": { - address: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', - symbol: 'USDC', - decimals: 6, + "0xfb42f5AFb722d2b01548F77C31AC05bf80e03381": { + address: '0xc18360217d8f7ab5e7c516566761ea12ce7f9d72', + symbol: 'ENS', }, - "WTC":{ - address: '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599', - symbol: 'WBTC', - decimals: 8, + "0x05498574BD0Fa99eeCB01e1241661E7eE58F8a85": { + address: '0xba100000625a3754423978a60c9317c58a424e3d', + symbol: 'BAL', }, - "UNI":{ - address: '0x1f9840a85d5af5bf1d1762f925bdaddc4201f984', - symbol: 'UNI', - decimals: 18, + "0xd3bd7a8777c042De830965de1C1BCC9784135DD2": { + address: ADDRESSES.ethereum.AAVE, + symbol: 'AAVE', }, - "USDI":{ - address: "0x2A54bA2964C8Cd459Dc568853F79813a60761B58", - symbol: 'USDI', - decimals: 18, + "0x7C1Caa71943Ef43e9b203B02678000755a4eCdE9": { + address: ADDRESSES.ethereum.LIDO, + symbol: 'LDO', + }, + "0xDDB3BCFe0304C970E263bf1366db8ed4DE0e357a": { + address: '0x92d6c1e31e14520e676a687f0a93788b716beff5', + symbol: 'DYDX', + }, + "0x9d878eC06F628e883D2F9F1D793adbcfd52822A8": { + address: ADDRESSES.ethereum.CRV, + symbol: 'CRV', + }, + "0x64eA012919FD9e53bDcCDc0Fc89201F484731f41": { + address: ADDRESSES.ethereum.RETH, + symbol: 'rETH', + }, + "0x99bd1f28a5A7feCbE39a53463a916794Be798FC3": { + address: '0xBe9895146f7AF43049ca1c1AE358B0541Ea49704', + symbol: 'cbETH', }, } -const getVaultCount = async (block) => { - return (await sdk.api.abi.call({ - block, - target: VaultController, - params: [], - abi: {name:"vaultsMinted", type:"function",stateMutability:"view",outputs:[{internalType:"uint96",type:"uint96"}]}, - })).output; -} - -const getVaults = async (block) => { - return getVaultCount() - .then(async (c)=>{ - return (await sdk.api.abi.call({ - block, - target: VaultController, - params: [1,c], - abi: vaultSummaryAbi, - })).output; - }) -} - -const getReserve = async (block) =>{ - return (await sdk.api.abi.call({ - block, - target: tokens.USDC.address, - params: [tokens.USDI.address], - abi: "erc20:balanceOf", - })).output; -} - -const collateral = async (timestamp, block)=>{ +async function tvl(_, _b, _cb, { api, }) { const balances = {} - const vaults = await getVaults() - vaults.forEach(x=>{ - x.tokenAddresses.forEach((token, i)=>{ - sdk.util.sumSingleBalance(balances, token, x.tokenBalances[i]) + const count = await api.call({ abi: " function vaultsMinted() view returns (uint96)", target: VaultController }) + const vaults = await api.call({ abi: vaultSummaryAbi, target: VaultController, params: [1, count]}) + vaults.map(vault => { + vault.tokenAddresses.map((token, i) => { + token = cappedTokens[token]?.address || token + sdk.util.sumSingleBalance(balances,token,vault.tokenBalances[i]) }) }) - return balances -} -const borrowed = async (timestamp, block) => { - const balances = {} - const vaults = await getVaults() - vaults.forEach(x=>{ - sdk.util.sumSingleBalance(balances, tokens.USDI.address, x.vaultLiability) - }) - return balances -} - - -const tvl = async (timestamp, block) => { - const coll = await collateral(timestamp, block) - const reserve = await getReserve(block) - const balances = { - [tokens.USDC.address]: reserve, - ...coll - } - return balances + return sumTokens2({ api, balances, owner: '0x2A54bA2964C8Cd459Dc568853F79813a60761B58', tokens: [ADDRESSES.ethereum.USDC]}) } module.exports = { - timetravel: true, start: 14962974, ethereum: { tvl, - borrowed }, methodology: `${lendingMarket}. For Interest Protocol, TVL is Reserve + Total Collateral Value Reserve is found through calling USDC.getBalances(USDI) Balances are found through VaultController.vaultSummaries(1,VaultController.vaultsMinted()) + Capped tokens converted 1:1 to underlying ` }; diff --git a/projects/ipor/abi.js b/projects/ipor/abi.js index c789b4e9b50..4a46808e427 100644 --- a/projects/ipor/abi.js +++ b/projects/ipor/abi.js @@ -1,18 +1,6 @@ module.exports = { abi: { - getAccruedBalance: { - inputs: [], - name: "getAccruedBalance", - outputs: [ - {internalType: "uint256", name: "totalCollateralPayFixed", type: "uint256"}, - {internalType: "uint256", name: "totalCollateralReceiveFixed", type: "uint256"}, - {internalType: "uint256", name: "liquidityPool", type: "uint256"}, - {internalType: "uint256", name: "vault", type: "uint256"}, - ], - payable: false, - stateMutability: "view", - type: "function", - }, - getAsset: {"inputs":[],"name":"getAsset","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"} - }, + getAccruedBalance: "function getAccruedBalance() view returns (uint256 totalCollateralPayFixed, uint256 totalCollateralReceiveFixed, uint256 liquidityPool, uint256 vault)", + getAsset: "address:getAsset", + } }; diff --git a/projects/ironbank/cerc20.json b/projects/ironbank/cerc20.json index 539e90ab68f..a374cd8db91 100644 --- a/projects/ironbank/cerc20.json +++ b/projects/ironbank/cerc20.json @@ -1,62 +1,6 @@ { - "getCash": { - "constant": true, - "inputs": [], - "name": "getCash", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "underlying": { - "constant": true, - "inputs": [], - "name": "underlying", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "totalBorrows": { - "constant": true, - "inputs": [], - "name": "totalBorrows", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "totalReserves": { - "constant": true, - "inputs": [], - "name": "totalReserves", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } + "getCash": "uint256:getCash", + "underlying": "address:underlying", + "totalBorrows": "uint256:totalBorrows", + "totalReserves": "uint256:totalReserves" } \ No newline at end of file diff --git a/projects/ironfinance/abi-polygon.json b/projects/ironfinance/abi-polygon.json index 27fd55d0dd3..8058482812a 100644 --- a/projects/ironfinance/abi-polygon.json +++ b/projects/ironfinance/abi-polygon.json @@ -1,98 +1,16 @@ { "IronSwap": { - "getTokenBalances": { - "inputs": [], - "name": "getTokenBalances", - "outputs": [ - { - "internalType": "uint256[]", - "name": "", - "type": "uint256[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getTokens": { - "inputs": [], - "name": "getTokens", - "outputs": [ - { - "internalType": "contract IERC20[]", - "name": "", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - } + "getTokenBalances": "uint256[]:getTokenBalances", + "getTokens": "address[]:getTokens" }, "IronController": { - "getAllMarkets": { - "constant": true, - "inputs": [], - "name": "getAllMarkets", - "outputs": [ - { - "internalType": "contract RToken[]", - "name": "", - "type": "address[]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } + "getAllMarkets": "address[]:getAllMarkets" }, "rToken": { - "getCash": { - "constant": true, - "inputs": [], - "name": "getCash", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - - "underlying": { - "constant": true, - "inputs": [], - "name": "underlying", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - - "symbol": { - "constant": true, - "inputs": [], - "name": "symbol", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } + "getCash": "uint256:getCash", + "underlying": "address:underlying", + "symbol": "string:symbol" } } diff --git a/projects/ironfinance/index.js b/projects/ironfinance/index.js index 8a3f758160a..85508e9c281 100644 --- a/projects/ironfinance/index.js +++ b/projects/ironfinance/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk'); const abiPolygon = require('./abi-polygon.json'); const { transformAddress } = require('./utils'); @@ -15,7 +16,7 @@ const Contracts = { lend: { ironController: '0xF20fcd005AFDd3AD48C85d0222210fe168DDd10c', }, - wrappedNative: '0x0000000000000000000000000000000000001010', + wrappedNative: ADDRESSES.polygon.WMATIC_1, }, avax: { pools: { @@ -29,7 +30,7 @@ const Contracts = { lend: { ironController: '0xDc4C597E36Fc80876801df0309Cc11A7C12E0764', }, - wrappedNative: '0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83', + wrappedNative: ADDRESSES.fantom.WFTM, }, }; @@ -68,7 +69,7 @@ const poolTvl = async (chain, poolAddress, block, addressTransformer) => { const polygonTvl = async (timestamp, ethBlock, chainBlocks) => { let block = chainBlocks['polygon']; - const addressTransformer = await transformAddress('polygon'); + const addressTransformer = transformAddress('polygon'); const tvl = {}; for (let address of Object.values(Contracts.polygon.pools)) { @@ -89,7 +90,7 @@ const polygonTvl = async (timestamp, ethBlock, chainBlocks) => { const avaxTvl = async (timestamp, ethBlock, chainBlocks) => { let tvl = {}; - const addressTransformer = await transformAddress('avax'); + const addressTransformer = transformAddress('avax'); for (let address of Object.values(Contracts.avax.pools)) { const balances = await poolTvl( 'avax', @@ -107,7 +108,7 @@ const avaxTvl = async (timestamp, ethBlock, chainBlocks) => { }; const fantomTvl = async (timestamp, ethBlock, chainBlocks) => { - const addressTransformer = await transformAddress('fantom'); + const addressTransformer = transformAddress('fantom'); const block = chainBlocks['fantom']; let tvl = {}; diff --git a/projects/ironfinance/utils.js b/projects/ironfinance/utils.js index 6fac3d20565..4ff2ae2d745 100644 --- a/projects/ironfinance/utils.js +++ b/projects/ironfinance/utils.js @@ -1,13 +1,11 @@ -const { transformFantomAddress, transformAvaxAddress, transformPolygonAddress } = require("../helper/portedTokens"); - const transformAddress = (chain, address) => { switch (chain) { case 'polygon': - return Promise.resolve(address => `polygon:${address}`) + return addr => 'polygon:'+addr case 'fantom': - return transformFantomAddress() + return addr => 'fantom:'+addr case 'avax': - return transformAvaxAddress() + return addr => 'avax:'+addr default: throw 'Unsupported chain' } diff --git a/projects/izumi-iziswap/abi.js b/projects/izumi-iziswap/abi.js index ae6225207e2..85b7159ba48 100644 --- a/projects/izumi-iziswap/abi.js +++ b/projects/izumi-iziswap/abi.js @@ -1,127 +1,6 @@ module.exports = { - liquidities: { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "liquidities", - "outputs": [ - { - "internalType": "int24", - "name": "leftPt", - "type": "int24" - }, - { - "internalType": "int24", - "name": "rightPt", - "type": "int24" - }, - { - "internalType": "uint128", - "name": "liquidity", - "type": "uint128" - }, - { - "internalType": "uint256", - "name": "lastFeeScaleX_128", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastFeeScaleY_128", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "remainTokenX", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "remainTokenY", - "type": "uint256" - }, - { - "internalType": "uint128", - "name": "poolId", - "type": "uint128" - } - ], - "stateMutability": "view", - "type": "function" - }, - liquidityNum: { - "inputs": [], - "name": "liquidityNum", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - pool: { - "inputs": [ - { - "internalType": "address", - "name": "tokenX", - "type": "address" - }, - { - "internalType": "address", - "name": "tokenY", - "type": "address" - }, - { - "internalType": "uint24", - "name": "fee", - "type": "uint24" - } - ], - "name": "pool", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - poolMetas: { - "inputs": [ - { - "internalType": "uint128", - "name": "", - "type": "uint128" - } - ], - "name": "poolMetas", - "outputs": [ - { - "internalType": "address", - "name": "tokenX", - "type": "address" - }, - { - "internalType": "address", - "name": "tokenY", - "type": "address" - }, - { - "internalType": "uint24", - "name": "fee", - "type": "uint24" - } - ], - "stateMutability": "view", - "type": "function" - }, + liquidities: "function liquidities(uint256) view returns (int24 leftPt, int24 rightPt, uint128 liquidity, uint256 lastFeeScaleX_128, uint256 lastFeeScaleY_128, uint256 remainTokenX, uint256 remainTokenY, uint128 poolId)", + liquidityNum: "uint256:liquidityNum", + pool: "function pool(address tokenX, address tokenY, uint24 fee) view returns (address)", + poolMetas: "function poolMetas(uint128) view returns (address tokenX, address tokenY, uint24 fee)", } \ No newline at end of file diff --git a/projects/izumi-iziswap/index.js b/projects/izumi-iziswap/index.js index 3da948959e4..538de53bfd7 100644 --- a/projects/izumi-iziswap/index.js +++ b/projects/izumi-iziswap/index.js @@ -1,53 +1,81 @@ +const ADDRESSES = require('../helper/coreAssets.json') let abi = require('./abi') const { sumTokens2, } = require('../helper/unwrapLPs') -const sdk = require('@defillama/sdk') -const nullAddress = '0x0000000000000000000000000000000000000000' -const poolHelper = '0x93C22Fbeff4448F2fb6e432579b0638838Ff9581' - -module.exports = { - bsc: { - tvl: async (ts, _b, { bsc: block }) => { - const chain = 'bsc' - const toa = [] - let i = 1 - let foundLastPool = false - const chunkSize = 10 - const poolMetaData = [] - - do { - const calls = [] - for (let j = i; j < i + chunkSize; j++) - calls.push({ params: j }) - i += chunkSize - const { output: poolMetas } = await sdk.api.abi.multiCall({ - target: poolHelper, - abi: abi.poolMetas, - calls, - chain, block, - }) - for (const { output } of poolMetas) { - if (output.tokenX === nullAddress && output.fee === '0') { - foundLastPool = true - break; - } - poolMetaData.push(output) - } - } while (!foundLastPool) - - const poolCalls = poolMetaData.map(i => ({ params: [i.tokenX, i.tokenY, i.fee] })) - const { output: pools } = await sdk.api.abi.multiCall({ - target: poolHelper, - abi: abi.pool, - calls: poolCalls, - chain, block, +const nullAddress = ADDRESSES.null +const poolHelpers = { + 'bsc': ['0x93C22Fbeff4448F2fb6e432579b0638838Ff9581', + '0xBF55ef05412f1528DbD96ED9E7181f87d8C9F453'], + 'arbitrum': ['0xAD1F11FBB288Cd13819cCB9397E59FAAB4Cdc16F'], + 'era': ['0x936c9A1B8f88BFDbd5066ad08e5d773BC82EB15F', + '0x483FDE31bcE3DCc168E23a870831b50Ce2cCd1F1'], + 'meter': ['0x07aBf894D5C25E626bb30f75eFC728a1d86BEeDC'], + 'aurora': ['0x61A41182CD6e94f2A026aE3c0D1b73B1AA579aEa', + '0xE78e7447223aaED59301b44513D1d3A892ECF212'], + // 'ethereumclassic': '0x1D377311b342633A970e71a787C50F83858BFC1B', + 'cronos': ['0x33531bDBFE34fa6Fd5963D0423f7699775AacaaF'], + 'polygon': ['0x33531bDBFE34fa6Fd5963D0423f7699775AacaaF'], + // 'conflux': '0x1502d025BfA624469892289D45C0352997251728', + 'mantle': ['0x611575eE1fbd4F7915D0eABCC518eD396fF78F0c'], + 'ethereum': ['0x19b683A2F45012318d9B2aE1280d68d3eC54D663'], + 'ontology_evm': ['0x110dE362cc436D7f54210f96b8C7652C2617887D'], + 'ultron' : ['0xcA7e21764CD8f7c1Ec40e651E25Da68AeD096037'], + 'linea': ['0x1CB60033F61e4fc171c963f0d2d3F63Ece24319c'], +} + +const blacklistedTokens = [ + ADDRESSES.bsc.iUSD, + '0x1382628e018010035999A1FF330447a0751aa84f', +] + +const tvl = async (_, _1, _2, { api }) => { + const chain = api.chain + const toa = [] + const chunkSize = 10 + const bTokens = [...blacklistedTokens] + const allPools = [] + const allPoolMetas = [] + + for(const manager of poolHelpers[chain]) { + let i = 1 + let foundLastPool = false + const poolMetaData = [] + do { + const calls = [] + for (let j = i; j < i + chunkSize; j++) + calls.push(j) + i += chunkSize + const poolMetas = await api.multiCall({ + target: manager, + abi: abi.poolMetas, + calls, }) + for (const output of poolMetas) { + if (output.tokenX === nullAddress && output.fee === '0') { + foundLastPool = true + break; + } + poolMetaData.push(output) + } + } while (!foundLastPool) + + const poolCalls = poolMetaData.map(i => ({ params: [i.tokenX, i.tokenY, i.fee] })) + const pools = await api.multiCall({ + target: manager, + abi: abi.pool, + calls: poolCalls, + }) - pools.forEach(({ output }, i) => toa.push([poolMetaData[i].tokenX, output], [poolMetaData[i].tokenY, output],)) + allPools.push(...pools) + allPoolMetas.push(...poolMetaData) + } - return sumTokens2({ tokensAndOwners: toa, chain, block }) - } - }, - ownTokens: ['IZI', 'IUSD'], + allPools.forEach((output, i) => toa.push([allPoolMetas[i].tokenX, output], [allPoolMetas[i].tokenY, output],)) + // if (chain === 'era') bTokens.push(ADDRESSES.arbitrum.WETH) + return sumTokens2({ tokensAndOwners: toa, api, blacklistedTokens: bTokens, permitFailure: true}) } + +Object.keys(poolHelpers).forEach(chain => { + module.exports[chain] = { tvl } +}) \ No newline at end of file diff --git a/projects/izumi/abi.json b/projects/izumi/abi.json index d9a0406e788..b5586ef4e35 100644 --- a/projects/izumi/abi.json +++ b/projects/izumi/abi.json @@ -1,342 +1,11 @@ { - "factory": { - "inputs": [], - "name": "factory", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "tokenOfOwnerByIndex":{ - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "uint256", - "name": "index", - "type": "uint256" - } - ], - "name": "tokenOfOwnerByIndex", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "liquidities": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "liquidities", - "outputs": [ - { - "internalType": "int24", - "name": "leftPt", - "type": "int24" - }, - { - "internalType": "int24", - "name": "rightPt", - "type": "int24" - }, - { - "internalType": "uint128", - "name": "liquidity", - "type": "uint128" - }, - { - "internalType": "uint256", - "name": "lastFeeScaleX_128", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastFeeScaleY_128", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "remainTokenX", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "remainTokenY", - "type": "uint256" - }, - { - "internalType": "uint128", - "name": "poolId", - "type": "uint128" - } - ], - "stateMutability": "view", - "type": "function" - }, - "pool": { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "uint24", - "name": "", - "type": "uint24" - } - ], - "name": "pool", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "state": { - "inputs": [], - "name": "state", - "outputs": [ - { - "internalType": "uint160", - "name": "sqrtPrice_96", - "type": "uint160" - }, - { - "internalType": "int24", - "name": "currentPoint", - "type": "int24" - }, - { - "internalType": "uint16", - "name": "observationCurrentIndex", - "type": "uint16" - }, - { - "internalType": "uint16", - "name": "observationQueueLen", - "type": "uint16" - }, - { - "internalType": "uint16", - "name": "observationNextQueueLen", - "type": "uint16" - }, - { - "internalType": "bool", - "name": "locked", - "type": "bool" - }, - { - "internalType": "uint128", - "name": "liquidity", - "type": "uint128" - }, - { - "internalType": "uint128", - "name": "liquidityX", - "type": "uint128" - } - ], - "stateMutability": "view", - "type": "function" - }, - "poolMetas": { - "inputs": [{ "internalType": "uint128", "name": "", "type": "uint128" }], - "name": "poolMetas", - "outputs": [ - { "internalType": "address", "name": "tokenX", "type": "address" }, - { "internalType": "address", "name": "tokenY", "type": "address" }, - { "internalType": "uint24", "name": "fee", "type": "uint24" } - ], - "stateMutability": "view", - "type": "function" - }, - "fixRangeMiningInfo":{ - "inputs": [], - "name": "getMiningContractInfo", - "outputs": [ - { - "internalType": "address", - "name": "tokenX_", - "type": "address" - }, - { - "internalType": "address", - "name": "tokenY_", - "type": "address" - }, - { - "internalType": "uint24", - "name": "fee_", - "type": "uint24" - }, - { - "components": [ - { - "internalType": "address", - "name": "rewardToken", - "type": "address" - }, - { - "internalType": "address", - "name": "provider", - "type": "address" - }, - { - "internalType": "uint256", - "name": "accRewardPerShare", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "rewardPerBlock", - "type": "uint256" - } - ], - "internalType": "struct Base.RewardInfo[]", - "name": "rewardInfos_", - "type": "tuple[]" - }, - { - "internalType": "address", - "name": "iziTokenAddr_", - "type": "address" - }, - { - "internalType": "int24", - "name": "rewardUpperTick_", - "type": "int24" - }, - { - "internalType": "int24", - "name": "rewardLowerTick_", - "type": "int24" - }, - { - "internalType": "uint256", - "name": "lastTouchBlock_", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalVLiquidity_", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "startBlock_", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "endBlock_", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "totalNIZI":{ - "inputs": [], - "name": "totalNIZI", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "DynamicRangeMiningInfo":{ - "inputs": [], - "name": "getMiningContractInfo", - "outputs": [ - { - "internalType": "address", - "name": "tokenX_", - "type": "address" - }, - { - "internalType": "address", - "name": "tokenY_", - "type": "address" - }, - { - "internalType": "uint24", - "name": "fee_", - "type": "uint24" - }, - { - "internalType": "address", - "name": "iziTokenAddr_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "lastTouchBlock_", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalVLiquidity_", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalTokenX_", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalTokenY_", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalNIZI_", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "startBlock_", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "endBlock_", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } + "factory": "address:factory", + "tokenOfOwnerByIndex": "function tokenOfOwnerByIndex(address owner, uint256 index) view returns (uint256)", + "liquidities": "function liquidities(uint256) view returns (int24 leftPt, int24 rightPt, uint128 liquidity, uint256 lastFeeScaleX_128, uint256 lastFeeScaleY_128, uint256 remainTokenX, uint256 remainTokenY, uint128 poolId)", + "pool": "function pool(address, address, uint24) view returns (address)", + "state": "function state() view returns (uint160 sqrtPrice_96, int24 currentPoint, uint16 observationCurrentIndex, uint16 observationQueueLen, uint16 observationNextQueueLen, bool locked, uint128 liquidity, uint128 liquidityX)", + "poolMetas": "function poolMetas(uint128) view returns (address tokenX, address tokenY, uint24 fee)", + "fixRangeMiningInfo": "function getMiningContractInfo() view returns (address tokenX_, address tokenY_, uint24 fee_, tuple(address rewardToken, address provider, uint256 accRewardPerShare, uint256 rewardPerBlock)[] rewardInfos_, address iziTokenAddr_, int24 rewardUpperTick_, int24 rewardLowerTick_, uint256 lastTouchBlock_, uint256 totalVLiquidity_, uint256 startBlock_, uint256 endBlock_)", + "totalNIZI": "uint256:totalNIZI", + "DynamicRangeMiningInfo": "function getMiningContractInfo() view returns (address tokenX_, address tokenY_, uint24 fee_, address iziTokenAddr_, uint256 lastTouchBlock_, uint256 totalVLiquidity_, uint256 totalTokenX_, uint256 totalTokenY_, uint256 totalNIZI_, uint256 startBlock_, uint256 endBlock_)" } \ No newline at end of file diff --git a/projects/izumi/api.js b/projects/izumi/api.js new file mode 100644 index 00000000000..d58b9aa2d9e --- /dev/null +++ b/projects/izumi/api.js @@ -0,0 +1,37 @@ +const { unwrapNFTs } = require('./utils') +const { getConfig: getConfigCache } = require('../helper/cache') + +async function getConfig(chainId) { + const data = await getConfigCache('izumi-liquidbox/'+chainId, `https://izumi.finance/api/v1/farm/compute?chainId=${chainId}`); + return data.data; +} + +const chains = { + 'ethereum': 1, + 'bsc': 56, + 'polygon': 137, + 'arbitrum': 42161, + 'aurora': 1313161554, + 'cronos': 25, +}; + +module.exports = { + // ownTokens: ['IZI', 'IUSD'], +} + +Object.keys(chains).forEach(chain => { + module.exports[chain] = { + tvl: getTvl(chain, false), + pool2: getTvl(chain, true), + } +}) + +function getTvl(chain, isPool2) { + return async (_, _b, { [chain]: block }) => { + const config = await getConfig(chains[chain]); + var contracts + if (isPool2){contracts = config.contracts[chain].pool2} + else {contracts = config.contracts[chain].pools} + return unwrapNFTs({ chain, block, nftAddress: config.liquidityManagers[chain], config: contracts, fixTokens: config.fixTokens[chain] }) + } +} \ No newline at end of file diff --git a/projects/izumi/index.js b/projects/izumi/index.js index 9f26c9e7149..70ce6ab03e8 100644 --- a/projects/izumi/index.js +++ b/projects/izumi/index.js @@ -1,40 +1,12 @@ const { staking } = require('../helper/staking') -const { unwrapNFTs } = require('./utils') -const { get } = require('../helper/http'); - -async function getConfig(chainId) { - const data = await get(`https://izumi.finance/api/v1/farm/compute?chainId=${chainId}`); - return data.data; -} - -const chains = { - 'ethereum': 1, - 'bsc': 56, - 'polygon': 137, - 'arbitrum': 42161, - 'aurora': 1313161554, - 'cronos': 25, -}; +const { getExports } = require('../helper/heroku-api') +const indexExports = require('./api') +const chainKeys = Object.keys(indexExports).filter(chain => typeof indexExports[chain] === 'object' && indexExports[chain].tvl) module.exports = { - ownTokens: ['IZI', 'IUSD'], -} - -Object.keys(chains).forEach(chain => { - module.exports[chain] = { - tvl: getTvl(chain, false), - pool2: getTvl(chain, true), - } -}) - -function getTvl(chain, isPool2) { - return async (_, _b, { [chain]: block }) => { - const config = await getConfig(chains[chain]); - var contracts - if (isPool2){contracts = config.contracts[chain].pool2} - else {contracts = config.contracts[chain].pools} - return unwrapNFTs({ chain, block, nftAddress: config.liquidityManagers[chain], config: contracts, fixTokens: config.fixTokens[chain] }) - } + timetravel: false, + misrepresentedTokens: true, + ...getExports("izumi", chainKeys, ['pool2']), } module.exports.ethereum.staking = staking('0xb56a454d8dac2ad4cb82337887717a2a427fcd00', '0x9ad37205d608b8b219e6a2573f922094cec5c200') diff --git a/projects/izumi/utils.js b/projects/izumi/utils.js index 99f504cc51f..786fb7d6dfb 100644 --- a/projects/izumi/utils.js +++ b/projects/izumi/utils.js @@ -3,7 +3,8 @@ const { unwrapUniswapV3NFTs } = require('../helper/unwrapLPs') const sdk = require("@defillama/sdk"); const abi = require('./abi.json'); const BigNumber = require('bignumber.js'); -const { get } = require('../helper/http') +const { get } = require('../helper/http'); +const { nullAddress } = require('../helper/tokenMapping'); function point2PoolPriceUndecimalSqrt(point) { return (1.0001 ** point) ** 0.5; @@ -155,6 +156,7 @@ async function unwrapiZiswapFixNFT({ balances, owner, nftAddress, block, chain = const poolInfo = (await sdk.api.abi.call({ target: factory, abi: abi.pool, block, chain, params: [miningInfo.tokenX_, miningInfo.tokenY_, miningInfo.fee_] })).output + if (poolInfo == nullAddress) return balances const state = (await sdk.api.abi.call({ target: poolInfo, abi: abi.state, block, chain })).output let params = { @@ -216,7 +218,7 @@ async function unwrapNFTs({ balances = {}, nftsAndOwners = [], block, chain = 'b if (iZiContracts) await unwrapiZiswapV3NFTs({ balances, chain, block, nftAddress, owners: iZiContracts, }) if (uniContracts) await unwrapUniswapV3NFTs({ balances, chain, block, owners: uniContracts, }) // to fix balances of token addresses which are not on CoinGecko - await checkAndFixToken(balances, chain, fixTokens) + // await checkAndFixToken(balances, chain, fixTokens) return balances } diff --git a/projects/jade-protocol/index.js b/projects/jade-protocol/index.js index 0245a7ec546..c7f4aa625a6 100644 --- a/projects/jade-protocol/index.js +++ b/projects/jade-protocol/index.js @@ -1,11 +1,3 @@ -const { ohmTvl } = require('../helper/ohm') - -const treasury = "0x2841c20F1f4C814b1f212d9198d258D5db98eF7d" -module.exports = ohmTvl(treasury, [ - //WBNB - ["0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c", false], - //BUSD - ["0xe9e7cea3dedca5984780bafc599bd69add087d56", false], - //PancakeLP - ["0x46503d91d7a41fcbdc250e84cee9d457d082d7b4", true], - ], "bsc", "0x097d72e1D9bbb8d0263477f9b20bEBF66f243AF4", "0x7ad7242A99F21aa543F9650A56D141C57e4F6081") \ No newline at end of file +module.exports = { + ethereum: { tvl: () => 0 } +}; diff --git a/projects/jadeswap/index.js b/projects/jadeswap/index.js new file mode 100644 index 00000000000..a1dde66f407 --- /dev/null +++ b/projects/jadeswap/index.js @@ -0,0 +1,28 @@ +const ADDRESSES = require("../helper/coreAssets.json"); +const { getUniTVL, staking } = require("../helper/unknownTokens"); +const sdk = require("@defillama/sdk"); +const uniTvl = getUniTVL({ + factory: "0xb20a6389cA872d094f3c7A8180fE5BAb431BD794", + useDefaultCoreAssets: true, + fetchBalances: true, +}); +const masterchef = "0xcC507803A4b832684154C4E395D92A6EDbEAfE52"; +const jade = "0x7c70229F108D3d506Cff8Ea243FFA57344Fc4cE1"; +const wmnt = ADDRESSES.mantle.WMNT; + +module.exports = { + misrepresentedTokens: true, + mantle: { + tvl: sdk.util.sumChainTvls([ + uniTvl, + staking({ + owners: [masterchef], + tokens: [wmnt], + }), + ]), + staking: staking({ + owners: [masterchef], + tokens: [jade], + }), + }, +}; diff --git a/projects/jarvis/abi.json b/projects/jarvis/abi.json index c520d45c372..0aa44be408e 100644 --- a/projects/jarvis/abi.json +++ b/projects/jarvis/abi.json @@ -1,9 +1,15 @@ { - "SynthereumPoolRegistry_getCollaterals": {"inputs":[],"name":"getCollaterals","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"}, - "SynthereumPoolRegistry_getSyntheticTokens": {"inputs":[],"name":"getSyntheticTokens","outputs":[{"internalType":"string[]","name":"","type":"string[]"}],"stateMutability":"view","type":"function"}, - "SynthereumPoolRegistry_getElements": {"inputs":[{"internalType":"string","name":"syntheticTokenSymbol","type":"string"},{"internalType":"contract IERC20","name":"collateralToken","type":"address"},{"internalType":"uint8","name":"version","type":"uint8"}],"name":"getElements","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"}, - "LiquidityPool_syntheticToken": {"inputs":[],"name":"syntheticToken","outputs":[{"internalType":"contract IERC20","name":"syntheticCurrency","type":"address"}],"stateMutability":"view","type":"function"}, - "LiquidityPool_getAllDerivatives": {"inputs":[],"name":"getAllDerivatives","outputs":[{"internalType":"contract IDerivative[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"}, - "collateralToken": {"inputs":[],"name":"collateralToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"}, - "totalCollateralAmount": {"inputs":[],"name":"totalCollateralAmount","outputs":[{"internalType":"uint256","name":"usersCollateral","type":"uint256"},{"internalType":"uint256","name":"lpsCollateral","type":"uint256"},{"internalType":"uint256","name":"totalCollateral","type":"uint256"}],"stateMutability":"view","type":"function"} + "SynthereumPoolRegistry_getCollaterals": "address[]:getCollaterals", + "SynthereumPoolRegistry_getSyntheticTokens": "string[]:getSyntheticTokens", + "SynthereumPoolRegistry_getElements": "function getElements(string syntheticTokenSymbol, address collateralToken, uint8 version) view returns (address[])", + "collateralToken": "address:collateralToken", + "totalCollateralAmount": "function totalCollateralAmount() view returns (uint256 usersCollateral, uint256 lpsCollateral, uint256 totalCollateral)", + "SynthereumFixedRateRegistry_getCollaterals": "address[]:getCollaterals", + "SynthereumFixedRateRegistry_getSyntheticTokens": "string[]:getSyntheticTokens", + "SynthereumFixedRateRegistry_getElements": "function getElements(string syntheticTokenSymbol, address collateralToken, uint8 version) view returns (address[])", + "totalPegCollateral": "uint256:totalPegCollateral", + "SynthereumSelfMintingRegistry_getCollaterals": "address[]:getCollaterals", + "SynthereumSelfMintingRegistry_getSyntheticTokens": "string[]:getSyntheticTokens", + "SynthereumSelfMintingRegistry_getElements": "function getElements(string syntheticTokenSymbol, address collateralToken, uint8 version) view returns (address[])", + "getGlobalPositionData": "function getGlobalPositionData() view returns (uint256 totCollateral, uint256 totTokensOutstanding)" } \ No newline at end of file diff --git a/projects/jarvis/index.js b/projects/jarvis/index.js index 78ab0f690b6..d7f10a09634 100644 --- a/projects/jarvis/index.js +++ b/projects/jarvis/index.js @@ -1,164 +1,172 @@ const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); - -const contracts_old = { - ethereum: { - usdcToken: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', - synthCollateralContracts: ['0x48546bdd57d34cb110f011cdd1ccaae75ee17a70', '0x182d5993106573a95a182ab3a77c892713ffda56', '0x496b179d5821d1a8b6c875677e3b89a9229aab77', "0x911f0Dfc9d98Fcf6E4d07410E7aC460F19843599", "0xF47Ff36956105255E64455BfEDe4538768439066", "0x2431b64cDD6D7E9A630046d225BA4F01B3AC9D3b", "0x4e3Decbb3645551B8A19f0eA1678079FCB33fB4c", "0x767058F11800FBA6A682E73A6e79ec5eB74Fac8c", "0xbD1463F02f61676d53fd183C2B19282BFF93D099", "0xCbbA8c0645ffb8aA6ec868f6F5858F2b0eAe34DA", "0xeF4Db4AF6189aae295a680345e07E00d25ECBAAb", "0x10d00f5788c39a2bf248adfa2863fa55d83dce36"], - liquidityPools: ['0x833407f9c6C55df59E7fe2Ed6fB86bb413536359', '0x2D8b421F3C6F14Df2887dce70b517d87d11af1E0', '0x6FF556740b30dFb092602dd5721F6D42c66A1580'] // Not AMM LP pools, just pools where money is waiting to be used for minting - }, - polygon: { - usdcToken: '0x2791bca1f2de4661ed88a30c99a7a9449aa84174', - synthCollateralContracts: ['0x0fa1a6b68be5dd9132a09286a166d75480be9165', '0xa87b3e78d128dab9db656cf459c9266c4c1d5255', '0x9b0a1c61f234e2d21b6f7c0da6178dfbbaa3756f', '0x2076648e2d9d452d55f4252cba9b162a1850db48', '0x0d1534bcc572288156b97e2a2651383f1029138c', '0xd016daf08017a0647b8fff5d82b629b93c6c91f3', '0xe25d6cd64c08b986e19cab507e67e8eec6b87156', '0xb6C683B89228455B15cF1b2491cC22b529cdf2c4', '0xA4B72abA6793Ef9f5a6773941d9d039af9258d65', '0x606ac601324e894dc20e0ac9698ccaf180960456'], - liquidityPools: ['0xcbba8c0645ffb8aa6ec868f6f5858f2b0eae34da', '0x10d00f5788c39a2bf248adfa2863fa55d83dce36', '0xef4db4af6189aae295a680345e07e00d25ecbaab', '0x6ca82a7e54053b102e7ec452788cc19204e831de', '0xf1a69f6937a7661a6e6f2f521f9497822bfa854c', '0x715995b91c4fa32a35514971f2f88ee2a7f59796', '0x86413032f772596034AEf76438aeF1A62Ec6121e', '0x91436EB8038ecc12c60EE79Dfe011EdBe0e6C777', '0x60E5db98d156B68bC079795096D8599d12F2DcA6', '0x09757f36838aaacd47df9de4d3f0add57513531f'] - } -} - -function chainTvl_old(chain) { - return async (timestamp, ethBlock, chainBlocks) => { - let balances = {}; - const block = chainBlocks[chain] - const { synthCollateralContracts, liquidityPools, usdcToken } = contracts_old[chain] - - const collateralTokens = await sdk.api.abi.multiCall({ - abi: 'erc20:balanceOf', - calls: synthCollateralContracts.concat(liquidityPools).map(contract => ({ - target: usdcToken, - params: [contract] - })), - block, - chain - }) - sdk.util.sumMultiBalanceOf(balances, collateralTokens, true, t => `${chain}:${t}`) - return balances - } -} - +const { sumTokens2 } = require('../helper/unwrapLPs') // The synthpoolRegistry addresses can be found in this repo // https://gitlab.com/jarvis-network/apps/exchange/mono-repo/-/tree/dev/libs/contracts/networks const contracts = { polygon: { // 137 - version: 4, synthpoolRegistry: '0xdCE12741DF9d2CcF2A8bB611684C8151De91a7d2', - }, - 'polygon-6': { // 137 - version: 6, synthpoolRegistry: '0xdCE12741DF9d2CcF2A8bB611684C8151De91a7d2', - }, - ethereum: { // 1 - version: 4, synthpoolRegistry: '0xaB77024DdC68A3Fe942De8dDb0014738ED01A5e5', + version: 6, synthpoolRegistry: '0xA5BB18ca30fB27045ec0aA4d7039Fc37a7A03BD1', + fixedRateVersion: 1, fixedRateRegistry: '0xBdE9c05FeA7a7fB1173024eac529a9c46bD0307f', + creditLineVersion: 2, selfMintingRegistry: '0x1eA5022a81bd0dF1Bb85085083cDDd1e6A4cf61C' }, bsc: { // 56 version: 5, synthpoolRegistry: '0x930A54D8Af945F6D1BED5AAF63b63fAb50a8197f', + fixedRateVersion: 1, fixedRateRegistry: '0x80eB7668AEC208af0dA10F8BB70ca99F3604E076', + creditLineVersion: 2, selfMintingRegistry: '0xBD8FdDa057de7e0162b7A386BeC253844B5E07A5' }, xdai: { // 100 version: 5, synthpoolRegistry: '0x43a98e5C4A7F3B7f11080fc9D58b0B8A80cA954e', + }, + optimism: { // 10 + version: 6, synthpoolRegistry: '0x811F78b7d6bCF1C0E94493C2eC727B50eE32B974', + creditLineVersion: 2, selfMintingRegistry: '0xBD8FdDa057de7e0162b7A386BeC253844B5E07A5' + }, + avax: { // 43114 + version: 5, synthpoolRegistry: '0x8FEceC5629EED60D18Fd3438aae4a8E69723D190', + }, + arbitrum: { // 42161 + version: 6, synthpoolRegistry: '0xf844826e986a2ad77Bf24a491Fe1D8b9ef2d3B03', + creditLineVersion: 2, selfMintingRegistry: '0x58741E9137a8aF31955D42AEc99a1aD4771EeC23' } } -function chainTvl(chain) { - return async (timestamp, ethBlock, chainBlocks) => { - const { synthpoolRegistry, version } = contracts[chain] - chain = chain.split('-')[0] - const block = chainBlocks[chain] - // Get liquidityPools by calling getElements(synth, collateral, version) - // For v4, these are not AMM LP pools, just pools where money is waiting to be used for minting - // For v5, the collateral is stored in the liquidity pools directly - // Get collaterals, usually single collat, USDC on polygon, BUSD on BSC, but might be multiple collats later on - const { output: collaterals } = await sdk.api.abi.call({ - abi: abi["SynthereumPoolRegistry_getCollaterals"], - target: synthpoolRegistry, +async function tvl(timestamp, ethBlock, chainBlocks, { api, }) { + const chain = api.chain + const { synthpoolRegistry, version } = contracts[chain] + const { fixedRateRegistry, fixedRateVersion } = contracts[chain] + const { selfMintingRegistry, creditLineVersion } = contracts[chain] + const block = chainBlocks[chain] + const balances = {} + + // Get liquidityPools by calling getElements(synth, collateral, version) + // For v5, the collateral is stored in the liquidity pools directly + // Get collaterals, usually single collat, USDC on polygon, BUSD on BSC, but might be multiple collats later on + + const collaterals = await api.call({ + abi: abi["SynthereumPoolRegistry_getCollaterals"], + target: synthpoolRegistry, + }) + // Get synth token symbols - jEUR, jCHF etc + const syntheticTokens = await api.call({ + abi: abi["SynthereumPoolRegistry_getSyntheticTokens"], + target: synthpoolRegistry, + }) + if (chain === 'polygon' || chain === 'bsc') { + // Get collateral for SynthereumFixedRate Wrappers + const fixedRateCollaterals = await api.call({ + abi: abi["SynthereumFixedRateRegistry_getCollaterals"], + target: fixedRateRegistry, + }) + + // Get synthTokens for SynthereumFixedRate Wrappers - jEUR, jCHF etc. + const fixedRateSynthTokens = await api.call({ + abi: abi["SynthereumFixedRateRegistry_getSyntheticTokens"], + target: fixedRateRegistry, + }) + + // Get fixedRateWrappers by calling SynthereumFixedRateRegistry_getElements + const params_list_fixedRate = fixedRateCollaterals.map(fixedRateCollateral => fixedRateSynthTokens.map(fixedRateSynth => [fixedRateSynth, fixedRateCollateral, fixedRateVersion])).flat().map(i => ({ params: i })) + const elements_obj_fixedRate = await api.multiCall({ + abi: abi["SynthereumFixedRateRegistry_getElements"], + target: fixedRateRegistry, + calls: params_list_fixedRate + }) + const fixedRateWrappers = elements_obj_fixedRate.flat(2) + const fixedRateCalls = fixedRateWrappers + const fixedRateCollateralTokens = await api.multiCall({ + abi: abi.collateralToken, + calls: fixedRateCalls, + }) + const fixedRateTotalCollateralAmounts = await api.multiCall({ + abi: abi.totalPegCollateral, + calls: fixedRateCalls, + }) + fixedRateCollateralTokens.forEach((data, i) => { + sdk.util.sumSingleBalance(balances, chain + ':' + data, fixedRateTotalCollateralAmounts[i]) + }) + } + + // Get synthereumPools by calling SynthereumPoolRegistry_getElements + const params_list = collaterals.map(collateral => syntheticTokens.map(synth => [synth, collateral, version])).flat().map(i => ({ params: i })) + const elements_obj = await api.multiCall({ + abi: abi["SynthereumPoolRegistry_getElements"], + target: synthpoolRegistry, + calls: params_list + }) + const liquidityPools = elements_obj.flat(2) + + if (version === 6) { + const blacklistedPools = [ + '0x63B5891895A57C31d5Ec2a8A5521b6EE67700f9F', + ].map(i => i.toLowerCase()) + const calls = liquidityPools.filter(i => !blacklistedPools.includes(i.toLowerCase())).map(a => ({ target: a })) + const collateralTokens = await api.multiCall({ + abi: abi.collateralToken, + calls + }) + const totalCollateralAmounts = await api.multiCall({ + abi: abi.totalCollateralAmount, + calls + }) + collateralTokens.forEach((data, i) => { + sdk.util.sumSingleBalance(balances, chain + ':' + data, totalCollateralAmounts[i].totalCollateral) + }) + } else if (version === 5) { + // Get balances of every LiquidityPool and SynthToken Contracts + await sumTokens2({ api, balances, owners: liquidityPools, tokens: collaterals }) + } + + if (chain === 'polygon' || chain === 'bsc' || chain === 'optimism' || chain === 'arbitrum') { + // Get collateral token addresses from self minting registry + const { output: selfMintingCollaterals } = await sdk.api.abi.call({ + abi: abi["SynthereumSelfMintingRegistry_getCollaterals"], + target: selfMintingRegistry, block, chain }) - // Get synth token symbols - jEUR, jCHF etc - const { output: syntheticTokens } = await sdk.api.abi.call({ - abi: abi["SynthereumPoolRegistry_getSyntheticTokens"], - target: synthpoolRegistry, + const { output: selfMintingSyntheticTokens } = await sdk.api.abi.call({ + abi: abi["SynthereumSelfMintingRegistry_getSyntheticTokens"], + target: selfMintingRegistry, block, chain }) - - // Get liquidityPools by calling SynthereumPoolRegistry_getElements - const params_list = collaterals.map(collateral => syntheticTokens.map(synth => [synth, collateral, version])).flat() - const { output: elements_obj } = await sdk.api.abi.multiCall({ - abi: abi["SynthereumPoolRegistry_getElements"], - calls: params_list.map(params => ({ - target: synthpoolRegistry, + // Get creditLineDerivatives by calling SynthereumSelfMintingRegistry_getElements + const params_list_creditline = selfMintingCollaterals.map(selfMintingCollateral => selfMintingSyntheticTokens.map(selfMintingSynth => [selfMintingSynth, selfMintingCollateral, creditLineVersion])).flat() + const { output: elements_obj_creditline } = await sdk.api.abi.multiCall({ + abi: abi["SynthereumSelfMintingRegistry_getElements"], + calls: params_list_creditline.map(params => ({ + target: selfMintingRegistry, params: params })), block, chain }) - const liquidityPools = elements_obj.map(e => e.output).flat(2) - - if (version === 6) { - const blacklistedPools = [ - '0x009fd83E664A4df9EEA1D46d3D0159e2413680F5', - '0x8F90eA62D0C4Ba040906BaCB4CA79b86BD18e8AD', - ].map(i => i.toLowerCase()) - - const calls = liquidityPools.filter(i => !blacklistedPools.includes(i.toLowerCase())).map(a => ({ target: a })) - const { output: collateralTokens } = await sdk.api.abi.multiCall({ - abi: abi.collateralToken, - chain, block, calls, - }) - const { output: totalCollateralAmounts } = await sdk.api.abi.multiCall({ - abi: abi.totalCollateralAmount, - chain, block, calls, - }) - - const balances = {}; - collateralTokens.forEach((data, i) => { - sdk.util.sumSingleBalance(balances, chain + ':' + data.output, totalCollateralAmounts[i].output.totalCollateral) - }) - return balances - } - // Retrieve synthCollateralContracts where most of the collateral is held for v4 - if (version <= 4) { - const synthCollateralContracts = (await sdk.api.abi.multiCall({ - abi: abi['LiquidityPool_getAllDerivatives'], - calls: liquidityPools.map(a => ({ target: a })), - block, - chain - })).output.map(e => e.output).flat().filter(c => c) // filter out null contracts - liquidityPools.push(...synthCollateralContracts) - } + const creditLineDerivatives = elements_obj_creditline.map(e => e.output).flat(2) - - // Get balances of every LiquidityPool and SynthToken Contracts - const tokenBalances_calls = collaterals.map(collat => - liquidityPools.map(contract => ({ - target: collat, - params: [contract] - })) - ).flat() - const collateralTokens = await sdk.api.abi.multiCall({ - abi: 'erc20:balanceOf', - calls: tokenBalances_calls, - block, - chain + const creditLineCalls = creditLineDerivatives.map(f => ({ target: f })) + const { output: creditLineCollateralTokens } = await sdk.api.abi.multiCall({ + abi: abi.collateralToken, + chain, block, calls: creditLineCalls, + }) + const { output: creditLineTotalCollateralAmounts } = await sdk.api.abi.multiCall({ + abi: abi.getGlobalPositionData, + chain, block, calls: creditLineCalls, + }) + creditLineCollateralTokens.forEach((data, i) => { + sdk.util.sumSingleBalance(balances, chain + ':' + data.output, creditLineTotalCollateralAmounts[i].output.totCollateral) }) - const balances = {}; - sdk.util.sumMultiBalanceOf(balances, collateralTokens, true, t => `${chain}:${t}`) - return balances } + return balances } - module.exports = { - ethereum: { - tvl: chainTvl('ethereum') - }, - polygon: { - tvl: sdk.util.sumChainTvls([chainTvl('polygon'), chainTvl('polygon-6')]) - }, - xdai: { - tvl: chainTvl('xdai') - }, - bsc: { - tvl: chainTvl('bsc') - }, - methodology: 'Count collateral used to mint jFIAT - in v4 it is held by liquidityPools and synthCollateralContracts, in v5 only in liquidityPools' -} \ No newline at end of file + methodology: 'Sum all collateral deposited by liquidity providers and users on SynthereumPools (V5 and V6) and FixedRateWrappers' +}; + + +Object.keys(contracts).forEach(chain => { + module.exports[chain] = { tvl } +}) diff --git a/projects/jbc/index.js b/projects/jbc/index.js new file mode 100644 index 00000000000..0f32be4f1e9 --- /dev/null +++ b/projects/jbc/index.js @@ -0,0 +1,22 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { pool2, staking } = require("../helper/unknownTokens"); +const { nullAddress, sumTokensExport, } = require("../helper/unwrapLPs"); + +const tokensAndOwners = [ + [ADDRESSES.arbitrum.fsGLP, '0xe964b6083F24dBC06e94C662b195c22C76923b22'], // GLP + [nullAddress, '0x64f688cACeFe6D4809f1A829c1d0286100196bE0'], // ETH + [ADDRESSES.arbitrum.WBTC, '0xCC13E077F54577cE3Ea52916fDd70305C461A3ED'], // WBTC + [ADDRESSES.arbitrum.USDC, '0xcA2F482B067D354B3cdB6926911f42F5d1f0e872'], // USDC +] +const lpToken = '0x85c6da933a7451bf2a6d836304b30967f3e76e11' + +module.exports = { + hallmarks: [ + [1681516800, "Rug Pull"] + ], + arbitrum: { + tvl: sumTokensExport({ tokensAndOwners }), + pool2: pool2({ stakingContract: '0x0F6f73c7ecCE4FB9861E25dabde79CBA112550b3', lpToken, useDefaultCoreAssets: true, }), + staking: staking({owner: "0xaF70e6DF6d34dbcd284BC4CCa047Bd232110A2CF", tokens: ["0xb67c175701fD60cD670cB9D331368367BF072e47"], lps: [lpToken]}) + } +} \ No newline at end of file diff --git a/projects/jediswap/abi.js b/projects/jediswap/abi.js new file mode 100644 index 00000000000..f88d69b2971 --- /dev/null +++ b/projects/jediswap/abi.js @@ -0,0 +1,75 @@ +const fabis = [ + { + "inputs": [], + "name": "get_all_pairs", + "outputs": [ + { + "name": "all_pairs_len", + "type": "felt" + }, + { + "name": "all_pairs", + "type": "felt*" + } + ], + "stateMutability": "view", + "type": "function" + } +] + +const pabis = [ + { + "inputs": [], + "name": "token0", + "outputs": [ + { + "name": "address", + "type": "felt" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "token1", + "outputs": [ + { + "name": "address", + "type": "felt" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "get_reserves", + "outputs": [ + { + "name": "reserve0", + "type": "Uint256" + }, + { + "name": "block_timestamp_last", + "type": "felt" + }, + { + "name": "reserve1", + "type": "Uint256" + }, + ], + "stateMutability": "view", + "type": "function" + }, +] + + +const factory = {} +const pair = {} +fabis.forEach(i => factory[i.name] = i) +pabis.forEach(i => pair[i.name] = i) + +module.exports = { + factory, pair, fabis, pabis, +} \ No newline at end of file diff --git a/projects/jediswap/api.js b/projects/jediswap/api.js new file mode 100644 index 00000000000..0f77ccc4635 --- /dev/null +++ b/projects/jediswap/api.js @@ -0,0 +1,36 @@ +// https://www.starknetjs.com/docs/API/contract + +const { call, multiCall, parseAddress } = require('../helper/chain/starknet') +const abi = require('./abi') +const { transformDexBalances } = require('../helper/portedTokens') + +async function tvl() { + const factory = '0xdad44c139a476c7a17fc8141e6db680e9abc9f56fe249a105094c44382c2fd' + let { all_pairs } = await call({ target: factory, abi: abi.factory.get_all_pairs}) + + const calls = all_pairs.map(i => parseAddress(i)) + const [ token0s, token1s, reserves ] = await Promise.all([ + multiCall({ abi: abi.pair.token0, calls }), + multiCall({ abi: abi.pair.token1, calls }), + multiCall({ abi: abi.pair.get_reserves, calls }), + ]) + + const data = [] + reserves.forEach((reserve, i) => { + data.push({ + token0: parseAddress(token0s[i]), + token1: parseAddress(token1s[i]), + token0Bal: +reserve.reserve0, + token1Bal: +reserve.reserve1, + }) + }) + + return transformDexBalances({chain:'starknet', data}) +} + +module.exports = { + timetravel: false, + starknet: { + tvl, + } +} \ No newline at end of file diff --git a/projects/jediswap/index.js b/projects/jediswap/index.js new file mode 100644 index 00000000000..674e8c995c1 --- /dev/null +++ b/projects/jediswap/index.js @@ -0,0 +1 @@ +module.exports = require('./api') \ No newline at end of file diff --git a/projects/jelly/index.js b/projects/jelly/index.js index 86ef5e94f92..7d0115f23fe 100644 --- a/projects/jelly/index.js +++ b/projects/jelly/index.js @@ -1,7 +1,8 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { staking } = require("../helper/staking"); const jelly = "0xf5f06fFa53Ad7F5914F493F16E57B56C8dd2eA80" -const USDC = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48" +const USDC = ADDRESSES.ethereum.USDC const jellyUsdcLP = "0x64C2F792038f1FB55da1A9a22749971eAC94463E" const sweetPool = '0xF897C014a57298DA3453f474312079cC6cB140c0' const royalPool = '0xcC43331067234a0014d298b5226A1c22cb0ac66a' diff --git a/projects/jet-protocol-v2-fixed-term/idl.json b/projects/jet-protocol-v2-fixed-term/idl.json new file mode 100644 index 00000000000..2ef08b5344c --- /dev/null +++ b/projects/jet-protocol-v2-fixed-term/idl.json @@ -0,0 +1,209 @@ +{ + "version": "0.1.0", + "name": "jet_fixed_term", + "constants": [ + { + "name": "MARKET", + "type": "bytes", + "value": "[109, 97, 114, 107, 101, 116]" + }, + { + "name": "TICKET_ACCOUNT", + "type": "bytes", + "value": "[116, 105, 99, 107, 101, 116, 95, 97, 99, 99, 111, 117, 110, 116]" + }, + { + "name": "TICKET_MINT", + "type": "bytes", + "value": "[116, 105, 99, 107, 101, 116, 95, 109, 105, 110, 116]" + }, + { + "name": "CRANK_AUTHORIZATION", + "type": "bytes", + "value": "[99, 114, 97, 110, 107, 95, 97, 117, 116, 104, 111, 114, 105, 122, 97, 116, 105, 111, 110]" + }, + { + "name": "CLAIM_NOTES", + "type": "bytes", + "value": "[99, 108, 97, 105, 109, 95, 110, 111, 116, 101, 115]" + }, + { + "name": "TICKET_COLLATERAL_NOTES", + "type": "bytes", + "value": "[116, 105, 99, 107, 101, 116, 95, 99, 111, 108, 108, 97, 116, 101, 114, 97, 108, 95, 110, 111, 116, 101, 115]" + }, + { + "name": "UNDERLYING_COLLATERAL_NOTES", + "type": "bytes", + "value": "[117, 110, 100, 101, 114, 108, 121, 105, 110, 103, 95, 99, 111, 108, 108, 97, 116, 101, 114, 97, 108, 95, 110, 111, 116, 101, 115]" + }, + { + "name": "EVENT_ADAPTER", + "type": "bytes", + "value": "[101, 118, 101, 110, 116, 95, 97, 100, 97, 112, 116, 101, 114]" + }, + { + "name": "TERM_LOAN", + "type": "bytes", + "value": "[116, 101, 114, 109, 95, 108, 111, 97, 110]" + }, + { + "name": "TERM_DEPOSIT", + "type": "bytes", + "value": "[116, 101, 114, 109, 95, 100, 101, 112, 111, 115, 105, 116]" + }, + { + "name": "USER", + "type": "bytes", + "value": "[117, 115, 101, 114]" + }, + { + "name": "ORDERBOOK_MARKET_STATE", + "type": "bytes", + "value": "[111, 114, 100, 101, 114, 98, 111, 111, 107, 95, 109, 97, 114, 107, 101, 116, 95, 115, 116, 97, 116, 101]" + }, + { + "name": "MARGIN_USER", + "type": "bytes", + "value": "[109, 97, 114, 103, 105, 110, 95, 117, 115, 101, 114]" + }, + { + "name": "UNDERLYING_TOKEN_VAULT", + "type": "bytes", + "value": "[117, 110, 100, 101, 114, 108, 121, 105, 110, 103, 95, 116, 111, 107, 101, 110, 95, 118, 97, 117, 108, 116]" + }, + { + "name": "FEE_VAULT", + "type": "bytes", + "value": "[102, 101, 101, 95, 118, 97, 117, 108, 116]" + } + ], + "instructions": [], + "accounts": [ + { + "name": "Market", + "type": { + "kind": "struct", + "fields": [ + { + "name": "versionTag", + "type": "u64" + }, + { + "name": "airspace", + "type": "publicKey" + }, + { + "name": "orderbookMarketState", + "type": "publicKey" + }, + { + "name": "eventQueue", + "type": "publicKey" + }, + { + "name": "asks", + "type": "publicKey" + }, + { + "name": "bids", + "type": "publicKey" + }, + { + "name": "underlyingTokenMint", + "type": "publicKey" + }, + { + "name": "underlyingTokenVault", + "type": "publicKey" + }, + { + "name": "ticketMint", + "type": "publicKey" + }, + { + "name": "claimsMint", + "type": "publicKey" + }, + { + "name": "ticketCollateralMint", + "type": "publicKey" + }, + { + "name": "underlyingCollateralMint", + "type": "publicKey" + }, + { + "name": "underlyingOracle", + "type": "publicKey" + }, + { + "name": "ticketOracle", + "type": "publicKey" + }, + { + "name": "feeVault", + "type": "publicKey" + }, + { + "name": "feeDestination", + "type": "publicKey" + }, + { + "name": "seed", + "type": { + "array": [ + "u8", + 32 + ] + } + }, + { + "name": "bump", + "type": { + "array": [ + "u8", + 1 + ] + } + }, + { + "name": "orderbookPaused", + "type": "bool" + }, + { + "name": "ticketsPaused", + "type": "bool" + }, + { + "name": "reserved", + "type": { + "array": [ + "u8", + 29 + ] + } + }, + { + "name": "borrowTenor", + "type": "u64" + }, + { + "name": "lendTenor", + "type": "u64" + }, + { + "name": "originationFee", + "type": "u64" + }, + { + "name": "nonce", + "type": "u64" + } + ] + } + } + ], + "types": [], + "errors": [] +} \ No newline at end of file diff --git a/projects/jet-protocol-v2-fixed-term/index.js b/projects/jet-protocol-v2-fixed-term/index.js new file mode 100644 index 00000000000..8ebc7367d52 --- /dev/null +++ b/projects/jet-protocol-v2-fixed-term/index.js @@ -0,0 +1,19 @@ +const { Program } = require("@project-serum/anchor"); +const { getProvider, sumTokens2, } = require("../helper/solana"); +const programId = 'JPTermEg2DwrV39xb1Fs7z1VUxcvdPT7mE7cyGsQ4xt'; +const idl = require('./idl.json') + +async function tvl() { + const provider = getProvider() + const program = new Program(idl, programId, provider) + const accounts = await program.account.market.all() + return sumTokens2({ tokenAccounts: accounts.map(i => i.account.underlyingTokenVault.toString()) }) +} + +module.exports = { + methodology: 'Add all the SOL in the pools, NFT value is not included in tvl', + timetravel: false, + solana: { + tvl, + }, +}; diff --git a/projects/jetfuelfinance/abi.json b/projects/jetfuelfinance/abi.json index 5db99d42a9d..ba440fbe0ea 100644 --- a/projects/jetfuelfinance/abi.json +++ b/projects/jetfuelfinance/abi.json @@ -1,58 +1,6 @@ { - "token": { - "inputs": [], - "name": "token", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "balance": { - "inputs": [], - "name": "balance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "underlying": { - "constant": true, - "inputs": [], - "name": "underlying", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "getCash": { - "constant": true, - "inputs": [], - "name": "getCash", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } -} + "token": "address:token", + "balance": "uint256:balance", + "underlying": "address:underlying", + "getCash": "uint256:getCash" +} \ No newline at end of file diff --git a/projects/jetfuelfinance/index.js b/projects/jetfuelfinance/index.js index 8e3da7ac509..75a48a0cc4d 100644 --- a/projects/jetfuelfinance/index.js +++ b/projects/jetfuelfinance/index.js @@ -1,12 +1,13 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); const { transformBscAddress } = require("../helper/portedTokens"); const { compoundExports } = require("../helper/compound"); -const {calculateUniTvl} = require("../helper/calculateUniTvl"); +const {uniTvlExport} = require("../helper/calculateUniTvl"); // Jetswap section -const factory = "0x0eb58E5c8aA63314ff5547289185cC4583DfCBD5"; +//const factory = "0x0eb58E5c8aA63314ff5547289185cC4583DfCBD5"; /*Vaults found via Jetfuel 1 deployer, some it could not be tracked * so there is missing a small % of tvl compare to their official site stated amount ~60m @@ -45,14 +46,16 @@ const single_side_vault = [ ]; const single_side_assets = [ - "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c", - "0x250632378e573c6be1ac2f97fcdf00515d0aa91b", - "0x7130d2a12b9bcbfae4f2634d864a1ee1ce3ead9c", + ADDRESSES.bsc.WBNB, + ADDRESSES.bsc.BETH, + ADDRESSES.bsc.BTCB, ]; +//const factoryTvl = uniTvlExport(factory, 'bsc') + const bscTvl = async (timestamp, block, chainBlocks) => { // Jetswap section - const balances = await calculateUniTvl(addr=>`bsc:${addr}`, chainBlocks.bsc, "bsc", factory, 0, true) + const balances = {} // Vault section in their repo const vault_balances = ( @@ -108,12 +111,11 @@ const bscTvl = async (timestamp, block, chainBlocks) => { return balances; }; -const {tvl:lendingTvl, borrowed} = compoundExports("0x67340bd16ee5649a37015138b3393eb5ad17c195", "bsc", "0xE24146585E882B6b59ca9bFaaaFfED201E4E5491", "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c") +const {tvl:lendingTvl, borrowed} = compoundExports("0x67340bd16ee5649a37015138b3393eb5ad17c195", "bsc", "0xE24146585E882B6b59ca9bFaaaFfED201E4E5491", ADDRESSES.bsc.WBNB) module.exports = { - timetravel: true, bsc: { - tvl: sdk.util.sumChainTvls([bscTvl, lendingTvl]), + tvl: sdk.util.sumChainTvls([ bscTvl, lendingTvl]), borrowed }, }; diff --git a/projects/jetprotocol-v2-margin/index.js b/projects/jetprotocol-v2-margin/index.js new file mode 100644 index 00000000000..fd21e9d9b89 --- /dev/null +++ b/projects/jetprotocol-v2-margin/index.js @@ -0,0 +1,20 @@ +const { Program } = require("@project-serum/anchor"); +const { getProvider, sumTokens2, } = require("../helper/solana"); +const programId = 'JPPooLEqRo3NCSx82EdE2VZY5vUaSsgskpZPBHNGVLZ'; + +async function tvl() { + const provider = getProvider() + const program = new Program(idl, programId, provider) + const accounts = await program.account.marginPool.all() + return sumTokens2({ tokenAccounts: accounts.map(i => i.account.vault.toString()), }) +} + +module.exports = { + methodology: 'Add all the SOL in the pools, NFT value is not included in tvl', + timetravel: false, + solana: { + tvl, + }, +}; + +const idl = {"version":"1.0.0","name":"jet_margin_pool","instructions":[],"accounts":[{"name":"MarginPool","type":{"kind":"struct","fields":[{"name":"version","type":"u8"},{"name":"poolBump","type":{"array":["u8",1]}},{"name":"vault","type":"publicKey"},{"name":"feeDestination","type":"publicKey"},{"name":"depositNoteMint","type":"publicKey"},{"name":"loanNoteMint","type":"publicKey"},{"name":"tokenMint","type":"publicKey"},{"name":"tokenPriceOracle","type":"publicKey"},{"name":"address","type":"publicKey"},{"name":"config","type":{"defined":"MarginPoolConfig"}},{"name":"borrowedTokens","type":{"array":["u8",24]}},{"name":"uncollectedFees","type":{"array":["u8",24]}},{"name":"depositTokens","type":"u64"},{"name":"depositNotes","type":"u64"},{"name":"loanNotes","type":"u64"},{"name":"accruedUntil","type":"i64"}]}}],"types":[{"name":"MarginPoolConfig","type":{"kind":"struct","fields":[{"name":"flags","type":"u64"},{"name":"utilizationRate1","type":"u16"},{"name":"utilizationRate2","type":"u16"},{"name":"borrowRate0","type":"u16"},{"name":"borrowRate1","type":"u16"},{"name":"borrowRate2","type":"u16"},{"name":"borrowRate3","type":"u16"},{"name":"managementFeeRate","type":"u16"},{"name":"reserved","type":"u64"}]}}],"events":[],"errors":[]} \ No newline at end of file diff --git a/projects/jetswap/index.js b/projects/jetswap/index.js index eeb960b74c3..6386c5a3cac 100644 --- a/projects/jetswap/index.js +++ b/projects/jetswap/index.js @@ -1,5 +1,5 @@ -const sdk = require("@defillama/sdk"); -const { calculateUniTvl } = require("../helper/calculateUniTvl"); +const { uniTvlExport } = require("../helper/calculateUniTvl"); +const { staking } = require('../helper/staking') const bscFactory = "0x0eb58E5c8aA63314ff5547289185cC4583DfCBD5"; const polygonFactory = "0x668ad0ed2622C62E24f0d5ab6B6Ac1b9D2cD4AC7"; @@ -13,69 +13,17 @@ const MASTER_BSC = "0x63d6EC1cDef04464287e2af710FFef9780B6f9F5"; const MASTER_POLYGON = "0x4e22399070aD5aD7f7BEb7d3A7b543e8EcBf1d85"; const MASTER_FANTOM = "0x9180583C1ab03587b545629dd60D2be0bf1DF4f2"; -async function bscTvl(timestamp, block, chainBlocks) { - let balances = await calculateUniTvl( - (addr) => `bsc:${addr}`, - chainBlocks.bsc, - "bsc", - bscFactory, - 0, - true - ); - return balances; -} - -async function polygonTvl(timestamp, block, chainBlocks) { - let balances = calculateUniTvl( - (addr) => `polygon:${addr}`, - chainBlocks.polygon, - "polygon", - polygonFactory, - 0, - true - ); - return balances; -} - -async function fantomTvl(timestamp, block, chainBlocks) { - let balances = calculateUniTvl( - (addr) => `fantom:${addr}`, - chainBlocks.fantom, - "fantom", - fantomFactory, - 0, - true - ); - return balances; -} - -function staking(masterchef, token, chain) { - return async (_timestamp, _block, chainBlocks) => { - let balances = {}; - let balance = ( - await sdk.api.erc20.balanceOf({ - target: token, - owner: masterchef, - block: chainBlocks[chain], - chain, - }) - ).output; - sdk.util.sumSingleBalance(balances, `bsc:${WINGS_TOKEN_BSC}`, balance); - return balances; - }; -} - module.exports = { bsc: { - tvl: bscTvl, - staking: staking(MASTER_BSC, WINGS_TOKEN_BSC, "bsc"), + tvl: uniTvlExport(bscFactory, 'bsc', true), + staking: staking(MASTER_BSC, WINGS_TOKEN_BSC), }, polygon: { - tvl: polygonTvl, - staking: staking(MASTER_POLYGON, WINGS_TOKEN_POLYGON, "polygon"), + tvl: uniTvlExport(polygonFactory, 'polygon', true), + staking: staking(MASTER_POLYGON, WINGS_TOKEN_POLYGON), }, fantom: { - tvl: fantomTvl, - staking: staking(MASTER_FANTOM, WINGS_TOKEN_FANTOM, "fantom"), + tvl: uniTvlExport(fantomFactory, 'fantom', true), + staking: staking(MASTER_FANTOM, WINGS_TOKEN_FANTOM), }, }; diff --git a/projects/jewelswap-lev-farming/api.js b/projects/jewelswap-lev-farming/api.js new file mode 100644 index 00000000000..8e562c21b03 --- /dev/null +++ b/projects/jewelswap-lev-farming/api.js @@ -0,0 +1,6 @@ +const { getExports } = require('../helper/heroku-api') + +module.exports = { + timetravel: false, + ...getExports("jewelswap-lev-farming", ['elrond']), +} diff --git a/projects/jewelswap-lev-farming/index.js b/projects/jewelswap-lev-farming/index.js new file mode 100644 index 00000000000..4d78f06a9d8 --- /dev/null +++ b/projects/jewelswap-lev-farming/index.js @@ -0,0 +1,96 @@ +const { getNFTs, sumTokens } = require("../helper/chain/elrond"); +const { ResultsParser, AbiRegistry, SmartContract, Address, } = require("@multiversx/sdk-core/out"); +const { ProxyNetworkProvider } = require("@multiversx/sdk-network-providers/out"); +const JEWEL_ONEDEX_FARM_SC_ABI = require("./jewel-onedex-farm.abi.json"); + + +const JEWEL_ONEDEX_FARM_SC_ADDRESS = "erd1qqqqqqqqqqqqqpgqm7exdla3rzshywy99pvlxzkr45wt9kjsdfys7qqpn0"; +const LENDING_POOL_FARMS = "erd1qqqqqqqqqqqqqpgq96n4gxvmw8nxgxud8nv8qmms5namspc5vmusg930sh"; + +const FARMS = "erd1qqqqqqqqqqqqqpgqlnxy2hmvs8qxr6ezq2wmggn7ev62cjp6vmusvdral4"; + +const jewelOnedexFarmAbiRegistry = AbiRegistry.create(JEWEL_ONEDEX_FARM_SC_ABI); +const jewelOnedexFarmSmartContract = new SmartContract({ + address: new Address(JEWEL_ONEDEX_FARM_SC_ADDRESS), + abi: jewelOnedexFarmAbiRegistry +}); + + +const networkConfigs = { + mainnet: { + id: "mainnet", + chainId: "1", + apiUrl: "https://api.multiversx.com", + gatewayUrl: "https://gateway.multiversx.com", + explorerUrl: "https://explorer.multiversx.com", + apiTimeout: 10000 + } +}; + + +const ELROND_NETWORK = "mainnet"; +const networkConfig = networkConfigs[ELROND_NETWORK]; + +const proxyProvider = new ProxyNetworkProvider(networkConfig.gatewayUrl, { + timeout: networkConfig.apiTimeout +}); + + +async function tvl() { + const { api } = arguments[3] + + const nfts = await getNFTs(FARMS) + nfts.forEach(nft => { + let lpToken + switch (nft.collection) { + case "FARM-e5ffde": lpToken = "ALP-2d0cf8"; break; + case "FARM-9ed1f9": lpToken = "ALP-5f9191"; break; + case "FARM-ccefc2": lpToken = "ALP-0fe50a"; break; + case "FARM-795466": lpToken = "ALP-afc922"; break; + default: lpToken = null; + } + if (lpToken) api.add(lpToken, nft.balance) + }) + await oneDexFarm(api) + return sumTokens({ owners: [LENDING_POOL_FARMS], balances: api.getBalances() }) +} + +async function oneDexFarm(api) { + const interaction = + jewelOnedexFarmSmartContract.methodsExplicit.viewFarms(); + const query = interaction.check().buildQuery(); + const queryResponse = + await proxyProvider.queryContract(query); + const endpointDefinition = interaction.getEndpoint(); + const { firstValue, returnCode, returnMessage } = + new ResultsParser().parseQueryResponse( + queryResponse, + endpointDefinition + ); + + if (!firstValue || !returnCode.isSuccess()) { + throw Error(returnMessage); + } + + const values = firstValue.valueOf(); + const decoded = values.map((value) => ({ + token0: value.first_token_id.toString(), + token1: value.second_token_id.toString(), + lpAmount: value.lp_token_amount.toFixed(0), + lpSupply: value.lp_token_supply.toFixed(0), + token0Supply: value.first_token_reserve.toFixed(0), + token1Supply: value.second_token_reserve.toFixed(0) + })); + decoded.forEach(({ token0, token1, lpAmount, lpSupply, token0Supply, token1Supply}) => { + const ratio = lpAmount / lpSupply + api.add(token0, token0Supply * ratio) + api.add(token1, token1Supply * ratio) + }) +} + +module.exports = { + timetravel: false, + elrond: { + tvl + } +}; diff --git a/projects/jewelswap-lev-farming/jewel-onedex-farm.abi.json b/projects/jewelswap-lev-farming/jewel-onedex-farm.abi.json new file mode 100644 index 00000000000..8af49b34716 --- /dev/null +++ b/projects/jewelswap-lev-farming/jewel-onedex-farm.abi.json @@ -0,0 +1,115 @@ +{ + "buildInfo": { + }, + "name": "JewelOnedexFarm", + "constructor": { + "inputs": [], + "outputs": [] + }, + "endpoints": [ + { + "name": "viewFarms", + "mutability": "readonly", + "inputs": [], + "outputs": [ + { + "type": "List" + } + ] + } + ], + "events": [], + "hasCallback": false, + "types": { + "FarmContext": { + "type": "struct", + "fields": [ + { + "name": "farm_id", + "type": "u32" + }, + { + "name": "dex_swap_pool_id", + "type": "u32" + }, + { + "name": "dex_farm_pool_id", + "type": "u32" + }, + { + "name": "min_deposit_base_token", + "type": "TokenIdentifier" + }, + { + "name": "min_deposit_base_amount", + "type": "BigUint" + }, + { + "name": "min_compound_rewards_amount", + "type": "BigUint" + }, + { + "name": "fee_percent", + "type": "u64" + }, + { + "name": "first_token_id", + "type": "TokenIdentifier" + }, + { + "name": "second_token_id", + "type": "TokenIdentifier" + }, + { + "name": "lp_token_id", + "type": "TokenIdentifier" + }, + { + "name": "rewards_token_id", + "type": "TokenIdentifier" + }, + { + "name": "pending_first_token_amount", + "type": "BigUint" + }, + { + "name": "pending_second_token_amount", + "type": "BigUint" + }, + { + "name": "farm_share", + "type": "BigUint" + }, + { + "name": "lp_token_amount", + "type": "BigUint" + }, + { + "name": "current_rewards_amount", + "type": "BigUint" + }, + { + "name": "farm_yearly_reward_amount", + "type": "BigUint" + }, + { + "name": "lp_token_supply", + "type": "BigUint" + }, + { + "name": "first_token_reserve", + "type": "BigUint" + }, + { + "name": "second_token_reserve", + "type": "BigUint" + }, + { + "name": "opened_position_count", + "type": "u32" + } + ] + } + + } +} diff --git a/projects/jewelswap-liq-staking/index.js b/projects/jewelswap-liq-staking/index.js new file mode 100644 index 00000000000..18faf36c927 --- /dev/null +++ b/projects/jewelswap-liq-staking/index.js @@ -0,0 +1,14 @@ +const { getTokenData, sumTokens, } = require('../helper/chain/elrond') +const { nullAddress } = require('../helper/tokenMapping') + +module.exports = { + elrond: { tvl} +} + +async function tvl(_, _b, _cb, { api, }) { + const data = await getTokenData('JWLEGLD-023462') + const data2 = await getTokenData('JWLASH-f362b9') + api.add(nullAddress, data.minted - data.burnt) + api.add('JWLASH-f362b9', data2.minted - data2.burnt) +} + diff --git a/projects/jewelswap-nft/api.js b/projects/jewelswap-nft/api.js new file mode 100644 index 00000000000..a3af2c0031e --- /dev/null +++ b/projects/jewelswap-nft/api.js @@ -0,0 +1,6 @@ +const { getExports } = require('../helper/heroku-api') + +module.exports = { + timetravel: false, + ...getExports("jewelswap-nft", ['elrond'], ['borrowed']), +} diff --git a/projects/jewelswap-nft/index.js b/projects/jewelswap-nft/index.js new file mode 100644 index 00000000000..fd0502fa3ed --- /dev/null +++ b/projects/jewelswap-nft/index.js @@ -0,0 +1,79 @@ +const { ResultsParser, AbiRegistry, SmartContract, Address, OptionalValue } = require("@multiversx/sdk-core/out"); +const { ProxyNetworkProvider } = require("@multiversx/sdk-network-providers/out"); +const NFT_LENDING_SC_ABI_JSON = require("./jewel-nft-lending.abi.json"); +const { sumTokens } = require("../helper/chain/elrond"); +const { nullAddress } = require("../helper/tokenMapping"); + + +const LENDING_POOL = "erd1qqqqqqqqqqqqqpgqhpauarfmx75nf4pwxh2fuy520ym03p8e8jcqt466up"; + +const abi = AbiRegistry.create(NFT_LENDING_SC_ABI_JSON); +const nftLendingSmartContract = new SmartContract({ + address: new Address(LENDING_POOL), + abi: abi +}); + +const networkConfigs = { + mainnet: { + id: "mainnet", + chainId: "1", + apiUrl: "https://api.multiversx.com", + gatewayUrl: "https://gateway.multiversx.com", + explorerUrl: "https://explorer.multiversx.com", + apiTimeout: 10000 + } +}; + + +const ELROND_NETWORK = "mainnet"; +const networkConfig = networkConfigs[ELROND_NETWORK]; + +const proxyProvider = new ProxyNetworkProvider(networkConfig.gatewayUrl, { + timeout: networkConfig.apiTimeout +}); + + +module.exports = { + misrepresentedTokens: true, + timetravel: false, + elrond: { + tvl: () => sumTokens({ owners: [LENDING_POOL] }), + borrowed, + } +}; + +async function borrowed() { + const { api } = arguments[3] + const commonSettings = await queryNFTDataFromSc(); + api.add(nullAddress, commonSettings.total_loan_amount) + + return api.getBalances() +} + +async function queryNFTDataFromSc() { + const args = [ + OptionalValue.newMissing() + ]; + const interaction = nftLendingSmartContract.methodsExplicit.viewCommonSettings(args); + const query = interaction.check().buildQuery(); + const queryResponse = await proxyProvider.queryContract(query); + const endpointDefinition = interaction.getEndpoint(); + const { + firstValue, + returnCode, + returnMessage + } = new ResultsParser().parseQueryResponse(queryResponse, endpointDefinition); + + if (!firstValue || !returnCode.isSuccess()) { + console.error(returnMessage); + return undefined; + } + + const value = firstValue.valueOf(); + const decoded = { + total_lending_amount: value.total_lending_amount.toFixed(), + total_collateral_amount: value.total_collateral_amount.toFixed(), + total_loan_amount: value.total_loan_amount.toFixed(), + }; + return decoded; +} diff --git a/projects/jewelswap-nft/jewel-nft-lending.abi.json b/projects/jewelswap-nft/jewel-nft-lending.abi.json new file mode 100644 index 00000000000..6c12f761ed9 --- /dev/null +++ b/projects/jewelswap-nft/jewel-nft-lending.abi.json @@ -0,0 +1,183 @@ +{ + "buildInfo": { + }, + "name": "EpunksNftLending", + "constructor": { + "inputs": [], + "outputs": [] + }, + "endpoints": [ + { + "name": "viewCommonSettings", + "mutability": "readonly", + "inputs": [ + { + "name": "opt_user_address", + "type": "optional
", + "multi_arg": true + } + ], + "outputs": [ + { + "type": "CommonSettings" + } + ] + } + ], + "hasCallback": true, + "types": { + "CommonSettings": { + "type": "struct", + "fields": [ + { + "name": "rewards_pool_rate", + "type": "u64" + }, + { + "name": "epunks_buyback_rate", + "type": "u64" + }, + { + "name": "team_rate", + "type": "u64" + }, + { + "name": "epunks_buyback_wallet", + "type": "Address" + }, + { + "name": "team_wallet", + "type": "Address" + }, + { + "name": "liquidation_wallet", + "type": "Address" + }, + { + "name": "lend_epoch_length", + "type": "u64" + }, + { + "name": "lend_lock_period", + "type": "u64" + }, + { + "name": "liquidation_threshold", + "type": "u64" + }, + { + "name": "lend_grace_period", + "type": "u64" + }, + { + "name": "liquidation_fee", + "type": "u64" + }, + { + "name": "total_lending_amount", + "type": "BigUint" + }, + { + "name": "lend_users", + "type": "u32" + }, + { + "name": "current_lend_epoch_id", + "type": "u32" + }, + { + "name": "lend_epoch_start_timestamp", + "type": "u64" + }, + { + "name": "lend_rewards_pool_amount", + "type": "BigUint" + }, + { + "name": "global_liquidation_rate", + "type": "u64" + }, + { + "name": "global_max_borrow_amount", + "type": "BigUint" + }, + { + "name": "global_collection_max_lend_cap_percent", + "type": "u64" + }, + { + "name": "global_max_borrower_cap_percent", + "type": "u64" + }, + { + "name": "borrow_plan_count", + "type": "u32" + }, + { + "name": "max_borrow_periods", + "type": "List" + }, + { + "name": "borrow_rates", + "type": "List" + }, + { + "name": "accumulated_loan_amount", + "type": "BigUint" + }, + { + "name": "total_loan_amount", + "type": "BigUint" + }, + { + "name": "total_collateral_amount", + "type": "BigUint" + }, + { + "name": "opened_loan_count", + "type": "u32" + }, + { + "name": "loan_owners", + "type": "u32" + }, + { + "name": "last_loan_id", + "type": "u32" + }, + { + "name": "collection_ids", + "type": "List" + }, + { + "name": "collection_collateral_rates", + "type": "List" + }, + { + "name": "collection_trait_counts", + "type": "List" + }, + { + "name": "collection_supplies", + "type": "List" + }, + { + "name": "collection_max_borrow_amounts", + "type": "List" + }, + { + "name": "collection_borrow_amounts", + "type": "List" + }, + { + "name": "collection_max_lend_cap_percents", + "type": "List" + }, + { + "name": "user_borrow_status", + "type": "bool" + } + ] + } + } +} diff --git a/projects/jexchange/index.js b/projects/jexchange/index.js index 22b0802dfd1..e3c5ac34eca 100644 --- a/projects/jexchange/index.js +++ b/projects/jexchange/index.js @@ -3,6 +3,6 @@ const { sumTokensExport } = require('../helper/sumTokens') module.exports = { timetravel: false, elrond: { - tvl: sumTokensExport({ chain: 'elrond', owner: 'erd1qqqqqqqqqqqqqpgqawkm2tlyyz6vtg02fcr5w02dyejp8yrw0y8qlucnj2', }) + tvl: sumTokensExport({ chain: 'elrond', owner: 'erd1qqqqqqqqqqqqqpgqmmxzmktd09gq0hldtczerlv444ykt3pz6avsnys6m9', }) } } \ No newline at end of file diff --git a/projects/jlswap/index.js b/projects/jlswap/index.js new file mode 100644 index 00000000000..03270865074 --- /dev/null +++ b/projects/jlswap/index.js @@ -0,0 +1,8 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports = { + misrepresentedTokens: true, + eos_evm: { + tvl: getUniTVL({ factory: '0x84c81cbC482B7BDB02470bB820F5323aa77C50F3', useDefaultCoreAssets: true, }) + } +} diff --git a/projects/jojo/index.js b/projects/jojo/index.js index 782750c0949..5fb852df6a9 100644 --- a/projects/jojo/index.js +++ b/projects/jojo/index.js @@ -1,13 +1,8 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokensExport } = require('../helper/unwrapLPs') -const contracts = [ - '0x25173BB47CB712cFCDFc13ECBebDAd753090801E' -]; - -const tokens = [ - '0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d' -]; - module.exports = { - bsc: { tvl: sumTokensExport({ tokens, chain: 'bsc', owners: contracts, }) } + era: { tvl: sumTokensExport({ tokens: [ADDRESSES.era.USDC], owners: ['0x47eAD228547db8397398C1D3aAfd0847CBEbddeC'], }) }, + bsc: { tvl: sumTokensExport({ tokens: [ADDRESSES.bsc.USDC], owners: ['0x25173BB47CB712cFCDFc13ECBebDAd753090801E'], }) }, + arbitrum: { tvl: sumTokensExport({ tokens: [ADDRESSES.arbitrum.USDC], owners: ['0xcDf9eED57Fe8dFaaCeCf40699E5861517143bcC7'], }) }, }; diff --git a/projects/jones-dao/abi.json b/projects/jones-dao/abi.json index d2d2f6d69e2..dc5f19935ce 100644 --- a/projects/jones-dao/abi.json +++ b/projects/jones-dao/abi.json @@ -1,99 +1,9 @@ { - "MANAGEMENT_WINDOW_OPEN": { - "inputs": [], - "name": "MANAGEMENT_WINDOW_OPEN", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - "snapshotVaultBalance": { - "inputs": [], - "name": "snapshotVaultBalance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "snapshotAssetBalance": { - "inputs": [], - "name": "snapshotAssetBalance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "balanceOf": { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "totalAssets": { - "inputs": [], - "name": "totalAssets", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "state": { - "inputs": [], - "name": "state", - "outputs": [ - { - "internalType": "enum IVault.State", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - "snapShotAssetBalance": { - "inputs": [], - "name": "snapshotAssetBalance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } + "MANAGEMENT_WINDOW_OPEN": "bool:MANAGEMENT_WINDOW_OPEN", + "snapshotVaultBalance": "uint256:snapshotVaultBalance", + "snapshotAssetBalance": "uint256:snapshotAssetBalance", + "balanceOf": "function balanceOf(address account) view returns (uint256)", + "totalAssets": "uint256:totalAssets", + "state": "uint8:state", + "snapShotAssetBalance": "uint256:snapshotAssetBalance" } \ No newline at end of file diff --git a/projects/jones-dao/addresses.json b/projects/jones-dao/addresses.json index 1c7cc04a4c9..7f71b93152e 100644 --- a/projects/jones-dao/addresses.json +++ b/projects/jones-dao/addresses.json @@ -1,15 +1,14 @@ { "jones": "0x10393c20975cf177a3513071bc110f7962cd67da", "jonesStaking": [ - "0xf1a26cf6309a59794da29b5b2e6fabd3070d470f", + "0xf1a26cf6309a59794da29b5b2e6fabd3070d470f", "0xb94d1959084081c5a11C460012Ab522F5a0FD756", "0x808A84063a586E680b7699be20a4Ec958ADfdF86" ], - "ethVaultV3": "0xF46Ce0C13577232D5F29D9Bd78a9Cab278755346", - "ethDpxFarm": "0x1f80C96ca521d7247a818A09b0b15C38E3e58a28", - "rdpxEthFarm": "0xEb0F03A203F25F08c7aFF0e1b1C2E0EE25Ca29Eb", - "dpxEthSlp": "0x0C1Cf6883efA1B496B01f654E247B9b419873054", - "rdpxEthSlp": "0x7418F5A2621E13c05d1EFBd71ec922070794b90a", + "ethDpxFarm": "0x1f80C96ca521d7247a818A09b0b15C38E3e58a28", + "rdpxEthFarm": "0xEb0F03A203F25F08c7aFF0e1b1C2E0EE25Ca29Eb", + "dpxEthSlp": "0x0C1Cf6883efA1B496B01f654E247B9b419873054", + "rdpxEthSlp": "0x7418F5A2621E13c05d1EFBd71ec922070794b90a", "DpxEthBullVault": "0x7AA12db079C901400e22a5B912204Dc575ff9C19", "DpxEthBearVault": "0x7a82A0ca7A2569d6cD3Df2aFeAF508f6d85Fd2c3", "RdpxEthBullVault": "0x64F6c761d855A6Eff9EF8b025B0258BDdEde5393", @@ -22,29 +21,36 @@ "RdpxEthStorage": "0x0c8F76ae6b3636643c912dbACe26F3b65acFbC87", "JonesRdpxEthBearStrategy": "0xE6c548B9443B8A296A5bC084903B569594E89cd0", "RdpxEthStorageBear": "0x2B441AB9810aDDC1AF7Faf8d777647D05E45E05D", - - "vaultandCollateral": [ - ["0x8883E5bb2920bBE766A2c9e86ad9aA45a573f3F5", "0x8d9ba570d6cb60c7e3e0f31343efe75ab8e65fb1"], - ["0x5BA98Ad75AB87eB90fFc2b680bCfC6b9030E1246", "0x6c2c06790b3e3e3c38e12ee22f8183b37a13ee55"], - ["0xF46Ce0C13577232D5F29D9Bd78a9Cab278755346", "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1"], - ["0x42448fDDCec02124cf6dB19a9f91Dea7bB0e88e5", "0x32Eb7902D4134bf98A28b963D26de779AF92A212"] + "vaults": [ + "0x8883E5bb2920bBE766A2c9e86ad9aA45a573f3F5", + "0x5BA98Ad75AB87eB90fFc2b680bCfC6b9030E1246", + "0xF46Ce0C13577232D5F29D9Bd78a9Cab278755346", + "0x42448fDDCec02124cf6dB19a9f91Dea7bB0e88e5" ], - "lpStaking": [ - "0x360a766F30F0Ba57d2865eFb32502FB800b14dD3", - "0x13f6A63867046107780Bc3fEBdeE90E7AfCdfd99", - "0xBAc58e8b57935A0B60D5Cb4cd9F6C21049595F04", - "0x7eCe38dBE9D61D0d9Bf2D804A87A7d21b5937a56", - "0x5723be83199C9Ec68ED0Ac979e98381224870e7f", - "0xb94d1959084081c5a11C460012Ab522F5a0FD756" + "0x360a766F30F0Ba57d2865eFb32502FB800b14dD3", + "0x13f6A63867046107780Bc3fEBdeE90E7AfCdfd99", + "0xBAc58e8b57935A0B60D5Cb4cd9F6C21049595F04", + "0x7eCe38dBE9D61D0d9Bf2D804A87A7d21b5937a56", + "0x5723be83199C9Ec68ED0Ac979e98381224870e7f", + "0xb94d1959084081c5a11C460012Ab522F5a0FD756" ], - "lps": [ - "0xe8EE01aE5959D3231506FcDeF2d5F3E85987a39c", - "0xa6efc26daa4bb2b9bf5d23a0bc202a2badc2b59e", - "0xdf1a6dd4e5b77d7f2143ed73074be26c806754c5", - "0x292d1587a6bb37e34574c9ad5993f221d8a5616c", - "0xeeb24360c8c7a87933d16b0075e10e1a30ad65b7", + "0xe8EE01aE5959D3231506FcDeF2d5F3E85987a39c", + "0xa6efc26daa4bb2b9bf5d23a0bc202a2badc2b59e", + "0xdf1a6dd4e5b77d7f2143ed73074be26c806754c5", + "0x292d1587a6bb37e34574c9ad5993f221d8a5616c", + "0xeeb24360c8c7a87933d16b0075e10e1a30ad65b7", "0x110a0f39b15D04f2F348B61Bd741429C7d188d3F" - ] + ], + "trackers": { + "uvert": { + "holder": "0xEB23C7e19DB72F9a728fD64E1CAA459E457cfaca", + "token": "0xa485a0bc44988B95245D5F20497CCaFF58a73E99" + } + }, + "strategy": "0x15df56a82c194FeFEC9337C37A41964B69b584d5", + "glpCompound": "0x7241bC8035b65865156DDb5EdEf3eB32874a3AF6", + "glp": "0x1aDDD80E6039594eE970E5872D247bf0414C8903", + "jonesGlpVaultRouter": "0x2F43c6475f1ecBD051cE486A9f3Ccc4b03F3d713" } \ No newline at end of file diff --git a/projects/jones-dao/index.js b/projects/jones-dao/index.js index a5337bd90c5..447995f782c 100644 --- a/projects/jones-dao/index.js +++ b/projects/jones-dao/index.js @@ -1,180 +1,89 @@ -const sdk = require("@defillama/sdk"); +const ADDRESSES = require('../helper/coreAssets.json') const { pool2s } = require("../helper/pool2"); const { stakings } = require("../helper/staking"); -const abi = require("./abi.json"); const addresses = require("./addresses.json"); -const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); -const { getChainTransform } = require('../helper/portedTokens') +const { sumTokens2 } = require("../helper/unwrapLPs"); +const lockerABI = require("./locked.json"); +const sdk = require('@defillama/sdk'); const jTokenToToken = { - "0x662d0f9ff837a51cf89a1fe7e0882a906dac08a3": "arbitrum:0x82af49447d8a07e3bd95bd0d56f35241523fbab1", // jETH - "0x5375616bb6c52a90439ff96882a986d8fcdce421": "arbitrum:0x8d9ba570d6cb60c7e3e0f31343efe75ab8e65fb1", // jgOHM, - "0xf018865b26ffab9cd1735dcca549d95b0cb9ea19": "arbitrum:0x6c2c06790b3e3e3c38e12ee22f8183b37a13ee55", // jDPX - "0x1f6fa7a58701b3773b08a1a16d06b656b0eccb23": "arbitrum:0x32eb7902d4134bf98a28b963d26de779af92a212" // jrdpx + "0x662d0f9ff837a51cf89a1fe7e0882a906dac08a3": "arbitrum:" + ADDRESSES.arbitrum.WETH, // jETH + "0x5375616bb6c52a90439ff96882a986d8fcdce421": "arbitrum:0x8d9ba570d6cb60c7e3e0f31343efe75ab8e65fb1", // jgOHM, + "0xf018865b26ffab9cd1735dcca549d95b0cb9ea19": "arbitrum:0x6c2c06790b3e3e3c38e12ee22f8183b37a13ee55", // jDPX + "0x1f6fa7a58701b3773b08a1a16d06b656b0eccb23": "arbitrum:0x32eb7902d4134bf98a28b963d26de779af92a212" // jrdpx } +const AURA = '0xC0c293ce456fF0ED870ADd98a0828Dd4d2903DBF' +const AURALocker = '0x3Fa73f1E5d8A792C80F426fc8F84FBF7Ce9bBCAC' +const USDC = ADDRESSES.arbitrum.USDC; +const jAuraStrategy = '0x7629fc134e5a7feBEf6340438D96881C8D121f2c'; -async function tvl(timestamp, block, chainBlocks) { - let balances = {}; - let slps = [addresses.dpxEthSlp, addresses.dpxEthSlp, addresses.rdpxEthSlp, addresses.rdpxEthSlp]; - let dopexFarms = [addresses.ethDpxFarm, addresses.ethDpxFarm, addresses.rdpxEthFarm, addresses.rdpxEthFarm]; - let metaVaultsAddresses = [addresses.DpxEthBullVault, addresses.DpxEthBearVault, addresses.RdpxEthBullVault, addresses.RdpxEthBearVault]; - let strategyStorageContractsDpxEth = [addresses.JonesDpxEthBullStrategy, addresses.DpxEthStorage, addresses.JonesDpxEthBearStrategy, addresses.DpxEthStorageBear]; - let strategyStorageContractsRdpxEth = [addresses.JonesRdpxEthBullStrategy, addresses.RdpxEthStorage, addresses.JonesRdpxEthBearStrategy, addresses.RdpxEthStorageBear]; - - block = chainBlocks.arbitrum; - const chain = "arbitrum"; - const transformAddress = await getChainTransform(chain) +async function tvl(timestamp, block, chainBlocks, { api }) { + let metaVaultsAddresses = [addresses.DpxEthBullVault, addresses.DpxEthBearVault, addresses.RdpxEthBullVault, addresses.RdpxEthBearVault]; - const ethManagementWindow = (await sdk.api.abi.call({ - target: addresses.ethVaultV3, - abi: abi.state, - block, - chain - })).output; // node test.js projects/jones-dao/index.js + const [ + tokens, bals, vAssets, vBals, + ] = await Promise.all([ + api.multiCall({ abi: 'address:depositToken', calls: metaVaultsAddresses}), + api.multiCall({ abi: 'uint256:workingBalance', calls: metaVaultsAddresses}), + api.multiCall({ abi: 'address:asset', calls: addresses.vaults }), + api.multiCall({ abi: 'uint256:totalAssets', calls: addresses.vaults }), + ]) - if (ethManagementWindow === true) { - const ethSnapshot = (await sdk.api.abi.call({ - target: addresses.ethVaultV3, - abi: abi.totalAssets, - block, - chain - })).output; - sdk.util.sumSingleBalance(balances, "arbitrum:0x82af49447d8a07e3bd95bd0d56f35241523fbab1", ethSnapshot); - } else { - const ethBalance = (await sdk.api.eth.getBalance({ - target: addresses.ethVaultV3, - block, - chain - })).output; - sdk.util.sumSingleBalance(balances, "arbitrum:0x82af49447d8a07e3bd95bd0d56f35241523fbab1", ethBalance); - } - - for (let i = 0; i < 3; i++) { - let temp = (await sdk.api.abi.call({ - target: dopexFarms[i], - abi: abi.balanceOf, - params: metaVaultsAddresses[i], - block, - chain - })).output; + const uvrtBalance = await sdk.api.erc20.balanceOf({ + target: addresses.trackers.uvert.token, + owner: addresses.jonesGlpVaultRouter, + chain: 'arbitrum', + block: chainBlocks['arbitrum'] + }).then(result => result.output) - await unwrapUniswapLPs( - balances, - [ - { - balance: temp, - token: slps[i] - } - ], - block, - chain, - transformAddress - ); + const toa = [] - let dpxEthBalance = (await sdk.api.abi.call({ - target: addresses.dpxEthSlp, - abi: abi.balanceOf, - params: strategyStorageContractsDpxEth[i], - block, - chain - })).output; + api.addTokens(tokens,bals) + api.addTokens(vAssets,vBals) + api.addToken(addresses.trackers.uvert.token, uvrtBalance) + Object.values(addresses.trackers).map(tracker => toa.push([tracker.token, tracker.holder])) + toa.push([addresses.glp, addresses.strategy,]) - await unwrapUniswapLPs( - balances, - [ - { - balance: dpxEthBalance, - token: addresses.dpxEthSlp - } - ], - block, - chain, - transformAddress - ); - - let rdpxEthBalance = (await sdk.api.abi.call({ - target: addresses.rdpxEthSlp, - abi: abi.balanceOf, - params: strategyStorageContractsRdpxEth[i], - block, - chain - })).output; - - await unwrapUniswapLPs( - balances, - [ - { - balance: rdpxEthBalance, - token: addresses.rdpxEthSlp - } - ], - block, - chain, - transformAddress - ); - } - - const vaultManagementWindows = (await sdk.api.abi.multiCall({ - calls: addresses.vaultandCollateral.map(p => ({ - target: p[0] - })), - abi: abi.state, - block, - chain - })).output; + return sumTokens2({ api, tokensAndOwners: toa, }); +} - const vaultSnapshots = (await sdk.api.abi.multiCall({ - calls: addresses.vaultandCollateral.map(p => ({ - target: p[0] - })), - abi: abi.snapshotAssetBalance, - block, - chain - })).output; - - const vaultBalances = (await sdk.api.abi.multiCall({ - calls: addresses.vaultandCollateral.map(p => ({ - target: p[1], - params: p[0] - })), - abi: "erc20:balanceOf", - block, - chain - })).output; +async function tvl_ethereum(timestamp, block, chainBlocks, { api }) { + const balances = {} - const vaultAssetBalances = (await sdk.api.abi.multiCall({ - calls: addresses.vaultandCollateral.map(p => ({ - target: p[0] - })), - abi: abi.snapshotAssetBalance, - block, - chain - })).output; + const leftoverStrategy = await sdk.api.erc20.balanceOf({ + target: AURA, + owner: jAuraStrategy, + chain: 'ethereum', + block: chainBlocks['ethereum'] + }).then(result => result.output) + sdk.util.sumSingleBalance(balances, AURA, leftoverStrategy) - for (let i = 0; i < addresses.vaultandCollateral.length; i++) { - if (vaultManagementWindows[i].output === true) { - sdk.util.sumSingleBalance(balances, `arbitrum:${addresses.vaultandCollateral[i][1]}`, vaultSnapshots[i].output); - } else if (vaultAssetBalances[i].success === true) { - sdk.util.sumSingleBalance(balances, `arbitrum:${addresses.vaultandCollateral[i][1]}`, vaultAssetBalances[i].output); - } else { - sdk.util.sumSingleBalance(balances, `arbitrum:${addresses.vaultandCollateral[i][1]}`, vaultBalances[i].output); - } - } + const lockedBalance = await sdk.api.abi.call({ + abi: lockerABI.at(0), + target: AURALocker, + params: jAuraStrategy, + chain: 'ethereum', + block: chainBlocks['ethereum'] + }).then(result => result.output[0]) + sdk.util.sumSingleBalance(balances, AURA, lockedBalance) - return balances; + return balances; } module.exports = { - misrepresentedTokens: true, - arbitrum: { - tvl, - pool2: pool2s(addresses.lpStaking, addresses.lps, "arbitrum", addr=>{ - addr = addr.toLowerCase(); - if (jTokenToToken[addr] !== undefined) { - return jTokenToToken[addr]; - } - return `arbitrum:${addr}`; - }), - staking: stakings(addresses.jonesStaking, addresses.jones, "arbitrum") - } -} \ No newline at end of file + arbitrum: { + tvl, + pool2: pool2s(addresses.lpStaking, addresses.lps, "arbitrum", addr => { + addr = addr.toLowerCase(); + if (jTokenToToken[addr] !== undefined) { + return jTokenToToken[addr]; + } + return `arbitrum:${addr}`; + }), + staking: stakings(addresses.jonesStaking, addresses.jones) + }, + ethereum: { + tvl: tvl_ethereum + } +} +// node test.js projects/jones-dao/index.js \ No newline at end of file diff --git a/projects/jones-dao/locked.json b/projects/jones-dao/locked.json new file mode 100644 index 00000000000..32a964f6ed1 --- /dev/null +++ b/projects/jones-dao/locked.json @@ -0,0 +1,48 @@ +[ + { + "inputs": [ + { + "internalType": "address", + "name": "_user", + "type": "address" + } + ], + "name": "lockedBalances", + "outputs": [ + { + "internalType": "uint256", + "name": "total", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "unlockable", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "locked", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint112", + "name": "amount", + "type": "uint112" + }, + { + "internalType": "uint32", + "name": "unlockTime", + "type": "uint32" + } + ], + "internalType": "struct AuraLocker.LockedBalance[]", + "name": "lockData", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + } +] \ No newline at end of file diff --git a/projects/joystickclub/index.js b/projects/joystickclub/index.js index b680ab93896..992883c4db2 100644 --- a/projects/joystickclub/index.js +++ b/projects/joystickclub/index.js @@ -8,19 +8,7 @@ const JOYBOT_STAKING_CONTRACT = "0x498B8524c7C309471b65aEAC4f16551776B80e0F" const staking = async (timestamp, ethBlock, {[chain]: block}) => { const total = (await sdk.api.abi.call({ target: JOYBOT_STAKING_CONTRACT, - abi: { - "inputs": [], - "name": "_totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, + abi: "uint256:_totalSupply", chain, block })).output diff --git a/projects/jpeg-d/helper/abis.js b/projects/jpeg-d/helper/abis.js index 6f3ce1525a0..1eb21f53066 100644 --- a/projects/jpeg-d/helper/abis.js +++ b/projects/jpeg-d/helper/abis.js @@ -1,44 +1,43 @@ -const VAULT_ABI = [{ - "inputs": [], - "name": "totalPositions", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - },{ - "inputs": [], - "name": "nftValueProvider", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" -}]; +const VAULT_ABI = { + totalPositions: "uint256:totalPositions", + nftValueProvider: "address:nftValueProvider", + positionOwner: "function positionOwner(uint256) view returns (address)", + openPositionIndices: + "function openPositionsIndexes() external view returns (uint256[] memory)", +}; + +const STRATEGY_ABI = { + depositAddress: + "function depositAddress(address) external view returns (address)", + isDeposited: + "function isDeposited(address, uint256) external view returns (bool)", +}; + +const APE_STAKING = { + stakedTotal: "function stakedTotal(address) external view returns (uint256)", +}; -const VALUE_PROVIDER_ABI = [{ - "inputs": [], - "name": "getFloorETH", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" -}] +const P2P_APE_STAKING_ABI = { + nextNonce: "function nextNonce() external view returns (uint256)", + offers: "function offers(uint24) view returns (uint8 offerType, tuple(uint8 collection, uint16 tokenId) mainNft, uint16 bakcTokenId, uint80 apeAmount, uint16 apeRewardShareBps, uint16 bakcRewardShareBps, bool isPaired, uint80 lastSingleStakingRewardPerShare)" +}; + +const ERC721 = { + tokenOfOwnerByIndex: + "function tokenOfOwnerByIndex(address owner, uint256 index) view returns (uint256)", +}; + +const PROVIDER_ABI = { + nftType: "function nftTypes(uint256) view returns (bytes32)", + nftTypeValueMultiplier: + "function nftTypeValueMultiplier(bytes32) view returns (uint128 numerator, uint128 denominator)", +}; module.exports = { - VAULT_ABI, - VALUE_PROVIDER_ABI + VAULT_ABI, + P2P_APE_STAKING_ABI, + PROVIDER_ABI, + STRATEGY_ABI, + APE_STAKING, + ERC721, }; diff --git a/projects/jpeg-d/helper/addresses.js b/projects/jpeg-d/helper/addresses.js new file mode 100644 index 00000000000..282b30da451 --- /dev/null +++ b/projects/jpeg-d/helper/addresses.js @@ -0,0 +1,140 @@ +// NFT pUSD vaults +const CRYPTO_PUNK_PUSD_VAULT = "0xD636a2fC1C18A54dB4442c3249D5e620cf8fE98F"; +const ETHER_ROCKS_PUSD_VAULT = "0x6837a113aa7393ffbd5f7464e7313593cd2dd560"; +const BAYC_PUSD_VAULT = "0x271c7603aaf2bd8f68e8ca60f4a4f22c4920259f"; +const MAYC_PUSD_VAULT = "0x7b179f9bfbe50cfa401c1cdde3cb2c339c6635f3"; +const DOODLES_PUSD_VAULT = "0x0a36f4bf39ed7d4718bd1b8dd759c19986ccd1a7"; +const PUDGY_PENGUINS_PUSD_VAULT = "0xe793eaedc048b7441ed61b51acb5df107af996c2"; +const AZUKI_PUSD_VAULT = "0x2acd96c8db23978a3dd32448a2477b132b4436e4"; +const CLONEX_PUSD_VAULT = "0xc001f165f7d7542d22a1e82b4640512034a91c7d"; +const AUTOGLYPH_PUSD_VAULT = "0xf42366f60ccc0f454b505fd72fb070e7f23b8171"; +const FIDENZA_PUSD_VAULT = "0x64979eA0e4C7EB440402Fef273483ec8e74146d0"; +const RINGERS_PUSD_VAULT = "0xa699e2f651861ec68e74fe01017ade75a12d5c1b"; +const SQUIGGLES_PUSD_VAULT = "0x266d98307469f86f134ab884afefa98d3b4835b1"; +const OTHERDEED_PUSD_VAULT = "0x09765190845c35fb81efd6952e19c995f6bd6a72"; +const MEEBITS_PUSD_VAULT = "0xf7Fa42b692b8132311B02F9d72af69f9587c447E"; +const BAKC_PUSD_VAULT = "0x3A90dB2E3392A26904da1aA632B4C26A824d296e"; +const MILADY_PUSD_VAULT = "0xDc6634879CEf6eD24EF0273DaA4a12b34e3D09Cc"; + +// NFT pETH vaults +const CRYPTO_PUNK_PETH_VAULT = "0x4e5f305bfca77b17f804635a9ba669e187d51719"; +const CRYPTO_PUNK_PETH_VAULT_B = "0x80711bacf6b3E64deDC4eBA2Ecf9b0Be6c0946f9"; +const ETHER_ROCKS_PETH_VAULT = "0x7Bc8c4D106f084304d6c224F48AC02e6854C7AC5"; +const BAYC_PETH_VAULT = "0xaf5e4c1bfac63e355cf093eea3d4aba138ea4089"; +const BAYC_PETH_VAULT_B = "0xc7848C3E15D0b23a38571c39F98893a056e59A65"; +const MAYC_PETH_VAULT = "0xc45775baa4a6040414f3e199767033257a2a91b9"; +const MAYC_PETH_VAULT_B = "0xe45640363024f6668Aab1D5a0A7545441c2c28DD"; +const DOODLES_PETH_VAULT = "0x229e09d943a94c162a662ba0ffbcad21521b477a"; +const PUDGY_PENGUINS_PETH_VAULT = "0x4b94b38bec611a2c93188949f017806c22097e9f"; +const AZUKI_PETH_VAULT = "0x72695c2af4193029e0669f2c01d84b619d8c25e7"; +const AZUKI_PETH_VAULT_B = "0xaaf36574e4c5b4aC152D350f7687adB661aC3558"; +const CLONEX_PETH_VAULT = "0x46db8fda0be00e8912bc28357d1e28e39bb404e2"; +const AUTOGLYPH_PETH_VAULT = "0xCFd74e932B49eEf26f6527091821aDa8A9A4CbDa"; +const FIDENZA_PETH_VAULT = "0x9C1DceD6C1668c4159cf71C41f54F0fb9C2Dc9Dc"; +const RINGERS_PETH_VAULT = "0x9895a329e1f8F7728a2e60F45Ef017565DdCB535"; +const SQUIGGLES_PETH_VAULT = "0x2a8d4e3bb2e09541bf5d79a1cf8b9dd2b3a1c6ab"; +const OTHERDEED_PETH_VAULT = "0x525a3999b65a7d06dbe1de9b0b5faab1dc72e83c"; +const MEEBITS_PETH_VAULT = "0xD5a4FF073fB6BA54B52CEC0747a69a2EBeD08D3F"; +const BAKC_PETH_VAULT = "0xBF3624e8E72737d632C27eaF814668200F3B0e09"; +const MILADY_PETH_VAULT = "0xdda32416E87c475A0bCBc6C2e74190e7c49c1E5f"; + +const VAULTS_ADDRESSES = [ + // pUSD vaults + CRYPTO_PUNK_PUSD_VAULT, + BAYC_PUSD_VAULT, + MAYC_PUSD_VAULT, + DOODLES_PUSD_VAULT, + PUDGY_PENGUINS_PUSD_VAULT, + AZUKI_PUSD_VAULT, + ETHER_ROCKS_PUSD_VAULT, + CLONEX_PUSD_VAULT, + AUTOGLYPH_PUSD_VAULT, + FIDENZA_PUSD_VAULT, + RINGERS_PUSD_VAULT, + SQUIGGLES_PUSD_VAULT, + OTHERDEED_PUSD_VAULT, + MEEBITS_PUSD_VAULT, + BAKC_PUSD_VAULT, + MILADY_PUSD_VAULT, + // pETH vaults + CRYPTO_PUNK_PETH_VAULT, + CRYPTO_PUNK_PETH_VAULT_B, + BAYC_PETH_VAULT, + BAYC_PETH_VAULT_B, + MAYC_PETH_VAULT, + MAYC_PETH_VAULT_B, + DOODLES_PETH_VAULT, + PUDGY_PENGUINS_PETH_VAULT, + AZUKI_PETH_VAULT, + AZUKI_PETH_VAULT_B, + ETHER_ROCKS_PETH_VAULT, + CLONEX_PETH_VAULT, + AUTOGLYPH_PETH_VAULT, + FIDENZA_PETH_VAULT, + RINGERS_PETH_VAULT, + SQUIGGLES_PETH_VAULT, + OTHERDEED_PETH_VAULT, + MEEBITS_PETH_VAULT, + BAKC_PETH_VAULT, + MILADY_PETH_VAULT, +]; + +const BAYC_VAULTS = [BAYC_PUSD_VAULT, BAYC_PETH_VAULT, BAYC_PETH_VAULT]; +const MAYC_VAULTS = [MAYC_PUSD_VAULT, MAYC_PETH_VAULT, MAYC_PETH_VAULT_B]; +const P2P_APE_STAKING = "0xD4b06218C545C047ac3ACc7cE49d124C172DB409"; +const BAYC_APE_STAKING_STRATEGY = "0x6b2e47560CC810C2Dce3bf2C0Da4310eC0af8831"; +const MAYC_APE_STAKING_STRATEGY = "0x6b2e47560CC810C2Dce3bf2C0Da4310eC0af8831"; +const APE_STAKING = "0x5954aB967Bc958940b7EB73ee84797Dc8a2AFbb9"; +const APE = "0x4d224452801aced8b2f0aebe155379bb5d594381"; + +const PETH_ETH_PAIR = "0x9848482da3Ee3076165ce6497eDA906E66bB85C5"; +const PETH_ETH_VAULT = "0x56D1b6Ac326e152C9fAad749F1F4f9737a049d46"; +const LP_STAKING = "0xb271d2c9e693dde033d97f8a3c9911781329e4ca"; +const JPEG = "0xE80C0cd204D654CEbe8dd64A4857cAb6Be8345a3"; +const JPEG_WETH_SLP = "0xdb06a76733528761eda47d356647297bc35a98bd"; +const STAKING_CONTRACT = "0x3eed641562ac83526d7941e4326559e7b607556b"; + +const helperToNftMapping = { + "0x810fdbc7e5cfe998127a1f2aa26f34e64e0364f4": + "0xb7f7f6c52f2e2fdb1963eab30438024864c313f6", + "0x2be665ee27096344b8f015b1952d3dfdb4db4691": + "0xb7f7f6c52f2e2fdb1963eab30438024864c313f6", + "0x3c5c66f30ce8a66bf6a1c81ca415b6c1c9eeb71e": + "0xb7f7f6c52f2e2fdb1963eab30438024864c313f6", + "0x1de562b03184521f9a699e9290a6d578cd32008d": + "0xa3f5998047579334607c47a6a2889bf87a17fc02", + "0x3d4d8cbd9c1087e9463143cb9762c41f18ac0f03": + "0xa3f5998047579334607c47a6a2889bf87a17fc02", +}; + +const artBlockOwners = new Set( + [ + "0x0d3ac0aba8efb92222bc050509a0c8d2fbfe6489", + "0x126e6da0caefeaf104c6b9d022394a42567d9a38", + "0x14774cf533e38a2c568287228c5ef9fd9bd6a0bf", + "0x9E208146A28A653f6212d2931f316932015A312b", + ].map((i) => i.toLowerCase()) +); + +module.exports = { + VAULTS_ADDRESSES, + BAYC_VAULTS, + MAYC_VAULTS, + P2P_APE_STAKING, + BAYC_APE_STAKING_STRATEGY, + MAYC_APE_STAKING_STRATEGY, + APE_STAKING, + APE, + JPEG, + STAKING_CONTRACT, + JPEG_WETH_SLP, + PETH_ETH_PAIR, + PETH_ETH_VAULT, + LP_STAKING, + PETH_ETH_F: "0x56D1b6Ac326e152C9fAad749F1F4f9737a049d46", + PETH_POOL: "0x9848482da3ee3076165ce6497eda906e66bb85c5", + PUSD_USD_F: "0xF6Cbf5e56a8575797069c7A7FBED218aDF17e3b2", + USD_POOL: "0x8ee017541375f6bcd802ba119bddc94dad6911a1", + helperToNftMapping, + artBlockOwners, +}; diff --git a/projects/jpeg-d/helper/index.js b/projects/jpeg-d/helper/index.js index 5826551e0f5..2ca5ed7c02b 100644 --- a/projects/jpeg-d/helper/index.js +++ b/projects/jpeg-d/helper/index.js @@ -1,121 +1,182 @@ -const sdk = require("@defillama/sdk"); +const { sumTokens2, nullAddress } = require("../../helper/unwrapLPs"); const abi = require("./abis"); -const { sumTokens } = require("../../helper/unwrapLPs"); - -// Treasury -const TREASURY = "0x51C2cEF9efa48e08557A361B52DB34061c025a1B"; - -// Tokens -const WETH = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"; -const USDC = "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"; -const DAI = "0x6b175474e89094c44da98b954eedeac495271d0f"; -const USDT = "0xdac17f958d2ee523a2206206994597c13d831ec7"; -const TUSD = "0x0000000000085d4780B73119b644AE5ecd22b376"; - -// NFT pUSD vaults -const CRYPTO_PUNK_PUSD_VAULT = "0xD636a2fC1C18A54dB4442c3249D5e620cf8fE98F"; -const ETHER_ROCKS_PUSD_VAULT = "0x6837a113aa7393ffbd5f7464e7313593cd2dd560"; -const BAYC_PUSD_VAULT = "0x271c7603aaf2bd8f68e8ca60f4a4f22c4920259f"; -const MAYC_PUSD_VAULT = "0x7b179f9bfbe50cfa401c1cdde3cb2c339c6635f3"; -const DOODLES_PUSD_VAULT = "0x0a36f4bf39ed7d4718bd1b8dd759c19986ccd1a7"; -const PUDGY_PENGUINS_PUSD_VAULT = "0xe793eaedc048b7441ed61b51acb5df107af996c2"; -const AZUKI_PUSD_VAULT = "0x2acd96c8db23978a3dd32448a2477b132b4436e4"; -const CLONEX_PUSD_VAULT = "0xc001f165f7d7542d22a1e82b4640512034a91c7d"; - -// NFT pETH vaults -const CRYPTO_PUNK_PETH_VAULT = "0x4e5f305bfca77b17f804635a9ba669e187d51719"; -const ETHER_ROCKS_PETH_VAULT = "0x7Bc8c4D106f084304d6c224F48AC02e6854C7AC5"; -const BAYC_PETH_VAULT = "0xaf5e4c1bfac63e355cf093eea3d4aba138ea4089"; -const MAYC_PETH_VAULT = "0xc45775baa4a6040414f3e199767033257a2a91b9"; -const DOODLES_PETH_VAULT = "0x229e09d943a94c162a662ba0ffbcad21521b477a"; -const PUDGY_PENGUINS_PETH_VAULT = "0x4b94b38bec611a2c93188949f017806c22097e9f"; -const AZUKI_PETH_VAULT = "0x72695c2af4193029e0669f2c01d84b619d8c25e7"; -const CLONEX_PETH_VAULT = "0x46db8fda0be00e8912bc28357d1e28e39bb404e2"; - -const VAULT_ARRAY = [ - CRYPTO_PUNK_PUSD_VAULT, - BAYC_PUSD_VAULT, - MAYC_PUSD_VAULT, - DOODLES_PUSD_VAULT, - PUDGY_PENGUINS_PUSD_VAULT, - AZUKI_PUSD_VAULT, - ETHER_ROCKS_PUSD_VAULT, - CLONEX_PUSD_VAULT, - CRYPTO_PUNK_PETH_VAULT, - BAYC_PETH_VAULT, - MAYC_PETH_VAULT, - DOODLES_PETH_VAULT, - PUDGY_PENGUINS_PETH_VAULT, - AZUKI_PETH_VAULT, - ETHER_ROCKS_PETH_VAULT, - CLONEX_PETH_VAULT, -]; - -async function getTVL(balances, chain, timestamp, chainBlocks) { - // Fetch positions from vaults - const { output: positions } = await sdk.api.abi.multiCall({ - calls: VAULT_ARRAY.map((address) => ({ - target: address, - })), - abi: abi.VAULT_ABI.find( - (a) => a.name === "totalPositions" - ), - block: chainBlocks[chain], - chain, - }) - - const { output: valueProviders } = await sdk.api.abi.multiCall({ - calls: VAULT_ARRAY.map((address) => ({ - target: address, - })), - abi: abi.VAULT_ABI.find( - (a) => a.name === "nftValueProvider" - ), - block: chainBlocks[chain], - chain, - }) - - // Fetch floor prices from price feeds set in the vaults - const { output: floorPrices } = await sdk.api.abi.multiCall({ - calls: valueProviders.map((item) => ({ - target: item.output, - })), - abi: abi.VALUE_PROVIDER_ABI.find( - (a) => a.name === "getFloorETH" - ), - block: chainBlocks[chain], - chain, - }) - - // Calculate total TVL in ETH terms - let collateralValueETH = 0; - for (let i = 0; i < positions.length; i++) { - const floorPrice = floorPrices[i].output; - const position = positions[i].output; - collateralValueETH += position * floorPrice; - } - - sdk.util.sumSingleBalance(balances, `${chain}:${WETH}`, collateralValueETH); - return balances; +const { + VAULTS_ADDRESSES, + BAYC_VAULTS, + MAYC_VAULTS, + BAYC_APE_STAKING_STRATEGY, + MAYC_APE_STAKING_STRATEGY, + APE_STAKING, + P2P_APE_STAKING, + STAKING_CONTRACT, + APE, + JPEG, + PETH_POOL, + USD_POOL, + PETH_ETH_F, + PUSD_USD_F, + artBlockOwners, + LP_STAKING, + helperToNftMapping, +} = require("./addresses"); + +/** + * + * @returns JPEG'd deposit addresses for APE Staking + */ +async function getApeDepositAddresses(api) { + const [baycPositionIndices, maycPositionIndices] = await Promise.all([ + api.multiCall({ + abi: abi.VAULT_ABI.openPositionIndices, + calls: BAYC_VAULTS, + }), + api.multiCall({ + abi: abi.VAULT_ABI.openPositionIndices, + calls: MAYC_VAULTS, + }), + ]); + + const [baycOwners, maycOwners] = await Promise.all([ + api.multiCall({ + abi: abi.VAULT_ABI.positionOwner, + calls: baycPositionIndices + .map((vaultIndices, i) => + vaultIndices.map((nftIndex) => ({ + target: BAYC_VAULTS[i], + params: [nftIndex.toString()], + })) + ) + .flat(), + }), + api.multiCall({ + abi: abi.VAULT_ABI.positionOwner, + calls: maycPositionIndices + .map((vaultIndices, i) => + vaultIndices.map((nftIndex) => ({ + target: MAYC_VAULTS[i], + params: [nftIndex.toString()], + })) + ) + .flat(), + }), + ]); + + const [baycDepositAddresses, maycDepositAddresses] = await Promise.all([ + api.multiCall({ + abi: abi.STRATEGY_ABI.depositAddress, + calls: [...new Set(baycOwners)].map((owner) => ({ + target: BAYC_APE_STAKING_STRATEGY, + params: [owner], + })), + }), + api.multiCall({ + abi: abi.STRATEGY_ABI.depositAddress, + calls: [...new Set(maycOwners)].map((owner) => ({ + target: MAYC_APE_STAKING_STRATEGY, + params: [owner], + })), + }), + ]); + + return Array.from(new Set(baycDepositAddresses)).concat( + Array.from(new Set(maycDepositAddresses)) + ); +} + +/** + * @returns the amount of JPEG locked on JPEG'd (trait or ltv boosts) + */ +async function stakingJPEGD(_, _1, _2, { api }) { + const providersAddresses = await api.multiCall({ + abi: "address:nftValueProvider", + calls: VAULTS_ADDRESSES, + }); + + providersAddresses.push(STAKING_CONTRACT); + + return sumTokens2({ owners: providersAddresses, tokens: [JPEG], api }); +} + +/** + * @returns the amount of $APE tokens staked on JPEG'd + */ +async function getStakedApeAmount(api) { + const [apeDepositAddresses, lastNonce] = await Promise.all([ + getApeDepositAddresses(api), + api.call({ + target: P2P_APE_STAKING, + abi: abi.P2P_APE_STAKING_ABI.nextNonce, + }), + ]); + + const [apeStakes, offers] = await Promise.all([ + api.multiCall({ + abi: abi.APE_STAKING.stakedTotal, + target: APE_STAKING, + calls: apeDepositAddresses, + }), + api.multiCall({ + abi: abi.P2P_APE_STAKING_ABI.offers, + target: P2P_APE_STAKING, + calls: new Array(Number(lastNonce)).fill(null).map((_, i) => i), + }), + ]); + + apeStakes.forEach((v) => api.add(APE, v)); + offers.forEach((v) => api.add(APE, v.apeAmount)); +} + +async function vaultsTvl(api) { + // Fetch positions from vaults + const positions = await api.multiCall({ + calls: VAULTS_ADDRESSES, + abi: abi.VAULT_ABI.totalPositions, + }); + let tokens = await api.multiCall({ + abi: "address:nftContract", + calls: VAULTS_ADDRESSES, + }); + tokens = tokens.map((i) => i.toLowerCase()); + const transform = (t) => helperToNftMapping[t.toLowerCase()] || t; + + tokens.forEach((v, i) => { + if (artBlockOwners.has(v)) return; + api.add(transform(v), positions[i]); + }); +} + +async function autocompoundingTvl(api) { + const curveBalApi = "function balances(uint256) view returns (uint256)"; + const [ + ethInPETHFactory, + pethGaugeSupply, + pethGaugeBalance, + usdInPUSDFactory, + pusdGaugeSupply, + pusdGaugeBalance, + ] = await api.batchCall([ + { target: PETH_POOL, abi: curveBalApi, params: [0] }, + { target: PETH_POOL, abi: "erc20:totalSupply" }, + { target: PETH_ETH_F, abi: "erc20:balanceOf", params: [LP_STAKING] }, + { target: USD_POOL, abi: curveBalApi, params: [1] }, + { target: USD_POOL, abi: "erc20:totalSupply" }, + { target: PUSD_USD_F, abi: "erc20:balanceOf", params: [LP_STAKING] }, + ]); + + api.add(nullAddress, (ethInPETHFactory * pethGaugeSupply) / pethGaugeSupply); + api.add( + "0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490", + (usdInPUSDFactory * pusdGaugeBalance) / pusdGaugeSupply + ); } -async function getTreasury(balances, chain, timestamp, chainBlocks) { - await sumTokens( - balances, - [ - [WETH, TREASURY], - [USDC, TREASURY], - [DAI, TREASURY], - [USDT, TREASURY], - [TUSD, TREASURY], - ], - chainBlocks[chain] - ); - - return balances; +async function tvl(ts, b, cb, { api }) { + await Promise.all([ + getStakedApeAmount(api), + vaultsTvl(api), + autocompoundingTvl(api), + sumTokens2({ api, resolveArtBlocks: true, owners: [...artBlockOwners] }), + ]); } -module.exports = { - getTVL, - getTreasury, -}; +module.exports = { tvl, stakingJPEGD }; diff --git a/projects/jpeg-d/index.js b/projects/jpeg-d/index.js index 00c1beb15ef..0637c369239 100644 --- a/projects/jpeg-d/index.js +++ b/projects/jpeg-d/index.js @@ -1,30 +1,18 @@ -const { staking } = require("../helper/staking") -const { pool2 } = require("../helper/pool2") -const { getTVL, getTreasury } = require("./helper/index") - -const JPEG = "0xe80c0cd204d654cebe8dd64a4857cab6be8345a3" -const JPEG_WETH_SLP = "0xdb06a76733528761eda47d356647297bc35a98bd" -const staking_contract = "0x3eed641562ac83526d7941e4326559e7b607556b" - -async function tvl(timestamp, block, chainBlocks) { - const balances = {}; - await getTVL(balances, "ethereum", timestamp, chainBlocks); - return balances; -} - -async function treasury(timestamp, block, chainBlocks) { - const balances = {}; - await getTreasury(balances, "ethereum", timestamp, chainBlocks); - return balances; -} +const { staking } = require("../helper/staking"); +const { tvl, stakingJPEGD } = require("./helper/index"); +const { LP_STAKING, JPEG_WETH_SLP } = require("./helper/addresses"); module.exports = { - misrepresentedTokens: true, methodology: `Counts the floor value of all NFTs supplied in the protocol vaults`, ethereum: { tvl, - treasury, - staking: staking(staking_contract, JPEG, "ethereum"), - pool2: pool2(staking_contract, JPEG_WETH_SLP, "ethereum"), - } -} + staking: stakingJPEGD, + pool2: staking(LP_STAKING, [JPEG_WETH_SLP]), + }, + hallmarks: [ + [1666003500, "pETH borrows"], + [1669551000, "JPEG LTV boost"], + [1683662400, "P2P Ape Staking"], + [1690730000, "pETH-ETH Curve pool drained"], + ], +}; diff --git a/projects/jswap-finance/index.js b/projects/jswap-finance/index.js index c91b1038915..bce3153e227 100644 --- a/projects/jswap-finance/index.js +++ b/projects/jswap-finance/index.js @@ -7,7 +7,6 @@ module.exports = { okexchain: { tvl: getUniTVL({ factory, - chain: 'okexchain', useDefaultCoreAssets: true, }) }, diff --git a/projects/juggler-red/index.js b/projects/juggler-red/index.js index 317d2cf772a..036a004c3f7 100644 --- a/projects/juggler-red/index.js +++ b/projects/juggler-red/index.js @@ -4,7 +4,6 @@ module.exports = { misrepresentedTokens: true, optimism: { tvl: getUniTVL({ - chain: 'optimism', useDefaultCoreAssets: true, factory: '0x0bef94f16ce5b7c83b0bdbd9924cf80239ba9837', }), diff --git a/projects/juicebox-v1/index.js b/projects/juicebox-v1/index.js new file mode 100644 index 00000000000..ff731630f68 --- /dev/null +++ b/projects/juicebox-v1/index.js @@ -0,0 +1,24 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokens2 } = require('../helper/unwrapLPs') + +// V1 Juicebox Terminals +const Terminal_V1 = "0xd569D3CCE55b71a8a3f3C418c329A66e5f714431"; +const Terminal_v1_1 = "0x981c8ECD009E3E84eE1fF99266BF1461a12e5c68"; +// Tokens +const ETH = ADDRESSES.null + +module.exports = { + timetravel: true, + methodology: "Count the value of the Ether in the Juicebox V1 terminals", + ethereum: + { + start: 1626369243, // 2021-06-15 17:14:03 (UTC) + tvl: async (_, block) => sumTokens2({ + block, + tokensAndOwners: [ + [ETH, Terminal_V1], + [ETH, Terminal_v1_1], + ] + }) + } +}; diff --git a/projects/juicebox-v2/index.js b/projects/juicebox-v2/index.js new file mode 100644 index 00000000000..581e168f3ea --- /dev/null +++ b/projects/juicebox-v2/index.js @@ -0,0 +1,22 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokens2 } = require('../helper/unwrapLPs') + +// V2 Juicebox Terminals +const Terminal_V2 = "0x7Ae63FBa045Fec7CaE1a75cF7Aa14183483b8397"; +// Tokens +const ETH = ADDRESSES.null + +module.exports = { + timetravel: true, + methodology: "Count the value of the Ether in the Juicebox V2 terminal", + ethereum: + { + start: 1653853643, // 2022-05-29 19:47:23 (UTC) + tvl: async (_, block) => sumTokens2({ + block, + tokensAndOwners: [ + [ETH, Terminal_V2], + ] + }) + } +}; diff --git a/projects/juicebox-v3/index.js b/projects/juicebox-v3/index.js new file mode 100644 index 00000000000..278432b2639 --- /dev/null +++ b/projects/juicebox-v3/index.js @@ -0,0 +1,24 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokens2 } = require('../helper/unwrapLPs') + +// V3 Juicebox Terminals +const Terminal_V3 = "0x594Cb208b5BB48db1bcbC9354d1694998864ec63"; +const Terminal_V3_1 = "0xFA391De95Fcbcd3157268B91d8c7af083E607A5C"; +// Tokens +const ETH = ADDRESSES.null + +module.exports = { + timetravel: true, + methodology: "Count the value of the Ether in the Juicebox V3 terminals", + ethereum: + { + start: 1663679075, // 2022-10-20 15:04:35(UTC) + tvl: async (_, block) => sumTokens2({ + block, + tokensAndOwners: [ + [ETH, Terminal_V3], + [ETH, Terminal_V3_1], + ] + }) + } +}; diff --git a/projects/jujubefinance/index.js b/projects/jujubefinance/index.js new file mode 100644 index 00000000000..d1b233517a2 --- /dev/null +++ b/projects/jujubefinance/index.js @@ -0,0 +1,6 @@ +const { dexExport } = require('../helper/chain/aptos') + +module.exports = dexExport({ + account: '0x4a45434525e4fc243071250a449494d915719d2b3f9f7b92242196c7f2e88346', + poolStr: 'liquidity_pool::LiquidityPool', +}) diff --git a/projects/julswap/index.js b/projects/julswap/index.js index 846ef55844c..d088f68b082 100644 --- a/projects/julswap/index.js +++ b/projects/julswap/index.js @@ -4,7 +4,6 @@ module.exports = { misrepresentedTokens: true, bsc: { tvl: getUniTVL({ - chain: 'bsc', useDefaultCoreAssets: true, factory: '0x553990F2CBA90272390f62C5BDb1681fFc899675', }) diff --git a/projects/junoswap/index.js b/projects/junoswap/index.js index 8211ccfead8..f66a1e7d997 100644 --- a/projects/junoswap/index.js +++ b/projects/junoswap/index.js @@ -5,10 +5,9 @@ module.exports = { misrepresentedTokens: true, juno: { tvl: async () => { - const data = await get('https://api-junoswap.enigma-validator.com/summary/pools/current/') return { - tether: Object.values(data).reduce((a, i) => a + i.token_liquidity_usd, 0) + tether: 0 } } } -} \ No newline at end of file +} diff --git a/projects/jupiterswap/index.js b/projects/jupiterswap/index.js index 70c4c723db1..6c8dd3b9a59 100644 --- a/projects/jupiterswap/index.js +++ b/projects/jupiterswap/index.js @@ -1,12 +1,14 @@ const { getUniTVL } = require('../helper/unknownTokens') module.exports = { + hallmarks: [ + [1660521600, "incentives not given"] + ], misrepresentedTokens: true, methodology: "Factory addresses (0xc08BAEA14C14f25bcafe3e3E05550715505eF3dE for kava) is used to find the LP pairs. TVL is equal to the liquidity on the AMM.", kava: { tvl: getUniTVL({ factory: '0xc08BAEA14C14f25bcafe3e3E05550715505eF3dE', - chain: 'kava', useDefaultCoreAssets: true, }), } diff --git a/projects/justCryptos/index.js b/projects/justCryptos/index.js index f797f0f32e3..f01405e47a4 100644 --- a/projects/justCryptos/index.js +++ b/projects/justCryptos/index.js @@ -21,5 +21,8 @@ async function fetch(){ } module.exports = { + tron: { + fetch + }, fetch } \ No newline at end of file diff --git a/projects/justmoney/index.js b/projects/justmoney/index.js index 33027e6a5fe..af8ef28f6b1 100644 --- a/projects/justmoney/index.js +++ b/projects/justmoney/index.js @@ -1,116 +1,34 @@ -const sdk = require('@defillama/sdk') -const { getTokenBalance } = require('../helper/chain/tron') -const { getUniTVL, } = require('../helper/unknownTokens') - -const tokens = { - ACTIV: { 'address': 'TVoxBVmFuBM7dsRnfi1V8v1iupv4uyPifN', 'id': '_activ' }, - BBT: { 'address': 'TGyZUWrL97mmmYJwrC7ZCLVrhbzvHmmWPL', 'id': '_bbt' }, - BEMT: { 'address': 'TBp6ZMzkxci5o4sJjFa6Fo9Wy36gcubQLW', 'id': 'bem' }, - BTT: { 'address': 'TAFjULxiVgT4qWk6UZwjqwZXTSaGaqnVp4', 'id': 'bittorrent' }, - CREED: { 'address': 'TM2fhs1CFiS696VW13s3oBuDdPazCEGcfJ', 'id': '_creed' }, - CREEDX: { 'address': 'TQSC8P2nLsawUZHF6iMAD6KPH8HdJXFWYi', 'id': '_creedx' }, - CUBE: { 'address': 'TQxzbBVFRFUgHXnhyCRiatrkwX9BAJnHam', 'id': '_cube' }, - CYFM: { 'address': 'TZ5jA9F5zGRgi9qk9ATMu6D7wyEpnxQGJh', 'id': 'cyberfm' }, - ICR: { 'address': 'TKqvrVG7a2zJvQ3VysLoiz9ijuMNDehwy7', 'id': 'intercrone' }, - JM: { 'address': 'TVHH59uHVpHzLDMFFpUgCx2dNAQqCzPhcR', 'id': 'justmoney-2' }, - JST: { 'address': 'TCFLL5dx5ZJdKnWuesXxi1VPwjLVmWZZy9', 'id': 'just' }, - KLV: { 'address': 'TVj7RNVHy6thbM7BWdSe9G6gXwKhjhdNZS', 'id': 'klever' }, - KODX: { 'address': 'TTUwzoZAK6rpDjpSh8B2XFTnxGfbMLHJaq', 'id': 'kodx' }, - KTY: { 'address': 'TTroZqb95vmsw4kppupQ8tVEzkNDDP2bcG', 'id': '_kty' }, - LDA: { 'address': 'TNP1D18nJCqQHhv4i38qiNtUUuL5VyNoC1', 'id': '_lda' }, - LUMI: { 'address': 'TDBNKiYQ8yfJtT5MDP3byu7f1npJuG2DBN', 'id': 'lumi-credits' }, - NFT: { 'address': 'TFczxzPhnThNSqr5by8tvxsdCFRRz6cPNq', 'id': 'apenft' }, - NOLE: { 'address': 'TPt8DTDBZYfJ9fuyRjdWJr4PP68tRfptLG', 'id': '_nole' }, - OLDJM: { 'address': 'TT8VkSkW6igkiRsV5WiJgLrsbVwY5bLLjA', 'id': 'justmoney' }, - SafeMoney: { 'address': 'TNBrVEzuVYbNbGF2ua3ivSX5Y5V9N4xhax', 'id': 'safemoney' }, - SUN: { 'address': 'TSSMHYeV2uE9qYH95DqyoCuNCzEL1NvU3S', 'id': 'sun-token' }, - TBT: { 'address': 'TJpCQC2gJRAbqG9nuQHvzYBmCuYJQzP3SS', 'id': '_tbt' }, - TNT: { 'address': 'TL33cN6t22RcKyqPKkb14iVrPHDFaFMH7t', 'id': '_tnt' }, - TRX: { 'address': 'TNUC9Qb1rRpS5CbWLmNMxXBjyFoydXjWFR', 'id': 'tron' }, - turu: { 'address': 'TK8K7HFDLkhYS6XnFC8MKQkVK6Xq8D13qJ', 'id': '_turu' }, - TREX: { 'address': 'THyYjzy42cy83Nwg6pbsUTcV1GBrPPqGE5', 'id': '_trex' }, - TWJ: { 'address': 'TNq5PbSssK5XfmSYU4Aox4XkgTdpDoEDiY', 'id': '_twj' }, - USDD: { 'address': 'TPYmHEhy5n8TCEfYGqW2rPxsghSfzghPDn', 'id': 'usdd' }, - USDT: { 'address': 'TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t', 'id': 'tether' }, - USTX: { 'address': 'TYX2iy3i3793YgKU5vqKxDnLpiBMSa5EdV', 'id': '_ustx' }, - VBS: { 'address': 'TJRc6ZTMhHEPrWPtfsVvXW1mxHPLw1arZo', 'id': '_vbs' }, - WOX: { 'address': 'TYVFMntFj7xLMxp1CvuXwg9LpPw1dPwWhM', 'id': '_wox' }, - ZLF: { 'address': 'TXoPCbHtWTerfiNjFBpJdMQqQJoXoT87pq', 'id': '_zlf' }, -} - -const pairs = [ - [tokens.TRX, tokens.OLDJM, 'TFijK2dCUsrXoZM7PYhFqnM9F4Tac8uBJt'], - [tokens.TRX, tokens.USDT, 'TYA7DfE44XFsZEpBm7M2HAmEgU5kCtDDXg'], - [tokens.USDT, tokens.OLDJM, 'TSGv8is6ZMeHRwMQCvq6f16YFTLbw2bpmr'], - [tokens.SafeMoney, tokens.TRX, 'TTqB2CRJ2PF9qbCRkSVVGsFbx9mZUFNZS3'], - [tokens.NOLE, tokens.USDT, 'TEg25qPxj9zecferiUbf2Senqmbuae7p55'], - [tokens.TRX, tokens.SUN, 'TGzv3DHcsbxmCNj1Cd1W6P3Ao37fs2mot8'], - [tokens.LUMI, tokens.USDT, 'TWEee7dNN7Zc2M8f13M28KhBGrroVrdGxM'], - [tokens.BBT, tokens.TRX, 'TTFYn18KrMxpdoQCxsp5SYjmDgS6dDEQTv'], - [tokens.ICR, tokens.TRX, 'TTHoKhr85UiMPSHmdTukLkv3mAjjSdsiH5'], - [tokens.CREED, tokens.TRX, 'TVcbypQLttW96yHzBraXBVnhcKC7HDRSfD'], - [tokens.TRX, tokens.CREEDX, 'TN4BUph6ubYbmBDy2u9wpqoNg3DR1vrZRN'], - [tokens.USDT, tokens.CYFM, 'TYNTeRHHbqH4sm5GcrwhQqa89ZaBGipEuG'], - [tokens.USDT, tokens.KLV, 'TBB26dZsWFPDfYNyPWpD8LtdKCCRr3aDbY'], - [tokens.TRX, tokens.KTY, 'TGMgXjSEzf5h7qK7cMZPuvu4wAk9x21Vwu'], - [tokens.NFT, tokens.TRX, 'TQy4L8yguUXEsxUZmyrLfADgtwRhL6GgWH'], - [tokens.JST, tokens.TRX, 'TJAZ6MvFBUnRw8vVDvgvGRMWGzDVaS6eqr'], - [tokens.TNT, tokens.TRX, 'TFT7z2ELWzPuUeP8FgPTEAYe7syQ4TTYfo'], - [tokens.TRX, tokens.ZLF, 'TEwbxEXNd3P7fVP6v4W91mRhGCYeGUkEdE'], - [tokens.turu, tokens.TRX, 'TVBdRMsCnaNmY7jDVRm6VJxfeZZW3qKWoE'], - [tokens.TRX, tokens.KLV, 'TNMUT9h6zZDnxouGf1EfXQ4yt1nHhnM4Ae'], - [tokens.TWJ, tokens.USDT, 'TA95HcnsqfzKarHJzfB4V4JvrnZnqnBvWU'], - [tokens.BTT, tokens.TRX, 'TMz4JoDPUv8rgqUaZCkaSrH7kQ819z2Vd9'], - [tokens.TRX, tokens.ACTIV, 'TG2ZRTv3WX9cD53TEcTyjuuHd8pWCAg11X'], - [tokens.TRX, tokens.KODX, 'TL8wEwke3gGrnw4zEBxisSG2RxehZT7xXs'], - [tokens.BEMT, tokens.TRX, 'TWXEXQyEwSzSBENrWyiGu69Dd3yU8QREHV'], - [tokens.TRX, tokens.WOX, 'TG1CirSZHqQ3yGJBMfXHjBcWVctfihciQL'], - [tokens.TREX, tokens.TRX, 'TVzgLYrKSf2ZrPkWP7SbFXk6iKfR7PNHtR'], - [tokens.LDA, tokens.TRX, 'TDV1P9ZpN3VaE8Rti6PXDZ3gAWUNMbRfa2'], - [tokens.TRX, tokens.CUBE, 'TCqsrTUsBHBFoDRwjvjn6zooj6Cp6e1wUk'], - [tokens.TRX, tokens.JM, 'TR7SpMHzp5ZfsBedbXzQ5CJsqBmg8oxzzr'], - [tokens.USDT, tokens.JM, 'THTWV7R3U7XQsHWQt8YHgsqirvY9QttB7u'], - [tokens.USDD, tokens.USDT, 'TNR1gJVMjE47uZxCrQaQe1xat2uBs3jAHr'], - [tokens.TBT, tokens.TRX, 'TWwbk4ypVR6aKb2CS8TvERg1rxATUfWavP'], - [tokens.TRX, tokens.USTX, 'TUFeu1WbJwL4jCAyu9pcotuASnbxEUbphn'], - [tokens.BBT, tokens.VBS, 'TH6yNkvtthsPJLqVE1M8ri7zX9G7pi3fRR'], -] - -async function tronTvl() { - const balances = {} - - await Promise.all(pairs.map(addPairs)) - return balances - - async function addPairs([tokenA, tokenB, pool]) { - if (!tokenA.id.startsWith('_')) sdk.util.sumSingleBalance(balances, tokenA.id, await getTokenBalance(tokenA.address, pool)) - if (!tokenB.id.startsWith('_')) sdk.util.sumSingleBalance(balances, tokenB.id, await getTokenBalance(tokenB.address, pool)) - } -} +const { getUniTVL } = require('../helper/unknownTokens') module.exports = { bsc: { tvl: getUniTVL({ - chain: 'bsc', factory: '0xF2Fb1b5Be475E7E1b3C31082C958e781f73a1712', useDefaultCoreAssets: true, }), }, bittorrent: { tvl: getUniTVL({ - chain: 'bittorrent', factory: '0x4dEb2f0976DC3Bf351555524B3A24A4feA4e137E', useDefaultCoreAssets: true, }), }, + ethereum: { + tvl: getUniTVL({ + factory: '0xd36Aba9Ec96523b0A89886c76065852aDFE2Eb39', + useDefaultCoreAssets: true, + }), + }, polygon: { tvl: getUniTVL({ - chain: 'polygon', factory: '0xD36ABA9EC96523B0A89886C76065852ADFE2EB39', useDefaultCoreAssets: true, }), }, tron: { - tvl: tronTvl + tvl: getUniTVL({ + factory: 'TBfTeNjh7k8PbkTad8z6WS2vqh7SQZUfQ8', + useDefaultCoreAssets: true, + }), }, } diff --git a/projects/juststable/index.js b/projects/juststable/index.js index a7d6175d430..bbba4e37fb7 100644 --- a/projects/juststable/index.js +++ b/projects/juststable/index.js @@ -1,27 +1,9 @@ -const axios = require('axios') -const {getApiTvl} = require('../helper/historicalApi') -const { usdtAddress } = require('../helper/balances') - -async function tvl(timestamp){ - const balances = await getApiTvl(timestamp, async ()=>{ - const r = (await axios.get("https://abc.ablesdxd.link/scan/collInfo/timeLine")).data.data - return Number(r[r.length-1].wtrxLocked)/1e12 - }, async()=>{ - const r = await axios.get("https://abc.ablesdxd.link/scan/collInfo/timeLine") - // {liquidity: "0.000000000000000000", time: 1597492800000} - return r.data.data.map(d=>({ - date: d.t/1000, - totalLiquidityUSD: Number(d.wtrxLocked)/1e12 - })) - }); - return { - "tron": Number(balances[usdtAddress]) - } -} +const { sumTokensExport } = require('../helper/unwrapLPs'); +const ADDRESSES = require('../helper/coreAssets.json'); module.exports = { - timetravel: true, - tron:{ - tvl - } + timetravel: false, + tron: { + tvl: sumTokensExport({ owner: 'TRrY9fXGnfLmcp7ytkLmHiTpvYMHG6zUGF', tokens: [ADDRESSES.tron.WTRX] }) + } } diff --git a/projects/justyield/index.js b/projects/justyield/index.js new file mode 100644 index 00000000000..0251eed8b47 --- /dev/null +++ b/projects/justyield/index.js @@ -0,0 +1,18 @@ +const { yieldHelper } = require("../helper/unknownTokens"); +const { getConfig } = require('../helper/cache') + +const chain = "arbitrum"; +const tokenAPI = "address:want" + +module.exports = { + [chain]: { + tvl: async (_, _b, { [chain]: block }) => { + const pools = await getConfig('justyield-arbitrum', 'https://raw.githubusercontent.com/JustYield-Finance/DogeCompounderApi/main/arbitrum_vaults.json'); + const vaults = []; + for(var i = 0; i < pools.length; i++) + vaults.push(pools[i].earnedTokenAddress); + + return yieldHelper({ vaults, chain, block, tokenAPI, useDefaultCoreAssets: true, }) + } + } +} \ No newline at end of file diff --git a/projects/kaDefi/index.js b/projects/kaDefi/index.js new file mode 100644 index 00000000000..c38d70cbd09 --- /dev/null +++ b/projects/kaDefi/index.js @@ -0,0 +1,17 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require('../helper/unknownTokens'); + +const WkavaKafiLpAddress = "0xA4Bea6f776f483a304FD6980F8F8c861AB24DE07"; +const ERC20ContractWkavaAddress = ADDRESSES.kava.WKAVA; +const ERC20ContractKafiAddress = "0x7356deD08af181869B492fcd641f4aEfB74De3E7"; +const POL_Pool_One = "0xdf65B85E43dBa1F153325e7e4A0682B7DeBBFe0f"; +const POL_Pool_Two = "0x738d2b4b59A0A3AA4086bC44C40a45845bB73FCC"; + +module.exports = { + kava: { + tvl: sumTokensExport({ owners: [POL_Pool_One, POL_Pool_Two], tokens: [ERC20ContractWkavaAddress], }), + staking: sumTokensExport({ owners: [POL_Pool_One, POL_Pool_Two], tokens: [ERC20ContractKafiAddress], useDefaultCoreAssets: true, lps: [WkavaKafiLpAddress], }), + } +}; + + diff --git a/projects/kaco/index.js b/projects/kaco/index.js index 11f40009e3f..17ccace50d4 100644 --- a/projects/kaco/index.js +++ b/projects/kaco/index.js @@ -1,6 +1,7 @@ -const sdk = require("@defillama/sdk"); +const ADDRESSES = require('../helper/coreAssets.json') + const { getUniTVL } = require('../helper/unknownTokens') -const { calculateUniTvl } = require("../helper/calculateUniTvl.js"); +const { uniTvlExport } = require("../helper/calculateUniTvl.js"); const { staking, stakingUnknownPricedLP} = require("../helper/staking"); const KACMasterChefContract = { @@ -13,33 +14,8 @@ const KACFactory = { }; const KAC = { bsc: "0xf96429A7aE52dA7d07E60BE95A3ece8B042016fB", - shiden: "0xb12c13e66ade1f72f71834f2fc5082db8c091358", + shiden: ADDRESSES.harmony.AVAX, }; -async function bscTvl(timestamp, block, chainBlocks) { - return calculateUniTvl( - (addr) => `bsc:${addr}`, - chainBlocks["bsc"], - "bsc", - KACFactory["bsc"], - 0, - true - ); -} -async function poolsTvl(timestamp, ethBlock, chainBlocks) { - const balances = {}; - const stakedKAC = sdk.api.erc20.balanceOf({ - target: KAC["bsc"], - owner: KACMasterChefContract["bsc"], - chain: "bsc", - block: chainBlocks["bsc"], - }); - sdk.util.sumSingleBalance( - balances, - "bsc:" + KAC["bsc"], - (await stakedKAC).output - ); - return balances; -} module.exports = { misrepresentedTokens: true, @@ -47,7 +23,8 @@ module.exports = { "Fast growing Defi on BSC and Shiden! Fractionalize and farm NFTs.", bsc: { staking: stakingUnknownPricedLP("0x81b71D0bC2De38e37978E6701C342d0b7AA67D59", "0xf96429A7aE52dA7d07E60BE95A3ece8B042016fB", "bsc", "0x315F25Cea80AC6c039B86e79Ffc46aE6b2e30922", addr=>`bsc:${addr}`), - tvl: bscTvl, + + tvl: uniTvlExport(KACFactory.bsc, 'bsc', true), }, shiden: { staking: staking( diff --git a/projects/kaddex/index.js b/projects/kaddex/index.js index ad20100db35..9ae3ca91d3e 100644 --- a/projects/kaddex/index.js +++ b/projects/kaddex/index.js @@ -44,17 +44,17 @@ const pairTokens = { code: "mok.token", }, }, - "coin:lago.kwUSDC": { - name: "coin:lago.kwUSDC", - token0: { - name: "KDA", - code: "coin", - }, - token1: { - name: "USDC", - code: "lago.kwUSDC", - }, - }, + // "coin:lago.kwUSDC": { + // name: "coin:lago.kwUSDC", + // token0: { + // name: "KDA", + // code: "coin", + // }, + // token1: { + // name: "USDC", + // code: "lago.kwUSDC", + // }, + // }, "coin:kaddex.kdx": { name: "coin:kaddex.kdx", token0: { diff --git a/projects/kafefinance/index.js b/projects/kafefinance/index.js index 4c86323acc1..8cac57320e7 100644 --- a/projects/kafefinance/index.js +++ b/projects/kafefinance/index.js @@ -1,49 +1,3 @@ -const utils = require("../helper/utils"); -const {toUSDTBalances} = require("../helper/balances"); -// Please refer to Github(https://github.com/kukafe/kafe-defillama/tree/main/kafe-defillama) for the codes to calculate the TVL via on-chain calls -const apiUrl = "http://142.93.53.244:5001/getTvl"; - -let responseData -async function fetchChain(chain, includePool2) { - let totalTvl = 0; - if (!responseData) responseData = utils.fetchURL(apiUrl) - let response = (await responseData).data; - Object.keys(response).forEach((key) => { - let entry = response[key]; - if (entry.chain !== chain) return; - if (includePool2 == false) { - if (key.startsWith("KAFE")) return; - } else { - if (!key.startsWith("KAFE")) return; - if (key.startsWith("KAFE") && key.endsWith("KAFE")) return; - } - totalTvl = totalTvl + Number(entry.TVL); - }); - return toUSDTBalances(Math.round(totalTvl)); -} - -async function fetchCronos() { - return fetchChain("cronos", false); -} - -async function fetchMoonriver() { - return fetchChain("moonriver", false); -} - -async function fetchMoonRiverPool2() { - return fetchChain("moonriver", true); -} - -async function fetchMoonriverStaking() { - let response = (await utils.fetchURL(apiUrl)).data; - return toUSDTBalances(Math.round(Number(response["KAFE"].TVL))); -} - -async function fetch() { - let cronosTvl = await fetchChain("cronos", false); - let moonriverTvl = await fetchChain("moonriver", false); - return cronosTvl + moonriverTvl; -} module.exports = { misrepresentedTokens: true, @@ -53,7 +7,5 @@ module.exports = { }, moonriver: { tvl: () => ({}), - // staking: fetchMoonriverStaking, - // pool2: fetchMoonRiverPool2 }, } diff --git a/projects/kafidao/index.js b/projects/kafidao/index.js new file mode 100644 index 00000000000..e2b8c026364 --- /dev/null +++ b/projects/kafidao/index.js @@ -0,0 +1,4 @@ +const { masterchefExports } = require("../helper/unknownTokens"); + +const chef = "0x58a8E42C071b9C9d049F261E75DE5568Ef81a427" +module.exports = masterchefExports({ chain: 'kava', masterchef: chef, useDefaultCoreAssets: true, nativeToken: '0x254B63C7481A16bC4080f0Ab369320004f79Cca3', poolInfoABI: 'function poolInfo(uint256) view returns (address lpToken, uint256 allocPoint, uint256 lastRewardBlock, uint256 accKfdPerShare)' }) \ No newline at end of file diff --git a/projects/kagla/abi/addressProvider.json b/projects/kagla/abi/addressProvider.json index 15db448d127..fe8ec1d824f 100644 --- a/projects/kagla/abi/addressProvider.json +++ b/projects/kagla/abi/addressProvider.json @@ -1,9 +1,3 @@ { - "get_registry": { - "inputs": [], - "name": "get_registry", - "outputs": [{ "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - } + "get_registry": "address:get_registry" } \ No newline at end of file diff --git a/projects/kagla/abi/registry.json b/projects/kagla/abi/registry.json index 46392c88de7..2008de39a43 100644 --- a/projects/kagla/abi/registry.json +++ b/projects/kagla/abi/registry.json @@ -1,30 +1,6 @@ { - "pool_count": { - "inputs": [], - "name": "pool_count", - "outputs": [{"name": "", "type": "uint256"}], - "stateMutability": "view", - "type": "function" - }, - "pool_list": { - "inputs": [{"name": "arg0", "type": "uint256"}], - "name": "pool_list", - "outputs": [{"name": "", "type": "address"}], - "stateMutability": "view", - "type": "function" - }, - "get_coins": { - "inputs": [{"name": "_pool", "type": "address"}], - "name": "get_coins", - "outputs": [{"name": "", "type": "address[8]"}], - "stateMutability": "view", - "type": "function" - }, - "get_balances": { - "inputs": [{"name": "_pool", "type": "address"}], - "name": "get_balances", - "outputs": [{"name": "", "type": "uint256[8]"}], - "stateMutability": "view", - "type": "function" - } + "pool_count": "uint256:pool_count", + "pool_list": "function pool_list(uint256 arg0) view returns (address)", + "get_coins": "function get_coins(address _pool) view returns (address[8])", + "get_balances": "function get_balances(address _pool) view returns (uint256[8])" } \ No newline at end of file diff --git a/projects/kagla/addresses.js b/projects/kagla/addresses.js index 7f037e9d04f..b51f3ce4cb0 100644 --- a/projects/kagla/addresses.js +++ b/projects/kagla/addresses.js @@ -1,54 +1,11 @@ -const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000" +const ADDRESSES = require('../helper/coreAssets.json') const ADDRESS_PROVIDER_ADDRESS = "0x5a0ad8337E5C6895b3893E80c8333859DAcf7c01" -const KGL_ADDRESS = "0x257f1a047948f73158DaDd03eB84b34498bCDc60" +const KGL_ADDRESS = ADDRESSES.astar.KGL const VOTING_ESCROW_ADDRESS = "0x432c8199F548425F7d5746416D98126E521e8174" -const transformTokenAddress = (address) => TOKENS[address] - -const TOKEN_INFO = { - ausd: { key: "acala-dollar", decimals: 12 } -} - -const TOKENS = { - // KGL - [KGL_ADDRESS]: "kagla-finance", - // muKGL: staked KGL by Muuu Finance - "0x5eaAe8435B178d4677904430BAc5079e73aFa56e": "kagla-finance", - // USDC - "0x6a2d262D56735DbA19Dd70682B39F6bE9a931D98": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", - // Starlay lUSDC -> USDC - "0xC404E12D3466acCB625c67dbAb2E1a8a457DEf3c": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", - // USDT - "0x3795C36e7D12A8c252A20C5a7B455f7c57b60283": "0xdac17f958d2ee523a2206206994597c13d831ec7", - // Starlay lUSDT -> USDT - "0x430D50963d9635bBef5a2fF27BD0bDDc26ed691F": "0xdac17f958d2ee523a2206206994597c13d831ec7", - // DAI - "0x6De33698e9e9b787e09d3Bd7771ef63557E148bb": "0x6b175474e89094c44da98b954eedeac495271d0f", - // Starlay lDAI -> DAI - "0x4dd9c468A44F3FEF662c35c1E9a6108B70415C2c": "0x6b175474e89094c44da98b954eedeac495271d0f", - // BUSD - "0x4Bf769b05E832FCdc9053fFFBC78Ca889aCb5E1E": "binance-usd", - // BAI - "0x733ebcC6DF85f8266349DEFD0980f8Ced9B45f35": "bai-stablecoin", - // aUSD - "0xfFFFFfFF00000000000000010000000000000001": TOKEN_INFO.ausd.key, - // ASTR - "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE" : "astar", - // nASTR: staked ASTR by Algem - "0xE511ED88575C57767BAfb72BfD10775413E3F2b0": "astar", - // LAY - "0xc4335B1b76fA6d52877b3046ECA68F6E708a27dd": "starlay-finance", - // muLAY: staked LAY by Muuu Finance - "0xDDF2ad1d9bFA208228166311FC22e76Ea7a4C44D": "starlay-finance", -}; - - module.exports = { - ZERO_ADDRESS, ADDRESS_PROVIDER_ADDRESS, VOTING_ESCROW_ADDRESS, KGL_ADDRESS, - TOKEN_INFO, - transformTokenAddress } diff --git a/projects/kagla/index.js b/projects/kagla/index.js index 0eda07aca01..560f32dd17f 100644 --- a/projects/kagla/index.js +++ b/projects/kagla/index.js @@ -1,26 +1,17 @@ const { getBalances } = require("./pools"); -const { getStaked } = require("./staking"); +const { VOTING_ESCROW_ADDRESS, KGL_ADDRESS, } = require("./addresses"); +const { staking } = require('../helper/staking') const START_BLOCK = 724359 -async function astar(_timestamp, _block, {astar: block}) { - const chain = "astar" - const balances = await getBalances(chain, block) - return balances -} - -async function staking(_timestamp, _block, {astar: block}) { - const chain = "astar" - const staked = await getStaked(chain, block) - return staked +async function astar(_timestamp, _block, {astar: block}, { api }) { + return getBalances(api) } module.exports = { - timetravel: true, - misrepresentedTokens: true, start: START_BLOCK, astar: { tvl: astar, - staking: staking + staking: staking(VOTING_ESCROW_ADDRESS, KGL_ADDRESS) }, }; diff --git a/projects/kagla/pools.js b/projects/kagla/pools.js index eef4140280b..183c19b00ae 100644 --- a/projects/kagla/pools.js +++ b/projects/kagla/pools.js @@ -1,76 +1,16 @@ -const sdk = require("@defillama/sdk"); -const { toBigNumberJsOrZero } = require("./utils.js"); +const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') const addressProviderABI = require("./abi/addressProvider.json"); const registryABI = require("./abi/registry.json"); -const { ADDRESS_PROVIDER_ADDRESS, ZERO_ADDRESS, transformTokenAddress, TOKEN_INFO } = require("./addresses"); +const { ADDRESS_PROVIDER_ADDRESS, } = require("./addresses"); -const getBalances = async (chain, block) => { - const registryAddress = (await sdk.api.abi.call({ - target: ADDRESS_PROVIDER_ADDRESS, - abi: addressProviderABI["get_registry"], - block, - chain, - })).output +const getBalances = async (api) => { + const registry = await api.call({ target: ADDRESS_PROVIDER_ADDRESS, abi: addressProviderABI["get_registry"], }) + const poolAddresses = await api.fetchList({ lengthAbi: registryABI["pool_count"], itemAbi: registryABI["pool_list"], target: registry }) - const poolAddresses = await listPoolAddresses(chain, block, registryAddress) - - const poolCoinsArray = (await sdk.api.abi.multiCall({ - calls: poolAddresses.map(address => ({ target: registryAddress, params: address })), - abi: registryABI["get_coins"], - block, - chain, - })).output.map(({ output }) => output.filter(address => address !== ZERO_ADDRESS)) - - const poolBalancesArray = (await sdk.api.abi.multiCall({ - calls: poolAddresses.map(address => ({ target: registryAddress, params: address })), - abi: registryABI["get_balances"], - block, - chain, - })).output.map(({ output }) => output) - - const balanceBNRecord = poolCoinsArray.reduce( - (result, coins, poolIndex) => - coins.reduce((coinsResult, coin, coinIndex) => { - const balance = toBigNumberJsOrZero(poolBalancesArray[poolIndex][coinIndex]) - const transformedCoin = transformTokenAddress(coin) - const exisitingBalance = coinsResult[transformedCoin] - if(!transformedCoin) return coinsResult - if(!exisitingBalance) - return { ...coinsResult, [transformedCoin]: balance } - return { ...coinsResult, [transformedCoin]: exisitingBalance.plus(balance) } - }, result), - {} - ) - - return Object.keys(balanceBNRecord).reduce((result, key) => { - if (key.startsWith("0x")) - return { ...result, [key]: balanceBNRecord[key].toString() } - for (const token of Object.values(TOKEN_INFO)) { - if (key === token.key) - return {...result, [key]: balanceBNRecord[key].shiftedBy(-token.decimals).toFixed(0) } - } - return ({ ...result, [key]: balanceBNRecord[key].shiftedBy(-18).toFixed(0) }) - }, {}) -} - -const listPoolAddresses = async (chain, block, registryAddress) => { - const numOfPools = (await sdk.api.abi.call({ - target: registryAddress, - abi: registryABI["pool_count"], - block, - chain, - })).output - const poolAddressesCalls = [] - for (let i = 0; i < numOfPools; i++) { - poolAddressesCalls.push({ target: registryAddress, params: i }) - } - return (await sdk.api.abi.multiCall({ - calls: poolAddressesCalls, - abi: registryABI["pool_list"], - block, - chain, - })).output.map(({ output }) => output) + const poolCoinsArray = await api.multiCall({ target: registry, calls: poolAddresses, abi: registryABI["get_coins"], }) + const ownerTokens = poolCoinsArray.map((v, i) => [v.filter(i => i !== nullAddress), poolAddresses[i]]) + return sumTokens2({ api, ownerTokens, blacklistedTokens: poolAddresses }) } module.exports = { diff --git a/projects/kagla/staking.js b/projects/kagla/staking.js deleted file mode 100644 index d28b7214769..00000000000 --- a/projects/kagla/staking.js +++ /dev/null @@ -1,22 +0,0 @@ -const sdk = require("@defillama/sdk"); -const { toBigNumberJsOrZero } = require("./utils.js"); - -const { VOTING_ESCROW_ADDRESS, KGL_ADDRESS, transformTokenAddress } = require("./addresses"); - -const getStaked = async (chain, block) => { - const lockedKGLBalance = (await sdk.api.abi.call({ - target: KGL_ADDRESS, - abi: 'erc20:balanceOf', - params: [VOTING_ESCROW_ADDRESS], - block, - chain, - })).output - - return { - [transformTokenAddress(KGL_ADDRESS)]: toBigNumberJsOrZero(lockedKGLBalance).shiftedBy(-18).toFixed(0) - } -} - -module.exports = { - getStaked -} diff --git a/projects/kagla/utils.js b/projects/kagla/utils.js deleted file mode 100644 index 696def55e5e..00000000000 --- a/projects/kagla/utils.js +++ /dev/null @@ -1,11 +0,0 @@ -const BigNumberJs = require("bignumber.js"); -BigNumberJs.config({ EXPONENTIAL_AT: 1e9 }) - -const toBigNumberJsOrZero = (value) => { - const bn = new BigNumberJs(value) - return bn.isNaN() ? new BigNumberJs('0') : bn -} - -module.exports = { - toBigNumberJsOrZero -} diff --git a/projects/kaidex/index.js b/projects/kaidex/index.js index b90de3f175c..9ed941fe566 100644 --- a/projects/kaidex/index.js +++ b/projects/kaidex/index.js @@ -10,7 +10,6 @@ module.exports = { methodology: 'TVL accounts for the liquidity on all AMM pools, using the TVL chart on https://becoswap.com/info as the source. Staking accounts for the BECO locked in MasterChef (0x20e8Ff1e1d9BC429489dA76B1Fc20A9BFbF3ee7e)', kardia: { tvl: sdk.util.sumChainTvls(factories.map(factory => getUniTVL({ - chain: 'kardia', useDefaultCoreAssets: true, factory, }))) diff --git a/projects/kalata/index.js b/projects/kalata/index.js index bf14b011eb1..d2e07e1a1e1 100644 --- a/projects/kalata/index.js +++ b/projects/kalata/index.js @@ -1,61 +1,32 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk') -const {sumTokensAndLPsSharedOwners} = require('../helper/unwrapLPs') -const {staking} = require('../helper/staking') -const {pool2s} = require('../helper/pool2') +const { staking } = require('../helper/staking') +const { getUniTVL } = require('../helper/unknownTokens') +const { sumTokens2 } = require('../helper/unwrapLPs') const kala = '0x32299c93960bb583a43c2220dc89152391a610c5' const masterchef = '0x565bCba3eA730ac6987edE126B29DCf499fccEA1' -const pool2Lps = ["0x64330C8AcCd74E8EB30894F341eF45c743B875b5", "0x2401F882CA9952df2aF3e335D4606620Be19aE89"] -const trans = addr=>{ - if(addr.toLowerCase() === "0x598308047116a8055c1e3debd2b761e3bc3dbcb8"){ // kUSD - return "0x0000000000085d4780b73119b644ae5ecd22b376" //tusd - } - return 'bsc:'+addr +async function tvl(time, ethBlock, chainBlocks, { api }) { + return sumTokens2({ + api, ownerTokens: [ + [[ADDRESSES.bsc.BUSD], '0x2d067575BE1f719f0b0865D357e67925B6f461C5'], // BUSD mint + [[ + ADDRESSES.bsc.BTCB, + ADDRESSES.bsc.ETH, + "0x23396cf899ca06c4472205fc903bdb4de249d6fc", + ADDRESSES.bsc.USDC, + "0x0e09fabb73bd3ade0a17ecc321fd13a19e81ce82", + ADDRESSES.bsc.USDT, + ADDRESSES.bsc.BUSD, + "0x5066c68cae3b9bdacd6a1a37c90f2d1723559d18",], masterchef], + ] + }) } -async function tvl(time, ethBlock, chainBlocks){ - const chain = 'bsc' - const block = chainBlocks.bsc - const balances = {} - // minting - await sumTokensAndLPsSharedOwners(balances,[ - ["0xe9e7cea3dedca5984780bafc599bd69add087d56", false], //BUSD - [kala, false], - ["0x598308047116a8055c1e3debd2b761e3bc3dbcb8", false], //kUSD - ], ["0x2d067575BE1f719f0b0865D357e67925B6f461C5"], block, chain, trans) - return balances -} - -async function masterchefTvl(time, ethBlock, chainBlocks){ - const chain = 'bsc' - const block = chainBlocks.bsc - const balances = {} - await sumTokensAndLPsSharedOwners(balances,[ - ["0x598308047116a8055c1e3debd2b761e3bc3dbcb8", false], //kUSD - ["0x6b2ADA69629592C04374FA27A17Fd538042BB299", true], - ["0x9a1C5D24492b6A3B99472270E58E95EF705eAe39", true], - ["0x6882911440c04Df3cBf2f82b6921097f53D7B767", true], - ["0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c", false], - ["0x2170Ed0880ac9A755fd29B2688956BD959F933F8", false], - ["0x23396cf899ca06c4472205fc903bdb4de249d6fc", false], - ["0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d", false], - ["0x0e09fabb73bd3ade0a17ecc321fd13a19e81ce82", false], - ["0x55d398326f99059ff775485246999027b3197955", false], - ["0x85593d5786b89a5659dbe3784e7c296827d70389", true], - ["0x2f5b3ab702b48b448d510200676af63630c6daa2", true], - ["0xe9e7cea3dedca5984780bafc599bd69add087d56", false], - ["0x5066c68cae3b9bdacd6a1a37c90f2d1723559d18", false] - ], [masterchef], block, chain, trans) - return balances -} - -module.exports={ - methodology: 'kUSD replaced by TUSD', - bsc:{ - tvl: sdk.util.sumChainTvls([tvl, masterchefTvl]), - masterchef: masterchefTvl, - staking: staking(masterchef, kala, 'bsc'), - pool2: pool2s([masterchef], pool2Lps, 'bsc', trans) - } +module.exports = { + bsc: { + tvl: sdk.util.sumChainTvls([getUniTVL({ factory: '0xa265535863305ce0a2a8ec330c2cec972aca3004', useDefaultCoreAssets: true, }), tvl]), + staking: staking(masterchef, kala, 'bsc'), + } } \ No newline at end of file diff --git a/projects/kalmy-app/abi.json b/projects/kalmy-app/abi.json index 09d664ac046..307b2644031 100644 --- a/projects/kalmy-app/abi.json +++ b/projects/kalmy-app/abi.json @@ -1,180 +1,14 @@ { - "vaultDebtVal": { - "inputs": [], - "name": "vaultDebtVal", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "totalToken": { - "inputs": [], - "name": "totalToken", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "reservePool": { - "inputs": [], - "name": "reservePool", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "balanceOf": { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "totalSupply": { - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "totalETH": { - "inputs": [], - "name": "totalETH", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "totalBEP20": { - "inputs": [], - "name": "totalBEP20", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "lpToken": { - "inputs": [], - "name": "lpToken", - "outputs": [ - { - "internalType": "contract IPancakePair", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "userInfo": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "userInfo", - "outputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "rewardDebt", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "pId": { - "inputs": [], - "name": "pid", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "ausdTotalStablecoinIssued": { - "inputs": [], - "name": "totalStablecoinIssued", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "xalpacaTotalSupply": { - "inputs": [], - "name": "supply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -} + "vaultDebtVal": "uint256:vaultDebtVal", + "totalToken": "uint256:totalToken", + "reservePool": "uint256:reservePool", + "balanceOf": "function balanceOf(address account) view returns (uint256)", + "totalSupply": "uint256:totalSupply", + "totalETH": "uint256:totalETH", + "totalBEP20": "uint256:totalBEP20", + "lpToken": "address:lpToken", + "userInfo": "function userInfo(uint256, address) view returns (uint256 amount, uint256 rewardDebt)", + "pId": "uint256:pid", + "ausdTotalStablecoinIssued": "uint256:totalStablecoinIssued", + "xalpacaTotalSupply": "uint256:supply" +} \ No newline at end of file diff --git a/projects/kalmy-app/index.js b/projects/kalmy-app/index.js index 31fc4d45a18..755aa35f6aa 100644 --- a/projects/kalmy-app/index.js +++ b/projects/kalmy-app/index.js @@ -1,26 +1,26 @@ const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); const BigNumber = require("bignumber.js"); -const axios = require("axios"); const { unwrapUniswapLPs } = require("../helper/unwrapLPs") -const { transformBalances } = require('../helper/portedTokens') +const { transformBalances } = require('../helper/portedTokens'); +const { getConfig } = require("../helper/cache"); async function getProcolAddresses() { - return (await axios.get( + return (await getConfig('kalmy-app/bsc', 'https://raw.githubusercontent.com/kalmar-io/kalmar-assets/main/data/bsc-kalmar-contract.json' - )).data + )) } async function getFTMProcolAddresses() { - return (await axios.get( + return (await getConfig('kalmy-app/fantom', 'https://raw.githubusercontent.com/kalmar-io/kalmar-assets/main/data/ftm-kalmar-contract.json' - )).data + )) } async function getAvaxProcolAddresses() { - return (await axios.get( + return (await getConfig('kalmy-app/avax', 'https://raw.githubusercontent.com/kalmar-io/kalmar-assets/main/data/avax-kalmar-contract.json' - )).data + )) } function getBSCAddress(address) { diff --git a/projects/kamino/api.js b/projects/kamino/api.js index 65e01fb85f2..29a30ff9126 100644 --- a/projects/kamino/api.js +++ b/projects/kamino/api.js @@ -1,22 +1,11 @@ - -const { clusterApiUrl, Connection } = require('@solana/web3.js') const { Kamino } = require('@hubbleprotocol/kamino-sdk') -const { sleep } = require('../helper/utils') +const { getConnection, } = require('../helper/solana') async function tvl() { - const connection = new Connection(clusterApiUrl('mainnet-beta')); - const kamino = new Kamino('mainnet-beta', connection); - - // get all strategies supported by Kamino - const strategies = await kamino.getStrategies(); - const sBalances = [] - for (const s of strategies) { - sBalances.push(await kamino.getStrategyBalances(s)) - await sleep(3000) - } - - return { - tether: sBalances.reduce((a, i) => a + +i.computedHoldings.totalSum, 0) + const kamino = new Kamino('mainnet-beta', getConnection()); + const shareData = await kamino.getStrategiesShareData({}); + return { + tether: shareData.reduce((a, i) => a + i.shareData.balance.computedHoldings.totalSum.toNumber(), 0) }; } diff --git a/projects/kamino/index.js b/projects/kamino/index.js index f1762719091..c35d609f757 100644 --- a/projects/kamino/index.js +++ b/projects/kamino/index.js @@ -1,6 +1,7 @@ const { getExports } = require('../helper/heroku-api') module.exports = { + doublecounted: true, timetravel: false, misrepresentedTokens: true, ...getExports("kamino", ['solana']) diff --git a/projects/kannagi-finance/abi.json b/projects/kannagi-finance/abi.json new file mode 100644 index 00000000000..bc8ebbfe262 --- /dev/null +++ b/projects/kannagi-finance/abi.json @@ -0,0 +1,4 @@ +{ + "poolTvlInfo":"function totalTvl() view returns (tuple(uint256 pid, address want, uint256 tvl)[])", + "reserves":"function getReserves() external view returns (uint _reserve0, uint _reserve1)" +} \ No newline at end of file diff --git a/projects/kannagi-finance/index.js b/projects/kannagi-finance/index.js new file mode 100644 index 00000000000..56cfcd23b53 --- /dev/null +++ b/projects/kannagi-finance/index.js @@ -0,0 +1,38 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const abi = require("./abi.json"); +const {yieldHelper} = require('../helper/yieldHelper'); +const KANA_ADDRESS = "0x26aC1D9945f65392B8E4E6b895969b5c01A7B414"; +const YIELD_ADDRESS= "0x6E415ba5a37761256D13E84B45f4822c179DEF47"; +const USDT_ADDRESS = "era:" + ADDRESSES.era.USDT; + + +function yieldHelperWrapper(){ + const helperReturn = yieldHelper({ + project: 'kannagi-finance', + chain: 'era', + masterchef: YIELD_ADDRESS, + nativeToken: KANA_ADDRESS, + getPoolsFn: async (api) => api.call({ target: YIELD_ADDRESS, abi: abi.poolTvlInfo }), + getTokenBalances: async ({ poolInfos }) => poolInfos.map(poolInfo => poolInfo.tvl), + abis: { + getReservesABI: abi.reserves, + } +}) + +const tvlFun = helperReturn.era.tvl; + +const tvlFunWrapper =async function(_, _b, _cb, { api }){ + const tvlBalances = await tvlFun(_, _b, _cb, { api }) + if(tvlBalances[USDT_ADDRESS]!=='0'&&tvlBalances[USDT_ADDRESS]!==undefined){ + let balance = (tvlBalances[USDT_ADDRESS])/1e6; + tvlBalances["tether"] = balance; + delete tvlBalances[USDT_ADDRESS]; + } + return tvlBalances; +} +helperReturn.era.tvl = tvlFunWrapper + +return helperReturn; +} + +module.exports = {...yieldHelperWrapper(), hallmarks:[[1690589340, "Rug"]]} diff --git a/projects/kanvas/abi.json b/projects/kanvas/abi.json index ac1b781490e..704e87865c5 100644 --- a/projects/kanvas/abi.json +++ b/projects/kanvas/abi.json @@ -1,49 +1,4 @@ -{ - "tokenList": { - "inputs": [], - "name": "tokenList", - "outputs": [ - { "internalType": "address[]", "name": "", "type": "address[]" } - ], - "stateMutability": "view", - "type": "function" - }, - "tokenParameters": { - "inputs": [{ "internalType": "address", "name": "", "type": "address" }], - "name": "tokenParameters", - "outputs": [ - { - "internalType": "contract IRewarder", - "name": "rewarder", - "type": "address" - }, - { - "internalType": "contract IKanvasStrategy", - "name": "strategy", - "type": "address" - }, - { - "internalType": "uint256", - "name": "lastRewardTime", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastCumulativeReward", - "type": "uint256" - }, - { "internalType": "uint256", "name": "storedPrice", "type": "uint256" }, - { - "internalType": "uint256", - "name": "accSKANVASPerShare", - "type": "uint256" - }, - { "internalType": "uint256", "name": "totalShares", "type": "uint256" }, - { "internalType": "uint256", "name": "totalTokens", "type": "uint256" }, - { "internalType": "uint128", "name": "multiplier", "type": "uint128" }, - { "internalType": "uint16", "name": "withdrawFeeBP", "type": "uint16" } - ], - "stateMutability": "view", - "type": "function" - } +{ + "tokenList": "address[]:tokenList", + "tokenParameters": "function tokenParameters(address) view returns (address rewarder, address strategy, uint256 lastRewardTime, uint256 lastCumulativeReward, uint256 storedPrice, uint256 accSKANVASPerShare, uint256 totalShares, uint256 totalTokens, uint128 multiplier, uint16 withdrawFeeBP)" } \ No newline at end of file diff --git a/projects/kanvas/index.js b/projects/kanvas/index.js index 251bfe4721e..30323e346cc 100644 --- a/projects/kanvas/index.js +++ b/projects/kanvas/index.js @@ -1,17 +1,17 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); -const token0Abi = require("../helper/abis/token0.json"); -const token1Abi = require("../helper/abis/token1.json"); +const token0Abi = 'address:token0' +const token1Abi = 'address:token1' const {unwrapUniswapLPs} = require("../helper/unwrapLPs"); const {staking} = require("../helper/staking"); -const BigNumber = require("bignumber.js"); const kanvas = "0xe005097ad7eea379ce404011eef68359b052cd0a"; const stakingAddress = "0x34d2Cfb257cCf7EFDC41DB9a824ac314da80Bae8"; const artStudio = "0xf15Bf479A5711f9411595C6289a9e7C36F24ad2F"; const transform = { -"0x150410ebbccc3be87997462ea7a44449b7c0dbf2":"kava:0x765277EebeCA2e31912C9946eAe1021199B39C61" +"0x150410ebbccc3be87997462ea7a44449b7c0dbf2":"kava:" + ADDRESSES.shiden.ETH } async function calcTvl(block, chain, pool2) { @@ -45,7 +45,8 @@ async function calcTvl(block, chain, pool2) { })), abi: token0Abi, block, - chain + chain, + permitFailure: true, })).output; const token1Address = (await sdk.api.abi.multiCall({ calls: tokenList.map(p => ({ @@ -53,6 +54,7 @@ async function calcTvl(block, chain, pool2) { })), abi: token1Abi, block, + permitFailure: true, chain })).output; diff --git a/projects/kapaswap/index.js b/projects/kapaswap/index.js new file mode 100644 index 00000000000..6c6b1da13b3 --- /dev/null +++ b/projects/kapaswap/index.js @@ -0,0 +1,7 @@ +const { getUniTVL } = require('../helper/unknownTokens') +module.exports = { + kava: { tvl: getUniTVL({ + factory: '0xAb9F1D773Bde5657BC1492dfaF57b0b9EB59FDDc', + useDefaultCoreAssets: true, + })} +} diff --git a/projects/kapinus/index.js b/projects/kapinus/index.js new file mode 100644 index 00000000000..601109737aa --- /dev/null +++ b/projects/kapinus/index.js @@ -0,0 +1,13 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports = { + misrepresentedTokens: true, + bsc: { + tvl: getUniTVL({ + factory: '0x70e881fa43a7124e36639b54162395451cef1922', + abi: 'uint256:allPairs', + useDefaultCoreAssets: true, + fetchBalances: true, + }) + }, +}; diff --git a/projects/karura-staking/index.js b/projects/karura-staking/index.js index 853f1741d0b..be2c2de6e1f 100644 --- a/projects/karura-staking/index.js +++ b/projects/karura-staking/index.js @@ -2,5 +2,6 @@ const {getExports} = require('../helper/heroku-api') module.exports = { timetravel: false, + misrepresentedTokens: true, ...getExports("karura-staking", ['karura']) } \ No newline at end of file diff --git a/projects/kasavadex/index.js b/projects/kasavadex/index.js index 889b273cf4f..9679c4859ce 100644 --- a/projects/kasavadex/index.js +++ b/projects/kasavadex/index.js @@ -1,12 +1,14 @@ const { getUniTVL } = require('../helper/unknownTokens') module.exports = { + hallmarks: [ + [1660521600, "incentives not given"] + ], misrepresentedTokens: true, methodology: "Factory addresses (0x8F1fD6Ed57B0806FF114135F5b50B5f76e9542F2 for kava) is used to find the LP pairs. TVL is equal to the liquidity on the AMM.", kava: { tvl: getUniTVL({ factory: '0x8F1fD6Ed57B0806FF114135F5b50B5f76e9542F2', - chain: 'kava', useDefaultCoreAssets: true, }), } diff --git a/projects/kassandra/index.js b/projects/kassandra/index.js index e24bb1eb02d..a9d8d4acb87 100644 --- a/projects/kassandra/index.js +++ b/projects/kassandra/index.js @@ -1,19 +1,73 @@ -const { postURL } = require('../helper/utils') +const sdk = require('@defillama/sdk') +const { getLogs } = require('../helper/cache/getLogs') +const { sumTokens2 } = require('../helper/unwrapLPs') +const abi = require('../aura-finance/abi.json') +const { stripTokenHeader } = require('../helper/tokenMapping') -async function fetch() { - const data = { - operationName: "TotalValueLocked", - variables: {}, - query: "query TotalValueLocked { factory (id: \"0x958c051B55a173e393af696EcB4C4FF3D6C13930\") { total_value_locked_usd } }" - } - const response = await postURL("https://graph.kassandra.finance/subgraphs/name/KassandraAvalanche", data); - return response.data.data.factory.total_value_locked_usd +const config = { + avax: { factory: '0x878fa1ef7d9c7453ea493c2424449d32f1dbd846', fromBlock: 10087927 }, } -module.exports = { - timetravel: false, - fetch, - avax: { - fetch, - } +const configBalancer = { + polygon: { factory: '0x228885c9d0440Ae640B88fBeE31522CC6a59Fd2F', fromBlock: 42020509 }, } + +Object.keys(config).forEach(chain => { + const { factory, fromBlock } = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const logs = await getLogs({ + api, + target: factory, + topics: ['0x2dcffae760adbb49d27552cdcd6cf9835c1a8e4545a5b123f8cac6d5a968b11b'], + eventAbi: 'event LogNewPool(address indexed caller, address indexed pool)', + onlyArgs: true, + fromBlock, + }) + const pools = logs.map(log => log.pool) + const tokens = await api.multiCall({ abi: 'address[]:getCurrentTokens', calls: pools }) + await sumTokens2({ api, ownerTokens: pools.map((pool, i) => [tokens[i], pool]) }) + if (chain === 'avax') { + const balances = api.getBalances() + const allTokens = tokens.flat().map(i => i.toLowerCase()) + const symbols = await api.multiCall({ abi: 'string:symbol', calls: allTokens, }) + const yrtTokens = allTokens.filter((token, i) => symbols[i] === 'YRT') + const depositTokens = await api.multiCall({ abi: 'address:depositToken', calls: yrtTokens}) + const deposits = await api.multiCall({ abi: 'uint256:totalDeposits', calls: yrtTokens}) + const supply = await api.multiCall({ abi: 'uint256:totalSupply', calls: yrtTokens}) + Object.entries(balances).forEach(([token, balance]) => { + const t = stripTokenHeader(token) + yrtTokens.forEach((yToken, i) => { + if (yToken === t) { + delete balances[token] + sdk.util.sumSingleBalance(balances, depositTokens[i], balance * deposits[i] / supply[i], api.chain) + } + }) + }) + return balances + } + } + } +}) + +Object.keys(configBalancer).forEach(chain => { + const { factory, fromBlock } = configBalancer[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const managedPoolFactory = await api.call({ target: factory, abi: 'address:managedPoolFactory'}) + const vault = await api.call({ target: managedPoolFactory, abi: 'address:getVault'}) + const logs = await getLogs({ + api, + target: factory, + topics: ['0x3bccd8755c586fb977facb52bc850861b8588643edb28cbfef711671791710e9'], + eventAbi: 'event KassandraPoolCreatedTokens (bytes32 indexed vaultPoolId, string tokenName, string tokenSymbol, address[] tokens)', + onlyArgs: true, + fromBlock, + }) + const poolIds = logs.map(log => log.vaultPoolId) + const data = await api.multiCall({ abi: abi.getPoolTokens, calls: poolIds, target: vault}) + data.forEach(({ tokens, balances}) => api.addTokens(tokens.slice(1), balances.slice(1))) + return api.getBalances() + } + } +}) \ No newline at end of file diff --git a/projects/kava-boost/index.js b/projects/kava-boost/index.js index a7f7e0906ae..166bb750443 100644 --- a/projects/kava-boost/index.js +++ b/projects/kava-boost/index.js @@ -1,44 +1,16 @@ -const utils = require("../helper/utils"); -const sdk = require("@defillama/sdk"); +const { queryV1Beta1 } = require('../helper/chain/cosmos'); -async function tvl() { - let balances = {}; - let url = `https://api2.kava.io/kava/savings/v1beta1/total_supply`; +const chain = 'kava' +const blacklisted = new Set(['kava', 'ukava', 'bkava']) - const response = await utils.fetchURL(url); - - for (let coin of response.data.result) { - const tokenInfo = generic(coin.denom); - if (!tokenInfo) { - console.log("unknown token", coin.denom); - continue; - } - const tokenName = tokenInfo[0]; - if (tokenName !== 'kava') - sdk.util.sumSingleBalance(balances,tokenName,coin.amount / 10 ** tokenInfo[1]) - } - - return balances; -} - -function generic(ticker) { - switch (ticker) { - case "bkava": - return ["kava", 6]; - case "ukava": - return ["kava", 6]; - case "erc20/multichain/usdc": - return ["usd-coin", 6]; - case "erc20/multichain/usdt": - return ["tether", 6]; - case "erc20/multichain/dai": - return ["dai", 18]; - case "bnb": - return ["binancecoin", 8] - } +async function tvl(_, _1, _2, { api }) { + const { result: pools } = await queryV1Beta1({ chain, url: '/savings/v1beta1/total_supply' }); + pools + .filter(({ denom }) => !blacklisted.has(denom)) + .forEach(({ denom, amount }) => api.add(denom, amount)) } module.exports = { timetravel: false, kava: { tvl } -}; +}; \ No newline at end of file diff --git a/projects/kava-earn/index.js b/projects/kava-earn/index.js index 6dc6f5a6a84..07bab0a106f 100644 --- a/projects/kava-earn/index.js +++ b/projects/kava-earn/index.js @@ -1,41 +1,13 @@ -const utils = require("../helper/utils"); -const sdk = require("@defillama/sdk"); +const { queryV1Beta1 } = require('../helper/chain/cosmos'); -async function tvl() { - const balances = {}; - let url = `https://api2.kava.io/kava/earn/v1beta1/total_supply`; +const chain = 'kava' - const response = await utils.fetchURL(url); - - for (let coin of response.data.result) { - const tokenInfo = generic(coin.denom); - if (!tokenInfo) { - utils.log("unknown token", coin.denom); - continue; - } - const tokenName = tokenInfo[0]; - sdk.util.sumSingleBalance(balances,tokenName,coin.amount / 10 ** tokenInfo[1]) - } - - return balances; -} - -function generic(ticker) { - switch (ticker) { - case "bkava": - return ["kava", 6]; - case "ukava": - return ["kava", 6]; - case "erc20/multichain/usdc": - return ["usd-coin", 6]; - case "erc20/multichain/usdt": - return ["tether", 6]; - case "erc20/multichain/dai": - return ["dai", 18]; - } +async function tvl(_, _1, _2, { api }) { + const { result: pools } = await queryV1Beta1({ chain, url: '/earn/v1beta1/total_supply' }); + pools.forEach(({ denom, amount }) => api.add(denom, amount)) } module.exports = { timetravel: false, kava: { tvl } -}; +}; \ No newline at end of file diff --git a/projects/kava-liquid/index.js b/projects/kava-liquid/index.js index 32ade015636..de7e1d7ae2e 100644 --- a/projects/kava-liquid/index.js +++ b/projects/kava-liquid/index.js @@ -1,37 +1,13 @@ -const utils = require("../helper/utils"); -// const sdk = require("@defillama/sdk"); +const { queryV1Beta1 } = require('../helper/chain/cosmos'); +const { transformBalances } = require('../helper/portedTokens') -async function tvl(timestamp) { - let totalValueLocked = {}; - let url = `https://api2.kava.io/kava/liquid/v1beta1/total_supply`; - // if (Math.abs(Date.now() / 1000 - timestamp) > 3600) { - // const block = await sdk.api.util.lookupBlock(timestamp, { chain: "kava" }); - // url += `?height=${block.block}`; - // } +const chain = 'kava' - const response = await utils.fetchURL(url); - - for (let coin of response.data.result) { - const tokenInfo = generic(coin.denom); - if (!tokenInfo) { - utils.log("unknown token", coin.denom); - continue; - } - - totalValueLocked[tokenInfo[0]] = coin.amount / 10 ** tokenInfo[1]; - } - return totalValueLocked; -} - - -function generic(ticker) { - switch (ticker) { - case "ukava": - return ["kava", 6]; - } +async function tvl(_, _1, _2, { api }) { + const { result: pools } = await queryV1Beta1({ chain, url: '/liquid/v1beta1/total_supply' }); + pools.forEach(({ denom, amount }) => api.add(denom, amount)) } - module.exports = { timetravel: false, kava: { tvl } diff --git a/projects/kavacave/index.js b/projects/kavacave/index.js index 53906d3d03a..fd5cfc7840f 100644 --- a/projects/kavacave/index.js +++ b/projects/kavacave/index.js @@ -6,7 +6,7 @@ const { getFixBalances } = require("../helper/portedTokens"); const masterChef = { - kava:"0xf17BBB9698b50156Ee437E01e22D7C2080184934" + kava: "0xf17BBB9698b50156Ee437E01e22D7C2080184934" }; const abi = { kava: kavaabi, @@ -14,8 +14,8 @@ const abi = { async function getTokensInMasterChef(time, ethBlock, chainBlocks, chain) { const block = chainBlocks[chain]; - - const transformAddress = (addr) => `${chain}:${addr}`; + + const transformAddress = (addr) => `${chain}:${addr}`; // const transformAddress=(addr)=>kavaFixMapping[addr]; const balances = {}; const poolLength = ( @@ -66,7 +66,7 @@ async function getTokensInMasterChef(time, ethBlock, chainBlocks, chain) { await unwrapUniswapLPs(balances, lpPositions, block, chain, transformAddress); // console.log(balances) - const fixbalances=await getFixBalances(chain); + const fixbalances = await getFixBalances(chain); fixbalances(balances); return balances; } @@ -76,6 +76,9 @@ async function kavaTvl(timestamp, block, chainBlocks) { } module.exports = { + hallmarks: [ + [1660521600, "incentives not given"] + ], methodology: "Staked LP is counted as TVL.", kava: { diff --git a/projects/kavacave/kavaAbi.json b/projects/kavacave/kavaAbi.json index c98e79c8f09..f2f4bb1dba8 100644 --- a/projects/kavacave/kavaAbi.json +++ b/projects/kavacave/kavaAbi.json @@ -1,61 +1,3 @@ { - "poolInfo":{ - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "poolInfo", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "lpToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "emi", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastRewardTime", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accKavePerShare", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "depositFeeBP", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalcap", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "bonusBp", - "type": "uint256" - }, - { - "internalType": "address", - "name": "strat", - "type": "address" - }, - { - "internalType": "uint256", - "name": "sid", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } + "poolInfo": "function poolInfo(uint256) view returns (address lpToken, uint256 emi, uint256 lastRewardTime, uint256 accKavePerShare, uint256 depositFeeBP, uint256 totalcap, uint256 bonusBp, address strat, uint256 sid)" } \ No newline at end of file diff --git a/projects/kavafc/index.js b/projects/kavafc/index.js new file mode 100644 index 00000000000..c1a95ce2b5a --- /dev/null +++ b/projects/kavafc/index.js @@ -0,0 +1,19 @@ +const { stakingPricedLP } = require("../helper/staking"); +const { unknownTombs, sumTokensExport } = require("../helper/unknownTokens"); +const { mergeExports } = require("../helper/utils"); + +const stakingValue = sumTokensExport({ + chain: "kava", + owner: "0xa07deE8FF35fE2e2961a7e1006EAdA98E24aE82E", + tokens: ["0x990e157fC8a492c28F5B50022F000183131b9026"], + lps: ["0x09d6561b3795ae237e42f7adf3dc83742e10a2e8"], + useDefaultCoreAssets: true, +}); +const lionLiquidityStake = { + kava: { + staking: stakingValue, + tvl: async () => ({}), + }, +}; + +module.exports = lionLiquidityStake; diff --git a/projects/kavastarter/index.js b/projects/kavastarter/index.js new file mode 100644 index 00000000000..f92076b9654 --- /dev/null +++ b/projects/kavastarter/index.js @@ -0,0 +1,18 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require('../helper/unknownTokens'); + +const KAST_LP = "0x821dd423c744cAa452C0Ae1651a9388009efbE5b"; + +const WKAVA = ADDRESSES.kava.WKAVA; +const KAVASTARTER = "0x32a57dCa514Cc601d3DDEe974f57Db9Dc2CfE83b"; + +const POL_Pool_One = "0x12450E12A7eC069b51b46C92Ac122D90DbD9A99D"; +const POL_Pool_Two = "0x9aedc0D09E0Ede60Ba5B5F969a955937af024c44"; +const POL_Pool_Three = "0x486F6f8cF46EC5CC584ec3f08C494E55a8484111"; + +module.exports = { + kava: { + tvl: sumTokensExport({ owners: [POL_Pool_One, POL_Pool_Two], tokens: [WKAVA] }), + staking: sumTokensExport({ owner: POL_Pool_Three, tokens: [KAVASTARTER], lps: [KAST_LP], useDefaultCoreAssets: true, }) + } +}; diff --git a/projects/kccguru/index.js b/projects/kccguru/index.js index 0b0decc279e..b4185ed0400 100644 --- a/projects/kccguru/index.js +++ b/projects/kccguru/index.js @@ -1,65 +1,18 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk") -const ITVL = [ - { - "inputs": [], - "name": "pool2", //POOL2 TVL : 1e18 === 1 USD - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "staking", //STAKING TVL : 1e18 === 1 USD - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "tvl", //GLOABL TVL : 1e18 === 1 USD - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "usd", //On-chain USD Reference Token - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } -] +const ITVL = { + pool2: "uint256:pool2", + staking: "uint256:staking", + tvl: "uint256:tvl", + usd: "address:usd", +} const tvlGuru = "0x426a4A4B73d4CD173C9aB78d18c0d79d1717eaA9"; //On-Chain Universal TVL Finder -const USD = "kcc:0x0039f574eE5cC39bdD162E9A88e3EB1f111bAF48"; //same as abi.call({target:tvlGuru,abi:ITVL["usd"]}) +const USD = "kcc:" + ADDRESSES.kcc.USDT; //same as abi.call({target:tvlGuru,abi:ITVL["usd"]}) //NOTE: USD===kcc:USDT is used explicitly to reduce EVM calls by this adapter. It makes this process faster. async function pool2(timestamp,_, {kcc: block}) { let _pool2 = await sdk.api.abi.call({ target: tvlGuru, - abi: ITVL[0], + abi: ITVL.pool2, block: block, chain: 'kcc' }); @@ -70,7 +23,7 @@ async function pool2(timestamp,_, {kcc: block}) { async function staking(timestamp,_, {kcc: block}) { let _staking = await sdk.api.abi.call({ target: tvlGuru, - abi: ITVL[1], + abi: ITVL.staking, block: block, chain: 'kcc' }); @@ -81,7 +34,7 @@ async function staking(timestamp,_, {kcc: block}) { async function tvl(timestamp,_, {kcc: block}) { let _tvl = await sdk.api.abi.call({ target: tvlGuru, - abi: ITVL[2], + abi: ITVL.tvl, block: block, chain: 'kcc' }); diff --git a/projects/kdex/index.js b/projects/kdex/index.js index c541b9d5899..6a0c7ef5d14 100644 --- a/projects/kdex/index.js +++ b/projects/kdex/index.js @@ -6,7 +6,6 @@ module.exports = { kava: { tvl: getUniTVL({ factory: '0x9a6d197e85e61c23146F5b7FA55fc8a6EDDD2D57', - chain: 'kava', useDefaultCoreAssets: true, }), } diff --git a/projects/kebab-finance/index.js b/projects/kebab-finance/index.js index a15c330ce7f..23f7c2281f8 100644 --- a/projects/kebab-finance/index.js +++ b/projects/kebab-finance/index.js @@ -4,18 +4,7 @@ const { addFundsInMasterChef } = require("../helper/masterchef"); const masterchef = "0x76FCeffFcf5325c6156cA89639b17464ea833ECd"; const kebab = "0x7979F6C54ebA05E18Ded44C4F986F49a5De551c2"; -const poolInfoAbi = { - inputs: [{ internalType: "uint256", name: "", type: "uint256" }], - name: "poolInfo", - outputs: [ - { internalType: "contract IBEP20", name: "lpToken", type: "address" }, - { internalType: "uint256", name: "allocPoint", type: "uint256" }, - { internalType: "uint256", name: "lastRewardBlock", type: "uint256" }, - { internalType: "uint256", name: "accCakePerShare", type: "uint256" }, - ], - stateMutability: "view", - type: "function", -}; +const poolInfoAbi = 'function poolInfo(uint256) view returns (address lpToken, uint256 allocPoint, uint256 lastRewardBlock, uint256 accCakePerShare)'; async function tvl(timestamp, block, chainBlocks) { let balances = {}; diff --git a/projects/keep3r/abis.js b/projects/keep3r/abis.js index 76b14e8a635..e9386b3350c 100644 --- a/projects/keep3r/abis.js +++ b/projects/keep3r/abis.js @@ -1,70 +1,6 @@ exports.abis = { - userInfo: { - inputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - { - internalType: "address", - name: "", - type: "address", - }, - ], - name: "userInfo", - outputs: [ - { - internalType: "uint256", - name: "amount", - type: "uint256", - }, - { - internalType: "uint256", - name: "rewardDebt", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, - - totalBorrows: { - constant: true, - inputs: [], - name: "totalBorrows", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - payable: false, - stateMutability: "view", - type: "function", - }, - - priceRegistry: { - constant: true, - inputs: [{ name: "_forex", type: "address" }], - name: "price", - outputs: [{ name: "", type: "uint256" }], - type: "function", - }, - - totalSupply: { - constant: true, - inputs: [], - name: "totalSupply", - outputs: [{ name: "totalSupply", type: "uint256" }], - type: "function", - }, - - getReserves: { - constant: true, - inputs: [], - name: "getReserves", - outputs: [{ name: "_reserve0", type: "uint112"}, { name: "_reserve1", type: "uint112"}, { name: "_blockTimestampLast", type: "uint32"} ] - } -}; + userInfo: "function userInfo(uint256, address) view returns (uint256 amount, uint256 rewardDebt)", + totalBorrows: "uint256:totalBorrows", + priceRegistry: "function price(address _forex) view returns (uint256)", + totalSupply: "uint256:totalSupply", +} diff --git a/projects/keep3r/index.js b/projects/keep3r/index.js index 5cd1b9e0223..1c0b7e2ce04 100644 --- a/projects/keep3r/index.js +++ b/projects/keep3r/index.js @@ -1,169 +1,9 @@ -// @ts-check -/** -* @typedef {{ [address: string]: string }} Balances -* @typedef {{ [address: string]: { price: string } }} TokenPrices -* @typedef {{ [address: string]: { price: string, balance: string } }} TokenData -*/ const sdk = require("@defillama/sdk"); const abis = require("./abis.js").abis; const registry = require("./registry.js").registry; const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); -const utils = require("../helper/utils"); -// =================== UTILS =================== - -/** - * @param {number} usd - * @param {string} bn - * @returns {bigint} - */ -const multiplyUSDby1e18 = (usd, bn) => - (BigInt(Math.round(usd * 100)) * BigInt(bn)) / BigInt(1e18) / BigInt(100); - -/** - * @param {Balances} balances - * @param {TokenPrices} tokenPrices - * @returns {bigint} - */ -const getTVLFromBalancesAndTokenPrices = (balances, tokenPrices) => { - const ibTokenAddresses = Object.keys(tokenPrices).map((a) => a.toLowerCase()); - - const ibTokensData = ibTokenAddresses.reduce((acc, addr) => { - acc[addr].balance = balances[addr]; - return acc; - }, /** @type {TokenData} */ (tokenPrices)); - - return Object.values(ibTokensData).reduce( - (acc, { price, balance }) => - acc + (BigInt(price) * BigInt(balance)) / BigInt(1e36), - BigInt(0) - ); -}; - -// =================== TVL getters =================== - -/** - * WARNING: this method return prices with 1e18 base, those can't be used in `multiplyUSDby1e18` function - * @param {any} options - * @returns {Promise} prices - */ -const getIbTokenPrices = async ({ block }) => { - const ibTokensAddresses = Object.values(registry.ibTokens); - const { output } = await sdk.api.abi.multiCall({ - block: block, - calls: ibTokensAddresses.map((address) => ({ - target: registry.FF_REGISTRY, - params: address, - })), - abi: abis.priceRegistry, - }); - - return output.reduce((acc, curr) => { - const address = curr.input.params[0].toLowerCase(); - - acc[address] = { - price: curr.output, - }; - - return acc; - }, {}); -}; - - -/** - * @param {{ balances: Balances, block: any }} options - * @return {Promise} ibTokensTVL - */ -const getIbTokensTVL = async ({ balances, block }) => { - const ibTokenPrices = await getIbTokenPrices({ block }); - - return getTVLFromBalancesAndTokenPrices(balances, ibTokenPrices); -}; - -/** - * @param {{ balances: Balances }} options - * @return {Promise} kp3rTVL - */ -const getKLPsTVL = async ({ balances }) => { - const WETH = registry.WETH.toLowerCase(); - const KP3R = registry.KP3R.toLowerCase(); - const klp = registry.Kp3rV2Klps.KP3R_WETH_1_PERCENT.toLowerCase(); - - const addresses = [KP3R, WETH]; - - const { data } = await utils.getPricesFromContract(addresses); - - const kp3rPrice = data[KP3R].usd; - const wethPrice = data[WETH].usd; - - const klpPrice = 2 * Math.sqrt(kp3rPrice / wethPrice) * wethPrice; - - const klpTvl = multiplyUSDby1e18(klpPrice, balances[klp]); - - return klpTvl; -}; - -/** - * @param {{ balances: Balances }} options - * @return {Promise} kp3rTVL - */ -const getOtherTokensTVL = async ({ balances }) => { - const addresses = [ - registry.KP3R, - registry.WETH, - registry.CVX, - registry.DAI, - registry.SUSHI, - registry.CRV, - registry.CVXCRV, - registry.SPELL, - registry.ARMOR, - registry.HEGIC, - registry.LDO, - registry.MM, - ]; - - const { data } = await utils.getPricesFromContract(addresses); - - const othersTvl = addresses.reduce((acc, curr) => { - const addr = curr.toLowerCase(); - const price = data[addr].usd; - const balance = balances[addr]; - - acc += multiplyUSDby1e18(price, balance); - return acc; - }, BigInt(0)); - - return othersTvl; -}; - -// =================== MAIN FUNCTIONS =================== - -/** - * @param {string} timestamp - * @param {any} block - * @return {Promise} TVL - */ -async function fetch(timestamp, block) { - const balances = /** @type {Balances} */ (await tvl(timestamp, block)); - - const IB_TOKENS_TVL = await getIbTokensTVL({ balances, block }); - const KLPS_TVL = await getKLPsTVL({ balances }); - - const OTHER_TOKENS_TVL = await getOtherTokensTVL({ balances }); - - // @ts-ignore - const TVL = IB_TOKENS_TVL + OTHER_TOKENS_TVL + KLPS_TVL; - - return TVL; -} - -/** - * @param {string} _timestamp - * @param {any} block - * @return {Promise} TVL - */ async function staking(_timestamp, block) { const { KP3R, VKP3R } = registry; const balances = {}; @@ -174,11 +14,6 @@ async function staking(_timestamp, block) { return balances; } -/** - * @param {string} _timestamp - * @param {any} block - * @return {Promise} TVL - */ async function borrowed(_timestamp, block) { /** @type {Balances} */ const balances = {}; @@ -201,19 +36,9 @@ async function borrowed(_timestamp, block) { ); } - const ibTokenPrices = await getIbTokenPrices({ block }); - - const borrowedTvl = getTVLFromBalancesAndTokenPrices(balances, ibTokenPrices); - - // @dev should return borrowedTvl return balances; } -/** - * @param {string} _timestamp - * @param {any} block - * @return {Promise} balances - */ async function tvl(_timestamp, block) { /** @type {Balances} */ const balances = {}; @@ -231,13 +56,13 @@ async function tvl(_timestamp, block) { [registry.WETH, false], ].concat( [ - [registry.KPR_WETH_SUSHI_POOL, true], - [registry.USDC_ibAUD_POOL, true], - [registry.USDC_ibEUR_POOL, true], - [registry.USDC_ibKRW_POOL, true], - [registry.USDC_ibJPY_POOl, true], - [registry.USDC_ibGBP_POOL, true], - [registry.USDC_ibCHF_POOL, true], + [registry.KPR_WETH_SUSHI_POOL, false], + [registry.USDC_ibAUD_POOL, false], + [registry.USDC_ibEUR_POOL, false], + [registry.USDC_ibKRW_POOL, false], + [registry.USDC_ibJPY_POOl, false], + [registry.USDC_ibGBP_POOL, false], + [registry.USDC_ibCHF_POOL, false], ], Object.values(registry.ibTokens).map((t) => [t, false]) ), @@ -257,7 +82,7 @@ async function tvl(_timestamp, block) { await sumTokensAndLPsSharedOwners( balances, - Object.values(registry.Kp3rV1Slps).map((t) => [t, true]), + Object.values(registry.Kp3rV1Slps).map((t) => [t, false]), [registry.KP3R], block ); @@ -266,10 +91,9 @@ async function tvl(_timestamp, block) { } module.exports = { - misrepresentedTokens: true, ethereum: { + tvl, staking, borrowed }, - fetch, }; diff --git a/projects/keep3r/registry.js b/projects/keep3r/registry.js index 296c71b0de2..edbe91be213 100644 --- a/projects/keep3r/registry.js +++ b/projects/keep3r/registry.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') exports.registry = { KP3R: "0x1ceb5cb57c4d4e2b2433641b95dd330a33185a44", KP3RV2: "0xeb02addCfD8B773A5FFA6B9d1FE99c566f8c44CC", @@ -20,14 +21,14 @@ exports.registry = { SJPY: "0xF6b1C627e95BFc3c1b4c9B825a032Ff0fBf3e07d", SCHF: "0x0F83287FF768D1c1e17a42F44d644D7F22e8ee1d", MIM: "0x99d8a9c45b2eca8864373a26d1459e3dff1e17f3", - CVX: "0x4e3fbd56cd56c3e72c1403e103b45db9da5b9d2b", - DAI: "0x6b175474e89094c44da98b954eedeac495271d0f", - SUSHI: "0x6B3595068778DD592e39A122f4f5a5cF09C90fE2", - CRV: "0xD533a949740bb3306d119CC777fa900bA034cd52", - CVXCRV: "0x62B9c7356A2Dc64a1969e19C23e4f579F9810Aa7", + CVX: ADDRESSES.ethereum.CVX, + DAI: ADDRESSES.ethereum.DAI, + SUSHI: ADDRESSES.ethereum.SUSHI, + CRV: ADDRESSES.ethereum.CRV, + CVXCRV: ADDRESSES.ethereum.cvxCRV, SPELL: "0x090185f2135308BaD17527004364eBcC2D37e5F6", - WETH: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", - LDO: "0x5a98fcbea516cf06857215779fd812ca3bef1b32", + WETH: ADDRESSES.ethereum.WETH, + LDO: ADDRESSES.ethereum.LIDO, ARMOR: "0x1337def16f9b486faed0293eb623dc8395dfe46a", HEGIC: "0x584bc13c7d411c00c01a62e8019472de68768430", MM: "0xa283aA7CfBB27EF0cfBcb2493dD9F4330E0fd304", diff --git a/projects/keeper-dao/abi/liquidity.json b/projects/keeper-dao/abi/liquidity.json index de1e76dbab7..b5a083850a1 100644 --- a/projects/keeper-dao/abi/liquidity.json +++ b/projects/keeper-dao/abi/liquidity.json @@ -1,114 +1,8 @@ { - "registeredTokens": { - "constant": true, - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "registeredTokens", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "kToken": { - "constant": true, - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - } - ], - "name": "kToken", - "outputs": [ - { - "internalType": "contract IKToken", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "tokenByIndex": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "tokenByIndex", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getAllMarkets": { - "constant": true, - "inputs": [], - "name": "getAllMarkets", - "outputs": [ - { - "internalType": "contract CToken[]", - "name": "", - "type": "address[]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "balanceOfUnderlying": { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - } - ], - "name": "balanceOfUnderlying", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - "underlying": { - "constant": true, - "inputs": [], - "name": "underlying", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } -} + "registeredTokens": "function registeredTokens(uint256) view returns (address)", + "kToken": "function kToken(address _token) view returns (address)", + "tokenByIndex": "function tokenByIndex(uint256) view returns (address)", + "getAllMarkets": "address[]:getAllMarkets", + "balanceOfUnderlying": "function balanceOfUnderlying(address owner) returns (uint256)", + "underlying": "address:underlying" +} \ No newline at end of file diff --git a/projects/keeper-dao/index.js b/projects/keeper-dao/index.js index ce60281e862..da4296bca9f 100644 --- a/projects/keeper-dao/index.js +++ b/projects/keeper-dao/index.js @@ -1,11 +1,10 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk'); const BigNumber = require('bignumber.js'); +const { sumTokens2 } = require('../helper/unwrapLPs'); const liquidityAbi = require('./abi/liquidity.json'); - -const ETH = '0x0000000000000000000000000000000000000000'; - const LIQUIDITY_POOL_CONTRACTS = { liquidityPoolContractV3: '0x35fFd6E268610E764fF6944d07760D0EFe5E40E5', liquidityPoolContractV4: '0x4F868C1aa37fCf307ab38D215382e88FCA6275E2' @@ -14,53 +13,15 @@ const HIDING_VAULT_START_BLOCK_NUMBER = 12690306; const HIDING_VAULT_CONTRACT = '0xE2aD581Fc01434ee426BB3F471C4cB0317Ee672E'; const COMPOUND_COMPTROLLER_ADDRESS = '0x3d9819210A31b4961b30EF54bE2aeD79B9c9Cd3B'; -// cache some data -let markets = { - '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE': { - symbol: 'ETH', - decimals: 18, - kToken: '0xC4c43C78fb32F2c7F8417AF5af3B85f090F1d327', - }, - '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2': { - symbol: 'WETH', - decimals: 18, - kToken: '0xac19815455C2c438af8A8b4623F65f091364be10', - }, - '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48': { - symbol: 'USDC', - decimals: 6, - kToken: '0xac826952bc30504359a099c3a486d44E97415c77', - }, - '0x6B175474E89094C44Da98b954EedeAC495271d0F': { - symbol: 'DAI', - decimals: 18, - kToken: '0x0314b6CC36Ea9b48f34a350828Ce98F17B76bC44', - }, - '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599': { - symbol: 'WBTC', - decimals: 8, - kToken: '0xDfd1B73e7635D8bDA4EF16D5f364c6B6333769C8', - }, - '0xEB4C2781e4ebA804CE9a9803C67d0893436bB27D': { - symbol: 'renBTC', - decimals: 8, - kToken: '0xDcAF89b0937c15eAb969Ea01f57AAacc92A21995', - }, -}; - async function getToken(block, index, liquidityPool) { - for (let i = 0; i < 5; i++) { - try { - return (await sdk.api.abi.call({ - block, - target: liquidityPool, - params: [index], - abi: liquidityAbi['registeredTokens'], - })).output - } catch (e) { - } - } - return null + try { + return (await sdk.api.abi.call({ + block, + target: liquidityPool, + params: [index], + abi: liquidityAbi['registeredTokens'], + })).output + } catch (e) { return null} } async function getAllTokens(block, liquidityPool) { @@ -78,36 +39,6 @@ async function getAllTokens(block, liquidityPool) { return tokens; } -async function getKToken(block, token, liquidityPool) { - return (await sdk.api.abi.call({ - block, - target: liquidityPool, - params: [token], - abi: liquidityAbi['kToken'], - })).output; -} - -// returns {[underlying]: {kToken, decimals, symbol}} -async function getMarkets(block, liquidityPool) { - if (block < 11908288) { - // the allMarkets getter was only added in this block. - return markets; - } else { - let allTokens = await getAllTokens(block, liquidityPool); - // if not in cache, get from the blockchain - for (const token of allTokens) { - let kToken = await getKToken(block, token, liquidityPool); - - if (!markets[token]) { - let info = await sdk.api.erc20.info(token); - markets[token] = { kToken, decimals: info.output.decimals, symbol: info.output.symbol }; - } - } - - return markets; - } -} - // Calculates all the token balances in Hiding Vault NFTs minted till the given block async function getHidingVaultBalances(timestamp, block) { let hidingVaultBalances = {} @@ -123,7 +54,7 @@ async function getHidingVaultBalances(timestamp, block) { // numberRange to iterate over indexes of NFTs. Can migrate to any supported util func of erc721 when it is supported. const indexRange = []; - for (let i = 0;i < +noOfHidingVaults; i++) + for (let i = 0; i < +noOfHidingVaults; i++) indexRange.push(i) // Query Hiding Vault Contract's 'tokenByIndex' with index to get individual HidingVaultNFTs @@ -153,7 +84,7 @@ async function getHidingVaultBalances(timestamp, block) { // get the underlying token address const isCEth = cTokenAddress.toLowerCase() === "0x4ddc2d193948926d02f9b1fe9e1daa0718270ed5" const { output: token } = isCEth - ? { output: '0x0000000000000000000000000000000000000000' } // ETH has no underlying asset on Compound + ? { output: ADDRESSES.null } // ETH has no underlying asset on Compound : await sdk.api.abi.call( { block, @@ -192,43 +123,21 @@ async function getHidingVaultBalances(timestamp, block) { } // Calculates the token balances in Liquidity Pool Contracts till the given block -async function getLiquidityPoolBalances(timestamp, block) { - let liquidityPoolBalances = {}; - - // Cumulative token balances from all liqudity pool contracts - for (let liquidityPool of Object.values(LIQUIDITY_POOL_CONTRACTS)) { - let markets = await getMarkets(block, liquidityPool); - // Get token balances - let balances = await sdk.api.abi.multiCall({ - block, - calls: Object.keys(markets).map((token) => ({ - target: token, - params: liquidityPool, - })).filter(m => m.target !== "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE"), - abi: 'erc20:balanceOf', - }); - - sdk.util.sumMultiBalanceOf(liquidityPoolBalances, balances); - - let ethBalance = (await sdk.api.eth.getBalance({ target: liquidityPool, block })).output; - sdk.util.sumSingleBalance(liquidityPoolBalances, ETH, ethBalance) - } - - return liquidityPoolBalances; +async function getLiquidityPoolBalances(timestamp, block, api) { + const toa = [] + + await Promise.all(Object.values(LIQUIDITY_POOL_CONTRACTS).map(async liquidityPool => { + let tokens = await getAllTokens(block, liquidityPool) + tokens.forEach(i => toa.push([i, liquidityPool])) + })) + return toa } -async function tvl(timestamp, block) { - const liquidityPoolBalances = await getLiquidityPoolBalances(timestamp, block); - const hidingVaultBalances = await getHidingVaultBalances(timestamp, block); - - const totalBalances = {}; - - const uniq = arry => [... new Set(arry)] - uniq(Object.keys(hidingVaultBalances).concat(Object.keys(liquidityPoolBalances))).forEach(asset => { - totalBalances[asset] = new BigNumber(hidingVaultBalances[asset] || "0").plus(new BigNumber(liquidityPoolBalances[asset] || "0")).toString(10); - }); +async function tvl(timestamp, block, _, { api }) { + const tokensAndOwners = await getLiquidityPoolBalances(timestamp, block); + const balances = await getHidingVaultBalances(timestamp, block); - return totalBalances; + return sumTokens2({ api, balances, tokensAndOwners }); } module.exports = { diff --git a/projects/kefirswap/index.js b/projects/kefirswap/index.js index ac9a2ee4906..a459ae97e6b 100644 --- a/projects/kefirswap/index.js +++ b/projects/kefirswap/index.js @@ -1,15 +1,18 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { getUniTVL } = require('../helper/unknownTokens') // const KEFIR = "0xf5E547C683f5d72D6A463542d3e2cC13C5470D71" const FACTORY = "0xeEAbe2F15266B19f3aCF743E69105016277756Fb" -const WKAVA = "0xc86c7C0eFbd6A49B35E8714C5f59D99De09A225b" +const WKAVA = ADDRESSES.kava.WKAVA module.exports = { + hallmarks: [ + [1656806400, "Rug Pull"] + ], methodology: "Count TVL as liquidity on the dex", misrepresentedTokens: true, kava: { tvl: getUniTVL({ - chain: 'kava', factory: FACTORY, useDefaultCoreAssets: true, }), diff --git a/projects/kei-finance/index.js b/projects/kei-finance/index.js new file mode 100644 index 00000000000..6c29579d47a --- /dev/null +++ b/projects/kei-finance/index.js @@ -0,0 +1,38 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const sdk = require("@defillama/sdk"); +const { request, } = require("graphql-request"); +const { BigNumber } = require("bignumber.js"); + +const TOKEN_ADDRESS = "0xF75C7a59bCD9bd207C4Ab1BEB0b32EEd3B6392f3"; +const TREASURY_ADDRESS = "0x3D027824a9Eb4cc5E8f24D97FD8495eA9DC7026F"; +const WETH_ADDRESS = ADDRESSES.ethereum.WETH; + +const config = { + ethereum: { + subgraph: 'https://api.thegraph.com/subgraphs/name/kei-finance/core', + } +} + +const graphQuery = ` + query GetStakingDetails { + staking(id:"staking") { + totalPrincipal + totalRewards + } + } +`; + +module.exports = { + ethereum: { + tvl: () => 0, + staking: () => 0, + /* staking: async () => { + const { staking } = await request( + config.ethereum.subgraph, + graphQuery + ) + + return { [TOKEN_ADDRESS]: BigNumber(staking.totalPrincipal).plus(BigNumber(staking.totalRewards)) }; + }, */ + } +}; diff --git a/projects/key/index.js b/projects/key/index.js new file mode 100644 index 00000000000..b8e2201d51b --- /dev/null +++ b/projects/key/index.js @@ -0,0 +1,89 @@ +const { getLogs } = require('../helper/cache/getLogs') +const { BigNumber, constants } = require('ethers') +const { getBlock } = require('../helper/http') + +const GmxkeyToken = '0xc5369c88440AB1FC842bCc60d3d087Bd459f20e4' +const EsGmxkeyToken = '0x3a924611895F8484194C9a791fceFb6fC07ddb85' +const MpkeyToken = '0x40a03B30D0c4D9e5E71164e041EC28CEe6dD9b36' +const GMXkeyGmxMarket = '0xC2e764eBEa35F079b03522D8C9cf7394De4EE15e' +const EsGMXkeyGmxMarket = '0x48dFF3e21843C2A81a4C5CE55535Ac444B55bDbf' +const MPkeyGmxMarket = '0x09861D732Af36Ee33490A09f24A0a3Cb06e035c1' +const UniswapGmxEthPool = '0x80A9ae39310abf666A87C743d6ebBD0E8C42158E' + +function getMarketPrice(api, fromBlock) { + return async (market, defaultPrice) => { + const logs = await getLogs({ + api, + target: market, + topic: 'TakeOrder(address,uint256,address,address,address,uint256,uint256,uint256,bool,uint256)', + eventAbi: 'event TakeOrder(address indexed account, uint256 indexed orderId, address indexed maker, address token, address currency, uint256 price, uint256 amount, uint256 filled, bool bidAsk, uint256 timestamp)', + onlyArgs: true, + skipCache: true, + fromBlock, + }) + + const targetLogs = logs + .map(({ timestamp, price }) => ({ timestamp, price })) + .sort((a, b) => a.timestamp > b.timestamp ? -1 : 1) + .slice(0, 5) + + const sum = targetLogs.reduce((prev, curr) => { + return prev.add(curr.price) + }, constants.Zero) + + if (sum.eq(constants.Zero)) { + return defaultPrice + } + + return sum.div(targetLogs.length).toNumber() / 10**4 + } +} + +function getTvl(gmxPrice, tokenPrice, totalSupply){ + const tokenSupply = totalSupply / 10**18 + return gmxPrice * tokenPrice * tokenSupply +} + +async function getGmxPrice(slot0) { + const priceSqrt = BigNumber.from(slot0[0]) + const gmxPriceInEth = priceSqrt.pow(2).mul(1000).div(BigNumber.from(2).pow(192)).toNumber() / 1000 + + return 1 / gmxPriceInEth +} + +async function tvl(timestamp, _, chainBlocks, { api }) { + const fromBlock = await getBlock(timestamp - (48 * 60 * 60), 'arbitrum', chainBlocks) + + const slot0 = await api.call({ + abi: 'function slot0() view returns (uint160 sqrtPriceX96, int24 tick, uint16 observationIndex, uint16 observationCardinality, uint16 observationCardinalityNext, uint8 feeProtocol, bool unlocked)', + target: UniswapGmxEthPool, + }) + + const [totalSupplyOfGmxkey, totalSupplyOfEsGmxkey, totalSupplyOfMpkey] = await api.multiCall({ + abi: 'erc20:totalSupply', + calls: [GmxkeyToken, EsGmxkeyToken, MpkeyToken], + }) + + const gmxPrice = await getGmxPrice(slot0) + + const marketPrice = getMarketPrice(api, fromBlock) + + const gmxkeyPrice = await marketPrice(GMXkeyGmxMarket, 0.95) + const gmxkeyTvl = getTvl(gmxPrice, gmxkeyPrice, totalSupplyOfGmxkey) + + const esGmxkeyPrice = await marketPrice(EsGMXkeyGmxMarket, 0.5) + const esGmxkeyTvl = getTvl(gmxPrice, esGmxkeyPrice, totalSupplyOfEsGmxkey) + + const mpkeyPrice = await marketPrice(MPkeyGmxMarket, 0.1) + const mpkeyTvl = getTvl(gmxPrice, mpkeyPrice, totalSupplyOfMpkey) + + return { + ethereum: gmxkeyTvl + esGmxkeyTvl + mpkeyTvl, + } +} + +module.exports = { + arbitrum: { + tvl, + } +} diff --git a/projects/kiloex/index.js b/projects/kiloex/index.js new file mode 100644 index 00000000000..056ed53416a --- /dev/null +++ b/projects/kiloex/index.js @@ -0,0 +1,9 @@ +const ADDRESSES = require("../helper/coreAssets.json"); +const { sumTokensExport } = require("../helper/unwrapLPs"); + +const owners = ["0x1c3f35F7883fc4Ea8C4BCA1507144DC6087ad0fb", "0xfE03be1b0504031e92eDA810374222c944351356"]; + +module.exports = { + start: 1690971144, + bsc: { tvl: sumTokensExport({ owners, tokens: [ADDRESSES.bsc.USDT], }) }, +}; \ No newline at end of file diff --git a/projects/kimberlite/abi.json b/projects/kimberlite/abi.json new file mode 100644 index 00000000000..b47a8837140 --- /dev/null +++ b/projects/kimberlite/abi.json @@ -0,0 +1,4 @@ +{ + "depositId": "uint256:depositId", + "lockedToken": "function lockedToken(uint256) view returns (address tokenAddress, address withdrawalAddress, uint256 tokenAmount, uint256 unlockTime, string memory lockName, string memory lockDescription, bool withdrawn)" +} diff --git a/projects/kimberlite/config.js b/projects/kimberlite/config.js new file mode 100644 index 00000000000..4da89a31c94 --- /dev/null +++ b/projects/kimberlite/config.js @@ -0,0 +1,56 @@ +const config = { + kimberliteSafeETH: { + chain: "ethereum", + locker: "0x1492AfF2D39fa5fFBF717DE80B15DCf3311B1BAb", + startBlock: 17029807 + }, + kimberliteSafeBSC: { + chain: "bsc", + locker: "0xFb22A44FF24D599600A90eea13B14b5662b10353", + startBlock: 25521834 + }, + kimberliteSafePLS: { + chain: "pulse", + locker: "0x5752Ed96a3Bfe6bdA9A290230e02E5e9E3A6e955", + startBlock: 17366715 + }, + kimberliteSafeMETIS: { + chain: "metis", + locker: "0xE4E56E5e234783BCb77A80e19C8B3B5b42588AAb", + startBlock: 4228174 + }, + kimberliteSafeCORE: { + chain: "core", + locker: "0xCa308C3B5e008148A8665c77073b0335AecF627c", + startBlock: 852565 + }, + kimberliteSafeMATIC: { + chain: "polygon", + locker: "0xE4E56E5e234783BCb77A80e19C8B3B5b42588AAb", + startBlock: 37286221 + }, + kimberliteSafeDOGE: { + chain: "dogechain", + locker: "0x1492AfF2D39fa5fFBF717DE80B15DCf3311B1BAb", + startBlock: 5552716 + }, + kimberliteSafeARB: { + chain: "arbitrum", + locker: "0xE4E56E5e234783BCb77A80e19C8B3B5b42588AAb", + startBlock: 49220342 + }, + kimberliteSafeZkEVM: { + chain: "polygon_zkevm", + locker: "0xE4E56E5e234783BCb77A80e19C8B3B5b42588AAb", + startBlock: 279366 + }, + kimberliteSafeKAVA: { + chain: "kava", + locker: "0xE4E56E5e234783BCb77A80e19C8B3B5b42588AAb", + startBlock: 4533304 + }, +} + +module.exports = { + config +} diff --git a/projects/kimberlite/index.js b/projects/kimberlite/index.js new file mode 100644 index 00000000000..a7dae25a415 --- /dev/null +++ b/projects/kimberlite/index.js @@ -0,0 +1,19 @@ +const { config } = require('./config') +const abi = require('./abi.json') +const { sumUnknownTokens, } = require('../helper/unknownTokens') + +module.exports = { + methodology: 'Counts TVL of all the tokens locked on the Kimberlite Safe locker smart contracts' +}; + +Object.values(config).forEach(({ chain, locker, startBlock }) => { + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const data = await api.fetchList({ lengthAbi: abi.depositId, itemAbi: abi.lockedToken, target: locker, startFromOne: true, }) + const tokensAndOwners = data + // .filter(i => !i.withdrawn) + .map((i) => [i.tokenAddress, locker]) + return sumUnknownTokens({ api, tokensAndOwners, useDefaultCoreAssets: true, resolveLP: true, }) + } + } +}) \ No newline at end of file diff --git a/projects/kinefinance/abi.json b/projects/kinefinance/abi.json index da3b628f783..f715ccbd819 100644 --- a/projects/kinefinance/abi.json +++ b/projects/kinefinance/abi.json @@ -1,47 +1,5 @@ -{ - "getAllMarkets": { - "constant": true, - "inputs": [], - "name": "getAllMarkets", - "outputs": [ - { - "internalType": "contract KToken[]", - "name": "", - "type": "address[]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "underlying": { - "constant": true, - "inputs": [], - "name": "underlying", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "totalBorrows": { - "constant": true, - "inputs": [], - "name": "totalBorrows", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } +{ + "getAllMarkets": "address[]:getAllMarkets", + "underlying": "address:underlying", + "totalBorrows": "uint256:totalBorrows" } \ No newline at end of file diff --git a/projects/kinefinance/index.js b/projects/kinefinance/index.js index cdffeb48dc7..de73216bd9b 100644 --- a/projects/kinefinance/index.js +++ b/projects/kinefinance/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const { BigNumber } = require("bignumber.js"); const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); @@ -123,14 +124,14 @@ async function getBorrowed(block, chain, kMcd) { chain })).output; - sdk.util.sumSingleBalance(balances, "0xdac17f958d2ee523a2206206994597c13d831ec7", BigNumber(totalBorrows).div(1e12).toFixed(0)); + sdk.util.sumSingleBalance(balances, ADDRESSES.ethereum.USDT, BigNumber(totalBorrows).div(1e12).toFixed(0)); return balances; } const ethUnitroller = "0xbb7d94a423f4978545ecf73161f0678e8afd1a92"; const keth = "0xa58e822de1517aae7114714fb354ee853cd35780"; -const weth = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"; +const weth = ADDRESSES.ethereum.WETH; const ethXKine = "0xa8d7643324df0f38764f514eb1a99d8f379cc692"; const ethKine = "0xcbfef8fdd706cde6f208460f2bf39aa9c785f05d"; const ethkMcd = "0xaf2617aa6fd98581bb8cb099a16af74510b6555f"; @@ -145,7 +146,7 @@ async function ethBorrow(timestamp, block) { const bscUnitroller = "0x3c2ddd486c07343b711a4415cdc9ab90ed32b571"; const kbnb = "0x5fbe4eb536dadbcee54d5b55ed6559e29c60b055"; -const wbnb = "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c"; +const wbnb = ADDRESSES.bsc.WBNB; const bscXKine = "0x8f5abd0d891d293b13f854700ff89210da3d5ba3"; const bscKine = "0xbfa9df9ed8805e657d0feab5d186c6a567752d7f"; const bsckMcd = "0x4f1ab95b798084e44d512b8b0fed3ef933177986"; @@ -160,7 +161,7 @@ async function bscBorrowed(timestamp, block, chainBlocks) { const polygonUnitroller = "0xdff18ac4146d67bf2ccbe98e7db1e4fa32b96881"; const kmatic = "0xf186a66c2bd0509beaafca2a16d6c39ba02425f9"; -const wmatic = "0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270"; +const wmatic = ADDRESSES.polygon.WMATIC_2; const polygonXKine = "0x66a782c9a077f5adc988cc0b5fb1cdcc9d7adeda"; const polygonKine = "0xa9c1740fa56e4c0f6ce5a792fd27095c8b6ccd87"; const polygonkMcd = "0xcd6b46443becad4996a70ee3d8665c0b86a0c54c"; @@ -175,7 +176,7 @@ async function polygonBorrowed(timestamp, block, chainBlocks) { const avaxUnitroller = "0x0ec3126390c606be63a0fa6585e68075f06679c6"; const kavax = "0x0544be6693763d64c02f49f16986ba1390a2fc39"; -const wavax = "0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7"; +const wavax = ADDRESSES.avax.WAVAX; const avaxXKine = "0x68b9737ae74cf1a169890042f1aa359647aa3e47"; const avaxKine = "0xa9c1740fa56e4c0f6ce5a792fd27095c8b6ccd87"; const avaxkMcd = "0xcd6b46443becad4996a70ee3d8665c0b86a0c54c"; diff --git a/projects/kinesis/index.js b/projects/kinesis/index.js index ff82d203fab..61f79cba1cc 100644 --- a/projects/kinesis/index.js +++ b/projects/kinesis/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') /*================================================== Modules ==================================================*/ @@ -34,24 +35,24 @@ const poolAddresses_evmos = [ ]; // Bridged Nomad Stablecoins -const madUSDC = "0x51e44FfaD5C2B122C8b635671FCC8139dc636E82"; -const madUSDT = "0x7FF4a56B32ee13D7D4D405887E0eA37d61Ed919e"; -const FRAX = "0xE03494D0033687543a80c9B1ca7D6237F2EA8BD8"; +const madUSDC = ADDRESSES.evmos.USDC; +const madUSDT = ADDRESSES.evmos.USDT; +const FRAX = ADDRESSES.evmos.FRAX; // Bridged Celer Stablecoins const ceDAI = "0x940dAAbA3F713abFabD79CdD991466fe698CBe54"; -const ceUSDC = "0xe46910336479F254723710D57e7b683F3315b22B"; -const ceUSDT = "0xb72A7567847abA28A2819B855D7fE679D4f59846"; +const ceUSDC = ADDRESSES.evmos.ceUSDC; +const ceUSDT = ADDRESSES.evmos.ceUSDT; // Bridged Axelar Stablecoins const axlDAI = "0x4A2a90D444DbB7163B5861b772f882BbA394Ca67"; -const axlUSDC = "0x15C3Eb3B621d1Bff62CbA1c9536B7c1AE9149b57"; +const axlUSDC = ADDRESSES.evmos.AXL_USDC; const axlUSDT = "0xe01C6D4987Fc8dCE22988DADa92d56dA701d0Fe0"; // Bridged Gravity Stablecoins -const gravDAI = "0xd567B3d7B8FE3C79a1AD8dA978812cfC4Fa05e75"; -const gravUSDC = "0x5FD55A1B9FC24967C4dB09C513C3BA0DFa7FF687"; -const gravUSDT = "0xecEEEfCEE421D8062EF8d6b4D814efe4dc898265"; +const gravDAI = ADDRESSES.functionx.PUNDIX; +const gravUSDC = ADDRESSES.functionx.PURSE; +const gravUSDT = ADDRESSES.functionx.USDT; async function tvl(timestamp, chainBlocks) { const balances = {}; diff --git a/projects/king-finance/index.js b/projects/king-finance/index.js new file mode 100644 index 00000000000..f42fd8eb208 --- /dev/null +++ b/projects/king-finance/index.js @@ -0,0 +1,10 @@ +const { staking } = require('../helper/staking') + +const POOL2S = '0x66e5388c84da5a30ebe58eeac73bbceb59c9f1ae' + +module.exports = { + bsc: { + tvl: () => 0, + staking: staking(POOL2S, '0x74f08aF7528Ffb751e3A435ddD779b5C4565e684'), + } +} diff --git a/projects/kintsugi/api.js b/projects/kintsugi/api.js index 3706e382fc0..f62a416c2e2 100644 --- a/projects/kintsugi/api.js +++ b/projects/kintsugi/api.js @@ -3,7 +3,7 @@ const { getAPI } = require('../helper/acala/api') async function tvl(){ const api = await getAPI('kintsugi'); - kintsugiTVL = {} + const kintsugiTVL = {} // Fetch total BTC locked (= kBTC minted) const tokens = await api.query.tokens.totalIssuance.entries() diff --git a/projects/kinza/index.js b/projects/kinza/index.js new file mode 100644 index 00000000000..d40ac2057c0 --- /dev/null +++ b/projects/kinza/index.js @@ -0,0 +1,11 @@ +const { aaveExports } = require("../helper/aave"); + +module.exports = { + methodology: + "Counts the tokens locked in the contracts to be used as collateral to borrow or to earn yield. Borrowed coins are not counted towards the TVL, so only the coins actually locked in the contracts are counted. There's multiple reasons behind this but one of the main ones is to avoid inflating the TVL through cycled lending", + bsc: { + ...aaveExports('bsc', '0x37D7Eb561E189895E5c8601Cd03EEAB67C269189', undefined, ['0x09ddc4ae826601b0f9671b9edffdf75e7e6f5d61'], { + v3: true, + }), + }, +}; diff --git a/projects/kivach/index.js b/projects/kivach/index.js new file mode 100644 index 00000000000..28a80c0ada3 --- /dev/null +++ b/projects/kivach/index.js @@ -0,0 +1,64 @@ +/* + * Cascading donations to github repositories + * + * Support open-source projects with donations in crypto, and they will automatically + * forward a part of your donation to other open-source projects that made them possible. + * + * @see https://kivach.org/ + */ +const { + getBalances, + fetchOswapExchangeRates, + fetchOswapAssets, + getDecimalsByAsset, +} = require('../helper/chain/obyte') + +const KIVACH_AA_ADDRESS = 'D3B42CWMY3A6I6GHC6KUJJSUKOCBE77U' + +async function totalTvl() { + const [assetMetadata, exchangeRates, balances] = await Promise.all([ + fetchOswapAssets(), + fetchOswapExchangeRates(), + getBalances([KIVACH_AA_ADDRESS]).then((balances) => balances[KIVACH_AA_ADDRESS]) + ]); + + const assetDecimals = {}; + const decimalGetters = []; + + Object.keys(balances).forEach((asset) => { + const decimals = assetMetadata[asset]?.decimals; + + if (decimals !== undefined) { + assetDecimals[asset] = decimals; + } else { + decimalGetters.push(getDecimalsByAsset(asset).then((decimals) => assetDecimals[asset] = decimals)) + } + }); + + await Promise.all(decimalGetters); + + let tvl = 0; + + Object.entries(balances).forEach(async ([asset, { stable: balance = 0 }]) => { + const assetKey = (asset === "base") ? "GBYTE" : asset; + const usdRate = exchangeRates[`${assetKey}_USD`] ?? 0; + const decimals = assetDecimals[asset]; + + if (decimals !== undefined) { + tvl += (balance / 10 ** decimals) * usdRate; + } + }); + + return { tether: tvl } +} + +module.exports = { + timetravel: false, + doublecounted: false, + misrepresentedTokens: true, + methodology: + "The TVL is the USD value of all undistributed donations received through Kivach.", + obyte: { + tvl: totalTvl + } +} diff --git a/projects/klaybank/abi/IDefiLlamaViewer.json b/projects/klaybank/abi/IDefiLlamaViewer.json deleted file mode 100644 index ea9cc3215a9..00000000000 --- a/projects/klaybank/abi/IDefiLlamaViewer.json +++ /dev/null @@ -1,103 +0,0 @@ -[ - { - "constant": true, - "inputs": [], - "name": "getAllReserveData", - "outputs": [ - { - "components": [ - { - "name": "symbol", - "type": "string" - }, - { - "name": "underlyingAssetAddress", - "type": "address" - }, - { - "name": "marketTvl", - "type": "uint256" - }, - { - "name": "marketTvlInUsd", - "type": "uint256" - } - ], - "name": "", - "type": "tuple[]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "assetDataAddress", - "type": "address" - }, - { - "name": "symbol", - "type": "string" - } - ], - "name": "_getReserveData", - "outputs": [ - { - "components": [ - { - "name": "symbol", - "type": "string" - }, - { - "name": "underlyingAssetAddress", - "type": "address" - }, - { - "name": "marketTvl", - "type": "uint256" - }, - { - "name": "marketTvlInUsd", - "type": "uint256" - } - ], - "name": "", - "type": "tuple" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getAllStakedData", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getTreasuryData", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } -] diff --git a/projects/klaybank/index.js b/projects/klaybank/index.js index 7c9d2078b4e..d152e955bdd 100644 --- a/projects/klaybank/index.js +++ b/projects/klaybank/index.js @@ -1,5 +1,8 @@ const sdk = require("@defillama/sdk") -const IDefiLlamaViewerAbi = require("./abi/IDefiLlamaViewer.json"); +const IDefiLlamaViewerAbi = { + getAllReserveData: "function getAllReserveData() view returns (tuple(string symbol, address underlyingAssetAddress, uint256 marketTvl, uint256 marketTvlInUsd)[])", + getAllStakedData: "uint256:getAllStakedData", +} const BigNumber = require("bignumber.js"); const { toUSDTBalances } = require("../helper/balances"); // addresses @@ -11,7 +14,7 @@ async function fetchLiquidity(ts, _block, chainBlocks) { const { output: reserves} = await sdk.api.abi.call({ chain, block, target: IDefiLlamaViewerContractAddress, - abi: IDefiLlamaViewerAbi.find(i => i.name === 'getAllReserveData') + abi: IDefiLlamaViewerAbi.getAllReserveData }) let marketTvl = new BigNumber(0); @@ -27,7 +30,7 @@ async function fetchStaked(ts, _block, chainBlocks) { const { output: staked} = await sdk.api.abi.call({ chain, block, target: IDefiLlamaViewerContractAddress, - abi: IDefiLlamaViewerAbi.find(i => i.name === 'getAllStakedData') + abi: IDefiLlamaViewerAbi.getAllStakedData }) let stakedTvl = new BigNumber(staked); diff --git a/projects/klaylend/index.js b/projects/klaylend/index.js index 983265ddeda..e0eb6d0f598 100644 --- a/projects/klaylend/index.js +++ b/projects/klaylend/index.js @@ -9,4 +9,7 @@ module.exports = masterchefExports({ masterchef: contract, nativeToken: kld, useDefaultCoreAssets: true, -}) \ No newline at end of file +}) +module.exports.hallmarks = [ + [1662336000, "Rug Pull"] +] \ No newline at end of file diff --git a/projects/klayportal/abi.json b/projects/klayportal/abi.json index 5ab6608a1e0..e1a970fdf63 100644 --- a/projects/klayportal/abi.json +++ b/projects/klayportal/abi.json @@ -1,16 +1,3 @@ { - "stakingPoolSum": { - "constant": true, - "inputs": [], - "name": "stakingPoolSum", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } + "stakingPoolSum": "uint256:stakingPoolSum" } \ No newline at end of file diff --git a/projects/klayswap-v3/index.js b/projects/klayswap-v3/index.js new file mode 100644 index 00000000000..df1ef1630f0 --- /dev/null +++ b/projects/klayswap-v3/index.js @@ -0,0 +1,36 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokens2 } = require('../helper/unwrapLPs') +const { getLogs } = require('../helper/cache/getLogs') + +async function v3Tvl(_, _b, _cb, { api, }) { + const factory = '0xA15Be7e90df29A4aeaD0C7Fc86f7a9fBe6502Ac9'; + const wklay = '0x19aac5f612f524b754ca7e7c41cbfa2e981a4432'; + const klay = ADDRESSES.null; + + const fromBlock = 124342981; + const eventAbi = 'event PoolCreated(address indexed token0, address indexed token1, uint24 indexed fee, int24 tickSpacing, address pool, uint256 exid)'; + const topics = [ + '0x20a108faf9dc51ca2b459a109d08568e65a9cb87569b6b3a334c275d504ff94f', + ]; + + const logs = await getLogs({ + api, + target: factory, + topics, + fromBlock, + eventAbi, + onlyArgs: true, + }) + + return sumTokens2({ + api, ownerTokens: logs.map(i => { + return [[(i.token0.toLowerCase() == wklay) ? klay : i.token0, i.token1], i.pool] + }), + }) +} + +module.exports = { + klaytn: { + tvl: v3Tvl, + }, +} \ No newline at end of file diff --git a/projects/klayswap/index.js b/projects/klayswap/index.js index c642543d6b0..a60058b1f4e 100644 --- a/projects/klayswap/index.js +++ b/projects/klayswap/index.js @@ -1,40 +1,37 @@ -const { get } = require('../helper/http') -const BigNumber = require("bignumber.js"); -const { toUSDTBalances } = require('../helper/balances'); - -async function fetchLiquidity() { - const klayswapInfo = await get('https://s.klayswap.com/stat/klayswapInfo.json') - const recentPoolInfo = klayswapInfo.recentPoolInfo; - var totalLiquidity = new BigNumber('0'); - - for (const pool of recentPoolInfo) { - totalLiquidity = totalLiquidity.plus(pool.poolVolume); - } - - // Single-sided deposits - const SinglePoolInfo = klayswapInfo.leveragePoolInfo.single; - var totalSingleSided = new BigNumber('0'); - - for (const spool of SinglePoolInfo) { - totalSingleSided = totalSingleSided.plus(spool.totalDepositVol); - } - - return toUSDTBalances(totalLiquidity.plus(totalSingleSided).toFixed(2)); +const ADDRESSES = require('../helper/coreAssets.json') +const { staking } = require('../helper/staking') +const { getUniTVL } = require('../helper/unknownTokens'); +const kslp = require('../helper/abis/kslp'); +const sdk = require('@defillama/sdk') +const { sumTokens2 } = require('../helper/unwrapLPs') + +const singlePoolFactory = '0xD1890D8F02F4C63553658ba49C53A82eb84009e6' + +async function singlePoolTvl(_, _b, _cb, { api, }) { + const pools = await api.fetchList({ lengthAbi: 'uint8:getPoolCount', itemAbi: 'function getPoolAddressByIndex(uint idx) public view returns (address)', target: singlePoolFactory }) + const tokens = await api.multiCall({ abi: 'address:token', calls: pools }) + const toa = tokens.map((val, i) => ([val, pools[i]])) + return sumTokens2({ api, tokensAndOwners: toa}) } - -async function fetchStakedToken() { - const klayswapInfo = await get('https://s.klayswap.com/stat/klayswapInfo.json') - var totalStaking = new BigNumber(klayswapInfo.common.stakingVol); - return toUSDTBalances(totalStaking.toFixed(2)); -} +const dexTVL = getUniTVL({ + useDefaultCoreAssets: true, + factory: ADDRESSES.klaytn.KSP, + abis: { + allPairsLength: kslp.getPoolCount, + allPairs: kslp.pools, + token0: kslp.tokenA, + token1: kslp.tokenB, + getReserves: kslp.getCurrentPool, + }, + exports +}) module.exports = { - methodology: 'TVL counts the liquidity of KlaySwap DEX and staking counts the KSP that has been staked. Data is pulled from:"https://s.klayswap.com/stat/klayswapInfo.json".', + methodology: 'TVL counts the liquidity of KlaySwap DEX and staking counts the KSP that has been staked', klaytn: { - tvl: fetchLiquidity, - staking: fetchStakedToken + tvl: sdk.util.sumChainTvls([singlePoolTvl, dexTVL,]), + staking: staking('0x2f3713f388bc4b8b364a7a2d8d57c5ff4e054830', ADDRESSES.klaytn.KSP) }, misrepresentedTokens: true, - timetravel: false, } \ No newline at end of file diff --git a/projects/klend/index.js b/projects/klend/index.js index 10f9cc43468..14b9faf543d 100644 --- a/projects/klend/index.js +++ b/projects/klend/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk'); const {compoundExports} = require('../helper/compound'); const {unwrapUniswapLPs} = require('../helper/unwrapLPs'); @@ -5,7 +6,7 @@ const {unwrapUniswapLPs} = require('../helper/unwrapLPs'); // BSC const unitroller = "0xA6bEd5B7320941eA185A315D1292492F7Fdd1e5c"; const kBnb = "0x2C334c6cBC0547e759084bD8D469f933B17Ff481"; -const wbnb = "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c" +const wbnb = ADDRESSES.bsc.WBNB const bscPools = [ "0xf1D447656692d51d4DB7057104Ac6E97029A7790", "0x95D4D2D88C96cE96c97A912Aa7122715716013D4" @@ -14,12 +15,11 @@ const okexPools = [ "0x2404c9F6Ba2d4D5c73d86b3E3b9D7F6c70ba3448", "0x5A74de8e3D0c46c106AB769d50bf9CAF8681D30d" ]; -const lpAbi = {"constant":true,"inputs":[],"name":"lp","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"}; - +const lpAbi = 'address:lp' // OKEX const okexUnitroller = "0x9589c9c9b7A484F57d69aC09c14EcE4b6d785710"; const kOkt = "0x4923abEe988f7bB7A9ae136BEBE4A8455e8dE229"; -const wokt = "0x8f8526dbfd6e38e3d8307702ca8469bae6c56c15" +const wokt = ADDRESSES.okexchain.WOKT async function pool2Tvl(balances, chainBlocks, chain, pools) { diff --git a/projects/kleros/index.js b/projects/kleros/index.js index 71696451031..7e8c7ce8004 100644 --- a/projects/kleros/index.js +++ b/projects/kleros/index.js @@ -1,5 +1,5 @@ const { request, gql } = require("graphql-request"); -const { getBlock } = require('../helper/getBlock') +const { getBlock } = require('../helper/http') const graphUrls = { ethereum: 'https://api.thegraph.com/subgraphs/name/salgozino/klerosboard', diff --git a/projects/kleva-lend/index.js b/projects/kleva-lend/index.js new file mode 100644 index 00000000000..95107564c31 --- /dev/null +++ b/projects/kleva-lend/index.js @@ -0,0 +1,37 @@ +const { getConfig } = require('../helper/cache') +const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') +const WORKERS_QUERY_URL = "https://kleva.io/static/data.json" + +async function getWorkers() { + return getConfig('kleva', WORKERS_QUERY_URL) +} + +const klayPool = '0xa691c5891d8a98109663d07bcf3ed8d3edef820a' +const wKlay = '0xf6f6b8bd0ac500639148f8ca5a590341a97de0de' + +async function getLendingTVL(data, api) { + const tokensAndOwners = data.lendingPools.map(({ vaultAddress, ibToken: { originalToken }}) => { + if (vaultAddress.toLowerCase() === klayPool) + return [wKlay, klayPool] + return [originalToken.address, vaultAddress] + }) + tokensAndOwners.push([nullAddress, klayPool]) + return sumTokens2({ api, tokensAndOwners }) +} + +async function tvl(_, _1, _2, { api }) { + const data = await getWorkers() + return getLendingTVL(data, api) +} + +async function borrowed(_, _1, _2, { api }) { + const data = await getWorkers() + const vaults = data.lendingPools.map(({ vaultAddress }) => vaultAddress) + const tokens = await api.multiCall({ abi: 'address:getBaseTokenAddress', calls: vaults}) + const debts = await api.multiCall({ abi: 'uint256:totalDebtAmount', calls: vaults}) + api.addTokens(tokens,debts) +} + +module.exports = { + klaytn: { tvl, borrowed }, +} \ No newline at end of file diff --git a/projects/kleva/FairLaunch.json b/projects/kleva/FairLaunch.json index 9ceaa96b482..e12f8169bc2 100644 --- a/projects/kleva/FairLaunch.json +++ b/projects/kleva/FairLaunch.json @@ -1,36 +1,3 @@ { - "userInfos": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "userInfos", - "outputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "rewardDebt", - "type": "uint256" - }, - { - "internalType": "address", - "name": "fundedBy", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } + "userInfos": "function userInfos(uint256, address) view returns (uint256 amount, uint256 rewardDebt, address fundedBy)" } \ No newline at end of file diff --git a/projects/kleva/index.js b/projects/kleva/index.js index feda913bf84..af03f8240a9 100644 --- a/projects/kleva/index.js +++ b/projects/kleva/index.js @@ -1,24 +1,20 @@ const sdk = require("@defillama/sdk") -const { get } = require('../helper/http') +const { getConfig } = require('../helper/cache') const { userInfos } = require('./FairLaunch') -const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') const { getChainTransform, getFixBalances } = require('../helper/portedTokens') const { getTokenPrices } = require('../helper/unknownTokens') +const kExports = require('../kleva-lend') const chain = 'klaytn' // const TOKEN_PRICE_QUERY_URL = "https://api.kltalchemy.com/klay/ksInfo" const WORKERS_QUERY_URL = "https://kleva.io/static/data.json" async function getWorkers() { - return get(WORKERS_QUERY_URL) + return getConfig('kleva', WORKERS_QUERY_URL) } -const klayPool = '0xa691c5891d8a98109663d07bcf3ed8d3edef820a' -const wKlay = '0xf6f6b8bd0ac500639148f8ca5a590341a97de0de' - - // Fetch farm list // - multicall 'userInfos' on FairLaunch contract with lpPoolId & workerAddress async function getFarmingTVL(data, balances,) { @@ -57,25 +53,13 @@ async function getFarmingTVL(data, balances,) { return balances } -// Fetch lending pool(ibToken) list -// - multicall 'getTotalToken' on ibToken contracts -async function getLendingTVL(data) { - const tokensAndOwners = data.lendingPools.map(({ vaultAddress, ibToken: { originalToken }}) => { - if (vaultAddress.toLowerCase() === klayPool) - return [wKlay, klayPool] - return [originalToken.address, vaultAddress] - }) - tokensAndOwners.push([nullAddress, klayPool]) - return sumTokens2({ chain, tokensAndOwners }) -} - async function fetchLiquidity() { const data = await getWorkers() - const balances = await getLendingTVL(data) + const balances = {} return getFarmingTVL(data, balances) } module.exports = { - klaytn: { tvl: fetchLiquidity }, - timetravel: false, + klaytn: { tvl: sdk.util.sumChainTvls([fetchLiquidity, kExports.klaytn.tvl]) }, + doublecounted: true, } \ No newline at end of file diff --git a/projects/klex/index.js b/projects/klex/index.js index 3b1a4b714d6..9474c709c37 100644 --- a/projects/klex/index.js +++ b/projects/klex/index.js @@ -1,24 +1,15 @@ -const { request, gql } = require("graphql-request"); +const { onChainTvl } = require("../helper/balancer") + const { sumTokens2 } = require('../helper/unwrapLPs'); +const { configPost } = require('../helper/cache') const V2_ADDRESS = '0xb519Cf56C63F013B0320E89e1004A8DE8139dA27'; // shared by all networks function v2(chain) { - return async (time, ethBlock, chainBlocks) => { + return async (time, ethBlock, chainBlocks, param4) => { const block = chainBlocks[chain] - const tokensApi = `https://graph-prod.klex.finance/subgraphs/name/klex-staging-2-mainnet`; - const POOL_TOKENS = gql` - { - pools { - name - tokensList - address - } - }`; - - const v2Tokens = await request(tokensApi, POOL_TOKENS, { - block, - }); + const { data: v2Tokens } = await configPost('kex/klaytn', 'https://graph-prod.klex.finance/subgraphs/name/klex-staging-2-mainnet', { query: '{ pools { name tokensList address }}' }) + if (!v2Tokens) return onChainTvl('0xb519Cf56C63F013B0320E89e1004A8DE8139dA27', 99368355)(time, ethBlock, chainBlocks, param4) const tokens = []; const blacklist = [] for (const { address, tokensList } of v2Tokens.pools) { @@ -30,7 +21,8 @@ function v2(chain) { } module.exports = { - klaytn:{ + klaytn: { tvl: v2("klaytn") + // tvl: onChainTvl('0xb519Cf56C63F013B0320E89e1004A8DE8139dA27', 99368355) }, } \ No newline at end of file diff --git a/projects/klima-dao/index.js b/projects/klima-dao/index.js index bb619f47131..f630499ac73 100644 --- a/projects/klima-dao/index.js +++ b/projects/klima-dao/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { staking } = require('../helper/staking') const { sumTokensAndLPsSharedOwners } = require('../helper/unwrapLPs') const { transformPolygonAddress } = require('../helper/portedTokens') @@ -12,7 +13,7 @@ async function tvl(time, ethBlock, chainBlocks) { await sumTokensAndLPsSharedOwners(balances, [ ["0x2f800db0fdb5223b3c3f354886d907a671414a7f", false], // BCT ["0xD838290e877E0188a4A44700463419ED96c16107", false], // NCT - ["0x2791bca1f2de4661ed88a30c99a7a9449aa84174", false], // USDC + [ADDRESSES.polygon.USDC, false], // USDC ["0x03E3369af9390493CB7CC599Cd5233D50e674Da4", false], // MOSS ["0x6BCa3B77C1909Ce1a4Ba1A20d1103bDe8d222E48", false], // NBO ["0x1E67124681b402064CD0ABE8ed1B5c79D2e02f64", true], // USDC-BCT @@ -25,7 +26,7 @@ async function tvl(time, ethBlock, chainBlocks) { module.exports = { polygon: { - tvl, + tvl: () => 0, staking: staking("0x25d28a24Ceb6F81015bB0b2007D795ACAc411b4d", "0x4e78011ce80ee02d2c3e649fb657e45898257815", "polygon") } } \ No newline at end of file diff --git a/projects/klondike/abi.json b/projects/klondike/abi.json index 3d511319131..f2cbf8b0f71 100644 --- a/projects/klondike/abi.json +++ b/projects/klondike/abi.json @@ -1,15 +1,3 @@ { - "allAllowedTokens": { - "inputs": [], - "name": "allAllowedTokens", - "outputs": [ - { - "internalType": "address[]", - "name": "", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - } + "allAllowedTokens": "address[]:allAllowedTokens" } \ No newline at end of file diff --git a/projects/kmex-io/index.js b/projects/kmex-io/index.js new file mode 100644 index 00000000000..bbd6b0e2d4f --- /dev/null +++ b/projects/kmex-io/index.js @@ -0,0 +1,15 @@ +const { gmxExports } = require('../helper/gmx') +const { sumTokensExport } = require("../helper/unknownTokens") + +// Kava +const kmexVault = '0x15B29830D5bE7240c7a401fe0B0dA5086C9d84c5'; +const kmexStaking = '0x71dDDafFb0DB6BEDc9495Ef92c5700ec96527BFb'; // Staked KMX, sKMX +const kavaKMX = '0x599b05875866ceB7378452D9F432d5377825F44B'; +const kavaKMXKAVAPool = '0xA08848E7A4dbaEeE8eeAb93a05F437ed9Efa2162' + +module.exports = { + kava: { + staking: sumTokensExport({ owner: kmexStaking, tokens: [kavaKMX],lps: [kavaKMXKAVAPool], useDefaultCoreAssets: true, }), + tvl: gmxExports({ vault: kmexVault, }) + }, +}; diff --git a/projects/knightswap/index.js b/projects/knightswap/index.js index d105227142f..821c90e9864 100644 --- a/projects/knightswap/index.js +++ b/projects/knightswap/index.js @@ -1,4 +1,4 @@ -const { calculateUniTvl } = require("../helper/calculateUniTvl"); +const { uniTvlExport } = require("../helper/calculateUniTvl"); const { stakingUnknownPricedLP } = require("../helper/staking"); const bscFactory = "0xf0bc2E21a76513aa7CC2730C7A1D6deE0790751f"; @@ -12,45 +12,10 @@ const ftmStaking = "0xb02e3A4B5ebC315137753e24b6Eb6aEF7D602E40"; const ftmKnight = "0x6cc0e0aedbbd3c35283e38668d959f6eb3034856"; const knightUsdcLP = "0x68D47D67b893c44A72BCAC39b1b658D4Cbdf87CA"; -const translateTokens = { - "0x049d68029688eabf473097a2fc38ef61633a3c7a": - "0xdac17f958d2ee523a2206206994597c13d831ec7", // fUSDT to USDT - "0x8d11ec38a3eb5e956b052f67da8bdc9bef8abf3e": - "0x6b175474e89094c44da98b954eedeac495271d0f", // DAI -}; - -async function bscTvl(timestamp, block, chainBlocks) { - return await calculateUniTvl( - (addr) => `bsc:${addr}`, - chainBlocks.bsc, - "bsc", - bscFactory, - 0, - true - ); -} - -async function ftmTvl(timestamp, block, chainBlocks) { - return await calculateUniTvl( - (addr) => { - addr = addr.toLowerCase(); - if (translateTokens[addr] !== undefined) { - return translateTokens[addr]; - } - return `fantom:${addr}`; - }, - chainBlocks.fantom, - "fantom", - ftmFactory, - 0, - true - ); -} - module.exports = { methodology: "TVL consists of pools created by the factory contract", bsc: { - tvl: bscTvl, + tvl: uniTvlExport(bscFactory, 'bsc', true), staking: stakingUnknownPricedLP( bscStaking, bscKnight, @@ -60,7 +25,7 @@ module.exports = { ), }, fantom: { - tvl: ftmTvl, + tvl: uniTvlExport(ftmFactory, 'fantom', true), staking: stakingUnknownPricedLP( ftmStaking, ftmKnight, diff --git a/projects/koffeeswap/abi.json b/projects/koffeeswap/abi.json index fa58a0b2269..9a9dc1f8d72 100644 --- a/projects/koffeeswap/abi.json +++ b/projects/koffeeswap/abi.json @@ -1,70 +1,6 @@ { - "stakingToken": { - "inputs": [], - "name": "stakingToken", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "token0": { - "constant": true, - "inputs": [], - "name": "token0", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "token1": { - "constant": true, - "inputs": [], - "name": "token1", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "getReserves": { - "constant": true, - "inputs": [], - "name": "getReserves", - "outputs": [ - { - "internalType": "uint112", - "name": "_reserve0", - "type": "uint112" - }, - { - "internalType": "uint112", - "name": "_reserve1", - "type": "uint112" - }, - { - "internalType": "uint32", - "name": "_blockTimestampLast", - "type": "uint32" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } + "stakingToken": "address:stakingToken", + "token0": "address:token0", + "token1": "address:token1", + "getReserves": "function getReserves() view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast)" } \ No newline at end of file diff --git a/projects/koffeeswap/index.js b/projects/koffeeswap/index.js index c375fe0d4ea..26e17a5731d 100644 --- a/projects/koffeeswap/index.js +++ b/projects/koffeeswap/index.js @@ -1,97 +1,5 @@ -const sdk = require("@defillama/sdk"); -const abi = require("./abi.json"); - -const FeatureStaking = "0xc0ffee0000212c25e338100f46c962473ed0447a"; -const KOFFEE = "0xc0ffee0000921eb8dd7d506d4de8d5b79b856157"; - -const brewContracts = [ - //KCS-USDT - "0xc0Ffee000019988Ae7e8aaA41AF3886eB8750401", - //KCS-USDC - "0xc0FfeE000016Ed5788F82814bE35AE8c8Aba06Cc", - //KCS-KOFFEE - "0xC0FFeE0000123A0DfdE79aaAA124B4919393cd0F", - //KOFFEE-USDT - "0xC0FfeE0000c3C9087Bc012d00F13ad5c781cEe87", - //KOFFEE-USDC - "0xc0fFEe0000961b3e66C635e3395EAbc6A637c8A2", -]; - -/*** Staking of native token (KOFFEE) TVL Portion ***/ -const staking = async (timestamp, ethBlock, chainBlocks) => { - const balances = {}; - - const stakingBalance = ( - await sdk.api.abi.call({ - abi: 'erc20:balanceOf', - target: KOFFEE, - params: FeatureStaking, - chain: "kucoin", - block: chainBlocks["kucoin"], - }) - ).output; - - sdk.util.sumSingleBalance(balances, `kucoin:${KOFFEE}`, stakingBalance); - - return balances; -}; - -const kccTvl = async (timestamp, ethBlock, chainBlocks) => { - const balances = {}; - - const stakingTokens = ( - await sdk.api.abi.multiCall({ - abi: abi.stakingToken, - calls: brewContracts.map((brew) => ({ - target: brew, - })), - chain: "kcc", - block: chainBlocks["kcc"], - }) - ).output.map((st) => st.output); - - for (let i = 0; i < stakingTokens.length; i++) { - const token0 = ( - await sdk.api.abi.call({ - target: stakingTokens[i], - abi: abi.token0, - chain: "kcc", - block: chainBlocks["kcc"], - }) - ).output; - - const token1 = ( - await sdk.api.abi.call({ - target: stakingTokens[i], - abi: abi.token1, - chain: "kcc", - block: chainBlocks["kcc"], - }) - ).output; - - const getReserves = ( - await sdk.api.abi.call({ - target: stakingTokens[i], - abi: abi.getReserves, - chain: "kcc", - block: chainBlocks["kcc"], - }) - ).output; - - sdk.util.sumSingleBalance(balances, `kcc:${token0}`, getReserves[0]); - - sdk.util.sumSingleBalance(balances, `kcc:${token1}`, getReserves[1]); - } - - return balances; -}; +const { getUniTVL } = require('../helper/unknownTokens') module.exports = { - misrepresentedTokens: true, - kcc: { - staking, - tvl: kccTvl, - }, - methodology: - "We count liquidity on the brews threw their contracts and the portion TVL staking the native token (KOFFEE) by FeatureStaking contract", -}; + kcc: { tvl: getUniTVL({ factory: '0xc0ffee00000e1439651c6ad025ea2a71ed7f3eab', useDefaultCoreAssets: true, }), }, +} diff --git a/projects/kogefarm/abi.json b/projects/kogefarm/abi.json index d19c061c481..475566dac80 100644 --- a/projects/kogefarm/abi.json +++ b/projects/kogefarm/abi.json @@ -1,188 +1,13 @@ { - "balance": { - "inputs": [], - "name": "balance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "balanceOf": { - "constant": true, - "inputs": [ - { - "name": "_owner", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "name": "balance", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" -}, - "token": { - "inputs": [], - "name": "token", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "symbol": { - "inputs": [], - "name": "symbol", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getPoolTokens": { - "inputs": [ - { - "internalType": "bytes32", - "name": "poolId", - "type": "bytes32" - } - ], - "name": "getPoolTokens", - "outputs": [ - { - "internalType": "contract IERC20[]", - "name": "tokens", - "type": "address[]" - }, - { - "internalType": "uint256[]", - "name": "balances", - "type": "uint256[]" - }, - { - "internalType": "uint256", - "name": "lastChangeBlock", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getPoolId": { - "inputs": [], - "name": "getPoolId", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - "totalSupply": { - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getRatio": { - "inputs": [], - "name": "getRatio", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "poolLength": { - "inputs": [], - "name": "poolLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "poolInfo": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "poolInfo", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "lpToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "allocPoint", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastRewardBlock", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accRewardPerShare", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "totalLiquidity": { - "inputs": [], - "name": "totalLiquidity", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -} + "balance": "uint256:balance", + "balanceOf": "function balanceOf(address _owner) view returns (uint256 balance)", + "token": "address:token", + "symbol": "string:symbol", + "getPoolTokens": "function getPoolTokens(bytes32 poolId) view returns (address[] tokens, uint256[] balances, uint256 lastChangeBlock)", + "getPoolId": "function getPoolId() view returns (bytes32)", + "totalSupply": "uint256:totalSupply", + "getRatio": "uint256:getRatio", + "poolLength": "uint256:poolLength", + "poolInfo": "function poolInfo(uint256) view returns (address lpToken, uint256 allocPoint, uint256 lastRewardBlock, uint256 accRewardPerShare)", + "totalLiquidity": "uint256:totalLiquidity" +} \ No newline at end of file diff --git a/projects/kogefarm/helper.js b/projects/kogefarm/helper.js index c198ebba4ce..da16dff3bf7 100644 --- a/projects/kogefarm/helper.js +++ b/projects/kogefarm/helper.js @@ -1,20 +1,20 @@ +const ADDRESSES = require('../helper/coreAssets.json') const BigNumber = require('bignumber.js') const sdk = require('@defillama/sdk') const abi = require('./abi.json') -const { unwrapCrv } = require('../helper/unwrapLPs') function transformAddressKF(chain = 'polygon') { return (addr) => { // WETH - if (addr.toLowerCase() === '0x7ceb23fd6bc0add59e62ac25578270cff1b9f619') { - return '0x0000000000000000000000000000000000000000' + if (addr.toLowerCase() === ADDRESSES.polygon.WETH_1) { + return ADDRESSES.null } // Special cases since coingecko doesn't find them if ( // fUSDT (chain === 'fantom' && - addr.toLowerCase() === '0x049d68029688eabf473097a2fc38ef61633a3c7a') || + addr.toLowerCase() === ADDRESSES.fantom.fUSDT) || (chain === 'moonriver' && addr.toLowerCase() === '0xe936caa7f6d9f5c9e907111fcaf7c351c184cda7') ) { @@ -24,7 +24,7 @@ function transformAddressKF(chain = 'polygon') { if ( // renbtc on Fantom (chain === 'fantom' && - addr.toLowerCase() === '0xdbf31df14b66535af65aac99c32e9ea844e14501') + addr.toLowerCase() === ADDRESSES.fantom.renBTC) ) { // renbtc on Polygon return `polygon:0xDBf31dF14B66535aF65AaC99C32e9eA844e14501` @@ -40,7 +40,7 @@ function transformAddressKF(chain = 'polygon') { if ( // Dai on Fantom (chain === 'fantom' && - addr.toLowerCase() === '0x8d11ec38a3eb5e956b052f67da8bdc9bef8abf3e') + addr.toLowerCase() === ADDRESSES.fantom.DAI) ) { // Dai on Eth return `ethereum:0x6b175474e89094c44da98b954eedeac495271d0f` @@ -103,7 +103,7 @@ function transformAddressKF(chain = 'polygon') { return `avax:0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7` } // Special case for MIM, since coingecko doesn't find - if (addr.toLowerCase() === '0x82f0b8b456c1a451378467398982d4834b6829c1') { + if (addr.toLowerCase() === ADDRESSES.fantom.MIM) { // MIM return `ethereum:0x99d8a9c45b2eca8864373a26d1459e3dff1e17f3` } @@ -178,21 +178,12 @@ async function unwrapCrvLPs( lpPositions, block, chain = 'ethereum', - transformAddress = (addr) => addr, - excludeTokensRaw=[] ) { await Promise.all( lpPositions.map(async (lp) => { const underlyingToken = lp.token const underlyingTokenBalance = lp.balance - try { - await unwrapCrv(balances, underlyingToken, underlyingTokenBalance, block, chain, transformAddress, excludeTokensRaw) - } catch (e) { - console.log( - `Failed to get data for Curve LP token at ${lp.token} on chain ${chain}`, - ) - throw e - } + sdk.util.sumSingleBalance(balances,underlyingToken,underlyingTokenBalance, chain) }), ) } diff --git a/projects/kogefarm/index.js b/projects/kogefarm/index.js index d00c3b3903f..f98988fc8e2 100644 --- a/projects/kogefarm/index.js +++ b/projects/kogefarm/index.js @@ -1,8 +1,10 @@ const sdk = require('@defillama/sdk') const abi = require('./abi.json') const utils = require('../helper/utils') -const { unwrapUniswapLPs, unwrapCrv } = require('../helper/unwrapLPs') -const { transformPolygonAddress, getFixBalances } = require('../helper/portedTokens') +const { unwrapUniswapLPs, } = require('../helper/unwrapLPs') +const { getFixBalances } = require('../helper/portedTokens') +const { getConfig } = require('../helper/cache') + const { transformAddressKF, getSinglePositions, @@ -129,7 +131,7 @@ const polygonTvl = ({ include, exclude }) => async ( /* const vaults_full = (await utils.fetchURL(current_polygon_vaults_url)).data let vaults = vaults_full.map( v => v['vault']) */ - let vaults = (await utils.fetchURL(current_polygon_vaults_url)).data + let vaults = (await getConfig('kogefarm/polygon',current_polygon_vaults_url)) if (include) { vaults = include @@ -242,7 +244,7 @@ const polygonTvl = ({ include, exclude }) => async ( const fantomTvl = async (timestamp, block, chainBlocks) => { let balances = {} - let vaults = (await utils.fetchURL(current_fantom_vaults_url)).data + let vaults = (await getConfig('kogefarm/fantom', current_fantom_vaults_url)) const lp_addresses = ( await sdk.api.abi.multiCall({ @@ -438,7 +440,7 @@ const fantomTvl = async (timestamp, block, chainBlocks) => { const moonriverTvl = async (timestamp, block, chainBlocks) => { const balances = {} - let vaults = (await utils.fetchURL(current_moonriver_vaults_url)).data + let vaults = (await getConfig('kogefarm/moonriver', current_moonriver_vaults_url)) const lp_addresses = ( await sdk.api.abi.multiCall({ @@ -532,8 +534,8 @@ const kavaTvl = async (timestamp, block, chainBlocks) => { let balances = {}; - let vaults = (await utils.fetchURL(current_kava_vaults_url)).data - if (typeof vaults === 'string') vaults = JSON.parse(vaults.replace(/\,(\s*[\}\]])/g, '$1')) + let vaults = (await getConfig('kogefarm/kava', current_kava_vaults_url)) + if (typeof vaults === 'string') vaults = JSON.parse(vaults.replace(/,(\s*[}\]])/g, '$1')) const lp_addresses = ( await sdk.api.abi.multiCall({ @@ -621,19 +623,6 @@ const kavaTvl = async (timestamp, block, chainBlocks) => { transformAddress, ) - -/* const { updateBalances, - pairBalances, - prices, - balances } = await getTokenPrices({ - block: kavablock, - chain: kavachain, - useDefaultCoreAssets: true, - lps: uniV2Positions.map(val => val.token), - transformAddress: transformAddress, - allLps: true - }) -*/ await getSinglePositions( balances, singlePositions, diff --git a/projects/kokoa-finance/Helper.json b/projects/kokoa-finance/Helper.json index 75304216438..e3c0899bc58 100644 --- a/projects/kokoa-finance/Helper.json +++ b/projects/kokoa-finance/Helper.json @@ -1,69 +1,9 @@ { "address": "0x2b170005ADA0e616E78A7fa93ea4473c03A98aa0", - "abi": [ - { - "inputs": [], - "name": "getCollateralTVL", - "outputs": [ - { - "internalType": "uint256[]", - "name": "collateralTVL", - "type": "uint256[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getSkokoaTVL", - "outputs": [ - { - "internalType": "uint256", - "name": "tvl", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "pool", - "type": "address" - } - ], - "name": "getKlayswapLpFarmTVL", - "outputs": [ - { - "internalType": "uint256", - "name": "tvl", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "pool", - "type": "address" - } - ], - "name": "getKokonutLpFarmTVL", - "outputs": [ - { - "internalType": "uint256", - "name": "tvl", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } - ] + "abi":{ + "getCollateralTVL": "uint256[]:getCollateralTVL", + "getSkokoaTVL": "uint256:getSkokoaTVL", + "getKlayswapLpFarmTVL": "function getKlayswapLpFarmTVL(address pool) view returns (uint256 tvl)", + "getKokonutLpFarmTVL": "function getKokonutLpFarmTVL(address pool) view returns (uint256 tvl)" + } } \ No newline at end of file diff --git a/projects/kokoa-finance/index.js b/projects/kokoa-finance/index.js index c9b227c67c3..bd2b6ab0bcb 100644 --- a/projects/kokoa-finance/index.js +++ b/projects/kokoa-finance/index.js @@ -1,6 +1,5 @@ const ABI = require("./Helper.json"); const sdk = require("@defillama/sdk"); -const { sumTokens2 } = require('../helper/unwrapLPs') const chain = 'klaytn' const { toUSDTBalances } = require("../helper/balances"); @@ -48,7 +47,7 @@ const fetchCollateral = async (ts, _block, chainBlocks) => { const { output: assetTvlLists } = await sdk.api.abi.call({ chain, block, target: HELPER_ADDR, - abi: ABI.abi.find(i => i.name === 'getCollateralTVL') + abi: ABI.abi.getCollateralTVL }) for (let assetTvl of assetTvlLists) { sum = sum.plus(assetTvl); @@ -73,7 +72,7 @@ const fetchPool2 = async (ts, _block, chainBlocks) => { chain, block, target: HELPER_ADDR, params: [pool[`address`]], - abi: ABI.abi.find(i => i.name === 'getKlayswapLpFarmTVL') + abi: ABI.abi.getKlayswapLpFarmTVL }) klayswapPool2Tvl = klayswapPool2Tvl.plus(value); } @@ -83,7 +82,7 @@ const fetchPool2 = async (ts, _block, chainBlocks) => { chain, block, target: HELPER_ADDR, params: [pool[`address`]], - abi: ABI.abi.find(i => i.name === 'getKokonutLpFarmTVL') + abi: ABI.abi.getKokonutLpFarmTVL }) kokonutPool2Tvl = kokonutPool2Tvl.plus(value); } @@ -98,7 +97,7 @@ const fetchStakedToken = async (ts, _block, chainBlocks) => { let { output: skokoaTvl } = await sdk.api.abi.call({ chain, block, target: HELPER_ADDR, - abi: ABI.abi.find(i => i.name === 'getSkokoaTVL') + abi: ABI.abi.getSkokoaTVL }) const decimal = 18; skokoaTvl = BigNumber(skokoaTvl).dividedBy(BigNumber(10).pow(decimal * 2)); diff --git a/projects/kokomo/index.js b/projects/kokomo/index.js new file mode 100644 index 00000000000..3a95257d7ab --- /dev/null +++ b/projects/kokomo/index.js @@ -0,0 +1,9 @@ +const { compoundExports, } = require('../helper/compound') + +module.exports = { + hallmarks: [ + [1680264000,"Rug Pull"] + ], + optimism: compoundExports('0x91c471053bA4697B13d62De1E850Cc89EbE23633', 'optimism'), + arbitrum: compoundExports('0x91c471053bA4697B13d62De1E850Cc89EbE23633', 'arbitrum'), +} diff --git a/projects/kokomoswap/abi.json b/projects/kokomoswap/abi.json index da384469326..2ce098a22b5 100644 --- a/projects/kokomoswap/abi.json +++ b/projects/kokomoswap/abi.json @@ -1,49 +1,4 @@ -{ - "poolInfo": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "poolInfo", - "outputs": [ - { - "internalType": "contract IBEP20", - "name": "lpToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "allocPoint", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastRewardBlock", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accKokomoPerShare", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "poolLength": { - "inputs": [], - "name": "poolLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } +{ + "poolInfo": "function poolInfo(uint256) view returns (address lpToken, uint256 allocPoint, uint256 lastRewardBlock, uint256 accKokomoPerShare)", + "poolLength": "uint256:poolLength" } \ No newline at end of file diff --git a/projects/kokomoswap/index.js b/projects/kokomoswap/index.js index 6fa47f43828..3bad2fefb2b 100644 --- a/projects/kokomoswap/index.js +++ b/projects/kokomoswap/index.js @@ -5,7 +5,6 @@ const FACTORY = "0x971A5f6Ef792bA565cdF61C904982419AA77989f"; module.exports = { bsc: { tvl: getUniTVL({ - chain: 'bsc', useDefaultCoreAssets: true, factory: FACTORY, }), diff --git a/projects/kokonut-swap/abi.json b/projects/kokonut-swap/abi.json index 201ca0409b3..fbcc0eb5af1 100644 --- a/projects/kokonut-swap/abi.json +++ b/projects/kokonut-swap/abi.json @@ -1,62 +1,6 @@ { - "getPoolPriceInfo": { - "inputs": [ - { - "internalType": "contract II4ISwapPool", - "name": "swap", - "type": "address" - } - ], - "name": "getPoolPriceInfo", - "outputs": [ - { - "internalType": "address[]", - "name": "tokens", - "type": "address[]" - }, - { - "internalType": "uint256[]", - "name": "balances", - "type": "uint256[]" - }, - { - "internalType": "uint256[]", - "name": "prices", - "type": "uint256[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getStakedEyePriceInfo": { - "inputs": [], - "name": "getStakedEyePriceInfo", - "outputs": [ - { - "internalType": "uint256", - "name": "balance", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "price", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getPoolList": { - "inputs": [], - "name": "getPoolList", - "outputs": [ - { - "internalType": "address[]", - "name": "", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - } + "getPoolPriceInfo": "function getPoolPriceInfo(address swap) view returns (address[] tokens, uint256[] balances, uint256[] prices)", + "getStakedEyePriceInfo": "function getStakedEyePriceInfo() view returns (uint256 balance, uint256 price)", + "getRegisteredPools": "function getRegisteredPools() view returns (tuple(address addr,string name,string symbol,address lpTokenAddress,uint256 lpTokenVirtualPrice,uint256 lpTokenTotalSupply,uint256 adminFee,tuple(address addr,string name,string symbol,uint8 decimals,uint256 balance,uint256 nativeBalance,uint256 allowance,bool isLpToken)[] liquidity,uint256 xcpProfit,uint256 priceScale,uint256 priceOracle)[])", + "getPoolList": "address[]:getPoolList" } \ No newline at end of file diff --git a/projects/kokonut-swap/index.js b/projects/kokonut-swap/index.js index d89ce088f77..7c6f58e6577 100644 --- a/projects/kokonut-swap/index.js +++ b/projects/kokonut-swap/index.js @@ -1,12 +1,14 @@ const abi = require("./abi.json"); const sdk = require("@defillama/sdk"); const { requery } = require('../helper/requery.js'); +const { sumTokens2 } = require("../helper/unwrapLPs"); +const { getUniTVL } = require("../helper/unknownTokens"); const registry_addr = "0xBd21dD5BCFE28475D26154935894d4F515A7b1C0"; const helper_addr = "0x1A09643f4D70B9Aa9da5737568C1935ED37423aa"; const chain = 'klaytn'; -async function tvl(timestamp, _, { klaytn: block }) { +async function klaytn_tvl(timestamp, _, { klaytn: block }) { const balances = {}; const poolList = (await sdk.api.abi.call({ @@ -21,10 +23,10 @@ async function tvl(timestamp, _, { klaytn: block }) { params: p })), abi: abi.getPoolPriceInfo, - block, chain + block, chain, + permitFailure: true, }); - await requery(info, chain, block, abi.getPoolPriceInfo); const gasToken = '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE'.toLowerCase() const tokenSet = new Set() @@ -61,7 +63,35 @@ async function tvl(timestamp, _, { klaytn: block }) { } return balances; -}; +} + +async function polygon_zkevm_tvl(_, _b, _cb, { api }) { + const ownerTokens = []; + const poolList = (await sdk.api.abi.call({ + target: "0x677bBBAd41D784a4731d902c613f8af43AAb4feb", + abi: abi.getRegisteredPools, + chain: 'polygon_zkevm' + })).output; + for (const pool of poolList) { + ownerTokens.push([pool.liquidity.map(t => t.addr), pool.addr]); + } + return sumTokens2({ api, ownerTokens }); +} + +const uniV2TVL = getUniTVL({ factory: '0x4Cf1284dcf30345232D5BfD8a8AAd6734b6941c4', useDefaultCoreAssets: true}); + +async function base_tvl(_, _b, _cb, { api }) { + const ownerTokens = []; + const poolList = (await sdk.api.abi.call({ + target: "0x03173F638B3046e463Ab6966107534f56E82E1F3", + abi: abi.getRegisteredPools, + chain: 'base' + })).output; + for (const pool of poolList) { + ownerTokens.push([pool.liquidity.map(t => t.addr), pool.addr]); + } + return sumTokens2({ api, ownerTokens }); +} async function staking(timestamp, _, { klaytn: block }) { const info = (await sdk.api.abi.call({ @@ -71,14 +101,20 @@ async function staking(timestamp, _, { klaytn: block }) { })).output; return { 'usd-coin': info.price * info.balance / 10 ** 36 }; -}; +} module.exports = { timetravel: false, misrepresentedTokens: true, klaytn: { staking, - tvl + tvl: klaytn_tvl + }, + polygon_zkevm: { + tvl: polygon_zkevm_tvl + }, + base: { + tvl: sdk.util.sumChainTvls([base_tvl, uniV2TVL]) }, methodology: "tvl is calculated using the total value of protocol's liquidity pool. Staked tokens include staked EYE values. Pool2 includes staked lp tokens eligible for KOKOS emissions" diff --git a/projects/kokoswap/abi.json b/projects/kokoswap/abi.json index da384469326..2ce098a22b5 100644 --- a/projects/kokoswap/abi.json +++ b/projects/kokoswap/abi.json @@ -1,49 +1,4 @@ -{ - "poolInfo": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "poolInfo", - "outputs": [ - { - "internalType": "contract IBEP20", - "name": "lpToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "allocPoint", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastRewardBlock", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accKokomoPerShare", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "poolLength": { - "inputs": [], - "name": "poolLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } +{ + "poolInfo": "function poolInfo(uint256) view returns (address lpToken, uint256 allocPoint, uint256 lastRewardBlock, uint256 accKokomoPerShare)", + "poolLength": "uint256:poolLength" } \ No newline at end of file diff --git a/projects/kokoswap/index.js b/projects/kokoswap/index.js index 3cd4e88ac76..d96661b992d 100644 --- a/projects/kokoswap/index.js +++ b/projects/kokoswap/index.js @@ -5,7 +5,6 @@ module.exports = { misrepresentedTokens: true, bsc: { tvl: getUniTVL({ - chain: 'bsc', useDefaultCoreAssets: true, factory: FACTORY, }), diff --git a/projects/kommunitas/index.js b/projects/kommunitas/index.js index cda342866b8..83a58fa243d 100644 --- a/projects/kommunitas/index.js +++ b/projects/kommunitas/index.js @@ -1,18 +1,20 @@ const { stakings } = require("../helper/staking"); -const KOM_TOKEN_CONTRACT = '0xC004e2318722EA2b15499D6375905d75Ee5390B8'; -const KOM_STAKING_CONTRACT = [ +const KOM_TOKEN_CONTRACT_POLYGON = '0xC004e2318722EA2b15499D6375905d75Ee5390B8'; +const KOM_STAKING_CONTRACT_POLYGON = [ "0x453d0a593d0af91e77e590a7935894f7ab1b87ec", - "0x8d37b12DB32E07d6ddF10979c7e3cDECCac3dC13" + "0x8d37b12DB32E07d6ddF10979c7e3cDECCac3dC13", + "0x8d34Bb43429c124E55ef52b5B1539bfd121B0C8D" ]; +const KOM_TOKEN_CONTRACT_ARBITRUM = '0xA58663FAEF461761e44066ea26c1FCddF2927B80'; +const KOM_STAKING_CONTRACT_ARBITRUM = ["0x5b63bdb6051CcB9c387252D8bd2364D7A86eFC70"]; module.exports = { polygon: { tvl: () => ({}), - staking: stakings( - KOM_STAKING_CONTRACT, - KOM_TOKEN_CONTRACT, - "polygon", - `polygon:${KOM_TOKEN_CONTRACT}` - ) - } -}; \ No newline at end of file + staking: stakings(KOM_STAKING_CONTRACT_POLYGON, KOM_TOKEN_CONTRACT_POLYGON) + }, + arbitrum: { + tvl: () => ({}), + staking: stakings(KOM_STAKING_CONTRACT_ARBITRUM, KOM_TOKEN_CONTRACT_ARBITRUM) + }, +}; diff --git a/projects/konverter/contracts.json b/projects/konverter/contracts.json new file mode 100644 index 00000000000..383135ab3c7 --- /dev/null +++ b/projects/konverter/contracts.json @@ -0,0 +1,31 @@ +{ + "wemix": { + "priceCalculator": "0xdc9cd9f7a3b962857854120dC3a8c75ed8A48b9e", + "stableSwapHelper": "0x164056263dBB527D06B008F263780fC8f1Bd22F5", + "pools": { + "0xa60448B0621335905a65753173D7e6FDFe494Da2": { + "name": "k3Pool", + "isMetaPool": false, + "n_coins": 3, + "poolToken": "0x7D57CeF121AC2371472214d100FF01eC6ddD5fAa", + "underlyingTokens": [ + "0xE3F5a90F9cb311505cd691a46596599aA1A0AD7D", + "0xA649325Aa7C5093d12D6F98EB4378deAe68CE23F", + "0x8E81fCc2d4A3bAa0eE9044E0D7E36F59C9BbA9c1" + ] + }, + "0xDacaD9ddF713496012748D35496c0FB09c8d8c15": { + "name": "wcd-k3Pool", + "isMetaPool": true, + "n_coins": 2, + "poolToken": "0xf7FA632AbeEDAD21E59089c5174C47735903506F", + "underlyingTokens": [ + "0x2ec6Fc5c495aF0C439E17268d595286d5f897dD0", + "0xE3F5a90F9cb311505cd691a46596599aA1A0AD7D", + "0xA649325Aa7C5093d12D6F98EB4378deAe68CE23F", + "0x8E81fCc2d4A3bAa0eE9044E0D7E36F59C9BbA9c1" + ] + } + } + } +} \ No newline at end of file diff --git a/projects/konverter/index.js b/projects/konverter/index.js new file mode 100644 index 00000000000..9641ea22a5b --- /dev/null +++ b/projects/konverter/index.js @@ -0,0 +1,16 @@ +const { sumTokens2 } = require('../helper/unwrapLPs') +const contracts = require("./contracts.json"); + +async function tvl(_, _b, _cb, { api, }) { + const ownerTokens = Object.entries(contracts[api.chain].pools).map(([pool, { underlyingTokens }]) => [underlyingTokens, pool]) + const blacklistedTokens = ownerTokens.map(i => i[1]) + return sumTokens2({ api, ownerTokens, blacklistedTokens }) +} + +module.exports = { + methodology: + "Sum of each liquidity pool's value", + wemix: { + tvl + } +}; diff --git a/projects/koone/index.js b/projects/koone/index.js new file mode 100644 index 00000000000..ee330b2fdc1 --- /dev/null +++ b/projects/koone/index.js @@ -0,0 +1,9 @@ +const { getUniTVL } = require('../helper/unknownTokens'); + +module.exports = { + misrepresentedTokens: true, + era: { + tvl: getUniTVL({ factory: '0x6167ce530e710e29d0F32CFe50062028800e5918', useDefaultCoreAssets: true }) + }, + methodology: "Counts liquidity in pools", +}; \ No newline at end of file diff --git a/projects/koyo/constants.js b/projects/koyo/constants.js index de9f68f1963..0e6898c9e2e 100644 --- a/projects/koyo/constants.js +++ b/projects/koyo/constants.js @@ -1,44 +1,26 @@ -const { gql } = require("graphql-request"); - -const tvlExclusion = ["ethereum"]; -const treasuryExclusion = []; -const stakingExclusion = ["ethereum"]; - +const ADDRESSES = require('../helper/coreAssets.json') const addresses = { boba: { treasury: "0x559dBda9Eb1E02c0235E245D9B175eb8DcC08398", staking: "0xD3535a7797F921cbCD275d746A4EFb1fBba0989F", feeCollector: "0xc9453BaBf4705F18e3Bb8790bdc9789Aaf17c2E1", - KYO: "0x618CC6549ddf12de637d46CDDadaFC0C2951131C", - BOBA: "0xa18bF3994C0Cc6E3b63ac420308E5383f53120D7", - FRAX: "0x7562F525106F5d54E891e005867Bf489B5988CD9", - USDC: "0x66a2A913e447d6b4BF33EFbec43aAeF87890FBbc", - USDT: "0x5DE1677344D3Cb0D7D465c10b72A8f60699C062d", - DAI: "0xf74195Bb8a5cf652411867c5C2C5b8C2a402be35", + tokens: { + KYO: "0x618CC6549ddf12de637d46CDDadaFC0C2951131C", + BREW: "0x3a93bd0fa10050d206370eea53276542a105c885", + BOBA: ADDRESSES.boba.BOBA, + FRAX: ADDRESSES.boba.FRAX, + USDC: ADDRESSES.boba.USDC, + USDT: ADDRESSES.boba.USDT, + DAI: ADDRESSES.boba.DAI, + }, + vault: '0x2a4409cc7d2ae7ca1e3d915337d1b6ba2350d6a3', }, ethereum: { treasury: "0x47BbF992a25B7fe1D532F8128D514524462731eF", - USDC: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", + USDC: ADDRESSES.ethereum.USDC, } }; -const POOL_TOKENS = gql` - { - koyos { - address - pools(first: 1000) { - tokens { - address - } - } - } - } -`; - module.exports = { - tvlExclusion, - treasuryExclusion, - stakingExclusion, addresses, - POOL_TOKENS, }; diff --git a/projects/koyo/index.js b/projects/koyo/index.js index 22117fce1d2..b6878c4e665 100644 --- a/projects/koyo/index.js +++ b/projects/koyo/index.js @@ -1,145 +1,15 @@ -const sdk = require("@defillama/sdk"); const constants = require("./constants"); -const { requery } = require("../helper/requery"); -const { chainJoinExports, chainTypeExports } = require("./utils"); -const { getBlock } = require("../helper/getBlock"); const { staking } = require("../helper/staking"); -const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); -const { - getChainTransform, -} = require("../helper/portedTokens"); -const { request } = require("graphql-request"); +// const { onChainTvl } = require("../helper/balancer"); +const { sumTokensExport } = require("../helper/unwrapLPs"); -const DATA = { - boba: async () => { - const bobaTransform = await getChainTransform('boba'); - - return [ - bobaTransform, - { - treasury: { - addresss: [constants.addresses.boba.treasury], - tokens: [ - [constants.addresses.boba.BOBA, false], // BOBA(Boba) - [constants.addresses.boba.FRAX, false], // FRAX(Boba) - [constants.addresses.boba.USDC, false], // USDC(Boba) - [constants.addresses.boba.USDT, false], // USDT(Boba) - [constants.addresses.boba.DAI, false], // DAI(Boba) - ], - }, - staking: { - address: constants.addresses.boba.staking, - token: constants.addresses.boba.KYO, - }, - }, - ]; - }, - ethereum: async () => { - const ethereumTransform = await getChainTransform('ethereum'); - - return [ - ethereumTransform, - { - treasury: { - addresss: [constants.addresses.ethereum.treasury], - tokens: [ - [constants.addresses.ethereum.USDC, false], // USDC(Ethereum) - ], - }, - }, - ]; - }, -}; - -const chainTVL = (chain) => { - return async (timestamp, _ethBlock, chainBlocks) => { - if (!DATA[chain] || constants.tvlExclusion.includes(chain)) return {}; - - const balances = {}; - const block = await getBlock(timestamp, chain, chainBlocks); - - const [transform] = await DATA[chain](); - const subgraphApi = `https://api.thegraph.com/subgraphs/name/koyo-finance/exchange-subgraph-${chain}`; - - const koyoVault = await request(subgraphApi, constants.POOL_TOKENS, { - block, - }); - - let tokenAddresses = []; - for (const pool of koyoVault.koyos[0].pools) { - for (let address of pool.tokens) { - tokenAddresses.push(address.address); - } - } - tokenAddresses = [...new Set(tokenAddresses)]; - - const balanceCalls = tokenAddresses.flatMap((address) => { - return [ - { - target: address, - params: koyoVault.koyos[0].address, - }, - { target: address, params: constants.addresses[chain].feeCollector }, - ]; - }); - const balancesCalled = await sdk.api.abi.multiCall({ - block, - calls: balanceCalls, - abi: "erc20:balanceOf", - }); - await requery(balancesCalled, chain, block, "erc20:balanceOf"); - - sdk.util.sumMultiBalanceOf(balances, balancesCalled, true, transform); - - return balances; - }; -}; -const chainTreasury = (chain) => { - return async (timestamp, _ethBlock, chainBlocks) => { - if (!DATA[chain] || constants.treasuryExclusion.includes(chain)) return {}; - - const balances = {}; - const block = await getBlock(timestamp, chain, chainBlocks); - - const [transform, data] = await DATA[chain](); - - await sumTokensAndLPsSharedOwners( - balances, - data.treasury.tokens, - data.treasury.addresss, - block, - chain, - transform - ); - - return balances; - }; -}; -const chainStaking = (chain) => { - return async (timestamp, ethBlock, chainBlocks) => { - if (!DATA[chain] || constants.stakingExclusion.includes(chain)) return {}; - - const [, data] = await DATA[chain](); - - return staking(data.staking.address, data.staking.token, chain)( - timestamp, - ethBlock, - chainBlocks - ); - }; -}; - -module.exports = chainJoinExports( - [ - (chains) => chainTypeExports("tvl", chainTVL, chains), - (chains) => chainTypeExports("treasury", chainTreasury, chains), - (chains) => chainTypeExports("staking", chainStaking, chains), - ], - ["boba", "ethereum"] -); module.exports = { - ...module.exports, + boba: { + // tvl: onChainTvl(constants.addresses.boba.vault, 668337), + tvl: sumTokensExport({ owner: constants.addresses.boba.vault, tokens: Object.values(constants.addresses.boba.tokens)}), + staking: staking(constants.addresses.boba.staking, constants.addresses.boba.tokens.KYO), + }, methodology: "Counts the tokens locked on swap pools based on their holdings.", hallmarks: [ diff --git a/projects/kperp-exchange/index.js b/projects/kperp-exchange/index.js index e600621fdcc..208b98c27ea 100644 --- a/projects/kperp-exchange/index.js +++ b/projects/kperp-exchange/index.js @@ -10,7 +10,7 @@ const kavaKpeUsdcPool = '0x9321922ae0e4Ad4642707cAc5bBaECF9C26f2B18' module.exports = { kava: { - staking: sumTokensExport({ chain: 'kava', owner: kavaStaking, tokens: [kavaKPE],lps: [kavaKpeUsdcPool], useDefaultCoreAssets: true, }), - tvl: gmxExports({ chain: 'kava', vault: kavaVault, }) + staking: sumTokensExport({ owner: kavaStaking, tokens: [kavaKPE],lps: [kavaKpeUsdcPool], useDefaultCoreAssets: true, }), + tvl: gmxExports({ vault: kavaVault, }) }, }; diff --git a/projects/kriya-dex/index.js b/projects/kriya-dex/index.js new file mode 100644 index 00000000000..7590c8fb945 --- /dev/null +++ b/projects/kriya-dex/index.js @@ -0,0 +1,21 @@ +const sui = require('../helper/chain/sui') + +const EVENT_FILTER = "0xa0eba10b173538c8fecca1dff298e488402cc9ff374f8a12ca7758eebe830b66::spot_dex::PoolCreatedEvent"; + +async function kriyaTVL(_, _1, _2, { api }) { + const poolIds = await sui.queryEvents({ eventType: EVENT_FILTER, transform: i => i.pool_id}); + const pools = await sui.getObjects(poolIds) + pools.forEach(i => { + const [token0, token1] = i.type.split('<')[1].replace('>', '').split(', ') + api.add(token0, i.fields.token_x) + api.add(token1, i.fields.token_y) + }) +} + +module.exports = { + timetravel: false, + methodology: "Collects TVL for all pools created on KriyaDEX", + sui: { + tvl: kriyaTVL, + } +} \ No newline at end of file diff --git a/projects/kromatika/abi.json b/projects/kromatika/abi.json index abee2be187a..d5f66674a0b 100644 --- a/projects/kromatika/abi.json +++ b/projects/kromatika/abi.json @@ -1,85 +1,6 @@ { - "tokenByIndex": { - "inputs": [ - { - "internalType": "uint256", - "name": "index", - "type": "uint256" - } - ], - "name": "tokenByIndex", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "orders": { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "orders", - "outputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "token0", - "type": "address" - }, - { - "internalType": "address", - "name": "token1", - "type": "address" - }, - { - "internalType": "uint24", - "name": "fee", - "type": "uint24" - }, - { - "internalType": "int24", - "name": "tickLower", - "type": "int24" - }, - { - "internalType": "int24", - "name": "tickUpper", - "type": "int24" - }, - { - "internalType": "uint128", - "name": "liquidity", - "type": "uint128" - }, - { - "internalType": "uint256", - "name": "processed", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "tokensOwed0", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "tokensOwed1", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } + "tokenByIndex": "function tokenByIndex(uint256 index) view returns (uint256)", + "tokenIds": "function tokenIds(uint256 index) view returns (uint256)", + "monitors": "function monitors(uint256 index) view returns (address)", + "orders": "function orders(uint256 tokenId) view returns (address owner, address token0, address token1, uint24 fee, int24 tickLower, int24 tickUpper, uint128 liquidity, uint256 processed, uint256 tokensOwed0, uint256 tokensOwed1)" } \ No newline at end of file diff --git a/projects/kromatika/index.js b/projects/kromatika/index.js index 1b43d08a41a..e7d6fbb0d60 100644 --- a/projects/kromatika/index.js +++ b/projects/kromatika/index.js @@ -1,5 +1,5 @@ const sdk = require("@defillama/sdk"); -const { getChainTransform } = require("../helper/portedTokens"); +const { sumTokensExport } = require('../helper/unwrapLPs') const abi = require("./abi.json"); const contracts = { @@ -15,109 +15,49 @@ const contracts = { KROM: "0x55ff62567f09906a85183b866df84bf599a4bf70", position: "0x02c282f60fb2f3299458c2b85eb7e303b25fc6f0", }, - polygon: { - KROM: "0x14Af1F2f02DCcB1e43402339099A05a5E363b83c", - position: "0xD1fDF0144be118C30a53E1d08Cc1E61d600E508e", - }, + polygon: { + KROM: "0x14Af1F2f02DCcB1e43402339099A05a5E363b83c", + position: "0x03F490aE5b59E428E6692059d0Dca1B87ED42aE1", + }, }; -const tvl = (chain) => - async function (timestamp, ethBlock, chainBlocks) { - const krom_position = contracts[chain].position; - - let transform = await getChainTransform(chain); - const block = chainBlocks[chain]; - const balances = {}; - - // Get LP positions tokens owed - const { output: positionsSupply } = await sdk.api.erc20.totalSupply({ - target: krom_position, - chain, - block, - }); - const position_indices = Array.from( - Array(parseInt(positionsSupply)).keys() - ); - const calls = position_indices.map((idx) => ({ - target: krom_position, - params: [idx], - })); - const tokenIds = await sdk.api.abi.multiCall({ - calls, - abi: abi["tokenByIndex"], - chain, - block, - }); - const tokenCalls = tokenIds.output.map((idx) => ({ - target: krom_position, - params: [idx.output], - })); - const orders = await sdk.api.abi.multiCall({ - calls: tokenCalls, - abi: abi["orders"], - chain, - block, - }); - // Retrieve valid orders and add tokens owed to balances - const valid_orders = orders.output.map((order) => order.output); - - valid_orders.forEach((order) => { - sdk.util.sumSingleBalance( - balances, - transform(order.token0), - order.tokensOwed0 - ); - sdk.util.sumSingleBalance( - balances, - transform(order.token1), - order.tokensOwed1 - ); - }); - - return balances; - }; - -const staking = (chain) => - async function (timestamp, ethBlock, chainBlocks) { - const krom = contracts[chain].KROM; - const krom_position = contracts[chain].position; - - let transform = await getChainTransform(chain); - const block = chainBlocks[chain]; - - // Get Kroma deposited by users to pay for their fees - const { output: balance } = await sdk.api.erc20.balanceOf({ - target: krom, - owner: krom_position, - chain, - block, - }); - const balances = {}; - sdk.util.sumSingleBalance(balances, transform(krom), balance); - - return balances; - }; - - module.exports = { - methodology: +async function opTvl(api, position) { + const orderIds = await api.fetchList({ target: position, lengthAbi: 'uint256:totalSupply', itemAbi: abi.tokenByIndex, }) + return getTvl({ api, position, orderIds }) +} + +async function getTvl({ api, position, orderIds }) { + const orderRes = await api.multiCall({ abi: abi.orders, calls: orderIds, target: position }) + const balances = {} + orderRes.map(({ token0, token1, tokensOwed0, tokensOwed1, }) => { + sdk.util.sumSingleBalance(balances, token0, tokensOwed0, api.chain) + sdk.util.sumSingleBalance(balances, token1, tokensOwed1, api.chain) + }) + return balances +} + +module.exports = { + methodology: "Kromatika handles Uniswap-v3 positions for their users who submit limit orders - TVL is amounts of tokens of each LP as well as KROM held by the contract to pay for fees", - optimism: { - tvl: tvl("optimism"), - staking: staking("optimism") - }, - arbitrum: { - tvl: ()=>({}), - staking: staking("arbitrum"), - }, - ethereum: { - tvl: ()=>({}), - staking: staking("ethereum"), - }, - polygon: { - tvl: ()=>({}), - staking: staking("polygon"), +}; + +Object.keys(contracts).forEach(chain => { + const {KROM, position} = contracts[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + if (chain === 'optimism') return opTvl(api, position) + const orderIds = [] + const monitors = await api.fetchList({ lengthAbi: 'uint256:monitorsLength', target: position, itemAbi: abi.monitors }) + console.log(monitors, chain) + for (const monitor of monitors) { + const _orderIds = await api.fetchList({ target: monitor, lengthAbi: 'uint256:getTokenIdsLength', itemAbi: abi.tokenIds, }) + orderIds.push(..._orderIds) + } + return getTvl({ api, position, orderIds }) }, - }; + staking: sumTokensExport({ owner: position, tokens: [KROM]}) + } +}) // UniswapV3Pool NonfungiblePositionManager has a low level mint method // this is what UniswapNFT uses and Kromatikaa is also using it; so in a way Kromatika is a different NFT LP manager for UniswapV3 but for limit orders // users gets Kromatika NFT for their limit position; same as they get Uniswap NFT for their LP; so it is a similar impl from Uniswap, but extended to support limit orders \ No newline at end of file diff --git a/projects/kronos/index.js b/projects/kronos/index.js index d610173ed43..42e422342bb 100644 --- a/projects/kronos/index.js +++ b/projects/kronos/index.js @@ -1,8 +1,9 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const { getChainTransform, getFixBalances } = require("../helper/portedTokens") -const KDAI = "0x5c74070fdea071359b86082bd9f9b3deaafbe32b"; -const KSD = "0x4fa62f1f404188ce860c8f0041d6ac3765a72e67"; +const KDAI = ADDRESSES.klaytn.KDAI; +const KSD = ADDRESSES.klaytn.KSD; const wrappedKlay = '0xd7a4d10070a4f7bc2a015e78244ea137398c3b74' const TREASURY = "0x03c812eE50e244909efE72e8c729976ACc5C16bb"; const token = "0xd676e57ca65b827feb112ad81ff738e7b6c1048d"; @@ -28,7 +29,7 @@ const LPs = [ { address: '0x2febbaed702b9a1d9f6ffccd67701550ac546115', // KRNO_KSP_LP tokens: [ - '0xc6a2ad8cc6e4a7e08fc37cc5954be07d499e7654', + ADDRESSES.klaytn.KSP, ] } ] @@ -97,7 +98,7 @@ async function getTvl(timestamp, ethBlock, chainBlocks) { fixBalances(balances.tvl) return balances -}; +} module.exports = { misrepresentedTokens: true, diff --git a/projects/kronosdao/index.js b/projects/kronosdao/index.js index c054aaa0e08..4505713cdad 100644 --- a/projects/kronosdao/index.js +++ b/projects/kronosdao/index.js @@ -1,4 +1,4 @@ -const { calculateUniTvl } = require("../helper/calculateUniTvl"); +const { uniTvlExport } = require("../helper/calculateUniTvl"); const { stakingUnknownPricedLP } = require("../helper/staking"); const kronosFactory = "0xcc045ebC2664Daf316aa0652E72237609EA6CB4f"; @@ -6,20 +6,10 @@ const kRONOSMasterChef = "0x30e9f20414515116598D073F3EBA116c68A6f4aC"; const kronosDaoToken = "0xbeC68a941feCC79E57762e258fd1490F29235D75"; const kronosBusdLP = "0xDBB34E29D345788273e85DE84814CfAA95c9c5f7"; -async function bscTvl(timestamp, block, chainBlocks) { - return await calculateUniTvl( - (addr) => `bsc:${addr}`, - chainBlocks.bsc, - "bsc", - kronosFactory, - 0, - true - ); -} module.exports = { methodology: "TVL consists of pools created by the factory contract", bsc: { - tvl: bscTvl, + tvl: uniTvlExport(kronosFactory, 'bsc', true), staking: stakingUnknownPricedLP( kRONOSMasterChef, kronosDaoToken, diff --git a/projects/ktx/index.js b/projects/ktx/index.js new file mode 100644 index 00000000000..e145a2d40e8 --- /dev/null +++ b/projects/ktx/index.js @@ -0,0 +1,13 @@ +const { staking } = require("../helper/staking"); +const { gmxExports } = require("../helper/gmx"); + +const bscVault = "0xd98b46C6c4D3DBc6a9Cc965F385BDDDf7a660856"; +const bscStaking = "0x5d1459517ab9FfD60f8aDECdD497ac94DD62d3FD"; +const bscKTC = "0x545356d4d69d8cD1213Ee7e339867574738751CA"; + +module.exports = { + bsc: { + staking: staking(bscStaking, bscKTC, "bsc"), + tvl: gmxExports({ vault: bscVault }), + }, +}; diff --git a/projects/kucoin/index.js b/projects/kucoin/index.js index 81ef030eb73..58c14f57b90 100644 --- a/projects/kucoin/index.js +++ b/projects/kucoin/index.js @@ -53,6 +53,13 @@ const config = { eos: { owners: ['qlwzviixzm1h', 'kucoinrise11'], }, + optimism: { + owners: [ + '0xa3f45e619cE3AAe2Fa5f8244439a66B203b78bCc', + '0xebb8ea128bbdff9a1780a4902a9380022371d466', + '0xd6216fc19db775df9774a6e33526131da7d19a2c', + ], + } } -module.exports = cexExports(config) \ No newline at end of file +module.exports = cexExports(config) diff --git a/projects/kudexfinance/abi.json b/projects/kudexfinance/abi.json index 1784c8cc624..3ff59788e8b 100644 --- a/projects/kudexfinance/abi.json +++ b/projects/kudexfinance/abi.json @@ -1,59 +1,4 @@ { - "poolLength": { - "inputs": [], - "name": "poolLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "poolInfo": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "poolInfo", - "outputs": [ - { - "internalType": "contract IKRC20", - "name": "lpToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "allocPoint", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastRewardBlock", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accKudexPerShare", - "type": "uint256" - }, - { - "internalType": "uint16", - "name": "depositFeeBP", - "type": "uint16" - }, - { - "internalType": "uint256", - "name": "harvestInterval", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } + "poolLength": "uint256:poolLength", + "poolInfo": "function poolInfo(uint256) view returns (address lpToken, uint256 allocPoint, uint256 lastRewardBlock, uint256 accKudexPerShare, uint16 depositFeeBP, uint256 harvestInterval)" } \ No newline at end of file diff --git a/projects/kujira/index.js b/projects/kujira/index.js index fa872ea1936..193ad071e47 100644 --- a/projects/kujira/index.js +++ b/projects/kujira/index.js @@ -1,19 +1,12 @@ -const { get } = require("../helper/http"); -const { sumTokens, endPoints } = require('../helper/chain/cosmos') +const { sumTokens } = require('../helper/chain/cosmos') +const { getConfig } = require("../helper/cache"); -const USK_MARKETS = [ - "kujira1ecgazyd0waaj3g7l9cmy5gulhxkps2gmxu9ghducvuypjq68mq2smfdslf", -]; +const chain = "kujira"; async function tvl() { - const { pairs } = await get("https://api.kujira.app/api/coingecko/pairs"); - const { contracts: blackWhaleVaults } = await get(endPoints.kujira + "/cosmwasm/wasm/v1/code/16/contracts?pagination.limit=100"); - const owners = [ - ...pairs.map((pair) => pair.pool_id), - ...USK_MARKETS, - ...blackWhaleVaults, - ] - return sumTokens({ owners, chain: 'kujira' }) + const contracts = await getConfig("kujira/contracts", "https://raw.githubusercontent.com/Team-Kujira/kujira.js/master/src/resources/contracts.json"); + const uskContracts = contracts["kaiyo-1"].uskMarket.map(x => x.address) + return sumTokens({ owners: uskContracts, chain }) } module.exports = { diff --git a/projects/kumu-finance/abi.js b/projects/kumu-finance/abi.js index 365241bbc46..4a9cfe72360 100644 --- a/projects/kumu-finance/abi.js +++ b/projects/kumu-finance/abi.js @@ -1,69 +1,4 @@ module.exports = { - poolInfo2: { - "inputs": [ - { - "internalType": "uint256", - "name": "_pid", - "type": "uint256" - } - ], - "name": "poolInfo2", - "outputs": [ - { - "internalType": "address", - "name": "lpToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "allocPoint", - "type": "uint256" - }, - { - "internalType": "address", - "name": "strat0", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount0", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "share0", - "type": "uint256" - }, - { - "internalType": "address", - "name": "strat1", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount1", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "share1", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - poolLength: { - "inputs": [], - "name": "poolLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, + poolInfo2: "function poolInfo2(uint256 _pid) view returns (address lpToken, uint256 allocPoint, address strat0, uint256 amount0, uint256 share0, address strat1, uint256 amount1, uint256 share1)", + poolLength: "uint256:poolLength", } \ No newline at end of file diff --git a/projects/kumu-finance/index.js b/projects/kumu-finance/index.js index 68df49b734d..f2c9a5ed319 100644 --- a/projects/kumu-finance/index.js +++ b/projects/kumu-finance/index.js @@ -1,8 +1,7 @@ const sdk = require("@defillama/sdk") const abi = require('./abi') const chain = 'klaytn' -const { getSymbols } = require('../helper/utils') -const { sumUnknownTokens, getTokenPrices } = require("../helper/unknownTokens") +const { sumUnknownTokens, } = require("../helper/unknownTokens") const contract = '0x7886eFbA097A7187f7AeC12913B54BbC9F258faC' const kumu = '0xe764d24563a5931fc5f716a78bd558a9a1bff55d' @@ -42,6 +41,9 @@ async function staking(_, _b, { [chain]: block }) { } module.exports = { + hallmarks: [ + [1662336000, "Rug Pull"] + ], klaytn: { tvl, staking } diff --git a/projects/kurrency/index.js b/projects/kurrency/index.js new file mode 100644 index 00000000000..90a91a83c18 --- /dev/null +++ b/projects/kurrency/index.js @@ -0,0 +1,23 @@ +async function tvl(_, _b, _cb, { api, }) { + const cdpManager = '0x1B18d5a2f35B431aACa02B58eE9E4B7FBa9b098d' + const PSM = '0xbdd0b6212505bcD15C38839cf338E40aeCd95b13' + const ids = await api.call({ abi: abi.getCollateralIds, target: cdpManager }) + const psmTokens = await api.call({ abi: abi.getPSMTokens, target: PSM }) + const psmInfos = await api.multiCall({ abi: abi.getPSMTokenInfo, calls: psmTokens, target: PSM }) + const infos = await api.multiCall({ abi: abi.getCollateralInfo, calls: ids, target: cdpManager }) + infos.forEach(info => api.add(info.token, info.balance)) + psmInfos.forEach((info, i) => api.add(psmTokens[i], info.balance)) +} + +module.exports = { + wemix: { + tvl + } +}; + +const abi = { + "getCollateralIds": "uint256[]:getCollateralIds", + "getPSMTokenInfo": "function getPSMTokenInfo(address token) view returns (tuple(uint256 mintLimit, uint256 minReserve, uint256 balance, uint256 mintAmount, uint256 collateralId, address investor) tokenInfo)", + "getPSMTokens": "address[]:getPSMTokens", + "getCollateralInfo": "function getCollateralInfo(uint256 collateralId) view returns (tuple(address token, address investor, uint256 balance, uint256 maxLTV, uint256 liquidationLTV, uint256 debtCeiling, uint256 interestRate, uint256 liquidationBonusRate, uint256 lastUpdateTime, uint256 lastVaultId, tuple(uint256 originalDebt, uint256 debt, uint256 debtShare) debtInfo) collateralInfo)", +} \ No newline at end of file diff --git a/projects/kuswap/index.js b/projects/kuswap/index.js index bb4c5948beb..a3cfcbb6ff4 100644 --- a/projects/kuswap/index.js +++ b/projects/kuswap/index.js @@ -4,7 +4,6 @@ module.exports = { misrepresentedTokens: true, kcc: { tvl: getUniTVL({ - chain: 'kcc', factory: '0xAE46cBBCDFBa3bE0F02F463Ec5486eBB4e2e65Ae', useDefaultCoreAssets: true, }), diff --git a/projects/kuufinance/abi.json b/projects/kuufinance/abi.json index 59c4b24e04b..bf896b0f7ea 100644 --- a/projects/kuufinance/abi.json +++ b/projects/kuufinance/abi.json @@ -1,21 +1,3 @@ { - "borrowableBalance": { - "type": "function", - "stateMutability": "view", - "outputs": [ - { - "type": "uint256", - "name": "", - "internalType": "uint256" - } - ], - "name": "borrowableBalance", - "inputs": [ - { - "type": "address", - "name": "_token", - "internalType": "address" - } - ] - } + "borrowableBalance": "function borrowableBalance(address _token) view returns (uint256)" } \ No newline at end of file diff --git a/projects/kuufinance/index.js b/projects/kuufinance/index.js index 5ef62ee025f..6461825496e 100644 --- a/projects/kuufinance/index.js +++ b/projects/kuufinance/index.js @@ -1,57 +1,26 @@ -const sdk = require("@defillama/sdk"); -const utils = require("../helper/utils"); -const abi = require("./abi.json"); +const ADDRESSES = require('../helper/coreAssets.json') -const JITU_CONTRACT_ADDRESS = "0x037BB12721A8876386411dAE5E31ff0c5bA991A8"; -const WAVAX = '0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7'; -const AVAX_KUU = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE"; - -const avaxTvl = async (timestamp, ethBlock, chainBlocks) => { - const balances = {}; - - const erc20TokenAddresses = ( - await utils.fetchURL( - "https://distributor-public-data-itke7j4u7q-uc.a.run.app/getIndividualSnapshot/0x0Ba99dB0Da8201056831c359d9Ebd354f3466359" - ) - ).data.assets.map((underlying) => underlying.underlyingTokenAddress); - - const balanceOfAssets = ( - await sdk.api.abi.multiCall({ - abi: abi.borrowableBalance, - calls: erc20TokenAddresses.map((erc20) => ({ - target: JITU_CONTRACT_ADDRESS, - params: erc20, - })), - chain: "avax", - block: chainBlocks["avax"], - }) - ).output.map((boa) => boa.output); +const { sumTokensExport } = require('../helper/unwrapLPs') - for (let index = 0; index < erc20TokenAddresses.length; index++) { - - if(erc20TokenAddresses[index] == AVAX_KUU){ - sdk.util.sumSingleBalance( - balances, - `avax:${WAVAX}`, - balanceOfAssets[index] - ); - }else{ - sdk.util.sumSingleBalance( - balances, - `avax:${erc20TokenAddresses[index]}`, - balanceOfAssets[index] - ); - } - } - - return balances; -}; +const JITU_CONTRACT_ADDRESS = "0x037BB12721A8876386411dAE5E31ff0c5bA991A8"; module.exports = { deadFrom: 1648765747, - misrepresentedTokens: true, + hallmarks: [ + [1633737600, "pausing liquidations program indefinitely"] + ], avax:{ - tvl: avaxTvl, + tvl: sumTokensExport({ + owner: JITU_CONTRACT_ADDRESS, + tokens: [ + '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE', + ADDRESSES.avax.WETH_e, + '0x50b7545627a5162F82A992c33b87aDc75187B218', + ADDRESSES.avax.USDT_e, + ADDRESSES.avax.DAI, + '0x5947BB275c521040051D82396192181b413227A3' + ] + }), }, methodology: `We count as TVL all the assets deposited in JITU contract`, }; diff --git a/projects/kyber-classic/index.js b/projects/kyber-classic/index.js new file mode 100644 index 00000000000..21151fe0e07 --- /dev/null +++ b/projects/kyber-classic/index.js @@ -0,0 +1,62 @@ +const { getUniTVL } = require("../helper/unknownTokens"); +const abi = require("../kyber/abi.json"); + +const chains = { + ethereum: { + graphId: "mainnet", + factory: "0x833e4083B7ae46CeA85695c4f7ed25CDAd8886dE" + }, + arbitrum: { + graphId: "arbitrum-one", + factory: "0x51E8D106C646cA58Caf32A47812e95887C071a62" + }, + polygon: { + graphId: "matic", + factory: "0x5F1fe642060B5B9658C15721Ea22E982643c095c" + }, + avax: { + graphId: "avalanche", + factory: "0x10908C875D865C66f271F5d3949848971c9595C9" + }, + bsc: { + graphId: "bsc", + factory: "0x878dFE971d44e9122048308301F540910Bbd934c" + }, + fantom: { + graphId: "fantom", + factory: "0x78df70615ffc8066cc0887917f2Cd72092C86409" + }, + cronos: { + graphId: "cronos", + factory: "0xD9bfE9979e9CA4b2fe84bA5d4Cf963bBcB376974" + }, + optimism: { + graphId: "optimism", + factory: "0x1c758aF0688502e49140230F6b0EBd376d429be5" + }, + aurora: { factory: "0xD9bfE9979e9CA4b2fe84bA5d4Cf963bBcB376974" }, + velas: { factory: "0xD9bfE9979e9CA4b2fe84bA5d4Cf963bBcB376974" }, + oasis: { factory: "0xD9bfE9979e9CA4b2fe84bA5d4Cf963bBcB376974" }, + bittorrent: { factory: "0xD9bfE9979e9CA4b2fe84bA5d4Cf963bBcB376974" }, +}; + +function classic(chain) { + const factory = chains[chain].factory + if (!factory) return {} + return getUniTVL({ + chain, factory: chains[chain].factory, abis: { + allPairsLength: abi.allPoolsLength, + allPairs: abi.allPools, + getReserves: abi.getReserves, + }, + }) +} + +module.exports = { + timetravel: false, +}; +Object.keys(chains).forEach(chain => { + module.exports[chain] = { + tvl: classic(chain) + }; +}); diff --git a/projects/kyber/abi.json b/projects/kyber/abi.json index 5fbc3f20e38..545913ac793 100644 --- a/projects/kyber/abi.json +++ b/projects/kyber/abi.json @@ -1,97 +1,8 @@ { - "getTokenWallet": { - "inputs": [ - { - "internalType": "contract IERC20", - "name": "token", - "type": "address" - } - ], - "name": "getTokenWallet", - "outputs": [ - { - "internalType": "address", - "name": "wallet", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "allPools": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "allPools", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" -}, -"allPoolsLength": { - "inputs": [], - "name": "allPoolsLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" -}, -"token0": { - "inputs": [], - "name": "token0", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" -}, -"token1": { - "inputs": [], - "name": "token1", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" -}, -"getReserves": { - "inputs": [], - "name": "getReserves", - "outputs": [ - { - "internalType": "uint112", - "name": "_reserve0", - "type": "uint112" - }, - { - "internalType": "uint112", - "name": "_reserve1", - "type": "uint112" - } - ], - "stateMutability": "view", - "type": "function" -} + "getTokenWallet": "function getTokenWallet(address token) view returns (address wallet)", + "allPools": "function allPools(uint256) view returns (address)", + "allPoolsLength": "uint256:allPoolsLength", + "token0": "address:token0", + "token1": "address:token1", + "getReserves": "function getReserves() view returns (uint112 _reserve0, uint112 _reserve1)" } \ No newline at end of file diff --git a/projects/kyber/index.js b/projects/kyber/index.js index 412a4e2c25b..da8c75df7c8 100644 --- a/projects/kyber/index.js +++ b/projects/kyber/index.js @@ -1,46 +1,31 @@ -const sdk = require("@defillama/sdk"); const { graphQuery } = require("../helper/http"); -const { getUniTVL } = require("../helper/unknownTokens"); const { sumTokens2 } = require('../helper/unwrapLPs') -const abi = require("./abi.json"); const chains = { ethereum: { graphId: "mainnet", - factory: "0x833e4083B7ae46CeA85695c4f7ed25CDAd8886dE" }, arbitrum: { graphId: "arbitrum-one", - factory: "0x51E8D106C646cA58Caf32A47812e95887C071a62" }, polygon: { graphId: "matic", - factory: "0x5F1fe642060B5B9658C15721Ea22E982643c095c" }, avax: { graphId: "avalanche", - factory: "0x10908C875D865C66f271F5d3949848971c9595C9" }, bsc: { graphId: "bsc", - factory: "0x878dFE971d44e9122048308301F540910Bbd934c" }, fantom: { graphId: "fantom", - factory: "0x78df70615ffc8066cc0887917f2Cd72092C86409" }, cronos: { graphId: "cronos", - factory: "0xD9bfE9979e9CA4b2fe84bA5d4Cf963bBcB376974" }, optimism: { graphId: "optimism", - factory: "0x1c758aF0688502e49140230F6b0EBd376d429be5" }, - aurora: { factory: "0xD9bfE9979e9CA4b2fe84bA5d4Cf963bBcB376974" }, - velas: { factory: "0xD9bfE9979e9CA4b2fe84bA5d4Cf963bBcB376974" }, - oasis: { factory: "0xD9bfE9979e9CA4b2fe84bA5d4Cf963bBcB376974" }, - bittorrent: { factory: "0xD9bfE9979e9CA4b2fe84bA5d4Cf963bBcB376974" }, }; async function fetchPools(chain) { @@ -85,21 +70,15 @@ function elastic(chain) { return sumTokens2({ chain, block, tokensAndOwners: pools }) } } -function classic(chain) { - const factory = chains[chain].factory - if (!factory) return {} - return getUniTVL({ chain, factory: chains[chain].factory, abis: { - allPairsLength: abi.allPoolsLength, - allPairs: abi.allPools, - getReservesABI: abi.getReserves, - } }) -} module.exports = { timetravel: false, + hallmarks: [ + [Math.floor(new Date('2023-04-17')/1e3), 'Kyber team identified a vuln'], + ], }; Object.keys(chains).forEach(chain => { module.exports[chain] = { - tvl: sdk.util.sumChainTvls([elastic(chain), classic(chain)]) + tvl: elastic(chain) }; }); diff --git a/projects/kyotoswap/index.js b/projects/kyotoswap/index.js new file mode 100644 index 00000000000..9c44e416fae --- /dev/null +++ b/projects/kyotoswap/index.js @@ -0,0 +1,21 @@ +const { getUniTVL } = require("../helper/unknownTokens"); +const { stakings } = require("../helper/staking"); + +const FACTORY = "0x1c3E50DBBCd05831c3A695d45D2b5bCD691AD8D8"; +const LOCKER = "0xd8e86cfD71A19AcF79B60fB75F0470185C95B06b"; +const KSWAP = "0x29ABc4D03D133D8Fd1F1C54318428353CE08727E"; + +module.exports = { + methodology: `Uses factory(${FACTORY}) address and whitelisted tokens address to find and price Liquidity Pool pairs`, + misrepresentedTokens: true, + doublecounted: false, + timetravel: true, + incentivized: true, + bsc: { + tvl: getUniTVL({ + factory: FACTORY, + useDefaultCoreAssets: true, + }), + staking: stakings([LOCKER], KSWAP, "bsc"), + }, +}; diff --git a/projects/l2fibank-xyz/index.js b/projects/l2fibank-xyz/index.js new file mode 100644 index 00000000000..f72ad4f0bcb --- /dev/null +++ b/projects/l2fibank-xyz/index.js @@ -0,0 +1,9 @@ +const { compoundV3Exports } = require('../helper/compoundV3') + +module.exports = compoundV3Exports({ + arbitrum: { + markets: [ + "0x0596355e1d3a467a7b22a9e96e5b0fba494b9f89", // USDT Market + ], + } +}) \ No newline at end of file diff --git a/projects/l2finance/abi.json b/projects/l2finance/abi.json index 86f2f25f5b9..aeff187f814 100644 --- a/projects/l2finance/abi.json +++ b/projects/l2finance/abi.json @@ -1,28 +1,4 @@ { - "supplyToken": { - "inputs": [], - "name": "supplyToken", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "syncBalance": { - "inputs": [], - "name": "syncBalance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } + "supplyToken": "address:supplyToken", + "syncBalance": "uint256:syncBalance" } \ No newline at end of file diff --git a/projects/l2finance/index.js b/projects/l2finance/index.js index d2e4ce1544f..007887c62ad 100644 --- a/projects/l2finance/index.js +++ b/projects/l2finance/index.js @@ -1,36 +1,28 @@ -const sdk = require('@defillama/sdk') -const { sumTokensAndLPsSharedOwners } = require('../helper/unwrapLPs') +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokens2 } = require('../helper/unwrapLPs') const abi = require('./abi.json') +const { getLogs } = require('../helper/cache/getLogs') const rollupChain = "0xf86FD6735f88d5b6aa709B357AD5Be22CEDf1A05" const registry = "0xfe81ab6930a30bdae731fe7b6c6abfbeafc014a8" -async function tvl(timestamp, block){ - const strategies = (await sdk.api.util.getLogs({ +async function tvl(timestamp, block, _, { api }) { + const strategies = (await getLogs({ + api, target: registry, - fromBlock: 12283733-1, - toBlock: block, - keys:[], - topic:'StrategyRegistered(address,uint32)' - })).output.map(s=>"0x"+s.data.slice(26, 66)) - const [syncBalances, tokens] = await Promise.all([abi.syncBalance,abi.supplyToken].map(abiMethod=>sdk.api.abi.multiCall({ - abi: abiMethod, - block, - calls: strategies.map(s=>({target:s})) - }))) - const balances = {} - syncBalances.output.forEach((bal, i)=>{ - sdk.util.sumSingleBalance(balances, tokens.output[i].output, bal.output) - }) - await sumTokensAndLPsSharedOwners(balances, [ - "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", //usdc - "0x6b175474e89094c44da98b954eedeac495271d0f", //dai - "0x4fabb145d64652a948d72533023f6e7a623c7c53", //busd - "0xdac17f958d2ee523a2206206994597c13d831ec7", //usdt - ].map(t=>[t,false]), [rollupChain], block) - return balances + fromBlock: 12283732, + topic: 'StrategyRegistered(address,uint32)' + })).map(s => "0x" + s.data.slice(26, 66)).filter(i => i !== '0x61fc4d40d313eb01483f537a6db2b29fb38aea8d') + const [syncBalances, tokens] = await Promise.all([abi.syncBalance, abi.supplyToken].map(abiMethod => api.multiCall({ abi: abiMethod, calls: strategies }))) + api.addTokens(tokens, syncBalances) + return sumTokens2({ api, owner: rollupChain, tokens: [ + ADDRESSES.ethereum.USDC, //usdc + ADDRESSES.ethereum.DAI, //dai + ADDRESSES.ethereum.BUSD, //busd + ADDRESSES.ethereum.USDT, //usdt + ]}) } -module.exports={ - ethereum:{tvl} +module.exports = { + ethereum: { tvl } } \ No newline at end of file diff --git a/projects/ladao-xocolatl/index.js b/projects/ladao-xocolatl/index.js new file mode 100644 index 00000000000..5b76269ae8e --- /dev/null +++ b/projects/ladao-xocolatl/index.js @@ -0,0 +1,26 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require('../helper/unwrapLPs'); + +module.exports = { + methodology: "Counts all the tokens being used as collateral in the House of Reserves contracts that back $XOC. $XOC is the first decentralized stablecoin with peg close to the mexican (MXN) peso.", + polygon: { + tvl: sumTokensExport({ + tokensAndOwners: [ + [ADDRESSES.polygon.WETH_1, '0xd411BE9A105Ea7701FabBe58C2834b7033EBC203'], + [ADDRESSES.polygon.WETH_1, '0x09dFC327364701d73683aCe049B8A5a8Ea27F3E8'], + [ADDRESSES.polygon.WBTC,'0x983A0eC44bf1BB11592a8bD5F91f05adE4F44D81'], + [ADDRESSES.polygon.WMATIC_2,'0xdB9Dd25660240415d95144C6CE4f21f00Edf8168'], + [ADDRESSES.polygon.WSTETH, '0x28C7DF27e5bC7Cb004c8D4bb2C2D91f246D0A2C9'], + [ADDRESSES.polygon.MATICX, '0x102dda5f4621a08dafD327f29f9c815f851846dC'], + ] + }) + }, + bsc: { + tvl: sumTokensExport({ + tokensAndOwners: [ + [ADDRESSES.bsc.ETH,'0xd411BE9A105Ea7701FabBe58C2834b7033EBC203'], + [ADDRESSES.bsc.WBNB,'0x070ccE6887E70b75015F948b12601D1E759D2024'] + ] + }) + }, +} \ No newline at end of file diff --git a/projects/lagobridge/index.js b/projects/lagobridge/index.js index 7c4d4d2e6cb..34c5d062b00 100644 --- a/projects/lagobridge/index.js +++ b/projects/lagobridge/index.js @@ -1,24 +1,16 @@ -const sdk = require("@defillama/sdk"); +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require('../helper/unwrapLPs') const bridgecontract = '0xc6895a02F9dFe64341c7B1d03e77018E24Db15eD'; -const usdc = '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48' -const wbtc = '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599' - -async function tvl(timestamp, block) { - - const balances = {} - const usdc_balance = (await sdk.api.erc20.balanceOf({ target: usdc, owner: bridgecontract, block: block })).output - const wbtc_balance = (await sdk.api.erc20.balanceOf({ target: wbtc, owner: bridgecontract, block: block })).output - - balances[usdc] = usdc_balance - balances[wbtc] = wbtc_balance - - return balances -}; +const usdc = ADDRESSES.ethereum.USDC +const wbtc = ADDRESSES.ethereum.WBTC module.exports = { - methodology: "Tracks funds locked in the Lago Bridge contract on Ethereum", - ethereum: { - tvl - } + methodology: "Tracks funds locked in the Lago Bridge contract on Ethereum", + ethereum: { + tvl: sumTokensExport({ owner: bridgecontract, tokens: [usdc, wbtc,] }) + }, + hallmarks: [ + [Math.floor(new Date('2022-12-23') / 1e3), 'Project is winding down'], + ], }; diff --git a/projects/landshare/index.js b/projects/landshare/index.js new file mode 100644 index 00000000000..2f0fda45db3 --- /dev/null +++ b/projects/landshare/index.js @@ -0,0 +1,34 @@ + +const { toUSDTBalances } = require('../helper/balances'); +const axios = require("axios"); + +const LandshareApi = "https://api.landshare.io/api/properties"; + +async function landshareTVL() { + const rentals = await axios.get(LandshareApi + "/rentals"); + const flips = await axios.get(LandshareApi + "/flips"); + + const totalRentals = rentals.data.reduce((acc, item) => { + acc = acc + item; + return acc; + }, 0); + + const totalFlips = rentals.data.reduce((acc, item) => { + acc = acc + item; + return acc; + }, 0); + + const total = totalRentals + totalFlips; + + return toUSDTBalances(total); +} + +module.exports = { + timetravel: false, + misrepresentedTokens: true, + bsc: { + tvl: landshareTVL, + } +}; + +// node test.js projects/landshare/index.js diff --git a/projects/lanternswap/index.js b/projects/lanternswap/index.js index 247186667b0..6b56c319391 100644 --- a/projects/lanternswap/index.js +++ b/projects/lanternswap/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') /*================================================== Modules ==================================================*/ @@ -16,9 +17,9 @@ const poolAddressesKava = [ "0x9076e914D94431A38311B247b289B7274E08d6f9", ]; -const DAI = "0x765277EebeCA2e31912C9946eAe1021199B39C61" -const USDC = "0xfA9343C3897324496A05fC75abeD6bAC29f8A40f" -const USDT = "0xB44a9B6905aF7c801311e8F4E76932ee959c663C" +const DAI = ADDRESSES.shiden.ETH +const USDC = ADDRESSES.telos.ETH +const USDT = ADDRESSES.moonriver.USDT async function tvl(timestamp, chainBlocks) { const balances = {}; diff --git a/projects/latoken/index.js b/projects/latoken/index.js new file mode 100644 index 00000000000..fe04fb0fe9a --- /dev/null +++ b/projects/latoken/index.js @@ -0,0 +1,142 @@ +const { cexExports } = require("../helper/cex"); + +const config = { + bitcoin: { + owners: [ + "bc1q48amr6l7dvacdppgucvnswwuyleaqh4dus8z8h", + "bc1q2cgh9nxn7cqmqhk4hc5fu6mju8nzy9a20qqqh8", //cold + "bc1qw5fc9ml9vm4xq5c6xkcdu3vtwyw4gdn8lw0uwq" + ] + }, + ethereum: { + owners: [ + "0x8D056D457a52c4dAF71CEf45F540a040c143Ea05", //eth hot wallet + "0x7891b20c690605f4e370d6944c8a5dbfac5a451c", //eth cold wallet + "0xeE61F5fB0dB81d3A09392375Ee96f723C0620E07", //erc20 hot wallet + "0xc00EEbe4E2bE29679781fc5fC350057eE8132BaB", //erc20 subsidy wallet + "0x4114d8D509503592175A8E044594b29EC081dbe0", //eth custody wallet + "0x00343217B01188388C0E3242278231Ace35E1b61", //eth custody2 wallet + "0x9976c40e8186a5E0C2a9D50d55b51F905d10ce52", //eth custody3 wallet + ], + }, + polygon: { + owners: [ + "0x235e8ceD6b42eE6E226837EB551E86D810d49f22", //hot wallet + "0xA614180C69aBF82f3E7AAbB53AD9976EC90aeAC6", //subsidy wallet + "0x235e8ceD6b42eE6E226837EB551E86D810d49f22", //hot wallet + "0xA614180C69aBF82f3E7AAbB53AD9976EC90aeAC6", //subsidy wallet + ], + }, + avax: { + owners: ["0xeD8D8f4Ff53915D80987BCD51C2DE582a05b2322"], + }, + cardano: { + owners: [ + "addr1vx6kespckg27xu879kf40mpv4pmjxl0ad5hewq067e3d50crylyhc", //hot wallet + "addr1v804l0u7q4ju4eyrd8ykvvdehryn6qyz3n4nh8ucfr8s3pgeskjvu", //subsidy wallet + ], + }, + algorand: { + owners: ["FQQQS3UJFSNYCII2KE5XSCUB5ZIV2HUFVQ22QYLGI3ONFTPOFMAF5HLLZE"], + }, + cosmos: { + owners: [ + "cosmos1wt5sdluapdqrp8wljyesl7s3x5vzq5z76t4nuj", //hot wallet + ], + }, + bsc: { + owners: [ + "0xBA6C98f1cc6869ECCbeB892b7A603F8F02Db3b29", //cold wallet + "0xCE55977E7B33E4e5534Bd370eE31504Fc7Ac9ADc", //hot wallet + "0x9480D1cc3fd4cb7936D114f7d63124107870A7b8", //custody wallet + "0xd76D939B455743e96adbCdf800627b11F3446780", //swap wallet + "0xBA6C98f1cc6869ECCbeB892b7A603F8F02Db3b29", //token cold wallet + "0xCE55977E7B33E4e5534Bd370eE31504Fc7Ac9ADc", //token hot wallet + "0x9480D1cc3fd4cb7936D114f7d63124107870A7b8", //token custody wallet + "0xd76D939B455743e96adbCdf800627b11F3446780", //token swap wallet + ], + }, + // celo: { + // owners: ["0xEeC02a6D1a7F9f534b9609c8EE30B9cF9A7fe1B3"], + // }, + elrond: { + owners: ["erd1z5xjeu4xw32jkckhj9jpc9dymj6a9h8yxtch96e43ncp6fhuzpnqshqutj"], + }, + eos: { + owners: ["latokenabbc1", "latokeneos11"], + }, + // energyweb: { + // owners: [ + // "0x26b52C889FCf3B8f449aD1c0F07b8572E6ACE262", //hot wallet + // "0x0F307b17d41acE555620DF5a55Dd5A01637e3b42", //cold wallet + // "0x6fb194fc9806fE320E0CBD658e31F13B1bAa3925", //custody wallet + // ], + // }, + ethereumclassic: { + owners: [ + "0xE69963CE13ED742639C8287913682bC008B3e622", //hot wallet + ], + }, + // lachain: { + // owners: ["0xEFf6E17Fdc68d56812DA40f7d05FC8cDfd212440"], + // }, + // filecoin: { + // owners: ["f1iy5dvp6ggzhtraxodbfdkbiw5s67mhff4w43pai"], //hot wallet + // }, + // gochain: { + // owners: [ + // "0xA1a0538D556B3E77f7E1340E3Ebd70C649c4bb84", //hot wallet + // "0x1771C9c8d5AF830d322c2E1D2161D002844679EF", //subsidy wallet + // ], + // }, + // injective: { + // owners: [ + // "inj1uyc234cek2ja9ru7a870cmx2lcavt5um2nk6hh", //hot wallet + // ], + // }, + // neo3: { + // owners: ["NMngTcDdCq3cFNHiPBvtim73HLuG3Dzkwb"], + // }, + // proton: { + // owners: ["protonla"], + // }, + polkadot: { + owners: ["1347e3PfJKKcJL4XJhFeZ5UmZYRnk26Vs9aGjZ8RZLPkWWNY"], + }, + solana: { + owners: [ + "51AASorYCLPcUHnuQQaau6DfsfFRixzh4HsoQwsc5Ara", //hot wallet + ], + }, + optimism: { + owners: [ + "0xecabeA0fB22f82F3A5a5D6043D7cCf65F3640c85", //hot wallet + "0x3b28358e9CDde80A24f0f811daD13aB9fc2A0d2A", //subsidy wallet + ], + }, + terra: { + owners: ["terra14rvsrmq47pr9v5pkdkttftgh526jeeluyumalk"], + }, + terra2: { + owners: ["terra13x5jkljx69vyak47k9e9u9qetu0sckxpfysrp7"], + }, + tezos: { + owners: [ + "tz2QLHkGgaXqoeqUFxUJXAvZ9pdQ2HQDhTe4", //hot wallet + ], + }, + tron: { + owners: [ + "TT2YwaJ8DXsrpycgBGDWEei1FUQm6YT85T", //hot wallet + "TUJrDuFr6ALjtZehcpFRKnBCCo79Gs76ww", //cold wallet + "TVNdyXbcJ5ZwwFsjnScrNXSv9d435guynT", //subsidy wallet + ], + }, + zilliqa: { + owners: [ + "zil1rklazrfy5spul4tqzc2jqfvuneszcjrdya6a8y", //hot wallet + ], + }, +}; + +module.exports = cexExports(config); diff --git a/projects/latte/index.js b/projects/latte/index.js index 1b0e7b23cfb..a67c49695f5 100644 --- a/projects/latte/index.js +++ b/projects/latte/index.js @@ -1,43 +1,11 @@ -// const utils = require('../helper/utils'); -// const {toUSDTBalances} = require('../helper/balances'); -const sdk = require("@defillama/sdk"); -const { calculateUniTvl } = require("../helper/calculateUniTvl"); - -// const baseURL = 'https://api.latteswap.com/api' -// async function fetch() { -// const totalTvl = await utils.fetchURL(`${baseURL}/v1/amm/defi-llama/tvl-exclude-latte`) -// return Number(totalTvl.data) -// } -// async function staking() { -// const latteTvl = await utils.fetchURL(`${baseURL}/v1/amm/defi-llama/tvl-latte-pool`) -// return toUSDTBalances(Number(latteTvl.data)) -// } +const sdk = require("@defillama/sdk"); +const { uniTvlExport } = require("../helper/calculateUniTvl"); const factory = "0x4DcE5Bdb81B8D5EdB66cA1b8b2616A8E0Dd5f807"; const latteToken = "0x8D78C2ff1fB4FBA08c7691Dfeac7bB425a91c81A"; const lattev2Token = "0xa269A9942086f5F87930499dC8317ccC9dF2b6CB"; const masterchef = "0xbCeE0d15a4402C9Cc894D52cc5E9982F60C463d6"; -const translate = { - "0x8d78c2ff1fb4fba08c7691dfeac7bb425a91c81a": - "bsc:0xa269a9942086f5f87930499dc8317ccc9df2b6cb", // LATTE to LATTEv2 -}; - -async function tvl(timestamp, block, chainBlocks) { - return await calculateUniTvl( - (addr) => { - if (translate[addr.toLowerCase()] !== undefined) { - return translate[addr]; - } - return `bsc:${addr}`; - }, - chainBlocks.bsc, - "bsc", - factory, - 0, - true - ); -} async function staking(timestamp, block, chainBlocks) { let balances = {}; @@ -66,7 +34,7 @@ async function staking(timestamp, block, chainBlocks) { module.exports = { bsc: { - tvl, + tvl: uniTvlExport(factory, 'bsc', true), staking, }, }; diff --git a/projects/lazyfi/index.js b/projects/lazyfi/index.js new file mode 100644 index 00000000000..9a4e08f7006 --- /dev/null +++ b/projects/lazyfi/index.js @@ -0,0 +1,9 @@ +const { sumTokens } = require('../helper/chain/near') +async function tvl() { + return sumTokens({ owners: ['app-rewards.lazyfi-wallet.near'], tokens: ['a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48.factory.bridge.near']}) +} + +module.exports = { + timetravel: false, + near: { tvl } +} \ No newline at end of file diff --git a/projects/leNFT/index.js b/projects/leNFT/index.js new file mode 100644 index 00000000000..2309f5b714b --- /dev/null +++ b/projects/leNFT/index.js @@ -0,0 +1,51 @@ +const { getLogs } = require("../helper/cache/getLogs"); +const { sumTokens2 } = require("../helper/unwrapLPs"); + +async function tvl(_, _b, _cb, { api }) { + const tradingPoolFactory = "0x197456A4f5c3B3605033270Bc04Bc599916CaBA0"; + const lendingMarket = "0xFAE8371d6b22F6451A64026785e79Bd7B438306F"; + + // Get the logs of trading pool creation + const tradingPoolFactoryLogs = await getLogs({ + api, + target: tradingPoolFactory, + topics: [ + "0xa1311e5e3c1c2207844ec9211cb2439ea0bce2a76c6ea09d9343f0d0eaddd9f6", + ], + fromBlock: 17605911, + eventAbi: + "event CreateTradingPool(address indexed pool, address indexed nft, address indexed token)", + onlyArgs: true, + }); + var ownerTokens = []; + + // Add trading pools + for (const log of tradingPoolFactoryLogs) { + ownerTokens.push([[log.token, log.nft], log.pool]); + } + + // Get the logs of lending pool creation + const lendingMarketLogs = await getLogs({ + api, + target: lendingMarket, + topics: [ + "0xe981a0f3e894fa2788c75d5d18601ca14c7b544c96311cc7c0a022bcc5900ee8", + ], + fromBlock: 17605911, + eventAbi: + "event CreateLendingPool(address indexed lendingPool, address indexed collection, address indexed asset)", + onlyArgs: true, + }); + + // Add lending pools + for (const log of lendingMarketLogs) { + ownerTokens.push([[log.asset, log.collection], log.lendingPool]); + } + + return sumTokens2({ ownerTokens, api }); +} + +module.exports = { + misrepresentedTokens: false, + ethereum: { tvl }, +}; diff --git a/projects/leaguedao/api.js b/projects/leaguedao/api.js new file mode 100644 index 00000000000..b83e37f2502 --- /dev/null +++ b/projects/leaguedao/api.js @@ -0,0 +1,8 @@ +const index = require('./index') + +module.exports = { + ethereum: { + tvl: () => 0, + staking: index.ethereum.staking, + } +} \ No newline at end of file diff --git a/projects/leaguedao/index.js b/projects/leaguedao/index.js index ceaa3532916..9e86c25fd7c 100644 --- a/projects/leaguedao/index.js +++ b/projects/leaguedao/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { ohmTvl } = require("../helper/ohm"); const leag = "0x7b39917f9562C8Bc83c7a6c2950FF571375D505D"; @@ -5,10 +6,10 @@ const stakingContract = "0x67F60dA0F409AB8427e8a408efc4B137D0BD4e7B"; const yieldFarmStakingContract = "0x43921eb2E5C78D9e887d3Ecd4620a3Bd606f4F95"; //Tokens in Yield Farm Contract -const link = "0x514910771af9ca656af840dff83e8264ecf986ca"; -const snx = "0xc011a73ee8576fb46f5e1c5751ca3b9fe0af2a6f"; +const link = ADDRESSES.ethereum.LINK; +const snx = ADDRESSES.ethereum.SNX; const ilv = "0x767fe9edc9e0df98e07454847909b5e959d7ca0e"; -const sushi = "0x6b3595068778dd592e39a122f4f5a5cf09c90fe2"; +const sushi = ADDRESSES.ethereum.SUSHI; const bond = "0x0391D2021f89DC339F60Fff84546EA23E337750f"; const xyz = "0x618679df9efcd19694bb1daa8d00718eacfa2883"; const ionx = "0x02d3a27ac3f55d5d91fb0f52759842696a864217"; @@ -27,7 +28,7 @@ module.exports = { [xyz, false], [ionx, false], [entr, false], - [leagUsdc, true], + [leagUsdc, false], ], "ethereum", stakingContract, diff --git a/projects/leetswap/index.js b/projects/leetswap/index.js new file mode 100644 index 00000000000..f4e9edb0e80 --- /dev/null +++ b/projects/leetswap/index.js @@ -0,0 +1,9 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports = { + misrepresentedTokens: true, + polygon_zkevm: { tvl: getUniTVL({ factory: '0xcE87E0960f4e2702f4bFFE277655E993Ae720e84', useDefaultCoreAssets: true, }), }, + canto: { tvl: getUniTVL({ factory: '0x116e8a41E8B0A5A87058AF110C0Ddd55a0ed82B7', useDefaultCoreAssets: true, }), }, + linea: { tvl: getUniTVL({ factory: '0x4DDf0fa98B5f9Bd7Cb0645c25bA89A574fe9Be8c', useDefaultCoreAssets: true, }), }, + base: { tvl: getUniTVL({ factory: '0x169C06b4cfB09bFD73A81e6f2Bb1eB514D75bB19', useDefaultCoreAssets: true, hasStablePools: true, stablePoolSymbol: 'sLS2', }), }, +} diff --git a/projects/lemma/abis/perpLemmaWrapper.json b/projects/lemma/abis/perpLemmaWrapper.json index 07c368789ab..39734a7fa8a 100644 --- a/projects/lemma/abis/perpLemmaWrapper.json +++ b/projects/lemma/abis/perpLemmaWrapper.json @@ -1,15 +1,3 @@ { - "isUsdlCollateralTailAsset": { - "inputs": [], - "name": "isUsdlCollateralTailAsset", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - } + "isUsdlCollateralTailAsset": "bool:isUsdlCollateralTailAsset" } \ No newline at end of file diff --git a/projects/lemma/abis/perpV2Vault.json b/projects/lemma/abis/perpV2Vault.json index cac6429ad4c..fc7d1dc3a6a 100644 --- a/projects/lemma/abis/perpV2Vault.json +++ b/projects/lemma/abis/perpV2Vault.json @@ -1,26 +1,3 @@ { - "getBalanceByToken": { - "inputs": [ - { - "internalType": "address", - "name": "trader", - "type": "address" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "name": "getBalanceByToken", - "outputs": [ - { - "internalType": "int256", - "name": "", - "type": "int256" - } - ], - "stateMutability": "view", - "type": "function" - } + "getBalanceByToken": "function getBalanceByToken(address trader, address token) view returns (int256)" } \ No newline at end of file diff --git a/projects/lemma/index.js b/projects/lemma/index.js index 65a0d3714e2..34c94851cf7 100644 --- a/projects/lemma/index.js +++ b/projects/lemma/index.js @@ -1,12 +1,13 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk'); const { transformOptimismAddress } = require('../helper/portedTokens'); const perpV2VaultABI = require('./abis/perpV2Vault.json'); const perpLemmaWrapperABI = require('./abis/perpLemmaWrapper.json'); -const USDC = "0x7F5c764cBc14f9669B88837ca1490cCa17c31607"; +const USDC = ADDRESSES.optimism.USDC; const PERP_V2_VAULT = "0xAD7b4C162707E0B2b5f6fdDbD3f8538A5fbA0d60"; const tokens = [ - "0x4200000000000000000000000000000000000006", + ADDRESSES.tombchain.FTM, "0x68f180fcce6836688e9084f035309e29bf0a2095", "0x350a791bfc2c21f9ed5d10980dad2e2638ffa7f6", "0x76FB31fb4af56892A25e32cFC43De717950c9278", diff --git a/projects/lendexe/index.js b/projects/lendexe/index.js new file mode 100644 index 00000000000..6161994b1ed --- /dev/null +++ b/projects/lendexe/index.js @@ -0,0 +1,34 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { compoundExports } = require('../helper/compound') +const { nullAddress } = require('../helper/tokenMapping') +const { lendingMarket } = require("../helper/methodologies"); + + +const u = undefined +const { tvl, borrowed } = compoundExports('0x2c7b7A776b5c3517B77D05B9313f4699Fb38a8d3',u,'0x36e66547e27a5953f6ca3d46cc2663d9d6bdc59e', nullAddress, undefined, undefined, { fetchBalances: true, blacklistedTokens: ['0x53011e93f21ec7a74cdfbb7e6548f1abce306833'] }) + +const mapping = { + [ADDRESSES.ethereum.USDC]: 6, + [ADDRESSES.ethereum.USDT]: 6, + [ADDRESSES.ethereum.WBTC]: 8, +} +async function borrowedWrapped(_, _1, _2, { api }) { + const borrowedRes = await borrowed(_, _1, _2, { api }) + Object.entries(mapping).forEach(([t, decimals]) => { + const regex = new RegExp(t, 'gi') + Object.keys(borrowedRes).forEach(key => { + if (regex.test(key)) { + borrowedRes[key] /= 10 ** (18 - decimals) + } + }) + }) + return borrowedRes +} + +module.exports = { + methodology: `${lendingMarket}. TVL is calculated by getting the market addresses from comptroller and calling the getCash() on-chain method to get the amount of tokens locked in each of these addresses, then we get the price of each token from coingecko.`, + ethereum: { + tvl, + borrowed: borrowedWrapped, + } +} \ No newline at end of file diff --git a/projects/lendflare/convexBooster.js b/projects/lendflare/convexBooster.js index b6da803f6b5..4be502cefe9 100644 --- a/projects/lendflare/convexBooster.js +++ b/projects/lendflare/convexBooster.js @@ -87,7 +87,7 @@ async function calculateTokenAmount(pools, timestamp, block, chainBlocks) { await sdk.api.abi.call({ block: chainBlocks.ethereum, chain: "ethereum", - abi: { "inputs": [{ "internalType": "uint256", "name": "_pid", "type": "uint256" }, { "internalType": "uint256", "name": "_tokens", "type": "uint256" }, { "internalType": "int128", "name": "_curveCoinId", "type": "int128" }], "name": "calculateTokenAmount", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, + abi: 'function calculateTokenAmount(uint256 _pid, uint256 _tokens, int128 _curveCoinId) view returns (uint256)', target: CONVEX_BOOSTER_PROXY, params: [pid, pools[pid].totalSupplyString, pools[pid].coinId] }).then(result => { diff --git a/projects/lendhub/abi.json b/projects/lendhub/abi.json index f3445a6301c..c27b10309a8 100644 --- a/projects/lendhub/abi.json +++ b/projects/lendhub/abi.json @@ -1,74 +1,7 @@ { - "getAllMarkets": { - "constant": true, - "inputs": [], - "name": "getAllMarkets", - "outputs": [ - { - "internalType": "contract CToken[]", - "name": "", - "type": "address[]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "underlying": { - "constant": true, - "inputs": [], - "name": "underlying", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "getCash": { - "constant": true, - "inputs": [], - "name": "getCash", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "valtToken": { - "inputs": [], - "name": "token", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "totalBorrows": { - "constant": true, - "inputs": [], - "name": "totalBorrows", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } + "getAllMarkets": "address[]:getAllMarkets", + "underlying": "address:underlying", + "getCash": "uint256:getCash", + "valtToken": "address:token", + "totalBorrows": "uint256:totalBorrows" } \ No newline at end of file diff --git a/projects/lendhub/index.js b/projects/lendhub/index.js index 5fb2b07fbf9..422c81c8e03 100644 --- a/projects/lendhub/index.js +++ b/projects/lendhub/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk'); const cAbis = require('./abi.json'); @@ -22,7 +23,7 @@ async function getMarkets(block) { const calls = [] for (const cToken of allCTokens) { if (cToken.toLowerCase() === '0x99a2114B282acC9dd25804782ACb4D3a2b1Ad215'.toLowerCase()) - markets.push({ cToken, underlying: '0x5545153ccfca01fbd7dd11c0b23ba694d9509a6f' }) + markets.push({ cToken, underlying: ADDRESSES.heco.WHT }) else calls.push({ target: cToken }) } @@ -79,8 +80,12 @@ function tvl(borrowed) { module.exports = { timetravel: false, + hallmarks: [ + [Math.floor(new Date('2023-01-12')/1e3), 'Protocol was hacked'], + ], heco: { tvl: tvl(false), - borrowed: tvl(true), + // borrowed: tvl(true), + borrowed: () => 0, } }; \ No newline at end of file diff --git a/projects/lendle/index.js b/projects/lendle/index.js new file mode 100644 index 00000000000..d332dc1e495 --- /dev/null +++ b/projects/lendle/index.js @@ -0,0 +1,15 @@ +const { aaveV2Export } = require("../helper/aave"); +const { staking } = require("../helper/staking"); + +const LPConfiguratorContract = "0x30D990834539E1CE8Be816631b73a534e5044856"; +const StakingContract = "0x5C75A733656c3E42E44AFFf1aCa1913611F49230"; +const TokenContract = "0x25356aeca4210eF7553140edb9b8026089E49396"; + +module.exports = { + mantle: { + ...aaveV2Export(LPConfiguratorContract, { + fromBlock: 56556, + }), + staking: staking(StakingContract, TokenContract), + }, +}; diff --git a/projects/lenlen/index.js b/projects/lenlen/index.js new file mode 100644 index 00000000000..93fd933f3ca --- /dev/null +++ b/projects/lenlen/index.js @@ -0,0 +1,17 @@ +const ADDRESSES = require('../helper/coreAssets.json') + +const { compoundV3Exports } = require('../helper/compoundV3') + +const markets = [ + "0xc9C1B486bB027cD7023019ADA41F17109eE6c722", // USDT Market +] + +const collaterals = [ + ADDRESSES.vision.USDT, +] + +module.exports = compoundV3Exports({ + vision: { + markets, collaterals, + } +}) \ No newline at end of file diff --git a/projects/leonicornswap/index.js b/projects/leonicornswap/index.js index 210e850a30b..98789412ddf 100644 --- a/projects/leonicornswap/index.js +++ b/projects/leonicornswap/index.js @@ -1,15 +1,11 @@ const sdk = require("@defillama/sdk"); -const { calculateUniTvl } = require("../helper/calculateUniTvl"); +const { getUniTVL } = require("../helper/unknownTokens"); const leos = "0x2c8368f8F474Ed9aF49b87eAc77061BEb986c2f1"; const leon = "0x27E873bee690C8E161813DE3566E9E18a64b0381"; const factory = "0xEB10f4Fe2A57383215646b4aC0Da70F8EDc69D4F"; const masterchef = "0x72F8fE2489A4d480957d5dF9924166e7a8DDaBBf"; -async function tvl(timestamp, block, chainBlocks) { - return await calculateUniTvl(addr=>`bsc:${addr}`, chainBlocks.bsc, "bsc", factory, 0, true); -} - async function staking(timestamp, block, chainBlocks) { let balances = {}; let stakingBalance = (await sdk.api.abi.multiCall({ @@ -34,8 +30,9 @@ async function staking(timestamp, block, chainBlocks) { } module.exports = { + misrepresentedTokens: true, bsc: { - tvl, + tvl: getUniTVL({ factory, useDefaultCoreAssets: true, }), staking }, } \ No newline at end of file diff --git a/projects/letsfil/index.js b/projects/letsfil/index.js new file mode 100644 index 00000000000..dc1bcf22a3e --- /dev/null +++ b/projects/letsfil/index.js @@ -0,0 +1,28 @@ +const sdk = require('@defillama/sdk'); +const ADDRESSES = require('../helper/coreAssets.json') +const LETSFIL_CONTRACT = "0x74a37AC5f124d25284ffEc0107cB93a6f9A2E433"; + + +async function tvl(_, _1, _2, { api }) { + + const collateralBalance = await api.call({ + abi: 'function getTvl() external view returns (uint256)', + target: LETSFIL_CONTRACT, + }); + + // await sdk.util.sumSingleBalance(balances, LETSFIL_CONTRACT, collateralBalance, api.chain) + // return balances; + + api.add(ADDRESSES.null,collateralBalance) +} + + + +module.exports = { + timetravel: false, + misrepresentedTokens: false, + methodology: 'counts the number of pledge filecoins in the letsfil contract', + filecoin: { + tvl + } +}; diff --git a/projects/level/index.js b/projects/level/index.js new file mode 100644 index 00000000000..43ef7d3c924 --- /dev/null +++ b/projects/level/index.js @@ -0,0 +1,46 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokens2 } = require("../helper/unwrapLPs"); +const { pool2 } = require("../helper/pool2"); + +const Contracts = { + Pool: "0xA5aBFB56a78D2BD4689b25B8A77fd49Bb0675874", + Chef: "0x5ae081b6647aef897dec738642089d4bda93c0e7", + Tokens: { + BTC: ADDRESSES.bsc.BTCB, + ETH: ADDRESSES.bsc.ETH, + WBNB: ADDRESSES.bsc.WBNB, + CAKE: "0x0e09fabb73bd3ade0a17ecc321fd13a19e81ce82", + BUSD: ADDRESSES.bsc.BUSD, + USDT: ADDRESSES.bsc.USDT + }, + LVL_BNB_LP: "0x70f16782010fa7ddf032a6aacdeed05ac6b0bc85" +} + +const ContractsArb = { + Pool: "0x32B7bF19cb8b95C27E644183837813d4b595dcc6", + Chef: "0x0180dee5Df18eBF76642e50FaaEF426f7b2874f7", + Tokens: { + ETH: ADDRESSES.arbitrum.WETH, + USDT: ADDRESSES.arbitrum.USDT, + USDC: ADDRESSES.arbitrum.USDC_CIRCLE, + BTC: ADDRESSES.arbitrum.WBTC, + ARB: ADDRESSES.arbitrum.ARB + } +} +async function arbtvl(_,b, _cb, { api, }) { + return sumTokens2({ api, owner: ContractsArb.Pool, tokens: Object.values(ContractsArb.Tokens)}) +} +async function tvl(_, _b, _cb, { api, }) { + return sumTokens2({ api, owner: Contracts.Pool, tokens: Object.values(Contracts.Tokens) }) +} + +module.exports = { + bsc: { + tvl, + pool2: pool2(Contracts.Chef, Contracts.LVL_BNB_LP) + }, + arbitrum: { tvl: arbtvl }, + hallmarks: [ + [Math.floor(new Date('2023-05-01')/1e3), 'Referral contract exploited'], + ], +}; diff --git a/projects/levinswap/index.js b/projects/levinswap/index.js index 44db0a151b8..9b4126fac09 100644 --- a/projects/levinswap/index.js +++ b/projects/levinswap/index.js @@ -1,17 +1,13 @@ -const { calculateUniTvl } = require("../helper/calculateUniTvl"); +const { uniTvlExport } = require("../helper/calculateUniTvl"); const { staking } = require("../helper/staking"); const factory = "0x965769C9CeA8A7667246058504dcdcDb1E2975A5"; const levin = "0x1698cD22278ef6E7c0DF45a8dEA72EDbeA9E42aa"; const xlevin = "0xafa57Fb9d8D63Ff8124E17c1495C73bc3a7678D0"; -async function tvl (timestamp, block, chainBlocks) { - return await calculateUniTvl(addr=>`xdai:${addr}`, chainBlocks.xdai, "xdai", factory, 0, true); -} - module.exports = { xdai: { - tvl, + tvl: uniTvlExport(factory, 'xdai', true), staking: staking(xlevin, levin, "xdai") } } \ No newline at end of file diff --git a/projects/levvy-fi/index.js b/projects/levvy-fi/index.js new file mode 100644 index 00000000000..29c72ff8919 --- /dev/null +++ b/projects/levvy-fi/index.js @@ -0,0 +1,19 @@ +const { post } = require('../helper/http') + +module.exports = { + misrepresentedTokens: true, + cardano: { + tvl: async () => { + const data = await post('https://citizens.theapesociety.io/api/getLevvyData', {}) + return { + cardano: data.adaTVL, + } + }, + borrowed: async () => { + const data = await post('https://citizens.theapesociety.io/api/getLevvyData', {}) + return { + cardano: data.borrowed, + } + } + }, +} diff --git a/projects/lfgswap-arbitrum/index.js b/projects/lfgswap-arbitrum/index.js new file mode 100644 index 00000000000..da01c748564 --- /dev/null +++ b/projects/lfgswap-arbitrum/index.js @@ -0,0 +1,11 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports = { + misrepresentedTokens: true, + arbitrum: { + tvl: getUniTVL({ + useDefaultCoreAssets: true, + factory: '0xE5552e0318531F9Ec585c83bDc8956C08Bf74b71', + }) + } +} \ No newline at end of file diff --git a/projects/lfgswap-core/index.js b/projects/lfgswap-core/index.js new file mode 100644 index 00000000000..fcc5274e5d8 --- /dev/null +++ b/projects/lfgswap-core/index.js @@ -0,0 +1,21 @@ +const { getUniTVL } = require('../helper/unknownTokens'); +const { stakings } = require("../helper/staking"); + +const stakingContracts = [ + "0x00801Df22566E6F1b7Eb2DCaa2c794ca6daD3D0A", + "0xcF17abb2CeA7e96eD1E35E0F3FAC919cFECad2F3", +]; + +const lfgToken = "0xf7a0b80681ec935d6dd9f3af9826e68b99897d6d"; + + +module.exports = { + misrepresentedTokens: true, + core: { + tvl: getUniTVL({ + useDefaultCoreAssets: true, + factory: '0xA1ADD165AED06D26fC1110b153ae17a5A5ae389e', + }), + //staking: stakings(stakingContracts, lfgToken, 'core', undefined, 18) + } +}; \ No newline at end of file diff --git a/projects/lfgswap/index.js b/projects/lfgswap/index.js index 466fae98553..c7c55b6ae38 100644 --- a/projects/lfgswap/index.js +++ b/projects/lfgswap/index.js @@ -1,11 +1,9 @@ - const { getUniTVL } = require('../helper/unknownTokens') module.exports = { misrepresentedTokens: true, ethpow: { tvl: getUniTVL({ - chain: 'ethpow', useDefaultCoreAssets: true, factory: '0xf66cef53c518659bFA0A9a4Aa07445AF08bf9B3a', }) diff --git a/projects/libre-swap/index.js b/projects/libre-swap/index.js new file mode 100644 index 00000000000..a3a936a2359 --- /dev/null +++ b/projects/libre-swap/index.js @@ -0,0 +1,51 @@ +const { getFullTable , getExchangeRates } = require("../helper/chain/libre"); +const { toUSDTBalances } = require('../helper/balances'); + +const SWAP_CONTRACT = 'swap.libre'; + +async function getPoolScopes() { + const pools = await getFullTable({code: SWAP_CONTRACT, scope: SWAP_CONTRACT, table: `swapindex`}); + const result = []; + for (const pool of pools) { + result.push(pool['swap_symbpol'].split(',')[1]); + } + return result; +} + +async function getPoolStats(scope, exchangeRates) { + const stats = await getFullTable({code: SWAP_CONTRACT, scope, table: `stat`}); + if (stats && stats.length) { + const poolStats = stats[0]; + const pool1Quantity = poolStats.pool1.quantity; + const pool2Quantity = poolStats.pool2.quantity; + const [ pool1Amount, pool1Symbol ] = pool1Quantity.split(' '); + const [ pool2Amount, pool2Symbol ] = pool2Quantity.split(' '); + const pool1Rate = exchangeRates[pool1Symbol.toUpperCase()] ?? 0; + const pool2Rate = exchangeRates[pool2Symbol.toUpperCase()] ?? 0; + return parseFloat(pool1Amount) * parseFloat(pool1Rate) + + parseFloat(pool2Amount) * parseFloat(pool2Rate); + } + return 0; +} + +async function getTvl() { + let result = 0; + const [exchangeRates, scopes ] = await Promise.all([ + getExchangeRates(), + getPoolScopes(), + ]) + await Promise.all(scopes.map(async scope => { + const poolTvl = await getPoolStats(scope, exchangeRates); + result += poolTvl; + })) + return toUSDTBalances(result); +} + +module.exports = { + misrepresentedTokens: true, + timetravel: false, + methodology: `Total Pool Liquidity on Libre Swap`, + libre: { + tvl: getTvl, + }, +} \ No newline at end of file diff --git a/projects/lido/abis.json b/projects/lido/abis.json deleted file mode 100644 index 8cc16fe7fca..00000000000 --- a/projects/lido/abis.json +++ /dev/null @@ -1,16 +0,0 @@ -[ - { - "constant": true, - "inputs": [], - "name": "getTotalPooledEther", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } -] \ No newline at end of file diff --git a/projects/lido/index.js b/projects/lido/index.js index f8eb52667ff..e0a21458a9b 100644 --- a/projects/lido/index.js +++ b/projects/lido/index.js @@ -1,44 +1,37 @@ +const ADDRESSES = require('../helper/coreAssets.json') const axios = require('axios'); -const abis = require('./abis.json') const sdk = require('@defillama/sdk') const sol = require('./sol-helpers'); const { getConnection } = require('../helper/solana'); -const ethContract = '0xae7ab96520de3a18e5e111b5eaab095312d7fe84'; +const ethContract = ADDRESSES.ethereum.STETH; async function terra(timestamp, ethBlock, chainBlocks) { - /* - const { block } = await sdk.api.util.lookupBlock(timestamp, { - chain: 'terra' - }) - const { total_bond_amount } = ( - await axios.get(`https://lcd.terra.dev/wasm/contracts/terra1mtwph2juhj0rvjz7dy92gvl6xvukaxu8rfv8ts/store?query_msg=%7B%22state%22%3A%20%7B%7D%7D&height=${block - (block % 100)}`) // Node is semi-pruned, only every 100th block is stored - ).data.result; - */ - const { total_bond_amount } = ( - await axios.get(`https://lcd.terra.dev/wasm/contracts/terra1mtwph2juhj0rvjz7dy92gvl6xvukaxu8rfv8ts/store?query_msg=%7B%22state%22%3A%20%7B%7D%7D`) - ).data.result; - return { - 'terra-luna': total_bond_amount / 1000000 - } + return {} + // const { total_bond_amount } = ( + // await axios.get(`https://lcd.terra.dev/wasm/contracts/terra1mtwph2juhj0rvjz7dy92gvl6xvukaxu8rfv8ts/store?query_msg=%7B%22state%22%3A%20%7B%7D%7D`) + // ).data.result; + // return { + // 'terra-luna': total_bond_amount / 1000000 + // } } async function eth(timestamp, ethBlock, chainBlocks) { const pooledETH = await sdk.api.abi.call({ block: ethBlock, target: ethContract, - abi: abis.find(abi => abi.name === "getTotalPooledEther") + abi: "uint256:getTotalPooledEther" }) const pooledMatic = await sdk.api.abi.call({ block: ethBlock, target: "0x9ee91F9f426fA633d227f7a9b000E28b9dfd8599", - abi: {"inputs":[],"name":"getTotalPooledMatic","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"} + abi: "uint256:getTotalPooledMatic", }) return { - '0x0000000000000000000000000000000000000000': pooledETH.output, - "0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0": pooledMatic.output, + [ADDRESSES.null]: pooledETH.output, + [ADDRESSES.ethereum.MATIC]: pooledMatic.output, } } @@ -48,7 +41,7 @@ async function ksm(timestamp, ethBlock, {moonriver: block}) { block, chain, target: "0xffc7780c34b450d917d557e728f033033cb4fa8c", - abi: {"inputs":[],"name":"getTotalPooledKSM","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"} + abi: "uint256:getTotalPooledKSM", }) return { @@ -61,8 +54,8 @@ async function dot(timestamp, ethBlock, {moonbeam: block}) { const pooledCoin = await sdk.api.abi.call({ block, chain, - target: "0xfa36fe1da08c89ec72ea1f0143a35bfd5daea108", - abi: {"inputs":[],"name":"getTotalPooledKSM","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"} + target: ADDRESSES.moonbeam.stDOT, + abi: "uint256:getTotalPooledKSM", }) return { @@ -83,9 +76,10 @@ async function solana(timestamp, ethBlock, chainBlocks) { module.exports = { hallmarks: [ + [1610496000, "Start of incentives for curve pool"], [1651881600,"UST depeg"], - [1658145600, "News stETH on Layer 2"], - [1667865600, "FTX collapse"] + [1667865600, "FTX collapse"], + [1684108800, "ETH Withdrawal Activation"] ], methodology: 'Staked tokens are counted as TVL based on the chain that they are staked on and where the liquidity tokens are issued, stMATIC is counted as Ethereum TVL since MATIC is staked in Ethereum and the liquidity token is also issued on Ethereum', timetravel: false, // solana diff --git a/projects/lido/sol-helpers.js b/projects/lido/sol-helpers.js index 42beeb1f35b..34321ef96ce 100644 --- a/projects/lido/sol-helpers.js +++ b/projects/lido/sol-helpers.js @@ -7,9 +7,11 @@ const RESERVE_ACCOUNT_ADDRESS = "3Kwv3pEAuoe4WevPB4rgMBTZndGDb53XT7qwQKnvHPfX"; async function retrieveValidatorsBalance(connection) { const accountInfo = await connection.getAccountInfo(new PublicKey(SOLIDO_ADDRESS)); const deserializedAccountInfo = decodeAccount('lido', accountInfo) - return deserializedAccountInfo.validators.entries - .map(pubKeyAndEntry => pubKeyAndEntry.entry) - .map(validator => validator.stake_accounts_balance.toNumber()) + const validatorListAddress = new PublicKey(deserializedAccountInfo.validator_list) + const validatorsInfo = await connection.getAccountInfo(validatorListAddress); + const decodedValInfo = decodeAccount('lidoValidatorList', validatorsInfo) + return decodedValInfo.entries + .map(validator => validator.effective_stake_balance.toNumber()) .reduce((prev, current) => prev + current, 0) } diff --git a/projects/lien/index.js b/projects/lien/index.js index 993f289e64a..ff7c6e0b895 100644 --- a/projects/lien/index.js +++ b/projects/lien/index.js @@ -1,7 +1,8 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const BigNumber = require("bignumber.js"); -const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000"; +const ZERO_ADDRESS = ADDRESSES.null; const contracts = [ "0xE446158503d0F5c70579FCCE774C00E8Db544559", // aggregator1 "0x5F3b6405dfcF8b21f8dEB4eb6DA44a89a652aCb0", // aggregator2 diff --git a/projects/lif3-swap/index.js b/projects/lif3-swap/index.js index b944f210d42..a880a7921dd 100644 --- a/projects/lif3-swap/index.js +++ b/projects/lif3-swap/index.js @@ -7,28 +7,26 @@ const stakingContract = "0x68cDbC441BAD0476db6750D1358F2Ea4dEB0d016" const LIF3_TOKEN = "fantom:0xbf60e7414ef09026733c1e7de72e7393888c64da" const stLIF3 = "0x42fc88b94C6C58797D3EA44ED66EEaFFD88E7344" -async function stakingTvl(timestamp, ethBlock, {tombchain: block}) { - const stakedLIF3 = (await sdk.api.abi.call({ - target: stLIF3, - params: stakingContract, - abi: 'erc20:balanceOf', - block: block, - chain: 'tombchain' - })).output - const balances = { - [LIF3_TOKEN]: stakedLIF3 - } - return balances +async function stakingTvl(timestamp, ethBlock, { tombchain: block }) { + const stakedLIF3 = (await sdk.api.abi.call({ + target: stLIF3, + params: stakingContract, + abi: 'erc20:balanceOf', + block: block, + chain: 'tombchain' + })).output + const balances = { + [LIF3_TOKEN]: stakedLIF3 } + return balances +} module.exports = { misrepresentedTokens: true, tombchain: { - tvl: getUniTVL({ - chain: 'tombchain', - useDefaultCoreAssets: true, - factory: '0x69Da8FFe6550A3D78dBff368194d490fB30703f9', - }), + tvl: getUniTVL({ useDefaultCoreAssets: true, factory: '0x69Da8FFe6550A3D78dBff368194d490fB30703f9', }), staking: stakingTvl - } + }, + bsc: { tvl: getUniTVL({ factory: '0x3FB1E7D5d9C974141A5B6E5fa4edab0a7Aa15C6A', useDefaultCoreAssets: true, }) }, + polygon: { tvl: getUniTVL({ factory: '0x3FB1E7D5d9C974141A5B6E5fa4edab0a7Aa15C6A', useDefaultCoreAssets: true, }) }, }; // node test.js projects/lif3-swap/index.js diff --git a/projects/lif3-trade/index.js b/projects/lif3-trade/index.js new file mode 100644 index 00000000000..bc4bfb3bb0a --- /dev/null +++ b/projects/lif3-trade/index.js @@ -0,0 +1,10 @@ +const { gmxExports } = require('../helper/gmx') + +module.exports = { + fantom: { + tvl: gmxExports({ vault: '0x58e3018B9991aBB9075776537f192669D69cA930', }) + }, + bsc: { + tvl: gmxExports({ vault: '0x089Bd994241db63a5dc5C256481d1722B23EF8d0', }) + }, +} \ No newline at end of file diff --git a/projects/lifedao/index.js b/projects/lifedao/index.js index f0ab0d04b53..6c7f1cbf0ea 100644 --- a/projects/lifedao/index.js +++ b/projects/lifedao/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { ohmTvl } = require('../helper/ohm') const treasury = "0x1e63a2eB2827db56d3CB1e1FF17ef1040B2d3D3f" @@ -5,7 +6,7 @@ module.exports = ohmTvl(treasury, [ //MIM ["0x130966628846bfd36ff31a822705796e8cb8c18d", false], //wAVAX - ["0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7", false], + [ADDRESSES.avax.WAVAX, false], //joe LP ["0xd7cdc2e47ab29a6b651704e39374bb9857f02e02", true], //joe LP diff --git a/projects/lighter/index.js b/projects/lighter/index.js new file mode 100644 index 00000000000..fd0ca1ea01a --- /dev/null +++ b/projects/lighter/index.js @@ -0,0 +1,19 @@ +const { sumTokens2 } = require('../helper/unwrapLPs') +const { getLogs } = require('../helper/cache/getLogs') + +async function tvl(_, _b, _cb, { api, }) { + const logs = await getLogs({ + api, + target: '0x35642792abc96fa1e9ffe5f2f62a539bb80a8af4', + topic: 'OrderBookCreated(uint8,address,address,address,uint8,uint8)', + fromBlock: 65833710, + eventAbi: 'event OrderBookCreated (uint8 orderBookId, address orderBookAddress, address token0, address token1, uint8 logSizeTick, uint8 logPriceTick)', + onlyArgs: true, + }) + + return sumTokens2({ api, ownerTokens: logs.map(i => [[i.token0, i.token1], i.orderBookAddress]) }) +} + +module.exports = { + arbitrum: { tvl, } +} \ No newline at end of file diff --git a/projects/line/index.js b/projects/line/index.js new file mode 100644 index 00000000000..f58d7083317 --- /dev/null +++ b/projects/line/index.js @@ -0,0 +1,50 @@ +/** + * LINE is a price-protected token. + * It is issued by borrowing against locking a collateral. + * If the token's price on DEXes grows after borrowing, the user will be able to sell it for profit. + * If it falls, the user will be able to repay the loan and get their collateral back (less fees). + * This is what ensures price protection. + * + * @see https://linetoken.org + * + */ + +const { sumUnknownTokens } = require('../helper/unknownTokens'); + +const LINE_CONTRACT_ADDRESS = "0x31f8d38df6514b6cc3C360ACE3a2EFA7496214f6"; +const COLLATERAL_TOKEN_ADDRESS = "0x0b93109d05Ef330acD2c75148891cc61D20C3EF1"; + +const tvl = async (_, _1, { kava: block }, { api }) => { + const LOAN_NFT_CONTRACT_ADDRESS = await api.call({ + abi: "address:loanNFT", + target: LINE_CONTRACT_ADDRESS, + }); + + return api.sumTokens({ + owners: [LINE_CONTRACT_ADDRESS, LOAN_NFT_CONTRACT_ADDRESS], + tokens: [COLLATERAL_TOKEN_ADDRESS], + }); +} + + +const staking = async (_, _1, { kava: block }, { api }) => { + const poolAddresses = await api.call({ + abi: "function getAllPools() view returns (tuple[](tuple(bool, uint16, uint256, uint256, uint256), address))", + target: LINE_CONTRACT_ADDRESS, + }).then(allPools => allPools.map(([_, address]) => address)); + + return sumUnknownTokens({ + owners: [LINE_CONTRACT_ADDRESS], + tokens: poolAddresses, + api, resolveLP: true, + coreAssets: [COLLATERAL_TOKEN_ADDRESS ] + }); +} + +module.exports = { + methodology: 'The TVL is calculated as USD value of the collateral locked for issuing LINE tokens, staked LP tokens of incentivized pools, and the balances of pending orders on the options market.', + kava: { + tvl, + staking + } +} \ No newline at end of file diff --git a/projects/lineabank/index.js b/projects/lineabank/index.js new file mode 100644 index 00000000000..90636a7dda7 --- /dev/null +++ b/projects/lineabank/index.js @@ -0,0 +1,12 @@ +const { compoundExports2 } = require("../helper/compound"); + +module.exports = { + linea: compoundExports2({ + comptroller: "0x009a0b7C38B542208936F1179151CD08E2943833", + fetchBalances: true, + abis: { + getAllMarkets: "address[]:allMarkets", + totalBorrows: "uint256:totalBorrow", + }, + }), +}; diff --git a/projects/linear/abis.json b/projects/linear/abis.json index 2bb83113e33..f4e247bd574 100644 --- a/projects/linear/abis.json +++ b/projects/linear/abis.json @@ -1,41 +1,5 @@ { - "totalLockedAmount": { - "inputs": [], - "name": "totalLockedAmount", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "totalStakeAmount": { - "inputs": [], - "name": "totalStakeAmount", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "totalSubscribedAmount": { - "inputs": [], - "name": "totalSubscribedAmount", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -} + "totalLockedAmount": "uint256:totalLockedAmount", + "totalStakeAmount": "uint256:totalStakeAmount", + "totalSubscribedAmount": "uint256:totalSubscribedAmount" +} \ No newline at end of file diff --git a/projects/linear/index.js b/projects/linear/index.js index 1779ddcff47..b3ddc8b1863 100644 --- a/projects/linear/index.js +++ b/projects/linear/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const BigNumber = require("bignumber.js"); @@ -10,7 +11,7 @@ const LnRewardLockerAddress = "0x66D60EDc3876b8aFefD324d4edf105fd5c4aBeDc"; const tokens = { lUSD: "0x23e8a70534308a4aaf76fb8c32ec13d17a3bd89e", LINA: "0x762539b45A1dCcE3D36d080F74d1AED37844b878", - bUSD: "0xe9e7cea3dedca5984780bafc599bd69add087d56", + bUSD: ADDRESSES.bsc.BUSD, LPTOKEN: "0x392f351fc02a3b74f7900de81a9aaac13ec28e95", }; diff --git a/projects/lioncommerce/index.js b/projects/lioncommerce/index.js new file mode 100644 index 00000000000..7ac71f4b67f --- /dev/null +++ b/projects/lioncommerce/index.js @@ -0,0 +1,19 @@ +const { stakingPricedLP } = require("../helper/staking"); +const { unknownTombs, sumTokensExport } = require("../helper/unknownTokens"); +const { mergeExports } = require("../helper/utils"); + +const stakingValue = sumTokensExport({ + chain: "kava", + owner: "0x52b18024e084150e001a34be9c7a41706517d79f", + tokens: ["0x990e157fC8a492c28F5B50022F000183131b9026"], + lps: ["0x09d6561b3795ae237e42f7adf3dc83742e10a2e8"], + useDefaultCoreAssets: true, +}); +const lionStaking = { + kava: { + staking: stakingValue, + tvl: async () => ({}), + }, +}; + +module.exports = lionStaking; diff --git a/projects/liondex/index.js b/projects/liondex/index.js new file mode 100644 index 00000000000..aac66e14abd --- /dev/null +++ b/projects/liondex/index.js @@ -0,0 +1,19 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { staking } = require('../helper/staking') +const { sumTokens2,sumTokensExport } = require('../helper/unwrapLPs') + +//const treasure = "0x7fca3bf8adc4e143bd789aecda36c0ce34f1d75b"; +const lionDEXVault = "0x8eF99304eb88Af9BDe85d58a35339Cb0e2a557B6"; +const lionStaking = "0x154E2b1dBE9F493fF7938E5d686366138ddCE017"; +const LION = "0x8ebb85d53e6955e557b7c53acde1d42fd68561ec"; +const fsGLP = ADDRESSES.arbitrum.fsGLP; +const USDC = ADDRESSES.arbitrum.USDC; + + +module.exports = { + methodology: `Counts fsGLP and USDC deposited to lionDEXVault. Staking counts Lion deposited to stakingPool.`, + arbitrum: { + tvl: sumTokensExport({ chain: 'arbitrum', owners: [lionDEXVault], tokens: [ fsGLP, USDC]}), + staking: staking(lionStaking, LION, 'arbitrum') + } +} diff --git a/projects/liqee/abi.json b/projects/liqee/abi.json index fc35e875f09..6e72d4e39f4 100644 --- a/projects/liqee/abi.json +++ b/projects/liqee/abi.json @@ -1,176 +1,12 @@ { - "getBaseData": { - "constant": false, - "inputs": [], - "name": "getBaseData", - "outputs": [{ - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - "balanceOfUnderlying":{ - "inputs": [ - { - "internalType": "address", - "name": "_account", - "type": "address" - } - ], - "name": "balanceOfUnderlying", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "balanceOf":{ - "constant": true, - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "totalSupply":{ - "constant": true, - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "exchangeRateCurrent":{ - "inputs": [], - "name": "exchangeRateCurrent", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "underlying":{ - "inputs": [], - "name": "underlying", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getUnderlyingPrice":{ - "inputs": [ - { - "internalType": "address", - "name": "_asset", - "type": "address" - } - ], - "name": "getUnderlyingPrice", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getAlliTokens": { - "inputs": [], - "name": "getAlliTokens", - "outputs": [ - { - "internalType": "address[]", - "name": "_alliTokens", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - "isiToken":{ - "inputs": [], - "name": "isiToken", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "pure", - "type": "function" - }, - "totalBorrows":{ - "inputs": [], - "name": "totalBorrows", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -} + "getBaseData": "function getBaseData() returns (uint256, uint256, uint256, uint256, uint256)", + "balanceOfUnderlying": "function balanceOfUnderlying(address _account) view returns (uint256)", + "balanceOf": "function balanceOf(address account) view returns (uint256)", + "totalSupply": "uint256:totalSupply", + "exchangeRateCurrent": "uint256:exchangeRateCurrent", + "underlying": "address:underlying", + "getUnderlyingPrice": "function getUnderlyingPrice(address _asset) view returns (uint256)", + "getAlliTokens": "address[]:getAlliTokens", + "isiToken": "bool:isiToken", + "totalBorrows": "uint256:totalBorrows" +} \ No newline at end of file diff --git a/projects/liquid-bolt/index.js b/projects/liquid-bolt/index.js new file mode 100644 index 00000000000..45317b3401b --- /dev/null +++ b/projects/liquid-bolt/index.js @@ -0,0 +1,28 @@ + +const { getUniTVL } = require('../helper/unknownTokens') + +const factory = { + bsc: "0xBDEc20d9cdf8E222EDd536268A9883a4C2ca172D", + fantom: "0xdE08A0860B5971201f4d621B6eD4bb5BFed454be", + polygon: "0xF301aE81800Aa97f68148531D487696EF939170E", + arbitrum: "0x3D225a66c4A609634fb2c2d75d30Fd6610EBb1BD", +}; + +module.exports = { + methodology: `Uses factory addresses to find and price Liquidity Pools TVL`, + bsc: { + tvl: getUniTVL({ factory: factory.bsc, useDefaultCoreAssets: true, }), + }, + fantom: { + tvl: getUniTVL({ factory: factory.fantom, useDefaultCoreAssets: true, }), + }, + polygon: { + tvl: getUniTVL({ factory: factory.polygon, useDefaultCoreAssets: true, }), + }, + arbitrum: { + tvl: getUniTVL({ factory: factory.arbitrum, useDefaultCoreAssets: true, }), + }, +}; + + + diff --git a/projects/liquid-finance/index.js b/projects/liquid-finance/index.js index 4a33b568508..5621859c947 100644 --- a/projects/liquid-finance/index.js +++ b/projects/liquid-finance/index.js @@ -1,12 +1,13 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumUnknownTokens, sumTokensExport, staking } = require('../helper/unknownTokens') -const LIQD_TOKEN = '0x93C15cd7DE26f07265f0272E0b831C5D7fAb174f' +const LIQD_TOKEN = ADDRESSES.arbitrum.LIQD const LIQD_ETH_TOKEN = '0x73700aeCfC4621E112304B6eDC5BA9e36D7743D3' const masterchef = '0x2582fFEa547509472B3F12d94a558bB83A48c007' const WETH_POOL = '0x705ea996D53Ff5bdEB3463dFf1890F83f57CDe97' const LIQD_STAKING = '0xA1A988A22a03CbE0cF089e3E7d2e6Fcf9BD585A9' const TREASURY = '0x61fb28d32447ef7F4e85Cf247CB9135b4E9886C2' -const WETH = '0x82af49447d8a07e3bd95bd0d56f35241523fbab1' +const WETH = ADDRESSES.arbitrum.WETH const chain = 'arbitrum' const LPs = [ '0x5dcf474814515b58ca0ca5e80bbb00d18c5b5cf8', diff --git a/projects/liquiddriver/abi.json b/projects/liquiddriver/abi.json index 9a0d954ce9e..32b2a27d1a6 100644 --- a/projects/liquiddriver/abi.json +++ b/projects/liquiddriver/abi.json @@ -1,240 +1,15 @@ { - "poolInfo": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "poolInfo", - "outputs": [ - { - "internalType": "contract IBEP20", - "name": "lpToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "allocPoint", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastRewardBlock", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accLqdrPerShare", - "type": "uint256" - }, - { - "internalType": "uint16", - "name": "depositFeeBP", - "type": "uint16" - } - ], - "stateMutability": "view", - "type": "function" - }, - "poolLength": { - "inputs": [], - "name": "poolLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "balanceOf": { - "inputs": [], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "lpToken": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "lpToken", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "strategies": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "strategies", - "outputs": [ - { - "internalType": "contract IStrategy", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "get_virtual_price": { - "stateMutability": "view", - "type": "function", - "name": "get_virtual_price", - "inputs": [], - "outputs": [ - { - "name": "", - "type": "uint256" - } - ] - }, - "getPoolTokens": { - "inputs": [ - { - "internalType": "bytes32", - "name": "poolId", - "type": "bytes32" - } - ], - "name": "getPoolTokens", - "outputs": [ - { - "internalType": "contract IERC20[]", - "name": "tokens", - "type": "address[]" - }, - { - "internalType": "uint256[]", - "name": "balances", - "type": "uint256[]" - }, - { - "internalType": "uint256", - "name": "lastChangeBlock", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getReserves": { - "constant": true, - "inputs": [], - "name": "getReserves", - "outputs": [ - { - "internalType": "uint112", - "name": "_reserve0", - "type": "uint112" - }, - { - "internalType": "uint112", - "name": "_reserve1", - "type": "uint112" - }, - { - "internalType": "uint32", - "name": "_blockTimestampLast", - "type": "uint32" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "totalSupply": { - "constant": true, - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "exchangeRateStored": { - "constant": true, - "inputs": [], - "name": "exchangeRateStored", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "shadowLpToken": { - "inputs": [], - "name": "lpToken", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "shadowStrategy": { - "inputs": [], - "name": "strategy", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getVirtualSupply": { - "inputs": [], - "name": "getVirtualSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } + "poolInfo": "function poolInfo(uint256) view returns (address lpToken, uint256 allocPoint, uint256 lastRewardBlock, uint256 accLqdrPerShare, uint16 depositFeeBP)", + "poolLength": "uint256:poolLength", + "balanceOf": "uint256:balanceOf", + "lpToken": "function lpToken(uint256) view returns (address)", + "strategies": "function strategies(uint256) view returns (address)", + "get_virtual_price": "uint256:get_virtual_price", + "getPoolTokens": "function getPoolTokens(bytes32 poolId) view returns (address[] tokens, uint256[] balances, uint256 lastChangeBlock)", + "getReserves": "function getReserves() view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast)", + "totalSupply": "uint256:totalSupply", + "exchangeRateStored": "uint256:exchangeRateStored", + "shadowLpToken": "address:lpToken", + "shadowStrategy": "address:strategy", + "getVirtualSupply": "uint256:getVirtualSupply" } \ No newline at end of file diff --git a/projects/liquiddriver/index.js b/projects/liquiddriver/index.js index d023eca9988..58f10a34192 100644 --- a/projects/liquiddriver/index.js +++ b/projects/liquiddriver/index.js @@ -1,7 +1,8 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); -const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); -const { transformFantomAddress } = require("../helper/portedTokens"); +const { unwrapUniswapLPs, sumTokens2 } = require("../helper/unwrapLPs"); +const { transformFantomAddress, transformBscAddress } = require("../helper/portedTokens"); const { addFundsInMasterChef } = require("../helper/masterchef"); const { staking } = require("../helper/staking"); const BigNumber = require("bignumber.js"); @@ -9,17 +10,10 @@ const BigNumber = require("bignumber.js"); // --- All sushitokens lp tokens are staked here for LQDR tokens --- const MASTERCHEF = "0x742474dae70fa2ab063ab786b1fbe5704e861a0c"; const MINICHEF = "0x6e2ad6527901c9664f016466b8DA1357a004db0f"; -const usdtTokenAddress = "0x049d68029688eabf473097a2fc38ef61633a3c7a"; -const usdcTokenAddress = "0x04068da6c83afcfa0e13ba15a6696662335d5b75"; -const wftmTokenAddress = "0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83"; -const spiritTokenAddress = "0x5Cc61A78F164885776AA610fb0FE1257df78E59B"; -const hndTokenAddress = "0x10010078a54396F62c96dF8532dc2B4847d47ED3"; +const BSCMINICHEF = "0xD46db083De31c64AF3F680f139A31fF37bac004f"; +const usdcTokenAddress = ADDRESSES.fantom.USDC; +const wftmTokenAddress = ADDRESSES.fantom.WFTM; const beethovenVaultAddress = "0x20dd72Ed959b6147912C2e529F0a0C651c33c9ce"; -const spiritLinspiritLpInSpirit = "0x54d5b6881b429a694712fa89875448ca8adf06f4"; -const linspiritStakingAddress = "0x1CC765cD7baDf46A215bD142846595594AD4ffe3"; -const linspiritTokenAddress = "0xc5713B6a0F26bf0fdC1c52B90cd184D950be515C"; -const liHndStakingAddress = "0xdf2dA1E24ADa883366972A73d23d1aDDA8CF7CD2"; -const liHndTokenAddress = "0xA147268f35Db4Ae3932eabe42AF16C36A8B89690"; const LQDR = "0x10b620b2dbac4faa7d7ffd71da486f5d44cd86f9"; const xLQDR = "0x3Ae658656d1C526144db371FaEf2Fff7170654eE"; @@ -50,6 +44,15 @@ const shadowChefAddresses = [ "0xD75d45215a5E8E484F1f094f15b2f626A953456e", // TAROT/FTM" "0x9757fd7d3B6281218E11Bab3b550eab8C4eF5eA9", // RING/FTM" "0xa0AC54644dfCE40F83F3B1BC941c234532B4B8e1", // CRE8R/FTM" + "0x763caa35565d457AD4231E089C3E8fb3d0fa3d56", // WPGUNK/FTM + "0xf2c00E3ee1c67aAD4169bD041aFd3B7ff98b2775", // wBOMB/FTM + "0x57B57A9a34de8547EC4a26b4bded6e78c92C9A76", // USDC/BOO + "0x948dbcf4595366297E5F2c1baD1593dBBDe875C6", // FTM/gALCX + "0x1c9c9d2A73A07F2cbAaa7C086a2DA70f155667d6", // USDC/MAI + "0x0f45B4A89AAb28f4C4dC2d08ebAD277983d4B67a", // LQDR/FTM + "0x0BF91d2e547A07A41d48817bDD28cb331227d945", // MATIC/FTM + "0x762C8112207820d60FbB9894D429A60c570Ab574", // TOR/FTM + "0xD354908d297ce9a348b417d2e0F561EE7D11de5E", // wsHEC/FTM ]; const masterchefTvl = async (timestamp, ethBlock, chainBlocks) => { @@ -69,351 +72,7 @@ const masterchefTvl = async (timestamp, ethBlock, chainBlocks) => { return balances; }; -const minichefTvl = async (timestamp, ethBlock, chainBlocks) => { - let balances = {}; - - const transformAddress = await transformFantomAddress(); - - // pool section tvl - const poolLength = ( - await sdk.api.abi.call({ - abi: abi.poolLength, - target: MINICHEF, - chain: "fantom", - block: chainBlocks["fantom"], - }) - ).output; - - const [lpTokens, strategies] = await Promise.all([ - sdk.api.abi.multiCall({ - block: chainBlocks["fantom"], - calls: Array.from(Array(Number(poolLength)).keys()).map((i) => ({ - target: MINICHEF, - params: i, - })), - abi: abi.lpToken, - chain: "fantom", - }), - sdk.api.abi.multiCall({ - block: chainBlocks["fantom"], - calls: Array.from(Array(Number(poolLength)).keys()).map((i) => ({ - target: MINICHEF, - params: i, - })), - abi: abi.strategies, - chain: "fantom", - }), - ]); - - const [symbols, tokenBalances, strategyBalances] = await Promise.all([ - sdk.api.abi.multiCall({ - block: chainBlocks["fantom"], - calls: lpTokens.output.map((p) => ({ - target: p.output, - })), - abi: "erc20:symbol", - chain: "fantom", - }), - sdk.api.abi.multiCall({ - block: chainBlocks["fantom"], - calls: lpTokens.output.map((p) => ({ - target: p.output, - params: MINICHEF, - })), - abi: "erc20:balanceOf", - chain: "fantom", - }), - sdk.api.abi.multiCall({ - block: chainBlocks["fantom"], - calls: strategies.output - .filter( - (strategy) => - strategy.output !== "0x0000000000000000000000000000000000000000" - ) - .map((strategy) => ({ - target: strategy.output, - })), - abi: abi.balanceOf, - chain: "fantom", - }) - ]); - - const lpPositions = []; - let i = 0; - - tokenBalances.output.forEach(async (balance, idx) => { - const strategy = strategies.output[idx].output; - - let totalBalance = new BigNumber(balance.output); - - if (strategy !== "0x0000000000000000000000000000000000000000") { - totalBalance = totalBalance.plus( - new BigNumber(strategyBalances.output[i].output) - ); - i++; - } - - const token = balance.input.target; - if (symbols.output[idx].success) { - if (token === "0x936D23C83c2469f6a14B9f5bEaec13879598A5aC") { // ICE-FTM SPIRIT LP - const [reserves, totalSupply] = await Promise.all([ - sdk.api.abi.call({ - abi: abi.getReserves, - target: token, - chain: "fantom", - block: chainBlocks["fantom"], - }), - sdk.api.abi.call({ - abi: abi.totalSupply, - target: token, - chain: "fantom", - block: chainBlocks["fantom"], - }), - ]); - const lpTokenRatio = new BigNumber(totalSupply.output).isZero() ? new BigNumber(0) : totalBalance.div(totalSupply.output); - sdk.util.sumSingleBalance( - balances, - transformAddress(wftmTokenAddress), - new BigNumber(Number(reserves.output[0])).times(2).times(lpTokenRatio).toFixed(0) - ); - } else if (symbols.output[idx].output.includes("LP")) { - if (lpTokens.output[idx].output === "0xD163415BD34EF06f57C58D2AEd5A5478AfB464cC") { // BeetXLP_MIM_USDC_USDT - // DO NOTHING - } else { - lpPositions.push({ - balance: totalBalance.toString(10), - token, - }); - } - } else { - if (symbols.output[idx].output === "3poolV2-f") { - const virtual_price = ( - await sdk.api.abi.call({ - abi: abi.get_virtual_price, - target: token, - chain: "fantom", - block: chainBlocks["fantom"], - }) - ).output; - const curveTvlInUsdt = totalBalance.times(virtual_price).div(1e30).toFixed(0); - - sdk.util.sumSingleBalance( - balances, - transformAddress(usdtTokenAddress), - curveTvlInUsdt - ); - } else if (lpTokens.output[idx].output === "0x30A92a4EEca857445F41E4Bb836e64D66920F1C0") { // BPT_LINSPIRIT LP - const [tokenBalances, reserves, totalSupply] = await Promise.all([ - sdk.api.abi.call({ - abi: abi.getPoolTokens, - target: beethovenVaultAddress, - params: ["0x30a92a4eeca857445f41e4bb836e64d66920f1c0000200000000000000000071"], - chain: "fantom", - block: chainBlocks["fantom"], - }), - sdk.api.abi.call({ - abi: abi.getReserves, - target: spiritLinspiritLpInSpirit, - chain: "fantom", - block: chainBlocks["fantom"], - }), - sdk.api.abi.call({ - abi: abi.totalSupply, - target: token, - chain: "fantom", - block: chainBlocks["fantom"], - }), - ]); - const lpTokenRatio = new BigNumber(totalSupply.output).isZero() ? new BigNumber(0) : totalBalance.div(totalSupply.output); - const linspiritPriceInSpirit = new BigNumber(Number(reserves.output[0])).div(Number(reserves.output[1])) - const linSpiritBalanceInSpirit = linspiritPriceInSpirit.times(Number(tokenBalances.output['1'][1])) - const bptLinspiritTvlInSpirit = new BigNumber(Number(tokenBalances.output['1'][0])).plus(linSpiritBalanceInSpirit).times(lpTokenRatio).toFixed(0); - sdk.util.sumSingleBalance( - balances, - transformAddress(spiritTokenAddress), - bptLinspiritTvlInSpirit - ); - } else if (lpTokens.output[idx].output === "0xf3A602d30dcB723A74a0198313a7551FEacA7DAc") { // BPT-QUARTET LP - const [tokenBalances, totalSupply] = await Promise.all([ - sdk.api.abi.call({ - abi: abi.getPoolTokens, - target: beethovenVaultAddress, - params: ["0xf3a602d30dcb723a74a0198313a7551feaca7dac00010000000000000000005f"], - chain: "fantom", - block: chainBlocks["fantom"], - }), - sdk.api.abi.call({ - abi: abi.totalSupply, - target: token, - chain: "fantom", - block: chainBlocks["fantom"], - }), - ]); - const lpTokenRatio = new BigNumber(totalSupply.output).isZero() ? new BigNumber(0) : totalBalance.div(totalSupply.output); - const bptQuartetTvlInUsdc = new BigNumber(tokenBalances.output['1'][0]).times(4).times(lpTokenRatio).toFixed(0); - sdk.util.sumSingleBalance( - balances, - transformAddress(usdcTokenAddress), - bptQuartetTvlInUsdc - ); - } else if (lpTokens.output[idx].output === "0xcdF68a4d525Ba2E90Fe959c74330430A5a6b8226") { // FTM-OPERA LP - const [tokenBalances, totalSupply] = await Promise.all([ - sdk.api.abi.call({ - abi: abi.getPoolTokens, - target: beethovenVaultAddress, - params: ["0xcdf68a4d525ba2e90fe959c74330430a5a6b8226000200000000000000000008"], - chain: "fantom", - block: chainBlocks["fantom"], - }), - sdk.api.abi.call({ - abi: abi.totalSupply, - target: token, - chain: "fantom", - block: chainBlocks["fantom"], - }), - ]); - const lpTokenRatio = new BigNumber(totalSupply.output).isZero() ? new BigNumber(0) : totalBalance.div(totalSupply.output); - const ftmOperaTvlInUsdc = new BigNumber(tokenBalances.output['1'][0]).times(100).div(30).times(lpTokenRatio).toFixed(0); - sdk.util.sumSingleBalance( - balances, - transformAddress(usdcTokenAddress), - ftmOperaTvlInUsdc - ); - } else if (lpTokens.output[idx].output === "0x8F6a658056378558fF88265f7c9444A0FB4DB4be") { // BPT_liHND LP - const [tokenBalances, totalSupply] = await Promise.all([ - sdk.api.abi.call({ - abi: abi.getPoolTokens, - target: beethovenVaultAddress, - params: ["0x8f6a658056378558ff88265f7c9444a0fb4db4be0002000000000000000002b8"], - chain: "fantom", - block: chainBlocks["fantom"], - }), - sdk.api.abi.call({ - abi: abi.totalSupply, - target: token, - chain: "fantom", - block: chainBlocks["fantom"], - }), - ]); - const lpTokenRatio = new BigNumber(totalSupply.output).isZero() ? new BigNumber(0) : totalBalance.div(totalSupply.output); - const bptLiHndTvlInHnd = new BigNumber(Number(tokenBalances.output['1'][0])).times(2).times(lpTokenRatio).toFixed(0); - sdk.util.sumSingleBalance( - balances, - transformAddress(hndTokenAddress), - bptLiHndTvlInHnd - ); - } else if (lpTokens.output[idx].output === "0x8B858Eaf095A7337dE6f9bC212993338773cA34e") { // DEI-USDC LP - const [tokenBalances, totalSupply] = await Promise.all([ - sdk.api.abi.call({ - abi: abi.getPoolTokens, - target: beethovenVaultAddress, - params: ["0x8b858eaf095a7337de6f9bc212993338773ca34e00020000000000000000023c"], - chain: "fantom", - block: chainBlocks["fantom"], - }), - sdk.api.abi.call({ - abi: abi.totalSupply, - target: token, - chain: "fantom", - block: chainBlocks["fantom"], - }), - ]); - const lpTokenRatio = new BigNumber(totalSupply.output).isZero() ? new BigNumber(0) : totalBalance.div(totalSupply.output); - const bptDeiUsdcTvlInUsdc = new BigNumber(Number(tokenBalances.output['1'][1])).div(1e12).plus(Number(tokenBalances.output['1'][0])).times(lpTokenRatio).toFixed(0); - sdk.util.sumSingleBalance( - balances, - transformAddress(usdcTokenAddress), - bptDeiUsdcTvlInUsdc - ); - } else if (lpTokens.output[idx].output === "0xc0064b291bd3D4ba0E44ccFc81bF8E7f7a579cD2") { // SFTMX/FTM - const [tokenBalances, totalSupply] = await Promise.all([ - sdk.api.abi.call({ - abi: abi.getPoolTokens, - target: beethovenVaultAddress, - params: ["0xc0064b291bd3d4ba0e44ccfc81bf8e7f7a579cd200000000000000000000042c"], - chain: "fantom", - block: chainBlocks["fantom"], - }), - sdk.api.abi.call({ - abi: abi.getVirtualSupply, - target: token, - chain: "fantom", - block: chainBlocks["fantom"], - }), - ]); - const sftmTokenAddress = "0xd7028092c830b5C8FcE061Af2E593413EbbC1fc1"; - const lpTokenRatio = new BigNumber(totalSupply.output).isZero() ? new BigNumber(0) : totalBalance.div(totalSupply.output); - const bptSftmxTvlInFtm = new BigNumber(Number(tokenBalances.output['1'][1])).times(lpTokenRatio).toFixed(0); - const bptSftmxTvlInFtm1 = new BigNumber(Number(tokenBalances.output['1'][2])).times(lpTokenRatio).toFixed(0); - sdk.util.sumSingleBalance( - balances, - transformAddress(wftmTokenAddress), - bptSftmxTvlInFtm - ); - sdk.util.sumSingleBalance( - balances, - transformAddress(sftmTokenAddress), - bptSftmxTvlInFtm1 - ); - } else { - sdk.util.sumSingleBalance( - balances, - transformAddress(token), - totalBalance.toString(10) - ); - } - } - } - }); - - const turns = Math.floor(lpPositions.length / 10); - let n = 0; - - for (let i = 0; i < turns; i++) { - await unwrapUniswapLPs( - balances, - lpPositions.slice(n, n + 10), - chainBlocks["fantom"], - "fantom", - transformAddress - ); - n += 10; - } - - // linspirit staking tvl - const linspiritStakedBalance = ((await sdk.api.abi.call({ - chain: 'fantom', - block: chainBlocks['fantom'], - target: linspiritTokenAddress, - abi: 'erc20:balanceOf', - params: linspiritStakingAddress - })).output); - - sdk.util.sumSingleBalance( - balances, - transformAddress(spiritTokenAddress), - linspiritStakedBalance - ); - - // lihnd staking tvl - const liHndStakedBalance = ((await sdk.api.abi.call({ - chain: 'fantom', - block: chainBlocks['fantom'], - target: liHndTokenAddress, - abi: 'erc20:balanceOf', - params: liHndStakingAddress - })).output); - - sdk.util.sumSingleBalance( - balances, - transformAddress(hndTokenAddress), - liHndStakedBalance - ); - - return balances; -}; - -const hundredchefTvl = async (timestamp, ethBlock, chainBlocks) => { +const hundredchefTvl = async (timestamp, ethBlock, chainBlocks, { api }) => { const balances = {}; const transformAddress = await transformFantomAddress(); @@ -429,154 +88,161 @@ const hundredchefTvl = async (timestamp, ethBlock, chainBlocks) => { hfraxChefAddress, ]; - for (let index = 0; index < chefAddressess.length; index++) { - const chefAddress = chefAddressess[index]; - const token = ((await sdk.api.abi.call({ - chain: 'fantom', - block: chainBlocks['fantom'], + await Promise.all(chefAddressess.map( async chefAddress => { + const token = await api.call({ target: chefAddress, abi: abi.lpToken, params: 0 - })).output); + }) - const exchangeRateStored = ((await sdk.api.abi.call({ - chain: 'fantom', - block: chainBlocks['fantom'], + const exchangeRateStored = await api.call({ target: token, abi: abi.exchangeRateStored, - })).output); + }) - const strategyAddress = ((await sdk.api.abi.call({ - chain: 'fantom', - block: chainBlocks['fantom'], + const strategyAddress = await api.call({ target: chefAddress, abi: abi.strategies, params: 0 - })).output); + }) - const strategyBalanace = ((await sdk.api.abi.call({ - chain: 'fantom', - block: chainBlocks['fantom'], + const strategyBalanace = await api.call({ target: strategyAddress, abi: abi.balanceOf, - })).output); + }) sdk.util.sumSingleBalance( balances, transformAddress(usdcTokenAddress), new BigNumber(Number(strategyBalanace)).times(exchangeRateStored).div(chefAddress === husdcChefAddress ? 1e18 : 1e30).toFixed(0) ); - }; + + })) return balances; }; -const shadowchefTvl = async (timestamp, ethBlock, chainBlocks) => { - let balances = {}; +async function getMinichefTvl(api, minichef, balances = {}) { + const [lpTokens, strategies] = await Promise.all([ + api.fetchList({ itemAbi: abi.lpToken, lengthAbi: abi.poolLength, target: minichef}), + api.fetchList({ itemAbi: abi.strategies, lengthAbi: abi.poolLength, target: minichef}), + ]) + + const calls = [] + const callTokens = [] + strategies.forEach((val, i) => { + if (val === ADDRESSES.null) return; + calls.push(val) + callTokens.push(lpTokens[i].toLowerCase()) + } ) + + const balanceOfs = await api.multiCall({ abi: abi.balanceOf, calls }) + + callTokens.forEach((token, i) => sdk.util.sumSingleBalance(balances,token,balanceOfs[i], api.chain)) + + if (api.chain === 'fantom') { + await Promise.all([ + resolveBPT(api, balances), + resolvOperaBPT(api, balances), + ]) + } - const transformAddress = await transformFantomAddress(); + return sumTokens2({ balances, api, + // owner: minichef, tokens: lpTokens, + resolveLP: true, }) +} + +async function shadowChefTvl(_, _1, _2, { api, }) { + const balances = {} + const [lpTokens, strategies] = await Promise.all([ + api.multiCall({ abi: abi.shadowLpToken, calls: shadowChefAddresses}), + api.multiCall({ abi: abi.shadowStrategy, calls: shadowChefAddresses}), + ]) + + const calls = [] + const callTokens = [] + strategies.forEach((val, i) => { + if (val === ADDRESSES.null) return; + calls.push(val) + callTokens.push(lpTokens[i].toLowerCase()) + } ) + + const balanceOfs = await api.multiCall({ abi: abi.balanceOf, calls }) + + callTokens.forEach((token, i) => sdk.util.sumSingleBalance(balances,token,balanceOfs[i], api.chain)) + + if (api.chain === 'fantom') { + await Promise.all([ + resolveBPT(api, balances), + resolvOperaBPT(api, balances), + ]) + } - const [lpTokens, strategies] = await Promise.all([ - sdk.api.abi.multiCall({ - block: chainBlocks["fantom"], - calls: Array.from(Array(Number(shadowChefAddresses.length)).keys()).map((i) => ({ - target: shadowChefAddresses[i], - })), - abi: abi.shadowLpToken, - chain: "fantom", + return sumTokens2({ balances, api, + // owner: minichef, tokens: lpTokens, + resolveLP: true, }) +} + +async function resolvOperaBPT(api, balances) { + const key = 'fantom:0xcdf68a4d525ba2e90fe959c74330430a5a6b8226' + const bal = balances[key] + if (!bal) return; + delete balances[key] + + const [tokenBalances, totalSupply] = await Promise.all([ + api.call({ + abi: abi.getPoolTokens, + target: beethovenVaultAddress, + params: ["0xcdf68a4d525ba2e90fe959c74330430a5a6b8226000200000000000000000008"], }), - sdk.api.abi.multiCall({ - block: chainBlocks["fantom"], - calls: Array.from(Array(Number(shadowChefAddresses.length)).keys()).map((i) => ({ - target: shadowChefAddresses[i], - })), - abi: abi.shadowStrategy, - chain: "fantom", + api.call({ + abi: abi.totalSupply, + target: '0xcdf68a4d525ba2e90fe959c74330430a5a6b8226', }), ]); - - const [symbols, tokenBalances, strategyBalances] = await Promise.all([ - sdk.api.abi.multiCall({ - block: chainBlocks["fantom"], - calls: lpTokens.output.map((p) => ({ - target: p.output, - })), - abi: "erc20:symbol", - chain: "fantom", + const lpTokenRatio = totalSupply === 0 ? 0 : bal / totalSupply + const bptSftmxTvlInFtm = tokenBalances['1'][0] * (100/30)* lpTokenRatio + sdk.util.sumSingleBalance(balances,usdcTokenAddress,bptSftmxTvlInFtm, api.chain) + return balances +} + +async function resolveBPT(api, balances) { + const key = 'fantom:0xc0064b291bd3d4ba0e44ccfc81bf8e7f7a579cd2' + const bal = balances[key] + if (!bal) return; + delete balances[key] + + const [tokenBalances, totalSupply] = await Promise.all([ + api.call({ + abi: abi.getPoolTokens, + target: beethovenVaultAddress, + params: ["0xc0064b291bd3d4ba0e44ccfc81bf8e7f7a579cd200000000000000000000042c"], }), - sdk.api.abi.multiCall({ - block: chainBlocks["fantom"], - calls: lpTokens.output.map((p, index) => ({ - target: p.output, - params: shadowChefAddresses[index], - })), - abi: "erc20:balanceOf", - chain: "fantom", + api.call({ + abi: abi.getVirtualSupply, + target: '0xc0064b291bd3d4ba0e44ccfc81bf8e7f7a579cd2', }), - sdk.api.abi.multiCall({ - block: chainBlocks["fantom"], - calls: strategies.output - .filter( - (strategy) => - strategy.output !== "0x0000000000000000000000000000000000000000" - ) - .map((strategy) => ({ - target: strategy.output, - })), - abi: abi.balanceOf, - chain: "fantom", - }) ]); - - const lpPositions = []; - let i = 0; - - tokenBalances.output.forEach(async (balance, idx) => { - const strategy = strategies.output[idx].output; - - let totalBalance = new BigNumber(balance.output); - - if (strategy !== "0x0000000000000000000000000000000000000000") { - totalBalance = totalBalance.plus( - new BigNumber(strategyBalances.output[i].output) - ); - i++; - } - - const token = balance.input.target; - if (symbols.output[idx].success) { - lpPositions.push({ - balance: totalBalance.toString(10), - token, - }); - } - }); - - const turns = Math.floor(lpPositions.length / 10); - let n = 0; - - for (let i = 0; i < turns; i++) { - await unwrapUniswapLPs( - balances, - lpPositions.slice(n, n + 10), - chainBlocks["fantom"], - "fantom", - transformAddress - ); - n += 10; - } - - return balances; -}; + const sftmTokenAddress = "0xd7028092c830b5C8FcE061Af2E593413EbbC1fc1"; + const lpTokenRatio = totalSupply === 0 ? 0 : bal / totalSupply + const bptSftmxTvlInFtm = tokenBalances['1'][1] * lpTokenRatio + const bptSftmxTvlInFtm1 = tokenBalances['1'][2] * lpTokenRatio + sdk.util.sumSingleBalance(balances,wftmTokenAddress,bptSftmxTvlInFtm, api.chain) + sdk.util.sumSingleBalance(balances,sftmTokenAddress,bptSftmxTvlInFtm1, api.chain) + return balances +} module.exports = { fantom: { staking: staking(xLQDR, LQDR, "fantom", "fantom:" + LQDR), tvl: sdk.util.sumChainTvls([ masterchefTvl, - minichefTvl, + (_, _1, _2, { api }) => getMinichefTvl(api, MINICHEF), hundredchefTvl, - shadowchefTvl, + shadowChefTvl, ]), + }, + bsc: { + tvl: (_, _1, _2, { api }) => getMinichefTvl(api, BSCMINICHEF), } -}; // node test.js projects/liquiddriver/index.js \ No newline at end of file +}; // node test.js projects/liquiddriver/index.js diff --git a/projects/liquidity-book/index.js b/projects/liquidity-book/index.js deleted file mode 100644 index 8c22f7abb87..00000000000 --- a/projects/liquidity-book/index.js +++ /dev/null @@ -1,21 +0,0 @@ -const sdk = require('@defillama/sdk'); -const { staking } = require('../helper/staking'); -const joeBar = "0x57319d41F71E81F3c65F2a47CA4e001EbAFd4F33"; -const joeToken = "0x6e84a6216eA6dACC71eE8E6b0a5B7322EEbC0fDd"; -const { getChainTvl } = require('../helper/getUniSubgraphTvl'); -const graphUrls = { - avax: 'https://api.thegraph.com/subgraphs/name/traderjoe-xyz/joe-v2', -}; - -module.exports = { - timetravel: true, - misrepresentedTokens: true, - methodology: 'We count liquidity on the pairs and we get that information from the "traderjoe-xyz/joe-v2" subgraph.', - avax:{ - tvl: getChainTvl( - graphUrls, - "lbfactories", - "totalValueLockedUSD" - )('avax'), - } -}; diff --git a/projects/liquidrium/abi.json b/projects/liquidrium/abi.json index 21fefc8ac74..1d18d506e2c 100755 --- a/projects/liquidrium/abi.json +++ b/projects/liquidrium/abi.json @@ -1,21 +1,3 @@ -{ - "getTotalAmounts": { - "inputs": [], - "name": "getTotalAmounts", - "outputs": [ - { - "internalType": "uint256", - "name": "total0", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "total1", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -} - \ No newline at end of file +{ + "getTotalAmounts": "function getTotalAmounts() view returns (uint256 total0, uint256 total1)" +} \ No newline at end of file diff --git a/projects/liquidrium/index.js b/projects/liquidrium/index.js index f0176d0efea..dcd811831b8 100644 --- a/projects/liquidrium/index.js +++ b/projects/liquidrium/index.js @@ -1,15 +1,15 @@ const sdk = require('@defillama/sdk'); const abi = require('./abi.json'); -const {vaults} = require('./vaults');1 +const { vaults } = require('./vaults'); 1 -function calculateValue(amount, decimals){ +function calculateValue(amount, decimals) { return amount / 10 ** decimals; -}; +} async function tvl(block, chain) { let balances = {}; - for(let i=0; i tokenMapping[market.marketId.toUpperCase()] + + +async function tvl(_, _b, _cb, { api, }) { + const {markets} = await graphQuery(endpoint, query) + + markets.filter(getToken).forEach(market => api.add(getToken(market) , market.totalSupply)) +} + +async function borrowed(_, _b, _cb, { api, }) { + const {markets} = await graphQuery(endpoint, query) + + markets.filter(getToken).forEach(market => { + const utilization = market.utilization + const availability = 1 - utilization + const totalBorrowed = market.totalSupply * utilization / availability + api.add(getToken(market), totalBorrowed) + }) +} diff --git a/projects/litxswap/index.js b/projects/litxswap/index.js new file mode 100644 index 00000000000..fbe2ba3b8f1 --- /dev/null +++ b/projects/litxswap/index.js @@ -0,0 +1,14 @@ +const { uniV3Export } = require("../helper/uniswapV3"); + +module.exports = uniV3Export({ + pulse: { + factory: "0x24398b6ea5434339934D999E431807B1C157b4Fd", + fromBlock: 17449439, + isAlgebra: true, + }, + bsc: { + factory: "0xbbc7f5605c9cb341d9c41e46ae6ceb30511bdfcf", + fromBlock: 29291639, + isAlgebra: true, + }, +}); diff --git a/projects/lixir/abi.json b/projects/lixir/abi.json index add5ce37946..72ac78801a5 100644 --- a/projects/lixir/abi.json +++ b/projects/lixir/abi.json @@ -1,120 +1,8 @@ { - "getRoleMemberCount": { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - } - ], - "name": "getRoleMemberCount", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getRoleMember": { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "index", - "type": "uint256" - } - ], - "name": "getRoleMember", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "calculateTotals": { - "inputs": [], - "name": "calculateTotals", - "outputs": [ - { - "internalType": "uint256", - "name": "total0", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "total1", - "type": "uint256" - }, - { - "internalType": "uint128", - "name": "mL", - "type": "uint128" - }, - { - "internalType": "uint128", - "name": "rL", - "type": "uint128" - } - ], - "stateMutability": "view", - "type": "function" - }, - "token0": { - "inputs": [], - "name": "token0", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "token1": { - "inputs": [], - "name": "token1", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "balanceOf": { - "constant": true, - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } + "getRoleMemberCount": "function getRoleMemberCount(bytes32 role) view returns (uint256)", + "getRoleMember": "function getRoleMember(bytes32 role, uint256 index) view returns (address)", + "calculateTotals": "function calculateTotals() view returns (uint256 total0, uint256 total1, uint128 mL, uint128 rL)", + "token0": "address:token0", + "token1": "address:token1", + "balanceOf": "function balanceOf(address account) view returns (uint256)" } \ No newline at end of file diff --git a/projects/lixir/index.js b/projects/lixir/index.js index c483b3792f6..dcf15c97154 100644 --- a/projects/lixir/index.js +++ b/projects/lixir/index.js @@ -12,7 +12,7 @@ async function ethTvl(timestamp, block) { let balances = await vaultTvl(oldRegistry, block, {}); await vaultTvl(newRegistry, block, balances) return balances//await newVaultTvl(block, newVaults, balances); -}; +} async function vaultTvl(registry, block, balances, pool2 = false) { const count = Number((await sdk.api.abi.call({ target: registry, @@ -64,9 +64,10 @@ async function vaultTvl(registry, block, balances, pool2 = false) { } return balances; -}; +} module.exports={ + doublecounted: true, ethereum:{ tvl: ethTvl, staking: staking("0x29adccf67821e9236b401df02080bac67f84192d", lixirToken) diff --git a/projects/llama-airforce/abi.json b/projects/llama-airforce/abi.json deleted file mode 100644 index bcb5fb22188..00000000000 --- a/projects/llama-airforce/abi.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "totalUnderlying": { - "inputs": [], - "name": "totalUnderlying", - "outputs": [ - { - "internalType": "uint256", - "name": "total", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "priceOracle": { - "stateMutability": "view", - "type": "function", - "name": "price_oracle", - "inputs": [], - "outputs": [ - { - "name": "", - "type": "uint256" - } - ] - } -} \ No newline at end of file diff --git a/projects/llama-airforce/index.js b/projects/llama-airforce/index.js index 69b6acc95c4..461d09469dc 100644 --- a/projects/llama-airforce/index.js +++ b/projects/llama-airforce/index.js @@ -1,43 +1,37 @@ -const sdk = require('@defillama/sdk'); -const abi = require('./abi.json'); - +const sdk = require("@defillama/sdk"); const contracts = { - cvxCRVHolder: "0x83507cc8c8b67ed48badd1f59f684d5d02884c81", - cvxCRV: "0x62b9c7356a2dc64a1969e19c23e4f579f9810aa7", - cvxFXSHolder: "0xf964b0e3ffdea659c44a5a52bc0b82a24b89ce0e", - cvxFXS: "0xFEEf77d3f69374f66429C91d732A244f074bdf74", - cvxFXSOracle: "0xd658A338613198204DCa1143Ac3F01A722b5d94A", - FXS: "0x3432b6a60d23ca0dfca7761b7ab56459d9c964d0" + uCRV1: "0x83507cc8c8b67ed48badd1f59f684d5d02884c81", + uCRV2: "0x4ebad8dbd4edbd74db0278714fbd67ebc76b89b7", + uCRV3: "0xde2bef0a01845257b4aef2a2eaa48f6eaeafa8b7", + uFXS1: "0xf964b0e3ffdea659c44a5a52bc0b82a24b89ce0e", + uFXS2: "0x3a886455e5b33300a31c5e77bac01e76c0c7b29c", + uCVX: "0x8659fc767cad6005de79af65dafe4249c57927af", + uBAL: "0x8c4eb0fc6805ee7337ac126f89a807271a88dd67", + pxCvx: "0xBCe0Cf87F513102F22232436CCa2ca49e815C3aC", }; -async function tvl(time, block){ - const balances = {}; - - balances[contracts.cvxCRV] = (await sdk.api.abi.call({ - target: contracts.cvxCRVHolder, - abi: abi.totalUnderlying, - block - })).output; - - const cvxFXS = (await sdk.api.abi.call({ - target: contracts.cvxFXSHolder, - abi: abi.totalUnderlying, - block - })).output; - - const ratio = (await sdk.api.abi.call({ - target: contracts.cvxFXSOracle, - abi: abi.priceOracle, - block - })).output; - - balances[contracts.FXS] = cvxFXS * ratio * 10**-18; - - return balances; +const vaults = [ + contracts.uCRV1, + contracts.uCRV2, + contracts.uCRV3, + contracts.uBAL, + contracts.uFXS1, + contracts.uFXS2, +] + +async function tvl(time, block, _, { api },) { + const balances = {}; + + const bals = await api.multiCall({ abi: "uint256:totalUnderlying", calls: vaults }) + const tokens = await api.multiCall({ abi: 'address:underlying', calls: vaults }) + bals.forEach((v, i) => sdk.util.sumSingleBalance(balances, tokens[i], v, api.chain)) + sdk.util.sumSingleBalance(balances, contracts.pxCvx, await api.call({ target: contracts.uCVX, abi: "uint256:totalAssets", }), api.chain) + + return balances; +} + +module.exports = { + ethereum: { + tvl, + }, }; - -module.exports={ - ethereum:{ - tvl - } -}; \ No newline at end of file diff --git a/projects/llamalend/abi.json b/projects/llamalend/abi.json index b4a47f6dfab..055539e4bf7 100644 --- a/projects/llamalend/abi.json +++ b/projects/llamalend/abi.json @@ -1,13 +1,3 @@ { - "totalBorrowed": { - "inputs": [], - "name": "totalBorrowed", - "outputs": [{ - "internalType": "uint256", - "name": "", - "type": "uint256" - }], - "stateMutability": "view", - "type": "function" - } + "totalBorrowed": "uint256:totalBorrowed" } \ No newline at end of file diff --git a/projects/llamalend/index.js b/projects/llamalend/index.js index 382f887b968..246367d4bb0 100644 --- a/projects/llamalend/index.js +++ b/projects/llamalend/index.js @@ -1,42 +1,39 @@ const sdk = require('@defillama/sdk') const abi = require("./abi.json"); const BigNumber = require("bignumber.js"); +const { getLogs } = require('../helper/cache/getLogs') const { nullAddress, sumTokens2 } = require('../helper/unwrapLPs') -async function getTVL(block, borrowed) { - const chain = 'ethereum' +async function getTVL(api, borrowed) { const PoolFactory = '0x55F9F26b3d7a4459205c70994c11775629530eA5' - const logs = await sdk.api.util.getLogs({ - keys: [], - toBlock: block, + const logs = await getLogs({ + api, target: PoolFactory, fromBlock: 15819910, topic: 'PoolCreated(address,address,address)', }) - const owners = logs.output.map(i => `0x${i.data.substring(26, 66)}`) - const totalBorrowed = await sdk.api.abi.multiCall({ + const owners = logs.map(i => `0x${i.data.substring(26, 66)}`) + const totalBorrowed = await api.multiCall({ calls: owners.map(pool => ({target: pool})), abi: abi.totalBorrowed, - chain, - block, }) const balances = {} if (borrowed) { balances[nullAddress] = BigNumber(0); - for (let pool of totalBorrowed.output) { - balances[nullAddress] = balances[nullAddress].plus(pool.output) + for (let pool of totalBorrowed) { + balances[nullAddress] = balances[nullAddress].plus(pool) } return balances } - await sumTokens2({ tokens: [nullAddress], owners, chain, block, balances, }) + await sumTokens2({ api, tokens: [nullAddress], owners, balances, }) return balances } -async function borrowed(_, block) { - return await getTVL(block, true) +async function borrowed(_, block, _1, { api }) { + return await getTVL(api, true) } -async function tvl(_, block) { - return await getTVL(block, false) +async function tvl(_, block, _1, { api }) { + return await getTVL(api, false) } module.exports = { diff --git a/projects/llamapay/abi.json b/projects/llamapay/abi.json index a336f3aa546..79d8b22af84 100644 --- a/projects/llamapay/abi.json +++ b/projects/llamapay/abi.json @@ -1,39 +1,7 @@ { - "getLlamaPayContractCount": { - "inputs": [], - "name": "getLlamaPayContractCount", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - "getLlamaPayContractByIndex": { - "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "name": "getLlamaPayContractByIndex", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - "token": { - "inputs": [], - "name": "token", - "outputs": [ - { "internalType": "contract IERC20", "name": "", "type": "address" } - ], - "stateMutability": "view", - "type": "function" - }, - "escrows_length": { - "stateMutability": "view", - "type": "function", - "name": "escrows_length", - "inputs": [], - "outputs": [{ "name": "", "type": "uint256" }] - }, - "escrows": { - "stateMutability": "view", - "type": "function", - "name": "escrows", - "inputs": [{ "name": "arg0", "type": "uint256" }], - "outputs": [{ "name": "", "type": "address" }] - } -} + "getLlamaPayContractCount": "uint256:getLlamaPayContractCount", + "getLlamaPayContractByIndex": "function getLlamaPayContractByIndex(uint256) view returns (address)", + "token": "address:token", + "escrows_length": "uint256:escrows_length", + "escrows": "function escrows(uint256 arg0) view returns (address)" +} \ No newline at end of file diff --git a/projects/llamapay/index.js b/projects/llamapay/index.js index 5c9926a4660..73fc74d78ae 100644 --- a/projects/llamapay/index.js +++ b/projects/llamapay/index.js @@ -10,6 +10,8 @@ const llamaPayVesting = "0xB93427b83573C8F27a08A909045c3e809610411a"; const llamaPayMeter = "0xc666badd040d5e471d2b77296fef46165ffe5132" const llamaPayMeterVesting = "0x6B24Fe659D1E91f8800E86600DE577A4cA8814a6"; const llamaPayMetis = "0x43634d1C608f16Fb0f4926c12b54124C93030600"; +const llamaPayKava = "0xCA052D073591C0C059675B6F7F95cE75a4Ab8fc8"; +const llamaPayKavaVesting = "0xB93427b83573C8F27a08A909045c3e809610411a" async function calculateTvl(llamapay, vesting, block, chain, isVesting) { let tokensAndOwners = await getTokensAndOwners(llamapay, chain, block) @@ -72,6 +74,7 @@ chains.forEach(chain => { case 'avax': contract = llamaPayAvax; break; case 'meter': contract = llamaPayMeter; vestingContract = llamaPayMeterVesting; break; case 'metis': contract = llamaPayMetis; break; + case 'kava': contract = llamaPayKava ; vestingContract = llamaPayKavaVesting; break; } module.exports[chain] = { diff --git a/projects/lobsterswap/index.js b/projects/lobsterswap/index.js new file mode 100644 index 00000000000..59d75516bb4 --- /dev/null +++ b/projects/lobsterswap/index.js @@ -0,0 +1,19 @@ +const { getUniTVL } = require('../helper/unknownTokens') +const ethers = require("ethers") +const { config } = require('@defillama/sdk/build/api'); + +config.setProvider("ozone", new ethers.providers.StaticJsonRpcProvider("https://node1.ozonechain.io", { name: "ozone", chainId: 4000, })) + +module.exports = { + misrepresentedTokens: true, + bsc: { + tvl: getUniTVL({ factory: '0xF936CDe5138282eDC6370F9f5ac70d9a1AFC6F78', useDefaultCoreAssets: true }), + }, + ozone: { + tvl: getUniTVL({ factory: '0xE6E64C926af9ABEc9D819f52c9572AB961CEF6C1', useDefaultCoreAssets: true }), + }, +} + +//https://github.com/lobster-swap +// https://app.lobsterswap.com/ +// https://twitter.com/lobster_swap diff --git a/projects/lodestar-v1/index.js b/projects/lodestar-v1/index.js new file mode 100644 index 00000000000..ca0bb507b1a --- /dev/null +++ b/projects/lodestar-v1/index.js @@ -0,0 +1,52 @@ +const sdk = require('@defillama/sdk') +const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') +const { transformBalances } = require('../helper/portedTokens') +const chain = 'arbitrum' +const controller = '0xa86dd95c210dd186fa7639f93e4177e97d057576' +const cETHER = '0x2193c45244AF12C280941281c8aa67dD08be0a64'.toLowerCase() + +async function getMarkets(block) { + let markets = await sdk.api2.abi.call({ target: controller, abi: abis.getAllMarkets, chain, block }) + markets = markets.filter(i => i.toLowerCase() !== cETHER) + + const tokens = await sdk.api2.abi.multiCall({ + abi: abis.underlying, + calls: markets, + chain, block, + }) + + markets.push(cETHER) + tokens.push(nullAddress) + return { markets, tokens } +} + +async function tvl(_, _b, { arbitrum: block }) { + const { markets, tokens } = await getMarkets(block) + const tokensAndOwners = tokens.map((t, i) => ([t, markets[i]])) + return sumTokens2({ tokensAndOwners, chain, block, }) +} + +async function borrowed(_, _b, { arbitrum: block }) { + const { markets, tokens } = await getMarkets(block) + const balances = {} + const borrows = await sdk.api2.abi.multiCall({ + abi: abis.totalBorrows, + calls: markets, + chain, block, + }) + borrows.forEach((a, i) => sdk.util.sumSingleBalance(balances, tokens[i], a)) + return transformBalances(chain, balances) +} + +module.exports = { + arbitrum: { + tvl, + borrowed, + } +}; + +const abis = { + getAllMarkets: "address[]:getAllMarkets", + underlying: "address:underlying", + totalBorrows: "uint256:totalBorrows", +} \ No newline at end of file diff --git a/projects/lodestar/index.js b/projects/lodestar/index.js new file mode 100644 index 00000000000..d37c825cbfc --- /dev/null +++ b/projects/lodestar/index.js @@ -0,0 +1,55 @@ +const sdk = require('@defillama/sdk') +const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') +const { transformBalances } = require('../helper/portedTokens') +const chain = 'arbitrum' +const controller = '0x92a62f8c4750D7FbDf9ee1dB268D18169235117B' +const cETHER = '0x7A472988bD094a09f045120e78Bb0cEa44558b52'.toLowerCase() + +async function getMarkets(block) { + let markets = await sdk.api2.abi.call({ target: controller, abi: abis.getAllMarkets, chain, block }) + markets = markets.filter(i => i.toLowerCase() !== cETHER) + + const tokens = await sdk.api2.abi.multiCall({ + abi: abis.underlying, + calls: markets, + chain, block, + }) + + markets.push(cETHER) + tokens.push(nullAddress) + return { markets, tokens } +} + +async function tvl(_, _b, { arbitrum: block }) { + const { markets, tokens } = await getMarkets(block) + const tokensAndOwners = tokens.map((t, i) => ([t, markets[i]])) + return sumTokens2({ tokensAndOwners, chain, block, }) +} + +async function borrowed(_, _b, { arbitrum: block }) { + const { markets, tokens } = await getMarkets(block) + const balances = {} + const borrows = await sdk.api2.abi.multiCall({ + abi: abis.totalBorrows, + calls: markets, + chain, block, + }) + borrows.forEach((a, i) => sdk.util.sumSingleBalance(balances, tokens[i], a)) + return transformBalances(chain, balances) +} + +module.exports = { + hallmarks: [ + [1670630400, "pvlGLP collateral exploit"] + ], + arbitrum: { + tvl, + borrowed, + } +}; + +const abis = { + getAllMarkets: "address[]:getAllMarkets", + underlying: "address:underlying", + totalBorrows: "uint256:totalBorrows", +} \ No newline at end of file diff --git a/projects/lofty/index.js b/projects/lofty/index.js index ef3d0139614..c3597c946f8 100644 --- a/projects/lofty/index.js +++ b/projects/lofty/index.js @@ -1,14 +1,15 @@ const { toUSDTBalances } = require('../helper/balances'); +const { getEnv } = require('../helper/env'); const axios = require("axios"); -const LoftyTVLApi = "https://api.lofty.ai/prod/properties/v2/valuations"; +const LoftyTVLApi = "https://partners.lofty.ai/properties/v2/valuations"; async function loftyTVL() { const response = ( await axios.get(LoftyTVLApi, { headers: { - 'X-API-Client': 'DEFILLAMA' + 'X-API-Key': getEnv('LOFTY_API') } }) ).data.data; @@ -22,6 +23,8 @@ async function loftyTVL() { } module.exports = { + timetravel: false, + misrepresentedTokens: true, algorand: { tvl: loftyTVL, } diff --git a/projects/logium/index.js b/projects/logium/index.js index 906a8a7d48a..de8afe83216 100644 --- a/projects/logium/index.js +++ b/projects/logium/index.js @@ -1,42 +1,24 @@ +const ADDRESSES = require('../helper/coreAssets.json') -const { getBlock } = require('../helper/getBlock') -const { providers } = require('@defillama/sdk/build/general'); +const { getBlock } = require('../helper/http') +const sdk = require('@defillama/sdk') const { Contract } = require('ethers') const { sumTokens2 } = require('../helper/unwrapLPs') -const USDC = '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48' +const USDC = ADDRESSES.ethereum.USDC const LOGIUM_CORE = '0xc61d1dcceeec03c94d729d8f8344ce3be75d09fe' const ONE_DAY = 24 * 60 * 60 -const usdcABI = [{ - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" -}] +const usdcABI = 'event Transfer(address indexed from, address indexed to, uint256 value)' + +function getProvider(network) { + const chainApi = new sdk.ChainApi(network) + return chainApi.provider +} async function tvl(ts, block) { const fromBlock = await getBlock(ts - (31 * ONE_DAY), 'ethereum', {}, false) //33 days ago - const usdcContract = new Contract(USDC, usdcABI, providers.ethereum) + const usdcContract = new Contract(USDC, [usdcABI], getProvider('ethereum')) const eventFilter = usdcContract.filters.Transfer(LOGIUM_CORE); const events = await usdcContract.queryFilter(eventFilter, fromBlock, block); const owners = [LOGIUM_CORE] diff --git a/projects/loop-finance/index.js b/projects/loop-finance/index.js index 1fc132e1918..d3c7e7d6ba1 100644 --- a/projects/loop-finance/index.js +++ b/projects/loop-finance/index.js @@ -1,105 +1,52 @@ const sdk = require("@defillama/sdk"); -const { fetchURL } = require('../helper/utils') -const { getBalance, getDenomBalance } = require("../helper/chain/terra"); - -async function getPairs() { - const factory00 = (await fetchURL( - queries.baseUrl + queries.factory0 + queries.query30 - )).data.result.pairs; - const factory01 = (await fetchURL( - queries.baseUrl + queries.factory0 + queries.factory0query60 - )).data.result.pairs; - const factory10 = (await fetchURL( - queries.baseUrl + queries.factory1 + queries.query30 - )).data.result.pairs; - - if (factory01.length > 29 || factory10.length > 29) { - throw new Error(`We need another query since they're capped at 30 results and pools may be missing`); - }; - - return factory00.concat(factory01, factory10); -}; - -const tokenMapping = { - "terra17wkadg0tah554r35x6wvff0y5s7ve8npcjfuhz": "prism-yluna", - "terra1hzh9vpxhsk8253se0vv5jj6etdvxu3nv8z07zu": "anchorust", - "terra1kcthelkax4j9x8d3ny6sdag0qmxxynl3qtcrpy": "pylon-protocol", - "terra1nef5jf6c7js9x6gkntlehgywvjlpytm7pcgkn4": "loop-token", - "terra1tlgelulz9pdkhls6uglfn5lmxarx7f2gxtdzh2": "prism-pluna", - "terra1w8kvd6cqpsthupsk4l0clwnmek4l3zr7c84kwq": "angel-protocol", - "terra1xfsdgcemqwxp4hhnyk4rle6wr22sseq7j07dnn": "kujira", - "uusd": "terrausd", - "uluna": "terra-luna", - // waiting on team for these IBC token tickers - "ibc/0471F1C4E7AFD3F07702BEF6DC365268D64570F7C1FDC98EA6098DD6DE59817B": "undefined", - "ibc/18ABA66B791918D51D33415DA173632735D830E2E77E63C91C11D3008CFD5262": "undefined", - "ibc/EB2CED20AB0466F18BE49285E56B31306D4C60438A022EA995BA65D5E3CF7E09": "undefined", -}; +const { queryContract, getTokenBalance, getToken, } = require("../helper/chain/cosmos"); +const { transformDexBalances } = require('../helper/portedTokens') + +async function getPairs(chain, factory) { + let data = { pairs: { limit: 30 } } + let pairs = [] + let res + do { + if (pairs.length) { + const lastItem = pairs[pairs.length - 1] + data.pairs.start_after = lastItem.asset_infos + } + res = await queryContract({ data, contract: factory, chain }) + pairs.push(...res.pairs) + } while (res.pairs.length >= 30) + return pairs +} const queries = { - "baseUrl": 'https://fcd.terra.dev/wasm/contracts/', - "factory0": 'terra16hdjuvghcumu6prg22cdjl96ptuay6r0hc6yns', - "factory1": 'terra10fp5e9m5avthm76z2ujgje2atw6nc87pwdwtww', - "query30": '/store?query_msg=%7B%22pairs%22:%7B%22limit%22:30%7D%7D', - "factory0query60": '/store?query_msg=%7B%22pairs%22:%7B%22start_after%22:[%7B%22token%22:%7B%22contract_addr%22:%22terra1mj4rkdr2l5cvse8089z45mlp5dxx0hrjy5ts94%22%7D%7D,%7B%22native_token%22:%7B%22denom%22:%22uusd%22%7D%7D],%22limit%22:30%7D%7D' -}; - -async function isDenom(balances, pair, block, index) { - if (pair.asset_infos[index].native_token) { - if (!tokenMapping[pair.asset_infos[index].native_token.denom]) { - throw new Error(`no mapping for token ${pair.asset_infos[index].native_token.denom}`); - }; - - sdk.util.sumSingleBalance( - balances, - tokenMapping[pair.asset_infos[index].native_token.denom], - 2 * (await getDenomBalance( - pair.asset_infos[index].native_token.denom, - pair.contract_addr, - block - )) / 10 ** 6 - ); - - return true; - }; -}; - -async function isToken(balances, pair, block, index) { - if (tokenMapping[pair.asset_infos[index].token.contract_addr]) { - if (!tokenMapping[pair.asset_infos[index].token.contract_addr]) { - throw new Error(`no mapping for token ${pair.asset_infos[index].token.contract_addr}`); - }; - - sdk.util.sumSingleBalance( - balances, - tokenMapping[pair.asset_infos[index].token.contract_addr], - 2 * (await getBalance( - pair.asset_infos[index].token.contract_addr, - pair.contract_addr, - block - )) / 10 ** 6 - ); - - return true; - }; -}; - -async function tvl(timestamp, _, {terra: block}) { - const balances = {}; - const pairs = await getPairs(); - for (let pair of pairs) { - (await isDenom(balances, pair, block, 0)) || (await isDenom(balances, pair, block, 1)) || - (await isToken(balances, pair, block, 0)) || (await isToken(balances, pair, block, 1)) - }; - return balances; -}; + "factory0": 'terra16hdjuvghcumu6prg22cdjl96ptuay6r0hc6yns', + "factory1": 'terra10fp5e9m5avthm76z2ujgje2atw6nc87pwdwtww', +} + +function getFactoryTvl(factory) { + return async function tvl(timestamp, _, { terra: block }, { api }) { + const chain = api.chain + const pairs = await getPairs(chain, factory) + sdk.log(chain, factory, pairs.length) + const token0s = pairs.map(i => i.asset_infos[0]).map(getToken) + const token1s = pairs.map(i => i.asset_infos[1]).map(getToken) + const token0Bals = await Promise.all(pairs.map(i => getTokenBalance({ chain, owner: i.contract_addr, token: i.asset_infos[0] }))) + const token1Bals = await Promise.all(pairs.map(i => getTokenBalance({ chain, owner: i.contract_addr, token: i.asset_infos[1] }))) + const data = pairs.map((_, i) => ({ + token0: token0s[i], + token1: token1s[i], + token0Bal: token0Bals[i], + token1Bal: token1Bals[i], + })) + return transformDexBalances({ chain, data, }) + } +} module.exports = { - timetravel: false, - terra: { - tvl - }, - hallmarks:[ + misrepresentedTokens: true, + timetravel: false, + terra: { tvl: sdk.util.sumChainTvls([getFactoryTvl(queries.factory0), getFactoryTvl(queries.factory1)]) }, + juno: { tvl: getFactoryTvl('juno1p4dmvjtdf3qw9394k7zl65eg8g5ehzvdxnvm9hd3ju7a7aslrmdqaspeak') }, + hallmarks: [ [1651881600, "UST depeg"], - ] + ] }; diff --git a/projects/loopring/index.js b/projects/loopring/index.js index fd3944b1fc7..f7512b56f0d 100644 --- a/projects/loopring/index.js +++ b/projects/loopring/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') /*================================================== Modules ==================================================*/ @@ -15,12 +16,12 @@ const listedTokens = [ '0xBBbbCA6A901c926F240b89EacB641d8Aec7AEafD', // LRC - '0xdac17f958d2ee523a2206206994597c13d831ec7', // USDT - '0x6B175474E89094C44Da98b954EedeAC495271d0F', // DAI - '0x514910771AF9Ca656af840dff83E8264EcF986CA', // LINK - '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', // USDC - '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599', // WBTC - '0x9f8F72aA9304c8B593d555F12eF6589cC3A579A2', // MKR + ADDRESSES.ethereum.USDT, // USDT + ADDRESSES.ethereum.DAI, // DAI + ADDRESSES.ethereum.LINK, // LINK + ADDRESSES.ethereum.USDC, // USDC + ADDRESSES.ethereum.WBTC, // WBTC + ADDRESSES.ethereum.MKR, // MKR ]; /*================================================== @@ -33,7 +34,7 @@ let ethBlanaceTotal = BigNumber(ethBalanceOld.output || 0).plus(ethBalanceNew.output); let balances = { - '0x0000000000000000000000000000000000000000': ethBlanaceTotal + [ADDRESSES.null]: ethBlanaceTotal }; let calls = []; diff --git a/projects/loterra/index.js b/projects/loterra/index.js index d8cf75df67a..948783eb17e 100644 --- a/projects/loterra/index.js +++ b/projects/loterra/index.js @@ -1,36 +1,8 @@ -const { sumSingleBalance, TOKEN_LIST, getBalance, } = require('../helper/chain/terra') - -// Source: https://docs.loterra.io/resources/contract-addresses -const contracts = { - multiSig: 'terra1s4twvkqy0eel5saah64wxezpckm7v9535jjshy', - dogether: 'terra19h4xk8xxxew0ne6fuw0mvuf7ltmjmxjxssj5ts' -} - -async function tvl(timestamp, ethBlock, { terra: block }) { - const balances = {} - - // Add aUST tokens in the multi-sig - const aUSTBalance = await getBalance(TOKEN_LIST.anchorust, contracts.dogether, block) - sumSingleBalance(balances, TOKEN_LIST.anchorust, aUSTBalance) - - return balances -} - -async function treasury(timestamp, ethBlock, { terra: block }) { - const balances = {} - - // Add aUST tokens in the multi-sig - const aUSTBalance = await getBalance(TOKEN_LIST.anchorust, contracts.multiSig, block) - sumSingleBalance(balances, TOKEN_LIST.anchorust, aUSTBalance) - - return balances -} module.exports = { methodology: 'TVL counts the UST that is available as a prize on the protocol.', terra: { - tvl, - treasury, + tvl: () => ({}), }, timetravel: false, hallmarks:[ diff --git a/projects/louverture/abi.json b/projects/louverture/abi.json index 1497c70f0cc..c8a97cf1638 100644 --- a/projects/louverture/abi.json +++ b/projects/louverture/abi.json @@ -1,15 +1,3 @@ { - "totalNodeValue": { - "inputs": [], - "name": "totalNodeValue", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } + "totalNodeValue": "uint256:totalNodeValue" } \ No newline at end of file diff --git a/projects/lsdx/index.js b/projects/lsdx/index.js new file mode 100644 index 00000000000..1bf4d30a4bb --- /dev/null +++ b/projects/lsdx/index.js @@ -0,0 +1,33 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { staking } = require("../helper/staking"); +const { sumTokens2, nullAddress } = require("../helper/unwrapLPs"); +const FACTORY_CONTRACT = "0x3B4b6B14d07A645005658E6Ea697edb0BD7bf2b1"; + +const ETHx = '0x21ead867c8c5181854f6f8ce71f75b173d2bc16a' +const LSD = '0xfac77a24e52b463ba9857d6b758ba41ae20e31ff' +const LSD_LPs = ['0x3322f41dfa379B6D3050C1e271B0b435b3Ee3303', '0x3ab2ebbe52f4a80098a461cf9ecdade2ed645fc4'] +const abis = { + "getStakingTokens": "function getStakingTokens() view returns (address[])", + "getStakingPoolAddress": "function getStakingPoolAddress(address) view returns (address)", +} + +async function tvl(_, _1, _2, { api }) { + const tokens = await api.call({ abi: abis.getStakingTokens, target: FACTORY_CONTRACT, }) + const owners = await api.multiCall({ abi: abis.getStakingPoolAddress, target: FACTORY_CONTRACT, calls: tokens }) + tokens.forEach((v, i) => { + if (v === nullAddress) { + tokens.push(ADDRESSES.ethereum.WETH) + owners.push(owners[i]) + } + }) + return sumTokens2({ api, tokensAndOwners2: [tokens, owners], blacklistedTokens: [...LSD_LPs, ETHx, LSD] }) +} + +module.exports = { + start: 16831303, + ethereum: { + tvl, + pool2: staking(['0x1D31755E03119311c7F00ae107874dddEC7573f3', '0xE05630Da82604591F002b61F7116429CfDC4B542'], LSD_LPs), + staking: staking(['0xcA73C2aBA8EECb37EA1648999A7b08787b808ee2'], ETHx), + } +}; diff --git a/projects/luchadores/index.js b/projects/luchadores/index.js index 2bf235ba1b0..db8609511e0 100644 --- a/projects/luchadores/index.js +++ b/projects/luchadores/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { staking } = require('../helper/staking'); const { pool2s } = require('../helper/pool2'); const {sumTokensAndLPsSharedOwners} = require('../helper/unwrapLPs'); @@ -10,6 +11,8 @@ const rewardPool = "0x72104d619BaEDf632936d9dcE38C089CA3bf12Dc"; // LPs const LUCHA_MATIC_comethLp = "0x5e1cd1b923674e99df95ce0f910dcf5a58a3ca2d"; const LUCHA_MUST_comethLp = "0x98503d87aa4e9c84ff5d2e558295a0967fbbbeff"; +const LUCHA_MATIC_satinLp = "0x989e0df932e742ac52f82f5da1b0b70bdce3ed5f"; +const LUCHA_CASH_satinLp = "0x55f70935f4e8dd194bc2d56fb1c4d25db599cbc5"; // staking const luchaStk = "0xC5E9E8574c27747B4D537ef94e2448a3A0525dF4"; @@ -18,32 +21,31 @@ const luchaMustStk = "0xe11f861dD5cE8407bb24dFD13b9710c0295276D6"; // ERC20 const LUCHA_polygon = "0x6749441Fdc8650b5b5a854ed255C82EF361f1596"; -const MATIC_polygon = "0x0000000000000000000000000000000000001010"; +const MATIC_polygon = ADDRESSES.polygon.WMATIC_1; const QI_polygon = "0x580A84C73811E1839F75d86d75d88cCa0c241fF4"; const MUST_polygon = "0x9C78EE466D6Cb57A4d01Fd887D2b5dFb2D46288f"; const PSP_polygon = "0x42d61D766B85431666B39B89C43011f24451bFf6"; const LINK_polygon = "0x53e0bca35ec356bd5dddfebbd1fc0fd03fabad39"; -const WETH_polygon = "0x7ceb23fd6bc0add59e62ac25578270cff1b9f619"; -const VQI_polygon = "0xB424dfDf817FaF38FF7acF6F2eFd2f2a843d1ACA"; -const GHST_polygon = "0x385eeac5cb85a38a9a07a70c73e0a3271cfb54a7"; -const RAIDER_polygon = "0xcd7361ac3307d1c5a46b63086a90742ff44c63b3"; -const AURUM_polygon = "0x34d4ab47bee066f361fa52d792e69ac7bd05ee23"; +const WETH_polygon = ADDRESSES.polygon.WETH_1; +const WMATIC_LUCHA_Balancer_polygon = "0x924EC7ed38080E40396c46F6206A6d77D0B9f72d"; async function tvl(time, ethBlock, chainBlocks){ const balances = {}; const transform = await transformPolygonAddress(); await sumTokensAndLPsSharedOwners(balances, [ + // [LUCHA_polygon, false], [MATIC_polygon, false], [QI_polygon, false], [MUST_polygon, false], [PSP_polygon, false], - [VQI_polygon, false], [LINK_polygon, false], [WETH_polygon, false], - [GHST_polygon, false], - [RAIDER_polygon, false], - [AURUM_polygon, false], - ], [treasury, luchaStk, rewardPool, luchaMaticStk, luchaMustStk], chainBlocks.polygon, "polygon", transform); + [WMATIC_LUCHA_Balancer_polygon, false], + [LUCHA_MATIC_comethLp, true], + [LUCHA_MUST_comethLp, true], + [LUCHA_MATIC_satinLp, true], + [LUCHA_CASH_satinLp, true] + ], [treasury, luchaStk, rewardPool, luchaMaticStk, luchaMustStk, LUCHA_MATIC_satinLp, LUCHA_CASH_satinLp], chainBlocks.polygon, "polygon", transform); return balances; } @@ -52,7 +54,7 @@ module.exports={ polygon:{ tvl, staking: staking(luchaStk, LUCHA_polygon, "polygon"), - pool2: pool2s([luchaMaticStk, luchaMustStk], [LUCHA_MATIC_comethLp, LUCHA_MUST_comethLp], "polygon") + pool2: pool2s([luchaMaticStk, luchaMustStk], [LUCHA_MATIC_comethLp, LUCHA_MUST_comethLp, LUCHA_MATIC_satinLp, LUCHA_CASH_satinLp], "polygon") }, methodology: `- Staking : Players can stake their $LUCHA to earn $MASK and access in-game services or equipment.\r - Treasury : 100% of the funds collected during the first raffle (purchase of wearable) have been kept in treasury to build a long term economic strategy. Luchadores.io own 60% of LP token to improve liquidity and facilitate user swaps.\r diff --git a/projects/luckychip/index.js b/projects/luckychip/index.js index 6f56b90ebdb..249858c4a6a 100644 --- a/projects/luckychip/index.js +++ b/projects/luckychip/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens } = require('../helper/unwrapLPs') const sdk = require('@defillama/sdk') const { transformBscAddress } = require('../helper/portedTokens'); @@ -12,14 +13,14 @@ const tokenHolderMap = [ checkETHBalance: true, }, { - tokens: '0x55d398326f99059fF775485246999027B3197955', // USDT + tokens: ADDRESSES.bsc.USDT, // USDT holders: [ "0x682ce0e340A0248B4554E14e834969F2E421dB2D" // USDT table ], } ] -const WBNB = "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c" +const WBNB = ADDRESSES.bsc.WBNB function normalizeArray(arrayOrString){ if(Array.isArray(arrayOrString)){ diff --git a/projects/luminous/index.js b/projects/luminous/index.js index 9a4ba3786dc..a9e75a125a4 100644 --- a/projects/luminous/index.js +++ b/projects/luminous/index.js @@ -1,8 +1,6 @@ -const { - getTokenBalance, - getTrxBalance, - unverifiedCall, -} = require("../helper/chain/tron") +const sdk = require('@defillama/sdk') +const { sumTokensExport } = require('../helper/unwrapLPs') +const { nullAddress } = require("../helper/tokenMapping"); const stakingWaterContract = "THyHbFrG5wnxdp9Lv7AgwJ4k7Nt1dp2pzj"; const WATER = "TFMUZn349bztRCCkL2PAmkWfy23Gyn5g5r"; @@ -10,13 +8,6 @@ const WATER = "TFMUZn349bztRCCkL2PAmkWfy23Gyn5g5r"; const stakingLumiContract = "TZD4xS3AFUixUwE28omTjeepCF6qUuxjCh"; const LUMI = "TDBNKiYQ8yfJtT5MDP3byu7f1npJuG2DBN"; -async function Staking() { - return { - water: await getTokenBalance(WATER, stakingWaterContract), - "lumi-credits": await getTokenBalance(LUMI, stakingLumiContract), - }; -} - const lumiFarm = "TJ6cgPpkri8cfrEh79TLdU2S16ugKHwAcW"; const waterLpToken = "TWH6NQ9tr28YoRdKuvcuQquVoEGrscPix4"; @@ -24,39 +15,46 @@ const waterFarm = "TY9mGUA8q1V9R9kmfUERpcG62SZ42gYuHW"; const lumiLpToken = "TUhZUbJaVicbQeNXHGBKxVsVuNL94usuoU"; async function Pool2() { + const { api } = arguments[3] + const [ waterLpTokenAmount, lumiLpTokenAmount, waterInLp, lumiInLp, - trxInWaterLp, - trxInLumiLp, waterLpTotalSupply, lumiLpTotalSupply, + ] = await api.batchCall([ + { abi: 'erc20:balanceOf', target: waterLpToken, params: lumiFarm }, + { abi: 'erc20:balanceOf', target: lumiLpToken, params: waterFarm }, + { abi: 'erc20:balanceOf', target: WATER, params: waterLpToken }, + { abi: 'erc20:balanceOf', target: LUMI, params: lumiLpToken }, + { abi: 'erc20:totalSupply', target: waterLpToken, }, + { abi: 'erc20:totalSupply', target: lumiLpToken, }, + ]) + + const [ + { output: trxInWaterLp}, + { output: trxInLumiLp}, ] = await Promise.all([ - getTokenBalance(waterLpToken, lumiFarm), - getTokenBalance(lumiLpToken, waterFarm), - getTokenBalance(WATER, waterLpToken), - getTokenBalance(LUMI, lumiLpToken), - getTrxBalance(waterLpToken), - getTrxBalance(lumiLpToken), - unverifiedCall(waterLpToken, "totalSupply()", []), - unverifiedCall(lumiLpToken, "totalSupply()", []), + sdk.api.eth.getBalance({ target: waterLpToken, chain: 'tron'}), + sdk.api.eth.getBalance({ target: lumiLpToken, chain: 'tron'}), ]); - return { - water: (waterInLp * waterLpTokenAmount) / (waterLpTotalSupply / 10 ** 6), - tron: - (trxInWaterLp * waterLpTokenAmount) / waterLpTotalSupply + - (trxInLumiLp * lumiLpTokenAmount) / lumiLpTotalSupply, - "lumi-credits": - (lumiInLp * lumiLpTokenAmount) / (lumiLpTotalSupply / 10 ** 6), - }; + api.add(WATER, (waterInLp * waterLpTokenAmount) / waterLpTotalSupply) + api.add(LUMI, (lumiInLp * lumiLpTokenAmount) / lumiLpTotalSupply) + api.add(nullAddress, (trxInWaterLp * waterLpTokenAmount) / waterLpTotalSupply) + api.add(nullAddress, (trxInLumiLp * lumiLpTokenAmount) / waterLpTotalSupply) } module.exports = { tron: { - staking: Staking, + staking: sumTokensExport({ + tokensAndOwners: [ + [WATER, stakingWaterContract], + [LUMI, stakingLumiContract], + ] + }), pool2: Pool2, tvl: (async) => ({}), }, diff --git a/projects/lunafi/index.js b/projects/lunafi/index.js new file mode 100644 index 00000000000..46a1a5b2399 --- /dev/null +++ b/projects/lunafi/index.js @@ -0,0 +1,18 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { staking } = require('../helper/staking'); +const { pool2 } = require('../helper/pool2'); +const { sumTokensExport } = require('../helper/unwrapLPs'); + +module.exports = { + polygon: { + tvl: sumTokensExport({ + tokensAndOwners: [ + [ADDRESSES.polygon.WBTC, '0x1311DCADf3330dD0AEB4d03177F9568880Febb34'], + [ADDRESSES.polygon.WETH_1, '0x2Bb91032F277BDc0DA7De271Ba03B3341B73b4c1'], + [ADDRESSES.polygon.USDC, '0x14e849B39CA7De7197763b6254EE57eDBE0F3375'], + ] + }), + pool2: pool2('0x4175acd3d7f128cf41d42826cce2185a5ade7c82', ['0x72CF5ee9ee918a529b25BBcB0372594008178535', '0xE3108CDCfb18E7B3e558b37bfD4473CBDE1Fd05c']), + staking: staking('0xfc604b6fD73a1bc60d31be111F798dd0D4137812', '0x77d97db5615dfe8a2d16b38eaa3f8f34524a0a74'), + } +}; \ No newline at end of file diff --git a/projects/lunggens-dex/index.js b/projects/lunggens-dex/index.js new file mode 100644 index 00000000000..78c32dd6e83 --- /dev/null +++ b/projects/lunggens-dex/index.js @@ -0,0 +1,2 @@ +const { uniTvlExport } = require('../helper/unknownTokens') +module.exports = uniTvlExport('lung', '0x78725F781C861938Ff11aCedcB0D69Da7Ae4581B') \ No newline at end of file diff --git a/projects/lusd-chickenbonds/getTreasury.abi.json b/projects/lusd-chickenbonds/getTreasury.abi.json deleted file mode 100644 index 4be2b2f3dd4..00000000000 --- a/projects/lusd-chickenbonds/getTreasury.abi.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "inputs":[], - "name":"getTreasury", - "outputs":[ - { - "internalType":"uint256", - "name":"_pendingLUSD", - "type":"uint256" - }, - { - "internalType":"uint256", - "name":"_totalAcquiredLUSD", - "type":"uint256" - }, - { - "internalType":"uint256", - "name":"_permanentLUSD", - "type":"uint256" - } - ], - "stateMutability":"view", - "type":"function" -} diff --git a/projects/lusd-chickenbonds/index.js b/projects/lusd-chickenbonds/index.js index 3961966369e..abd8486671f 100644 --- a/projects/lusd-chickenbonds/index.js +++ b/projects/lusd-chickenbonds/index.js @@ -1,14 +1,14 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk'); const BigNumber = require("bignumber.js"); -const getTreasuryAbi = require("./getTreasury.abi.json"); const CHICKEN_BOND_MANAGER_CONTRACT = '0x57619FE9C539f890b19c61812226F9703ce37137'; -const LUSD_ADDRESS = '0x5f98805A4E8be255a32880FDeC7F6728C6568bA0'; +const LUSD_ADDRESS = ADDRESSES.ethereum.LUSD; async function tvl(_, block) { const bucketAmounts = (await sdk.api.abi.call({ target: CHICKEN_BOND_MANAGER_CONTRACT, - abi: getTreasuryAbi, + abi: 'function getTreasury() view returns (uint256 _pendingLUSD, uint256 _totalAcquiredLUSD, uint256 _permanentLUSD)', chain: "ethereum", block, })).output; diff --git a/projects/luxor/api.js b/projects/luxor/api.js new file mode 100644 index 00000000000..1a05bc80e7a --- /dev/null +++ b/projects/luxor/api.js @@ -0,0 +1,8 @@ +const index = require('./index') + +module.exports = { + fantom: { + tvl: () => 0, + staking: index.fantom.staking, + } +} \ No newline at end of file diff --git a/projects/luxor/index.js b/projects/luxor/index.js index b79b84bb74b..4a73eb027c4 100644 --- a/projects/luxor/index.js +++ b/projects/luxor/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { ohmTvl } = require("../helper/ohm"); const treasury = "0xDF2A28Cc2878422354A93fEb05B41Bd57d71DB24" @@ -6,8 +7,8 @@ const LUX = "0x6671e20b83ba463f270c8c75dae57e3cc246cb2b" module.exports=ohmTvl( treasury, [ - ["0x8d11ec38a3eb5e956b052f67da8bdc9bef8abf3e", false], - ["0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83", false], + [ADDRESSES.fantom.DAI, false], + [ADDRESSES.fantom.WFTM, false], ["0x46729c2AeeabE7774a0E710867df80a6E19Ef851", true], ["0x951BBB838e49F7081072895947735b0892cCcbCD", true] ], @@ -15,8 +16,8 @@ module.exports=ohmTvl( "0xf3F0BCFd430085e198466cdCA4Db8C2Af47f0802", LUX, (addr) => { - if (addr.toLowerCase() === "0x8d11ec38a3eb5e956b052f67da8bdc9bef8abf3e") { - return "0x6b175474e89094c44da98b954eedeac495271d0f"; + if (addr.toLowerCase() === ADDRESSES.fantom.DAI) { + return ADDRESSES.ethereum.DAI; } return `fantom:${addr}`; } diff --git a/projects/luxs.fi/index.js b/projects/luxs.fi/index.js new file mode 100755 index 00000000000..4647fc18d66 --- /dev/null +++ b/projects/luxs.fi/index.js @@ -0,0 +1,52 @@ +const sdk = require("@defillama/sdk"); + +const facades = { + polygon: "0x0708542D895C2559001Fa9e4Bc49C3343735e6e2", + arbitrum: "0xE75254f298a5145438595Aa9d6D4327fCD14418D", + bsc: "0xD187937762c6fd4d7a58C71fD810CbfE22E64a84", + optimism: "0x285cAee14514f30bB178FB56c985e43A47d68E75", +}; + +async function tvl(_, _b, _cb, { api }) { + const vaults = await api.call({ + abi: " function getVaults() external view returns (address[] memory) ", + target: facades[api.chain], + }); + + const balances = {}; + const tokens = await api.multiCall({ + abi: "address:token", + calls: vaults, + }); + + const totalBalance = await api.multiCall({ + abi: "function getVaultValueLocked(address _vault) external view returns (uint256)", + calls: vaults.map((address) => ({ + target: facades[api.chain], + params: [address], + })), + chain: api.chain, + }); + + tokens.forEach((t, i) => + sdk.util.sumSingleBalance(balances, t, totalBalance[i], api.chain) + ); + return balances; +} + +module.exports = { + misrepresentedTokens: true, + arbitrum: { + tvl: tvl, + }, + optimism: { + tvl: tvl, + }, + polygon: { + tvl: tvl, + }, + bsc: { + tvl: tvl, + }, + methodology: "TVL is counted from the LuxsFi vaults contracts", +}; \ No newline at end of file diff --git a/projects/lybra/index.js b/projects/lybra/index.js new file mode 100644 index 00000000000..848b7bf64d0 --- /dev/null +++ b/projects/lybra/index.js @@ -0,0 +1,12 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require("../helper/unwrapLPs"); + +// Lybra holds total stake collateral (deposited ETH) +const LYBRA_CONTRACT = "0x97de57eC338AB5d51557DA3434828C5DbFaDA371"; + +module.exports = { + start: 1682265600, + ethereum: { + tvl: sumTokensExport({ owner: LYBRA_CONTRACT, tokens: [ADDRESSES.ethereum.STETH]}), + } +}; diff --git a/projects/lydia/index.js b/projects/lydia/index.js index ecfbe8349da..572dc293017 100644 --- a/projects/lydia/index.js +++ b/projects/lydia/index.js @@ -3,6 +3,6 @@ const { getUniTVL } = require('../helper/unknownTokens') module.exports = { misrepresentedTokens: true, avax:{ - tvl: getUniTVL({ chain: 'avax', factory: '0xe0C1bb6DF4851feEEdc3E14Bd509FEAF428f7655', }) + tvl: getUniTVL({ misrepresentedTokens: true, factory: '0xe0C1bb6DF4851feEEdc3E14Bd509FEAF428f7655', blacklistedTokens: ['0xc1a49c0b9c10f35850bd8e15eaef0346be63e002']}) }, } diff --git a/projects/lympo/index.js b/projects/lympo/index.js index 5507e54dc86..91a560aa09f 100644 --- a/projects/lympo/index.js +++ b/projects/lympo/index.js @@ -1,11 +1,12 @@ -const { get } = require('../helper/http') +const { getConfig } = require('../helper/cache') + const { sumTokens2 } = require('../helper/unwrapLPs') const poolsUrl = 'https://api.lympo.io/pools/poolsV2/pools.json'; const sportTokenAddress = "0x503836c8c3A453c57f58CC99B070F2E78Ec14fC0" async function staking(timestamp, _, { polygon: block }) { - const pools = await get(poolsUrl) + const pools = await getConfig('lympo', poolsUrl) const owners = pools.map(i => i.address) return sumTokens2({ chain: 'polygon', block, owners, tokens: [sportTokenAddress]}) } diff --git a/projects/lyra/index.js b/projects/lyra/index.js index 0d174b3019b..954e559f998 100644 --- a/projects/lyra/index.js +++ b/projects/lyra/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { staking } = require('../helper/staking') const { sumTokens } = require('../helper/unwrapLPs') @@ -25,42 +26,80 @@ const v1_2_ShortCollateral = [ '0xa5ce396616c7D14F61B5B9bbA3A57388Db885b2E' ] -const pools = [...new Set([...v1_0_Pools, ...v1_1_LiquidityPool, ...v1_1_ShortCollateral, ...v1_2_LiquidityPool, ...v1_2_ShortCollateral].map(t=>t.toLowerCase()))] +const v1_3_arb_ShortCollateral = [ + '0xef4a92fcde48c84ef2b5c4a141a4cd1988fc73a9', //WETH + '0x5a4842c0c1f81ebbae7bb3ec07edf7ae55aac631', //WBTC + ] +const v1_3_arb_LiquidityPool = [ + '0xb619913921356904bf62aba7271e694fd95aa10d', //WETH + '0xec6f3ef9481e7b8484290edbae2cedcdb0ce790e', //WBTC + ] + +const v2_op_ShortCollateral = [ + '0x8512028339bb67aee47c06a298031d91bb7d15ba', //WETH + '0xa95c6d6a2765627a854960e9ee96f607b857385a', //WBTC + '0x292a5929bd150d28eda3c17d9b7c754968b2899d', //OP + '0xa49f2ea43b445f9a2467b7279cfa1f6a0c2e3f4f', //ARB + ] +const v2_op_LiquidityPool = [ + '0xb8e90fd247700de65450aacd4a47b2948dc59fc1', //WETH + '0xacacff03241256304e841e89c13319eae09f14b3', //WBTC + '0x12a4fd54aa321eb16b45310ccb177bd87c6ae447', //OP + '0xdd0d125475453767e65f1a4dd30b62699fdcc9f5', //ARB + ] + +const op_pools = [...new Set([...v1_0_Pools, ...v1_1_LiquidityPool, ...v1_1_ShortCollateral, ...v1_2_LiquidityPool, ...v1_2_ShortCollateral, ...v2_op_ShortCollateral, ...v2_op_LiquidityPool].map(t=>t.toLowerCase()))] + +const arb_pools = [...new Set([...v1_3_arb_ShortCollateral, ...v1_3_arb_LiquidityPool].map(t=>t.toLowerCase()))] -const tokens = ['0x8c6f28f2f1a3c87f0f938b96d27520d9751ec8d9', '0xe405de8f52ba7559f9df3c368500b6e6ae6cee49', - '0xc5db22719a06418028a40a9b5e9a7c02959d0d08', '0x298b9b95708152ff6968aafd889c6586e9169f1d'] +const op_tokens = [ADDRESSES.optimism.sUSD, ADDRESSES.optimism.sETH, + '0xc5db22719a06418028a40a9b5e9a7c02959d0d08', '0x298b9b95708152ff6968aafd889c6586e9169f1d', + ADDRESSES.optimism.OP, '0x68f180fcce6836688e9084f035309e29bf0a2095', + ADDRESSES.optimism.WETH, ADDRESSES.optimism.USDC] + +const arb_tokens = [ADDRESSES.arbitrum.USDC, ADDRESSES.arbitrum.WETH, + ADDRESSES.arbitrum.WBTC] const L2toL1Synths = { - '0xe405de8f52ba7559f9df3c368500b6e6ae6cee49': '0x5e74c9036fb86bd7ecdcb084a0673efc32ea31cb', - '0x8c6f28f2f1a3c87f0f938b96d27520d9751ec8d9': '0x57ab1ec28d129707052df4df418d58a2d46d5f51', + [ADDRESSES.optimism.sETH]: '0x5e74c9036fb86bd7ecdcb084a0673efc32ea31cb', + [ADDRESSES.optimism.sUSD]: ADDRESSES.ethereum.sUSD, '0x298b9b95708152ff6968aafd889c6586e9169f1d': '0xfe18be6b3bd88a2d2a7f928d00292e7a9963cfc6', '0xc5db22719a06418028a40a9b5e9a7c02959d0d08': '0xbbc455cb4f1b9e4bfc4b73970d360c8f032efee6' } -async function tvl(ttimestamp, _b, {optimism: block}){ +async function tvlOptimism(ttimestamp, _b, {optimism: block}){ const balances = {} const transform = (addr)=>{ return L2toL1Synths[addr] || addr; } - await sumTokens(balances, tokens.map(t=>pools.map(p=>[t,p])).flat(), block, 'optimism', transform) + await sumTokens(balances, op_tokens.map(t=>op_pools.map(p=>[t,p])).flat(), block, 'optimism') + return balances +} + +async function tvlArbitrum(ttimestamp, _b, {arbitrum: block}){ + const balances = {} + await sumTokens(balances, arb_tokens.map(t=>arb_pools.map(p=>[t,p])).flat(), block, 'arbitrum') return balances } module.exports = { methodology: 'TVL counts the option market locked synth value, along with USDC in safety module.', optimism:{ - tvl, - staking: staking("0xdE48b1B5853cc63B1D05e507414D3E02831722F8", "0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb", "optimism") + tvl:tvlOptimism + }, + arbitrum:{ + tvl:tvlArbitrum }, ethereum:{ - tvl: staking("0x54d59c4596c7ea66fd62188ba1e16db39e6f5472", "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", "ethereum"), - staking: staking("0xb9619d73c08076bc5d4f0470593e98b9eb19a219", "0x01ba67aac7f75f647d94220cc98fb30fcc5105bf", "ethereum") + tvl: staking("0x54d59c4596c7ea66fd62188ba1e16db39e6f5472", ADDRESSES.ethereum.USDC, "ethereum"), + staking: staking("0xcb9f85730f57732fc899fb158164b9ed60c77d49", "0x01ba67aac7f75f647d94220cc98fb30fcc5105bf", "ethereum") }, hallmarks:[ [1635218174, "Lyra Token"], [1635822974, "Token Program Start"], [1655341200, "Lyra V1.1 End"], [1656291600, "Lyra Avalon Start"], - [1659560056, "OP Rewards Distribution Start"] + [1659560056, "OP Rewards Distribution Start"], + [1675080000, "Launch on Arbitrum"] ] } diff --git a/projects/macaron/abi.json b/projects/macaron/abi.json index 606103f21f8..a8c9939e57e 100644 --- a/projects/macaron/abi.json +++ b/projects/macaron/abi.json @@ -1,116 +1,8 @@ { - "poolInfo": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "poolInfo", - "outputs": [ - { - "internalType": "contract IBEP20", - "name": "lpToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "allocPoint", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastRewardBlock", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accMacaronPerShare", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "isCLP", - "type": "bool" - }, - { - "internalType": "contract ICakeStrategy", - "name": "cakeStrategy", - "type": "address" - }, - { - "internalType": "contract IBEP20", - "name": "syrupToken", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "poolLength": { - "inputs": [], - "name": "poolLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "stakingToken": { - "inputs": [], - "name": "stakingToken", - "outputs": [ - { - "internalType": "contract IBEP20", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "lpSupply": { - "inputs": [], - "name": "lpSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "token": { - "inputs": [], - "name": "token", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "balanceOf": { - "inputs": [], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } + "poolInfo": "function poolInfo(uint256) view returns (address lpToken, uint256 allocPoint, uint256 lastRewardBlock, uint256 accMacaronPerShare, bool isCLP, address cakeStrategy, address syrupToken)", + "poolLength": "uint256:poolLength", + "stakingToken": "address:stakingToken", + "lpSupply": "uint256:lpSupply", + "token": "address:token", + "balanceOf": "uint256:balanceOf" } \ No newline at end of file diff --git a/projects/macaron/config.js b/projects/macaron/config.js index 84f5766cad0..15ca85d9a0c 100644 --- a/projects/macaron/config.js +++ b/projects/macaron/config.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const vaults_bsc = [ { "sousId": 0, @@ -558,7 +559,7 @@ const choco_pools_bsc = [ "earningToken": { "symbol": "wBNB", "address": { - "56": "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c", + "56": ADDRESSES.bsc.WBNB, "97": "0xae13d989dac2f0debff460ac112a837c89baa7cd" }, "decimals": 18, @@ -950,7 +951,7 @@ const choco_pools_polygon = [ "earningToken": { "symbol": "wMATIC", "address": { - "137": "0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270", + "137": ADDRESSES.polygon.WMATIC_2, "80001": "" }, "decimals": 18, diff --git a/projects/macaron/index.js b/projects/macaron/index.js index 6fd4e7d9975..c1d7c566b9d 100644 --- a/projects/macaron/index.js +++ b/projects/macaron/index.js @@ -8,14 +8,13 @@ const { getChainTransform, } = require("../helper/portedTokens"); module.exports = {} function setChainTVL(chain) { - const { masterchef, pools, vaults_json, chainId, treasury, erc20s, LPs, token, } = config[chain] + const { masterchef, pools, vaults_json, chainId, erc20s, LPs, token, } = config[chain] let getTvl async function getAllTVL(ts, _block, chainBlocks) { const transform = await getChainTransform(chain) const block = chainBlocks[chain] const balances = { - treasury: {}, tvl: {}, staking: {}, pool2: {}, @@ -44,11 +43,6 @@ function setChainTVL(chain) { masterchefPools.push(output) }) - if (treasury) { - let toa = erc20s.map(token => [token, treasury]) - balances.treasury = await sumTokens({}, toa, block, chain) - } - const toaTvl = [] const toaSyrup = [] const toaPool2 = [] @@ -119,7 +113,6 @@ function setChainTVL(chain) { const chainExports = { tvl: getTvlFunction('tvl'), pool2: getTvlFunction('pool2'), - treasury: getTvlFunction('treasury'), staking: getTvlFunction('staking'), } diff --git a/projects/madmex/index.js b/projects/madmex/index.js index e504009198b..e756c8b6bc7 100644 --- a/projects/madmex/index.js +++ b/projects/madmex/index.js @@ -2,6 +2,6 @@ const { gmxExports } = require('../helper/gmx') module.exports = { polygon: { - tvl: gmxExports({ chain: 'polygon', vault: '0xE990519F19DCc6c1589A544C331c4Ec046593e7A', }) + tvl: gmxExports({ vault: '0xE990519F19DCc6c1589A544C331c4Ec046593e7A', }) }, } \ No newline at end of file diff --git a/projects/magicfox-vault/index.js b/projects/magicfox-vault/index.js new file mode 100644 index 00000000000..b1e46316ff8 --- /dev/null +++ b/projects/magicfox-vault/index.js @@ -0,0 +1,45 @@ +const { unwrapLPsAuto } = require('../helper/unwrapLPs') + +const config = { + bsc: { voters: ['0x3Bb920C4875411C40981f6eb6959d4e169877A66', '0xaE0439eC64985D4165d12dDE7F514D092B4C0E23'] }, + arbitrum: { voters: ['0x01A07719596713bE5aB1C3AeEA76e3f5fde0885d', '0xF995f72445B14ae8D56523C9A0dE3F03334BFE2C'] }, + polygon: { voters: ['0x3F316559EB4f493C75638425106144261e20F3a2', '0xf999009fF931749a0930B8db02C6Cd888c7DC5ED'] }, +} + +const totalAmountAbi = "function getTotalAmounts() view returns (uint256 total0, uint256 total1)" +const guageAbiBsc = "function gaugeListExtended() view returns (address[], address[], uint16[])" +const guageAbi = "function gaugeListExtended() view returns (address[], address[])" + +Object.keys(config).forEach(chain => { + const { voters } = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const res = await api.multiCall({ abi: chain === 'bsc' ? guageAbiBsc : guageAbi, calls: voters }) + let gauges = res.flatMap(i => i[0]) + gauges = [...new Set(gauges.map(i => i.toLowerCase()))] + const tokens = await api.multiCall({ abi: 'address:TOKEN', calls: gauges }) + const bals = (await api.multiCall({ abi: 'uint256:balance', calls: gauges, permitFailure: true })).map(i => i ?? 0) + const isHypervisor = await api.multiCall({ abi: totalAmountAbi, calls: tokens, permitFailure: true }) + const items = gauges.map((gauge, i) => ({ + gauge, + token: tokens[i], + balance: bals[i], + isHypervisor: !!isHypervisor[i] + })).filter(i => i.balance > 0) + const hypervisorItems = items.filter(i => i.isHypervisor) + const lpItems = items.filter(i => !i.isHypervisor) + lpItems.forEach(i => api.add(i.token, i.balance)) + const hypTokens = hypervisorItems.map(i => i.token) + const hypToken0s = await api.multiCall({ abi: 'address:token0', calls: hypTokens }) + const hypToken1s = await api.multiCall({ abi: 'address:token1', calls: hypTokens }) + const hypTotalSupplies = await api.multiCall({ abi: 'uint256:totalSupply', calls: hypTokens }) + const hypTokenBals = await api.multiCall({ abi: totalAmountAbi, calls: hypTokens }) + hypTokens.forEach((_, i) => { + const ratio = hypervisorItems[i].balance / hypTotalSupplies[i] + api.add(hypToken0s[i], hypTokenBals[i][0] * ratio) + api.add(hypToken1s[i], hypTokenBals[i][1] * ratio) + }) + return unwrapLPsAuto({ api,}) + } + } +}) \ No newline at end of file diff --git a/projects/magicfox/index.js b/projects/magicfox/index.js new file mode 100644 index 00000000000..8ac1d75910a --- /dev/null +++ b/projects/magicfox/index.js @@ -0,0 +1,13 @@ +const { uniTvlExport } = require("../helper/unknownTokens"); + +module.exports = { + ...uniTvlExport("bsc", "0xcEDa3234D7D5b36114d886682A399c6d126A03e0", { + hasStablePools: true, + }), + ...uniTvlExport("arbitrum", "0xBd7A8c05D0eB214e3C5cc63D4B77C2Ea38bDe440", { + hasStablePools: true, + }), + ...uniTvlExport("polygon", "0xa2d23C7Ca6D360D5B0b30CaFF79dbBfa242B4811", { + hasStablePools: true, + }), +}; diff --git a/projects/magicianmv/index.js b/projects/magicianmv/index.js new file mode 100644 index 00000000000..05f52d0903e --- /dev/null +++ b/projects/magicianmv/index.js @@ -0,0 +1,10 @@ +const { getUniTVL } = require("../helper/unknownTokens"); +module.exports = { + misrepresentedTokens: true, + polygon: { + tvl: getUniTVL({ + factory: "0xf08ae17c2a2728a788bb1b6c243fe7eb3e5bbadc", + useDefaultCoreAssets: true, + }), + }, +}; diff --git a/projects/magik-farm/config/vault/aurora_pools.js b/projects/magik-farm/config/vault/aurora_pools.js index 5980982a7e4..317e52b7b0c 100644 --- a/projects/magik-farm/config/vault/aurora_pools.js +++ b/projects/magik-farm/config/vault/aurora_pools.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../../../helper/coreAssets.json') const auroraPools = [ { id: 'carbon-carbon-near', diff --git a/projects/magik-farm/config/vault/avalanche_pools.js b/projects/magik-farm/config/vault/avalanche_pools.js index 7348014b39f..2da1cbbbd8f 100644 --- a/projects/magik-farm/config/vault/avalanche_pools.js +++ b/projects/magik-farm/config/vault/avalanche_pools.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../../../helper/coreAssets.json') const avalanchePools = [ { id: "cham-avic-usdc", diff --git a/projects/magik-farm/config/vault/bsc_pools.js b/projects/magik-farm/config/vault/bsc_pools.js index 329f29ab29a..4be092cda16 100644 --- a/projects/magik-farm/config/vault/bsc_pools.js +++ b/projects/magik-farm/config/vault/bsc_pools.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../../../helper/coreAssets.json') const bscPools = [ { id: 'orb-orb-magik', diff --git a/projects/magik-farm/config/vault/fantom_pools.js b/projects/magik-farm/config/vault/fantom_pools.js index 390bcca0fc2..50529ecaf0a 100644 --- a/projects/magik-farm/config/vault/fantom_pools.js +++ b/projects/magik-farm/config/vault/fantom_pools.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../../../helper/coreAssets.json') const fantomPools = [ { id: 'lif3-tomb', diff --git a/projects/magik-farm/index.js b/projects/magik-farm/index.js index ca833c3fb58..bdc808c440c 100644 --- a/projects/magik-farm/index.js +++ b/projects/magik-farm/index.js @@ -94,15 +94,7 @@ const networkMapping = { pools: magikConfig.auroraPools, }, }; -const balanceAbi = { - constant: true, - inputs: [], - name: "balance", - outputs: [{ internalType: "uint256", name: "", type: "uint256" }], - payable: false, - stateMutability: "view", - type: "function", -}; +const balanceAbi = "uint256:balance" // Time-based cache buster const getApiCacheBuster = () => { diff --git a/projects/magpiexyz/abis/masterMagpie.json b/projects/magpiexyz/abis/masterMagpie.json new file mode 100644 index 00000000000..ab06b5b3d43 --- /dev/null +++ b/projects/magpiexyz/abis/masterMagpie.json @@ -0,0 +1,5 @@ +{ + "poolLength": "uint256:poolLength", + "registeredToken": "function registeredToken(uint256) view returns (address)", + "tokenToPoolInfo": "function tokenToPoolInfo(address) view returns (address stakingToken, uint256 allocPoint, uint256 lastRewardTimestamp, uint256 accMGPPerShare, address rewarder, address helper, bool helperNeedsHarvest)" +} \ No newline at end of file diff --git a/projects/magpiexyz/abis/wombatPoolHelper.json b/projects/magpiexyz/abis/wombatPoolHelper.json new file mode 100644 index 00000000000..1e668fea80d --- /dev/null +++ b/projects/magpiexyz/abis/wombatPoolHelper.json @@ -0,0 +1,3 @@ +{ + "depositToken": "address:depositToken" +} \ No newline at end of file diff --git a/projects/magpiexyz/config.js b/projects/magpiexyz/config.js new file mode 100644 index 00000000000..8301676618d --- /dev/null +++ b/projects/magpiexyz/config.js @@ -0,0 +1,19 @@ +const ADDRESSES = require('../helper/coreAssets.json') +module.exports = { + bsc: { + MasterMagpieAddress: "0xa3B615667CBd33cfc69843Bf11Fbb2A1D926BD46", + VlMGPAddress: "0x9B69b06272980FA6BAd9D88680a71e3c3BeB32c6", + MWOMSVAddress: ADDRESSES.null, + MGPAddress: "0xD06716E1Ff2E492Cc5034c2E81805562dd3b45fa", + WOMAddress: "0xAD6742A35fB341A9Cc6ad674738Dd8da98b94Fb1", + MWOMAddress: "0x027a9d301FB747cd972CFB29A63f3BDA551DFc5c", + }, + arbitrum: { + MasterMagpieAddress: "0x664cc2BcAe1E057EB1Ec379598c5B743Ad9Db6e7", + VlMGPAddress: "0x536599497Ce6a35FC65C7503232Fec71A84786b9", + MWOMSVAddress: "0x21804FB90593458630298f10a85094cb6d3B07Db", + MGPAddress: "0xa61F74247455A40b01b0559ff6274441FAfa22A3", + WOMAddress: "0x7B5EB3940021Ec0e8e463D5dBB4B7B09a89DDF96", + MWOMAddress: "0x509FD25EE2AC7833a017f17Ee8A6Fb4aAf947876", + }, + }; \ No newline at end of file diff --git a/projects/magpiexyz/index.js b/projects/magpiexyz/index.js index 987942cde6f..a80b2858e33 100644 --- a/projects/magpiexyz/index.js +++ b/projects/magpiexyz/index.js @@ -1,33 +1,42 @@ -const sdk = require('@defillama/sdk'); -const { POOL_LIST } = require("./pool") -const MasterMagpieAddress = "0xa3B615667CBd33cfc69843Bf11Fbb2A1D926BD46"; -const WOMAddress = "0xAD6742A35fB341A9Cc6ad674738Dd8da98b94Fb1" -const { transformBalances } = require('../helper/portedTokens') -async function tvl(timestamp, block, chainBlocks) { +const ADDRESSES = require('../helper/coreAssets.json') +const sdk = require('@defillama/sdk') +const { staking } = require('../helper/staking') +const WombatPoolHelperAbi = require("./abis/wombatPoolHelper.json") +const MasterMagpieAbi = require("./abis/masterMagpie.json"); +const config = require("./config") + +async function getPoolList(api, MasterMagpieAddress, VlMGPAddress, MWOMAddress, MWOMSVAddress) { + let poolTokens = await api.fetchList({ lengthAbi: MasterMagpieAbi.poolLength, itemAbi: MasterMagpieAbi.registeredToken, target: MasterMagpieAddress }) + const customPools = new Set([MWOMAddress, VlMGPAddress, MWOMSVAddress, '0x2130Df9dba40AfeFcA4C9b145f5ed095335c5FA3'].map(i => i.toLowerCase())) + poolTokens = poolTokens.filter(i => !customPools.has(i.toLowerCase())) + const infos = await api.multiCall({ calls: poolTokens, abi: MasterMagpieAbi.tokenToPoolInfo, target: MasterMagpieAddress }) + const depositTokens = await api.multiCall({ calls: infos.map(i => i.helper), abi: WombatPoolHelperAbi.depositToken, }) + return [poolTokens, depositTokens] +} + +async function tvl(timestamp, block, chainBlocks, { api }) { + const { MasterMagpieAddress, VlMGPAddress, MWOMSVAddress, WOMAddress, MWOMAddress } = config[api.chain]; + const [poolTokens, depositTokens] = await getPoolList(api, MasterMagpieAddress, VlMGPAddress, MWOMAddress, MWOMSVAddress); + const decimals = await api.multiCall({ abi: 'erc20:decimals', calls: depositTokens }) const balances = {}; - for(let i = 0, l = POOL_LIST.length; i < l; i++) { - const pool = POOL_LIST[i]; - const collateralBalance = (await sdk.api.abi.call({ - abi: 'erc20:balanceOf', - chain: 'bsc', - target: pool.rawStakingToken, - params: [MasterMagpieAddress], - block: chainBlocks['bsc'], - })).output; - if (pool.type == "MAGPIE_WOM_POOL") { - await sdk.util.sumSingleBalance(balances, `bsc:${WOMAddress}`, collateralBalance) - } - else { - await sdk.util.sumSingleBalance(balances, `bsc:${pool.stakingToken}`, collateralBalance) - } - + const womBal = await api.call({ abi: 'erc20:balanceOf', target: MWOMAddress, params: MasterMagpieAddress }) + sdk.util.sumSingleBalance(balances, WOMAddress, womBal, api.chain) + if (MWOMSVAddress != ADDRESSES.null) { + const mWomSVBal = await api.call({ abi: 'erc20:balanceOf', target: MWOMAddress, params: MWOMSVAddress }) + sdk.util.sumSingleBalance(balances, WOMAddress, mWomSVBal, api.chain) } - return transformBalances('bsc', balances); + const bals = await api.multiCall({ abi: 'erc20:balanceOf', calls: poolTokens.map(i => ({ target: i, params: MasterMagpieAddress })) }) + bals.forEach((v, i) => { + v /= 10 ** (18 - decimals[i]) + sdk.util.sumSingleBalance(balances, depositTokens[i], v, api.chain) + }) + return balances } -module.exports = { - methodology: 'counts the number of MINT tokens in the Club Bonding contract.', - bsc: { - tvl, +Object.keys(config).forEach((chain) => { + const { VlMGPAddress, MGPAddress, } = config[chain]; + module.exports[chain] = { + tvl: tvl, + staking: staking(VlMGPAddress, MGPAddress) } -}; \ No newline at end of file +}) \ No newline at end of file diff --git a/projects/magpiexyz/pool.js b/projects/magpiexyz/pool.js deleted file mode 100644 index 0a902c83e6d..00000000000 --- a/projects/magpiexyz/pool.js +++ /dev/null @@ -1,250 +0,0 @@ -const POOL_LIST = [ - { - "type": "WOMBAT_POOL", - "poolId": 0, - "helper": "0xC4a2B6de728B1E76D2F7178bF8AB3df458dF4C92", - "helperNeedsHarvest": true, - "locker": "0x0000000000000000000000000000000000000000", - "rewarder": "0x236B0863F2241B0e5218962650b0974bCAe095Ab", - "stakingToken": "0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56", - "rawStakingToken": "0xcC9cAf0c84514D01cDa62C9E0FC7B3e21e45f25D", - "desc": "on Wombat", - "apr": "0.0%", - "isNative": false, - "stakingTokenInfo": { - "name": "BUSD", - "symbol": "BUSD", - "showSymbol": "BUSD", - "priceId": "BUSD" - }, - "wombatPoolType": "MAIN_POOL", - }, - { - "type": "WOMBAT_POOL", - "poolId": 1, - "helper": "0x1aa1E18FAFAe4391FF33dFBE6198dc84B9541D77", - "helperNeedsHarvest": true, - "locker": "0x0000000000000000000000000000000000000000", - "rewarder": "0xb060cA9ED2B96D082f0EC2A62c84df54e868E694", - "stakingToken": "0x55d398326f99059fF775485246999027B3197955", - "rawStakingToken": "0x1773072c932854291F844b67CFFE65216e6400D4", - "desc": "on Wombat", - "apr": "0.0%", - "isNative": false, - "stakingTokenInfo": { - "name": "USDT", - "symbol": "USDT", - "showSymbol": "USDT", - "priceId": "USDT", - }, - "wombatPoolType": "MAIN_POOL", - }, - { - "type": "WOMBAT_POOL", - "poolId": 2, - "helper": "0xB8fcc8aC3aB0eb77ab43aA3C5483234CB10e5a73", - "helperNeedsHarvest": true, - "locker": "0x0000000000000000000000000000000000000000", - "rewarder": "0x76B891f9D5106C09B2057cEa42E143F62352aa35", - "stakingToken": "0x1AF3F329e8BE154074D8769D1FFa4eE058B1DBc3", - "rawStakingToken": "0x1Bfaf418C13e36958b0b6736B27C3E8bC1F9bB91", - "desc": "on Wombat", - "apr": "0.0%", - "isNative": false, - "stakingTokenInfo": { - "name": "DAI", - "symbol": "DAI", - "showSymbol": "DAI", - "priceId": "DAI", - - }, - "wombatPoolType": "MAIN_POOL", - }, - { - "type": "WOMBAT_POOL", - "poolId": 3, - "helper": "0xb68F5247f31fe28FDe0b0F7543F635a4d6EDbD7F", - "helperNeedsHarvest": true, - "locker": "0x0000000000000000000000000000000000000000", - "rewarder": "0x162231b60B077c42Ef988aa822ef372bbf14F846", - "stakingToken": "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d", - "rawStakingToken": "0x8044494b2e0790f56445aA167F59D1D1d843E67c", - "desc": "on Wombat", - "apr": "0.0%", - "isNative": false, - "stakingTokenInfo": { - "name": "USDC", - "symbol": "USDC", - "showSymbol": "USDC", - "priceId": "USDC", - - }, - "wombatPoolType": "MAIN_POOL", - - }, - { - "type": "WOMBAT_POOL", - "poolId": 4, - "helper": "0xD3e3d4C7e6e41f9b8Ec6eF34fC133287102AEf3A", - "helperNeedsHarvest": true, - "locker": "0x0000000000000000000000000000000000000000", - "rewarder": "0x64F10A11311E033C356F3eC5cF81a727996436C7", - "stakingToken": "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c", - "rawStakingToken": "0xA67e1Ef2483522532417eEF57659C5410D24b973", - "desc": "on Wombat", - "apr": "0.0%", - "isNative": true, - "stakingTokenInfo": { - "name": "WBNB", - "symbol": "WBNB", - "showSymbol": "WBNB", - "priceId": "WBNB", - }, - "wombatPoolType": "BNB_POOL", - }, - { - "type": "WOMBAT_POOL", - "poolId": 5, - "helper": "0x9b5Ecb7b3f311955B2f3F32f23187d18149f05A2", - "helperNeedsHarvest": true, - "locker": "0x0000000000000000000000000000000000000000", - "rewarder": "0xacEf07D2d32263c3373f23E9cfe32F385db10E2f", - "stakingToken": "0x1bdd3Cf7F79cfB8EdbB955f20ad99211551BA275", - "rawStakingToken": "0xC134D4c9C9E99F928835ba2D13E188f45Af56B3D", - "desc": "on Wombat", - "apr": "0.0%", - "isNative": false, - "stakingTokenInfo": { - "name": "BNBx", - "symbol": "BNBx", - "showSymbol": "BNBx", - "priceId": "BNBX", - }, - "wombatPoolType": "BNB_POOL", - }, - { - "type": "WOMBAT_POOL", - "poolId": 6, - "helper": "0x399cB05deb6a9C9F0172EC50A972590e760dbf71", - "helperNeedsHarvest": true, - "locker": "0x0000000000000000000000000000000000000000", - "rewarder": "0xf0630d4F3d92E2E8CF9dA4D5A0418dc4BA26664f", - "stakingToken": "0xE85aFCcDaFBE7F2B096f268e31ccE3da8dA2990A", - "rawStakingToken": "0x57dbD8F307740c12B492A9a6333Eb84A680E6878", - "desc": "on Wombat", - "apr": "0.0%", - "isNative": false, - "stakingTokenInfo": { - "name": "aBNBc", - "symbol": "aBNBc", - "showSymbol": "aBNBc", - "priceId": "ABNBC", - - }, - "wombatPoolType": "BNB_POOL", - - }, - { - "type": "WOMBAT_POOL", - "poolId": 7, - "helper": "0xbf925c91f3AB02aDAcB707643acFae287d593be1", - "helperNeedsHarvest": true, - "locker": "0x0000000000000000000000000000000000000000", - "rewarder": "0xc3fFa7e52bb11cF93263BefB3533aA3D4b788aa9", - "stakingToken": "0xc2E9d07F66A89c44062459A47a0D2Dc038E4fb16", - "rawStakingToken": "0x7d49DeDE48CA98967E50dc10a9Dd394359956802", - "desc": "on Wombat", - "apr": "0.0%", - "isNative": false, - "stakingTokenInfo": { - "name": "stkBNB", - "symbol": "stkBNB", - "showSymbol": "stkBNB", - "priceId": "STKBNB", - }, - "wombatPoolType": "BNB_POOL", - }, - { - "type": "WOMBAT_POOL", - "poolId": 8, - "helper": "0xC2fb19640fC90Ce84410EcD203e4EA2C2AD1291b", - "helperNeedsHarvest": true, - "locker": "0x0000000000000000000000000000000000000000", - "rewarder": "0x1b6cD25613A68D613fCcb1c4B2d8F7DaA6e63aa1", - "stakingToken": "0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56", - "rawStakingToken": "0x59DF1bC9c8Ac7b205F2F9717F970E69804B644b7", - "desc": "on Wombat", - "apr": "0.0%", - "isNative": false, - "stakingTokenInfo": { - "name": "BUSD", - "symbol": "BUSD", - "showSymbol": "BUSD", - "priceId": "BUSD", - }, - "wombatPoolType": "SIDE_POOL", - }, - { - "type": "WOMBAT_POOL", - "poolId": 9, - "helper": "0xe61eBb17b11Cd995f0564A8Ff70f17d10D850872", - "helperNeedsHarvest": true, - "locker": "0x0000000000000000000000000000000000000000", - "rewarder": "0xc81A98a3EdDA58490D69cfE15c49dd90A38C4f8A", - "stakingToken": "0x0782b6d8c4551B9760e74c0545a9bCD90bdc41E5", - "rawStakingToken": "0xaB22C452308eAe8C0CDdad0Ec4E31aa21f1d6c42", - "desc": "on Wombat", - "apr": "0.0%", - "isNative": false, - "stakingTokenInfo": { - "name": "HAY", - "symbol": "HAY", - "showSymbol": "HAY", - "priceId": "HAY", - }, - "wombatPoolType": "SIDE_POOL", - }, - { - "type": "MAGPIE_WOM_POOL", - "poolId": 10, - "helper": "0x4bcc7c793534246BC18acD3737aA4897FF23B458", - "helperNeedsHarvest": false, - "locker": "0x0000000000000000000000000000000000000000", - "rewarder": "0x1A51cFfea774dDEAB342A9bB8BC825457B9F5eaD", - "stakingToken": "0x027a9d301FB747cd972CFB29A63f3BDA551DFc5c", - "rawStakingToken": "0x027a9d301FB747cd972CFB29A63f3BDA551DFc5c", - "desc": "on PancakeSwap", - "apr": "0.0%", - "isNative": false, - "stakingTokenInfo": { - "name": "mWOM", - "symbol": "mWOM", - "showSymbol": "mWOM", - "priceId": "MWOM", - }, - - }, - { - "type": "MAGPIE_VLMGP_POOL", - "poolId": 11, - "helper": "0x9B69b06272980FA6BAd9D88680a71e3c3BeB32c6", - "helperNeedsHarvest": false, - "locker": "0x9B69b06272980FA6BAd9D88680a71e3c3BeB32c6", - "rewarder": "0x94Eb0E6800F10E22550e104EC04f98F043B6b3ad", - "stakingToken": "0xD06716E1Ff2E492Cc5034c2E81805562dd3b45fa", - "rawStakingToken": "0x9B69b06272980FA6BAd9D88680a71e3c3BeB32c6", - "desc": "on PancakeSwap", - "apr": "0.0%", - "isNative": false, - "stakingTokenInfo": { - "name": "Vote Locked MGP", - "symbol": "vlMGP", - "showSymbol": "vlMGP", - "priceId": "VLMGP", - }, - } -] - -module.exports = { - POOL_LIST -} \ No newline at end of file diff --git a/projects/mahadao/bsc.js b/projects/mahadao/bsc.js index aa1070babd0..27e063b088d 100644 --- a/projects/mahadao/bsc.js +++ b/projects/mahadao/bsc.js @@ -1,9 +1,10 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens } = require("../helper/unwrapLPs.js"); const chain = "bsc"; const bsc = { - busd: "0xe9e7cea3dedca5984780bafc599bd69add087d56", + busd: ADDRESSES.bsc.BUSD, arth: "0x85daB10c3BA20148cA60C2eb955e1F8ffE9eAa79", arthBusdPool: "0x21de718bcb36f649e1a7a7874692b530aa6f986d", diff --git a/projects/mahadao/ethereum.js b/projects/mahadao/ethereum.js index 4a503d187e1..4f91f18cdb5 100644 --- a/projects/mahadao/ethereum.js +++ b/projects/mahadao/ethereum.js @@ -1,78 +1,42 @@ -const { sumTokens } = require("../helper/unwrapLPs.js"); -const { unwrapTroves } = require("../helper/unwrapLPs.js"); +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport, nullAddress, sumTokens2 } = require("../helper/unwrapLPs.js"); const { staking } = require("../helper/staking"); - -const chain = "ethereum"; +const activePoolAbi = "address:activePool" const eth = { - dai: "0x6b175474e89094c44da98b954eedeac495271d0f", - maha: "0xb4d930279552397bba2ee473229f89ec245bc365", - weth: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + dai: ADDRESSES.ethereum.DAI, + maha: "0x745407c86df8db893011912d3ab28e68b62e49b0", + weth: ADDRESSES.ethereum.WETH, arth: "0x8CC0F052fff7eaD7f2EdCCcaC895502E884a8a71", crv3: "0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490", - usdc: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", + usdc: ADDRESSES.ethereum.USDC, mahax: "0xbdd8f4daf71c2cb16cce7e54bb81ef3cfcf5aacb", - daiMahaPool: "0x8cb8f052e7337573cd59d33bb67b2acbb65e9876", - arthUsdcPool: "0x031a1d307C91fbDE01005Ec2Ebc5Fcb03b6f80aB", - arthMahaPool: "0xC5Ee69662e7EF79e503be9D54C237d5aafaC305d", - arth3crvPool: "0x96f34Bb82fcA57e475e6ad218b0dd0C5c78DF423", - arthWethPool: "0xE7cDba5e9b0D5E044AaB795cd3D659aAc8dB869B", + daiMahaPoolUNIV3: "0x8cb8f052e7337573cd59d33bb67b2acbb65e9876", + arthUsdcPoolUNIV3: "0x031a1d307C91fbDE01005Ec2Ebc5Fcb03b6f80aB", + arthMahaPoolUNIV3: "0x8a039FB7503B914A9cb2a004010706ca192377Bc", + arthWethPoolUNIV3: "0xE7cDba5e9b0D5E044AaB795cd3D659aAc8dB869B", + wethMahaPoolUNIV3: "0xb28ddf1ee8ee014eafbecd8de979ac8d297931c7", + + arthUsdcPoolCRV: "0xb4018cb02e264c3fcfe0f21a1f5cfbcaaba9f61f", }; Object.keys(eth).forEach((k) => (eth[k] = eth[k].toLowerCase())); -async function pool2(_, block) { - const balances = {}; - - const tokensAndOwners = [ - // ARTH/CRV - Curve - // https://curve.fi/#/ethereum/pools/factory-crypto-142/swap - // Stablecoin part of the pool - [eth.arth, eth.arth3crvPool], - [eth.crv3, eth.arth3crvPool], - - // ARTH/ETH Uniswap 1% - // https://info.uniswap.org/#/pools/0xe7cdba5e9b0d5e044aab795cd3d659aac8db869b - // Stablecoin part of the pool - [eth.arth, eth.arthWethPool], - [eth.weth, eth.arthWethPool], - - // ARTH/MAHA Uniswap 1% - // https://info.uniswap.org/#/pools/0xc5ee69662e7ef79e503be9d54c237d5aafac305d - // Stablecoin & Governance token part of the pool - [eth.arth, eth.arthMahaPool], - [eth.maha, eth.arthMahaPool], - - // ARTH/USDC Uniswap 1% - // https://info.uniswap.org/#/pools/0x031a1d307c91fbde01005ec2ebc5fcb03b6f80ab - // Stablecoin part of the pool - [eth.arth, eth.arthUsdcPool], - [eth.usdc, eth.arthUsdcPool], - - // DAI/MAHA Uniswap 1% - // https://info.uniswap.org/#/pools/0x8cb8f052e7337573cd59d33bb67b2acbb65e9876 - // Governance part of the pool - [eth.dai, eth.daiMahaPool], - [eth.maha, eth.daiMahaPool], - ]; - - return sumTokens(balances, tokensAndOwners, block, chain); -} - -async function tvl(_, block) { - const balances = {}; +async function tvl(_, block, _1, { api }) { const troves = [ - "0xd3761e54826837b8bbd6ef0a278d5b647b807583", // ETH Trove + "0x8b1da95724b1e376ae49fdb67afe33fe41093af5", // ETH Trove ]; - await unwrapTroves({ balances, chain, block, troves }); + const pools = await api.multiCall({ abi: activePoolAbi, calls: troves}) - return balances; + return sumTokens2({ owners: pools, tokens: [ nullAddress ]}) } module.exports = { staking: staking(eth.mahax, eth.maha), - pool2, + pool2: sumTokensExport({ tokensAndOwners: [ + ['0xdf34bad1D3B16c8F28c9Cf95f15001949243A038', '0x9ee8110c0aacb7f9147252d7a2d95a5ff52f8496'], + ]}), tvl, }; diff --git a/projects/mahadao/polygon.js b/projects/mahadao/polygon.js index a750cb51bca..3f177a12721 100644 --- a/projects/mahadao/polygon.js +++ b/projects/mahadao/polygon.js @@ -1,9 +1,10 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens } = require("../helper/unwrapLPs.js"); const chain = "polygon"; const polygon = { - usdc: "0x2791bca1f2de4661ed88a30c99a7a9449aa84174", + usdc: ADDRESSES.polygon.USDC, arthRedeemer: "0x394f4f7db617a1e4612072345f9601235f64b326", }; diff --git a/projects/mahalend/index.js b/projects/mahalend/index.js new file mode 100644 index 00000000000..921694a9103 --- /dev/null +++ b/projects/mahalend/index.js @@ -0,0 +1,10 @@ +const { aaveExports } = require("../helper/aave"); + +module.exports = { + ethereum: aaveExports("ethereum", undefined, undefined, [ + "0xCB5a1D4a394C4BA58999FbD7629d64465DdA70BC", + ]), + arbitrum: aaveExports("arbitrum", undefined, undefined, [ + "0xE76C1D2a7a56348574810e83D38c07D47f0641F3", + ]), +}; diff --git a/projects/maia-dao-uni/index.js b/projects/maia-dao-uni/index.js new file mode 100644 index 00000000000..d6359b97e37 --- /dev/null +++ b/projects/maia-dao-uni/index.js @@ -0,0 +1,5 @@ +const { uniV3Export } = require('../helper/uniswapV3') + +module.exports = uniV3Export({ + metis: { factory: '0xf5fd18Cd5325904cC7141cB9Daca1F2F964B9927', fromBlock: 5212263, }, +}) \ No newline at end of file diff --git a/projects/maia-dao/abis.json b/projects/maia-dao/abis.json index 2396b894125..9902d560229 100644 --- a/projects/maia-dao/abis.json +++ b/projects/maia-dao/abis.json @@ -1,54 +1,7 @@ { - "locked": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "locked", - "outputs": [ - { - "internalType": "int128", - "name": "amount", - "type": "int128" - }, - { - "internalType": "uint256", - "name": "end", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "gauges": { - "type": "function", - "stateMutability": "view", - "outputs": [{ "type": "address", "name": "", "internalType": "address" }], - "name": "gauges", - "inputs": [{ "type": "address", "name": "", "internalType": "address" }] - }, - "balanceOf": { - "type": "function", - "stateMutability": "view", - "outputs": [{ "type": "uint256", "name": "", "internalType": "uint256" }], - "name": "balanceOf", - "inputs": [{ "type": "address", "name": "", "internalType": "address" }] - }, - "pools": { - "type": "function", - "stateMutability": "view", - "outputs": [{ "type": "address", "name": "", "internalType": "address" }], - "name": "pools", - "inputs": [{ "type": "uint256", "name": "", "internalType": "uint256" }] - }, - "length": { - "type": "function", - "stateMutability": "view", - "outputs": [{ "type": "uint256", "name": "", "internalType": "uint256" }], - "name": "length", - "inputs": [] - } -} + "locked": "function locked(uint256) view returns (int128 amount, uint256 end)", + "gauges": "function gauges(address) view returns (address)", + "balanceOf": "function balanceOf(address) view returns (uint256)", + "pools": "function pools(uint256) view returns (address)", + "length": "uint256:length" +} \ No newline at end of file diff --git a/projects/maia-dao/api.js b/projects/maia-dao/api.js new file mode 100644 index 00000000000..55e19de8f53 --- /dev/null +++ b/projects/maia-dao/api.js @@ -0,0 +1,8 @@ +const { staking } = require('../helper/staking') + +module.exports = { + metis: { + tvl: () => 0, + staking: staking('0xD7a586CE5250bEfaB2cc2239F7226B9602536E6A', '0x72c232D56542Ba082592DEE7C77b1C6CFA758BCD') + } +} \ No newline at end of file diff --git a/projects/maia-dao/index.js b/projects/maia-dao/index.js index d28130bac9b..7b1ebdd7e63 100644 --- a/projects/maia-dao/index.js +++ b/projects/maia-dao/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const { getChainTransform } = require('../helper/portedTokens'); const { unwrapUniswapLPs, sumTokens2, } = require('../helper/unwrapLPs'); @@ -6,7 +7,7 @@ const abis = require("./abis.json"); const HERMES = '0xb27bbeaaca2c00d6258c3118bab6b5b6975161c8'; const excludedTokens = ["0xa3e8e7eb4649ffc6f3cbe42b4c2ecf6625d3e802"]; const multisig = '0x77314eAA8D99C2Ad55f3ca6dF4300CFC50BdBC7F'; -const tokens = ['0x420000000000000000000000000000000000000A', '0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000', '0xEA32A96608495e54156Ae48931A7c20f0dcc1a21', '0xbB06DCA3AE6887fAbF931640f67cab3e3a16F4dC', '0x4651B38e7ec14BB3db731369BFE5B08F2466Bd0A', '0xEfFEC28996aAff6D55B6D108a46446d45C3a2E71', '0x5ab390084812E145b619ECAA8671d39174a1a6d1',]; +const tokens = [ADDRESSES.metis.WETH, ADDRESSES.metis.Metis, ADDRESSES.metis.m_USDC, ADDRESSES.metis.m_USDT, ADDRESSES.metis.DAI, '0xEfFEC28996aAff6D55B6D108a46446d45C3a2E71', '0x5ab390084812E145b619ECAA8671d39174a1a6d1',]; async function tvl(timestamp, _, { metis: block }) { const chain = 'metis' @@ -71,12 +72,12 @@ async function tvl(timestamp, _, { metis: block }) { excludedTokens.includes(pairAddresses[i].output.toLowerCase()) ) { continue; - }; + } lpPositions.push({ balance: pairBalances[i].output, token: pairAddresses[i].output }); - }; + } await unwrapUniswapLPs( balances, @@ -86,7 +87,7 @@ async function tvl(timestamp, _, { metis: block }) { transform ); return sumTokens2({ balances, owner: multisig, tokens, chain, block, resolveLP: 'true', }) -}; +} module.exports = { metis: { diff --git a/projects/maiar/index.js b/projects/maiar/index.js index 1bc20d23a0a..3d6e7da189f 100644 --- a/projects/maiar/index.js +++ b/projects/maiar/index.js @@ -1,9 +1,7 @@ -const { default: axios } = require("axios"); -const { request, gql } = require("graphql-request"); +const { request } = require("graphql-request"); const { toUSDTBalances } = require('../helper/balances') -const { sumTokensExport } = require('../helper/sumTokens') -const LiquidityQuery = gql` +const LiquidityQuery = ` { factory { pairCount @@ -12,22 +10,28 @@ const LiquidityQuery = gql` } ` +const StakingQuery2 = `{ + totalValueLockedUSD + totalValueStakedUSD + totalLockedMexStakedUSD +}` + async function tvl() { - const results = await request("https://graph.maiar.exchange/graphql", LiquidityQuery) + const results = await request("http://graph.xexchange.com/graphql", LiquidityQuery) return toUSDTBalances(results.factory.totalValueLockedUSD) } -const stakingContracts = [ - "erd1qqqqqqqqqqqqqpgq7qhsw8kffad85jtt79t9ym0a4ycvan9a2jps0zkpen", - "erd1qqqqqqqqqqqqqpgqv4ks4nzn2cw96mm06lt7s2l3xfrsznmp2jpsszdry5" -] +async function stakingAndLockedMEX() { + const results = await request("http://graph.xexchange.com/graphql", StakingQuery2) + return toUSDTBalances(results.totalValueStakedUSD) +} module.exports = { misrepresentedTokens: true, timetravel: false, elrond: { tvl, - staking: sumTokensExport({ chain: 'elrond', owners: stakingContracts, token: 'MEX-455c57' }) + staking: stakingAndLockedMEX, }, } \ No newline at end of file diff --git a/projects/maker/abis/maker-mcd.js b/projects/maker/abis/maker-mcd.js index af90d024cdf..326221c7a0c 100644 --- a/projects/maker/abis/maker-mcd.js +++ b/projects/maker/abis/maker-mcd.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../../helper/coreAssets.json') module.exports = { // addresses for kovan version 0.2.17 KOVANVAT: "0xba987bdb501d131f766fee8180da5d81b34b69d9", @@ -7,34 +8,10 @@ module.exports = { VAT: "0x35d1b3f3d7966a1dfe207aa4514c12a259a0492b", POT: "0x197e90f9fad81970ba7976f33cbd77088e5d7cf7", JUG: "0x19c0976f590d67707e62397c87829d896dc0f1f1", - DAI: "0x6B175474E89094C44Da98b954EedeAC495271d0F", + DAI: ADDRESSES.ethereum.DAI, STARTBLOCK: 8928152, - ilk: { - constant: true, - inputs: [], - name: "ilk", - outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }], - payable: false, - stateMutability: "view", - type: "function", - }, - gem: { - constant: true, - inputs: [], - name: "gem", - outputs: [{ internalType: "address", name: "", type: "address" }], - payable: false, - stateMutability: "view", - type: "function", - }, - Pie: { - constant: true, - inputs: [], - name: "Pie", - outputs: [{ internalType: "uint256", name: "", type: "uint256" }], - payable: false, - stateMutability: "view", - type: "function", - }, - dog: {"inputs":[],"name":"dog","outputs":[{"internalType":"contract DogLike","name":"","type":"address"}],"stateMutability":"view","type":"function"} + ilk: "function ilk() view returns (bytes32)", + gem: "address:gem", + Pie: "uint256:Pie", + dog: "address:dog", }; diff --git a/projects/maker/abis/makerdao.js b/projects/maker/abis/makerdao.js index d7c2af872c2..18ab2c20ff5 100755 --- a/projects/maker/abis/makerdao.js +++ b/projects/maker/abis/makerdao.js @@ -1,5 +1,6 @@ +const ADDRESSES = require('../../helper/coreAssets.json') module.exports = { TUB_ADDRESS: "0x448a5065aebb8e423f0896e6c5d525c040f59af3", - DAI_ADDRESS: "0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359", - WETH_ADDRESS: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2" + DAI_ADDRESS: ADDRESSES.ethereum.SAI, + WETH_ADDRESS: ADDRESSES.ethereum.WETH }; \ No newline at end of file diff --git a/projects/maker/index.js b/projects/maker/index.js index c3da845b368..2dc14f6257a 100644 --- a/projects/maker/index.js +++ b/projects/maker/index.js @@ -1,54 +1,49 @@ +const ADDRESSES = require('../helper/coreAssets.json') // const utils = require('web3-utils'); const sdk = require('@defillama/sdk'); const MakerSCDConstants = require("./abis/makerdao.js"); const MakerMCDConstants = require("./abis/maker-mcd.js"); const { sumTokens2 } = require('../helper/unwrapLPs') -const { requery } = require('../helper/requery.js'); +const { getLogs } = require('../helper/cache/getLogs') -async function getJoins(block) { +async function getJoins(block, api) { // let rely = utils.sha3("rely(address)").substr(0, 10); // let relyTopic = utils.padRight(rely, 64); let relyTopic = '0x65fae35e00000000000000000000000000000000000000000000000000000000' let joins = []; + let failed = []; + const failedSet = new Set(failedJoins) // get list of auths - const logs = ( - await sdk.api.util - .getLogs({ - keys: [], - toBlock: block, - target: MakerMCDConstants.VAT, - fromBlock: MakerMCDConstants.STARTBLOCK, - topics: [relyTopic], - }) - ).output; - - let auths = logs.map(auth => { - return `0x${auth.topics[1].substr(26)}`; - }); + const auths = ( + await getLogs({ + api, + target: MakerMCDConstants.VAT, + fromBlock: MakerMCDConstants.STARTBLOCK, + topics: [relyTopic], + }) + ).map(i => `0x${i.topics[1].substr(26)}`).filter(i => !failedSet.has(i)) - const ilks = await sdk.api.abi.multiCall({ + const ilks = await api.multiCall({ abi: MakerMCDConstants.ilk, - calls: auths.map((auth) => ({ - target: auth, - })), - block + calls: auths, + permitFailure: true, }); - await requery(ilks, "ethereum", block, MakerMCDConstants.ilk) - await requery(ilks, "ethereum", block, MakerMCDConstants.ilk) // make sure that failed calls actually fail - for (let ilk of ilks.output) { - if (ilk.output) { - joins.push(ilk.input.target) - } - } + ilks.forEach((_, i) => { + const token = auths[i].toLowerCase() + if (_) joins.push(token) + else failed.push(token) + }) + + if (failed.length) sdk.log('failed', failed) return joins; } -async function tvl(timestamp, block) { - const toa = [ +async function tvl(timestamp, block, _, { api }) { + let toa = [ [MakerSCDConstants.WETH_ADDRESS, MakerSCDConstants.TUB_ADDRESS,], ] @@ -57,15 +52,19 @@ async function tvl(timestamp, block) { '0x41ca7a7aa2be78cf7cb80c0f4a9bdfbc96e81815', ] if (block > MakerMCDConstants.STARTBLOCK) { - let joins = await getJoins(block); - joins = joins.filter(i => !blacklistedJoins.includes(i)) + let joins = await getJoins(block, api); + const dogSet = new Set(dogs) + joins = joins.filter(i => !blacklistedJoins.includes(i) && !dogSet.has(i)) const { output: gems } = await sdk.api.abi.multiCall({ abi: MakerMCDConstants.gem, block, calls: joins.map(i => ({ target: i })), + permitFailure: true, }) - const dogCalls = [] + const dogCalls = dogs.map(i => ({ target: i })) + gems.forEach(({ success, output, input: { target } }) => { + target = target.toLowerCase() if (!success) { dogCalls.push({ target }) return; @@ -77,6 +76,7 @@ async function tvl(timestamp, block) { const { output: dogRes } = await sdk.api.abi.multiCall({ abi: MakerMCDConstants.dog, calls: dogCalls, block, + permitFailure: true, }) const failedCalls = dogRes.filter(i => !i.success) @@ -86,7 +86,37 @@ async function tvl(timestamp, block) { } } - return sumTokens2({ block, tokensAndOwners: toa }) + toa = toa.filter(i => i[0].toLowerCase() !== ADDRESSES.ethereum.SAI.toLowerCase()) + const symbols = await api.multiCall({ abi: 'erc20:symbol', calls: toa.map(t => t[0]) }) + const gUNIToa = toa.filter((_, i) => symbols[i] === 'G-UNI') + toa = toa.filter((_, i) => symbols[i] !== 'G-UNI') + + const balances = await sumTokens2({ api, tokensAndOwners: toa, }) + return unwrapGunis({ api, toa: gUNIToa, balances, }) +} + +async function unwrapGunis({ api, toa, balances = {} }) { + const lps = toa.map(i => i[0]) + const balanceOfCalls = toa.map(t => ({ params: t[1], target: t[0] })) + const [ + token0s, token1s, supplies, uBalances, tokenBalances + ] = await Promise.all([ + api.multiCall({ abi: 'address:token0', calls: lps }), + api.multiCall({ abi: 'address:token1', calls: lps }), + api.multiCall({ abi: 'uint256:totalSupply', calls: lps }), + api.multiCall({ abi: 'function getUnderlyingBalances() view returns (uint256 token0Bal, uint256 token1Bal)', calls: lps }), + api.multiCall({ abi: 'erc20:balanceOf', calls: balanceOfCalls }), + ]) + + tokenBalances.forEach((bal, i) => { + const ratio = bal / supplies[i] + const token0Bal = uBalances[i][0] * ratio + const token1Bal = uBalances[i][1] * ratio + sdk.util.sumSingleBalance(balances, token0s[i], token0Bal) + sdk.util.sumSingleBalance(balances, token1s[i], token1Bal) + }) + sdk.util.removeTokenBalance(balances, ADDRESSES.ethereum.DAI) // remove dai balances + return balances } module.exports = { @@ -99,3 +129,77 @@ module.exports = { tvl }, }; + +const dogs = [ + '0x832dd5f17b30078a5e46fdb8130a68cbc4a74dc0', + '0x9dacc11dcd0aa13386d295eaeebbd38130897e6f', + '0xc67963a226eddd77b91ad8c421630a1b0adff270', + '0x71eb894330e8a4b96b8d6056962e7f116f50e06f', + '0xc2b12567523e3f3cbd9931492b91fe65b240bc47', + '0x0227b54adbfaeec5f1ed1dfa11f54dcff9076e2c', + '0x3d22e6f643e2f4c563fd9db22b229cbb0cd570fb', + '0xdc90d461e148552387f3ab3ebee0bdc58aa16375', + '0x006aa3eb5e666d8e006aa647d4afab212555ddea', + '0xf5c8176e1eb0915359e46ded16e52c071bb435c0', + '0x2bb690931407dca7ece84753ea931ffd304f0f38', + '0x81c5cdf4817dbf75c7f08b8a1cdab05c9b3f70f7', + '0x6aac067bb903e633a422de7be9355e62b3ce0378', + '0x3713f83ee6d138ce191294c131148176015bc29a', + '0x834719bea8da68c46484e001143bdde29370a6a3', + '0x8723b74f598de2ea49747de5896f9034cc09349e', + '0x9f6981ba5c77211a34b76c6385c0f6fa10414035', + '0x93ae03815baf1f19d7f18d9116e4b637cc32a131', + '0x2ac4c9b49051275acb4c43ec973082388d015d48', + '0x4fc53a57262b87abda61d6d0db2be7e9be68f6b8', + '0xb15afab996904170f87a64fe42db0b64a6f75d24', + '0x6aa0520354d1b84e1c6abfe64a708939529b619e', + '0xb0ece6f5542a4577e2f1be491a937ccbbec8479e', + '0x854b252ba15eafa4d1609d3b98e00cc10084ec55', + '0xe4b82be84391b9e7c56a1fc821f47569b364dd4a', + '0x046b1a5718da6a226d912cfd306ba19980772908', + '0x5590f23358fe17361d7e4e4f91219145d8ccfcb3', + '0x0f6f88f8a4b918584e3539182793a0c276097f44', + '0xfc9d6dd08bee324a5a8b557d2854b9c36c2aec5d', + '0xbcb396cd139d1116bd89562b49b9d1d6c25378b0', + '0xa47d68b9db0a0361284fa04ba40623fcbd1a263e', + '0x66609b4799fd7ce12ba799ad01094abd13d5014d', + '0x9b3310708af333f6f379fa42a5d09cbaa10ab309', + '0x5322a3551bc6a1b39d5d142e5e38dc5b4bc5b3d2', + '0x29342f530ed6120bdb219d602dafd584676293d1', + '0x5048c5cd3102026472f8914557a1fd35c8dc6c9e', + '0x49a33a28c4c7d9576ab28898f4c9ac7e52ea457a', + '0xa93b98e57dde14a3e301f20933d59dc19bf8212e', + '0xe30663c6f83a06edee6273d72274ae24f1084a22', + '0x39f29773dcb94a32529d0612c6706c49622161d1', + '0xf93cc3a50f450ed245e003bfecc8a6ec1732b0b2', + '0xb55da3d3100c4ebf9de755b6ddc24bf209f6cc06', + '0x1926862f899410bfc19fefb8a3c69c7aed22463a', + '0x3ea60191b7d5990a3544b6ef79983fd67e85494a', + '0x27ca5e525ea473ed52ea9423cd08ccc081d96a98', + '0xd9e758bd239e5d568f44d0a748633f6a8d52cbbb', +] + +const failedJoins = [ + '0xbaa65281c2fa2baacb2cb550ba051525a480d3f4', + '0x65c79fcb50ca1594b025960e539ed7a9a6d434a3', + '0x19c0976f590d67707e62397c87829d896dc0f1f1', + '0x197e90f9fad81970ba7976f33cbd77088e5d7cf7', + '0x78f2c2af65126834c51822f56be0d7469d7a523e', + '0xab14d3ce3f733cacb76ec2abe7d2fcb00c99f3d5', + '0xbe8e3e3618f7474f8cb1d074a26affef007e98fb', + '0x4d95a049d5b0b7d32058cd3f2163015747522e99', + '0xa41b6ef151e06da0e34b009b86e828308986736d', + '0xa5679c04fc3d9d8b0aab1f0ab83555b301ca70ea', + '0xc7bdd1f2b16447dcf3de045c4a039a60ec2f0ba3', + '0x88f88bb9e66241b73b84f3a6e197fbba487b1e30', + '0xbb856d1742fd182a90239d7ae85706c2fe4e5922', + '0x29cfbd381043d00a98fd9904a431015fef07af2f', + '0x135954d155898d42c90d2a57824c690e0c7bef1b', + '0x1eb4cf3a948e7d72a198fe073ccb8c7a948cd853', + '0x2cc583c0aacdac9e23cb601fda8f1a0c56cdcb71', + '0x09e05ff6142f2f9de8b6b65855a1d56b6cfe4c58', + '0xa4c22f0e25c6630b2017979acf1f865e94695c4b', + '0x0e2e8f1d1326a4b9633d96222ce399c708b19c28', + '0x60744434d6339a6b27d73d9eda62b6f66a0a04fa', + '0x12f36cdea3a28c35ac8c6cc71d9265c17c74a27f', +] diff --git a/projects/makiswap/abi.json b/projects/makiswap/abi.json index ed099b779a9..f73548ff075 100644 --- a/projects/makiswap/abi.json +++ b/projects/makiswap/abi.json @@ -1,20 +1,4 @@ { - "totalPairs": { - "constant": true, - "inputs": [], - "name": "totalPairs", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "allPairs": { - "constant": true, - "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "name": "allPairs", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "payable": false, - "stateMutability": "view", - "type": "function" - } -} + "totalPairs": "uint256:totalPairs", + "allPairs": "function allPairs(uint256) view returns (address)" +} \ No newline at end of file diff --git a/projects/mama-dao/index.js b/projects/mama-dao/index.js index c9863d86385..9a1b1bd6622 100644 --- a/projects/mama-dao/index.js +++ b/projects/mama-dao/index.js @@ -1,8 +1,9 @@ +const ADDRESSES = require('../helper/coreAssets.json') const {ohmTvl} = require("../helper/ohm"); const treasury = "0x884f6A98477b0F689f1da280A83a963f2B768972"; const treasuryTokens = [ - ["0x8f3cf7ad23cd3cadbd9735aff958023239c6a063", false], // DAI + [ADDRESSES.polygon.DAI, false], // DAI ["0xBdDB96D54E1434654f8E46Dba41120cd652039bb", true] // MAMA-DAI UNI LP ] const stakingAddress = "0xe1B64E20921a38c20BE98f953F758e9DeD80F89b" diff --git a/projects/mango-farmers-club/index.js b/projects/mango-farmers-club/index.js new file mode 100644 index 00000000000..dc633f71d2b --- /dev/null +++ b/projects/mango-farmers-club/index.js @@ -0,0 +1,18 @@ +const { fetchURL } = require("../helper/utils"); + +module.exports = { + polygon_zkevm: { + staking: async (_, _1, _2, { api }) => { + const stakingBalance = await api.call({ + abi: 'erc20:balanceOf', + target: '0x1fa03edb1b8839a5319a7d2c1ae6aae492342bad', + params: "0xdd38211f2973dc41cd6fC4DB681596Fd6118D894", + }); + const { price : mangoPrice } = (await fetchURL('https://prod.clober-api.com/1101/markets/0x1FC38BA10E741F357b1c8B69DC08eA654c21Ae37/trades?limit=1')).data.trades[0] + return { + tether: mangoPrice * stakingBalance /1e18 + } + }, + tvl: () => ({}) + } +}; diff --git a/projects/mango-markets-v4/idl.json b/projects/mango-markets-v4/idl.json new file mode 100644 index 00000000000..c5414b0c9c5 --- /dev/null +++ b/projects/mango-markets-v4/idl.json @@ -0,0 +1,361 @@ +{ + "version": "0.16.0", + "name": "mango_v4", + "instructions": [], + "accounts": [ + { + "name": "Bank", + "type": { + "kind": "struct", + "fields": [ + { + "name": "group", + "type": "publicKey" + }, + { + "name": "name", + "type": { + "array": [ + "u8", + 16 + ] + } + }, + { + "name": "mint", + "type": "publicKey" + }, + { + "name": "vault", + "type": "publicKey" + }, + { + "name": "oracle", + "type": "publicKey" + }, + { + "name": "oracleConfig", + "type": { + "defined": "OracleConfig" + } + }, + { + "name": "stablePriceModel", + "type": { + "defined": "StablePriceModel" + } + }, + { + "name": "depositIndex", + "type": { + "defined": "I80F48" + } + }, + { + "name": "borrowIndex", + "type": { + "defined": "I80F48" + } + }, + { + "name": "indexedDeposits", + "type": { + "defined": "I80F48" + } + }, + { + "name": "indexedBorrows", + "type": { + "defined": "I80F48" + } + }, + { + "name": "indexLastUpdated", + "type": "u64" + }, + { + "name": "bankRateLastUpdated", + "type": "u64" + }, + { + "name": "avgUtilization", + "type": { + "defined": "I80F48" + } + }, + { + "name": "adjustmentFactor", + "type": { + "defined": "I80F48" + } + }, + { + "name": "util0", + "type": { + "defined": "I80F48" + } + }, + { + "name": "rate0", + "type": { + "defined": "I80F48" + } + }, + { + "name": "util1", + "type": { + "defined": "I80F48" + } + }, + { + "name": "rate1", + "type": { + "defined": "I80F48" + } + }, + { + "name": "maxRate", + "type": { + "defined": "I80F48" + } + }, + { + "name": "collectedFeesNative", + "type": { + "defined": "I80F48" + } + }, + { + "name": "loanOriginationFeeRate", + "type": { + "defined": "I80F48" + } + }, + { + "name": "loanFeeRate", + "type": { + "defined": "I80F48" + } + }, + { + "name": "maintAssetWeight", + "type": { + "defined": "I80F48" + } + }, + { + "name": "initAssetWeight", + "type": { + "defined": "I80F48" + } + }, + { + "name": "maintLiabWeight", + "type": { + "defined": "I80F48" + } + }, + { + "name": "initLiabWeight", + "type": { + "defined": "I80F48" + } + }, + { + "name": "liquidationFee", + "type": { + "defined": "I80F48" + } + }, + { + "name": "dust", + "type": { + "defined": "I80F48" + } + }, + { + "name": "flashLoanTokenAccountInitial", + "type": "u64" + }, + { + "name": "flashLoanApprovedAmount", + "type": "u64" + }, + { + "name": "tokenIndex", + "type": "u16" + }, + { + "name": "bump", + "type": "u8" + }, + { + "name": "mintDecimals", + "type": "u8" + }, + { + "name": "bankNum", + "type": "u32" + }, + { + "name": "minVaultToDepositsRatio", + "type": "f64" + }, + { + "name": "netBorrowLimitWindowSizeTs", + "type": "u64" + }, + { + "name": "lastNetBorrowsWindowStartTs", + "type": "u64" + }, + { + "name": "netBorrowLimitPerWindowQuote", + "type": "i64" + }, + { + "name": "netBorrowsInWindow", + "type": "i64" + }, + { + "name": "borrowWeightScaleStartQuote", + "type": "f64" + }, + { + "name": "depositWeightScaleStartQuote", + "type": "f64" + }, + { + "name": "reduceOnly", + "type": "u8" + }, + { + "name": "forceClose", + "type": "u8" + }, + { + "name": "reserved", + "type": { + "array": [ + "u8", + 2118 + ] + } + } + ] + } + } + ], + "types": [ + + { + "name": "OracleConfig", + "type": { + "kind": "struct", + "fields": [ + { + "name": "confFilter", + "type": { + "defined": "I80F48" + } + }, + { + "name": "maxStalenessSlots", + "type": "i64" + }, + { + "name": "reserved", + "type": { + "array": [ + "u8", + 72 + ] + } + } + ] + } + }, + { + "name": "I80F48", + "type": { + "kind": "struct", + "fields": [ + { + "name": "val", + "type": "i128" + } + ] + } + }, + + { + "name": "StablePriceModel", + "type": { + "kind": "struct", + "fields": [ + { + "name": "stablePrice", + "type": "f64" + }, + { + "name": "lastUpdateTimestamp", + "type": "u64" + }, + { + "name": "delayPrices", + "type": { + "array": [ + "f64", + 24 + ] + } + }, + { + "name": "delayAccumulatorPrice", + "type": "f64" + }, + { + "name": "delayAccumulatorTime", + "type": "u32" + }, + { + "name": "delayIntervalSeconds", + "type": "u32" + }, + { + "name": "delayGrowthLimit", + "type": "f32" + }, + { + "name": "stableGrowthLimit", + "type": "f32" + }, + { + "name": "lastDelayIntervalIndex", + "type": "u8" + }, + { + "name": "padding", + "type": { + "array": [ + "u8", + 7 + ] + } + }, + { + "name": "reserved", + "type": { + "array": [ + "u8", + 48 + ] + } + } + ] + } + } + ], + "events": [], + "errors": [] +} \ No newline at end of file diff --git a/projects/mango-markets-v4/index.js b/projects/mango-markets-v4/index.js new file mode 100644 index 00000000000..6a4ecfd061d --- /dev/null +++ b/projects/mango-markets-v4/index.js @@ -0,0 +1,24 @@ +const { Program } = require("@project-serum/anchor"); +const { getProvider, sumTokens2, } = require("../helper/solana"); +const idl = require('./idl.json') + +async function tvl() { + const provider = getProvider() + const program = new Program(idl, '4MangoMjqJ2firMokCjjGgoK8d4MXcrgL7XJaL3w6fVg', provider) + const banks = await program.account.bank.all() + return sumTokens2({ tokenAccounts: banks.map(i => i.account.vault) }) +} +async function borrowed() { + const { api } = arguments[3] + const provider = getProvider() + const program = new Program(idl, '4MangoMjqJ2firMokCjjGgoK8d4MXcrgL7XJaL3w6fVg', provider) + const banks = await program.account.bank.all() + banks.forEach(({ account: i }) => { + api.add(i.mint.toString(), i.indexedBorrows.val.mul(i.borrowIndex.val).toString() / (2**(48 * 2))) + }) +} + +module.exports = { + timetravel: false, + solana: { tvl, borrowed }, +} diff --git a/projects/manhattan/abi.json b/projects/manhattan/abi.json index 1639f4b9a0d..3c0e74a76ea 100644 --- a/projects/manhattan/abi.json +++ b/projects/manhattan/abi.json @@ -1,28 +1,4 @@ { - "Token": { - "inputs": [], - "name": "Token", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "checkInvestedLast": { - "inputs": [], - "name": "checkInvestedLast", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } + "Token": "address:Token", + "checkInvestedLast": "uint256:checkInvestedLast" } \ No newline at end of file diff --git a/projects/manhattan/index.js b/projects/manhattan/index.js index 362e73bf50c..c2956020f85 100644 --- a/projects/manhattan/index.js +++ b/projects/manhattan/index.js @@ -1,63 +1,33 @@ const sdk = require("@defillama/sdk"); -const abi = require("./abi.json"); -const { transformFantomAddress } = require("../helper/portedTokens"); +const { sumTokens2 } = require('../helper/unwrapLPs') -var ifTokens = [ - "0xbb4F9c4CaE5D08AB0C02De724B3c51C28e8c181d", - "0x00C38025F12F239B72dadc09a4B93F8830c462C0", - "0x20FF28c943DE978dd7Ff3Af1f94a921A257cC7Cc", - "0xacdAe58fA05cc449A6f099Cf42cF6a2C7A0317a6", - "0x51086a97a72AB9a7022d5Cf3Fd2a5FeDE4d7bec8", - "0x391E1bfc9851a518022815Fe786707c2E786f0Ca", - "0x4Bbd947d5E04D6fC90eaeD18084B68F88279D73e", - "0x29e65a3846AE97DD4A584C20383C53Bffe2a0130", - "0x614062ED8b4dAc60DED33f357bA2A604F2C65D18", - "0xF842F73e47A5f191deFb79e61E836545712144Ad", - "0x522225662A7050D890cFe7D3Ecd49ac411f09c69", - "0xF2486A76368463dd463188E6ba09A6C66E1c7479", - "0x81c2DbE1Cd07539eB1104cd267Bec21800F3bC20", -]; - -async function tvl(timestamp, block, chainBlocks) { - block = chainBlocks.fantom - let balances = {}; - let transform = await transformFantomAddress(); - - const underlying = ( - await sdk.api.abi.multiCall({ - block, - abi: abi.Token, - calls: ifTokens.map((t) => ({ - target: t, - })), - chain: "fantom", - }) - ).output.map((o) => o.output); - - const balance = ( - await sdk.api.abi.multiCall({ - block, - abi: abi.checkInvestedLast, - calls: ifTokens.map((t) => ({ - target: t, - })), - chain: "fantom", - }) - ).output.map((o) => o.output); - - for (let i = 0; i < underlying.length; i++) { - sdk.util.sumSingleBalance( - balances, - transform(underlying[i]), - balance[i] - ); - }; +const config = { + polygon: { + pools: [ + '0x4b7509ce029656341D0B59D387D9B5312E41615a', + '0x34fa22892256216a659D4f635354250b4D771458', + ] + }, + moonbeam: { + pools: [ + '0x3A82F4da24F93a32dc3C2A28cFA9D6E63EC28531', + '0x3756465c5b1C1C4cEe473880c9726E20875284f1', + ] + } +} - return balances; -}; +module.exports = {}; -module.exports = { - fantom: { - tvl, - }, -}; +Object.keys(config).forEach(chain => { + const { pools } = config[chain] + module.exports[chain] = { + tvl: async (_, _b, {[chain]: block}) => { + const collaterals = await sdk.api2.abi.multiCall({ + abi: "address:collateral", + calls: pools, + chain, block, + }) + return sumTokens2({ chain, block, tokensAndOwners: collaterals.map((i, idx) => ([i, pools[idx]]))}) + } + } +}) diff --git a/projects/manifest/index.js b/projects/manifest/index.js index cb0b1deb2bd..84bf5197508 100644 --- a/projects/manifest/index.js +++ b/projects/manifest/index.js @@ -1,8 +1,9 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { ohmTvl } = require("../helper/ohm"); const treasuryAddress = "0x200a433086C37eB55bc4CD31f8195831052a67C6"; module.exports = ohmTvl(treasuryAddress, [ ["0x04f2694c8fcee23e8fd0dfea1d4f5bb8c352111f", false], // sOHM ["0x89c4d11dfd5868d847ca26c8b1caa9c25c712cef", true], // MNFST-OHM - ["0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", false] // WETH + [ADDRESSES.ethereum.WETH, false] // WETH ], "ethereum", "0x9c9022c6a2e1ed9f3110e177763123c4400d5eb6", "0x21585bbcd5bdc3f5737620cf0db2e51978cf60ac") diff --git a/projects/manifesto/index.js b/projects/manifesto/index.js new file mode 100644 index 00000000000..41468a3c687 --- /dev/null +++ b/projects/manifesto/index.js @@ -0,0 +1,33 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require("../helper/unknownTokens"); +const lps = [ + '0xF65af1E61D7aC87d73E347D17E369Dc2118E9517', +] + +module.exports = { + hallmarks: [ + [1676332800, "Rug Pull"] + ], + misrepresentedTokens: true, + canto: { + tvl: sumTokensExport({ + owner: '0x20636bd0E15be0e1faADE1b27f568e642f59814E', + tokens: [ + ADDRESSES.canto.NOTE, + ADDRESSES.canto.WCANTO, + ADDRESSES.functionx.PURSE, + ADDRESSES.functionx.WFX, + ...lps, + ], + useDefaultCoreAssets: true, + }), + staking: sumTokensExport({ + owner: '0xbE718E9431c4E25F4Af710f085a475074e24D7Cd', + tokens: [ + '0xfC65316f26949B268f82519256C159B23ACC938F', + ], + lps, + useDefaultCoreAssets: true, + }), + } +} diff --git a/projects/mantleswap/index.js b/projects/mantleswap/index.js new file mode 100644 index 00000000000..587f2f200a1 --- /dev/null +++ b/projects/mantleswap/index.js @@ -0,0 +1,30 @@ +const { getLogs } = require('../helper/cache/getLogs') +const { transformDexBalances } = require('../helper/portedTokens') + + +module.exports = { + misrepresentedTokens: true, + mantle: { + tvl + } +} + +async function tvl(_, _b, _cb, { api, }) { + const logs = await getLogs({ + api, + target: '0x5c84e5d27fc7575D002fe98c5A1791Ac3ce6fD2f', + topics: ['0x0d3648bd0f6ba80134a33ba9275ac585d9d315f0ad8355cddefde31afa28d0e9'], + eventAbi: 'event PairCreated(address indexed token0, address indexed token1, address pair, uint256 )', + onlyArgs: true, + fromBlock: 5964, + }) + const tok0Bals = await api.multiCall({ abi: 'erc20:balanceOf', calls: logs.map(i => ({ target: i.token0, params: i.pair}))}) + const tok1Bals = await api.multiCall({ abi: 'erc20:balanceOf', calls: logs.map(i => ({ target: i.token1, params: i.pair}))}) + return transformDexBalances({ chain: api.chain, data: logs.map((log, i) => ({ + token0: log.token0, + token0Bal: tok0Bals[i], + token1: log.token1, + token1Bal: tok1Bals[i], + }))}) + +} \ No newline at end of file diff --git a/projects/maple-rwa/index.js b/projects/maple-rwa/index.js new file mode 100644 index 00000000000..4f5adf1285d --- /dev/null +++ b/projects/maple-rwa/index.js @@ -0,0 +1,16 @@ + +const rwaPools = [ + '0xfe119e9C24ab79F1bDd5dd884B86Ceea2eE75D92', // Cash Management + '0xe9d33286f0E37f517B1204aA6dA085564414996d', // AQRU +] + +async function tvl(_, _b, _cb, { api, }) { + const tokens = await api.multiCall({ abi: 'address:asset', calls: rwaPools }) + const bals = await api.multiCall({ abi: 'uint256:totalAssets', calls: rwaPools }) + api.addTokens(tokens, bals) +} + +module.exports = { + doublecounted: true, + ethereum: { tvl, } +} \ No newline at end of file diff --git a/projects/maple/abi.json b/projects/maple/abi.json index e10b1f0b2af..2a0e4995eee 100644 --- a/projects/maple/abi.json +++ b/projects/maple/abi.json @@ -1,86 +1,8 @@ { - "pools": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "pools", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "poolsCreated": { - "inputs": [], - "name": "poolsCreated", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "liquidityAsset": { - "inputs": [], - "name": "liquidityAsset", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "totalSupply": { - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "liquidityLocker": { - "inputs": [], - "name": "liquidityLocker", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "principalOut": { - "inputs": [], - "name": "principalOut", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } + "pools": "function pools(uint256) view returns (address)", + "poolsCreated": "uint256:poolsCreated", + "liquidityAsset": "address:liquidityAsset", + "totalSupply": "uint256:totalSupply", + "liquidityLocker": "address:liquidityLocker", + "principalOut": "uint256:principalOut" } \ No newline at end of file diff --git a/projects/maple/index.js b/projects/maple/index.js index 52c6114c230..b18f8989209 100644 --- a/projects/maple/index.js +++ b/projects/maple/index.js @@ -1,107 +1,12 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); -const abi = require("./abi.json"); -const { sumTokensAndLPsSharedOwners, sumTokens2 } = require("../helper/unwrapLPs"); +const { sumTokens2 } = require("../helper/unwrapLPs"); const { staking, } = require("../helper/staking") const { getConnection, getTokenBalance } = require('../helper/solana') const { PublicKey } = require('@solana/web3.js') +const { getLogs } = require('../helper/cache/getLogs') -const PoolFactory = "0x2Cd79F7f8b38B9c0D80EA6B230441841A31537eC"; - -const MapleTreasury = "0xa9466EaBd096449d650D5AEB0dD3dA6F52FD0B19"; -const USDC = "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"; -const chain = 'ethereum' - -/*** Treasury ***/ -const Treasury = async (timestamp, ethBlock, chainBlocks) => { - const balances = {}; - - await sumTokensAndLPsSharedOwners( - balances, - [[USDC, false]], - [MapleTreasury], - chainBlocks["ethereum"], - "ethereum", - addr => addr - ); - - return balances; -}; - -/*** Ethereum TVL Portions ***/ -const ethTvl = async (timestamp, block) => { - const poolsCreated = ( - await sdk.api.abi.call({ - abi: abi.poolsCreated, - target: PoolFactory, - block - }) - ).output; - const calls = [] - - for (let i = 0; i < poolsCreated; i++) - calls.push({ params: i }) - - const { output: pools } = await sdk.api.abi.multiCall({ - target: PoolFactory, - abi: abi.pools, - calls, - chain, block, - }) - - const { output: assetOfLiquidity } = await sdk.api.abi.multiCall({ - abi: abi.liquidityAsset, - calls: pools.map(i => ({ target: i.output })), - chain, block, - }) - - const { output: locker } = await sdk.api.abi.multiCall({ - abi: abi.liquidityLocker, - calls: pools.map(i => ({ target: i.output })), - chain, block, - }) - - const toa = assetOfLiquidity.map(({ output }, i) => [output, locker[i].output]) - - return sumTokens2({ tokensAndOwners: toa, block }) -}; - - -const borrowed = async (timestamp, block) => { - const poolsCreated = ( - await sdk.api.abi.call({ - abi: abi.poolsCreated, - target: PoolFactory, - block - }) - ).output; - const calls = [] - - for (let i = 0; i < poolsCreated; i++) - calls.push({ params: i }) - - const { output: pools } = await sdk.api.abi.multiCall({ - target: PoolFactory, - abi: abi.pools, - calls, - chain, block, - }) - - const { output: assetOfLiquidity } = await sdk.api.abi.multiCall({ - abi: abi.liquidityAsset, - calls: pools.map(i => ({ target: i.output })), - chain, block, - }) - - const { output: principalOut } = await sdk.api.abi.multiCall({ - abi: abi.principalOut, - calls: pools.map(i => ({ target: i.output })), - chain, block, - }) - - const balances = {} - assetOfLiquidity.forEach(({ output }, i) => sdk.util.sumSingleBalance(balances, output, principalOut[i].output)) - return balances -}; +const USDC = ADDRESSES.ethereum.USDC; /*** Solana TVL Portions ***/ const POOL_DISCRIMINATOR = "35K4P9PCU"; @@ -110,7 +15,7 @@ const TVL_DATA_SIZE = 8; const PROGRAM_ID = "5D9yi4BKrxF8h65NkVE1raCCWFKUs5ngub2ECxhvfaZe"; let _tvl -const usdc = 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v' +const usdc = ADDRESSES.solana.USDC function getTvl(borrowed = false) { return async () => { @@ -141,6 +46,7 @@ async function getSolanaTVL() { tvlValue += loanBalance * 1e6 borrowed += poolTvl - loanBalance * 1e6 } + if (borrowed < 0) borrowed = 0 return { tvl: { @@ -152,15 +58,67 @@ async function getSolanaTVL() { }; } +const pInfos = {} + +async function getPoolInfo(block, api) { + if (!pInfos[block]) pInfos[block] = _getPoolInfo() + return pInfos[block] + + async function _getPoolInfo() { + const loanFactory = '0x1551717ae4fdcb65ed028f7fb7aba39908f6a7a6' + const openTermLoanManagerFactory = '0x90b14505221a24039A2D11Ad5862339db97Cc160' + + const logs = await getLogs({ + api, + target: loanFactory, + topic: "InstanceDeployed(uint256,address,bytes)", + fromBlock: 16126995, + }); + const logs2 = await getLogs({ // open term + api, + target: openTermLoanManagerFactory, + topic: "InstanceDeployed(uint256,address,bytes)", + fromBlock: 17372608, + }); + + let proxies = logs.map(s => "0x" + s.topics[2].slice(26, 66)) + const proxiesOpenTerm = logs2.map(s => "0x" + s.topics[2].slice(26, 66)) + proxies.push(...proxiesOpenTerm) + proxies = [...new Set(proxies.map(i => i.toLowerCase()))] + const managers = await api.multiCall({ abi: 'address:poolManager', calls: proxies }) + const assets = await api.multiCall({ block, abi: abis.fundsAsset, calls: proxies, }) + return { proxies, assets, managers } + } +} + +async function ethTvl2(_, block, _1, { api }) { + const { managers, assets, } = await getPoolInfo(block, api) + const pools = await api.multiCall({ + abi: abis.pool, + calls: managers, + }) + + return sumTokens2({ block, tokensAndOwners: pools.map((o, i) => ([assets[i], o])) }) +} + +async function borrowed2(_, block, _1, { api }) { + const balances = {} + const { proxies, assets, } = await getPoolInfo(block, api) + const principalOut = await api.multiCall({ + abi: abis.principalOut, + calls: proxies, + }) + principalOut.forEach((val, i) => sdk.util.sumSingleBalance(balances, assets[i], val)) + return balances +} module.exports = { misrepresentedTokens: true, timetravel: false, ethereum: { - tvl: ethTvl, - treasury: Treasury, + tvl: sdk.util.sumChainTvls([ethTvl2]), staking: staking('0x4937a209d4cdbd3ecd48857277cfd4da4d82914c', '0x33349b282065b0284d756f0577fb39c158f935e6'), - borrowed, + borrowed: sdk.util.sumChainTvls([borrowed2]), }, solana: { tvl: getTvl(), @@ -169,3 +127,9 @@ module.exports = { methodology: "We count liquidity by USDC deposited on the pools through PoolFactory contract", } + +const abis = { + fundsAsset: "address:fundsAsset", + principalOut: "uint128:principalOut", + pool: "address:pool", +} \ No newline at end of file diff --git a/projects/mare-finance-v2/index.js b/projects/mare-finance-v2/index.js new file mode 100644 index 00000000000..c4848883fea --- /dev/null +++ b/projects/mare-finance-v2/index.js @@ -0,0 +1,11 @@ +const { compoundExports } = require("../helper/compound"); +const { staking } = require("../helper/staking"); + +const unitroller = "0xFcD7D41D5cfF03C7f6D573c9732B0506C72f5C72"; + +module.exports = { + methodology: "Same as Compound Finance, we just count all the tokens supplied (not borrowed money) on the lending markets", + kava: { + ...compoundExports(unitroller, "kava"), + }, +} \ No newline at end of file diff --git a/projects/mare-finance/index.js b/projects/mare-finance/index.js new file mode 100644 index 00000000000..3239fb09713 --- /dev/null +++ b/projects/mare-finance/index.js @@ -0,0 +1,12 @@ +const { compoundExports } = require("../helper/compound"); +const { staking } = require("../helper/staking"); + +const unitroller = "0x4804357AcE69330524ceb18F2A647c3c162E1F95"; + +module.exports = { + methodology: "Same as Compound Finance, we just count all the tokens supplied (not borrowed money) on the lending markets", + kava: { + ...compoundExports(unitroller, "kava"), + staking: staking(['0x2c4A1f47c3E15F468399A87c4B41ec0d19297772', '0x194AAd54F363D28aDEaE53A7957d63B9BCf8a6b2'], '0xd86C8d4279CCaFbec840c782BcC50D201f277419') + }, +} \ No newline at end of file diff --git a/projects/marginfi/idl.js b/projects/marginfi/idl.js new file mode 100644 index 00000000000..1e3c755527b --- /dev/null +++ b/projects/marginfi/idl.js @@ -0,0 +1,763 @@ +module.exports = { + version: '0.1.0', + name: 'marginfi', + instructions: [], + accounts: [ + { + name: 'bank', + type: { + kind: 'struct', + fields: [ + { + name: 'mint', + type: 'publicKey' + }, + { + name: 'mintDecimals', + type: 'u8' + }, + { + name: 'group', + type: 'publicKey' + }, + { + name: 'ignore1', + type: { + array: [ + 'u8', + 7 + ] + } + }, + { + name: 'assetShareValue', + type: { + defined: 'WrappedI80F48' + } + }, + { + name: 'liabilityShareValue', + type: { + defined: 'WrappedI80F48' + } + }, + { + name: 'liquidityVault', + type: 'publicKey' + }, + { + name: 'liquidityVaultBump', + type: 'u8' + }, + { + name: 'liquidityVaultAuthorityBump', + type: 'u8' + }, + { + name: 'insuranceVault', + type: 'publicKey' + }, + { + name: 'insuranceVaultBump', + type: 'u8' + }, + { + name: 'insuranceVaultAuthorityBump', + type: 'u8' + }, + { + name: 'ignore2', + type: { + array: [ + 'u8', + 4 + ] + } + }, + { + name: 'collectedInsuranceFeesOutstanding', + type: { + defined: 'WrappedI80F48' + } + }, + { + name: 'feeVault', + type: 'publicKey' + }, + { + name: 'feeVaultBump', + type: 'u8' + }, + { + name: 'feeVaultAuthorityBump', + type: 'u8' + }, + { + name: 'ignore3', + type: { + array: [ + 'u8', + 6 + ] + } + }, + { + name: 'collectedGroupFeesOutstanding', + type: { + defined: 'WrappedI80F48' + } + }, + { + name: 'totalLiabilityShares', + type: { + defined: 'WrappedI80F48' + } + }, + { + name: 'totalAssetShares', + type: { + defined: 'WrappedI80F48' + } + }, + { + name: 'lastUpdate', + type: 'i64' + }, + { + name: 'config', + type: { + defined: 'BankConfig' + } + }, + { + name: 'emissionsFlags', + docs: [ + 'Emissions Config Flags', + '', + '- EMISSIONS_FLAG_BORROW_ACTIVE: 1', + '- EMISSIONS_FLAG_LENDING_ACTIVE: 2', + '' + ], + type: 'u64' + }, + { + name: 'emissionsRate', + docs: [ + 'Emissions APR.', + 'Number of emitted tokens (emissions_mint) per 1M tokens (bank mint) (native amount) per 1 YEAR.' + ], + type: 'u64' + }, + { + name: 'emissionsRemaining', + type: { + defined: 'WrappedI80F48' + } + }, + { + name: 'emissionsMint', + type: 'publicKey' + }, + { + name: 'padding0', + type: { + array: [ + 'u128', + 28 + ] + } + }, + { + name: 'padding1', + type: { + array: [ + 'u128', + 32 + ] + } + } + ] + } + } + ], + types: [ + { + name: 'LendingAccount', + type: { + kind: 'struct', + fields: [ + { + name: 'balances', + type: { + array: [ + { + defined: 'Balance' + }, + 16 + ] + } + }, + { + name: 'padding', + type: { + array: [ + 'u64', + 8 + ] + } + } + ] + } + }, + { + name: 'Balance', + type: { + kind: 'struct', + fields: [ + { + name: 'active', + type: 'bool' + }, + { + name: 'bankPk', + type: 'publicKey' + }, + { + name: 'ignore', + type: { + array: [ + 'u8', + 7 + ] + } + }, + { + name: 'assetShares', + type: { + defined: 'WrappedI80F48' + } + }, + { + name: 'liabilityShares', + type: { + defined: 'WrappedI80F48' + } + }, + { + name: 'emissionsOutstanding', + type: { + defined: 'WrappedI80F48' + } + }, + { + name: 'lastUpdate', + type: 'u64' + }, + { + name: 'padding', + type: { + array: [ + 'u64', + 1 + ] + } + } + ] + } + }, + { + name: 'GroupConfig', + type: { + kind: 'struct', + fields: [ + { + name: 'admin', + type: { + option: 'publicKey' + } + } + ] + } + }, + { + name: 'InterestRateConfig', + type: { + kind: 'struct', + fields: [ + { + name: 'optimalUtilizationRate', + type: { + defined: 'WrappedI80F48' + } + }, + { + name: 'plateauInterestRate', + type: { + defined: 'WrappedI80F48' + } + }, + { + name: 'maxInterestRate', + type: { + defined: 'WrappedI80F48' + } + }, + { + name: 'insuranceFeeFixedApr', + type: { + defined: 'WrappedI80F48' + } + }, + { + name: 'insuranceIrFee', + type: { + defined: 'WrappedI80F48' + } + }, + { + name: 'protocolFixedFeeApr', + type: { + defined: 'WrappedI80F48' + } + }, + { + name: 'protocolIrFee', + type: { + defined: 'WrappedI80F48' + } + }, + { + name: 'padding', + type: { + array: [ + 'u128', + 8 + ] + } + } + ] + } + }, + { + name: 'InterestRateConfigOpt', + type: { + kind: 'struct', + fields: [ + { + name: 'optimalUtilizationRate', + type: { + option: { + defined: 'WrappedI80F48' + } + } + }, + { + name: 'plateauInterestRate', + type: { + option: { + defined: 'WrappedI80F48' + } + } + }, + { + name: 'maxInterestRate', + type: { + option: { + defined: 'WrappedI80F48' + } + } + }, + { + name: 'insuranceFeeFixedApr', + type: { + option: { + defined: 'WrappedI80F48' + } + } + }, + { + name: 'insuranceIrFee', + type: { + option: { + defined: 'WrappedI80F48' + } + } + }, + { + name: 'protocolFixedFeeApr', + type: { + option: { + defined: 'WrappedI80F48' + } + } + }, + { + name: 'protocolIrFee', + type: { + option: { + defined: 'WrappedI80F48' + } + } + } + ] + } + }, + { + name: 'BankConfig', + docs: [ + 'TODO: Convert weights to (u64, u64) to avoid precision loss (maybe?)' + ], + type: { + kind: 'struct', + fields: [ + { + name: 'assetWeightInit', + type: { + defined: 'WrappedI80F48' + } + }, + { + name: 'assetWeightMaint', + type: { + defined: 'WrappedI80F48' + } + }, + { + name: 'liabilityWeightInit', + type: { + defined: 'WrappedI80F48' + } + }, + { + name: 'liabilityWeightMaint', + type: { + defined: 'WrappedI80F48' + } + }, + { + name: 'depositLimit', + type: 'u64' + }, + { + name: 'interestRateConfig', + type: { + defined: 'InterestRateConfig' + } + }, + { + name: 'operationalState', + type: { + defined: 'BankOperationalState' + } + }, + { + name: 'oracleSetup', + type: 'u8' + }, + { + name: 'oracleKeys', + type: { + array: [ + 'publicKey', + 5 + ] + } + }, + { + name: 'ignore1', + type: { + array: [ + 'u8', + 6 + ] + } + }, + { + name: 'borrowLimit', + type: 'u64' + }, + { + name: 'riskTier', + type: { + defined: 'RiskTier' + } + }, + { + name: 'padding', + type: { + array: [ + 'u8', + 55 + ] + } + } + ] + } + }, + { + name: 'WrappedI80F48', + type: { + kind: 'struct', + fields: [ + { + name: 'value', + type: 'i128' + } + ] + } + }, + { + name: 'BankConfigOpt', + type: { + kind: 'struct', + fields: [ + { + name: 'assetWeightInit', + type: { + option: { + defined: 'WrappedI80F48' + } + } + }, + { + name: 'assetWeightMaint', + type: { + option: { + defined: 'WrappedI80F48' + } + } + }, + { + name: 'liabilityWeightInit', + type: { + option: { + defined: 'WrappedI80F48' + } + } + }, + { + name: 'liabilityWeightMaint', + type: { + option: { + defined: 'WrappedI80F48' + } + } + }, + { + name: 'depositLimit', + type: { + option: 'u64' + } + }, + { + name: 'borrowLimit', + type: { + option: 'u64' + } + }, + { + name: 'operationalState', + type: { + option: { + defined: 'BankOperationalState' + } + } + }, + { + name: 'oracle', + type: { + option: { + defined: 'OracleConfig' + } + } + }, + { + name: 'interestRateConfig', + type: { + option: { + defined: 'InterestRateConfigOpt' + } + } + }, + { + name: 'riskTier', + type: { + option: { + defined: 'RiskTier' + } + } + } + ] + } + }, + { + name: 'OracleConfig', + type: { + kind: 'struct', + fields: [ + { + name: 'setup', + type: { + defined: 'OracleSetup' + } + }, + { + name: 'keys', + type: { + array: [ + 'publicKey', + 5 + ] + } + } + ] + } + }, + { + name: 'BalanceIncreaseType', + type: { + kind: 'enum', + variants: [ + { + name: 'Any' + }, + { + name: 'RepayOnly' + }, + { + name: 'DepositOnly' + } + ] + } + }, + { + name: 'BalanceDecreaseType', + type: { + kind: 'enum', + variants: [ + { + name: 'Any' + }, + { + name: 'WithdrawOnly' + }, + { + name: 'BorrowOnly' + }, + { + name: 'BypassBorrowLimit' + } + ] + } + }, + { + name: 'WeightType', + type: { + kind: 'enum', + variants: [ + { + name: 'Initial' + }, + { + name: 'Maintenance' + } + ] + } + }, + { + name: 'BalanceSide', + type: { + kind: 'enum', + variants: [ + { + name: 'Assets' + }, + { + name: 'Liabilities' + } + ] + } + }, + { + name: 'RiskRequirementType', + type: { + kind: 'enum', + variants: [ + { + name: 'Initial' + }, + { + name: 'Maintenance' + } + ] + } + }, + { + name: 'BankOperationalState', + type: { + kind: 'enum', + variants: [ + { + name: 'Paused' + }, + { + name: 'Operational' + }, + { + name: 'ReduceOnly' + } + ] + } + }, + { + name: 'RiskTier', + type: { + kind: 'enum', + variants: [ + { + name: 'Collateral' + }, + { + name: 'Isolated' + } + ] + } + }, + { + name: 'BankVaultType', + type: { + kind: 'enum', + variants: [ + { + name: 'Liquidity' + }, + { + name: 'Insurance' + }, + { + name: 'Fee' + } + ] + } + }, + { + name: 'OracleSetup', + type: { + kind: 'enum', + variants: [ + { + name: 'None' + }, + { + name: 'PythEma' + }, + { + name: 'SwitchboardV2' + } + ] + } + } + ], + events: [], + errors: [] +} \ No newline at end of file diff --git a/projects/marginfi/index.js b/projects/marginfi/index.js new file mode 100644 index 00000000000..075e5bc5933 --- /dev/null +++ b/projects/marginfi/index.js @@ -0,0 +1,15 @@ +const { Program } = require("@project-serum/anchor"); +const { getProvider, sumTokens2, } = require("../helper/solana"); +const idl = require('./idl') + +async function tvl() { + const provider = getProvider() + const program = new Program(idl, 'MFv2hWf31Z9kbCa1snEPYctwafyhdvnV7FZnsebVacA', provider) + const banks = await program.account.bank.all() + return sumTokens2({ tokenAccounts: banks.map(i => i.account.liquidityVault.toString()) }) +} + +module.exports = { + timetravel: false, + solana: { tvl, }, +} diff --git a/projects/marginx/index.js b/projects/marginx/index.js new file mode 100644 index 00000000000..ea552d4893b --- /dev/null +++ b/projects/marginx/index.js @@ -0,0 +1,30 @@ +const { sumTokens } = require('../helper/chain/cosmos') +const { getConfig } = require('../helper/cache'); +const bech32 = require('bech32'); +const { ethers } = require("ethers"); + +const toChecksumAddress = (address) => { + return ethers.utils.getAddress(address) +}; + +function bech32ToEthereum(bech32Address) { + const { prefix, words } = bech32.decode(bech32Address); + const data = bech32.fromWords(words); + const hex = Buffer.from(data).toString('hex'); + const ethereumAddress = toChecksumAddress(`0x${hex}`); + return ethereumAddress; +} + +async function tvl(_, _b, _cb, { api, }) { + const { data: chainInfo} = await getConfig('marginxConfig', 'https://api.marginx.io/settings/cross/chains') + const owners = chainInfo.map(i => i.ibcAddress) + return sumTokens({ chain: 'fxcore', owners }) + // const owners = chainInfo.map(i => bech32ToEthereum(i.ibcAddress)) + // return sumTokens2({ api, owners, tokens: [ADDRESSES.null, ADDRESSES.functionx.USDT], }) +} + +module.exports = { + functionx: { + tvl + }, +}; diff --git a/projects/market.xyz/abi.js b/projects/market.xyz/abi.js index a7fe48f1d18..36ab78b8c1f 100644 --- a/projects/market.xyz/abi.js +++ b/projects/market.xyz/abi.js @@ -1,70 +1 @@ -module.exports = { - inputs: [], - name: "getPublicPoolsWithData", - outputs: [ - { - internalType: "uint256[]", - name: "", - type: "uint256[]", - }, - { - components: [ - { - internalType: "string", - name: "name", - type: "string", - }, - { - internalType: "address", - name: "creator", - type: "address", - }, - { - internalType: "address", - name: "comptroller", - type: "address", - }, - { - internalType: "uint256", - name: "blockPosted", - type: "uint256", - }, - { - internalType: "uint256", - name: "timestampPosted", - type: "uint256", - }, - ], - internalType: "struct FusePoolDirectory.FusePool[]", - name: "", - type: "tuple[]", - }, - { - internalType: "uint256[]", - name: "", - type: "uint256[]", - }, - { - internalType: "uint256[]", - name: "", - type: "uint256[]", - }, - { - internalType: "address[][]", - name: "", - type: "address[][]", - }, - { - internalType: "string[][]", - name: "", - type: "string[][]", - }, - { - internalType: "bool[]", - name: "", - type: "bool[]", - }, - ], - stateMutability: "nonpayable", - type: "function", -}; +module.exports = 'function getPublicPoolsWithData() returns (uint256[], tuple(string name, address creator, address comptroller, uint256 blockPosted, uint256 timestampPosted)[], uint256[], uint256[], address[][], string[][], bool[])'; diff --git a/projects/market.xyz/index.js b/projects/market.xyz/index.js index 8cd571c4ca7..c9509632160 100644 --- a/projects/market.xyz/index.js +++ b/projects/market.xyz/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const abi = require("./abi"); const { @@ -10,7 +11,7 @@ const fusePoolLensAddress = { fantom: "0x5aB6215AB8344C28B899efdE93BEe47B124200Fb", }; -const WETH = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'; +const WETH = ADDRESSES.ethereum.WETH; async function getFusePools( timestamp, @@ -80,7 +81,7 @@ module.exports = { borrowed: polygonBorrowed, }, fantom: { - tvl: fantomTvl, - borrowed: fantomBorrowed, + tvl: () => ({}), + borrowed: () => ({}), }, }; diff --git a/projects/mars/index.js b/projects/mars/index.js index 6c1b9eb0cd3..a9b9d4b2bfb 100644 --- a/projects/mars/index.js +++ b/projects/mars/index.js @@ -1,13 +1,153 @@ -const zero = (timestamp, block) => ({}); +const sdk = require('@defillama/sdk'); +const axios = require('axios'); + +const { endPoints, queryContract, sumTokens } = require('../helper/chain/cosmos'); +const { getChainTransform } = require('../helper/portedTokens'); + +const addresses = { + osmosis: { + redBank: 'osmo1c3ljch9dfw5kf52nfwpxd2zmj2ese7agnx0p9tenkrryasrle5sqf3ftpg', + creditManager: 'osmo1f2m24wktq0sw3c0lexlg7fv4kngwyttvzws3a3r3al9ld2s2pvds87jqvf', + }, + neutron: { + redBank: 'neutron1n97wnm7q6d2hrcna3rqlnyqw2we6k0l8uqvmyqq6gsml92epdu7quugyph', + } +} + + +// OSMOSIS + +async function osmosisTVL() { + let balances = {}; + await addRedBankTvl(balances, 'osmosis'); + await osmosisSumVaultsTVL(balances); + return balances; +} + +async function osmosisSumVaultsTVL(balances) { + let coins = []; + let vaultPagesRemaining = true; + let startAfter = null; + const pageLimit = 10; + const osmosisDenomTransform = await getChainTransform('osmosis'); + + while (vaultPagesRemaining) { + const fieldsVaultsInfo = await queryContract({ + contract: addresses.osmosis.creditManager, + chain: 'osmosis', + data: { 'vaults_info': { limit: pageLimit, 'start_after': startAfter } } + }); + + if(fieldsVaultsInfo.length === pageLimit) { + startAfter = fieldsVaultsInfo[fieldsVaultsInfo.length - 1].vault; + vaultPagesRemaining = true + } else { + vaultPagesRemaining = false; + } + + await osmosisAddCoinsForVaultsInfoPage(coins, fieldsVaultsInfo); + } + + coins.forEach(coin => { + sdk.util.sumSingleBalance(balances, osmosisDenomTransform(coin.denom), coin.amount); + }) +} + +async function osmosisAddCoinsForVaultsInfoPage(coins, fieldsVaultsInfoPage) { + let vaultsMetadata = fieldsVaultsInfoPage.map(rvi => ({ fieldsVaultInfo: rvi })); + + // query the vault info for the vault contract itself to get the vault's + // base token + await Promise.all(vaultsMetadata.map(async vm => { + let vaultInfo = await queryContract({ + contract: vm.fieldsVaultInfo.vault.address, + chain: 'osmosis', + data: { 'info': {} } + }); + vm.vaultInfo = vaultInfo; + })); + + // get total vault shares owned by fields for each vault + await Promise.all(vaultsMetadata.map(async vm => { + let vaultShares = await queryContract({ + contract: addresses.osmosis.creditManager, + chain: 'osmosis', + data: { 'total_vault_coin_balance': { vault: vm.fieldsVaultInfo.vault } } + }); + vm.vaultShares = vaultShares; + })); + + // convert vault shares to vault base asset + await Promise.all(vaultsMetadata.map( async vm => { + let query = { + contract: vm.fieldsVaultInfo.vault.address, + chain: 'osmosis', + data: { 'convert_to_assets': { amount: vm.vaultShares } } + }; + let amount = await queryContract(query); + vm.baseTokenAmount = amount; + })); + + // Add coins to then be added to balances + // * For gamm lp tokens compute the share of underlying assets and add those + // * For other assets, add as is + await Promise.all(vaultsMetadata.map( async vm => { + const baseToken = vm.vaultInfo['base_token']; + if (baseToken.startsWith('gamm/pool/')) { + let poolId = baseToken.split('/')[2]; + const url = `osmosis/gamm/v1beta1/pools/${poolId}`; + const query = await cosmosLCDQuery(url, 'osmosis'); + const pool = query.pool; + pool['pool_assets'].forEach(asset => { + const denom = asset.token.denom; + const amount = asset.token.amount * vm.baseTokenAmount / pool['total_shares'].amount; + coins.push({denom, amount}); + }); + } else { + coins.push({denom: baseToken, amount: vm.baseTokenAmount}); + } + })); +} + +// NEUTRON + +async function neutronTVL() { + let balances = {}; + await addRedBankTvl(balances, 'neutron'); + return balances; +} + +// HELPERS + +async function addRedBankTvl(balances, chain) { + await sumTokens({balances, owners: [addresses[chain].redBank], chain}); +} + +function getEndpoint(chain) { + if (!endPoints[chain]) throw new Error('Chain not found: ' + chain); + return endPoints[chain]; +} + +async function cosmosLCDQuery(url, chain) { + let endpoint = `${getEndpoint(chain)}/${url}`; + let request = await axios.get(endpoint); + return request.data; +} module.exports = { timetravel: false, - methodology: "We query Mars protocol smart contracts to get the amount of assets deposited and borrowed, then use CoinGecko to price the assets in USD.", + methodology: 'For each chain, sum up token balances in Red Bank smart contracts and vault underlying assets in Fields smart contracts', + osmosis: { + tvl: osmosisTVL, + }, + neutron: { + tvl: neutronTVL, + }, terra: { - tvl: zero, - borrowed: zero, + tvl: () => 0, }, hallmarks:[ - [1651881600, "UST depeg"], + [1651881600, 'UST depeg'], + [1675774800, 'Relaunch on Osmosis'], ] }; diff --git a/projects/marsecosystem/abi.json b/projects/marsecosystem/abi.json index 026609ffb9c..095de52eb97 100644 --- a/projects/marsecosystem/abi.json +++ b/projects/marsecosystem/abi.json @@ -1,9 +1,3 @@ { - "sharesTotal": { - "inputs": [{ "internalType": "uint256", "name": "_pid", "type": "uint256" }], - "name": "sharesTotal", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - } + "sharesTotal": "function sharesTotal(uint256 _pid) view returns (uint256)" } \ No newline at end of file diff --git a/projects/marsecosystem/index.js b/projects/marsecosystem/index.js index 8e8b7cb918f..11d3e500fa7 100644 --- a/projects/marsecosystem/index.js +++ b/projects/marsecosystem/index.js @@ -2,22 +2,23 @@ const sdk = require("@defillama/sdk"); const utils = require('../helper/utils'); const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); const { transformBscAddress } = require("../helper/portedTokens"); +const { getConfig } = require('../helper/cache') const abi = require("./abi.json"); const url = 'https://api.marsecosystem.com/api/pools'; async function tvl(timestamp, chainBlocks) { - const rows = (await utils.fetchURL(url)).data; + const rows = (await getConfig('mars-ecosystem', url)); const localPools = rows.filter(v => v.masterChef.includes('LiquidityMiningMaster') && !v.baseToken.includes('xms')); const remotePools = rows.filter(v => v.masterChef.includes('MarsFarmV2') && !v.baseToken.includes('xms')); return await calculate(chainBlocks, localPools, remotePools); -}; +} async function staking(timstamp, chainBlocks) { - const rows = (await utils.fetchURL(url)).data; + const rows = (await getConfig('mars-ecosystem', url)); const localPools = rows.filter(v => v.masterChef.includes('LiquidityMiningMaster') && v.baseToken.includes('xms')); const remotePools = rows.filter(v => v.masterChef.includes('MarsFarmV2') && v.baseToken.includes('xms')); return await calculate(chainBlocks, localPools, remotePools); -}; +} async function calculate(chainBlocks, localPools, remotePools) { let balances = {}; @@ -89,6 +90,5 @@ module.exports = { bsc: { tvl, staking, - masterchef: tvl, } }; diff --git a/projects/marshamallowdefi/abi.json b/projects/marshamallowdefi/abi.json index a9773d910b0..0dc9d10bc15 100644 --- a/projects/marshamallowdefi/abi.json +++ b/projects/marshamallowdefi/abi.json @@ -1,41 +1,3 @@ { - "poolInfo": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "poolInfo", - "outputs": [ - { - "internalType": "contract IBEP20", - "name": "lpToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "allocPoint", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastRewardBlock", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accEggPerShare", - "type": "uint256" - }, - { - "internalType": "uint16", - "name": "depositFeeBP", - "type": "uint16" - } - ], - "stateMutability": "view", - "type": "function" - } + "poolInfo": "function poolInfo(uint256) view returns (address lpToken, uint256 allocPoint, uint256 lastRewardBlock, uint256 accEggPerShare, uint16 depositFeeBP)" } \ No newline at end of file diff --git a/projects/maskex/index.js b/projects/maskex/index.js index f68cccb549c..c8de7c1a07b 100644 --- a/projects/maskex/index.js +++ b/projects/maskex/index.js @@ -21,6 +21,10 @@ const config = { '0xc3edbb9c181016cef5d76491f835930e9c8c4d2c', '0xdd9c649edb7ff80c6c9d238344260184a4f94b88', '0xfb65377800a7282cf81baf0f335fbc6f8ff36776', + '0x0ce7eefb9f862aa0374ee7bbc4d8a0fc2c651517', + '0x0ce92d3a15908b53371ff1afcae800f28142250c', + '0x95ad8841376058a000F489196F05ecf176bEB8ac', + '0x0B3c7bcE764E6f1B52443e30fcb4f34997A0674c', ], }, bsc: { @@ -37,28 +41,36 @@ const config = { '0xc6acb77befebff0359cc581973859eee8cbaeda1', '0xd666ad8d95903bce9b4dcd2cacde5145e36405c2', '0xd7aed730a7c4cf8dfe313b16712af3406f6dca5b', + '0x6db133e840376555a5ad5c1d7616872ef57e7f13', + '0xDCa6951B82e82AF6AAB4bB9e90CA00F5760370e1', ] }, tron: { owners: [ - 'TArBsHHp4zz1TWgHhZWvNcxD4A7DMbcoMm', + // 'TArBsHHp4zz1TWgHhZWvNcxD4A7DMbcoMm', 'TAv486fty6xRuWHQfhBiMh4jBofSuXJcpV', - 'TBqiQviC27UdWU58qbviJKJwp9b3DygLpY', + // 'TBqiQviC27UdWU58qbviJKJwp9b3DygLpY', 'TDQ7nxDTJBMZkkWcFZKs9KdWzb2vT2drDu', 'TKCbzA6HPnwEDL9M2tAWnqsbD6TXLUD7yy', - 'TLHuz1191oCESWJH6sAq9MS5w66HtHVbyc', + // 'TLHuz1191oCESWJH6sAq9MS5w66HtHVbyc', 'TLqPRfPHieHsMMFaQSMXoXqWD18C97cFqB', - 'TNoQvaDoPHcdoux2Ymt3yUnsSGJgLSXygo', + // 'TNoQvaDoPHcdoux2Ymt3yUnsSGJgLSXygo', 'TSFvf8LZuwy4BKNPdULFD5vaCFMrkiGRme', - 'TTNeMfGyAL1Bb8vw32U8hxJ5Vmju5tsQ8y', - 'TUTh7mS9o2EPgxLbx2bNSwwyoPCsLUmkNq', - 'TUXjobUdiUPvSZmbBVWTcSEqoXzFNr4ZDa', - 'TUrk8EeZgKCQkfd1KhAfRMBmH1Y4NYnaaL', + // 'TTNeMfGyAL1Bb8vw32U8hxJ5Vmju5tsQ8y', + // 'TUTh7mS9o2EPgxLbx2bNSwwyoPCsLUmkNq', + // 'TUXjobUdiUPvSZmbBVWTcSEqoXzFNr4ZDa', + // 'TUrk8EeZgKCQkfd1KhAfRMBmH1Y4NYnaaL', 'TW6DLBY5dyCUVzc3sgKV72HXNT8EkmEUT8', - 'TX39NXuXviJ1be8y1XkbnQ4DfFmp9gRhez', + // 'TX39NXuXviJ1be8y1XkbnQ4DfFmp9gRhez', 'TXiZ9ddXTBUke9PDs5HLXVvvHY68kmC3me', - 'TYp46EYRTHb2grSfjkDFFtakcgedXBHEhh', - 'TYshj25EXjnPB7P5xRGLmFTNPV6HMoZyrq', + // 'TYp46EYRTHb2grSfjkDFFtakcgedXBHEhh', + // 'TYshj25EXjnPB7P5xRGLmFTNPV6HMoZyrq', + // 'TUiATx1SGs3TwwKY1atafMvYjrQD8KLiSk', + ] + }, + bitcoin: { + owners: [ + '39DUz1NCkLu25GczWiAjjgZBu4mUjKbdNA', // this wallet was collected from https://blog.maskex.com/news/announcements/embracing-transparency-maskex-reveals-wallet-addresses ] } } diff --git a/projects/matrix.farm/index.js b/projects/matrix.farm/index.js index eb7cda7f1ea..45efee2d097 100644 --- a/projects/matrix.farm/index.js +++ b/projects/matrix.farm/index.js @@ -26,5 +26,8 @@ module.exports = { arbitrum: { fetch: fetch('arbitrum'), }, + bsc: { + fetch: fetch('binance'), + }, fetch: fetch('tvl') } diff --git a/projects/matrix/abi.json b/projects/matrix/abi.json index f6520b2900b..e4009eeb670 100644 --- a/projects/matrix/abi.json +++ b/projects/matrix/abi.json @@ -1,32 +1,3 @@ { - "poolInfo": { - "type": "function", - "stateMutability": "view", - "outputs": [ - { - "type": "address", - "name": "lpToken", - "internalType": "contract IBEP20" - }, - { "type": "uint256", "name": "allocPoint", "internalType": "uint256" }, - { - "type": "uint256", - "name": "lastRewardTime", - "internalType": "uint256" - }, - { - "type": "uint256", - "name": "accMatrixPerShare", - "internalType": "uint256" - }, - { "type": "uint16", "name": "depositFeeBP", "internalType": "uint16" }, - { - "type": "uint256", - "name": "harvestInterval", - "internalType": "uint256" - } - ], - "name": "poolInfo", - "inputs": [{ "type": "uint256", "name": "", "internalType": "uint256" }] - } -} + "poolInfo": "function poolInfo(uint256) view returns (address lpToken, uint256 allocPoint, uint256 lastRewardTime, uint256 accMatrixPerShare, uint16 depositFeeBP, uint256 harvestInterval)" +} \ No newline at end of file diff --git a/projects/matrixdock/index.js b/projects/matrixdock/index.js new file mode 100644 index 00000000000..941c4020be3 --- /dev/null +++ b/projects/matrixdock/index.js @@ -0,0 +1,9 @@ +module.exports = { + ethereum: { + tvl: async (...args) => { + const { api } = args[3] + const STBT = '0x530824DA86689C9C17CdC2871Ff29B058345b44a' + api.add(STBT, await api.call({ target: STBT, abi: 'erc20:totalSupply'})) + } + } +} \ No newline at end of file diff --git a/projects/maverick/index.js b/projects/maverick/index.js new file mode 100644 index 00000000000..c79bd0e4edc --- /dev/null +++ b/projects/maverick/index.js @@ -0,0 +1,73 @@ +// Maverick Protocol +const { sumTokens2 } = require("../helper/unwrapLPs"); +const { getLogs } = require("../helper/cache/getLogs"); + +function maverickTVL(config) { + const exports = {}; + + Object.keys(config).forEach((chain) => { + const { factories } = config[chain]; + exports[chain] = { + tvl: async (_, _b, _cb, { api }) => { + let logs = []; + for (let k = 0; k < factories.length; k++) { + logs.push( + ...(await getLogs({ + api, + target: factories[k].address, + topics: [ + "0x9b3fb3a17b4e94eb4d1217257372dcc712218fcd4bc1c28482bd8a6804a7c775", + ], + fromBlock: factories[k].startBlock, + eventAbi: + "event PoolCreated(address poolAddress, uint256 fee, uint256 tickSpacing, int32 activeTick, int256 lookback, uint64 protocolFeeRatio, address tokenA, address tokenB)", + onlyArgs: true, + })) + ); + } + + return sumTokens2({ + api, + ownerTokens: logs.map((i) => [[i.tokenA, i.tokenB], i.poolAddress]), + }); + }, + }; + }); + + return exports; +} + +module.exports = maverickTVL({ + ethereum: { + factories: [ + { + address: "0xEb6625D65a0553c9dBc64449e56abFe519bd9c9B", + startBlock: 17210221, + }, + { + address: "0xa5eBD82503c72299073657957F41b9cEA6c0A43A", + startBlock: 16727800, + }, + ], + }, + era: { + factories: [ + { + address: "0x96707414DB71e553F6a49c7aDc376e40F3BEfC33", + startBlock: 1337265, + }, + { + address: "0x2C1a605f843A2E18b7d7772f0Ce23c236acCF7f5", + startBlock: 3002731, + }, + ], + }, + bsc: { + factories: [ + { + address: "0x76311728FF86054Ad4Ac52D2E9Ca005BC702f589", + startBlock: 29241050, + }, + ], + }, +}); diff --git a/projects/maximizer/allocatorAbi.json b/projects/maximizer/allocatorAbi.json index 5991a0c8a6b..4acdc790b9e 100644 --- a/projects/maximizer/allocatorAbi.json +++ b/projects/maximizer/allocatorAbi.json @@ -1,55 +1,5 @@ { - "balanceOf":{ - "inputs":[ - { - "internalType":"address", - "name":"_token", - "type":"address" - } - ], - "name":"balanceOf", - "outputs":[ - { - "internalType":"uint256", - "name":"", - "type":"uint256" - } - ], - "stateMutability":"view", - "type":"function" - }, - "pending":{ - "inputs":[ - - ], - "name":"pending", - "outputs":[ - { - "internalType":"uint256", - "name":"", - "type":"uint256" - } - ], - "stateMutability":"view", - "type":"function" - }, - "pendingOf":{ - "inputs":[ - { - "internalType":"address", - "name":"_token", - "type":"address" - } - ], - "name":"pendingOf", - "outputs":[ - { - "internalType":"uint256", - "name":"", - "type":"uint256" - } - ], - "stateMutability":"view", - "type":"function" - } + "balanceOf": "function balanceOf(address _token) view returns (uint256)", + "pending": "uint256:pending", + "pendingOf": "function pendingOf(address _token) view returns (uint256)" } \ No newline at end of file diff --git a/projects/maximizer/index.js b/projects/maximizer/index.js index ca4926506e1..1672dfe0004 100644 --- a/projects/maximizer/index.js +++ b/projects/maximizer/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const BigNumber = require("bignumber.js"); const { sumTokensAndLPsSharedOwners, unwrapUniswapLPs } = require("../helper/unwrapLPs"); const sdk = require("@defillama/sdk"); @@ -16,14 +17,14 @@ const BenqiAllocator = '0x1e3834DA9a9B4d4016427554Ef31ff4e1F41d4Ed'; const MAXI = "0x7C08413cbf02202a1c13643dB173f2694e0F73f0"; const SMAXI = "0xEcE4D1b3C2020A312Ec41A7271608326894076b4"; -const DAIe = "0xd586E7F844cEa2F87f50152665BCbc2C279D8d70"; -const USDC = "0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E"; -const USDCe = "0xA7D7079b0FEaD91F3e65f86E8915Cb59c1a4C664"; -const WAVAX = "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7"; +const DAIe = ADDRESSES.avax.DAI; +const USDC = ADDRESSES.avax.USDC; +const USDCe = ADDRESSES.avax.USDC_e; +const WAVAX = ADDRESSES.avax.WAVAX; const PNG = "0x60781C2586D68229fde47564546784ab3fACA982"; const QI = "0x8729438EB15e2C8B576fCc6AeCdA6A148776C0F5"; -const JOE = "0x6e84a6216eA6dACC71eE8E6b0a5B7322EEbC0fDd"; -const XJOE = "0x57319d41F71E81F3c65F2a47CA4e001EbAFd4F33"; +const JOE = ADDRESSES.avax.JOE; +const XJOE = ADDRESSES.avax.xJOE; const ISA = "0x3EeFb18003D033661f84e48360eBeCD181A84709"; const PTP = "0x22d4002028f537599bE9f666d1c4Fa138522f9c8"; const VEPTP = "0x5857019c749147EEE22b1Fe63500F237F3c1B692"; @@ -98,7 +99,7 @@ const Tokens = [ function compareToIgnoreCase(a, b) { return a.toLowerCase() === b.toLowerCase(); -}; +} const transformAddress = (addr) => { let resultantAddress = addr; @@ -198,7 +199,7 @@ async function tvl(timestamp, block, chainBlocks) { for (const [index, allocator] of Allocators.entries()) { sdk.util.sumSingleBalance(balances, config.transformAddress(allocator.stakeToken), stakedYieldTokens[index]); sdk.util.sumSingleBalance(balances, config.transformAddress(allocator.yieldToken), pendingYieldTokens[index]); - }; + } for (const market of BenqiMarkets) { const [balance, exchangeRate] = await Promise.all([ @@ -219,7 +220,7 @@ async function tvl(timestamp, block, chainBlocks) { sdk.util.sumSingleBalance(balances, config.transformAddress(PTP), stakedPtp); return balances; -}; +} module.exports = { avax:{ diff --git a/projects/maximizer/qiTokenAbi.json b/projects/maximizer/qiTokenAbi.json index cc5cc806b9e..c38887b2d0f 100644 --- a/projects/maximizer/qiTokenAbi.json +++ b/projects/maximizer/qiTokenAbi.json @@ -1,33 +1,4 @@ { - "balanceOf": { - "inputs": [ - { - "internalType":"address", - "name":"_token", - "type":"address" - } - ], - "name":"balanceOf", - "outputs": [ - { - "internalType":"uint256", - "name":"", - "type":"uint256" - } - ], - "stateMutability":"view", - "type":"function" - }, - "exchangeRateStored": { - "constant": true, - "inputs": [], - "name": "exchangeRateStored", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type":"uint256" - } - ] - } + "balanceOf": "function balanceOf(address _token) view returns (uint256)", + "exchangeRateStored": "uint256:exchangeRateStored" } \ No newline at end of file diff --git a/projects/maximizer/stableJoeStakingAbi.json b/projects/maximizer/stableJoeStakingAbi.json index 6a5a20683d3..12408177389 100644 --- a/projects/maximizer/stableJoeStakingAbi.json +++ b/projects/maximizer/stableJoeStakingAbi.json @@ -1,31 +1,3 @@ { - "getUserInfo": { - "inputs": [ - { - "internalType": "address", - "name": "_user", - "type": "address" - }, - { - "internalType": "contract IERC20Upgradeable", - "name": "_rewardToken", - "type": "address" - } - ], - "name": "getUserInfo", - "outputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "rewardDebt", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } + "getUserInfo": "function getUserInfo(address _user, address _rewardToken) view returns (uint256 amount, uint256 rewardDebt)" } \ No newline at end of file diff --git a/projects/maximizer/stakingRewardsAbi.json b/projects/maximizer/stakingRewardsAbi.json index 9b80aaad2da..7bdb38ca15e 100644 --- a/projects/maximizer/stakingRewardsAbi.json +++ b/projects/maximizer/stakingRewardsAbi.json @@ -1,21 +1,3 @@ { - "balanceOf": { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } + "balanceOf": "function balanceOf(address) view returns (uint256 amount)" } \ No newline at end of file diff --git a/projects/maximizer/veptpAbi.json b/projects/maximizer/veptpAbi.json index 3e1f9caa4cb..ee245265da7 100644 --- a/projects/maximizer/veptpAbi.json +++ b/projects/maximizer/veptpAbi.json @@ -1,21 +1,3 @@ { - "getStakedPtp":{ - "inputs": [ - { - "internalType": "address", - "name": "_addr", - "type": "address" - } - ], - "name": "getStakedPtp", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } + "getStakedPtp": "function getStakedPtp(address _addr) view returns (uint256)" } \ No newline at end of file diff --git a/projects/mayfair/index.js b/projects/mayfair/index.js new file mode 100644 index 00000000000..191602a0f1e --- /dev/null +++ b/projects/mayfair/index.js @@ -0,0 +1,38 @@ +const { request } = require("../helper/utils/graphql") +const { cachedGraphQuery } = require('../helper/cache') + +const { toUSDTBalances } = require("../helper/balances") + +const url = "https://squid.subsquid.io/mayfair-indexer/graphql" + +async function getStakingData() { + return await request(url, `query StakingAnalytics { + stakingPools(where: {id_eq: "0x3ad426dc2f005b721359a94f8b8d71b8890b3068-0"}) { + tvl + } + } + `) + +} +async function getStaking() { + let staking = 0 + const data = await getStakingData() + staking = data.stakingPools?.[0].tvl; + return toUSDTBalances(staking) +} + +async function tvl(_, _1, _2, { api }) { + const { balancerVaults: [{ pools }] } = await cachedGraphQuery('mayfair', url, `{ balancerVaults { pools{ id vaultId } } }`) + const data = await api.multiCall({ abi: 'function getPoolTokens(bytes32) view returns (address[] tokens, uint256[] balances, uint256 lastChangeBlock)', calls: pools.map(i => ({ target: i.vaultId, params: i.id })) }) + data.forEach(({ tokens, balances }) => api.addTokens(tokens.slice(1), balances.slice(1))) + return api.getBalances() +} + +module.exports = { + timetravel: false, + doublecounted: true, // tokens are in balancer pools + arbitrum: { + tvl, + staking: getStaking + } +} diff --git a/projects/mcdex/index.js b/projects/mcdex/index.js index 658e6198e65..8fcc8e357d4 100644 --- a/projects/mcdex/index.js +++ b/projects/mcdex/index.js @@ -1,84 +1,35 @@ -const sdk = require('@defillama/sdk'); const {gql} = require('graphql-request') -const { blockQuery } = require('../helper/graph') +const { blockQuery } = require('../helper/http') const {toUSDTBalances} = require('../helper/balances'); -const {getBlock} = require('../helper/getBlock'); - -const axios = require('axios'); - -async function GenerateCallList() { - const markets = (await axios.get('https://mcdex.io/api/markets')).data.data.markets; - const marketStatus = (await axios.get('https://mcdex.io/api/markets/status')).data.data; - let id2Info = {}; - markets.forEach(market => { - const id = market.id; - if (market.contractType === 'Perpetual') { - id2Info[id] = {perpetualAddress: market.perpetualAddress}; - } - }); - marketStatus.forEach(status => { - if (status === null) { - return; - } - const id = status.marketID; - if (id2Info[id] && status.perpetualStorage && status.perpetualStorage.collateralTokenAddress !== '0x0000000000000000000000000000000000000000') { - id2Info[id].collateralTokenAddress = status.perpetualStorage.collateralTokenAddress; - } - }); - let calls = [] - Object.values(id2Info).map((info, id) => { - if (info.collateralTokenAddress && info.perpetualAddress) { - calls.push({ - target: info.collateralTokenAddress, - params: info.perpetualAddress - }) - } - }); - return calls; -} +const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') async function ethereum(timestamp, block) { - const ethBalance = (await sdk.api.eth.getBalance({ - target: '0x220a9f0DD581cbc58fcFb907De0454cBF3777f76', - block - })).output; - let balances = { - "0x0000000000000000000000000000000000000000": ethBalance, - }; - - const erc20Calls = await GenerateCallList(); - const balanceOfResults = await sdk.api.abi.multiCall({ - block, - calls: erc20Calls, - abi: 'erc20:balanceOf' - }); - - await sdk.util.sumMultiBalanceOf(balances, balanceOfResults); - return balances; + return sumTokens2({ block, owner: '0x220a9f0DD581cbc58fcFb907De0454cBF3777f76', tokens: [nullAddress]}) } - -async function getTVL(subgraphName, block) { +async function getTVL(subgraphName, api) { const endpoint = `https://api.thegraph.com/subgraphs/name/mcdexio/${subgraphName}` const query = gql` - query getTvl { - factories { + query getTvl ($block: Int) { + factories ( + block: { number: $block } + ){ id totalValueLockedUSD } } `; - const results = await blockQuery(endpoint, query, block, 600) + const results = await blockQuery(endpoint, query, { api, blockCatchupLimit: 600, }) return results.factories[0].totalValueLockedUSD; } -async function arbitrum(timestamp, ethBlock, chainBlocks) { - return toUSDTBalances(await getTVL("mcdex3-arb-perpetual", await getBlock(timestamp, "arbitrum", chainBlocks))) +async function arbitrum(_, _b, _cb, { api, }) { + return toUSDTBalances(await getTVL("mcdex3-arb-perpetual", api)) } -async function bsc(timestamp, ethBlock, chainBlocks) { - return toUSDTBalances(await getTVL("mcdex3-bsc-perpetual", await getBlock(timestamp, "bsc", chainBlocks))) +async function bsc(_, _b, _cb, { api, }) { + return toUSDTBalances(await getTVL("mcdex3-bsc-perpetual", api)) } module.exports = { diff --git a/projects/mcs/index.js b/projects/mcs/index.js new file mode 100644 index 00000000000..1b41c49d735 --- /dev/null +++ b/projects/mcs/index.js @@ -0,0 +1,13 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { staking } = require('../helper/staking') + +const MCS_TOKEN_ADDRESS = '0xDa5aC8F284537d6eaB198801127a9d49b0CbDff5'; +const USDC_TOKEN_ADDRESS = ADDRESSES.telos.ETH; +const STAKING_CONTRACT_ADDRESS = '0x258FC83E130Bc708541c33900bAEDE83242646db'; + +module.exports = { + kava: { + tvl: staking(STAKING_CONTRACT_ADDRESS, USDC_TOKEN_ADDRESS), + staking: staking(STAKING_CONTRACT_ADDRESS, MCS_TOKEN_ADDRESS), + } +} \ No newline at end of file diff --git a/projects/mdex/abi.json b/projects/mdex/abi.json deleted file mode 100644 index 3e6a51e217d..00000000000 --- a/projects/mdex/abi.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "allPairs": { - "constant": true, - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "allPairs", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "allPairsLength": { - "constant": true, - "inputs": [], - "name": "allPairsLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } - } - \ No newline at end of file diff --git a/projects/mdex/api.js b/projects/mdex/api.js deleted file mode 100644 index 5c93def62b4..00000000000 --- a/projects/mdex/api.js +++ /dev/null @@ -1,21 +0,0 @@ -const { getUniTVL } = require('../helper/unknownTokens') - -const factories = { - heco: "0xb0b670fc1F7724119963018DB0BfA86aDb22d941", - bsc: "0x3CD1C46068dAEa5Ebb0d3f55F6915B10648062B8", -}; - -const hecoTvl = getUniTVL({ factory: factories.heco, chain: 'heco', useDefaultCoreAssets: true }) - -module.exports = { - misrepresentedTokens: true, - timetravel: false, - /* - heco: { - tvl: hecoTvl, - }, - */ - bsc: { - tvl: getUniTVL({ factory: factories.bsc, chain: 'bsc', useDefaultCoreAssets: true }), - }, -}; diff --git a/projects/mdex/index.js b/projects/mdex/index.js index a458aeaad45..2ac19f0abb6 100644 --- a/projects/mdex/index.js +++ b/projects/mdex/index.js @@ -1,28 +1,18 @@ -const { get } = require('../helper/http') +const { getUniTVL } = require('../helper/unknownTokens') -async function fetch(chainId) { - return (await get(`https://info.mdex.one/pair/tvl?chain_id=${chainId}`)).result - .map(p => p.tvl) - .reduce((a, b) => a + parseFloat(b), 0); -}; - -async function heco() { - return (await fetch(128)); -}; -async function bsc() { - return (await fetch(56)); -}; -async function total() { - return (await fetch(128)) + (await fetch(56)); +const factories = { + heco: "0xb0b670fc1F7724119963018DB0BfA86aDb22d941", + bsc: "0x3CD1C46068dAEa5Ebb0d3f55F6915B10648062B8", + bittorrent: "0x36117cc868139FA3AeD4067142C5EF3C121c6a72" }; module.exports = { - timetravel: false, - heco: { - fetch: heco - }, - bsc: { - fetch: bsc - }, - fetch: total + misrepresentedTokens: true, }; + +Object.keys(factories).forEach(chain => { + const factory = factories[chain] + module.exports[chain] = { + tvl: getUniTVL({ factory, useDefaultCoreAssets: true }) + } +}) \ No newline at end of file diff --git a/projects/mdex/subgraphs.js b/projects/mdex/subgraphs.js deleted file mode 100644 index 81257d3abc2..00000000000 --- a/projects/mdex/subgraphs.js +++ /dev/null @@ -1,91 +0,0 @@ -const { request, gql } = require("graphql-request"); -const sdk = require("@defillama/sdk"); -const BigNumber = require("bignumber.js"); -const { calculateUniTvl } = require('../helper/calculateUniTvl') -const {toUSDTBalances} = require('../helper/balances'); -const { getBlock } = require("../helper/getBlock"); - -// --> bsc addresses found here: https://github.com/mdexSwap/bscswap -// --> heco addresses found here: https://github.com/mdexSwap/contracts - -const factories = { - heco: "0xb0b670fc1F7724119963018DB0BfA86aDb22d941", - bsc: "0x3CD1C46068dAEa5Ebb0d3f55F6915B10648062B8", -}; - -const REDUCE_BLOCK = 60; - -const graphUrls = { - heco: "https://heco-lite-graph.mdex.cc/subgraphs/name/chain/heco", - bsc: "https://bsc-lite-graph.mdex.one/subgraphs/name/chain/bsc", -}; - -const graphQueries = { - heco: gql` - query tvl($block: Int) { - mdexFactory( - id: "0xb0b670fc1F7724119963018DB0BfA86aDb22d941" - block: { number: $block } - ) { - totalLiquidityUSD - } - } - `, - bsc: gql` - query tvl($block: Int) { - mdexFactory( - id: "0x3CD1C46068dAEa5Ebb0d3f55F6915B10648062B8" - block: { number: $block } - ) { - totalLiquidityUSD - } - } - `, -}; - -// --- We need to token as ref for the balances object --- -const usdtToken = "0xdac17f958d2ee523a2206206994597c13d831ec7"; - -function getMDEXLiquidity(block, chain) { - return request(graphUrls[chain], graphQueries[chain], { - block, - }); -} - -const bscTvl = async (timestamp, ethBlock, chainBlocks) => { - const chain = "bsc" - const block = await getBlock(timestamp, chain, chainBlocks) - const results = await request(graphUrls[chain], graphQueries[chain], { - block, - }); - return toUSDTBalances(results.mdexFactory.totalLiquidityUSD) -}; - -const hecoTvl = async (timestamp, ethBlock, chainBlocks) => { - let block = chainBlocks["heco"]; - - if (block === undefined) { - block = (await sdk.api.util.lookupBlock(timestamp, { chain: "heco" })) - .block; - } - - // --- Reduce a bit as the indexing takes time to catch up, otherwise error jumps somehow from endpoint --- - const results = await getMDEXLiquidity(block - REDUCE_BLOCK, "heco"); - - return { - // --- Arrange to account the decimals as it was usdt (decimals = 6) --- - [usdtToken]: BigNumber(results.mdexFactory.totalLiquidityUSD) - .multipliedBy(10 ** 6) - .toFixed(0), - }; -}; - -module.exports = { - misrepresentedTokens: true, - bsc: { - tvl: bscTvl, // individually outputs >1B --- breakdown per token (OK) - }, - heco: { - tvl: hecoTvl, // individually outputs >1B --- simply using graphql endpoint (OK) - }, -}; diff --git a/projects/meanfinance/addresses.js b/projects/meanfinance/addresses.js index c11345c9aa7..a0992c91f89 100644 --- a/projects/meanfinance/addresses.js +++ b/projects/meanfinance/addresses.js @@ -1,11 +1,12 @@ +const ADDRESSES = require('../helper/coreAssets.json') const V1_POOLS = [ - { pool: '0x8124cD94629Bd7e902D9B7dabDcef71F9847b232', tokenA: '0x6B175474E89094C44Da98b954EedeAC495271d0F', tokenB: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2' }, - { pool: '0x9a2789dd698D010f3d6Bb5Bf865369A734D43f83', tokenA: '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599', tokenB: '0x6B175474E89094C44Da98b954EedeAC495271d0F' }, - { pool: '0xa649C9306896f90d6f8a3366f29be10557461144', tokenA: '0x0bc529c00C6401aEF6D220BE8C6Ea1667F6Ad93e', tokenB: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2' }, - { pool: '0xC62D0265ADCe0719373661FFF26d93980f5e6Fc0', tokenA: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', tokenB: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2' }, - { pool: '0xAc324adB90eDA530884eB0f5BE58614c6249484a', tokenA: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', tokenB: '0xD291E7a03283640FDc51b121aC401383A46cC623' }, - { pool: '0x82Eb5b1F3A2286903F5918f8a42Cc84A2ea500fb', tokenA: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', tokenB: '0xdAC17F958D2ee523a2206206994597C13D831ec7' }, - { pool: '0x59aCef0FC104EDe425DF5CD3a1677A09e7e025cD', tokenA: '0x2602278EE1882889B946eb11DC0E810075650983', tokenB: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2' }, + { pool: '0x8124cD94629Bd7e902D9B7dabDcef71F9847b232', tokenA: ADDRESSES.ethereum.DAI, tokenB: ADDRESSES.ethereum.WETH }, + { pool: '0x9a2789dd698D010f3d6Bb5Bf865369A734D43f83', tokenA: ADDRESSES.ethereum.WBTC, tokenB: ADDRESSES.ethereum.DAI }, + { pool: '0xa649C9306896f90d6f8a3366f29be10557461144', tokenA: ADDRESSES.ethereum.YFI, tokenB: ADDRESSES.ethereum.WETH }, + { pool: '0xC62D0265ADCe0719373661FFF26d93980f5e6Fc0', tokenA: ADDRESSES.ethereum.USDC, tokenB: ADDRESSES.ethereum.WETH }, + { pool: '0xAc324adB90eDA530884eB0f5BE58614c6249484a', tokenA: ADDRESSES.ethereum.WETH, tokenB: '0xD291E7a03283640FDc51b121aC401383A46cC623' }, + { pool: '0x82Eb5b1F3A2286903F5918f8a42Cc84A2ea500fb', tokenA: ADDRESSES.ethereum.WETH, tokenB: ADDRESSES.ethereum.USDT }, + { pool: '0x59aCef0FC104EDe425DF5CD3a1677A09e7e025cD', tokenA: '0x2602278EE1882889B946eb11DC0E810075650983', tokenB: ADDRESSES.ethereum.WETH }, ] const TOKENS_IN_LEGACY_VERSIONS = { @@ -15,31 +16,31 @@ const TOKENS_IN_LEGACY_VERSIONS = { '0x296f55f8fb28e498b858d0bcda06d955b2cb3f97', // STG '0x298b9b95708152ff6968aafd889c6586e9169f1d', // sBTC '0x350a791bfc2c21f9ed5d10980dad2e2638ffa7f6', // LINK - '0x4200000000000000000000000000000000000006', // WETH - '0x4200000000000000000000000000000000000042', // OP - '0x5029c236320b8f15ef0a657054b84d90bfbeded3', // BitANT + ADDRESSES.tombchain.FTM, // WETH + ADDRESSES.optimism.OP, // OP + ADDRESSES.optimism.BitANT, // BitANT '0x50c5725949a6f0c72e6c4a641f24049a917db0cb', // LYRA '0x65559aa14915a70190438ef90104769e5e890a00', // ENS '0x68f180fcce6836688e9084f035309e29bf0a2095', // WBTC '0x6fd9d7ad17242c41f7131d257212c54a0e816691', // UNI - '0x7f5c764cbc14f9669b88837ca1490cca17c31607', // USDC + ADDRESSES.optimism.USDC, // USDC '0x7fb688ccf682d58f86d7e38e03f9d22e7705448b', // RAI '0x8700daec35af8ff88c16bdf0418774cb3d7599b4', // SNX - '0x8c6f28f2f1a3c87f0f938b96d27520d9751ec8d9', // sUSD - '0x94b008aa00579c1307b0ef2c499ad98a8ce58e58', // USDT + ADDRESSES.optimism.sUSD, // sUSD + ADDRESSES.optimism.USDT, // USDT '0x9bcef72be871e61ed4fbbc7630889bee758eb81d', // rETH '0x9e1028f5f1d5ede59748ffcee5532509976840e0', // PERP - '0xda10009cbd5d07dd0cecc66161fc93d7c9000da1', // DAI + ADDRESSES.optimism.DAI, // DAI '0xe0bb0d3de8c10976511e5030ca403dbf4c25165b', // 0xBTC - '0xe405de8f52ba7559f9df3c368500b6e6ae6cee49', // sETH + ADDRESSES.optimism.sETH, // sETH '0xf98dcd95217e15e05d8638da4c91125e59590b07', // KROM ], polygon: [ '0x0b3f868e0be5597d5db7feb59e1cadbb0fdda50a', // SUSHI - '0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270', // WMATIC + ADDRESSES.polygon.WMATIC_2, // WMATIC '0x172370d5cd63279efa6d502dab29171933a610af', // CRV - '0x1bfd67037b42cf73acf2047067bd4f2c47d9bfd6', // WBTC - '0x2791bca1f2de4661ed88a30c99a7a9449aa84174', // USDC + ADDRESSES.polygon.WBTC, // WBTC + ADDRESSES.polygon.USDC, // USDC '0x2c89bbc92bd86f8075d1decc58c7f4e0107f286b', // AVAX '0x3066818837c5e6ed6601bd5a91b0762877a6b731', // UMA '0x3a58a54c066fdc0f2d55fc9c89f0415c92ebf3c4', // stMATIC @@ -49,16 +50,16 @@ const TOKENS_IN_LEGACY_VERSIONS = { '0x53e0bca35ec356bd5dddfebbd1fc0fd03fabad39', // LINK '0x5fe2b58c013d7601147dcdd68c143a77499f5531', // GRT '0x6f7c932e7684666c9fd1d44527765433e01ff61d', // MKR - '0x7ceb23fd6bc0add59e62ac25578270cff1b9f619', // WETH + ADDRESSES.polygon.WETH_1, // WETH '0x831753dd7087cac61ab5644b308642cc1c33dc13', // QUICK '0x8505b9d2254a7ae468c0e9dd10ccea3a837aef5c', // COMP - '0x8f3cf7ad23cd3cadbd9735aff958023239c6a063', // DAI + ADDRESSES.polygon.DAI, // DAI '0x9a71012b13ca4d3d0cdc72a177df3ef03b0e76a3', // BAL '0xa1c57f48f0deb89f569dfbe6e2b7f46d33606fd4', // MANA '0xa3fa99a148fa48d14ed51d610c367c61876997f1', // miMATIC '0xb33eaad8d922b1083446dc23f610c2567fb5180f', // UNI '0xbbba073c31bf03b8acf7c28ef0738decf3695683', // SAND - '0xc2132d05d31c914a87c6611c10748aeb04b58e8f', // USDT + ADDRESSES.polygon.USDT, // USDT '0xd6df932a45c0f255f85145f286ea0b292b21c90b', // AAVE '0xda537104d6a5edd53c6fbba9a898708e465260b6', // YFI ] diff --git a/projects/meanfinance/index.js b/projects/meanfinance/index.js index 9f8368bb5eb..bab0a68a3d1 100644 --- a/projects/meanfinance/index.js +++ b/projects/meanfinance/index.js @@ -1,6 +1,6 @@ -const { fetchURL } = require("../helper/utils"); const { V1_POOLS, TOKENS_IN_LEGACY_VERSIONS } = require("./addresses"); const { sumTokens2 } = require('../helper/unwrapLPs') +const { getConfig } = require('../helper/cache') const YIELD_VERSION = '0xA5AdC5484f9997fBF7D405b9AA62A7d88883C345' const YIELDLESS_VERSION = '0x059d306A25c4cE8D7437D25743a8B94520536BD5' @@ -13,7 +13,7 @@ const LEGACY_VERSIONS = { } async function getTokensInChain(chain) { - const { data } = await fetchURL(`https://api.mean.finance/v1/dca/networks/${chain}/tokens?includeNotAllowed`) + const data = await getConfig('mean-finance/'+chain, `https://api.mean.finance/v1/dca/networks/${chain}/tokens?includeNotAllowed`) return data.map(({ address }) => address) } @@ -59,14 +59,11 @@ module.exports = { optimism: getV2TvlObject('optimism'), polygon: getV2TvlObject('polygon'), arbitrum: getV2TvlObject('arbitrum'), + bsc: getV2TvlObject('bsc'), hallmarks: [ - [1638850958, "V2 Beta launch on Optimism"], - [1643602958, "V2 full launch"], - [1646367758, "Deployment on Polygon"], - [1650082958, "Protocol is paused because a non-critical vulnerability"], - [1653366158, "V2 Relaunch"], - [1654057358, "OP launch brings more users into Optimism and benefits Mean"], - [1666364400, "Yield-While-DCA launch"], + [1650082958, "Protocol is paused due to non-critical vulnerability"], + [1654057358, "OP launch"], [1668006000, "Deployment on Arbitrum"], + [1672099200, "Deployment on Ethereum"], ] }; diff --git a/projects/megamoon/index.js b/projects/megamoon/index.js new file mode 100644 index 00000000000..98ba7c62d97 --- /dev/null +++ b/projects/megamoon/index.js @@ -0,0 +1,23 @@ +const ADDRESSES = require("../helper/coreAssets.json"); +const { sumTokensExport, nullAddress } = require("../helper/unwrapLPs"); + +const owners = [ + "0xA73dA7954834260d7909c697Eb6022e46A5924DE", + "0xC5d1D50d9517db581DE2Ceb6e5d33B7750b0a04A", + "0x4c00e75A710E92ea915a865379b07caDf3e6C45e", +]; + +const config = { + polygon: { + tokens: [ADDRESSES.polygon.USDT, nullAddress], + }, +}; + +module.exports = {}; + +Object.keys(config).forEach((chain) => { + const { tokens } = config[chain]; + module.exports[chain] = { + tvl: sumTokensExport({ owners, tokens }), + }; +}); diff --git a/projects/megatonfi/index.js b/projects/megatonfi/index.js new file mode 100644 index 00000000000..c4941228a29 --- /dev/null +++ b/projects/megatonfi/index.js @@ -0,0 +1,26 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { get } = require('../helper/http') +const { transformDexBalances } = require('../helper/portedTokens') +const nullAddress = ADDRESSES.null + +module.exports = { + misrepresentedTokens: true, + timetravel: false, + ton: { + tvl: async () => { + const lpInfoList = await get('https://megaton.fi/api/lp/infoList'); + const pools = lpInfoList[0] + + return transformDexBalances({ + chain: 'ton', + data: pools.map(pool => ({ + token0: pool.token0 ?? nullAddress, + token1: pool.token1 ?? nullAddress, + token0Bal: pool.amount0, + token1Bal: pool.amount1, + })) + }) + } + } +} + diff --git a/projects/meld-gold/index.js b/projects/meld-gold/index.js new file mode 100644 index 00000000000..0d1058f7c90 --- /dev/null +++ b/projects/meld-gold/index.js @@ -0,0 +1,45 @@ +const { tokens, getAssetInfo } = require('../helper/chain/algorand') +const sdk = require('@defillama/sdk') + +async function tvl() { + const abi = 'function latestRoundData() view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound)' + const api = new sdk.ChainApi({}) + let totalMeldMarketCap = 0 + + // Gold is priced in tory oz, silver is priced in oz, but Meld Tokens are both priced in grams + const ozToGrams = 31.10347687 + + // Meld tokens + const assetInfo = [ + { + assetId: tokens.gold$, + grams: ozToGrams, + priceFeed: '0x214eD9Da11D2fbe465a6fc601a91E62EbEc1a0D6', + }, + { + assetId: tokens.silver$, + grams: ozToGrams, + priceFeed: '0x379589227b15F1a12195D3f2d90bBc9F31f95235', + }, + ] + + // Get total market cap of all Meld tokens + for (const asset of assetInfo) { + const { assetId, grams, priceFeed } = asset + const { answer: price } = await api.call({ abi, target: priceFeed }) + const assetInfo = await getAssetInfo(assetId) + const circulatingSupply = assetInfo.circulatingSupply + const marketCap = (circulatingSupply / grams / 10 ** 6) * (price / 10 ** 8) + totalMeldMarketCap += marketCap + } + + return { tether: totalMeldMarketCap } +} + +module.exports = { + timetravel: false, + misrepresentedTokens: true, + algorand: { + tvl, + }, +} diff --git a/projects/meld/index.js b/projects/meld/index.js index dd501db0e2f..0a13591e3b3 100644 --- a/projects/meld/index.js +++ b/projects/meld/index.js @@ -1,20 +1,9 @@ -const axios = require('axios') +const { sumTokensExport } = require('../helper/chain/cardano') -async function staking(){ - const meldLocked = (await axios.get("https://cardano-mainnet.blockfrost.io/api/v0/addresses/addr1wxar2qwdzuxfvdyuxsk9aapy93vkkk904mxullqtkp90pmqh0xrmz", { - headers:{ - project_id: "mainnetTV9qV3mfZXbE6e44TVGMe1UoRlLrpSQt" - } - })).data.amount.find(token=>token.unit==="6ac8ef33b510ec004fe11585f7c5a9f0c07f0c23428ab4f29c1d7d104d454c44").quantity - return { - "meld": meldLocked/1e6 - } -} - -module.exports={ - timetravel: false, - cardano:{ - staking, - tvl:()=>({}), - } +module.exports = { + timetravel: false, + cardano: { + staking: sumTokensExport({ owner: 'addr1wxar2qwdzuxfvdyuxsk9aapy93vkkk904mxullqtkp90pmqh0xrmz', tokens: ['6ac8ef33b510ec004fe11585f7c5a9f0c07f0c23428ab4f29c1d7d104d454c44'] }), + tvl: () => ({}), + } } diff --git a/projects/meme-dollar/index.js b/projects/meme-dollar/index.js new file mode 100644 index 00000000000..ea585d4dc22 --- /dev/null +++ b/projects/meme-dollar/index.js @@ -0,0 +1,27 @@ +const { staking } = require("../helper/staking"); +const { sumTokensExport } = require("../helper/unknownTokens"); + +const PINA_TOKEN_CONTRACT = "0x02814F435dD04e254Be7ae69F61FCa19881a780D"; +const PINA_DAO_CONTRACT = "0xd50B9219C832a762dd9a6929Dc4FeF988f65175b"; +const PINA_LP_CONTRACT = "0x03083F4fE89b899C7887E26bE3E974EbBa11E591"; +const PINA_DONTDIEMEME_CONTRACT = "0xe0bE1793539378cb87b6d4217E7878d53567bcfb"; +const PINA_USDC_LP_CONTRACT = "0x58624E7a53700cb39772E0267ca0AC70f064078B"; +const PINA_MEME_LP_CONTRACT = "0x713afa49478f1a33c3194ff65dbf3c8058406670"; + +module.exports = { + methodology: "counts the number of tokens in Pina pool", + start: 1673928000, + ethereum: { + tvl: () => 0, + staking: staking( + [PINA_DAO_CONTRACT, PINA_DONTDIEMEME_CONTRACT], + PINA_TOKEN_CONTRACT + ), + pool2: sumTokensExport({ + owner: PINA_LP_CONTRACT, + tokens: [PINA_USDC_LP_CONTRACT, PINA_MEME_LP_CONTRACT], + resolveLPs: true, + useDefaultCoreAssets: true, + }), + }, +}; diff --git a/projects/memedex/index.js b/projects/memedex/index.js new file mode 100644 index 00000000000..f7acb545173 --- /dev/null +++ b/projects/memedex/index.js @@ -0,0 +1,8 @@ +const { getUniTVL } = require('../helper/unknownTokens'); + +module.exports = { + misrepresentedTokens: true, + conflux: { + tvl: getUniTVL({ chain: 'conflux', useDefaultCoreAssets: true, factory: '0x62283c20Ac4c7B1E61BB3C27bE2fA0880ee982Ea'}), + } +} \ No newline at end of file diff --git a/projects/mensa/abi.json b/projects/mensa/abi.json deleted file mode 100644 index c66cd25739b..00000000000 --- a/projects/mensa/abi.json +++ /dev/null @@ -1,304 +0,0 @@ -{ - "getReservesList":{"inputs":[],"name":"getReservesList","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"}, - "getAMMReserveData":{"inputs":[{"internalType":"address","name":"asset","type":"address"}],"name":"getReserveData","outputs":[{"components":[{"components":[{"internalType":"uint256","name":"data","type":"uint256"}],"internalType":"struct DataTypes.ReserveConfigurationMap","name":"configuration","type":"tuple"},{"internalType":"uint128","name":"liquidityIndex","type":"uint128"},{"internalType":"uint128","name":"variableBorrowIndex","type":"uint128"},{"internalType":"uint128","name":"currentLiquidityRate","type":"uint128"},{"internalType":"uint128","name":"currentVariableBorrowRate","type":"uint128"},{"internalType":"uint128","name":"currentStableBorrowRate","type":"uint128"},{"internalType":"uint40","name":"lastUpdateTimestamp","type":"uint40"},{"internalType":"address","name":"aTokenAddress","type":"address"},{"internalType":"address","name":"stableDebtTokenAddress","type":"address"},{"internalType":"address","name":"variableDebtTokenAddress","type":"address"},{"internalType":"address","name":"interestRateStrategyAddress","type":"address"},{"internalType":"uint8","name":"id","type":"uint8"}],"internalType":"struct DataTypes.ReserveData","name":"","type":"tuple"}],"stateMutability":"view","type":"function"}, - "getCurrentTokens":{"constant":true,"inputs":[],"name":"getCurrentTokens","outputs":[{"internalType":"address[]","name":"tokens","type":"address[]"}],"payable":false,"stateMutability":"view","type":"function"}, - "getReserveData": { - "constant": true, - "inputs": [ - { - "internalType": "address", - "name": "_reserve", - "type": "address" - } - ], - "name": "getReserveData", - "outputs": [ - { - "internalType": "uint256", - "name": "totalLiquidity", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "availableLiquidity", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalBorrowsStable", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalBorrowsVariable", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "liquidityRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "variableBorrowRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "stableBorrowRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "averageStableBorrowRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "utilizationRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "liquidityIndex", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "variableBorrowIndex", - "type": "uint256" - }, - { - "internalType": "address", - "name": "aTokenAddress", - "type": "address" - }, - { - "internalType": "uint40", - "name": "lastUpdateTimestamp", - "type": "uint40" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "getReserveConfigurationData": { - "constant": true, - "inputs": [ - { - "internalType": "address", - "name": "_reserve", - "type": "address" - } - ], - "name": "getReserveConfigurationData", - "outputs": [ - { - "internalType": "uint256", - "name": "ltv", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "liquidationThreshold", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "liquidationBonus", - "type": "uint256" - }, - { - "internalType": "address", - "name": "interestRateStrategyAddress", - "type": "address" - }, - { - "internalType": "bool", - "name": "usageAsCollateralEnabled", - "type": "bool" - }, - { - "internalType": "bool", - "name": "borrowingEnabled", - "type": "bool" - }, - { - "internalType": "bool", - "name": "stableBorrowRateEnabled", - "type": "bool" - }, - { - "internalType": "bool", - "name": "isActive", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "getReserves": { - "constant": true, - "inputs": [], - "name": "getReserves", - "outputs": [ - { - "internalType": "address[]", - "name": "", - "type": "address[]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "getAddressesProvidersList": { - "inputs": [], - "name": "getAddressesProvidersList", - "outputs": [ - { - "internalType": "address[]", - "name": "", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getAddress": { - "inputs": [ - { - "internalType": "bytes32", - "name": "id", - "type": "bytes32" - } - ], - "name": "getAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getAllATokens": { - "inputs": [], - "name": "getAllATokens", - "outputs": [ - { - "components": [ - { - "internalType": "string", - "name": "symbol", - "type": "string" - }, - { - "internalType": "address", - "name": "tokenAddress", - "type": "address" - } - ], - "internalType": "struct AaveProtocolDataProvider.TokenData[]", - "name": "", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getUnderlying": { - "inputs": [], - "name": "UNDERLYING_ASSET_ADDRESS", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getReserveDataV2": { - "inputs": [ - { - "internalType": "address", - "name": "asset", - "type": "address" - } - ], - "name": "getReserveData", - "outputs": [ - { - "internalType": "uint256", - "name": "availableLiquidity", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalStableDebt", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalVariableDebt", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "liquidityRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "variableBorrowRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "stableBorrowRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "averageStableBorrowRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "liquidityIndex", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "variableBorrowIndex", - "type": "uint256" - }, - { - "internalType": "uint40", - "name": "lastUpdateTimestamp", - "type": "uint40" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getBPool": { - "inputs": [], - "name": "bPool", - "outputs": [ - { - "internalType": "contract IBPool", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } -} \ No newline at end of file diff --git a/projects/mensa/index.js b/projects/mensa/index.js index f30159963d6..fd999d8bedc 100644 --- a/projects/mensa/index.js +++ b/projects/mensa/index.js @@ -1,84 +1,9 @@ -const sdk = require("@defillama/sdk"); - -const abi = require('./abi.json'); -const {transformFantomAddress} = require('../helper/portedTokens') - -const _mensaCoreAddress = '0xa7D5d34207eb2EfB510Fb15b06feE6224Cd936Cd'; - -async function tvl(_, _ethBlock, chainBlocks) { - - const reserves_mensa = ( - await sdk.api.abi.call({ - target: _mensaCoreAddress, - abi: abi["getReserves"], - block: chainBlocks['fantom'], - chain: 'fantom' - }) - ).output.filter(t=>t!=="0x1111111111111111111111111111111111111111"); - - const decimalsOfReserve = ( - await sdk.api.abi.multiCall({ - calls: reserves_mensa.map((reserve) => ({ - target: reserve - })), - abi: "erc20:decimals", - block: chainBlocks['fantom'], - chain: 'fantom' - }) - ).output; - - const assets = []; - reserves_mensa.map((reserve, i) => { - - let symbol; - - let decimals = decimalsOfReserve[i]; - if (decimals.success) { - assets.push({ - address: reserve, - }) - } else { - throw new Error("Call failed") - } - }) - - const balance_ftm = ( - await sdk.api.eth.getBalance({ - target: _mensaCoreAddress, - block: chainBlocks['fantom'], - chain: 'fantom' - }) - ).output; - - - const balanceOfResults = await sdk.api.abi.multiCall({ - block: chainBlocks['fantom'], - chain: 'fantom', - calls: assets.map((reserve) => ({ - target: reserve.address, - params: _mensaCoreAddress, - })), - abi: "erc20:balanceOf", - }) - - const balances = {}; - const transform = await transformFantomAddress() - - assets.forEach((_item,_i)=>{ - balances[transform(_item.address)] = balanceOfResults.output[_i].output; - }) - - balances['fantom:0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83'] = balance_ftm - - return balances; - -} module.exports = { deadFrom: 1648765747, misrepresentedTokens: true, methodology: 'Using the same methodology applied to other lending platforms, TVL for Mensa consists deposits made to the protocol and borrowed tokens are not counted.', fantom:{ - tvl, + tvl: () => 0 }, }; diff --git a/projects/mento/index.js b/projects/mento/index.js index b8ae201102a..202a0d84a79 100644 --- a/projects/mento/index.js +++ b/projects/mento/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { nullAddress, } = require('../helper/unwrapLPs') const { sumTokensExport, } = require('../helper/sumTokens') @@ -13,7 +14,7 @@ module.exports = { ethereum: { tvl: sumTokensExport({ owners: ['0xe1955eA2D14e60414eBF5D649699356D8baE98eE', '0x8331C987D9Af7b649055fa9ea7731d2edbD58E6B', '0x26ac3A7b8a675b741560098fff54F94909bE5E73', '0x16B34Ce9A6a6F7FC2DD25Ba59bf7308E7B38E186', ], - tokens: [nullAddress, '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', '0x6b175474e89094c44da98b954eedeac495271d0f', ], + tokens: [nullAddress, ADDRESSES.ethereum.USDC, ADDRESSES.ethereum.DAI, ], chain: 'ethereum', }) }, diff --git a/projects/meowfinance/abi.json b/projects/meowfinance/abi.json index 7f0be4aa8e3..83c72d22eb5 100644 --- a/projects/meowfinance/abi.json +++ b/projects/meowfinance/abi.json @@ -1,96 +1,11 @@ { - "token": { - "inputs": [], - "name": "token", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - "totalToken": { - "inputs": [], - "name": "totalToken", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - "vaultDebtVal": { - "inputs": [], - "name": "vaultDebtVal", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - "poolLength": { - "inputs": [], - "name": "poolLength", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - "poolInfo": { - "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "name": "poolInfo", - "outputs": [ - { "internalType": "address", "name": "stakeToken", "type": "address" }, - { "internalType": "uint256", "name": "allocPoint", "type": "uint256" }, - { - "internalType": "uint256", - "name": "lastRewardTime", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accMeowPerShare", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "lpToken": { - "inputs": [], - "name": "lpToken", - "outputs": [ - { - "internalType": "contract IUniswapV2Pair", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "masterchef": { - "inputs": [], - "name": "masterChef", - "outputs": [ - { - "internalType": "contract ISpookyMasterChef", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "pid": { - "inputs": [], - "name": "pid", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - "userInfo": { - "inputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" }, - { "internalType": "address", "name": "", "type": "address" } - ], - "name": "userInfo", - "outputs": [ - { "internalType": "uint256", "name": "amount", "type": "uint256" }, - { "internalType": "uint256", "name": "rewardDebt", "type": "uint256" } - ], - "stateMutability": "view", - "type": "function" - } -} + "token": "address:token", + "totalToken": "uint256:totalToken", + "vaultDebtVal": "uint256:vaultDebtVal", + "poolLength": "uint256:poolLength", + "poolInfo": "function poolInfo(uint256) view returns (address stakeToken, uint256 allocPoint, uint256 lastRewardTime, uint256 accMeowPerShare)", + "lpToken": "address:lpToken", + "masterchef": "address:masterChef", + "pid": "uint256:pid", + "userInfo": "function userInfo(uint256, address) view returns (uint256 amount, uint256 rewardDebt)" +} \ No newline at end of file diff --git a/projects/meowfinance/index.js b/projects/meowfinance/index.js index fcc8da2d08a..1c7ba696954 100644 --- a/projects/meowfinance/index.js +++ b/projects/meowfinance/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); const { pool2Exports } = require("../helper/pool2"); @@ -10,10 +11,10 @@ const meowFtm = "0x150Aeb5389d56E258c2bbb42c7e67e944EDEE913"; const treasuryContract = "0x7d25f49C648B2a12B5f530Df929204352cb6080e"; const translate = { - "0x049d68029688eabf473097a2fc38ef61633a3c7a": - "0xdac17f958d2ee523a2206206994597c13d831ec7", - "0x8d11ec38a3eb5e956b052f67da8bdc9bef8abf3e": - "0x6b175474e89094c44da98b954eedeac495271d0f", + [ADDRESSES.fantom.fUSDT]: + ADDRESSES.ethereum.USDT, + [ADDRESSES.fantom.DAI]: + ADDRESSES.ethereum.DAI, }; const workers = [ @@ -203,12 +204,5 @@ module.exports = { meowFtm, (addr) => `fantom:${addr}` ), - treasury: stakingUnknownPricedLP( - treasuryContract, - meow, - "fantom", - meowFtm, - (addr) => `fantom:${addr}` - ), }, }; diff --git a/projects/mercurity/abi.json b/projects/mercurity/abi.json index df7915f7cc7..af35e25ecd2 100644 --- a/projects/mercurity/abi.json +++ b/projects/mercurity/abi.json @@ -1,17 +1,3 @@ { - "getCurrentTokens": { - "constant": true, - "inputs": [], - "name": "getCurrentTokens", - "outputs": [ - { - "internalType": "address[]", - "name": "tokens", - "type": "address[]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } + "getCurrentTokens": "address[]:getCurrentTokens" } \ No newline at end of file diff --git a/projects/mercurity/index.js b/projects/mercurity/index.js index 29bb7a9fd61..b9abfe32341 100644 --- a/projects/mercurity/index.js +++ b/projects/mercurity/index.js @@ -1,66 +1,50 @@ -const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); +const { getLogs } = require('../helper/cache/getLogs') +const { sumTokens2 } = require('../helper/unwrapLPs') const pool_factoryV1 = "0x20dC7DA7cFc8F5b465060496a170229dc4A47A87"; const pool_factoryV2 = "0xCD21ef2220596cba4A7DaE59b5eeeA6dB7859df7"; const toAddr = (d) => "0x" + d.substr(26); -const calc = async (balances, block, factory) => { - - const START_BLOCK = 11259517; // 11971199 -> start block for Factory Pool V2 - const END_BLOCK = block; - const events = ( - await sdk.api.util.getLogs({ - target: factory, - topic: `LOG_NEW_POOL(address,address)`, - keys: [], - fromBlock: START_BLOCK, - toBlock: END_BLOCK, - }) - ).output; - - const pools = events.map((event) => toAddr(event.topics[2])); - - for (const pool of pools) { - const tokens = ( - await sdk.api.abi.call({ - abi: abi.getCurrentTokens, - target: pool, - }) - ).output; - - for (const token of tokens) { - const getBalance = ( - await sdk.api.abi.call({ - abi: 'erc20:balanceOf', - target: token, - params: pool, - }) - ).output; - - sdk.util.sumSingleBalance(balances, token, getBalance); - } - } +const calc = async (balances, block, factory, api) => { + const START_BLOCK = 11259517; // 11971199 -> start block for Factory Pool V2 + const events = ( + await getLogs({ + target: factory, + topic: `LOG_NEW_POOL(address,address)`, + api, + fromBlock: START_BLOCK, + }) + ); + + const pools = events.map((event) => toAddr(event.topics[2])); + const tokens = await api.multiCall({ + calls: pools, + abi: abi.getCurrentTokens, + }) + const tokensAndOwners = [] + tokens.forEach((t, i) => t.forEach(j => tokensAndOwners.push([j, pools[i]]))) + return sumTokens2({ api, tokensAndOwners, balances }) }; -const ethTvl = async (ethBlock) => { - const balances = {}; +const ethTvl = async (_, ethBlock, _1, { api }) => { + const balances = {}; + await Promise.all([ /*** Pool V1 TVL Portion ***/ - await calc(balances, ethBlock, pool_factoryV1) - + calc(balances, ethBlock, pool_factoryV1, api), /*** Pool V2 TVL Portion ***/ - await calc(balances, ethBlock, pool_factoryV2) + calc(balances, ethBlock, pool_factoryV2, api), + ]) - return balances; + return balances; }; module.exports = { - misrepresentedTokens: true, - ethereum: { - tvl: ethTvl, - }, - methodology: - "Counts tvl on the Pools through MFactory (V1 and V2) Contracts", + ethereum: { + tvl: ethTvl, + }, + methodology: + "Counts tvl on the Pools through MFactory (V1 and V2) Contracts", }; diff --git a/projects/merkl/index.js b/projects/merkl/index.js new file mode 100644 index 00000000000..31563736082 --- /dev/null +++ b/projects/merkl/index.js @@ -0,0 +1,29 @@ +const sdk = require("@defillama/sdk"); + +/* +Merkl doesn't have any TVL as no funds are staked on the contracts. +This adapter was made to integrate Merkl in the Yields dashboard. +For more information on Merkl, see here: https://docs.angle.money/side-products/merkl +*/ + +async function tvl() { + const balances = {}; + return balances; +} + +module.exports = { + methodology: + "Merkl is a side product from Angle Labs used to better reward concentrated liquidity positions. It doesn't have any TVL. See the yield dashboard for a list of Merkl pools.", + ethereum: { + tvl, + }, + polygon: { + tvl, + }, + optimism: { + tvl, + }, + arbitrum: { + tvl, + }, +}; diff --git a/projects/merlin/index.js b/projects/merlin/index.js new file mode 100644 index 00000000000..26f8863233b --- /dev/null +++ b/projects/merlin/index.js @@ -0,0 +1,9 @@ +module.exports = { + start: 1682899200, + era: { + tvl: () => 0, + }, + hallmarks: [ + [Math.floor(new Date('2023-04-26')/1e3), 'Project Rugged!'], + ], +}; diff --git a/projects/merlinlab/index.js b/projects/merlinlab/index.js index 997f434c40c..6bb70709499 100644 --- a/projects/merlinlab/index.js +++ b/projects/merlinlab/index.js @@ -107,6 +107,6 @@ const bscTvl = async (timestamp, ethBlock, chainBlocks) => { module.exports = { bsc: { - tvl: bscTvl, + tvl: () => ({}), //Project is dead }, }; diff --git a/projects/merlinlab/staking.json b/projects/merlinlab/staking.json index 7ac57077065..e45ed48db17 100644 --- a/projects/merlinlab/staking.json +++ b/projects/merlinlab/staking.json @@ -1,15 +1,3 @@ { - "userInfo": { - "inputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" }, - { "internalType": "address", "name": "", "type": "address" } - ], - "name": "userInfo", - "outputs": [ - { "internalType": "uint256", "name": "amount", "type": "uint256" }, - { "internalType": "uint256", "name": "rewardDebt", "type": "uint256" } - ], - "stateMutability": "view", - "type": "function" - } -} + "userInfo": "function userInfo(uint256, address) view returns (uint256 amount, uint256 rewardDebt)" +} \ No newline at end of file diff --git a/projects/merlinlab/vault.json b/projects/merlinlab/vault.json index 8b768ac93ec..fd712316f6b 100644 --- a/projects/merlinlab/vault.json +++ b/projects/merlinlab/vault.json @@ -1,16 +1,4 @@ { - "stakingToken": { - "inputs": [], - "name": "stakingToken", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - "pid": { - "inputs": [], - "name": "pid", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - } -} + "stakingToken": "address:stakingToken", + "pid": "uint256:pid" +} \ No newline at end of file diff --git a/projects/mero/abi.json b/projects/mero/abi.json index dee7fb8d098..da82cfcd552 100644 --- a/projects/mero/abi.json +++ b/projects/mero/abi.json @@ -1,60 +1,6 @@ { - "totalUnderlying": { - "inputs": [], - "name": "totalUnderlying", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getUnderlying": { - "inputs": [], - "name": "getUnderlying", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "poolsCount": { - "inputs": [], - "name": "poolsCount", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getPoolAtIndex": { - "inputs": [ - { - "internalType": "uint256", - "name": "index", - "type": "uint256" - } - ], - "name": "getPoolAtIndex", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } + "totalUnderlying": "uint256:totalUnderlying", + "getUnderlying": "address:getUnderlying", + "poolsCount": "uint256:poolsCount", + "getPoolAtIndex": "function getPoolAtIndex(uint256 index) view returns (address)" } \ No newline at end of file diff --git a/projects/meshswap/index.js b/projects/meshswap/index.js index 28441d63aa9..db62d96d408 100644 --- a/projects/meshswap/index.js +++ b/projects/meshswap/index.js @@ -1,49 +1,33 @@ -const { get } = require('../helper/http') -const BigNumber = require("bignumber.js"); -const { toUSDTBalances } = require('../helper/balances'); +const { staking } = require('../helper/staking') +const { getUniTVL } = require('../helper/unknownTokens'); +const kslp = require('../helper/abis/kslp'); +const sdk = require('@defillama/sdk') +const { sumTokens2 } = require('../helper/unwrapLPs') -async function tvl() { - const meshswapInfo = await get('https://s.meshswap.fi/stat/meshswapInfo.json') - const recentPoolInfo = meshswapInfo.recentPoolInfo; - const tokenInfoObj = meshswapInfo.tokenInfo; - const SinglePoolInfo = meshswapInfo.leveragePoolInfo.single; +const singlePoolFactory = '0x504722a6eabb3d1573bada9abd585ae177d52e7a' - var totalLiquidity = new BigNumber('0'); - - for(const pool of recentPoolInfo){ - totalLiquidity = totalLiquidity.plus(pool.poolVolume); - } - var tokenInfo = {}; - for(const token of tokenInfoObj){ - tokenInfo[token.address] = token - } - - for(const spool of SinglePoolInfo){ - const totalDeposit = new BigNumber(spool.totalDeposit); - const totalBorrow = new BigNumber(spool.totalBorrow); - const singlePoolAmount = totalDeposit.minus(totalBorrow); - - const tokenPrice = tokenInfo[spool.token].price; - const tokenDecimal = tokenInfo[spool.token].decimal; - const singlePoolVol = singlePoolAmount.div(10**tokenDecimal).times(tokenPrice); - - totalLiquidity = totalLiquidity.plus(singlePoolVol); - } - return toUSDTBalances(totalLiquidity); +async function singlePoolTvl(_, _b, _cb, { api, }) { + const pools = await api.fetchList({ lengthAbi: 'uint8:getPoolCount', itemAbi: 'function getPoolAddressByIndex(uint idx) public view returns (address)', target: singlePoolFactory }) + const tokens = await api.multiCall({ abi: 'address:token', calls: pools }) + const toa = tokens.map((val, i) => ([val, pools[i]])) + return sumTokens2({ api, tokensAndOwners: toa}) } -async function staking() { - const meshswapInfo = await get('https://s.meshswap.fi/stat/meshswapInfo.json') - var totalStaking = new BigNumber(meshswapInfo.common.stakingVol); - return toUSDTBalances(totalStaking); -} +const dexTVL = getUniTVL({ + useDefaultCoreAssets: true, + factory: '0x9f3044f7f9fc8bc9ed615d54845b4577b833282d', + abis: { + allPairsLength: kslp.getPoolCount, + allPairs: kslp.pools, + getReserves: kslp.getCurrentPool, + }, + exports +}) module.exports = { - methodology: "meshswap is an AMM-based Instant Swap Protocol", - timetravel: false, - misrepresentedTokens: true, polygon: { - staking, - tvl - } + tvl: sdk.util.sumChainTvls([dexTVL, singlePoolTvl]), + staking: staking('0x176b29289f66236c65c7ac5db2400abb5955df13', '0x82362ec182db3cf7829014bc61e9be8a2e82868a') + }, + misrepresentedTokens: true, } \ No newline at end of file diff --git a/projects/messinaone/index.js b/projects/messinaone/index.js new file mode 100644 index 00000000000..c906f8a0ca5 --- /dev/null +++ b/projects/messinaone/index.js @@ -0,0 +1,45 @@ +const { getConfig } = require("../helper/cache"); +const { sumTokens } = require("../helper/sumTokens"); + +let messinaAssets; + +const tokenChain = { + ethereum: 2, + algorand: 8, + cronos: 20025, + polygon: 5, + avax: 6, + arbitrum: 23, + bsc: 4, +}; + +const fetchAssets = async () => { + if (!messinaAssets) + messinaAssets = getConfig( + "messina-one", + "https://messina.one/api/bridge/get-assets?cache=true" + ); + + return messinaAssets; +}; + +const tvl = async (_, _1, _2, { chain }) => { + messinaAssets = await fetchAssets(); + messinaAssets = messinaAssets.filter((asset) => asset.wrapped === false); + const toa = messinaAssets + .filter((t) => t.chainId == tokenChain[chain]) + .map((i) => [i.id, i.escrowAddress]); + return sumTokens({ chain, tokensAndOwners: toa }); +}; + +module.exports = { + timetravel: false, + methodology: "Fetches assets currently held by Messina.one contracts.", + ethereum: { tvl }, + algorand: { tvl }, + cronos: { tvl }, + polygon: { tvl }, + avax: { tvl }, + arbitrum: { tvl }, + bsc: { tvl }, +}; diff --git a/projects/metacoin/index.js b/projects/metacoin/index.js new file mode 100644 index 00000000000..b972641caf7 --- /dev/null +++ b/projects/metacoin/index.js @@ -0,0 +1,22 @@ +const { getLogs } = require('../helper/cache/getLogs') +const { sumTokens2 } = require('../helper/unwrapLPs') + +const exchangeAddr = '0x1dd2235091c82862bcc7e9c25017ba9c409c0820' +const vaultAddr = '0x1ac269102c4d8c4f92b3cf9d214ea78060b4d366' + +async function tvl(_, _b, _cb, { api, }) { + const logs = await getLogs({ + api, + target: exchangeAddr, + topic: 'TokenRegistrationConfirmed(address,string,uint8)', + eventAbi: 'event TokenRegistrationConfirmed(address indexed assetAddress, string assetSymbol, uint8 decimals)', + onlyArgs: true, + fromBlock: 16594995, + }) + const tokens = logs.map(i => i.assetAddress) + return sumTokens2({ tokens, api, owners: [vaultAddr]}) +} + +module.exports = { + bsc: { tvl } +} \ No newline at end of file diff --git a/projects/metaid/index.js b/projects/metaid/index.js new file mode 100644 index 00000000000..3062fdd0467 --- /dev/null +++ b/projects/metaid/index.js @@ -0,0 +1,16 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, sumTokensExport } = require('../helper/unwrapLPs') +const USDC = ADDRESSES.telos.ETH +const wkava = ADDRESSES.kava.WKAVA +const MetaId = "0x8dD02F065EE650787A414568a13948629fa21333" + + +module.exports = { + kava: { + tvl: sumTokensExport({ tokensAndOwners: [ + [USDC, MetaId], + [wkava, MetaId], + [nullAddress, MetaId], + ]}), + }, + } \ No newline at end of file diff --git a/projects/metalswap/index.js b/projects/metalswap/index.js index e4e89c0f813..67956995131 100644 --- a/projects/metalswap/index.js +++ b/projects/metalswap/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { stakings } = require('../helper/staking') const { pool2UniV3 } = require('../helper/pool2') const { sumTokens2, nullAddress } = require('../helper/unwrapLPs'); @@ -7,9 +8,13 @@ const { sumTokens2, nullAddress } = require('../helper/unwrapLPs'); const config = { ethereum: { toa: [ - [nullAddress, '0xaAA50f60a256b74D1C71ED4AD739836b50059201'], // ETH pool - ['0xdac17f958d2ee523a2206206994597c13d831ec7', '0x51bb873D5b68309cf645e84234bC290b7D991D2C'], // USDT pool - ['0x2260fac5e5542a773aa44fbcfedf7c193bc2c599', '0xdCE224F9299CDd66e4D01D196d4cabce35a2F478'], // WBTC pool + [nullAddress, '0xaAA50f60a256b74D1C71ED4AD739836b50059201'], // ETH pool legacy + [nullAddress,'0x9494c9FfE0735832885269a10c910CDb227a7B0F'], // ETH pool new + [ADDRESSES.ethereum.USDT, '0x51bb873D5b68309cf645e84234bC290b7D991D2C'], //usdt pool legacy + [ADDRESSES.ethereum.USDT, '0x2535D0578562C88c1c875075A1085a4AD3117b20'], //usdt pool new + [ADDRESSES.ethereum.WBTC, '0xdCE224F9299CDd66e4D01D196d4cabce35a2F478'], //wbtc pool legacy + [ADDRESSES.ethereum.WBTC, '0x725fbd08e4c5d4b5978E48667d96D03F9B1C4d3A'], //wbtc pool new + ['0x45804880De22913dAFE09f4980848ECE6EcbAf78', '0x787c68f6bCAb352Ec871C522d038bc7A30268020'], //paxg pool ], token: '0x3E5D9D8a63CC8a88748f229999CF59487e90721e', staking: [ @@ -20,6 +25,7 @@ const config = { '0xcbF519299A115e325d6C82b514358362A9CA6ee5', // Iron Pool 180 days '0xaF9101314b14D8e243e1D519c0dd4e69DFd44466', // Iron Pool 360 days '0x6b392C307E0Fe2a8BE3687Bc780D4157592F4aC2', // nft Pre order + '0x65e4FCDf4C0F6D8C5eA4842B5B7f4a9FF68bC0d6', // Smart Pool 6 months + 3 months ], }, bsc: { @@ -29,9 +35,20 @@ const config = { '0xd38b66aACA9819623380f60814308c6594E2DC26', // Pool 30 days '0xd9b5b86De1F696dFe290803b92Fe5e9baCa9371A', // Pool 60 days '0x306825856807321671d21d4A2A9a65b02CCB51db', // Smart Pool 3 months + 3 months - '0x842fDf4A6e861983D3Ef9299bF26EFC1FDB1Ba7A', // Smart Pool 2 + '0x842fDf4A6e861983D3Ef9299bF26EFC1FDB1Ba7A', // Smart Pool 2 months + 6 months + '0x799BfC125170ab4dF34E9dC07DB47AA0edB9bC7C', // Smart Pool 6 months + 6 months ], }, + + optimism: { + toa: [ + [nullAddress, '0x5B7C5daa5f4Bb37c457dA468Da1CDaA6219892A1'], // ETH pool + [ADDRESSES.optimism.USDC, '0x24682cFDc060316355C26C420d0748F289502e83'], //usdt pool new + ['0x68f180fcCe6836688e9084f035309E29Bf0A2095', '0x469CC7AF1696B5e4E6151796Dc3B3fEf39b34f39'], //wbtc pool new + [ADDRESSES.optimism.OP, '0xc9394748D5f633152AD3F8f557a9B7743148db1B'], //Op pool new + ], + token: '0x3E5D9D8a63CC8a88748f229999CF59487e90721e', + }, } module.exports = { diff --git a/projects/metapoly/abi.json b/projects/metapoly/abi.json index e76ca11c7f7..415ab90f2c8 100644 --- a/projects/metapoly/abi.json +++ b/projects/metapoly/abi.json @@ -1,22 +1,4 @@ -{ - "totalSupply": { - "inputs": [], - "name": "totalSupply", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - "UNDERLYING_ASSET_ADDRESS": { - "inputs": [], - "name": "UNDERLYING_ASSET_ADDRESS", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } -} +{ + "totalSupply": "uint256:totalSupply", + "UNDERLYING_ASSET_ADDRESS": "address:UNDERLYING_ASSET_ADDRESS" +} \ No newline at end of file diff --git a/projects/metareserve/index.js b/projects/metareserve/index.js index c3aa5795a42..ea0144b2b62 100644 --- a/projects/metareserve/index.js +++ b/projects/metareserve/index.js @@ -1,10 +1,11 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { ohmTvl } = require("../helper/ohm"); const power = "0x000c6322Df760155bBe4F20F2EDD8F4Cd35733A6"; const staking = "0x5c643737AF2aD7A0B9ae62158b715793505967bE"; const treasury = "0x6651BDeE6A47F6962C86d680b498DC492a7E78C8"; const treasuryTokens = [ - ["0xe9e7cea3dedca5984780bafc599bd69add087d56", false], // BUSD + [ADDRESSES.bsc.BUSD, false], // BUSD ["0xA1A64b7D85B92A19fdb628557cC44bCb40284B65", true] // POWER-BUSD ]; diff --git a/projects/metastreet-v2/abi.json b/projects/metastreet-v2/abi.json new file mode 100644 index 00000000000..7ecb54a5d21 --- /dev/null +++ b/projects/metastreet-v2/abi.json @@ -0,0 +1,6 @@ +{ + "getPools": "address[]:getPools", + "collateralToken": "address:collateralToken", + "currencyToken": "address:currencyToken", + "liquidityNodes": "function liquidityNodes(uint128 startTick, uint128 endTick) view returns (tuple(uint128 tick, uint128 value, uint128 shares, uint128 available, uint128 pending, uint128 redemptions, uint128 prev, uint128 next)[])" +} \ No newline at end of file diff --git a/projects/metastreet-v2/index.js b/projects/metastreet-v2/index.js new file mode 100644 index 00000000000..d4e1283bb26 --- /dev/null +++ b/projects/metastreet-v2/index.js @@ -0,0 +1,102 @@ +const sdk = require("@defillama/sdk"); +const abi = require("./abi.json"); +const { sumTokens2 } = require('../helper/unwrapLPs') +const { blockQuery } = require('../helper/http') + +const query = ` +query nfts($block: Int) { + loans(where: { or: [{ status: "Active" }, { status: "Liquidated" }] } block: { number: $block }) { + collateralTokenIds + collateralToken { + id + } + pool { + id + } + } +} +` +const endpoint = 'https://api.studio.thegraph.com/query/49216/metastreet-v2-mainnet-devel/version/latest' + +// Constants +const METASTREET_POOL_FACTORY = "0x1c91c822F6C5e117A2abe2B33B0E64b850e67095"; +const MAX_UINT_128 = "0xffffffffffffffffffffffffffffffff" + +// Gets all MetaStreet V2 pools created by PoolFactory and their +// corresponding currency token +async function getAllPoolsAndTokens(block) { + const pools = ( + await sdk.api.abi.call({ + target: METASTREET_POOL_FACTORY, + abi: abi.getPools, + block, + }) + ).output; + + const tokens = ( + await sdk.api.abi.multiCall({ + abi: abi.currencyToken, + calls: pools.map((pool) => ({ + target: pool, + })), + block, + }) + ).output.map((response) => response.output); + + return [pools, tokens]; +} + +// Calculates total borrowed value across all MetaStreet pools +async function getBorrowedValue(values, block, pools, tokens) { + const poolsBorrowedValue = ( + await sdk.api.abi.multiCall({ + abi: abi.liquidityNodes, + calls: pools.map((pool) => ({ + target: pool, + params: [0, MAX_UINT_128], + })), + block, + }) + ).output.map((response) => + response.output.reduce( + (partialSum, node) => partialSum + +node.value - +node.available, + 0 + ) + ); + + // Sum up borrowed value of each pool + for (let i = 0; i < pools.length; i++) { + sdk.util.sumSingleBalance(values, tokens[i], poolsBorrowedValue[i]); + } + + return values; +} + +function getMetaStreetBorrowedValue() { + return async (_, block) => { + const values = {}; + // Get all pools and tokens + const [pools, tokens] = await getAllPoolsAndTokens(block); + await getBorrowedValue(values, block, pools, tokens); + return values; + }; +} + +module.exports = { + ethereum: { + tvl, + borrowed: getMetaStreetBorrowedValue(), + }, + methodology: "TVL is calculated by summing the value of token balances and NFTs across all MetaStreet pools. Total borrowed is calculated by subtracting the tokens available from the total value of all liquidity nodes across all pools.", + start: 17497132, // Block number of PoolFactory creation +}; + +async function tvl(_, _b, _cb, { api, }) { + const pools = await api.call({ target: METASTREET_POOL_FACTORY, abi: abi.getPools, }) + const tokens = await api.multiCall({ abi: abi.currencyToken, calls: pools }) + // const collateralTokens = await api.multiCall({ abi: abi.collateralToken, calls: pools }) + const ownerTokens = pools.map((pool, i) => [[tokens[i]], pool,]) + const { loans } = await blockQuery(endpoint, query, { api, blockCatchupLimit: 600, }) + loans.forEach(loan => api.add(loan.collateralToken.id, loan.collateralTokenIds.length)) + return sumTokens2({ api, ownerTokens, }) +} \ No newline at end of file diff --git a/projects/metastreet/abi.json b/projects/metastreet/abi.json index a159a13305a..40c88d6c265 100644 --- a/projects/metastreet/abi.json +++ b/projects/metastreet/abi.json @@ -1,56 +1,5 @@ { - "getVaultList": { - "inputs": [], - "name": "getVaultList", - "outputs": [ - { - "internalType": "address[]", - "name": "", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - "balanceState": { - "inputs": [], - "name": "balanceState", - "outputs": [ - { - "internalType": "uint256", - "name": "totalCashBalance", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalLoanBalance", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalAdminFeeBalance", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalWithdrawalBalance", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "currencyToken": { - "inputs": [], - "name": "currencyToken", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } -} + "getVaultList": "address[]:getVaultList", + "balanceState": "function balanceState() view returns (uint256 totalCashBalance, uint256 totalLoanBalance, uint256 totalAdminFeeBalance, uint256 totalWithdrawalBalance)", + "currencyToken": "address:currencyToken" +} \ No newline at end of file diff --git a/projects/metastreet/index.js b/projects/metastreet/index.js index 52d63cdbcf2..adde541784c 100644 --- a/projects/metastreet/index.js +++ b/projects/metastreet/index.js @@ -45,7 +45,7 @@ async function getTVL(balances, block, vaults, tokens) { // Sum up token balances for (let i = 0; i < vaults.length; i++) { sdk.util.sumSingleBalance(balances, tokens[i], vaultBalances[i]); - }; + } return balances; } @@ -65,7 +65,7 @@ async function getBorrowed(balances, block, vaults, tokens) { // Sum up token balances for (let i = 0; i < vaults.length; i++) { sdk.util.sumSingleBalance(balances, tokens[i], vaultBalances[i]); - }; + } return balances; } diff --git a/projects/metaswap/index.js b/projects/metaswap/index.js new file mode 100644 index 00000000000..ccca98e31f4 --- /dev/null +++ b/projects/metaswap/index.js @@ -0,0 +1,8 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports = { + misrepresentedTokens: true, + eos_evm: { + tvl: getUniTVL({ factory: '0x589ca5Ab00443681e2eA427971BB1460823A36f9', useDefaultCoreAssets: true, }) + } +} \ No newline at end of file diff --git a/projects/metatdex/index.js b/projects/metatdex/index.js index d10e2d52e0e..e445d015127 100644 --- a/projects/metatdex/index.js +++ b/projects/metatdex/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk') const { sumTokens2 } = require('../helper/unwrapLPs') @@ -10,6 +11,10 @@ const config = { tdex: '0x0b416e5da1f68dd780683b5daef858b0a081c364', owner: '0x09a28712208bf913b2e79eab446594c9fab2f37c', }, + polygon: { + tdex: '0xa63D57042B2d462B8dcf1570F8288dba405Cc909', + owner: '0xd4013b79867C03d3FB5196899193efC8f29d54A4', + }, } module.exports = {}; @@ -24,13 +29,14 @@ Object.keys(config).forEach(chain => { params: [0, 301], chain, block, }) - if (chain === 'heco') - tokens.push('0xa71edc38d189767582c38a3145b5873052c3e47a') + if (chain === 'bsc') tokens.push(ADDRESSES.bsc.USDT) + if (chain === 'heco') tokens.push(ADDRESSES.heco.USDT) + if (chain === 'polygon') tokens.push(ADDRESSES.polygon.USDT) return sumTokens2({ tokens, owner, chain, block, }) } } }) const abi = { - getTokenAddressList: {"inputs":[{"internalType":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"end","type":"uint256"}],"name":"getTokenAddressList","outputs":[{"internalType":"address[]","name":"list","type":"address[]"}],"stateMutability":"view","type":"function"}, -} \ No newline at end of file + getTokenAddressList: "function getTokenAddressList(uint256 start, uint256 end) view returns (address[] list)", +} diff --git a/projects/metavault-bo/index.js b/projects/metavault-bo/index.js new file mode 100644 index 00000000000..577e5109f2c --- /dev/null +++ b/projects/metavault-bo/index.js @@ -0,0 +1,8 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require('../helper/unwrapLPs') + +module.exports = { + polygon: { + tvl: sumTokensExport({ owner: '0x6fd5b386d8bed29b3b62c0856250cdd849b3564d', tokens: [ADDRESSES.polygon.USDC]}) + } +} \ No newline at end of file diff --git a/projects/metavault.trade/abi.js b/projects/metavault.trade/abi.js index effe9cc568e..f8c6174c1e6 100644 --- a/projects/metavault.trade/abi.js +++ b/projects/metavault.trade/abi.js @@ -1,34 +1,4 @@ module.exports = { - allWhitelistedTokens: { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "allWhitelistedTokens", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - allWhitelistedTokensLength: { - "inputs": [], - "name": "allWhitelistedTokensLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, + allWhitelistedTokens: "function allWhitelistedTokens(uint256) view returns (address)", + allWhitelistedTokensLength: "uint256:allWhitelistedTokensLength", } \ No newline at end of file diff --git a/projects/metavault/index.js b/projects/metavault/index.js index 3957c757222..d4f00986cab 100644 --- a/projects/metavault/index.js +++ b/projects/metavault/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const readerAbi = require("./reader.json"); @@ -6,8 +7,8 @@ const { staking } = require("../helper/staking"); const { sumTokens2 } = require('../helper/unwrapLPs'); const { default: BigNumber } = require("bignumber.js"); -const DAI_ADDRESS = "0x6B175474E89094C44Da98b954EedeAC495271d0F"; -const USDC_ADDRESS = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"; +const DAI_ADDRESS = ADDRESSES.ethereum.DAI; +const USDC_ADDRESS = ADDRESSES.ethereum.USDC; const MVLP_ADDRESS = "0x9F4f8bc00F48663B7C204c96b932C29ccc43A2E8"; const MVLP_DECIMALS = 18; @@ -22,7 +23,7 @@ const READER_CONTRACT = "0x01dd8B434A83cbdDFa24f2ef1fe2D6920ca03734"; // getToke const stakingAddress = "0x42162457006DB4DA3a7af5B53DFee5A891243b4D"; // Governance Staking const stakingTokenAddress = "0x788B6D2B37Aa51D916F2837Ae25b05f0e61339d1"; // MVD -const ADDRESS_ZERO = "0x0000000000000000000000000000000000000000"; +const ADDRESS_ZERO = ADDRESSES.null; async function getTvl(timestamp, block) { const toa = [ diff --git a/projects/metavault/mvlpManager.json b/projects/metavault/mvlpManager.json index f2ff17d9f3a..98f4f3c2098 100644 --- a/projects/metavault/mvlpManager.json +++ b/projects/metavault/mvlpManager.json @@ -1,15 +1,3 @@ { - "getAums": { - "inputs": [], - "name": "getAums", - "outputs": [ - { - "internalType": "uint256[]", - "name": "", - "type": "uint256[]" - } - ], - "stateMutability": "view", - "type": "function" - } + "getAums": "uint256[]:getAums" } \ No newline at end of file diff --git a/projects/metavault/reader.json b/projects/metavault/reader.json index d60baa22f0e..36b8b454303 100644 --- a/projects/metavault/reader.json +++ b/projects/metavault/reader.json @@ -1,26 +1,3 @@ { - "getTokenBalancesWithSupplies": { - "inputs": [ - { - "internalType": "address", - "name": "_account", - "type": "address" - }, - { - "internalType": "address[]", - "name": "_tokens", - "type": "address[]" - } - ], - "name": "getTokenBalancesWithSupplies", - "outputs": [ - { - "internalType": "uint256[]", - "name": "", - "type": "uint256[]" - } - ], - "stateMutability": "view", - "type": "function" - } + "getTokenBalancesWithSupplies": "function getTokenBalancesWithSupplies(address _account, address[] _tokens) view returns (uint256[])" } \ No newline at end of file diff --git a/projects/metaversepro/index.js b/projects/metaversepro/index.js index cd169cebedf..fad5b9cb7b2 100644 --- a/projects/metaversepro/index.js +++ b/projects/metaversepro/index.js @@ -1,11 +1,12 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { ohmTvl } = require('../helper/ohm') const treasury = "0xb874ac3a21e3ffe06fb4b6dcf9b62c7ea753a9a0" module.exports = ohmTvl(treasury, [ //WBNB - ["0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c", false], + [ADDRESSES.bsc.WBNB, false], //BUSD - ["0xe9e7cea3dedca5984780bafc599bd69add087d56", false], + [ADDRESSES.bsc.BUSD, false], //Pancake LP ["0x512385e505615eb30ec80A2915575E344ACf792A", true], //Pancake LPs 1 @@ -15,5 +16,5 @@ module.exports = ohmTvl(treasury, [ //Pancake LPs 3 ["0x1c8ed2f2cef333aa43f1ba9a4589899c53787d2f", true], // USDC - ["0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d", false] + [ADDRESSES.bsc.USDC, false] ], "bsc", "0xb91db0c2551aae4784119ce4c33234c9e3c9af71", "0x0a2046C7fAa5a5F2b38C0599dEB4310AB781CC83", undefined, undefined, false) \ No newline at end of file diff --git a/projects/metavisor/index.js b/projects/metavisor/index.js new file mode 100644 index 00000000000..1d80b649bf7 --- /dev/null +++ b/projects/metavisor/index.js @@ -0,0 +1,49 @@ +const { sumTokens2 } = require("../helper/unwrapLPs"); +const { getLogs } = require("../helper/cache/getLogs"); + +const VAULT_STATUS_ABI = "function getVaultStatus() returns (uint256 amount0, uint256 amount1, uint256 fees0, uint256 fees1, uint128 liquidity)"; +const DEFAULT_FACTORY = '0x25f47fEF4D6471a8b9Cb93197E1bdAa4a256EE23' +const CONFIG = { + ethereum: { uniswapRegistry: { startBlock: 16864761, }, }, + polygon: { uniswapRegistry: { startBlock: 40543157, }, }, + bsc: { uniswapRegistry: { startBlock: 26612076, }, }, + optimism: { uniswapRegistry: { startBlock: 82239696, }, }, + arbitrum: { uniswapRegistry: { startBlock: 71578282, }, }, +}; + +async function tvl(timestamp, block, chainBlocks, { api }) { + const chainConfig = CONFIG[api.chain]["uniswapRegistry"]; + + const vaultLogs = await getLogs({ + target: chainConfig.target ?? DEFAULT_FACTORY, + topic: "VaultCreated(address,uint8,address)", + fromBlock: chainConfig.startBlock, + api, + onlyArgs: true, + eventAbi: 'event VaultCreated(address indexed ,uint8 indexed ,address indexed vault)' + }); + + const vaults = vaultLogs.map(i => i.vault) + const [token0s, token1s, data] = await Promise.all([ + api.multiCall({ abi: 'address:token0', calls: vaults, }), + api.multiCall({ abi: 'address:token1', calls: vaults, }), + api.multiCall({ abi: VAULT_STATUS_ABI, calls: vaults, }), + ]) + const ownerTokens = vaults.map((v, i) => [[token0s[i], token1s[i]], v]) + data.forEach((v, i) => { + api.add(token0s[i], v.amount0) + api.add(token0s[i], v.fees0) + api.add(token1s[i], v.amount1) + api.add(token1s[i], v.fees1) + }) + + return sumTokens2({ api, ownerTokens }); +} + +module.exports = { + doublecounted: true, +}; + +Object.keys(CONFIG).forEach(chain => { + module.exports[chain] = { tvl } +}) diff --git a/projects/meter-Liquid-Staking/index.js b/projects/meter-Liquid-Staking/index.js new file mode 100644 index 00000000000..390a59cb03e --- /dev/null +++ b/projects/meter-Liquid-Staking/index.js @@ -0,0 +1,21 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const sdk = require("@defillama/sdk"); +const { BigNumber,utils } = require('ethers'); + +const stMTRG = '0x215d603293357ca222bE92A1bf75eEc38DeF0aad'; +async function tvl(timestamp, _, { meter: block }) { + const stMTRGStaking = await sdk.api.abi.call({ + target: stMTRG, + abi: 'erc20:totalSupply', + chain: "meter", block, + }); + return { + meter: stMTRGStaking.output / 1e18 + }; +} + +module.exports = { + meter: { + tvl, + } +} \ No newline at end of file diff --git a/projects/meterBridge/addresses.json b/projects/meterBridge/addresses.json index 529b3e1190c..ce2894ebc59 100644 --- a/projects/meterBridge/addresses.json +++ b/projects/meterBridge/addresses.json @@ -2,50 +2,112 @@ "ethereum": { "ERC20Handler": "0xEa31ca828F53A41bA2864FA194bb8A2d3f11C0C0", "Tokens": [ + "0xD46bA6D942050d489DBd938a2C909A5d5039A161", + "0xcf3c8be2e2c42331da80ef210e9b1b307c03d36a", + "0xac0104cca91d167873b8601d2e71eb3d4d8c33e0", + "0x6b175474e89094c44da98b954eedeac495271d0f", "0xBd2949F67DcdC549c6Ebe98696449Fa79D988A9F", + "0xd478161c952357f05f0292b56012cd8457f1cfbf", "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", "0xdAC17F958D2ee523a2206206994597C13D831ec7", - "0xCF3C8Be2e2C42331Da80EF210e9B1b307C03d36A", - "0xaC0104Cca91D167873B8601d2e71EB3D4D8c33e0", - "0xABe580E7ee158dA464b51ee1a83Ac0289622e6be", - "0xD478161C952357F05f0292B56012Cd8457F1cfbF", - "0xa58a4f5c4Bb043d2CC1E170613B74e767c94189B", "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", - "0x0Def8d8addE14c9eF7c2a986dF3eA4Bd65826767", - "0x6B175474E89094C44Da98b954EedeAC495271d0F" - ], - "Wrapped": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2" + "0xabe580e7ee158da464b51ee1a83ac0289622e6be", + "0xa58a4f5c4Bb043d2CC1E170613B74e767c94189B", + "0x0Def8d8addE14c9eF7c2a986dF3eA4Bd65826767" + ] }, "bsc": { "ERC20Handler": "0x83354D47379881e167F7160A80dAC8269Fe946Fa", "Tokens": [ - "0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56", - "0xbcf39f0edda668c58371e519af37ca705f2bfcbd" - ], - "Wrapped": "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c" + "0xDB021b1B247fe2F1fa57e0A87C748Cc1E321F07F", + "0x7130d2a12b9bcbfae4f2634d864a1ee1ce3ead9c", + "0xe9e7cea3dedca5984780bafc599bd69add087d56", + "0xbcf39F0EDDa668C58371E519AF37CA705f2bFcbd", + "0x27d72484f1910F5d0226aFA4E03742c9cd2B297a", + "0xBd2949F67DcdC549c6Ebe98696449Fa79D988A9F", + "0xe138c66982Fd5c890c60b94FDBa1747faF092c20" + ] }, "moonriver": { "ERC20Handler": "0xB1eFA941D6081afdE172e29D870f1Bbb91BfABf7", "Tokens": [ - "0xbD90A6125a84E5C512129D622a75CDDE176aDE5E", + "0xCb4a593ce512D78162C58384f0b2Fd6e802c2c47", + "0xaBD347F625194D8e56F8e8b5E8562F34B6Df3469", + "0x6fc9651f45B262AE6338a701D563Ab118B1eC0Ce", + "0x0B5B9806b1B202e22aA26Cfd527fDCafEF9eDAcf", + "0x59A1B7B7469b968eb051f6c71512d2B61F27794d", + "0xdf1380A3Ade5F398c9233f36aD6fD0d88AEa9e51", "0x5c22ba65F65ADfFADFc0947382f2E7C286A0Fe45", - "0xE3F5a90F9cb311505cd691a46596599aA1A0AD7D" - ], - "Wrapped": "0x98878B06940aE243284CA214f92Bb71a2b032B8A" + "0x1e24EC84F66cd26Dad607d81796DbeB13Cb22692", + "0x8b29344f368b5FA35595325903fE0eAab70C8E1F", + "0xbD90A6125a84E5C512129D622a75CDDE176aDE5E", + "0x7B37d0787A3424A0810E02b24743a45eBd5530B2", + "0xe3f5a90f9cb311505cd691a46596599aa1a0ad7d", + "0x3674D64AaB971aB974B2035667a4B3d09B5ec2B3", + "0xff0bb979035Bc622f01062F37E2BaD4a05B31D83", + "0xE6a991Ffa8CfE62B0bf6BF72959A3d4f11B2E0f5", + "0x6b35140fcc6e502a7e1edAC6E740513f41c4b5ec" + ] }, "meter": { "ERC20Handler": "0x139d9b458acda76457dd99db3a6a36ca9cb3bbf1", "Tokens": [ + "0x1cf09D1B5Da9d9d24365D87B932A7c4bD018A419", + "0xF0E86246519Be0810C9FAfc8430C49799985aAA8", + "0x24aA189DfAa76c671c279262F94434770F557c35", + "0x983147FB73A45FC7F8B4DFA1cd61Bdc7b111e5b6", + "0x6CFe9AdaD5215195c1Aa9755DAed29360e6Ab986", + "0xb158870beB809Ad955Bf56065C5C10D7Fd957cC0", "0x228ebBeE999c6a7ad74A6130E81b12f9Fe237Ba3", - "0x8df95e66cb0ef38f91d2776da3c921768982fba0" - ], - "Wrapped": "0x160361ce13ec33C993b5cCA8f62B6864943eb083" + "0xd5e615BB3c761AB4cD9251dEEd78Dac58BE9CcBF", + "0x75Fd6F7EDCc5E7A8100eAd3D29CCD844153ef0F3", + "0xd86e243fc0007e6226b07c9a50c9d70d78299eb5", + "0x5Fa41671c48e3C951AfC30816947126CCC8C162e", + "0x8Df95e66Cb0eF38F91D2776DA3c921768982fBa0", + "0xc1f6C86ABEe8e2e0B6fd5BD80F0b51fef783635C" + ] }, "theta": { "ERC20Handler": "0xe1c892A6cE33cB31c100369aA6fC302d7B96254a", "Tokens": [ - "0x1336739b05c7ab8a526d40dcc0d04a826b5f8b03" - ], - "Wrapped": "0x4dc08b15ea0e10b96c41aec22fab934ba15c983e" + "0x7B37d0787A3424A0810E02b24743a45eBd5530B2", + "0xBd2949F67DcdC549c6Ebe98696449Fa79D988A9F", + "0x1336739b05c7ab8a526d40dcc0d04a826b5f8b03", + "0x3Ca3fEFA944753b43c751336A5dF531bDD6598B6", + "0x3c751Feb00364CA9e2d0105c40F0b423abf1DEE3", + "0xE6a991Ffa8CfE62B0bf6BF72959A3d4f11B2E0f5", + "0xae6f0539e33f624ac685cce9ba57cc1d948d909d", + "0xf64FA5155D8cc578D473A21FB67507DDCbB80D21" + ] + }, + "avax": { + "ERC20Handler": "0xeB06fa7e1d400caa3D369776Da45EbB5EbDF9b5B", + "Tokens": [ + "0x027dbcA046ca156De9622cD1e2D907d375e53aa7" + ] + }, + "moonbeam": { + "ERC20Handler": "0x766E33b910Cd6329a0cBD5F72e48Ec162E38A25D", + "Tokens": [ + "0x4EdF8E0778967012D46968ceadb75436d0426f88", + "0x7B37d0787A3424A0810E02b24743a45eBd5530B2", + "0x1aBB8FdE5e64be3419FceF80df335C68dD2956C7", + "0xAcc15dC74880C9944775448304B263D191c6077F", + "0xB60590313975f0d98821B6Cab5Ea2a6d9641D7B6", + "0xBd2949F67DcdC549c6Ebe98696449Fa79D988A9F", + "0x8b29344f368b5FA35595325903fE0eAab70C8E1F", + "0x4bDE98731149093a12579D71338fd3741fe6E5Ce", + "0x89C36bB2E30efCA78bDEB99101C1Ac1FfcB6a30e", + "0x3c751Feb00364CA9e2d0105c40F0b423abf1DEE3", + "0xE6a991Ffa8CfE62B0bf6BF72959A3d4f11B2E0f5", + "0xf64FA5155D8cc578D473A21FB67507DDCbB80D21" + ] + }, + "polygon": { + "ERC20Handler": "0xeB06fa7e1d400caa3D369776Da45EbB5EbDF9b5B", + "Tokens": [ + "0xf305012ea754252184f1071c86ae99fac5b40320", + "0x3Ca3fEFA944753b43c751336A5dF531bDD6598B6" + ] } } \ No newline at end of file diff --git a/projects/meterBridge/index.js b/projects/meterBridge/index.js index c24577ec18c..9c99b93951c 100644 --- a/projects/meterBridge/index.js +++ b/projects/meterBridge/index.js @@ -1,11 +1,24 @@ const addresses = require("./addresses.json"); -const { sumTokensExport, nullAddress, } = require('../helper/unwrapLPs') +const { sumTokensExport, nullAddress } = require('../helper/unwrapLPs'); +const sdk = require('@defillama/sdk') module.exports = {}; Object.keys(addresses).forEach(chain => { - const {ERC20Handler, Tokens, } = addresses[chain] + const { ERC20Handler: owner, Tokens } = addresses[chain] + module.exports[chain] = { - tvl: sumTokensExport({ chain, owner: ERC20Handler, tokens: [...Tokens, nullAddress, ]}) + tvl: sumTokensExport({ chain, owner, tokens: [nullAddress, ...Tokens] }) + } + + if (chain === 'ethereum') { + module.exports.ethereum.tvl = sdk.util.sumChainTvls([ + module.exports.ethereum.tvl, + sumTokensExport({ + tokensAndOwners: [ + ['0xd46ba6d942050d489dbd938a2c909a5d5039a161', '0x805c7ecba41f9321bb098ec1cf31d86d9407de2f',], + ] + }) + ]) } }) diff --git a/projects/metf-finance/TreasuryContract.json b/projects/metf-finance/TreasuryContract.json deleted file mode 100644 index 0ce8ce8819a..00000000000 --- a/projects/metf-finance/TreasuryContract.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" -} \ No newline at end of file diff --git a/projects/metf-finance/getPairPrice.json b/projects/metf-finance/getPairPrice.json deleted file mode 100644 index 10c59cf71e2..00000000000 --- a/projects/metf-finance/getPairPrice.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "inputs": [ - { - "internalType": "address", - "name": "pair", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "getPairPrice", - "outputs": [ - { - "internalType": "uint256", - "name": "valueInMMF", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "valueInUSD", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" -} \ No newline at end of file diff --git a/projects/metf-finance/index.js b/projects/metf-finance/index.js index 1ea0f188dc6..7bf991b47a4 100644 --- a/projects/metf-finance/index.js +++ b/projects/metf-finance/index.js @@ -1,6 +1,6 @@ -const abi = require("./TreasuryContract.json"); -const pairPrice = require("./getPairPrice.json"); -const valueOfAsset = require("./valueOfAsset.json"); +const abi = 'function balanceOf(address token) view returns (uint256)' +const pairPrice = 'function getPairPrice(address pair, uint256 amount) view returns (uint256 valueInMMF, uint256 valueInUSD)'; +const valueOfAsset = 'function valueOfAsset(address asset, uint256 amount) view returns (uint256 valueInCRO, uint256 valueInUSD)' const sdk = require("@defillama/sdk"); const BigNumber = require("bignumber.js"); const { pool2 } = require('../helper/pool2') diff --git a/projects/metf-finance/valueOfAsset.json b/projects/metf-finance/valueOfAsset.json deleted file mode 100644 index db78cd3967c..00000000000 --- a/projects/metf-finance/valueOfAsset.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "inputs": [ - { - "internalType": "address", - "name": "asset", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "valueOfAsset", - "outputs": [ - { - "internalType": "uint256", - "name": "valueInCRO", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "valueInUSD", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" -} \ No newline at end of file diff --git a/projects/metronome-synth/index.js b/projects/metronome-synth/index.js new file mode 100644 index 00000000000..b8c57da6845 --- /dev/null +++ b/projects/metronome-synth/index.js @@ -0,0 +1,38 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require("../helper/unwrapLPs") + +module.exports = { + ethereum: { + tvl: sumTokensExport({ + owner: '0x3691ef68ba22a854c36bc92f6b5f30473ef5fb0a', + tokens: [ + ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.WETH, + "0xd1C117319B3595fbc39b471AB1fd485629eb05F2", + ADDRESSES.ethereum.FRAX, + ADDRESSES.ethereum.DAI, + ADDRESSES.ethereum.WBTC, + "0xa8b607Aa09B6A2E306F93e74c282Fb13f6A80452", + "0xc14900dFB1Aa54e7674e1eCf9ce02b3b35157ba5", + ADDRESSES.ethereum.sfrxETH, + "0x4Dbe3f01aBe271D3E65432c74851625a8c30Aa7B", + "0x650CD45DEdb19c33160Acc522aD1a82D9701036a", + "0xDD9F61a85fFE73E41eF889817972f0B0AaE6D6Dd" + ] + }), + }, + optimism: { + tvl: sumTokensExport({ + owner: '0x4c6bf87b7fc1c8db85877151c6ede38ed27c34f6', + tokens: [ + ADDRESSES.optimism.USDC, + ADDRESSES.optimism.WETH_1, + ADDRESSES.optimism.OP, + "0xdd63ae655b388cd782681b7821be37fdb6d0e78d", + "0xccf3d1acf799bae67f6e354d685295557cf64761", + "0x19382707d5a47e74f60053b652ab34b6e30febad", + "0x539505dde2b9771debe0898a84441c5e7fdf6bc0", + ] + }), + } +} diff --git a/projects/metronome/index.js b/projects/metronome/index.js index 417e10e0c37..93f566c8cfa 100644 --- a/projects/metronome/index.js +++ b/projects/metronome/index.js @@ -1,48 +1,20 @@ -/*================================================== - Modules - ==================================================*/ - - const sdk = require('@defillama/sdk'); - const BigNumber = require("bignumber.js"); - -/*================================================== - TVL - ==================================================*/ - - async function tvl(timestamp, block) { - const acc = '0x686e5ac50D9236A9b7406791256e47feDDB26AbA'; - const met = '0xa3d58c4E56fedCae3a7c43A725aeE9A71F0ece4e'; - const proceeds = '0x68c4b7d05fae45bcb6192bb93e246c77e98360e1'; - - const [accBalance, proceedsBalance] = await Promise.all([ - sdk.api.eth.getBalance({ target: acc, block }), - sdk.api.eth.getBalance({ target: proceeds, block }) - ]); - - const ethBalance = ((BigNumber(accBalance.output || 0)) - .plus(BigNumber(proceedsBalance.output || 0))) - .toFixed(); - - let metBalance = (await sdk.api.abi.call({ - block, - target: met, - params: acc, - abi: 'erc20:balanceOf' - })).output; - - let balances = { - [met]: metBalance, - "0x0000000000000000000000000000000000000000": ethBalance, - }; - - return balances; +const { sumTokensExport, nullAddress } = require('../helper/unwrapLPs') + +const acc = '0x686e5ac50D9236A9b7406791256e47feDDB26AbA'; +const met = '0x2Ebd53d035150f328bd754D6DC66B99B0eDB89aa'; +const proceeds = '0x68c4b7d05fae45bcb6192bb93e246c77e98360e1'; + +module.exports = { + start: 1527076766, // block 5659904 + hallmarks: [ + [1661257318,"Metronome V1 Sunset"] + ], + ethereum: { + tvl: sumTokensExport({ + tokensAndOwners: [ + [nullAddress, acc], + [nullAddress, proceeds], + ] + }) } - -/*================================================== - Exports - ==================================================*/ - - module.exports = { - start: 1527076766, // block 5659904 - ethereum: { tvl } - }; +}; diff --git a/projects/metropolis/index.js b/projects/metropolis/index.js new file mode 100644 index 00000000000..2abdc189cdc --- /dev/null +++ b/projects/metropolis/index.js @@ -0,0 +1,36 @@ +const { sumTokens2 } = require('../helper/unwrapLPs') + +const factories = { + fantom: '0xdD693b9F810D0AEE1b3B74C50D3c363cE45CEC0C', +} +async function tvl(_, _b, _cb, { api, }) { + const pools = await api.fetchList({ + target: factories[api.chain], + itemAbi: 'function allLBPairs(uint256) view returns (address)', + lengthAbi: 'uint256:getNumberOfLBPairs', + }) + const tokenA = await api.multiCall({ + abi: 'address:tokenX', + calls: pools, + }) + const tokenB = await api.multiCall({ + abi: 'address:tokenY', + calls: pools, + }) + const toa = [] + tokenA.map((_, i) => { + toa.push([tokenA[i], pools[i]]) + toa.push([tokenB[i], pools[i]]) + }) + return sumTokens2({api, tokensAndOwners: toa, }) +} + +module.exports = { + hallmarks: [ + [1680097334,"Acquired by Swapline"] + ], + methodology: 'We count the token balances in in different liquidity book contracts', + fantom:{ + tvl: () => 0 + }, +}; \ No newline at end of file diff --git a/projects/mexc-cex/index.js b/projects/mexc-cex/index.js new file mode 100644 index 00000000000..9c9323c29d6 --- /dev/null +++ b/projects/mexc-cex/index.js @@ -0,0 +1,44 @@ +const { cexExports } = require('../helper/cex') + +const config = { + bitcoin: { + owners: [ + "13uZyaPbt4rTwYQ8xWFySVUzWH3pk2P5c7" + ], + }, + ethereum:{ + owners: [ + "0x3cc936b795a188f0e246cbb2d74c5bd190aecf18", + "0x0162cd2ba40e23378bf0fd41f919e1be075f025f", + "0x75e89d5979e4f6fba9f97c104c2f0afb3f1dcb88", + ] + }, + bsc: { + owners:[ + "0x4982085c9e2f89f2ecb8131eca71afad896e89cb", + "0x2e8f79ad740de90dc5f5a9f0d8d9661a60725e64" + ] + }, + polygon: { + owners:[ + "0x51e3d44172868acc60d68ca99591ce4230bc75e0", + ] + }, + tron: { + owners:[ + "TEPSrSYPDSQ7yXpMFPq91Fb1QEWpMkRGfn", + ] + }, + arbitrum: { + owners:[ + "0x9b64203878f24eb0cdf55c8c6fa7d08ba0cf77e5", + ] + }, + optimism: { + owners:[ + "0xdf90c9b995a3b10a5b8570a47101e6c6a29eb945", + ] + } +} + +module.exports = cexExports(config) \ No newline at end of file diff --git a/projects/mfinance/abi.json b/projects/mfinance/abi.json index f0d9930e272..e7d4222b803 100644 --- a/projects/mfinance/abi.json +++ b/projects/mfinance/abi.json @@ -1,36 +1,3 @@ { - "poolInfo": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "poolInfo", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "lpToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "allocPoint", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastRewardBlock", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accMGPerShare", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } + "poolInfo": "function poolInfo(uint256) view returns (address lpToken, uint256 allocPoint, uint256 lastRewardBlock, uint256 accMGPerShare)" } \ No newline at end of file diff --git a/projects/mfinance/index.js b/projects/mfinance/index.js index 688390c774c..3bb18fec7e9 100644 --- a/projects/mfinance/index.js +++ b/projects/mfinance/index.js @@ -1,28 +1,7 @@ const abi = require("./abi.json"); -const { staking } = require("../helper/staking"); -const { pool2BalanceFromMasterChefExports } = require("../helper/pool2"); const { masterChefExports } = require("../helper/masterchef"); const masterChef = "0x342A8A451c900158BA4f1367C55955b5Fbcb7CCe"; const MG = "0x06b0c26235699b15e940e8807651568b995a8e01"; -const ethTvl = async (chainBlocks) => { - const balances = {}; - - await addFundsInMasterChef( - balances, - masterChef, - chainBlocks["ethereum"], - "ethereum", - (addr) => addr, - abi.poolInfo, - [], - true, - true, - MG - ); - - return balances; -}; - module.exports = masterChefExports(masterChef, "ethereum", MG, false, abi.poolInfo) diff --git a/projects/miaswap/index.js b/projects/miaswap/index.js new file mode 100644 index 00000000000..85dae955856 --- /dev/null +++ b/projects/miaswap/index.js @@ -0,0 +1,8 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports = { + misrepresentedTokens: true, + onus: { + tvl: getUniTVL({ factory: '0xA5DA4dC244c7aD33a0D8a10Ed5d8cFf078E86Ef3', useDefaultCoreAssets: true }), + } +} \ No newline at end of file diff --git a/projects/midas-capital/index.js b/projects/midas-capital/index.js index 9d2dbff0c37..eb015c39e4b 100644 --- a/projects/midas-capital/index.js +++ b/projects/midas-capital/index.js @@ -1,21 +1,30 @@ const sdk = require("@defillama/sdk"); const { compoundExportsWithAsyncTransform } = require("../helper/compound"); + +module.exports = { + hallmarks: [ + [Math.floor(new Date('2023-06-17')/1e3), 'Protocol was exploited for $600k'], + ] +} + const pools = { bsc: { pools: [ + "0x1851e32F34565cb95754310b031C5a2Fc0a8a905", // Helio-Ankr "0x31d76A64Bc8BbEffb601fac5884372DEF910F044", // Jarvis - "0xb2234eE69555EE4C3b6cEA4fd25c4979BbDBf0fd", // Risedile + "0xb2234eE69555EE4C3b6cEA4fd25c4979BbDBf0fd", // Risedle "0xEF0B026F93ba744cA3EDf799574538484c2C4f80", // AutoHedge "0x5373C052Df65b317e48D6CAD8Bb8AC50995e9459", // BOMB - "0xfeB4f9080Ad40ce33Fd47Ff6Da6e4822fE26C7d5", // Ankr - "0xd3E5AAFebBF06A071509cf894f665710dDaa800d", // Tester + "0xCB2841d6d300b9245EB7745Db89A0A50D8468501", // Ankr "0x35F3a59389Dc3174A98610727C2e349E275Dc909", // Ellipsis "0x3F239A5C45849391E7b839190597B5130780790d", // PancakeStack "0x7f8B5fCA1a63C632776ffc9936D2e323c14B57f8", // Alpha Strategies "0x20a0ED8c794F96C1479e2867995C99E931Ee36Ba", // Transfero Stables - "0x5EB884651F50abc72648447dCeabF2db091e4117", //Stader BNBx + "0x5EB884651F50abc72648447dCeabF2db091e4117", // Stader BNBx "0xBc06411a6204B36ce6a5559FFBE3a56C5960F6fe", // pStake BNB + "0x1B6D43501E0c7201Ea061961cBAEc88FB012f57B", // THENA Core Pools + ], }, moonbeam: { @@ -29,13 +38,17 @@ const pools = { pools: [ "0xD265ff7e5487E9DD556a4BB900ccA6D087Eb3AD2", // Jarvis "0xB08A309eFBFFa41f36A06b2D0C9a4629749b17a2", // Arrakis - "0xBd82D36B9CDfB9747aA12025CeCE3782EDe767FE", // tbd + "0xBd82D36B9CDfB9747aA12025CeCE3782EDe767FE", // Polygon Liquid Staking "0xF1ABd146B4620D2AE67F34EA39532367F73bbbd2", // MIMO + "0xBd82D36B9CDfB9747aA12025CeCE3782EDe767FE", // Stader MATICx + "0x59013D8a77D656777329D74ea1C88DA796005F1B" // Planet ix + ], }, arbitrum: { pools: [ "0x185Fa7d0e7d8A4FE7E09eB9df68B549c660e1116", // Risedle + "0x44a03C14F30D49cB43b7F7E91E987ecC10cc0b09" // OHM Pool ] } }; @@ -43,17 +56,38 @@ const pools = { function getTvl(chain) { const config = pools[chain] ?? { pools: [] }; const tvls = config.pools.map((pool) => - compoundExportsWithAsyncTransform( - pool, - chain, - undefined, - undefined - ) + compoundExportsWithAsyncTransform(pool, chain, undefined, undefined, { resolveLPs: true }) ); - return { - tvl: sdk.util.sumChainTvls(tvls.map((t) => t.tvl)), - borrowed: sdk.util.sumChainTvls(tvls.map((t) => t.borrowed)), - }; + let _tvl = sdk.util.sumChainTvls(tvls.map((t) => t.tvl)) + let _borrowed = sdk.util.sumChainTvls(tvls.map((t) => t.borrowed)) + let tvl = _tvl + let borrowed = _borrowed + if (chain === "bsc") { + tvl = resolveHypervisor(_tvl) + borrowed = resolveHypervisor(_borrowed) + } + return { tvl, borrowed }; } -Object.keys(pools).forEach(chain => module.exports[chain] = getTvl(chain)) \ No newline at end of file +Object.keys(pools).forEach(chain => module.exports[chain] = getTvl(chain)) + +function resolveHypervisor(tvlFunc) { + return async (...args) => { + const { api } = args[3] + const balances = await tvlFunc(...args) + let bscTokens = Object.keys(balances).filter(t => t.startsWith('bsc:')).map(t => t.slice(4)) + const res = await api.multiCall({ abi: 'function getTotalAmounts() view returns (uint256,uint256)', calls: bscTokens, permitFailure: true }) + const hyperVisorTokens = bscTokens.filter((t, i) => res[i]) + const totalAmounts = res.filter(i => i) + const token0s = await api.multiCall({ abi: 'address:token0', calls: hyperVisorTokens, }) + const token1s = await api.multiCall({ abi: 'address:token1', calls: hyperVisorTokens, }) + const totalSupplies = await api.multiCall({ abi: 'function totalSupply() returns (uint256)', calls: hyperVisorTokens, }) + hyperVisorTokens.forEach((token, i) => { + const bal = balances[`bsc:${token}`] / totalSupplies[i] + delete balances[`bsc:${token}`] + sdk.util.sumSingleBalance(balances, token0s[i], totalAmounts[i][0] * bal, api.chain) + sdk.util.sumSingleBalance(balances, token1s[i], totalAmounts[i][1] * bal, api.chain) + }) + return balances + } +} \ No newline at end of file diff --git a/projects/milkomeda-djed/abi.json b/projects/milkomeda-djed/abi.json new file mode 100644 index 00000000000..ffe5319866c --- /dev/null +++ b/projects/milkomeda-djed/abi.json @@ -0,0 +1,5 @@ +{ + "Djed": { + "reserve": "function R(uint256 cpa) view returns (uint256 balance)" + } + } \ No newline at end of file diff --git a/projects/milkomeda-djed/config.json b/projects/milkomeda-djed/config.json new file mode 100644 index 00000000000..b7e39bcf859 --- /dev/null +++ b/projects/milkomeda-djed/config.json @@ -0,0 +1,10 @@ +{ + "djedAddress": { + "milkomeda": "0x67A30B399F5Ed499C1a6Bc0358FA6e42Ea4BCe76", + "milkomeda_a1": "0x..." + }, + "reserveTokenAddress": { + "milkomeda": "0xAE83571000aF4499798d1e3b0fA0070EB3A3E3F9", + "milkomeda_a1": "0x..." + } + } \ No newline at end of file diff --git a/projects/milkomeda-djed/index.js b/projects/milkomeda-djed/index.js new file mode 100644 index 00000000000..c1ed78e7b80 --- /dev/null +++ b/projects/milkomeda-djed/index.js @@ -0,0 +1,24 @@ +const sdk = require('@defillama/sdk'); +const { transformBalances } = require('../helper/portedTokens'); + +const abi = require('./abi.json'); +const config = require("./config.json"); + +async function tvl(chain, chainBlocks) { + const balances = {}; + + const reserve = (await sdk.api.abi.call({ + abi: abi.Djed.reserve, chain: chain, target: config.djedAddress[chain], params: [ 0 ], block: chainBlocks[chain], + })).output; + + sdk.util.sumSingleBalance(balances, config.reserveTokenAddress[chain], reserve); // Using WADA address instead of mADA + return transformBalances(chain, balances); +} + +module.exports = { + methodology: 'The TVL of each Djed deployment on Milkomeda C1.', + milkomeda: { + start: 10440400, + tvl: (timestamp, block, chainBlocks) => tvl('milkomeda', chainBlocks) + }, +}; diff --git a/projects/milkomeda-macc/abi.json b/projects/milkomeda-macc/abi.json new file mode 100644 index 00000000000..f6a1957f9f7 --- /dev/null +++ b/projects/milkomeda-macc/abi.json @@ -0,0 +1,3 @@ +{ + "getAllFragmentedTokens" : "address[]:getAllFragmentedTokens" +} \ No newline at end of file diff --git a/projects/milkomeda-macc/index.js b/projects/milkomeda-macc/index.js new file mode 100644 index 00000000000..2a09134156f --- /dev/null +++ b/projects/milkomeda-macc/index.js @@ -0,0 +1,16 @@ +const abi = require("./abi.json"); +const { sumTokens2 } = require('../helper/unwrapLPs') +const TokenMerger = '0x36A06C470342Fc3443d768a9c85Aa43985D82219'; + +async function tvl(_, _1, _2, { api }) { + const tokens = await api.call({ abi: abi.getAllFragmentedTokens, target: TokenMerger }) + return sumTokens2({ api, owner: TokenMerger, tokens, }) +} + +module.exports = { + methodology: 'Counts the total balance of Fragmented tokens held in the Token Merger contract on Milkomeda C1 MACC.', + milkomeda: { + tvl, + }, +}; + diff --git a/projects/mimo/index.js b/projects/mimo/index.js index 2f841dd8b82..20213b249ad 100755 --- a/projects/mimo/index.js +++ b/projects/mimo/index.js @@ -1,29 +1,30 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokensExport } = require('../helper/unwrapLPs'); const config = { ethereum: { vaultCore: ['0x4026BdCD023331D52533e3374983ded99CcBB6d4'], collaterals: [ - '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', //wETH - '0x2260fac5e5542a773aa44fbcfedf7c193bc2c599', //wBTC - '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', //USDC + ADDRESSES.ethereum.WETH, //wETH + ADDRESSES.ethereum.WBTC, //wBTC + ADDRESSES.ethereum.USDC, //USDC ], }, polygon: { vaultCore: ['0x03175c19cb1d30fa6060331a9ec181e04cac6ab0'], collaterals: [ - '0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270', //wMATIC - '0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619', //wETH - '0x1BFD67037B42Cf73acF2047067bd4F2C47D9BfD6', //wBTC - '0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174', //USDC + ADDRESSES.polygon.WMATIC_2, //wMATIC + ADDRESSES.polygon.WETH_1, //wETH + ADDRESSES.polygon.WBTC, //wBTC + ADDRESSES.polygon.USDC, //USDC ], }, fantom: { vaultCore: ['0xB2b4feB22731Ae013344eF63B61f4A0e09fa370e'], collaterals:[ - '0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83', //wFTM + ADDRESSES.fantom.WFTM, //wFTM '0x74b23882a30290451A17c44f4F05243b6b58C76d', //ETH '0x321162Cd933E2Be498Cd2267a90534A804051b11', //BTC - '0x04068DA6C83AFCFA0e13ba15A6696662335D5B75', //USDC + ADDRESSES.fantom.USDC, //USDC ], } } diff --git a/projects/mindgames/index.js b/projects/mindgames/index.js index d8ab7084efe..4c7b0e42467 100644 --- a/projects/mindgames/index.js +++ b/projects/mindgames/index.js @@ -1,26 +1,24 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { getUniTVL, staking } = require('../helper/unknownTokens') +const xCRX = "0x35AfE95662fdf442762a11E4eD5172C81fBceF7e"; +const CRX = "0xb21Be1Caf592A5DC1e75e418704d1B6d50B0d083"; +const factory = "0x7C7F1c8E2b38d4C06218565BC4C9D8231b0628c0"; -const xCELL = "0xbe334d7208366B3E4Fb40348576227b524d8CBA0"; -const CELL = "0xa685F488DEe49b75469E9e866965daBc8Ed6083d"; -const factory = "0x78f406B41C81eb4144C321ADa5902BBF5de28538"; -const coreAssets = [ - "0xC42C30aC6Cc15faC9bD938618BcaA1a1FaE8501d", -] - -const tvl = getUniTVL({ factory, chain: 'aurora', coreAssets }) +const tvl = getUniTVL({ factory, chain: 'arbitrum', useDefaultCoreAssets: true, fetchBalances: true }) module.exports = { misrepresentedTokens: true, methodology: - "Factory address (0x78f406B41C81eb4144C321ADa5902BBF5de28538) is used to find the LP pairs. TVL is equal to the liquidity on the AMM.", - aurora: { + "Factory address (0x7C7F1c8E2b38d4C06218565BC4C9D8231b0628c0) is used to find the LP pairs. TVL is equal to the liquidity on the AMM.", + arbitrum: { tvl, - staking: staking({ - owner: xCELL, - tokens: [CELL], - chain: 'aurora', - coreAssets, - lps: ['0xcA5eD5745890C66026400F9b805466fB3984A345'] - }) + staking: staking( + { + owner: xCRX, + tokens: [CRX], + chain: 'arbitrum', + coreAssets: [ADDRESSES.arbitrum.USDC], + lps: ['0xf7305D209BFeCF40Bd53ccBdbe5303B3153d0660'] + }) }, -}; \ No newline at end of file +}; diff --git a/projects/minerswap/index.js b/projects/minerswap/index.js index df6e9e4c7c0..607a2c39ce5 100644 --- a/projects/minerswap/index.js +++ b/projects/minerswap/index.js @@ -1,3 +1,6 @@ const { uniTvlExport } = require('../helper/unknownTokens') -module.exports = uniTvlExport('ethpow', '0x91836d77af0a5fda36c5a1f3c11dbc7766de4d03') +module.exports.hallmarks=[ + [1668124800, "Rug Pull"] +], +module.exports = uniTvlExport('ethpow', '0x91836d77af0a5fda36c5a1f3c11dbc7766de4d03', undefined, undefined, { useDefaultCoreAssets: true, hasStablePools: true, }) diff --git a/projects/minerva/index.js b/projects/minerva/index.js new file mode 100644 index 00000000000..1dcc93e636d --- /dev/null +++ b/projects/minerva/index.js @@ -0,0 +1,9 @@ +const {staking} = require('../helper/staking') +const { gmxExports } = require('../helper/gmx') + +module.exports = { + optimism: { + staking: staking('0x21563764f5641ffcb89f25560644e39947b21be0', '0xE4d8701C69b3B94A620ff048e4226C895b67b2c0'), + tvl: gmxExports({ vault: '0x7EF6f8abAc00689e057C9ec14E34aC232255a2fb', }) + } +} \ No newline at end of file diff --git a/projects/minimax/index.js b/projects/minimax/index.js index dff57bcb9e8..f738c9a4886 100644 --- a/projects/minimax/index.js +++ b/projects/minimax/index.js @@ -1,68 +1,7 @@ -const { get } = require('../helper/http') - -async function bsc() { - const tvl_data = await get("https://api.minimax.finance/tvl/56"); - return parseFloat(tvl_data.TvlTotal); -} - -async function polygon() { - const tvl_data = await get("https://api.minimax.finance/tvl/137"); - return parseFloat(tvl_data.TvlTotal); -} - -async function fantom() { - const tvl_data = await get("https://api.minimax.finance/tvl/250"); - return parseFloat(tvl_data.TvlTotal); -} - -async function avalanche() { - const tvl_data = await get("https://api.minimax.finance/tvl/43114"); - return parseFloat(tvl_data.TvlTotal); -} - -async function arbitrum() { - const tvl_data = await get("https://api.minimax.finance/tvl/42161"); - return parseFloat(tvl_data.TvlTotal); -} - -async function aurora() { - const tvl_data = await get("https://api.minimax.finance/tvl/1313161554"); - return parseFloat(tvl_data.TvlTotal); -} - -async function moonbeam() { - const tvl_data = await get("https://api.minimax.finance/tvl/1284"); - return parseFloat(tvl_data.TvlTotal); -} - - -async function fetch() { - const tvl_data = await get("https://api.minimax.finance/tvl"); - return parseFloat(tvl_data.TvlTotal); -} - module.exports = { methodology: 'We store all user positions in our database, which is built using the blockchain data (it helps us fetch read data fast for our website). TVL is just a sum of all open positions in $ equivalent.', - bsc: { - fetch: bsc - }, - polygon: { - fetch: polygon - }, - fantom: { - fetch: fantom - }, - avax:{ - fetch: avalanche - }, - arbitrum: { - fetch: arbitrum - }, - aurora: { - fetch: aurora - }, - moonbeam: { - fetch: moonbeam - }, - fetch + hallmarks: [ + [Math.floor(new Date('2023-01-26')/1e3), 'Product is winding down'], + ], + fetch: () => 0 } diff --git a/projects/miningtycoon/index.js b/projects/miningtycoon/index.js index 8190d02a523..a4fa7481467 100644 --- a/projects/miningtycoon/index.js +++ b/projects/miningtycoon/index.js @@ -1,16 +1,17 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk'); const tokenFarm = '0xBdfbeecF52bCfF5aa8cc1B8A4B737B2Af3D1BA2F'; const tokenFarm2 = '0x8A6AE8076A1866877e006cC9b4bd0378646A9bD5'; const NTToken = '0x8b70512b5248e7c1f0f6996e2fde2e952708c4c9'; -const USDTToken = '0xa71edc38d189767582c38a3145b5873052c3e47a'; +const USDTToken = ADDRESSES.heco.USDT; const bsc_tokenFarm = '0xA05Cbf21620553Ade9a3368f1b20D81eEe74a1FC'; const bsc_tokenFarm2 = '0x973fEAf394F5E882B0F8a9B5CDC0b3E28AA08926'; const bsc_NTToken = '0xfbcf80ed90856AF0d6d9655F746331763EfDb22c'; -const bsc_USDTToken = '0x55d398326f99059fF775485246999027B3197955'; +const bsc_USDTToken = ADDRESSES.bsc.USDT; async function tvl(timestamp, ethBlock, chainBlocks) { let balances = {}; diff --git a/projects/minipanther/index.js b/projects/minipanther/index.js index ed3cad39948..938a01f1526 100644 --- a/projects/minipanther/index.js +++ b/projects/minipanther/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { ohmTvl } = require('../helper/ohm') const treasury = "0xBc461eA008c586a1721c6bF6a712f38e199A3Ce7" @@ -5,11 +6,11 @@ const miniPantherToken = "0x3264810174f577F82DDD4FD08818F368AC363505" const stakingAddress = "0x7dc10Ade8599bf5033577F60C6740479aa39DB41" const treasuryTokens = [ ["0x9cbccdaf10153edd092817a013470a0693852a77", false], //PantherUSD - ["0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83", false], //WFTM + [ADDRESSES.fantom.WFTM, false], //WFTM ["0x321162Cd933E2Be498Cd2267a90534A804051b11", false], //WBTC ["0x74b23882a30290451A17c44f4F05243b6b58C76d", false], //WETH - ["0x8D11eC38a3EB5E956B052f67Da8Bdc9bef8Abf3E", false], //DAI - ["0x82f0b8b456c1a451378467398982d4834b6829c1", false], //MIM + [ADDRESSES.fantom.DAI, false], //DAI + [ADDRESSES.fantom.MIM, false], //MIM ["0x761D6a950c8F441D616f34d6D918230936a3F27b", true], //MiniPanther-DAI ] diff --git a/projects/minmax-finance/index.js b/projects/minmax-finance/index.js index a989579b0fc..30f9052021d 100644 --- a/projects/minmax-finance/index.js +++ b/projects/minmax-finance/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens2 } = require('../helper/unwrapLPs'); const MINMAX_B3_POOL = '0x09A1B7d922BcfECa097b06498Bc992A83b0BCc42'; @@ -14,27 +15,27 @@ const MINMAX_XIM_M3_METAPOOL = '0x7B24cAA6a497bc79FDfBAeb8A71a38F15eB3d7F7'; const tokens = { // BUSD - '0xacee9b11cd4b3f57e58880277ac72c8c41abe4e4':[MINMAX_E4_POOL, MINMAX_XIM_E3_POOL], // decimal: 18 + [ADDRESSES.iotex.ioBUSD]:[MINMAX_E4_POOL, MINMAX_XIM_E3_POOL], // decimal: 18 // USDC - '0x3B2bf2b523f54C4E454F08Aa286D03115aFF326c':[MINMAX_E4_POOL, MINMAX_XIM_E3_POOL, MINMAX_E3_POOL, MINMAX_XIM_E3_METAPOOL], // decimal: 6 + [ADDRESSES.iotex.ioUSDC]:[MINMAX_E4_POOL, MINMAX_XIM_E3_POOL, MINMAX_E3_POOL, MINMAX_XIM_E3_METAPOOL], // decimal: 6 // USDT - '0x6fbCdc1169B5130C59E72E51Ed68A84841C98cd1':[MINMAX_E4_POOL, MINMAX_USDT_POOL, MINMAX_XIM_E3_POOL, MINMAX_E3_POOL, MINMAX_XIM_E3_METAPOOL], // decimal: 6 + [ADDRESSES.iotex.ioUSDT]:[MINMAX_E4_POOL, MINMAX_USDT_POOL, MINMAX_XIM_E3_POOL, MINMAX_E3_POOL, MINMAX_XIM_E3_METAPOOL], // decimal: 6 // DAI - '0x1CbAd85Aa66Ff3C12dc84C5881886EEB29C1bb9b':[MINMAX_E4_POOL, MINMAX_E3_POOL, MINMAX_XIM_E3_METAPOOL], // decimal: 18 + [ADDRESSES.iotex.ioDAI]:[MINMAX_E4_POOL, MINMAX_E3_POOL, MINMAX_XIM_E3_METAPOOL], // decimal: 18 // BUSD_b - '0x84abcb2832be606341a50128aeb1db43aa017449':[MINMAX_B3_POOL, MINMAX_XIM_B3_POOL, MINMAX_XIM_B3_METAPOOL], // decimal: 18 + [ADDRESSES.iotex.BUSD_bsc]:[MINMAX_B3_POOL, MINMAX_XIM_B3_POOL, MINMAX_XIM_B3_METAPOOL], // decimal: 18 // USDC_b - '0x037346E5a5722957Ac2cAb6ceb8c74fC18Cea91D':[MINMAX_B3_POOL, MINMAX_XIM_B3_POOL, MINMAX_XIM_B3_METAPOOL], // decimal: 18 + [ADDRESSES.iotex.USDC_b]:[MINMAX_B3_POOL, MINMAX_XIM_B3_POOL, MINMAX_XIM_B3_METAPOOL], // decimal: 18 // USDT_b - '0x42C9255D5e522e83B16ea11a3BA04c2D3AfCA079':[MINMAX_B3_POOL, MINMAX_USDT_POOL, MINMAX_XIM_B3_POOL, MINMAX_XIM_B3_METAPOOL], // decimal: 18 + [ADDRESSES.iotex.USDT_b]:[MINMAX_B3_POOL, MINMAX_USDT_POOL, MINMAX_XIM_B3_POOL, MINMAX_XIM_B3_METAPOOL], // decimal: 18 // DAI_m - '0x62a9d987cbf4c45a550deed5b57b200d7a319632':[MINMAX_M3_POOL, MINMAX_XIM_M3_POOL, MINMAX_XIM_M3_METAPOOL], // decimal: 18 + [ADDRESSES.iotex.DAI_matic]:[MINMAX_M3_POOL, MINMAX_XIM_M3_POOL, MINMAX_XIM_M3_METAPOOL], // decimal: 18 // USDT_m - '0x3cdb7c48e70b854ed2fa392e21687501d84b3afc':[MINMAX_M3_POOL, MINMAX_USDT_POOL, MINMAX_XIM_M3_POOL, MINMAX_XIM_M3_METAPOOL], // decimal: 6 + [ADDRESSES.iotex.USDT_matic]:[MINMAX_M3_POOL, MINMAX_USDT_POOL, MINMAX_XIM_M3_POOL, MINMAX_XIM_M3_METAPOOL], // decimal: 6 // USDC_m - '0xc04da3a99d17135857bb937d2fbb321d3b6c6a81':[MINMAX_M3_POOL, MINMAX_XIM_M3_POOL, MINMAX_XIM_M3_METAPOOL], // decimal: 6 + [ADDRESSES.iotex.USDC_matic]:[MINMAX_M3_POOL, MINMAX_XIM_M3_POOL, MINMAX_XIM_M3_METAPOOL], // decimal: 6 // XIM - '0xec690cdd448e3cbb51ed135df72301c3265a8f80': [MINMAX_XIM_B3_POOL, MINMAX_XIM_M3_POOL, MINMAX_XIM_E3_POOL, MINMAX_XIM_E3_METAPOOL, MINMAX_XIM_B3_METAPOOL, MINMAX_XIM_M3_METAPOOL] // decimal: 6 + [ADDRESSES.iotex.XIM]: [MINMAX_XIM_B3_POOL, MINMAX_XIM_M3_POOL, MINMAX_XIM_E3_POOL, MINMAX_XIM_E3_METAPOOL, MINMAX_XIM_B3_METAPOOL, MINMAX_XIM_M3_METAPOOL] // decimal: 6 }; async function tvl(_, _b, {iotex: block}) { diff --git a/projects/minotaur-money/index.js b/projects/minotaur-money/index.js index 3f47ab1e199..ea0fd70eafd 100644 --- a/projects/minotaur-money/index.js +++ b/projects/minotaur-money/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { ohmTvl } = require("../helper/ohm"); const mino = "0x3A1138075bd97a33F23A87824b811146FA44288E"; @@ -8,7 +9,7 @@ const tokens = [ ["0xf2001b145b43032aaf5ee2884e456ccd805f677d", false], // DAI ["0xf5a5f547612e95c688971fb68334a80ceb3c542b", true], // MINO-DAI ["0x1c139f4b953ce0c0f6aa1cd1755727ad5aba5080", true], // MINO-WCRO - ["0x062e66477faf219f25d27dced647bf57c3107d52", false], // WBTC + [ADDRESSES.cronos.WBTC, false], // WBTC ["0x5c7f8a570d578ed84e63fdfa7b1ee72deae1ae23", false], // WCRO ["0xe44fd7fcb2b1581822d0c862b68222998a0c299a", false] // WETH ]; @@ -17,7 +18,7 @@ module.exports = { misrepresentedTokens: true, ...ohmTvl(treasury, tokens, "cronos", staking, mino, addr=>{ if (addr.toLowerCase() === "0xe6052a9a4c0a2f14adc9876a3a1a7b2882f5f139") { - return "0x0000000000085d4780b73119b644ae5ecd22b376" + return ADDRESSES.ethereum.TUSD } return `cronos:${addr}` }, undefined, false) diff --git a/projects/minswap/index.js b/projects/minswap/index.js index 2f725d2e5f6..2d53b7b01ad 100644 --- a/projects/minswap/index.js +++ b/projects/minswap/index.js @@ -1,8 +1,20 @@ const { getAdaInAddress } = require("../helper/chain/cardano"); +const { getConfig } = require('../helper/cache') async function tvl() { - const liquidityPoolLocked = await getAdaInAddress("addr1z8snz7c4974vzdpxu65ruphl3zjdvtxw8strf2c2tmqnxz2j2c79gy9l76sdg0xwhd7r0c0kna0tycz4y5s6mlenh8pq0xmsha") - const batchOrderLocked = await getAdaInAddress("addr1wxn9efv2f6w82hagxqtn62ju4m293tqvw0uhmdl64ch8uwc0h43gt") + const res = await getConfig("minswap", "https://api-mainnet-prod.minswap.org/dex-addresses") + const poolAddresses = res.pools + const orderAddresses = res.orders + let liquidityPoolLocked = 0 + for (const addr of poolAddresses) { + const adaLocked = await getAdaInAddress(addr) + liquidityPoolLocked += adaLocked + } + let batchOrderLocked = 0 + for (const addr of orderAddresses) { + const adaLocked = await getAdaInAddress(addr) + batchOrderLocked += adaLocked + } return { cardano: (liquidityPoolLocked * 2) + batchOrderLocked, }; diff --git a/projects/mintswap/index.js b/projects/mintswap/index.js index ade1720a7fe..da50608cb34 100644 --- a/projects/mintswap/index.js +++ b/projects/mintswap/index.js @@ -1,12 +1,11 @@ const { addFundsInMasterChef } = require("../helper/masterchef"); -const { transformAvaxAddress } = require("../helper/portedTokens"); const masterChefContract = "0xAdD22604caf79139450e9fb4851394fFCE1692Be"; const avaxTvl = async (chainBlocks) => { const balances = {}; - const transformAddress = await transformAvaxAddress(); + const transformAddress = addr => 'avax:'+addr await addFundsInMasterChef( balances, masterChefContract, diff --git a/projects/mirror/index.js b/projects/mirror/index.js index e4340498e02..a527b1cb2cb 100644 --- a/projects/mirror/index.js +++ b/projects/mirror/index.js @@ -1,85 +1,3 @@ -const { default: BigNumber } = require("bignumber.js"); -const { request, gql } = require("graphql-request"); - -const graphUrl = 'https://graph.mirror.finance/graphql' -const mirLiquidityQuery = gql` -query liq($network: Network){ - assets{ - token - symbol - statistic{ - liquidity(network: $network) - } - } -} -`; - -const tvlQuery = gql` -query statistic{ - statistic{ - totalValueLocked { - total - collateral - liquidity - } - collateralRatio - } -} -` - -const ust = val=>Number(val)*1e12 -const fixed = val=>BigNumber(val).toFixed(0) - -function getMirLiquidity(network){ - return request( - graphUrl, - mirLiquidityQuery, - { - network, - } - ).then(data=> data.assets); -} - -const getTotalLiq = assets => assets.reduce((acc, asset)=>acc+ust(asset.statistic.liquidity), 0) -const getPool2Liq = liq => ust(liq.find(asset=>asset.symbol==="MIR").statistic.liquidity) -const ustAddress = "0xa47c8bf37f92abed4a126bda807a7b7498661acd" - -async function terraPool2() { - const pool2TerraLiq = getPool2Liq(await getMirLiquidity('TERRA')) - return { - [ustAddress] : fixed(pool2TerraLiq), - } -} - -async function ethereumPool2() { - const pool2EthLiq = getPool2Liq(await getMirLiquidity('ETH')) - return { - [ustAddress] : fixed(pool2EthLiq), - } -} - -async function terraTvl() { - const totalTvl = request(graphUrl,tvlQuery).then(data=>ust(data.statistic.totalValueLocked.total)) - const ethLiquidity = getMirLiquidity('ETH') - const terraLiquidity = getMirLiquidity('TERRA') - const totalEthLiquidity = getTotalLiq(await ethLiquidity) - const pool2TerraLiq = getPool2Liq(await terraLiquidity) - - return { - [ustAddress] : fixed((await totalTvl)-totalEthLiquidity-pool2TerraLiq), - } -} - -async function ethereumTvl() { - const ethLiquidity = getMirLiquidity('ETH') - const totalEthLiquidity = getTotalLiq(await ethLiquidity) - const pool2EthLiq = getPool2Liq(await ethLiquidity) - - return { - [ustAddress]: fixed(totalEthLiquidity-pool2EthLiq) - } -} - module.exports = { hallmarks: [ [1633651200,"Lock contract exploit"], @@ -88,12 +6,7 @@ module.exports = { ], timetravel: false, misrepresentedTokens: true, - ethereum: { - tvl: ethereumTvl, - pool2: ethereumPool2 - }, terra: { - tvl: () => ({'0': 0}), - //pool2: terraPool2 + tvl: () => ({}), } } diff --git a/projects/mirrosset/index.js b/projects/mirrosset/index.js new file mode 100644 index 00000000000..d71954349e3 --- /dev/null +++ b/projects/mirrosset/index.js @@ -0,0 +1,17 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const sdk = require('@defillama/sdk') +const { nullAddress, sumTokensExport } = require('../helper/unwrapLPs') +const USDC = ADDRESSES.telos.ETH +const mUSDC = "0x79568bEfa9bF339e76bE12813cf7430018E1AB58" +const MortgagePool = "0xA6d5df932FFE35810389e00D1A3a698a44A14E85" +const InsurancePool = "0x587Abb291379Ea84AcE583aB07A13109b9B3F347" + +module.exports = { + kava: { + tvl: sumTokensExport({ tokensAndOwners: [ + [USDC, InsurancePool], + // [mUSDC, InsurancePool], // you cant count your own tokens as your tvl + [nullAddress, MortgagePool], + ]}), + }, + } \ No newline at end of file diff --git a/projects/mm-finance-arbitrum-v3/index.js b/projects/mm-finance-arbitrum-v3/index.js new file mode 100644 index 00000000000..12ac490f560 --- /dev/null +++ b/projects/mm-finance-arbitrum-v3/index.js @@ -0,0 +1,8 @@ +const { uniV3Export } = require("../helper/uniswapV3"); + +module.exports = uniV3Export({ + arbitrum: { + factory: "0x947bc57CEFDd22420C9a6d61387FE4D4cf8A090d", + fromBlock: 72404739, + }, +}); diff --git a/projects/mm-finance-arbitrum/index.js b/projects/mm-finance-arbitrum/index.js new file mode 100644 index 00000000000..b8a2e7f1efe --- /dev/null +++ b/projects/mm-finance-arbitrum/index.js @@ -0,0 +1,19 @@ +const { staking } = require('../helper/staking') +const { getUniTVL } = require('../helper/unknownTokens') + + +const factory = '0xfe3699303D3Eb460638e8aDA2bf1cFf092C33F22' +const mmfToken = '0x56b251d4b493ee3956e3f899d36b7290902d2326' +const masterChef = '0xa73Ae666CEB460D5E884a20fb30DE2909604557A' + +module.exports = { + misrepresentedTokens: true, + methodology: 'TVL accounts for the liquidity on all AMM pools, using the TVL chart on https://arbimm.finance as the source. Staking accounts for the MMF locked in MasterChef (0xa73Ae666CEB460D5E884a20fb30DE2909604557A)', + arbitrum: { + staking: staking(masterChef, mmfToken, 'arbitrum'), + tvl: getUniTVL({ + factory, + useDefaultCoreAssets: true, + }), + }, +} \ No newline at end of file diff --git a/projects/mm-finance-polygon/index.js b/projects/mm-finance-polygon/index.js index 7308a6c5ff8..20a8b406e1d 100644 --- a/projects/mm-finance-polygon/index.js +++ b/projects/mm-finance-polygon/index.js @@ -11,7 +11,6 @@ module.exports = { polygon: { staking: staking(masterChef, mmfToken, 'polygon'), tvl: getUniTVL({ - chain: 'polygon', factory, useDefaultCoreAssets: true, }), diff --git a/projects/mm-finance/index.js b/projects/mm-finance/index.js index b12acb5b13f..89cbfe5e0ca 100644 --- a/projects/mm-finance/index.js +++ b/projects/mm-finance/index.js @@ -13,7 +13,6 @@ module.exports = { cronos: { staking: staking(masterChef, mmfToken, 'cronos'), tvl: getUniTVL({ - chain: 'cronos', factory, useDefaultCoreAssets: true, blacklist:[ diff --git a/projects/mm-stableswap-polygon/index.js b/projects/mm-stableswap-polygon/index.js index 5f665cf5c01..863c32dff70 100644 --- a/projects/mm-stableswap-polygon/index.js +++ b/projects/mm-stableswap-polygon/index.js @@ -1,12 +1,13 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens2, } = require('../helper/unwrapLPs') const pools = { '3MM Basepool': { owner: '0x690BBaa9EDBb762542FD198763092eaB2B2A5350', tokens: [ - '0xc2132d05d31c914a87c6611c10748aeb04b58e8f', // USDT - '0x2791bca1f2de4661ed88a30c99a7a9449aa84174', // USDC - '0x8f3cf7ad23cd3cadbd9735aff958023239c6a063', // DAI + ADDRESSES.polygon.USDT, // USDT + ADDRESSES.polygon.USDC, // USDC + ADDRESSES.polygon.DAI, // DAI ] } } @@ -17,7 +18,7 @@ async function tvl(ts, _, { [chain]: block }) { i.tokens.forEach(j => toa.push([j, i.owner])) }) return sumTokens2({ tokensAndOwners: toa, chain, block, }) -}; +} module.exports = { doublecounted: true, diff --git a/projects/mm-stableswap/index.js b/projects/mm-stableswap/index.js index 645575f97e5..6a9e1175c4a 100644 --- a/projects/mm-stableswap/index.js +++ b/projects/mm-stableswap/index.js @@ -1,10 +1,11 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); const MM3BasePool = "0x61bB2F4a4763114268a47fB990e633Cb40f045F8"; const DAI = "0xF2001B145b43032AAF5Ee2884e456CCd805F677D"; -const USDT = "0x66e428c3f67a68878562e79A0234c1F83c208770"; -const USDC = "0xc21223249CA28397B4B6541dfFaEcC539BfF0c59"; +const USDT = ADDRESSES.cronos.USDT; +const USDC = ADDRESSES.cronos.USDC; async function tvl(timestamp, block, chainBlocks) { @@ -24,7 +25,7 @@ async function tvl(timestamp, block, chainBlocks) { ); return balances; -}; +} module.exports = { doublecounted: true, diff --git a/projects/mmo-finance-polygon/abi.json b/projects/mmo-finance-polygon/abi.json deleted file mode 100644 index b99c7d2b86b..00000000000 --- a/projects/mmo-finance-polygon/abi.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "inputs": [ - { - "internalType": "address", - "name": "pool", - "type": "address" - } - ], - "name": "tvlOfPool", - "outputs": [ - { - "internalType": "uint256", - "name": "tvl", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" -} \ No newline at end of file diff --git a/projects/mmo-finance-polygon/index.js b/projects/mmo-finance-polygon/index.js index 23e235320b8..793a0f037e4 100644 --- a/projects/mmo-finance-polygon/index.js +++ b/projects/mmo-finance-polygon/index.js @@ -1,5 +1,5 @@ const sdk = require("@defillama/sdk"); -const abi = require("./abi.json"); +const abi = 'function tvlOfPool(address pool) view returns (uint256 tvl)' const BigNumber = require("bignumber.js"); const dashboardPolygon = "0xFAacEA541e23F0D3eC7d4E202E791923Ce273787"; diff --git a/projects/mmo-finance/abi.json b/projects/mmo-finance/abi.json deleted file mode 100644 index b99c7d2b86b..00000000000 --- a/projects/mmo-finance/abi.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "inputs": [ - { - "internalType": "address", - "name": "pool", - "type": "address" - } - ], - "name": "tvlOfPool", - "outputs": [ - { - "internalType": "uint256", - "name": "tvl", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" -} \ No newline at end of file diff --git a/projects/mmo-finance/genericVaultBalance.json b/projects/mmo-finance/genericVaultBalance.json deleted file mode 100644 index eba68a8dcb5..00000000000 --- a/projects/mmo-finance/genericVaultBalance.json +++ /dev/null @@ -1,15 +0,0 @@ - - { - "inputs": [], - "name": "balance", - "outputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } - \ No newline at end of file diff --git a/projects/mmo-finance/index.js b/projects/mmo-finance/index.js index 13c5489e853..aa19af2210d 100644 --- a/projects/mmo-finance/index.js +++ b/projects/mmo-finance/index.js @@ -1,7 +1,7 @@ const sdk = require("@defillama/sdk"); -const abi = require("./abi.json"); -const genericVaultBalance = require("./genericVaultBalance.json"); -const valueOfAsset = require("./valueOfAsset.json"); +const abi = 'function tvlOfPool(address pool) view returns (uint256 tvl)'; +const genericVaultBalance = "uint256:balance" +const valueOfAsset = 'function valueOfAsset(address asset, uint256 amount) view returns (uint256 valueInCRO, uint256 valueInUSD)' const BigNumber = require("bignumber.js"); const dashboardCronos = "0x55f040E3A6e0ff69f5095B3cbF458919C5e02A0B"; diff --git a/projects/mmo-finance/valueOfAsset.json b/projects/mmo-finance/valueOfAsset.json deleted file mode 100644 index db78cd3967c..00000000000 --- a/projects/mmo-finance/valueOfAsset.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "inputs": [ - { - "internalType": "address", - "name": "asset", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "valueOfAsset", - "outputs": [ - { - "internalType": "uint256", - "name": "valueInCRO", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "valueInUSD", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" -} \ No newline at end of file diff --git a/projects/mmo/helper/abis/MEtherInterfaceFull.json b/projects/mmo/helper/abis/MEtherInterfaceFull.json deleted file mode 100644 index a4bedb4a886..00000000000 --- a/projects/mmo/helper/abis/MEtherInterfaceFull.json +++ /dev/null @@ -1,59 +0,0 @@ -[ - { - "constant": true, - "inputs": [], - "name": "thisFungibleMToken", - "outputs": [ - { - "internalType": "uint240", - "name": "", - "type": "uint240" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "internalType": "uint240", - "name": "", - "type": "uint240" - } - ], - "name": "totalBorrows", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "internalType": "uint240", - "name": "", - "type": "uint240" - } - ], - "name": "totalCashUnderlying", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } -] diff --git a/projects/mmo/helper/abis/MtrollerInterfaceFull.json b/projects/mmo/helper/abis/MtrollerInterfaceFull.json deleted file mode 100644 index 69118dfce00..00000000000 --- a/projects/mmo/helper/abis/MtrollerInterfaceFull.json +++ /dev/null @@ -1,58 +0,0 @@ -[ - { - "constant": true, - "inputs": [], - "name": "oracle", - "outputs": [ - { - "internalType": "contract PriceOracle", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "price", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "internalType": "address", - "name": "underlyingToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenID", - "type": "uint256" - } - ], - "name": "getUnderlyingPrice", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } -] diff --git a/projects/mmo/helper/helper.js b/projects/mmo/helper/helper.js index b8854294701..f92dee6d7d1 100644 --- a/projects/mmo/helper/helper.js +++ b/projects/mmo/helper/helper.js @@ -1,8 +1,16 @@ const sdk = require("@defillama/sdk"); const { GraphQLClient, gql } = require("graphql-request"); -const mEtherABI = require("./abis/MEtherInterfaceFull.json"); -const MtrollerABI = require("./abis/MtrollerInterfaceFull.json"); +const mEtherABI = { + thisFungibleMToken: "function thisFungibleMToken() view returns (uint240)", + totalBorrows: "function totalBorrows(uint240) view returns (uint256)", + totalCashUnderlying: "function totalCashUnderlying(uint240) view returns (uint256)", +}; +const MtrollerABI = { + oracle: "address:oracle", + price: "uint256:price", + getUnderlyingPrice: "function getUnderlyingPrice(address underlyingToken, uint256 tokenID) view returns (uint256)", +} async function fetch(query) { var endpoint = @@ -23,9 +31,7 @@ async function getTotalCash(block) { `; const results = await fetch(getTotalSupply); - const thisFungibleMTokenABI = mEtherABI.find( - (i) => i.name === "thisFungibleMToken" - ); + const thisFungibleMTokenABI = mEtherABI.thisFungibleMToken; const mEtherIDCalls = results.vaults.map((vaultObj) => ({ target: vaultObj.id, })); @@ -36,9 +42,7 @@ async function getTotalCash(block) { block: block, }); - const totalCashUnderlyingABI = mEtherABI.find( - (i) => i.name === "totalCashUnderlying" - ); + const totalCashUnderlyingABI = mEtherABI.totalCashUnderlying; const totalCashUnderlyingCalls = results.vaults.map((vaultObj, idx) => ({ target: vaultObj.id, params: mEtherIDs.output[idx].output, @@ -74,7 +78,7 @@ async function getTotalCollateral(block) { let totalCollateral = 0; for (depositedNFTObj of results.depositedNFTsEntities) { if (depositedNFTObj.name === "Glasses") { - const getPriceABI = MtrollerABI.find((i) => i.name === "price"); + const getPriceABI = MtrollerABI.price const price = await sdk.api.abi.call({ abi: getPriceABI, @@ -83,15 +87,13 @@ async function getTotalCollateral(block) { }); totalCollateral += price.output / 10 ** 18; } else { - const getOracleABI = MtrollerABI.find((i) => i.name === "oracle"); + const getOracleABI = MtrollerABI.oracle const oracle = await sdk.api.abi.call({ abi: getOracleABI, target: depositedNFTObj.mtroller, block: block, }); - const getUnderlyingPriceABI = MtrollerABI.find( - (i) => i.name === "getUnderlyingPrice" - ); + const getUnderlyingPriceABI = MtrollerABI.getUnderlyingPrice const price = await sdk.api.abi.call({ abi: getUnderlyingPriceABI, target: oracle.output, diff --git a/projects/mmo/index.js b/projects/mmo/index.js index a163d40963b..ab63b1c0b1c 100644 --- a/projects/mmo/index.js +++ b/projects/mmo/index.js @@ -1,7 +1,11 @@ const sdk = require("@defillama/sdk"); const { gql } = require("graphql-request"); -const mEtherABI = require("./helper/abis/MEtherInterfaceFull.json"); +const mEtherABI = { + thisFungibleMToken: "function thisFungibleMToken() view returns (uint240)", + totalBorrows: "function totalBorrows(uint240) view returns (uint256)", + totalCashUnderlying: "function totalCashUnderlying(uint240) view returns (uint256)", +}; const { getTotalCash, getTotalCollateral, fetch } = require("./helper/helper"); async function tvl(_, block) { @@ -21,9 +25,7 @@ async function borrowed(_, block) { } `; const results = await fetch(getTotalBorrows); - const thisFungibleMTokenABI = mEtherABI.find( - (i) => i.name === "thisFungibleMToken" - ); + const thisFungibleMTokenABI = mEtherABI.thisFungibleMToken const mEtherIDCalls = results.vaults.map((vaultObj) => ({ target: vaultObj.id, })); @@ -33,7 +35,7 @@ async function borrowed(_, block) { calls: mEtherIDCalls, }); - const totalBorrowsABI = mEtherABI.find((i) => i.name === "totalBorrows"); + const totalBorrowsABI = mEtherABI.totalBorrows const totalBorrowsCall = results.vaults.map((vaultObj, idx) => ({ target: vaultObj.id, params: mEtherIDs.output[idx].output, diff --git a/projects/mobius/index.js b/projects/mobius/index.js index 4adf8e62771..dab40934c35 100644 --- a/projects/mobius/index.js +++ b/projects/mobius/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens2 } = require('../helper/unwrapLPs') let pools = [ @@ -5,7 +6,7 @@ let pools = [ "name": "USDC (Portal)", "address": "0xc0ba93d4aaf90d39924402162ee4a213300d1d60", "tokens": [ - "0x765DE816845861e75A25fCA122bb6898B8B1282a", + ADDRESSES.celo.cUSD, "0x37f750B7cC259A2f741AF45294f6a16572CF5cAd" ], "lp": "0xe10fd4788a76d19ba0110b1bfda5e13d35ed4359" @@ -14,7 +15,7 @@ let pools = [ "name": "Staked CELO", "address": "0xebf0536356256f8ff2a5eb6c65800839801d8b95", "tokens": [ - "0x471EcE3750Da237f93B8E339c536989b8978a438", + ADDRESSES.celo.CELO, "0xC668583dcbDc9ae6FA3CE46462758188adfdfC24" ], "lp": "0x4730ff6bc3008a40cf74d660d3f20d5b51646da3" @@ -23,8 +24,8 @@ let pools = [ "name": "UST (Allbridge)", "address": "0x9f4adbd0af281c69a582eb2e6fa2a594d4204cae", "tokens": [ - "0x765DE816845861e75A25fCA122bb6898B8B1282a", - "0xEd193C4E69F591E42398eF54DEa65aa1bb02835c" + ADDRESSES.celo.cUSD, + ADDRESSES.celo.atUST ], "lp": "0x9438e7281d7e3e99a9dd21e0ead9c6a254e17ab2" }, @@ -41,7 +42,7 @@ let pools = [ "name": "USDC (Optics V2)", "address": "0x9906589ea8fd27504974b7e8201df5bbde986b03", "tokens": [ - "0x765DE816845861e75A25fCA122bb6898B8B1282a", + ADDRESSES.celo.cUSD, "0xef4229c8c3250C675F21BCefa42f58EfbfF6002a" ], "lp": "0x39b6f09ef97db406ab78d869471adb2384c494e3" @@ -50,8 +51,8 @@ let pools = [ "name": "DAI (Optics V2)", "address": "0xf3f65dfe0c8c8f2986da0fec159abe6fd4e700b4", "tokens": [ - "0x765DE816845861e75A25fCA122bb6898B8B1282a", - "0x90Ca507a5D4458a4C6C6249d186b6dCb02a5BCCd" + ADDRESSES.celo.cUSD, + ADDRESSES.celo.DAI ], "lp": "0x274dd2df039f1f6131419c82173d97770e6af6b7" }, @@ -60,7 +61,7 @@ let pools = [ "address": "0xaefc4e8cf655a182e8346b24c8abce45616ee0d2", "tokens": [ "0xD629eb00dEced2a080B7EC630eF6aC117e614f1b", - "0xBAAB46E28388d2779e6E31Fd00cF0e5Ad95E327B" + ADDRESSES.celo.WBTC ], "lp": "0x20d7274c5af4f9de6e8c93025e44af3979d9ab2b" }, @@ -68,7 +69,7 @@ let pools = [ "name": "pUSDC (Optics V2)", "address": "0xcce0d62ce14fb3e4363eb92db37ff3630836c252", "tokens": [ - "0x765DE816845861e75A25fCA122bb6898B8B1282a", + ADDRESSES.celo.cUSD, "0x1bfc26cE035c368503fAE319Cc2596716428ca44" ], "lp": "0x68b239b415970dd7a5234a9701cbb5bfab544c7c" @@ -77,8 +78,8 @@ let pools = [ "name": "USDC (Optics V1)", "address": "0xa5037661989789d0310ac2b796fa78f1b01f195d", "tokens": [ - "0x765DE816845861e75A25fCA122bb6898B8B1282a", - "0x2A3684e9Dc20B857375EA04235F2F7edBe818FA7" + ADDRESSES.celo.cUSD, + ADDRESSES.celo.USDC ], "lp": "0xd7bf6946b740930c60131044bd2f08787e1ddbd4" }, @@ -86,8 +87,8 @@ let pools = [ "name": "aaUSDC (Allbridge)", "address": "0x0986b42f5f9c42feeef66fc23eba9ea1164c916d", "tokens": [ - "0x765DE816845861e75A25fCA122bb6898B8B1282a", - "0xb70e0a782b058BFdb0d109a3599BEc1f19328E36" + ADDRESSES.celo.cUSD, + ADDRESSES.celo.aaUSDC ], "lp": "0x730e677f39c4ca96012c394b9da09a025e922f81" }, @@ -95,7 +96,7 @@ let pools = [ "name": "Poof cUSD V2", "address": "0xa2f0e57d4ceacf025e81c76f28b9ad6e9fbe8735", "tokens": [ - "0x765DE816845861e75A25fCA122bb6898B8B1282a", + ADDRESSES.celo.cUSD, "0xEadf4A7168A82D30Ba0619e64d5BCf5B30B45226" ], "lp": "0x07e137e5605e15c93f22545868fa70cecfcbbffe" @@ -104,7 +105,7 @@ let pools = [ "name": "Poof CELO V2", "address": "0xfc9e2c63370d8deb3521922a7b2b60f4cff7e75a", "tokens": [ - "0x765DE816845861e75A25fCA122bb6898B8B1282a", + ADDRESSES.celo.cUSD, "0x301a61D01A63c8D670c2B8a43f37d12eF181F997" ], "lp": "0xaffd8d6b5e5a0e25034dd3d075532f9ce01c305c" @@ -122,7 +123,7 @@ let pools = [ "name": "Poof cUSD V1", "address": "0x02db089fb09fda92e05e92afcd41d9aafe9c7c7c", "tokens": [ - "0x765DE816845861e75A25fCA122bb6898B8B1282a", + ADDRESSES.celo.cUSD, "0xB4aa2986622249B1F45eb93F28Cfca2b2606d809" ], "lp": "0x18d71b8664e69d6dd61c79247dbf12bfaaf66c10" @@ -131,8 +132,8 @@ let pools = [ "name": "asUSDC (Allbridge)", "address": "0x63c1914bf00a9b395a2bf89aada55a5615a3656e", "tokens": [ - "0x765DE816845861e75A25fCA122bb6898B8B1282a", - "0xCD7D7Ff64746C1909E44Db8e95331F9316478817" + ADDRESSES.celo.cUSD, + ADDRESSES.celo.asUSDC ], "lp": "0xafee90ab6a2d3b265262f94f6e437e7f6d94e26e" }, @@ -140,7 +141,7 @@ let pools = [ "name": "pUSDC (Optics V1)", "address": "0x2080aaa167e2225e1fc9923250ba60e19a180fb2", "tokens": [ - "0x765DE816845861e75A25fCA122bb6898B8B1282a", + ADDRESSES.celo.cUSD, "0xcC82628f6A8dEFA1e2B0aD7ed448bef3647F7941" ], "lp": "0xf5b454cf47caca418d95930aa03975ee4bf409bc" @@ -167,8 +168,8 @@ let pools = [ "name": "USDT (Moss)", "address": "0xdbf27fd2a702cc02ac7acf0aea376db780d53247", "tokens": [ - "0x765DE816845861e75A25fCA122bb6898B8B1282a", - "0xcFFfE0c89a779c09Df3DF5624f54cDf7EF5fDd5D" + ADDRESSES.celo.cUSD, + ADDRESSES.celo.cUSDT ], "lp": "0xc7a4c6ef4a16dc24634cc2a951ba5fec4398f7e0" }, @@ -176,8 +177,8 @@ let pools = [ "name": "USDC (Moss)", "address": "0x0ff04189ef135b6541e56f7c638489de92e9c778", "tokens": [ - "0x765DE816845861e75A25fCA122bb6898B8B1282a", - "0x93DB49bE12B864019dA9Cb147ba75cDC0506190e" + ADDRESSES.celo.cUSD, + ADDRESSES.celo.cUSDC ], "lp": "0x635aec36c4b61bac5eb1c3eee191147d006f8a21" }, @@ -185,7 +186,7 @@ let pools = [ "name": "Poof Celo V1", "address": "0x413ffcc28e6cdde7e93625ef4742810fe9738578", "tokens": [ - "0x471EcE3750Da237f93B8E339c536989b8978a438", + ADDRESSES.celo.CELO, "0xE74AbF23E1Fdf7ACbec2F3a30a772eF77f1601E1" ], "lp": "0x4d6b17828d0173668e8eb730106444556a98c0f9" @@ -212,7 +213,7 @@ let pools = [ "name": "cUSD (Mento 1:1 Pool)", "address": "0xfa3df877f98ac5ecd87456a7accaa948462412f0", "tokens": [ - "0x765DE816845861e75A25fCA122bb6898B8B1282a", + ADDRESSES.celo.cUSD, "0x37f750B7cC259A2f741AF45294f6a16572CF5cAd" ], "lp": "0x552b9aa0eee500c60f09456e49fbc1096322714c" diff --git a/projects/mobiusfinance/abis/Resolver.json b/projects/mobiusfinance/abis/Resolver.json deleted file mode 100644 index ddc74534fa6..00000000000 --- a/projects/mobiusfinance/abis/Resolver.json +++ /dev/null @@ -1,72 +0,0 @@ -{ - "contractName": "Resolver", - "abi": [ - { - "inputs": [ - { - "internalType": "bytes32", - "name": "assetType", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "assetName", - "type": "bytes32" - } - ], - "name": "getAsset", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - }, - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "assetType", - "type": "bytes32" - } - ], - "name": "getAssets", - "outputs": [ - { - "internalType": "bytes32[]", - "name": "", - "type": "bytes32[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "name", - "type": "bytes32" - } - ], - "name": "getAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } - ] -} \ No newline at end of file diff --git a/projects/mobiusfinance/index.js b/projects/mobiusfinance/index.js index 039686413e3..ce29bcbbc2f 100644 --- a/projects/mobiusfinance/index.js +++ b/projects/mobiusfinance/index.js @@ -1,14 +1,18 @@ +const ADDRESSES = require('../helper/coreAssets.json') const formatBytes32String = require('ethers').utils.formatBytes32String; const { sumTokens, } = require('../helper/unwrapLPs') -const { resolveCrvTokens, } = require('../helper/resolveCrvTokens') const { transformPolygonAddress } = require('../helper/portedTokens') const ResolverAddr = "0x1E02cdbbA6729B6470de81Ad4D2cCA4c514521b9" -const ResolverJson = require('./abis/Resolver.json').abi; +const ResolverJson = { + getAsset: "function getAsset(bytes32 assetType, bytes32 assetName) view returns (bool, address)", + getAssets: "function getAssets(bytes32 assetType) view returns (bytes32[])", + getAddress: "function getAddress(bytes32 name) view returns (address)", +} const sdk = require('@defillama/sdk') const chain = 'polygon' -const nullAddr = "0x0000000000000000000000000000000000000000" +const nullAddr = ADDRESSES.null const motToken = '0x2db0Db271a10661e7090b6758350E18F6798a49D' async function tvl(ts, _block, { polygon: block }) { @@ -23,10 +27,10 @@ async function tvl(ts, _block, { polygon: block }) { Collaterals, ] = await Promise.all([ sdk.api.abi.call({ - target: ResolverAddr, abi: ResolverJson.find(i => i.name === 'getAddress'), params: [mobiusStr], block, chain, + target: ResolverAddr, abi: ResolverJson.getAddress, params: [mobiusStr], block, chain, }), sdk.api.abi.call({ - target: ResolverAddr, abi: ResolverJson.find(i => i.name === 'getAssets'), params: [stakeStr], block, chain, + target: ResolverAddr, abi: ResolverJson.getAssets, params: [stakeStr], block, chain, }), ]).then(o => o.map(i => i.output)) @@ -36,7 +40,7 @@ async function tvl(ts, _block, { polygon: block }) { return; let { output: r } = await sdk.api.abi.call({ - target: ResolverAddr, abi: ResolverJson.find(i => i.name === 'getAsset'), params: [stakeStr, collateral], block, chain, + target: ResolverAddr, abi: ResolverJson.getAsset, params: [stakeStr, collateral], block, chain, }) if (!r[0]) @@ -52,7 +56,6 @@ async function tvl(ts, _block, { polygon: block }) { } })) - await resolveCrvTokens(balances, block, chain, transform) return balances } @@ -63,7 +66,7 @@ async function staking(ts, _block, { polygon: block }) { MobiusAddr, ] = await Promise.all([ sdk.api.abi.call({ - target: ResolverAddr, abi: ResolverJson.find(i => i.name === 'getAddress'), params: [mobiusStr], block, chain, + target: ResolverAddr, abi: ResolverJson.getAddress, params: [mobiusStr], block, chain, }), ]).then(o => o.map(i => i.output)) @@ -77,7 +80,7 @@ async function pool2(ts, _block, { polygon: block }) { rewardAddr, ] = await Promise.all([ sdk.api.abi.call({ - target: ResolverAddr, abi: ResolverJson.find(i => i.name === 'getAddress'), params: [rewardAddrStr], block, chain, + target: ResolverAddr, abi: ResolverJson.getAddress, params: [rewardAddrStr], block, chain, }), ]).then(o => o.map(i => i.output)) const toa = [ @@ -86,7 +89,7 @@ async function pool2(ts, _block, { polygon: block }) { '0x49d8136336e3feb7128c12172ae5ff78238a88be', ].map(t => [t, rewardAddr]) - return sumTokens({}, toa, block, chain, undefined, { resolveLP: true, resolveCrv: true, }) + return sumTokens({}, toa, block, chain, undefined, { resolveLP: true,}) } module.exports = { diff --git a/projects/mochifi/index.js b/projects/mochifi/index.js index 36def13b40a..e791eaaa99e 100644 --- a/projects/mochifi/index.js +++ b/projects/mochifi/index.js @@ -1,23 +1,19 @@ // node test.js projects/mochifi/index.js -const { get } = require('../helper/http') -const sdk = require('@defillama/sdk'); -const BigNumber = require('bignumber.js'); +const { getConfig } = require('../helper/cache') +const { sumTokens2 } = require('../helper/unwrapLPs'); -async function ethereum(timestamp, block, chainBlocks) { - const { vaults } = await get('https://backend.mochi.fi/vaults?chainId=1'); +async function ethereum(timestamp, block, chainBlocks, { api }) { + const { vaults } = await getConfig('mochifi','https://backend.mochi.fi/vaults?chainId=1'); - const results = {} - vaults - .forEach(v => { - if (+v.vaultDeposits > 0) - sdk.util.sumSingleBalance(results, v.tokenAddress.toLowerCase(), BigNumber(v.vaultDeposits * (10 ** +v.decimals)).toFixed(0)) - }) - delete results['0x60ef10edff6d600cd91caeca04caed2a2e605fe5'] - return results + const tokensAndOwners = vaults.map(i => ([i.tokenAddress, i.vaultAddress])) + return sumTokens2({ + api, + tokensAndOwners, + blacklistedTokens: ['0x60ef10edff6d600cd91caeca04caed2a2e605fe5'] + }) } module.exports = { - timetravel: false, methodology: "TVL counts collateral deposits to mint USDM", ethereum: { tvl: ethereum diff --git a/projects/mochiswap/index.js b/projects/mochiswap/index.js index c319ba26796..3b0fc7e3aea 100644 --- a/projects/mochiswap/index.js +++ b/projects/mochiswap/index.js @@ -39,7 +39,6 @@ async function harmonyStaking(timestamp, block, chainBlocks) { module.exports = { bsc: { tvl: getUniTVL({ - chain: 'bsc', factory: bscFactory, useDefaultCoreAssets: true, }), @@ -47,7 +46,6 @@ module.exports = { }, harmony: { tvl: getUniTVL({ - chain: 'harmony', factory: harmonyFactory, useDefaultCoreAssets: true, }), diff --git a/projects/mojitoswap/index.js b/projects/mojitoswap/index.js index 2ec6c36d45a..9d024d674c3 100644 --- a/projects/mojitoswap/index.js +++ b/projects/mojitoswap/index.js @@ -1,8 +1,9 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { getUniTVL } = require('../helper/unknownTokens') const { stakings } = require('../helper/staking') const masterchefAddress = "0x25c6d6a65c3ae5d41599ba2211629b24604fea4f"; const masterchefV2Address = "0xfdfcE767aDD9dCF032Cbd0DE35F0E57b04495324"; -const mjtAddress = "0x2ca48b4eea5a731c2b54e7c3944dbdb87c0cfb6f"; +const mjtAddress = ADDRESSES.kcc.MJT; module.exports = { misrepresentedTokens: true, diff --git a/projects/mole/abi.json b/projects/mole/abi.json index ba399ba575a..7da1b07d910 100644 --- a/projects/mole/abi.json +++ b/projects/mole/abi.json @@ -1,128 +1,10 @@ { - "vaultDebtVal": { - "inputs": [], - "name": "vaultDebtVal", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "token": { - "inputs": [], - "name": "token", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "pid": { - "inputs": [], - "name": "pid", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "reservePool": { - "inputs": [], - "name": "reservePool", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "balanceOf": { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "lpToken": { - "inputs": [], - "name": "lpToken", - "outputs": [ - { - "internalType": "contract IPancakePair", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "userInfo": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "userInfo", - "outputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "rewardDebt", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "xmoleTotalSupply": { - "inputs": [], - "name": "supply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -} + "vaultDebtVal": "uint256:vaultDebtVal", + "token": "address:token", + "pid": "uint256:pid", + "reservePool": "uint256:reservePool", + "balanceOf": "function balanceOf(address account) view returns (uint256)", + "lpToken": "address:lpToken", + "userInfo": "function userInfo(uint256, address) view returns (uint256 amount, uint256 rewardDebt)", + "xmoleTotalSupply": "uint256:supply" +} \ No newline at end of file diff --git a/projects/mole/index.js b/projects/mole/index.js index 4a7a8916265..45b82448d72 100644 --- a/projects/mole/index.js +++ b/projects/mole/index.js @@ -1,22 +1,38 @@ -const { calLyfTvl } = require("./lyf"); +const { calLyfTvl, calLyfTvlAptos, calLyfTvlSui } = require("./lyf"); const { calxMOLEtvl } = require('./xmole'); +// async function avaxTvl(timestamp, ethBlock, chainBlocks) { +// const lyfTvl = await calLyfTvl('avax', chainBlocks.avax); +// return {...lyfTvl}; +// } -async function avaxTvl(timestamp, ethBlock, chainBlocks) { - const lyfTvl = await calLyfTvl('avax', chainBlocks.avax); +// async function avaxStaking(timestamp, ethBlock, chainBlocks) { +// return await calxMOLEtvl('avax', chainBlocks.avax); +// } + +async function aptosTvl() { + const lyfTvl = await calLyfTvlAptos() return {...lyfTvl}; } -async function avaxStaking(timestamp, ethBlock, chainBlocks) { - return await calxMOLEtvl('avax', chainBlocks.avax); -} +async function suiTvl() { + const { api } = arguments[3] + return calLyfTvlSui(api) +} -// node test.js projects/mole/index.js +// run command: node test.js projects/mole/index.js module.exports = { + timetravel: false, start: 1653840000, - avax: { - tvl: avaxTvl, - staking: avaxStaking, + // avax: { + // tvl: avaxTvl, + // staking: avaxStaking, + // }, + aptos: { + tvl: aptosTvl + }, + sui: { + tvl: suiTvl } }; diff --git a/projects/mole/lyf.js b/projects/mole/lyf.js index 25594f8999e..966b803e48f 100644 --- a/projects/mole/lyf.js +++ b/projects/mole/lyf.js @@ -1,24 +1,43 @@ const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); const BigNumber = require("bignumber.js"); -const axios = require("axios"); +const { coreTokens } = require("../helper/chain/aptos"); +const { getResources } = require("../helper/chain/aptos"); +const { getConfig } = require('../helper/cache') const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); -const { transformAvaxAddress } = require("../helper/portedTokens"); +const sui = require('../helper/chain/sui') +const { transformBalances } = require("../helper/portedTokens"); +const { i32BitsToNumber } = require("./utils") async function getProcolAddresses(chain) { - if (chain == 'avax') { + // if (chain === 'avax') { + // return ( + // await getConfig('mole/'+chain, + // "https://raw.githubusercontent.com/Mole-Fi/mole-protocol/main/.avalanche_mainnet.json" + // ) + // ); + // } + + if (chain === 'aptos') { + return ( + await getConfig('mole/' + chain, + "https://raw.githubusercontent.com/Mole-Fi/mole-protocol/main/.aptos_mainnet.json" + ) + ); + } else if (chain === 'sui') { return ( - await axios.get( - "https://raw.githubusercontent.com/Mole-Fi/mole-protocol/main/.avalanche_mainnet.json" + await getConfig('mole/' + chain, + "https://raw.githubusercontent.com/Mole-Fi/mole-protocol/main/.sui_mainnet.json" ) - ).data; + ); } } +// avax async function calLyfTvl(chain, block) { /// @dev Initialized variables const balances = {}; - const transform = await transformAvaxAddress() + const transform = addr => 'avax:' + addr /// @dev Getting all addresses from Github const addresses = await getProcolAddresses(chain); @@ -85,7 +104,211 @@ async function calLyfTvl(chain, block) { return balances; } +// aptos +async function calLyfTvlAptos() { + /// @dev Initialized variables + const balances = {}; + + /// @dev Getting all resources + const addresses = await getProcolAddresses('aptos'); + const resources = await getResources(addresses.Publisher); + + const lps = {}; + + const workers = {} + addresses.Vaults.flatMap(i => i.workers).map(i => { + workers[i.address.replace('0x0', '0x')] = true; + }); + + /// @dev getting balances that each of workers holding + sumPancakeWorkerStakingLps(resources, lps, workers); + + /// @dev unwrap LP to get underlaying token balances for workers that are working with LPs + await unwrapPancakeSwapLps({ + balances, + lps, + account: '0xc7efb4076dbe143cbcd98cfaaa929ecfc8f299203dfff63b95ccb6bfe19850fa', + poolStr: 'swap::TokenPairReserve', + token0Reserve: i => i.data.reserve_x, + token1Reserve: i => i.data.reserve_y + }) + + /// @dev getting all unused liquidity on each vault + resources.filter(i => i.type.includes("vault::VaultInfo")) + .map(i => { + const token = i.type.split('<')[1].replace('>', ''); + sdk.util.sumSingleBalance(balances, token, new BigNumber(i.data.coin.value).minus(i.data.reserve_pool).toFixed(0)) + }) + + return transformBalances('aptos', balances) +} + +function sumPancakeWorkerStakingLps(resources, lps, workers) { + const workerInfos = resources.filter(i => + ( + i.type.includes("pancake_worker::WorkerInfo") || + i.type.includes("delta_neutral_pancake_asset_worker::WorkerInfo") || + i.type.includes("delta_neutral_pancake_stable_worker::WorkerInfo") + ) && workers[i.type.split('::', 1)[0]] + ) + + workerInfos.forEach(i => { + let lpWithSuffix = i.type.split(", "); + lpWithSuffix = lpWithSuffix.splice(2, lpWithSuffix.length - 2).join(", "); + const lp = lpWithSuffix.substr(0, lpWithSuffix.length - 1); + const amount = new BigNumber(i.data.total_balance ?? i.data.total_lp_balance) + + if (lps[lp] === undefined) { + lps[lp] = { amount: amount } + } else { + lps[lp].amount = lps[lp].amount.plus(amount); + } + }) +} + +async function unwrapPancakeSwapLps({ + balances, + lps, + account, + poolStr, + token0Reserve = i => i.data.coin_x_reserve.value, + token1Reserve = i => i.data.coin_y_reserve.value, + getTokens = i => i.type.split('<')[1].replace('>', '').split(', ') +}) { + const coinInfos = {} + const lpReserves = {} + for (const lpType in lps) { + if (lps.hasOwnProperty(lpType)) { + coinInfos[`0x1::coin::CoinInfo<${lpType}>`] = lpType; + const tokens = getTokens({ type: lpType }) + lpReserves[`${account}::${poolStr}<${tokens[0]}, ${tokens[1]}>`] = lpType; + } + } + + let pools = await getResources(account); + let lpInfos = pools; + pools = pools.filter((i) => { + if (!i.type.includes(poolStr)) { + return false + } + + i.lpType = lpReserves[i.type] + return i.lpType !== undefined; + }); + lpInfos.forEach(i => { + const lpType = coinInfos[i.type]; + if (lpType) { + lps[lpType].totalSupply = new BigNumber(i.data.supply.vec[0].integer.vec[0].value) + } + }); + + pools.forEach(i => { + const reserve0 = token0Reserve(i) + const reserve1 = token1Reserve(i) + const [token0, token1] = getTokens(i) + const isCoreAsset0 = coreTokens.includes(token0) + const isCoreAsset1 = coreTokens.includes(token1) + const nonNeglibleReserves = reserve0 !== '0' && reserve1 !== '0' + const lp = lps[i.lpType]; + const balance0 = new BigNumber(reserve0).times(lp.amount).div(lp.totalSupply).toFixed(0); + const balance1 = new BigNumber(reserve1).times(lp.amount).div(lp.totalSupply).toFixed(0); + if (isCoreAsset0 && isCoreAsset1) { + sdk.util.sumSingleBalance(balances, token0, balance0) + sdk.util.sumSingleBalance(balances, token1, balance1) + } else if (isCoreAsset0) { + sdk.util.sumSingleBalance(balances, token0, balance0) + if (nonNeglibleReserves) + sdk.util.sumSingleBalance(balances, token0, balance0) + } else if (isCoreAsset1) { + sdk.util.sumSingleBalance(balances, token1, balance1) + if (nonNeglibleReserves) + sdk.util.sumSingleBalance(balances, token1, balance1) + } + }) +} + +// sui +async function calLyfTvlSui(api) { + + // calculate the Farming TVL. + + /// @dev Getting all resources + const addresses = await getProcolAddresses('sui'); + const workerInfoIds = addresses.Vaults.flatMap(valut => valut.workers).map(worker => worker.workerInfo) + const workerInfos = await sui.getObjects(workerInfoIds) + + let poolIds = [] + workerInfos.forEach(workerInfo => { + let poolId = workerInfo.fields.position_nft.fields.pool + // poolId = poolId.replace('0x0', '0x') + if (!poolIds.includes(poolId)) { + poolIds.push(poolId) + } + } + ) + + const poolInfos = await sui.getObjects(poolIds) + let poolMap = new Map() + poolInfos.forEach(poolInfo => { + // const poolId = poolInfo.fields.id.id.replace('0x0', '0x') + poolMap.set(poolInfo.fields.id.id, poolInfo) + } + ) + + workerInfos.forEach(workerInfo => { + let poolId = workerInfo.fields.position_nft.fields.pool + + let coinAamount = 0 + let coinBamount = 0 + computeCLMMPositionBalances() + + const [coinA, coinB] = poolMap.get(poolId).type.replace('>', '').split('<')[1].split(', ') + api.add(coinA, coinAamount) + api.add(coinB, coinBamount) + + // code copied from uni v3 NFT resolver + function computeCLMMPositionBalances() { + const tickToPrice = (tick) => 1.0001 ** tick + + const liquidity = workerInfo.fields.position_nft.fields.liquidity + const tickLowerIndex = i32BitsToNumber(workerInfo.fields.position_nft.fields.tick_lower_index.fields.bits) + const tickUpperIndex = i32BitsToNumber(workerInfo.fields.position_nft.fields.tick_upper_index.fields.bits) + const bottomTick = tickLowerIndex + const topTick = tickUpperIndex + const tick = i32BitsToNumber(poolMap.get(poolId).fields.current_tick_index.fields.bits) + const sa = tickToPrice(bottomTick / 2) + const sb = tickToPrice(topTick / 2) + + if (tick < bottomTick) { + coinAamount = liquidity * (sb - sa) / (sa * sb) + } else if (tick < topTick) { + const price = tickToPrice(tick) + const sp = price ** 0.5 + + coinAamount = liquidity * (sb - sp) / (sp * sb) + coinBamount = liquidity * (sp - sa) + } else { + coinBamount = liquidity * (sb - sa) + } + } + } + ) + + // calculate the Vault TVL. + + const vaultInfoIds = addresses.Vaults.map(valut => valut.vaultInfo) + const vaultInfos = await sui.getObjects(vaultInfoIds) + + for (let i = 0; i < vaultInfos.length; i++) { + const baseToken = addresses.Vaults[i].baseToken + const tokenAmount = vaultInfos[i].fields.value.fields.coin + api.add(baseToken, tokenAmount) + } +} + + module.exports = { - calLyfTvl + calLyfTvl, + calLyfTvlAptos, + calLyfTvlSui, } - \ No newline at end of file diff --git a/projects/mole/utils.js b/projects/mole/utils.js new file mode 100644 index 00000000000..fc5220af102 --- /dev/null +++ b/projects/mole/utils.js @@ -0,0 +1,12 @@ + +function asIntN(int, bits = 32) { + return Number(BigInt.asIntN(bits, BigInt(int))); +} + +function i32BitsToNumber(v) { + return asIntN(BigInt(v), 32); +} + +module.exports = { + i32BitsToNumber, +} diff --git a/projects/mole/xmole.js b/projects/mole/xmole.js index fd9535ffca3..914ffdd1044 100644 --- a/projects/mole/xmole.js +++ b/projects/mole/xmole.js @@ -1,15 +1,14 @@ const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); -const BigNumber = require("bignumber.js"); -const axios = require("axios"); +const { getConfig } = require('../helper/cache') async function getProcolXMoleAddresses(chain) { if (chain == "avax") { return ( - await axios.get( + await getConfig('xmole', "https://raw.githubusercontent.com/Mole-Fi/mole-protocol-xmole/main/.avalanche_mainnet.json" ) - ).data; + ); } } diff --git a/projects/monolend/index.js b/projects/monolend/index.js new file mode 100644 index 00000000000..c38eb994ab6 --- /dev/null +++ b/projects/monolend/index.js @@ -0,0 +1,6 @@ +const { aaveExports } = require("../helper/aave"); + +module.exports = { + methodology: "Counts the tokens locked in the contracts to be used as collateral to borrow or to earn yield. Borrowed coins are not counted towards the TVL, so only the coins actually locked in the contracts are counted. There are multiple reasons behind this but one of the main ones is to avoid inflating the TVL through cycled lending.", + polygon: aaveExports('polygon', '0x49Ce0308F3F55955D224453aECe7610b6983c123'), +}; diff --git a/projects/monolith/abis.json b/projects/monolith/abis.json new file mode 100644 index 00000000000..02d452e5496 --- /dev/null +++ b/projects/monolith/abis.json @@ -0,0 +1,13 @@ +{ + "lens": { + "poolsInfo": "function poolsInfo() view returns (tuple(address id, string symbol, bool stable, address token0Address, address token1Address, address gaugeAddress, address bribeAddress, address[] bribeTokensAddresses, address fees, uint256 totalSupply, address feeDistAddress)[])", + "poolsReservesInfo": "function poolsReservesInfo(address[] pools) view returns (tuple(address id, address token0Address, address token1Address, uint256 token0Reserve, uint256 token1Reserve, uint8 token0Decimals, uint8 token1Decimals)[])", + "veTokensIdsOf": "function veTokensIdsOf(address owner) view returns (uint256[] tokens)" + }, + "gauge": { + "balanceOf": "function balanceOf(address owner) view returns (uint256 balance)" + }, + "vesolid": { + "locked": "function locked(uint256) view returns (int128 amount, uint256 end)" + } +} diff --git a/projects/monolith/index.js b/projects/monolith/index.js new file mode 100644 index 00000000000..fcdfea5ede4 --- /dev/null +++ b/projects/monolith/index.js @@ -0,0 +1,58 @@ +const sdk = require("@defillama/sdk"); +const ABI = require("./abis.json") + +const vesolidAddress = "0x77730ed992D286c53F3A0838232c3957dAeaaF73"; +const solidAddress = "0x777172D858dC1599914a1C4c6c9fC48c99a60990"; +const solidlyLensAddress = "0x7778D2091E3c97a259367c2cfc621cF839Bbbe2c"; +const lpDepositor = "0x822ef744c568466d40ba28b0f9e4a4961837a46a"; + +async function tvl(time, ethBlock, chainBlocks, { api }) { + const balances = {}; + + const addBalance = (tokenAddress, amount) => sdk.util.sumSingleBalance(balances, tokenAddress, amount, api.chain) + + const poolsInfo = await api.call({ + target: solidlyLensAddress, + abi: ABI.lens.poolsInfo, + }); + + const poolsReservesInfo = await api.call({ + params: [poolsInfo.map((p) => p.id)], + target: solidlyLensAddress, + abi: ABI.lens.poolsReservesInfo, + }); + + const depositorPoolBalances = await api.multiCall({ + calls: poolsInfo.map((p) => ({ + target: p.gaugeAddress, + params: [lpDepositor], + })), + abi: ABI.gauge.balanceOf, + }); + + for (let i = 0; i < poolsInfo.length; i++) { + const poolInfo = poolsInfo[i]; + const poolReservesInfo = poolsReservesInfo[i]; + const depositorBalance = depositorPoolBalances[i] + + const shareOfTotalSupply =depositorBalance / poolInfo.totalSupply + let token0Reserve =poolReservesInfo.token0Reserve * shareOfTotalSupply + let token1Reserve =poolReservesInfo.token1Reserve * shareOfTotalSupply + + addBalance(poolInfo.token0Address, token0Reserve); + addBalance(poolInfo.token1Address, token1Reserve); + } + + const veTokenIds = await api.call({ abi: ABI.lens.veTokensIdsOf, target: solidlyLensAddress, params: lpDepositor}) + const amounts = await api.multiCall({ abi: ABI.vesolid.locked, calls: veTokenIds, target: vesolidAddress}) + amounts.forEach(i => addBalance(solidAddress, i.amount)) + + return balances; +} + +module.exports = { + misrepresentedTokens: true, + ethereum: { + tvl, + }, +}; diff --git a/projects/monopoly-finance/abi.json b/projects/monopoly-finance/abi.json new file mode 100644 index 00000000000..ba25caa69eb --- /dev/null +++ b/projects/monopoly-finance/abi.json @@ -0,0 +1,10 @@ +{ + "poolInfo": "function poolInfo(uint256) view returns (address lpToken, address strategy, uint256 allocPoint, uint256 lastRewardTimestamp, uint256 accEarningPerShare, uint256 totalShares, uint256 lpPerShare, uint16 depositFeeBP, uint16 withdrawFeeBP, bool isWithdrawFee)", + "poolLength": "uint256:poolLength", + "totalSupply": "uint256:totalSupply", + "getReserves": "function getReserves() view returns (uint256 _reserve0, uint256 _reserve1)", + "getAssets": "function getAssets() view returns (address[] assets)", + "token0": "address:token0", + "token1": "address:token1", + "getTotalAmounts": "function getTotalAmounts() view returns (uint256 totalAmount0, uint256 totalAmount1)" +} diff --git a/projects/monopoly-finance/index.js b/projects/monopoly-finance/index.js new file mode 100644 index 00000000000..820a5d2a1aa --- /dev/null +++ b/projects/monopoly-finance/index.js @@ -0,0 +1,37 @@ +const { staking } = require("../helper/staking"); +const abi = require("./abi.json"); +const { unwrapLPsAuto } = require("../helper/unwrapLPs"); +const chef = "0x2900f5E68cD57b712806f60096514A4D3F772E9D"; +const poly = "0x34772C4D12F288368Aa35AE7bc527A6B2b3e8906".toLowerCase(); +const ACC_POLY_PRECISION = 1e18; + +async function getTokensInMasterChef(time, ethBlock, chainBlocks, { api }) { + const poolInfo = await api.fetchList({ + lengthAbi: abi.poolLength, + itemAbi: abi.poolInfo, + target: chef, + }); + + poolInfo.forEach((pool) => { + let { lpToken, totalShares, lpPerShare } = pool; + lpToken = lpToken.toLowerCase(); + if (lpToken === poly) { + return; + } + let bals = (totalShares * lpPerShare) / ACC_POLY_PRECISION; + api.add(lpToken, bals); + }); + await unwrapLPsAuto({ + api, + lpAddresses: poolInfo.map((p) => p.lpToken), + block: chainBlocks["arbitrum"], + }); +} +module.exports = { + methodology: + "TVL includes all farms in MasterChef contract, as well as staking pools.", + arbitrum: { + tvl: getTokensInMasterChef, + staking: staking("0xF30489AdB76745BFb201023403B5E1bCcb216354", poly), + }, +}; diff --git a/projects/monox/index.js b/projects/monox/index.js index 88f1aa6468c..c67ebfd3fbd 100644 --- a/projects/monox/index.js +++ b/projects/monox/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const {sumTokensSharedOwners} = require('../helper/unwrapLPs') async function eth(timestamp, ethBlock, chainBlocks){ @@ -6,10 +7,10 @@ async function eth(timestamp, ethBlock, chainBlocks){ await sumTokensSharedOwners(balances, [ "0x99d8a9c45b2eca8864373a26d1459e3dff1e17f3", "0x92e187a03b6cd19cb6af293ba17f2745fd2357d5", - "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599", - "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", - "0xdac17f958d2ee523a2206206994597c13d831ec7", - "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" + ADDRESSES.ethereum.WBTC, + ADDRESSES.ethereum.WETH, + ADDRESSES.ethereum.USDT, + ADDRESSES.ethereum.USDC ], ["0x59653E37F8c491C3Be36e5DD4D503Ca32B5ab2f4"], ethBlock) return balances } @@ -18,11 +19,11 @@ async function polygon(timestamp, ethBlock, chainBlocks){ const block = chainBlocks.polygon const balances = {} await sumTokensSharedOwners(balances, [ - "0x1bfd67037b42cf73acf2047067bd4f2c47d9bfd6", - "0xc2132d05d31c914a87c6611c10748aeb04b58e8f", - "0x2791bca1f2de4661ed88a30c99a7a9449aa84174", - "0x7ceb23fd6bc0add59e62ac25578270cff1b9f619", - "0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270", + ADDRESSES.polygon.WBTC, + ADDRESSES.polygon.USDT, + ADDRESSES.polygon.USDC, + ADDRESSES.polygon.WETH_1, + ADDRESSES.polygon.WMATIC_2, ], ["0x3826367A5563eCE9C164eFf9701146d96cC70AD9"], block, "polygon") return balances } diff --git a/projects/moola/index.js b/projects/moola/index.js index 15d8e9d7176..a97c2d72add 100644 --- a/projects/moola/index.js +++ b/projects/moola/index.js @@ -1,9 +1,10 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { aaveChainTvl } = require('../helper/aave') const { singleAssetV1Market } = require('../aave/v1') const sdk = require('@defillama/sdk') const v1PoolCore = "0xAF106F8D4756490E7069027315F4886cc94A8F73" -const gasAsset = "0x471ece3750da237f93b8e339c536989b8978a438" +const gasAsset = ADDRESSES.celo.CELO function lending(borrowed) { return async (timestamp, ethBlock, {celo: block}) => { diff --git a/projects/moondao/index.js b/projects/moondao/index.js index 28eea1e633d..475529c8dd8 100644 --- a/projects/moondao/index.js +++ b/projects/moondao/index.js @@ -1,11 +1,15 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { ohmTvl } = require('../helper/ohm') const treasury = "0xeC2aE8A3E2692E4b0836AB5cf88104d101DEBEf4" +module.exports.hallmarks=[ + [1639180800,"Rug Pull"] +], module.exports = ohmTvl(treasury, [ //DAI ["0x80a16016cc4a2e6a2caca8a4a498b1699ff0f844", false], //USDC - ["0xe3f5a90f9cb311505cd691a46596599aa1a0ad7d", false], + [ADDRESSES.moonriver.USDC, false], //solarbeam LP ["0xdbf638d800190271f5473e76898c6c8e741cba51", true], ], "moonriver", "0x534F861B6BaFdF030E5b469D2d763834163f522f", "0x761cb807bFbF14A4f4bA980f29F43F009F6a18c0") \ No newline at end of file diff --git a/projects/mooniswap/abi.json b/projects/mooniswap/abi.json index 41977559cfc..02e1cc444d6 100644 --- a/projects/mooniswap/abi.json +++ b/projects/mooniswap/abi.json @@ -1,47 +1,5 @@ { - "getPool": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "allPools", - "outputs": [ - { - "internalType": "contract Mooniswap", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getAllPools": { - "inputs": [], - "name": "getAllPools", - "outputs": [ - { - "internalType": "contract Mooniswap[]", - "name": "", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getTokens": { - "inputs": [], - "name": "getTokens", - "outputs": [ - { - "internalType": "contract IERC20[]", - "name": "", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - } + "getPool": "function allPools(uint256) view returns (address)", + "getAllPools": "address[]:getAllPools", + "getTokens": "address[]:getTokens" } \ No newline at end of file diff --git a/projects/moonlift/index.js b/projects/moonlift/index.js index ba5ea9ea3e3..2a7e44da2aa 100644 --- a/projects/moonlift/index.js +++ b/projects/moonlift/index.js @@ -5,7 +5,6 @@ module.exports = { bsc: { tvl: getUniTVL({ factory: '0xe9cABbC746C03010020Fd093cD666e40823E0D87', - chain: 'bsc', useDefaultCoreAssets: true }) }, diff --git a/projects/moonswap/index.js b/projects/moonswap/index.js index a28b4cf6122..ba0db0ebce9 100644 --- a/projects/moonswap/index.js +++ b/projects/moonswap/index.js @@ -3,7 +3,6 @@ const { getUniTVL } = require('../helper/unknownTokens') module.exports = { moonriver: { tvl: getUniTVL({ - chain: 'moonriver', factory: '0x056973f631a5533470143bb7010c9229c19c04d2', useDefaultCoreAssets: true, blacklist: [ diff --git a/projects/moonswap/onchain.js b/projects/moonswap/onchain.js index 6003be8701d..bc5bace50ef 100644 --- a/projects/moonswap/onchain.js +++ b/projects/moonswap/onchain.js @@ -1,9 +1,9 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); -const axios = require('axios'); const factoryAbi = require("../helper/abis/factory.json"); -const token0 = require("../helper/abis/token0.json"); -const token1 = require("../helper/abis/token1.json"); -const getReserves = require("../helper/abis/getReserves.json"); +const token0 = 'address:token0' +const token1 = 'address:token1' +const getReserves = 'function getReserves() view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast)' async function tvl(timestamp, ethBlock, chainBlocks) { let balances = {}; @@ -83,27 +83,27 @@ async function tvl(timestamp, ethBlock, chainBlocks) { } else { balances[tokenId[0]] = reserves[n].output[side] * 2 / 10**tokenId[1]; - }; - }; + } + } return balances; -}; +} function getTokenId(address) { switch(address) { case '0x98878b06940ae243284ca214f92bb71a2b032b8a': return ['moonriver', 18] - case '0xe3f5a90f9cb311505cd691a46596599aa1a0ad7d': + case [ADDRESSES.moonriver.USDC]: return ['usd-coin', 6] - case '0xb44a9b6905af7c801311e8f4e76932ee959c663c': + case [ADDRESSES.moonriver.USDT]: return ['tether', 6] - case '0x639a647fbe20b6c8ac19e48e2de44ea792c62c5c': + case [ADDRESSES.moonriver.ETH]: return ['ethereum', 18] case '0x5d9ab5522c64e1f6ef5e3627eccc093f56167818': return ['binance-usd', 18] default: return false; - }; -}; + } +} // node test.js projects/moonswap/index.js module.exports = { misrepresentedTokens: true, diff --git a/projects/moraswap/index.js b/projects/moraswap/index.js new file mode 100644 index 00000000000..efcf9e3ca0c --- /dev/null +++ b/projects/moraswap/index.js @@ -0,0 +1,14 @@ +const { getUniTVL } = require('../helper/unknownTokens') +const { stakingUnknownPricedLP } = require('../helper/staking.js') + +const dexTVL_neon = getUniTVL({ factory: '0xd43F135f6667174f695ecB7DD2B5f953d161e4d1', useDefaultCoreAssets: true }) + +module.exports = { + misrepresentedTokens: true, + neon_evm: { + tvl: dexTVL_neon, + staking: stakingUnknownPricedLP("0xa3da566fdE97c90c08052f612BdBed8F3B8004B7", "0x2043191e10a2A4b4601F5123D6C94E000b5d915F", 'neon_evm', '0xe6faaf048b2A9b9Bf906aBdD8623811458d81Cf3'), + } +}; + + diff --git a/projects/moremoney/StakingMetadata.js b/projects/moremoney/StakingMetadata.js index 3b51ad94ff4..be3848899b0 100644 --- a/projects/moremoney/StakingMetadata.js +++ b/projects/moremoney/StakingMetadata.js @@ -1,5 +1,6 @@ +const ADDRESSES = require('../helper/coreAssets.json') -const nullAddress = '0x0000000000000000000000000000000000000000' +const nullAddress = ADDRESSES.null const sdk = require("@defillama/sdk"); const addresses = require("./addresses.json"); @@ -9,87 +10,7 @@ async function useParsedStakingMetadata(block) { const stratViewer = await sdk.api.abi.call({ block, target: curAddresses.CurvePoolRewards, - abi: { - inputs: [ - { - internalType: "address", - name: "account", - type: "address", - }, - ], - name: "stakingMetadata", - outputs: [ - { - components: [ - { - internalType: "address", - name: "stakingToken", - type: "address", - }, - { - internalType: "address", - name: "rewardsToken", - type: "address", - }, - { - internalType: "uint256", - name: "totalSupply", - type: "uint256", - }, - { - internalType: "uint256", - name: "tvl", - type: "uint256", - }, - { - internalType: "uint256", - name: "aprPer10k", - type: "uint256", - }, - { - internalType: "uint256", - name: "vestingCliff", - type: "uint256", - }, - { - internalType: "uint256", - name: "periodFinish", - type: "uint256", - }, - { - internalType: "uint256", - name: "stakedBalance", - type: "uint256", - }, - { - internalType: "uint256", - name: "vestingStart", - type: "uint256", - }, - { - internalType: "uint256", - name: "earned", - type: "uint256", - }, - { - internalType: "uint256", - name: "rewards", - type: "uint256", - }, - { - internalType: "uint256", - name: "vested", - type: "uint256", - }, - ], - internalType: "struct VestingStakingRewards.StakingMetadata", - name: "", - type: "tuple", - }, - ], - stateMutability: "view", - type: "function", - }, + abi: 'function stakingMetadata(address account) view returns (tuple(address stakingToken, address rewardsToken, uint256 totalSupply, uint256 tvl, uint256 aprPer10k, uint256 vestingCliff, uint256 periodFinish, uint256 stakedBalance, uint256 vestingStart, uint256 earned, uint256 rewards, uint256 vested))', chain: "avax", params: [nullAddress], }); diff --git a/projects/moremoney/StrategyMetadata.js b/projects/moremoney/StrategyMetadata.js index 51530cfe795..db7aabaf937 100644 --- a/projects/moremoney/StrategyMetadata.js +++ b/projects/moremoney/StrategyMetadata.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const StrategyViewer = require("./StrategyViewer.json"); const addresses = require("./addresses.json"); @@ -9,11 +10,11 @@ async function useStrategyMetadata(block) { const token2Strat = { ["0xE5e9d67e93aD363a50cABCB9E931279251bBEFd0"]: curAddresses.YieldYakStrategy2, - ["0x152b9d0FdC40C096757F570A51E494bd4b943E50"]: + [ADDRESSES.avax.BTC_b]: curAddresses.YieldYakStrategy2, ["0x2b2C81e08f1Af8835a78Bb2A90AE924ACE0eA4bE"]: curAddresses.YieldYakStrategy2, - ["0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7"]: + [ADDRESSES.avax.WAVAX]: curAddresses.YieldYakAVAXStrategy2, ["0x9e295B5B976a184B14aD8cd72413aD846C299660"]: curAddresses.YieldYakPermissiveStrategy2, @@ -23,11 +24,11 @@ async function useStrategyMetadata(block) { const tokens = Object.keys(token2Strat); const strats = Object.values(token2Strat); - tokens.push("0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7"); + tokens.push(ADDRESSES.avax.WAVAX); strats.push(curAddresses.AltYieldYakAVAXStrategy2); - tokens.push("0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7"); + tokens.push(ADDRESSES.avax.WAVAX); strats.push(curAddresses.OldYieldYakAVAXStrategy2); - tokens.push("0x152b9d0FdC40C096757F570A51E494bd4b943E50"); + tokens.push(ADDRESSES.avax.BTC_b); strats.push(curAddresses.AltYieldYakStrategy2); tokens.push("0x2b2C81e08f1Af8835a78Bb2A90AE924ACE0eA4bE"); strats.push(curAddresses.AltYieldYakStrategy2); @@ -36,7 +37,7 @@ async function useStrategyMetadata(block) { const stratViewer = await sdk.api.abi.call({ target: curAddresses.StrategyViewer, - abi: StrategyViewer.abi.find(i => i.name === 'viewMetadata'), + abi: StrategyViewer.abi, chain, block, params: [curAddresses.StableLending2, tokens, strats], }); @@ -52,13 +53,13 @@ async function useLegacyIsolatedStrategyMetadata(block) { curAddresses.YieldYakStrategy, ["0x59414b3089ce2AF0010e7523Dea7E2b35d776ec7"]: curAddresses.YieldYakStrategy, - ["0x6e84a6216ea6dacc71ee8e6b0a5b7322eebc0fdd"]: + [ADDRESSES.avax.JOE]: curAddresses.YieldYakStrategy, - ["0xd586e7f844cea2f87f50152665bcbc2c279d8d70"]: + [ADDRESSES.avax.DAI]: curAddresses.YieldYakStrategy, ["0x8729438EB15e2C8B576fCc6AeCdA6A148776C0F5"]: curAddresses.YieldYakStrategy, - ["0xA7D7079b0FEaD91F3e65f86E8915Cb59c1a4C664"]: + [ADDRESSES.avax.USDC_e]: curAddresses.YieldYakStrategy, ["0xA389f9430876455C36478DeEa9769B7Ca4E3DDB1"]: curAddresses.YieldYakStrategy, @@ -72,7 +73,7 @@ async function useLegacyIsolatedStrategyMetadata(block) { curAddresses.MultiTraderJoeMasterChef3Strategy, }; // const masterChef2Tokens = [ - // '0x57319d41f71e81f3c65f2a47ca4e001ebafd4f33', + // ADDRESSES.avax.xJOE, // '0xa389f9430876455c36478deea9769b7ca4e3ddb1', // '0xed8cbd9f0ce3c6986b22002f03c6475ceb7a6256', // ].map(getAddress); @@ -83,12 +84,12 @@ async function useLegacyIsolatedStrategyMetadata(block) { //legacy legacyTokens.push("0x454E67025631C065d3cFAD6d71E6892f74487a15"); legacyStrats.push(curAddresses.YieldYakStrategy); - legacyTokens.push("0x6e84a6216eA6dACC71eE8E6b0a5B7322EEbC0fDd"); + legacyTokens.push(ADDRESSES.avax.JOE); legacyStrats.push(curAddresses.sJoeStrategy); const stratViewer = await sdk.api.abi.call({ target: curAddresses.LegacyStrategyViewer, - abi: StrategyViewer.abi.find(i => i.name === 'viewMetadata'), + abi: StrategyViewer.abi, chain, block, params: [curAddresses.StableLending, legacyTokens, legacyStrats], }); diff --git a/projects/moremoney/StrategyViewer.json b/projects/moremoney/StrategyViewer.json index 7bf82571d92..25cef63ef0b 100644 --- a/projects/moremoney/StrategyViewer.json +++ b/projects/moremoney/StrategyViewer.json @@ -1,110 +1,3 @@ { - "abi": [ - { - "inputs": [ - { - "internalType": "address", - "name": "lendingContract", - "type": "address" - }, - { - "internalType": "address[]", - "name": "tokens", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "strategies", - "type": "address[]" - } - ], - "name": "viewMetadata", - "outputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "debtCeiling", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalDebt", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "stabilityFee", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "mintingFee", - "type": "uint256" - }, - { - "internalType": "address", - "name": "strategy", - "type": "address" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "APF", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalCollateral", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "borrowablePer10k", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "valuePer1e18", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "strategyName", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "tvl", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "harvestBalance2Tally", - "type": "uint256" - }, - { - "internalType": "enum IStrategy.YieldType", - "name": "yieldType", - "type": "uint8" - }, - { - "internalType": "address", - "name": "underlyingStrategy", - "type": "address" - } - ], - "internalType": "struct StableLending.ILStrategyMetadata[]", - "name": "", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - } - ] + "abi": "function viewMetadata(address lendingContract, address[] tokens, address[] strategies) view returns (tuple(uint256 debtCeiling, uint256 totalDebt, uint256 stabilityFee, uint256 mintingFee, address strategy, address token, uint256 APF, uint256 totalCollateral, uint256 borrowablePer10k, uint256 valuePer1e18, bytes32 strategyName, uint256 tvl, uint256 harvestBalance2Tally, uint8 yieldType, address underlyingStrategy)[])" } diff --git a/projects/moret/index.js b/projects/moret/index.js new file mode 100644 index 00000000000..19ab8d9dd68 --- /dev/null +++ b/projects/moret/index.js @@ -0,0 +1,20 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require('../helper/unwrapLPs') + +const markets = ['0x73917c0b432727Ce608824D1bb5a784ed1a93695', // ETH pool + '0xb0c2E53336106DFA3c3E4DC6A2Df25af0ae2626d', // BTC pool + '0x090015A60a99Fa4551e458E1cb95bE3C381B1C54' // GHST pool + ] +const tvlTokens = [ADDRESSES.polygon.WETH_1, // WETH + ADDRESSES.polygon.WBTC, // WBTC + '0x385Eeac5cB85A38A9a07A70c73e0a3271CfB54A7', // GHST + ADDRESSES.polygon.USDC // USDC + ] + +module.exports = { + methodology: 'counts all USDC/WBTC/WETH/GHST balances of market contracts.', + start: 1677225600, // 24 Feb 2023 08:00:00 UTC + polygon: { + tvl: sumTokensExport({ owners: markets, tokens: tvlTokens, }), + } +}; \ No newline at end of file diff --git a/projects/morpheusswap/abi.json b/projects/morpheusswap/abi.json index 9d2f459baa2..62e9aa74f6b 100644 --- a/projects/morpheusswap/abi.json +++ b/projects/morpheusswap/abi.json @@ -1,59 +1,4 @@ { - "poolInfo": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "poolInfo", - "outputs": [ - { - "internalType": "contract IBEP20", - "name": "lpToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "allocPoint", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastRewardTimestamp", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accMorphPerShare", - "type": "uint256" - }, - { - "internalType": "uint16", - "name": "depositFeeBP", - "type": "uint16" - }, - { - "internalType": "uint256", - "name": "lpSupply", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "poolLength": { - "inputs": [], - "name": "poolLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -} + "poolInfo": "function poolInfo(uint256) view returns (address lpToken, uint256 allocPoint, uint256 lastRewardTimestamp, uint256 accMorphPerShare, uint16 depositFeeBP, uint256 lpSupply)", + "poolLength": "uint256:poolLength" +} \ No newline at end of file diff --git a/projects/morpheusswap/index.js b/projects/morpheusswap/index.js index 6a837af5117..a92e6351967 100644 --- a/projects/morpheusswap/index.js +++ b/projects/morpheusswap/index.js @@ -2,19 +2,18 @@ const abi = require("./abi.json"); const { getUniTVL } = require('../helper/unknownTokens') const { addFundsInMasterChef } = require("../helper/masterchef"); const { stakings } = require("../helper/staking"); -const sdk = require('@defillama/sdk') const chef = "0xc7dad2e953Dc7b11474151134737A007049f576E" const morph = "0x0789ff5ba37f72abc4d561d00648acadc897b32d" -async function tvl(timestamp, block, chainBlocks) { +async function tvl(timestamp, block, chainBlocks, api) { const balances = {} const transformAddress = addr=>`fantom:${addr}` //await transformFantomAddress(); if(chainBlocks.fantom<21182441){ // Factory deployment block await addFundsInMasterChef(balances, chef, chainBlocks.fantom, "fantom", transformAddress, abi.poolInfo, [morph]) } else { const dexTvl = getUniTVL({ factory: '0x9C454510848906FDDc846607E4baa27Ca999FBB6', chain: 'fantom', useDefaultCoreAssets: true }) - return dexTvl(timestamp, block, chainBlocks); + return dexTvl(timestamp, block, chainBlocks, api); } return balances; } @@ -27,5 +26,6 @@ module.exports = { "0x7E01c21789DEF6572E31Ab6c67A4182E0808428B", "0x2D5F05D8e578397889f5F5C88d8e3b81D8a6f865", "0x578fb737cf5F3814Ddd80Cd6a7b4FFF9504c0c39", "0xb6bA5d27b00c2E62e32c0716D7c6505463cFBbf2", "0xb31bF9a835584d18595d886D35157467576A76e8", "0xde1592f643F9c77f186970daa43D3cAB22C0fd22", "0xeF5627d8B7BC8102E0C9760F62E0c5b0b7F38AF6", "0x80da05De8B759B7A9399F43C04A859cC0eaA24AC", "0x983A4dA9E8baC8b8F2F04B161968906B780f3629", "0x63AD93bAb2842Fefec06630b9ddC7A2351D7cb91", "0x616a0030688329b4FaaFda8Cf469f1899e58cBfC", "0x94005434C078e9d8cC23fF4b5D88FC9bc7c0E1A5", "0xc948EaD0069adc742539c7D6e038CD132010513D", "0x5D29690d7e9f4216dFE3F15C0A2db828D25e9aD5", "0x3BEef19946b0595621650793d45C1cb06e9F810a", "0x913473eaF564e3982E9fFb6D5c559E2adb669D61", "0xA75C807d43F75806DFbDd1f302C7F388E610Be87", "0x40F4F6473F39882645237f39900fc15C2E8dd56c", "0xC60044503dA0C800DEE0577f294862Fc1c1Aca1B", "0x04f429bBFa7032a046F24466F835284351Cef5E4", "0xbC4f8A55fc3Aba02dA4E18aA66E9176EA476468D", "0xF6d428f7ee882C0bdd43AA060c69f35874609B9f", "0x23308c96cF9f46Fa6D7Ee714B960780551d35E16", "0x11d7A542ad2E12Bd0C033C85aeF6FB891CD92690", "0xc8C017674fb54F5F25f05AC0981116715465254A", "0xCCA9F9E68F7E7e1BE97DA2Ff91B016c234a13c88", "0xA431fDd6d23f0d7C4b4B92F4aD866a5939b53abB", "0x326A7D91B6F767458599E7d93DFc850d2e083d30", "0x5bCb5f2ed10aC292C9E281C5eAD4F0533666c3b6"], "0xB66b5D38E183De42F21e92aBcAF3c712dd5d6286", "fantom") - } + }, + hallmarks: [[1642942800, "Wonderland deposit for Solidly wars"]] } diff --git a/projects/morphex/index.js b/projects/morphex/index.js new file mode 100644 index 00000000000..bc99181130b --- /dev/null +++ b/projects/morphex/index.js @@ -0,0 +1,24 @@ +const { staking } = require("../helper/staking"); +const { gmxExports } = require("../helper/gmx"); + +// Fantom +const vaultAddressFantom = "0x3CB54f0eB62C371065D739A34a775CC16f46563e"; +const stakingAddressFantom = "0xa4157E273D88ff16B3d8Df68894e1fd809DbC007"; +const tokenAddressMPXFantom = "0x66eEd5FF1701E6ed8470DC391F05e27B1d0657eb"; + +// BNB Chain +const vaultAddressBSC = "0x46940Dc651bFe3F2CC3E04cf9dC5579B50Cf0765"; +const stakingAddressBSC = "0x13d2bBAE955c54Ab99F71Ff70833dE64482519B1"; +const tokenAddressMPXBSC = "0x94C6B279b5df54b335aE51866d6E2A56BF5Ef9b7"; + +module.exports = { + methodology: "Morphex liquidity is calculated by the value of tokens in the MLP pool. TVL also includes MPX staked.", + fantom: { + staking: staking(stakingAddressFantom, tokenAddressMPXFantom, "fantom"), + tvl: gmxExports({ vault: vaultAddressFantom }) + }, + bsc: { + staking: staking(stakingAddressBSC, tokenAddressMPXBSC, "bsc"), + tvl: gmxExports({ vault: vaultAddressBSC }) + }, +}; diff --git a/projects/morpho-aave/index.js b/projects/morpho-aave/index.js index 58d61f12e43..20a4f6e9eae 100644 --- a/projects/morpho-aave/index.js +++ b/projects/morpho-aave/index.js @@ -59,10 +59,11 @@ const ethereum = (borrowed) => { module.exports = { timetravel: true, + doublecounted: true, methodology: `Collateral (supply minus borrows) in the balance of the Morpho contracts`, ethereum: { tvl: ethereum(false), borrowed: ethereum(true) } }; -// node test.js projects/morpho-aave/index.js \ No newline at end of file +// node test.js projects/morpho-aave/index.js diff --git a/projects/morpho-aaveV3/addresses.js b/projects/morpho-aaveV3/addresses.js new file mode 100644 index 00000000000..7fc42bd52aa --- /dev/null +++ b/projects/morpho-aaveV3/addresses.js @@ -0,0 +1,3 @@ +module.exports = { + morphoAaveV3: "0x33333aea097c193e66081e930c33020272b33333" +} \ No newline at end of file diff --git a/projects/morpho-aaveV3/index.js b/projects/morpho-aaveV3/index.js new file mode 100644 index 00000000000..5e4efce49d7 --- /dev/null +++ b/projects/morpho-aaveV3/index.js @@ -0,0 +1,60 @@ +const abi = require("../helper/abis/morpho.json"); +const erc20 = require("../helper/abis/erc20.json"); +const {morphoAaveV3} = require("./addresses"); +const BigNumber = require("bignumber.js"); +const fetchMarketsData = require("./markets"); + +const getMetrics = async (api, borrowed) => { + const markets = await api.call({ target: morphoAaveV3, abi: abi.morphoAaveV3.marketsCreated, }); + const marketsData = await fetchMarketsData(markets, api); + const balancesTotalBorrowOnPool = await api.multiCall({ + calls: marketsData.map(({debtToken}) => ({ + target: debtToken, + params: [morphoAaveV3] + })), + abi: erc20.balanceOf + }); + const totalBorrows = marketsData.map(({scaledP2PBorrow, p2pBorrowIndex}, i) => { + const totalBorrowOnPool = balancesTotalBorrowOnPool[i]; + const totalBorrowP2P = BigNumber(scaledP2PBorrow).times(p2pBorrowIndex).div(10**27).toFixed(0); + return BigNumber(totalBorrowOnPool).plus(totalBorrowP2P).toFixed(0); + }); + if (borrowed) { + marketsData.forEach(({underlying}, idx) => { + api.add(underlying, totalBorrows[idx]) + }); + return; + } + + const balancesTotalSupplyOnPool = await api.multiCall({ + calls: marketsData.map(({aToken}) => ({ + target: aToken, + params: [morphoAaveV3] + })), + abi: erc20.balanceOf + }); + marketsData.forEach(({underlying, scaledP2PSupply, p2pSupplyIndex}, idx) => { + const totalBorrow = totalBorrows[idx]; + const totalSupplyOnPool = balancesTotalSupplyOnPool[idx]; + const totalSupplyP2P = BigNumber(scaledP2PSupply).times(p2pSupplyIndex).div(10**27).toFixed(0); + const totalSupply = BigNumber(totalSupplyOnPool).plus(totalSupplyP2P); + const tvl = totalSupply.minus(totalBorrow).toFixed(0); // Through morpho, for a given market, this value can be negative. + api.add(underlying, tvl) + }); +}; + +const ethereum = (borrowed) => { + return async (timestamp, block, _, { api }) => { + return getMetrics(api, borrowed); + }; +}; + +module.exports = { + methodology: `Collateral (supply minus borrows) in the balance of the Morpho contracts`, + doublecounted: true, + ethereum: { + tvl: ethereum(false), + borrowed: ethereum(true) + } +}; +// node test.js projects/morpho-aave/index.js diff --git a/projects/morpho-aaveV3/markets.js b/projects/morpho-aaveV3/markets.js new file mode 100644 index 00000000000..d617f20dcd3 --- /dev/null +++ b/projects/morpho-aaveV3/markets.js @@ -0,0 +1,17 @@ +const abi = require("../helper/abis/morpho.json"); +const { morphoAaveV3 } = require("./addresses") +module.exports = async (underlyings, api) => (await api.multiCall({ + calls: underlyings, + target: morphoAaveV3, + abi: abi.morphoAaveV3.market +})).map((output, i) => { + return { + aToken: output.aToken, + underlying: underlyings[i], + debtToken: output.variableDebtToken, + scaledP2PSupply: output.deltas.supply.scaledP2PTotal, + scaledP2PBorrow: output.deltas.borrow.scaledP2PTotal, + p2pSupplyIndex: output.indexes.supply.p2pIndex, + p2pBorrowIndex: output.indexes.borrow.p2pIndex, + } +}) \ No newline at end of file diff --git a/projects/morpho/addresses.js b/projects/morpho/addresses.js index 800ce689fbe..124146bdad5 100644 --- a/projects/morpho/addresses.js +++ b/projects/morpho/addresses.js @@ -1,5 +1,6 @@ +const ADDRESSES = require('../helper/coreAssets.json') module.exports = { morphoCompoundMainnetLens: "0x930f1b46e1d081ec1524efd95752be3ece51ef67", cEth: "0x4ddc2d193948926d02f9b1fe9e1daa0718270ed5", - wEth: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2" + wEth: ADDRESSES.ethereum.WETH } \ No newline at end of file diff --git a/projects/morpho/index.js b/projects/morpho/index.js index f7677f76e55..04edca0d140 100644 --- a/projects/morpho/index.js +++ b/projects/morpho/index.js @@ -62,10 +62,11 @@ const ethereum = (borrowed) => { module.exports = { timetravel: true, + doublecounted: true, methodology: `Collateral (supply minus borrows) in the balance of the Morpho contracts`, ethereum: { tvl: ethereum(false), borrowed: ethereum(true), } }; -// node test.js projects/morpho-compound/index.js \ No newline at end of file +// node test.js projects/morpho-compound/index.js diff --git a/projects/mosquitos-finance/helper.js b/projects/mosquitos-finance/helper.js new file mode 100644 index 00000000000..b100cbaa174 --- /dev/null +++ b/projects/mosquitos-finance/helper.js @@ -0,0 +1,16 @@ +const moduleAddress = '0x190d44266241744264b964a37b8f09863167a12d3e70cda39376cfb4e3561e12' +const resourceAddress = '0x5a97986a9d031c4567e15b797be516910cfcb4156312482efc6a19c0a30c948' +const masterchefModuleAddress = '0x4db735a9d57f0ed393e44638540efc8e2ef2dccca3bd30c29bd09353b6285832' +const masterchefResourceAddress = '0xe1996571b77b4fc6feeae1f426f124e68ff31bb30508562106479456f6ecaabd' + +function getTypeArgs(struct) { + return struct.split('<')[1].split('>').split(',') +} + +module.exports = { + moduleAddress, + resourceAddress, + masterchefModuleAddress, + masterchefResourceAddress, + getTypeArgs +} \ No newline at end of file diff --git a/projects/mosquitos-finance/index.js b/projects/mosquitos-finance/index.js new file mode 100644 index 00000000000..a5c8a930b56 --- /dev/null +++ b/projects/mosquitos-finance/index.js @@ -0,0 +1,148 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const sdk = require("@defillama/sdk") +const { default: BigNumber } = require("bignumber.js"); +const { getResource, getResources, coreTokens } = require("../helper/chain/aptos"); +const { transformBalances } = require("../helper/portedTokens"); +const { resourceAddress, masterchefResourceAddress } = require('./helper') + +const poolStr = 'liquidity_pool::LiquidityPool' +const farmStr = 'MasterChefV1::PoolInfo' +const coinInfoStr = '0x1::coin::CoinInfo' +const poolCoinInfoStr = `${coinInfoStr}<0x5a97986a9d031c4567e15b797be516910cfcb4156312482efc6a19c0a30c948::lp_coin::LP` + +const suckrStakingPoolKey = "0x4db735a9d57f0ed393e44638540efc8e2ef2dccca3bd30c29bd09353b6285832::MasterChefV1::PoolInfo<0x4db735a9d57f0ed393e44638540efc8e2ef2dccca3bd30c29bd09353b6285832::MosquitoCoin::SUCKR>" +const suckrAndAptPairKey = '0x190d44266241744264b964a37b8f09863167a12d3e70cda39376cfb4e3561e12::liquidity_pool::LiquidityPool<0x4db735a9d57f0ed393e44638540efc8e2ef2dccca3bd30c29bd09353b6285832::MosquitoCoin::SUCKR, 0x1::aptos_coin::AptosCoin, 0x190d44266241744264b964a37b8f09863167a12d3e70cda39376cfb4e3561e12::curves::Uncorrelated>' +const suckrAddr = "0x4db735a9d57f0ed393e44638540efc8e2ef2dccca3bd30c29bd09353b6285832::MosquitoCoin::SUCKR" + +async function getLiquidSwapPools() { + const pools = {} + const resources = await getResources(resourceAddress) + resources.forEach((resource) => { + if (resource.type.includes(poolStr)) { + const index = resource.type.indexOf(poolStr) + poolStr.length + 1 + const key = resource.type.substring(index, resource.type.length - 1) + const [coinX, coinY,] = key.split(', ') + if (pools[key]) { + pools[key].reserveX = resource.data.coin_x_reserve.value + pools[key].reserveY = resource.data.coin_y_reserve.value + } else { + pools[key] = { + coinX, + coinY, + reserveX: resource.data.coin_x_reserve.value, + reserveY: resource.data.coin_y_reserve.value + } + } + } else if (resource.type.includes(poolCoinInfoStr)) { + const key = resource.type.substring(poolCoinInfoStr.length + 1, resource.type.length - 2) + const [coinX, coinY,] = key.split(', ') + if (pools[key]) { + pools[key].lpSupply = resource.data.supply.vec[0].integer.vec[0].value + } else { + pools[key] = { + coinX, + coinY, + reserveX: '0', + reserveY: '0', + lpSupply: resource.data.supply.vec[0].integer.vec[0].value + } + } + } + }) + + return pools +} + +async function getMasterChefPools(pools) { + const farms = [] + const resources = await getResources(masterchefResourceAddress) + resources.forEach((resource) => { + if (resource.type.includes(farmStr)) { + const index = resource.type.indexOf(farmStr) + farmStr.length + 1 + const lpKey = resource.type.substring(index, resource.type.length - 1) + if (lpKey.split('<').length >= 2) { + const key = lpKey.split('<')[1].substring(0, lpKey.split('<')[1].length - 1) + if (pools[key]) { + const pool = pools[key] + farms.push({ + coinX: pool.coinX, + coinY: pool.coinY, + reserveX: new BigNumber(pool.reserveX), + reserveY: new BigNumber(pool.reserveY), + lpSupply: new BigNumber(pool.lpSupply), + lpAmount: new BigNumber(resource.data.total_share) + }) + } + } + } + }) + + return farms +} + +function calculateFarmTokens(pools, farms) { + const balances = {} + farms.forEach((farm) => { + const { coinX, coinY, reserveX, reserveY, lpAmount, lpSupply } = farm + const share = new BigNumber(lpAmount).div(lpSupply) + const balanceX = share.multipliedBy(reserveX).toFixed(0) + const balanceY = share.multipliedBy(reserveY).toFixed(0) + + if (coreTokens.includes(coinX) && coreTokens.includes(coinY)) { + sdk.util.sumSingleBalance(balances, coinX, balanceX) + sdk.util.sumSingleBalance(balances, coinY, balanceY) + } if (coreTokens.includes(coinX)) { + sdk.util.sumSingleBalance(balances, coinX, balanceX * 2) + } else if (coreTokens.includes(coinY)) { + sdk.util.sumSingleBalance(balances, coinY, balanceY * 2) + } + }) + + return balances +} + +async function tvl() { + /* + const pools = await getLiquidSwapPools() + const farms = await getMasterChefPools(pools) + const balances = calculateFarmTokens(pools, farms) + const tvl = await transformBalances('aptos', balances) + */ + + return {} +} + +async function staking() { + const suckrAndAptPair = await getResource(resourceAddress, suckrAndAptPairKey) + const suckrStakingPool = await getResource(masterchefResourceAddress, suckrStakingPoolKey) + + const balances = {} + if (suckrAndAptPair && suckrStakingPool) { + const index = suckrAndAptPairKey.indexOf(poolStr) + poolStr.length + 1 + const key = suckrAndAptPairKey.substring(index, suckrAndAptPairKey.length - 1) + const [coinX, coinY,] = key.split(', ') + const reserveX = new BigNumber(suckrAndAptPair.coin_x_reserve.value) + const reserveY = new BigNumber(suckrAndAptPair.coin_y_reserve.value) + const stakedSUCKR = new BigNumber(suckrStakingPool.total_share) + + if (suckrAddr == coinX) { + sdk.util.sumSingleBalance(balances, coinY, stakedSUCKR.div(reserveX).multipliedBy(reserveY).toFixed(0)) + } else { + sdk.util.sumSingleBalance(balances, coinX, stakedSUCKR.div(reserveY).multipliedBy(reserveX).toFixed(0)) + } + } + const tvl = await transformBalances('aptos', balances) + + return tvl +} + +module.exports = { + hallmarks: [ + [1678320000, "Rug Pull"] + ], + timetravel: false, + aptos: { + tvl, + staking + } +} diff --git a/projects/move-dollar/index.js b/projects/move-dollar/index.js new file mode 100644 index 00000000000..43d9d511f2c --- /dev/null +++ b/projects/move-dollar/index.js @@ -0,0 +1,43 @@ +const sdk = require("@defillama/sdk"); +const { getResources, } = require("../helper/chain/aptos"); +const { transformBalances } = require("../helper/portedTokens"); + +const moveDollarAddress = "0x6f986d146e4a90b828d8c12c14b6f4e003fdff11a8eecceceb63744363eaac01"; + +let resourcesCache; + +async function _getResources() { + if (!resourcesCache) resourcesCache = getResources(moveDollarAddress) + return resourcesCache +} +const extractVaultType = resource => resource.type.split('<')[1].replace('>', '').split(', '); +const vaultsFilter = resource => resource.type.includes(`${moveDollarAddress}::vault::Vaults<`) +const psmsFilter = resource => resource.type.includes(`${moveDollarAddress}::psm::PSM<`) + +module.exports = { + timetravel: false, + methodology: + "Aggregates all collateral backing Move Dollar in Thala's CDP Vaults.", + aptos: { + tvl: async () => { + const balances = {}; + const resources = await _getResources() + const vaults = resources.filter(vaultsFilter).map(vault => ({ + total_collateral: vault.data.total_collateral, + asset_type: extractVaultType(vault), + })); + const psms = resources.filter(psmsFilter).map(psm => ({ + total_collateral: psm.data.coin.value, + asset_type: extractVaultType(psm), + })); + vaults.forEach(({ asset_type, total_collateral }) => { + sdk.util.sumSingleBalance(balances, asset_type, total_collateral); + }); + psms.forEach(({ asset_type, total_collateral }) => { + sdk.util.sumSingleBalance(balances, asset_type, total_collateral); + }); + + return transformBalances("aptos", balances); + }, + }, +}; \ No newline at end of file diff --git a/projects/mover/abi.json b/projects/mover/abi.json index 9fcb92eccaa..2ac8dafd376 100644 --- a/projects/mover/abi.json +++ b/projects/mover/abi.json @@ -1,28 +1,4 @@ { - "inceptionLPPriceUSDC": { - "inputs": [], - "name": "inceptionLPPriceUSDC", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "lpTokensBalance": { - "inputs": [], - "name": "lpTokensBalance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } + "inceptionLPPriceUSDC": "uint256:inceptionLPPriceUSDC", + "lpTokensBalance": "uint256:lpTokensBalance" } \ No newline at end of file diff --git a/projects/mover/baseLedgerPoolAbi.json b/projects/mover/baseLedgerPoolAbi.json index cf9410a623f..b4c9952f594 100644 --- a/projects/mover/baseLedgerPoolAbi.json +++ b/projects/mover/baseLedgerPoolAbi.json @@ -1,15 +1,3 @@ { - "totalAssetAmount": { - "inputs": [], - "name": "totalAssetAmount", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } + "totalAssetAmount": "uint256:totalAssetAmount" } \ No newline at end of file diff --git a/projects/mover/index.js b/projects/mover/index.js index f3731461615..9da9737c5fb 100644 --- a/projects/mover/index.js +++ b/projects/mover/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const baseLedgerAbi = require("./baseLedgerPoolAbi.json"); const savingsPoolAbi = require("./savingsPoolAbi.json"); @@ -14,8 +15,8 @@ const MOVER_WETH_SLP = "0x87b918e76c92818DB0c76a4E174447aeE6E6D23f"; const savingsPool = "0xAF985437DCA19DEFf89e61F83Cd526b272523719"; const savingsPlusPolygonPool = "0x77D5333d97A092cA01A783468E53E550C379dc3C"; -const USDC = "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"; -const USDCinPolygon = "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174"; +const USDC = ADDRESSES.ethereum.USDC; +const USDCinPolygon = ADDRESSES.polygon.USDC; const baseLedgerPool = '0x1f15F293C1Cd3d05d58d3EdeAf0C72c5A2dfeaFf'; const UBT = '0x8400D94A5cb0fa0D041a3788e395285d61c9ee5e'; diff --git a/projects/mover/savingsPlusPoolAbi.json b/projects/mover/savingsPlusPoolAbi.json index cf9410a623f..b4c9952f594 100644 --- a/projects/mover/savingsPlusPoolAbi.json +++ b/projects/mover/savingsPlusPoolAbi.json @@ -1,15 +1,3 @@ { - "totalAssetAmount": { - "inputs": [], - "name": "totalAssetAmount", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } + "totalAssetAmount": "uint256:totalAssetAmount" } \ No newline at end of file diff --git a/projects/mover/savingsPoolAbi.json b/projects/mover/savingsPoolAbi.json index 0b78ffe8028..b4c9952f594 100644 --- a/projects/mover/savingsPoolAbi.json +++ b/projects/mover/savingsPoolAbi.json @@ -1,15 +1,3 @@ { - "totalAssetAmount": { - "inputs": [], - "name": "totalAssetAmount", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -} + "totalAssetAmount": "uint256:totalAssetAmount" +} \ No newline at end of file diff --git a/projects/mstable-yield/index.js b/projects/mstable-yield/index.js new file mode 100644 index 00000000000..417262285cf --- /dev/null +++ b/projects/mstable-yield/index.js @@ -0,0 +1,27 @@ +const sdk = require('@defillama/sdk') + +const vaults = [ + '0x9614a4C61E45575b56c7e0251f63DCDe797d93C5', // 3CRV +] + +module.exports = { + ethereum: { + tvl: async (_, block) => { + const totalAssets = await sdk.api2.abi.multiCall({ + abi: abis.totalAssets, calls: vaults,block, + }) + const asset = await sdk.api2.abi.multiCall({ + abi: abis.asset, calls: vaults,block, + }) + + const balances = {} + vaults.map((_,i) => sdk.util.sumSingleBalance(balances,asset[i],totalAssets[i], 'ethereum')) + return balances + } + } +} + +const abis = { + totalAssets: "uint256:totalAssets", + asset: "address:asset", +} \ No newline at end of file diff --git a/projects/mstable/abi-massetv1.json b/projects/mstable/abi-massetv1.json index 441ad8d7d8e..f67112d1394 100644 --- a/projects/mstable/abi-massetv1.json +++ b/projects/mstable/abi-massetv1.json @@ -1,52 +1,3 @@ { - "getBassets": { - "constant": true, - "inputs": [], - "name": "getBassets", - "outputs": [{ - "components": [{ - "internalType": "address", - "name": "addr", - "type": "address" - }, - { - "internalType": "enum MassetStructs.BassetStatus", - "name": "status", - "type": "uint8" - }, - { - "internalType": "bool", - "name": "isTransferFeeCharged", - "type": "bool" - }, - { - "internalType": "uint256", - "name": "ratio", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxWeight", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "vaultBalance", - "type": "uint256" - } - ], - "internalType": "struct MassetStructs.Basset[]", - "name": "bAssets", - "type": "tuple[]" - }, - { - "internalType": "uint256", - "name": "len", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } -} + "getBassets": "function getBassets() view returns (tuple(address addr, uint8 status, bool isTransferFeeCharged, uint256 ratio, uint256 maxWeight, uint256 vaultBalance)[] bAssets, uint256 len)" +} \ No newline at end of file diff --git a/projects/mstable/abi-massetv2.json b/projects/mstable/abi-massetv2.json index d9178476808..56bc9b0d15e 100644 --- a/projects/mstable/abi-massetv2.json +++ b/projects/mstable/abi-massetv2.json @@ -1,55 +1,3 @@ { - "getBassets": { - - "inputs": [], - "name": "getBassets", - "outputs": [ - { - "components": [ - { - "internalType": "address", - "name": "addr", - "type": "address" - }, - { - "internalType": "address", - "name": "integrator", - "type": "address" - }, - { - "internalType": "bool", - "name": "hasTxFee", - "type": "bool" - }, - { - "internalType": "enum MassetStructs.BassetStatus", - "name": "status", - "type": "uint8" - } - ], - "internalType": "struct MassetStructs.BassetPersonal[]", - "name": "personal", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "uint128", - "name": "ratio", - "type": "uint128" - }, - { - "internalType": "uint128", - "name": "vaultBalance", - "type": "uint128" - } - ], - "internalType": "struct MassetStructs.BassetData[]", - "name": "data", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - } + "getBassets": "function getBassets() view returns (tuple(address addr, address integrator, bool hasTxFee, uint8 status)[] personal, tuple(uint128 ratio, uint128 vaultBalance)[] data)" } \ No newline at end of file diff --git a/projects/mt-gox/index.js b/projects/mt-gox/index.js new file mode 100644 index 00000000000..90343648020 --- /dev/null +++ b/projects/mt-gox/index.js @@ -0,0 +1,89 @@ +const { cexExports } = require('../helper/cex') + +const config = { + bitcoin: { + owners: [ + "17Tf4bVQaCzwWrDWGRPC97RLCHnU4LY8Qr", + "1BzK87zuqidZn489Wb2oLSktrjKrX7TLKe", + "1Drshi4RAuvxk4T6Bkq959ZvLbvy7b1wvD", + "1EiiKCCnFgHjEvPZdu29qqgdBm8zTvpU3U", + "14p4w3TRCd6NMRSnzTmgdvQhNnbrAmzXmy", + "12KkeeRkiNS13GMbg7zos9KRn9ggvZtZgx", + "12T4oSNd4t9ty9fodgNd47TWhK35pAxDYN", + "15kNZcrhxeFZgVVLK2Yjzd69tRidbFdJEZ", + "1LS5EFRRMDgMQusW6zokQUHjzNUfy6HHCQ", + "1FrV9hv1AW34BGJvobJatyzUWYDWB9epRW", + "1HdKXsNQtzDcfB6PGM7DWTgX9vhBWsz1ak", + "1Fu4YgM3Y9CxvioGPqkSzkydAC8MVaPN1D", + "1G23Uzwj55k2A9TRwaTknqGav66oDTkWCu", + "1GkZQcDy8V6pmHFZqUBUBCnN9dc2hoWasD", + "1Hm6XDmhKCHz68wDEYTapN9MEanke8iwUk", + "15SeCwVCFx5cWyrcdD1Zp1D1zxjH2SELPg", + "15U4VsmWG1cdXAtizvQsW4r7iMxzp64Tgu", + "16jZZkMYqjUWUtQ9DfDvHdH5ko5BcnH9XQ", + "16w6sZBDP58yyeyZAcvnxcEGJpwR9amM6g", + "19Cr4zXpKw43xLJhFZW9iv4DDNtQk2TDeB", + "1GyDutntMuYyA2vQGW5HFcKLfx4cbDdbJq", + "17etv2L3nhk6SCcWSNW4eoZkBy84izAm17", + "18ok25NTkdrUzdByFJCNVsqVYkujZ8aP45", + "199Yxz2TJGtND3QKsHTptTJivqSaUZBvku", + "1AZu7TQmKBAes2duNDctYwjAB9nhHczUnA", + "17KcBp8g76Ue8pywgjta4q8Ds6wK4bEKp7", + "1LLc8aA9C9LLULGbYCYSFKXgxKP2DXdCqP", + "1CZsoJfkknbnW5fKrt1oR7N1ALE5WmDGP1", + "1DedUxzgwErg4ipNi988wPgLk5thwciKcc", + "1H4K3dGfNbAN4AUfyUrpkGpjrd83sntDpV", + "13sXfpp2V16nnxYvW9FHHoBdMa3k98uJw8", + "13Wv5hGhubAWgSPWtXYh6s1s7HX2N1psYg", + "14mP6caC5dFhHdVAPCjPKM8Nm36MBDR5pM", + "155FsTtEFq4eGCcBxDseuwLKPbmtWbyHJR", + "156HpsWfgkWYLT63uhTAGUSUF3ZMnB9WWj", + "15QcKCa84ZCHxbsqXDoKhi5XbmQB8jPEAd", + "1EK8vW7UYaYHKiW4TZmYJKtwcZLM14VjvP", + "1Hb8DmmvvtTYv5RBLuGtDxznkZwVpd5Vjy", + "1HuPVqz2xvf1rdNFUqd62vRTyxP3jeX9Ch", + "13xGCc4TPSYY9GYxBGVNox82KxyjkFnxMX", + "13ahgw8sM95EDbugT3tdb8TYoMU46Uw7PX", + "1439q4Na8v88kPBqoyg8F4ueL9SYr8ANWj", + "13dXFMyG22EsUsvaWhCqUo7SXuX7rBPog6", + "14USZ558Rr28AZwdJQyciSQkN4JT1cEoj2", + "1FhRuUkk8Bfx8FJDemtxhKAR4F8GCNKrXG", + "1Mm9brripN4RPTzkGnRrbt5uDWdqbfk2iX", + "1LueUjEuBgc7cQhsWT8zAfTjcWmrNBZXaR", + "1LXi3x7hyt17cxncscGE887WCrC6XDNZ4P", + "19KiFrafXEyJCUDYFEv3B6tBUwyfFo7kNU", + "18YDgRhxsomuBZ1g9d8Y1JuRmxDhF8Bvff", + "18hcZVFPqDNAovJmb9vA6hEJrDz6uWXNGh", + "1BDZBTb4KE5oq6wAgA6EvAe3uCFRrAbPao", + "195HvmjXgoF3M5vFaBC8swZPhwrE7VhxRD", + "18KDS3q6a4YV9Nn8jcyMvNoVPfcrfemeag", + "19c8sUa54yQuRTVDfJa3iDkkCaFkzBJLPB", + "1B6kJM75iu5ty1HAHMMz6tT1HhjoGNTCa9", + "18M1Z337NqLtK9V69bssnQUYsvb7hmfSFS", + "19eihBKk6e5YD2QXAe4SVUsxRLLnTDKsfv", + "1C5aU4Xnpd3txbxehk46UZgiuNB8QdpHCH", + "1BXyJc6BVuTFnHQCcjiWX2xmCPNVfaSZeb", + "1Ar6meJQCkNoC9wnPcyRNNpzX5fBDaGcKd", + "1CRjKZJu8LvTutnSKq4zTJ4yiqrzMAArYW", + "1HweN9p41BY2RBunsPqyVuheEq7gVoxA9u", + "1HX4s3JeFU3x1eQgPNQVAdx6FoCtbb1hr8", + "1HzEPuenagLEWj68igDXBBXrzc293RuR5V", + "1JtgU6Uo1RAt5eiMf34EehyatUezBQP36C", + "1JVmoJT3471FjsX5H4hAeR1RyrDgpkHbpm", + "1JVU43LNKXqa9W5fCh8tppxDDEWgfeNg46", + "1JztCg7eKSkb1vi7NzGJynXpLZmoaFtYud", + "1KFDUSZuapMv7YaDmL6cyrHTQhma1MtFYs", + "1MkyfwJf7uhWTmVGGQXfcT5ip31DoHMxsz", + "1LzwbLgdKd4eFLkpRdeajkH1YJkVCip2zj", + "1MPJJzRaT8vLhowNB4dVyWRxxu79dq7WkB", + "1MvpYtqgBH7CXbTutrSVCTNHPzm9vakuRy", + "1N5X4kcZ56uRh24XrZoztS9Vb8G7j1Joop", + "1Pq7hooZbEAz5y3QMnqFY8C5xqTdrjUwcA", + "1PRXQEoL8vzEzoJJ9hbtAP6NaV2daccAUn", + "1PxGTuJzDx1ceFHx4Z5CHaWuhiPBNovmZD", + "1NA3Tj4b1jtx9eGELe31Jw4DrzTqKP3ayH" //https://www.cryptoground.com/mtgox-cold-wallet-monitor/ + ], + }, +} + +module.exports = cexExports(config) \ No newline at end of file diff --git a/projects/mtgo/index.js b/projects/mtgo/index.js index 3877987625c..c15d66462ad 100644 --- a/projects/mtgo/index.js +++ b/projects/mtgo/index.js @@ -1,46 +1,14 @@ -const { - sumLPWithOnlyOneTokenOtherThanKnown, -} = require("./../helper/unwrapLPs"); +const { sumTokensExport } = require('../helper/unknownTokens') const lpToken = "0x2a382b6d2dac1cba6e4820fd04e3c2c14e1aa7b2"; const treasuryAddress = "0xdE2957506B6dC883963fbE9cE45a94a8A22c6006"; const mtgoToken = "0x1bc8547e3716680117d7ba26dcf07f2ed9162cd0"; const poolAddress = "0x1781d2e9b4c7c0a3657411a64d2c1dfc50118772"; -const wiotx = "0xA00744882684C3e4747faEFD68D283eA44099D03"; -const erc20Tokens = [ - ["0x1bc8547e3716680117d7ba26dcf07f2ed9162cd0", false], // MTGO -]; - -async function iotexPool2(timestamp, _, {iotex: block}) { - const balances = {}; - await sumLPWithOnlyOneTokenOtherThanKnown( - balances, - lpToken, - poolAddress, - mtgoToken, - block, - "iotex" - ); - return { iotex: (balances[wiotx] / 10 ** 18) }; -} - -async function treasury(timestamp, _, {iotex: block}) { - const balances = {}; - await sumLPWithOnlyOneTokenOtherThanKnown( - balances, - lpToken, - treasuryAddress, - mtgoToken, - block, - "iotex" - ); - return { iotex: (balances[wiotx] / 10 ** 18) }; -} module.exports = { iotex: { tvl: async () => ({}), - pool2: iotexPool2, - treasury, + pool2: sumTokensExport({ tokensAndOwners: [[lpToken, poolAddress]], lps:[lpToken]}), + // treasury: sumTokensExport({ tokensAndOwners: [[lpToken, treasuryAddress]], lps:[lpToken]}), }, }; diff --git a/projects/muesliswap/index.js b/projects/muesliswap/index.js index 7d368124d08..de09fe0b67d 100644 --- a/projects/muesliswap/index.js +++ b/projects/muesliswap/index.js @@ -3,22 +3,25 @@ const { stakingPricedLP } = require('../helper/staking') const { fetchURL } = require('../helper/utils') -async function staking(){ +async function staking() { let totalAda = 0 // Milk locked - const tvlMilk = (await fetchURL("https://staking.muesliswap.com/milk-locked")).data - if(tvlMilk.data<=0){ + const tvlMilk = ( + (await fetchURL("https://staking.muesliswap.com/milk-locked")).data + + (await fetchURL("https://staking.muesliswap.com/milk-vault-locked")).data + ) + if (tvlMilk.data <= 0) { throw new Error("muesliswap tvl is below 0") } const infoMilk = (await fetchURL(`https://api.muesliswap.com/price/?base-policy-id=&base-tokenname="e-tokenname=4d494c4b"e-policy-id=8a1cfae21368b8bebbbed9800fec304e95cce39a2a57dc35e2e3ebaa`)).data - const priceMilk = parseFloat(infoMilk.price) / 1e6 - totalAda += priceMilk * tvlMilk + const priceMilk = parseFloat(infoMilk.price) + totalAda += priceMilk * tvlMilk / 1e6 // Myield locked const tvlMyield = parseFloat((await fetchURL("http://staking.muesliswap.com/myield-info")).data[0]["amountStaked"]) / 1e6 const infoMyield = (await fetchURL(`https://api.muesliswap.com/price/?base-policy-id=&base-tokenname="e-tokenname=4d5949454c44"e-policy-id=8f9c32977d2bacb87836b64f7811e99734c6368373958da20172afba`)).data const priceMyield = parseFloat(infoMyield.price) - totalAda += priceMyield * tvlMyield + totalAda += priceMyield * tvlMyield / 1e6 return { cardano: totalAda @@ -26,72 +29,83 @@ async function staking(){ } -async function adaTvl(){ - const tokens = (await fetchURL("https://orders.muesliswap.com/known-tokens")).data +async function adaTvl() { let totalAda = 0 - await Promise.all(tokens.map(async t=>{ - const policyId = t.address.split(".")[0]; - const tokenname = t.address.split(".")[1]; - const orders = (await fetchURL(`https://orders.muesliswap.com/orderbook/?policy-id=${policyId}&tokenname=${encodeURIComponent(tokenname)}`)).data - if(orders.fromToken !== "."){ - throw new Error("Tokens paired against something other than ADA") - } - let totalBuy= 0; - orders.buy.forEach(o=>{ - totalBuy += o.totalPrice - }) - if(orders.buy.length === 0 || orders.sell.length === 0){ - return - } - const topPrice = orders.buy[0].price - let totalAmountOtherToken = 0 - orders.sell.forEach(o=>{ - totalAmountOtherToken += o.amount - }) - const totalSell = totalAmountOtherToken * topPrice - totalAda += totalBuy + totalSell - })) + // fetch the prices of each traded token first - const tokenlistv2 = (await fetchURL("https://api.muesliswap.com/list?base-policy-id=&base-tokenname=")).data - const adapricev2 = new Map(tokenlistv2.map(d => { - return [d.price.toToken, parseFloat(d.price.bidPrice)] + const tokenlistV2 = (await fetchURL("https://api.muesliswap.com/list?base-policy-id=&base-tokenname=")).data + const adaPrices = new Map(tokenlistV2.map(d => { + const ident = d.info.address.policyId + '.' + d.info.address.name + const bidPrice = parseFloat(d.price.bidPrice) + const price = parseFloat(d.price.price) + return [ident, { bidPrice, price }] })) - // then accumulate over the orderbooks - const orderbooksv2 = (await fetchURL("https://onchain.muesliswap.com/all-orderbooks")).data - await Promise.all(orderbooksv2.map(async ob=>{ - if(ob.fromToken !== "."){ - const price = adapricev2.get(ob.fromToken) - let totalAmountOtherToken = 0 - ob.orders.forEach(o=>{ - totalAmountOtherToken += parseInt(o.fromAmount) - }) - const totalSell = totalAmountOtherToken * price - if(isNaN(totalSell) || !isFinite(totalSell)) return; - totalAda += totalSell / 1e6 - } - else if(ob.fromToken === "."){ - let totalLovelace = 0; - ob.orders.forEach(o=>{ - totalLovelace += parseInt(o.fromAmount) - }) - const totalBuy = totalLovelace - totalAda += totalBuy / 1e6 + + // then first accumulate over the legacy orderbook + const orderbookV1 = (await fetchURL("https://orders.muesliswap.com/all-orderbooks")).data + const vOrderbookV1 = orderbookV1.map(ob => { + if (ob.fromToken === ".") { + const totalBuy = ob.buy.map(o => parseFloat(o.totalPrice)).reduce((p, c) => p + c, 0) + const totalSell = ob.sell.map(o => parseFloat(o.amount)).reduce((p, c) => p + c, 0) + // Find the price (we need to convert the tokenname to hex first for this) + const policyId = ob.toToken.split('.')[0] + const name = Buffer.from(ob.toToken.split('.', 2)[1]).toString('hex').toLowerCase() + const price = (adaPrices.get(policyId + '.' + name)?.bidPrice ?? 0) / 1e6 + return (totalBuy + totalSell * price) + } else { + const totalBuy = ob.buy.map(o => parseFloat(o.totalPrice)).reduce((p, c) => p + c, 0) + const totalSell = ob.sell.map(o => parseFloat(o.amount)).reduce((p, c) => p + c, 0) + // Find the price (we need to convert the tokenname to hex first for this) + const fromPolicyId = ob.fromToken.split('.')[0] + const fromName = Buffer.from(ob.fromToken.split('.', 2)[1]).toString('hex').toLowerCase() + const fromPrice = (adaPrices.get(fromPolicyId + '.' + fromName)?.bidPrice ?? 0) / 1e6 + const toPolicyId = ob.toToken.split('.')[0] + const toName = Buffer.from(ob.toToken.split('.', 2)[1]).toString('hex').toLowerCase() + const toPrice = (adaPrices.get(toPolicyId + '.' + toName)?.bidPrice ?? 0) / 1e6 + return (totalBuy * fromPrice + totalSell * toPrice) } - })) + }) + totalAda += vOrderbookV1.reduce((p, c) => p + c, 0) + + // then accumulate over the orderbooks + const orderbookV2 = (await fetchURL("https://onchain.muesliswap.com/all-orderbooks")).data + const vOrderbookV2 = orderbookV2 + .map(ob => { + if (ob.fromToken === ".") { + const totalBuy = ob.orders + .filter(o => !o.providers.includes("muesliswapAMM")) + .map(o => parseInt(o.fromAmount)).reduce((p, c) => p + c, 0) + return totalBuy + } else { + const price = adaPrices.get(ob.fromToken)?.bidPrice ?? 0 + const totalAmountOtherToken = ob.orders + .filter(o => !o.providers.includes("muesliswapAMM")) + .map(o => parseInt(o.fromAmount)).reduce((p, c) => p + c, 0) + const totalSell = totalAmountOtherToken * price + return totalSell + } + }) + totalAda += vOrderbookV2.reduce((p, c) => p + c, 0) / 1e6 + + // and add pool TVLs + const pools = (await fetchURL("https://api.muesliswap.com/liquidity/pools?providers=muesliswap,muesliswap_clp,muesliswap_v2&only-verified=n")).data + const vPools = pools.map(p => { + const amountA = parseInt(p.tokenA.amount) * parseFloat(p.tokenA.priceAda) + const amountB = parseInt(p.tokenB.amount) * parseFloat(p.tokenB.priceAda) + return amountA + amountB + }) + totalAda += vPools.reduce((p, c) => p + c, 0) / 1e6 + return { cardano: totalAda } } -module.exports={ +module.exports = { misrepresentedTokens: true, timetravel: false, methodology: "The factory addresses are used to find the LP pairs on Smart BCH and Milkomeda. For Cardano we calculate the tokens on resting orders on the order book contracts. TVL is equal to the liquidity on the AMM plus the open orders in the order book", - smartbch: { - tvl: getUniTVL({ factory: '0x72cd8c0B5169Ff1f337E2b8F5b121f8510b52117', chain: 'smartbch', useDefaultCoreAssets: true }), - staking: stakingPricedLP("0x4856BB1a11AF5514dAA0B0DC8Ca630671eA9bf56", "0xc8E09AEdB3c949a875e1FD571dC4b3E48FB221f0", "smartbch", "0x599061437d8455df1f86d401FCC2211baaBC632D", "bitcoin-cash", false, 18) - }, - cardano:{ + cardano: { tvl: adaTvl, staking }, diff --git a/projects/mufex/index.js b/projects/mufex/index.js new file mode 100644 index 00000000000..6cabb58fb75 --- /dev/null +++ b/projects/mufex/index.js @@ -0,0 +1,13 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require('../helper/unwrapLPs') + +const owners = [ + '0x763ecd00eEA0CDAECBDF97d88c3e0fd5457eE5A0', + '0x16BEDB2Ab2aEf9023ff2cbF0C78135cA120c03C6', +] + +module.exports = { + arbitrum: { tvl: sumTokensExport({ owners, tokens: [ADDRESSES.arbitrum.USDT] }) }, + polygon: { tvl: sumTokensExport({ owners, tokens: [ADDRESSES.polygon.USDT] }) }, + bsc: { tvl: sumTokensExport({ owners, tokens: [ADDRESSES.bsc.USDT] }) }, +}; diff --git a/projects/mugen-fi/index.js b/projects/mugen-fi/index.js new file mode 100644 index 00000000000..420e7c22e47 --- /dev/null +++ b/projects/mugen-fi/index.js @@ -0,0 +1,17 @@ +const { staking } = require('../helper/staking') + +async function tvl(_, _b, _cb, { api, }) { + const reserveBalance = await api.call({ abi: 'uint256:reserveBalance', target: '0xf7be8476ae27d27ebc236e33020150b23a86f3dd'}) + return { + tether: reserveBalance / 1e18 + } +} + +module.exports = { + misrepresentedTokens: true, + doublecounted: true, + arbitrum: { + tvl, + staking: staking('0x25b9f82d1f1549f97b86bd0873738e30f23d15ea', '0xfc77b86f3ade71793e1eec1e7944db074922856e') + } +} \ No newline at end of file diff --git a/projects/multialt-stacking/index.js b/projects/multialt-stacking/index.js new file mode 100644 index 00000000000..58f325229a6 --- /dev/null +++ b/projects/multialt-stacking/index.js @@ -0,0 +1,15 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require("../helper/unwrapLPs"); + +const masterchef = "0xFFd33A71411fbA8B989Eca9F99EE7a908a2dEf4F"; +const token_USDT = ADDRESSES.moonriver.USDT; +const token_USDC = ADDRESSES.telos.ETH; + +module.exports = { + kava: { + tvl: sumTokensExport({ + owner: masterchef, + tokens: [token_USDT, token_USDC] + }) + } +} diff --git a/projects/multiplierfinance/abi.json b/projects/multiplierfinance/abi.json index 9d60f59f866..c86b1c6c523 100644 --- a/projects/multiplierfinance/abi.json +++ b/projects/multiplierfinance/abi.json @@ -1,145 +1,7 @@ { - "getReserves": { - "constant": true, - "inputs": [], - "name": "getReserves", - "outputs": [ - { - "internalType": "address[]", - "name": "", - "type": "address[]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "getReserveData": { - "constant": true, - "inputs": [ - { - "internalType": "address", - "name": "_reserve", - "type": "address" - } - ], - "name": "getReserveData", - "outputs": [ - { - "internalType": "uint256", - "name": "totalLiquidity", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "availableLiquidity", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalBorrowsStable", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalBorrowsVariable", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "liquidityRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "variableBorrowRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "stableBorrowRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "averageStableBorrowRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "utilizationRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "liquidityIndex", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "variableBorrowIndex", - "type": "uint256" - }, - { - "internalType": "address", - "name": "mTokenAddress", - "type": "address" - }, - { - "internalType": "uint40", - "name": "lastUpdateTimestamp", - "type": "uint40" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "totalSupply": { - "constant": true, - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "getNoOfErc20s": { - "inputs": [], - "name": "getNoOfErc20s", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "erc20List": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "erc20List", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } + "getReserves": "address[]:getReserves", + "getReserveData": "function getReserveData(address _reserve) view returns (uint256 totalLiquidity, uint256 availableLiquidity, uint256 totalBorrowsStable, uint256 totalBorrowsVariable, uint256 liquidityRate, uint256 variableBorrowRate, uint256 stableBorrowRate, uint256 averageStableBorrowRate, uint256 utilizationRate, uint256 liquidityIndex, uint256 variableBorrowIndex, address mTokenAddress, uint40 lastUpdateTimestamp)", + "totalSupply": "uint256:totalSupply", + "getNoOfErc20s": "uint256:getNoOfErc20s", + "erc20List": "function erc20List(uint256) view returns (address)" } \ No newline at end of file diff --git a/projects/multiplierfinance/index.js b/projects/multiplierfinance/index.js index 6e0b764f572..b8209c44070 100644 --- a/projects/multiplierfinance/index.js +++ b/projects/multiplierfinance/index.js @@ -110,8 +110,8 @@ async function getReservesDataV2(block) { } const abiv2 = { - getReservesList: {"inputs":[],"name":"getReservesList","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"}, - getReserveData: {"inputs":[{"internalType":"address","name":"asset","type":"address"}],"name":"getReserveData","outputs":[{"components":[{"components":[{"internalType":"uint256","name":"data","type":"uint256"}],"internalType":"struct DataTypes.ReserveConfigurationMap","name":"configuration","type":"tuple"},{"internalType":"uint128","name":"liquidityIndex","type":"uint128"},{"internalType":"uint128","name":"variableBorrowIndex","type":"uint128"},{"internalType":"uint128","name":"currentLiquidityRate","type":"uint128"},{"internalType":"uint128","name":"currentVariableBorrowRate","type":"uint128"},{"internalType":"uint128","name":"currentStableBorrowRate","type":"uint128"},{"internalType":"uint40","name":"lastUpdateTimestamp","type":"uint40"},{"internalType":"address","name":"aTokenAddress","type":"address"},{"internalType":"address","name":"stableDebtTokenAddress","type":"address"},{"internalType":"address","name":"variableDebtTokenAddress","type":"address"},{"internalType":"address","name":"interestRateStrategyAddress","type":"address"},{"internalType":"uint8","name":"id","type":"uint8"}],"internalType":"struct DataTypes.ReserveData","name":"","type":"tuple"}],"stateMutability":"view","type":"function"}, + getReservesList: "address[]:getReservesList", + getReserveData: "function getReserveData(address asset) view returns (tuple(tuple(uint256 data) configuration, uint128 liquidityIndex, uint128 variableBorrowIndex, uint128 currentLiquidityRate, uint128 currentVariableBorrowRate, uint128 currentStableBorrowRate, uint40 lastUpdateTimestamp, address aTokenAddress, address stableDebtTokenAddress, address variableDebtTokenAddress, address interestRateStrategyAddress, uint8 id))", } module.exports = { diff --git a/projects/mummy/index.js b/projects/mummy/index.js new file mode 100644 index 00000000000..d23f05efe33 --- /dev/null +++ b/projects/mummy/index.js @@ -0,0 +1,34 @@ +const { staking } = require("../helper/staking"); +const { gmxExports } = require("../helper/gmx"); + +//Fantom +const fantomVault = "0xA6D7D0e650aa40FFa42d845A354c12c2bc0aB15f"; +const fantomStaking = "0x727dB8FA7861340d49d13ea78321D0C9a1a79cd5"; +const fantomMMY = "0x01e77288b38b416F972428d562454fb329350bAc"; + +//Optimism +const opVault = "0xA6D7D0e650aa40FFa42d845A354c12c2bc0aB15f"; +const opStaking = "0x04f23404553fcc388Ec73110A0206Dd2E76a6d95"; +const opMMY = "0x47536f17f4ff30e64a96a7555826b8f9e66ec468"; +//Arbitrum +const arbVault = "0x304951d7172bCAdA54ccAC1E4674862b3d5b3d5b"; +const arbStaking = "0x52cC60893d3Bd8508baAB835620CbF9ddfA0A13C"; +const arbMMY = "0xA6D7D0e650aa40FFa42d845A354c12c2bc0aB15f"; +module.exports = { + hallmarks: [ + [1675242000,"sifu 2M deposit"] + ], + fantom: { + staking: staking(fantomStaking, fantomMMY, "fantom"), + tvl: gmxExports({ vault: fantomVault }) + }, + optimism: { + staking: staking(opStaking, opMMY, "optimism"), + tvl: gmxExports({ vault: opVault }) + }, + arbitrum: { + staking: staking(arbStaking, arbMMY, "arbitrum"), + tvl: gmxExports({ vault: arbVault }) + } + +}; diff --git a/projects/mustcometh/index.js b/projects/mustcometh/index.js index 2591820d79f..096dc2812fd 100644 --- a/projects/mustcometh/index.js +++ b/projects/mustcometh/index.js @@ -1,13 +1,5 @@ -const {calculateUniTvl} = require('../helper/calculateUniTvl.js') +const {uniTvlExport} = require('../helper/unknownTokens') const FACTORY = "0x800b052609c355cA8103E06F022aA30647eAd60a"; -async function tvl(timestamp, block, chainBlocks) { - return calculateUniTvl(addr=>`polygon:${addr}`, chainBlocks['polygon'], 'polygon', FACTORY, 0, true); -} - - -module.exports = { - misrepresentedTokens: true, - ethereum: { tvl }, -} \ No newline at end of file +module.exports = uniTvlExport('polygon', FACTORY) \ No newline at end of file diff --git a/projects/mute/index.js b/projects/mute/index.js new file mode 100644 index 00000000000..3b49cd3d2b6 --- /dev/null +++ b/projects/mute/index.js @@ -0,0 +1,29 @@ +const { getUniTVL } = require('../helper/unknownTokens'); +const { sumTokensExport } = require("../helper/unwrapLPs"); +const sdk = require("@defillama/sdk"); + +const dMUTE_staking_contract = "0x4336e06Be4F62bD757c4248c48D4C0b32615A2Df" +const MUTE = "0x0e97C7a0F8B2C9885C8ac9fC6136e829CbC21d42" + +async function stakingTVL(timestamp, chain, chainBlocks) { + + let { output: balance } = await sdk.api.erc20.balanceOf({ + target: MUTE, + owner: dMUTE_staking_contract, + block: chainBlocks.era, + chain: "era" + }); + + let staked_MUTE = balance / 10**18 + + return {mute:staked_MUTE}; +} + +module.exports = { + misrepresentedTokens: true, + era: { + tvl: getUniTVL({ factory: '0x40be1cba6c5b47cdf9da7f963b6f761f4c60627d', useDefaultCoreAssets: true, hasStablePools: true, stablePoolSymbol: 'sMLP' }), + staking: stakingTVL + }, + methodology: "Counts liquidity in pools and MUTE token in the dMUTE contract", +}; \ No newline at end of file diff --git a/projects/muuu/abi.json b/projects/muuu/abi.json index 35a511b3cd0..ef0bd55a20a 100644 --- a/projects/muuu/abi.json +++ b/projects/muuu/abi.json @@ -1,255 +1,17 @@ { - "poolInfo": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "poolInfo", - "outputs": [ - { - "internalType": "address", - "name": "lptoken", - "type": "address" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "address", - "name": "gauge", - "type": "address" - }, - { - "internalType": "address", - "name": "crvRewards", - "type": "address" - }, - { - "internalType": "address", - "name": "stash", - "type": "address" - }, - { - "internalType": "bool", - "name": "shutdown", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - "poolLength": { - "inputs": [], - "name": "poolLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "coinsUint": { - "name": "coins", - "outputs": [ - { - "type": "address", - "name": "" - } - ], - "inputs": [ - { - "type": "uint256", - "name": "arg0" - } - ], - "stateMutability": "view", - "type": "function", - "gas": 2280 - }, - "coinsInt": { - "name": "coins", - "outputs": [ - { - "type": "address", - "name": "out" - } - ], - "inputs": [ - { - "type": "int128", - "name": "arg0" - } - ], - "constant": true, - "payable": false, - "type": "function", - "gas": 2190 - }, - "coins": { - "constant": true, - "name": "coins", - "outputs": [ - { - "type": "address", - "name": "" - } - ], - "inputs": [ - { - "type": "uint256", - "name": "arg0" - } - ], - "stateMutability": "view", - "type": "function", - "gas": 2280 - }, - "get_balances": { - "constant": true, - "name": "get_balances", - "outputs": [ - { - "type": "uint256[2]", - "name": "" - } - ], - "inputs": [], - "stateMutability": "view", - "type": "function", - "gas": 2284 - }, - "underlying": { - "constant": true, - "inputs": [], - "name": "underlying", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "exchangeRateStored": { - "constant": true, - "inputs": [], - "name": "exchangeRateStored", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "get_underlying_coins": { - "stateMutability": "view", - "type": "function", - "name": "get_underlying_coins", - "inputs": [ - { - "name": "_pool", - "type": "address" - } - ], - "outputs": [ - { - "name": "", - "type": "address[8]" - } - ], - "gas": 12194 - }, - "get_pool_from_lp_token": { - "stateMutability": "view", - "type": "function", - "name": "get_pool_from_lp_token", - "inputs": [ - { - "name": "arg0", - "type": "address" - } - ], - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "gas": 2443 - }, - "get_coins": { - "stateMutability": "view", - "type": "function", - "name": "get_coins", - "inputs": [ - { - "name": "_pool", - "type": "address" - } - ], - "outputs": [ - { - "name": "", - "type": "address[8]" - } - ], - "gas": 12102 - }, - "get_underlying_balances": { - "stateMutability": "view", - "type": "function", - "name": "get_underlying_balances", - "inputs": [ - { - "name": "_pool", - "type": "address" - } - ], - "outputs": [ - { - "name": "", - "type": "uint256[8]" - } - ], - "gas": 162842 - }, - "get_virtual_price_from_lp_token": { - "inputs": [ - { - "name": "_token", - "type": "address" - } - ], - "name": "get_virtual_price_from_lp_token", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "lockedSupply": { - "inputs": [], - "name": "lockedSupply", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - } -} + "poolInfo": "function poolInfo(uint256) view returns (address lptoken, address token, address gauge, address crvRewards, address stash, bool shutdown)", + "poolLength": "uint256:poolLength", + "coinsUint": "function coins(uint256 arg0) view returns (address) @2280", + "coinsInt": "function coins(int128 arg0) view returns (address out) @2190", + "coins": "function coins(uint256 arg0) view returns (address) @2280", + "get_balances": "function get_balances(address _pool) view returns (uint256[8]) @2284", + "underlying": "address:underlying", + "exchangeRateStored": "uint256:exchangeRateStored", + "get_underlying_coins": "function get_underlying_coins(address _pool) view returns (address[8]) @12194", + "get_pool_from_lp_token": "function get_pool_from_lp_token(address arg0) view returns (address) @2443", + "get_coins": "function get_coins(address _pool) view returns (address[8])", + "get_underlying_balances": "function get_underlying_balances(address _pool) view returns (uint256[8]) @162842", + "get_virtual_price_from_lp_token": "function get_virtual_price_from_lp_token(address _token) view returns (uint256)", + "get_virtual_price": "function get_virtual_price() view returns (uint256)", + "lockedSupply": "uint256:lockedSupply" +} \ No newline at end of file diff --git a/projects/muuu/index.js b/projects/muuu/index.js index 1cdc2529e8f..8e9fe9afc0b 100644 --- a/projects/muuu/index.js +++ b/projects/muuu/index.js @@ -3,7 +3,6 @@ const { tvl, staking } = require("./tvl"); const START_BLOCK = 903029; module.exports = { - timetravel: true, misrepresentedTokens: true, start: START_BLOCK, astar: { diff --git a/projects/muuu/tvl.js b/projects/muuu/tvl.js index 1816338c3ab..9955b135568 100644 --- a/projects/muuu/tvl.js +++ b/projects/muuu/tvl.js @@ -1,189 +1,62 @@ -const sdk = require("@defillama/sdk"); -const BigNumberJs = require("bignumber.js"); +const ADDRESSES = require("../helper/coreAssets.json"); const ABI = require("./abi.json"); -const { toBigNumberJsOrZero } = require("./utils.js"); +const { staking } = require('../helper/staking') -const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000"; +const ZERO_ADDRESS = ADDRESSES.null; const REGISTRY_ADDRESS = "0xDA820e20A89928e43794645B9A9770057D65738B"; const BOOSTER_ADDRESS = "0x6d12e3dE6dAcDBa2779C4947c0F718E13b78cfF4"; const MUKGL_ADDRESS = "0x5eaAe8435B178d4677904430BAc5079e73aFa56e"; +const MULAY_ADDRESS = "0xDDF2ad1d9bFA208228166311FC22e76Ea7a4C44D"; +const MUU_TOKEN = "0xc5BcAC31cf55806646017395AD119aF2441Aee37"; const MUUU_REWARDS_ADDRESS = "0xB2ae0CF4819f2BE89574D3dc46D481cf80C7a255"; -const TOKENS = { - // USDC - "0x6a2d262D56735DbA19Dd70682B39F6bE9a931D98": - "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", - // USDT - "0x3795C36e7D12A8c252A20C5a7B455f7c57b60283": - "0xdac17f958d2ee523a2206206994597c13d831ec7", - // DAI - "0x6De33698e9e9b787e09d3Bd7771ef63557E148bb": - "0x6b175474e89094c44da98b954eedeac495271d0f", - // Starlay lUSDC -> USDC - "0xC404E12D3466acCB625c67dbAb2E1a8a457DEf3c": - "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", - // Starlay lUSDT -> USDT - "0x430D50963d9635bBef5a2fF27BD0bDDc26ed691F": - "0xdac17f958d2ee523a2206206994597c13d831ec7", - // Starlay lDAI -> DAI - "0x4dd9c468A44F3FEF662c35c1E9a6108B70415C2c": - "0x6b175474e89094c44da98b954eedeac495271d0f", - // BUSD - "0x4Bf769b05E832FCdc9053fFFBC78Ca889aCb5E1E": - "0x4fabb145d64652a948d72533023f6e7a623c7c53", - // 3KGL -> DAI(TMP) - "0x18BDb86E835E9952cFaA844EB923E470E832Ad58": - "0x6b175474e89094c44da98b954eedeac495271d0f", - // BAI -> DAI(TMP) - "0x733ebcC6DF85f8266349DEFD0980f8Ced9B45f35": - "0x6b175474e89094c44da98b954eedeac495271d0f", - // oUSD -> DAI(TMP) - "0x29F6e49c6E3397C3A84F715885F9F233A441165C": - "0x6b175474e89094c44da98b954eedeac495271d0f", -}; - -const transformTokenAddress = (address) => TOKENS[address]; - -async function tvl(timestamp, block, chainBlocks) { - let allCoins = {}; - - const poolLength = ( - await sdk.api.abi.call({ - target: BOOSTER_ADDRESS, - abi: ABI.poolLength, - block: chainBlocks["astar"], - chain: "astar", - }) - ).output; - const poolInfo = []; - const calldata = []; - for (let i = 0; i < poolLength; i++) { - calldata.push({ - target: BOOSTER_ADDRESS, - params: [i], - }); - } - const returnData = await sdk.api.abi.multiCall({ - abi: ABI.poolInfo, - calls: calldata, - block: chainBlocks["astar"], - chain: "astar", - }); - for (let i = 0; i < poolLength; i++) { - const pdata = returnData.output[i].output; - if (pdata.shutdown) continue; - poolInfo.push(pdata); - } - await Promise.all( - [...Array(Number(poolInfo.length)).keys()].map(async (i) => { - const supplyFromMuuuFinance = ( - await sdk.api.erc20.totalSupply({ - target: poolInfo[i].token, - block: chainBlocks["astar"], - chain: "astar", - }) - ).output; - - const totalsupply = ( - await sdk.api.erc20.totalSupply({ - target: poolInfo[i].lptoken, - block: chainBlocks["astar"], - chain: "astar", - }) - ).output; - - const muuuFinanceShare = BigNumberJs(supplyFromMuuuFinance) - .times(1e18) - .div(totalsupply) - .toFixed(6); - - const pool = ( - await sdk.api.abi.call({ - target: REGISTRY_ADDRESS, - block: chainBlocks["astar"], - chain: "astar", - abi: ABI.get_pool_from_lp_token, - params: poolInfo[i].lptoken, - }) - ).output; - - const maincoins = ( - await sdk.api.abi.call({ - target: REGISTRY_ADDRESS, - block: chainBlocks["astar"], - chain: "astar", - abi: ABI.get_coins, - params: pool, - }) - ).output; - - const coins = []; - for (let key in maincoins) { - let coin = maincoins[key]; - if (coin == ZERO_ADDRESS) { - continue; - } - - const bal = await sdk.api.erc20.balanceOf({ - target: coin, - owner: pool, - block: chainBlocks["astar"], - chain: "astar", - }); - coins.push({ coin: coin, balance: bal.output }); - } - for (var c = 0; c < coins.length; c++) { - const balanceShare = BigNumberJs(coins[c].balance.toString()) - .times(muuuFinanceShare) - .div(1e18) - .toFixed(0); - - const coinAddress = coins[c].coin; - - // convert 3KGL tokens to DAI. This is temp and should convert using virtual price - // as the tokens have accrued interest, this means current tvl is under reporting - sdk.util.sumSingleBalance( - allCoins, - transformTokenAddress(coinAddress), - balanceShare - ); - } - }) - ); - - // When KGL's price is determined, we can count muKGL's TVL - const muKGL = await sdk.api.erc20.totalSupply({ - target: MUKGL_ADDRESS, - block: chainBlocks["astar"], - chain: "astar", - }); - sdk.util.sumSingleBalance( - allCoins, - "kagla-finance", - toBigNumberJsOrZero(muKGL.output).shiftedBy(-18).toNumber() - ); - - return allCoins; -} - -// When MUUU's price is determined, we can count MUUU's TVL -async function staking(timestamp, block, chainBlocks) { - const balances = {}; - const muuuStakedSupply = await sdk.api.erc20.totalSupply({ - target: MUUU_REWARDS_ADDRESS, - block: chainBlocks["astar"], - chain: "astar", - }); - - sdk.util.sumSingleBalance( - balances, - "muuu", - toBigNumberJsOrZero(muuuStakedSupply.output).shiftedBy(-18).toNumber() - ); - return balances; +async function tvl(timestamp, block, chainBlocks, { api }) { + const [veKGL, veLAY] = await api.multiCall({ abi: 'erc20:totalSupply', calls: [MUKGL_ADDRESS, MULAY_ADDRESS] }) + api.add(ADDRESSES.astar.KGL, veKGL) + api.add(ADDRESSES.astar.LAY, veLAY) + const pools = await api.fetchList({ lengthAbi: ABI.poolLength, itemAbi: ABI.poolInfo, target: BOOSTER_ADDRESS }) + const supply = await api.multiCall({ abi: 'erc20:totalSupply', calls: pools.map(i => i.token) }) + let i = 0 + for (const pool of pools) await addTokensInPool(api, pool.lptoken, supply[i++]) } module.exports = { tvl, - staking, + staking: staking(MUUU_REWARDS_ADDRESS, MUU_TOKEN), }; + +const poolMapping = { + '0x5c71534db6e54322943ad429209d97fa25bbfcd2': { pool:'0x4fD9011F0867e7e8AF7608Ad1BB969Da8b0aBa9B', tokenCount: 2 }, + '0xe12332a6118832cbafc1913ec5d8c3a05e6fd880': { pool:'0xe12332a6118832cbafc1913ec5d8c3a05e6fd880', tokenCount: 2 }, + '0xb91e7abcbf38d0cac1f99b062b75ae0c18e169d1': { pool:'0x578AA1be6D258677e80c9067711861dd981a663E', tokenCount: 2 }, + '0xdc1c5babb4dad3117fd46d542f3b356d171417fa': { pool:'0xdc1c5babb4dad3117fd46d542f3b356d171417fa', tokenCount: 2 }, +} + +async function addTokensInPool(api, lpToken, tokenBal) { + let pool = await api.call({ target: REGISTRY_ADDRESS, abi: ABI.get_pool_from_lp_token, params: lpToken, }) + let tokens = [] + let bals = [] + const mappingPool = poolMapping[lpToken.toLowerCase()] + const supply = await api.call({ abi: 'erc20:totalSupply', target: lpToken }) + if (pool === ZERO_ADDRESS && !mappingPool) { + api.add(lpToken, tokenBal) + return; + } + + if (mappingPool){ + const { pool , tokenCount } = mappingPool + bals = await api.multiCall({ abi: "function balances(uint256) view returns (uint256)", target: pool, calls: Array(tokenCount).fill(0).map((_, i) => i)}) + tokens = await api.multiCall({ abi: ABI.coins, target: pool, calls: Array(tokenCount).fill(0).map((_, i) => i)}) + console.log(bals, tokens) + } else { + tokens = await api.call({ abi: ABI.get_coins, target: REGISTRY_ADDRESS, params: pool }) + bals = await api.call({ abi: ABI.get_balances, target: REGISTRY_ADDRESS, params: pool }) + } + const ratio = tokenBal / supply + for (const t of tokens) { + if (t === ZERO_ADDRESS) continue; + const name = await api.call({ abi: 'string:name', target: t }) + if (name.includes('Kagla.fi')) await addTokensInPool(api, t, bals[tokens.indexOf(t)] * ratio) + else api.add(t, bals[tokens.indexOf(t)] * ratio) + } +} \ No newline at end of file diff --git a/projects/muuu/utils.js b/projects/muuu/utils.js deleted file mode 100644 index 9b7fe7d49b2..00000000000 --- a/projects/muuu/utils.js +++ /dev/null @@ -1,11 +0,0 @@ -const BigNumberJs = require("bignumber.js"); -BigNumberJs.config({ EXPONENTIAL_AT: 1e9 }); - -const toBigNumberJsOrZero = (value) => { - const bn = new BigNumberJs(value); - return bn.isNaN() ? new BigNumberJs("0") : bn; -}; - -module.exports = { - toBigNumberJsOrZero, -}; diff --git a/projects/mux/abi.json b/projects/mux/abi.json index ae928302652..dc6eed37771 100644 --- a/projects/mux/abi.json +++ b/projects/mux/abi.json @@ -1,334 +1,4 @@ -[ - { - "inputs": [], - "name": "dex", - "outputs": [ - { - "internalType": "contract ILiquidityManager", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getChainStorage", - "outputs": [ - { - "components": [ - { - "components": [ - { - "internalType": "uint32", - "name": "shortFundingBaseRate8H", - "type": "uint32" - }, - { - "internalType": "uint32", - "name": "shortFundingLimitRate8H", - "type": "uint32" - }, - { - "internalType": "uint32", - "name": "fundingInterval", - "type": "uint32" - }, - { - "internalType": "uint32", - "name": "liquidityBaseFeeRate", - "type": "uint32" - }, - { - "internalType": "uint32", - "name": "liquidityDynamicFeeRate", - "type": "uint32" - }, - { - "internalType": "uint96", - "name": "mlpPriceLowerBound", - "type": "uint96" - }, - { - "internalType": "uint96", - "name": "mlpPriceUpperBound", - "type": "uint96" - }, - { - "internalType": "uint32", - "name": "lastFundingTime", - "type": "uint32" - }, - { - "internalType": "uint32", - "name": "sequence", - "type": "uint32" - }, - { - "internalType": "uint32", - "name": "strictStableDeviation", - "type": "uint32" - } - ], - "internalType": "struct Reader.PoolStorage", - "name": "pool", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "bytes32", - "name": "symbol", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "tokenAddress", - "type": "address" - }, - { - "internalType": "address", - "name": "muxTokenAddress", - "type": "address" - }, - { - "internalType": "uint8", - "name": "id", - "type": "uint8" - }, - { - "internalType": "uint8", - "name": "decimals", - "type": "uint8" - }, - { - "internalType": "uint56", - "name": "flags", - "type": "uint56" - }, - { - "internalType": "uint32", - "name": "initialMarginRate", - "type": "uint32" - }, - { - "internalType": "uint32", - "name": "maintenanceMarginRate", - "type": "uint32" - }, - { - "internalType": "uint32", - "name": "positionFeeRate", - "type": "uint32" - }, - { - "internalType": "uint32", - "name": "minProfitRate", - "type": "uint32" - }, - { - "internalType": "uint32", - "name": "minProfitTime", - "type": "uint32" - }, - { - "internalType": "uint96", - "name": "maxLongPositionSize", - "type": "uint96" - }, - { - "internalType": "uint96", - "name": "maxShortPositionSize", - "type": "uint96" - }, - { - "internalType": "uint32", - "name": "spotWeight", - "type": "uint32" - }, - { - "internalType": "uint32", - "name": "longFundingBaseRate8H", - "type": "uint32" - }, - { - "internalType": "uint32", - "name": "longFundingLimitRate8H", - "type": "uint32" - }, - { - "internalType": "uint8", - "name": "referenceOracleType", - "type": "uint8" - }, - { - "internalType": "address", - "name": "referenceOracle", - "type": "address" - }, - { - "internalType": "uint32", - "name": "referenceDeviation", - "type": "uint32" - }, - { - "internalType": "uint32", - "name": "halfSpread", - "type": "uint32" - }, - { - "internalType": "uint128", - "name": "longCumulativeFundingRate", - "type": "uint128" - }, - { - "internalType": "uint128", - "name": "shortCumulativeFunding", - "type": "uint128" - }, - { - "internalType": "uint96", - "name": "spotLiquidity", - "type": "uint96" - }, - { - "internalType": "uint96", - "name": "totalLongPosition", - "type": "uint96" - }, - { - "internalType": "uint96", - "name": "totalShortPosition", - "type": "uint96" - }, - { - "internalType": "uint96", - "name": "averageLongPrice", - "type": "uint96" - }, - { - "internalType": "uint96", - "name": "averageShortPrice", - "type": "uint96" - }, - { - "internalType": "uint128", - "name": "collectedFee", - "type": "uint128" - }, - { - "internalType": "uint256", - "name": "deduct", - "type": "uint256" - } - ], - "internalType": "struct Reader.AssetStorage[]", - "name": "assets", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "uint8", - "name": "dexId", - "type": "uint8" - }, - { - "internalType": "uint8", - "name": "dexType", - "type": "uint8" - }, - { - "internalType": "uint8[]", - "name": "assetIds", - "type": "uint8[]" - }, - { - "internalType": "uint32[]", - "name": "assetWeightInDEX", - "type": "uint32[]" - }, - { - "internalType": "uint256[]", - "name": "totalSpotInDEX", - "type": "uint256[]" - }, - { - "internalType": "uint32", - "name": "dexWeight", - "type": "uint32" - }, - { - "internalType": "uint256", - "name": "dexLPBalance", - "type": "uint256" - }, - { - "internalType": "uint256[]", - "name": "liquidityBalance", - "type": "uint256[]" - } - ], - "internalType": "struct Reader.DexStorage[]", - "name": "dexes", - "type": "tuple[]" - }, - { - "internalType": "uint32", - "name": "liquidityLockPeriod", - "type": "uint32" - }, - { - "internalType": "uint32", - "name": "marketOrderTimeout", - "type": "uint32" - }, - { - "internalType": "uint32", - "name": "maxLimitOrderTimeout", - "type": "uint32" - }, - { - "internalType": "uint256", - "name": "lpDeduct", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "stableDeduct", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "isPositionOrderPaused", - "type": "bool" - }, - { - "internalType": "bool", - "name": "isLiquidityOrderPaused", - "type": "bool" - } - ], - "internalType": "struct Reader.ChainStorage", - "name": "chain", - "type": "tuple" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "pool", - "outputs": [ - { - "internalType": "contract ILiquidityPool", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } -] \ No newline at end of file +{ + "getChainStorage": "function getChainStorage() returns (tuple(tuple(uint32 shortFundingBaseRate8H, uint32 shortFundingLimitRate8H, uint32 fundingInterval, uint32 liquidityBaseFeeRate, uint32 liquidityDynamicFeeRate, uint96 mlpPriceLowerBound, uint96 mlpPriceUpperBound, uint32 lastFundingTime, uint32 sequence, uint32 strictStableDeviation) pool, tuple(bytes32 symbol, address tokenAddress, address muxTokenAddress, uint8 id, uint8 decimals, uint56 flags, uint32 initialMarginRate, uint32 maintenanceMarginRate, uint32 positionFeeRate, uint32 liquidationFeeRate, uint32 minProfitRate, uint32 minProfitTime, uint96 maxLongPositionSize, uint96 maxShortPositionSize, uint32 spotWeight, uint32 longFundingBaseRate8H, uint32 longFundingLimitRate8H, uint8 referenceOracleType, address referenceOracle, uint32 referenceDeviation, uint32 halfSpread, uint128 longCumulativeFundingRate, uint128 shortCumulativeFunding, uint96 spotLiquidity, uint96 credit, uint96 totalLongPosition, uint96 totalShortPosition, uint96 averageLongPrice, uint96 averageShortPrice, uint128 collectedFee, uint256 deduct)[] assets, tuple(uint8 dexId, uint8 dexType, uint8[] assetIds, uint32[] assetWeightInDEX, uint256[] totalSpotInDEX, uint32 dexWeight, uint256 dexLPBalance, uint256[] liquidityBalance)[] dexes, uint32 liquidityLockPeriod, uint32 marketOrderTimeout, uint32 maxLimitOrderTimeout, uint256 lpDeduct, uint256 stableDeduct, bool isPositionOrderPaused, bool isLiquidityOrderPaused) chain)", + "pool": "address:pool" +} \ No newline at end of file diff --git a/projects/mux/index.js b/projects/mux/index.js index 9eaab22bdac..d192e74ba0f 100644 --- a/projects/mux/index.js +++ b/projects/mux/index.js @@ -3,21 +3,22 @@ const sdk = require("@defillama/sdk"); const { sumTokens2 } = require('../helper/unwrapLPs') const readerContract = { - arbitrum: '0x6e29c4e8095B2885B8d30b17790924F33EcD7b33', - bsc: '0xeAb5b06a1ea173674601dD54C612542b563beca1', - avax: '0x5996D4545EE59D96cb1FE8661a028Bef0f4744B0', - fantom: '0x29F4dC996a0219838AfeCF868362E4df28A70a7b', + arbitrum: '0x437CEa956B415e97517020490205c07f4a845168', + bsc: '0x2981Bb8F9c7f7C5b9d8CA5e41C0D9cBbd89C7489', + avax: '0xB33e3dDcE77b7679fA92AF77863Ae439C44c8519', + fantom: '0xfb0DCDC30BF892Ec981255e7133AEcb8ea642b76', + optimism: '0x572E9467b2585c3Ab6D9CbEEED9619Fd168254D5', } async function tvl(chain, block) { const { output: storage } = await sdk.api.abi.call({ target: readerContract[chain], - abi: abi.find(i => i.name === 'getChainStorage'), + abi: abi.getChainStorage, chain, block, }) const { output: pool } = await sdk.api.abi.call({ target: readerContract[chain], - abi: abi.find(i => i.name === 'pool'), + abi: abi.pool, chain, block, }) @@ -36,10 +37,6 @@ async function tvl(chain, block) { return balances } -module.exports = { - methodology: `This is the total value of all tokens in the MUXLP Pool. The liquidity pool consists of a token portfolio used for margin trading and third-party DEX mining.`, -} - Object.keys(readerContract).forEach(chain => { module.exports[chain] = { tvl: async (_, _b, {[chain]: block}) => { diff --git a/projects/mversex/index.js b/projects/mversex/index.js new file mode 100644 index 00000000000..7dc4f3812b7 --- /dev/null +++ b/projects/mversex/index.js @@ -0,0 +1,7 @@ +const { getUniTVL } = require("../helper/unknownTokens"); +module.exports = { + misrepresentedTokens: true, + kava: { + tvl: getUniTVL({ factory: "0x266F951c525130a4E230bB40F0e3525C6C99B9c5", useDefaultCoreAssets: true, fetchBalances: true, }), + }, +}; diff --git a/projects/mycelium/index.js b/projects/mycelium/index.js index 781145ba7fc..aa8bb727522 100644 --- a/projects/mycelium/index.js +++ b/projects/mycelium/index.js @@ -4,7 +4,7 @@ const { staking } = require('../helper/staking') module.exports = { methodology: "We count liquidity in Perpetual Swaps based on the value of tokens in the MLP pool.", arbitrum: { - tvl: gmxExports({ chain: 'arbitrum', vault: '0xDfbA8AD57d2c62F61F0a60B2C508bCdeb182f855', }), + tvl: gmxExports({ vault: '0xDfbA8AD57d2c62F61F0a60B2C508bCdeb182f855', }), staking: staking('0xF9B003Ee160dA9677115Ad3c5bd6BB6dADcB2F93', '0xC74fE4c715510Ec2F8C61d70D397B32043F55Abe', 'arbitrum') }, } \ No newline at end of file diff --git a/projects/mymetatrader/index.js b/projects/mymetatrader/index.js new file mode 100644 index 00000000000..2f9c3025c14 --- /dev/null +++ b/projects/mymetatrader/index.js @@ -0,0 +1,21 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require("../helper/unwrapLPs"); +const { staking } = require("../helper/staking"); + +const vault = "0x992EB7040b66b13abEa94E2621D4E61d5CE608BD"; +const usdc = ADDRESSES.arbitrum.USDC; + +const stakingPool = "0xBdB00022030C9D715A10F2fCeDb19e99020Aa357"; +const mmtToken = "0x27d8de4c30ffde34e982482ae504fc7f23061f61"; + +module.exports = { + arbitrum: { + tvl: sumTokensExport({ + tokensAndOwners: [ + [usdc, vault], + ], + }), + staking: staking(stakingPool, mmtToken), + }, + hallmarks: [[1677765600, "Closed mainnet"]], +}; diff --git a/projects/myso/index.js b/projects/myso/index.js new file mode 100644 index 00000000000..725745df819 --- /dev/null +++ b/projects/myso/index.js @@ -0,0 +1,70 @@ +const { sumTokens2 } = require("../helper/unwrapLPs"); +const axios = require("axios"); +const zlib = require("zlib"); + +const mapChainToChainId = { + ethereum: 1, + arbitrum: 42161, +}; + +const brotliDecode = (stream) => { + return new Promise((resolve, reject) => { + let responseBuffer = []; + + stream.on("data", function handleStreamData(chunk) { + responseBuffer.push(chunk); + }); + + stream.on("error", function handleStreamError(err) { + reject(err); + }); + + stream.on("end", function handleStreamEnd() { + let responseData = Buffer.concat(responseBuffer); + + responseData = responseData.toString("utf8"); + + resolve(JSON.parse(responseData)); + }); + }); +}; + +const getPools = async (chainId) => { + const response = await axios.get( + `https://api.myso.finance/chainIds/${chainId}/pools`, + { + decompress: false, + responseType: "stream", + transformResponse: (data) => { + return data.pipe(zlib.createBrotliDecompress()); + }, + } + ); + + const data = await brotliDecode(response.data); + + return data.pools.map((pool) => pool.poolAddress); +}; + +async function tvl(_, _b, _cb, { api, chain }) { + const chainId = mapChainToChainId[chain]; + const pools = await getPools(chainId); + + const data = await api.multiCall({ + abi: "function getPoolInfo() view returns (address _loanCcyToken, address _collCcyToken, uint256 _maxLoanPerColl, uint256 _minLoan, uint256 _loanTenor, uint256 _totalLiquidity, uint256 _totalLpShares, uint256 _baseAggrBucketSize, uint256 _loanIdx)", + calls: pools, + }); + const toa = pools + .map((owner, i) => [ + [data[i]._loanCcyToken, owner], + [data[i]._collCcyToken, owner], + ]) + .flat(); + return sumTokens2({ api, tokensAndOwners: toa, chain }); +} + +module.exports = { + ethereum: { tvl }, + arbitrum: { tvl }, + methodology: "token held as collateral + liquidity left to be borrowed", +}; diff --git a/projects/myswap/abi.js b/projects/myswap/abi.js new file mode 100644 index 00000000000..3d182dbdf0d --- /dev/null +++ b/projects/myswap/abi.js @@ -0,0 +1,102 @@ +const allAbi = [ + { + "name": "Uint256", + "size": 2, + "type": "struct", + "members": [ + { + "name": "low", + "type": "felt", + "offset": 0 + }, + { + "name": "high", + "type": "felt", + "offset": 1 + } + ] + }, + { + "name": "Pool", + "size": 10, + "type": "struct", + "members": [ + { + "name": "name", + "type": "felt", + "offset": 0 + }, + { + "name": "token_a_address", + "type": "felt", + "offset": 1 + }, + { + "name": "token_a_reserves", + "type": "Uint256", + "offset": 2 + }, + { + "name": "token_b_address", + "type": "felt", + "offset": 4 + }, + { + "name": "token_b_reserves", + "type": "Uint256", + "offset": 5 + }, + { + "name": "fee_percentage", + "type": "felt", + "offset": 7 + }, + { + "name": "cfmm_type", + "type": "felt", + "offset": 8 + }, + { + "name": "liq_token", + "type": "felt", + "offset": 9 + } + ] + }, + { + "name": "get_total_number_of_pools", + "type": "function", + "inputs": [], + "outputs": [ + { + "name": "num", + "type": "felt" + } + ], + "stateMutability": "view" + }, + { + "name": "get_pool", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "felt" + } + ], + "outputs": [ + { + "name": "pool", + "type": "Pool" + } + ], + "stateMutability": "view" + }, +] + +const factoryAbi = {} +allAbi.forEach(i => factoryAbi[i.name] = i) + +module.exports = { + factoryAbi, allAbi, +} \ No newline at end of file diff --git a/projects/myswap/api.js b/projects/myswap/api.js new file mode 100644 index 00000000000..1747869fd24 --- /dev/null +++ b/projects/myswap/api.js @@ -0,0 +1,32 @@ +const { call, multiCall, parseAddress } = require('../helper/chain/starknet') +const { transformDexBalances } = require('../helper/portedTokens') +const { factoryAbi, allAbi, } = require('./abi') + +async function tvl() { + const factory = '0x010884171baf1914edc28d7afb619b40a4051cfae78a094a55d230f19e944a28' + let pairCount = await call({ target: factory, abi: factoryAbi.get_total_number_of_pools}) + pairCount = +pairCount + const calls = [] + + for (let i = 1; i <= pairCount; i++) calls.push(i) + const reserves = await multiCall({ abi: factoryAbi.get_pool, calls, allAbi, target: factory, }) + + const data = [] + reserves.forEach((reserve) => { + data.push({ + token0: parseAddress(reserve.token_a_address), + token1: parseAddress(reserve.token_b_address), + token0Bal: +reserve.token_a_reserves.low, + token1Bal: +reserve.token_b_reserves.low, + }) + }) + + return transformDexBalances({chain:'starknet', data}) +} + +module.exports = { + timetravel: false, + starknet: { + tvl, + } +} diff --git a/projects/myswap/index.js b/projects/myswap/index.js new file mode 100644 index 00000000000..674e8c995c1 --- /dev/null +++ b/projects/myswap/index.js @@ -0,0 +1 @@ +module.exports = require('./api') \ No newline at end of file diff --git a/projects/nacho-finance/index.js b/projects/nacho-finance/index.js index 49bc6e94b3f..80097b55a60 100644 --- a/projects/nacho-finance/index.js +++ b/projects/nacho-finance/index.js @@ -35,7 +35,7 @@ async function calcPool2(masterchef, lps, block, chain) { balance: p.output, token: p.input.target, }); - }; + } }); await unwrapUniswapLPs( balances, diff --git a/projects/naos/index.js b/projects/naos/index.js index 31652398fc9..60a261e5c77 100644 --- a/projects/naos/index.js +++ b/projects/naos/index.js @@ -1,67 +1,19 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); -const abis = require("../config/abis"); const { staking, stakings } = require("../helper/staking"); const { pool2 } = require("../helper/pool2"); const BigNumber = require("bignumber.js"); const { sumTokens2 } = require("../helper/unwrapLPs"); -const alpacaAdapterAbi = [ - { - inputs: [], - name: "totalValue", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, -]; - -const AssessorAbi = [ - { - "constant": true, - "inputs": [], - "name": "seniorDebt", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } -] +const alpacaAdapterAbi = "uint256:totalValue"; -const reserveAbi = [ - { - "constant": true, - "inputs": [], - "name": "totalBalance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, -] +const AssessorAbi = "uint256:seniorDebt" // BSC address const BSC_NAOS_ADDRESS = "0x758d08864fb6cce3062667225ca10b8f00496cc2"; const CAKE_BNB_NAOS_LP_ADDRESS = "0xcaa662ad41a662b81be2aea5d59ec0697628665f"; const BSC_BOOST_POOL = "0x3dcd32dd2b225749aa830ca3b4f2411bfeb03db4"; -const BUSD_CONTRACT_ADDRESS = "0xe9e7cea3dedca5984780bafc599bd69add087d56"; +const BUSD_CONTRACT_ADDRESS = ADDRESSES.bsc.BUSD; const BUSD_CONTRACT_HOLDER = [ "0x9591ff9c5070107000155ff6c5ce049aa1443dd3", // Formation "0xb9ece39b356d5c0842301b42a716e4385617c871", // Transmuter @@ -91,7 +43,7 @@ const UNI_ETH_NAOS_LP_ADDRESS = "0x9b577e849b128ee1a69144b218e809b8bb98c35d"; const NAOS_ADDRESS = "0x4a615bb7166210cce20e6642a6f8fb5d4d044496"; const NUSD_3CRV_LP_ADDRESS = "0x67d9eAe741944D4402eB0D1cB3bC3a168EC1764c"; -const DAI_CONTRACT_ADDRESS = "0x6b175474e89094c44da98b954eedeac495271d0f"; +const DAI_CONTRACT_ADDRESS = ADDRESSES.ethereum.DAI; const DAI_CONTRACT_HOLDER = [ "0x9Ddceb30515eD297C1B72Ff8F848F254104b7A12", // Formation "0x3ED6355Ad74605c0b09415d6B0b29a294Fd31265", // Transmuter @@ -134,7 +86,7 @@ async function tvl(timestamp, block) { }), sdk.api.abi.call({ target: YEARN_VAULT_ADDRESS, - abi: abis.abis.minYvV2[1], // pricePerShare + abi: "uint256:pricePerShare", // pricePerShare block, }), sdk.api.erc20.decimals(YEARN_VAULT_ADDRESS), @@ -161,7 +113,7 @@ async function bscTvl(timestamp, ethBlock, chainBlocks) { // ---- Start ibBUSD (map ibBUSD value to BUSD) // formation const { output: isBUSDs } = await sdk.api.abi.multiCall({ - abi: alpacaAdapterAbi[0], + abi: alpacaAdapterAbi, calls: BSC_ALPACA_ADAPTERS.map(i => ({ target: i })), chain, block, }) @@ -183,7 +135,7 @@ async function bscBorrowed(timestamp, ethBlock, chainBlocks) { const seniorDebt = ( await sdk.api.abi.call({ target: borrwer.Assessor, - abi: AssessorAbi[0], + abi: AssessorAbi, chain, block, }) ).output; @@ -209,19 +161,7 @@ module.exports = { sdk.api.erc20.decimals(NUSD_3CRV_LP_ADDRESS), sdk.api.abi.call({ target: NUSD_3CRV_LP_ADDRESS, - abi: { - "name": "get_virtual_price", - "outputs": [ - { - "type": "uint256", - "name": "" - } - ], - "inputs": [], - "stateMutability": "view", - "type": "function", - "gas": 1011891 - }, + abi: "uint256:get_virtual_price", block, }) ])).map(i => i.output) diff --git a/projects/narwhal-finance/index.js b/projects/narwhal-finance/index.js new file mode 100644 index 00000000000..20365454b9b --- /dev/null +++ b/projects/narwhal-finance/index.js @@ -0,0 +1,19 @@ +const { sumTokensExport } = require('../helper/unwrapLPs') +const ADDRESSES = require('../helper/coreAssets.json'); + +module.exports = { + hallmarks: [ + [1689034511, "Launch on Arbitrum & BSC"], + ], +}; + +const config = { + bsc: { owner: '0x71AF984f825C7BEf79cAEE5De14565ca8A29Fe93', tokens: [ADDRESSES.bsc.USDT,]}, + arbitrum: { owner: '0x14559479DC1041Ef6565f44028D454F423d2b9E6', tokens: [ADDRESSES.arbitrum.USDT,]}, +} + +Object.keys(config).forEach(chain => { + module.exports[chain] = { + tvl: sumTokensExport(config[chain]) + } +}) diff --git a/projects/native/index.js b/projects/native/index.js new file mode 100644 index 00000000000..f4b8191e088 --- /dev/null +++ b/projects/native/index.js @@ -0,0 +1,32 @@ +const { getLogs } = require('../helper/cache/getLogs'); +const { sumTokens2, nullAddress, } = require("../helper/unwrapLPs"); + +module.exports = { + methodology: "includes the liquidity provided to the infrasturcture and ecosystem of Native", +} + +const config = { + bsc: { factory: '0x85b0f66e83515ff4e825dfcaa58e040e08278ef9', fromBlock: 27103796, }, + ethereum: { factory: '0x85b0f66e83515ff4e825dfcaa58e040e08278ef9', fromBlock: 16995923, }, +} + +Object.keys(config).forEach(chain => { + const { factory, fromBlock, } = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const logs = await getLogs({ + api, + target: factory, + topic: 'PoolCreated(address,address,address,address,address)', + eventAbi: 'event PoolCreated(address treasury, address owner, address signer, address pool, address impl)', + onlyArgs: true, + fromBlock, + }) + const treasuries = logs.map(i => i.treasury) + const pools = logs.map(i => i.pool) + const tokenAs = await api.multiCall({ abi: 'address[]:getTokenAs', calls: pools }) + const tokenBs = await api.multiCall({ abi: 'address[]:getTokenBs', calls: pools }) + return sumTokens2({ api, ownerTokens: treasuries.map((v, i) => [[nullAddress, ...tokenAs[i], ...tokenBs[i]], v]) }) + } + } +}) diff --git a/projects/nava-finance/index.js b/projects/nava-finance/index.js index e145b3a39b1..f2ebd6cc26c 100644 --- a/projects/nava-finance/index.js +++ b/projects/nava-finance/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { unknownTombs, sumUnknownTokens } = require('../helper/unknownTokens') const { staking } = require('../helper/staking'); const { sumTokens2 } = require('../helper/unwrapLPs') @@ -13,7 +14,7 @@ const pool2lps = [ ]; const genesisPool = '0xb9F9993f0D4A63344D9571387E18f659B6AE5447' const OORT = '0x3D1BBD0eC9Af25e8f12383d9F6a6bbFa6DfeF06F' -const WREI = '0x2545AF3D8b11e295bB7aEdD5826021AB54F71630' +const WREI = ADDRESSES.rei.WREI const OORT_LP = '0xB95783dCE72CF2C7fa13a6b3D7399A4223259878' // module.exports = { // ...tombTvl(bond, share, rewardPool, boardroom, pool2lps, "rei", undefined, false, pool2lps[1]) diff --git a/projects/navi/index.js b/projects/navi/index.js new file mode 100644 index 00000000000..7acf22c3d17 --- /dev/null +++ b/projects/navi/index.js @@ -0,0 +1,43 @@ +const sui = require("../helper/chain/sui") + +const reserves = [ + "0xab644b5fd11aa11e930d1c7bc903ef609a9feaf9ffe1b23532ad8441854fbfaf", + "0xeb3903f7748ace73429bd52a70fff278aac1725d3b58afa781f25ce3450ac203", +] + +const decimalShift = { + '0x5d4b302506645c37ff133b98c4b50a5ae14841659738d6d733d59d0d217a93bf::coin::COIN': -3, // USDC +} + + +async function borrow() { + const { api } = arguments[3] + const objects = await sui.getObjects(reserves) + objects.forEach(object => { + const coin = '0x' + object.fields.value.fields.coin_type + const borrowed = object.fields.value.fields.borrow_balance.fields.total_supply + const amount = borrowed * (10 ** (decimalShift[coin] ?? 0)) + api.add(coin, amount) + }) +} + + +async function tvl() { + const { api } = arguments[3] + const objects = await sui.getObjects(reserves) + objects.forEach(object => { + const coin = '0x' + object.fields.value.fields.coin_type + const total_supply = object.fields.value.fields.supply_balance.fields.total_supply + const borrowed = object.fields.value.fields.borrow_balance.fields.total_supply + const amount = (total_supply - borrowed) * (10 ** (decimalShift[coin] ?? 0)) + api.add(coin, amount) + }) +} + +module.exports = { + timetravel: false, + sui: { + tvl, + borrowed: borrow, + }, +} \ No newline at end of file diff --git a/projects/nayms/index.js b/projects/nayms/index.js new file mode 100644 index 00000000000..c4b954c24eb --- /dev/null +++ b/projects/nayms/index.js @@ -0,0 +1,21 @@ +const ADDRESSES = require("../helper/coreAssets.json"); +const { sumTokensExport } = require("../helper/unwrapLPs"); + +const tokens = [ + ADDRESSES.ethereum.WETH, + ADDRESSES.ethereum.DAI, + ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.TUSD, + ADDRESSES.ethereum.USDT, +]; + +const owner = '0x39e2f550fef9ee15b459d16bD4B243b04b1f60e5' + +module.exports = { + methodology: "Sum assets on Nayms", + start: 1681990619, // Thu Apr 20 13:36:59 2023 GMT + ethereum: { + tvl: sumTokensExport({ owner, tokens }), + }, + hallmarks: [[1681990619, "Nayms V3 Launch"]], +}; diff --git a/projects/nearpad/index.js b/projects/nearpad/index.js index 6310cf696c1..6b4e53c0486 100644 --- a/projects/nearpad/index.js +++ b/projects/nearpad/index.js @@ -1,18 +1,19 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { getUniTVL } = require('../helper/unknownTokens') const tokens = [ "0x885f8CF6E45bdd3fdcDc644efdcd0AC93880c781", "0xC9BdeEd33CD01541e1eeD10f90519d2C06Fe3feB", - "0xC42C30aC6Cc15faC9bD938618BcaA1a1FaE8501d", - "0x4988a896b1227218e4A686fdE5EabdcAbd91571f", + ADDRESSES.aurora.NEAR, + ADDRESSES.aurora.USDT_e, "0xe3520349F477A5F6EB06107066048508498A291b", - "0xB12BFcA5A55806AaF64E99521918A4bf0fC40802", + ADDRESSES.aurora.USDC_e, "0xF4eB217Ba2454613b15dBdea6e5f22276410e89e", - "0x8BEc47865aDe3B172A928df8f990Bc7f2A3b9f79", + ADDRESSES.aurora.AURORA, "0xFa94348467f64D5A457F75F8bc40495D33c65aBB", "0x74974575d2f1668c63036d51ff48dbaa68e52408", "0xdcD6D4e2B3e1D1E1E6Fa8C21C8A323DcbecfF970", - "0xDA2585430fEf327aD8ee44Af8F1f989a2A91A3d2", + ADDRESSES.aurora.FRAX, ]; diff --git a/projects/nemesis-dao/index.js b/projects/nemesis-dao/index.js index 3a10cb87874..7af04cc022a 100644 --- a/projects/nemesis-dao/index.js +++ b/projects/nemesis-dao/index.js @@ -1,9 +1,10 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { ohmTvl } = require('../helper/ohm') const treasury = "0xdffb6fb92e3f54c0daa59e5af3f47fd58824562a" module.exports = ohmTvl(treasury, [ //BUSD - ["0xe9e7cea3dedca5984780bafc599bd69add087d56", false], + [ADDRESSES.bsc.BUSD, false], //Pancake LP ["0x6b0a3e71b69ab49ddea0ed23bef48f78bf9509aa", true], ], "bsc", "0xfd562672bf1da0f80d43f26bfc4ca19121ba661b", "0x8AC9DC3358A2dB19fDd57f433ff45d1fc357aFb3") \ No newline at end of file diff --git a/projects/neopin-liquid-staking/index.js b/projects/neopin-liquid-staking/index.js new file mode 100644 index 00000000000..76b4a8b5856 --- /dev/null +++ b/projects/neopin-liquid-staking/index.js @@ -0,0 +1,32 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const sdk = require('@defillama/sdk'); + +const wethAddress = ADDRESSES.ethereum.WETH; +const wKlayAddress = ADDRESSES.klaytn.WKLAY; + +const npEthContract = '0x841d3B6660663Ed4B0D9b9EDAEe6642e05A4E182'; +const npKlayContract = '0xb0BB95ac3195A266Ab924596Ba32c2a10e245a95'; + +async function getEthTvl(timestamp, ethBlock, chainBlocks) { + const chain = 'ethereum'; + const pooledETH = await sdk.api.abi.call({ chain, block: ethBlock, target: npEthContract, abi: "uint256:getTotalPooledEth" }); + + return { + [`${chain}:0x0000000000000000000000000000000000000000`]: pooledETH.output + }; +} + +async function getKlayTvl(timestamp, ethBlock, chainBlocks) { + const chain = 'klaytn'; + const pooledKlay = await sdk.api.abi.call({ chain, target: npKlayContract, abi: "uint256:getTotalPooledKlay" }); + + return { + [`${chain}:0x0000000000000000000000000000000000000000`]: pooledKlay.output + }; +} + +module.exports = { + methodology: 'Staked are counted as TVL based on the chain that they are staked on and where the liquidity tokens are issued, npETH and npKLAY are counted as Ethereum TVL and Klaytn TVL since ETH and KLAY are staked in each mainnet and the liquidity tokens are also issued on each mainnet network.', + ethereum: { tvl: getEthTvl }, + klaytn: { tvl: getKlayTvl }, +} diff --git a/projects/neopin-staking/index.js b/projects/neopin-staking/index.js new file mode 100644 index 00000000000..08f1f6abcf7 --- /dev/null +++ b/projects/neopin-staking/index.js @@ -0,0 +1,28 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { getStakedTron } = require('../helper/chain/tron'); +const { staking } = require('../helper/staking') +const { sumTokensExport } = require('../helper/sumTokens'); +const { nullAddress } = require('../helper/unwrapLPs'); + +module.exports = { + klaytn: { + tvl: sumTokensExport({ + owners: [ + '0xDa664b81C13b050F9b0435D0B712218Aa8BB1609', + '0x0D3ACA076712DE598DF856cEcEF76daD38F0A75b', + '0xf9d92BAd7b1410dfFB0a204B7aa418C9fd5A898F', + '0xf20816C9bdcb25da3ba79b206e9b7107ae02ae10' + ], + tokens: [nullAddress], + }), + staking: staking('0x306ee01a6ba3b4a8e993fa2c1adc7ea24462000c', ADDRESSES.klaytn.NPT, 'klaytn'), + }, + tron: { + tvl: async () => { + return { + tron: await getStakedTron('TTjacDH5PL8hpWirqU7HQQNZDyF723PuCg') + } + }, + }, + timetravel: false, +} diff --git a/projects/neopin/index.js b/projects/neopin/index.js new file mode 100644 index 00000000000..f9784d76cb6 --- /dev/null +++ b/projects/neopin/index.js @@ -0,0 +1,9 @@ +const { uniTvlExport } = require('../helper/unknownTokens') +const { mergeExports } = require('../helper/utils') + + +module.exports = mergeExports([ + uniTvlExport('klaytn', '0x1a1F14ec33BF8c2e66731f46D0A706e8025b43e9'), + uniTvlExport('polygon', '0x1289ae78422b94414c1F827C534a1fE8E31E71Aa'), + uniTvlExport('ethereum', '0x2D723f60ad8da76286B2aC120498A5EA6bAbC792'), +]) \ No newline at end of file diff --git a/projects/neptune-mutual/index.js b/projects/neptune-mutual/index.js index f6d01522993..b8f0c9a47f8 100644 --- a/projects/neptune-mutual/index.js +++ b/projects/neptune-mutual/index.js @@ -1,34 +1,42 @@ -const sdk = require('@defillama/sdk') -const { ethers } = require("ethers"); const { sumTokens2 } = require('../helper/unwrapLPs') +const { getLogs } = require('../helper/cache/getLogs') const abi = { - sc: { "inputs": [], "name": "sc", "outputs": [{ "internalType": "contract IStore", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, + sc: "address:sc", } -async function tvl(_, block) { - const {output: logs} = await sdk.api.util.getLogs({ - target: "0x0150b57aa8cc6fcbc110f07eef0c85731d8aacf4", // vault factory +const vaultFactories = { + ethereum: "0x0150b57aa8cc6fcbc110f07eef0c85731d8aacf4", + arbitrum: "0x0150b57aa8cc6fcbc110f07eef0c85731d8aacf4", +}; + +const fromBlocks = { + ethereum: 15912005, + arbitrum: 54210090, +}; + +async function tvl(_, block, _1, { api, chain }) { + const logs = await getLogs({ + api, + target: vaultFactories[chain], // vault factory topic: "VaultDeployed(address,bytes32,string,string)", - keys: [], - fromBlock: 15912005, - toBlock: block, + fromBlock: fromBlocks[chain], + eventAbi: 'event VaultDeployed (address vault, bytes32 coverKey, string name, string symbol)', }); - let iface = new ethers.utils.Interface(['event VaultDeployed (address vault, bytes32 coverKey, string name, string symbol)']) - const vaults = logs.map((log) => iface.parseLog(log).args.vault) - const { output: tokens } = await sdk.api.abi.multiCall({ + const vaults = logs.map((log) => log.args.vault) + const tokens = await api.multiCall({ abi: abi.sc, - calls: vaults.map(i => ({ target: i})), - block, + calls: vaults, }) - const toa = tokens.map(i => ([i.output, i.input.target])) + const toa = tokens.map((token, i) => ([token, vaults[i]])) - return sumTokens2({ tokensAndOwners: toa, block, }) + return sumTokens2({ api, tokensAndOwners: toa, chain }) } module.exports = { methodology: "TVL consists of the total liquidity available in the cover pools", start: 1667260800, // Nov 01 2022 @ 12:00am (UTC) ethereum: { tvl }, + arbitrum: { tvl }, }; diff --git a/projects/nereus/index.js b/projects/nereus/index.js index 0e70e352046..12b134729fa 100644 --- a/projects/nereus/index.js +++ b/projects/nereus/index.js @@ -1,12 +1,13 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const tokenAndContract = [ - ["0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7", "0x6d9336ce867606Dcb1aeC02C8Ef0EDF0FF22d247"], // nWAVAX - ["0x49D5c2BdFfac6CE2BFdB6640F4F80f226bc10bAB", "0x92F79834fC52f0Aa328f991C91185e081ea4f957"], // nWETH + [ADDRESSES.avax.WAVAX, "0x6d9336ce867606Dcb1aeC02C8Ef0EDF0FF22d247"], // nWAVAX + [ADDRESSES.avax.WETH_e, "0x92F79834fC52f0Aa328f991C91185e081ea4f957"], // nWETH ["0x50b7545627a5162F82A992c33b87aDc75187B218", "0x3D8231cE419886a5D400dD5a168C8917aEeAB25C"], // nWBTC - ["0xd586E7F844cEa2F87f50152665BCbc2C279D8d70", "0x6Ce0e6e81Dc7A5D997E6169cD5f8C982DA83e49e"], // nDAI - ["0xc7198437980c041c805A1EDcbA50c1Ce5db95118", "0x29F511e6f62118b27D9B47d1AcD6fDd5cD0B4C64"], // nUSDT - ["0xA7D7079b0FEaD91F3e65f86E8915Cb59c1a4C664", "0x723191E7F8D87eC22E682c13Df504E5E3432e53E"] // nUSDC + [ADDRESSES.avax.DAI, "0x6Ce0e6e81Dc7A5D997E6169cD5f8C982DA83e49e"], // nDAI + [ADDRESSES.avax.USDT_e, "0x29F511e6f62118b27D9B47d1AcD6fDd5cD0B4C64"], // nUSDT + [ADDRESSES.avax.USDC_e, "0x723191E7F8D87eC22E682c13Df504E5E3432e53E"] // nUSDC ] async function tvl(timestamp, block, chainBlocks) { diff --git a/projects/nerve/index.js b/projects/nerve/index.js index 67bea424400..7637b89e750 100644 --- a/projects/nerve/index.js +++ b/projects/nerve/index.js @@ -1,96 +1,32 @@ -const sdk = require('@defillama/sdk') -const BigNumber = require('bignumber.js') - +const ADDRESSES = require('../helper/coreAssets.json') const { staking } = require('../helper/staking') -const {unwrapCrv} = require('../helper/unwrapLPs') - -/*================================================== - Addresses - ==================================================*/ +const { sumTokensExport } = require('../helper/unwrapLPs') -const btcPoolAddress = '0x6C341938bB75dDe823FAAfe7f446925c66E6270c' -const usdPoolAddress = '0x1B3771a66ee31180906972580adE9b81AFc5fCDc' -const ethPoolAddress = '0x146CD24dCc9f4EB224DFd010c5Bf2b0D25aFA9C0' const xnrvAddress = '0x15B9462d4Eb94222a7506Bc7A25FB27a2359291e' -const rusdPoolAddress = '0x0eafaa7ed9866c1f08ac21dd0ef3395e910f7114' -const fusdtPoolAddress = '0xd0fBF0A224563D5fFc8A57e4fdA6Ae080EbCf3D3' -const ustPoolAddress = '0x2dcCe1586b1664f41C72206900e404Ec3cA130e0' -const nrv3 = '0xf2511b5e4fb0e5e2d123004b672ba14850478c14' const nrv = "0x42F6f551ae042cBe50C739158b4f0CAC0Edb9096" const tokens = { - // BUSD - '0xe9e7cea3dedca5984780bafc599bd69add087d56': [usdPoolAddress], - // Binance Pegged USDC - '0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d': [usdPoolAddress], - // Binance Pegged USDT - '0x55d398326f99059ff775485246999027b3197955': [usdPoolAddress], - // rUSD - '0x07663837218a003e66310a01596af4bf4e44623d': [rusdPoolAddress], - // 3NRV-LP - //'0xf2511b5e4fb0e5e2d123004b672ba14850478c14': [rusdPoolAddress], - // Binance Pegged BTC - '0x7130d2a12b9bcbfae4f2634d864a1ee1ce3ead9c': [btcPoolAddress], - // anyBTC - '0x54261774905f3e6e9718f2abb10ed6555cae308a': [btcPoolAddress], - // Binance Pegged ETH - '0x2170ed0880ac9a755fd29b2688956bd959f933f8': [ethPoolAddress], - // anyETH - '0x6f817a0ce8f7640add3bc0c1c2298635043c2423': [ethPoolAddress], - // FUSDT - '0x049d68029688eabf473097a2fc38ef61633a3c7a': [fusdtPoolAddress], - // 3NRV-LP - '0xf2511b5e4fb0e5e2d123004b672ba14850478c14': [fusdtPoolAddress], - // UST - '0x23396cf899ca06c4472205fc903bdb4de249d6fc': [ustPoolAddress], + busd: ADDRESSES.bsc.BUSD, + usdt: ADDRESSES.bsc.USDT, + usdc: ADDRESSES.bsc.USDC, } -async function tvl(timestamp, block, chainBlocks) { - let balances = {} - let calls = [] - - for (const token in tokens) { - for (const poolAddress of tokens[token]) - calls.push({ - target: token, - params: poolAddress, - }) - } - - // Pool Balances - let balanceOfResults = await sdk.api.abi.multiCall({ - block:chainBlocks['bsc'], - calls: calls, - abi: 'erc20:balanceOf', - chain: 'bsc' - }) - - // Compute Balances - balanceOfResults.output.forEach((balanceOf) => { - let address = `bsc:${balanceOf.input.target}`.toLowerCase(); - if(address === "bsc:0x54261774905f3e6e9718f2abb10ed6555cae308a"){ - balances["bitcoin"] = Number(balanceOf.output)/1e8 - return; - } else if(address === "bsc:0x6f817a0ce8f7640add3bc0c1c2298635043c2423"){ - address = "bsc:0x2170ed0880ac9a755fd29b2688956bd959f933f8" - } else if(address === "bsc:0x07663837218a003e66310a01596af4bf4e44623d" || address === 'bsc:0x049d68029688eabf473097a2fc38ef61633a3c7a'){ // fusdt and rusd - address = "0x6b175474e89094c44da98b954eedeac495271d0f" - } - balances[address] = BigNumber(balances[address] || 0) - .plus(balanceOf.output) - .toFixed() - }) - await unwrapCrv(balances, nrv3, balances['bsc:'+nrv3], chainBlocks['bsc'], 'bsc', (addr)=>`bsc:${addr}`) - delete balances['bsc:'+nrv3]; - - return balances -} +const ownerTokens = [ + [ + [tokens.busd, tokens.usdt, tokens.usdc,], '0x1b3771a66ee31180906972580ade9b81afc5fcdc' + ], + [ ['0x54261774905f3e6e9718f2abb10ed6555cae308a', ADDRESSES.bsc.BTCB], '0x6C341938bB75dDe823FAAfe7f446925c66E6270c' ], + [ [ADDRESSES.bsc.ETH, '0x6f817a0ce8f7640add3bc0c1c2298635043c2423'], '0x146CD24dCc9f4EB224DFd010c5Bf2b0D25aFA9C0' ], + [ ['0x07663837218a003e66310a01596af4bf4e44623d'], '0x0eafaa7ed9866c1f08ac21dd0ef3395e910f7114' ], + [ [ADDRESSES.fantom.fUSDT], '0xd0fBF0A224563D5fFc8A57e4fdA6Ae080EbCf3D3' ], + [ ['0x23396cf899ca06c4472205fc903bdb4de249d6fc'], '0x2dcCe1586b1664f41C72206900e404Ec3cA130e0' ], +] module.exports = { - timetravel: true, + misrepresentedTokens: true, start: 1614556800, // March 1, 2021 00:00 AM (UTC) bsc:{ - tvl, + tvl: sumTokensExport({ ownerTokens }), staking:staking(xnrvAddress, nrv, "bsc") } } diff --git a/projects/nervenetworkbridge/index.js b/projects/nervenetworkbridge/index.js new file mode 100644 index 00000000000..fbffad6ae68 --- /dev/null +++ b/projects/nervenetworkbridge/index.js @@ -0,0 +1,123 @@ +const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') +const sdk = require("@defillama/sdk"); +const { getConfig } = require('../helper/cache') +const { get } = require('../helper/http') +const { BigNumber } = require("bignumber.js"); + +const getBridgeContract = { + 'ethereum': '0xC707E0854DA2d72c90A7453F8dc224Dd937d7E82', + 'bsc': '0x75Ab1d50BEDBd32b6113941fcF5359787a4bBEf4', + 'heco': '0x2ead2e7a3bd88c6a90b3d464bc6938ba56f1407f', + 'okexchain': '0xE096d12D6cb61e11BCE3755f938b9259B386523a', + 'harmony': '0x32Fae32961474e6D19b7a6346524B8a6a6fd1D9c', + 'polygon': '0x9DDc2fB726cF243305349587AE2a33dd7c91460e', + 'kcc': '0xdb442dff8ff9fd10245406da9a32528c30c10c92', + 'cronos': '0x3758AA66caD9F2606F1F501c9CB31b94b713A6d5', + 'avax': '0x3758AA66caD9F2606F1F501c9CB31b94b713A6d5', + 'arbitrum': '0xf0E406c49C63AbF358030A299C0E00118C4C6BA5', + 'fantom': '0x3758AA66caD9F2606F1F501c9CB31b94b713A6d5', + 'metis': '0x3758AA66caD9F2606F1F501c9CB31b94b713A6d5', + 'iotex': '0xf0e406c49c63abf358030a299c0e00118c4c6ba5', + 'optimism': '0x3758AA66caD9F2606F1F501c9CB31b94b713A6d5', + 'klaytn': '0x3758aa66cad9f2606f1f501c9cb31b94b713a6d5', + 'smartbch': '0x3758AA66caD9F2606F1F501c9CB31b94b713A6d5', + 'enuls': '0x3758AA66caD9F2606F1F501c9CB31b94b713A6d5', + 'kava': '0x3758AA66caD9F2606F1F501c9CB31b94b713A6d5', + 'ethpow': '0x67b3757f20DBFa114b593dfdAc2b3097Aa42133E', + 'rei': '0x3758AA66caD9F2606F1F501c9CB31b94b713A6d5', + 'era': '0x54C4A99Ee277eFF14b378405b6600405790d5045' +} +const tronBridgeContract = 'TXeFBRKUW2x8ZYKPD13RuZDTd9qHbaPGEN'; + +let tokensConfTest; +async function getTokensConf() { + if (!tokensConfTest) { + tokensConfTest = getConfig('nerve-network-bridge', 'https://assets.nabox.io/api/tvltokens'); + } + return tokensConfTest +} + +function getChain(chain) { + const chainMapping = { + era: 'zksync' + } + + return chainMapping[chain] ?? chain +} + +async function tvl(_, _b, _cb, { api, }) { + let conf = await getTokensConf(); + + const bridgeContract = getBridgeContract[api.chain]; + const tokens = Object.values(conf[getChain(api.chain)]) + const owners = [bridgeContract] + return sumTokens2({ api, tokens, owners, }) +} + +async function tronTvl() { + const { api } = arguments[3] + let conf = await getTokensConf(); + const tokens = conf['tron']; + const tokenKeys = Object.keys(conf['tron']) + const tokens1 = [] + for (let label of tokenKeys) { + let token = tokens[label]; + if (token !== 'T9yD14Nj9j7xAB4dbGeiX9h8unkKHxuWwb') { + tokens1.push(token) + } + } + return sumTokens2({ api, owner: tronBridgeContract, tokens: [nullAddress, ...tokens1] }) +} + +module.exports = { + methodology: "Assets staked in the pool and trading contracts", + tron: { + tvl: tronTvl + }, + nuls: { + tvl: async () => { + const api = 'https://public.nerve.network/asset/nuls' + const nulsOnNerve = (await get(api)).total; + const nulsOnEth = ( + await sdk.api.abi.call({ + target: '0xa2791BdF2D5055Cda4d46EC17f9F429568275047', + abi: 'erc20:totalSupply', + chain: 'ethereum' + }) + ).output; + const nulsOnBSC = ( + await sdk.api.abi.call({ + target: '0x8CD6e29d3686d24d3C2018CEe54621eA0f89313B', + abi: 'erc20:totalSupply', + chain: 'bsc' + }) + ).output; + const nulsOnOKC = ( + await sdk.api.abi.call({ + target: '0x8cd6e29d3686d24d3c2018cee54621ea0f89313b', + abi: 'erc20:totalSupply', + chain: 'okexchain' + }) + ).output; + const nulsOnHeco = ( + await sdk.api.abi.call({ + target: '0xd938e45680da19ad36646ae8d4c671b2b1270f39', + abi: 'erc20:totalSupply', + chain: 'heco' + }) + ).output; + const all = new BigNumber(nulsOnNerve) + .plus(nulsOnEth).plus(nulsOnBSC) + .plus(nulsOnOKC).plus(nulsOnHeco); + return { + 'nuls': all.shiftedBy(-8).toFixed(0) + } + } + }, +} +for (const network of Object.keys(getBridgeContract)) { + module.exports[network] = { tvl }; +} + + + diff --git a/projects/nerveswap/index.js b/projects/nerveswap/index.js new file mode 100644 index 00000000000..4adeedc1625 --- /dev/null +++ b/projects/nerveswap/index.js @@ -0,0 +1,17 @@ +const utils = require('../helper/utils'); +const { BigNumber } = require("bignumber.js"); + +async function fetch() { + let total = await utils.fetchURL('https://api.swap.nerve.network/swap/total/info'); + let tvl = new BigNumber(total.data.data.tvl); + tvl = tvl.shiftedBy(-18).toFixed(6); + return tvl; +} + +module.exports = { + methodology: "A NerveDeFi platform that integrates consensus, swap, cross-chain swap,liquidity, farm and cross-chain bridge.", + nuls: { + fetch + }, + fetch +} diff --git a/projects/nest/index.js b/projects/nest/index.js index 55d3165e1d3..a19ee7ba486 100644 --- a/projects/nest/index.js +++ b/projects/nest/index.js @@ -19,7 +19,7 @@ function staking(chain) { .reduce((a, b) => Number(a) + Number(b), 0) }; }; -}; +} function tvl(chain) { return async (timestamp, block, chainBlocks) => { @@ -28,7 +28,7 @@ function tvl(chain) { if (!contracts.tvlContracts.hasOwnProperty([chain])) { return balances; - }; + } await sumTokensSharedOwners( balances, @@ -41,7 +41,7 @@ function tvl(chain) { return balances; }; -}; +} const chainExports = Object.keys(contracts.stakingContracts).reduce((a, chain) => ({ ...a, [chain]: { diff --git a/projects/nested/abi.json b/projects/nested/abi.json index 48018646be5..f708a7c7a15 100644 --- a/projects/nested/abi.json +++ b/projects/nested/abi.json @@ -1,3 +1,3 @@ { - "nestedRecords_getAssetTokens": {"inputs":[{"internalType":"uint256","name":"_nftId","type":"uint256"}],"name":"getAssetTokens","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"} + "nestedRecords_getAssetTokens": "function getAssetTokens(uint256 _nftId) view returns (address[])" } \ No newline at end of file diff --git a/projects/nested/index.js b/projects/nested/index.js index 718659cf008..89045bb4a20 100644 --- a/projects/nested/index.js +++ b/projects/nested/index.js @@ -1,6 +1,16 @@ const sdk = require('@defillama/sdk') -const { get } = require('../helper/http') const {chainExports} = require('../helper/exports') +const { getConfig } = require('../helper/cache') + +let data + +async function getData() { + if (!data) data = _internal() + return data + async function _internal() { + return getConfig('nested', tokens_url) + } +} const tokens_url = 'https://api.nested.finance/tvl-tokens' const nested = { @@ -38,7 +48,7 @@ function chainTvl_onchain(chain) { const transformAddress = (addr) => `${chain}:${addr}` - const tokens_response = await get(tokens_url); + const tokens_response = await getData(); const recordsTokens = tokens_response .filter(t => t.startsWith(nested[chain]['prefix'])) .map(t => t.substring(t.indexOf(':') + 1)) diff --git a/projects/nestfi/index.js b/projects/nestfi/index.js new file mode 100644 index 00000000000..2c3674c5518 --- /dev/null +++ b/projects/nestfi/index.js @@ -0,0 +1,53 @@ +const sdk = require('@defillama/sdk') + +async function bsctvl(timestamp, ethBlock, chainBlocks) { + + const nestVault = '0x65e7506244CDdeFc56cD43dC711470F8B0C43beE'; + const NEST_token = '0x98f8669F6481EbB341B522fCD3663f79A3d1A6A7' + + const strat_bal = ( + await sdk.api.abi.call({ + abi: 'erc20:balanceOf', + target: NEST_token, + params: nestVault, + chain: "bsc", + block: chainBlocks["bsc"], + }) + ).output; + + return { + 'nest': Number(strat_bal) / 1e18 + }; +} + +async function ethtvl(timestamp, ethBlock, chainBlocks) { + + const eth_nestVault = '0x12858F7f24AA830EeAdab2437480277E92B0723a'; + const ETH_NEST_token = '0x04abEdA201850aC0124161F037Efd70c74ddC74C' + + const eth_strat_bal = ( + await sdk.api.abi.call({ + abi: 'erc20:balanceOf', + target: ETH_NEST_token, + params: eth_nestVault, + chain: "ethereum", + block: ethBlock, + }) + ).output; + + return { + 'nest': Number(eth_strat_bal) / 1e18 + }; +} + +module.exports = { + timetravel: true, + misrepresentedTokens: false, + methodology: 'TVL counts NEST tokens used as collateral by the protocol.', + bsc: { + tvl: bsctvl + }, + ethereum: { + tvl: ethtvl + } +} \ No newline at end of file diff --git a/projects/neutra-finance/index.js b/projects/neutra-finance/index.js new file mode 100644 index 00000000000..e97a103fa8a --- /dev/null +++ b/projects/neutra-finance/index.js @@ -0,0 +1,24 @@ +const ADDRESSES = require('../helper/coreAssets.json') + +async function tvl(_, _b, _cb, { api }) { + const nGlpVaults = "0x6Bfa4F1DfAfeb9c37E4E8d436E1d0C5973E47e25"; + const nUSDCVault = "0x2a958665bC9A1680135241133569C7014230Cb21"; + + const nGlpTotalValue = await api.call({ + abi: "uint256:totalValue", + target: nGlpVaults, + }); + const nUSDCTotalValue = await api.call({ + abi: "uint256:totalAssets", + target: nUSDCVault, + }); + + const tvl = +nUSDCTotalValue + nGlpTotalValue / 1e24; + api.add(ADDRESSES.arbitrum.USDC, tvl) +} +module.exports = { + misrepresentedTokens: true, + arbitrum: { + tvl, + }, +}; diff --git a/projects/neutrino/index.js b/projects/neutrino/index.js index f8ea3b6b6a1..2efa357ff40 100644 --- a/projects/neutrino/index.js +++ b/projects/neutrino/index.js @@ -1,8 +1,5 @@ -const { wavesAdapter } = require('../helper/chain/wavesAdapter') +const { wavesExport } = require('../helper/chain/wavesAdapter') -const endpoint = "http://51.158.191.108:8002/api/v1/history/neutrino" +const endpoint = "/neutrino" -module.exports = { - timetravel: false, - waves: { tvl: wavesAdapter(endpoint, item => item.usdnLocked + item.defoLocked) } -} \ No newline at end of file +module.exports = wavesExport(endpoint, item => item.usdnLocked + item.defoLocked) \ No newline at end of file diff --git a/projects/neutroswap/index.js b/projects/neutroswap/index.js new file mode 100644 index 00000000000..f69aaaab853 --- /dev/null +++ b/projects/neutroswap/index.js @@ -0,0 +1,8 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports = { + misrepresentedTokens: true, + eos_evm: { + tvl: getUniTVL({ factory: '0x2140AB15bfdfa3fa1037DB7204a92429f816794D', useDefaultCoreAssets: true, }) + } +} \ No newline at end of file diff --git a/projects/newland/abi.json b/projects/newland/abi.json index cae100cdf11..289d7b84664 100644 --- a/projects/newland/abi.json +++ b/projects/newland/abi.json @@ -1,143 +1,5 @@ { - "poolInfoA": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "poolInfo", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "lpToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "allocPoint", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastRewardBlock", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accHptPerShare", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "miningChefPid", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lpBalance", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accMiningPerShare", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalLPReinvest", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalPoints", - "type": "uint256" - }, - { - "internalType": "contract IStrategyLink", - "name": "strategyLink", - "type": "address" - }, - { - "internalType": "uint256", - "name": "sid", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "mdxPid", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "paused", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - "poolInfoB": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "poolInfo", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "lpToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "allocPoint", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastRewardBlock", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accHptPerShare", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "mdxChefPid", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lpBalance", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accMdxPerShare", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "poolLength": { - "inputs": [], - "name": "poolLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } + "poolInfoA": "function poolInfo(uint256) view returns (address lpToken, uint256 allocPoint, uint256 lastRewardBlock, uint256 accHptPerShare, uint256 miningChefPid, uint256 lpBalance, uint256 accMiningPerShare, uint256 totalLPReinvest, uint256 totalPoints, address strategyLink, uint256 sid, uint256 mdxPid, bool paused)", + "poolInfoB": "function poolInfo(uint256) view returns (address lpToken, uint256 allocPoint, uint256 lastRewardBlock, uint256 accHptPerShare, uint256 mdxChefPid, uint256 lpBalance, uint256 accMdxPerShare)", + "poolLength": "uint256:poolLength" } \ No newline at end of file diff --git a/projects/newland/index.js b/projects/newland/index.js index c3630e26d3a..3f979353ef6 100644 --- a/projects/newland/index.js +++ b/projects/newland/index.js @@ -88,7 +88,6 @@ module.exports = { }, heco: { tvl: hecoTvl, - treasury: Treasury, }, methodology: `We count TVL on the pools (LP tokens), that are staking in other protocolos as Booster, Mdex and Lava on Heco Network and SushiSwap on Ethereum Network,threw their correspondent MasterChef contracts; and Treasury part separated`, diff --git a/projects/newspace/index.js b/projects/newspace/index.js index cf29ae08d6d..c862846b747 100644 --- a/projects/newspace/index.js +++ b/projects/newspace/index.js @@ -3,7 +3,4 @@ const { masterChefExports } = require("../helper/masterchef"); const masterchef = "0x24e5C28c060ae0836e6378FfDa3d0846fee0c56E"; const token = "0xbbdaA8700A7caAAf3b4aAc1fA6Fb5fF76Fc14C56"; -module.exports = { - misrepresentedTokens: true, - ...masterChefExports(masterchef, "bsc", token, false) -} \ No newline at end of file +module.exports = masterChefExports(masterchef, "bsc", token) \ No newline at end of file diff --git a/projects/nex/index.js b/projects/nex/index.js index 05ccbe5e9f9..bf7e93643bb 100644 --- a/projects/nex/index.js +++ b/projects/nex/index.js @@ -2,9 +2,9 @@ const { gmxExports } = require('../helper/gmx') module.exports = { aurora: { - tvl: gmxExports({ chain: 'aurora', vault: '0x5827094484b93989D1B75b12a57989f49e3b88B0', }) + tvl: gmxExports({ vault: '0x5827094484b93989D1B75b12a57989f49e3b88B0', }) }, optimism: { - tvl: gmxExports({ chain: 'optimism', vault: '0x5827094484b93989D1B75b12a57989f49e3b88B0', }) + tvl: gmxExports({ vault: '0x5827094484b93989D1B75b12a57989f49e3b88B0', }) }, } \ No newline at end of file diff --git a/projects/nexo-cex/index.js b/projects/nexo-cex/index.js new file mode 100644 index 00000000000..21d95ab7770 --- /dev/null +++ b/projects/nexo-cex/index.js @@ -0,0 +1,77 @@ +const { cexExports } = require('../helper/cex') + +const config = { + ethereum: { + owners: [ + '0x8fd589aa8bfa402156a6d1ad323fec0ecee50d9d', // NEXO TOKEN + '0xb60c61dbb7456f024f9338c739b02be68e3f545c', + '0x57793e249825492212de2aa4306379017301e1da', // NEXO TOKEN + '0x9bdb521a97e95177bf252c253e256a60c3e14447', // This wallet is also staking 5,134.81 ETH on lido + '0xffec0067f5a79cff07527f63d83dd5462ccf8ba4', + '0x55e4d16f9c3041eff17ca32850662f3e9dddbce7', + '0x7344e478574acbe6dac9de1077430139e17eec3d', // This wallet is also staking 0.32 ETH on lido + Deposited 10.07 BTC into aave and borrow 564,398 REN + '0x6914fc70fac4cab20a8922e900c4ba57feecf8e1', + '0xf36a47300f002c0c9f8c131962f077c3543b2fc6', + '0x7ab6c736baf1dac266aab43884d82974a9adcccf', + '0xa75ede99f376dd47f3993bc77037f61b5737c6ea', + '0x65b0bf8ee4947edd2a500d74e50a3d757dc79de0', + '0x0031e147a79c45f24319dc02ca860cb6142fcba1', + '0x00ee047a66d5cff27587a61559138c26b62f7ceb', + '0x354e9fa5c6ee7e6092158a8c1b203ccac932d66d', + '0xba90b5bc12daab8d06582967a22c86ae7eed0469', + + ], + }, + polygon: { + owners: [ + '0xb60c61dbb7456f024f9338c739b02be68e3f545c', + '0x9bdb521a97e95177bf252c253e256a60c3e14447', + '0x7344e478574acbe6dac9de1077430139e17eec3d', + '0x6914fc70fac4cab20a8922e900c4ba57feecf8e1', + '0x7ab6c736baf1dac266aab43884d82974a9adcccf', + '0xa75ede99f376dd47f3993bc77037f61b5737c6ea', + ] + }, + bsc: { + owners: [ + '0xb60c61dbb7456f024f9338c739b02be68e3f545c', + '0x9bdb521a97e95177bf252c253e256a60c3e14447', + '0x55e4d16f9c3041eff17ca32850662f3e9dddbce7', + '0x7344e478574acbe6dac9de1077430139e17eec3d', + '0x6914fc70fac4cab20a8922e900c4ba57feecf8e1', + '0xf36a47300f002c0c9f8c131962f077c3543b2fc6', + '0x7ab6c736baf1dac266aab43884d82974a9adcccf', + '0xa75ede99f376dd47f3993bc77037f61b5737c6ea', + ] + }, + fantom: { + owners: [ + '0xb60c61dbb7456f024f9338c739b02be68e3f545c', + '0x9bdb521a97e95177bf252c253e256a60c3e14447', + '0x6914fc70fac4cab20a8922e900c4ba57feecf8e1', + '0xa75ede99f376dd47f3993bc77037f61b5737c6ea', + ] + }, + avax: { + owners: [ + '0xb60c61dbb7456f024f9338c739b02be68e3f545c', + '0x9bdb521a97e95177bf252c253e256a60c3e14447', + '0x6914fc70fac4cab20a8922e900c4ba57feecf8e1', + '0xa75ede99f376dd47f3993bc77037f61b5737c6ea', + ] + }, + optimism: { + owners: [ + '0x7344e478574acbe6dac9de1077430139e17eec3d', + '0x6914fc70fac4cab20a8922e900c4ba57feecf8e1', + ] + }, + arbitrum: { + owners: [ + '0x6914fc70fac4cab20a8922e900c4ba57feecf8e1', + ] + } +} + +module.exports = cexExports(config) +module.exports.methodology = 'We are not counting money in defi Protocols. In this case around $1.49m in AAVE (Ethereum and polygon network), around $2.4m into notional (Ethereum network), around $660k into beethoven (Fantom network), around $130k into Harvest (BSC chain). We may also not counting a few small token balances. This data was collected on 14/01/2023 ' \ No newline at end of file diff --git a/projects/nexon/index.js b/projects/nexon/index.js new file mode 100644 index 00000000000..dd0d3c3cbfe --- /dev/null +++ b/projects/nexon/index.js @@ -0,0 +1,14 @@ +const { compoundExports } = require('../helper/compound'); +const { nullAddress } = require('../helper/tokenMapping'); + +module.exports = { + hallmarks: [ + [1690243200, "read-only Reentrancy Attack"] + ], + era: compoundExports('0x0171cA5b372eb510245F5FA214F5582911934b3D', 'era', '0x1BbD33384869b30A323e15868Ce46013C82B86FB', nullAddress, undefined, undefined, { + resolveLPs: true, + abis: { + getReservesABI: 'function getReserves() view returns (uint112 _reserve0, uint112 _reserve1)' + } + }), +}; \ No newline at end of file diff --git a/projects/nexus-protocol/index.js b/projects/nexus-protocol/index.js index 8b8aa2bbc9e..e49f4f3a7c2 100644 --- a/projects/nexus-protocol/index.js +++ b/projects/nexus-protocol/index.js @@ -1,35 +1,8 @@ -const { fetchURL } = require('../helper/utils') - -const vaults = [ - ["https://lcd.terra.dev/wasm/contracts/terra10cxuzggyvvv44magvrh3thpdnk9cmlgk93gmx2/store?query_msg=%7B%22borrower%22:%7B%22address%22:%22terra1tfrecwlvzcv9h697q3g0d08vd53ssu5w4war4n%22%7D%7D", "ethereum"], - ["https://lcd.terra.dev/wasm/contracts/terra1ptjp2vfjrwh0j0faj9r6katm640kgjxnwwq9kn/store?query_msg=%7B%22borrower%22:%7B%22address%22:%22terra1cda4adzngjzcn8quvfu2229s8tedl5t306352x%22%7D%7D", "terra-luna"] -] - -async function tvl() { - const balances = {} - await Promise.all(vaults.map(async vault => { - const deposited = await fetchURL(vault[0]) - balances[vault[1]] = Number(deposited.data.result.balance) / 1e6 - })) - return balances -} - -async function staking() { - const staked = await fetchURL( - `https://lcd.terra.dev/wasm/contracts/terra12897djskt9rge8dtmm86w654g7kzckkd698608/store?query_msg=%7B%22balance%22:%7B%22address%22:%22terra1xrk6v2tfjrhjz2dsfecj40ps7ayanjx970gy0j%22%7D%7D` - ) - // console.log(Number(staked.data.result.balance) / 1e6) - return { - "nexus-governance-token": Number(staked.data.result.balance) / 1e6 - } -} module.exports = { timetravel: false, terra: { - // Token not on coingecko yet - //staking, - tvl + tvl: () => ({}), }, hallmarks:[ [1651881600, "UST depeg"], diff --git a/projects/nexus/index.js b/projects/nexus/index.js index d36acd128fe..4654064dbeb 100644 --- a/projects/nexus/index.js +++ b/projects/nexus/index.js @@ -1,63 +1,22 @@ -/*================================================== - Modules - ==================================================*/ - - const sdk = require('@defillama/sdk'); - - const BigNumber = require('bignumber.js'); - -/*================================================== - Settings - ==================================================*/ - - const pools = [ - '0xcafea35cE5a2fc4CED4464DA4349f81A122fd12b' // current pool - ]; - - const tokensAddresses = [ - '0x6B175474E89094C44Da98b954EedeAC495271d0F', // DAI - '0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84', // stETH - ] - -/*================================================== - TVL - ==================================================*/ - - async function tvl(timestamp, block) { - let balances = {}; - - let calls = []; - - pools.forEach((pool) => { - tokensAddresses.forEach((tokenAddress) => { - calls.push({ - target: tokenAddress, - params: pool - }) - }); - }); - - let balanceOfResults = await sdk.api.abi.multiCall({ - block, - calls, - abi: 'erc20:balanceOf' - }); - - sdk.util.sumMultiBalanceOf(balances, balanceOfResults); - - for(let pool of pools) { - let balance = (await sdk.api.eth.getBalance({target: pool, block})).output; - balances['0x0000000000000000000000000000000000000000'] = BigNumber(balances['0x0000000000000000000000000000000000000000'] || 0).plus(balance).toFixed(); - } - - return balances; - } - -/*================================================== - Exports - ==================================================*/ - - module.exports = { - start: 1558569600, // 05/23/2019 @ 12:00am (UTC) - ethereum: { tvl } - } +const { sumTokens2 } = require('../helper/unwrapLPs'); + +const pools = [ + '0xcafea112Db32436c2390F5EC988f3aDB96870627' // current pool +]; +const yieldPools = [ + '0x27f23c710dd3d878fe9393d93465fed1302f2ebd' +] +const getAssetsABI = "function getAssets() view returns (tuple(address assetAddress, bool isCoverAsset, bool isAbandoned)[])" + +async function tvl(timestamp, block, _, { api }) { + const assets = await api.multiCall({ abi: getAssetsABI, calls: pools}) + const ownerTokens = assets.map((v, i) => [v.map(i => i.assetAddress), pools[i]]) + const assets2 = await api.multiCall({ abi: 'address[]:getTrackedAssets', calls: yieldPools }) + assets2.forEach((v, i) => ownerTokens.push([v, yieldPools[i]])) + return sumTokens2({ api, ownerTokens, blacklistedTokens: yieldPools}) +} + +module.exports = { + start: 1558569600, // 05/23/2019 @ 12:00am (UTC) + ethereum: { tvl } +} diff --git a/projects/nft360/index.js b/projects/nft360/index.js new file mode 100644 index 00000000000..052fe969ec1 --- /dev/null +++ b/projects/nft360/index.js @@ -0,0 +1,15 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require("../helper/unwrapLPs"); + +const token_USDC = ADDRESSES.telos.ETH; +const token_USDT = ADDRESSES.moonriver.USDT; +const masterchef = "0x061362b6c0676fA9995A15D7fFcaef0323A9dF2F"; + +module.exports = { + kava: { + tvl: sumTokensExport({ + owner: masterchef, + tokens: [token_USDC, token_USDT] + }) + } +} diff --git a/projects/nftb/abi.json b/projects/nftb/abi.json index 8ab98d27eb7..f719a4ddfc3 100644 --- a/projects/nftb/abi.json +++ b/projects/nftb/abi.json @@ -1,38 +1,4 @@ { - "getPrice": { - "constant": true, - "inputs": [ - { - "internalType": "address", - "name": "asset", - "type": "address" - } - ], - "name": "getPrice", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "getTotal": { - "constant": true, - "inputs": [], - "name": "getTotalCollateral", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } -} + "getPrice": "function getPrice(address asset) view returns (uint256)", + "getTotal": "uint256:getTotalCollateral" +} \ No newline at end of file diff --git a/projects/nftfi/helper/index.js b/projects/nftfi/helper/index.js deleted file mode 100644 index 3a85875ddc6..00000000000 --- a/projects/nftfi/helper/index.js +++ /dev/null @@ -1,53 +0,0 @@ -const sdk = require("@defillama/sdk"); -const abi = require("../../helper/abis/chainlink.json"); -const { nftPriceFeeds, tokens } = require('../../helper/tokenMapping'); - -// Vaults -const v2 = "0xf896527c49b44aAb3Cf22aE356Fa3AF8E331F280"; -const v2_1 = "0x8252Df1d8b29057d1Afe3062bf5a64D503152BC8"; - -async function getTVL(balances, chain, timestamp, chainBlocks) { - // Get v2 deposited collateral - const { output: v2Positions } = await sdk.api.abi.multiCall({ - calls: nftPriceFeeds[chain].map((priceFeed) => ({ - target: priceFeed.token, params: [v2] - })), - abi: "erc20:balanceOf", - block: chainBlocks[chain], - chain, - }); - - // Get v2_1 deposited collateral - const { output: v21Positions } = await sdk.api.abi.multiCall({ - calls: nftPriceFeeds[chain].map((priceFeed) => ({ - target: priceFeed.token, params: [v2_1] - })), - abi: "erc20:balanceOf", - block: chainBlocks[chain], - chain, - }); - - // Get floor prices from Chainlink feeds - const { output: floorPrices } = await sdk.api.abi.multiCall({ - calls: nftPriceFeeds[chain].map((priceFeed) => ({ - target: priceFeed.oracle, - })), - abi: abi.latestAnswer, - block: chainBlocks[chain], - chain, - }); - - let collateralValueETH = 0; - for (let i = 0; i < v2Positions.length; i++) { - const floorPrice = floorPrices[i].output; - const position = Number(v2Positions[i].output) + Number(v21Positions[i].output); - collateralValueETH += position * floorPrice; - } - - sdk.util.sumSingleBalance(balances, tokens.weth, collateralValueETH); - return balances; -} - -module.exports = { - getTVL, -}; diff --git a/projects/nftfi/index.js b/projects/nftfi/index.js index d4c566cc1b2..503072f83de 100644 --- a/projects/nftfi/index.js +++ b/projects/nftfi/index.js @@ -1,15 +1,15 @@ -const { getTVL } = require("./helper/index"); +const { sumTokensExport, } = require('../helper/unwrapLPs'); -async function tvl(timestamp, block, chainBlocks) { - const balances = {}; - await getTVL(balances, "ethereum", timestamp, chainBlocks); - return balances; -} +// Vaults +const v2 = "0xf896527c49b44aAb3Cf22aE356Fa3AF8E331F280"; +const v2_1 = "0x8252Df1d8b29057d1Afe3062bf5a64D503152BC8"; +const offers_ADDR = "0xe52cec0e90115abeb3304baa36bc2655731f7934"; +const bundles = "0x16c583748faed1c5a5bcd744b4892ee6b6290094"; module.exports = { misrepresentedTokens: true, - methodology: `Counts the floor value of all deposited NFTs with Chainlink price feeds`, + methodology: `Counts the floor value of all deposited NFTs with Chainlink price feeds. Borrowed coins are not counted towards the TVL`, ethereum: { - tvl, + tvl: sumTokensExport({ owners: [v2, v2_1, offers_ADDR, bundles], resolveNFTs: true, }), } } diff --git a/projects/nftperp/index.js b/projects/nftperp/index.js new file mode 100644 index 00000000000..cccf4948fbe --- /dev/null +++ b/projects/nftperp/index.js @@ -0,0 +1,18 @@ +const ADDRESSES = require('../helper/coreAssets.json'); +const { sumTokensExport } = require('../helper/sumTokens'); + +module.exports = { + arbitrum: { + tvl: sumTokensExport({ + tokensAndOwners: [ + // DEX + [ADDRESSES.arbitrum.WETH, '0x6fc05B7DFe545cd488E9D47d56CFaCA88F69A2e1'], + // Insurance fund + [ADDRESSES.arbitrum.WETH, '0x035E4480437002A30b61Df6788DFb6199c2C5210'], + ] + }) + }, + hallmarks: [ + [1688695200, "v1 shutdown"], + ], +}; diff --git a/projects/nftx/abi.json b/projects/nftx/abi.json index cd6ecc6d1c5..7f775aa36c3 100644 --- a/projects/nftx/abi.json +++ b/projects/nftx/abi.json @@ -1,34 +1,4 @@ { - "vaultsLength": { - "inputs": [], - "name": "vaultsLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "xToken": { - "inputs": [ - { - "internalType": "uint256", - "name": "vaultId", - "type": "uint256" - } - ], - "name": "xToken", - "outputs": [ - { - "internalType": "contract IXToken", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } + "vaultsLength": "uint256:vaultsLength", + "xToken": "function xToken(uint256 vaultId) view returns (address)" } \ No newline at end of file diff --git a/projects/nftx/index.js b/projects/nftx/index.js index ad35b21dd74..49cdb513664 100644 --- a/projects/nftx/index.js +++ b/projects/nftx/index.js @@ -1,25 +1,25 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { gql } = require("graphql-request"); -const { blockQuery } = require('../helper/graph') +const { blockQuery } = require('../helper/http') const { getTokenPrices } = require('../helper/unknownTokens') const sdk = require('@defillama/sdk') const { getChainTransform } = require('../helper/portedTokens') -const { getBlock } = require('../helper/getBlock') const config = { ethereum: { - weth: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', - graphUrl: 'https://graph-proxy.nftx.xyz/c/gateway/api/690cf8d6987a151008c2536454bd3d7a/subgraphs/id/4gZf3atMXjYDh4g48Zr83NFX3rkvZED86VqMNhgEXgLc' + weth: ADDRESSES.ethereum.WETH, + graphUrl: 'https://graph-proxy.nftx.xyz/c/shared/subgraphs/name/nftx-project/nftx-v2-1-mainnet' }, arbitrum: { - weth: '0x82aF49447D8a07e3bd95BD0d56f35241523fBab1', + weth: ADDRESSES.arbitrum.WETH, graphUrl: 'https://graph-proxy.nftx.xyz/shared/subgraphs/name/nftx-project/nftx-v2-arbitrum' }, } function getTvl(chain) { const { weth, graphUrl } = config[chain] - return async (timestamp, _, cb) => { - const block = await getBlock(timestamp, chain, cb) - const { vaults } = await blockQuery(graphUrl, graphQuery, block, 500) + return async (timestamp, _, cb, { api }) => { + const { vaults } = await blockQuery(graphUrl, graphQuery, { api }) + const block = api.block const LPs = new Set(vaults.map(v => v.lpStakingPool.stakingToken.id)) const tokens = new Set(vaults.map(v => v.token.id)) const transform = await getChainTransform(chain) diff --git a/projects/nidhi-dao/index.js b/projects/nidhi-dao/index.js index 7551f9f4e76..070848b6ef6 100644 --- a/projects/nidhi-dao/index.js +++ b/projects/nidhi-dao/index.js @@ -1,15 +1,9 @@ -const { ohmTvl } = require('../helper/ohm') - -const token = "0x057E0bd9B797f9Eeeb8307B35DbC8c12E534c41E"; -const stakingContract = "0x4Eef9cb4D2DA4AB2A76a4477E9d2b07f403f0675"; -const treasury = "0x05d0a05c1fd3a00ca1fc7a4a7321552c0dd80521"; - -const treasuryContracts = [ - ["0x8f3cf7ad23cd3cadbd9735aff958023239c6a063", false], // DAI - ["0x7c9B16d845FE163F464d265193cC2B4eE3faC326", true] // GURU-DAI SLP -] - module.exports = { - deadFrom: 1648765747, - ...ohmTvl(treasury, treasuryContracts, "polygon", stakingContract, token) + hallmarks: [ + [1651320000, "NidhiDAO/TangibleDAO Merge"] //https://twitter.com/tangibleDAO/status/1520512970962313216 + ], + deadFrom: 1648765747, + polygon: { + tvl: () => 0 + } } diff --git a/projects/nightmare/index.js b/projects/nightmare/index.js index 3d477c96ed6..be948559b7f 100644 --- a/projects/nightmare/index.js +++ b/projects/nightmare/index.js @@ -19,6 +19,9 @@ async function tvl(timestamp, block, chainBlocks) { module.exports = { methodology: "TVL includes all farms in MasterChef contract", + hallmarks: [ + [1646179200, "Rug Pull"] + ], fantom: { tvl, staking: staking(fearchef, fear, "fantom"), diff --git a/projects/nirvana/index.js b/projects/nirvana/index.js index 19578c5f612..e8a081314d5 100644 --- a/projects/nirvana/index.js +++ b/projects/nirvana/index.js @@ -14,6 +14,9 @@ async function tvl() { } module.exports = { + hallmarks: [ + [1659009600,"Flash-Loan & Price Manipulation Attack"] + ], timetravel: false, methodology: "The total value of ANA tokens locked in the protocol, either as staking or as collateral for loans.", diff --git a/projects/nitron/index.js b/projects/nitron/index.js new file mode 100644 index 00000000000..9bb2a6852c8 --- /dev/null +++ b/projects/nitron/index.js @@ -0,0 +1,64 @@ +const { get } = require("../helper/http") +const sdk = require('@defillama/sdk') +const { default: axios } = require('axios'); +const BigNumber = require('bignumber.js') + +async function getTotalSupplied() { + const modAddress = 'swth1wq9ts6l7atfn45ryxrtg4a2gwegsh3xh7w83xl' + const debtInfos = (await axios.get('https://api.carbon.network/carbon/cdp/v1/token_debt')).data.debt_infos_all + const modBalances = (await axios.get(`https://api.carbon.network/carbon/coin/v1/balances/${modAddress}`)).data.token_balances + const allAssets = [] + for (const debt of debtInfos){ + const {denom,total_principal} = debt + const modBalance = new BigNumber((modBalances.find((o) => o.denom === denom))?.available ?? 0) + const totalPrincipal = new BigNumber(total_principal ?? 0) + allAssets.push({ denom, amount: modBalance.plus(totalPrincipal).toNumber()}) + } + return allAssets +} + +async function getTokenInfo() { + const { result: { gecko } } = await get('https://api-insights.carbon.network/info/denom_gecko_map') + const tokenMap = {} + let skip = 0 + let data + const size = 100 + const url = () => `https://api.carbon.network/carbon/coin/v1/tokens?pagination.limit=${size}&pagination.offset=${skip}` + do { + data = await get(url()) + skip += size + for (const token of data.tokens) { + const denom = token.denom + if (!gecko[denom]) continue; + token.geckoId = gecko[token.denom] + tokenMap[denom] = token + } + } while (data.tokens.length) + return tokenMap +} + +async function tvl() { + const balances = {} + const [tokenData, assets] = await Promise.all([ + getTokenInfo(), + getTotalSupplied() + ]) + + for(const {denom, amount} of assets) { + if (tokenData[denom]) { + addBalance(denom, amount) + } + } + return balances + + function addBalance(id, amount) { + sdk.util.sumSingleBalance(balances, tokenData[id].geckoId, amount / (10 ** +tokenData[id].decimals)) + } +} + +module.exports = { + timetravel: false, + carbon: { + tvl + } +} \ No newline at end of file diff --git a/projects/noahark/index.js b/projects/noahark/index.js new file mode 100644 index 00000000000..c940cf35885 --- /dev/null +++ b/projects/noahark/index.js @@ -0,0 +1,8 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports = { + misrepresentedTokens: true, + eos_evm: { + tvl: getUniTVL({ factory: '0x75782A57c6522B8B17FCc01Ff11759f4535b2752', useDefaultCoreAssets: true, }) + } +} \ No newline at end of file diff --git a/projects/noaharkdao/index.js b/projects/noaharkdao/index.js index da7c7ce04c3..5296523773e 100644 --- a/projects/noaharkdao/index.js +++ b/projects/noaharkdao/index.js @@ -1,10 +1,11 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { ohmTvl } = require("../helper/ohm"); const nrk = "0x61a47034276eb993e1c5e67bf1375ad0a48f10f6"; const stakingContract = "0xe830a08D4A794DEDB03A0B46cA7BBC8468ADc47B"; const treasury = "0x64E5dd04123BFF64a9eD7fe5b902720E63C422F0"; const treasuryTokens = [ - ["0xd586e7f844cea2f87f50152665bcbc2c279d8d70", false], // DAI + [ADDRESSES.avax.DAI, false], // DAI ["0x790c840b774d8f02ebdad9ddb74331614b535cef", true] // NRK-DAI SLP ] diff --git a/projects/node-dao/index.js b/projects/node-dao/index.js new file mode 100644 index 00000000000..e19286cb848 --- /dev/null +++ b/projects/node-dao/index.js @@ -0,0 +1,33 @@ +const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') + +module.exports = { + ethereum: { + tvl: async (_, _1, _2, { api }) => { + // nodeDAO v0 validator nft + const nodeDaoV0ValidatorNFT = '0x40Cd77D9aa9e0b2D485259415eA05486B201c514' + const v0VdalitorsNumber = await api.call({ abi: 'uint256:totalSupply', target: nodeDaoV0ValidatorNFT }) + + // nodeDAO liquidStaking + const nodeDaoLiquidStaking = '0x8103151E2377e78C04a3d2564e20542680ed3096' + const nethTVL = await api.call({ abi: 'uint256:getTotalEthValue', target: nodeDaoLiquidStaking }) + + // nodeDAO v1 validator nft + const nodeDaoV1ValidatorNFT = '0x58553F5c5a6AEE89EaBFd42c231A18aB0872700d' + const v1Vdalitors = await api.call({ abi: 'uint256[]:activeNftsOfUser', target: nodeDaoV1ValidatorNFT }) + + // nodeDAO totalEth = nethTVL + (v1ValidatorNumber + v0VdalitorsNumber)* 32 eth + let totalEth = parseInt(nethTVL) + (v1Vdalitors.length + parseInt(v0VdalitorsNumber)) * 32_000_000_000_000_000_000 + + // nodeDAO largeStaking + const nodeDaoLargeStaking = '0xBBd19e8F766Dcc94D50e47502b79C81cdaD484B8' + const nodeOperatorRegistry = '0x8742178Ac172eC7235E54808d5F327C30A51c492' + const operatorNumbers = await api.call({ abi: 'uint256:getNodeOperatorsCount', target: nodeOperatorRegistry }) + for (let i = 1; i <= operatorNumbers; i++) { + const validatorNumbers = await api.call({ abi: 'function getOperatorValidatorCounts(uint256 _operatorId) external view returns (uint256)', target: nodeDaoLargeStaking, params: [i] }) + totalEth += parseInt(validatorNumbers) * 32_000_000_000_000_000_000 + } + + api.add(nullAddress, totalEth) + } + } +} diff --git a/projects/nodoka/index.js b/projects/nodoka/index.js index 10836efa894..f05d471f2a8 100644 --- a/projects/nodoka/index.js +++ b/projects/nodoka/index.js @@ -1,5 +1,4 @@ const sdk = require("@defillama/sdk"); -const uniswapV3abi = require("./uniswapV3.json"); const BigNumber = require("bignumber.js"); @@ -24,7 +23,7 @@ async function getNethPrice(block) { const { output: slot0 } = await sdk.api.abi.call({ block, target: nethPool, - abi: uniswapV3abi.find(i => i.name === 'slot0') + abi: 'function slot0() view returns (uint160 sqrtPriceX96, int24 tick, uint16 observationIndex, uint16 observationCardinality, uint16 observationCardinalityNext, uint8 feeProtocol, bool unlocked)' }) const priceSqrt = new BigNumber(slot0[0]); const nethPriceInEth = (priceSqrt * priceSqrt) / 2 ** 192; diff --git a/projects/nodoka/uniswapV3.json b/projects/nodoka/uniswapV3.json deleted file mode 100644 index c68e353be2a..00000000000 --- a/projects/nodoka/uniswapV3.json +++ /dev/null @@ -1,27 +0,0 @@ -[{ - "inputs": [], - "name": "slot0", - "outputs": [ - { "internalType": "uint160", "name": "sqrtPriceX96", "type": "uint160" }, - { "internalType": "int24", "name": "tick", "type": "int24" }, - { - "internalType": "uint16", - "name": "observationIndex", - "type": "uint16" - }, - { - "internalType": "uint16", - "name": "observationCardinality", - "type": "uint16" - }, - { - "internalType": "uint16", - "name": "observationCardinalityNext", - "type": "uint16" - }, - { "internalType": "uint8", "name": "feeProtocol", "type": "uint8" }, - { "internalType": "bool", "name": "unlocked", "type": "bool" } - ], - "stateMutability": "view", - "type": "function" -}] \ No newline at end of file diff --git a/projects/nomad/index.js b/projects/nomad/index.js index c2c23909ed6..6639c25b3ab 100644 --- a/projects/nomad/index.js +++ b/projects/nomad/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') // proxy contract: // https://github.com/nomad-xyz/config/blob/main/production.json // token holdings: @@ -15,32 +16,26 @@ const HOME_CHAINS = { const TOKEN_ADDRESSES = [ { - // FRAX - 'ethereum': '0x853d955aCEf822Db058eb8505911ED77F175b99e' + 'ethereum': ADDRESSES.ethereum.FRAX }, { - // USDC - 'ethereum': '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48' + 'ethereum': ADDRESSES.ethereum.USDC }, { - // DAI - 'ethereum': '0x6B175474E89094C44Da98b954EedeAC495271d0F' + 'ethereum': ADDRESSES.ethereum.DAI }, { - // USDT - 'ethereum': '0xdAC17F958D2ee523a2206206994597C13D831ec7' + 'ethereum': ADDRESSES.ethereum.USDT }, { // FXS 'ethereum': '0x3432B6A60D23Ca0dFCa7761B7ab56459D9C964D0' }, { - // WETH - 'ethereum': '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2' + 'ethereum': ADDRESSES.ethereum.WETH }, { - // WBTC - 'ethereum': '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599' + 'ethereum': ADDRESSES.ethereum.WBTC }, { // IAG diff --git a/projects/nomiswap/index.js b/projects/nomiswap/index.js index fc629b62b21..282a7c3f243 100644 --- a/projects/nomiswap/index.js +++ b/projects/nomiswap/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { getUniTVL } = require("../helper/unknownTokens"); const { stakings } = require("../helper/staking"); const sdk = require('@defillama/sdk') @@ -6,11 +7,10 @@ const constantProductFactory = "0xd6715A8be3944ec72738F0BFDC739d48C3c29349"; const stableSwapFactory = "0xC6B7ee49D386bAe4FD501F2d2f8d18828F1f6285"; const factories = [constantProductFactory, stableSwapFactory].map(factory => getUniTVL({ factory, - chain: 'bsc', useDefaultCoreAssets: true })) -const NMX = "0xd32d01a43c869edcd1117c640fbdcfcfd97d9d65" +const NMX = ADDRESSES.bsc.NMX const stakingPools = [ // Staking pool diff --git a/projects/nord-finance/config.js b/projects/nord-finance/config.js index 72fc02a5eef..970fe08f0fd 100644 --- a/projects/nord-finance/config.js +++ b/projects/nord-finance/config.js @@ -1,16 +1,17 @@ +const ADDRESSES = require('../helper/coreAssets.json') module.exports = { ethereum: { toa: [ - ['0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', '0x53E1c9750014C7Cf8303D69A3CA06A555C739DD0'], - ['0xdAC17F958D2ee523a2206206994597C13D831ec7', '0xCD4F2844b11A4515398fD2201247Cf2ed411245f'], - ['0x6B175474E89094C44Da98b954EedeAC495271d0F', '0x6Db6ABb2a55154C385e90d3fD05EE8ca46e3BA35'], - ['0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', '0xD824fDFEdbE9b99F0B27e911Ad963Ec4544dF2Dc'], - ['0x2260fac5e5542a773aa44fbcfedf7c193bc2c599', '0xD824fDFEdbE9b99F0B27e911Ad963Ec4544dF2Dc'], - ['0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', '0xD824fDFEdbE9b99F0B27e911Ad963Ec4544dF2Dc'], - ['0x1f9840a85d5af5bf1d1762f925bdaddc4201f984', '0xD824fDFEdbE9b99F0B27e911Ad963Ec4544dF2Dc'], - ['0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9', '0xD824fDFEdbE9b99F0B27e911Ad963Ec4544dF2Dc'], - ['0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0', '0xD824fDFEdbE9b99F0B27e911Ad963Ec4544dF2Dc'], - ['0xd533a949740bb3306d119cc777fa900ba034cd52', '0xD824fDFEdbE9b99F0B27e911Ad963Ec4544dF2Dc'], + [ADDRESSES.ethereum.USDC, '0x53E1c9750014C7Cf8303D69A3CA06A555C739DD0'], + [ADDRESSES.ethereum.USDT, '0xCD4F2844b11A4515398fD2201247Cf2ed411245f'], + [ADDRESSES.ethereum.DAI, '0x6Db6ABb2a55154C385e90d3fD05EE8ca46e3BA35'], + [ADDRESSES.ethereum.USDC, '0xD824fDFEdbE9b99F0B27e911Ad963Ec4544dF2Dc'], + [ADDRESSES.ethereum.WBTC, '0xD824fDFEdbE9b99F0B27e911Ad963Ec4544dF2Dc'], + [ADDRESSES.ethereum.WETH, '0xD824fDFEdbE9b99F0B27e911Ad963Ec4544dF2Dc'], + [ADDRESSES.ethereum.UNI, '0xD824fDFEdbE9b99F0B27e911Ad963Ec4544dF2Dc'], + [ADDRESSES.ethereum.AAVE, '0xD824fDFEdbE9b99F0B27e911Ad963Ec4544dF2Dc'], + [ADDRESSES.ethereum.MATIC, '0xD824fDFEdbE9b99F0B27e911Ad963Ec4544dF2Dc'], + [ADDRESSES.ethereum.CRV, '0xD824fDFEdbE9b99F0B27e911Ad963Ec4544dF2Dc'], ], staking: [ ['0x6e9730ecffbed43fd876a264c982e254ef05a0de', '0x2b9a023415f0feeb88597c1a7d09fdefa0ef5614'], @@ -21,16 +22,16 @@ module.exports = { }, polygon: { toa: [ - ['0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174', '0x8a5Ae804Da4924081663D4C5DaB4DC9BB7092E2E'], - ['0xc2132D05D31c914a87C6611C10748AEb04B58e8F', '0xa4dbb459fb9051b976947d2d8ab74477e1720a73'], - ['0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063', '0xeE2dEf710a8a0021DCbF99C4cD7f69Dc536fc57b'], - ['0x1bfd67037b42cf73acf2047067bd4f2c47d9bfd6', '0x014fD6Db604b55eF900704ed5c25F9Ef61e8B225'], - ['0x7ceb23fd6bc0add59e62ac25578270cff1b9f619', '0x014fD6Db604b55eF900704ed5c25F9Ef61e8B225'], + [ADDRESSES.polygon.USDC, '0x8a5Ae804Da4924081663D4C5DaB4DC9BB7092E2E'], + [ADDRESSES.polygon.USDT, '0xa4dbb459fb9051b976947d2d8ab74477e1720a73'], + [ADDRESSES.polygon.DAI, '0xeE2dEf710a8a0021DCbF99C4cD7f69Dc536fc57b'], + [ADDRESSES.polygon.WBTC, '0x014fD6Db604b55eF900704ed5c25F9Ef61e8B225'], + [ADDRESSES.polygon.WETH_1, '0x014fD6Db604b55eF900704ed5c25F9Ef61e8B225'], ['0x53e0bca35ec356bd5dddfebbd1fc0fd03fabad39', '0x014fD6Db604b55eF900704ed5c25F9Ef61e8B225'], ['0xb33eaad8d922b1083446dc23f610c2567fb5180f', '0x014fD6Db604b55eF900704ed5c25F9Ef61e8B225'], ['0xd6df932a45c0f255f85145f286ea0b292b21c90b', '0x014fD6Db604b55eF900704ed5c25F9Ef61e8B225'], - ['0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270', '0x014fD6Db604b55eF900704ed5c25F9Ef61e8B225'], - ['0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174', '0x014fD6Db604b55eF900704ed5c25F9Ef61e8B225'], + [ADDRESSES.polygon.WMATIC_2, '0x014fD6Db604b55eF900704ed5c25F9Ef61e8B225'], + [ADDRESSES.polygon.USDC, '0x014fD6Db604b55eF900704ed5c25F9Ef61e8B225'], ], staking: [ ['0xf6f85b3f9fd581c2ee717c404f7684486f057f95', '0xf0882a08D855ec8Ad3f25087dE3FB311A5344b20'], @@ -39,9 +40,9 @@ module.exports = { }, avax: { toa: [ - ['0xA7D7079b0FEaD91F3e65f86E8915Cb59c1a4C664', '0xAA1110b6A39647f93dfBbc6345216912E1dee6FF'], - ['0xc7198437980c041c805A1EDcbA50c1Ce5db95118', '0xFbb37792f98fd57AC1f2f20b151e2db5cceF7F11'], - ['0xd586E7F844cEa2F87f50152665BCbc2C279D8d70', '0xaF3745feCEe0a79c5F19991291Cd60B716C4F698'], + [ADDRESSES.avax.USDC_e, '0xAA1110b6A39647f93dfBbc6345216912E1dee6FF'], + [ADDRESSES.avax.USDT_e, '0xFbb37792f98fd57AC1f2f20b151e2db5cceF7F11'], + [ADDRESSES.avax.DAI, '0xaF3745feCEe0a79c5F19991291Cd60B716C4F698'], ], staking: [ ['0x8965349fb649a33a30cbfda057d8ec2c48abe2a2', '0x1929aED2175688252C9388df11B162F7303ff926'], diff --git a/projects/northpole/abi.json b/projects/northpole/abi.json index f3b5607596e..11f18e61dd4 100644 --- a/projects/northpole/abi.json +++ b/projects/northpole/abi.json @@ -1,15 +1,3 @@ { - "totalTVL": { - "inputs": [], - "name": "totalTVL", - "outputs": [ - { - "internalType": "uint256", - "name": "tvl", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -} + "totalTVL": "uint256:totalTVL" +} \ No newline at end of file diff --git a/projects/northpole/index.js b/projects/northpole/index.js index 22b7b93215e..cf9a40dbba2 100644 --- a/projects/northpole/index.js +++ b/projects/northpole/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk'); const abi = require('./abi.json') @@ -15,7 +16,7 @@ async function tvl(timestamp, ethBlock, chainBlocks) { })).output.map(t => t.output); return { - "0xdac17f958d2ee523a2206206994597c13d831ec7": Number(tvl) / 10 ** 12 + [ADDRESSES.ethereum.USDT]: Number(tvl) / 10 ** 12 } } diff --git a/projects/nostra/abi.js b/projects/nostra/abi.js new file mode 100644 index 00000000000..88aff8c79c4 --- /dev/null +++ b/projects/nostra/abi.js @@ -0,0 +1,33 @@ +const assetToken = [ + { + "name": "underlyingAsset", + "type": "function", + "inputs": [], + "outputs": [ + { + "name": "_underlyingAsset", + "type": "felt" + } + ], + "stateMutability": "view" + }, + { + "name": "totalSupply", + "type": "function", + "inputs": [], + "outputs": [ + { + "name": "totalSupply", + "type": "Uint256" + } + ], + "stateMutability": "view" + } +] + +const assetTokenAbi = {} +assetToken.forEach(i => assetTokenAbi[i.name] = i) + +module.exports = { + assetTokenAbi +} \ No newline at end of file diff --git a/projects/nostra/index.js b/projects/nostra/index.js new file mode 100644 index 00000000000..e303062bcfd --- /dev/null +++ b/projects/nostra/index.js @@ -0,0 +1,32 @@ +const { multiCall, parseAddress, sumTokens, } = require('../helper/chain/starknet') +const { assetTokenAbi } = require('./abi'); + +const vault = '0x03d39f7248fb2bfb960275746470f7fb470317350ad8656249ec66067559e892' +const debtTokens = [ + '0x075b0d87aca8dee25df35cdc39a82b406168fa23a76fc3f03abbfdc6620bb6d7', + '0x040b091cb020d91f4a4b34396946b4d4e2a450dbd9410432ebdbfe10e55ee5e5', + '0x03b6058a9f6029b519bc72b2cc31bcb93ca704d0ab79fec2ae5d43f79ac07f7a', + '0x0362b4455f5f4cc108a5a1ab1fd2cc6c4f0c70597abb541a99cf2734435ec9cb', + '0x065c6c7119b738247583286021ea05acc6417aa86d391dcdda21843c1fc6e9c6', +] + +async function tvl(_, _1, _2, { api }) { + let underlyings = await multiCall({ calls: debtTokens, abi: assetTokenAbi.underlyingAsset }) + underlyings = underlyings.map(parseAddress) + return sumTokens({ api, owner: vault, tokens: underlyings}) +} + +async function borrowed(_, _1, _2, { api }) { + let data = await multiCall({ calls: debtTokens, abi: assetTokenAbi.totalSupply }); + let underlyings = await multiCall({ calls: debtTokens, abi: assetTokenAbi.underlyingAsset }) + underlyings = underlyings.map(parseAddress) + data = data.map(i => +i) + api.addTokens(underlyings, data) +} + +module.exports = { + methodology: 'Sums the circulating supply of each Nostra Asset Token.', + starknet: { + tvl, borrowed, + } +}; diff --git a/projects/notiboy/index.js b/projects/notiboy/index.js new file mode 100644 index 00000000000..8713e8847b8 --- /dev/null +++ b/projects/notiboy/index.js @@ -0,0 +1,6 @@ +module.exports = { + timetravel: false, + algorand: { + tvl: () => 0 + } +} diff --git a/projects/notional/abi.json b/projects/notional/abi.json index cbe2fa7c97c..4c5e817c6b9 100644 --- a/projects/notional/abi.json +++ b/projects/notional/abi.json @@ -1,34 +1,4 @@ { - "maxCurrencyId": { - "inputs": [], - "name": "maxCurrencyId", - "outputs": [ - { - "internalType": "uint16", - "name": "", - "type": "uint16" - } - ], - "stateMutability": "view", - "type": "function" - }, - "currencyIdToAddress": { - "inputs": [ - { - "internalType": "uint16", - "name": "", - "type": "uint16" - } - ], - "name": "currencyIdToAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } + "getMaxCurrencyId": "function getMaxCurrencyId() view returns (uint16)", + "getCurrency": "function getCurrency(uint16) view returns ((address,bool,int256,uint8,uint256),(address,bool,int256,uint8,uint256))" } \ No newline at end of file diff --git a/projects/notional/index.js b/projects/notional/index.js index 9b254b23e7a..fbff298d43e 100644 --- a/projects/notional/index.js +++ b/projects/notional/index.js @@ -1,61 +1,21 @@ +const { sumTokens2 } = require('../helper/unwrapLPs'); const abi = require('./abi'); -const sdk = require('@defillama/sdk'); -const { sumTokensAndLPsSharedOwners } = require('../helper/unwrapLPs'); -const escrowContract = '0x9abd0b8868546105F6F48298eaDC1D9c82f7f683'; const v2Contract = "0x1344A36A1B56144C3Bc62E7757377D288fDE0369" -async function tvl (timestamp, block) { - const maxCurrencyId = (await sdk.api.abi.call({ - block, - target: escrowContract, - abi: abi['maxCurrencyId'] - })).output; - - const addressCalls = [] - for (let i = 0; i <= maxCurrencyId; i++) { - addressCalls.push({ - target: escrowContract, - params: i - }) - } - - const supportedTokens = (await sdk.api.abi.multiCall({ - calls: addressCalls, - target: escrowContract, - abi: abi['currencyIdToAddress'], - block, - })).output - - const balanceCalls = supportedTokens.map((s) => { - return { - target: s.output, - params: escrowContract - } - }) - - const balances = (await sdk.api.abi.multiCall({ - calls: balanceCalls, - abi: 'erc20:balanceOf', - block - })).output - - const balanceMap = balances.reduce((obj, b) => { - obj[b.input.target] = b.output - return obj - }, {}) - - await sumTokensAndLPsSharedOwners(balanceMap, [ - "0x39aa39c021dfbae8fac545936693ac917d5e7563", - "0x5d3a536E4D6DbD6114cc1Ead35777bAB948E3643", - "0x4ddc2d193948926d02f9b1fe9e1daa0718270ed5", - "0xccf4429db6322d5c611ee964527d42e5d685dd6a" - ].map(a=>[a, false]), [v2Contract], block) - - return balanceMap +async function tvl(timestamp, block, _, { api }) { + let tokens = await api.fetchList({ lengthAbi: abi.getMaxCurrencyId, itemAbi: abi.getCurrency, target: v2Contract, startFromOne: true, }) + tokens = tokens.flat().map(i => i[0]) + const tokenNames = await api.multiCall({ abi: 'string:name', calls: tokens, permitFailure: true, }) + const nwTokens = tokens.filter((v, i) => tokenNames[i] && tokenNames[i].startsWith('Notional Wrapped')) + let nwBals = await api.multiCall({ abi: 'erc20:balanceOf', calls: nwTokens.map(i => ({ target: i, params: v2Contract}))}) + const underlyingTokens = await api.multiCall({ abi: 'address:underlying', calls: nwTokens}) + const exchangeRate = await api.multiCall({ abi: 'uint256:getExchangeRateView', calls: nwTokens}) + nwBals = nwBals.map((bal, i) => bal * (exchangeRate[i]/1e18)) + api.addTokens(underlyingTokens, nwBals) + return sumTokens2({ api, owner: v2Contract, tokens, blacklistedTokens: nwTokens }) } - module.exports = { - //start: 1602115200, // Oct-08-2020 12:00:00 AM +UTC - ethereum: { tvl }, - }; \ No newline at end of file +module.exports = { + ethereum: { tvl }, +}; \ No newline at end of file diff --git a/projects/nowswap/index.js b/projects/nowswap/index.js index 4abd3c9b932..19957883cfa 100644 --- a/projects/nowswap/index.js +++ b/projects/nowswap/index.js @@ -2,6 +2,9 @@ const { getUniTVL } = require('../helper/unknownTokens') module.exports = { + hallmarks: [ + [1631664000, "Hacked"] + ], ethereum: { tvl: getUniTVL({ factory: '0xa556E2d77060A42516C9A8002E9156d8d3c832CE', diff --git a/projects/nsure/abi.json b/projects/nsure/abi.json index fa644c02675..5a9ba21a185 100644 --- a/projects/nsure/abi.json +++ b/projects/nsure/abi.json @@ -1,49 +1,6 @@ { - "totalPledge": { - "inputs": [], - "name": "totalPledge", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - "totalStake": { - "inputs": [], - "name": "totalStake", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - "totalSupply": { - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "balanceOf": { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } - -} + "totalPledge": "uint256:totalPledge", + "totalStake": "uint256:totalStake", + "totalSupply": "uint256:totalSupply", + "balanceOf": "function balanceOf(address account) view returns (uint256)" +} \ No newline at end of file diff --git a/projects/nsure/index.js b/projects/nsure/index.js index e3037a33d1e..7c2172a23d5 100644 --- a/projects/nsure/index.js +++ b/projects/nsure/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); @@ -22,7 +23,7 @@ const constant = { }; async function purchase(block) { - let weth = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'; + let weth = ADDRESSES.ethereum.WETH; let _purchasePool; const [surplus, treasury] = await Promise.all([ sdk.api.abi.call({ @@ -62,7 +63,7 @@ async function underwriting(block) { async function startEth(block) { let capitalAddr = '0xa6b658Ce4b1CDb4E7d8f97dFFB549B8688CAFb84' - let ethAddr = '0x0000000000000000000000000000000000000000' + let ethAddr = ADDRESSES.null let trueBalance = 0; let _ethBalance = await sdk.api.eth.getBalance({ target: capitalAddr, block: block }); diff --git a/projects/nucleon/index.js b/projects/nucleon/index.js new file mode 100644 index 00000000000..2c2f51f4a5e --- /dev/null +++ b/projects/nucleon/index.js @@ -0,0 +1,23 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport, } = require("../helper/unknownTokens"); + +const MasterchefV2 = "0xeced26633b5c2d7124b5eae794c9c32a8b8e7df2"; +// const NUT_TokenAddress = "0xfe197e7968807b311d476915db585831b43a7e3b"; +const XCFX_TokenAddress = "0x889138644274a7dc602f25a7e7d53ff40e6d0091"; + +const CFX_NUT_LP_TokenAddress = "0xd9d5748cb36a81fe58f91844f4a0412502fd3105"; +const CFX_XCFX_LP_TokenAddress = "0x949b78ef2c8d6979098e195b08f27ff99cb20448"; + +const WCFX = ADDRESSES.conflux.WCFX; + +module.exports = { + conflux: { + tvl: async (_, _1, _2, { api }) => { + const [exchangeRate] = await api.call({ target: '0x808f81acc4618a05c8253a7b41240468c08cd64c', abi: 'function XCFX_burn_estim(uint256) returns (uint256,uint256)', params: 1e18 +''}) + return { + ['conflux:' + WCFX]: (await api.call({ target: XCFX_TokenAddress, abi: 'erc20:totalSupply' })) * exchangeRate / 1e18 + } + }, + pool2: sumTokensExport({ owner: MasterchefV2, coreAssets: [WCFX], tokens: [CFX_NUT_LP_TokenAddress, CFX_XCFX_LP_TokenAddress] }), + } +} \ No newline at end of file diff --git a/projects/numisme/abi.json b/projects/numisme/abi.json index 9c317e6f50a..cff0f3ec672 100644 --- a/projects/numisme/abi.json +++ b/projects/numisme/abi.json @@ -1,56 +1,6 @@ { - "token": { - "inputs": [], - "name": "token", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "vaultToken": { - "inputs": [], - "name": "vaultToken", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "get_virtual_price": { - "name": "get_virtual_price", - "outputs": [ - { - "type": "uint256", - "name": "" - } - ], - "inputs": [], - "stateMutability": "view", - "type": "function", - "gas": 992854 - }, - "getPricePerFullShare": { - "constant": true, - "inputs": [], - "name": "getPricePerFullShare", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } + "token": "address:token", + "vaultToken": "address:vaultToken", + "get_virtual_price": "uint256:get_virtual_price", + "getPricePerFullShare": "uint256:getPricePerFullShare" } \ No newline at end of file diff --git a/projects/numoen/index.js b/projects/numoen/index.js new file mode 100644 index 00000000000..363c5bb2510 --- /dev/null +++ b/projects/numoen/index.js @@ -0,0 +1,56 @@ +const { getLogs, getAddress, } = require('../helper/cache/getLogs') +const { sumTokens2 } = require('../helper/unwrapLPs') + +const config = { + arbitrum: { + factory: '0x1B327eFf5033922B0f88FC4D56C29d7AF5a8ecdB', + fromBlock: 43951762, + }, +} + +const blocks = { + celo: 17976668, + arbitrum: 65269032, + polygon: 40648569, +} + +async function tvl(_, _b, _cb, { api, }) { + const ownerTokens = [] + + const logs = await getLogs({ + api, + fromBlock: blocks[api.chain], + target: '0x8396a792510a402681812ece6ad3ff19261928ba', + topics: ['0x581e7fde17a1f90a422f4ef8f75f22c3437a96787d3bf54aa93c838b740183c3'], + }) + logs.forEach(i => { + const base = getAddress(i.topics[1]) + const speculative = getAddress(i.topics[2]) + const lendgine = getAddress(i.data.slice(154-26)) + const tokens = [base, speculative] + ownerTokens.push([tokens, lendgine]) + }) + ownerTokens.push(...(await ownerTokensExtra(api))) + return sumTokens2({ api, ownerTokens}) +} + +Object.keys(blocks).forEach(chain => { module.exports[chain] = { tvl }}) + +async function ownerTokensExtra(api) { + const { factory, fromBlock, } = config[api.chain] ?? {} + if (!factory) return [] + const ownerTokens = [] + + const logs = await getLogs({ + api, fromBlock, target: factory, + topics: ['0x1c8c5ae778c5728afc9c5b6cd391acf7cb01a6c6d4988fb2de551001ec7dc644'], + eventAbi: 'event LendgineCreated(address indexed base, address indexed speculative, uint256 baseScaleFactor, uint256 speculativeScaleFactor, uint256 indexed upperBound, address lendgine, address pair)', + onlyArgs: true, + }) + logs.forEach(i => { + const tokens = [i.base, i.speculative] + ownerTokens.push([tokens, i.lendgine]) + ownerTokens.push([tokens, i.pair]) + }) + return ownerTokens +} diff --git a/projects/nuon/index.js b/projects/nuon/index.js new file mode 100644 index 00000000000..8bafe1b8ee6 --- /dev/null +++ b/projects/nuon/index.js @@ -0,0 +1,8 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require("../helper/unwrapLPs"); + +module.exports = { + arbitrum: { + tvl: sumTokensExport({ owner: '0x27788F93eEbB53728b887f13c16AdA286e1b6e92' ,tokens: [ADDRESSES.arbitrum.WETH, ADDRESSES.arbitrum.USDT]}) + } +} \ No newline at end of file diff --git a/projects/nutbox/index.js b/projects/nutbox/index.js new file mode 100644 index 00000000000..5625e13feb4 --- /dev/null +++ b/projects/nutbox/index.js @@ -0,0 +1,30 @@ +const { getLogs } = require('../helper/cache/getLogs'); +const { sumUnknownTokens } = require('../helper/unknownTokens'); + +const config = { + bsc: { factory: '0xf870724476912057c807056b29c1161f5fe0199a', fromBlock: 15414926 }, + enuls: { factory: '0xb71A12De824B837eCD30D41384e80C8CDFb5D694', fromBlock: 768727 }, +} + +module.exports = { + misrepresentedTokens: true, +}; + +Object.keys(config).forEach(chain => { + const { factory, fromBlock, } = config[chain] + module.exports[chain] = { + tvl: () => ({}), + staking: async (_, _b, _cb, { api, }) => { + const logs = await getLogs({ + api, + target: factory, + topics: ['0x246afd9fb9e1733d63ee77f86f5d1440fb048c65e36822f48d468d9e5e7b8f21'], + eventAbi: 'event ERC20StakingCreated(address indexed pool, address indexed community, string name, address erc20Token)', + onlyArgs: true, + fromBlock, + }) + return sumUnknownTokens({ api, tokensAndOwners: logs.map(i => [i.erc20Token, i.pool]), useDefaultCoreAssets: true, }) + } + } +}) + diff --git a/projects/o2-dao/index.js b/projects/o2-dao/index.js index 9853a36d608..2db22ba5fc0 100644 --- a/projects/o2-dao/index.js +++ b/projects/o2-dao/index.js @@ -1,47 +1,15 @@ -const { sumTokensAndLPsSharedOwners, sumLPWithOnlyOneTokenOtherThanKnown } = require("../helper/unwrapLPs"); const { stakingUnknownPricedLP } = require("../helper/staking"); -const sdk = require('@defillama/sdk') const transform = addr=>`avax:${addr}` const chain = "avax" -const wMEMO = "0x0da67235dd5787d67955420c84ca1cecd4e5bb3b" -const time = "avax:0xb54f16fb19478766a268f172c9480f8da1a7c9c3" -const treasuryAddress = "0x10C12B7322Ac2c5a26bD9929ABc6e6b7997570ba"; const joeLP = "0x7bc2561d69b56fae9760df394a9fa9202c5f1f11" -const treasuryTokens = [ - // gOHM - ["0x321E7092a180BB43555132ec53AaA65a5bF84251", false], - // Joe LP - [joeLP, true], - //wMEMO - [wMEMO, false] -] -const stakingToken = "0xAA2439DBAd718c9329a5893A51a708C015F76346" -async function tvl(timestamp, ethBlock, chainBlocks) { - const block = chainBlocks[chain] - const balances = {} - await sumTokensAndLPsSharedOwners(balances, treasuryTokens.filter(t => t[1] === false), [treasuryAddress], block, chain, transform) - await Promise.all(treasuryTokens.filter(t => t[1] === true).map(t => - sumLPWithOnlyOneTokenOtherThanKnown(balances, t[0], treasuryAddress, stakingToken, block, chain, transform) - )) - const wmemoAddress = transform(wMEMO) - const memo = await sdk.api.abi.call({ - target: wMEMO, - abi:{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"wMEMOToMEMO","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}, - chain, - block: chainBlocks.avax, - params: [balances[wmemoAddress]] - }) - balances[time] = memo.output - delete balances[wmemoAddress] - return balances -} +const stakingToken = "0xAA2439DBAd718c9329a5893A51a708C015F76346" module.exports={ avax:{ - tvl, + tvl: () => 0, staking: stakingUnknownPricedLP("0x50971d6B5a3CCd79C516f914208C67C8104977dF", stakingToken, chain, joeLP, transform) } } \ No newline at end of file diff --git a/projects/oasisswapdex/index.js b/projects/oasisswapdex/index.js new file mode 100644 index 00000000000..75d618b10a4 --- /dev/null +++ b/projects/oasisswapdex/index.js @@ -0,0 +1,20 @@ +const { getUniTVL } = require('../helper/unknownTokens') +const { staking } = require('../helper/staking') +const sdk = require("@defillama/sdk") + +module.exports = { + misrepresentedTokens: true, + methodology: + "Factory address (0x947D83b35Cd2e71df4aC7B359C6761B07d0bce19) is used to find the LP pairs. TVL is equal to the liquidity on the AMM.", + arbitrum: { + tvl: sdk.util.sumChainTvls([ + getUniTVL({ factory: '0xbC467D80AD6401dC25B37EB86F5fcd048Ae4BF6d', useDefaultCoreAssets: true }), + getUniTVL({ factory: '0x947D83b35Cd2e71df4aC7B359C6761B07d0bce19', useDefaultCoreAssets: true }), + ]), + staking: staking("0x73c1fb66b4e183bc101b98d4c17431b667d85958", "0x602eb0d99a5e3e76d1510372c4d2020e12eaea8a") + }, + base: { + tvl: sdk.util.sumChainTvls([ + getUniTVL({ factory: '0xc8126578093366968199707b7f8edff258f473b6', useDefaultCoreAssets: true }), + ]), +} }// node test.js projects/oasisswapdex/index.js \ No newline at end of file diff --git a/projects/obric/index.js b/projects/obric/index.js new file mode 100644 index 00000000000..d311e3e0a37 --- /dev/null +++ b/projects/obric/index.js @@ -0,0 +1,8 @@ +const { dexExport } = require('../helper/chain/aptos') + +module.exports = dexExport({ + account: '0xc7ea756470f72ae761b7986e4ed6fd409aad183b1b2d3d2f674d979852f45c4b', + poolStr: 'piece_swap::PieceSwapPoolInfo', + token0Reserve: i => i.data.reserve_x.value, + token1Reserve: i => i.data.reserve_y.value, +}) diff --git a/projects/ocean-one/index.js b/projects/ocean-one/index.js index f563b81313e..dd70a4bef8d 100644 --- a/projects/ocean-one/index.js +++ b/projects/ocean-one/index.js @@ -18,5 +18,8 @@ async function fetch() { } module.exports = { + mixin: { + fetch + }, fetch } \ No newline at end of file diff --git a/projects/ocean-protocol/abi.json b/projects/ocean-protocol/abi.json index 26e4ea1ce4a..c2bfae0f0f9 100644 --- a/projects/ocean-protocol/abi.json +++ b/projects/ocean-protocol/abi.json @@ -1,6 +1,6 @@ { - "pool_getNormalizedWeight": {"constant":true,"inputs":[{"name":"token","type":"address"}],"name":"getNormalizedWeight","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"}, - "pool_isInitialized": {"constant":true,"inputs":[],"name":"isInitialized","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"}, - "pool_isFinalized": {"constant":true,"inputs":[],"name":"isFinalized","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"}, - "pool_isPublicSwap": {"constant":true,"inputs":[],"name":"isPublicSwap","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"} -} + "pool_getNormalizedWeight": "function getNormalizedWeight(address token) view returns (uint256)", + "pool_isInitialized": "bool:isInitialized", + "pool_isFinalized": "bool:isFinalized", + "pool_isPublicSwap": "bool:isPublicSwap" +} \ No newline at end of file diff --git a/projects/oceanus/index.js b/projects/oceanus/index.js index ccfea0e61db..cba3392edfe 100644 --- a/projects/oceanus/index.js +++ b/projects/oceanus/index.js @@ -40,7 +40,6 @@ module.exports = { misrepresentedTokens: true, metis: { tvl: (async) => ({}), - treasury: staking(treasuryContract, SEA, "metis"), staking: Staking, pool2: pool2Exports(OShareRewardPool, lpPool2Addresses, "metis"), }, diff --git a/projects/octane/index.js b/projects/octane/index.js index bbc89d36266..e2d10d5e3ab 100644 --- a/projects/octane/index.js +++ b/projects/octane/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { pool2s } = require('../helper/pool2') const { stakings } = require('../helper/staking') const venusFinanceAbi = require("../cookfinance/venusFinanceAbi.json"); @@ -31,7 +32,7 @@ async function tvl(timestamp, _, { bsc: block }) { }), ]) if (vToken === '0xa07c5b74c9b40447a954e1466938b865b6bbea36') - token = '0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c' + token = ADDRESSES.bsc.WBNB else token = (await sdk.api.abi.call({ target: vToken, diff --git a/projects/octolsd/index.js b/projects/octolsd/index.js new file mode 100644 index 00000000000..6f45d7d4892 --- /dev/null +++ b/projects/octolsd/index.js @@ -0,0 +1,31 @@ +const { sumTokens2 } = require("../helper/unwrapLPs"); +const { getLogs } = require("../helper/cache/getLogs"); +const { staking } = require("../helper/staking"); + +const POOL_CONTRACT = "0x7f885c6c9f847a764d247056ed4d13dc72cef7d0"; +const OCTO_ETH_LP_ADDRESS = "0xFe4cd8B965353de5fac7c0Cb041B75f5e238B413"; +const OCTO_ADDRESS = "0x52dec19feef469d7a683963b7380ecd0b1aff9c7"; + +async function tvl(timestamp, block, chainBlocks, { api }) { + const logs = await getLogs({ + api, + target: POOL_CONTRACT, + topics: ["0x18caa0724a26384928efe604ae6ddc99c242548876259770fc88fcb7e719d8fa",], + eventAbi: "event AddPool (uint256 indexed pid, uint256 rewardToken, address indexed stakingToken, bool isRegular)", + onlyArgs: true, + fromBlock: 17209964, + }); + + const lsdAddresses = logs.map((i) => i.stakingToken); + return sumTokens2({ api, owner:POOL_CONTRACT , tokens: lsdAddresses, blacklistedTokens: [OCTO_ADDRESS, OCTO_ETH_LP_ADDRESS]}); + +} + +module.exports = { + ethereum: { + methodology: + "TVL of Staked ETH & LSD tokens, with pool2 including value of staked OCTO/ETH Uniswap-V2 LP tokens", + tvl, + pool2: staking([POOL_CONTRACT], [OCTO_ETH_LP_ADDRESS]), + }, +}; diff --git a/projects/octopow/index.js b/projects/octopow/index.js index ddd771f250b..29fe60f109f 100644 --- a/projects/octopow/index.js +++ b/projects/octopow/index.js @@ -4,7 +4,6 @@ module.exports = { misrepresentedTokens: true, ethpow: { tvl: getUniTVL({ - chain: 'ethpow', useDefaultCoreAssets: true, factory: '0x3a69E908fA1614e445720Ab816a0CD51e5dc6FeC', }) diff --git a/projects/oddz/index.js b/projects/oddz/index.js index ea68ae10870..f180e070821 100644 --- a/projects/oddz/index.js +++ b/projects/oddz/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); async function getTotalCollateral(pools, chain, block) { const balances = {}; @@ -21,8 +22,8 @@ const bscPools = [ // pool, token, representation [ "0x99f29c537c70897f60c9774d3f13bd081D423467", - "0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d", - "bsc:0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d", + ADDRESSES.bsc.USDC, + "bsc:" + ADDRESSES.bsc.USDC, ], // oUSD ]; @@ -42,8 +43,8 @@ const bscPool2 = [ ], // sODDZ [ "0x3c2c77353E2F6AC1578807b6b2336Bf3a3CbB014", - "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c", - "bsc:0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c", + ADDRESSES.bsc.WBNB, + "bsc:" + ADDRESSES.bsc.WBNB, ], // ODDZ-BNB ]; @@ -52,8 +53,8 @@ const avaxPools = [ // pool, token, representation [ "0x6a165bA195D9d331b2A1C9648328d409aA599465", - "0xA7D7079b0FEaD91F3e65f86E8915Cb59c1a4C664", - "avax:0xA7D7079b0FEaD91F3e65f86E8915Cb59c1a4C664", + ADDRESSES.avax.USDC_e, + "avax:" + ADDRESSES.avax.USDC_e, ], // oUSD ]; @@ -73,8 +74,8 @@ const avaxPool2 = [ ], // sODDZ [ "0x3c2c77353E2F6AC1578807b6b2336Bf3a3CbB014", - "0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7", - "avax:0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7", + ADDRESSES.avax.WAVAX, + "avax:" + ADDRESSES.avax.WAVAX, ], // ODDZ-AVAX ]; diff --git a/projects/oh-finance/abi.json b/projects/oh-finance/abi.json index ff55b30a2e2..81c99ed36ff 100644 --- a/projects/oh-finance/abi.json +++ b/projects/oh-finance/abi.json @@ -1,28 +1,4 @@ { - "virtualBalance": { - "inputs": [], - "name": "virtualBalance", - "outputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "underlying": { - "inputs": [], - "name": "underlying", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } + "virtualBalance": "uint256:virtualBalance", + "underlying": "address:underlying" } \ No newline at end of file diff --git a/projects/ohmw/index.js b/projects/ohmw/index.js index 070d99f2388..92a987cc952 100644 --- a/projects/ohmw/index.js +++ b/projects/ohmw/index.js @@ -1,10 +1,14 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { ohmTvl } = require('../helper/ohm') const { getFixBalancesSync } = require('../helper/portedTokens') module.exports= { + hallmarks: [ + [1670457600, "Rug Pull"] + ], ...ohmTvl("0xE0Fe9Af0208ba444F81eDF348F23bd1A91Dc395E", [ ["0x11bbB41B3E8baf7f75773DB7428d5AcEe25FEC75", false], // USDC - ["0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", false], // WETH + [ADDRESSES.ethereum.WETH, false], // WETH ["0x2569134cbe40da06C1c9c1A24A7E1D2641099cA6", true], // OHMW-ETHW SLP ], "ethpow", "0x55C07a8AB97DAF79D478fE2bC2090858F0708AFF", "0xA5174cB46A15bD7d90Af7664372b1f4207a9ABea",undefined, getFixBalancesSync('ethpow')) } \ No newline at end of file diff --git a/projects/oin-finance/abi.json b/projects/oin-finance/abi.json index 4efa9532d2d..728f4b05cc8 100644 --- a/projects/oin-finance/abi.json +++ b/projects/oin-finance/abi.json @@ -1,43 +1,5 @@ { - "peek": { - "inputs": [], - "name": "peek", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "totalToken": { - "constant": true, - "inputs": [], - "name": "totalToken", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "totalUSDODeposits": { - "inputs": [], - "name": "totalUSDODeposits", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -} + "peek": "uint256:peek", + "totalToken": "uint256:totalToken", + "totalUSDODeposits": "uint256:totalUSDODeposits" +} \ No newline at end of file diff --git a/projects/oin-finance/index.js b/projects/oin-finance/index.js index b8aba4e4094..369dccdcdcd 100644 --- a/projects/oin-finance/index.js +++ b/projects/oin-finance/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const BigNumber = require("bignumber.js"); const axios = require("axios"); const BYTES = "100000000"; @@ -96,7 +97,7 @@ module.exports = { }, harmony: { tvl: getStaking('harmony', [ - ['0xcf664087a5bb0237a0bad6742852ec6c8d69a27a', '0xD018669755ad1e8c10807836A4729DCDEE8f036d'], // WONE + [ADDRESSES.harmony.WONE, '0xD018669755ad1e8c10807836A4729DCDEE8f036d'], // WONE ['0xb6768223895acc78efba06c28fdd8940f95a8ec2', '0x014186Ea70568806c2eEFeeaa1D2A71c18B9B95a'], // VIPER-LP ]), }, diff --git a/projects/okc-liquid-staking/index.js b/projects/okc-liquid-staking/index.js new file mode 100644 index 00000000000..7c98efb1654 --- /dev/null +++ b/projects/okc-liquid-staking/index.js @@ -0,0 +1,9 @@ +const STContract = '0x97B05e6C5026D5480c4B6576A8699866eb58003b'; + +module.exports = { + okexchain: { + tvl: async (_, _1, _2, { api }) => { + return { 'oec-token': (await api.call({ target: STContract, abi: "uint256:getTotalPooledOKT" })) / 1e18 } + } + } +} diff --git a/projects/okcoin/index.js b/projects/okcoin/index.js new file mode 100644 index 00000000000..f97b4f305e7 --- /dev/null +++ b/projects/okcoin/index.js @@ -0,0 +1,120 @@ +const { cexExports } = require('../helper/cex') + +const config = { + ethereum: { + owners: [ + //only wallets with more than 100 USD + '0xd30b438df65f4f788563b2b3611bd6059bff4ad9', + '0x4a8f1f5b2a3652131eac54a6f183a4a2cf44a9a6', + '0x2ce910fbba65b454bbaf6a18c952a70f3bcd8299', + '0xa28062bd708ce49e9311d6293def7df63f2b0816', + '0x964b78ef2925f24c3a8d270c10522638dee5f17f', + '0xd7efcbb86efdd9e8de014dafa5944aae36e817e4' + ], + }, + bitcoin: { + owners: [ + // we only added wallets with more than 0.1 BTC + 'bc1q39q4hqvchfq2ynyl5xttshkpvdsvp958uq94m0ddv4gt92xhnlvsj32mfy', + 'bc1qv3ertag30cfd58e9krg7ee2etp2628yapwfv27scf3t4yaqvz5wslag54w', + "36Y1UJBWGGreKCKNYQPVPr41rgG2sQF7SC", + "bc1qwkq9e5teav7n4v5v9msdyxh3tdl8782xhf9y02ffnkutppkm4rxsq5wes2", + "bc1qzrz29mxxlv3lnsng50lzpa6xrl848jp3lwmcn67t082k2xv45muswkwelc", + "bc1quktu2u654pelsn7qtmv839yyg0xecmdr59r6tuu0t5hcxq5nsxwqc5fzpu", + "bc1q65v48necseqseqm7dggtz5wf6clvwj8t8a0wswucgy8664uad7ysyf705a", + "bc1q8hnvhz3kdpxv7p7nzh2pm5qn95kfp0ff8sfk435ega90cxae374sgd8658", + "bc1qwqtm4d9x4fa7lvc88xl0autp42lkqgmp6pdpw9hpsvt9ac8k2xvq83dkz4", + "bc1qsrdlqttu69x44z9ch4r2e4t9x099rpf3p7rtu3yzpufrz4dsse0qcpqxjn", + "bc1q0peyk5wv6uathf6jlal3sqd4s66y5hfux2vh5x9z47kkt6cu4dxq05t57u", + "bc1qnp7julzx0qyyz7dapdjjyuvlhd696frj0puu9gptwdutvhryyvcsuvc3na", + "bc1qyc54t9mc7rh0srk5ctyshykqmz793y30r6jrn372v8wx76gydgwqafugxu", + "bc1qx0v26ajsfq07j4l9c60eqa7putpcvakz2u234ywh9yk3lsrd5u0s8zh9hr", + "bc1qmsdxj3j3fq9mw2733dhpvc5d79u3nhekt6fqz4y3h40gqzq7kvgq0fwjku", + "bc1qxty7nz6zwk6lfxtzsldksfsgfpvem2hewn72mc9dm09y3xq7dh7qcnyul9", + "bc1q6pgpwufv42jrq724waqdhsv9vg3wrgrcw93mj0kpdpy3d622uyyspfc9nr", + "bc1qvc6tmyr9pas29d09hu7l0n8q5eqmcepptls3lrdkhxvdc4jhatzsa6wfls", + "bc1qlaltsl05swgtvweq9uc9qmy94n2l8t92y2rxy0wnxz72jdt3qugschn0rt", + "bc1qy3s7efla47m9s32pqwg220p3a4de4f2uqe0rfmqhdfh30h52rguspl52g6", + "bc1q0708h4g2g35xfwujrrgxj6e0j2et6qkfr3a85dc2lzmyyezg4eeszmkrae", + "35EyyC2Q7UTTzmcWeuVd7b96cjkR2ykadT", + "36igHhLGsmCt4Qh1TZTgzinEjU3AQipVDi", + "36j6PzEU83pmM1PbHCP3uBH9HcuwYX1igb", + "361SutatvucBNkTBZvmNPaXThLbDm1XK5i", + "38xvfmxwR81ZtdQRw8j5XLwP38J2AioW6i", + "33qUcf4RyoysAn1TxQgzEBodvq22pDT32H", + "3HPQGA5BDsfk2Wxy4jjkg9bNpxKz33kN5o", + "3FJ6vkm44vwPQz7X82S2q9poh55tTgECM7", + "3EunnmL6LhqcB9u3PVbUAdtj1vZdGQgFBP", + "3JnxnGXVn1iSkjhsAtNRq2GGgZaDXz9SZv", + "3BiJA1srAFWoaoCPAjvNiwSmgFGGnRXCQA", + "3Mn6GnHRtA5S9HWgKdJnTfGyCgj5r8a7d8", + "bc1q2s3rjwvam9dt2ftt4sqxqjf3twav0gdx0k0q2etxflx38c3x8tnssdmnjq", + "3DekqjWw33GGZi6ER4QLTsyDZV8gEycLnt", + "3DFiiWYGszd44qADZFMae4vSwVkzKH9D1J", + "3BQ2ZssxxTpkDhSC1kanGpQ2ofNfZHfqdE", + "3L8Jow9gos1tewxYKvhxUeE43dzxFP7jfw", + "3Jcus23RVs6iyCLS4x67o64wZJuxyLJPEy", + "3EsXfkx4hdLdX6GhzthGw4G4QJSPymGyqY", + "39yNTRaotoLsGtUWrJQ2FTg4uT9i8jETNs", + "34Hx5KffA1mUQG23ZdcZ7zhpPj1jdHRPB7", + "336RCi69KyksFvfd5K8nVgv2V6L4TzPo5e", + "33Us9LTox4pPCyDRucWAeAgv5HFJ3F8QEY", + "33Miwhfghqp2fPre272zM6bBPjU6fFBjdP", + "3JrDVvApcDrJvYUhGoSXAkwCxJkxH37uRY", + "3ARVBKq7MESv4aKXeXZVjhMxmBBC7Uohvt", + "37jUoYXzKb5M2kvdXRxGnwmRrHLXuBPkGR", + "358DzMfBG2fzVMYTZjktqUQaDMR5WpYFGJ", + "35tt48ioWimAbPLxk4MfWkp6La2B7gRbRd", + "3MWUMsGmx3y1iBDCwjkZp1XdUxEHYNzUq2", + "3L39V5WF9422tHSjK7joFPnriioCrPim7j", + "35PTstw2PqGrquLnUhmye3A2nMZJzeK5MF", + "39uKss4GEpj7F8Z39tSThmatWivVW9N3cV", + "bc1qngnta9lvmht9z6y4nq5kc8x57pzan0e5daxrxtg3llgpd2jfumts8056hj", + "bc1q73cqllektyf7wgkfl9ar85sr56vuz7w8lre75ux8m0r3vcplqjmq6d8jkd", + "3Bbyo51FEEM8jzw2JQEwu7DQmBPMJzWRj4", + "3Kib3E62NKnL4bAy425G14BPofYH5qMgMF", + "3H36uhmRugEN9ySYSh4ZftP1GerUfvseXP", + "3EXXcxmcfAtMG5SeUshEZMGD3NEuDZWSXg", + "3PTcMGdNKYV5ZZDQorNYmMxoVDoghFcwWn", + "3FmNm3byE5qwzfgQbQod3jHoKGy5r4Qapp", + "36LdQB5Ae5BbnQv18R61qotgicbG1dTaBj", + "3HWqMWUcDxFjyCKvSBSmYDpGXWNqPaYoW1", + "3MxBjHLRhvV1jPLTtgUAdfDw8xJ4ww5R3z", + "3GVHA98byHdxekZjBhHBWdHCMH4GRNC61e", + "35t1TFTbUcTH5ZnZiMVqQUPUtfT4sRcTrC", + "3AxGEYCt8Hq13E6LhENzL1q6ieP7fv9M8s", + "bc1qp8gd6xakvqqg7qt9ktfpq4wrsfhp0jlyzy4npfk22xh5qk83fztqsuuspf", + "3NMQ4igWQVAZq1NeUSd4a2NLJ65w8JqmFS", + "33L5akK2tnaupkERpCndewo9hVNFkSuzFw", + "37J1MywnA1NY1mmC9ny4EgmkKEFB8zmg33", + "3Ad6D5e83PfTxZpdYQumYiMrFnc7S6hE1P", + "35VhixfJ7PhxF12F6oCSnzm6Cgu5RZUoMu", + "3FFyv1BR5r93YN8aVpmJ7JDeMH7TeccZw7", + "32UxKDSVdSeaNyAQQd5UfHveJzAikbGLmT", + "37HNTMRUGWFMzws1RF6fAp2sDP5m6tMwec", + "3JeBScBZpYp4szgK1R8LCZvA2tzkXr9VRD", + "38Tqph89kZ7pACYfB3QEWMmcqwT6iLYzsF", + "38E56tLzMHxpmwfdgB6BaPgNkHFh5FzaTi", + "3Kv5DCmHU64wN68hiD6hGyTgfEv3E7czDd", + "377313tZcAthF8jq2Z7zsfYPAHTvA3mg9P" + ] + }, + tron: { + owners: [ + 'TQ7wK19fhZZqLdj2Xcw2e6Ejs3cTZbfBbF', + ] + }, + avax: { + owners: ["0x5793da1b0c41c7db8e3eb8dbcd18fdca94a58535"] + }, + polygon: { + owners: ["0x0f51a310a4dd79d373eb8be1c0ddd54570235443"] + }, + okexchain: { + owners: ["0x5b73841a54f6f2e8b179f1801f664f470d7f37ea"] + } +} + +module.exports = cexExports(config) +module.exports.methodology = 'This wallets where collect from here https://www.okcoin.com/proof-of-reserves/download Audit ID 500509486 , 06/08/2023, 19:00:00. We are only tracking BTC wallets with more than 0.1 BTC. We are only tracking ETH wallets with more than 100$.' + diff --git a/projects/okcswap/index.js b/projects/okcswap/index.js index 1045f7b8ffb..d86a82b2492 100644 --- a/projects/okcswap/index.js +++ b/projects/okcswap/index.js @@ -6,7 +6,6 @@ module.exports = { okexchain: { tvl: getUniTVL({ factory: '0x7b9F0a56cA7D20A44f603C03C6f45Db95b31e539', - chain: 'okexchain', useDefaultCoreAssets: true, }) }, diff --git a/projects/okex/index.js b/projects/okex/index.js index 23e670275ef..58439471f57 100644 --- a/projects/okex/index.js +++ b/projects/okex/index.js @@ -91,7 +91,12 @@ const config = { owners:[ "0x06959153b974d0d5fdfd87d561db6d8d4fa0bb0b", ] + }, + optimism:{ + owners:[ + "0xebe80f029b1c02862b9e8a70a7e5317c06f62cae", + ] } } -module.exports = cexExports(config) \ No newline at end of file +module.exports = cexExports(config) diff --git a/projects/olafinance/index.js b/projects/olafinance/index.js index 0413f5984ea..db54a0dcb7b 100644 --- a/projects/olafinance/index.js +++ b/projects/olafinance/index.js @@ -1,15 +1,11 @@ const {usdCompoundExports} = require('../helper/compound') const unitroller_fantom = "0x892701d128d63c9856A9Eb5d967982F78FD3F2AE" -//const unitroller_bsc = "0xAD48B2C9DC6709a560018c678e918253a65df86e" -//APESWAP tvl moved over to APESWAP adapter -//FUSE tvl combined with fuseswap as fusefi tvl -//const unitroller_fuse = "0x26a562B713648d7F3D1E1031DCc0860A4F3Fa340" const abis = { - oracle: {"constant":true,"inputs":[],"name":"getRegistry","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"}, - underlyingPrice: {"constant":true,"inputs":[{"internalType":"address","name":"cToken","type":"address"}],"name":"getPriceForUnderling","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"}, -} + oracle: "address:getRegistry", + underlyingPrice: "function getPriceForUnderling(address cToken) view returns (uint256)", + } module.exports={ diff --git a/projects/olivecash/abi.json b/projects/olivecash/abi.json index 5f77f2b6c20..45bf320f952 100644 --- a/projects/olivecash/abi.json +++ b/projects/olivecash/abi.json @@ -1,49 +1,4 @@ { - "poolInfo": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "poolInfo", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "lpToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "allocPoint", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastRewardBlock", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accOlivePerShare", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "poolLength": { - "inputs": [], - "name": "poolLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -} + "poolInfo": "function poolInfo(uint256) view returns (address lpToken, uint256 allocPoint, uint256 lastRewardBlock, uint256 accOlivePerShare)", + "poolLength": "uint256:poolLength" +} \ No newline at end of file diff --git a/projects/olivecash/index.js b/projects/olivecash/index.js index 222a8a876d6..1fb3ca3b148 100644 --- a/projects/olivecash/index.js +++ b/projects/olivecash/index.js @@ -1,6 +1,5 @@ -const sdk = require('@defillama/sdk'); const abi = require("./abi.json"); -const { addTokensAndLPs } = require("../helper/unwrapLPs"); +const { sumTokens2 } = require('../helper/unwrapLPs') const CHEFS = { "avax": "0x5A9710f3f23053573301C2aB5024D0a43A461E80", @@ -8,80 +7,21 @@ const CHEFS = { "fantom": "0xC90812E4502D7848E58e53753cA397A201f2e99B" } -async function chainTvl(timestamp, block, chainBlocks, chain) { - const chef = CHEFS[chain]; - const poolLength = Number( - ( - await sdk.api.abi.call({ - abi: abi.poolLength, - target: chef, - chain: chain, - block: chainBlocks[chain], - }) - ).output - ); - const poolIds = Array.from(Array(poolLength).keys()); - - const lpTokens = ( - await sdk.api.abi.multiCall({ - abi: abi.poolInfo, - calls: poolIds.map((pid) => ({ - target: chef, - params: pid, - })), - chain: chain, - block: chainBlocks[chain], - }) - ).output.map((lp) => ({ output: lp.output[0].toLowerCase() })); - - const amounts = ( - await sdk.api.abi.multiCall({ - abi: 'erc20:balanceOf', - calls: lpTokens.map((lp) => ({ - target: lp.output, - params: chef, - })), - chain: chain, - block: chainBlocks[chain], - }) - ) - - const balances = {}; - const tokens = { output: lpTokens }; - const transformAddress = addr => `${chain}:${addr}`; - await addTokensAndLPs( - balances, - tokens, - amounts, - chainBlocks[chain], - chain, - transformAddress - ); - - return balances; -} - -async function avaxTvl(timestamp, block, chainBlocks) { - return await chainTvl(timestamp, block, chainBlocks, "avax") -} - -async function bscTvl(timestamp, block, chainBlocks) { - return await chainTvl(timestamp, block, chainBlocks, "bsc") -} - -async function fantomTvl(timestamp, block, chainBlocks) { - return await chainTvl(timestamp, block, chainBlocks, "fantom") -} - module.exports = { methodology: "TVL includes all farms in MasterChef contract", - avax:{ - tvl: avaxTvl - }, - bsc: { - tvl: bscTvl, - }, - fantom: { - tvl: fantomTvl, - }, -} \ No newline at end of file +} + +Object.keys(CHEFS).forEach(chain => { + const chef = CHEFS[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const lp = await api.fetchList({ + lengthAbi: abi.poolLength, + itemAbi: abi.poolInfo, + target: chef, + }) + const tokens = lp.map(i => i.lpToken) + return sumTokens2({ api, owner: chef, tokens, resolveLP: true, }) + } + } +}) \ No newline at end of file diff --git a/projects/olivedao/index.js b/projects/olivedao/index.js index a3bc049e28a..77654254acb 100644 --- a/projects/olivedao/index.js +++ b/projects/olivedao/index.js @@ -1,10 +1,11 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const {transformPolygonAddress} = require('../helper/portedTokens'); const ethPool = "0x8e300739960457B532Af3bEd62475B790e0Dee5E" const usdcPool = "0x05a37e1745926D8725A6C5dbD7Fd9873Dd9E356e" -const usdcMatic = "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174" -const wethMatic = "0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619" +const usdcMatic = ADDRESSES.polygon.USDC +const wethMatic = ADDRESSES.polygon.WETH_1 async function tvl(_timestamp, ethBlock, chainBlocks) { const balances = {}; diff --git a/projects/olympulsex/index.js b/projects/olympulsex/index.js new file mode 100644 index 00000000000..2fced2012d9 --- /dev/null +++ b/projects/olympulsex/index.js @@ -0,0 +1,12 @@ +const { sumTokensExport } = require('../helper/unknownTokens') + +const stakingToken = "0xBB366A397D7d4d2BEDABD9139D4c32a8826605Ed"; // SEX +const staking = "0xf1Bc988e7EaBA7a2dbF0121E6ad9BEA82A1AB1ff"; +const LP = '0x2d593b3472d6a5439bC1523a04C2aec314CBc44c' + +module.exports = { + pulse: { + tvl: () => 0, + staking: sumTokensExport({ owner: staking, tokens: [stakingToken], lps: [LP], useDefaultCoreAssets: true, }), + } +} \ No newline at end of file diff --git a/projects/olympus/abi.json b/projects/olympus/abi.json index 514e0468363..a40d9fd4ad3 100644 --- a/projects/olympus/abi.json +++ b/projects/olympus/abi.json @@ -1,44 +1,4 @@ { - "totalValueDeployed": { - "inputs": [], - "name": "totalValueDeployed", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "userInfo": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "userInfo", - "outputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "rewardDebt", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } + "totalValueDeployed": "uint256:totalValueDeployed", + "userInfo": "function userInfo(uint256, address) view returns (uint256 amount, uint256 rewardDebt)" } \ No newline at end of file diff --git a/projects/olympus/api.js b/projects/olympus/api.js new file mode 100644 index 00000000000..b83e37f2502 --- /dev/null +++ b/projects/olympus/api.js @@ -0,0 +1,8 @@ +const index = require('./index') + +module.exports = { + ethereum: { + tvl: () => 0, + staking: index.ethereum.staking, + } +} \ No newline at end of file diff --git a/projects/olympus/index.js b/projects/olympus/index.js index 208a8c38889..157d96f2edb 100644 --- a/projects/olympus/index.js +++ b/projects/olympus/index.js @@ -1,66 +1,183 @@ -const sdk = require("@defillama/sdk"); -const {gql, request} = require('graphql-request'); -const { toUSDTBalances } = require("../helper/balances"); +const ADDRESSES = require('../helper/coreAssets.json') +const { blockQuery } = require("../helper/http"); +const { getEnv } = require("../helper/env"); +const { staking } = require('../helper/staking'); +const { sumTokens2 } = require("../helper/unwrapLPs"); const OlympusStakings = [ // Old Staking Contract "0x0822F3C03dcc24d200AFF33493Dc08d0e1f274A2", // New Staking Contract "0xFd31c7d00Ca47653c6Ce64Af53c1571f9C36566a", + "0xb63cac384247597756545b500253ff8e607a8020", ]; -const OHM = "0x383518188c0c6d7730d91b2c03a03c837814a899"; +const OHM_V1 = "0x383518188c0c6d7730d91b2c03a03c837814a899" // this is OHM v1 +const OHM = "0x64aa3364f17a4d01c6f1751fd97c2bd3d7e7f1d5" // this is OHM v1 +/** Map any staked assets without price feeds to those with price feeds. + * All balances are 1: 1 to their unstaked counterpart that has the price feed. + **/ +const addressMap = { + "0xb23dfc0c4502a271976f1ee65321c51be2529640": + "0x76fcf0e8c7ff37a47a799fa2cd4c13cde0d981c9", //aura50OHM-50DAI -> 50OHM-50DAI + "0xc8418af6358ffdda74e09ca9cc3fe03ca6adc5b0": + "0x3432b6a60d23ca0dfca7761b7ab56459d9c964d0", // veFXS -> FXS + "0x3fa73f1e5d8a792c80f426fc8f84fbf7ce9bbcac": + "0xc0c293ce456ff0ed870add98a0828dd4d2903dbf", //vlAURA -> AURA + [ADDRESSES.ethereum.vlCVX]: + ADDRESSES.ethereum.CVX, //vlCVX -> CVX + "0xa02d8861fbfd0ba3d8ebafa447fe7680a3fa9a93": + "0xd1ec5e215e8148d76f4460e4097fd3d5ae0a3558", //aura50OHM-50WETH -> 50OHM-50WETH + "0x0ef97ef0e20f84e82ec2d79cbd9eda923c3daf09": + "0xd4f79ca0ac83192693bce4699d0c10c66aa6cf0f", //auraOHM-wstETH -> OHM-wstETH + "0x81b0dcda53482a2ea9eb496342dc787643323e95": + "0x5271045f7b73c17825a7a7aee6917ee46b0b7520", //stkcvxOHMFRAXBP-f-frax -> OHMFRAXBP-f + "0x8a53ee42fb458d4897e15cc7dea3f75d0f1c3475": + "0x3175df0976dfa876431c2e9ee6bc45b65d3473cc", //stkcvxcrvFRAX-frax -> crvFRAX-frax + "0xb0c22d8d350c67420f06f48936654f567c73e8c8": + "0x4e78011ce80ee02d2c3e649fb657e45898257815", //sKLIMA -> KLIMA + "0x742b70151cd3bc7ab598aaff1d54b90c3ebc6027": + "0xc55126051B22eBb829D00368f4B12Bde432de5Da", //rlBTRFLY -> BTRFLY V2 + "0xc0d4ceb216b3ba9c3701b291766fdcba977cec3a": + "0xc55126051B22eBb829D00368f4B12Bde432de5Da", //BTRFLY -> BTRFLYV2 +}; -/*** Staking of native token (OHM) TVL Portion ***/ -const staking = async (timestamp, ethBlock, chainBlocks) => { - const balances = {}; - - for (const stakings of OlympusStakings) { - const stakingBalance = await sdk.api.abi.call({ - abi: 'erc20:balanceOf', - target: OHM, - params: stakings, - block: ethBlock, - }); - - sdk.util.sumSingleBalance(balances, OHM, stakingBalance.output); +const protocolQuery = (block) => ` + query { + tokenRecords(orderDirection: desc, orderBy: block, where: {block: ${block}}) { + block + timestamp + category + tokenAddress + balance + } } +`; - return balances; -}; - -const protocolQuery = gql` -query get_tvl($block: Int) { - protocolMetrics( - first: 1, orderBy: timestamp, orderDirection: desc - ) { - treasuryMarketValue +const getLatestBlockIndexed = ` +query { + lastBlock: tokenRecords(first: 1, orderBy: block, orderDirection: desc) { + block timestamp } +}`; + + +//Subgraph returns balances in tokenAddress / allocator pairs. Need to return based on balance. +function sumBalancesByTokenAddress(arr) { + return arr.reduce((acc, curr) => { + const found = acc.find((item) => item.tokenAddress === curr.tokenAddress); + if (found) { + found.balance = +found.balance + +curr.balance; + } else { + const newItem = { + tokenAddress: curr.tokenAddress, + balance: curr.balance, + category: curr.category, + }; + acc.push(newItem); + } + return acc; + }, []); } -` -/*** Bonds TVL Portion (Treasury) *** - * Treasury TVL consists of DAI, FRAX and WETH balances + Sushi SLP and UNI-V2 balances +/*** Query Subgraphs for latest Treasury Allocations *** + * #1. Query tokenRecords for latestBlock indexed in subgraph. + * This allows us to filter protocol query to a list of results only for the latest block indexed + * #2. Call tokenRecords with block num from prev query + * #3. Sum values returned ***/ -async function ethTvl(timestamp, block) { - const queriedData = await request("https://api.thegraph.com/subgraphs/name/drondin/olympus-protocol-metrics", protocolQuery, {block}) - const metric= queriedData.protocolMetrics[0] - if(Date.now()/1000 - metric.timestamp > 3600*24){ - throw new Error("outdated") +async function tvl(timestamp, block, _, { api }, isOwnTokensMode = false) { +const subgraphUrls = { + ethereum: `https://gateway.thegraph.com/api/${getEnv('OLYMPUS_GRAPH_API_KEY')}/subgraphs/id/DTcDcUSBRJjz9NeoK5VbXCVzYbRTyuBwdPUqMi8x32pY`, + arbitrum: + "https://api.thegraph.com/subgraphs/name/olympusdao/protocol-metrics-arbitrum", + fantom: + "https://api.thegraph.com/subgraphs/name/olympusdao/protocol-metrics-fantom", + polygon: + "https://api.thegraph.com/subgraphs/name/olympusdao/protocol-metrics-polygon", +}; + const indexedBlockForEndpoint = await blockQuery( + subgraphUrls[api.chain], + getLatestBlockIndexed, + { api } + ); + const blockNum = indexedBlockForEndpoint.lastBlock[0].block; + const { tokenRecords } = await blockQuery( + subgraphUrls[api.chain], + protocolQuery(blockNum), + { api } + ); + + const aDay = 24 * 3600; + const now = Date.now() / 1e3; + if (now - blockNum[0].timestamp > 3 * aDay) { + throw new Error("outdated"); } - return toUSDTBalances(metric.treasuryMarketValue) + // const filteredTokenRecords = poolsOnly + // ? tokenRecords.filter((t) => t.category === "Protocol-Owned Liquidity") + // : tokenRecords; + + /** + * iterates over filtered list from subgraph and returns any addresses + * that need to be normalized for pricing . + * See addressMap above + **/ + const normalizedFilteredTokenRecords = tokenRecords.map((token) => { + const normalizedAddress = addressMap[token.tokenAddress] + ? addressMap[token.tokenAddress] + : token.tokenAddress; + return { ...token, tokenAddress: normalizedAddress }; + }); + + const tokensToBalances = sumBalancesByTokenAddress( + normalizedFilteredTokenRecords + ).filter(i => { + if (api.chain !== 'arbitrum') return true; + return !['0x89dc7e71e362faf88d92288fe2311d25c6a1b5e0000200000000000000000423', '0xce6195089b302633ed60f3f427d1380f6a2bfbc7000200000000000000000424'].includes(i.tokenAddress) + }) + const tokens = tokensToBalances.map(i => i.tokenAddress) + + + const decimals = await api.multiCall({ abi: 'erc20:decimals', calls: tokens }) + const ownTokens = new Set([ + '0x0ab87046fBb341D058F17CBC4c1133F25a20a52f', // GOHM + '0x64aa3364f17a4d01c6f1751fd97c2bd3d7e7f1d5', // OHM + ].map(i => i.toLowerCase())) + tokensToBalances.map(async (token, i) => { + if (ownTokens.has(token.tokenAddress.toLowerCase())) { + if (!isOwnTokensMode) return; + } else if (isOwnTokensMode) return; + api.add(token.tokenAddress, token.balance * 10 ** decimals[i]) + }) + return sumTokens2({ api, resolveLP: true, }) +} + +async function ownTokens(timestamp, block, _, { api }) { + return tvl(timestamp, block, _, { api }, true); } module.exports = { start: 1616569200, // March 24th, 2021 timetravel: false, - misrepresentedTokens: true, + methodology: + "TVL is the sum of the value of all assets held by the treasury (excluding pTokens). Please visit https://app.olympusdao.finance/#/dashboard for more info.", ethereum: { - tvl: ethTvl, - staking + staking: staking(OlympusStakings, [OHM, OHM_V1]), + tvl, + ownTokens, + }, + arbitrum: { + tvl, + // pool2, + }, + polygon: { + tvl, + // pool2, + }, + fantom: { + tvl, + // pool2, }, - methodology: - "Counts DAI, DAI SLP (OHM-DAI), FRAX, FRAX ULP (OHM-FRAX), WETH on the treasury", }; diff --git a/projects/omaxswap/index.js b/projects/omaxswap/index.js new file mode 100644 index 00000000000..4a9dfd6f38b --- /dev/null +++ b/projects/omaxswap/index.js @@ -0,0 +1,3 @@ +const { uniTvlExport } = require('../helper/unknownTokens') + +module.exports = uniTvlExport('omax', '0x0e149Ff38Cd5B5c0F1004D08A14C9653485ad5fA') \ No newline at end of file diff --git a/projects/omicron/api.js b/projects/omicron/api.js new file mode 100644 index 00000000000..469bda32f63 --- /dev/null +++ b/projects/omicron/api.js @@ -0,0 +1,8 @@ +const index = require('./index') + +module.exports = { + arbitrum: { + tvl: () => 0, + staking: index.arbitrum.staking, + } +} \ No newline at end of file diff --git a/projects/omicron/index.js b/projects/omicron/index.js index eca79c7fd2b..696db9b0e96 100644 --- a/projects/omicron/index.js +++ b/projects/omicron/index.js @@ -1,11 +1,12 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { ohmTvl } = require('../helper/ohm') const treasury = "0x9EF8600b0f107c083F9df557e0Ddf12E071E75fe" module.exports = ohmTvl(treasury, [ //USDC - ["0xff970a61a04b1ca14834a43f5de4533ebddb5cc8", false], + [ADDRESSES.arbitrum.USDC, false], //MIM - ["0xfea7a6a0b346362bf88a9e4a88416b77a57d6c2a", false], + [ADDRESSES.arbitrum.MIM, false], //sushi LP ["0xe4ad045abb586dbdae6b11a4d2c6ff5434b93ed1", true], // diff --git a/projects/omm/index.js b/projects/omm/index.js index b312e0afb4a..64f7e6eeac3 100644 --- a/projects/omm/index.js +++ b/projects/omm/index.js @@ -64,5 +64,8 @@ async function fetch() { } module.exports = { + hallmarks: [ + [1674388800,"Smart Contract Exploit"] + ], fetch } \ No newline at end of file diff --git a/projects/omnidex-lend/abi.json b/projects/omnidex-lend/abi.json index e60bc2d3f99..1369686f0ff 100644 --- a/projects/omnidex-lend/abi.json +++ b/projects/omnidex-lend/abi.json @@ -1,24 +1,3 @@ { - "getAllOTokens": { - "inputs": [], - "name": "getAllOTokens", - "outputs": [{ - "components": [{ - "internalType": "string", - "name": "symbol", - "type": "string" - }, - { - "internalType": "address", - "name": "tokenAddress", - "type": "address" - } - ], - "internalType": "struct AaveProtocolDataProvider.TokenData[]", - "name": "", - "type": "tuple[]" - }], - "stateMutability": "view", - "type": "function" - } + "getAllOTokens": "function getAllOTokens() view returns (tuple(string symbol, address tokenAddress)[])" } \ No newline at end of file diff --git a/projects/omnidex-perpetuals/index.js b/projects/omnidex-perpetuals/index.js new file mode 100644 index 00000000000..fb6902ea6d7 --- /dev/null +++ b/projects/omnidex-perpetuals/index.js @@ -0,0 +1,10 @@ +const { gmxExports } = require('../helper/gmx') + +//Telos +const Vault = '0x8F23134EBc390856E01993dE9f7F837bcD93014a'; + +module.exports = { + telos: { + tvl: gmxExports({ vault: Vault }) + }, +}; \ No newline at end of file diff --git a/projects/omnidex/index.js b/projects/omnidex/index.js index 9cca6edb066..98452addb81 100644 --- a/projects/omnidex/index.js +++ b/projects/omnidex/index.js @@ -1,6 +1,7 @@ const { getUniTVL } = require('../helper/unknownTokens') module.exports={ + misrepresentedTokens: true, telos:{ tvl: getUniTVL({ factory: '0x7a2A35706f5d1CeE2faa8A254dd6F6D7d7Becc25', chain: 'telos', useDefaultCoreAssets: true }), } diff --git a/projects/omniprotocol/helper.js b/projects/omniprotocol/helper.js deleted file mode 100644 index 67fafa49afa..00000000000 --- a/projects/omniprotocol/helper.js +++ /dev/null @@ -1,101 +0,0 @@ -const sdk = require("@defillama/sdk"); -const abiOmni = require("./omni.json"); - -async function getOmniReserves( - block, - chain, - validProtocolDataHelper -) { - const validProtocolDataHelpers = [validProtocolDataHelper]; - - const aTokenMarketData = ( - await sdk.api.abi.multiCall({ - calls: validProtocolDataHelpers.map((dataHelper) => ({ - target: dataHelper, - })), - abi: abiOmni["getAllOTokens"], - block, - chain, - }) - ).output; - - const reserveTokenMarketData = ( - await sdk.api.abi.multiCall({ - calls: validProtocolDataHelpers.map((dataHelper) => ({ - target: dataHelper, - })), - abi: abiOmni["getAllReservesTokens"], - block, - chain, - }) - ).output; - - let aTokenAddresses = []; - aTokenMarketData.map((aTokensData) => { - aTokenAddresses = [ - ...aTokenAddresses, - ...aTokensData.output.map((aToken) => aToken[1]), - ]; - }); - - let reserveAddresses = []; - reserveTokenMarketData.map((aTokensData) => { - reserveAddresses = [ - ...reserveAddresses, - ...aTokensData.output.map((aToken) => aToken[1]), - ]; - }); - - return [aTokenAddresses, reserveAddresses, validProtocolDataHelpers[0]]; -} - -async function getTvl( - block, - chain, - ntokens, - reserveTokens, -) { - const balanceOfUnderlying = await sdk.api.abi.multiCall({ - calls: ntokens.map((aToken, index) => ({ - target: reserveTokens[index], - params: aToken, - })), - abi: "erc20:balanceOf", - block, - chain, - }); - - return balanceOfUnderlying.output.map(({ input, output }) => ({ - asset: input.target, - output, - })); -} - -async function getBorrowed( - block, - chain, - reserveTokens, - dataHelper, -) { - const reserveData = await sdk.api.abi.multiCall({ - calls: reserveTokens.map((token) => ({ - target: dataHelper, - params: token, - })), - abi: abiOmni["getReserveData"], - block, - chain, - }); - - return reserveData.output.map(({ input, output }) => ({ - asset: input.params[0], - variable: output.totalVariableDebt, - stable: output.totalStableDebt, - })); -} - -module.exports = { - getTvl, - getBorrowed, - getOmniReserves, -}; \ No newline at end of file diff --git a/projects/omniprotocol/index.js b/projects/omniprotocol/index.js index b51870d36df..617e207341a 100644 --- a/projects/omniprotocol/index.js +++ b/projects/omniprotocol/index.js @@ -1,131 +1,17 @@ -const sdk = require("@defillama/sdk"); -const { - getTvl, - getBorrowed, - getOmniReserves, -} = require("./helper.js"); const abi = require("./omni.json"); -const { default: BigNumber } = require("bignumber.js"); +const { aaveExports } = require("../helper/aave"); const validProtocolDataHelper = "0x8AAc97e25c79195aC77817287Cf512b0Acc9da44"; const omniOracle = "0x08Eaf1C8c270a485DD9c8aebb2EDE3FcAe72e04f"; -const ETH = "0x0000000000000000000000000000000000000000"; - -function totalTvl() { - return async (timestamp, block) => { - const balances = { - [ETH]: 0, - }; - - // get all derivative and underlying tokens - const [otokens, reserveTokens, dataHelper] = await getOmniReserves( - block, - "ethereum", - validProtocolDataHelper - ); - - // get balance of all supplied assets in protocol - const protocolBalance = await getTvl( - block, - "ethereum", - otokens, - reserveTokens - ); - - // get decimals for all assets - ERC721 will return null - let { output: decimals } = await sdk.api.abi.multiCall({ - calls: protocolBalance.map((asset, index) => ({ - target: asset.asset, - })), - abi: "erc20:decimals", - block, - chain: "ethereum", - }); - - // fetch prices for every asset in single call - const { output: prices } = await sdk.api.abi.call({ - target: omniOracle, - params: [protocolBalance.map((item) => item.asset)], - abi: abi["getAssetsPrices"], - }); - - protocolBalance.map((val, index) => { - let isNft = !decimals[index].success; - - if (isNft) { - // treat NFT's as their underlying floor balance - let price = prices[index]; - balances[ETH] += BigNumber(val.output) * BigNumber(price); - } else { - balances[val.asset] = val.output; - } - }); - - return balances; - }; -} - -function totalBorrowed() { - return async (timestamp, block) => { - const balances = { - [ETH]: 0, - }; - - // get all derivative and underlying tokens - const [otokens, reserveTokens, dataHelper] = await getOmniReserves( - block, - "ethereum", - validProtocolDataHelper - ); - - // get balance of all borrowed assets in protocol - const protocolBorrowed = await getBorrowed( - block, - "ethereum", - reserveTokens, - dataHelper - ); - - // get decimals for all assets - ERC721 will return null - let { output: decimals } = await sdk.api.abi.multiCall({ - calls: protocolBorrowed.map((asset, index) => ({ - target: asset.asset, - })), - abi: "erc20:decimals", - block, - chain: "ethereum", - }); - - // fetch prices for every asset in single call - const { output: prices } = await sdk.api.abi.call({ - target: omniOracle, - params: [protocolBorrowed.map((item) => item.asset)], - abi: abi["getAssetsPrices"], - }); - - protocolBorrowed.map((borrowed, index) => { - let isNft = !decimals[index].success; - let totalDebt = borrowed.variable + borrowed.stable; - - if (isNft) { - // treat NFT's as their underlying floor balance - let price = prices[index]; - balances[ETH] += BigNumber(totalDebt) * BigNumber(price); - } else { - balances[borrowed.asset] = totalDebt; - } - }); - - return balances; - }; -} module.exports = { - timetravel: true, misrepresentedTokens: true, methodology: `Counts the tokens locked in the contracts to be used as collateral to borrow or to earn yield. NFT's are counted as their floor price for both collateral and debt. Borrowed coins are not counted towards the TVL, so only the coins actually locked in the contracts are counted. There's multiple reasons behind this but one of the main ones is to avoid inflating the TVL through cycled lending`, - ethereum: { - tvl: totalTvl(), - borrowed: totalBorrowed(), - }, + ethereum: aaveExports('ethereum', undefined, undefined, [validProtocolDataHelper], { oracle: omniOracle, + abis: { + getAllATokens: abi.getAllOTokens, + }}), + hallmarks: [ + [Math.floor(new Date('2022-07-10')/1e3), 'reentrancy hack'], + ], }; \ No newline at end of file diff --git a/projects/omniprotocol/omni.json b/projects/omniprotocol/omni.json index f7257bcd8cf..1369686f0ff 100644 --- a/projects/omniprotocol/omni.json +++ b/projects/omniprotocol/omni.json @@ -1,142 +1,3 @@ { - "getAllOTokens": { - "inputs": [], - "name": "getAllOTokens", - "outputs": [ - { - "components": [ - { "internalType": "string", "name": "symbol", "type": "string" }, - { - "internalType": "address", - "name": "tokenAddress", - "type": "address" - } - ], - "internalType": "struct ProtocolDataProvider.TokenData[]", - "name": "", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getAllReservesTokens": { - "inputs": [], - "name": "getAllReservesTokens", - "outputs": [ - { - "components": [ - { "internalType": "string", "name": "symbol", "type": "string" }, - { - "internalType": "address", - "name": "tokenAddress", - "type": "address" - } - ], - "internalType": "struct ProtocolDataProvider.TokenData[]", - "name": "", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getReserveTokensAddresses": { - "inputs": [ - { "internalType": "address", "name": "asset", "type": "address" } - ], - "name": "getReserveTokensAddresses", - "outputs": [ - { "internalType": "address", "name": "xTokenAddress", "type": "address" }, - { - "internalType": "address", - "name": "stableDebtTokenAddress", - "type": "address" - }, - { - "internalType": "address", - "name": "variableDebtTokenAddress", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getAssetPrice": { - "inputs": [ - { "internalType": "address", "name": "asset", "type": "address" } - ], - "name": "getAssetPrice", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - "getAssetsPrices": { - "inputs": [ - { "internalType": "address[]", "name": "assets", "type": "address[]" } - ], - "name": "getAssetsPrices", - "outputs": [ - { "internalType": "uint256[]", "name": "", "type": "uint256[]" } - ], - "stateMutability": "view", - "type": "function" - }, - "getReserveData": { - "inputs": [ - { "internalType": "address", "name": "asset", "type": "address" } - ], - "name": "getReserveData", - "outputs": [ - { - "internalType": "uint256", - "name": "accruedToTreasuryScaled", - "type": "uint256" - }, - { "internalType": "uint256", "name": "totalOToken", "type": "uint256" }, - { - "internalType": "uint256", - "name": "totalStableDebt", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalVariableDebt", - "type": "uint256" - }, - { "internalType": "uint256", "name": "liquidityRate", "type": "uint256" }, - { - "internalType": "uint256", - "name": "variableBorrowRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "stableBorrowRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "averageStableBorrowRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "liquidityIndex", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "variableBorrowIndex", - "type": "uint256" - }, - { - "internalType": "uint40", - "name": "lastUpdateTimestamp", - "type": "uint40" - } - ], - "stateMutability": "view", - "type": "function" - } + "getAllOTokens": "function getAllOTokens() view returns (tuple(string symbol, address tokenAddress)[])" } \ No newline at end of file diff --git a/projects/omt-finance/index.js b/projects/omt-finance/index.js new file mode 100644 index 00000000000..cd1404a9f83 --- /dev/null +++ b/projects/omt-finance/index.js @@ -0,0 +1,7 @@ +const { gmxExports } = require('../helper/gmx') + +module.exports = { + onus:{ + tvl: gmxExports({ vault: '0x9a10B55FdE534e7809345D9DE0191a2b01E2F399', }) + }, +}; diff --git a/projects/onavax/index.js b/projects/onavax/index.js index f7ce9732e65..ba7d3338f33 100644 --- a/projects/onavax/index.js +++ b/projects/onavax/index.js @@ -6,7 +6,6 @@ module.exports = { avax: { tvl: getUniTVL({ factory, - chain: 'avax', useDefaultCoreAssets: true, }), }, diff --git a/projects/onc/index.js b/projects/onc/index.js new file mode 100644 index 00000000000..c1b71cdddfd --- /dev/null +++ b/projects/onc/index.js @@ -0,0 +1,49 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require('../helper/unwrapLPs') + +module.exports = { + methodology: "Gets TVL inside the ONC Treasury.", + era: { + tvl: sumTokensExport({ + owner: "0x581f87De7a655f50932F706873fcc7024d2309Fa", tokens: [ + ADDRESSES.era.USDC, // USDC + "0x4BEf76b6b7f2823C6c1f4FcfEACD85C24548ad7e", // DAI + ] + }), + }, + kava: { + tvl: sumTokensExport({ + owner: "0x481654217A24B43fB63a7761d7033Fdf9361eAB6", tokens: [ + ADDRESSES.kava.WKAVA, // WKAVA + ] + }), + }, + arbitrum: { + tvl: sumTokensExport({ + owner: "0xc9cb7AB00802165e316A6f8c241E87E0Ee72e787", tokens: [ + ADDRESSES.arbitrum.USDC, // USDC + ADDRESSES.arbitrum.USDT, // USDT + ADDRESSES.optimism.DAI, // DAI + ] + }), + }, + bsc: { + tvl: sumTokensExport({ + owner: "0x7c24b813089675cf5484afa4850FE9276D97b461", tokens: [ + ADDRESSES.bsc.BUSD, // BUSD + ADDRESSES.bsc.USDC, // USDC + ADDRESSES.bsc.USDT, // USDT + "0x1AF3F329e8BE154074D8769D1FFa4eE058B1DBc3", // DAI + ] + }), + }, + avax: { + tvl: sumTokensExport({ + owner: "0xD5a7Df8B56d285011AbE406235109c029F45797A", tokens: [ + ADDRESSES.avax.USDC, // USDC + ADDRESSES.avax.USDt, // USDT + ADDRESSES.avax.DAI, // DAI + ] + }), + }, +}; diff --git a/projects/ondofinance-v1/abi.json b/projects/ondofinance-v1/abi.json new file mode 100644 index 00000000000..a6002279a51 --- /dev/null +++ b/projects/ondofinance-v1/abi.json @@ -0,0 +1,3 @@ +{ + "getVaults": "function getVaults(uint256 _from, uint256 _to) view returns (tuple(uint256 id, tuple(address token, address trancheToken, uint256 trancheCap, uint256 userCap, uint256 deposited, uint256 originalInvested, uint256 totalInvested, uint256 received, uint256 rolloverDeposited)[] assets, address strategy, address creator, address strategist, address rollover, uint256 hurdleRate, uint8 state, uint256 startAt, uint256 investAt, uint256 redeemAt)[] vaults)" +} diff --git a/projects/ondofinance-v1/index.js b/projects/ondofinance-v1/index.js new file mode 100644 index 00000000000..86e7796899f --- /dev/null +++ b/projects/ondofinance-v1/index.js @@ -0,0 +1,128 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const sdk = require("@defillama/sdk"); +const abi = require("./abi.json"); +const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); +const { default: BigNumber } = require("bignumber.js"); +const { getBlock } = require("../helper/http"); + +const NEAR_TOKEN = "0x85f17cf997934a597031b2e18a9ab6ebd4b9f6a4"; +const WETH = ADDRESSES.ethereum.WETH; + +async function addEthBalances(addresses, block, balances) { + await Promise.all( + addresses.map(async (target) => { + const ethBalance = ( + await sdk.api.eth.getBalance({ + target, + block, + }) + ).output; + + sdk.util.sumSingleBalance(balances, WETH, ethBalance); + }) + ); +} +const data = { + ondo_lps: [ + "0x9241943c29eb0B1Fc0f8E5B464fbc14915Da9A57", + "0x5d62134DBD7D56faE9Bc0b7DF3788f5f8DADE62d", + ], + ondo_all_pair_vaults: { + contracts: [ + "0xeF970A111dd6c281C40Eee6c40b43f24435833c2", + "0x2bb8de958134afd7543d4063cafad0b7c6de08bc", + ], + ignored_vault_ids: [ + "25353739650153436290862732054545997422315472318522956085559001114575751243902", + ], + }, + ondo_multisigs: [ + "0xBD9495E42ec4a2F5DF1370A6DA42Ec9a4656E963", + "0xb230B535D2cf009Bdc9D7579782DE160b795d5E8", + "0x7EBa8a9cAcb4bFbf7e1258b402A8e7aA004ED9FD", + "0x5A16e6dD9aB0bEa9a247f92c5aa0b349f2A4E4c6", + ], + supported_tokens: [ + "0x4Eb8b4C65D8430647586cf44af4Bf23dEd2Bb794", + "0x36784d3B5aa8A807698475b3437a13fA20B7E9e1", + ADDRESSES.ethereum.FRAX, + "0x3432B6A60D23Ca0dFCa7761B7ab56459D9C964D0", + "0x956F47F50A910163D8BF957Cf5846D573E7f87CA", + "0x0f2D719407FdBeFF09D87557AbB7232601FD9F29", + "0x3Ec8798B81485A254928B70CDA1cf0A2BB0B74D7", + "0x67B6D479c7bB412C54e03dCA8E1Bc6740ce6b99C", + "0x0cEC1A9154Ff802e7934Fc916Ed7Ca50bDE6844e", + "0x04Fa0d235C4abf4BcF4787aF4CF447DE572eF828", + ADDRESSES.ethereum.CVX, + "0xff20817765cb7f73d4bde2e66e067e58d11095c2", + "0xa3BeD4E1c75D00fa6f4E5E6922DB7261B5E9AcD2", + "0x470ebf5f030ed85fc1ed4c2d36b9dd02e77cf1b7", + "0x758b4684be769e92eefea93f60dda0181ea303ec", + "0xc770eefad204b5180df6a14ee197d99d808ee52d", + "0xc7283b66eb1eb5fb86327f08e1b5816b0720212b", + "0xa693B19d2931d498c5B318dF961919BB4aee87a5", + ADDRESSES.ethereum.WETH, + "0x85f17cf997934a597031b2e18a9ab6ebd4b9f6a4", + ], +}; + +async function tvl(timestamp, block, chainBlocks) { + const balances = {}; + const partner_tokens = data["supported_tokens"]; + let ondo_multisigs = data["ondo_multisigs"]; + block = await getBlock(timestamp, "ethereum", { ethereum: block }); + + if (block > 15258765) ondo_multisigs = []; + + const ondo_lps = data["ondo_lps"]; + + await addEthBalances(ondo_multisigs, block, balances); + + const tokens = [ + ...partner_tokens.map((i) => [i, false]), + ...ondo_lps.map((i) => [i, true]), + ]; + + await sumTokensAndLPsSharedOwners(balances, tokens, ondo_multisigs, block); + + if (balances[NEAR_TOKEN]) { + balances.near = BigNumber(balances[NEAR_TOKEN]) + .dividedBy(10 ** 24) + .toFixed(0); + delete balances[NEAR_TOKEN]; + } + + return balances; +} + +async function tvlForAllPairs(timestamp, block, chainBlocks) { + const ondoAllPairVaults = data["ondo_all_pair_vaults"]["contracts"]; + const ignoredVaultIds = data["ondo_all_pair_vaults"]["ignored_vault_ids"]; + let { output: vaults } = await sdk.api.abi.multiCall({ + calls: ondoAllPairVaults.map((i) => ({ target: i, params: [0, 9999] })), + block, + abi: abi.getVaults, + }); + vaults = vaults.map((i) => i.output).flat(); + const balances = {}; + for (const vault of vaults) { + if ( + !ignoredVaultIds.includes(vault.id) && + timestamp > Number(vault.startAt) && + timestamp < Number(vault.redeemAt) + ) { + vault.assets.forEach((asset) => { + sdk.util.sumSingleBalance(balances, asset.token, asset.deposited); + }); + } + } + return balances; +} + +module.exports = { + methodology: + "Counts all tokens in deployed vaults as well as Ondo's LaaS multi-sigs", + ethereum: { + tvl: sdk.util.sumChainTvls([tvlForAllPairs, tvl]), + }, +}; diff --git a/projects/ondofinance/abi.json b/projects/ondofinance/abi.json deleted file mode 100644 index 50a7bf8483d..00000000000 --- a/projects/ondofinance/abi.json +++ /dev/null @@ -1,130 +0,0 @@ -{ - "getVaults": { - "inputs": [ - { - "internalType": "uint256", - "name": "_from", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_to", - "type": "uint256" - } - ], - "name": "getVaults", - "outputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "id", - "type": "uint256" - }, - { - "components": [ - { - "internalType": "contract IERC20", - "name": "token", - "type": "address" - }, - { - "internalType": "contract ITrancheToken", - "name": "trancheToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "trancheCap", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "userCap", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deposited", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "originalInvested", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalInvested", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "received", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "rolloverDeposited", - "type": "uint256" - } - ], - "internalType": "struct IPairVault.Asset[]", - "name": "assets", - "type": "tuple[]" - }, - { - "internalType": "contract IStrategy", - "name": "strategy", - "type": "address" - }, - { - "internalType": "address", - "name": "creator", - "type": "address" - }, - { - "internalType": "address", - "name": "strategist", - "type": "address" - }, - { - "internalType": "address", - "name": "rollover", - "type": "address" - }, - { - "internalType": "uint256", - "name": "hurdleRate", - "type": "uint256" - }, - { - "internalType": "enum OLib.State", - "name": "state", - "type": "uint8" - }, - { - "internalType": "uint256", - "name": "startAt", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "investAt", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "redeemAt", - "type": "uint256" - } - ], - "internalType": "struct IPairVault.VaultView[]", - "name": "vaults", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - } -} \ No newline at end of file diff --git a/projects/ondofinance/index.js b/projects/ondofinance/index.js index bc5abb6af3f..4c91c46b45d 100644 --- a/projects/ondofinance/index.js +++ b/projects/ondofinance/index.js @@ -1,87 +1,31 @@ -const sdk = require('@defillama/sdk') -const abi = require('./abi.json') -const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs") -const { default: BigNumber } = require('bignumber.js') -const { getBlock } = require('../helper/getBlock') - -const NEAR_TOKEN = "0x85f17cf997934a597031b2e18a9ab6ebd4b9f6a4" -const WETH = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2" - -async function addEthBalances(addresses, block, balances) { - await Promise.all(addresses.map(async (target) => { - const ethBalance = ( - await sdk.api.eth.getBalance({ - target, - block, - }) - ).output; - - sdk.util.sumSingleBalance( - balances, - WETH, - ethBalance - ) - })) -} -const data = {"ondo_lps":["0x9241943c29eb0B1Fc0f8E5B464fbc14915Da9A57","0x5d62134DBD7D56faE9Bc0b7DF3788f5f8DADE62d"],"ondo_all_pair_vaults":{"contracts":["0xeF970A111dd6c281C40Eee6c40b43f24435833c2","0x2bb8de958134afd7543d4063cafad0b7c6de08bc"],"ignored_vault_ids":["25353739650153436290862732054545997422315472318522956085559001114575751243902"]},"ondo_multisigs":["0xBD9495E42ec4a2F5DF1370A6DA42Ec9a4656E963","0xb230B535D2cf009Bdc9D7579782DE160b795d5E8","0x7EBa8a9cAcb4bFbf7e1258b402A8e7aA004ED9FD","0x5A16e6dD9aB0bEa9a247f92c5aa0b349f2A4E4c6"],"supported_tokens":["0x4Eb8b4C65D8430647586cf44af4Bf23dEd2Bb794","0x36784d3B5aa8A807698475b3437a13fA20B7E9e1","0x853d955aCEf822Db058eb8505911ED77F175b99e","0x3432B6A60D23Ca0dFCa7761B7ab56459D9C964D0","0x956F47F50A910163D8BF957Cf5846D573E7f87CA","0x0f2D719407FdBeFF09D87557AbB7232601FD9F29","0x3Ec8798B81485A254928B70CDA1cf0A2BB0B74D7","0x67B6D479c7bB412C54e03dCA8E1Bc6740ce6b99C","0x0cEC1A9154Ff802e7934Fc916Ed7Ca50bDE6844e","0x04Fa0d235C4abf4BcF4787aF4CF447DE572eF828","0x4e3FBD56CD56c3e72c1403e103b45Db9da5B9D2B","0xff20817765cb7f73d4bde2e66e067e58d11095c2","0xa3BeD4E1c75D00fa6f4E5E6922DB7261B5E9AcD2","0x470ebf5f030ed85fc1ed4c2d36b9dd02e77cf1b7","0x758b4684be769e92eefea93f60dda0181ea303ec","0xc770eefad204b5180df6a14ee197d99d808ee52d","0xc7283b66eb1eb5fb86327f08e1b5816b0720212b","0xa693B19d2931d498c5B318dF961919BB4aee87a5","0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2","0x85f17cf997934a597031b2e18a9ab6ebd4b9f6a4"]}; - -async function tvl(timestamp, block, chainBlocks) { - const balances = {}; - const partner_tokens = data["supported_tokens"] - let ondo_multisigs = data["ondo_multisigs"] - block = await getBlock(timestamp, 'ethereum', { ethereum: block }) - - if (block > 15258765) - ondo_multisigs = [] - - const ondo_lps = data["ondo_lps"] - - await addEthBalances(ondo_multisigs, block, balances) - - const tokens = [ - ...partner_tokens.map(i => [i, false]), - ...ondo_lps.map(i => [i, true]), - ]; - await sumTokensAndLPsSharedOwners( - balances, - tokens, - ondo_multisigs, - block, - ); - - if (balances[NEAR_TOKEN]) { - balances.near = BigNumber(balances[NEAR_TOKEN]).dividedBy(10 ** 24).toFixed(0) - delete balances[NEAR_TOKEN] - } - - return balances; -} - -async function tvlForAllPairs(timestamp, block, chainBlocks) { - const ondoAllPairVaults = data["ondo_all_pair_vaults"]["contracts"]; - const ignoredVaultIds = data["ondo_all_pair_vaults"]["ignored_vault_ids"]; - let { output: vaults } = await sdk.api.abi.multiCall({ - calls: ondoAllPairVaults.map(i => ({ target: i, params: [0, 9999] })), - block, - abi: abi.getVaults, - }) - vaults = vaults.map(i => i.output).flat() - const balances = {} - for (const vault of vaults) { - if (!ignoredVaultIds.includes(vault.id) && timestamp > Number(vault.startAt) && timestamp < Number(vault.redeemAt)) { - vault.assets.forEach(asset => { - sdk.util.sumSingleBalance(balances, asset.token, asset.deposited) - }) - } - } - return balances -} +const sdk = require('@defillama/sdk') module.exports = { - methodology: "Counts all tokens in deployed vaults as well as Ondo's LaaS multi-sigs", - ethereum: { - tvl: sdk.util.sumChainTvls([tvlForAllPairs, tvl]) - }, + methodology: "Sums Ondo's fund supplies.", + misrepresentedTokens: true, + doublecounted: true, +}; + +const config = { + ethereum: { + OUSG: '0x1B19C19393e2d034D8Ff31ff34c81252FcBbee92', + }, + polygon: { + OUSG: '0xbA11C5effA33c4D6F8f593CFA394241CfE925811', + } } +Object.keys(config).forEach(chain => { + let funds = config[chain] + funds = Object.values(funds) + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const ethApi = new sdk.ChainApi({ chain: 'ethereum', block: _b}) + const supplies = await api.multiCall({ abi: 'erc20:totalSupply', calls: funds }) + const tokenPrice = (await ethApi.call({ abi: 'uint256:rwaPrice', target: '0xc53e6824480d976180A65415c19A6931D17265BA'})) / 1e18 + const totalTvl = (supplies.reduce((a, i) => a +i/1e18, 0) * tokenPrice) + return {'usd-coin':totalTvl} + } + } +}) \ No newline at end of file diff --git a/projects/one-ring/abi.json b/projects/one-ring/abi.json index 11a094d4eb4..a31b6dd33c1 100644 --- a/projects/one-ring/abi.json +++ b/projects/one-ring/abi.json @@ -1,25 +1,5 @@ { - "getSharePrice": { - "inputs": [], - "name": "getSharePrice", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - "totalSupply": { - "inputs": [], - "name": "totalSupply", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - "balanceWithInvested": { - "inputs": [], - "name": "balanceWithInvested", - "outputs": [ - { "internalType": "uint256", "name": "balance", "type": "uint256" } - ], - "stateMutability": "view", - "type": "function" - } -} + "getSharePrice": "uint256:getSharePrice", + "totalSupply": "uint256:totalSupply", + "balanceWithInvested": "uint256:balanceWithInvested" +} \ No newline at end of file diff --git a/projects/one-ring/index.js b/projects/one-ring/index.js index 0a56ed86084..7742ba6a291 100644 --- a/projects/one-ring/index.js +++ b/projects/one-ring/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); const { @@ -5,9 +6,9 @@ const { transformPolygonAddress, } = require("../helper/portedTokens"); const VAULT_CONTRACT_FANTOM = "0x4e332D616b5bA1eDFd87c899E534D996c336a2FC"; -const DAI_ADDRSSS_FANTOM = "0x8D11eC38a3EB5E956B052f67Da8Bdc9bef8Abf3E"; +const DAI_ADDRSSS_FANTOM = ADDRESSES.fantom.DAI; const VAULT_CONTRACT_POLYGON = "0x6C89E1cD0aa5F62cA2260709BC3895A4Cb735f6c"; -const DAI_ADDRESS_POLYGON = "0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063"; +const DAI_ADDRESS_POLYGON = ADDRESSES.polygon.DAI; async function tvlFantom(timestamp, block, chainBlocks) { const balances = {}; @@ -58,6 +59,9 @@ async function tvlPolygon(timestamp, block, chainBlocks) { } module.exports = { + hallmarks: [ + [1647907200, "Rug Pull"] + ], fantom: { tvl: tvlFantom, }, diff --git a/projects/onedaofinance/index.js b/projects/onedaofinance/index.js index ff822425b4f..fdccd8a4a4c 100644 --- a/projects/onedaofinance/index.js +++ b/projects/onedaofinance/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { ohmTvl } = require('../helper/ohm') const { getFixBalancesSync } = require('../helper/portedTokens') @@ -17,7 +18,7 @@ module.exports= { ["0x4f658217f163509115b6e1fbba37cd9aefbdba12", true], // ODAO-DAI SLP ["0x3c2b8be99c50593081eaa2a724f0b8285f5aba8f", false], // USDT ["0x985458e523db3d53125813ed68c274899e9dfab4", false], // USDC - ["0xcf664087a5bb0237a0bad6742852ec6c8d69a27a", false], // WONE + [ADDRESSES.harmony.WONE, false], // WONE ["0x224e64ec1bdce3870a6a6c777edd450454068fec", false] // WUST ], "harmony", "0x9cAc73eA219e5F8a96485c937E2C8A617f7F4f37", "0x947394294F75D7502977AC6813FD99f77C2931ec",addr=>{ return replacements[addr] || `harmony:${addr}`}, getFixBalancesSync('harmony')) diff --git a/projects/onedex/index.js b/projects/onedex/index.js new file mode 100644 index 00000000000..73fd88f9b62 --- /dev/null +++ b/projects/onedex/index.js @@ -0,0 +1,8 @@ +const { sumTokensExport } = require('../helper/sumTokens') + +module.exports = { + timetravel: false, + elrond: { + tvl: sumTokensExport({ owner: 'erd1qqqqqqqqqqqqqpgqqz6vp9y50ep867vnr296mqf3dduh6guvmvlsu3sujc', }), + }, +}; \ No newline at end of file diff --git a/projects/oneswap/index.js b/projects/oneswap/index.js index c7e030af07e..f69fc874731 100644 --- a/projects/oneswap/index.js +++ b/projects/oneswap/index.js @@ -1,38 +1,21 @@ -const utils = require('../helper/utils') -const { getApiTvl } = require('../helper/historicalApi') +const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') +const tronNull = 'T9yD14Nj9j7xAB4dbGeiX9h8unkKHxuWwb' -function getTvlChain(chain) { - return async (timestamp) => { - return getApiTvl(timestamp, - async () => { - const data = await utils.fetchURL(`https://www.oneswap.net/res/${chain}/market/statistic/total`) - return data.data.data.total_liquidity_value - }, - async () => { - const data = await utils.fetchURL(`https://www.oneswap.net/res/${chain}/market/statistic/graph/liquidity?interval=30d`) - return data.data.data.map(d => ({ - date: Math.round(new Date(d.timestamp).getTime() / 1000), - totalLiquidityUSD: d.liquidity - })) - } - ) - } +const config = { + ethereum: { factory: '0x5ed3c9089ed0355bc77cf439dc2ed28c4054c8c4' }, + bsc: { factory: '0xEeFa8Ca24dd1D573882277b917720953e999734D' }, + csc: { factory: '0xEeFa8Ca24dd1D573882277b917720953e999734D' }, + tron: { factory: 'TTw6kcn7yGExHZRuJXNP2saq6xZ7oTHne4' }, } -module.exports = { - misrepresentedTokens: true, - ethereum: { - tvl: getTvlChain("eth") - }, - csc: { - tvl: getTvlChain("cet") - }, - tron: { - tvl: getTvlChain("trx") - }, - bsc: { - tvl: getTvlChain("bnb") - }, - methodology: `Counts the liquidity on all AMM pools. Metrics come from: 'https://www.oneswap.net/eth', - 'https://www.oneswap.net/cet', 'https://www.oneswap.net/trx' and 'https://www.oneswap.net/bnb'`, -} \ No newline at end of file +Object.keys(config).forEach(chain => { + const { factory } = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const pairs = await api.fetchList({ lengthAbi: 'uint256:allPairsLength', itemAbi: 'function allPairs(uint256) view returns (address)', target: factory, permitFailure: true, }) + const data = await api.multiCall({ abi: 'function getTokensFromPair(address) view returns (address, address)', calls: pairs, target: factory}) + const ownerTokens = data.map((v, i) => [v.map(i => i === tronNull ? nullAddress : i), pairs[i]]) + return sumTokens2({ api, ownerTokens, blacklistedTokens: pairs}) + } + } +}) \ No newline at end of file diff --git a/projects/onsenswap/index.js b/projects/onsenswap/index.js new file mode 100644 index 00000000000..a5ca229177f --- /dev/null +++ b/projects/onsenswap/index.js @@ -0,0 +1,13 @@ +const { getUniTVL } = require("../helper/unknownTokens"); + +module.exports = { + misrepresentedTokens: true, + start: 1682168400, + era: { + tvl: getUniTVL({ + factory: "0x0E15a1a03bD356B17F576c50d23BF7FC00305590", + useDefaultCoreAssets: true, + fetchBalances: true, + }), + }, +}; diff --git a/projects/onus-usdo/index.js b/projects/onus-usdo/index.js new file mode 100644 index 00000000000..ad96fa1cf5b --- /dev/null +++ b/projects/onus-usdo/index.js @@ -0,0 +1,8 @@ +const { sumTokensExport } = require('../helper/unwrapLPs') +const ADDRESSES = require('../helper/coreAssets.json') + +module.exports = { + onus: { + tvl: sumTokensExport({ owner: '0x3D513abc13f53A1E18Ae59A7B5B0930E55733C87', tokens: [ADDRESSES.onus.BUSD]}) + } +} \ No newline at end of file diff --git a/projects/onyx/index.js b/projects/onyx/index.js new file mode 100644 index 00000000000..d40204bbb72 --- /dev/null +++ b/projects/onyx/index.js @@ -0,0 +1,16 @@ +const { compoundExports2 } = require('../helper/compound'); +const { staking, } = require("../helper/staking") + +const tokensAddress = { + unitroller: "0x7D61ed92a6778f5ABf5c94085739f1EDAbec2800", + oEth: "0x714bD93aB6ab2F0bcfD2aEaf46A46719991d0d79", + stakingPool: "0x23445c63FeEf8D85956dc0f19aDe87606D0e19A9", + onyx: '0xA2cd3D43c775978A96BdBf12d733D5A1ED94fb18', +}; + +module.exports = { + ethereum: { + ...compoundExports2({ comptroller: tokensAddress.unitroller, cether: tokensAddress.oEth}), + staking: staking(tokensAddress.stakingPool, tokensAddress.onyx), + }, +}; diff --git a/projects/onyxdao-farm/index.js b/projects/onyxdao-farm/index.js new file mode 100644 index 00000000000..f34721f913e --- /dev/null +++ b/projects/onyxdao-farm/index.js @@ -0,0 +1,8 @@ +const { masterChefExports, } = require("../helper/masterchef") + +const token = "0xB7cD6C8C4600AeD9985d2c0Eb174e0BEe56E8854"; +const masterchef = "0xF9C83fF6cf1A9bf2584aa2D00A7297cA8F845CcE"; + +module.exports = { + ...masterChefExports(masterchef, "arbitrum", token, false) +} \ No newline at end of file diff --git a/projects/ooki/abi.json b/projects/ooki/abi.json index 10a806b68f9..a7bf804693c 100644 --- a/projects/ooki/abi.json +++ b/projects/ooki/abi.json @@ -1,126 +1,9 @@ { - "getTokens": { - "constant": true, - "inputs": [ - { "name": "_start", "type": "uint256" }, - { "name": "_count", "type": "uint256" }, - { "name": "_tokenType", "type": "uint256" } - ], - "name": "getTokens", - "outputs": [ - { - "components": [ - { "name": "token", "type": "address" }, - { "name": "asset", "type": "address" }, - { "name": "name", "type": "string" }, - { "name": "symbol", "type": "string" }, - { "name": "tokenType", "type": "uint256" }, - { "name": "index", "type": "uint256" } - ], - "name": "tokenData", - "type": "tuple[]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "totalAssetSupply": { - "constant": true, - "inputs": [ - - ], - "name": "totalAssetSupply", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "totalAssetBorrow": { - "constant": true, - "inputs": [ - - ], - "name": "totalAssetBorrow", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - - "totalSupplyByAsset": { - "constant": true, - "inputs": [ - { "name": "asset", "type": "address" } - ], - "name": "totalSupplyByAsset", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - - "balanceOf": { - "constant": true, - "inputs": [ - { "name": "asset", "type": "address" } - ], - "name": "balanceOf", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - - "totalVested": { - "constant": true, - "inputs": [ - ], - "name": "totalVested", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - - "totalSupply": { - "constant": true, - "inputs": [ - ], - "name": "totalSupply", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } -} + "getTokens": "function getTokens(uint256 _start, uint256 _count, uint256 _tokenType) view returns (tuple(address token, address asset, string name, string symbol, uint256 tokenType, uint256 index)[] tokenData)", + "totalAssetSupply": "uint256:totalAssetSupply", + "totalAssetBorrow": "uint256:totalAssetBorrow", + "totalSupplyByAsset": "function totalSupplyByAsset(address asset) view returns (uint256)", + "balanceOf": "function balanceOf(address asset) view returns (uint256)", + "totalVested": "uint256:totalVested", + "totalSupply": "uint256:totalSupply" +} \ No newline at end of file diff --git a/projects/ooki/index.js b/projects/ooki/index.js index 899cbec465a..58f5bd90a52 100644 --- a/projects/ooki/index.js +++ b/projects/ooki/index.js @@ -1,227 +1,58 @@ - -/*================================================== -Modules -==================================================*/ -const BigNumber = require('bignumber.js'); -const sdk = require("@defillama/sdk"); -const { sumTokens } = require('../helper/unwrapLPs'); +const { sumTokens2 } = require('../helper/unwrapLPs') const { stakings } = require("../helper/staking"); const abi = require('./abi'); const registry = require('./registry'); -const itoken = require('./itoken'); -const masterchef = require('./masterchef'); - -let iTokens = []; - -let iTokensNew = []; - -const tokens = { - ethereum: { - 'bzrx': '0x56d811088235F11C8920698a204A5010a788f4b3', - 'ooki': '0x0De05F6447ab4D22c8827449EE4bA2D5C288379B', - }, - polygon: { - 'bzrx': '0x54cFe73f2c7d0c4b62Ab869B473F5512Dc0944D2', - 'ooki': '0xCd150B1F528F326f5194c012f32Eb30135C7C2c9', - }, - bsc: { - 'ooki': '0xa5a6817ac4c164F27df3254B71fE83904B1C3c3e', - }, - arbitrum: { - 'ooki': '0x400F3ff129Bc9C9d239a567EaF5158f1850c65a4', - }, - optimism: { - } -} const contracts = { - ethereum: { - 'protocol': '0xD8Ee69652E4e4838f2531732a46d1f7F584F0b7f', - 'registry': '0xf0E474592B455579Fe580D610b846BdBb529C6F7', - }, - polygon: { - 'protocol': '0x059D60a9CEfBc70b9Ea9FFBb9a041581B1dFA6a8', - 'registry': '0x4B234781Af34E9fD756C27a47675cbba19DC8765', - }, - bsc: { - 'protocol': '0xD154eE4982b83a87b0649E5a7DDA1514812aFE1f', - 'registry': '0x1BE70f29D30bB1D325E5D76Ee73109de3e50A57d', - }, - arbitrum: { - 'protocol': '0x37407F3178ffE07a6cF5C847F8f680FEcf319FAB', - 'registry': '0x86003099131d83944d826F8016E09CC678789A30', - }, - optimism: { - 'protocol': '0xAcedbFd5Bc1fb0dDC948579d4195616c05E74Fd1', - 'registry': '0x22a2208EeEDeb1E2156370Fd1c1c081355c68f2B', - } -} - -/*================================================== -Main -==================================================*/ -async function eth(timestamp, block, chainBlocks) { -return getBalances(timestamp, block, chainBlocks, 'ethereum') -} - -async function bsc(timestamp, block, chainBlocks) { -return getBalances(timestamp, block, chainBlocks, 'bsc') -} - -async function polygon(timestamp, block, chainBlocks) { -return getBalances(timestamp, block, chainBlocks, 'polygon') -} - -async function optimism(timestamp, block, chainBlocks) { -return getBalances(timestamp, block, chainBlocks, 'optimism') -} - -async function arbitrum(timestamp, block, chainBlocks) { -return getBalances(timestamp, block, chainBlocks, 'arbitrum') + ethereum: { + 'protocol': '0xD8Ee69652E4e4838f2531732a46d1f7F584F0b7f', + 'registry': '0xf0E474592B455579Fe580D610b846BdBb529C6F7', + }, + polygon: { + 'protocol': '0x059D60a9CEfBc70b9Ea9FFBb9a041581B1dFA6a8', + 'registry': '0x4B234781Af34E9fD756C27a47675cbba19DC8765', + }, + bsc: { + 'protocol': '0xD154eE4982b83a87b0649E5a7DDA1514812aFE1f', + 'registry': '0x1BE70f29D30bB1D325E5D76Ee73109de3e50A57d', + }, + arbitrum: { + 'protocol': '0x37407F3178ffE07a6cF5C847F8f680FEcf319FAB', + 'registry': '0x86003099131d83944d826F8016E09CC678789A30', + }, + optimism: { + 'protocol': '0xAcedbFd5Bc1fb0dDC948579d4195616c05E74Fd1', + 'registry': '0x22a2208EeEDeb1E2156370Fd1c1c081355c68f2B', + } } -async function getBalances(timestamp, block, chainBlocks, network) { - let balances = {}; - const balanceOfCalls = []; - const getTokensResult = await sdk.api.abi.call({ - chainBlocks, - target: contracts[network].registry, - params: [0, 200], - chain: network, - abi: registry.getTokens - }); - - getTokensResult.output.forEach((token) =>{ - iTokensNew.push({ - iTokenAddress: token[0], - underlyingAddress: token[1] - }); - - const target = token[1]; - balanceOfCalls.push({ target: target, params: contracts[network].protocol }); - }); - - iTokens = iTokens.concat(iTokensNew); - const iTokenCalls = iTokens.map((iToken) => ({ - target: iToken.iTokenAddress - })); +async function getBalances(api, isBorrowed) { + const network = api.chain ?? 'ethereum' + const info = await api.call({ + target: contracts[network].registry, + params: [0, 200], + abi: registry.getTokens + }) + if (!isBorrowed) + return sumTokens2({ api, tokensAndOwners: info.map(i => [i.asset, i.token]) }) - const supplyResult = await sdk.api.abi.multiCall({ - chainBlocks, - calls: iTokenCalls, - chain: network, - abi: abi.totalAssetSupply - }); - - const borrowResult = await sdk.api.abi.multiCall({ - chainBlocks, - calls: iTokenCalls, - chain: network, - abi: abi.totalAssetBorrow - }); - - iTokens.forEach((iToken) => { - const supply = supplyResult.output.find((result) => (result.input.target === iToken.iTokenAddress)); - const borrow = borrowResult.output.find((result) => (result.input.target === iToken.iTokenAddress)); - - const totalSupply = (supply && supply.success)?supply.output:0; - const totalBorrow = (borrow && borrow.success)?borrow.output:0; - - if (totalSupply > totalBorrow) { - const token = iToken.underlyingAddress; - balances[token] = BigNumber(totalSupply).minus(totalBorrow).toFixed(); - } - }); - - - //Balances - const balanceOfs = await sdk.api.abi.multiCall({ - chainBlocks, - calls: balanceOfCalls, - chain: network, - abi: abi["balanceOf"], - }); - - for(let i = 0; i{ - balances[remap(key, network)] = balances[key]; - delete balances[key] - }) - - - return balances; + const borrowedBals = await api.multiCall({ abi: abi.totalAssetBorrow, calls: info.map(i => i.token) }) + api.addTokens(info.map(i => i.asset), borrowedBals) } -function remap(token, network){ - if(token === tokens[network].bzrx){ - token = 'ethereum:'+tokens['ethereum'].bzrx; - } - else{ - token = network+':'+token; - } - return token -} - -/*================================================== -Staking and Treasury -==================================================*/ - let ooki = '0x0De05F6447ab4D22c8827449EE4bA2D5C288379B' let bzrx = '0x56d811088235F11C8920698a204A5010a788f4b3' -const treasuryContract = '0xfedC4dD5247B93feb41e899A09C44cFaBec29Cbc' let stakingContracts = [ - '0xe95Ebce2B02Ee07dEF5Ed6B53289801F7Fc137A4', - '0x16f179f5c344cc29672a58ea327a26f64b941a63' -] - -let TreasureTokens = [ - '0x56d811088235F11C8920698a204A5010a788f4b3', //bzrx - '0x0De05F6447ab4D22c8827449EE4bA2D5C288379B', //ooki - //'vbzrx': '0xB72B31907C1C95F3650b64b2469e08EdACeE5e8F', vesting tokens not counted - '0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490', //pool3 + '0xe95Ebce2B02Ee07dEF5Ed6B53289801F7Fc137A4', + '0x16f179f5c344cc29672a58ea327a26f64b941a63' ] -let ookistaking = stakings(stakingContracts, ooki, 'ethereum') -let bzrxstaking = stakings(stakingContracts, bzrx, 'ethereum') - -async function ethTreasury(timestamp, _block, { ethereum: block }) { - const toa = TreasureTokens.map(t => [t, treasuryContract]) - return sumTokens({}, toa, block, 'ethereum') +Object.keys(contracts).forEach(chain => { + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => getBalances(api, false), + borrowed: async (_, _b, _cb, { api, }) => getBalances(api, true), } - -/*================================================== -Exports -==================================================*/ - -module.exports = { - ethereum:{ - tvl: eth, - staking: sdk.util.sumChainTvls([ookistaking,bzrxstaking]), - treasury: ethTreasury - }, - polygon:{ - tvl: polygon - }, - bsc:{ - tvl: bsc - }, - arbitrum:{ - tvl: arbitrum - }, - optimism:{ - tvl: optimism - }, -}; - +}) +module.exports.ethereum.staking = stakings(stakingContracts, [ooki, bzrx]) diff --git a/projects/ooki/itoken.json b/projects/ooki/itoken.json index 7c228da0123..0d3d3c06988 100644 --- a/projects/ooki/itoken.json +++ b/projects/ooki/itoken.json @@ -1,62 +1,6 @@ { - "avgBorrowInterestRate": { - "constant": true, - "inputs": [], - "name": "avgBorrowInterestRate", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "totalAssetBorrow": { - "constant": true, - "inputs": [], - "name": "totalAssetBorrow", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "supplyInterestRate": { - "constant": true, - "inputs": [], - "name": "supplyInterestRate", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "borrowInterestRate": { - "constant": true, - "inputs": [], - "name": "borrowInterestRate", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } -} + "avgBorrowInterestRate": "uint256:avgBorrowInterestRate", + "totalAssetBorrow": "uint256:totalAssetBorrow", + "supplyInterestRate": "uint256:supplyInterestRate", + "borrowInterestRate": "uint256:borrowInterestRate" +} \ No newline at end of file diff --git a/projects/ooki/masterchef.json b/projects/ooki/masterchef.json index 360913313e6..84eaf4e3ceb 100644 --- a/projects/ooki/masterchef.json +++ b/projects/ooki/masterchef.json @@ -1,35 +1,4 @@ { - "balanceOf": { - "constant": true, - "inputs": [ - { "name": "pid", "type": "uint256" } - ], - "name": "balanceOf", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - - "userInfo": { - "constant": true, - "inputs": [ - { "internalType": "uint256", "name": "pid", "type": "uint256" }, - { "internalType": "uint256", "name": "owner", "type": "address" } - ], - "name": "userInfo", - "outputs": - [ - { "name": "amount", "type": "uint256" }, - { "name": "rewardDebt", "type": "uint256" } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } -} + "balanceOf": "function balanceOf(uint256 pid) view returns (uint256)", + "userInfo": "function userInfo(uint256 pid, address owner) view returns (uint256 amount, uint256 rewardDebt)" +} \ No newline at end of file diff --git a/projects/ooki/registry.json b/projects/ooki/registry.json index 40344e0f259..9d5fbdf2ff9 100644 --- a/projects/ooki/registry.json +++ b/projects/ooki/registry.json @@ -1,40 +1,3 @@ { - "getTokens": { - "constant": true, - "inputs": [ - { - "internalType": "uint256", - "name": "_start", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_count", - "type": "uint256" - } - ], - "name": "getTokens", - "outputs": [ - { - "components": [ - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "address", - "name": "asset", - "type": "address" - } - ], - "internalType": "struct TokenRegistry.TokenMetadata[]", - "name": "metadata", - "type": "tuple[]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } + "getTokens": "function getTokens(uint256 _start, uint256 _count) view returns (tuple(address token, address asset)[] metadata)" } \ No newline at end of file diff --git a/projects/oolongswap/index.js b/projects/oolongswap/index.js index 3df13a6855a..18e768251b2 100644 --- a/projects/oolongswap/index.js +++ b/projects/oolongswap/index.js @@ -3,7 +3,6 @@ const { getUniTVL } = require('../helper/unknownTokens') module.exports = { boba: { tvl: getUniTVL({ - chain: 'boba', factory: '0x7DDaF116889D655D1c486bEB95017a8211265d29', useDefaultCoreAssets: true, }) diff --git a/projects/oortswap/index.js b/projects/oortswap/index.js index f40ad1ccb93..4e2202bc3ed 100644 --- a/projects/oortswap/index.js +++ b/projects/oortswap/index.js @@ -6,7 +6,6 @@ module.exports = { "Factory address (0xac15fe2C74bD635EfAF687F302633C7e5EbfF973) is used to find the LP pairs. TVL is equal to the liquidity on the AMM.", rei: { tvl: getUniTVL({ - chain: 'rei', factory: '0xac15fe2C74bD635EfAF687F302633C7e5EbfF973', useDefaultCoreAssets: true, }) diff --git a/projects/openbook/index.js b/projects/openbook/index.js index ecad73c13da..072f8a7bae0 100644 --- a/projects/openbook/index.js +++ b/projects/openbook/index.js @@ -1,34 +1,35 @@ -const { graphQuery } = require('../helper/http') +const { getConnection, decodeAccount, } = require('../helper/solana') const sdk = require('@defillama/sdk') +const { PublicKey } = require("@solana/web3.js") +const blacklistedTokens = new Set([ + '674PmuiDtgKx3uKuJ1B16f9m5L84eFvNwj3xDMvHcbo7', // $WOOD + 'SNSNkV9zfG5ZKWQs6x4hxvBRV6s8SqMfSGCtECDvdMd', // SNS + 'A7rqejP8LKN8syXMr4tvcKjs2iJ4WtZjXNs1e6qP3m9g', // ZION + 'NGK3iHqqQkyRZUj4uhJDQqEyKKcZ7mdawWpqwMffM3s', //YAKU +]) -const endpoint = 'http://51.159.109.243:8079' +async function tvl(_, _1, _2, { api }) { + const connection = getConnection() + + const programPublicKey = new PublicKey('srmqPvymJeFKQ4zGQed1GFppgkRHL9kaELCbyksJtPX') + const programAccounts = await connection.getProgramAccounts(programPublicKey, { + filters: [{ dataSize: 388 }] + }); + sdk.log('#markets', programAccounts.length) + + programAccounts.forEach((account) => { + const market = decodeAccount('openbook', account.account) + const baseToken = market.baseMint.toBase58() + const quoteToken = market.quoteMint.toBase58() + const baseBal = +market.baseDepositsTotal + +market.baseFeesAccrued + const quoteBal = +market.quoteDepositsTotal + +market.quoteFeesAccrued + if (!blacklistedTokens.has(baseToken)) api.add(baseToken, baseBal) + if (!blacklistedTokens.has(quoteToken)) api.add(quoteToken, quoteBal) + }); + +} module.exports = { timetravel: false, - solana: { - tvl: async () => { - const query = ` - { - markets { - baseVault - quoteVault - baseMint - quoteMint - stats { - tvlBase - tvlQuote - } - } - } - ` - - const { markets } = await graphQuery(endpoint, query) - const balances = {} - markets.forEach(i => { - sdk.util.sumSingleBalance(balances,i.baseMint,i.stats.tvlBase, 'solana') - sdk.util.sumSingleBalance(balances,i.quoteMint,i.stats.tvlQuote, 'solana') - }) - return balances - } - } -} \ No newline at end of file + solana: { tvl, }, +} diff --git a/projects/opendao/abi.json b/projects/opendao/abi.json index 992dfd7f835..b6ed2c18037 100644 --- a/projects/opendao/abi.json +++ b/projects/opendao/abi.json @@ -1,142 +1,10 @@ { - "getAllMarkets": { - "constant": true, - "inputs": [], - "name": "getAllMarkets", - "outputs": [ - { - "internalType": "contract CToken[]", - "name": "", - "type": "address[]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "getCash": { - "constant": true, - "inputs": [], - "name": "getCash", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "underlying": { - "constant": true, - "inputs": [], - "name": "underlying", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "symbol": { - "constant": true, - "inputs": [], - "name": "symbol", - "outputs": [ - { - "name": "", - "type": "string" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "totalBorrows": { - "constant": true, - "inputs": [], - "name": "totalBorrows", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "poolInfo": { - "constant": true, - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "poolInfo", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "lpToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "allocPoint", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastRewardBlock", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accSushiPerShare", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "poolLength": { - "constant": true, - "inputs": [], - "name": "poolLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "cash": { - "constant": true, - "inputs": [], - "name": "cash", - "outputs": [ - { - "internalType": "contract ERC20Detailed", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } -} + "getAllMarkets": "address[]:getAllMarkets", + "getCash": "uint256:getCash", + "underlying": "address:underlying", + "symbol": "string:symbol", + "totalBorrows": "uint256:totalBorrows", + "poolInfo": "function poolInfo(uint256) view returns (address lpToken, uint256 allocPoint, uint256 lastRewardBlock, uint256 accSushiPerShare)", + "poolLength": "uint256:poolLength", + "cash": "address:cash" +} \ No newline at end of file diff --git a/projects/openeden-tbill/index.js b/projects/openeden-tbill/index.js new file mode 100644 index 00000000000..d5a4d63f311 --- /dev/null +++ b/projects/openeden-tbill/index.js @@ -0,0 +1,12 @@ +async function tvl(_, _b, _cb, { api, }) { + const contract = '0xad6250f0bd49f7a1eb11063af2ce9f25b9597b0f' + const [bal, token] = await api.batchCall([ + { abi: 'uint256:assetsAvailable', target: contract }, + { abi: 'address:asset', target: contract }, + ]) + api.add(token, bal) +} + +module.exports = { + ethereum: { tvl }, +} \ No newline at end of file diff --git a/projects/openleverage/index.js b/projects/openleverage/index.js index 91ebef21668..725d4446165 100644 --- a/projects/openleverage/index.js +++ b/projects/openleverage/index.js @@ -1,132 +1,36 @@ -const {gql, GraphQLClient} = require("graphql-request"); -const utils = require("../helper/utils"); const { sumTokens2 } = require('../helper/unwrapLPs') -const openleve_address = { - "eth" : '0x03bf707deb2808f711bb0086fc17c5cafa6e8aaf', - "bsc" : '0x6A75aC4b8d8E76d15502E69Be4cb6325422833B4', - "kcc" : '0xEF6890d740E1244fEa42E3D1B9Ff515C24c004Ce' -} -const subgraph_endpoint = { - "eth" : 'https://api.thegraph.com/subgraphs/name/openleveragedev/openleverage', - "bsc" : 'https://api.thegraph.com/subgraphs/name/openleveragedev/openleverage-bsc' -} -const http_endpoint = { - "kcc" : { - size: 20, - firstPage: 1, - getDataURL: (page, size) => `https://kcc.openleverage.finance/api/trade/markets/stat?page=${page}&size=${size}`, - }, -} - -async function eth_tvl(timestamp, block) { - const poolInfo = await getPoolFromSubgraph("eth"); - const toa = [] - for (const pool of poolInfo["poolAddressList"]) { - const poolToken = poolInfo["poolToken"][pool] - toa.push([poolToken, pool]) - } - for (const token of poolInfo["tokenAddressList"]) { - toa.push([token, openleve_address["eth"]]) - } - return sumTokens2({ block, tokensAndOwners: toa, }) -} - -async function bsc_tvl(timestamp, _block, { bsc: block }) { - const toa = [] - const poolInfo = await getPoolFromSubgraph("bsc"); - for (const pool of poolInfo["poolAddressList"]) { - const poolToken = poolInfo["poolToken"][pool] - toa.push([poolToken, pool]) - } - for (const token of poolInfo["tokenAddressList"]) { - toa.push([token, openleve_address["bsc"]]) - } - return sumTokens2({ chain: 'bsc', block, tokensAndOwners: toa, }) -} - -async function getPoolFromSubgraph(chain) { - var sql = gql`{ - pairs(first: 1000) { - id - token0 { - id - } - token1 { - id - } - pool0 - pool1 - } - } - `; - var graphQLClient = new GraphQLClient(subgraph_endpoint[chain]) - const results = await graphQLClient.request(sql) - const tokenAddressList = [] - const poolAddressList = [] - const poolToken = {} - for (const s of results["pairs"]) { - tokenAddressList.push(s["token0"]["id"]) - poolAddressList.push(s["pool0"]) - poolToken[s["pool0"]] = s["token0"]["id"] - - tokenAddressList.push(s["token1"]["id"]) - poolAddressList.push(s["pool1"]) - poolToken[s["pool1"]] = s["token1"]["id"] - } - return {"tokenAddressList" : Array.from(new Set(tokenAddressList)), "poolAddressList" : poolAddressList, "poolToken": poolToken} -} - -async function getPoolFromHttp(chain) { - const { size, firstPage, getDataURL } = http_endpoint[chain] - let fetchNext = true - let page = firstPage - const results = [] - while (fetchNext) { - const { data: { data: result }} = await utils.fetchURL(getDataURL(page, size)) - fetchNext = size === result.length - page++ - results.push(...result) - } - - const tokenAddressList = [] - const poolAddressList = [] - const poolToken = {} - for (const s of results) { - tokenAddressList.push(s["token0Addr"]) - poolAddressList.push(s["pool0Addr"]) - poolToken[s["pool0Addr"]] = s["token1Addr"] - - tokenAddressList.push(s["token1Addr"]) - poolAddressList.push(s["pool1Addr"]) - poolToken[s["pool1Addr"]] = s["token0Addr"] - } - return {"tokenAddressList" : Array.from(new Set(tokenAddressList)), "poolAddressList" : poolAddressList, "poolToken": poolToken} -} - -async function kcc_tvl(timestamp, _block, { kcc: block }) { - const toa = [] - const poolInfo = await getPoolFromHttp("kcc"); - for (const pool of poolInfo["poolAddressList"]) { - const poolToken = poolInfo["poolToken"][pool] - toa.push([poolToken, pool]) - } - - for (const token of poolInfo["tokenAddressList"]) { - toa.push([token, openleve_address["kcc"]]) - } - return sumTokens2({ chain: 'kcc', block, tokensAndOwners: toa, }) -} - -module.exports = { - methodology: "get pool and token address from the openleverage subgraph", - ethereum: { - tvl: eth_tvl - }, - bsc: { - tvl: bsc_tvl - }, - kcc: { - tvl: kcc_tvl - } -} \ No newline at end of file +const config = { + ethereum: '0x03bf707deb2808f711bb0086fc17c5cafa6e8aaf', + bsc: '0x6A75aC4b8d8E76d15502E69Be4cb6325422833B4', + kcc: '0xEF6890d740E1244fEa42E3D1B9Ff515C24c004Ce', + arbitrum: '0x2925671dc7f2def9e4ad3fa878afd997f0b4db45' +} +// openleverage overcollateralized-borrowing-contracts +const borrowConfig = { + bsc: '0xf436f8fe7b26d87eb74e5446acec2e8ad4075e47', + arbitrum: '0xe7779ebb5c28ccd6d3dcf13920b06402ca52189c' +} +module.exports = {}; + +Object.keys(config).forEach(chain => { + const openLevAddr = config[chain] + const borrowAddr = borrowConfig[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const data = await api.fetchList({ lengthAbi: 'uint256:numPairs', itemAbi: "function markets(uint16) view returns (address pool0, address pool1, address token0, address token1, uint16 marginLimit, uint16 feesRate, uint16 priceDiffientRatio, address priceUpdater, uint256 pool0Insurance, uint256 pool1Insurance)", target: openLevAddr }) + const tokensAndOwners = data.map(i => { + const toa = [ + [i.token0, openLevAddr], + [i.token0, i.pool0], + [i.token1, openLevAddr], + [i.token1, i.pool1], + ] + if (borrowAddr) + toa.push([i.token0, borrowAddr], [i.token1, borrowAddr],) + return toa + }).flat() + return sumTokens2({ api, tokensAndOwners }) + } + } +}) \ No newline at end of file diff --git a/projects/opensky/index.js b/projects/opensky/index.js index f6da3ada785..1466f2914a4 100644 --- a/projects/opensky/index.js +++ b/projects/opensky/index.js @@ -1,100 +1,44 @@ -const { default: BigNumber } = require("bignumber.js"); -const { parseEther } = require("ethers/lib/utils"); -const { request, gql } = require("graphql-request"); -const axios = require("axios"); +const { getLogs } = require('../helper/cache/getLogs') +const { sumTokens2 } = require('../helper/unwrapLPs') const sdk = require('@defillama/sdk') -const graphUrl = 'https://api.studio.thegraph.com/query/30874/openskyfinancefallback/v0.0.2' - -const graphReservesQuery = gql` -query GET_RESERVES { - reserves { - id name symbol underlyingAsset oTokenAddress totalDeposits totalAmountOfBespokeLoans totalAmountOfInstantLoans interestPerSecondOfInstantLoans - } -} -`; - -const graphCollectionsQuery = gql` -query GET_COLLECTION_LOANS ($limit: Int) { - collections(first: $limit) { - id - numberOfBespokeLoans - numberOfInstantLoans - } +const abi = { + create: 'event Create(uint256 indexed reserveId, address indexed underlyingAsset, address indexed oTokenAddress, string name, string symbol, uint8 decimals)', + getAvailableLiquidity: "function getAvailableLiquidity(uint256 reserveId) view returns (uint256)", + getTotalBorrowBalance: "function getTotalBorrowBalance(uint256 reserveId) view returns (uint256)", } -`; -async function tvl(timestamp, block, chainBlocks) { +async function tvl(timestamp, block, chainBlocks, { api }) { const balances = {}; - - const { reserves } = await request(graphUrl, graphReservesQuery); - - reserves.forEach(i => { - sdk.util.sumSingleBalance(balances, i.underlyingAsset, BigNumber(i.totalDeposits).minus(i.totalAmountOfInstantLoans).minus(i.totalAmountOfBespokeLoans).toFixed(0)) - }); - - sdk.util.sumSingleBalance(balances, 'ethereum', (await collateral()) / 1e18) - return balances; + const factory = '0xdae29a91f663faf7657594f908e183e3b826d437' + const logs = await getLogs({ + api, + target: factory, + topics: ['0xa974e5e75ec9215fd423fc8e00fbfed574e4e36bfa650d4c54ffc9b12224d105'], + fromBlock: 15223160, + eventAbi: abi.create + }) + const deposits = await api.multiCall({ abi: abi.getAvailableLiquidity, calls: logs.map(i => i.args.reserveId.toString()), target: factory }) + deposits.map((val, i) => sdk.util.sumSingleBalance(balances,logs[i].args.underlyingAsset,val, api.chain)) + return sumTokens2({ api, owner: '0x87d6dec027e167136b081f888960fe48bb10328a', resolveNFTs: true, balances, }) } -async function borrowed(timestamp, block, chainBlocks) { +async function borrowed(timestamp, block, chainBlocks, { api }) { const balances = {}; - const { reserves } = await request(graphUrl, graphReservesQuery); - - reserves.forEach(i => { - sdk.util.sumSingleBalance(balances, i.underlyingAsset, BigNumber(i.totalAmountOfInstantLoans).plus(i.totalAmountOfBespokeLoans).toFixed(0)) - }); - - return balances; -} - -async function getFloorPrice(address) { - const url = `https://api.nftbank.ai/estimates-v2/floor_price/${address}?chain_id=ETHEREUM` - const { data } = await axios.get(url, - { - headers: { - 'x-api-key': '70c3d2af9df9a83f2b64b055484347ee' - }, - retries: 3 - } - ) - return data.data[0].floor_price.filter(item => item.currency_symbol == 'ETH')[0].floor_price -} - -async function collateral() { - let { collections } = await request( - graphUrl, - graphCollectionsQuery, - { limit: 100 } - ); - - collections = collections.filter(collection => - collection.numberOfBespokeLoans > 0 || collection.numberOfInstantLoans > 0 - ); - - const floorPrices = await Promise.all( - collections.map(collection => - getFloorPrice(collection.id) - ) - ); - - let collateralValue = new BigNumber(0); - - collections.forEach((collection, index) => { - collateralValue = collateralValue.plus( - new BigNumber( - parseEther( - floorPrices[index] * (parseInt(collection.numberOfBespokeLoans) + parseInt(collection.numberOfInstantLoans)) + '' - ).toString() - ) - ) - }); - - return collateralValue.toString(); + const factory = '0xdae29a91f663faf7657594f908e183e3b826d437' + const logs = await getLogs({ + api, + target: factory, + topics: ['0xa974e5e75ec9215fd423fc8e00fbfed574e4e36bfa650d4c54ffc9b12224d105'], + fromBlock: 15223160, + eventAbi: abi.create + }) + const borrowed = await api.multiCall({ abi: abi.getTotalBorrowBalance, calls: logs.map(i => i.args.reserveId.toString()), target: factory }) + borrowed.map((val, i) => sdk.util.sumSingleBalance(balances,logs[i].args.underlyingAsset,val, api.chain)) + return balances } module.exports = { - timetravel: false, methodology: `Counts the tokens locked in the contracts to be used as collateral to borrow or to earn yield. Borrowed coins are not counted towards the TVL, so only the coins actually locked in the contracts are counted. There's multiple reasons behind this but one of the main ones is to avoid inflating the TVL through cycled lending`, ethereum: { tvl, diff --git a/projects/openswap_harmony/index.js b/projects/openswap_harmony/index.js index 78b3fbd8b5e..f9e21141a41 100644 --- a/projects/openswap_harmony/index.js +++ b/projects/openswap_harmony/index.js @@ -4,7 +4,6 @@ module.exports = { harmony: { tvl: getUniTVL({ factory: '0x5d2f9817303b940c9bb4f47c8c566c5c034d9848', - chain: 'harmony', useDefaultCoreAssets: true, blacklist: [ '0xed0b4b0f0e2c17646682fc98ace09feb99af3ade', // RVRS diff --git a/projects/openworld/index.js b/projects/openworld/index.js new file mode 100644 index 00000000000..d5580cf7082 --- /dev/null +++ b/projects/openworld/index.js @@ -0,0 +1,7 @@ +const { gmxExports } = require('../helper/gmx') + +module.exports = { + arbitrum: { + tvl: gmxExports({ vault: '0xec45801399EB38B75A3bf793051b00bb64fF3eF8', }) + }, +} \ No newline at end of file diff --git a/projects/openxswap/index.js b/projects/openxswap/index.js new file mode 100644 index 00000000000..54cf9275661 --- /dev/null +++ b/projects/openxswap/index.js @@ -0,0 +1,17 @@ +const {getUniTVL} = require('../helper/unknownTokens') +const { staking } = require('../helper/staking') + +const OpenX = "0xc3864f98f2a61A7cAeb95b039D031b4E2f55e0e9" +const OpenXStaking = "0x2513486f18eeE1498D7b6281f668B955181Dd0D9" + +module.exports = { + misrepresentedTokens: true, + optimism:{ + tvl: getUniTVL({ + factory: '0xf3C7978Ddd70B4158b53e897f980093183cA5c52', + useDefaultCoreAssets: true, + }), + staking: staking(OpenXStaking, OpenX, 'optimism') + }, +} + diff --git a/projects/optidoge/index.js b/projects/optidoge/index.js index b920dce9416..5952b44af6a 100644 --- a/projects/optidoge/index.js +++ b/projects/optidoge/index.js @@ -1,8 +1,9 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk') const {pool2Exports} = require("../helper/pool2") const {stakingUnknownPricedLP} = require("../helper/staking") -const weth = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2' +const weth = ADDRESSES.ethereum.WETH async function tvl(time, _ethBlock, {optimism: block}){ const eth = await sdk.api.eth.getBalance({ target: '0xc911523c466b4E1dADE1bac9A2D4ceA3F9E1A2ae', diff --git a/projects/optifi/index.js b/projects/optifi/index.js index 4dbb1a83dcf..b203bea5571 100644 --- a/projects/optifi/index.js +++ b/projects/optifi/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { Program } = require("@project-serum/anchor"); const { getProvider, sumTokens2, } = require("../helper/solana"); const idl = require('./idl.json') @@ -14,7 +15,7 @@ async function tvl() { } const tokens = [ - 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v', // USDC + ADDRESSES.solana.USDC, // USDC ] const serumPCVaults = [ diff --git a/projects/optim-liquidity-bonds/index.js b/projects/optim-liquidity-bonds/index.js new file mode 100644 index 00000000000..11e43782372 --- /dev/null +++ b/projects/optim-liquidity-bonds/index.js @@ -0,0 +1,13 @@ +const { get } = require('../helper/http') + +module.exports = { + timetravel: false, + cardano: { + tvl: async () => { + const data = await get('https://spo-server.optim.finance/tvl') + return { + cardano: data.historicalData.totalLovelace/1e6 + } + } + }, +}; diff --git a/projects/optinyan/index.js b/projects/optinyan/index.js index e4e25bf5538..a075ac1808f 100644 --- a/projects/optinyan/index.js +++ b/projects/optinyan/index.js @@ -1,6 +1,7 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk') -const weth = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2' +const weth = ADDRESSES.ethereum.WETH async function tvl(time, _ethBlock, {optimism: block}){ const eth = await sdk.api.eth.getBalance({ target: '0x6F7Fe8b33358a3F4313421186b98CA78127C6DB6', diff --git a/projects/optitude/index.js b/projects/optitude/index.js new file mode 100644 index 00000000000..67f5ac73255 --- /dev/null +++ b/projects/optitude/index.js @@ -0,0 +1,11 @@ +const { yieldHelper, } = require("../helper/yieldHelper") + +const contract = '0x6a063c12aD67B7Ec793ad3E86E6a16177F01C12D' +const opt = '0xAd669b6cf06704e9D3b8D1d85A275623A1bD8288' + +module.exports = yieldHelper({ + project: 'optitude-finance', + chain: 'optimism', + masterchef: contract, + nativeToken: opt, +}) \ No newline at end of file diff --git a/projects/optyfi/index.js b/projects/optyfi/index.js index 7362160029c..673e4f58e99 100644 --- a/projects/optyfi/index.js +++ b/projects/optyfi/index.js @@ -1,39 +1,15 @@ const sdk = require("@defillama/sdk"); -const axios = require("axios"); +const { getConfig } = require('../helper/cache') const optyfi_api = "https://api.opty.fi"; const get_vaults_api = `${optyfi_api}/v1/yield/vaults`; const abi = { - totalSupply: { - inputs: [], - name: "totalSupply", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, - getPricePerFullShare: { - inputs: [], - name: "getPricePerFullShare", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, + totalSupply: "uint256:totalSupply", + getPricePerFullShare: "uint256:getPricePerFullShare", }; async function getTVL(chain, block, chain_id) { - const vaults = (await axios.get(get_vaults_api)).data.items.filter(i => !i.is_staging && i.chain.chain_id === chain_id) + const vaults = (await getConfig('optyfi', get_vaults_api)).items.filter(i => !i.is_staging && i.chain.chain_id === chain_id) const calls = vaults.map(i => ({ target: i.vault_token.address })) const { output: supply } = await sdk.api.abi.multiCall({ abi: abi.totalSupply, diff --git a/projects/opx/index.js b/projects/opx/index.js index ae61abadd2d..92cda1ac29f 100644 --- a/projects/opx/index.js +++ b/projects/opx/index.js @@ -2,6 +2,6 @@ const { gmxExports } = require('../helper/gmx') module.exports = { optimism: { - tvl: gmxExports({ chain: 'optimism', vault: '0xb94C36A74c8504Dea839C119aeaF2e615364253F', }) + tvl: gmxExports({ vault: '0xb94C36A74c8504Dea839C119aeaF2e615364253F', }) }, } \ No newline at end of file diff --git a/projects/opyn-convexity/index.js b/projects/opyn-convexity/index.js new file mode 100644 index 00000000000..d17957ca5e3 --- /dev/null +++ b/projects/opyn-convexity/index.js @@ -0,0 +1,35 @@ +const { sumTokens2 } = require('../helper/unwrapLPs') + +const getNumberOfOptionsContractsAbi = "uint256:getNumberOfOptionsContracts"; +const optionsContractsAbi = "function optionsContracts(uint256) view returns (address)"; +const collateralAbi = "address:collateral" + +const factoriesAddresses = [ + "0xb529964F86fbf99a6aA67f72a27e59fA3fa4FEaC", + "0xcC5d905b9c2c8C9329Eb4e25dc086369D6C7777C" +] + +async function tvl(_, _b, _cb, { api, }) { + let contracts = await Promise.all( + factoriesAddresses.map(i => api.fetchList({ + target: i, + lengthAbi: getNumberOfOptionsContractsAbi, + itemAbi: optionsContractsAbi, + })) + ) + + contracts = contracts.flat() + const collaterals = await api.multiCall({ + abi: collateralAbi, + calls: contracts, + }) + + const tokensAndOwners = collaterals.map((t, i) => ([t, contracts[i]])) + return sumTokens2({ api, tokensAndOwners}) +} + +module.exports = { + ethereum: { + tvl + }, +}; \ No newline at end of file diff --git a/projects/opyn-gamma/gamma_avax.js b/projects/opyn-gamma/gamma_avax.js new file mode 100644 index 00000000000..a3c07443f35 --- /dev/null +++ b/projects/opyn-gamma/gamma_avax.js @@ -0,0 +1,7 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require('../helper/unwrapLPs') + +const marginPool = "0xCCF6629aEaB734E621Cc59EBb0297196774fDb9D"; +const wavax = ADDRESSES.avax.WAVAX.toLowerCase() + +module.exports = sumTokensExport({ owner: marginPool, tokens: [wavax]}) diff --git a/projects/opyn-gamma/gamma_ethereum.js b/projects/opyn-gamma/gamma_ethereum.js new file mode 100644 index 00000000000..3deb85d4b5a --- /dev/null +++ b/projects/opyn-gamma/gamma_ethereum.js @@ -0,0 +1,28 @@ +const { getLogs } = require('../helper/cache/getLogs') +const { sumTokens2 } = require('../helper/unwrapLPs') + +const START_BLOCK = 11551118; +const whitelist = "0xa5ea18ac6865f315ff5dd9f1a7fb1d41a30a6779"; +const marginPool = "0x5934807cc0654d46755ebd2848840b616256c6ef"; + +function toAddress(str, skip = 0) { + return `0x${str.slice(64 - 40 + 2 + skip * 64, 64 + 2 + skip * 64)}`.toLowerCase(); +} + +module.exports = async function ethereumTvl(timestamp, block, _1, { api }) { + let balances = {}; + + if(block >= START_BLOCK) { + const whitelistedCollaterals = await getLogs({ + target: whitelist, + topic: 'CollateralWhitelisted(address)', + api, + fromBlock: 11544457, + }) + + const tokens = whitelistedCollaterals.map(log => toAddress(log.topics[1])) + return sumTokens2({ tokens, owner: marginPool, api, }) + } + + return balances; +} \ No newline at end of file diff --git a/projects/opyn-gamma/gamma_polygon.js b/projects/opyn-gamma/gamma_polygon.js new file mode 100644 index 00000000000..8ba14c5fce0 --- /dev/null +++ b/projects/opyn-gamma/gamma_polygon.js @@ -0,0 +1,10 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const marginPool = "0x30ae5debc9edf60a23cd19494492b1ef37afa56d"; +const WETH = ADDRESSES.polygon.WETH_1; +const collateralAssets = [ADDRESSES.polygon.WMATIC_2, + ADDRESSES.polygon.USDC, + ADDRESSES.polygon.WBTC, WETH, ] + +const { sumTokensExport } = require('../helper/unwrapLPs') + +module.exports = sumTokensExport({ owner: marginPool, tokens: collateralAssets}) diff --git a/projects/opyn-gamma/index.js b/projects/opyn-gamma/index.js new file mode 100644 index 00000000000..762f7964a78 --- /dev/null +++ b/projects/opyn-gamma/index.js @@ -0,0 +1,17 @@ +const avaxTvl = require('./gamma_avax'); +const ethereumTvl = require('./gamma_ethereum'); +const polygonTvl = require('./gamma_polygon'); + + +module.exports = { + ethereum: { + tvl: ethereumTvl + }, + avax:{ + tvl: avaxTvl + }, + polygon: { + tvl: polygonTvl + } +} + \ No newline at end of file diff --git a/projects/opyn-squeeth/index.js b/projects/opyn-squeeth/index.js new file mode 100644 index 00000000000..c33c840b9d8 --- /dev/null +++ b/projects/opyn-squeeth/index.js @@ -0,0 +1,33 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokens2 } = require('../helper/unwrapLPs') + +const START_BLOCK = 13982541; +const controller = "0x64187ae08781B09368e6253F9E94951243A493D5".toLowerCase(); +const ETH = ADDRESSES.null; +const WETH = ADDRESSES.ethereum.WETH.toLowerCase(); + +const uniPool = '0x82c427adfdf2d245ec51d8046b41c4ee87f0d29c'; + + +module.exports = { + ethereum: { + tvl: async (timestamp, block, _, { api })=> { + let balances = {}; + + if(block >= START_BLOCK) { + + return sumTokens2({ api, tokensAndOwners: [ + [ETH, controller], + [WETH, uniPool], + ]}) + } + + return balances; + } + }, + hallmarks: [ + [1643053740, "Crab v1 launch"], + [1659055140, "Crab v2 launch"], + [1671221995, "Zen Bull launch"] + ] +}; \ No newline at end of file diff --git a/projects/opyn/abis/convexity/collateral.json b/projects/opyn/abis/convexity/collateral.json deleted file mode 100644 index 67764cd258a..00000000000 --- a/projects/opyn/abis/convexity/collateral.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "constant": true, - "inputs": [], - "name": "collateral", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" -} \ No newline at end of file diff --git a/projects/opyn/abis/convexity/getNumberOfOptionsContracts.json b/projects/opyn/abis/convexity/getNumberOfOptionsContracts.json deleted file mode 100644 index 95dd4d4537f..00000000000 --- a/projects/opyn/abis/convexity/getNumberOfOptionsContracts.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "constant": true, - "inputs": [], - "name": "getNumberOfOptionsContracts", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" -} \ No newline at end of file diff --git a/projects/opyn/abis/convexity/optionsContracts.json b/projects/opyn/abis/convexity/optionsContracts.json deleted file mode 100644 index 5695190a23f..00000000000 --- a/projects/opyn/abis/convexity/optionsContracts.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "constant": true, - "inputs": [ - { - "name": "", - "type": "uint256" - } - ], - "name": "optionsContracts", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" -} \ No newline at end of file diff --git a/projects/opyn/abis/gamma/isWhitelistedCollateral.json b/projects/opyn/abis/gamma/isWhitelistedCollateral.json deleted file mode 100644 index ca3af0b31b5..00000000000 --- a/projects/opyn/abis/gamma/isWhitelistedCollateral.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "inputs": [ - { - "internalType": "address", - "name": "_collateral", - "type": "address" - } - ], - "name": "isWhitelistedCollateral", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function", - "constant": true -} \ No newline at end of file diff --git a/projects/opyn/convexity.js b/projects/opyn/convexity.js deleted file mode 100644 index b55b99ee0d9..00000000000 --- a/projects/opyn/convexity.js +++ /dev/null @@ -1,115 +0,0 @@ -const sdk = require('@defillama/sdk'); - -const BigNumber = require('bignumber.js'); - -const getNumberOfOptionsContractsAbi = require('./abis/convexity/getNumberOfOptionsContracts.json'); -const optionsContractsAbi = require('./abis/convexity/optionsContracts.json'); -const collateralAbi = require('./abis/convexity/collateral.json'); - -const factoriesAddresses = [ - "0xb529964F86fbf99a6aA67f72a27e59fA3fa4FEaC", - "0xcC5d905b9c2c8C9329Eb4e25dc086369D6C7777C" -] - -module.exports.tvl = async function tvl(timestamp, block) { - let balances = {}; - - for(let i = 0; i < factoriesAddresses.length; i++) { - // number of created oTokens - let numberOfOptionsContracts = ( - await sdk.api.abi.call({ - target: factoriesAddresses[i], - abi: getNumberOfOptionsContractsAbi, - }) - ).output; - - // batch getOptionsContracts calls - let getOptionsContractsCalls = []; - - for(let j = 0; j < numberOfOptionsContracts; j++) { - getOptionsContractsCalls.push({ - target: factoriesAddresses[i], - params: j - }) - } - - let optionsContracts = ( - await sdk.api.abi.multiCall({ - calls: getOptionsContractsCalls, - abi: optionsContractsAbi, - block - }) - ).output; - - // list of options addresses - let optionsAddresses = [] - - optionsContracts.forEach(async (contracts) => { - if(contracts.output != null) { - optionsAddresses = [ - ...optionsAddresses, - contracts.output - ] - } - }); - - // batch getCollateralAsset calls - let getCollateralAssetCalls = []; - - optionsAddresses.forEach((optionAddress) => { - getCollateralAssetCalls.push({ - target: optionAddress - }) - }) - - // get list of options collateral assets - let optionsCollateral = ( - await sdk.api.abi.multiCall({ - calls: getCollateralAssetCalls, - abi: collateralAbi, - block - }) - ).output; - - let optionsCollateralAddresses = [] - - optionsCollateral.forEach(async (collateralAsset) => { - // only consider supported tokens - if((collateralAsset.output.toLowerCase() != null) && (collateralAsset.output.toLowerCase() !== "0x0000000000000000000000000000000000000000") && (!optionsCollateralAddresses.includes(collateralAsset.output.toLowerCase())) ) { - optionsCollateralAddresses = [ - ...optionsCollateralAddresses, - collateralAsset.output.toLowerCase() - ] - } - }); - - // get ETH balance - optionsAddresses.forEach(async (optionAddress) => { - let balance = (await sdk.api.eth.getBalance({target: optionAddress, block})).output; - sdk.util.sumSingleBalance(balances, "0x0000000000000000000000000000000000000000", balance) - }) - - // batch balanceOf calls - let balanceOfCalls = []; - - optionsCollateralAddresses.forEach(async (optionCollateralAddress) => { - optionsAddresses.forEach((optionAddress) => { - balanceOfCalls.push({ - target: optionCollateralAddress, - params: [optionAddress] - }); - }) - }); - - // get tokens balances - const balanceOfResults = await sdk.api.abi.multiCall({ - block, - calls: balanceOfCalls, - abi: "erc20:balanceOf" - }); - - sdk.util.sumMultiBalanceOf(balances, balanceOfResults, false); - } - - return balances; -} \ No newline at end of file diff --git a/projects/opyn/gamma.js b/projects/opyn/gamma.js deleted file mode 100644 index a3030c1943a..00000000000 --- a/projects/opyn/gamma.js +++ /dev/null @@ -1,85 +0,0 @@ -const sdk = require('@defillama/sdk'); -const BigNumber = require('bignumber.js'); - -const START_BLOCK = 11551118; -const whitelist = "0xa5ea18ac6865f315ff5dd9f1a7fb1d41a30a6779"; -const marginPool = "0x5934807cc0654d46755ebd2848840b616256c6ef"; -const yvUSDC = "0x5f18c75abdae578b483e5f43f12a39cf75b973a9"; -const usdc = '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48'; -const sdeCRV = "0xa2761B0539374EB7AF2155f76eb09864af075250".toLowerCase(); -const sdcrvWSBTC = "0x24129b935aff071c4f0554882c0d9573f4975fed".toLowerCase(); -const sdcrvFrax = "0x5af15da84a4a6edf2d9fa6720de921e1026e37b7".toLowerCase(); -const frax = "0x853d955acef822db058eb8505911ed77f175b99e".toLowerCase(); -const WBTC = '0x2260fac5e5542a773aa44fbcfedf7c193bc2c599'.toLowerCase(); -const ETH = '0x0000000000000000000000000000000000000000'.toLowerCase(); - -function toAddress(str, skip = 0) { - return `0x${str.slice(64 - 40 + 2 + skip * 64, 64 + 2 + skip * 64)}`.toLowerCase(); -} - -const yvUSDC2="0xa354f35829ae975e850e23e9615b11da1b3dc4de" - -const transforms = { - [yvUSDC]:usdc, - [sdeCRV]:ETH, - // [sdcrvWSBTC]: WBTC, - [yvUSDC2]:usdc, - [sdcrvFrax]: frax -} - -const transform = addr=>transforms[addr]??addr - -module.exports.tvl = async function tvl(timestamp, block) { - let balances = {}; - - if(block >= START_BLOCK) { - // get ETH balance - const balance = (await sdk.api.eth.getBalance({target: marginPool, block})).output; - balances[ETH] = BigNumber(balances[ETH] || 0).plus(BigNumber(balance)).toFixed(); - - const whitelistedCollaterals = await sdk.api.util.getLogs({ - target: whitelist, - topic: 'CollateralWhitelisted(address)', - keys: [], - fromBlock: 11544457, - toBlock: block - }) - - const balanceCalls = [] - - whitelistedCollaterals.output.forEach(async (log) => { - const collateralAsset = toAddress(log.topics[1]).toLowerCase(); - - const ignored = [ETH, sdcrvWSBTC] - if(!ignored.includes(collateralAsset)) { - balanceCalls.push({ - target: collateralAsset, - params: marginPool - }) - } - }); - - const balanceOfs = await sdk.api.abi.multiCall({ - abi: "erc20:balanceOf", - calls: balanceCalls, - block - }) - - sdk.util.sumMultiBalanceOf(balances, balanceOfs, true, transform) - - // Add sdcrvWSBTC as WBTC to balances - const sdcrvWSBTCBalance = ( - await sdk.api.abi.call({ - target: sdcrvWSBTC, - params: marginPool, - abi: 'erc20:balanceOf', - block - }) - ).output; - - balances[WBTC] = BigNumber(balances[WBTC] || 0).plus(BigNumber(sdcrvWSBTCBalance / 10 ** 10)).toFixed(0); - - } - - return balances; -} \ No newline at end of file diff --git a/projects/opyn/gamma_avax.js b/projects/opyn/gamma_avax.js deleted file mode 100644 index be74ed47eb7..00000000000 --- a/projects/opyn/gamma_avax.js +++ /dev/null @@ -1,23 +0,0 @@ -const sdk = require('@defillama/sdk'); - -const marginPool = "0xCCF6629aEaB734E621Cc59EBb0297196774fDb9D"; -const wavax = '0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7'.toLowerCase() - -module.exports.tvl = async function tvl(timestamp, block) { - - let balances = {}; - - const wavaxBalance = ( - await sdk.api.abi.call({ - target: wavax, - params: marginPool, - abi: 'erc20:balanceOf', - block, - chain: 'avax' - }) - ); - - sdk.util.sumSingleBalance(balances, `avax:${wavax}`, wavaxBalance.output) - - return balances; -} \ No newline at end of file diff --git a/projects/opyn/gamma_polygon.js b/projects/opyn/gamma_polygon.js deleted file mode 100644 index c418f1fbda3..00000000000 --- a/projects/opyn/gamma_polygon.js +++ /dev/null @@ -1,47 +0,0 @@ -const sdk = require('@defillama/sdk'); -const { transformPolygonAddress } = require("../helper/portedTokens"); - -const marginPool = "0x30ae5debc9edf60a23cd19494492b1ef37afa56d"; -const WETH = "0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619"; - -module.exports.tvl = async function tvl(timestamp, block, chainBlocks) { - let balances = {}; - - - const balanceCalls = [] - // WMATIC, PoS USDC, PoS WBTC are the collateral assets - const collateralAssets = ['0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270', - '0x2791bca1f2de4661ed88a30c99a7a9449aa84174', - '0x1bfd67037b42cf73acf2047067bd4f2c47d9bfd6']; - - collateralAssets.forEach(collateralAsset => { - balanceCalls.push({ - target: collateralAsset, - params: marginPool - }) - }); - - const transform = await transformPolygonAddress(); - const balanceOfs = await sdk.api.abi.multiCall({ - abi: 'erc20:balanceOf', - calls: balanceCalls, - chain: 'polygon', - block: chainBlocks.polygon - }) - - sdk.util.sumMultiBalanceOf(balances, balanceOfs, false, transform) - - // Calculate TVL of Locked WETH on margin pool - const wethBalance = ( - await sdk.api.abi.call({ - target: WETH, - params: marginPool, - abi: 'erc20:balanceOf', - block: chainBlocks.polygon, - chain: 'polygon', - }) - ).output; - sdk.util.sumSingleBalance(balances, `polygon:${WETH}`, wethBalance); - - return balances; -} \ No newline at end of file diff --git a/projects/opyn/index.js b/projects/opyn/index.js deleted file mode 100644 index 636ac58c2c1..00000000000 --- a/projects/opyn/index.js +++ /dev/null @@ -1,30 +0,0 @@ -const sdk = require('@defillama/sdk'); -const BigNumber = require('bignumber.js'); -const v1TVL = require('./convexity'); -const v2TVL = require('./gamma'); -const v2AvaxTVL = require('./gamma_avax'); -const gammaPolygonTVL = require('./gamma_polygon'); -const squeethTVL = require('./squeeth'); - -async function avaxTvl(_, ethBlock, chainBlock) { - const avaxBalances = await v2AvaxTVL.tvl(_, chainBlock.avax); - return avaxBalances; -} - -module.exports = { - ethereum: { - tvl: sdk.util.sumChainTvls([v1TVL.tvl, v2TVL.tvl, squeethTVL.tvl]) - }, - avax:{ - tvl: avaxTvl - }, - polygon: { - tvl: sdk.util.sumChainTvls([gammaPolygonTVL.tvl]) - }, - hallmarks: [ - [1619493707, "Ribbon launch"], - [1641855660, "Squeeth launch"], - [1643053740, "Crab v1 launch"], - [1659055140, "Crab v2 launch"] - ] -} diff --git a/projects/opyn/squeeth.js b/projects/opyn/squeeth.js deleted file mode 100644 index 8584ca3a8a3..00000000000 --- a/projects/opyn/squeeth.js +++ /dev/null @@ -1,36 +0,0 @@ -const sdk = require('@defillama/sdk'); -const BigNumber = require('bignumber.js'); - -const START_BLOCK = 13982541; -const controller = "0x64187ae08781B09368e6253F9E94951243A493D5".toLowerCase(); -const ETH = '0x0000000000000000000000000000000000000000'; -const WETH = '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2'.toLowerCase(); - -const uniPool = '0x82c427adfdf2d245ec51d8046b41c4ee87f0d29c'; - -module.exports.tvl = async function tvl(timestamp, block) { - let balances = {}; - - if(block >= START_BLOCK) { - // get ETH balance in squeeth vaults - const balanceVault = (await sdk.api.eth.getBalance({ target: controller, block})).output; - balances[ETH] = BigNumber(balances[ETH] || 0).plus(BigNumber(balanceVault)).toFixed(0); - - // get ETH balance in squeeth pool - const balancePool = ( - await sdk.api.abi.call({ - target: WETH, - params: uniPool, - abi: 'erc20:balanceOf', - block - }) - ); - - balances[ETH] = BigNumber(balances[ETH] || 0).plus(BigNumber(balancePool.output)).toFixed(0); - - } - - - - return balances; -} \ No newline at end of file diff --git a/projects/oraidex/index.js b/projects/oraidex/index.js new file mode 100644 index 00000000000..d9dc64d9cc7 --- /dev/null +++ b/projects/oraidex/index.js @@ -0,0 +1,12 @@ +const { getFactoryTvl } = require('../terraswap/factoryTvl') +const sdk = require('@defillama/sdk') +const factories = ["orai1hemdkz4xx9kukgrunxu3yw0nvpyxf34v82d2c8", 'orai167r4ut7avvgpp3rlzksz6vw5spmykluzagvmj3ht845fjschwugqjsqhst'] + +module.exports = { + timetravel: false, + misrepresentedTokens: true, + methodology: "Liquidity on the DEX", + orai: { + tvl: sdk.util.sumChainTvls(factories.map(getFactoryTvl)) + }, +} \ No newline at end of file diff --git a/projects/orbitbridge/index.js b/projects/orbitbridge/index.js index 9f9060c7804..d8c2c57980c 100644 --- a/projects/orbitbridge/index.js +++ b/projects/orbitbridge/index.js @@ -1,64 +1,41 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk') -const utils = require('../helper/utils') +const { get } = require('../helper/http') +const { getConfig } = require('../helper/cache') const { sumTokensExport } = require('../helper/sumTokens') const { sumTokens2 } = require('../helper/unwrapLPs') +const { transformBalances } = require('../helper/portedTokens') +const { nullAddress } = require('../helper/tokenMapping'); const ABI = { - wantLockedTotal: { - "inputs": [], - "name": "wantLockedTotal", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - farms: { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "farms", - "outputs": [ - { - "internalType": "address payable", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } + wantLockedTotal: "uint256:wantLockedTotal", + farms: "function farms(address) view returns (address)" } + const vaults = { bsc: '0x89c527764f03BCb7dC469707B23b79C1D7Beb780', celo: '0x979cD0826C2bf62703Ef62221a4feA1f23da3777', ethereum: '0x1bf68a9d1eaee7826b3593c20a0ca93293cb489a', heco: '0x38C92A7C2B358e2F2b91723e5c4Fc7aa8b4d279F', klaytn: '0x9abc3f6c11dbd83234d6e6b2c373dfc1893f648d', - polygon: '0x506DC4c6408813948470a06ef6e4a1DaF228dbd5' + polygon: '0x506DC4c6408813948470a06ef6e4a1DaF228dbd5', + meta: '0x292A00F3b99e3CB9b324EdbaA92258C3C61b55ab', + wemix: '0x445F863df0090f423A6D7005581e30d5841e4D6d' } const farms = { bsc: [ - '0x0000000000000000000000000000000000000000',// BNB - '0x55d398326f99059ff775485246999027b3197955',// USDT-B - '0xe9e7cea3dedca5984780bafc599bd69add087d56',// BUSD + ADDRESSES.null,// BNB + ADDRESSES.bsc.USDT,// USDT-B + ADDRESSES.bsc.BUSD,// BUSD '0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82',// CAKE ], ethereum: [ - '0x0000000000000000000000000000000000000000',// ETH - '0xdAC17F958D2ee523a2206206994597C13D831ec7',// USDT - '0x6B175474E89094C44Da98b954EedeAC495271d0F',// DAI - '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',// USDC - '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599',// WBTC + ADDRESSES.null,// ETH + ADDRESSES.ethereum.USDT,// USDT + ADDRESSES.ethereum.DAI,// DAI + ADDRESSES.ethereum.USDC,// USDC + ADDRESSES.ethereum.WBTC,// WBTC ] } @@ -72,13 +49,15 @@ function chainTvls(chain) { if (chain === 'polygon') targetChain = 'matic' const tokenListURL = 'https://bridge.orbitchain.io/open/v1/api/monitor/rawTokenList' - tokenData = tokenData || utils.fetchURL(tokenListURL) - const { data } = await tokenData + tokenData = tokenData || getConfig('orbit-bridge', tokenListURL) + const data = await tokenData - let tokenList = data.origins.filter(x => x.chain === targetChain).map(x => x.address) - const tokensAndOwners = tokenList.map(i => ([i, vault])) - const balances = await sumTokens2({ tokensAndOwners, chain, block, blacklistedTokens: [ - // '0x662b67d00a13faf93254714dd601f5ed49ef2f51' // ORC, blacklist project's own token + let tokenList = data.origins.filter(x => x.chain === targetChain && !x.is_nft).map(x => x.address) + tokenList.push(nullAddress) + const balances = await sumTokens2({ owner: vault, tokens: tokenList, chain, block, blacklistedTokens: [ + '0x662b67d00a13faf93254714dd601f5ed49ef2f51' // ORC, blacklist project's own token + // reason for skipping, most of the tvl comes from this transaction which is about 25% of ORU supply on ETH + // https://etherscan.io/tx/0x0a556fcef2a867421ec3941251ad3c10ae1402a23ddd9ad4b1097b686ced89f7 ] }) if (farms[chain]) { @@ -101,7 +80,6 @@ function chainTvls(chain) { module.exports = { methodology: 'Tokens locked in Orbit Bridge contract are counted as TVL', - misrepresentedTokens: true, timetravel: false, bsc: { tvl: chainTvls('bsc') @@ -121,7 +99,20 @@ module.exports = { polygon: { tvl: chainTvls('polygon') }, + meta: { + tvl: chainTvls('meta') + }, + wemix: { + tvl: chainTvls('wemix') + }, ripple: { tvl: sumTokensExport({ chain: 'ripple', owner: 'rLcxBUrZESqHnruY4fX7GQthRjDCDSAWia'}) - } + }, + ton: { + tvl: async () => { + let ton_vault = "EQAtkbV8ysI75e7faO8Ihu0mFtmsg-osj7gmrTg_mljVRccy" + const res = await get(`https://tonapi.io/v1/account/getInfo?account=${ton_vault}`) + return await transformBalances('ton', {[ADDRESSES.null]: res.balance}) + } + }, } \ No newline at end of file diff --git a/projects/orbiter-one/index.js b/projects/orbiter-one/index.js new file mode 100644 index 00000000000..e142370c62c --- /dev/null +++ b/projects/orbiter-one/index.js @@ -0,0 +1,11 @@ +const { compoundExports2 } = require('../helper/compound') + +const moonbeamConfig = { + comptroller: "0x27DC3DAdBfb40ADc677A2D5ef192d40aD7c4c97D", + cether: "0xCc444ca6bba3764Fc55BeEFe4FFA27435cF6c259", + fetchBalances: true, +} + +module.exports = { + moonbeam: compoundExports2(moonbeamConfig) +} \ No newline at end of file diff --git a/projects/orca-kujira/index.js b/projects/orca-kujira/index.js new file mode 100644 index 00000000000..0bd465e0bac --- /dev/null +++ b/projects/orca-kujira/index.js @@ -0,0 +1,21 @@ +const { sumTokens } = require('../helper/chain/cosmos') +const { getConfig } = require("../helper/cache"); + + +async function tvl() { + const contracts = await getConfig("kujira/contracts", "https://raw.githubusercontent.com/Team-Kujira/kujira.js/master/src/resources/contracts.json"); + const orcaPools = contracts["kaiyo-1"].orca.map(x => x.address) + const owners = [ + ...orcaPools, + ] + return sumTokens({ owners, chain: 'kujira' }) +} + +module.exports = { + hallmarks: [ + [1673740800, "TVL separated into products"] + ], + kujira: { + tvl, + }, +} diff --git a/projects/orca/index.js b/projects/orca/index.js index 009769e9fb0..a3c21e323d8 100644 --- a/projects/orca/index.js +++ b/projects/orca/index.js @@ -1,24 +1,223 @@ -const axios = require('axios'); +const { getProvider, sumTokens2, exportDexTVL, } = require('../helper/solana') +const { Program, } = require("@project-serum/anchor"); +const sdk = require('@defillama/sdk') -const endpoint = "https://api.orca.so/pools"; -const wpEndpoint = "https://mainnet-zp2-v2.orca.so/pools"; - -async function fetch() { - const [pools, whirlpools] = await Promise.all([axios.get(endpoint), axios.get(wpEndpoint)]); - const poolsTvl = pools.data.reduce((sum, pool) => - sum + pool.liquidity - , 0); - const wpTvl = whirlpools.data.reduce((sum, pool) => - sum + pool.tvl - , 0); - return poolsTvl + wpTvl; +async function tvl() { + const provider = getProvider() + const programId = 'whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc' + const program = new Program(whirpoolIDL, programId, provider) + const whirlpools = await program.account.whirlpool.all() + const tokenAccounts = whirlpools.map(({ account}) => [account.tokenVaultA, account.tokenVaultB]).flat() + return sumTokens2({ tokenAccounts, }) } +/* async function orcaPoolTvlViaConfig() { + const tokenAccounts = [] + const v1ProgramId = 'DjVE6JNiYqPL2QXyCUUh8rNjHrbz9hXHNYt99MQ59qw1' + const { pools } = await getConfig('orca/pools', 'https://api.orca.so/configs') + Object.values(pools).forEach(i => { + tokenAccounts.push(i.tokenAccountA) + tokenAccounts.push(i.tokenAccountB) + }) + return sumTokens2({ tokenAccounts, blacklistedTokens, }) +} */ + +const orcaV1Tvl = exportDexTVL('DjVE6JNiYqPL2QXyCUUh8rNjHrbz9hXHNYt99MQ59qw1') +const orcaV2Tvl = exportDexTVL('9W959DqEETiGZocYWCQPaJ6sBmUzgfxXfqGeTEdp3aQP') + module.exports = { - timetravel: false, - fetch, - hallmarks:[ - [1628565707, "Token+LM launch"], - [1667865600, "FTX collapse"] - ] + timetravel: false, + solana: { + tvl: sdk.util.sumChainTvls([orcaV1Tvl, orcaV2Tvl, tvl]) + }, + hallmarks: [ + [1628565707, "Token+LM launch"], + [1667865600, "FTX collapse"] + ] }; + +const whirpoolIDL = { + version: '0.2.0', + name: 'whirlpool', + instructions: [], + accounts: [ + { + name: 'whirlpoolsConfig', + type: { + kind: 'struct', + fields: [ + { + name: 'feeAuthority', + type: 'publicKey' + }, + { + name: 'collectProtocolFeesAuthority', + type: 'publicKey' + }, + { + name: 'rewardEmissionsSuperAuthority', + type: 'publicKey' + }, + { + name: 'defaultProtocolFeeRate', + type: 'u16' + } + ] + } + }, + { + name: 'whirlpool', + type: { + kind: 'struct', + fields: [ + { + name: 'whirlpoolsConfig', + type: 'publicKey' + }, + { + name: 'whirlpoolBump', + type: { + array: [ + 'u8', + 1 + ] + } + }, + { + name: 'tickSpacing', + type: 'u16' + }, + { + name: 'tickSpacingSeed', + type: { + array: [ + 'u8', + 2 + ] + } + }, + { + name: 'feeRate', + type: 'u16' + }, + { + name: 'protocolFeeRate', + type: 'u16' + }, + { + name: 'liquidity', + type: 'u128' + }, + { + name: 'sqrtPrice', + type: 'u128' + }, + { + name: 'tickCurrentIndex', + type: 'i32' + }, + { + name: 'protocolFeeOwedA', + type: 'u64' + }, + { + name: 'protocolFeeOwedB', + type: 'u64' + }, + { + name: 'tokenMintA', + type: 'publicKey' + }, + { + name: 'tokenVaultA', + type: 'publicKey' + }, + { + name: 'feeGrowthGlobalA', + type: 'u128' + }, + { + name: 'tokenMintB', + type: 'publicKey' + }, + { + name: 'tokenVaultB', + type: 'publicKey' + }, + { + name: 'feeGrowthGlobalB', + type: 'u128' + }, + { + name: 'rewardLastUpdatedTimestamp', + type: 'u64' + }, + { + name: 'rewardInfos', + type: { + array: [ + { + defined: 'WhirlpoolRewardInfo' + }, + 3 + ] + } + } + ] + } + } + ], + types: [ + { + name: 'WhirlpoolRewardInfo', + docs: [ + 'Stores the state relevant for tracking liquidity mining rewards at the `Whirlpool` level.', + 'These values are used in conjunction with `PositionRewardInfo`, `Tick.reward_growths_outside`,', + 'and `Whirlpool.reward_last_updated_timestamp` to determine how many rewards are earned by open', + 'positions.' + ], + type: { + kind: 'struct', + fields: [ + { + name: 'mint', + docs: [ + 'Reward token mint.' + ], + type: 'publicKey' + }, + { + name: 'vault', + docs: [ + 'Reward vault token account.' + ], + type: 'publicKey' + }, + { + name: 'authority', + docs: [ + 'Authority account that has permission to initialize the reward and set emissions.' + ], + type: 'publicKey' + }, + { + name: 'emissionsPerSecondX64', + docs: [ + 'Q64.64 number that indicates how many tokens per second are earned per unit of liquidity.' + ], + type: 'u128' + }, + { + name: 'growthGlobalX64', + docs: [ + 'Q64.64 number that tracks the total tokens earned per unit of liquidity since the reward', + 'emissions were turned on.' + ], + type: 'u128' + } + ] + } + } + ], + errors: [] +} diff --git a/projects/orcadao/abi.json b/projects/orcadao/abi.json index 7babc50c2e0..f6ff36d195e 100644 --- a/projects/orcadao/abi.json +++ b/projects/orcadao/abi.json @@ -1,9 +1,3 @@ { - "totalDebt": { - "inputs": [], - "name": "totalDebt", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - } -} + "totalDebt": "uint256:totalDebt" +} \ No newline at end of file diff --git a/projects/orcadao/index.js b/projects/orcadao/index.js index 50737ff714e..2ab76ac03e6 100644 --- a/projects/orcadao/index.js +++ b/projects/orcadao/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); @@ -18,7 +19,7 @@ const banksAndCollateral = [ ["0x330cc45c8f60fef7f9d271a7512542b3d201a48d","0x64D56b4B6C844015EC07e52A1267D5d5d4F4E5BD"], // YAK BENQI WBTC ["0x9669fe1ea0d8883661289461b90a10b71ae400ee","0xEa03cDCdD912522400d21Ee89A5bC46Bffe11AC3"], // YAK BENQI DAI ["0x07b0e11d80ccf75cb390c9be6c27f329c119095a","0xAf8d16500A58b868C34be9106d674b820d67C979"], // YAK BENQI USDT - ["0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7","0xC029713E92383426C9b387b124C0BF6271d08b80"], // AVAX + [ADDRESSES.avax.WAVAX,"0xC029713E92383426C9b387b124C0BF6271d08b80"], // AVAX ["0x8b414448de8b609e96bd63dcf2a8adbd5ddf7fdd","0x2b583646EC93245562Fd08A3b5f44Aa55417766B"], // YAK BENQI AVAX ["0x0eac97a78a93b75549d49145df41dbe9cd520874","0xd694F97dd5874fA4e712FDFB781231D93642D29b"], // YAK BENQI USDC ["0x957ca4a4aa7cdc866cf430bb140753f04e273bc0","0x8aee038726715d78C49dFb2f12e76DE70C2F48eC"], // YAK AAVE AVAX @@ -28,22 +29,22 @@ const banksAndCollateral = [ ["0x3a91a592a06390ca7884c4d9dd4cba2b4b7f36d1","0xa1A34E32c24911daA45e338dB9D785c1b323F280"], // YAK JOE ["0x0f7f48d4b66bf5a53d4f21fa6ffca45f70cef770","0x18419976Ba05dd9cE44544B8d91590704aFA4a29"], // YAK AAVE WBTC ["0xbf5bffbf7d94d3b29abe6eb20089b8a9e3d229f7","0xC09caDDA753c54292BeB1D10429bD175556b8b5E"], // YAK QI - ["0x49d5c2bdffac6ce2bfdb6640f4f80f226bc10bab","0x4805D6563B36a02C5012c11d6e15552f50066d58"], // WETH + [ADDRESSES.avax.WETH_e,"0x4805D6563B36a02C5012c11d6e15552f50066d58"], // WETH ["0x50b7545627a5162f82a992c33b87adc75187b218","0x1eA60d781376C06693dFB21d7e5951cAEc13F7E4"], // WBTC ] const translateToken = { - "0x957ca4a4aa7cdc866cf430bb140753f04e273bc0": "avax:0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7", + "0x957ca4a4aa7cdc866cf430bb140753f04e273bc0": "avax:" + ADDRESSES.avax.WAVAX, "0x0f7f48d4b66bf5a53d4f21fa6ffca45f70cef770": "avax:0x50b7545627a5162f82a992c33b87adc75187b218", - "0xb634a71a54d3382ff6896eb22244b4a4e54c0a82": "avax:0x49d5c2bdffac6ce2bfdb6640f4f80f226bc10bab", - "0x3a91a592a06390ca7884c4d9dd4cba2b4b7f36d1": "avax:0x6e84a6216ea6dacc71ee8e6b0a5b7322eebc0fdd", + "0xb634a71a54d3382ff6896eb22244b4a4e54c0a82": "avax:" + ADDRESSES.avax.WETH_e, + "0x3a91a592a06390ca7884c4d9dd4cba2b4b7f36d1": "avax:" + ADDRESSES.avax.JOE, "0x8b414448de8b609e96bd63dcf2a8adbd5ddf7fdd": "avax:0x8729438eb15e2c8b576fcc6aecda6a148776c0f5", "0x4084f32a91f4d8636ca08386efe70c6e302f1d84": "avax:0x5947bb275c521040051d82396192181b413227a3", - "0x9669fe1ea0d8883661289461b90a10b71ae400ee": "avax:0xd586e7f844cea2f87f50152665bcbc2c279d8d70", + "0x9669fe1ea0d8883661289461b90a10b71ae400ee": "avax:" + ADDRESSES.avax.DAI, "0x330cc45c8f60fef7f9d271a7512542b3d201a48d": "avax:0x50b7545627a5162f82a992c33b87adc75187b218", - "0x07b0e11d80ccf75cb390c9be6c27f329c119095a": "avax:0x9702230a8ea53601f5cd2dc00fdbc13d4df4a8c7", - "0x0eac97a78a93b75549d49145df41dbe9cd520874": "avax:0xa7d7079b0fead91f3e65f86e8915cb59c1a4c664", - "0x7d2d076000611e44740d636843384412399e31b9": "avax:0x49d5c2bdffac6ce2bfdb6640f4f80f226bc10bab", + "0x07b0e11d80ccf75cb390c9be6c27f329c119095a": "avax:" + ADDRESSES.avax.USDt, + "0x0eac97a78a93b75549d49145df41dbe9cd520874": "avax:" + ADDRESSES.avax.USDC_e, + "0x7d2d076000611e44740d636843384412399e31b9": "avax:" + ADDRESSES.avax.WETH_e, "0xbf5bffbf7d94d3b29abe6eb20089b8a9e3d229f7": "avax:0x8729438eb15e2c8b576fcc6aecda6a148776c0f5" } @@ -76,7 +77,7 @@ async function borrowed(timestamp, block, chainBlocks) { } const treasuryContract = "0x10131d4f3193a59A46d3ab57D765f2604e77B4E3"; -const usdc = "0xa7d7079b0fead91f3e65f86e8915cb59c1a4c664" +const usdc = ADDRESSES.avax.USDC_e const ocraAvaiPGL = "0x1A9Bd67c82C0e8E47C3ad2FA772FCb9B7A831A37"; const orcaWavaxPGL = "0x73e6CB72a79dEa7ed75EF5eD6f8cFf86C9128eF5"; const avaiUsdc = "0xeD7a2B4054757Cfdb632Af15Ad528624F0fFf3B0"; diff --git a/projects/orcus/abi.js b/projects/orcus/abi.js index eebf80f8649..3670f4b6cc4 100644 --- a/projects/orcus/abi.js +++ b/projects/orcus/abi.js @@ -1,21 +1,3 @@ module.exports = { - lpToken: { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "lpToken", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } + lpToken: "function lpToken(uint256) view returns (address)", } \ No newline at end of file diff --git a/projects/orcus/index.js b/projects/orcus/index.js index 0859e1c732d..84c5a3f6b3b 100644 --- a/projects/orcus/index.js +++ b/projects/orcus/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens } = require('../helper/unwrapLPs') const { getTokenPrices } = require('../helper/unknownTokens') const { getFixBalances } = require('../helper/portedTokens') @@ -8,8 +9,8 @@ const sdk = require('@defillama/sdk') const chain = 'astar' const MASTER_CHEF = '0xfa1Cfa75bFae8303A9Fe8aF711AacD59015eE6d4' -const USDC = '0x6a2d262D56735DbA19Dd70682B39F6bE9a931D98' -const ibUSDC = '0xC404E12D3466acCB625c67dbAb2E1a8a457DEf3c' +const USDC = ADDRESSES.moonbeam.USDC +const ibUSDC = ADDRESSES.astar.lUSDC const ORU = '0xCdB32eEd99AA19D39e5d6EC45ba74dC4afeC549F' const STAKE_ADDRESS = '0x243e038685209B9B68e0521bD5838C6C937d666A' const BANK_SAFE = '0xd89dEa2daC8Fb73F4107C2cbeA5Eb36dab511F64' diff --git a/projects/ordernchaos/index.js b/projects/ordernchaos/index.js deleted file mode 100644 index 265e8f134ae..00000000000 --- a/projects/ordernchaos/index.js +++ /dev/null @@ -1,37 +0,0 @@ -const { getChainTransform} = require("../helper/portedTokens") -const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); - - -const DAI = "0xd586E7F844cEa2F87f50152665BCbc2C279D8d70" -const USDC = "0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E" -const USDT = "0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7" - - -const collateralAddr = [ - "0xD5a7Df8B56d285011AbE406235109c029F45797A", // 3pool - ]; - -async function stablePoolTvl(timestamp, chainBlocks) { - const balances = {}; - const transformAddress = await getChainTransform("avax"); - await sumTokensAndLPsSharedOwners( - balances, - [ - [DAI, false], - [USDC, false], - [USDT, false], - ], - collateralAddr, - chainBlocks["avax"], - "avax", - transformAddress - ); - return balances; - } - -module.exports = { - methodology: 'Counts the DAI, USDC, and USDT that have been deposited to mint CHAOS', - avax: { - tvl: stablePoolTvl - } -}; \ No newline at end of file diff --git a/projects/oreoswap/index.js b/projects/oreoswap/index.js new file mode 100644 index 00000000000..634dfcd861b --- /dev/null +++ b/projects/oreoswap/index.js @@ -0,0 +1,22 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { getUniTVL, staking } = require('../helper/unknownTokens') +const sdk = require('@defillama/sdk') +const uniTvl = getUniTVL({ factory: '0x20fAfD2B0Ba599416D75Eb54f48cda9812964f46', useDefaultCoreAssets: true }) +const masterchef = '0xa481384653c484901b301634086c8625e550bbec' +const masterchefOld = '0xeb66b69d1cc6ef04575a11d4b0a6427b1cdacc45' +const oreo = '0x319e222De462ac959BAf2aEc848697AeC2bbD770' +const weth = ADDRESSES.arbitrum.WETH + +module.exports = { + misrepresentedTokens: true, + arbitrum: { + tvl: sdk.util.sumChainTvls([uniTvl, staking({ + owners: [masterchefOld, masterchef], + tokens: [weth], + })]), + staking: staking({ + owners: [masterchefOld, masterchef], + tokens: [oreo], + }) + } +}; diff --git a/projects/origindollar/abi.json b/projects/origindollar/abi.json index f52ec43be38..56a51d32a34 100644 --- a/projects/origindollar/abi.json +++ b/projects/origindollar/abi.json @@ -1,59 +1,5 @@ { - "getAllAssets": { - "constant": true, - "inputs": [], - "name": "getAllAssets", - "outputs": [ - { - "internalType": "address[]", - "name": "", - "type": "address[]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "checkBalance": { - "constant": true, - "inputs": [ - { - "internalType": "address", - "name": "_asset", - "type": "address" - } - ], - "name": "checkBalance", - "outputs": [ - { - "internalType": "uint256", - "name": "balance", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "supportsAsset": { - "constant": true, - "inputs": [ - { - "internalType": "address", - "name": "_asset", - "type": "address" - } - ], - "name": "supportsAsset", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } + "getAllAssets": "address[]:getAllAssets", + "checkBalance": "function checkBalance(address _asset) view returns (uint256 balance)", + "supportsAsset": "function supportsAsset(address _asset) view returns (bool)" } \ No newline at end of file diff --git a/projects/originether/index.js b/projects/originether/index.js new file mode 100644 index 00000000000..ceea8da7690 --- /dev/null +++ b/projects/originether/index.js @@ -0,0 +1,38 @@ +const sdk = require("@defillama/sdk"); +const abi = require("../origindollar/abi.json"); + +const vault = "0x39254033945aa2e4809cc2977e7087bee48bd7ab"; + +const ethTvl = async (timestamp, ethBlock) => { + const balances = {}; + + // Account WETH, rETH, frxETH and stETH backing up the minted OUSD + const backingAssets = ( + await sdk.api.abi.call({ + abi: abi.getAllAssets, + target: vault, + block: ethBlock, + }) + ).output; + + for (let i = 0; i < backingAssets.length; i++) { + const backingAssetBalance = ( + await sdk.api.abi.call({ + abi: abi.checkBalance, + target: vault, + params: backingAssets[i], + block: ethBlock, + }) + ).output; + + sdk.util.sumSingleBalance(balances, backingAssets[i], backingAssetBalance); + } + + return balances; +}; + +module.exports = { + ethereum: { + tvl: ethTvl, + }, +}; diff --git a/projects/orio/index.js b/projects/orio/index.js new file mode 100644 index 00000000000..5ce2a5d348f --- /dev/null +++ b/projects/orio/index.js @@ -0,0 +1,23 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokens2 } = require('../helper/unwrapLPs') +const chain = 'ethereum' + +async function tvl(_, _b, { [ chain]: block }) { + const owners = [ + '0x335DE1cB210B6d981EF3c5253ed7A39456Ee8F1D' + ] + const tokens = [ + ADDRESSES.ethereum.BUSD,//busd + ADDRESSES.ethereum.USDC,//usdc + ADDRESSES.ethereum.USDT,//usdt + ADDRESSES.ethereum.DAI,//dai + '0x8e870d67f660d95d5be530380d0ec0bd388289e1',//usdp +] + return sumTokens2({ chain, block, owners, tokens, }) +} + +module.exports = { + ethereum: { + tvl + } +} \ No newline at end of file diff --git a/projects/orion-money/abi.json b/projects/orion-money/abi.json deleted file mode 100644 index 2b7d09b05b4..00000000000 --- a/projects/orion-money/abi.json +++ /dev/null @@ -1,221 +0,0 @@ -[ - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipTransferred", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "_operator", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_before", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_after", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_updateCount", - "type": "uint256" - } - ], - "name": "RateUpdated", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_baseRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_period", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_weight", - "type": "uint256" - } - ], - "name": "addToken", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "bool", - "name": "_simulate", - "type": "bool" - } - ], - "name": "exchangeRateOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "renounceOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address[]", - "name": "_tokens", - "type": "address[]" - } - ], - "name": "startUpdate", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address[]", - "name": "_tokens", - "type": "address[]" - } - ], - "name": "stopUpdate", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "tokens", - "outputs": [ - { - "internalType": "enum IExchangeRateFeeder.Status", - "name": "status", - "type": "uint8" - }, - { - "internalType": "uint256", - "name": "exchangeRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "period", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "weight", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastUpdatedAt", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - } - ], - "name": "update", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } - ] \ No newline at end of file diff --git a/projects/orion-money/index.js b/projects/orion-money/index.js index ebbd0c927c7..3179ed945fb 100644 --- a/projects/orion-money/index.js +++ b/projects/orion-money/index.js @@ -1,21 +1,16 @@ -const { sumTokensAndLPsSharedOwners } = require('../helper/unwrapLPs') -const utils = require('../helper/utils'); -const sdk = require("@defillama/sdk") - -const exchangeRateFeederABI = require('./abi.json'); -const exchangeRateFeederAddress = '0xB12B8247bD1749CC271c55Bb93f6BD2B485C94A7'; - +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport, } = require('../helper/unwrapLPs') const fundedContracts = [ '0xefe0fed2b728b9711030e7643e98477957df9809', //TransparentUpgradeableProxy '0xd9184981bbab68e05eafd631dd2f8cbaf47e3e13' //TransparentUpgradeableProxy ]; const stable = [ - '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', //'USDC' : - '0xdac17f958d2ee523a2206206994597c13d831ec7', //'USDT' : - '0x6b175474e89094c44da98b954eedeac495271d0f', //'DAI' : + ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.USDT, + ADDRESSES.ethereum.DAI, '0xa47c8bf37f92abed4a126bda807a7b7498661acd', //'wUST' : - '0x4fabb145d64652a948d72533023f6e7a623c7c53', //'BUSD' : - '0x853d955acef822db058eb8505911ed77f175b99e' //'FRAX' : + ADDRESSES.ethereum.BUSD, + ADDRESSES.ethereum.FRAX, ]; const anchor = [ '0x94eAd8f528A3aF425de14cfdDA727B218915687C', //'aUSDC': @@ -25,51 +20,10 @@ const anchor = [ '0x5a6a33117ecbc6ea38b3a140f3e20245052cc647', //'aBUSD': '0x0660ae7b180e584d05890e56be3a372f0b746515', //'aFRAX': ]; -async function tvl(timestamp, block) { - // SUM STABLES BALANCES - const balances = {}; - const stableTokens = stable.map(t => [t, false]); - await sumTokensAndLPsSharedOwners( - balances, stableTokens, fundedContracts, block); - - // SUM INTEREST BEARING BALANCES - for (let i = 0; i < anchor.length; i++) { - let totalCoins = 0; - - // find exchangeRateOf - - const { output: pricePerShare } = await sdk.api.abi.call({ - block, - params: [stable[i], true], - target: exchangeRateFeederAddress, - abi: exchangeRateFeederABI.find(i => i.name === 'exchangeRateOf') - }) - - // sum contract token balances - const tokenDecimals = await returnDecimals(stable[i], block); - for (const contract of fundedContracts) { - const contractTokenBalance = - await utils.returnBalance(anchor[i], contract); - totalCoins = Number(totalCoins) + - Number(contractTokenBalance * pricePerShare * - 10 ** tokenDecimals / 10 ** 18); - }; - balances[stable[i]] = Number(balances[stable[i]]) + Number(totalCoins); - }; - return balances; -}; - -async function returnDecimals(address, block) { - if (address.toLowerCase() === '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee') { - return 18; - } - const { output: decimals } = await sdk.api.erc20.decimals(address) - return decimals; - } module.exports = { ethereum: { - tvl, + tvl: sumTokensExport({ tokens: [...stable, ...anchor], owners: fundedContracts}), }, methodology: "counts the value of each stablecoin, and interest-bearing anchor-stable, in the TransparentUpgradeableProxy contracts.", }; \ No newline at end of file diff --git a/projects/orionprotocol/index.js b/projects/orionprotocol/index.js index 64d05a9d2ae..f272d3f9791 100644 --- a/projects/orionprotocol/index.js +++ b/projects/orionprotocol/index.js @@ -6,13 +6,13 @@ module.exports = { methodology: 'The Factory address is used to find the liquidity in each of the LP pairs', bsc: { tvl: getUniTVL({ - chain: 'bsc', useDefaultCoreAssets: true, + useDefaultCoreAssets: true, factory: '0xE52cCf7B6cE4817449F2E6fA7efD7B567803E4b4', }), }, ethereum: { tvl: getUniTVL({ - chain: 'ethereum', useDefaultCoreAssets: true, + useDefaultCoreAssets: true, factory: ethFactory, }), }, diff --git a/projects/oswap-token/index.js b/projects/oswap-token/index.js new file mode 100644 index 00000000000..a2455c11ae2 --- /dev/null +++ b/projects/oswap-token/index.js @@ -0,0 +1,44 @@ +/** + * OSWAP token is designed to reflect the success + * of Oswap protocol — with greater total value locked (TVL) + * in all pools of Oswap DEX the token appreciates faster, and + * with lower TVL it appreciates slower. + * + * @see https://token.oswap.io/ + * + */ + +const { getAaStateVars, executeGetter } = require('../helper/chain/obyte') + +const AA_ADDRESS = "OSWAPWKOXZKJPYWATNK47LRDV4UN4K7H"; + +const GBYTE_DECIMALS = 9; +const OSWAP_TOKEN_DECIMALS = 9; + +async function tvl() { + const state = await getAaStateVars(AA_ADDRESS, "state").then(({ state }) => state || {}); + const tokenReserveTVL = state?.reserve || 0; + + return { 'byteball': tokenReserveTVL / 10 ** GBYTE_DECIMALS } +} + +async function staking() { + const state = await getAaStateVars(AA_ADDRESS, "state").then(({ state }) => state || {}); + const totalStakedBalance = state?.total_staked_balance || 0; + const oswapTokenPrice = await executeGetter(AA_ADDRESS, "get_price"); + const totalStakedTVL = (totalStakedBalance / 10 ** OSWAP_TOKEN_DECIMALS) * oswapTokenPrice; + + return { 'byteball': totalStakedTVL } +} + +module.exports = { + timetravel: false, + doublecounted: false, + misrepresentedTokens: true, + methodology: + "The TVL is the USD value of the all assets locked on the OSWAP token autonomous agent. This includes the reserve asset used to issue the OSWAP tokens and OSWAP tokens locked in governance (as staking).", + obyte: { + tvl, + staking + }, +} diff --git a/projects/otterclam.js b/projects/otterclam.js deleted file mode 100644 index c612209c944..00000000000 --- a/projects/otterclam.js +++ /dev/null @@ -1,12 +0,0 @@ -const { ohmTvl } = require('./helper/ohm') - -module.exports = ohmTvl( - '0x8ce47D56EAa1299d3e06FF3E04637449fFb01C9C', - [ - ['0xa3fa99a148fa48d14ed51d610c367c61876997f1', false], - ['0x1581802317f32a2665005109444233ca6e3e2d68', true], - ], - 'polygon', - '0xC8B0243F350AA5F8B979b228fAe522DAFC61221a', - '0xC250e9987A032ACAC293d838726C511E6E1C029d' -) diff --git a/projects/overnight-daiPlus/index.js b/projects/overnight-daiPlus/index.js new file mode 100644 index 00000000000..8bf8a4b5705 --- /dev/null +++ b/projects/overnight-daiPlus/index.js @@ -0,0 +1,28 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const sdk = require("@defillama/sdk"); + +const m2m = { + optimism: "0x8416d215b71a5C91b04E326140bbbDcDa82C01da", + arbitrum: "0xF04124F4226389d1Bf3ad7AcB54da05fF4078c8b", +} + +const assets = { + optimism: ADDRESSES.optimism.DAI, //DAI + arbitrum: ADDRESSES.optimism.DAI, //DAI +} + +const abi = "uint256:totalNetAssets" + +module.exports = {}; + +Object.keys(m2m).forEach(chain => { + module.exports[chain] = { + tvl: async (_, _b, cb) => { + const block = cb[chain] + const { output } = await sdk.api.abi.call({ chain, block, abi, target: m2m[chain]}) + return { + [`${chain}:${assets[chain]}`]: output + } + } + } +}) \ No newline at end of file diff --git a/projects/overnight-usdPlus/index.js b/projects/overnight-usdPlus/index.js new file mode 100644 index 00000000000..3bc1210b190 --- /dev/null +++ b/projects/overnight-usdPlus/index.js @@ -0,0 +1,34 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const sdk = require("@defillama/sdk"); + +const m2m = { + polygon: "0x33efB0868A6f12aEce19B451e0fcf62302Ec4A72", + bsc: "0x9Af655c4DBe940962F776b685d6700F538B90fcf", + optimism: "0x9Af655c4DBe940962F776b685d6700F538B90fcf", + arbitrum: "0x9Af655c4DBe940962F776b685d6700F538B90fcf", + era: "0x240aad990FFc5F04F11593fF4dCF1fF714d6fc80", +} + +const assets = { + polygon: ADDRESSES.polygon.USDC, //USDC + bsc: ADDRESSES.bsc.BUSD, //BUSD + optimism: ADDRESSES.optimism.USDC, //USDC + arbitrum: ADDRESSES.arbitrum.USDC, //USDC + era: ADDRESSES.era.USDC, +} + +const abi = "uint256:totalNetAssets" + +module.exports = {}; + +Object.keys(m2m).forEach(chain => { + module.exports[chain] = { + tvl: async (_, _b, cb) => { + const block = cb[chain] + const { output } = await sdk.api.abi.call({ chain, block, abi, target: m2m[chain]}) + return { + [`${chain}:${assets[chain]}`]: output + } + } + } +}) \ No newline at end of file diff --git a/projects/overnight-usdtPlus/index.js b/projects/overnight-usdtPlus/index.js new file mode 100644 index 00000000000..7b6e5ecf188 --- /dev/null +++ b/projects/overnight-usdtPlus/index.js @@ -0,0 +1,26 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const sdk = require("@defillama/sdk"); + +const m2m = { + bsc: "0xF3434f6a11AA950150AF3e4962E39E6281496EF9", +} + +const assets = { + bsc: ADDRESSES.bsc.USDT, //USDT +} + +const abi = "uint256:totalNetAssets" + +module.exports = {}; + +Object.keys(m2m).forEach(chain => { + module.exports[chain] = { + tvl: async (_, _b, cb) => { + const block = cb[chain] + const { output } = await sdk.api.abi.call({ chain, block, abi, target: m2m[chain]}) + return { + [`${chain}:${assets[chain]}`]: output + } + } + } +}) \ No newline at end of file diff --git a/projects/ovnstable.js b/projects/ovnstable.js deleted file mode 100644 index 6bbbb2ae708..00000000000 --- a/projects/ovnstable.js +++ /dev/null @@ -1,45 +0,0 @@ -const sdk = require("@defillama/sdk"); -const { getBlock } = require('./helper/getBlock') - -const m2m = { - polygon: "0x33efB0868A6f12aEce19B451e0fcf62302Ec4A72", - bsc: "0x9Af655c4DBe940962F776b685d6700F538B90fcf", - optimism: "0x9Af655c4DBe940962F776b685d6700F538B90fcf", - avax: "0x9Af655c4DBe940962F776b685d6700F538B90fcf", -} - -const assets = { - polygon: "0x2791bca1f2de4661ed88a30c99a7a9449aa84174", //USDC - bsc: "0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56", //BUSD - optimism: "0x7F5c764cBc14f9669B88837ca1490cCa17c31607", //USDC - avax: "0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E", //USDC -} - -const abi = { - "inputs": [], - "name": "totalNetAssets", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" -} - -module.exports = {}; - -Object.keys(m2m).forEach(chain => { - module.exports[chain] = { - tvl: async (_, _b, cb) => { - const block = await getBlock(_, chain, cb) - //console.log(_ ,chain, block) - const { output } = await sdk.api.abi.call({ chain, block, abi, target: m2m[chain]}) - return { - [`${chain}:${assets[chain]}`]: output - } - } - } -}) \ No newline at end of file diff --git a/projects/ovr/index.js b/projects/ovr/index.js index 24b1fbd57d8..cad94f322f3 100644 --- a/projects/ovr/index.js +++ b/projects/ovr/index.js @@ -1,17 +1,29 @@ const { stakings } = require("../helper/staking"); const stakingContract = [ - "0xc947FA28527A06cEE53614E1b77620C1b7D3A75D", - "0xCa0F390C044FD43b1F38B9D2A02e06b13B65FA48" + "0xc947FA28527A06cEE53614E1b77620C1b7D3A75D", + "0xCa0F390C044FD43b1F38B9D2A02e06b13B65FA48", ]; -const OVR = "0x21bfbda47a0b4b5b1248c767ee49f7caa9b23697"; +const OVR = { + eth: "0x21bfbda47a0b4b5b1248c767ee49f7caa9b23697", + polygon: "0x1631244689EC1fEcbDD22fb5916E920dFC9b8D30", +}; module.exports = { - misrepresentedTokens: true, ethereum: { - staking: stakings(stakingContract, OVR), - tvl: (async) => ({}), + tvl: () => ({}), + staking: stakings(stakingContract, OVR.eth), + vesting: stakings([ + "0xcee8fcbc9676a08b0a048180d99b41a7f080bb78", + "0xe6984300afd314A2F49A5869e773883CdfAe49C2", + ], OVR.eth), + }, + polygon: { + staking: stakings([ + "0x7e98b560eFa48d8d04292EaF680E693F6EEfB534", + "0x671F928505C108E49c006fb97066CFdAB34a2898", + ], OVR.polygon), }, - methodology: "Counts liquidty on the staking only", + methodology: "We count the tokens locked in the staking contract, the tokens in the IBCO reserve, and the tokens locked in vesting.", }; diff --git a/projects/owna/config.js b/projects/owna/config.js new file mode 100644 index 00000000000..ad8b5edca06 --- /dev/null +++ b/projects/owna/config.js @@ -0,0 +1,13 @@ +const ADDRESSES = require('../helper/coreAssets.json') +module.exports = { + chains: [ + { + name: 'polygon_zkevm', + tokens: [ + ADDRESSES.polygon_zkevm.USDC, + ], + nftContract: '0xa0db7ef54eeffb7a3a5d9e7a95fb853392573b90', + lendingContract: '0x27Ca3D6c64398FF9BcF2E66896EC4B3BEc5e1959', + }, + ] +} \ No newline at end of file diff --git a/projects/owna/index.js b/projects/owna/index.js new file mode 100644 index 00000000000..4bb4f8a0a40 --- /dev/null +++ b/projects/owna/index.js @@ -0,0 +1,94 @@ +const { get } = require('../helper/http') +const config = require("./config"); +const sdk = require("@defillama/sdk"); +const { sumTokensExport } = require('../helper/unwrapLPs') + +module.exports = { + methodology: 'Counts the amount of stables locked in Owna protocol contracts', +}; + +config.chains.forEach(async chainInfo => { + const {name: chain, tokens, lendingContract, nftContract} = chainInfo + + async function currentTokenId() { + return (await sdk.api.abi.call({ + abi: "uint256:noOfTokenId", + target: nftContract, + chain + })).output + } + + async function getBorrow(tokenId) { + return (await sdk.api.abi.call({ + abi: "function borrow(uint256) view returns (bool nft, bool isEntryFeePaid, bool isSold, uint256 nftId, uint256 offerType, uint256 loanAmount, uint256 debtPaid, uint256 lastUpdate, uint256 borrowedStartTime)", + target: lendingContract, + chain, + params: [tokenId] + })).output + } + + async function requestAgainstNft(tokenId, offerID) { + return (await sdk.api.abi.call({ + abi: "function requestAgainstNft(uint256,uint256) view returns (uint256 offerID, uint256 offerType, uint256 nftId, uint256 durations, uint256 offerStartTime, uint256 apr, uint256 minLoan, uint256 maxLoan, uint256 loan, uint256 acceptable_debt, address lender, address borrower, string status)", + target: lendingContract, + chain, + params: [tokenId, offerID] + })).output + } + + async function readDynamicInterest(tokenId, offerID) { + return (await sdk.api.abi.call({ + abi: "function readDynamicInterest(uint256,uint256) view returns (uint256)", + target: lendingContract, + chain, + params: [tokenId, offerID] + })).output + } + + async function getOffersCount(tokenId) { + return parseInt(await get('https://backend.owna.io/offer/getOffersCount?mintId=' + tokenId)); + } + + async function totalOffers() { + let total = 0; + for (let i = 0; i < await currentTokenId(); i++) { + const borrow = await getBorrow(i); + if (parseInt(borrow.offerType) === 0) { + var offerCount = await getOffersCount(i); + if (offerCount > 0) { + for (let j = 0; j < offerCount; j++) { + var offer = await requestAgainstNft(i, j); + if (offer.status == "Pending") { + total += parseInt(offer.maxLoan); + } + } + } + } + } + return { + usd: total / 10 ** 6, + }; + } + + async function totalBorrowed() { + let total = 0; + let totalInterest = 0; + for (let i = 0; i <= await currentTokenId(); i++) { + const borrow = await getBorrow(i); + if (!borrow.isEntryFeePaid) { + total += parseInt(borrow.loanAmount); + if (parseInt(borrow.offerType) > 0) { + totalInterest += parseInt(await readDynamicInterest(i, 0)); + } + }} + return { + usd: (total / 10 ** 6) + (totalInterest / 10 ** 6), + }; + } + + module.exports[chain] = { + tvl: sumTokensExport({ chain, tokens, owners: [lendingContract] }), + borrowed: totalBorrowed, + offers: totalOffers, + } +}) diff --git a/projects/oxygen/idl.js b/projects/oxygen/idl.js index 54a1501b2fb..225d65a608e 100644 --- a/projects/oxygen/idl.js +++ b/projects/oxygen/idl.js @@ -2,515 +2,8 @@ module.exports = { version: '0.0.0', name: 'borrow_lending', - instructions: [ - { - name: 'initializeMain', - accounts: [ - { - name: 'mainSigner', - isMut: false, - isSigner: false, - }, - { - name: 'mainAccount', - isMut: true, - isSigner: true, - }, - { - name: 'authority', - isMut: true, - isSigner: true, - }, - { - name: 'priceAuthority', - isMut: false, - isSigner: false, - }, - { - name: 'systemProgram', - isMut: false, - isSigner: false, - }, - { - name: 'rent', - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: 'signerBump', - type: 'u8', - }, - ], - }, - { - name: 'setPriceAuthority', - accounts: [ - { - name: 'mainAccount', - isMut: true, - isSigner: false, - }, - { - name: 'authority', - isMut: false, - isSigner: true, - }, - { - name: 'newPriceAuthority', - isMut: false, - isSigner: false, - }, - ], - args: [], - }, - { - name: 'initializeMargin', - accounts: [ - { - name: 'marginAccount', - isMut: true, - isSigner: false, - }, - { - name: 'mainAccount', - isMut: false, - isSigner: false, - }, - { - name: 'authority', - isMut: true, - isSigner: true, - }, - { - name: 'systemProgram', - isMut: false, - isSigner: false, - }, - { - name: 'rent', - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: 'marginBump', - type: 'u8', - }, - ], - }, - { - name: 'deposit', - accounts: [ - { - name: 'marginAccount', - isMut: true, - isSigner: false, - }, - { - name: 'mainAccount', - isMut: true, - isSigner: false, - }, - { - name: 'from', - isMut: true, - isSigner: false, - }, - { - name: 'to', - isMut: true, - isSigner: false, - }, - { - name: 'authority', - isMut: false, - isSigner: true, - }, - { - name: 'tokenProgram', - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: 'quantity', - type: 'u64', - }, - { - name: 'vaultBump', - type: 'u8', - }, - ], - }, - { - name: 'withdraw', - accounts: [ - { - name: 'marginAccount', - isMut: true, - isSigner: false, - }, - { - name: 'mainSigner', - isMut: false, - isSigner: false, - }, - { - name: 'mainAccount', - isMut: true, - isSigner: false, - }, - { - name: 'from', - isMut: true, - isSigner: false, - }, - { - name: 'to', - isMut: true, - isSigner: false, - }, - { - name: 'authority', - isMut: false, - isSigner: true, - }, - { - name: 'tokenProgram', - isMut: false, - isSigner: false, - }, - { - name: 'clock', - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: 'quantity', - type: 'u64', - }, - { - name: 'vaultBump', - type: 'u8', - }, - ], - }, - { - name: 'liquidate', - accounts: [ - { - name: 'liquidateeAccount', - isMut: true, - isSigner: false, - }, - { - name: 'liquidatorAccount', - isMut: true, - isSigner: false, - }, - { - name: 'mainAccount', - isMut: true, - isSigner: false, - }, - { - name: 'authority', - isMut: false, - isSigner: true, - }, - { - name: 'clock', - isMut: false, - isSigner: false, - }, - ], - args: [], - }, - { - name: 'crankInterest', - accounts: [ - { - name: 'mainAccount', - isMut: true, - isSigner: false, - }, - { - name: 'tokenParamsAccount', - isMut: true, - isSigner: false, - }, - { - name: 'clock', - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: 'tpaBump', - type: 'u8', - }, - { - name: 'tokenIds', - type: { - array: [ - 'u8', - 16, - ], - }, - }, - ], - }, - { - name: 'setPrice', - accounts: [ - { - name: 'mainAccount', - isMut: true, - isSigner: false, - }, - { - name: 'priceAuthority', - isMut: false, - isSigner: true, - }, - { - name: 'clock', - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: 'tokenIds', - type: { - array: [ - 'u8', - 16, - ], - }, - }, - { - name: 'prices', - type: { - array: [ - 'u128', - 16, - ], - }, - }, - ], - }, - { - name: 'crankPrice', - accounts: [], - args: [ - { - name: 'tokenIds', - type: { - array: [ - 'u8', - 16, - ], - }, - }, - ], - }, - { - name: 'addToken', - accounts: [ - { - name: 'mainSigner', - isMut: false, - isSigner: false, - }, - { - name: 'mainAccount', - isMut: true, - isSigner: false, - }, - { - name: 'tokenVault', - isMut: true, - isSigner: false, - }, - { - name: 'feeVault', - isMut: true, - isSigner: false, - }, - { - name: 'mint', - isMut: false, - isSigner: false, - }, - { - name: 'authority', - isMut: true, - isSigner: true, - }, - { - name: 'systemProgram', - isMut: false, - isSigner: false, - }, - { - name: 'rent', - isMut: false, - isSigner: false, - }, - { - name: 'tokenProgram', - isMut: false, - isSigner: false, - }, - { - name: 'clock', - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: 'vaultBump', - type: 'u8', - }, - { - name: 'feeBump', - type: 'u8', - }, - ], - }, - { - name: 'initTokenParameters', - accounts: [ - { - name: 'mainAccount', - isMut: true, - isSigner: false, - }, - { - name: 'tokenParamsAccount', - isMut: true, - isSigner: false, - }, - { - name: 'authority', - isMut: true, - isSigner: true, - }, - { - name: 'systemProgram', - isMut: false, - isSigner: false, - }, - { - name: 'rent', - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: 'tpaBump', - type: 'u8', - }, - ], - }, - { - name: 'setTokenParameters', - accounts: [ - { - name: 'mainAccount', - isMut: false, - isSigner: false, - }, - { - name: 'tokenParamsAccount', - isMut: true, - isSigner: false, - }, - { - name: 'authority', - isMut: true, - isSigner: true, - }, - ], - args: [ - { - name: 'tpaBump', - type: 'u8', - }, - { - name: 'tokenId', - type: 'u8', - }, - { - name: 'uOptimal', - type: 'u16', - }, - { - name: 'baseRate', - type: 'u16', - }, - { - name: 'slopeOne', - type: 'u16', - }, - { - name: 'slopeTwo', - type: 'u16', - }, - ], - }, - ], + instructions: [], accounts: [ - { - name: 'MarginAccount', - type: { - kind: 'struct', - fields: [ - { - name: 'bump', - type: 'u8', - }, - { - name: 'authority', - type: 'publicKey', - }, - { - name: 'tokenShares', - type: { - array: [ - { - defined: 'TokenShares', - }, - 64, - ], - }, - }, - { - name: 'mainAccount', - type: 'publicKey', - }, - { - name: 'padding', - type: { - array: [ - 'u8', - 1024, - ], - }, - }, - ], - }, - }, { name: 'MainAccount', type: { @@ -573,67 +66,8 @@ module.exports = { ], }, }, - { - name: 'TokensParametersAccount', - type: { - kind: 'struct', - fields: [ - { - name: 'authority', - type: 'publicKey', - }, - { - name: 'params', - type: { - array: [ - { - defined: 'TokenParameters', - }, - 64, - ], - }, - }, - { - name: 'rates', - type: { - array: [ - { - defined: 'TokenRate', - }, - 64, - ], - }, - }, - { - name: 'padding', - type: { - array: [ - 'u8', - 500, - ], - }, - }, - ], - }, - }, ], types: [ - { - name: 'TokenShares', - type: { - kind: 'struct', - fields: [ - { - name: 'tokenId', - type: 'u8', - }, - { - name: 'shares', - type: 'i128', - }, - ], - }, - }, { name: 'Balance', type: { @@ -676,46 +110,6 @@ module.exports = { ], }, }, - { - name: 'TokenRate', - type: { - kind: 'struct', - fields: [ - { - name: 'borrowApr', - type: 'u128', - }, - { - name: 'depositApy', - type: 'u128', - }, - ], - }, - }, - { - name: 'TokenParameters', - type: { - kind: 'struct', - fields: [ - { - name: 'uOptimal', - type: 'u16', - }, - { - name: 'baseRate', - type: 'u16', - }, - { - name: 'slopeOne', - type: 'u16', - }, - { - name: 'slopeTwo', - type: 'u16', - }, - ], - }, - }, { name: 'TokenData', type: { @@ -749,56 +143,5 @@ module.exports = { }, }, ], - errors: [ - { - code: 300, - name: 'IncorrectTokenAccount', - msg: 'Token account is not owned by main account.', - }, - { - code: 301, - name: 'UnsupportedTokenMint', - msg: 'The given token mint is not supported.', - }, - { - code: 302, - name: 'UnauthorizedAddToken', - msg: 'Account is not authorized to add a new token.', - }, - { - code: 303, - name: 'UnauthorizedSetPrice', - msg: 'Account is not authorized to set token price.', - }, - { - code: 304, - name: 'StaleData', - msg: 'Stale price or interest data.', - }, - { - code: 305, - name: 'TooManyDecimals', - msg: 'Too many decimals in token mint', - }, - { - code: 306, - name: 'InsufficientCollateral', - msg: 'Account has insufficient collateral.', - }, - { - code: 307, - name: 'SufficientCollateral', - msg: 'Account has sufficient collateral.', - }, - { - code: 308, - name: 'InvalidTokenConfiguration', - msg: 'Invalid token configuration.', - }, - { - code: 309, - name: 'InvalidTokenId', - msg: 'Invalid token id.', - }, - ], + errors: [], }; diff --git a/projects/oxygen/index.js b/projects/oxygen/index.js index 68143effc6e..e86bd412530 100644 --- a/projects/oxygen/index.js +++ b/projects/oxygen/index.js @@ -1,51 +1,9 @@ -const { getProvider } = require('../helper/solana') -const BigNumber = require('bignumber.js') +const { getProvider, getTokenDecimals } = require('../helper/solana') const { PublicKey } = require('@solana/web3.js') const { Program, } = require("@project-serum/anchor"); -const idl = require('./idl') -const MINTS = [ - { - name: 'Bitcoin', - mintAddress: '9n4nbM75f5Ui33ZbPYXn59EwSgE8CGsHtAeTH5YFeJ9E', - decimals: 6, - }, - { - name: 'Ethereum', - mintAddress: '2FPyTwcZLUg1MDrwsyoP4D6s1tM7hAkHYRjkNb5w6Pxk', - decimals: 6, - }, - { - symbol: 'SOL', - mintAddress: 'So11111111111111111111111111111111111111112', - decimals: 9, - }, - { - symbol: 'USDC', - mintAddress: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v', - decimals: 6, - }, - { - symbol: 'SRM', - mintAddress: 'SRMuApVNdxXokk5GT7XD5cUUgXMBCoAz2LHeuAoKWRt', - decimals: 6, - }, - { - symbol: 'USDT', - mintAddress: 'Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB', - decimals: 6, - }, -]; -const INTERNAL_DECIMALS = 12; - -const convertFromBN = (amount, decimals) => { - const amountStr = new BigNumber(amount.toString()); - const toDivAmount = `1${'0'.repeat(decimals)}`; - return amountStr.dividedBy(toDivAmount).toNumber(); -}; +const idl = require('./idl'); -const numberToFixed = (amount, fixed = 2) => { - return new BigNumber(amount).decimalPlaces(fixed).toNumber(); -}; +const INTERNAL_DECIMALS = 12; let tokenData @@ -55,39 +13,10 @@ async function _getTokenData() { const provider = getProvider() const program = new Program(idl, programId, provider) const data = await program.account.mainAccount.fetch(mainAccountAddress) - - const { balancesMap, pricesMap, } = data.tokens.reduce((acc, { mint }, i) => { - acc.pricesMap[mint.toBase58()] = data.prices[i]?.price || new BigNumber(0); - acc.balancesMap[mint.toBase58()] = data.balances[i]?.balance || { - borrowTotal: new BigNumber(0), - depositTotal: new BigNumber(0), - }; - return acc; - }, { balancesMap: {}, pricesMap: {}}); - - data.balancesMap = balancesMap; - data.pricesMap = pricesMap; - - - const tokens = MINTS.reduce((acc, token, i) => { - const { mintAddress, decimals } = token; - const depositTotal = numberToFixed(convertFromBN(data.balancesMap[mintAddress].depositTotal, INTERNAL_DECIMALS), decimals); - const borrowTotal = numberToFixed(convertFromBN(data.balancesMap[mintAddress].borrowTotal, INTERNAL_DECIMALS), decimals); - const available = BigNumber.maximum(new BigNumber(depositTotal).minus(borrowTotal), 0); - const price = convertFromBN(data.pricesMap[mintAddress], INTERNAL_DECIMALS); - - acc[mintAddress] = { - borrowed: { - usd: numberToFixed((borrowTotal * price)), - }, - available: { - usd: numberToFixed(available * price), - }, - }; - return acc; - }, {}); - - return tokens + data.tokens = data.tokens.slice(0, 6) + data.balances = data.balances.slice(0, 6) + data.tokenDecimals = await getTokenDecimals(data.tokens.map(({ mint }) => mint.toBase58())) + return data } async function getTokenData() { @@ -95,25 +24,31 @@ async function getTokenData() { return tokenData } -async function tvl() { +async function tvl(_, _1, _2, { api }) { const data = await getTokenData() - return { - tether: Object.values(data).reduce((a, i) => a + i.available.usd, 0) - } + data.tokens.forEach(({ mint }, i) => { + const token = mint.toBase58() + const { balance: { depositTotal, borrowTotal } } = data.balances[i] + const decimals = 10 ** (data.tokenDecimals[token] - INTERNAL_DECIMALS) + api.add(token, depositTotal.toString() * decimals) + api.add(token, borrowTotal.toString() * -1 * decimals) + }) } -async function borrowed() { +async function borrowed(_, _1, _2, { api }) { const data = await getTokenData() - return { - tether: Object.values(data).reduce((a, i) => a + i.borrowed.usd, 0) - } + data.tokens.forEach(({ mint }, i) => { + const token = mint.toBase58() + const { balance: { borrowTotal } } = data.balances[i] + const decimals = 10 ** (data.tokenDecimals[token] - INTERNAL_DECIMALS) + api.add(token, borrowTotal.toString()* decimals) + }) } module.exports = { timetravel: false, - misrepresentedTokens: true, solana: { tvl, - borrowed, + borrowed: () => 0, }, } diff --git a/projects/pacman/index.js b/projects/pacman/index.js new file mode 100644 index 00000000000..929caf096f9 --- /dev/null +++ b/projects/pacman/index.js @@ -0,0 +1,32 @@ +const { graphQuery } = require('../helper/http') + +const subgraphUrl = "https://api.thegraph.com/subgraphs/name/pacmanfinance/pacman-arbitrum"; + +const vaultsQuery = ` + query { + vaults { + baseToken { + id + priceByUsd + decimals + } + id + availableAmount + totalDeposit + totalDebt + } + } +`; + +async function tvl(timestamp, ethBlock, chainBlocks, { api }) { + const { vaults } = await graphQuery(subgraphUrl, vaultsQuery) + vaults.forEach(({ baseToken: { id, decimals }, totalDebt, totalDeposit}) => { + api.add(id, (totalDeposit - totalDebt) * ( 10 ** decimals)) + }) +} + +module.exports = { + arbitrum: { + tvl, + } +}; \ No newline at end of file diff --git a/projects/padswap/index.js b/projects/padswap/index.js index c1f70ffa2ef..e9081aea9f4 100644 --- a/projects/padswap/index.js +++ b/projects/padswap/index.js @@ -22,7 +22,7 @@ module.exports = { methodology: `TVL accounts for the liquidity on all AMM pools (see https://info.padswap.exchange/ and https://movr-info.padswap.exchange/). Staking includes all TOAD staked in TOAD farms.`, misrepresentedTokens: true, bsc: { - tvl: getUniTVL({ chain: 'bsc', factory: PADSWAP_BSC_FACTORY_ADDRESS, useDefaultCoreAssets: true, }), + tvl: getUniTVL({ chain: 'bsc', factory: PADSWAP_BSC_FACTORY_ADDRESS, useDefaultCoreAssets: true, blacklistedTokens: ['0xcdb943908de5ee37998a53f23467017d1a307e60'], }), staking: stakings( [ TOAD_FARM_ADDRESS, diff --git a/projects/paintswap/abis/getReserves.json b/projects/paintswap/abis/getReserves.json deleted file mode 100644 index 90bcafd86aa..00000000000 --- a/projects/paintswap/abis/getReserves.json +++ /dev/null @@ -1,25 +0,0 @@ -[ - { - "inputs": [], - "name": "getReserves", - "outputs": [ - { - "internalType": "uint112", - "name": "reserve0", - "type": "uint112" - }, - { - "internalType": "uint112", - "name": "reserve1", - "type": "uint112" - }, - { - "internalType": "uint32", - "name": "blockTimestampLast", - "type": "uint32" - } - ], - "stateMutability": "view", - "type": "function" - } - ] \ No newline at end of file diff --git a/projects/pairex/index.js b/projects/pairex/index.js new file mode 100644 index 00000000000..03e88224b0c --- /dev/null +++ b/projects/pairex/index.js @@ -0,0 +1,26 @@ +const ADDRESSES = require('../helper/coreAssets.json'); +const { sumTokensExport } = require('../helper/unwrapLPs') + +const contracts = [ + '0x154fDc2e0c4A2e4b39AFc329f0df88499d96F665', + '0x9CC1b358E39651F118AA02126648f4a770B7432D', + '0x2Ca07638acDa0B2bEa7B6a06F135476BDdd7101B', + '0xA7dE0DD19004b430cC8C920fCA9F5FDE5A66379b', + '0x35DD17F0d9098fc5B24D6328122B4C9ea5dD7DB5', + '0x0a30067Ad5ff753F6887bBaF03b467C87CF62eF3' +] + +const tokens = [ + ADDRESSES.arbitrum.USDT, + ADDRESSES.arbitrum.LINK +] + +module.exports = { + start: 1678852800, // 15/03/2023 @ 04:00am (UTC) + arbitrum: { + tvl: sumTokensExport({ tokens, owners: contracts }), + }, + hallmarks: [ + [1678852800, "Arbitrum Pairex Launch"] + ] +} diff --git a/projects/pala/abi.json b/projects/pala/abi.json index 3466bb6f703..351fb133ca5 100644 --- a/projects/pala/abi.json +++ b/projects/pala/abi.json @@ -1,125 +1,7 @@ { - "poolInfos":{ - "inputs": [], - "name": "poolInfos", - "outputs": [ - { - "components": [ - { "internalType": "address", "name": "pool", "type": "address" }, - { "internalType": "address", "name": "token0", "type": "address" }, - { "internalType": "address", "name": "token1", "type": "address" }, - { "internalType": "string", "name": "name", "type": "string" }, - { "internalType": "string", "name": "symbol", "type": "string" }, - { "internalType": "uint8", "name": "decimals", "type": "uint8" }, - { "internalType": "uint256", "name": "totalSupply", "type": "uint256" }, - { "internalType": "uint112", "name": "token0Reserve", "type": "uint112" }, - { "internalType": "uint112", "name": "token1Reserve", "type": "uint112" }, - { "internalType": "uint256", "name": "token0Balance", "type": "uint256" }, - { "internalType": "uint256", "name": "token1Balance", "type": "uint256" } - ], - "internalType": "struct Viewer.PoolInfo[]", - "name": "poolInfoList", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function", - "constant": true - }, - "tokenInfoDetail":{ - "inputs": [{ "internalType": "address", "name": "token", "type": "address" }], - "name": "tokenInfoDetail", - "outputs": [ - { - "components": [ - { "internalType": "address", "name": "token", "type": "address" }, - { "internalType": "string", "name": "name", "type": "string" }, - { "internalType": "string", "name": "symbol", "type": "string" }, - { "internalType": "uint8", "name": "decimals", "type": "uint8" }, - { "internalType": "uint256", "name": "totalSupply", "type": "uint256" } - ], - "internalType": "struct Viewer.TokenInfo", - "name": "info", - "type": "tuple" - }, - { "internalType": "uint256", "name": "price", "type": "uint256" } - ], - "stateMutability": "view", - "type": "function", - "constant": true - }, - "balanceOf":{ - "constant": true, - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "totalSupply":{ - "constant": true, - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "farmInfos":{ - "inputs": [{ "internalType": "address", "name": "farm", "type": "address" }], - "name": "farmInfos", - "outputs": [ - { - "components": [ - { "internalType": "address", "name": "pool", "type": "address" }, - { "internalType": "uint256", "name": "totalLP", "type": "uint256" }, - { "internalType": "uint256", "name": "allocPoint", "type": "uint256" }, - { "internalType": "uint256", "name": "lastRewardBlock", "type": "uint256" }, - { "internalType": "uint256", "name": "accRewardPerShare", "type": "uint256" } - ], - "internalType": "struct Viewer.FarmInfo[]", - "name": "farmInfoList", - "type": "tuple[]" - }, - { - "components": [ - { "internalType": "uint256", "name": "attenTotalAllocPoint", "type": "uint256" }, - { "internalType": "uint256", "name": "attenFarmStartBlock", "type": "uint256" }, - { "internalType": "uint256", "name": "attenFarmEndBlock", "type": "uint256" }, - { "internalType": "uint256", "name": "attenPerBlock", "type": "uint256" }, - { "internalType": "uint256", "name": "attenBonusMultiplier", "type": "uint256" }, - { "internalType": "uint256", "name": "palaTotalAllocPoint", "type": "uint256" }, - { "internalType": "uint256", "name": "palaFarmStartBlock", "type": "uint256" }, - { "internalType": "uint256", "name": "palaPerBlock", "type": "uint256" }, - { "internalType": "uint256", "name": "palaBonusMultiplier", "type": "uint256" } - ], - "internalType": "struct Viewer.FarmConfig", - "name": "config", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function", - "constant": true - } - + "poolInfos": "function poolInfos() view returns (tuple(address pool, address token0, address token1, string name, string symbol, uint8 decimals, uint256 totalSupply, uint112 token0Reserve, uint112 token1Reserve, uint256 token0Balance, uint256 token1Balance)[] poolInfoList)", + "tokenInfoDetail": "function tokenInfoDetail(address token) view returns (tuple(address token, string name, string symbol, uint8 decimals, uint256 totalSupply) info, uint256 price)", + "balanceOf": "function balanceOf(address) view returns (uint256)", + "totalSupply": "uint256:totalSupply", + "farmInfos": "function farmInfos(address farm) view returns (tuple(address pool, uint256 totalLP, uint256 allocPoint, uint256 lastRewardBlock, uint256 accRewardPerShare)[] farmInfoList, tuple(uint256 attenTotalAllocPoint, uint256 attenFarmStartBlock, uint256 attenFarmEndBlock, uint256 attenPerBlock, uint256 attenBonusMultiplier, uint256 palaTotalAllocPoint, uint256 palaFarmStartBlock, uint256 palaPerBlock, uint256 palaBonusMultiplier) config)" } \ No newline at end of file diff --git a/projects/paladin-dao/index.js b/projects/paladin-dao/index.js index d925661e7e5..ed1cd89d60a 100644 --- a/projects/paladin-dao/index.js +++ b/projects/paladin-dao/index.js @@ -1,10 +1,11 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { ohmTvl } = require("../helper/ohm"); const token = "0xb4da413d7643000a84c5b62bfb1bf2077604b165"; const tokenStake = "0x7B73d56c53059699003ac11aF4308f6bEb4877FF"; const treasury = "0x6382192259f45a7acDa2A08cc30ce9FaF0e1863E"; const tokens = [ - ["0xe9e7cea3dedca5984780bafc599bd69add087d56", false], // BUSD + [ADDRESSES.bsc.BUSD, false], // BUSD ["0x103900036e483c85ea4748b6733f621b8df21e2d", true] // PAL-BUSD ]; diff --git a/projects/paladinfinance-warlord/abi.json b/projects/paladinfinance-warlord/abi.json new file mode 100644 index 00000000000..ab2a894df7f --- /dev/null +++ b/projects/paladinfinance-warlord/abi.json @@ -0,0 +1,5 @@ +{ + "token": "address:token", + "getCurrentLockedTokens": "uint256:getCurrentLockedTokens", + "lockers": "function lockers(uint256) view returns (address)" +} \ No newline at end of file diff --git a/projects/paladinfinance-warlord/index.js b/projects/paladinfinance-warlord/index.js new file mode 100644 index 00000000000..d269ee7f4e7 --- /dev/null +++ b/projects/paladinfinance-warlord/index.js @@ -0,0 +1,45 @@ +const sdk = require("@defillama/sdk"); +const abi = require("./abi.json"); +const { BigNumber } = require("ethers"); + +const WAR_CONTROLLER = "0xFDeac9F9e4a5A7340Ac57B47C67d383fb4f13DBb"; + +async function getLockers(api) { + let lockers = []; + + for (let i = 0; i != -1; ++i) { + try { + const output = await api.call({ + target: WAR_CONTROLLER, + abi: abi["lockers"], + params: [BigNumber.from(i)] + }) + lockers.push(output); + } catch(e) { + break; + } + } + + return lockers; +} + +async function ethTvl(timestamp, block, _, { api },) { + const balances = {}; + + const lockers = await getLockers(api); + + const bals = await api.multiCall({ abi: abi["getCurrentLockedTokens"], calls: lockers.map(i => ({ target: i})) }) + const tokens = await api.multiCall({ abi: abi["token"], calls: lockers.map(i => ({ target: i})) }) + + bals.forEach((v, i) => sdk.util.sumSingleBalance(balances, tokens[i], v)) + + return balances; +} + +module.exports = { + methodology: "Counts the total locked tokens inside the lockers contracts", + ethereum: { + tvl: ethTvl, + }, + start: 17368026 +}; diff --git a/projects/paladinfinance/abi.json b/projects/paladinfinance/abi.json index d571825a049..24eaf5be6e2 100644 --- a/projects/paladinfinance/abi.json +++ b/projects/paladinfinance/abi.json @@ -1,45 +1,6 @@ { - "underlying": { - "inputs": [], - "name": "underlying", - "outputs": [ - { "internalType": "contract IERC20", "name": "", "type": "address" } - ], - "stateMutability": "view", - "type": "function" - }, - - "underlyingBalance": { - "inputs": [], - "name": "underlyingBalance", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - "totalBorrowed": { - "inputs": [], - "name": "totalBorrowed", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "totalReserve": { - "inputs": [], - "name": "totalReserve", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -} + "underlying": "address:underlying", + "underlyingBalance": "uint256:underlyingBalance", + "totalBorrowed": "uint256:totalBorrowed", + "totalReserve": "uint256:totalReserve" +} \ No newline at end of file diff --git a/projects/paladinfinance/index.js b/projects/paladinfinance/index.js index c63a6aecc9f..f38de2ad1fd 100644 --- a/projects/paladinfinance/index.js +++ b/projects/paladinfinance/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const { sumSingleBalance } = require("@defillama/sdk/build/generalUtil"); const abi = require("./abi.json"); @@ -48,7 +49,7 @@ async function ethTvl(timestamp, block) { //If stkAAVE address then change token address to AAVE address if (token === "0x4da27a545c0c5B758a6BA100e3a049001de870f5") { - token = "0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9"; + token = ADDRESSES.ethereum.AAVE; } let tvl = BigNumber(underlyingBalances.output[i].output).plus(totalBorrowed.output[i].output).minus(totalReserve.output[i].output).toFixed(0); sumSingleBalance(balances, token, tvl) diff --git a/projects/palmaswap/index.js b/projects/palmaswap/index.js new file mode 100644 index 00000000000..6cacfa927a3 --- /dev/null +++ b/projects/palmaswap/index.js @@ -0,0 +1,26 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { getUniTVL, staking } = require('../helper/unknownTokens') +const sdk = require('@defillama/sdk') +const uniTvl = getUniTVL({ factory: '0xb8b9a4d9beE1fB41b03edfa47640b1dadF49EDd2', useDefaultCoreAssets: true, }) +const masterchef = '0x41338973c89Aa4bb47aFDCb29c5D74F81b8416A4' +const palma = '0xC2B82A3b2240509D54FbF3f1AC9fc2cA094a6f9c' +const weth = ADDRESSES.core.WCORE + +module.exports = { + misrepresentedTokens: true, + hallmarks: [ + [1679356800, "Rug Pull"] + ], + core: { + tvl: sdk.util.sumChainTvls([uniTvl, staking({ + owners: [masterchef], + tokens: [weth], + })]), + staking: staking({ + owners: [masterchef], + tokens: [palma], + lps: ['0x0D2055199924040BE0F0B855C9F4effaf5C1393e'], + useDefaultCoreAssets: true, + }) + } +}; diff --git a/projects/palmswap/index.js b/projects/palmswap/index.js new file mode 100644 index 00000000000..6c61b803a9b --- /dev/null +++ b/projects/palmswap/index.js @@ -0,0 +1,14 @@ +const { gmxExports } = require("../helper/gmx"); +const { staking } = require("../helper/staking"); + +const palmswapVault = "0x806f709558CDBBa39699FBf323C8fDA4e364Ac7A"; //Vault + +const palmTokenStakingContract = "0x95fc6f7df412040a815494cf27fbc82be6c7585c"; //RewardTracker +const palmToken = "0x29745314B4D294B7C77cDB411B8AAa95923aae38"; //PALM token address + +module.exports = { + bsc: { + tvl: gmxExports({ vault: palmswapVault }), + staking: staking(palmTokenStakingContract, palmToken), + }, +}; diff --git a/projects/pancake-swap-stableswap/index.js b/projects/pancake-swap-stableswap/index.js new file mode 100644 index 00000000000..e73aff10af5 --- /dev/null +++ b/projects/pancake-swap-stableswap/index.js @@ -0,0 +1,39 @@ +const { sumTokens2 } = require('../helper/unwrapLPs') +const { getLogs } = require('../helper/cache/getLogs') +const factories = [ + // { target: '0x36bbb126e75351c0dfb651e39b38fe0bc436ffd2', fromBlock: 21456599, }, + { target: '0x25a55f9f2279a54951133d503490342b50e5cd15', fromBlock: 25535459, token3: true, }, +] + +module.exports = { + methodology: + "TVL accounts for the liquidity on all StableSwap pools, using the TVL chart on https://pancakeswap.finance/info?type=stableSwap as the source.", + bsc: { + tvl: async (_, _b, _cb, { api }) => { + const configs = await Promise.all(factories.map(getTvlConfig)) + return sumTokens2({ api, ownerTokens: configs.flat() }) + + async function getTvlConfig({ target, fromBlock, token3 }) { + let topic = '0xa9551fb056fc743efe2a0a34e39f9769ad10166520df7843c09a66f82e148b97' + let eventAbi = 'event NewStableSwapPair(address indexed swapContract, address indexed tokenA, address indexed tokenB)' + let getOwnTokens = logs => logs.map(i => ([[i.tokenA, i.tokenB], i.swapContract])) + if (token3) { + topic = '0x48dc7a1b156fe3e70ed5ed0afcb307661905edf536f15bb5786e327ea1933532' + eventAbi = 'event NewStableSwapPair(address indexed swapContract, address tokenA, address tokenB, address tokenC, address LP)' + getOwnTokens = logs => logs.map(i => ([[i.tokenA, i.tokenB, i.tokenC], i.swapContract])) + } + + const logs = await getLogs({ + api, + target, + topics: [topic], + fromBlock, + eventAbi, + onlyArgs: true, + }) + + return getOwnTokens(logs) + } + } + }, +}; diff --git a/projects/pancake-swap.js b/projects/pancake-swap/index.js similarity index 58% rename from projects/pancake-swap.js rename to projects/pancake-swap/index.js index a27757bbb04..6de8621a3d4 100644 --- a/projects/pancake-swap.js +++ b/projects/pancake-swap/index.js @@ -1,19 +1,19 @@ -const { request, gql } = require("graphql-request"); -const { toUSDTBalances } = require('./helper/balances') -const { stakings } = require('./helper/staking') -const { getUniTVL } = require('./helper/unknownTokens') -const { dexExport } = require('./helper/chain/aptos') +const { request, } = require("graphql-request"); +const { toUSDTBalances } = require('../helper/balances') +const { stakings } = require('../helper/staking') +const { getUniTVL } = require('../helper/unknownTokens') +const { dexExport } = require('../helper/chain/aptos') -const graphEndpoint = 'https://bsc.streamingfast.io/subgraphs/name/pancakeswap/exchange-v2' -const currentQuery = gql` +const graphEndpoint = 'https://proxy-worker.pancake-swap.workers.dev/bsc-exchange' +const currentQuery = ` query pancakeFactories { pancakeFactories(first: 1) { totalLiquidityUSD } } ` -const historicalQuery = gql` +const historicalQuery = ` query pancakeDayDatas { pancakeDayDatas( first: 1000 @@ -29,7 +29,7 @@ pancakeDayDatas( ` const graphUrl = 'https://api.thegraph.com/subgraphs/name/pancakeswap/exchange' -const graphQuery = gql` +const graphQuery = ` query get_tvl($block: Int) { uniswapFactories( block: { number: $block } @@ -63,7 +63,7 @@ async function tvl(timestamp, ethBlock, chainBlocks) { } ); const usdTvl = Number(uniswapFactories[0].totalLiquidityUSD) - + return toUSDTBalances(usdTvl) } return toUSDTBalances(closest.totalLiquidityUSD) @@ -73,13 +73,20 @@ async function tvl(timestamp, ethBlock, chainBlocks) { module.exports = { timetravel: false, misrepresentedTokens: true, - methodology: 'TVL accounts for the liquidity on all AMM pools, using the TVL chart on https://pancakeswap.info/ as the source. Staking accounts for the CAKE locked in MasterChef (0x73feaa1eE314F8c655E354234017bE2193C9E24E)', + methodology: 'TVL accounts for the liquidity on all AMM pools, using the TVL chart on https://pancakeswap.finance/info as the source. Staking accounts for the CAKE locked in MasterChef (0x73feaa1eE314F8c655E354234017bE2193C9E24E)', bsc: { - staking: stakings(["0x73feaa1eE314F8c655E354234017bE2193C9E24E", "0x45c54210128a065de780c4b0df3d16664f7f859e"], "0x0e09fabb73bd3ade0a17ecc321fd13a19e81ce82", "bsc"), + staking: stakings(["0x73feaa1eE314F8c655E354234017bE2193C9E24E", "0xa5f8C5Dbd5F286960b9d90548680aE5ebFf07652", "0x45c54210128a065de780c4b0df3d16664f7f859e", "0x556B9306565093C855AEA9AE92A594704c2Cd59e"], "0x0e09fabb73bd3ade0a17ecc321fd13a19e81ce82", "bsc"), tvl }, ethereum: { - tvl: getUniTVL({ chain: 'ethereum', factory: '0x1097053Fd2ea711dad45caCcc45EfF7548fCB362', useDefaultCoreAssets: true, }) + staking: stakings(["0x556B9306565093C855AEA9AE92A594704c2Cd59e"], "0x152649ea73beab28c5b49b26eb48f7ead6d4c898", "ethereum"), + tvl: getUniTVL({ factory: '0x1097053Fd2ea711dad45caCcc45EfF7548fCB362', useDefaultCoreAssets: true, }) + }, + polygon_zkevm: { + tvl: getUniTVL({ factory: '0x02a84c1b3BBD7401a5f7fa98a384EBC70bB5749E', useDefaultCoreAssets: true, }) + }, + linea: { + tvl: getUniTVL({ factory: '0x02a84c1b3BBD7401a5f7fa98a384EBC70bB5749E', useDefaultCoreAssets: true, }) }, aptos: dexExport({ account: '0xc7efb4076dbe143cbcd98cfaaa929ecfc8f299203dfff63b95ccb6bfe19850fa', @@ -87,4 +94,7 @@ module.exports = { token0Reserve: i => i.data.reserve_x, token1Reserve: i => i.data.reserve_y, }).aptos, + era: { + tvl: getUniTVL({ factory: '0xd03D8D566183F0086d8D09A84E1e30b58Dd5619d', useDefaultCoreAssets: true, }) + }, } diff --git a/projects/pancakeswap-v3/index.js b/projects/pancakeswap-v3/index.js new file mode 100644 index 00000000000..2e2afab9811 --- /dev/null +++ b/projects/pancakeswap-v3/index.js @@ -0,0 +1,16 @@ +const { uniV3Export } = require('../helper/uniswapV3') + +module.exports = uniV3Export({ + bsc: { factory: '0x0bfbcf9fa4f9c56b0f40a671ad40e0805a091865', fromBlock: 26956207, blacklistedTokens: [ + '0x860368babf32129c18306a70ce7db10c5b437072', + '0xc476d3961f77645464acccce404eb17815a80878', + '0xf8c7f403829cc0f9a37f126a3da41358c232acdf', + '0x95e7c70b58790a1cbd377bc403cd7e9be7e0afb1', + '0x454f4597582df557c2757403f47d3f3bbb890d43', + '0x121a3fba8456ebce13964363ba35fea00c2aa3d2', + ] }, + ethereum: { factory: '0x0bfbcf9fa4f9c56b0f40a671ad40e0805a091865', fromBlock: 16950685, }, + polygon_zkevm: { factory: '0x0BFbCF9fa4f9C56B0F40a671Ad40E0805A091865', fromBlock: 750148, }, + linea: { factory: '0x0BFbCF9fa4f9C56B0F40a671Ad40E0805A091865', fromBlock: 1445, }, + era: { factory: '0x1BB72E0CbbEA93c08f535fc7856E0338D7F7a8aB', fromBlock: 9413438, } +}) diff --git a/projects/pandachef/index.js b/projects/pandachef/index.js new file mode 100644 index 00000000000..9e96c53aba7 --- /dev/null +++ b/projects/pandachef/index.js @@ -0,0 +1,24 @@ +const abi = { + "poolInfo": "function poolInfo(uint256) view returns (address lpToken, uint256 allocPoint, uint256 lastRewardBlock, uint256 accBaoPerShare)" +} +const { staking } = require("../helper/staking"); +const { sumTokens2 } = require("../helper/unwrapLPs"); + + +const masterChef = "0x9942cb4c6180820E6211183ab29831641F58577A"; +const PNDA = "0x47DcC83a14aD53Ed1f13d3CaE8AA4115f07557C0"; + +async function tvl(_, _b, _cb, { api, }) { + const tokenInfo = await api.fetchList({ lengthAbi: 'uint256:poolLength', itemAbi: abi.poolInfo, target: masterChef }) + let tokens = tokenInfo.map(i => i.lpToken) + const symbols = await api.multiCall({ abi: 'erc20:symbol', calls: tokens}) + tokens = tokens.filter((_, i) => symbols[i] !== 'PNDA-V2') // skip own LP tokens + return sumTokens2({ api, owner: masterChef, tokens, blacklistedTokens: [PNDA], resolveLP: true, }) +} + +module.exports = { + bsc: { + tvl, + staking: staking(masterChef, PNDA) + } +} \ No newline at end of file diff --git a/projects/pandaland/index.js b/projects/pandaland/index.js index bcdfa7db8d1..a0c273c6411 100644 --- a/projects/pandaland/index.js +++ b/projects/pandaland/index.js @@ -4,39 +4,6 @@ const PDA = "0x288B6Ca2eFCF39C9B68052B0088A0cB3f3D3B5f2"; const MASTERCHEF = "0x1682051ad5bb1933d5446fa6d4d9ad878df95f21"; const CHAIN = "smartbch"; -const chefAbi = { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "poolInfo", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "lpToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "allocPoint", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastRewardBlock", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accSushiPerShare", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" -} +const chefAbi = 'function poolInfo(uint256) view returns (address lpToken, uint256 allocPoint, uint256 lastRewardBlock, uint256 accSushiPerShare)' module.exports = masterChefExports(MASTERCHEF, CHAIN, PDA, false, chefAbi) \ No newline at end of file diff --git a/projects/pandaswap/abi.json b/projects/pandaswap/abi.json deleted file mode 100644 index 73daef83d70..00000000000 --- a/projects/pandaswap/abi.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "poolInfo": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "poolInfo", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "lpToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "allocPoint", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastRewardBlock", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accBaoPerShare", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -} \ No newline at end of file diff --git a/projects/pandaswap/index.js b/projects/pandaswap/index.js index a5d0fc2416e..16ff75bd665 100644 --- a/projects/pandaswap/index.js +++ b/projects/pandaswap/index.js @@ -1,7 +1,3 @@ -const abi = require("./abi.json"); -const { masterChefExports } = require("../helper/masterchef"); +const { uniTvlExport } = require('../helper/unknownTokens') -const masterChef = "0x9942cb4c6180820E6211183ab29831641F58577A"; -const PNDA = "0x47DcC83a14aD53Ed1f13d3CaE8AA4115f07557C0"; - -module.exports = masterChefExports(masterChef, "bsc", PNDA, true, abi.poolInfo) \ No newline at end of file +module.exports = uniTvlExport('bsc', '0x9ad32bf5dafe152cbe027398219611db4e8753b3') \ No newline at end of file diff --git a/projects/pandora-digital/index.js b/projects/pandora-digital/index.js index 5cf7c0cca99..9f10805130b 100644 --- a/projects/pandora-digital/index.js +++ b/projects/pandora-digital/index.js @@ -1,16 +1,10 @@ -const sdk = require("@defillama/sdk"); -const {calculateUniTvl} = require('../helper/calculateUniTvl.js') +const {uniTvlExport} = require('../helper/calculateUniTvl.js') const PANDORA_FACTORY = "0xFf9A4E72405Df3ca3D909523229677e6B2b8dC71" -async function bscTvl(timestamp, block, chainBlocks) { - return calculateUniTvl(addr=>`bsc:${addr}`, chainBlocks['bsc'], 'bsc', PANDORA_FACTORY, 0, true); -} - module.exports = { - misrepresentedTokens: true, bsc:{ - tvl: bscTvl + tvl: uniTvlExport(PANDORA_FACTORY, 'bsc', true), }, methodology: "The TVL is the total of all liquidity pools on Pandora DEX", } \ No newline at end of file diff --git a/projects/pangolin/index.js b/projects/pangolin/index.js index 249f5dd8e2e..1f1f2c8d0e8 100644 --- a/projects/pangolin/index.js +++ b/projects/pangolin/index.js @@ -1,5 +1,8 @@ -const { staking, stakingPricedLP} = require("../helper/staking"); +const { staking, stakingPricedLP } = require("../helper/staking"); +const { graphQuery } = require("../helper/http"); +const { getCurrentBlock } = require("../helper/chain/hbar"); const { getUniTVL } = require('../helper/unknownTokens') +const { toUSDTBalances } = require('../helper/balances') const contracts = { avax: { @@ -12,18 +15,23 @@ const contracts = { png: "0xb2987753D1561570f726Aa373F48E77e27aa5FF4", stakingContract: "0x7428A089A79B24400a620F1Cbf8bd0526cFae777", }, + flare: { + factory: "0xbfe13753156b9c6b2818FB45ff3D2392ea43d79A", + png: "0xC60BcDaA9CC7Cc372E793101fDfCB1083E25A203", + }, }; module.exports = { misrepresentedTokens: true, + timetravel: false, // hedera rug methodology: "The Pangolin factory contract address are used to obtain the balance held in every LP pair and the stake contract is used to get the locked PNG balance.", avax: { - tvl: getUniTVL({ chain: 'avax', useDefaultCoreAssets: true, factory: contracts.avax.factory, }), + tvl: getUniTVL({ useDefaultCoreAssets: true, factory: contracts.avax.factory, }), staking: staking(contracts.avax.stakingContract, contracts.avax.png, "avax"), }, songbird: { - tvl: getUniTVL({ chain: 'songbird', useDefaultCoreAssets: true, factory: contracts.songbird.factory, }), + tvl: getUniTVL({ useDefaultCoreAssets: true, factory: contracts.songbird.factory, }), staking: stakingPricedLP( contracts.songbird.stakingContract, contracts.songbird.png, @@ -33,5 +41,19 @@ module.exports = { false ), }, + flare: { + tvl: getUniTVL({ useDefaultCoreAssets: true, factory: contracts.flare.factory, }), + }, + hedera: { + tvl: async () => { + const block = await getCurrentBlock() + const data = await graphQuery('https://hedera-graph.pangolin.network/subgraphs/name/pangolin', `{ + pangolinFactory(id: "1" block: { number: ${block - 1000} }) { + totalLiquidityUSD + } + }`) + return toUSDTBalances(data.pangolinFactory.totalLiquidityUSD) + } + }, start: 1612715300, // 7th-Feb-2021 }; diff --git a/projects/pantherswap/index.js b/projects/pantherswap/index.js index 754c49a88fd..31dfebfaade 100644 --- a/projects/pantherswap/index.js +++ b/projects/pantherswap/index.js @@ -1,14 +1,9 @@ -const sdk = require("@defillama/sdk"); -const {calculateUniTvl} = require("../helper/calculateUniTvl"); -const factory = "0x670f55c6284c629c23baE99F585e3f17E8b9FC31"; - -const bscTvl = async (timestamp, ethBlock, chainBlocks) => { - const balances = {}; +const {uniTvlExport} = require("../helper/calculateUniTvl"); - return calculateUniTvl(addr=>`bsc:${addr}`, chainBlocks.bsc, 'bsc', factory, 0, true); -}; +const factory = "0x670f55c6284c629c23baE99F585e3f17E8b9FC31"; module.exports = { - bsc: { tvl: bscTvl, } + bsc: { + tvl: uniTvlExport(factory, 'bsc', true), } } diff --git a/projects/papa-dao/index.js b/projects/papa-dao/index.js index 926f63b937f..d601d5eda23 100644 --- a/projects/papa-dao/index.js +++ b/projects/papa-dao/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { ohmTvl } = require("../helper/ohm"); const treasuryAddress = "0x3C8e800B9f12771A5f150D0943De968ABc7A7bE1"; @@ -5,9 +6,9 @@ module.exports = ohmTvl(treasuryAddress, [ //MIM ["0x130966628846bfd36ff31a822705796e8cb8c18d", false], //USDT.e - ["0xc7198437980c041c805a1edcba50c1ce5db95118", false], + [ADDRESSES.avax.USDT_e, false], //wAVAX - ["0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7", false], + [ADDRESSES.avax.WAVAX, false], //JOE LP ["0xa03a99cd3d553fe9ebbccecabcb8c47100482f72", true] , //JOE LP diff --git a/projects/paperdao/index.js b/projects/paperdao/index.js index c69b6cccdc7..d70f520098f 100644 --- a/projects/paperdao/index.js +++ b/projects/paperdao/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { compoundExports } = require("../helper/compound"); const blacklist = [ @@ -10,5 +11,5 @@ const blacklist = [ module.exports = { methodology: `As in Compound Finance, TVL counts the tokens locked in the contracts to be used as collateral to borrow or to earn yield. Borrowed coins are counted as "Borrowed" TVL and can be toggled towards the regular TVL.`, - ethpow: compoundExports("0x5e496e7F241B13c514A78B7E840bc3cC744D7215", "ethpow", "0xb9e008f2C039fB994C8adD806F8aF709899aA95e", '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2' , undefined, undefined, {blacklistedTokens: blacklist}) + ethpow: compoundExports("0x5e496e7F241B13c514A78B7E840bc3cC744D7215", "ethpow", "0xb9e008f2C039fB994C8adD806F8aF709899aA95e", ADDRESSES.ethereum.WETH , undefined, undefined, {blacklistedTokens: blacklist}) } \ No newline at end of file diff --git a/projects/papr-wtf/index.js b/projects/papr-wtf/index.js new file mode 100644 index 00000000000..a0c01135b4b --- /dev/null +++ b/projects/papr-wtf/index.js @@ -0,0 +1,20 @@ +const { sumTokens2 } = require('../helper/unwrapLPs') +const { getLogs } = require('../helper/cache/getLogs') + +async function tvl(_, _b, _cb, { api, }) { + + const controller = '0x3b29c19ff2fcea0ff98d0ef5b184354d74ea74b0' + const logs = await getLogs({ + api, + target: controller, + topic: 'AllowCollateral(address,bool)', + eventAbi: 'event AllowCollateral(address indexed collateral, bool isAllowed)', + onlyArgs: true, + fromBlock: 16592385, + }) + return sumTokens2({ api, owner: controller, tokens: logs.map(i => i.collateral)}) +} + +module.exports = { + ethereum: { tvl } +} diff --git a/projects/paprprintr/index.js b/projects/paprprintr/index.js index 793d7d9a74f..7fc68b007d1 100644 --- a/projects/paprprintr/index.js +++ b/projects/paprprintr/index.js @@ -1,35 +1,23 @@ -const { fetchURL } = require("../helper/utils"); -const { toUSDTBalances } = require("../helper/balances"); +const { staking } = require("../helper/staking"); +const { pool2 } = require("../helper/pool2"); -function chainTvl(ChainName, mapFunction) { - return async () => { - const response = await fetchURL("https://api.paprprintr.finance/api"); - const data = Number( - response.data.networks - .filter((chain) => chain.name.includes(ChainName)) - .map(mapFunction) - ); - - return toUSDTBalances(data); - }; -} - -function chainExports(chain) { - return { - tvl: chainTvl(chain, (tvl) => tvl.stats.vaults), - staking: chainTvl(chain, (stake) => stake.stats.boardroom.tvl), - pool2: chainTvl(chain, (pool) => pool.stats.pools), - }; +const config = { + bsc: { papr: '0x246475dF8703BE0C2bA2f8d0fb7248D95Cc1Ba26', lp: '0x88afbae882348011c80bd4f659962d32ffed4089', stakingC: '0xa00ba88adb75d8877e4f2035f3abe43b74f10a4b', pool2C: '0x28165e285cb40210f6b896bc937f7322f3a2bee2', }, + polygon: { papr: '0xFbe49330E7B9F58a822788F86c1be38Ab902Bab1', lp: '0xb1Cd060D7c7B8F338e13D6Aac11f484eE451c5b5', stakingC: '0xD524e0dE85b225A7ea29E989bF13a4deE5De1913', pool2C: '0xac2b5b9c4696dd96c97d3d8da6f6ff412020566d', }, + kcc: { papr: '0x9dEb450638266f787E6E29d0Fe811069f828CF56', stakingC: '0xa0A0727cA35B2Af606EceDD2f69d8884DE090538', }, + fantom: { papr: '0xC5e7A99A20941cBF56E0D4De608332cDB792e23e', stakingC: '0x982Df9B6e86838c7f0fB0d63eD84f98dcC110E29', }, + aurora: { papr: '0xa5C09De3aa1CDb5Cb190Be66c77E033Be1CA594A', stakingC: '0x008757aB3E3aDE24a402882d701f9B99F3809283', }, } module.exports = { - timetravel: false, - kcc: chainExports("KCC"), - fantom: chainExports("Fantom"), - bsc: chainExports("BSC"), - polygon: chainExports("Polygon"), - aurora: chainExports("Aurora"), - okexchain: chainExports("OKExChain"), - methodology: - "Counts the liquidity on all the Vaults; and the portion locked on the Pools and Broadrooms as pool2 and staking respectivly", }; + +Object.keys(config).forEach(chain => { + const { papr, lp, stakingC, pool2C } = config[chain] + module.exports[chain] = { + tvl: () => ({}), + staking: staking(stakingC, papr, chain), + } + if (lp && pool2C) + module.exports[chain].pool2 = pool2(pool2C, lp, chain) +}) \ No newline at end of file diff --git a/projects/parallax/abis/prllxERC20.json b/projects/parallax/abis/prllxERC20.json new file mode 100644 index 00000000000..ba0a575e0dc --- /dev/null +++ b/projects/parallax/abis/prllxERC20.json @@ -0,0 +1,4 @@ +{ + "strategyToId": "function strategyToId(address) view returns (uint256)", + "strategies": "function strategies(uint256) view returns (tuple fees, uint256 totalDeposited, uint256 totalStaked, uint256 lastCompoundTimestamp, uint256 cap, uint256 rewardPerBlock, uint256 rewardPerShare, uint256 lastUpdatedBlockNumber, address strategy, uint32 timelock, bool isActive, address rewardToken, uint256 usersCount)" +} \ No newline at end of file diff --git a/projects/parallax/contracts.json b/projects/parallax/contracts.json new file mode 100644 index 00000000000..fe1e98e7e7f --- /dev/null +++ b/projects/parallax/contracts.json @@ -0,0 +1,26 @@ +{ + "eth": { + "parallaxAddress": "0xd8935F1369E1dAc77CD37e664BC13ffdd741B962", + "strategyAddress": "0x9E6121e89dD50B5D02362A9fdb7EC1fAd3D15725", + "lpAddress": "0x5aee1e99fe86960377de9f88689616916d5dcabe", + "feedAddress": "0x5f4ec3df9cbd43714fe2740f5e3616155c5b8419", + "usdc": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" + }, + "arbitrum": { + "mim": { + "parallaxCoreAddress": "0x07F78cC2668F9Bb152c4026E801df68Ed3AB9858", + "strategyAddress": "0xbf81Ba9D10F96ce0bb1206DE5F2d5B363f9796A9", + "parallaxCoreAddressOld": "0x74A819d4925dC9f473F398863666Ac787B48e1d0", + "strategyAddressOld": "0x7b8eFCd93ee71A0480Ad4dB06849B75573168AF4", + "lpAddresss": "0x30dF229cefa463e991e29D42DB0bae2e122B2AC7", + "usdc": "0xff970a61a04b1ca14834a43f5de4533ebddb5cc8" + }, + "sushi": { + "parallaxAddr": "0xDCBEA8b2142Fe5E97BE9545FCFB30af812685Fb6", + "strategyAddrSushi": "0xb53BbF686b600857B209B863c1Bce2C83acef123", + "strategyAddrGMX": "0xF7caD5Ec40b5980Bd741346eAeE019c6E2b5D373", + "parallaxBackendAddr": "0x1724623a721a094f8Ba9d271c9BE8be83e64f74f", + "usdc": "0xff970a61a04b1ca14834a43f5de4533ebddb5cc8" + } + } +} \ No newline at end of file diff --git a/projects/parallax/getPrice.js b/projects/parallax/getPrice.js new file mode 100644 index 00000000000..1c859d4ebb8 --- /dev/null +++ b/projects/parallax/getPrice.js @@ -0,0 +1,89 @@ +const get_virtual_price = "function get_virtual_price() view returns (uint256)"; +const getRate = "function getRate() view returns (uint256)"; +const latestRoundData = + "function latestRoundData() view returns (uint80 roundId,int256 answer,uint256 startedAt,uint256 updatedAt,uint80 answeredInRound)"; +const getPrice = "function getPrice() view returns (uint256 sushi,uint256 gmx)"; +const { default: BigNumber } = require("bignumber.js"); + +const getPriceMIM = async (tokenAddress, api) => { + const priceLpWei = await api.call({ + target: tokenAddress, + abi: get_virtual_price, + }) + + const decimals = await api.call({ + target: tokenAddress, + abi: "erc20:decimals", + }) + + const tokenPrice = new BigNumber(priceLpWei).div(`1e${decimals}`); + + return { + price: tokenPrice, + decimals, + }; +}; + +const getPriceAura = async ( + tokenAddress, + feedAddress, + api +) => { + const decimals = + await api.call({ + target: tokenAddress, + abi: "erc20:decimals", + }) + + const rate = + await api.call({ + target: tokenAddress, + abi: getRate, + }) + + const getLatestRoundData = + await api.call({ + target: feedAddress, + abi: latestRoundData, + }) + + const ethPriceInUSD = parseInt(getLatestRoundData.answer) / 10 ** 8; + const priceETH = new BigNumber(rate).div(`1e${decimals}`); + + const tokenPrice = new BigNumber(priceETH * ethPriceInUSD).div( + `1e${decimals}` + ); + + return { + price: tokenPrice, + decimals, + }; +}; + +const getPriceSushi = async (backendAddress, api) => { + const sushiDecimals = 14, + gmxDecimals = 8; + + const sushiGmxPrice = await api.call({ + target: backendAddress, + abi: getPrice, + }) + + const sushiPrice = new BigNumber(sushiGmxPrice.sushi).div( + `1e${sushiDecimals}` + ); + const gmxPrice = new BigNumber(sushiGmxPrice.gmx).div(`1e${gmxDecimals}`); + + return { + sushiPrice: sushiPrice, + gmxPrice: gmxPrice, + sushiDecimals, + gmxDecimals, + }; +}; + +module.exports = { + getPriceMIM, + getPriceAura, + getPriceSushi, +}; diff --git a/projects/parallax/index.js b/projects/parallax/index.js new file mode 100644 index 00000000000..100250b8a7a --- /dev/null +++ b/projects/parallax/index.js @@ -0,0 +1,157 @@ +const sdk = require("@defillama/sdk"); +const { default: BigNumber } = require("bignumber.js"); + +const { getPriceMIM, getPriceAura, getPriceSushi } = require("./getPrice"); + +const prllxERC20 = require("./abis/prllxERC20.json"); +const contracts = require("./contracts.json"); + +async function ethTvl(time, _ethBlock, { ethereum: block }, { api }) { + const strategyId = await api.call({ + target: contracts.eth.parallaxAddress, + params: contracts.eth.strategyAddress, + abi: prllxERC20["strategyToId"], + }); + + const strategy = await api.call({ + target: contracts.eth.parallaxAddress, + params: strategyId, + abi: prllxERC20["strategies"], + }); + + const balances = {}; + const { price, decimals } = await getPriceAura( + contracts.eth.lpAddress, + contracts.eth.feedAddress, + api + ); + + // const totalStaked = new BigNumber(strategy.totalStaked).div(`1e${decimals}`); + const totalStakedTVL = price + .times(strategy.totalStaked) + .times(1e6) + .toFixed(0); + + sdk.util.sumSingleBalance( + balances, + `ethereum:${contracts.eth.usdc}`, + totalStakedTVL + ); + + return balances; +} + +async function arbitrumTvl(time, _ethBlock, { arbitrum: block }, { api }) { + const balances = {}; + + const strategyId = await api.call({ + target: contracts.arbitrum.mim.parallaxCoreAddress, + params: contracts.arbitrum.mim.strategyAddress, + abi: prllxERC20["strategyToId"], + }); + + const strategy = await api.call({ + target: contracts.arbitrum.mim.parallaxCoreAddress, + params: strategyId, + abi: prllxERC20["strategies"], + }); + + const { price, decimals } = await getPriceMIM( + contracts.arbitrum.mim.lpAddresss, + api + ); + + const totalStaked = new BigNumber(strategy.totalStaked).div(`1e${decimals}`); + const totalStakedTVLMIM = price.times(totalStaked).times(1e6).toFixed(0); + + // const strategyIdOld = await api.call({ + // target: contracts.arbitrum.mim.parallaxCoreAddressOld, + // params: contracts.arbitrum.mim.strategyAddressOld, + // abi: prllxERC20["strategyToId"], + // }) + // + // const strategyOld = + // await api.call({ + // target: contracts.arbitrum.mim.parallaxCoreAddressOld, + // params: strategyIdOld, + // abi: prllxERC20["strategies"], + // }) + // + // const totalStakedOld = new BigNumber(strategyOld.totalStaked).div( + // `1e${decimals}` + // ); + // const totalStakedTVLMIMOld = price + // .times(totalStakedOld) + // .times(1e6) + // .toFixed(0); + + // const totalStakedTVLMIMAll = + // Number(totalStakedTVLMIM) + Number(totalStakedTVLMIMOld); + + sdk.util.sumSingleBalance( + balances, + `arbitrum:${contracts.arbitrum.mim.usdc}`, + totalStakedTVLMIM + ); + + const strategySushiId = await api.call({ + target: contracts.arbitrum.sushi.parallaxAddr, + params: contracts.arbitrum.sushi.strategyAddrSushi, + abi: prllxERC20["strategyToId"], + }); + + const strategyGmxId = await api.call({ + target: contracts.arbitrum.sushi.parallaxAddr, + params: contracts.arbitrum.sushi.strategyAddrGMX, + abi: prllxERC20["strategyToId"], + }); + + const strategySushi = await api.call({ + target: contracts.arbitrum.sushi.parallaxAddr, + params: strategySushiId, + abi: prllxERC20["strategies"], + }); + + const strategyGmx = await api.call({ + target: contracts.arbitrum.sushi.parallaxAddr, + params: strategyGmxId, + abi: prllxERC20["strategies"], + }); + + const { sushiPrice, gmxPrice, sushiDecimals, gmxDecimals } = + await getPriceSushi(contracts.arbitrum.sushi.parallaxBackendAddr, api); + + const totalStakedSushi = new BigNumber(strategySushi.totalStaked).div(`1e18`); + const totalStakedGmx = new BigNumber(strategyGmx.totalStaked).div(`1e18`); + + const totalStakedTVLSushi = sushiPrice + .times(totalStakedSushi) + .times(1e6) + .toFixed(0); + + const totalStakedTVLGmx = gmxPrice + .times(totalStakedGmx) + .times(1e6) + .toFixed(0); + + const totalStakedTVL = + Number(totalStakedTVLSushi) + Number(totalStakedTVLGmx); + + sdk.util.sumSingleBalance( + balances, + `arbitrum:${contracts.arbitrum.sushi.usdc}`, + totalStakedTVL + ); + + return balances; +} + +module.exports = { + methodology: "TVL comes from the Staking Vaults", + arbitrum: { + tvl: arbitrumTvl, + }, + ethereum: { + tvl: ethTvl, + }, +}; diff --git a/projects/paraluni-dex/index.js b/projects/paraluni-dex/index.js new file mode 100644 index 00000000000..3e529209f5e --- /dev/null +++ b/projects/paraluni-dex/index.js @@ -0,0 +1,8 @@ +const { uniTvlExport } = require('../helper/unknownTokens'); +const prehackAddress = '0xa0a33e6a7d8961e4d8210a70bc67d3e7b0e8135f' + +module.exports = uniTvlExport('bsc', '0xf3b426a160686082447545e1150829ee5485a91a') + +module.exports.hallmarks = [ + [Math.floor(new Date('2022-05-02')/1e3), 'launch new dex'], +] \ No newline at end of file diff --git a/projects/paraspace-ape-staking/index.js b/projects/paraspace-ape-staking/index.js new file mode 100644 index 00000000000..ba6f75a4e15 --- /dev/null +++ b/projects/paraspace-ape-staking/index.js @@ -0,0 +1,59 @@ +const abi = require("../paraspace/helper/abis"); +const address = require("../paraspace/helper/address"); +const sdk = require("@defillama/sdk"); + +async function tvl(_, _1, _cb, { api }) { + const { + UiPoolDataProvider, + PoolAddressProvider, + ApeCoinStaking, + ApeCoin, + P2PPairStaking, + cAPE, + Bayc, + Bakc, + Mayc, + } = address[api.chain]; + let [reservesData] = await api.call({ + target: UiPoolDataProvider, + params: PoolAddressProvider, + abi: abi.UiPoolDataProvider.getReservesData, + }); + + const nMAYC = reservesData.find( + (r) => r.underlyingAsset.toLowerCase() === Mayc.toLowerCase() + ).xTokenAddress; + const nBAYC = reservesData.find( + (r) => r.underlyingAsset.toLowerCase() === Bayc.toLowerCase() + ).xTokenAddress; + const nBAKC = reservesData.find( + (r) => r.underlyingAsset.toLowerCase() === Bakc.toLowerCase() + ).xTokenAddress; + + const stakedAddress = [nBAYC, nMAYC, nBAKC, P2PPairStaking, cAPE]; + + const balances = {}; + + const allStakes = await api.multiCall({ + calls: stakedAddress, + target: ApeCoinStaking, + abi: abi.ApeCoinStaking.getAllStakes, + }); + const otherPools = {} + allStakes.flat().forEach(({ poolId, tokenId, deposited }) => { + if (poolId === '0') { + sdk.util.sumSingleBalance(balances, ApeCoin, deposited, api.chain) + return; + } + otherPools[`${poolId}-${tokenId}`] = deposited + }) + Object.values(otherPools).forEach(v => sdk.util.sumSingleBalance(balances, ApeCoin, v, api.chain)) + + return balances; +} + +module.exports = { + ethereum: { + tvl, + }, +}; diff --git a/projects/paraspace/helper/abis/ApeCoinStaking.json b/projects/paraspace/helper/abis/ApeCoinStaking.json new file mode 100644 index 00000000000..ed67d317f66 --- /dev/null +++ b/projects/paraspace/helper/abis/ApeCoinStaking.json @@ -0,0 +1,3 @@ +{ + "getAllStakes": "function getAllStakes(address _address) external view returns (tuple(uint256 poolId, uint256 tokenId, uint256 deposited, uint256 unclaimed, uint256 rewards24hr, tuple(uint256 mainTokenId, uint256 mainTypePoolId))[])" +} diff --git a/projects/paraspace/helper/abis/ERC721.json b/projects/paraspace/helper/abis/ERC721.json new file mode 100644 index 00000000000..60574c05f11 --- /dev/null +++ b/projects/paraspace/helper/abis/ERC721.json @@ -0,0 +1,3 @@ +{ + "tokenOfOwnerByIndex": "function tokenOfOwnerByIndex(address owner, uint256 index) view returns (uint256)" +} \ No newline at end of file diff --git a/projects/paraspace/helper/abis/UiPoolDataProvider.json b/projects/paraspace/helper/abis/UiPoolDataProvider.json new file mode 100644 index 00000000000..5172ed11532 --- /dev/null +++ b/projects/paraspace/helper/abis/UiPoolDataProvider.json @@ -0,0 +1,4 @@ +{ + "getReservesData": "function getReservesData(address provider) view returns (tuple(address underlyingAsset, string name, string symbol, uint256 decimals, uint256 baseLTVasCollateral, uint256 reserveLiquidationThreshold, uint256 reserveLiquidationBonus, uint256 reserveFactor, bool usageAsCollateralEnabled, bool borrowingEnabled, bool auctionEnabled, bool isActive, bool isFrozen, bool isPaused, bool isAtomicPricing, uint128 liquidityIndex, uint128 variableBorrowIndex, uint128 liquidityRate, uint128 variableBorrowRate, uint40 lastUpdateTimestamp, address xTokenAddress, address variableDebtTokenAddress, address interestRateStrategyAddress, address auctionStrategyAddress, address timeLockStrategyAddress, uint256 availableLiquidity, uint256 totalScaledVariableDebt, uint256 priceInMarketReferenceCurrency, address priceOracle, uint256 variableRateSlope1, uint256 variableRateSlope2, uint256 baseVariableBorrowRate, uint256 optimalUsageRatio, uint128 accruedToTreasury, uint256 borrowCap, uint256 supplyCap, uint8 assetType, tuple(uint256 minThreshold, uint256 midThreshold, uint48 minWaitTime, uint48 midWaitTime, uint48 maxWaitTime, uint48 poolPeriodWaitTime, uint256 poolPeriodLimit, uint256 period, uint128 totalAmountInCurrentPeriod, uint48 lastResetTimestamp) timeLockStrategyData)[], tuple(uint256 marketReferenceCurrencyUnit, int256 marketReferenceCurrencyPriceInUsd, int256 networkBaseTokenPriceInUsd, uint8 networkBaseTokenPriceDecimals))", + "getUniswapV3LpTokenData": "function getUniswapV3LpTokenData(address provider, address lpTokenAddress, uint256 tokenId) view returns (tuple(address token0, address token1, uint24 feeRate, int24 positionTickLower, int24 positionTickUpper, int24 currentTick, uint128 liquidity, uint256 liquidityToken0Amount, uint256 liquidityToken1Amount, uint256 lpFeeToken0Amount, uint256 lpFeeToken1Amount, uint256 tokenPrice, uint256 baseLTVasCollateral, uint256 reserveLiquidationThreshold))" +} diff --git a/projects/paraspace/helper/abis/index.js b/projects/paraspace/helper/abis/index.js new file mode 100644 index 00000000000..a6790156187 --- /dev/null +++ b/projects/paraspace/helper/abis/index.js @@ -0,0 +1,9 @@ +const UiPoolDataProvider = require("./UiPoolDataProvider.json"); +const ERC721 = require("./ERC721.json"); +const ApeCoinStaking = require("./ApeCoinStaking.json"); + +module.exports = { + UiPoolDataProvider, + ERC721, + ApeCoinStaking +}; diff --git a/projects/paraspace/helper/address.js b/projects/paraspace/helper/address.js new file mode 100644 index 00000000000..5d313c70713 --- /dev/null +++ b/projects/paraspace/helper/address.js @@ -0,0 +1,28 @@ +module.exports = { + ethereum: { + UiPoolDataProvider: "0x30E6C173Ff3958a6629258C71Bd161e70BEe0e6D", + PoolAddressProvider: "0x6cD30e716ADbE47dADf7319f6F2FB83d507c857d", + UniV3Pos: "0xC36442b4a4522E871399CD717aBDD847Ab11FE88", + P2PPairStaking: "0xf090Eb4c2B63e7B26E8Bb09e6Fc0cC3A7586263B", + Bayc: "0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D", + Mayc: "0x60E4d786628Fea6478F785A6d7e704777c86a7c6", + Bakc: "0xba30E5F9Bb24caa003E9f2f0497Ad287FDF95623", + ApeCoinStaking: "0x5954aB967Bc958940b7EB73ee84797Dc8a2AFbb9", + ApeCoin: "0x4d224452801ACEd8B2F0aebE155379bb5D594381", + cAPE: "0xC5c9fB6223A989208Df27dCEE33fC59ff5c26fFF", + }, + arbitrum: { + UiPoolDataProvider: "0x94bDD135ccC48fF0440D750300A4e4Ba9B216B3A", + PoolAddressProvider: "0x45a35124749B061a29f91cc8ddf85606586dcf24", + UniV3Pos: "0xC36442b4a4522E871399CD717aBDD847Ab11FE88", + }, + polygon: { + UiPoolDataProvider: "0xa2a9dD7079f05d17BE291D99048e671129DdDc83", + PoolAddressProvider: "0x42b0C49130162F949e82ba855C4eFF0C3Fd4C5cC", + UniV3Pos: "0xC36442b4a4522E871399CD717aBDD847Ab11FE88", + }, + era: { + UiPoolDataProvider: "0x451E3288a2dcD91b001cd831dD75109D524578b6", + PoolAddressProvider: "0xc11B2F53E119634c8755855e56D323C4F6dfd23d", + }, +}; diff --git a/projects/paraspace/helper/index.js b/projects/paraspace/helper/index.js new file mode 100644 index 00000000000..d5d86f7799c --- /dev/null +++ b/projects/paraspace/helper/index.js @@ -0,0 +1,50 @@ +const sdk = require("@defillama/sdk"); +const { sumTokens2, } = require('../../helper/unwrapLPs') + +const abi = require("./abis"); +const address = require("./address"); + +async function tvl(_, _1, _cb, { api, }) { + const { UiPoolDataProvider, PoolAddressProvider, UniV3Pos, P2PPairStaking, Bayc, Bakc, Mayc } = address[api.chain] + let [reservesData] = await api.call({ + target: UiPoolDataProvider, + params: PoolAddressProvider, + abi: abi.UiPoolDataProvider.getReservesData, + }) + + const balances = {}; + if (UniV3Pos) { + const isUniV3XToken = i => i.underlyingAsset.toLowerCase() === UniV3Pos.toLowerCase() + + const uniswapOwners = reservesData.filter(isUniV3XToken).map(i => i.xTokenAddress) + reservesData = reservesData.filter(i => !isUniV3XToken(i)) + await sumTokens2({ chain: api.chain, api, balances, owners: uniswapOwners, resolveUniV3: true}) + } + let toa = reservesData.map(i => ([i.underlyingAsset, i.xTokenAddress])) + if (api.chain === "ethereum") { + toa.push(...[[Bayc, P2PPairStaking], [Mayc, P2PPairStaking], [Bakc, P2PPairStaking]]) + } + return sumTokens2({ chain: api.chain, balances, tokensAndOwners: toa, blacklistedTokens: ['0x0000000000000000000000000000000000000001', address.ethereum.cAPE] }) +} + +async function borrowed(_, _1, _cb, { api, }) { + const { UiPoolDataProvider, PoolAddressProvider, } = address[api.chain] + let [reservesData] = await api.call({ + target: UiPoolDataProvider, + params: PoolAddressProvider, + abi: abi.UiPoolDataProvider.getReservesData, + }) + + const balances = {}; + + reservesData.forEach((d) => { + sdk.util.sumSingleBalance(balances, d.underlyingAsset, d.totalScaledVariableDebt * d.variableBorrowIndex * 1e-27, api.chain) + }) + + return balances; +} + +module.exports = { + tvl, + borrowed, +}; diff --git a/projects/paraspace/index.js b/projects/paraspace/index.js new file mode 100644 index 00000000000..83dfe189914 --- /dev/null +++ b/projects/paraspace/index.js @@ -0,0 +1,25 @@ +const { tvl, borrowed } = require("./helper/index"); + +module.exports = { + hallmarks: [ + [Math.floor(new Date('2023-03-17') / 1e3), 'Whitehat hack'], + [Math.floor(new Date('2023-05-10') / 1e3), 'CEO drama'], + ], + methodology: `TVL includes ERC-20 and ERC-721 tokens that have been supplied as well as ERC-20 tokens that are supplied for lending.`, + ethereum: { + tvl, + borrowed, + }, + arbitrum: { + tvl, + borrowed, + }, + polygon: { + tvl, + borrowed, + }, + era: { + tvl, + borrowed, + } +}; diff --git a/projects/parasset/index.js b/projects/parasset/index.js index 1f4e5dca710..ba61075e302 100644 --- a/projects/parasset/index.js +++ b/projects/parasset/index.js @@ -1,14 +1,15 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const { stakings } = require("../helper/staking"); const PUSDMorPool = "0x505eFcC134552e34ec67633D1254704B09584227"; // Mortgage-PUSD pool contract const PETHMorPool = "0x9a5C88aC0F209F284E35b4306710fEf83b8f9723"; //Mortgage-PETH pool contract const NEST = "0x04abeda201850ac0124161f037efd70c74ddc74c"; -const ETH = "0x0000000000000000000000000000000000000000"; +const ETH = ADDRESSES.null; const PUSDInsPool = "0x79025438C04Ae6A683Bcc7f7c51a01Eb4C2DDabA"; //Insurance-USD pool contract const PUSD = "0xCCEcC702Ec67309Bc3DDAF6a42E9e5a6b8Da58f0"; -const USDT = "0xdAC17F958D2ee523a2206206994597C13D831ec7"; +const USDT = ADDRESSES.ethereum.USDT; const PETHInsPool = "0x0bd32fFC80d5B98E403985D4446AE3BA67528C2e"; //Insurance-ETH pool contract const PETH = "0x53f878fb7ec7b86e4f9a0cb1e9a6c89c0555fbbd"; diff --git a/projects/parcl/index.js b/projects/parcl/index.js new file mode 100644 index 00000000000..a79539b4bf7 --- /dev/null +++ b/projects/parcl/index.js @@ -0,0 +1,208 @@ +const { getProvider, sumTokens2, } = require('../helper/solana') +const { Program, } = require("@project-serum/anchor") + +async function tvl() { + const provider = getProvider() + const programId = 'pAMMTYk2C9tAxenepGk8a1bi9JQtUdnzu3UAh7NxYcW' + const program = new Program(idl, programId, provider) + const data = await program.account.pool.all() + return sumTokens2({ tokenAccounts: data.map(i => i.account.collateralVault.toBase58()) }) +} + +module.exports = { + timetravel: false, + solana: { tvl, }, +} + +const idl = { + version: '0.0.3', + name: 'parcl_v2_core', + constants: [], + instructions: [], + accounts: [ + { + name: 'pool', + type: { + kind: 'struct', + fields: [ + { + name: 'version', + type: 'u8' + }, + { + name: 'bumpSeed', + type: { + array: [ + 'u8', + 1 + ] + } + }, + { + name: 'tradeFeeRateSeed', + type: { + array: [ + 'u8', + 2 + ] + } + }, + { + name: 'liquidationFeeRateSeed', + type: { + array: [ + 'u8', + 2 + ] + } + }, + { + name: 'liquidationThresholdSeed', + type: { + array: [ + 'u8', + 2 + ] + } + }, + { + name: 'minLeverageSeed', + type: { + array: [ + 'u8', + 1 + ] + } + }, + { + name: 'maxLeverageSeed', + type: { + array: [ + 'u8', + 1 + ] + } + }, + { + name: 'maxNegativeSkewImpactSeed', + type: { + array: [ + 'u8', + 8 + ] + } + }, + { + name: 'oracleType', + type: 'u8' + }, + { + name: 'minLeverage', + type: 'u8' + }, + { + name: 'maxLeverage', + type: 'u8' + }, + { + name: 'tradeFeeRate', + type: 'u16' + }, + { + name: 'liquidationFeeRate', + type: 'u16' + }, + { + name: 'liquidationThreshold', + type: 'u16' + }, + { + name: 'state', + type: 'publicKey' + }, + { + name: 'creator', + type: 'publicKey' + }, + { + name: 'priceFeed', + type: 'publicKey' + }, + { + name: 'liquidityTokenMint', + type: 'publicKey' + }, + { + name: 'liquidityTokenVault', + type: 'publicKey' + }, + { + name: 'collateralMint', + type: 'publicKey' + }, + { + name: 'collateralVault', + type: 'publicKey' + }, + { + name: 'protocolFeeVault', + type: 'publicKey' + }, + { + name: 'skewManager', + type: { + defined: 'SkewManager' + } + }, + { + name: 'reserved0', + type: 'u128' + }, + { + name: 'reserved1', + type: 'u128' + }, + { + name: 'reserved2', + type: 'publicKey' + }, + { + name: 'reserved3', + type: 'publicKey' + } + ] + } + } + ], + types: [ + { + name: 'SkewManager', + type: { + kind: 'struct', + fields: [ + { + name: 'maxNegativeSkewImpact', + type: 'u64' + }, + { + name: 'lastTimestamp', + type: 'i64' + }, + { + name: 'cumulativeFundingRate', + type: 'i128' + }, + { + name: 'openInterestLong', + type: 'u128' + }, + { + name: 'openInterestShort', + type: 'u128' + } + ] + } + } + ], + errors: [] +} \ No newline at end of file diff --git a/projects/paribus/index.js b/projects/paribus/index.js new file mode 100644 index 00000000000..483c5cea70c --- /dev/null +++ b/projects/paribus/index.js @@ -0,0 +1,4 @@ +const { compoundExports2 } = require('../helper/compound') +module.exports = { + arbitrum: compoundExports2({ comptroller: '0x712E2B12D75fe092838A3D2ad14B6fF73d3fdbc9', cether: '0xaffd437801434643b734d0b2853654876f66f7d7' }), +} \ No newline at end of file diff --git a/projects/pawnfi-ape-staking/index.js b/projects/pawnfi-ape-staking/index.js new file mode 100644 index 00000000000..715be14330a --- /dev/null +++ b/projects/pawnfi-ape-staking/index.js @@ -0,0 +1,26 @@ +const ABI = require("../pawnfi/helper/abi.json") +const sdk = require("@defillama/sdk"); +const { ApeStakingPoolAddress } = require("../pawnfi/helper/config.js") + +module.exports = { + ethereum: { + tvl: async (_, _b, _cb, { api }) => { + const balances = {}; + + const stakedTotal = await api.multiCall({ + calls: [ + ApeStakingPoolAddress.BoundApe, + ApeStakingPoolAddress.BoundBAYC, + ApeStakingPoolAddress.BoundMAYC, + ApeStakingPoolAddress.BoundBAKC, + ], + target: ApeStakingPoolAddress.ApeCoinStaking, + abi: ABI.stakedTotal, + }) + stakedTotal.forEach((d) => + sdk.util.sumSingleBalance(balances, ApeStakingPoolAddress.APE, d, api.chain) + ); + return balances; + }, + }, +}; diff --git a/projects/pawnfi-lending/index.js b/projects/pawnfi-lending/index.js new file mode 100644 index 00000000000..d9aad52fef6 --- /dev/null +++ b/projects/pawnfi-lending/index.js @@ -0,0 +1,43 @@ +const ABI = require("../pawnfi/helper/abi.json") +const { Lending, LendCToken } = require("../pawnfi/helper/config.js") +const { sumTokens2 } = require('../helper/unwrapLPs') +const { getLogs } = require('../helper/cache/getLogs') +const { mergeExports } = require('../helper/utils') +const nftTvl = require('../pawnfi-nft/index.js') + +async function getPawnNFTTokens(api) { + const logs = await getLogs({ + api, + target: '0x82cac2725345ea95a200187ae9a5506e48fe1c5d', + topics: ['0x0e9af31ba332bde3bd4bd41172ead69274cb4263d5a6f2fa934a14dacefed4b1'], + eventAbi: 'event PieceTokenCreated (address token, address pieceToken, uint256 pieceTokenLength)', + onlyArgs: true, + fromBlock: 17107816, + }) + return logs.map(log => log.pieceToken) +} + +async function borrowed(timestamp, block, _, { api }) { + const blacklistedTokens = await getPawnNFTTokens(api) + const items = await api.call({ abi: ABI.cTokenMetadataAll, target: Lending, params: [LendCToken], }) + items.forEach((v) => { + if (blacklistedTokens.includes(v.underlyingAssetAddress)) return + api.add(v.underlyingAssetAddress, v.totalBorrows) + }) +} + + +async function tvl(timestamp, block, _, { api }) { + const blacklistedTokens = await getPawnNFTTokens(api) + const items = await api.call({ abi: ABI.cTokenMetadataAll, target: Lending, params: [LendCToken], }) + return sumTokens2({ api, tokensAndOwners: items.map(i => [i.underlyingAssetAddress, i.cToken]), blacklistedTokens }) +} + + +module.exports = mergeExports([{ + ethereum: { tvl, borrowed }, +}, nftTvl]) + +module.exports.hallmarks = [ + [Math.floor(new Date('2023-06-16') / 1e3), 'Protocol was exploited'], +] diff --git a/projects/pawnfi-nft/index.js b/projects/pawnfi-nft/index.js new file mode 100644 index 00000000000..918744e83f7 --- /dev/null +++ b/projects/pawnfi-nft/index.js @@ -0,0 +1,19 @@ +const { sumTokens2, sumTokensExport } = require('../helper/unwrapLPs') +const { getLogs } = require('../helper/cache/getLogs') + +module.exports = { + ethereum: { + tvl: async function tvl(_, _b, _cb, { api, }) { + const logs = await getLogs({ + api, + target: '0x82cac2725345ea95a200187ae9a5506e48fe1c5d', + topics: ['0x0e9af31ba332bde3bd4bd41172ead69274cb4263d5a6f2fa934a14dacefed4b1'], + eventAbi: 'event PieceTokenCreated (address token, address pieceToken, uint256 pieceTokenLength)', + onlyArgs: true, + fromBlock: 17107816, + }) + return sumTokens2({ api, tokensAndOwners: logs.map(log=>[log.token, log.pieceToken])}) + }, + pool2: sumTokensExport({ owner: '0x0f41eAdEc8FA71787516CCC5CEAcBD6430848f9E', resolveUniV3: true}) + } +} diff --git a/projects/pawnfi/helper/abi.json b/projects/pawnfi/helper/abi.json new file mode 100644 index 00000000000..00f8f43a4a8 --- /dev/null +++ b/projects/pawnfi/helper/abi.json @@ -0,0 +1,4 @@ +{ + "cTokenMetadataAll": "function cTokenMetadataAll(address[] cTokens) view returns (tuple(address cToken,uint exchangeRateCurrent,uint supplyRatePerBlock,uint borrowRatePerBlock,uint reserveFactorMantissa,uint totalBorrows,uint totalReserves,uint totalSupply,uint totalCash,bool isListed,uint collateralFactorMantissa,address underlyingAssetAddress,uint cTokenDecimals,uint underlyingDecimals,uint compSupplySpeed,uint compBorrowSpeed,uint borrowCap)[])", + "stakedTotal": "function stakedTotal(address _address) external view returns (uint256)" +} \ No newline at end of file diff --git a/projects/pawnfi/helper/config.js b/projects/pawnfi/helper/config.js new file mode 100644 index 00000000000..88a353026f2 --- /dev/null +++ b/projects/pawnfi/helper/config.js @@ -0,0 +1,25 @@ +module.exports = { + Lending: "0x136491CFEae8655501c847F2987B9Bc923A94065", + LendCToken:[ + "0xE8Ca2212c1F4a108d8728cb065622c6387a9860e", + "0x37B614714e96227D81fFffBdbDc4489e46eAce8C", + "0x223D9e0A8db805B0d2Bb06ef5D41b79fb29B5BC7", + "0xF58C9ba6e836919da211858191E6CbC5da7D44FC", + "0xE9373Ca88004bbF192B05A6460aFD05A88D9e1bC", + "0x9C1c49B595D5c25F0Ccc465099E6D9d0a1E5aB37", + "0xB77441172E72d93dde9742DE23c0562d3090966F", + "0x3B2da9304bd1308Dc0d1b2F9c3C14F4CF016a955", + "0x0b7d8EdA67cE2555abe41d2dF2102D62becf38BD", + "0x5CD407de334525C710FA485a8E19D8E98adE39E8", + "0x6A55080D5bA7cFf935Fb6aC54f4af4486EE24B1C" + ], + ApeStakingPoolAddress:{ + BoundApe: '0x73625745eD66F0d4C68C91613086ECe1Fc5a0119', + BoundBAYC: '0x5f0a4a59c8b39cddbcf0c683a6374655b4f5d76e', + BoundMAYC: '0x7d0b6fb139408af77f1c5bfdc8bd9166f5901304', + BoundBAKC: '0x23012599f9ABBA61Cb1A62D3785af7E434F692C6', + APE: '0x4d224452801ACEd8B2F0aebE155379bb5D594381', + ApeCoinStaking: "0x5954aB967Bc958940b7EB73ee84797Dc8a2AFbb9" + } + +} \ No newline at end of file diff --git a/projects/pawnfi/index.js b/projects/pawnfi/index.js new file mode 100644 index 00000000000..df9e6df9f55 --- /dev/null +++ b/projects/pawnfi/index.js @@ -0,0 +1,12 @@ +const { get } = require('../helper/http.js') + +async function fetch(arg) { + const data = await get('https://api-app.pawnfi.com/api/stat/queryplatstatinfo.do') + return data.info.f_total_tvl; +} + +module.exports = { + timetravel: false, + methodology: "The Pawnfi API endpoint fetches on-chain data from Pawnfi NFT contracts, token balance for each lending liquidity pools, and any value generated within Pawnfi platform.", + fetch: fetch, +}; \ No newline at end of file diff --git a/projects/paxo-finance/index.js b/projects/paxo-finance/index.js new file mode 100644 index 00000000000..8935c4c0285 --- /dev/null +++ b/projects/paxo-finance/index.js @@ -0,0 +1,7 @@ +const { compoundExports } = require('../helper/compound') +const { lendingMarket } = require('../helper/methodologies') + +module.exports = { + polygon: compoundExports('0x1eDf64B621F17dc45c82a65E1312E8df988A94D3', 'polygon'), + methodology: `${lendingMarket}. TVL is calculated by getting the market addresses from comptroller and calling the getCash() on-chain method to get the amount of tokens locked in each of these addresses.`, +} diff --git a/projects/peakdefi/index.js b/projects/peakdefi/index.js index bb33fc03477..5562ba3b413 100644 --- a/projects/peakdefi/index.js +++ b/projects/peakdefi/index.js @@ -1,130 +1,34 @@ +const ADDRESSES = require('../helper/coreAssets.json') - const sdk = require("@defillama/sdk") - const BigNumber = require('bignumber.js'); +const { sumTokens2 } = require('../helper/unwrapLPs') const { staking } = require('../helper/staking'); - const zeroAddress = '0x0000000000000000000000000000000000000000' - const peakAddress = '0x630d98424eFe0Ea27fB1b3Ab7741907DFFEaAd78' - - const funds = { - globalFund: { - address: '0x07cDB44fA1E7eCEb638c12A3451A3Dc9CE1400e4', - tokens: [ - '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', - '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', - '0xdd974d5c2e2928dea5f71b9825b8b646686bd200', - '0x9f8F72aA9304c8B593d555F12eF6589cC3A579A2', - '0x0D8775F648430679A709E98d2b0Cb6250d2887EF', - '0x514910771AF9Ca656af840dff83E8264EcF986CA', - '0xF629cBd94d3791C9250152BD8dfBDF380E2a3B9c', - '0x1F573D6Fb3F13d689FF844B4cE37794d79a7FF1C', - '0x8dd5fbCe2F6a956C3022bA3663759011Dd51e73E', - '0xE41d2489571d322189246DaFA5ebDe1F4699F498', - '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599', - '0xc00e94Cb662C3520282E6f5717214004A7f26888', - '0x7Fc66500c84A76Ad7e9c93437bFc5Ac33E2DDaE9', - '0xC011a73ee8576Fb46F5E1c5751cA3B9Fe0af2a6F', - '0xba11d00c5f74255f56a5e366f4f77f5a186d7f55', - '0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984', - '0x607F4C5BB672230e8672085532f7e901544a7375', - '0x8400D94A5cb0fa0D041a3788e395285d61c9ee5e', - '0xD46bA6D942050d489DBd938a2C909A5d5039A161', - '0x408e41876cCCDC0F92210600ef50372656052a38', - '0x967da4048cD07aB37855c090aAF366e4ce1b9F48', - '0x7D1AfA7B718fb893dB30A3aBc0Cfc608AaCfeBB0', - '0xD9Ec3ff1f8be459Bb9369b4E79e9Ebcf7141C093', - '0xec67005c4E498Ec7f55E092bd1d35cbC47C91892', - '0x8762db106B2c2A0bccB3A80d1Ed41273552616E8', - '0x0000000000085d4780B73119b644AE5ecd22b376', - '0xd26114cd6EE289AccF82350c8d8487fedB8A0C07', - '0xfeF4185594457050cC9c23980d301908FE057Bb1', - '0x4a220E6096B25EADb88358cb44068A3248254675', - '0x6B175474E89094C44Da98b954EedeAC495271d0F', - '0x0bc529c00C6401aEF6D220BE8C6Ea1667F6Ad93e', - '0xD533a949740bb3306d119CC777fa900bA034cd52', - '0x0F5D2fB29fb7d3CFeE444a200298f468908cC942', - '0x2ba592F78dB6436527729929AAf6c908497cB200', - '0x6B3595068778DD592e39A122f4f5a5cF09C90fE2', - '0x744d70FDBE2Ba4CF95131626614a1763DF805B9E', - '0xA4e8C3Ec456107eA67d3075bF9e3DF3A75823DB0', - '0xaAAf91D9b90dF800Df4F55c205fd6989c977E73a', - '0x0E8d6b471e332F140e7d9dbB99E5E3822F728DA6', - '0x960b236A07cf122663c4303350609A66A7B288C0', - ] - }, - nftFund: { - address: '0xC120C7dB0804ae3AbEB1d5f9c9C70402347B4685', - tokens: [ - '0xf629cbd94d3791c9250152bd8dfbdf380e2a3b9c', - '0x0f5d2fb29fb7d3cfee444a200298f468908cc942', - '0x3845badAde8e6dFF049820680d1F14bD3903a5d0', - '0x8207c1ffc5b6804f6024322ccf34f29c3541ae26', - '0x3506424f91fd33084466f402d5d97f05f8e3b4af', - '0xbb0e17ef65f82ab018d8edd776e8dd940327b28b', - '0xd13c7342e1ef687c5ad21b27c2b65d772cab5c8c', - '0x18aaa7115705e8be94bffebde57af9bfc265b998', - '0xe53EC727dbDEB9E2d5456c3be40cFF031AB40A55', - '0xbbc2ae13b23d715c30720f079fcd9b4a74093505', - '0xfca59cd816ab1ead66534d82bc21e7515ce441cf', - '0x87d73e916d7057945c9bcd8cdd94e42a6f47f776', - '0x3883f5e181fccaF8410FA61e12b59BAd963fb645' - ] - } - } - - const stakingContracts = { - ethereum: '0x9733f49D577dA2b6705cA173382C0e3CdFff2A48', - bsc: '0xe9428B8acaA6b9d7C3314D093975c291Ec59A009', - } - - async function getFundBalances(block) { - let calls = []; - let balances = {}; - let fundsAddresses = []; - - // Prepare funds balances - Object.values(funds).forEach((fund) => { - let fundTokens = fund.tokens - let fundAddress = fund.address - - // Save the funds addresses - fundsAddresses.push(fundAddress) - - // Calculate ERC20 balance for every token of the fund - fundTokens.forEach((tokenAddress) => { - calls.push({ - target: tokenAddress, - params: fundAddress - }) - }) - }) - - let balanceOfResults = await sdk.api.abi.multiCall({ - block, - calls, - abi: 'erc20:balanceOf' - }); - - sdk.util.sumMultiBalanceOf(balances, balanceOfResults); - - // Fetch ETH balance of the funds - let ETHBalances = (await sdk.api.eth.getBalances({targets: fundsAddresses, block})).output; - balances[zeroAddress] = ETHBalances.reduce((accumulator, ETHBalance) => accumulator.plus(new BigNumber(ETHBalance.balance)), new BigNumber("0")).toFixed(); - - return balances; - } - - async function tvl(timestamp, block) { - const balances = await getFundBalances(block); - return balances; - } - module.exports = { - start: 1607405152, // Dec-08-2020 05:25:52 PM +UTC - bsc:{ - staking: staking(stakingContracts.bsc, peakAddress, "bsc", peakAddress), - }, - ethereum:{ - staking: staking(stakingContracts.ethereum, peakAddress), - tvl - }, - } \ No newline at end of file +const peakAddress = '0x630d98424eFe0Ea27fB1b3Ab7741907DFFEaAd78' + +const tokens = [ + ADDRESSES.ethereum.USDC, +] + +const funds = { + globalFund: '0x07cDB44fA1E7eCEb638c12A3451A3Dc9CE1400e4', + nftFund: '0xC120C7dB0804ae3AbEB1d5f9c9C70402347B4685', +} + +const stakingContracts = { + ethereum: '0x9733f49D577dA2b6705cA173382C0e3CdFff2A48', + bsc: '0xe9428B8acaA6b9d7C3314D093975c291Ec59A009', +} + +async function tvl(timestamp, block, _, { api }) { + return sumTokens2({ api, owners: Object.values(funds), tokens }) +} +module.exports = { + start: 1607405152, // Dec-08-2020 05:25:52 PM +UTC + bsc: { + staking: staking(stakingContracts.bsc, peakAddress, "bsc", peakAddress), + }, + ethereum: { + staking: staking(stakingContracts.ethereum, peakAddress), + tvl + }, +} \ No newline at end of file diff --git a/projects/peaky-finance/index.js b/projects/peaky-finance/index.js index cf019eede1f..52b0e9e0157 100644 --- a/projects/peaky-finance/index.js +++ b/projects/peaky-finance/index.js @@ -1,12 +1,11 @@ const sdk = require("@defillama/sdk"); const { gmxExports } = require("../helper/gmx"); -const chain = "bsc"; module.exports = { bsc: { tvl: sdk.util.sumChainTvls([ - gmxExports({ chain, vault: '0xFD8c82a5Eb07147Ff49704b67c931EC7aFd9CCEA', }), - gmxExports({ chain, vault: '0xb160c4070Ba9183dA27a66D53209Eb2191Df5Bd7', }), + gmxExports({ vault: '0xFD8c82a5Eb07147Ff49704b67c931EC7aFd9CCEA', }), + gmxExports({ vault: '0xb160c4070Ba9183dA27a66D53209Eb2191Df5Bd7', }), ]) } } \ No newline at end of file diff --git a/projects/peardao/index.js b/projects/peardao/index.js index 94d54b60e7b..dc18cc4df33 100644 --- a/projects/peardao/index.js +++ b/projects/peardao/index.js @@ -1,13 +1,14 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { stakings } = require('../helper/staking'); const { pool2 } = require('../helper/pool2'); const { sumTokensExport } = require('../helper/unwrapLPs') const PEX_TOKEN_CONTRACT = '0x6a0b66710567b6beb81A71F7e9466450a91a384b'; -const BUSD_TOKEN_CONTRACT = '0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56'; -const USDT_TOKEN_CONTRACT = '0x55d398326f99059ff775485246999027b3197955'; -const USDC_TOKEN_CONTRACT = '0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d'; -const WBNB_TOKEN_CONTRACT = '0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c'; -const BTCB_TOKEN_CONTRACT = '0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c'; +const BUSD_TOKEN_CONTRACT = ADDRESSES.bsc.BUSD; +const USDT_TOKEN_CONTRACT = ADDRESSES.bsc.USDT; +const USDC_TOKEN_CONTRACT = ADDRESSES.bsc.USDC; +const WBNB_TOKEN_CONTRACT = ADDRESSES.bsc.WBNB; +const BTCB_TOKEN_CONTRACT = ADDRESSES.bsc.BTCB; const USTC_TOKEN_CONTRACT = '0x23396cF899Ca06c4472205fC903bDB4de249D6fC'; const PEX_BNB_LP_CONTRACT = '0x5ca96E8bDe0Bc587DaC9e02422Fd205b1102DAa4'; @@ -23,7 +24,6 @@ module.exports = { methodology: 'Counts the value of LP tokens and PEX tokens in the staking contracts, assets locked in the P2P escrow contract, and assets in the treasury contract.', start: 15966251, // Mar-11-2022 01:00:01 PM +UTC bsc: { - treasury: sumTokensExport({ chain: 'bsc', tokens, owner: TREASURY_ADDRESS, }), tvl: sumTokensExport({ chain: 'bsc', tokens, owner: DOTC_CONTRACT, }), staking: stakings([TREASURY_ADDRESS, PEX_STAKING_POOL_CONTRACT], PEX_TOKEN_CONTRACT, "bsc"), pool2: pool2(PEX_BNB_LP_MASTER_CHEF, PEX_BNB_LP_CONTRACT, 'bsc') diff --git a/projects/pearlfi/index.js b/projects/pearlfi/index.js new file mode 100644 index 00000000000..200be55a86e --- /dev/null +++ b/projects/pearlfi/index.js @@ -0,0 +1,10 @@ +const { getUniTVL } = require('../helper/unknownTokens') + + +module.exports = { + misrepresentedTokens: true, + methodology: `Uses factory(0xd541Bc203Cc2B85810d9b8E6a534eed1615528E2) address to count liquidity in pools as TVL.`, + polygon: { + tvl: getUniTVL({ factory: '0xd541Bc203Cc2B85810d9b8E6a534eed1615528E2', useDefaultCoreAssets: true, hasStablePools: true }), + } +}; \ No newline at end of file diff --git a/projects/pegasusdao/index.js b/projects/pegasusdao/index.js deleted file mode 100644 index bffc637124a..00000000000 --- a/projects/pegasusdao/index.js +++ /dev/null @@ -1,10 +0,0 @@ -const {ohmTvl} = require("../helper/ohm"); - -const sus = "0x5b5Fe1238aca91C65683aCd7f9D9Bf922e271EAA"; -const stakingContract = ""; - -const treasury = "0x7310855e0Aa8B110925fdE0100b01c62984d2a3C"; -const treasuryTokens = [ - ["0xc21223249CA28397B4B6541dfFaEcC539BfF0c59", false], // USDC - ["0xAE182Db2F7897D7678c5099C1e52A1c802580827", true], // SUS-USDC CRONA LPS -] \ No newline at end of file diff --git a/projects/pegasusfinance/index.js b/projects/pegasusfinance/index.js index e2b4aa09db0..98aee5bb23b 100644 --- a/projects/pegasusfinance/index.js +++ b/projects/pegasusfinance/index.js @@ -1,14 +1,12 @@ -const sdk = require("@defillama/sdk"); +const ADDRESSES = require('../helper/coreAssets.json') const { staking } = require("../helper/staking"); -const TREASURY_CONTRACT = "0x680b96DDC962349f59F54FfBDe2696652669ED60"; const LIQUIDITY_POOL_CONTRACT = "0x7398c321449d836cec83582a678ccb8650360a18"; -const WETH_OPTIMISM = "0x4200000000000000000000000000000000000006"; +const WETH_OPTIMISM = ADDRESSES.tombchain.FTM; module.exports = { methodology: "WETH supplied to liquidity pool + leftover weth in treasury", optimism: { tvl: staking(LIQUIDITY_POOL_CONTRACT, WETH_OPTIMISM, "optimism"), - treasury: staking(TREASURY_CONTRACT, WETH_OPTIMISM, "optimism"), }, }; diff --git a/projects/pegasys-v3/index.js b/projects/pegasys-v3/index.js new file mode 100644 index 00000000000..e474864b7b9 --- /dev/null +++ b/projects/pegasys-v3/index.js @@ -0,0 +1,5 @@ +const { uniV3Export } = require('../helper/uniswapV3') + +module.exports = uniV3Export({ + rollux: { factory: '0xeAa20BEA58979386A7d37BAeb4C1522892c74640', fromBlock: 87430, }, +}) diff --git a/projects/pegasys/index.js b/projects/pegasys/index.js index c8fc67304cc..3c5c517936e 100644 --- a/projects/pegasys/index.js +++ b/projects/pegasys/index.js @@ -7,7 +7,6 @@ module.exports = { "Factory address (0x7Bbbb6abaD521dE677aBe089C85b29e3b2021496) is used to find the LP pairs. TVL is equal to the liquidity on the AMM.", syscoin: { tvl: getUniTVL({ - chain: 'syscoin', factory: '0x7Bbbb6abaD521dE677aBe089C85b29e3b2021496', useDefaultCoreAssets: true, }) diff --git a/projects/pembrock/index.js b/projects/pembrock/index.js index 90c9ae58efb..58c357215bb 100644 --- a/projects/pembrock/index.js +++ b/projects/pembrock/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { BigNumber } = require('bignumber.js'); const { call, addTokenBalances, sumSingleBalance } = require('../helper/chain/near'); @@ -41,7 +42,7 @@ async function tvl() { async function staking() { const balances = {}; - sumSingleBalance(balances, "token.pembrock.near", await call('staking.v1.pembrock.near', "get_total_staked", {})) + sumSingleBalance(balances, ADDRESSES.near.PEMBROCK, await call('staking.v1.pembrock.near', "get_total_staked", {})) return balances; } diff --git a/projects/pendle/abi.json b/projects/pendle/abi.json index 70a28a29af4..378b625aa74 100644 --- a/projects/pendle/abi.json +++ b/projects/pendle/abi.json @@ -1,91 +1,7 @@ { - "userInfo": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "userInfo", - "outputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "rewardDebt", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "wMEMOToMEMO": { - "inputs": [ - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "wMEMOToMEMO", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "xBTRFLYValue": { - "inputs": [ - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "xBTRFLYValue", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "assetInfo": { - "inputs": [], - "name": "assetInfo", - "outputs": [ - { - "internalType": "enum IStandardizedYield.AssetType", - "name": "assetType", - "type": "uint8" - }, - { "internalType": "address", "name": "assetAddress", "type": "address" }, - { "internalType": "uint8", "name": "assetDecimals", "type": "uint8" } - ], - "stateMutability": "view", - "type": "function" - }, - "exchangeRate": { - "inputs": [], - "name": "exchangeRate", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - } -} + "userInfo": "function userInfo(uint256, address) view returns (uint256 amount, uint256 rewardDebt)", + "wMEMOToMEMO": "function wMEMOToMEMO(uint256 _amount) view returns (uint256)", + "xBTRFLYValue": "function xBTRFLYValue(uint256 _amount) view returns (uint256)", + "assetInfo": "function assetInfo() view returns (uint8 assetType, address assetAddress, uint8 assetDecimals)", + "exchangeRate": "uint256:exchangeRate" +} \ No newline at end of file diff --git a/projects/pendle/index.js b/projects/pendle/index.js index 2d9a1458210..d91e01c7149 100644 --- a/projects/pendle/index.js +++ b/projects/pendle/index.js @@ -1,26 +1,6 @@ -const { sumChainTvls } = require("@defillama/sdk/build/generalUtil"); const v1 = require("./v1.js"); const v2 = require("./v2.js"); +const { mergeExports } = require("../helper/utils"); -function buildExports() { - let tvl = v1; - const v1Chains = Object.keys(v1); - Object.keys(v2).map(chain => { - if (!v1Chains.includes(chain)) return; - const v1Filters = Object.keys(tvl[chain]); - - Object.keys(v2[chain]).map(filter => { - if (!v1Filters.includes(filter)) return; - tvl[chain][filter] = sumChainTvls([ - tvl[chain][filter], - v2[chain][filter] - ]); - }); - }); - - return tvl; -} - -module.exports = buildExports(); -// node test.js projects/pendle/index.js +module.exports = mergeExports([v1, v2]) diff --git a/projects/pendle/v1.js b/projects/pendle/v1.js index dec121de47c..2ab549e92ed 100644 --- a/projects/pendle/v1.js +++ b/projects/pendle/v1.js @@ -2,10 +2,10 @@ const { sumTokensAndLPsSharedOwners, unwrapUniswapLPs } = require("../helper/unwrapLPs"); -const { transformAvaxAddress } = require("../helper/portedTokens"); const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); const contracts = require("./contracts"); +const { staking } = require("../helper/staking"); const ethTokens = contracts.v1.eth.tokens; const ethFundedContracts = Object.keys(contracts.v1.eth.funded); @@ -41,17 +41,17 @@ async function ethTvl(timestamp, block) { [ethTokens.USDC, false], [ethTokens.aUSDC, false], [ethTokens.cDAI, false], - [ethTokens.SLP_ETHUSDC, true], - [ethTokens.SLP_PENDLEETH, true], + [ethTokens.SLP_ETHUSDC, false], + [ethTokens.SLP_PENDLEETH, false], [ethTokens.SUSHI, false], [ethTokens.COMP, false], [ethTokens.wxBTRFLY, false], - [ethTokens.SLP_OT_aUSDC_21, true], - [ethTokens.SLP_OT_aUSDC_22, true], - [ethTokens.SLP_OT_cDAI_21, true], - [ethTokens.SLP_OT_cDAI_22, true], - [ethTokens.SLP_OT_ETHUSDC_22, true], - [ethTokens.SLP_OT_wxBTRFLY_22, true] + [ethTokens.SLP_OT_aUSDC_21, false], + [ethTokens.SLP_OT_aUSDC_22, false], + [ethTokens.SLP_OT_cDAI_21, false], + [ethTokens.SLP_OT_cDAI_22, false], + [ethTokens.SLP_OT_ETHUSDC_22, false], + [ethTokens.SLP_OT_wxBTRFLY_22, false] ], ethFundedContracts, block @@ -61,43 +61,11 @@ async function ethTvl(timestamp, block) { } delete balances[ethTokens.PENDLE]; - balances[ethTokens.BTRFLY] = (await sdk.api.abi.call({ - target: ethTokens.wxBTRFLY, - abi: abi.xBTRFLYValue, - params: [balances[ethTokens.wxBTRFLY]], - block: block - })).output; - delete balances[ethTokens.wxBTRFLY]; - return balances; } -async function staking(timestamp, block) { - const staking = {}; - await sumTokensAndLPsSharedOwners( - staking, - [[ethTokens.PENDLE, false]], - ethStakingContracts, - block - ); - return staking; -} -async function ethPool2(timestamp, block) { - const pool2 = {}; - await sumTokensAndLPsSharedOwners( - pool2, - [ - [ethTokens.SLP_PENDLEETH, true], - [ethTokens.PENDLE, false], - [ethTokens.SUSHI, false] - ], - ethPool2Contracts, - block - ); - return pool2; -} async function avaxTvl(timestamp, _, { avax: block }) { - const transform = await transformAvaxAddress(); + const transform = addr => 'avax:'+addr const balances = {}; const masterChefContract = "0xd6a4F121CA35509aF06A0Be99093d08462f53052"; @@ -118,17 +86,17 @@ async function avaxTvl(timestamp, _, { avax: block }) { [avaxTokens.qiAVAX, false], [avaxTokens.qiUSDC, false], [avaxTokens.xJOE, false], - [avaxTokens.JLP_PENDLEAVAX, true], + [avaxTokens.JLP_PENDLEAVAX, false], [avaxTokens.WAVAX, false], [avaxTokens.JOE, false], [avaxTokens.QI, false], [avaxTokens.MIM, false], [avaxTokens.wMEMO, false], - [avaxTokens.JLP_OT_PAP, true], - [avaxTokens.JLP_OT_qiUSDC, true], - [avaxTokens.JLP_OT_qiAVAX, true], - [avaxTokens.JLP_OT_xJOE, true], - [avaxTokens.JLP_OT_wMEMO, true] + [avaxTokens.JLP_OT_PAP, false], + [avaxTokens.JLP_OT_qiUSDC, false], + [avaxTokens.JLP_OT_qiAVAX, false], + [avaxTokens.JLP_OT_xJOE, false], + [avaxTokens.JLP_OT_wMEMO, false] ], avaxFundedContracts, block, @@ -149,24 +117,16 @@ async function avaxTvl(timestamp, _, { avax: block }) { delete balances[`avax:${token.toLowerCase()}`]; } - if (`avax:${avaxTokens.qiUSDC}` in balances) { - balances[ethTokens.USDC] = - Number(balances[ethTokens.USDC]) + - Number(balances[`avax:${avaxTokens.qiUSDC}`]) / 10 ** 12; - delete balances[`avax:${avaxTokens.qiUSDC}`]; - } - delete balances[avaxTokens.PENDLE]; - return balances; } async function avaxPool2(timestamp, _, { avax: block }) { - const transform = await transformAvaxAddress(); + const transform = addr => 'avax:'+addr const pool2 = {}; await sumTokensAndLPsSharedOwners( pool2, [ - [avaxTokens.JLP_PENDLEAVAX, true], + [avaxTokens.JLP_PENDLEAVAX, false], [avaxTokens.PENDLE, false], [avaxTokens.JOE, false] ], @@ -181,9 +141,9 @@ async function avaxPool2(timestamp, _, { avax: block }) { module.exports = { ethereum: { - pool2: ethPool2, + pool2: staking(ethPool2Contracts, [ethTokens.SLP_PENDLEETH, ethTokens.PENDLE, ethTokens.SUSHI,]), tvl: ethTvl, - staking + staking: staking(ethStakingContracts, [ethTokens.PENDLE]) }, avax: { pool2: avaxPool2, diff --git a/projects/pendle/v2.js b/projects/pendle/v2.js index 2d8778cdd72..73ff88c91cd 100644 --- a/projects/pendle/v2.js +++ b/projects/pendle/v2.js @@ -1,77 +1,87 @@ -const abi = require("./abi.json"); +const ADDRESSES = require("../helper/coreAssets.json"); const contracts = require("./contracts"); -const { request, gql } = require("graphql-request"); -const { call, multiCall } = require("@defillama/sdk/build/abi"); -const { sumSingleBalance } = require("@defillama/sdk/build/generalUtil"); -const api = "https://api-v2.pendle.finance/core/graphql"; -const query = gql` - query { - markets(chainId: 1) { - results { - address - sy { - address - } - } - } - } -`; +const { staking } = require("../helper/staking"); +const { getLogs } = require("../helper/cache/getLogs"); +const steth = ADDRESSES.ethereum.STETH; +const config = { + ethereum: { + factory: "0x27b1dacd74688af24a64bd3c9c1b143118740784", + fromBlock: 16032059, + }, + arbitrum: { + factory: "0xf5a7de2d276dbda3eef1b62a9e718eff4d29ddc8", + fromBlock: 62979673, + }, + bsc: { + factory: "0x2bEa6BfD8fbFF45aA2a893EB3B6d85D10EFcC70E", + fromBlock: 29484286, + }, +}; + +module.exports = {}; + +Object.keys(config).forEach((chain) => { + const { factory, fromBlock } = config[chain]; + module.exports[chain] = { + tvl: async (_, _b, _cb, { api }) => { + const logs = await getLogs({ + api, + target: factory, + topics: [ + "0x166ae5f55615b65bbd9a2496e98d4e4d78ca15bd6127c0fe2dc27b76f6c03143", + ], + eventAbi: + "event CreateNewMarket (address indexed market, address indexed PT, int256 scalarRoot, int256 initialAnchor)", + onlyArgs: true, + fromBlock, + }); + const pt = logs.map((i) => i.PT); + let sy = [ + ...new Set( + ( + await api.multiCall({ + abi: "address:SY", + calls: pt, + }) + ).map((s) => s.toLowerCase()) + ), + ]; -async function tvl(_, block) { - const balances = {}; - const res = await request(api, query); - const sys = [...new Set(res.markets.results.map(r => r.sy.address))]; - const [underlyings, supplies, rates] = await Promise.all([ - multiCall({ - calls: sys.map(sy => ({ - target: sy - })), - abi: abi.assetInfo, - block - }).then(c => - c.output.map(o => ({ - address: o.output.assetAddress, - decimals: o.output.assetDecimals - })) - ), - multiCall({ - calls: sys.map(sy => ({ - target: sy - })), - abi: "erc20:totalSupply", - block - }).then(c => c.output.map(o => o.output)), - multiCall({ - calls: sys.map(sy => ({ - target: sy - })), - abi: abi.exchangeRate, - block - }).then(c => c.output.map(o => o.output)) - ]); - underlyings.map((u, i) => { - sumSingleBalance( - balances, - u.address, - supplies[i] * rates[i] / 10 ** u.decimals - ); - }); + const [data, supply, decimals] = await Promise.all([ + api.multiCall({ + abi: "function assetInfo() view returns (uint8 assetType , address uAsset , uint8 decimals )", + calls: sy, + }), + api.multiCall({ abi: "erc20:totalSupply", calls: sy }), + api.multiCall({ abi: "erc20:decimals", calls: sy }), + ]); - return balances; -} -async function staking(_, block) { - return { - [contracts.v2.PENDLE]: (await call({ - target: contracts.v2.PENDLE, - abi: "erc20:balanceOf", - block, - params: [contracts.v2.vePENDLE] - })).output + const tokenAssetTypeSy = sy.filter((_, i) => data[i].assetType === "0"); + const exchangeRates = await api.multiCall({ + abi: "function exchangeRate() view returns (uint256 res)", + calls: tokenAssetTypeSy, + }); + + data.forEach((v, i) => { + let value = supply[i] * 10 ** (v.decimals - decimals[i]); + let index = tokenAssetTypeSy.indexOf(sy[i]); + if (index !== -1) { + value = (value * exchangeRates[index]) / 10 ** 18; + } + api.add(v.uAsset.toLowerCase(), value); + }); + let balances = api.getBalances(); + const bridged = `arbitrum:${steth}`; + if (bridged in balances) { + balances[steth] = balances[bridged]; + delete balances[bridged]; + } + return balances; + }, }; -} -module.exports = { - ethereum: { - tvl, - staking - } -}; +}); + +module.exports.ethereum.staking = staking( + contracts.v2.vePENDLE, + contracts.v2.PENDLE +); diff --git a/projects/penguin/abi.json b/projects/penguin/abi.json index 9ab3a7c2e32..8b79c3ccf3e 100644 --- a/projects/penguin/abi.json +++ b/projects/penguin/abi.json @@ -1,61 +1,3 @@ { - "poolInfo": { - "type": "function", - "stateMutability": "view", - "outputs": [ - { - "type": "address", - "name": "poolToken", - "internalType": "contract IERC20" - }, - { - "type": "address", - "name": "rewarder", - "internalType": "contract IRewarder" - }, - { - "type": "address", - "name": "strategy", - "internalType": "contract IIglooStrategy" - }, - { - "type": "uint256", - "name": "allocPoint", - "internalType": "uint256" - }, - { - "type": "uint256", - "name": "lastRewardTime", - "internalType": "uint256" - }, - { - "type": "uint256", - "name": "accPEFIPerShare", - "internalType": "uint256" - }, - { - "type": "uint16", - "name": "withdrawFeeBP", - "internalType": "uint16" - }, - { - "type": "uint256", - "name": "totalShares", - "internalType": "uint256" - }, - { - "type": "uint256", - "name": "lpPerShare", - "internalType": "uint256" - } - ], - "name": "poolInfo", - "inputs": [ - { - "type": "uint256", - "name": "", - "internalType": "uint256" - } - ] - } + "poolInfo": "function poolInfo(uint256) view returns (address poolToken, address rewarder, address strategy, uint256 allocPoint, uint256 lastRewardTime, uint256 accPEFIPerShare, uint16 withdrawFeeBP, uint256 totalShares, uint256 lpPerShare)" } \ No newline at end of file diff --git a/projects/penpie/config.js b/projects/penpie/config.js new file mode 100644 index 00000000000..1d6d3ee2441 --- /dev/null +++ b/projects/penpie/config.js @@ -0,0 +1,23 @@ +module.exports = { + ethereum: { + masterPenpie: "0x16296859C15289731521F199F0a5f762dF6347d0", + vePENDLE: "0x4f30A9D41B80ecC5B94306AB4364951AE3170210", + mPENDLE: "0x83e817E1574e2201a005EC0f7e700ED5606F555E", + PENDLE: "0x808507121b80c02388fad14726482e061b8da827", + pendleStaking: "0x6E799758CEE75DAe3d84e09D40dc416eCf713652", + }, + arbitrum: { + masterPenpie: "0x0776C06907CE6Ff3d9Dbf84bA9B3422d7225942D", + vePENDLE: "0x3209E9412cca80B18338f2a56ADA59c484c39644", + mPENDLE: "0xB688BA096b7Bb75d7841e47163Cd12D18B36A5bF", + PENDLE: "0x0c880f6761F1af8d9Aa9C466984b80DAb9a8c9e8", + pendleStaking: "0x6DB96BBEB081d2a85E0954C252f2c1dC108b3f81", + }, + bsc: { + masterPenpie: "0xb35b3d118c0394e750b4b59d2a2f9307393cd5db", + vePENDLE: "0x8A09574b0401A856d89d1b583eE22E8cb0C5530B", + mPENDLE: "0x0465aad9da170798433f4ab7fa7ec8b9b9bf0bb1", + PENDLE: "0xb3Ed0A426155B79B898849803E3B36552f7ED507", + pendleStaking: "0x782d9d67feaa4d1cdf8222d9053c8cba1c3b7982", + }, +}; diff --git a/projects/penpie/index.js b/projects/penpie/index.js new file mode 100644 index 00000000000..cb783d1deda --- /dev/null +++ b/projects/penpie/index.js @@ -0,0 +1,27 @@ +const MasterMagpieAbi = require("../magpiexyz/abis/masterMagpie.json"); +const config = require("./config"); + +async function tvl(timestamp, block, chainBlocks, { api }) { + const { masterPenpie, pendleStaking, vePENDLE, PENDLE, mPENDLE, } = config[api.chain]; + + const poolTokens = await api.fetchList({ + lengthAbi: MasterMagpieAbi.poolLength, + itemAbi: MasterMagpieAbi.registeredToken, + target: masterPenpie, + }); + const poolInfos = await api.multiCall({ abi: 'function getPoolInfo(address) view returns ( uint256 emission, uint256 allocpoint, uint256 sizeOfPool, uint256 totalPoint)', calls: poolTokens, target: masterPenpie, }) + const symbols = await api.multiCall({ abi: 'erc20:symbol', calls: poolTokens, }) + poolTokens.forEach((token, i) => { + if (symbols[i] === 'vlPenpie' || symbols[i] === 'mPendle' || symbols[i] === 'mPendleOFT') { + token = PENDLE + } + api.add(token, poolInfos[i].sizeOfPool) + }) +} + +Object.keys(config).forEach((chain) => { + module.exports[chain] = { + doublecounted: true, + tvl: tvl, + }; +}); diff --git a/projects/penrose/abi.js b/projects/penrose/abi.js index faf8a2517bf..60c3af4ae87 100644 --- a/projects/penrose/abi.js +++ b/projects/penrose/abi.js @@ -1,160 +1,5 @@ module.exports = { - penPoolsData: { - "inputs": [], - "name": "penPoolsData", - "outputs": [ - { - "components": [ - { - "internalType": "address", - "name": "id", - "type": "address" - }, - { - "internalType": "address", - "name": "stakingAddress", - "type": "address" - }, - { - "internalType": "uint256", - "name": "stakedTotalSupply", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" - }, - { - "components": [ - { - "internalType": "address", - "name": "id", - "type": "address" - }, - { - "internalType": "string", - "name": "symbol", - "type": "string" - }, - { - "internalType": "bool", - "name": "stable", - "type": "bool" - }, - { - "internalType": "address", - "name": "token0Address", - "type": "address" - }, - { - "internalType": "address", - "name": "token1Address", - "type": "address" - }, - { - "internalType": "address", - "name": "gaugeAddress", - "type": "address" - }, - { - "internalType": "address", - "name": "bribeAddress", - "type": "address" - }, - { - "internalType": "address[]", - "name": "bribeTokensAddresses", - "type": "address[]" - }, - { - "internalType": "address", - "name": "fees", - "type": "address" - }, - { - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" - } - ], - "internalType": "struct IDystopiaLens.Pool", - "name": "poolData", - "type": "tuple" - } - ], - "internalType": "struct PenLens.PenPoolData[]", - "name": "", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - poolsReservesInfo: { - "inputs": [ - { - "internalType": "address[]", - "name": "_poolsAddresses", - "type": "address[]" - } - ], - "name": "poolsReservesInfo", - "outputs": [ - { - "components": [ - { - "internalType": "address", - "name": "id", - "type": "address" - }, - { - "internalType": "address", - "name": "token0Address", - "type": "address" - }, - { - "internalType": "address", - "name": "token1Address", - "type": "address" - }, - { - "internalType": "uint256", - "name": "token0Reserve", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "token1Reserve", - "type": "uint256" - }, - { - "internalType": "uint8", - "name": "token0Decimals", - "type": "uint8" - }, - { - "internalType": "uint8", - "name": "token1Decimals", - "type": "uint8" - } - ], - "internalType": "struct IDystopiaLens.PoolReserveData[]", - "name": "", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - locked: { - "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "name": "locked", - "outputs": [ - { "internalType": "int128", "name": "amount", "type": "int128" }, - { "internalType": "uint256", "name": "end", "type": "uint256" } - ], - "stateMutability": "view", - "type": "function" - }, + penPoolsData: "function penPoolsData() view returns (tuple(address id, address stakingAddress, uint256 stakedTotalSupply, uint256 totalSupply, tuple(address id, string symbol, bool stable, address token0Address, address token1Address, address gaugeAddress, address bribeAddress, address[] bribeTokensAddresses, address fees, uint256 totalSupply) poolData)[])", + poolsReservesInfo: "function poolsReservesInfo(address[] _poolsAddresses) view returns (tuple(address id, address token0Address, address token1Address, uint256 token0Reserve, uint256 token1Reserve, uint8 token0Decimals, uint8 token1Decimals)[])", + locked: "function locked(uint256) view returns (int128 amount, uint256 end)", } \ No newline at end of file diff --git a/projects/pepe-bridge/index.js b/projects/pepe-bridge/index.js new file mode 100644 index 00000000000..2314078ac00 --- /dev/null +++ b/projects/pepe-bridge/index.js @@ -0,0 +1,53 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, sumTokensExport, } = require('../helper/unwrapLPs'); + +const config = { + ethereum: [ + [[nullAddress], '0x882260324AD5A87bF5007904B4A8EF87023c856A'], + [ + [ + ADDRESSES.ethereum.USDT, + ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.WBTC, + ADDRESSES.ethereum.CRV, + ], + '0x0de7b091A21BD439bdB2DfbB63146D9cEa21Ea83' + ] + ], + bsc: [ + [[nullAddress], '0xF1632012f6679Fcf464721433AFAAe9c11ad9e03'], + [ + [ + ADDRESSES.bsc.USDT, + ADDRESSES.bsc.USDC, + ADDRESSES.bsc.BTCB, + ], + '0x8DF12786EC0E34e60D4c52f9052ba4e536e9367a' + ] + ], + polygon: [ + [[nullAddress], '0xEa3cc73165748AD1Ca76b4d1bA9ebC43fb399018'], + [ + [ + ADDRESSES.polygon.USDT, + ADDRESSES.polygon.USDC, + ], + '0xF57dB884606a0ed589c06320d9004FBeD4f81e4A' + ] + ], + tron: [ + [[nullAddress], 'TMsm33cUm8HuxyRqwG7xhV46cmx5NVPPGB'], + [ + [ + ADDRESSES.tron.USDT, + ADDRESSES.tron.USDC + ], + 'TNN42f7dXYksBsh8hjVo8XD8aYSKcSEhJF' + ] + ] +} +module.exports = {}; + +Object.keys(config).forEach(chain => { + module.exports[chain] = { tvl: sumTokensExport({ ownerTokens: config[chain] }) } +}) diff --git a/projects/pepe-swaves/index.js b/projects/pepe-swaves/index.js new file mode 100644 index 00000000000..f8046b5e1a8 --- /dev/null +++ b/projects/pepe-swaves/index.js @@ -0,0 +1,19 @@ +const { data } = require("../helper/chain/waves"); +const sdk = require('@defillama/sdk') + +const wavesStakingContract = "3PDPzZVLhN1EuzGy4xAxjjTVkawKDLEaHiV"; + +async function wavesTVL() { + const balances = {}; + const contractTVLInWAVES = await data(wavesStakingContract, "STAKING_AMOUNT"); + sdk.util.sumSingleBalance(balances,'waves',contractTVLInWAVES.value/1e8) + return balances; +} + +module.exports = { + timetravel: false, // Waves blockchain + methodology: "TVL of sWAVES means the quantity of WAVES tokens underlying", + waves: { + tvl: wavesTVL, + }, +}; diff --git a/projects/pepedex/index.js b/projects/pepedex/index.js new file mode 100644 index 00000000000..ef089cbf8f7 --- /dev/null +++ b/projects/pepedex/index.js @@ -0,0 +1,12 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports = { + misrepresentedTokens: true, + ethereum: { + tvl: getUniTVL({ + fetchBalances: true, + useDefaultCoreAssets: true, + factory: '0x460b2005b3318982feADA99f7ebF13e1D6f6eFfE', + }) + } +}; diff --git a/projects/percent/abi.json b/projects/percent/abi.json index cd09bf0e2fd..209ed710bbb 100644 --- a/projects/percent/abi.json +++ b/projects/percent/abi.json @@ -1,32 +1,4 @@ { - "getCurrentTokens": { - "constant": true, - "inputs": [], - "name": "getCurrentTokens", - "outputs": [ - { - "internalType": "address[]", - "name": "tokens", - "type": "address[]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "totalSupply": { - "constant": true, - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } + "getCurrentTokens": "address[]:getCurrentTokens", + "totalSupply": "uint256:totalSupply" } \ No newline at end of file diff --git a/projects/percent/index.js b/projects/percent/index.js index 83aec90d71c..6d141a89f81 100644 --- a/projects/percent/index.js +++ b/projects/percent/index.js @@ -1,12 +1,12 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); -const { default: BigNumber } = require("bignumber.js"); const { stakings } = require("../helper/staking"); const { getCompoundV2Tvl } = require("../helper/compound"); const comptroller = "0xf47dD16553A934064509C40DC5466BBfB999528B"; const pETH = "0x45F157b3d3d7C415a0e40012D64465e3a0402C64"; -const pETHEquivalent = "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"; +const pETHEquivalent = ADDRESSES.ethereum.WETH; const pool2Contract = "0x23b53026187626Ed8488e119767ACB2Fe5F8de4e"; const lpOfPool2 = "0xEB85B2E12320a123d447Ca0dA26B49E666b799dB"; @@ -36,62 +36,32 @@ const PCT = "0xbc16da9df0a22f01a16bc0620a27e7d6d6488550"; const stakingContracts = pctPoolContracts.concat([stakingContract, comptroller]) -const calc = async (balances, poolContract, lpToken) => { - const balanceLPofPool2 = ( - await sdk.api.abi.call({ - abi: 'erc20:balanceOf', - target: lpToken, - params: poolContract, +async function resolveBalancers({ balances = {}, toa, api }) { + const bals = await api.multiCall({ abi: 'erc20:balanceOf', calls: toa.map(i => ({ params: i[1], target: i[0] })) }) + const supply = await api.multiCall({ abi: abi.totalSupply, calls: toa.map(i => i[0]) }) + const ratio = bals.map((v, i) => v / supply[i]) + const tokens = await api.multiCall({ abi: abi.getCurrentTokens, calls: toa.map(i => i[0]) }) + await Promise.all(tokens.map(async (t, i) => { + const owner = toa[i][0] + const bals = await api.multiCall({ abi: 'erc20:balanceOf', calls: t.map(j => ({ target: j, params: owner })) }) + bals.forEach((bal, j) => { + const token = t[j] + sdk.util.sumSingleBalance(balances, token, bal * ratio[i], api.chain) }) - ).output; - - const tokensOfLP = ( - await sdk.api.abi.call({ - abi: abi.getCurrentTokens, - target: lpToken, - }) - ).output; - - for (const token of tokensOfLP) { - const getBalance = ( - await sdk.api.abi.call({ - abi: 'erc20:balanceOf', - target: token, - params: lpToken, - }) - ).output; - - const totalSupply = ( - await sdk.api.abi.call({ - abi: abi.totalSupply, - target: lpToken, - }) - ).output; - - sdk.util.sumSingleBalance( - balances, - token, - BigNumber(getBalance).times(balanceLPofPool2).div(totalSupply).toFixed(0) - ); - } -}; - -async function pool2() { - const balances = {}; - - await calc(balances, pool2Contract, lpOfPool2); - - return balances; + })) + return balances } -async function ethTvl() { - const balances = {}; +async function pool2(_, _1, _2, { api }) { + return resolveBalancers({ toa: [[lpOfPool2, pool2Contract]], api }) +} - for (let i = 0; i < pctPoolContracts.length; i++) { - await calc(balances, pctPoolContracts[i], lpOfPctPools[i]); - } +async function ethTvl(_, _1, _2, { api }) { + const toa = [] + for (let i = 0; i < pctPoolContracts.length; i++) + toa.push([lpOfPctPools[i], pctPoolContracts[i]]) - return balances; + return resolveBalancers({ api, toa }); } module.exports = { diff --git a/projects/perennial/index.js b/projects/perennial/index.js new file mode 100644 index 00000000000..cf50d9a22b0 --- /dev/null +++ b/projects/perennial/index.js @@ -0,0 +1,15 @@ +const { sumTokensExport } = require("../helper/unwrapLPs"); + +const config = { + ethereum: { DSU: '0x605D26FBd5be761089281d5cec2Ce86eeA667109', collateral: '0x2d264EBDb6632A06A1726193D4d37FeF1E5dbDcd', }, + arbitrum: { DSU: '0x52C64b8998eB7C80b6F526E99E29ABdcC86B841b', collateral: '0xaf8ced28fce00abd30463d55da81156aa5aeeec2', }, +} + +module.exports = {}; + +Object.keys(config).forEach(chain => { + const { DSU, collateral} = config[chain] + module.exports[chain] = { + tvl: sumTokensExport({ owner: collateral, tokens: [DSU] }) + } +}) diff --git a/projects/perifinance/abi.json b/projects/perifinance/abi.json index eb80713751e..4870780e867 100644 --- a/projects/perifinance/abi.json +++ b/projects/perifinance/abi.json @@ -1,23 +1,3 @@ { - "totalIssuedPynths": { - "constant": true, - "inputs": [ - { - "internalType": "bytes32", - "name": "currencyKey", - "type": "bytes32" - } - ], - "name": "totalIssuedPynths", - "outputs": [ - { - "internalType": "uint256", - "name": "totalIssued", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } + "totalIssuedPynths": "function totalIssuedPynths(bytes32 currencyKey) view returns (uint256 totalIssued)" } \ No newline at end of file diff --git a/projects/perifinance/index.js b/projects/perifinance/index.js index c4114baee84..9daf0fe4d52 100644 --- a/projects/perifinance/index.js +++ b/projects/perifinance/index.js @@ -76,7 +76,7 @@ module.exports = { } return "0x" + hex; -}; +} /** * Should be called to pad string to expected length @@ -94,4 +94,4 @@ function rightPad(string, chars, sign) { var padding = (chars - string.length + 1 >= 0) ? chars - string.length + 1 : 0; return (hasPrefix ? '0x' : '') + string + (new Array(padding).join(sign ? sign : "0")); -}; \ No newline at end of file +} \ No newline at end of file diff --git a/projects/perion/index.js b/projects/perion/index.js new file mode 100644 index 00000000000..349f7d0a27b --- /dev/null +++ b/projects/perion/index.js @@ -0,0 +1,9 @@ +const PERC = "0x60bE1e1fE41c1370ADaF5d8e66f07Cf1C2Df2268"; +const { staking } = require('../helper/staking') + +module.exports = { + ethereum: { + tvl: () => 0, + staking: staking('0xf64F48A4E27bBC299273532B26c83662ef776b7e', PERC) + }, +}; \ No newline at end of file diff --git a/projects/perlinx/abi.json b/projects/perlinx/abi.json index ebbf7837d95..fa50aebf962 100644 --- a/projects/perlinx/abi.json +++ b/projects/perlinx/abi.json @@ -1,119 +1,9 @@ { - "poolCount": { - "inputs": [], - "name": "poolCount", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "arrayPerlinPools": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "arrayPerlinPools", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "poolIsListed": { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "poolIsListed", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getCurrentTokens": { - "constant": true, - "inputs": [], - "name": "getCurrentTokens", - "outputs": [ - { - "internalType": "address[]", - "name": "tokens", - "type": "address[]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "synthCount": { - "inputs": [], - "name": "synthCount", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "arraySynths": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "arraySynths", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "mapSynth_EMP": { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "mapSynth_EMP", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } + "poolCount": "uint256:poolCount", + "arrayPerlinPools": "function arrayPerlinPools(uint256) view returns (address)", + "poolIsListed": "function poolIsListed(address) view returns (bool)", + "getCurrentTokens": "address[]:getCurrentTokens", + "synthCount": "uint256:synthCount", + "arraySynths": "function arraySynths(uint256) view returns (address)", + "mapSynth_EMP": "function mapSynth_EMP(address) view returns (address)" } \ No newline at end of file diff --git a/projects/perlinx/index.js b/projects/perlinx/index.js index e0f3564af21..caf7253f5c6 100644 --- a/projects/perlinx/index.js +++ b/projects/perlinx/index.js @@ -28,7 +28,7 @@ async function tvl(timestamp, block) { if (timestamp < startTimestamp || block < startBlock) { return balances; - }; + } const synthCount = await sdk.api.abi.call({ target: perlinX, diff --git a/projects/perp/index.js b/projects/perp/index.js index 2ea517f9bda..d0e69d6892d 100644 --- a/projects/perp/index.js +++ b/projects/perp/index.js @@ -1,41 +1,25 @@ -const sdk = require("@defillama/sdk"); -const { getChainTransform } = require('../helper/portedTokens'); +const ADDRESSES = require('../helper/coreAssets.json') const { staking } = require("../helper/staking"); -const insuranceFund = "0x8C29F6F7fc1999aB84b476952E986F974Acb3824" -const clearingHouse = "0x5d9593586b4B5edBd23E7Eba8d88FD8F09D83EBd" -const usdcXdai = "0xDDAfbb505ad214D7b80b1f830fcCc89B60fb7A83" - const perpToken = "0xbC396689893D065F41bc2C6EcbeE5e0085233447" +const perpTokenOP = "0x9e1028F5F1D5eDE59748FFceE5532509976840E0" const stakingContract = "0x0f346e19F01471C02485DF1758cfd3d624E399B4" - -async function xdai(_timestamp, ethBlock, chainBlocks) { - const balances = {}; - const underlyingBalances = await sdk.api.abi.multiCall({ - calls: [{ - target: usdcXdai, - params: insuranceFund - },{ - target: usdcXdai, - params: clearingHouse - }], - block: chainBlocks.xdai, - abi: "erc20:balanceOf", - chain: 'xdai' - }); - const usdc = (await getChainTransform('xdai'))(usdcXdai); - sdk.util.sumSingleBalance(balances, usdc, underlyingBalances.output[0].output) - sdk.util.sumSingleBalance(balances, usdc, underlyingBalances.output[1].output) - - return balances -} - +const stakingContractOP = "0xD360B73b19Fb20aC874633553Fb1007e9FcB2b78" module.exports = { - ethereum: { - staking: staking(stakingContract, perpToken) - }, - optimism:{ - tvl: staking("0xAD7b4C162707E0B2b5f6fdDbD3f8538A5fbA0d60", "0x7f5c764cbc14f9669b88837ca1490cca17c31607", "optimism") - }, - + ethereum: { + staking: staking(stakingContract, perpToken) + }, + optimism: { + staking: staking(stakingContractOP, perpTokenOP), + tvl: staking( + [ + "0xAD7b4C162707E0B2b5f6fdDbD3f8538A5fbA0d60" + ], + [ + ADDRESSES.optimism.USDC, + ADDRESSES.optimism.USDT, + ADDRESSES.optimism.OP, + ADDRESSES.tombchain.FTM, + ADDRESSES.optimism.FRAX]) + }, } \ No newline at end of file diff --git a/projects/perp88/index.js b/projects/perp88/index.js index 91f9eecbb27..9eacb8aabd3 100644 --- a/projects/perp88/index.js +++ b/projects/perp88/index.js @@ -1,18 +1,16 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokensExport } = require('../helper/unwrapLPs') const tokens = { - "WMATIC": "0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270", - "WETH": "0x7ceb23fd6bc0add59e62ac25578270cff1b9f619", - "WBTC": "0x1bfd67037b42cf73acf2047067bd4f2c47d9bfd6", - "DAI": "0x8f3cf7ad23cd3cadbd9735aff958023239c6a063", - "USDC": "0x2791bca1f2de4661ed88a30c99a7a9449aa84174", - "USDT": "0xc2132d05d31c914a87c6611c10748aeb04b58e8f" + "WMATIC": ADDRESSES.polygon.WMATIC_2, + "WETH": ADDRESSES.polygon.WETH_1, + "WBTC": ADDRESSES.polygon.WBTC, + "DAI": ADDRESSES.polygon.DAI, + "USDC": ADDRESSES.polygon.USDC, + "USDT": ADDRESSES.polygon.USDT } const POOL_DIAMOND_CONTRACT = '0xE7D96684A56e60ffBAAe0fC0683879da48daB383'; module.exports = { - timetravel: false, - misrepresentedTokens: false, - methodology: 'Count every tokens under PoolDiamond management.', start: 1668684025, polygon: { tvl: sumTokensExport({ @@ -20,5 +18,17 @@ module.exports = { tokens: Object.values(tokens), chain: 'polygon', }), + }, + arbitrum: { + tvl: sumTokensExport({ + owner: '0x56CC5A9c0788e674f17F7555dC8D3e2F1C0313C0', + tokens: [ + ADDRESSES.arbitrum.USDC, + ADDRESSES.arbitrum.WETH, + ADDRESSES.arbitrum.WBTC, + ADDRESSES.arbitrum.USDT, + ADDRESSES.arbitrum.fsGLP, + ] + }) } } diff --git a/projects/phantom-finance/index.js b/projects/phantom-finance/index.js index fde52454c55..48212740d3b 100644 --- a/projects/phantom-finance/index.js +++ b/projects/phantom-finance/index.js @@ -18,6 +18,9 @@ async function tvl(timestamp, block, chainBlocks) { } module.exports = { + hallmarks: [ + [1646179200, "Rug Pull"] + ], deadFrom: 1648765747, methodology: "TVL includes all farms in MasterChef contract", fantom: { diff --git a/projects/pheasantswap/index.js b/projects/pheasantswap/index.js new file mode 100644 index 00000000000..4941297bcf0 --- /dev/null +++ b/projects/pheasantswap/index.js @@ -0,0 +1,5 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports = { + enuls: { tvl: getUniTVL({ factory: '0x7bf960B15Cbd9976042257Be3F6Bb2361E107384', useDefaultCoreAssets: true, fetchBalances: true }), }, +} diff --git a/projects/phemex/index.js b/projects/phemex/index.js new file mode 100644 index 00000000000..8aaad51c992 --- /dev/null +++ b/projects/phemex/index.js @@ -0,0 +1,17 @@ +const { cexExports } = require('../helper/cex') + +const config = { + bitcoin: { + owners: [ + '3PiGxVdpMjWSsH8X8BypdwcsmPW5cmE4Ta', + ] + }, + ethereum: { + owners: [ + '0xf7D13C7dBec85ff86Ee815f6dCbb3DEDAc78ca49' + ], + }, +} + +module.exports = cexExports(config) +module.exports.methodology = 'We are only tracking part of their cold wallets, more information here https://phemex.com/proof-of-reserves' \ No newline at end of file diff --git a/projects/phenix-dex/index.js b/projects/phenix-dex/index.js new file mode 100644 index 00000000000..ea0ca1b00d2 --- /dev/null +++ b/projects/phenix-dex/index.js @@ -0,0 +1,17 @@ +const { getUniTVL } = require("../helper/unknownTokens"); + +module.exports = { + methodology: `TVL of staked assets across the Phenix DEX on both Cronos Mainnet and Polygon POS chains.`, + cronos: { + tvl: getUniTVL({ + factory: "0x6Bae09822c36a9359d563A22fc7d134eF27a5f60", + useDefaultCoreAssets: true, + }), + }, + polygon: { + tvl: getUniTVL({ + factory: "0x9A3F01dfA086C2E234fC88742c692368438fBb30", + useDefaultCoreAssets: true, + }), + }, +}; diff --git a/projects/phezzan/index.js b/projects/phezzan/index.js new file mode 100644 index 00000000000..ae2fbc0a55a --- /dev/null +++ b/projects/phezzan/index.js @@ -0,0 +1,45 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport, nullAddress, } = require('../helper/unknownTokens') +const { toUSDTBalances } = require('../helper/balances') +const { get } = require('../helper/http') + +async function offers() { + const markets = await get('https://api.phezzan.xyz/api/v1/markets') + const marketInfos = await get('https://api.phezzan.xyz/api/v1/marketinfos?chain_id=280&market=' + Object.keys(markets).join(',')) + let total = 1000 + Object.keys(markets).forEach(market => { + const info = marketInfos[market] + const { baseVolume, quoteVolume } = markets[market] + if (!info) return; + total += baseVolume * info.baseAsset.usdPrice + quoteVolume * info.quoteAsset.usdPrice + }) + return toUSDTBalances(total) +} + + +const Contracts = { + kava: { + wkava: ADDRESSES.kava.WKAVA, + usdc: ADDRESSES.telos.ETH, + perpV1Result: "0x46bC4858F5BEE5AeB09bEB5906D7eFE92Ba50851", + fundingResult: "0xDe7570E5835B6045C6AB360222887bAED21Be5EA", // Funding + P1P1TradeResult: "0x49Ef8ca9A80B701E470EB70C835b361a99091278", // Staking + P1LiquidationResult: "0x55B5134A843b75Ad0b968782788b32dA23d9AeDA" // LPs + }, +}; + +module.exports = { + timetravel: false, + misrepresentedTokens: true, + kava: { + tvl: async () => ({}), + // tvl: sumTokensExport({ owners: [Contracts.kava.perpV1Result, Contracts.kava.fundingResult, ], tokens: [Contracts.kava.wkava, Contracts.kava.usdc, nullAddress] }), + }, + zksync: { + // offers, + tvl: async () => ({}) + }, + hallmarks: [ + [Math.floor(new Date('2023-04-23')/1e3), 'Protocol shutdown'], + ], +}; diff --git a/projects/phission-finance/index.js b/projects/phission-finance/index.js index 36040ffdb0d..af8f50d5288 100644 --- a/projects/phission-finance/index.js +++ b/projects/phission-finance/index.js @@ -1,6 +1,7 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokensExport } = require('../helper/unknownTokens') -const WETH = '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2'; +const WETH = ADDRESSES.ethereum.WETH; const GOV_POOL = '0x18174E80335B9fCbc8ac0AB7f40F25aba878ccCC'; const SPLIT_CONTRACT = '0x5b38A73f9dB3F5e12BB4dCb5a434FB3bd3972E53'; const STAKING_CONTRACT = '0x569a157eac744b87a42314e8fc03a2e648ea33a2' diff --git a/projects/phoenix-bonds/index.js b/projects/phoenix-bonds/index.js new file mode 100644 index 00000000000..f7611db8eb5 --- /dev/null +++ b/projects/phoenix-bonds/index.js @@ -0,0 +1,27 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { call } = require('../helper/chain/near') + +async function tvl() { + const linear_price = await call( + ADDRESSES.near.LINA, + 'ft_price', + {} + ); + const { linear_balance } = await call( + 'phoenix-bonds.near', + 'get_summary', + { + "linear_price": linear_price + } + ); + return { + near: ( linear_price / 1e24 ) * (linear_balance / 1e24) + }; +} + +module.exports = { + near: { + tvl + }, + timetravel: false, +}; \ No newline at end of file diff --git a/projects/phoenix-dex/index.js b/projects/phoenix-dex/index.js index 07807547fe9..879c3cfc0f8 100644 --- a/projects/phoenix-dex/index.js +++ b/projects/phoenix-dex/index.js @@ -5,9 +5,6 @@ module.exports = { misrepresentedTokens: true, methodology: "Liquidity on the DEX", terra2: { - tvl: getFactoryTvl( - "terra1pewdsxywmwurekjwrgvjvxvv0dv2pf8xtdl9ykfce2z0q3gf0k3qr8nezy", - true, - ), + tvl: getFactoryTvl("terra1pewdsxywmwurekjwrgvjvxvv0dv2pf8xtdl9ykfce2z0q3gf0k3qr8nezy"), }, }; diff --git a/projects/phoenix/abi.json b/projects/phoenix/abi.json index e75c84f1ed5..7f571b79cdf 100644 --- a/projects/phoenix/abi.json +++ b/projects/phoenix/abi.json @@ -1,17 +1,3 @@ -{ - "totalSupply": { - "constant": true, - "inputs": [], - "name": "getTvl", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } -} +{ + "totalSupply": "uint256:getTvl" +} \ No newline at end of file diff --git a/projects/phoenix/index.js b/projects/phoenix/index.js index bbd9cabfc1a..91cc6159594 100644 --- a/projects/phoenix/index.js +++ b/projects/phoenix/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk'); const BigNumber = require('bignumber.js'); @@ -8,7 +9,7 @@ const bscpool = '0xBB8dA4ed33388A0eAc442eD1f28474413FC9d7a7'; const wanpool = '0xBB8dA4ed33388A0eAc442eD1f28474413FC9d7a7'; //const wanOptionFactorySc = new wanWeb3.eth.Contract(optionFactoryAbi,wanOptionFactory); -let usd = "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"; +let usd = ADDRESSES.ethereum.USDC; async function polygon(timestamp, _, {polygon: block }) { let totalSupply = (await sdk.api.abi.call({ diff --git a/projects/photon-protocol/index.js b/projects/photon-protocol/index.js index 29f30555293..0028dd3dab7 100644 --- a/projects/photon-protocol/index.js +++ b/projects/photon-protocol/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { stakingUnknownPricedLP } = require("../helper/staking"); const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); @@ -6,7 +7,7 @@ const stakingContract = "0x81177472Ce36A9b1AB573804CD215C72cEb76F36"; const photonbusd = "0xEBAa17dA7D5C616441290669E9D2c982c8B1Da25"; //PHOTON-BUSD const treasury = "0x0f90591b01DE6F832e8B8E4ec3525efD423BCaD1"; const treasuryTokens = [ - ["0xe9e7cea3dedca5984780bafc599bd69add087d56", false], // BUSD + [ADDRESSES.bsc.BUSD, false], // BUSD ]; async function tvl (timestamp, block, chainBlocks) { diff --git a/projects/photonswap/index.js b/projects/photonswap/index.js index 4f325154305..d1c2ec365a5 100644 --- a/projects/photonswap/index.js +++ b/projects/photonswap/index.js @@ -6,21 +6,18 @@ module.exports = { cronos: { tvl: getUniTVL({ factory: '0x462C98Cae5AffEED576c98A55dAA922604e2D875', - chain: 'cronos', useDefaultCoreAssets: true, }), }, evmos: { tvl: getUniTVL({ factory: '0x1c671d6fEC45Ec0de88C82e6D8536bFe33F00c8a', - chain: 'evmos', useDefaultCoreAssets: true, }), }, kava: { tvl: getUniTVL({ factory: '0x4FD2c40c25Dd40e9Bf0CE8479bA384178b8671b5', - chain: 'kava', useDefaultCoreAssets: true, }), } diff --git a/projects/phuture/abis/Index.abi.json b/projects/phuture/abis/Index.abi.json index 59b1316b553..fc3970461b7 100644 --- a/projects/phuture/abis/Index.abi.json +++ b/projects/phuture/abis/Index.abi.json @@ -1,46 +1,5 @@ { - "anatomy": { - "inputs": [], - "name": "anatomy", - "outputs": [ - { - "internalType": "address[]", - "name": "_assets", - "type": "address[]" - }, - { - "internalType": "uint8[]", - "name": "_weights", - "type": "uint8[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - "inactiveAnatomy": { - "inputs": [], - "name": "inactiveAnatomy", - "outputs": [ - { - "internalType": "address[]", - "name": "", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - "vTokenFactory": { - "inputs": [], - "name": "vTokenFactory", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } + "anatomy": "function anatomy() view returns (address[] _assets, uint8[] _weights)", + "inactiveAnatomy": "address[]:inactiveAnatomy", + "vTokenFactory": "address:vTokenFactory" } \ No newline at end of file diff --git a/projects/phuture/abis/SavingsVault.abi.json b/projects/phuture/abis/SavingsVault.abi.json index 5d87094f525..b0fd36e2665 100644 --- a/projects/phuture/abis/SavingsVault.abi.json +++ b/projects/phuture/abis/SavingsVault.abi.json @@ -1,28 +1,4 @@ { - "asset": { - "inputs": [], - "name": "asset", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "totalAssets": { - "inputs": [], - "name": "totalAssets", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } + "asset": "address:asset", + "totalAssets": "uint256:totalAssets" } \ No newline at end of file diff --git a/projects/phuture/abis/vToken.abi.json b/projects/phuture/abis/vToken.abi.json index 1ec10d6187f..2c4de4ea1b0 100644 --- a/projects/phuture/abis/vToken.abi.json +++ b/projects/phuture/abis/vToken.abi.json @@ -1,15 +1,3 @@ { - "virtualTotalAssetSupply": { - "inputs": [], - "name": "virtualTotalAssetSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -} + "virtualTotalAssetSupply": "uint256:virtualTotalAssetSupply" +} \ No newline at end of file diff --git a/projects/phuture/abis/vTokenFactory.abi.json b/projects/phuture/abis/vTokenFactory.abi.json index 39fe116a3b2..40654950a01 100644 --- a/projects/phuture/abis/vTokenFactory.abi.json +++ b/projects/phuture/abis/vTokenFactory.abi.json @@ -1,21 +1,3 @@ { - "vTokenOf": { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "vTokenOf", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } + "vTokenOf": "function vTokenOf(address) view returns (address)" } \ No newline at end of file diff --git a/projects/phuture/index.js b/projects/phuture/index.js index 107c2dbbf5c..d86c8207c03 100644 --- a/projects/phuture/index.js +++ b/projects/phuture/index.js @@ -16,9 +16,9 @@ const indexTvl = (chain) => async (timestamp, block, chainBlocks) => { const indexes = Object.fromEntries( anatomy.map(({ input, output: { _assets } }) => [ - input.target, - _assets - ] + input.target, + _assets + ] ) ); @@ -69,29 +69,22 @@ const indexTvl = (chain) => async (timestamp, block, chainBlocks) => { ); }; -const savingsVaultTvl = (chain) => async (timestamp, block, chainBlocks) => { - const { output: assets } = await sdk.api.abi.multiCall({ - chain, - block: chainBlocks[chain], - calls: networks[chain]["savingsVaults"].map((target) => ({ target })), - abi: savingsVaultAbi.asset - }); - - const { output: totalAssets } = await sdk.api.abi.multiCall({ - chain, - block: chainBlocks[chain], - calls: networks[chain]["savingsVaults"].map((target) => ({ target })), - abi: savingsVaultAbi.totalAssets - }); - - const chainTransform = await getChainTransform(chain); +const savingsVaultTvl = (chain) => async (_, _1, _2, { api }) => { + const calls = networks[chain]["savingsVaults"] + const assets = await api.multiCall({ + abi: savingsVaultAbi.asset, calls, + }) + const totalAssets = await api.multiCall({ + abi: savingsVaultAbi.totalAssets, calls, + }) + const balances = {} - return Object.fromEntries( - assets.map(({ output: asset }, i) => [ - chainTransform(asset), - totalAssets[i].output - ]) - ); + totalAssets.forEach((bal, i) => { + const token = assets[i] + if (!bal && calls[i].toLowerCase() === '0x6bad6a9bcfda3fd60da6834ace5f93b8cfed9598') return; + sdk.util.sumSingleBalance(balances, token, bal, chain) + }) + return balances }; module.exports = { diff --git a/projects/phux/index.js b/projects/phux/index.js new file mode 100644 index 00000000000..20b7243d9c7 --- /dev/null +++ b/projects/phux/index.js @@ -0,0 +1,16 @@ +const { onChainTvl } = require('../helper/balancer') + +const VAULT_ADDRESS = '0x7F51AC3df6A034273FB09BB29e383FCF655e473c'; + +const config = { + pulse: { fromBlock: 17500116, }, +} + +module.exports = {}; + +Object.keys(config).forEach(chain => { + const { fromBlock } = config[chain] + module.exports[chain] = { + tvl: onChainTvl(VAULT_ADDRESS, fromBlock) + } +}) \ No newline at end of file diff --git a/projects/pickle/index.js b/projects/pickle/index.js index caa53fb35df..2d56bb657f1 100644 --- a/projects/pickle/index.js +++ b/projects/pickle/index.js @@ -1,7 +1,7 @@ const { toUSDT, usdtAddress } = require("../helper/balances"); const axios = require("axios"); -const pfcore = "https://api.pickle.finance/prod/protocol/pfcore/"; +const pfcore = "https://f8wgg18t1h.execute-api.us-west-1.amazonaws.com/prod/protocol/pfcore/"; const pickleAddress = "0x429881672B9AE42b8EbA0E26cD9C73711b891Ca5"; // node test.js projects/pickle/index.js function fetch(chain, type) { @@ -39,7 +39,7 @@ function fetch(chain, type) { result = { [usdtAddress]: toUSDT(pool2) }; break; case "staking": - const picklesLocked = response.dill.pickleLocked; + const picklesLocked = response.dill?.pickleLocked || 0; result = { [pickleAddress]: picklesLocked * 1e18 }; break; } diff --git a/projects/pidao-finance/index.js b/projects/pidao-finance/index.js index 70a7d6339bb..cc57fb54ac8 100644 --- a/projects/pidao-finance/index.js +++ b/projects/pidao-finance/index.js @@ -1,13 +1,14 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { ohmTvl } = require('../helper/ohm') const treasury = "0x458B737d87C40252EC11b160C76bb1C53F248b28" module.exports = ohmTvl(treasury, [ //busd - ["0xe9e7cea3dedca5984780bafc599bd69add087d56", false], + [ADDRESSES.bsc.BUSD, false], //busd-usd - ["0x55d398326f99059ff775485246999027b3197955", false], + [ADDRESSES.bsc.USDT, false], //TrueUSD - ["0x14016e85a25aeb13065688cafb43044c2ef86784", false], + [ADDRESSES.bsc.BTUSD, false], //MDEX LP ["0x149a712378aba63882c1d372739eb47a6fd0e12e", true], //Pancake LPs diff --git a/projects/piedao/pieDAO.js b/projects/piedao/pieDAO.js index 748d93bf15e..44349e54ee4 100644 --- a/projects/piedao/pieDAO.js +++ b/projects/piedao/pieDAO.js @@ -28,7 +28,7 @@ module.exports = class PieDAO { const pieCalls = Object.values(this.pies).map(pie => ({ target: pie })) const { output: supplies } = await sdk.api.abi.multiCall({ calls: pieCalls, - abi: pieABI.find(i => i.name === 'totalSupply') + abi: pieABI.totalSupply }) const calls = supplies.map(({ input, output }) => ({ target: input.target, @@ -36,7 +36,7 @@ module.exports = class PieDAO { })) const { output: tokensAndAmountsAll } = await sdk.api.abi.multiCall({ calls, - abi: pieABI.find(i => i.name === 'calcTokensForAmount') + abi: pieABI.calcTokensForAmount }) for (let j = 0; j < tokensAndAmountsAll.length; j++) { const tokensAndAmounts = tokensAndAmountsAll[j].output @@ -70,14 +70,14 @@ module.exports = class PieDAO { case "all": const { output: poolCount } = await sdk.api.abi.call({ target: poolAddress, - abi: pieStakingAll.find(i => i.name === 'poolCount') + abi: pieStakingAll.poolCount }) const poolCalls = [] for (let i=0;i i.name === 'getPoolToken') + abi: pieStakingAll.getPoolToken }) const tokens = underlyingTokens.map(i => i.output) const tokenCalls = tokens.map(t => ({ target: t })) @@ -112,7 +112,7 @@ module.exports = class PieDAO { case "BPT": response = await sdk.api.abi.call({ target: underlyingAddress, - abi: IBPT.find(i => i.name === 'getFinalTokens') + abi: IBPT.getFinalTokens }) underlyings = response.output hangingPromises.push(this.calculateUnderLyings(underlyings, underlyingAddress, underlyingBalance, underlyingSupply)) @@ -121,7 +121,7 @@ module.exports = class PieDAO { case "BCP": response = await sdk.api.abi.call({ target: underlyingAddress, - abi: IBCP.find(i => i.name === 'getTokens') + abi: IBCP.getTokens }) underlyings = response.output hangingPromises.push(this.calculateUnderLyings(underlyings, underlyingAddress, underlyingBalance, underlyingSupply)) @@ -133,7 +133,7 @@ module.exports = class PieDAO { case "balancer": underlyingAddress = stakingPool.lp ? stakingPool.lp : (await sdk.api.abi.call({ target: poolAddress, - abi: IStakingBalancer.find(i => i.name === 'uni') + abi: IStakingBalancer.uni })).output; //console.log("calculatePools", stakingPool.type, underlyingAddress); @@ -142,7 +142,7 @@ module.exports = class PieDAO { response = await sdk.api.abi.call({ target: underlyingAddress, - abi: IStakedToken.find(i => i.name === 'getFinalTokens') + abi: IStakedToken.getFinalTokens }) underlyings = response.output hangingPromises.push(this.calculateUnderLyings(underlyings, underlyingAddress, underlyingBalance, underlyingSupply)) @@ -151,7 +151,7 @@ module.exports = class PieDAO { case "piedao": response = await sdk.api.abi.call({ target: poolAddress, - abi: IStakedPieDAO.find(i => i.name === 'uni') + abi: IStakedPieDAO.uni }) underlyingAddress = response.output underlyingBalance = new BigNumber((await sdk.api.erc20.balanceOf({ target: underlyingAddress, owner: poolAddress })).output); @@ -159,7 +159,7 @@ module.exports = class PieDAO { response = await sdk.api.abi.call({ target: underlyingAddress, - abi: IBCP.find(i => i.name === 'getTokens') + abi: IBCP.getTokens }) underlyings = response.output hangingPromises.push(this.calculateUnderLyings(underlyings, underlyingAddress, underlyingBalance, underlyingSupply)) @@ -168,7 +168,7 @@ module.exports = class PieDAO { case "uniswap": response = await sdk.api.abi.call({ target: poolAddress, - abi: IStakingUniswap.find(i => i.name === 'uni') + abi: IStakingUniswap.uni }) underlyingAddress = response.output hangingPromises.push(sumTokens(balances, [[underlyingAddress, poolAddress]], )) diff --git a/projects/piggy/abi.json b/projects/piggy/abi.json deleted file mode 100644 index 57b2a328f03..00000000000 --- a/projects/piggy/abi.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "inputs": [], - "name": "getEntireSystemColl", - "outputs": [ - { - "internalType": "uint256", - "name": "entireSystemColl", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" -} diff --git a/projects/piggy/index.js b/projects/piggy/index.js index ecdfc87d238..ea209dff27a 100644 --- a/projects/piggy/index.js +++ b/projects/piggy/index.js @@ -1,13 +1,7 @@ -const sdk = require('@defillama/sdk'); -const abi = require('./abi'); +const ADDRESSES = require('../helper/coreAssets.json') const {getLiquityTvl} = require('../helper/liquity') -const BNB_ADDRESS = "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c"; -const PUSD_TOKEN_ADDRESS = "0xedbdb5c2f68ece62ef35134a22156e665c3b06e3"; -const prefixBsc = addr => `bsc:${addr}`; - -// StabilityPool holds deposited PUSD -const STABILITY_POOL_ADDRESS = "0xD4F3B638dFe1509DD06B9c8Fcf45a4C87179f03F"; +const BNB_ADDRESS = ADDRESSES.bsc.WBNB; // TroveManager holds total system collateral (deposited BNB) const TROVE_MANAGER_ADDRESS = "0xb283466d09177c5C6507785d600caFDFa538C65C"; diff --git a/projects/piggybankdao/index.js b/projects/piggybankdao/index.js index 06eca494be3..63909b5db35 100644 --- a/projects/piggybankdao/index.js +++ b/projects/piggybankdao/index.js @@ -1,5 +1,4 @@ const {sumTokensAndLPsSharedOwners, sumLPWithOnlyOneToken} = require('../helper/unwrapLPs') -const {transformAvaxAddress} = require('../helper/portedTokens') const { stakingPricedLP } = require('../helper/staking') @@ -14,7 +13,7 @@ const MIM = "0x130966628846bfd36ff31a822705796e8cb8c18d" async function avaxTvl(time, ethBlock, chainBlocks){ const balances = {} - const transform = await transformAvaxAddress() + const transform = addr => 'avax:'+addr await sumLPWithOnlyOneToken(balances, "0xd3a6eebbe6f6d9197a7fc2aaaf94d8b0ec51f8a8", treasury, MIM, chainBlocks.avax, "avax", transform) await sumTokensAndLPsSharedOwners(balances, [ [MIM, false], diff --git a/projects/pika-v4/index.js b/projects/pika-v4/index.js new file mode 100644 index 00000000000..e3d3705a97c --- /dev/null +++ b/projects/pika-v4/index.js @@ -0,0 +1,10 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require('../helper/unwrapLPs') + +module.exports = { + optimism: { + tvl: sumTokensExport({ owners: [ + '0x9b86B2Be8eDB2958089E522Fe0eB7dD5935975AB', + ], tokens: [ADDRESSES.optimism.USDC]}) + } +} \ No newline at end of file diff --git a/projects/pilotprotocol/abi.json b/projects/pilotprotocol/abi.json index ceead44bd93..5d060ab47b7 100644 --- a/projects/pilotprotocol/abi.json +++ b/projects/pilotprotocol/abi.json @@ -1,102 +1,7 @@ -{ - "totalToken": { - "constant": true, - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "name": "totalToken", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "hecoPool": { - "constant": true, - "inputs": [], - "name": "hecoPool", - "outputs": [ - { - "internalType": "contract IHecoPool", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "hecoPoolId": { - "constant": true, - "inputs": [], - "name": "hecoPoolId", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "userInfo": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "userInfo", - "outputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "rewardDebt", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "multLpRewardDebt", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "stakingToken": { - "constant": true, - "inputs": [], - "name": "stakingToken", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } +{ + "totalToken": "function totalToken(address token) view returns (uint256)", + "hecoPool": "address:hecoPool", + "hecoPoolId": "uint256:hecoPoolId", + "userInfo": "function userInfo(uint256, address) view returns (uint256 amount, uint256 rewardDebt, uint256 multLpRewardDebt)", + "stakingToken": "address:stakingToken" } \ No newline at end of file diff --git a/projects/pilotprotocol/index.js b/projects/pilotprotocol/index.js index e9872ee8f10..ac1fcd9b474 100644 --- a/projects/pilotprotocol/index.js +++ b/projects/pilotprotocol/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); @@ -29,7 +30,7 @@ const farmingPools = [ const tokens = [ // USDT: - "0xa71EdC38d189767582C38A3145b5873052c3e47a", + ADDRESSES.heco.USDT, // HBTC: "0x66a79D23E58475D2738179Ca52cd0b41d73f0BEa", // ETH: @@ -91,6 +92,7 @@ const hecoTvl = async (timestamp, ethBlock, chainBlocks) => { })), chain: "heco", block: chainBlocks["heco"], + permitFailure: true, }) ).output.map((st) => st.output); diff --git a/projects/pine-protocol/index.js b/projects/pine-protocol/index.js new file mode 100644 index 00000000000..31658435ae8 --- /dev/null +++ b/projects/pine-protocol/index.js @@ -0,0 +1,44 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { getLogs, getAddress } = require('../helper/cache/getLogs') +const { sumTokens2 } = require('../helper/unwrapLPs') +const sdk = require('@defillama/sdk') + +async function _getLogs(api) { + const { factory, fromBlock } = config[api.chain] + const logs = await getLogs({ + api, + target: factory, + topics: ['0xfe735a4766d74f0c8b076be3f254cfc301a851f3ac49c4ae35e7d48ab75cd69d'], + fromBlock, + }) + return logs.map(i => i.topics.slice(1).map(getAddress)) +} + +async function tvl(_, _b, _cb, { api, }) { + const { factory, wrapped } = config[api.chain] + const logs = await _getLogs(api) + const tokensAndOwners = logs.map(i => [i[1], i[0]]) + tokensAndOwners.push([wrapped, factory]) + return sumTokens2({ api, tokensAndOwners, permitFailure: true }) +} + +async function borrowed(_, _b, _cb, { api, }) { + const balances = {} + const logs = await _getLogs(api) + const loans = await api.multiCall({ abi: 'uint256:_currentLoanAmount', calls: logs.map(i => i[0]) }) + loans.forEach((val, i) => sdk.util.sumSingleBalance(balances, logs[i][2], val, api.chain)) + return balances +} + +const config = { + ethereum: { factory: '0x19c56cb20e6e9598fc4d22318436f34981e481f9', fromBlock: 16423090, wrapped: ADDRESSES.ethereum.WETH, }, + polygon: { factory: '0x85b609f4724860fead57e16175e66cf1f51bf72d', fromBlock: 40378130, wrapped: ADDRESSES.polygon.WMATIC_2, }, +} + +module.exports = { + methodology: 'value of NFTs locked in pools as taken as tvl, tokens borrowed against it is counted towards borrowed', +}; + +Object.keys(config).forEach(chain => { + module.exports[chain] = { tvl, borrowed, } +}) \ No newline at end of file diff --git a/projects/pinjam/index.js b/projects/pinjam/index.js new file mode 100644 index 00000000000..0112742f7d8 --- /dev/null +++ b/projects/pinjam/index.js @@ -0,0 +1,60 @@ +const { getLogs, getAddress } = require('../helper/cache/getLogs') +const { staking } = require("../helper/staking"); + +const stakingContract = "0x6413707acd0eF29E54e4f7eE931bb00575868eA4"; +const PINKAV = "0xE5274E38E91b615D8822e8512a29A16FF1B9C4Af"; +const config = { + kava: { lendingPool: "0x11C3D91259b1c2Bd804344355C6A255001F7Ba1e", fromBlock: 5281411, }, +}; + +async function getTokens(api) { + const { lendingPool, fromBlock } = config[api.chain] + const logs = await getLogs({ + api, + target: lendingPool, + topics: ['0x9f8f649e3f624ae845ed20c597f2841f852ba62903a53736c2b36d67869ca919'], + fromBlock, + }) + return logs.map(log => getAddress(log.topics[1])) +} + +async function tvl(_, _b, _cb, { api, }) { + const { lendingPool } = config[api.chain] + const tokens = await getTokens(api) + const bals = await api.multiCall({ abi: abi.getTotalLiquidity, calls: tokens, target: lendingPool }) + const borrows = await api.multiCall({ abi: abi.getTotalDebt, calls: tokens, target: lendingPool }) + api.addTokens(tokens, bals) + api.addTokens(tokens, borrows.map(i => i * -1)) +} + +async function borrowed(_, _b, _cb, { api, }) { + const { lendingPool } = config[api.chain] + const tokens = await getTokens(api) + const bals = await api.multiCall({ abi: abi.getTotalDebt, calls: tokens, target: lendingPool }) + api.addTokens(tokens, bals) +} + +module.exports = { + methodology: + "Counts the total tokens supplied to the lending pool and the total tokens borrowed from the lending pool.", + kava: { + staking: staking(stakingContract, PINKAV), + }, + hallmarks: [ + [1688670115, "Multichain Exploit"], +], +}; + + +Object.keys(config).forEach(chain => { + module.exports[chain] = { + ...(module.exports[chain] || {}), + tvl, borrowed, + } +}) + +const abi = { + "getSupportedAsset": "function getSupportedAsset(uint256 _index) view returns (address)", + "getTotalDebt": "function getTotalDebt(address _underlyingAsset) view returns (uint256)", + "getTotalLiquidity": "function getTotalLiquidity(address _underlyingAsset) view returns (uint256)", +} diff --git a/projects/pinkpea/index.js b/projects/pinkpea/index.js index da92779bcbe..478c0158706 100644 --- a/projects/pinkpea/index.js +++ b/projects/pinkpea/index.js @@ -1,9 +1,10 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const abi = require("./lens.json"); const { ethers } = require("ethers"); const vaultLensAddress = "0x64958a77bE17f3B840d66260CB088f4C8dB1f47C"; -const zeroAddress = "0x0000000000000000000000000000000000000000"; +const zeroAddress = ADDRESSES.null; const tokenDecimals = { "0x53ff774ebE8Bf7E03df8D73D3E9915b2Ca4eC40E": 6, @@ -47,7 +48,7 @@ async function tvl(timestamp, ethBlock, chainBlocks) { Number(ethers.utils.formatUnits(data.tokenPrice, decimal)); }); return { - "aurora:0x4988a896b1227218e4A686fdE5EabdcAbd91571f": totalTvl * 1000000, + ["aurora:" + ADDRESSES.aurora.USDT_e]: totalTvl * 1000000, }; } module.exports = { diff --git a/projects/pinkpea/lens.json b/projects/pinkpea/lens.json index b266bfd8610..d8ca904cc9d 100644 --- a/projects/pinkpea/lens.json +++ b/projects/pinkpea/lens.json @@ -1,69 +1,3 @@ { - "balanceInfoViews": - { - "inputs": [ - { - "internalType": "address[]", - "name": "vaults", - "type": "address[]" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "balanceInfoViews", - "outputs": [ - { - "components": [ - { - "internalType": "uint8", - "name": "decimal", - "type": "uint8" - }, - { - "internalType": "uint256", - "name": "balance", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "allowance", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deposited", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "vaultPerShare", - "type": "uint256" - }, - { - "internalType": "address", - "name": "vaultAddress", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tvl", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "tokenPrice", - "type": "uint256" - } - ], - "internalType": "struct BalanceInfosLens.BalanceInfo[]", - "name": "", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - } + "balanceInfoViews": "function balanceInfoViews(address[] vaults, address account) view returns (tuple(uint8 decimal, uint256 balance, uint256 allowance, uint256 deposited, uint256 vaultPerShare, address vaultAddress, uint256 tvl, uint256 tokenPrice)[])" } \ No newline at end of file diff --git a/projects/pinksale/abi.js b/projects/pinksale/abi.js index f9667e3f460..2875bdc4f0c 100644 --- a/projects/pinksale/abi.js +++ b/projects/pinksale/abi.js @@ -1,142 +1,5 @@ module.exports = { - getTotalLockCount: { - "inputs": [], - "name": "getTotalLockCount", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - getLock: { - "inputs": [ - { - "internalType": "uint256", - "name": "index", - "type": "uint256" - } - ], - "name": "getLock", - "outputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "id", - "type": "uint256" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lockDate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "unlockDate", - "type": "uint256" - } - ], - "internalType": "struct PinkLock.Lock", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - getLockAt: { - "inputs": [ - { - "internalType": "uint256", - "name": "index", - "type": "uint256" - } - ], - "name": "getLockAt", - "outputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "id", - "type": "uint256" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lockDate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "tgeDate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "tgeBps", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "cycle", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "cycleBps", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "unlockedAmount", - "type": "uint256" - }, - { - "internalType": "string", - "name": "description", - "type": "string" - } - ], - "internalType": "struct PinkLock02.Lock", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, + getTotalLockCount: "uint256:getTotalLockCount", + getLock: "function getLock(uint256 index) view returns (tuple(uint256 id, address token, address owner, uint256 amount, uint256 lockDate, uint256 unlockDate))", + getLockAt: "function getLockAt(uint256 index) view returns (tuple(uint256 id, address token, address owner, uint256 amount, uint256 lockDate, uint256 tgeDate, uint256 tgeBps, uint256 cycle, uint256 cycleBps, uint256 unlockedAmount, string description))", } \ No newline at end of file diff --git a/projects/pinksale/apiCache.js b/projects/pinksale/apiCache.js index e9eccd88f5a..4f06864a48a 100644 --- a/projects/pinksale/apiCache.js +++ b/projects/pinksale/apiCache.js @@ -2,16 +2,17 @@ const sdk = require("@defillama/sdk") const abi = require('./abi') const config = require('./config') const { getUniqueAddresses } = require('../helper/utils') -const { vestingHelper, getCache, setCache, } = require("../helper/cache"); +const { getCache, setCache, } = require("../helper/cache") +const { vestingHelper, } = require("../helper/unknownTokens") -const project = 'pinksale' +const project = 'bulky/pinksale' module.exports = {} Object.keys(config).forEach(chain => { module.exports[chain] = { tvl: async (timestamp, _block, { [chain]: block }) => { - const cache = getCache(project, chain) || { vaults: {} } + const cache = await getCache(project, chain) || { vaults: {} } const balances = {} const { vaults, blacklist, log_coreAssetPrices, log_minTokenValue, } = config[chain] for (const vault of vaults) { @@ -51,7 +52,7 @@ Object.keys(config).forEach(chain => { log_coreAssetPrices, log_minTokenValue, }) - setCache(project, chain, cache) + await setCache(project, chain, cache) Object.entries(balance).forEach(([token, bal]) => sdk.util.sumSingleBalance(balances, token, bal)) } diff --git a/projects/pinksale/config.js b/projects/pinksale/config.js index 2f7c7f02e42..1e6931cb9bc 100644 --- a/projects/pinksale/config.js +++ b/projects/pinksale/config.js @@ -32,6 +32,9 @@ module.exports = { '0x33d4cC8716Beb13F814F538Ad3b2de3b036f5e2A', '0x71B5759d73262FBb223956913ecF4ecC51057641', ], + blacklist: [ + '0xd626661e2d4f93a1c4122d386fa9ea0f62b5ab0b', + ], }, polygon: { vaults: [ diff --git a/projects/pinkswap/abi.json b/projects/pinkswap/abi.json index 9eb3926cf12..20c2adfc838 100644 --- a/projects/pinkswap/abi.json +++ b/projects/pinkswap/abi.json @@ -1,38 +1,4 @@ { - "allPairs": { - "constant": true, - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "allPairs", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "allPairsLength": { - "constant": true, - "inputs": [], - "name": "allPairsLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } + "allPairs": "function allPairs(uint256) view returns (address)", + "allPairsLength": "uint256:allPairsLength" } \ No newline at end of file diff --git a/projects/pinkswap/index.js b/projects/pinkswap/index.js index 85af1529f8d..c8443974675 100644 --- a/projects/pinkswap/index.js +++ b/projects/pinkswap/index.js @@ -7,7 +7,6 @@ const masterChef = '0xe981676633dCf0256Aa512f4923A7e8DA180C595' module.exports = { bsc: { tvl: getUniTVL({ - chain: 'bsc', factory: FACTORY, useDefaultCoreAssets: true, }), diff --git a/projects/pinnako/index.js b/projects/pinnako/index.js new file mode 100644 index 00000000000..05273454765 --- /dev/null +++ b/projects/pinnako/index.js @@ -0,0 +1,17 @@ +const { sumTokensExport } = require('../helper/unwrapLPs') +const ADDRESSES = require('../helper/coreAssets.json') + +module.exports = { + era: { + tvl: sumTokensExport({ + owner: '0x87A43dfAB5068c9Ae2f75da2906559bc9A71b42d', + tokens: [ + ADDRESSES.era.WETH, + ADDRESSES.era.WBTC, + ADDRESSES.era.USDC, + ADDRESSES.era.USDT, + ] + }), + staking: sumTokensExport({ owner: '0x2A283C805D11ad77161Be0c503805a2b8Bc7Fd84', tokens: ['0xf8C6dA1bbdc31Ea5F968AcE76E931685cA7F9962'] }), + }, +} diff --git a/projects/pippifinance/abi.json b/projects/pippifinance/abi.json index 1a9195302cd..e2b89b8c850 100644 --- a/projects/pippifinance/abi.json +++ b/projects/pippifinance/abi.json @@ -1,49 +1,4 @@ { - "poolInfo": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "poolInfo", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "lpToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "allocPoint", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastRewardBlock", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accWardenPerShare", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "poolLength": { - "inputs": [], - "name": "poolLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } + "poolInfo": "function poolInfo(uint256) view returns (address lpToken, uint256 allocPoint, uint256 lastRewardBlock, uint256 accWardenPerShare)", + "poolLength": "uint256:poolLength" } \ No newline at end of file diff --git a/projects/pippifinance/index.js b/projects/pippifinance/index.js index 4df97f7093d..4fbb2e01cf8 100644 --- a/projects/pippifinance/index.js +++ b/projects/pippifinance/index.js @@ -5,8 +5,8 @@ const PIPPI_FACTORY = "0x979efE7cA072b72d6388f415d042951dDF13036e"; module.exports = { heco: { tvl: getUniTVL({ - chain: 'heco', factory: PIPPI_FACTORY, + useDefaultCoreAssets: true, }), }, }; \ No newline at end of file diff --git a/projects/pirex/abi.json b/projects/pirex/abi.json new file mode 100644 index 00000000000..56d93708cea --- /dev/null +++ b/projects/pirex/abi.json @@ -0,0 +1,13 @@ +{ + "balances": { + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "balances", + "outputs": [ + { "internalType": "uint112", "name": "locked", "type": "uint112" }, + { "internalType": "uint112", "name": "boosted", "type": "uint112" }, + { "internalType": "uint32", "name": "nextUnlockIndex", "type": "uint32" } + ], + "stateMutability": "view", + "type": "function" + } +} diff --git a/projects/pirex/index.js b/projects/pirex/index.js index ec0c06f91e1..47fa8fbbaeb 100644 --- a/projects/pirex/index.js +++ b/projects/pirex/index.js @@ -1,24 +1,61 @@ -const sdk = require('@defillama/sdk') +const ADDRESSES = require('../helper/coreAssets.json') +const sdk = require("@defillama/sdk"); +const abi = require("./abi.json"); -const CVX = '0x4e3fbd56cd56c3e72c1403e103b45db9da5b9d2b' -const pxCVX = '0xbce0cf87f513102f22232436cca2ca49e815c3ac' +const PirexCVX = "0x35A398425d9f1029021A92bc3d2557D42C8588D7"; +const pxGMX = "0x9a592b4539e22eeb8b2a3df679d572c7712ef999"; +const pxGLP = "0x0eac365e4d7de0e293078bd771ba7d0ba9a4c892" +const GMX = ADDRESSES.arbitrum.GMX; +const GLP = "0x4277f8F2c384827B5273592FF7CeBd9f2C1ac258"; +const BTRFLY = "0xc55126051B22eBb829D00368f4B12Bde432de5Da"; +const pxBTRFLY = "0x10978Db3885bA79Bf1Bc823E108085FB88e6F02f"; -async function tvl(timestamp, block, chainBlocks){ - const balances = {} - const pxCVXSupply = await sdk.api.erc20.totalSupply({ - target: pxCVX, - chain: 'ethereum', - block: chainBlocks['ethereum'] - }).then(result => result.output) - sdk.util.sumSingleBalance(balances, CVX, pxCVXSupply) +async function ethereum(ts, block, _, { api }) { + const balances = {}; + const chain = "ethereum"; - return balances + const { locked: lockedCVX } = await api.call({ + abi: abi.balances, + target: ADDRESSES.ethereum.vlCVX, + params: [PirexCVX], + }); + const { output: pxBTRFLYSupply } = await sdk.api.erc20.totalSupply({ + target: pxBTRFLY, + chain + }); + + sdk.util.sumSingleBalance(balances, ADDRESSES.ethereum.CVX, lockedCVX); + sdk.util.sumSingleBalance(balances, BTRFLY, pxBTRFLYSupply, chain); + + return balances; +} + +async function arbitrum() { + const balances = {}; + const chain = "arbitrum"; + + const { output: pxGMXSupply } = await sdk.api.erc20.totalSupply({ + target: pxGMX, + chain, + }); + const { output: pxGLPSupply } = await sdk.api.erc20.totalSupply({ + target: pxGLP, + chain, + }); + + sdk.util.sumSingleBalance(balances, GMX, pxGMXSupply, chain); + sdk.util.sumSingleBalance(balances, GLP, pxGLPSupply, chain); + + return balances; } module.exports = { - timetravel: true, - methodology: "tvl = Total CVX locked in Pirex", - ethereum:{ - tvl - }, -} \ No newline at end of file + timetravel: true, + methodology: "TVL = Total value of tokens locked in Pirex Vaults", + ethereum: { + tvl: ethereum, + }, + arbitrum: { + tvl: arbitrum, + }, +}; diff --git a/projects/pizza/index.js b/projects/pizza/index.js index 776afc57e80..8d1fd73befe 100644 --- a/projects/pizza/index.js +++ b/projects/pizza/index.js @@ -14,7 +14,9 @@ async function fetch() { module.exports = { methodology: `${lendingMarket}. Pizza TVL is achieved by making a call to its Pizza API V2.`, eos: { - fetch: eos + tvl: () => 0, }, - fetch + hallmarks: [ + [Math.floor(new Date('2023-02-16')/1e3), 'Product is winding down'], + ], } diff --git a/projects/planet-blue/index.js b/projects/planet-blue/index.js index c4f54a947c7..576e5cb5e95 100644 --- a/projects/planet-blue/index.js +++ b/projects/planet-blue/index.js @@ -5,7 +5,6 @@ module.exports = { bsc: { tvl: getUniTVL({ factory: '0xa053582601214FEb3778031a002135cbBB7DBa18', - chain: 'bsc', useDefaultCoreAssets: false }) }, diff --git a/projects/planet-finance/abi.json b/projects/planet-finance/abi.json index 7916d1abc2c..9afa66b9bb3 100644 --- a/projects/planet-finance/abi.json +++ b/projects/planet-finance/abi.json @@ -1,98 +1,9 @@ { - "wantLockedTotal": { - "inputs": [], - "name": "wantLockedTotal", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - "poolLength": { - "inputs": [], - "name": "poolLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "poolInfo": { - "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "name": "poolInfo", - "outputs": [ - { "internalType": "contract IERC20", "name": "want", "type": "address" }, - { "internalType": "uint256", "name": "allocPoint", "type": "uint256" }, - { - "internalType": "uint256", - "name": "lastRewardBlock", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accAQUAPerShare", - "type": "uint256" - }, - { "internalType": "address", "name": "strat", "type": "address" } - ], - "stateMutability": "view", - "type": "function" - }, - "totalSupply":{ - "constant": true, - "inputs": [], - "name": "totalSupply", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "exchangeRateStored":{ - "constant": true, - "inputs": [], - "name": "exchangeRateStored", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "decimals":{ - "constant": true, - "inputs": [], - "name": "decimals", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "balanceOfGtoken": { - "inputs":[], - "name":"balanceOfGtoken", - "outputs":[ - { - "internalType":"uint256", - "name":"", - "type":"uint256" - } - ], - "stateMutability":"view", - "type":"function" - } - } - - - + "wantLockedTotal": "uint256:wantLockedTotal", + "poolLength": "uint256:poolLength", + "poolInfo": "function poolInfo(uint256) view returns (address want, uint256 allocPoint, uint256 lastRewardBlock, uint256 accAQUAPerShare, address strat)", + "totalSupply": "uint256:totalSupply", + "exchangeRateStored": "uint256:exchangeRateStored", + "decimals": "uint8:decimals", + "balanceOfGtoken": "uint256:balanceOfGtoken" +} \ No newline at end of file diff --git a/projects/planet-finance/index.js b/projects/planet-finance/index.js index fc55beafa12..4b6b0b38149 100644 --- a/projects/planet-finance/index.js +++ b/projects/planet-finance/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); @@ -6,14 +7,14 @@ const { getPoolInfo } = require("../helper/masterchef.js"); const { transformBscAddress } = require("../helper/portedTokens"); const replacements = { - "0xa8Bb71facdd46445644C277F9499Dd22f6F0A30C": - "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c", //beltBNB -> wbnb - "0x9cb73F20164e399958261c289Eb5F9846f4D1404": - "0x55d398326f99059ff775485246999027b3197955", // 4belt -> usdt - "0x51bd63F240fB13870550423D208452cA87c44444": - "0x7130d2a12b9bcbfae4f2634d864a1ee1ce3ead9c", //beltBTC-> - "0xAA20E8Cb61299df2357561C2AC2e1172bC68bc25": - "0x2170ed0880ac9a755fd29b2688956bd959f933f8", //beltETH-> + [ADDRESSES.bsc.beltBNB]: + ADDRESSES.bsc.WBNB, //beltBNB -> wbnb + [ADDRESSES.bsc.Belt4]: + ADDRESSES.bsc.USDT, // 4belt -> usdt + [ADDRESSES.bsc.beltBTC]: + ADDRESSES.bsc.BTCB, //beltBTC-> + [ADDRESSES.bsc.beltETH]: + ADDRESSES.bsc.ETH, //beltETH-> }; // liquidity pools @@ -72,8 +73,8 @@ async function tvl(timestamp, ethBlock, chainBlocks) { transform(addr), poolTvl.output[i].output ); - }; - }; + } + } await unwrapUniswapLPs( balances, @@ -84,7 +85,7 @@ async function tvl(timestamp, ethBlock, chainBlocks) { ); return balances; -}; +} // node test.js projects/planet-finance/index.js diff --git a/projects/planet-green/index.js b/projects/planet-green/index.js index 03948997fd2..ecc94e63a85 100644 --- a/projects/planet-green/index.js +++ b/projects/planet-green/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const { compoundExports } = require("../helper/compound"); const { staking } = require("../helper/staking.js"); @@ -9,20 +10,21 @@ const compoundTVL1 = compoundExports( '0xF54f9e7070A1584532572A6F640F09c606bb9A83', 'bsc', '0x24664791B015659fcb71aB2c9C0d56996462082F', - '0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c' + ADDRESSES.bsc.WBNB ) const compoundTVL2 = compoundExports( '0x1e0C9D09F9995B95Ec4175aaA18b49f49f6165A3', 'bsc', '0x190354707Ad8221bE30bF5f097fa51C9b1EbdB29', - '0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c' + ADDRESSES.bsc.WBNB ) // node test.js projects/green-planet/index.js module.exports = mergeExports([ - -{ bsc: compoundTVL1, }, +{methodology: "Counts the tokens locked in the contracts to be used as collateral to borrow or to earn yield. Borrowed coins are not counted towards the TVL, so only the coins actually locked in the contracts are counted. There's multiple reasons behind this but one of the main ones is to avoid inflating the TVL through cycled lending.. TVL is calculated by getting the market addresses from comptroller and calling the getCash() on-chain method to get the amount of tokens locked in each of these addresses, then we get the price of each token from coingecko."}, +{ bsc: { + tvl: compoundTVL1.tvl +}, }, { bsc: compoundTVL2, }, - ]); \ No newline at end of file diff --git a/projects/platypus-finance/constants.js b/projects/platypus-finance/constants.js deleted file mode 100644 index f5de0aa686b..00000000000 --- a/projects/platypus-finance/constants.js +++ /dev/null @@ -1,261 +0,0 @@ -/** - * lp token addresses - */ -// Main -const MAIN_DAIe_LP = "0xc1Daa16E6979C2D1229cB1fd0823491eA44555Be"; -const MAIN_USDC_LP = "0xAEf735B1E7EcfAf8209ea46610585817Dc0a2E16"; -const MAIN_USDCe_LP = "0x909B0ce4FaC1A0dCa78F8Ca7430bBAfeEcA12871"; -const MAIN_USDT_LP = "0x776628A5C37335608DD2a9538807b9bba3869E14"; -const MAIN_USDTe_LP = "0x0D26D103c91F63052Fbca88aAF01d5304Ae40015"; -const MAIN_MIM_LP = "0x6220BaAd9D08Dee465BefAE4f82ee251cF7c8b82"; -const MAIN_BUSD_LP = "0xe23F8CCDeB4e8Ce5d9fE76782718cD85D12689C8"; - -// Alt: FRAX - USDC -const ALT_USDC_FRAX_LP = "0x035D7D7F209B5d18e2AB5C2072E85B32e1D43760"; -const ALT_FRAX_LP = "0x6FD4b4c38ED80727EcD0d58505565F9e422c965f"; -// Alt: UST - USDC -const ALT_USDC_UST_LP = "0xFC95481F79eC965A535Ed8cef4630e1dd308d319"; -const ALT_UST_LP = "0xc7388D98Fa86B6639d71A0A6d410D5cDfc63A1d0"; -// Alt: MIM - USDC -const ALT_USDC_MIM_LP = "0x4E5704991b43C1D33b9Ccd1BC33B211bf068385A"; -const ALT_MIM_LP = "0xF01cEA00598d87Cb9792a01B040d04b0bd8Ca781"; -// Alt: YUSD - USDC -const ALT_USDC_YUSD_LP = "0x4b851118a4A4948799f24d0CBE17FA3dad09e2D5"; -const ALT_YUSD_LP = "0x7716307350c0819eD05C3e7f6c478b27CAED5361"; -// Alt: sAVAX - WAVAX -const ALT_WAVAX_SAVAX_LP = "0xC73eeD4494382093C6a7C284426A9a00f6C79939"; -const ALT_SAVAX_LP = "0xA2A7EE49750Ff12bb60b407da2531dB3c50A1789"; -// Alt: yyAVAX - WAVAX -const ALT_WAVAX_YYAVAX_LP = "0x12141b8FD20b4bBdd5F4e911bF91575258A3eABD"; -const ALT_YYAVAX_LP = "0x3BEB0D3DB537b79D377131Ce81950B683d382Ec9"; -// Alt: BTC.b - WBTC.e -const ALT_BTCb_LP = "0x209a0399A2905900C0d1a9a382fe23e37024dC84"; -const ALT_WBTCe_LP = "0xc09c12093b037866Bf68C9474EcDb5113160fBcE"; -// Alt: USDC - MONEY -const ALT_USDC_MONEY_LP = "0x551C259Bf4D88edFdAbb04179342a73dAa759583"; -const ALT_MONEY_LP = "0xE08947eE864Af325D9F98743B3b905875Ae0Ec99"; - -// FACTORY: USDC - TSD -const FACTORY_USDC_TSD_LP = "0x979702f708dd794A0e5E616E89C1656a2C55d681"; -const FACTORY_TSD_LP = "0x027A24Fa0168DA4fC7AF9Bf5331D42692889AFaa"; -// FACTORY: USDC - H2O -const FACTORY_USDC_H2O_LP = "0xd78d5f6A5bF62a88212203077D1A28F812307145"; -const FACTORY_H2O_LP = "0x4f734D89531b6c9A1242C196297316E928AEeFBa"; -// FACTORY: USDC - MAI -const FACTORY_USDC_MAI_LP = "0x4bc279727585b80A2a6a64498Ae67E2db1D9fAdF"; -const FACTORY_MAI_LP = "0xb49626bB9F93F9c6466d67dc80F2f33B4162E416"; -// FACTORY: USDC - USX -const FACTORY_USDC_USX_LP = "0x6689C9Eb9a8A0Dd8BbD0935Ce0cD7FeD72E8667E"; -const FACTORY_USX_LP = "0x2DebC993c5f9Cac766Efa3EdCb1b6e40aDb4F6E2"; -/** - * token addresses - */ -const DAIe = "0xd586e7f844cea2f87f50152665bcbc2c279d8d70"; -const USDC = "0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E"; -const USDCe = "0xa7d7079b0fead91f3e65f86e8915cb59c1a4c664"; -const USDT = "0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7"; -const USDTe = "0xc7198437980c041c805a1edcba50c1ce5db95118"; -const MIM = "0x130966628846bfd36ff31a822705796e8cb8c18d"; -const UST = "0xb599c3590F42f8F995ECfa0f85D2980B76862fc1"; -const FRAX = "0xD24C2Ad096400B6FBcd2ad8B24E7acBc21A1da64"; -const WAVAX = "0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7"; -const SAVAX = "0x2b2C81e08f1Af8835a78Bb2A90AE924ACE0eA4bE"; -const YUSD = "0x111111111111ed1D73f860F57b2798b683f2d325"; -const H2O = "0x026187BdbC6b751003517bcb30Ac7817D5B766f8"; -const TSD = "0x4fbf0429599460d327bd5f55625e30e4fc066095"; -const MONEY = "0x0f577433bf59560ef2a79c124e9ff99fca258948"; -const BTCb = "0x152b9d0FdC40C096757F570A51E494bd4b943E50"; -const WBTCe = "0x50b7545627a5162F82A992c33b87aDc75187B218"; -const MAI = "0x3B55E45fD6bd7d4724F5c47E0d1bCaEdd059263e"; -const USX = "0x853ea32391AaA14c112C645FD20BA389aB25C5e0"; -const YYAVAX = "0xF7D9281e8e363584973F946201b82ba72C965D27"; -const BUSD = "0x9C9e5fD8bbc25984B178FdCE6117Defa39d2db39"; - -module.exports = { - DAI: { - id: "dai", - addresses: [ - { - token: DAIe, - lpTokens: [MAIN_DAIe_LP], - }, - ], - }, - USDC: { - id: "usd-coin", - addresses: [ - { - token: USDC, - lpTokens: [ - MAIN_USDC_LP, - ALT_USDC_FRAX_LP, - ALT_USDC_UST_LP, - ALT_USDC_MIM_LP, - ALT_USDC_YUSD_LP, - ALT_USDC_MONEY_LP, - FACTORY_USDC_H2O_LP, - FACTORY_USDC_TSD_LP, - FACTORY_USDC_MAI_LP, - FACTORY_USDC_USX_LP, - ], - }, - ], - }, - USDCe: { - id: "usd-coin-avalanche-bridged-usdc-e", - addresses: [ - { - token: USDCe, - lpTokens: [MAIN_USDCe_LP], - }, - ], - }, - USDT: { - id: "tether", - addresses: [ - { - token: USDT, - lpTokens: [MAIN_USDT_LP], - }, - { - token: USDTe, - lpTokens: [MAIN_USDTe_LP], - }, - ], - }, - MIM: { - id: "magic-internet-money", - addresses: [ - { - token: MIM, - lpTokens: [MAIN_MIM_LP, ALT_MIM_LP], - }, - ], - }, - UST: { - id: "terrausd-wormhole", - addresses: [ - { - token: UST, - lpTokens: [ALT_UST_LP], - }, - ], - }, - FRAX: { - id: "frax", - addresses: [ - { - token: FRAX, - lpTokens: [ALT_FRAX_LP], - }, - ], - }, - WAVAX: { - id: "wrapped-avax", - addresses: [ - { - token: WAVAX, - lpTokens: [ALT_WAVAX_SAVAX_LP, ALT_WAVAX_YYAVAX_LP], - }, - ], - }, - SAVAX: { - id: "benqi-liquid-staked-avax", - addresses: [ - { - token: SAVAX, - lpTokens: [ALT_SAVAX_LP], - }, - ], - }, - YYAVAX: { - id: "yield-yak-avax", - addresses: [ - { - token: YYAVAX, - lpTokens: [ALT_YYAVAX_LP], - }, - ], - }, - YUSD: { - id: "yusd-stablecoin", - addresses: [ - { - token: YUSD, - lpTokens: [ALT_YUSD_LP], - }, - ], - }, - MONEY: { - id: "moremoney-usd", - addresses: [ - { - token: MONEY, - lpTokens: [ALT_MONEY_LP], - }, - ], - }, - TSD: { - id: "teddy-dollar", - addresses: [ - { - token: TSD, - lpTokens: [FACTORY_TSD_LP], - }, - ], - }, - H2O: { - id: "defrost-finance-h2o", - addresses: [ - { - token: H2O, - lpTokens: [FACTORY_H2O_LP], - }, - ], - }, - BTCb: { - id: "bitcoin", - addresses: [ - { - token: BTCb, - lpTokens: [ALT_BTCb_LP], - }, - ], - }, - WBTCe: { - id: "wrapped-bitcoin", - addresses: [ - { - token: WBTCe, - lpTokens: [ALT_WBTCe_LP], - }, - ], - }, - MAI: { - id: "mimatic", - addresses: [ - { - token: MAI, - lpTokens: [FACTORY_MAI_LP], - }, - ], - }, - USX: { - id: "token-dforce-usd", - addresses: [ - { - token: USX, - lpTokens: [FACTORY_USX_LP], - }, - ], - }, - BUSD: { - id: "binance-usd", - addresses: [ - { - token: BUSD, - lpTokens: [MAIN_BUSD_LP], - }, - ], - }, -}; diff --git a/projects/platypus-finance/index.js b/projects/platypus-finance/index.js index 64fd5422850..62638cab708 100644 --- a/projects/platypus-finance/index.js +++ b/projects/platypus-finance/index.js @@ -1,46 +1,47 @@ -const sdk = require("@defillama/sdk"); const { staking } = require("../helper/staking"); -const constants = require("./constants"); +const { sumTokens2 } = require("../helper/unwrapLPs"); -async function balanceOf(owner, target, block) { - const chain = "avax"; - let decimals = (await sdk.api.erc20.decimals(target, chain)).output; - let balance = ( - await sdk.api.erc20.balanceOf({ - owner, - target, - block, - chain, - }) - ).output; - return Number(balance) / 10 ** decimals; -} - -async function tvl(timestamp, ethereumBlock, chainBlocks) { - const block = chainBlocks["avax"]; - let balances = {}; +const pools = [ + "0xbe52548488992Cc76fFA1B42f3A58F646864df45", + "0x66357dcace80431aee0a7507e2e361b7e2402370", + "0x39dE4e02F76Dbd4352Ec2c926D8d64Db8aBdf5b2", + "0xB8E567fc23c39C94a1f6359509D7b43D1Fbed824", + "0x30C30d826be87Cd0A4b90855C2F38f7FcfE4eaA7", + "0x4658EA7e9960D6158a261104aAA160cC953bb6ba", + "0xC828D995C686AaBA78A4aC89dfc8eC0Ff4C5be83", + "0x81E63d0EEBA2D85609A6b206737e98e39B888F4C", + "0x91BB10D68C72d64a7cE10482b453153eEa03322C", + "0x27912AE6Ba9a54219d8287C3540A8969FF35500B", + "0x233Ba46B01d2FbF1A31bDBc500702E286d6de218", + "0x89E9EFD9614621309aDA948a761D364F0236eDEA", + "0x8b4a45da5b0705ae4f47ebefc180c099345cf57e", + "0xDeD29DF6b2193B885F45B5F5027ed405291A96C1", + "0xb3393f4e609c504da770ebc968540784cc4e016c", +]; - for (const key in constants) { - const { id, addresses } = constants[key]; - let totalBalance = 0; - for (const { token, lpTokens } of addresses) { - for (const lpToken of lpTokens) { - totalBalance += await balanceOf(lpToken, token, block); - } - } - balances[id] = totalBalance; - } +const blacklistedTokens = [] - return balances; +async function tvl(timestamp, ethereumBlock, chainBlocks, { api }) { + if (timestamp > +new Date("2023-02-17") / 1e3) blacklistedTokens.push("0xdaCDe03d7Ab4D81fEDdc3a20fAA89aBAc9072CE2") // USP was hacked + const tokensArray = await api.multiCall({ abi: "function getTokenAddresses() view returns (address[])", calls: pools}) + const tokens = tokensArray.flat() + const calls = tokensArray.map((t, i)=> t.map((token) => ({ target: pools[i], params: token }))).flat() + + const owners = await api.multiCall({ abi:"function assetOf(address) view returns (address)", calls}) + tokens.push('0xb599c3590f42f8f995ecfa0f85d2980b76862fc1') + owners.push('0xc7388d98fa86b6639d71a0a6d410d5cdfc63a1d0') + return sumTokens2({ api, tokensAndOwners2: [tokens, owners], blacklistedTokens }); } module.exports = { - avax:{ + avax: { tvl, staking: staking( "0x5857019c749147eee22b1fe63500f237f3c1b692", "0x22d4002028f537599be9f666d1c4fa138522f9c8", - "avax" ), }, + hallmarks: [ + [Math.floor(new Date('2023-02-17') / 1e3), 'Protocol was hacked for $8.5m'], + ], }; diff --git a/projects/plenty/index.js b/projects/plenty/index.js index 920b6de3bcf..a7b90f1d524 100644 --- a/projects/plenty/index.js +++ b/projects/plenty/index.js @@ -1,46 +1,20 @@ -const axios = require('axios') const { sumTokens2, } = require('../helper/chain/tezos') +const { getConfig } = require("../helper/cache") async function tvl() { return sumTokens2({ owners: await getDexes(), includeTezos: true, }) } -async function staking() { - return sumTokens2({ owners: ['KT1PxkrCckgh5fA5v2cZEE2bX5q2RV1rv8dj'], includeTezos: false, }) -} - async function getDexes() { - // We take ts file and use regex to convert it to JSON and parse it (Yes, seriously) - const { data } = await axios.get('https://raw.githubusercontent.com/Plenty-DeFi/plenty-interface/master/src/config/config.ts') - - const a = data.slice(data.indexOf(': IConfig')) // find start of config file - - let text = a.slice(a.indexOf('{'), a.lastIndexOf('}') + 1) // find first { and last } and get all data in between - text = text.split('\n') //remove all comment lines - text = text.map(i => { - if (i.includes('// ')) return i.slice(0, i.indexOf('// ')) - if (i.includes(' //')) return i.slice(0, i.indexOf(' //')) - return i - }).join('\n') - text = text.replace(/\,(\s*[\}\]])/g, '$1') // remove trailing commas - text = text.replace(/\'/g, '"') // convert single quotation to double - text = text.replace(/(\s?)(\w+)\s*\:([^\/])/g, '$1"$2":$3') // cover keys with qoutes, eg. key1: "value" -> "key1":"value" - const config = JSON.parse(text) - const dexSet = new Set() - Object.values(config.AMM.mainnet).forEach(t => { - Object.values(t.DEX_PAIRS || {}).forEach(pair => { - dexSet.add(pair.contract) - }) - }) - const dexes = [...dexSet] - return dexes + const data = await getConfig('tezos/plenty', "https://config.mainnet.plenty.network/pools") + return Object.keys(data) } module.exports = { timetravel: false, misrepresentedTokens: true, + start: 1672531200, tezos: { - staking, tvl, }, } \ No newline at end of file diff --git a/projects/pls2e/index.js b/projects/pls2e/index.js index d86a30a5374..5a605b75ef6 100644 --- a/projects/pls2e/index.js +++ b/projects/pls2e/index.js @@ -5,7 +5,6 @@ module.exports = { bsc: { tvl: getUniTVL({ factory: '0x0944AB692786D9104AE9a29778285c41C33c0415', - chain: 'bsc', useDefaultCoreAssets: true }) }, diff --git a/projects/pluto/index.js b/projects/pluto/index.js index 363b28cede5..c35c72c81d1 100644 --- a/projects/pluto/index.js +++ b/projects/pluto/index.js @@ -1,10 +1,2 @@ -const { wavesAdapter } = require('../helper/chain/wavesAdapter') - -const endpoint = "http://51.158.191.108:8002/api/v1/history/pluto" - -module.exports = { - timetravel: false, - waves: { - tvl: wavesAdapter(endpoint, item => item.totalLocked) - } -} \ No newline at end of file +const { wavesExport } = require('../helper/chain/wavesAdapter') +module.exports = wavesExport("/pluto", item => item.totalLocked) \ No newline at end of file diff --git a/projects/plutusDAO/index.js b/projects/plutusDAO/index.js index 61322bc71f8..05c2097e748 100644 --- a/projects/plutusDAO/index.js +++ b/projects/plutusDAO/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const { staking, } = require("../helper/staking"); const { sumUnknownTokens } = require('../helper/unknownTokens'); @@ -13,7 +14,7 @@ const plsJones = "0xe7f6C3c1F0018E4C08aCC52965e5cbfF99e34A44"; const plsJonesFarm = "0x23B87748b615096d1A0F48870daee203A720723D"; const plsSpa = "0x0D111e482146fE9aC9cA3A65D92E65610BBC1Ba6"; const plsSpaFarm = "0x73e7c78E8a85C074733920f185d1c78163b555C8"; -const plvGlpToken = "0x5326E71Ff593Ecc2CF7AcaE5Fe57582D6e74CFF1"; +const plvGlpToken = ADDRESSES.arbitrum.plvGLP; const plgGlpPlutusChef = "0x4E5Cf54FdE5E1237e80E87fcbA555d829e1307CE"; const dpxPlsDpxMasterChef = "0xA61f0d1d831BA4Be2ae253c13ff906d9463299c2"; @@ -39,7 +40,13 @@ const plutusStakingContracts = [ async function tvl(ts, _block, {[chain]: block}) { const balances = {} const { output: glpBal } = await sdk.api.erc20.balanceOf({ target: plvGlpToken, owner: plgGlpPlutusChef, chain, block, }) - sdk.util.sumSingleBalance(balances, 'arbitrum:0x4277f8F2c384827B5273592FF7CeBd9f2C1ac258', glpBal) // sun as GLP + sdk.util.sumSingleBalance(balances, 'arbitrum:0x4277f8F2c384827B5273592FF7CeBd9f2C1ac258', glpBal) // sum as GLP + + const { output: plvGlpSupply } = await sdk.api.erc20.totalSupply({target: plvGlpToken, chain, block}); + + sdk.util.sumSingleBalance(balances, 'arbitrum:0x4277f8F2c384827B5273592FF7CeBd9f2C1ac258', plvGlpSupply) // sum as GLP as well + + const tokensAndOwners = [ [plsDpx, plsDpxFarmV1], [plsDpx, plsDpxFarm], diff --git a/projects/pocm-staking/index.js b/projects/pocm-staking/index.js new file mode 100644 index 00000000000..cc5ff2e5511 --- /dev/null +++ b/projects/pocm-staking/index.js @@ -0,0 +1,15 @@ +const http = require("../helper/http"); + +async function staking() { + return { + 'nuls': Number((await http.get("https://pocm.nuls.io/api/pocm/info")).data.totalStaking).toFixed(0) + }; +} + +module.exports = { + timetravel: false, + nuls: { + tvl: async ()=> ({}), + staking, + } +}; diff --git a/projects/pods-yield/constants.js b/projects/pods-yield/constants.js index 31a374ddaf9..02d52087cf1 100644 --- a/projects/pods-yield/constants.js +++ b/projects/pods-yield/constants.js @@ -1,24 +1,18 @@ +const ADDRESSES = require('../helper/coreAssets.json') module.exports = { - ADDRESS_ZERO: '0x0000000000000000000000000000000000000000', + ADDRESS_ZERO: ADDRESSES.null, EXPIRATION_START_FROM: 1605000000, NETWORK_MAINNET: { id: 1, name: 'ethereum', - vaults: ['0xbab1e772d70300422312dff12daddcb60864bd41'] + vaults: [ + '0xbab1e772d70300422312dff12daddcb60864bd41', + '0x463F9ED5e11764Eb9029762011a03643603aD879', + '0x5FE4B38520e856921978715C8579D2D7a4d2274F', + '0x287f941aB4B5AaDaD2F13F9363fcEC8Ee312a969' + ] }, ABI_SHORT: { - asset: { - inputs: [], - name: 'asset', - outputs: [ - { - internalType: 'contract IERC20Metadata', - name: '', - type: 'address' - } - ], - stateMutability: 'view', - type: 'function' - } + asset: 'address:asset' } } diff --git a/projects/podsfinance/constants.js b/projects/podsfinance/constants.js index 4987fb49bbb..f9a95a18217 100644 --- a/projects/podsfinance/constants.js +++ b/projects/podsfinance/constants.js @@ -1,5 +1,6 @@ +const ADDRESSES = require('../helper/coreAssets.json') module.exports = { - ADDRESS_ZERO: '0x0000000000000000000000000000000000000000', + ADDRESS_ZERO: ADDRESSES.null, OPTION_TYPE_PUT: 0, OPTION_TYPE_CALL: 1, EXPIRATION_START_FROM: 1605000000, diff --git a/projects/poison-finance/index.js b/projects/poison-finance/index.js new file mode 100644 index 00000000000..c664c7bfdb6 --- /dev/null +++ b/projects/poison-finance/index.js @@ -0,0 +1,37 @@ +const { createIncrementArray } = require('../helper/utils'); +const { sumTokens2 } = require('../helper/unwrapLPs'); +const { staking } = require('../helper/staking'); + + +const config = { + arbitrum: { vault: '0xd5e31fc5f4a009A49312C20742DF187b35975528', token: '0x31C91D8Fb96BfF40955DD2dbc909B36E8b104Dde', stakingContract: '0xDA016d31f2B52C73D7c1956E955ae8A507b305bB', poolCount: 5 }, + bsc: { vault: '0xd5e31fc5f4a009A49312C20742DF187b35975528', token: '0x31C91D8Fb96BfF40955DD2dbc909B36E8b104Dde', stakingContract: '0x04fCB69aa48f9151741A5D238b5c3cDb2A788e05', poolCount: 5 }, +} + +const abi = { + "tokenInfo": "function tokenInfo(uint256) view returns (address stableToken, uint256 underlyingContractDecimals, bool canMint)", +} + +async function tvl(_, _b, _cb, { api, }) { + const { poolCount, vault } = config[api.chain] + const calls = createIncrementArray(poolCount) + const tokensInfo = await api.multiCall({ abi: abi.tokenInfo, calls, target: vault }) + return sumTokens2({ api, owner: vault, tokens: tokensInfo.map(i => i.stableToken) }) +} + +module.exports = {}; + +Object.keys(config).forEach(chain => { + const { token, stakingContract, } = config[chain] + module.exports[chain] = { tvl } + if (stakingContract && token) module.exports[chain].staking = staking(stakingContract, token) +}) + + + + + + + + + diff --git a/projects/polaris-finance/abi.json b/projects/polaris-finance/abi.json index ef2ce3ad0ef..2ad7168d431 100644 --- a/projects/polaris-finance/abi.json +++ b/projects/polaris-finance/abi.json @@ -1,54 +1,4 @@ { - "poolInfo": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "poolInfo", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "allocPoint", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastRewardTime", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accPolarPerShare", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "isStarted", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - "symbol": { - "inputs": [], - "name": "symbol", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - } + "poolInfo": "function poolInfo(uint256) view returns (address token, uint256 allocPoint, uint256 lastRewardTime, uint256 accPolarPerShare, bool isStarted)", + "symbol": "string:symbol" } \ No newline at end of file diff --git a/projects/polaris-finance/index.js b/projects/polaris-finance/index.js index 754200e38e5..d4f6f4aa655 100644 --- a/projects/polaris-finance/index.js +++ b/projects/polaris-finance/index.js @@ -1,44 +1,17 @@ -const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); -const { sumTokens2 } = require('../helper/unwrapLPs') -const sdk = require("@defillama/sdk"); +const { sumTokens2 } = require("../helper/unwrapLPs"); +const { onChainTvl } = require("../helper/balancer"); -const spolar = "0x9D6fc90b25976E40adaD5A3EdD08af9ed7a21729"; -const spolarRewardPool = "0xA5dF6D8D59A7fBDb8a11E23FDa9d11c4103dc49f"; -const chain = 'aurora' +const xpolar = "0xeAf7665969f1DaA3726CEADa7c40Ab27B3245993"; +const xpolarRewardPool = "0x140e8a21d08cbb530929b012581a7c7e696145ef"; +const chain = "aurora"; const sunrises = [ - "0xA452f676F109d34665877B7a7B203f2B445D7DE0", //polarSunrise + "0xA452f676F109d34665877B7a7B203f2B445D7DE0", // polarSunrise "0x203a65b3153C55B57f911Ea73549ed0b8EC82B2D", // tripolarSunrise - "0x813c989395f585115152f5D54FdD181fC19CA82a", // oldEthernalSunrise - "0x154ad27D2C8bC616A90a5eEc3e6297f9fB7aB88e", // oldOrbitalSunrise "0x37223e0066969027954a5499ea4445bB9F55b36F", // uspSunrise "0x33Fd42C929769f2C57cD68353Bff0bD7C6c51604", // ethernalSunrise "0x494E811678f84816878A6e7e333f834Be7d4f21D", // orbitalSunrise -]; - -const LPTokens = [ - [ - // polarLPTokens - "0x3fa4d0145a0b6Ad0584B1ad5f61cB490A04d8242", // POLAR-NEAR - "0xADf9D0C77c70FCb1fDB868F54211288fCE9937DF", // SPOLAR-NEAR - "0x75890912E9bb373dD0aA57a3fe9eC748Bf923915", // POLAR-STNEAR - ], - [ - // ethernalLPTokens - "0x81D77f8e86f65b9C0F393afe0FC743D888c2d4d7", // ETHERNAL-ETHEREUM - ], - [ - // orbitalLPTokens - "0x7243cB5DBae5921c78A022110645a23a38ffBA5D", // ORBITAL-WBTC - ], - [ - // tripolarLPTokens - "0x51488c4BcEEa96Ee530bC6093Bd0c00F9461fbb5", // TRIPOLAR-TRI - ], - [ - // uspLPTokens - "0xa984B8062316AFE25c86576b0478E76E65FdF564", // USP-USDC - ], + "0x5DB00aeFe6404A08802678480e953ACb32E14Eab", // binarisSunrise ]; const singleStakeTokens = [ @@ -54,54 +27,20 @@ const singleStakeTokens = [ "0x8200B4F47eDb608e36561495099a8caF3F806198", // TRIBOND ]; -const pool2Total = async (_timestamp, _ethBlock, {[chain]: block}) => { - return sumTokens2({ chain, block, owner: spolarRewardPool, tokens: LPTokens.flat(), resolveLP: true }) - let balances = {}; - let transform = (addr) => `${"aurora"}:${addr}`; - - for (let token of singleStakeTokens) { - const tokenBalance = ( - await sdk.api.abi.call({ - abi: "erc20:balanceOf", - chain: "aurora", - target: token, - params: [spolarRewardPool], - block: chainBlocks["aurora"], - }) - ).output; - - sdk.util.sumSingleBalance(balances, `aurora:${token}`, tokenBalance); - } - - for (const lp of LPTokens) { - await sumTokensAndLPsSharedOwners( - balances, - lp.map((token) => [token, true]), - [spolarRewardPool], - chainBlocks["aurora"], - "aurora", - transform - ); - } - - return balances; -}; - -const staking = async (_timestamp, _ethBlock, {[chain]: block}) => { - const tokensAndOwners = [] - sunrises.forEach(o => tokensAndOwners.push([spolar, o])) - singleStakeTokens.forEach(t => tokensAndOwners.push([t, spolarRewardPool])) - return sumTokens2({ chain, block, tokensAndOwners }) +const staking = async (_timestamp, _ethBlock, { [chain]: block }) => { + const tokensAndOwners = []; + sunrises.forEach((o) => tokensAndOwners.push([xpolar, o])); + singleStakeTokens.forEach((t) => tokensAndOwners.push([t, xpolarRewardPool])); + return sumTokens2({ chain, block, tokensAndOwners }); }; module.exports = { timetravel: true, - misrepresentedTokens: false, + misrepresentedTokens: true, methodology: "Pool2 TVL accounts for all LPs staked in Dawn, Staking TVL accounts for all tokens staked in Sunrise.", aurora: { - tvl: async () => ({}), - pool2: pool2Total, + tvl: onChainTvl('0x6985436a0E5247A3E1dc29cdA9e1D89C5b59e26b', 71729132), staking, }, }; diff --git a/projects/polkaex/index.js b/projects/polkaex/index.js index be1e58750f0..efa127ba806 100644 --- a/projects/polkaex/index.js +++ b/projects/polkaex/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { getUniTVL } = require('../helper/unknownTokens') const { stakings } = require("../helper/staking"); const { getFixBalances } = require('../helper/portedTokens'); @@ -11,42 +12,42 @@ const FACTORIES = { const NATIVE_TOKENS = { WASTAR: "0xAeaaf0e2c81Af264101B9129C00F4440cCF0F720", - WSDN: "0x0f933Dc137D21cA519ae4C7E93f87a4C8EF365Ef", - WBNB: "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c", - WETH: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2" + WSDN: ADDRESSES.shiden.WSDN, + WBNB: ADDRESSES.bsc.WBNB, + WETH: ADDRESSES.ethereum.WETH } const TOKENS = { astar: { - USDC: "0x6a2d262D56735DbA19Dd70682B39F6bE9a931D98", - USDT: "0x3795C36e7D12A8c252A20C5a7B455f7c57b60283", - DOT: "0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF", + USDC: ADDRESSES.moonbeam.USDC, + USDT: ADDRESSES.astar.USDT, + DOT: ADDRESSES.astar.DOT, WASTAR: NATIVE_TOKENS.WASTAR, }, shiden: { - // KAC: "0xb12c13e66ade1f72f71834f2fc5082db8c091358", - STND: "0x722377A047e89CA735f09Eb7CccAb780943c4CB4", - USDC: "0xfA9343C3897324496A05fC75abeD6bAC29f8A40f", - USDT: "0x818ec0A7Fe18Ff94269904fCED6AE3DaE6d6dC0b", - JPYC: "0x735aBE48e8782948a37C7765ECb76b98CdE97B0F", - BNB: "0x332730a4f6e03d9c55829435f10360e13cfa41ff", - BUSD: "0x65e66a61d0a8f1e686c2d6083ad611a10d84d97a", - ETH: "0x765277EebeCA2e31912C9946eAe1021199B39C61", + // KAC: ADDRESSES.harmony.AVAX, + STND: ADDRESSES.shiden.STND, + USDC: ADDRESSES.telos.ETH, + USDT: ADDRESSES.telos.USDC, + JPYC: ADDRESSES.shiden.JPYC, + BNB: ADDRESSES.dogechain.BUSD, + BUSD: ADDRESSES.shiden.BUSD, + ETH: ADDRESSES.shiden.ETH, WSDN: NATIVE_TOKENS.WSDN }, bsc: { - BUSD: "0xe9e7cea3dedca5984780bafc599bd69add087d56", + BUSD: ADDRESSES.bsc.BUSD, WBNB: NATIVE_TOKENS.WBNB }, ethereum: { - USDC: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", + USDC: ADDRESSES.ethereum.USDC, WETH: NATIVE_TOKENS.WETH } } const PKEX = { astar: "0x1fE622E91e54D6AD00B01917351Ea6081426764A", - shiden: "0xDC42728B0eA910349ed3c6e1c9Dc06b5FB591f98", + shiden: ADDRESSES.dogechain.MATIC, ethereum: "0xe6f143a0e0a8f24f6294ce3432ea10fad0206920", bsc: "0x68edF56289134b41C6583c0e8fc29fbD7828aCa4", polygon: "0xd13eB71515DC48a8a367D12F844e5737bab415dF" diff --git a/projects/polkamarkets/index.js b/projects/polkamarkets/index.js index a175e805692..ca7c0eea78d 100644 --- a/projects/polkamarkets/index.js +++ b/projects/polkamarkets/index.js @@ -66,7 +66,7 @@ function chainStaking(chain) { "polkamarkets", Number(polkBalance) / 1e18 ); - }; + } return balances; } diff --git a/projects/pollyfinance/index.js b/projects/pollyfinance/index.js index b03fd6cb892..a3fb8befb4b 100644 --- a/projects/pollyfinance/index.js +++ b/projects/pollyfinance/index.js @@ -1,5 +1,5 @@ -const sdk = require("@defillama/sdk"); -const {unwrapUniswapLPs} = require("../helper/unwrapLPs"); +const ADDRESSES = require('../helper/coreAssets.json') +const {sumTokens2} = require("../helper/unwrapLPs"); const polly = "0x4C392822D4bE8494B798cEA17B43d48B2308109C"; const masterchef = "0x850161bF73944a8359Bd995976a34Bb9fe30d398"; @@ -45,7 +45,7 @@ const nDefiUnderLying = [ "0xda537104d6a5edd53c6fbba9a898708e465260b6", "0x95c300e7740D2A88a44124B424bFC1cB2F9c3b89", "0xc81278a52AD0e1485B7C3cDF79079220Ddd68b7D", - "0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270", + ADDRESSES.polygon.WMATIC_2, "0x3066818837c5e6ed6601bd5a91b0762877a6b731", "0xb33eaad8d922b1083446dc23f610c2567fb5180f", "0x3AE490db48d74B1bC626400135d4616377D0109f" @@ -59,78 +59,18 @@ const nStblUnderLying = [ "0x1a13F4Ca1d028320A707D99520AbFefca3998b7F" ] -async function lpTvl(balances, chainBlocks, pools) { - let LPBalance = (await sdk.api.abi.multiCall({ - calls: pools.map(p => ({ - target: p, - params: masterchef - })), - abi: "erc20:balanceOf", - block: chainBlocks, - chain: "polygon" - })).output; - let lpPositions = []; - LPBalance.forEach(i => { - lpPositions.push({ - balance: i.output, - token: i.input.target - }); - }); - await unwrapUniswapLPs(balances, lpPositions, chainBlocks, "polygon", addr=>{ - if (addr === "0x4257ea7637c355f81616050cbb6a9b709fd72683") { - return "0x4e3fbd56cd56c3e72c1403e103b45db9da5b9d2b"; - } - else if(addr === "0x3ae490db48d74b1bc626400135d4616377d0109f") { - return "0xa1faa113cbe53436df28ff0aee54275c13b40975"; - } - else if(addr === "0x3066818837c5e6ed6601bd5a91b0762877a6b731") { - return "0x04fa0d235c4abf4bcf4787af4cf447de572ef828"; - } - return `polygon:${addr}`; - }); -} - -async function underlyingTvl(balances, chainBlocks, token, underlying) { - let underBals = (await sdk.api.abi.multiCall({ - calls: underlying.map(p => ({ - target: p, - params: token - })), - abi: "erc20:balanceOf", - block: chainBlocks, - chain: "polygon" - })).output; - underBals.forEach(i => { - let addr = i.input.target.toLowerCase(); - let balance = i.output; - if (addr === "0x4257ea7637c355f81616050cbb6a9b709fd72683") { - addr = "0x4e3fbd56cd56c3e72c1403e103b45db9da5b9d2b"; - } - else if(addr === "0x3ae490db48d74b1bc626400135d4616377d0109f") { - addr = "0xa1faa113cbe53436df28ff0aee54275c13b40975"; - } - else if(addr === "0x3066818837c5e6ed6601bd5a91b0762877a6b731") { - addr = "0x04fa0d235c4abf4bcf4787af4cf447de572ef828"; - } - else { - addr = `polygon:${addr}`; - } - sdk.util.sumSingleBalance(balances, addr, balance); - }) -} - -async function tvl(timestamp, block, chainBlocks) { +async function tvl(timestamp, block, chainBlocks, { api }) { let balances = {}; - await lpTvl(balances, chainBlocks.polygon, sushiLPs); - await underlyingTvl(balances, chainBlocks.polygon, nDefi, nDefiUnderLying); - await underlyingTvl(balances, chainBlocks.polygon, nStbl, nStblUnderLying); - return balances; + await Promise.all([ + sumTokens2({ api, owner: nDefi, tokens: nDefiUnderLying, balances, }), + sumTokens2({ api, owner: nStbl, tokens: nStblUnderLying, balances,}), + sumTokens2({ api, owner: masterchef, tokens: sushiLPs, balances,}), + ]) + return balances } -async function pool2(timestamp, block, chainBlocks) { - let balances = {}; - await lpTvl(balances, chainBlocks.polygon, pool2LPs); - return balances; +async function pool2(timestamp, block, chainBlocks, { api }) { + return sumTokens2({ api, owner: masterchef, tokens: pool2LPs}) } module.exports = { diff --git a/projects/polycat-dex/index.js b/projects/polycat-dex/index.js new file mode 100644 index 00000000000..2f924d356fc --- /dev/null +++ b/projects/polycat-dex/index.js @@ -0,0 +1,15 @@ +const { getUniTVL } = require('../helper/unknownTokens') +const { staking } = require('../helper/staking') +const factory = "0x477Ce834Ae6b7aB003cCe4BC4d8697763FF456FA"; +const tankchef = "0xfaBC099AD582072d26375F65d659A3792D1740fB"; +const paw = "0xbc5b59ea1b6f8da8258615ee38d40e999ec5d74f"; + + +module.exports = { + misrepresentedTokens: true, + methodology: "TVL are from the pools created by the factory and TVL in vaults", + polygon: { + tvl: getUniTVL({ factory, chain: 'polygon', useDefaultCoreAssets: true }), + staking: staking(tankchef, paw, 'polygon'), + } +} \ No newline at end of file diff --git a/projects/polycat/abi.json b/projects/polycat/abi.json index a186ce4a2f4..ef49f1a5a13 100644 --- a/projects/polycat/abi.json +++ b/projects/polycat/abi.json @@ -1,78 +1,7 @@ { - "poolLength": { - "inputs": [], - "name": "poolLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "poolInfo": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "poolInfo", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "want", - "type": "address" - }, - { - "internalType": "address", - "name": "strat", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "wantLockedTotal": { - "inputs": [], - "name": "wantLockedTotal", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "token0": { - "inputs": [], - "name": "token0", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "token1": { - "inputs": [], - "name": "token1", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } + "poolLength": "uint256:poolLength", + "poolInfo": "function poolInfo(uint256) view returns (address want, address strat)", + "wantLockedTotal": "uint256:wantLockedTotal", + "token0": "address:token0", + "token1": "address:token1" } \ No newline at end of file diff --git a/projects/polycat/index.js b/projects/polycat/index.js index e8c1e0f706f..0f423b4a9ca 100644 --- a/projects/polycat/index.js +++ b/projects/polycat/index.js @@ -1,183 +1,15 @@ -const sdk = require("@defillama/sdk"); -const { getUniTVL } = require('../helper/unknownTokens') -const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); +const { yieldHelper } = require('../helper/yieldHelper') const abi = require("./abi.json"); -const factory = "0x477Ce834Ae6b7aB003cCe4BC4d8697763FF456FA"; const vaultchef = "0xBdA1f897E851c7EF22CD490D2Cf2DAce4645A904"; -const tankchef = "0xfaBC099AD582072d26375F65d659A3792D1740fB"; const fish = "0x3a3df212b7aa91aa0402b9035b098891d276572b"; -const paw = "0xbc5b59ea1b6f8da8258615ee38d40e999ec5d74f"; -const WMATIC = "0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270" -const convert = { - "0x61bdd9c7d4df4bf47a4508c0c8245505f2af5b7b":"0xbb0e17ef65f82ab018d8edd776e8dd940327b28b", - "0x2c89bbc92bd86f8075d1decc58c7f4e0107f286b":"avax:0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7", - "0x4eac4c4e9050464067d673102f8e24b2fcceb350":"0xc4e15973e6ff2a35cc804c2cf9d2a1b817a8b40f", - "0x845e76a8691423fbc4ecb8dd77556cb61c09ee25":"bsc:0x0487b824c8261462f88940f97053e65bdb498446", - "0x6971aca589bbd367516d70c3d210e4906b090c96":"polygon:0xbc5b59ea1b6f8da8258615ee38d40e999ec5d74f", - "0xacd7b3d9c10e97d0efa418903c0c7669e702e4c0":"bsc:0xacd7b3d9c10e97d0efa418903c0c7669e702e4c0", - "0x3053ad3b31600074e9a90440770f78d5e8fc5a54":"bsc:0xb64e638e60d154b43f660a6bf8fd8a3b249a6a21", - "0x4a592de6899ff00fbc2c99d7af260b5e7f88d1b4":"0x6c3f90f043a72fa612cbac8115ee7e52bde6e490", - "0xe7a24ef0c5e95ffb0f6684b813a78f2a3ad7d171":"0x6c3f90f043a72fa612cbac8115ee7e52bde6e490", - "0xb4d09ff3da7f9e9a2ba029cb0a81a989fd7b8f17":"0x6c3f90f043a72fa612cbac8115ee7e52bde6e490" -} - -async function vaulttvl(timestamp, block, chainBlocks) { - const chain = "polygon"; - let balances = {}; - - await calcVaultTvl(balances, chainBlocks.polygon, vaultchef, false); - return balances; -} - -async function calcVaultTvl(balances, block, vaultchef, pool2) { - const chain = "polygon"; - let poolLength = (await sdk.api.abi.call({ - target: vaultchef, - abi: abi["poolLength"], - block, - chain - })).output; - poolLength = Number(poolLength); - - const poolInfos = (await sdk.api.abi.multiCall({ - calls: Array.from({length: poolLength}, (_, k) => ({ - target: vaultchef, - params: k - })), - abi: abi["poolInfo"], - block, - chain - })).output; - - const wantLockedTotals = (await sdk.api.abi.multiCall({ - calls: poolInfos.map(p => ({ - target: p.output.strat - })), - abi: abi["wantLockedTotal"], - block, - chain - })).output; - - let withBalance = []; - - for (let i = 0; i < poolLength; i++) { - if (Number(wantLockedTotals[i].output) === 0) continue; - withBalance.push([poolInfos[i].output.want.toLowerCase(), wantLockedTotals[i].output]); - } - - const wantSymbols = (await sdk.api.abi.multiCall({ - calls: withBalance.map(p => ({ - target: p[0] - })), - abi: "erc20:symbol", - block, - chain - })).output; - - let lps = []; - - for (let i = 0; i < withBalance.length; i++) { - const symbol = wantSymbols[i].output; - const balance = withBalance[i][1]; - const token = withBalance[i][0]; - if (token === paw || token === fish) continue; - if (symbol.endsWith("UNI-V2") || symbol.endsWith("LP")) { - lps.push([token, balance]); - continue; - } - if (pool2) continue; - if (convert[token] !== undefined) { - sdk.util.sumSingleBalance(balances, convert[token], balance); - continue; - } - sdk.util.sumSingleBalance(balances, `polygon:${token}`, balance); +module.exports = yieldHelper({ + project: 'polycat', + chain: 'polygon', + masterchef: vaultchef, + nativeToken: fish, + blacklistedTokens: ['0xd76D74DE1EF47E6A390FA53b3b11ef095d0c738c'], + abis: { + poolInfo: abi.poolInfo } - - const lpToken0 = (await sdk.api.abi.multiCall({ - calls: lps.map(p => ({ - target: p[0] - })), - abi: abi["token0"], - block, - chain - })).output; - - const lpToken1 = (await sdk.api.abi.multiCall({ - calls: lps.map(p => ({ - target: p[0] - })), - abi: abi["token1"], - block, - chain - })).output; - - let lpPositions = []; - - for (let i = 0; i < lps.length; i++) { - const token0 = lpToken0[i].output.toLowerCase(); - const token1 = lpToken1[i].output.toLowerCase(); - if (pool2) { - if (token0 === fish || token1 === fish || token0 === paw || token1 === paw) { - lpPositions.push({token: lps[i][0], balance: lps[i][1]}); - } - } - else if (!pool2) { - if (token0 !== fish && token1 !== fish && token0 !== paw && token1 !== paw) { - lpPositions.push({token: lps[i][0], balance: lps[i][1]}); - } - } - } - - await unwrapUniswapLPs(balances, lpPositions, block, chain, addr=>{ - addr = addr.toLowerCase(); - if (convert[addr] !== undefined) { - return convert[addr]; - } - return `polygon:${addr}` - }) -} - -async function pool2(timestamp, block, chainBlocks) { - let balances = {}; - await calcVaultTvl(balances, chainBlocks.polygon, vaultchef, true); - return balances; -} - -async function staking(timestamp, block, chainBlocks) { - let balances = {}; - const stakedBalances = (await sdk.api.abi.multiCall({ - calls: [ - { - target: paw, - params: tankchef - }, - { - target: fish, - params: "0x640328B6BB1856dDB6a7d7BB07e5E1F3D9F50B94" - } - ], - abi: "erc20:balanceOf", - block: chainBlocks.polygon, - chain: "polygon" - })).output; - - stakedBalances.forEach(p => { - sdk.util.sumSingleBalance(balances, `polygon:${p.input.target}`, p.output); - }); - return balances; -} - -module.exports = { - misrepresentedTokens: true, - methodology: "TVL are from the pools created by the factory and TVL in vaults", - polygon: { - tvl: sdk.util.sumChainTvls([ - getUniTVL({ factory, chain: 'polygon', useDefaultCoreAssets: true }), - vaulttvl]), - pool2, - staking - } -} - - +}) diff --git a/projects/polydex/index.js b/projects/polydex/index.js index aeb4423f6d8..e905ee63810 100644 --- a/projects/polydex/index.js +++ b/projects/polydex/index.js @@ -1,16 +1,10 @@ -const {calculateUniTvl} = require('../helper/calculateUniTvl.js') -const {transformPolygonAddress} = require('../helper/portedTokens') +const {uniTvlExport} = require('../helper/calculateUniTvl.js') const FACTORY = '0xEAA98F7b5f7BfbcD1aF14D0efAa9d9e68D82f640'; -async function tvl(_, ethBlock, chainBlocks) { - const transformPolygon = await transformPolygonAddress()// addr=>`polygon:${addr}` - const block = chainBlocks['polygon'] - const chain = 'polygon' - const balances = await calculateUniTvl(transformPolygon, block, chain, FACTORY, 16125888, true) - return balances -}; module.exports = { - polygon: { tvl } + polygon: { + tvl: uniTvlExport(FACTORY, 'polygon', true), + } }; diff --git a/projects/polygon/index.js b/projects/polygon/index.js index bc96cdaced9..d8c647dba2e 100644 --- a/projects/polygon/index.js +++ b/projects/polygon/index.js @@ -1,34 +1,28 @@ -const sdk = require('@defillama/sdk'); -const { default: axios } = require('axios') -const BigNumber = require("bignumber.js"); +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens2 } = require('../helper/unwrapLPs') async function tvl(_, block) { - const etherAddress = '0x0000000000000000000000000000000000000000' + const etherAddress = ADDRESSES.null const posEtherPredicate = '0x8484Ef722627bf18ca5Ae6BcF031c23E6e922B30' const posERC20Predicate = '0x40ec5B33f54e0E8A33A975908C5BA1c14e5BbbDf' const plasmaDepositManager = '0x401F6c983eA34274ec46f84D70b31C151321188b' - const maticToken = '0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0' + const maticToken = ADDRESSES.ethereum.MATIC const stakeManager = '0x5e3Ef299fDDf15eAa0432E6e66473ace8c13D908' - const PoSMappedTokenList = 'https://api.bridge.matic.network/api/tokens/pos/erc20' - const PlasmaMappedTokenList = 'https://api.bridge.matic.network/api/tokens/plasma/erc20' - - let balances = { } const toa = [ [etherAddress, posEtherPredicate] ] const erc20Tokens = [ - '0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0', - '0x6b175474e89094c44da98b954eedeac495271d0f', + ADDRESSES.ethereum.MATIC, + ADDRESSES.ethereum.DAI, '0x3F382DbD960E3a9bbCeaE22651E88158d2791550', - '0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9', - '0x514910771af9ca656af840dff83e8264ecf986ca', + ADDRESSES.ethereum.AAVE, + ADDRESSES.ethereum.LINK, '0xaaaebe6fe48e54f431b0c390cfaf0b017d09d42d', - '0xD533a949740bb3306d119CC777fa900bA034cd52', + ADDRESSES.ethereum.CRV, '0x0f5d2fb29fb7d3cfee444a200298f468908cc942', '0xba100000625a3754423978a60c9317c58a424e3d', '0x4b520c812e8430659fc9f12f6d0c39026c83588d', @@ -38,10 +32,10 @@ async function tvl(_, block) { '0x56d811088235F11C8920698a204A5010a788f4b3', '0xcfcecfe2bd2fed07a9145222e8a7ad9cf1ccd22a', // '0x17ac188e09a7890a1844e5e65471fe8b0ccfadf3', - '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', + ADDRESSES.ethereum.USDC, '0x3845badAde8e6dFF049820680d1F14bD3903a5d0', - '0x2260fac5e5542a773aa44fbcfedf7c193bc2c599', - '0xdac17f958d2ee523a2206206994597c13d831ec7', + ADDRESSES.ethereum.WBTC, + ADDRESSES.ethereum.USDT, '0xe0cca86b254005889ac3a81e737f56a14f4a38f5', '0x09617f6fd6cf8a71278ec86e23bbab29c04353a7', '0xd2ba23de8a19316a638dc1e7a9adda1d74233368', @@ -52,7 +46,7 @@ async function tvl(_, block) { '0x16eccfdbb4ee1a85a33f3a9b21175cd7ae753db4', '0x0335a7610d817aeca1bebbefbd392ecc2ed587b8', '0xcc4ae94372da236e9b113132e0c46c68704246b9', - '0x0000000000085d4780B73119b644AE5ecd22b376', + ADDRESSES.ethereum.TUSD, '0xff56cc6b1e6ded347aa0b7676c85ab0b3d08b0fa', '0x0a6e18fb2842855c3af925310b0f50a4bfa17909', '0x8ffe40a3d0f80c0ce6b203d5cdc1a6a86d9acaea', @@ -61,7 +55,7 @@ async function tvl(_, block) { '0xe912b8bA2513D7e29b7b2E5B14398dbf77503Fb4', '0xba8a621b4a54e61c442f5ec623687e2a942225ef', '0x249e38ea4102d0cf8264d3701f1a0e39c4f2dc3b', - '0x853d955acef822db058eb8505911ed77f175b99e', + ADDRESSES.ethereum.FRAX, '0xd0cd466b34a24fcb2f87676278af2005ca8a78c4', '0x3a4f40631a4f906c2BaD353Ed06De7A5D3fCb430', '0xba100000625a3754423978a60c9317c58a424e3d', @@ -69,11 +63,11 @@ async function tvl(_, block) { '0x8b3870df408ff4d7c3a26df852d41034eda11d81', '0xb705268213d593b8fd88d3fdeff93aff5cbdcfae', '0xdb25f211ab05b1c97d595516f45794528a807ad8', - '0x1f9840a85d5af5bf1d1762f925bdaddc4201f984', + ADDRESSES.ethereum.UNI, '0xdeFA4e8a7bcBA345F687a2f1456F5Edd9CE97202', '0x3593d125a4f7849a1b059e64f4517a86dd60c95d', '0x6f40d4a6237c257fff2db00fa0510deeecd303eb', - '0x5a98fcbea516cf06857215779fd812ca3bef1b32', + ADDRESSES.ethereum.LIDO, '0xb4d930279552397bba2ee473229f89ec245bc365', '0x73968b9a57c6e53d41345fd57a6e6ae27d6cdb2f', '0x544c42fbb96b39b21df61cf322b5edc285ee7429', @@ -93,76 +87,6 @@ async function tvl(_, block) { toa.push([maticToken, plasmaDepositManager]) toa.push([maticToken, stakeManager]) return sumTokens2({ block, tokensAndOwners: toa, }) - - // -- Attempt to calculate TVL from mapped POS tokens - const posTokens = [{ target: maticToken, params: stakeManager }] - // Attempt to read list of all mapped ERC20 token addresses - // via POS bridge - const resp = await axios.get(PoSMappedTokenList) - - if (resp.status == 200 && resp.data.status == 1) { - - posTokens.push(...resp.data.tokens.filter( - // this token had no supply and was breaking the adapter - t => t.rootToken != '0xf042075ad88af3c5b9fbfbfcd9d4deace0b8543e' - ).map(v => { - - return { - target: v.rootToken, - params: posERC20Predicate - } - - }).filter(t=>t.target !== "0x7ebaa895e524d5646e7a5b686c47989b3b17aa5f")) - - } - - const lockedPoSBalances = await sdk.api.abi.multiCall({ - calls: posTokens, - abi: 'erc20:balanceOf', - block - }) - - await sdk.util.sumMultiBalanceOf(balances, lockedPoSBalances) - // -- Done with POS tokens - - // -- Attempt to calculate TVL from mapped Plasma tokens - const plasmaTokens = [] - - // Attempt to read list of all mapped ERC20 token addresses - // via Plasma bridge - const respPlasma = await axios.get(PlasmaMappedTokenList) - - if (respPlasma.status == 200 && respPlasma.data.status == 1) { - - plasmaTokens.push(...respPlasma.data.tokens.map(v => { - - return { - target: v.rootToken, - params: plasmaDepositManager - } - - })) - - } - - const lockedPlasmaBalances = await sdk.api.abi.multiCall({ - calls: plasmaTokens, - abi: 'erc20:balanceOf', - block - }) - - let wrappedETHIndex = lockedPlasmaBalances.output.findIndex(v => v.input.target == '0xa45b966996374E9e65ab991C6FE4Bfce3a56DDe8') - if (wrappedETHIndex > -1) { - - balances[etherAddress] = new BigNumber(balances[etherAddress]).plus(lockedPlasmaBalances.output[wrappedETHIndex].output) - lockedPlasmaBalances.output[wrappedETHIndex].output = '0'; - - } - - await sdk.util.sumMultiBalanceOf(balances, lockedPlasmaBalances) - // -- Done with Plasma tokens - - return balances; } module.exports = { diff --git a/projects/polynetwork/index.js b/projects/polynetwork/index.js index 7572fd0ef10..0c6297df90b 100644 --- a/projects/polynetwork/index.js +++ b/projects/polynetwork/index.js @@ -150,6 +150,10 @@ async function bitgert() { const tvl = await utils.fetchURL('https://explorer.poly.network/api/v1/GetTVLBitgert') return Number(tvl.data); } +async function dexit() { + const tvl = await utils.fetchURL('https://explorer.poly.network/api/v1/GetTVLDexit') + return Number(tvl.data); +} async function fetch() { const tvl = await utils.fetchURL('https://explorer.poly.network/api/v1/getTVLTotal') @@ -253,5 +257,8 @@ module.exports = { bitgert: { fetch: bitgert }, + dexit: { + fetch: dexit + }, fetch } \ No newline at end of file diff --git a/projects/polynomial-earn/abi.json b/projects/polynomial-earn/abi.json new file mode 100644 index 00000000000..29f3b971883 --- /dev/null +++ b/projects/polynomial-earn/abi.json @@ -0,0 +1,8 @@ +{ + "name": "string:name", + "polynomial_COLLATERAL": "address:COLLATERAL", + "polynomial_UNDERLYING": "address:UNDERLYING", + "polynomial_pendingDeposits": "uint256:pendingDeposits", + "polynomial_totalFunds": "uint256:totalFunds", + "polynomial_premiumCollected": "uint256:premiumCollected" +} \ No newline at end of file diff --git a/projects/polynomial-earn/abi2.json b/projects/polynomial-earn/abi2.json new file mode 100644 index 00000000000..307f13cd073 --- /dev/null +++ b/projects/polynomial-earn/abi2.json @@ -0,0 +1,8 @@ +{ + "name": "function name() view returns (bytes32)", + "polynomial_COLLATERAL": "address:SUSD", + "polynomial_UNDERLYING": "address:UNDERLYING", + "polynomial_totalQueuedDeposits": "uint256:totalQueuedDeposits", + "polynomial_totalFunds": "uint256:totalFunds", + "polynomial_totalQueuedWithdrawals": "uint256:totalQueuedWithdrawals" +} \ No newline at end of file diff --git a/projects/polynomial/index.js b/projects/polynomial-earn/index.js similarity index 79% rename from projects/polynomial/index.js rename to projects/polynomial-earn/index.js index 2b6672339ca..45e2e9b9834 100644 --- a/projects/polynomial/index.js +++ b/projects/polynomial-earn/index.js @@ -1,9 +1,10 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk') -const axios = require('axios') const BigNumber = require('bignumber.js') const abi = require('./abi.json') const abi2 = require('./abi2.json') const chain = 'optimism' +const { getConfig } = require('../helper/cache') const transform = t => `${chain}:${t}` // Polynomial contract addresses @@ -14,13 +15,12 @@ const polynomial_contracts = [ '0x23CB080dd0ECCdacbEB0BEb2a769215280B5087D' ] -const MAINNET_SUSD = '0x57Ab1ec28D129707052df4dF418D58a2D46d5f51' const MAINNET_SETH = '0x5e74C9036fb86BD7eCdcb084a0673EFc32eA31cb' //Optimism Synths to Mainnet Synths const L2toL1Synths = { - '0xe405de8f52ba7559f9df3c368500b6e6ae6cee49': MAINNET_SETH, - '0x8c6f28f2f1a3c87f0f938b96d27520d9751ec8d9': MAINNET_SUSD, + [ADDRESSES.optimism.sETH]: MAINNET_SETH, + [ADDRESSES.optimism.sUSD]: ADDRESSES.ethereum.sUSD, '0x298b9b95708152ff6968aafd889c6586e9169f1d': '0xfe18be6b3bd88a2d2a7f928d00292e7a9963cfc6', '0xc5db22719a06418028a40a9b5e9a7c02959d0d08': '0xbbc455cb4f1b9e4bfc4b73970d360c8f032efee6' } @@ -29,15 +29,15 @@ const contractL1Synths = { // sEth Call Selling '0x53268e841E30278EF0B9597813893fA8e4559510': MAINNET_SETH, // sETH Put Selling - '0xa11451ACD2Fbdf4Ae798F44c4227cAB9517739d7': MAINNET_SUSD, + '0xa11451ACD2Fbdf4Ae798F44c4227cAB9517739d7': ADDRESSES.ethereum.sUSD, // ETH PUT SELLING - '0xb28Df1b71a5b3a638eCeDf484E0545465a45d2Ec': MAINNET_SUSD, + '0xb28Df1b71a5b3a638eCeDf484E0545465a45d2Ec': ADDRESSES.ethereum.sUSD, // ETH CALL SELLING '0x2D46292cbB3C601c6e2c74C32df3A4FCe99b59C7': MAINNET_SETH, // GAMMA - '0x965e460bF5cb38BadA79fB2293c6304C799D0b1c': MAINNET_SUSD, + '0x965e460bF5cb38BadA79fB2293c6304C799D0b1c': ADDRESSES.ethereum.sUSD, //ETH CALL SELLING QUOTE - '0xB7b4270cFD938F4F1C111ac819e7365E8Ce0300a': MAINNET_SUSD + '0xB7b4270cFD938F4F1C111ac819e7365E8Ce0300a': ADDRESSES.ethereum.sUSD } @@ -96,28 +96,13 @@ async function tvl (timestamp, ethBlock, {[chain]: block}) { transform(collat.output), BigNumber(totalFunds[idx].output).plus(BigNumber(pendingDeposits[idx].output)).plus(BigNumber(premiumCollected[idx].output)).toFixed(0) ]) - - // Cnovert token_balances_pairs to object and aggregate similar tokens + + // Convert token_balances_pairs to object and aggregate similar tokens var balances ={}; tokens_balances_pairs.forEach( e => { - let mainnetTokenAddress = getL1SynthAddressFromL2SynthAddress(e[0]); - if( balances.hasOwnProperty(mainnetTokenAddress) ){ - balances[mainnetTokenAddress] = BigNumber(balances[mainnetTokenAddress]).plus( BigNumber(e[1]) ) - } else{ - balances[mainnetTokenAddress] = e[1]; - } - }) - const v2balance = await getV2Balance(block) - - Object.keys(balances).forEach(key => { - const v1Amount = balances[key] - const v2Amount = v2balance[key] - - if (v2Amount) { - balances[key] = BigNumber(v1Amount).plus(v2Amount) - } + let mainnetTokenAddress = getL1SynthAddressFromL2SynthAddress(e[0]) + sdk.util.sumSingleBalance(balances, mainnetTokenAddress, e[1]) }) - return balances } @@ -130,11 +115,11 @@ function tvlSumUp(contract) { // XXX: The logic needs more discussion // .minus(new BigNumber(withdrawal)) } -async function getV2Balance(block) { +async function getV2Balance(_, _1,{ optimism: block }) { const ENDPOINT = 'https://earn-api.polynomial.fi/vaults' - const response = await axios.get(ENDPOINT) + const response = await getConfig('polynomial-vaults', ENDPOINT) // Only allow contracts which sets underlying and COLLATERAL - const v2Contracts = response.data.filter(contract => contractL1Synths[contract.vaultAddress]) + const v2Contracts = response.filter(contract => contractL1Synths[contract.vaultAddress]) const multiCalls = v2Contracts.map(contract => ({ target: contract.vaultAddress})) const [{output: pendingDeposits}, {output: totalFunds}, {output: totalWithdrawals}] = await Promise.all( [ @@ -170,12 +155,7 @@ async function getV2Balance(block) { const result = Object.keys(contractTable).reduce((balance, vaultAddress) => { const amount = tvlSumUp(contractTable[vaultAddress]) const key = `ethereum:${contractL1Synths[vaultAddress]}` - const prev = balance[key] - if (key in balance) { - balance[key] = prev.plus(amount) - } else { - balance[key] = amount - } + sdk.util.sumSingleBalance(balance, key, +amount) return balance }, {}) @@ -185,7 +165,12 @@ async function getV2Balance(block) { module.exports = { optimism: { - tvl, + tvl: sdk.util.sumChainTvls([tvl, getV2Balance]), }, + hallmarks:[ + [1648728000, "Earn V1 Launch"], + [1655380800, "Earn V1 Shutdown"], + [1660132800, "Earn V2 Launch"], + ], methodology: 'Using contract methods, TVL is pendingDeposits + totalFunds + premiumCollected and the asset is UNDERLYING or COLLATERAL (put vs call) ', -} +} \ No newline at end of file diff --git a/projects/polynomial-trade/index.js b/projects/polynomial-trade/index.js new file mode 100644 index 00000000000..0589a8400e3 --- /dev/null +++ b/projects/polynomial-trade/index.js @@ -0,0 +1,24 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const axios = require('axios') + +// api +const BASE_URL = "https://perps-api-experimental.polynomial.fi/snx-perps/tvl"; +const api = axios.create({ + baseURL: BASE_URL, +}); + +async function tvl (timestamp, ethBlock) { + const perpApi = await api.get(); + return { + [`ethereum:${ADDRESSES.ethereum.sUSD}`]: perpApi.data.tvl * 1e18 + }; +} + +module.exports = { + optimism: { + tvl + }, + hallmarks:[ + [1679918400, "Trade Launch"] + ] +} \ No newline at end of file diff --git a/projects/polynomial/abi.json b/projects/polynomial/abi.json deleted file mode 100644 index b1c0f111876..00000000000 --- a/projects/polynomial/abi.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "name": {"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"}, - "polynomial_COLLATERAL": {"inputs":[],"name":"COLLATERAL","outputs":[{"internalType":"contract ERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"}, - "polynomial_UNDERLYING": {"inputs":[],"name":"UNDERLYING","outputs":[{"internalType":"contract ERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"}, - "polynomial_pendingDeposits": {"inputs":[],"name":"pendingDeposits","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}, - "polynomial_totalFunds": {"inputs":[],"name":"totalFunds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}, - "polynomial_premiumCollected": {"inputs":[],"name":"premiumCollected","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"} -} \ No newline at end of file diff --git a/projects/polynomial/abi2.json b/projects/polynomial/abi2.json deleted file mode 100644 index 7578a3cf73d..00000000000 --- a/projects/polynomial/abi2.json +++ /dev/null @@ -1,80 +0,0 @@ -{ - "name": { - "inputs": [], - "name": "name", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - "polynomial_COLLATERAL": { - "inputs": [], - "name": "SUSD", - "outputs": [ - { - "internalType": "contract ERC20", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "polynomial_UNDERLYING": { - "inputs": [], - "name": "UNDERLYING", - "outputs": [ - { - "internalType": "contract ERC20", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "polynomial_totalQueuedDeposits": { - "inputs": [], - "name": "totalQueuedDeposits", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "polynomial_totalFunds": { - "inputs": [], - "name": "totalFunds", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "polynomial_totalQueuedWithdrawals": { - "inputs": [], - "name": "totalQueuedWithdrawals", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } - } \ No newline at end of file diff --git a/projects/polyo-exchange/index.js b/projects/polyo-exchange/index.js index a47abc4a42d..3d98b3c4fc1 100644 --- a/projects/polyo-exchange/index.js +++ b/projects/polyo-exchange/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens2 } = require('../helper/unwrapLPs') // polyo Asset Address @@ -7,10 +8,10 @@ const Asset_P01_USDC = "0x17B308e859FD8ccC3D27EC290Fe5220c01188E52"; const Asset_P01_USDT = "0x2d7FA7402569e061A2218dc4e7Ac79281a8C4fB5"; // underlyingToken Address -const BUSD = "0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56"; +const BUSD = ADDRESSES.bsc.BUSD; const DAI = "0x1AF3F329e8BE154074D8769D1FFa4eE058B1DBc3"; -const USDC = "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d"; -const USDT = "0x55d398326f99059fF775485246999027B3197955"; +const USDC = ADDRESSES.bsc.USDC; +const USDT = ADDRESSES.bsc.USDT; async function tvl(timestamp, ethereumBlock, chainBlocks) { const chain = 'bsc' diff --git a/projects/polyquail/abi.json b/projects/polyquail/abi.json index 988c231efeb..d1100459566 100644 --- a/projects/polyquail/abi.json +++ b/projects/polyquail/abi.json @@ -1,41 +1,3 @@ { - "poolInfo": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "poolInfo", - "outputs": [ - { - "internalType": "contract IBEP20", - "name": "lpToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "allocPoint", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastRewardBlock", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accKWILPerShare", - "type": "uint256" - }, - { - "internalType": "uint16", - "name": "depositFeeBP", - "type": "uint16" - } - ], - "stateMutability": "view", - "type": "function" - } + "poolInfo": "function poolInfo(uint256) view returns (address lpToken, uint256 allocPoint, uint256 lastRewardBlock, uint256 accKWILPerShare, uint16 depositFeeBP)" } \ No newline at end of file diff --git a/projects/polyquity/getEntireSystemColl.abi.json b/projects/polyquity/getEntireSystemColl.abi.json deleted file mode 100644 index 15a2c6c04b3..00000000000 --- a/projects/polyquity/getEntireSystemColl.abi.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "inputs": [], - "name": "getEntireSystemColl", - "outputs": [ - { - "internalType": "uint256", - "name": "entireSystemColl", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" -} \ No newline at end of file diff --git a/projects/polyquity/index.js b/projects/polyquity/index.js index f85d9e91130..e231e6c8a25 100644 --- a/projects/polyquity/index.js +++ b/projects/polyquity/index.js @@ -1,17 +1,17 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); -const getEntireSystemCollAbi = require("./getEntireSystemColl.abi.json") -const MATIC_ADDRESS = '0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0'; +const MATIC_ADDRESS = ADDRESSES.ethereum.MATIC; const MATIC_TROVE_MANAGER_ADDRESS = "0xA2A065DBCBAE680DF2E6bfB7E5E41F1f1710e63b"; -const USDC_ADDRESS = '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48'; +const USDC_ADDRESS = ADDRESSES.ethereum.USDC; const USDC_TROVE_MANAGER_ADDRESS = "0x09273531f634391dE6be7e63C819F4ccC086F41c"; async function tvl(_, _ethBlock, chainBlocks) { const MaticBalance = ( await sdk.api.abi.call({ target: MATIC_TROVE_MANAGER_ADDRESS, - abi: getEntireSystemCollAbi, + abi: "uint256:getEntireSystemColl", block: chainBlocks['polygon'], chain: 'polygon' }) @@ -20,7 +20,7 @@ async function tvl(_, _ethBlock, chainBlocks) { const USDCBalance = ( await sdk.api.abi.call({ target: USDC_TROVE_MANAGER_ADDRESS, - abi: getEntireSystemCollAbi, + abi: "uint256:getEntireSystemColl", block: chainBlocks['polygon'], chain: 'polygon' }) diff --git a/projects/qidao/abi.json b/projects/polysynth/bps.json similarity index 87% rename from projects/qidao/abi.json rename to projects/polysynth/bps.json index e5665e6c053..b5c5e2f8814 100644 --- a/projects/qidao/abi.json +++ b/projects/polysynth/bps.json @@ -1,5 +1,5 @@ { - "getPricePerFullShare": { + "bps": { "inputs": [], "name": "getPricePerFullShare", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], diff --git a/projects/polysynth/index.js b/projects/polysynth/index.js index 289724bc69a..99aefd6f517 100644 --- a/projects/polysynth/index.js +++ b/projects/polysynth/index.js @@ -1,210 +1,29 @@ -const sdk = require("@defillama/sdk"); -const {transformPolygonAddress} = require('../helper/portedTokens'); -const { staking } = require("../helper/staking"); -const totalBalanceABI = require('./vault.json') - -const insuranceFund = "0x809F76d983768846acCbD8F8C9BDc240dC39bf8B" -const manager = "0xeC5ae95D4e9288a5C7c744F278709C56e9dC34eD" -const usdcMatic = "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174" -const wethMatic = "0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619" -const wbtcMatic = "0x1BFD67037B42Cf73acF2047067bd4F2C47D9BfD6" -const wmatic = "0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270" -const maticX = "0xfa68FB4628DFF1028CFEc22b4162FCcd0d45efb6" -const stakingAddress = "0xb88cc657d93979495045e9f204cec2eed265ed42" -const usdcAssetVaults = [ - "0x26dde715023d8acb57f6702731b569c160e2a3fb", - "0xAefA2EF8c02e39DAA310F5CAdAE3a35B198ff38B", - "0x80B3C9Cc16d2614b667E66844265395527a9b9C6" -] - -const ethAssetVaults = [ - "0xBbC6561d382bC45d81Fdb3581D76047f15825D53" -] - -const btcAssetVaults = [ - "0x3728afb2dab6A6D0507f5536F9601F0956154355" -] - -const wmaticAssetVaults = [ - "0xbBf71cbE5Cf84DEB429fEA9BC77394931230a054" -] - -const maticxAssetVaults = [ - "0x1D289fB120e06E6D58a288df1a9828a2C647fb52" -] - -//ETH mainnet -const wethMainnet = "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2" -const wbtcMainnet = "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599" -const usdcMainnet = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48" -const ethAssetVaultsMainnet = [ - "0x8c6b3A5f9E7A92fe631Ac6EEc68d507Ee2AC7eA2" -] -const btcAssetVaultsMainnet = [ - "0xBbC6561d382bC45d81Fdb3581D76047f15825D53" -] -const usdcAssetVaultsMainnet = [ - "0x2d2ac1edaf20C1f34A153167E62D1A41F11Ad940", - "0x16b9f400192dc0809431219EeBB38650b980A11F", - '0x9ca9e71830aC1d1e9c918595396f19739eC3B7b7', - '0x1D289fB120e06E6D58a288df1a9828a2C647fb52' -] - - -async function tvl(_timestamp, ethBlock, chainBlocks) { - const balances = {}; - const usdc = await (await transformPolygonAddress())(usdcMatic); - const weth = await (await transformPolygonAddress())(wethMatic); - const wbtc = await (await transformPolygonAddress())(wbtcMatic); - const trWMatic = await (await transformPolygonAddress())(wmatic); - const trMaticX = await (await transformPolygonAddress())(maticX); - - //TVL for Perpetuals - const underlyingBalances = await sdk.api.abi.multiCall({ - calls: [{ - target: usdcMatic, - params: insuranceFund - },{ - target: usdcMatic, - params: manager - },{ - target: usdcMatic, - params: stakingAddress - }], - block: chainBlocks.polygon, - abi: "erc20:balanceOf", - chain: 'polygon' - }); - - underlyingBalances.output.forEach((ub)=>{ - sdk.util.sumSingleBalance(balances, usdc, ub.output) - }) - - - //TVL for USDC DOV vaults - const totalBalances = await sdk.api.abi.multiCall({ - calls: usdcAssetVaults.map((address) => ({ - target: address - })), - abi: totalBalanceABI['totalBalance'], - block: chainBlocks.polygon, - chain: 'polygon' - }) - - totalBalances.output.forEach((totalBalanceVault)=>{ - sdk.util.sumSingleBalance(balances, usdc, totalBalanceVault.output) - }) - - //TVL for ETH DOV vaults - const totalBalancesETH = await sdk.api.abi.multiCall({ - calls: ethAssetVaults.map((address) => ({ - target: address - })), - abi: totalBalanceABI['totalBalance'], - block: chainBlocks.polygon, - chain: 'polygon' - }) - - totalBalancesETH.output.forEach((totalBalanceVault)=>{ - sdk.util.sumSingleBalance(balances, weth, totalBalanceVault.output) - }) - - //TVL for BTC DOV vaults - const totalBalancesBTC = await sdk.api.abi.multiCall({ - calls: btcAssetVaults.map((address) => ({ - target: address - })), - abi: totalBalanceABI['totalBalance'], - block: chainBlocks.polygon, - chain: 'polygon' - }) - - totalBalancesBTC.output.forEach((totalBalanceVault)=>{ - sdk.util.sumSingleBalance(balances, wbtc, totalBalanceVault.output) - }) - - //TVL for WMATIC DOV vaults - const totalBalancesWMATIC = await sdk.api.abi.multiCall({ - calls: wmaticAssetVaults.map((address) => ({ - target: address - })), - abi: totalBalanceABI['totalBalance'], - block: chainBlocks.polygon, - chain: 'polygon' - }) - - totalBalancesWMATIC.output.forEach((totalBalanceVault)=>{ - sdk.util.sumSingleBalance(balances, trWMatic, totalBalanceVault.output) - }) - - //TVL for MATICX DOV vaults - const totalBalancesMATICX = await sdk.api.abi.multiCall({ - calls: maticxAssetVaults.map((address) => ({ - target: address - })), - abi: totalBalanceABI['totalBalance'], - block: chainBlocks.polygon, - chain: 'polygon' - }) - - totalBalancesMATICX.output.forEach((totalBalanceVault)=>{ - sdk.util.sumSingleBalance(balances, trMaticX, totalBalanceVault.output) - }) - - - return balances +const { getConfig } = require('../helper/cache') +const { sumTokens2 } = require('../helper/unwrapLPs') +let _response; + +async function getVaults(chain) { + if (!_response) _response = getConfig('polysynth', 'https://fast-wren-87.hasura.app/api/rest/vaults/all/meta') + return (await _response).vault_meta_data + .filter(i => i.chain_id === chains[chain]) } -async function ethTVL(ts, ethBlock) { - const balances = {}; - - //TVL for ETH DOV vaults - const totalBalancesETH = await sdk.api.abi.multiCall({ - calls: ethAssetVaultsMainnet.map((address) => ({ - target: address - })), - abi: totalBalanceABI['totalBalance'], - block: ethBlock - }) - - totalBalancesETH.output.forEach((totalBalanceVault) => { - sdk.util.sumSingleBalance(balances, wethMainnet, totalBalanceVault.output) - }) - - //TVL for USDC DOV vaults - const totalBalances = await sdk.api.abi.multiCall({ - calls: usdcAssetVaultsMainnet.map((address) => ({ - target: address - })), - abi: totalBalanceABI['totalBalance'], - block: ethBlock - }) - - totalBalances.output.forEach((totalBalanceVault) => { - sdk.util.sumSingleBalance(balances, usdcMainnet, totalBalanceVault.output) - }) - - //TVL for BTC DOV vaults - const totalBalancesBTC = await sdk.api.abi.multiCall({ - calls: btcAssetVaultsMainnet.map((address) => ({ - target: address - })), - abi: totalBalanceABI['totalBalance'], - block: ethBlock - }) - - totalBalancesBTC.output.forEach((totalBalanceVault) => { - sdk.util.sumSingleBalance(balances, wbtcMainnet, totalBalanceVault.output) - }) - - return balances +const chains = { + ethereum: 1, + polygon: 137, + arbitrum: 42161 } -module.exports = { - ethereum: { - tvl: ethTVL - }, - polygon: { - tvl: tvl +module.exports = {}; + +Object.keys(chains).forEach(chain => { + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const vaultData = await getVaults(chain) + const vaults = vaultData.map(i => i.vault_address) + const beefys = await api.multiCall({ abi: 'address:BEEFY_VAULT', calls: vaults, permitFailure: true, }) + const tokens = vaultData.map((v, i) => beefys[i] ? beefys[i] : v.asset_address) + return sumTokens2({ api, tokensAndOwners2: [tokens, vaults] }) + } } -} \ No newline at end of file +}) \ No newline at end of file diff --git a/projects/polysynth/vault.json b/projects/polysynth/vault.json index 1b666623368..ac9d59a12a9 100644 --- a/projects/polysynth/vault.json +++ b/projects/polysynth/vault.json @@ -1,15 +1,3 @@ { - "totalBalance": { - "inputs": [], - "name": "totalBalance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } + "totalBalance": "uint256:totalBalance" } \ No newline at end of file diff --git a/projects/polytrade/index.js b/projects/polytrade/index.js new file mode 100644 index 00000000000..a9701231e62 --- /dev/null +++ b/projects/polytrade/index.js @@ -0,0 +1,35 @@ +const sdk = require('@defillama/sdk'); +const { sumTokens2 } = require('../helper/unwrapLPs') +const LENDER_POOL_CONTRACT = '0xE544a0Ca5F4a01f137AE5448027471D6a9eC9661'; +const chain = 'polygon' + +module.exports = { + methodology: 'gets the amount in liquidity pool', + start: 1657074185, + polygon: { + tvl: async (_,_b , {polygon: block}) => { + const strategy = await sdk.api2.abi.call({ + target: LENDER_POOL_CONTRACT, + abi: abis.strategy, + chain, block, + }) + const stable = await sdk.api2.abi.call({ + target: strategy, + abi: abis.stable, + chain, block, + }) + const aStable = await sdk.api2.abi.call({ + target: strategy, + abi: abis.aStable, + chain, block, + }) + return sumTokens2({ chain, block, owner: strategy, tokens: [stable, aStable ]}) + }, + } +}; + +const abis = { + strategy: "address:strategy", + stable: "address:stable", + aStable: "address:aStable", +} \ No newline at end of file diff --git a/projects/pond/index.js b/projects/pond/index.js index 899b2832cbf..31a0901b3f9 100644 --- a/projects/pond/index.js +++ b/projects/pond/index.js @@ -1,16 +1,9 @@ -const { calculateUniTvl } = require("../helper/calculateUniTvl"); +const { uniTvlExport } = require("../helper/calculateUniTvl"); const factory = "0x1d1f1A7280D67246665Bb196F38553b469294f3a"; -async function tvl (timestamp, block, chainBlocks) { - let balances = await calculateUniTvl(addr=> { - return `fuse:${addr}` - }, chainBlocks.fuse, "fuse", factory, 0, true); - return balances -} - module.exports = { fuse: { - tvl + tvl: uniTvlExport(factory, 'fuse', true), } } \ No newline at end of file diff --git a/projects/ponyswap/index.js b/projects/ponyswap/index.js new file mode 100644 index 00000000000..009a1d1de65 --- /dev/null +++ b/projects/ponyswap/index.js @@ -0,0 +1,9 @@ +const { uniTvlExport } = require("../helper/calculateUniTvl"); +module.exports = { + doublecounted: false, + timetravel: true, + start: 1678790700, + arbitrum: { + tvl: uniTvlExport("0x66020547Ce3c861dec7632495D86e1b93dA6542c", "arbitrum", true), + }, +}; \ No newline at end of file diff --git a/projects/ponytaswap/index.js b/projects/ponytaswap/index.js new file mode 100644 index 00000000000..ce038e7f9dc --- /dev/null +++ b/projects/ponytaswap/index.js @@ -0,0 +1,11 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports = { + misrepresentedTokens: true, + rpg: { + tvl: getUniTVL({ + useDefaultCoreAssets: true, + factory: '0x1589DD24f11e1e49566fE99744E7487CbcAb2d43', + }) + } +} \ No newline at end of file diff --git a/projects/poofcash/index.js b/projects/poofcash/index.js index 55342fd1f28..88105e08e6a 100644 --- a/projects/poofcash/index.js +++ b/projects/poofcash/index.js @@ -1,35 +1,36 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const tokens = [ { holder: "0x5b46A20284366F5e79D9B3e5e2FA0F5702b8C72F", // wmcUSD currency: "celo-dollar", - tokenAddress: "0x918146359264C492BD6934071c6Bd31C854EDBc3", // mcUSD + tokenAddress: ADDRESSES.celo.mcUSD, // mcUSD }, { holder: "0xD96A74081440C28E9a3c09a3256D6e0454c52E41", // wmcUSD 2 currency: "celo-dollar", - tokenAddress: "0x918146359264C492BD6934071c6Bd31C854EDBc3", // mcUSD + tokenAddress: ADDRESSES.celo.mcUSD, // mcUSD }, { holder: "0xd3D7831D502Ab85319E1F0A18109aa9aBEBC2603", // wmCELO currency: "celo", - tokenAddress: "0x7D00cd74FF385c955EA3d79e47BF06bD7386387D", // mCELO + tokenAddress: ADDRESSES.celo.mCELO, // mCELO }, { holder: "0x337ddAD7Fcb34E93a54a7B6df7C8Bae00fA91D09", // wmCELO 2 currency: "celo", - tokenAddress: "0x7D00cd74FF385c955EA3d79e47BF06bD7386387D", // mCELO + tokenAddress: ADDRESSES.celo.mCELO, // mCELO }, { holder: "0xb7e4e9329DA677969376cc76e87938563B07Ac6A", // wmcEUR currency: "celo-euro", - tokenAddress: "0xE273Ad7ee11dCfAA87383aD5977EE1504aC07568", // mcEUR + tokenAddress: ADDRESSES.celo.mCEUR, // mcEUR }, { holder: "0xAb32a0b6d427ce11a4cEf7Be174A3F291a2753E6", // wmcEUR 2 currency: "celo-euro", - tokenAddress: "0xE273Ad7ee11dCfAA87383aD5977EE1504aC07568", // mcEUR + tokenAddress: ADDRESSES.celo.mCEUR, // mcEUR }, ]; diff --git a/projects/pooltogether/abi.json b/projects/pooltogether/abi.json index 174bef5e59c..8ff2b38d43b 100644 --- a/projects/pooltogether/abi.json +++ b/projects/pooltogether/abi.json @@ -1,15 +1,3 @@ { - "accountedBalance": { - "inputs": [], - "name": "accountedBalance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } + "accountedBalance": "uint256:accountedBalance" } \ No newline at end of file diff --git a/projects/pooltogether/index.js b/projects/pooltogether/index.js index fce7323ffb3..1392e6e813b 100644 --- a/projects/pooltogether/index.js +++ b/projects/pooltogether/index.js @@ -1,8 +1,9 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const { request, gql } = require("graphql-request"); const abi = require('./abi.json') const { getChainTransform } = require("../helper/portedTokens"); -const { getBlock } = require("../helper/getBlock"); +const { getBlock } = require("../helper/http"); const { sumTokens } = require("../helper/unwrapLPs"); const { default: BigNumber } = require("bignumber.js"); @@ -89,11 +90,11 @@ async function eth(timestamp, block) { async function polygon(timestamp, block, chainBlocks) { return getChainBalances([{ id: "0x887E17D791Dcb44BfdDa3023D26F7a04Ca9C7EF4", - underlyingCollateralToken: "0xdac17f958d2ee523a2206206994597c13d831ec7" + underlyingCollateralToken: ADDRESSES.ethereum.USDT }, { id: "0xee06abe9e2af61cabcb13170e01266af2defa946", - underlyingCollateralToken: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" + underlyingCollateralToken: ADDRESSES.ethereum.USDC }], 'polygon', chainBlocks.polygon) } @@ -146,6 +147,7 @@ module.exports = { }, hallmarks:[ [1658872800, "OP Rewards Start"], + [1669615200, "OP Rewards Start"], ], methodology: `TVL is the total quantity of tokens locked in PoolTogether pools on Ethereum, Polygon, Avalanche, Optimism, Celo, and BSC` } diff --git a/projects/poopsicle/abi.json b/projects/poopsicle/abi.json index c336b461681..f907c4913bf 100644 --- a/projects/poopsicle/abi.json +++ b/projects/poopsicle/abi.json @@ -1,16 +1,3 @@ { - "totalStaked": { - "constant": true, - "inputs": [], - "name": "totalStaked", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } -} + "totalStaked": "uint256:totalStaked" +} \ No newline at end of file diff --git a/projects/popcorn/abi/basicSetIssuanceModule.json b/projects/popcorn/abi/basicSetIssuanceModule.json deleted file mode 100644 index 433b9f96639..00000000000 --- a/projects/popcorn/abi/basicSetIssuanceModule.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "inputs": [ - { - "internalType": "contract ISetToken", - "name": "_setToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_quantity", - "type": "uint256" - } - ], - "name": "getRequiredComponentUnitsForIssue", - "outputs": [ - { - "internalType": "address[]", - "name": "", - "type": "address[]" - }, - { - "internalType": "uint256[]", - "name": "", - "type": "uint256[]" - } - ], - "stateMutability": "view", - "type": "function" -} \ No newline at end of file diff --git a/projects/popcorn/abi/butterBatchProcessing.json b/projects/popcorn/abi/butterBatchProcessing.json deleted file mode 100644 index 8d35e9ac8e1..00000000000 --- a/projects/popcorn/abi/butterBatchProcessing.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "inputs": [ - { - "internalType": "address[]", - "name": "_tokenAddresses", - "type": "address[]" - }, - { - "internalType": "uint256[]", - "name": "_quantities", - "type": "uint256[]" - } - ], - "name": "valueOfComponents", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" -} \ No newline at end of file diff --git a/projects/popcorn/abi/curveMetapoolABI.json b/projects/popcorn/abi/curveMetapoolABI.json deleted file mode 100644 index aa8fab2fd24..00000000000 --- a/projects/popcorn/abi/curveMetapoolABI.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "name": "get_virtual_price", - "outputs": [ - { - "type": "uint256", - "name": "" - } - ], - "inputs": [], - "stateMutability": "view", - "type": "function", - "gas": 1011891 -} \ No newline at end of file diff --git a/projects/popcorn/abi/yearnVaultABI.json b/projects/popcorn/abi/yearnVaultABI.json deleted file mode 100644 index 1c26dbe68de..00000000000 --- a/projects/popcorn/abi/yearnVaultABI.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "stateMutability": "view", - "type": "function", - "name": "pricePerShare", - "inputs": [], - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "gas": 18195 -} \ No newline at end of file diff --git a/projects/popcorn/butter.js b/projects/popcorn/butter.js index 2082ab79227..f7a545bba85 100644 --- a/projects/popcorn/butter.js +++ b/projects/popcorn/butter.js @@ -1,7 +1,7 @@ const sdk = require('@defillama/sdk'); const { ADDRESSES } = require("./constants"); -const yearnVaultABI = require("./abi/yearnVaultABI.json") -const curveMetapoolABI = require("./abi/curveMetapoolABI.json") +const yearnVaultABI = "uint256:pricePerShare" +const curveMetapoolABI = "uint256:get_virtual_price" const { ethers } = require("ethers") async function addButterV2TVL(balances, timestamp, chainBlocks, chain = "ethereum") { diff --git a/projects/popcorn/constants.js b/projects/popcorn/constants.js index 44d0a09ec84..d223f8a2533 100644 --- a/projects/popcorn/constants.js +++ b/projects/popcorn/constants.js @@ -1,4 +1,5 @@ -const ADDRESSES = { +const ADDRESSES = require('../helper/coreAssets.json') +const ADDRESSES_ = { ethereum: { popLocker: "0xeEE1d31297B042820349B03027aB3b13a9406184", // done @@ -12,8 +13,8 @@ const ADDRESSES = { pop: "0xd0cd466b34a24fcb2f87676278af2005ca8a78c4", - usdc: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", - dai: "0x6B175474E89094C44Da98b954EedeAC495271d0F", + usdc: ADDRESSES.ethereum.USDC, + dai: ADDRESSES.ethereum.DAI, // for butter setBasicIssuanceModule: "0xd8EF3cACe8b4907117a45B0b125c68560532F94D", @@ -37,7 +38,10 @@ const ADDRESSES = { crv3EurMetapool: "0xb9446c4Ef5EBE66268dA6700D26f96273DE3d571", crvSUSDMetapool: "0xA5407eAE9Ba41422680e2e00537571bcC53efBfD", crvSUSD: "0xC25a3A3b969415c80451098fa907EC722572917F", - threeX: "0x8b97ADE5843c9BE7a1e8c95F32EC192E31A46cf3" + threeX: "0x8b97ADE5843c9BE7a1e8c95F32EC192E31A46cf3", + + vaultRegistry: '0x007318Dc89B314b47609C684260CfbfbcD412864', + }, arbitrum: { rewardsEscrow: "0x0c0991cb6e1c8456660a49aa200b71de6158b85c", @@ -46,14 +50,16 @@ const ADDRESSES = { }, polygon: { pop: "0xc5b57e9a1e7914fda753a88f24e5703e617ee50c", - usdc: "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174", + usdc: ADDRESSES.polygon.USDC, popLocker: "0xe8af04AD759Ad790Aa5592f587D3cFB3ecC6A9dA", rewardsEscrow: "0xa82cAA79F35f7d6B6f1EC1971878F3474C894565", popUsdcGelatoLp: "0xe8654f2b0a038a01bc273a2a7b7c48a76c0e58c5", arrakisPool: "0x6dE0500211bc3140409B345Fa1a5289cb77Af1e4", - arrakisPoolStaking: "0xd3836EF639A74EA7398d34c66aa171b1564BE4bc" + arrakisPoolStaking: "0xd3836EF639A74EA7398d34c66aa171b1564BE4bc", + + vaultRegistry: '0x2246c4c469735bCE95C120939b0C078EC37A08D0' }, bsc: { rewardsEscrow: "0x0C0991CB6e1c8456660A49aa200B71de6158b85C", @@ -62,5 +68,5 @@ const ADDRESSES = { } module.exports = { - ADDRESSES + ADDRESSES:ADDRESSES_ } \ No newline at end of file diff --git a/projects/popcorn/index.js b/projects/popcorn/index.js index 54d24c729f1..f058e3b3bfb 100644 --- a/projects/popcorn/index.js +++ b/projects/popcorn/index.js @@ -3,14 +3,21 @@ const { staking } = require('./staking') const { ADDRESSES } = require("./constants"); const { addButterV2TVL, addThreeXTVL } = require("./butter") const { addStakingPoolsTVL } = require("./stakingPools") +const { addVaultToTVL } = require("./vault"); + +const vaultChains = Object.keys(ADDRESSES).filter(chain => Object.keys(ADDRESSES[chain]).includes('vaultRegistry')); function getTVL(chain = undefined) { - return async (timestamp, block, chainBlocks) => { + return async (timestamp, block, chainBlocks, { api }) => { let balances = {}; if (chain && chain === 'ethereum') { await addButterV2TVL(balances, timestamp, chainBlocks, chain); await addThreeXTVL(balances, timestamp, chainBlocks, chain); } + + if (chain && vaultChains.includes(chain)) { + await addVaultToTVL(balances, api, ADDRESSES[chain].vaultRegistry); + } return balances; } } @@ -28,7 +35,7 @@ module.exports = { methodology: ``, ethereum: { staking: staking(true, [ADDRESSES.ethereum.popLocker], ADDRESSES.ethereum.pop,), - pool2: getLPTokensStakedTVL('ethereum'), + //pool2: getLPTokensStakedTVL('ethereum'), start: 12237585, tvl: getTVL('ethereum'), }, @@ -38,7 +45,7 @@ module.exports = { }, polygon: { staking: staking(true, [ADDRESSES.polygon.popLocker], ADDRESSES.polygon.pop, 'polygon'), - pool2: getLPTokensStakedTVL("polygon"), + //pool2: getLPTokensStakedTVL("polygon"), tvl: getTVL('polygon'), }, arbitrum: { diff --git a/projects/popcorn/vault.js b/projects/popcorn/vault.js new file mode 100644 index 00000000000..ee61dfb0a8c --- /dev/null +++ b/projects/popcorn/vault.js @@ -0,0 +1,17 @@ +const sdk = require('@defillama/sdk'); + +const getVaultsAbi = 'address[]:getRegisteredAddresses'; +const getAssetAbi = 'address:asset'; +const getTotalAssets = 'uint256:totalAssets'; + +async function addVaultToTVL(balances, api, vaultRegistryAddress) { + const vaultAddresses = await api.call({ target: vaultRegistryAddress, abi: getVaultsAbi }); + const assets = await api.multiCall({ abi: getAssetAbi, calls: vaultAddresses, }); + const totalAssets = await api.multiCall({ abi: getTotalAssets, calls: vaultAddresses, }); + + assets.forEach((v, i) => sdk.util.sumSingleBalance(balances, v, totalAssets[i], api.chain)) +} + +module.exports = { + addVaultToTVL +} \ No newline at end of file diff --git a/projects/popsicle/index.js b/projects/popsicle/index.js index d3fd6cf0a51..90e98b628b3 100644 --- a/projects/popsicle/index.js +++ b/projects/popsicle/index.js @@ -1,13 +1,8 @@ -const sdk = require("@defillama/sdk"); +const ADDRESSES = require('../helper/coreAssets.json') const poolInfoAbi = require("../helper/abis/masterchef.json"); -const { sumTokensAndLPsSharedOwners, sumTokens2 } = require('../helper/unwrapLPs'); +const { sumTokens2 } = require('../helper/unwrapLPs'); const { addFundsInMasterChef } = require("../helper/masterchef"); -const { - transformBscAddress, - transformFantomAddress, -} = require("../helper/portedTokens"); -const { fetchURL } = require("../helper/utils"); -const { toUSDTBalances } = require("../helper/balances"); +const { getConfig } = require('../helper/cache') const MasterChefContract = "0xbf513aCe2AbDc69D38eE847EFFDaa1901808c31c"; const ice = "0xf16e81dce15B08F326220742020379B855B87DF9"; @@ -15,84 +10,51 @@ const ice = "0xf16e81dce15B08F326220742020379B855B87DF9"; function pool2(chain) { return async (timestamp, ethBlock, chainBlocks) => { const balances = {}; - await addFundsInMasterChef( - balances, - MasterChefContract, - chainBlocks[chain], - chain, - undefined, - poolInfoAbi.poolInfo, - [ice] - ); + await addFundsInMasterChef(balances, MasterChefContract, chainBlocks[chain], chain, undefined, poolInfoAbi.poolInfo, [ice]); return balances; }; } -async function optimizerV3(time, block) { - const data = await fetchURL( - "https://analytics.back.popsicle.finance/api/v1/FragolaApy" - ); - return toUSDTBalances(data.data.reduce((total, pool) => total + pool.tvl, 0)); +const config = { + ethereum: 'https://analytics.back.popsicle.finance/api/v1/FragolaApy', + polygon: 'https://analytics.back.popsicle.finance/api/v1/polygon/FragolaApy', } -async function fantomTvl(timestamp, block, chainBlocks) { - const transform = await transformFantomAddress(); - const balances = {}; - await sumTokensAndLPsSharedOwners( - balances, - [ - ["0xddc0385169797937066bbd8ef409b5b3c0dfeb52", false], - ], - [ - "0xFDB988aF9ef9D0C430176f972bA82B98b476F3ee", - ], - chainBlocks.fantom, "fantom", transform - ); - - //wMEMO - const memo = ( - await sdk.api.abi.call({ - target: "0x0da67235dd5787d67955420c84ca1cecd4e5bb3b", - params: [ - balances["fantom:0xddc0385169797937066bbd8ef409b5b3c0dfeb52"], - ], - abi: { - inputs: [ - { internalType: "uint256", name: "_amount", type: "uint256" }, - ], - name: "wMEMOToMEMO", - outputs: [{ internalType: "uint256", name: "", type: "uint256" }], - stateMutability: "view", - type: "function", - }, - block: chainBlocks.avax, - chain: "avax", - }) - ).output; - balances["avax:0xb54f16fb19478766a268f172c9480f8da1a7c9c3"] = memo; - delete balances["fantom:0xddc0385169797937066bbd8ef409b5b3c0dfeb52"]; - - return balances; -}; +async function optimizerV3(time, block, _, {api}) { + const data = await getConfig('popsicle/'+api.chain, config[api.chain]) + const pools = data.map(i => i.fragolaAddress) + const token0s = await api.multiCall({ abi: 'address:token0', calls: pools}) + const token1s = await api.multiCall({ abi: 'address:token1', calls: pools}) + const bals = await api.multiCall({ abi: 'function usersAmounts() returns (uint256,uint256)', calls: pools}) + bals.forEach(([bal0, bal1], i) => { + api.add(token0s[i], bal0) + api.add(token1s[i], bal1) + }) +} +async function fantomTvl(timestamp, block, chainBlocks, {api}) { + return api.sumTokens({ owner: '0xFDB988aF9ef9D0C430176f972bA82B98b476F3ee', tokens: ['0xddc0385169797937066bbd8ef409b5b3c0dfeb52']}) +} -async function fantomStaking(timestamp, block, chainBlocks) { +async function fantomStaking(timestamp, block, chainBlocks, { api }) { return sumTokens2({ + api, tokensAndOwners: [ ['0xf16e81dce15b08f326220742020379b855b87df9', '0xaE2e07276A77DAdE3378046eEd92FfDE3995b0D5'], // ICE - ['0x7f620d7d0b3479b1655cefb1b0bc67fb0ef4e443', '0xBC8d95Ab498502242b41fdaD30bDFfC841f436e2'], // nICE + [ADDRESSES.fantom.nICE, '0xBC8d95Ab498502242b41fdaD30bDFfC841f436e2'], // nICE ], - chain: 'fantom', - block: chainBlocks.fantom, }) } // node test.js projects/popsicle/index.js module.exports = { - misrepresentedTokens: true, + doublecounted: true, ethereum: { pool2: pool2("ethereum"), tvl: optimizerV3, }, + polygon: { + tvl: optimizerV3, + }, bsc: { pool2: pool2("bsc"), }, diff --git a/projects/poptown/abi.json b/projects/poptown/abi.json index d5e461fecab..5c6375abac1 100644 --- a/projects/poptown/abi.json +++ b/projects/poptown/abi.json @@ -1,96 +1,6 @@ { - "pendingMlpCount": { - "inputs": [], - "name": "pendingMlpCount", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "allMlp": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "allMlp", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "uniswapPair": { - "inputs": [], - "name": "uniswapPair", - "outputs": [ - { - "internalType": "contract IUniswapV2Pair", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getMlp": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "getMlp", - "outputs": [ - { - "internalType": "address", - "name": "uniswapPair", - "type": "address" - }, - { - "internalType": "address", - "name": "submitter", - "type": "address" - }, - { - "internalType": "uint256", - "name": "liquidity", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "endDate", - "type": "uint256" - }, - { - "internalType": "enum PopMarketplace.MlpStatus", - "name": "status", - "type": "uint8" - }, - { - "internalType": "uint256", - "name": "bonusToken0", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "bonusToken1", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } + "pendingMlpCount": "uint256:pendingMlpCount", + "allMlp": "function allMlp(uint256) view returns (address)", + "uniswapPair": "address:uniswapPair", + "getMlp": "function getMlp(uint256) view returns (address uniswapPair, address submitter, uint256 liquidity, uint256 endDate, uint8 status, uint256 bonusToken0, uint256 bonusToken1)" } \ No newline at end of file diff --git a/projects/poptown/index.js b/projects/poptown/index.js index 03d7791d31f..fdcccbb9dde 100644 --- a/projects/poptown/index.js +++ b/projects/poptown/index.js @@ -46,10 +46,11 @@ const ethTvl = async (ts, block) => { }) - return sumTokens2({ block, tokensAndOwners, }) + return sumTokens2({ block, tokensAndOwners, resolveLP: true, }) }; module.exports = { + misrepresentedTokens: true, ethereum: { staking: stakings(candyFarmsContracts, POP), tvl: ethTvl, diff --git a/projects/portfinance/index.js b/projects/portfinance/index.js index 1cc1422bf94..19362999ea2 100644 --- a/projects/portfinance/index.js +++ b/projects/portfinance/index.js @@ -1,18 +1,19 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens2 } = require('../helper/solana') async function tvl() { const tokensAndOwners = [ /// Main Pool - ["EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", "8x2uay8UgrLiX8AAYyF6AkK9z91nNtN6aLwfqPkf6TAQ"], - ["Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB", "8x2uay8UgrLiX8AAYyF6AkK9z91nNtN6aLwfqPkf6TAQ"], - ["So11111111111111111111111111111111111111112", "8x2uay8UgrLiX8AAYyF6AkK9z91nNtN6aLwfqPkf6TAQ"], + [ADDRESSES.solana.USDC, "8x2uay8UgrLiX8AAYyF6AkK9z91nNtN6aLwfqPkf6TAQ"], + [ADDRESSES.solana.USDT, "8x2uay8UgrLiX8AAYyF6AkK9z91nNtN6aLwfqPkf6TAQ"], + [ADDRESSES.solana.SOL, "8x2uay8UgrLiX8AAYyF6AkK9z91nNtN6aLwfqPkf6TAQ"], ["Ea5SjE2Y6yvCeW5dYTn7PYMuW5ikXkvbGdcmSnXeaLjS", "8x2uay8UgrLiX8AAYyF6AkK9z91nNtN6aLwfqPkf6TAQ"], ["MERt85fc5boKw3BW1eYdxonEuJNvXbiMbs6hvheau5K", "8x2uay8UgrLiX8AAYyF6AkK9z91nNtN6aLwfqPkf6TAQ"], ["9n4nbM75f5Ui33ZbPYXn59EwSgE8CGsHtAeTH5YFeJ9E", "8x2uay8UgrLiX8AAYyF6AkK9z91nNtN6aLwfqPkf6TAQ"], ["SRMuApVNdxXokk5GT7XD5cUUgXMBCoAz2LHeuAoKWRt", "8x2uay8UgrLiX8AAYyF6AkK9z91nNtN6aLwfqPkf6TAQ"], ["mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So", "8x2uay8UgrLiX8AAYyF6AkK9z91nNtN6aLwfqPkf6TAQ"], - ["9EaLkQrbjmbbuZG9Wdpo8qfNUEjHATJFSycEmw6f1rGX", "8x2uay8UgrLiX8AAYyF6AkK9z91nNtN6aLwfqPkf6TAQ"], + [ADDRESSES.solana.pSOL, "8x2uay8UgrLiX8AAYyF6AkK9z91nNtN6aLwfqPkf6TAQ"], ["Saber2gLauYim4Mvftnrasomsv6NvAuncvMEZwcLpD1", "8x2uay8UgrLiX8AAYyF6AkK9z91nNtN6aLwfqPkf6TAQ"], ["2poo1w1DL6yd2WNTCnNTzDqkC6MBXq7axo77P16yrBuf", "8x2uay8UgrLiX8AAYyF6AkK9z91nNtN6aLwfqPkf6TAQ"], ["9vMJfxuKxXBoEa7rM12mYLMwTacLMLDJqHozw96WQL8i", "8x2uay8UgrLiX8AAYyF6AkK9z91nNtN6aLwfqPkf6TAQ"], @@ -25,19 +26,19 @@ async function tvl() { ["mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So", "GU1nCjN7mcLiSX1dtBw2t9agYCw3ybXfu1me41Q2tGT3"], ["Ea5SjE2Y6yvCeW5dYTn7PYMuW5ikXkvbGdcmSnXeaLjS", "GU1nCjN7mcLiSX1dtBw2t9agYCw3ybXfu1me41Q2tGT3"], ["9n4nbM75f5Ui33ZbPYXn59EwSgE8CGsHtAeTH5YFeJ9E", "GU1nCjN7mcLiSX1dtBw2t9agYCw3ybXfu1me41Q2tGT3"], - ["So11111111111111111111111111111111111111112", "GU1nCjN7mcLiSX1dtBw2t9agYCw3ybXfu1me41Q2tGT3"], + [ADDRESSES.solana.SOL, "GU1nCjN7mcLiSX1dtBw2t9agYCw3ybXfu1me41Q2tGT3"], /// UXD Innovation Zone ["7kbnvuGBxxj8AG9qp8Scn56muWGaRaFqxg1FsRp3PaFT", "Hy6gCkJyMmWMaoxLyzELRReLzdBdZ1YEjNGjQzF9LDPa"], - ["EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", "Hy6gCkJyMmWMaoxLyzELRReLzdBdZ1YEjNGjQzF9LDPa"], - ["Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB", "Hy6gCkJyMmWMaoxLyzELRReLzdBdZ1YEjNGjQzF9LDPa"], - ["So11111111111111111111111111111111111111112", "Hy6gCkJyMmWMaoxLyzELRReLzdBdZ1YEjNGjQzF9LDPa"], + [ADDRESSES.solana.USDC, "Hy6gCkJyMmWMaoxLyzELRReLzdBdZ1YEjNGjQzF9LDPa"], + [ADDRESSES.solana.USDT, "Hy6gCkJyMmWMaoxLyzELRReLzdBdZ1YEjNGjQzF9LDPa"], + [ADDRESSES.solana.SOL, "Hy6gCkJyMmWMaoxLyzELRReLzdBdZ1YEjNGjQzF9LDPa"], ["mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So", "Hy6gCkJyMmWMaoxLyzELRReLzdBdZ1YEjNGjQzF9LDPa"], /// Hedge Innovation Zone ["9iLH8T7zoWhY7sBmj1WK9ENbWdS1nL8n9wAxaeRitTa6", "4bf5HQQZ9qtGGCuxYNnhiTrKpTMTX6HSoLy5a7wUjCEb"], ["9n4nbM75f5Ui33ZbPYXn59EwSgE8CGsHtAeTH5YFeJ9E", "4bf5HQQZ9qtGGCuxYNnhiTrKpTMTX6HSoLy5a7wUjCEb"], - ["So11111111111111111111111111111111111111112", "4bf5HQQZ9qtGGCuxYNnhiTrKpTMTX6HSoLy5a7wUjCEb"], + [ADDRESSES.solana.SOL, "4bf5HQQZ9qtGGCuxYNnhiTrKpTMTX6HSoLy5a7wUjCEb"], ["mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So", "4bf5HQQZ9qtGGCuxYNnhiTrKpTMTX6HSoLy5a7wUjCEb"], ] diff --git a/projects/potluckprotocol/abi.json b/projects/potluckprotocol/abi.json index 2c4757ec8c3..62e9aa74f6b 100644 --- a/projects/potluckprotocol/abi.json +++ b/projects/potluckprotocol/abi.json @@ -1,59 +1,4 @@ -{ - "poolInfo": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "poolInfo", - "outputs": [ - { - "internalType": "contract IBEP20", - "name": "lpToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "allocPoint", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastRewardTimestamp", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accMorphPerShare", - "type": "uint256" - }, - { - "internalType": "uint16", - "name": "depositFeeBP", - "type": "uint16" - }, - { - "internalType": "uint256", - "name": "lpSupply", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "poolLength": { - "inputs": [], - "name": "poolLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } +{ + "poolInfo": "function poolInfo(uint256) view returns (address lpToken, uint256 allocPoint, uint256 lastRewardTimestamp, uint256 accMorphPerShare, uint16 depositFeeBP, uint256 lpSupply)", + "poolLength": "uint256:poolLength" } \ No newline at end of file diff --git a/projects/powaa-protocol/index.js b/projects/powaa-protocol/index.js index 78e9424cd5e..5db82f82603 100644 --- a/projects/powaa-protocol/index.js +++ b/projects/powaa-protocol/index.js @@ -1,33 +1,26 @@ -const { default: axios } = require("axios"); const { sumTokens2 } = require('../helper/unwrapLPs') -const { sumUnknownTokens } = require('../helper/unknownTokens') +const { getConfig } = require('../helper/cache') +let data + +async function getData() { + if (!data) data = _internal() + return data + + async function _internal() { + return getConfig('powaa-protocol', "https://raw.githubusercontent.com/powaa-protocol/powaa-contract-config/main/prod.json") + } +} async function tvl(ts, block) { - const config = ( - await axios.get( - "https://raw.githubusercontent.com/powaa-protocol/powaa-contract-config/main/prod.json" - ) - ).data; + const config = await getData(); const vaults = config["TokenVault"]; const toa = vaults.map(i => [i.TokenAddress, i.VaultAddress]) return sumTokens2({ block, tokensAndOwners: toa, }) } -async function pool2(ts, block) { - const config = ( - await axios.get( - "https://raw.githubusercontent.com/powaa-protocol/powaa-contract-config/main/prod.json" - ) - ).data; - const gov = config["GovLPVault"]; - const toa = [[gov.TokenAddress, gov.VaultAddress]] - return sumUnknownTokens({ block, tokensAndOwners: toa, useDefaultCoreAssets: true }) -} - module.exports = { timetravel: false, ethereum: { tvl, - pool2, }, }; diff --git a/projects/powerbomb/abi.json b/projects/powerbomb/abi.json index 4b34e5d8f6a..09d3d4c314a 100644 --- a/projects/powerbomb/abi.json +++ b/projects/powerbomb/abi.json @@ -1,15 +1,3 @@ { - "getAllPoolInUSD": { - "inputs": [], - "name": "getAllPoolInUSD", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -} + "getAllPoolInUSD": "uint256:getAllPoolInUSD" +} \ No newline at end of file diff --git a/projects/powerbomb/index.js b/projects/powerbomb/index.js index 1dab5e19d80..7abf37917aa 100644 --- a/projects/powerbomb/index.js +++ b/projects/powerbomb/index.js @@ -39,14 +39,14 @@ const opCrvPengAddr = "0x68ca3a3BBD306293e693871E45Fe908C04387614" const opCrvSethPengAddr = "0x98f82ADA10C55BC7D67b92d51b4e1dae69eD0250" // harmony -const oneCrv3poolBtcAddr = "0x12CEf50b6a6dDBeC998353724180184157a685a7" -const oneCrv3poolEthAddr = "0xb6f8747Ab388087692f21FE8524DE5c07f6C7185" +// const oneCrv3poolBtcAddr = "0x12CEf50b6a6dDBeC998353724180184157a685a7" +// const oneCrv3poolEthAddr = "0xb6f8747Ab388087692f21FE8524DE5c07f6C7185" // avalanche -const avaxCrv3poolBtcAddr = "0x2510E5054eeEbED40C3C580ae3241F5457b630D9" -const avaxCrv3poolEthAddr = "0xFAcB839BF8f09f2e7B4b6C83349B5bbFD62fd659" -const avaxCrv3poolGohmAddr = "0x4d3e58DAa8233Cc6a46b9c6e23df5A202B178550" -const avaxCrv3poolWmemoAddr = "0x9adA6069D6C02c839111e8F406270ED03D1a9506" +// const avaxCrv3poolBtcAddr = "0x2510E5054eeEbED40C3C580ae3241F5457b630D9" +// const avaxCrv3poolEthAddr = "0xFAcB839BF8f09f2e7B4b6C83349B5bbFD62fd659" +// const avaxCrv3poolGohmAddr = "0x4d3e58DAa8233Cc6a46b9c6e23df5A202B178550" +// const avaxCrv3poolWmemoAddr = "0x9adA6069D6C02c839111e8F406270ED03D1a9506" const vaults = { arbitrum: [ @@ -86,16 +86,16 @@ const vaults = { opCrvPengAddr, opCrvSethPengAddr, ], - harmony: [ - oneCrv3poolBtcAddr, - oneCrv3poolEthAddr, - ], - avax: [ - avaxCrv3poolBtcAddr, - avaxCrv3poolEthAddr, - avaxCrv3poolGohmAddr, - avaxCrv3poolWmemoAddr, - ] + // harmony: [ + // oneCrv3poolBtcAddr, + // oneCrv3poolEthAddr, + // ], + // avax: [ + // avaxCrv3poolBtcAddr, + // avaxCrv3poolEthAddr, + // avaxCrv3poolGohmAddr, + // avaxCrv3poolWmemoAddr, + // ] } module.exports = { diff --git a/projects/powerindex/abi.json b/projects/powerindex/abi.json index 8f47c00e44d..c2984213f9d 100644 --- a/projects/powerindex/abi.json +++ b/projects/powerindex/abi.json @@ -1,85 +1,8 @@ { - "getCurrentTokens": { - "constant": true, - "inputs": [], - "name": "getCurrentTokens", - "outputs": [ - { - "internalType": "address[]", - "name": "tokens", - "type": "address[]" - } - ], - "payable": false, - "type": "function" - }, - "underlying": { - "constant": true, - "inputs": [], - "name": "underlying", - "outputs": [ - { - "internalType": "contract IERC20", - "type": "address" - } - ], - "payable": false, - "type": "function" - }, - "getPricePerFullShare": { - "constant": true, - "inputs": [], - "name": "getPricePerFullShare", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "token": { - "constant": true, - "inputs": [], - "name": "token", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "get_virtual_price": { - "name": "get_virtual_price", - "outputs": [ - { - "type": "uint256", - "name": "" - } - ], - "inputs": [], - "stateMutability": "view", - "type": "function", - "gas": 992854 - }, - "pricePerShare": { - "stateMutability": "view", - "type": "function", - "name": "pricePerShare", - "inputs": [], - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "gas": 18195 - } + "getCurrentTokens": "address[]:getCurrentTokens", + "underlying": "address:underlying", + "getPricePerFullShare": "uint256:getPricePerFullShare", + "token": "address:token", + "get_virtual_price": "uint256:get_virtual_price", + "pricePerShare": "uint256:pricePerShare" } \ No newline at end of file diff --git a/projects/powerindex/index.js b/projects/powerindex/index.js index 2f3dcbae780..4491f611032 100644 --- a/projects/powerindex/index.js +++ b/projects/powerindex/index.js @@ -1,142 +1,47 @@ -const sdk = require('@defillama/sdk'); - -const BigNumber = require('bignumber.js'); -const curvePools = require('../convex/pools-crv.js') +const { getLogs } = require('../helper/cache/getLogs') +const { sumTokens2 } = require('../helper/unwrapLPs') const abi = require('./abi'); -const gusd = '0x056Fd409E1d7A124BD7017459dFEa2F387b6d5Cd' -const curveFactoryPools = [ - "0xEd279fDD11cA84bEef15AF5D39BB4d4bEE23F0cA", - "0x4807862AA8b2bF68830e4C8dc86D0e9A998e085a" -].map(pool => pool.toLowerCase()) - -async function getBscTvl(time, ethBlock, chainBlocks) { - let bscBalances = {} - const block = chainBlocks.bsc - +async function getBscTvl(time, ethBlock, chainBlocks, { api }) { const poolAddress = "0x40E46dE174dfB776BB89E04dF1C47d8a66855EB3" - /* - const poolAddress = await sdk.api.util.getLogs({ - keys: ['topics'], - toBlock: block, - target: '0x37c4a7E826a7F6606628eb5180df7Be8d6Ca4B2C', - fromBlock: 10481280, - topic: 'LOG_NEW_POOL(address,address,address)', - chain: 'bsc' - }).then(r => `0x${r.output[0][2].slice(26)}`); - */ - - let poolTokens = await sdk.api.abi.call({ - chain: 'bsc', - abi: abi.getCurrentTokens, + const tokens = await api.call({ target: poolAddress, - block - }); - - let poolBalances = await sdk.api.abi.multiCall({ - chain: 'bsc', - block, - abi: 'erc20:balanceOf', - calls: poolTokens.output.map( - (poolToken) => ({ target: poolToken, params: poolAddress})) - }) - - poolBalances.output.forEach((poolBalance) => { - bscBalances[`bsc:${poolBalance.input.target}`] = poolBalance.output + abi: abi.getCurrentTokens, }) - - return bscBalances; + return sumTokens2({ api, tokens, owner: poolAddress }) } -async function eth(timestamp, block) { - let balances = {}; - - let poolLogs = await sdk.api.util.getLogs({ +async function eth(timestamp, block, _1, { api }) { + let poolLogs = await getLogs({ target: '0x0Ba2e75FE1368d8d517BE1Db5C39ca50a1429441', topic: 'LOG_NEW_POOL(address,address)', - keys: ['topics'], fromBlock: 11362346, - toBlock: block - }).then(r => r.output); + api, + }) - poolLogs = poolLogs.concat(await sdk.api.util.getLogs({ + poolLogs = poolLogs.concat(await getLogs({ target: '0x967D77f1fBb5fD1846Ce156bAeD3AAf0B13020D1', topic: 'LOG_NEW_POOL(address,address,address)', - keys: ['topics'], fromBlock: 11706591, - toBlock: block - }).then(r => r.output)) - - let poolCalls = []; + api, + })) let pools = poolLogs.map((poolLog) => { - return `0x${poolLog[2].slice(26)}` + return `0x${poolLog.topics[2].slice(26)}` }); - const poolTokenData = (await sdk.api.abi.multiCall({ - calls: pools.map((poolAddress) => ({ target: poolAddress })), + const tokensAndOwners = [] + const tokens = await api.multiCall({ abi: abi.getCurrentTokens, - })).output; - - poolTokenData.forEach((poolToken) => { - let poolTokens = poolToken.output; - if(poolTokens === null){ - throw new Error("poolTokens failed call") - } - let poolAddress = poolToken.input.target; - - poolTokens.forEach((token) => { - poolCalls.push({ - target: token, - params: poolAddress, - }); - }) - }); - - const [{ output: poolBalances }, { output: tokensUnderlyings }, { output: pricesPerFullShare }, { output: tokens }, { output: v2PricePerShare }] = await Promise.all([ - sdk.api.abi.multiCall({ block, calls: poolCalls, abi: 'erc20:balanceOf' }), - sdk.api.abi.multiCall({ block, calls: poolCalls.map(c => ({ target: c.target })), abi: abi.underlying }), - sdk.api.abi.multiCall({ block, calls: poolCalls.map(c => ({ target: c.target })), abi: abi.getPricePerFullShare }), - sdk.api.abi.multiCall({ block, calls: poolCalls.map(c => ({ target: c.target })), abi: abi.token }), - sdk.api.abi.multiCall({ block, calls: poolCalls.map(c => ({ target: c.target })), abi: abi.pricePerShare }), - ]); - - for (let i = 0; i < poolBalances.length; i++) { - const balanceOf = poolBalances[i]; - const tokenAddress = balanceOf.input.target; - let underlying = tokensUnderlyings.find(t => t.input.target === tokenAddress); - let pricePerFullShare = pricesPerFullShare[i]; - if (v2PricePerShare[i].success) { - pricePerFullShare = v2PricePerShare[i]; - } - if (pricePerFullShare.success) { - underlying = tokens[i]; - const underlyingAddr = underlying.output.toLowerCase() - - const curvePool = curvePools.find(pool => pool.addresses.lpToken.toLowerCase() === underlyingAddr)?.addresses.swap ?? curveFactoryPools.find(underlyingAddr) - if (curvePool !== undefined) { - const virtualPrice = await sdk.api.abi.call({ - target: curvePool, - abi: abi.get_virtual_price, - block - }) - underlying.output = gusd // Wrong, we just count all curve lp underlyings as GUSD - balanceOf.output = BigNumber(balanceOf.output).times(virtualPrice.output).div(BigNumber(10).pow(18 + 18 - 2)).toFixed(0) // 2 decimals for GUSD - } - balanceOf.output = BigNumber(balanceOf.output).times(pricePerFullShare.output).div(BigNumber(10).pow(18)).toFixed(0) - } - const balance = balanceOf.output; - const address = underlying.success ? underlying.output : tokenAddress; - - if (BigNumber(balance).toNumber() <= 0) { - continue; - } - - balances[address] = BigNumber(balances[address] || 0).plus(balance).toFixed(); - } + calls: pools, + }) + tokens.forEach((t, i) => { + const owner = pools[i] + tokensAndOwners.push(...t.map(j => ([j, owner]))) + }) + return sumTokens2({ api, tokensAndOwners, }) - return balances; } module.exports = { diff --git a/projects/powerswap/index.js b/projects/powerswap/index.js index 25c2c7eb81e..9cb6b93fae1 100644 --- a/projects/powerswap/index.js +++ b/projects/powerswap/index.js @@ -5,7 +5,6 @@ module.exports = { ethpow: { tvl: getUniTVL({ factory: '0xD51CFEb0fa23101f67cF62EB02D0a82A4BaD52b7', - chain: 'ethpow', useDefaultCoreAssets: true }) }, diff --git a/projects/powswap/index.js b/projects/powswap/index.js index 9387d4b09aa..0af5680945d 100644 --- a/projects/powswap/index.js +++ b/projects/powswap/index.js @@ -4,7 +4,6 @@ module.exports = { misrepresentedTokens: true, ethpow: { tvl: getUniTVL({ - chain: 'ethpow', useDefaultCoreAssets: true, factory: '0x62009bD6349A3A1d7f1bcC7C69492Cd26F1FBF75', }) diff --git a/projects/prdt/index.js b/projects/prdt/index.js index 232ff6ef601..2a7560fb5ed 100644 --- a/projects/prdt/index.js +++ b/projects/prdt/index.js @@ -1,5 +1,7 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokensExport, nullAddress } = require("../helper/unwrapLPs"); -const USDTpolygon = "0xc2132D05D31c914a87C6611C10748AEb04B58e8F"; +const USDTpolygon = ADDRESSES.polygon.USDT; +const USDTbsc = ADDRESSES.bsc.USDT; const config = { bsc: { @@ -7,14 +9,16 @@ const config = { predictionBNB: "0x31B8A8Ee92961524fD7839DC438fd631D34b49C6", predictionETH: "0xE39A6a119E154252214B369283298CDF5396026B", predictionBTC: "0x3Df33217F0f82c99fF3ff448512F22cEf39CC208", + predictionPRO: "0x599974D3f2948b50545Fb5aa77C9e0bddc230ADE", + predictionPROV2: "0x22dB94d719659d7861612E0f43EE28C9FF9909C7", }), }, polygon: { owners: Object.values({ predictionBTCPOLY: "0xd71b0366CD2f2E90dd1F80A1F0EA540F73Ac0EF6", - predictionTESLA: "0x3fc376530Ac35d37Dd1Fa794F922e0f30CbB2c46", predictionMATIC: "0x59e0aD27d0F58A15128051cAA1D2917aA71AB864", predictionPRO: "0x764C3Ea13e7457261E5C1AaD597F281f3e738240", + predictionPROV2: "0x8251E5EBc2d2C20f6a116144800D569FAF75d746", }), }, }; @@ -22,7 +26,7 @@ const config = { module.exports = {}; module.exports = { - bsc: { tvl: sumTokensExport({ chain: "bsc", owners: config.bsc.owners, tokens: [nullAddress] }) }, + bsc: { tvl: sumTokensExport({ chain: "bsc", owners: config.bsc.owners, tokens: [nullAddress, USDTbsc] }) }, polygon: { tvl: sumTokensExport({ chain: "polygon", owners: config.polygon.owners, tokens: [nullAddress, USDTpolygon] }), }, diff --git a/projects/prePo/index.js b/projects/prePo/index.js new file mode 100644 index 00000000000..4fb3ce1fb25 --- /dev/null +++ b/projects/prePo/index.js @@ -0,0 +1,34 @@ +const { getLogs } = require('../helper/cache/getLogs'); +const { sumTokens2 } = require('../helper/unwrapLPs') +const { getUniqueAddresses } = require('../helper/utils') +const config = { + arbitrum: { factory: '0x6f889e3fce9b13fe8cefa068a48f4074292e663c', fromBlock: 70478558 }, +} + +module.exports = {} + +Object.keys(config).forEach(chain => { + const { fromBlock, factory, } = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const logs = await getLogs({ + api, + target: factory, + topics: ['0xe56f19ada061bf6161817694d647d94134afe9d3e877db1d8118b3012b744635'], + eventAbi: 'event MarketCreation(address, address, address, uint256, uint256, uint256, uint256, uint256 expiryTime)', + onlyArgs: true, + fromBlock: fromBlock, + }) + const markets = logs.map(i => i[0]) + let tokens = await api.multiCall({ abi: 'address:getCollateral', calls: markets }) + let wrappedTokens = getUniqueAddresses(tokens) + const tokenNames = await api.multiCall({ abi: 'string:name', calls: wrappedTokens }) + wrappedTokens = wrappedTokens.filter((v, i) => tokenNames[i].startsWith('prePO')) + let baseTokens = await api.multiCall({ abi: 'address:getBaseToken', calls: wrappedTokens }) + const tokensAndOwners = baseTokens.map((v, i) => [v, wrappedTokens[i]]) + markets.forEach((v, i) => tokensAndOwners.push([tokens[i], v])) + return sumTokens2({ api, tokensAndOwners, blacklistedTokens: wrappedTokens }) + } + } +}) + diff --git a/projects/predy-v3/index.js b/projects/predy-v3/index.js new file mode 100644 index 00000000000..336d68c6bf5 --- /dev/null +++ b/projects/predy-v3/index.js @@ -0,0 +1,33 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require('../helper/unwrapLPs') + +const v3Address = '0x4006A8840F8640A7D8F46D2c3155a58c76eCD56e'; + +const WETH_CONTRACT = ADDRESSES.arbitrum.WETH; +const USDC_CONTRACT = ADDRESSES.arbitrum.USDC; + +const abi = { + v3: { + getTokenState: 'function getTokenState() returns (tuple(uint256 totalCompoundDeposited, uint256 totalCompoundBorrowed, uint256 totalNormalDeposited, uint256 totalNormalBorrowed, uint256 assetScaler, uint256 debtScaler, uint256 assetGrowth, uint256 debtGrowth), tuple(uint256 totalCompoundDeposited, uint256 totalCompoundBorrowed, uint256 totalNormalDeposited, uint256 totalNormalBorrowed, uint256 assetScaler, uint256 debtScaler, uint256 assetGrowth, uint256 debtGrowth))' + }, + v320: { + getAsset: 'function getAsset(uint256 _id) external view returns (tuple(uint256 id, address token, address supplyTokenAddress, tuple(uint256 riskRatio, int24 rangeSize, int24 rebalanceThreshold), tuple(uint256 totalCompoundDeposited, uint256 totalCompoundBorrowed, uint256 totalNormalDeposited, uint256 totalNormalBorrowed, uint256 assetScaler, uint256 debtScaler, uint256 assetGrowth, uint256 debtGrowth), tuple(address uniswapPool, int24 tickLower, int24 tickUpper, uint256 totalAmount, uint256 borrowedAmount, uint256 supplyPremiumGrowth, uint256 borrowPremiumGrowth, uint256 fee0Growth, uint256 fee1Growth, tuple(int256 positionAmount, uint256 lastFeeGrowth), tuple(int256 positionAmount, uint256 lastFeeGrowth), int256 rebalanceFeeGrowthUnderlying, int256 rebalanceFeeGrowthStable), bool isMarginZero, tuple(uint256 baseRate, uint256 kinkRate, uint256 slope1, uint256 slope2), tuple(uint256 baseRate, uint256 kinkRate, uint256 slope1, uint256 slope2), uint256 lastUpdateTimestamp, uint256 accumulatedProtocolRevenue))' + } +} + + +async function borrowed(_time, _ethBlock, chainBlocks, { api }) { + // V3 + const v3TokenState = await api.call({ abi: abi.v3.getTokenState, target: v3Address, }) + api.add(WETH_CONTRACT, v3TokenState[0].totalNormalBorrowed) + api.add(USDC_CONTRACT, v3TokenState[1].totalNormalBorrowed) + +} + + +module.exports = { + methodology: "USDC and WETH locked on predy contracts", + arbitrum: { + tvl: sumTokensExport({ owners: [v3Address], tokens: [USDC_CONTRACT, WETH_CONTRACT,] }), + }, +}; diff --git a/projects/predy-v320/index.js b/projects/predy-v320/index.js new file mode 100644 index 00000000000..05a6780d273 --- /dev/null +++ b/projects/predy-v320/index.js @@ -0,0 +1,34 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require('../helper/unwrapLPs') + +const v320Address = '0x68a154fB3e8ff6e4DA10ECd54DEF25D9149DDBDE'; + +const WETH_CONTRACT = ADDRESSES.arbitrum.WETH; +const USDC_CONTRACT = ADDRESSES.arbitrum.USDC; + +const abi = { + v3: { + getTokenState: 'function getTokenState() returns (tuple(uint256 totalCompoundDeposited, uint256 totalCompoundBorrowed, uint256 totalNormalDeposited, uint256 totalNormalBorrowed, uint256 assetScaler, uint256 debtScaler, uint256 assetGrowth, uint256 debtGrowth), tuple(uint256 totalCompoundDeposited, uint256 totalCompoundBorrowed, uint256 totalNormalDeposited, uint256 totalNormalBorrowed, uint256 assetScaler, uint256 debtScaler, uint256 assetGrowth, uint256 debtGrowth))' + }, + v320: { + getAsset: 'function getAsset(uint256 _id) external view returns (tuple(uint256 id, address token, address supplyTokenAddress, tuple(uint256 riskRatio, int24 rangeSize, int24 rebalanceThreshold), tuple(uint256 totalCompoundDeposited, uint256 totalCompoundBorrowed, uint256 totalNormalDeposited, uint256 totalNormalBorrowed, uint256 assetScaler, uint256 debtScaler, uint256 assetGrowth, uint256 debtGrowth), tuple(address uniswapPool, int24 tickLower, int24 tickUpper, uint256 totalAmount, uint256 borrowedAmount, uint256 supplyPremiumGrowth, uint256 borrowPremiumGrowth, uint256 fee0Growth, uint256 fee1Growth, tuple(int256 positionAmount, uint256 lastFeeGrowth), tuple(int256 positionAmount, uint256 lastFeeGrowth), int256 rebalanceFeeGrowthUnderlying, int256 rebalanceFeeGrowthStable), bool isMarginZero, tuple(uint256 baseRate, uint256 kinkRate, uint256 slope1, uint256 slope2), tuple(uint256 baseRate, uint256 kinkRate, uint256 slope1, uint256 slope2), uint256 lastUpdateTimestamp, uint256 accumulatedProtocolRevenue))' + } +} + + +async function borrowed(_time, _ethBlock, chainBlocks, { api }) { + // V3.2 + const v320USDCState = await api.call({ abi: abi.v320.getAsset, target: v320Address, params: 1}) + const v320ETHState = await api.call({ abi: abi.v320.getAsset, target: v320Address, params: 2 }) + api.add(WETH_CONTRACT, v320ETHState[4][3]) + api.add(USDC_CONTRACT, v320USDCState[4][3]) +} + + +module.exports = { + methodology: "USDC and WETH locked on predy contracts", + arbitrum: { + tvl: sumTokensExport({ owners: [v320Address], tokens: [USDC_CONTRACT, WETH_CONTRACT,] }), + + }, +}; diff --git a/projects/predy-v5/index.js b/projects/predy-v5/index.js new file mode 100644 index 00000000000..7ea9209f1a8 --- /dev/null +++ b/projects/predy-v5/index.js @@ -0,0 +1,39 @@ +const v5Address = '0x06a61E55d4d4659b1A23C0F20AEdfc013C489829'; + +const abi = { + v5: { + getAsset: "function getAsset(uint256 _id) view returns (tuple(uint256 id, uint256 pairGroupId, tuple(address token, address supplyTokenAddress, tuple(uint256 totalCompoundDeposited, uint256 totalNormalDeposited, uint256 totalNormalBorrowed, uint256 assetScaler, uint256 assetGrowth, uint256 debtGrowth) tokenStatus, tuple(uint256 baseRate, uint256 kinkRate, uint256 slope1, uint256 slope2) irmParams) stablePool, tuple(address token, address supplyTokenAddress, tuple(uint256 totalCompoundDeposited, uint256 totalNormalDeposited, uint256 totalNormalBorrowed, uint256 assetScaler, uint256 assetGrowth, uint256 debtGrowth) tokenStatus, tuple(uint256 baseRate, uint256 kinkRate, uint256 slope1, uint256 slope2) irmParams) underlyingPool, tuple(uint256 riskRatio, int24 rangeSize, int24 rebalanceThreshold) riskParams, tuple(address uniswapPool, int24 tickLower, int24 tickUpper, uint64 numRebalance, uint256 totalAmount, uint256 borrowedAmount, uint256 lastRebalanceTotalSquartAmount, uint256 lastFee0Growth, uint256 lastFee1Growth, uint256 borrowPremium0Growth, uint256 borrowPremium1Growth, uint256 fee0Growth, uint256 fee1Growth, tuple(int256 positionAmount, uint256 lastFeeGrowth) rebalancePositionUnderlying, tuple(int256 positionAmount, uint256 lastFeeGrowth) rebalancePositionStable, int256 rebalanceFeeGrowthUnderlying, int256 rebalanceFeeGrowthStable) sqrtAssetStatus, bool isMarginZero, bool isIsolatedMode, uint256 lastUpdateTimestamp) data)", + globalData: "function globalData() view returns (uint256 pairGroupsCount, uint256 pairsCount, uint256 vaultCount)", + } +} + +async function tvl(_, _b, _cb, { api, }) { + const { pairsCount } = await api.call({ abi: abi.v5.globalData, target: v5Address }) + const data = await api.fetchList({ itemCount: pairsCount - 1, startFromOne: true, itemAbi: abi.v5.getAsset, target: v5Address }) + const tokens = [] + data.forEach(({ stablePool, underlyingPool }) => { + tokens.push(stablePool.token) + tokens.push(underlyingPool.token) + }) + return api.sumTokens({ tokens, owner: v5Address, }) +} + +async function borrowed(_, _b, _cb, { api, }) { + const { pairsCount } = await api.call({ abi: abi.v5.globalData, target: v5Address }) + const data = await api.fetchList({ itemCount: pairsCount - 1, startFromOne: true, itemAbi: abi.v5.getAsset, target: v5Address }) + data.forEach(({ stablePool, underlyingPool }) => { + api.add(stablePool.token, stablePool.tokenStatus.totalNormalBorrowed) + api.add(underlyingPool.token, underlyingPool.tokenStatus.totalNormalBorrowed) + }) +} + +module.exports = { + methodology: "USDC and WETH locked on predy contracts", + arbitrum: { + tvl, + borrowed, + }, + hallmarks: [ + [1688490168, "Launch Predy V5"] + ], +}; \ No newline at end of file diff --git a/projects/predy/index.js b/projects/predy/index.js index b26a13b0bb7..101dc8cf780 100644 --- a/projects/predy/index.js +++ b/projects/predy/index.js @@ -1,52 +1,19 @@ -const sdk = require('@defillama/sdk'); -const BigNumber = require("bignumber.js"); +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require('../helper/unwrapLPs') -const predyContractV2 = '0xc7ec02AEeCdC9087bf848c4C4f790Ed74A93F2AF'; -const predyContractV202 = '0xAdBAeE9665C101413EbFF07e20520bdB67C71AB6'; +const v2Address = '0xc7ec02AEeCdC9087bf848c4C4f790Ed74A93F2AF'; +const v202Address = '0xAdBAeE9665C101413EbFF07e20520bdB67C71AB6'; -const weth = "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1"; -const usdc = "0xff970a61a04b1ca14834a43f5de4533ebddb5cc8"; - -async function tvl(_time, _ethBlock, chainBlocks) { - let balances = {}; - - const v2usdc = (await sdk.api.erc20.balanceOf({ - target: usdc, - owner: predyContractV2, - chain: 'arbitrum', - block: chainBlocks.arbitrum - })).output; - - const v202usdc = (await sdk.api.erc20.balanceOf({ - target: usdc, - owner: predyContractV202, - chain: 'arbitrum', - block: chainBlocks.arbitrum - })).output; - - balances[`arbitrum:${usdc}`] = BigNumber(v2usdc).plus(v202usdc); - - const v2weth = (await sdk.api.erc20.balanceOf({ - target: weth, - owner: predyContractV2, - chain: 'arbitrum', - block: chainBlocks.arbitrum - })).output; - - const v202weth = (await sdk.api.erc20.balanceOf({ - target: weth, - owner: predyContractV202, - chain: 'arbitrum', - block: chainBlocks.arbitrum - })).output; - - balances[`arbitrum:${weth}`] = BigNumber(v2weth).plus(v202weth); - return balances; -}; +const WETH_CONTRACT = ADDRESSES.arbitrum.WETH; +const USDC_CONTRACT = ADDRESSES.arbitrum.USDC; module.exports = { - methodology: "USDC and WETH locked on predy contracts", - arbitrum: { - tvl - } + methodology: "USDC and WETH locked on predy contracts", + arbitrum: { + tvl: sumTokensExport({ owners: [v202Address, v2Address], tokens: [USDC_CONTRACT, WETH_CONTRACT,] }), + }, + hallmarks: [ + [1671092333, "Launch Predy V3"], + [1678734774, "Launch Predy V3.2"] + ], }; diff --git a/projects/premia/abi.json b/projects/premia/abi.json index 270edca4fee..8f1380b83a4 100644 --- a/projects/premia/abi.json +++ b/projects/premia/abi.json @@ -1,16 +1,4 @@ { - "tokens": { - "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "name": "tokens", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - "tokensLength": { - "inputs": [], - "name": "tokensLength", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - } -} + "tokens": "function tokens(uint256) view returns (address)", + "tokensLength": "uint256:tokensLength" +} \ No newline at end of file diff --git a/projects/premia/index.js b/projects/premia/index.js index 28fd97fd0fe..1af30cb2f19 100644 --- a/projects/premia/index.js +++ b/projects/premia/index.js @@ -1,9 +1,10 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); const { sumTokens } = require("../helper/unwrapLPs"); const { stakings } = require("../helper/staking"); const { request, gql } = require("graphql-request"); -const { getBlock } = require("../helper/getBlock"); +const { getBlock } = require("../helper/http"); //const tvlV1 = require('./v1') @@ -12,8 +13,8 @@ const PREMIA_OPTIONS_CONTRACT_ETH = const PREMIA_OPTIONS_CONTRACT_BSC = "0x8172aAC30046F74907a6b77ff7fC867A6aD214e4"; -const erc20DAI = "0x6B175474E89094C44Da98b954EedeAC495271d0F"; -const erc20BUSD = "0xe9e7cea3dedca5984780bafc599bd69add087d56"; +const erc20DAI = ADDRESSES.ethereum.DAI; +const erc20BUSD = ADDRESSES.bsc.BUSD; const calcTvl = async (balances, chain, block, premiaOptionsContract) => { const erc20TokensLength = ( diff --git a/projects/premia/v1.js b/projects/premia/v1.js index 5cb8a87863a..d1d49afc5e3 100644 --- a/projects/premia/v1.js +++ b/projects/premia/v1.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { request, gql } = require("graphql-request"); const sdk = require('@defillama/sdk') @@ -52,8 +53,8 @@ const graphUrls = { bsc: 'https://api.thegraph.com/subgraphs/name/premiafinance/premia-bsc', }; const denominators = { - ethereum: "0x6b175474e89094c44da98b954eedeac495271d0f", //DAI - bsc: "0xe9e7cea3dedca5984780bafc599bd69add087d56", //BUSD + ethereum: ADDRESSES.ethereum.DAI, //DAI + bsc: ADDRESSES.bsc.BUSD, //BUSD } module.exports = function v1Tvl(chain) { diff --git a/projects/premio/index.js b/projects/premio/index.js new file mode 100644 index 00000000000..97813e33f53 --- /dev/null +++ b/projects/premio/index.js @@ -0,0 +1,15 @@ +const { staking } = require('../helper/staking') + + + +module.exports = { + methodology: 'TVL counts staked PREMIO coins on the platform itself. CoinGecko is used to find the price of tokens in USD.', + celo: { + staking: staking('0x1DA2C9f15E2399960032dCF709B873712626ABF1', '0x94140c2ea9d208d8476ca4e3045254169791c59e') + }, + kava: { + tvl:() => 0, + staking: staking('0x0281CBD3e40Ce01b514360a47BdB4dB26Dd76bc3', '0x9B82ee2C5e811d9849D7766edC3D750d9ab6492c') + }, +}; + diff --git a/projects/prime-protocol/index.js b/projects/prime-protocol/index.js new file mode 100644 index 00000000000..8b42aea6294 --- /dev/null +++ b/projects/prime-protocol/index.js @@ -0,0 +1,238 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const sdk = require('@defillama/sdk'); +const { sumTokens2, } = require('../helper/unwrapLPs') + +const MASTER_VIEW_CONTRACT = { + v1_4_6: { + address: '0x47ecFB57deD0160d66103A6A201C5f30f7CC7d13', + abi: { + calculateAssetTVL: 'function calculateRawAssetTVL(uint256 chainId, address pToken) view returns (uint256)' + } + } +}; + +const MOONBEAM_MARKETS = { + xcDOT_v0_v1_2_0: { + pTokenMarketAddress: '0x156F5c70a157A381610F1DbaAE4f336a2DB70E7E', + pTokenUnderlyingAddress: '0xFfFFfFff1FcaCBd218EDc0EbA20Fc2308C778080' + }, + GLMR_v1_v1_4_6: { + pTokenMarketAddress: '0x53d5a47bb874eE688acb479676aD133d47CB9B25', + pTokenUnderlyingAddress: ADDRESSES.null, + }, + whUSDC_v1_v1_4_6: { + pTokenMarketAddress: '0x5f8d500ec32dB09aa3115a852f30e9C756867d5A', + pTokenUnderlyingAddress: '0x931715FEE2d06333043d11F658C8CE934aC61D0c', + }, + xcUSDT_v1_v1_4_6: { + pTokenMarketAddress: '0x1D5CC7840a05BA39Db0AAd21e14dF1ff09b599ED', + pTokenUnderlyingAddress: ADDRESSES.moonbeam.xcUSDT, + }, + xcDOT_v1_v1_4_6: { + pTokenMarketAddress: '0x8f7F208F38A4362e6Fe6112b720630f93bb608aA', + pTokenUnderlyingAddress: '0xFfFFfFff1FcaCBd218EDc0EbA20Fc2308C778080', + }, + GLMR_v2_v1_6_0: { + pTokenMarketAddress: '0xdC427cDB81E1532747BEDeB8077a4AEcDbfB585e', + pTokenUnderlyingAddress: ADDRESSES.null, + }, + whUSDC_v2_v1_6_0: { + pTokenMarketAddress: '0x227EEB717a3Ec78025bE51c87b3A7160192613D2', + pTokenUnderlyingAddress: '0x931715FEE2d06333043d11F658C8CE934aC61D0c', + }, + xcUSDT_v2_v1_6_0: { + pTokenMarketAddress: '0x8ef25FAC30DeD9A210151C1d27e58F71f2142e2f', + pTokenUnderlyingAddress: ADDRESSES.moonbeam.xcUSDT, + }, + xcDOT_v2_v1_6_0: { + pTokenMarketAddress: '0x525c6B3D27B6b1Fc28bca7dc04964247c1a942B1', + pTokenUnderlyingAddress: '0xFfFFfFff1FcaCBd218EDc0EbA20Fc2308C778080', + }, + whWBTC_v2_v1_10_2: { + pTokenMarketAddress: '0x2A104E502480b4e3C1D13EA2EC657C08f4578a7a', + pTokenUnderlyingAddress: ADDRESSES.moonbeam.WBTC, + } +}; + +const AVALANCHE_MARKETS = { + ETH_v1_v1_4_6: { + pTokenMarketAddress: '0x94ebF80b33120a1AbE370E56192db39f4944b6ca', + pTokenUnderlyingAddress: ADDRESSES.avax.WETH_e, + }, + USDC_v1_v1_4_6: { + pTokenMarketAddress: '0x6Cce9601CA44a9049A761C22b70D5849662c2C0a', + pTokenUnderlyingAddress: ADDRESSES.avax.USDC, + }, + USDT_v1_v1_4_6: { + pTokenMarketAddress: '0xe06F55FB6c6C62b74AAD7eb77f00b06920FB176e', + pTokenUnderlyingAddress: ADDRESSES.avax.USDt, + }, + ETH_v2_v1_6_0: { + pTokenMarketAddress: '0x4Ebba16380fEb2083938c008aEDD4b5EBeA80f72', + pTokenUnderlyingAddress: ADDRESSES.avax.WETH_e, + }, + USDC_v2_v1_6_0: { + pTokenMarketAddress: '0x73c5c93E78cB8CA4939307e0D95e032631fB9eEe', + pTokenUnderlyingAddress: ADDRESSES.avax.USDC, + }, + USDT_v2_v1_6_0: { + pTokenMarketAddress: '0x1BF6752282039ee82C06DE64D094C9E35578A1a0', + pTokenUnderlyingAddress: ADDRESSES.avax.USDt, + }, + DAI_v2_v1_10_2: { + pTokenMarketAddress: '0x05f2B8EAc42c9Cc771B8ECF6448481A3802e08c6', + pTokenUnderlyingAddress: ADDRESSES.avax.DAI, + }, + bBTC_v2_v1_10_2: { + pTokenMarketAddress: '0xA5c74A10B60f276F806468c6E2f83D490dCfA89A', + pTokenUnderlyingAddress: ADDRESSES.avax.BTC_b, + }, +}; + +const ARBITRUM_MARKETS = { + ETH_v1_v1_4_6: { + pTokenMarketAddress: '0x2E9F73aA3F16748C9c1E8243D204d60F87dEC872', + pTokenUnderlyingAddress: ADDRESSES.null, + }, + USDC_v1_v1_4_6: { + pTokenMarketAddress: '0x1b0509D8CC044805F54D132ccDa7b4A4ED88261A', + pTokenUnderlyingAddress: ADDRESSES.arbitrum.USDC, + }, + ETH_v2_v1_6_0: { + pTokenMarketAddress: '0xc01683398fFCc86264ba17bC36977f51A1d25e06', + pTokenUnderlyingAddress: ADDRESSES.null, + }, + USDC_v2_v1_6_0: { + pTokenMarketAddress: '0xddC6Df52F9749ED80966Fb6a9D4C87264cC1e6C1', + pTokenUnderlyingAddress: ADDRESSES.arbitrum.USDC, + }, + DAI_v2_v1_10_2: { + pTokenMarketAddress: '0x3e1C8203B8D36E8E427Ee181A65549fd86AE3907', + pTokenUnderlyingAddress: ADDRESSES.optimism.DAI, + }, + WBTC_v2_v1_10_2: { + pTokenMarketAddress: '0x51Ff97d92683992AD091E04470069bB942219D71', + pTokenUnderlyingAddress: ADDRESSES.arbitrum.WBTC, + }, + nativeUSDC_v1_v1_10_2: { + pTokenMarketAddress: '0xA44C28Bd4Fd4fc307f23B2E6e9cC07BC03571798', + pTokenUnderlyingAddress: ADDRESSES.arbitrum.USDC_CIRCLE, + }, +}; + +const ETHEREUM_MARKETS = { + ETH_v1_v1_4_6: { + pTokenMarketAddress: '0xD15a15C0b6d79D9E59F4fcC0D17912219f6b470C', + pTokenUnderlyingAddress: ADDRESSES.null, + }, + USDC_v1_v1_4_6: { + pTokenMarketAddress: '0x8F0Ba37DAC51a8102b1203C9D9ac26724DC684Ac', + pTokenUnderlyingAddress: ADDRESSES.ethereum.USDC, + }, + USDT_v1_v1_4_6: { + pTokenMarketAddress: '0x373bb8bE40Ee6f704576CDC815372ff71d6825c5', + pTokenUnderlyingAddress: ADDRESSES.ethereum.USDT, + }, + ETH_v2_v1_6_0: { + pTokenMarketAddress: '0xd833F882ca07F69C4C5a069675B6B65C235325C3', + pTokenUnderlyingAddress: ADDRESSES.null, + }, + USDC_v2_v1_6_0: { + pTokenMarketAddress: '0x67CeC45eB8d9f059D4c974a4BdEA357b68Ad80Ef', + pTokenUnderlyingAddress: ADDRESSES.ethereum.USDC, + }, + USDT_v2_v1_6_0: { + pTokenMarketAddress: '0xDC313B592949E8F4bB91A22c6DC9f7BE11b74Ea7', + pTokenUnderlyingAddress: ADDRESSES.ethereum.USDT, + }, +}; + +const BSC_MARKETS = { + USDC_v2_v1_10_2: { + pTokenMarketAddress: '0xc01683398fFCc86264ba17bC36977f51A1d25e06', + pTokenUnderlyingAddress: ADDRESSES.bsc.USDC, + }, + USDT_v2_v1_10_2: { + pTokenMarketAddress: '0xddC6Df52F9749ED80966Fb6a9D4C87264cC1e6C1', + pTokenUnderlyingAddress: ADDRESSES.bsc.USDT, + }, + BNB_v2_v1_10_2: { + pTokenMarketAddress: '0xaCD7a2991f3514E215034Ace732Bafe005185C94', + pTokenUnderlyingAddress: ADDRESSES.null, + }, + BTCB_v2_v1_10_2: { + pTokenMarketAddress: '0xA7BCF4433e044e454c43fe596C9eE8DDAF5776aC', + pTokenUnderlyingAddress: ADDRESSES.bsc.BTCB, + }, + ETH_v2_v1_10_2: { + pTokenMarketAddress: '0xBdDc67911C63f63e6720A8EEfCAF08a573Fd9AE4', + pTokenUnderlyingAddress: ADDRESSES.bsc.ETH, + }, +}; + +const POLYGON_POS_MARKETS = { + USDC_v1_v1_10_2: { + pTokenMarketAddress: '0x45913B2088E2910C3Dd168c2f08eaf2274D7bf6c', + pTokenUnderlyingAddress: ADDRESSES.polygon.USDC, + }, + USDT_v1_v1_10_2: { + pTokenMarketAddress: '0x2ce0Ac2FD666a93b70fbE731C9Fe6581f410F73B', + pTokenUnderlyingAddress: ADDRESSES.polygon.USDT, + }, + WBTC_v1_v1_10_2: { + pTokenMarketAddress: '0x786D8B5d16171f441BC5F2047bDf0Ea54268a735', + pTokenUnderlyingAddress: ADDRESSES.polygon.WBTC, + }, +}; + +const PRIME_MARKETS = { + moonbeam: { + networkMarkets: MOONBEAM_MARKETS + }, + avax: { + networkMarkets: AVALANCHE_MARKETS + }, + arbitrum: { + networkMarkets: ARBITRUM_MARKETS + }, + ethereum: { + networkMarkets: ETHEREUM_MARKETS + }, + bsc: { + networkMarkets: BSC_MARKETS + }, + polygon: { + networkMarkets: POLYGON_POS_MARKETS + }, +}; + +async function borrowed(_, _1, _2, { api }) { + const moonbeamApi = new sdk.ChainApi({ chain: 'moonbeam' }); + + const markets = Object.values(PRIME_MARKETS[api.chain].networkMarkets) + let uDecimals = await api.multiCall({ abi: 'erc20:decimals', calls: markets.map(i => i.pTokenUnderlyingAddress), permitFailure: true, }) + uDecimals = uDecimals.map(i => i ?? 18) + let rawTvls = await moonbeamApi.multiCall({ + abi: MASTER_VIEW_CONTRACT.v1_4_6.abi.calculateAssetTVL, + target: MASTER_VIEW_CONTRACT.v1_4_6.address, + calls: markets.map(i => ({ params: [api.getChainId(), i.pTokenMarketAddress] })), + }) + rawTvls.forEach((v, i) => api.add(markets[i].pTokenUnderlyingAddress, v * (10 ** uDecimals[i] / 1e18))) + const tvlBal = await sumTokens2({ balances: {}, api, tokensAndOwners: markets.map(i => [i.pTokenUnderlyingAddress, i.pTokenMarketAddress]) }) + Object.entries(tvlBal).forEach(([token, bal]) => { + api.add(token, bal * -1, { skipChain: true }) + }) +} + +async function tvl(_, _b, _cb, { api, }) { + return sumTokens2({ api, tokensAndOwners: Object.values(PRIME_MARKETS[api.chain].networkMarkets).map(i => [i.pTokenUnderlyingAddress, i.pTokenMarketAddress]) }) +} + +module.exports = { + timetravel: false, + methodology: 'Adds the deposits of each market to the borrows that were not redeposited into that market.', +}; + +Object.keys(PRIME_MARKETS).forEach(chain => { + module.exports[chain] = { tvl, borrowed, } +}) \ No newline at end of file diff --git a/projects/primitive/.prettierrc b/projects/primitive/.prettierrc deleted file mode 100644 index 893983743ed..00000000000 --- a/projects/primitive/.prettierrc +++ /dev/null @@ -1,4 +0,0 @@ -{ - "semi": false, - "singleQuote": true - } \ No newline at end of file diff --git a/projects/primitive/abi.json b/projects/primitive/abi.json index 3214ae8fe3e..bb002254d71 100644 --- a/projects/primitive/abi.json +++ b/projects/primitive/abi.json @@ -1,4 +1,4 @@ { - "risky": {"inputs":[],"name":"risky","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}, - "stable": {"inputs":[],"name":"stable","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"} + "risky": "address:risky", + "stable": "address:stable" } \ No newline at end of file diff --git a/projects/primitive/abis/getAssetAddresses.json b/projects/primitive/abis/getAssetAddresses.json deleted file mode 100644 index e6680113aac..00000000000 --- a/projects/primitive/abis/getAssetAddresses.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "inputs": [], - "name": "getAssetAddresses", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" -} diff --git a/projects/primitive/abis/getCacheBalances.json b/projects/primitive/abis/getCacheBalances.json deleted file mode 100644 index f6929b3bc2b..00000000000 --- a/projects/primitive/abis/getCacheBalances.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "inputs": [], - "name": "getCacheBalances", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" -} diff --git a/projects/primitive/abis/getPair.json b/projects/primitive/abis/getPair.json deleted file mode 100644 index f7f469683a7..00000000000 --- a/projects/primitive/abis/getPair.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "constant": true, - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "getPair", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" -} diff --git a/projects/primitive/abis/getReserves.json b/projects/primitive/abis/getReserves.json deleted file mode 100644 index e3f6fcc11d8..00000000000 --- a/projects/primitive/abis/getReserves.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "constant": true, - "inputs": [], - "name": "getReserves", - "outputs": [ - { - "internalType": "uint112", - "name": "_reserve0", - "type": "uint112" - }, - { - "internalType": "uint112", - "name": "_reserve1", - "type": "uint112" - }, - { - "internalType": "uint32", - "name": "_blockTimestampLast", - "type": "uint32" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" -} diff --git a/projects/primitive/abis/getStrikeTokenAddress.json b/projects/primitive/abis/getStrikeTokenAddress.json deleted file mode 100644 index 7cd9acf8d85..00000000000 --- a/projects/primitive/abis/getStrikeTokenAddress.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "inputs": [], - "name": "getStrikeTokenAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" -} diff --git a/projects/primitive/abis/getUnderlyingTokenAddress.json b/projects/primitive/abis/getUnderlyingTokenAddress.json deleted file mode 100644 index 1bdf6f9b3af..00000000000 --- a/projects/primitive/abis/getUnderlyingTokenAddress.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "inputs": [], - "name": "getUnderlyingTokenAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" -} diff --git a/projects/primitive/abis/redeemToken.json b/projects/primitive/abis/redeemToken.json deleted file mode 100644 index d94f1b8683f..00000000000 --- a/projects/primitive/abis/redeemToken.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "inputs": [], - "name": "redeemToken", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" -} diff --git a/projects/primitive/abis/token0.json b/projects/primitive/abis/token0.json deleted file mode 100644 index eefbeb998a3..00000000000 --- a/projects/primitive/abis/token0.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "constant": true, - "inputs": [], - "name": "token0", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" -} diff --git a/projects/primitive/abis/token1.json b/projects/primitive/abis/token1.json deleted file mode 100644 index cccef25f486..00000000000 --- a/projects/primitive/abis/token1.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "constant": true, - "inputs": [], - "name": "token1", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" -} diff --git a/projects/primitive/v1.js b/projects/primitive/v1.js index fbe331e53c3..2e2ed8db1e9 100644 --- a/projects/primitive/v1.js +++ b/projects/primitive/v1.js @@ -1,32 +1,33 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk') const BigNumber = require('bignumber.js') -const getCacheBalances = require('./abis/getCacheBalances.json') -const getUnderlyingTokenAddress = require('./abis/getUnderlyingTokenAddress.json') -const getStrikeTokenAddress = require('./abis/getStrikeTokenAddress.json') -const redeemToken = require('./abis/redeemToken.json') -const getPair = require('./abis/getPair.json') -const token0 = require('./abis/token0.json') -const token1 = require('./abis/token1.json') -const getReserves = require('./abis/getReserves.json') +const getCacheBalances = 'function getCacheBalances() view returns (uint256, uint256)' +const getUnderlyingTokenAddress = "address:getUnderlyingTokenAddress" +const getStrikeTokenAddress = "address:getStrikeTokenAddress" +const redeemToken = "address:redeemToken" +const getPair = 'function getPair(address, address) view returns (address)' +const token0 = 'address:token0' +const token1 = 'address:token1' +const getReserves = 'function getReserves() view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast)' +const { getLogs } = require('../helper/cache/getLogs') const START_BLOCK = 11142900 const REGISTRY = '0x16274044dab9635Df2B5AeAF7CeCb5f381c71680' const FACTORY = '0xC0AEe478e3658e2610c5F7A4A2E1777cE9e4f2Ac' -const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000' +const ZERO_ADDRESS = ADDRESSES.null -module.exports = async function tvl(_, block) { +module.exports = async function tvl(_, block, _1, { api }) { // ===== Primitive Contracts ===== const logs = ( - await sdk.api.util.getLogs({ - keys: [], - toBlock: block, + await getLogs({ + api, target: REGISTRY, fromBlock: START_BLOCK, topic: 'DeployedOptionClone(address,address,address)', }) - ).output + ) const optionAddresses = logs .map((log) => `0x${log.topics[2].substring(26)}`) diff --git a/projects/printerfinancial/helper.js b/projects/printerfinancial/helper.js index 6553ea9c645..70070cafbac 100644 --- a/projects/printerfinancial/helper.js +++ b/projects/printerfinancial/helper.js @@ -1,8 +1,8 @@ const { staking, stakingUnknownPricedLP } = require("../helper/staking"); const { pool2Exports } = require("../helper/pool2"); const sdk = require("@defillama/sdk"); -const token0Abi = require("../helper/abis/token0.json"); -const token1Abi = require("../helper/abis/token1.json"); +const token0Abi = 'address:token0' +const token1Abi = 'address:token1' const { default: BigNumber } = require("bignumber.js"); function printerTvl(token, share, rewardPool, masonry, pool2LPs, chain = "ethereum", transform = undefined, tokensOnCoingecko = true, lpWithShare = undefined) { diff --git a/projects/printy/index.js b/projects/printy/index.js new file mode 100644 index 00000000000..2e07502f02c --- /dev/null +++ b/projects/printy/index.js @@ -0,0 +1,8 @@ +const { uniTvlExport } = require("../helper/calculateUniTvl.js"); + +module.exports = { + avax: { + tvl: uniTvlExport("0xc62Ca231Cd2b0c530C622269dA02374134511a36", "avax", undefined, undefined, { hasStablePools: true, useDefaultCoreAssets: false, }), + }, +}; + diff --git a/projects/prism/index.js b/projects/prism/index.js index a1d0dc23c5a..3e6fef1b274 100644 --- a/projects/prism/index.js +++ b/projects/prism/index.js @@ -1,30 +1,21 @@ -const { fetchURL } = require('../helper/utils') +const { queryContract } = require('../helper/chain/cosmos') async function tvl() { - const res = await fetchURL( - `https://lcd.terra.dev/wasm/contracts/terra1xw3h7jsmxvh6zse74e4099c6gl03fnmxpep76h/store?query_msg=%7B%22state%22%3A%20%7B%7D%7D` - ) + const res = await queryContract({ chain: 'terra2', contract: 'terra188mmw2vsp0yahen3vh2clup543qrttvdzkxl0h9myfuwjj56nausztpegt', data: { state: {}}}) return { - "terra-luna": res.data.result.total_bond_amount / 1e6, + "terra-luna-2": res.total_bond_amount / 1e6, } } -async function staking() { - const staked = await fetchURL( - `https://lcd.terra.dev/wasm/contracts/terra1042wzrwg2uk6jqxjm34ysqquyr9esdgm5qyswz/store?query_msg=%7B%22token_info%22%3A%20%7B%7D%7D` - ) - - return { - "prism-governance-token": Number(staked.data.result.total_supply) / 1e6 - } -} module.exports = { timetravel: false, terra: { + tvl: () => 0, + }, + terra2: { tvl, - staking, }, hallmarks:[ [1651881600, "UST depeg"], diff --git a/projects/privcash/config.js b/projects/privcash/config.js new file mode 100644 index 00000000000..511b74e7000 --- /dev/null +++ b/projects/privcash/config.js @@ -0,0 +1,27 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress } = require('../helper/unwrapLPs') + +module.exports = { + kava: [ + { + tokens: [nullAddress], // KAVA + holders: [ + "0xCDFfa16631d2b6E78fE9Da3B0454EbF0d2edfFf3", // 100 + "0xfe79e117875993da3c8332Be34B5F06A55c7d154", // 1000 + "0x8Bbd79F1E28006D2e7a6B7B29aa46E236F4DFE07", // 10000 + "0x29d9813881ADB448e9d94ae35a0015c996DB2d40", // 100000 + "0xD58b5EB926F2Ae88372Bb23C6D432932c705C53F", // 1000000 + ], + }, + { + tokens: [ADDRESSES.telos.ETH], // USDC + holders: [ + "0xe4e992802314dbbd8BB9d050afae19ca1c45cB1A", // 10 + "0x8DFB4d1925cC8C7446AfA92f1cDd6c8be567Ae7C", // 100 + "0x00F5E31F0E33FBc23e723dCEd6C078fdD688D36a", // 1000 + "0xCA0d7b385e9DC484C646C50F1BBA6B01CC60E361", // 10000 + "0xc500DA72cCeA705aD5Ee3A4d77ABb1864DD30a4F", // 100000 + ], + } + ] +} diff --git a/projects/privcash/index.js b/projects/privcash/index.js new file mode 100644 index 00000000000..64a6c5cbad9 --- /dev/null +++ b/projects/privcash/index.js @@ -0,0 +1,13 @@ +const { sumTokensExport } = require('../helper/unwrapLPs') + +const config = require('./config.js') + +module.exports = { +}; + +Object.keys(config).forEach(chain => { + const tokensAndOwners = config[chain].map(({ tokens, holders }) => holders.map(o => tokens.map(t => [t, o])).flat()).flat() + module.exports[chain] = { + tvl: sumTokensExport({ tokensAndOwners }) + } +}) \ No newline at end of file diff --git a/projects/protectorate/index.js b/projects/protectorate/index.js new file mode 100644 index 00000000000..20c9813de62 --- /dev/null +++ b/projects/protectorate/index.js @@ -0,0 +1,7 @@ +const { sumERC4626VaultsExport } = require("../helper/erc4626"); + +module.exports = { + ethereum: { + tvl: sumERC4626VaultsExport({ vaults: ["0xaF53431488E871D103baA0280b6360998F0F9926"], }), + }, +} \ No newline at end of file diff --git a/projects/proteo-farms/index.js b/projects/proteo-farms/index.js new file mode 100644 index 00000000000..b1d0f258286 --- /dev/null +++ b/projects/proteo-farms/index.js @@ -0,0 +1,35 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokens } = require('../helper/chain/elrond') + +async function tvl() { + const tokensAndOwners = [ + [ADDRESSES.null, 'erd1qqqqqqqqqqqqqpgqwqxfv48h9ssns5cc69yudvph297veqeeznyqr4l930'], + [ADDRESSES.null, 'erd1qqqqqqqqqqqqqpgqyhj3hk6kkw7405j42g20th3g2h5s8076znyqrpe2pr'], + ['USDC-c76f1f', 'erd1qqqqqqqqqqqqqpgq3lh80a92d49am3t2pfzheapdxtykzt5kznyqsjhfrx'], + ['USDC-c76f1f', 'erd1qqqqqqqqqqqqqpgq25l7fgjdecaanxuuzxnquzs7k80q6mqaznyqzjclf5'], + ['ZPAYWEGLD-34e5c1', 'erd1qqqqqqqqqqqqqpgqrpa6ezy0q4xuj6y9plgv85va43x7wy3dznyqr2rwcz'], + ['ZPAYWEGLD-34e5c1', 'erd1qqqqqqqqqqqqqpgqpn4fnee2mwkqea6x65xdsgp2whfcl964znyqw67z9s'], + ['KROUSDC-7787ab', 'erd1qqqqqqqqqqqqqpgqu693lwsewjvs5f9mssk0fpfex00q77zfznyq4cd0rt'], + ['KROUSDC-7787ab', 'erd1qqqqqqqqqqqqqpgqa6y0t72nglqdlqe7cv5cqjsam2ssm4w3znyqdrphza'], + ['AEROWEGLD-81cc37', 'erd1qqqqqqqqqqqqqpgqapmdgehzl22pu6m5pkvy2fhzm49uxkxhznyqhwhcx5'], + ['AEROWEGLD-81cc37', 'erd1qqqqqqqqqqqqqpgqnedra5da464rkcektgzyv0qxcgqgyh26znyq8q4phx'], + ] + return sumTokens({tokensAndOwners}) +} + +async function pool2() { + const tokensAndOwners = [ + ['PROTEOEGLD-baf054', 'erd1qqqqqqqqqqqqqpgq86drapw9lr2y7vnzwcktc3hvlrev6dugznyqvc6flj'], + ['PROTEOEGLD-baf054', 'erd1qqqqqqqqqqqqqpgq6hzck3wac3ljmth7dkzk2wcw3c9lvcauznyq268sn6'], + ] + + return sumTokens({tokensAndOwners}) +} + +module.exports = { + timetravel: false, + elrond: { + tvl, + pool2, + }, +} \ No newline at end of file diff --git a/projects/protofi/index.js b/projects/protofi/index.js index 1dcc3fbe921..75fe468cc5b 100644 --- a/projects/protofi/index.js +++ b/projects/protofi/index.js @@ -2,6 +2,6 @@ const {uniTvlExport} = require('../helper/calculateUniTvl') module.exports={ fantom:{ - tvl: uniTvlExport("0x39720E5Fe53BEEeb9De4759cb91d8E7d42c17b76", "fantom") + tvl: uniTvlExport("0x39720E5Fe53BEEeb9De4759cb91d8E7d42c17b76", "fantom", true) } } \ No newline at end of file diff --git a/projects/proton-dex/index.js b/projects/proton-dex/index.js new file mode 100644 index 00000000000..18d4bdeecb4 --- /dev/null +++ b/projects/proton-dex/index.js @@ -0,0 +1,82 @@ +const { getTableRows, getCurrencyBalance, getAllOracleData, getTokenPriceUsd } = require("../helper/chain/proton"); +const { get } = require('../helper/http') +const { toUSDTBalances } = require('../helper/balances'); + +const DEX_CONTRACT = 'dex'; + + /** + * It gets all the pools from the pools table in the swap contract. + * @param {string} [lower_bound] - The lower bound of the range of rows to return. + * @returns The `getPools` function returns an array of `RawPool` objects. + */ +async function getMarkets (lower_bound) { + let { rows, more, next_key } = await getTableRows({ + code: DEX_CONTRACT, + scope: DEX_CONTRACT, + table: 'markets', + limit: -1, + key_type: 'i64', + lower_bound + }) + + if (more) { + const moreRows = await this.getPools(next_key) + rows = rows.concat(moreRows) + } + return rows +} + +async function getTokenPrices () { + return get("https://api.protonchain.com/v1/chain/tokens") +} + +async function marketsWithPrices () { + const oracles = await getAllOracleData(); + const markets = await getMarkets(); + const tokenPrices = await getTokenPrices(); + + let tvl = 0; + const marketSet = new Set(); + + for (const market of markets) { + // Find oracle + const oracle = oracles.find( + (oracle) => oracle.feed_index === market.ask_oracle_index + ); + if (!oracle || !oracle.aggregate.d_double) continue; + + // Determine pool amount + const [, symbol] = market.bid_token.sym.split(','); + + if (!marketSet.has(symbol)){ + + marketSet.add(symbol); + + const [cash] = await getCurrencyBalance( + market.bid_token.contract, + DEX_CONTRACT, + symbol + ); + + const tokenPrice = tokenPrices.find((price) => price.account === market.bid_token.contract && price.symbol === symbol).price.usd; + + const [cashAmount] = cash.split(' '); + const total = +cashAmount * tokenPrice; + tvl += total * oracle.aggregate.d_double; + } + } + return tvl; +} + +async function getDexTvl() { + const tvl = await marketsWithPrices(); + return toUSDTBalances(tvl); +} + +module.exports = { + misrepresentedTokens: true, + methodology: `Proton Dex TVL is the sum of pool liquidity on the DEX`, + proton: { + tvl: getDexTvl + }, +} \ No newline at end of file diff --git a/projects/proton-loan/index.js b/projects/proton-loan/index.js index f626a82ee78..47df70645ed 100644 --- a/projects/proton-loan/index.js +++ b/projects/proton-loan/index.js @@ -63,7 +63,7 @@ function getLendingTvl(returnBorrowed = false) { return toUSDTBalances(tvl - borrowed) } } -}; +} async function getTotalStaking() { const loanPrice = await getTokenPriceUsd('LOAN', LOAN_TOKEN_CONTRACT) @@ -71,7 +71,7 @@ async function getTotalStaking() { const [stakedAmount] = staked.split(' '); let stakingTvl = toUSDTBalances(stakedAmount * loanPrice) return stakingTvl -}; +} module.exports = { misrepresentedTokens: true, diff --git a/projects/protoss-dex/abi.js b/projects/protoss-dex/abi.js new file mode 100644 index 00000000000..07114bcb6be --- /dev/null +++ b/projects/protoss-dex/abi.js @@ -0,0 +1,87 @@ +const fabis = [{ + "name": "allPairs", + "type": "function", + "inputs": [ + { + "name": "index", + "type": "felt" + } + ], + "outputs": [ + { + "name": "pair", + "type": "felt" + } + ], + "stateMutability": "view" +}, +{ + "name": "allPairsLength", + "type": "function", + "inputs": [], + "outputs": [ + { + "name": "length", + "type": "felt" + } + ], + "stateMutability": "view" +} +] + +const pabis = [ + { + "name": "token0", + "type": "function", + "inputs": [], + "outputs": [ + { + "name": "token0", + "type": "felt" + } + ], + "stateMutability": "view" + }, + { + "name": "token1", + "type": "function", + "inputs": [], + "outputs": [ + { + "name": "token1", + "type": "felt" + } + ], + "stateMutability": "view" + }, + { + "name": "getReserves", + "type": "function", + "inputs": [], + "outputs": [ + { + "name": "reserve0", + "type": "felt" + }, + { + "name": "reserve1", + "type": "felt" + }, + { + "name": "blockTimestampLast", + "type": "felt" + } + ], + "stateMutability": "view" + }, +] + + +const factory = {} +const pair = {} +fabis.forEach(i => factory[i.name] = i) +pabis.forEach(i => pair[i.name] = i) + +module.exports = { + factory, pair, fabis, pabis, +} \ No newline at end of file diff --git a/projects/protoss-dex/api.js b/projects/protoss-dex/api.js new file mode 100644 index 00000000000..bcfbb200016 --- /dev/null +++ b/projects/protoss-dex/api.js @@ -0,0 +1,38 @@ + +const { call, multiCall, parseAddress } = require('../helper/chain/starknet') +const abi = require('./abi') +const { transformDexBalances } = require('../helper/portedTokens') +const { getParamCalls } = require('../helper/utils') + +async function tvl() { + const factory = '0x04bd9ec70e3ee64fe0adefe0ae4eff797fe07b6fe19d72438db0b6d336ee77c8' + let pairLength = await call({ target: factory, abi: abi.factory.allPairsLength}) + let pairs = await multiCall({ abi: abi.factory.allPairs, target: factory, calls: getParamCalls(+pairLength)}) + + const calls = pairs.map(i => parseAddress(i)) + + const [ token0s, token1s, reserves ] = await Promise.all([ + multiCall({ abi: abi.pair.token0, calls }), + multiCall({ abi: abi.pair.token1, calls }), + multiCall({ abi: abi.pair.getReserves, calls }), + ]) + + const data = [] + reserves.forEach((reserve, i) => { + data.push({ + token0: parseAddress(token0s[i]), + token1: parseAddress(token1s[i]), + token0Bal: +reserve.reserve0, + token1Bal: +reserve.reserve1, + }) + }) + + return transformDexBalances({chain:'starknet', data}) +} + +module.exports = { + timetravel: false, + starknet: { + tvl, + } +} diff --git a/projects/protoss-dex/index.js b/projects/protoss-dex/index.js new file mode 100644 index 00000000000..674e8c995c1 --- /dev/null +++ b/projects/protoss-dex/index.js @@ -0,0 +1 @@ +module.exports = require('./api') \ No newline at end of file diff --git a/projects/prxy/abi.json b/projects/prxy/abi.json deleted file mode 100644 index cbe36284c2b..00000000000 --- a/projects/prxy/abi.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "inputs": [], - "name": "getTVLInUsd", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" -} \ No newline at end of file diff --git a/projects/prxy/index.js b/projects/prxy/index.js index ba1d214c7cd..2fa417bf2bd 100644 --- a/projects/prxy/index.js +++ b/projects/prxy/index.js @@ -1,10 +1,11 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); -const abi = require("./abi.json"); +const abi = "uint256:getTVLInUsd"; const axios = require("axios"); -const usdc = "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"; +const usdc = ADDRESSES.ethereum.USDC; const prxy = "0xab3d689c22a2bb821f50a4ff0f21a7980dcb8591"; const prxyTransformed = `polygon:${prxy}`; -const wbtc = "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599"; +const wbtc = ADDRESSES.ethereum.WBTC; const btcpx = "0x9C32185b81766a051E08dE671207b34466DD1021"; const farmProxy = "0x256116a8Ea8bAd13897462117d88082C464B68e1"; @@ -79,7 +80,7 @@ async function farmPrxyStaking(timestamp, ethBlock, chainBlocks){ chain: "polygon" })).output; -return {'0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48': farmStaking} +return {[ADDRESSES.ethereum.USDC]: farmStaking} } diff --git a/projects/pstake/index.js b/projects/pstake/index.js index edd71ba0554..c138f4be667 100644 --- a/projects/pstake/index.js +++ b/projects/pstake/index.js @@ -1,155 +1,26 @@ -const BigNumber = require("bignumber.js"); -const { request, gql } = require("graphql-request"); -const sdk = require("@defillama/sdk"); -const { transformBscAddress } = require('../helper/portedTokens'); +const { nullAddress } = require('../helper/tokenMapping'); +const { get } = require('../helper/http') -// chains with staking component: -let stkTokensObject = { - stkATOM: "0x44017598f2AF1bD733F9D87b5017b4E7c1B28DDE", - stkXPRT: "0x45e007750Cc74B1D2b4DD7072230278d9602C499", -}; - -let pTokensObject = { - pATOM: "0x446E028F972306B5a2C36E81D3d088Af260132B3", - pXPRT: "0x8793cD84c22B94B1fDD3800f02C4B1dcCa40D50b", -}; -const STKBNB_TOKEN_CONTRACT = '0xc2E9d07F66A89c44062459A47a0D2Dc038E4fb16'; - -const sushiGraphUrl = - "https://api.thegraph.com/subgraphs/name/sushiswap/exchange"; - -// graphQL query to only get the Staking Contract section of the TVL (pool2) -const sushiGraphQuery = gql` - query pstakePairs($stkContract: String, $block: Int) { - pairs(where: { token0: $stkContract }, block: { number: $block }) { - reserve0 - token0 { - decimals - } - } - } -`; +async function bsctvl(timestamp, block, chainBlocks, { api }) { + const bal = await api.call({ abi: 'function exchangeRate() external view returns (uint256 totalWei, uint256 poolTokenSupply)', target: '0xc228cefdf841defdbd5b3a18dfd414cc0dbfa0d8' }) -async function eth(timestamp, block) { - let balances = {}; - - // get the total supply of each stkToken - const stkTokenTotalSupplyValues = await sdk.api.abi.multiCall({ - abi: "erc20:totalSupply", - calls: Object.keys(stkTokensObject).map((t) => ({ - target: stkTokensObject[t], - })), - block, - }); - - // get the total supply of each pToken - const pTokenTotalSupplyValues = await sdk.api.abi.multiCall({ - abi: "erc20:totalSupply", - calls: Object.keys(pTokensObject).map((t) => ({ - target: pTokensObject[t], - })), - block, - }); - - // add the total supply values individually to the balances object - // stkTokenTotalSupplyValues.output.forEach((call, index) => { - for ( - let index = 0; - index < stkTokenTotalSupplyValues.output.length; - index++ - ) { - // ADD THE VALUES OF STKTOKENS - const underlyingStkToken = - stkTokenTotalSupplyValues.output[index].input.target; - const underlyingStkTokenBalance = - stkTokenTotalSupplyValues.output[index].output; - // sumSingleBalance is used to allocate only number of tokens and token address and it is - // supposed to pull the price directly from the usd price in the various pools in defilama - sdk.util.sumSingleBalance( - balances, - underlyingStkToken, - underlyingStkTokenBalance - ); - - // ADD THE VALUES OF PTOKENS AS WELL - // const underlyingPToken = pTokenTotalSupplyValues[index].input.target; - const underlyingPTokenBalance = - pTokenTotalSupplyValues.output[index].output; - // sumSingleBalance is used to allocate only number of tokens and token address and it is - // supposed to pull the price directly from the usd price in the various pools in defilama - sdk.util.sumSingleBalance( - balances, - underlyingStkToken, - underlyingPTokenBalance - ); - } - - return balances; -} - -async function pool2(timestamp, block) { - let balances = {}; - - for (let index = 0; index < Object.values(stkTokensObject).length; index++) { - const { pairs } = await request(sushiGraphUrl, sushiGraphQuery, { - stkContract: Object.values(stkTokensObject) - [index].toString() - .toLocaleLowerCase(), - block: block, - }); - - let reserve0BN = BigNumber(pairs[0].reserve0); - let decimals = Number(pairs[0].token0.decimals); - - const underlyingToken = Object.values(stkTokensObject)[index]; - const underlyingTokenBalance = reserve0BN.shiftedBy(decimals).toString(); - sdk.util.sumSingleBalance( - balances, - underlyingToken, - underlyingTokenBalance - ); - } - - return balances; -} - - -async function bsctvl(timestamp, block, chainBlocks) { - const balances = {}; - const transform = await transformBscAddress(); - - const collateralBalance = (await sdk.api.abi.call({ - abi: { - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - chain: 'bsc', - target: STKBNB_TOKEN_CONTRACT, - block: chainBlocks['bsc'], - })).output; - - sdk.util.sumSingleBalance(balances, transform(STKBNB_TOKEN_CONTRACT), collateralBalance) - - return balances; + return { + ['bsc:' + nullAddress]: bal.totalWei + }; } module.exports = { methodology: `We get the totalSupply of the constituent token contracts (like stkATOM, pATOM, stkXPRT, pXPRT, stkBNB etc.) and then we multiply it with the USD market value of the constituent token`, - ethereum: { - tvl: eth, - pool2: pool2, - }, bsc: { tvl: bsctvl + }, + persistence: { + tvl: async () => { + const api = 'https://api.persistence.one/pstake/stkatom/atom_tvu' + return { + 'cosmos:uatom': (await get(api)).amount.amount + } + } } }; diff --git a/projects/psyoptions/index.js b/projects/psyoptions/index.js index 9fe939a6ea5..c77d0b9ec4c 100644 --- a/projects/psyoptions/index.js +++ b/projects/psyoptions/index.js @@ -1,13 +1,16 @@ -const { - PublicKey, -} = require("@solana/web3.js"); +const { PublicKey } = require("@solana/web3.js"); const { Program } = require("@project-serum/anchor"); const PsyAmericanIdl = require("./idl.json"); -const { getProvider, sumTokens2, } = require("../helper/solana"); +const PsyFiV2Idl = require("./psyfiV2Idl.json"); +const PsyFiMmIdl = require("./psyFiMmIdl.json"); +const PsyLendIdl = require("./psyLendIdl.json"); +const { getProvider, sumTokens2 } = require("../helper/solana"); const textEncoder = new TextEncoder(); -const TOKEN_PROGRAM_ID = new PublicKey('TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA'); +const TOKEN_PROGRAM_ID = new PublicKey( + "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" +); async function getAllOptionAccounts(program) { const accts = await program.account.optionMarket.all(); @@ -24,19 +27,19 @@ async function getPsyAmericanTokenAccounts(anchorProvider) { anchorProvider ); const optionMarkets = await getAllOptionAccounts(program); - const tokensAndOwners = [] + const tokensAndOwners = []; optionMarkets.forEach((market) => { - tokensAndOwners.push([market.underlyingAssetMint.toBase58(), market.key]) - tokensAndOwners.push([market.quoteAssetMint.toBase58(), market.key]) + tokensAndOwners.push([market.underlyingAssetMint.toBase58(), market.key]); + tokensAndOwners.push([market.quoteAssetMint.toBase58(), market.key]); }); - return tokensAndOwners + return tokensAndOwners; } async function getTokenizedEurosControlledAccounts(anchorProvider) { const programId = new PublicKey( "FASQhaZQT53W9eT9wWnPoBFw8xzZDey9TbMmJj6jCQTs" ); - const [poolAuthority] = await PublicKey.findProgramAddress( + const [poolAuthority] = PublicKey.findProgramAddressSync( [textEncoder.encode("poolAuthority")], programId ); @@ -44,16 +47,82 @@ async function getTokenizedEurosControlledAccounts(anchorProvider) { await anchorProvider.connection.getTokenAccountsByOwner(poolAuthority, { programId: TOKEN_PROGRAM_ID, }); - return tokenProgramAccounts.value.map(i => i.pubkey.toString()) + return tokenProgramAccounts.value.map((i) => i.pubkey.toString()); +} + +async function getPsyFiEurosTokenAccounts(anchorProvider) { + const programId = new PublicKey( + "PSYFiYqguvMXwpDooGdYV6mju92YEbFobbvW617VNcq" + ); + const program = new Program(PsyFiV2Idl, programId, anchorProvider); + // Load all vaults + const vaults = await program.account.vaultAccount.all(); + // return all vault collateral accounts + return vaults.map((vault) => + vault.account.vaultCollateralAssetAccount.toString() + ); +} + +async function getPsyFiMmTokenAccounts(anchorProvider) { + const programId = new PublicKey( + "PSYAFJTojpfAjYcHMcFdU89s5hwKA6hgihnvD9Hitue" + ); + const program = new Program(PsyFiMmIdl, programId, anchorProvider); + // Load all vaults + const vaults = await program.account.vaultAccount.all(); + const tokenAccountAddresses = []; + // return all vault collateral accounts + vaults.forEach((vault) => { + tokenAccountAddresses.push( + vault.account.vaultCollateralAssetAccount.toString() + ); + tokenAccountAddresses.push( + vault.account.activeCollateralAccount.toString() + ); + }); + return tokenAccountAddresses; +} + +async function getPsyLendTokenAccounts(anchorProvider) { + const programId = new PublicKey( + "PLENDj46Y4hhqitNV2WqLqGLrWKAaH2xJHm2UyHgJLY" + ); + const program = new Program(PsyLendIdl, programId, anchorProvider); + // Load all Reserve accounts + const reserves = await program.account.reserve.all(); + // Pull all collateral and fee token accounts + const tokenAccountAddresses = []; + reserves.forEach((reserve) => { + tokenAccountAddresses.push(reserve.account.vault.toString()); + tokenAccountAddresses.push(reserve.account.feeNoteVault.toString()); + }); + return tokenAccountAddresses; } async function tvl() { const anchorProvider = getProvider(); - const [ tokensAndOwners, tokenAccounts, ] = await Promise.all([ + const [ + tokensAndOwners, + tokenAccounts, + psyFiV2TokenAccounts, + psyFiMmTokenAccounts, + psyLendTokenAccounts, + ] = await Promise.all([ getPsyAmericanTokenAccounts(anchorProvider), getTokenizedEurosControlledAccounts(anchorProvider), + getPsyFiEurosTokenAccounts(anchorProvider), + getPsyFiMmTokenAccounts(anchorProvider), + getPsyLendTokenAccounts(anchorProvider), ]); - return sumTokens2({ tokenAccounts, tokensAndOwners, }) + return sumTokens2({ + tokenAccounts: [ + ...tokenAccounts, + ...psyFiV2TokenAccounts, + ...psyFiMmTokenAccounts, + ...psyLendTokenAccounts, + ], + tokensAndOwners, + }); } module.exports = { diff --git a/projects/psyoptions/psyFiMmIdl.json b/projects/psyoptions/psyFiMmIdl.json new file mode 100644 index 00000000000..cc437cd50dc --- /dev/null +++ b/projects/psyoptions/psyFiMmIdl.json @@ -0,0 +1,202 @@ +{ + "version": "0.1.0", + "name": "psyfi_euros", + "instructions": [], + "accounts": [ + { + "name": "VaultAccount", + "docs": [ + "Allocated Size = 2000 bytes, incl. buffer.", + "Estimated Rent = 0.0148 SOL", + "Current Size = (32 * 11 + 33 + 24 + 1 * 4 + 5 * 8 + 2)", + "= 455 bytes + 8 bytes overhead." + ], + "type": { + "kind": "struct", + "fields": [ + { + "name": "ownerAuthority", + "docs": [ + "Authorized System Roles" + ], + "type": "publicKey" + }, + { + "name": "managerAuthority", + "type": "publicKey" + }, + { + "name": "taskerAuthority", + "type": "publicKey" + }, + { + "name": "vaultCollateralAssetAccount", + "type": "publicKey" + }, + { + "name": "activeCollateralAccount", + "type": "publicKey" + }, + { + "name": "withdrawalCollateralAssetAccount", + "type": "publicKey" + }, + { + "name": "vaultOwnershipTokenAccount", + "type": "publicKey" + }, + { + "name": "feeTokenAccount", + "docs": [ + "Receipient of fees. Account can be owned by anyone and has to have", + "collateral asset as mint." + ], + "type": "publicKey" + }, + { + "name": "collateralAssetMint", + "type": "publicKey" + }, + { + "name": "vaultOwnershipTokenMint", + "type": "publicKey" + }, + { + "name": "seedVaultTokenPerCollateral", + "docs": [ + "Vault Constants", + "Used for calculating number of tokens for first deposit into the Vault." + ], + "type": { + "defined": "ExchangeRate" + } + }, + { + "name": "endingExchangeRateDecimals", + "docs": [ + "Decimals used for setting the epoch ending exchange rates." + ], + "type": "u8" + }, + { + "name": "strategyType", + "type": "u8" + }, + { + "name": "vaultAccountBump", + "type": "u8" + }, + { + "name": "uniqueSeed", + "docs": [ + "Additional seed for Vault Account with the same collateral type and strategy." + ], + "type": "u16" + }, + { + "name": "maxDeposits", + "docs": [ + "Vault Parameters (Modifiable by Vault Owner)" + ], + "type": "u64" + }, + { + "name": "fees", + "type": { + "defined": "VaultFees" + } + }, + { + "name": "currentEpoch", + "docs": [ + "Vault State" + ], + "type": "u64" + }, + { + "name": "currentEpochHistory", + "type": "publicKey" + }, + { + "name": "pendingCollateralAssetDeposits", + "type": "u64" + }, + { + "name": "pendingWithdrawalTokens", + "type": "u64" + }, + { + "name": "initiatedDebt", + "type": "u64" + }, + { + "name": "optionsActive", + "type": "bool" + } + ] + } + } + ], + "types": [ + { + "name": "ExchangeRate", + "docs": [ + "Size = 33 bytes" + ], + "type": { + "kind": "struct", + "fields": [ + { + "name": "rate", + "docs": [ + "The number of units of the \"to\" asset to receive per unit of the \"from\"", + "asset. This number is in the native \"to\" units, adjusted by the decimals", + "of the exchange rate, to support higher precision rates." + ], + "type": "u128" + }, + { + "name": "decimals", + "docs": [ + "Decimals for the exchange rate" + ], + "type": "u8" + } + ] + } + }, + { + "name": "VaultFees", + "docs": [ + "Size = 24 bytes" + ], + "type": { + "kind": "struct", + "fields": [ + { + "name": "managementFeeBps", + "docs": [ + "Percentage fee to collect on collateral asset per epoch." + ], + "type": "u64" + }, + { + "name": "performanceFeeBps", + "docs": [ + "Percentage fee to collect on Option Sale per epoch." + ], + "type": "u64" + }, + { + "name": "withdrawalFeeBps", + "docs": [ + "Percentage fee to collect on withdrawal." + ], + "type": "u64" + } + ] + } + } + ], + "errors": [] + } \ No newline at end of file diff --git a/projects/psyoptions/psyLendIdl.json b/projects/psyoptions/psyLendIdl.json new file mode 100644 index 00000000000..44975e322d9 --- /dev/null +++ b/projects/psyoptions/psyLendIdl.json @@ -0,0 +1,380 @@ +{ + "version": "0.1.0", + "name": "psylend", + "instructions": [], + "accounts": [ + { + "name": "Reserve", + "type": { + "kind": "struct", + "fields": [ + { + "name": "version", + "type": "u16" + }, + { + "name": "index", + "docs": [ + "The unique id for this reserve within the market.", + "Note: Should correspond to index of the `reserve_info` Vec on the market" + ], + "type": "u16" + }, + { + "name": "exponent", + "docs": [ + "The base 10 decimals used for token values", + "Note: Typically stored as a negative to reflect the Pyth value, but the absolute value is", + "used everywhere, so a positive number of equal magnitude can be used." + ], + "type": "i32" + }, + { + "name": "market", + "docs": [ + "The market this reserve is a part of." + ], + "type": "publicKey" + }, + { + "name": "pythOraclePrice", + "docs": [ + "The account where a Pyth oracle keeps the updated price of the token." + ], + "type": "publicKey" + }, + { + "name": "pythOracleProduct", + "docs": [ + "The account where a Pyth oracle keeps metadata about the token." + ], + "type": "publicKey" + }, + { + "name": "tokenMint", + "docs": [ + "The mint for the token being held in this reserve" + ], + "type": "publicKey" + }, + { + "name": "depositNoteMint", + "docs": [ + "The mint for this reserve's deposit notes. Uses `token_mint` decimals." + ], + "type": "publicKey" + }, + { + "name": "loanNoteMint", + "docs": [ + "The mint for this reserve's loan notes. Uses `token_mint` decimals." + ], + "type": "publicKey" + }, + { + "name": "vault", + "docs": [ + "The account with custody over the reserve's tokens." + ], + "type": "publicKey" + }, + { + "name": "feeNoteVault", + "docs": [ + "The account with custody of the notes generated from collected fees" + ], + "type": "publicKey" + }, + { + "name": "dexSwapTokens", + "docs": [ + "The account for storing quote tokens during a swap" + ], + "type": "publicKey" + }, + { + "name": "dexOpenOrders", + "docs": [ + "The account used for trading with the DEX" + ], + "type": "publicKey" + }, + { + "name": "dexMarket", + "docs": [ + "The DEX market account that this reserve can trade in" + ], + "type": "publicKey" + }, + { + "name": "reserved0", + "type": { + "array": [ + "u8", + 408 + ] + } + }, + { + "name": "config", + "type": { + "defined": "ReserveConfig" + } + }, + { + "name": "psyfiVaultConfig", + "type": { + "defined": "PsyFiVaultConfig" + } + }, + { + "name": "discountRate", + "docs": [ + "Discount rate for the token this reserve uses, updated from the common discounts account" + ], + "type": "u16" + }, + { + "name": "discountRateVersion", + "docs": [ + "Current version of the discount rate. If lower than the version in the discounts account,", + "should be updated." + ], + "type": "u16" + }, + { + "name": "haltState", + "docs": [ + "Indicates if the reserve has halted borrows, repays, or deposits:", + "", + "0 (0b00000000) = nothing halted,", + "1 (0b00000001) = deposits halted,", + "2 (0b00000010) = borrows halted,", + "4 (0b00000100) = repays halted,", + "8 (0b00001000) = withdraws halted", + "", + "Allows addition or bitwise AND to combine multiple states:", + "(e.g., 4 + 2 = 6 (0b00000110) = borrows and repays halted, others allowed)" + ], + "type": "u8" + }, + { + "name": "reserved1", + "type": { + "array": [ + "u8", + 123 + ] + } + }, + { + "name": "reserved2", + "type": { + "array": [ + "u128", + 32 + ] + } + }, + { + "name": "state", + "type": { + "array": [ + "u8", + 3584 + ] + } + } + ] + } + } + ], + "types": [ + { + "name": "PsyFiVaultConfig", + "type": { + "kind": "struct", + "fields": [ + { + "name": "vaultAccount", + "type": "publicKey" + }, + { + "name": "collateralTokenDecimals", + "type": "u8" + }, + { + "name": "reserved1", + "type": { + "array": [ + "u8", + 31 + ] + } + }, + { + "name": "reserved2", + "type": { + "array": [ + "u8", + 64 + ] + } + } + ] + } + }, + { + "name": "ReserveConfig", + "docs": [ + "We have three interest rate regimes. The rate is described by a continuous,", + "piecewise-linear function of the utilization rate:", + "1. zero to [utilization_rate_1]: borrow rate increases linearly from", + "[borrow_rate_0] to [borrow_rate_1].", + "2. [utilization_rate_1] to [utilization_rate_2]: borrow rate increases linearly", + "from [borrow_rate_1] to [borrow_rate_2].", + "3. [utilization_rate_2] to one: borrow rate increases linearly from", + "[borrow_rate_2] to [borrow_rate_3].", + "", + "Interest rates are nominal annual amounts, compounded continuously with", + "a day-count convention of actual-over-365. The accrual period is determined", + "by counting slots, and comparing against the number of slots per year." + ], + "type": { + "kind": "struct", + "fields": [ + { + "name": "utilizationRate1", + "docs": [ + "The utilization rate at which we switch from the first to second regime." + ], + "type": "u16" + }, + { + "name": "utilizationRate2", + "docs": [ + "The utilization rate at which we switch from the second to third regime." + ], + "type": "u16" + }, + { + "name": "borrowRate0", + "docs": [ + "The lowest borrow rate in the first regime. Essentially the minimum", + "borrow rate possible for the reserve." + ], + "type": "u16" + }, + { + "name": "borrowRate1", + "docs": [ + "The borrow rate at the transition point from the first to second regime." + ], + "type": "u16" + }, + { + "name": "borrowRate2", + "docs": [ + "The borrow rate at the transition point from the second to thirs regime." + ], + "type": "u16" + }, + { + "name": "borrowRate3", + "docs": [ + "The highest borrow rate in the third regime. Essentially the maximum", + "borrow rate possible for the reserve." + ], + "type": "u16" + }, + { + "name": "minCollateralRatio", + "docs": [ + "The minimum allowable collateralization ratio for an obligation" + ], + "type": "u16" + }, + { + "name": "liquidationPremium", + "docs": [ + "The amount given as a bonus to a liquidator" + ], + "type": "u16" + }, + { + "name": "manageFeeCollectionThreshold", + "docs": [ + "The threshold at which to collect the fees accumulated from interest into", + "real deposit notes." + ], + "type": "u64" + }, + { + "name": "manageFeeRate", + "docs": [ + "The fee rate applied to the interest payments collected" + ], + "type": "u16" + }, + { + "name": "loanOriginationFee", + "docs": [ + "The fee rate applied as interest owed on new loans" + ], + "type": "u16" + }, + { + "name": "reserved0", + "docs": [ + "unused" + ], + "type": "u16" + }, + { + "name": "confidenceThreshold", + "docs": [ + "Represented as a percentage of the Price", + "confidence values above this will not be accepted" + ], + "type": "u16" + }, + { + "name": "liquidationDexTradeMax", + "docs": [ + "The maximum token amount to allow in a single DEX trade when", + "liquidating assetr from this reserve as collateral." + ], + "type": "u64" + }, + { + "name": "depositRewardMultiplier", + "docs": [ + "Multiplier that determines the fraction of reward points (by dividing over", + "sum of all multiplier for the market) allocated for deposit notes." + ], + "type": "u8" + }, + { + "name": "borrowRewardMultiplier", + "docs": [ + "Multiplier that determines the fraction of reward points (by dividing over", + "sum of all multiplier for the market) allocated for loan notes." + ], + "type": "u8" + }, + { + "name": "reserved1", + "type": { + "array": [ + "u8", + 22 + ] + } + } + ] + } + } + ], + "events": [], + "errors": [] + } \ No newline at end of file diff --git a/projects/psyoptions/psyfiV2Idl.json b/projects/psyoptions/psyfiV2Idl.json new file mode 100644 index 00000000000..320627cbf53 --- /dev/null +++ b/projects/psyoptions/psyfiV2Idl.json @@ -0,0 +1,302 @@ +{ + "version": "0.1.5", + "name": "psyfi_euros", + "instructions": [], + "accounts": [ + { + "name": "VaultAccount", + "docs": [ + "Allocated Size = 2000 bytes, incl. buffer.", + "Estimated Rent = 0.0148 SOL", + "Current Size = (32 * 13 + 33 + 24 + 1 * 4 + 10 * 8 + 2) + 43 * 4", + "= 731 bytes" + ], + "type": { + "kind": "struct", + "fields": [ + { + "name": "ownerAuthority", + "docs": [ + "Authorized System Roles" + ], + "type": "publicKey" + }, + { + "name": "managerAuthority", + "type": "publicKey" + }, + { + "name": "taskerAuthority", + "type": "publicKey" + }, + { + "name": "vaultCollateralAssetAccount", + "type": "publicKey" + }, + { + "name": "withdrawalCollateralAssetAccount", + "type": "publicKey" + }, + { + "name": "vaultOwnershipTokenAccount", + "type": "publicKey" + }, + { + "name": "feeTokenAccount", + "docs": [ + "Receipient of fees. Account can be owned by anyone and has to have", + "collateral asset as mint." + ], + "type": "publicKey" + }, + { + "name": "collateralAssetMint", + "type": "publicKey" + }, + { + "name": "quoteAssetMint", + "type": "publicKey" + }, + { + "name": "vaultOwnershipTokenMint", + "type": "publicKey" + }, + { + "name": "oracle", + "type": "publicKey" + }, + { + "name": "seedVaultTokenPerCollateral", + "docs": [ + "Vault Constants", + "Used for calculating number of tokens for first deposit into the Vault." + ], + "type": { + "defined": "ExchangeRate" + } + }, + { + "name": "endingExchangeRateDecimals", + "docs": [ + "Decimals used for setting the epoch ending exchange rates." + ], + "type": "u8" + }, + { + "name": "strategyType", + "type": "u8" + }, + { + "name": "vaultAccountBump", + "type": "u8" + }, + { + "name": "uniqueSeed", + "docs": [ + "Additional seed for Vault Account with the same collateral type and strategy." + ], + "type": "u16" + }, + { + "name": "maxDeposits", + "docs": [ + "Vault Parameters (Modifiable by Vault Owner)" + ], + "type": "u64" + }, + { + "name": "fees", + "type": { + "defined": "VaultFees" + } + }, + { + "name": "currentEpoch", + "docs": [ + "Vault State" + ], + "type": "u64" + }, + { + "name": "currentEpochHistory", + "type": "publicKey" + }, + { + "name": "pendingCollateralAssetDeposits", + "type": "u64" + }, + { + "name": "pendingWithdrawalTokens", + "type": "u64" + }, + { + "name": "optionsCollateralHeld", + "docs": [ + "Amount held as collateral by EuroPrimitive program for options minted." + ], + "type": "u64" + }, + { + "name": "optionsActive", + "type": "bool" + }, + { + "name": "auctionCurrencyMint", + "type": "publicKey" + }, + { + "name": "oracleProviderId", + "docs": [ + "An oracle provider identifier" + ], + "type": "u8" + }, + { + "name": "vaultOwnershipTokenSupply", + "docs": [ + "Cached Vault States. Used primarily for pricing of vault token without reading other", + "additional accounts." + ], + "type": "u64" + }, + { + "name": "vaultCollateralAssetAccountAmount", + "type": "u64" + }, + { + "name": "currentOptionSaleAmount", + "type": "u64" + }, + { + "name": "reserved1", + "type": "u64" + }, + { + "name": "reserved2", + "type": "u64" + }, + { + "name": "euroMetaCache", + "docs": [ + "Caches state of options minted. Each EuroMetaCache corresponds to", + "euro_meta and respective accounts in epoch_history.option_market_meta_vec." + ], + "type": { + "array": [ + { + "defined": "EuroMetaCache" + }, + 4 + ] + } + } + ] + } + } + ], + "types": [ + { + "name": "EuroMetaCache", + "docs": [ + "Size = (8 * 5 + 1 * 3) = 43 bytes" + ], + "type": { + "kind": "struct", + "fields": [ + { + "name": "strikePrice", + "type": "u64" + }, + { + "name": "strikePriceDecimals", + "type": "u8" + }, + { + "name": "writerTokenAmount", + "type": "u64" + }, + { + "name": "writerTokenDecimals", + "type": "u8" + }, + { + "name": "optionTokenAmount", + "type": "u64" + }, + { + "name": "optionTokenDecimals", + "type": "u8" + }, + { + "name": "reserved1", + "type": "u64" + }, + { + "name": "reserved2", + "type": "u64" + } + ] + } + }, + { + "name": "ExchangeRate", + "docs": [ + "Size = 33 bytes" + ], + "type": { + "kind": "struct", + "fields": [ + { + "name": "rate", + "docs": [ + "The number of units of the \"to\" asset to receive per unit of the \"from\"", + "asset. This number is in the native \"to\" units, adjusted by the decimals", + "of the exchange rate, to support higher precision rates." + ], + "type": "u128" + }, + { + "name": "decimals", + "docs": [ + "Decimals for the exchange rate" + ], + "type": "u8" + } + ] + } + }, + { + "name": "VaultFees", + "docs": [ + "Size = 24 bytes" + ], + "type": { + "kind": "struct", + "fields": [ + { + "name": "managementFeeBps", + "docs": [ + "Percentage fee to collect on collateral asset per epoch." + ], + "type": "u64" + }, + { + "name": "performanceFeeBps", + "docs": [ + "Percentage fee to collect on Option Sale per epoch." + ], + "type": "u64" + }, + { + "name": "withdrawalFeeBps", + "docs": [ + "Percentage fee to collect on withdrawal." + ], + "type": "u64" + } + ] + } + } + ], + "errors": [] + } \ No newline at end of file diff --git a/projects/puddingswap/index.js b/projects/puddingswap/index.js index c8ab38925fd..b2ea0e18d03 100644 --- a/projects/puddingswap/index.js +++ b/projects/puddingswap/index.js @@ -3,7 +3,6 @@ const { getUniTVL } = require('../helper/unknownTokens') module.exports = { hoo: { tvl: getUniTVL({ - chain: 'hoo', factory: '0x6168D508ad65D87f8F5916986B55d134Af7153bb', useDefaultCoreAssets: true, }), diff --git a/projects/puli/index.js b/projects/puli/index.js index 86be572f137..54790723102 100644 --- a/projects/puli/index.js +++ b/projects/puli/index.js @@ -1,26 +1,6 @@ -const PULI_TOKEN_CONTRACT = '0xaef0a177c8c329cbc8508292bb7e06c00786bbfc'; -const { sumTokensExport, nullAddress, } = require('../helper/unknownTokens') -// const PULI_TOKEN_STAKING_CONTRACT = '0x864d434308997e9648838d23f3eedf5d0fd17bea'; -const chain = 'bsc' -const TREASURY1 = '0xc569C21b0862B112Ed69bA9d2C6e9Ed86A036f9C' -const TREASURY2 = '0xA017862ADba59aA030b8aA0433eD91D9d909B8B1' - -async function tvl(timestamp, block, chainBlocks) { - return {} -} module.exports = { bsc: { - tvl, - treasury: sumTokensExport({ - chain, - tokensAndOwners: [ - [nullAddress, TREASURY1], - [nullAddress, TREASURY2], - ['0xe9e7cea3dedca5984780bafc599bd69add087d56', TREASURY1], - ['0xC17c30e98541188614dF99239cABD40280810cA3', TREASURY1], - ['0x3FF5cbE338153063D8251d2B6a22A437EC09Eef3', TREASURY2], - ], - }) + tvl: () => 0 } } diff --git a/projects/pulsarswap/index.js b/projects/pulsarswap/index.js new file mode 100644 index 00000000000..eca81a5832e --- /dev/null +++ b/projects/pulsarswap/index.js @@ -0,0 +1,20 @@ +const { sumTokens2 } = require('../helper/unwrapLPs') +const config = { + arbitrum: '0x336a2f76d2be24e7cb6f468665a4277d4d617d00', + ethereum: '0x408f66057163d829a30d4d466092c6b0eebb692f', + mantle: '0xB5B03706C24c79D3F7a368b30562a1711d74F688', +} + +module.exports = {}; + +Object.keys(config).forEach(chain => { + const factory = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const pairs = await api.fetchList({ lengthAbi: 'uint256:allPairsLength', itemAbi: 'function allPairs(uint256) view returns (address)', target: factory}) + const tokenA = await api.multiCall({ abi: 'address:tokenA', calls: pairs}) + const tokenB = await api.multiCall({ abi: 'address:tokenB', calls: pairs}) + return sumTokens2({ api, ownerTokens: pairs.map((v, i) => [[tokenA[i], tokenB[i]], v])}) + } + } +}) \ No newline at end of file diff --git a/projects/pulsedao/index.js b/projects/pulsedao/index.js index 9b0fdbc954e..f05a113ee06 100644 --- a/projects/pulsedao/index.js +++ b/projects/pulsedao/index.js @@ -10,6 +10,9 @@ const lps = [ ] module.exports = { + hallmarks: [ + [1647216000, "Rug Pull"] + ], deadFrom: 1648765747, misrepresentedTokens: true, ...tombTvl(pld, pshare, rewardPool, boardroom, lps, "fantom", undefined, false, lps[1]) diff --git a/projects/pulsemaxfinance/index.js b/projects/pulsemaxfinance/index.js new file mode 100644 index 00000000000..40b9adf5320 --- /dev/null +++ b/projects/pulsemaxfinance/index.js @@ -0,0 +1,17 @@ +const { tombTvl } = require("../helper/tomb"); + +const max = "0x368acF537B1A8EfFE4ceEF11054CBcEAF0302086"; +const pshare = "0xbc57572Ba711C8077222142C3374acE7B0c92231"; +const rewardpool = "0xEb8A0191Fa31F7aCEDeDe618246f7f7f907139bA"; +const boardroom = "0x4c5c8fD88Ba0709949e3C5Be3502500112Cd026c"; + +const pool2LPs = [ + "0x32D1D76bA3df143C7258d933dAfB048f137c42BA", // PSHARE-DAI + "0x0edC492E29Ce7bEd4c71f83513E435f5d81cDEF9", // MAX-DAI + "0x99B45b6f0Dd06866C955207c96431cDA2DA1d34b" // MAX-PSHARE +] + +module.exports = { + misrepresentedTokens: true, + ...tombTvl(max, pshare, rewardpool, boardroom, pool2LPs, "pulse", undefined, false, pool2LPs[0]) +} diff --git a/projects/pulserate/index.js b/projects/pulserate/index.js new file mode 100644 index 00000000000..feca6b1e783 --- /dev/null +++ b/projects/pulserate/index.js @@ -0,0 +1,22 @@ +const { getUniTVL, sumTokensExport } = require("../helper/unknownTokens"); +const PSHARE = "0x11D4109Cd7E5cE596471583E90e20e51d087de33"; +module.exports = { + misrepresentedTokens: true, + methodology: + "Factory address (0xE2332E5297b18a21DcE0E6ac461e821C353A00cA) is used to find the LP pairs. TVL is equal to the liquidity on the AMM. Staking balance is equal to the balance of PSHARE in Boardroom contract", + pulse: { + tvl: getUniTVL({ + factory: "0xE2332E5297b18a21DcE0E6ac461e821C353A00cA", + useDefaultCoreAssets: true, + fetchBalances: true, + }), + staking: sumTokensExport({ + owners: ["0xD7A2F5A72079654E7997C615cC07A1b92D850b32"], + tokens: [PSHARE], + lps: [ + '0x91d3E933B7f2ccBAdf4d5278d826Cb10659a1c55', + ], + useDefaultCoreAssets: true, + }), + }, +}; diff --git a/projects/pulsex-v2/index.js b/projects/pulsex-v2/index.js new file mode 100644 index 00000000000..9cec9bf6849 --- /dev/null +++ b/projects/pulsex-v2/index.js @@ -0,0 +1,8 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports = { + misrepresentedTokens: true, + pulse: { + tvl: getUniTVL({ factory: '0x29ea7545def87022badc76323f373ea1e707c523', useDefaultCoreAssets: true }), + }, +}; // node test.js projects/pulsex/index.js \ No newline at end of file diff --git a/projects/pulsex/index.js b/projects/pulsex/index.js new file mode 100644 index 00000000000..c2a330054c4 --- /dev/null +++ b/projects/pulsex/index.js @@ -0,0 +1,10 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports = { + misrepresentedTokens: true, + methodology: + "Factory address (0x1715a3E4A142d8b698131108995174F37aEBA10D) is used to find the LP pairs. TVL is equal to the liquidity on the AMM.", + pulse: { + tvl: getUniTVL({ factory: '0x1715a3E4A142d8b698131108995174F37aEBA10D', useDefaultCoreAssets: true }), + }, +}; // node test.js projects/pulsex/index.js \ No newline at end of file diff --git a/projects/pumpkin-dao/index.js b/projects/pumpkin-dao/index.js index c8b78974be9..92327e523d4 100644 --- a/projects/pumpkin-dao/index.js +++ b/projects/pumpkin-dao/index.js @@ -1,15 +1,16 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { ohmTvl } = require("../helper/ohm"); const treasuryAddress = "0x0DEA39519cb8c7c549e321d3020E96f91Ed36Ed3"; module.exports = ohmTvl(treasuryAddress, [ //DAI - ["0x8d11ec38a3eb5e956b052f67da8bdc9bef8abf3e", false], + [ADDRESSES.fantom.DAI, false], //wFTM - ["0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83", false], + [ADDRESSES.fantom.WFTM, false], //SPOOKY LP ["0xdf42866dc8fa6a962124b5d9eb8c91fa447f4feb", true] , //SPOOKY LP ["0x01e7f6506bc3661dc690a0a076ace9d3d0253d92", true] ], "fantom", "0x5d189D8224a9aFBc3eC69bedBe2f6dd89B937E73", "0x8eDDA0107D661E82df660DBa01Ff1D40FA17B70c" , addr=> - addr.toLowerCase()==="0x8d11ec38a3eb5e956b052f67da8bdc9bef8abf3e"?"0x6b175474e89094c44da98b954eedeac495271d0f":`fantom:${addr}` + addr.toLowerCase()===ADDRESSES.fantom.DAI?[ADDRESSES.ethereum.DAI]:`fantom:${addr}` , undefined, false) \ No newline at end of file diff --git a/projects/purple-bridge-dex/index.js b/projects/purple-bridge-dex/index.js new file mode 100644 index 00000000000..aa1627babb7 --- /dev/null +++ b/projects/purple-bridge-dex/index.js @@ -0,0 +1,8 @@ +const { getUniTVL } = require("../helper/unknownTokens"); + +module.exports = { + misrepresentedTokens: true, + polygon: { + tvl: getUniTVL({factory: '0x9c9238b2E47D61482D36deaFcDCD448D8bAAd75b', useDefaultCoreAssets: true, }), + } +} \ No newline at end of file diff --git a/projects/puzzle-lend/index.js b/projects/puzzle-lend/index.js new file mode 100644 index 00000000000..3afd009b4b1 --- /dev/null +++ b/projects/puzzle-lend/index.js @@ -0,0 +1,3 @@ +const { wavesExport } = require('../helper/chain/wavesAdapter') + +module.exports = wavesExport('/puzzlelend') \ No newline at end of file diff --git a/projects/pxswap/index.js b/projects/pxswap/index.js new file mode 100644 index 00000000000..f3db5efae14 --- /dev/null +++ b/projects/pxswap/index.js @@ -0,0 +1,10 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const sdk = require('@defillama/sdk') +const { sumTokensExport } = require('../helper/unwrapLPs') + +const contract = "0x638B06F80FB28F109E65C9d5cC585aDf9A0c3f9f" +const usdcToken = ADDRESSES.telos.ETH + +module.exports = { + kava: { tvl: sumTokensExport({ owner: contract, tokens: [usdcToken]}) }, +} diff --git a/projects/pyeswap/index.js b/projects/pyeswap/index.js index 6d4d6c4477e..575fef9eaa7 100644 --- a/projects/pyeswap/index.js +++ b/projects/pyeswap/index.js @@ -5,7 +5,6 @@ module.exports = { bsc: { tvl: getUniTVL({ factory: '0xb664bdce35b5ee182e8832d4f3b615232e98a51e', - chain: 'bsc', useDefaultCoreAssets: true }) }, diff --git a/projects/pylon/index.js b/projects/pylon/index.js index 487a9684ba8..2d76fbdb89a 100644 --- a/projects/pylon/index.js +++ b/projects/pylon/index.js @@ -1,71 +1,8 @@ -const { queryContractStore, getBalance, sumSingleBalance, getDenomBalance, TOKEN_LIST, } = require('../helper/chain/terra') - -// taken from https://api.pylon.money/api/gateway/v1/projects/ -const pools = [ - "terra1z5j60wct88yz62ylqa4t8p8239cwx9kjlghkg2", - "terra149fxy4crxnhy4z2lezefwe7evjthlsttyse20m", - "terra1he8j44cv2fcntujjnsqn3ummauua555agz4js0", - "terra1xu84jh7x2ugt3gkpv8d450hdwcyejtcwwkkzgv", - "terra1zxtcxxjqp7c46g8jx0t25s5ysa5qawmwd2w7nr", - "terra1jk0xh49ft2ls4u9dlfqweed8080u6ysumvmtcz", - "terra15y9r79wlu8uqvlu3k7vgv0kgdy29m8j9tt9xgg", - "terra19zn5u7ej083em99was4y02j3yhracnxwxcvmt4", - "terra15y70slq4l4s5da2etsyqasyjht0dnquj03qm05", - "terra1g9kzlt58ycppx9elymnrgxmwssfawym668r2y4", - "terra1he8ymhmqmtuu5699akwk94urap6z09xnnews32", - "terra1vftcl08p73v3nkuwvv5ntznku44s7p2tq00mgn", - "terra132u62nsympysvtg3nng5xg6tjf6cr8sxrq7ena", - "terra1dyattlzq58ty7pat337a9dz6j46thldu5gn8ls", - "terra1xkw8vusucy9c2w9hxuw6lktxk2w8g72utdyq96", - "terra1jzsjs8qx9ehsukzea9smuqtfuklmngmeh5csl3" -] - -// Pools in https://gateway.pylon.money/ -async function tvl() { - const balances = {} - for (const pool of pools) { - const [aUSTBalance, ustcBalance] = await Promise.all([ - getBalance(TOKEN_LIST.anchorust, pool), - getDenomBalance('uusd', pool), - ]) - sumSingleBalance(balances, TOKEN_LIST.anchorust, aUSTBalance) - sumSingleBalance(balances, TOKEN_LIST.terrausd, ustcBalance) - } - - Object.entries(balances).forEach(([t, v]) => balances[t] = Number(v).toFixed(0)) - return balances -} - -async function pool2() { - const { assets } = await queryContractStore({ contract: 'terra134m8n2epp0n40qr08qsvvrzycn2zq4zcpmue48', queryParam: { "pool": {} } }) - let pylonAmount - let uusdAmount - - assets.forEach(i => { - if (i.info.token) pylonAmount = i.amount / 1e6 - else uusdAmount = i.amount / 1e6 - }) - - return { - "pylon-protocol": pylonAmount, - "terrausd": uusdAmount, - } -} - -async function staking() { - const { balance } = await queryContractStore({ contract: 'terra1kcthelkax4j9x8d3ny6sdag0qmxxynl3qtcrpy', queryParam: { "balance": { "address": "terra1xu8utj38xuw6mjwck4n97enmavlv852zkcvhgp" } } }) - return { - "pylon-protocol": balance / 1e6 - } -} - module.exports = { timetravel: false, methodology: 'TVL counts the UST that has been deposted to the Protocol. Data is pulled from the Pylon API:"https://api.pylon.money/api/launchpad/v1/projects/mine".', terra: { - pool2, - staking, - tvl + tvl: () => ({}), }, hallmarks:[ [1651881600, "UST depeg"], diff --git a/projects/qian/abi.json b/projects/qian/abi.json index 6dfb557a3a3..0163b194160 100644 --- a/projects/qian/abi.json +++ b/projects/qian/abi.json @@ -1,53 +1,11 @@ { "asset": { - "balances": { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "name": "balances", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } + "balances": "function balances(address token) view returns (uint256)" }, "balance": { - "gsupply": { - "inputs": [], - "name": "gsupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } + "gsupply": "uint256:gsupply" }, "env": { - "tokens": { - "inputs": [], - "name": "tokens", - "outputs": [ - { - "internalType": "address[]", - "name": "", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - } + "tokens": "address[]:tokens" } } diff --git a/projects/qidao/index.js b/projects/qidao/index.js index 27af81fec18..e1d8e0f58ed 100644 --- a/projects/qidao/index.js +++ b/projects/qidao/index.js @@ -1,87 +1,162 @@ -const { sumTokens, unwrapUniswapLPs } = require("../helper/unwrapLPs"); +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokens2, nullAddress, } = require("../helper/unwrapLPs"); const sdk = require("@defillama/sdk"); -const abi = require("./abi.json"); -const { BigNumber } = require("bignumber.js"); -const { getFixBalancesSync, getChainTransform } = require("../helper/portedTokens"); -const { handleYearnTokens } = require("../creditum/helper.js"); -const { getBlock } = require('../helper/getBlock'); -async function handleMooTokens(balances, block, chain, tokens) { - const transformAddress = await getChainTransform(chain) - let balance = ( - await sdk.api.abi.multiCall({ - calls: tokens.map((p) => ({ - target: p[0], - params: p[1], - })), - abi: "erc20:balanceOf", - block, - chain, - }) - ).output; - let pricePerShare = ( - await sdk.api.abi.multiCall({ - calls: tokens.map((p) => ({ - target: p[0], - })), - abi: abi.getPricePerFullShare, - block, - chain, - }) - ).output; - for (let i = 0; i < balance.length; i++) { - let addr = balance[i].input.target.toLowerCase(); - sdk.util.sumSingleBalance( - balances, - transformAddress(addr), - BigNumber(balance[i].output) - .times(pricePerShare[i].output).div(1e18) - .toFixed(0) - ); - } -} - -async function handleMooLPs(balances, block, chain, tokens) { - let lpBalances = ( - await sdk.api.abi.multiCall({ - calls: tokens.map((p) => ({ - target: p[1], - params: p[0], - })), - abi: "erc20:balanceOf", - block, - chain, - }) - ).output; - let pricePerShare = ( - await sdk.api.abi.multiCall({ - calls: tokens.map((p) => ({ - target: p[1], - })), - abi: abi.getPricePerFullShare, - block, - chain, - }) - ).output; - let lpPositions = []; - for (let i = 0; i < tokens.length; i++) { - lpPositions.push({ - balance: BigNumber(lpBalances[i].output) - .times(pricePerShare[i].output).div(1e18) - .toFixed(0), - token: tokens[i][2], - }); - } - await unwrapUniswapLPs(balances, lpPositions, block, chain, (addr) => { - return `${chain}:${addr}`; - }); -} +module.exports = { + methodology: + "TVL counts the AAVE tokens that are deposited within the Yield Instruments section of QiDao, the Vault token deposits of CRV, LINK, AAVE and WETH, as well as USDC deposited to mint MAI.", +}; -async function polygon(timestamp, block, chainBlocks) { - const balances = {}; - await sumTokens( - balances, - [ +const config = { + optimism: { + vaults: [ + "0x062016cd29fabb26c52bab646878987fc9b0bc55", + "0xb9c8f0d3254007ee4b98970b94544e473cd610ec", + "0xbf1aea8670d2528e08334083616dd9c5f3b087ae", + "0xF9CE2522027bD40D3b1aEe4abe969831FE3BeAf5", + "0xAB91c51b55F7Dd7B34F2FD7217506fD5b632B2B9", + "0xB89c1b3d9f335B9d8Bb16016F3d60160AE71041f", + "0x86f78d3cbca0636817ad9e27a44996c738ec4932", + "0xa478E708A27853848C6Bc979668fe6225FEe46Fa", + "0x7198ff382b5798dab7dc72a23c1fec9dc091893b", + "0xc88c8ada95d92c149377aa660837460775dcc6d9" + ] + }, + arbitrum: { + vaults: [ + "0xC76a3cBefE490Ae4450B2fCC2c38666aA99f7aa0", + "0xB237f4264938f0903F5EC120BB1Aa4beE3562FfF", + "0xd371281896f2F5f7A2C65F49d23A2B6ecfd594f3", + "0xe47ca047Cb7E6A9AdE9405Ca68077d63424F34eC", + "0xa864956ff961ce62c266a8563b46577d3573372e", + "0x950eceee9e7d7366a24fc9d2ed4c0c37d17a0fa9" + ] + }, + fantom: { + vaults: [ + "0x1066b8FC999c1eE94241344818486D5f944331A0", + "0x7efB260662a6FA95c1CE1092c53Ca23733202798", + "0x682E473FcA490B0adFA7EfE94083C1E63f28F034", + "0xD939c268C49c442F037E968F045ba02f499562D4", + "0xE5996a2cB60eA57F03bf332b5ADC517035d8d094", + "0x267bDD1C19C932CE03c7A62BBe5b95375F9160A6", + "0xd6488d586E8Fcd53220e4804D767F19F5C846086", + "0xdB09908b82499CAdb9E6108444D5042f81569bD9", + "0x3609A304c6A41d87E895b9c1fd18c02ba989Ba90", + "0xC1c7eF18ABC94013F6c58C6CdF9e829A48075b4e", + "0x5563Cc1ee23c4b17C861418cFF16641D46E12436", + "0x8e5e4D08485673770Ab372c05f95081BE0636Fa2", + "0xBf0ff8ac03f3E0DD7d8faA9b571ebA999a854146", + // "0x051b82448a521bC32Ac7007a7A76F9dEC80F6BA2", + // "0xD60FBaFc954Bfbd594c7723C980003c196bDF02F", + // "0xCB99178C671761482097F32595cb79fb28a49Fd8", + "0x7aE52477783c4E3e5c1476Bbb29A8D029c920676", + "0x571F42886C31f9b769ad243e81D06D0D144BE7B4", + "0x6d6029557a06961aCC5F81e1ffF5A474C54e32Fd", + "0x3f6cf10e85e9c0630856599fab8d8bfcd9c0e7d4", + "0x75D4aB6843593C111Eeb02Ff07055009c836A1EF", + // "0xf18F4847a5Db889B966788dcbDbcBfA72f22E5A6", + // "0xedF25e618E4946B05df1E33845993FfEBb427A0F", + "0xF34e271312e41Bbd7c451B76Af2AF8339D6f16ED", + "0x7aE52477783c4E3e5c1476Bbb29A8D029c920676", + "0x571F42886C31f9b769ad243e81D06D0D144BE7B4", + "0x6d6029557a06961aCC5F81e1ffF5A474C54e32Fd", + ], + }, + avax: { + vaults: [ + "0xfA19c1d104F4AEfb8d5564f02B3AdCa1b515da58", + // "0xC3537ef04Ad744174A4A4a91AfAC4Baf0CF80cB3", + // "0xF8AC186555cbd5104c0e8C5BacF8bB779a3869f5", + // "0xEa88eB237baE0AE26f4500146c251d25F409FA32", + // "0x8Edc3fB6Fcdd5773216331f74AfDb6a2a2E16dc9", + "0x13a7fe3ab741ea6301db8b164290be711f546a73", + "0x73a755378788a4542a780002a75a7bae7f558730", + "0xa9122dacf3fccf1aae6b8ddd1f75b6267e5cbbb8", + "0x1f8f7a1d38e41eaf0ed916def29bdd13f2a3f11a", + ] + }, + moonbeam: { + vaults: [ + "0x3A82F4da24F93a32dc3C2A28cFA9D6E63EC28531", + ] + }, + moonriver: { + vaults: [ + // "0x97D811A7eb99Ef4Cb027ad59800cE27E68Ee1109", + //"0x4a0474E3262d4DB3306Cea4F207B5d66eC8E0AA9", + ] + }, + harmony: { + vaults: [ + //"0x12FcB286D664F37981a42cbAce92eAf28d1dA94f", + //"0x46469f995A5CB60708200C25EaD3cF1667Ed36d6", + ] + }, + xdai: { + vaults: [ + "0x5c49b268c9841AFF1Cc3B0a418ff5c3442eE3F3b", + "0x014a177e9642d1b4e970418f894985dc1b85657f", + ] + }, + ethereum: { + vaults: [ + "0x60d133c666919B54a3254E0d3F14332cB783B733", + "0xEcbd32bD581e241739be1763DFE7a8fFcC844ae1", + "0x98eb27E5F24FB83b7D129D789665b08C258b4cCF", + "0x8C45969aD19D297c9B85763e90D0344C6E2ac9d1", + "0xcc61Ee649A95F2E2f0830838681f839BDb7CB823", + "0x82E90EB7034C1DF646bD06aFb9E67281AAb5ed28", + "0xCA3EB45FB186Ed4e75B9B22A514fF1d4abAdD123", + "0x4ce4C542D96Ce1872fEA4fa3fbB2E7aE31862Bad" + ] + }, + bsc: { + vaults: [ + "0x014a177e9642d1b4e970418f894985dc1b85657f", + "0xa56f9a54880afbc30cf29bb66d2d9adcdcaeadd6", + "0x7333fd58d8d73a8e5fc1a16c8037ada4f580fa2b", + ] + }, + metis: { + vaults: [ + "0x10dcbee8afa39a847707e16aea5eb34c6b01aba9", + "0xc09c73f7b32573d178138e76c0e286ba21085c20", + "0xb89c1b3d9f335b9d8bb16016f3d60160ae71041f", + "0x5A03716bd1f338D7849f5c9581AD5015ce0020B0", + "0x19Cb63CCbfAC2f28B1fd79923f6aDfC096e6EBB4" + ] + }, + polygon: { + vaults: [ + "0x3fd939B017b31eaADF9ae50C7fF7Fa5c0661d47C", + "0x61167073E31b1DAd85a3E531211c7B8F1E5cAE72", + "0x87ee36f780ae843A78D5735867bc1c13792b7b11", + "0x98B5F32dd9670191568b661a3e847Ed764943875", + "0x37131aEDd3da288467B6EBe9A77C523A700E6Ca1", + "0x701A1824e5574B0b6b1c8dA808B184a7AB7A2867", + "0x649Aa6E6b6194250C077DF4fB37c23EE6c098513", + "0xF086dEdf6a89e7B16145b03a6CB0C0a9979F1433", + "0xff2c44fb819757225a176e825255a01b3b8bb051", + "0x178f1c95c85fe7221c7a6a3d6f12b7da3253eeae", + "0x1dcc1f864a4bd0b8f4ad33594b758b68e9fa872c", + "0x305f113ff78255d4f8524c8f50c7300b91b10f6a", + "0x7d36999a69f2B99BF3FB98866cBbE47aF43696C8", + "0x506533B9C16eE2472A6BF37cc320aE45a0a24F11", + "0x7CbF49E4214C7200AF986bc4aACF7bc79dd9C19a", + "0xaa19d0e397c964a35e6e80262c692dbfc9c23451", + "0x11826d20b6a16a22450978642404da95b4640123", + "0x34fa22892256216a659d4f635354250b4d771458", + "0x7d75F83f0aBe2Ece0b9Daf41CCeDdF38Cb66146b", + "0x57cbf36788113237d64e46f25a88855c3dff1691", + "0x1f0aa72b980d65518e88841ba1da075bd43fa933", + "0x9A05b116b56304F5f4B3F1D5DA4641bFfFfae6Ab", + "0xF1104493eC315aF2cb52f0c19605443334928D38", + "0xb1f28350539b06d5a35d016908eef0424bd13c4b", + "0x3bcbAC61456c9C9582132D1493A00E318EA9C122" + ], + toa: [ + [nullAddress, '0xa3fa99a148fa48d14ed51d610c367c61876997f1'], // vaults [ "0x1a13f4ca1d028320a707d99520abfefca3998b7f", @@ -113,675 +188,34 @@ async function polygon(timestamp, block, chainBlocks) { ], // amWBTC // anchor [ - "0x2791bca1f2de4661ed88a30c99a7a9449aa84174", + ADDRESSES.polygon.USDC, "0x947D711C25220d8301C087b25BA111FE8Cbf6672", ], //USDC [ - "0xc2132d05d31c914a87c6611c10748aeb04b58e8f", + ADDRESSES.polygon.USDT, "0xa4742A65f24291AA421497221AaF64c70b098d98", ], //USDT [ - "0x8f3cf7ad23cd3cadbd9735aff958023239c6a063", + ADDRESSES.polygon.DAI, "0x6062E92599a77E62e0cC9749261eb2eaC3aBD44F", ], //DAI - // mai vaults - [ - "0x7ceb23fd6bc0add59e62ac25578270cff1b9f619", - "0x3fd939B017b31eaADF9ae50C7fF7Fa5c0661d47C", - ], // weth - [ - "0x53e0bca35ec356bd5dddfebbd1fc0fd03fabad39", - "0x61167073E31b1DAd85a3E531211c7B8F1E5cAE72", - ], // link - [ - "0xd6df932a45c0f255f85145f286ea0b292b21c90b", - "0x87ee36f780ae843A78D5735867bc1c13792b7b11", - ], // aave - [ - "0x172370d5cd63279efa6d502dab29171933a610af", - "0x98B5F32dd9670191568b661a3e847Ed764943875", - ], // crv - [ - "0x1bfd67037b42cf73acf2047067bd4f2c47d9bfd6", - "0x37131aEDd3da288467B6EBe9A77C523A700E6Ca1", - ], // wbtc - [ - "0x9a71012b13ca4d3d0cdc72a177df3ef03b0e76a3", - "0x701A1824e5574B0b6b1c8dA808B184a7AB7A2867", - ], //bal - [ - "0xf28164a485b0b2c90639e47b0f377b4a438a16b1", - "0x649Aa6E6b6194250C077DF4fB37c23EE6c098513", - ], //dquick - [ - "0x385eeac5cb85a38a9a07a70c73e0a3271cfb54a7", - "0xF086dEdf6a89e7B16145b03a6CB0C0a9979F1433", - ], - [ - "0x1a3acf6d19267e2d3e7f898f42803e90c9219062", - "0xff2c44fb819757225a176e825255a01b3b8bb051", - ], - [ - "0xD85d1e945766Fea5Eda9103F918Bd915FbCa63E6", - "0x178f1c95c85fe7221c7a6a3d6f12b7da3253eeae", - ], // CEL - [ - "0xBbba073C31bF03b8ACf7c28EF0738DeCF3695683", - "0x1dcc1f864a4bd0b8f4ad33594b758b68e9fa872c", - ], // SAND - [ - "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270", - "0x305f113ff78255d4f8524c8f50c7300b91b10f6a", - ], // WMATIC - [ - "0xfe4546feFe124F30788c4Cc1BB9AA6907A7987F9", - "0x7d36999a69f2B99BF3FB98866cBbE47aF43696C8", - ], // cxETH - [ - "0x64875Aaa68d1d5521666C67d692Ee0B926b08b2F", - "0x506533B9C16eE2472A6BF37cc320aE45a0a24F11", - ], // cxADA - [ - "0x9Bd9aD490dD3a52f096D229af4483b94D63BE618", - "0x7CbF49E4214C7200AF986bc4aACF7bc79dd9C19a", - ], // WMATIC - [ - "0xaa19d0e397c964a35e6e80262c692dbfc9c23451", - "0xf52B3250E026E0307d7d717AE0f331baAA4F83a8", - ], //tetu xxdai - [ - "0x11826d20b6a16a22450978642404da95b4640123", - "0x6c5e2E7dF0372f834B7F40D16Ff4333Cf49Af235", - ], //tetu xxlink - [ - "0x34fa22892256216a659d4f635354250b4d771458", - "0x3A58a54C066FdC0f2D55FC9C89F0415C92eBf3C4", - ], // stmatic - [ - "0x873f4aE80867b9f97304B9Bb7Ef92c4d563fA48c", - "0x7d75F83f0aBe2Ece0b9Daf41CCeDdF38Cb66146b" - ] - - ], - chainBlocks.polygon, - "polygon", - (addr) => `polygon:${addr}` - ); - balances["polygon:0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270"] = ( - await sdk.api.eth.getBalance({ - target: "0xa3fa99a148fa48d14ed51d610c367c61876997f1", - block: chainBlocks.polygon, - chain: "polygon", - }) - ).output; - - balances['avax:0xa7d7079b0fead91f3e65f86e8915cb59c1a4c664'] = ( - await sdk.api.erc20.balanceOf({ - target: "0x7d60F21072b585351dFd5E8b17109458D97ec120", - owner: "0x57cbf36788113237d64e46f25a88855c3dff1691", - block: chainBlocks.polygon, - chain: "polygon", - }) - ).output / 10 ** 12; - - balances['0x3f382dbd960e3a9bbceae22651e88158d2791550'] = ( - await sdk.api.erc20.balanceOf({ - target: "0x51195e21BDaE8722B29919db56d95Ef51FaecA6C", - owner: "0x1f0aa72b980d65518e88841ba1da075bd43fa933", - block: chainBlocks.polygon, - chain: "polygon", - }) - ).output; - - return balances; -} - -async function fantom(timestamp, block, chainBlocks) { - const balances = {}; - const chain = "fantom"; - const transformAddress = await getChainTransform(chain) - await sumTokens( - balances, - [ - [ - "0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83", - "0x1066b8FC999c1eE94241344818486D5f944331A0", - ], - [ - "0x0DEC85e74A92c52b7F708c4B10207D9560CEFaf0", - "0x7efB260662a6FA95c1CE1092c53Ca23733202798", - ], - [ - "0x637eC617c86D24E421328e6CAEa1d92114892439", - "0x682E473FcA490B0adFA7EfE94083C1E63f28F034", - ], - [ - "0x74b23882a30290451A17c44f4F05243b6b58C76d", - "0xD939c268C49c442F037E968F045ba02f499562D4", - ], - [ - "0x321162Cd933E2Be498Cd2267a90534A804051b11", - "0xE5996a2cB60eA57F03bf332b5ADC517035d8d094", - ], - [ - "0xae75A438b2E0cB8Bb01Ec1E1e376De11D44477CC", - "0x267bDD1C19C932CE03c7A62BBe5b95375F9160A6", - ], - [ - "0xb3654dc3d10ea7645f8319668e8f54d2574fbdc8", - "0xd6488d586E8Fcd53220e4804D767F19F5C846086", - ], - [ - "0x6a07A792ab2965C72a5B8088d3a069A7aC3a993B", - "0xdB09908b82499CAdb9E6108444D5042f81569bD9", - ], - [ - "0x49c68edb7aebd968f197121453e41b8704acde0c", - "0x3609A304c6A41d87E895b9c1fd18c02ba989Ba90", - ], - [ - "0x0a03d2c1cfca48075992d810cc69bd9fe026384a", - "0xC1c7eF18ABC94013F6c58C6CdF9e829A48075b4e", - ], - [ - "0x97927abfe1abbe5429cbe79260b290222fc9fbba", - "0x5563Cc1ee23c4b17C861418cFF16641D46E12436", - ], - [ - "0x6dfe2aaea9daadadf0865b661b53040e842640f8", - "0x8e5e4D08485673770Ab372c05f95081BE0636Fa2", - ], - [ - "0x920786cff2a6f601975874bb24c63f0115df7dc8", - "0xBf0ff8ac03f3E0DD7d8faA9b571ebA999a854146", - ], - [ - "0x6c021Ae822BEa943b2E66552bDe1D2696a53fbB7", - "0x051b82448a521bC32Ac7007a7A76F9dEC80F6BA2" - ], - [ - "0x4cdF39285D7Ca8eB3f090fDA0C069ba5F4145B37", - "0xD60FBaFc954Bfbd594c7723C980003c196bDF02F" - ], - [ - "0x5cc61a78f164885776aa610fb0fe1257df78e59b", - "0xCB99178C671761482097F32595cb79fb28a49Fd8" - ], - [ - "0xCe2Fc0bDc18BD6a4d9A725791A3DEe33F3a23BB7", - "0x7aE52477783c4E3e5c1476Bbb29A8D029c920676", - ], - [ - "0xd817A100AB8A29fE3DBd925c2EB489D67F758DA9", - "0x571F42886C31f9b769ad243e81D06D0D144BE7B4", - ], - [ - "0x2C850cceD00ce2b14AA9D658b7Cad5dF659493Db", - "0x6d6029557a06961aCC5F81e1ffF5A474C54e32Fd", - ], - [ - "0xa48d959AE2E88f1dAA7D5F611E01908106dE7598", - "0x3f6cf10e85e9c0630856599fab8d8bfcd9c0e7d4", - ], - //[t,p], - - ], - chainBlocks[chain], - chain, - transformAddress, - { resolveYearn: true }, - ); - const ftmMooTokens = [ - [ - "0xbf07093ccd6adfc3deb259c557b61e94c1f66945", - "0x75D4aB6843593C111Eeb02Ff07055009c836A1EF", - ] - ]; - await handleMooTokens(balances, chainBlocks.fantom, chain, ftmMooTokens); - const ftmLPs = [ - //Vault, token, LP - [ - "0x9BA01B1279B1F7152b42aCa69fAF756029A9ABDe", - "0x2a30C5e0d577108F694d2A96179cd73611Ee069b", - "0xf0702249F4D3A25cD3DED7859a165693685Ab577", - ], - [ - "0xF34e271312e41Bbd7c451B76Af2AF8339D6f16ED", - "0xA3e3Af161943CfB3941B631676134bb048739727", - "0xFdb9Ab8B9513Ad9E419Cf19530feE49d412C3Ee3", - ], - [ - "0xB595C02147bCEDE84e0E85D9e95727cF38C02b07", - "0xee3a7c885fd3cc5358ff583f2dab3b8bc473316f", - "0xEc7178F4C41f346b2721907F5cF7628E388A7a58" - ], - [ - "0x3F4f523ACf811E713e7c34852b24E927D773a9e5", - "0x27c77411074ba90ca35e6f92a79dad577c05a746", - "0x2a651563c9d3af67ae0388a5c8f89b867038089e" - ], - [ - "0x872C847056e11cF75D1D9636b522D077E8C9F653", - "0xae94e96bf81b3a43027918b138b71a771d381150", - "0x4733bc45eF91cF7CcEcaeeDb794727075fB209F2" - ], - [ - "0x413f1815D32e5aca0d8984FA89e50E83dDac0BBE", - "0x5d2EF803D6e255eF4D1c66762CBc8845051B54dB", - "0x9606d683d03f012dda296ef0ae9261207c4a5847" - ], - [ - "0x03c20569c2c78CD48f491415a4cDEAC02608DB7e", - "0xA4e2EE5a7fF51224c27C98098D8DB5C770bAAdbE", - "0xe7e90f5a767406eff87fdad7eb07ef407922ec1d" - ], - [ - "0xD3af91f21F791F29FC664cD5cD61180edc263191", - "0xD8dd2EA228968F7f043474Db610A20aF887866c7", - "0xd14dd3c56d9bc306322d4cea0e1c49e9ddf045d4" ] - ]; - await handleMooLPs(balances, chainBlocks.fantom, chain, ftmLPs); - - await sumTokens( - balances, - [ - [ - "0xa48d959ae2e88f1daa7d5f611e01908106de7598", - "0xf18F4847a5Db889B966788dcbDbcBfA72f22E5A6", - ], - [ - "0x7345a537A975d9Ca588eE631BEFdDfEF34fD5e8f", - "0xedF25e618E4946B05df1E33845993FfEBb427A0F", - ] - ], - chainBlocks.fantom, - "fantom", - transformAddress - ) - - await Promise.all([ - handleYearnTokens(balances, [ - "0xCe2Fc0bDc18BD6a4d9A725791A3DEe33F3a23BB7", - ], - "0x7aE52477783c4E3e5c1476Bbb29A8D029c920676", - chainBlocks.fantom, - 'fantom', - transformAddress), - handleYearnTokens(balances, [ - "0xd817A100AB8A29fE3DBd925c2EB489D67F758DA9", - ], - "0x571F42886C31f9b769ad243e81D06D0D144BE7B4", - chainBlocks.fantom, - 'fantom', - transformAddress), - handleYearnTokens(balances, [ - "0x2C850cceD00ce2b14AA9D658b7Cad5dF659493Db" - ], - "0x6d6029557a06961aCC5F81e1ffF5A474C54e32Fd", - chainBlocks.fantom, - 'fantom', - transformAddress) - ]); - - return balances; -} - -async function avax(timestamp, block, chainBlocks) { - const balances = {}; - const chain = "avax"; - const transformAddress = await getChainTransform(chain) - const avaxMooTokens = [ - [ - "0x1B156C5c75E9dF4CAAb2a5cc5999aC58ff4F9090", - "0xfA19c1d104F4AEfb8d5564f02B3AdCa1b515da58", - ], - [ - "0xD795d70ec3C7b990ffED7a725a18Be5A9579c3b9", - "0xC3537ef04Ad744174A4A4a91AfAC4Baf0CF80cB3" - ], - [ - "0xb6767518b205ea8B312d2EF4d992A2a08C2f2416", - "0xF8AC186555cbd5104c0e8C5BacF8bB779a3869f5" - ], - [ - "0xAf9f33df60CA764307B17E62dde86e9F7090426c", - "0xEa88eB237baE0AE26f4500146c251d25F409FA32" - ], - [ - "0x808D5f0A62336917Da14fA9A10E9575B1040f71c", - "0x8Edc3fB6Fcdd5773216331f74AfDb6a2a2E16dc9" - ] - ]; - await handleMooTokens(balances, chainBlocks.avax, chain, avaxMooTokens); - - await sumTokens( - balances, - [ - [ - "0x60781C2586D68229fde47564546784ab3fACA982", - "0xfc3eAFD931ebcd0D8E59bfa0BeaE776d7F987716" - ], - [ - "0x0665eF3556520B21368754Fb644eD3ebF1993AD4", - "0x13a7fe3ab741ea6301db8b164290be711f546a73" - ], - [ - "0x60781C2586D68229fde47564546784ab3fACA982", - "0xfc3eAFD931ebcd0D8E59bfa0BeaE776d7F987716" - ], - [ - "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7", - "0x73a755378788a4542a780002a75a7bae7f558730" - ], // avax - [ - "0x49D5c2BdFfac6CE2BFdB6640F4F80f226bc10bAB", - "0xa9122dacf3fccf1aae6b8ddd1f75b6267e5cbbb8" - ], // eth - [ - "0x50b7545627a5162F82A992c33b87aDc75187B218", - "0x1f8f7a1d38e41eaf0ed916def29bdd13f2a3f11a" - ] // btc - ], - chainBlocks.avax, - "avax", - transformAddress - ); - return balances; -} - -async function moonriver(timestamp, block, chainBlocks) { - const balances = {}; - const chain = "moonriver"; - const moonriverMooLPs = [ - [ - "0x97D811A7eb99Ef4Cb027ad59800cE27E68Ee1109", - "0x932009984bd2a7da8c6396694e811da5c0952d05", - "0xA0D8DFB2CC9dFe6905eDd5B71c56BA92AD09A3dC", - ], - ]; - await sumTokens( - balances, - [ - [ - "0x639a647fbe20b6c8ac19e48e2de44ea792c62c5c", - "0x4a0474E3262d4DB3306Cea4F207B5d66eC8E0AA9", - ], - ], - chainBlocks.moonriver, - chain, - (addr) => { - return `moonriver:${addr}`; - } - ); - await handleMooLPs(balances, chainBlocks.moonriver, chain, moonriverMooLPs); - return balances; + } } -async function harmony(timestamp, block, chainBlocks) { - const balances = {}; - await sumTokens( - balances, - [ - [ - "0xcf664087a5bb0237a0bad6742852ec6c8d69a27a", - "0x12FcB286D664F37981a42cbAce92eAf28d1dA94f", - ], - [ - "0x6983d1e6def3690c4d616b13597a09e6193ea013", - "0x46469f995A5CB60708200C25EaD3cF1667Ed36d6", - ], - ], - chainBlocks.harmony, - "harmony", - (addr) => { - return `harmony:${addr}`; +Object.keys(config).forEach(chain => { + const { vaults, toa = [] } = config[chain] + module.exports[chain] = { + tvl: async (_, _b, { [chain]: block }) => { + const tokens = await sdk.api2.abi.multiCall({ + abi: 'address:collateral', + calls: vaults, + chain, block, + }) + const tokensAndOwners = tokens.map((t, i) => ([t, vaults[i]])) + tokensAndOwners.push(...toa) + + return sumTokens2({ tokensAndOwners, chain, block, }) } - ); - getFixBalancesSync('harmony')(balances); - return balances; -} - -async function xdai (timestamp, block, chainBlocks) { - const balances = {}; - await sumTokens( - balances, - [ - [ - "0x6a023ccd1ff6f2045c3309768ead9e68f978f6e1", - "0x5c49b268c9841AFF1Cc3B0a418ff5c3442eE3F3b" - ], - [ - "0x9c58bacc331c9aa871afd802db6379a98e80cedb", - "0x014a177e9642d1b4e970418f894985dc1b85657f" - ] - ], - chainBlocks.xdai, - "xdai", - addr=>`xdai:${addr}` - ); - return balances; -} - -async function bsc (timestamp, block, chainBlocks) { - const balances = {}; - const transformAddress = await getChainTransform('bsc') - - await sumTokens( - balances, - [ - [ - "0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82", - "0x014a177e9642d1b4e970418f894985dc1b85657f" - ], - [ - "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c", - "0xa56f9a54880afbc30cf29bb66d2d9adcdcaeadd6" - ], - [ - "0x67ee3cb086f8a16f34bee3ca72fad36f7db929e2", - "0x7333fd58d8d73a8e5fc1a16c8037ada4f580fa2b" - ], - ], - chainBlocks.bsc, - "bsc", - transformAddress - ); - return balances; -} - -async function optimism (timestamp, block, chainBlocks) { - const balances = {}; - const transformAddress = await getChainTransform('optimism') - - await sumTokens( - balances, - [ - [ - "0x4200000000000000000000000000000000000006", - "0x062016cd29fabb26c52bab646878987fc9b0bc55" - ], - [ - "0x68f180fcCe6836688e9084f035309E29Bf0A2095", - "0xb9c8f0d3254007ee4b98970b94544e473cd610ec" - ], - [ - "0x4200000000000000000000000000000000000042", - "0xbf1aea8670d2528e08334083616dd9c5f3b087ae" - ], - [ - "0x7eE71053102d54Fc843BaEBaf07277C2b6dB64f1", - "0xF9CE2522027bD40D3b1aEe4abe969831FE3BeAf5" - ], - [ - "0x8e2cDf8c6477439B7C989e86B917D80871B92339", - "0xAB91c51b55F7Dd7B34F2FD7217506fD5b632B2B9" - ], - [ - "0x4D153F47F03c237F6360a6eccd185b4aE09c63D0", - "0xB89c1b3d9f335B9d8Bb16016F3d60160AE71041f" - ] - - ], - chainBlocks.optimism, - "optimism", - transformAddress - ); - return balances; -} - -async function arbitrum (timestamp, block, chainBlocks) { - const balances = {}; - const transformAddress = await getChainTransform('arbitrum') - - await sumTokens( - balances, - [ - [ - "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1", - "0xC76a3cBefE490Ae4450B2fCC2c38666aA99f7aa0" - ], - [ - "0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f", - "0xB237f4264938f0903F5EC120BB1Aa4beE3562FfF" - ], - ], - chainBlocks.arbitrum, - "arbitrum", - transformAddress - ); - return balances; -} - -async function moonbeam (timestamp, ethblock, chainBlocks) { - const balances = {}; - let chain = "moonbeam" - const transformAddress = await getChainTransform(chain) - const block = await getBlock(timestamp, "moonbeam", chainBlocks) - - await sumTokens( - balances, - [ - [ - "0xAcc15dC74880C9944775448304B263D191c6077F", - "0x3A82F4da24F93a32dc3C2A28cFA9D6E63EC28531" - ], - ], - block, - chain, - transformAddress - ); - return balances; -} - -async function metis (timestamp, block, chainBlocks) { - const balances = {}; - const transformAddress = await getChainTransform('metis') - - await sumTokens( - balances, - [ - [ - "0xdeaddeaddeaddeaddeaddeaddeaddeaddead0000", //Token - "0x10dcbee8afa39a847707e16aea5eb34c6b01aba9" //Vault - ], - [ - "0x420000000000000000000000000000000000000A", - "0xc09c73f7b32573d178138e76c0e286ba21085c20", - ], //Eth - [ - "0xa5B55ab1dAF0F8e1EFc0eB1931a957fd89B918f4", - "0xb89c1b3d9f335b9d8bb16016f3d60160ae71041f", - ], //Btc - [ - "0x433E43047B95cB83517abd7c9978Bdf7005E9938", - "0x5A03716bd1f338D7849f5c9581AD5015ce0020B0", - ], //Btc - ], - chainBlocks.metis, - "metis", - transformAddress - ); - return balances; -} - -async function ethereum (timestamp, block, chainBlocks) { - const balances = {}; - const transformAddress = await getChainTransform('ethereum') - - await sumTokens( - balances, - [ - [ - "0x671a912C10bba0CFA74Cfc2d6Fba9BA1ed9530B2", // - "0x60d133c666919B54a3254E0d3F14332cB783B733" // - ], - [ - "0xa258C4606Ca8206D8aA700cE2143D7db854D168c", - "0xEcbd32bD581e241739be1763DFE7a8fFcC844ae1", - ], - [ - "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", - "0x98eb27E5F24FB83b7D129D789665b08C258b4cCF", - ], //weth - [ - "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", - "0x8C45969aD19D297c9B85763e90D0344C6E2ac9d1", - ], - [ - "0xbC10c4F7B9FE0B305e8639B04c536633A3dB7065", - "0xcc61Ee649A95F2E2f0830838681f839BDb7CB823", - ], - [ - "0xdCD90C7f6324cfa40d7169ef80b12031770B4325", - "0x82E90EB7034C1DF646bD06aFb9E67281AAb5ed28", - ] - ], - block, - "ethereum", - transformAddress - ); - return balances; -} - -module.exports = { - misrepresentedTokens: true, - methodology: - "TVL counts the AAVE tokens that are deposited within the Yield Instruments section of QiDao, the Vault token deposits of CRV, LINK, AAVE and WETH, as well as USDC deposited to mint MAI.", - polygon: { - tvl: polygon, - }, - fantom: { - tvl: fantom, - }, - avax:{ - tvl: avax, - }, - moonriver: { - tvl: moonriver, - }, - harmony: { - tvl: harmony, - }, - xdai: { - tvl: xdai - }, - arbitrum: { - tvl: arbitrum - }, - optimism: { - tvl: optimism - }, - bsc: { - tvl: bsc - }, - metis: { - tvl: metis - }, - ethereum: { - tvl: ethereum - }, - moonbeam: { - tvl: moonbeam } -}; +}) diff --git a/projects/qilin/index.js b/projects/qilin/index.js index 2ec8d961546..2135110787b 100644 --- a/projects/qilin/index.js +++ b/projects/qilin/index.js @@ -1,17 +1,10 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk') +const { sumTokensExport } = require('../helper/unwrapLPs') const contract = "0x57A0B07dcD834cAbB844BEc8E7903A3B2faE6245" -const usdcToken = "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" -async function tvl(_timestamp, ethBlock){ - return { - [usdcToken]: (await sdk.api.erc20.balanceOf({ - target: usdcToken, - owner: contract, - block: ethBlock - })).output - } -} +const usdcToken = ADDRESSES.ethereum.USDC module.exports = { - ethereum: { tvl }, + ethereum: { tvl: sumTokensExport({ owner: contract, tokens: [usdcToken]}) }, } \ No newline at end of file diff --git a/projects/quadrat/index.js b/projects/quadrat/index.js new file mode 100644 index 00000000000..bd9978676c6 --- /dev/null +++ b/projects/quadrat/index.js @@ -0,0 +1,66 @@ +const { getLogs } = require('../helper/cache/getLogs') +const sdk = require('@defillama/sdk') + +module.exports = { + doublecounted: true, + methodology: 'Counts the tokens locked in Strategy Vaults in Uniswap v3 Pools.', + start: 1667197843, // Mon Oct 31 2022 06:30:43 GMT+0000 +}; + +const config = { + ethereum: { + factory: '0x823db50c56d8a994af0ceb3f7dc421852cf6fbff', + fromBlock: 15891335, + }, + optimism: { + factory: '0x3ae3b506a39ffc1aa3964f6dc888891ea10671ed', + fromBlock: 33415677, + }, + polygon: { + factory: '0x1a639e9249d26c70edf0b7410a8495d9b72140ff', + fromBlock: 35028277, + }, + arbitrum: { + factory: '0xb8d498f025c45a8a7a63277cb1cca36c2599bbd7', + fromBlock: 34510988, + }, + bsc: { + factory: '0x28e9f86690449059734e079eaaa66d8913263bed', + fromBlock: 26497758, + }, +} + +Object.keys(config).forEach(chain => { + const { factory, fromBlock, } = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const balances = {} + + const logs = await getLogs({ + api, + target: factory, + topics: ['0x9c5d829b9b23efc461f9aeef91979ec04bb903feb3bee4f26d22114abfc7335b'], + fromBlock, + onlyArgs: true, + eventAbi: 'event PoolCreated (address indexed uniPool, address indexed manager, address indexed pool)' + }) + + const calls = logs.map(i => i.pool) + + const [token0, token1, bals] = await Promise.all([ + api.multiCall({ abi: 'address:token0', calls }), + api.multiCall({ abi: 'address:token1', calls }), + api.multiCall({ abi: 'function getUnderlyingBalances() view returns (uint256 amount0, uint256 amount1)', calls }), + ]) + + bals.forEach((val, i) => { + if (!val) return; + const { amount0, amount1 } = val + sdk.util.sumSingleBalance(balances, token0[i], amount0, api.chain) + sdk.util.sumSingleBalance(balances, token1[i], amount1, api.chain) + }) + + return balances + } + } +}) \ No newline at end of file diff --git a/projects/quantumx-network/api.js b/projects/quantumx-network/api.js new file mode 100644 index 00000000000..95326af5291 --- /dev/null +++ b/projects/quantumx-network/api.js @@ -0,0 +1 @@ +module.exports = require('./index') \ No newline at end of file diff --git a/projects/quantumx-network/index.js b/projects/quantumx-network/index.js new file mode 100644 index 00000000000..5a7ca2265da --- /dev/null +++ b/projects/quantumx-network/index.js @@ -0,0 +1,8 @@ +const { sumTokensExport } = require('../helper/sumTokens') + +module.exports = { + timetravel: false, + elrond: { + tvl: sumTokensExport({ chain: 'elrond', owner: 'erd1qqqqqqqqqqqqqpgql6dxenaameqn2uyyru3nmmpf7e95zmlxu7zskzpdcw', }) + } +} \ No newline at end of file diff --git a/projects/quarry/index.js b/projects/quarry/index.js index dcb1eee088c..3d932879db2 100644 --- a/projects/quarry/index.js +++ b/projects/quarry/index.js @@ -1,97 +1,22 @@ -const { sliceIntoChunks, log } = require("../helper/utils"); const { PublicKey } = require("@solana/web3.js"); const { Program, } = require("@project-serum/anchor"); -const { getMSolLPTokens, MSOL_LP_MINT } = require("./msolLP"); const sdk = require('@defillama/sdk') -const { getMultipleAccountBuffers, getSaberPools, getQuarryData, getProvider, } = require("../helper/solana"); +const { getProvider, } = require("../helper/solana"); async function tvl() { - // this is a mapping of token mint to list of quarries - // more details: https://github.com/QuarryProtocol/rewarder-list - const { quarriesByStakedMint, - } = await getQuarryData(); - const saberPools = await getSaberPools() + const balances = {} const quarryId = new PublicKey('QMNeHCGYnLVDn1icRAfQZpjPLBNkfGbSKRB83G5d8KB') const provider = getProvider(); const QuarryMineIDL = await Program.fetchIdl(quarryId, provider) const quarryProgram = new Program(QuarryMineIDL, quarryId, provider) const allQuaries = await quarryProgram.account.quarry.all() - const quaryMapping = {} - allQuaries.forEach(i => quaryMapping[i.publicKey.toString()] = i) - log('total', Object.keys(quarriesByStakedMint).length) - const quarriies = [] - const balances = {} - - for (const [stakedMint, quarryKeys] of Object.entries(quarriesByStakedMint)) { - const saberPool = saberPools.find((p) => p.lpMint === stakedMint); - const isMsolSolLP = stakedMint === MSOL_LP_MINT.toString(); - - if (saberPool) { - quarriies.push(...quarryKeys) - continue; - } - - const quarries = quarryKeys.map(i => quaryMapping[i].account) - - const totalTokens = quarries.reduce((sum, q) => sum + +q.totalTokensDeposited, 0); - - if (!isMsolSolLP) { - sdk.util.sumSingleBalance(balances,'solana:'+stakedMint,totalTokens) - } else if (isMsolSolLP) { - const msolTVL = await getMSolLPTokens(totalTokens); - for (const [tokenId, amount] of Object.entries(msolTVL)) { - sdk.util.sumSingleBalance(balances,tokenId,amount) - } - } - } - - const quaryData = quarriies.map(i => quaryMapping[i].account) - const quarryDataKeyed = {} - quaryData.forEach((data, i) => { - if (!data) return; - quarryDataKeyed[quarriies[i]] = { - quarry: data, - tokenAmount: data.totalTokensDeposited, - decimals: data.tokenMintDecimals - } - }) - - const dataKeys = [] - for (const [stakedMint, quarryKeys] of Object.entries(quarriesByStakedMint)) { - const saberPool = saberPools.find((p) => p.lpMint === stakedMint) - if (!saberPool) continue; - quarryKeys.forEach(key => { - if (!quarryDataKeyed[key]) return; - quarryDataKeyed[key].saberPool = saberPool - quarryDataKeyed[key].stakedMint = stakedMint - dataKeys.push(stakedMint, saberPool.reserveA, saberPool.reserveB) - }) - } - const dataCache = {} - for (const keys of sliceIntoChunks(dataKeys, 99)) { - const res = await getMultipleAccountBuffers(keys) - keys.forEach((key, i) => { - dataCache[key] = res[i] - }) - } - Object.keys(quarryDataKeyed).forEach(key => { - if (!quarryDataKeyed[key].saberPool) delete quarryDataKeyed[key] + allQuaries.forEach(({account: i}) => { + const amount = +i.totalTokensDeposited + if (amount < 1e6) return; + sdk.util.sumSingleBalance(balances,i.tokenMintKey.toString(),amount, 'solana') }) - Object.values(quarryDataKeyed).forEach(quarry => addQuarryBalance(dataCache, balances, quarry)) - - return balances; -} - -function addQuarryBalance(dataCache, balances = {}, { tokenAmount, stakedMint, saberPool: { reserveA, reserveB, tokenA, tokenB, } }) { - const lpTokenTotalSupply = Number(dataCache[stakedMint].readBigUInt64LE(36)); - let poolShare = tokenAmount / lpTokenTotalSupply; - - const reserveAAmount = Number(dataCache[reserveA].readBigUInt64LE(64)); - const reserveBAmount = Number(dataCache[reserveB].readBigUInt64LE(64)); - sdk.util.sumSingleBalance(balances, 'solana:'+tokenA, poolShare * reserveAAmount) - sdk.util.sumSingleBalance(balances, 'solana:'+tokenB, poolShare * reserveBAmount) return balances } diff --git a/projects/quarry/msolLP.js b/projects/quarry/msolLP.js deleted file mode 100644 index ac28c7d42ab..00000000000 --- a/projects/quarry/msolLP.js +++ /dev/null @@ -1,37 +0,0 @@ -const { getMultipleAccountBuffers, getConnection, } = require("../helper/solana"); -const { PublicKey } = require("@solana/web3.js"); - -const MSOL_LP_SOL = new PublicKey( - "UefNb6z6yvArqe4cJHTXCqStRsKmWhGxnZzuHbikP5Q" -); -const MSOL_LP_MSOL = new PublicKey( - "7GgPYjS5Dza89wV6FpZ23kUJRG5vbQ1GM25ezspYFSoE" -); -const MSOL_LP_MINT = new PublicKey( - "LPmSozJJ8Jh69ut2WP3XmVohTjL4ipR18yiCzxrUmVj" -); - -const getMSolLPTokens = async (lpAmount) => { - const connection = getConnection(); - const accountData = await getMultipleAccountBuffers({ - msolTokens: MSOL_LP_MSOL.toString(), - poolMint: MSOL_LP_MINT.toString(), - }); - - const solAmount = - (await connection.getAccountInfo(MSOL_LP_SOL)).lamports / 10 ** 9; - const msolAmount = - Number(accountData.msolTokens.readBigUInt64LE(64)) / 10 ** 9; - const lpSupply = - Number(accountData.poolMint.readBigUInt64LE(4 + 32)) / 10 ** 9; - - return { - 'solana:mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So': (msolAmount * lpAmount) / lpSupply, - 'solana:So11111111111111111111111111111111111111112': (solAmount * lpAmount) / lpSupply, - }; -}; - -module.exports = { - MSOL_LP_MINT, - getMSolLPTokens, -}; diff --git a/projects/quasar-swap/index.js b/projects/quasar-swap/index.js index 9a0b0abff1f..978a457c47d 100644 --- a/projects/quasar-swap/index.js +++ b/projects/quasar-swap/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') //const { masterChefExports } = require('../helper/masterchef'); // const { sumTokens2 } = require("../helper/unwrapLPs"); const { getUniTVL, sumUnknownTokens } = require("../helper/unknownTokens"); @@ -7,7 +8,7 @@ const { getUniTVL, sumUnknownTokens } = require("../helper/unknownTokens"); const sntNova = "0x657a66332a65b535da6c5d67b8cd1d410c161a08"; const qsrToken = "0x356c044B99e9378C1B28A1cAb2F95Cd65E877F33"; // const qsrLP = "0xf8c1b66e95790467819bb25f852e37b59e47c16d" -const nUSD = "0x1F5396f254EE25377A5C1b9c6BfF5f44e9294fFF" +const nUSD = ADDRESSES.nova.NUSD const sntQsrFarm = "0x0e9768b0199e7b31852b4effb70031d860b812d6"; // const sntNusdFarm = "0x050bc8fa6da93dff0d7629923e0972c0aecebb9e"; const poolAuto = "0x71da5557c9D89a0b34Ef3A6FE0EcC750c93996e9"; @@ -18,7 +19,6 @@ module.exports = { nova: { tvl: getUniTVL({ factory: dexFactory, - chain: "nova", useDefaultCoreAssets: true, }), staking: async (_, _b, { nova: block }) => diff --git a/projects/quasar/index.js b/projects/quasar/index.js new file mode 100644 index 00000000000..068a5a1689c --- /dev/null +++ b/projects/quasar/index.js @@ -0,0 +1,66 @@ +const { queryContract } = require('../helper/chain/cosmos') +const sdk = require('@defillama/sdk') + +const chain = 'quasar' + +const lpStrategyContracts = { + 1: [ + "quasar14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9sy9numu", + "quasar1l468h9metf7m8duvay5t4fk2gp0xl94h94f3e02mfz4353de2ykqh6rcts", + "quasar1cp8cy5kvaury53frlsaml7ru0es2reln66nfj4v7j3kcfxl4datqsw0aw4", + "quasar1kj8q8g2pmhnagmfepp9jh9g2mda7gzd0m5zdq0s08ulvac8ck4dq9ykfps", + ], + 678: [ + "quasar1suhgf5svhu4usrurvxzlgn54ksxmn8gljarjtxqnapv8kjnp4nrsmslfn4", + "quasar1ma0g752dl0yujasnfs9yrk6uew7d0a2zrgvg62cfnlfftu2y0egqx8e7fv", + ], + 803: [ + "quasar1jgn70d6pf7fqtjke0q63luc6tf7kcavdty67gvfpqhwwsx52xmjq7kd34f", + "quasar1t9adyk9g2q0efn3xndunzy4wvdrnegjkpvp382vm2uc7hnvash5qpzmxe4", + ], + 833: [ + "quasar1ery8l6jquynn9a4cz2pff6khg8c68f7urt33l5n9dng2cwzz4c4qxhm6a2", + ], + 904: [ + "quasar1ch4s3kkpsgvykx5vtz2hsca4gz70yks5v55nqcfaj7mgsxjsqypsxqtx2a", + ], + 944: [ + "quasar1xkakethwh43dds3ccmsjals9jt7qsfmedgm9dvm9tpqq8watpv9q0458u6", + "quasar1ch4s3kkpsgvykx5vtz2hsca4gz70yks5v55nqcfaj7mgsxjsqypsxqtx2a", + ], +} + +async function tvl() { + const api = new sdk.ChainApi({ chain: 'osmosis' }) + + for (const poolID in lpStrategyContracts) { + let lpContracts = lpStrategyContracts[poolID]; + for (const contractAddress of lpContracts) { + try { + let ica_balances = await queryContract({ + contract: contractAddress, + chain: chain, + data: { 'ica_balance': {} } + }); + + let denom = ica_balances.amount.denom; + let amount = Number(ica_balances.amount.amount); + + api.add(denom, amount) + } catch (e) { + console.log(e) + continue; + } + } + } + + return api.getBalances() +} + +module.exports = { + timetravel: false, + methodology: "Total TVL on vaults", + osmosis: { + tvl, + }, +} \ No newline at end of file diff --git a/projects/qubit/abi.json b/projects/qubit/abi.json index 16045b40fde..3b62e39ea7e 100644 --- a/projects/qubit/abi.json +++ b/projects/qubit/abi.json @@ -1,73 +1,7 @@ { - "allMarkets": { - "inputs": [], - "name": "allMarkets", - "outputs": [ - { - "internalType": "address[]", - "name": "", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getCash": { - "inputs": [], - "name": "getCash", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "underlying": { - "inputs": [], - "name": "underlying", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "totalBorrow": { - "inputs": [], - "name": "totalBorrow", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "totalValueLockedOf": { - "inputs": [ - { - "internalType": "address[]", - "name": "markets", - "type": "address[]" - } - ], - "name": "totalValueLockedOf", - "outputs": [ - { - "internalType": "uint256", - "name": "totalSupplyInUSD", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -} + "allMarkets": "address[]:allMarkets", + "getCash": "uint256:getCash", + "underlying": "address:underlying", + "totalBorrow": "uint256:totalBorrow", + "totalValueLockedOf": "function totalValueLockedOf(address[] markets) view returns (uint256 totalSupplyInUSD)" +} \ No newline at end of file diff --git a/projects/qubit/index.js b/projects/qubit/index.js index 8500c0432ed..5815aa0bc41 100644 --- a/projects/qubit/index.js +++ b/projects/qubit/index.js @@ -1,9 +1,10 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); const BigNumber = require("bignumber.js"); const qBnb = "0xbE1B5D17777565D67A5D2793f879aBF59Ae5D351"; // qBNB -const wBnb = "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c"; //wBNB +const wBnb = ADDRESSES.bsc.WBNB; //wBNB const qoreComptroller = "0xf70314eb9c7fe7d88e6af5aa7f898b3a162dcd48"; const dashboardKlaytn = "0x9A47D707FDffC561E3598990f25d3874af448568"; diff --git a/projects/quicksilver/index.js b/projects/quicksilver/index.js new file mode 100644 index 00000000000..8a1aa8b3e22 --- /dev/null +++ b/projects/quicksilver/index.js @@ -0,0 +1,49 @@ +const sdk = require("@defillama/sdk"); +const { get } = require("../helper/http"); + +const coinGeckoIds = { + uatom: "cosmos", + uosmo: "osmosis", + uregen: "regen", + ujuno: "juno-network", + ustars: "stargaze" +}; + +async function tvl() { + const balances = {}; + + const { zones } = await get( + "https://rest.cosmos.directory/quicksilver/quicksilver/interchainstaking/v1/zones" + ); + const { supply } = await get( + "https://rest.cosmos.directory/quicksilver/cosmos/bank/v1beta1/supply" + ); + + zones.map((zone) => { + const balance = supply.find((coin) => { + return coin.denom === zone.local_denom; + }); + const amount = balance.amount / 1e6; + + const id = coinGeckoIds[zone.base_denom] + if (!id) { + throw new Error("Missing CoinGecko ID for denom " + zone.base_denom); + } + + sdk.util.sumSingleBalance( + balances, + id, + amount * zone.redemption_rate + ); + }); + + return balances; +} + +module.exports = { + timetravel: false, + methodology: "Sum of all the tokens that are liquid staked on Quicksilver", + quicksilver: { + tvl, + }, +}; // node test.js projects/quicksilver/index.js diff --git a/projects/quickswap-perps/index.js b/projects/quickswap-perps/index.js new file mode 100644 index 00000000000..6f862694ffb --- /dev/null +++ b/projects/quickswap-perps/index.js @@ -0,0 +1,7 @@ +const { gmxExports } = require('../helper/gmx') + +module.exports = { + polygon_zkevm:{ + tvl: gmxExports({ vault: '0x99b31498b0a1dae01fc3433e3cb60f095340935c', }) + }, +}; diff --git a/projects/quickswap-v3/index.js b/projects/quickswap-v3/index.js index e5969d3bb38..647708069a3 100644 --- a/projects/quickswap-v3/index.js +++ b/projects/quickswap-v3/index.js @@ -1,73 +1,25 @@ -const { request, gql } = require("graphql-request"); -const { getBlock } = require("../helper/getBlock"); -const { sumTokens2 } = require("../helper/unwrapLPs"); -const { log } = require("../helper/utils"); - -const graphs = { - polygon: "https://api.thegraph.com/subgraphs/name/sameepsi/quickswap-v3", - dogechain: - "https://graph-node.dogechain.dog/subgraphs/name/quickswap/dogechain-info", -}; - -const blacklists = { - polygon: [], - dogechain: [], -}; - -function v3TvlPaged(chain) { - return async (_, _b, { [chain]: block }) => { - // block = await getBlock(_, chain, { [chain]: block }); - log("Fetching data for block: ", chain, block); - const balances = {}; - const size = 1000; - let lastId = ""; - let pools; - const graphQueryPaged = gql` - query poolQuery($lastId: String) { - pools(first:${size} where: {id_gt: $lastId totalValueLockedUSD_gt: 100}) { +const { uniV3Export } = require('../helper/uniswapV3') +const { cachedGraphQuery } = require('../helper/cache') +module.exports = uniV3Export({ + polygon: { factory: '0x411b0facc3489691f28ad58c47006af5e3ab3a28', fromBlock: 32610688, isAlgebra: true, }, + dogechain: { factory: '0xd2480162aa7f02ead7bf4c127465446150d58452', fromBlock: 837574, isAlgebra: true, }, + polygon_zkevm: { factory: '0x4B9f4d2435Ef65559567e5DbFC1BbB37abC43B57', fromBlock: 300, isAlgebra: true, }, +}) + +async function tvl(_, _b, _cb, { api, }) { + const { pools } = await cachedGraphQuery('quickswap-v3/'+api.chain, 'https://graph-node.dogechain.dog/subgraphs/name/quickswap/dogechain-info', `{ + pools(first:1000) { + token0 { + id + } + token1 { id - token0 { id } - token1 { id } } + id } - `; // remove the bad pools - const blacklisted = blacklists[chain] || []; - - do { - const res = await request(graphs[chain], graphQueryPaged, { - lastId, - // block: block - 500, - }); - pools = res.pools; - const tokensAndOwners = pools - .map((i) => [ - [i.token0.id, i.id], - [i.token1.id, i.id], - ]) - .flat(); - log(chain, block, lastId, pools.length); - await sumTokens2({ - balances, - tokensAndOwners, - chain, - block, - blacklistedTokens: blacklisted, - }); - lastId = pools[pools.length - 1].id; - } while (pools.length === size); - - return balances; - }; + }`) + const ownerTokens = pools.map(p=>[[p.token0.id, p.token1.id], p.id]) + return api.sumTokens({ ownerTokens }) } -module.exports = { - timetravel: false, -}; - -const chains = ["polygon", "dogechain"]; - -chains.forEach((chain) => { - module.exports[chain] = { - tvl: v3TvlPaged(chain), - }; -}); +module.exports.dogechain.tvl = tvl \ No newline at end of file diff --git a/projects/quickswap/index.js b/projects/quickswap/index.js index e1f5f510f57..dc552207c59 100644 --- a/projects/quickswap/index.js +++ b/projects/quickswap/index.js @@ -5,7 +5,7 @@ module.exports = { timetravel: true, polygon:{ tvl: getChainTvl({ - polygon: 'https://polygon.furadao.org/subgraphs/name/quickswap' + polygon: 'https://api.thegraph.com/subgraphs/name/sameepsi/quickswap06' })('polygon') }, hallmarks:[ diff --git a/projects/quipuswap-stableswap/index.js b/projects/quipuswap-stableswap/index.js new file mode 100644 index 00000000000..54d77322af9 --- /dev/null +++ b/projects/quipuswap-stableswap/index.js @@ -0,0 +1,52 @@ +const { sumTokens2, getStorage, getBigMapById, } = require('../helper/chain/tezos') +const { PromisePool } = require('@supercharge/promise-pool') +const sdk = require('@defillama/sdk') + +const stableSwap = async (_, _1, _2, { api }) => { + const data = await getStorage('KT1UPiYB4HrLFcHQ5tkjahGnDM55E8iEbNAx') + const pools = await getBigMapById(data.storage.pool_id_to_address); + return sumTokens2({ owners: Object.values(pools), includeTezos: false, }) +} + +const sswapAndYupuna = async (_, _1, _2, { api }) => { + const data = await getStorage('KT1Q9gw5mZSLPGkoCaWc5a8FKLGDiTiULc6R') + const pools = await getBigMapById(data.storage.pool_id_to_address); + const { errors } = await PromisePool.withConcurrency(10) + .for(Object.values(pools).slice(0, 2)) + .process(async pool => { + const { storage: data } = await getStorage(pool) + const tokenInfos = await getBigMapById(data.pools); + const tokenDatas = await getBigMapById(data.tokens); + Object.keys(tokenInfos).forEach(key => { + const { tokens_info } = tokenInfos[key] + const tokenData = tokenDatas[key] + Object.keys(tokens_info).forEach(key => { + const token = getToken(tokenData[key]) + const { reserves } = tokens_info[key] + api.add(token, reserves) + }) + }) + }) + + if (errors && errors.length) + throw errors[0] + return api.getBalances() +} + +function getToken(object) { + if (object.fa12) return object.fa12 + if (object.fa2) { + const { token_id, token_address } = object.fa2 + if (token_id && token_id !== '0') return `${token_address}-${token_id}` + return token_address + } + throw new Error("Unknown token type" + JSON.stringify(object, null, 2)) +} + +module.exports = { + timetravel: false, + tezos: { + tvl: sdk.util.sumChainTvls([stableSwap, sswapAndYupuna]), + } +} + diff --git a/projects/quipuswap-v2/index.js b/projects/quipuswap-v2/index.js new file mode 100644 index 00000000000..106bf9b34e1 --- /dev/null +++ b/projects/quipuswap-v2/index.js @@ -0,0 +1,16 @@ +const { sumTokens2, getStorage, getBigMapById, } = require('../helper/chain/tezos') + + +const factory = 'KT1J8Hr3BP8bpbfmgGpRPoC9nAMSYtStZG43' +module.exports = { + timetravel: false, + tezos: { + tvl: async () => { + const data = await getStorage(factory) + const pools = await getBigMapById(data.storage.pairs); + const owners = Object.values(pools).map(i => i.bucket).filter(i => i) + owners.push(factory) + return sumTokens2({ owners, includeTezos: true, }) + }, + } +} diff --git a/projects/quipuswap-v3/index.js b/projects/quipuswap-v3/index.js new file mode 100644 index 00000000000..7f3cdf16152 --- /dev/null +++ b/projects/quipuswap-v3/index.js @@ -0,0 +1,12 @@ +const { sumTokens2, getStorage, getBigMapById, } = require('../helper/chain/tezos') + +module.exports = { + timetravel: false, + tezos: { + tvl: async () => { + const data = await getStorage('KT1JNNMMGyNNy36Zo6pcgRTMLUZyqRrttMZ4') + const pools = await getBigMapById(data.pools); + return sumTokens2({ owners: Object.values(pools), includeTezos: false, }) + }, + } +} diff --git a/projects/quipuswap/index.js b/projects/quipuswap/index.js index 753468e76fd..209cd982811 100644 --- a/projects/quipuswap/index.js +++ b/projects/quipuswap/index.js @@ -1,14 +1,14 @@ +const { sumTokens2, getStorage, getBigMapById, } = require('../helper/chain/tezos') -const { getLPs, sumTokens2, } = require('../helper/chain/tezos') - -async function tvl() { - const tokenToTokenLPAddress = 'KT1VNEzpf631BLsdPJjt2ZhgUitR392x6cSi' - return sumTokens2({ owners: [tokenToTokenLPAddress, ... await getLPs('Quipuswap')], includeTezos: true, }) -} +const factory = 'KT1Lw8hCoaBrHeTeMXbqHPG4sS4K1xn7yKcD' module.exports = { timetravel: false, tezos: { - tvl, + tvl: async () => { + const data = await getStorage(factory) + const pools = await getBigMapById(data.token_to_exchange); + return sumTokens2({ owners: Object.values(pools), includeTezos: true, }) + }, } -} +} \ No newline at end of file diff --git a/projects/quoll/abi.json b/projects/quoll/abi.json index 1e4331f366c..9acdaaa3f7e 100644 --- a/projects/quoll/abi.json +++ b/projects/quoll/abi.json @@ -1,171 +1,9 @@ { - "userInfo": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "userInfo", - "outputs": [ - { - "internalType": "uint128", - "name": "amount", - "type": "uint128" - }, - { - "internalType": "uint128", - "name": "factor", - "type": "uint128" - }, - { - "internalType": "uint128", - "name": "rewardDebt", - "type": "uint128" - }, - { - "internalType": "uint128", - "name": "pendingWom", - "type": "uint128" - } - ], - "stateMutability": "view", - "type": "function" - }, - "poolLength": { - "inputs": [], - "name": "poolLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "poolInfo": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "poolInfo", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "lpToken", - "type": "address" - }, - { - "internalType": "uint96", - "name": "allocPoint", - "type": "uint96" - }, - { - "internalType": "contract IMultiRewarder", - "name": "rewarder", - "type": "address" - }, - { - "internalType": "uint256", - "name": "sumOfFactors", - "type": "uint256" - }, - { - "internalType": "uint104", - "name": "accWomPerShare", - "type": "uint104" - }, - { - "internalType": "uint104", - "name": "accWomPerFactorShare", - "type": "uint104" - }, - { - "internalType": "uint40", - "name": "lastRewardTimestamp", - "type": "uint40" - } - ], - "stateMutability": "view", - "type": "function" - }, - "pool": { - "inputs": [], - "name": "pool", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "lockedSupply": { - "inputs": [], - "name": "lockedSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "underlyingToken": { - "inputs": [], - "name": "underlyingToken", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "quotePotentialWithdraw": { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "liquidity", - "type": "uint256" - } - ], - "name": "quotePotentialWithdraw", - "outputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "fee", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -} + "userInfo": "function userInfo(uint256, address) view returns (uint128 amount, uint128 factor, uint128 rewardDebt, uint128 pendingWom)", + "poolLength": "uint256:poolLength", + "poolInfo": "function poolInfo(uint256) view returns (address lpToken, uint96 allocPoint, address rewarder, uint256 sumOfFactors, uint104 accWomPerShare, uint104 accWomPerFactorShare, uint40 lastRewardTimestamp)", + "pool": "address:pool", + "lockedSupply": "uint256:lockedSupply", + "underlyingToken": "address:underlyingToken", + "quotePotentialWithdraw": "function quotePotentialWithdraw(address token, uint256 liquidity) view returns (uint256 amount, uint256 fee)" +} \ No newline at end of file diff --git a/projects/quoll/index.js b/projects/quoll/index.js index 9a1f3a6c099..26ea2999c55 100644 --- a/projects/quoll/index.js +++ b/projects/quoll/index.js @@ -1,103 +1,53 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk'); -const { ethers: {BigNumber} } = require("ethers") +const { ethers: { BigNumber } } = require("ethers") const { staking } = require("../helper/staking"); const abi = require('./abi.json'); const voterProxy = '0xe96c48C5FddC0DC1Df5Cf21d68A3D8b3aba68046'; -const masterWombat = '0xE2C07d20AF0Fb50CAE6cDD615CA44AbaAA31F9c8'; +const masterWombat = '0x489833311676B566f888119c29bd997Dc6C95830'; const quoLocker = "0xe76eEA460d02663275962a99529700E132EF526c"; const quo = '0x08b450e4a48C04CDF6DB2bD4cf24057f7B9563fF'; const wom = '0xAD6742A35fB341A9Cc6ad674738Dd8da98b94Fb1'; const veWom = '0x3DA62816dD31c56D9CdF22C6771ddb892cB5b0Cc'; const chain = 'bsc'; -async function voterProxyBalances(block) { - const poolLength = await sdk.api.abi.call({ - abi: abi.poolLength, - target: masterWombat, - params: [], - block, - chain - }).then(l => parseInt(l.output.toString())); +async function voterProxyBalances(api) { + const poolLength = await api.call({ abi: abi.poolLength, target: masterWombat, }) - const masterWombatPoolInfos = await sdk.api.abi.multiCall({ - block, - abi: abi.poolInfo, - calls: Array.from(Array(poolLength).keys()).map((pid) => ({ target: masterWombat, params: [pid] })), - chain, - }); - - const masterWombatVoterProxyBalances = await sdk.api.abi.multiCall({ - block, - abi: abi.userInfo, - calls: Array.from(Array(poolLength).keys()).map((pid) => ({ target: masterWombat, params: [pid, voterProxy] })), - chain, - }); - - const lpTokenTargets = masterWombatPoolInfos.output.map((pool) => ({ target: pool.output.lpToken, params: [] })); + const masterWombatPoolInfos = await api.multiCall({ abi: abi.poolInfo, target: masterWombat, calls: Array.from(Array(+poolLength).keys()), }); + const masterWombatVoterProxyBalances = await api.multiCall({ abi: abi.userInfo, target: masterWombat, calls: Array.from(Array(+poolLength).keys()).map((pid) => ({ params: [pid, voterProxy] })), }); - const lpPools = await sdk.api.abi.multiCall({ - block, - abi: abi.pool, - calls: lpTokenTargets, - chain, - }); - - const underlyingTokens = await sdk.api.abi.multiCall({ - block, - abi: abi.underlyingToken, - calls: lpTokenTargets, - chain, - }); + const lpTokenTargets = masterWombatPoolInfos.map((pool) => pool.lpToken); + const lpPools = await api.multiCall({ abi: abi.pool, calls: lpTokenTargets, }); + const underlyingTokens = await api.multiCall({ abi: abi.underlyingToken, calls: lpTokenTargets, }); - const underlyingAmounts = await sdk.api.abi.multiCall({ - block, + const underlyingAmounts = await api.multiCall({ abi: abi.quotePotentialWithdraw, - calls: lpPools.output.map((pool, index) => { + calls: lpPools.map((pool, index) => { return { - target: pool.output, - params: [underlyingTokens.output[index].output, masterWombatVoterProxyBalances.output[index].output.amount], + target: pool, + params: [underlyingTokens[index], masterWombatVoterProxyBalances[index].amount], }; }), - chain, + permitFailure: true, }); - return underlyingAmounts.output + return underlyingAmounts .map((a, i) => { - if (masterWombatVoterProxyBalances.output[i].output.amount === '0') return; - if (underlyingTokens.output[i].output.toLowerCase() === '0xE85aFCcDaFBE7F2B096f268e31ccE3da8dA2990A'.toLowerCase()) return; // disable aBNBc (ankr bnb) - return ({amount: a.output.amount, token: underlyingTokens.output[i].output}) - }).filter(i => i); + if (+masterWombatVoterProxyBalances[i].amount === 0) return; + if (underlyingTokens[i].toLowerCase() === ADDRESSES.bsc.ankrBNB.toLowerCase()) return; // disable aBNBc (ankr bnb) + if (a) + api.add(underlyingTokens[i], a.amount) + }) } -async function veWomBalance(block) { - return sdk.api.erc20.balanceOf({ - owner: voterProxy, - target: veWom, - block, - chain, - }).then(s => s.output); -} - -async function tvl(timestamp, ethereumBlock, chainBlocks) { - const block = chainBlocks[chain]; - - let balances = {}; - balances[`${chain}:${wom}`] = await veWomBalance(block); - - const vpBalances = await voterProxyBalances(block); - vpBalances.forEach(b => { - if (balances[`${chain}:${b.token}`]) { - balances[`${chain}:${b.token}`] = BigNumber.from(balances[`${chain}:${b.token}`]).add(BigNumber.from(b.amount)).toString(); - } else { - balances[`${chain}:${b.token}`] = b.amount; - } - }); - - return balances; +async function tvl(timestamp, ethereumBlock, chainBlocks, { api }) { + api.add(wom, await api.call({ abi: 'erc20:balanceOf', target: veWom, params: [voterProxy], })) + await voterProxyBalances(api) } module.exports = { methodology: - "TVL of Quoll Finance consists of Wombat LP tokens staked in MasterWombat, WOM tokens locked in veWOM, and Quoll tokens locked in QUO Vote Lock contract.", + "TVL of Quoll Finance consists of Wombat LP tokens staked in MasterWombat, WOM tokens locked in veWOM, and Quoll tokens locked in QUO Vote Lock contract.", bsc: { tvl, staking: staking( diff --git a/projects/rabbitfinance/abi.json b/projects/rabbitfinance/abi.json index c8ba558d1f9..f69565b9e2b 100644 --- a/projects/rabbitfinance/abi.json +++ b/projects/rabbitfinance/abi.json @@ -1,11 +1,3 @@ -{ - "totalToken": { - "inputs": [ - { "internalType": "address", "name": "token", "type": "address" } - ], - "name": "totalToken", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - } -} +{ + "totalToken": "function totalToken(address token) view returns (uint256)" +} \ No newline at end of file diff --git a/projects/rabbitfinance/index.js b/projects/rabbitfinance/index.js index 863dbf75ed4..48b248c7937 100644 --- a/projects/rabbitfinance/index.js +++ b/projects/rabbitfinance/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); const { staking } = require("../helper/staking"); @@ -27,10 +28,10 @@ const bscTvl = async (timestamp, ethBlock, { [chain]: block }) => { // ).map((addr) => addr.contract_address); const poolsInfo = [ - '0x55d398326f99059ff775485246999027b3197955', - '0xe9e7cea3dedca5984780bafc599bd69add087d56', - '0x2170ed0880ac9a755fd29b2688956bd959f933f8', - '0x7130d2a12b9bcbfae4f2634d864a1ee1ce3ead9c', + ADDRESSES.bsc.USDT, + ADDRESSES.bsc.BUSD, + ADDRESSES.bsc.ETH, + ADDRESSES.bsc.BTCB, '0x95a1199eba84ac5f19546519e287d43d2f0e1b41', '0x3ee2200efb3400fabb9aacf31297cbdd1d435d47', '0x9c65ab58d8d978db963e63f2bfb7121627e3a739', diff --git a/projects/rabbitx/index.js b/projects/rabbitx/index.js new file mode 100644 index 00000000000..6391347eecd --- /dev/null +++ b/projects/rabbitx/index.js @@ -0,0 +1,8 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require("../helper/unwrapLPs"); + +module.exports = { + ethereum: { + tvl: sumTokensExport({ owners: ['0xFc7f884DE22a59c0009C91733196b012Aecb8F41', '0x3b8F6D6970a24A58b52374C539297ae02A3c4Ae4', '0x7fAb440A0251dA67B316d2c0431E3Ccf4520Cd42',], tokens: [ADDRESSES.ethereum.USDT]}) + } +} diff --git a/projects/radao/index.js b/projects/radao/index.js index 305d5e460d8..775f61b5b21 100644 --- a/projects/radao/index.js +++ b/projects/radao/index.js @@ -1,7 +1,8 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { ohmTvl } = require("../helper/ohm"); const treasuryAddress = "0x652A6F3459B276887bf2Fe9fb0FF810c9B24e1E3"; -const BUSD = "0xe9e7cea3dedca5984780bafc599bd69add087d56"; +const BUSD = ADDRESSES.bsc.BUSD; const RaStaking = "0xf45aE86eD6C7d7A6b6C4640e04FEc228641D4C64"; const RA = "0xcc238200cFfdA7A5E2810086c26d5334e64F1155"; diff --git a/projects/radial/index.js b/projects/radial/index.js index f75a8c8513c..778a92ce848 100644 --- a/projects/radial/index.js +++ b/projects/radial/index.js @@ -11,28 +11,14 @@ const { const { transformFantomAddress } = require("../helper/portedTokens"); const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); - const tokenAbi = require("../helper/abis/token.json"); - const token0Abi = require("../helper/abis/token0.json"); - const token1Abi = require("../helper/abis/token1.json"); - const getReservesAbi = require("../helper/abis/getReserves.json"); - const shareValue = { - inputs: [], - name: "getShareValue", - outputs: [{ internalType: "uint256", name: "", type: "uint256" }], - stateMutability: "view", - type: "function", - }; + const tokenAbi = 'address:token' + const token0Abi = 'address:token0' + const token1Abi = 'address:token1' + const getReservesAbi = 'function getReserves() view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast)' + const shareValue = "uint256:getShareValue"; const xSCREAM = "0xe3D17C7e840ec140a7A51ACA351a482231760824"; const xCREDIT = "0xd9e28749e80D867d5d14217416BFf0e668C10645"; - const shareTarot = { - inputs: [{ internalType: "uint256", name: "_share", type: "uint256" }], - name: "shareValuedAsUnderlying", - outputs: [ - { internalType: "uint256", name: "underlyingAmount_", type: "uint256" }, - ], - stateMutability: "nonpayable", - type: "function", - }; + const shareTarot = 'function shareValuedAsUnderlying(uint256 _share) returns (uint256 underlyingAmount_)'; const xTAROT = "0x74D1D2A851e339B8cB953716445Be7E8aBdf92F4"; const fBEET = "0xfcef8a994209d6916EB2C86cDD2AFD60Aa6F54b1"; const masterChef = "0x6f536B36d02F362CfF4278190f922582d59E7e08"; @@ -66,6 +52,7 @@ const { const balance = tokenBalances.output[idx].output; const token = symbol.input.target.toLowerCase(); if (token === stakingToken) { + return; } else if (isLP(symbol.output, token, chain)) { lpPositions.push({ balance, diff --git a/projects/radiant-v2/index.js b/projects/radiant-v2/index.js new file mode 100644 index 00000000000..7d2ed422967 --- /dev/null +++ b/projects/radiant-v2/index.js @@ -0,0 +1,18 @@ +const { staking } = require("../helper/staking"); +const { sumTokensExport } = require("../helper/unknownTokens"); +const { aaveExports } = require("../helper/aave"); + +module.exports = { + methodology: + "Counts the tokens locked in the contracts to be used as collateral to borrow or to earn yield. Borrowed coins are not counted towards the TVL, so only the coins actually locked in the contracts are counted. There's multiple reasons behind this but one of the main ones is to avoid inflating the TVL through cycled lending", + arbitrum: { + ...aaveExports('arbitrum', '0x9D36DCe6c66E3c206526f5D7B3308fFF16c1aa5E'), + // balancer pool is not unwrapped properly, so we use staking and rely on price api instead + pool2: staking("0x76ba3eC5f5adBf1C58c91e86502232317EeA72dE", "0x32df62dc3aed2cd6224193052ce665dc18165841"), + }, + bsc: { + ...aaveExports('bsc', '0x16Cd518fE9db541feA810b3091fBee6829a9B0Ce'), + // balancer pool is not unwrapped properly, so we use staking and rely on price api instead + pool2: sumTokensExport({ owner: '0x4fd9f7c5ca0829a656561486bada018505dfcb5e', tokens: ['0x346575fc7f07e6994d76199e41d13dc1575322e1'], useDefaultCoreAssets: true, }) + }, +}; diff --git a/projects/radiant/index.js b/projects/radiant/index.js index 66745113ec7..f34f56249c3 100644 --- a/projects/radiant/index.js +++ b/projects/radiant/index.js @@ -1,7 +1,6 @@ const { staking } = require("../helper/staking"); const { pool2 } = require("../helper/pool2"); -const { aaveChainTvl } = require("../helper/aave"); -const { transformArbitrumAddress } = require("../helper/portedTokens"); +const { aaveExports } = require("../helper/aave"); const stakingContract = "0xc2054A8C33bfce28De8aF4aF548C48915c455c13"; const RADIANT = "0x0C4681e6C0235179ec3D4F4fc4DF3d14FDD96017"; @@ -9,26 +8,11 @@ const RADIANT = "0x0C4681e6C0235179ec3D4F4fc4DF3d14FDD96017"; const stakingContractPool2 = "0xc963ef7d977ECb0Ab71d835C4cb1Bf737f28d010"; const RADIANT_WETH_sushiLP = "0x24704aFF49645D32655A76Df6d407E02d146dAfC"; -function lending(borrowed) { - return async (timestamp, ethBlock, chainBlocks) => { - const transform = await transformArbitrumAddress(); - return aaveChainTvl( - "arbitrum", - "0x7BB843f889e3a0B307299c3B65e089bFfe9c0bE0", - transform, - undefined, - borrowed - )(timestamp, ethBlock, chainBlocks); - }; -} - module.exports = { - timetravel: true, methodology: "Counts the tokens locked in the contracts to be used as collateral to borrow or to earn yield. Borrowed coins are not counted towards the TVL, so only the coins actually locked in the contracts are counted. There's multiple reasons behind this but one of the main ones is to avoid inflating the TVL through cycled lending", arbitrum: { - tvl: lending(false), - borrowed: lending(true), + ...aaveExports('arbitrum', '0x7BB843f889e3a0B307299c3B65e089bFfe9c0bE0'), staking: staking(stakingContract, RADIANT, "arbitrum"), pool2: pool2(stakingContractPool2, RADIANT_WETH_sushiLP, "arbitrum"), }, diff --git a/projects/radiate-protocol/index.js b/projects/radiate-protocol/index.js new file mode 100644 index 00000000000..6e1c94227fd --- /dev/null +++ b/projects/radiate-protocol/index.js @@ -0,0 +1,17 @@ +const { sumTokens2 } = require('../helper/unwrapLPs') + +async function tvl(_, _b, _cb, { api, }) { + const vault = '0xC6dC7749781F7Ba1e9424704B2904f2F94D3eb63' + const dlp = await api.call({ abi: 'address:dlp', target: vault}) + const masterchef = await api.call({ abi: 'address:mfd', target: vault}) + const { total }= await api.call({ abi:"function lockedBalances(address user) view returns (uint256 total, uint256 unlockable, uint256 locked, uint256 lockedMultiplier, tuple(uint256 amount, uint256 unlockTime, uint256, uint256)[] lockData)", target: masterchef, params: vault }) + api.add(dlp, total) + return sumTokens2({ owner: vault, tokens: [dlp], api}) +} + +module.exports = { + doublecounted: true, + arbitrum: { + tvl, + }, +} \ No newline at end of file diff --git a/projects/radioshack/index.js b/projects/radioshack/index.js index 6f1a8ac0ad7..1b8a3d7218e 100644 --- a/projects/radioshack/index.js +++ b/projects/radioshack/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens2 } = require('../helper/unwrapLPs') const { getUniTVL } = require('../helper/unknownTokens') @@ -13,7 +14,7 @@ const chainConfig = { }, polygon: { factory: '0xB581D0A3b7Ea5cDc029260e989f768Ae167Ef39B', - radio: '0x613a489785C95afEB3b404CC41565cCff107B6E0', + radio: ADDRESSES.polygon.RADIO, shack: '0x6E65Ae5572DF196FAe40Be2545Ebc2A9A24eAcE9', stakingContracts: ['0x1D72b58d2b73942451b1D0DFE2B6ef2c5a52a301', '0x01d97Df7dc98E97da0c14ffB27Adf00fda0245DD', '0x9E8C85c40001a7264a1a1B11999F8f7b0503D60a'], }, diff --git a/projects/raft/index.js b/projects/raft/index.js new file mode 100644 index 00000000000..3f05728ff5d --- /dev/null +++ b/projects/raft/index.js @@ -0,0 +1,23 @@ +const { sumTokensExport } = require("../helper/unwrapLPs"); +const ADDRESSES = require("../helper/coreAssets.json"); + +const RAFT_POSITION_MANAGER = "0x5f59b322eb3e16a0c78846195af1f588b77403fc"; +const WRAPPED_RETH = "0xb69e35fb4a157028b92f42655090b984609ae598"; + +function transformAddress(token) { + if (token === WRAPPED_RETH) { + return ADDRESSES.ethereum.RETH; + } + + return token; +} + +module.exports = { + ethereum: { + tvl: sumTokensExport({ + owner: RAFT_POSITION_MANAGER, + tokens: [ADDRESSES.ethereum.WSTETH, WRAPPED_RETH], + transformAddress: transformAddress, + }), + }, +}; diff --git a/projects/ragetrade/index.js b/projects/ragetrade/index.js index 8c7bd96ac38..9309c6aeacf 100644 --- a/projects/ragetrade/index.js +++ b/projects/ragetrade/index.js @@ -1,29 +1,22 @@ -const sdk = require("@defillama/sdk"); -const { transformArbitrumAddress } = require("../helper/portedTokens"); - -const TRICRYPTO_VAULT = "0x1d42783E7eeacae12EbC315D1D2D0E3C6230a068"; -const USDC = "0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8"; -const abi = require('./tricrypto-vault.json'); - -const arbitrumTvl = async (timestamp, ethBlock, { arbitrum: block }) => { - const balances = {}; - const transform = await transformArbitrumAddress(); - - const collateralBalance = ( - await sdk.api.abi.call({ - abi, - chain: "arbitrum", - target: TRICRYPTO_VAULT, - params: [], - block, - }) - ).output; - sdk.util.sumSingleBalance(balances, transform(USDC), collateralBalance); - return balances; -}; - module.exports = { + misrepresentedTokens: true, + hallmarks: [ + [1670856656, "Launch GLP Vaults"] + ], arbitrum: { - tvl: arbitrumTvl, - }, -}; + tvl: async (_, _b, _cb, { api }) => { + const vaults = [ + '0x1d42783E7eeacae12EbC315D1D2D0E3C6230a068', // tricrypto + '0xf9305009fba7e381b3337b5fa157936d73c2cf36', // dnGmxSeniorVault + '0x8478ab5064ebac770ddce77e7d31d969205f041e', // dnGmxJuniorVault + ] + const bals = await api.multiCall({ + abi: 'int256:getVaultMarketValue', calls: vaults, + }) + + return { + tether: bals.reduce((a, i) => a + i / 1e6, 0), + } + } + } +} \ No newline at end of file diff --git a/projects/ragetrade/tricrypto-vault.json b/projects/ragetrade/tricrypto-vault.json deleted file mode 100644 index fa748812ca6..00000000000 --- a/projects/ragetrade/tricrypto-vault.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "inputs": [], - "name": "getVaultMarketValue", - "outputs": [ - { - "internalType": "int256", - "name": "vaultMarketValue", - "type": "int256" - } - ], - "stateMutability": "view", - "type": "function" -} diff --git a/projects/ragnarokdao/index.js b/projects/ragnarokdao/index.js index 74af7084bf5..9f9d0b63575 100644 --- a/projects/ragnarokdao/index.js +++ b/projects/ragnarokdao/index.js @@ -1,10 +1,11 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { ohmTvl } = require("../helper/ohm"); const treasury = "0xfa9cCe3098C02F770DcB2D17Df9B8f5331bE86D0"; const rgk = "0x46fccf447f74ec97a521615fce111118597071f7"; const stakingContract = "0xeb6B44834E002ECDEAdF9E61448B21cCc33284ca"; const mim = "0x130966628846bfd36ff31a822705796e8cb8c18d"; -const usdc = "0xa7d7079b0fead91f3e65f86e8915cb59c1a4c664"; +const usdc = ADDRESSES.avax.USDC_e; const rgkMimJLP = "0xE8419ecDA1C76c38800b21e7D43BDB6B02f51ACE"; module.exports = { ...ohmTvl( diff --git a/projects/raidshift/index.js b/projects/raidshift/index.js new file mode 100644 index 00000000000..a97ef50d2d2 --- /dev/null +++ b/projects/raidshift/index.js @@ -0,0 +1,37 @@ +const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') + +const contracts = [ + // 'TC3TuowSyMxJSLaqiWJuCkZ2i3q7JCFR4x', + // 'TGxDz3kgbxwEAESNtfWk4JFXXEgZAoWqeG', + 'TVMuhpXdRvNjjFAWqZ5urvhrQQyFvc19SN', + 'TJmx4Zg4xMjCZR5Q3aoCyDmYY3r42xU2GZ', + 'TMiHbWfnzh8cFmxNptoDgBvhuFSe2eiDFQ', + 'TVR8KWCV21nAM6Epifzh73Y9wy8GFzKdBP', + 'TWxrUkHSSHwJoNtLPJimVmgKhmwVGvhwUZ', + 'TSbbCH6nss56q1D2NtSKquuNPYZ2ZDyKZg', + 'TPxT4UrAkbp4fK4CtjuMmvS9u85HjU7EYq', + 'TEEQvDKY9sFQ65xxwhSH4QBkLD2NtwoN4a', + 'TUHHCVD4MR7LXthbS2fBBw5bXARhBg4k5G', + 'TPfAqGJ83NbVcRcsMFx7GJ749t9VV6cZvp', +] + +async function tvl() { + const { api } = arguments[3] + const tokenAs = await api.multiCall({ calls: contracts, abi: 'address:tokenA', permitFailure: true }) + const tokenBs = await api.multiCall({ calls: contracts, abi: 'address:tokenB', permitFailure: true }) + const tokensAndOwners = [] + tokenAs.forEach((t, i) => tokensAndOwners.push([fixNullToken(t), contracts[i]])) + tokenBs.forEach((t, i) => tokensAndOwners.push([fixNullToken(t), contracts[i]])) + return sumTokens2({ api, tokensAndOwners, blacklistedTokens: ['TNEjtKFHWpz8bN2ZruLVY2NW2AD39uSUAs']}) + + + function fixNullToken(token) { + if (token === '0x') return nullAddress + return token + }} + +module.exports = { + tron: { + tvl, + }, +} diff --git a/projects/railgun/ABI.json b/projects/railgun/ABI.json deleted file mode 100644 index fd140aafcd9..00000000000 --- a/projects/railgun/ABI.json +++ /dev/null @@ -1,215 +0,0 @@ -{ - "DEPLOY_TIME": { - "inputs": [], - "name": "DEPLOY_TIME", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "SNAPSHOT_INTERVAL": { - "inputs": [], - "name": "SNAPSHOT_INTERVAL", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "STAKE_LOCKTIME": { - "inputs": [], - "name": "STAKE_LOCKTIME", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "currentInterval": { - "inputs": [], - "name": "currentInterval", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "globalsSnapshot": { - "inputs": [ - { - "internalType": "uint256", - "name": "_index", - "type": "uint256" - } - ], - "name": "globalsSnapshot", - "outputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "interval", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalVotingPower", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalStaked", - "type": "uint256" - } - ], - "internalType": "struct Staking.GlobalsSnapshot", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - "globalsSnapshotAt": { - "inputs": [ - { - "internalType": "uint256", - "name": "_interval", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_hint", - "type": "uint256" - } - ], - "name": "globalsSnapshotAt", - "outputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "interval", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalVotingPower", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalStaked", - "type": "uint256" - } - ], - "internalType": "struct Staking.GlobalsSnapshot", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - "globalsSnapshotLength": { - "inputs": [], - "name": "globalsSnapshotLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "intervalAtTime": { - "inputs": [ - { - "internalType": "uint256", - "name": "_time", - "type": "uint256" - } - ], - "name": "intervalAtTime", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "latestGlobalsSnapshotInterval": { - "inputs": [], - "name": "latestGlobalsSnapshotInterval", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "stakingToken": { - "inputs": [], - "name": "stakingToken", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "totalStaked": { - "inputs": [], - "name": "totalStaked", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "totalVotingPower": { - "inputs": [], - "name": "totalVotingPower", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -} diff --git a/projects/railgun/index.js b/projects/railgun/index.js index 1eea1739340..abc8d449f93 100644 --- a/projects/railgun/index.js +++ b/projects/railgun/index.js @@ -1,77 +1,52 @@ -const sdk = require('@defillama/sdk'); -const abi = require('./ABI.json'); -const { getTokens } = require('../helper/getTokens'); -const { getChainTransform } = require('../helper/portedTokens'); +const { covalentGetTokens } = require('../helper/http'); const { sumTokens2 } = require('../helper/unwrapLPs') +const { staking } = require('../helper/staking') const CONTRACTS = { ethereum: { STAKING: '0xee6a649aa3766bd117e12c161726b693a1b2ee20', RAIL: '0xe76C6c83af64e4C60245D8C7dE953DF673a7A33D', - TREASURY: '0xE8A8B458BcD1Ececc6b6b58F80929b29cCecFF40', PROXY: '0xFA7093CDD9EE6932B4eb2c9e1cde7CE00B1FA4b9', }, bsc: { STAKING: '0x753f0F9BA003DDA95eb9284533Cf5B0F19e441dc', RAIL: '0x3F847b01d4d498a293e3197B186356039eCd737F', - TREASURY: '0x19B620929f97b7b990801496c3b361CA5dEf8C71', PROXY: '0x590162bf4b50F6576a459B75309eE21D92178A10', }, polygon: { STAKING: '0x9AC2bA4bf7FaCB0bbB33447e5fF8f8D63B71dDC1', RAIL: '0x92A9C92C215092720C731c96D4Ff508c831a714f', - TREASURY: '0x7C956dB76b4Bd483F96fcE6beA3615f263aFD333', PROXY: '0x19B620929f97b7b990801496c3b361CA5dEf8C71', }, + + arbitrum: { + PROXY: '0xFA7093CDD9EE6932B4eb2c9e1cde7CE00B1FA4b9', + }, }; +const blacklistedTokens = [ + '0x2e14949ce0133ccfd4c0cbe707ba878015a7a40c', +] function getTVLFunc(contractAddress, chain) { - return async function (timestamp, _, { [chain]: block }) { - const tokens = await getTokens(contractAddress, chain); - return sumTokens2({ owner: contractAddress, tokens, blacklistedTokens: [CONTRACTS[chain].RAIL], chain, block, }) - } -} - -function getStakingFunc(stackingContractAddress, chain) { - return async function staking(timestamp, blockEth, { [chain]: block }) { - const chainTransform = await getChainTransform(chain); - const balances = {}; - - const railAddress = chainTransform(CONTRACTS[chain].RAIL); - const interval = await sdk.api.abi.call({ - target: stackingContractAddress, - abi: abi['intervalAtTime'], - params: timestamp, - block: block, - chain - }); - - const railTVL = await sdk.api.abi.call({ - target: stackingContractAddress, - abi: abi['globalsSnapshotAt'], - params: [interval.output, 0], - block: block, - chain - }); - - balances[railAddress] = railTVL.output.totalStaked; - return balances; + return async function (timestamp, _, { [chain]: block }, { api }) { + const tokens = await covalentGetTokens(contractAddress, chain); + if (CONTRACTS[chain].RAIL) blacklistedTokens.push(CONTRACTS[chain].RAIL) + return sumTokens2({ owner: contractAddress, tokens, blacklistedTokens, api }) } } function getChainTVL(chain) { return { - staking: getStakingFunc(CONTRACTS[chain].STAKING, chain), - treasury: getTVLFunc(CONTRACTS[chain].TREASURY, chain), + staking: CONTRACTS[chain].STAKING ? staking(CONTRACTS[chain].STAKING, CONTRACTS[chain].RAIL) : undefined, tvl: getTVLFunc(CONTRACTS[chain].PROXY, chain), }; } module.exports = { - ethereum: getChainTVL('ethereum'), - bsc: getChainTVL('bsc'), - polygon: getChainTVL('polygon'), -} +}; +Object.keys(CONTRACTS).forEach(chain => { + module.exports[chain] = getChainTVL(chain) +}) diff --git a/projects/ramp/abi.json b/projects/ramp/abi.json index 078b416a105..2bb16d74587 100644 --- a/projects/ramp/abi.json +++ b/projects/ramp/abi.json @@ -1,40 +1,4 @@ { - "getPoolBalance": { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - } - ], - "name": "getPoolBalance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getPoolAmount": { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - } - ], - "name": "getPoolAmount", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -} + "getPoolBalance": "function getPoolBalance(address _token) view returns (uint256)", + "getPoolAmount": "function getPoolAmount(address _token) view returns (uint256)" +} \ No newline at end of file diff --git a/projects/ramses-cl/index.js b/projects/ramses-cl/index.js new file mode 100644 index 00000000000..476cff6cc3a --- /dev/null +++ b/projects/ramses-cl/index.js @@ -0,0 +1,5 @@ +const { uniV3Export } = require('../helper/uniswapV3') + +module.exports = uniV3Export({ + arbitrum: { factory: '0xaa2cd7477c451e703f3b9ba5663334914763edf8', fromBlock: 90593047, }, +}) \ No newline at end of file diff --git a/projects/ramses/index.js b/projects/ramses/index.js new file mode 100644 index 00000000000..5d6661fc30f --- /dev/null +++ b/projects/ramses/index.js @@ -0,0 +1,10 @@ +const {getUniTVL} = require('../helper/unknownTokens') +const { staking } = require('../helper/staking') + +module.exports = { + misrepresentedTokens: true, + arbitrum:{ + tvl: getUniTVL({ factory: '0xAAA20D08e59F6561f242b08513D36266C5A29415', useDefaultCoreAssets: true, hasStablePools: true, stablePoolSymbol: 'crAMM' }), + staking: staking("0xAAA343032aA79eE9a6897Dab03bef967c3289a06", "0xaaa6c1e32c55a7bfa8066a6fae9b42650f262418"), + }, +} \ No newline at end of file diff --git a/projects/range/abi.json b/projects/range/abi.json new file mode 100644 index 00000000000..240ac80526a --- /dev/null +++ b/projects/range/abi.json @@ -0,0 +1,3 @@ +{ + "underlyingBalance": "function getUnderlyingBalances() public view returns (uint256 amount0Current, uint256 amount1Current)" +} \ No newline at end of file diff --git a/projects/range/index.js b/projects/range/index.js new file mode 100644 index 00000000000..c4254faff63 --- /dev/null +++ b/projects/range/index.js @@ -0,0 +1,39 @@ +const { getLogs } = require('../helper/cache/getLogs') + +const ABI = require('./abi.json'); +const config = { + ethereum: { factory: '0xf1e70677fb1f49471604c012e8B42BA11226336b', fromBlock: 17266660, }, + arbitrum: { factory: '0xB9084c75D361D1d4cfC7663ef31591DeAB1086d6', fromBlock: 88503603, }, + bsc: { factory: '0xad2b34a2245b5a7378964BC820e8F34D14adF312', fromBlock: 28026886, }, + polygon: { factory: '0xad2b34a2245b5a7378964BC820e8F34D14adF312', fromBlock: 42446548, } +} + +module.exports = { + methodology: 'assets deployed on DEX as LP + asset balance of vaults', + doublecounted: true, + start: 1683965157, +}; + +Object.keys(config).forEach(chain => { + const { factory, fromBlock } = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const logs = await getLogs({ + api, + target: factory, + topic: 'VaultCreated(address,address)', + eventAbi: 'event VaultCreated(address indexed uniPool, address indexed vault)', + onlyArgs: true, + fromBlock, + }) + const vaults = logs.map(log => log.vault) + const token0s = await api.multiCall({ abi: "address:token0", calls: vaults, }) + const token1s = await api.multiCall({ abi: "address:token1", calls: vaults, }) + const bals = await api.multiCall({ abi: ABI.underlyingBalance, calls: vaults, }) + bals.forEach(({ amount0Current, amount1Current }, i) => { + api.add(token0s[i], amount0Current) + api.add(token1s[i], amount1Current) + }) + } + } +}) \ No newline at end of file diff --git a/projects/rari/abi.json b/projects/rari/abi.json index d099c745855..13d807fb47b 100644 --- a/projects/rari/abi.json +++ b/projects/rari/abi.json @@ -1,137 +1,9 @@ { - "getReserves": { - "constant": true, - "inputs": [], - "name": "getReserves", - "outputs": [ - { - "internalType": "uint112", - "name": "_reserve0", - "type": "uint112" - }, - { - "internalType": "uint112", - "name": "_reserve1", - "type": "uint112" - }, - { - "internalType": "uint32", - "name": "_blockTimestampLast", - "type": "uint32" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "getPublicPools": { - "inputs": [], - "name": "getPublicPools", - "outputs": [ - { "internalType": "uint256[]", "name": "", "type": "uint256[]" }, - { - "components": [ - { "internalType": "string", "name": "name", "type": "string" }, - { "internalType": "address", "name": "creator", "type": "address" }, - { - "internalType": "address", - "name": "comptroller", - "type": "address" - }, - { - "internalType": "uint256", - "name": "blockPosted", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "timestampPosted", - "type": "uint256" - } - ], - "internalType": "struct FusePoolDirectory.FusePool[]", - "name": "", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function", - "constant": true - }, - "getPoolSummary": { - "inputs": [ - { - "internalType": "contract Comptroller", - "name": "comptroller", - "type": "address" - } - ], - "name": "getPoolSummary", - "outputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" }, - { "internalType": "uint256", "name": "", "type": "uint256" }, - { "internalType": "address[]", "name": "", "type": "address[]" }, - { "internalType": "string[]", "name": "", "type": "string[]" } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - "getRawFundBalancesAndPrices": { - "constant": false, - "inputs": [], - "name": "getRawFundBalancesAndPrices", - "outputs": [ - { "internalType": "string[]", "name": "", "type": "string[]" }, - { "internalType": "uint256[]", "name": "", "type": "uint256[]" }, - { "internalType": "uint8[][]", "name": "", "type": "uint8[][]" }, - { "internalType": "uint256[][]", "name": "", "type": "uint256[][]" }, - { "internalType": "uint256[]", "name": "", "type": "uint256[]" } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - "getRawFundBalances": { - "constant": false, - "inputs": [], - "name": "getRawFundBalances", - "outputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" }, - { "internalType": "uint8[]", "name": "", "type": "uint8[]" }, - { "internalType": "uint256[]", "name": "", "type": "uint256[]" } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - "balanceOf":{ - "constant": true, - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "totalStaked": { - "constant": true, - "inputs": [], - "name": "totalStaked", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - } -} + "getReserves": "function getReserves() view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast)", + "getPublicPools": "function getPublicPools() view returns (uint256[], tuple(string name, address creator, address comptroller, uint256 blockPosted, uint256 timestampPosted)[])", + "getPoolSummary": "function getPoolSummary(address comptroller) returns (uint256, uint256, address[], string[])", + "getRawFundBalancesAndPrices": "function getRawFundBalancesAndPrices() returns (string[], uint256[], uint8[][], uint256[][], uint256[])", + "getRawFundBalances": "function getRawFundBalances() returns (uint256, uint8[], uint256[])", + "balanceOf": "function balanceOf(address account) view returns (uint256)", + "totalStaked": "uint256:totalStaked" +} \ No newline at end of file diff --git a/projects/rari/index.js b/projects/rari/index.js index 2686f48e3a2..5d8d5cfc694 100644 --- a/projects/rari/index.js +++ b/projects/rari/index.js @@ -1,10 +1,13 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const { requery } = require("../helper/requery"); const abi = require("./abi"); const { default: BigNumber } = require("bignumber.js"); const { getCompoundV2Tvl } = require('../helper/compound') const { pool2 } = require('../helper/pool2'); -const { getBlock } = require("../helper/getBlock"); +const { getBlock } = require("../helper/http"); +const { sliceIntoChunks } = require("../helper/utils"); +const { sumTokens2 } = require("../helper/unwrapLPs"); const earnETHPoolFundControllerAddressesIncludingLegacy = [ '0xD9F223A36C2e398B0886F945a7e556B41EF91A3C', @@ -13,49 +16,55 @@ const earnETHPoolFundControllerAddressesIncludingLegacy = [ ] const earnDAIPoolControllerAddressesIncludingLegacy = [ '0x7C332FeA58056D1EF6aB2B2016ce4900773DC399', - '0x3F579F097F2CE8696Ae8C417582CfAFdE9Ec9966' + // '0x3F579F097F2CE8696Ae8C417582CfAFdE9Ec9966' ] const earnStablePoolAddressesIncludingLegacy = [ '0x4a785fa6fcd2e0845a24847beb7bddd26f996d4d', - '0x27C4E34163b5FD2122cE43a40e3eaa4d58eEbeaF', - '0x318cfd99b60a63d265d2291a4ab982073fbf245d', - '0xb6b79D857858004BF475e4A57D4A446DA4884866', - '0xD4be7E211680e12c08bbE9054F0dA0D646c45228', - '0xB202cAd3965997f2F5E67B349B2C5df036b9792e', - '0xe4deE94233dd4d7c2504744eE6d34f3875b3B439' + // '0x27C4E34163b5FD2122cE43a40e3eaa4d58eEbeaF', + // '0x318cfd99b60a63d265d2291a4ab982073fbf245d', + // '0xb6b79D857858004BF475e4A57D4A446DA4884866', + // '0xD4be7E211680e12c08bbE9054F0dA0D646c45228', + // '0xB202cAd3965997f2F5E67B349B2C5df036b9792e', + // '0xe4deE94233dd4d7c2504744eE6d34f3875b3B439' ] const fusePoolLensAddress = '0x8dA38681826f4ABBe089643D2B3fE4C6e4730493' const fusePoolDirectoryAddress = '0x835482FE0532f169024d5E9410199369aAD5C77E' const rariGovernanceTokenUniswapDistributorAddress = '0x1FA69a416bCF8572577d3949b742fBB0a9CD98c7' -const sushiETHRGTPairAddress = '0x18a797c7c70c1bf22fdee1c09062aba709cacf04' -const WETHTokenAddress = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2' -const RGTTokenAddress = '0xD291E7a03283640FDc51b121aC401383A46cC623' const RGTETHSushiLPTokenAddress = '0x18a797c7c70c1bf22fdee1c09062aba709cacf04' -const ETHAddress = '0x0000000000000000000000000000000000000000' +const ETHAddress = ADDRESSES.null const bigNumZero = BigNumber('0') const tokenMapWithKeysAsSymbol = { - 'DAI': '0x6b175474e89094c44da98b954eedeac495271d0f', - 'USDC': '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', - 'USDT': '0xdac17f958d2ee523a2206206994597c13d831ec7', - 'TUSD': '0x0000000000085d4780b73119b644ae5ecd22b376', - 'BUSD': '0x4fabb145d64652a948d72533023f6e7a623c7c53', - 'SUSD': '0x57ab1ec28d129707052df4df418d58a2d46d5f51', + 'DAI': ADDRESSES.ethereum.DAI, + 'USDC': ADDRESSES.ethereum.USDC, + 'USDT': ADDRESSES.ethereum.USDT, + 'TUSD': ADDRESSES.ethereum.TUSD, + 'BUSD': ADDRESSES.ethereum.BUSD, + 'SUSD': ADDRESSES.ethereum.sUSD, 'MUSD': '0xe2f2a5c287993345a840db3b0845fbc70f5935a5' } const fusePoolData = {} async function getFusePoolData(pools, block) { - const data = await sdk.api.abi.multiCall({ + console.log({ target: fusePoolLensAddress, abi: abi['getPoolSummary'], block, - calls: pools.map((poolInfo) => ({ - params: [poolInfo[2]] - })) + calls: pools.map(i => i.comptroller) }) - requery(data, 'ethereum', block, abi['getPoolSummary']) + const data = { output: [] } + const chunks = sliceIntoChunks(pools.map(i => ({ params: i.comptroller })), 25) + for (const chunk of chunks) { + const items = await sdk.api2.abi.multiCall({ + target: fusePoolLensAddress, + abi: abi['getPoolSummary'], + block, + calls: chunk + }) + console.log(items) + data.output.push(...items.output) + } return data } @@ -72,6 +81,7 @@ async function getFusePools(timestamp, block, balances, borrowed) { fusePoolData[block] = getFusePoolData(fusePools, block) const poolSummaries = await fusePoolData[block] + console.log(poolSummaries) for (let summaryResult of poolSummaries.output) { if (summaryResult.success) { @@ -92,6 +102,9 @@ async function getFusePools(timestamp, block, balances, borrowed) { } async function borrowed(timestamp, block) { + if (block > 14684686) { + return {} // after fei hack + } const balances = {} await getFusePools(timestamp, block, balances, true) return balances @@ -174,25 +187,41 @@ async function tvl(timestamp, block) { await getBalancesFromEarnPool(earnStablePoolAddressesIncludingLegacy) // Fuse - await getFusePools(timestamp, block, balances, false) + // await getFusePools(timestamp, block, balances, false) return balances } +async function fuseTvl(__, _b, _cb, { api, }) { + + const [_, pools] = (await api.call({ target: fusePoolDirectoryAddress, abi: abi['getPublicPools'] })) + const markets = (await api.multiCall({ abi: 'address[]:getAllMarkets', calls: pools.map(i => i.comptroller) })).flat() + const tokens = await api.multiCall({ abi: 'address:underlying', calls: markets }) + return sumTokens2({api , tokensAndOwners2: [tokens, markets]}) +} +async function fuseBorrowed(__, _b, _cb, { api, }) { + + const [_, pools] = (await api.call({ target: fusePoolDirectoryAddress, abi: abi['getPublicPools'] })) + const markets = (await api.multiCall({ abi: 'address[]:getAllMarkets', calls: pools.map(i => i.comptroller) })).flat() + const tokens = await api.multiCall({ abi: 'address:underlying', calls: markets }) + const bals = await api.multiCall({ abi: 'uint256:totalBorrows', calls: markets }) + api.addTokens(tokens, bals) + return api.getBalances() +} + module.exports = { - timetravel: true, misrepresentedTokens: true, doublecounted: true, start: 1596236058, // July 14, 2020 ethereum: { - tvl, + tvl: sdk.util.sumChainTvls([tvl, fuseTvl]), pool2: pool2(rariGovernanceTokenUniswapDistributorAddress, RGTETHSushiLPTokenAddress), borrowed, }, arbitrum: { // Borrowing is disabled, and Tetranode's locker is the only pool with significant tvl, so counting only that - tvl: getCompoundV2Tvl('0xC7D021BD813F3b4BB801A4361Fbcf3703ed61716', 'arbitrum', undefined, undefined, undefined, false), - borrowed: getCompoundV2Tvl('0xC7D021BD813F3b4BB801A4361Fbcf3703ed61716', 'arbitrum', undefined, undefined, undefined, true), + tvl: getCompoundV2Tvl('0xC7D021BD813F3b4BB801A4361Fbcf3703ed61716', 'arbitrum', undefined, undefined, undefined, false), + borrowed: getCompoundV2Tvl('0xC7D021BD813F3b4BB801A4361Fbcf3703ed61716', 'arbitrum', undefined, undefined, undefined, true), }, hallmarks: [ [1651276800, "FEI hack"], diff --git a/projects/ray/abis/Opportunity.json b/projects/ray/abis/Opportunity.json deleted file mode 100644 index b0075599b51..00000000000 --- a/projects/ray/abis/Opportunity.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "getBalance": { - "constant": true, - "inputs": [ - { - "name": "principalToken", - "type": "address" - } - ], - "name": "getBalance", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } -} diff --git a/projects/ray/index.js b/projects/ray/index.js index 36aa43de061..0dffad302ea 100644 --- a/projects/ray/index.js +++ b/projects/ray/index.js @@ -1,189 +1,61 @@ - const sdk = require('@defillama/sdk'); - - const BigNumber = require('bignumber.js'); - - const opportunityAbi = require('./abis/Opportunity'); - - const ETH_ADDRESS = '0x0000000000000000000000000000000000000000'; - const WETH_ADDRESS = '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2'; - const SAI_ADDRESS = '0x89d24A6b4CcB1B6fAA2625fE562bDD9a23260359'; - const DAI_ADDRESS = '0x6B175474E89094C44Da98b954EedeAC495271d0F'; - const USDC_ADDRESS = '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48'; - - const tokenAddresses = [ - WETH_ADDRESS, - SAI_ADDRESS, - DAI_ADDRESS, - USDC_ADDRESS - ]; - - const allOpportunities = [ - { - address: '0xEa5ee32F3A63c3FaBb311c6E8c985D308A53dcC1', beginTimestamp: 1568057588, endTimestamp: null, - coins: [SAI_ADDRESS, DAI_ADDRESS, USDC_ADDRESS, WETH_ADDRESS] - }, - { - address: '0xEB6394f817b498c423C44bD72c3D7f8ED5DeeC6e', beginTimestamp: 1568057609, endTimestamp: null, - coins: [SAI_ADDRESS, DAI_ADDRESS, USDC_ADDRESS, WETH_ADDRESS], added: [0, 1575650224, 1568341399, 0] - - }, - { - address: '0x759A728653C4d0483D897DCCf3a343fe2bBbb54A', beginTimestamp: 1570466036, endTimestamp: null, - coins: [SAI_ADDRESS, DAI_ADDRESS, USDC_ADDRESS, WETH_ADDRESS] - }, - { - address: '0xC830217BD3000E92CE846C549de6a2A36AEa8954', beginTimestamp: 1575649643, endTimestamp: null, - coins: [DAI_ADDRESS] - }, - { - address: '0x3d6fa1331E142504Ba0B7965CD801c7F3b21b6C0', beginTimestamp: 1583869244, endTimestamp: null, - coins: [DAI_ADDRESS, USDC_ADDRESS, WETH_ADDRESS] - } - ]; - - - - const allPortfolioManagers = [ - { - address: '0x06a5Bf70BfF314177488864Fe03576ff608e6aec', beginTimestamp: 1568274392, endTimestamp: null - } - ]; - - function getPmCalls(timestamp) { - - let pmCalls = []; - let portfolioManagers = []; - - for (let i = 0 ; i < allPortfolioManagers.length; i++) { - - if (timestamp >= allPortfolioManagers[i].beginTimestamp && - ((allPortfolioManagers[i].endTimestamp == null) || - timestamp <= allPortfolioManagers[i].endTimestamp)) { - - let calls = tokenAddresses.reduce((accum, tokenAddress) => [...accum, { - target: tokenAddress, - params: allPortfolioManagers[i].address - }], []); - - for (let call of calls) { - pmCalls.push(call); - } - - portfolioManagers.push(allPortfolioManagers[i].address); - } - - } - - return { pmCalls, portfolioManagers }; +const ADDRESSES = require('../helper/coreAssets.json') + + const { sumTokensExport } = require('../helper/unwrapLPs'); + +const ETH_ADDRESS = ADDRESSES.null; +const WETH_ADDRESS = ADDRESSES.ethereum.WETH; +const SAI_ADDRESS = ADDRESSES.ethereum.SAI; +const DAI_ADDRESS = ADDRESSES.ethereum.DAI; +const USDC_ADDRESS = ADDRESSES.ethereum.USDC; + +const tokenAddresses = [ + ETH_ADDRESS, + WETH_ADDRESS, + SAI_ADDRESS, + DAI_ADDRESS, + USDC_ADDRESS +]; + +const allOpportunities = [ + { + address: '0xEa5ee32F3A63c3FaBb311c6E8c985D308A53dcC1', beginTimestamp: 1568057588, endTimestamp: null, + coins: [SAI_ADDRESS, DAI_ADDRESS, USDC_ADDRESS, WETH_ADDRESS] + }, + { + address: '0xEB6394f817b498c423C44bD72c3D7f8ED5DeeC6e', beginTimestamp: 1568057609, endTimestamp: null, + coins: [SAI_ADDRESS, DAI_ADDRESS, USDC_ADDRESS, WETH_ADDRESS], added: [0, 1575650224, 1568341399, 0] + + }, + { + address: '0x759A728653C4d0483D897DCCf3a343fe2bBbb54A', beginTimestamp: 1570466036, endTimestamp: null, + coins: [SAI_ADDRESS, DAI_ADDRESS, USDC_ADDRESS, WETH_ADDRESS] + }, + { + address: '0xC830217BD3000E92CE846C549de6a2A36AEa8954', beginTimestamp: 1575649643, endTimestamp: null, + coins: [DAI_ADDRESS] + }, + { + address: '0x3d6fa1331E142504Ba0B7965CD801c7F3b21b6C0', beginTimestamp: 1583869244, endTimestamp: null, + coins: [DAI_ADDRESS, USDC_ADDRESS, WETH_ADDRESS] } +]; - function getOpportunityCalls(timestamp) { - - let opportunityCalls = []; - - for (let i = 0 ; i < allOpportunities.length; i++) { - - if (timestamp >= allOpportunities[i].beginTimestamp && - ((allOpportunities[i].endTimestamp == null) || - timestamp <= allOpportunities[i].endTimestamp)) { - - let supportedTokens = allOpportunities[i].coins; +const owners = allOpportunities.map(i => i.address) - if (allOpportunities[i].added) { - supportedTokens = removeTokens(timestamp, supportedTokens, allOpportunities[i].added); - } - - let calls = supportedTokens.reduce((accum, tokenAddress) => [...accum, - { - target: allOpportunities[i].address, - params: tokenAddress - }], []); - - for (let call of calls) { - opportunityCalls.push(call); - } - - } - } - - return opportunityCalls; +const allPortfolioManagers = [ + { + address: '0x06a5Bf70BfF314177488864Fe03576ff608e6aec', beginTimestamp: 1568274392, endTimestamp: null } +]; - function removeTokens(timestamp, tokens, timestamps) { - let offset = 0; - - for (let j = 0; j < timestamps.length; j++) { - if (timestamp < timestamps[j]) { - tokens.splice(j - offset, 1); - offset++; - } - } - - return tokens; - } - - async function tvl(timestamp, block) { - let balances = {}; - - let { pmCalls, portfolioManagers } = getPmCalls(timestamp); - let opportunityCalls = getOpportunityCalls(timestamp); - - await Promise.all(portfolioManagers.map((portfolioManager) => { - return new Promise(async (resolve, reject) => { - try { - let balance = (await sdk.api.eth.getBalance({target: portfolioManager, block})).output; - - balances[ETH_ADDRESS] = BigNumber(balances[ETH_ADDRESS] || 0).plus(balance).toFixed(); - resolve(); - } catch(error) { - reject(error); - } - }) - })); - - let pmBalances = (await sdk.api.abi.multiCall({ - block, - calls: pmCalls, - abi: 'erc20:balanceOf' - })).output; - - pmBalances.forEach((result) => { - let balance = result.output; - let address = result.input.target; - - if (BigNumber(balance).toNumber() <= 0) { - return; - } - - balances[address] = BigNumber(balances[address] || 0).plus(balance).toFixed(); - }); - - let opportunityBalances = (await sdk.api.abi.multiCall({ - block, - calls: opportunityCalls, - abi: opportunityAbi.getBalance - })).output; - - opportunityBalances.forEach((result) => { - if(result.input.params[0] === '0x89d24A6b4CcB1B6fAA2625fE562bDD9a23260359' && result.input.target === "0x759A728653C4d0483D897DCCf3a343fe2bBbb54A"){ - return - } - let balance = result.output; - let address = result.input.params; - - if (BigNumber(balance).toNumber() <= 0) { - return; - } - - balances[address] = BigNumber(balances[address] || 0).plus(balance).toFixed(); - }); - - return balances; - } +owners.push(allPortfolioManagers[0].address) - module.exports = { - start: 1568274392, // 09/12/2019 @ 7:46am (UTC) - ethereum:{ - tvl - } +module.exports = { + start: 1568274392, // 09/12/2019 @ 7:46am (UTC) + ethereum: { + tvl: sumTokensExport({ + owners, + tokens: tokenAddresses + }) } +} diff --git a/projects/rbx/index.js b/projects/rbx/index.js new file mode 100644 index 00000000000..b4278af7035 --- /dev/null +++ b/projects/rbx/index.js @@ -0,0 +1,19 @@ + +const { mergeExports } = require('../helper/utils'); +const { masterchefExports } = require('../helper/unknownTokens'); + +module.exports = mergeExports([ + masterchefExports({ + chain: 'bsc', + masterchef: '0x864d434308997e9648838d23f3eedf5d0fd17bea', + blacklistedTokens: [ + '0xa9639160481b625ba43677be753e0a70bf58c647', + ], + nativeToken: '0xace3574b8b054e074473a9bd002e5dc6dd3dff1b', + }), + masterchefExports({ + chain: 'ethereum', + masterchef: '0x50b641caab809c1853be334246ac951faccc49b0', + nativeToken: '0x8254e26e453EB5aBd29B3c37AC9E8Da32E5d3299', + }) +]) \ No newline at end of file diff --git a/projects/rcpswap/index.js b/projects/rcpswap/index.js index a5fab5f8fd8..e5ad8b1d274 100644 --- a/projects/rcpswap/index.js +++ b/projects/rcpswap/index.js @@ -4,7 +4,6 @@ module.exports = { misrepresentedTokens: true, arbitrum_nova: { tvl: getUniTVL({ - chain: 'arbitrum_nova', useDefaultCoreAssets: true, factory: '0xF9901551B4fDb1FE8d5617B5deB6074Bb8E1F6FB', }) diff --git a/projects/reactorfusion/index.js b/projects/reactorfusion/index.js new file mode 100644 index 00000000000..07e3e836797 --- /dev/null +++ b/projects/reactorfusion/index.js @@ -0,0 +1,8 @@ +const { compoundExports2 } = require('../helper/compound'); + +module.exports = { + era: compoundExports2({ + comptroller: '0x23848c28Af1C3AA7B999fA57e6b6E8599C17F3f2', + cether: '0xC5db68F30D21cBe0C9Eac7BE5eA83468d69297e6', + }) +}; \ No newline at end of file diff --git a/projects/realtmarkets/abi.json b/projects/realtmarkets/abi.json index 20572ec437a..ba59f4c1f4e 100644 --- a/projects/realtmarkets/abi.json +++ b/projects/realtmarkets/abi.json @@ -1,103 +1,4 @@ { - "getReservesList": { - "inputs": [], - "name": "getReservesList", - "outputs": [ - { - "internalType": "address[]", - "name": "", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getReserveData": { - "inputs": [ - { - "internalType": "address", - "name": "asset", - "type": "address" - } - ], - "name": "getReserveData", - "outputs": [ - { - "components": [ - { - "components": [ - { - "internalType": "uint256", - "name": "data", - "type": "uint256" - } - ], - "internalType": "struct DataTypes.ReserveConfigurationMap", - "name": "configuration", - "type": "tuple" - }, - { - "internalType": "uint128", - "name": "liquidityIndex", - "type": "uint128" - }, - { - "internalType": "uint128", - "name": "variableBorrowIndex", - "type": "uint128" - }, - { - "internalType": "uint128", - "name": "currentLiquidityRate", - "type": "uint128" - }, - { - "internalType": "uint128", - "name": "currentVariableBorrowRate", - "type": "uint128" - }, - { - "internalType": "uint128", - "name": "currentStableBorrowRate", - "type": "uint128" - }, - { - "internalType": "uint40", - "name": "lastUpdateTimestamp", - "type": "uint40" - }, - { - "internalType": "address", - "name": "aTokenAddress", - "type": "address" - }, - { - "internalType": "address", - "name": "stableDebtTokenAddress", - "type": "address" - }, - { - "internalType": "address", - "name": "variableDebtTokenAddress", - "type": "address" - }, - { - "internalType": "address", - "name": "interestRateStrategyAddress", - "type": "address" - }, - { - "internalType": "uint8", - "name": "id", - "type": "uint8" - } - ], - "internalType": "struct DataTypes.ReserveData", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - } + "getReservesList": "address[]:getReservesList", + "getReserveData": "function getReserveData(address asset) view returns (tuple(tuple(uint256 data) configuration, uint128 liquidityIndex, uint128 variableBorrowIndex, uint128 currentLiquidityRate, uint128 currentVariableBorrowRate, uint128 currentStableBorrowRate, uint40 lastUpdateTimestamp, address aTokenAddress, address stableDebtTokenAddress, address variableDebtTokenAddress, address interestRateStrategyAddress, uint8 id))" } \ No newline at end of file diff --git a/projects/realtmarkets/index.js b/projects/realtmarkets/index.js index abb127cccdd..a3f0b673fc7 100644 --- a/projects/realtmarkets/index.js +++ b/projects/realtmarkets/index.js @@ -1,88 +1,10 @@ -const sdk = require("@defillama/sdk"); -const abi = require("./abi.json"); - -const registry = "0x5B8D36De471880Ee21936f328AAB2383a280CB2A"; - -async function tvl (timestamp, block, chainBlocks) { - let balances = {}; - const chain = "xdai"; - block = chainBlocks.xdai; - - const reserveList = (await sdk.api.abi.call({ - target: registry, - abi: abi.getReservesList, - block, - chain - })).output; - - const reserveDatas = (await sdk.api.abi.multiCall({ - calls: reserveList.map(p => ({ - target: registry, - params: p - })), - abi: abi.getReserveData, - block, - chain - })).output; - - const collateralBalances = (await sdk.api.abi.multiCall({ - calls: reserveDatas.map(p => ({ - target: p.input.params[0], - params: p.output.aTokenAddress - })), - abi: "erc20:balanceOf", - block, - chain - })).output; - - collateralBalances.forEach(p => { - sdk.util.sumSingleBalance(balances, `xdai:${p.input.target}`, p.output); - }) - - return balances; -} - -async function borrowed (timestamp, block, chainBlocks) { - let balances = {}; - const chain = "xdai"; - block = chainBlocks.xdai; - - const reserveList = (await sdk.api.abi.call({ - target: registry, - abi: abi.getReservesList, - block, - chain - })).output; - - const reserveDatas = (await sdk.api.abi.multiCall({ - calls: reserveList.map(p => ({ - target: registry, - params: p - })), - abi: abi.getReserveData, - block, - chain - })).output; - - const debtTokenSupply = (await sdk.api.abi.multiCall({ - calls: reserveDatas.map(p => ({ - target: p.output.variableDebtTokenAddress - })), - abi: "erc20:totalSupply", - block, - chain - })).output; - - for (let i = 0; i < debtTokenSupply.length; i++) { - sdk.util.sumSingleBalance(balances, `xdai:${reserveList[i]}`, debtTokenSupply[i].output); - } - - return balances; -} - -module.exports = { - xdai: { - tvl, - borrowed - } +const { aaveExports } = require('../helper/aave') + +module.exports={ + timetravel: true, + misrepresentedTokens: true, + methodology: "Counts the tokens locked in the contracts to be used as collateral to borrow or to earn yield. Borrowed coins are not counted towards the TVL, so only the coins actually locked in the contracts are counted. There's multiple reasons behind this but one of the main ones is to avoid inflating the TVL through cycled lending", + xdai: aaveExports('xdai', '0xae6933231Fb83257696E29B050cA6068D6E6Cc84', undefined, undefined, { + oracle: '0x1a88d967936a73326562d2310062eCE226Ed6664', + }), } \ No newline at end of file diff --git a/projects/reaper.farm/index.js b/projects/reaper.farm/index.js index f016a8349c0..c358a91df9d 100644 --- a/projects/reaper.farm/index.js +++ b/projects/reaper.farm/index.js @@ -15,6 +15,12 @@ function fetchTvl(chainName) { case 'optimism': tvlMsg = await client.get('/optimism/tvlTotal'); break; + case 'arbitrum': + tvlMsg = await client.get('/arbitrum/tvlTotal'); + break; + case 'bsc': + tvlMsg = await client.get('/bsc/tvlTotal'); + break; default: tvlMsg = await client.get('/tvlTotal'); } @@ -33,6 +39,12 @@ module.exports = { optimism: { tvl: fetchTvl('optimism') }, + arbitrum: { + tvl: fetchTvl('arbitrum') + }, + bsc: { + tvl: fetchTvl('bsc') + }, hallmarks:[ [1659441956, "$1.7m Exploit"], ] diff --git a/projects/reax-one-dex/index.js b/projects/reax-one-dex/index.js new file mode 100644 index 00000000000..43fd2f353a7 --- /dev/null +++ b/projects/reax-one-dex/index.js @@ -0,0 +1,14 @@ +const { onChainTvl } = require('../helper/balancer') + +module.exports = { + mantle: { + tvl: onChainTvl('0x1AA7f1f5b51fe22478e683466232B5C8fc49407f', 10790, { + blacklistedTokens: [ + '0xf7dfe223e19701a514e78f3ce7ba98f2c5fbb5b2', + '0xa84bdecd44e6cee1c588a3c97fcc4482831fde05', + '0x62959ad021402f48d0d8067bc5c4c03f63fceaa4', + '0x8348b81b9ed72f29e52027c349f30703b42c0110' + ] + }), + } +} diff --git a/projects/reax-one-lending/index.js b/projects/reax-one-lending/index.js new file mode 100644 index 00000000000..0ed1782c2f1 --- /dev/null +++ b/projects/reax-one-lending/index.js @@ -0,0 +1,7 @@ +const { aaveV2Export } = require('../helper/aave.js'); + +module.exports = { + mantle: aaveV2Export('0x4bbea708f4e48eb0bb15e0041611d27c3c8638cf', { abis: { + "getReserveData": "function getReserveData(address asset) view returns (tuple(tuple(uint256 data) configuration, uint128 liquidityIndex, uint128 currentLiquidityRate, uint128 variableBorrowIndex, uint128 currentVariableBorrowRate, uint128 currentStableBorrowRate, uint40 lastUpdateTimestamp, uint16 id, address aTokenAddress, address stableDebtTokenAddress, address variableDebtTokenAddress, address interestRateStrategyAddress, uint128 accruedToTreasury, uint128 unbacked, uint128 isolationModeTotalDebt))" + } }) +} diff --git a/projects/reax-one-synth/index.js b/projects/reax-one-synth/index.js new file mode 100644 index 00000000000..5c66fb96bb9 --- /dev/null +++ b/projects/reax-one-synth/index.js @@ -0,0 +1,16 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require('../helper/unwrapLPs') + +module.exports = { + mantle: { + tvl: sumTokensExport({ + owner: '0x78B2fa94A94bF3E96fcF9CE965bed55bE49FA9E7', + tokens: [ + ADDRESSES.mantle.WETH, + ADDRESSES.mantle.USDT, + '0xCAbAE6f6Ea1ecaB08Ad02fE02ce9A44F09aebfA2', + ADDRESSES.mantle.WMNT + ] + }), + } +} diff --git a/projects/redacted/index.js b/projects/redacted/index.js index 5c952c614be..01745540a4c 100644 --- a/projects/redacted/index.js +++ b/projects/redacted/index.js @@ -1,16 +1,16 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokensAndLPsSharedOwners, unwrapUniswapV3NFTs, genericUnwrapCvx } = require('../helper/unwrapLPs') const sdk = require('@defillama/sdk') const { BigNumber } = require('ethers') const treasuries = ["0xa52fd396891e7a74b641a2cb1a6999fcf56b077e", "0x086c98855df3c78c6b481b6e1d47bef42e9ac36b"] -const CVXLocker = '0x72a19342e8f1838460ebfccef09f6585e32db86e' const cvxCRVStaking = '0x3Fe65692bfCD0e6CF84cB1E7d24108E434A7587e' -const CVX = '0x4e3fbd56cd56c3e72c1403e103b45db9da5b9d2b' -const cvxCRV = '0x62b9c7356a2dc64a1969e19c23e4f579f9810aa7' +const CVX = ADDRESSES.ethereum.CVX +const cvxCRV = ADDRESSES.ethereum.cvxCRV const FXS = '0x3432b6a60d23ca0dfca7761b7ab56459d9c964d0' const veFXS = '0xc8418aF6358FFddA74e09Ca9CC3Fe03Ca6aDC5b0' -const CRV = '0xD533a949740bb3306d119CC777fa900bA034cd52' +const CRV = ADDRESSES.ethereum.CRV const veCRV = '0x5f3b5DfEb7B28CDbD7FAba78963EE202a494e2A2' const sOHM = '0x04906695D6D12CF5459975d7C3C03356E4Ccd460' const OHM = '0x64aa3364f17a4d01c6f1751fd97c2bd3d7e7f1d5' @@ -19,10 +19,9 @@ const AURALocker = '0x3Fa73f1E5d8A792C80F426fc8F84FBF7Ce9bBCAC' const rlBTRFLY = '0x742B70151cd3Bc7ab598aAFF1d54B90c3ebC6027' const BTRFLYV2 = '0xc55126051B22eBb829D00368f4B12Bde432de5Da' const cvxCRVPool = '0x0392321e86F42C2F94FBb0c6853052487db521F0' -const cvxFXSPool = '0xf27AFAD0142393e4b3E5510aBc5fe3743Ad669Cb' const rlBTRFLYAbi = { - lockedSupply: {"inputs":[],"name":"lockedSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}, + lockedSupply: "uint256:lockedSupply", } async function tvl(timestamp, block, chainBlocks){ @@ -37,10 +36,8 @@ async function tvl(timestamp, block, chainBlocks){ [AURA, false], // BTRFLY/ETH Curve LP ['0x7483Dd57f6488b0e194A151C57Df6Ec85C00aCE9', false], - // USDC - ['0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', false], - // FRAX - ['0x853d955aCEf822Db058eb8505911ED77F175b99e', false], + [ADDRESSES.ethereum.USDC, false], + [ADDRESSES.ethereum.FRAX, false], ], treasuries, block) //Add UniswapV3 LPs @@ -54,7 +51,7 @@ async function tvl(timestamp, block, chainBlocks){ //Add vlCVX as CVX const vlCVXBalance = await sdk.api.erc20.balanceOf({ - target: CVXLocker, + target: ADDRESSES.ethereum.vlCVX, owner: treasuries[0], chain: 'ethereum', block: chainBlocks['ethereum'] diff --git a/projects/redbees/index.js b/projects/redbees/index.js deleted file mode 100644 index a62de818f32..00000000000 --- a/projects/redbees/index.js +++ /dev/null @@ -1,8 +0,0 @@ -const {masterChefExports} = require("../helper/masterchef"); - -const token = "0xb6dd76ce852ff1b23cd8fe21aabb001a5a710a00"; -const masterchef = "0x2A807C49e506457D76ce3eBbD716fB2980AF6c79"; - -module.exports = { - ...masterChefExports(masterchef, "avax", token, false) -} \ No newline at end of file diff --git a/projects/redemption/index.js b/projects/redemption/index.js index c97ab5806d6..1b446aa614c 100644 --- a/projects/redemption/index.js +++ b/projects/redemption/index.js @@ -5,7 +5,6 @@ module.exports = { fantom: { tvl: getUniTVL({ factory: '0xa2dF50d1401afF182D19Bb41d76cf35953942c51', - chain: 'fantom', useDefaultCoreAssets: true }) }, diff --git a/projects/reflexer/index.js b/projects/reflexer/index.js index 96390f0d463..8c696fd367d 100644 --- a/projects/reflexer/index.js +++ b/projects/reflexer/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') /*================================================== Modules ==================================================*/ @@ -10,7 +11,7 @@ const sdk = require("@defillama/sdk"); async function tvl(timestamp, block) { // WETH ERC20 contract - const weth = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"; + const weth = ADDRESSES.ethereum.WETH; // Contract holding all of the WETH balance in the system const ethCollateralJoin = "0x2D3cD7b81c93f188F3CB8aD87c8Acc73d6226e3A"; diff --git a/projects/rehold-v2/index.js b/projects/rehold-v2/index.js new file mode 100644 index 00000000000..d42de3b0345 --- /dev/null +++ b/projects/rehold-v2/index.js @@ -0,0 +1,24 @@ +const { sumTokens2 } = require('../helper/unwrapLPs') +const { covalentGetTokens } = require('../helper/http') + +const VAULT_V2 = '0xde6b4964c4384bcdfa150a4a8be9865c5b91e29c'; + +async function tvl(_, _b, _cb, { api, }) { + const tokens = await covalentGetTokens(VAULT_V2, api.chain) + + return sumTokens2({ + api, + owner: VAULT_V2, + tokens, + blacklistedTokens: ['0x594f9274e08ba6c5760bacfba795b1879af17255'], + }); +} + +module.exports = { + ethereum: { tvl }, + bsc: { tvl }, + polygon: { tvl }, + avax: { tvl }, + arbitrum: { tvl }, + optimism: { tvl }, +}; diff --git a/projects/rehold/index.js b/projects/rehold/index.js new file mode 100644 index 00000000000..64f9047d4df --- /dev/null +++ b/projects/rehold/index.js @@ -0,0 +1,27 @@ +const { sumTokens2 } = require('../helper/unwrapLPs') +const { covalentGetTokens } = require('../helper/http') +const vault = '0xd476ce848c61650e3051f7571f3ae437fe9a32e0' + +async function tvl(_, _b, _cb, { api, }) { + const tokens = await covalentGetTokens(vault, api.chain) + return sumTokens2({ + api, owner: vault, tokens, blacklistedTokens: [ + '0x594f9274e08ba6c5760bacfba795b1879af17255' + ] + }) +} + +module.exports = { + bsc: { tvl }, + polygon: { tvl }, + avax: { tvl }, + arbitrum: { tvl }, + optimism: { tvl }, + fantom: { tvl }, + + hallmarks: [ + [1688688480, "ReHold V2 Launch"], + [1689743327, "Ethereum Deployment"], + [1690898169, "Limit Orders Launch"], + ], +} diff --git a/projects/relayChain/index.js b/projects/relayChain/index.js index a003fac4a86..9ad5a62559f 100644 --- a/projects/relayChain/index.js +++ b/projects/relayChain/index.js @@ -1,56 +1,57 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const { getChainTransform } = require('../helper/portedTokens'); const { sumTokens } = require('../helper/unwrapLPs') -const usdtEth = "0xdAC17F958D2ee523a2206206994597C13D831ec7"; -const daiEth = "0x6b175474e89094c44da98b954eedeac495271d0f"; -const wbtcEth = "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599"; -const usdcEth = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"; -const wethEth = "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"; +const usdtEth = ADDRESSES.ethereum.USDT; +const daiEth = ADDRESSES.ethereum.DAI; +const wbtcEth = ADDRESSES.ethereum.WBTC; +const usdcEth = ADDRESSES.ethereum.USDC; +const wethEth = ADDRESSES.ethereum.WETH; const relayEth = "0x5D843Fa9495d23dE997C394296ac7B4D721E841c"; const xcasEth = "0x7659CE147D0e714454073a5dd7003544234b6Aa0"; -const trueUSDEth = "0x0000000000085d4780B73119b644AE5ecd22b376"; +const trueUSDEth = ADDRESSES.ethereum.TUSD; const zeroEth = "0xF0939011a9bb95c3B791f0cb546377Ed2693a574"; const dxpEth="0x88aa4a6C5050b9A1b2Aa7e34D0582025cA6AB745"; -const usdtBsc = "0x55d398326f99059fF775485246999027B3197955"; +const usdtBsc = ADDRESSES.bsc.USDT; const daiBsc = "0x1AF3F329e8BE154074D8769D1FFa4eE058B1DBc3"; -const usdcBsc = "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d"; -const busdBsc = "0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56"; -const ethBsc = "0x2170Ed0880ac9A755fd29B2688956BD959F933F8"; -const wbnbBsc = "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c"; +const usdcBsc = ADDRESSES.bsc.USDC; +const busdBsc = ADDRESSES.bsc.BUSD; +const ethBsc = ADDRESSES.bsc.ETH; +const wbnbBsc = ADDRESSES.bsc.WBNB; const relayBsc = "0xE338D4250A4d959F88Ff8789EaaE8c32700BD175"; -const daiAvax = "0xd586E7F844cEa2F87f50152665BCbc2C279D8d70"; -const wavax = "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7"; +const daiAvax = ADDRESSES.avax.DAI; +const wavax = ADDRESSES.avax.WAVAX; const wbtcAvax = "0x50b7545627a5162F82A992c33b87aDc75187B218"; -const usdcAvax = "0xA7D7079b0FEaD91F3e65f86E8915Cb59c1a4C664"; -const usdtAvax = "0xc7198437980c041c805A1EDcbA50c1Ce5db95118"; +const usdcAvax = ADDRESSES.avax.USDC_e; +const usdtAvax = ADDRESSES.avax.USDT_e; -const wHeco = "0x5545153CCFcA01fbd7Dd11C0b23ba694D9509A6F"; +const wHeco = ADDRESSES.heco.WHT; const wbtcHeco = "0x66a79D23E58475D2738179Ca52cd0b41d73f0BEa"; const ethHeco = "0x64FF637fB478863B7468bc97D30a5bF3A428a1fD"; -const usdcHeco = "0x9362Bbef4B8313A8Aa9f0c9808B80577Aa26B73B"; -const daiHeco = "0x3D760a45D0887DFD89A2F5385a236B29Cb46ED2a"; +const usdcHeco = ADDRESSES.heco.USDC_HECO; +const daiHeco = ADDRESSES.heco.DAI_HECO; const husdHeco = "0x0298c2b32eaE4da002a15f36fdf7615BEa3DA047"; const miMatic = "0xa3Fa99A148fA48D14Ed51d610c367C61876997F1"; -const wmatic = "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270"; -const wethMatic = "0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619"; -const wbtcMatic = "0x1BFD67037B42Cf73acF2047067bd4F2C47D9BfD6"; -const usdcMatic = "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174"; -const daiMatic = "0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063"; -const usdtMatic = "0xc2132D05D31c914a87C6611C10748AEb04B58e8F"; +const wmatic = ADDRESSES.polygon.WMATIC_2; +const wethMatic = ADDRESSES.polygon.WETH_1; +const wbtcMatic = ADDRESSES.polygon.WBTC; +const usdcMatic = ADDRESSES.polygon.USDC; +const daiMatic = ADDRESSES.polygon.DAI; +const usdtMatic = ADDRESSES.polygon.USDT; -const usdtMoonriver = "0xB44a9B6905aF7c801311e8F4E76932ee959c663C"; +const usdtMoonriver = ADDRESSES.moonriver.USDT; const daiMoonriver = "0x80A16016cC4A2E6a2CACA8a4a498b1699fF0f844"; -const usdcMoonriver = "0xE3F5a90F9cb311505cd691a46596599aA1A0AD7D"; +const usdcMoonriver = ADDRESSES.moonriver.USDC; const wbtcMoonriver = "0xE6a991Ffa8CfE62B0bf6BF72959A3d4f11B2E0f5"; const wethMoonriver = "0x3Ca3fEFA944753b43c751336A5dF531bDD6598B6"; const relayMoonriver = "0xAd7F1844696652ddA7959a49063BfFccafafEfe7"; @@ -59,9 +60,9 @@ const wMOVR = "0x98878B06940aE243284CA214f92Bb71a2b032B8A"; const usdtFantom = "0x1B27A9dE6a775F98aaA5B90B62a4e2A0B84DbDd9"; const relayFantom = "0x338003E074DabFec661E1901bdB397aF9Cab6A76"; -const daiFantom = "0x8d11ec38a3eb5e956b052f67da8bdc9bef8abf3e"; -const usdcFantom = "0x04068DA6C83AFCFA0e13ba15A6696662335D5B75"; -const wFantom = "0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83"; +const daiFantom = ADDRESSES.fantom.DAI; +const usdcFantom = ADDRESSES.fantom.USDC; +const wFantom = ADDRESSES.fantom.WFTM; const btcFantom = "0x321162Cd933E2Be498Cd2267a90534A804051b11"; @@ -70,59 +71,59 @@ const relayHarmony = "0x0e4d3a20b757cea2a0910129991b9d42cc2be188"; const daiHarmony = "0xEf977d2f931C1978Db5F6747666fa1eACB0d0339"; const usdcHarmony = "0x985458e523db3d53125813ed68c274899e9dfab4"; const busdHarmony = "0xe176ebe47d621b984a73036b9da5d834411ef734"; -const woneOne = "0xcf664087a5bb0237a0bad6742852ec6c8d69a27a"; +const woneOne = ADDRESSES.harmony.WONE; const wsdnShiden = "0x1a6a12953d5439e8965d94d3d8452464fbd53e30"; -const usdtShiden = "0x818ec0A7Fe18Ff94269904fCED6AE3DaE6d6dC0b"; -const usdcShiden = "0xfA9343C3897324496A05fC75abeD6bAC29f8A40f"; -const busdShiden = "0x65e66a61d0a8f1e686c2d6083ad611a10d84d97a"; +const usdtShiden = ADDRESSES.telos.USDC; +const usdcShiden = ADDRESSES.telos.ETH; +const busdShiden = ADDRESSES.shiden.BUSD; -const usdcMetis = "0xea32a96608495e54156ae48931a7c20f0dcc1a21"; -const usdtMetis = "0xbb06dca3ae6887fabf931640f67cab3e3a16f4dc"; -const relayMetis = "0xfe282Af5f9eB59C30A3f78789EEfFA704188bdD4"; -const maticMetis = "0x4b9D2923D875edF43980BF5dddDEde3Fb20fC742"; +const usdcMetis = ADDRESSES.metis.m_USDC; +const usdtMetis = ADDRESSES.metis.m_USDT; +const relayMetis = ADDRESSES.metis.RELAY; +const maticMetis = ADDRESSES.metis.MATIC; const mimMetis = "0x44Dd7C98885cD3086E723B8554a90c9cC4089C4C"; -const ftmMetis = "0x6aB6d61428fde76768D7b45D8BFeec19c6eF91A8" -const metis = "0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000"; -const wbtcMetis = "0xa5B55ab1dAF0F8e1EFc0eB1931a957fd89B918f4"; -const avaxMetis = "0xE253E0CeA0CDD43d9628567d097052B33F98D611"; -const daiMetis = "0x4651B38e7ec14BB3db731369BFE5B08F2466Bd0A"; +const ftmMetis = ADDRESSES.oasis.USDT +const metis = ADDRESSES.metis.Metis; +const wbtcMetis = ADDRESSES.metis.WBTC; +const avaxMetis = ADDRESSES.metis.rAVAX; +const daiMetis = ADDRESSES.metis.DAI; const mdaiMetis="0x4c078361FC9BbB78DF910800A991C7c3DD2F6ce0"; -const usdtCronos = "0x66e428c3f67a68878562e79A0234c1F83c208770"; +const usdtCronos = ADDRESSES.cronos.USDT; const daiCronos = "0xF2001B145b43032AAF5Ee2884e456CCd805F677D"; -const usdcCronos = "0xc21223249CA28397B4B6541dfFaEcC539BfF0c59"; -const wbtcCronos = "0x062e66477faf219f25d27dced647bf57c3107d52"; +const usdcCronos = ADDRESSES.cronos.USDC; +const wbtcCronos = ADDRESSES.cronos.WBTC; const wethCronos = "0xe44fd7fcb2b1581822d0c862b68222998a0c299a"; const relayCronos = "0x9C29650a1B273A031A35F3121914aae882B144A4"; -const busdCronos = "0x6aB6d61428fde76768D7b45D8BFeec19c6eF91A8"; +const busdCronos = ADDRESSES.oasis.USDT; const wCronos = "0x5C7F8A570d578ED84E63fdFA7b1eE72dEae1AE23"; -const usdtIoTex = "0x6fbCdc1169B5130C59E72E51Ed68A84841C98cd1"; -const daiIoTex = "0x1CbAd85Aa66Ff3C12dc84C5881886EEB29C1bb9b"; -const usdcIoTex = "0x3B2bf2b523f54C4E454F08Aa286D03115aFF326c"; -const busdIoTex = "0xacee9b11cd4b3f57e58880277ac72c8c41abe4e4"; -const wIotex = "0xa00744882684c3e4747faefd68d283ea44099d03"; +const usdtIoTex = ADDRESSES.iotex.ioUSDT; +const daiIoTex = ADDRESSES.iotex.ioDAI; +const usdcIoTex = ADDRESSES.iotex.ioUSDC; +const busdIoTex = ADDRESSES.iotex.ioBUSD; +const wIotex = ADDRESSES.iotex.WIOTX; -const usdtOptimism = "0x94b008aA00579c1307B0EF2c499aD98a8ce58e58"; -const daiOptimism = "0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1"; +const usdtOptimism = ADDRESSES.optimism.USDT; +const daiOptimism = ADDRESSES.optimism.DAI; const wbtcOptimism = "0x68f180fcCe6836688e9084f035309E29Bf0A2095"; -const wbtcArbitrum = "0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f"; -const usdtArbitrum = "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9"; -const daiArbitrum = "0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1"; +const wbtcArbitrum = ADDRESSES.arbitrum.WBTC; +const usdtArbitrum = ADDRESSES.arbitrum.USDT; +const daiArbitrum = ADDRESSES.optimism.DAI; @@ -170,10 +171,10 @@ async function ethTvl(timestamp, ethBlock) { }) tokenBalance = (await sdk.api.eth.getBalance({ target: eth1Addr })).output; - sdk.util.sumSingleBalance(balances, "ethereum:" + "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", tokenBalance) + sdk.util.sumSingleBalance(balances, "ethereum:" + ADDRESSES.ethereum.WETH, tokenBalance) return sumTokens(balances, toa, ethBlock) -}; +} async function bscTvl(timestamp, ethBlock, chainBlocks) { @@ -187,7 +188,7 @@ async function bscTvl(timestamp, ethBlock, chainBlocks) { return sumTokens(balances, toa, chainBlocks[chain], chain) -}; +} async function avaxTvl(timestamp, ethBlock, chainBlocks) { const chain = 'avax' @@ -199,7 +200,7 @@ async function avaxTvl(timestamp, ethBlock, chainBlocks) { }) return sumTokens(balances, toa, chainBlocks[chain], chain) -}; +} async function hecoTvl(timestamp, ethBlock, chainBlocks) { const chain = 'heco' @@ -211,7 +212,7 @@ async function hecoTvl(timestamp, ethBlock, chainBlocks) { }) return sumTokens(balances, toa, chainBlocks[chain], chain) -}; +} async function polygonTvl(timestamp, ethBlock, chainBlocks) { const chain = 'polygon' @@ -223,7 +224,7 @@ async function polygonTvl(timestamp, ethBlock, chainBlocks) { }) return sumTokens(balances, toa, chainBlocks[chain], chain) -}; +} async function fantomTvl(unixTimestamp, ethBlock, chainBlocks) { const chain = 'fantom' diff --git a/projects/ren/index.js b/projects/ren/index.js index fc9c9352642..3ce3d800d76 100644 --- a/projects/ren/index.js +++ b/projects/ren/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { request, gql } = require("graphql-request"); const sdk = require("@defillama/sdk"); const { getTokenSupply } = require('../helper/solana') @@ -96,7 +97,7 @@ async function polygon(timestamp, ethBlock, chainBlocks) { async function arbitrum(timestamp, ethBlock, chainBlocks) { return { "0xeb4c2781e4eba804ce9a9803c67d0893436bb27d": (await sdk.api.erc20.totalSupply({ - target: "0xdbf31df14b66535af65aac99c32e9ea844e14501", + target: ADDRESSES.fantom.renBTC, chain: "arbitrum", block: chainBlocks.arbitrum })).output diff --git a/projects/reserve/index.js b/projects/reserve/index.js index 9093673b5cc..b5fea0f3d36 100644 --- a/projects/reserve/index.js +++ b/projects/reserve/index.js @@ -1,18 +1,84 @@ -const { sumTokensAndLPsSharedOwners} = require('../helper/unwrapLPs') - -const vault = "0xaedcfcdd80573c2a312d15d6bb9d921a01e4fb0f" - -async function tvl(time, block){ - const balances = {} - await sumTokensAndLPsSharedOwners(balances, [ - "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", //usdc - "0x8e870d67f660d95d5be530380d0ec0bd388289e1", //pax - "0x0000000000085d4780B73119b644AE5ecd22b376", //tusd - ].map(t=>[t, false]), [vault], block) - return balances +const ADDRESSES = require('../helper/coreAssets.json') +const { getLogs } = require('../helper/cache/getLogs') +const { sumTokens2, genericUnwrapCvxDeposit, unwrapCreamTokens } = require("../helper/unwrapLPs.js"); + +const vault = "0xaedcfcdd80573c2a312d15d6bb9d921a01e4fb0f"; +const deployerAddresses = ["0xFd6CC4F251eaE6d02f9F7B41D1e80464D3d2F377", "0x5c46b718Cd79F2BBA6869A3BeC13401b9a4B69bB"]; +const rsr = "0x320623b8E4fF03373931769A31Fc52A4E78B5d70"; + +async function tvl(_time, block, _, { api }) { + // First section is for RSV which will soon be deprecated + const ownerTokens = [[[ + ADDRESSES.ethereum.USDC, //usdc + "0x8e870d67f660d95d5be530380d0ec0bd388289e1", //pax + ADDRESSES.ethereum.TUSD, //tusd + ADDRESSES.ethereum.BUSD, //busd + ], vault]] + const blacklistedTokens = [rsr] + const fluxListWithOwner = [] + const creationLogs = await _getLogs(api) + + const mains = creationLogs.map(i => i.main) + const rTokens = creationLogs.map(i => i.rToken) + + const backingManagers = await api.multiCall({ abi: 'address:backingManager', calls: mains }) + const basketHandlers = await api.multiCall({ abi: 'address:basketHandler', calls: mains }) + const basketRes = await api.multiCall({ abi: "function quote(uint192, uint8) view returns (address[], uint256[])", calls: basketHandlers.map(i => ({ target: i, params: [0, 0] })) }) + await Promise.all(basketRes.map(async ([tokens], idx) => { + const rToken = rTokens[idx] + const manager = backingManagers[idx] + const names = await api.multiCall({ abi: 'string:name', calls: tokens, }) + + // handle Atokens + const aTokenBases = tokens.filter((_, i) => names[i].startsWith('Static ')) + tokens = tokens.filter((_, i) => !names[i].startsWith('Static ')) + const aTokens = await api.multiCall({ abi: 'address:ATOKEN', calls: aTokenBases}) + blacklistedTokens.push(...aTokenBases) + aTokens.forEach((v, i) => ownerTokens.push([[v], aTokenBases[i]])) + + // handle flux and convex deposit tokens + const baseTokens = tokens.filter((_, i) => names[i].endsWith('Convex Deposit')) + const fluxTokens = tokens.filter((_, i) => names[i].startsWith('Flux ')) + blacklistedTokens.push(...baseTokens) + blacklistedTokens.push(...fluxTokens) + tokens = tokens.filter((_, i) => !names[i].endsWith('Convex Deposit')) + tokens = tokens.filter((_, i) => !names[i].startsWith('Flux ')) + fluxTokens.forEach(token => { + fluxListWithOwner.push([token, rToken]) + fluxListWithOwner.push([token, manager]) + }) + // Update lpBalances for Curve tokens + await Promise.all(baseTokens.map((token) => genericUnwrapCvxDeposit({ api, token, owner: rToken }))) + await Promise.all(baseTokens.map((token) => genericUnwrapCvxDeposit({ api, token, owner: manager }))) + + ownerTokens.push([tokens, rToken]) + ownerTokens.push([tokens, manager]) + })) + await unwrapCreamTokens(api.getBalances(), fluxListWithOwner, block) + + await sumTokens2({ api, ownerTokens, blacklistedTokens }) +} + +async function staking(_time, block, _, { api }) { + const creationLogs = await _getLogs(api) + const stRsrs = creationLogs.map(i => i.stRSR) + return sumTokens2({ api, owners: stRsrs, tokens: [rsr] }) +} + +async function _getLogs(api) { + const resLog = (await Promise.all(deployerAddresses.map(deployerAddress => + getLogs({ + api, + target: deployerAddress, + topic: 'RTokenCreated(address,address,address,address,string)', + fromBlock: 16680995, + eventAbi: 'event RTokenCreated(address indexed main, address indexed rToken, address stRSR, address indexed owner, string version)', + onlyArgs: true, + })))).flat() + return resLog } -module.exports={ - ethereum: { tvl }, - methodology: `Gets the tokens on ${vault}` -} \ No newline at end of file +module.exports = { + ethereum: { tvl, staking, }, + methodology: `Gets the tokens on ${vault}`, +}; diff --git a/projects/resonatefinance/index.js b/projects/resonatefinance/index.js new file mode 100644 index 00000000000..59c95a45ad1 --- /dev/null +++ b/projects/resonatefinance/index.js @@ -0,0 +1,41 @@ +const sdk = require('@defillama/sdk'); +const axios = require('axios'); + + +//Full Calculations for computing TVL for Resonate Finance is done internally by Resonate and exposed via API +//API Endpoint: https://api.resonate.finance/{chainId}/tvl +//https://github.com/Revest-Finance/railway-monorepo/blob/main/src/api.ts", +async function tvl(_, _1, _2, { api }) { + let usdValue = 0; + do { + const {data, success} = await axios.get(`https://api.resonate.finance/${api.chainId}/tvl`); + usdValue = data; + } while (usdValue == 0) + + return { + tether: usdValue, + }; +} + +module.exports = { + methodology: "We sum all the tokens deposited as principal and any unclaimed interest accrued on it.", + hallmarks: [ + [1682438400, "Launch of Regen Portal"], + [1687276800, "Launch of Frax Portal"] + ], + ethereum: { + tvl + }, + polygon: { + tvl + }, + optimism: { + tvl + }, + arbitrum: { + tvl + }, + fantom: { + tvl + }, + }; diff --git a/projects/retro/index.js b/projects/retro/index.js new file mode 100644 index 00000000000..990098bbd7a --- /dev/null +++ b/projects/retro/index.js @@ -0,0 +1,8 @@ +const { uniV3Export } = require("../helper/uniswapV3"); + +module.exports = uniV3Export({ + polygon: { + factory: "0x91e1B99072f238352f59e58de875691e20Dc19c1", + fromBlock: 43939793, + }, +}); diff --git a/projects/retrodefi/abi.json b/projects/retrodefi/abi.json index 04ab0744475..683c1f0f96a 100644 --- a/projects/retrodefi/abi.json +++ b/projects/retrodefi/abi.json @@ -1,74 +1,5 @@ { - "poolInfo": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "poolInfo", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "want", - "type": "address" - }, - { - "internalType": "uint256", - "name": "allocPoint", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastRewardBlock", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accNATIVEPerShare", - "type": "uint256" - }, - { - "internalType": "address", - "name": "strat", - "type": "address" - }, - { - "internalType": "uint256", - "name": "depositFeeBP", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "poolLength": { - "inputs": [], - "name": "poolLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "symbol": { - "constant": true, - "inputs": [], - "name": "symbol", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } + "poolInfo": "function poolInfo(uint256) view returns (address want, uint256 allocPoint, uint256 lastRewardBlock, uint256 accNATIVEPerShare, address strat, uint256 depositFeeBP)", + "poolLength": "uint256:poolLength", + "symbol": "string:symbol" } \ No newline at end of file diff --git a/projects/retrodefi/index.js b/projects/retrodefi/index.js index 0aeec6ce9dc..8a36b244fd4 100644 --- a/projects/retrodefi/index.js +++ b/projects/retrodefi/index.js @@ -126,6 +126,7 @@ const calcTvl = async ( symbol.includes("QBERT") || symbol.includes("pQBERT") ) { + continue } else if (symbol.includes("LP")) { lpPositions.push({ token: want, diff --git a/projects/revault/RevaChef.json b/projects/revault/RevaChef.json index 41c4493a7ea..7fe9ff22257 100644 --- a/projects/revault/RevaChef.json +++ b/projects/revault/RevaChef.json @@ -1,41 +1,3 @@ { - "tokens" : { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "tokens", - "outputs": [ - { - "internalType": "uint256", - "name": "totalPrincipal", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "tvlBusd", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastRewardBlock", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accRevaPerToken", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "rewardsEnabled", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - } -} + "tokens": "function tokens(address) view returns (uint256 totalPrincipal, uint256 tvlBusd, uint256 lastRewardBlock, uint256 accRevaPerToken, bool rewardsEnabled)" +} \ No newline at end of file diff --git a/projects/revault/index.js b/projects/revault/index.js index 393b35bb004..aeed5967a97 100644 --- a/projects/revault/index.js +++ b/projects/revault/index.js @@ -47,8 +47,8 @@ async function tvl(timestamp, _, { bsc: block }) { transform(tokenInfos[i].input.params[0]), tokenInfos[i].output.totalPrincipal ); - }; - }; + } + } await unwrapUniswapLPs( balances, @@ -58,7 +58,7 @@ async function tvl(timestamp, _, { bsc: block }) { transform); return balances; -}; +} module.exports = { misrepresentedTokens: true, diff --git a/projects/revert-compoundor/index.js b/projects/revert-compoundor/index.js index 3de73e104e7..9d7887bb9ca 100644 --- a/projects/revert-compoundor/index.js +++ b/projects/revert-compoundor/index.js @@ -13,6 +13,9 @@ const config = { optimism: { owners: ['0x5411894842e610C4D0F6Ed4C232DA689400f94A1'], }, + bsc: { + owners: ['0x98eC492942090364AC0736Ef1A741AE6C92ec790'] + } } module.exports = { diff --git a/projects/revert-v3-staker/index.js b/projects/revert-v3-staker/index.js index 836fd83f960..9a0b4d58b52 100644 --- a/projects/revert-v3-staker/index.js +++ b/projects/revert-v3-staker/index.js @@ -3,10 +3,14 @@ const { unwrapUniswapV3NFTs } = require('../helper/unwrapLPs') const config = { polygon: { owners: ['0x8c696deF6Db3104DF72F7843730784460795659a'] + }, + evmos: { + owners: ['0x3eb0fffa1470cdd3725b9eb29aded2736144b078'] } } module.exports = { + doublecounted: true }; Object.keys(config).forEach(chain => { diff --git a/projects/revest/index.js b/projects/revest/index.js index e6c40782b9e..78e3638a45e 100644 --- a/projects/revest/index.js +++ b/projects/revest/index.js @@ -1,60 +1,51 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens2, } = require("../helper/unwrapLPs") -const { request } = require("graphql-request"); -const { get, } = require("../helper/http") -const sdk = require('@defillama/sdk') -const { getChainTransform } = require('../helper/portedTokens') +const { covalentGetTokens, } = require("../helper/http") const { getUniqueAddresses } = require('../helper/utils') -const BigNumber = require("bignumber.js"); +const sdk = require("@defillama/sdk"); + +const CutoffABI = "function FNFT_CUTOFF() external view returns (uint256)" +const numFNFTSABI = "function fnftsCreated() external view returns (uint256)" +const getFNFTSupplyABI = "function getSupply(uint256 fnftId) external view returns (uint256)" +const getFNFTConfigABI = "function getFNFT(uint256 fnftId) external view returns (tuple(address asset,,,,,,,) memory)" +const balanceOfABI = "function balanceOf(address account) view returns (uint256)" +const getWalletABI = "function getFNFTAddress(uint256 fnftId) external view returns (address)" + +const ZERO_ADDRESS = ADDRESSES.null -const tokenAddress = 'https://defi-llama-feed.vercel.app/api/address' const config = { ethereum: { holder: '0xA81bd16Aa6F6B25e66965A2f842e9C806c0AA11F', - graph: 'https://api.thegraph.com/subgraphs/name/revest-finance/revest-mainnet-subgraph', - chainId: 1, revest: '0x120a3879da835a5af037bb2d1456bebd6b54d4ba', + tokenVaultV2: '0xD672f1E3411c23Edbb49e8EB6C6b1564b2BF8E17', + fnftHandler: '0xa07E6a51420EcfCB081917f40423D29529705e8a' }, polygon: { holder: '0x3cCc20d960e185E863885913596b54ea666b2fe7', - chainId: 137, + tokenVaultV2: '0xd2c6eB7527Ab1E188638B86F2c14bbAd5A431d78', + fnftHandler: '0x6c111d0b0c5f6577de586f7df262f15a6741ddb7' }, fantom: { holder: '0x3923E7EdBcb3D0cE78087ac58273E732ffFb82cf', - // graph: 'https://api.thegraph.com/subgraphs/name/revest-finance/revestfantomtvl', - chainId: 250, + tokenVaultV2: '0x0ca61c96d1E0bE5F80f4773be367f4bF2025f224', + fnftHandler: '0xA6f5efC3499d41fF1Eca9d325cfe13C913a85F45' }, avax: { holder: '0x955a88c27709a1EEf4ACa0df0712c67B48240919', - chainId: 43114, + fnftHandler: '0xd6E44901Ee92c85D7f019BdaF05cbD779f36Edaa' }, + optimism: { + tokenVaultV2: '0x490867a64746AC33f721A778dD8C30BBb0074055', + fnftHandler: '0xA002Dc3E3C163732F4F5e6F941C87b61B5Afca74', + holder: '0x490867a64746AC33f721A778dD8C30BBb0074055' + }, + arbitrum: { + tokenVaultV2: '0x209F3F7750d4CC52776e3e243717b3A8aDE413eB', + fnftHandler: '0xd90D465631a1718FDB3eA64C39F41290Addf70da', + holder: '0x209F3F7750d4CC52776e3e243717b3A8aDE413eB' + } } -const tokenTrackersABI = { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "tokenTrackers", - "outputs": [ - { - "internalType": "uint256", - "name": "lastBalance", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastMul", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" -} - - module.exports = { hallmarks: [ [1648339200, "Reentrancy attack"] @@ -62,78 +53,195 @@ module.exports = { methodology: "We list all tokens in our vault and sum them together", }; - Object.keys(config).forEach(chain => { - const { chainId, holder, revest, graph, } = config[chain] + const { holder, revest, tokenVaultV2, fnftHandler} = config[chain] module.exports[chain] = { - tvl: async (_, _b, { [chain]: block }) => { + tvl: async (_, _b, _1, { api }) => { + let balances = {} + const blacklist = [] if (revest) blacklist.push(revest.toLowerCase()) - const transform = await getChainTransform(chain) - const tokenURL = `${tokenAddress}?chainId=${chainId}` - let { body: tokens } = await get(tokenURL) + blacklist.push(ZERO_ADDRESS.toLowerCase()) + + let owners = [] + + if (tokenVaultV2 != null) { + + let info = await api.batchCall([ + { + target: tokenVaultV2, + abi: CutoffABI, + chain: chain + }, + { + target: fnftHandler, + abi: numFNFTSABI, + chain: chain + } + ]) + + let cutoff = Number(info[0]) + let numFNFTS = Number(info[1]) + + //Build the Multicall to get the supply of each FNFT to check for ones that still exist + let fnftSupplyCalls = [] + for(let x = cutoff; x < numFNFTS; x++) { + fnftSupplyCalls.push({ + target: fnftHandler, + params: x, + }) + } + + //Get the supply of each to determine if an FNFT is still alive by supply > 0 + let fnftSupplys = await sdk.api.abi.multiCall({ + calls: fnftSupplyCalls, + abi: getFNFTSupplyABI, + requery: true, + permitFailure: false, + chain: chain + }) + + //If the FNFT still exists, track it's ID + let aliveFNFTCalls = [] + let aliveFNFTS = {} + fnftSupplys.output.forEach(supply => { + if (supply.output != 0) { + + //Track the supply of the FNFT + aliveFNFTS[supply.input.params[0]] = supply.output + + aliveFNFTCalls.push({ + target: tokenVaultV2, + params: supply.input.params[0], + }) + } + }) + + //Get the asset of the FNFT + let fnftConfigs = await sdk.api.abi.multiCall({ + calls: aliveFNFTCalls, + abi: getFNFTConfigABI, + requery: true, + permitFailure: false, + chain: chain + }) + + + //Link each FNFTId to its underlying token + let tokenAddressesPerFNFT = {} + let walletCalls = [] + fnftConfigs.output.forEach(config => { + if (!blacklist.includes(config.output[0].toLowerCase())) { + tokenAddressesPerFNFT[config.input.params[0]] = config.output[0] + + walletCalls.push({ + target: tokenVaultV2, + params: [config.input.params[0]], + }) + } + + }) + + //Get the wallet for each FNFT + let wallets = await sdk.api.abi.multiCall({ + abi: getWalletABI, + calls: walletCalls, + chain: chain, + requery: true, + permitFailure: false, + }) + + //Prepare Calldata to check the balance of each token in each wallet + let balanceOfMultiCalls = [] + wallets.output.forEach(wallet => { + balanceOfMultiCalls.push({ + target: tokenAddressesPerFNFT[wallet.input.params[0]], + params: wallet.output, + }) + }) + + let multiCallBalances = await sdk.api.abi.multiCall({ + abi: balanceOfABI, + calls: balanceOfMultiCalls, + chain: chain, + requery: true, + permitFailure: false, + }) + + //Record balances, increasing stored amount if necessary + multiCallBalances.output.forEach(balance => { + if (balances[balance.input.target] == undefined) { + balances[balance.input.target] = 0 + } + + balances[balance.input.target] = (Number(balances[balance.input.target]) + Number(balance.output)) + + }) + + } + + //Get values in tokenVaultV1 + owners.push(holder); + let tokens = await covalentGetTokens(holder, api.chain) tokens = getUniqueAddresses(tokens).filter(t => !blacklist.includes(t)) // filter out staking and LP tokens - const balances = await sumTokens2({ chain, block, owner: holder, tokens, resolveLP: true }) - if (!graph) return balances - return queryGraph(graph, tokens, transform, balances) + let tokenVaultV1Balances = await sumTokens2({ api, owners: owners, tokens, }) + + //For each key in V1 Balances append to regular balances and return + Object.keys(balances).forEach(key => { + if (tokenVaultV1Balances[key] == undefined) { + tokenVaultV1Balances[`${chain}:${key}`] = 0 + } + tokenVaultV1Balances[`${chain}:${key}`] += balances[key] + }) + return tokenVaultV1Balances; }, } if (revest) - module.exports[chain].staking = async (_, _b, { [chain]: block }) => { - const transform = await getChainTransform(chain) - const balances = await sumTokens2({ chain, block, owner: holder, tokens: [revest] }) - if (!graph) return balances - return queryGraph(graph, [revest], transform, balances) - } -}) - - -async function queryGraph(graph_api, tokens, transform, balances) { - //for each token we care about in the array - for (let i = 0; i < tokens.length; i++) { - let totalBalance = 0; - let skipAmount = 0; - let objReturned = 0; - - do { - const tokensQuery = ` - query { - tokenVaultInteractions ( - where: { - token: \"${tokens[i]}" - } - skip: ${skipAmount} - ) { - isDeposit - amountTokens - } - } - `; + module.exports[chain].staking = async (_, _b, _1, { api }) => { + //Get the number of FNFTS for the TokenVaultV2 + let info = await api.batchCall([ + { + target: config[chain].tokenVaultV2, + abi: CutoffABI, + chain: chain + }, + { + target: config[chain].fnftHandler, + abi: numFNFTSABI, + chain: chain + } + ]) - const data = await request(graph_api, tokensQuery) + let cutoff = Number(info[0]) + let numFNFTS = Number(info[1]) - for (let y = 0; y < data.tokenVaultInteractions.length; y++) { - let bal = +data.tokenVaultInteractions[y].amountTokens; - if (data.tokenVaultInteractions[y].isDeposit == true) { - // console.log(Number(ethers.utils.formatEther(data.tokenVaultInteractions[y].amountTokens))) - totalBalance += bal; - } else { - totalBalance -= bal; + //Build Multicall Data + let calls = [] + for(let x = cutoff; x < numFNFTS; x++) { + calls.push({ + target: config[chain].tokenVaultV2, + params: [x] + }) } - } - // console.log(`Length: ${data.tokenVaultInteractions.length}`) - skipAmount += 100; - objReturned = data.tokenVaultInteractions.length; - } while (objReturned != 0); - // console.log(`Total Balance ${tokens[i]}: ${totalBalance}`) - if (totalBalance < 0) { - // throw new Error('balance should never be zero token: ' + tokens[i] + totalBalance) - console.log('balance should never be zero token: ' + tokens[i] + totalBalance) - totalBalance = 0 + //Get the wallet address for each FNFT via multicall + let walletMultiCallList = await sdk.api.abi.multiCall({ + abi: getWalletABI, + calls: calls, + chain: chain, + requery: true, + permitFailure: false + }) + let wallets = [] + walletMultiCallList.output.forEach(wallet => { + // console.log(`output: ${JSON.stringify(wallet)}`) + wallets.push(wallet.output) + }) + + wallets.push(holder); + + //Return the balance of revest in every wallet. + return sumTokens2({ api, owners: wallets, tokens: [revest] }) } - sdk.util.sumSingleBalance(balances, transform(tokens[i]), BigNumber(totalBalance).toFixed(0)) - } - return balances; -} +}) \ No newline at end of file diff --git a/projects/rhea/index.js b/projects/rhea/index.js index f92d9c14007..62dd90e3983 100644 --- a/projects/rhea/index.js +++ b/projects/rhea/index.js @@ -1,7 +1,8 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const KDAI_RHEA_LP = "0x0b8ac02bf51e1c3a809f8f773dd44025c31c4467"; -const KDAI = "0x5c74070fdea071359b86082bd9f9b3deaafbe32b"; +const KDAI = ADDRESSES.klaytn.KDAI; const TREASURY = "0x32F71263CF373d726f4e45286Bbb6935d553E8D0"; const RHEA = "0x0758fb651282581f86316514e8f5021493e9ed83"; const STAKING_ADDR = "0xee0f2e95e69d4246f8267be6d0f2610ce75d993c"; @@ -56,7 +57,7 @@ async function getTvl(timestamp, ethBlock, chainBlocks) { sdk.util.sumSingleBalance(balances.staking, 'tether', staking) return balances -}; +} module.exports = { methodology: "Counts tokens on the treasury for tvl and staked RHEA for staking", diff --git a/projects/ribbon-earn/index.js b/projects/ribbon-earn/index.js index 4098fb9bc27..55a9bbe9ab2 100644 --- a/projects/ribbon-earn/index.js +++ b/projects/ribbon-earn/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk") const abi = require("../ribbon/abi.json") const { sumTokensExport } = require('../helper/unwrapLPs'); @@ -5,9 +6,12 @@ const { default: BigNumber } = require("bignumber.js"); // Ribbon Earn vaults const rearnUSDC = "0x84c2b16FA6877a8fF4F3271db7ea837233DFd6f0"; +const rearnstETH = "0xCE5513474E077F5336cf1B33c1347FDD8D48aE8c"; // Ethereum Assets -const usdc = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48" +const usdc = ADDRESSES.ethereum.USDC; +const steth = ADDRESSES.ethereum.STETH; + async function addVaults({ balances, chain, vaults, block, transformAddress = a => a }) { const { output: balanceRes } = await sdk.api.abi.multiCall({ abi: abi.totalBalance, @@ -18,11 +22,11 @@ async function addVaults({ balances, chain, vaults, block, transformAddress = a balanceRes.forEach((data, i) => sdk.util.sumSingleBalance(balances, transformAddress(vaults[i][0]), data.output)) } -async function getUSDCOnVault(block) { - const { output: usdcBalance } = await sdk.api.abi.call({ - target: usdc, abi: 'erc20:balanceOf', params: rearnUSDC, block, +async function getAssetOnVault(asset, param, block) { + const { output: balance } = await sdk.api.abi.call({ + target: asset, abi: 'erc20:balanceOf', params: param, block, }) - return usdcBalance + return balance } async function borrowed(_, block) { @@ -30,16 +34,17 @@ async function borrowed(_, block) { const vaults = [ // ribbon earn [usdc, rearnUSDC], + [steth, rearnstETH], ] - await addVaults({ balances, block, vaults, }) - sdk.util.sumSingleBalance(balances, usdc, BigNumber(-1 * (await getUSDCOnVault(block))).toFixed(0)) + sdk.util.sumSingleBalance(balances, usdc, BigNumber(-1 * (await getAssetOnVault(usdc, rearnUSDC, block))).toFixed(0)) + sdk.util.sumSingleBalance(balances, steth, BigNumber(-1 * (await getAssetOnVault(steth, rearnstETH, block))).toFixed(0)) return balances } module.exports = { ethereum: { - tvl: sumTokensExport({ owner: rearnUSDC, tokens: [usdc]}), + tvl: sumTokensExport({tokensAndOwners: [[usdc, rearnUSDC], [steth, rearnstETH]]}), borrowed, }, } diff --git a/projects/ribbon-lend/index.js b/projects/ribbon-lend/index.js index fc5af304072..f4e3889ecbd 100644 --- a/projects/ribbon-lend/index.js +++ b/projects/ribbon-lend/index.js @@ -1,17 +1,17 @@ const sdk = require("@defillama/sdk") const { sumTokens2 } = require('../helper/unwrapLPs') +const { getLogs } = require('../helper/cache/getLogs') -async function getPools(block) { +async function getPools(api) { const pools = [] const poolFactory = '0x312853485a41f76f20a14f927cd0ea676588936c' - const logs = await sdk.api.util.getLogs({ - keys: [], - toBlock: block, + const logs = await getLogs({ + api, target: poolFactory, fromBlock: 15598950, topic: 'PoolCreated(address,address,address)', }) - logs.output.forEach((log) => { + logs.forEach((log) => { const pool = `0x${log.topics[1].substring(26)}`.toLowerCase(); const currency = `0x${log.topics[3].substring(26)}`.toLowerCase(); pools.push({ pool, currency }) @@ -19,30 +19,17 @@ async function getPools(block) { return pools } -async function tvl(_, block) { - const pools = await getPools(block) +async function tvl(_, block, _1, { api }) { + const pools = await getPools(api) const tokensAndOwners = pools.map(i => ([i.currency, i.pool])) return sumTokens2({ block, tokensAndOwners }) } -async function borrowed(_, block) { - const pools = await getPools(block) +async function borrowed(_, block, _1, { api }) { + const pools = await getPools(api) const calls = pools.map(i => ({ target: i.pool })) - const abi = { - "inputs": [], - "name": "borrows", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } const { output: borrows } = await sdk.api.abi.multiCall({ - abi, calls, block, + abi: "uint256:borrows", calls, block, }) const balances = {} borrows.forEach(({ output, }, i) => sdk.util.sumSingleBalance(balances, pools[i].currency, output )) diff --git a/projects/ribbon/abi.json b/projects/ribbon/abi.json index 6d16b3a2400..ac9d59a12a9 100644 --- a/projects/ribbon/abi.json +++ b/projects/ribbon/abi.json @@ -1,3 +1,3 @@ { - "totalBalance": {"inputs":[],"name":"totalBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"} + "totalBalance": "uint256:totalBalance" } \ No newline at end of file diff --git a/projects/ribbon/evm.js b/projects/ribbon/evm.js index de98af4ef42..1d8c5385ea7 100644 --- a/projects/ribbon/evm.js +++ b/projects/ribbon/evm.js @@ -1,13 +1,12 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); const { staking } = require("../helper/staking"); -const { sumTokens2, nullAddress } = require('../helper/unwrapLPs'); +const { sumTokens2, nullAddress, sumTokensExport } = require('../helper/unwrapLPs'); const { getChainTransform } = require('../helper/portedTokens'); -// Treasury -const treasury = "0xDAEada3d210D2f45874724BeEa03C7d4BBD41674"; - // Ethereum Vaults +const uniCallVault = "0xDD9d1B7dEaB1A843A1B584d2CA5903B8A4735deF"; const ethCallVault = "0x0fabaf48bbf864a3947bdd0ba9d764791a60467a"; const ethCallVaultV2 = "0x25751853Eab4D0eB3652B5eB6ecB102A2789644B"; const wbtcCallVault = "0x8b5876f5B0Bf64056A89Aa7e97511644758c3E8c"; @@ -39,25 +38,26 @@ const pauserAvax = "0xf08d6a9c2C5a2Dc9B8645c5Ac0b529D4046D19aa"; const rearnUSDC = "0x84c2b16FA6877a8fF4F3271db7ea837233DFd6f0"; // Ethereum Assets -const weth = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"; -const wbtc = "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599"; -const usdc = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"; -const aave = "0x7Fc66500c84A76Ad7e9c93437bFc5Ac33E2DDaE9"; +const weth = ADDRESSES.ethereum.WETH; +const wbtc = ADDRESSES.ethereum.WBTC; +const usdc = ADDRESSES.ethereum.USDC; +const aave = ADDRESSES.ethereum.AAVE; const perp = "0xbC396689893D065F41bc2C6EcbeE5e0085233447"; const ape = "0x4d224452801ACEd8B2F0aebE155379bb5D594381"; const bal = "0xba100000625a3754423978a60c9317c58a424e3D"; -const reth = "0xae78736Cd615f374D3085123A210448E74Fc6393"; -const steth = "0xae7ab96520de3a18e5e111b5eaab095312d7fe84"; +const reth = ADDRESSES.ethereum.RETH; +const steth = ADDRESSES.ethereum.STETH; const spell = "0x090185f2135308BaD17527004364eBcC2D37e5F6"; const badger = "0x3472A5A71965499acd81997a54BBA8D852C6E53d"; -const wsteth = "0x7f39c581f595b53c5cb19bd0b3f8da6c935e2ca0"; -const ldo = "0x5A98FcBEA516Cf06857215779Fd812CA3beF1B32"; +const wsteth = ADDRESSES.ethereum.WSTETH; +const ldo = ADDRESSES.ethereum.LIDO; const rbnWeth = "0xdb44a4a457c87225b5ba45f27b7828a4cc03c112"; +const uni = ADDRESSES.ethereum.UNI; // Avalanche Assets -const wavax = "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7"; +const wavax = ADDRESSES.avax.WAVAX; const savax = "0x2b2C81e08f1Af8835a78Bb2A90AE924ACE0eA4bE"; -const usdce = "0xA7D7079b0FEaD91F3e65f86E8915Cb59c1a4C664"; +const usdce = ADDRESSES.avax.USDC_e; async function addVaults({ balances, chain, vaults, block, transformAddress = a => a }) { const { output: balanceRes } = await sdk.api.abi.multiCall({ @@ -73,6 +73,7 @@ async function ethTvl(_, block) { const balances = {}; const vaults = [ // theta vault + [uni, uniCallVault], [weth, ethCallVault], [weth, ethCallVaultV2], [wbtc, wbtcCallVault], @@ -112,14 +113,6 @@ async function avaxTvl(_, _b, { avax: block }) { return sumTokens2({ balances, owner: pauserAvax, tokens: [nullAddress, savax], chain, block, transformAddress, }) } -async function getTreasury(timestamp, block, chainBlocks) { - return sumTokens2({ - block, owner: treasury, - tokens: [ weth, wsteth, wbtc, usdc, aave, ldo, reth, bal, rbnWeth, nullAddress], - resolveLP: true, - }) -} - /** * STAKING */ @@ -131,9 +124,15 @@ module.exports = { ethereum: { tvl: ethTvl, staking: veRBNStaking, - treasury: getTreasury, }, avax: { tvl: avaxTvl, }, + bsc: { + tvl: sumTokensExport({ + tokensAndOwners: [ + [ADDRESSES.bsc.WBNB, '0xC56d5a5BE96B5fB51C2bA5cBC59AfE77198838F7'], // BNB Theta vault + ] + }) + } }; diff --git a/projects/ribbon/solana.js b/projects/ribbon/solana.js index b087876043b..0dc32a44a6d 100644 --- a/projects/ribbon/solana.js +++ b/projects/ribbon/solana.js @@ -1,15 +1,153 @@ -const { get } = require('../helper/http') - -const tvl = async () => { - const vault = await get("https://solana-vault.uc.r.appspot.com/tvl") - - return { - solana: +vault.sol.tvl - }; -}; +const { getProvider, sumTokens2, } = require('../helper/solana') +const { Program, } = require("@project-serum/anchor"); +async function tvl() { + const { api } = arguments[3] + const provider = getProvider() + const program = new Program(idl, 'RBN2XNc6JQU6ewFp9TyPq6WznsvNuumzSJkor1nJFcz', provider) + const vaults = await program.account.vault.all() + const tokenAccounts = vaults.map(({ account: { + underlyingMint, + startEpochVaultBalance, + vaultUnderlyingTokenAccount, + vaultDepositQueueUnderlyingTokenAccount, + vaultWithdrawQueueRedeemableTokenAccount, + } }) => { + api.add(underlyingMint.toString(), +startEpochVaultBalance) + return [vaultUnderlyingTokenAccount, vaultDepositQueueUnderlyingTokenAccount, vaultWithdrawQueueRedeemableTokenAccount] + }).flat().map(i => i.toString()) + return sumTokens2({ balances: api.getBalances(), tokenAccounts, }) +} module.exports = { solana: { tvl, }, }; + +const idl = { + "version": "0.1.0", + "name": "covered_call_vault", + "instructions": [], + "accounts": [ + { + "name": "Vault", + "type": { + "kind": "struct", + "fields": [ + { + "name": "vaultName", + "type": { + "array": [ + "u8", + 20 + ] + } + }, + { + "name": "vaultNonce", + "type": "u8" + }, + { + "name": "redeemableMintNonce", + "type": "u8" + }, + { + "name": "vaultUnderlyingTokenAccountNonce", + "type": "u8" + }, + { + "name": "depositQueueHeaderNonce", + "type": "u8" + }, + { + "name": "vaultDepositQueueUnderlyingTokenAccountNonce", + "type": "u8" + }, + { + "name": "withdrawQueueHeaderNonce", + "type": "u8" + }, + { + "name": "vaultWithdrawQueueRedeemableTokenAccountNonce", + "type": "u8" + }, + { + "name": "underlyingMint", + "type": "publicKey" + }, + { + "name": "redeemableMint", + "type": "publicKey" + }, + { + "name": "vaultUnderlyingTokenAccount", + "type": "publicKey" + }, + { + "name": "vaultDepositQueueUnderlyingTokenAccount", + "type": "publicKey" + }, + { + "name": "vaultWithdrawQueueRedeemableTokenAccount", + "type": "publicKey" + }, + { + "name": "depositLimit", + "type": "u64" + }, + { + "name": "epochSequenceNumber", + "type": "u64" + }, + { + "name": "startEpoch", + "type": "u64" + }, + { + "name": "endDeposits", + "type": "u64" + }, + { + "name": "startSettlement", + "type": "u64" + }, + { + "name": "endEpoch", + "type": "u64" + }, + { + "name": "epochCadence", + "type": "u32" + }, + { + "name": "startEpochVaultBalance", + "type": "u64" + }, + { + "name": "optionMint", + "type": "publicKey" + }, + { + "name": "optionsRemaining", + "type": "bool" + }, + { + "name": "collateralCollected", + "type": "bool" + }, + { + "name": "depositQueueHeader", + "type": "publicKey" + }, + { + "name": "withdrawQueueHeader", + "type": "publicKey" + } + ] + } + } + ], + "types": [], + "events": [], + "errors": [] +} \ No newline at end of file diff --git a/projects/rift-finance/abis/masterChefAbi.js b/projects/rift-finance/abis/masterChefAbi.js deleted file mode 100644 index b6857d0ec64..00000000000 --- a/projects/rift-finance/abis/masterChefAbi.js +++ /dev/null @@ -1,38 +0,0 @@ -module.exports = [ - { - inputs: [ - { - internalType: "uint256", - name: "pid", - type: "uint256", - }, - { - internalType: "address", - name: "user", - type: "address", - }, - ], - name: "userInfo", - outputs: [ - { - components: [ - { - internalType: "uint256", - name: "amount", - type: "uint256", - }, - { - internalType: "uint256", - name: "rewardDebt", - type: "uint256", - }, - ], - internalType: "struct IMasterChefWithdraw.UserInfo", - name: "", - type: "tuple", - }, - ], - stateMutability: "view", - type: "function", - }, -]; diff --git a/projects/rift-finance/abis/riftVaultAbi.js b/projects/rift-finance/abis/riftVaultAbi.js deleted file mode 100644 index 55c56fa11b5..00000000000 --- a/projects/rift-finance/abis/riftVaultAbi.js +++ /dev/null @@ -1,67 +0,0 @@ -module.exports = [ - { - inputs: [], - name: "token0", - outputs: [ - { - internalType: "contract IERC20Upgradeable", - name: "", - type: "address", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "token1", - outputs: [ - { - internalType: "contract IERC20Upgradeable", - name: "", - type: "address", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "pair", - outputs: [ - { - internalType: "address", - name: "", - type: "address", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "rewarder", - outputs: [ - { - internalType: "address", - name: "", - type: "address", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "pid", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, -]; diff --git a/projects/rift-finance/index.js b/projects/rift-finance/index.js index 251c69fab78..a0500ce2edb 100644 --- a/projects/rift-finance/index.js +++ b/projects/rift-finance/index.js @@ -1,17 +1,22 @@ const sdk = require("@defillama/sdk"); -const { getBlock } = require("../helper/getBlock"); +const { getBlock } = require("../helper/http"); const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); const { getChainTransform } = require("../helper/portedTokens"); const { request, gql } = require("graphql-request"); const NETWORKS = require("./networks"); -const riftVaultAbi = require("./abis/riftVaultAbi"); -const masterChefAbi = require("./abis/masterChefAbi"); +const riftVaultAbi = { + rewarder: "address:rewarder", + pid: "uint256:pid", +}; +const masterChefAbi = { + userInfo: "function userInfo(uint256 pid, address user) view returns (tuple(uint256 amount, uint256 rewardDebt))", +} function getAbi(obj, fnName) { - return obj.find((x) => x.name === fnName); + return obj[fnName]; } function addressToId(address) { @@ -49,7 +54,8 @@ async function getChainBalances(timestamp, chainBlocks, chain) { coreAddr: addressToId(coreAddress), }); - for (const vault of queryResult.core.vaults) { + await Promise.all(queryResult.core.vaults.map(async vault => { + // Get balances. const token0Bal = ( await sdk.api.abi.call({ @@ -135,7 +141,7 @@ async function getChainBalances(timestamp, chainBlocks, chain) { transform ); } - } + })) return balances; } diff --git a/projects/rigoblock/index.js b/projects/rigoblock/index.js new file mode 100644 index 00000000000..70260055432 --- /dev/null +++ b/projects/rigoblock/index.js @@ -0,0 +1,67 @@ +const sdk = require('@defillama/sdk') +const { getLogs } = require('../helper/cache/getLogs') +const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') +const { getUniqueAddresses } = require('../helper/tokenMapping') + +const E_WHITELIST = '0xB43baD2638696F8bC82247B92bD56B8DF37d89aB' +const REGISTRY = '0x06767e8090bA5c4Eca89ED00C3A719909D503ED6' // same on all chains + +module.exports = { + methodology: `Rigoblock TVL on Ethereum, Arbitrum, Optimism and Polygon pulled from onchain data`, +} +const config = { + ethereum: { fromBlock: 15817831, GRG_VAULT_ADDRESSES: '0xfbd2588b170Ff776eBb1aBbB58C0fbE3ffFe1931', GRG_TOKEN_ADDRESSES: '0x4FbB350052Bca5417566f188eB2EBCE5b19BC964', }, + arbitrum: { fromBlock: 32290603, GRG_VAULT_ADDRESSES: '0xE86a667F239A2531C9d398E81154ba125030497e', GRG_TOKEN_ADDRESSES: '0x7F4638A58C0615037deCc86f1daE60E55fE92874', }, + optimism: { fromBlock: 31239008, GRG_VAULT_ADDRESSES: '0x5932C223186F7856e08A1D7b35ACc2Aa5fC57BfD', GRG_TOKEN_ADDRESSES: '0xEcF46257ed31c329F204Eb43E254C609dee143B3', }, + polygon: { fromBlock: 34751673, GRG_VAULT_ADDRESSES: '0xF241De983959A483F376fDC8Ed09DC580BA66109', GRG_TOKEN_ADDRESSES: '0xBC0BEA8E634ec838a2a45F8A43E7E16Cd2a8BA99', }, +} + +Object.keys(config).forEach(chain => { + const { fromBlock, GRG_TOKEN_ADDRESSES, GRG_VAULT_ADDRESSES } = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const { pools, tokens } = await getPoolInfo(api) + return sumTokens2({ owners: pools, tokens, api, resolveUniV3: true, blacklistedTokens: [GRG_TOKEN_ADDRESSES] }) + }, + staking: async (_, _b, _cb, { api, }) => { + const { pools, tokens } = await getPoolInfo(api) + const bals = await api.multiCall({ abi: 'erc20:balanceOf', calls: pools, target: GRG_VAULT_ADDRESSES }) + bals.forEach(i => api.add(GRG_TOKEN_ADDRESSES, i)) + return sumTokens2({ owners: pools, tokens: [GRG_TOKEN_ADDRESSES], api, resolveUniV3: true, uniV3WhitelistedTokens: [GRG_TOKEN_ADDRESSES] }) + }, + } + + async function getPoolInfo(api) { + const poolKey = `${api.chain}-${api.block}` + if (!poolData[poolKey]) poolData[poolKey] = _getPoolInfo() + return poolData[poolKey] + + async function _getPoolInfo() { + const registeredLogs = await getLogs({ + api, + target: REGISTRY, + fromBlock, + topic: 'Registered(address,address,bytes32,bytes32,bytes32)', + onlyArgs: true, + eventAbi: 'event Registered(address indexed group, address pool, bytes32 indexed name, bytes32 indexed symbol, bytes32 id)' + }) + const whitelistedTokensLogs = await getLogs({ + api, + target: E_WHITELIST, + fromBlock, + topic: 'Whitelisted(address,bool)', + onlyArgs: true, + eventAbi: 'event Whitelisted(address indexed token, bool isWhitelisted)' + }) + const pools = registeredLogs.map(i => i.pool) + let tokens = whitelistedTokensLogs.map(i => i.token) + tokens.push(nullAddress) + // we may have duplicates if a token is first whitelisted than removed + tokens = getUniqueAddresses(tokens) + sdk.log('chain: ', api.chain, 'pools: ', pools.length, 'tokens: ', tokens.length) + return { pools, tokens } + } + } +}) + +const poolData = {} \ No newline at end of file diff --git a/projects/rikkei-finance/index.js b/projects/rikkei-finance/index.js index 048c5c35402..9ce99e76abb 100644 --- a/projects/rikkei-finance/index.js +++ b/projects/rikkei-finance/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { compoundExports } = require("../helper/compound"); module.exports = { @@ -6,7 +7,7 @@ module.exports = { '0x4f3e801Bd57dC3D641E72f2774280b21d31F64e4', 'bsc', '0x157822aC5fa0Efe98daa4b0A55450f4a182C10cA', - '0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c' + ADDRESSES.bsc.WBNB ) } }; \ No newline at end of file diff --git a/projects/ripae/index.js b/projects/ripae/index.js index b3b2d20284b..d3d7da01473 100644 --- a/projects/ripae/index.js +++ b/projects/ripae/index.js @@ -66,6 +66,17 @@ const chains = [ "0xB54B196E9FeCcF364c2281da1E11BC498cB5c1C1", "0x89A3A5b03f705A10443fB0A93f19F6cBB7ca191A" ] + }, + { + chain: "optimism", + token: "0x6ca558bd3eaB53DA1B25aB97916dd14bf6CFEe4E", + share: "0x09448876068907827ec15f49a8f1a58c70b04d45", + rewardPool: "0xf5e49b0a960459799F1E9b3f313dFA81D2CE553c", + masonry: "0x95F73Fc89F62b42410fC4A4a60edEfC51De0B7B0", + pool2: [ + "0x20d33fF7880f65a3554bBEE9C4E9BF79812C6ef6", + "0x9629a694C041f3b10cE974DC37eF4dD4596c4F54" + ] } ]; diff --git a/projects/rising-undead/index.js b/projects/rising-undead/index.js new file mode 100644 index 00000000000..37fe07560a0 --- /dev/null +++ b/projects/rising-undead/index.js @@ -0,0 +1,16 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require('../helper/unwrapLPs'); + +const owner = "0xc732471083342a842a728221878327c8DeE8aEDB"; +const tokens = [ + {symbol: "WKAVA", address: ADDRESSES.kava.WKAVA }, + {symbol: "ETH", address: ADDRESSES.moonriver.USDC }, + {symbol: "USDC", address: ADDRESSES.telos.ETH }, + {symbol: "USDT", address: ADDRESSES.moonriver.USDT }, +] + +module.exports = { + kava: { + tvl: sumTokensExport({ owner, tokens: tokens.map(i => i.address)}) + } +} \ No newline at end of file diff --git a/projects/risk-harbor/index.js b/projects/risk-harbor/index.js index 4f3ab1db2e6..22fa805bd90 100644 --- a/projects/risk-harbor/index.js +++ b/projects/risk-harbor/index.js @@ -1,49 +1,80 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const { - queryV1Beta1, queryContract, - getDenomBalance, -} = require("../helper/chain/terra"); -const { sumTokens } = require("../helper/unwrapLPs"); + sumTokens: sumTokensCosmos, +} = require("../helper/chain/cosmos"); +const { sumTokens, } = require("../helper/unwrapLPs"); +const vaultManagerAbi = "address[]:getVaults"; +const vaultAbi = 'function self() view returns (tuple(address underwritingToken, uint32 start, uint32 expiration, uint8 underwritingTokenDecimals) config, tuple(tuple(tuple(uint128 numerator, uint128 denominator)[] expectedXVector, tuple(uint128 numerator, uint128 denominator)[] varCovarMatrix, tuple(uint128 numerator, uint128 denominator) lambda) config) amm, tuple(tuple(address standard, address rollover) underwritingPositionERC20, address nextVault, uint56 poolCount, uint32 latestInteraction, bool paused, uint256 premiums, uint256 premiumsAccruedPerShare, uint256 premiumDripBasis, uint256[] allocationVector) state)' const networks = { ethereum: { + // V2.5 Factory (underwriting tokens are dynamically fetched) + vaultManager: "0x7B99AfA5A2EC23499e6CD6955dEdF85318347cc9", + // V2 Vaults vaults: [ // [underwritingAsset, vaultAddress] [ - "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", + ADDRESSES.ethereum.USDC, "0x83944C256e5C057A246aE1b1945934440eb35Af6", ], [ - "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", + ADDRESSES.ethereum.USDC, "0x8D999a2f262FfDA47A734B987D1A15bc984e45Be", ], [ - "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", + ADDRESSES.ethereum.USDC, "0x0881Ec8e0e743906E1c1dFeE8Ae12BfDc0611b24", ], [ - "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", + ADDRESSES.ethereum.USDC, "0x8529687adD661120C9E23E366Cc7F545f1A03ADf", ], + [ + ADDRESSES.ethereum.USDC, + "0x61635d1De721DD1DB35f8aCFD0f1ea367dF65671", + ], ], }, arbitrum: { + vaultManager: "0x713C8810F79B4F101f66bB5b5a1326473ae5c7f7", vaults: [ [ - "0xff970a61a04b1ca14834a43f5de4533ebddb5cc8", + ADDRESSES.arbitrum.USDC, "0x207472891AF32F5636c35d9ca8e17464Df7108bB", ], [ - "0xff970a61a04b1ca14834a43f5de4533ebddb5cc8", + ADDRESSES.arbitrum.USDC, "0xbcA81A2118982182d897845571BE950aE94C619c", ], + [ + ADDRESSES.arbitrum.USDC, + "0x2DafE4DD7C661c2CEaf967d51206f5130AA32782", + ], + [ + ADDRESSES.arbitrum.USDC, + "0xdd74ee6c6568429537bf30cb63dab0061b83c41a" + ], + [ + ADDRESSES.arbitrum.USDC, + "0xc7c52aa35d499e0c18ff3854f24e65d43c97d5a4" + ], + [ + ADDRESSES.arbitrum.USDC, + "0x695d803207579bb4f34c97ab3e3a449de8ad042e" + ], + [ + ADDRESSES.arbitrum.USDC, + "0x451709e54474a7a7df889e98124180847782cb4a" + ] ], }, avax: { + vaultManager: "0xBf8c506a56F355d2340F37a91FA6569737b08254", vaults: [ [ - "0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e", + ADDRESSES.avax.USDC, "0x2DafE4DD7C661c2CEaf967d51206f5130AA32782", ], [ @@ -52,7 +83,11 @@ const networks = { "0x2DafE4DD7C661c2CEaf967d51206f5130AA32782", ], [ - "0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e", + ADDRESSES.avax.USDC, + "0xBe09C11d28683E283fdf7566DE1685A6A221B6bf", + ], + [ + ADDRESSES.avax.USDC, "0xBe09C11d28683E283fdf7566DE1685A6A221B6bf", ], ], @@ -60,7 +95,7 @@ const networks = { fantom: { vaults: [ [ - "0x04068DA6C83AFCFA0e13ba15A6696662335D5B75", + ADDRESSES.fantom.USDC, "0xca67B16b02E418CFbC9EF287C7C20B77dbb665f2", ], ], @@ -68,11 +103,57 @@ const networks = { aurora: { vaults: [ [ - "0xb12bfca5a55806aaf64e99521918a4bf0fc40802", + ADDRESSES.aurora.USDC_e, "0x8D999a2f262FfDA47A734B987D1A15bc984e45Be", ], ], }, + optimism: { + vaultManager: "0x7c1187AF4D6B23F7f7682799454168E24bC06EED", + vaults: [ + [ + ADDRESSES.optimism.USDC, + "0xfB969b45Fa9186CD8B420407552aD447F7c3817b", + ], + [ + ADDRESSES.optimism.USDC, + "0x88e7385eacf8e31c9cddce7632bfe654b58f4a09", + ], + [ + ADDRESSES.optimism.USDC, + "0x88e7385eacf8e31c9cddce7632bfe654b58f4a09" + ], + [ + ADDRESSES.optimism.USDC, + "0x01bd59477e03d9034684a118ba67cfa32cd9b123" + ], + [ + ADDRESSES.optimism.USDC, + "0xdf9d37e1a19474e5928fb410a3f8513a25ba680c" + ] + + ], + }, + polygon: { + vaults: [ + [ + ADDRESSES.polygon.USDC, + "0xdf9d37e1a19474e5928fb410a3f8513a25ba680c" + ], + [ + ADDRESSES.polygon.USDC, + "0xadaab38f3ecdf2b486eb3cab7f54bdcbdfb7fd66" + ], + [ + ADDRESSES.polygon.USDC, + "0x4db26943e581c1befaa5d682f6404de17c028487" + ], + [ + ADDRESSES.polygon.USDC, + "0xa644bdf7f0da0b83623ac4d01607ea91a24b1ede" + ] + ] + }, terra: { vaults: [ "terra1dlfz2teqt5shxuw87npfecjtv7xlrxvqd4sapt", // Ozone v1 pool 1 @@ -80,102 +161,101 @@ const networks = { ], }, terra2: { + wrapped_luna: "terra1ufj34v4agxlazv6gv36fsdm5e8y4kclqgp0qt0l8ureql9pcwssspma238", factory: "terra1lnq5rk4gla2c537hpyxq6wjs8g0k0dedxug2p50myydaqjtm4g5ss94y8n", masterPool: "terra1gz50vgzjssefzmld0kfkt7sfvejgel9znun9chsc82k09xfess5qqu8qyc", // Ozone v2 underwriting master pool }, }; -async function terra2(timestamp, ethBlock, chainBlocks) { - const balances = { "terra-luna-2": 0 }; +async function getManagedVaults(vaultManager, block, chain) { + let res = []; + const { output: managedVaults } = await sdk.api.abi.call({ + abi: vaultManagerAbi, + target: vaultManager, + block, + chain, + }); + + let calls = []; + managedVaults.forEach((vault) => { + calls.push({ + target: vault, + }); + }); + + const { output: vaultStoragesResult } = await sdk.api.abi.multiCall({ + abi: vaultAbi, + calls, + block, + chain, + }); + + // Join the two arrays into [[underwritingToken, vaultAddr]] + vaultStoragesResult.forEach((vaultStorageResult) => { + if (vaultStorageResult.success) { + const underwritingToken = + vaultStorageResult.output.config.underwritingToken; + res.push([underwritingToken, vaultStorageResult.input.target]); + } + }); + + return res; +} - const { vaults } = await queryContract({ +async function terra2(timestamp, ethBlock, chainBlocks, { api }) { + const { addresses } = await queryContract({ contract: networks.terra2.factory, - isTerra2: true, + chain: "terra2", data: { get_vaults: {}, }, }); - // Go through each vault and add it's underwriting balance - // stored in allocation_vector slot 0 // 09-28-22 As of now, the only asset supported for deposit // is Luna2 in the form of wrapped Luna2 since RH Ozone v2 does // not support native token types - vaults.forEach((vault) => { - balances["terra-luna-2"] += - parseInt(vault.state.allocation_vector[0]) / 1e6; - }); - - // Query the Master underwriting vault - balances["terra-luna-2"] += - (await getDenomBalance( - "uluna", - networks.terra2.masterPool, - chainBlocks.terra2, - { - isTerra2: true, - } - )) / 1e6; + // For each vault, query its wrapped LUNA2 balance + for (const address of addresses) { + const { balance } = await queryContract({ + contract: networks.terra2.wrapped_luna, + chain: 'terra2', + data: { balance: { address: address } } + }) + api.add('terra-luna-2', balance / 1e6) + } - return balances; + return sumTokensCosmos({ balances: api.getBalances(), owner: networks.terra2.masterPool, chain: "terra2", }) } async function terra(timestamp, ethBlock, chainBlocks) { - const balances = { terrausd: 0 }; - - for (const vaultAddr of networks.terra.vaults) { - let paginationKey; - - do { - const data = await queryV1Beta1( - `bank/v1beta1/balances/${vaultAddr}`, - paginationKey, - chainBlocks.terra - ); - - paginationKey = data.pagination.next_key; - - data.balances.forEach(({ denom, amount }) => { - /** - * 3/10/2022 - As of now the only supported underwriting token for Risk Harbor Ozone is UST, so - * balances should always be an array of length 1. Added support for dynamic balances length, denom checking, and pagination for - * future proofing and safety. - */ - if (denom === "uusd") { - balances["terrausd"] += parseInt(amount) / 1e6; - } - }); - } while (paginationKey); - } - return balances; + return sumTokensCosmos({ owners: networks.terra.vaults, chain: "terra" }); } function evm(chainName) { - return async (timestamp, block, chainBlocks) => { - const balances = {}; + return async (timestamp, block, chainBlocks, { api }) => { const network = networks[chainName]; - if (chainName === "ethereum") { - await sumTokens(balances, network.vaults, block); - } else { - await sumTokens( - balances, - network.vaults, - chainBlocks[chainName], - chainName, - null, - { - resolveCrv: true, - } + + if (network.vaultManager) { + const managedVaults = await getManagedVaults( + network.vaultManager, + api.block, + chainName ); + network.vaults = [...network.vaults, ...managedVaults]; } - return balances; + + return sumTokens( + undefined, + network.vaults, + api.block, + chainName, + ); }; } module.exports = { - timetravel: true, - misrepresentedTokens: false, + timetravel: false, methodology: "Amount of underwriter capital inside the protocol", terra: { tvl: terra, @@ -183,7 +263,6 @@ module.exports = { terra2: { tvl: terra2, }, - ethereum: { tvl: evm("ethereum"), }, @@ -199,5 +278,11 @@ module.exports = { aurora: { tvl: evm("aurora"), }, + optimism: { + tvl: evm("optimism"), + }, + polygon: { + tvl: evm("polygon"), + }, hallmarks: [[1651881600, "UST depeg"]], }; diff --git a/projects/roaring-lion/index.js b/projects/roaring-lion/index.js index 39ab03fe871..788051bb15d 100644 --- a/projects/roaring-lion/index.js +++ b/projects/roaring-lion/index.js @@ -1,5 +1,5 @@ const sdk = require("@defillama/sdk"); -const { unwrapBalancerPool } = require('../helper/unwrapLPs') +const { unwrapBalancerToken } = require('../helper/unwrapLPs') const LION = "0x3CC9E655B6c4f530DFc1b1fC51CeEa65c6344716"; const LSHARE = "0x50d8D7F7CcEA28cc1C9dDb996689294dC62569cA"; @@ -8,22 +8,14 @@ const rewardPool = "0x119ad97096fff8629347f5af7f36ac1a32de4f2d"; //users can only lock lps in the boardroom -async function pool2(timestamp, block, chainBlocks) { - return await unwrapBalancerPool({ - chain: 'bsc', - chainBlocks, - balancerPool: "0x950667EF678bAe44Ef037c721E564C365FC8303E", - owner: boardroom, }) +async function pool2(timestamp, block, chainBlocks, { api }) { + return unwrapBalancerToken({ api, balancerToken: "0x950667EF678bAe44Ef037c721E564C365FC8303E", owner: boardroom, }) } -async function tvl(timestamp, block, chainBlocks) { - let balances = {}; - return balances; -} module.exports = { methodology: 'TVL consists of 30DAI-70LSHARE balancer pools that users can lock in the boardroom', bsc: { - tvl: tvl, + tvl: () => ({}), pool2: pool2, //staking: LshareRewardPool has no tokens locked } diff --git a/projects/robovault/index.js b/projects/robovault/index.js index 74f6ec0596f..810f1525cf9 100644 --- a/projects/robovault/index.js +++ b/projects/robovault/index.js @@ -1,24 +1,42 @@ -const axios = require("axios"); - -function fetch(endpoint) { - return async () => { - const vaults = (await axios.get(`https://api.robo-vault.com/${endpoint}`)).data; - return vaults - .filter((p) => p.status.toLowerCase() === 'active') - .map(e => e.tvlUsd).filter(e => e != undefined).reduce((a, b) => a + b, 0); - }; -}; +const sdk = require('@defillama/sdk') module.exports = { + hallmarks: [ + [1674820800, "Vaults Pause"] + ], methodology: 'TVL counts deposits made to the Robo-Vault vaults. Data is pulled from the Robo-Vault API:"https://api.robo-vault.com/vault".', - polygon: { - fetch: fetch('vaults/polygon') +} + +const config = { + avax: { + vaults: [ + '0x7A6fC041274FF996E2761e02F4b3B4b0f16e955A', + '0x49d743E645C90ef4c6D5134533c1e62D08867b14', + '0xca99b7Ad739Da614BFd6aB70d885CEf80538470a', + '0x7fc282B1B6162733084eE3F882624e2BD1ed941E', + ] }, fantom: { - fetch: fetch('vaults/fantom') + vaults: [ + '0x1B6ecdA7Fd559793c0Def1F1D90A2Df4887B9718', + '0xd10112521e860bdE82FD34f88113052e434930C4', + '0x92D2DdF8eed6f2bdB9a7890a00B07a48C9c7A658', + '0x38Da23Ef41333bE0d309Cd63166035FF3b7E2000', + '0x13994411Eda808B354F62db5490B344F431499ae', + '0x81F0f4fDF5148f09aAE811b5995D94F703ED0963', + ] }, - avax:{ - fetch: fetch('vaults/avalanche') - }, - fetch: fetch('vaults'), -}; // node test.js projects/robovault/index.js +} + +Object.keys(config).forEach(chain => { + const { vaults } = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const balances = {} + const bals = await api.multiCall({ abi: 'uint256:totalAssets', calls: vaults }) + const tokens = await api.multiCall({ abi: 'address:token', calls: vaults }) + tokens.forEach((v, i) => sdk.util.sumSingleBalance(balances, v, bals[i], api.chain)) + return balances + } + } +}) \ No newline at end of file diff --git a/projects/rocifi-v2/index.js b/projects/rocifi-v2/index.js new file mode 100644 index 00000000000..5afc21779c5 --- /dev/null +++ b/projects/rocifi-v2/index.js @@ -0,0 +1,64 @@ +const { sumTokens2 } = require("../helper/unwrapLPs"); +const sdk = require('@defillama/sdk') + +const ROCI_COLLATERAL_MANAGER = { + polygon: '0xd85af14C32Cc98Be9Fe5195eDb797773af8bB609', + era: '0x0C10f6BeaF642Fa43bA8375f160F45704c865E65' +} + +const ROCI_SETTINGS_PROVIDER = { + polygon: '0xb2e577a112A6F2C6d3d511ade2AD512cEA312a6d', + era: '0x719b5f658C13C943010718266a22D8F76cbfc8B9' +} + +const ROCI_LIMIT_MANAGER = { + polygon: '0x347892c2c0C230f0803127F4E1137b3e975F57E4', + era: '0xc8531874Dfe8bc6415e06C1C1eD64dbf5dCeEa18' +} + +const limitManagerAbi = 'function poolToBorrowedAmount(address) view returns (uint256)' + +const getPools = async (chain, api) => { + const pools = await api.call({ target: ROCI_SETTINGS_PROVIDER[chain], abi: "address[]:getPools", }); + const underlyings = await api.multiCall({ abi: "address:underlyingToken", calls: pools }) + return { pools, underlyings } +} + +const tvl = (chain) => async (_, __, _1, { api }) => { + const { pools, underlyings } = await getPools(chain, api); + + const collaterals = await api.call({ + target: ROCI_COLLATERAL_MANAGER[chain], + abi: "address[]:getCollaterals", + }); + + const toa = [ + ...pools.map((pool, i) => [underlyings[i], pool]), + ...collaterals.map((collateral) => [collateral, ROCI_COLLATERAL_MANAGER[chain]]), + ]; + + return sumTokens2({ + api, + tokensAndOwners: toa, + }); +} + +const borrowed = (chain) => async (_, __, _1, { api }) => { + const { pools, underlyings } = await getPools(chain, api); + + const balances = {}; + const borrowed = await api.multiCall({ abi: limitManagerAbi, calls: pools, target: ROCI_LIMIT_MANAGER[chain] }) + underlyings.forEach((v, i) => sdk.util.sumSingleBalance(balances, v, borrowed[i], api.chain)) + return balances +} + +module.exports = { + polygon: { + tvl: tvl('polygon'), + borrowed: borrowed('polygon'), + }, + era: { + tvl: tvl('era'), + borrowed: borrowed('era'), + }, +}; diff --git a/projects/rocifiv1/index.js b/projects/rocifiv1/index.js index 3b06ecf126a..053acce371a 100644 --- a/projects/rocifiv1/index.js +++ b/projects/rocifiv1/index.js @@ -1,75 +1,53 @@ -const sdk = require("@defillama/sdk"); +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens2 } = require('../helper/unwrapLPs') -const USDC = "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174"; -const WETH = "0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619" +const USDC = ADDRESSES.polygon.USDC; +const WETH = ADDRESSES.polygon.WETH_1 const ROCI_POOLS = [ - '0x883F10Dc3960493f38F69b8696dC331D22fdEd76', - '0x8bf2B880B48EA3d1b13677f327c5058480b4e1d0', - '0x978F89dE413594378a68CB9C14a83CeC0cEC721b' + '0x883F10Dc3960493f38F69b8696dC331D22fdEd76', + '0x8bf2B880B48EA3d1b13677f327c5058480b4e1d0', + '0x978F89dE413594378a68CB9C14a83CeC0cEC721b' ]; const ROCI_REVENUE_MANAGER = "0x10C9F64289cc5114E8854Cc216aD75a0d19d60b5"; - const ROCI_COLLATERAL_MANAGER = "0x6cb3C5e73b9A6B9E5e9745545a0f40c9724e2337"; -const RociRevenueManagerABI = { - "inputs": [ - { - "internalType": "address", - "name": "_poolAddress", - "type": "address" - } - ], - "name": "balanceAvailable", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" -} - -const poolValueAbi = { "inputs": [], "name": "poolValue", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" } +const RociRevenueManagerABI = 'function balanceAvailable(address _poolAddress) view returns (uint256)' +const poolValueAbi = "uint256:poolValue" -const chain = 'polygon' -async function tvl(timestamp, _, { [chain]: block }) { - return sumTokens2({ - chain, block, tokensAndOwners: [ - [WETH, ROCI_COLLATERAL_MANAGER], - [USDC, ROCI_REVENUE_MANAGER], - ] - }) +async function tvl(timestamp, _, _1, { api }) { + return sumTokens2({ + api, tokensAndOwners: [ + [WETH, ROCI_COLLATERAL_MANAGER], + [USDC, ROCI_REVENUE_MANAGER], + ] + }) } -async function borrowed(timestamp, _, { [chain]: block }) { - const { output: poolValues } = await sdk.api.abi.multiCall({ - abi: poolValueAbi, - calls: ROCI_POOLS.map(i => ({ target: i })), - chain, block, - }) - const { output: balanceAvailable } = await sdk.api.abi.multiCall({ - target: ROCI_REVENUE_MANAGER, - abi: RociRevenueManagerABI, - calls: ROCI_POOLS.map(i => ({ params: i })), - chain, block, - }) - let total = 0 - poolValues.forEach(({ output }) => total += +output) - balanceAvailable.forEach(({ output }) => total -= +output) - return { - 'usd-coin': total / 1e6 - } +async function borrowed(timestamp, _, _1, { api }) { + const poolValues = await api.multiCall({ + abi: poolValueAbi, + calls: ROCI_POOLS, + }) + const balanceAvailable = await api.multiCall({ + target: ROCI_REVENUE_MANAGER, + abi: RociRevenueManagerABI, + calls: ROCI_POOLS, + }) + let total = 0 + poolValues.forEach(output => total += +output) + balanceAvailable.forEach(output => total -= +output) + if (total < 0) total = 0 + return { + ['polygon:'+USDC]: total / 1e6 + } } module.exports = { - polygon: { - tvl, - borrowed, - }, + polygon: { + tvl, + borrowed, + }, }; \ No newline at end of file diff --git a/projects/rocketpool/abi.json b/projects/rocketpool/abi.json index 4dacdef5409..e62ad396395 100644 --- a/projects/rocketpool/abi.json +++ b/projects/rocketpool/abi.json @@ -1,199 +1,13 @@ { - "rocketNodeStaking.getNodeEffectiveRPLStake": { - "inputs": [ - { - "internalType": "address", - "name": "_nodeAddress", - "type": "address" - } - ], - "name": "getNodeEffectiveRPLStake", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "rocketNodeStaking.getTotalRPLStake": { - "inputs": [], - "name": "getTotalRPLStake", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "rocketNetworkBalances.getTotalETHBalance": { - "inputs": [], - "name": "getTotalETHBalance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "rocketMinipoolQueue.getTotalLength": { - "inputs": [], - "name": "getTotalLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "rocketMinipoolQueue.getTotalCapacity": { - "inputs": [], - "name": "getTotalCapacity", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "rocketDepositPool.getBalance": { - "inputs": [], - "name": "getBalance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "rocketMinipoolManager.getMinipoolCountPerStatus": { - "inputs": [ - { - "internalType": "uint256", - "name": "offset", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "limit", - "type": "uint256" - } - ], - "name": "getMinipoolCountPerStatus", - "outputs": [ - { - "internalType": "uint256", - "name": "initialisedCount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "prelaunchCount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "stakingCount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "withdrawableCount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "dissolvedCount", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "rocketMinipoolManager.getActiveMinipoolCount": { - "inputs": [], - "name": "getActiveMinipoolCount", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "rocketMinipoolManager.getStakingMinipoolCount": { - "inputs": [], - "name": "getStakingMinipoolCount", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "rocketVault.balanceOfToken": { - "inputs": [ - { - "internalType": "string", - "name": "_networkContractName", - "type": "string" - }, - { - "internalType": "contract IERC20", - "name": "_tokenAddress", - "type": "address" - } - ], - "name": "balanceOfToken", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "rocketVault.balanceOf": { - "inputs": [ - { - "internalType": "string", - "name": "_networkContractName", - "type": "string" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } + "rocketNodeStaking.getNodeEffectiveRPLStake": "function getNodeEffectiveRPLStake(address _nodeAddress) view returns (uint256)", + "rocketNodeStaking.getTotalRPLStake": "uint256:getTotalRPLStake", + "rocketNetworkBalances.getTotalETHBalance": "uint256:getTotalETHBalance", + "rocketMinipoolQueue.getTotalLength": "uint256:getTotalLength", + "rocketMinipoolQueue.getTotalCapacity": "uint256:getTotalCapacity", + "rocketDepositPool.getBalance": "uint256:getBalance", + "rocketMinipoolManager.getMinipoolCountPerStatus": "function getMinipoolCountPerStatus(uint256 offset, uint256 limit) view returns (uint256 initialisedCount, uint256 prelaunchCount, uint256 stakingCount, uint256 withdrawableCount, uint256 dissolvedCount)", + "rocketMinipoolManager.getActiveMinipoolCount": "uint256:getActiveMinipoolCount", + "rocketMinipoolManager.getStakingMinipoolCount": "uint256:getStakingMinipoolCount", + "rocketVault.balanceOfToken": "function balanceOfToken(string _networkContractName, address _tokenAddress) view returns (uint256)", + "rocketVault.balanceOf": "function balanceOf(string _networkContractName) view returns (uint256)" } \ No newline at end of file diff --git a/projects/rocketpool/index.js b/projects/rocketpool/index.js index 0c1876ee662..fead07a1d65 100644 --- a/projects/rocketpool/index.js +++ b/projects/rocketpool/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk") const abi = require('./abi.json') @@ -5,7 +6,7 @@ const rocketMinipoolManager = '0x6293B8abC1F36aFB22406Be5f96D893072A8cF3a' const rocketVault = '0x3bDC69C4E5e13E52A65f5583c23EFB9636b469d6' const rocketNodeStaking_contract = '0x3019227b2b8493e45Bf5d25302139c9a2713BF15' -const weth = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2' +const weth = ADDRESSES.ethereum.WETH const rpl = '0xd33526068d116ce69f19a9ee46f0bd304f21a51f' async function tvl(timestamp, ethBlock, chainBlocks) { @@ -16,7 +17,7 @@ async function tvl(timestamp, ethBlock, chainBlocks) { let offset = 0 const limit = 400, statusesCount = 5 let minipool_count_per_status = new Array(statusesCount).fill(0); - while (true) { + while (true) { // eslint-disable-line const {output: activeMinipoolCount} = await sdk.api.abi.call({ target: rocketMinipoolManager, params: [offset, limit], diff --git a/projects/rocketswap-cc/index.js b/projects/rocketswap-cc/index.js new file mode 100644 index 00000000000..46868795e8d --- /dev/null +++ b/projects/rocketswap-cc/index.js @@ -0,0 +1,6 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports = { + misrepresentedTokens: true, + base: { tvl: getUniTVL({ factory: '0x1b8128c3a1b7d20053d10763ff02466ca7ff99fc', useDefaultCoreAssets: true, fetchBalances: true, }), }, +} diff --git a/projects/rodeo/abi.json b/projects/rodeo/abi.json new file mode 100644 index 00000000000..7b16ec60643 --- /dev/null +++ b/projects/rodeo/abi.json @@ -0,0 +1,3 @@ +{ + "peekPools": "function peekPools(address[] pools) view returns (uint256[], uint256[], uint256[], uint256[], uint256[], uint256[])" +} \ No newline at end of file diff --git a/projects/rodeo/index.js b/projects/rodeo/index.js new file mode 100644 index 00000000000..a353abdedb7 --- /dev/null +++ b/projects/rodeo/index.js @@ -0,0 +1,26 @@ +const abi = require("./abi.json"); +const { sumTokens2 } = require("../helper/unwrapLPs"); + +const investorHelper = "0x6f456005A7CfBF0228Ca98358f60E6AE1d347E18"; +const pools = [ + "0x0032F5E1520a66C6E572e96A11fBF54aea26f9bE", // usdc-v1 +]; + +async function borrowed(_, _1, _2, { api }) { + const assets = await api.multiCall({ abi: 'address:asset', calls: pools}) + const data = await api.call({ abi: abi.peekPools, target: investorHelper, params: [pools]}) + data[3].forEach((v, i) => api.add(assets[i], v)) +} + +async function tvl(_, _b, _cb, { api, }) { + const assets = await api.multiCall({ abi: 'address:asset', calls: pools}) + return sumTokens2({ api, tokensAndOwners2: [assets, pools]}) +} + +module.exports = { + arbitrum: { tvl, borrowed, }, + methodology: `The TVL shown is the result of subtracting the borrow from the supply for each Rodeo lending pool`, + hallmarks: [ + [Math.floor(new Date('2023-07-11')/1e3), 'Protocol was exploited'], + ], +}; diff --git a/projects/roe/index.js b/projects/roe/index.js new file mode 100644 index 00000000000..dafa9de98f4 --- /dev/null +++ b/projects/roe/index.js @@ -0,0 +1,10 @@ +const { aaveExports } = require("../helper/aave"); + +module.exports = { + ethereum: aaveExports('ethereum', '0x0029B254d039d8C5C88512a44EAa6FF999296009', undefined, + ['0xC68A4F7764f5219f250614d5647258a17A51a6c7']), + polygon: aaveExports('polygon', '0x1ceb99Acd9788bb7d7Ce4a90219cBb0627b008F9', undefined, + ['0xA0132fF55E4ee9818B2F2d769f6Ba5c14Cfe0DA4']), + arbitrum: aaveExports('arbitrum', '0x01b76559D512Fa28aCc03630E8954405BcBB1E02', undefined, + ['0x156a166B58afB948f4c60e1DC6bEdFF55760c319']), +}; \ No newline at end of file diff --git a/projects/rollup-fi/index.js b/projects/rollup-fi/index.js new file mode 100644 index 00000000000..7217c03e839 --- /dev/null +++ b/projects/rollup-fi/index.js @@ -0,0 +1,7 @@ +const { gmxExports } = require('../helper/gmx') + +module.exports = { + era:{ + tvl: gmxExports({ vault: '0xefdE2AeFE307A7362C7E0E3BE019D1491Dc7E163', }) + }, +}; diff --git a/projects/rose-finance/index.js b/projects/rose-finance/index.js new file mode 100644 index 00000000000..bdd7b2ede85 --- /dev/null +++ b/projects/rose-finance/index.js @@ -0,0 +1,28 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport, unknownTombs } = require("../helper/unknownTokens"); + +const token = "0x07D49375A3213eF25aAA47C97A2d23A754bB8f8a"; +const shares = "0xe318140bF0A31EAAf401AD62801b6c7427b36773"; +const shareRewardPool = "0x989128334442946ed6508C45C43758a4e1E14923"; +const boardroom = "0x9d7BBFA16E80A9C4ce9ecf3B706166aEf1477cE1"; +const GenMasterchef = "0x29dA4fF649d39510f633Cd804B860858C333E5aD"; + +const pool2LPs = [ + "0xE368148b5A3771211C96F950B7d4f0C7E5427C1D", // ROSE-ETH + "0x0DB2Efc6c9A93eA22152ef410E3099f0cd67A599" // SHARE-WETH +] + +module.exports = unknownTombs({ + token: [token], + shares: [shares,], + masonry: [boardroom,], + rewardPool: [shareRewardPool,], + chain: 'arbitrum', + lps: pool2LPs, + useDefaultCoreAssets: true, +}) + +module.exports.arbitrum.tvl = sumTokensExport({ + owner: GenMasterchef, + tokens: [ADDRESSES.arbitrum.WETH, ADDRESSES.arbitrum.USDC] +}) diff --git a/projects/rose/abi.json b/projects/rose/abi.json index d84febd0e5f..5df5018200b 100644 --- a/projects/rose/abi.json +++ b/projects/rose/abi.json @@ -1,64 +1,5 @@ { - "balanceOf": { - "inputs": [ - { - "internalType": "contract IERC20", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - - "balances": { - "name": "balances", - "outputs": [ - { - "type": "uint256", - "name": "" - } - ], - "inputs": [ - { - "type": "uint256", - "name": "arg0" - } - ], - "stateMutability": "view", - "type": "function" - }, - - "totalBorrow": { - "inputs": [], - "name": "totalBorrow", - "outputs": [ - { - "internalType": "uint128", - "name": "elastic", - "type": "uint128" - }, - { - "internalType": "uint128", - "name": "base", - "type": "uint128" - } - ], - "stateMutability": "view", - "type": "function" - } -} - + "balanceOf": "function balanceOf(address, address) view returns (uint256)", + "balances": "function balances(uint256 arg0) view returns (uint256)", + "totalBorrow": "function totalBorrow() view returns (uint128 elastic, uint128 base)" +} \ No newline at end of file diff --git a/projects/rose/index.js b/projects/rose/index.js index bb3fb23785a..3f6d920792b 100644 --- a/projects/rose/index.js +++ b/projects/rose/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const { default: BigNumber } = require("bignumber.js"); @@ -13,16 +14,16 @@ const rusdPool = "0x79B0a67a4045A7a8DC04b17456F4fe15339cBA34"; // token addresses const DAI = "0xe3520349F477A5F6EB06107066048508498A291b"; -const USDC = "0xB12BFcA5A55806AaF64E99521918A4bf0fC40802"; -const USDT = "0x4988a896b1227218e4A686fdE5EabdcAbd91571f"; -const FRAX = "0xda2585430fef327ad8ee44af8f1f989a2a91a3d2"; +const USDC = ADDRESSES.aurora.USDC_e; +const USDT = ADDRESSES.aurora.USDT_e; +const FRAX = ADDRESSES.aurora.FRAX; const UST = "0x5ce9F0B6AFb36135b5ddBF11705cEB65E634A9dC"; -const MAI = "0xdFA46478F9e5EA86d57387849598dbFB2e964b02"; +const MAI = ADDRESSES.moonbeam.MAI; // const BUSD = "0x5C92A4A7f59A9484AFD79DbE251AD2380E589783"; const RUSD = "0x19cc40283B057D6608C22F1D20F17e16C245642E"; const ROSE = "0xdcD6D4e2B3e1D1E1E6Fa8C21C8A323DcbecfF970"; const STROSE = "0xe23d2289FBca7De725DC21a13fC096787A85e16F"; -const NEAR = "0xC42C30aC6Cc15faC9bD938618BcaA1a1FaE8501d"; +const NEAR = ADDRESSES.aurora.NEAR; const WETH = "0xC9BdeEd33CD01541e1eeD10f90519d2C06Fe3feB"; const WBTC = "0xf4eb217ba2454613b15dbdea6e5f22276410e89e"; diff --git a/projects/routerprotocol/index.js b/projects/routerprotocol/index.js index d3f0334c40f..c8fafab9c4f 100644 --- a/projects/routerprotocol/index.js +++ b/projects/routerprotocol/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens2, nullAddress, } = require('../helper/unwrapLPs') const NATIVE_ADDRESS = "NATIVE"; @@ -6,83 +7,83 @@ const config = { arbitrum: { contractAddress: "0x6e14f48576265272B6CAA3A7cC500a26050Be64E", tokens: [ - { name: "usd-coin", address: "0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8", decimals: 6 }, - { name: "weth", address: "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1", decimals: 18 }, + { name: "usd-coin", address: ADDRESSES.arbitrum.USDC, decimals: 6 }, + { name: "weth", address: ADDRESSES.arbitrum.WETH, decimals: 18 }, ] }, avax: { contractAddress: "0x6e14f48576265272B6CAA3A7cC500a26050Be64E", tokens: [ - { name: "usd-coin", address: "0xA7D7079b0FEaD91F3e65f86E8915Cb59c1a4C664", decimals: 6 }, + { name: "usd-coin", address: ADDRESSES.avax.USDC_e, decimals: 6 }, { name: "wbnb", address: "0x264c1383EA520f73dd837F915ef3a732e204a493", decimals: 18 }, - { name: "wrapped-avax", address: "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7", decimals: 18 }, - { name: "weth", address: "0x49D5c2BdFfac6CE2BFdB6640F4F80f226bc10bAB", decimals: 18 }, + { name: "wrapped-avax", address: ADDRESSES.avax.WAVAX, decimals: 18 }, + { name: "weth", address: ADDRESSES.avax.WETH_e, decimals: 18 }, ] }, fantom: { contractAddress: "0x6e14f48576265272B6CAA3A7cC500a26050Be64E", tokens: [ - { name: "usd-coin", address: "0x04068DA6C83AFCFA0e13ba15A6696662335D5B75", decimals: 6 }, + { name: "usd-coin", address: ADDRESSES.fantom.USDC, decimals: 6 }, { name: "wmatic", address: "0x40DF1Ae6074C35047BFF66675488Aa2f9f6384F3", decimals: 18 }, { name: "wbnb", address: "0x27f26F00e1605903645BbaBC0a73E35027Dccd45", decimals: 18 }, { name: "wrapped-avax", address: "0x511D35c52a3C244E7b8bd92c0C297755FbD89212", decimals: 18 }, - { name: "wrapped-fantom", address: "0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83", decimals: 18 }, + { name: "wrapped-fantom", address: ADDRESSES.fantom.WFTM, decimals: 18 }, { name: "weth", address: "0x74b23882a30290451A17c44f4F05243b6b58C76d", decimals: 18 }, ] }, optimism: { contractAddress: "0x6e14f48576265272B6CAA3A7cC500a26050Be64E", tokens: [ - { name: "usd-coin", address: "0x7F5c764cBc14f9669B88837ca1490cCa17c31607", decimals: 6 }, - { name: "weth", address: "0x4200000000000000000000000000000000000006", decimals: 18 }, + { name: "usd-coin", address: ADDRESSES.optimism.USDC, decimals: 6 }, + { name: "weth", address: ADDRESSES.tombchain.FTM, decimals: 18 }, ] }, polygon: { contractAddress: "0x6e14f48576265272B6CAA3A7cC500a26050Be64E", tokens: [ - { name: "usd-coin", address: "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174", decimals: 6 }, + { name: "usd-coin", address: ADDRESSES.polygon.USDC, decimals: 6 }, { name: "mimatic", address: "0xa3Fa99A148fA48D14Ed51d610c367C61876997F1", decimals: 18 }, { name: "route", address: "0x16ECCfDbb4eE1A85A33f3A9B21175Cd7Ae753dB4", decimals: 18 }, { name: "wmatic", address: "0x4c28f48448720e9000907bc2611f73022fdce1fa", decimals: 18 }, { name: "dfyn-network", address: "0xC168E40227E4ebD8C1caE80F7a55a4F0e6D66C97", decimals: 18 }, - { name: "wbnb", address: "0x5c4b7CCBF908E64F32e12c6650ec0C96d717f03F", decimals: 18 }, + { name: "wbnb", address: ADDRESSES.polygon.BNB, decimals: 18 }, { name: "wrapped-avax", address: "0x2C89bbc92BD86F8075d1DEcc58C7F4E0107f286b", decimals: 18 }, { name: "wrapped-fantom", address: "0xC9c1c1c20B3658F8787CC2FD702267791f224Ce1", decimals: 18 }, - { name: "weth", address: "0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619", decimals: 18 }, + { name: "weth", address: ADDRESSES.polygon.WETH_1, decimals: 18 }, ] }, bsc: { contractAddress: "0x6e14f48576265272B6CAA3A7cC500a26050Be64E", tokens: [ - { name: "usd-coin", address: "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d", decimals: 18 }, + { name: "usd-coin", address: ADDRESSES.bsc.USDC, decimals: 18 }, { name: "wmatic", address: "0xcc42724c6683b7e57334c4e856f4c9965ed682bd", decimals: 18 }, - { name: "wbnb", address: "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c", decimals: 18 }, + { name: "wbnb", address: ADDRESSES.bsc.WBNB, decimals: 18 }, { name: "binance-peg-avalanche", address: "0x1CE0c2827e2eF14D5C4f29a091d735A204794041", decimals: 18 }, { name: "wrapped-fantom", address: "0xAD29AbB318791D579433D831ed122aFeAf29dcfe", decimals: 18 }, - { name: "weth", address: "0x2170Ed0880ac9A755fd29B2688956BD959F933F8", decimals: 18 }, + { name: "weth", address: ADDRESSES.bsc.ETH, decimals: 18 }, ] }, ethereum: { contractAddress: "0x6e14f48576265272B6CAA3A7cC500a26050Be64E", tokens: [ - { name: "usd-coin", address: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", decimals: 6 }, + { name: "usd-coin", address: ADDRESSES.ethereum.USDC, decimals: 6 }, { name: "route", address: "0x16ECCfDbb4eE1A85A33f3A9B21175Cd7Ae753dB4", decimals: 18 }, - { name: "wmatic", address: "0x7D1AfA7B718fb893dB30A3aBc0Cfc608AaCfeBB0", decimals: 18 }, + { name: "wmatic", address: ADDRESSES.ethereum.MATIC, decimals: 18 }, { name: "dfyn-network", address: "0x9695e0114e12C0d3A3636fAb5A18e6b737529023", decimals: 18 }, - { name: "wbnb", address: "0xB8c77482e45F1F44dE1745F52C74426C631bDD52", decimals: 18 }, + { name: "wbnb", address: ADDRESSES.ethereum.BNB, decimals: 18 }, { name: "avalanche-wormhole", address: "0x85f138bfEE4ef8e540890CFb48F620571d67Eda3", decimals: 18 }, - { name: "fantom", address: "0x4E15361FD6b4BB609Fa63C81A2be19d873717870", decimals: 18 }, - { name: "weth", address: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", decimals: 18 }, + { name: "fantom", address: ADDRESSES.ethereum.FTM, decimals: 18 }, + { name: "weth", address: ADDRESSES.ethereum.WETH, decimals: 18 }, { name: "wrapped-cro", address: "0xA0b73E1Ff0B80914AB6fe0444E65848C4C34450b", decimals: 18 }, ] }, aurora: { contractAddress: "0x6e14f48576265272B6CAA3A7cC500a26050Be64E", tokens: [ - { name: "usd-coin", address: "0xB12BFcA5A55806AaF64E99521918A4bf0fC40802", decimals: 6 }, + { name: "usd-coin", address: ADDRESSES.aurora.USDC_e, decimals: 6 }, { name: "weth", address: "0xC9BdeEd33CD01541e1eeD10f90519d2C06Fe3feB", decimals: 18 }, - { name: "wmatic", address: "0x6aB6d61428fde76768D7b45D8BFeec19c6eF91A8", decimals: 18 }, - { name: "wbnb", address: "0x2bF9b864cdc97b08B6D79ad4663e71B8aB65c45c", decimals: 18 }, + { name: "wmatic", address: ADDRESSES.oasis.USDT, decimals: 18 }, + { name: "wbnb", address: ADDRESSES.syscoin.USDC, decimals: 18 }, { name: "wrapped-avax", address: "0x80A16016cC4A2E6a2CACA8a4a498b1699fF0f844", decimals: 18 }, ], }, @@ -95,19 +96,19 @@ const config = { cronos: { contractAddress: "0x6e14f48576265272B6CAA3A7cC500a26050Be64E", tokens: [ - { name: "usd-coin", address: "0xc21223249CA28397B4B6541dfFaEcC539BfF0c59", decimals: 6 }, + { name: "usd-coin", address: ADDRESSES.cronos.USDC, decimals: 6 }, { name: "wrapped-cro", address: "0x5C7F8A570d578ED84E63fdFA7b1eE72dEae1AE23", decimals: 18 }, { name: "wmatic", address: "0xad79AC3c5a5c15C6B9194F5568e451b3fc3C2B40", decimals: 18 }, - { name: "wbnb", address: "0xfa9343c3897324496a05fc75abed6bac29f8a40f", decimals: 18 }, - { name: "wrapped-avax", address: "0x765277eebeca2e31912c9946eae1021199b39c61", decimals: 18 }, + { name: "wbnb", address: ADDRESSES.telos.ETH, decimals: 18 }, + { name: "wrapped-avax", address: ADDRESSES.shiden.ETH, decimals: 18 }, { name: "weth", address: "0xe44Fd7fCb2b1581822D0c862B68222998a0c299a", decimals: 18 }, - { name: "wrapped-fantom", address: "0xB44a9B6905aF7c801311e8F4E76932ee959c663C", decimals: 18 }, + { name: "wrapped-fantom", address: ADDRESSES.moonriver.USDT, decimals: 18 }, ], }, kava: { contractAddress: "0x6e14f48576265272B6CAA3A7cC500a26050Be64E", tokens: [ - { name: "usd-coin", address: "0xfA9343C3897324496A05fC75abeD6bAC29f8A40f", decimals: 6 }, + { name: "usd-coin", address: ADDRESSES.telos.ETH, decimals: 6 }, ], }, } diff --git a/projects/rubic/index.js b/projects/rubic/index.js index 914356c364d..952db83665a 100644 --- a/projects/rubic/index.js +++ b/projects/rubic/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk'); const solana = require('../helper/solana') const { stakings } = require('../helper/staking'); @@ -22,17 +23,17 @@ const pools = { }; const usdcByChain = { - bsc: '0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d', - ethereum: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', - polygon: '0x2791bca1f2de4661ed88a30c99a7a9449aa84174', - fantom: '0x04068da6c83afcfa0e13ba15a6696662335d5b75', - avax: '0xa7d7079b0fead91f3e65f86e8915cb59c1a4c664', + bsc: ADDRESSES.bsc.USDC, + ethereum: ADDRESSES.ethereum.USDC, + polygon: ADDRESSES.polygon.USDC, + fantom: ADDRESSES.fantom.USDC, + avax: ADDRESSES.avax.USDC_e, harmony: '0x985458e523db3d53125813ed68c274899e9dfab4', - moonriver: '0xe3f5a90f9cb311505cd691a46596599aa1a0ad7d', - arbitrum: '0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8', - aurora: '0xB12BFcA5A55806AaF64E99521918A4bf0fC40802', - solana: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v', - kava: '0xfA9343C3897324496A05fC75abeD6bAC29f8A40f' + moonriver: ADDRESSES.moonriver.USDC, + arbitrum: ADDRESSES.arbitrum.USDC, + aurora: ADDRESSES.aurora.USDC_e, + solana: ADDRESSES.solana.USDC, + kava: ADDRESSES.telos.ETH } function chainTvl(chain) { diff --git a/projects/rubicon/index.js b/projects/rubicon/index.js index 58b64388b96..53b4768732b 100644 --- a/projects/rubicon/index.js +++ b/projects/rubicon/index.js @@ -1,43 +1,47 @@ -const { getBlock } = require('../helper/getBlock') -const {transformOptimismAddress} = require('../helper/portedTokens') -const {sumTokensAndLPsSharedOwners} = require('../helper/unwrapLPs') +const { cachedGraphQuery } = require('../helper/cache') +const { sumTokens2 } = require('../helper/unwrapLPs') -const tokens = [ - "0x7f5c764cbc14f9669b88837ca1490cca17c31607", //USDC - "0x68f180fcce6836688e9084f035309e29bf0a2095", //WBTC - "0xda10009cbd5d07dd0cecc66161fc93d7c9000da1", //DAI - "0x94b008aa00579c1307b0ef2c499ad98a8ce58e58", //USDT - "0x8700daec35af8ff88c16bdf0418774cb3d7599b4", //SNX - "0x4200000000000000000000000000000000000006", //ETH - "0x4200000000000000000000000000000000000042" //OP -] +const RUBICON_MARKET_OPTIMISM = '0x7a512d3609211e719737E82c7bb7271eC05Da70d' +const RUBICON_MARKET_ARBITRUM = '0xC715a30FDe987637A082Cf5F19C74648b67f2db8' -const owners = [ - "0x7a512d3609211e719737E82c7bb7271eC05Da70d", // Rubicon Market - // * Bath Tokens * TODO: drive dynamically off of subgraph query - "0xB0bE5d911E3BD4Ee2A8706cF1fAc8d767A550497", // bathETH - "0x7571CC9895D8E997853B1e0A1521eBd8481aa186", // bathWBTC - "0xe0e112e8f33d3f437D1F895cbb1A456836125952", // bathUSDC - "0x60daEC2Fc9d2e0de0577A5C708BcaDBA1458A833", // bathDAI - "0xfFBD695bf246c514110f5DAe3Fa88B8c2f42c411", // bathUSDT - "0xeb5F29AfaaA3f44eca8559c3e8173003060e919f", // bathSNX - "0x574a21fE5ea9666DbCA804C9d69d8Caf21d5322b" // bathOP -] +module.exports = { + methodology: "Counts the tokens on the market (orders in the orderbook) and in bath pools", + hallmarks: [ + [1657915200, "OP Rewards Start"], + [1685073974, "V2 Upgrade"], + [1688184374, "OP Rewards for Makers"], + [1688616374, "Arbitrum Launch"] + ] +} -async function tvl(time, ethBlock, {optimism: block}){ - const balances={} - const transform = await transformOptimismAddress() - await sumTokensAndLPsSharedOwners(balances, tokens.map(t=>[t, false]), owners, block, "optimism", transform) - return balances +const config = { + optimism: { + endpoint: 'https://api.thegraph.com/subgraphs/name/denverbaumgartner/rubiconmetricsoptimism', + owners: [ + RUBICON_MARKET_OPTIMISM, // Rubicon Market + "0xB0bE5d911E3BD4Ee2A8706cF1fAc8d767A550497", // bathETH + "0x7571CC9895D8E997853B1e0A1521eBd8481aa186", // bathWBTC + "0xe0e112e8f33d3f437D1F895cbb1A456836125952", // bathUSDC + "0x60daEC2Fc9d2e0de0577A5C708BcaDBA1458A833", // bathDAI + "0xfFBD695bf246c514110f5DAe3Fa88B8c2f42c411", // bathUSDT + "0xeb5F29AfaaA3f44eca8559c3e8173003060e919f", // bathSNX + "0x574a21fE5ea9666DbCA804C9d69d8Caf21d5322b" // bathOP + ] + }, + arbitrum: { + endpoint: 'https://api.thegraph.com/subgraphs/name/jossduff/rubiconmetricsarbitrum', + owners: [RUBICON_MARKET_ARBITRUM,] + } } -module.exports={ - methodology: "Counts the tokens on the bath pools and on the market (orders in the orderbook)", - optimism:{ - tvl - }, - hallmarks:[ - [1657915200, "OP Rewards Start"], - ] -} \ No newline at end of file +Object.keys(config).forEach(chain => { + const { endpoint, owners } = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const response = await cachedGraphQuery('rubicon/' + chain, endpoint, `{ tokens { address } }`) + const tokens = response.tokens.map(i => i.address) + return sumTokens2({ api, tokens, owners}) + } + } +}) \ No newline at end of file diff --git a/projects/ruby-exchange-stable/index.js b/projects/ruby-exchange-stable/index.js new file mode 100644 index 00000000000..bba6b7561df --- /dev/null +++ b/projects/ruby-exchange-stable/index.js @@ -0,0 +1,14 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require('../helper/unwrapLPs') +module.exports = { + europa: { tvl: sumTokensExport({ + ownerTokens: [ + [ [ + ADDRESSES.europa.USDP, + ADDRESSES.europa.USDT, + ADDRESSES.europa.USDC, + ADDRESSES.europa.DAI, + ], '0x45c550dc634bcc271c092a20d36761d3bb834e5d'] + ] + })} +} diff --git a/projects/ruby-exchange/index.js b/projects/ruby-exchange/index.js new file mode 100644 index 00000000000..b34df6afa08 --- /dev/null +++ b/projects/ruby-exchange/index.js @@ -0,0 +1,9 @@ + +const { getUniTVL } = require("../helper/unknownTokens"); + +module.exports = { + europa: { tvl: getUniTVL({ + factory: '0x71f7BbbB33550fa5d70CA3F7eeAD87529f2DC3C8', + useDefaultCoreAssets: true, + }),}, +} diff --git a/projects/rubydex/index.js b/projects/rubydex/index.js new file mode 100644 index 00000000000..59164aa6d8b --- /dev/null +++ b/projects/rubydex/index.js @@ -0,0 +1,22 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require('../helper/unwrapLPs'); +const VAULT_ARBITRUM = '0x4a7c10780afdba628332e31c9e7d1675cfad594c'; +const VAULT_BSC = '0xedB6CD4fdd2F465d2234f978276F9Ed2EE02102c'; +const VAULT_ZKSYNC_ERA = '0x211ac72f3ee4a35523B41aA8D67644E1eF860059'; +const VAULT_ETHEREUM = '0x1DE35eB48f92Fb38dee51041AAE86FFf18029E90'; + +module.exports = { + methodology: 'USDT tokens held by the RubyDex Vault contract.', + arbitrum: { + tvl: sumTokensExport({ owner: VAULT_ARBITRUM, tokens: [ADDRESSES.arbitrum.USDT] }), + }, + bsc: { + tvl: sumTokensExport({ owner: VAULT_BSC, tokens: [ADDRESSES.bsc.USDT] }), + }, + era: { + tvl: sumTokensExport({ owner: VAULT_ZKSYNC_ERA, tokens: [ADDRESSES.era.USDT] }), + }, + ethereum: { + tvl: sumTokensExport({ owner: VAULT_ETHEREUM, tokens: [ADDRESSES.ethereum.USDT] }), + }, +}; diff --git a/projects/rubyfinance/index.js b/projects/rubyfinance/index.js index d7ec589bf17..f26ba2153f1 100644 --- a/projects/rubyfinance/index.js +++ b/projects/rubyfinance/index.js @@ -1,10 +1,11 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); const { getFixBalances } = require("../helper/portedTokens"); const { getTokenPrices } = require("../helper/unknownTokens") const { stakingUnknownPricedLP } = require("../helper/staking") -const wkavaAddress = "0xc86c7C0eFbd6A49B35E8714C5f59D99De09A225b"; +const wkavaAddress = ADDRESSES.kava.WKAVA; const rshareTokenAddress = "0x5547F680Ad0104273d0c007073B87f98dEF199c6"; const rshareRewardPoolAddress = "0x63c8069EE16BA666800cECaFd99f4C75ad6dd7Aa"; const genesisPoolAddress = "0x0D6f8847EdB9ea4203241529ee753f6b26920f11"; @@ -88,6 +89,9 @@ async function KavaPool2(timestamp, block, chainBlocks) { } module.exports = { + hallmarks: [ + [1660521600, "incentives not given"] + ], methodology: "Pool2 deposits consist of RUBY/USDC, RUBY/KAVA, RSHARE/KAVA and RUBY/RSHARE LP deposits while the staking TVL consists of the RSHARE tokens locked within the Boardroom contract.", kava: { diff --git a/projects/rugdao/index.js b/projects/rugdao/index.js index 56751521a64..49657a9e06b 100644 --- a/projects/rugdao/index.js +++ b/projects/rugdao/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { ohmTvl } = require('../helper/ohm') const treasury = "0x9e0eE5E4c93e300fF024518d090f98c719504560"; @@ -7,9 +8,9 @@ module.exports = ohmTvl( //MIM ["0x130966628846bfd36ff31a822705796e8cb8c18d", false], //USDT - ["0xc7198437980c041c805a1edcba50c1ce5db95118", false], + [ADDRESSES.avax.USDT_e, false], //USDC - ["0xa7d7079b0fead91f3e65f86e8915cb59c1a4c664", false], + [ADDRESSES.avax.USDC_e, false], // RUG-MIM JLP ["0x8b667C1e422c08f9874709939Bc90E71c2BEA167", true] ], diff --git a/projects/ruler/index.js b/projects/ruler/index.js index 0a6b73c5201..8e3eb361422 100644 --- a/projects/ruler/index.js +++ b/projects/ruler/index.js @@ -1,77 +1,5 @@ -const sdk = require('@defillama/sdk'); -const axios = require('axios') - -const core = "0xF19f4490A7fCCfEf2DaB8199ACDB2Dc1B9027C18" -const xruler = '0x01F7Fd324b366380D2145Dfa6C7A76fdb75f17B9' -const ruler = '0x2aECCB42482cc64E087b6D2e5Da39f5A7A7001f8' -const crv3 = '0x6c3f90f043a72fa612cbac8115ee7e52bde6e490' - -const oldPools = [ - '0x1Daf17e6d1d9ed6aa9Fe9910AE17Be98C2C4e6BA', - '0x52890A0c018fbab21794AD18e15f87fdb57fb975', - '0x910A00594DC16dD699D579A8F7811d465Dfa2752', - '0xf085c77B66cD32182f3573cA2B10762DF3Caaa50', - '0x6Df2B0855060439251fee7eD34952b87b68EeEd9', - '0xaFcc5DADcDcFc4D353Ab2d36fbd57b80513a34e6', - '0x4AcE85cF348F316384A96b4739A1ab58f5123E7a', - '0x23078d5BC3AAD79aEFa8773079EE703168F15cF5', - '0xaF47f0877A9b26FfF12ec8253E07f92F89c6805D', - '0x273AfbF6E257aae160749a61D4b83E06A841c3eB', - '0xfB51e37CebC5D6f1569004206629BB7e47b6843f', - '0xaC63c167955007D5166Fec43255AD5675EfC3102', - '0xE764Fb1f870D621a197951F1A27aaC6d4F930329', - '0xbe735E6dd6c47d86BF8510D3c36Cba1a359B8dDc', - '0x2009f19A8B46642E92Ea19adCdFB23ab05fC20A6', - '0x421CB018b91b4048FaAC1760Cee3B66026B940f2' -] - -const replacements = { - '0x898BAD2774EB97cF6b94605677F43b41871410B1': '0x0000000000000000000000000000000000000000', // vETH2 -> ETH - '0xa921392015eB37c5977c4Fd77E14DD568c59D5F8': '0x4688a8b1F292FDaB17E9a90c8Bc379dC1DBd8713', // xCOVER -> COVER - '0x16f9D564Df80376C61AC914205D3fDfF7057d610': '0x6399C842dD2bE3dE30BF99Bc7D1bBF6Fa3650E70', // xPREMIA -> PREMIA - '0xE14d13d8B3b85aF791b2AADD661cDBd5E6097Db1': '0x0bc529c00C6401aEF6D220BE8C6Ea1667F6Ad93e' // yvYFI -> YFI -} - -async function tvl(timestamp, block) { - const balances = {} - return balances - const data = await axios.get('https://api.rulerprotocol.com/backend_data/production') - const balancesOnCore = await sdk.api.abi.multiCall({ - abi: 'erc20:balanceOf', - block, - calls: data.data.pairs.collaterals.map(token => ({ - target: token, - params: [core] - })) - }) - sdk.util.sumMultiBalanceOf(balances, balancesOnCore) - const poolAddresses = Object.values(data.data.rewards).map(reward => reward.poolAddress).concat(oldPools) - const balancesOnPairs = await sdk.api.abi.multiCall({ - abi: 'erc20:balanceOf', - block, - calls: poolAddresses.map(pool => ({ - target: crv3, - params: [pool] - })) - }) - sdk.util.sumMultiBalanceOf(balances, balancesOnPairs) - const rulerOnXruler = await sdk.api.erc20.balanceOf({ - block, - target: ruler, - owner: xruler - }) - sdk.util.sumSingleBalance(balances, ruler, rulerOnXruler.output) - delete balances[xruler] - Object.keys(balances).forEach(token=>{ - if(replacements[token] !== undefined){ - balances[replacements[token]] = balances[token]; - delete balances[token]; - } - }) - return balances; -} module.exports = { deadFrom: 1648765747, - ethereum: { tvl }, + ethereum: { tvl: () => 0 }, } \ No newline at end of file diff --git a/projects/ryoshi/index.js b/projects/ryoshi/index.js index 0d8a94a5fba..951d7cf81a7 100644 --- a/projects/ryoshi/index.js +++ b/projects/ryoshi/index.js @@ -1,6 +1,7 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { masterchefExports } = require('../helper/unknownTokens') -const wDoge = '0xB7ddC6414bf4F5515b52D8BdD69973Ae205ff101' -const nullAddress = '0x0000000000000000000000000000000000000000' +const wDoge = ADDRESSES.dogechain.WWDOGE +const nullAddress = ADDRESSES.null module.exports = masterchefExports({ @@ -8,72 +9,7 @@ module.exports = masterchefExports({ masterchef: '0x206949295503c4FC5C9757099db479dD5383A5dC', nativeTokens: ['0xa4F9877A08F7639df15D506eAFF92Ab5E78273cd', '0xa98fa09D0BED62A9e0Fb2E58635b7C9274160dc7', ], useDefaultCoreAssets: true, - poolLengthAbi: { - "inputs": [], - "name": "poolCounter", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - poolInfoABI: { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "pools", - "outputs": [ - { - "internalType": "address", - "name": "stakingToken", - "type": "address" - }, - { - "internalType": "address", - "name": "rewardsToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "duration", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "finishAt", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "updatedAt", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "rewardRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "rewardPerTokenStored", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, + poolLengthAbi: "uint256:poolCounter", + poolInfoABI: 'function pools(uint256) view returns (address stakingToken, address rewardsToken, uint256 duration, uint256 finishAt, uint256 updatedAt, uint256 rewardRate, uint256 rewardPerTokenStored, uint256 totalSupply)', getToken: i => i.stakingToken === nullAddress ? wDoge : i.stakingToken, }) \ No newline at end of file diff --git a/projects/rysk/index.js b/projects/rysk/index.js new file mode 100644 index 00000000000..ddf047b693f --- /dev/null +++ b/projects/rysk/index.js @@ -0,0 +1,29 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokens2, } = require('../helper/unwrapLPs') +const sdk = require('@defillama/sdk') + +async function tvl(_, _b, _cb, { api, }) { + const balances = {} + const reactorTvl = await api.multiCall({ + abi: 'uint256:getPoolDenominatedValue', calls: [ + '0x933589C46233Efa8cCDe8287E077cA6CC51Bec17', + '0xDd418b4Ec8396191D08957bD42F549e215B8e89a', + ] + }) + reactorTvl.forEach(i => sdk.util.sumSingleBalance(balances, 'tether', i/1e18)) + + return sumTokens2({ + api, balances, tokensAndOwners: [ + [ADDRESSES.arbitrum.USDC, '0xc10b976c671ce9bff0723611f01422acbae100a5'], // LP alpha + [ADDRESSES.arbitrum.USDC_CIRCLE, '0x217749d9017cB87712654422a1F5856AAA147b80'], // LP beyond USDC native + [ADDRESSES.arbitrum.USDC, '0xb9F33349db1d0711d95c1198AcbA9511B8269626'], // marginPool + [ADDRESSES.arbitrum.USDC_CIRCLE, '0xb9F33349db1d0711d95c1198AcbA9511B8269626'], // marginPool USDC native + [ADDRESSES.arbitrum.WETH, '0xb9F33349db1d0711d95c1198AcbA9511B8269626'], // marginPool + ] + }) +} + +module.exports = { + misrepresentedTokens: true, + arbitrum: { tvl } +} \ No newline at end of file diff --git a/projects/sablier-v2/index.js b/projects/sablier-v2/index.js new file mode 100644 index 00000000000..7f056a6c564 --- /dev/null +++ b/projects/sablier-v2/index.js @@ -0,0 +1,57 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokens2, sumTokensExport } = require('../helper/unwrapLPs') +const { covalentGetTokens } = require('../helper/http') +const { isWhitelistedToken } = require('../helper/streamingHelper') +const { getUniqueAddresses } = require('../helper/utils') +const { cachedGraphQuery } = require('../helper/cache') + +const blacklistedTokens = [ + ADDRESSES.ethereum.sUSD_OLD, + // TODO: We shouldn't need to lowercase here + ADDRESSES.ethereum.SAI.toLowerCase(), + ADDRESSES.ethereum.MKR, +] + +async function getTokensConfig(api, isVesting) { + const ownerTokens = [] + const { endpoints } = config[api.chain] + let i = 0 + for (const endpoint of endpoints) { + i++ + const { contracts, assets } = await cachedGraphQuery('sablier-v2/' + api.chain + '-' + i, endpoint, `{ + contracts { id address category } + assets { id chainId symbol } + }`) + const owners = contracts.map(i => i.address) + let tokens = assets.map(i => i.id) + const symbols = assets.map(i => i.symbol) + tokens = tokens.filter((v, i) => isWhitelistedToken(symbols[i], v, isVesting)) + owners.forEach(owner => ownerTokens.push([tokens, owner])) + } + + return { ownerTokens } +} + +async function tvl(_, block, _1, { api }) { + const { owners } = config[api.chain] + return api.sumTokens(await getTokensConfig(api, false)) +} + +async function vesting(_, block, _1, { api }) { + const { owners } = config[api.chain] + return api.sumTokens(await getTokensConfig(api, true)) +} + +const config = { + ethereum: { endpoints: ['https://api.thegraph.com/subgraphs/name/sablier-labs/sablier-v2'], }, + arbitrum: { endpoints: ['https://api.thegraph.com/subgraphs/name/sablier-labs/sablier-v2-arbitrum'], }, + bsc: { endpoints: ['https://api.thegraph.com/subgraphs/name/sablier-labs/sablier-v2-bsc'], }, + xdai: { endpoints: ['https://api.thegraph.com/subgraphs/name/sablier-labs/sablier-v2-gnosis'], }, + optimism: { endpoints: ['https://api.thegraph.com/subgraphs/name/sablier-labs/sablier-v2-optimism'], }, + polygon: { endpoints: ['https://api.thegraph.com/subgraphs/name/sablier-labs/sablier-v2-polygon'], }, + avax: { endpoints: ['https://api.thegraph.com/subgraphs/name/sablier-labs/sablier-v2-avalanche'], }, +} + +Object.keys(config).forEach(chain => { + module.exports[chain] = { tvl, vesting } +}) \ No newline at end of file diff --git a/projects/sablier/index.js b/projects/sablier/index.js index 8f5f5124e63..c9bf052a0d1 100644 --- a/projects/sablier/index.js +++ b/projects/sablier/index.js @@ -1,37 +1,67 @@ -const { GraphQLClient, gql } = require('graphql-request') -const { sumTokens2 } = require('../helper/unwrapLPs') +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokens2, sumTokensExport } = require('../helper/unwrapLPs') +const { covalentGetTokens } = require('../helper/http') const { isWhitelistedToken } = require('../helper/streamingHelper') - -const sablierAddresses = { - "v1.0.0": "0xA4fc358455Febe425536fd1878bE67FfDBDEC59a", - "v1.1.0": "0xCD18eAa163733Da39c232722cBC4E8940b1D8888", -} +const { getUniqueAddresses } = require('../helper/utils') const blacklistedTokens = [ - '0x57ab1e02fee23774580c119740129eac7081e9d3', // sUSD legacy + ADDRESSES.ethereum.sUSD_OLD, + // TODO: We shouldn't need to lowercase here + ADDRESSES.ethereum.SAI.toLowerCase(), + ADDRESSES.ethereum.MKR, ] -async function getTokens(isVesting) { - const graphQLClient = new GraphQLClient('https://api.thegraph.com/subgraphs/name/sablierhq/sablier') - var query = gql`{tokens (first: 1000) { id name symbol }}` - const results = await graphQLClient.request(query) - return results.tokens.filter(i => isWhitelistedToken(i.symbol, i.id, isVesting)).map(i => i.id) +async function getTokens(api, owners, isVesting) { + let tokens = (await Promise.all(owners.map(i => covalentGetTokens(i, api.chain)))).flat().filter(i => !blacklistedTokens.includes(i)) + tokens = getUniqueAddresses(tokens) + const symbols = await api.multiCall({ abi: 'erc20:symbol', calls: tokens }) + return tokens.filter((v, i) => isWhitelistedToken(symbols[i], v, isVesting)) } -async function tvl(_, block) { - const tokens = await getTokens(false) - return sumTokens2({ block, owners: Object.values(sablierAddresses), tokens: tokens, blacklistedTokens, }) +async function tvl(_, block, _1, { api }) { + const { owners } = config[api.chain] + const tokens = await getTokens(api, owners, false) + return sumTokens2({ api, owners, tokens, blacklistedTokens, }) } -async function vesting(_, block) { - const tokens = await getTokens(true) - return sumTokens2({ block, owners: Object.values(sablierAddresses), tokens: tokens, blacklistedTokens, }) +async function vesting(_, block, _1, { api }) { + const { owners } = config[api.chain] + const tokens = await getTokens(api, owners, true) + return sumTokens2({ api, owners, tokens, blacklistedTokens, }) } module.exports = { hallmarks: [ - [Math.floor(new Date('2022-10-03')/1e3), 'Vesting tokens are not included in tvl'], + [Math.floor(new Date('2022-10-03') / 1e3), 'Vesting tokens are not included in tvl'], ], start: 1573582731, - ethereum: { tvl, vesting, } -}; \ No newline at end of file + timetravel: false, + ronin: { + tvl: sumTokensExport({ + owner: '0xDe9dCc27aa1552d591Fc9B9c21881feE43BD8118', + tokens: [ + ADDRESSES.ronin.USDC, + ADDRESSES.ronin.WETH, + ADDRESSES.ronin.AXS, + ] + }) + } +}; + +const config = { + ethereum: { + owners: [ + "0xA4fc358455Febe425536fd1878bE67FfDBDEC59a", // v1.0.0 + "0xCD18eAa163733Da39c232722cBC4E8940b1D8888", // v1.1.0 + ] + }, + arbitrum: { owners: ['0xaDB944B478818d95659067E70D2e5Fc43Fa3eDe9'], }, + avax: { owners: ['0x73f503fad13203C87889c3D5c567550b2d41D7a4'], }, + bsc: { owners: ['0x05BC7f5fb7F248d44d38703e5C921A8c16825161'], }, + optimism: { owners: ['0x6C5927c0679e6d857E87367bb635decbcB20F31c'], }, + polygon: { owners: ['0xAC18EAB6592F5fF6F9aCf5E0DCE0Df8E49124C06'], }, +} + +Object.keys(config).forEach(chain => { + module.exports[chain] = { tvl, vesting } +}) \ No newline at end of file diff --git a/projects/saddle/config.json b/projects/saddle/config.json deleted file mode 100644 index 00ad8622624..00000000000 --- a/projects/saddle/config.json +++ /dev/null @@ -1,852 +0,0 @@ -{ - "ethereum": { - "BTC": { - "address": "0x4f6A43Ad7cba042606dECaCA730d4CE0A57ac62e", - "lpToken": "0xC28DF698475dEC994BE00C9C9D8658A548e6304F", - "poolTokens": [ - { - "address": "0x8daebade922df735c38c80c7ebd708af50815faa", - "name": "tBTC" - }, - { - "address": "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599", - "name": "WBTC" - }, - { - "address": "0xeb4c2781e4eba804ce9a9803c67d0893436bb27d", - "name": "renBTC" - }, - { - "address": "0xfe18be6b3bd88a2d2a7f928d00292e7a9963cfc6", - "name": "sBTC" - } - ] - }, - "BTC V2": { - "address": "0xdf3309771d2BF82cb2B6C56F9f5365C8bD97c4f2", - "lpToken": "0xF32E91464ca18fc156aB97a697D6f8ae66Cd21a3", - "poolTokens": [ - { - "address": "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599", - "name": "WBTC" - }, - { - "address": "0xeb4c2781e4eba804ce9a9803c67d0893436bb27d", - "name": "renBTC" - }, - { - "address": "0xfe18be6b3bd88a2d2a7f928d00292e7a9963cfc6", - "name": "sBTC" - } - ] - }, - "Frax 3Pool": { - "address": "0x8cAEa59f3Bf1F341f89c51607E4919841131e47a", - "lpToken": "0x0785aDDf5F7334aDB7ec40cD785EBF39bfD91520", - "poolTokens": [ - { - "address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", - "name": "USDC Coin" - }, - { - "address": "0xdac17f958d2ee523a2206206994597c13d831ec7", - "name": "Tether" - }, - { - "address": "0x853d955aCEf822Db058eb8505911ED77F175b99e", - "name": "Frax" - } - ] - }, - "USD": { - "address": "0x3911F80530595fBd01Ab1516Ab61255d75AEb066", - "lpToken": "0x76204f8CFE8B95191A3d1CfA59E267EA65e06FAC", - "poolTokens": [ - { - "address": "0x6B175474E89094C44Da98b954EedeAC495271d0F", - "name": "Dai" - }, - { - "address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", - "name": "USDC Coin" - }, - { - "address": "0xdac17f958d2ee523a2206206994597c13d831ec7", - "name": "Tether" - } - ] - }, - "USDv2": { - "address": "0xaCb83E0633d6605c5001e2Ab59EF3C745547C8C7", - "lpToken": "0x5f86558387293b6009d7896A61fcc86C17808D62", - "poolTokens": [ - { - "address": "0x6B175474E89094C44Da98b954EedeAC495271d0F", - "name": "Dai" - }, - { - "address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", - "name": "USDC Coin" - }, - { - "address": "0xdac17f958d2ee523a2206206994597c13d831ec7", - "name": "Tether" - } - ] - }, - "vETH2": { - "address": "0xdec2157831D6ABC3Ec328291119cc91B337272b5", - "lpToken": "0xe37E2a01feA778BC1717d72Bd9f018B6A6B241D5", - "poolTokens": [ - { - "address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", - "name": "WETH" - }, - { - "address": "0x898BAD2774EB97cF6b94605677F43b41871410B1", - "name": "vETH2" - } - ] - }, - "alETH": { - "address": "0xa6018520EAACC06C30fF2e1B3ee2c7c22e64196a", - "lpToken": "0xc9da65931ABf0Ed1b74Ce5ad8c041C4220940368", - "poolTokens": [ - { - "address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", - "name": "WETH" - }, - { - "address": "0x0100546F2cD4C9D97f798fFC9755E47865FF7Ee6", - "name": "Alchemix ETH" - }, - { - "address": "0x5e74C9036fb86BD7eCdcb084a0673EFc32eA31cb", - "name": "Synth sETH" - } - ] - }, - "D4": { - "address": "0xC69DDcd4DFeF25D8a793241834d4cc4b3668EAD6", - "lpToken": "0xd48cF4D7FB0824CC8bAe055dF3092584d0a1726A", - "poolTokens": [ - { - "address": "0xBC6DA0FE9aD5f3b0d58160288917AA56653660E9", - "name": "Alchemix USD" - }, - { - "address": "0x956F47F50A910163D8BF957Cf5846D573E7f87CA", - "name": "Fei Protocol" - }, - { - "address": "0x853d955aCEf822Db058eb8505911ED77F175b99e", - "name": "Frax" - }, - { - "address": "0x5f98805A4E8be255a32880FDeC7F6728C6568bA0", - "name": "Liquity USD" - } - ] - }, - "sUSD Meta V2": { - "address": "0x824dcD7b044D60df2e89B1bB888e66D8BCf41491", - "lpToken": "0xb6214a9d18f5Bf34A23a355114A03bE4f7D804fa", - "poolTokens": [ - { - "address": "0x57Ab1ec28D129707052df4dF418D58a2D46d5f51", - "name": "sUSD" - }, - { - "address": "0x6B175474E89094C44Da98b954EedeAC495271d0F", - "name": "Dai" - }, - { - "address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", - "name": "USDC Coin" - }, - { - "address": "0xdac17f958d2ee523a2206206994597c13d831ec7", - "name": "Tether" - } - ] - }, - "sUSD Meta": { - "address": "0x0C8BAe14c9f9BF2c953997C881BEfaC7729FD314", - "lpToken": "0x8Fa31c1b33De16bf05c38AF20329f22D544aD64c", - "poolTokens": [ - { - "address": "0x57Ab1ec28D129707052df4dF418D58a2D46d5f51", - "name": "sUSD" - }, - { - "address": "0x6B175474E89094C44Da98b954EedeAC495271d0F", - "name": "Dai" - }, - { - "address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", - "name": "USDC Coin" - }, - { - "address": "0xdac17f958d2ee523a2206206994597c13d831ec7", - "name": "Tether" - } - ] - }, - "tBTC Meta": { - "address": "0xf74ebe6e5586275dc4CeD78F5DBEF31B1EfbE7a5", - "lpToken": "0x122Eca07139EB368245A29FB702c9ff11E9693B7", - "poolTokens": [ - { - "address": "0x18084fba666a33d37592fa2633fd49a74dd93a88", - "name": "tBTCv2" - }, - { - "address": "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599", - "name": "WBTC" - }, - { - "address": "0xeb4c2781e4eba804ce9a9803c67d0893436bb27d", - "name": "renBTC" - }, - { - "address": "0xfe18be6b3bd88a2d2a7f928d00292e7a9963cfc6", - "name": "sBTC" - } - ] - }, - "tBTC Meta V2": { - "address": "0xA0b4a2667dD60d5CdD7EcFF1084F0CeB8dD84326", - "lpToken": "0x3f2f811605bC6D701c3Ad6E501be13461c560320", - "poolTokens": [ - { - "address": "0x18084fba666a33d37592fa2633fd49a74dd93a88", - "name": "tBTCv2" - }, - { - "address": "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599", - "name": "WBTC" - }, - { - "address": "0xeb4c2781e4eba804ce9a9803c67d0893436bb27d", - "name": "renBTC" - }, - { - "address": "0xfe18be6b3bd88a2d2a7f928d00292e7a9963cfc6", - "name": "sBTC" - } - ] - }, - "wCUSD Meta": { - "address": "0x3F1d224557afA4365155ea77cE4BC32D5Dae2174", - "lpToken": "0x78179d49C13c4ECa14C69545ec172Ba0179EAE6B", - "poolTokens": [ - { - "address": "0xad3e3fc59dff318beceaab7d00eb4f68b1ecf195", - "name": "Wrapped Celo USD" - }, - { - "address": "0x6B175474E89094C44Da98b954EedeAC495271d0F", - "name": "Dai" - }, - { - "address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", - "name": "USDC Coin" - }, - { - "address": "0xdac17f958d2ee523a2206206994597c13d831ec7", - "name": "Tether" - } - ] - }, - "wCUSD Meta V2": { - "address": "0xc02D481B52Ae04Ebc76a8882441cfAED45eb8342", - "lpToken": "0x5F7872490a9B405946376dd40fCbDeF521F13e3f", - "poolTokens": [ - { - "address": "0xad3e3fc59dff318beceaab7d00eb4f68b1ecf195", - "name": "Wrapped Celo USD" - }, - { - "address": "0x6B175474E89094C44Da98b954EedeAC495271d0F", - "name": "Dai" - }, - { - "address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", - "name": "USDC Coin" - }, - { - "address": "0xdac17f958d2ee523a2206206994597c13d831ec7", - "name": "Tether" - } - ] - }, - "tBTCv2-BTCv2_v3": { - "address": "0xfa9ED0309Bf79Eb84C847819F0B3CB84F6d351Af", - "lpToken": "0xA2E81Eb93F0F9814ae9A3bea2D2A63408f2709C1", - "poolTokens": [ - { - "address": "0x18084fba666a33d37592fa2633fd49a74dd93a88", - "name": "tBTCv2" - }, - { - "address": "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599", - "name": "WBTC" - }, - { - "address": "0xeb4c2781e4eba804ce9a9803c67d0893436bb27d", - "name": "renBTC" - }, - { - "address": "0xfe18be6b3bd88a2d2a7f928d00292e7a9963cfc6", - "name": "sBTC" - } - ] - }, - "wcUSD-USDv2_v3": { - "address": "0xB62222B941e9B652BE3632EEa062cb0ff66b1d1c", - "lpToken": "0x0dB8b09c13FE21913faF463274cE8e0a51719f16", - "poolTokens": [ - { - "address": "0xad3e3fc59dff318beceaab7d00eb4f68b1ecf195", - "name": "Wrapped Celo USD" - }, - { - "address": "0x6B175474E89094C44Da98b954EedeAC495271d0F", - "name": "Dai" - }, - { - "address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", - "name": "USDC Coin" - }, - { - "address": "0xdac17f958d2ee523a2206206994597c13d831ec7", - "name": "Tether" - } - ] - }, - "sUSD-USDv2_v3": { - "address": "0x4568727f50c7246ded8C39214Ed6FF3c157f080D", - "lpToken": "0x444F94460a641429CDa4e38E02E51642Cc38276A", - "poolTokens": [ - { - "address": "0x57Ab1ec28D129707052df4dF418D58a2D46d5f51", - "name": "sUSD" - }, - { - "address": "0x6B175474E89094C44Da98b954EedeAC495271d0F", - "name": "Dai" - }, - { - "address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", - "name": "USDC Coin" - }, - { - "address": "0xdac17f958d2ee523a2206206994597c13d831ec7", - "name": "Tether" - } - ] - }, - "FRAX-USDC-BP": { - "address": "0x13Cc34Aa8037f722405285AD2C82FE570bfa2bdc", - "lpToken": "0x927E6f04609A45B107C789aF34BA90Ebbf479f7f", - "poolTokens": [ - { - "address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", - "name": "USDC Coin" - }, - { - "address": "0x853d955aCEf822Db058eb8505911ED77F175b99e", - "name": "Frax" - } - ] - }, - "FRAXBP-USDT": { - "address": "0xC765Cd3d015626244AD63B5FB63a97c5634643b9", - "lpToken": "0x486DFCfdbF9025c062110E8c0344a15279aD0a85", - "poolTokens": [ - { - "address": "0xdac17f958d2ee523a2206206994597c13d831ec7", - "name": "Tether" - }, - { - "address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", - "name": "USDC Coin" - }, - { - "address": "0x853d955aCEf822Db058eb8505911ED77F175b99e", - "name": "Frax" - } - ] - }, - "FRAXBP-SUSD": { - "address": "0x69baA0d7c2e864b74173922Ca069Ac79d3be1556", - "lpToken": "0x6Ac7a4cB3BFa90DC651CD53EB098e23c88d04e77", - "poolTokens": [ - { - "address": "0x57Ab1ec28D129707052df4dF418D58a2D46d5f51", - "name": "sUSD" - }, - { - "address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", - "name": "USDC Coin" - }, - { - "address": "0x853d955aCEf822Db058eb8505911ED77F175b99e", - "name": "Frax" - } - ] - }, - "FRAXBP-alUSD": { - "address": "0xFB516cF3710fC6901F2266aAEB8834cF5e4E9558", - "lpToken": "0x3cF7b9479a01eeB3bbfC43581fa3bb21cd888e2A", - "poolTokens": [ - { - "address": "0xBC6DA0FE9aD5f3b0d58160288917AA56653660E9", - "name": "Alchemix USD" - }, - { - "address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", - "name": "USDC Coin" - }, - { - "address": "0x853d955aCEf822Db058eb8505911ED77F175b99e", - "name": "Frax" - } - ] - }, - "USDC-USX": { - "address": "0x2bFf1B48CC01284416E681B099a0CDDCA0231d72", - "lpToken": "0x1AE28a6ACA177c29b5773e91fbf74AfB0B7fE5C9", - "poolTokens": [ - { - "address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", - "name": "USDC Coin" - }, - { - "address": "0x0a5e677a6a24b2f1a2bf4f3bffc443231d2fdec8", - "name": "dForce USD" - } - ] - } - }, - "arbitrum": { - "arbUSD": { - "address": "0xBea9F78090bDB9e662d8CB301A00ad09A5b756e9", - "lpToken": "0xc969dD0A7AB0F8a0C5A69C0839dB39b6C928bC08", - "poolTokens": [ - { - "address": "0x2913e812cf0dcca30fb28e6cac3d2dcff4497688", - "name": "nUSD" - }, - { - "address": "0xfea7a6a0b346362bf88a9e4a88416b77a57d6c2a", - "name": "Magic Internet Money" - }, - { - "address": "0xff970a61a04b1ca14834a43f5de4533ebddb5cc8", - "name": "USDC Coin" - }, - { - "address": "0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9", - "name": "Tether" - } - ] - }, - "usds-arbUSDV2 Meta": { - "address": "0x5dD186f8809147F96D3ffC4508F3C82694E58c9c", - "lpToken": "0xa815b134294580692482E321dD1A191aC1454192", - "poolTokens": [ - { - "address": "0xd74f5255d557944cf7dd0e45ff521520002d5748", - "name": "USDs" - }, - { - "address": "0x17fc002b466eec40dae837fc4be5c67993ddbd6f", - "name": "Frax" - }, - { - "address": "0xff970a61a04b1ca14834a43f5de4533ebddb5cc8", - "name": "USDC Coin" - }, - { - "address": "0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9", - "name": "Tether" - } - ] - }, - "arbUSDV2": { - "address": "0xfeEa4D1BacB0519E8f952460A70719944fe56Ee0", - "lpToken": "0x0a20c2FFa10cD43F67D06170422505b7D6fC0953", - "poolTokens": [ - { - "address": "0x17fc002b466eec40dae837fc4be5c67993ddbd6f", - "name": "Frax" - }, - { - "address": "0xff970a61a04b1ca14834a43f5de4533ebddb5cc8", - "name": "USDC Coin" - }, - { - "address": "0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9", - "name": "Tether" - } - ] - }, - "FRAX-USDC-BP": { - "address": "0x401AFbc31ad2A3Bc0eD8960d63eFcDEA749b4849", - "lpToken": "0x896935B02D3cBEb152192774e4F1991bb1D2ED3f", - "poolTokens": [ - { - "address": "0xff970a61a04b1ca14834a43f5de4533ebddb5cc8", - "name": "USDC Coin" - }, - { - "address": "0x17fc002b466eec40dae837fc4be5c67993ddbd6f", - "name": "Frax" - } - ] - }, - "FRAXBP-USDT": { - "address": "0xf8504e92428d65E56e495684A38f679C1B1DC30b", - "lpToken": "0x166680852ae9Dec3d63374c5eBf89E974448BFE9", - "poolTokens": [ - { - "address": "0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9", - "name": "Tether" - }, - { - "address": "0xff970a61a04b1ca14834a43f5de4533ebddb5cc8", - "name": "USDC Coin" - }, - { - "address": "0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9", - "name": "Tether" - } - ] - }, - "arbFRAXBP-USDs": { - "address": "0xa5bD85ed9fA27ba23BfB702989e7218E44fd4706", - "lpToken": "0x1e491122f3C096392b40a4EA27aa1a29360d38a1", - "poolTokens": [ - { - "address": "0xd74f5255d557944cf7dd0e45ff521520002d5748", - "name": "USDs" - }, - { - "address": "0xff970a61a04b1ca14834a43f5de4533ebddb5cc8", - "name": "USDC Coin" - }, - { - "address": "0x17fc002b466eec40dae837fc4be5c67993ddbd6f", - "name": "Frax" - } - ] - }, - "arbFRAXBP-USX": { - "address": "0xb2a2764D0DCAB445E24f4b813bE3f6ef8AE5f84D", - "lpToken": "0x721DaC7d5ACc8Aa62946fd583C1F999e1570b97D", - "poolTokens": [ - { - "address": "0x641441c631e2F909700d2f41FD87F0aA6A6b4EDb", - "name": "dForce USD" - }, - { - "address": "0xff970a61a04b1ca14834a43f5de4533ebddb5cc8", - "name": "USDC Coin" - }, - { - "address": "0x17fc002b466eec40dae837fc4be5c67993ddbd6f", - "name": "Frax" - } - ] - } - }, - "fantom": { - "ftmUSD": { - "address": "0xBea9F78090bDB9e662d8CB301A00ad09A5b756e9", - "lpToken": "0xc969dD0A7AB0F8a0C5A69C0839dB39b6C928bC08", - "poolTokens": [ - { - "address": "0xdc301622e621166bd8e82f2ca0a26c13ad0be355", - "name": "Frax" - }, - { - "address": "0x04068da6c83afcfa0e13ba15a6696662335d5b75", - "name": "USDC Coin" - } - ] - }, - "ftmFRAXBP-USDT": { - "address": "0xdb5c5A6162115Ce9a188E7D773C4D011F421BbE5", - "lpToken": "0x21EA072844fd4aBEd72539750c054E009D877f72", - "poolTokens": [ - { - "address": "0x049d68029688eAbF473097a2fC38ef61633A3C7A", - "name": "Tether" - }, - { - "address": "0xdc301622e621166bd8e82f2ca0a26c13ad0be355", - "name": "Frax" - }, - { - "address": "0x04068da6c83afcfa0e13ba15a6696662335d5b75", - "name": "USDC Coin" - } - ] - }, - "ftmFRAXBP-alUSD": { - "address": "0x4E1484607760118ebE2Ab07C0c71f1B4D9671e01", - "lpToken": "0xd7D1b50c8ef77d9aB410723f81363C8B252C729F", - "poolTokens": [ - { - "address": "0xB67FA6deFCe4042070Eb1ae1511Dcd6dcc6a532E", - "name": "Alchemix USD" - }, - { - "address": "0xdc301622e621166bd8e82f2ca0a26c13ad0be355", - "name": "Frax" - }, - { - "address": "0x04068da6c83afcfa0e13ba15a6696662335d5b75", - "name": "USDC Coin" - } - ] - } - }, - "evmos": { - "Evmos BTC": { - "address": "0x7003102c75587E8D29c56124060463Ef319407D0", - "lpToken": "0xa6018520EAACC06C30fF2e1B3ee2c7c22e64196a", - "poolTokens": [ - { - "address": "0xF80699Dc594e00aE7bA200c7533a07C1604A106D", - "name": "WBTC" - }, - { - "address": "0xb1a8C961385B01C3aA782fba73E151465445D319", - "name": "renBTC" - } - ] - }, - "Evmos 4Pool": { - "address": "0x81272C5c573919eF0C719D6d63317a4629F161da", - "lpToken": "0x9A34c72Bb85f0Da63578aC18047325E2a246f273", - "poolTokens": [ - { - "address": "0x63743ACF2c7cfee65A5E356A4C4A005b586fC7AA", - "name": "madDAI" - }, - { - "address": "0x51e44FfaD5C2B122C8b635671FCC8139dc636E82", - "name": "madUSDC Coin" - }, - { - "address": "0x7FF4a56B32ee13D7D4D405887E0eA37d61Ed919e", - "name": "madTether" - }, - { - "address": "0xE03494D0033687543a80c9B1ca7D6237F2EA8BD8", - "name": "Frax" - } - ] - }, - "Evmos Frax 3Pool": { - "address": "0x21d4365834B7c61447e142ef6bCf01136cBD01c6", - "lpToken": "0x2801fE8f9DE3a4aD6098a5B95d5165676bb01f82", - "poolTokens": [ - { - "address": "0x51e44FfaD5C2B122C8b635671FCC8139dc636E82", - "name": "madUSDC Coin" - }, - { - "address": "0x7FF4a56B32ee13D7D4D405887E0eA37d61Ed919e", - "name": "madTether" - }, - { - "address": "0xE03494D0033687543a80c9B1ca7D6237F2EA8BD8", - "name": "Frax" - } - ] - }, - "evmosUSD": { - "address": "0x1275203FB58Fc25bC6963B13C2a1ED1541563aF0", - "lpToken": "0x9c673F50CEe126FcC9F7378Ed46c33f5DEDEc0fC", - "poolTokens": [ - { - "address": "0x63743ACF2c7cfee65A5E356A4C4A005b586fC7AA", - "name": "Dai" - }, - { - "address": "0x51e44FfaD5C2B122C8b635671FCC8139dc636E82", - "name": "USDC Coin" - }, - { - "address": "0x7FF4a56B32ee13D7D4D405887E0eA37d61Ed919e", - "name": "Tether" - } - ] - }, - "tbtc-evmosBTC Meta": { - "address": "0xdb5c5A6162115Ce9a188E7D773C4D011F421BbE5", - "lpToken": "0x21EA072844fd4aBEd72539750c054E009D877f72", - "poolTokens": [ - { - "address": "0x8d395AfFC1767141387ffF45aF88a074614E7Ccf", - "name": "tBTCv2" - }, - { - "address": "0xF80699Dc594e00aE7bA200c7533a07C1604A106D", - "name": "WBTC" - }, - { - "address": "0xb1a8C961385B01C3aA782fba73E151465445D319", - "name": "renBTC" - } - ] - } - }, - "optimism": { - "optUSD": { - "address": "0x5847f8177221268d279Cf377D0E01aB3FD993628", - "lpToken": "0xcCf860874cbF2d615192a4C4455580B4d622D3B9", - "poolTokens": [ - { - "address": "0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1", - "name": "Dai" - }, - { - "address": "0x7F5c764cBc14f9669B88837ca1490cCa17c31607", - "name": "USDC Coin" - }, - { - "address": "0x94b008aA00579c1307B0EF2c499aD98a8ce58e58", - "name": "Tether" - } - ] - }, - "frax-optUSD": { - "address": "0xc55E8C79e5A6c3216D4023769559D06fa9A7732e", - "lpToken": "0xfF5fa61Eb9b5cDD63bdFa16EF029d5313457925A", - "poolTokens": [ - { - "address": "0x2E3D870790dC77A83DD1d18184Acc7439A53f475", - "name": "Frax" - }, - { - "address": "0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1", - "name": "Dai" - }, - { - "address": "0x7F5c764cBc14f9669B88837ca1490cCa17c31607", - "name": "USDC Coin" - }, - { - "address": "0x94b008aA00579c1307B0EF2c499aD98a8ce58e58", - "name": "Tether" - } - ] - }, - "FRAX-USDC-BP": { - "address": "0xF6C2e0aDc659007Ba7c48446F5A4e4E94dfe08b5", - "lpToken": "0xf74ebe6e5586275dc4CeD78F5DBEF31B1EfbE7a5", - "poolTokens": [ - { - "address": "0x7F5c764cBc14f9669B88837ca1490cCa17c31607", - "name": "USDC Coin" - }, - { - "address": "0x2E3D870790dC77A83DD1d18184Acc7439A53f475", - "name": "Frax" - } - ] - }, - "FRAXBP-USDT": { - "address": "0xa9a84238098Dc3d1529228E6c74dBE7EbdF117a5", - "lpToken": "0xb63d7B0D835ca6eFf89ab774498ed6dD0D71e93e", - "poolTokens": [ - { - "address": "0x94b008aA00579c1307B0EF2c499aD98a8ce58e58", - "name": "Tether" - }, - { - "address": "0x7F5c764cBc14f9669B88837ca1490cCa17c31607", - "name": "USDC Coin" - }, - { - "address": "0x2E3D870790dC77A83DD1d18184Acc7439A53f475", - "name": "Frax" - } - ] - }, - "FRAXBP-SUSD": { - "address": "0x250184dDDEC6d38E28ac12B481c9016867226E9D", - "lpToken": "0x205c9B8c1fCa803B779b1eB4B887Aa0E00FE629F", - "poolTokens": [ - { - "address": "0x8c6f28f2F1A3C87F0f938b96d27520d9751ec8d9", - "name": "sUSD" - }, - { - "address": "0x7F5c764cBc14f9669B88837ca1490cCa17c31607", - "name": "USDC Coin" - }, - { - "address": "0x2E3D870790dC77A83DD1d18184Acc7439A53f475", - "name": "Frax" - } - ] - }, - "FRAXBP-USX": { - "address": "0xe184F7E575a5Beb8f2409E8e2218Cd770ddDa2A6", - "lpToken": "0xf349fB2b5eD45864e1d9ad34a483Eb37aC6e0034", - "poolTokens": [ - { - "address": "0xbfD291DA8A403DAAF7e5E9DC1ec0aCEaCd4848B9", - "name": "dForce USD" - }, - { - "address": "0x7F5c764cBc14f9669B88837ca1490cCa17c31607", - "name": "USDC Coin" - }, - { - "address": "0x2E3D870790dC77A83DD1d18184Acc7439A53f475", - "name": "Frax" - } - ] - } - }, - "kava": { - "3pool": { - "address": "0xA500b0e1360462eF777804BCAe6CE2BfB524dD2e", - "lpToken": "0x619535e015f0e46c5984a0B45FD71C0549F001Fc", - "poolTokens": [ - { - "address": "0xfA9343C3897324496A05fC75abeD6bAC29f8A40f", - "name": "USDC Coin" - }, - { - "address": "0xB44a9B6905aF7c801311e8F4E76932ee959c663C", - "name": "Tether" - }, - { - "address": "0x765277EebeCA2e31912C9946eAe1021199B39C61", - "name": "Dai" - } - ] - }, - "USDC-USDT": { - "address": "0x5847f8177221268d279Cf377D0E01aB3FD993628", - "lpToken": "0xcCf860874cbF2d615192a4C4455580B4d622D3B9", - "poolTokens": [ - { - "address": "0xfA9343C3897324496A05fC75abeD6bAC29f8A40f", - "name": "USDC Coin" - }, - { - "address": "0xB44a9B6905aF7c801311e8F4E76932ee959c663C", - "name": "Tether" - } - ] - } - } -} diff --git a/projects/saddle/contracts.json b/projects/saddle/contracts.json new file mode 100644 index 00000000000..c90c85bb98e --- /dev/null +++ b/projects/saddle/contracts.json @@ -0,0 +1,9 @@ +{ + "ethereum": "0xc5ad17b98D7fe73B6dD3b0df5b3040457E68C045", + "arbitrum": "0xaB94A2c0D8F044AA439A5654f06b5797928396cF", + "fantom": "0x7003102c75587E8D29c56124060463Ef319407D0", + "evmos": "0xBa684B8E05415726Ee1fFE197eaf1b82E4d44418", + "optimism": "0x0E510c9b20a5D136E75f7FD2a5F344BD98f9d875", + "kava": "0x3A0c2A793a8DB779e0293699D0Ce77c77617FE0f", + "aurora": "0x29FD31d37AB8D27f11EAB68F96424bf64231fFce" +} diff --git a/projects/saddle/index.js b/projects/saddle/index.js index d1c07817100..2554af4782a 100644 --- a/projects/saddle/index.js +++ b/projects/saddle/index.js @@ -1,30 +1,88 @@ +const { sumTokens2 } = require("../helper/unwrapLPs"); +const sdk = require("@defillama/sdk"); +const contracts = require("./contracts.json"); -const { sumTokens2 } = require('../helper/unwrapLPs') -const config = require("./config"); -const sdk = require('@defillama/sdk') - +const POOL_REGISTRY_BYTES = + "0x506f6f6c52656769737472790000000000000000000000000000000000000000"; module.exports = { misrepresentedTokens: true, methodology: "Counts as TVL all the Assets deposited on each chain through different Pool Contracts", - hallmarks: [ - [1651276800, "sUSDv2 hack"] - ] + hallmarks: [[1651276800, "sUSDv2 hack"]], +}; + +async function getPoolDataAtIndex(index, poolReg, block, chain) { + const res = await sdk.api.abi.call({ + abi: `function getPoolDataAtIndex(uint256 index) view returns (tuple( + address poolAddress, + address lpToken, + uint8 typeOfAsset, + bytes32 poolName, + address targetAddress, + address[] tokens, + address[] underlyingTokens, + address basePoolAddress, + address metaSwapDepositAddress, + bool isSaddleApproved, + bool isRemoved, + bool isGuarded + ))`, + target: poolReg, + block: block, + params: [index], + chain: chain, + }); + return res.output; } -Object.keys(config).forEach(chain => { - module.exports[chain] = { - tvl: async (_, _b, { [chain]: block}) => { - const toa = [] - const blacklistedTokens = [] - Object.values(config[chain]).forEach(({ address, lpToken, poolTokens }) => { - blacklistedTokens.push(lpToken) - poolTokens.forEach(i => toa.push([i.address, address])) - }) - const balances = await sumTokens2({ tokensAndOwners: toa, chain, block, blacklistedTokens, }) - return balances - } +async function getPoolsData(poolReg, block, chain) { + const poolLength = await sdk.api.abi.call({ + abi: "uint256:getPoolsLength", + target: poolReg, + chain: chain, + block: block, + }); + const poolDatas = []; + for (var i = 0; i < poolLength.output; i++) { + const poolData = await getPoolDataAtIndex(i, poolReg, block, chain); + poolDatas.push({ + poolAddress: poolData.poolAddress, + lpToken: poolData.lpToken, + tokens: poolData.tokens, + }); } -}) + return poolDatas; +} +async function getPoolReg(block, chain) { + const poolRegAddress = await sdk.api.abi.call({ + abi: "function resolveNameToLatestAddress(bytes32 name) view returns (address)", + target: contracts[chain], + params: [POOL_REGISTRY_BYTES], + block: block, + chain: chain, + }); + return poolRegAddress.output; +} + +Object.keys(contracts).forEach((chain) => { + module.exports[chain] = { + tvl: async (_, _b, { [chain]: block }) => { + const poolsDatas = await getPoolsData(await getPoolReg(block, chain), block, chain); + const toa = []; + const blacklistedTokens = []; + Object.values(poolsDatas).forEach(({ poolAddress, lpToken, tokens }) => { + blacklistedTokens.push(lpToken); + tokens.forEach((i) => toa.push([i, poolAddress])); + }); + const balances = await sumTokens2({ + tokensAndOwners: toa, + chain, + block, + blacklistedTokens, + }); + return balances; + }, + }; +}); diff --git a/projects/safedollar/index.js b/projects/safedollar/index.js index b32f06500ae..35820df099f 100644 --- a/projects/safedollar/index.js +++ b/projects/safedollar/index.js @@ -1,18 +1,19 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk'); const farmUtils = require('./farm-utils'); const BigNumber = require('bignumber.js'); const url = "https://api.safedollar.fi/api/public/getAllCollateral"; -const utils = require('../helper/utils');; +const utils = require('../helper/utils'); /** * calculate collateral locked in safedollar */ const Contracts = { SafeAssets: [{ collateralAddress: "0x736Fb0CbB5F55941ecF6A811be4926c2cFa4dD4b", - address: "0x2791bca1f2de4661ed88a30c99a7a9449aa84174" + address: ADDRESSES.polygon.USDC },{ collateralAddress: "0xbd75b2a992ea83abed729e60022c9fe8fe539e54", - address: "0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270" + address: ADDRESSES.polygon.WMATIC_2 }], boardRoom: "0x46C6a9b8E3243FB0dfB069119D5Fc6a75EEc8604", diff --git a/projects/safeohm/index.js b/projects/safeohm/index.js index 94abfb2c6dd..a5eb06e187a 100644 --- a/projects/safeohm/index.js +++ b/projects/safeohm/index.js @@ -1,7 +1,8 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { ohmTvl } = require('../helper/ohm') const treasury = "0x16d657D5CfD6D7f894BFdB2F5481f8a23bDce269" module.exports = ohmTvl(treasury, [ - ["0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c", false], + [ADDRESSES.bsc.WBNB, false], ["0xb2e7793aad96e4e3048e0eb8d091e13a12087a52", true], ], "bsc", "0x7C340D53252A5b921754A436Ce3211Ac6E0F267D", "0xBDaa094a95e452c6bA175cE9EdfeFBa04e6a51Ac") \ No newline at end of file diff --git a/projects/saffron/abi.json b/projects/saffron/abi.json index 48c5c66ea6c..4216157d81a 100644 --- a/projects/saffron/abi.json +++ b/projects/saffron/abi.json @@ -1,36 +1,3 @@ { - "poolInfo": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "poolInfo", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "lpToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "allocPoint", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastRewardBlock", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accSFIPerShare", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } + "poolInfo": "function poolInfo(uint256) view returns (address lpToken, uint256 allocPoint, uint256 lastRewardBlock, uint256 accSFIPerShare)" } \ No newline at end of file diff --git a/projects/sagebet/index.js b/projects/sagebet/index.js new file mode 100644 index 00000000000..c05f9d47445 --- /dev/null +++ b/projects/sagebet/index.js @@ -0,0 +1,11 @@ +const { sumTokens2 } = require('../helper/unwrapLPs') + +async function tvl(_, _b, _cb, { api, }) { + const [markets] = await api.call({ target: '0xd350c2b3d8eb1de65cfa68928ea135eda88326b6', abi: "function getAllActiveMarkets() view returns (address[], string[], bool[])"}) + const tokens = await api.multiCall({ abi: 'address:collateralToken', calls: markets}) + return sumTokens2({ api, tokensAndOwners2: [tokens, markets]}) +} + +module.exports = { + arbitrum: { tvl } +} \ No newline at end of file diff --git a/projects/saharadao/abi.json b/projects/saharadao/abi.json index 4bdaad47b49..89cd4fbd2f7 100644 --- a/projects/saharadao/abi.json +++ b/projects/saharadao/abi.json @@ -1,51 +1,11 @@ { "bank": { - "usableCollateralBalance": { - "inputs": [], - "name": "usableCollateralBalance", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - } + "usableCollateralBalance": "uint256:usableCollateralBalance" }, "multiFeeDistribution": { - "totalSupply": { - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } + "totalSupply": "uint256:totalSupply" }, "pair": { - "getReserves": { - "inputs": [], - "name": "getReserves", - "outputs": [ - { - "internalType": "uint112", - "name": "_reserve0", - "type": "uint112" - }, - { - "internalType": "uint112", - "name": "_reserve1", - "type": "uint112" - }, - { - "internalType": "uint32", - "name": "_blockTimestampLast", - "type": "uint32" - } - ], - "stateMutability": "view", - "type": "function" - } + "getReserves": "function getReserves() view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast)" } } diff --git a/projects/saitaswap/index.js b/projects/saitaswap/index.js new file mode 100644 index 00000000000..d1e462c601b --- /dev/null +++ b/projects/saitaswap/index.js @@ -0,0 +1,13 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports = { + misrepresentedTokens: true, + methodology: + "Factory address (0x35113a300ca0D7621374890ABFEAC30E88f214b1 on Ethereum & 0x19e5ebc005688466d11015e646fa182621c1881e on BSC) is used to find the LP pairs. TVL is equal to the liquidity on the AMM.", + ethereum: { + tvl: getUniTVL({ factory: '0x35113a300ca0D7621374890ABFEAC30E88f214b1', chain: 'ethereum', useDefaultCoreAssets: true }), + }, + bsc: { + tvl: getUniTVL({ factory: '0x19e5ebc005688466d11015e646fa182621c1881e', chain: 'bsc', useDefaultCoreAssets: true }), + }, +}; // node test.js projects/saitaswap/index.js \ No newline at end of file diff --git a/projects/sakai-vault/index.js b/projects/sakai-vault/index.js new file mode 100644 index 00000000000..5849a200ee8 --- /dev/null +++ b/projects/sakai-vault/index.js @@ -0,0 +1,13 @@ +const { staking } = require('../helper/staking'); + +const contracts = { + "SAKAI": "0x43b35e89d15b91162dea1c51133c4c93bdd1c4af", + "Sakai-SP": "0xc20A079c7962D9fc92173cda349e80D484dFA42A" //Sakai Staking Protocol Contract +} + +module.exports = { + bsc: { + tvl: () => 0, + staking: staking(contracts['Sakai-SP'], contracts.SAKAI) + }, +} \ No newline at end of file diff --git a/projects/sakeperp/abi.json b/projects/sakeperp/abi.json index 8bb166eb46d..e6d48f5a1fb 100644 --- a/projects/sakeperp/abi.json +++ b/projects/sakeperp/abi.json @@ -1,45 +1,7 @@ { - "allPairs": { - "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "name": "allPairs", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - "allPairsLength": { - "inputs": [], - "name": "allPairsLength", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - "getReserves": { - "inputs": [], - "name": "getReserves", - "outputs": [ - { "internalType": "uint112", "name": "_reserve0", "type": "uint112" }, - { "internalType": "uint112", "name": "_reserve1", "type": "uint112" }, - { - "internalType": "uint32", - "name": "_blockTimestampLast", - "type": "uint32" - } - ], - "stateMutability": "view", - "type": "function" - }, - "token0": { - "inputs": [], - "name": "token0", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - "token1": { - "inputs": [], - "name": "token1", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - } -} + "allPairs": "function allPairs(uint256) view returns (address)", + "allPairsLength": "uint256:allPairsLength", + "getReserves": "function getReserves() view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast)", + "token0": "address:token0", + "token1": "address:token1" +} \ No newline at end of file diff --git a/projects/sakeperp/index.js b/projects/sakeperp/index.js index 334cbdcf84d..20d230a11c3 100644 --- a/projects/sakeperp/index.js +++ b/projects/sakeperp/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); @@ -8,7 +9,7 @@ const bscSake = "0x8BD778B12b15416359A227F0533Ce2D91844e1eD"; const bscFactory = "0xA534cf041Dcd2C95B4220254A0dCb4B905307Fd8"; const bscSakebar = "0xbC83FAdA7D0881F772daaB2B4295F949FA309B59"; const perpVault = "0xa34dA41edB2b15A20893d2208377E24D8dcdeB6e"; -const bUsd = "0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56"; +const bUsd = ADDRESSES.bsc.BUSD; async function tvl(factory, block, chain) { let balances = {}; diff --git a/projects/salem/index.js b/projects/salem/index.js index 8a8bc8229e0..915b93a4e23 100644 --- a/projects/salem/index.js +++ b/projects/salem/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const { addFundsInMasterChef } = require("../helper/masterchef"); const { stakingUnknownPricedLP } = require("../helper/staking"); @@ -27,8 +28,8 @@ const ftmPool2 = [ ] const translate = { - "0xb44a9b6905af7c801311e8f4e76932ee959c663c": "fantom:0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83", - "0xf2001b145b43032aaf5ee2884e456ccd805f677d": "0x6b175474e89094c44da98b954eedeac495271d0f", + [ADDRESSES.moonriver.USDT]: "fantom:" + ADDRESSES.fantom.WFTM, + "0xf2001b145b43032aaf5ee2884e456ccd805f677d": ADDRESSES.ethereum.DAI, "0x7dff46370e9ea5f0bad3c4e29711ad50062ea7a4": "bsc:0x570a5d26f7765ecb712c0924e4de545b89fd43df" }; diff --git a/projects/salsa/index.js b/projects/salsa/index.js new file mode 100644 index 00000000000..2f689343e74 --- /dev/null +++ b/projects/salsa/index.js @@ -0,0 +1,16 @@ +const { call } = require("../helper/chain/elrond"); + +const ADDRESSES = require('../helper/coreAssets.json'); + +const tvl = async (_, _1, _2, { api }) => { + const tokenPrice = await call({ target: 'erd1qqqqqqqqqqqqqpgqaqxztq0y764dnet95jwtse5u5zkg92sfacts6h9su3', abi: 'getTokenPrice', responseTypes: ['number'] }); + const lsTokenSupply = await call({ target: 'erd1qqqqqqqqqqqqqpgqaqxztq0y764dnet95jwtse5u5zkg92sfacts6h9su3', abi: 'getLiquidTokenSupply', responseTypes: ['number'] }); + api.add(ADDRESSES.null, tokenPrice * lsTokenSupply / 1e18) +}; + +module.exports = { + timetravel: false, + elrond: { + tvl, + }, +}; diff --git a/projects/samodao/index.js b/projects/samodao/index.js index 8d7c105e1d7..e03b48b92b3 100644 --- a/projects/samodao/index.js +++ b/projects/samodao/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { ohmTvl } = require("../helper/ohm"); @@ -5,7 +6,7 @@ const token = "0xcd7CBc46d083A245B45E22Cb4bE2c569947Ce896"; const tokenStaking = "0x082e884e640eC62C67ea3dC791793E4dF2C46c2D"; const treasury = "0xBB575FbDd418E9e8405D97A33043818A379CD2Ca"; const treasurytokens = [ - ["0xe9e7cea3dedca5984780bafc599bd69add087d56", false], // BUSD + [ADDRESSES.bsc.BUSD, false], // BUSD ["0x4a49858B15F934306725B32582FFa55f95D9F90a", true] // CAKE LP (samoDAO-BUSD) ] diff --git a/projects/sandclock/index.js b/projects/sandclock/index.js new file mode 100644 index 00000000000..d1e20d72102 --- /dev/null +++ b/projects/sandclock/index.js @@ -0,0 +1,40 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const sdk = require('@defillama/sdk'); +const { sumTokens2 } = require('../helper/unwrapLPs') + +const LUSD = ADDRESSES.ethereum.LUSD; +const WETH = ADDRESSES.ethereum.WETH; +const USDC = ADDRESSES.ethereum.USDC; +const YEARN_VAULT = '0x4fe4bf4166744bcbc13c19d959722ed4540d3f6a'; +const LIQUITY_VAULT = '0x91a6194f1278f6cf25ae51b604029075695a74e5'; +const WETH_VAULT = '0x1Fc623b96c8024067142Ec9c15D669E5c99c5e9D'; +const USDC_VAULT = '0x1038Ff057b7092f17807358c6f68b42661d15caB'; + +const v1Vaults = [YEARN_VAULT, LIQUITY_VAULT]; +const v2Vaults = [WETH_VAULT, USDC_VAULT]; + +async function tvl(_, _b, _cb, { api, chain, block, }) { + const balances = {} + const v1VaultBalances = await api.multiCall({ + abi: 'uint256:totalUnderlying', + calls: v1Vaults, + }) + v1VaultBalances.forEach(i => sdk.util.sumSingleBalance(balances, LUSD, i, chain)) + const v2VaultBalances = await api.multiCall({ + abi: 'uint256:totalAssets', + calls: v2Vaults, + }) + sdk.util.sumSingleBalance(balances, WETH, v2VaultBalances[0], chain) + sdk.util.sumSingleBalance(balances, USDC, v2VaultBalances[1], chain) + return sumTokens2({ balances, chain, block, }) +} + +module.exports = { + misrepresentedTokens: false, + methodology: 'add underlying asset balances in all the vaults together.', + doublecounted: true, + start: 15308000, // The first vault YEARN_VAULT was deployed + ethereum: { + tvl, + } +}; \ No newline at end of file diff --git a/projects/sapphire/index.js b/projects/sapphire/index.js index 2374eb56f1d..f8843cd0749 100644 --- a/projects/sapphire/index.js +++ b/projects/sapphire/index.js @@ -2,8 +2,7 @@ const sdk = require("@defillama/sdk"); const { transformFantomAddress } = require("../helper/portedTokens"); const { addFundsInMasterChef } = require("../helper/masterchef"); const { stakings } = require('../helper/staking') -const poolInfo = {"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"poolInfo","outputs":[{"internalType":"contract IERC20","name":"lpToken","type":"address"},{"internalType":"uint256","name":"allocPoint","type":"uint256"},{"internalType":"uint256","name":"lastRewardBlock","type":"uint256"},{"internalType":"uint256","name":"accfSapphirePerShare","type":"uint256"},{"internalType":"uint16","name":"depositFeeBP","type":"uint16"},{"internalType":"uint256","name":"lpSupply","type":"uint256"}],"stateMutability":"view","type":"function"} -const warPoolInfo = {"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"poolInfo","outputs":[{"internalType":"contract IERC20","name":"lpToken","type":"address"},{"internalType":"uint256","name":"allocPoint","type":"uint256"},{"internalType":"uint256","name":"lastRewardBlock","type":"uint256"},{"internalType":"uint256","name":"accfSapphirePerShare","type":"uint256"},{"internalType":"uint16","name":"depositFeeBP","type":"uint16"},{"internalType":"uint256","name":"lpSupply","type":"uint256"}],"stateMutability":"view","type":"function"} +const poolInfo = 'function poolInfo(uint256) view returns (address lpToken, uint256 allocPoint, uint256 lastRewardBlock, uint256 accfSapphirePerShare, uint16 depositFeeBP, uint256 lpSupply)' const chef = "0x5A3b5A572789B87755Fa7720A4Fae36e2e2D3b35" const sapphireWarChef = "0xD1b96929AceDFa7a2920b5409D0c5636b89dcD85" @@ -16,7 +15,7 @@ async function tvl(timestamp, block, chainBlocks) { const balances = {} const transformAddress = await transformFantomAddress() await addFundsInMasterChef(balances, chef, chainBlocks.fantom, "fantom", transformAddress, poolInfo, [sapphire, sapphireFtmLP]) - await addFundsInMasterChef(balances, sapphireWarChef, chainBlocks.fantom, "fantom", transformAddress, warPoolInfo, [sapphireWar, sapphireWarFtmLP]) + await addFundsInMasterChef(balances, sapphireWarChef, chainBlocks.fantom, "fantom", transformAddress, poolInfo, [sapphireWar, sapphireWarFtmLP]) return balances; } @@ -49,6 +48,6 @@ module.exports = { tvl, pool2: stakings([chef, sapphireWarChef], [sapphireFtmLP, sapphireWarFtmLP], "fantom"), staking, - masterchef: tvl, + // masterchef: tvl, } } diff --git a/projects/sashimidao/index.js b/projects/sashimidao/index.js index 12b00a38faf..015f1abed7f 100644 --- a/projects/sashimidao/index.js +++ b/projects/sashimidao/index.js @@ -1,4 +1,4 @@ -const { transformAvaxAddress } = require("../helper/portedTokens"); + const { stakings } = require("../helper/staking"); const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); @@ -18,7 +18,7 @@ const SASHI_MIM_JLP = "0x71f8DF8A958D5a09694312a79355655F44310084"; async function avaxTvl(timestamp, chainBlocks) { const balances = {}; - let transformAddress = await transformAvaxAddress(); + let transformAddress = addr => 'avax:'+addr await sumTokensAndLPsSharedOwners( balances, @@ -36,6 +36,9 @@ async function avaxTvl(timestamp, chainBlocks) { } module.exports = { + hallmarks: [ + [1642464000, "Rug Pull"] + ], misrepresentedTokens: true, avax: { staking: stakings(sashimidaoStakings, SASHI, "avax"), diff --git a/projects/sashimiswap/index.js b/projects/sashimiswap/index.js index b292dd2c54b..32409899dd7 100644 --- a/projects/sashimiswap/index.js +++ b/projects/sashimiswap/index.js @@ -1,66 +1,147 @@ -const sdk = require("@defillama/sdk"); -const {uniTvlExport} = require("../helper/calculateUniTvl"); -const { compoundExports } = require("../helper/compound"); +const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') +const { getLogs } = require('../helper/cache/getLogs') const { staking } = require("../helper/staking"); -const factoryETH = "0xF028F723ED1D0fE01cC59973C49298AA95c57472"; -const comprollerETH = "0xB5d53eC97Bed54fe4c2b77f275025c3fc132D770"; -const sIETH = "0xC597F86424EEb6599Ea40f999DBB739e3Aca5d82"; -const WETHEquivalent = "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"; - -const factoryBSC = "0x1DaeD74ed1dD7C9Dabbe51361ac90A69d851234D"; -const comprollerBSC = "0x88fEf82FDf75E32e4BC0e662d67CfcEF4838F026"; -const sIBNB = "0x6Df484F552115fa7F54bE4A6D7aE2999cadB2324"; -const WBNBEquivalent = "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c"; - -const factoryHECO = "0xC28E27870558cF22ADD83540d2126da2e4b464c2"; -const comprollerHECO = "0x6Cb9d7ecf84b0d3E7704ed91046e16f9D45C00FA"; -const sIHT = "0xf13d3E10DEE31b80887422c89285112Dd00ce0B5"; -const WHTEquivalent = "0x5545153ccfca01fbd7dd11c0b23ba694d9509a6f"; - -const {tvl: ethMarketsTvl, borrowed: borrowedEth} = compoundExports( - comprollerETH, - "ethereum", - sIETH, - WETHEquivalent -) - -const {tvl: bscMarketsTvl, borrowed: borrowedBsc} = compoundExports( - comprollerBSC, - "bsc", - sIBNB, - WBNBEquivalent -) - -const {tvl: hecoMarketsTvl, borrowed: borrowedHeco} = compoundExports( - comprollerHECO, - "heco", - sIHT, - WHTEquivalent -) - -const ethTvl = uniTvlExport(factoryETH, "ethereum"); - -const bscTvl = uniTvlExport(factoryBSC, "bsc"); - -const hecoTvl = uniTvlExport(factoryHECO, "heco"); - module.exports = { - timetravel: true, - doublecounted: false, + methodology: + "We count liquidity on the Farms (LP tokens) threw Factory Contract; and on the lending markets same as compound", + hallmarks: [ + [Math.floor(new Date('2021-12-30')/1e3), 'Protocol was hacked for 210K USD'], + ], +}; + +const config = { ethereum: { - tvl: sdk.util.sumChainTvls([ethTvl,ethMarketsTvl]), - staking: staking("0x6ed306DbA10E6c6B20BBa693892Fac21f3B91977", "0xC28E27870558cF22ADD83540d2126da2e4b464c2"), - borrowed: borrowedEth, + dexFactory: '0xF028F723ED1D0fE01cC59973C49298AA95c57472', + dexFromBlock: 10943133, + comptroller: '0xB5d53eC97Bed54fe4c2b77f275025c3fc132D770', + // cToken: '0xC597F86424EEb6599Ea40f999DBB739e3Aca5d82', + stakingContracts: ['0x6ed306DbA10E6c6B20BBa693892Fac21f3B91977'], + stakingToken: '0xC28E27870558cF22ADD83540d2126da2e4b464c2', }, bsc: { - tvl: sdk.util.sumChainTvls([bscTvl, bscMarketsTvl]), - borrowed: borrowedBsc, + dexFactory: '0x1DaeD74ed1dD7C9Dabbe51361ac90A69d851234D', + dexFromBlock: 5208518, + comptroller: '0x88fEf82FDf75E32e4BC0e662d67CfcEF4838F026', + // cToken: '0xC597F86424EEb6599Ea40f999DBB739e3Aca5d82', }, heco: { - tvl: sdk.util.sumChainTvls([hecoTvl,hecoMarketsTvl]), - borrowed: borrowedHeco, + dexFactory: '0xC28E27870558cF22ADD83540d2126da2e4b464c2', + dexFromBlock: 783990, + comptroller: '0x6Cb9d7ecf84b0d3E7704ed91046e16f9D45C00FA', + // cToken: '0xC597F86424EEb6599Ea40f999DBB739e3Aca5d82', }, - methodology: - "We count liquidity on the Farms (LP tokens) threw Factory Contract; and on the lending markets same as compound", -}; +} + +Object.keys(config).forEach(chain => { + const { stakingContracts, stakingToken, dexFactory, comptroller, dexFromBlock, } = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const ownerTokens = [] + if (comptroller) { + const markets = await api.call({ abi: 'address[]:getAllMarkets', target: comptroller, }) + let uTokens = await api.multiCall({ abi: 'address:underlying', calls: markets, permitFailure: true }) + uTokens = uTokens.map(i => i ?? nullAddress) + ownerTokens.push(...markets.map((m, i) => [[uTokens[i]], m])) + } + if (dexFactory) { + const logs = await getLogs({ + api, + target: dexFactory, + topics: ['0x0d3648bd0f6ba80134a33ba9275ac585d9d315f0ad8355cddefde31afa28d0e9'], + eventAbi: 'event PairCreated (address indexed token0, address indexed token1, address pair, uint256)', + onlyArgs: true, + fromBlock: dexFromBlock, + }) + const routers = await api.multiCall({ abi: 'address:router', calls: logs.map(i => i.pair) }) + routers.forEach((r, i) => ownerTokens.push([[logs[i].token0, logs[i].token1], r])) + } + return sumTokens2({ api, ownerTokens, blacklistedTokens, }) + }, + borrowed: async (_, _b, _cb, { api, }) => { + if (comptroller) { + const markets = await api.call({ abi: 'address[]:getAllMarkets', target: comptroller, }) + let uTokens = await api.multiCall({ abi: 'address:underlying', calls: markets, permitFailure: true }) + uTokens = uTokens.map(i => i ?? nullAddress) + let borrows = await api.multiCall({ abi: 'uint256:totalBorrows', calls: markets }) + api.addTokens(uTokens, borrows) + } + api.getBalances() + }, + } + + if (stakingContracts) { + module.exports[chain].staking = staking(stakingContracts, stakingToken) + } +}) + +const blacklistedTokens = [ + // ethereum + '0x24efe6b87bf1bfe9ea2ccb5a9d0a959c7172b364', + '0x786448439d9401e0a8427acf7ca66a5114eb2368', + '0x32503febaa15d0bcfda2a9d8fe492d14a750e52c', + '0x7756661eea92e4423ae4680f552aa0be0da040f1', + '0x03012a6f9bb5bff61997aee59477a893debd203b', + '0x0c7858badb509262e736748e6041b8d7b0b94dbf', + '0xb904d3f16bf305e99fd785dda1bb13df354c381b', + '0x674dcbde5c622abb3122d6934fcce446b95060dc', + '0x90b4fc25a6bd9a666aa4507148f07198a4abc849', + '0x0aa387225497ccca54fe9de989d3274c1377efe7', + '0x823b35caa9d0c66a5f9ffb6d042fa130f34cb760', + '0x9e844c8a08b6e56c7c89c7428d63599b64f62ea9', + '0x7a77073c1191f2d2fd31a71c758d44f3de0af831', + '0xbacbd121f37557e5ea1d0c4bb67756867866c3fe', + '0xf1b43f4e14650ac8c4bb009d9b56eb77c1ae87cd', + '0x5b8c75d6f91663c515bb12e3cf7c29ade0e1a302', + '0x7578fd876752a5e4999a16fb80cfe30c1056de11', + '0x1ad47ee8074ee1adabd76e97b23b94713de9d175', + '0x9a3eed88730378393e903387087964184b462c71', + '0xdd530cbe1409df4e7e2dfd18931292c81d8c5e17', + '0x6e4e0a7f4dc3068970ecb81fd28cd19d4119125b', + '0x0c662c1e8635aead580714ffa19ab5f008ab7aeb', + '0x30404353bdceebe86e0b6391fe66db1082bc6cb7', + '0xa503ddef9c88b5b566705298f8c8faace130b80b', + '0x002141edcfb5814ad2772e3aecb73a3312f0b60c', + '0xa6ce576e27ee546cb64e280bb2aa18ad438c28cc', + '0xa35ff70c648acd83cf0742b919bce4d1b424dca4', + '0x079308fcea7973da3ae2b45904948a5b51f3cba3', + '0x4ff5b5108f4db6f925cd76a68bb80565fd8053e6', + '0x0df2d534cc6849558a9d237c98be560b5ff502f8', + + // bsc + '0xc28e27870558cf22add83540d2126da2e4b464c2', + '0x4b64a2d17231882e62d7d5d84daa92e6a39e93b4', + '0xd9f2894257a57333e84682f463c01e539af15f3a', + '0x627c99cfc6421224a99b88cec08ba9894253779c', + '0xabc2984de273dd6fc4cfe602d5a9736ab94402be', + '0xd7bfb8faa3c395d475ac97f337f528565b2ea2c6', + '0x216ca859fbc236a32d6464ce17b18591dd72c3d3', + '0x5fbce2d40ea2c5233c2ba399e27a2a21b0d6964c', + '0xa9cb2cb1f0080b2d479e4be62a27969d80b6577c', + '0x2f11f3a4656732c2f9e77c8642ed8a7d42aa2a02', + '0x6047ac230eef705d294ece482f1652235dac6405', + '0xd771dcc836d69f45e8ed604be03a26bdf4be2623', + '0x01876dccb99cd6172f343a874021427afe550472', + '0x176c673a31904dbfff4255f2501567b4ddc73f65', + '0x7213c252e7857b529582dddc770ddb275759d1ec', + + // heco + '0xc2037c1c13dd589e0c14c699dd2498227d2172cc', + '0x03271182cf2b47929978d0e4ca4af0846f66e2de', + '0x891daabf6de7a648c9665928e1097b808c1721e2', + '0xe9c95876f144bbdf5dc33d1a35c26cab0611903f', + '0x389eec1b8795853770874b76b912ec18de796e1b', + '0xeaac96f59e40d38bd970b37879a79a1d28737d8a', + '0x6c606fb47d99d1e66f9b599f8c5602cd4eb44d5a', + '0xae399aea42867fec2cd4a04963a7f0e247a39431', + '0x818bbc9b9d37685f9f4db032d46b52a70d890632', + '0x6ccbc3a5ae94e8a75f9571438a78f3e3aa956655', + '0xc2d36a8c0b1235ddecac2ed519139e9177e67736', + '0x611e93a7718a215bfda3c63f7175d764793272df', + '0x377dca38ff279a73a9075f25d36d00b98515a9a1', + '0x937a48287fdc4b503d608cb988ac35eee75f076f', + '0x3f3aaaa941ad756fc49a4b3241a87a7c04e39a4e', + '0x06068d90e0cbf9b7ccfd21efddb9bceb4c47fd31', + '0xe2a246c36fa86eee290acef79a8dc66b6b7f25ba', + '0x8fc67b8ed339c740a58ebd7aae24ba9d57d8dd25', +] diff --git a/projects/satin/index.js b/projects/satin/index.js new file mode 100644 index 00000000000..1079697bde6 --- /dev/null +++ b/projects/satin/index.js @@ -0,0 +1,12 @@ +const { getUniTVL } = require("../helper/unknownTokens"); + +module.exports = { + misrepresentedTokens: true, + polygon: { + tvl: getUniTVL({ + factory: "0x30030Aa4bc9bF07005cf61803ac8D0EB53e576eC", + hasStablePools: true, + useDefaultCoreAssets: true, + }), + }, +}; diff --git a/projects/satori/index.js b/projects/satori/index.js new file mode 100644 index 00000000000..ac5666b2249 --- /dev/null +++ b/projects/satori/index.js @@ -0,0 +1,24 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require("../helper/unwrapLPs"); + +const USDT_TOKEN_CONTRACT = "0x1E4a5963aBFD975d8c9021ce480b42188849D41d"; +const WALLET_ADDR = [ + "0x62e724cB4d6C6C7317e2FADe4A03001Fe7856940", + "0xA59a2365D555b24491B19A5093D3c99b119c2aBb", +]; +module.exports = { + methodology: + "TVL includes the total token value inside the protocol's liquidity pools.", + polygon_zkevm: { + tvl: sumTokensExport({ owners: WALLET_ADDR, tokens: [USDT_TOKEN_CONTRACT]}), + }, + era: { + tvl: sumTokensExport({ + owners: [ + "0x0842b33529516abe86CA8EA771aC4c84FDd0eeE0", + "0x48756b37Fd643bB40F669804730024F02900C476", + ], + tokens: [ADDRESSES.era.USDC], + }), + }, +}; diff --git a/projects/satoshiswap/index.js b/projects/satoshiswap/index.js new file mode 100644 index 00000000000..6babbb3f041 --- /dev/null +++ b/projects/satoshiswap/index.js @@ -0,0 +1,11 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports = { + misrepresentedTokens: true, + core: { + tvl: getUniTVL({ + useDefaultCoreAssets: true, + factory: '0x8f5c03a1c86bf79ae0baC0D72E75aee662083e26', + }) + } +} \ No newline at end of file diff --git a/projects/savvy/contracts.json b/projects/savvy/contracts.json new file mode 100644 index 00000000000..41cce45ab1c --- /dev/null +++ b/projects/savvy/contracts.json @@ -0,0 +1,46 @@ +{ + "infoAggregator": "0x68D54ff41BA47355b95Bd477Bcf4d5ff4b2c2A59", + "tokenHolders": { + "SavvyPositionManagerBTC": "0x3204d81C73F8100766C1691A67078b16Ec7c142c", + "SavvyPositionManagerETH": "0x5c4eb1909fB21e39Fc45ee753420AeDeBA07F3EF", + "SavvyPositionManagerUSD": "0x36358A1597DB299033b16fda567010D53c0A4EdA", + "YieldStrategyManagerBTC": "0xdC82E20111767f4a2A76A65BD85E41F7859c7b9f", + "YieldStrategyManagerETH": "0x23627eb1C6692Adf25AD79285FDe2bc6bdf12C82", + "YieldStrategyManagerUSD": "0x09Dde6661fd023cf7c3751555347a5cB8687F806", + "SavvySwapWETH": "0xb5231e17596bEAf436A25B018bd63e5b42e14135", + "SavvySwapBTCb": "0x43be188901F529c11337f28bC1F753a878B2F691", + "SavvySwapWBTC": "0x9A3A3ba687Fcb8AFE6367Eff3A5F5A11F51626DA", + "SavvySwapUSDCe": "0xD9565AB01AA30D7Aa2b982b8b1c740480C1C8497", + "SavvySwapUSDT": "0x0E56d518E5d3F5e6cFCfD46095B6B4024541027b", + "SavvySwapDAI": "0x03fA5a7fA80E5EA464559d21B8843E15b7969c07", + "SavvySageBTC": "0x2fcCd0f67d0722f5EB7c1A404DFF0224544155E3", + "SavvySageETH": "0xCd5156Fdd53fD9A0f5bfc37B212DD9c989C10533", + "SavvySageUSD": "0x78A370c3d5fFF93Da53a2B088a117244c52AF857", + "savvyAArbWBTC": "0xDD7e69c478288A9596DECc2230A39c7b922413Dd", + "savvyAArbWETH": "0xCaB3886D48bAd0F749ba7e7c7A255b636c64F937", + "savvyAArbUSDC": "0xCdFF8576683E22621f512fc2E6d347A9D241DAd3", + "JonesAdapterUSDC": "0x9394b6B85bEab8cba1e4aA35FbBB5C31c258224A" + }, + "savvyTokens": { + "SVY": "0x43aB8f7d2A8Dd4102cCEA6b438F6d747b1B9F034", + "svBTC": "0xeEE18334c414A47FB886a7317E1885b2Bfb8c2A6", + "svETH": "0xf7728582002ef82908c8242CF552E969BA863Ffa", + "svUSD": "0xF202Ab403Cd7E90197ec0f010ee897E283037706" + }, + "baseTokens": { + "WETH": "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1", + "WBTC": "0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f", + "USDCe": "0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8", + "USDT": "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9", + "DAI": "0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1", + "BTCb": "0x2297aEbD383787A160DD0d9F71508148769342E3" + }, + "yieldTokens": { + "aArbWBTC": "0x078f358208685046a11C85e8ad32895DED33A249", + "aArbWETH": "0xe50fA9b3c56FfB159cB0FCA61F5c9D750e8128c8", + "aArbUSDC": "0x625E7708f30cA75bfd92586e17077590C60eb4cD", + "jUSDC": "0xe66998533a1992ecE9eA99cDf47686F4fc8458E0" + } + +} + diff --git a/projects/savvy/index.js b/projects/savvy/index.js new file mode 100644 index 00000000000..72d6b843be4 --- /dev/null +++ b/projects/savvy/index.js @@ -0,0 +1,16 @@ +const contracts = require("./contracts.json"); +const { sumTokens2 } = require("../helper/unwrapLPs"); + +function tvl(chain) { + return async (timestamp, block, chainBlocks, { api }) => { + const tokens = Object.values(contracts.baseTokens).concat(Object.values(contracts.yieldTokens)); + await sumTokens2({ tokens, api, owners: Object.values(contracts.tokenHolders) }) + }; +} + +module.exports = { + methodology: 'The calculated TVL is the current sum of all base tokens and yield tokens in our contracts.', + arbitrum: { + tvl: tvl("arbitrum") + } +} \ No newline at end of file diff --git a/projects/scallop/index.js b/projects/scallop/index.js index a07c77d0ab0..5d7ad92a46e 100644 --- a/projects/scallop/index.js +++ b/projects/scallop/index.js @@ -2,7 +2,9 @@ const anchor = require("@project-serum/anchor"); const { PublicKey } = require("@solana/web3.js"); const activePoolBases = require("./active-pools.json"); const { getConnection, decodeAccount } = require("../helper/solana"); +const sui = require("../helper/chain/sui"); const sdk = require('@defillama/sdk') +const BigNumber = require("bignumber.js"); const SCALLOP_PROGRAM_ID = new PublicKey("SCPv1LabixHirZbX6s7Zj3oiBogadWZvGUKRvXD3Zec"); @@ -10,6 +12,8 @@ const SCALLOP_PROGRAM_ID = new PublicKey("SCPv1LabixHirZbX6s7Zj3oiBogadWZvGUKRvX const COUPON_SEED = "coupon_seed"; const POOL_AUTHORITY = "pool_authority_seed"; +const SCALLOP_SUI_MARKET_ID = "0xa757975255146dc9686aa823b7838b507f315d704f428cbadad2f4ea061939d9" + function getTokenGeckoId(mintAuthority) { for (let i = 0; i < activePoolBases.length; i++) { const pubkey = new PublicKey(activePoolBases[i].base) @@ -22,7 +26,7 @@ function getTokenGeckoId(mintAuthority) { } } -async function tvl() { +async function solanaTvl() { const connection = getConnection() // at Scallop, coupon representing deposited amount of a pool @@ -54,9 +58,58 @@ async function tvl() { return balances; } +async function suiBorrowed() { + const { api } = arguments[3] + const object = await sui.getObject(SCALLOP_SUI_MARKET_ID) + + const balanceSheetsFields = await sui.getDynamicFieldObjects({ + parent: object.fields.vault.fields.balance_sheets.fields.table.fields.id.id, + }); + + const balanceSheets = await sui.getObjects(balanceSheetsFields.map((e) => e.fields.id.id)) + + balanceSheets.forEach((e) => { + const coinType = '0x' + e.fields.name.fields.name + const amount = new BigNumber(e.fields.value.fields.debt).toString() + api.add(coinType, amount) + }) +} + +async function suiTvl() { + const { api } = arguments[3] + const object = await sui.getObject(SCALLOP_SUI_MARKET_ID) + + const balanceSheetsFields = await sui.getDynamicFieldObjects({ + parent: object.fields.vault.fields.balance_sheets.fields.table.fields.id.id, + }); + + const balanceSheets = await sui.getObjects(balanceSheetsFields.map((e) => e.fields.id.id)) + + balanceSheets.forEach((e) => { + const coinType = '0x' + e.fields.name.fields.name + const amount = new BigNumber(e.fields.value.fields.cash).toString() + api.add(coinType, amount) + }) + + const collateralStatsFields = await sui.getDynamicFieldObjects({ + parent: object.fields.collateral_stats.fields.table.fields.id.id, + }); + + const collateralStats = await sui.getObjects(collateralStatsFields.map((e) => e.fields.id.id)) + + collateralStats.forEach((e) => { + const coinType = '0x' + e.fields.name.fields.name + api.add(coinType, e.fields.value.fields.amount) + }) +} + module.exports = { timetravel: false, solana: { - tvl, + tvl: solanaTvl, + }, + sui: { + tvl: suiTvl, + borrowed: suiBorrowed, }, } \ No newline at end of file diff --git a/projects/scanto/index.js b/projects/scanto/index.js new file mode 100644 index 00000000000..8f7882ca479 --- /dev/null +++ b/projects/scanto/index.js @@ -0,0 +1,13 @@ +const ADDRESSES = require('../helper/coreAssets.json') +async function tvl(_, _b, _cb, { api }){ + const supply = await api.call({ abi: "function totalSupply() view returns (uint256)", target:"0x9F823D534954Fc119E31257b3dDBa0Db9E2Ff4ed" }) + return { + ["canto:" + ADDRESSES.null]: supply + } +} + +module.exports={ + canto:{ + tvl + } +} \ No newline at end of file diff --git a/projects/scarecrow-raven/abi.json b/projects/scarecrow-raven/abi.json index 7ade267a7a2..7d70492db5b 100644 --- a/projects/scarecrow-raven/abi.json +++ b/projects/scarecrow-raven/abi.json @@ -1,59 +1,4 @@ { - "poolInfo": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "poolInfo", - "outputs": [ - { - "internalType": "contract IBEP20", - "name": "lpToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "allocPoint", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastRewardBlock", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accRavenPerShare", - "type": "uint256" - }, - { - "internalType": "uint16", - "name": "depositFeeBP", - "type": "uint16" - }, - { - "internalType": "uint256", - "name": "lpSupply", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "poolLength": { - "inputs": [], - "name": "poolLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } + "poolInfo": "function poolInfo(uint256) view returns (address lpToken, uint256 allocPoint, uint256 lastRewardBlock, uint256 accRavenPerShare, uint16 depositFeeBP, uint256 lpSupply)", + "poolLength": "uint256:poolLength" } \ No newline at end of file diff --git a/projects/scarecrow-raven/index.js b/projects/scarecrow-raven/index.js index 8943dbc34b0..73b5a07baf2 100644 --- a/projects/scarecrow-raven/index.js +++ b/projects/scarecrow-raven/index.js @@ -1,63 +1,16 @@ -const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); -const { transformFantomAddress } = require("../helper/portedTokens"); -const { addTokensAndLPs } = require("../helper/unwrapLPs"); +const { sumTokens2 } = require("../helper/unwrapLPs"); const chef = "0x2639779d6ca9091483a2a7b9a1fe77ab83b90281"; -async function chainTvl(timestamp, block, chainBlocks) { - const poolLength = Number( - ( - await sdk.api.abi.call({ - abi: abi.poolLength, - target: chef, - chain: "fantom", - block: chainBlocks["fantom"], - }) - ).output - ); - const poolIds = Array.from(Array(poolLength).keys()); - - const lpTokens = ( - await sdk.api.abi.multiCall({ - abi: abi.poolInfo, - calls: poolIds.map((pid) => ({ - target: chef, - params: pid, - })), - chain: "fantom", - block: chainBlocks["fantom"], - }) - ).output.map((lp) => ({ output: lp.output[0].toLowerCase() })); - - const amounts = await sdk.api.abi.multiCall({ - abi: 'erc20:balanceOf', - calls: lpTokens.map((lp) => ({ - target: lp.output, - params: chef, - })), - chain: "fantom", - block: chainBlocks["fantom"], - }); - - const balances = {}; - const tokens = { output: lpTokens }; - const transformAddress = await transformFantomAddress(); - await addTokensAndLPs( - balances, - tokens, - amounts, - chainBlocks["fantom"], - "fantom", - transformAddress - ); - - return balances; +async function tvl(timestamp, block, chainBlocks, { api }) { + const tokens = (await api.fetchList({ lengthAbi: abi.poolLength , itemAbi: abi.poolInfo, target: chef})).map(i => i[0]) + return sumTokens2({ api, tokens, owner: chef, }) } module.exports = { methodology: "TVL includes all farms in MasterChef contract", fantom: { - tvl: sdk.util.sumChainTvls([chainTvl]), + tvl, } }; diff --git a/projects/scaryswap/contracts.json b/projects/scaryswap/contracts.json new file mode 100644 index 00000000000..ea257c749d7 --- /dev/null +++ b/projects/scaryswap/contracts.json @@ -0,0 +1,23 @@ +{ + "pools": [ + "0x704e258002428ad5a8dbb433D477654404f15587", + "0x034D059190a8554f2E474Bd25c369F18ac5Ad3Ab", + "0xc35cBc7964D1eC52e23D87551bC0198bd6CA5684", + "0x2A2FBB49dDaB99a8bDFC203b70570187573ba8ac", + "0xE5E1e21B7564D6DCd36d5dC061A06eD3E97c2058", + "0x6286fC97636C79ce3Cf5cf176054C69b6FFD4333", + "0x1981a9fe49A69e1050D07CcF85B65b8aB0adFDA4", + "0x088A14e3BC62313C8D694424015657aEdD98Df26", + "0x421ACe6888c80bF5214424C71879fF69F874553c", + "0xD79666d97779C3bdeDc5e8697F48a0849ea0a9b2", + "0x64e3c3fbC549C19605Ba0B5d823d3aE673C2f8Ab" + ], + "farms": [ + { "contract": "0x335974e9A7449765DfE891dFc9e9ECF4Ae0E1F08", "token": "0x8D11eC38a3EB5E956B052f67Da8Bdc9bef8Abf3E" }, + { "contract": "0x7968FC7B3aBf481d8D6577D048DbE10930Bb48BA", "token": "0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83" }, + { "contract": "0x4c2032f0F6856be925B1f5E217e01ca8bd4197F6", "token": "0x04068DA6C83AFCFA0e13ba15A6696662335D5B75" }, + { "contract": "0x1ad66466Fc9Cdd5992b3919E475885aCC572887a", "token": "0xAD522217E64Ec347601015797Dd39050A2a69694" }, + { "contract": "0xC17c92E9b2A9Be62e3547819438482033c5d4026", "token": "0xAD522217E64Ec347601015797Dd39050A2a69694" }, + { "contract": "0xDad0e7f0cc49c8B24Ba89B7c224bb0bF462dCBD5", "token": "0xAD522217E64Ec347601015797Dd39050A2a69694" } + ] +} diff --git a/projects/scaryswap/index.js b/projects/scaryswap/index.js index 40fe1a7db84..fb42b01a1be 100644 --- a/projects/scaryswap/index.js +++ b/projects/scaryswap/index.js @@ -1,13 +1,23 @@ -const { getUniTVL} = require('../helper/unknownTokens') +const { getUniTVL } = require("../helper/unknownTokens"); +const { pools, farms } = require("./contracts.json"); +const poolAbi = require("./pool.json"); +const { sumTokens2 } = require("../helper/unwrapLPs"); -const chain = 'fantom' +const chain = "fantom"; -module.exports = { - fantom: { - tvl: getUniTVL({ - chain, - useDefaultCoreAssets: true, - factory: '0x7ceb5f3a6d1888eec74a41a5377afba5b97200ea', - }), - }, +async function staking(timestamp, block, chainBlocks, { api }) { + const tokens = await api.multiCall({ abi: poolAbi.rewardsToken, calls: pools }) + const tokensAndOwners = tokens.map((v, i) => [v, pools[i]]) + farms.forEach(({ token, contract}) => tokensAndOwners.push([token, contract])) + return sumTokens2({ api, tokensAndOwners}) } + +module.exports = { + fantom: { + tvl: getUniTVL({ + useDefaultCoreAssets: true, + factory: "0x7ceb5f3a6d1888eec74a41a5377afba5b97200ea", + }), + staking: staking + }, +}; diff --git a/projects/scaryswap/pool.json b/projects/scaryswap/pool.json new file mode 100644 index 00000000000..0e04add9281 --- /dev/null +++ b/projects/scaryswap/pool.json @@ -0,0 +1 @@ +{ "rewardsToken": "address:rewardsToken" } diff --git a/projects/scientixfinance/abi/AlpacaVault.json b/projects/scientixfinance/abi/AlpacaVault.json deleted file mode 100644 index a06bf07a475..00000000000 --- a/projects/scientixfinance/abi/AlpacaVault.json +++ /dev/null @@ -1,28 +0,0 @@ -[ - { - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalToken", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -] diff --git a/projects/scientixfinance/abi/ScToken.json b/projects/scientixfinance/abi/ScToken.json deleted file mode 100644 index 8ee5cd593a1..00000000000 --- a/projects/scientixfinance/abi/ScToken.json +++ /dev/null @@ -1,36 +0,0 @@ -[ - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function", - "constant": true - }, - { - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function", - "constant": true - } -] diff --git a/projects/scientixfinance/abi/Scientist.json b/projects/scientixfinance/abi/Scientist.json deleted file mode 100644 index 96aa6c7cb6a..00000000000 --- a/projects/scientixfinance/abi/Scientist.json +++ /dev/null @@ -1,15 +0,0 @@ -[ - { - "inputs": [], - "name": "totalDeposited", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -] diff --git a/projects/scientixfinance/abi/StakingPools.json b/projects/scientixfinance/abi/StakingPools.json deleted file mode 100644 index b0e13869736..00000000000 --- a/projects/scientixfinance/abi/StakingPools.json +++ /dev/null @@ -1,22 +0,0 @@ -[ - { - "inputs": [ - { - "internalType": "uint256", - "name": "_poolId", - "type": "uint256" - } - ], - "name": "getPoolTotalDeposited", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function", - "constant": true - } -] diff --git a/projects/scientixfinance/abi/Transmuter.json b/projects/scientixfinance/abi/Transmuter.json deleted file mode 100644 index bc6ab1aa55e..00000000000 --- a/projects/scientixfinance/abi/Transmuter.json +++ /dev/null @@ -1,15 +0,0 @@ -[ - { - "inputs": [], - "name": "totalSupplyScTokens", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -] diff --git a/projects/scientixfinance/abi/VotingEscrow.json b/projects/scientixfinance/abi/VotingEscrow.json deleted file mode 100644 index 9e47a2e26c5..00000000000 --- a/projects/scientixfinance/abi/VotingEscrow.json +++ /dev/null @@ -1,16 +0,0 @@ -[ - { - "inputs": [], - "name": "_totalLockedSCIX", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function", - "constant": true - } -] diff --git a/projects/scientixfinance/abi/YearnVaultAdapterWithIndirection.json b/projects/scientixfinance/abi/YearnVaultAdapterWithIndirection.json deleted file mode 100644 index 33d05beac90..00000000000 --- a/projects/scientixfinance/abi/YearnVaultAdapterWithIndirection.json +++ /dev/null @@ -1,16 +0,0 @@ -[ - { - "inputs": [], - "name": "totalValue", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function", - "constant": true - } -] diff --git a/projects/scientixfinance/index.js b/projects/scientixfinance/index.js index f37e6b38c8f..79d32727ba6 100644 --- a/projects/scientixfinance/index.js +++ b/projects/scientixfinance/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') /*================================================== Modules ==================================================*/ @@ -5,15 +6,6 @@ const axios = require("axios"); const BigNumber = require('bignumber.js'); const sdk = require("@defillama/sdk") -const scientistAbi = require('./abi/Scientist.json'); -const transmuteAbi = require('./abi/Transmuter.json'); -const transmuteAdapterAbi = require('./abi/YearnVaultAdapterWithIndirection.json'); -const stakingPoolsAbi = require('./abi/StakingPools.json'); -const scTokenAbi = require('./abi/ScToken.json'); -const votingEscrowAbi = require('./abi/VotingEscrow.json'); -const alpacaVaultAbi = require('./abi/AlpacaVault.json'); - - /*================================================== Address ==================================================*/ @@ -25,7 +17,7 @@ const Farm = '0x68145F3319F819b8E01Dfa3c094fa8205E9EfB9a'; const VotingEscrow = '0xF92aBA2A79dC133278DE2CDDB38Db775A4b5B024'; // Token -const BUSD = "0xe9e7cea3dedca5984780bafc599bd69add087d56"; +const BUSD = ADDRESSES.bsc.BUSD; const ibALPACA = "0xf1be8ecc990cbcb90e166b71e368299f0116d421"; const scUSD = "0x0E5C2b15666EEE4b66788E45CF4Da0392C070fa7"; const SCIX = "0x2CFC48CdFea0678137854F010b5390c5144C0Aa5"; @@ -45,7 +37,7 @@ async function getTokenBalance(token, account) { chain: 'bsc', target: token, params: [account], - abi: scTokenAbi.find(i => i.name === 'balanceOf') + abi: 'function balanceOf(address account) view returns (uint256)' }) return output } @@ -54,7 +46,7 @@ async function getTokenTotalSupply(token) { const { output } = await sdk.api.abi.call({ chain: 'bsc', target: token, - abi: scTokenAbi.find(i => i.name === 'totalSupply') + abi: "uint256:totalSupply" }) return output } @@ -64,7 +56,7 @@ async function totalDepositBUSD(vault) { const { output } = await sdk.api.abi.call({ chain: 'bsc', target: vault, - abi: scientistAbi.find(i => i.name === 'totalDeposited') + abi: "uint256:totalDeposited" }) return output } @@ -74,7 +66,7 @@ async function getTotalStakedScTokens(transmute) { const { output } = await sdk.api.abi.call({ chain: 'bsc', target: transmute, - abi: transmuteAbi.find(i => i.name === 'totalSupplyScTokens') + abi: "uint256:totalSupplyScTokens" }) return output } @@ -83,7 +75,7 @@ async function getAdapterTotalValue(transmuteAdapter) { const { output } = await sdk.api.abi.call({ chain: 'bsc', target: transmuteAdapter, - abi: transmuteAdapterAbi.find(i => i.name === 'totalValue') + abi: "uint256:totalValue" }) return output } @@ -94,7 +86,7 @@ async function getPoolTotalDeposited(contract, poolID) { chain: 'bsc', params: [poolID], target: contract, - abi: stakingPoolsAbi.find(i => i.name === 'getPoolTotalDeposited') + abi: 'function getPoolTotalDeposited(uint256 _poolId) view returns (uint256)' }) return output } @@ -110,7 +102,7 @@ async function getBUSDLpPrice(lpTokenAddress, BUSDAddress, scUSDAddress) { return new BigNumber(BUSDBalance).plus(new BigNumber(scUSDBalance)) .div(new BigNumber(totalSupply)); } catch (e) { - console.log(e); + sdk.log(e); } return 0; } @@ -119,7 +111,7 @@ async function getAalpacaTotal(vault) { const { output } = await sdk.api.abi.call({ chain: 'bsc', target: vault, - abi: alpacaVaultAbi.find(i => i.name === 'totalToken') + abi: "uint256:totalToken" }) return output } @@ -128,7 +120,7 @@ async function getAalpacaTotalSupply(vault) { const { output } = await sdk.api.abi.call({ chain: 'bsc', target: vault, - abi: alpacaVaultAbi.find(i => i.name === 'totalSupply') + abi: "uint256:totalSupply" }) return output } @@ -175,7 +167,7 @@ async function getSCIXTotalLocked(ve) { const { output } = await sdk.api.abi.call({ chain: 'bsc', target: ve, - abi: votingEscrowAbi.find(i => i.name === '_totalLockedSCIX') + abi: "uint256:_totalLockedSCIX" }) return output } diff --git a/projects/scion-finance/abis/scionVaultAbi.js b/projects/scion-finance/abis/scionVaultAbi.js index 964defe75a1..63f9445e390 100644 --- a/projects/scion-finance/abis/scionVaultAbi.js +++ b/projects/scion-finance/abis/scionVaultAbi.js @@ -1,15 +1,3 @@ module.exports = { - totalHoldings: { - inputs: [], - name: "totalHoldings", - outputs: [ - { - internalType: "uint256", - name: "totalUnderlyingHeld", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, + totalHoldings: "uint256:totalHoldings", }; diff --git a/projects/scion-finance/addresses.js b/projects/scion-finance/addresses.js index f3277a765aa..b0d1ee35544 100644 --- a/projects/scion-finance/addresses.js +++ b/projects/scion-finance/addresses.js @@ -1,4 +1,5 @@ -const USDC = "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"; +const ADDRESSES = require('../helper/coreAssets.json') +const USDC = ADDRESSES.ethereum.USDC; module.exports = { moonriver: [ diff --git a/projects/scream/index.js b/projects/scream/index.js index f992f35803e..26b8f3ef017 100644 --- a/projects/scream/index.js +++ b/projects/scream/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { getCompoundV2Tvl } = require('../helper/compound') const { transformFantomAddress } = require('../helper/portedTokens') const { staking } = require('../helper/staking') @@ -7,7 +8,7 @@ function lending(borrowed) { const transformAdress = await transformFantomAddress() const balances = await getCompoundV2Tvl("0x260e596dabe3afc463e75b6cc05d8c46acacfb09", "fantom", addr => { if (addr === "0xAd84341756Bf337f5a0164515b1f6F993D194E1f") { - return "0x0000000000085d4780b73119b644ae5ecd22b376" + return ADDRESSES.ethereum.TUSD } return transformAdress(addr) }, undefined, undefined, borrowed)(...params) diff --git a/projects/scrub/index.js b/projects/scrub/index.js index 788554545c3..e1f97c2b2da 100644 --- a/projects/scrub/index.js +++ b/projects/scrub/index.js @@ -1,47 +1,52 @@ -const { stakingPricedLP } = require("../helper/staking") -const { unknownTombs, sumTokensExport } = require("../helper/unknownTokens") -const { mergeExports } = require("../helper/utils") +const { unknownTombs, sumTokensExport } = require("../helper/unknownTokens"); +const { mergeExports } = require("../helper/utils"); -const token = ["0x49fB98F9b4a3183Cd88e7a115144fdf00fa6fB95","0xAA22aEBd60c9Eb653A0aE0Cb8b7367087a9B5Dba"] -const rewardPool = ["0x44B4a1e8f34Bb52ed39854aD218FF94D2D5b4800"] +const rewardPool = ["0xC0608A81Fe9850360B899D5eFC9f34D1cCd58D55"]; const lps = Object.values({ - 'LION-USDC-LP': '0xf2059ed015ec4ecc80f902d9fdbcd2a227bfe037', - 'TIGER-USDC-LP': '0xf6464c80448d6ec4deb7e8e5ec95b8eb768fbf69', - 'BEAR-WBTC-LP': '0x3d9e539fa44b970605658e25d18f816ce78c4007', -}) + "LION-USDC-LP": "0x59e38a5799B64fE17c5fAb7E0E5396C15E2acb7b", + "TIGER-USDC-LP": "0x6Eff7d2D494bc13949523e3504dE1994a6325F0A", + "BEAR-WBTC-LP": "0x9e334ce82f7659d2967C92a4a399aD694F63bbCF", +}); + + +const lpsPrice = Object.values({ + "LION-USDC-LP": "0x09d6561b3795ae237e42f7adf3dc83742e10a2e8", + "TIGER-USDC-LP": "0x7f8ed7d31795dc6f5fc5f6685b11419674361501", + "BEAR-WBTC-LP": "0xea848151acb1508988e56ee7689f004df2b15ced", +}); module.exports = unknownTombs({ lps, shares: [ - '0xD6597AA36DD90d7fCcBd7B8A228F2d5CdC88eAd0', //Tiger + "0x471F79616569343e8e84a66F342B7B433b958154", //Tiger ], rewardPool, - masonry: [ - '0x05CaB739FDc0A4CE0642604c78F307C6c543cD6d', - ], - chain: 'cronos', + masonry: ["0x0dB75Ef798a12312afd98d1884577664f4DD4411"], + chain: "kava", useDefaultCoreAssets: true, -}) -module.exports.misrepresentedTokens = true -module.exports.kava = require('../scrubKava/index.js').kava +}); +module.exports.misrepresentedTokens = true; const lionStaking = { + misrepresentedTokens: true, + cronos: { tvl: () => 0}, kava: { - staking: sumTokensExport({ chain: 'kava', owner: '0xBD98813A2F43587CCeC8c0489a5486d1f6Ef9C50', tokens: ['0x990e157fC8a492c28F5B50022F000183131b9026'],lps: ["0x59e38a5799B64fE17c5fAb7E0E5396C15E2acb7b"], useDefaultCoreAssets: true, }) - } -} -const lionStakingSecondRound = { - kava: { - staking: sumTokensExport({ chain: 'kava', owner: '0x3367716f07A85C04340B01D95B618d02c681Be2e', tokens: ['0x990e157fC8a492c28F5B50022F000183131b9026'],lps: ["0x59e38a5799B64fE17c5fAb7E0E5396C15E2acb7b"], useDefaultCoreAssets: true, }) - } -} + staking: sumTokensExport({ + chain: "kava", + tokensAndOwners: [ + ['0x990e157fC8a492c28F5B50022F000183131b9026', '0x199A0CD96065f50F9f7978c7BB47869503a9eD1E'], // Lion cave + ['0x471F79616569343e8e84a66F342B7B433b958154', '0x67041094c4fc1492A1AB988Fb8De0ab4A0a4A080'], // Tiger staking + ['0x990e157fC8a492c28F5B50022F000183131b9026', '0x3367716f07A85C04340B01D95B618d02c681Be2e'], // Lion ±Staking round 2 + ['0x990e157fC8a492c28F5B50022F000183131b9026', '0x83E315fC68F97EaFf04468D05eb084C9eD36f649'], // Lion Staking round 3 + ['0x990e157fC8a492c28F5B50022F000183131b9026', '0xBD98813A2F43587CCeC8c0489a5486d1f6Ef9C50'], // Lion Staking round 1 -//address tiger stake: 0x2d4F96b3cdAEB79165459199B93baD49A8533C23 -const tigerStaking = { - kava: { - staking: sumTokensExport({ chain: 'kava', owner: '0x67041094c4fc1492A1AB988Fb8De0ab4A0a4A080', tokens: ['0x471F79616569343e8e84a66F342B7B433b958154'],lps: ["0x6Eff7d2D494bc13949523e3504dE1994a6325F0A"], useDefaultCoreAssets: true, }) - } -} + ], + lps: lpsPrice, + useDefaultCoreAssets: true, + restrictTokenRatio: 100, + }), + }, +}; -module.exports = mergeExports([module.exports, lionStaking,lionStakingSecondRound, tigerStaking]) +module.exports = mergeExports([module.exports, lionStaking]); diff --git a/projects/scrubKava/index.js b/projects/scrubKava/index.js deleted file mode 100644 index 3cec8e00bda..00000000000 --- a/projects/scrubKava/index.js +++ /dev/null @@ -1,23 +0,0 @@ -const { unknownTombs } = require("../helper/unknownTokens") - -const token = ["0x990e157fC8a492c28F5B50022F000183131b9026","0x38481Fdc1aF61E6E72E0Ff46F069315A59779C65"] -const rewardPool = ["0xC0608A81Fe9850360B899D5eFC9f34D1cCd58D55"] -const lps = Object.values({ - 'LION-USDC-LP': '0x59e38a5799B64fE17c5fAb7E0E5396C15E2acb7b', - 'TIGER-USDC-LP': '0x6Eff7d2D494bc13949523e3504dE1994a6325F0A', - 'BEAR-WBTC-LP': '0x9e334ce82f7659d2967C92a4a399aD694F63bbCF', -}) - -module.exports = unknownTombs({ - lps, - shares: [ - '0x471F79616569343e8e84a66F342B7B433b958154', //Tiger - ], - rewardPool, - masonry: [ - '0x0dB75Ef798a12312afd98d1884577664f4DD4411', - ], - chain: 'kava', - useDefaultCoreAssets: true, -}) -module.exports.misrepresentedTokens = true diff --git a/projects/scrubinvest/index.js b/projects/scrubinvest/index.js new file mode 100644 index 00000000000..eae68ef0d16 --- /dev/null +++ b/projects/scrubinvest/index.js @@ -0,0 +1,70 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumUnknownTokens } = require("../helper/unknownTokens"); +async function tvl(_, _b, _cb, { api, }) { + + const calls = [ + { target: '0x075CA53543D304c02Ee692C0b691770AEB273dA4', params: '0x4402Cf5433D57266563979654d20887AcE672393' }, + { target: '0x69cEf0795FFFa66DfC4Ffc90E8Bd05c399388650', params: '0xa2355f35Ab85f1771FB1085a0e5b2599B8F47457' }, + { target: '0xe2C935041aEF672974A31d46c41A4F292982e621', params: '0x2c1C6aaB89272d07B7f78bFe93eefb6D2631Cf94' }, + { target: '0x46B9FCac1B698AE54b9c1D52A734338964e28AEE', params: '0x070110b0cAd64833b1a6a9E86337A4e4eE786607' }, + { target: '0xA250a3b6a5e5E8b398092537951F8Bd80639ed5c', params: '0xE04539bD52618B7d197Be54B3e4D80732082906E' }, + { target: '0xCa0d15B4BB6ad730fE40592f9E25A2E052842c92', params: '0xEa892552BD31A20F42ceb3476D6A280c405883d0' }, + { target: '0xa27a1f03479cfe4B0b97Fd8c772a84aD815C1946', params: '0xa1FA74fD861FFf2fc5f7a618A05beB12709fB419' }, + { target: '0x74AE6bB3138DB1969c52f39e2c311d997528633B', params: '0x2D1D648c2AEdf62037f2b80f9cC8c93258179380' }, + { target: '0x8EEA85dA61b397EaB933C001DAAD6fC1C5A4c67C', params: '0xcf4673F714183C42DADc1B42DAC21BE09cfc3684' }, + { target: '0xc28fcef5970fd23e5bfcdc31ce1ba72ef98cc70a', params: '0xef7541FCa94988fA423bC418a854f7967f83a3E0' }, + { target: '0x371d33963fb89ec9542a11ccf955b3a90391f99f', params: '0x43Ac7f627e41EBDa7515FEaCa425306AaB9cB602' }, + { target: '0x1E5573b2A7C1D08112d0Ff22e9F2D8EFc9583532', params: '0x9e890FBD4295D92c41fA12a2083b51C387699Fd8' }, + { target: '0x8fE243F8B47107c468537D74514d7c52Cd61E937', params: '0x56a9c9230d6D3b7bF147c10fdDBCD8F2eB1a2B6d' }, + //NEW LPs 14/07 - GAUGE / CONTRACT + { target: '0x5383dEB37479599a33584f7Bbc346ab299e30FF0', params: '0x79eb3848B7B4630D1d883172f8e56B2e8fb18521' }, + { target: '0x776d2Ae19FC4c5982D5b20d8c14BCDae09755796', params: '0x1C415Ce79D0A18A4aA835D3d9083d2aF4d7894FC' }, + { target: '0x1f343A11b317EB54F08D80FD3cF9d706eDA5982c', params: '0xF35265f9713FD7ab6a27D387B2D02C1306FFB606' }, + + ] + const bals = await api.multiCall({ abi: 'erc20:balanceOf', calls }) + const lps = await api.multiCall({ abi: 'address:stake', calls: calls.map(i => i.target)}) + api.addTokens(lps, bals) + + return sumUnknownTokens({ + api, + tokensAndOwners: [ + // YieldOptimizers Mare + ['0x066C98E48238e8D77006a5fA14EC3B080Fd2848d', '0xcd017B495DF1dE2DC8069b274e2ddfBB78561176'], + ['0x92e17FD2DA50775FBD423702E4717cCD7FB2A6BB', '0x88555c4d8e53ffB223aB5baDe0B5e6B2Cd3966c4'], + ['0x58333b7D0644b52E0e56cC3803CA94aF9e0B52C3', '0xB4Ba7ba722eacAE8f1e4c6213AF05b5E8B27dbdB'], + ['0x24149e2D0D3F79EBb7Fc464b09e3628dE395b39D', '0xB9774bB2A18Af59Ec9bf86dCaeC07473A2D2F230'], + ['0x0B6c2a9d4d739778dF6cD1cf815754BD1438063c', '0x3CcA2C0d433E00433082ba16e968CA11dA6Dc156'], + ['0x2f9e61D4E9A9A3694CcDc287c790EA5cc3302E88', '0x1504B9EDdD57Ed8252b3b3b407DdE27B72A80790'], + ['0x350c4A0aC240755Bb6432FeB907eCAFbbBc75770', '0xC05021F3b3601BF33aB59dc75577B85985ACaab7'], + ['0x8E00102d96b34BEF29F3E1e0e5DBd0a611Cac312', '0x6d81FcA3abD89Bd89D400281aE5f1Ee0D62Cd16f'], + // also count base assets if available + [ADDRESSES.telos.ETH, '0xcd017B495DF1dE2DC8069b274e2ddfBB78561176'], + [ADDRESSES.moonriver.USDT, '0x88555c4d8e53ffB223aB5baDe0B5e6B2Cd3966c4'], + [ADDRESSES.shiden.ETH, '0xB4Ba7ba722eacAE8f1e4c6213AF05b5E8B27dbdB'], + [ADDRESSES.kava.WKAVA, '0xB9774bB2A18Af59Ec9bf86dCaeC07473A2D2F230'], + [ADDRESSES.moonriver.USDC, '0x3CcA2C0d433E00433082ba16e968CA11dA6Dc156'], + [ADDRESSES.moonriver.USDC, '0x1504B9EDdD57Ed8252b3b3b407DdE27B72A80790'], + [ADDRESSES.kava.WKAVA, '0xC05021F3b3601BF33aB59dc75577B85985ACaab7'], + // New Scrub Pool + ['0x471F79616569343e8e84a66F342B7B433b958154', '0x67041094c4fc1492A1AB988Fb8De0ab4A0a4A080'], + + // WETH + + // Vaults Equilibre Scrub + // ['0xeA848151ACB1508988e56Ee7689F004df2B15ced', "0x4402Cf5433D57266563979654d20887AcE672393"], + // ['0x7f8ed7d31795dc6f5fc5f6685b11419674361501', "0xa2355f35Ab85f1771FB1085a0e5b2599B8F47457"], + // ['0x09d6561b3795ae237e42f7adf3dc83742e10a2e8', "0x2c1C6aaB89272d07B7f78bFe93eefb6D2631Cf94"], + ], + useDefaultCoreAssets: true, + resolveLP: true, + lps + }) +} + +module.exports = { + misrepresentedTokens: true, + kava: { + tvl, + } +}; diff --git a/projects/sealightswap/index.js b/projects/sealightswap/index.js index 06735b2f066..34a57823e2a 100644 --- a/projects/sealightswap/index.js +++ b/projects/sealightswap/index.js @@ -5,7 +5,6 @@ module.exports = { polygon: { tvl: getUniTVL({ factory: '0xd0B30Fc63169bAaa3702ad7ec33EBe3f9e8627c0', - chain: 'polygon', useDefaultCoreAssets: false }) }, diff --git a/projects/seashell/index.js b/projects/seashell/index.js new file mode 100644 index 00000000000..e78ce926106 --- /dev/null +++ b/projects/seashell/index.js @@ -0,0 +1,13 @@ +const { sumTokensExport } = require("../helper/unwrapLPs"); + +const SGLP_TOKEN = "0x5402B5F40310bDED796c7D0F3FF6683f5C0cFfdf"; +const BLUEBERRY_GLP_COMPOUNDER_CONTRACT = + "0x5BAC5eEfA13696Cf815388021235b215587263Ea"; + +module.exports = { + methodology: "Total assets in Seashell's Blueberry GLP Compounder contract", + start: 66190371, + arbitrum: { + tvl: sumTokensExport({ owner: BLUEBERRY_GLP_COMPOUNDER_CONTRACT, tokens: [SGLP_TOKEN]}), + }, +}; diff --git a/projects/sector-fi/index.js b/projects/sector-fi/index.js new file mode 100644 index 00000000000..9f18ce26a26 --- /dev/null +++ b/projects/sector-fi/index.js @@ -0,0 +1,49 @@ +const { getLogs } = require('../helper/cache/getLogs') + +const config = { + ethereum: { + factory: '0xcb2e195d92e9da36ea1f186b8df09aade31a5dda', + fromBlock: 16567503, + }, + optimism: { + factory: '0x4adfe3ed020dac0ff69ca212f32be3b71185399e', + fromBlock: 75797008, + }, + arbitrum: { + factory: '0x7cf580c74d6974f4d4e7eb6edcf052770f9e2645', + fromBlock: 63190862, + }, + moonriver: { + factory: '0xc85f25eb74eaa5ad74eb6d9e8bdf686089a156d5', + fromBlock: 3673027, + }, +} + +module.exports = {}; + +Object.keys(config).forEach(chain => { + const { factory, fromBlock, } = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const logs = await getLogs({ + api, + target: factory, + topic: 'AddVault(address,string)', + fromBlock, + eventAbi: 'event AddVault(address vault, string vaultType)', + onlyArgs: true, + }) + + const vaults = logs.filter(i => i.vaultType === 'SCYVault' || i.vaultType === 'SCYWEpochVault').map(i => i.vault) + const bals = (await api.multiCall({ abi: 'uint256:getTvl', calls: vaults, permitFailure: true, })).map(i => i ?? 0) + const tokens = await api.multiCall({ abi: 'address:underlying', calls: vaults }) + api.addTokens(tokens, bals.map(i => i || 0)) + + // Add agg vault floats. + const aggregators = logs.filter(i => i.vaultType === 'AggregatorVault' || i.vaultType === 'AggregatorWEpochVault').map(i => i.vault) + const aggFloats = await api.multiCall({ abi: 'uint256:getFloat', calls: aggregators }) + const aggTokens = await api.multiCall({ abi: 'address:underlying', calls: aggregators }) + api.addTokens(aggTokens, aggFloats.map(i => i || 0)) + } + } +}) diff --git a/projects/securedao/index.js b/projects/securedao/index.js index 02e9af33f4e..7d9391d5d8c 100644 --- a/projects/securedao/index.js +++ b/projects/securedao/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const {ohmTvl} = require("../helper/ohm"); const scr = "0x8183C18887aC4386CE09Dbdf5dF7c398DAcB2B5a"; @@ -7,7 +8,7 @@ const stakingContract = "0x3d97040e407078823891C59BB07eadb2dDF3AE32" module.exports = { misrepresentedTokens: true, ...ohmTvl(treasury, [ - ["0x82f0b8b456c1a451378467398982d4834b6829c1", false], // MIM + [ADDRESSES.fantom.MIM, false], // MIM ["0x468c174cc015d4a697586C0a99F95E045F7e6f91", true] // scrMim SPIRIT LP ], "fantom", stakingContract, scr, undefined, undefined, false) } \ No newline at end of file diff --git a/projects/securofinance/abiLci.json b/projects/securofinance/abiLci.json index c485b99d665..09d3d4c314a 100644 --- a/projects/securofinance/abiLci.json +++ b/projects/securofinance/abiLci.json @@ -1,9 +1,3 @@ -{ - "getAllPoolInUSD": { - "inputs": [], - "name": "getAllPoolInUSD", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - } -} +{ + "getAllPoolInUSD": "uint256:getAllPoolInUSD" +} \ No newline at end of file diff --git a/projects/seeder/abi.json b/projects/seeder/abi.json index 0c47494d05e..dfd24a074b8 100644 --- a/projects/seeder/abi.json +++ b/projects/seeder/abi.json @@ -1,94 +1,6 @@ { - "getAllFarms": { - "inputs": [], - "name": "getAllFarms", - "outputs": [ - { - "components": [ - { - "internalType": "contract IERC20", - "name": "stakeToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "allocationPoint", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastUpdateBlock", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "rewardPerStakeWithBuffer", - "type": "uint256" - } - ], - "internalType": "struct BigFarmV3.Farm[]", - "name": "", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - "symbol": { - "constant": true, - "inputs": [], - "name": "symbol", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "getIBPrice": { - "inputs": [ - { - "internalType": "address", - "name": "originToken", - "type": "address" - } - ], - "name": "getIBPrice", - "outputs": [ - { - "internalType": "uint256", - "name": "ibPriceWithPrecision", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "precision", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getNativeIBPrice": { - "inputs": [], - "name": "getNativeIBPrice", - "outputs": [ - { - "internalType": "uint256", - "name": "ibPriceWithPrecision", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "precision", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } + "getAllFarms": "function getAllFarms() view returns (tuple(address stakeToken, uint256 allocationPoint, uint256 lastUpdateBlock, uint256 rewardPerStakeWithBuffer)[])", + "symbol": "string:symbol", + "getIBPrice": "function getIBPrice(address originToken) view returns (uint256 ibPriceWithPrecision, uint256 precision)", + "getNativeIBPrice": "function getNativeIBPrice() view returns (uint256 ibPriceWithPrecision, uint256 precision)" } \ No newline at end of file diff --git a/projects/seeder/index.js b/projects/seeder/index.js index c7a48f3d5b2..adf7db32942 100644 --- a/projects/seeder/index.js +++ b/projects/seeder/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); const { transformBscAddress } = require("../helper/portedTokens"); @@ -6,7 +7,7 @@ const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); const farmContract = "0x1aF28E7b1A03fA107961897a28449F4F9768ac75"; const bankContract = "0x99dD1c7a2893931D209fA5C57FE65f34d4C11db8"; const LEAF = "0x1cbddf83de068464eba3a4e319bd3197a7eea12c"; -const WBNB = "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c"; +const WBNB = ADDRESSES.bsc.WBNB; const bscTvl = async (chainBlocks) => { const balances = {}; diff --git a/projects/selfex/index.js b/projects/selfex/index.js new file mode 100644 index 00000000000..78a9d22d469 --- /dev/null +++ b/projects/selfex/index.js @@ -0,0 +1,11 @@ +const { getUniTVL } = require('../helper/unknownTokens') +const chains = ['kava'] + +module.exports = { + misrepresentedTokens: true, + methodology: "Using DefiLlama's SDK for making on-chain calls to Selfex Factory Contract to iterate over Liquidity Pools & count token balances therein.", +}; + +chains.forEach(chain => { + module.exports[chain] = { tvl: getUniTVL({ factory: '0x98a3567692Eb055fA1F05D616cad494DE9B05512', useDefaultCoreAssets: true, }) } +}) diff --git a/projects/sencha/index.js b/projects/sencha/index.js index 6331140df6c..2eab65c5ff2 100644 --- a/projects/sencha/index.js +++ b/projects/sencha/index.js @@ -1,10 +1,11 @@ -const utils = require('../helper/utils') +const { getConfig } = require('../helper/cache') + const {getTokenAccountBalance} = require('../helper/solana'); async function tvl() { // this is a list of token accounts that are reserves of a swap // more details: https://github.com/senchahq/sencha-registry - const { data: senchaTokenAccounts } = await utils.fetchURL( + const senchaTokenAccounts= await getConfig('sencha', "https://raw.githubusercontent.com/SenchaHQ/sencha-registry/master/data/known-accounts.json" ); diff --git a/projects/senpai/index.js b/projects/senpai/index.js index c8f3e72380e..08b229e9b93 100644 --- a/projects/senpai/index.js +++ b/projects/senpai/index.js @@ -1,16 +1,17 @@ +const ADDRESSES = require('../helper/coreAssets.json') const {ohmTvl} = require('../helper/ohm') const transforms = { - "0xf74195bb8a5cf652411867c5c2c5b8c2a402be35": "0x6b175474e89094c44da98b954eedeac495271d0f", - "0x66a2a913e447d6b4bf33efbec43aaef87890fbbc": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", + [ADDRESSES.boba.DAI]: ADDRESSES.ethereum.DAI, + [ADDRESSES.boba.USDC]: ADDRESSES.ethereum.USDC, } module.exports={ ...ohmTvl("0xbfFC76cDC85A496404662dc7D8A270cE9567C544", [ - ["0xf74195Bb8a5cf652411867c5C2C5b8C2a402be35", false], //dai + [ADDRESSES.boba.DAI, false], //dai ["0xF582bC0437a1F1D0476f3a0c8efeEc8d05E6bc96", true], ["0x32fDfeA5CdCe7E417818ed5093E8bD4cA85dfE06", true], - ["0x66a2A913e447d6b4BF33EFbec43aAeF87890FBbc", false] //usdc + [ADDRESSES.boba.USDC, false] //usdc ], "boba", "0xAECFc89Da2f125D893Da6Fb6d157b5DfF1F0aD9E", "0xaC3a4aF1778203c8B651dAfA73cEd5b79c80F239", addr=> transforms[addr.toLowerCase()] , diff --git a/projects/sense/index.js b/projects/sense/index.js index 4ec01fc4fe6..6caaf37f813 100644 --- a/projects/sense/index.js +++ b/projects/sense/index.js @@ -1,9 +1,11 @@ const sdk = require("@defillama/sdk"); -const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') -const { getChainTransform } = require('../helper/portedTokens') +const BigNumber = require("bignumber.js"); +const { nullAddress } = require("../helper/unwrapLPs"); +const { getChainTransform } = require("../helper/portedTokens"); +const { getLogs } = require("../helper/cache/getLogs"); const DIVIDER = "0x86bA3E96Be68563E41c2f5769F1AF9fAf758e6E0"; -const SPACE_FACTORY = "0x5f6e8e9C888760856e22057CBc81dD9e0494aA34"; +const SPACE_FACTORY = "0x9e629751b3FE0b030C219e567156adCB70ad5541"; const BALANCER_VAULT = "0xBA12222222228d8Ba445958a75a0704d566BF2C8"; const DIVIDER_INIT_BLOCK = 14427177; const DIVIDER_INIT_TS = 1647831440; @@ -11,13 +13,12 @@ const DIVIDER_INIT_TS = 1647831440; // Converts a bytes32 into an address or, if there is more data, slices an address out of the first 32 byte word const toAddress = (data) => `0x${data.slice(64 - 40 + 2, 64 + 2)}`; -async function tvl(_time, block) { - const transform = await getChainTransform('ethereum') - const { output: seriesLogs } = await sdk.api.util.getLogs({ +async function tvl(_time, block, _1, { api }) { + const transform = await getChainTransform("ethereum"); + const seriesLogs = await getLogs({ target: DIVIDER, topic: "SeriesInitialized(address,uint256,address,address,address,address)", - keys: [], - toBlock: block, + api, fromBlock: DIVIDER_INIT_BLOCK, }); @@ -32,53 +33,148 @@ async function tvl(_time, block) { return { ...acc, [adapter]: [maturity] }; } }, {}); - const adapters = Object.keys(series) + const adapters = Object.keys(series).filter(i => i.toLowerCase() !== '0x0ed600eecf445b71ae3f8170cd368439e2739289'); const { output: targets } = await sdk.api.abi.multiCall({ abi: abi.target, - calls: adapters.map(i => ({ target: i })), + calls: adapters.map((i) => ({ target: i })), block, - }) - const toa = targets.map(i => ([i.output, i.input.target])) - const adapterTargetCache = {} - targets.forEach(i => adapterTargetCache[i.input.target] = i.output) - const balances = await sumTokens2({ block, tokensAndOwners: toa}) - const poolCalls = Object.entries(series).map(([addr, maturities]) => maturities.map(m => ({ params: [addr, m]})) ).flat() + }); + const { output: underlyings } = await sdk.api.abi.multiCall({ + abi: abi.underlying, + calls: adapters.map((i) => ({ target: i })), + block, + }); + const { output: scales } = await sdk.api.abi.multiCall({ + abi: abi.scale, + calls: adapters.map((i) => ({ target: i })), + block, + }); + + const { output: targetDecimals } = await sdk.api.abi.multiCall({ + abi: "erc20:decimals", + calls: targets.map((i) => ({ target: i.output })), + block, + }); + const { output: underlyingDecimals } = await sdk.api.abi.multiCall({ + abi: "erc20:decimals", + calls: underlyings.map((i) => ({ target: i.output })), + block, + }); + + const balances = {}; + const adapterTargetCache = {}; + const adapterUnderlyingCache = {}; + const adapterScaleCache = {}; + const adapterDecimalDeltaCache = {}; + + targets.forEach((i) => (adapterTargetCache[i.input.target] = i.output)); + underlyings.forEach( + (i) => (adapterUnderlyingCache[i.input.target] = i.output) + ); + scales.forEach((i) => (adapterScaleCache[i.input.target] = i.output)); + + const { output: adapterTargetBalances } = await sdk.api.abi.multiCall({ + abi: "erc20:balanceOf", + calls: adapters.map((i) => ({ target: adapterTargetCache[i], params: i })), + block, + }); + + adapterTargetBalances.forEach((i) => { + const adapterAddress = i.input.params[0]; + const targetAddress = adapterTargetCache[adapterAddress]; + const underlyingAddress = adapterUnderlyingCache[adapterAddress]; + + const scale = adapterScaleCache[adapterAddress]; + + const targetDec = targetDecimals.find( + (j) => j.input.target === targetAddress + ).output; + + const underlyingDec = underlyingDecimals.find( + (j) => j.input.target === underlyingAddress + ).output; + + const adapterDecimalDelta = parseInt(targetDec) - parseInt(underlyingDec); + adapterDecimalDeltaCache[adapterAddress] = adapterDecimalDelta; + + const underlyingBalance = new BigNumber(i.output) + .times(scale) // always 18 decimals + .div(`1e${18 + adapterDecimalDelta}`) // convert to underlying decimals (take out 18 from scale multiplication, then add or subtract based tDecimals - uDecimals) + .toFixed(0); + + sdk.util.sumSingleBalance( + balances, + transform(underlyingAddress), + underlyingBalance + ); + }); + + const poolCalls = Object.entries(series).filter(([i]) => i.toLowerCase() !== '0x0ed600eecf445b71ae3f8170cd368439e2739289') + .map(([addr, maturities]) => maturities.map((m) => ({ params: [addr, m] }))) + .flat(); + let { output: poolAddresses } = await sdk.api.abi.multiCall({ target: SPACE_FACTORY, abi: abi.pools, calls: poolCalls, block, - }) - poolAddresses = poolAddresses.filter(i => i.output !== nullAddress) - const poolToTargetMapping = {} - poolAddresses.forEach(i => poolToTargetMapping[i.output] = adapterTargetCache[i.input.params[0]]) - poolAddresses = poolAddresses.map(i => i.output) + }); + poolAddresses = poolAddresses.filter((i) => i.output !== nullAddress); + + const poolToAdapterMapping = {}; + + poolAddresses.forEach( + (i) => (poolToAdapterMapping[i.output] = i.input.params[0]) + ); + + poolAddresses = poolAddresses.map((i) => i.output); + let { output: ptis } = await sdk.api.abi.multiCall({ abi: abi.pti, - calls: poolAddresses.map(i => ({ target: i})), + calls: poolAddresses.map((i) => ({ target: i })), block, - }) + }); + let { output: poolIds } = await sdk.api.abi.multiCall({ abi: abi.getPoolId, - calls: poolAddresses.map(i => ({ target: i})), + calls: poolAddresses.map((i) => ({ target: i })), block, - }) + }); - ptis = ptis.map(i => parseInt(i.output)) + ptis = ptis.map((i) => parseInt(i.output)); const { output: poolBalances } = await sdk.api.abi.multiCall({ target: BALANCER_VAULT, abi: abi.getPoolTokens, - calls: poolIds.map(i => ({ params: i.output})), + calls: poolIds.map((i) => ({ params: i.output })), block, - }) + }); + + poolBalances.forEach(({ output: { balances: poolBalance } }, i) => { + const adapterAddress = poolToAdapterMapping[poolAddresses[i]]; + const underlyingAddress = adapterUnderlyingCache[adapterAddress]; + const adapterDecimalDelta = adapterDecimalDeltaCache[adapterAddress]; + const scale = adapterScaleCache[adapterAddress]; + + const underlyingBalance = new BigNumber(poolBalance[1 - ptis[i]]) + .times(scale) + .div(`1e${18 + adapterDecimalDelta}`) // convert to underlying decimals + .toFixed(0); + + sdk.util.sumSingleBalance( + balances, + transform(underlyingAddress), + underlyingBalance + ); + }); - poolBalances.forEach(({ output: {balances: poolBalance}, }, i) => sdk.util.sumSingleBalance(balances,transform(poolToTargetMapping[poolAddresses[i]]),poolBalance[1-ptis[i]])) - return balances + return balances; } module.exports = { + timetravel: true, doublecounted: true, + misrepresentedTokens: true, methodology: "TVL is comprised of the sum of yield-bearing assets in Sense, which includes those assets being used both 1) to issue fixed term Sense tokens (PTs/YTs) and 2) as reserves in our Space AMM Pools. Data is collected via the DeFi Llama SDK.", start: DIVIDER_INIT_TS, @@ -88,96 +184,12 @@ module.exports = { }; const abi = { - target: { - inputs: [], - name: "target", - outputs: [ - { - internalType: "address", - name: "", - type: "address", - }, - ], - stateMutability: "view", - type: "function", - }, - pools: { - inputs: [ - { - internalType: "address", - name: "", - type: "address", - }, - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - name: "pools", - outputs: [ - { - internalType: "address", - name: "", - type: "address", - }, - ], - stateMutability: "view", - type: "function", - }, - getPoolId: { - inputs: [], - name: "getPoolId", - outputs: [ - { - internalType: "bytes32", - name: "", - type: "bytes32", - }, - ], - stateMutability: "view", - type: "function", - }, - pti: { - inputs: [], - name: "pti", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, - getPoolTokens: { - inputs: [ - { - internalType: "bytes32", - name: "poolId", - type: "bytes32", - }, - ], - name: "getPoolTokens", - outputs: [ - { - internalType: "contract IERC20[]", - name: "tokens", - type: "address[]", - }, - { - internalType: "uint256[]", - name: "balances", - type: "uint256[]", - }, - { - internalType: "uint256", - name: "lastChangeBlock", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, + target: "address:target", + underlying: "address:underlying", + scale: "uint256:scale", + pools: "function pools(address, uint256) view returns (address)", + getPoolId: "function getPoolId() view returns (bytes32)", + pti: "uint256:pti", + getPoolTokens: + "function getPoolTokens(bytes32 poolId) view returns (address[] tokens, uint256[] balances, uint256 lastChangeBlock)", }; diff --git a/projects/sentiment/index.js b/projects/sentiment/index.js index 37cdbb118b9..c0c8973ab54 100644 --- a/projects/sentiment/index.js +++ b/projects/sentiment/index.js @@ -1,50 +1,42 @@ -const sdk = require("@defillama/sdk") -const {getBlock} = require("../helper/getBlock") +const ADDRESSES = require('../helper/coreAssets.json') +const { graphFetchById } = require('../helper/http') -async function tvl(timestamp, ethBlock, chainBlocks){ - const chain = "arbitrum" - const block = await getBlock(timestamp, chain, chainBlocks, true) - const tokens = (await sdk.api.abi.call({ - block, chain, - target: "0x17b07cfbab33c0024040e7c299f8048f4a49679b", - abi: {"inputs":[],"name":"getAllLTokens","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"} - })).output - const assets = (await sdk.api.abi.multiCall({ - block, chain, - calls: tokens.map(t=>({target:t})), - abi: {"inputs":[],"name":"asset","outputs":[{"internalType":"contract ERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"} - })).output - const totalAssets = (await sdk.api.abi.multiCall({ - block, chain, - calls: tokens.map(t=>({target:t})), - abi: {"inputs":[],"name":"totalAssets","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"} - })).output - const balances = assets.reduce((bals, asset, i)=>{ - sdk.util.sumSingleBalance(bals, `arbitrum:${asset.output}`, totalAssets[i].output) - return bals; - }, {}) - const userAccounts = (await sdk.api.abi.call({ - block, chain, - target: "0x17b07cfbab33c0024040e7c299f8048f4a49679b", - abi: {"inputs":[],"name":"getAllAccounts","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"} - })).output - const equity = (await sdk.api.abi.multiCall({ - block, chain, - calls: userAccounts.map(t=>({target:"0xc0ac97A0eA320Aa1E32e9DEd16fb580Ef3C078Da", params: [t]})), - abi: {"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}, - })).output - const borrows = (await sdk.api.abi.multiCall({ - block, chain, - calls: userAccounts.map(t=>({target:"0xc0ac97A0eA320Aa1E32e9DEd16fb580Ef3C078Da", params: [t]})), - abi: {"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getBorrows","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"} - })).output - for(let i=0; i i.id) + const [equity, borrows] = await Promise.all([ + api.multiCall({ target: "0xc0ac97A0eA320Aa1E32e9DEd16fb580Ef3C078Da", calls: userAccounts, abi: "function getBalance(address account) view returns (uint256)", permitFailure: true, }), + api.multiCall({ target: "0xc0ac97A0eA320Aa1E32e9DEd16fb580Ef3C078Da", calls: userAccounts, abi: "function getBorrows(address account) view returns (uint256)", permitFailure: true, }), + ]) + for (let i = 0; i < equity.length; i++) { + const equity_ = equity[i] ?? 0 + const borrow = borrows[i] ?? 0 + api.add(ADDRESSES.arbitrum.WETH, equity_ - borrow) + } } -module.exports={ - misrepresentedTokens: true, - arbitrum:{tvl} -} \ No newline at end of file +module.exports = { + misrepresentedTokens: true, + arbitrum: { tvl, }, + hallmarks: [ + [Math.floor(new Date('2023-04-04') / 1e3), '1M hack'], + ], +}; + +const query = `query get_accounts($lastId: String!, $block: Int!) { + accounts( + first: 1000 + block: {number: $block} + where: {and: [{id_gt: $lastId}, {or: [{balance_gt: 0}, {debt_gt: 0}]}]} + ) { + id + balance + debt + } +}` \ No newline at end of file diff --git a/projects/set-protocol/abis/getPositions.json b/projects/set-protocol/abis/getPositions.json deleted file mode 100644 index 055f1020f38..00000000000 --- a/projects/set-protocol/abis/getPositions.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "inputs": [], - "name": "getPositions", - "outputs": [ - { - "components": [ - { - "internalType": "address", - "name": "component", - "type": "address" - }, - { - "internalType": "address", - "name": "module", - "type": "address" - }, - { - "internalType": "int256", - "name": "unit", - "type": "int256" - }, - { - "internalType": "uint8", - "name": "positionState", - "type": "uint8" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "internalType": "struct ISetToken.Position[]", - "name": "", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" -} diff --git a/projects/set-protocol/abis/getReserves.json b/projects/set-protocol/abis/getReserves.json deleted file mode 100644 index e3f6fcc11d8..00000000000 --- a/projects/set-protocol/abis/getReserves.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "constant": true, - "inputs": [], - "name": "getReserves", - "outputs": [ - { - "internalType": "uint112", - "name": "_reserve0", - "type": "uint112" - }, - { - "internalType": "uint112", - "name": "_reserve1", - "type": "uint112" - }, - { - "internalType": "uint32", - "name": "_blockTimestampLast", - "type": "uint32" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" -} diff --git a/projects/set-protocol/abis/getSets.json b/projects/set-protocol/abis/getSets.json deleted file mode 100644 index 2a0787e11fa..00000000000 --- a/projects/set-protocol/abis/getSets.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "inputs": [], - "name": "getSets", - "outputs": [ - { - "internalType": "address[]", - "name": "", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" -} diff --git a/projects/set-protocol/abis/totalSupply.json b/projects/set-protocol/abis/totalSupply.json deleted file mode 100644 index 33dd41d1ce2..00000000000 --- a/projects/set-protocol/abis/totalSupply.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" -} diff --git a/projects/set-protocol/v1.js b/projects/set-protocol/v1.js index 591d5fe2a1e..8db98ead55d 100644 --- a/projects/set-protocol/v1.js +++ b/projects/set-protocol/v1.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk'); const BigNumber = require('bignumber.js'); @@ -9,19 +10,19 @@ Settings const cTokenDecimalScale = BigNumber("10").pow(18); const tokens = [ - '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', // WETH - '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599', // WBTC - '0x514910771AF9Ca656af840dff83E8264EcF986CA', // LINK - '0x89d24A6b4CcB1B6fAA2625fE562bDD9a23260359', // SAI - '0x6B175474E89094C44Da98b954EedeAC495271d0F', // DAI - '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', // USDC + ADDRESSES.ethereum.WETH, + ADDRESSES.ethereum.WBTC, + ADDRESSES.ethereum.LINK, + ADDRESSES.ethereum.SAI, + ADDRESSES.ethereum.DAI, + ADDRESSES.ethereum.USDC, '0x39AA39c021dfbaE8faC545936693aC917d5E7563', // cUSDC '0x5d3a536e4d6dbd6114cc1ead35777bab948e3643', // cDAI ] const cTokensMap = { - '0x39AA39c021dfbaE8faC545936693aC917d5E7563': '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', // cUSDC: USDC - '0x5d3a536e4d6dbd6114cc1ead35777bab948e3643': '0x6B175474E89094C44Da98b954EedeAC495271d0F' // cDAI: DAI + '0x39AA39c021dfbaE8faC545936693aC917d5E7563': ADDRESSES.ethereum.USDC, // cUSDC: USDC + '0x5d3a536e4d6dbd6114cc1ead35777bab948e3643': ADDRESSES.ethereum.DAI // cDAI: DAI } /*================================================== @@ -51,18 +52,7 @@ module.exports = async function tvl(timestamp, block) { target: cToken } }), - abi: { - "constant": true, - "inputs": [], - "name": "exchangeRateStored", - "type": "function", - "outputs": [ - { - "name":"", - "type":"uint256" - } - ] - } + abi: "uint256:exchangeRateStored" })).output.reduce(function(map, object) { map[object.input.target] = object.output; return map; diff --git a/projects/set-protocol/v2.js b/projects/set-protocol/v2.js index fc5ef660479..148e05fa7d8 100644 --- a/projects/set-protocol/v2.js +++ b/projects/set-protocol/v2.js @@ -4,23 +4,10 @@ const BigNumber = require('bignumber.js'); const SUPPLY_SCALE = BigNumber("10").pow(18) const START_BLOCK = 10830496; -const EXTERNAL_POSITION = '1'; -const getSets = require('./abis/getSets.json'); -const getPositions = require('./abis/getPositions.json'); -const totalSupply = require('./abis/totalSupply.json'); -const getReserves = require('./abis/getReserves.json'); - -const pairAddresses = { - '0xBb2b8038a1640196FbE3e38816F3e67Cba72D940': [ - '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599', - '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2' - ], - '0xA478c2975Ab1Ea89e8196811F51A7B7Ade33eB11': [ - '0x6B175474E89094C44Da98b954EedeAC495271d0F', - '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2' - ], -}; +const getSets = "address[]:getSets" +const getPositions = 'function getPositions() view returns (tuple(address component, address module, int256 unit, uint8 positionState, bytes data)[])'; +const totalSupply = "uint256:totalSupply"; /*================================================== TVL @@ -60,7 +47,6 @@ module.exports = async function tvl(timestamp, block) { }), })).output; - let uniswapPositions = {}; positionsForSets.forEach(function(positionForSet, i) { const setSupply = BigNumber(supplies[i].output); if(positionForSet.output === null){ @@ -70,7 +56,6 @@ module.exports = async function tvl(timestamp, block) { const componentAddress = position[0]; const positionUnits = BigNumber(position[2]); - const isExternalPosition = position[3] == EXTERNAL_POSITION; balances[componentAddress] = BigNumber(balances[componentAddress] || 0).plus((positionUnits).times(setSupply).div(SUPPLY_SCALE)).toFixed(0); }); }); diff --git a/projects/sevenswap/index.js b/projects/sevenswap/index.js new file mode 100644 index 00000000000..f3b49132d04 --- /dev/null +++ b/projects/sevenswap/index.js @@ -0,0 +1,7 @@ +const { getUniTVL } = require('../helper/unknownTokens') +module.exports = { + kava: { tvl: getUniTVL({ + factory: '0x72b97F61fdb9a3aD34cd284B2f9c55d04127019c', + useDefaultCoreAssets: true, + })} +} diff --git a/projects/sfinance/index.js b/projects/sfinance/index.js index 9c399ede864..284e9d3dcb9 100644 --- a/projects/sfinance/index.js +++ b/projects/sfinance/index.js @@ -64,49 +64,13 @@ let balancesResultsA = await sdk.api.abi.multiCall({ block, calls: balancesCalls.slice(0, swapsA_coinSum), - abi: { - "name": "balances", - "outputs": [ - { - "type": "uint256", - "name": "out" - } - ], - "inputs": [ - { - "type": "int128", - "name": "arg0" - } - ], - "constant": true, - "payable": false, - "type": "function", - "gas": 2250 - }, + abi: 'function balances(int128 arg0) view returns (uint256 out)', }) let balancesResultsB = await sdk.api.abi.multiCall({ block, calls: balancesCalls.slice(-swapsB_coinSum), - abi: { - "name": "balances", - "outputs": [ - { - "type": "uint256", - "name": "out" - } - ], - "inputs": [ - { - "type": "uint256", - "name": "arg0" - } - ], - "constant": true, - "payable": false, - "type": "function", - "gas": 2250 - }, + abi: 'function balances(uint256 arg0) view returns (uint256 out)', }) let balancesResults = [...balancesResultsA.output, ...balancesResultsB.output] @@ -118,40 +82,13 @@ let coinsResultsA = await sdk.api.abi.multiCall({ block, calls: coinsCalls.slice(0, swapsA_coinSum), - abi: { - "name": "underlying_coins", - "outputs": [{ - "type": "address", - "name": "out" - }], - "inputs": [{ - "type": "int128", - "name": "arg0" - }], - "constant": true, - "payable": false, - "type": "function", - "gas": 2190 - } + abi: 'function underlying_coins(int128 arg0) view returns (address out)' }) let coinsResultsB = await sdk.api.abi.multiCall({ block, calls: coinsCalls.slice(-swapsB_coinSum), - abi: { - "name": "coins", - "outputs": [{ - "type": "address", - "name": "" - }], - "inputs": [{ - "type": "uint256", - "name": "arg0" - }], - "stateMutability": "view", - "type": "function", - "gas": 2250 - } + abi: 'function coins(uint256 arg0) view returns (address out)' }) let coinsResults = [...coinsResultsA.output, ...coinsResultsB.output] diff --git a/projects/sft-protocol/index.js b/projects/sft-protocol/index.js new file mode 100644 index 00000000000..aa3b06591d1 --- /dev/null +++ b/projects/sft-protocol/index.js @@ -0,0 +1,52 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokens2 } = require('../helper/unwrapLPs'); +const { utils } = require("ethers"); +const { getConfig } = require('../helper/cache'); + +const tokens = [ + ADDRESSES.null, // FIL +] + +const getActiveMinersFromRPC = async () => { + const resp = await getConfig('sft-protocol', 'https://ww8.sftproject.io/api/c/api/v1/public/dashboard/info') + let nodes = [] + let node_i = [] + nodes = resp.data.combined + .filter(i => i.miner && i.miner !== '') + .map(({ miner }) => { + let node = parseInt(miner.slice(2,)) + let bytes = Buffer.alloc(20); + bytes.writeUint8(0xff, 0); + bytes.writeBigUint64BE(BigInt(node), 12); + return utils.getAddress('0x' + bytes.toString('hex')); + }); + + if (resp.data.independent !== null) { + node_i = resp.data.independent + .filter(i => i.miner && i.miner !== '') + .map(({ miner }) => { + let node = parseInt(miner.slice(2,)) + let bytes = Buffer.alloc(20); + bytes.writeUint8(0xff, 0); + bytes.writeBigUint64BE(BigInt(node), 12); + return utils.getAddress('0x' + bytes.toString('hex')); + }); + } + nodes = nodes.concat(node_i) + return nodes +} + +module.exports = { + filecoin: { + tvl: async (_, _1, _2, { api }) => { + + let balances = {}; + + let minerAddrs = await getActiveMinersFromRPC(); + await sumTokens2({ balances, owners: minerAddrs, tokens, api, }); + + return balances; + } + } +} + diff --git a/projects/shadecash/index.js b/projects/shadecash/index.js index 1edc95e4892..f03bb42deb5 100644 --- a/projects/shadecash/index.js +++ b/projects/shadecash/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens } = require('../helper/unwrapLPs') const addresses = require('./contracts.json') const { transformFantomAddress } = require("../helper/portedTokens"); @@ -6,14 +7,14 @@ const {staking} = require('../helper/staking'); const {pool2} = require('../helper/pool2') const tokens = { - "USDC": "0x04068DA6C83AFCFA0e13ba15A6696662335D5B75", + "USDC": ADDRESSES.fantom.USDC, "xBOO": "0xa48d959AE2E88f1dAA7D5F611E01908106dE7598", "SHADE": "0x3A3841f5fa9f2c283EA567d5Aeea3Af022dD2262" }; async function tvl(_, _ethBlock, chainBlocks) { let balances = { - "0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83": 0 + [ADDRESSES.fantom.WFTM]: 0 } let calls = []; @@ -24,11 +25,11 @@ async function tvl(_, _ethBlock, chainBlocks) { block: chainBlocks['fantom'], chain: "fantom" }).then(b => { - balances["0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83"] = + balances[ADDRESSES.fantom.WFTM] = Number(b.output) + - Number(balances["0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83"]); + Number(balances[ADDRESSES.fantom.WFTM]); }); - }; + } // GET ERC20 BALANCES Object.entries(addresses).map(([,address]) => { Object.entries(tokens).map(([,token]) => { diff --git a/projects/shadeprotocol-derivatives/index.js b/projects/shadeprotocol-derivatives/index.js new file mode 100644 index 00000000000..6b03ff08d68 --- /dev/null +++ b/projects/shadeprotocol-derivatives/index.js @@ -0,0 +1,15 @@ +const { get } = require("../helper/http") + +async function tvl(_, _b, _cb, { api, }) { + const data = await get('https://ruvzuawwz7.execute-api.us-east-1.amazonaws.com/prod-analytics-v1/derivatives') + return { + tether: data.totalUsd + } +} + +module.exports = { + misrepresentedTokens: true, + secret: { + tvl + } +} \ No newline at end of file diff --git a/projects/shadeprotocol-lend/index.js b/projects/shadeprotocol-lend/index.js new file mode 100644 index 00000000000..2bf9299ee77 --- /dev/null +++ b/projects/shadeprotocol-lend/index.js @@ -0,0 +1,24 @@ +const { get } = require("../helper/http") + +// Total Collateral Deposited in Vaults +async function tvl(_, _b, _cb, { api, }) { + const data = await get('https://ruvzuawwz7.execute-api.us-east-1.amazonaws.com/prod-analytics-v1/lend') + + let totalValue = 0; + + for (let i = 0; i < data.collaterals.length; i++) { + // Add the value of each collateral to the total value + totalValue += data.collaterals[i].value; + } + + return { + tether: totalValue + } +} + +module.exports = { + misrepresentedTokens: true, + secret: { + tvl + } +} diff --git a/projects/shadeprotocol-silk/index.js b/projects/shadeprotocol-silk/index.js new file mode 100644 index 00000000000..0b1d3f2a405 --- /dev/null +++ b/projects/shadeprotocol-silk/index.js @@ -0,0 +1,15 @@ +const { get } = require("../helper/http") + +async function tvl(_, _b, _cb, { api, }) { + const data = await get('https://ruvzuawwz7.execute-api.us-east-1.amazonaws.com/prod-analytics-v1/silk') + return { + tether: data.totalUsd + } +} + +module.exports = { + misrepresentedTokens: true, + secret: { + tvl + } +} \ No newline at end of file diff --git a/projects/shadeprotocol-swap/index.js b/projects/shadeprotocol-swap/index.js new file mode 100644 index 00000000000..26666b229d3 --- /dev/null +++ b/projects/shadeprotocol-swap/index.js @@ -0,0 +1,17 @@ +const { get } = require("../helper/http") + +async function tvl(_, _b, _cb, { api, }) { + const data = await get('https://na36v10ce3.execute-api.us-east-1.amazonaws.com/API-mainnet-STAGE/shadeswap/pairs') + return { + tether: data.map(i => +i.liquidity_usd).filter(i=>i<1e9).reduce((a, i) => a + i) + } + +} + + +module.exports = { + misrepresentedTokens: true, + secret: { + tvl + } +} \ No newline at end of file diff --git a/projects/shadeswap/index.js b/projects/shadeswap/index.js new file mode 100644 index 00000000000..26666b229d3 --- /dev/null +++ b/projects/shadeswap/index.js @@ -0,0 +1,17 @@ +const { get } = require("../helper/http") + +async function tvl(_, _b, _cb, { api, }) { + const data = await get('https://na36v10ce3.execute-api.us-east-1.amazonaws.com/API-mainnet-STAGE/shadeswap/pairs') + return { + tether: data.map(i => +i.liquidity_usd).filter(i=>i<1e9).reduce((a, i) => a + i) + } + +} + + +module.exports = { + misrepresentedTokens: true, + secret: { + tvl + } +} \ No newline at end of file diff --git a/projects/shadowswap/index.js b/projects/shadowswap/index.js new file mode 100644 index 00000000000..009bb8b3e9e --- /dev/null +++ b/projects/shadowswap/index.js @@ -0,0 +1,11 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports = { + misrepresentedTokens: true, + core: { + tvl: getUniTVL({ + useDefaultCoreAssets: true, + factory: '0x326Ee96748E7DcC04BE1Ef8f4E4F6bdd54048932', + }) + } +} \ No newline at end of file diff --git a/projects/shapeshift/index.js b/projects/shapeshift/index.js index af38c84c7f8..8e6a4836e81 100644 --- a/projects/shapeshift/index.js +++ b/projects/shapeshift/index.js @@ -1,18 +1,35 @@ const { staking } = require("../helper/staking"); +const { pool2 } = require("../helper/pool2"); // Contracts -const StakingYieldContract = "0xDd80E21669A664Bce83E3AD9a0d74f8Dad5D9E72"; -const StakingYieldContractV2 = "0xc54b9f82c1c54e9d4d274d633c7523f2299c42a0"; +const stakingUNIv2Contracts = [ + "0xDd80E21669A664Bce83E3AD9a0d74f8Dad5D9E72", // v1 + "0xc54b9f82c1c54e9d4d274d633c7523f2299c42a0", // v2 + "0x212ebf9fd3c10f371557b08e993eaab385c3932b", // v3 + "0x24FD7FB95dc742e23Dc3829d3e656FEeb5f67fa0", // v4 + "0xC14eaA8284feFF79EDc118E06caDBf3813a7e555", // v5 + "0xEbB1761Ad43034Fd7FaA64d84e5BbD8cB5c40b68", // v6 +]; +const stakingFoxy = "0xee77aa3Fd23BbeBaf94386dD44b548e9a785ea4b"; // Tokens Or LPs const ETH_FOX_UNIV2 = "0x470e8de2eBaef52014A47Cb5E6aF86884947F08c"; const FOX = "0xc770eefad204b5180df6a14ee197d99d808ee52d"; +const tFOX = "0x808D3E6b23516967ceAE4f17a5F9038383ED5311"; +const FOXy = "0xDc49108ce5C57bc3408c3A5E95F3d864eC386Ed3"; module.exports = { ethereum: { - pool2: staking([StakingYieldContract, StakingYieldContractV2], [ETH_FOX_UNIV2]), - tvl: async ()=>({}), + pool2: pool2( + [...stakingUNIv2Contracts, ], + [ETH_FOX_UNIV2, ] + ), + staking: staking( + [stakingFoxy], + [FOX, tFOX] + ), + tvl: async () => ({}), }, methodology: - "We count liquidity of ETH-FOX LP deposited on Uniswap V2 pool through StakingYieldContract contract; and the staking of native token", + "We count liquidity of ETH-FOX LP deposited on Uniswap V2 pool through StakingYieldContract contracts; and the staking of native token", }; diff --git a/projects/sharedstake/index.js b/projects/sharedstake/index.js index 9bd72b48d7c..5dae9057b09 100644 --- a/projects/sharedstake/index.js +++ b/projects/sharedstake/index.js @@ -1,7 +1,8 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk'); const {unwrapUniswapLPs} = require('../helper/unwrapLPs') -const wethAddress = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2' +const wethAddress = ADDRESSES.ethereum.WETH const sgtStakingPool = "0xc637dB981e417869814B2Ea2F1bD115d2D993597" const sgt = "0x84810bcF08744d5862B8181f12d17bfd57d3b078" const pool2StakingPool = "0x64A1DB33f68695df773924682D2EFb1161B329e8" diff --git a/projects/sharelock/index.js b/projects/sharelock/index.js new file mode 100644 index 00000000000..d3810ed4ab7 --- /dev/null +++ b/projects/sharelock/index.js @@ -0,0 +1,7 @@ +const { getUniTVL} = require("../helper/unknownTokens") + +module.exports = { + era: { + tvl: getUniTVL({ factory: '0xea51CE8A1f9C1Cbbf5B89D9B1dA4A94fB1557866', fetchBalances: true, }) + }, +} diff --git a/projects/sharkswap/index.js b/projects/sharkswap/index.js index 8b0c71592aa..104c5a856c8 100644 --- a/projects/sharkswap/index.js +++ b/projects/sharkswap/index.js @@ -3,7 +3,6 @@ const { getUniTVL } = require("../helper/unknownTokens") module.exports = { sx: { tvl: getUniTVL({ - chain: 'sx', factory: '0x6A482aC7f61Ed75B4Eb7C26cE8cD8a66bd07B88D', useDefaultCoreAssets: true, }) diff --git a/projects/sharky/helper/index.js b/projects/sharky/helper/index.js new file mode 100644 index 00000000000..49a955cc8c3 --- /dev/null +++ b/projects/sharky/helper/index.js @@ -0,0 +1,47 @@ +const anchor = require("@project-serum/anchor"); +const { getProvider, } = require("../../helper/solana"); +const sdk = require('@defillama/sdk') + +const { once } = require('../../helper/utils') + +const getLoans = once(async () => { + const provider = getProvider(); + sdk.log('fetching loans...') + const program = new anchor.Program(SHARKY_IDL, SHARKY_PROGRAM_ID, provider); + + return program.account.loan.all() + +}) + +const SHARKY_PROGRAM_ID = "SHARKobtfF1bHhxD2eqftjHBdVSCbKo9JtgK71FhELP"; +const SHARKY_IDL = require("./sharky.json"); + +async function borrowed(timestamp, _, _1, { api }) { + let loans = await getLoans() + loans = loans.map(i => i.account) + api.log('loan count: ',loans.length) + loans = loans.filter(i => { + + const time = i.loanState?.taken?.taken?.terms?.time + if (!time) return false + return +time.start + +time.duration > timestamp + }) + api.log('active loans count: ',loans.length) + loans.forEach(i => api.add(i.valueTokenMint.toString(), i.principalLamports.toString())) +} + +async function tvl(timestamp, _, _1, { api }) { + let loans = await getLoans() + loans = loans.map(i => i.account) + api.log('loan count: ',loans.length) + loans = loans.filter(i => { + return !i.loanState.taken + }) + api.log('Loans yet to be taken: ',loans.length) + loans.forEach(i => api.add(i.valueTokenMint.toString(), i.principalLamports.toString())) +} + +module.exports = { + borrowed, + tvl, +}; diff --git a/projects/sharky/helper/sharky.json b/projects/sharky/helper/sharky.json new file mode 100644 index 00000000000..8a546360a32 --- /dev/null +++ b/projects/sharky/helper/sharky.json @@ -0,0 +1,196 @@ +{ + "version": "5.0.0", + "name": "sharky", + "instructions": [], + "accounts": [ + { + "name": "Loan", + "type": { + "kind": "struct", + "fields": [ + { + "name": "version", + "type": "u8" + }, + { + "name": "principalLamports", + "docs": ["amount in tokens, decimals included"], + "type": "u64" + }, + { + "name": "orderBook", + "type": "publicKey" + }, + { + "name": "valueTokenMint", + "docs": ["Token mint for what the loan is in (spl address)"], + "type": "publicKey" + }, + { + "name": "escrowBumpSeed", + "type": "u8" + }, + { + "name": "loanState", + "docs": ["stores start and duration"], + "type": { + "defined": "LoanState" + } + } + ] + } + } + ], + "types": [ + { + "name": "LoanOffer", + "type": { + "kind": "struct", + "fields": [ + { + "name": "lenderWallet", + "type": "publicKey" + }, + { + "name": "termsSpec", + "type": { + "defined": "LoanTermsSpec" + } + }, + { + "name": "offerTime", + "type": "i64" + } + ] + } + }, + { + "name": "TakenLoan", + "type": { + "kind": "struct", + "fields": [ + { + "name": "nftCollateralMint", + "type": "publicKey" + }, + { + "name": "lenderNoteMint", + "type": "publicKey" + }, + { + "name": "borrowerNoteMint", + "type": "publicKey" + }, + { + "name": "apy", + "docs": [ + "Thousandths of a percent (allows to have 3 decimal points of precision)" + ], + "type": { + "defined": "APY" + } + }, + { + "name": "terms", + "type": { + "defined": "LoanTerms" + } + } + ] + } + }, + { + "name": "APY", + "docs": ["APY settings on an [`OrderBook`]"], + "type": { + "kind": "enum", + "variants": [ + { + "name": "Fixed", + "fields": [ + { + "name": "apy", + "docs": ["Thousandths of a percent"], + "type": "u32" + } + ] + } + ] + } + }, + { + "name": "LoanTermsSpec", + "type": { + "kind": "enum", + "variants": [ + { + "name": "Time", + "fields": [ + { + "name": "duration", + "type": "u64" + } + ] + } + ] + } + }, + { + "name": "LoanTerms", + "type": { + "kind": "enum", + "variants": [ + { + "name": "Time", + "fields": [ + { + "name": "start", + "docs": ["This is a [`UnixTimeStamp`]"], + "type": "i64" + }, + { + "name": "duration", + "type": "u64" + }, + { + "name": "total_owed_lamports", + "type": "u64" + } + ] + } + ] + } + }, + { + "name": "LoanState", + "type": { + "kind": "enum", + "variants": [ + { + "name": "Offer", + "fields": [ + { + "name": "offer", + "type": { + "defined": "LoanOffer" + } + } + ] + }, + { + "name": "Taken", + "fields": [ + { + "name": "taken", + "type": { + "defined": "TakenLoan" + } + } + ] + } + ] + } + } + ], + "errors": [] +} diff --git a/projects/sharky/index.js b/projects/sharky/index.js new file mode 100644 index 00000000000..ec00454bbd8 --- /dev/null +++ b/projects/sharky/index.js @@ -0,0 +1,7 @@ +const solExports = require("./helper"); + +module.exports = { + timetravel: false, + methodology: `TVL is the total principal of all current offers and taken loans.`, + solana: solExports, +}; diff --git a/projects/sharkyswap/index.js b/projects/sharkyswap/index.js new file mode 100644 index 00000000000..ba6677868c7 --- /dev/null +++ b/projects/sharkyswap/index.js @@ -0,0 +1,12 @@ +const { getUniTVL, } = require('../helper/unknownTokens') +const { staking } = require('../helper/staking') + +module.exports = { + arbitrum: { + tvl: getUniTVL({ + factory: "0x36800286f652dDC9bDcFfEDc4e71FDd207C1d07C", + useDefaultCoreAssets: true, + }), + staking: staking('0xD5f406eB9E38E3B3E35072A8A35E0DcC671ea8DB', '0x73eD68B834e44096eB4beA6eDeAD038c945722F1') + } +}; \ No newline at end of file diff --git a/projects/sheepdex/abi.json b/projects/sheepdex/abi.json index 276a5844f53..df726d82f30 100644 --- a/projects/sheepdex/abi.json +++ b/projects/sheepdex/abi.json @@ -1,28 +1,4 @@ { - "token0": { - "inputs": [], - "name": "token0", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "token1": { - "inputs": [], - "name": "token1", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } + "token0": "address:token0", + "token1": "address:token1" } \ No newline at end of file diff --git a/projects/shell/index.js b/projects/shell/index.js index e430a311651..76706ae431a 100644 --- a/projects/shell/index.js +++ b/projects/shell/index.js @@ -1,51 +1,29 @@ -const sdk = require('@defillama/sdk'); -const { getChainTransform } = require('../helper/portedTokens'); +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, sumTokensExport, } = require('../helper/unwrapLPs'); const OCEAN_CONTRACT = '0xC32eB36f886F638fffD836DF44C124074cFe3584'; -const DAI_CONTRACT = '0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1'; -const USDC_CONTRACT = '0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8'; -const USDT_CONTRACT = '0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9'; -const WBTC_CONTRACT = '0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f'; +const DAI_CONTRACT = ADDRESSES.optimism.DAI; +const USDC_CONTRACT = ADDRESSES.arbitrum.USDC; +const USDT_CONTRACT = ADDRESSES.arbitrum.USDT; +const WBTC_CONTRACT = ADDRESSES.arbitrum.WBTC; +const WSTETH_CONTRACT = '0x5979D7b546E38E414F7E9822514be443A4800529'; +const ARB_CONTRACT = ADDRESSES.arbitrum.ARB; const TOKEN_CONTRACTS = [ - DAI_CONTRACT, - USDC_CONTRACT, - USDT_CONTRACT, - WBTC_CONTRACT + DAI_CONTRACT, + USDC_CONTRACT, + USDT_CONTRACT, + WBTC_CONTRACT, + WSTETH_CONTRACT, + ARB_CONTRACT, + nullAddress, ] -async function tvl(timestamp, block, chainBlocks) { - const balances = {}; - const transform = await getChainTransform('arbitrum'); - - for(let i = 0; i < TOKEN_CONTRACTS.length; i++){ - const tokenBalance = (await sdk.api.abi.call({ - abi: 'erc20:balanceOf', - chain: 'arbitrum', - target: TOKEN_CONTRACTS[i], - params: [OCEAN_CONTRACT], - block: chainBlocks.arbitrum, - })).output; - - sdk.util.sumSingleBalance(balances, transform(TOKEN_CONTRACTS[i]), tokenBalance) - } - - const ethBalance = (await sdk.api.eth.getBalance({ - target: OCEAN_CONTRACT, - chain: 'arbitrum' - })).output - - sdk.util.sumSingleBalance(balances, "0x0000000000000000000000000000000000000000", ethBalance) - - return balances; -} - module.exports = { - timetravel: true, methodology: 'Sums up the value of all tokens wrapped into Shell v2', start: 24142587, arbitrum: { - tvl + tvl: sumTokensExport({ owner: OCEAN_CONTRACT, tokens: TOKEN_CONTRACTS}) }, hallmarks: [ [1662927378, "Shell v2 Launch"] diff --git a/projects/sherlock/abi.json b/projects/sherlock/abi.json index 6112dcc2dfb..acab69b8b68 100644 --- a/projects/sherlock/abi.json +++ b/projects/sherlock/abi.json @@ -1,15 +1,3 @@ { - "balanceOf": { - "inputs": [], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -} + "balanceOf": "uint256:balanceOf" +} \ No newline at end of file diff --git a/projects/sherlock/index.js b/projects/sherlock/index.js index e1e605cb46f..7c11bbbd088 100644 --- a/projects/sherlock/index.js +++ b/projects/sherlock/index.js @@ -1,10 +1,11 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk'); const abi = require('./abi.json'); const usdcabi = require('./usdcabi.json'); const sherlockV2abi = require('./sherlockV2abi.json'); const BigNumber = require("bignumber.js"); -const USDC = '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48'; +const USDC = ADDRESSES.ethereum.USDC; const SherlockContract = '0xacbBe1d537BDa855797776F969612df7bBb98215'; const SherlockV2Contract = '0x0865a889183039689034dA55c1Fd12aF5083eabF'; diff --git a/projects/sherlock/sherlockV2abi.json b/projects/sherlock/sherlockV2abi.json index 4f362d9fed5..f6c7f4336ff 100644 --- a/projects/sherlock/sherlockV2abi.json +++ b/projects/sherlock/sherlockV2abi.json @@ -1,15 +1,3 @@ { - "totalTokenBalanceStakers": { - "inputs": [], - "name": "totalTokenBalanceStakers", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -} + "totalTokenBalanceStakers": "uint256:totalTokenBalanceStakers" +} \ No newline at end of file diff --git a/projects/sherlock/usdcabi.json b/projects/sherlock/usdcabi.json index f207085c716..9cdd3659074 100644 --- a/projects/sherlock/usdcabi.json +++ b/projects/sherlock/usdcabi.json @@ -1,11 +1,3 @@ { - "balanceOf": { - "inputs": - [{"internalType":"address","name":"account","type":"address"}], - "name":"balanceOf", - "outputs": - [{"internalType":"uint256","name":"","type":"uint256"}], - "stateMutability":"view", - "type":"function" - } -} + "balanceOf": "function balanceOf(address account) view returns (uint256)" +} \ No newline at end of file diff --git a/projects/shibance-bsc/abi.json b/projects/shibance-bsc/abi.json deleted file mode 100644 index 2dad6d05ea2..00000000000 --- a/projects/shibance-bsc/abi.json +++ /dev/null @@ -1,54 +0,0 @@ -[ - { - "inputs": [], - "name": "getPricePerFullShare", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalShares", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "calculateHarvestCakeRewards", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "calculateTotalPendingCakeRewards", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } - ] \ No newline at end of file diff --git a/projects/shibance-bsc/constants/abi.json b/projects/shibance-bsc/constants/abi.json deleted file mode 100644 index 9aecf0e7774..00000000000 --- a/projects/shibance-bsc/constants/abi.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "poolInfo": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "poolInfo", - "outputs": [ - { - "internalType": "contract IBEP20", - "name": "lpToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "allocPoint", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastRewardBlock", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accCakePerShare", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "totalAllocPoint" : { - "inputs": [], - "name": "totalAllocPoint", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -} \ No newline at end of file diff --git a/projects/shibance-bsc/constants/bsc/contracts.js b/projects/shibance-bsc/constants/bsc/contracts.js deleted file mode 100644 index 69944188578..00000000000 --- a/projects/shibance-bsc/constants/bsc/contracts.js +++ /dev/null @@ -1,22 +0,0 @@ -module.exports = { - masterChef: { - 56: "0x4fbEebd68B71aE4367F778129d4218668151EB99", - 97: "0x5559C8a6267b0b1bcDe0005a44db0B1546711B76", - }, - sousChef: { - 56: "0x0703c295644ba1d333e14367e510773629264Ee2", - 97: "0x4A2947DE6A35F0B83cc26827A9Cf832193c38614", - }, - multiCall: { - 56: "0x3dB443d8e82700FaBdB831dBe180994B6b109790", - 97: "0x6a45C680E74c81797E287Ccf48284698f85909b4", - }, - woofVault: { - 56: "0x09fE45A62502E7a0b226a99f18043F3eC32F78E8", - 97: "0x238d502163AC149Da69A180Cbae59347d72AE842", - }, - woofCollectibles: { - 56: "0x89e36408cc275168ab235e8a5902a2dd4c8fbaa7", - 97: "", - }, -}; diff --git a/projects/shibance-bsc/constants/bsc/farms.js b/projects/shibance-bsc/constants/bsc/farms.js deleted file mode 100644 index b6fb682aba6..00000000000 --- a/projects/shibance-bsc/constants/bsc/farms.js +++ /dev/null @@ -1,215 +0,0 @@ -const tokens = require("./tokens"); -const farms = [ - { - pid: 0, - lpSymbol: "WOOF", - lpAddresses: { - 56: "0x9e26c50B8A3b7652c3fD2B378252A8647a0C9268", - 97: "0x43eef5BA4899431F7F9D855E9C5Ed06016c8227b", - }, - token: tokens.syrup, - quoteToken: tokens.wbnb, - }, - { - pid: 1, - lpSymbol: "WOOF-BNB LP", - lpAddresses: { - 56: "0xccefc6013a4f3e1c4e71c5006353a55e228f4c2d", - 97: "0x5d6ddb67bcef8dd94a7f4ade4f5b912da9bacd62", - }, - token: tokens.woof, - quoteToken: tokens.wbnb, - }, - { - pid: 18, - lpSymbol: "CUPCAKE-WOOF LP", - lpAddresses: { - 97: "", - 56: "0x897a60da157cdca5faff2fd9314e72b763dda9cd", - }, - token: tokens.cupcake, - quoteToken: tokens.woof, - }, - { - pid: 21, - lpSymbol: "CUPCAKE-BUSD LP", - lpAddresses: { - 97: "", - 56: "0x9e20535e12d1ef96a3838ea27256ee6c767f644f", - }, - token: tokens.cupcake, - quoteToken: tokens.busd, - }, - { - pid: 3, - lpSymbol: "WOOF-BUSD SHIBANCE LP", - lpAddresses: { - 97: "0x00ce857d4a66beF6614E2EBAcf16c8fF5C451146", - 56: "0x6e729f2ed894fbcebc14dfd7344975a558052c55", - }, - token: tokens.woof, - quoteToken: tokens.busd, - }, - { - pid: 4, - lpSymbol: "WOOF-BUSD PANCAKESWAP LP", - lpAddresses: { - 97: "0x638798c119ffC95482423981884c0461664d7195", - 56: "0xe064a0666b86d5554e83adf4bf14fa6d5ffc4175", - }, - token: tokens.woof, - quoteToken: tokens.busd, - }, - { - pid: 2, - lpSymbol: "BUSD-BNB LP", - lpAddresses: { - 56: "0xf5ef5e2ecfb73126ea2db39703e4f6269d484f61", - 97: "0x354f0d65790d44ac7ad65354e150dd8a1aa76f48", - }, - token: tokens.busd, - quoteToken: tokens.wbnb, - }, - { - pid: 6, - lpSymbol: "DOGE-BUSD LP", - lpAddresses: { - 97: "0xaC0AEC94af77eDCc868BDb7BA816380c5129E163", - 56: "0xe076028cecc3e9390e9ae1222b7c99b13de95627", - }, - token: tokens.doge, - quoteToken: tokens.busd, - }, - { - pid: 20, - lpSymbol: "BIRB-WOOF LP", - lpAddresses: { - 97: "", - 56: "0x9809eFcc1E1cDEE2BbA0Efd23ec000ca840725cb", - }, - token: tokens.birb, - quoteToken: tokens.woof, - }, - { - pid: 15, - lpSymbol: "MOONSHOT-WOOF LP", - lpAddresses: { - 97: "", - 56: "0xaa19A0bF68acc25e6a853044AA0f9E9c08C97A7d", - }, - token: tokens.moonshot, - quoteToken: tokens.woof, - }, - { - pid: 8, - lpSymbol: "CUMMIES-WOOF LP", - lpAddresses: { - 97: "", - 56: "0x8Fe92296F007F7B864765BAEc58fCfB7820d71B6", - }, - token: tokens.cummies, - quoteToken: tokens.woof, - }, - { - pid: 11, - lpSymbol: "CUMMIES-BUSD LP", - lpAddresses: { - 97: "", - 56: "0x82b34a5384d337a8f306d1d49063d7e22ebcc296", - }, - token: tokens.cummies, - quoteToken: tokens.busd, - }, - { - pid: 16, - lpSymbol: "CAKE-WOOF LP", - lpAddresses: { - 97: "", - 56: "0xba7e74e2d06d7a76025413a1f338ab849084843b", - }, - token: tokens.cake, - quoteToken: tokens.woof, - }, - { - pid: 17, - lpSymbol: "CAKE-BUSD LP", - lpAddresses: { - 97: "", - 56: "0xcda8205d6bd1619bf79b27e765e4e29651fd987e", - }, - token: tokens.cake, - quoteToken: tokens.busd, - }, - { - pid: 14, - lpSymbol: "ASS-WOOF LP", - lpAddresses: { - 97: "", - 56: "0x2e4a51084eae9237388bec1dce2a26afcbbdb568", - }, - token: tokens.ass, - quoteToken: tokens.woof, - }, - { - pid: 13, - lpSymbol: "ASS-BUSD LP", - lpAddresses: { - 97: "0xF7a8F04bFE8813Ad888d1b6a123aACc2DD86B120", - 56: "0xb719c3f92cdbf7d8426217ae323509b8cee8f4b9", - }, - token: tokens.ass, - quoteToken: tokens.busd, - }, - { - pid: 9, - lpSymbol: "SAFEMOON-WOOF LP", - lpAddresses: { - 97: "", - 56: "0x5261bd9a6fed9361cbf5d00c831e11d7db6bdf54", - }, - token: tokens.safemoon, - quoteToken: tokens.woof, - }, - { - pid: 10, - lpSymbol: "SAFEMOON-BUSD LP", - lpAddresses: { - 97: "", - 56: "0x916c7e58017e24de428b48a05db7531dd478a75b", - }, - token: tokens.safemoon, - quoteToken: tokens.busd, - }, - { - pid: 7, - lpSymbol: "BABYDOGE-WOOF LP", - lpAddresses: { - 97: "", - 56: "0x3627589F64e3942b18549361fC35a5F2Bd08eF77", - }, - token: tokens.babydoge, - quoteToken: tokens.woof, - }, - { - pid: 12, - lpSymbol: "BABYDOGE-BUSD LP", - lpAddresses: { - 97: "", - 56: "0x1f6753200130e3478c7d02671bb7234220f4520c", - }, - token: tokens.babydoge, - quoteToken: tokens.busd, - }, - { - pid: 5, - lpSymbol: "USDT-BUSD LP", - lpAddresses: { - 97: "0x2E2b6cdB1ea0C39b397EbFc50BF2117437819002", - 56: "0x6f5ae0eb19343b8b1b1426fc11fa9ae1f0a15159", - }, - token: tokens.usdt, - quoteToken: tokens.busd, - }, -]; - -module.exports = farms; \ No newline at end of file diff --git a/projects/shibance-bsc/constants/bsc/pools.js b/projects/shibance-bsc/constants/bsc/pools.js deleted file mode 100644 index b1b6fae888f..00000000000 --- a/projects/shibance-bsc/constants/bsc/pools.js +++ /dev/null @@ -1,79 +0,0 @@ -const tokens = require("./tokens"); - -const PoolCategory = { - 'COMMUNITY' :'Community', - 'CORE' : 'Core', - 'BINANCE' : 'Binance', // Pools using native BNB behave differently than pools using a token - 'AUTO' : 'Auto', -} - -const pools = [ - { - sousId: 0, - stakingToken: tokens.woof, - earningToken: tokens.woof, - contractAddress: { - 97: "0x5559C8a6267b0b1bcDe0005a44db0B1546711B76", - 56: "0x4fbEebd68B71aE4367F778129d4218668151EB99", - }, - poolCategory: PoolCategory.CORE, - harvest: true, - tokenPerBlock: "10", - sortOrder: 1, - isFinished: false, - }, - { - sousId: 1, - stakingToken: tokens.woof, - earningToken: tokens.ass, - contractAddress: { - 97: "0x1E3C2695Aa1b040a56e9aE7db7E7b2B96125e17A", - 56: "0xb2b694833e0875eA76AF7Fe50800658A41831fcF", - }, - poolCategory: PoolCategory.CORE, - harvest: true, - tokenPerBlock: "3260302.556", - sortOrder: 1, - }, - { - sousId: 2, - stakingToken: tokens.woof, - earningToken: tokens.busd, - contractAddress: { - 97: "0x4Cad350eA6F1C0010A11aA6b4Df26617A50AD8fF", - 56: "0x52C68033b2eEEFD7b6875b3f9b880a5ccDc51eF7", - }, - poolCategory: PoolCategory.CORE, - harvest: true, - tokenPerBlock: "0.011574", - sortOrder: 1, - }, - { - sousId: 3, - stakingToken: tokens.woof, - earningToken: tokens.cummies, - contractAddress: { - 97: "0x88f1Ee74eE6727Cb77208A8935261146F9b64293", - 56: "0x2d7831a6C7018dCEF7f9764Bee684B8f7d505222", - }, - poolCategory: PoolCategory.CORE, - harvest: true, - tokenPerBlock: "0.230902777", - sortOrder: 1, - }, - { - sousId: 4, - stakingToken: tokens.woof, - earningToken: tokens.cupcake, - contractAddress: { - 97: "", - 56: "0xD7a7b01C47497339ECaDcca579492De45bE68A71", - }, - poolCategory: PoolCategory.CORE, - harvest: true, - tokenPerBlock: "1765", - sortOrder: 2, - }, -]; - -module.exports = pools; \ No newline at end of file diff --git a/projects/shibance-bsc/constants/bsc/tokens.js b/projects/shibance-bsc/constants/bsc/tokens.js deleted file mode 100644 index 66a265ade1d..00000000000 --- a/projects/shibance-bsc/constants/bsc/tokens.js +++ /dev/null @@ -1,134 +0,0 @@ -const tokens = { - bnb: { - symbol: "BNB", - projectLink: "https://www.binance.com/", - }, - woof: { - symbol: "WOOF", - address: { - 56: "0x9e26c50B8A3b7652c3fD2B378252A8647a0C9268", - 97: "0x43eef5BA4899431F7F9D855E9C5Ed06016c8227b", - }, - decimals: 18, - projectLink: "https://shibance.com/", - }, - syrup: { - symbol: "DOGGYPOUND", - address: { - 56: "0x516B3D832379cd9417bFA3cc54459460CB91fd33", - 97: "0xCBc317eFa8f0b18683C6c1b9e1842BcaCbC46f36", - }, - decimals: 18, - projectLink: "https://pancakeswap.finance/", - }, - wbnb: { - symbol: "wBNB", - address: { - 56: "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c", - 97: "0xae13d989dac2f0debff460ac112a837c89baa7cd", - }, - decimals: 18, - projectLink: "https://pancakeswap.finance/", - }, - busd: { - symbol: "BUSD", - address: { - 56: "0xe9e7cea3dedca5984780bafc599bd69add087d56", - 97: "0x8301f2213c0eed49a7e28ae4c3e91722919b8b47", - }, - decimals: 18, - projectLink: "https://www.paxos.com/busd/", - }, - usdt: { - symbol: "USDT", - address: { - 56: "0x55d398326f99059ff775485246999027b3197955", - 97: "0x9D4BB7939D27D3bd7F425744DFBf7eE777490388", - }, - decimals: 18, - projectLink: "https://usdt.com/", - }, - doge: { - symbol: "DOGE", - address: { - 56: "0xba2ae424d960c26247dd6c32edc70b295c744c43", - 97: "0x30c638Fd87379Dc280fA1892667a1BFA4ff31387", - }, - decimals: 8, - projectLink: "https://doge.com/", - }, - babydoge: { - symbol: "BABYDOGE", - address: { - 56: "0xc748673057861a797275cd8a068abb95a902e8de", - 97: "", - }, - decimals: 18, - projectLink: "https://babydogecoin.com/", - }, - cummies: { - symbol: "CUMMIES", - address: { - 56: "0x27ae27110350b98d564b9a3eed31baebc82d878d", - 97: "", - }, - decimals: 18, - projectLink: "https://cumrocket.io/", - }, - safemoon: { - symbol: "SAFEMOON", - address: { - 56: "0x8076c74c5e3f5852037f31ff0093eeb8c8add8d3", - 97: "", - }, - decimals: 9, - projectLink: "https://safemoon.net/", - }, - ass: { - symbol: "ASS", - address: { - 56: "0x7c63f96feafacd84e75a594c00fac3693386fbf0", - 97: "0x422227357806ed386de58340d34c17b60d68046e", - }, - decimals: 9, - projectLink: "https://assfinance.com/", - }, - moonshot: { - symbol: "MOONSHOT", - address: { - 56: "0xd27d3f7f329d93d897612e413f207a4dbe8bf799", - 97: "", - }, - decimals: 9, - projectLink: "https://project-moonshot.me/", - }, - cake: { - symbol: "CAKE", - address: { - 56: "0x0e09fabb73bd3ade0a17ecc321fd13a19e81ce82", - 97: "", - }, - decimals: 18, - projectLink: "https://pancakeswap.finance/", - }, - cupcake: { - symbol: "CUPCAKE", - address: { - 56: "0x5d74b0f8c474f96e093c70b507452399573cff73", - 97: "", - }, - decimals: 18, - projectLink: "https://cupcakecoin.io/", - }, - birb: { - symbol: "BIRB", - address: { - 56: "0x82a479264b36104be4fdb91618a59a4fc0f50650", - 97: "", - }, - decimals: 18, - projectLink: "https://birb.co/", - }, -}; - -module.exports = tokens; \ No newline at end of file diff --git a/projects/shibance-bsc/constants/chain.js b/projects/shibance-bsc/constants/chain.js deleted file mode 100644 index 16c71478962..00000000000 --- a/projects/shibance-bsc/constants/chain.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - kcc: 321, - bsc: 56, -}; \ No newline at end of file diff --git a/projects/shibance-bsc/constants/kcc/contracts.js b/projects/shibance-bsc/constants/kcc/contracts.js deleted file mode 100644 index 929889ec98e..00000000000 --- a/projects/shibance-bsc/constants/kcc/contracts.js +++ /dev/null @@ -1,14 +0,0 @@ -module.exports = { - masterChef: { - 321: "0x1Ae33198c47799e9333bbcd74cd3aB80DC03D283", - }, - sousChef: { - 321: "0xE35a1619319BBfa5Bf985e4Ca14964210774aB31", - }, - multiCall: { - 321: "0xEdf9cC6cC32842D74ffD6D85D7985ee9283B1E24", - }, - woofVault: { - 321: "0x5cE1e2F6c99aFcfbB6E640354837C263ec3a5664", - }, -}; \ No newline at end of file diff --git a/projects/shibance-bsc/constants/kcc/farms.js b/projects/shibance-bsc/constants/kcc/farms.js deleted file mode 100644 index 0abaf129c3b..00000000000 --- a/projects/shibance-bsc/constants/kcc/farms.js +++ /dev/null @@ -1,105 +0,0 @@ -const tokens = require("./tokens"); - -const farms = [ - { - pid: 0, - lpSymbol: "KWOOF", - lpAddresses: { - 321: "0x192F72eFD1009D90B0e6F82Ff27a0a2389F803e5", - }, - token: tokens.syrup, - quoteToken: tokens.wbnb, - }, - { - pid: 10, - lpSymbol: "KAFE-KWOOF LP", - lpAddresses: { - 321: "0x016b2ec91d6eebf65827c16b612a35187e0db6f9", - }, - token: tokens.kafe, - quoteToken: tokens.kwoof, - }, - { - pid: 11, - lpSymbol: "KAFE-USDT LP", - lpAddresses: { - 321: "0x473666ca99a69c3d445386c0c4d1b524c9e8fd35", - }, - token: tokens.kafe, - quoteToken: tokens.busd, - }, - { - pid: 1, - lpSymbol: "KWOOF-KCS LP", - lpAddresses: { - 321: "0x463e451d05f84da345d641fbaa3129693ce13816", - }, - token: tokens.kwoof, - quoteToken: tokens.wbnb, - }, - { - pid: 3, - lpSymbol: "KWOOF-USDT LP", - lpAddresses: { - 321: "0x5ea4ee58945c7e94c6efdce53d0b46d3dfbcf7db", - }, - token: tokens.kwoof, - quoteToken: tokens.busd, - }, - { - pid: 4, - lpSymbol: "KWOOF-USDC LP", - lpAddresses: { - 321: "0xd05be4d487beffb4eb9dbec9f16158d7c9e60a7c", - }, - token: tokens.kwoof, - quoteToken: tokens.usdc, - }, - { - pid: 2, - lpSymbol: "USDT-KCS LP", - lpAddresses: { - 321: "0x5a4b75cec96b99bc7dda80c42914636a5a46dfb1", - }, - token: tokens.busd, - quoteToken: tokens.wbnb, - }, - { - pid: 5, - lpSymbol: "USDC-KCS LP", - lpAddresses: { - 321: "0x3705eef160335a9aaa375ce31f858ba0a64aade0", - }, - token: tokens.usdc, - quoteToken: tokens.wbnb, - }, - { - pid: 6, - lpSymbol: "USDC-USDT LP", - lpAddresses: { - 321: "0x7060d8bfe77df123c8992d6ebf36b66163124c33", - }, - token: tokens.usdc, - quoteToken: tokens.busd, - }, - { - pid: 7, - lpSymbol: "GHOST-KWOOF LP", - lpAddresses: { - 321: "0x35540268609fbfbbed512bc917d75668e5f5d11d", - }, - token: tokens.ghost, - quoteToken: tokens.kwoof, - }, - { - pid: 8, - lpSymbol: "KUST-KWOOF LP", - lpAddresses: { - 321: "0x4eda6784ed216a30d89da18a73c05dff810c69e2", - }, - token: tokens.kust, - quoteToken: tokens.kwoof, - }, -]; - -module.exports = farms; diff --git a/projects/shibance-bsc/constants/kcc/pools.js b/projects/shibance-bsc/constants/kcc/pools.js deleted file mode 100644 index b9593ae39af..00000000000 --- a/projects/shibance-bsc/constants/kcc/pools.js +++ /dev/null @@ -1,39 +0,0 @@ -const tokens = require("./tokens"); - -const PoolCategory = { - COMMUNITY: "Community", - CORE: "Core", - BINANCE: "Binance", // Pools using native BNB behave differently than pools using a token - AUTO: "Auto", -}; - -const pools = [ - { - sousId: 0, - stakingToken: tokens.kwoof, - earningToken: tokens.kwoof, - contractAddress: { - 321: "0x1Ae33198c47799e9333bbcd74cd3aB80DC03D283", - }, - poolCategory: PoolCategory.CORE, - harvest: true, - tokenPerBlock: "10", - sortOrder: 1, - isFinished: false, - }, - { - sousId: 1, - stakingToken: tokens.kwoof, - earningToken: tokens.kafe, - contractAddress: { - 321: "0x27d55dd01cb6bff2791f46e4a7657e69257e80df", - }, - poolCategory: PoolCategory.CORE, - harvest: true, - tokenPerBlock: "0.00289", - sortOrder: 1, - isFinished: false, - }, -]; - -module.exports = pools; diff --git a/projects/shibance-bsc/constants/kcc/tokens.js b/projects/shibance-bsc/constants/kcc/tokens.js deleted file mode 100644 index 4e5d9de11d7..00000000000 --- a/projects/shibance-bsc/constants/kcc/tokens.js +++ /dev/null @@ -1,72 +0,0 @@ -const tokens = { - bnb: { - symbol: "BNB", - projectLink: "https://www.kucoin.com/", - }, - kwoof: { - symbol: "KWOOF", - address: { - 321: "0x192F72eFD1009D90B0e6F82Ff27a0a2389F803e5", - }, - decimals: 18, - projectLink: "https://shibance.com/", - }, - syrup: { - symbol: "DOGGYPOUND", - address: { - 321: "0xc72B04864aE423CD97F83E49D53b76b5937de8C8", - }, - decimals: 18, - projectLink: "https://shibance.com/", - }, - wbnb: { - symbol: "wBNB", - address: { - 321: "0x4446fc4eb47f2f6586f9faab68b3498f86c07521", - }, - decimals: 18, - projectLink: "https://www.kcc.io/", - }, - busd: { - symbol: "BUSD", - address: { - 321: "0x0039f574ee5cc39bdd162e9a88e3eb1f111baf48", - }, - decimals: 18, - projectLink: "https://www.kcc.io/", - }, - usdc: { - symbol: "USDC", - address: { - 321: "0x980a5afef3d17ad98635f6c5aebcbaeded3c3430", - }, - decimals: 18, - projectLink: "https://www.kcc.io/", - }, - ghost: { - symbol: "GHOST", - address: { - 321: "0x3341a4cc481637a773187400227446f85f66da0a", - }, - decimals: 9, - projectLink: "https://twitter.com/kughostkcc/", - }, - kust: { - symbol: "KUST", - address: { - 321: "0xfc56a7e70f6c970538020cc39939929b4d393f1f", - }, - decimals: 18, - projectLink: "https://kustarter.com/", - }, - kafe: { - symbol: "KAFE", - address: { - 321: "0x516F50028780B60e2FE08eFa853124438f9E46a7", - }, - decimals: 18, - projectLink: "https://kukafe.finance/", - }, -}; - -module.exports = tokens; diff --git a/projects/shibance-bsc/farm.js b/projects/shibance-bsc/farm.js deleted file mode 100644 index f021503a7d7..00000000000 --- a/projects/shibance-bsc/farm.js +++ /dev/null @@ -1,318 +0,0 @@ - - -const chains = require('./constants/chain'); -const { BIG_TEN, BIG_ZERO } = require("./format"); -const sdk = require("@defillama/sdk"); -const multiCall = sdk.api.abi.multiCall; -const allABI = require("./constants/abi.json"); -const BigNumber = require("bignumber.js"); - -const fetchFarm = async (chain, farm, block) => { - const { pid, lpAddresses, token, quoteToken } = farm; - const chainId = chains[chain]; - const addresses = require("./constants/" + chain + "/contracts.js"); - - function getAddress(addrs) { - return addrs[chainId]; - } - - const getMasterChefAddress = () => { - return getAddress(addresses.masterChef); - }; - - const lpAddress = lpAddresses[chainId]; - const farmFetch = async () => { - var _a; - const balances = ( - await multiCall({ - chain, - block, - calls: [ - // Balance of token in the LP contract - { - target: getAddress(token.address), - params: lpAddress, - }, - // Balance of quote token on LP contract - { - target: getAddress(quoteToken.address), - params: lpAddress, - }, - // Balance of LP tokens in the master chef contract - { - target: lpAddress, - params: getMasterChefAddress(), - }, - ].filter((_) => _.params), - abi: "erc20:balanceOf", - }) - ).output.map((_) => _.output); - - const decimals = ( - await multiCall({ - chain, - block, - calls: [ - { - target: getAddress(token.address), - }, - { - target: getAddress(quoteToken.address), - }, - ], - abi: "erc20:decimals", - }) - ).output.map((_) => _.output); - - const lpTotal = ( - await multiCall({ - chain, - block, - calls: [ - { - target: lpAddress, - }, - ], - abi: "erc20:totalSupply", - }) - ).output.map((_) => _.output); - - - const [tokenBalanceLP, quoteTokenBalanceLP, lpTokenBalanceMC] = balances; - const [lpTotalSupply] = lpTotal; - const [tokenDecimals, quoteTokenDecimals] = decimals; - - // Ratio in % of LP tokens that are staked in the MC, vs the total number in circulation - const lpTokenRatio = new BigNumber(lpTokenBalanceMC).div( - new BigNumber(lpTotalSupply) - ); - // Raw amount of token in the LP, including those not staked - const tokenAmountTotal = new BigNumber(tokenBalanceLP).div( - BIG_TEN.pow(tokenDecimals) - ); - const quoteTokenAmountTotal = new BigNumber(quoteTokenBalanceLP).div( - BIG_TEN.pow(quoteTokenDecimals) - ); - // Amount of token in the LP that are staked in the MC (i.e amount of token * lp ratio) - const tokenAmountMc = tokenAmountTotal.times(lpTokenRatio); - const quoteTokenAmountMc = quoteTokenAmountTotal.times(lpTokenRatio); - // Total staked in LP, in quote token value - const lpTotalInQuoteToken = quoteTokenAmountMc.times(new BigNumber(2)); - - // Only make masterchef calls if farm has pid - const [info, totalAllocPoint] = - pid || pid === 0 - ? [ - ( - await multiCall({ - chain, - block, - calls: [ - { - target: getMasterChefAddress(), - name: "poolInfo", - params: [pid], - }, - ], - abi: allABI["poolInfo"], - }) - ).output.map((_) => _.output)[0], - ( - await multiCall({ - chain, - block, - calls: [ - { - target: getMasterChefAddress(), - name: "totalAllocPoint", - }, - ], - abi: allABI["totalAllocPoint"], - }) - ).output.map((_) => _.output)[0], - ] - : [null, null]; - - const allocPoint = info ? new BigNumber(info.allocPoint) : BIG_ZERO; - const poolWeight = totalAllocPoint - ? allocPoint.div(new BigNumber(totalAllocPoint)) - : BIG_ZERO; - return { - ...farm, - tokenAmountMc: tokenAmountMc.toJSON(), - quoteTokenAmountMc: quoteTokenAmountMc.toJSON(), - tokenAmountTotal: tokenAmountTotal.toJSON(), - quoteTokenAmountTotal: quoteTokenAmountTotal.toJSON(), - lpTotalSupply: new BigNumber(lpTotalSupply).toJSON(), - lpTotalInQuoteToken: lpTotalInQuoteToken.toJSON(), - tokenPriceVsQuote: quoteTokenAmountTotal.div(tokenAmountTotal).toJSON(), - poolWeight: poolWeight.toJSON(), - multiplier: `${allocPoint.div(100).toString()}X`, - }; - }; - // // In some browsers promise above gets stuck that causes fetchFarms to not proceed. - // const timeout = new Promise((resolve) => { - // const id = setTimeout(() => { - // clearTimeout(id); - // resolve({}); - // }, 25000); - // }); - return await farmFetch(); -}; - -const filterFarmsByQuoteToken = ( - farms, - preferredQuoteTokens = ["BUSD", "wBNB"] -) => { - const preferredFarm = farms.find((farm) => { - return preferredQuoteTokens.some((quoteToken) => { - return farm.quoteToken.symbol === quoteToken; - }); - }); - return preferredFarm || farms[0]; -}; - - -const getFarmFromTokenSymbol = ( - farms, - tokenSymbol, - preferredQuoteTokens -) => { - const farmsWithTokenSymbol = farms.filter( - (farm) => farm.token.symbol === tokenSymbol - ); - const filteredFarm = filterFarmsByQuoteToken( - farmsWithTokenSymbol, - preferredQuoteTokens - ); - return filteredFarm; -}; - -const getFarmBaseTokenPrice = ( - farm, - quoteTokenFarm, - bnbPriceBusd -) => { - const hasTokenPriceVsQuote = Boolean(farm.tokenPriceVsQuote); - - if (farm.quoteToken.symbol === "BUSD") { - return hasTokenPriceVsQuote - ? new BigNumber(farm.tokenPriceVsQuote) - : BIG_ZERO; - } - - if (farm.quoteToken.symbol === "wBNB") { - return hasTokenPriceVsQuote - ? bnbPriceBusd.times(farm.tokenPriceVsQuote) - : BIG_ZERO; - } - - // We can only calculate profits without a quoteTokenFarm for BUSD/BNB farms - if (!quoteTokenFarm) { - return BIG_ZERO; - } - - // Possible alternative farm quoteTokens: - // UST (i.e. MIR-UST), pBTC (i.e. PNT-pBTC), BTCB (i.e. bBADGER-BTCB), ETH (i.e. SUSHI-ETH) - // If the farm's quote token isn't BUSD or wBNB, we then use the quote token, of the original farm's quote token - // i.e. for farm PNT - pBTC we use the pBTC farm's quote token - BNB, (pBTC - BNB) - // from the BNB - pBTC price, we can calculate the PNT - BUSD price - if (quoteTokenFarm.quoteToken.symbol === "wBNB") { - const quoteTokenInBusd = bnbPriceBusd.times( - quoteTokenFarm.tokenPriceVsQuote - ); - return hasTokenPriceVsQuote && quoteTokenInBusd - ? new BigNumber(farm.tokenPriceVsQuote).times(quoteTokenInBusd) - : BIG_ZERO; - } - - if (quoteTokenFarm.quoteToken.symbol === "BUSD") { - const quoteTokenInBusd = quoteTokenFarm.tokenPriceVsQuote; - return hasTokenPriceVsQuote && quoteTokenInBusd - ? new BigNumber(farm.tokenPriceVsQuote).times(quoteTokenInBusd) - : BIG_ZERO; - } - - // Catch in case token does not have immediate or once-removed BUSD/wBNB quoteToken - return BIG_ZERO; -}; - -const getFarmQuoteTokenPrice = ( - farm, - quoteTokenFarm, - bnbPriceBusd -) => { - if (farm.quoteToken.symbol === "BUSD") { - return new BigNumber(1); - } - - if (farm.quoteToken.symbol === "wBNB") { - return bnbPriceBusd; - } - - if (!quoteTokenFarm) { - return BIG_ZERO; - } - - if (quoteTokenFarm.quoteToken.symbol === "wBNB") { - return quoteTokenFarm.tokenPriceVsQuote - ? bnbPriceBusd.times(quoteTokenFarm.tokenPriceVsQuote) - : BIG_ZERO; - } - - if (quoteTokenFarm.quoteToken.symbol === "BUSD") { - return quoteTokenFarm.tokenPriceVsQuote - ? new BigNumber(quoteTokenFarm.tokenPriceVsQuote) - : BIG_ZERO; - } - - return BIG_ZERO; -}; - -const fetchFarmsPrices = async (farms) => { - const bnbBusdFarm = farms.find((farm) => farm.pid === 2); - const bnbPriceBusd = bnbBusdFarm.tokenPriceVsQuote - ? new BigNumber(1).div(bnbBusdFarm.tokenPriceVsQuote) - : BIG_ZERO; - - const farmsWithPrices = farms.map((farm) => { - const quoteTokenFarm = getFarmFromTokenSymbol( - farms, - farm.quoteToken.symbol - ); - const baseTokenPrice = getFarmBaseTokenPrice( - farm, - quoteTokenFarm, - bnbPriceBusd - ); - const quoteTokenPrice = getFarmQuoteTokenPrice( - farm, - quoteTokenFarm, - bnbPriceBusd - ); - const token = { ...farm.token, busdPrice: baseTokenPrice.toJSON() }; - const quoteToken = { - ...farm.quoteToken, - busdPrice: quoteTokenPrice.toJSON(), - }; - return { ...farm, token, quoteToken }; - }); - - return farmsWithPrices; -}; - - -async function fetchFarms(chain, block) { - try { - const farms = require("./constants/" + chain + "/farms"); - let allInfos = await Promise.all( - farms.map((_) => fetchFarm(chain, _, block)) - ); - allInfos = fetchFarmsPrices(allInfos); - return allInfos; - } catch(e) { - console.log("fetchFarms.error", e); - } -} - -module.exports = fetchFarms; \ No newline at end of file diff --git a/projects/shibance-bsc/format.js b/projects/shibance-bsc/format.js deleted file mode 100644 index 29ece5d8e69..00000000000 --- a/projects/shibance-bsc/format.js +++ /dev/null @@ -1,44 +0,0 @@ - -const BigNumber = require("bignumber.js"); -const BIG_TEN = new BigNumber(10) -const BIG_ZERO = new BigNumber(0); -/** - * Take a formatted amount, e.g. 15 BNB and convert it to full decimal value, e.g. 15000000000000000 - */ -const getDecimalAmount = (amount, decimals = 18) => { - return new BigNumber(amount).times(BIG_TEN.pow(decimals)) -} - -const getBalanceAmount = (amount, decimals = 18) => { - return new BigNumber(amount).dividedBy(BIG_TEN.pow(decimals)) -} - -/** - * This function is not really necessary but is used throughout the site. - */ -const getBalanceNumber = (balance, decimals = 18) => { - return getBalanceAmount(balance, decimals).toNumber() -} - -const getFullDisplayBalance = (balance, decimals = 18, decimalsToAppear) => { - return getBalanceAmount(balance, decimals).toFixed(decimalsToAppear) -} - -const formatNumber = (number, minPrecision = 2, maxPrecision = 2) => { - const options = { - minimumFractionDigits: minPrecision, - maximumFractionDigits: maxPrecision, - } - return number.toLocaleString(undefined, options) -} - -module.exports = { - BIG_ZERO, - BIG_TEN, - getBalanceAmount, - formatNumber, - getFullDisplayBalance, - getBalanceNumber, - getBalanceAmount, - getDecimalAmount -} \ No newline at end of file diff --git a/projects/shibance-bsc/index.js b/projects/shibance-bsc/index.js deleted file mode 100644 index c62f475f2c9..00000000000 --- a/projects/shibance-bsc/index.js +++ /dev/null @@ -1,112 +0,0 @@ -const BigNumber = require("bignumber.js"); -const { getBalanceNumber } = require('./format'); -const chains = require('./constants/chain'); - -const fetchPublicVaultData = require("./vault"); -const fetchFarms = require('./farm'); -const { fetchPoolsTotalStaking } = require('./pool'); - -function getChainTvl(chain) { - return function (timestamp, _ethBlock, chainBlocks) { - return getTvl(chain, timestamp, _ethBlock, chainBlocks); - }; -} - -async function getTvl(chain, timestamp, _ethBlock, chainBlocks) { - const block = chainBlocks ? chainBlocks[chain] : null; - const chainPid = { - kcc: 1, - bsc: 3 - }; - - const chainId = chains[chain]; - // console.log("block", block); - const [vData, pools, farmsLP] = await Promise.all([ - fetchPublicVaultData(chain, block), - fetchPoolsTotalStaking(chain, block), - fetchFarms(chain, block), - ]); - - const totalCakeInVault = new BigNumber(vData.totalCakeInVault); - const woofLp = farmsLP.filter(_ => _.pid == chainPid[chain])[0]; - const woofPrice = new BigNumber(woofLp.token.busdPrice); - - const farmsLiquidity = farmsLP - .map((farm) => { - if ( - farm.pid !== 0 && - farm.multiplier !== "0X" && - farm.lpTotalInQuoteToken && - farm.quoteToken.busdPrice - ) { - return new BigNumber(farm.lpTotalInQuoteToken).times( - farm.quoteToken.busdPrice - ); - } - return null; - }) - .filter((liquidity) => !!liquidity) - .reduce((a, b) => a.plus(b)); - - let poolsStaked = null; - - if (woofPrice.gt(0) && totalCakeInVault.gt(0)) { - const staked = pools.map((pool) => { - if (pool.sousId === 0) { - return new BigNumber(pool.totalStaked) - .minus(totalCakeInVault) - .times(woofPrice); - } - return new BigNumber(pool.totalStaked).times(woofPrice); - }); - poolsStaked = staked.reduce((a, b) => a.plus(b)); - } - - const tvl = - farmsLiquidity && totalCakeInVault && poolsStaked - ? farmsLiquidity - .plus( - getBalanceNumber( - totalCakeInVault.times(woofPrice).plus(poolsStaked), - 18 - ) - ) - : null; - - const balances = {}; - const usdMappings = { - 'bsc' : '0x4fabb145d64652a948d72533023f6e7a623c7c53' - } - const baseToken = usdMappings[chain]; - balances[`${chain}:${baseToken}`] = tvl.toNumber(); - - // if (chainBlocks) return balances; - return tvl.toNumber(); -} - -// (async () => { -// try { -// console.log( -// await getTvl("bsc", null, null, { -// bsc: 10700328, -// }) -// ); -// } catch(e) { -// console.log(e.stack) -// } -// })(); - -module.exports = { - misrepresentedTokens: true, - methodology: "We count liquidity on the dexes, pulling data from onchain", - bsc: { - tvl: getChainTvl("bsc"), - } - // kcc: { - // tvl: getChainTvl("kcc"), - // }, - // bsc: { - // tvl: getChainTvl("bsc"), - // }, - // tvl: getChainTvl("bsc"), -}; \ No newline at end of file diff --git a/projects/shibance-bsc/pool.js b/projects/shibance-bsc/pool.js deleted file mode 100644 index ac1fb977e3a..00000000000 --- a/projects/shibance-bsc/pool.js +++ /dev/null @@ -1,78 +0,0 @@ -const chains = require("./constants/chain"); -const sdk = require("@defillama/sdk"); -const multiCall = sdk.api.abi.multiCall; -const BigNumber = require("bignumber.js"); - -const fetchPoolsTotalStaking = async (chain, block) => { - try { - const chainId = chains[chain]; - const tokens = require("./constants/" + chain + "/tokens"); - const poolsConfig = require("./constants/" + chain + "/pools"); - - function getAddress(addrs) { - return addrs[chainId]; - } - - const getWbnbAddress = () => { - return getAddress(tokens.wbnb.address); - }; - - const nonBnbPools = poolsConfig.filter( - (p) => p.stakingToken.symbol !== "BNB" - ); - const bnbPool = poolsConfig.filter((p) => p.stakingToken.symbol === "BNB"); - const callsNonBnbPools = nonBnbPools - .map((poolConfig) => { - return { - target: getAddress(poolConfig.stakingToken.address), - params: getAddress(poolConfig.contractAddress), - }; - }) - .filter((_) => _.params); - - const callsBnbPools = bnbPool - .map((poolConfig) => { - return { - target: getWbnbAddress(), - params: getAddress(poolConfig.contractAddress), - }; - }) - .filter((_) => _.params); - - const nonBnbPoolsTotalStaked = ( - await multiCall({ - chain, - block, - calls: callsNonBnbPools, - abi: "erc20:balanceOf", - }) - ).output.map((_) => _.output); - - const bnbPoolsTotalStaked = ( - await multiCall({ - chain, - block, - calls: callsBnbPools, - abi: "erc20:balanceOf", - }) - ).output.map((_) => _.output); - - return [ - ...nonBnbPools.map((p, index) => ({ - sousId: p.sousId, - totalStaked: new BigNumber(nonBnbPoolsTotalStaked[index]).toJSON(), - })), - ...bnbPool.map((p, index) => ({ - sousId: p.sousId, - totalStaked: new BigNumber(bnbPoolsTotalStaked[index]).toJSON(), - })), - ]; - } catch (e) { - console.log("fetchPoolsTotalStaking", e); - } -}; - - -module.exports = { - fetchPoolsTotalStaking, -}; \ No newline at end of file diff --git a/projects/shibance-bsc/vault.js b/projects/shibance-bsc/vault.js deleted file mode 100644 index a83fb8cd1e9..00000000000 --- a/projects/shibance-bsc/vault.js +++ /dev/null @@ -1,83 +0,0 @@ -const cakeVaultAbi = require("./abi.json"); -const BigNumber = require("bignumber.js"); -const { - getBalanceNumber, - getFullDisplayBalance, - getDecimalAmount, -} = require("./format"); - -const woofVaultContractAddres = { - kcc: "0x5cE1e2F6c99aFcfbB6E640354837C263ec3a5664", - bsc: "0x09fE45A62502E7a0b226a99f18043F3eC32F78E8", -}; -const sdk = require("@defillama/sdk") - -const convertSharesToWoof = ( - shares, - cakePerFullShare, - decimals = 18, - decimalsToRound = 3 -) => { - const sharePriceNumber = getBalanceNumber(cakePerFullShare, decimals); - const amountInCake = new BigNumber(shares.multipliedBy(sharePriceNumber)); - const cakeAsNumberBalance = getBalanceNumber(amountInCake, decimals); - const cakeAsBigNumber = getDecimalAmount( - new BigNumber(cakeAsNumberBalance), - decimals - ); - const cakeAsDisplayBalance = getFullDisplayBalance( - amountInCake, - decimals, - decimalsToRound - ); - return { cakeAsNumberBalance, cakeAsBigNumber, cakeAsDisplayBalance }; -}; - -const fetchPublicVaultData = async (chain, block) => { - const woofVaultAddress = woofVaultContractAddres[chain]; - const [ - sharePrice, - shares, - estimatedCakeBountyReward, - totalPendingCakeHarvest, - ] = await Promise.all([ - sdk.api.abi.call({ - block, chain, - target: woofVaultAddress, - abi: cakeVaultAbi.find(i => i.name === 'getPricePerFullShare') - }), - sdk.api.abi.call({ - block, chain, - target: woofVaultAddress, - abi: cakeVaultAbi.find(i => i.name === 'totalShares') - }), - sdk.api.abi.call({ - block, chain, - target: woofVaultAddress, - abi: cakeVaultAbi.find(i => i.name === 'calculateHarvestCakeRewards') - }), - sdk.api.abi.call({ - block, chain, - target: woofVaultAddress, - abi: cakeVaultAbi.find(i => i.name === 'calculateTotalPendingCakeRewards') - }), - ]).then(response => response.map(a => a.output)); - - const totalSharesAsBigNumber = new BigNumber(shares); - const sharePriceAsBigNumber = new BigNumber(sharePrice); - const totalCakeInVaultEstimate = convertSharesToWoof( - totalSharesAsBigNumber, - sharePriceAsBigNumber - ); - return { - totalShares: totalSharesAsBigNumber.toJSON(), - pricePerFullShare: sharePriceAsBigNumber.toJSON(), - totalCakeInVault: totalCakeInVaultEstimate.cakeAsBigNumber.toJSON(), - estimatedCakeBountyReward: new BigNumber( - estimatedCakeBountyReward - ).toJSON(), - totalPendingCakeHarvest: new BigNumber(totalPendingCakeHarvest).toJSON(), - }; -}; - -module.exports = fetchPublicVaultData; \ No newline at end of file diff --git a/projects/shibaswap/index.js b/projects/shibaswap/index.js index 973218a9724..772fb8ccf36 100644 --- a/projects/shibaswap/index.js +++ b/projects/shibaswap/index.js @@ -1,21 +1,21 @@ -const {calculateUniTvl} = require('../helper/calculateUniTvl.js') const {getUniTVL} = require('../helper/unknownTokens') const FACTORY = '0x115934131916c8b277dd010ee02de363c09d037c'; -async function tvl(_, ethBlock, chainBlocks) { - const chain = 'ethereum' - const balances = await calculateUniTvl(id=>id, ethBlock, chain, FACTORY, 0, true) - return balances -}; - module.exports = { misrepresentedTokens: true, ethereum: { tvl: getUniTVL({ factory: FACTORY, - chain: 'ethereum', useDefaultCoreAssets: true, + blacklist: [ + '0x6ADb2E268de2aA1aBF6578E4a8119b960E02928F', + '0xab167E816E4d76089119900e941BEfdfA37d6b32', + '0xF33893DE6eB6aE9A67442E066aE9aBd228f5290c', + '0x84FA8f52E437Ac04107EC1768764B2b39287CB3e', + '0x7121D00b4fA18F13Da6c2e30d19C04844E6AfDC8', + '0xC1bfcCd4c29813eDe019D00D2179Eea838a67703' + ], }) } }; \ No newline at end of file diff --git a/projects/shibshift/index.js b/projects/shibshift/index.js new file mode 100644 index 00000000000..2b850ab1979 --- /dev/null +++ b/projects/shibshift/index.js @@ -0,0 +1,8 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports = { + misrepresentedTokens: true, + pulse: { + tvl: getUniTVL({ factory: '0xD56B9f53A1CAf0a6b66B209a54DAE5C5D40dE622', useDefaultCoreAssets: true, fetchBalances: true, }), + }, +}; \ No newline at end of file diff --git a/projects/shibui/index.js b/projects/shibui/index.js index e58061b6a0e..5f2242bb845 100644 --- a/projects/shibui/index.js +++ b/projects/shibui/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); const { staking } = require("../helper/staking"); const { pool2s } = require("../helper/pool2"); @@ -6,8 +7,8 @@ const CHAINS = ["boba"]; const Boba_SHIBUI = "0xf08ad7c3f6b1c6843ba027ad54ed8ddb6d71169b"; -const Boba_BOBA = "0xa18bF3994C0Cc6E3b63ac420308E5383f53120D7"; -const Boba_USDT = "0x5de1677344d3cb0d7d465c10b72a8f60699c062d"; +const Boba_BOBA = ADDRESSES.boba.BOBA; +const Boba_USDT = ADDRESSES.boba.USDT; const Boba_SHIBUI_WETH = "0xcE9F38532B3d1e00a88e1f3347601dBC632E7a82"; const Boba_SHIBUI_USDT = "0x3f714fe1380ee2204ca499d1d8a171cbdfc39eaa"; const Boba_4Koyo = "0xDAb3Fc342A242AdD09504bea790f9b026Aa1e709"; @@ -53,22 +54,5 @@ module.exports = { Boba_SHIBUI, CHAINS[0] ), - treasury: async (timestamp, _ethBlock, chainBlocks) => { - const chain = CHAINS[0]; - const [data, koyoAssets] = CHAIN_ORGANISED_DATA[chain](); - - const balances = {}; - const block = chainBlocks[chain]; - - await sumTokensAndLPsSharedOwners( - balances, - data.treasuryTokens, - data.treasuryAddresses, - block, - chain - ); - - return balances; - }, }, } diff --git a/projects/shield/index.js b/projects/shield/index.js index 98984c951db..526c871f47c 100644 --- a/projects/shield/index.js +++ b/projects/shield/index.js @@ -1,5 +1,6 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens2 } = require('../helper/unwrapLPs') -const USDT = "0x55d398326f99059fF775485246999027B3197955"; +const USDT = ADDRESSES.bsc.USDT; const publicPool = "0x65081C21228dc943f47b1Cdb394Eb8db022bc744"; const privatePool = "0xFa4e13EfAf2C90D6Eaf5033A4f3cB189ee4eF189"; diff --git a/projects/shiftdollar/index.js b/projects/shiftdollar/index.js index e04d053a37e..2d46a70db19 100644 --- a/projects/shiftdollar/index.js +++ b/projects/shiftdollar/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens2 } = require('../helper/unwrapLPs') const { tombTvl } = require('../helper/tomb') @@ -6,7 +7,7 @@ const SHIFT = "0x4f9bd6be8455ee2b3c7ff76bbb885e6654797137"; const SFSHARE = "0xE64fF204Df5f3D03447dA4895C6DA1fB590F1290"; const boardroom = "0x251672021bE4Cbf8eD5a6Acb66478a29c95c7Cb5"; const rewardPool = "0x585ab630996dB20F7aCc0dbC48e7c332620E7D59"; -const USDC = "0xc21223249CA28397B4B6541dfFaEcC539BfF0c59" +const USDC = ADDRESSES.cronos.USDC const factory = "0x9fB58aBA4a3aD49d273b42cb8F495C58e9a8d14F" const lps = [ "0xCbEA9C785D0D6233d3F965baC901ea42A7a3B05c", diff --git a/projects/shipyard-finance/abi.json b/projects/shipyard-finance/abi.json index 83dc6f2660e..171284349e1 100644 --- a/projects/shipyard-finance/abi.json +++ b/projects/shipyard-finance/abi.json @@ -1,30 +1,4 @@ { - "balance": { - "name": "balance", - "type": "function", - "inputs": [ - ], - "outputs": [ - { - "name": "", - "type": "uint256", - "internalType": "uint256" - } - ], - "stateMutability": "view" - }, - "want": { - "name": "want", - "type": "function", - "inputs": [ - ], - "outputs": [ - { - "name": "", - "type": "address", - "internalType": "address" - } - ], - "stateMutability": "view" - } -} + "balance": "uint256:balance", + "want": "address:want" +} \ No newline at end of file diff --git a/projects/shipyard-finance/index.js b/projects/shipyard-finance/index.js index 10544aa3d85..f54788b5a78 100644 --- a/projects/shipyard-finance/index.js +++ b/projects/shipyard-finance/index.js @@ -1,7 +1,7 @@ const sdk = require('@defillama/sdk'); const abi = require('./abi.json'); const {usdtAddress} = require("../helper/balances"); -const { post } = require('../helper/http') +const { get } = require('../helper/http') const USDT_DECIMALS = 6; @@ -37,9 +37,7 @@ function chainTvl(chain, config) { coins.push(`${chain}:${want}`.toLowerCase()); } - const getCoins = post("https://coins.llama.fi/prices", { - "coins": coins - }) + const getCoins = get(`https://coins.llama.fi/prices/current/${coins.join(',')}`) const coinsData = (await getCoins).coins; @@ -81,5 +79,8 @@ module.exports = { }, ethereum: { tvl: chainTvl('ethereum', ETHEREUM), - } + }, + hallmarks: [ + [1677200400, "Vaults deprecated"] + ] }; diff --git a/projects/shoebillFinance/index.js b/projects/shoebillFinance/index.js new file mode 100644 index 00000000000..9db30a8c819 --- /dev/null +++ b/projects/shoebillFinance/index.js @@ -0,0 +1,46 @@ +const { toUSDTBalances } = require("../helper/balances"); + +const protocolDataProviderAbi = "function getAllAggregatedReservesData() view returns (tuple(tuple(string internalSymbol, address internalAddress, string externalSymbol, address externalAddress, address aTokenAddress, address stableDebtTokenAddress, address variableDebtTokenAddress) token, tuple(uint256 ltv, uint256 liquidationThreshold, uint256 liquidationBonus, uint256 reserveFactor, bool usageAsCollateralEnabled, bool borrowingEnabled, bool stableBorrowRateEnabled, bool isActive, bool isFrozen, uint256 decimals) configuration, tuple(uint256 availableLiquidity, uint256 totalStableDebt, uint256 totalVariableDebt, uint256 liquidityRate, uint256 variableBorrowRate, uint256 stableBorrowRate, uint256 averageStableBorrowRate, uint256 liquidityIndex, uint256 variableBorrowIndex, uint40 lastUpdateTimestamp, bool isCollateral, address yieldAddress) overview, uint256 oraclePrice)[])" + +async function tvl(timestamp, ethBlock, chainBlocks, { api }) { + const shoebillDataProviderAddress = config[api.chain].dataProvider + const aggregatedData = await api.call({ target: shoebillDataProviderAddress, abi: protocolDataProviderAbi }) + + const data = aggregatedData.filter(i => i.overview).map((e) => { + return { + address: e.token.externalAddress, + tvl: e.overview.availableLiquidity * e.oraclePrice / (10 ** e.configuration.decimals), + }; + }); + const totalSupplyTvl = data.reduce((a, b) => a + +b.tvl, 0) / 1e8; + + return toUSDTBalances(totalSupplyTvl); +} +async function borrowed(timestamp, ethBlock, chainBlocks, { api }) { + const shoebillDataProviderAddress = config[api.chain].dataProvider + const aggregatedData = await api.call({ target: shoebillDataProviderAddress, abi: protocolDataProviderAbi }) + + const data = aggregatedData.map((e) => { + return { + borrowed: e.overview.totalVariableDebt * e.oraclePrice / (10 ** e.configuration.decimals), + }; + }); + const borrowed = data.reduce((a, b) => a + b.borrowed, 0) / 1e8; + + return toUSDTBalances(borrowed); +} +module.exports = { + misrepresentedTokens: true, + doublecounted: true, + methodology: + "Counts the tokens locked in the contracts to be used as collateral to borrow or to earn yield. Borrowed coins are not counted towards the TVL, so only the coins actually locked in the contracts are counted. There's multiple reasons behind this but one of the main ones is to avoid inflating the TVL through cycled lending", +}; + +const config = { + klaytn: { dataProvider: '0xBdc26Ba6a0ebFD83c76CEf76E8F9eeb7714A5884', }, + kava: { dataProvider: '0xb2631276eE6524C6A7f205600F44E1408F21235F', }, +} + +Object.keys(config).forEach(chain => { + module.exports[chain] = { tvl, borrowed, } +}) \ No newline at end of file diff --git a/projects/shrike-perps/index.js b/projects/shrike-perps/index.js new file mode 100644 index 00000000000..46c9de04910 --- /dev/null +++ b/projects/shrike-perps/index.js @@ -0,0 +1,7 @@ +const { gmxExports } = require('../helper/gmx') + +module.exports = { + polygon_zkevm:{ + tvl: gmxExports({ vault: '0x3371195e36f45cBDc6cC0EF9e94d87AC8424621D', }) + }, +}; diff --git a/projects/sierra/index.js b/projects/sierra/index.js index f48d2438656..76920615074 100644 --- a/projects/sierra/index.js +++ b/projects/sierra/index.js @@ -9,6 +9,9 @@ const treasuryTokens = [ ]; module.exports = { + hallmarks: [ + [1648765747, "Rug Pull"] + ], deadFrom: 1648765747, misrepresentedTokens: true, ...ohmTvl(treasury, treasuryTokens, "avax", tokenStaking, token, undefined, undefined, false) diff --git a/projects/sigmafi/index.js b/projects/sigmafi/index.js new file mode 100644 index 00000000000..0845f58e595 --- /dev/null +++ b/projects/sigmafi/index.js @@ -0,0 +1,26 @@ +const { nullAddress } = require('../helper/tokenMapping') +const { sumTokensExport } = require('../helper/chain/ergo') +const axios = require('axios') + +async function borrowed(_, _b, _cb, { api, }) { + const { data } = await axios.get('https://api.sigmaexplorer.org/sigmafi/loans/ongoing?limit=10000') + data.forEach(({ repayment: { tokenId, amount}}) => { + api.add(tokenId === 'erg' ? nullAddress : tokenId, amount) + }) + return api.getBalances() +} + +module.exports = { + timetravel: false, + ergo: { + tvl: sumTokensExport({ owners: [ + '47r8CNpYJhLaJy9vQAyyhVX7SLu73dg8EDmi9zzei7YWomvTAbNaZMAHdM38TsFoiZfAcKuyrgngD6ZS2uPQktLfFpvypxkRiRi9LswRYd5tk6B5HHDsFNMfLcdqeWT9RDR2SRq1zm2HF9F913aY1gc9gVyeh8PGED2ThKJ2NCG19XhyPqCbgTFY5uTC6RaqpGCdH9p58fD4DWDd46D3EfUXz3XLzqGQvDGXTghkh9UtZ1LB7nFFoPDFc2QVDt6BCtTQwq4Jh9vFfTfBG9q6ReVF5cVX7nA6vXhWjUuHKMd7Zw5anM2u95e', + '2f7L4F3Q9eCjdWRmxSENw18Bw5SPAf3vBaimRqgpWB5JayiqSWG2tvnc6kF8ae8mpYwtZasmVDzmgjbfa8EBTdA1u55yB8ypRZDDFhs6DmhQekuGvzBoViApMyKdAXCPriXMaJWgHxAdjtR7QhXSjdnyozxZ7ApXrQY6hDSX6H2Fg9siuGUQpTQ3oJDa8nScMGdLNK2T5A7oHs', + '2jMoa21VMLebD9C3j1jXHBCSZitYqMdcqJt7jSKAVwAsVaKifkspA8jfSeRp2dnnQVgjdsXfRDzo4h1hmroTnPsMAB8qiBnyGjStmMxxFirroejmZFgH25zouApdAZtjTERNrvn67QFPGhGRpxopGEZYrQbpj3PmNR4UPyvKkCHzWbkM7cMA2o45RadU4gY6LAoDwvop35QmPsbP2CuETfJPWUKHgDw87wzwPfpBHYxNht3btUuaNB7ifL1To8KotbFKQyRQ3s84vsbed5abchfWhgSkU6HDvJJM9vmt2axcC5P72jEtPsdK19oGw3FsYZp5S9DpKmQRJasDStTRtgBEbD6vnP6orTrje9oJEpvarFdRE9gG1gQKoQdUn5PtssaVhWG3yX67BSyy1mQVkdPq17CrD4di6mhuakBKi9Wn6YTFCvdeLqfSTAaFJPA3uitsqpSkLxNGyqMMtHZ5oahuZ3jVtx3As5N2ZTt835XUYsFE31n3CzfZPvyHCDtahYTRqeCBvPMZw8vdh3a1XtfqNX15AmQy7Jf8W6Y7McsKQVwG5gogXu6XSSCrGn9r2j9m3DBPitUPpEdNqavvxX5Jqrrp2UNLNNfsZZRT26ifnWWa1W5LnjVQVeRFdki5Haf', + '3FdyuY8fqeTtYcsuvTsmsw4ZBGde2cad6hyntGxzSY3rd4JtTwTvK64xp3XJZvYNTijrTMZMQxkFiULuHpq46VFbAiSSHXLe1qy5WXNRELj4tcx6wEPbSDqzDyVbY6wKFQhmvYQT2XjqLJAiBGV9F6f2uXrjXFPzPnXpVeJnWc8ob1wMqbfgBQKdfu24qx3pejkAfAz2hmQQ57xgzGwHCcGyJdad7UxwmDetAUER8iwE32rygGCmqXaVeKGcJ33epYNGpDLPnYUg3Qz7eYuHHb7mAqwkEp6XGE1jWbf8nS7TA1taNpakssbWYN2YmB9NBG8nWNzLhc9QBdqyAn9WQ63Jh1znt2up6sQJR7xnon9ZsYoeo7bErzg4uoJbTLzwjhZBJ9En9bMX72xUb5zhvSSua6CseMMA6s86g2mwrieRwqFM7CGDypy78MzWS1nagUBKLet8LAFFpb6DKBK1h2HpAvLnMbWB7Kp3rJ4be6ed5crNdZTqhbSww96P2KNSZemhwfgAkUFjMJzB2dEG9VNAW1dMk5nBrS8JsRHhYpPqFcJiFtQvcar1ijs2PqsR9k4P41Y99iomfYXkSoA6z612v1U1C19ASVurzuxGP1vNwNyKLceFVTYXbgkgUFX8Z2nwMz6d2TCa4XTpt9daV5sBV88YJgCiYbL5QhxnoTdYRZbxu725jnV7gbnX9FWjLNaXYJubi5u8kPs3MYzSALeUvtfx6wJV1XyBn5DMbvy8XgFFMKyxtUrfU3dAVaZmUZJnYy8Dz6qrf8tyKx3uU7RfosjV7rcAFRDpozznWRfsxZUir5EzcVFQc9NbjB4HdgJxxvUJ9Nr9F8XCQLL89wCTtaNZBFF284qLtrQ', + '3FdyuY8fqeBRBVN7uhPo71JiPcmugpqdCjG5gakgXSPR7DKEGbXWkwm4dfer46kn8nCbAK1Ycw8svJGj2fMLM2kiA7GsZZdVEqDeR9K3RcVHRUCATB9qo9pf9FmekGVfG6pbzRMNrPp3TaWimHFhZCLUyqukuSaf4h9JuDqJE29hHCtdb8W7AeXTV2kfB18jUpDhCKxET3EnoBTHC1buAg3SdhPiBhVAYJFw5NVfph6kfV37nHn6hdawVrdtLbnC47xgQ7KzeMG9spHbEbn73Mz9bhCdPeqnS75jAQSjokrDLDeQSgKU8aN3Cb4i5oE5MUT9p55ignJnjzJ335UfAiEGve4tbr489sCcZ5sCNeXZEGK1WYWp39RbwdpdsfhyrVNKCpXn9xHsjSPwZVGduc5fanzGDGHEESEJCV1JYzzJ32ai274q1aQMgJuPB3CSvcy4pqcJe2XNKVSMrrwou9VXNrpeNv4DTDcnVSjB8kc6omgSYKaWBjGwaSVs6vuHK9gLfvQrDa3G1EMhfpuM3Vqs2TaHqxjc4XQyGRjJnhhqKwN4td5bo54MXEa8kojxXrXSFbi2DwcVzMQemjzxs1m5VqLv3wjCSzP9wXDEhyFMCsRbfNPTju5j7HVsRf4YBgViG6vXbAvbUcE7bA3nHMpB9SKyuGQZRVabo5899yfJpWyUM1DEwAnPDjoK4v1UYsSvUBHfs6adrHWu6oVDhZBFZZXYMVvmo56jhSXhGYTrecnhPY25a2UV5cN64bPcE3vFnW7Lpvo1nvh8XYGT9bJuP9fn1ohgnKqBwpgnwMEZxoCWHqvSsbyp4SV6nMcA416YCBYrNmwfiwFqmhYYFfAYCFdutEx52xa8E2r', + '3FdyuY8fqvU21gvgv1A5Vo8XkkR4ba8RzyqwDv6ig7466wTwax4fbJc5bJMeGnYrRsvS5uiAisS7gykBJsxYgE4LRuRuKr9KzZn4BtcNeT3Hsw3zncjE7yhzSPKoW7FkbijxtTUoKYXuby5W8TEk9L1kBaDzgKRpG1YahyHVghtJYgMcy3utVjRZXxBqZbij3cZtqSNqk3UZJmTBZKufYT17C5Mae62DckHwk6ZSZi9GVSTvw2xiENo5koKya67JcX4n23WPQ4dCVsEKcQ2cGjETJhSCi4fsvFUteGkayZW9Q4jqkuum3hz3imhdSAyPvhHnRTMEPG7PKvnn4E7hbiPsbTRAd5L8DruVosvQkcyFPXJ8qhaKDrzmcqy4baHzWHN5GRqY1CrFMnSMJTmznHXzdPwm4MfdjHXppvxBsmDTFxoRdGtriafByVmvYtkKmH9pS3agL142ByqKo79yFSWucVQnE6ojfY8gmVb7uwHqxq1Lez2Nxjbupu2tC9hHdYeM3kX3VBYrjTnXP72sv3Gr3eocm383ZGC5Ppa3pB4DSYmtiJ9LdxU85WBA36KzfrLLEsnHj9gRFWwqEfA6akTNgtboo4wQH9HTCSyHRFnu4HZh4fHaLZe6Wg1LrbbTrcEWUaMFaTEaGhKR32KG2Pd75BxVbYeF6LTQ5yfVeSyhvLWBgKD49X6Y2AemNdV2JE62cS42WDFNH7NwJL7Zqrf465mWhJ137rcrzUpm4sGqv3fnVuxcT2bY2AD8UKindPGjSzP9cg8Pey8EqG4c5jZ44D4rbmNSGaVBzm47tvNyEZRNAmhRPhkuvqsMDoNNjAGwUDxQ2XCShQHhdQAMSdTfKiPMGxmqv7n25js', + ] }), + borrowed, + }, +} diff --git a/projects/sigmao/index.js b/projects/sigmao/index.js new file mode 100644 index 00000000000..01cf185e772 --- /dev/null +++ b/projects/sigmao/index.js @@ -0,0 +1,34 @@ +const { sumTokensExport } = require('../helper/sumTokens') + +module.exports = { + timetravel: false, + ergo: { + tvl: sumTokensExport({ + owners: [ + "2PnwgiUqPKQyKUNfDShUyoZZA1DLwJyVE7oNri6JrKVWf4DYCiBqqoBYFfokffDVaV9VYahvpDiKBt9x6NVXBkBm4LgE5tM3wC8w2Qhbhh9Ps7scNLGXJZ3tLbZpu1E78ynnrn4MBouTuE7rqTaG6Su8PwkzhBFBaiQgZKqCtQMVDLrN1D6MzAj5MvbpscFEsLTqaWEemPQvxKfx7rW1HgcMSCccWAvzy4pThM7re7Mqxz9Su7ETX2RRmjGksPpHMJxVV5cGM8ijQwNsdakuMWDVLJ7qL1FEaBAbwEih6CdRZMnkYV6sNS3FFrepAa8G1nA21ztiadoQdT9wKx9gfQZJwPe2DJWoeTEp3s2TezdUiZEM67MFa5RiSEtQwkuYzin8nQ7EMWenqmSQkRfhf1QyfwEsWz7cGYHHndBp8Axg29qp1kEzcGBMUA4f8Qivi3JLPrzqKPZH7neTRYmcbYKxSTFkdzBvbKJSVoKcUaUb4QVvpcdNg4TywHELP4B2JRjhaDJFgKQvZT14owh1xuB62VoMGQhoRg8Xub4fJVJUXVSAVLcZ5qhmrc1X6Gwt5a5Nju1t4R6LFERuBYmfreofxpACfsq3oN83cSQCSiNbkRn4YVQzZqGnrHaDbsDgR2wEJbdYfXpfV6YMX525MfCj6t2TXjBzuhyYtBTnQyp7bRQeQ47kfm77gYU6esdCokZj4ic2jxyxnpm6AHxkM2oDLqrvQ8uXCM4oToNEsr8xJWFRmDsUvtu5zs9dm5HGoyXjfjojCXuE2ZMhgweU4v7N21mzGgKepzpJvWARzjtnFFK7wRpCyZvLcgq9Hf4gqdR82Pmiko5azFBYA3T1su3L1u93RxAZTSWEGJ54uoYnbBWr1mT3GDo8iXPjXQ8S5SCwJ5xzASCsvi1DAtS5jmMWp745TJPekGFE7jovG9eoqzYCgoTmjfuFHv6cuMK6TQpFRKqLGPyprmDEGSVZ2TUTzP7JoJZgQxRHrwoAwFRejgJzgVxdxH9LXCuvYvzy4GnNaTJ3eatzhwpHPQjsMdZjBsEbLujgqWV4je5d719sAb5Lqc3Dd6LRFNqR6SRw8cL3XXKiRnEmVBrTokA91CFnjroSgQ3erYBabNTpQF64Nd4BrLxKVt3UEppfXFghaQ8AjBnkjwjkrnCrwt83XtnehwjMGpJksiy9yYKoP281njgfe2S8y6JQziy9peQoSLuUXtLE9Ptz6MmKgn22NonRxMA7Rzqw8Wywsbs9Z7yrpKyzNJJ89Vwyd9aRWBuPLuNEwoLqv54bUsPoiqeyfSK8RaCpE1WhzoCK6Uncrx9pAbysJNZVesMCu5CydDKTJC3MY7ryLe4cL82PxzTjTTrvGPmdtKfro4jpR3nnPFg8FkJ3YktHKzzJjM91fs283hjVJBxuvugQTbd5SdfTro9fd3P3YPSQPzRhEHY63642x8qez4Q2HnhKeKuvhvTNiN6XpvzFMtu5DN268BYwP3V4qc2btLbEWtVG3QLVL363Q4UiBgscq5XV", + "2k6W1ZcLsgRi4qtmdmFKEXGL6c5Av34BGEeRrEVAZ3jeKzmdAX37YEmd3bDCz9sZkf7tP6Pvz6qWcXnWGxvrrBwPqrJvCgubAD4Tn5WipkY5YXz8yjNCzEPaFmwZm6iMqtFsrjhWc9QE91ZYoWzAPU8fmf8uZxuJn37W9wHAV5Qxs96VWiJ1rjo7AiWX7SavEZC3nCBeDKpSnjgsoaq5qEkhYWDYR4woDT6B7ui8o38ZuHS3jDx88YHaMEqKWLHJYmRszJFMM2x1keJgHX3syPXgVfkinmMC8wVACDgQkaALBodq6fcVsF2Hs82XvmaMu4fDkA9uLG9cgw86AWCNWaMhcGp678UPNCeT9hsd31nPaUETxhgyibmonHpJk5if5QPyn3p45rYn3i71Y1Wgq3uvMCwuC682K8vCzc8DVHCDZDQgnBYbbQNypEWAadSWv6iVZU78mjwZ", + "7uQ7MoQgMkyP9RxB7cfAAtZFWUtuWGEWzskvUq4ZxEvh4nDruTmrRQejoBbVmZXirMTmG8Yxk3p7HPQwzziugxxXrQhgXP62k6jrz28xXVz1bNJfACUstvozRNBzcB5MuX2RYMoE", + "V9BoRZ3WH5ph9FY7MfrNc6cNtPdd6PNA7EWZVkHCDiuxwrcore2gCWbGcZWQxpwkqQK5rp78KPSSD1DLV8nqv4RnuN4Q7oaknZxYEN2LbVDcZHNffxSJ1sEVsqDMe418qyzYoaSvTBGZ3e6UkEWVvCb3vzQATAcv7zAEP3dzs7kZEB9prJChfn4mjUNGpdeeh8KwsrxMdS5m2a7TmkkWJ6SH4KCJpVaQikKqUYk2wMKgH3yBLL6h1ZnPtdptL7F6YRkfU74UFxubsFb5ZrkmWV1ynjJ1orz7c8Nzdh44tqCX1VUdFWwqUwH5wXggawXPNwSCR8qLQawkrhAdR7kRBEMGTWMXvwdtXbtQGpiC8VXWbYS77d7L82CYBwqwZk1eYatASrNrzyc7LXpjKZ3JzAibeDJiKSpQzH79QT1F84zvF3pFYR9XTmYMRcNSS3a8qupqyRG1JawzF4FUnnQpsyhTmQYnfQGiG5ob9ymQyBHdj4fE3787VzQRhoJQQtztBhvQye992odAQyJZbdfgF4KetoCPK6t9XTHfKxGtse1yk7MZGUQC4WMF4dyhJnaRcfrJupn4Y5UcqYhMN9vmCUe8BvypkqPUsUW834Q", + "3i4iuEoB17WB96toihTpjxoGeMFs7y9oMkvB5GnAkS8mPpPNbJuyHNAZBaDqURaurt93CwV532VNXe1sQmCGXySDGLmsx8WQXP7yNdK1L5cz3yLfxZkMUKddYejNnyV53CfHs8QVyRLUjCXwZB3g27UxwsirTNvhuWC4F2ACMwvqSgpVuDjpSEb3sgBqjFG1tpJHxHiyss5GyriA2X54Nip35ANWQJ9KXfXRj1ogjoNUNFQVtotPkfA9LdCoF9ZCuT94UpgXw1kj6Ndp1Y3Rvmy4crrxBt2J9PcwiGvq1WNH5PdVyUJCgYpwhHELbZTBABbhmcj92mp3cbBHqF6qHqvG4ZjoVMLvT5CXKkx2u8psshcqTdEqpe2D3QH6CJNAwANv2iY3kaVct2jhjNqNoY7S8RMT18ZCZQo9RJQX26QFyEBwkoAsxAFCLAqVRRosrUUTWkUUfzaVYzMZJ8gsQLAjbD4WcChktk6B5ju3f5WG4YX2C3wjGkFBsvzMcMwZt8ZfiRpdKp7ooJryVBPp8sf4aZEm8GjorjzV58xMzUa2crRLDd3rg3FTAvPzGWKpaaAAbTRyePEy1Vm5B44t32x3Rv2mR9jbCcxfQDAHAXNJSgVFNDaUCUk2p2QqraQNUFY98sg7Q9PDQhbMPafyBpyS2AvPLQgP4JvfB67TzAVwS121FNjdfczHSETJMEf8q7gXXhDu2zuXhVwS4tcWNabS9rJ2hnL7zubi3TsKN2LLboHs8KNkcoGLY1rcfgmhoovF92nK3p5ZP1hE2YyZDwUyH88WydUJiKW4R7GEzqZ88bPfH3NArzenoRQAfWcsbbzBTbMJvfBeRwv57RYUciWqNe2nrAom6GoyFi1RuHfJb3W4Y8d6Ez4Fn17Guhtu7aMBa7uaWaHKuv58wAf8wQgv6vpvETEhPJvSGTaXY4dpbKyGhqSiPSqPNJsLjWMyMWqT9ceQAjhMpitxq7e2TuHCGYzQdvtJbgN2UfyX14r2BEkbzE6xxEQunF3eugXwoG22ymgeFw2qMURmuREV7QThf96o2sQ396tUBJNuMvnbCBRB4XK6wAfiN5xUh3CFwajw5yhtikhjc2o2Uj6yZTPpFcGGqaWbCEBc3zqVQZivXJSp1QcF3eGXqKKJKyoPc4g4uxrk448a1Aa4PugVWqmUsnKyfuh1vd3L6TYNVhmxbnMbkSAm2i31fgMaJTSnodTZ1QcPtvWngZtbwEHEmbAkXppoe9cT9zq42dHAfskPZ4MPysaGbqEKPJcUmNwP4SSa1CtgVShHrtL6Z4CsZJCNjatZXNhSczPE9WDewUZ22jnUaYFQd4ULuJFS5zfU2iBTRvxR83q6xU8NNiWTH2VvquPg2gBJMZS7bRL4AD71Hsq29r3UxNHGDQHDo7YouA7mKUdyLp2BhaZHrbNdbK22T9Y1e6U1D9Y2GGpcX2gu2zEKRe3eLZAiCqC942BoYJob147SoDPmrJcJ1pngJVVg8ECzA3aq8XNWuT3VPbWnyhNAaqqMLYC3RHw7ch7SnUzctq6GVbcEcA11YgvrwVYjnPFLxd9d4MisfARjN", + "4tQGGLNJFJ2pSiGpQZZRxamsS2moL5vEZ2Y35pnqyjXNVdoRQgTNwcwZN2wKpHt1DAndD6pkBeuZbCEKC4khRKxFd9KEJvpEesmZUvQ2RMXTTeXXioMMonSbGHouMX5Ng6GixyNfyHWXrDUJEmbNqgcGsMxUKaab4fCgQt95GU1dgJ9XFVchpbJ62m3R9ZEEWrUPCBM5MmC57xV7uKhdJkJdw74QU6pAMeFxgru3CSTWznFm62zMx3GKeMQsVMLVuJrDkUe5jDQ8Ru5uwZSc5pqdMTPQVDMP3GKxr5g5ghBj229zLJFZZcMjVE1amzioJqeLVFLFmw7bN739P39oPBnmoccJXn7YZzx1tEtkzxCwSv8z7Nson6UEt98emWremVCAYbWpHqqiaUnZzSckLENiAnq4MBdSht7xhRf3NjCRLQEsm9RaGs1hUHVXaynNXJt4uoYddFhZPZC3ZqftdtxUNgwBqAdMQPNaEantUL1Q5qum5iW8oiPJFj7yp4dbt5xBab3ot5eb5yGSkR4LtENHJ4x36gheFmRNx51bxYt5cbzPZLrRNyFLRFaABxKmTT9FHAkgZVb1zNKgnviw2nzreC5Gspqsa2L3tRFGdHQCcEYE2QpkUw3ntTfUfPx4sTkYgimMJ23W2t7wWdb7Q9mT1cyRSD5GzDuvXwKHbKvedVgZSvvLVPUgfK7YyHhTPcv2LyZCho1j6NUcXY525FhbfdquMFmcR6JedSRv8hpWHYJ7QcfWG2StoaM5CjzqGzMWtNXJ6hrmK526jzWzBaDVETaN4afb9k6CspQL3zfkpY3Wu7Dhv8APN7nAH2y4b7vZ3DShvQjNBAipXKnim1b5JQaxGJCFPL8FGXXDnJUx5NPZrh4TgDAzBA7c3erqYHBa2Q44pUoZLBnQBzjEsDAQvfaW7AjX5p7HBZoa2aVVf8QpsBkxwqTxs5QQ6q8An9PYXagocKWMaX7zbvjvXrAQ3RLMPgDQtM1LkiSvL9fQVKaBXcnzwUhiPB5S7UNNdBfBdRa9o2rG9Q1EDZkdqZpQgShkHchN93S4BMVFzJa2e3tbCqyyMRTYeZ3Yi24k3EVSp9hYspKjW37ghPajqLnwrXHowM9dm7JUi2g8nnGowTPsu7TuPaEZfFsCkPUwVyHqntArHwdy24tLHuogD2FYxYNMSS4psT3TJxZJWSCvjmYxpsB1pm24rSEmjcRnbLGwC6J42qE8ceKeY3pLHJS9yEYvBkNjWkw8QjT7hejABFMA9QYoir7fAdEDq6feVUvRVgVNKis9Th1L8AGVSDVPJdSwE1p5NGenH2x1giKsDQVfNeQ9FbaZsQFS1d3CUc3fcSahov1nBnMYWr5HwqeeCotCbL3HT1zjfpZmsYA5hyGjthTur8dMKvy7vQoKjK1RoZW11fQr6FmGsFUa2rAj3wdrMfXHbMdU5hPNN6hjDFknmeGNGzXDfRLUWrUptaiU5bQKhkzSH3vyG7CyjCuQo3hpJGbmSmvdV6px4C3jFLfYDhYTT2zieos3yadm12fpB1Nxt15KWXv69EsJCHba4sng1Expk8TgeNp6s6TzerpsxSCu5Ccc6a6L9phLeVqCQ2QqVWqv8Ve3fW9N8JD3bRY5rrvS9MA9j", + "4tQGGLNJFJ2pSiGpQZZRxamsS2moL5vEZ2Y35pnqyjXNVdoRQgTNwcwZN2wKpHt1DAndD6pkBeuZbCEKC4khRKxFd9KEJvpEesmZUvQ2RMXTTeXXioMMonSbGHouMX5Ng6GixyNfyHWXrDUJEmbNqgcGsMxUKaab4fCgQt95GU1dgJ9XFVchpbJ62m3R9ZEEWrUPCBM5MmC57xV7uKhdJkJdw74QU6pAMeFxgru3CSTWznFm62zMx3GKeMQsVMLVuJrDkUe5jDQ8Ru5uwafpAmWPbXWv7XFV6Yx1pFJUg3q1Y5Cxi4TvYU5z6yhupeXQZgccL253TQKbFupXLzqSJ8J85QNAM3hFCg4xvVTMsdM5ovVsvSXLNXvM2VX12BR5otuJwfJVBAfYdYwPSecEbeGjoCecPS1SCw4S5rErEE8RcTEG9zn8Gpt1aKyT8qhwvvapksxcfGG5d9wCg8k3La87LW1DT5djS6nMZ9XH5zMUPuxHnMsoEj2UhQYBHyX3nuX3u8qmFb2JVgTUZqbYfu1SGHe6FTsQcTgm9e6zt8KFxzrMAk1QSHhC4FD6jS65cyWhwLVPyF2miB8KeoGLCoUdc26vhen7uDiwyz8gZZMaWcSKrVWsS45xK6vi1BNA5LrLYRE6YM8X69jXkcLdZHUgkph1Z9gjr3tCzYXXrPvUsHBLZhkaUTXzNkcnPj4LFTHLS2NGnxUcnvRDjk5eZ6mj7dDtux3HWqzf8bmdd25e4qALwRXDdmoPRw6L6MMvojHAJndjW4LEPmk3Stkffo1EHAvrDBPcmuhkzJ6tq4Lc355AykviKo7daJgN7aAwBW5r7p21RcHwuth6po9eUsp8nwJhrBDHv9CenPAtpjUTE2twL8YavVFbcDigGqQMcCa4puKsGyCmF2bfbgzSWw7R4gh2i4eb9NmaJXqSceYiqv39HDbVuaQhzhitfXXG9E15sCf7MK95F7zfmepD1uLzUbErGZGWDtDbNnVNA3QR66QkwivhHXQh6Ce1ERp3xAa7V5hNa4HnKZJLgGqNC6fCvLphUp7ZaKX883bSyTUn6VSAL414ss6oxejQT1C2CFrYceSecF8RhLSDBUeqiusYuwPgNrNyn7jyRxs2KuoiJQZpftnvF6rpg5fs5MyzkhG7hG6RwvfMG2D6BxDobHYumQq8ZHGZ9RYeiKZQuScAYsNF7JmondyYXSW97ciyCSGLskSdGxHq6auJzc5SE8bq8tjJUPpgKhqfbew8Ry93oWgSkzUnDjS2Na2UG6mf1RqZcVphH6LWrpvdtJEQXxYcoN8w4ogTMhm8iM5WEXDL4H49iBKpHkqcntyKx7sEGt8xqif4bbgBkpPvFDAz4z6aqTASnjgKdmmBQfbj1cAJTPNtZbnyQBghjohqEyHgnZ3NA5qm1Ax289QHtsiTLvB7c4HhdqRQ5reV3APRxg3Tq9fENvZB9UAeHoc68QkuPqEnFCtK29i94zAVrJiMu6zX1p9NprPf5a1Q3MYspfMicf4zJfeJtZj3Qo4jbnVUkjrtDwuY8Mjaaari32ipiqXFeATYvt7w9J3hky98aK7VZh4v7EdAmMzckYyjxZMhejr3gTj8H1g9nx22R3AzZaAXkZLdvSXArKKhB", + "9YRY2j5TBZrc5T8aJWNMmxmPWyA8JMCRvtTQmpz7QJSJKED1fnjgt2FLEf5tgHZAKtZZvprxZdLx91q4zDYbZ9GCAd8DNmoAJe4fpEU89HMWa7NdQTuisS8vKGN6HuBj73rjzCfUuA6xupEq5ihPSC1a9f7w3GayayDtDJvK9wjdpf8tV18893kPW3sbZAzs6fbvZZhMpaA8EmVg7n1UemRDAv1jxgGs6vHpPb3FUk59Lpa6r41Fp3ycwiGMy53bVUT4V36bFXV9sJyE4dCnyjK4Aik8LVc3u5jymVH1boSC31q6m3PMNsUiWxq8N91m4NXnDZiic5jT8iGou1g9FodbTN5ntExFr4s1rHnJ2FbrSqxPbZnvZFekSBJVFDFXYbGnwpkoEEk4h9RZLHGrUgYqp6sCEWoiUddKyrxgN8fjUZx1aEEV6N5kgrarJpfpUQr8YCreCJH6cxfgSeGxrHKMKK1xdfyhGfHgfgo2XKWmGPySFuSTJDkNAJZ9C5KS3RKCMuFvn2zREw1T26hNQXpwMADnMF3SBqHrqhdzxdaaPBkUXncoFnbVKYTxo4x2WeTCx4Pp7ZeWkWBpGaoAiMwRenqcK9GbXy89Ff3DF9UGunGsGMzch4qwicWviFrqcUhw87CZu9jhEEj7Akw6A6p8JwqEEkM4qFpHCpn3DApvViDpLZoCNGF23uh9ydy2Sa7v71ohFBSojDv6dQexKY9J8UwxuLm6FjLm1XwBwX7Dq678zdKdTHkxekwx2ec1x5Sd48NrVNHSoVNbA4ZQvbh66R6B68S14HE1oDn5yAS39wQxPpe8y2qg25wa4nFKPJRo7LXa9adP7sCyQvrp26PhMp8E5b1VCYNfSu1dBDxEU33JVKyaKB1rU8bQk798wLRtqnGo5Bg3MXVdSmoM6zGrDuzYfmCmKj78yTP59EHLEd9P64hLVB7igtSZWaBipkadxAFUFSvoaNCgG4T7p7wYSXjCPcKnL5BPaEwvdovd9VjpoaahSEac3QRaDFtfduym4GC6ACXW9bs8zYRygGf3hEkyLMwHfEpHJTP6U4cVka8tPDpmZq2L7aBkSYph64SctB8yKe3HuQEQJnUwtuEry3ysbAaS12CQZj7xgGyCqhVQc4Eqe1Dvk7bBmKbxD9ABcMypiMUpciEg4xAutR64TJBbrbvQ5R4JuX6a3oc68WExV8YM8MufyeTyGhn6NBCCttzRJS3FRJjhyrjDDx8C4i7Xcmz1b6SDTiM9MrzffCExDxKabhUucTkxoA5sA6P8aqyw7yGBLZ1aAbULL6vasLqrihF1agY6SSthh9cjjyidZBytvZ5k9v1CsunKBoc4G742RQUzERXhpyikiPEqqRE6tY5oTGaAdaTihTLG54iRkYZgwMen83sXLTUzjSYA4q8A666nVaTHLafdHs7BdgqtrK651ntW7BC8Vm6sSWs2GnyfsPQxWQYhnFGX5ZTaWMnPuSGviXr3xcXRknqcvaGZDW4BuUgzDSdug5npopJw6FLbGKTyXZDsQDKgHTHKr7iegEPazg53RxKBsqiAivNiqz9dBNFwrSwu8eVMkL7thQy4zCgnhY1gxAbasMPMqcNDDWPq7tvS4LR5GTMrxzzzZiszXnSfnJrF8nSrK", + "2wF8sNAVsk5NkVqW2tt34Q6HgnHMX8b3v2TWAsHfkFGHF5ep16ZUU8vTnKdiunuoQEvHJCtXuok1LL77t5izFHkRzF8YVNPYEvT2efNJDKdj4YAxRH3F92XMh8VqFGyikYopcd5rvCcnciHW21fhnEGUdZcvSfjtyCWbywgZc95y7vm6GvTXTxNdaDKJNinkzNiTvbqnzyRFDSWaALpmTGAkaXtaTKVyQrgwieBV6W5xbW23FT1ibjirjLBoEWaKfK9NfQMDDzjYDu82PvRXBFdE8Sxosv5LnwGVXVtAVmrEbgLtb9zXsy8BKjhhUbmZmjjjqcDSKbmQ1R3E4oX7dAnb6wwPHSJQtKUW47KPV8pDAwP89hVTik57VEAJ1Tp2ssUN7CVZc1HhUYrmuoFCfrWPPwoYhCXR8NEUzjvVaZc2JmofKo4huZFTyD4YV1JnUiaAtwMUkBGZdJpQbrMqtUUww5H4p5VtDir8di9tAxBBewkimAc1YeraJUpCbWsb1MJWwk97bkZo9XiMUX2uucVMjq8EnMWcmfcihxRp2omZ4KPLfYMsQaDu8hDc5JL6mdtcPKAyFKV5LW2ALcdbNoqyPEV7AanwnP5SL81PSX6L7PTcCCrkyBcmTp2Vix7DpxVerZpbpxxWsAhGQPu6BnwSioNJDXUNGyMKZKuLnMu3nBqYeSkWf2XUaouTb8N5UE53iAw81gCvHyHjyqUcNhAGW3CCQG7VfQSwVuwqtZyg94kjcS6nuNvtBBottQZi63XbiicmeFPZJNdBUxXpEiTjQmBdTdYmNbL8mDH9XMo7DpRnPGdAYwnUXpreXxAxnAX6yvAbMVCeK5dsx65Cw2jJyeGbKCQ47bjmMPLtsgzvoXqBnHwBNu6eWuEW9q3shTqeyGsgAjxtxA7JLpkGVE5EyVSPuiAqMnsThNXeopshL2sd5a3HS6De4VXtXQLeiUvLYPTpqipiD59obempFrj8DsTWu5oP2LkCGzHErtfSyp8GvVRbg3fm4HGiSbP8DEr3CPGRKgTWkedVGQ3wT5R6ULUsVTXjZXCv7V8McZhCxH1skeJHqEt2u1jbtWmaS9KH4n5J1rp59GFeqZaLSbrsRoXVa495yppeSG2ga52iJcE96ZUTuHVMLTVmTZ9fVnT1JJdbkeRQcTxXNQQnMADBPNgSfbT7cL6JkkrAiRgtA74rUajW2WYFuSEm6bgtfKTmUk8VgADHEQsPhpJ9egibddASoezYw1PuWWWeq4Qp2QcwbwgWbiMRZPyga4eezzZVZP3f1X8kCXWxJapqTBvZtogDfWnoHKKe3kX3yG6ntUZ2BJ9DTj5ZUUwdZP6vrk3C1KTJoMMuXxhVTwGsDoLADx4qGw8aPpdobKBMEfWHjSu5yNbZoffBDvrcsQsxMAC9vbeMmqSYBxvGvqLQNfV5oU3ZHS6uB8ys6ESSGUxS9HLrSMEZrHmwWeYX7XRSE6gYmemWBnWB3wfjSiMk62n6nnhTweEQhj6pAUWGoqdsVCfAyzZ6C9x1JETc2YbGGQJET8kisX6rzqfx4APm786vSK7wyK7xCEMe1JZrdtpTv7xXwxAn3R9NcvJZAyi6Ms5BJYPpEt5bXMn4fYHZD7JrJRHuQiBctnpARmv6PLB9", + "DfVFCdP3wxHvs1T6zV3UaL1RWXGbVUouKbBja63RCjur5imaiNUSPWh4DJUzkQ74FK9exj66xjtRYwtYtndzyJZWvbAPjML1znXQZ8S3hVTNBfHXmyZvCpK3oSdproRWHQBHYtPsxDqtFoqdwLPqo7B2fpjUxoPksRpimGzqWUkQpPb79NW6B8H9qr7ktmfpy864YgMDcXZAQPoTVZRPsozRaB7UJ3xbgVmFfGfkivF9Zm6FCWHe76M9rjFGoZjZbEZWSv1pyn2XhGMZhQYPYysMToaEKrgXZwnvkejzWdt2jk7PYbzCeVGQ3vaTrgvZWfMuMxwTiFiRKxb55gkNbcSnojSDzk91mA55CV42K6HtijTjn4JukcwafcfsM26N6eD8s9a5wDhtVFNy6XSU54nvkWo4AcSijRL8hHwAHS2LyhgjDmExQc384TtXhjjmKUqBKumJw77gFX7H7vitSPpSejHLJ7AaNtoZEaVhPEVUnSgTLizkfCEZkSsAufXpRVgHNWtyFRwSqraDfUBkuTgDBYE17N9efhNA5tHAQDKBkFxofR4cQL9veBMPCJSSAPieoXjo5a8J1NXZuyAiub53J2J8g8FBkHtesNZRuEzLQYUtDmDfXhjBSxDV8GDa4eVgbX2FyPddAfen79vXUKWDEzAVnDkHezvmmJSd24in5vYCuhPDhBXvBcXt4NL6MmH5gHcUWzWEcj9pXvs5E2tuFhPJGbyVGqJkqVcAMX6dTA2Y5Y25CHPU9W4SVo7d78avDa1G23nGhGzf59BBQPJiDeCs7Mo5qS7PX6RFFeKtwEnzvhh4vmzbXNcSpE9wvpZyaPaiscmjurti9djNMd74zecbii9bgUKEyh913ze79xcYZ7s1DZEj65u9vHgVmMUbyfzBhnc5FpwpdQF999DEdioYhJ2gioYxA97gLbmzHjqxFt59Gr1STcn9UeDsiwg7rJJRu34DNxbmSa8x51kBQYCFQ5ZQ7izJzk5FVAaNkurJ9wh8tUC8iXzqd1o33rpEb84jrNJdxnkB1JHo6PrkWfHxQ2LvAZSTPS2W9EmmS2qPF5i2Hegd5Mt4zzCSsdAQYBJG2DDoDAyMskZPLqfJ6sgS1i5rRV84CiGsvhoJg6d7xZc6px7oCpxpnMU3iGRm6Z5avWo4dJBbUYRvdtiASxzqz1UqZJA5SGZ5iad6xmQ61dSGT7RpSWnXZ8Cw5nNicUD4YxYy5fckVSZ3qkt8BxBsB2r5Q3x4ZVKMMe9oPE32mgY5YPqVyXnanz4LubBFhKmC4LoyHLxRjuSkvMpBwN8usbwTj87zp4sxomMtcEhKsagTpSg5Qvms46ERpLdsiywQAhLkiMEeychcZtVhXTTPdE2sTVPaaR21uALrLWwsWsss1awugG3eZFdR8oAZF9TTdAjTMViMcuh3GxzhmgoxEeWPuv6TyzkpWQkAZVCafnchPJxa9QfWZ6Z6rt7gAry6d5eHWkm3Qx6aQ5DCaA6JMrjufubGJJK12mHRnEvjU6xNj2PZzj8y6WhSSh3L4ADDLhvprwUT2udQHPgMZmGf5X2oBXyNj9hAmYJi8mdHeHfF6LAAaDmEduWtDGmzy8778Txy1ZT1SjE2Hqhwb5figyFvfMtTY9wdv3nQ7Gws8", + "DfVFCdP3wxHvs1T6zV3UaL1RWXGbVUouKbBja63RCjur5imaiNUSPWh4DJUzkQ74FK9exj66xjtRYwtYtndzyJZWvbAPjML1znXQZ8S3hVTNBfHXmyZvCpK3oSdproRWHQBHYtPsxDqtFoqdwLPqo7B2fpjUxoPksRpimGzqWUkQpPb79NW6B8H9qr7ktmfpy864YgMDcXZAQPoTVZRPsozRaB7UJ3xbgVmFfGfkivF9Zm6FCWHe76M9rjFGoZjZbEZWSv1pyn2XhGMZhQYPYysMToaEKrdFPymjFMFAsNt2vSWhVxh7X7KigVuWQCTv5ig7qcM7aShwN9fnpMtLMxh6jadCWN5ozS1oQ4pQxx4E5RzQwen7YJ1j6jisP2XjJ3vSozEzBqeui2kUevVQwDxc2jziAodhPc5PWNS7KaAX7y7m5PmgKU6sSnXnuPj6d85gv95fmEr3w8DpttTf9m2oQP4PERchifotFQPNQ83cod3c2tj7BCHnbFR5JaJadjbbxk3634R6JFJ56v9S3JGuBDZjZ7dVo6giLJUybDBRbN7xYTbzBLHyYdvnhXnczMvRGQ6XNVdNVbHkLheRQGqH6UAsMR6SCkyuW66H8boKGjTbNFigtjj9MGPbyvjAVQUWteUpJY9UqmNYVpbNesm2jx3sVQLy9oEMzmACKkjrM8ZBk31SN9CQLshVfPdBFPJ7Tb82uckM3t4gYXEWJXJGQ1JVMriwHGizXJ6pM8gckfPb5XLo11hu1P1eXz1FDQzqUoNyocTA8TT5KArePH7CjyQUZ5PAKv6d8UbZMcJwdxiwFhRQtthPGbhbWKe6ttwqz3pw3Vm15y4PUeknf6ULzWzvZok31J7fB1QXyPvsPZMZQ4eWGf4mqkM7W5ff5DgtvXaRP2oJCDQueTr1DyApSwXP796uEWyC3M3dczzsS4DJ4fe3Sxz8PSWFoKKZR4KwxJW9gtBdYN8WyEjwouzsf7tGtPQN5y6jF7VS914grZkMMVYBCVqsN58vAazAHVnqdSkoUmrdiHjUp1bFFZhcQLZx3arj1JK9mFGzarthvxJYMUH1aweoAE84o18acqrxNJsQpDGE1oiLrBukBs2j8t7bC5Cb9wJ4NtM9bD4vsC1mSpyW3utVZHDWcZQT9dD18MyDFzkoeQsKFhcNtkGzyUg1yo3uy5YfM79pnMnmGYWxpYz8h75DL8BFESjJvdwGXYzAgo6fGep7t7hzdV18tmrXUhUwW8VFnqjwLki8ceEzvz3bzc9q7c76qrRCt1fe2pAD2ku9HhZhpFBQ13yLR1inM71Brq9KdWD1ek8GSCDmanqmuV7EKf2WtjsuytbBmHs3qQ3djCZPX4hfDfqXbKqfsVfAATRsk9bNCbgGqqfGUgMrkxV6ErMtShWKc8GS6qHYdJ7p6TPu2Xw9SntozAXg3GSFLXrGyFhKQ2z77woL3EG8MTWnbjqJsWPJm6nrPtcZjErwJ5uArH5s5mTPU95mrmRDrtVQDGEZJ363APFmNNiqaJVigkHtiRAnHhStL49xK5pDhzmTxhmEwt6Y2yYmaSqAxoMa7szdwqZaJ1b7qbq3gfSzBdUE9K7HjL2MAoTKu8W7dL8P8j7fXbqLbPN2KHfAGDim6hb2BXsgtXT5D", + "DfVFCdP3wxHvs1T6zV3UaL1RWXGbVUouKbBja63RCjur5imaiNUSPWh4DJUzkQ74FK9exj66xjtRYwtYtndzyJZWvbAPjML1znXQZ8S3hVTNBfHXmyZvCpK3oSdproRWHQBHYtPsxDqtFoqdwLPqo7B2fpjUxoPksRpimGzqWUkQpPb79NW6B8H9qr7ktmfpy864YgMDcXZAQPoTVZRPsozRaB7UJ3xbgVmFfGfkivF9Zm6FCWHe76M9rjFGoZjZbEZWSv1pyn2XhGMZhQYPYysMToaEKreqRNRKK6po3m1zS8u2h5wn3N767WB2LZkGSY5ayo74A9nTXGteRuZU1cv4ZUudsmAHbLR7XCvgKxGPnZ2hfYv2n9c2xqcUyjJaaewAMhrEBw3ZswNvNA9zobF49ak1yXZA2EJ29bghhMk7EFZqSTTP3mfUtunS2aCfhgeMJ7HBgLT6HHxyJfygfvW6XEjNgfnzFGQjfq3SNFCGcbDirQJ36wEbZemFahCLGi5oPLzPzTSgN5i8wpNuyNJoaBGBwpVTnHdTAi6HPda67xTbRxyM6A8pNprveRGPtgxt6Y9CughZatz3M5kxT7GToXUWTuv3zZCceRPkxffcscSWDyHrvPcweWgJS54MA38njaKKBRAQMwvDUt332uiUTNVzSaAHkZzDNUS7JoJjRQZiUGBua9t7YRxoibPCQVPtcFQqy6rJNawrkUyVqDLxDnuCfttCwxzhshtvZf6jtgGm9E6XDw3m6rtFqqyUWFwQrnE4jc1imJf9reFR5pU2VhVLF7GoMb9GTHrXG8x5vLGuDsPb3GNsPDcMMC75a3qpPMtTVRmwAY4gfghhmCAEiFwV2fTZuXVLKJRUUkmTVB9qwFpBpyH5hsjVxG7LshYNBWfqj3a7p8u8nHKS2sVaFaQXsoRcNzmduTrK8mdvBRkQ8XbQGeN1pRiVVoAhTM2sqv2KHMLAmHswtyKFc5JD9jkqNV14SpkXETMQDQLRh8X5j3TvAyMK6kBXdqwwdPzGVGqrjbpsZJd5GtquJSfSDh1mF1yUrq9CaXtxCALBDXNgj4ZrjXUvGeXC7SgjdSubtBcdjWVuBkKUAUurszLnT6j9LY9gvQLn6HhAB661Yy7yqYKRR8KciVrRJtAjp7VN8HjNixdALCx47kGp2wm293FHshLmBRtGMHSsNmHBr6bYUtTsZV6jVRxqaqFo66ZXVjt4ofdhYCAK39ubmaBB7WXajuG5XrZzK7if3HwVUbCjo4cSJwVUzujdQNNtK7DyjunPkBQqwbPKPN1c5kLdYippp6bN2JHZHpEWedfw38dTtDwFavc6qyL3pVAcRjuJWeUeR1Wb8Lsji639VmCLk2Bog4tDbQGzDsmr8h7Q2tCFWmgVameJJWpV5j3JXC1C7GNfWwUAE4JUnYoTssCLTCzPchJJ6UqetZQgmvG2w4zZbz185gNea4HtzkMhgREaZW4tjhkQqRppN3DhgsHXp6KYf1w3YkPEmX1qVED3hQrvghP2Mdt3WbxVYDJcurMTCht2EvdjZyEHTbz13ULFvsUxRCa8XkoGcgq96LRac724fPQrK6dCzQVeUkj5ygvAcXcqMJm5kVhPJRxYTgU8Xho5VPgy14ZbRZ5wBojGu64Mm", + "DfVFCdP3wxHvs1T6zV3UaL1RWXGbVUouKbBja63RCjur5imaiNUSPWh4DJUzkQ74FK9exj66xjtRYwtYtndzyJZWvbAPjML1znXQZ8S3hVTNBfHXmyZvCpK3oSdproRWHQBHYtPsxDqtFoqdwLPqo7B2fpjUxoPksRpimGzqWUkQpPb79NW6B8H9qr7ktmfpy864YgMDcXZAQPoTVZRPsozRaB7UJ3xbgVmFfGfkivF9Zm6FCWHe76M9rjFGoZjZbEZWSv1pyn2XhGMZhQYPYysMToaEKrDP659LKft7LjBqo5YaTaYmdThf8X71Ky2sUoLWEWjHX2uKqhdKHnS95Ngwovo4YFWKMA4pWNpy23AaK7a5Qxs8Uc31RgjDekU2Yhm1goy3xk7sa4rwJfQPHKp7CBQn6NcWVW2fwmk6SVYAWDgj1jvK3kWTxmuBFReAVpdMXCTfRALMi7MuWkXVkuYgrgxpScMTfCZgYFApDhCgz1r46Y6AWgcJW1h6HejfatJCQmdujEoTSz76CP3g7VxyZFSmosAyRkQaDAkvud3bgkdawWftihkwUHvrwnHWtRqehsR7ybQa4Fgipfg67nMGJPMLcc2T6fR4Q9jFehDPU1aBaaBprxneHERTSJNUF5ospECkQXK4VDAcZscz4kJkTnbAnrBd8a65Wa6eWUWQqUQUYYP7yPCUeDy3mJDQJm5MKUSM5YxphNucf8a2MT9KdLvR1CM78jgpztiKupoparB2mBw1HAN7uLMZzRgbumypf66w5rLsVp3GbEBWnD2S3UJX1qxQZBGVcDdXviWoBq3V4NiqidruRUfyKhg8yJ74GGJtJfgBrE9oFDQ5zPqTkqkrm7k8b77C7E4G5gp79udZyKn5FbkazdVA8rE8PyzMj2Q8H2qJ1ozapi6y5qi7os4CNwiqxoUMyvQxvqHViL5HzhiejKgnsCMXEm18msPtxrx8yvQPu1u1HCe5PEdNAU9UiGhrDYeTywfbgw2ANaN5BRYwLqb7SYzs4zrBHV889D6VXKVqpTPBWuHhsLpCEMfcbp5qS8tVX5ubHQA1Fip3nWqizMdXi3XY84WwBc1FjyHUnRrJCDa3PRWMzAzqVZyjgCyGQP8iq7baKDAGw4R8DmKXdfVV8dqmYP5479vaqutCWLEz7AtZtQve3zf9MRpQLtXnepmaQ7J9Ddw7BRb4DkjWR2acubBMDcJvEhUJbMr3tqcA9pABzUTyKmYU1igEkCZTDRqArs81yUP5MDJ28vq6TuGrrcm27V4SJcKEdxUG7PATsYWuBSRpk29iCYDz7hG9DxsnSps67HRREZeE6kZRr8rTR3G971eqZys1992fk4LGLZHKUBDyXkyKtCrNCGwt3UeqcJuewxvQj4RZ3z3gZaZiBX7pAS7inpb6jxyio8Grt6poyfwCykhb7NaNYHGZGx9TvYgzcEudXpTuzhFRgg4aTwbhcU4LKuqY8ZQ964MrRTJGmem8HN5LvrpRDpn7R2FERfWoKRsEmrULR2rmjpEe1p4WsVcpxNhT6RZeoBvL33sD4XnV1bstiwiD48RXt9S9UE5YnhjNZPaLkp5v581EZzk4US8JdXCh6X9sSxYjF5G6rA3EEBiXeAgQ9d6pdcTwkdwPXbvHEr2CK", + "4tQGGLNJFJ2pSiGpQZZRxamsS2moL5vEZ2Y35pnqyjXNVdoRQgTNwcwZN2wKpHt1DAndD6pkBeuZbCEKC4khRKxFd9KEJvpEesmZUvQ2RMXTTeXXioMMonSbGHouMX5Ng6GixyNfyHWXrDUJEmbNqgcGsMxUKaab4fCgQt95GU1dgJ9XFVchpbJ62m3R9ZEEWrUPCBM5MmC57xV7uKhdJkJdw74QU6pAMeFxgru3CSTWznFm62zMx3GKeMQsVMLVuJrDkUe5jDQ8Ru5uwyCBu5zHeqqGcGzqjvHbHHGH1ev98wMmeqGbeGpi4yL5Cxq4FRgLDUTr5g9C6eTkrwuE31q3YYoDAzwfzFHtq7eognqaiWMR2t25qb69QGDt8wnYKHMNkxNuug7kBM4btmhPm9D6NcLJsCScWueFAtHnQKgHGmUSde9HqsiFXehmXcnJL2rQpWaj12ktNcruUdLKYrpbAGAoUtt7QFD4jwaXmnJZcPPymV6fb3EQ71NMAL6VBaSu8wqhYAXDsfHa2s3pfYxydmWiY4n1FwLYAgfh5mPhK5ukjzxbA7ioBvWpHhDMAnZhGdj6AHKN1zwruyjEmrRHFP9J8bA5nVhgQ7uqQmHatrZY2e3i2Y2jvgWSZrj12b6YKW3pihasyR9fiYLy9MGtV5cvEHCr28h8F2xFStkhkEP3WqkjTXzJYuv8cL6xVMv1gXxM9xpUBkchSw9WWdzn5Mii5xafufEqVTT1L7Zpbr8jr36S4h84HUhcnfton1pEJb3Enr8eCEjcJqvsPZaxjr1pkL3rjvVHRWM1rWYp86LTEGwQgAcAvBdkRw1QoJASBH6uMfZWMgRrAsyNPdbnQHX1Aupku3Gvy115p3VPhPtnC1p1NSW3dUGH94z6MRq3aG1kVpn3vjnG6mKuFWRBqNTHVj2wk7cJgjXsSeydDcVxGNNh9FyCwSjjLnp7H4FNESK8d21TYPfNSha5mPu6UGTRo2oNrSbjHRnFPubYL4te1zzowjb9JsQLGKzfYyXoBgrLmjvcqZcNJuL798eSr1yACpWm5928K13536MV8BTtR8FgNA57WNkzLQkuUi3hEwWEkG8hBK1DRbr5kU35paQ9FuXo6ZDhvokenubw5xXxnXMg59Ky3ce2xA7qnkYTv5orD7ipLybrNL8PN4KHx2te1dhV399qEPChRPegiFL56sDavsJuRjgWCWxkSoKaL3hvR7eLBuMwxdAch21Kpv8w6ex2di9kHFEuXKZCfrEtWfHbp8KbfRcyzkG7DwVMrHygPbvkBNXxnEqvBXqBaA2TJxUQsmvaPRahYtiyUSpSsScQwkTEnEGMNxo6NKFiLn1aiN64b6bfgELNHqV3tJ99WvhvNNQBjRAzJZFk6EeURiJFwYyn4w9MyA8hPeoGAt2WgvqAMYfKfysoiHZdtfnyQJKXAC3Bu2wj3qZ7Su9jzKJgykFsrUvBkcGPTaQ15KWbiyQ5xvBW3xvw53Xw8uFvMb2DM1FdZTguysxxH7HLj3ZfkcDeL1iykH9RVS3mABVFe9XvRss2Qwg5aoqcKfbtDnTSrAGkrJ6iZSgKePbUVDavN479WJhZ9oXLjuQWHhjtTQ6LCeFGZroTksLAppottiXNDy4un", + "4tQGGLNJFJ2pSiGpQZZRxamsS2moL5vEZ2Y35pnqyjXNVdoRQgTNwcwZN2wKpHt1DAndD6pkBeuZbCEKC4khRKxFd9KEJvpEesmZUvQ2RMXTTeXXioMMonSbGHouMX5Ng6GixyNfyHWXrDUJEmbNqgcGsMxUKaab4fCgQt95GU1dgJ9XFVchpbJ62m3R9ZEEWrUPCBM5MmC57xV7uKhdJkJdw74QU6pAMeFxgru3CSTWznFm62zMx3GKeMQsVMLVuJrDkUe5jDQ8Ru5uzBrpBUJWAamhRD8zzu3iHTh6MN2Zb5m64ydpNUrtxhECCWPDaSSRBXu9noUmHTR93e72FFyXcxxCwx2oq2N9S2DyoEoytLur2nzgczMPKqEMvEfy8X19xp2ih7hNCthn2eq6Hqr7pamZUWp7srji587CkDFq11YnKMgXeGweRHQ3hPTGeFCnaLMJ6SAPjj8VgPKQMEhnT6graMsAgZiwqDKiLtPWqVCvzZ8Dhhma62moTthnBc9aw1v4WNsnnX43VnEgWVQFnnxwLp55uv7AAhxHC96EnA3jPrXcUNadm82njEaHBayfzLy9dr9PVjPHhrrsWThvG41ZPa8iP936EA81c2usCtWKqsie71hrmxB5CzJypFV5U6eurtf7t8pZab1tyKCgn4pN6HBPuFTzRV3Tcw5JTsdTbTvG7f7eieC9UrnuxFFwHdUgdGXnfAmND6j3Jrzhxsc9rzbEAv561QdKmns113JZeLNrUdkfvPr7XiSethpQugvUt1n2cNHwj77whEHMFnKgEsygJUD5xVKtG8cxS9AdB4egPe6gwSuGuW63oBXq6xKt8RURmy3FGf865LqBtb5a7Q1SdxnyFWPQsjJrPpE9SsyBfN8VFh3wEsTqNUtfnh6WwJ1SdRFycSJBiuFK7mWHKqJQNNMwrzS88Fw1AJscbvq23AvgCj9RboGSn1CLd4o3yqNec26i9Ucgy2djVxZjjdCsxDhqsRoevNjrNsRbAE3fiddJ2T5pxWg75NYBiCDiqd9hc361MUNy8n8BXA87CdexrstrGUHQd4EW424cVAoV7X48kYmHJnUuegA6aXKCSYvrMhEGPC38trrYgDav4DN1VzKK81nE3zjHS2JrnXGiNsmven8JFH3yEL463iWLw3rZAVGpjSaEHWsgKnf3JLB72kA2D6WrFjv7PWWPuQiKLgsSTxLkcbDcQ7ttdBfzMuMLFPtahcsdYgjrrRc7v99UYEyMnfJMbJqWAAquguZQ1WvacdjdJmRue46QyboQeKE3LuscRk4nhBvubpSPbLcwEaHsjeDaw4PwSEPS5H1GQt9iWvCybjmnFvSB9G5a6udRjJj9nVL8N483uJUfzSfxgLLmEQ57EoJ5rDptM8oAUB1zd12KuE7Bzgg8t1ENoS1MxPWRHKSgmC9qWjpVQHxKwPT1PyRaxsj6CM2ysqiwtEaok7G5d7dMdA7eom8ENB2JoSFSbsii6zSDBGkuzfakJeatfWvYtu9phtvykaWAqbqwk33u9jZkbTP6vjrgoxzGDQkdsdqNKn3BXwihmTwJfG7HQidueaW7LWiq8LR1Hw3X2pWzsrwn8vag48qhBfxm65gvm2wGVVvxthDPMvHeLPuZS", + "9YRY2j5TBZrc5T8aJWNMmxmPWyA8JMCRvtTQmpz7QJSJKED1fnjgt2FLEf5tgHZAKtZZvprxZdLx91q4zDYbZ9GCAd8DNmoAJe4fpEU89HMWa7NdQTuisS8vKGN6HuBj73rjzCfUuA6xupEq5ihPSC1a9f7w3GayayDtDJvK9wjdpf8tV18893kPW3sbZAzs6fbvZZhMpaA8EmVg7n1UemRDAv1jxgGs6vHpPb3FUk59Lpa6r41Fp3ycwiGMy53bVUT4V36bFXV9sJyE4dCnyjK4AiLX8BnsqZm5G1dTdPUaJD4XAi5pQa46XTS2NL7fZpLnUVJcfH6dnLxdmTEuppABYqXiGM5pT9FQbkaSyVxiqfFS4j6Q18pn6WSz1DQfTJRQtt1r4UA79UaimUsoMEoQBXVyVyHCEpChf99faDaasNmZ7Qc7WECCRi7yazV7roJNAb2EmhBMGqXQjokt7NwcRFJPd82k6NtyjEH7CXsVgRQGnZ2Sie6H4A51L71MsbMV5cy6rmJHzXVYe7fGwcZGxVeCmfCQVBz7w1xazYSZAM1HfoFAkggj29Zq1N1rbpBRXQvSZd7d9rLGFwgozk5N7AMmwJY9r7HiQWioZdM9A5tXtKDZ5PnFi163HtyZHaLA5AwnBzpUutigkYwT4KpPdzqFJNtu3heu9ZBJ6VxQZaXHbG2YmZaU84c53dEyLitW2j6V4CXVzDTLxe6briherveYiwvnGiujFCGuisBktzGMcgsA32qR45pnRFRYfWuvPTNjLWUkd3LR4jjEgeds41PW85rD195Lc9Aqtt7X1f9TMBuR5cmyL9enRhEipaSiReynxcp2iofKH63gneHkCbite6sJDojdK5tnUhzPSjZHYeqHfd2eNhWUYdZG9kFjxfBGk8v4jDXvbp7Y7mKPf6VTLieBcJK9ufke3ZonA15pRAG14fzKNxWvYr3qPEWAJUF96sms6TFuLV77PbZigKJooajg6kzDzvPEbwaDg2x9j5rATPEXv2iqUXK1TJLRetS6mckqQQ7CsQy1a2sbQ1UmzxAtmRLU2KFmxkcWiPEqeQvkgMYKksySajBEKybTDimesVoDkPLrNeFQmXr46voqPo9hNaerkZN86zjspPWBLLmGE3BWJVyzMiEGzPPJTDDki4n6hww3zbeiniJqboSTf7DrvaBRL3YiG3RgqfvH3spVjsbDB96KtqLRPqXCQHftnt3jwCSGYW5P1hVGdfQSnq8Re2a8xhkoQpbRaa7B5JEmVyfNXFoLbzwXwdE8f8AeQbchCNgCHJjksdJ7BsRCGTZoqS1VDLSyEC8183XG5rsUHpKWvibbHXDiZ7sfVDa1n3jSFGNpQvKisivXhZR4ETVfYg6bfLdbZyNuY3so8ax1vCTTsanXtxva57PMLPnn44s1BG1nHf6pPFYhBubJTbG7qvGf8TLdthZYVohsoVW6j7kGiMhziupRLJp5oL9joBg1AjxrhT3Z6mkDiJUc8KTvmZjtnbR5E2JEti2WCwabGCi28nnX4hQ5GNGLnRJPyAQwzXTce5HCWjD8qn7L94Uv17cChouKNw7q4A8jp6udJCLGFuF1rdUUBmkjtwQG1vCP6hYe6VmP2mG7s7WP2ctSb7qDdzahSr4qo", + "2RsDz4W1HJ6FBsRyHnBfHFpLfJkeVLAVVc3SN1xCct4EEs88B7jHasKNoPVyer4sLhafNViWaSbsKaNUiqwnb1c7LHF49bKDTZtp5KgC1scYWCJoRLu9Qr8LuzVNmS97QsSV2raZKKMG7e6uyCGAFqn2VCSnBWtUhgHRtg8r1KSnZYd8BpWthL8QMqxSjABYp8oEjCnP69Fg2LugAApCj5YkdJDknYUw4Ph8iAnmzHBRggiazCcRKscYkM6ZySqGUJ8gjtBdnWt5TZQ9rVdoPiRa9z5tVNcwgYQi5WoWdr4Mj9RhPskN63rKBifnAJnnbXCcZdAFKLvQvy1weiY27tWTRD9eLYujw4ZLGh9wFk1er86zCsg1ntyU5CJ638J8y3i3pf4yUhmKC2DhRA1YqMpiukRjxqeiiXVLGMhhWsXRv8N4JHA1N53SzmZmi4Ba1V566SgwGbFaWJQYSNmLSRqgaoKWTuqz4bcG2AYBXoitrrsgraVsh3Nh56KLzeNLPPJTMpnQMS8MKCCoq8XkwdRjf1fd5vmoV43dAAUfez9joYWBZdiCNZfHUCB5PCPjuZJTLXDVcmwEn5ALJurdH6gyUPu57Z9Dd2a2BbQjb9YdHEegaaKn36BJoA3iS32rexEf6uQF4yyhu4N8NBQqoTbBE2BWXAEf81dZ76J6vuc7ZHg53UBW4E4KiymHfbHPfLAU6vLBcuaAemxAP4YgsbU9a7MYR9hMxtdSc4mpcauDT2tEGBT9fMm98wVurk2qXBS47oXNWXDUbQhDMU4DhB2NthU9qkWTvjtsXGdBA44Rogk3FXftUBfYwDR1Sfw9PnNaYaqdqnADhFCe33jGXD3z49bu1htufZRnoHK3QULiUiN6SMgHDhvCjEK7tvuNSTtbjZ8rBxF8FFkHNTD76W8cdkw4bGjPeNnQn7ujGhkD4zvtS14o8bPH6wA8qthaHDHmyvA62R8C7Ybw2L3gwYaKjCnTHuDB2CiFZKvhpVUbmvNXJLMtAJ66J5UjE19JmjcGTEnbSrXCtooYpVntPUFqAjgfddFk2TyNBr8SwhKLSAAPdmN8R21qArCxqoR97968JkQh5SC3kH8b55Kos3KAsFMBbJgek9Cs7DErithUsB4CM4HN275saRSNkREGdRkSKbLmdbER26D8sr6VBdFz7CYRDUoWejhWsG7vgAeWbZPpncCsAQmu9gMirps1aY3xPSm9nfmHFQ67SFzBE4yg2rbBTqbuhQ46yBALRjuAPC1vn1MyrVuagDcoA4NSXVARkCNnipGqUPm55WDDq9zZixSjfVQ2qr3RrDkZJA5ucb67h7hAVQpBJtacer4GCCHseEh2yTip2pYPwn7h9BHAcrkxNNVbmb9iscbVtP7o7dVBCrQCmi59f7QXHhk8rET8JPanWDCJhwnXbmLJUJ4hSUkzVw1LvyFY9qFj4MZegr3HdKr8GzWHnoay9MibfxwMjBH2gUre2bjUtGHgAeMnhMAd17vfaD3aUjUQE4pwXsAGdoeUzn2Yb68vBZs3jqbaktpcm9Uzm8DB5iqR6mp2Vd1y2xXWG8J7bHcUPdR5y9hL2fpPUH7hhR5byJNDHZYnMLLETmF9J6TmEE2k6cABvF9wetw5a38dcpS1EV8WXh8uPpQERn3", + "4tQGGLNJFJ2pSiGpQZZRxamsS2moL5vEZ2Y35pnqyjXNVdoRQgTNwcwZN2wKpHt1DAndD6pkBeuZbCEKC4khRKxFd9KEJvpEesmZUvQ2RMXTTeXXioMMonSbGHouMX5Ng6GixyNfyHWXrDUJEmbNqgcGsMxUKaab4fCgQt95GU1dgJ9XFVchpbJ62m3R9ZEEWrUPCBM5MmC57xV7uKhdJkJdw74QU6pAMeFxgru3CSTWznFm62zMx3GKeMQsVMLVuJrDkUe5jDQ8Ru5uwyFfu8QeAwhd3MwnV7kFhdAXsvoDWj9SsyXtdF9EJhHBmod6E34PmJgQWhp9qEnu1qwQw5Pqaw48EQKoYbME1ceE13vXNcQmWYGTYJT5qVq3wHJEsVWTSQYzSNGcTaDrSonH2b8rmAPGceLLv8Dcp76aw8UbBEUXZSBRnTekkh52GRYJYqHoXf1Pyxqtudu5FUWvxwGkq2ZJDgqLpTkCw9SrkuPQJn8QZErrNqzEaFzS9YbDoHs99SxaX5kmzMt353Q3dcCQe6YE65jjKydFkNCuMEfybDbP3Dk7t8dxhpMcrL1qdh4YhMV3QV1z2Q7qfYNoLbwjMxdqL4ESX7VZTXhJ5MuJ8GMHoqsKiRWz4ge1z474gksy8DXKVKDFisWpNhcL7hvJov7mKj5gjq2xM37fJe79QoKEb8WNywGzAgVsntvKKTtParmkiNtWW9bJMr1ewzW27FBhDzvaXutkXejfJKp7GiHGiLUDkS89Jqy8YnZUwqo7Vus5fgVjxYXJHACHHhGuPPSkKf5PaFDUCJhDLKz7to1djuVeNCJBnDU1JjHVNeznQWL1wmsuurTgWnaCww1raacT8jnxc3rj4v4BYuTfTdgJsY6sPpuX5KHNNjWGyvR3r8R4HhKUJteC7mv6czPTPTSy38rKkNW5pT9NxUQQgpSxFt3s6Py9sPvovSj8xU3Cu9RhvPQQnsKfEWZDXs6BfhTdVaXWB8CYz4Reeb2CCwtdYbyxvTz2T9i12EA4PecRXGjqxddm9CwVBEnWhzLFiSgVgBWyGpirSjujv6v6SKUc2MWyyqDRBWmBTZjKrf7DHvGDe5fVWZf4kwiU4jMLkF7T6AdSDrMnnUsdfWA9NcajV7U1VTnANaUtcB1oc2E4NiqfdFQHDrMbeN7K2HKzod6bjuNAYh3sQ6BBotKAsJdNbWCM6THYceY4nSfkSfVBsUdaiqXaUHKEXYH1LNRBdr5Rx7jPGm6sAUbSdLWD6UT362gK69rBc3auv5rZSfThL9bY8MPLhJN6hzetknw1bnsrc4UVqmYNgXX4tVJHYGwiPw2hjQsJC6f45QbvyFct2jeQ62ARhi1kmV5Vvb5VfT2DnCjKkgjXgXw93JVmhpgnC7jAiWJr2iFzHjfgvUQUBgMCT7DnjixDrmJfTXVu4BZjP7AVaBa34PBkgznofoz7ojJKJ1sjtRKj2Gg8gknwLsVaTjKaqXsgLtt3TFRYGmoWHtpihadJ3ELBbb1S8w2LmUDiWbJXw4oyHdcVuW6TWofniQQh9XFZX3uu7omug68ttLGnbbtfmvqmdmYNAz4apixj2EW1shev7ciwAh5ZF5hCvFsrJBYFSbxb1BGRoRQWvxQ77z6Hq", + "2RsDz4W1HJ6FBsRyHnBfHFpLfJkeVLAVVc3SN1xCct4EEs88B7jHasKNoPVyer4sLhafNViWaSbsKaNUiqwnb1c7LHF49bKDTZtp5KgC1scYWCJoRLu9Qr8LuzVNmS97QsSV2raZKKMG7e6uyCGAFqn2VCSnBWtUhgHRtg8r1KSnZYd8BpWthL8QMqxSjABYp8oEjCnP69Fg2LugAApCj5YkdJDknYUw4Ph8iAnmzHBRggiazCcRKscYkM6ZySqGUJ8gjtBdnWt5TZQ9rVdoPiRa9z5tVNcwgYQiS3EhZMmc78gU1DqGVM4HruSkCZoeiReXaUwE232Uprm8P6dK8NM8nGL2NC6bMraxqpKNUvx39ENjSy9z8rcQuU9t4KUP2tfvHxWFwZ6nU2EWgpTDVkdwg1nbJyDLeGL37FgfiqzdGhS1QgmZsinpN1cowo8P7fyyngHuUzD5E6aiqS7uNVvUmLvQ4TDGA7sDa6UQqhd8eTxcm7EksetrQqXKGZMzJApp1HLvgxdGBNUMMajSbauk1bjVjyCpcjkJyLznFerZEqcmwEhEnCXUVdQaM9dtRhiMVVVgujt925rEDbjGcjkT1XCibxrcKBT2raL7W6ScSFTm9py8z3CtBrU4w9htwDoQ7n3pwheEAP7LKkMzBXdEi3J9sXAJy2pJBqM5bGLvRqXykdswpKCzogpGktfXRpiQ5d6TooH7MTEfTibvk9aEoGDhhuf5oakcvJnBGkebMfK9S7tbaWQF1NudjFrUJoD6ZGFFeJGQs51HTTCT4UWhQyYED6ZdCD351YJXG5bZnVr4Tc8oTDV1LtSVbRAjtMT9Fai5fh6P1Lb9P2NGnXayVWHdkHFGFT7drCDAjsqyA4ar5bWUwadLgpPzKpim9yuCdAdiey6FUitJfqtWt63MMEGBd76ahd7SHnXS9QVsuytrgu4FKRYbnfo3akTTWio1d4EorrebqgpcCuyvduR4bU4dJHsqYfZ8qmL4FtqiHLw7P8dKoeWkwvV2quu4nuxWtZ4TWLP2MqeYYyCFEtC6eY1b9cJXt7VMVCJGjsoy63vWmZ13S7pQytguUNmipW77TL7z5TZSsBEY5WsDNeGTFr522YynUp6fWv1sYzxSDDg2Xb5gEaDWx8McJYZjbyBUmwPoaiuEizs47A2fKP6dTbBck8QAGEeD5XeXWRS2equjpF242CDMY4UeGWvVbD9BzfitimAtK923nRtFr6LGP1GsTAL4TNKMMHxVpWLHfXbsWF8uq2ZJj8vPFBeymaaNdqnoPXzaRmt8T5vDuZYvFzqgKdLsr42e6sX7j2iNgNFt4obmR6fqYk3EABHVYHJ166ArX16XNRbF1MPDyTqESLiBQA5MGEd4jA89YzMM1CtzcnRpy9DrJsDR7xZqhq89aVCfB2WGF7sENKcrRBRXRvAGts2ciytTKTj2aToq8AifQMBFZiWieHtRwQUWz3ieLU99Ygrh7zya57wAYpJ2W1DhyjjXpvkgAKrJ3FRFqLMkz21iSSwFTjJk9d15FxGun13wyKcjcwaRytmwbx4QreQP88mqsNcSVZ2UYkfCaRa2HreDf19RmxzCQuXWpbhX5GhyDqMvrMn9rW9t3afKn7wpZ26UQWkDHM8L2edatcH6ojmb2tV", + "DfVFCdP3wxHvs1T6zV3UaL1RWXGbVUouKbBja63RCjur5imaiNUSPWh4DJUzkQ74FK9exj66xjtRYwtYtndzyJZWvbAPjML1znXQZ8S3hVTNBfHXmyZvCpK3oSdproRWHQBHYtPsxDqtFoqdwLPqo7B2fpjUxoPksRpimGzqWUkQpPb79NW6B8H9qr7ktmfpy864YgMDcXZAQPoTVZRPsozRaB7UJ3xbgVmFfGfkivF9Zm6FCWHe76M9rjFGoZjZbEZWSv1pyn2XhGMZhQYPYysMToaEKrVo1ikPrYsQKMPDqBa3Pg5U4ZXUK58YY6Q4n8H4NQM4fYo8JchQqqhu7Hhf5oSGnkZPJ8MhCPLbg5i1XRLZDFSsm6Jq3LCdrdLuyiGUafaWznLi54oghwQcTBdhjABWLZiZydxMxjq7uD3NULABrXrC8FCaKfTLEe64FyhjxuFch2EmrrmhmKGjvzYqvc67xrWpvYSZLDmVwkH2wC7hQmYxTwPzant3GwCx1uhREnHHJLvv2keK8bAwhb4H9GCygx1p4s72e91NXBHg1RmR7YQLChEDjMLgCydCNAayi81SGzspNkqGQy4CThqYGRP6vxXPHP3ZYyn8TGvyQDtGahgqNchSHTGbcxcTp83fJ7wEEDpoEQF7yAVDkosRFYz7b98uiSFzhQ4PVtmLhY3fGCBySCqUhjNjqYeufh2uE4P23ELxEbVQJAFQw6aFcpudZmHuyXreQmenqYfnSuU1ZixwNGs2TJrqGVVTbpKNtEqZCp6ZbdPTETJPHtja94qBBdh5qgTfWeZQVfXrZsnXqWbjPBBQC2j96ZX4cZLXSc1GEzQXb6ci7yFQvZoUY4JPETwCQetSNUajLcnZUay7V9pFbKv9sWJfgUBKh3nZ7fsKcYBgMmfnqcbtHjZ1fypQj9TS1cnDSGj5tkbuZUVdGh7PoCbTSC8LE1eCEA6KBSJzSZLVLUFT2JQVnbb28fYEMtRcwB48T84mP1MTDuP1BP1Bpsntm2EWcuRHA4mVTBpcm8AYksFpyBwpiSHosBwRhxoGiSsFp9YB7cNSjQQa3k5EHbAm4Far2qYiSymWXWDVejdCygubcLD6dctAMcqswj9js6XyWRcBxgCBUQCXTM1HohBLye8DYe1k51doqLVuEqnniWqNSHR1Bik6Fxkxi26zsmwB9uMdfovRJ8jYmtr6BSKY4Ameb83ozKTDsMHcoq2tVP6GkCm7Um8FtwRYQRGLTzJcT8BH1QyUCwnThFwtoD45x9YoteLdY4ahY12DK1dx2dpFhC5dyKbpXMaBEZ6xZKmBJE6Vr2WBK8Y3VYmvsdNuyktEvNdMmSmLck63uM1xCRdpSWpRy1RioKkk8myvCF45mhNgmZXcDo8BY4raFjfLCtUzsvQXyoeS3pWuvJnkuv9JSe48XKqXtWDxukrbzzjU9ZrNskEBzMUfao4LFYDSy6FVEo6kpNBWwa3yeN83gozACAK31HqRYV3XhpwjsUyNiE4cqpvdWACYkbQvFKJZ137B4b76vFC3h4aqdcF86cxsRbZ7jE3sifk15ZKfbQJ3CbseD1XiBoLMCdgefKoYLTZGDvimwh1pAP7s3M8ttRxM19UNLHGatTtEiSB654Qo3MkaosdceFUzC", + "DfVFCdP3wxHvs1T6zV3UaL1RWXGbVUouKbBja63RCjur5imaiNUSPWh4DJUzkQ74FK9exj66xjtRYwtYtndzyJZWvbAPjML1znXQZ8S3hVTNBfHXmyZvCpK3oSdproRWHQBHYtPsxDqtFoqdwLPqo7B2fpjUxoPksRpimGzqWUkQpPb79NW6B8H9qr7ktmfpy864YgMDcXZAQPoTVZRPsozRaB7UJ3xbgVmFfGfkivF9Zm6FCWHe76M9rjFGoZjZbEZWSv1pyn2XhGMZhQYPYysMToaEKrESE3griYC7sq7LWyGr6NTyzbgn2arrrCEjKoUe1HdXRERBe2YjxTMtFgFqXGeB8dyZddrQ75apZoGzXheCbHt4PXesqwzTPg1ybNoqiBDLr4AyoWqkt8BNFCzGxNL8Rb5dGozChvJG82batVEwbjbygaL9mmFHxBi4kNvY7abk8bh6gCwFVE4dKBq6mrvXaoqnR27DpwrcgSHKpBkB4KuWqKBMdKXCmDSFj5E7LRezwEWyUTu5exovMknqgj9hiMKzczK8RzDhLsEL9w4a1FKfn4UYcpk9dNNguftUQgQkyzmUPDaMX17acbgW99qNvMgGvc2xc2aTqyCNTKtzbaRiXyStQz8onT4SmgxjvdEXiTRCtnG953sCYHYGKrYRtvdXQw4yTRhoXznKPiFoYC5fse51S5PRZV5VjLbQZxX3BfMmwEXMt18TQyBd2WJLryKVdVtDR5pmxPrrpHjeRdAt1Ar7r7hDy4mQ5kAaFLzDVsTWCXkRZdAG45S8FvQfWV7Mh8JLEC41HdSBuZdaNXbBRagKj5W92EyDyajYLPQ5nzUmq2VJprLitQmzTrBvV6qBJcxZm42kDazY3TKfwZ2d1bHezxNPbiYZivy8qm58Z8aPKQQd1qEL3WbrfMQRTGFTDEC9RUaLKPnS3fdovKpbxkmfU1oou26MeWFrATRp5FNJiGNZ7Gb2TaLokPUhrv9sCMg7g5x7MGBhGpeXdAyb8hri6K5SbVaWj7fHgEDJnjhTDvF2Y9A75GE4tpcsM9XHaqnvDeBZakjUdW88F28LfTUHmyCjGmopsgChL1rjKFoYnqV5fDHKWqJtSLjeg6RzXV94CGzyq6BD7mojdVtmMQjnQEbFcnrs5am55w8nUE4F7jk6XsEsiZinN23ehG9zuAMJUiXtVMPWbXefRAUwHLpbnCur32C7suwCcFzzxFS3w1sMkJhvPYi6bfienqhX1tks6cfR4YkPWuu1HaHVbCrYybdA5fnR8hqM5URG4HSXXfLe8hnK4Lro6rJx1m1bXeYxdgzJdczejDKj3rmedSu4HC2BMZSGVatPScReH9sQVpZ3GS7ALpr5TMm6jisYLqFT6JWfZsJmydqrn5QZMZv5x9XAwkWEoEB8Sk8W7SuH1ZwvS4m8pDmegVFKWXTLqPxW11q9ydWZQ8zjqMxDTR42K2oVJUkRk3qgcsYiJSjyLBrbpheArpxB7z1JneQ7b97zu8j1KQS1aHTFvxU4ANRU3quRtySxy6iPNLapmwpBWwK6uniGkv3UmjWjvhzx3fiTC2rrMj6NdqP1fLAUkMTczWHkdCA4abRmPHiTYP3YuTvyy1QcQhAowwcdQsnD959dHXtJ4XsKAb4z8", + "4tQGGLNJFJ2pSiGpQZZRxamsS2moL5vEZ2Y35pnqyjXNVdoRQgTNwcwZN2wKpHt1DAndD6pkBeuZbCEKC4khRKxFd9KEJvpEesmZUvQ2RMXTTeXXioMMonSbGHouMX5Ng6GixyNfyHWXrDUJEmbNqgcGsMxUKaab4fCgQt95GU1dgJ9XFVchpbJ62m3R9ZEEWrUPCBM5MmC57xV7uKhdJkJdw74QU6pAMeFxgru3CSTWznFm62zMx3GKeMQsVMLVuJrDkUe5jDQ8Ru5uxJcBB868FiQToHL5G1dW9W7RfJrD6ZqAgLBm8V48XCSG9TfZhrjjmj4hukQ8etisz7FuDu1Tx3Tf2bEhfeqm9j1WUpzRt5DwYQc8Tu21gdT3zzwNgPkTugxgzJH6cPL393tgktCXNF5Ar64s5E6DodUXhc5NEapAc1uSCP5RaZ7spaEhXr5XsUqH9VUzMhSXSss2ziDiTU31Stz9DLGdhumXMzbR1y89zHEeKEWA9PFqNqf9svF41hiuTinRNeSDtpMqcf2EPDyEbB87kMQE4UHTzFn18DEHryVpkUGbbL1GT5c8E89rUqNGtEG1z1Aw8849veWDoX4xqDnomWT5FWWj2ozAMbbRZqYBDGxWZfPq8XZdXwz836Z6m1GysiCJVCTuMXUZnZ6Lqo49thrK8SPUX656rik8M6Vec6QRri517wf6EWR69iLe9ZUKK99XbwqkFb1y3kni6mqz4Z2q6a8QdepMNfCUXTPoFe2MMJRQZ3XdxSSKd3Ht71RfrGbDdR4Gu9xojZY46paGSBGDsDmvQFbnqQiN4yZjcNFwrVvpWPFVQL5hh6BBiHU2WGgEZ3doc8hU6kcJUMaNkLMAKusMCzhDWr4rC9m9qoagpBojNTqttqnvERLPggwKcpP9wtYrwRXgoSVKiQTFmbRtTofcCgFjCU8wgU3DMRWY289oH5VvKX3WkJ1k8UbDcnymv3V18zCRhmaLwygDSbzXR8ye92fjxrHPEQa56D7WVy8dRjVxAPfmWw75QVTusmRswcKNipLE4RSE5Kx1gfGcsN52NkwVYwV6aGN9T65MJccvEdUbG16Lz515QbCFtK5ay1TBkzi21XpR5jwiUBU4zc98VqS21YmAyVgbRf4JMCJXHzKWyhpYaa3BFGuVx5by59DVv3ZTjghKdHt2osCGSHPmoXRw2MA6RdvZuiPntJ7TsNcSpSmJqftZTCSXvkYGkDuoj8YRHbzKANs1cu2zkYHz6HANxiTgD71px8Xrtooh13RZBQ5PQ3ZdzpyT3etAGEHqcYsvAwm12zhtctL7NXuDpgJ7V1NYcuAXsRoRkBVMU5WUPCZ3ZmySyAXFyGf6XP2U1mKVoTxKRDay6JJr6kDa57zDYQJD3L1beKBUMXQnFhfyzBBMDwVVTvw7n2t73wz6k5jHggtU1eBKhRmhwTvur9otMJmtXN5yGDY7vcxxnP3MFeptq1zAGXYFFdQcU26ceThahq9TpixmZFALohtyjUCxBYpSJVdZNRW71Uueu7sqjKdBtAAC9e8NtdekJMYqsBdRRiui8ectZjJL6Dz4zuEmq19ruQsqxF4v1zgEQaTX35djjg44k91kBdQN1TzNHCvn3XireZyP9NKRW", + "2wF8sNAVsk5NkVqW2tt34Q6HgnHMX8b3v2TWAsHfkFGHF5ep16ZUU8vTnKdiunuoQEvHJCtXuok1LL77t5izFHkRzF8YVNPYEvT2efNJDKdj4YAxRH3F92XMh8VqFGyikYopcd5rvCcnciHW21fhnEGUdZcvSfjtyCWbywgZc95y7vm6GvTXTxNdaDKJNinkzNiTvbqnzyRFDSWaALpmTGAkaXtaTKVyQrgwieBV6W5xbW23FT1ibjirjLBoEWaKfK9NfQMDDzjYDu82PvRXBFdE8nyhYmsYXmX8dGVfg6kMcKgMqXR4C5QsmUqJ5bazAcWYPCv4LpsQtw1oMa31f25LgXMt88HWa5V1iQoZNXbh7drCERXhrpGsPGwAbgRqJZ5DfRvc4EtoqYiR4N66i5PkrpVHYJTV9VHtMv8zFJEavDaRaUk9wPXqprTXhjk4f8r3U2QtBTPrp9YUMWL1YxoeAtdQCMLSqRwRVVvJbXPcQEKzTUUDvqsUdDofPXwVHVq23Z93BU9WKDZ3YR98VnRdrFMKavE6uGbT99ay5XtYZAKhNVrZNdJnQyLHDsT1DnT4QDZ5mcAJSAVpNgwoPFmvJYrcntoVH1Pye7rJHCxZSRrwo9kTeM1RBS8frGMJmUiPcC1K9yGb6JeXQADEsNPPG8ZXTRry16JdUCjDW1JYMV4YrhuX3Kr69R2LHJ5AVgk2Cup2LjSEJ8FJ2MjHaAgGPPegn3UCWbZYM2VBWm1pBLaXEEYP8cc22JmGWVcbv2zP6ixGDefdGS2E9sEnQj76avTz8qcejTgaP8tTVsgBdi7sTSr5xE6peqK7tbT7PWL2Skwhr4BKQyfi38nVbyfH1gVtKLVoiK4bcpVdzdXRtkCoqqVeerXzonnFHSgzYFuH3fUrbJQrDwSCfyE42dZjeC3SD2aqdTkvLyKbhs1ws2diRcioJ6ZmwQ6T8qANEzoavbKbzsJqbCFQEdQVy67jsXiJhFQX83LzAcVkcmqdmCcGfNpBze1gshH72YpTf5as9DysZZYnUmSdYAxuHo69S69WNiKs5oQyUfvyLkMpUh16BCho4BP5dJF8Xou26Vwfzb8BXrMQf5RG65tzfy1tqsADWq4gCkFwhSp9vG7BxxvLFvWGZCa1GKjrHPagPEchuekA4s8kMEvZzkC119myDLjniThawLxGF9CLzW9kXfEPRVCoVpFYs3vqVcxLMAKyuHGCRumWgEjJJbtDAxSnMYAr5iRkDXoLfyvvip28167L16xfLD4d5VNrk6hsu3Ta8WUqt2y1WnMAXYkdLE5zswhGFQVyTow1CH2oqezoJLJLs3Vp4HAb6ng2WS6JBGDxL3EhRrAgzruezYBYCZBMoeMDn8Lt2M8kHxCaKax5mzves8AaE1ooi8m5uiLFVPmd6NJCTM2Tia7XLZTxu3YLEbztRqz1tTox8muB481c7SEn9S5L9ENHxPswy4KdS5k8BVMT86yxnnctx4ruEnLRYENmMDp2McBz22z3tJ4tVq37nn3hMuc5pajTnR99it5wBbwZWbHXzyU9uMeK8MjS9GmVz52KqAwi53WnbnkyboKeFunH99Dt4D8AhJoH3iFNXn9PTXLcGw7AMonWCB4qMfwQieMJgRAHf1PGUnzV", + ] + }) + }, +} diff --git a/projects/sigmausd/index.js b/projects/sigmausd/index.js index 6fe990661cd..81e46d3f511 100644 --- a/projects/sigmausd/index.js +++ b/projects/sigmausd/index.js @@ -1,17 +1,10 @@ -const utils = require('../helper/utils'); - -async function tvl() { - const {data: { confirmed }} = await utils.fetchURL('https://api.ergoplatform.com/api/v1/addresses/MUbV38YgqHy7XbsoXWF5z7EZm524Ybdwe5p9WDrbhruZRtehkRPT92imXer2eTkjwPDfboa1pR3zb3deVKVq3H7Xt98qcTqLuSBSbHb7izzo5jphEpcnqyKJ2xhmpNPVvmtbdJNdvdopPrHHDBbAGGeW7XYTQwEeoRfosXzcDtiGgw97b2aqjTsNFmZk7khBEQywjYfmoDc9nUCJMZ3vbSspnYo3LarLe55mh2Np8MNJqUN9APA6XkhZCrTTDRZb1B4krgFY1sVMswg2ceqguZRvC9pqt3tUUxmSnB24N6dowfVJKhLXwHPbrkHViBv1AKAJTmEaQW2DN1fRmD9ypXxZk8GXmYtxTtrj3BiunQ4qzUCu1eGzxSREjpkFSi2ATLSSDqUwxtRz639sHM6Lav4axoJNPCHbY8pvuBKUxgnGRex8LEGM8DeEJwaJCaoy8dBw9Lz49nq5mSsXLeoC4xpTUmp47Bh7GAZtwkaNreCu74m9rcZ8Di4w1cmdsiK1NWuDh9pJ2Bv7u3EfcurHFVqCkT3P86JUbKnXeNxCypfrWsFuYNKYqmjsix82g9vWcGMmAcu5nagxD4iET86iE2tMMfZZ5vqZNvntQswJyQqv2Wc6MTh4jQx1q2qJZCQe4QdEK63meTGbZNNKMctHQbp3gRkZYNrBtxQyVtNLR8xEY8zGp85GeQKbb37vqLXxRpGiigAdMe3XZA4hhYPmAAU5hpSMYaRAjtvvMT3bNiHRACGrfjvSsEG9G2zY5in2YWz5X9zXQLGTYRsQ4uNFkYoQRCBdjNxGv6R58Xq74zCgt19TxYZ87gPWxkXpWwTaHogG1eps8WXt8QzwJ9rVx6Vu9a5GjtcGsQxHovWmYixgBU8X9fPNJ9UQhYyAWbjtRSuVBtDAmoV1gCBEPwnYVP5GCGhCocbwoYhZkZjFZy6ws4uxVLid3FxuvhWvQrVEDYp7WRvGXbNdCbcSXnbeTrPMey1WPaXX/balance/total'); - - return { - ergo: confirmed.nanoErgs / 1e9 - }; -} +const { nullAddress } = require('../helper/tokenMapping') +const { sumTokensExport } = require('../helper/chain/ergo') module.exports = { - timetravel: false, - ergo:{ - tvl - }, - methodology: `SigmaUSD TVL is calculated by calling the sigmaUSD bank (via the ergo blockchain explorer API), this returns the confirmed total within the contract in nanoERGs` -} \ No newline at end of file + timetravel: false, + ergo: { + tvl: sumTokensExport({ owner: 'MUbV38YgqHy7XbsoXWF5z7EZm524Ybdwe5p9WDrbhruZRtehkRPT92imXer2eTkjwPDfboa1pR3zb3deVKVq3H7Xt98qcTqLuSBSbHb7izzo5jphEpcnqyKJ2xhmpNPVvmtbdJNdvdopPrHHDBbAGGeW7XYTQwEeoRfosXzcDtiGgw97b2aqjTsNFmZk7khBEQywjYfmoDc9nUCJMZ3vbSspnYo3LarLe55mh2Np8MNJqUN9APA6XkhZCrTTDRZb1B4krgFY1sVMswg2ceqguZRvC9pqt3tUUxmSnB24N6dowfVJKhLXwHPbrkHViBv1AKAJTmEaQW2DN1fRmD9ypXxZk8GXmYtxTtrj3BiunQ4qzUCu1eGzxSREjpkFSi2ATLSSDqUwxtRz639sHM6Lav4axoJNPCHbY8pvuBKUxgnGRex8LEGM8DeEJwaJCaoy8dBw9Lz49nq5mSsXLeoC4xpTUmp47Bh7GAZtwkaNreCu74m9rcZ8Di4w1cmdsiK1NWuDh9pJ2Bv7u3EfcurHFVqCkT3P86JUbKnXeNxCypfrWsFuYNKYqmjsix82g9vWcGMmAcu5nagxD4iET86iE2tMMfZZ5vqZNvntQswJyQqv2Wc6MTh4jQx1q2qJZCQe4QdEK63meTGbZNNKMctHQbp3gRkZYNrBtxQyVtNLR8xEY8zGp85GeQKbb37vqLXxRpGiigAdMe3XZA4hhYPmAAU5hpSMYaRAjtvvMT3bNiHRACGrfjvSsEG9G2zY5in2YWz5X9zXQLGTYRsQ4uNFkYoQRCBdjNxGv6R58Xq74zCgt19TxYZ87gPWxkXpWwTaHogG1eps8WXt8QzwJ9rVx6Vu9a5GjtcGsQxHovWmYixgBU8X9fPNJ9UQhYyAWbjtRSuVBtDAmoV1gCBEPwnYVP5GCGhCocbwoYhZkZjFZy6ws4uxVLid3FxuvhWvQrVEDYp7WRvGXbNdCbcSXnbeTrPMey1WPaXX', tokens: [nullAddress] }) + }, + methodology: `Spectrum Finance TVL is achieved by making a call to its API: https://api.spectrum.fi/v1/amm/platform/stats.` +} diff --git a/projects/silkroad-fbifunds/index.js b/projects/silkroad-fbifunds/index.js new file mode 100644 index 00000000000..3adb8f92247 --- /dev/null +++ b/projects/silkroad-fbifunds/index.js @@ -0,0 +1,14 @@ +const { cexExports } = require('../helper/cex') + +const config = { + bitcoin: { + owners: [ + "bc1qa5wkgaew2dkv56kfvj49j0av5nml45x9ek9hz6", //https://www.reddit.com/r/CryptoCurrency/comments/li1fw7/btc_silkroad_stash_seized_nov_2020_by_the_feds/ + 'bc1qmxjefnuy06v345v6vhwpwt05dztztmx4g3y7wp', + 'bc1qf2yvj48mzkj7uf8lc2a9sa7w983qe256l5c8fs', + 'bc1qe7nk2nlnjewghgw4sgm0r89zkjzsurda7z4rdg' + ], + }, +} + +module.exports = cexExports(config) \ No newline at end of file diff --git a/projects/silo/index.js b/projects/silo/index.js index 10c201bf137..d7089c1a700 100644 --- a/projects/silo/index.js +++ b/projects/silo/index.js @@ -1,125 +1,69 @@ const sdk = require('@defillama/sdk') const { sumTokens2 } = require('../helper/unwrapLPs') -const getAssetsAbi = { - "inputs": [], - "name": "getAssets", - "outputs": [ - { - "internalType": "address[]", - "name": "assets", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" -} +const { getLogs } = require('../helper/cache/getLogs') +const getAssetsAbi = "address[]:getAssets" -const getAssetStateAbi = { - "inputs": [], - "name": "getAssetsWithState", - "outputs": [ - { - "internalType": "address[]", - "name": "assets", - "type": "address[]" - }, - { - "components": [ - { - "internalType": "contract IShareToken", - "name": "collateralToken", - "type": "address" - }, - { - "internalType": "contract IShareToken", - "name": "collateralOnlyToken", - "type": "address" - }, - { - "internalType": "contract IShareToken", - "name": "debtToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "totalDeposits", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "collateralOnlyDeposits", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalBorrowAmount", - "type": "uint256" - } - ], - "internalType": "struct IBaseSilo.AssetStorage[]", - "name": "assetsStorage", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" -} +const getAssetStateAbi = 'function getAssetsWithState() view returns (address[] assets, tuple(address collateralToken, address collateralOnlyToken, address debtToken, uint256 totalDeposits, uint256 collateralOnlyDeposits, uint256 totalBorrowAmount)[] assetsStorage)' -const START_BLOCK = 15307294 -const SILO_FACTORY = '0x4D919CEcfD4793c0D47866C8d0a02a0950737589' +const config = { + ethereum: { + START_BLOCK: 15307294, + SILO_FACTORY: '0x4D919CEcfD4793c0D47866C8d0a02a0950737589', + }, + arbitrum: { + START_BLOCK: 51894508, + SILO_FACTORY: '0x4166487056A922D784b073d4d928a516B074b719', + }, +} -async function tvl(_, block) { +const XAI = '0xd7c9f0e536dc865ae858b0c0453fe76d13c3beac' +const fallbackBlacklist = ["0x6543ee07cf5dd7ad17aeecf22ba75860ef3bbaaa",]; - const siloArray = await getSilos(block) - const { output: assets } = await sdk.api.abi.multiCall({ +async function tvl(_, block, _1, { api }) { + const siloArray = await getSilos(api) + const assets = await api.multiCall({ abi: getAssetsAbi, - calls: siloArray.map(i => ({ target: i})), - block, + calls: siloArray, }) - const toa = assets.map(i => i.output.map(j => [j, i.input.target])).flat() - return sumTokens2({ block, tokensAndOwners: toa, }) + const toa = assets.map((v, i) => ([v, siloArray[i]])) + return sumTokens2({ api, ownerTokens: toa, blacklistedTokens: [XAI], }) } -async function borrowed(_, block) { - const balances = {} - const siloArray = await getSilos(block) - const { output: assetStates } = await sdk.api.abi.multiCall({ +async function borrowed(_, block, _1, { api }) { + const siloArray = await getSilos(api) + const assetStates = await api.multiCall({ abi: getAssetStateAbi, - calls: siloArray.map(i => ({ target: i})), - block, + calls: siloArray.map(i => ({ target: i })), }); - assetStates.forEach(({ output: { assets, assetsStorage}}) => { - assetsStorage.forEach((i, j) => sdk.util.sumSingleBalance(balances, assets[j], i.totalBorrowAmount)) + assetStates.forEach(({ assets, assetsStorage }) => { + assetsStorage + .forEach((i, j) => { + if (assets[j].toLowerCase() === XAI) return; + return api.add(assets[j], i.totalBorrowAmount) + }) }) - - return balances } -let silos - -async function getSilos(block) { - if (!silos) silos = _getSilos() - return silos +async function getSilos(api) { + const chain = api.chain + const { SILO_FACTORY, START_BLOCK, } = config[chain] + const logs = ( + await getLogs({ + api, + target: SILO_FACTORY, + fromBlock: START_BLOCK, + topic: 'NewSiloCreated(address,address,uint128)', + }) + ) - async function _getSilos() { - const logs = ( - await sdk.api.util.getLogs({ - keys: [], - toBlock: block, - target: SILO_FACTORY, - fromBlock: START_BLOCK, - topic: 'NewSiloCreated(address,address,uint128)', - }) - ).output - - return logs.map((log) => `0x${log.topics[1].substring(26)}`) - } + return logs.map((log) => `0x${log.topics[1].substring(26)}`).filter((address) => fallbackBlacklist.indexOf(address.toLowerCase()) === -1); } module.exports = { ethereum: { tvl, borrowed, }, + arbitrum: { tvl, borrowed, }, hallmarks: [ [1668816000, "XAI Genesis"] ] diff --git a/projects/silodefi/index.js b/projects/silodefi/index.js index 509b2ac7478..b59ce3ab8fa 100644 --- a/projects/silodefi/index.js +++ b/projects/silodefi/index.js @@ -6,7 +6,13 @@ async function tvl() { const call = 913906096; const put = 913951447; const usdc = 31566704; - let accounts = await Promise.all([call, put].map(appId => searchAccountsAll({ appId }))) + const searchParams = { + 'asset-id': usdc, + 'currency-greater-than': 1000000, + } + const callAccounts = await searchAccountsAll({ appId: call, searchParams, limit: 100 }) + const putAccounts = await searchAccountsAll({ appId: put, searchParams, limit: 100 }) + let accounts = [...callAccounts, ...putAccounts] accounts = accounts.flat().filter(i => i["created-assets"] && i["created-assets"].some(asset => asset.params["unit-name"] === 'SILO') ) diff --git a/projects/single/abi.js b/projects/single/abi.js new file mode 100644 index 00000000000..af989a76c58 --- /dev/null +++ b/projects/single/abi.js @@ -0,0 +1,29 @@ +const camelotMasterAbi = { + "poolLength": 'function poolsLength() view returns (uint256)', + "getPoolAddressByIndex": "function getPoolAddressByIndex(uint256 index) view returns (address)", + "getPoolInfo": "function getPoolInfo(address) view returns (address poolAddress, uint256 allocPoint, uint256 lastRewardTime, uint256 reserve, uint256 poolEmissionRate)", +} + +const camelotNFTPoolAbi = { + "balanceOf": "function balanceOf(address owner) view returns (uint256 balance)", + "tokenOfOwnerByIndex": "function tokenOfOwnerByIndex(address owner, uint256 index) view returns (uint256)", + "getPoolInfo": "function getPoolInfo() view returns (address lpToken, address grailToken, address xGrailToken, uint256 lastRewardTime, uint256 accRewardsPerShare, uint256 lpSupply, uint256 lpSupplyWithMultiplier, uint256 allocPoint)", + "getStakingPosition" : "function getStakingPosition(uint256 tokenId) view returns (uint256 amount, uint256 amountWithMultiplier, uint256 startLockTime, uint256 lockDuration, uint256 lockMultiplier, uint256 rewardDebt, uint256 boostPoints, uint256 totalMultiplier)" +} + +const camelotNitroPoolAbi = { + "nftPool": "function nftPool() view returns (address)", + "userInfo": "function userInfo(address) view returns (uint256 totalDepositAmount, uint256 rewardDebtToken1, uint256 rewardDebtToken2, uint256 pendingRewardsToken1, uint256 pendingRewardsToken2)" +} + +const wCamelotSpNFTAbi = { + "stakedNitroPool": "function stakedNitroPool(uint256) view returns (address stakedNitroPool)", +} + + +module.exports = { + camelotMasterAbi, + camelotNFTPoolAbi, + camelotNitroPoolAbi, + wCamelotSpNFTAbi, +} \ No newline at end of file diff --git a/projects/single/cronos/vvsPoolInfo.json b/projects/single/cronos/vvsPoolInfo.json deleted file mode 100644 index dcd923438a1..00000000000 --- a/projects/single/cronos/vvsPoolInfo.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "type": "function", - "stateMutability": "view", - "outputs": [ - { - "type": "address", - "name": "lpToken", - "internalType": "contract IERC20" - }, - { - "type": "uint256", - "name": "allocPoint", - "internalType": "uint256" - }, - { - "type": "uint256", - "name": "lastRewardBlock", - "internalType": "uint256" - }, - { - "type": "uint256", - "name": "accVVSPerShare", - "internalType": "uint256" - } - ], - "name": "poolInfo", - "inputs": [ - { - "type": "uint256", - "name": "", - "internalType": "uint256" - } - ] -} \ No newline at end of file diff --git a/projects/single/fantom/spookyMasterChefV2PoolInfo.json b/projects/single/fantom/spookyMasterChefV2PoolInfo.json deleted file mode 100644 index 31c487b977c..00000000000 --- a/projects/single/fantom/spookyMasterChefV2PoolInfo.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "lpToken", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" -} \ No newline at end of file diff --git a/projects/single/helpers.js b/projects/single/helpers.js index 82467be5cd4..964e69e2267 100644 --- a/projects/single/helpers.js +++ b/projects/single/helpers.js @@ -1,9 +1,11 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk'); +const bn = require('bignumber.js'); const abi = require('../helper/abis/masterchef.json'); const { unwrapLPsAuto } = require('../helper/unwrapLPs'); -const userInfoAbi = require("../helper/abis/userInfo.json"); -const { default: BigNumber } = require('bignumber.js'); +const userInfoAbi = 'function userInfo(uint256, address) view returns (uint256 amount, uint256 rewardDebt)' const { getChainTransform } = require('../helper/portedTokens'); +const { camelotMasterAbi, camelotNFTPoolAbi, camelotNitroPoolAbi, wCamelotSpNFTAbi } = require("./abi") /** this is adapted from `projects/helpers/masterchef/getUserMasterChefBalances` * to deal with VVS's CraftsmanV2 Contract, which does not have @@ -37,6 +39,76 @@ async function getUserCraftsmanV2Balances({ balances = {}, masterChefAddress, us return balances; } +async function getUserCamelotMasterBalances({ balances = {}, masterChefAddress, userAddres: wCamelotSpNFT, block, chain = 'ethereum', transformAddress, excludePool2 = false, onlyPool2 = false, pool2Tokens = [] }) { + if (!transformAddress) + transformAddress = await getChainTransform(chain); + + const tempBalances = {}; + const poolLength = (await sdk.api.abi.call({ abi: camelotMasterAbi.poolLength, target: masterChefAddress, block, chain, })).output; + + const dummyArray = Array.from(Array(Number(poolLength)).keys()); + const poolAddressCalls = dummyArray.map(i => ({ target: masterChefAddress, params: i, })); + const poolAddresses = (await sdk.api.abi.multiCall({ block, calls: poolAddressCalls, abi: camelotMasterAbi.getPoolAddressByIndex, chain, })).output + .map(a => a.output) + + const poolInfoCalls = dummyArray.map(i => ({ target: poolAddresses[i] })); + const lpTokens = (await sdk.api.abi.multiCall({ block, calls: poolInfoCalls, abi: camelotNFTPoolAbi.getPoolInfo, chain, })).output + .map(a => a.output.lpToken) + + const userSpNFTBalanceCalls = dummyArray.map(i => ({ target: poolAddresses[i], params: wCamelotSpNFT, })); + const userSpNFTBalance = (await sdk.api.abi.multiCall({ block, calls: userSpNFTBalanceCalls, abi: camelotNFTPoolAbi.balanceOf, chain, })).output + .map(a => a.output) + + const userLpBalance = await Promise.all(userSpNFTBalance.map(async (spNFTBalance, idx) => { + if (isNaN(+spNFTBalance) || +spNFTBalance <= 0) return; + const dummySpNFTArray = Array.from(Array(Number(spNFTBalance)).keys()); + const spNFTIdCalls = dummySpNFTArray.map(i => ({ target: poolAddresses[idx], params: [wCamelotSpNFT, i] })); + const userSpNFTId = (await sdk.api.abi.multiCall({ block, calls: spNFTIdCalls, abi: camelotNFTPoolAbi.tokenOfOwnerByIndex, chain, })).output + .map(a => a.output) + const stakingPositionsCalls = dummySpNFTArray.map(i => ({ target: poolAddresses[idx], params: userSpNFTId[i] })); + const userLpBalance = (await sdk.api.abi.multiCall({ block, calls: stakingPositionsCalls, abi: camelotNFTPoolAbi.getStakingPosition, chain, })).output + .map(a => a.output.amount) + return { + lpToken: lpTokens[idx], + balance: userLpBalance.reduce((partialSum, a) => partialSum.plus(a), bn(0)).toFixed() + }; + })) + userLpBalance.forEach((data, idx) => { + if (!data) return; + tempBalances[transformAddress(data.lpToken)] = data.balance + }) + + const nitroPoolAddressesCalls = dummyArray.map(i => ({ target: wCamelotSpNFT, params: i })); + const nitroPoolAddresses = (await sdk.api.abi.multiCall({ block, calls: nitroPoolAddressesCalls, abi: wCamelotSpNFTAbi.stakedNitroPool, chain, })).output + .map(a => a.output) + const nitroPoolUserLpBalanceCalls = nitroPoolAddresses + .filter((v) => v !== ADDRESSES.null) + .map((v, i) => ({ target: v, params: wCamelotSpNFT })); + const nitroPoolUserLpBalance = (await sdk.api.abi.multiCall({ block, calls: nitroPoolUserLpBalanceCalls, abi: camelotNitroPoolAbi.userInfo, chain, })).output + .map((v, i) => { + if (!v.output?.totalDepositAmount || v.output.totalDepositAmount === "0") return + const lpTokenIdx = nitroPoolAddresses.findIndex(addr => addr === nitroPoolUserLpBalanceCalls[i].target) + if (lpTokenIdx === -1) return; + return { + lpToken: lpTokens[lpTokenIdx], + balance: v.output.totalDepositAmount + } + }) + nitroPoolUserLpBalance.forEach((data, idx) => { + if (!data) return; + if (tempBalances[transformAddress(data.lpToken)]) { + tempBalances[transformAddress(data.lpToken)] = bn(tempBalances[transformAddress(data.lpToken)]).plus(data.balance).toFixed() + } else { + tempBalances[transformAddress(data.lpToken)] = data.balance + } + }) + + await unwrapLPsAuto({ balances: tempBalances, chain, block, transformAddress, excludePool2, onlyPool2, pool2Tokens }); + Object.keys(tempBalances).forEach(key => sdk.util.sumSingleBalance(balances, key, tempBalances[key])); + return balances; +} + module.exports = { - getUserCraftsmanV2Balances + getUserCraftsmanV2Balances, + getUserCamelotMasterBalances, } \ No newline at end of file diff --git a/projects/single/index.js b/projects/single/index.js index 686f04bf114..dd73cbed6d1 100644 --- a/projects/single/index.js +++ b/projects/single/index.js @@ -1,11 +1,11 @@ const { sumTokens2 } = require("../helper/unwrapLPs") const { getFixBalances } = require("../helper/portedTokens") const { getUserMasterChefBalances } = require("../helper/masterchef") -const { getUserCraftsmanV2Balances } = require("./helpers") -const vvsPoolInfoABI = require('./cronos/vvsPoolInfo.json') -const spookyMasterChefV2PoolInfoABI = require('./fantom/spookyMasterChefV2PoolInfo.json') -const { fetchURL, } = require("../helper/utils") -const { get, } = require("../helper/http") +const { getUserCraftsmanV2Balances, getUserCamelotMasterBalances } = require("./helpers") +const vvsPoolInfoABI = 'function poolInfo(uint256) view returns (address lpToken, uint256 allocPoint, uint256 lastRewardBlock, uint256 accVVSPerShare)' +const spookyMasterChefV2PoolInfoABI = 'function lpToken(uint256) view returns (address)' +const { getConfig } = require('../helper/cache') + const sdk = require('@defillama/sdk') const BASE_API_URL = 'https://api.singlefinance.io' @@ -18,6 +18,10 @@ const constants = { 'fantom': { chainId: 250, single: '0x8cc97b50fe87f31770bcdcd6bc8603bc1558380b' + }, + 'arbitrum': { + chainId: 42161, + single: '0x55853edc67aa68ec2e3903ac00f2bc5bf2ca8db0' } } @@ -26,46 +30,29 @@ const getWMasterChefBalances = ({ masterChef: masterChefAddress, wMasterChef, na if (name === "vvsMultiYield") { return getUserCraftsmanV2Balances({ ...commonParams, poolInfoABI: vvsPoolInfoABI, craftsmanV1: rest.craftsmanV1, ...args }) } - if (name === "spookyMultiYield") { + if (name === "spookyMultiYield" || name === "sushi") { return getUserMasterChefBalances({ ...commonParams, poolInfoABI: spookyMasterChefV2PoolInfoABI, getLPAddress: a => a, ...args }) } + if (name === "camelot") { + return getUserCamelotMasterBalances({ ...commonParams, ...args }) + } return getUserMasterChefBalances({ ...commonParams, poolInfoABI: vvsPoolInfoABI, ...args }) } +const data = { +} const getHelpers = (chain) => { const SINGLE_TOKEN = constants[chain].single; const fetchDataOnce = (() => { - - let data; - let queues = []; - - return () => new Promise(res => { - - if (data) { - res(data); - } - - queues.push(res); - - if (queues.length === 1) { - fetchURL(`${BASE_API_URL}/api/protocol/contracts?chainid=${constants[chain].chainId}`) - .then(value => { - data = value; - - for (const resolve of queues) { - resolve(value); - } - }); - } - - }) - })(); + if (!data[chain]) return getConfig('single/contracts/'+chain, `${BASE_API_URL}/api/protocol/contracts?chainid=${constants[chain].chainId}`) + return data[chain] + }) async function staking(timestamp, _block, chainBlocks) { - const { data: { pools, vaults, } } = await fetchDataOnce() + const { pools, } = await fetchDataOnce() let balances = {} const fixBalances = await getFixBalances(chain) @@ -79,7 +66,7 @@ const getHelpers = (chain) => { async function tvl(tx, _block, chainBlocks) { - const { data: { vaults, wmasterchefs } } = await fetchDataOnce() + const { wmasterchefs, vaults, } = await fetchDataOnce() const balances = {} const block = chainBlocks[chain] @@ -97,7 +84,7 @@ const getHelpers = (chain) => { async function pool2(tx, _block, chainBlocks) { - const { data: { wmasterchefs, pools } } = await fetchDataOnce() + const { wmasterchefs, pools } = await fetchDataOnce() const balances = {} const block = chainBlocks[chain] @@ -130,12 +117,13 @@ module.exports = { tvl: cronosTvl, }, fantom: getHelpers('fantom'), + arbitrum: getHelpers('arbitrum'), } // see if single will run with updated unwrapLPs async function cronosTvl(_, _b, { cronos: block }) { - const { data } = await get('https://api.singlefinance.io/api/vaults?chainid=25') - const { data: strategies } = await get('https://api.singlefinance.io/api/strategies?chainid=25') + const { data } = await getConfig('single/vault/cronos', 'https://api.singlefinance.io/api/vaults?chainid=25') + const { data: strategies } = await getConfig('single/strategy/cronos','https://api.singlefinance.io/api/strategies?chainid=25') const tether = strategies.reduce((a, i)=> a+i.tvl/1e18, 0) const balances = {} data.forEach(({ token: { id }, totalTokens }) => sdk.util.sumSingleBalance(balances, 'cronos:' + id, totalTokens)) diff --git a/projects/singularfarm/avaxAbi.json b/projects/singularfarm/avaxAbi.json index d9ee14a55ac..2d3dece33df 100644 --- a/projects/singularfarm/avaxAbi.json +++ b/projects/singularfarm/avaxAbi.json @@ -1,71 +1,3 @@ { - "poolInfo": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "poolInfo", - "outputs": [ - { - "internalType": "contract IBEP20", - "name": "lpToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "allocPoint", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastRewardTime", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accSingPerShare", - "type": "uint256" - }, - { - "internalType": "uint16", - "name": "depositFeeBP", - "type": "uint16" - }, - { - "internalType": "uint256", - "name": "totalcap", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "isStrat", - "type": "bool" - }, - { - "internalType": "uint256", - "name": "stratId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "stratFee", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "earned", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accEarnPerShare", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -} + "poolInfo": "function poolInfo(uint256) view returns (address lpToken, uint256 allocPoint, uint256 lastRewardTime, uint256 accSingPerShare, uint16 depositFeeBP, uint256 totalcap, bool isStrat, uint256 stratId, uint256 stratFee, uint256 earned, uint256 accEarnPerShare)" +} \ No newline at end of file diff --git a/projects/singularfarm/bscAbi.json b/projects/singularfarm/bscAbi.json index 9808d15c562..d30ec7e699e 100644 --- a/projects/singularfarm/bscAbi.json +++ b/projects/singularfarm/bscAbi.json @@ -1,71 +1,3 @@ { - "poolInfo": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "poolInfo", - "outputs": [ - { - "internalType": "contract IBEP20", - "name": "lpToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "allocPoint", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastRewardTime", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accSingPerShare", - "type": "uint256" - }, - { - "internalType": "uint16", - "name": "depositFeeBP", - "type": "uint16" - }, - { - "internalType": "uint256", - "name": "totalcap", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "isStrat", - "type": "bool" - }, - { - "internalType": "uint256", - "name": "stratId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "earned", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "earnfee", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accEarnPerShare", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -} + "poolInfo": "function poolInfo(uint256) view returns (address lpToken, uint256 allocPoint, uint256 lastRewardTime, uint256 accSingPerShare, uint16 depositFeeBP, uint256 totalcap, bool isStrat, uint256 stratId, uint256 earned, uint256 earnfee, uint256 accEarnPerShare)" +} \ No newline at end of file diff --git a/projects/singularfarm/ftmAbi.json b/projects/singularfarm/ftmAbi.json index b1d8b2c4212..3853026dbc1 100644 --- a/projects/singularfarm/ftmAbi.json +++ b/projects/singularfarm/ftmAbi.json @@ -1,76 +1,3 @@ { - "poolInfo": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "poolInfo", - "outputs": [ - { - "internalType": "contract IBEP20", - "name": "lpToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "allocPoint", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastRewardTime", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accSingPerShare", - "type": "uint256" - }, - { - "internalType": "uint16", - "name": "depositFeeBP", - "type": "uint16" - }, - { - "internalType": "uint256", - "name": "totalcap", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "isStrat", - "type": "bool" - }, - { - "internalType": "uint256", - "name": "masterId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "stratId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "earned", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "earnfee", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accEarnPerShare", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -} + "poolInfo": "function poolInfo(uint256) view returns (address lpToken, uint256 allocPoint, uint256 lastRewardTime, uint256 accSingPerShare, uint16 depositFeeBP, uint256 totalcap, bool isStrat, uint256 masterId, uint256 stratId, uint256 earned, uint256 earnfee, uint256 accEarnPerShare)" +} \ No newline at end of file diff --git a/projects/singularfarm/polyAbi.json b/projects/singularfarm/polyAbi.json index d9ee14a55ac..2d3dece33df 100644 --- a/projects/singularfarm/polyAbi.json +++ b/projects/singularfarm/polyAbi.json @@ -1,71 +1,3 @@ { - "poolInfo": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "poolInfo", - "outputs": [ - { - "internalType": "contract IBEP20", - "name": "lpToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "allocPoint", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastRewardTime", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accSingPerShare", - "type": "uint256" - }, - { - "internalType": "uint16", - "name": "depositFeeBP", - "type": "uint16" - }, - { - "internalType": "uint256", - "name": "totalcap", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "isStrat", - "type": "bool" - }, - { - "internalType": "uint256", - "name": "stratId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "stratFee", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "earned", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accEarnPerShare", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -} + "poolInfo": "function poolInfo(uint256) view returns (address lpToken, uint256 allocPoint, uint256 lastRewardTime, uint256 accSingPerShare, uint16 depositFeeBP, uint256 totalcap, bool isStrat, uint256 stratId, uint256 stratFee, uint256 earned, uint256 accEarnPerShare)" +} \ No newline at end of file diff --git a/projects/singularityDAO/abi.json b/projects/singularityDAO/abi.json index 91a33bb0c25..5fbd9e95a0b 100644 --- a/projects/singularityDAO/abi.json +++ b/projects/singularityDAO/abi.json @@ -1,47 +1,5 @@ { - "getCurrentTokens": { - "inputs": [], - "name": "getCurrentTokens", - "outputs": [ - { - "internalType": "address[]", - "name": "tokens", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - "poolLength": { - "inputs": [], - "name": "poolLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "lpToken": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "lpToken", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } + "getCurrentTokens": "address[]:getCurrentTokens", + "poolLength": "uint256:poolLength", + "lpToken": "function lpToken(uint256) view returns (address)" } \ No newline at end of file diff --git a/projects/singularityDAO/index.js b/projects/singularityDAO/index.js index 54a33670e02..226ba618b2a 100644 --- a/projects/singularityDAO/index.js +++ b/projects/singularityDAO/index.js @@ -1,16 +1,18 @@ +const ADDRESSES = require('../helper/coreAssets.json') const abi = require("./abi.json"); const http = require("../helper/http"); const sdk = require("@defillama/sdk"); const { sumTokens2 } = require("../helper/unwrapLPs"); -const { getParamCalls } = require('../helper/utils') - +const { getParamCalls } = require("../helper/utils"); const AGIX_TOKEN = "0x5B7533812759B45C2B44C19e320ba2cD2681b542"; -const NuNet_TOKEN = "0xF0d33BeDa4d734C72684b5f9abBEbf715D0a7935"; +const NUNET_TOKEN = "0xF0d33BeDa4d734C72684b5f9abBEbf715D0a7935"; const SDAO_TOKEN = "0x993864E43Caa7F7F12953AD6fEb1d1Ca635B875F"; const SDAO_TOKEN_BNB = "0x90Ed8F1dc86388f14b64ba8fb4bbd23099f18240"; +const DYNASETSBNB = "0x5569B42513203f49a761Cc9720D4Bb9B6b9E5AB8"; + const DYNASET_FORGES = [ "0xe125044733366071793Afd1f9CB41521078Dd029", "0x5d94F225caBd9010c8206c1036c6352F66C06E57", @@ -20,8 +22,7 @@ const DYNASET_FORGES = [ const LP_TOKEN_SDAO_ETH = "0x424485f89ea52839fdb30640eb7dd7e0078e12fb"; const LP_TOKEN_SDAO_USDT = "0x3a925503970d40d36d2329e3846e09fcfc9b6acb"; -const getDynasetQuery = - "{ dynaset { address } }"; +const getDynasetQuery = "{ dynaset { address } }"; const graphEndpoint = "https://dev-onchain-server.singularitydao.ai/dynaset-server/api/graphql"; @@ -31,18 +32,23 @@ const graphEndpoint = // TVL -async function tvl(ts, block) { - const blacklistedTokens = [SDAO_TOKEN, LP_TOKEN_SDAO_ETH, LP_TOKEN_SDAO_USDT, AGIX_TOKEN, NuNet_TOKEN] +async function tvl(_, block) { + const blacklistedTokens = [ + SDAO_TOKEN, + LP_TOKEN_SDAO_ETH, + LP_TOKEN_SDAO_USDT, + AGIX_TOKEN, + NUNET_TOKEN, + ]; // DYNASETS const response = await http.graphQuery(graphEndpoint, getDynasetQuery); - const dynasets = response.dynaset - .map((d) => d.address) - .flat(); + const dynasets = response.dynaset.map((d) => d.address).flat(); const { output: tokens } = await sdk.api.abi.multiCall({ calls: dynasets.map((addr) => ({ target: addr })), abi: abi.getCurrentTokens, block, + permitFailure: true, }); const tokensAndOwners = []; tokens @@ -55,26 +61,28 @@ async function tvl(ts, block) { let { output: forgetCount } = await sdk.api.abi.multiCall({ abi: abis.totalForges, - calls: DYNASET_FORGES.map(i => ({ target: i})), + calls: DYNASET_FORGES.map((i) => ({ target: i })), block, - }) + }); - const calls = [] - forgetCount = forgetCount.map(({input: { target}, output}) => { - let arry = getParamCalls(output) - arry.forEach(i => i.target = target) - calls.push(...arry) - }) + const calls = []; + forgetCount = forgetCount.map(({ input: { target }, output }) => { + let arry = getParamCalls(output); + arry.forEach((i) => (i.target = target)); + calls.push(...arry); + }); let { output: tokenInfo } = await sdk.api.abi.multiCall({ - abi: abis.forgeInfo, calls, block, - }) + abi: abis.forgeInfo, + calls, + block, + }); - tokenInfo.forEach(({input: { target}, output}) => { - tokensAndOwners.push([output.contributionToken, target]) - }) + tokenInfo.forEach(({ input: { target }, output }) => { + tokensAndOwners.push([output.contributionToken, target]); + }); - return sumTokens2({ tokensAndOwners, block, blacklistedTokens, }) + return sumTokens2({ tokensAndOwners, block, blacklistedTokens }); } // LP Pools ERC @@ -86,7 +94,7 @@ async function pool2(ts, block) { [LP_TOKEN_SDAO_ETH, "0xfB85B9Ec50560e302Ab106F1E2857d95132120D0"], // Unbonded [LP_TOKEN_SDAO_USDT, "0xfB85B9Ec50560e302Ab106F1E2857d95132120D0"], // Bonded 6M ]; - return sumTokens2({tokensAndOwners, block, resolveLP: true,}); + return sumTokens2({ tokensAndOwners, block, resolveLP: true }); } // Staking pools ERC @@ -97,19 +105,37 @@ async function staking(ts, block) { [SDAO_TOKEN, "0xfB85B9Ec50560e302Ab106F1E2857d95132120D0"], // Unbonded [SDAO_TOKEN, "0x74641ed232dbB8CBD9847484dD020d44453F0368"], // Bonded 6M [SDAO_TOKEN, "0xF5738B4aD2f8302b926676692a0C09603d930b42"], // Bonded 12M - [NuNet_TOKEN, "0x502B965d3D51d4FD531E6A1c1fA9bFA50337bA55"], - [NuNet_TOKEN, "0xfB85B9Ec50560e302Ab106F1E2857d95132120D0"], - [NuNet_TOKEN, "0xb267deaace0b8c5fcb2bb04801a364e7af7da3f4"], + [NUNET_TOKEN, "0x502B965d3D51d4FD531E6A1c1fA9bFA50337bA55"], + [NUNET_TOKEN, "0xfB85B9Ec50560e302Ab106F1E2857d95132120D0"], + [NUNET_TOKEN, "0xb267deaace0b8c5fcb2bb04801a364e7af7da3f4"], [AGIX_TOKEN, "0xfB85B9Ec50560e302Ab106F1E2857d95132120D0"], [AGIX_TOKEN, "0xb267deaace0b8c5fcb2bb04801a364e7af7da3f4"], ]; - return sumTokens2({ tokensAndOwners, block, }) + return sumTokens2({ tokensAndOwners, block }); } ////////////////////////////////// ////// BNB CHAIN //////////////// //////////////////////////////// +// DYNASET BNB CHAIN + +async function tvlBNB(ts, EthBlock, { bsc: block }) { + const tokensAndOwners = [ + [ADDRESSES.bsc.WBNB, DYNASETSBNB], // BNB + [ADDRESSES.bsc.BUSD, DYNASETSBNB], // BUSD + ["0x7083609fCE4d1d8Dc0C979AAb8c869Ea2C873402", DYNASETSBNB], // BDOT + [ADDRESSES.bsc.ETH, DYNASETSBNB], // BETH + ["0x1D2F0da169ceB9fC7B3144628dB156f3F6c60dBE", DYNASETSBNB], // BXRP + [ADDRESSES.bsc.BTCB, DYNASETSBNB], // WBTC + ["0x1CE0c2827e2eF14D5C4f29a091d735A204794041", DYNASETSBNB], // BAVAX + ["0x3EE2200Efb3400fAbB9AacF31297cBdD1d435D47", DYNASETSBNB], // BADA + ["0xCC42724C6683B7E57334c4E856f4c9965ED682bD", DYNASETSBNB], // BMATIC + ["0xfA54fF1a158B5189Ebba6ae130CEd6bbd3aEA76e", DYNASETSBNB], // BSOL + ]; + return sumTokens2({ tokensAndOwners, block, chain: "bsc" }); +} + // Staking pools BNB async function stakingBNB(ts, EthBlock, { bsc: block }) { @@ -117,18 +143,27 @@ async function stakingBNB(ts, EthBlock, { bsc: block }) { [SDAO_TOKEN_BNB, "0x79292c62f593e08d9b850b790b07e7a0903fd007"], // Unbonded [SDAO_TOKEN_BNB, "0x17de46760F4c18C26eEc36117C23793299F564A8"], // Bonded ]; - return sumTokens2({ tokensAndOwners, block, chain: 'bsc' }) + return sumTokens2({ tokensAndOwners, block, chain: "bsc" }); } // LP Pools BNB async function pool2BNB(ts, EthBlock, { bsc: block }) { const tokensAndOwners = [ - ['0x6c805d2077025eaaa42fae7f764e61df42aadb14', "0xba1933bc47e6ad050a4e4485f6f4b16b9ccdb806"], - ['0x43b95976cf0929478bc13332c9cd2d63bf060976', "0x79292c62f593e08d9b850b790b07e7a0903fd007"], - ['0x3d12e4381901a6b94438758b90881cb03f10b01e', "0x79292c62f593e08d9b850b790b07e7a0903fd007"], + [ + "0x6c805d2077025eaaa42fae7f764e61df42aadb14", + "0xba1933bc47e6ad050a4e4485f6f4b16b9ccdb806", + ], + [ + "0x43b95976cf0929478bc13332c9cd2d63bf060976", + "0x79292c62f593e08d9b850b790b07e7a0903fd007", + ], + [ + "0x3d12e4381901a6b94438758b90881cb03f10b01e", + "0x79292c62f593e08d9b850b790b07e7a0903fd007", + ], ]; - return sumTokens2({ tokensAndOwners, block, chain: 'bsc', resolveLP: true, }) + return sumTokens2({ tokensAndOwners, block, chain: "bsc", resolveLP: true }); } module.exports = { @@ -139,12 +174,14 @@ module.exports = { pool2, }, bsc: { + tvl: tvlBNB, staking: stakingBNB, pool2: pool2BNB, }, }; const abis = { - totalForges: {"inputs":[],"name":"totalForges","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}, - forgeInfo: {"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"forgeInfo","outputs":[{"internalType":"bool","name":"isEth","type":"bool"},{"internalType":"address","name":"contributionToken","type":"address"},{"internalType":"uint256","name":"dynasetLp","type":"uint256"},{"internalType":"uint256","name":"totalContribution","type":"uint256"},{"internalType":"uint256","name":"minContribution","type":"uint256"},{"internalType":"uint256","name":"maxContribution","type":"uint256"},{"internalType":"uint256","name":"maxCap","type":"uint256"},{"internalType":"uint256","name":"contributionPeriod","type":"uint256"},{"internalType":"bool","name":"withdrawEnabled","type":"bool"},{"internalType":"bool","name":"depositEnabled","type":"bool"},{"internalType":"bool","name":"forging","type":"bool"},{"internalType":"uint256","name":"nextForgeContributorIndex","type":"uint256"}],"stateMutability":"view","type":"function"}, -} \ No newline at end of file + totalForges: "uint256:totalForges", + forgeInfo: + "function forgeInfo(uint256) view returns (bool isEth, address contributionToken, uint256 dynasetLp, uint256 totalContribution, uint256 minContribution, uint256 maxContribution, uint256 maxCap, uint256 contributionPeriod, bool withdrawEnabled, bool depositEnabled, bool forging, uint256 nextForgeContributorIndex)", +}; diff --git a/projects/sio2/abi.json b/projects/sio2/abi.json deleted file mode 100644 index 3473151d2b2..00000000000 --- a/projects/sio2/abi.json +++ /dev/null @@ -1,401 +0,0 @@ -{ - "getReservesList": { - "inputs": [], - "name": "getReservesList", - "outputs": [ - { - "internalType": "address[]", - "name": "", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getCurrentTokens": { - "constant": true, - "inputs": [], - "name": "getCurrentTokens", - "outputs": [ - { - "internalType": "address[]", - "name": "tokens", - "type": "address[]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "getReserveData": { - "constant": true, - "inputs": [ - { - "internalType": "address", - "name": "_reserve", - "type": "address" - } - ], - "name": "getReserveData", - "outputs": [ - { - "internalType": "uint256", - "name": "totalLiquidity", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "availableLiquidity", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalBorrowsStable", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalBorrowsVariable", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "liquidityRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "variableBorrowRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "stableBorrowRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "averageStableBorrowRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "utilizationRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "liquidityIndex", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "variableBorrowIndex", - "type": "uint256" - }, - { - "internalType": "address", - "name": "sTokenAddress", - "type": "address" - }, - { - "internalType": "uint40", - "name": "lastUpdateTimestamp", - "type": "uint40" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "getReserveConfigurationData": { - "constant": true, - "inputs": [ - { - "internalType": "address", - "name": "_reserve", - "type": "address" - } - ], - "name": "getReserveConfigurationData", - "outputs": [ - { - "internalType": "uint256", - "name": "ltv", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "liquidationThreshold", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "liquidationBonus", - "type": "uint256" - }, - { - "internalType": "address", - "name": "interestRateStrategyAddress", - "type": "address" - }, - { - "internalType": "bool", - "name": "usageAsCollateralEnabled", - "type": "bool" - }, - { - "internalType": "bool", - "name": "borrowingEnabled", - "type": "bool" - }, - { - "internalType": "bool", - "name": "stableBorrowRateEnabled", - "type": "bool" - }, - { - "internalType": "bool", - "name": "isActive", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "getReserves": { - "constant": true, - "inputs": [], - "name": "getReserves", - "outputs": [ - { - "internalType": "address[]", - "name": "", - "type": "address[]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "getAddressesProvidersList": { - "inputs": [], - "name": "getAddressesProvidersList", - "outputs": [ - { - "internalType": "address[]", - "name": "", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getAddress": { - "inputs": [ - { - "internalType": "bytes32", - "name": "id", - "type": "bytes32" - } - ], - "name": "getAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getAllSTokens": { - "inputs": [], - "name": "getAllSTokens", - "outputs": [ - { - "components": [ - { - "internalType": "string", - "name": "symbol", - "type": "string" - }, - { - "internalType": "address", - "name": "tokenAddress", - "type": "address" - } - ], - "internalType": "struct StarlayProtocolDataProvider.TokenData[]", - "name": "", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getUnderlying": { - "inputs": [], - "name": "UNDERLYING_ASSET_ADDRESS", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getReserveDataV2": { - "inputs": [ - { - "internalType": "address", - "name": "asset", - "type": "address" - } - ], - "name": "getReserveData", - "outputs": [ - { - "internalType": "uint256", - "name": "availableLiquidity", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalStableDebt", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalVariableDebt", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "liquidityRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "variableBorrowRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "stableBorrowRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "averageStableBorrowRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "liquidityIndex", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "variableBorrowIndex", - "type": "uint256" - }, - { - "internalType": "uint40", - "name": "lastUpdateTimestamp", - "type": "uint40" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getHelperReserveData": { - "inputs": [ - { - "internalType": "address", - "name": "asset", - "type": "address" - } - ], - "name": "getReserveData", - "outputs": [ - { - "internalType": "uint256", - "name": "availableLiquidity", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalStableDebt", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalVariableDebt", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "liquidityRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "variableBorrowRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "stableBorrowRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "averageStableBorrowRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "liquidityIndex", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "variableBorrowIndex", - "type": "uint256" - }, - { - "internalType": "uint40", - "name": "lastUpdateTimestamp", - "type": "uint40" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getReserveTotalBorrows": { - "constant": true, - "inputs": [ - { - "internalType": "address", - "name": "_reserve", - "type": "address" - } - ], - "name": "getReserveTotalBorrows", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } -} diff --git a/projects/sio2/constants.js b/projects/sio2/constants.js deleted file mode 100644 index 9e388137478..00000000000 --- a/projects/sio2/constants.js +++ /dev/null @@ -1,38 +0,0 @@ -const DEFAULT_DECIMALS = 18 - -const DOT_TOKEN = "polkadot" -const DOT_DECIMALS = 10 - -const TOKENS = { - // WASTR - "0xAeaaf0e2c81Af264101B9129C00F4440cCF0F720": "astar", - // DOT - "0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF": DOT_TOKEN, - // BAI - "0x733ebcC6DF85f8266349DEFD0980f8Ced9B45f35": "bai-stablecoin", - // USDC - "0x6a2d262D56735DbA19Dd70682B39F6bE9a931D98": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", - // USDT - "0x3795C36e7D12A8c252A20C5a7B455f7c57b60283": - "0xdac17f958d2ee523a2206206994597c13d831ec7", - // BUSD - "0x4Bf769b05E832FCdc9053fFFBC78Ca889aCb5E1E": "binance-usd", - // DAI - "0x6De33698e9e9b787e09d3Bd7771ef63557E148bb": - "0x6b175474e89094c44da98b954eedeac495271d0f", - // WETH - "0x81ECac0D6Be0550A00FF064a4f9dd2400585FE9c": - "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", - // wBTC - "0xad543f18cFf85c77E140E3E5E3c3392f6Ba9d5CA": - "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599", - // BNB - "0x7f27352D5F83Db87a5A3E00f4B07Cc2138D8ee52": "binancecoin", -}; - -module.exports = { - DEFAULT_DECIMALS, - DOT_DECIMALS, - DOT_TOKEN, - TOKENS, -} diff --git a/projects/sio2/index.js b/projects/sio2/index.js index d101ddd84c4..cc7942e8961 100644 --- a/projects/sio2/index.js +++ b/projects/sio2/index.js @@ -1,55 +1,11 @@ -const { getReserves, getSio2Tvl } = require("./sio2"); -const BigNumber = require("bignumber.js"); -const { getBorrowed } = require("../helper/aave"); -const { TOKENS, DOT_TOKEN, DOT_DECIMALS, DEFAULT_DECIMALS } = require("./constants"); - -const transferFromAddress = (underlying) => TOKENS[underlying] - -function astar(borrowed) { - return async (timestamp, _, {star: block}) => { - const balances = {}; - const [sTokens, reserveTokens, validProtocolDataHelpers] = - await getReserves(block); - - const chain = "astar"; - - if (borrowed) { - await getBorrowed( - balances, - block, - chain, - reserveTokens, - validProtocolDataHelpers, - transferFromAddress - ); - } else { - await getSio2Tvl( - balances, - block, - chain, - sTokens, - reserveTokens, - transferFromAddress - ); - } - - return Object.keys(balances).reduce((res, key) => { - if (key.startsWith("0x")) - return { ...res, [key]: balances[key] }; - if (key === DOT_TOKEN) - return { ...res, [key]: new BigNumber(balances[key]).shiftedBy(-DOT_DECIMALS).toNumber() }; - return { ...res, [key]: new BigNumber(balances[key]).shiftedBy(-DEFAULT_DECIMALS).toNumber() }; - }, {}); - }; -} - - +const { aaveExports } = require("../helper/aave"); module.exports = { timetravel: true, methodology: `Counts the tokens locked in the contracts to be used as collateral to borrow or to earn yield. Borrowed coins are not counted towards the TVL, so only the coins actually locked in the contracts are counted. There's multiple reasons behind this but one of the main ones is to avoid inflating the TVL through cycled lending.`, - astar: { - tvl: astar(false), - borrowed: astar(true) - } -} + astar: aaveExports("astar", '0x9D8bB85b1c728f69672923dD4A0209EC8b75EFda', undefined, undefined, { + abis: { + getAllATokens: "function getAllSTokens() view returns (tuple(string symbol, address tokenAddress)[])" + } + }) +} \ No newline at end of file diff --git a/projects/sio2/sio2.js b/projects/sio2/sio2.js deleted file mode 100644 index e0edb4b8ee0..00000000000 --- a/projects/sio2/sio2.js +++ /dev/null @@ -1,100 +0,0 @@ -const sdk = require("@defillama/sdk"); -const abi = require("./abi.json"); -const { default: BigNumber } = require("bignumber.js"); -const addressesProviderRegistry = "0x9D8bB85b1c728f69672923dD4A0209EC8b75EFda"; // from https://sio2-finance.gitbook.io/en/development/contract-addresses - -async function getReserves(block) { - const chain = "astar"; - const addressesProviders = ( - await sdk.api.abi.call({ - target: addressesProviderRegistry, - abi: abi["getAddressesProvidersList"], - block, - chain, - }) - ).output; - - const protocolDataHelpers = ( - await sdk.api.abi.multiCall({ - calls: addressesProviders.map((provider) => ({ - target: provider, - params: - "0x0100000000000000000000000000000000000000000000000000000000000000", - })), - abi: abi["getAddress"], - block, - chain, - }) - ).output; - - const validProtocolDataHelpers = protocolDataHelpers - .filter( - (helper) => helper.output !== "0x0000000000000000000000000000000000000000" - ) - .map((p) => p.output); - - const sTokenMarketData = ( - await sdk.api.abi.multiCall({ - calls: validProtocolDataHelpers.map((dataHelper) => ({ - target: dataHelper, - })), - abi: abi["getAllSTokens"], - block, - chain, - }) - ).output; - - let sTokenAddresses = []; - sTokenMarketData.map((sTokensData) => { - sTokenAddresses = [ - ...sTokenAddresses, - ...sTokensData.output.map((sToken) => sToken[1]), - ]; - }); - const underlyingAddressesData = ( - await sdk.api.abi.multiCall({ - calls: sTokenAddresses.map((sToken) => ({ - target: sToken, - })), - abi: abi["getUnderlying"], - block, - chain, - }) - ).output; - - const reserveAddresses = underlyingAddressesData.map( - (reserveData) => reserveData.output - ); - return [sTokenAddresses, reserveAddresses, validProtocolDataHelpers[0]]; -} - -async function getSio2Tvl( - balances, - block, - chain, - sTokens, - reserveTokens, - transformAddress -) { - const balanceOfUnderlying = await sdk.api.abi.multiCall({ - calls: sTokens.map((sToken, index) => ({ - target: reserveTokens[index], - params: sToken, - })), - abi: "erc20:balanceOf", - block, - chain, - }); - - sdk.util.sumMultiBalanceOf( - balances, - balanceOfUnderlying, - true, - transformAddress - ); -} - -module.exports = { - getReserves, - getSio2Tvl, -}; diff --git a/projects/sio2/utils.js b/projects/sio2/utils.js deleted file mode 100644 index 696def55e5e..00000000000 --- a/projects/sio2/utils.js +++ /dev/null @@ -1,11 +0,0 @@ -const BigNumberJs = require("bignumber.js"); -BigNumberJs.config({ EXPONENTIAL_AT: 1e9 }) - -const toBigNumberJsOrZero = (value) => { - const bn = new BigNumberJs(value) - return bn.isNaN() ? new BigNumberJs('0') : bn -} - -module.exports = { - toBigNumberJsOrZero -} diff --git a/projects/siren/index.js b/projects/siren/index.js index 7c3f6a0ab24..91ac06ea7ac 100644 --- a/projects/siren/index.js +++ b/projects/siren/index.js @@ -1,145 +1,25 @@ - const { request, gql } = require("graphql-request"); - const BigNumber = require('bignumber.js'); - const sdk = require("@defillama/sdk"); - - const MAINNET_GRAPH_URL = 'https://api.thegraph.com/subgraphs/name/sirenmarkets/protocol'; - - const POLYGON_GRAPH_URL = 'https://api.thegraph.com/subgraphs/name/sirenmarkets/protocol-v2-matic' - -async function calculateMainnetTVL(timestamp, block, chainBlocks) { - - const ethereumBlock = chainBlocks['ethereum']; - - const mainnet_amms = await request(MAINNET_GRAPH_URL, GET_POOLS_MAINNET, { - ethereumBlock, - }); - - const mainnet_result = { - '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48': '0' - }; - - for (let i = 0; i < mainnet_amms['amms'].length; i++) { - - const amm = mainnet_amms['amms'][i]; - - const collateralToken = amm['collateralToken']['id']; - - // Get collateral in AMM - const response = await sdk.api.erc20.balanceOf({ - block: ethereumBlock, - target: collateralToken, - owner: amm['id'], - chain: "ethereum" - }); - - if (!mainnet_result[collateralToken]) { - mainnet_result[collateralToken] = '0'; - } - mainnet_result[collateralToken] = BigNumber(mainnet_result[collateralToken]).plus(response.output).toFixed(); - - // Get collateral in Markets - for (let im = 0; im < amm.markets.length; im++) { - const market = amm.markets[im]; - - const response = await sdk.api.erc20.balanceOf({ - block: ethereumBlock, - target: collateralToken, - owner: market['id'], - chain: "ethereum" - }); - - mainnet_result[collateralToken] = BigNumber(mainnet_result[collateralToken]).plus(response.output).toFixed(); - } - } - return mainnet_result; - -} - -async function calculatePolygonTVL(timestamp, block, chainBlocks) { - - const {seriesVaults} = await request(POLYGON_GRAPH_URL, GET_SERIES_VAULT_ID); - - const polygonBlock = chainBlocks['polygon']; - - const polygon_amms = await request(POLYGON_GRAPH_URL, GET_POOLS_POLYGON, { - polygonBlock, - }); - - const polygon_result = { - 'polygon:0x2791bca1f2de4661ed88a30c99a7a9449aa84174': '0' - }; - - for (let i = 0; i < polygon_amms['amms'].length; i++) { - const amm = polygon_amms['amms'][i]; - const collateralToken = amm['collateralToken']['id']; - - // Get collateral in AMM - const response = await sdk.api.erc20.balanceOf({ - block: polygonBlock, - target: collateralToken, - owner: amm['id'], - chain: "polygon" - }); - - if (!polygon_result['polygon:'+collateralToken]) { - polygon_result['polygon:'+collateralToken] = '0'; - } - polygon_result['polygon:'+collateralToken] = BigNumber(polygon_result['polygon:'+collateralToken]).plus(response.output).toFixed(); - - // Get collateral in Series - const response2 = await sdk.api.erc20.balanceOf({ - block: polygonBlock, - target: collateralToken, - owner: seriesVaults[0]['id'], - chain: "polygon" - }); - polygon_result['polygon:'+collateralToken] = BigNumber(polygon_result['polygon:'+collateralToken]).plus(response2.output).toFixed(); - - } - return polygon_result; - +const { getLogs, getAddress } = require('../helper/cache/getLogs'); +const { sumTokens2 } = require("../helper/unwrapLPs"); +const config = { + polygon: { fromBlock: 17842705, factory: '0x0cdaa64b47474e02cdfbd811ec9fd2d265cd3a0a', vault: '0xc40a31bd9fed1569ce647bb7de7ff93facca36e9', }, + ethereum: { fromBlock: 11272343, factory: '0xb8623477ea6f39b63598ceac4559728dca81af63', vault: '0x7b63ecbc78402553a2d7f01ea3d10079c3aaa469', }, } - const GET_POOLS_MAINNET = gql` - query Pools($ethereumBlock: Int) { - amms(block: { number: $ethereumBlock }) { - id - collateralToken { - id - } - markets { - id - } - } - } - ` - -const GET_POOLS_POLYGON = gql` -query Pools { - amms { - id - collateralToken { - id +module.exports = {}; + +Object.keys(config).forEach(chain => { + const { factory, fromBlock, vault, } = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const logs = await getLogs({ + api, + target: factory, + topics: ['0xa128ec36b78fa37f9f3e10bf2451c665a4e9fb1339f9f0e6fef45b343e73dcb1'], + fromBlock, + }) + const pools = logs.map(i => getAddress(i.data)) + const tokens = await api.multiCall({ abi: 'address:collateralToken', calls: pools}) + return sumTokens2({ api, tokensAndOwners: tokens.map((v, i) => [[v, pools[i]], [v, vault]]).flat()}) } } -}` -const GET_SERIES_VAULT_ID = gql` -query {seriesVaults{ - id - } -}` -// async function calculateUniTvl() - -/*================================================== - Exports - ==================================================*/ - - module.exports = { - start: 1605574800, // Nov-17-2020 01:00:00 AM +UTC - polygon: { - tvl: calculatePolygonTVL, - }, - ethereum: { - tvl: calculateMainnetTVL - }, - } \ No newline at end of file +}) \ No newline at end of file diff --git a/projects/sirius-finance/constants.js b/projects/sirius-finance/constants.js index eb050cb000f..63486dab000 100644 --- a/projects/sirius-finance/constants.js +++ b/projects/sirius-finance/constants.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') /*** Astar Addresses ***/ const usdPoolAddress = "0x417E9d065ee22DFB7CC6C63C403600E27627F333"; @@ -15,26 +16,26 @@ const AvaultPoolAddress = "0xD8Bc543273B0E19eed34a295614963720c89f9e4" const SRS = "0x9448610696659de8F72e1831d392214aE1ca4838" const VotingEscrow = "0xc9D383f1e6E5270D77ad8e198729e237b60b6397" -const DAI = '0x6De33698e9e9b787e09d3Bd7771ef63557E148bb' -const USDC = '0x6a2d262D56735DbA19Dd70682B39F6bE9a931D98' -const USDT = '0x3795C36e7D12A8c252A20C5a7B455f7c57b60283' -const BUSD = '0x4Bf769b05E832FCdc9053fFFBC78Ca889aCb5E1E' -const oUSD = '0x29F6e49c6E3397C3A84F715885F9F233A441165C'; -const BAI = '0x733ebcC6DF85f8266349DEFD0980f8Ced9B45f35'; -const LDAI = '0x4dd9c468A44F3FEF662c35c1E9a6108B70415C2c' -const LUSDC = '0xc404e12d3466accb625c67dbab2e1a8a457def3c' -const LUSDT = '0x430D50963d9635bBef5a2fF27BD0bDDc26ed691F' -const LBUSD = '0xb7aB962c42A8Bb443e0362f58a5A43814c573FFb' -const JPYC = '0x431d5dff03120afa4bdf332c61a6e1766ef37bdb' -const WBTC = '0xad543f18cff85c77e140e3e5e3c3392f6ba9d5ca' -const WETH = '0x81ecac0d6be0550a00ff064a4f9dd2400585fe9c' -const WBNB = '0x7f27352d5f83db87a5a3e00f4b07cc2138d8ee52' -const nASTR = '0xE511ED88575C57767BAfb72BfD10775413E3F2b0' +const DAI = ADDRESSES.astar.DAI +const USDC = ADDRESSES.moonbeam.USDC +const USDT = ADDRESSES.astar.USDT +const BUSD = ADDRESSES.oasis.ceUSDT +const oUSD = ADDRESSES.astar.oUSD; +const BAI = ADDRESSES.astar.BAI; +const LDAI = ADDRESSES.astar.lDAI +const LUSDC = ADDRESSES.astar.lUSDC +const LUSDT = ADDRESSES.astar.lUSDT +const LBUSD = ADDRESSES.astar.lBUSD +const JPYC = ADDRESSES.astar.JPYC +const WBTC = ADDRESSES.astar.WBTC +const WETH = ADDRESSES.moonbeam.USDT +const WBNB = ADDRESSES.milkomeda.BNB +const nASTR = ADDRESSES.astar.nASTR const wASTR = '0xAeaaf0e2c81Af264101B9129C00F4440cCF0F720' -const aBaiUsdc = '0xDBd71969aC2583A9A20Af3FB81FE9C20547f30F3' -const aDaiUsdc = '0x9914Bff0437f914549c673B34808aF6020e2B453' -const aBusdUsdc = '0x347e53263F8fb843EC605A1577eC7C8c0cAC7a58' -const aUsdtUsdc = '0x02Dac4898B2c2cA9D50fF8D6a7726166CF7bCFD0' +const aBaiUsdc = ADDRESSES.astar.aBaiUsdc +const aDaiUsdc = ADDRESSES.astar.aDaiUsdc +const aBusdUsdc = ADDRESSES.astar.aBusdUsdc +const aUsdtUsdc = ADDRESSES.astar.aUsdtUsdc module.exports = { diff --git a/projects/sithswap/abi.js b/projects/sithswap/abi.js new file mode 100644 index 00000000000..d69dc1543da --- /dev/null +++ b/projects/sithswap/abi.js @@ -0,0 +1,112 @@ +const fabis = [{ + "name": "allPairs", + "type": "function", + "inputs": [ + { + "name": "pid", + "type": "felt" + } + ], + "outputs": [ + { + "name": "res", + "type": "felt" + } + ], + "stateMutability": "view" +}, +{ + "name": "allPairsLength", + "type": "function", + "inputs": [], + "outputs": [ + { + "name": "res", + "type": "felt" + } + ], + "stateMutability": "view" +} +] + +const pabis = [ + { + "name": "getToken0", + "type": "function", + "inputs": [], + "outputs": [ + { + "name": "res", + "type": "felt" + } + ], + "stateMutability": "view" + }, + { + "name": "getToken1", + "type": "function", + "inputs": [], + "outputs": [ + { + "name": "res", + "type": "felt" + } + ], + "stateMutability": "view" + }, + { + "inputs": [], + "name": "getReserves", + "outputs": [ + { + "name": "reserve0", + "type": "felt" + }, + { + "name": "reserve1", + "type": "felt" + }, + { + "name": "block_timestamp", + "type": "felt" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getReserve1", + "outputs": [ + { + "name": "res", + "type": "Uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getReserve0", + "outputs": [ + { + "name": "res", + "type": "Uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + +] + + +const factory = {} +const pair = {} +fabis.forEach(i => factory[i.name] = i) +pabis.forEach(i => pair[i.name] = i) + +module.exports = { + factory, pair, fabis, pabis, +} \ No newline at end of file diff --git a/projects/sithswap/api.js b/projects/sithswap/api.js new file mode 100644 index 00000000000..587b71976cf --- /dev/null +++ b/projects/sithswap/api.js @@ -0,0 +1,40 @@ +// https://www.starknetjs.com/docs/API/contract + +const { call, multiCall, parseAddress } = require('../helper/chain/starknet') +const abi = require('./abi') +const { transformDexBalances } = require('../helper/portedTokens') +const { getParamCalls } = require('../helper/utils') +async function tvl() { + const factory = '0xeaf728d8e09bfbe5f11881f848ca647ba41593502347ed2ec5881e46b57a32' + let pairLength = await call({ target: factory, abi: abi.factory.allPairsLength}) + let pairs = await multiCall({ abi: abi.factory.allPairs, target: factory, calls: getParamCalls(Number(pairLength) + 1)}) + if (pairs[0]== 0){ + pairs.shift() + } + const calls = pairs.map(i => parseAddress(i)) + const [ token0s, token1s ,reserves0,reserves1] = await Promise.all([ + multiCall({ abi: abi.pair.getToken0, calls }), + multiCall({ abi: abi.pair.getToken1, calls }), + multiCall({ abi: abi.pair.getReserve0, calls }), + multiCall({ abi: abi.pair.getReserve1, calls }), + ]) + + const data = [] + reserves0.forEach((reserve0, i) => { + data.push({ + token0: parseAddress(token0s[i]), + token1: parseAddress(token1s[i]), + token0Bal: +reserve0, + token1Bal: +reserves1[i], + }) + }) + + return transformDexBalances({chain:'starknet', data}) +} + +module.exports = { + timetravel: false, + starknet: { + tvl, + } +} \ No newline at end of file diff --git a/projects/sithswap/index.js b/projects/sithswap/index.js new file mode 100644 index 00000000000..674e8c995c1 --- /dev/null +++ b/projects/sithswap/index.js @@ -0,0 +1 @@ +module.exports = require('./api') \ No newline at end of file diff --git a/projects/skcs/index.js b/projects/skcs/index.js index e9ff9f10176..121ba05b3e6 100644 --- a/projects/skcs/index.js +++ b/projects/skcs/index.js @@ -7,7 +7,7 @@ async function tvl(timestamp, ethBlock, {kcc: block}) { block, chain, target: "0x3CEF6d63C299938083D0c89C812d9C6985e3Af1c", - abi:{ "inputs": [], "name": "getLatestLockedKCS", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" } + abi: "uint256:getLatestLockedKCS" }) return {'kucoin-shares':Number(totalLockedKCS.output / 1e18)} diff --git a/projects/skeleton/abi.json b/projects/skeleton/abi.json index 23c1db9d808..a15745c5625 100644 --- a/projects/skeleton/abi.json +++ b/projects/skeleton/abi.json @@ -1,80 +1,6 @@ { - "poolInfo": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "poolInfo", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "want", - "type": "address" - }, - { - "internalType": "uint256", - "name": "allocPoint", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastRewardBlock", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accNATIVEPerShare", - "type": "uint256" - }, - { - "internalType": "address", - "name": "strat", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "poolLength": { - "inputs": [], - "name": "poolLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "wantLockedTotal": { - "inputs": [], - "name": "wantLockedTotal", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "symbol": { - "inputs": [], - "name": "symbol", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - } + "poolInfo": "function poolInfo(uint256) view returns (address want, uint256 allocPoint, uint256 lastRewardBlock, uint256 accNATIVEPerShare, address strat)", + "poolLength": "uint256:poolLength", + "wantLockedTotal": "uint256:wantLockedTotal", + "symbol": "string:symbol" } \ No newline at end of file diff --git a/projects/skeleton/index.js b/projects/skeleton/index.js index 6e3142007d0..5ed7340038f 100644 --- a/projects/skeleton/index.js +++ b/projects/skeleton/index.js @@ -1,9 +1,10 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); const { getParamCalls } = require('../helper/utils') const masterChefContract = "0x4fff737de45da4886f711b2d683fb6A6cf62C60C"; -const USDC = "0x04068da6c83afcfa0e13ba15a6696662335d5b75"; +const USDC = ADDRESSES.fantom.USDC; const chain = 'fantom' const ftmTvl = async (_, _b, { fantom: block }) => { @@ -29,7 +30,6 @@ const ftmTvl = async (_, _b, { fantom: block }) => { calls: stratCalls, chain, block, }) - console.log stratResponse.forEach(({ output },i) => { sdk.util.sumSingleBalance(balances, 'fantom:'+poolData[i].output.want, output) }) diff --git a/projects/skullswap-v3/index.js b/projects/skullswap-v3/index.js new file mode 100644 index 00000000000..0f764483be8 --- /dev/null +++ b/projects/skullswap-v3/index.js @@ -0,0 +1,9 @@ +const { uniV3Export } = require('../helper/uniswapV3') + +module.exports = uniV3Export({ + fantom: { + factory: '0x39eae0e8e8a733bcc1165a1e538a98fe8c46e183', + fromBlock: 56614737, + isAlgebra: true, + } +}) \ No newline at end of file diff --git a/projects/skullswap/index.js b/projects/skullswap/index.js new file mode 100644 index 00000000000..f62677baf5e --- /dev/null +++ b/projects/skullswap/index.js @@ -0,0 +1,3 @@ +const { uniTvlExport } = require('../helper/unknownTokens') + +module.exports = uniTvlExport('fantom', '0x67BDF64a26A6B08f003580873448346c1C8bA93c') \ No newline at end of file diff --git a/projects/skydex/index.js b/projects/skydex/index.js new file mode 100644 index 00000000000..52156dd304b --- /dev/null +++ b/projects/skydex/index.js @@ -0,0 +1,22 @@ +const { sumTokens2 } = require("../helper/unwrapLPs"); + +const pools = [ + "0xe59eA42466f3dD0ea620A622701085983A068863", + "0x33b4424A65cfE19CDf0Dff4E54e399782327a1b6", +]; + +const blacklistedTokens = [] + +async function tvl(timestamp, ethereumBlock, chainBlocks, { api }) { + const tokensArray = await api.multiCall({ abi: "address[]:getTokens", calls: pools}) + const tokens = tokensArray.flat() + const calls = tokensArray.map((t, i)=> t.map((token) => ({ target: pools[i], params: token }))).flat() + const owners = await api.multiCall({ abi:"function assetOf(address) view returns (address)", calls}) + return sumTokens2({ api, tokensAndOwners2: [tokens, owners], blacklistedTokens }); +} + +module.exports = { + era: { + tvl, + }, +}; diff --git a/projects/sleepearn/index.js b/projects/sleepearn/index.js index 7ebbf6bfb1b..64805ba3d92 100644 --- a/projects/sleepearn/index.js +++ b/projects/sleepearn/index.js @@ -5,9 +5,9 @@ async function fetch() { let tvl = 0; for (const vault in response.data[0]) { tvl += response.data[0][vault]; - }; + } return tvl; -}; +} module.exports = { kardia:{ diff --git a/projects/slsd/index.js b/projects/slsd/index.js new file mode 100644 index 00000000000..51fd1bcbf39 --- /dev/null +++ b/projects/slsd/index.js @@ -0,0 +1,32 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { staking } = require("../helper/staking"); +const { sumTokens2, nullAddress } = require("../helper/unwrapLPs"); +const FACTORY_CONTRACT = "0x253924C4D0806Fd6A81f72e0bEa400CD97c64700"; + +const SLSD_LP = '0x712Ed536645e66d0d8605d3cB22d1ed3b2Dc255B'; +const SLSD = '0xB668f51f1D63452b566456053fA348c3037E2B1F'; +const eSLSD = '0x2dd8f7378fce12c9dfe36a6c155fc2446d18b3f9'; +const abis = { + "getStakingTokens": "function getStakingTokens() view returns (address[])", + "getStakingPoolAddress": "function getStakingPoolAddress(address) view returns (address)", +} + +async function tvl(_, _1, _2, { api }) { + const tokens = await api.call({ abi: abis.getStakingTokens, target: FACTORY_CONTRACT, }) + const owners = await api.multiCall({ abi: abis.getStakingPoolAddress, target: FACTORY_CONTRACT, calls: tokens }) + tokens.forEach((v, i) => { + if (v === nullAddress) { + tokens.push(ADDRESSES.ethereum.WETH) + owners.push(owners[i]) + } + }) + return sumTokens2({ api, tokensAndOwners2: [tokens, owners], blacklistedTokens: [SLSD_LP, SLSD, eSLSD,] }) +} + +module.exports = { + start: 17142918, + ethereum: { + tvl, + pool2: staking('0xBE13DC5235a64d090E9c62952654DBF3c65199d9', SLSD_LP) + } +}; diff --git a/projects/smbswap-v3/index.js b/projects/smbswap-v3/index.js new file mode 100644 index 00000000000..05f25391571 --- /dev/null +++ b/projects/smbswap-v3/index.js @@ -0,0 +1,5 @@ +const { uniV3Export } = require('../helper/uniswapV3') + +module.exports = uniV3Export({ + bsc: { factory: '0xa9b5d4eac94cb98117abdcc0ecbd7731960f91d9', fromBlock: 27043748, isAlgebra: false,}, +}) \ No newline at end of file diff --git a/projects/smolswap/abi.json b/projects/smolswap/abi.json index d9f2d069c70..85069067302 100644 --- a/projects/smolswap/abi.json +++ b/projects/smolswap/abi.json @@ -1,37 +1,3 @@ { - "poolInfo": { - "type":"function", - "stateMutability":"view", - "outputs": - [ - { - "type":"address", - "name":"lpToken", - "internalType":"contract IERC20" - }, - { - "type":"uint256", - "name":"allocPoint", - "internalType":"uint256" - }, - { - "type":"uint256", - "name":"lastRewardTime", - "internalType":"uint256" - }, - { - "type":"uint256", - "name":"accSmolPerShare", - "internalType":"uint256" - } - ], - "name":"poolInfo", - "inputs":[ - { - "type":"uint256", - "name":"", - "internalType":"uint256" - } - ] - } + "poolInfo": "function poolInfo(uint256) view returns (address lpToken, uint256 allocPoint, uint256 lastRewardTime, uint256 accSmolPerShare)" } \ No newline at end of file diff --git a/projects/smurfmoney/index.js b/projects/smurfmoney/index.js index 86d24bd8f5a..ff519ee6930 100644 --- a/projects/smurfmoney/index.js +++ b/projects/smurfmoney/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { addFundsInMasterChef } = require("../helper/masterchef"); const clever = "0x465bc6d1ab26efa74ee75b1e565e896615b39e79"; @@ -9,8 +10,8 @@ async function tvl (timestamp, block, chainBlocks) { let balances = {}; await addFundsInMasterChef(balances, clevermasterchef, chainBlocks.fantom, "fantom", addr=>`fantom:${addr}`, undefined, [mushy, clever], true, true, clever); await addFundsInMasterChef(balances, mushymasterchef, chainBlocks.fantom, "fantom", addr=>`fantom:${addr}`, undefined, [mushy, clever], true, true, mushy); - balances["0x6b175474e89094c44da98b954eedeac495271d0f"] = balances["fantom:0x8D11eC38a3EB5E956B052f67Da8Bdc9bef8Abf3E"]; - delete balances["fantom:0x8D11eC38a3EB5E956B052f67Da8Bdc9bef8Abf3E"]; + balances[ADDRESSES.ethereum.DAI] = balances["fantom:" + ADDRESSES.fantom.DAI]; + delete balances["fantom:" + ADDRESSES.fantom.DAI]; return balances; } diff --git a/projects/smxswap/index.js b/projects/smxswap/index.js index e056e687905..3153d4acc99 100644 --- a/projects/smxswap/index.js +++ b/projects/smxswap/index.js @@ -1,11 +1,8 @@ -const { getUniTVL } = require('../helper/unknownTokens') +const { uniTvlExport } = require('../helper/unknownTokens') +const { mergeExports } = require('../helper/utils') -module.exports={ - cronos: { - tvl: getUniTVL({ - chain: 'cronos', - factory: '0x1Ed37E4323E429C3fBc28461c14A181CD20FC4E8', - useDefaultCoreAssets: true, - }), - } -} \ No newline at end of file +module.exports = mergeExports([ + uniTvlExport('cronos', '0x1Ed37E4323E429C3fBc28461c14A181CD20FC4E8'), + uniTvlExport('bsc', '0x2C3408a4827DF0419DA2f53eAe92f338B4d314ec'), + uniTvlExport('polygon', '0xDD4047F11c80f7831922904Ddb61E370E83D5fbb'), +]) \ No newline at end of file diff --git a/projects/snarklaunch/index.js b/projects/snarklaunch/index.js new file mode 100644 index 00000000000..bdac5aaf126 --- /dev/null +++ b/projects/snarklaunch/index.js @@ -0,0 +1,12 @@ +const { sumTokensExport } = require('../helper/unwrapLPs') + +const STAKING_SNRK_CONTRACT = "0xEbA49A81501b036234578D10e78685ca8BbD2901"; +const SNRK_TOKEN = "0x533b5F887383196C6bc642f83338a69596465307"; + +module.exports = { + methodology: 'TVL for SNRK staking is computed by summing the balance of SNRK tokens held by the staking contract.', + era: { + staking: sumTokensExport({ owners: [STAKING_SNRK_CONTRACT], tokens: [SNRK_TOKEN] }), + tvl: () => 0, + }, +} diff --git a/projects/snowball/abi.json b/projects/snowball/abi.json index 5bc9e749132..0d2794594d0 100644 --- a/projects/snowball/abi.json +++ b/projects/snowball/abi.json @@ -1,73 +1,7 @@ { - "getToken": { - "type": "function", - "stateMutability": "view", - "outputs": [ - { - "type": "address", - "name": "", - "internalType": "contract IERC20" - } - ], - "name": "getToken", - "inputs": [ - { - "type": "uint8", - "name": "index", - "internalType": "uint8" - } - ] - }, - "want": { - "type": "function", - "stateMutability": "view", - "outputs": [ - { - "type": "address", - "name": "", - "internalType": "address" - } - ], - "name": "want", - "inputs": [] - }, - "balanceOf": { - "type": "function", - "stateMutability": "view", - "outputs": [ - { - "type": "uint256", - "name": "", - "internalType": "uint256" - } - ], - "name": "balanceOf", - "inputs": [] - }, - "token": { - "type": "function", - "stateMutability": "view", - "outputs": [ - { - "type": "address", - "name": "", - "internalType": "contract IERC20" - } - ], - "name": "token", - "inputs": [] - }, - "balance": { - "type": "function", - "stateMutability": "view", - "outputs": [ - { - "type": "uint256", - "name": "", - "internalType": "uint256" - } - ], - "name": "balance", - "inputs": [] - } + "getToken": "function getToken(uint8 index) view returns (address)", + "want": "address:want", + "balanceOf": "uint256:balanceOf", + "token": "address:token", + "balance": "uint256:balance" } \ No newline at end of file diff --git a/projects/snowball/index.js b/projects/snowball/index.js index a81da58b7f0..618c5a5980c 100644 --- a/projects/snowball/index.js +++ b/projects/snowball/index.js @@ -1,12 +1,10 @@ -const sdk = require('@defillama/sdk'); const { request, gql } = require("graphql-request"); -const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); -const { isLP } = require('../helper/utils.js'); +const { sumTokens2 } = require("../helper/unwrapLPs"); +const { staking } = require('../helper/staking.js'); const abi = require('./abi.json') const API_URL = `https://api.snowapi.net/graphql` -const OLD_API_URL = `https://snob-backend-api.herokuapp.com/graphql` const query = gql` query { @@ -28,138 +26,47 @@ query { const XSNOB_CONTRACT = '0x83952E7ab4aca74ca96217D6F8f7591BEaD6D64E'; const SNOB_TOKEN_CONTRACT = '0xc38f41a296a4493ff429f1238e030924a1542e50'; -async function staking(timestamp, block, chainBlocks) { - const balances = {}; - await sdk.api.abi.call({ - target: SNOB_TOKEN_CONTRACT, - params: [XSNOB_CONTRACT], - block: chainBlocks.avax, - chain: 'avax', - abi: 'erc20:balanceOf' - }).then(stakedSnob => { - sdk.util.sumSingleBalance(balances, `avax:${SNOB_TOKEN_CONTRACT}`, stakedSnob.output); - }); - return balances; -} - -async function getStableVaultBalances(balances, stablevaults, block) { - await Promise.all(stablevaults.map(async (vault) => { - await sdk.api.abi.multiCall({ - calls: [0, 1, 2, 3].map(num => ({ - target: vault.swapAddress, - params: [num] - })), - abi: abi.getToken, - block, - chain: 'avax' - }).then(async tokens => { - await sdk.api.abi.multiCall({ - calls: tokens.output.filter(t => t.output != null).map(token => ({ - target: token.output, - params: [vault.swapAddress] - })), - abi: 'erc20:balanceOf', - block, - chain: 'avax' - }).then(tokenBalances => { - const balancesToAdd = {}; - sdk.util.sumMultiBalanceOf(balancesToAdd, tokenBalances); - Object.entries(balancesToAdd).forEach(balance => { - sdk.util.sumSingleBalance(balances, `avax:${balance[0]}`, balance[1]); - }); - }); - }); - })); +async function getStableVaultBalances(stablevaults, api) { + const calls = stablevaults.map(i => [0, 1, 2, 3].map(num => ({ params: num, target: i.swapAddress }))).flat() + const tokens = await api.multiCall({ abi: abi.getToken, calls: calls, withMetadata: true, + permitFailure: true, }) + const toa = [] + tokens.forEach(i => { + if (!i.output) return; + toa.push([i.output, i.input.target]) + }) + return sumTokens2({ api, tokensAndOwners: toa }) } -async function getSnowglobeBalances(balances, snowglobes, block) { - const singleSidedPairs = { - calls: snowglobes.filter((globe) => !globe.pair.includes("-")).map(globe => ({ - target: globe.snowglobeAddress - })), - block, - chain: 'avax' - } +async function getSnowglobeBalances(snowglobes, api) { + const singleSidedPairs = snowglobes.map(globe => globe.snowglobeAddress).filter(i => i) const [tokens, tokenBalances] = await Promise.all([ - sdk.api.abi.multiCall({ - ...singleSidedPairs, + api.multiCall({ + calls: singleSidedPairs, abi: abi.token }), - sdk.api.abi.multiCall({ - ...singleSidedPairs, + api.multiCall({ + calls: singleSidedPairs, abi: abi.balance }) ]) - await Promise.all(tokens.output.map((token, idx) => { - sdk.util.sumSingleBalance(balances, `avax:${token.output}`, tokenBalances.output[idx].output); - })); - - snowglobes = snowglobes.filter((globe) => globe.pair.includes("-")); - const globes = { - calls: snowglobes.map(globe => ({ - target: globe.snowglobeAddress, - })), - block, - chain: 'avax' - }; - const [lpTokens, lpTokenBalances] = await Promise.all([ - sdk.api.abi.multiCall({ - ...globes, - abi: abi.token, - }), - sdk.api.abi.multiCall({ - ...globes, - abi: abi.balance, - }), - ]); - - const tokenNames = await sdk.api.abi.multiCall({ - abi: 'erc20:symbol', - calls: lpTokens.output.map(t => ({ - target: t.output - })), - block, - chain: 'avax' - }) - - const lpPositions = []; - for (let i = 0; i < tokenNames.output.length; i++) { - if (isLP(tokenNames.output[i].output , tokenNames.output[i].input.target, 'avax')) { - lpPositions.push({ - token: lpTokens.output[i].output, - balance: lpTokenBalances.output[i].output - }) - } else { - // these are all axial LPs - sdk.util.sumSingleBalance(balances, 'avax:0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E', (lpTokenBalances.output[i].output / 10 ** 12).toFixed(0)) - } - } - - await unwrapUniswapLPs(balances, lpPositions, block, 'avax', (addr) => `avax:${addr}`, [], true); + api.addTokens(tokens, tokenBalances) } -async function tvl(_timestamp, _ethereumBlock, chainBlocks) { - const balances = {} - const block = chainBlocks['avax']; - - let data; - try { - data = await request(API_URL, query); - } catch { - data = await request(OLD_API_URL, query); - } +async function tvl(_timestamp, _ethereumBlock, chainBlocks, { api }) { + let data = await request(API_URL, query); const deprecatedSnowglobes = data.DeprecatedContracts.filter(contract => contract.kind === "Snowglobe").map(contract => ({ pair: contract.pair, snowglobeAddress: contract.contractAddresses[0] })); const deprecatedStablevaults = data.DeprecatedContracts.filter(contract => contract.kind === "Stablevault").map(contract => ({ swapAddress: contract.contractAddresses[2] })); - await getStableVaultBalances(balances, data.StablevaultContracts.concat(deprecatedStablevaults), block); - await getSnowglobeBalances(balances, data.SnowglobeContracts.concat(deprecatedSnowglobes), block); - - return balances; + await Promise.all([ + getStableVaultBalances(data.StablevaultContracts.concat(deprecatedStablevaults), api), + getSnowglobeBalances(data.SnowglobeContracts.concat(deprecatedSnowglobes), api), + ]) } module.exports = { - avax:{ + avax: { tvl, - staking + staking: staking(XSNOB_CONTRACT, SNOB_TOKEN_CONTRACT) } } // node test.js projects/snowball/index.js diff --git a/projects/snowdogdao/index.js b/projects/snowdogdao/index.js index d8974dc2434..bd4938f6da2 100644 --- a/projects/snowdogdao/index.js +++ b/projects/snowdogdao/index.js @@ -1,16 +1,20 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { ohmTvl } = require('../helper/ohm') +module.exports.hallmarks=[ + [1637798400,"Rug Pull"] +], module.exports=ohmTvl("0xC0E7DA06e56727F3B55B24F58e9503FdaAfb2a68", [ //mim ["0x130966628846bfd36ff31a822705796e8cb8c18d", false], //wavax - ["0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7", false], + [ADDRESSES.avax.WAVAX, false], //spell ["0xce1bffbd5374dac86a2893119683f4911a2f7814", false], //joe - ["0x6e84a6216ea6dacc71ee8e6b0a5b7322eebc0fdd", false], + [ADDRESSES.avax.JOE, false], //weth - ["0x49d5c2bdffac6ce2bfdb6640f4f80f226bc10bab", false], + [ADDRESSES.avax.WETH_e, false], //LP_sdog_mim ["0xa3f1f5076499ec37d5bb095551f85ab5a344bb58", true] ], "avax", "0xc970dab38627bc7Ba1487754d832A327E0e626Cd", "0xde9e52f1838951e4d2bb6c59723b003c353979b6") \ No newline at end of file diff --git a/projects/snowflake/abi.js b/projects/snowflake/abi.js index a7ff07f46c1..35e127f8475 100644 --- a/projects/snowflake/abi.js +++ b/projects/snowflake/abi.js @@ -1,17 +1,4 @@ module.exports = { - getAssets: { - "inputs": [], - "name": "getAssets", - "outputs": [ - { - "internalType": "address[][]", - "name": "", - "type": "address[][]" - } - ], - "stateMutability": "view", - "type": "function" - }, - + getAssets: "function getAssets() view returns (address[][])", } \ No newline at end of file diff --git a/projects/snowflake/constants.js b/projects/snowflake/constants.js index 6a61bb7ce94..10b6fc4dd12 100644 --- a/projects/snowflake/constants.js +++ b/projects/snowflake/constants.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') /** * lp token addresses */ @@ -7,9 +8,9 @@ const MAIN_USDT_LP = "0x3dc2a544A3A9C4D86d58D52bCaD1ECA8c1EC2361"; const MAIN_DAI_LP = "0x59a49E5bd704fC70E2cD9fe3d4D5D03991278015"; const MAIN_MAI_LP = "0xD0dCF24aA7784e34F022AdF43447578e54e2a695"; -const USDC = "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174"; -const USDT = "0xc2132D05D31c914a87C6611C10748AEb04B58e8F"; -const DAI = "0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063"; +const USDC = ADDRESSES.polygon.USDC; +const USDT = ADDRESSES.polygon.USDT; +const DAI = ADDRESSES.polygon.DAI; const MAI = "0xa3Fa99A148fA48D14Ed51d610c367C61876997F1"; module.exports = { diff --git a/projects/snowflake/index.js b/projects/snowflake/index.js index 02482b74efe..4f9d577377e 100644 --- a/projects/snowflake/index.js +++ b/projects/snowflake/index.js @@ -3,21 +3,35 @@ const { staking } = require("../helper/staking"); const { sumTokens2 } = require('../helper/unwrapLPs') const assetsAbi = require("./abi") const asssetsContract = "0x2c326AbbE089B786E7170da84e39F3d0c6650653" +const bscAsssetsContract = "0xEaEC4e680F5D534772e888fbD558b3b29e1F2E89" + const chain = "polygon" +const chain2 = "bsc" async function tvl(timestamp, ethereumBlock, chainBlocks) { const block = chainBlocks[chain]; - const { output: toa } = await sdk.api.abi.call({ target: asssetsContract, abi: assetsAbi.getAssets, chain, block, }) - return sumTokens2({ chain: chain, block, tokensAndOwners: toa, }) } +async function bscTvl(timestamp, ethereumBlock, chainBlocks) { + const block = chainBlocks[chain2]; + const { output: toa } = await sdk.api.abi.call({ + target: bscAsssetsContract, + abi: assetsAbi.getAssets, + chain: chain2, block, + }) + return sumTokens2({ chain: chain2, block, tokensAndOwners: toa, }) +} + module.exports = { + hallmarks: [ + [1672448400,"Rug Pull"] + ], polygon:{ tvl, staking: staking( @@ -26,4 +40,13 @@ module.exports = { "polygon" ), }, + + bsc: { + tvl: bscTvl, + staking: staking( + "0xfD5D4caDe98366d0b09c03cB3cEe7D244c8b6146", //ve + "0xE0f463832295ADf63eB6CA053413a3f9cd8bf685", //snow + "bsc" + ), + } }; diff --git a/projects/snowswap-xyz/index.js b/projects/snowswap-xyz/index.js new file mode 100644 index 00000000000..d8c76420613 --- /dev/null +++ b/projects/snowswap-xyz/index.js @@ -0,0 +1,11 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports = { + misrepresentedTokens: true, + crab: { + tvl: getUniTVL({ + useDefaultCoreAssets: true, + factory: '0x36ABF1A7851fBF9ae9D79dc3E39C1227068158B3', + }) + }, +} \ No newline at end of file diff --git a/projects/soarpulse/index.js b/projects/soarpulse/index.js new file mode 100644 index 00000000000..074ad878486 --- /dev/null +++ b/projects/soarpulse/index.js @@ -0,0 +1,9 @@ +const { sumTokensExport, nullAddress } = require("../helper/unwrapLPs"); + +const contract = "0xb29201EBB420b28Bb43052Ad58C23F43d6899F51"; + +module.exports = { + pulse: { + tvl: sumTokensExport({ owner: contract, tokens: [nullAddress]}), + }, +}; \ No newline at end of file diff --git a/projects/sobal/index.js b/projects/sobal/index.js new file mode 100644 index 00000000000..dd4ce279afd --- /dev/null +++ b/projects/sobal/index.js @@ -0,0 +1,15 @@ +const { onChainTvl } = require('../helper/balancer') + +const V2_ADDRESS = '0x7122e35ceC2eED4A989D9b0A71998534A203972C'; // Vault + +const config = { + neon_evm: { fromBlock: 206166057, }, + base: { fromBlock: 2029566 } +} + +Object.keys(config).forEach(chain => { + const { fromBlock } = config[chain] + module.exports[chain] = { + tvl: onChainTvl(V2_ADDRESS, fromBlock) + } +}) diff --git a/projects/socialswap/index.js b/projects/socialswap/index.js index 1e67570095b..d57f5dc8b69 100644 --- a/projects/socialswap/index.js +++ b/projects/socialswap/index.js @@ -1,12 +1,16 @@ -const utils = require("../helper/utils"); +const sdk = require('@defillama/sdk') +const { getUniTVL } = require('../helper/unknownTokens.js') -// There are staking and pool2 parts, but the Social Swap Token (SST) is not on coingecko yet. It'll be updated !! - -async function fetch(timestamp, chainBlocks) { - const tvl = await utils.fetchURL("https://backend.socialswap.io/api/v1/tlv"); - return tvl.data.total_usdt; -} +const TRON_FACTORY_V1 = 'TN57jo2jGQz3v5YDybyLFHFtvkmRQvCNFz' +const TRON_FACTORY_V2 = 'TSzrq5j2Btn27eVcBAvZj9WQK3FhURamDQ' module.exports = { - fetch, -}; + timetravel: false, + misrepresentedTokens: true, + tron: { + tvl: sdk.util.sumChainTvls([ + getUniTVL({ factory: TRON_FACTORY_V1, useDefaultCoreAssets: true, }), + getUniTVL({ factory: TRON_FACTORY_V2, useDefaultCoreAssets: true, }), + ]) + } +} diff --git a/projects/soda-protocol/index.js b/projects/soda-protocol/index.js index 1fc3e831728..b9c4ae64baf 100644 --- a/projects/soda-protocol/index.js +++ b/projects/soda-protocol/index.js @@ -1,13 +1,14 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens2 } = require('../helper/solana') async function tvl() { const owner = '5cv5tMwrCMAVbwAC5icUPB5XB4qQpsaf3KaGP7Ygdomc' const tokens = [ "9n4nbM75f5Ui33ZbPYXn59EwSgE8CGsHtAeTH5YFeJ9E", - "So11111111111111111111111111111111111111112", + ADDRESSES.solana.SOL, "SRMuApVNdxXokk5GT7XD5cUUgXMBCoAz2LHeuAoKWRt", - "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", - "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB", + ADDRESSES.solana.USDC, + ADDRESSES.solana.USDT, "2FPyTwcZLUg1MDrwsyoP4D6s1tM7hAkHYRjkNb5w6Pxk", "4k3Dyjzvzp8eMZWUXbBCjEvwSkkk59S5iCNLY3QrkX6R", ] diff --git a/projects/sohei/index.js b/projects/sohei/index.js new file mode 100644 index 00000000000..4882d9f1162 --- /dev/null +++ b/projects/sohei/index.js @@ -0,0 +1,12 @@ +const {compoundExports} = require('../helper/compound'); +const { nullAddress } = require('../helper/tokenMapping'); + +const ceth = "0x685d1f1a83ff64e75fe882e7818e4ad9173342ca"; +const chain = "arbitrum"; + +module.exports = { + hallmarks: [ + [1680480000, "Team out of funds announced"] + ], + arbitrum: compoundExports('0x9f750cf10034f3d7a18221aec0bddab7fc6f32ba', chain, ceth, nullAddress, undefined, undefined, { blacklistedTokens: ['0x6e002cb9bf8c17409eeb6c593ef6548faddd2985']}), +}; \ No newline at end of file diff --git a/projects/solace-finance/config.js b/projects/solace-finance/config.js index 7ea017e1e5c..51f428ae11d 100644 --- a/projects/solace-finance/config.js +++ b/projects/solace-finance/config.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') module.exports = { ethereum: { solace: '0x501acE9c35E60f03A2af4d484f49F9B1EFde9f40', @@ -5,27 +6,27 @@ module.exports = { uwp_address: '0x5efC0d9ee3223229Ce3b53e441016efC5BA83435', tokens: [ { - PoolToken: "0x853d955aCEf822Db058eb8505911ED77F175b99e", + PoolToken: ADDRESSES.ethereum.FRAX, TokenTicker: "FRAX", }, { - PoolToken: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", + PoolToken: ADDRESSES.ethereum.USDC, TokenTicker: "USDC", }, { - PoolToken: "0xdAC17F958D2ee523a2206206994597C13D831ec7", + PoolToken: ADDRESSES.ethereum.USDT, TokenTicker: "USDT", }, { - PoolToken: "0x6B175474E89094C44Da98b954EedeAC495271d0F", + PoolToken: ADDRESSES.ethereum.DAI, TokenTicker: "DAI", }, { - PoolToken: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + PoolToken: ADDRESSES.ethereum.WETH, TokenTicker: "WETH", }, { - PoolToken: "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", + PoolToken: ADDRESSES.ethereum.WBTC, TokenTicker: "WBTC", }, ] @@ -35,7 +36,7 @@ module.exports = { solace: '0x501acE9c35E60f03A2af4d484f49F9B1EFde9f40', tokens: [ { - PoolToken: "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270", + PoolToken: ADDRESSES.polygon.WMATIC_2, TokenTicker: "WMATIC", }, { @@ -43,23 +44,23 @@ module.exports = { TokenTicker: "FRAX", }, { - PoolToken: "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174", + PoolToken: ADDRESSES.polygon.USDC, TokenTicker: "USDC", }, { - PoolToken: "0xc2132D05D31c914a87C6611C10748AEb04B58e8F", + PoolToken: ADDRESSES.polygon.USDT, TokenTicker: "USDT", }, { - PoolToken: "0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063", + PoolToken: ADDRESSES.polygon.DAI, TokenTicker: "DAI", }, { - PoolToken: "0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619", + PoolToken: ADDRESSES.polygon.WETH_1, TokenTicker: "WETH", }, { - PoolToken: "0x1BFD67037B42Cf73acF2047067bd4F2C47D9BfD6", + PoolToken: ADDRESSES.polygon.WBTC, TokenTicker: "WBTC", }, ] @@ -70,23 +71,23 @@ module.exports = { lp: '0xdDAdf88b007B95fEb42DDbd110034C9a8e9746F2', tokens: [ { - PoolToken: "0xC42C30aC6Cc15faC9bD938618BcaA1a1FaE8501d", + PoolToken: ADDRESSES.aurora.NEAR, TokenTicker: "WNEAR", }, { - PoolToken: "0x8BEc47865aDe3B172A928df8f990Bc7f2A3b9f79", + PoolToken: ADDRESSES.aurora.AURORA, TokenTicker: "AURORA", }, { - PoolToken: "0xDA2585430fEf327aD8ee44Af8F1f989a2A91A3d2", + PoolToken: ADDRESSES.aurora.FRAX, TokenTicker: "FRAX", }, { - PoolToken: "0xB12BFcA5A55806AaF64E99521918A4bf0fC40802", + PoolToken: ADDRESSES.aurora.USDC_e, TokenTicker: "USDC", }, { - PoolToken: "0x4988a896b1227218e4A686fdE5EabdcAbd91571f", + PoolToken: ADDRESSES.aurora.USDT_e, TokenTicker: "USDT", }, { diff --git a/projects/solarbeam/index.js b/projects/solarbeam/index.js index d9e941fbfdd..54c0b6b2f6c 100644 --- a/projects/solarbeam/index.js +++ b/projects/solarbeam/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { getUniTVL } = require('../helper/unknownTokens') const sdk = require("@defillama/sdk"); const BigNumber = require("bignumber.js"); @@ -51,13 +52,13 @@ const stableSwapPools = { const stableSwapTokens = { USDC: { - address: '0xE3F5a90F9cb311505cd691a46596599aA1A0AD7D', + address: ADDRESSES.moonriver.USDC, decimals: 6, symbol: 'USDC', gecko: 'usd-coin' }, USDT: { - address: '0xB44a9B6905aF7c801311e8F4E76932ee959c663C', + address: ADDRESSES.moonriver.USDT, decimals: 6, symbol: 'USDT', gecko: 'tether' @@ -113,7 +114,7 @@ const stableSwapTokens = { WBTC: { symbol: 'WBTC', name: 'Wrapped BTC', - address: '0x6aB6d61428fde76768D7b45D8BFeec19c6eF91A8', + address: ADDRESSES.oasis.USDT, decimals: 8, gecko: 'bitcoin' } @@ -163,14 +164,14 @@ async function stableDexTVL(timestamp, _block, chainBlocks) { } const dexTVL = getUniTVL({ + useDefaultCoreAssets: true, factory: '0x049581aEB6Fe262727f290165C29BDAB065a1B68', - chain: 'moonriver', coreAssets: [ '0xf50225a84382c74CbdeA10b0c176f71fc3DE0C4d', // moonriver "0x98878B06940aE243284CA214f92Bb71a2b032B8A", // WMOVR - // "0xb44a9b6905af7c801311e8f4e76932ee959c663c", // usdt - "0xe3f5a90f9cb311505cd691a46596599aa1a0ad7d", // usdc - "0x639a647fbe20b6c8ac19e48e2de44ea792c62c5c", // eth + // ADDRESSES.moonriver.USDT, // usdt + ADDRESSES.moonriver.USDC, // usdc + ADDRESSES.moonriver.ETH, // eth ] }) diff --git a/projects/solend/index.js b/projects/solend/index.js index af8eedd15b2..895249b3b03 100644 --- a/projects/solend/index.js +++ b/projects/solend/index.js @@ -3,13 +3,13 @@ const { PublicKey, } = require("@solana/web3.js"); const { sliceIntoChunks, } = require('../helper/utils') const { transformBalances, } = require('../helper/portedTokens') const { sumTokens, getConnection, decodeAccount, } = require("../helper/solana"); -const { fetchURL } = require('../helper/utils') +const { getConfig } = require('../helper/cache') const sdk = require('@defillama/sdk') const solendConfigEndpoint = "https://api.solend.fi/v1/markets/configs?scope=all&deployment=production"; async function borrowed() { - const markets = (await fetchURL(solendConfigEndpoint))?.data; + const markets = (await getConfig('solend', solendConfigEndpoint)) const connection = getConnection() const balances = {}; const reserves = [] @@ -32,7 +32,7 @@ async function borrowed() { } async function tvl() { - const markets = (await fetchURL(solendConfigEndpoint))?.data; + const markets = (await getConfig('solend', solendConfigEndpoint)) const tokensAndOwners = [] for (const market of markets) { diff --git a/projects/solhero/index.js b/projects/solhero/index.js index b934973892b..1a941679b16 100644 --- a/projects/solhero/index.js +++ b/projects/solhero/index.js @@ -1,17 +1,19 @@ +const ADDRESSES = require('../helper/coreAssets.json') const utils = require('../helper/utils') const { getConnection } = require('../helper/solana') const BigNumber = require('bignumber.js') const { PublicKey } = require('@solana/web3.js') +const sdk = require('@defillama/sdk') const poolInfoKey = new PublicKey('CsMSJ2wJAsQBNZU9LuL3FAx2Do9ndY4Ae15JAXhFMc1p') const decimals = { 'Hero6s7zJXsw9hfCXLVR5stLqgCok3E7CCkpQEoLAk2g': 6, // HERO - 'So11111111111111111111111111111111111111112': 9, // SOL + [ADDRESSES.solana.SOL]: 9, // SOL '4k3Dyjzvzp8eMZWUXbBCjEvwSkkk59S5iCNLY3QrkX6R': 6, // RAY 'mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So': 9, // mSOL - 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v': 6, // USDC - 'Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB': 6, // USDT + [ADDRESSES.solana.USDC]: 6, // USDC + [ADDRESSES.solana.USDT]: 6, // USDT 'rEmtKCiw6DQL8kAaGzhSryqnqNckYabPxTNXDdj2Jur': 6, // hero-usdc 'Epm4KfTj4DMrvqn6Bwg2Tr2N8vhQuNbuK8bESFp4k33K': 9, // sol-usdt '8HoQnePLqPj4M7PUDzfw8e3Ymdwgc7NLGnaTUapubyvu': 9, // sol-usdc @@ -50,7 +52,6 @@ function isLp(token) { var priceCache = new Map() async function getTokenSupplyUI(mintPubkey) { - //console.log('getTokenSupplyUi(' + mintPubkey.toString() + ')') const connection = getConnection() var supply = new BigNumber(0) @@ -62,7 +63,6 @@ async function getTokenSupplyUI(mintPubkey) { } async function getLpPrice(tokenPubkey) { - //console.log('getLpPrice(' + tokenPubkey.toString() + ')') if (priceCache[tokenPubkey.toString()]) return priceCache[tokenPubkey.toString()] @@ -91,16 +91,14 @@ async function getLpPrice(tokenPubkey) { priceCache[tokenPubkey.toString()] = price } else { - console.log(res) + sdk.log(res) } - //console.log('lp ' + tokenAddress + '\' price is ' + price.toFixed(3)) return price } async function getTokenPrice(tokenPubkey) { - //console.log('getTokenPrice(' + tokenPubkey.toString() + ')') if (priceCache[tokenPubkey.toString()]) return priceCache[tokenPubkey.toString()] @@ -120,7 +118,6 @@ async function getTokenPrice(tokenPubkey) { } async function getHeroPrice() { - //console.log('getHeroPrice') if (priceCache['Hero6s7zJXsw9hfCXLVR5stLqgCok3E7CCkpQEoLAk2g']) return priceCache['Hero6s7zJXsw9hfCXLVR5stLqgCok3E7CCkpQEoLAk2g'] @@ -192,7 +189,7 @@ async function staking() { var tvl = new BigNumber(0) - var solPrice = await getTokenPrice('So11111111111111111111111111111111111111112') + var solPrice = await getTokenPrice(ADDRESSES.solana.SOL) var amounts = [] @@ -241,7 +238,7 @@ async function farmPool() { var tvl = new BigNumber(0) - var solPrice = await getTokenPrice('So11111111111111111111111111111111111111112') + var solPrice = await getTokenPrice(ADDRESSES.solana.SOL) var amounts = [] @@ -287,7 +284,7 @@ async function lpTvl() { var tvl = new BigNumber(0) - var solPrice = await getTokenPrice('So11111111111111111111111111111111111111112') + var solPrice = await getTokenPrice(ADDRESSES.solana.SOL) var lpTvl = await getHeroLp() lpTvl = lpTvl.div(solPrice) diff --git a/projects/solid-world/abi.json b/projects/solid-world/abi.json new file mode 100644 index 00000000000..5b52c1fc79a --- /dev/null +++ b/projects/solid-world/abi.json @@ -0,0 +1,7 @@ +{ + "getTotalAmounts": "function getTotalAmounts() external view returns (uint256 total0, uint256 total1)", + "totalSupply": "uint256:totalSupply", + "balanceOf": "erc20:balanceOf", + "token0": "address:token0", + "token1": "address:token1" +} diff --git a/projects/solid-world/config.js b/projects/solid-world/config.js new file mode 100644 index 00000000000..f1b5182f65a --- /dev/null +++ b/projects/solid-world/config.js @@ -0,0 +1,15 @@ +const config = { + polygon: { + pools: [ + { + crispToken: "0xEF6Ab48ef8dFe984FAB0d5c4cD6AFF2E54dfdA14", + hypervisor: "0x4a39cBb8198376AB08c24e596fF5E668c3ca269E", + stakingContract: "0xaD7Ce5Cf8E594e1EFC6922Ab2c9F81d7a0E14337" + } + ] + } +}; + +module.exports = { + config +}; diff --git a/projects/solid-world/index.js b/projects/solid-world/index.js new file mode 100644 index 00000000000..7694ec1fb4a --- /dev/null +++ b/projects/solid-world/index.js @@ -0,0 +1,65 @@ +const sdk = require("@defillama/sdk"); +const BigNumber = require("bignumber.js"); +const { config } = require("./config"); +const abi = require("./abi.json"); + +async function tvl(timestamp, ethBlock, _, { api }) { + const chainConfig = config[api.chain]; + const crispSupplies = await api.multiCall({ + calls: chainConfig.pools.map(pool => pool.crispToken), + abi: abi.totalSupply + }); + + const TVL = {}; + chainConfig.pools.forEach(({ crispToken }, i) => { + sdk.util.sumSingleBalance(TVL, crispToken, crispSupplies[i], api.chain); + }); + + return TVL; +} + +async function pool2(timestamp, ethBlock, _, { api }) { + const chainConfig = config[api.chain]; + const [token0s, token1s, totalAmounts, totalSupplies, stakedAmounts] = await Promise.all([ + api.multiCall({ calls: chainConfig.pools.map(pool => pool.hypervisor), abi: abi.token0 }), + api.multiCall({ calls: chainConfig.pools.map(pool => pool.hypervisor), abi: abi.token1 }), + api.multiCall({ calls: chainConfig.pools.map(pool => pool.hypervisor), abi: abi.getTotalAmounts }), + api.multiCall({ calls: chainConfig.pools.map(pool => pool.hypervisor), abi: abi.totalSupply }), + api.multiCall({ + calls: chainConfig.pools.map(pool => ({ + target: pool.hypervisor, + params: [pool.stakingContract] + })), abi: abi.balanceOf + }) + ]); + + // zip the results + const poolStats = chainConfig.pools.map((_, i) => ({ + token0: token0s[i], + token1: token1s[i], + totalAmount: totalAmounts[i], + totalSupply: totalSupplies[i], + stakedAmount: stakedAmounts[i] + })); + + const TVL = {}; + poolStats.forEach((e) => { + sdk.util.sumSingleBalance(TVL, e.token0, adjustAmount(e.totalAmount.total0, e.stakedAmount, e.totalSupply), api.chain); + sdk.util.sumSingleBalance(TVL, e.token1, adjustAmount(e.totalAmount.total1, e.stakedAmount, e.totalSupply), api.chain); + }); + + return TVL; +} + +function adjustAmount(amount, numerator, denominator) { + return BigNumber(amount).times(numerator).div(denominator).toFixed(0); +} + +module.exports = { + start: 1684477800, // Fri May 19 2023 06:30:00 GMT+0000 + methodology: "TVL is a measure of the health of the Solid World ecosystem. It's the total amount of value that is locked up in our staking contract, and it's calculated by adding up the value of all the LP tokens that are staked. The LP tokens represent the amount of liquidity that has been provided to the Solid World platform.", + polygon: { + tvl, + pool2 + } +}; diff --git a/projects/solidex/abis.json b/projects/solidex/abis.json index 2e42d9a3221..daaeb12cc9c 100644 --- a/projects/solidex/abis.json +++ b/projects/solidex/abis.json @@ -1,95 +1,7 @@ { - "tokens": { - "inputs": [], - "name": "tokens", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "locked": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "locked", - "outputs": [ - { - "internalType": "int128", - "name": "amount", - "type": "int128" - }, - { - "internalType": "uint256", - "name": "end", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "totalBalances": { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "totalBalances", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "allPairsLength": { - "inputs": [], - "name": "allPairsLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "allPairs": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "allPairs", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } + "tokens": "function tokens() view returns (address, address)", + "locked": "function locked(uint256) view returns (int128 amount, uint256 end)", + "totalBalances": "function totalBalances(address) view returns (uint256)", + "allPairsLength": "uint256:allPairsLength", + "allPairs": "function allPairs(uint256) view returns (address)" } \ No newline at end of file diff --git a/projects/solidex/index.js b/projects/solidex/index.js index 9d61a12d592..40e4d55b2a8 100644 --- a/projects/solidex/index.js +++ b/projects/solidex/index.js @@ -39,12 +39,12 @@ async function tvl(timestamp, block, chainBlocks) { for (let i = 0; i < pairTokens.length; i++) { const owner = pairTokens[i].input.target; (pairTokens[i].output || []).forEach(token => tokensAndOwners.push([token, owner])) - }; + } await sumTokens(balances, tokensAndOwners, chainBlocks.fantom, 'fantom',); return balances; -}; +} async function staking(ts, _block, chainBlocks) { const balances = {}; diff --git a/projects/solidlizard/index.js b/projects/solidlizard/index.js new file mode 100644 index 00000000000..bdcfb7f7bf6 --- /dev/null +++ b/projects/solidlizard/index.js @@ -0,0 +1,12 @@ +const { getUniTVL } = require('../helper/unknownTokens.js') + +module.exports = { + misrepresentedTokens: true, + arbitrum:{ + tvl: getUniTVL({ + useDefaultCoreAssets: true, + hasStablePools: true, + factory: '0x734d84631f00dC0d3FCD18b04b6cf42BFd407074', + }), + }, +} diff --git a/projects/solidly-v2/index.js b/projects/solidly-v2/index.js new file mode 100644 index 00000000000..af379ff2152 --- /dev/null +++ b/projects/solidly-v2/index.js @@ -0,0 +1,9 @@ +const { uniTvlExport } = require("../helper/calculateUniTvl.js"); +const { staking } = require('../helper/staking'); + +module.exports = { + ethereum: { + tvl: uniTvlExport("0x777de5Fe8117cAAA7B44f396E93a401Cf5c9D4d6", "ethereum", undefined, undefined, { hasStablePools: true, useDefaultCoreAssets: false, }), + staking: staking("0x77730ed992D286c53F3A0838232c3957dAeaaF73", "0x777172D858dC1599914a1C4c6c9fC48c99a60990","ethereum"), + }, +}; diff --git a/projects/solidly/index.js b/projects/solidly/index.js index 612f6cf3dc0..b5b10020ba6 100644 --- a/projects/solidly/index.js +++ b/projects/solidly/index.js @@ -1,7 +1,8 @@ const { uniTvlExport } = require('../helper/calculateUniTvl.js') module.exports = { + misrepresentedTokens: true, fantom: { - tvl: uniTvlExport("0x3fAaB499b519fdC5819e3D7ed0C26111904cbc28", "fantom"), + tvl: uniTvlExport("0x3fAaB499b519fdC5819e3D7ed0C26111904cbc28", "fantom", undefined, undefined, { useDefaultCoreAssets: true, hasStablePools: true, }), }, } \ No newline at end of file diff --git a/projects/solisnek/index.js b/projects/solisnek/index.js new file mode 100644 index 00000000000..26537b5710d --- /dev/null +++ b/projects/solisnek/index.js @@ -0,0 +1,9 @@ +const { getUniTVL } = require("../helper/unknownTokens"); +const { staking } = require('../helper/staking'); + +module.exports = { + misrepresentedTokens: true, + avax: { + tvl: getUniTVL({ factory: '0xeeee1F1c93836B2CAf8B9E929cb978c35d46657E', useDefaultCoreAssets: true, hasStablePools: true, stablePoolSymbol: 'ssAMM' }), + }, +}; diff --git a/projects/solo/abi.json b/projects/solo/abi.json index 888de8092fe..eb81522c676 100644 --- a/projects/solo/abi.json +++ b/projects/solo/abi.json @@ -1,20 +1,3 @@ { - "getGlobalStatistics": { - "inputs": [], - "name": "getGlobalStatistics", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -} + "getGlobalStatistics": "function getGlobalStatistics() view returns (uint256, uint256)" +} \ No newline at end of file diff --git a/projects/solo/index.js b/projects/solo/index.js index 1b0df6dfaa3..586f6db2378 100644 --- a/projects/solo/index.js +++ b/projects/solo/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk'); const BigNumber = require("bignumber.js") const abi = require('./abi.json'); @@ -13,10 +14,10 @@ const VAULT_BSC = "0x7033A512639119C759A51b250BfA461AE100894b" const VAULT_POLYGON = "0xE95876787B055f1b9E4cfd5d3e32BDe302BF789d" const VAULT_OEC = "0xa8AF3199aCE72E47c1DEb56E58BEA1CD41C37c22" -const USDT_HECO = "0xa71EdC38d189767582C38A3145b5873052c3e47a" -const USDT_BSC = "0x55d398326f99059fF775485246999027B3197955" -const USDT_POLYGON = "0xc2132D05D31c914a87C6611C10748AEb04B58e8F" -const USDT_OEC = "0x382bB369d343125BfB2117af9c149795C6C65C50" +const USDT_HECO = ADDRESSES.heco.USDT +const USDT_BSC = ADDRESSES.bsc.USDT +const USDT_POLYGON = ADDRESSES.polygon.USDT +const USDT_OEC = ADDRESSES.okexchain.USDT const tvlHeco = async (timestamp, blockETH, chainBlocks) => { let block = chainBlocks[CHAIN_HECO]; diff --git a/projects/soluna/index.js b/projects/soluna/index.js index fa1acf2bd85..3d913ed08d7 100644 --- a/projects/soluna/index.js +++ b/projects/soluna/index.js @@ -1,11 +1,7 @@ -const { sumSingleBalance, TOKEN_LIST, getBalance, } = require('../helper/chain/terra') +const { sumTokens, } = require('../helper/chain/cosmos') async function tvl(timestamp, ethBlock, { terra: block }) { - const balances = {} - const aUSTBalance = await getBalance(TOKEN_LIST.anchorust, 'terra1aug2pyftq4e85kq5590ud30yswnewa42n9fmr8', block) - sumSingleBalance(balances, TOKEN_LIST.anchorust, aUSTBalance) - - return balances + return sumTokens({ owner: 'terra1qwzdua7928ugklpytdzhua92gnkxp9z4vhelq8', chain: 'terra'}) } module.exports = { diff --git a/projects/solunea/index.js b/projects/solunea/index.js new file mode 100644 index 00000000000..91cc9da46a3 --- /dev/null +++ b/projects/solunea/index.js @@ -0,0 +1,19 @@ +const { getUniTVL } = require('../helper/unknownTokens.js') + +module.exports = { + misrepresentedTokens: true, + era: { + tvl: getUniTVL({ + factory: '0x5892Dc61d3f243Fa397197BaBC3Bb709Af4a0787', + useDefaultCoreAssets: true, + hasStablePools: true, + }) + }, + arbitrum: { + tvl: getUniTVL({ + factory: '0x6ef065573cd3fff4c375d4d36e6ca93cd6e3d499', + useDefaultCoreAssets: true, + hasStablePools: true, + }) + }, +} diff --git a/projects/solv-protocol-v3/abi.json b/projects/solv-protocol-v3/abi.json new file mode 100644 index 00000000000..a7d28aec895 --- /dev/null +++ b/projects/solv-protocol-v3/abi.json @@ -0,0 +1,7 @@ +{ + "concrete": "address:concrete", + "slotTotalValue": "function slotTotalValue(uint256 slot_) view returns (uint256)", + "slotBaseInfo": "function slotBaseInfo(uint256 slot_) view returns (tuple(address issuer, address currency, uint64 valueDate, uint64 maturity, uint64 createTime, bool transferable, bool isValid))", + "decimals": "uint8:decimals", + "balanceOf": "function balanceOf(address _owner) view returns (uint256 balance)" +} \ No newline at end of file diff --git a/projects/solv-protocol-v3/index.js b/projects/solv-protocol-v3/index.js new file mode 100644 index 00000000000..81ec0c49507 --- /dev/null +++ b/projects/solv-protocol-v3/index.js @@ -0,0 +1,100 @@ +const { default: BigNumber } = require("bignumber.js"); +const abi = require("./abi.json"); +const { cachedGraphQuery } = require("../helper/cache"); + +// The Graph +const graphUrlList = { + ethereum: 'https://api.studio.thegraph.com/query/40045/solv-payable-factory-prod/version/latest', + bsc: 'https://api.thegraph.com/subgraphs/name/slov-payable/solv-v3-earn-factory', + arbitrum: 'https://api.studio.thegraph.com/query/40045/solv-payable-factory-arbitrum/version/latest', +} + +const filterSlot = [ + "24463698369598535545979799361840946803505909684060624549876546521811809090281", + "35721610559268442584760110830641808857798079704888818123868248602816498531758", + "71384167217207433357665203528199852676074195415546219658272700694805764131696", + "94855382073997775269187449187472275689000980913702165029893305070390069014119" +]; + +async function tvl() { + const { api } = arguments[3]; + const network = api.chain; + const slots = await getSlot(api.timestamp, network); + if (slots.length <= 0) { + return; + } + const concretes = await concrete(slots, api); + + const totalValues = await api.multiCall({ + abi: abi.slotTotalValue, + calls: slots.map((index) => ({ + target: concretes[index.contractAddress], + params: [index.slot] + })), + }) + + const baseInfos = await api.multiCall({ + abi: abi.slotBaseInfo, + calls: slots.map((index) => ({ + target: concretes[index.contractAddress], + params: [index.slot] + })), + }) + + const decimalList = await api.multiCall({ + abi: abi.decimals, + calls: baseInfos.map(i => i[1]), + }) + + for (let i = 0; i < totalValues.length; i++) { + const decimals = decimalList[i]; + const balance = BigNumber(totalValues[i]).div(BigNumber(10).pow(18 - decimals)).toNumber(); + api.add(baseInfos[i][1], balance) + } +} + +async function concrete(slots, api) { + var slotsList = []; + var only = {}; + for (var i = 0; i < slots.length; i++) { + if (!only[slots[i].contractAddress]) { + slotsList.push(slots[i]); + only[slots[i].contractAddress] = true; + } + } + + const concreteLists = await api.multiCall({ + calls: slotsList.map((index) => index.contractAddress), + abi: abi.concrete, + }) + + let concretes = {}; + for (var k = 0; k < concreteLists.length; k++) { + concretes[slotsList[k].contractAddress] = concreteLists[k]; + } + + return concretes; +} + + +async function getSlot(timestamp, chain) { + const slotDataQuery = `query BondSlotInfos { + bondSlotInfos(first: 1000, where:{maturity_gt:${timestamp}}) { + contractAddress + slot + } + }`; + const slots = (await cachedGraphQuery(`solv-protocol/graph-data/${chain}`, graphUrlList[chain], slotDataQuery)).bondSlotInfos; + let slotList = []; + for (let i = 0; i < slots.length; i++) { + const bondSlotInfo = slots[i]; + if (filterSlot.indexOf(bondSlotInfo.slot) == -1) { + slotList.push(bondSlotInfo) + } + } + return slotList; +} + +['ethereum', 'bsc', 'arbitrum'].forEach(chain => { + module.exports[chain] = { tvl } +}) \ No newline at end of file diff --git a/projects/solv-protocol/index.js b/projects/solv-protocol/index.js index 601ce679959..a03f135fecc 100644 --- a/projects/solv-protocol/index.js +++ b/projects/solv-protocol/index.js @@ -1,84 +1,36 @@ -const { sumTokens, } = require('../helper/unwrapLPs') -const axios = require('axios') -const { staking } = require('../helper/staking'); -const { getChainTransform } = require("../helper/portedTokens"); +const { getConfig } = require("../helper/cache"); +const { sumTokens2 } = require("../helper/unwrapLPs"); // token list const tokenListsApiEndpoint = "https://token-list.solv.finance/vouchers-prod.json" -// Staking Tvls -const solvEthereumTokenAddress = '0x256F2d67e52fE834726D2DDCD8413654F5Eb8b53' -const solvEthereumPoolAddress = '0x7D0C93DcAD6f6B38C81431d7262CF0E48770B81a' -const solvBscTokenAddress = '0xC073c4eD65622A9423b5e5BDe2BFC8B81EBC471c' -const solvBscPoolAddress = '0xE5742912EDb4599779ACC1CE2acB6a06E01f1089' -const ethereumTVL = async (timestamp, block, chainBlocks) => { - const transform = await getChainTransform('ethereum'); - return tvl(timestamp, block, chainBlocks, "ethereum", 1, transform); -} - -const polygonTVL = async (timestamp, block, chainBlocks) => { - const transform = await getChainTransform('polygon'); - return tvl(timestamp, block, chainBlocks, "polygon", 137, transform); -} - -const arbitrumTVL = async (timestamp, block, chainBlocks) => { - const transform = await getChainTransform('arbitrum'); - return tvl(timestamp, block, chainBlocks, "arbitrum", 42161, transform); -}; - -const bscTVL = async (timestamp, block, chainBlocks) => { - const transform = await getChainTransform('bsc'); - return tvl(timestamp, block, chainBlocks, "bsc", 56, transform); -}; - -async function tvl(timestamp, block, chainBlocks, network, chainId, transform) { - let balances = {}; // Setup the balances object - const tokens = await tokenList(chainId); - let tokenPairs = [] - for (let i = 0; i < tokens.length; i++) { - const token = tokens[i]; - tokenPairs.push([ - token.address, - token.pool - ]) - } - - await sumTokens(balances, tokenPairs, chainBlocks[network], network, transform) - - return balances; +async function tvl() { + const { api } = arguments[3] + const chainId = api.getChainId() + const tokens = await tokenList(chainId); + await sumTokens2({ api, tokensAndOwners: tokens.map(i => [i.address, i.pool]), permitFailure: true }) } async function tokenList(chainId) { - let tokens = []; - const allTokens = (await axios.get(tokenListsApiEndpoint)).data.tokens; - for (let token of allTokens) { - if (chainId == token.chainId) { - if (token.extensions.voucher.underlyingToken && token.extensions.voucher.underlyingToken.symbol != "SOLV") { - tokens.push({ - address: token.extensions.voucher.underlyingToken.address, - pool: token.extensions.voucher.vestingPool - }) - } + let tokens = []; + const allTokens = (await getConfig('solv-protocol', tokenListsApiEndpoint)).tokens; + for (let token of allTokens) { + if (chainId == token.chainId) { + if (token.extensions.voucher.underlyingToken != undefined) { + if (token.extensions.voucher.underlyingToken.symbol != "SOLV" && token.extensions.voucher.underlyingToken.symbol.indexOf("_") == -1) { + tokens.push({ + address: token.extensions.voucher.underlyingToken.address, + pool: token.extensions.voucher.vestingPool + }) } + } } + } - return tokens; -} -// node test.js projects/solv-protocol/index.js -module.exports = { - ethereum: { - tvl: ethereumTVL, - staking: staking(solvEthereumPoolAddress, solvEthereumTokenAddress) - }, - bsc: { - tvl: bscTVL, - staking: staking(solvBscPoolAddress, solvBscTokenAddress, "bsc") - }, - polygon: { - tvl: polygonTVL - }, - arbitrum: { - tvl: arbitrumTVL - } + return tokens; } + +['ethereum', 'bsc', 'polygon', 'arbitrum'].forEach(chain => { + module.exports[chain] = { tvl } +}) \ No newline at end of file diff --git a/projects/sommelier/cellar-v0-8-15.json b/projects/sommelier/cellar-v0-8-15.json index 8c4e511c0ab..e6684c5a252 100644 --- a/projects/sommelier/cellar-v0-8-15.json +++ b/projects/sommelier/cellar-v0-8-15.json @@ -1,67 +1,7 @@ { - "asset": { - "inputs": [], - "name": "asset", - "outputs": [ - { - "internalType": "contract ERC20", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "totalAssets": { - "inputs": [], - "name": "totalAssets", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "totalHoldings": { - "inputs": [], - "name": "totalHoldings", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "totalLocked": { - "inputs": [], - "name": "totalLocked", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "maxLocked": { - "inputs": [], - "name": "maxLocked", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -} + "asset": "address:asset", + "totalAssets": "uint256:totalAssets", + "totalHoldings": "uint256:totalHoldings", + "totalLocked": "uint256:totalLocked", + "maxLocked": "uint256:maxLocked" +} \ No newline at end of file diff --git a/projects/sommelier/cellar-v0-8-16.json b/projects/sommelier/cellar-v0-8-16.json index 431850a1fb5..ff129808355 100644 --- a/projects/sommelier/cellar-v0-8-16.json +++ b/projects/sommelier/cellar-v0-8-16.json @@ -1,41 +1,5 @@ { - "holdingPosition": { - "inputs": [], - "name": "holdingPosition", - "outputs": [ - { - "internalType": "contract ERC20", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getPositions": { - "inputs": [], - "name": "getPositions", - "outputs": [ - { - "internalType": "address[]", - "name": "", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - "totalAssets": { - "inputs": [], - "name": "totalAssets", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -} + "holdingPosition": "address:holdingPosition", + "getPositions": "address[]:getPositions", + "totalAssets": "uint256:totalAssets" +} \ No newline at end of file diff --git a/projects/sommelier/index.js b/projects/sommelier/index.js index 8e75c98e1ab..a263c6bd29a 100644 --- a/projects/sommelier/index.js +++ b/projects/sommelier/index.js @@ -1,5 +1,6 @@ const v0815 = require("./v0-8-15"); const v0816 = require("./v0-8-16"); +const v2 = require("./v2"); const chain = "ethereum"; // v0.8.15 Cellars (Cellar 1.0) @@ -11,14 +12,43 @@ const ETH_BTC_TREND = "0x6b7f87279982d919bbf85182ddeab179b366d8f2"; const ETH_BTC_MOM = "0x6e2dac3b9e9adc0cbbae2d0b9fd81952a8d33872"; const STEADY_ETH = "0x3f07a84ecdf494310d397d24c1c78b041d2fa622"; const STEADY_BTC = "0x4986fd36b6b16f49b43282ee2e24c5cf90ed166d"; +const STEADY_UNI = "0x6f069f711281618467dae7873541ecc082761b33"; +const STEADY_MATIC = "0x05641a27c82799aaf22b436f20a3110410f29652"; const cellarsV0816 = [ { id: ETH_BTC_TREND, startBlock: 15733768 }, { id: ETH_BTC_MOM, startBlock: 15733768 }, { id: STEADY_ETH, startBlock: 15991609 }, { id: STEADY_BTC, startBlock: 15991609 }, + { id: STEADY_UNI, startBlock: 16192732 }, + { id: STEADY_MATIC, startBlock: 16192732 }, ]; -async function tvl(timestamp, block, chainBlocks) { +// v2 Cellars +const DEFI_STARS = "0x03df2a53cbed19b824347d6a45d09016c2d1676a"; +const REAL_YIELD_USD = "0x97e6e0a40a3d02f12d1cec30ebfbae04e37c119e"; +const REAL_YIELD_ETH = "0xb5b29320d2dde5ba5bafa1ebcd270052070483ec"; +const REAL_YIELD_LINK = "0x4068bdd217a45f8f668ef19f1e3a1f043e4c4934"; +const REAL_YIELD_1INCH = "0xc7b69e15d86c5c1581dacce3cacaf5b68cd6596f"; +const REAL_YIELD_UNI = "0x6a6af5393dc23d7e3db28d28ef422db7c40932b6"; +const REAL_YIELD_SNX = "0xcbf2250f33c4161e18d4a2fa47464520af5216b5"; +const REAL_YIELD_ENS = "0x18ea937aba6053bc232d9ae2c42abe7a8a2be440"; +const REAL_YIELD_BTC = "0x0274a704a6d9129f90a62ddc6f6024b33ecdad36"; +const FRAXIMAL = "0xdbe19d1c3f21b1bb250ca7bdae0687a97b5f77e6"; + +const cellarsV2 = [ + { id: DEFI_STARS, startBlock: 17181497 }, + { id: REAL_YIELD_USD, startBlock: 16431804 }, + { id: REAL_YIELD_ETH, startBlock: 16986127 }, + { id: REAL_YIELD_LINK, startBlock: 17377190 }, + { id: REAL_YIELD_1INCH, startBlock: 17377190 }, + { id: REAL_YIELD_UNI, startBlock: 17377190 }, + { id: REAL_YIELD_SNX, startBlock: 17377190 }, + { id: REAL_YIELD_ENS, startBlock: 17377190 }, + { id: REAL_YIELD_BTC, startBlock: 17667535 }, + { id: FRAXIMAL, startBlock: 17589948 }, +]; + +async function tvl(timestamp, block, chainBlocks, { api }) { const balances = {}; const baseOptions = { balances, chainBlocks }; @@ -34,6 +64,12 @@ async function tvl(timestamp, block, chainBlocks) { cellars: filterActiveCellars(cellarsV0816, block), }); + await v2.sumTvl({ + ...baseOptions, + api, + cellars: filterActiveCellars(cellarsV2, block), + }); + return balances; } @@ -55,5 +91,7 @@ module.exports = { [1658419200, "aave2 Cellar Launch"], [1666886400, "ETH-BTC Trend & Momentum Cellars Launch"], [1669741200, "Steady ETH & BTC Cellars Launch"], + [1674671068, "Real Yield USD Cellar Launch"], + [1681233049, "Real Yield ETH Cellar Launch"], ], }; diff --git a/projects/sommelier/utils.js b/projects/sommelier/utils.js deleted file mode 100644 index 6dd7d8a911f..00000000000 --- a/projects/sommelier/utils.js +++ /dev/null @@ -1,10 +0,0 @@ -// Flattens a nested array with a depth of 1 -function flattenOnce(array) { - return array.reduce((memo, el) => { - return [...memo, ...el]; - }, []); -} - -module.exports = { - flattenOnce, -}; diff --git a/projects/sommelier/v0-8-16.js b/projects/sommelier/v0-8-16.js index f8e91abc718..795cc548cf0 100644 --- a/projects/sommelier/v0-8-16.js +++ b/projects/sommelier/v0-8-16.js @@ -1,6 +1,5 @@ const sdk = require("@defillama/sdk"); const abiCellarV0816 = require("./cellar-v0-8-16.json"); -const { flattenOnce } = require("./utils"); const chain = "ethereum"; @@ -19,7 +18,7 @@ async function sumTvl(options) { let balanceCalls = await Promise.all( cellars.map((cellar) => getCellarBalanceCalls(cellar, options)) ); - balanceCalls = flattenOnce(balanceCalls); + balanceCalls = balanceCalls.flat(); // Call balanceOf for all positions across all Cellars using multicall const balanceResult = await sdk.api.abi.multiCall({ diff --git a/projects/sommelier/v2.js b/projects/sommelier/v2.js new file mode 100644 index 00000000000..378edee614d --- /dev/null +++ b/projects/sommelier/v2.js @@ -0,0 +1,12 @@ +const sdk = require("@defillama/sdk"); + +async function sumTvl({ balances, cellars, api }) { + const assets = await api.multiCall({ abi: "address:asset", calls: cellars}) + const bals = await api.multiCall({ abi: "uint256:totalAssets", calls: cellars}) + assets.forEach((a, i) => sdk.util.sumSingleBalance(balances,a,bals[i], api.chain)) + return balances +} + +module.exports = { + sumTvl, +}; diff --git a/projects/sonne-finance/index.js b/projects/sonne-finance/index.js index 9210e693e3d..5189ffe4b28 100644 --- a/projects/sonne-finance/index.js +++ b/projects/sonne-finance/index.js @@ -1,10 +1,19 @@ -const { compoundExports } = require('../helper/compound') +const { compoundExports } = require("../helper/compound"); +const { staking } = require("../helper/staking"); -const soWETH = "0xf7B5965f5C117Eb1B5450187c9DcFccc3C317e8E" -const unitroller = "0x60CF091cD3f50420d50fD7f707414d0DF4751C58" -const opWETH = "0x4200000000000000000000000000000000000006" +const unitroller = "0x60CF091cD3f50420d50fD7f707414d0DF4751C58"; module.exports = { - methodology: "Same as Compound Finance, we just count all the tokens supplied (not borrowed money) on the lending markets", - optimism: compoundExports(unitroller, "optimism", soWETH, opWETH), -} + methodology: + "Same as Compound Finance, we just count all the tokens supplied (not borrowed money) on the lending markets", + optimism: { + ...compoundExports(unitroller, "optimism"), + staking: staking( + [ + "0xdc05d85069dc4aba65954008ff99f2d73ff12618", + "0x41279e29586eb20f9a4f65e031af09fced171166", + ], + "0x1DB2466d9F5e10D7090E7152B68d62703a2245F0" + ), + }, +}; diff --git a/projects/sorbetfinance/abi.json b/projects/sorbetfinance/abi.json index 34228c193aa..a3f879f2f9a 100644 --- a/projects/sorbetfinance/abi.json +++ b/projects/sorbetfinance/abi.json @@ -1,78 +1,7 @@ { - "getDeployers": { - "inputs": [], - "name": "getDeployers", - "outputs": [ - { - "internalType": "address[]", - "name": "", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getPools": { - "inputs": [ - { - "internalType": "address", - "name": "deployer", - "type": "address" - } - ], - "name": "getPools", - "outputs": [ - { - "internalType": "address[]", - "name": "", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - "token0": { - "inputs": [], - "name": "token0", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "token1": { - "inputs": [], - "name": "token1", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getUnderlyingBalances": { - "inputs": [], - "name": "getUnderlyingBalances", - "outputs": [ - { - "internalType": "uint256", - "name": "amount0Current", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "amount1Current", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } + "getDeployers": "address[]:getDeployers", + "getPools": "function getPools(address deployer) view returns (address[])", + "token0": "address:token0", + "token1": "address:token1", + "getUnderlyingBalances": "function getUnderlyingBalances() view returns (uint256 amount0Current, uint256 amount1Current)" } \ No newline at end of file diff --git a/projects/sorbetfinance/index.js b/projects/sorbetfinance/index.js index 5d4f7e1584d..a6e0f7ee335 100644 --- a/projects/sorbetfinance/index.js +++ b/projects/sorbetfinance/index.js @@ -70,6 +70,7 @@ const chainTvl = (chain, G_UNI_Factory) => async (timestamp, ethBlock, chainBloc }; module.exports = { + doublecounted: true, ethereum: { tvl: chainTvl("ethereum", "0xEA1aFf9dbFfD1580F6b81A3ad3589E66652dB7D9"), }, @@ -81,4 +82,8 @@ module.exports = { }, methodology: "Counts TVL that's on all the Pools through G-UNI Factory Contract", + hallmarks:[ + [1632253540, "GUNI-DAIUSDC Added to Maker"], + [1643056020, "Maker GUNI Cap to 500M"], + ], }; diff --git a/projects/sorbetto/abi.json b/projects/sorbetto/abi.json deleted file mode 100644 index 35a038ab025..00000000000 --- a/projects/sorbetto/abi.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "token0": { - "inputs": [], - "name": "token0", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "token0PerShareStored": { - "inputs": [], - "name": "token0PerShareStored", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "token1": { - "inputs": [], - "name": "token1", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "token1PerShareStored": { - "inputs": [], - "name": "token1PerShareStored", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -} \ No newline at end of file diff --git a/projects/sorbetto/index.js b/projects/sorbetto/index.js deleted file mode 100644 index c0bead705df..00000000000 --- a/projects/sorbetto/index.js +++ /dev/null @@ -1,30 +0,0 @@ -const sdk = require('@defillama/sdk') -const utils = require('../helper/utils') -const abi = require('./abi.json'); -const BigNumber = require('bignumber.js') - -const addressAPI = "https://analytics.back.popsicle.finance/api/v1/FragolaApy" - -async function tvl(timestamp, ethBlock) { - const addresses = (await utils.fetchURL(addressAPI)).data.map(t => t.fragolaAddress) - const balances = {} - const [token0, token1, token0PerShareStored, token1PerShareStored, totalSupply] = await Promise.all( - ["token0", "token1", "token0PerShareStored", "token1PerShareStored"] - .map(method => abi[method]).concat(['erc20:totalSupply']).map(abi => sdk.api.abi.multiCall({ - abi, - calls: addresses.map(a => ({ target: a })), - block: ethBlock - })) - ) - for (let i = 0; i < addresses.length; i++) { - sdk.util.sumSingleBalance(balances, token0.output[i].output, BigNumber(token0PerShareStored.output[i].output).times(totalSupply.output[i].output).div(1e18).toFixed(0)) - sdk.util.sumSingleBalance(balances, token1.output[i].output, BigNumber(token1PerShareStored.output[i].output).times(totalSupply.output[i].output).div(1e18).toFixed(0)) - } - return balances -} - -module.exports = { - ethereum: { - tvl - }, -} \ No newline at end of file diff --git a/projects/soulswap/abis/factory.json b/projects/soulswap/abis/factory.json index f38a969b6a8..9a147cdfb8a 100644 --- a/projects/soulswap/abis/factory.json +++ b/projects/soulswap/abis/factory.json @@ -1,20 +1,4 @@ { - "allPairs": { - "constant": true, - "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "name": "allPairs", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "totalPairs": { - "constant": true, - "inputs": [], - "name": "totalPairs", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - } -} + "allPairs": "function allPairs(uint256) view returns (address)", + "totalPairs": "uint256:totalPairs" +} \ No newline at end of file diff --git a/projects/soulswap/abis/getReserves.json b/projects/soulswap/abis/getReserves.json deleted file mode 100644 index e3f6fcc11d8..00000000000 --- a/projects/soulswap/abis/getReserves.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "constant": true, - "inputs": [], - "name": "getReserves", - "outputs": [ - { - "internalType": "uint112", - "name": "_reserve0", - "type": "uint112" - }, - { - "internalType": "uint112", - "name": "_reserve1", - "type": "uint112" - }, - { - "internalType": "uint32", - "name": "_blockTimestampLast", - "type": "uint32" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" -} diff --git a/projects/soulswap/abis/token0.json b/projects/soulswap/abis/token0.json deleted file mode 100644 index eefbeb998a3..00000000000 --- a/projects/soulswap/abis/token0.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "constant": true, - "inputs": [], - "name": "token0", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" -} diff --git a/projects/soulswap/abis/token1.json b/projects/soulswap/abis/token1.json deleted file mode 100644 index cccef25f486..00000000000 --- a/projects/soulswap/abis/token1.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "constant": true, - "inputs": [], - "name": "token1", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" -} diff --git a/projects/soulswap/helper/getUsdSoulTvl.js b/projects/soulswap/helper/getUsdSoulTvl.js index 5e3d66d1ad1..a6d888b7d14 100644 --- a/projects/soulswap/helper/getUsdSoulTvl.js +++ b/projects/soulswap/helper/getUsdSoulTvl.js @@ -1,8 +1,7 @@ -const BigNumber = require('bignumber.js'); const sdk = require('@defillama/sdk'); -const token0 = require('../abis/token0.json'); -const token1 = require('../abis/token1.json'); -const getReserves = require('../abis/getReserves.json'); +const token0 = 'address:token0' +const token1 = 'address:token1' +const getReserves = 'function getReserves() view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast)' const factoryAbi = require('../abis/factory.json'); async function requery(results, chain, block, abi) { @@ -165,7 +164,7 @@ function calculateUsdSoulTvl(FACTORY, chain, coreAssetRaw, whitelistRaw, coreAss [coreAssetName]: (coreBalance) / (10 ** decimals) } } -}; +} module.exports = { calculateUsdSoulTvl, diff --git a/projects/soulswap/index.js b/projects/soulswap/index.js index 2ec11bd38ef..c4f86c5b246 100644 --- a/projects/soulswap/index.js +++ b/projects/soulswap/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { calculateUsdSoulTvl } = require('./helper/getUsdSoulTvl.js') const { staking } = require('../helper/staking.js'); const { underworldLending } = require('./underworld-lending.js') @@ -5,18 +6,18 @@ const { underworldLending } = require('./underworld-lending.js') const factory_fantom = '0x1120e150dA9def6Fe930f4fEDeD18ef57c0CA7eF' const farm_fantom = '0xb898226dE3c5ca980381fE85F2Bc10e35e00634c' const soul_fantom = '0xe2fb177009ff39f52c0134e8007fa0e4baacbd07' -const wftm_fantom = '0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83' +const wftm_fantom = ADDRESSES.fantom.WFTM const rndm_fantom = '0x49ac072c793fb9523f0688a0d863aadfbfb5d475' -const usdc_fantom = '0x04068da6c83afcfa0e13ba15a6696662335d5b75' +const usdc_fantom = ADDRESSES.fantom.USDC const wbtc_fantom = '0x321162cd933e2be498cd2267a90534a804051b11' const factory_avax = '0x5BB2a9984de4a69c05c996F7EF09597Ac8c9D63a' const farm_avax = '0xB1e330401c920077Ddf157AbA5594238d36b54B1' const soul_avax = '0x11d6DD25c1695764e64F439E32cc7746f3945543' -const wavax_avax = '0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7' -const usdc_avax = '0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E' +const wavax_avax = ADDRESSES.avax.WAVAX +const usdc_avax = ADDRESSES.avax.USDC const wbtc_avax = '0x50b7545627a5162F82A992c33b87aDc75187B218' -const weth_avax = '0x49D5c2BdFfac6CE2BFdB6640F4F80f226bc10bAB' +const weth_avax = ADDRESSES.avax.WETH_e const wl_fantom = [ usdc_fantom, soul_fantom, rndm_fantom, wbtc_fantom ] const wl_avax = [ usdc_avax, soul_avax, wbtc_avax, weth_avax ] diff --git a/projects/soulswap/underworld-lending.js b/projects/soulswap/underworld-lending.js index 47a585acc65..eead9b86937 100644 --- a/projects/soulswap/underworld-lending.js +++ b/projects/soulswap/underworld-lending.js @@ -2,8 +2,6 @@ const sdk = require("@defillama/sdk"); const { request, gql } = require("graphql-request"); const { BigNumber } = require('bignumber.js'); -const {getBlock} = require('../helper/getBlock') - // https://thegraph.com/hosted-service/subgraph/soulswapfantom/coffinbox const graphUrls = { 'fantom': 'https://api.thegraph.com/subgraphs/name/soulswapfinance/fantom-coffinbox', diff --git a/projects/sovryn-dex/index.js b/projects/sovryn-dex/index.js new file mode 100644 index 00000000000..a83c22fd213 --- /dev/null +++ b/projects/sovryn-dex/index.js @@ -0,0 +1,15 @@ +const { get } = require('../helper/http') + +module.exports = { + timetravel: false, + misrepresentedTokens: true, + rsk: { + tvl: async () => { + // tvlProtocol - margin account tvl + const { tvlAmm, tvlProtocol, } = await get('https://backend.sovryn.app/tvl') + return { + 'tether': tvlAmm.totalUsd + tvlProtocol.totalUsd + } + } + } +} \ No newline at end of file diff --git a/projects/sovryn-lending/index.js b/projects/sovryn-lending/index.js new file mode 100644 index 00000000000..472ba83ef13 --- /dev/null +++ b/projects/sovryn-lending/index.js @@ -0,0 +1,27 @@ +const { get } = require('../helper/http') + +module.exports = { + timetravel: false, + misrepresentedTokens: true, + rsk: { + tvl: async () => { + return { + 'tether': (await get('https://backend.sovryn.app/tvl')).tvlLending.totalUsd + } + }, + borrowed: async (_, _1, _2, { api }) => { + const data = Object.entries((await get('https://backend.sovryn.app/tvl')).tvlLending).filter(i => i[0].endsWith('_Lending')).map(i => i[1]) + const [ borrowed, decimals,] = await Promise.all([ + api.multiCall({ abi: 'uint256:totalAssetBorrow', calls: data.map(i => i.contract) }), + api.multiCall({ abi: 'erc20:decimals', calls: data.map(i => i.asset) }), + ]) + + // data.forEach((v, i) => api.add(v.asset, borrowed[i])) + // return; + //https://github.com/DistributedCollective/Sovryn-frontend/blob/development/src/utils/blockchain/abi/LoanTokenLogicStandard.json#L1410 + return { + 'tether': data.reduce((acc, v, i) => acc + borrowed[i] * v.balanceUsd / (v.balance * (10 ** decimals[i])), 0) + } + } + } +} \ No newline at end of file diff --git a/projects/sovryn-zero/index.js b/projects/sovryn-zero/index.js new file mode 100644 index 00000000000..34f6a424086 --- /dev/null +++ b/projects/sovryn-zero/index.js @@ -0,0 +1,12 @@ +const { get } = require('../helper/http') + +module.exports = { + timetravel: false, + rsk: { + tvl: async () => { + return { + 'bitcoin': (await get('https://backend.sovryn.app/tvl')).tvlZero.BTC_Zero.balance + } + } + } +} \ No newline at end of file diff --git a/projects/sovryn.js b/projects/sovryn.js deleted file mode 100644 index 359a13ac314..00000000000 --- a/projects/sovryn.js +++ /dev/null @@ -1,10 +0,0 @@ -const { get } = require('./helper/http') -async function fetch() { - let tvl_feed = await get('https://backend.sovryn.app/tvl') - let tvl = tvl_feed.tvlLending.totalUsd + tvl_feed.tvlAmm.totalUsd + tvl_feed.tvlProtocol.totalUsd + tvl_feed.tvlSubprotocols.totalUsd; - return tvl; -} - -module.exports = { - fetch -} diff --git a/projects/soyfinance/index.js b/projects/soyfinance/index.js index ecca1710998..cc8899fa920 100644 --- a/projects/soyfinance/index.js +++ b/projects/soyfinance/index.js @@ -1,15 +1,5 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { getUniTVL } = require('../helper/unknownTokens') -const ethers = require("ethers") -const { config } = require('@defillama/sdk/build/api'); - - -config.setProvider("ethereumclassic", new ethers.providers.StaticJsonRpcProvider( - "https://etc.mytokenpocket.vip", - { - name: "ethereumclassic", - chainId: 61, - } -)) module.exports = { misrepresentedTokens: true, @@ -18,28 +8,24 @@ module.exports = { callisto: { tvl: getUniTVL({ factory: '0x9CC7C769eA3B37F1Af0Ad642A268b80dc80754c5', - chain: 'callisto', useDefaultCoreAssets: true, }) }, ethereumclassic: { tvl: getUniTVL({ factory: '0x23675f1Ac7cce101Aff647B96d7201EfCf66E4b0', - chain: 'ethereumclassic', useDefaultCoreAssets: true, }) }, bittorrent: { tvl: getUniTVL({ - factory: '0xbf6c50889d3a620eb42c0f188b65ade90de958c4', - chain: 'bittorrent', + factory: ADDRESSES.callisto.BUSDT, useDefaultCoreAssets: true, }) }, bsc: { tvl: getUniTVL({ factory: '0x23675f1Ac7cce101Aff647B96d7201EfCf66E4b0', - chain: 'bsc', useDefaultCoreAssets: true, }) }, diff --git a/projects/spacedex-io/index.js b/projects/spacedex-io/index.js new file mode 100644 index 00000000000..a7b6fa9997f --- /dev/null +++ b/projects/spacedex-io/index.js @@ -0,0 +1,28 @@ +const {staking} = require('../helper/staking') +const { gmxExports } = require('../helper/gmx') + +//Arbitrum +const arbitrumVault = '0xA2D4719b29991271F3a6f06C757Ce31C6731491E' +const arbitrumStaking = '0xdb3aE24F01E8a0AF40CEd355B7262BbdbFdF715A' +const arbitrumFalcon = '0xA822CfD3AcbC0eB1a1Aba073B3355aCaF756ef7F' + +//Bsc +const bscVault = '0x24Ed2bf2c1E76C621164d93B73debD10cdC4BBD0' +const bscStaking = '0x7B8f0a523E8B929EB854749096e1b032189e0f26' +const bscFalcon = '0x37D39950f9C753d62529DbF68fCb4DCa4004fBFd' + +module.exports = { + arbitrum: { + staking: staking(arbitrumStaking, arbitrumFalcon, "arbitrum", "falcon", 18), + tvl: gmxExports({ vault: arbitrumVault, }) + }, + bsc:{ + staking: staking(bscStaking, bscFalcon, "bsc", "falcon", 18), + tvl: gmxExports({ vault: bscVault, }) + }, + hallmarks:[ + [1678365000, "BSC SpaceDex Launch"], + [1680521400, "Arbitrum SpaceDex Launch"] + ], + +}; diff --git a/projects/spacefi/index.js b/projects/spacefi/index.js index e46a089c66e..7816f2d015b 100644 --- a/projects/spacefi/index.js +++ b/projects/spacefi/index.js @@ -5,7 +5,12 @@ module.exports = { evmos: { tvl: getUniTVL({ factory: '0x868A71EbfC46B86a676768C7b7aD65055CC293eE', - chain: 'evmos', + useDefaultCoreAssets: true, + }) + }, + era: { + tvl: getUniTVL({ + factory: '0x0700Fb51560CfC8F896B2c812499D17c5B0bF6A7', useDefaultCoreAssets: true, }) }, diff --git a/projects/spadefinance/index.js b/projects/spadefinance/index.js index 61fb058fdf4..e49d8db310f 100644 --- a/projects/spadefinance/index.js +++ b/projects/spadefinance/index.js @@ -24,6 +24,8 @@ module.exports = { staking: stakingPricedLP(spadechef, spade, "fantom", spadeFtmLP, "fantom"), pool2: pool2Exports(spadechef, [spadeFtmLP, spadeUsdcLP], "fantom"), }, - + hallmarks: [ + [1647734400, "Rug Pull"] + ] } diff --git a/projects/spark-fi/index.js b/projects/spark-fi/index.js new file mode 100644 index 00000000000..424ee872961 --- /dev/null +++ b/projects/spark-fi/index.js @@ -0,0 +1,7 @@ +const ADDRESSES = require('../helper/coreAssets.json') + +const { aaveExports } = require('../helper/aave'); + +module.exports = { + ethereum: aaveExports('ethereum', '0x03cFa0C4622FF84E50E75062683F44c9587e6Cc1', undefined, ["0xFc21d6d146E6086B8359705C8b28512a983db0cb"], { v3: true, blacklistedTokens: [ADDRESSES.ethereum.DAI]}) +}; \ No newline at end of file diff --git a/projects/spartacus-exchange/index.js b/projects/spartacus-exchange/index.js index dcf9108c88b..0f1ac5998b3 100644 --- a/projects/spartacus-exchange/index.js +++ b/projects/spartacus-exchange/index.js @@ -2,10 +2,7 @@ const {uniTvlExport} = require('../helper/calculateUniTvl.js') module.exports = { misrepresentedTokens: true, - doublecounted: false, - timetravel: true, - incentivized: true, fantom: { - tvl: uniTvlExport("0x535646cf57E4155Df723bb24625f356d98ae9D2F", "fantom"), + tvl: uniTvlExport("0x535646cf57E4155Df723bb24625f356d98ae9D2F", "fantom", undefined, undefined, { hasStablePools: true, useDefaultCoreAssets: true, }), } }// node test.js projects/spartacus-exchange/index.js \ No newline at end of file diff --git a/projects/spartacus/index.js b/projects/spartacus/index.js index 617a89235c9..0495b35761e 100644 --- a/projects/spartacus/index.js +++ b/projects/spartacus/index.js @@ -1,24 +1,8 @@ const { staking } = require('../helper/staking') -const { sumTokensAndLPsSharedOwners } = require('../helper/unwrapLPs') -const { transformFantomAddress } = require('../helper/portedTokens') - - -const treasury = "0x8CFA87aD11e69E071c40D58d2d1a01F862aE01a8" - -async function tvl(time, ethBlock, chainBlocks) { - const balances = {} - const transform = await transformFantomAddress() - await sumTokensAndLPsSharedOwners(balances, [ - ["0x8d11ec38a3eb5e956b052f67da8bdc9bef8abf3e", false], - ["0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83", false], // FTM asset - ["0xfa5a5f0bc990be1d095c5385fff6516f6e03c0a7", true] - ], [treasury], chainBlocks.fantom, "fantom", transform) - return balances -} module.exports = { fantom: { - tvl, + tvl: () => 0, staking: staking("0x9863056B4Bdb32160A70107a6797dD06B56E8137", "0x5602df4A94eB6C680190ACCFA2A475621E0ddBdc", "fantom") } } \ No newline at end of file diff --git a/projects/spartan-protocol/abis/PoolFactory.json b/projects/spartan-protocol/abis/PoolFactory.json index b0bea452110..6e638c83f71 100644 --- a/projects/spartan-protocol/abis/PoolFactory.json +++ b/projects/spartan-protocol/abis/PoolFactory.json @@ -1,22 +1,4 @@ { - "getPool": { - "inputs": [ - { "internalType": "address", "name": "token", "type": "address" } - ], - "name": "getPool", - "outputs": [ - { "internalType": "address", "name": "pool", "type": "address" } - ], - "stateMutability": "view", - "type": "function" - }, - "getTokenAssets": { - "inputs": [], - "name": "getTokenAssets", - "outputs": [ - { "internalType": "address[]", "name": "tokens", "type": "address[]" } - ], - "stateMutability": "view", - "type": "function" - } -} + "getPool": "function getPool(address token) view returns (address pool)", + "getTokenAssets": "address[]:getTokenAssets" +} \ No newline at end of file diff --git a/projects/sperax-demeter/index.js b/projects/sperax-demeter/index.js new file mode 100644 index 00000000000..ba6ffd03eec --- /dev/null +++ b/projects/sperax-demeter/index.js @@ -0,0 +1,38 @@ +const { sumTokens2 } = require('../helper/unwrapLPs') + +async function tvl(_, _b, _cb, { api, }) { + const farms = await api.call({ + target: '0xC4fb09E0CD212367642974F6bA81D8e23780A659', + abi: 'function getFarmList() view returns (address[])', + }) + const rewardTokens = await api.multiCall({ + calls: farms, + abi: 'function getRewardTokens() view returns (address[])', + }) + + const toa = [] + farms.forEach((o, i) => { + rewardTokens[i].forEach(t => toa.push([t, o])) + }); + await sumTokens2({ api, owners: farms, resolveUniV3: true, }) + const camelotFarms = (await api.multiCall({ abi: 'address:nftPool', calls: farms, permitFailure: true, })).map((v, i) => v ? [v, farms[i]] : null).filter(v => v) + await Promise.all(camelotFarms.map(i => getFarmTvl(api, i))) + return sumTokens2({ api, tokensAndOwners: toa, }) +} + +async function getFarmTvl(api, [nftPool, farm]) { + const poolInfo = await api.call({ abi: "function getPoolInfo() view returns (address lpToken, address grailToken, address xGrailToken, uint256 lastRewardTime, uint256 accRewardsPerShare, uint256 lpSupply, uint256 lpSupplyWithMultiplier, uint256 allocPoint)", target: nftPool, }) + const tokenCount = await api.call({ abi: 'erc20:balanceOf', target: nftPool, params: farm, }) + const calls = [] + for (let i= 0;i< +tokenCount;i++) calls.push({ params: [farm, i]}) + const tokenIds = await api.multiCall({ abi: 'function tokenOfOwnerByIndex(address,uint256) view returns (uint256)', calls, target: nftPool}) + const positions = await api.multiCall({ abi: "function getStakingPosition(uint256 tokenId) view returns (uint256 amount, uint256 amountWithMultiplier, uint256 startLockTime, uint256 lockDuration, uint256 lockMultiplier, uint256 rewardDebt, uint256 boostPoints, uint256 totalMultiplier)", calls: tokenIds, target: nftPool,}) + positions.forEach((position, i) => { + api.add(poolInfo.lpToken, position.amount) + }) +} + +module.exports = { + doublecounted: true, + arbitrum: { tvl } +} \ No newline at end of file diff --git a/projects/sperax/abi.json b/projects/sperax/abi.json index f759d5e2e40..09010832fd2 100644 --- a/projects/sperax/abi.json +++ b/projects/sperax/abi.json @@ -1,15 +1,3 @@ { - "totalValueLocked": { - "inputs": [], - "name": "totalValueLocked", - "outputs": [ - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -} + "totalValueLocked": "uint256:totalValueLocked" +} \ No newline at end of file diff --git a/projects/sphere-finance/index.js b/projects/sphere-finance/index.js index 62c5f82e5d7..a81d8f7dfca 100644 --- a/projects/sphere-finance/index.js +++ b/projects/sphere-finance/index.js @@ -1,8 +1,7 @@ -const { staking } = require('../helper/staking') const { get } = require('../helper/http') const sphere_token = "0x62f594339830b90ae4c084ae7d223ffafd9658a7" -const stakingAddress = "0x284eba456e27ec9d07a656ce7cf68f2c78578f2e" // Sphere Games StakePrizePool +const stakingAddress = "0x4Af613f297ab00361D516454E5E46bc895889653" // ylSPHERE module.exports = { timetravel: false, @@ -11,9 +10,8 @@ module.exports = { tvl: async () => { const data = await get('https://spheretvl.simsalacrypto.workers.dev/') return { - tether: data.portfolio.net_worth + tether: data.portfolio.net_worth_pools } }, - staking: staking(stakingAddress, sphere_token, 'polygon') } -} \ No newline at end of file +} diff --git a/projects/spherium/abi.json b/projects/spherium/abi.json index 93496a5282a..8c892f3b37a 100644 --- a/projects/spherium/abi.json +++ b/projects/spherium/abi.json @@ -1,34 +1,4 @@ { - "getAllWhitelistedTokenNames": { - "inputs": [], - "name": "getAllWhitelistedTokenNames", - "outputs": [ - { - "internalType": "string[]", - "name": "", - "type": "string[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - "whitelistedTokenAddress": { - "inputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "name": "whitelistedTokenAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } -} + "getAllWhitelistedTokenNames": "string[]:getAllWhitelistedTokenNames", + "whitelistedTokenAddress": "function whitelistedTokenAddress(string) view returns (address)" +} \ No newline at end of file diff --git a/projects/sphynx/index.js b/projects/sphynx/index.js index d001240e269..539b9921c11 100644 --- a/projects/sphynx/index.js +++ b/projects/sphynx/index.js @@ -1,33 +1,22 @@ const { getUniTVL } = require('../helper/unknownTokens') +const config = { + bsc: '0x8BA1a4C24DE655136DEd68410e222cCA80d43444', + cronos: '0x5019EF5dd93A7528103BB759Bb2F784D065b826a', + bitgert: '0xd4688F52e9944A30A7eaD808E9A86F95a0661DF8', + // ethereum: '0x5Fc2b10Efb7C202Ab84ffF9Ea54d240280421D4b', + // polygon: '0xF902beC4aFEcd6b9d9998F582f580Be6994A56aB', + loop: '0xc0246b4f24475a11ee4383d29575394dc237fc36', + // okexchain: '0xd38Ec16cAf3464ca04929E847E4550Dcff25b27a', + // avax: '0x4faAFf0925886AcC7B6fE752F50d244E32248700', + // arbitrum: '0x945905D2E8D14fD58E156684Ad56a71cb02F2F02', + // optimism: '0xb37C9656e88927F9CAa6177ac409EF31f85f789A', +} module.exports = { misrepresentedTokens: true, - bsc: { - tvl: getUniTVL({ - chain: 'bsc', - factory: '0x8BA1a4C24DE655136DEd68410e222cCA80d43444', - useDefaultCoreAssets: true, - }), - }, - // ethereum: { - // tvl: getUniTVL({ - // chain: 'ethereum', - // factory: '0x5Fc2b10Efb7C202Ab84ffF9Ea54d240280421D4b', - // useDefaultCoreAssets: true, - // }), - // }, - cronos: { - tvl: getUniTVL({ - chain: 'cronos', - factory: '0x5019EF5dd93A7528103BB759Bb2F784D065b826a', - useDefaultCoreAssets: true, - }), - }, - bitgert: { - tvl: getUniTVL({ - chain: 'bitgert', - factory: '0xd4688F52e9944A30A7eaD808E9A86F95a0661DF8', - useDefaultCoreAssets: true, - }), - }, }; + +Object.keys(config).forEach(chain => { + const factory = config[chain] + module.exports[chain] = { tvl: getUniTVL({ factory, useDefaultCoreAssets: true }) } +}) diff --git a/projects/spice-finance/index.js b/projects/spice-finance/index.js new file mode 100644 index 00000000000..a5e83ababe8 --- /dev/null +++ b/projects/spice-finance/index.js @@ -0,0 +1,20 @@ +const vaults = [ + '0xAe11ae7CaD244dD1d321Ff2989543bCd8a6Db6DF', // Flagship + '0xd68871bd7D28572860b2E0Ee5c713b64445104F9', // Leverage + '0x6110d61DD1133b0f845f1025d6678Cd22A11a2fe', // VIP + '0xfC287513E2DD58fbf952eB0ED05D511591a6215B', // Blur +] + +async function tvl(_1, _2, chainBlocks, { api }) { + const tokens = await api.multiCall({ abi: 'address:asset', calls: vaults }) + const bals = await api.multiCall({ abi: 'uint256:totalAssets', calls: vaults }) + api.addTokens(tokens, bals) +} + +module.exports = { + misrepresentedTokens: true, + methodology: `Counts WETH deposited to earn yield via NFT lending.`, + ethereum: { + tvl, + }, +}; diff --git a/projects/spicetrade/index.js b/projects/spicetrade/index.js index 43347cb7379..060a8cda62b 100644 --- a/projects/spicetrade/index.js +++ b/projects/spicetrade/index.js @@ -17,26 +17,25 @@ function getTokens(chain, type) { case 'pool2': return Object.values(contracts[chain].tokens.pool2) - }; -}; + } +} const tvl = (chain, type) => { return async (_t, _e, { [chain]: block}) => { let holders = [] for (let key in contracts[chain].tokenHolders) { holders.push(...Object.values(contracts[chain].tokenHolders[key])); - }; + } const tokens = getTokens(chain, type) const toa = tokens.map(t => holders.map(o => [t, o])).flat() - return sumTokens({}, toa, block, chain, undefined, { resolveCrv: true, resolveLP: true }) + return sumTokens({}, toa, block, chain, undefined, { resolveLP: true }) }; }; const chainTypeExports = (chains) => { return chains.reduce((obj, chain) => { const uniTVL = getUniTVL({ - chain, factory: contracts[chain].factory, useDefaultCoreAssets: true, }) diff --git a/projects/spin-prep/index.js b/projects/spin-prep/index.js new file mode 100644 index 00000000000..07c72144b14 --- /dev/null +++ b/projects/spin-prep/index.js @@ -0,0 +1,19 @@ +const { call, addTokenBalances } = require('../helper/chain/near'); + +const PERP_PROJECT_CONTRACT = 'v2_0_2.perp.spin-fi.near'; +const GET_BASE_CUURENCY_METHOD = 'get_base_currency'; + +async function tvl() { + let perpFtCurrency = (await call(PERP_PROJECT_CONTRACT, GET_BASE_CUURENCY_METHOD, {}))['address']; + + // NOTE: add collateral balance (only USDC right now) for perp + return addTokenBalances(perpFtCurrency, PERP_PROJECT_CONTRACT); +} + + +module.exports = { + timetravel: false, + near: { + tvl, + }, +} diff --git a/projects/spin-vault/index.js b/projects/spin-vault/index.js new file mode 100644 index 00000000000..9a1477f81c6 --- /dev/null +++ b/projects/spin-vault/index.js @@ -0,0 +1,21 @@ +const { call, addTokenBalances } = require('../helper/chain/near'); + +const VAULT_PROJECT_CONTRACT = 'v1.vault.spin-fi.near' +const VAULT_GET_ALL = 'vault_get_all'; + + +async function tvl() { + // NOTE: add TVL for vaults + const execution_assets = (await call(VAULT_PROJECT_CONTRACT, VAULT_GET_ALL, { "limit": "100", "offset": "0" })) + .map(vault => vault['invariant']['execution_asset']); + + return addTokenBalances(execution_assets, VAULT_PROJECT_CONTRACT); +} + + +module.exports = { + timetravel: false, + near: { + tvl, + }, +} diff --git a/projects/spin/index.js b/projects/spin/index.js index dfa9d0af0e2..c0f36041c0b 100644 --- a/projects/spin/index.js +++ b/projects/spin/index.js @@ -6,10 +6,6 @@ const NATIVE_NEAR = 'near.near'; const FT_NEAR = 'wrap.near'; const FT_AURORA = 'd9c2d319cd7e6177336b0a9c93c21cb48d84fb54.factory.bridge.near'; -const PERP_PROJECT_CONTRACT = 'v2_0_2.perp.spin-fi.near'; -const GET_BASE_CUURENCY_METHOD = 'get_base_currency'; - - async function tvl() { let spotFtCurrencies = (await call(SPOT_PROJECT_CONTRACT, GET_CURRENCIES_METHOD, {})) .filter(token => token['address'] !== NATIVE_NEAR) @@ -25,12 +21,6 @@ async function tvl() { // NOTE: add near balance for spot const spot_contract_state = await view_account(SPOT_PROJECT_CONTRACT); sumSingleBalance(balances, FT_NEAR, spot_contract_state['amount']); - - let perpFtCurrency = (await call(PERP_PROJECT_CONTRACT, GET_BASE_CUURENCY_METHOD, {}))['address']; - - // NOTE: add collateral balance (only USDC right now) for perp - balances = await addTokenBalances(perpFtCurrency, PERP_PROJECT_CONTRACT, balances); - return balances; } diff --git a/projects/spiral-dao/abi.json b/projects/spiral-dao/abi.json new file mode 100644 index 00000000000..bc914099df2 --- /dev/null +++ b/projects/spiral-dao/abi.json @@ -0,0 +1,6 @@ +{ + "poolCount": "function poolCount() external view returns (uint256)", + "poolInfo": "function poolInfo(uint256 poolId) external view returns (tuple(address target, address adapter, uint256 targetPoolId, uint256 rewardableDeposits) memory)", + "lockableToken": "function lockableToken(uint256) external view returns (address)" +} + diff --git a/projects/spiral-dao/index.js b/projects/spiral-dao/index.js new file mode 100644 index 00000000000..839789b86da --- /dev/null +++ b/projects/spiral-dao/index.js @@ -0,0 +1,28 @@ +const { staking } = require('../helper/staking') +const sdk = require('@defillama/sdk'); +const abi = require('./abi.json'); + +const MASTERMIND = "0xFACE8DED582816E2f2cD4C6cc1cbD1aCCc9df65E" +const STAKING = "0x6701e792b7cd344bae763f27099eeb314a4b4943" +const COIL = '0x823E1B82cE1Dc147Bbdb25a203f046aFab1CE918' + +async function tvl(_, _1, _2, { api }) { + const balances = {} + let pools = await api.fetchList({ target: MASTERMIND, itemAbi: abi.poolInfo, lengthAbi: abi.poolCount, }) + let poolInputs = await api.fetchList({ target: MASTERMIND, itemAbi: abi.lockableToken, lengthAbi: abi.poolCount, }) + for (let i = 0; i < pools.length; i++) { + await sdk.util.sumSingleBalance(balances, poolInputs[i], pools[i].rewardableDeposits) + } + return balances; +} + + +module.exports = { + methodology: 'Information is retrieved from both the blockchain and the SpiralDAO API. "https://api.spiral.farm".', + start: 16991020, + ethereum: { + tvl, + staking: staking(STAKING, COIL), + } +}; + diff --git a/projects/spiral-fi-mixer/index.js b/projects/spiral-fi-mixer/index.js new file mode 100644 index 00000000000..2032acb827e --- /dev/null +++ b/projects/spiral-fi-mixer/index.js @@ -0,0 +1,11 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require('../helper/unwrapLPs') + +module.exports = { + era: { + tvl: sumTokensExport({ owner: '0xcd98e2C68248de044c3E44144C34D9EBb09337a9', tokens: [ADDRESSES.era.USDC]}) + }, + polygon_zkevm: { + tvl: sumTokensExport({owner: '0x96DaD05740807e76892076684F433D5E0b3569fB', tokens: [ADDRESSES.polygon_zkevm.USDC]}) + } +} \ No newline at end of file diff --git a/projects/spiral-finance/abi.json b/projects/spiral-finance/abi.json index 92861e7ffbd..08941c1eac8 100644 --- a/projects/spiral-finance/abi.json +++ b/projects/spiral-finance/abi.json @@ -1,113 +1,7 @@ { - "poolLength": { - "inputs": [], - "name": "poolLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "poolInfo": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "poolInfo", - "outputs": [ - { - "internalType": "contract Target", - "name": "target", - "type": "address" - }, - { - "internalType": "address", - "name": "adapter", - "type": "address" - }, - { - "internalType": "uint256", - "name": "targetPoolId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "drainModifier", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalShares", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalDeposits", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "entranceFee", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "lockableToken": { - "inputs": [ - { - "internalType": "uint256", - "name": "poolId", - "type": "uint256" - } - ], - "name": "lockableToken", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "token0": { - "constant": true, - "inputs": [], - "name": "token0", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "token1": { - "constant": true, - "inputs": [], - "name": "token1", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } + "poolLength": "uint256:poolLength", + "poolInfo": "function poolInfo(uint256) view returns (address target, address adapter, uint256 targetPoolId, uint256 drainModifier, uint256 totalShares, uint256 totalDeposits, uint256 entranceFee)", + "lockableToken": "function lockableToken(uint256 poolId) view returns (address)", + "token0": "address:token0", + "token1": "address:token1" } \ No newline at end of file diff --git a/projects/spiral-finance/index.js b/projects/spiral-finance/index.js index 9d41c7c2ccb..48cb5553c0d 100644 --- a/projects/spiral-finance/index.js +++ b/projects/spiral-finance/index.js @@ -1,120 +1,93 @@ const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); -const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); +const { unwrapUniswapLPs, nullAddress } = require("../helper/unwrapLPs"); const spr = "0x8c739564345dfcb7e4c7e520b0e8fa142c358a78"; const mastermind = "0x0Ff4c81489fbaFf02201b55636Df5889b43972e9"; -async function calcTvl (block, spr, mastermind, pool2) { - let balances = {}; - const chain = "fantom"; - - const poolLength = (await sdk.api.abi.call({ - target: mastermind, - abi: abi["poolLength"], - block, - chain - })).output; - - const poolInfos = (await sdk.api.abi.multiCall({ - calls: Array.from({length: Number(poolLength)}, (_,k) => ({ - target: mastermind, - params: k - })), - abi: abi["poolInfo"], - block, - chain - })).output; - - const tokens = (await sdk.api.abi.multiCall({ - calls: poolInfos.map(p => ({ - target: p.output.target, - params: p.output.targetPoolId - })), - abi: abi["lockableToken"], - block, - chain - })).output; - - const symbols = (await sdk.api.abi.multiCall({ - calls: tokens.map(p => ({ - target: p.output - })), - abi: "erc20:symbol", - block, - chain - })).output; - - const lps = []; - - for (let i = 0; i < Number(poolLength); i++) { - if (tokens[i].output === null) continue; - const token = tokens[i].output.toLowerCase(); - const symbol = symbols[i].output; - const balance = poolInfos[i].output.totalDeposits; - if (token === spr) continue; - if (!symbol.endsWith("LP") && pool2) continue; - if (symbol.endsWith("LP")) { - lps.push([token, balance]); - } else { - sdk.util.sumSingleBalance(balances, `fantom:${token}`, balance); - } +async function calcTvl(block, spr, mastermind, pool2, api) { + const balances = {} + const poolInfos = (await api.fetchList({ lengthAbi: abi.poolLength, itemAbi: abi.poolInfo, target: mastermind })).filter(i => i.target !== nullAddress) + + const tokens = (await api.multiCall({ + calls: poolInfos.map(p => ({ + target: p.target, + params: p.targetPoolId + })), + abi: abi["lockableToken"], + })) + + const symbols = (await api.multiCall({ + calls: tokens, + abi: "erc20:symbol", + })); + + const lps = []; + + for (let i = 0; i < poolInfos.length; i++) { + if (tokens[i] === null) continue; + const token = tokens[i].toLowerCase(); + const symbol = symbols[i]; + const balance = poolInfos[i].totalDeposits; + if (token === spr) continue; + if (!symbol.endsWith("LP") && pool2) continue; + if (symbol.endsWith("LP")) { + lps.push([token, balance]); + } else { + sdk.util.sumSingleBalance(balances, `fantom:${token}`, balance); } - - const lpToken0 = (await sdk.api.abi.multiCall({ - calls: lps.map( p => ({ - target: p[0] - })), - abi: abi["token0"], - block, - chain - })).output; - - const lpToken1 = (await sdk.api.abi.multiCall({ - calls: lps.map( p => ({ - target: p[0] - })), - abi: abi["token1"], - block, - chain - })).output; - - let lpPositions = []; - for (let i = 0; i < lps.length; i++) { - const token = lps[i][0].toLowerCase(); - const token0 = lpToken0[i].output.toLowerCase(); - const token1 = lpToken1[i].output.toLowerCase(); - if (pool2) { - if (token0 !== spr && token1 !== spr ) continue; - lpPositions.push({ - token, - balance: lps[i][1] - }); - } else { - if (token0 === spr || token1 === spr ) continue; - lpPositions.push({ - token, - balance: lps[i][1] - }); - } + } + + const lpToken0 = (await api.multiCall({ + calls: lps.map(p => ({ + target: p[0] + })), + abi: abi["token0"], + })); + + const lpToken1 = (await api.multiCall({ + calls: lps.map(p => ({ + target: p[0] + })), + abi: abi["token1"], + })); + + let lpPositions = []; + for (let i = 0; i < lps.length; i++) { + const token = lps[i][0].toLowerCase(); + const token0 = lpToken0[i].toLowerCase(); + const token1 = lpToken1[i].toLowerCase(); + if (pool2) { + if (token0 !== spr && token1 !== spr) continue; + lpPositions.push({ + token, + balance: lps[i][1] + }); + } else { + if (token0 === spr || token1 === spr) continue; + lpPositions.push({ + token, + balance: lps[i][1] + }); } + } - await unwrapUniswapLPs(balances, lpPositions, block, chain, addr=>`fantom:${addr}`); + await unwrapUniswapLPs(balances, lpPositions, api.block, api.chain, addr => `fantom:${addr}`); - return balances; + return balances; } -async function tvl(timestamp, block, chainBlocks) { - return await calcTvl(chainBlocks.fantom, spr, mastermind, false); +async function tvl(timestamp, block, chainBlocks, { api }) { + return await calcTvl(chainBlocks.fantom, spr, mastermind, false, api); } -async function pool2(timestamp, block, chainBlocks) { - return await calcTvl(chainBlocks.fantom, spr, mastermind, true); +async function pool2(timestamp, block, chainBlocks, { api }) { + return await calcTvl(chainBlocks.fantom, spr, mastermind, true, api); } module.exports = { - fantom: { - tvl, - pool2 - } + fantom: { + tvl, + pool2 + } } diff --git a/projects/spiritswap-lending/index.js b/projects/spiritswap-lending/index.js index 3e318be24c1..07d3007feb2 100644 --- a/projects/spiritswap-lending/index.js +++ b/projects/spiritswap-lending/index.js @@ -1,8 +1,8 @@ const {usdCompoundExports} = require('../helper/compound') const abis = { - oracle: {"constant":true,"inputs":[],"name":"getRegistry","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"}, - underlyingPrice: {"constant":true,"inputs":[{"internalType":"address","name":"cToken","type":"address"}],"name":"getPriceForUnderling","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"}, + oracle: "address:getRegistry", + underlyingPrice: "function getPriceForUnderling(address cToken) view returns (uint256)", } const unitroller_fantom = "0x892701d128d63c9856A9Eb5d967982F78FD3F2AE" diff --git a/projects/spl-governance/index.js b/projects/spl-governance/index.js new file mode 100644 index 00000000000..f68ef0c49f0 --- /dev/null +++ b/projects/spl-governance/index.js @@ -0,0 +1,22 @@ +const { getCache } = require('../helper/http') +const url = 'https://api.realms.today/stats/tvl' + +async function tvl() { + const { tvl } = await getCache(url) + return tvlObject(tvl) +} + +async function staking() { + const { ownTokens } = await getCache(url) + return tvlObject(ownTokens) +} + +function tvlObject(obj) { + return Object.fromEntries(Object.entries(obj).filter(([_, i]) => +i > 1).map(([a, b]) => ['solana:'+a, b])) +} + +module.exports = { + methodology: 'SOL token and stables held in the contracts are counted under tvl, gov tokens are counted under staking', + timetravel: false, + solana: { tvl, staking, } +} diff --git a/projects/spookyswap/index.js b/projects/spookyswap/index.js index c75c67a2ead..9416f18f215 100644 --- a/projects/spookyswap/index.js +++ b/projects/spookyswap/index.js @@ -1,8 +1,7 @@ -const { getChainTvl } = require("../helper/getUniSubgraphTvl") +const { getUniTVL } = require("../helper/unknownTokens") module.exports={ + misrepresentedTokens: true, fantom:{ - tvl: getChainTvl({ - fantom: 'https://api.fura.org/subgraphs/name/spookyswap' - })('fantom') - } -} \ No newline at end of file + tvl: getUniTVL({ useDefaultCoreAssets: true, factory: '0x152eE697f2E276fA89E96742e9bB9aB1F2E61bE3' }), + }, +} \ No newline at end of file diff --git a/projects/spool/abi.json b/projects/spool/abi.json index 82ad200b43a..23322a7cb19 100644 --- a/projects/spool/abi.json +++ b/projects/spool/abi.json @@ -1,6 +1,6 @@ { - "spoolController_getAllStrategies": {"inputs":[],"name":"getAllStrategies","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"}, - "masterSpool_getUnderlying": {"inputs":[{"internalType":"address","name":"strat","type":"address"}],"name":"getUnderlying","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"view","type":"function"}, - "masterSpool_getStratUnderlying": {"inputs":[{"internalType":"address","name":"strat","type":"address"}],"name":"getStratUnderlying","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"nonpayable","type":"function"}, - "strategy_underlying": {"inputs":[],"name":"underlying","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"} -} + "spoolController_getAllStrategies": "address[]:getAllStrategies", + "masterSpool_getUnderlying": "function getUnderlying(address strat) view returns (uint128)", + "masterSpool_getStratUnderlying": "function getStratUnderlying(address strat) returns (uint128)", + "strategy_underlying": "address:underlying" +} \ No newline at end of file diff --git a/projects/spool/index.js b/projects/spool/index.js index 47a28432a4d..d3ccf6cdb7b 100644 --- a/projects/spool/index.js +++ b/projects/spool/index.js @@ -1,65 +1,34 @@ const sdk = require("@defillama/sdk") -const {sumTokens,} = require("../helper/unwrapLPs.js") -const {staking} = require("../helper/staking.js") -const abi = require("./abi.json"); -const { sumMultiBalanceOf } = require("@defillama/sdk/build/generalUtil"); - -const spoolController = '0xdd4051c3571c143b989c3227e8eb50983974835c' -const masterSpool = '0xe140bb5f424a53e0687bfc10f6845a5672d7e242' +const { sumTokens2, } = require("../helper/unwrapLPs.js") +const { staking } = require("../helper/staking.js") +const abi = require("./abi.json") const SPOOL = '0x40803cea2b2a32bda1be61d3604af6a814e70976' const SPOOL_staking = '0xc3160C5cc63B6116DD182faA8393d3AD9313e213' - -const chain = 'ethereum' -// TVL is asset holdings of the masterSpool + all capital deployed via each strategy -async function tvl (timestamp, block, chainBlocks) { - const balances = {} - - // Get strategies contract addresses and underlying tokens - let {output: strategies} = await sdk.api.abi.call({ - abi: abi['spoolController_getAllStrategies'], - target: spoolController, - block, - chain, - }) - // strategies = ['0x854DB91E371e42818936E646361452c3060ec9dd'] - const {output: underlyings_nonunique} = await sdk.api.abi.multiCall({ - abi: abi['strategy_underlying'], - calls: strategies.map(s => ({target: s})), - block, - chain, - }) - const underlyings = [... new Set(underlyings_nonunique.map(u => u.output))]; - // console.log('strategies', strategies, 'underlyings', underlyings) - - // Balances of tokens pending to be deployed in strategies - const tokensAndOwners = underlyings.map(t => [t, masterSpool]) - await sumTokens(balances, tokensAndOwners, block, chain) - - const underlyingBalances = await sdk.api.abi.multiCall({ - abi: abi['masterSpool_getStratUnderlying'], - calls: strategies.map(strat => ({ - target: masterSpool, - params: strat - })), - block, - chain, - }) - // console.log('underlyingBalances', underlyingBalances) - // Since tvl is deployed to aave, yearn, compound, use masterSpool_getStratUnderlying method - // For simplicity, trick sumMultiBalanceOf into thinking the calls were erc20 balanceOf - underlyingBalances.output.forEach((c, i) => c.input.target = underlyings_nonunique[i].output) - await sumMultiBalanceOf(balances, underlyingBalances) - - // console.log(`balances `, balances) - return balances +const config = { + ethereum: { controller: '0xdd4051c3571c143b989c3227e8eb50983974835c', masterSpool: '0xe140bb5f424a53e0687bfc10f6845a5672d7e242', }, + arbitrum: { controller: '0xd31ff4536bd190c87039c7697b3a5843196c1b94', masterSpool: '0xe4b6347395262d203e3fec5c8ebde4cfe92111b3', }, } module.exports = { - ethereum: { - tvl, - staking: staking(SPOOL_staking, SPOOL, "ethereum"), - }, methodology: `Counting Pending deposits in the MasterSpool contract as well as assets deployed to each strategy` } + +Object.keys(config).forEach(chain => { + const { controller, masterSpool, } = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const balances = {} + const strategies = await api.call({ abi: abi.spoolController_getAllStrategies, target: controller }) + let underlyings = await api.multiCall({ abi: abi.strategy_underlying, calls: strategies }) + let bals = await api.multiCall({ abi: abi.masterSpool_getStratUnderlying, calls: strategies, target: masterSpool, }) + bals.forEach((v, i) => sdk.util.sumSingleBalance(balances,underlyings[i],v, api.chain)) + + return sumTokens2({ api, balances, owner: masterSpool, tokens: underlyings }) + } + } +}) + + +module.exports.ethereum.staking = staking(SPOOL_staking, SPOOL) \ No newline at end of file diff --git a/projects/spoon-exchange/index.js b/projects/spoon-exchange/index.js new file mode 100644 index 00000000000..54ef1ba0cf0 --- /dev/null +++ b/projects/spoon-exchange/index.js @@ -0,0 +1,12 @@ +const { getUniTVL } = require('../helper/unknownTokens.js') + +module.exports = { + misrepresentedTokens: true, + core:{ + tvl: getUniTVL({ + useDefaultCoreAssets: true, + hasStablePools: true, + factory: '0x097665669d8bd2ad7554E1434A3B93a42F03b435', + }), + }, +} diff --git a/projects/squid-dao/index.js b/projects/squid-dao/index.js index e8381c45b29..51679a4ca5e 100644 --- a/projects/squid-dao/index.js +++ b/projects/squid-dao/index.js @@ -1,7 +1,8 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { ohmTvl } = require('../helper/ohm') const treasury = "0x61d8a57b3919e9F4777C80b6CF1138962855d2Ca" module.exports = ohmTvl(treasury, [ - ["0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", false], + [ADDRESSES.ethereum.WETH, false], ["0xfad704847967d9067df7a60910399155fca43fe8", true] ], "ethereum", "0x5895b13da9beb11e36136817cdcf3c4fcb16aaea", "0x21ad647b8f4fe333212e735bfc1f36b4941e6ad2") \ No newline at end of file diff --git a/projects/squidstake/index.js b/projects/squidstake/index.js index 32142bb1732..c2bcdd77b96 100644 --- a/projects/squidstake/index.js +++ b/projects/squidstake/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const { transformBscAddress } = require("../helper/portedTokens"); const { addFundsInMasterChef } = require("../helper/masterchef"); @@ -11,22 +12,10 @@ const squidBnbLP = "0x2e0484D3684701dC032f29cce59c785A5837B34E"; const solWbnbLP = { lpToken: "0x9d5B48AD38748c6DBD77399eccE3FD8B6f980456", token0: ["solana"], - token1: "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c", + token1: ADDRESSES.bsc.WBNB, }; -const getReserves = { - constant: true, - inputs: [], - name: "getReserves", - outputs: [ - { internalType: "uint112", name: "_reserve0", type: "uint112" }, - { internalType: "uint112", name: "_reserve1", type: "uint112" }, - { internalType: "uint32", name: "_blockTimestampLast", type: "uint32" }, - ], - payable: false, - stateMutability: "view", - type: "function", -}; +const getReserves = 'function getReserves() view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast)'; async function tvl(timestamp, chain, chainBlocks) { let balances = {}; diff --git a/projects/stCelo/index.js b/projects/stCelo/index.js index dc4e4ab49ed..2a38e5bb550 100644 --- a/projects/stCelo/index.js +++ b/projects/stCelo/index.js @@ -16,20 +16,9 @@ async function tvl(timestamp, ethBlock, chainBlocks) { const stCelo_contract_address = '0x4aAD04D41FD7fd495503731C5a2579e19054C432'; const block = chainBlocks.celo - console.log(chainBlocks.celo) const stCelo_pooled = await sdk.api.abi.call({ - abi: { - "type":"function", - "stateMutability":"view", - "outputs":[{ - "type":"uint256", - "name":"", - "internalType":"uint256" - }], - "name":"getTotalCelo", - "inputs":[] - }, + abi: "uint256:getTotalCelo", target: stCelo_contract_address, block: block, chain: 'celo' diff --git a/projects/stUSDT/index.js b/projects/stUSDT/index.js new file mode 100644 index 00000000000..d52f1f79b00 --- /dev/null +++ b/projects/stUSDT/index.js @@ -0,0 +1,19 @@ +const ADDRESSES = require('../helper/coreAssets.json') +module.exports = { + tron: { + tvl: async (_, _b, _cb, { api, }) => { + const supply = await api.call({ abi: "erc20:totalSupply", target: "TThzxNRLrW2Brp9DcTQU8i4Wd9udCWEdZ3" }) + return { + [ADDRESSES.ethereum.USDT]: supply/1e12 + } + } + }, + ethereum: { + tvl: async (_, _b, _cb, { api, }) => { + const supply = await api.call({ abi: "erc20:totalSupply", target: "0x25ec98773d7b4ced4cafab96a2a1c0945f145e10" }) + return { + [ADDRESSES.ethereum.USDT]: supply/1e12 + } + } + } +} diff --git a/projects/stabilizefi/getEntireSystemColl.abi.json b/projects/stabilizefi/getEntireSystemColl.abi.json deleted file mode 100644 index 15a2c6c04b3..00000000000 --- a/projects/stabilizefi/getEntireSystemColl.abi.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "inputs": [], - "name": "getEntireSystemColl", - "outputs": [ - { - "internalType": "uint256", - "name": "entireSystemColl", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" -} \ No newline at end of file diff --git a/projects/stabilizefi/index.js b/projects/stabilizefi/index.js index 97d970638c8..f7ad8696a57 100644 --- a/projects/stabilizefi/index.js +++ b/projects/stabilizefi/index.js @@ -1,59 +1,35 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); -const BigNumber = require("bignumber.js"); const { getLiquityTvl } = require("../helper/liquity"); -const getEntireSystemCollAbi = require("./getEntireSystemColl.abi.json"); -const totalTokenStakedAbi = require("./totalTokenStaked.abi.json"); const { pool2 } = require('../helper/pool2'); -const { transformAvaxAddress } = require("../helper/portedTokens"); // staking const TOKEN_STAKING_ADDRESS = "0x4A2B73ebAc93D9233BAB10a795F04efb9C00D466"; const SET_ADDRESS = "avax:0x37d87e316CB4e35163881fDb6c6Bc0CdBa91dc0A"; -// farm -const USDC_ADDRESS = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48" -const FARM_ADDRESS_SUSD_USDC = "0xdB9E11363eCBAc008b42C59b80Bc25B1f1C66Cb2" -const LP_ADDRESS_SUSD_USDC = "0x360C233A63314B2b75cf0172E63B489BCeA8e4b4" -const AVAX_USDC_ADDRESS = "0xA7D7079b0FEaD91F3e65f86E8915Cb59c1a4C664" - const FARM_ADDRESS_SET_USDC = "0xAA31D7Bc8186888D9Eebb5524C47268E4bC87496" const LP_ADDRESS_SET_USDC = "0x31fa3838788A07607D95C9c640D041eAec649f50" // system coll -const AVAX_ADDRESS = '0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7'; +const AVAX_ADDRESS = ADDRESSES.avax.WAVAX; const AVAX_TROVE_MANAGER_ADDRESS = "0x7551A127C41C85E1412EfE263Cadb49900b0668C"; -const ETH_ADDRESS = '0x49d5c2bdffac6ce2bfdb6640f4f80f226bc10bab'; +const ETH_ADDRESS = ADDRESSES.avax.WETH_e; const ETH_TROVE_MANAGER_ADDRESS = "0x7837C2dB2d004eB10E608d95B2Efe8cb57fd40b4"; const BTC_ADDRESS = '0x50b7545627a5162f82a992c33b87adc75187b218'; const BTC_TROVE_MANAGER_ADDRESS = "0x56c194F1fB30F8cdd49E7351fC9C67d8C762a86F"; -const DAI_ADDRESS = '0xd586e7f844cea2f87f50152665bcbc2c279d8d70'; +const DAI_ADDRESS = ADDRESSES.avax.DAI; const DAI_TROVE_MANAGER_ADDRESS = "0x54b35c002468a5Cc2BD1428C011857d26463ecbC"; -/* -// stability pool -const SUSD_ADDRESS = "avax:0xAafd2577Fb67366d3C89DB0d627C49D769ee2e5D"; - -const U_AVAX_ADDRESS = '0xc53A6EDa2C847ce9f10b5C8D51BC2a9Ed2Fe3d44'; -const AVAX_STABILITY_POOL_ADDRESS = "0x4EBb1d6043e267EF5f2b88Ee18D414F541fD1b5C"; - -const U_ETH_ADDRESS = '0x6bD3156F45c063cfF86E7574Ad12f0bA8df589f7'; -const ETH_STABILITY_POOL_ADDRESS = "0xBDe5cff40479853419c121E57B9FcF637338bd0c"; -const U_BTC_ADDRESS = '0x979aB023e9F63f86eA08625BdAc258058a28D609'; -const BTC_STABILITY_POOL_ADDRESS = "0x35d7d7Aeb582523285C56082e0A282678540f356"; - -const U_DAI_ADDRESS = '0x9fee03160502782CeB5845e8799638AF351D1Ed5'; -const DAI_STABILITY_POOL_ADDRESS = "0x7Dd93401Df9BDe8a61d43ee99511CA658685f0BD"; -*/ // --- staking --- async function stakingTvl(_, _ethBlock, chainBlocks) { const StakesBalance = ( await sdk.api.abi.call({ target: TOKEN_STAKING_ADDRESS, - abi: totalTokenStakedAbi, + abi: "uint256:totalTokenStaked", block: chainBlocks['avax'], chain: 'avax' }) @@ -64,169 +40,10 @@ async function stakingTvl(_, _ethBlock, chainBlocks) { } -/* -async function tvl(_, _ethBlock, chainBlocks) { - - - - - // --- farm --- - const FarmPoolLPBalance_SUSD_USDC = ( - await sdk.api.erc20.balanceOf({ - target: LP_ADDRESS_SUSD_USDC, - owner: FARM_ADDRESS_SUSD_USDC, - block: chainBlocks['avax'], - chain: 'avax' - }) - ).output; - - const LPTotalSupply_SUSD_USDC = ( - await sdk.api.erc20.totalSupply({ - target: LP_ADDRESS_SUSD_USDC, - block: chainBlocks['avax'], - chain: 'avax' - }) - ).output; - - const LPValue_SUSD_USDC = ( - await sdk.api.erc20.balanceOf({ - target: AVAX_USDC_ADDRESS, - owner: LP_ADDRESS_SUSD_USDC, - block: chainBlocks['avax'], - chain: 'avax' - }) - ).output; - - const FarmPoolBalance_SUSD_USDC = BigNumber(LPValue_SUSD_USDC).times(2).times(FarmPoolLPBalance_SUSD_USDC).div(LPTotalSupply_SUSD_USDC); - - const FarmPoolLPBalance_SET_USDC = ( - await sdk.api.erc20.balanceOf({ - target: LP_ADDRESS_SET_USDC, - owner: FARM_ADDRESS_SET_USDC, - block: chainBlocks['avax'], - chain: 'avax' - }) - ).output; - - const LPTotalSupply_SET_USDC = ( - await sdk.api.erc20.totalSupply({ - target: LP_ADDRESS_SET_USDC, - block: chainBlocks['avax'], - chain: 'avax' - }) - ).output; - - const LPValue_SET_USDC = ( - await sdk.api.erc20.balanceOf({ - target: AVAX_USDC_ADDRESS, - owner: LP_ADDRESS_SET_USDC, - block: chainBlocks['avax'], - chain: 'avax' - }) - ).output; - - const FarmPoolBalance_SET_USDC = BigNumber(LPValue_SET_USDC).times(2).times(FarmPoolLPBalance_SET_USDC).div(LPTotalSupply_SET_USDC); - - const FarmPoolBalance = FarmPoolBalance_SUSD_USDC.plus(FarmPoolBalance_SET_USDC); - - - // --- System Coll --- - - const AVAXBalance = ( - await sdk.api.abi.call({ - target: AVAX_TROVE_MANAGER_ADDRESS, - abi: getEntireSystemCollAbi, - block: chainBlocks['avax'], - chain: 'avax' - }) - ).output; - - const ETHBalance = ( - await sdk.api.abi.call({ - target: ETH_TROVE_MANAGER_ADDRESS, - abi: getEntireSystemCollAbi, - block: chainBlocks['avax'], - chain: 'avax' - }) - ).output; - - const BTCBalance = ( - await sdk.api.abi.call({ - target: BTC_TROVE_MANAGER_ADDRESS, - abi: getEntireSystemCollAbi, - block: chainBlocks['avax'], - chain: 'avax' - }) - ).output; - - const DAIBalance = ( - await sdk.api.abi.call({ - target: DAI_TROVE_MANAGER_ADDRESS, - abi: getEntireSystemCollAbi, - block: chainBlocks['avax'], - chain: 'avax' - }) - ).output; - - - // --- Stability pool --- - - const StabilityPoolBalanceOfAVAX = ( - await sdk.api.erc20.balanceOf({ - target: U_AVAX_ADDRESS, - owner: AVAX_STABILITY_POOL_ADDRESS, - block: chainBlocks['avax'], - chain: 'avax' - }) - ).output; - - const StabilityPoolBalanceOfETH = ( - await sdk.api.erc20.balanceOf({ - target: U_ETH_ADDRESS, - owner: ETH_STABILITY_POOL_ADDRESS, - block: chainBlocks['avax'], - chain: 'avax' - }) - ).output; - - const StabilityPoolBalanceOfBTC = ( - await sdk.api.erc20.balanceOf({ - target: U_BTC_ADDRESS, - owner: BTC_STABILITY_POOL_ADDRESS, - block: chainBlocks['avax'], - chain: 'avax' - }) - ).output; - - const StabilityPoolBalanceOfDAI = ( - await sdk.api.erc20.balanceOf({ - target: U_DAI_ADDRESS, - owner: DAI_STABILITY_POOL_ADDRESS, - block: chainBlocks['avax'], - chain: 'avax' - }) - ).output; - - const StabilityPoolTotalBalance = - BigNumber(StabilityPoolBalanceOfAVAX) - .plus(StabilityPoolBalanceOfETH) - .plus(StabilityPoolBalanceOfBTC) - .plus(StabilityPoolBalanceOfDAI).toFixed(); - - return { - - [USDC_ADDRESS]: FarmPoolBalance, - [SUSD_ADDRESS]: StabilityPoolTotalBalance, - [AVAX_ADDRESS]: AVAXBalance, - [ETH_ADDRESS] : ETHBalance, - [BTC_ADDRESS] : BTCBalance, - [DAI_ADDRESS] : DAIBalance}; -} -*/ module.exports = { avax:{ tvl: sdk.util.sumChainTvls([ - getLiquityTvl(ETH_ADDRESS,ETH_TROVE_MANAGER_ADDRESS,"avax",transformAvaxAddress), + getLiquityTvl(ETH_ADDRESS,ETH_TROVE_MANAGER_ADDRESS,"avax",addr => 'avax:'+addr), getLiquityTvl(BTC_ADDRESS,BTC_TROVE_MANAGER_ADDRESS,"avax"), getLiquityTvl(AVAX_ADDRESS,AVAX_TROVE_MANAGER_ADDRESS,"avax"), getLiquityTvl(DAI_ADDRESS,DAI_TROVE_MANAGER_ADDRESS,"avax"), diff --git a/projects/stabilizefi/totalTokenStaked.abi.json b/projects/stabilizefi/totalTokenStaked.abi.json deleted file mode 100644 index 8e042400b09..00000000000 --- a/projects/stabilizefi/totalTokenStaked.abi.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "inputs": [], - "name": "totalTokenStaked", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" -} \ No newline at end of file diff --git a/projects/stabl-v2/abi.json b/projects/stabl-v2/abi.json new file mode 100644 index 00000000000..0d3c5315772 --- /dev/null +++ b/projects/stabl-v2/abi.json @@ -0,0 +1,5 @@ +{ + "getAllAssets": "address[]:getAllAssets", + "checkBalance": "function checkBalance(address _asset) view returns (uint256 balance)", + "isSupportedAsset": "function supportsAsset(address _asset) view returns (bool)" + } \ No newline at end of file diff --git a/projects/stabl-v2/index.js b/projects/stabl-v2/index.js new file mode 100644 index 00000000000..e013ecb1861 --- /dev/null +++ b/projects/stabl-v2/index.js @@ -0,0 +1,39 @@ +const sdk = require("@defillama/sdk"); +const abi = require("./abi.json"); + +const vault = "0x2D62f6D8288994c7900e9C359F8a72e84D17bfba"; + +const polygonTvl = async (timestamp, ethBlock, chainBlocks) => { + const balances = {}; + + const stablecoins = ( + await sdk.api.abi.call({ + abi: abi.getAllAssets, + target: vault, + block: chainBlocks['polygon'], + chain: 'polygon' + }) + ).output; + + for (let i = 0; i < stablecoins.length; i++) { + const balance_stablecoin = ( + await sdk.api.abi.call({ + abi: abi.checkBalance, + target: vault, + params: stablecoins[i], + block: chainBlocks['polygon'], + chain: 'polygon' + }) + ).output; + + sdk.util.sumSingleBalance(balances, stablecoins[i], balance_stablecoin,'polygon'); + } + + return balances; +}; + +module.exports = { + polygon: { + tvl: polygonTvl, + }, +}; diff --git a/projects/stabl/index.js b/projects/stabl/index.js index c5f62f4f4b9..fdfba33a847 100644 --- a/projects/stabl/index.js +++ b/projects/stabl/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const vaults = { @@ -5,22 +6,10 @@ const vaults = { } const assets = { - polygon: "0x2791bca1f2de4661ed88a30c99a7a9449aa84174", //USDC + polygon: ADDRESSES.polygon.USDC, //USDC } -const abi = { - "inputs": [], - "name": "checkBalance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" -} +const abi = "uint256:checkBalance" module.exports = { misrepresentedTokens: true, @@ -31,7 +20,8 @@ Object.keys(vaults).forEach(chain => { tvl: async (_, _b, {[chain]: block}) => { const { output } = await sdk.api.abi.call({ chain, block, abi, target: vaults[chain]}) return { - [`${chain}:${assets[chain]}`]: output + // refilling wont work because at mar 26th the decimals used by checkBalance() changed + [`${chain}:${assets[chain]}`]: output/100 } } } diff --git a/projects/stabledoin/index.js b/projects/stabledoin/index.js index b0ca812c78b..3b72f821e39 100644 --- a/projects/stabledoin/index.js +++ b/projects/stabledoin/index.js @@ -5,6 +5,9 @@ const factory = "0x7bbAB21475d99C09a92fc4B93Fa2DDa987DbA17c" module.exports = { misrepresentedTokens: true, + hallmarks: [ + [1666656000, "Rug Pull"] + ], dogechain: { tvl: sdk.util.sumChainTvls([ getUniTVL({ chain: 'dogechain', factory, useDefaultCoreAssets: true, }), diff --git a/projects/stablekoi/abi.json b/projects/stablekoi/abi.json index d676bf44882..7e8058d689a 100644 --- a/projects/stablekoi/abi.json +++ b/projects/stablekoi/abi.json @@ -1,17 +1,3 @@ { - "totalSupply": { - "constant": true, - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } -} + "totalSupply": "uint256:totalSupply" +} \ No newline at end of file diff --git a/projects/stablekoi/index.js b/projects/stablekoi/index.js index 3c9136f6660..fba993ed4a0 100644 --- a/projects/stablekoi/index.js +++ b/projects/stablekoi/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens } = require("../helper/unwrapLPs"); const { getFixBalances } = require("../helper/portedTokens"); const { GraphQLClient, gql } = require("graphql-request"); @@ -5,7 +6,7 @@ const abi = require("./abi.json"); const sdk = require("@defillama/sdk"); const { default: BigNumber } = require("bignumber.js"); const { toUSDTBalances } = require("../helper/balances"); -const { get } = require('../helper/http') +const { getConfig } = require('../helper/cache') const chain = "godwoken"; @@ -13,7 +14,7 @@ async function tvl(ts, _block, chainBlocks) { const balances = {}; const fixBalances = await getFixBalances(chain); const tokensAndOwners = []; - const poolInfo = await get("https://app.stablekoi.com/lists/poollist.json"); + const poolInfo = await getConfig('stable-koi-v0', "https://app.stablekoi.com/lists/poollist.json"); poolInfo.forEach((pool) => { pool.tokens.forEach((token) => tokensAndOwners.push([token, pool.address])); }); @@ -99,7 +100,7 @@ const v1Pools = [ }, { "symbol": "USDC|bsc", - "address": "0xfA307CfdEA89DC197A346c338a98aC85d517af6e", + "address": ADDRESSES.godwoken_v1.USDC_bsc, } ] }, @@ -127,7 +128,7 @@ const v1Pools = [ }, { "symbol": "USDT|bsc", - "address": "0xDFF2faCdFe47C1D5b51f18231f900949F1d5988f", + "address": ADDRESSES.godwoken_v1.USDT_bsc, } ] }, @@ -137,11 +138,11 @@ const v1Pools = [ "tokens": [ { "symbol": "WBTC|eth", - "address": "0x82455018F2c32943b3f12F4e59D0DA2FAf2257Ef", + "address": ADDRESSES.godwoken_v1.WBTC_eth, }, { "symbol": "BTCB|bsc", - "address": "0xEF2439e020509259FA603c34B35A81FFe676CFB4", + "address": ADDRESSES.godwoken_v1.BTCB_bsc, } ] } diff --git a/projects/stablz/index.js b/projects/stablz/index.js new file mode 100644 index 00000000000..9c3e33e54f7 --- /dev/null +++ b/projects/stablz/index.js @@ -0,0 +1,20 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { staking } = require("../helper/staking"); + +const USDT = ADDRESSES.ethereum.USDT; +const STABLZ_CANNAVEST_RWA_POOL = "0xa030f3e984A08B5Ada0377A9f4EaAF846E6A2cB0"; + +async function borrowed(_, block, _1, { api }) { + const bal = await api.call({ abi: 'erc20:totalSupply', target: STABLZ_CANNAVEST_RWA_POOL }) + const usdtBal = await api.call({ abi: 'erc20:balanceOf', target: USDT, params: STABLZ_CANNAVEST_RWA_POOL, }) + api.add(USDT, bal - usdtBal) +} + +module.exports = { + ethereum: { + borrowed, + tvl: staking(STABLZ_CANNAVEST_RWA_POOL, USDT), + staking: staking('0xdb6b004e34a7750e30e59e11281fcb0c73666990', '0xA4Eb9C64eC359D093eAc7B65F51Ef933D6e5F7cd') + }, + methodology: "Gets the TVL in USDT from the Stablz Cannavest (real world asset) smart contract", +}; diff --git a/projects/stacker/index.js b/projects/stacker/index.js index 570509cff4e..b882d291df3 100644 --- a/projects/stacker/index.js +++ b/projects/stacker/index.js @@ -1,10 +1,11 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk'); const vaults = [ // farm, token used - ['0x067b9FE006E16f52BBf647aB6799f87566480D2c', '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48'], // USDC - ['0x70e51DFc7A9FC391995C2B2f027BC49D4fe01577', '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'], // WETH - ['0x17E9ed51feD2F190D50f5bd4f1a8C9CbCd36162A', '0x2260fac5e5542a773aa44fbcfedf7c193bc2c599'], // WBTC + ['0x067b9FE006E16f52BBf647aB6799f87566480D2c', ADDRESSES.ethereum.USDC], // USDC + ['0x70e51DFc7A9FC391995C2B2f027BC49D4fe01577', ADDRESSES.ethereum.WETH], // WETH + ['0x17E9ed51feD2F190D50f5bd4f1a8C9CbCd36162A', ADDRESSES.ethereum.WBTC], // WBTC ] async function tvl(timestamp, block, chainBlocks) { diff --git a/projects/stacks/index.js b/projects/stacks/index.js index 553e782d3d7..f2624c3dcec 100644 --- a/projects/stacks/index.js +++ b/projects/stacks/index.js @@ -9,6 +9,7 @@ async function tvl(timestamp) { } module.exports = { + timetravel: false, stacks: { tvl }, diff --git a/projects/stackswap/api.js b/projects/stackswap/api.js new file mode 100644 index 00000000000..89c64945e2d --- /dev/null +++ b/projects/stackswap/api.js @@ -0,0 +1,38 @@ +const sdk = require('@defillama/sdk') +const { call } = require('../helper/chain/stacks-api') +const { transformDexBalances } = require('../helper/portedTokens') +const { getCache, setCache, } = require('../helper/cache') + +const factory = 'SP1Z92MPDQEWZXW36VX71Q25HKF5K2EPCJ304F275.stackswap-swap-v5k' + +module.exports = { + stacks: { tvl } +} + +async function tvl(_, _b, _cb, { api, }) { + const data = [] + const { value: pairCount } = await call({ target: factory, abi: 'get-pair-count' }) + const cache = await getCache('stackswap', 'stacks-config') + if (!cache.pairData) cache.pairData = [] + for (let i = cache.pairData.length +1; i <= pairCount; i++) { + const pair = await call({ target: factory, abi: 'get-pair-contracts', inputArgs: [{ type: 'number', value: i }] }) + cache.pairData.push(pair) + console.log('pair count: ', cache.pairData.length) + } + + await setCache('stackswap', 'stacks-config', cache) + let j = 0 + + for (const pair of cache.pairData) { + if (pair['liquidity-token'].value === 'SP1Z92MPDQEWZXW36VX71Q25HKF5K2EPCJ304F275.liquidity-token-v5krqbd8nh6') continue // ignore STSW-lBTC + const pairData = await call({ target: pair['liquidity-token'].value, abi: 'get-lp-data', }) + data.push({ + token0: pair['token-x'].value, + token1: pair['token-y'].value, + token0Bal: +pairData.value['balance-x'].value + +pairData.value['fee-balance-x'].value, + token1Bal: +pairData.value['balance-y'].value + +pairData.value['fee-balance-y'].value, + }) + console.log('pair data: ',++j) + } + return transformDexBalances({ chain: 'stacks', data}) +} \ No newline at end of file diff --git a/projects/stader/index.js b/projects/stader/index.js index 4c4ffac9f1e..1906dc87982 100644 --- a/projects/stader/index.js +++ b/projects/stader/index.js @@ -1,44 +1,51 @@ -const { fetchURL } = require("../helper/utils") +const { nullAddress, sumTokens2 } = require('../helper/unwrapLPs') +const { get } = require("../helper/http") +let _res + +async function getData() { + if (!_res) _res = get("https://universe.staderlabs.com/common/tvl") + return _res +} async function hbarTvl(timestamp) { - const res = await fetchURL("https://staderverse.staderlabs.com/tvl") + const res = await get("https://universe.staderlabs.com/common/tvl") return { - "hedera-hashgraph": res.data.hedera.native + "hedera-hashgraph": res.hedera.native } } async function maticTvl() { - const res = await fetchURL("https://staderverse.staderlabs.com/tvl") + const res = await getData() return { - "matic-network": res.data.polygon.native + "matic-network": res.polygon.native } } async function ftmTvl() { - const res = await fetchURL("https://staderverse.staderlabs.com/tvl") + const res = await getData() return { - "fantom": res.data.fantom.native + "fantom": res.fantom.native } } async function terra2Tvl() { - const res = await fetchURL("https://staderverse.staderlabs.com/tvl") + const res = await getData() return { - "terra-luna-2": res.data.terra.native + "terra-luna-2": res.terra.native } } async function bscTvl() { - const res = await fetchURL("https://staderverse.staderlabs.com/tvl") + const res = await getData() return { - "binancecoin": res.data.bnb.native + "binancecoin": res.bnb.native } } async function nearTvl() { - const res = await fetchURL("https://staderverse.staderlabs.com/tvl") + const res = await getData() return { - "near": res.data.near.native + "near": res.near.native } } @@ -52,9 +59,9 @@ module.exports = { tvl: hbarTvl, }, // its on ethereum because funds are locked there - ethereum: { + /* ethereum: { tvl: maticTvl - }, + }, */ fantom: { tvl: ftmTvl }, @@ -67,7 +74,20 @@ module.exports = { near: { tvl: nearTvl }, - hallmarks:[ + ethereum: { + tvl: async (_, _1, _2, { api }) => { + + const res = await getData() + const nodeOperatorRegistry = '0x4f4bfa0861f62309934a5551e0b2541ee82fdcf1' + const nodeOperatorCount = await api.call({ abi: 'uint256:totalActiveValidatorCount', target: nodeOperatorRegistry }) + const balances = { + "matic-network": res.polygon.native, + [nullAddress]: +(await api.call({ abi: 'uint256:totalAssets', target: '0xcf5ea1b38380f6af39068375516daf40ed70d299' })) + +nodeOperatorCount * 4 * 1e18 // 4 ETH per node operator + } + return sumTokens2({ api, balances, owner: nodeOperatorRegistry, tokens: [nullAddress] }) + } + }, + hallmarks: [ [1651881600, "UST depeg"], ] } diff --git a/projects/stafi/index.js b/projects/stafi/index.js index b39be88f9b7..da7757101b5 100644 --- a/projects/stafi/index.js +++ b/projects/stafi/index.js @@ -1,10 +1,11 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk'); const {chainExports} = require('../helper/exports') const {usdtAddress} = require('../helper/balances') const {getApiTvl} = require('../helper/historicalApi'); const { fetchURL } = require('../helper/utils'); -const wethAddress = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2' +const wethAddress = ADDRESSES.ethereum.WETH async function ethereum(timestamp, block) { const supply = await sdk.api.erc20.totalSupply({ @@ -24,6 +25,9 @@ const chainToParams={ kusama: ["RKSM", "kusama"], solana: ["RSOL", "solana"], cosmos: ["RATOM", "cosmos"], + carbon: ["RSWTH", "switcheo"], + chihuahua: ["RHUAHUA", "chihuahua-token"], + irisnet:["RIRIS","iris-network"] } function getTvlFunction(token, cgId){ @@ -53,17 +57,17 @@ function chainTvl(chain){ module.exports = { timetravel: true, ethereum: { - tvl: ethereum, + tvl: sdk.util.sumChainTvls([chainTvl('polygon'), ethereum]), staking: getTvlFunction("RFIS", "stafi") }, bsc: { tvl: chainTvl('bsc') - }, + },/* polygon: { - tvl: chainTvl('polygon') - }, + tvl: chainTvl('polygon') //exported along with ethereum tvl since MATIC's are staked on the Ethereum Mainnet + },*/ cosmos: { - tvl: chainTvl('cosmos') + tvl: sdk.util.sumChainTvls([chainTvl('cosmos'), chainTvl('carbon'), chainTvl('chihuahua'), chainTvl('irisnet')]) }, solana: { tvl: chainTvl('solana') diff --git a/projects/stake-ly/index.js b/projects/stake-ly/index.js index 17c0db6b111..771aa48d036 100644 --- a/projects/stake-ly/index.js +++ b/projects/stake-ly/index.js @@ -8,13 +8,7 @@ async function tvl(timestamp, _ethBlock, {klaytn: block}) { block, chain, target: stKlayAddress, - abi: { - inputs: [], - name: "totalStaking", - outputs: [{ internalType: "uint256", name: "", type: "uint256" }], - stateMutability: "view", - type: "function", - }, + abi: "uint256:totalStaking", }); return { diff --git a/projects/stake1/abi.json b/projects/stake1/abi.json index c5fe11d4f9e..02e2ecaf6fb 100644 --- a/projects/stake1/abi.json +++ b/projects/stake1/abi.json @@ -1,28 +1,4 @@ { - "see_s1ftm_circ": { - "inputs": [], - "name": "see_s1ftm_circ", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "see_s1tomb_circ": { - "inputs": [], - "name": "see_s1tomb_circ", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } + "see_s1ftm_circ": "uint256:see_s1ftm_circ", + "see_s1tomb_circ": "uint256:see_s1tomb_circ" } \ No newline at end of file diff --git a/projects/stake1/index.js b/projects/stake1/index.js index 371de8a7470..e2dff319787 100644 --- a/projects/stake1/index.js +++ b/projects/stake1/index.js @@ -12,7 +12,7 @@ async function vaultTvl(balances, block, abi, target, coin) { })).output); sdk.util.sumSingleBalance(balances, coin, ftmStaked); -}; +} async function tvl(timestamp, block, chainBlocks) { const balances = {}; @@ -65,7 +65,7 @@ async function tvl(timestamp, block, chainBlocks) { sdk.util.sumSingleBalance(balances, contracts.DAI, daiBalances); return balances; -}; +} module.exports = { fantom: { diff --git a/projects/stakedao/abi.json b/projects/stakedao/abi.json index 8500a5ef995..7e832423f38 100644 --- a/projects/stakedao/abi.json +++ b/projects/stakedao/abi.json @@ -1,210 +1,7 @@ { - "balance": { - "constant": true, - "inputs": [], - "name": "balance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "balanceOf": { - "constant": true, - "name": "balanceOf", - "inputs": [ - { - "type": "address", - "name": "arg0" - } - ], - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "collateralMap": { - "constant": true, - "name":"collateralMap", - "outputs": [ - { - "internalType":"contract IERC20", - "name":"token", - "type":"address" - }, - { - "internalType":"contract ISanToken", - "name":"sanToken", - "type":"address" - }, - { - "internalType":"contract IPerpetualManager", - "name":"perpetualManager", - "type":"address" - }, - { - "internalType":"contract IOracle", - "name":"oracle", - "type":"address" - }, - { - "internalType":"uint256", - "name":"stocksUsers", - "type":"uint256" - }, - { - "internalType":"uint256", - "name":"sanRate", - "type":"uint256" - }, - { - "internalType":"uint256", - "name":"collatBase", - "type":"uint256" - }, - { - "components":[ - { - "internalType":"uint256", - "name":"lastBlockUpdated", - "type":"uint256" - }, - { - "internalType":"uint256", - "name":"lockedInterests", - "type":"uint256" - }, - { - "internalType":"uint256", - "name":"maxInterestsDistributed", - "type":"uint256" - }, - { - "internalType":"uint256", - "name":"feesAside", - "type":"uint256" - }, - { - "internalType":"uint64", - "name":"slippageFee", - "type":"uint64" - }, - { - "internalType":"uint64", - "name":"feesForSLPs", - "type":"uint64" - }, - { - "internalType":"uint64", - "name":"slippage", - "type":"uint64" - }, - { - "internalType":"uint64", - "name":"interestsForSLPs", - "type":"uint64" - } - ],"internalType":"struct SLPData","name":"slpData","type":"tuple" - }, - { - "components":[ - { - "internalType":"uint64[]", - "name":"xFeeMint", - "type":"uint64[]" - }, - { - "internalType":"uint64[]", - "name":"yFeeMint", - "type":"uint64[]" - }, - { - "internalType":"uint64[]", - "name":"xFeeBurn", - "type":"uint64[]" - }, - { - "internalType":"uint64[]", - "name":"yFeeBurn", - "type":"uint64[]" - }, - { - "internalType":"uint64", - "name":"targetHAHedge", - "type":"uint64" - }, - { - "internalType":"uint64", - "name":"bonusMalusMint", - "type":"uint64" - }, - { - "internalType":"uint64", - "name":"bonusMalusBurn", - "type":"uint64" - }, - { - "internalType":"uint256", - "name":"capOnStableMinted", - "type":"uint256" - } - ], "internalType":"struct MintBurnData","name":"feeData","type":"tuple" - } - ], - "inputs": [ - { - "internalType":"contract IPoolManager", - "name":"", - "type":"address" - } - ], - "stateMutability":"view", - "type":"function" - }, - "bal": { - "inputs": [], - "name": "bal", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "locked": { - "name": "locked", - "outputs": [ - { - "type": "int128", - "name": "amount" - }, - { - "type": "uint256", - "name": "end" - } - ], - "inputs": [ - { - "type": "address", - "name": "arg0" - } - ], - "stateMutability": "view", - "type": "function", - "gas": 3359 - } + "balance": "uint256:balance", + "balanceOf": "function balanceOf(address arg0) view returns (uint256)", + "collateralMap": "function collateralMap(address) view returns (address token, address sanToken, address perpetualManager, address oracle, uint256 stocksUsers, uint256 sanRate, uint256 collatBase, tuple(uint256 lastBlockUpdated, uint256 lockedInterests, uint256 maxInterestsDistributed, uint256 feesAside, uint64 slippageFee, uint64 feesForSLPs, uint64 slippage, uint64 interestsForSLPs) slpData, tuple(uint64[] xFeeMint, uint64[] yFeeMint, uint64[] xFeeBurn, uint64[] yFeeBurn, uint64 targetHAHedge, uint64 bonusMalusMint, uint64 bonusMalusBurn, uint256 capOnStableMinted) feeData)", + "bal": "uint256:bal", + "locked": "function locked(address arg0) view returns (int128 amount, uint256 end) @3359" } \ No newline at end of file diff --git a/projects/stakedao/index.js b/projects/stakedao/index.js index a195a92a0fb..9382c955e77 100644 --- a/projects/stakedao/index.js +++ b/projects/stakedao/index.js @@ -1,332 +1,296 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const abi = require('./abi.json') -const { unwrapCrv } = require('../helper/unwrapLPs') -const { transformAvaxAddress, transformBscAddress } = require('../helper/portedTokens'); -const BigNumber = require("bignumber.js"); +const { sumTokens2 } = require('../helper/unwrapLPs') +const { getConfig } = require('../helper/cache'); -// Mainnet -const crv_3crv_vault = { - contract: '0xB17640796e4c27a39AF51887aff3F8DC0daF9567', - crvToken: '0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490', - abi: 'balance' -} -const crv_eurs_vault = { - contract: '0xCD6997334867728ba14d7922f72c893fcee70e84', - crvToken: '0x194eBd173F6cDacE046C53eACcE9B953F28411d1', - abi: 'balance' -} -const crv_btc_vault = { - contract: '0x24129B935AfF071c4f0554882C0D9573F4975fEd', - crvToken: '0x075b1bb99792c9E1041bA13afEf80C91a1e70fB3', - abi: 'balance' -} -const crv_frax_vault = { - contract: '0x5af15DA84A4a6EDf2d9FA6720De921E1026E37b7', - crvToken: '0xd632f22692FaC7611d2AA1C0D552930D43CAEd3B', - abi: 'balance' -} -const crv_frax_vault2 = { - contract: '0x99780beAdd209cc3c7282536883Ef58f4ff4E52F', - crvToken: '0xd632f22692FaC7611d2AA1C0D552930D43CAEd3B', - abi: 'balance' -} -const crv_eth_vault = { - contract: '0xa2761B0539374EB7AF2155f76eb09864af075250', - crvToken: '0xA3D87FffcE63B53E0d54fAa1cc983B7eB0b74A9c', - abi: 'balance' -} -const crv_perpetual_vault = { - contract: '0x52f541764E6e90eeBc5c21Ff570De0e2D63766B6', - crvToken: '0x5f3b5DfEb7B28CDbD7FAba78963EE202a494e2A2', - abi: 'locked' -} -const crv_steth_vault = { - contract: '0xbC10c4F7B9FE0B305e8639B04c536633A3dB7065', - crvToken: '0x06325440D014e39736583c165C2963BA99fAf14E', - abi:'balance' -} -const angle_vault = { - contract: '0x79B738e404208e9607c3B4D4B3800Ed0d4A0e05F', - sanUsdcEurGauge: '0x51fE22abAF4a26631b2913E417c0560D547797a7', - usdcToken: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', - stableMasteFront: '0x5adDc89785D75C86aB939E9e15bfBBb7Fc086A87', - usdcPoolManager: '0xe9f183FC656656f1F17af1F2b0dF79b8fF9ad8eD', - abi:'balanceOf', - abiCM: 'collateralMap' -} -const fxs_locker_vault = { - contract: '0xCd3a267DE09196C48bbB1d9e842D7D7645cE448f', - veFxsToken: '0xc8418aF6358FFddA74e09Ca9CC3Fe03Ca6aDC5b0', - abi: 'locked' -} -const angle_locker_vault = { - contract: '0xD13F8C25CceD32cdfA79EB5eD654Ce3e484dCAF5', - veAngleToken: '0x0C462Dbb9EC8cD1630f1728B2CFD2769d09f0dd5', - abi: 'locked' -} +const STRATEGIES_ENDPOINT = 'https://lockers.stakedao.org/api/strategies/cache'; +const LOCKERS_ENDPOINT = 'https://lockers.stakedao.org/api/lockers/cache'; -// Polygon -const crv_3crv_vault_polygon = { - contract: '0x7d60F21072b585351dFd5E8b17109458D97ec120', - crvToken: '0xE7a24EF0C5e95Ffb0f6684b813A78F2a3AD7D171', - abi: 'balance' -} -const crv_btc_vault_polygon = { - contract: '0x953Cf8f1f097c222015FFa32C7B9e3E96993b8c1', - crvToken: '0xf8a57c1d3b9629b77b6726a042ca48990A84Fb49', - abi: 'balance' -} +async function strategiesCurveBalancer(timestamp, block) { + const resp = await Promise.all([ + getConfig('stakedao/curve', `${STRATEGIES_ENDPOINT}/curve`), + getConfig('stakedao/balancer', `${STRATEGIES_ENDPOINT}/balancer`) + ]); -// Avalanche -const crv_3crv_vault_avalanche = { - contract: '0x0665eF3556520B21368754Fb644eD3ebF1993AD4', - crvToken: '0x1337BedC9D22ecbe766dF105c9623922A27963EC', - abi: 'balance' -} + const strats = resp[0].concat(resp[1]) + const lgv4 = strats.map((strat) => [strat.infos.protocolLiquidityGaugeV4, strat.infos.angleLocker || strat.infos.curveLocker]) -// Harmony -const crv_3crv_vault_harmony = { - contract: '0x787C95Fb37FFc32e36121aD49CA27b7E3D45b77e', - crvToken: '0xC5cfaDA84E902aD92DD40194f0883ad49639b023', - abi: 'balance' + return lgv4 } -// BSC -const btcEPS_vault_bsc = { - contract: '0xf479e1252481360f67c2b308F998395cA056a77f', - crvToken: '0x2a435ecb3fcc0e316492dc1cdd62d0f189be5640', - abi: 'balance' -} -const EPS3_vault_bsc = { - contract: '0x4835BC54e87ff7722a89450dc26D9dc2d3A69F36', - crvToken: '0xaf4de8e872131ae328ce21d909c74705d3aaf452', - abi: 'balance' -} -const fusdt3EPS_vault_bsc = { - contract: '0x8E724986B08F2891cD98F7F71b5F52E7CFF420de', - crvToken: '0x373410a99b64b089dfe16f1088526d399252dace', - abi: 'balance' -} +async function tvl(timestamp, block, _, { api }) { + let balances = {} + ///////////////////////////////////////////////////////////////////// + // --- STRATEGIES V2 + ///////////////////////////////////////////////////////////////////// + // ==== Addresses ==== // + const crv3_vault_v2 = { + contract: '0xB17640796e4c27a39AF51887aff3F8DC0daF9567', + token: '0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490', + } + const eurs_vault_v2 = { + contract: '0xCD6997334867728ba14d7922f72c893fcee70e84', + token: '0x194eBd173F6cDacE046C53eACcE9B953F28411d1', + } + const frax_vault_v2 = { + contract: '0x5af15DA84A4a6EDf2d9FA6720De921E1026E37b7', + token: '0xd632f22692FaC7611d2AA1C0D552930D43CAEd3B', + } + const frax_vault2_v2 = { + contract: '0x99780beAdd209cc3c7282536883Ef58f4ff4E52F', + token: '0xd632f22692FaC7611d2AA1C0D552930D43CAEd3B', + } + const eth_vault_v2 = { + contract: '0xa2761B0539374EB7AF2155f76eb09864af075250', + token: '0xA3D87FffcE63B53E0d54fAa1cc983B7eB0b74A9c', + } + const steth_vault_v2 = { + contract: '0xbC10c4F7B9FE0B305e8639B04c536633A3dB7065', + token: '0x06325440D014e39736583c165C2963BA99fAf14E', + } + let vaults = [ + crv3_vault_v2, + eurs_vault_v2, + frax_vault_v2, + frax_vault2_v2, + eth_vault_v2, + steth_vault_v2 + ] + const vaultBals = await api.multiCall({ + abi: abi['balance'], + calls: vaults.map(i => i.contract), + }) + vaultBals.forEach((bal, i) => sdk.util.sumSingleBalance(balances, vaults[i].token, bal)) -const vaults = [ - crv_3crv_vault, - crv_eurs_vault, - crv_btc_vault, - crv_frax_vault, - crv_frax_vault2, - crv_eth_vault, - crv_steth_vault, -] + ///////////////////////////////////////////////////////////////////// + // --- STRATEGIES ANGLE + ///////////////////////////////////////////////////////////////////// + // ==== Addresses ==== // + const angle_protocol = { + stableMasteFront: '0x5adDc89785D75C86aB939E9e15bfBBb7Fc086A87', + usdcPoolManager: '0xe9f183FC656656f1F17af1F2b0dF79b8fF9ad8eD', + fraxPoolManager: '0x6b4eE7352406707003bC6f6b96595FD35925af48', + daiPoolManager: '0xc9daabC677F3d1301006e723bD21C60be57a5915', + locker: '0xD13F8C25CceD32cdfA79EB5eD654Ce3e484dCAF5', + abiCM: 'collateralMap' + } + const angle_sanUSDC_V3 = { + contract: angle_protocol.locker, + sanUsdcEurGauge: '0x51fE22abAF4a26631b2913E417c0560D547797a7', + usdcToken: ADDRESSES.ethereum.USDC, + abi: 'balanceOf', + } + const angle_sanDAI_V3 = { + contract: angle_protocol.locker, + sanDaiEurGauge: '0x8E2c0CbDa6bA7B65dbcA333798A3949B07638026', + daiToken: ADDRESSES.ethereum.DAI, + abi: 'balanceOf', + } + const angle_sanFRAX_V3 = { + contract: angle_protocol.locker, + sanFraxEurGauge: '0xb40432243E4F317cE287398e72Ab8f0312fc2FE8', + fraxToken: ADDRESSES.ethereum.FRAX, + abi: 'balanceOf', + } + const angle_sushi_agEUR_V3 = { + contract: angle_protocol.locker, + sushiAgEURGauge: '0xBa625B318483516F7483DD2c4706aC92d44dBB2B', + sushiAgEURToken: '0x1f4c763BdE1D4832B3EA0640e66Da00B98831355', + abi: 'balanceOf', + } + const angle_guni_agEUR_usdc_V3 = { + contract: angle_protocol.locker, + guniAgEURUsdcGauge: '0xEB7547a8a734b6fdDBB8Ce0C314a9E6485100a3C', + guniAgEURUsdcToken: '0xEDECB43233549c51CC3268b5dE840239787AD56c', + abi: 'balanceOf', + } -const vaultsPolygon = [ - crv_3crv_vault_polygon, - crv_btc_vault_polygon -] + // ==== Calls Balance ==== // + const [ + sanUsdcEurV3, + sanDaiEurV3, + sanFraxEurV3, + angleSushiAgEurV3, + angleGuniAgEurUSDCV3, + ] = await api.multiCall({ + abi: abi[angle_sanUSDC_V3.abi], calls: [ + angle_sanUSDC_V3.sanUsdcEurGauge, + angle_sanDAI_V3.sanDaiEurGauge, + angle_sanFRAX_V3.sanFraxEurGauge, + angle_sushi_agEUR_V3.sushiAgEURGauge, + angle_guni_agEUR_usdc_V3.guniAgEURUsdcGauge, + ].map(i => ({ target: i, params: angle_sanUSDC_V3.contract })) + }) -const vaultsAvalanche = [ - crv_3crv_vault_avalanche -] + // ==== Calls Rate ==== // + const [ + sanUsdcEurRate, + sanDaiEurRate, + sanFraxEurRate, + ] = (await api.multiCall({ + abi: abi[angle_protocol.abiCM], calls: [{ + target: angle_protocol.stableMasteFront, + params: angle_protocol.usdcPoolManager + }, { + target: angle_protocol.stableMasteFront, + params: angle_protocol.daiPoolManager + }, { + target: angle_protocol.stableMasteFront, + params: angle_protocol.fraxPoolManager + },] + })).map(i => i.sanRate) -const vaultsHarmony = [ - crv_3crv_vault_harmony -] + // ==== Map ==== // + //sdk.util.sumSingleBalance(balances, angle_sanUSDC_V2.usdcToken, ((await sanUsdcEurV2) * sanUsdcEurRate / 10**18)) + sdk.util.sumSingleBalance(balances, angle_sanUSDC_V3.usdcToken, (sanUsdcEurV3 * sanUsdcEurRate / 10 ** 18)) + sdk.util.sumSingleBalance(balances, angle_sanDAI_V3.daiToken, ((sanDaiEurV3 * sanDaiEurRate / 10 ** 18))) + sdk.util.sumSingleBalance(balances, angle_sanFRAX_V3.fraxToken, ((sanFraxEurV3 * sanFraxEurRate / 10 ** 18))) + sdk.util.sumSingleBalance(balances, angle_sushi_agEUR_V3.sushiAgEURToken, angleSushiAgEurV3) + sdk.util.sumSingleBalance(balances, angle_guni_agEUR_usdc_V3.guniAgEURUsdcToken, angleGuniAgEurUSDCV3) -const vaultsBsc = [ - btcEPS_vault_bsc, - EPS3_vault_bsc, - fusdt3EPS_vault_bsc -] + const strategies = await strategiesCurveBalancer() -const sanctuary = '0xaC14864ce5A98aF3248Ffbf549441b04421247D3' -const arbStrat = '0x20D1b558Ef44a6e23D9BF4bf8Db1653626e642c3' -const veSdt = '0x0C30476f66034E11782938DF8e4384970B6c9e8a' -const sdtToken = '0x73968b9a57c6E53d41345FD57a6E6ae27d6CDB2F' -const crvToken = '0xD533a949740bb3306d119CC777fa900bA034cd52' -const fxsToken = '0x3432B6A60D23Ca0dFCa7761B7ab56459D9C964D0' -const angleToken = '0x31429d1856aD1377A8A0079410B297e1a9e214c2' + ///////////////////////////////////////////////////////////////////// + // --- LIQUID LOCKERS + ///////////////////////////////////////////////////////////////////// + const resp = await getConfig('stakedao/locker', LOCKERS_ENDPOINT) -async function ethereum(timestamp, block) { - let balances = {}; - const crvInPerpetual = sdk.api.abi.call({ - target: crv_perpetual_vault.crvToken, - block, - abi: abi[crv_perpetual_vault.abi], - params: crv_perpetual_vault.contract - }) - const fxsInLocker = sdk.api.abi.call({ - target: fxs_locker_vault.veFxsToken, - block, - abi: abi[fxs_locker_vault.abi], - params: fxs_locker_vault.contract - }) - const angleInLocker = sdk.api.abi.call({ - target: angle_locker_vault.veAngleToken, - block, - abi: abi[angle_locker_vault.abi], - params: angle_locker_vault.contract - }) - const sanUsdcEurInVault = sdk.api.abi.call({ - target: angle_vault.sanUsdcEurGauge, - block, - abi: abi[angle_vault.abi], - params: angle_vault.contract - }) - const collateralMap = sdk.api.abi.call({ - target: angle_vault.stableMasteFront, - block, - abi: abi[angle_vault.abiCM], - params: angle_vault.usdcPoolManager - }) - const sanUsdcEurRate = (await collateralMap).output.sanRate - const sanUsdcEurVaultBalance = (await sanUsdcEurInVault).output - await Promise.all(vaults.map(async vault=>{ - const crvBalance = await sdk.api.abi.call({ - target: vault.contract, - block, - abi: abi[vault.abi] - }) - await unwrapCrv(balances, vault.crvToken, crvBalance.output, block) - })) - sdk.util.sumSingleBalance(balances, crvToken, (await crvInPerpetual).output.amount) - sdk.util.sumSingleBalance(balances, fxsToken, (await fxsInLocker).output.amount) - sdk.util.sumSingleBalance(balances, angleToken, (await angleInLocker).output.amount) - sdk.util.sumSingleBalance(balances, angle_vault.usdcToken, (sanUsdcEurVaultBalance * sanUsdcEurRate / 10**18).toFixed(0)) - return balances -} + let lockersInfos = [] + for (let i = 0; i < resp.length; ++i) { + lockersInfos.push({ contract: `${resp[i].infos.locker}`, veToken: `${resp[i].infos.ve}`, token: `${resp[i].infos.token}` }) + } -async function staking(timestamp, block){ - const sdtInSactuary = await sdk.api.erc20.balanceOf({ - target: sdtToken, - owner: sanctuary, - block - }) + // To deal with special vePendle case + const vePendle = "0x4f30A9D41B80ecC5B94306AB4364951AE3170210" + const veMAV = "0x4949Ac21d5b2A0cCd303C20425eeb29DCcba66D8".toLowerCase() + const calls = [] + const callsPendle = [] + const callsMAV = [] + for (let i = 0; i < lockersInfos.length; ++i) { + if (lockersInfos[i].veToken == vePendle) { + callsPendle.push({ + target: lockersInfos[i].veToken, + params: lockersInfos[i].contract + }) + } else if (lockersInfos[i].veToken.toLowerCase() == veMAV) { + callsMAV.push({ + veToken: lockersInfos[i].veToken, + contract: lockersInfos[i].contract + }) + } else { + calls.push({ + target: lockersInfos[i].veToken, + params: lockersInfos[i].contract + }) + } + } - const sdtInArbStrategy = await sdk.api.erc20.balanceOf({ - target: sdtToken, - owner: arbStrat, - block - }) + let lockerBals = await api.multiCall({ abi: abi.locked, calls }) + let lockerPendleBal = await api.multiCall({ abi: "function positionData(address arg0) view returns (uint128 amount, uint128 end)", calls: callsPendle }) + let lockerMAVBal = [] - const sdtInLocker = await sdk.api.erc20.balanceOf({ - target: sdtToken, - owner: veSdt, - block - }) + for (const { contract, veToken } of callsMAV) { + const count = await api.call({ abi: 'function lockupCount(address) view returns (uint256)', target: veToken, params: contract }) + let balance = 0 + for (let i = 0; i < count; i++) { + const lockup = await api.call({ abi: 'function lockups(address,uint256) view returns (uint256 amount, uint256 end, uint256 points)', target: veToken, params: [contract, i] }) + balance += +lockup.amount + } + lockerMAVBal.push({ amount: balance, end: 0 }) + } - const totalSDTStaked = BigNumber(sdtInSactuary.output) - .plus(BigNumber(sdtInArbStrategy.output)) - .plus(BigNumber(sdtInLocker.output)) - .toFixed() + console.log(lockerBals, lockerPendleBal, lockerMAVBal) - return { - [sdtToken]:totalSDTStaked + for (let i = 0; i < lockersInfos.length; ++i) { + let amount; + if (lockersInfos[i].veToken == vePendle) { + amount = lockerPendleBal.shift().amount + } else if (lockersInfos[i].veToken.toLowerCase() == veMAV) { + amount = lockerMAVBal.shift().amount + } else { + amount = lockerBals.shift().amount + } + sdk.util.sumSingleBalance(balances, lockersInfos[i].token, amount) } -} -async function polygon(timestamp, ethBlock, chainBlocks) { - let balances = {}; - const block = chainBlocks.polygon - await Promise.all(vaultsPolygon.map(async vault=>{ - const crvBalance = await sdk.api.abi.call({ - target: vault.contract, - block, - abi: abi[vault.abi], - chain: 'polygon' - }) - await unwrapCrv(balances, vault.crvToken, crvBalance.output, block, 'polygon', addr=>`polygon:${addr}`) - })) - return balances + return sumTokens2({ api, tokensAndOwners: strategies, balances, }) } -async function avax(timestamp, ethBlock, chainBlocks) { - const transformAddress = await transformAvaxAddress() - let balances = {}; - const block = chainBlocks.avax - await Promise.all(vaultsAvalanche.map(async vault=>{ - const crvBalance = await sdk.api.abi.call({ - target: vault.contract, - block, - abi: abi[vault.abi], - chain: 'avax' - }) - await unwrapCrv(balances, vault.crvToken, crvBalance.output, block, 'avax', addr=>`avax:${addr}`) - })) - - // map from avax to ethereum token address - const dai_eth_address = transformAddress('0xbA7dEebBFC5fA1100Fb055a87773e1E99Cd3507a') - const usdc_eth_address = transformAddress('0xA7D7079b0FEaD91F3e65f86E8915Cb59c1a4C664') - const usdt_eth_address = transformAddress('0xde3A24028580884448a5397872046a019649b084') +async function staking(timestamp, block) { + const sanctuary = '0xaC14864ce5A98aF3248Ffbf549441b04421247D3' + const arbStrat = '0x20D1b558Ef44a6e23D9BF4bf8Db1653626e642c3' + const veSdt = '0x0C30476f66034E11782938DF8e4384970B6c9e8a' + const sdtToken = '0x73968b9a57c6E53d41345FD57a6E6ae27d6CDB2F' + return sumTokens2({ + owners: [sanctuary, arbStrat, veSdt,], + tokens: [sdtToken] + }) +} - // avDAI - const avDAI = 'avax:0x47AFa96Cdc9fAb46904A55a6ad4bf6660B53c38a' - balances[dai_eth_address] = balances[avDAI] - delete balances[avDAI] - // avUSDC - const avUSDC = 'avax:0x46A51127C3ce23fb7AB1DE06226147F446e4a857' - balances[usdc_eth_address] = balances[avUSDC] - delete balances[avUSDC] - // avUSDT - const avUSDT = 'avax:0x532E6537FEA298397212F09A61e03311686f548e' - balances[usdt_eth_address] = balances[avUSDT] - delete balances[avUSDT] +async function polygon(timestamp, ethBlock, chainBlocks, { api, }) { + const crv_3crv_vault_polygon = { + contract: '0x7d60F21072b585351dFd5E8b17109458D97ec120', + } + const vaultsPolygon = [ + crv_3crv_vault_polygon, + ] + return getBalances(api, vaultsPolygon) +} +async function getBalances(api, vaults, { balances = {} } = {}) { + const tokens = await api.multiCall({ abi: 'address:token', calls: vaults.map(i => i.contract) }) + const bals = await api.multiCall({ abi: 'uint256:balance', calls: vaults.map(i => i.contract) }) + tokens.forEach((token, i) => sdk.util.sumSingleBalance(balances, token, bals[i], api.chain)) return balances } -async function harmony(timestamp, ethBlock, chainBlocks) { - let balances = {}; - const block = chainBlocks.harmony - await Promise.all(vaultsHarmony.map(async vault=>{ - const crvBalance = await sdk.api.abi.call({ - target: vault.contract, - block, - abi: abi[vault.abi], - chain: 'harmony' - }) - await unwrapCrv(balances, vault.crvToken, crvBalance.output, block, 'harmony', addr=>`harmony:${addr}`) - })) +async function avax(timestamp, ethBlock, chainBlocks, { api }) { + const crv_3crv_vault_avalanche = { + contract: '0x0665eF3556520B21368754Fb644eD3ebF1993AD4', + } - return balances + const vaultsAvalanche = [ + crv_3crv_vault_avalanche + ] + return getBalances(api, vaultsAvalanche) } -async function bsc(timestamp, ethBlock, chainBlocks) { - let balances = {}; - const block = chainBlocks.bsc; - const transform = await transformBscAddress(); - await Promise.all(vaultsBsc.map(async vault=>{ +async function bsc(timestamp, ethBlock, chainBlocks, { api }) { + const btcEPS_vault_bsc = { + contract: '0xf479e1252481360f67c2b308F998395cA056a77f', + } + const EPS3_vault_bsc = { + contract: '0x4835BC54e87ff7722a89450dc26D9dc2d3A69F36', + } + const fusdt3EPS_vault_bsc = { + contract: '0x8E724986B08F2891cD98F7F71b5F52E7CFF420de', + } - const crvBalance = (await sdk.api.abi.call({ - target: vault.contract, - block, - abi: abi[vault.abi], - chain: 'bsc' - })).output; + const vaultsBsc = [ + btcEPS_vault_bsc, + EPS3_vault_bsc, + fusdt3EPS_vault_bsc + ].map(i => i.contract) - switch(vault.crvToken) { - case '0x2a435ecb3fcc0e316492dc1cdd62d0f189be5640': - balances['bitcoin'] = crvBalance / 10 ** 18; break; - case '0xaf4de8e872131ae328ce21d909c74705d3aaf452': - balances['usd-coin'] = crvBalance / 10 ** 18; break; - case '0x373410a99b64b089dfe16f1088526d399252dace': - balances['tether'] = crvBalance / 10 ** 18; break; - } - })) - return balances + const [bitcoin, usdc, tether] = (await api.multiCall({ abi: abi.balance, calls: vaultsBsc })).map(i => i / 1e18) + return { + bitcoin, tether, 'usd-coin': usdc + } } + // node test.js projects/stakedao/index.js module.exports = { - ethereum:{ - tvl: ethereum, - staking - }, - polygon:{ - tvl: polygon + misrepresentedTokens: true, + ethereum: { + tvl, + staking, }, - avax:{ - tvl: avax + polygon: { + tvl: polygon, }, - harmony: { - tvl: harmony + avax: { + tvl: avax, }, bsc: { tvl: bsc, diff --git a/projects/stakedicp/index.js b/projects/stakedicp/index.js new file mode 100644 index 00000000000..1dd10aa8d1c --- /dev/null +++ b/projects/stakedicp/index.js @@ -0,0 +1,23 @@ +const BigNumber = require("bignumber.js"); +const axios = require('axios'); + +const url = 'https://h6uvl-xiaaa-aaaap-qaawa-cai.ic0.app/tvl'; + +async function tvl(_timestamp, _block) { + const tvl = (await axios.get(url)).data.tvl; + if (tvl === undefined) { + // API didn't return a tvl number to work with + throw new Error("Unknown"); + } + return { + "coingecko:internet-computer": BigNumber(tvl).div(1e8).toFixed(0), + }; +} + +module.exports = { + timetravel: false, + methodology: "TVL counts ICP deposited as collateral to mint stICP", + icp: { + tvl, + }, +}; diff --git a/projects/stakedotlink-index/index.js b/projects/stakedotlink-index/index.js new file mode 100644 index 00000000000..50790e0aa1b --- /dev/null +++ b/projects/stakedotlink-index/index.js @@ -0,0 +1,13 @@ +const { sumTokens2 } = require('../helper/unwrapLPs') + +async function tvl(_, _b, _cb, { api, }) { + const ixETH = '0x535321013A1E2D5aF3B1853812a64CA3fc6C1fa1' + const tokens = await api.call({ abi: 'address[]:getLSDTokens', target: ixETH }) + const strategies = await api.multiCall({ abi: 'function lsdAdapters(address) view returns (address)', calls: tokens, target: ixETH, }) + const tokensAndOwners2 = [tokens, strategies] + return sumTokens2({ api, tokensAndOwners2, }) +} + +module.exports = { + ethereum: { tvl } +} \ No newline at end of file diff --git a/projects/stakedotlink/index.js b/projects/stakedotlink/index.js new file mode 100644 index 00000000000..c345f9cb134 --- /dev/null +++ b/projects/stakedotlink/index.js @@ -0,0 +1,43 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const sdk = require("@defillama/sdk"); + +const sdlToken = "0xA95C5ebB86E0dE73B4fB8c47A45B792CFeA28C23"; +const sdlStakingPool = "0xAEF186611EC96427d161107fFE14bba8aA1C2284"; +const linkToken = ADDRESSES.ethereum.LINK; +const linkStakingPool = "0xb8b295df2cd735b15BE5Eb419517Aa626fc43cD5"; + +async function tvl(timestamp, ethBlock, chainBlocks) { + const stakedLINK = await sdk.api.abi.call({ + block: ethBlock, + target: linkStakingPool, + abi: "uint256:totalStaked", + }); + + return { + [linkToken]: stakedLINK.output, + }; +} + +async function staking(timestamp, ethBlock, chainBlocks) { + const stakedSDL = await sdk.api.abi.call({ + block: ethBlock, + target: sdlStakingPool, + abi: "uint256:totalStaked", + }); + + return { + [sdlToken]: stakedSDL.output, + }; +} + +module.exports = { + timetravel: true, + misrepresentedTokens: false, + methodology: + "Queries LINK and SDL staking pools for the total amount of tokens staked", + start: 1670337984, + ethereum: { + tvl, + staking, + }, +}; diff --git a/projects/stakehound/index.js b/projects/stakehound/index.js index 64a64b7239a..dfe1e698e96 100644 --- a/projects/stakehound/index.js +++ b/projects/stakehound/index.js @@ -1,6 +1,7 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk'); -const wethAddress = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2' +const wethAddress = ADDRESSES.ethereum.WETH async function tvl(timestamp, block) { const supply = await sdk.api.erc20.totalSupply({ diff --git a/projects/stakerz-io/index.js b/projects/stakerz-io/index.js index ffce7bfe085..eea88be5633 100644 --- a/projects/stakerz-io/index.js +++ b/projects/stakerz-io/index.js @@ -15,9 +15,6 @@ function fetchChain(chainId, staking) { tvl += Number(chain[vault]); } } - if (tvl === 0 && !staking) { - throw new Error(`chain ${chainId} tvl is 0`) - } return toUSDTBalances(tvl); } diff --git a/projects/stakesteak/abi.json b/projects/stakesteak/abi.json deleted file mode 100644 index 430310b664f..00000000000 --- a/projects/stakesteak/abi.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "inputs": [ - { - "internalType": "uint256", - "name": "_pid", - "type": "uint256" - } - ], - "name": "getPoolInfo", - "outputs": [ - { - "components": [ - { - "internalType": "contract IERC20", - "name": "stakingToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "stakingTokenTotalAmount", - "type": "uint256" - }, - { - "internalType": "uint32", - "name": "lastRewardTime", - "type": "uint32" - }, - { - "internalType": "uint256[]", - "name": "AccRewardsPerShare", - "type": "uint256[]" - }, - { - "internalType": "uint256[]", - "name": "AllocPoints", - "type": "uint256[]" - } - ], - "internalType": "struct SteakHouseV2.PoolInfo", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" -} \ No newline at end of file diff --git a/projects/stakesteak/index.js b/projects/stakesteak/index.js index 5268332bd8b..f254b23a9ce 100644 --- a/projects/stakesteak/index.js +++ b/projects/stakesteak/index.js @@ -1,10 +1,11 @@ +const ADDRESSES = require('../helper/coreAssets.json') const {addFundsInMasterChef} = require('../helper/masterchef') const sdk = require('@defillama/sdk') const {staking} = require('../helper/staking') const {transformFantomAddress} = require('../helper/portedTokens') -const poolInfoAbi = require('./abi.json') +const poolInfoAbi = 'function getPoolInfo(uint256 _pid) view returns (tuple(address stakingToken, uint256 stakingTokenTotalAmount, uint32 lastRewardTime, uint256[] AccRewardsPerShare, uint256[] AllocPoints))' -const tusd = "0x0000000000085d4780b73119b644ae5ecd22b376" +const tusd = ADDRESSES.ethereum.TUSD const ifusd = "0x9fC071cE771c7B27b7d9A57C32c0a84c18200F8a" async function tvl(_t, _b, chainBlocks){ diff --git a/projects/stakewise/index.js b/projects/stakewise/index.js index 033210d5db4..280a693dacd 100644 --- a/projects/stakewise/index.js +++ b/projects/stakewise/index.js @@ -1,22 +1,23 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk'); const BigNumber = require('bignumber.js') +const { getLogs } = require('../helper/cache/getLogs') -const wethAddress = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2' +const wethAddress = ADDRESSES.ethereum.WETH -async function tvl(timestamp, block) { +async function tvl(timestamp, block, _1, { api }) { const supply = await sdk.api.erc20.totalSupply({ target: '0xFe2e637202056d30016725477c5da089Ab0A043A', block }) - const solosValidators = await sdk.api.util.getLogs({ + const solosValidators = await getLogs({ target: '0xEadCBA8BF9ACA93F627F31fB05470F5A0686CEca', topic: 'ValidatorRegistered(bytes32,bytes,uint256,address)', - fromBlock: 0, - toBlock: block, - keys:[] + fromBlock: 11726299, + api }) - const ethOnValidators = BigNumber(solosValidators.output.length).times(32e18) + const ethOnValidators = BigNumber(solosValidators.length).times(32e18) return { [wethAddress]: ethOnValidators.plus(supply.output).toFixed(0) @@ -32,7 +33,7 @@ async function xdaiTvl(timestamp, ethBlock, { xdai: block }) { }) return { - "0x6810e776880c02933d47db1b9fc05908e5386b96": supply.output + [ADDRESSES.ethereum.GNO]: supply.output } } diff --git a/projects/standcash/index.js b/projects/standcash/index.js index fb5b0610006..62665eeb70e 100644 --- a/projects/standcash/index.js +++ b/projects/standcash/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { stakings } = require("../helper/staking"); const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); @@ -39,16 +40,12 @@ const poolContracts = [ ]; const tokenAddresses = [ - //USDT - "0xdac17f958d2ee523a2206206994597c13d831ec7", - //USDC - "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", - //FRAX - "0x853d955acef822db058eb8505911ed77f175b99e", + ADDRESSES.ethereum.USDT, + ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.FRAX, //ESD "0x36F3FD68E7325a35EB768F1AedaAe9EA0689d723", - //DAI - "0x6b175474e89094c44da98b954eedeac495271d0f", + ADDRESSES.ethereum.DAI, //BAC "0x3449fc1cd036255ba1eb19d65ff4ba2b8903a69a", //AETH diff --git a/projects/starbank/index.js b/projects/starbank/index.js index f578c441593..4b1d55824e9 100644 --- a/projects/starbank/index.js +++ b/projects/starbank/index.js @@ -1,17 +1,18 @@ -// starbank -const { get } = require('../helper/http') -const {toUSDTBalances} = require("../helper/balances"); - -const seconds = Math.floor(parseInt(Date.now().toString()) / 1000 / 5); // 5sec cache -const starbankTVLUrl = - `https://starbank-storage-api.s3.ap-south-1.amazonaws.com/api/consolidatedDataV1.json?timestamp=${seconds}`; - -async function tvl() { - return toUSDTBalances((await get(starbankTVLUrl)).totalLiquidity); -} +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require('../helper/unwrapLPs'); module.exports = { - astar:{ - tvl - } + astar: { + tvl: sumTokensExport({ + owner: '0x18df7884DEa0B24334800C8b05763112Eb592ce0', + tokens: [ + '0xAeaaf0e2c81Af264101B9129C00F4440cCF0F720', + ADDRESSES.moonbeam.USDC, + ADDRESSES.astar.USDT, + ADDRESSES.astar.SDN, + ADDRESSES.astar.DAI, + ADDRESSES.oasis.ceUSDT, + ], + }) + } }; diff --git a/projects/starfish-finance/index.js b/projects/starfish-finance/index.js index 6831b350322..e04e94d4b7e 100644 --- a/projects/starfish-finance/index.js +++ b/projects/starfish-finance/index.js @@ -1,15 +1,30 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { staking } = require("../helper/staking.js"); - +const { onChainTvl } = require("../helper/balancer"); + const addresses = { astar: { - seanStaking: '0xa86dc743efBc24AF4c1FC5d150AaDb4DCF52c868', - seanToken: '0xEe8138B3bd03905cF84aFE10cCD0dCcb820eE08E' - } -} + seanStaking: "0xa86dc743efBc24AF4c1FC5d150AaDb4DCF52c868", + seanToken: "0xEe8138B3bd03905cF84aFE10cCD0dCcb820eE08E", + }, +}; module.exports = { astar: { - tvl: () => ({}), - staking: staking(addresses.astar.seanStaking, addresses.astar.seanToken, "astar", 'starfish-finance', 18) - } -} + tvl: onChainTvl('0x496F6125E1cd31f268032bd4cfaA121D203639b7', 3258352, { + preLogTokens: [ + '0xEa093b81ca103585FC8Df82CB3D5D7F2e394AB70', + ADDRESSES.astar.SDN, + '0xEe8138B3bd03905cF84aFE10cCD0dCcb820eE08E', + ADDRESSES.astar.BAI, + ADDRESSES.astar.DAI, + ADDRESSES.astar.DOT, + '0x5E60Af4d06A9fc89eb47B39b5fF1b1b42a19ef39', + ADDRESSES.moonbeam.USDC, + '0xfFFfffFF000000000000000000000001000007C0', + ADDRESSES.astar.USDT, + ] + }), + staking: staking(addresses.astar.seanStaking, addresses.astar.seanToken,), + }, +}; diff --git a/projects/starfish-liq-staking/index.js b/projects/starfish-liq-staking/index.js new file mode 100644 index 00000000000..ba01ddbbbd6 --- /dev/null +++ b/projects/starfish-liq-staking/index.js @@ -0,0 +1,9 @@ +const ADDRESSES = require('../helper/coreAssets.json') +module.exports = { + astar: { + tvl: async (_, _1, _2, { api }) => { + const bal = await api.call({ abi: 'uint256:internalDotBalance', target: '0x5E60Af4d06A9fc89eb47B39b5fF1b1b42a19ef39'}) + api.add(ADDRESSES.astar.DOT, bal) + } + } +} \ No newline at end of file diff --git a/projects/stargate-finance/api.js b/projects/stargate-finance/api.js new file mode 100644 index 00000000000..606277d1561 --- /dev/null +++ b/projects/stargate-finance/api.js @@ -0,0 +1,4 @@ +const index = require('./index') +const { ohmStaking } = require('../helper/treasury') + +module.exports = ohmStaking(index) \ No newline at end of file diff --git a/projects/stargate-finance/index.js b/projects/stargate-finance/index.js index 229f79c51a3..e5d541b91ac 100644 --- a/projects/stargate-finance/index.js +++ b/projects/stargate-finance/index.js @@ -1,11 +1,12 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { ohmTvl } = require("../helper/ohm"); const treasuryAddress = "0xA2B48Ad28c09cc64CcCf9eD73e1EfceD052877d5"; module.exports = ohmTvl(treasuryAddress, [ //BSC-USD - ["0x55d398326f99059ff775485246999027b3197955", false], + [ADDRESSES.bsc.USDT, false], //BUSD - ["0xe9e7cea3dedca5984780bafc599bd69add087d56", false], + [ADDRESSES.bsc.BUSD, false], //BABY LP ["0xd397a40884ce00e662b419673e0b15cae628877f", true] , //Pancake LP diff --git a/projects/stargatefinance/abi.json b/projects/stargatefinance/abi.json index 3643e0258da..9dd05371bbb 100644 --- a/projects/stargatefinance/abi.json +++ b/projects/stargatefinance/abi.json @@ -1,79 +1,7 @@ { - "factory": { - "inputs": [], - "name": "factory", - "outputs": [ - { - "internalType": "contract Factory", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "allPoolsLength": { - "inputs": [], - "name": "allPoolsLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "allPools": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "allPools", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "pools": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "pools", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "token": { - "inputs": [], - "name": "token", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } + "factory": "address:factory", + "allPoolsLength": "uint256:allPoolsLength", + "allPools": "function allPools(uint256) view returns (address)", + "pools": "function pools(uint256) view returns (address)", + "token": "address:token" } \ No newline at end of file diff --git a/projects/stargatefinance/index.js b/projects/stargatefinance/index.js index 6b378e1d161..5c6978ff5bf 100644 --- a/projects/stargatefinance/index.js +++ b/projects/stargatefinance/index.js @@ -1,12 +1,11 @@ -const sdk = require("@defillama/sdk") +const ADDRESSES = require('../helper/coreAssets.json') const abi = require("./abi.json") -const { sumTokens, } = require('../helper/unwrapLPs') -const { getChainTransform } = require("../helper/portedTokens") +const { nullAddress, sumTokens2, } = require('../helper/unwrapLPs') const CONFIG = { ethereum: { router: '0x8731d54E9D02c286767d56ac03e8037C07e01e98', - etherToken: '0x0000000000000000000000000000000000000000', + etherToken: '0x72E2F4830b9E45d52F80aC08CB2bEC0FeF72eD9c', }, bsc: { router: '0x4a364f8c717cAAD9A442737Eb7b8A55cc6cf18D8', @@ -16,11 +15,11 @@ const CONFIG = { }, arbitrum: { router: '0x53Bf833A5d6c4ddA888F69c22C88C9f356a41614', - etherToken: '0x0000000000000000000000000000000000000000', + etherToken: '0x82CbeCF39bEe528B5476FE6d1550af59a9dB6Fc0', }, optimism: { router: '0xB0D502E938ed5f4df2E681fE6E419ff29631d62b', - etherToken: '0x0000000000000000000000000000000000000000', + etherToken: '0xb69c8CBCD90A39D8D3d3ccf0a3E968511C3856A0', }, fantom: { router: '0xAf5191B0De278C7286d6C7CC6ab6BB8A73bA2Cd6', @@ -28,43 +27,36 @@ const CONFIG = { avax:{ router: '0x45A01E4e04F14f7A4a6702c74187c5F6222033cd', }, + metis:{ + router: '0x2F6F07CDcf3588944Bf4C42aC74ff24bF56e7590', + }, } -/*** Ethereum TVL Portions ***/ -const tvl = (chain) => async (timestamp, _block, chainBlocks) => { - const { - [chain]: { router, etherToken, } - } = CONFIG - - if (chain === 'avalanche') chain = 'avax' - - const balances = {} - const block = chainBlocks[chain] - const tokens = [] - const transformAddress = await getChainTransform(chain) - - const factory = (await sdk.api.abi.call({ abi: abi.factory, target: router, block, chain, })).output - const allPoolsLength = (await sdk.api.abi.call({ abi: abi.allPoolsLength, target: factory, block, chain, })).output - - for (let i = 0; i < allPoolsLength; i++) { - let pool = (await sdk.api.abi.call({ abi: abi.allPools, target: factory, block, params: i, chain, })).output - let token = (await sdk.api.abi.call({ abi: abi.token, target: pool, block, chain, })).output - const { output: symbol } = await sdk.api.erc20.symbol(token, chain) - if (symbol === 'SGETH') { - if (!etherToken) throw new Error('Missing Ether token') - pool = token - token = etherToken +module.exports = { + goerli:{ + tvl: async (_, _b, _cb, { api, })=>{ + return { + [ADDRESSES.ethereum.WETH]: await api.call({ abi: 'erc20:balanceOf', target: "0xdD69DB25F6D620A7baD3023c5d32761D353D3De9", params:["0x88124ef4a9ec47e691f254f2e8e348fd1e341e9b"] }) + } } - tokens.push([token, pool]) } - - await sumTokens(balances, tokens, block, chain, transformAddress) - return balances -} - -const chainExports = Object.keys(CONFIG).reduce((agg, chain) => ({ ...agg, [chain]: { tvl: tvl(chain) } }), {}) - -module.exports = { - misrepresentedTokens: true, - ...chainExports -} +}; + +Object.keys(CONFIG).forEach(chain => { + let { router, etherToken = '', } = CONFIG[chain] + etherToken = etherToken.toLowerCase() + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const factory = await api.call({ abi: abi.factory, target: router }) + const pools = await api.fetchList({ lengthAbi: abi.allPoolsLength, itemAbi: abi.allPools, target: factory}) + const tokens = await api.multiCall({ abi: abi.token, calls: pools}) + const toa = [] + tokens.forEach((t, i) => { + t = t.toLowerCase() + if (t === etherToken) toa.push([nullAddress, t]) + else toa.push([t, pools[i]]) + }) + return sumTokens2({ api, tokensAndOwners: toa }) + } + } +}) \ No newline at end of file diff --git a/projects/stargaze/index.js b/projects/stargaze/index.js new file mode 100644 index 00000000000..5fd6ce24600 --- /dev/null +++ b/projects/stargaze/index.js @@ -0,0 +1,26 @@ +const sdk = require("@defillama/sdk"); +const { get } = require('../helper/http') + +async function tvl() { + const balances = {}; + + /** + * The denom is the official API. bids was custom made for this use. @pen.so on #Stargaze + * Bids has already been converted from ustars to stars. + */ + + // const denomURL = `https://rest.stargaze-apis.com/cosmos/staking/v1beta1/params`; + const bidsURL = `https://metabase.constellations.zone/api/public/card/4bd16e60-7e77-4206-8ad2-8b04f362afed/query` + + const bidsResponse = await get(bidsURL); + // const denomResponse = await utils.fetchURL(denomURL); + sdk.util.sumSingleBalance(balances, 'ustars', bidsResponse.data.rows[0] * 1e6, 'stargaze') + + return balances; +} + +module.exports = { + timetravel: false, + methodology: 'Queries the chain API for the how many STARS are locked in bids.', + stargaze: { tvl } +}; diff --git a/projects/starkex/abi.js b/projects/starkex/abi.js new file mode 100644 index 00000000000..7ae4cfbdf79 --- /dev/null +++ b/projects/starkex/abi.js @@ -0,0 +1,87 @@ +const fabis = [{ + "name": "allPairs", + "type": "function", + "inputs": [ + { + "name": "index", + "type": "felt" + } + ], + "outputs": [ + { + "name": "pair", + "type": "felt" + } + ], + "stateMutability": "view" +}, +{ + "name": "allPairsLength", + "type": "function", + "inputs": [], + "outputs": [ + { + "name": "length", + "type": "felt" + } + ], + "stateMutability": "view" +} +] + +const pabis = [ + { + "name": "token0", + "type": "function", + "inputs": [], + "outputs": [ + { + "name": "token0", + "type": "felt" + } + ], + "stateMutability": "view" + }, + { + "name": "token1", + "type": "function", + "inputs": [], + "outputs": [ + { + "name": "token1", + "type": "felt" + } + ], + "stateMutability": "view" + }, + { + "name": "getReserves", + "type": "function", + "inputs": [], + "outputs": [ + { + "name": "reserve0", + "type": "felt" + }, + { + "name": "reserve1", + "type": "felt" + }, + { + "name": "blockTimestampLast", + "type": "felt" + } + ], + "stateMutability": "view" + }, +] + + +const factory = {} +const pair = {} +fabis.forEach(i => factory[i.name] = i) +pabis.forEach(i => pair[i.name] = i) + +module.exports = { + factory, pair, fabis, pabis, +} diff --git a/projects/starkex/api.js b/projects/starkex/api.js new file mode 100644 index 00000000000..e0541fe5b2b --- /dev/null +++ b/projects/starkex/api.js @@ -0,0 +1,38 @@ + +const { call, multiCall, parseAddress } = require('../helper/chain/starknet') +const abi = require('./abi') +const { transformDexBalances } = require('../helper/portedTokens') +const { getParamCalls } = require('../helper/utils') + +async function tvl() { + const factory = '0x07df3bce30857e8f9c08bcd9d9668df34166e94dd968db6e2920b870c4410e34' + let pairLength = await call({ target: factory, abi: abi.factory.allPairsLength}) + let pairs = await multiCall({ abi: abi.factory.allPairs, target: factory, calls: getParamCalls(+pairLength)}) + + const calls = pairs.map(i => parseAddress(i)) + + const [ token0s, token1s, reserves ] = await Promise.all([ + multiCall({ abi: abi.pair.token0, calls }), + multiCall({ abi: abi.pair.token1, calls }), + multiCall({ abi: abi.pair.getReserves, calls }), + ]) + + const data = [] + reserves.forEach((reserve, i) => { + data.push({ + token0: parseAddress(token0s[i]), + token1: parseAddress(token1s[i]), + token0Bal: +reserve.reserve0, + token1Bal: +reserve.reserve1, + }) + }) + + return transformDexBalances({chain:'starknet', data}) +} + +module.exports = { + timetravel: false, + starknet: { + tvl, + } +} diff --git a/projects/starkex/index.js b/projects/starkex/index.js new file mode 100644 index 00000000000..11f5177a678 --- /dev/null +++ b/projects/starkex/index.js @@ -0,0 +1 @@ +module.exports = require('./api') diff --git a/projects/starlay/abi.json b/projects/starlay/abi.json deleted file mode 100644 index 22762036804..00000000000 --- a/projects/starlay/abi.json +++ /dev/null @@ -1,401 +0,0 @@ -{ - "getReservesList": { - "inputs": [], - "name": "getReservesList", - "outputs": [ - { - "internalType": "address[]", - "name": "", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getCurrentTokens": { - "constant": true, - "inputs": [], - "name": "getCurrentTokens", - "outputs": [ - { - "internalType": "address[]", - "name": "tokens", - "type": "address[]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "getReserveData": { - "constant": true, - "inputs": [ - { - "internalType": "address", - "name": "_reserve", - "type": "address" - } - ], - "name": "getReserveData", - "outputs": [ - { - "internalType": "uint256", - "name": "totalLiquidity", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "availableLiquidity", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalBorrowsStable", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalBorrowsVariable", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "liquidityRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "variableBorrowRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "stableBorrowRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "averageStableBorrowRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "utilizationRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "liquidityIndex", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "variableBorrowIndex", - "type": "uint256" - }, - { - "internalType": "address", - "name": "lTokenAddress", - "type": "address" - }, - { - "internalType": "uint40", - "name": "lastUpdateTimestamp", - "type": "uint40" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "getReserveConfigurationData": { - "constant": true, - "inputs": [ - { - "internalType": "address", - "name": "_reserve", - "type": "address" - } - ], - "name": "getReserveConfigurationData", - "outputs": [ - { - "internalType": "uint256", - "name": "ltv", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "liquidationThreshold", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "liquidationBonus", - "type": "uint256" - }, - { - "internalType": "address", - "name": "interestRateStrategyAddress", - "type": "address" - }, - { - "internalType": "bool", - "name": "usageAsCollateralEnabled", - "type": "bool" - }, - { - "internalType": "bool", - "name": "borrowingEnabled", - "type": "bool" - }, - { - "internalType": "bool", - "name": "stableBorrowRateEnabled", - "type": "bool" - }, - { - "internalType": "bool", - "name": "isActive", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "getReserves": { - "constant": true, - "inputs": [], - "name": "getReserves", - "outputs": [ - { - "internalType": "address[]", - "name": "", - "type": "address[]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "getAddressesProvidersList": { - "inputs": [], - "name": "getAddressesProvidersList", - "outputs": [ - { - "internalType": "address[]", - "name": "", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getAddress": { - "inputs": [ - { - "internalType": "bytes32", - "name": "id", - "type": "bytes32" - } - ], - "name": "getAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getAllLTokens": { - "inputs": [], - "name": "getAllLTokens", - "outputs": [ - { - "components": [ - { - "internalType": "string", - "name": "symbol", - "type": "string" - }, - { - "internalType": "address", - "name": "tokenAddress", - "type": "address" - } - ], - "internalType": "struct StarlayProtocolDataProvider.TokenData[]", - "name": "", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getUnderlying": { - "inputs": [], - "name": "UNDERLYING_ASSET_ADDRESS", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getReserveDataV2": { - "inputs": [ - { - "internalType": "address", - "name": "asset", - "type": "address" - } - ], - "name": "getReserveData", - "outputs": [ - { - "internalType": "uint256", - "name": "availableLiquidity", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalStableDebt", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalVariableDebt", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "liquidityRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "variableBorrowRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "stableBorrowRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "averageStableBorrowRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "liquidityIndex", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "variableBorrowIndex", - "type": "uint256" - }, - { - "internalType": "uint40", - "name": "lastUpdateTimestamp", - "type": "uint40" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getHelperReserveData": { - "inputs": [ - { - "internalType": "address", - "name": "asset", - "type": "address" - } - ], - "name": "getReserveData", - "outputs": [ - { - "internalType": "uint256", - "name": "availableLiquidity", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalStableDebt", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalVariableDebt", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "liquidityRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "variableBorrowRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "stableBorrowRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "averageStableBorrowRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "liquidityIndex", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "variableBorrowIndex", - "type": "uint256" - }, - { - "internalType": "uint40", - "name": "lastUpdateTimestamp", - "type": "uint40" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getReserveTotalBorrows": { - "constant": true, - "inputs": [ - { - "internalType": "address", - "name": "_reserve", - "type": "address" - } - ], - "name": "getReserveTotalBorrows", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } -} diff --git a/projects/starlay/constanrs.js b/projects/starlay/constanrs.js deleted file mode 100644 index 8f84b0f0693..00000000000 --- a/projects/starlay/constanrs.js +++ /dev/null @@ -1,52 +0,0 @@ -const DEFAULT_DECIMALS = 18 - -const TOKEN_INFO = { - dot: { key: "polkadot", decimals:10 }, - ausd: { key: "acala-dollar", decimals:12 } -} - -const LAY_ADDRESS = "0xc4335B1b76fA6d52877b3046ECA68F6E708a27dd" - -const TOKENS = { - // WASTR - "0xAeaaf0e2c81Af264101B9129C00F4440cCF0F720": "astar", - // WETH - "0x81ECac0D6Be0550A00FF064a4f9dd2400585FE9c": - "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", - // wBTC - "0xad543f18cFf85c77E140E3E5E3c3392f6Ba9d5CA": - "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599", - // SDN - "0x75364D4F779d0Bd0facD9a218c67f87dD9Aff3b4": "shiden", - // USDC - "0x6a2d262D56735DbA19Dd70682B39F6bE9a931D98": - "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", - // USDT - "0x3795C36e7D12A8c252A20C5a7B455f7c57b60283": - "0xdac17f958d2ee523a2206206994597c13d831ec7", - // DAI - "0x6De33698e9e9b787e09d3Bd7771ef63557E148bb": - "0x6b175474e89094c44da98b954eedeac495271d0f", - // BUSD - "0x4Bf769b05E832FCdc9053fFFBC78Ca889aCb5E1E": "binance-usd", - // MATIC - "0xdd90E5E87A2081Dcf0391920868eBc2FFB81a1aF": "matic-network", - // BNB - "0x7f27352D5F83Db87a5A3E00f4B07Cc2138D8ee52": "binancecoin", - // DOT - "0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF": TOKEN_INFO.dot.key, - // aUSD - "0xfFFFFfFF00000000000000010000000000000001": TOKEN_INFO.ausd.key, - // LAY - [LAY_ADDRESS]: "starlay-finance", -}; - -const VOTING_ESCROW_ADDRESS = "0xDf32D28c1BdF25c457E82797316d623C2fcB29C8" - -module.exports = { - DEFAULT_DECIMALS, - TOKEN_INFO, - LAY_ADDRESS, - TOKENS, - VOTING_ESCROW_ADDRESS, -} diff --git a/projects/starlay/index.js b/projects/starlay/index.js index 99363648768..fb7f3a7a122 100644 --- a/projects/starlay/index.js +++ b/projects/starlay/index.js @@ -1,65 +1,16 @@ -const { getReserves, getStarlayTvl } = require("./starlay"); -const BigNumber = require("bignumber.js"); -const { getBorrowed } = require("../helper/aave"); -const { TOKENS, TOKEN_INFO, DEFAULT_DECIMALS, LAY_ADDRESS } = require("./constanrs"); -const { getLockedLAY } = require("./ve"); - -const transferFromAddress = (underlying) => TOKENS[underlying] - -function astar(borrowed) { - return async (timestamp, _, {astar: block}) => { - const balances = {}; - const [lTokens, reserveTokens, validProtocolDataHelpers] = - await getReserves(block); - const chain = "astar"; - - if (borrowed) { - await getBorrowed( - balances, - block, - chain, - reserveTokens, - validProtocolDataHelpers, - transferFromAddress - ); - } else { - await getStarlayTvl( - balances, - block, - chain, - lTokens, - reserveTokens, - transferFromAddress - ); - } - - return Object.keys(balances).reduce((res, key) => { - if (key.startsWith("0x")) - return { ...res, [key]: balances[key] }; - for (const token of Object.values(TOKEN_INFO)) { - if (key === token.key) - return { ...res, [key]: new BigNumber(balances[key]).shiftedBy(-token.decimals).toFixed(0) }; - } - return { ...res, [key]: new BigNumber(balances[key]).shiftedBy(-DEFAULT_DECIMALS).toFixed(0) }; - }, {}); - }; -} - -async function staking(_timestamp, _block, {astar: block}) { - const chain = "astar" - const stakedLay = await getLockedLAY(chain, block) - return { - [transferFromAddress(LAY_ADDRESS)]: stakedLay.shiftedBy(-DEFAULT_DECIMALS).toFixed(0) - } -} - +const { aaveExports } = require("../helper/aave"); +const ADDRESSES = require('../helper/coreAssets.json') +const VOTING_ESCROW_ADDRESS = "0xDf32D28c1BdF25c457E82797316d623C2fcB29C8"; +const { staking } = require("../helper/staking"); module.exports = { - timetravel: true, methodology: `Counts the tokens locked in the contracts to be used as collateral to borrow or to earn yield. Borrowed coins are not counted towards the TVL, so only the coins actually locked in the contracts are counted. There's multiple reasons behind this but one of the main ones is to avoid inflating the TVL through cycled lending.`, astar: { - tvl: astar(false), - borrowed: astar(true), - staking, - }, + ...aaveExports("astar", '0xF6206297b6857779443eF7Eca4a3cFFb1660F952', undefined, undefined, { + abis: { + getAllATokens: "function getAllLTokens() view returns (tuple(string symbol, address tokenAddress)[])" + } + }), + staking: staking(VOTING_ESCROW_ADDRESS, ADDRESSES.astar.LAY), + } }; diff --git a/projects/starlay/starlay.js b/projects/starlay/starlay.js deleted file mode 100644 index 4f2cb85a8db..00000000000 --- a/projects/starlay/starlay.js +++ /dev/null @@ -1,97 +0,0 @@ -const sdk = require("@defillama/sdk"); -const abi = require("./abi.json"); -const { default: BigNumber } = require("bignumber.js"); -const addressesProviderRegistry = "0xF6206297b6857779443eF7Eca4a3cFFb1660F952"; - -async function getReserves(block) { - const chain = "astar"; - const addressesProviders = ( - await sdk.api.abi.call({ - target: addressesProviderRegistry, - abi: abi["getAddressesProvidersList"], - block, - chain, - }) - ).output; - - const protocolDataHelpers = ( - await sdk.api.abi.multiCall({ - calls: addressesProviders.map((provider) => ({ - target: provider, - params: - "0x0100000000000000000000000000000000000000000000000000000000000000", - })), - abi: abi["getAddress"], - block, - chain, - }) - ).output; - const validProtocolDataHelpers = protocolDataHelpers - .filter( - (helper) => helper.output !== "0x0000000000000000000000000000000000000000" - ) - .map((p) => p.output); - - const lTokenMarketData = ( - await sdk.api.abi.multiCall({ - calls: validProtocolDataHelpers.map((dataHelper) => ({ - target: dataHelper, - })), - abi: abi["getAllLTokens"], - block, - chain, - }) - ).output; - - let lTokenAddresses = []; - lTokenMarketData.map((lTokensData) => { - lTokenAddresses = [ - ...lTokenAddresses, - ...lTokensData.output.map((lToken) => lToken[1]), - ]; - }); - const underlyingAddressesData = ( - await sdk.api.abi.multiCall({ - calls: lTokenAddresses.map((lToken) => ({ - target: lToken, - })), - abi: abi["getUnderlying"], - block, - chain, - }) - ).output; - const reserveAddresses = underlyingAddressesData.map( - (reserveData) => reserveData.output - ); - return [lTokenAddresses, reserveAddresses, validProtocolDataHelpers[0]]; -} - -async function getStarlayTvl( - balances, - block, - chain, - lTokens, - reserveTokens, - transformAddress -) { - const balanceOfUnderlying = await sdk.api.abi.multiCall({ - calls: lTokens.map((lToken, index) => ({ - target: reserveTokens[index], - params: lToken, - })), - abi: "erc20:balanceOf", - block, - chain, - }); - sdk.util.sumMultiBalanceOf( - balances, - balanceOfUnderlying, - true, - transformAddress - ); -} - -module.exports = { - getReserves, - getStarlayTvl, -}; diff --git a/projects/starlay/utils.js b/projects/starlay/utils.js deleted file mode 100644 index 696def55e5e..00000000000 --- a/projects/starlay/utils.js +++ /dev/null @@ -1,11 +0,0 @@ -const BigNumberJs = require("bignumber.js"); -BigNumberJs.config({ EXPONENTIAL_AT: 1e9 }) - -const toBigNumberJsOrZero = (value) => { - const bn = new BigNumberJs(value) - return bn.isNaN() ? new BigNumberJs('0') : bn -} - -module.exports = { - toBigNumberJsOrZero -} diff --git a/projects/starlay/ve.js b/projects/starlay/ve.js deleted file mode 100644 index 7b87a9204ac..00000000000 --- a/projects/starlay/ve.js +++ /dev/null @@ -1,19 +0,0 @@ -const sdk = require("@defillama/sdk"); -const { toBigNumberJsOrZero } = require("./utils.js"); - -const { VOTING_ESCROW_ADDRESS, LAY_ADDRESS } = require("./constanrs"); - -const getLockedLAY = async (chain, block) => { - const lockedLAYBalance = (await sdk.api.abi.call({ - target: LAY_ADDRESS, - abi: 'erc20:balanceOf', - params: [VOTING_ESCROW_ADDRESS], - block, - chain, - })).output - return toBigNumberJsOrZero(lockedLAYBalance) -} - -module.exports = { - getLockedLAY -} diff --git a/projects/starmaker/index.js b/projects/starmaker/index.js new file mode 100644 index 00000000000..c40d3eaddea --- /dev/null +++ b/projects/starmaker/index.js @@ -0,0 +1,9 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports = { + misrepresentedTokens: true, + era: { + tvl: getUniTVL({ factory: '0x7096Cebc52012e2611a1E88c45bC54ee2A88dcB4', useDefaultCoreAssets: true, fetchBalances: true, }), + }, + methodology: "Counts liquidity in pools", +}; \ No newline at end of file diff --git a/projects/starswap/index.js b/projects/starswap/index.js index 008ddfc3146..5fb6aa0cacb 100644 --- a/projects/starswap/index.js +++ b/projects/starswap/index.js @@ -20,62 +20,13 @@ module.exports = { astar: { tvl: getUniTVL({ factory: FACTORIES, - chain, useDefaultCoreAssets: true, }), staking: async (_, _b, { [chain]: block }) => { const { output: { totalStakedTokens } } = await sdk.api.abi.call({ target: STAKING_CONTRACT, params: 0, - abi: { - "type": "function", - "stateMutability": "view", - "outputs": [ - { - "type": "address", - "name": "lpToken", - "internalType": "contract IERC20" - }, - { - "type": "uint256", - "name": "allocPoint", - "internalType": "uint256" - }, - { - "type": "uint256", - "name": "lastRewardBlock", - "internalType": "uint256" - }, - { - "type": "uint256", - "name": "accStarPerShare", - "internalType": "uint256" - }, - { - "type": "uint16", - "name": "depositFeeBP", - "internalType": "uint16" - }, - { - "type": "uint256", - "name": "harvestInterval", - "internalType": "uint256" - }, - { - "type": "uint256", - "name": "totalStakedTokens", - "internalType": "uint256" - } - ], - "name": "poolInfo", - "inputs": [ - { - "type": "uint256", - "name": "", - "internalType": "uint256" - } - ] - }, + abi: 'function poolInfo(uint256) view returns (address lpToken, uint256 allocPoint, uint256 lastRewardBlock, uint256 accStarPerShare, uint16 depositFeeBP, uint256 harvestInterval, uint256 totalStakedTokens)', chain, block, }) diff --git a/projects/steadefi/index.js b/projects/steadefi/index.js new file mode 100644 index 00000000000..7937b60d9b0 --- /dev/null +++ b/projects/steadefi/index.js @@ -0,0 +1,56 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { getConfig } = require('../helper/cache'); +const { sumTokens2 } = require('../helper/unwrapLPs'); +const { camelotNFTPoolAbi } = require('../single/abi'); + +async function getProjectInfo() { + return Promise.all([ + getConfig('steadefi/lendingPools', 'https://api.steadefi.com/lending-pools'), + getConfig('steadefi/vaults', 'https://api.steadefi.com/vaults'), + ]) +} + +const config = { + arbitrum: { fsglp: ADDRESSES.arbitrum.fsGLP }, + avax: { fsglp: '0x9e295B5B976a184B14aD8cd72413aD846C299660' }, +} + +module.exports = { +}; + +Object.keys(config).forEach(chain => { + const { fsglp } = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const chainId = api.getChainId() + let [lendingPools, vaults] = await getProjectInfo() + lendingPools = lendingPools.filter(i => i.chainId === chainId).map(i => i.address) + const grailVaults = vaults.filter(i => i.chainId === chainId && i.protocol === 'Camelot').map(i => i.address) + vaults = vaults.filter(i => i.chainId === chainId && i.protocol !== 'Camelot').map(i => i.address) + const lpAssets = await api.multiCall({ abi: 'address:asset', calls: lendingPools }) + const managers = await api.multiCall({ abi: 'address:manager', calls: vaults }) + let lpTokens = await api.multiCall({ abi: 'address:lpToken', calls: managers, permitFailure: true, }) + const glpPoolManagers = managers.filter((_, i) => !lpTokens[i]) + glpPoolManagers.forEach(v => { + lpAssets.push(fsglp) + lendingPools.push(v) + }) + const lpPoolManagers = managers.filter((_, i) => lpTokens[i]) + lpTokens = lpTokens.filter(i => i) + const bals = await api.multiCall({ abi: 'uint256:lpTokenAmt', calls: lpPoolManagers }) + api.addTokens(lpTokens, bals) + // api.add('tether', tokenValue.reduce((a, v) => a + v/1e13, 0), { skipChain: true}) + if (grailVaults.length) { + const grailManagers = await api.multiCall({ abi: 'address:manager', calls: grailVaults }) + const spNfts = await api.multiCall({ abi: 'address:spNft', calls: grailManagers }) + const positionIds = await api.multiCall({ abi: 'uint256:positionId', calls: grailManagers }) + const poolInfos = await api.multiCall({ abi: camelotNFTPoolAbi.getPoolInfo, calls: spNfts }) + const stakedPositionInfo = await api.multiCall({ abi: camelotNFTPoolAbi.getStakingPosition, calls: spNfts.map((v, i) => ({ target: v, params: positionIds[i] })) }) + const lpTokens = poolInfos.map(v => v.lpToken) + const lpBalances = stakedPositionInfo.map(v => v.amount) + api.addTokens(lpTokens, lpBalances) + } + return sumTokens2({ api, tokensAndOwners2: [lpAssets, lendingPools] }) + } + } +}) \ No newline at end of file diff --git a/projects/steak/terra.js b/projects/steak/terra.js index 05a53da5362..d7b4fdcea05 100644 --- a/projects/steak/terra.js +++ b/projects/steak/terra.js @@ -6,15 +6,7 @@ const GRPC_API_URL = "https://lcd.terra.dev"; const STEAK_HUB = "terra15qr8ev2c0a0jswjtfrhfaj5ucgkhjd7la2shlg"; async function tvl() { - const queryMsg = { state: {} }; - - const response = await axios.get( - `${GRPC_API_URL}/terra/wasm/v1beta1/contracts/${STEAK_HUB}/store?query_msg=${encodeBase64(queryMsg)}` - ); - - return { - "terra-luna": parseInt(response.data.query_result.total_uluna) / 1e6, - }; + return {} } module.exports = { tvl }; diff --git a/projects/steak/terra.test.js b/projects/steak/terra.test.js deleted file mode 100644 index a1988dee5b2..00000000000 --- a/projects/steak/terra.test.js +++ /dev/null @@ -1,5 +0,0 @@ -const { tvl } = require("./terra.js"); - -(async function () { - console.log(await tvl()); -})(); diff --git a/projects/steakHut-lb/abi.json b/projects/steakHut-lb/abi.json new file mode 100644 index 00000000000..42a2d3f202a --- /dev/null +++ b/projects/steakHut-lb/abi.json @@ -0,0 +1,7 @@ + +{ + "totalSupply": "uint256:totalSupply", + "getUnderlyingAssets": "function getUnderlyingAssets(uint256) view returns (uint256, uint256)", + "want": "function want() view returns (address, address)" +} + diff --git a/projects/steakHut-lb/index.js b/projects/steakHut-lb/index.js new file mode 100644 index 00000000000..ae265b2a490 --- /dev/null +++ b/projects/steakHut-lb/index.js @@ -0,0 +1,87 @@ +const sdk = require('@defillama/sdk'); +const abi = require('./abi.json') + +const _vaults = { + avax: [ + '0x37e0f0513ae3d3c4403e7b11c8a15b06c7cb1412', //USDC.e/USDC_C + '0xb41506675a0977a34e8cec7da8c061d6753b5b03', //USDT/USDC_B + '0xc4bbd4ba96eaf7ccb3d0f2e0819b1f6e5c900b16', //USDT/USDC_C + '0x07462883abb2350e5243b94aeb27f4d37e3238e8', //USDT/USDT.e_B + '0x9f44e67ba256c18411bb041375e572e3dd11fa72', //USDT/USDT.e_C + '0x3b27aee8df3a3791eb57b59a770a530a93dc0221', //USDC.e/USDC_B + '0x89547441489262feb5cee346fdacb9037c2574db', //JOE/AVAX_B + '0x668530302c6ecc4ebe693ec877b79300ac72527c', //AVAX/USDC_B + '0x9c9cea14731821f4d08889717043977e6dee766a', //WETH.e/AVAX_B + '0x9cc15d1204d768380cec8d35bc1d8e1945083397', //BTC.b/USDC_B + '0x536d7e7423e8fb799549caf574cfa12aae95ffcd', //BTC.b/AVAX_B + '0x9bdda0c0cd56d98a8165fddabdeb7f9aee2d993e', //GMX/AVAX + '0xFFE588AC8d94c758AFaC5c50A4b4bF4BC1887fFD', //CAI/AVAX + ], + arbitrum: [ + '0x862f459c3c1f8949b3f5b624d39134d61697946e', //GMX/ETH + '0xec9fba07ca8b3429950b2e01aec4e2b08dbd7897', //ETH/USDC + '0xfb6421346d7e96f573414be757b502c0bb15cb62', //USDT/USDC_B + '0xf8d6eb0e55a83e8a27af3c5f48cab883da3c716d', //USDT/USDC_C + '0x2DBb0b159dc932D86FA4a5378924E7e074F4a5f2', //ARB/WETH + '0x223d04520d5376D6B465e4270e64746048eed716', //ARB/USDC + '0x04F9a9D6B7728787520B0ac69b88D81ddB5C10ED', //UNIDX/WETH + '0x57de2A8df99480fCc5323678bdA61E8Fd612bD54', //JOE/WETH + '0xe5F984fA55315fb1ee3399D6be3d9aAF74F1eFE4', //MAGIC/WETH + '0xEb7081e31E6d46058Fe65A68a309B788Aa8B363f', //BFR/WETH + '0xA0676beC4EC591c33A69877A2d39f08b54d34b84', //BETS/WETH + ], +} + +async function getVaultShares(api) { + return api.multiCall({ + calls: _vaults[api.chain], + abi: abi.totalSupply, + }) +} + +async function getDepositTokens(api) { + return api.multiCall({ + calls: _vaults[api.chain], + abi: abi.want, + }) +} + + +async function tvl(_, block, _1, { api }) { + const balances = {}; + + //get the total shares from all vaults + const vaultShares = await getVaultShares(api); + const depositTokens = await getDepositTokens(api); + + //get the total underlying assets from all shares + const calls = [] + + for (let i = 0; i < _vaults[api.chain].length; i++) + calls.push({ target: _vaults[api.chain][i], params: vaultShares[i] }) + + const poolInfo = await api.multiCall({ + calls, + abi: abi.getUnderlyingAssets, + }) + + for (let i = 0; i < poolInfo.length; i++) { + for (let t = 0; t < poolInfo[i].length; t++) { + sdk.util.sumSingleBalance(balances, depositTokens[i][t], poolInfo[i][t], api.chain) + } + } + + return balances; +} + +module.exports = { + doublecounted: true, + methodology: 'Counts the value of LB tokens staked into SteakHut Liquidity.', + avax: { + tvl, + }, + arbitrum: { + tvl + } + +}; diff --git a/projects/steakHut/abi.json b/projects/steakHut/abi.json index 0f75aacf775..a5a352815dd 100644 --- a/projects/steakHut/abi.json +++ b/projects/steakHut/abi.json @@ -1,54 +1,4 @@ { - "poolInfo": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "poolInfo", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "lpToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "accJoePerShare", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastRewardTimestamp", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalLpSupply", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "poolEnabled", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - "poolLength": { - "inputs": [], - "name": "poolLength", - "outputs": [ - { - "internalType": "uint256", - "name": "pools", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } + "poolInfo": "function poolInfo(uint256) view returns (address lpToken, uint256 accJoePerShare, uint256 lastRewardTimestamp, uint256 totalLpSupply, bool poolEnabled)", + "poolLength": "uint256:poolLength" } \ No newline at end of file diff --git a/projects/steakHut/index.js b/projects/steakHut/index.js index 77e41718f33..f24ebef54b7 100644 --- a/projects/steakHut/index.js +++ b/projects/steakHut/index.js @@ -1,7 +1,6 @@ const sdk = require('@defillama/sdk'); const { unwrapUniswapLPs, } = require('../helper/unwrapLPs') const abi = require('./abi.json') -const { transformAvaxAddress } = require('../helper/portedTokens'); const { staking } = require('../helper/staking'); const steakMasterChef = '0xddBfBd5dc3BA0FeB96Cb513B689966b2176d4c09'; @@ -11,7 +10,7 @@ async function tvl(timestamp, block, chainBlocks) { const balances = {}; const lps = [] - const transformAddress = await transformAvaxAddress() + const transformAddress = addr => 'avax:'+addr const { output: poolLength } = await sdk.api.abi.call({ target: steakMasterChef, diff --git a/projects/steakbank/abis.json b/projects/steakbank/abis.json index bfbef5b43e7..7396c21e80b 100644 --- a/projects/steakbank/abis.json +++ b/projects/steakbank/abis.json @@ -1,3 +1,3 @@ { - "lbnbMarketCapacityCountByBNB":{"inputs":[],"name":"lbnbMarketCapacityCountByBNB","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"} + "lbnbMarketCapacityCountByBNB": "uint256:lbnbMarketCapacityCountByBNB" } \ No newline at end of file diff --git a/projects/steakbank/index.js b/projects/steakbank/index.js index 7f24ddeed2e..9a4f7c52c8f 100644 --- a/projects/steakbank/index.js +++ b/projects/steakbank/index.js @@ -1,8 +1,9 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk') const abis = require('./abis.json') const stakingContract = "0x79DB0dAa012F4b98F332A9D45c80A1A3FFaa6f9a" -const wbnb = "bsc:0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c" +const wbnb = "bsc:" + ADDRESSES.bsc.WBNB async function tvl(timestamp, ethBlock, chainBlocks){ const stakedBNB = await sdk.api.abi.call({ diff --git a/projects/steer/index.js b/projects/steer/index.js new file mode 100644 index 00000000000..968135991bb --- /dev/null +++ b/projects/steer/index.js @@ -0,0 +1,43 @@ +const { getLogs } = require('../helper/cache/getLogs') +const config = { + polygon: { registry: '0x24825b3c44742600d3995d1d3760ccee999a7f0b', fromBlock: 41535540, }, + arbitrum: { registry: '0x9f5b097AD23e2CF4F34e502A3E41D941678877Dc', fromBlock: 88698956, }, + optimism: { registry: '0xC1Ecd10398A6D7036CceE1f50551ff169715081c', fromBlock: 96971465, }, + avax: { registry: '0x9f5b097AD23e2CF4F34e502A3E41D941678877Dc', fromBlock: 30434642, }, + bsc: { registry: '0x31e4ee367d4f2685BAfcAb9566e9C87E60D48983', fromBlock: 28461459, }, + evmos: { registry: '0xD90c8970708FfdFC403bdb56636621e3E9CCe921', fromBlock: 13671900, }, + metis: { registry: '0x116Dba5DcE9CcDA828218b7eB46406810632014C', fromBlock: 6067741, }, + polygon_zkevm: { registry: '0x9f5b097AD23e2CF4F34e502A3E41D941678877Dc', fromBlock: 1022413, }, + celo: { registry: '0x116Dba5DcE9CcDA828218b7eB46406810632014C', fromBlock: 19813127, }, + thundercore: { registry: '0xa1Dd21fbd9e1F0BF28d41F18bDC22326e50C02e9', fromBlock: 135181847, }, +} + +module.exports = {}; + +Object.keys(config).forEach(chain => { + const { registry, fromBlock, } = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const logs = await getLogs({ + api, + target: registry, + topic: "VaultCreated(address,address,string,uint256,address)", + eventAbi: 'event VaultCreated(address deployer, address vault, string beaconName, uint256 indexed tokenId, address vaultManager)', + onlyArgs: true, + fromBlock, + }) + const vaults = logs.map(log => log.vault) + const bals = await api.multiCall({ abi: "function getTotalAmounts() view returns (uint256 total0, uint256 total1)", calls: vaults, permitFailure: true, }) + const token0s = await api.multiCall({ abi: "address:token0", calls: vaults, permitFailure: true, }) + const token1s = await api.multiCall({ abi: "address:token1", calls: vaults, permitFailure: true, }) + bals.forEach((bal, i) => { + const token0 = token0s[i] + const token1 = token1s[i] + if (!bal || !token0 || !token1) return // skip failures + api.add(token0, bal.total0) + api.add(token1, bal.total1) + }) + return api.getBalances() + } + } +}) \ No newline at end of file diff --git a/projects/stellarx/index.js b/projects/stellarx/index.js index 4c6fc2b9699..d59f5537470 100644 --- a/projects/stellarx/index.js +++ b/projects/stellarx/index.js @@ -1,11 +1,10 @@ -const utils = require('../helper/utils'); +const { get } = require('../helper/http'); async function fetch() { - var totalTvl = await utils.fetchURL('https://amm-api.stellarx.com/api/pools/30d-statistic/?pool_string='); - return totalTvl.data[totalTvl.data.length-1].liquidity; + var totalTvl = await get('https://amm-api.stellarx.com/api/pools/?cursor=1&format=json&limit=500&order=desc&orderField=liquidity'); + return totalTvl.pools.reduce((a, i) => a + i.liquidity, 0) } module.exports = { fetch, - } diff --git a/projects/stellaswap-v3/index.js b/projects/stellaswap-v3/index.js new file mode 100644 index 00000000000..460e043759c --- /dev/null +++ b/projects/stellaswap-v3/index.js @@ -0,0 +1,9 @@ +const { uniV3Export } = require("../helper/uniswapV3"); + +module.exports = uniV3Export({ + moonbeam: { + factory: "0xabe1655110112d0e45ef91e94f8d757e4ddba59c", + fromBlock: 2649801, + isAlgebra: true, + }, +}); diff --git a/projects/stellaxyz-io/index.js b/projects/stellaxyz-io/index.js new file mode 100644 index 00000000000..915e42eb5e7 --- /dev/null +++ b/projects/stellaxyz-io/index.js @@ -0,0 +1,40 @@ +const { sumTokens2 } = require('../helper/unwrapLPs') +const { getLogs, getAddress } = require('../helper/cache/getLogs'); + +const config = { + arbitrum: { + lendingContracts: [ + '0x3251f402cc06b33e742f08e1adbe0d2e4c1ea2fa', + '0x36569fbc5a9d4c59d71e81d46db24256a09d1ad6', + '0x5ecb93b3ef882bf42fee65541942d50a7dab4b33', + '0x8e57143d14bae132210cfeec58d0c48875f7d415', + '0xab416e57ec74e87295b8a1507745a954b0bb9f02', + ], + factory: '0x573a89fBc6b4a5B11a55DC9814A1018a3A9cD0CA', + fromBlock: 101291920, + } +} + +module.exports = { +}; + +Object.keys(config).forEach(chain => { + const { lendingContracts, factory, fromBlock, } = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const logs = await getLogs({ + api, + target: factory, + topics: ['0x0803371633b57311f58d10924711080d2dae75ab17c5c0c262af3887cfca00bb'], + fromBlock, + }) + + const strategies = logs.map(i => getAddress(i.data.slice(64, 64 * 2 + 2))) + const positionManagers = await api.multiCall({ abi: 'address:positionManager', calls: strategies}) + + const tokens = await api.multiCall({ abi: 'address:depositToken', calls: lendingContracts }) + await sumTokens2({ api, tokensAndOwners2: [tokens, lendingContracts] }) + return sumTokens2({ api, owners: positionManagers, resolveUniV3: true, }) + } + } +}) \ No newline at end of file diff --git a/projects/sterling-finance/index.js b/projects/sterling-finance/index.js new file mode 100644 index 00000000000..f6a304404e9 --- /dev/null +++ b/projects/sterling-finance/index.js @@ -0,0 +1,12 @@ +const {getUniTVL} = require('../helper/unknownTokens') + +module.exports = { + misrepresentedTokens: true, + arbitrum:{ + tvl: getUniTVL({ + factory: '0xF7A23B9A9dCB8d0aff67012565C5844C20C11AFC', + useDefaultCoreAssets: true, + hasStablePools: true, + }) + }, +} \ No newline at end of file diff --git a/projects/steroids/index.js b/projects/steroids/index.js index 44fa1210393..b35ffdee16d 100644 --- a/projects/steroids/index.js +++ b/projects/steroids/index.js @@ -1,5 +1,5 @@ -const { sumTokens, unwrapCrv, sumTokensAndLPs, } = require('../helper/unwrapLPs') +const { sumTokens2, } = require('../helper/unwrapLPs') const UNI_CONTRACTS = { pntETH: { @@ -29,32 +29,10 @@ const CURVE_CONTRACTS = [{ // pBTCsBTC curve token: '0xDE5331AC4B3630f94853Ff322B66407e0D6331E8', }] -const unwrapCurveMetaPool = [ - '0x075b1bb99792c9e1041ba13afef80c91a1e70fb3' // wBTC-SBTC curve pool -] - - -async function tvl(timestamp, block) { - const balances = {} - const curveLPs = {} - - const uniTokens = Object.values(UNI_CONTRACTS).map(({ uniPair, address }) => [uniPair, address, true]) - // Resolve all Unswap LPs staked - await sumTokensAndLPs(balances, uniTokens, block) - - // Resolve pBTC curve pool that was staked - await sumTokens(curveLPs, CURVE_CONTRACTS.map(({ token, address }) => [token, address]), block,) - const unwarpCurves = Object.keys(curveLPs).map(token => unwrapCrv(balances, token, curveLPs[token], block)) - await Promise.all(unwarpCurves) - for (const unwrapCurveToken of unwrapCurveMetaPool) { - if (balances[unwrapCurveToken]) { - await unwrapCrv(balances, unwrapCurveToken, balances[unwrapCurveToken], block) - delete balances[unwrapCurveToken] - } - } - - return balances -} +async function tvl(timestamp, block, _, { api }) { + const toa = Object.values(UNI_CONTRACTS).map(({ uniPair, address }) => ([uniPair, address])) + CURVE_CONTRACTS.forEach(i => toa.push([i.token, i.address])) + return sumTokens2({ api, tokensAndOwners: toa})} module.exports = { diff --git a/projects/steth-win/index.js b/projects/steth-win/index.js new file mode 100644 index 00000000000..281458b0849 --- /dev/null +++ b/projects/steth-win/index.js @@ -0,0 +1,12 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require('../helper/unwrapLPs'); + +const POOL_CONTRACT = '0x2758b8d894b08342f0d00ac5f9466fdc795e4618'; +const STETH_CONTRACT = ADDRESSES.ethereum.STETH; + +module.exports = { + methodology: 'Counts the number of stETH tokens in the pool and calculates its TVL', + ethereum: { + tvl: sumTokensExport({ owner: POOL_CONTRACT, tokens: [STETH_CONTRACT] }), + } +}; diff --git a/projects/stfil/index.js b/projects/stfil/index.js new file mode 100644 index 00000000000..62785876ad7 --- /dev/null +++ b/projects/stfil/index.js @@ -0,0 +1,35 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const {sumTokens2} = require('../helper/unwrapLPs'); +const {utils} = require("ethers"); +const {get} = require('../helper/http'); + +const poolAddr = '0xC8E4EF1148D11F8C557f677eE3C73901CD796Bf6' // pool address +const tokens = [ + ADDRESSES.null, // FIL +] + +const getActiveMinersFromRPC = async () => { + const resp = await get('https://api.stfil.io/v1/node?delegate=1') + return resp.data.map(({node}) => { + let bytes = Buffer.alloc(20); + bytes.writeUint8(0xff, 0); + bytes.writeBigUint64BE(BigInt(node), 12); + return utils.getAddress('0x' + bytes.toString('hex')); + }); +} + +module.exports = { + filecoin: { + tvl: async (_, _1, _2, {api}) => { + + let balances = {}; + await sumTokens2({balances, owner: poolAddr, tokens, api, }); + + let minerAddrs = await getActiveMinersFromRPC(); + await sumTokens2({balances, owners: minerAddrs, tokens, api, }); + + return balances; + } + } +} + diff --git a/projects/stlos-liquid-staking/index.js b/projects/stlos-liquid-staking/index.js index 9dc8558013d..39c91368797 100644 --- a/projects/stlos-liquid-staking/index.js +++ b/projects/stlos-liquid-staking/index.js @@ -1,7 +1,8 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const sTlosAbi = require("./sTlos.json"); -const sTLOS = "0xb4b01216a5bc8f1c8a33cd990a1239030e60c905"; +const sTLOS = ADDRESSES.telos.STLOS; async function tvl(timestamp, _, { telos: block }) { const pooledTLOS = await sdk.api.abi.call({ diff --git a/projects/stlos-liquid-staking/sTlos.json b/projects/stlos-liquid-staking/sTlos.json index d403f336d5c..dda88359cae 100644 --- a/projects/stlos-liquid-staking/sTlos.json +++ b/projects/stlos-liquid-staking/sTlos.json @@ -1,18 +1,3 @@ { - "totalAssets": { - "inputs": [], - "name": "totalAssets", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } - } - - - + "totalAssets": "uint256:totalAssets" +} \ No newline at end of file diff --git a/projects/ston/index.js b/projects/ston/index.js new file mode 100644 index 00000000000..ea4db669f8a --- /dev/null +++ b/projects/ston/index.js @@ -0,0 +1,24 @@ +const { post } = require('../helper/http') +const { transformDexBalances } = require('../helper/portedTokens') +const sdk = require('@defillama/sdk') + +module.exports = { + misrepresentedTokens: true, + timetravel: false, + ton: { + tvl: async () => { + const { result: {pools}} = await post('https://app.ston.fi/rpc', {"jsonrpc":"2.0","id":2,"method":"pool.list","params":{}}) + sdk.log(pools.length) + + return transformDexBalances({ + chain: 'ton', + data: pools.map(i => ({ + token0: i.token0_address, + token1: i.token1_address, + token0Bal: i.reserve0, + token1Bal: i.reserve1, + })) + }) + } + } +} diff --git a/projects/stonedefi/abi.json b/projects/stonedefi/abi.json index 35b064bef2a..96cbc77ed6a 100644 --- a/projects/stonedefi/abi.json +++ b/projects/stonedefi/abi.json @@ -1,25 +1,5 @@ { - "token": { - "stateMutability": "view", - "type": "function", - "name": "token", - "inputs": [], - "outputs": [{ "name": "", "type": "address" }], - "gas": 3948 - }, - "totalAssets": { - "stateMutability": "view", - "type": "function", - "name": "totalAssets", - "inputs": [], - "outputs": [{ "name": "", "type": "uint256" }], - "gas": 8878 - }, - "stbnbMarketCapacityCountByBNB": { - "inputs": [], - "name": "stbnbMarketCapacityCountByBNB", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - } -} + "token": "address:token", + "totalAssets": "uint256:totalAssets", + "stbnbMarketCapacityCountByBNB": "uint256:stbnbMarketCapacityCountByBNB" +} \ No newline at end of file diff --git a/projects/stonedefi/index.js b/projects/stonedefi/index.js index f4f09d247d7..0dd3242770c 100644 --- a/projects/stonedefi/index.js +++ b/projects/stonedefi/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); const {BigNumber} = require("bignumber.js"); @@ -135,7 +136,7 @@ module.exports = { pool2: pool2s([bsccakevault, stbnbcakevault], [stbnbcakelp, bsccakelp], "bsc", addr=>{ addr = addr.toLowerCase(); if (addr === "0xd523a3c371c0c301794120c7ca9639f22c02839a") { - return "bsc:0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c" + return "bsc:" + ADDRESSES.bsc.WBNB } else if (addr === "0xf7fb08c187e6cd1f2149e6c818d0b6d4d4ef1430") { return "0xe63d6b308bce0f6193aec6b7e6eba005f41e36ab" diff --git a/projects/stream/abi.js b/projects/stream/abi.js new file mode 100644 index 00000000000..59be2467e3b --- /dev/null +++ b/projects/stream/abi.js @@ -0,0 +1,4 @@ +module.exports = { + currentExchangeRate: + "function currentExchangeRate() view returns (uint256 vaultToken, uint256 baseToken)", +}; diff --git a/projects/stream/index.js b/projects/stream/index.js new file mode 100644 index 00000000000..2c07821302f --- /dev/null +++ b/projects/stream/index.js @@ -0,0 +1,42 @@ +const sdk = require("@defillama/sdk"); +const abi = require("./abi.js"); +const USDW4_TOKEN_CONTRACT = "0xadf789e61bf38c463e4ba5b2b6e9c1af6659e11b"; +const TBILL_VAULT_CLUB_BOND_CONTRACT = + "0xd86FFB404147163e19E010a0e9d4995E0e36F335"; + +async function tvl(_, _1, _2, { api }) { + const totalSupply = await api.call({ + abi: "erc20:totalSupply", + target: USDW4_TOKEN_CONTRACT, + }); + + const decimals = await api.call({ + abi: "erc20:decimals", + target: USDW4_TOKEN_CONTRACT, + }); + + const vaultBalance = await api.call({ + abi: "erc20:balanceOf", + target: USDW4_TOKEN_CONTRACT, + params: [TBILL_VAULT_CLUB_BOND_CONTRACT], + }); + + const { vaultToken, baseToken } = await api.call({ + abi: abi.currentExchangeRate, + target: TBILL_VAULT_CLUB_BOND_CONTRACT, + }); + + return { + "usd-coin": + (totalSupply - vaultBalance) / (vaultToken / baseToken) / 10 ** decimals, + }; +} + +module.exports = { + misrepresentedTokens: true, + methodology: "Calculates the TVL of the General Purpose T-Bills Vault.", + start: 16685700, + ethereum: { + tvl, + }, +}; diff --git a/projects/streamflow/api.js b/projects/streamflow/api.js new file mode 100644 index 00000000000..1fc818100b4 --- /dev/null +++ b/projects/streamflow/api.js @@ -0,0 +1,7 @@ +const { getExports } = require('../helper/heroku-api') + +module.exports = { + timetravel: false, + misrepresentedTokens: true, + ...getExports("streamflow", ['solana'], ['vesting']), +} \ No newline at end of file diff --git a/projects/streamflow/index.js b/projects/streamflow/index.js new file mode 100644 index 00000000000..517cc1b6814 --- /dev/null +++ b/projects/streamflow/index.js @@ -0,0 +1,53 @@ +const { getCache } = require('../helper/http') + +const TVL_KEY = "tvl"; +const VESTING_KEY = "tvl_vested"; +const api = + "https://metabase.internal-streamflow.com/_public/api/v1/stats/accumulated"; +const chains = [ + "solana", + "aptos", + "bsc", + "polygon", + "ethereum", +]; +const chainMapping = { + bsc: 'bnb' +}; + +const getValueForKey = (arr, chain, key) => { + for (let i = 0; i < arr.length; i++) { + if (arr[i].chain.toLowerCase() === (chainMapping[chain] || chain) && arr[i][key] !== undefined) { + return arr[i][key]; + } + } + return 0; +} + +async function getCachedApiRespnse() { + let apiResponse = (await getCache(api)); + + return apiResponse; +} + +async function tvl(_, _1, _2, { api }) { + return { + tether: getValueForKey(await getCachedApiRespnse(), api.chain, TVL_KEY), + } +} +async function vesting(_, _1, _2, { api }) { + return { + tether: getValueForKey(await getCachedApiRespnse(), api.chain, VESTING_KEY), + } +} + +module.exports = { + methodology: 'Token breakdown: https://metabase.internal-streamflow.com/public/dashboard/fe3731c1-fbe4-4fb6-8960-515af1d6e72d', + timetravel: false, + misrepresentedTokens: true, +} +chains.forEach((chain) => { + module.exports[chain] = { + tvl, vesting + }; +}); diff --git a/projects/stride/index.js b/projects/stride/index.js index 2b14756ce1f..ad75c2740e5 100644 --- a/projects/stride/index.js +++ b/projects/stride/index.js @@ -1,37 +1,63 @@ -const sdk = require('@defillama/sdk') -const { get } = require('../helper/http'); -const { log } = require('../helper/utils'); +const sdk = require("@defillama/sdk"); +const { get } = require("../helper/http"); const coinGeckoIds = { uatom: "cosmos", ustars: "stargaze", ujuno: "juno-network", uosmo: "osmosis", + uluna: "terra-luna-2", + aevmos: "evmos", + inj: "injective-protocol", + uumee: "umee", + ucmdx: "comdex", }; +function getCoinDenom(denom) { + // inj uses 1e18 - https://docs.injective.network/learn/basic-concepts/inj_coin#base-denomination + const idArray = ['aevmos', 'inj']; + + if (idArray.includes(denom)) { + return 1e18; + } else { + return 1e6; + } +} + async function tvl() { - const balances = {} - const { - host_zone: hostZones - } = await get("https://stride-library.main.stridenet.co/api/Stride-Labs/stride/stakeibc/host_zone"); + const balances = {}; + + const { host_zone: hostZones } = await get( + "https://stride-fleet.main.stridenet.co/api/Stride-Labs/stride/stakeibc/host_zone" + ); - const { - supply: assetBalances - } = await get("https://stride-fleet.main.stridenet.co/api/cosmos/bank/v1beta1/supply"); + const { supply: assetBalances } = await get( + "https://stride-fleet.main.stridenet.co/api/cosmos/bank/v1beta1/supply" + ); hostZones.map((hostZone) => { const assetBalance = assetBalances.find((asset) => { return asset.denom === `st${hostZone.host_denom}`; }); - const amount = assetBalance.amount / 1e6; - const geckoId = coinGeckoIds[hostZone.host_denom] - if (!geckoId) - throw new Error('Missing gecko mapping: '+hostZone.host_denom) - sdk.util.sumSingleBalance(balances, geckoId, amount * hostZone.redemption_rate) + const coinDecimals = getCoinDenom(hostZone.host_denom); + + const amount = assetBalance.amount / coinDecimals; + + const geckoId = coinGeckoIds[hostZone.host_denom]; + + if (!geckoId) { + throw new Error("Missing gecko mapping: " + hostZone.host_denom); + } + + sdk.util.sumSingleBalance( + balances, + geckoId, + amount * hostZone.redemption_rate + ); }); - return balances + return balances; } module.exports = { diff --git a/projects/strike/index.js b/projects/strike/index.js index c93a23b0201..40f8308780b 100644 --- a/projects/strike/index.js +++ b/projects/strike/index.js @@ -1,5 +1,6 @@ +const ADDRESSES = require('../helper/coreAssets.json') const {fullCoumpoundExports} = require('../helper/compound') const comptroller = "0xe2e17b2CBbf48211FA7eB8A875360e5e39bA2602" -module.exports=fullCoumpoundExports(comptroller, "ethereum", "0xbEe9Cf658702527b0AcB2719c1FAA29EdC006a92", "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2") \ No newline at end of file +module.exports=fullCoumpoundExports(comptroller, "ethereum", "0xbEe9Cf658702527b0AcB2719c1FAA29EdC006a92", ADDRESSES.ethereum.WETH) \ No newline at end of file diff --git a/projects/strips/abi.json b/projects/strips/abi.json index 83d45062865..a298b68429a 100644 --- a/projects/strips/abi.json +++ b/projects/strips/abi.json @@ -1,40 +1,4 @@ { - "getAllMarkets": { - "inputs": [], - "name": "getAllMarkets", - "outputs": [ - { - "components": [ - { - "internalType": "bool", - "name": "created", - "type": "bool" - }, - { - "internalType": "address", - "name": "market", - "type": "address" - } - ], - "internalType": "struct IStrips.ExtendedMarketData[]", - "name": "", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getLiquidity": { - "inputs": [], - "name": "getLiquidity", - "outputs": [ - { - "internalType": "int256", - "name": "", - "type": "int256" - } - ], - "stateMutability": "view", - "type": "function" - } + "getAllMarkets": "function getAllMarkets() view returns (tuple(bool created, address market)[])", + "getLiquidity": "int256:getLiquidity" } \ No newline at end of file diff --git a/projects/strips/index.js b/projects/strips/index.js index 03d533504c0..0068a5f02d7 100644 --- a/projects/strips/index.js +++ b/projects/strips/index.js @@ -1,7 +1,8 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk'); const abi = require('./abi.json'); const stripsContract = '0xFC03E4A954B7FF631e4a32360CaebB27B6849457'; -const usdc = '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48'; +const usdc = ADDRESSES.ethereum.USDC; const chain = 'arbitrum'; async function getMarkets(block) { @@ -12,7 +13,7 @@ async function getMarkets(block) { block, }); return allMarkets.filter(c => c.created).map(c => c.market); -}; +} async function pool2(timestamp, block, chainBlocks) { block = chainBlocks.arbitrum diff --git a/projects/struct-finance/index.js b/projects/struct-finance/index.js new file mode 100644 index 00000000000..891238abff3 --- /dev/null +++ b/projects/struct-finance/index.js @@ -0,0 +1,29 @@ +const ADDRESSES = require('../helper/coreAssets.json'); +const { sumTokens2 } = require("../helper/unwrapLPs"); + +const addresses = { + struct: { + gmxYieldSource: "0x6aE12b0adF9716181c07D19dfe76442AB1b3817b", + gmxFactory: "0x46f8765781ac36e5e8f9937658fa311af9d735d7", + }, + token: { + fsGlp: "0x9e295b5b976a184b14ad8cd72413ad846c299660", + }, +}; + +async function tvl(ts, _, __, { api }) { + const vaults = await api.fetchList({ lengthAbi: 'uint256:totalProducts', itemAbi: "function allProducts(uint256) external view returns (address)", target: addresses.struct.gmxFactory}) + vaults.push(addresses.struct.gmxYieldSource); + + return sumTokens2({ + api, + owners: vaults, + tokens: [ADDRESSES.avax.BTC_b, ADDRESSES.avax.USDC, addresses.token.fsGlp], + }); +} + +module.exports = { + avax: { + tvl, + }, +}; diff --git a/projects/strxfinance/index.js b/projects/strxfinance/index.js index fe20f71e7c1..b9b07834a49 100644 --- a/projects/strxfinance/index.js +++ b/projects/strxfinance/index.js @@ -1,19 +1,28 @@ -const { getTrxBalance } = require('../helper/chain/tron'); -const STAKINGPOOL_ADDRESS = 'TGrdCu9fu8csFmQptVE25fDzFmPU9epamH'; -const FREEZE_ADDRESS = 'TSTrx3UteLMBdeGe9Edwwi2hLeQCmLPZ5g'; +const { + postURL +} = require('../helper/utils'); + +async function getCurrentStake() { + let postdata = { + "contract_address": "414b8a2c619bccb710206b3d11e28dce62d8d72a8b", + "owner_address": "4128fb7be6c95a27217e0e0bff42ca50cd9461cc9f", + "function_selector": "reservedTRX()", + "parameter": "", + "call_value": 0 + }; + let result = await postURL('https://api.trongrid.io/wallet/triggerconstantcontract', postdata); + let trx = parseInt(result.data.constant_result[0], 16) / 10 ** 6; + return trx; +} async function tvl() { - const [stakingBalance, freezeBalance] = await Promise.all([ - getTrxBalance(STAKINGPOOL_ADDRESS), - getTrxBalance(FREEZE_ADDRESS), - ]); - return { - "tron": (stakingBalance + freezeBalance) / 10 ** 6, - }; + return { + "tron": await getCurrentStake() + } } module.exports = { - tron: { - tvl, - }, -} \ No newline at end of file + tron: { + tvl, + }, +} diff --git a/projects/sturdy/index.js b/projects/sturdy/index.js index 2617fca12d7..55d9f32cb5b 100644 --- a/projects/sturdy/index.js +++ b/projects/sturdy/index.js @@ -1,67 +1,20 @@ -const { request, gql } = require("graphql-request"); -const { toUSDTBalances } = require("../helper/balances"); - -const graphUrl_ftm = - 'https://api.thegraph.com/subgraphs/name/sturdyfi/sturdy-fantom'; -const graphUrl_eth = - 'https://api.thegraph.com/subgraphs/name/sturdyfi/sturdy-ethereum'; - -const graphQuery = gql` - query get_tvl { - reserves { - name - symbol - decimals - price { - priceInEth - } - totalDeposits - totalLiquidity - availableLiquidity - totalCurrentVariableDebt - } - usdPriceEth: priceOracle(id: "1") { - usdPriceEth - } - } -`; - -const priceInUSD = (value, decimals, price) => { - return (value / Math.pow(10, decimals) * price / Math.pow(10, 8)).toFixed(2); -} - -async function fetch(borrow, chain) { - const graphUrl = chain == 'fantom' ? graphUrl_ftm : graphUrl_eth; - const { reserves, usdPriceEth } = await request(graphUrl, graphQuery); - let tvl = reserves.reduce((sum, reserve) => { - const value = borrow ? reserve.totalCurrentVariableDebt : reserve.availableLiquidity; - return sum + +priceInUSD(value, reserve.decimals, reserve.price.priceInEth); - }, 0); - - if (chain != 'ethereum') - return toUSDTBalances(tvl); - - const ethPrice = Math.pow(10, 18) / usdPriceEth.usdPriceEth; - tvl = tvl / Math.pow(10, 10) * ethPrice; - return toUSDTBalances(tvl); -} - -const borrowed = (chain) => async (_timestamp, _ethBlock, chainBlocks) => { - return await fetch(true, chain); -} - -const tvl = (chain) => async (_timestamp, _ethBlock, chainBlocks) => { - return await fetch(false, chain); -} - -module.exports = { +const ADDRESSES = require('../helper/coreAssets.json') +const { aaveV2Export, } = require('../helper/aave'); +const { mergeExports, } = require('../helper/utils'); + +module.exports = mergeExports([ + { + ethereum: aaveV2Export('0x9f72DC67ceC672bB99e3d02CbEA0a21536a2b657', { useOracle: true }), + }, + { misrepresentedTokens: true, - fantom: { - tvl: tvl('fantom'), - borrowed: borrowed('fantom'), - }, - ethereum: { - tvl: tvl('ethereum'), - borrowed: borrowed('ethereum'), - }, -}; + hallmarks: [ + [Math.floor(new Date('2023-06-11')/1e3), 'Protocol was hacked'], + ], + ethereum: aaveV2Export('0xA422CA380bd70EeF876292839222159E41AAEe17', { useOracle: true }), + fantom: aaveV2Export('0x7ff2520cd7b76e8c49b5db51505b842d665f3e9a', { useOracle: true, baseCurrency: ADDRESSES.fantom.DAI }), + methodology: "Counts the tokens locked in the contracts to be used as collateral to borrow or to earn yield. Borrowed coins are not counted towards the TVL, so only the coins actually locked in the contracts are counted. There's multiple reasons behind this but one of the main ones is to avoid inflating the TVL through cycled lending.. TVL is calculated by getting the market addresses from comptroller and calling the getCash() on-chain method to get the amount of tokens locked in each of these addresses, then we get the price of each token from coingecko. To view the Borrowed amounts along with the currently liquidity, click the 'Borrowed' check box", + } +]) + +module.exports.doublecounted = true diff --git a/projects/subzero-plus/index.js b/projects/subzero-plus/index.js new file mode 100644 index 00000000000..0631d9699df --- /dev/null +++ b/projects/subzero-plus/index.js @@ -0,0 +1,22 @@ +const { unknownTombs } = require("../helper/unknownTokens") + +const avaxZShare = "0xF5b1A0d66856CBF5627b0105714a7E8a89977349" +const avaxChef = "0xDAccfd92e37be54Ca1A8ff37A7922446614b4759" // ZShare reward pool +const avaxBoardroom = "0xa252FfDB3A73Bd0F88Eea39658c7C00a281B3bB6" +const avaxAbzero = "0xD9Ef0818432b87a17709b62D0cB78a3fEa57Cb00" + +const lps = [ + "0xD1D0340d80bee3c6f90116467a78dC3718121100", // SUB-AVAX LP + "0xbfE8B1f30035262903927F5BfD65319ef09B48B5", // ZSHARE-SUB LP + "0x763513C7e639A21D0a7d4A5ec60a6e7314Ed00C8", // ZSHARE-AVAX LP +] + +module.exports = unknownTombs({ + lps, + token: avaxAbzero, + shares: [avaxZShare,], + rewardPool: [avaxChef], + masonry: [avaxBoardroom], + chain: 'avax', + useDefaultCoreAssets: true, +}) diff --git a/projects/sudoinu/index.js b/projects/sudoinu/index.js index a5a7469b533..912e4c24a9b 100644 --- a/projects/sudoinu/index.js +++ b/projects/sudoinu/index.js @@ -5,25 +5,7 @@ module.exports = masterchefExports({ masterchef: '0x32E9BB1E0E03fdaC8131De202Be2f55AceDB349f', nativeTokens: ['0x93b743Fb12a2677adB13093f8eA8464A436DA008'], useDefaultCoreAssets: true, - poolInfoABI: { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "poolToken", - "outputs": [ - { - "internalType": "contract ERC20", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, + poolInfoABI: 'function poolToken(uint256) view returns (address)', getToken: i => i }) diff --git a/projects/sudoswap-v2/index.js b/projects/sudoswap-v2/index.js new file mode 100644 index 00000000000..43b20ad057e --- /dev/null +++ b/projects/sudoswap-v2/index.js @@ -0,0 +1,34 @@ +const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') +const { getLogs } = require('../helper/cache/getLogs') + +async function tvl(_, _b, _cb, { api, }) { + const multicallAddy = '0xca11bde05977b3631167028862be2a173976ca11' + const logs1155 = await getLogs({ + api, + target: '0xA020d57aB0448Ef74115c112D18a9C231CC86000', + topics: ['0x2966b6b401975e778520aec46cbefbe73799119a5670feda3e8f884c7c3ffb11'], + eventAbi: 'event NewERC1155Pair(address indexed pool, uint256 initialBalance)', + onlyArgs: true, + fromBlock: 17309203, + extraKey: 'erc1155', + }) + const logs721 = await getLogs({ + api, + target: '0xA020d57aB0448Ef74115c112D18a9C231CC86000', + topics: ['0xe8e1cee58c33f242c87d563bbc00f2ac82eb90f10a252b0ba8498ae6c1dc241a'], + eventAbi: 'event NewERC721Pair(address indexed pool, uint256[] initialIds)', + onlyArgs: true, + fromBlock: 17309203, + extraKey: 'erc721', + }) + const pools = logs721.map(i => i.pool) + const allPools = [...logs1155, ...logs721].map(log => log.pool) + const nfts = await api.multiCall({ abi: 'address:nft', calls: pools}) + const ethBals = await api.multiCall({ abi: 'function getEthBalance(address) view returns (uint256)', calls: allPools, target: multicallAddy}) + ethBals.forEach(i => api.add(nullAddress, i)) + await sumTokens2({ api, tokensAndOwners2: [nfts, pools], permitFailure: true, }) +} + +module.exports = { + ethereum: { tvl, } +} \ No newline at end of file diff --git a/projects/sudoswap/index.js b/projects/sudoswap/index.js index aeccb0b2a9c..5b1235cf79a 100644 --- a/projects/sudoswap/index.js +++ b/projects/sudoswap/index.js @@ -1,33 +1,96 @@ +const { graphFetchById, } = require('../helper/http') +const { ART_BLOCKS, sumArtBlocks } = require('../helper/nft') const sdk = require('@defillama/sdk') -const { nullAddress, sumTokens2 } = require('../helper/unwrapLPs') -const { sliceIntoChunks, log, } = require('../helper/utils') + +const query = ` +query get_pairs($lastId: String, $block: Int) { + pairs( + first: 1000 + block: { number: $block } + where: { + and: [ + {id_gt: $lastId} + { + or: [ + { numNfts_gt: 0 }, + { ethBalance_gt: 0 }, + ] + } + ] + } + ) { + id + ethBalance + collection { + id + } + spotPrice + numNfts + } +}` + +module.exports = { + methodology: 'Sum up all the ETH in pools and count whitelisted NFT values as well (price fetched from chainlink)', + ethereum: { + tvl: async (timestamp, block, chainBlocks, { api }) => { + const data = await graphFetchById({ + endpoint: 'https://api.thegraph.com/subgraphs/name/zeframlou/sudoswap', + query, + api, + options: { + useBlock: true, + safeBlockLimit: 500, + } + }) + const balances = {} + const artBlockOwners = [] + data.forEach(({ ethBalance, collection, numNfts, id }) => { + sdk.util.sumSingleBalance(balances, 'ethereum', ethBalance / 1e18) + const nft = collection.id.toLowerCase() + + if (+numNfts > 0) { + if (nft === ART_BLOCKS) { + artBlockOwners.push(id) + return; + } + sdk.util.sumSingleBalance(balances, nft, numNfts) + } + }) + + return sumArtBlocks({ api, owners: artBlockOwners, balances, }) + } + } +} + +/* +const { getLogs } = require('../helper/cache/getLogs') +const { getCache, setCache } = require('../helper/cache') +const { nullAddress, } = require('../helper/unwrapLPs') module.exports = { - methodology: 'Sum up all the ETH in pools', + methodology: 'Sum up all the ETH & nfts in pools', ethereum: { - tvl: async (_, block) => { - const chain = 'ethereum' + tvl: async (_, block, _1, { api }) => { const PairFactory = '0xb16c1342E617A5B6E4b631EB114483FDB289c0A4' - const logs = await sdk.api.util.getLogs({ - keys: [], - toBlock: block, + const logs = await getLogs({ + api, target: PairFactory, - fromBlock: 14650107, - topic: 'NewPair(address)', + topics: ['0xf5bdc103c3e68a20d5f97d2d46792d3fdddfa4efeb6761f8141e6a7b936ca66c'], + eventAbi: 'event NewPair(address pool)', + onlyArgs: true, + fromBlock: 14645816, }) + const pools = logs.map(i => i.pool) + const cache = await getCache('sudoswap-v1', api.chain) + if (!cache.pools) cache.nfts = [] + const missingPools = pools.slice(cache.nfts.length) + const missingNfts = await api.multiCall({ abi: 'address:nft', calls: missingPools}) + cache.nfts.push(...missingNfts) - // TODO: improve logic here, might end up with too many pools - const ownersList = logs.output.map(i => `0x${i.data.substring(26, 66)}`) - log('List of owners: %s', ownersList.length) - - const ownerArrays = sliceIntoChunks(ownersList, 100) - const balances = {} - let i = 0 - for (const owners of ownerArrays) { - log('fetching %s of %s', ++i, ownerArrays.length) - await sumTokens2({ tokens: [nullAddress], owners, chain, block, balances, }) - } - return balances + if (missingPools.length > 0) await setCache('sudoswap-v1', api.chain, cache) + await api.sumTokens({ owners: pools, tokens: [nullAddress]}) + return api.sumTokens({ tokensAndOwners2: [cache.nfts, pools], blacklistedTokens: ['0x08142348e6bbf233002b81047bc2f27026af10a5']}) } } } +*/ \ No newline at end of file diff --git a/projects/sugarswap/index.js b/projects/sugarswap/index.js new file mode 100644 index 00000000000..23df7132dc0 --- /dev/null +++ b/projects/sugarswap/index.js @@ -0,0 +1,26 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { getUniTVL, staking } = require('../helper/unknownTokens') +const sdk = require('@defillama/sdk') +const uniTvl = getUniTVL({ factory: '0x1486397B3C0e6fEB8c483faD2F03E8c404cAEDe7', useDefaultCoreAssets: true }) +const masterchef = '0x45eecDADa0B58B0E78F94549F65FDAF447b35c17' +const sugar = '0xd3ccBF3867FF0204730173eB4cad3C4B5fd07c69' +const weth = ADDRESSES.arbitrum.WETH + +module.exports = { + hallmarks: [ + [1673827200, "Rug Pull"] + ], + misrepresentedTokens: true, + arbitrum: { + tvl: sdk.util.sumChainTvls([uniTvl, staking({ + owners: [masterchef], + tokens: [weth], + })]), + staking: staking({ + owners: [masterchef], + tokens: [sugar], + lps: ['0xD184aAbFc9De6B56994D1283ed4C132B70A73a14'], + useDefaultCoreAssets: true, + }) + } +}; \ No newline at end of file diff --git a/projects/summer-fi/api.js b/projects/summer-fi/api.js new file mode 100644 index 00000000000..702709855f7 --- /dev/null +++ b/projects/summer-fi/api.js @@ -0,0 +1,7 @@ +const {getExports} = require('../helper/heroku-api') +const chains = ['ethereum'] + +module.exports = { + timetravel: false, + ...getExports("summer-fi", chains) +} diff --git a/projects/summer-fi/constants/abi.js b/projects/summer-fi/constants/abi.js new file mode 100644 index 00000000000..5dc735e42be --- /dev/null +++ b/projects/summer-fi/constants/abi.js @@ -0,0 +1,17 @@ +module.exports = { + TriggerAdded: + "event TriggerAdded(uint256 indexed triggerId, address indexed commandAddress, uint256 indexed cdpId, bytes triggerData)", + TriggerExecuted: + "event TriggerExecuted(uint256 indexed triggerId, uint256 indexed cdpId, bytes executionData)", + TriggerRemoved: + "event TriggerRemoved(uint256 indexed cdpId, uint256 indexed triggerId)", + activeTriggers: + "function activeTriggers(uint256) view returns (bytes32 triggerHash, uint256 cdpId)", + self: "address:self", + serviceRegistry: "address:serviceRegistry", + triggersCounter: "uint256:triggersCounter", + getVaultInfo: + "function getCdpInfo(uint256 vaultId,bytes32) view returns (uint256 collateralLocked, uint256)", + ilks: "function ilks(uint256) view returns (bytes32)", + info: "function info(bytes32 ilk) view returns (string name, string symbol, uint256 class, uint256 dec, address gem, address pip, address join, address xlip)", +}; diff --git a/projects/summer-fi/constants/contracts.js b/projects/summer-fi/constants/contracts.js new file mode 100644 index 00000000000..d33ef54c98b --- /dev/null +++ b/projects/summer-fi/constants/contracts.js @@ -0,0 +1,6 @@ +module.exports = { + AutomationV1Contract: "0x6E87a7A0A03E51A741075fDf4D1FCce39a4Df01b", + McdMonitorV2: "0xa59d5E94BFE605A9a4aC7e02f5380e02061c8dd2", + CdpManager: "0x5ef30b9986345249bc32d8928b7ee64de9435e39", + IlkRegistry: "0x5a464c28d19848f44199d003bef5ecc87d090f87", +}; diff --git a/projects/summer-fi/constants/creation-blocks.js b/projects/summer-fi/constants/creation-blocks.js new file mode 100644 index 00000000000..be10d07edc4 --- /dev/null +++ b/projects/summer-fi/constants/creation-blocks.js @@ -0,0 +1,5 @@ +const creationBlocks = { + AutomationV1Contract: 14583413, +}; + +module.exports = creationBlocks; diff --git a/projects/summer-fi/constants/endpoints.js b/projects/summer-fi/constants/endpoints.js new file mode 100644 index 00000000000..517494cb664 --- /dev/null +++ b/projects/summer-fi/constants/endpoints.js @@ -0,0 +1,11 @@ +const { getEnv } = require("../../helper/env"); + +const endpoints = { + aave: () => getEnv("SUMMER_HISTORY_ENDPOINT"), + ajna: () => getEnv("SUMMER_AJNA_ENDPOINT"), + makerVaults: () => getEnv("SUMMER_CONFIRMED_VAULTS_ENDPOINT"), +}; + +module.exports = { + endpoints, +}; diff --git a/projects/summer-fi/constants/index.js b/projects/summer-fi/constants/index.js new file mode 100644 index 00000000000..382d9642311 --- /dev/null +++ b/projects/summer-fi/constants/index.js @@ -0,0 +1,11 @@ +const creationBlocks = require("./creation-blocks"); +const abi = require("./abi"); +const contracts = require("./contracts"); +const logsTopic = require("./logs-topic"); + +module.exports = { + creationBlocks, + abi, + contracts, + logsTopic, +}; diff --git a/projects/summer-fi/constants/logs-topic.js b/projects/summer-fi/constants/logs-topic.js new file mode 100644 index 00000000000..46580cecb3a --- /dev/null +++ b/projects/summer-fi/constants/logs-topic.js @@ -0,0 +1,8 @@ +module.exports = { + TriggerAdded: + "0xcb616360dd177f28577e33576c8ac7ffcc1008cba7ac2323e0b2f170faf60bd2", + TriggerExecuted: + "0xc10f224f2f1ceab5e36f97effaa05c4b75eccbecd77b65bfb20c484de9096cdd", + TriggerRemoved: + "0xb4a1fc324bd863f8cd42582bebf2ce7f2d309c6a84bf371f28e069f95a4fa9e1", +}; diff --git a/projects/summer-fi/handlers/automation-v1.js b/projects/summer-fi/handlers/automation-v1.js new file mode 100644 index 00000000000..7458782616a --- /dev/null +++ b/projects/summer-fi/handlers/automation-v1.js @@ -0,0 +1,30 @@ +const { + getCdpData, + getCdpManagerData, + getIlkRegistryData, + getDecimalsData, +} = require("../helpers"); + +const automationTvl = async ({ api, cdpIdList }) => { + let positionsWithTriggersAndCollateral = 0; + + const cdpIds = [...cdpIdList]; + const ilkNames = await getCdpManagerData(cdpIds, api); + const cdpIlkIds = {} + ilkNames.forEach((val, idx) => cdpIlkIds[cdpIds[idx]] = val) + const ilkIds = [...new Set(ilkNames)]; + const tokens = (await getIlkRegistryData(ilkIds, api)).map((i) => i[4]); + const decimals = await getDecimalsData(tokens, api); + const collData = await getCdpData(cdpIds.map(i => [i, cdpIlkIds[i]]), api); + collData.forEach(({ collateralLocked }, i) => { + if (collateralLocked > 0) { + positionsWithTriggersAndCollateral++; + } + const idx = ilkIds.indexOf(ilkNames[i]); + api.add(tokens[idx], collateralLocked / 10 ** (18 - decimals[idx])); + }); +}; + +module.exports = { + automationTvl, +}; diff --git a/projects/summer-fi/handlers/dpm-positions.js b/projects/summer-fi/handlers/dpm-positions.js new file mode 100644 index 00000000000..48b06e9370f --- /dev/null +++ b/projects/summer-fi/handlers/dpm-positions.js @@ -0,0 +1,109 @@ +const ADDRESSES = require('../../helper/coreAssets.json') +const BigNumber = require("bignumber.js"); +const { blockQuery } = require("../../helper/http"); +const { endpoints } = require("../constants/endpoints"); + +const NEGATIVE_WAD_PRECISION = -18; +const WETH_ADDRESS = ADDRESSES.ethereum.WETH; + +const aaveQuery = (block) => ` +query { + positions(first: 10000, where: { + and: [ + { collateral_gt: 0 }, + { or: [{ protocol: "AAVE" }, { protocol: "AAVE_V3" }] } + ] + }, block: { number: ${block} }) { + collateral + collateralAddress + } +}`; + +const ajnaQuery = (block) => ` +query { + accounts(first: 10000, where: { + and: [ + { isDPM: true }, + { protocol: "Ajna" }, + ] + }, block: { number: ${block} }) { + collateralToken + borrowPositions { + collateral + } + pool { + address + } + } + pools(block: { number: ${block} }) { + address + depositSize + debt + quoteTokenAddress + } +}`; + +const dpmPositions = async ({ api, }) => { + const aave = await blockQuery(endpoints.aave(), aaveQuery(api.block), { api }); + const ajna = await blockQuery(endpoints.ajna(), ajnaQuery(api.block), { api }); + + const supportedAjnaPools = [ + ...new Set(ajna.accounts.map(({ pool: { address } }) => address)), + ]; + + const aaveBorrowishPositions = aave.positions.map( + ({ collateral, collateralAddress }) => ({ + collateral: new BigNumber(collateral), + collateralAddress, + }) + ); + const ajnaBorrowishPositions = ajna.accounts + .filter(({ borrowPositions }) => borrowPositions.length) + .map(({ borrowPositions: [{ collateral }], collateralToken }) => ({ + collateral: new BigNumber(collateral).shiftedBy(NEGATIVE_WAD_PRECISION), + collateralAddress: collateralToken, + })); + const ajnaEarnPositions = ajna.pools + .filter(({ address }) => supportedAjnaPools.includes(address)) + .map(({ debt, depositSize, quoteTokenAddress }) => ({ + collateral: new BigNumber(depositSize) + .minus(new BigNumber(debt)) + .shiftedBy(NEGATIVE_WAD_PRECISION), + collateralAddress: quoteTokenAddress, + })); + + const tokensWithAmounts = [ + ...aaveBorrowishPositions, + ...ajnaBorrowishPositions, + ...ajnaEarnPositions, + ].reduce( + (total, { collateral, collateralAddress }) => ({ + ...total, + [collateralAddress]: total[collateralAddress] + ? total[collateralAddress].plus(collateral) + : collateral, + }), + {} + ); + + const fallbackDecimal = await api.call({ + abi: "erc20:decimals", + target: WETH_ADDRESS, + }); + const decimals = await api.multiCall({ + abi: "erc20:decimals", + calls: Object.keys(tokensWithAmounts), + }); + + Object.keys(tokensWithAmounts).forEach((collateralAddress, i) => { + api.add( + collateralAddress, + tokensWithAmounts[collateralAddress].toNumber() * + 10 ** (decimals[i] || fallbackDecimal) + ); + }); +}; + +module.exports = { + dpmPositions, +}; diff --git a/projects/summer-fi/handlers/index.js b/projects/summer-fi/handlers/index.js new file mode 100644 index 00000000000..d0ebe456ac3 --- /dev/null +++ b/projects/summer-fi/handlers/index.js @@ -0,0 +1,9 @@ +const { automationTvl } = require("./automation-v1"); +const { dpmPositions } = require("./dpm-positions"); +const { makerTvl } = require("./maker-vaults"); + +module.exports = { + automationTvl, + dpmPositions, + makerTvl, +}; diff --git a/projects/summer-fi/handlers/maker-vaults.js b/projects/summer-fi/handlers/maker-vaults.js new file mode 100644 index 00000000000..9c2e810ded8 --- /dev/null +++ b/projects/summer-fi/handlers/maker-vaults.js @@ -0,0 +1,44 @@ +const { + getCdpData, + getCdpManagerData, + getIlkRegistryData, + getDecimalsData, +} = require("../helpers"); + +const makerTvl = async ({ api, cdpIdList, confirmedSummerFiMakerVaults }) => { + const confirmedSummerFiMakerVaultsArray = [ + ...Object.keys(confirmedSummerFiMakerVaults), + ]; + const confirmedSummerFiMakerVaultsSet = new Set( + confirmedSummerFiMakerVaultsArray + ); + ([...cdpIdList]).forEach((cdpId) => { + confirmedSummerFiMakerVaultsSet.delete(cdpId); + }); + + const filteredVaultsList = [...confirmedSummerFiMakerVaultsSet].filter( + (i) => { + const [startBlock] = confirmedSummerFiMakerVaults[i]; + return api.block > startBlock; + } + ); + const cdpIds = [...new Set(filteredVaultsList)] + const ilkNames = await getCdpManagerData(cdpIds, api); + const cdpIlkIds = {} + ilkNames.forEach((val, idx) => cdpIlkIds[cdpIds[idx]] = val) + const ilkIds = [...new Set(ilkNames)]; + const tokens = (await getIlkRegistryData(ilkIds, api)).map((i) => i[4]); + const decimals = await getDecimalsData(tokens, api); + const collData = await getCdpData(filteredVaultsList.map(i => [i, cdpIlkIds[i]]), api); + collData.forEach(({ collateralLocked }, i) => { + const idx = ilkIds.indexOf(ilkNames[i]); + if (idx === -1) { + return; + } + api.add(tokens[idx], collateralLocked / 10 ** (18 - decimals[idx])); + }); +}; + +module.exports = { + makerTvl, +}; diff --git a/projects/summer-fi/helpers/calls.js b/projects/summer-fi/helpers/calls.js new file mode 100644 index 00000000000..cf2c8223d93 --- /dev/null +++ b/projects/summer-fi/helpers/calls.js @@ -0,0 +1,94 @@ +const { sliceIntoChunks } = require("@defillama/sdk/build/util/index.js"); +const abi = require("../constants/abi.js"); +const contracts = require("../constants/contracts.js"); +const sdk = require("@defillama/sdk"); + +const getCdpData = async (cdpIds, api) => { + const res = []; + const chunks = sliceIntoChunks(cdpIds, 100); + for (const chunk of chunks) + res.push( + ...(await api.multiCall({ + abi: abi.getVaultInfo, + target: contracts.McdMonitorV2, + calls: chunk.map(i => ({ params: i})), + })) + ); + + return res; +}; + +const getCdpManagerData = async (cdpIds, api) => { + return cachedCalls({ + items: cdpIds, + multiCall: async (calls) => + api.multiCall({ + abi: abi.ilks, + target: contracts.CdpManager, + calls, + }), + key: "getCdpManagerData", + }); +}; + +const getIlkRegistryData = async (ilks, api) => { + return cachedCalls({ + items: ilks, + multiCall: async (calls) => + api.multiCall({ + abi: abi.info, + target: contracts.IlkRegistry, + calls, + }), + key: "getIlkRegistryData", + }); +}; + +const getDecimalsData = async (tokens, api) => { + return cachedCalls({ + items: tokens, + multiCall: async (calls) => + api.multiCall({ + abi: "erc20:decimals", + calls, + }), + key: "getDecimalsData", + }); +}; + +let cache = {}; +function setCallCache(_cache) { + cache = _cache; +} + +async function cachedCalls({ items, multiCall, key }) { + if (!cache[key]) cache[key] = {}; + const res = []; + const missingIds = []; + const missingIndices = []; + items.forEach((id, i) => { + if (cache[key][id]) res[i] = cache[key][id]; + else { + missingIds.push(id); + missingIndices.push(i); + } + }); + + if (missingIds.length) { + sdk.log("Missing ids", missingIds.length, "key", key); + const tempRes = await multiCall(missingIds); + missingIds.forEach((id, i) => { + res[missingIndices[i]] = tempRes[i]; + cache[key][id] = tempRes[i]; + }); + } + return res; +} + +module.exports = { + getCdpData, + getCdpManagerData, + getIlkRegistryData, + getDecimalsData, + setCallCache, +}; diff --git a/projects/summer-fi/helpers/get-automation-cdp-ids.js b/projects/summer-fi/helpers/get-automation-cdp-ids.js new file mode 100644 index 00000000000..6df1731a7fb --- /dev/null +++ b/projects/summer-fi/helpers/get-automation-cdp-ids.js @@ -0,0 +1,52 @@ +const { getLogs } = require("../../helper/cache/getLogs"); + +const { abi, contracts, logsTopic, creationBlocks } = require("../constants"); + +const getAutomationCdpIdList = async ({ api }) => { + const cdpIdList = new Set(); + const [triggerAddedEvents, triggerRemovedEvents, triggerExecutedEvents] = + await Promise.all( + Object.keys(logsTopic).map((key) => + getLogs({ + api, + fromBlock: creationBlocks.AutomationV1Contract, + target: contracts.AutomationV1Contract, + topics: [logsTopic[key]], + eventAbi: abi[key], + extraKey: key, + onlyArgs: true, + }) + ) + ); + const triggerEvents = [ + ...triggerAddedEvents.map((event) => ({ + cdp: event.cdpId.toString(), + trigger: event.triggerId.toString(), + action: "triggerAdded", + })), + ...triggerRemovedEvents.map((event) => ({ + cdp: event.cdpId.toString(), + trigger: event.triggerId.toString(), + action: "triggerRemoved", + })), + ...triggerExecutedEvents.map((event) => ({ + cdp: event.cdpId.toString(), + trigger: event.triggerId.toString(), + action: "triggerExecuted", + })), + ].sort((a, b) => a.trigger - b.trigger); + + triggerEvents.forEach((event) => { + const { cdp, action } = event; + if (action === "triggerAdded") { + cdpIdList.add(cdp); + } else if (action === "triggerRemoved" || action === "triggerExecuted") { + cdpIdList.delete(cdp); + } + }); + return cdpIdList; +}; + +module.exports = { + getAutomationCdpIdList, +}; diff --git a/projects/summer-fi/helpers/index.js b/projects/summer-fi/helpers/index.js new file mode 100644 index 00000000000..ccad34a095d --- /dev/null +++ b/projects/summer-fi/helpers/index.js @@ -0,0 +1,17 @@ +const { getAutomationCdpIdList } = require("./get-automation-cdp-ids"); +const { + getCdpData, + getCdpManagerData, + getIlkRegistryData, + getDecimalsData, + setCallCache, +} = require("./calls"); + +module.exports = { + setCallCache, + getAutomationCdpIdList, + getCdpData, + getCdpManagerData, + getIlkRegistryData, + getDecimalsData, +}; diff --git a/projects/summer-fi/index.js b/projects/summer-fi/index.js new file mode 100644 index 00000000000..a3ca89f388d --- /dev/null +++ b/projects/summer-fi/index.js @@ -0,0 +1,33 @@ +const { automationTvl, dpmPositions, makerTvl } = require("./handlers"); +const { getAutomationCdpIdList, setCallCache } = require("./helpers"); +const sdk = require("@defillama/sdk"); +const { getConfig, getCache, setCache } = require("../helper/cache"); +const { endpoints } = require("./constants/endpoints"); + +module.exports = { + doublecounted: true, + ethereum: { tvl }, +}; + +async function tvl(_, _1, _2, { api }) { + await api.getBlock(); + const executionStart = Date.now() / 1000; + const [confirmedSummerFiMakerVaults, cdpIdList, cache] = await Promise.all([ + await getConfig("summer-fi/maker-vaults", endpoints.makerVaults()), + getAutomationCdpIdList({ api }), + getCache("summer-fi/cache", api.chain), + ]); + + setCallCache(cache); + + sdk.log([...cdpIdList].length, "cdpIdList"); + + await Promise.all([ + dpmPositions({ api }), + automationTvl({ api, cdpIdList }), + makerTvl({ api, cdpIdList, confirmedSummerFiMakerVaults }), + ]); + + await setCache("summer-fi/cache", api.chain, cache); + sdk.log("Execution time", Date.now() / 1000 - executionStart, "seconds"); +} diff --git a/projects/summitdefi/abi.json b/projects/summitdefi/abi.json index 0944c877c3d..8c164f4dfb0 100644 --- a/projects/summitdefi/abi.json +++ b/projects/summitdefi/abi.json @@ -1,102 +1,8 @@ { - "getPools": { - "inputs": [], - "name": "getPools", - "outputs": [ - { - "internalType": "address[]", - "name": "", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - "tokensWithAllocation": { - "inputs": [], - "name": "tokensWithAllocation", - "outputs": [ - { - "internalType": "address[]", - "name": "", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - "supply": { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - } - ], - "name": "supply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getVault": { - "inputs": [], - "name": "getVault", - "outputs": [ - { - "internalType": "contract IVault", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getPoolId": { - "inputs": [], - "name": "getPoolId", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getPoolTokens": { - "inputs": [ - { - "internalType": "bytes32", - "name": "poolId", - "type": "bytes32" - } - ], - "name": "getPoolTokens", - "outputs": [ - { - "internalType": "contract IERC20[]", - "name": "tokens", - "type": "address[]" - }, - { - "internalType": "uint256[]", - "name": "balances", - "type": "uint256[]" - }, - { - "internalType": "uint256", - "name": "lastChangeBlock", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } + "getPools": "address[]:getPools", + "tokensWithAllocation": "address[]:tokensWithAllocation", + "supply": "function supply(address _token) view returns (uint256)", + "getVault": "address:getVault", + "getPoolId": "function getPoolId() view returns (bytes32)", + "getPoolTokens": "function getPoolTokens(bytes32 poolId) view returns (address[] tokens, uint256[] balances, uint256 lastChangeBlock)" } \ No newline at end of file diff --git a/projects/summitdefi/index.js b/projects/summitdefi/index.js index cbf1851cc00..2d3b40002ba 100644 --- a/projects/summitdefi/index.js +++ b/projects/summitdefi/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); const abi = require("./abi.json"); @@ -152,7 +153,7 @@ async function staking(timestamp, block, chainBlocks) { block, chain })).output; - sdk.util.sumSingleBalance(balances, "fantom:0x8d11ec38a3eb5e956b052f67da8bdc9bef8abf3e", BigNumber(summitInEverest).times(summitValueInUSDC).toFixed(0)); + sdk.util.sumSingleBalance(balances, "fantom:" + ADDRESSES.fantom.DAI, BigNumber(summitInEverest).times(summitValueInUSDC).toFixed(0)); return balances; } diff --git a/projects/sumswap/index.js b/projects/sumswap/index.js index 6f934dffb7e..7b83e60042e 100644 --- a/projects/sumswap/index.js +++ b/projects/sumswap/index.js @@ -1,8 +1,7 @@ const { getUniTVL } = require('../helper/unknownTokens') module.exports = { - misrepresentedTokens: true, ethereum: { - tvl: getUniTVL({ chain: 'ethereum', factory: '0x96FF042f8c6757fCE515d171F194b5816CAFEe11', useDefaultCoreAssets: true, }), + tvl: getUniTVL({ useDefaultCoreAssets: true, factory: '0x96FF042f8c6757fCE515d171F194b5816CAFEe11', }), }, }; diff --git a/projects/sun/index.js b/projects/sun/index.js index 188fb58bcf0..916ed60c3b9 100644 --- a/projects/sun/index.js +++ b/projects/sun/index.js @@ -1,91 +1,100 @@ -const sdk = require('@defillama/sdk') -const { getTokenBalance, getTrxBalance, unverifiedCall } = require('../helper/chain/tron'); +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require('../helper/unwrapLPs') const pools = [ { pool: 'TKcEU8ekq2ZoFzLSGFYCUY6aocJBX9X31b', stablecoins: [ - ["TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t", "tether"], // USDT - ["TMwFHYXLJaRUPeW6421aqXL4ZEzPRFGkGT", "just-stablecoin"], // USDJ - ["TUpMhErZL2fhh4sVNULAbNKLokS4GjC1F4", "true-usd"] // TUSD + ADDRESSES.tron.USDT, // USDT + ADDRESSES.tron.USDJ, + ADDRESSES.tron.TUSD, ] }, { pool: 'TKVsYedAY23WFchBniU7kcx1ybJnmRSbGt', stablecoins: [ // USDD 3pool - ["TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t", "tether"], // USDT - ["TPYmHEhy5n8TCEfYGqW2rPxsghSfzghPDn", "usdd"], // USDD - ["TUpMhErZL2fhh4sVNULAbNKLokS4GjC1F4", "true-usd"] // TUSD + ADDRESSES.tron.USDT, // USDT + ADDRESSES.tron.USDD, // USDD + ADDRESSES.tron.TUSD, ] }, { pool: 'TAUGwRhmCP518Bm4VBqv7hDun9fg8kYjC4', stablecoins: [ // USDD 2pool - ["TPYmHEhy5n8TCEfYGqW2rPxsghSfzghPDn", "usdd"], // USDD - ["TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t", "tether"], // USDT + ADDRESSES.tron.USDD, // USDD + ADDRESSES.tron.USDT, // USDT ] }, { pool: 'TQx6CdLHqjwVmJ45ecRzodKfVumAsdoRXH', stablecoins: [ - ["TEkxiTehnzSmSe2XqrBj4w32RUN966rdz8", "usd-coin"], // USDC + ADDRESSES.tron.USDC, // // USDC ] }, { pool: 'TB6zgiG14iQkNxqU4mYe7cMiS5aCYfyidL', stablecoins: [ - ["TEkxiTehnzSmSe2XqrBj4w32RUN966rdz8", "usd-coin"], // USDC + ADDRESSES.tron.USDC, // // USDC ] }, { - pool: 'TNTfaTpkdd4AQDeqr8SGG7tgdkdjdhbP5c', stablecoins: [ // new USDD 2pool - ["TPYmHEhy5n8TCEfYGqW2rPxsghSfzghPDn", "usdd"], // USDD - ["TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t", "tether"], // USDT + pool: 'TNTfaTpkdd4AQDeqr8SGG7tgdkdjdhbP5c', stablecoins: [ // USDD 2pool + ADDRESSES.tron.USDD, // USDD + ADDRESSES.tron.USDT, // USDT + ] + }, + { + pool: 'TExeaZuD5YPi747PN5yEwk3Ro9eT2jJfB6', stablecoins: [ // USDC 2pool + ADDRESSES.tron.USDC, // // USDC + ADDRESSES.tron.USDT, // USDT + ] + }, + { + pool: 'TS8d3ZrSxiGZkqhJqMzFKHEC1pjaowFMBJ', stablecoins: [ // new TUSD 2pool + ADDRESSES.tron.TUSD, + ADDRESSES.tron.USDT, // USDT + ] + }, + { + pool: 'TE7SB1v9vRbYRe5aJMWQWp9yfE2k9hnn3s', stablecoins: [ // new USDD/2USD + ADDRESSES.tron.USDC, // // USDC + ] + }, + { + pool: 'TKBqNLyGJRQbpuMhaT49qG7adcxxmFaVxd', stablecoins: [ // new USDJ/2USD + ADDRESSES.tron.USDJ, + ] + }, + { + pool: 'TLssvTsY4YZeDPwemQvUzLdoqhFCbVxDGo', stablecoins: [ // new USDC/2USD + ADDRESSES.tron.USDD, // USDD ] } ] - async function tvl() { - const balances = {} - for( let poolConfig of pools) { - const { - pool, - stablecoins - } = poolConfig - for ( let [token, label] of stablecoins) { - const tokenBalace= await getTokenBalance(token, pool) - sdk.util.sumSingleBalance(balances, label, tokenBalace) - } - } - - return balances - } +const ownerTokens = pools.map(({ pool, stablecoins }) => { + return [stablecoins, pool] +}) const stakingContract = "TXbA1feyCqWAfAQgXvN1ChTg82HpBT8QPb" -const sun = "TSSMHYeV2uE9qYH95DqyoCuNCzEL1NvU3S" -async function staking() { - return { - "sun-token": await getTokenBalance(sun, stakingContract) - } -} +const sun = ADDRESSES.tron.SUN const lpToken = 'TDQaYrhQynYV9aXTYj63nwLAafRffWSEj6' const oldLpStaking = "TGsymdggp98tLKZWGHcGX58TjTcaQr9s4x" const lpStaking = "TAkrcKsS5FW9f3ZfzvWy6Zvsz9uEjUxPoV" -async function pool2() { +/* async function pool2() { + const { api } = arguments[3] const [lpTokenAmount, sunInLp, trxInLp, totalSupply] = await Promise.all([ getTokenBalance(lpToken, lpStaking), getTokenBalance(sun, lpToken), getTrxBalance(lpToken), - unverifiedCall(lpToken, 'totalSupply()', []) + call({ target: lpToken, abi: 'totalSupply()', resTypes: ['number'] }), ]) - return { - "sun-token": sunInLp * lpTokenAmount / (totalSupply / 10 ** 6), - "tron": trxInLp * lpTokenAmount / totalSupply, - } + api.add(sun, sunInLp * lpTokenAmount / totalSupply) + api.add(nullAddress, trxInLp * lpTokenAmount / totalSupply) } - + */ module.exports = { tron: { - tvl, - staking, - pool2 + tvl: sumTokensExport({ ownerTokens }), + staking: sumTokensExport({ owner: stakingContract, tokens: [sun] }), + // pool2 }, } diff --git a/projects/sunSwap/index.js b/projects/sunSwap/index.js deleted file mode 100644 index 95382e3cec2..00000000000 --- a/projects/sunSwap/index.js +++ /dev/null @@ -1,25 +0,0 @@ -const axios = require('axios') - -let nowDate = new Date(); -nowDate.setFullYear(nowDate.getFullYear() - 1); -let T = parseInt(nowDate.getTime() / 1000); - -const url = "https://apilist.tronscan.org/api/defiTvl?type=tvlline&project=&startTime=" + T; - -function getItemByName (projectName, listArr) { - for (let i = 0; i < listArr.length; i++) { - if (listArr[i].project === projectName) { - return listArr[i]; - } - } -} - -async function fetch(){ - const pools = await axios.get(url); - let item = getItemByName('SUN.io', pools.data.projects); - return parseInt(item.locked); -} - -module.exports = { - fetch -} \ No newline at end of file diff --git a/projects/sunflowerswap/index.js b/projects/sunflowerswap/index.js index 76330f92bcb..b77e81f05e0 100644 --- a/projects/sunflowerswap/index.js +++ b/projects/sunflowerswap/index.js @@ -1,21 +1,3 @@ +const { uniTvlExport } = require('../helper/unknownTokens') - -const { getChainTransform } = require('../helper/portedTokens') -const { addFundsInMasterChef } = require('../helper/masterchef') - -const MASTER_CONTRACT = '0x1b9df08EF60800D2B7b8a909589246e18E809797' - -async function tvl(timestamp, ethBlock, chainBlocks) { - const balances = {}; - const chain = 'moonbeam' - const transformAddress = await getChainTransform(chain); - await addFundsInMasterChef(balances, MASTER_CONTRACT, chainBlocks[chain], chain, transformAddress); - return balances; -}; - -module.exports = { - misrepresentedTokens: true, - timetravel: true, - incentivized: true, - moonbeam: { tvl, }, -} +module.exports = uniTvlExport('moonbeam', '0xf6c49609e8d637c3d07133e28d369283b5e80c70') diff --git a/projects/sunswap-v2/api.js b/projects/sunswap-v2/api.js new file mode 100644 index 00000000000..4d82220cd47 --- /dev/null +++ b/projects/sunswap-v2/api.js @@ -0,0 +1,7 @@ +const {getExports} = require('../helper/heroku-api') +const chains = ['tron'] + +module.exports = { + timetravel: false, + ...getExports("sunswap-v2", chains) +} diff --git a/projects/sunswap-v2/index.js b/projects/sunswap-v2/index.js new file mode 100644 index 00000000000..055990fcfc9 --- /dev/null +++ b/projects/sunswap-v2/index.js @@ -0,0 +1,11 @@ +const { getUniTVL } = require('../helper/unknownTokens.js') + +process.env.TRON_RPC="https://rpc.ankr.com/http/tron/wallet/triggerconstantcontract" + +module.exports = { + timetravel: false, + misrepresentedTokens: true, + tron: { + tvl: getUniTVL({ factory: 'TKWJdrQkqHisa1X8HUdHEfREvTzw4pMAaY', useDefaultCoreAssets: true, queryBatched: 11 }), + } +} diff --git a/projects/superbots/index.js b/projects/superbots/index.js index b070cb5ed8d..a5dcb72c1ad 100644 --- a/projects/superbots/index.js +++ b/projects/superbots/index.js @@ -1,12 +1,13 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens2 } = require('../helper/unwrapLPs') const { pool2 } = require('../helper/pool2') const { staking } = require('../helper/staking') const vault_tokens = [ - '0xe9e7cea3dedca5984780bafc599bd69add087d56', // BUSD - '0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c', // WBNB - '0x7130d2a12b9bcbfae4f2634d864a1ee1ce3ead9c', // BTCB - '0x2170ed0880ac9a755fd29b2688956bd959f933f8', // WETH + ADDRESSES.bsc.BUSD, // BUSD + ADDRESSES.bsc.WBNB, // WBNB + ADDRESSES.bsc.BTCB, // BTCB + ADDRESSES.bsc.ETH, // WETH ] const vaults = [ '0x4558684869b1f814b4d8b177dcb0a2e10f4e007d', diff --git a/projects/superlauncher/index.js b/projects/superlauncher/index.js new file mode 100644 index 00000000000..5579c6d7b20 --- /dev/null +++ b/projects/superlauncher/index.js @@ -0,0 +1,13 @@ +const { stakings } = require("../helper/staking"); + +const LAUNCH = "0xF6D9a093A1C69a152d87e269A7d909E9D76B1815"; +const STAKING_CONTRACT = "0xA05385Ec1F4fFe5a43336f3864Ae66f536D95602"; + +module.exports = { + misrepresentedTokens: true, + era: { + tvl: () => ({}), + staking: stakings([STAKING_CONTRACT], [LAUNCH], 'era','superlauncher-dao',18) + }, + methodology: "TVL is calculated by summing the total LAUNCH held in the staking contract.", +}; \ No newline at end of file diff --git a/projects/surfswap-stableswap/index.js b/projects/surfswap-stableswap/index.js new file mode 100644 index 00000000000..4c7c18bca58 --- /dev/null +++ b/projects/surfswap-stableswap/index.js @@ -0,0 +1,24 @@ +const { sumTokens2 } = require('../helper/unwrapLPs') + +const abi = { + getTokens: "address[]:getTokens", +} + +async function tvl(_, _b, _2, { api }) { + const pools = [ + '0x62bf12869E145A862218eE7e28F942Cc7FaeC460', // base 4 pool + ] + + const tokens = await api.multiCall({ + abi: abi.getTokens, calls: pools, + }) + + const ownerTokens = tokens.map((v, i) => [v, pools[i]]) + return sumTokens2({ api, ownerTokens, }) +} + +module.exports = { + kava: { + tvl, + } +} diff --git a/projects/surfswap/index.js b/projects/surfswap/index.js index f96264b9ad0..25139599720 100644 --- a/projects/surfswap/index.js +++ b/projects/surfswap/index.js @@ -1,76 +1,16 @@ const { getUniTVL } = require('../helper/unknownTokens') -const sdk = require('@defillama/sdk') -const { sumTokens2 } = require('../helper/unwrapLPs') -const chain = 'kava' const dexTVL = getUniTVL({ factory: "0xc449665520C5a40C9E88c7BaDa149f02241B1f9F", - chain: "kava", useDefaultCoreAssets: true, }) -async function stablePoolTVL(_, _b, { [chain]: block }) { - const pools = [ - '0x62bf12869E145A862218eE7e28F942Cc7FaeC460', // base 4 pool - ] - - let { output: lpTokens } = await sdk.api.abi.multiCall({ - abi: abi.getLpToken, - calls: pools.map(i => ({ target: i })), - chain, block, - }) - - lpTokens = lpTokens.map(i => i.output.toLowerCase()) - - const { output: tokens } = await sdk.api.abi.multiCall({ - abi: abi.getTokens, - calls: pools.map(i => ({ target: i })), - chain, block, - }) - - const toa = [] - tokens.forEach(res => { - res.output.forEach(t => { - if (lpTokens.includes(t.toLowerCase())) return; - toa.push([t, res.input.target]) - }) - }) - - return sumTokens2({ tokensAndOwners: toa, chain, block, }) -} - module.exports = { + hallmarks: [ + [1660521600, "incentives not given"] + ], misrepresentedTokens: true, kava: { - tvl: sdk.util.sumChainTvls([dexTVL, stablePoolTVL]) + tvl:dexTVL, } } - -const abi = { - getTokens: { - "inputs": [], - "name": "getTokens", - "outputs": [ - { - "internalType": "contract IERC20[]", - "name": "", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - getLpToken: { - "inputs": [], - "name": "getLpToken", - "outputs": [ - { - "internalType": "contract LPToken", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, -} diff --git a/projects/surge/index.js b/projects/surge/index.js new file mode 100644 index 00000000000..92df270fbbb --- /dev/null +++ b/projects/surge/index.js @@ -0,0 +1,31 @@ +const { getLogs } = require('../helper/cache/getLogs') +const { sumTokens2 } = require('../helper/unwrapLPs') + +const config = { + arbitrum: { factory: '0x503A14768e23456620fB3Cb61e37A36A2736Cbd0', fromBlock: 107875529, } +} + +Object.keys(config).forEach(chain => { + const { factory, fromBlock, } = config[chain] + const _getLogs = (api) => getLogs({ + api, + target: factory, + topics: ['0xfd4f84c703fbc9ed47d26b2769a6133a02ea690b88125c716c7321699d0115fa'], + eventAbi: 'event PoolDeployed(uint256 poolId, address pool, address indexed collateralToken, address indexed loanToken, uint256 indexed maxCollateralRatioMantissa, uint256 surgeMantissa, uint256 collateralRatioFallDuration, uint256 collateralRatioRecoveryDuration, uint256 minRateMantissa, uint256 surgeRateMantissa, uint256 maxRateMantissa)', + onlyArgs: true, + fromBlock, + }) + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const logs = await _getLogs(api) + const ownerTokens = logs.map(l => [[l.collateralToken, l.loanToken], l.pool]) + return sumTokens2({ api, ownerTokens, }) + }, + borrowed: async (_, _b, _cb, { api, }) => { + const logs = await _getLogs(api) + const borrowed = await api.multiCall({ abi: 'uint256:lastTotalDebt', calls: logs.map(i => i.pool) }) + api.addTokens(logs.map(i => i.loanToken), borrowed) + return api.getBalances() + }, + } +}) \ No newline at end of file diff --git a/projects/sushiswap-bentobox/bentobox.js b/projects/sushiswap-bentobox/bentobox.js index 90ba7fd6b56..86a1e23b197 100644 --- a/projects/sushiswap-bentobox/bentobox.js +++ b/projects/sushiswap-bentobox/bentobox.js @@ -1,7 +1,7 @@ const sdk = require("@defillama/sdk"); const { default: BigNumber } = require("bignumber.js"); const { getChainTransform } = require("../helper/portedTokens"); -const { getBlock } = require("../helper/getBlock"); +const { getBlock } = require("../helper/http"); const { getFuroTokens, getKashiTokens, @@ -14,7 +14,7 @@ function bentobox(chain) { const balances = {}; const transform = await getChainTransform(chain); let block = await getBlock(timestamp, chain, chainBlocks) - block = block - 100; + block = block - 1000; const bentoTokens = await getBentoboxTokensArray(chain, block); //array with shares and amount const tridentTokens = await getTridentTokens(chain, block); //mapping with amount diff --git a/projects/sushiswap-bentobox/helper.js b/projects/sushiswap-bentobox/helper.js index e865cfa1048..657dc5dc625 100644 --- a/projects/sushiswap-bentobox/helper.js +++ b/projects/sushiswap-bentobox/helper.js @@ -19,17 +19,8 @@ const bentoboxes = { //kava: "0xc35DADB65012eC5796536bD9864eD8773aBc74C4", }; -const toAmountAbi = { - inputs: [ - { internalType: "contract IERC20", name: "token", type: "address" }, - { internalType: "uint256", name: "share", type: "uint256" }, - { internalType: "bool", name: "roundUp", type: "bool" }, - ], - name: "toAmount", - outputs: [{ internalType: "uint256", name: "amount", type: "uint256" }], - stateMutability: "view", - type: "function", -}; +const toAmountAbi = + "function toAmount(address token, uint256 share, bool roundUp) view returns (uint256 amount)"; const bentoSubgraphs = { ethereum: @@ -91,7 +82,7 @@ const furoSubgraphs = { const furoQuery = gql` query get_tokens($block: Int, $id: ID!) { tokens( - block: { number: $block }, + block: { number: $block } orderBy: liquidityShares orderDirection: desc first: 1000 @@ -132,16 +123,22 @@ const kashiQuery = gql` `; const tridentSubgraphs = { - polygon: "https://api.thegraph.com/subgraphs/name/sushi-qa/trident-polygon", - optimism: "https://api.thegraph.com/subgraphs/name/sushi-qa/trident-optimism", - //kava: "https://pvt.graph.kava.io/subgraphs/name/sushi-qa/trident-kava", - //metis: "https://andromeda.thegraph.metis.io/subgraphs/name/sushi-qa/trident-metis", + polygon: "https://api.thegraph.com/subgraphs/name/sushi-v2/trident-polygon", + optimism: "https://api.thegraph.com/subgraphs/name/sushi-v2/trident-optimism", + kava: "https://pvt.graph.kava.io/subgraphs/name/sushi-v2/trident-kava", + metis: + "https://andromeda.thegraph.metis.io/subgraphs/name/sushi-v2/trident-metis", + bittorrent: + "https://subgraphs.sushi.com/subgraphs/name/sushi-v2/trident-bttc", + arbitrum: "https://api.thegraph.com/subgraphs/name/sushi-v2/trident-arbitrum", + bsc: "https://api.thegraph.com/subgraphs/name/sushi-v2/trident-bsc", + avax: "https://api.thegraph.com/subgraphs/name/sushi-v2/trident-avalanche", }; const tridentQuery = gql` query get_tokens($block: Int, $id: ID!) { tokens( - block: { number: $block }, + block: { number: $block } first: 1000 orderBy: liquidityUSD orderDirection: desc @@ -162,7 +159,7 @@ async function getFuroTokens(chain, block) { return balances; } - const tokens = await fetchAllTokens(subgraph, furoQuery, block, 'furo') + const tokens = await fetchAllTokens(subgraph, furoQuery, block, "furo"); const calls = tokens.map((token) => { return { @@ -173,17 +170,24 @@ async function getFuroTokens(chain, block) { target: bentoboxes[chain], abi: toAmountAbi, calls, - chain, block, + chain, + block, }); output.forEach( ({ + success, output: amount, input: { params: [tokenId], }, }) => { - sdk.util.sumSingleBalance(balances, tokenId, BigNumber(amount).toFixed(0)) + if (success) + sdk.util.sumSingleBalance( + balances, + tokenId, + BigNumber(amount).toFixed(0) + ); } ); @@ -198,15 +202,23 @@ async function getKashiTokens(chain, block) { return balances; } - const kashiPairs = await fetchAllTokens(subgraph, kashiQuery, block, 'kashi'); - const shareBalances = {} + const kashiPairs = await fetchAllTokens(subgraph, kashiQuery, block, "kashi"); + const shareBalances = {}; kashiPairs.map((pair) => { if (pair.totalAsset.elastic > 0) { - sdk.util.sumSingleBalance(shareBalances, pair.asset.id, BigNumber(pair.totalAsset.elastic).toFixed(0)) + sdk.util.sumSingleBalance( + shareBalances, + pair.asset.id, + BigNumber(pair.totalAsset.elastic).toFixed(0) + ); } if (pair.totalCollateralShare > 0) { - sdk.util.sumSingleBalance(shareBalances, pair.collateral.id, BigNumber(pair.totalCollateralShare).toFixed(0)) + sdk.util.sumSingleBalance( + shareBalances, + pair.collateral.id, + BigNumber(pair.totalCollateralShare).toFixed(0) + ); } }); @@ -219,17 +231,19 @@ async function getKashiTokens(chain, block) { target: bentoboxes[chain], abi: toAmountAbi, calls, - chain, block, + chain, + block, }); output.forEach( ({ + success, output: amount, input: { params: [tokenId], }, }) => { - sdk.util.sumSingleBalance(balances, tokenId, BigNumber(amount).toFixed(0)) + if (success) sdk.util.sumSingleBalance(balances, tokenId, amount); } ); @@ -244,9 +258,13 @@ async function getTridentTokens(chain, block) { return balances; } - const tokens = await fetchAllTokens(subgraph, tridentQuery, block, 'trident'); + const tokens = await fetchAllTokens(subgraph, tridentQuery, block, "trident"); tokens.map((token) => { - sdk.util.sumSingleBalance(balances, token.id, BigNumber(token.liquidity).toFixed(0)) + sdk.util.sumSingleBalance( + balances, + token.id, + BigNumber(token.liquidity).toFixed(0) + ); }); return balances; @@ -258,7 +276,7 @@ async function getBentoboxTokensArray(chain, block) { if (!subgraph) { return []; } - return fetchAllTokens(subgraph, bentoQuery, block, 'bento') + return fetchAllTokens(subgraph, bentoQuery, block, "bento"); } async function fetchAllTokens(subgraph, query, block, type) { @@ -266,14 +284,14 @@ async function fetchAllTokens(subgraph, query, block, type) { //query all tokens even if > 1000 as we can't order efficiently by $ liquidity let id = 0; - while (true) { + while (true) { // eslint-disable-line let result = await request(subgraph, query, { - id, block, + id, + block, }); - let tokens = result.tokens - if (type === 'kashi') - tokens = result.kashiPairs + let tokens = result.tokens; + if (type === "kashi") tokens = result.kashiPairs; allTokens.push(...tokens); if (tokens.length < 1000) { @@ -283,7 +301,6 @@ async function fetchAllTokens(subgraph, query, block, type) { } return allTokens; - } module.exports = { diff --git a/projects/sushiswap-furo/furo.js b/projects/sushiswap-furo/furo.js index 8b77caaa5e3..cfecc8d7bd2 100644 --- a/projects/sushiswap-furo/furo.js +++ b/projects/sushiswap-furo/furo.js @@ -54,17 +54,7 @@ const furoQuery = gql` } `; -const toAmountAbi = { - inputs: [ - { internalType: "contract IERC20", name: "token", type: "address" }, - { internalType: "uint256", name: "share", type: "uint256" }, - { internalType: "bool", name: "roundUp", type: "bool" }, - ], - name: "toAmount", - outputs: [{ internalType: "uint256", name: "amount", type: "uint256" }], - stateMutability: "view", - type: "function", -}; +const toAmountAbi = 'function toAmount(address token, uint256 share, bool roundUp) view returns (uint256 amount)' function furo(chain, isVesting) { return async (timestamp, ethBlock, { [chain]: block}) => { diff --git a/projects/sushiswap-kashi/kashi-lending.js b/projects/sushiswap-kashi/kashi-lending.js index e3472321f70..171a303f19b 100644 --- a/projects/sushiswap-kashi/kashi-lending.js +++ b/projects/sushiswap-kashi/kashi-lending.js @@ -1,7 +1,5 @@ -const sdk = require("@defillama/sdk"); -const { request, gql } = require("graphql-request"); -const { getBlock } = require("../helper/getBlock"); -const { getChainTransform } = require("../helper/portedTokens"); +const ADDRESSES = require('../helper/coreAssets.json') +const { blockQuery } = require("../helper/http"); const { BigNumber } = require("ethers"); const graphUrls = { @@ -20,19 +18,9 @@ const bentoboxes = { avax: "0x0711b6026068f736bae6b213031fce978d48e026", }; -const toAmountAbi = { - inputs: [ - { internalType: "contract IERC20", name: "token", type: "address" }, - { internalType: "uint256", name: "share", type: "uint256" }, - { internalType: "bool", name: "roundUp", type: "bool" }, - ], - name: "toAmount", - outputs: [{ internalType: "uint256", name: "amount", type: "uint256" }], - stateMutability: "view", - type: "function", -}; +const toAmountAbi ='function toAmount(address token, uint256 share, bool roundUp) view returns (uint256 amount)' -const kashiQuery = gql` +const kashiQuery = ` query get_pairs($block: Int) { kashiPairs(block: { number: $block }, first: 1000) { id @@ -54,23 +42,19 @@ const kashiQuery = gql` `; function kashiLending(chain, borrowed) { - return async (timestamp, ethBlock, chainBlocks) => { - const balances = {}; + return async (timestamp, ethBlock, chainBlocks, {api}) => { const graphUrl = graphUrls[chain]; - let block = await getBlock(timestamp, chain, chainBlocks) - block = block - 100; //subgraphs can be late by few seconds/minutes - const transform = await getChainTransform(chain); // Query graphql endpoint - const { kashiPairs } = await request(graphUrl, kashiQuery, { - block: block, + const { kashiPairs } = await blockQuery(graphUrl, kashiQuery, { + api }); const calls = [] kashiPairs.map(async (pair) => { if ( - pair.asset.id === "0x0000000000000000000000000000000000000000" || - pair.collateral.id === "0x0000000000000000000000000000000000000000" + pair.asset.id === ADDRESSES.null || + pair.collateral.id === ADDRESSES.null ) { return; } @@ -97,15 +81,13 @@ function kashiLending(chain, borrowed) { } }) - const { output } = await sdk.api.abi.multiCall({ - calls, chain, block, abi: toAmountAbi, target: bentoboxes[chain], + const output = await api.multiCall({ + calls,abi: toAmountAbi, target: bentoboxes[chain], }) - output.forEach(({ input: { params: [token]}, output: balance}) => { - sdk.util.sumSingleBalance(balances, transform(token), balance) + output.forEach((balance, idx) => { + api.add(calls[idx].params[0], balance) }) - - return balances; }; } diff --git a/projects/sushiswap-trident/index.js b/projects/sushiswap-trident/index.js index b6ca73bdd40..226b5e27053 100644 --- a/projects/sushiswap-trident/index.js +++ b/projects/sushiswap-trident/index.js @@ -1,7 +1,16 @@ const { trident } = require("./trident.js"); const modulesToExport = {}; -const trident_chains = ["polygon", "optimism", "kava", "metis"]; +const trident_chains = [ + "polygon", + "optimism", + // "kava", + "metis", + "bittorrent", + "arbitrum", + "bsc", + "avax", +]; trident_chains.forEach((chain) => { modulesToExport[chain] = { @@ -13,3 +22,5 @@ module.exports = { misrepresentedTokens: false, ...modulesToExport, }; + +module.exports.kava = { tvl: () => 0} \ No newline at end of file diff --git a/projects/sushiswap-trident/trident.js b/projects/sushiswap-trident/trident.js index 3433ca92e0d..268baae7e79 100644 --- a/projects/sushiswap-trident/trident.js +++ b/projects/sushiswap-trident/trident.js @@ -1,16 +1,21 @@ -const sdk = require("@defillama/sdk"); -const { request, gql } = require("graphql-request"); -const { getChainTransform } = require("../helper/portedTokens"); +const { blockQuery } = require('../helper/http') const graphUrls = { - polygon: "https://api.thegraph.com/subgraphs/name/sushi-qa/trident-polygon", - optimism: "https://api.thegraph.com/subgraphs/name/sushi-qa/trident-optimism", - kava: "https://pvt.graph.kava.io/subgraphs/name/sushi-qa/trident-kava", + polygon: "https://api.thegraph.com/subgraphs/name/sushi-v2/trident-polygon", + polygonOldRouter: + "https://api.thegraph.com/subgraphs/name/sushi-0m/trident-polygon", + optimism: "https://api.thegraph.com/subgraphs/name/sushi-v2/trident-optimism", + kava: "https://pvt.graph.kava.io/subgraphs/name/sushi-v2/trident-kava", metis: - "https://andromeda.thegraph.metis.io/subgraphs/name/sushi-qa/trident-metis", + "https://andromeda.thegraph.metis.io/subgraphs/name/sushi-v2/trident-metis", + bittorrent: + "https://subgraphs.sushi.com/subgraphs/name/sushi-v2/trident-bttc", + arbitrum: "https://api.thegraph.com/subgraphs/name/sushi-v2/trident-arbitrum", + bsc: "https://api.thegraph.com/subgraphs/name/sushi-v2/trident-bsc", + avax: "https://api.thegraph.com/subgraphs/name/sushi-v2/trident-avalanche", }; -const tridentQueryWithBlock = gql` +const tridentQueryWithBlock = ` query get_tokens($block: Int) { tokens( block: { number: $block } @@ -26,7 +31,7 @@ const tridentQueryWithBlock = gql` } `; -const tridentQuery = gql` +const tridentQuery = ` query get_tokens { tokens( first: 1000 @@ -42,27 +47,23 @@ const tridentQuery = gql` `; function trident(chain) { - return async (timestamp, ethBlock, chainBlocks) => { - const balances = {}; + return async (timestamp, ethBlock, chainBlocks, { api }) => { const graphUrl = graphUrls[chain]; - const block = chainBlocks[chain]; - const transform = await getChainTransform(chain); - // Query graphql endpoint let result; - if (block) { - result = await request(graphUrl, tridentQueryWithBlock, { - block: block - 50, //subgraphs can be late by few seconds/minutes - }); - } else { - result = await request(graphUrl, tridentQuery); + result = await blockQuery(graphUrl, tridentQueryWithBlock, { api }); + + if (chain == "polygon") { + //add pools that haven't been migrated to the new router + result.tokens.push( + ...(await blockQuery(graphUrls["polygonOldRouter"], tridentQuery, { api })).tokens + ); } result.tokens.forEach((token) => { - sdk.util.sumSingleBalance(balances, transform(token.id), token.liquidity); + api.add(token.id, token.liquidity); }); - return balances; }; } diff --git a/projects/sushiswap-v3/index.js b/projects/sushiswap-v3/index.js new file mode 100644 index 00000000000..30af1c0e74b --- /dev/null +++ b/projects/sushiswap-v3/index.js @@ -0,0 +1,65 @@ +const { uniV3Export } = require("../helper/uniswapV3"); + +module.exports = uniV3Export({ + ethereum: { + factory: "0xbACEB8eC6b9355Dfc0269C18bac9d6E2Bdc29C4F", + fromBlock: 16955547, + }, + arbitrum: { + factory: "0x1af415a1EbA07a4986a52B6f2e7dE7003D82231e", + fromBlock: 75998697, + }, + optimism: { + factory: "0x9c6522117e2ed1fE5bdb72bb0eD5E3f2bdE7DBe0", + fromBlock: 85432013, + }, + polygon: { + factory: "0x917933899c6a5F8E37F31E19f92CdBFF7e8FF0e2", + fromBlock: 41024971, + }, + arbitrum_nova: { + factory: "0xaa26771d497814e81d305c511efbb3ced90bf5bd", + fromBlock: 4242300, + }, + avax: { + factory: "0x3e603C14aF37EBdaD31709C4f848Fc6aD5BEc715", + fromBlock: 28186391, + }, + bsc: { + factory: "0x126555dd55a39328F69400d6aE4F782Bd4C34ABb", + fromBlock: 26976538, + }, + fantom: { + factory: "0x7770978eED668a3ba661d51a773d3a992Fc9DDCB", + fromBlock: 58860670, + }, + fuse: { + factory: "0x1b9d177CcdeA3c79B6c8F40761fc8Dc9d0500EAa", + fromBlock: 22556035, + }, + xdai: { + factory: "0xf78031CBCA409F2FB6876BDFDBc1b2df24cF9bEf", + fromBlock: 27232871, + }, + moonbeam: { + factory: "0x2ecd58F51819E8F8BA08A650BEA04Fc0DEa1d523", + fromBlock: 3264275, + }, + moonriver: { + factory: "0x2F255d3f3C0A3726c6c99E74566c4b18E36E3ce6", + fromBlock: 3945310, + }, + // boba: { factory: '0x0BE808376Ecb75a5CF9bB6D237d16cd37893d904', fromBlock: 998556, }, + polygon_zkevm: { + factory: "0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506", + fromBlock: 80860, + }, + thundercore: { + factory: "0xc35dadb65012ec5796536bd9864ed8773abc74c4", + fromBlock: 132536332, + }, + base: { + factory: "0xc35DADB65012eC5796536bD9864eD8773aBc74C4", + fromBlock: 1759510, + }, +}); diff --git a/projects/sushiswap/api.js b/projects/sushiswap/api.js index 1e345fef0f9..bded00d1074 100644 --- a/projects/sushiswap/api.js +++ b/projects/sushiswap/api.js @@ -1,13 +1,9 @@ -const { request, gql } = require("graphql-request"); const { toUSDTBalances } = require('../helper/balances'); -const { getBlock } = require('../helper/getBlock') +const { blockQuery } = require('../helper/http') const { getUniTVL } = require("../helper/unknownTokens") -const { sumTokens2 } = require('../helper/unwrapLPs') -const sdk = require('@defillama/sdk'); -const { getChainTransform } = require("../helper/portedTokens"); const graphUrl = 'https://api.thegraph.com/subgraphs/name/zippoxer/sushiswap-subgraph-fork' -const graphQuery = gql` +const graphQuery = ` query get_tvl($block: Int) { uniswapFactory( id: "0xC0AEe478e3658e2610c5F7A4A2E1777cE9e4f2Ac", @@ -18,7 +14,7 @@ query get_tvl($block: Int) { } } `; -const graphQueryPolygon = gql` +const graphQueryPolygon = ` query get_tvl($block: Int) { factory( id: "0xc35dadb65012ec5796536bd9864ed8773abc74c4", @@ -29,33 +25,16 @@ query get_tvl($block: Int) { } `; -async function eth(timestamp, ethBlock, chainBlocks) { - let block = ethBlock - if (block === undefined) { - block = await getBlock(timestamp, 'ethereum', chainBlocks) - } - const { uniswapFactory } = await request( - graphUrl, - graphQuery, - { - block: block - 50, - } - ); +async function eth(timestamp, ethBlock, chainBlocks, { api }) { + const { uniswapFactory } = await blockQuery(graphUrl, graphQuery, { api, }); const usdTvl = Number(uniswapFactory.totalLiquidityUSD) return toUSDTBalances(usdTvl) } -function getChainTVL(chain) { - return async (timestamp, _b, chainBlocks) => { - const block = await getBlock(timestamp, chain, chainBlocks, false) - const { factory } = await request( - 'https://api.thegraph.com/subgraphs/name/sushiswap/exchange-' + chain, - graphQueryPolygon, - { - block: block - 100, - } - ); +function getChainTVL() { + return async (timestamp, _b, chainBlocks, { api }) => { + const { factory } = await blockQuery('https://api.thegraph.com/subgraphs/name/sushiswap/exchange-' + api.chain, graphQueryPolygon, { api, }); const usdTvl = Number(factory.liquidityUSD) return toUSDTBalances(usdTvl) @@ -63,173 +42,43 @@ function getChainTVL(chain) { } const factory = '0xc35DADB65012eC5796536bD9864eD8773aBc74C4' +const tvl = getUniTVL({ + factory, useDefaultCoreAssets: true, blacklist: [ + '0xed0b4b0f0e2c17646682fc98ace09feb99af3ade', // RVRS + '0x00598f74DA03489d4fFDb7Fde54db8E3D3AA9a61', // GSHIB + '0xE38928cd467AD7347465048b3637893124187d02', // GSHIB + '0xc0e39cbac6a5c5cdcdf2c1a1c29cbf5917754943', // GSHIB + ], +}) module.exports = { - telos: { - tvl: getUniTVL({ - factory, - chain: 'telos', - useDefaultCoreAssets: true, - }), - }, - palm: { - tvl: getUniTVL({ - factory, - chain: 'palm', - useDefaultCoreAssets: true, - }), - }, - moonriver: { - tvl: getUniTVL({ - factory, - chain: 'moonriver', - useDefaultCoreAssets: true, - }), - }, - celo: { - tvl: getUniTVL({ - factory, - chain: 'celo', - useDefaultCoreAssets: true, - }), - }, - okexchain: { - tvl: getUniTVL({ - factory, - chain: 'okexchain', - useDefaultCoreAssets: true, - }), - }, - arbitrum: { - tvl: getUniTVL({ - factory, - chain: 'arbitrum', - useDefaultCoreAssets: true, - }), - }, - xdai: { - tvl: getUniTVL({ - factory, - chain: 'xdai', - useDefaultCoreAssets: true, - }) - }, - harmony: { - tvl: getUniTVL({ - factory, - chain: 'harmony', - useDefaultCoreAssets: true, - blacklist: [ - '0xed0b4b0f0e2c17646682fc98ace09feb99af3ade', // RVRS - ], - }) - }, - ethereum: { - tvl: eth, - }, - polygon: { - tvl: getUniTVL({ - factory, - chain: 'polygon', - useDefaultCoreAssets: true, - }), - }, - fantom: { - tvl: getUniTVL({ - factory, - chain: 'fantom', - useDefaultCoreAssets: true, - }), - }, - bsc: { - tvl: getUniTVL({ - factory, - chain: 'bsc', - useDefaultCoreAssets: true, - blacklist: [ - '0x00598f74DA03489d4fFDb7Fde54db8E3D3AA9a61', // GSHIB - '0xE38928cd467AD7347465048b3637893124187d02', // GSHIB - '0xc0e39cbac6a5c5cdcdf2c1a1c29cbf5917754943', // GSHIB - ] - }), - }, - heco: { - tvl: getUniTVL({ - factory, - chain: 'heco', - useDefaultCoreAssets: true, - }), - }, - boba: { - tvl: getUniTVL({ - factory, - chain: 'boba', - useDefaultCoreAssets: true, - }), - }, - avax: { - tvl: getUniTVL({ - factory, - chain: 'avax', - useDefaultCoreAssets: true, - }), - }, + telos: { tvl, }, + palm: { tvl, }, + moonriver: { tvl, }, + celo: { tvl, }, + okexchain: { tvl, }, + arbitrum: { tvl, }, + xdai: { tvl, }, + harmony: { tvl, }, + ethereum: { tvl: eth, }, + polygon: { tvl, }, + fantom: { tvl, }, + bsc: { tvl, }, + heco: { tvl, }, + boba: { tvl, }, + boba_avax: { tvl, }, + boba_bnb: { tvl, }, + avax: { tvl, }, fuse: { - tvl: getUniTVL({ - factory: '0x43eA90e2b786728520e4f930d2A71a477BF2737C', - chain: 'fuse', - useDefaultCoreAssets: true, - }), - }, - arbitrum_nova: { - tvl: getUniTVL({ - chain: 'arbitrum_nova', - useDefaultCoreAssets: true, - factory, - }) + tvl: getUniTVL({ factory: '0x43eA90e2b786728520e4f930d2A71a477BF2737C', useDefaultCoreAssets: true, }), }, + arbitrum_nova: { tvl, }, + base: { tvl, }, //moved kava to trident adapter - //kava: { - // tvl: kavaTridentTvl, - //}, + //kava: { // tvl: kavaTridentTvl, //}, } module.exports.polygon.tvl = getChainTVL('polygon') // module.exports.bsc.tvl = getChainTVL('bsc') -module.exports.fantom.tvl = getChainTVL('fantom') +// module.exports.fantom.tvl = getChainTVL('fantom') // module.exports.harmony.tvl = getChainTVL('harmony') - -async function kavaTridentTvl(ts, _b, cb) { - const chain = 'kava' - const graph = 'https://pvt.graph.kava.io/subgraphs/name/sushiswap/trident-kava' - const query = `query get_tvl($block: Int){ - pairs( - block: { number: $block } - size: 1000 - ){ - id - name - type - reserve0 - reserve1 - token0 { - id - } - token1 { - id - } - } - }` - const block = await getBlock(ts, chain, cb, false) - const { pairs } = await request(graph, query, { - block: block - 100, - }) - // const bentoBox = '0xc35DADB65012eC5796536bD9864eD8773aBc74C4' - const balances = {} - const transform = await getChainTransform(chain) - pairs.forEach(i => { - sdk.util.sumSingleBalance(balances, transform(i.token0.id), i.reserve0) - sdk.util.sumSingleBalance(balances, transform(i.token1.id), i.reserve1) - } ) - return balances -} diff --git a/projects/sushiswap/historical.js b/projects/sushiswap/historical.js index f1d5d957f83..97278060cf0 100644 --- a/projects/sushiswap/historical.js +++ b/projects/sushiswap/historical.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk') const { getChainTvl } = require('../helper/getUniSubgraphTvl') const {staking} = require('../helper/staking') @@ -31,7 +32,7 @@ const subgraphChainTvls = Object.keys(subgraphs).reduce((obj, chain) => ({ }), {}) const xSUSHI = "0x8798249c2E607446EfB7Ad49eC89dD1865Ff4272" -const SUSHI = "0x6b3595068778dd592e39a122f4f5a5cf09c90fe2" +const SUSHI = ADDRESSES.ethereum.SUSHI subgraphChainTvls.ethereum.staking = staking(xSUSHI, SUSHI, 'ethereum'); diff --git a/projects/sushiswap/index.js b/projects/sushiswap/index.js index c04d02c497b..7eaf665f7c0 100644 --- a/projects/sushiswap/index.js +++ b/projects/sushiswap/index.js @@ -1,16 +1,20 @@ +const ADDRESSES = require('../helper/coreAssets.json') const {staking} = require('../helper/staking') const { getExports } = require('../helper/heroku-api') const indexExports = require('./api') const xSUSHI = "0x8798249c2E607446EfB7Ad49eC89dD1865Ff4272" -const SUSHI = "0x6b3595068778dd592e39a122f4f5a5cf09c90fe2" -const chainKeys = Object.keys(indexExports).filter(chain => typeof indexExports[chain] === 'object' && indexExports[chain].tvl) +const SUSHI = ADDRESSES.ethereum.SUSHI +// const chainKeys = Object.keys(indexExports).filter(chain => typeof indexExports[chain] === 'object' && indexExports[chain].tvl) -module.exports = { - timetravel: false, - misrepresentedTokens: true, - ...getExports("sushiswap", chainKeys), -} +// // module.exports = { +// // timetravel: false, +// // misrepresentedTokens: true, +// // ...getExports("sushiswap", chainKeys), +// // } + +module.exports = indexExports +module.exports.misrepresentedTokens = true module.exports.ethereum.staking = staking(xSUSHI, SUSHI, 'ethereum') // node test.js projects/sushiswap/index.js \ No newline at end of file diff --git a/projects/suter-shield/index.js b/projects/suter-shield/index.js index 94322078a06..f47367ef187 100644 --- a/projects/suter-shield/index.js +++ b/projects/suter-shield/index.js @@ -1,16 +1,17 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk'); const BigNumber = require("bignumber.js") // ETH -const ETH_COIN = '0x0000000000000000000000000000000000000000'; +const ETH_COIN = ADDRESSES.null; const SUTER_ETH_V1 = '0x02b4E089E96a0A672dE0a0d93E2869B899b15a44'; const SUTER_ETH_V2 = '0x934cc5704165711296207b5AFc87933AE0685a4C'; -const USDT_COIN = '0xdAC17F958D2ee523a2206206994597C13D831ec7'; +const USDT_COIN = ADDRESSES.ethereum.USDT; const SUTER_USDT_V1 = '0x29abf1a011cdfb9548dc8faa6d19b1b39808bf58'; const SUTER_USDT_V2 = '0xB8fcF79EAd34E98e45fc21E5dB1C5C561d906371'; -const DAI_COIN = '0x6B175474E89094C44Da98b954EedeAC495271d0F'; +const DAI_COIN = ADDRESSES.ethereum.DAI; const SUTER_DAI_V1 = '0x54A8e0C76Eec21DD30842FbbcA2D336669102b77'; const SUTER_DAI_V2 = '0xbdf418486D438e44F5aAC6aF86330dA638ea70AD'; @@ -18,13 +19,13 @@ const SUTER_COIN = '0xAA2ce7Ae64066175E0B90497CE7d9c190c315DB4'; const SUTER_SUTER_V1 = '0xab4e72599e2cec5dcc8249657833b3408905900e'; // BSC -// const BNB_COIN = '0x0000000000000000000000000000000000000000'; +// const BNB_COIN = ADDRESSES.null; // WBNB -const BNB_COIN = '0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c'; +const BNB_COIN = ADDRESSES.bsc.WBNB; const SUTER_BNB_V1 = '0x2A00d7d2de1E147a3BCAa122B4EC5D6f9F0c1147'; const SUTER_BNB_V2 = '0x5bb6eE37a6503fe381207c3BAC0Aa6d7B33590Fa'; -const BUSD_COIN = '0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56'; +const BUSD_COIN = ADDRESSES.bsc.BUSD; const SUTER_BUSD_V1 = '0xe557c77Ed24df7cDF21ED55a8C56Ea36CeBD5BD2'; const SUTER_BUSD_V2 = '0x382926Ba4D92E5d7652A85Aa7085Ffb15b6b6C89'; @@ -44,18 +45,6 @@ const XSUTER_COIN = '0x822d04d22f962d6132f53b0fa6b9409097d12550'; const BSC_SUTER_XSUTER_V1 = '0x4de5cB2EB81A37DD768fc58fe0ca7b811C997c35'; const BSC_SUTER_XSUTER_V2 = '0x41690D4E1E20B0cBB1fb6004CA80e67bdFa6BA02'; -// POLYGON -const MATIC_COIN = '0x0000000000000000000000000000000000000000'; -const POLYGON_SUTER_MATIC_V1 = '0x934cc5704165711296207b5AFc87933AE0685a4C'; - -// SMART BCH -const BCH_COIN = '0x0000000000000000000000000000000000000000'; -const SUTER_BCH_V2 = '0x5B5bC8624F595136CdC4593606883c60A2150aF2'; - -const FLEXUSD_COIN = '0x7b2B3C5308ab5b2a1d9a94d20D35CCDf61e05b72'; -const SUTER_FLEXUSD_V2 = '0xe253BAA5C5b5615727Cf2C55Aa806090D891Cd54'; - - async function eth_tvl(timestamp, block) { let balances = {}; let total_eth_tvl = 0; @@ -80,7 +69,6 @@ async function eth_tvl(timestamp, block) { block, chain: 'ethereum' }); - // console.log("eth:", eth_tvl.output, typeof(eth_tvl.output)) total_eth_tvl = new BigNumber(eth_tvl.output).plus(new BigNumber(total_eth_tvl)); } } @@ -108,7 +96,6 @@ async function bsc_tvl(timestamp, ethBlock, chainBlocks) { }else{ balances[`bsc:${coin}`] = new BigNumber(balances[`bsc:${coin}`]).plus(new BigNumber(erc20_tvl.output)); } - // console.log(erc20_tvl.output, typeof(erc20_tvl.output)) } let bnb_tvl = await sdk.api.eth.getBalance({ target: pool, @@ -124,39 +111,6 @@ async function bsc_tvl(timestamp, ethBlock, chainBlocks) { } -// async function polygon_tvl(timestamp, block) { -// let balances = {}; -// let total_matic_tvl = 0; -// let pools = {[MATIC_COIN]: [POLYGON_SUTER_MATIC_V1]}; -// for(var coin in pools){ -// for(var pool of pools[coin]) { -// if(coin !== MATIC_COIN){ -// let erc20_tvl = await sdk.api.erc20.balanceOf({ -// target: coin, -// owner: pool, -// block: block, -// chain: 'polygon' -// }); -// if(balances[`polygon:${coin}`] === undefined){ -// balances[`polygon:${coin}`] = erc20_tvl.output; -// }else{ -// balances[`polygon:${coin}`] = new BigNumber(balances[`polygon:${coin}`]).plus(new BigNumber(erc20_tvl.output)).toString(); -// } -// } -// let matic_tvl = await sdk.api.eth.getBalance({ -// target: pool, -// block, -// chain: 'polygon' -// }); -// total_matic_tvl = new BigNumber(matic_tvl.output).plus(new BigNumber(total_matic_tvl)); -// } -// } - -// balances[`polygon:${MATIC_COIN}`] = total_matic_tvl.toString(); -// return balances; -// } - - module.exports = { timetravel: false, ethereum:{ @@ -165,10 +119,4 @@ module.exports = { bsc: { tvl: bsc_tvl, }, - // polygon: { - // tvl: polygon_tvl - // }, - // smartbch: { - // tvl: bch_tvl, - // } }; \ No newline at end of file diff --git a/projects/svn/abi.json b/projects/svn/abi.json index 54ef644c42e..23394820bb9 100644 --- a/projects/svn/abi.json +++ b/projects/svn/abi.json @@ -1,80 +1,4 @@ { - "poolInfo": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "poolInfo", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "allocPoint", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastRewardTime", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accMSharePerShare", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "isStarted", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - "poolInfo2": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "poolInfo", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "allocPoint", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastRewardTime", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accSavannaPerShare", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "isStarted", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - } + "poolInfo": "function poolInfo(uint256) view returns (address token, uint256 allocPoint, uint256 lastRewardTime, uint256 accMSharePerShare, bool isStarted)", + "poolInfo2": "function poolInfo(uint256) view returns (address token, uint256 allocPoint, uint256 lastRewardTime, uint256 accSavannaPerShare, bool isStarted)" } \ No newline at end of file diff --git a/projects/svn/index.js b/projects/svn/index.js index 520d95848cf..d0d8cf77d52 100644 --- a/projects/svn/index.js +++ b/projects/svn/index.js @@ -1,12 +1,12 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); -const { tombTvl } = require("../helper/tomb"); const { stakingPricedLP } = require("../helper/staking"); const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); -const token0Abi = require("../helper/abis/token0.json"); -const token1Abi = require("../helper/abis/token1.json"); +const token0Abi = 'address:token0' +const token1Abi = 'address:token1' const { default: BigNumber } = require("bignumber.js"); -let token = "0x654bAc3eC77d6dB497892478f854cF6e8245DcA9"; +let token = ADDRESSES.cronos.SVN; let share = "0xf8b9facB7B4410F5703Eb29093302f2933D6E1Aa"; const rewardPool = "0xA51054BDf0910E3cE9B233e6B5BdDc0931b2E2ED"; const masonry = "0x2CcbFD9598116cdF9B94fF734ece9dCaF4c9d471"; @@ -94,10 +94,10 @@ async function tvl(timestamp, block, chainBlocks) { "cronos", (addr) => `cronos:${addr}` ); - delete balances['cronos:0x654bac3ec77d6db497892478f854cf6e8245dca9']; + delete balances['cronos:' + ADDRESSES.cronos.SVN]; return balances; -}; +} module.exports = { cronos : { tvl, diff --git a/projects/swaap-v2/index.js b/projects/swaap-v2/index.js new file mode 100644 index 00000000000..a2f7d3325a9 --- /dev/null +++ b/projects/swaap-v2/index.js @@ -0,0 +1,27 @@ +const { getLogs } = require('../helper/cache/getLogs') + +const config = { + ethereum: { factory: '0x03C01Acae3D0173a93d819efDc832C7C4F153B06', fromBlock: 17598603, }, + polygon: { factory: '0x03C01Acae3D0173a93d819efDc832C7C4F153B06', fromBlock: 44521619, }, +} + +Object.keys(config).forEach(chain => { + const { factory, fromBlock } = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const logs = await getLogs({ + api, + target: factory, + topics: ['0x83a48fbcfc991335314e74d0496aab6a1987e992ddc85dddbcc4d6dd6ef2e9fc'], + eventAbi: 'event PoolCreated (address indexed pool)', + onlyArgs: true, + fromBlock, + }) + const pools = logs.map(log => log.pool) + const vault = await api.call({ abi: 'address:getVault', target: factory }) + const poolIds = await api.multiCall({ abi: 'function getPoolId() view returns (bytes32)', calls: pools }) + const data = await api.multiCall({ abi: 'function getPoolTokens(bytes32) view returns (address[] tokens, uint256[] balances, uint256 lastChangeBlock)', calls: poolIds, target: vault }) + data.forEach(({ tokens, balances }) => api.addTokens(tokens, balances)) + } + } +}) \ No newline at end of file diff --git a/projects/swaap/index.js b/projects/swaap/index.js index bf5d6f10ce9..a269c0e564f 100644 --- a/projects/swaap/index.js +++ b/projects/swaap/index.js @@ -1,7 +1,7 @@ -const { GraphQLClient, gql } = require("graphql-request"); const { sumTokens2 } = require('../helper/unwrapLPs') +const { cachedGraphQuery } = require('../helper/cache') -const configV1 = { +const configV1 = { polygon: { startBlock: 29520285, blockDelay: 30, @@ -18,33 +18,26 @@ const configV1 = { } function tvlFunctionGetterV1(chain) { - - return async function tvlFunction(timestamp, ethBlock, chainBlocks) { - - var graphQLClient = new GraphQLClient(configV1[chain]['theGraph']['endpoint']); - + return async function tvlFunction(timestamp, ethBlock, chainBlocks, { api }) { let block = chainBlocks[chain] if (block) - block = configV1[chain]['startBlock'] + configV1[chain]['blockDelay'] > chainBlocks[chain]['startBlock'] ? - configV1[chain]['startBlock'] : chainBlocks[chain] - configV1[chain]['blockDelay'] // delayed to allow subgraph to update - - const fetchAllPools = gql`query ($block: Int) { ${configV1[chain]['theGraph']['query']} }`; - const results = await graphQLClient.request(fetchAllPools, { - block, + block = configV1[chain]['startBlock'] + configV1[chain]['blockDelay'] > chainBlocks[chain]['startBlock'] ? + configV1[chain]['startBlock'] : chainBlocks[chain] - configV1[chain]['blockDelay'] // delayed to allow subgraph to update + + const fetchAllPools = `query ($block: Int) { ${configV1[chain]['theGraph']['query']} }`; + const results = await cachedGraphQuery('swaaap-v1/' + chain, configV1[chain]['theGraph']['endpoint'], fetchAllPools, { + variables: { block, } }); const toa = results.pools.map(i => i.tokens.map(j => ([j.address, i.id]))).flat() - return sumTokens2({ chain, block, tokensAndOwners: toa, }) - } + return sumTokens2({ api, tokensAndOwners: toa, }) + } } module.exports = { start: 1655130642, // Jun-13-2022 02:30:42 PM +UTC - timetravel: true, - misrepresentedTokens: false, methodology: `The TVL is retrieved using a mix of TheGraph (to get the list of pools) and on-chain (to get the pools' assets balance) calls.`, polygon: { tvl: tvlFunctionGetterV1("polygon"), }, - hallmarks:[] }; diff --git a/projects/swampfinance/index.js b/projects/swampfinance/index.js index 7656ba95b7f..674d31402a4 100644 --- a/projects/swampfinance/index.js +++ b/projects/swampfinance/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { yieldHelper, } = require("../helper/yieldHelper") module.exports = yieldHelper({ @@ -5,4 +6,5 @@ module.exports = yieldHelper({ chain: 'bsc', masterchef: '0x33AdBf5f1ec364a4ea3a5CA8f310B597B8aFDee3', nativeToken: '0xc5A49b4CBe004b6FD55B30Ba1dE6AC360FF9765d', + blacklistedTokens: [ADDRESSES.bsc.BTCB] }) \ No newline at end of file diff --git a/projects/swapbase/index.js b/projects/swapbase/index.js new file mode 100644 index 00000000000..605dd0f5e99 --- /dev/null +++ b/projects/swapbase/index.js @@ -0,0 +1,6 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports = { + misrepresentedTokens: true, + base: { tvl: getUniTVL({ factory: '0x04C9f118d21e8B767D2e50C946f0cC9F6C367300', useDefaultCoreAssets: true, fetchBalances: true, }), }, +} \ No newline at end of file diff --git a/projects/swapfish/index.js b/projects/swapfish/index.js index 427424cab17..4acd24c93c3 100644 --- a/projects/swapfish/index.js +++ b/projects/swapfish/index.js @@ -1,14 +1,19 @@ const { staking } = require("../helper/staking"); const MasterChefContract = "0x33141e87ad2DFae5FBd12Ed6e61Fa2374aAeD029"; +const MasterChefBscContract = "0x671eFBa3F6874485cC39535fa7b525fe764985e9"; const FISH = "0xb348B87b23D5977E2948E6f36ca07E1EC94d7328"; const { getUniTVL } = require('../helper/unknownTokens') module.exports = { methodology: `Uses factory(0x71539D09D3890195dDa87A6198B98B75211b72F3) address and whitelisted tokens address to find and price Liquidity Pool pairs`, arbitrum: { - tvl: getUniTVL({ factory: '0x71539D09D3890195dDa87A6198B98B75211b72F3', chain: 'arbitrum' }), + tvl: getUniTVL({ factory: '0x71539D09D3890195dDa87A6198B98B75211b72F3', useDefaultCoreAssets: true }), staking: staking(MasterChefContract, FISH, "arbitrum"), + }, + bsc: { + tvl: getUniTVL({ factory: '0x71539D09D3890195dDa87A6198B98B75211b72F3', useDefaultCoreAssets: true }), + staking: staking(MasterChefBscContract, FISH, "bsc"), } }; diff --git a/projects/swapline/index.js b/projects/swapline/index.js new file mode 100644 index 00000000000..d3dd743d6e3 --- /dev/null +++ b/projects/swapline/index.js @@ -0,0 +1,57 @@ +const { sumTokens2 } = require('../helper/unwrapLPs') + +const factories = { + fantom: '0x640801a6983c109805E928dc7d9794080C21C88E', + optimism: '0xd08C98F6409fCAe3E61f3157B4147B6595E60cf3', + polygon_zkevm: '0x5A5c0C4832828FF878CE3ab4fEc44d21200b1496', + arbitrum: '0xEE0616a2DEAa5331e2047Bc61E0b588195A49cEa', + base: '0x5A5c0C4832828FF878CE3ab4fEc44d21200b1496', +} +async function tvl(_, _b, _cb, { api, }) { + let blacklistedTokens = [] + if (api.chain === 'fantom') blacklistedTokens = ['0xdc6ff44d5d932cbd77b52e5612ba0529dc6226f1'] + const pools = await api.fetchList({ + target: factories[api.chain], + itemAbi: 'function getLBPairAtIndex(uint256) view returns (address)', + lengthAbi: 'uint256:getNumberOfLBPairs', + }) + const tokenA = await api.multiCall({ + abi: 'address:getTokenX', + calls: pools, + }) + const tokenB = await api.multiCall({ + abi: 'address:getTokenY', + calls: pools, + }) + const toa = [] + tokenA.map((_, i) => { + toa.push([tokenA[i], pools[i]]) + toa.push([tokenB[i], pools[i]]) + }) + return sumTokens2({...api, tokensAndOwners: toa, blacklistedTokens,}) +} + +module.exports = { + hallmarks: [ + [1682298000,"Launch on Optimism"], + [1687827600,"Launch on Polygon zkEVM"], + [1689037200,"Launch on Arbitrum"], + [1690848000,"Launch on Base"] + ], + methodology: 'We count the token balances in in different liquidity book contracts', + fantom:{ + tvl, + }, + optimism:{ + tvl, + }, + polygon_zkevm:{ + tvl, + }, + arbitrum:{ + tvl, + }, + base:{ + tvl, + }, +}; \ No newline at end of file diff --git a/projects/swapmatic/index.js b/projects/swapmatic/index.js index dbdf286b320..868193d1a72 100644 --- a/projects/swapmatic/index.js +++ b/projects/swapmatic/index.js @@ -1,23 +1,20 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk') const BigNumber = require('bignumber.js'); -const { getBlock } = require('../helper/getBlock') +const { getLogs } = require('../helper/cache/getLogs') const START_BLOCK = 3285065 - 1; const FACTORY = '0x90D882B2789523403ff263D1F93Ead986c38446C'; -const MATIC = '0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0'.toLowerCase(); +const MATIC = ADDRESSES.ethereum.MATIC.toLowerCase(); -async function tvl(_, _block, cb) { - const block = await getBlock(_, 'polygon', cb) +async function tvl(_, _block, cb, { api }) { const chain = 'polygon' - const logs = (await sdk.api.util - .getLogs({ - keys: [], - toBlock: block, - chain, + const logs = (await getLogs({ + api, target: FACTORY, fromBlock: START_BLOCK, topic: 'NewExchange(address,address)', - })).output; + })); const exchanges = {}; logs.forEach((log) => { @@ -32,38 +29,11 @@ async function tvl(_, _block, cb) { await sdk.api.eth .getBalances({ targets: Object.keys(exchanges).map((exchangeAddress) => exchangeAddress), - block, + block: api.block, chain, }) ).output; - /* - const tokenBalances = ( - await sdk.api.abi - .multiCall({ - abi: 'erc20:balanceOf', - calls: Object.keys(exchanges).map((exchangeAddress) => ({ - target: exchanges[exchangeAddress], - params: exchangeAddress, - })), - chain, - block, - }) - ).output; - - const balances = tokenBalances.reduce( - (accumulator, tokenBalance) => { - const balanceBigNumber = new BigNumber(tokenBalance.output) - if (!balanceBigNumber.isZero()) { - const tokenAddress = tokenBalance.input.target.toLowerCase() - accumulator['polygon:'+tokenAddress] = balanceBigNumber.toFixed() - } - return accumulator - }, - {} - ) - */ - return { [MATIC]: ETHBalances.reduce( (accumulator, ETHBalance) => @@ -71,7 +41,7 @@ async function tvl(_, _block, cb) { new BigNumber('0') ).times(2).toFixed(0), } -}; +} module.exports = { misrepresentedTokens: true, diff --git a/projects/swapperchan/index.js b/projects/swapperchan/index.js index ccdfc7d12a4..c301e120755 100644 --- a/projects/swapperchan/index.js +++ b/projects/swapperchan/index.js @@ -4,7 +4,6 @@ module.exports={ boba:{ tvl: getUniTVL({ factory: '0x3d97964506800d433fb5dbebdd0c202ec9b62557', - chain: 'boba', useDefaultCoreAssets: true, }) } diff --git a/projects/swaprum/index.js b/projects/swaprum/index.js new file mode 100644 index 00000000000..d0953fdc4fd --- /dev/null +++ b/projects/swaprum/index.js @@ -0,0 +1,19 @@ +const { getUniTVL } = require("../helper/unknownTokens"); +const { stakings } = require("../helper/staking"); + +const factory = "0xD757C986a28F82761Fe874Bc40073718dC1e980C"; +const SAPR = "0x2aE25460c44d578E6f41aB900a7A5425b6492C16" +const pools = [ + "0x2B6deC18E8e4DEf679b2E52e628B14751F2f66bc", +] + +module.exports = { + misrepresentedTokens: true, + arbitrum: { + staking: stakings(pools, SAPR,), + tvl: getUniTVL({ fetchBalances: true, useDefaultCoreAssets: true, factory }) + }, + hallmarks: [ + [Math.floor(new Date('2023-05-18')/1e3), 'Project rugged!'], + ], +}; \ No newline at end of file diff --git a/projects/swapscanner-staking/index.js b/projects/swapscanner-staking/index.js new file mode 100644 index 00000000000..e0d48b95604 --- /dev/null +++ b/projects/swapscanner-staking/index.js @@ -0,0 +1,24 @@ +const sdk = require("@defillama/sdk"); +const { nullAddress } = require('../helper/unwrapLPs'); +const chain = 'klaytn' + +const SCNR = { + GCKLAY: '0x999999999939ba65abb254339eec0b2a0dac80e9' +} + +module.exports = { + klaytn: { + tvl: async (_, _b, {klaytn:block}) => { + const gcklayBal = await sdk.api2.abi.call({ + target: SCNR.GCKLAY, + abi: 'erc20:totalSupply', + chain, block, + }) + + const balances = {} + sdk.util.sumSingleBalance(balances, nullAddress, gcklayBal, chain) + return balances; + } + }, + timetravel: false, +} diff --git a/projects/swapscanner/index.js b/projects/swapscanner/index.js index f8e90f11e53..80b0f957140 100644 --- a/projects/swapscanner/index.js +++ b/projects/swapscanner/index.js @@ -1,5 +1,6 @@ -const { stakingUnknownPricedLP } = require("../helper/staking") -const { pool2 } = require("../helper/unknownTokens") +const sdk = require('@defillama/sdk') +const { transformBalances } = require('../helper/portedTokens') +const chain = 'klaytn' const SCNR = { address: "0x8888888888885b073f3c81258c27e83db228d5f3", @@ -11,15 +12,51 @@ const SCNR = { const WKLAY = "0xd7a4d10070a4f7bc2a015e78244ea137398c3b74"; +async function getTokenPrice(block) { + const [scnrLPBal, klayLPBal] = await sdk.api2.abi.multiCall({ + abi: 'erc20:balanceOf', + calls: [[SCNR.address, SCNR.LPs.KLAY],[WKLAY, SCNR.LPs.KLAY]].map(([target, params]) => ({ target, params, })), + chain, block, + }) + return klayLPBal/scnrLPBal +} + +async function staking(_, _b, {klaytn: block}) { + const scnrBal = await sdk.api2.abi.call({ + abi: 'erc20:balanceOf', + target: SCNR.address, + params: SCNR.staking, + chain, block, + }) + + const balances = {} + sdk.util.sumSingleBalance(balances,WKLAY,scnrBal * await getTokenPrice(block)) + return transformBalances(chain, balances) +} + +async function pool2(_, _b, {klaytn: block}) { + const [klayLPBal, lpBalance] = await sdk.api2.abi.multiCall({ + abi: 'erc20:balanceOf', + calls: [[WKLAY, SCNR.LPs.KLAY],[SCNR.LPs.KLAY, SCNR.staking]].map(([target, params]) => ({ target, params, })), + chain, block, + }) + + const supply = await sdk.api2.abi.call({ + target: SCNR.LPs.KLAY, + abi: 'erc20:totalSupply', + chain, block, + }) + + const balances = {} + sdk.util.sumSingleBalance(balances,WKLAY,2*klayLPBal * lpBalance/supply) + return transformBalances(chain, balances) +} + + module.exports = { klaytn: { tvl: async () => ({}), - staking: stakingUnknownPricedLP(SCNR.staking, SCNR.address, 'klaytn', SCNR.LPs.KLAY), - pool2: pool2({ - useDefaultCoreAssets: true, - chain: 'klaytn', - lpToken: SCNR.LPs.KLAY, - stakingContract: SCNR.staking, - }), + staking, + pool2, }, -}; +}; \ No newline at end of file diff --git a/projects/swapsicle/iceBoxABI.json b/projects/swapsicle/iceBoxABI.json new file mode 100644 index 00000000000..49c8cc7fb49 --- /dev/null +++ b/projects/swapsicle/iceBoxABI.json @@ -0,0 +1,3 @@ +{ + "totalPrimaryStaked": "uint256:totalPrimaryStaked" +} \ No newline at end of file diff --git a/projects/swapsicle/icevaultABI.json b/projects/swapsicle/icevaultABI.json new file mode 100644 index 00000000000..8e73ce09e5a --- /dev/null +++ b/projects/swapsicle/icevaultABI.json @@ -0,0 +1,3 @@ +{ + "totalStaked": "uint256:totalStaked" +} \ No newline at end of file diff --git a/projects/swapsicle/index.js b/projects/swapsicle/index.js index 550b34bee8b..7788764abe2 100644 --- a/projects/swapsicle/index.js +++ b/projects/swapsicle/index.js @@ -1,59 +1,164 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { staking } = require("../helper/staking"); +const { ethers } = require("ethers"); const { getUniTVL } = require('../helper/unknownTokens') const { stakingPricedLP } = require("../helper/staking") const sdk = require("@defillama/sdk") const BigNumber = require("bignumber.js"); +const iceBoxABI = require("./iceBoxABI.json"); +const iceVaultABI = require("./icevaultABI.json"); -const stakingContract_IB = "0x6aA10ead8531504a8A3B04a9BfCFd18108F2d2c2"; -const WAVAX = '0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7' +const WAVAX = ADDRESSES.avax.WAVAX +//const WTLOS = ADDRESSES.telos.WTLOS const contracts = { avax: { factory: "0x9c60c867ce07a3c403e2598388673c10259ec768", pops: "0x240248628B7B6850352764C5dFa50D1592A033A8", + usdc: ADDRESSES.avax.USDC, stakingContract_sPOPS: "0x5108176bC1B7e72440e6B48862c51d7eB0AEd5c4", stakingContract_IB: "0x6aA10ead8531504a8A3B04a9BfCFd18108F2d2c2", + stakingContract_IB2: "0x737CAE995aCec229a6958B49f6d3eB9F383480Ab", + stakingContract_IV: "0x2626658BB9186B22C798Ea85A4623C2c1eBa2901", }, polygon: { - factory: "0x1eb5644fAC0FB43f79dE25C0BaB94F0d56062718" + factory: "0x735ab9808d792B5c8B54e31196c011c26C08b4ce" + }, + bsc: { + factory: "0xEe673452BD981966d4799c865a96e0b92A8d0E45" + }, + fantom: { + factory: "0x98F23162E3a7FE610aC89C88E4217a599A15858F" + }, + arbitrum: { + factory: "0x2f0c7c98462651bb2102f6cd05acdad333e031b0" + }, + ethereum: { + factory: "0x2f0c7c98462651bb2102f6cd05acdad333e031b0" + }, + optimism: { + factory: "0x2f0c7c98462651bb2102f6cd05acdad333e031b0" + }, + telos: { + factory: "0xB630F53DF13645BFF0Ef55eB44a8a490a7DD4514", + stakingContract_sPOPS: "0x14e374cef17d800109710aa2c2d73e50db76d367", + stakingContract_IB: '0xac448d75e945923b176ebca4ff2b5a82de73f812', + stakingContract_IB2: '0x08010b76d4b03cabcfb0f6ba9db7de8336c715fe', + stakingContract_NFT: '0x552fd5743432eC2dAe222531e8b88bf7d2410FBc', + pops: "0x173fd7434b8b50df08e3298f173487ebdb35fd14", + stlos: ADDRESSES.telos.STLOS } -}; +} function getAVAXAddress(address) { return `avax:${address}`; } +function getTLOSAddress(address) { + return `telos:${address}`; +} + // AVAX (ETH) staking product -async function iceBox(contract, block) { +async function iceBox(contract, block, chain) { let balances = { - "0x0000000000000000000000000000000000000000": ( - await sdk.api.eth.getBalance({ target: contract, block, chain: "avax" }) + [ADDRESSES.null]: ( + await sdk.api.eth.getBalance({ target: contract, block, chain: chain }) ).output, }; return balances; -}; +} + +// Avalanche - IceVault Staking (USDC) +async function stakedUSDC(timestamp, _, { avax: block }) { + const balances = {}; + + const tokenBalance = await sdk.api.abi.call({ + target: contracts.avax.stakingContract_IV, + abi: iceVaultABI.totalStaked, + chain: "avax", block, + }); + + balances[getAVAXAddress(contracts.avax.usdc)] = tokenBalance.output; + + return balances; +} -async function stakedAVAX(timestamp, ethBlock, chainBlocks) { +async function stakedAVAXIceBox(timestamp, ethBlock, chainBlocks) { const balances = {}; const block = chainBlocks.avax; - const avaxBalance = await iceBox(stakingContract_IB, block); - balances[getAVAXAddress("0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7")] = avaxBalance["0x0000000000000000000000000000000000000000"]; + const ibBalance = await iceBox(contracts.avax.stakingContract_IB, block, 'avax'); + balances[getAVAXAddress(WAVAX)] = ibBalance[ADDRESSES.null]; + return balances; -}; +} + +async function stakedAVAXIceBox2(timestamp, ethBlock, chainBlocks) { + const balances = {}; + const block = chainBlocks.avax; + + const ibBalance2 = await iceBox(contracts.avax.stakingContract_IB2, block, 'avax'); + balances[getAVAXAddress(WAVAX)] = ibBalance2[ADDRESSES.null] + + return balances; +} + +async function stakedTLOSIceBox(timestamp, _, { telos: block }) { + const balances = {}; + const stakedSTLOS = await sdk.api.abi.call({ + target: contracts.telos.stakingContract_IB2, + abi: iceBoxABI.totalPrimaryStaked, + chain: "telos", block, + }); + + balances[getTLOSAddress(contracts.telos.stlos)] = stakedSTLOS.output; + return balances; +} module.exports = { misrepresentedTokens: true, methodology: "", avax: { - tvl: getUniTVL({ chain: 'avax', useDefaultCoreAssets: false, factory: contracts.avax.factory }), + tvl: getUniTVL({ chain: 'avax', useDefaultCoreAssets: true, factory: contracts.avax.factory }), staking: sdk.util.sumChainTvls([ - stakingPricedLP(contracts.avax.stakingContract_sPOPS, contracts.avax.pops,'avax','0x7E454625e4bD0CFdC27e752B46bF35C6343D9A78',"wrapped-avax",true), - stakedAVAX + // Ice Cream Van + stakingPricedLP(contracts.telos.stakingContract_sPOPS, contracts.avax.pops,'avax','0x7E454625e4bD0CFdC27e752B46bF35C6343D9A78',"wrapped-avax",true), + // Ice Box + stakedAVAXIceBox, + stakedAVAXIceBox2, + // IceVault + stakedUSDC, + stakingPricedLP(contracts.avax.stakingContract_IV, contracts.avax.pops,'avax','0x7E454625e4bD0CFdC27e752B46bF35C6343D9A78',"wrapped-avax",true) ]) }, polygon: { - tvl: getUniTVL({ chain: 'polygon', useDefaultCoreAssets: false, factory: contracts.polygon.factory }), + tvl: getUniTVL({ chain: 'polygon', useDefaultCoreAssets: true, factory: contracts.polygon.factory }), + }, + bsc: { + tvl: getUniTVL({ chain: 'bsc', useDefaultCoreAssets: true, factory: contracts.bsc.factory }), + }, + fantom: { + tvl: getUniTVL({ chain: 'fantom', useDefaultCoreAssets: true, factory: contracts.fantom.factory }), + }, + arbitrum: { + tvl: getUniTVL({ chain: 'arbitrum', useDefaultCoreAssets: true, factory: contracts.arbitrum.factory }), + }, + ethereum: { + tvl: getUniTVL({ chain: 'ethereum', useDefaultCoreAssets: true, factory: contracts.ethereum.factory }), }, - start: 15434772, -}; + optimism: { + tvl: getUniTVL({ chain: 'optimism', useDefaultCoreAssets: true, factory: contracts.optimism.factory }), + }, + telos: { + tvl: getUniTVL({ chain: 'telos', useDefaultCoreAssets: true, factory: contracts.telos.factory }), + staking: sdk.util.sumChainTvls([ + // Ice Cream Van + stakingPricedLP(contracts.telos.stakingContract_sPOPS, contracts.telos.pops,'telos','0x6dee26f527adb0c24fef704228d8e458b46f9f5f',"wrapped-telos",true), + // NFT's + stakingPricedLP(contracts.telos.stakingContract_NFT, contracts.telos.pops,'telos','0x6dee26f527adb0c24fef704228d8e458b46f9f5f',"wrapped-telos",true), + // Ice Box + stakedTLOSIceBox + ]) + }, + //start: 15434772, +} diff --git a/projects/swarm-markets/index.js b/projects/swarm-markets/index.js index 5f394a2c279..202b5f91cbf 100644 --- a/projects/swarm-markets/index.js +++ b/projects/swarm-markets/index.js @@ -1,55 +1,26 @@ -const sdk = require("@defillama/sdk"); -const { request, gql } = require("graphql-request"); +const { v1Tvl } = require("../helper/balancer") +const sdk = require('@defillama/sdk') -const SUBGRAPH_URL = - "https://api.thegraph.com/subgraphs/name/protofire/swarm-markets"; -const XTokenWrapperContractAddress = - "0x2b9dc65253c035eb21778cb3898eab5a0ada0cce"; - -async function getTokens() { - let tokens = []; - - const tokensQuery = gql` - query Tokens { - tokens(where: { symbol_not: "SPT" }) { - id - } - } - `; - const tokensResponse = await request(SUBGRAPH_URL, tokensQuery); - tokens = tokensResponse.tokens.map((token) => token.id); - - return tokens; -} - -async function getBalances(tokens, block) { - const balanceCalls = tokens.map((token) => ({ - target: token, - params: XTokenWrapperContractAddress, - })); - - const balanceResponses = ( - await sdk.api.abi.multiCall({ - block, - calls: balanceCalls, - abi: "erc20:balanceOf", - }) - ); - - const balances = {}; - sdk.util.sumMultiBalanceOf(balances, balanceResponses, true); - return balances; -} - -async function tvl(timestamp, block) { - const tokens = await getTokens(); - const balances = await getBalances(tokens, block); - - return balances; +const config = { + polygon: { factory: '0x991fd11876a438af7bcadc98f4b3cf201bdf6191', fromBlock: 23158523, wrapper: '0x6cdde4ed9165405c1914b229d3cd4ac9c354c331', }, + ethereum: { factory: '0x9186503af1d7d3317b4c2c44a815be984838c296', fromBlock: 12432945, wrapper: '0x2b9dc65253c035eb21778cb3898eab5a0ada0cce', }, } -module.exports = { - ethereum: { - tvl +module.exports = {}; + +Object.keys(config).forEach(chain => { + const { factory, fromBlock, wrapper } = config[chain] + const tvlFunc = v1Tvl(factory, fromBlock) + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const balances = {} + const balances_ = await tvlFunc(_, _b, _cb, { api, }) + const tokens = Object.keys(balances_) + const uTokens = await api.multiCall({ abi: 'function xTokenToToken(address) view returns (address)', target: wrapper, calls: tokens.map(i => i.replace(api.chain + ':', '')) }) + tokens.forEach((v, i) => { + sdk.util.sumSingleBalance(balances, uTokens[i], balances_[v], api.chain) + }) + return balances } -} \ No newline at end of file + } +}) \ No newline at end of file diff --git a/projects/swell/index.js b/projects/swell/index.js new file mode 100644 index 00000000000..0a97b03fd24 --- /dev/null +++ b/projects/swell/index.js @@ -0,0 +1,14 @@ +const { nullAddress } = require("../helper/unwrapLPs"); + +module.exports = { + ethereum: { + tvl: async (_, _1, _2, { api }) => { + const totalSupply = await api.call({ target: '0xf951E335afb289353dc249e82926178EaC7DEd78', abi: 'uint256:totalSupply'}); + const rate = await api.call({ target: '0xf951E335afb289353dc249e82926178EaC7DEd78', abi: 'uint256:getRate'}); + + return { + [nullAddress]: (totalSupply * rate)/1e18 + }; + } + } +}; diff --git a/projects/swift-finance/abi.json b/projects/swift-finance/abi.json index 5e548e9bc83..ed1909dd4e1 100644 --- a/projects/swift-finance/abi.json +++ b/projects/swift-finance/abi.json @@ -1,27 +1,3 @@ { - "poolInfo": { - "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "name": "poolInfo", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "lpToken", - "type": "address" - }, - { "internalType": "uint256", "name": "allocPoint", "type": "uint256" }, - { - "internalType": "uint256", - "name": "lastRewardBlock", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accSwiftPerShare", - "type": "uint256" - }, - { "internalType": "uint16", "name": "depositFeeBP", "type": "uint16" } - ], - "stateMutability": "view", - "type": "function" - } -} + "poolInfo": "function poolInfo(uint256) view returns (address lpToken, uint256 allocPoint, uint256 lastRewardBlock, uint256 accSwiftPerShare, uint16 depositFeeBP)" +} \ No newline at end of file diff --git a/projects/swift-finance/index.js b/projects/swift-finance/index.js index f6defc77470..de8ebc583ec 100644 --- a/projects/swift-finance/index.js +++ b/projects/swift-finance/index.js @@ -1,15 +1,7 @@ const abi = require("./abi.json"); -const {addFundsInMasterChef, masterChefExports} = require("../helper/masterchef") +const {masterChefExports} = require("../helper/masterchef") const token = "0x0Aa4ef05B43700BF4b6E6Dc83eA4e9C2CF6Af0fA"; const masterchef = "0x242c27C5F92e20d70CA0dAA7b76d927DFC7EF20B" -// async function tvl(timestamp, block, chainBlocks) { -// let balances = {}; -// await addFundsInMasterChef(balances, masterchef, chainBlocks.avax, "avax", addr=>`avax:${addr}`, abi.poolInfo, [token], true, true, token); -// return balances; -// } - -module.exports = { - ...masterChefExports(masterchef, "avax", token, true, abi.poolInfo) -}; \ No newline at end of file +module.exports = masterChefExports(masterchef, "avax", token, true, abi.poolInfo) \ No newline at end of file diff --git a/projects/swim/config.js b/projects/swim/config.js index f033bd41249..68dc4e77239 100644 --- a/projects/swim/config.js +++ b/projects/swim/config.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') module.exports = { solana: { tvl: { @@ -5,12 +6,12 @@ module.exports = { { pool: 'AfhhYsLMXXyDxQ1B7tNqLTXXDHYtDxCzPcnXWXzHAvDb', // Hexapool tokens: [ - 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v', // Solana-USDC - 'Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB', // Solana-USDT + ADDRESSES.solana.USDC, // Solana-USDC + ADDRESSES.solana.USDT, // Solana-USDT 'A9mUU4qviSctJVPJdBJWkb28deg915LYJKrzQ19ji3FM', // Eth-USDC 'Dn4noZ5jgGfkntzcQSUZ8czkreiZ1ForXYoV2H8Dm7S1', // Eth-USDT - '5RpUwQ8wtdPCZHhu6MERp2RGrpobsbZ6MH5dDHkUjs2', // Bsc-BUSD - '8qJSyQprMC57TWKaYEmetUR3UUiTP2M3hXdcvFhkZdmv', // Bsc-USDT + ADDRESSES.solana.BUSDbs, // Bsc-BUSD + ADDRESSES.solana.USDTbs, // Bsc-USDT ], symbols: [ "usd-coin", diff --git a/projects/swirllend/index.js b/projects/swirllend/index.js new file mode 100644 index 00000000000..5f394d4dad9 --- /dev/null +++ b/projects/swirllend/index.js @@ -0,0 +1,15 @@ +const { compoundExports2 } = require("../helper/compound"); + +module.exports = { + linea: compoundExports2({ + comptroller: "0xcAABf6Ffb76634183254B0a4a3D5fb36180FdAE4", + fetchBalances: true, + cether: '0x91067b912f89dfca50c3f5529dbeb78b63c6a2e5', + }), + + base: compoundExports2({ + comptroller: "0xcAABf6Ffb76634183254B0a4a3D5fb36180FdAE4", + fetchBalances: true, + cether: '0x91067b912f89dfca50c3f5529dbeb78b63c6a2e5', + }), +}; diff --git a/projects/swivel/index.js b/projects/swivel/index.js index 6a87a804664..ff654a4a7d4 100644 --- a/projects/swivel/index.js +++ b/projects/swivel/index.js @@ -1,21 +1,28 @@ -const { sumTokensExport } = require('../helper/unknownTokens') +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require("../helper/unknownTokens"); module.exports = { + hallmarks: [ + [Math.floor(new Date('2023-03-13') / 1e3), 'Euler was hacked'], + ], ethereum: { tvl: sumTokensExport({ owners: [ - '0x3b983B701406010866bD68331aAed374fb9f50C9', // Swivel v1 - '0x093e4d20d9b2c3c8f68e8a20262d8fb8ebce08fa', // Swivel v2 - '0x373a06bD3067f8DA90239a47f316F09312b7800F', // Swivel v3 + "0x3b983B701406010866bD68331aAed374fb9f50C9", // Swivel v1 + "0x093e4d20d9b2c3c8f68e8a20262d8fb8ebce08fa", // Swivel v2 + "0x373a06bD3067f8DA90239a47f316F09312b7800F" // Swivel v3 ], tokens: [ - '0x5d3a536E4D6DbD6114cc1Ead35777bAB948E3643', // cDAI - '0x6b175474e89094c44da98b954eedeac495271d0f', // DAI - '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', // USDC - '0xEb91861f8A4e1C12333F42DCE8fB0Ecdc28dA716', // eUSDC - '0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84', // Lido stETH - '0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0', // Lido wstETH - ], + "0x5d3a536E4D6DbD6114cc1Ead35777bAB948E3643", // cDAI + ADDRESSES.ethereum.DAI, + ADDRESSES.ethereum.USDC, + "0x39AA39c021dfbaE8faC545936693aC917d5E7563", // cUSDC, + // "0xEb91861f8A4e1C12333F42DCE8fB0Ecdc28dA716", // eUSDC + ADDRESSES.ethereum.STETH, + ADDRESSES.ethereum.WSTETH, + "0x5E8422345238F34275888049021821E8E08CAa1f", // frxETH + ADDRESSES.ethereum.sfrxETH + ] }) } -} \ No newline at end of file +}; diff --git a/projects/swop/index.js b/projects/swop/index.js index ff0bfd99212..e97e99921c6 100644 --- a/projects/swop/index.js +++ b/projects/swop/index.js @@ -1,10 +1,17 @@ -const { wavesAdapter } = require('../helper/chain/wavesAdapter') +const { get } = require("../helper/http"); +const { toUSDTBalances } = require("../helper/balances"); -const endpoint = "http://51.158.191.108:8002/api/v1/history/swop" +const swopfiBackendEndpoint = "https://backend.swop.fi"; + +const getSwopFiTVL = async () => { + const poolsStats = await get(`${swopfiBackendEndpoint}/pools`); + return toUSDTBalances(poolsStats.overall.liquidity); +} module.exports = { - timetravel: false, - waves: { - tvl: wavesAdapter(endpoint, item => item.totalLocked / 1e6) - } -} \ No newline at end of file + timetravel: false, // Waves blockchain, + methodology: "Counts the tokens locked on AMM pools", + waves: { + tvl: getSwopFiTVL, + } +}; diff --git a/projects/symbiosis-finance/abi/getToken.json b/projects/symbiosis-finance/abi/getToken.json deleted file mode 100644 index 5ca81406e81..00000000000 --- a/projects/symbiosis-finance/abi/getToken.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "inputs": [ - { - "internalType": "uint8", - "name": "index", - "type": "uint8" - } - ], - "name": "getToken", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" -} \ No newline at end of file diff --git a/projects/symbiosis-finance/config.js b/projects/symbiosis-finance/config.js new file mode 100644 index 00000000000..d344a09f57a --- /dev/null +++ b/projects/symbiosis-finance/config.js @@ -0,0 +1,187 @@ +const ADDRESSES = require('../helper/coreAssets.json') +module.exports = { + chains: [ + { + name: 'ethereum', + tokens: [ + ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.WETH, + ], + holders: [ + '0xb80fDAA74dDA763a8A158ba85798d373A5E84d84', // portal v1 + '0xb8f275fBf7A959F4BCE59999A2EF122A099e81A8', // portal v2 + ] + }, + { + name: 'bsc', + tokens: [ + ADDRESSES.bsc.BUSD, + ADDRESSES.bsc.USDC, + ADDRESSES.bsc.ETH, + ], + holders: [ + '0xD7F9989bE0d15319d13d6FA5d468211C89F0b147', // portal v1 + '0x5Aa5f7f84eD0E5db0a4a85C3947eA16B53352FD4', // portal v2 + '0xab0738320A21741f12797Ee921461C691673E276', // v1 pool with Ethereum + ] + }, + { + name: 'avax', + tokens: [ + ADDRESSES.avax.USDC_e, + ADDRESSES.avax.USDC, + ], + holders: [ + '0xD7F9989bE0d15319d13d6FA5d468211C89F0b147', // portal v1 + '0xE75C7E85FE6ADd07077467064aD15847E6ba9877', // portal v2 + '0xab0738320A21741f12797Ee921461C691673E276', // v1 pool with Ethereum + '0xF4BFF06E02cdF55918e0ec98082bDE1DA85d33Db', // v1 pool with BNB chain + ] + }, + { + name: 'polygon', + tokens: [ + ADDRESSES.polygon.USDC, + ADDRESSES.polygon.WETH_1, + ], + holders: [ + '0xD7F9989bE0d15319d13d6FA5d468211C89F0b147', // portal v1 + '0xb8f275fBf7A959F4BCE59999A2EF122A099e81A8', // portal v2 + '0xab0738320A21741f12797Ee921461C691673E276', // v1 pool with Ethereum + '0xF4BFF06E02cdF55918e0ec98082bDE1DA85d33Db', // v1 pool with BNB chain + '0x3F1bfa6FA3B6D03202538Bf0cdE92BbE551104ac', // v1 pool with Avalanche + ] + }, + { + name: 'telos', + tokens: [ + ADDRESSES.telos.USDC, + ], + holders: [ + '0x17A0E3234f00b9D7028e2c78dB2caa777F11490F', // portal v1 + '0xb8f275fBf7A959F4BCE59999A2EF122A099e81A8', // portal v2 + '0x7f3C1E54b8b8C7c08b02f0da820717fb641F26C8', // v1 pool with BNB chain + ] + }, + { + name: 'aurora', + tokens: [ + ADDRESSES.aurora.USDC_e, + ], + holders: [ + '0x17A0E3234f00b9D7028e2c78dB2caa777F11490F', // portal v1 + '0x7Ff7AdE2A214F9A4634bBAA4E870A5125dA521B8', // v1 pool with BNB chain + '0x7F1245B61Ba0b7D4C41f28cAc9F8637fc6Bec9E4', // v1 pool with Polygon + ] + }, + { + name: 'boba', + tokens: [ + ADDRESSES.boba.USDC, + ], + holders: [ + '0xD7F9989bE0d15319d13d6FA5d468211C89F0b147', // portal v1 + '0xb8f275fBf7A959F4BCE59999A2EF122A099e81A8', // portal v2 + '0xab0738320A21741f12797Ee921461C691673E276', // v1 pool with Ethereum + '0xe0ddd7afC724BD4B320472B5C954c0abF8192344', // v1 pool with BNB chain + ] + }, + { + name: 'boba_avax', + tokens: [ + ADDRESSES.boba_avax.USDC_e, + ], + holders: [ + '0xd8db4fb1fEf63045A443202d506Bcf30ef404160', // portal v2 + ] + }, + { + name: 'boba_bnb', + tokens: [ + ADDRESSES.boba_bnb.USDC, + ], + holders: [ + '0x6148FD6C649866596C3d8a971fC313E5eCE84882', // pool v2 + ] + }, + { + name: 'kava', + tokens: [ + ADDRESSES.kava.USDC, + ADDRESSES.kava.USDt, + ], + holders: [ + '0x292fC50e4eB66C3f6514b9E402dBc25961824D62', // portal v2 + ] + }, + { + name: 'era', + tokens: [ + ADDRESSES.era.USDC, + ADDRESSES.era.WETH, + ], + holders: [ + '0x39dE19C9fF25693A2311AAD1dc5C790194084A39', // portal v2 + ] + }, + { + name: 'arbitrum', + tokens: [ + ADDRESSES.arbitrum.USDC, // USDC.e + ADDRESSES.arbitrum.USDC_CIRCLE, + ADDRESSES.arbitrum.WETH, + ], + holders: [ + '0x01A3c8E513B758EBB011F7AFaf6C37616c9C24d9', // portal v2 + ] + }, + { + name: 'optimism', + tokens: [ + ADDRESSES.optimism.USDC, + ADDRESSES.optimism.WETH_1, + ], + holders: [ + '0x292fC50e4eB66C3f6514b9E402dBc25961824D62', // portal v2 + ] + }, + { + name: 'arbitrum_nova', + tokens: [ + ADDRESSES.arbitrum_nova.USDC, + ADDRESSES.arbitrum_nova.WETH, + ], + holders: [ + '0x292fC50e4eB66C3f6514b9E402dBc25961824D62', // portal v2 + ] + }, + { + name: 'polygon_zkevm', + tokens: [ + ADDRESSES.polygon_zkevm.USDC, + ADDRESSES.polygon_zkevm.WETH, + ], + holders: [ + '0x292fC50e4eB66C3f6514b9E402dBc25961824D62', // portal v2 + ] + }, + { + name: 'mantle', + tokens: [ + ADDRESSES.mantle.USDC, + ], + holders: [ + '0x292fC50e4eB66C3f6514b9E402dBc25961824D62', // portal v2 + ] + }, + { + name: 'linea', + tokens: [ + ADDRESSES.linea.WETH, + ], + holders: [ + '0x292fC50e4eB66C3f6514b9E402dBc25961824D62', // portal v2 + ] + }, + ] +} \ No newline at end of file diff --git a/projects/symbiosis-finance/index.js b/projects/symbiosis-finance/index.js index 418b80a4af3..2b5d1b4542a 100644 --- a/projects/symbiosis-finance/index.js +++ b/projects/symbiosis-finance/index.js @@ -1,113 +1,13 @@ -const sdk = require('@defillama/sdk'); -const { sumTokens2 } = require('../helper/unwrapLPs') -const erc20Abi = require("../helper/abis/erc20.json") - -const getTokenAbi = require("./abi/getToken.json"); - -const config = { - chains: [ - { - id: 1, - name: 'ethereum', - portal: '0xb80fDAA74dDA763a8A158ba85798d373A5E84d84', - stable: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', // USDC - pools: [] - }, - { - id: 56, - name: 'bsc', - portal: '0xD7F9989bE0d15319d13d6FA5d468211C89F0b147', - stable: '0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56', // BUSD - pools: [ - '0xab0738320A21741f12797Ee921461C691673E276', // BUSD + sUSDC from Ethereum - ] - }, - { - id: 43114, - name: 'avax', - portal: '0xD7F9989bE0d15319d13d6FA5d468211C89F0b147', - stable: '0xA7D7079b0FEaD91F3e65f86E8915Cb59c1a4C664', // USDC.e - pools: [ - '0xab0738320A21741f12797Ee921461C691673E276', // USDC.e + sUSDC from Ethereum - '0xF4BFF06E02cdF55918e0ec98082bDE1DA85d33Db', // USDC.e + sBUSD from BSC - ] - }, - { - id: 137, - name: 'polygon', - portal: '0xD7F9989bE0d15319d13d6FA5d468211C89F0b147', - stable: '0x2791bca1f2de4661ed88a30c99a7a9449aa84174', // USDC - pools: [ - '0xab0738320A21741f12797Ee921461C691673E276', // USDC + sUSDC from Ethereum, - '0xF4BFF06E02cdF55918e0ec98082bDE1DA85d33Db', // USDC + sBUSD from BSC, - '0x3F1bfa6FA3B6D03202538Bf0cdE92BbE551104ac', // USDC + sUSDC.e from Avalanche - ] - }, - { - id: 288, - name: 'boba', - portal: '0xD7F9989bE0d15319d13d6FA5d468211C89F0b147', - stable: '0x66a2A913e447d6b4BF33EFbec43aAeF87890FBbc', // USDC - pools: [ - '0xab0738320A21741f12797Ee921461C691673E276', // USDC + sUSDC from Ethereum, - '0xe0ddd7afC724BD4B320472B5C954c0abF8192344', // USDC + sBUSD from BSC, - ] - }, - { - id: 1313161554, - name: 'aurora', - portal: '0x17A0E3234f00b9D7028e2c78dB2caa777F11490F', - stable: '0xB12BFcA5A55806AaF64E99521918A4bf0fC40802', // USDC - pools: [ - '0x7Ff7AdE2A214F9A4634bBAA4E870A5125dA521B8', // USDC + sBUSD from BSC, - '0x7F1245B61Ba0b7D4C41f28cAc9F8637fc6Bec9E4', // USDC + sUSDC from Polygon, - ] - }, - { - id: 40, - name: 'telos', - portal: '0x17A0E3234f00b9D7028e2c78dB2caa777F11490F', - stable: '0x818ec0a7fe18ff94269904fced6ae3dae6d6dc0b', // USDC - pools: [ - '0x7f3C1E54b8b8C7c08b02f0da820717fb641F26C8', // USDC + sBUSD from BSC, - ] - }, - { - id: 2001, - name: 'milkomeda', - portal: '0x3Cd5343546837B958a70B82E3F9a0E857d0b5fea', - pools: [], - synthStable: '0x42110A5133F91B49E32B671Db86E2C44Edc13832' // sUSDC - }, - ] -} +const config = require("./config"); +const { sumTokensExport } = require('../helper/unwrapLPs') module.exports = { - methodology: 'Counts the amount of locked assets in Portal contracts plus amount locked in stable pools', + methodology: 'Counts the amount of stables locked in Symbiosis protocol contracts: Portals V1, NervePools V1, Portals V2, OmniPool V2', }; config.chains.forEach(chainInfo => { - const { name: chain, stable, portal, pools, } = chainInfo + const {name: chain, tokens, holders} = chainInfo module.exports[chain] = { - tvl: async (_, _b, { [chain]: block }) => { - const tokensAndOwners = [] - if (stable) tokensAndOwners.push([stable, portal]) - if (pools) { - const poolIndexes = [0, 1] // every stable pool consists of 2 assets - const calls = pools.map(i => poolIndexes.map(j => ({ target: i, params: j }))).flat(); - (await sdk.api.abi.multiCall({ - abi: getTokenAbi, - calls, chain, block, - })).output.forEach(({ input: { target }, output }) => tokensAndOwners.push([output, target])) - } - const tokens = tokensAndOwners.map(i => i[0]) - const { output: nameRes } = await sdk.api.abi.multiCall({ - abi: erc20Abi.name, - calls: tokens.map(i => ({ target: i })), - chain, block, - }) - const blacklistedTokens = tokens.filter((_, i) => nameRes[i].output.startsWith('Synthetic ')) - return sumTokens2({ chain, block, tokensAndOwners, blacklistedTokens, }) - } + tvl: sumTokensExport({ chain, tokens, owners: holders }) } }) diff --git a/projects/symmetric/index.js b/projects/symmetric/index.js index c21971b2cff..ab82c474182 100644 --- a/projects/symmetric/index.js +++ b/projects/symmetric/index.js @@ -1,60 +1,20 @@ const sdk = require('@defillama/sdk'); -const BigNumber = require("bignumber.js"); -const { GraphQLClient, gql } = require('graphql-request') -const { toUSDTBalances } = require('../helper/balances'); -const { getBlock } = require('../helper/getBlock'); -async function getTVL(subgraphName, block, version = 'v1') { - // delayed by around 5 mins to allow subgraph to update - block -= 25; - var endpoint = `https://api.thegraph.com/subgraphs/name/centfinance/${subgraphName}` - var graphQLClient = new GraphQLClient(endpoint) - - var v1 = gql` - query get_tvl($block: Int) { - symmetrics( - first: 5, - block: { number: $block } - ) { - totalLiquidity, - totalSwapVolume - } - } - `; - var v2 = gql` - query get_tvl($block: Int) { - balancers( - first: 5, - block: { number: $block } - ) { - totalLiquidity, - totalSwapVolume - } - } - `; - const results = await graphQLClient.request(version === 'v1' ? v1 : v2, { - block - }) - return version ==='v1'? results.symmetrics[0].totalLiquidity : results.balancers[0].totalLiquidity; -} - -async function xdai(timestamp, ethBlock, chainBlocks) { - const [v1,v2] = await Promise.all([getTVL("symmetric-xdai", await getBlock(timestamp, "xdai", chainBlocks), 'v1'), getTVL("symmetric-v2-gnosis", await getBlock(timestamp, "xdai", chainBlocks), 'v2')]) - return toUSDTBalances(BigNumber(v1).plus(v2)) -} - -async function celo(timestamp, ethBlock, chainBlocks) { - const [v1,v2] = await Promise.all([getTVL("symmetric-celo", await getBlock(timestamp, "celo", chainBlocks), 'v1'), getTVL("symmetric-v2-celo", await getBlock(timestamp, "celo", chainBlocks), 'v2')]) - return toUSDTBalances(BigNumber(v1).plus(v2)) -} +const { v1Tvl, onChainTvl } = require('../helper/balancer') module.exports = { - misrepresentedTokens: true, - methodology: `Symmetric is an Automated Market Maker (AMM) and a Decentralized Exchange (DEX), running on the Celo and Gnosis networks. - Symmetric TVL is pulled from the Symmetric subgraph and includes deposits made to Symmetric Gnosis and Symmetric Celo V1 & V2 liquidity pools.`, - celo:{ - tvl: celo + celo: { + tvl: sdk.util.sumChainTvls([ + v1Tvl('0x6C2e59C3cCB1d81c0eC9Fb9d4d6a3CC3488Fd71c', 6759199), + onChainTvl('0xE9265892B5c56264d60e26451862B576814185C9', 11764404), + ]) }, - xdai:{ - tvl: xdai + xdai: { + tvl: sdk.util.sumChainTvls([ + v1Tvl('0x9B4214FD41cD24347A25122AC7bb6B479BED72Ac', 16465037), + onChainTvl('0x901E0dC02f64C42F73F0Bdbf3ef21aFc96CF50be', 21343993), + ]) }, + kava: { + tvl: onChainTvl('0xA18808989E7EB0FcF0932fd00D007F3C118B78E7', 551649), + } } diff --git a/projects/symmetry/index.js b/projects/symmetry/index.js new file mode 100644 index 00000000000..c438680a719 --- /dev/null +++ b/projects/symmetry/index.js @@ -0,0 +1,41 @@ +const { getConnection, sumTokens2 } = require("../helper/solana"); +const { PublicKey } = require('@solana/web3.js') +const FUNDS_VAULT = 'BLBYiq48WcLQ5SxiftyKmPtmsZPUBEnDEjqEnKGAR4zx' +const TOKEN_PROGRAM_ID = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; + +async function fetch() { + const connection = getConnection(); + const filters = [ + { + dataSize: 165, + }, + { + memcmp: { + offset: 32, + bytes: FUNDS_VAULT, + } + } + ]; + const accounts = await connection.getParsedProgramAccounts( + new PublicKey(TOKEN_PROGRAM_ID), + {filters: filters} + ) + let balances = {}; + let tokenAccounts = []; + accounts.forEach((account, i) => { + const parsedAccountInfo = account.account.data; + const mintAddress = parsedAccountInfo["parsed"]["info"]["mint"]; + const tokenBalance = parsedAccountInfo["parsed"]["info"]["tokenAmount"]["uiAmount"]; + tokenAccounts.push(account.pubkey.toString()); + balances[mintAddress] = tokenBalance; + }); + let sum = await sumTokens2({ tokenAccounts }) + return sum; +} + +module.exports = { + timetravel: false, + solana: { + tvl: fetch + }, +}; \ No newline at end of file diff --git a/projects/symphony/abi.json b/projects/symphony/abi.json index 93338fe72fa..c592dbcdab7 100644 --- a/projects/symphony/abi.json +++ b/projects/symphony/abi.json @@ -1,31 +1,3 @@ { - "getTotalTokens": { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "contractBalance", - "type": "uint256" - }, - { - "internalType": "address", - "name": "tokenStrategy", - "type": "address" - } - ], - "name": "getTotalTokens", - "outputs": [ - { - "internalType": "uint256", - "name": "totalTokens", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - } + "getTotalTokens": "function getTotalTokens(address token, uint256 contractBalance, address tokenStrategy) returns (uint256 totalTokens)" } \ No newline at end of file diff --git a/projects/symphony/index.js b/projects/symphony/index.js index 18a8d9ee3f9..05145fe3493 100644 --- a/projects/symphony/index.js +++ b/projects/symphony/index.js @@ -1,10 +1,6 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk'); -const { fetchURL } = require("../helper/utils"); -const { - transformAvaxAddress, - transformPolygonAddress, - transformOptimismAddress, -} = require("../helper/portedTokens"); +const { getConfig } = require('../helper/cache') const abi = require('./abi.json'); const yoloAddress = { @@ -12,11 +8,11 @@ const yoloAddress = { 'polygon': "0x935b97586FE291750F46Bf4eD7BeB8E1c3d110A2", 'optimism': "0x3Ff61F4d7e1d912CA3Cb342581B2e764aE24d017" } -const zeroAddress = '0x0000000000000000000000000000000000000000'; +const zeroAddress = ADDRESSES.null; const TOKENLIST_URL = "https://raw.githubusercontent.com/symphony-finance/token-list/master/symphony.tokenlist.json"; const calcTvl = async (balances, id, chain, block, transformAddress) => { - const tokenList = (await fetchURL(TOKENLIST_URL)).data.tokens + const tokenList = (await getConfig('symphony', TOKENLIST_URL)).tokens .filter((data) => data.chainId == id && !data.extensions.isNative) .map((token) => token); @@ -60,7 +56,7 @@ const calcTvl = async (balances, id, chain, block, transformAddress) => { const avaxTVL = async (chainBlocks) => { const balances = {}; - const transformAddress = await transformAvaxAddress(); + const transformAddress = addr => 'avax:'+addr await calcTvl( balances, 43114, @@ -73,7 +69,7 @@ const avaxTVL = async (chainBlocks) => { const polygonTvl = async (chainBlocks) => { const balances = {}; - const transformAddress = await transformPolygonAddress(); + const transformAddress = addr => 'polygon:'+addr await calcTvl( balances, 137, @@ -86,7 +82,7 @@ const polygonTvl = async (chainBlocks) => { const optimismTvl = async (chainBlocks) => { const balances = {}; - const transformAddress = await transformOptimismAddress(); + const transformAddress = addr => 'optimism:'+addr await calcTvl( balances, 10, diff --git a/projects/synapse/config.js b/projects/synapse/config.js index fbc7c0a9fcb..af2ca176fc6 100644 --- a/projects/synapse/config.js +++ b/projects/synapse/config.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') module.exports = { ethereum: { tvl: { @@ -5,9 +6,9 @@ module.exports = { { pool: '0x1116898dda4015ed8ddefb84b6e8bc24528af2d8', tokens: [ - "0x6b175474e89094c44da98b954eedeac495271d0f", // DAI - "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", // USDC - "0xdac17f958d2ee523a2206206994597c13d831ec7", // USDT + ADDRESSES.ethereum.DAI, + ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.USDT, ] }, ], @@ -15,17 +16,17 @@ module.exports = { address: '0x2796317b0fF8538F253012862c06787Adfb8cEb6', tokens: [ '0x98585dfc8d9e7d48f0b1ae47ce33332cf4237d96', // NEWO - '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', // WETH + ADDRESSES.ethereum.WETH, '0x0ab87046fBb341D058F17CBC4c1133F25a20a52f', // gOHM '0x71ab77b7dbb4fa7e017bc15090b2163221420282', // HIGH - '0x853d955acef822db058eb8505911ed77f175b99e', // FRAX + ADDRESSES.ethereum.FRAX, '0xbaac2b4491727d78d2b78815144570b9f2fe8899', // DOG '0x73968b9a57c6e53d41345fd57a6e6ae27d6cdb2f', // SDT - '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', // USDC - '0xdac17f958d2ee523a2206206994597c13d831ec7', // USDT + ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.USDT, '0xb753428af26e81097e7fd17f40c88aaa3e04902c', // SFI - '0x6B175474E89094C44Da98b954EedeAC495271d0F', // DAI - '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599', // wBTC + ADDRESSES.ethereum.DAI, + ADDRESSES.ethereum.WBTC, '0x1a7e4e63778B4f12a199C062f3eFdD288afCBce8', // agEUR '0x0642026E7f0B6cCaC5925b4E7Fa61384250e1701', // H2O '0x02B5453D92B730F29a86A0D5ef6e930c4Cf8860B', // USDB @@ -44,14 +45,14 @@ module.exports = { pool: '0xE27BFf97CE92C3e1Ff7AA9f86781FDd6D48F5eE9', tokens: [ // '0x809DC529f07651bD43A172e8dB6f4a7a0d771036', // neth - '0x121ab82b49B2BC4c7901CA46B8277962b4350204', // weth + ADDRESSES.optimism.WETH, ] }, { pool: '0xF44938b0125A6662f9536281aD2CD6c499F22004', tokens: [ - // '0x67C10C397dD0Ba417329543c1a40eb48AAa7cd00', // nusd - '0x7f5c764cbc14f9669b88837ca1490cca17c31607', // usdc + // ADDRESSES.metis.SYN, // nusd + ADDRESSES.optimism.USDC, ] }, ], @@ -62,10 +63,10 @@ module.exports = { bridge: { address: '0xC05e61d0E7a63D27546389B7aD62FdFf5A91aACE', tokens: [ - '0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7', // WAVAX + ADDRESSES.avax.WAVAX, '0x1f1e7c893855525b303f99bdf5c3c05be09ca251', // SYN '0x321E7092a180BB43555132ec53AaA65a5bF84251', // gOHM - '0x152b9d0FdC40C096757F570A51E494bd4b943E50', // BTC.b + ADDRESSES.avax.BTC_b, '0x5aB7084CB9d270c2Cb052dd30dbecBCA42F8620c', // USDB '0x62edc0692BD897D2295872a9FFCac5425011c661', // GMX ] @@ -74,9 +75,9 @@ module.exports = { { pool: '0xED2a7edd7413021d440b09D654f3b87712abAB66', tokens: [ - "0xd586E7F844cEa2F87f50152665BCbc2C279D8d70", // DAI - "0xA7D7079b0FEaD91F3e65f86E8915Cb59c1a4C664", // USDC - "0xc7198437980c041c805a1edcba50c1ce5db95118", // USDT + ADDRESSES.avax.DAI, + ADDRESSES.avax.USDC_e, + ADDRESSES.avax.USDT_e, // "0xCFc37A6AB183dd4aED08C204D1c2773c0b1BDf46", // nusd ] }, @@ -100,7 +101,7 @@ module.exports = { { pool: '0xCb6674548586F20ca39C97A52A0ded86f48814De', tokens: [ - "0xc21223249CA28397B4B6541dfFaEcC539BfF0c59", // DAI + ADDRESSES.cronos.USDC, // "0x396c9c192dd323995346632581BEF92a31AC623b", // nusd ] }, @@ -114,7 +115,7 @@ module.exports = { tokens: [ '0x5f4bde007dc06b867f86ebfe4802e34a1ffeed63', // HIGH '0xaA88C603d142C371eA0eAC8756123c5805EdeE03', // DOG - '0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56', // BUSD + ADDRESSES.bsc.BUSD, '0x0FE9778c005a5A6115cBE12b0568a2d50b765A51', // NFD '0x130025eE738A66E691E6A7a62381CB33c6d9Ae83', // JUMP '0xc8699AbBba90C7479dedcCEF19eF78969a2fc608', // USDB @@ -124,9 +125,9 @@ module.exports = { { pool: '0x28ec0B36F0819ecB5005cAB836F4ED5a2eCa4D13', tokens: [ - "0xe9e7cea3dedca5984780bafc599bd69add087d56", // BUSD - "0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d", // USDC - "0x55d398326f99059ff775485246999027b3197955", // USDT + ADDRESSES.bsc.BUSD, + ADDRESSES.bsc.USDC, + ADDRESSES.bsc.USDT, // "0x23b891e5c62e0955ae2bd185990103928ab817b3", // nusd ] }, @@ -139,16 +140,16 @@ module.exports = { address: '0x8f5bbb2bb8c2ee94639e55d5f41de9b4839c1280', tokens: [ '0xd8cA34fd379d9ca3C6Ee3b3905678320F5b45195', // gOHM - '0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270', // wMATIC + ADDRESSES.polygon.WMATIC_2, ] }, pools: [ { pool: '0x85fCD7Dd0a1e1A9FCD5FD886ED522dE8221C3EE5', tokens: [ - "0x8f3cf7ad23cd3cadbd9735aff958023239c6a063", // DAI - "0x2791bca1f2de4661ed88a30c99a7a9449aa84174", // USDC - "0xc2132d05d31c914a87c6611c10748aeb04b58e8f", // USDT + ADDRESSES.polygon.DAI, + ADDRESSES.polygon.USDC, + ADDRESSES.polygon.USDT, // "0xb6c473756050de474286bed418b77aeac39b02af", // nusd ] }, @@ -161,7 +162,7 @@ module.exports = { address: '0xAf41a65F786339e7911F4acDAD6BD49426F2Dc6b', tokens: [ '0x91fa20244Fb509e8289CA630E5db3E9166233FDc', // gOHM - '0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83', // wFTM + ADDRESSES.fantom.WFTM, '0x6Fc9383486c163fA48becdEC79d6058f984f62cA', // USDB ] }, @@ -169,17 +170,17 @@ module.exports = { { pool: '0x85662fd123280827e11c59973ac9fcbe838dc3b4', tokens: [ - "0x04068da6c83afcfa0e13ba15a6696662335d5b75", // USDC - "0x049d68029688eabf473097a2fc38ef61633a3c7a", // fUSDT + ADDRESSES.fantom.USDC, + ADDRESSES.fantom.fUSDT, // "0xED2a7edd7413021d440b09D654f3b87712abAB66", // nusd ] }, { - pool: '0x2913E812Cf0dcCA30FB28E6Cac3d2DCFF4497688', + pool: ADDRESSES.arbitrum.nUSD, tokens: [ - "0x82f0b8b456c1a451378467398982d4834b6829c1", // MIM - "0x04068da6c83afcfa0e13ba15a6696662335d5b75", // USDC - "0x049d68029688eabf473097a2fc38ef61633a3c7a", // USDT + ADDRESSES.fantom.MIM, + ADDRESSES.fantom.USDC, + ADDRESSES.fantom.fUSDT, // "0xED2a7edd7413021d440b09D654f3b87712abAB66", // nusd ] }, @@ -187,7 +188,7 @@ module.exports = { pool: '0x8D9bA570D6cb60C7e3e0F31343Efe75AB8E65FB1', tokens: [ "0x74b23882a30290451A17c44f4F05243b6b58C76d", // weth - // "0x67c10c397dd0ba417329543c1a40eb48aaa7cd00", // neth + // ADDRESSES.metis.SYN, // neth ] }, ] @@ -204,16 +205,16 @@ module.exports = { { pool: '0x753bb855c8fe814233d26Bb23aF61cb3d2022bE5', tokens: [ - "0xd203De32170130082896b4111eDF825a4774c18E", // weth + ADDRESSES.boba.WETH, // "0x96419929d7949D6A801A6909c145C8EEf6A40431", // neth ] }, { pool: '0x75FF037256b36F15919369AC58695550bE72fead', tokens: [ - "0xf74195Bb8a5cf652411867c5C2C5b8C2a402be35", // DAI - "0x66a2A913e447d6b4BF33EFbec43aAeF87890FBbc", // USDC - "0x5DE1677344D3Cb0D7D465c10b72A8f60699C062d", // USDT + ADDRESSES.boba.DAI, + ADDRESSES.boba.USDC, + ADDRESSES.boba.USDT, // "0x6B4712AE9797C199edd44F897cA09BC57628a1CF", // nusd ] }, @@ -232,14 +233,14 @@ module.exports = { { pool: '0x09fec30669d63a13c666d2129230dd5588e2e240', tokens: [ - "0x420000000000000000000000000000000000000a", // weth + ADDRESSES.metis.WETH, // "0x931b8f17764362a3325d30681009f0edd6211231", // neth ] }, { pool: '0x555982d2E211745b96736665e19D9308B615F78e', tokens: [ - "0xea32a96608495e54156ae48931a7c20f0dcc1a21", // USDC + ADDRESSES.metis.m_USDC, // "0x961318fc85475e125b99cc9215f62679ae5200ab", // nusd ] }, @@ -251,32 +252,32 @@ module.exports = { bridge: { address: '0x6F4e8eBa4D337f874Ab57478AcC2Cb5BACdc19c9', tokens: [ - '0xfc5a1a6eb076a2c7ad06ed22c90d7e710e35ad0a', + ADDRESSES.arbitrum.GMX, ] }, pools: [ { pool: '0xa067668661C84476aFcDc6fA5D758C4c01C34352', tokens: [ - "0x82af49447d8a07e3bd95bd0d56f35241523fbab1", // weth + ADDRESSES.arbitrum.WETH, // "0x3ea9b0ab55f34fb188824ee288ceaefc63cf908e", // neth ] }, { pool: '0x9Dd329F5411466d9e0C488fF72519CA9fEf0cb40', tokens: [ - "0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9", // USDT - "0xff970a61a04b1ca14834a43f5de4533ebddb5cc8", // USDC - // "0x2913e812cf0dcca30fb28e6cac3d2dcff4497688", // nusd + ADDRESSES.arbitrum.USDT, + ADDRESSES.arbitrum.USDC, + // ADDRESSES.arbitrum.nUSD, // nusd ] }, { pool: '0x0Db3FE3B770c95A0B99D1Ed6F2627933466c0Dd8', tokens: [ - "0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9", // USDT - "0xff970a61a04b1ca14834a43f5de4533ebddb5cc8", // USDC - "0xfea7a6a0b346362bf88a9e4a88416b77a57d6c2a", // MIM - // "0x2913e812cf0dcca30fb28e6cac3d2dcff4497688", // nusd + ADDRESSES.arbitrum.USDT, + ADDRESSES.arbitrum.USDC, + ADDRESSES.arbitrum.MIM, + // ADDRESSES.arbitrum.nUSD, // nusd ] }, ] @@ -293,9 +294,9 @@ module.exports = { { pool: '0xcEf6C2e20898C2604886b888552CA6CcF66933B0', tokens: [ - "0xB12BFcA5A55806AaF64E99521918A4bf0fC40802", // USDC - "0x4988a896b1227218e4A686fdE5EabdcAbd91571f", // USDT - // "0x07379565cD8B0CaE7c60Dc78e7f601b34AF2A21c", // nusd + ADDRESSES.aurora.USDC_e, + ADDRESSES.aurora.USDT_e, + // ADDRESSES.aurora.nUSD, // nusd ] }, ] @@ -306,8 +307,8 @@ module.exports = { bridge: { address: '0xAf41a65F786339e7911F4acDAD6BD49426F2Dc6b', tokens: [ - '0x72cb10c6bfa5624dd07ef608027e366bd690048f', // JEWEL - '0xa9ce83507d872c5e1273e745abcfda849daa654f', // xJEWEL + ADDRESSES.harmony.JEWEL, + ADDRESSES.harmony.xJEWEL, '0x24eA0D436d3c2602fbfEfBe6a16bBc304C963D04', // DFKTEARS ] }, @@ -322,16 +323,16 @@ module.exports = { ] }, { - pool: '0x2913E812Cf0dcCA30FB28E6Cac3d2DCFF4497688', + pool: ADDRESSES.arbitrum.nUSD, tokens: [ "0x6983d1e6def3690c4d616b13597a09e6193ea013", // 1ETH - // "0x0b5740c6b4a97f90ef2f0220651cca420b868ffb", // neth + // ADDRESSES.optimism.gOHM, // neth ] }, { pool: '0x00A4F57D926781f62D09bb05ec76e6D8aE4268da', tokens: [ - "0xb12c13e66ade1f72f71834f2fc5082db8c091358", // avax + ADDRESSES.harmony.AVAX, // "???", // synAvax ] }, @@ -357,6 +358,38 @@ module.exports = { ] }, } + }, + canto: { + tvl: { + bridge: { + address: '0xDde5BEC4815E1CeCf336fb973Ca578e8D83606E0', + tokens: [ + ] + }, + pools: [ + { + pool: ADDRESSES.aurora.nUSD, + tokens: [ + ADDRESSES.canto.NOTE, + // "0xd8836af2e565d3befce7d906af63ee45a57e8f80", // nUSD + ] + }, + { + pool: '0x273508478e099Fdf953349e6B3704E7c3dEE91a5', + tokens: [ + ADDRESSES.functionx.WFX, + // "0xd8836af2e565d3befce7d906af63ee45a57e8f80", // nusd + ] + }, + { + pool: '0xF60F88bA0CB381b8D8A662744fF93486273c22F9', + tokens: [ + ADDRESSES.functionx.PURSE, + // "0x09fec30669d63a13c666d2129230dd5588e2e240", // nETH + ] + }, + ] + } }, klaytn: { tvl: { @@ -376,7 +409,7 @@ module.exports = { pool: '0xfdbad1699a550f933efebf652a735f2f89d3833c', tokens: [ "0xd6dab4cff47df175349e6e7ee2bf7c40bb8c05a3", // USDT - "0xcee8faf64bb97a73bb51e115aa89c17ffa8dd167", // o.USDT + ADDRESSES.klaytn.oUSDT, ] }, ] diff --git a/projects/synapse/index.js b/projects/synapse/index.js index 214b382bd75..d5a5ed90fce 100644 --- a/projects/synapse/index.js +++ b/projects/synapse/index.js @@ -1,10 +1,11 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens, } = require("../helper/unwrapLPs") -const { sumSingleBalance, TOKEN_LIST, getDenomBalance, } = require('../helper/chain/terra') +const { sumTokens: sumTokensCosmos, } = require('../helper/chain/cosmos') const sdk = require("@defillama/sdk") const { getChainTransform, getFixBalances } = require("../helper/portedTokens") const config = require("./config") -const nullAddress = '0x0000000000000000000000000000000000000000' +const nullAddress = ADDRESSES.null Object.keys(config).forEach(chain => { const chainExport = { @@ -45,10 +46,7 @@ module.exports.ethereum.pool2 = async (ts, block) => { module.exports.terra = {} module.exports.terra.tvl = async (timestamp, ethBlock, { terra: block }) => { - const balances = {} - const balance = await getDenomBalance('uusd', 'terra1qwzdua7928ugklpytdzhua92gnkxp9z4vhelq8', block) - sumSingleBalance(balances, TOKEN_LIST.terrausd, balance) - return balances + return sumTokensCosmos({ owner: 'terra1qwzdua7928ugklpytdzhua92gnkxp9z4vhelq8', chain: 'terra'}) } module.exports.hallmarks = [ [1651881600, "UST depeg"], diff --git a/projects/syncdex-finance/index.js b/projects/syncdex-finance/index.js new file mode 100644 index 00000000000..e84840811ec --- /dev/null +++ b/projects/syncdex-finance/index.js @@ -0,0 +1,8 @@ +module.exports = { + era: { + hallmarks: [ + [1681340401,"Rug Pull"] + ], + tvl: () => 0, + }, +}; \ No newline at end of file diff --git a/projects/syncnetwork/abi.json b/projects/syncnetwork/abi.json index 7f9696570a4..c34954a68ac 100644 --- a/projects/syncnetwork/abi.json +++ b/projects/syncnetwork/abi.json @@ -1,44 +1,6 @@ { - "getReserves": { - "constant": true, - "inputs": [], - "name": "getReserves", - "outputs": [ - { "internalType": "uint112", "name": "_reserve0", "type": "uint112" }, - { "internalType": "uint112", "name": "_reserve1", "type": "uint112" }, - { - "internalType": "uint32", - "name": "_blockTimestampLast", - "type": "uint32" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "token0": { - "constant": true, - "inputs": [], - "name": "token0", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "token1": { - "constant": true, - "inputs": [], - "name": "token1", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "totalSYNCLocked": { - "inputs": [], - "name": "totalSYNCLocked", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - } -} + "getReserves": "function getReserves() view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast)", + "token0": "address:token0", + "token1": "address:token1", + "totalSYNCLocked": "uint256:totalSYNCLocked" +} \ No newline at end of file diff --git a/projects/syncswap/index.js b/projects/syncswap/index.js new file mode 100644 index 00000000000..8b76cdcb786 --- /dev/null +++ b/projects/syncswap/index.js @@ -0,0 +1,43 @@ +const { getLogs } = require('../helper/cache/getLogs') +const { transformDexBalances } = require('../helper/portedTokens') +const sdk = require('@defillama/sdk') + +async function tvl(timestamp, ethBlock, chainBlocks, { api }) { + const { fromBlock, stableFactory, classicFactory, } = config[api.chain] + const stableLogs = await getFactoryLogs(api, stableFactory) + const classicLogs = await getFactoryLogs(api, classicFactory) + const balances = {} + const data = [] + const stableReserves = await api.multiCall({ abi: 'function getReserves() external view returns (uint, uint)', calls: stableLogs.map(i => i.pool) }) + const classicReserves = await api.multiCall({ abi: 'function getReserves() external view returns (uint, uint)', calls: classicLogs.map(i => i.pool) }) + stableReserves.forEach(([reserve0, reserve1], i) => { + sdk.util.sumSingleBalance(balances, stableLogs[i].token0, reserve0) + sdk.util.sumSingleBalance(balances, stableLogs[i].token1, reserve1) + }) + classicReserves.forEach(([token0Bal, token1Bal], i) => { + data.push({ token0Bal, token1Bal, token0: classicLogs[i].token0, token1: classicLogs[i].token1, }) + }) + return transformDexBalances({ balances, data, chain: api.chain }) + + async function getFactoryLogs(api, factory) { + return getLogs({ + api, + target: factory, + fromBlock, + topic: 'PoolCreated(address,address,address)', + eventAbi: 'event PoolCreated(address indexed token0, address indexed token1, address pool)', + onlyArgs: true, + }) + } +} + +const config = { + era: { fromBlock: 9775, stableFactory: '0x5b9f21d407F35b10CbfDDca17D5D84b129356ea3', classicFactory: '0xf2DAd89f2788a8CD54625C60b55cD3d2D0ACa7Cb', }, + linea: { fromBlock: 716, stableFactory: '0xE4CF807E351b56720B17A59094179e7Ed9dD3727', classicFactory: '0x37BAc764494c8db4e54BDE72f6965beA9fa0AC2d', }, +} + +module.exports = { + misrepresentedTokens: true, +} + +Object.keys(config).forEach(chain => { module.exports[chain] = { tvl } }) diff --git a/projects/synfutures-v1/index.js b/projects/synfutures-v1/index.js index 59bea27f05e..0fd6498c917 100644 --- a/projects/synfutures-v1/index.js +++ b/projects/synfutures-v1/index.js @@ -1,62 +1,29 @@ -// SynFutures-v1 TVL from chain -const { request, gql } = require("graphql-request"); const { sumTokens2 } = require('../helper/unwrapLPs') +const { getLogs, getAddress } = require('../helper/cache/getLogs'); -const QUERY_PAIRS = gql`{ - pairs(first: 1000, where: {state_: {status_not_in: [CREATED]}}) { - id - symbol - ammProxy - futuresProxy - quote { - id - symbol - decimals - } - state{ - status - } - } -}`; - -const info = { - ethereum: { - subgraph: 'https://api.thegraph.com/subgraphs/name/synfutures/ethereum-v1', - }, - bsc: { - subgraph: 'https://api.thegraph.com/subgraphs/name/synfutures/bsc-v1', - }, - polygon: { - subgraph: 'https://api.thegraph.com/subgraphs/name/synfutures/polygon-v1', - }, - arbitrum: { - subgraph: 'https://api.thegraph.com/subgraphs/name/synfutures/arbitrum-one-v1', - }, +const config = { + ethereum: { factory: '0x6e893ddfa75d67febb853e00f81c913c151bf9a9', fromBlock: 12599579 }, + bsc: { factory: '0x6e893ddfa75d67febb853e00f81c913c151bf9a9', fromBlock: 8142455 }, + arbitrum: { factory: '0x1e7db497d664e77fc96321a1ad0bf018e55cbff8', fromBlock: 218877 }, + polygon: { factory: '0x6e893ddfa75d67febb853e00f81c913c151bf9a9', fromBlock: 15508720 }, } -function chainTvl(chain) { - return async (_, _b, {[chain]: block}) => { - const pairsData = await request(info[chain].subgraph,QUERY_PAIRS,{ block }); - const toa = [] - - for (let pair of pairsData.pairs) - toa.push([pair.quote.id, pair.id]) - return sumTokens2({ chain, block, tokensAndOwners: toa, }) +Object.keys(config).forEach(chain => { + const { factory, fromBlock, } = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const logs = await getLogs({ + api, + target: factory, + topics: ['0xee193dabd87eb415480c4b61fae32c09068f2348d08b811bbf3a004404eae51b'], + fromBlock, + }) + const tokensAndOwners = logs.map((i) => { + const token = getAddress(i.data.slice(64, 64 * 2 + 2)); + const pool = getAddress(i.data.slice(64 * 5, 64 * 6 + 2)); + return [token, pool]; + }); + return sumTokens2({ tokensAndOwners, api, }) + } } -} - -module.exports = { - timetravel: false, - polygon: { - tvl: chainTvl('polygon'), - }, - bsc: { - tvl: chainTvl('bsc'), - }, - ethereum: { - tvl: chainTvl('ethereum'), - }, - arbitrum: { - tvl: chainTvl('arbitrum'), - }, -} \ No newline at end of file +}) \ No newline at end of file diff --git a/projects/synfutures-v2/index.js b/projects/synfutures-v2/index.js new file mode 100644 index 00000000000..be1e4a63a06 --- /dev/null +++ b/projects/synfutures-v2/index.js @@ -0,0 +1,26 @@ +const { sumTokens2 } = require('../helper/unwrapLPs') +const { getLogs, getAddress } = require('../helper/cache/getLogs'); + +const config = { + polygon: { factory: '0x1267c6e5d4048318ae48f936130c292e2e0edd73', fromBlock: 32799818 }, +} + +Object.keys(config).forEach(chain => { + const { factory, fromBlock, } = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const logs = await getLogs({ + api, + target: factory, + topics: ['0x3e54f626b503b6952f636f8f05b35a3a2c6345dd88a99285dede80fc89961706'], + fromBlock, + }) + const tokensAndOwners = logs.map((i) => { + const token = getAddress(i.data.slice(0, 64 + 2)); + const pool = getAddress(i.data.slice(64 * 3, 64 * 4 + 2)); + return [token, pool]; + }); + return sumTokens2({ tokensAndOwners, api, }) + } + } +}) \ No newline at end of file diff --git a/projects/synthetix-v1/index.js b/projects/synthetix-v1/index.js new file mode 100644 index 00000000000..641a297b340 --- /dev/null +++ b/projects/synthetix-v1/index.js @@ -0,0 +1,7 @@ +const {getExports} = require('../helper/heroku-api') +const chains = ['ethereum'] + +module.exports = { + timetravel: false, + ...getExports("synthetix", chains) +} diff --git a/projects/synthetix-v2/index.js b/projects/synthetix-v2/index.js new file mode 100644 index 00000000000..a3af239c1a7 --- /dev/null +++ b/projects/synthetix-v2/index.js @@ -0,0 +1,7 @@ +const {getExports} = require('../helper/heroku-api') +const chains = ['optimism'] + +module.exports = { + timetravel: false, + ...getExports("synthetix", chains) +} diff --git a/projects/synthetix/abi.json b/projects/synthetix/abi.json index 8a766c1439a..ec84e10270a 100644 --- a/projects/synthetix/abi.json +++ b/projects/synthetix/abi.json @@ -1,71 +1,6 @@ { - "issuanceRatio": { - "constant":true, - "inputs":[ - - ], - "name":"issuanceRatio", - "outputs":[ - { - "name":"", - "type":"uint256" - } - ], - "payable":false, - "stateMutability":"view", - "type":"function" - }, - "collateralisationRatio": { - "constant":true, - "inputs":[ - { - "name":"issuer", - "type":"address" - } - ], - "name":"collateralisationRatio", - "outputs":[ - { - "name":"", - "type":"uint256" - } - ], - "payable":false, - "stateMutability":"view", - "type":"function" - }, - "collateral": { - "constant":true, - "inputs":[ - { - "name":"account", - "type":"address" - } - ], - "name":"collateral", - "outputs":[ - { - "name":"", - "type":"uint256" - } - ], - "payable":false, - "stateMutability":"view", - "type":"function" - }, - "totalSupply": { - "constant":true, - "inputs":[ - ], - "name":"totalSupply", - "outputs":[ - { - "name":"", - "type":"uint256" - } - ], - "payable":false, - "stateMutability":"view", - "type":"function" - } + "issuanceRatio": "uint256:issuanceRatio", + "collateralisationRatio": "function collateralisationRatio(address issuer) view returns (uint256)", + "collateral": "function collateral(address account) view returns (uint256)", + "totalSupply": "uint256:totalSupply" } \ No newline at end of file diff --git a/projects/synthetix/api.js b/projects/synthetix/api.js index 3b081cc87cb..1850690eed1 100644 --- a/projects/synthetix/api.js +++ b/projects/synthetix/api.js @@ -1,7 +1,8 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk'); const BigNumber = require('bignumber.js'); const abi = require('./abi.json'); -const { getBlock } = require('../helper/getBlock'); +const { getBlock } = require('../helper/http'); const { requery } = require('../helper/requery'); const { sliceIntoChunks, } = require('../helper/utils'); const { request, gql } = require("graphql-request"); @@ -21,7 +22,7 @@ const synthetixStates = { optimism: '0x8377b25B8564f6Be579865639776c5082CB37163' // It's Issuer, not SynthetixState but has the same issuanceRatio function } const synthetixs = { - ethereum: '0xC011a73ee8576Fb46F5E1c5751cA3B9Fe0af2a6F', + ethereum: ADDRESSES.ethereum.SNX, optimism: '0x8700daec35af8ff88c16bdf0418774cb3d7599b4' } const snxGraphEndpoints = { @@ -29,7 +30,7 @@ const snxGraphEndpoints = { optimism: 'https://api.thegraph.com/subgraphs/name/0xngmi/snx-lite-optimism-regenesis' } const ethStaking = "0xc1aae9d18bbe386b102435a8632c8063d31e747c" -const weth = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2" +const weth = ADDRESSES.ethereum.WETH function chainTvl(chain) { return async (timestamp, ethBlock, chainBlocks) => { @@ -41,7 +42,7 @@ function chainTvl(chain) { let totalTopStakersSNX = new BigNumber(0); const holdersAll = sliceIntoChunks(await SNXHolders(snxGraphEndpoint, block, chain), 5000) - console.log('holders count: ', holdersAll.flat().length, chain) + sdk.log('holders count: ', holdersAll.flat().length, chain) const issuanceRatio = (await sdk.api.abi.call({ block, @@ -53,7 +54,7 @@ function chainTvl(chain) { let i = 0 for (const holders of holdersAll) { - console.log('fetching %s of %s', ++i, holdersAll.length) + sdk.log('fetching %s of %s', ++i, holdersAll.length) const calls = holders.map(holder => ({ target: synthetix, params: holder })) const [ratio, collateral] = await Promise.all([ @@ -98,7 +99,6 @@ function chainTvl(chain) { abi: abi['totalSupply'] })).output; - //console.log(unformattedSnxTotalSupply, new BigNumber(unformattedSnxTotalSupply).div(Math.pow(10, 18))) const snxTotalSupply = parseInt(new BigNumber(unformattedSnxTotalSupply).div(Math.pow(10, 18))); const totalSNXLocked = percentLocked.times(snxTotalSupply); diff --git a/projects/synthetix/apiCache.js b/projects/synthetix/apiCache.js index 7826fe78a55..735e61a8fd1 100644 --- a/projects/synthetix/apiCache.js +++ b/projects/synthetix/apiCache.js @@ -1,12 +1,13 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk'); const BigNumber = require('bignumber.js'); const abi = require('./abi.json'); -const { getBlock } = require('../helper/getBlock'); +const { getBlock } = require('../helper/http'); const { requery } = require('../helper/requery'); const { sliceIntoChunks, } = require('../helper/utils'); const { getCache, setCache } = require('../helper/cache'); const { request, gql } = require("graphql-request"); -const project = 'synthetix' +const project = 'bulky/synthetix' const { log } = require('../helper/utils') const QUERY_NO_BLOCK = gql` @@ -24,7 +25,7 @@ const synthetixStates = { optimism: '0x8377b25B8564f6Be579865639776c5082CB37163' // It's Issuer, not SynthetixState but has the same issuanceRatio function } const synthetixs = { - ethereum: '0xC011a73ee8576Fb46F5E1c5751cA3B9Fe0af2a6F', + ethereum: ADDRESSES.ethereum.SNX, optimism: '0x8700daec35af8ff88c16bdf0418774cb3d7599b4' } const snxGraphEndpoints = { @@ -32,7 +33,7 @@ const snxGraphEndpoints = { optimism: 'https://api.thegraph.com/subgraphs/name/0xngmi/snx-lite-optimism-regenesis' } const ethStaking = "0xc1aae9d18bbe386b102435a8632c8063d31e747c" -const weth = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2" +const weth = ADDRESSES.ethereum.WETH function chainTvl(chain) { return async (timestamp, ethBlock, chainBlocks) => { @@ -43,7 +44,7 @@ function chainTvl(chain) { let totalTopStakersSNXLocked = new BigNumber(0); let totalTopStakersSNX = new BigNumber(0); - const holdersAll = sliceIntoChunks(await SNXHolders(snxGraphEndpoint, block, chain), 5000) + const holdersAll = sliceIntoChunks(await SNXHolders(snxGraphEndpoint, block, chain), 500) log('holders count: ', holdersAll.flat().length, chain) const issuanceRatio = (await sdk.api.abi.call({ @@ -124,7 +125,7 @@ function chainTvl(chain) { // Uses graph protocol to run through SNX contract. Since there is a limit of 1000 results per query // we can use graph-results-pager library to increase the limit. async function SNXHolders(snxGraphEndpoint, block, chain) { - const cache = getCache(project, chain) + const cache = await getCache(project, chain) if (!cache.data) cache.data = [] let holders = new Set(cache.data) let lastID = cache.lastID || "" @@ -143,7 +144,7 @@ async function SNXHolders(snxGraphEndpoint, block, chain) { if (lastID) cache.lastID = lastID } while (lastID); cache.data = Array.from(holders) - setCache(project, chain, cache) + await setCache(project, chain, cache) return cache.data } diff --git a/projects/synthex/index.js b/projects/synthex/index.js new file mode 100644 index 00000000000..88364890f12 --- /dev/null +++ b/projects/synthex/index.js @@ -0,0 +1,28 @@ +const ADDRESSES = require('../helper/coreAssets.json') + +const { sumTokensExport } = require("../helper/unwrapLPs"); +const poolC = '0x8d6E834277E4f513BacF83B0A87524c913eF8691'; +const poolF = "0x0546458d110Dff9D394C0F4621423Bc8f009A779"; +const USDC = ADDRESSES.arbitrum.USDC; +const WBTC = ADDRESSES.arbitrum.WBTC; +const ARB = ADDRESSES.arbitrum.ARB; +const ETH = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE"; +const WETH = ADDRESSES.arbitrum.WETH; +const USDT = ADDRESSES.arbitrum.USDT; +const DAI = ADDRESSES.optimism.DAI; + + +module.exports = { + methodology: "counts value of assets in the PoolC and PoolF", + start: 82762407, + arbitrum: { + tvl: sumTokensExport({ + ownerTokens: [ + [[USDC, WBTC, ARB, ETH, WETH], poolC], + [[USDC, DAI, USDT], poolF], + ] + }), + }, +}; + + diff --git a/projects/synthswap/index.js b/projects/synthswap/index.js new file mode 100644 index 00000000000..8e3d38af7da --- /dev/null +++ b/projects/synthswap/index.js @@ -0,0 +1,21 @@ +const { getUniTVL, sumTokensExport } = require('../helper/unknownTokens') +const SYNTH = "0xbd2DBb8eceA9743CA5B16423b4eAa26bDcfE5eD2"; +const FACTORY = "0x4bd16d59A5E1E0DB903F724aa9d721a31d7D720D" + + +const dexTVL = getUniTVL({ factory: FACTORY, useDefaultCoreAssets: true }) + + +module.exports = { + misrepresentedTokens: true, + methodology: `Uses factory(${FACTORY}) address and whitelisted tokens address to find and price Liquidity Pool pairs.`, + base: { + tvl: dexTVL, + staking: sumTokensExport({ + owners: ['0x01CC6b33c63CeE896521D63451896C14D42D05Ea'], + tokens: [SYNTH], + }) + } +}; + + diff --git a/projects/syrupfinance/index.js b/projects/syrupfinance/index.js new file mode 100644 index 00000000000..d053dd47524 --- /dev/null +++ b/projects/syrupfinance/index.js @@ -0,0 +1,19 @@ +const { staking } = require("../helper/staking"); +const { gmxExports } = require("../helper/gmx"); + +//bsc +const bscVault = "0x47E3d600C6A58f262Bc6C0159D2C9cA75aaE12D0"; +const bscStaking = "0x024CcD75EF4f772a3431e444c42Ee99452Afca01"; +const srxToken = "0xdef49c195099e30e41b2df7dad55e0bbbe60a0c5"; + + +module.exports = { + hallmarks: [ + [1675209600, "Rug Pull"] + ], + bsc: { + staking: staking(bscStaking, srxToken, "bsc", undefined, undefined), + tvl: gmxExports({ vault: bscVault }) + } + +}; \ No newline at end of file diff --git a/projects/t-protocol/index.js b/projects/t-protocol/index.js new file mode 100644 index 00000000000..dad6f75eeae --- /dev/null +++ b/projects/t-protocol/index.js @@ -0,0 +1,14 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require("../helper/unwrapLPs"); + +const USDC_TOKEN_CONTRACT = ADDRESSES.ethereum.USDC; +const TREASURY_CONTRACT = "0xa01D9bc8343016C7DDD39852e49890a8361B2884"; +const STBT = '0x530824DA86689C9C17CdC2871Ff29B058345b44a' + +module.exports = { + methodology: "counts value of assets in the Treasury", + start: 1677913260, + ethereum: { + tvl: sumTokensExport({ owner: TREASURY_CONTRACT, tokens: [USDC_TOKEN_CONTRACT, STBT] }), + }, +}; diff --git a/projects/tai-money/index.js b/projects/tai-money/index.js new file mode 100644 index 00000000000..8691301bbc2 --- /dev/null +++ b/projects/tai-money/index.js @@ -0,0 +1,31 @@ +const { sumTokens2 } = require('../helper/unwrapLPs'); + +const config = { + ethereum: { + coinJoins: { + "GEB_JOIN_ETH_A": "0xf6c35af06ed2d97f62b31d7030370f8ae33bd3b1", + "GEB_JOIN_ETH_B": "0xa822e24f944127f445d8ad30adcddd721a5616e9", + "GEB_JOIN_ETH_C": "0x793a0de4db6f96cf30d371ef28278496b66223f8", + "GEB_JOIN_WSTETH_A": "0x5d527c9641effeb3802f2ffafdd15a1b95e41c8c", + "GEB_JOIN_WSTETH_B": "0x9e240daf92dd0edf903def1ff1dd036ca447aaf7", + "GEB_JOIN_RETH_A": "0xf4e8267f05cf1ead340ac7f2bff343528526f16b", + "GEB_JOIN_RETH_B": "0x7daedd26e1202897c9c6bf3967fb5ae45616aef5", + "GEB_JOIN_RAI_A": "0x67b97de3f10ad081fbddf36099699d5ab488828e", + "GEB_JOIN_CBETH_A": "0x10ff8d4376798f920fae147f109157fa6b9a985b", + "GEB_JOIN_CBETH_B": "0xb4941d2a62421adc6ce939cb466f884535bfbff9", + }, + }, +} + +module.exports = {} + +Object.keys(config).forEach(chain => { + let { coinJoins } = config[chain] + coinJoins = Object.values(coinJoins) + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const tokens = await api.multiCall({ abi: 'address:collateral', calls: coinJoins }) + return sumTokens2({ api, tokensAndOwners2: [tokens, coinJoins]}) + } + } +}) \ No newline at end of file diff --git a/projects/taichi/index.js b/projects/taichi/index.js index 7c3e1539cc3..daeb79d21d4 100644 --- a/projects/taichi/index.js +++ b/projects/taichi/index.js @@ -1,13 +1,17 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { ohmTvl } = require('../helper/ohm') const treasury = "0xD4b0DC48AB6BD7907E3698A62CCD1DBE2d46d310" module.exports = { + hallmarks: [ + [1648765747,"Rug Pull"] + ], deadFrom: 1648765747, ...ohmTvl(treasury, [ //BUSD - ["0xe9e7cea3dedca5984780bafc599bd69add087d56", false], + [ADDRESSES.bsc.BUSD, false], //WBNB - ["0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c", false], + [ADDRESSES.bsc.WBNB, false], //pancakeswap LP ["0x5ef473d91e89c613b3e5138fa8279884bf5b7adf", true], ], "bsc", "0xb12Ef3033D5CE0F3f80f3A15dE7E90Cd87a5973e", "0xe49bfc53a195a62d78a941a1967d7b0f83a47c14") diff --git a/projects/taiga/api.js b/projects/taiga/api.js index 9ef534269b8..28453b13529 100644 --- a/projects/taiga/api.js +++ b/projects/taiga/api.js @@ -32,6 +32,5 @@ module.exports = { async function balanceOf(api, account, token) { const currencyId = await forceToCurrencyId(api, token) const tokenRes = await api.query.tokens.accounts(account, currencyId) - // console.log(token, Math.floor(+tokenRes.toHuman().free.replaceAll(',', ''))) return +tokenRes.toHuman().free.replace(/,/g, '') } diff --git a/projects/talentprotocol/index.js b/projects/talentprotocol/index.js index 5b9daa817e5..4ce8d9ea7b6 100644 --- a/projects/talentprotocol/index.js +++ b/projects/talentprotocol/index.js @@ -1,6 +1,7 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk') -const cUSDTokenAddress = "0x765DE816845861e75A25fCA122bb6898B8B1282a" +const cUSDTokenAddress = ADDRESSES.celo.cUSD const stakingContract = "0x8ea91a982d93836415CE3abbaf12d59fb8cE3Ff8" diff --git a/projects/tangent-protocol/index.js b/projects/tangent-protocol/index.js new file mode 100644 index 00000000000..235771d647d --- /dev/null +++ b/projects/tangent-protocol/index.js @@ -0,0 +1,8 @@ +const { sumTokensExport } = require('../helper/chain/cardano') + +module.exports = { + cardano: { + tvl: () => 0, + staking: sumTokensExport({ owner: 'addr1q92f5qddkudgq6sna3qfsqrwnk9253gv4qwmfw735xvluhrsqycc2x23z60333ktgjrrufgv8xh2gnxr4m6av63jkassawurfj'}), + }, +}; \ No newline at end of file diff --git a/projects/tangent/index.js b/projects/tangent/index.js index 8a79817c1f2..caba1759064 100644 --- a/projects/tangent/index.js +++ b/projects/tangent/index.js @@ -1,13 +1,10 @@ const { default: axios } = require('axios'); -async function fetch(){ - +async function fetch() { return (await axios.get('https://api.tangent.bar/api/v1/MainStatistics')).data.allTVL - - } module.exports = { methodology: "Data is retrieved from the api at https://api.tangent.bar/", timetravel: false, - fetch + fetch: () => 0 } diff --git a/projects/tangible/abi.js b/projects/tangible/abi.js index 054205bc0e6..01f5e4cfdb3 100644 --- a/projects/tangible/abi.js +++ b/projects/tangible/abi.js @@ -1,235 +1,10 @@ module.exports = { - - apGetAddress: { - "inputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "name": "getAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - getPriceManager: { - "inputs": [], - "name": "priceManager", - "outputs": [ - { - "internalType": "contract ITangiblePriceManager", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - getCategories: { - "inputs": [], - "name": "getCategories", - "outputs": [ - { - "internalType": "contract ITangibleNFT[]", - "name": "", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - getTreasuryValue: { - "inputs": [], - "name": "getTreasuryValue", - "outputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "stable", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "usdr", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "rwa", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "tngbl", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "liquidity", - "type": "uint256" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "tngbl", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "underlying", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "liquidity", - "type": "uint256" - } - ], - "internalType": "struct ITreasury.TNGBLLiquidity", - "name": "tngblLiquidity", - "type": "tuple" - }, - { - "internalType": "uint256", - "name": "debt", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "total", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "rwaVaults", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "rwaEscrow", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "rwaValueNotLatest", - "type": "bool" - } - ], - "internalType": "struct ITreasury.TreasuryValue", - "name": "value", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - getTotalSupply: { - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - getTokenByIndex: { - "inputs": [ - { - "internalType": "uint256", - "name": "index", - "type": "uint256" - } - ], - "name": "tokenByIndex", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - getTnftCustody: { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "tnftCustody", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - getItemPriceBatchTokenIds: { - "inputs": [ - { - "internalType": "contract ITangibleNFT", - "name": "nft", - "type": "address" - }, - { - "internalType": "contract IERC20Metadata", - "name": "paymentUSDToken", - "type": "address" - }, - { - "internalType": "uint256[]", - "name": "tokenIds", - "type": "uint256[]" - } - ], - "name": "itemPriceBatchTokenIds", - "outputs": [ - { - "internalType": "uint256[]", - "name": "weSellAt", - "type": "uint256[]" - }, - { - "internalType": "uint256[]", - "name": "weSellAtStock", - "type": "uint256[]" - }, - { - "internalType": "uint256[]", - "name": "weBuyAt", - "type": "uint256[]" - }, - { - "internalType": "uint256[]", - "name": "weBuyAtStock", - "type": "uint256[]" - }, - { - "internalType": "uint256[]", - "name": "lockedAmount", - "type": "uint256[]" - } - ], - "stateMutability": "view", - "type": "function" - }, + apGetAddress: "function getAddress(bytes32) view returns (address)", + getPriceManager: "address:priceManager", + getCategories: "address[]:getCategories", + getTreasuryValue: "function getTreasuryValue() view returns (tuple(uint256 stable, uint256 usdr, uint256 rwa, uint256 tngbl, uint256 liquidity, tuple(uint256 tngbl, uint256 underlying, uint256 liquidity) tngblLiquidity, uint256 debt, uint256 total, uint256 rwaVaults, uint256 rwaEscrow, bool rwaValueNotLatest) value)", + getTotalSupply: "uint256:totalSupply", + getTokenByIndex: "function tokenByIndex(uint256 index) view returns (uint256)", + getTnftCustody: "function tnftCustody(uint256) view returns (bool)", + getItemPriceBatchTokenIds: "function itemPriceBatchTokenIds(address nft, address paymentUSDToken, uint256[] tokenIds) view returns (uint256[] weSellAt, uint256[] weSellAtStock, uint256[] weBuyAt, uint256[] weBuyAtStock, uint256[] lockedAmount)", } \ No newline at end of file diff --git a/projects/tarina/index.js b/projects/tarina/index.js index a053e1dc091..e775fadf04d 100644 --- a/projects/tarina/index.js +++ b/projects/tarina/index.js @@ -2,10 +2,7 @@ const {uniTvlExport} = require('../helper/calculateUniTvl.js') module.exports = { misrepresentedTokens: true, - doublecounted: false, - timetravel: true, - incentivized: true, avax:{ - tvl: uniTvlExport("0xb334a709dd2146caced08e698c05d4d22e2ac046", "avax"), + tvl: uniTvlExport("0xb334a709dd2146caced08e698c05d4d22e2ac046", "avax", undefined, undefined, { useDefaultCoreAssets: true, hasStablePools: true, }), } } \ No newline at end of file diff --git a/projects/tarot/abi.js b/projects/tarot/abi.js index e7590ae38fd..7b3b149d5c6 100644 --- a/projects/tarot/abi.js +++ b/projects/tarot/abi.js @@ -1,110 +1,7 @@ module.exports = { - - allLendingPools: { - "constant": true, - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "allLendingPools", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - allLendingPoolsLength: { - "constant": true, - "inputs": [], - "name": "allLendingPoolsLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - getLendingPool: { - "constant": true, - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "getLendingPool", - "outputs": [ - { - "internalType": "bool", - "name": "initialized", - "type": "bool" - }, - { - "internalType": "uint24", - "name": "lendingPoolId", - "type": "uint24" - }, - { - "internalType": "address", - "name": "collateral", - "type": "address" - }, - { - "internalType": "address", - "name": "borrowable0", - "type": "address" - }, - { - "internalType": "address", - "name": "borrowable1", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - underlying: { - "constant": true, - "inputs": [], - "name": "underlying", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - totalBorrows: { - "constant": true, - "inputs": [], - "name": "totalBorrows", - "outputs": [ - { - "internalType": "uint112", - "name": "", - "type": "uint112" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, + allLendingPools: "function allLendingPools(uint256) view returns (address)", + allLendingPoolsLength: "uint256:allLendingPoolsLength", + getLendingPool: "function getLendingPool(address) view returns (bool initialized, uint24 lendingPoolId, address collateral, address borrowable0, address borrowable1)", + underlying: "address:underlying", + totalBorrows: "function totalBorrows() view returns (uint112)", } \ No newline at end of file diff --git a/projects/tarot/index.js b/projects/tarot/index.js index 0cbe3a87c9d..7bdb44c97ed 100644 --- a/projects/tarot/index.js +++ b/projects/tarot/index.js @@ -6,16 +6,66 @@ const config = { '0x35C052bBf8338b06351782A565aa9AaD173432eA', // Tarot Classic '0xF6D943c8904195d0f69Ba03D97c0BAF5bbdCd01B', // Tarot Requiem '0xbF76F858b42bb9B196A87E43235C2f0058CF7322', // Tarot Carcosa + '0xa90092A6bfC100e32777B257AF46B3Ec2675d876', // Tarot Voyager + '0xe034c865299dA16A429DaD26bFf5468C2689F7D8', // Tarot Forever ] }, optimism: { factories: [ '0x1D90fDAc4DD30c3ba38d53f52A884F6e75d0989e', // Tarot Opaline '0xD7cABeF2c1fD77a31c5ba97C724B82d3e25fC83C', // Tarot Velours + '0x49DF1fe24cAf1a7dcBB2E2b1793b93b04eDb62bF', // Tarot Jupiter + '0xBA47316035E6C95b31cb55BfB93458Ad41E4Da04', // Tarot Velouté + ] + }, + arbitrum: { + factories: [ + '0x2217AEC3440E8FD6d49A118B1502e539f88Dba55', // Tarot Galahad + '0x1bbD5637421a83b00C5Cd549B9C3721B28553F80', // Tarot Saurian + '0x4B6daE049A35196A773028B2E835CCcCe9DD4723', // Tarot Ulysses + ] + }, + bsc: { + factories: [ + '0x2217AEC3440E8FD6d49A118B1502e539f88Dba55', // Tarot Bermuda + '0xC20099a3F0728634C1136489074508be7B406d3a', // Tarot Palermo + ] + }, + ethereum: { + factories: [ + '0x1CAfcB9f3B5A152b1553bC2c688BA6a18054b653', // Tarot Eleusis + '0x4B6daE049A35196A773028B2E835CCcCe9DD4723', // Tarot Equinox + ] + }, + kava: { + factories: [ + '0x82B3413D575Aa93806308A04b53c78ae2037dA11', // Tarot Avignon + '0x54950cae3d8513EA041066F31697903de5909F57', // Tarot Orleans + ] + }, + canto: { + factories: [ + '0xb6193DF61351736e5190bF1DEB2E4f0769bd1BF2', // Tarot Cabaret + '0x82B3413D575Aa93806308A04b53c78ae2037dA11', // Tarot Cantata + ] + }, + avax: { + factories: [ + '0x36Df0A76a124d8b2205fA11766eC2eFF8Ce38A35', // Tarot Cascade + ] + }, + polygon: { + factories: [ + '0x36Df0A76a124d8b2205fA11766eC2eFF8Ce38A35', // Tarot Paprika + ] + }, + era: { + factories: [ + '0xf450b51fb2E1e4f05DAf9Cf7D9BB97714540B4f4', // Tarot Zeniths ] }, } module.exports = {} -tarotHelper(module.exports, config) \ No newline at end of file +tarotHelper(module.exports, config) diff --git a/projects/tarot/tarotHelper.js b/projects/tarot/tarotHelper.js index d172819a8bf..370141e73ba 100644 --- a/projects/tarot/tarotHelper.js +++ b/projects/tarot/tarotHelper.js @@ -1,97 +1,86 @@ const abi = require('./abi') -const { getChainTransform } = require('../helper/portedTokens') -const { sumTokens } = require('../helper/unwrapLPs') +const { sumTokens2 } = require('../helper/unwrapLPs') const sdk = require('@defillama/sdk') +const { nullAddress } = require('../helper/tokenMapping') -function tarotHelper(exportsObj, config) { -Object.keys(config).forEach(chain => { - let tvlPromise - const balances = {} - const borrowedBalances = {} - - async function _getTvl(block) { - const { factories } = config[chain] - const transform = await getChainTransform(chain) - const collaterals = [] - const borrowables = [] +function tarotHelper(exportsObj, config, { tarotSymbol = 'vTAROT' } = {}) { + async function tvl(_, _b, _cb, { api, }) { + const { factories } = config[api.chain] + const pools = [] await Promise.all(factories.map(async (factory) => { - const { output: allLendingPoolsLength } = await sdk.api.abi.call({ + const lendingPools = await api.fetchList({ lengthAbi: abi.allLendingPoolsLength, itemAbi: abi.allLendingPools, target: factory }) + + const poolData = await api.multiCall({ target: factory, - abi: abi.allLendingPoolsLength, - chain, block, + abi: abi.getLendingPool, + calls: lendingPools, }) - const poolCalls = [] - for (let i = 0; i < +allLendingPoolsLength; i++) poolCalls.push({ params: i }) - const { output: allLendingPools } = await sdk.api.abi.multiCall({ - target: factory, - abi: abi.allLendingPools, - calls: poolCalls, - chain, block, + poolData.forEach(i => { + pools.push(i.collateral, i.borrowable0, i.borrowable1) }) + })) - const calls2 = allLendingPools.map(i => ({ params: i.output })) + const underlyings = await api.multiCall({ + abi: abi.underlying, + calls: pools, + }) + + const filteredUnderlyings = underlyings.filter(i => i !== nullAddress) + const uSymbols = await api.multiCall({ abi: 'erc20:symbol', calls: filteredUnderlyings }) + const uvTokens = filteredUnderlyings.filter((_, i) => uSymbols[i] === tarotSymbol) + const [uToken, totalBalance] = await Promise.all([ + api.multiCall({ abi: 'address:underlying', calls: uvTokens }), + api.multiCall({ abi: 'uint256:totalBalance', calls: uvTokens }), + ]) - const { output: getLendingPool } = await sdk.api.abi.multiCall({ + const toa = pools.map((v, i) => [underlyings[i], v]) + api.addTokens(uToken, totalBalance) + return sumTokens2({ + api, tokensAndOwners: toa, resolveLP: true, blacklistedTokens: uvTokens, + }) + } + + async function borrowed(_, _b, _cb, { api, }) { + const { factories } = config[api.chain] + const balances = {} + const borrowables = [] + await Promise.all(factories.map(async (factory) => { + const lendingPools = await api.fetchList({ lengthAbi: abi.allLendingPoolsLength, itemAbi: abi.allLendingPools, target: factory }) + + const poolData = await api.multiCall({ target: factory, abi: abi.getLendingPool, - calls: calls2, - chain, block, + calls: lendingPools, }) - getLendingPool.forEach(i => { - collaterals.push(i.output.collateral) - borrowables.push(i.output.borrowable0, i.output.borrowable1) + poolData.forEach(i => { + borrowables.push(i.borrowable0, i.borrowable1) }) })) - const underlyingCalls = [...collaterals, ...borrowables].map(i => ({ target: i })) - const { output: toaInput } = await sdk.api.abi.multiCall({ + const underlyings = await api.multiCall({ abi: abi.underlying, - calls: underlyingCalls, - chain, block, + calls: borrowables, }) - const underlyingMapping = {} - - const toa = toaInput.map(i => [i.output, i.input.target]) - toaInput.forEach(i => underlyingMapping[i.input.target] = i.output) - const { output: borrowed } = await sdk.api.abi.multiCall({ + const borrowed = await api.multiCall({ abi: abi.totalBorrows, - calls: borrowables.map(i => ({ target: i })), - chain, block, + calls: borrowables }) - borrowed.forEach(i => { - sdk.util.sumSingleBalance(borrowedBalances, transform(underlyingMapping[i.input.target]), i.output) + underlyings.forEach((v, i) => { + // Lot of MAI pools have bad debt, ignoring it + if (v.toLowerCase() !== '0xfb98b335551a418cd0737375a2ea0ded62ea213b') { + sdk.util.sumSingleBalance(balances, v, borrowed[i], api.chain) + } }) - - await sumTokens(balances, toa, block, chain, transform, { - resolveLP: true, blacklistedLPs: [ - '0xa5c76fe460128936229f80f651b1deafa37583ae', // evolve in cronos - // '0x1f2bff0e37c592c7de6393c9dd3c0f7933408228', // disabled because _getReserves has a different abi compared to others - '0x357c1b507ef563d342afecd01001f1c0b525e25b', // disabled Error: Returned error: execution reverted: VaultToken: INSUFFICIENT_RESERVES - // '0x526b38991627c509a570ac18a46f7ac7aabc7e4a', // disabled Error: Returned error: execution reverted: VaultToken: INSUFFICIENT_RESERVES - '0x8706dc2067d64651620d66052bc065da1c81327f', // disabled Error: Returned error: execution reverted: VaultToken: INSUFFICIENT_RESERVES - '0x1c669f6caaf59dbfe86e9d8b9fb694d4d06611d5', // disabled Error: Returned error: execution reverted: VaultToken: INSUFFICIENT_RESERVES - '0x6cce00972bff06ec4fed6602bd22f65214e14d1f', // Not a smart contract - '0x9bf544e9e96033d1c8b667824844a40aa6c2132a', // - '0x7eac79383c42bc16e33cd100008ee6d5e491680f', // - ] - }) - return { balances, borrowedBalances } + return balances } - async function getTvl(block) { - if (!tvlPromise) tvlPromise = _getTvl(block) - return tvlPromise - } - - exportsObj[chain] = { - tvl: async (_, _b, { [chain]: block }) => (await getTvl(block)).balances, - borrowed: async (_, _b, { [chain]: block }) => (await getTvl(block)).borrowedBalances, - } -}) + Object.keys(config).forEach(chain => { + exportsObj[chain] = { borrowed, tvl, } + }) } module.exports = { diff --git a/projects/tashi/index.js b/projects/tashi/index.js new file mode 100644 index 00000000000..e08d509c353 --- /dev/null +++ b/projects/tashi/index.js @@ -0,0 +1,7 @@ +const { compoundExports } = require('../helper/compound') +const ADDRESSES = require('../helper/coreAssets.json') + +module.exports = { + methodology: "Same as compound, we just get all the collateral (not borrowed money) on the lending markets", + evmos: compoundExports("0x053841Bd1D291380726a007eA834Ecd296923260", "evmos", "0x1cd248D72248A0618932F77093Dc4ceC9757759d", ADDRESSES.null, undefined, undefined, { fetchBalances: true, }) +} diff --git a/projects/tbtc/index.js b/projects/tbtc/index.js new file mode 100644 index 00000000000..214a888e486 --- /dev/null +++ b/projects/tbtc/index.js @@ -0,0 +1,13 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const sdk = require('@defillama/sdk') + +async function tvl(ts, block) { + return { + [ADDRESSES.ethereum.tBTC]: (await sdk.api.erc20.totalSupply({ target: ADDRESSES.ethereum.tBTC, block })).output + } +} + +module.exports = { + ethereum: { tvl }, + methodology: `TVL for tBTC consists of the BTC deposits in custody that were used to mint tBTC` +} diff --git a/projects/teahouse-v3/abi.json b/projects/teahouse-v3/abi.json new file mode 100644 index 00000000000..b6e21cbcbbb --- /dev/null +++ b/projects/teahouse-v3/abi.json @@ -0,0 +1,4 @@ +{ + "assetToken1": "function assetToken1() view returns (address)", + "estimatedValueIntoken1": "function estimatedValueInToken1() view returns (uint256 value1)" +} diff --git a/projects/teahouse-v3/index.js b/projects/teahouse-v3/index.js new file mode 100644 index 00000000000..25f35be4e02 --- /dev/null +++ b/projects/teahouse-v3/index.js @@ -0,0 +1,40 @@ +const abi = require("./abi.json"); +const { getConfig } = require("../helper/cache"); + +// teahouse public api for vault +const teahouseVaultAPI = "https://vault-content-api.teahouse.finance/vaults"; + +// get vault contract addresses from teahouse api +async function getVaultContractsAddress(chain) { + let plAddress = []; + const { vaults } = await getConfig("teahouse", teahouseVaultAPI); + vaults.forEach((element) => { + // v3 vaults + if (element.isDeFi == true && element.isActive == true) { + if (element.chain === chain) plAddress.push(element.share.address); + } + }); + return plAddress; +} + +const chains = ["ethereum", "optimism", "arbitrum"]; + +chains.forEach((chain) => { + module.exports[chain] = { + tvl: async (_, _b, _cb, { api }) => { + const vaults = await getVaultContractsAddress(chain); + const tokens = await api.multiCall({ + abi: abi.assetToken1, + calls: vaults, + }); + const bals = await api.multiCall({ + abi: abi.estimatedValueIntoken1, + calls: vaults, + }); + api.addTokens(tokens, bals); + return api.getBalances(); + }, + }; +}); + +module.exports.misrepresentedTokens = true \ No newline at end of file diff --git a/projects/teahouse/abi.json b/projects/teahouse/abi.json new file mode 100644 index 00000000000..4ec981ae73f --- /dev/null +++ b/projects/teahouse/abi.json @@ -0,0 +1,6 @@ +{ + "globalState": "function globalState() view returns (uint128 depositLimit, uint128 lockedAssets, uint32 cycleIndex, uint64 cycleStartTimestamp, uint64 fundingLockTimestamp, bool fundClosed)", + "cycleState": "function cycleState(uint32) view returns (uint128 totalFundValue, uint128 fundValueAfterRequests, uint128 requestedDeposits, uint128 convertedDeposits, uint128 requestedWithdrawals, uint128 convertedWithdrawals)", + "asset": "function asset() view returns (address assetTokenAddress)", + "latestAnswer": "function latestAnswer() view returns (int256)" +} diff --git a/projects/teahouse/index.js b/projects/teahouse/index.js new file mode 100644 index 00000000000..62853ef81d4 --- /dev/null +++ b/projects/teahouse/index.js @@ -0,0 +1,49 @@ +const abi = require("./abi.json"); +const { getConfig } = require("../helper/cache"); + +// teahouse public api for vault +const teahouseVaultAPI = "https://vault-content-api.teahouse.finance/vaults"; + +// get vault contract addresses from teahouse api +async function getVaultContractsAddress(chain) { + let htAddress = []; + const { vaults } = await getConfig("teahouse", teahouseVaultAPI); + vaults.forEach((element) => { + // v2 vaults + if (element.isDeFi == false && element.isActive == true) { + if (element.chain === chain) htAddress.push(element.share.address); + } + }); + return htAddress; +} + + +const chains = ["ethereum", "optimism", "arbitrum"]; + +chains.forEach((chain) => { + module.exports[chain] = { + tvl: async (_, _b, _cb, { api }) => { + const vaults = await getVaultContractsAddress(chain); + const tokens = await api.multiCall({ + abi: "address:asset", + calls: vaults, + }); + const cycleIndices = ( + await api.multiCall({ abi: abi.globalState, calls: vaults }) + ).map((i) => i.cycleIndex); + const bals = ( + await api.multiCall({ + abi: abi.cycleState, + calls: vaults.map((vault, i) => ({ + target: vault, + params: cycleIndices[i] - 1, + })), + }) + ).map((i) => i.fundValueAfterRequests); + api.addTokens(tokens, bals); + return api.getBalances(); + }, + }; +}); + +module.exports.misrepresentedTokens = true \ No newline at end of file diff --git a/projects/tealswap/index.js b/projects/tealswap/index.js new file mode 100644 index 00000000000..99d6ef2cb30 --- /dev/null +++ b/projects/tealswap/index.js @@ -0,0 +1,8 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports = { + misrepresentedTokens: true, + oas: { + tvl: getUniTVL({ factory: '0x5200000000000000000000000000000000000018', useDefaultCoreAssets: true, }) + } +} \ No newline at end of file diff --git a/projects/team-finance/apiCache.js b/projects/team-finance/apiCache.js index f67ff4877f9..687a6b9cca0 100644 --- a/projects/team-finance/apiCache.js +++ b/projects/team-finance/apiCache.js @@ -1,8 +1,9 @@ const sdk = require("@defillama/sdk"); const { ethereumContractData, polygonContractData, avaxContractData, bscContractData, kavaContractData, } = require("./config"); -const { vestingHelper, getCache, setCache, } = require("../helper/cache"); +const { getCache, setCache, } = require("../helper/cache") +const { vestingHelper, } = require("../helper/unknownTokens") -const project = 'team-finance' +const project = 'bulky/team-finance' function getTvl(args) { return async (timestamp, ethBlock, chainBlocks) => { @@ -12,7 +13,7 @@ function getTvl(args) { const contractAddress = args[i].contract const abi = args[i].contractABI const chain = args[i].chain - const cache = getCache(project, chain) || { vaults: {} } + const cache = await getCache(project, chain) || { vaults: {} } if (!cache.vaults) cache.vaults = {} if (!cache.vaults[contractAddress]) cache.vaults[contractAddress] = { lastTotalId: 0, tokens: [], } const cCache = cache.vaults[contractAddress] @@ -54,14 +55,14 @@ function getTvl(args) { block, chain, blacklist: args[i].blacklist, }) - setCache(project, chain, cache) + await setCache(project, chain, cache) for (const [token, balance] of Object.entries(balances)) sdk.util.sumSingleBalance(totalBalances, token, balance) } return totalBalances } -}; +} module.exports = { methodology: `Counts each LP pair's native token and diff --git a/projects/team-finance/index.js b/projects/team-finance/index.js index 94e119d3043..be863218091 100644 --- a/projects/team-finance/index.js +++ b/projects/team-finance/index.js @@ -56,7 +56,7 @@ function getTvl(args) { } return totalBalances } -}; +} module.exports = { methodology: `Counts each LP pair's native token and diff --git a/projects/team-finance/lockcontract.abi.json b/projects/team-finance/lockcontract.abi.json index 096429b0a72..21b439f93e7 100644 --- a/projects/team-finance/lockcontract.abi.json +++ b/projects/team-finance/lockcontract.abi.json @@ -1,51 +1,4 @@ { - "depositId": { - "constant": true, - "inputs": [], - "name": "depositId", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "getDepositDetails": { - "constant": true, - "inputs": [ - { - "name": "_id", - "type": "uint256" - } - ], - "name": "getDepositDetails", - "outputs": [ - { - "name": "_tokenAddress", - "type": "address" - }, - { - "name": "_withdrawalAddress", - "type": "address" - }, - { - "name": "_tokenAmount", - "type": "uint256" - }, - { - "name": "_unlockTime", - "type": "uint256" - }, - { - "name": "_withdrawn", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } + "depositId": "uint256:depositId", + "getDepositDetails": "function getDepositDetails(uint256 _id) view returns (address _tokenAddress, address _withdrawalAddress, uint256 _tokenAmount, uint256 _unlockTime, bool _withdrawn)" } \ No newline at end of file diff --git a/projects/team-finance/lockcontract_v3.abi.json b/projects/team-finance/lockcontract_v3.abi.json index ae7149f2c95..6faeb35b71f 100644 --- a/projects/team-finance/lockcontract_v3.abi.json +++ b/projects/team-finance/lockcontract_v3.abi.json @@ -1,66 +1,4 @@ { - "depositId": { - "inputs": [], - "name": "depositId", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getDepositDetails": { - "inputs": [ - { - "internalType": "uint256", - "name": "_id", - "type": "uint256" - } - ], - "name": "getDepositDetails", - "outputs": [ - { - "internalType": "address", - "name": "_tokenAddress", - "type": "address" - }, - { - "internalType": "address", - "name": "_withdrawalAddress", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_tokenAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_unlockTime", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "_withdrawn", - "type": "bool" - }, - { - "internalType": "uint256", - "name": "_tokenId", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "_isNFT", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - } -} - - + "depositId": "uint256:depositId", + "getDepositDetails": "function getDepositDetails(uint256 _id) view returns (address _tokenAddress, address _withdrawalAddress, uint256 _tokenAmount, uint256 _unlockTime, bool _withdrawn, uint256 _tokenId, bool _isNFT)" +} \ No newline at end of file diff --git a/projects/tectonic/abi.json b/projects/tectonic/abi.json index 599db2fe64f..264a1f89194 100644 --- a/projects/tectonic/abi.json +++ b/projects/tectonic/abi.json @@ -1,32 +1,4 @@ { - "totalBorrows": { - "constant": true, - "inputs": [], - "name": "totalBorrows", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "underlying": { - "constant": true, - "inputs": [], - "name": "underlying", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } + "totalBorrows": "uint256:totalBorrows", + "underlying": "address:underlying" } \ No newline at end of file diff --git a/projects/teddy/getEntireSystemColl.abi.json b/projects/teddy/getEntireSystemColl.abi.json deleted file mode 100644 index 15a2c6c04b3..00000000000 --- a/projects/teddy/getEntireSystemColl.abi.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "inputs": [], - "name": "getEntireSystemColl", - "outputs": [ - { - "internalType": "uint256", - "name": "entireSystemColl", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" -} \ No newline at end of file diff --git a/projects/teddy/index.js b/projects/teddy/index.js index 1879dbf2e57..3f93e997c0e 100644 --- a/projects/teddy/index.js +++ b/projects/teddy/index.js @@ -1,7 +1,7 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const { staking } = require("../helper/staking"); const { pool2 } = require("../helper/pool2"); -const getEntireSystemCollAbi = require("./getEntireSystemColl.abi.json"); const {getLiquityTvl} = require('../helper/liquity') const treasuryContract = "0xb4Fbc7839ce88029c8c1c6274660118e27B6f982"; @@ -12,35 +12,13 @@ const TEDDY = "0x094bd7b2d99711a1486fb94d4395801c6d0fddcc"; const stakingPool2Contract = "0x9717Ff7406Be065EA177bA9ab1bE704060Af8370"; const WAVAX_TSD_PGL = "0x67E395B6ACd948931eeE8F52C7c1Fe537E7f1a7a"; -const NATIVE_ADDRESS = "0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7"; -//const LUSD_TOKEN_ADDRESS = "0x5f98805a4e8be255a32880fdec7f6728c6568ba0"; +const NATIVE_ADDRESS = ADDRESSES.avax.WAVAX; +//const LUSD_TOKEN_ADDRESS = ADDRESSES.ethereum.LUSD; -const STABILITY_POOL_ADDRESS = "0x7AEd63385C03Dc8ed2133F705bbB63E8EA607522"; const TROVE_MANAGER_ADDRESS = "0xd22b04395705144Fd12AfFD854248427A2776194"; -const TSD = "0x4fbf0429599460D327BD5F55625E30E4fC066095"; - -const chain = "avax"; - -async function avaxTvl(_, ethBlock, chainBlocks) { - const block = chainBlocks[chain]; - - const troveEthTvl = ( - await sdk.api.abi.call({ - target: TROVE_MANAGER_ADDRESS, - abi: getEntireSystemCollAbi, - block, - chain, - }) - ).output; - - return { - [chain + ":" + NATIVE_ADDRESS]: troveEthTvl, - }; -} module.exports = { avax: { - treasury: staking(treasuryContract, TEDDY, "avax"), staking: sdk.util.sumChainTvls([ staking(stakingContract, TEDDY, "avax"), //staking(STABILITY_POOL_ADDRESS, TSD, "avax"), diff --git a/projects/tegisto/index.js b/projects/tegisto/index.js new file mode 100644 index 00000000000..699f0725948 --- /dev/null +++ b/projects/tegisto/index.js @@ -0,0 +1,16 @@ +const { staking } = require("../helper/staking") +const { getUniTVL } = require("../helper/unknownTokens") +const sdk = require('@defillama/sdk') + +module.exports = { + kava: { + tvl: sdk.util.sumChainTvls([ + getUniTVL({ factory: '0x07fA706528c0bb721327798B5686B620BCcf5b99', useDefaultCoreAssets: true, fetchBalances: true }), + getUniTVL({ factory: '0xfdF832fe60a5145909e7b24Cff225830c1850917', useDefaultCoreAssets: true, fetchBalances: true }), + ]), + staking: staking('0x744Dd9f79b80437a9e5eb0292128045F51C48b6d', '0x87F1E00d6bcD3712031e5edD26DFcdB0FEd35D20', undefined, 'tegisto', 18), + }, + celo: { + tvl: getUniTVL({ factory: '0x1FA136Ba715889B691305a687A0fbD82e6287A67', useDefaultCoreAssets: true, fetchBalances: true }), + } +} \ No newline at end of file diff --git a/projects/tegro/index.js b/projects/tegro/index.js new file mode 100644 index 00000000000..e66a25a663c --- /dev/null +++ b/projects/tegro/index.js @@ -0,0 +1,20 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { get } = require('../helper/http') +const { getConfig } = require('../helper/cache') +const { getTonBalance } = require('../helper/chain/ton') +const sdk = require('@defillama/sdk') +const nullAddress = ADDRESSES.null + +module.exports = { + misrepresentedTokens: true, + timetravel: false, + ton: { + tvl: async (_, _1, _2, { api}) => { + const pools = await getConfig('tegro-fi', 'https://api.tegro.finance/v1/pairs') + let tonPools = pools.filter(i => !i.base.address ).map(i => i.address) + sdk.log(pools.length, tonPools.length) + const tonBalances = await Promise.all(tonPools.map(getTonBalance)) + tonBalances.forEach(i => api.add(nullAddress, i * 2)) + } + } +} diff --git a/projects/teller/index.js b/projects/teller/index.js new file mode 100644 index 00000000000..9b52acb05e7 --- /dev/null +++ b/projects/teller/index.js @@ -0,0 +1,100 @@ +const { getLogs } = require('../helper/cache/getLogs') +const { sumTokens2 } = require('../helper/unwrapLPs') + +// https://docs.teller.org/teller-v2-protocol/l96ARgEDQcTgx4muwINt/resources/deployed-contracts +const config = { + ethereum: { factory: '0x2551a099129ad9b0b1fec16f34d9cb73c237be8b', fromBlock: 16472616, tellerV2: '0x00182FdB0B880eE24D428e3Cc39383717677C37e', }, + polygon: { factory: '0x76888a882a4ff57455b5e74b791dd19df3ba51bb', fromBlock: 38446227, tellerV2: '0xD3D79A066F2cD471841C047D372F218252Dbf8Ed', }, +} + +const blacklistedTokens = ['0x8f9bbbb0282699921372a134b63799a48c7d17fc'] + +const data = {} + +async function getData(api) { + const key = `${api.chain}-${api.block}` + if (!data[key]) data[key] = _getData() + return data[key] + + async function _getData() { + const chain = api.chain + const { factory, fromBlock, tellerV2 } = config[chain] + const collateralDepositedLogs = await getLogs({ + api, + target: factory, + topics: ['0x1a7f128dbc559fb97831b7681dee32957c2917e95d1c5070da20fb89e91f9d7a'], + eventAbi: 'event CollateralDeposited (uint256 _bidId, uint8 _type, address _collateralAddress, uint256 _amount, uint256 _tokenId)', + onlyArgs: true, + extraKey: 'CollateralDeposited', + fromBlock, + }) + const escrowLogs = await getLogs({ + api, + target: factory, + topics: ['0xc201bfb915e3eed80ff17e013f3d88db1c51ac7fc12728fce91a2afc659128ef'], + eventAbi: 'event CollateralEscrowDeployed (uint256 _bidId, address _collateralEscrow)', + onlyArgs: true, + extraKey: 'CollateralEscrowDeployed', + fromBlock, + }) + const repaidLogs = await getLogs({ + api, + target: tellerV2, + topic: 'LoanRepaid(uint256)', + eventAbi: 'event LoanRepaid(uint256 indexed bidId)', + extraKey: 'LoanRepaid', + onlyArgs: true, + fromBlock, + }) + const liquidatedLogs = await getLogs({ + api, + target: tellerV2, + topic: 'LoanLiquidated(uint256,address)', + eventAbi: 'event LoanLiquidated(uint256 indexed bidId, address indexed liquidator)', + onlyArgs: true, + extraKey: 'LoanLiquidated', + fromBlock, + }) + let closedBidSet = new Set() + repaidLogs.forEach(i => closedBidSet.add(+i.bidId)) + liquidatedLogs.forEach(i => closedBidSet.add(+i.bidId)) + const escrowMap = {} + escrowLogs.forEach(i => { + const bidId = +i._bidId + if (closedBidSet.has(bidId)) return; + if (escrowMap[bidId]) throw new Error('Escrow address already found for ' + bidId) + escrowMap[bidId] = { + owner: i._collateralEscrow, + tokens: [], + } + }) + collateralDepositedLogs.forEach(i => { + const bidId = +i._bidId + if (closedBidSet.has(bidId)) return; + if (!escrowMap[bidId]) throw new Error('Escrow address missing for ' + bidId) + escrowMap[bidId].tokens.push(i._collateralAddress) + }) + return escrowMap + } +} + +async function tvl(_, _b, _cb, { api, }) { + const data = await getData(api) + return sumTokens2({ api, ownerTokens: Object.values(data).map(i => [i.tokens, i.owner]), blacklistedTokens }) +} + +async function borrowed(_, _b, _cb, { api, }) { + const data = await getData(api) + const activeLoans = Object.keys(data) + const { tellerV2 } = config[api.chain] + const loanData = await api.multiCall({ abi: "function bids(uint256) view returns (address borrower, address receiver, address lender, uint256 marketplaceId, bytes32 _metadataURI, tuple(address lendingToken, uint256 principal, tuple(uint256 principal, uint256 interest) totalRepaid, uint32 timestamp, uint32 acceptedTimestamp, uint32 lastRepaidTimestamp, uint32 loanDuration) loanDetails, tuple(uint256 paymentCycleAmount, uint32 paymentCycle, uint16 APR) terms, uint8 state, uint8 paymentType)", calls: activeLoans, target: tellerV2 }) + loanData.forEach(i => { + api.add(i.loanDetails.lendingToken, i.loanDetails.principal - i.loanDetails.totalRepaid.principal) + }) +} + +module.exports = {} + +Object.keys(config).forEach(chain => { + module.exports[chain] = { tvl, borrowed, } +}) \ No newline at end of file diff --git a/projects/templar/api.js b/projects/templar/api.js new file mode 100644 index 00000000000..cd075bf1b66 --- /dev/null +++ b/projects/templar/api.js @@ -0,0 +1,18 @@ +const index = require('./index') + +module.exports = { + bsc: { + tvl: index.bsc.tvl, + staking: index.bsc.staking, + }, + /* + moonriver: { + tvl: () => 0, + staking: index.moonriver.staking, + }, + harmony: { + tvl: () => 0, + staking: index.harmony.staking, + }, + */ +} \ No newline at end of file diff --git a/projects/templar/index.js b/projects/templar/index.js index 65e3b0fb8a2..31a8172a02e 100644 --- a/projects/templar/index.js +++ b/projects/templar/index.js @@ -1,90 +1,30 @@ -const sdk = require("@defillama/sdk"); -const {staking} = require("../helper/staking"); -const {sumTokensAndLPsSharedOwners} = require("../helper/unwrapLPs"); -const {getFixBalancesSync} = require("../helper/portedTokens"); +const { sumTokensExport } = require("../helper/unwrapLPs"); - -const bscTem = "0x19e6BfC1A6e4B042Fb20531244D47E252445df01"; const bscStaking = "0xa1f61Ca61fe8655d2a204B518f6De964145a9324"; -const bscTreasuryContract = "0xd01e8D805BB310F06411e70Fd50eB58cAe2B4C27"; - -async function bscTvl(timestamp, block, chainBlocks) { - let balances = {}; - await sumTokensAndLPsSharedOwners( - balances, - [ - ["0xe9e7cea3dedca5984780bafc599bd69add087d56", false], // BUSD - ["0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c", false], // WBNB - ["0xfe19f0b51438fd612f6fd59c1dbb3ea319f433ba", false], // MIM - ["0x9911e98974d0badde85bd5f4d1f93087aa3ec5fa", true], // MIM-BUSD CAKELP - ["0xbf598a387c5f96f8bac9bdccf8fb68bc189cdff7", true], // TEM-MIM CAKELP - ["0x1ede821daade714edade648f525ada0c5fe4ee3a", true], // TEM-BUSD CAKELP - ], - [bscTreasuryContract], - chainBlocks.bsc, - "bsc", - (addr) => { - if (addr.toLowerCase() === "0xfe19f0b51438fd612f6fd59c1dbb3ea319f433ba") { - return "0x99d8a9c45b2eca8864373a26d1459e3dff1e17f3"; - } - return `bsc:${addr}`; - } - ); - return balances; -} - -const moonriverTem = "0xD86E3F7B2Ff4e803f90c799D702955003bcA9875"; -const moonriverStaking = "0xa1f61Ca61fe8655d2a204B518f6De964145a9324"; -const moonriverTreasuryContract = "0xd01e8D805BB310F06411e70Fd50eB58cAe2B4C27"; - -async function moonriverTvl (timestamp, block, chainBlocks) { - let balances = {}; - await sumTokensAndLPsSharedOwners(balances, [ - ["0x5eF6e7e82b2402d354a22a0714299920135B45bE", true], // temMim HBLP - ["0x0cae51e1032e8461f4806e26332c030e34de3adb", false], // MIM - ["0x98878B06940aE243284CA214f92Bb71a2b032B8A", false] // WMOVR - ], [moonriverTreasuryContract], chainBlocks.moonriver, "moonriver", addr=> { - if (addr.toLowerCase() === "0xd86e3f7b2ff4e803f90c799d702955003bca9875") { - return "bsc:0x19e6BfC1A6e4B042Fb20531244D47E252445df01" - } - return `moonriver:${addr}` - }) - return balances; -} - - -const harmonyTem = "0xd754ae7bb55feb0c4ba6bc037b4a140f14ebe018"; -const harmonyStaking = "0xd86e3f7b2ff4e803f90c799d702955003bca9875"; -const harmonyTreasury = "0x92ae908d7bcf891ffa47ae10596e6a66cf43a77a"; +const bscStakingV2 = "0xffC7B93b53BC5F4732b414295E989684702D0eb5"; -async function harmonyTvl (timestamp, block, chainBlocks) { - let balances = {}; - await sumTokensAndLPsSharedOwners(balances, [ - ["0xef977d2f931c1978db5f6747666fa1eacb0d0339", false], // DAI - ["0xeed838406194feba1bd654cfdf85a941ac0944bc", true], // TEM DAI SLP - ["0xcf664087a5bb0237a0bad6742852ec6c8d69a27a", false] // WONE - ], [harmonyTreasury], chainBlocks.harmony, "harmony", addr=> { - addr = addr.toLowerCase(); - if (addr == "0xd754ae7bb55feb0c4ba6bc037b4a140f14ebe018") { - return `bsc:0x19e6BfC1A6e4B042Fb20531244D47E252445df01`; - } - return `harmony:${addr}`; - }); - getFixBalancesSync('harmony')(balances); - return balances; -} +const bscTokens = { + TEM: "0x19e6BfC1A6e4B042Fb20531244D47E252445df01", +}; module.exports = { - bsc: { - tvl: bscTvl, - staking: staking(bscStaking, bscTem, "bsc") - }, - moonriver: { - tvl: moonriverTvl, - staking: staking(moonriverStaking, moonriverTem, "moonriver", "bsc:0x19e6BfC1A6e4B042Fb20531244D47E252445df01") - }, - harmony: { - tvl: harmonyTvl, - staking: staking(harmonyStaking, harmonyTem, "harmony", "bsc:0x19e6BfC1A6e4B042Fb20531244D47E252445df01") - }, -} + bsc: { + staking: sumTokensExport({ + owners: [bscStaking, bscStakingV2], + tokens: [bscTokens.TEM], + }), + tvl: () => 0, + }, + ethereum: { + tvl: () => 0, + staking: () => 0, + }, + moonriver: { + tvl: () => 0, + staking: () => 0, + }, + harmony: { + tvl: () => 0, + staking: () => 0, + }, +}; \ No newline at end of file diff --git a/projects/templedao-trade/index.js b/projects/templedao-trade/index.js index 0289b67e94a..b0cb2306aff 100644 --- a/projects/templedao-trade/index.js +++ b/projects/templedao-trade/index.js @@ -1,12 +1,10 @@ const sdk = require("@defillama/sdk"); - - -const FRAX = "0x853d955aCEf822Db058eb8505911ED77F175b99e"; +const ADDRESSES = require('../helper/coreAssets.json') const tvlContracts = [ { address: '0x98257C876ACe5009e7B97843F8c71b3AE795c71E', // AMMrouter - token: FRAX + token: ADDRESSES.ethereum.FRAX } ]; @@ -30,13 +28,13 @@ async function findBalances(contracts, block) { balanceOfs[i].output ); - }; + } return balances; -}; +} async function tvl(timestamp, ethBlock, chainBlocks) { return await findBalances(tvlContracts, ethBlock); -}; +} module.exports = { diff --git a/projects/templedao/abi.json b/projects/templedao/abi.json index b724d56cf5d..1d62235d643 100644 --- a/projects/templedao/abi.json +++ b/projects/templedao/abi.json @@ -1,111 +1,9 @@ { - "stakingToken": { - "inputs": [], - "name": "stakingToken", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "operator": { - "inputs": [], - "name": "operator", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "poolLength": { - "inputs": [], - "name": "poolLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "poolInfo": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "poolInfo", - "outputs": [ - { - "internalType": "address", - "name": "lptoken", - "type": "address" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "address", - "name": "gauge", - "type": "address" - }, - { - "internalType": "address", - "name": "crvRewards", - "type": "address" - }, - { - "internalType": "address", - "name": "stash", - "type": "address" - }, - { - "internalType": "bool", - "name": "shutdown", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - "totalBalanceOf": { - "inputs": [ - { "internalType": "address", "name": "_account", "type": "address" } - ], - "name": "totalBalanceOf", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - "curveToken": { - "inputs": [], - "name": "curveToken", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - "balances": { - "inputs": [{ "internalType": "address", "name": "", "type": "address" }], - "name": "balances", - "outputs": [ - { "internalType": "uint112", "name": "locked", "type": "uint112" }, - { "internalType": "uint32", "name": "nextUnlockIndex", "type": "uint32" } - ], - "stateMutability": "view", - "type": "function" - } -} + "stakingToken": "address:stakingToken", + "operator": "address:operator", + "poolLength": "uint256:poolLength", + "poolInfo": "function poolInfo(uint256) view returns (address lptoken, address token, address gauge, address crvRewards, address stash, bool shutdown)", + "totalBalanceOf": "function totalBalanceOf(address _account) view returns (uint256)", + "curveToken": "address:curveToken", + "balances": "function balances(address) view returns (uint112 locked, uint32 nextUnlockIndex)" +} \ No newline at end of file diff --git a/projects/templedao/index.js b/projects/templedao/index.js index 1231a811c9b..3cc965307c2 100644 --- a/projects/templedao/index.js +++ b/projects/templedao/index.js @@ -1,11 +1,10 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { staking } = require("../helper/staking"); const { pool2 } = require("../helper/pool2"); -const { sumTokens } = require("../helper/unwrapLPs") +const { sumTokens, sumTokens2, unwrapUniswapV3NFTs } = require("../helper/unwrapLPs") const { createIncrementArray } = require("../helper/utils") -const { resolveCrvTokens } = require("../helper/resolveCrvTokens") const sdk = require('@defillama/sdk'); const abi = require("./abi.json"); -const { GraphQLClient, gql } = require("graphql-request"); const poolInfos = {} const templeStakingContract = "0xEc3C1aBDAb15EbC069ec5e320EaACf716eDfC011"; @@ -16,9 +15,9 @@ const TEMPLE = "0x470ebf5f030ed85fc1ed4c2d36b9dd02e77cf1b7"; const auraLocker = '0x3Fa73f1E5d8A792C80F426fc8F84FBF7Ce9bBCAC'; const templeTreasuryContract = "0x5c8898f8e0f9468d4a677887bc03ee2659321012"; -const FRAX = "0x853d955acef822db058eb8505911ed77f175b99e"; +const FRAX = ADDRESSES.ethereum.FRAX; const FXS = "0x3432b6a60d23ca0dfca7761b7ab56459d9c964d0"; -const CVX_FXS = "0xFEEf77d3f69374f66429C91d732A244f074bdf74"; +const CVX_FXS = ADDRESSES.ethereum.cvxFXS; const AURA = '0xC0c293ce456fF0ED870ADd98a0828Dd4d2903DBF' const TEMPLE_DENDEND1 = '0x8A5058100E60e8F7C42305eb505B12785bbA3BcA'; const TEMPLE_DENDEND2 = '0xb0D978C8Be39C119922B99f483cD8C4092f0EA56'; @@ -44,13 +43,13 @@ async function treasuryTvl(ts, block) { const auraLockerDetails = await sdk.api.abi.call({target: auraLocker, params: [temepleGnosisAddress], abi: abi.balances, block, chain}); const lockedAuraBalance = auraLockerDetails.output.locked; sdk.util.sumSingleBalance(balances, AURA, lockedAuraBalance); + await unwrapUniswapV3NFTs({ owner: temepleGnosisAddress, balances, block, }) - const auraPools = await fetchAuraPoolData(temepleGnosisAddress); - auraPools.account.poolAccounts.forEach(account => { - balances[account.pool.lpToken.id] = account.balance - }); - - return balances; + return sumTokens2({ balances, chain, owner: temepleGnosisAddress, tokens: [ + '0x3835a58ca93cdb5f912519ad366826ac9a752510', + '0xfb6b1c1a1ea5618b3cfc20f81a11a97e930fa46b', + '0x173063a30e095313eee39411f07e95a8a806014e', + ]}) } async function getCvxPoolValue({ block, owner, pool, balances, chain }) { @@ -61,7 +60,6 @@ async function getCvxPoolValue({ block, owner, pool, balances, chain }) { const ourPoolInfo = poolInfos[operator].find(i => JSON.stringify(i).indexOf(stakingToken) > -1) const crvToken = ourPoolInfo.lptoken balances[crvToken] = poolBalance - await resolveCrvTokens(balances, block, chain) async function setPoolInfo(operator) { if (poolInfos[operator]) return; const poolLength = +(await sdk.api.abi.call({ target: operator, block, chain, abi: abi.poolLength })).output @@ -75,33 +73,8 @@ async function getCvxProxyVaultValue({block, balances, pool, vault}) { const unwrappedToken = (await sdk.api.abi.call({ target: stakingToken, block, chain, abi: abi.curveToken })).output const lpTokenBalance = (await sdk.api.abi.call({ target: stakingToken, params: [vault], block, chain, abi: abi.totalBalanceOf })).output sdk.util.sumSingleBalance(balances, unwrappedToken, lpTokenBalance); - await resolveCrvTokens(balances, block, chain) -} - -async function fetchAuraPoolData(account) { - const endpoint = "https://api.thegraph.com/subgraphs/name/aurafinance/aura"; - const graphQLClient = new GraphQLClient(endpoint); - - const query = gql` - { - account(id: "${account}") { - poolAccounts { - pool { - lpToken { - id - } - } - balance - } - } - } - `; - - return graphQLClient.request(query) } - - module.exports = { doublecounted: true, misrepresentedTokens: true, diff --git a/projects/tempodao/index.js b/projects/tempodao/index.js index a0af66dd95a..97279e02c22 100644 --- a/projects/tempodao/index.js +++ b/projects/tempodao/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { ohmTvl } = require("../helper/ohm"); const treasuryAddress = "0xd069c8c4aD8CCE7076BdD1dca8AA9199dC980Ea8"; @@ -7,5 +8,5 @@ module.exports = ohmTvl(treasuryAddress, [ //JOE LP ["0x720dd9292b3d0dd78c9afa57afd948c2ea2d50d8", true], // WAVAX - ["0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7", false] + [ADDRESSES.avax.WAVAX, false] ], "avax", "0x6323c227f71b30babdd6fe84093027079a955662", "0x88a425b738682f58c0ff9fcf2cceb47a361ef4cf") \ No newline at end of file diff --git a/projects/tender-finance/index.js b/projects/tender-finance/index.js new file mode 100644 index 00000000000..bc9ca257848 --- /dev/null +++ b/projects/tender-finance/index.js @@ -0,0 +1,10 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { compoundExports } = require("../helper/compound"); + +module.exports = { + hallmarks: [ + [1678190400,"Oracle Exploit"] + ], + methodology: "Same as compound, we just get all the collateral (not borrowed money) on the lending markets.", + arbitrum: compoundExports('0xeed247Ba513A8D6f78BE9318399f5eD1a4808F8e', 'arbitrum', '0x0706905b2b21574DEFcF00B5fc48068995FCdCdf', ADDRESSES.arbitrum.WETH) +}; diff --git a/projects/tenderize/index.js b/projects/tenderize/index.js index 508c88643af..63c9f30a960 100644 --- a/projects/tenderize/index.js +++ b/projects/tenderize/index.js @@ -1,4 +1,3 @@ -const tenderSwapABI = require('./tenderSwapABI.json'); const sdk = require('@defillama/sdk'); const { GraphQLClient, gql } = require('graphql-request'); const BigNumber = require('bignumber.js'); @@ -46,7 +45,7 @@ async function fetchArbitrum(timestamp, ethBlock, chainBlocks) { const token1Balance = await sdk.api.abi.call({ block: chainBlocks['arbitrum'], target: config.tenderSwap, - abi: tenderSwapABI.find((abi) => abi.name === 'getToken1Balance'), + abi: "uint256:getToken1Balance", chain: 'arbitrum' }); @@ -74,7 +73,7 @@ async function fetchEthereum(timestamp, ethBlock, chainBlocks) { const token1Balance = await sdk.api.abi.call({ block: ethBlock, target: config.tenderSwap, - abi: tenderSwapABI.find((abi) => abi.name === 'getToken1Balance'), + abi: "uint256:getToken1Balance", }); tvlData[config.steak] = addBNstr( diff --git a/projects/tenderize/tenderSwapABI.json b/projects/tenderize/tenderSwapABI.json deleted file mode 100644 index 813490eef35..00000000000 --- a/projects/tenderize/tenderSwapABI.json +++ /dev/null @@ -1,9 +0,0 @@ -[ - { - "inputs": [], - "name": "getToken1Balance", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - } -] diff --git a/projects/tendieswap-app/index.js b/projects/tendieswap-app/index.js new file mode 100644 index 00000000000..be38e7a01a9 --- /dev/null +++ b/projects/tendieswap-app/index.js @@ -0,0 +1,13 @@ +const { staking } = require("../helper/staking.js"); +const { getUniTVL } = require("../helper/unknownTokens.js"); + +const masterchef = "0x6dDb25ca46656767f8f2385D653992dC1cdb4470"; +const tendie = "0x0260F440AEa04a1690aB183Dd63C5596d66A9a43" + +module.exports = { + misrepresentedTokens: true, + tenet: { + tvl: getUniTVL({ useDefaultCoreAssets: true, factory: '0x2D2ee1a4aec9f3c8c14dFcE837e1C89b639dd1E4', }), + // staking: staking(masterchef, tendie) + }, +}; \ No newline at end of file diff --git a/projects/tendieswap/index.js b/projects/tendieswap/index.js index 5429f6de3cf..be6c8a943e9 100644 --- a/projects/tendieswap/index.js +++ b/projects/tendieswap/index.js @@ -8,7 +8,7 @@ const tendie = "0x9853A30C69474BeD37595F9B149ad634b5c323d9" module.exports = { bsc: { tvl: getUniTVL({ - chain: 'bsc', useDefaultCoreAssets: true, + useDefaultCoreAssets: true, factory: factoryBSC, }), staking: staking(masterchef, tendie, "bsc") diff --git a/projects/tenet/abi.json b/projects/tenet/abi.json index 7c20b2146f0..ecb1974e3cd 100644 --- a/projects/tenet/abi.json +++ b/projects/tenet/abi.json @@ -1,61 +1,3 @@ { - "poolSettingInfo": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "poolSettingInfo", - "outputs": [ - { - "internalType": "address", - "name": "lpToken", - "type": "address" - }, - { - "internalType": "address", - "name": "tokenAddr", - "type": "address" - }, - { - "internalType": "address", - "name": "projectAddr", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "startBlock", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "endBlock", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "tokenPerBlock", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "tokenBonusEndBlock", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "tokenBonusMultipler", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } + "poolSettingInfo": "function poolSettingInfo(uint256) view returns (address lpToken, address tokenAddr, address projectAddr, uint256 tokenAmount, uint256 startBlock, uint256 endBlock, uint256 tokenPerBlock, uint256 tokenBonusEndBlock, uint256 tokenBonusMultipler)" } \ No newline at end of file diff --git a/projects/tenfinance/abi.json b/projects/tenfinance/abi.json index b1047bb88ec..daa63adb8c0 100644 --- a/projects/tenfinance/abi.json +++ b/projects/tenfinance/abi.json @@ -1,43 +1,5 @@ { - "wantLockedTotal": { - "inputs": [], - "name": "wantLockedTotal", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - "poolLength": { - "inputs": [], - "name": "poolLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "poolInfo": { - "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "name": "poolInfo", - "outputs": [ - { "internalType": "contract IERC20", "name": "want", "type": "address" }, - { "internalType": "uint256", "name": "allocPoint", "type": "uint256" }, - { - "internalType": "uint256", - "name": "lastRewardBlock", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accAQUAPerShare", - "type": "uint256" - }, - { "internalType": "address", "name": "strat", "type": "address" } - ], - "stateMutability": "view", - "type": "function" - } -} + "wantLockedTotal": "uint256:wantLockedTotal", + "poolLength": "uint256:poolLength", + "poolInfo": "function poolInfo(uint256) view returns (address want, uint256 allocPoint, uint256 lastRewardBlock, uint256 accAQUAPerShare, address strat)" +} \ No newline at end of file diff --git a/projects/tenfinance/index.js b/projects/tenfinance/index.js index 5c9e947a1e6..f0ae04afb6b 100644 --- a/projects/tenfinance/index.js +++ b/projects/tenfinance/index.js @@ -5,9 +5,6 @@ const tenVault = "0xC2fB710D39f1D116FD3A70789381a3699Ff9fce0"; const tenfi = "0xd15c444f1199ae72795eba15e8c1db44e47abf62"; const tenFi_PCS = '0xFBF4cf9CdD629bF102F68BFEE43A49923f869505'.toLowerCase() -const replacements = { -}; - const { yieldHelper, } = require("../helper/yieldHelper") module.exports = yieldHelper({ diff --git a/projects/tenx-exchange/index.js b/projects/tenx-exchange/index.js new file mode 100644 index 00000000000..4fddb4762c9 --- /dev/null +++ b/projects/tenx-exchange/index.js @@ -0,0 +1,3 @@ +const { uniTvlExport } = require('../helper/unknownTokens') + +module.exports = uniTvlExport('tenet', '0xbaB158ED71F7FD4AD43b1db1aAc5d0EFA0a8469f') \ No newline at end of file diff --git a/projects/terra-bridge/index.js b/projects/terra-bridge/index.js index 42d539faa07..df12bcd855c 100644 --- a/projects/terra-bridge/index.js +++ b/projects/terra-bridge/index.js @@ -1,46 +1,17 @@ -const sdk = require('@defillama/sdk') -const { fetchAssets } = require('../helper/chain/terra') -const { getChainTransform } = require('../helper/portedTokens') - -const data = { - ethereum: { - path: '/shuttle/eth.json' - }, - bsc: { - path: '/shuttle/bsc.json', - }, - harmony: { - path: '/shuttle/hmy.json', - }, -} - -function getTVLFunction(chain) { - return async function tvl(timestamp, ethBlock, {[chain]: block}) { - const balances = {} - const chainData = data[chain]; - const chainTokens = await fetchAssets(chainData.path); - - const transform = await getChainTransform(chain) - const calls = Object.values(chainTokens.data.mainnet).map(t => ({ target: t })) - const { output: results } = await sdk.api.abi.multiCall({ abi: 'erc20:totalSupply', calls, block, chain }) - results.forEach(({ input, output }) => sdk.util.sumSingleBalance(balances, transform(input.target), output)) - - return balances - } -} +const { sumTokensExport } = require('../helper/sumTokens') module.exports = { - methodology: "Sums tokens that are bridged (minted) to other chains via Terra Bridge (shuttle).", - ethereum: { - tvl: getTVLFunction('ethereum'), - }, - bsc: { - tvl: getTVLFunction('bsc'), - }, - harmony: { - tvl: getTVLFunction('harmony'), - }, - hallmarks:[ - [1651881600, "UST depeg"], - ], + methodology: "Sums tokens that are bridged (minted) to other chains via Terra Bridge (shuttle).", + terra: { + tvl: sumTokensExport({ + owners: [ + 'terra13yxhrk08qvdf5zdc9ss5mwsg5sf7zva9xrgwgc', + 'terra1g6llg3zed35nd3mh9zx6n64tfw3z67w2c48tn2', + 'terra1rtn03a9l3qsc0a9verxwj00afs93mlm0yr7chk', + ] + }) + }, + hallmarks: [ + [1651881600, "UST depeg"], + ], }; diff --git a/projects/terraswap/factoryTvl.js b/projects/terraswap/factoryTvl.js index 95b54183d14..354f1dee529 100644 --- a/projects/terraswap/factoryTvl.js +++ b/projects/terraswap/factoryTvl.js @@ -1,4 +1,4 @@ -const { query, queryContract } = require('../helper/chain/terra') +const { queryContract } = require('../helper/chain/cosmos') const { PromisePool } = require('@supercharge/promise-pool') const { transformDexBalances } = require('../helper/portedTokens') @@ -6,75 +6,17 @@ function getAssetInfo(asset) { return [asset.info.native_token?.denom ?? asset.info.token?.contract_addr, Number(asset.amount)] } -const terra = { - getAllPairs: async function (factory) { - let allPairs = [] - let currentPairs; - do { - currentPairs = (await query(`contracts/${factory}/store?query_msg={"pairs":{"limit":30${allPairs.length === 0 ? "" : `,"start_after":${JSON.stringify(allPairs[allPairs.length - 1].asset_infos)}` - }}}`, undefined, false)).pairs - allPairs = [...allPairs, ...currentPairs]; - } while (currentPairs.length > 0) - return allPairs.map(pair => pair.contract_addr) - }, - - getFactoryTvl: (factory) => { - return async () => { - const pairs = await terra.getAllPairs(factory, undefined, false) - - let ustTvl = 0; - const balances = {} - const prices = {} - const addPairToTVL = async (pair, index) => { - const { assets } = await query(`contracts/${pair}/store?query_msg={"pool":{}}`, undefined, false) - const [token0, amount0] = getAssetInfo(assets[0]) - const [token1, amount1] = getAssetInfo(assets[1]) - if (token0 === "uusd") { - ustTvl += amount0 * 2 - if (amount1 !== 0) { - prices[token1] = amount0 / amount1 - } - } else if (token1 === 'uusd') { - ustTvl += amount1 * 2 - if (amount0 !== 0) { - prices[token0] = amount1 / amount0 - } - } else if (token1 === "uluna") { - balances[token1] = (balances[token1] ?? 0) + amount1 * 2 - } else { - balances[token0] = (balances[token0] ?? 0) + amount0 - balances[token1] = (balances[token1] ?? 0) + amount1 - } - } - await PromisePool - .withConcurrency(31) - .for(pairs) - .process(addPairToTVL) - Object.entries(balances).map(entry => { - const price = prices[entry[0]] - if (price) { - ustTvl += entry[1] * price - } - }) - return { - 'terrausd': ustTvl / 1e6 - } - } - } -} - - -async function getAllPairs(factory, isTerra2) { +async function getAllPairs(factory, chain) { let allPairs = [] let currentPairs; do { const queryStr = `{"pairs": { "limit": 30 ${allPairs.length ? `,"start_after":${JSON.stringify(allPairs[allPairs.length - 1].asset_infos)}` : ""} }}` - currentPairs = (await queryContract({ contract: factory, isTerra2, data: queryStr })).pairs + currentPairs = (await queryContract({ contract: factory, chain, data: queryStr })).pairs allPairs.push(...currentPairs) } while (currentPairs.length > 0) const dtos = [] const getPairPool = (async (pair) => { - const pairRes = await queryContract({ contract: pair.contract_addr, isTerra2, data: { pool: {} } }) + const pairRes = await queryContract({ contract: pair.contract_addr, chain, data: { pool: {} } }) const pairDto = {} pairDto.assets = [] pairDto.addr = pair.contract_addr @@ -91,11 +33,9 @@ async function getAllPairs(factory, isTerra2) { return dtos } -function getFactoryTvl(factory, isTerra2 = false) { - if (!isTerra2) - return terra.getFactoryTvl(factory) - return async () => { - const pairs = (await getAllPairs(factory, isTerra2)).filter(pair => (pair.assets[0].balance && pair.assets[1].balance)) +function getFactoryTvl(factory) { + return async (_, _1, _2, { chain }) => { + const pairs = (await getAllPairs(factory, chain)).filter(pair => (pair.assets[0].balance && pair.assets[1].balance)) const data = pairs.map(({ assets }) => ({ token0: assets[0].addr, @@ -103,7 +43,7 @@ function getFactoryTvl(factory, isTerra2 = false) { token1: assets[1].addr, token1Bal: assets[1].balance, })) - return transformDexBalances({ chain: 'terra2', data }) + return transformDexBalances({ chain, data }) } } diff --git a/projects/terraswap/index.js b/projects/terraswap/index.js index 74508cbcb81..c10c6c27a17 100644 --- a/projects/terraswap/index.js +++ b/projects/terraswap/index.js @@ -10,7 +10,7 @@ module.exports = { misrepresentedTokens: true, methodology: "Liquidity on the DEX", terra: { tvl: getFactoryTvl(factory.classic) }, - terra2: { tvl: getFactoryTvl(factory.terra2, true) }, + terra2: { tvl: getFactoryTvl(factory.terra2) }, hallmarks:[ [1651881600, "UST depeg"], ] diff --git a/projects/tesseract/abi.json b/projects/tesseract/abi.json index 821c9033625..d310be833ba 100644 --- a/projects/tesseract/abi.json +++ b/projects/tesseract/abi.json @@ -1,4 +1,4 @@ { - "token":{"stateMutability":"view","type":"function","name":"token","inputs":[],"outputs":[{"name":"","type":"address"}],"gas":3888}, - "totalAssets":{"stateMutability":"view","type":"function","name":"totalAssets","inputs":[],"outputs":[{"name":"","type":"uint256"}],"gas":8698} + "token": "address:token", + "totalAssets": "uint256:totalAssets" } \ No newline at end of file diff --git a/projects/tethys-perpetual/index.js b/projects/tethys-perpetual/index.js new file mode 100644 index 00000000000..138306c8ab5 --- /dev/null +++ b/projects/tethys-perpetual/index.js @@ -0,0 +1,9 @@ +const {staking} = require('../helper/staking') +const { gmxExports } = require('../helper/gmx') + +module.exports = { + metis:{ + staking: staking('0xA3c1694EfCd4389Ce652D521d2be28c912250a53', '0x69fdb77064ec5c84FA2F21072973eB28441F43F3'), + tvl: gmxExports({ vault: '0xD2032462fd8A45C4BE8F5b90DE25eE3631ec1c2C', }) + } +}; diff --git a/projects/tethys/index.js b/projects/tethys/index.js index 1520d7f83be..4b6450f6820 100644 --- a/projects/tethys/index.js +++ b/projects/tethys/index.js @@ -1,24 +1,15 @@ const { getUniTVL } = require('../helper/unknownTokens') -const { staking, stakingPricedLP } = require('../helper/staking.js'); +const { staking } = require('../helper/staking.js'); const factory = '0x2CdFB20205701FF01689461610C9F321D1d00F80' -const metis = '0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000' const tethys = '0x69fdb77064ec5c84FA2F21072973eB28441F43F3' const masterchef = '0x54A8fB8c634dED694D270b78Cb931cA6bF241E21' -const whitelist = [ - tethys, // TETHYS - '0xEA32A96608495e54156Ae48931A7c20f0dcc1a21', // USDC - '0xbB06DCA3AE6887fAbF931640f67cab3e3a16F4dC', // USDT - '0x420000000000000000000000000000000000000A', // WETH -] module.exports = { methodology: `Metis tokens, USDC, USDT, WETH, TETHYS allocated in LP`, misrepresentedTokens: true, - timetravel: true, - doublecounted: false, metis:{ tvl: getUniTVL({ factory, chain: 'metis', useDefaultCoreAssets: true }), - staking: stakingPricedLP(masterchef, tethys, "metis","0xc9b290ff37fa53272e9d71a0b13a444010af4497", "metis-token"), + staking: staking(masterchef, tethys), } } diff --git a/projects/tetu-pawnshop/index.js b/projects/tetu-pawnshop/index.js new file mode 100644 index 00000000000..c99f56f73e0 --- /dev/null +++ b/projects/tetu-pawnshop/index.js @@ -0,0 +1,28 @@ +const { sumTokens2 } = require('../helper/unwrapLPs') + +const config = { + polygon: { shop: '0x0c9fa52d7ed12a6316d3738c80931ecbc6c49907', }, +} + +module.exports = { +}; + +Object.keys(config).forEach(chain => { + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const shop = config[chain].shop + const posIds = await api.fetchList({ itemAbi: abi.openPositions, lengthAbi: abi.openPositionsSize, target: shop }) + const posData = await api.multiCall({ abi: abi.positions, calls: posIds, target: shop }) + const tokens = posData.map(pos => ([pos.collateral.collateralToken, pos.acquired.acquiredToken, pos.depositToken])).flat() + console.log(tokens) + return sumTokens2({ api, owner: shop, tokens, resolveUniV3: true, blacklistedTokens: ['0xc36442b4a4522e871399cd717abdd847ab11fe88']}) + return {} + } + } +}) + +const abi = { + "openPositions": "function openPositions(uint256) view returns (uint256)", + "openPositionsSize": "uint256:openPositionsSize", + "positions": "function positions(uint256) view returns (uint256 id, address borrower, address depositToken, uint256 depositAmount, bool open, uint256 minAuctionAmount, tuple(uint256 posDurationBlocks, uint256 posFee, uint256 createdBlock, uint256 createdTs) info, tuple(address collateralToken, uint8 collateralType, uint256 collateralAmount, uint256 collateralTokenId) collateral, tuple(address acquiredToken, uint256 acquiredAmount) acquired, tuple(address lender, uint256 posStartBlock, uint256 posStartTs, uint256 posEndTs) execution)", +} \ No newline at end of file diff --git a/projects/tetu-swap/index.js b/projects/tetu-swap/index.js index 17d8cb6859f..d179dc83314 100644 --- a/projects/tetu-swap/index.js +++ b/projects/tetu-swap/index.js @@ -4,7 +4,6 @@ module.exports = { misrepresentedTokens: true, polygon: { tvl: getUniTVL({ - chain: 'polygon', useDefaultCoreAssets: true, factory: '0x684d8c187be836171a1af8d533e4724893031828', }), diff --git a/projects/tetu/abi.json b/projects/tetu/abi.json index 0bedd79a001..8604871d560 100644 --- a/projects/tetu/abi.json +++ b/projects/tetu/abi.json @@ -1,81 +1,13 @@ { - "vaultsLength": { - "constant":true, - "inputs": [], - "name": "vaultsLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable":false, - "stateMutability":"view", - "type": "function" - }, - "vaults": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "_vaults", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "vaultTvlUsdc": { - "inputs": [ - { - "internalType": "address", - "name": "_vault", - "type": "address" - } - ], - "name": "vaultTvlUsdc", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "strategy": { - "inputs": [], - "name": "strategy", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "platform": { - "inputs": [], - "name": "platform", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - } -} + "vaultsLength": "uint256:vaultsLength", + "vaults": "function _vaults(uint256) view returns (address)", + "vaultTvlUsdc": "function vaultTvlUsdc(address _vault) view returns (uint256)", + "totalTvlUsdc": "function totalTvlUsdc(address[] _vault) view returns (uint256)", + "strategy": "address:strategy", + "platform": "uint8:platform", + "vaultsList": "address[]:vaultsList", + "vaultERC4626TvlUsdc": "function vaultERC2626TvlUsdc(address _vault) view returns (uint256)", + "veTokens": "function tokens(uint256) view returns (address)", + "getPrice": "function getPrice(address _token) view returns (uint256)", + "balanceOf": "function balanceOf(address _owner) view returns (uint256)" +} \ No newline at end of file diff --git a/projects/tetu/index.js b/projects/tetu/index.js index dfcd6d56941..3fddd121871 100644 --- a/projects/tetu/index.js +++ b/projects/tetu/index.js @@ -6,6 +6,14 @@ const EXCLUDED_PLATFORMS = { "12": true, // TETU_SWAP "29": true // TETU self farm } +const EXCLUDED_VAULTS = { + "ethereum": { + "0xfe700d523094cc6c673d78f1446ae0743c89586e": true, // tetuBAL ethereum + }, + "fantom": { + "0x27c616838b8935c8a34011d0e88ba335040ac7b1": true // broken MAI on fantom + } +} module.exports = { start: 1628024400, //Tue Aug 03 2021 21:00:00 GMT+0000 @@ -16,6 +24,8 @@ const config = { polygon: { bookkeeper: '0x0A0846c978a56D6ea9D2602eeb8f977B21F3207F', contract_Reader: '0xCa9C8Fba773caafe19E6140eC0A7a54d996030Da', + controllerV2: '0x33b27e0A2506a4A2FBc213a01C51d0451745343a', + veTETU: '0x6FB29DD17fa6E27BD112Bc3A2D0b8dae597AeDA4', }, fantom: { bookkeeper: '0x00379dD90b2A337C4652E286e4FBceadef940a21', @@ -32,51 +42,59 @@ const config = { } Object.keys(config).forEach(chain => { - const { bookkeeper, contract_Reader, } = config[chain] + const { bookkeeper, contract_Reader, controllerV2, veTETU } = config[chain] module.exports[chain] = { - tvl: async (_, _b, { [chain]: block }) => { - const vaultLength = ( - await sdk.api.abi.call({ - abi: abi.vaultsLength, - target: bookkeeper, - block, chain, - }) - ).output; - let calls = getParamCalls(vaultLength) - const { output: vaultAddresses } = await sdk.api.abi.multiCall({ - target: bookkeeper, - abi: abi.vaults, - calls, chain, block, - }) + tvl: async (_, _b, { [chain]: block }, { api }) => { + const vaultAddresses = await api.fetchList({ lengthAbi: abi.vaultsLength, itemAbi: abi.vaults, target: bookkeeper }) + const strategies = await api.multiCall({ abi: abi.strategy, calls: vaultAddresses, }) + const platforms = await api.multiCall({ abi: abi.platform, calls: strategies, }) + const vaultsCall = [] - calls = vaultAddresses.map(i => ({ target: i.output })) - const { output: strategies } = await sdk.api.abi.multiCall({ - abi: abi.strategy, - calls, - chain, block, - }) + for (let i = 0; i < vaultAddresses.length; i++) { + if (EXCLUDED_PLATFORMS[platforms[i]] === true) + continue; + // exclude duplication count or broken vaults + if (EXCLUDED_VAULTS[chain] && EXCLUDED_VAULTS[chain][vaultAddresses[i].toLowerCase()] === true) + continue; + vaultsCall.push(vaultAddresses[i]) + } - calls = strategies.map(i => ({ target: i.output })) - const { output: platforms } = await sdk.api.abi.multiCall({ - abi: abi.platform, - calls, chain, block, - }) + // TetuV2 vaults + let usdcsV2 = []; + if (controllerV2) { + const vaultsV2 = (await api.call({ abi: abi.vaultsList, target: controllerV2, })); + usdcsV2 = await api.multiCall({ target: contract_Reader, abi: abi.vaultERC4626TvlUsdc, calls: vaultsV2, permitFailure: true, }) + } - calls = [] - for (let i = 0; i < vaultLength; i++) { - if (EXCLUDED_PLATFORMS[platforms[i].output] === true) - continue; - calls.push({ params: vaultAddresses[i].output }) + // veTETU + let veTETU_USDC = 0; + if (veTETU) { + for (let i = 0; i < 100; i++) { + let token = ''; + try { + token = (await api.call({ abi: abi.veTokens, target: veTETU, params: i, })); + } catch (e) { + // assume that tokens ended + // we don't have length for tokens so this workaround + break; + } + + const amount = (await api.call({ abi: abi.balanceOf, target: token, params: veTETU, })); + const price = (await api.call({ abi: abi.getPrice, target: contract_Reader, params: token, })); + + // assume all tokens inside with decimal 18 + // if not need addtionial call with decimals + veTETU_USDC += amount * price / 1e36; + } } - const { output: usdcs } = await sdk.api.abi.multiCall({ - target: contract_Reader, - abi: abi.vaultTvlUsdc, - calls, chain, block, - }) + let total = veTETU_USDC + for (const vault of vaultsCall) { + const usdcs = await api.call({ target: contract_Reader, abi: abi.totalTvlUsdc, params: [[vault]], }) + total += usdcs / 1e18 + } - let total = 0 - usdcs.forEach(i => total += i.output / 1e18) + usdcsV2.forEach(i => total += i / 1e18) return { 'usd-coin': total } diff --git a/projects/tezos-baking/index.js b/projects/tezos-baking/index.js index 1c561a8616b..b19412e8a2e 100644 --- a/projects/tezos-baking/index.js +++ b/projects/tezos-baking/index.js @@ -1,21 +1,9 @@ -const utils = require('../helper/utils') - -const pair = "KT1TxqZ8QtKvLu3V3JH7Gx58n7Co8pgtpQU5" - -async function tvl(){ - const btc = await utils.fetchURL("https://api.tzkt.io/v1/contracts/KT1TxqZ8QtKvLu3V3JH7Gx58n7Co8pgtpQU5/storage") - const xtz = await utils.fetchURL("https://rpc.tzbeta.net/chains/main/blocks/head/context/contracts/KT1TxqZ8QtKvLu3V3JH7Gx58n7Co8pgtpQU5/balance") - - return { - "bitcoin": Number(btc.data.tokenPool)/1e8, - "tezos": Number(xtz.data)/1e6, - } -} - -module.exports={ - tezos: { - tvl, - }, - - methodology: "Liquidity on tezos' tzBTC-XTZ pair" +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport, nullAddress } = require('../helper/sumTokens') + +module.exports = { + tezos: { + tvl: sumTokensExport({ owner: 'KT1TxqZ8QtKvLu3V3JH7Gx58n7Co8pgtpQU5', tokens: [nullAddress, ADDRESSES.tezos.tzBTC] }), + }, + methodology: "Liquidity on tezos' tzBTC-XTZ pair" } \ No newline at end of file diff --git a/projects/thalaswap/index.js b/projects/thalaswap/index.js new file mode 100644 index 00000000000..60aef875522 --- /dev/null +++ b/projects/thalaswap/index.js @@ -0,0 +1,41 @@ +const sdk = require("@defillama/sdk"); +const { getResources, } = require("../helper/chain/aptos"); +const { transformBalances } = require("../helper/portedTokens"); + +const thalaswapAddress = "0x48271d39d0b05bd6efca2278f22277d6fcc375504f9839fd73f74ace240861af"; +const nullCoinType = "base_pool::Null"; + +let resourcesCache; + +async function _getResources() { + if (!resourcesCache) resourcesCache = getResources(thalaswapAddress) + return resourcesCache +} +const extractCoinAddress = resource => resource.type.split('<')[1].replace('>', '').split(', '); +const poolsFilter = resource => resource.type.includes(`${thalaswapAddress}::stable_pool::StablePool<`) || resource.type.includes(`${thalaswapAddress}::weighted_pool::WeightedPool<`) +module.exports = { + timetravel: false, + methodology: + "Aggregates TVL in all pools in Thalaswap, Thala Labs' AMM.", + aptos: { + tvl: async () => { + const balances = {}; + const resources = await _getResources() + const pools = resources.filter(poolsFilter).map(pool => ({ + assets: [pool.data.asset_0, pool.data.asset_1, pool.data.asset_2, pool.data.asset_3], + asset_types: extractCoinAddress(pool), + })); + + pools.forEach(({ assets, asset_types }) => { + assets.forEach((asset, index) => { + // We ignore the null coin because it signifies that we don't have either a third or fourth asset in the pool + // We ignore the THL coin because native tokens are exempt from TVL calculations + if (!asset_types[index].includes(nullCoinType)) + sdk.util.sumSingleBalance(balances, asset_types[index], asset.value); + }); + }); + + return transformBalances("aptos", balances); + }, + }, +}; \ No newline at end of file diff --git a/projects/thales/abi.json b/projects/thales/abi.json index f7f355e8ca7..fff29c16a54 100644 --- a/projects/thales/abi.json +++ b/projects/thales/abi.json @@ -1,6 +1,7 @@ { - "activeMarkets":{"constant":true,"inputs":[{"internalType":"uint256","name":"index","type":"uint256"},{"internalType":"uint256","name":"pageSize","type":"uint256"}],"name":"activeMarkets","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"payable":false,"stateMutability":"view","type":"function"}, - "totalDeposited": {"constant":true,"inputs":[],"name":"totalDeposited","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"}, - "getUnderlyingBalance": {"inputs":[],"name":"getUnderlyingBalances","outputs":[{"internalType":"uint256","name":"amount0Current","type":"uint256"},{"internalType":"uint256","name":"amount1Current","type":"uint256"}],"stateMutability":"view","type":"function"} - -} \ No newline at end of file + "activeMarkets": "function activeMarkets(uint256 index, uint256 pageSize) view returns (address[])", + "totalDeposited": "uint256:totalDeposited", + "tradingAllocation": "uint256:tradingAllocation", + "getUnderlyingBalance": "function getUnderlyingBalances() view returns (uint256 amount0Current, uint256 amount1Current)", + "activeParlayMarkets": "function activeParlayMarkets(uint index, uint pageSize) external view returns (address[] memory)" +} diff --git a/projects/thales/index.js b/projects/thales/index.js index 47dec6df393..01b3cb6a2e3 100644 --- a/projects/thales/index.js +++ b/projects/thales/index.js @@ -1,155 +1,90 @@ -const sdk = require('@defillama/sdk') -const { sumTokensAndLPsSharedOwners } = require('../helper/unwrapLPs') +const { sumTokens2 } = require('../helper/unwrapLPs') const { staking } = require('../helper/staking') const abi = require('./abi.json') const { dodoPool2 } = require('../helper/pool2') +const ADDRESSES = require('../helper/coreAssets.json') const ethMarketsManager = "0x5ed98Ebb66A929758C7Fe5Ac60c979aDF0F4040a" -const ETH_SUSD = "0x57ab1ec28d129707052df4df418d58a2d46d5f51" -const ETH_THALES = "0x8947da500eb47f82df21143d0c01a29862a8c3c5" -const ETH_WETH = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2" -const ETH_USDC = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48" const opMarketsManager = "0xBE086E0A2c588Ad64C8530048cE4356190D6a6F3" -const OP_SUSD = "0x8c6f28f2f1a3c87f0f938b96d27520d9751ec8d9" +const OP_SUSD = ADDRESSES.optimism.sUSD const opThalesStaking = "0xc392133eea695603b51a5d5de73655d571c2ce51" -const opThalesAmm = "0x5ae7454827d83526261f3871c1029792644ef1b1" +const opThalesAmm = "0x278b5a44397c9d8e52743fedec263c4760dc1a1a" +const opRangedAmm = "0x2d356b114cbCA8DEFf2d8783EAc2a5A5324fE1dF" +const opParlayAmm = "0x82B3634C0518507D5d817bE6dAb6233ebE4D68D9" +const opSportsLp = "0x842e89b7a7eF8Ce099540b3613264C933cE0eBa5" +const opSportsVault = ["0x43d19841d818b2ccc63a8b44ce8c7def8616d98e", "0x5e2b49c68f1fd68af1354c377eacec2f05632d3f", "0x8285047f33c26c1bf5b387f2b07f21a2af29ace2", "0xbaac5464bf6e767c9af0e8d4677c01be2065fd5f", "0xc922f4CDe42dD658A7D3EA852caF7Eae47F6cEcd"] +const opAmmVault = ["0xb484027CB0c538538Bad2bE492714154f9196F93", "0x6c7Fd4321183b542E81Bcc7dE4DfB88F9DBca29F", "0x43318DE9E8f65b591598F17aDD87ae7247649C83"] const opThalesLpToken = "0xac6705BC7f6a35eb194bdB89066049D6f1B0B1b5"; const opThalesToken = "0x217d47011b23bb961eb6d93ca9945b7501a5bb11" - const opSportsMarketsManager = "0xFBffEbfA2bF2cF84fdCf77917b358fC59Ff5771e" -const opSportsAmm = "0x170a5714112daEfF20E798B6e92e25B86Ea603C1" const polygonMarketsManager = "0x85f1B57A1D3Ac7605de3Df8AdA056b3dB9676eCE" -const polygon_USDC = "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174" -const polygonThalesAmm = "0x9b6d76B1C6140FbB0ABc9C4a348BFf4e4e8a1213" +const polygon_USDC = ADDRESSES.polygon.USDC +const polygonThalesAmm = "0xd52B865584c25FEBfcB676B9A87F32683356A063" +const polygonRangedAMM = "0xe8e022405505a9F2b0B7452C844F1e64423849fC" const arbitrumMarketsManager = "0x95d93c88c1b5190fA7FA4350844e0663e5a11fF0" -const arbitrum_USDC = "0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8" +const arbitrum_USDC = ADDRESSES.arbitrum.USDC +const arbThalesStaking = "0x160Ca569999601bca06109D42d561D85D6Bb4b57" const arbitrumThalesAMM = "0x2b89275efB9509c33d9AD92A4586bdf8c4d21505" +const arbSportsMarketsManager = "0x72ca0765d4bE0529377d656c9645600606214610" +const arbParlayAmm = "0x2Bb7D689780e7a34dD365359bD7333ab24903268" +const arbSportsLp = "0x8e9018b48456202aA9bb3E485192B8475822B874" +const arbSportsVault = ["0xfF7AEA98740fA1e2a9eB81680583e62aaFf1e3Ad", "0xE26374c7aFe71a2a6AB4A61080772547C43B87E6", "0xA852a651377fbE23f3d3acF5919c3D092aD4b77d", "0x31c2947c86412A5e33794105aA034DD9312eb711"] +const arbAmmVault = ["0x640c34D9595AD5351Da8c5C833Bbd1AfD20519ea", "0x0A29CddbdAAf56342507574820864dAc967D2683", "0x008A4e30A8b41781F5cb017b197aA9Aa4Cd53b46"] +const arbThalesToken = "0xE85B662Fe97e8562f4099d8A1d5A92D4B453bF30" - -const L2toL1Synths = { - //THALES - "0x217d47011b23bb961eb6d93ca9945b7501a5bb11": ETH_THALES, - // sUSD - "0x8c6f28f2f1a3c87f0f938b96d27520d9751ec8d9": ETH_SUSD, - // WETH - "0x4200000000000000000000000000000000000006": ETH_WETH, - // USDC - "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174": ETH_USDC, -} - -const transform = (addr)=>{ - return L2toL1Synths[addr] || addr; +async function guniPool2(_timestamp, _ethBlock, chainBlocks, { api }) { + const [lp, token0, token1] = await api.batchCall([ + { target: opThalesLpToken, abi: abi.getUnderlyingBalance, }, + { target: opThalesLpToken, abi: 'address:token0', }, + { target: opThalesLpToken, abi: 'address:token1', }, + ]) + api.add(token0, lp[0]) + api.add(token1, lp[1]) } -async function eth_tvl(_time, block){ - const markets = await sdk.api.abi.call({ - target: ethMarketsManager, - abi: abi.activeMarkets, - block, - params:[0, 1000] - }) - const balances = {} - await sumTokensAndLPsSharedOwners(balances, [[ETH_SUSD, false]], markets.output, block) - return balances +async function getMarkets(api, manager) { + return api.call({ target: manager, abi: abi.activeMarkets, params: [0, 1000] }) } -async function op_tvl(_time, block, cb){ - block = cb.optimism - const markets = await sdk.api.abi.call({ - target: opMarketsManager, - abi: abi.activeMarkets, - block, - params:[0, 1000], - chain: "optimism" - }) - const balances = {} - await sumTokensAndLPsSharedOwners(balances, [[OP_SUSD, false]], markets.output, block, "optimism", transform) - return balances +async function addSportsLPTvl(api, contract, token) { + api.add(token, await api.call({ target: contract, abi: abi.totalDeposited, })) } -async function sports_tvl(_time, block, cb){ - block = cb.optimism - const markets = await sdk.api.abi.call({ - target: opSportsMarketsManager, - abi: abi.activeMarkets, - block, - params:[0, 1000], - chain: "optimism" - }) - const balances = {} - await sumTokensAndLPsSharedOwners(balances, [[OP_SUSD, false]], markets.output, block, "optimism", transform) - return balances -} - -async function polygon_tvl(_time, block, cb){ - block = cb.polygon - const markets = await sdk.api.abi.call({ - target: polygonMarketsManager, - abi: abi.activeMarkets, - block, - params:[0, 1000], - chain: "polygon" - }) - const balances = {} - await sumTokensAndLPsSharedOwners(balances, [[polygon_USDC, false]], markets.output, block, "polygon") - return balances -} - -async function arbitrum_tvl(_time, block, cb){ - block = cb.arbitrum - const markets = await sdk.api.abi.call({ - target: arbitrumMarketsManager, - abi: abi.activeMarkets, - block, - params:[0, 1000], - chain: "arbitrum" - }) - const balances = {} - await sumTokensAndLPsSharedOwners(balances, [[arbitrum_USDC, false]], markets.output, block, "arbitrum") - return balances -} - -function guniPool2(_time, chain="optimism") { - return async (_timestamp, _ethBlock, chainBlocks) => { - const block = chainBlocks[chain] - const lp = await sdk.api.abi.call({ - target: opThalesLpToken, - abi: abi.getUnderlyingBalance, - block, - chain: "optimism" - }) - const balances = {} - sdk.util.sumSingleBalance(balances, ETH_THALES, lp.output.amount0Current) - sdk.util.sumSingleBalance(balances, ETH_WETH, lp.output.amount1Current) - return balances - } -} - -module.exports={ - methodology: "sUSD/USDC locked on markets", - ethereum:{ - tvl: eth_tvl, - pool2: dodoPool2("0x136829c258e31b3ab1975fe7d03d3870c3311651", "0x031816fd297228e4fd537c1789d51509247d0b43") +module.exports = { + methodology: "sUSD/USDC locked on markets", + ethereum: { + tvl: async (_, _1, _2, { api }) => { + return sumTokens2({ api, owners: await getMarkets(api, ethMarketsManager), tokens: [ADDRESSES.ethereum.sUSD] }) + }, + pool2: dodoPool2("0x136829c258e31b3ab1975fe7d03d3870c3311651", "0x031816fd297228e4fd537c1789d51509247d0b43"), + }, + polygon: { + tvl: async (_, _1, _2, { api }) => { + const markets = await getMarkets(api, polygonMarketsManager) + markets.push(polygonThalesAmm, polygonRangedAMM) + return sumTokens2({ api, owners: markets, tokens: [polygon_USDC] }) }, - optimism:{ - tvl: sdk.util.sumChainTvls([op_tvl, sports_tvl, // sUSD in all active markets - staking(opThalesAmm, OP_SUSD, "optimism", ETH_SUSD), - staking(opSportsAmm, OP_SUSD, "optimism", ETH_SUSD), - ]), - staking: staking(opThalesStaking, opThalesToken, "optimism", ETH_THALES), - pool2: guniPool2() + }, + optimism: { + tvl: async (_, _1, _2, { api }) => { + await addSportsLPTvl(api, opSportsLp, OP_SUSD) + const markets = (await Promise.all([opMarketsManager, opSportsMarketsManager,].map(i => getMarkets(api, i)))).flat() + markets.push(opThalesAmm, opParlayAmm, opRangedAmm, ...opSportsVault, ...opAmmVault) + return sumTokens2({ api, tokens: [OP_SUSD], owners: markets }) }, - polygon:{ - tvl: sdk.util.sumChainTvls([polygon_tvl, // USDC in all active markets - staking(polygonThalesAmm, polygon_USDC, "polygon", ETH_USDC), - ]) + staking: staking(opThalesStaking, opThalesToken), + pool2: guniPool2, + }, + arbitrum: { + tvl: async (_, _1, _2, { api }) => { + await addSportsLPTvl(api, arbSportsLp, arbitrum_USDC) + const markets = (await Promise.all([arbitrumMarketsManager, arbSportsMarketsManager,].map(i => getMarkets(api, i)))).flat() + markets.push(arbitrumThalesAMM, arbParlayAmm, ...arbSportsVault, ...arbAmmVault) + return sumTokens2({ api, tokens: [arbitrum_USDC], owners: markets }) }, - arbitrum:{ - tvl: sdk.util.sumChainTvls([arbitrum_tvl, // USDC in all active markets - staking(arbitrumThalesAMM, arbitrum_USDC, "arbitrum", ETH_USDC), - ]) - } + staking: staking(arbThalesStaking, arbThalesToken), + }, } \ No newline at end of file diff --git a/projects/the-granary/abi.json b/projects/the-granary/abi.json deleted file mode 100644 index 20572ec437a..00000000000 --- a/projects/the-granary/abi.json +++ /dev/null @@ -1,103 +0,0 @@ -{ - "getReservesList": { - "inputs": [], - "name": "getReservesList", - "outputs": [ - { - "internalType": "address[]", - "name": "", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getReserveData": { - "inputs": [ - { - "internalType": "address", - "name": "asset", - "type": "address" - } - ], - "name": "getReserveData", - "outputs": [ - { - "components": [ - { - "components": [ - { - "internalType": "uint256", - "name": "data", - "type": "uint256" - } - ], - "internalType": "struct DataTypes.ReserveConfigurationMap", - "name": "configuration", - "type": "tuple" - }, - { - "internalType": "uint128", - "name": "liquidityIndex", - "type": "uint128" - }, - { - "internalType": "uint128", - "name": "variableBorrowIndex", - "type": "uint128" - }, - { - "internalType": "uint128", - "name": "currentLiquidityRate", - "type": "uint128" - }, - { - "internalType": "uint128", - "name": "currentVariableBorrowRate", - "type": "uint128" - }, - { - "internalType": "uint128", - "name": "currentStableBorrowRate", - "type": "uint128" - }, - { - "internalType": "uint40", - "name": "lastUpdateTimestamp", - "type": "uint40" - }, - { - "internalType": "address", - "name": "aTokenAddress", - "type": "address" - }, - { - "internalType": "address", - "name": "stableDebtTokenAddress", - "type": "address" - }, - { - "internalType": "address", - "name": "variableDebtTokenAddress", - "type": "address" - }, - { - "internalType": "address", - "name": "interestRateStrategyAddress", - "type": "address" - }, - { - "internalType": "uint8", - "name": "id", - "type": "uint8" - } - ], - "internalType": "struct DataTypes.ReserveData", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - } -} \ No newline at end of file diff --git a/projects/the-granary/index.js b/projects/the-granary/index.js index e7718579f5b..3846ff7536c 100644 --- a/projects/the-granary/index.js +++ b/projects/the-granary/index.js @@ -1,6 +1,5 @@ const sdk = require("@defillama/sdk"); -const abi = require("./abi.json"); -const { getV2Reserves, getTvl, getBorrowed, aaveChainTvl } = require('../helper/aave'); +const { aaveChainTvl } = require('../helper/aave'); function v2(chain, v2Registry){ const section = borrowed => sdk.util.sumChainTvls([ @@ -16,7 +15,8 @@ module.exports = { fantom: v2("fantom", "0x6D77F7a0e9F8EBE1C0FF2d757FC5a411640309ac"), avax: v2("avax", "0xC043BA54F34C9fb3a0B45d22e2Ef1f171272Bc9D"), optimism: v2("optimism", "0x872B9e8aea5D65Fbf29b8B05bfA4AA3fE94cC11f"), - harmony: v2("harmony", "0xeb3DF52E0254e22434f044C3b62291919501Ee7D"), ethereum: v2("ethereum", "0x5C93B799D31d3d6a7C977f75FDB88d069565A55b"), metis: v2("metis", "0x37133A8dCA96400c249102E59B11e25b0F663Ee0"), + arbitrum: v2("arbitrum", "0x512f582fFCCF3C14bD872152EeAe60866dCB2A1e"), + bsc: v2("bsc", "0x7c8E7536c5044E1B3693eB564C6dE3a3CE58bbDa"), } diff --git a/projects/the-idols/index.js b/projects/the-idols/index.js index 929ecfa073c..d9a0bb3cf53 100644 --- a/projects/the-idols/index.js +++ b/projects/the-idols/index.js @@ -1,9 +1,10 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { ohmTvl } = require('../helper/ohm') const treasury = "0x439cac149b935ae1d726569800972e1669d17094" const virtue_token = "0x9416ba76e88d873050a06e5956a3ebf10386b863" const stakingAddress = "0x0dd5a35fe4cd65fe7928c7b923902b43d6ea29e7" const treasuryTokens = [ - ["0xae7ab96520de3a18e5e111b5eaab095312d7fe84", false], //stETH + [ADDRESSES.ethereum.STETH, false], //stETH ] module.exports = ohmTvl(treasury, treasuryTokens, "ethereum", stakingAddress, virtue_token, undefined, undefined, true) \ No newline at end of file diff --git a/projects/thedragonslair/abi.json b/projects/thedragonslair/abi.json index 46aacd15001..4a7e1bd05cd 100644 --- a/projects/thedragonslair/abi.json +++ b/projects/thedragonslair/abi.json @@ -1,59 +1,4 @@ { - "poolInfo": { - "type": "function", - "stateMutability": "view", - "outputs": [ - { - "type": "address", - "name": "lpToken", - "internalType": "contract IERC20" - }, - { - "type": "uint256", - "name": "allocPoint", - "internalType": "uint256" - }, - { - "type": "uint256", - "name": "lastRewardBlock", - "internalType": "uint256" - }, - { - "type": "uint256", - "name": "accDragonEggPerShare", - "internalType": "uint256" - }, - { - "type": "uint16", - "name": "depositFeeBP", - "internalType": "uint16" - }, - { - "type": "uint256", - "name": "lpSupply", - "internalType": "uint256" - } - ], - "name": "poolInfo", - "inputs": [ - { - "type": "uint256", - "name": "", - "internalType": "uint256" - } - ] - }, - "poolLength": { - "type": "function", - "stateMutability": "view", - "outputs": [ - { - "type": "uint256", - "name": "", - "internalType": "uint256" - } - ], - "name": "poolLength", - "inputs": [] - } + "poolInfo": "function poolInfo(uint256) view returns (address lpToken, uint256 allocPoint, uint256 lastRewardBlock, uint256 accDragonEggPerShare, uint16 depositFeeBP, uint256 lpSupply)", + "poolLength": "uint256:poolLength" } \ No newline at end of file diff --git a/projects/thedragonslair/index.js b/projects/thedragonslair/index.js index 682fb7e532f..0c933ac943f 100644 --- a/projects/thedragonslair/index.js +++ b/projects/thedragonslair/index.js @@ -1,5 +1,4 @@ const abi = require("./abi.json"); -const { transformAvaxAddress } = require("../helper/portedTokens"); const { addFundsInMasterChef } = require("../helper/masterchef"); const { staking } = require("../helper/staking"); const { pool2s } = require("../helper/pool2"); @@ -11,11 +10,11 @@ const pool2LPs = ["0xB52a2b91Bf89BcB9435ad94D23555EaD26954CA9", "0x6c4339A47AA98 async function tvl(timestamp, ethBlock, chainBlocks){ const balances = {}; - const transformAddress = await transformAvaxAddress(); + const transformAddress = addr => 'avax:'+addr await addFundsInMasterChef(balances, STAKING_CONTRACT, chainBlocks.avax, "avax", transformAddress, abi.poolInfo, [...pool2LPs, dregg]) return balances; -}; +} module.exports = { avax:{ diff --git a/projects/thegrandbanks/abi.json b/projects/thegrandbanks/abi.json index 8ce18e1906b..6845d25c2b7 100644 --- a/projects/thegrandbanks/abi.json +++ b/projects/thegrandbanks/abi.json @@ -1,55 +1,6 @@ { - "poolLength": { - "inputs": [], - "name": "poolLength", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - "poolInfo": { - "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "name": "poolInfo", - "outputs": [ - { "internalType": "contract IERC20", "name": "want", "type": "address" }, - { "internalType": "uint256", "name": "allocPoint", "type": "uint256" }, - { - "internalType": "uint256", - "name": "lastRewardBlock", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accGrandPerShare", - "type": "uint256" - }, - {"internalType":"address","name":"strat","type":"address"}, - {"internalType":"address","name":"frySailing","type":"address"}, - {"internalType":"address","name":"fryLanding","type":"address"}, - {"internalType":"bool","name":"isLp","type":"bool"} - ], - "stateMutability": "view", - "type": "function" - }, - "wantLockedTotal": { - "inputs": [], - "name": "wantLockedTotal", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "symbol": { - "constant": true, - "inputs": [], - "name": "symbol", - "outputs": [{ "internalType": "string", "name": "", "type": "string" }], - "payable": false, - "stateMutability": "view", - "type": "function" - } -} + "poolLength": "uint256:poolLength", + "poolInfo": "function poolInfo(uint256) view returns (address want, uint256 allocPoint, uint256 lastRewardBlock, uint256 accGrandPerShare, address strat, address frySailing, address fryLanding, bool isLp)", + "wantLockedTotal": "uint256:wantLockedTotal", + "symbol": "string:symbol" +} \ No newline at end of file diff --git a/projects/thegrandbanks/index.js b/projects/thegrandbanks/index.js index 2a91f77fac6..b925d55116a 100644 --- a/projects/thegrandbanks/index.js +++ b/projects/thegrandbanks/index.js @@ -1,7 +1,7 @@ const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); const { staking } = require("../helper/staking"); -const { unwrapUniswapLPs, unwrapCrv } = require("../helper/unwrapLPs"); +const { unwrapUniswapLPs, } = require("../helper/unwrapLPs"); const { getChainTransform } = require('../helper/portedTokens') const GRAND = { @@ -128,14 +128,7 @@ const calcTvl = async (balances, banksContract, chain) => { await Promise.all( crvPositions.map(async (crv) => { - await unwrapCrv( - balances, - crv.token, - crv.balance, - chainBlocks[chain], - chain, - transform, - ); + sdk.util.sumSingleBalance(balances,crv.token,crv.balance, chain) }) ); }; diff --git a/projects/themis-capital-dex/index.js b/projects/themis-capital-dex/index.js new file mode 100644 index 00000000000..4aa8f785725 --- /dev/null +++ b/projects/themis-capital-dex/index.js @@ -0,0 +1,12 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports = { + misrepresentedTokens: true, + filecoin: { + tvl: getUniTVL({ + factory: '0xe250A89d23F466c14B26BDF60a0DC3b54974FBE9', + useDefaultCoreAssets: true, + fetchBalances: true, + }) + }, +}; \ No newline at end of file diff --git a/projects/themis-capital-ohm/index.js b/projects/themis-capital-ohm/index.js new file mode 100644 index 00000000000..22ed94313ca --- /dev/null +++ b/projects/themis-capital-ohm/index.js @@ -0,0 +1,14 @@ +const { sumTokensExport } = require('../helper/unknownTokens') + +module.exports = { + misrepresentedTokens: true, + filecoin: { + tvl: () => ({}), + staking: sumTokensExport({ + owner: '0xA8a3136111ca0b010C9FD5C2D6d7c71e4982606A', + tokens: ['0x005E02A4A934142d8Dd476F192d0dD9c381b16b4'], + lps: ['0x45680718F6BdB7Ec3A7dF7D61587aC7C3fB49d50'], + useDefaultCoreAssets: true, + }) + }, +}; \ No newline at end of file diff --git a/projects/themis-exchange/index.js b/projects/themis-exchange/index.js new file mode 100644 index 00000000000..f93a5b4685b --- /dev/null +++ b/projects/themis-exchange/index.js @@ -0,0 +1,42 @@ +const { sumTokens2 } = require('../helper/unwrapLPs') + +const config = { + arbitrum: { addressProvider: '0x75F805e2fB248462e7817F0230B36E9Fae0280Fc', }, +} + +module.exports = { + hallmarks: [ + [Math.floor(new Date('2023-06-27')/1e3), 'Protocol was exploited and lost $370k'], + ], +}; +Object.keys(config).forEach(chain => { + const { addressProvider } = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const tokens = await api.call({ abi: abi.getReservesList, target: addressProvider }) + const tokenData = await api.multiCall({ abi: abi.getReserveData, target: addressProvider, calls: tokens, }) + return sumTokens2({ api, tokensAndOwners2: [tokens, tokenData.map(i => i.aTokenAddress)], }) + }, + // borrowed, + } +}) + +async function borrowed(_, _b, _cb, { api, }) { + const { addressProvider } = config[api.chain] + const tokens = await api.call({ abi: abi.getReservesList, target: addressProvider }) + const tokenData = await api.multiCall({ abi: abi.getReserveData, target: addressProvider, calls: tokens, }) + const vDebtSupply = await api.multiCall({ abi: 'erc20:totalSupply', calls: tokenData.map(i => i.variableDebtTokenAddress), }) + const sDebtSupply = await api.multiCall({ abi: 'erc20:totalSupply', calls: tokenData.map(i => i.stableDebtTokenAddress), }) + tokens.forEach((token, i) => { + const variableDebt = vDebtSupply[i] + const stableDebt = sDebtSupply[i] + api.add(token, variableDebt) + api.add(token, stableDebt) + }) + return api.getBalances() +} + +const abi = { + "getReserveData": "function getReserveData(address asset) view returns (tuple(tuple(uint256 data) configuration, uint128 liquidityIndex, uint128 currentLiquidityRate, uint128 variableBorrowIndex, uint128 currentVariableBorrowRate, uint128 currentStableBorrowRate, uint40 lastUpdateTimestamp, uint16 id, address aTokenAddress, address stableDebtTokenAddress, address variableDebtTokenAddress, address interestRateStrategyAddress, uint128 accruedToTreasury, uint128 unbacked, uint128 isolationModeTotalDebt))", + "getReservesList": "address[]:getReservesList", +} \ No newline at end of file diff --git a/projects/thena-v3/index.js b/projects/thena-v3/index.js new file mode 100644 index 00000000000..059e00e3805 --- /dev/null +++ b/projects/thena-v3/index.js @@ -0,0 +1,5 @@ +const { uniV3Export } = require("../helper/uniswapV3"); + +module.exports = uniV3Export({ + bsc: { factory: "0x306F06C147f064A010530292A1EB6737c3e378e4", fromBlock: 26030310, isAlgebra: true, }, +}); diff --git a/projects/thena/index.js b/projects/thena/index.js new file mode 100644 index 00000000000..80f139fe384 --- /dev/null +++ b/projects/thena/index.js @@ -0,0 +1,6 @@ +const { uniTvlExport } = require('../helper/unknownTokens') + +module.exports = uniTvlExport('bsc', '0xafd89d21bdb66d00817d4153e055830b1c2b3970', { + hasStablePools: true, + useDefaultCoreAssets: false, +}) \ No newline at end of file diff --git a/projects/thetanuts/index.js b/projects/thetanuts/index.js index f313ebbb9d4..6e70fb30a1e 100644 --- a/projects/thetanuts/index.js +++ b/projects/thetanuts/index.js @@ -1,5 +1,5 @@ -const sdk = require('@defillama/sdk') -const { toUSDTBalances } = require('../helper/balances') +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require('../helper/unwrapLPs') // Ethereum Vaults const ethCallVault = '0x9014f8E90423766343Ed4fe41668563526dF6715' @@ -13,13 +13,13 @@ const bitPutVault = '0x4Ca3e8bD2F471415b9131E35bdcEC0819a4E7a83' const bitCallVault = '0x9F639524db6DfD57613895b0abb49A53c11B3f0e' // Ethereum - Stronghold IndexUSDC vaults -const indexUSDC_BTC_1wk = "0x3BA337F3167eA35910E6979D5BC3b0AeE60E7d59" -const indexUSDC_ETH_2wk_a = "0xE1c93dE547cc85CBD568295f6CC322B1dbBCf8Ae" -const indexUSDC_AVAX_2wk_b = "0x248038fDb6F00f4B636812CA6A7F06b81a195AB8" -const indexUSDC_FTM_2wk_a = "0x182E7DAD39C8412ce1258B01f1a25afDC6c2294d" -const indexUSDC_SOL_2wk_b = "0xb466a23c77df358B8B1e86514411c5Fe0D613896" +const indexUSDC_BTC_1wk = "0x3BA337F3167eA35910E6979D5BC3b0AeE60E7d59" +const indexUSDC_ETH_2wk_a = "0xE1c93dE547cc85CBD568295f6CC322B1dbBCf8Ae" +const indexUSDC_AVAX_2wk_b = "0x248038fDb6F00f4B636812CA6A7F06b81a195AB8" +const indexUSDC_FTM_2wk_a = "0x182E7DAD39C8412ce1258B01f1a25afDC6c2294d" +const indexUSDC_SOL_2wk_b = "0xb466a23c77df358B8B1e86514411c5Fe0D613896" const indexUSDC_MATIC_2wk_a = "0xAD57221ae9897DA08656aaaBd5B1D4673d4eDE71" -const indexUSDC_BNB_2wk_b = "0xE5e8caA04C4b9E1C9bd944A2a78a48b05c3ef3AF" +const indexUSDC_BNB_2wk_b = "0xE5e8caA04C4b9E1C9bd944A2a78a48b05c3ef3AF" // Ethereum - Stronghold IndexETH vaults const indexETH_BiWeekly_A = "0xcb317b4b7CB45ef6D5Aa4e43171d16760dFE5eeA" @@ -38,12 +38,15 @@ const ftmCallVault = '0x302ABD505757FD355C8ef3cF8b4918D6404f4996' const ftmPutVault = '0x7EDa4C29726355D0d8E85001B9152158b35Eae4f' //BSC Vaults -const adaPutVault = '0xF98297A842f52Cd1f6c6f5f003Cd701813b1C461' -const adaCallVault = '0x8BE731cB3b301b4a209C1A38ea14D6438e6913F6' -const bchPutVault = '0xc879ecC0d2cdA26072e9049178a99B26C51eDF8a' -const bchCallVault = '0xfe9B8054B947aCEeC01912Cf1811DB06fc804b69' -const wbnbPutVault = '0x9EF72De1782431cf54518c42C06e26014E7201D1' -const wbnbCallVault = '0xc75C3BE0Bc41857B9c1a675475F6E0a7c5Db63fC' +//BSC Vaults +const adaCallVault = '0xF98297A842f52Cd1f6c6f5f003Cd701813b1C461' +const adaPutVault = '0x8BE731cB3b301b4a209C1A38ea14D6438e6913F6' +const bchCallVault = '0xc879ecC0d2cdA26072e9049178a99B26C51eDF8a' +const bchPutVault = '0xfe9B8054B947aCEeC01912Cf1811DB06fc804b69' +const wbnbCallVault = '0x9EF72De1782431cf54518c42C06e26014E7201D1' +const wbnbPutVault = '0xc75C3BE0Bc41857B9c1a675475F6E0a7c5Db63fC' + +//Woo Vaults const wooSynVault_Bi_10 = '0x74b9C75ee344cc6D323489906c571912980d03ac' const wooSynVault_Bi_25 = '0x91E3d1461B4655E48Be431895E483C3b17915DA5' const wooSynVault_Mo_10 = '0x68B727b3D2EC73026FD1c7B9f736604f1c09C541' @@ -64,207 +67,154 @@ const nearCallVault = '0xfc7F11Bb0d97d9db1f701eEA0fDE611536F1EB5F' const bobaCallVault = '0x5a9f1D95C59365613B4224e690Bb4971DD246142' const bobaPutVault = '0xff5fe7909fc4d0d6643f1e8be8cba72610d0b485' +//Arbitrum Vaults +const arbCallVault = '0x0833EC3262Dcc417D88f85Ed5E1EBAf768080f41' +//zkEVM vaults +const stMaticCallVault = '0x7bF3c7C23501EA3E09B237D6F8AdcB7Ea3CeF41C' // Ethereum Assets -const weth = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2' -const usdc = '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48' -const wbtc = '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599' +const weth = ADDRESSES.ethereum.WETH +const usdc = ADDRESSES.ethereum.USDC +const wbtc = ADDRESSES.ethereum.WBTC const ust = '0xa693b19d2931d498c5b318df961919bb4aee87a5' const tUSDC = '0x9f238fae3d1f1982716f136836fc2c0d1c2928ab' const tAlgo = '0x0354762a3c01730d07d2f7098365d64dc81b565d' const bit = '0x1a4b46696b2bb4794eb3d4c26f1c55f9170fa4c5' // Avalanche Assets -const wavax = '0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7' -const usdce = '0xa7d7079b0fead91f3e65f86e8915cb59c1a4c664' +const wavax = ADDRESSES.avax.WAVAX +const usdce = ADDRESSES.avax.USDC_e +const usdc_avax = ADDRESSES.avax.USDC // Fantom Assets -const wftm = '0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83' -const fusdc = '0x04068da6c83afcfa0e13ba15a6696662335d5b75' +const wftm = ADDRESSES.fantom.WFTM +const fusdc = ADDRESSES.fantom.USDC // Binance Smart Chain Assets -const busd = '0xe9e7cea3dedca5984780bafc599bd69add087d56' +const busd = ADDRESSES.bsc.BUSD const ada = '0x3ee2200efb3400fabb9aacf31297cbdd1d435d47' const bch = '0x8ff795a6f4d97e7887c79bea79aba5cc76444adf' -const wbnb = '0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c' +const wbnb = ADDRESSES.bsc.WBNB const woo = '0x4691937a7508860F876c9c0a2a617E7d9E945D4B' // Polygon Assets -const wmatic = '0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270' -const pousdc = '0x2791bca1f2de4661ed88a30c99a7a9449aa84174' +const wmatic = ADDRESSES.polygon.WMATIC_2 +const pousdc = ADDRESSES.polygon.USDC const ust_matic_wormhole = '0xE6469Ba6D2fD6130788E0eA9C0a0515900563b59' // Aurora Assets -const near = '0xC42C30aC6Cc15faC9bD938618BcaA1a1FaE8501d' +const near = ADDRESSES.aurora.NEAR // Boba Assets -let boba = '0xa18bF3994C0Cc6E3b63ac420308E5383f53120D7' -const bobaUSDC = '0x66a2A913e447d6b4BF33EFbec43aAeF87890FBbc' - - - - -async function addVault(balances, vault, token, block, chain) { - const totalBalance = await sdk.api.erc20.balanceOf({ - target: token, - owner: vault, - block: block, - chain: chain - }) - if(chain == 'ethereum'){ - sdk.util.sumSingleBalance(balances,token,totalBalance.output) - } - else if(chain == 'avax'){ - sdk.util.sumSingleBalance(balances,`avax:${token}`,totalBalance.output) - } - - else if(chain == 'fantom'){ - sdk.util.sumSingleBalance(balances,`fantom:${token}`,totalBalance.output) - } - - else if(chain == 'bsc'){ - sdk.util.sumSingleBalance(balances,`bsc:${token}`,totalBalance.output) - } - - else if(chain == 'polygon'){ - sdk.util.sumSingleBalance(balances,`polygon:${token}`,totalBalance.output) - } - - else if(chain == 'boba'){ - sdk.util.sumSingleBalance(balances,`boba:${token}`,totalBalance.output,) - } - - else if(chain == 'aurora'){ - sdk.util.sumSingleBalance(balances,`aurora:${token}`,totalBalance.output) - } -} - -async function ethTvl(timestamp, block) { - const balances = {} - await Promise.all([ - addVault(balances, ethCallVault, weth, block, 'ethereum'), - addVault(balances, ethPutVault, usdc, block, 'ethereum'), - addVault(balances, wbtcCallVault, wbtc, block, 'ethereum'), - //addVault(balances, wbtcPutVault, usdc, block, 'ethereum'), //Consolidated with indexUSDC_BTC_1wk - addVault(balances, lunaPutVault, ust, block, 'ethereum'), - addVault(balances, algoPutVault, tUSDC, block, 'ethereum'), - addVault(balances, algoCallVault, tAlgo, block, 'ethereum'), - addVault(balances, bitPutVault, usdc, block, 'ethereum'), - addVault(balances, bitCallVault, bit, block, 'ethereum'), - - addVault(balances, indexUSDC_BTC_1wk , usdc, block, 'ethereum'), - addVault(balances, indexUSDC_ETH_2wk_a , usdc, block, 'ethereum'), - addVault(balances, indexUSDC_AVAX_2wk_b , usdc, block, 'ethereum'), - addVault(balances, indexUSDC_FTM_2wk_a , usdc, block, 'ethereum'), - addVault(balances, indexUSDC_SOL_2wk_b , usdc, block, 'ethereum'), - addVault(balances, indexUSDC_MATIC_2wk_a, usdc, block, 'ethereum'), - addVault(balances, indexUSDC_BNB_2wk_b , usdc, block, 'ethereum'), - - addVault(balances, indexETH_BiWeekly_A, weth, block, 'ethereum'), - addVault(balances, indexETH_BiWeekly_B, weth, block, 'ethereum'), - addVault(balances, indexBTC_BiWeekly_A, wbtc, block, 'ethereum'), - addVault(balances, indexBTC_BiWeekly_B, wbtc, block, 'ethereum'), - - ]) - return balances -} - - -async function avaxTvl(timestamp, ethblocks, chainBlocks) { - const balances = {} - await Promise.all([ - addVault(balances, avaxCallVault, wavax, chainBlocks["avax"], 'avax'), - addVault(balances, avaxPutVault, usdce, chainBlocks["avax"], 'avax'), - ]) - return balances -} +let boba = ADDRESSES.boba.BOBA +const bobaUSDC = ADDRESSES.boba.USDC -async function ftmTvl(timestamp, ethblocks, chainBlocks) { - const balances = {} - await Promise.all([ - addVault(balances, ftmCallVault, wftm, chainBlocks["fantom"], 'fantom'), - addVault(balances, ftmPutVault, fusdc, chainBlocks["fantom"], 'fantom'), - ]) - return balances -} - -async function bscTvl(timestamp, ethblocks, chainBlocks) { - const balances = {} - await Promise.all([ - addVault(balances, adaPutVault, busd, chainBlocks["bsc"], 'bsc'), - addVault(balances, adaCallVault, ada, chainBlocks["bsc"], 'bsc'), - addVault(balances, bchPutVault, busd, chainBlocks["bsc"], 'bsc'), - addVault(balances, bchCallVault, bch, chainBlocks["bsc"], 'bsc'), - addVault(balances, wbnbPutVault, busd, chainBlocks["bsc"], 'bsc'), - addVault(balances, wbnbCallVault, wbnb, chainBlocks["bsc"], 'bsc'), +// Arbitrum assets +let arb = ADDRESSES.arbitrum.ARB - addVault(balances, wooSynVault_Bi_10, woo, chainBlocks["bsc"], 'bsc'), - addVault(balances, wooSynVault_Bi_10, busd, chainBlocks["bsc"], 'bsc'), - addVault(balances, wooSynVault_Bi_25, woo, chainBlocks["bsc"], 'bsc'), - addVault(balances, wooSynVault_Bi_25, busd, chainBlocks["bsc"], 'bsc'), - addVault(balances, wooSynVault_Mo_10, woo, chainBlocks["bsc"], 'bsc'), - addVault(balances, wooSynVault_Mo_10, busd, chainBlocks["bsc"], 'bsc'), - addVault(balances, wooSynVault_Mo_25, woo, chainBlocks["bsc"], 'bsc'), - addVault(balances, wooSynVault_Mo_25, busd, chainBlocks["bsc"], 'bsc'), - ]) - return balances -} +// zkEVM assets +const stMatic = '0x83b874c1e09D316059d929da402dcB1A98e92082'; -async function polygonTvl(timestamp, ethblocks, chainBlocks) { - const balances = {} - await Promise.all([ - addVault(balances, wMaticCallVault, wmatic, chainBlocks["polygon"], 'polygon'), - addVault(balances, wMaticPutVault, pousdc, chainBlocks["polygon"], 'polygon'), - addVault(balances, indexUST_LUNA_2wk_a, ust_matic_wormhole, chainBlocks["polygon"], 'polygon'), - addVault(balances, indexUST_LUNA_2wk_b, ust_matic_wormhole, chainBlocks["polygon"], 'polygon'), - ]) - return balances -} - -async function bobaTvl(timestamp, ethblocks, chainBlocks) { - const balances = {} - await Promise.all([ - addVault(balances, bobaCallVault, boba, chainBlocks["boba"], 'boba'), - addVault(balances, bobaPutVault, bobaUSDC, chainBlocks["boba"], 'boba'), - ]) - return balances +module.exports = { + methodology: `Only the funds deposited by the users into our vaults are calculated as TVL.`, + hallmarks: [ + [Math.floor(new Date('2022-09-30') / 1e3), 'Thetanuts migration V0 -> V1'], + ], } -async function auroraTvl(timestamp, ethblocks, chainBlocks) { - const balances = {} - await Promise.all([ - addVault(balances, nearCallVault, near, chainBlocks["aurora"], 'aurora'), - - ]) - return balances +const config = { + ethereum: { + tokensAndOwners: [ + [weth, ethCallVault,], + [usdc, ethPutVault,], + [wbtc, wbtcCallVault,], + [ust, lunaPutVault,], + [tUSDC, algoPutVault,], + [tAlgo, algoCallVault,], + [usdc, bitPutVault,], + [bit, bitCallVault,], + + [usdc, indexUSDC_BTC_1wk,], + [usdc, indexUSDC_ETH_2wk_a,], + [usdc, indexUSDC_AVAX_2wk_b,], + [usdc, indexUSDC_FTM_2wk_a,], + [usdc, indexUSDC_SOL_2wk_b,], + [usdc, indexUSDC_MATIC_2wk_a,], + [usdc, indexUSDC_BNB_2wk_b,], + + [weth, indexETH_BiWeekly_A,], + [weth, indexETH_BiWeekly_B,], + [wbtc, indexBTC_BiWeekly_A,], + [wbtc, indexBTC_BiWeekly_B,], + + ] + }, + avax: { + tokensAndOwners: [ + [wavax, avaxCallVault,], + [usdc_avax, avaxPutVault,], + ] + }, + arbitrum: { + tokensAndOwners: [ + [arb, arbCallVault,], + ] + }, + fantom: { + tokensAndOwners: [ + [wftm, ftmCallVault,], + [fusdc, ftmPutVault,], + ] + }, + bsc: { + tokensAndOwners: [ + [busd, adaPutVault,], + [ada, adaCallVault,], + [busd, bchPutVault,], + [bch, bchCallVault,], + [busd, wbnbPutVault,], + [wbnb, wbnbCallVault,], + + [woo, wooSynVault_Bi_10,], + [busd, wooSynVault_Bi_10,], + [woo, wooSynVault_Bi_25,], + [busd, wooSynVault_Bi_25,], + [woo, wooSynVault_Mo_10,], + [busd, wooSynVault_Mo_10,], + [woo, wooSynVault_Mo_25,], + [busd, wooSynVault_Mo_25,], + ] + }, + polygon: { + tokensAndOwners: [ + [wmatic, wMaticCallVault,], + [pousdc, wMaticPutVault,], + [ust_matic_wormhole, indexUST_LUNA_2wk_a,], + [ust_matic_wormhole, indexUST_LUNA_2wk_b,], + ] + }, + boba: { + tokensAndOwners: [ + [boba, bobaCallVault,], + [bobaUSDC, bobaPutVault,], + ] + }, + aurora: { + tokensAndOwners: [ + [near, nearCallVault,], + ] + }, + polygon_zkevm: { + tokensAndOwners: [ + [stMatic, stMaticCallVault,], + ] + } } - -module.exports = { - methodology: `Only the funds deposited by the users into our vaults are calculated as TVL.`, - ethereum: { - tvl: ethTvl - }, - avax: { - tvl: avaxTvl - }, - fantom: { - tvl: ftmTvl - }, - bsc: { - tvl: bscTvl - }, - polygon: { - tvl: polygonTvl - }, - boba: { - tvl: bobaTvl - }, - aurora: { - tvl: auroraTvl - }, - hallmarks: [ - [Math.floor(new Date('2022-09-30')/1e3), 'Thetanuts migration V0 -> V1'], - ], -} +Object.keys(config).forEach(chain => { + const { tokensAndOwners } = config[chain] + module.exports[chain] = { + tvl: sumTokensExport({ tokensAndOwners, }) + } +}) \ No newline at end of file diff --git a/projects/thorchain/index.js b/projects/thorchain/index.js index 076118caed7..dce3ed2f531 100644 --- a/projects/thorchain/index.js +++ b/projects/thorchain/index.js @@ -1,38 +1,104 @@ -const { get } = require('../helper/http') +const { getCache, get } = require('../helper/http') +const sdk = require('@defillama/sdk') +const { nullAddress } = require('../helper/tokenMapping') -function diff(interval, timestamp){ - const time = (Number(interval.endTime) + Number(interval.startTime))/2 - return Math.abs(time-timestamp) +async function staking() { + var res = await get('https://midgard.ninerealms.com/v2/network') + const { totalActiveBond, totalStandbyBond } = res.bondMetrics + return { + "thorchain": (Number(totalActiveBond) + Number(totalStandbyBond)) / 1e8 + } } -async function fetch(timestamp) { - var res = await get('https://midgard.ninerealms.com/v2/history/tvl?interval=day&count=400') - let interval = res.intervals[0] - res.intervals.forEach(newInter=>{ - if(diff(newInter, timestamp) 24*3600){ - throw new Error("Difference too large") - } +const chainMapping = { + ETH: 'ethereum', + BTC: 'bitcoin', + AVAX: 'avax', + BNB: 'bsc', + LTC: 'litecoin', + BCH: 'bitcoin-cash', + DOGE: 'dogecoin', + GAIA: 'cosmos', +} - return parseFloat(interval.totalValuePooled)*parseFloat(interval.runePriceUSD)/1e8 +const defillamaChainMapping = { + 'bitcoin-cash': 'bitcoincash', + 'dogecoin': 'doge', } -async function staking(timestamp) { - var res = await get('https://midgard.ninerealms.com/v2/network') - const {totalActiveBond, totalStandbyBond} = res.bondMetrics - return { - "thorchain": (Number(totalActiveBond) + Number(totalStandbyBond))/1e8 - } +function getDChain(chain) { + return defillamaChainMapping[chainMapping[chain]] || chainMapping[chain] +} + +const tokenGeckoMapping = { + 'BNB.TWT-8C2': 'trust-wallet-token', + 'BNB.BUSD-BD1': 'binance-usd', + 'GAIA.ATOM': 'cosmos', + 'BNB.BTCB-1DE': 'bitcoin-bep2', + 'BNB.AVA-645': 'concierge-io', + 'BNB.ETH-1C9': 'ethereum', } +const blacklistedPools = [] + +async function tvl(_, _1, _2, { api }) { + const pools = await getCache('https://midgard.ninerealms.com/v2/pools') + const aChain = api.chain + + const balances = {} + await Promise.all(pools.map(addPool)) + return balances + + async function addPool({ asset: pool, assetDepth: totalDepth, nativeDecimal, runeDepth }) { + if (blacklistedPools.includes(pool)) return; + if (aChain === 'thorchain') { + sdk.util.sumSingleBalance(balances, 'thorchain', runeDepth/1e8) + return; + } + if (+totalDepth < 1) return; + let [chainStr, token] = pool.split('.') + let chain = chainMapping[chainStr] + const dChain = getDChain(chainStr) + if (dChain !== aChain) return; + + let [baseToken, address] = token.split('-') + if (['ethereum', 'bsc', 'avax'].includes(chain)) { + totalDepth = totalDepth * (10 ** (+nativeDecimal - 8)) + if (address && address.length > 8) { + address = address.toLowerCase() + sdk.util.sumSingleBalance(balances, address, totalDepth, chain) + } else if (chainStr === baseToken) { + sdk.util.sumSingleBalance(balances, nullAddress, totalDepth, chain) + } else if (tokenGeckoMapping[pool]) { + sdk.util.sumSingleBalance(balances, tokenGeckoMapping[pool], totalDepth / 1e8) + } else { + sdk.log('skipped', pool, Number(totalDepth).toFixed(2)) + } + } else { + if (chainStr === baseToken) { + if (chain === 'bitcoincash') chain = 'bitcoin-cash' + sdk.util.sumSingleBalance(balances, chain, totalDepth / 1e8) + } else if (tokenGeckoMapping[pool]) { + sdk.util.sumSingleBalance(balances, tokenGeckoMapping[pool], totalDepth / 1e8) + } else { + sdk.log('skipped', pool, totalDepth) + } + } + } +} + module.exports = { - thorchain:{ - fetch, + hallmarks: [ + [1658145600, "Kill Switch"] //https://twitter.com/THORChain/status/1549078524253847553?ref_src=twsrc%5Etfw%7Ctwcamp%5Etweetembed%7Ctwterm%5E1549078524253847553%7Ctwgr%5Edf22fb0a2751e6182143d32b477f2b7f759b8a9f%7Ctwcon%5Es1_&ref_url=https%3A%2F%2Ffinance.yahoo.com%2Fnews%2Fthorchain-phases-support-rune-tokens-123034231.html + ], + timetravel: false, + thorchain: { + tvl, staking }, - fetch } + +Object.keys(chainMapping).map(getDChain).forEach(chain => { + module.exports[chain] = {tvl } +}) \ No newline at end of file diff --git a/projects/thorusfi/index.js b/projects/thorusfi/index.js index 1c796a5e84c..7c690ca89f9 100644 --- a/projects/thorusfi/index.js +++ b/projects/thorusfi/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { staking } = require("../helper/staking"); const { getUniTVL } = require('../helper/unknownTokens') @@ -7,21 +8,21 @@ const thorusMaster_avax = "0x871d68cFa4994170403D9C1c7b3D3E037c76437d"; const THO_avax = "0xAE4AA155D2987B454C29450ef4f862CF00907B61"; const thorusMaster_moonbeam = "0xEeB84a24e10502D8A5c97B11df381D1550B25b9d"; -const THO_moonbeam = "0x735aBE48e8782948a37C7765ECb76b98CdE97B0F"; +const THO_moonbeam = ADDRESSES.shiden.JPYC; module.exports = { timetravel: true, avax:{ tvl: getUniTVL({ - chain: 'avax', + useDefaultCoreAssets: true, factory: factoryContract, }), staking: staking(thorusMaster_avax, THO_avax, "avax"), }, moonbeam: { tvl: getUniTVL({ - chain: 'moonbeam', + useDefaultCoreAssets: true, factory: factoryContract, }), staking: staking( diff --git a/projects/thunderpokt/index.js b/projects/thunderpokt/index.js index abc22788087..11a62a118ea 100644 --- a/projects/thunderpokt/index.js +++ b/projects/thunderpokt/index.js @@ -21,7 +21,7 @@ async function tvl(timestamp, ethBlock, chainBlocks) { module.exports = { methodology: 'tPOKT is backed 1:1 by POKT. Total supply of tPOKT is pulled and multiplied by POKT price to get the TVL', - polygon: { + pokt: { tvl } } \ No newline at end of file diff --git a/projects/tidalfinance/abi.json b/projects/tidalfinance/abi.json index 4cd5d059086..2689ba630e2 100644 --- a/projects/tidalfinance/abi.json +++ b/projects/tidalfinance/abi.json @@ -1,34 +1,4 @@ { - "getAssetLength": { - "inputs": [], - "name": "getAssetLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "assetBalance": { - "inputs": [ - { - "internalType": "uint16", - "name": "", - "type": "uint16" - } - ], - "name": "assetBalance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } + "getAssetLength": "uint256:getAssetLength", + "assetBalance": "function assetBalance(uint16) view returns (uint256)" } \ No newline at end of file diff --git a/projects/tidalfinance/index.js b/projects/tidalfinance/index.js index 39d83d33098..fa4fb8eefbd 100644 --- a/projects/tidalfinance/index.js +++ b/projects/tidalfinance/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); const { transformPolygonAddress } = require("../helper/portedTokens"); @@ -9,7 +10,7 @@ const sellerContract = "0xc73C6C3e80C28dBc55F65bBdC895E828bb98C72d"; const stakingContract = "0x21edB57A75ee69BCe0Fe3D0EfC5674bcF1D5BF93"; // Tokens -const USDC = "0x2791bca1f2de4661ed88a30c99a7a9449aa84174"; +const USDC = ADDRESSES.polygon.USDC; const TIDAL = "0xB41EC2c036f8a42DA384DDE6ADA79884F8b84b26"; /*** Staking of native token (TIDAL) TVL portion ***/ diff --git a/projects/tifi-bank/index.js b/projects/tifi-bank/index.js index bd554f8a091..9a2bb52039f 100644 --- a/projects/tifi-bank/index.js +++ b/projects/tifi-bank/index.js @@ -1,9 +1,36 @@ const { getUniTVL } = require('../helper/unknownTokens') -const { staking } = require('../helper/staking') +const { sumTokensExport } = require("../helper/unknownTokens"); +const { stakings } = require('../helper/staking') + +const stakingContracts = [ + // Staking in the RESERVIOR + "0x0AEfF3d761F6706295f3828C87ccE29c9418a93B", + // Loan + "0x8A6F7834A9d60090668F5db33FEC353a7Fb4704B", + // Lock to Earn + "0xA015263066da13e94526a8b897eDB0E3cd55B19A" +]; + +const lpContract = [ + //PinkLock TIFI Bank + "0x407993575c91ce7643a4d4ccacc9a98c36ee1bbe", + //PinkLock Cake + "0x7ee058420e5937496f5a2096f04caa7721cf70cc" +] + +const lpTokens = [ + // TiFi bank LP token + "0x707B6F02fFC0C7fD9fe3a4F392Aef47218021337", + // Cake LP token + "0xB62BB233Af2F83028Be19626256A9894B68AAe5E" +] + module.exports = { + misrepresentedTokens: true, bsc: { - tvl: getUniTVL({ chain: 'bsc', factory: '0xb3456550c17128ca7ebbcc47d4be6cae29d43853', }), - staking: staking('0x0AEfF3d761F6706295f3828C87ccE29c9418a93B', '0x17E65E6b9B166Fb8e7c59432F0db126711246BC0', 'bsc') + tvl: getUniTVL({ factory: '0xb3456550c17128ca7ebbcc47d4be6cae29d43853', useDefaultCoreAssets: true }), + staking: stakings(stakingContracts, '0x17E65E6b9B166Fb8e7c59432F0db126711246BC0'), + // pool2: sumTokensExport({ tokens: lpTokens, owners: lpContract, useDefaultCoreAssets: true }), } } diff --git a/projects/tigris/index.js b/projects/tigris/index.js new file mode 100644 index 00000000000..3a3764af3c2 --- /dev/null +++ b/projects/tigris/index.js @@ -0,0 +1,61 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { staking } = require("../helper/staking"); +const { sumTokens2 } = require("../helper/unwrapLPs"); + +const TigrisAddresses = { + arbitrum: { + TIG: "0x3A33473d7990a605a88ac72A78aD4EFC40a54ADB", + xTIG: "0x19694Cf64572e6adf643Ae7B13d5b2921215B4E5", + // tigUSD and USDT are 1:1 exchangeable via stable vault + tigUSD: "0x7E491F53bF807f836E2dd6C4A4FBd193e1913EFd", + USDT: ADDRESSES.arbitrum.USDT, + TigStaking: "0x6E8BFBb31A46D0F5502426050Ea28b19F8E761f4", + TokenSale: "0x45F52502aF87e7e4E446BA15BDf223A19b47DA98", + StableVault: "0xe82fcefbDD034500B5862B4827CAE5c117f6b921", + Treasury: "0xf416c2b41fb6c592c9ba7cb6b2f985ed593a51d7", + Lock: "0x76e0c3bda3dD22A2cFDCdbCafdaC997927F80483", + TeamVesting: "0x97F1b43ED98587B2ab5A649aa63Ecc28403282bC", + }, + polygon: { + TIG: "0x7157Fe7533f2fc77498755Cc253d79046c746560", + TigStaking: "0xC6c32eD781450228dFadfa49A430d7868B110F44", + // tigUSD and DAI are 1:1 exchangeable via stable vault + tigUSD: "0x76973Ba2AFF24F87fFE41FDBfD15308dEBB8f7E8", + DAI: ADDRESSES.polygon.DAI, + StableVault: "0x3677415Dc23e49B7780ef46976F418F4a9d5031B", + Treasury: "0x4f7046f36B5D5282A94cB448eAdB3cdf9Ff2b051", + Lock: "0x638e39D4a927EfE3040F0f6D4d27e4CccD8c996A", + Bond: "0xC5d9B681086b2617626B0Ed05A7D632660Fc99f4", + }, +}; + +async function arbitrumTvl(_, _b, _cb, { api }) { + const tokensAndOwners = [ + [TigrisAddresses.arbitrum.USDT, TigrisAddresses.arbitrum.StableVault], + ]; + return sumTokens2({ api, tokensAndOwners }); +} + +async function polygonTvl(_, _b, _cb, { api }) { + const tokensAndOwners = [ + [TigrisAddresses.polygon.DAI, TigrisAddresses.polygon.StableVault], + ]; + return sumTokens2({ api, tokensAndOwners }); +} + +module.exports = { + arbitrum: { + staking: staking( + TigrisAddresses.arbitrum.TigStaking, + TigrisAddresses.arbitrum.TIG + ), + tvl: arbitrumTvl, + }, + polygon: { + staking: staking( + TigrisAddresses.polygon.TigStaking, + TigrisAddresses.polygon.TIG + ), + tvl: polygonTvl, + }, +}; diff --git a/projects/timeless/abi.json b/projects/timeless/abi.json index 22bca64415f..73abdc5336e 100644 --- a/projects/timeless/abi.json +++ b/projects/timeless/abi.json @@ -1,34 +1,4 @@ { - "asset": { - "inputs": [], - "name": "asset", - "outputs": [ - { - "internalType": "contract ERC20", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "convertToAssets": { - "inputs": [ - { - "internalType": "uint256", - "name": "shares", - "type": "uint256" - } - ], - "name": "convertToAssets", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } + "asset": "address:asset", + "convertToAssets": "function convertToAssets(uint256 shares) view returns (uint256)" } \ No newline at end of file diff --git a/projects/timeless/index.js b/projects/timeless/index.js index 8c3aa1ebfba..40e4ad90895 100644 --- a/projects/timeless/index.js +++ b/projects/timeless/index.js @@ -1,22 +1,21 @@ const sdk = require("@defillama/sdk"); const { sumTokens2 } = require('../helper/unwrapLPs') const abi = require('./abi.json') +const { getLogs } = require('../helper/cache/getLogs') -const chain = 'ethereum' const factory = '0xbd16088611054fce04711aa9509d1d86e04dce2c' const wl_stETH_token = '0xf9a98a9452485ed55cd3ce5260c2b71c9807b11a' -async function tvl(_, block) { +async function tvl(_, block, _1, { api }) { const logs = ( - await sdk.api.util.getLogs({ - keys: [], - toBlock: block, + await getLogs({ + api, target: factory, fromBlock: 14916925, topic: 'DeployYieldTokenPair(address,address,address,address)', }) - ).output + ) const toa = [] logs.forEach(({ topics }) => { @@ -24,21 +23,12 @@ async function tvl(_, block) { const vault = `0x${topics[2].substring(26)}` toa.push([vault, gate]) }) - const balances = await sumTokens2({ block, tokensAndOwners: toa, }) - - const wl_stETH_balance = balances[wl_stETH_token] - delete balances[wl_stETH_token] - const { output: unwrappedAsset } = await sdk.api.abi.call({ - target: wl_stETH_token, - abi: abi.asset, - chain, block, - }) - const { output: balance } = await sdk.api.abi.call({ - target: wl_stETH_token, - abi: abi.convertToAssets, - params: wl_stETH_balance, - chain, block, - }) + const balances = await sumTokens2({ api, tokensAndOwners: toa, }) + const wl_stETH = wl_stETH_token + const wl_stETH_balance = balances[wl_stETH] + delete balances[wl_stETH] + const unwrappedAsset = await api.call({ target: wl_stETH_token, abi: abi.asset, }) + const balance = await api.call({ target: wl_stETH_token, abi: abi.convertToAssets, params: wl_stETH_balance, }) sdk.util.sumSingleBalance(balances, unwrappedAsset, balance) return balances diff --git a/projects/timeswap-v2/index.js b/projects/timeswap-v2/index.js new file mode 100644 index 00000000000..d07b58ca7a8 --- /dev/null +++ b/projects/timeswap-v2/index.js @@ -0,0 +1,94 @@ +const { getLogs, getAddress } = require("../helper/cache/getLogs"); +const { sumTokens2 } = require("../helper/unwrapLPs"); + +async function tvl(_, _b, _cb, { api }) { + const { factory, oldFactory, fromBlock, newFactory } = config[api.chain]; + + const logs = await getLogs({ + api, + target: factory, + topics: [ + "0x68ff1cfcdcf76864161555fc0de1878d8f83ec6949bf351df74d8a4a1a2679ab", + ], + fromBlock, + }); + + let ownerTokens = logs.map((i) => { + return [ + [getAddress(i.topics[2]), getAddress(i.topics[3])], + getAddress(i.data), + ]; + }); + if (newFactory) { + const newLogs = await getLogs({ + api, + target: newFactory, + topics: [ + "0x68ff1cfcdcf76864161555fc0de1878d8f83ec6949bf351df74d8a4a1a2679ab", + ], + fromBlock, + }); + const newOwnerTokens = newLogs.map((i) => { + return [ + [getAddress(i.topics[2]), getAddress(i.topics[3])], + getAddress(i.data), + ]; + }); + ownerTokens = [...ownerTokens, ...newOwnerTokens]; + } + if (oldFactory) { + let oldOwnerTokens; + const oldLogs = await getLogs({ + api, + target: oldFactory, + topics: [ + "0x68ff1cfcdcf76864161555fc0de1878d8f83ec6949bf351df74d8a4a1a2679ab", + ], + fromBlock, + }); + oldOwnerTokens = oldLogs.map((i) => { + const token0 = getAddress(i.data.slice(64, 64 * 2 + 2)); + const token1 = getAddress(i.data.slice(64 * 2, 64 * 3 + 2)); + const pool = getAddress(i.data.slice(64 * 3, 64 * 4 + 2)); + return [[token0, token1], pool]; + }); + ownerTokens = [...ownerTokens, ...oldOwnerTokens]; + } + + return sumTokens2({ + api, + ownerTokens, + }); +} + +const config = { + polygon: { + oldFactory: "0xcAB2E5Ba8b3A8d8Bf8B50F0eec12884D0255fB4A", + factory: "0xcf0aca5c5b7e1bF63514D362243b6c50d5761FE8", + newFactory: "0x406d3Dfcbe20b642c2262b29b960822975371502", + fromBlock: 39476334, + }, + ethereum: { + factory: "0xcf0aca5c5b7e1bF63514D362243b6c50d5761FE8", + fromBlock: 16778358, + }, + arbitrum: { + factory: "0xcf0aca5c5b7e1bF63514D362243b6c50d5761FE8", + newFactory: "0x406d3Dfcbe20b642c2262b29b960822975371502", + fromBlock: 70785970, + }, + mantle: { + factory: "0xf8F5e4B7825d484FBDFDC36fc915E79f30b02f9E", + fromBlock: 3563, + }, + polygon_zkevm: { + factory: "0x406d3Dfcbe20b642c2262b29b960822975371502", + fromBlock: 1787343, + } +}; + +module.exports = {}; + +Object.keys(config).forEach((chain) => { + module.exports[chain] = { tvl }; +}); diff --git a/projects/timeswap/index.js b/projects/timeswap/index.js index 50e57e2cf5d..43f21f7c237 100644 --- a/projects/timeswap/index.js +++ b/projects/timeswap/index.js @@ -1,8 +1,5 @@ -const sdk = require("@defillama/sdk"); - const { request, gql } = require("graphql-request"); -const { getBlock } = require("../helper/getBlock"); -const { getChainTransform } = require("../helper/portedTokens"); +const { sumTokens2 } = require('../helper/unwrapLPs') const GRAPH_URLS = { polygon: @@ -10,12 +7,10 @@ const GRAPH_URLS = { }; function chainTvl(chain) { - return async (timestamp, _ethBlock, chainBlocks) => { - const block = await getBlock(timestamp, chain, chainBlocks); - + return async (timestamp, _ethBlock, chainBlocks, { api }) => { const query = gql` { - pairs(block: { number: ${block} }) { + pairs { id asset { id @@ -35,34 +30,11 @@ function chainTvl(chain) { collateral: pair.collateral.id, })); - const balanceCalls = []; - - for (const pair of pairs) { - balanceCalls.push( - { - target: pair.asset, - params: pair.address, - }, - { - target: pair.collateral, - params: pair.address, - } - ); - } - - const tokenBalances = await sdk.api.abi.multiCall({ - abi: "erc20:balanceOf", - calls: balanceCalls, - block, - chain, - }); - - let transform = await getChainTransform(chain); - let balances = {}; - - sdk.util.sumMultiBalanceOf(balances, tokenBalances, true, transform); + const ownerTokens = []; - return balances; + for (const pair of pairs) + ownerTokens.push([[pair.asset, pair.collateral], pair.address]) + return sumTokens2({ api, ownerTokens}) }; } diff --git a/projects/timewarp/abi.json b/projects/timewarp/abi.json index bd1d348ee7d..2ff66f45638 100644 --- a/projects/timewarp/abi.json +++ b/projects/timewarp/abi.json @@ -1,15 +1,3 @@ { - "erc20Deposit": { - "inputs": [], - "name": "erc20Deposit", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } + "erc20Deposit": "address:erc20Deposit" } \ No newline at end of file diff --git a/projects/tinlake/index.js b/projects/tinlake/index.js index a604a340f3e..98bcfc22754 100644 --- a/projects/tinlake/index.js +++ b/projects/tinlake/index.js @@ -1,13 +1,13 @@ +const ADDRESSES = require('../helper/coreAssets.json') const BigNumber = require("bignumber.js"); -const { request, gql } = require("graphql-request"); +const { graphQuery } = require('../helper/http') const data = {} -const subgraphUrl = 'https://api.thegraph.com/subgraphs/name/centrifuge/tinlake'; -const graphTotalTokenTVLQuery = gql` -query GET_TOTAL_TOKEN_TVL($block: Int) { +const subgraphUrl = 'https://graph.centrifuge.io/tinlake/subgraphs/name/allow-null-maturity-date'; +const graphTotalTokenTVLQuery = ` +query GET_TOTAL_TOKEN_TVL { pools( - first: 1000, - block: { number: $block } + first: 1000 ) { id assetValue @@ -15,21 +15,15 @@ query GET_TOTAL_TOKEN_TVL($block: Int) { } } `; -const dai = "0x6b175474e89094c44da98b954eedeac495271d0f" +const dai = ADDRESSES.ethereum.DAI -async function getData(ethBlock) { - return request( - subgraphUrl, - graphTotalTokenTVLQuery, - { - block: ethBlock - } - ) +async function getData(api) { + return graphQuery(subgraphUrl, graphTotalTokenTVLQuery, { api, }) } -async function borrowed(timestamp, ethBlock) { +async function borrowed(timestamp, ethBlock, _, {api }) { let total = BigNumber(0) - if (!data[ethBlock]) data[ethBlock] = await getData(ethBlock) + if (!data[ethBlock]) data[ethBlock] = await getData(api) const { pools } = await data[ethBlock] pools.forEach(pool => { total = total.plus(pool.assetValue) @@ -40,9 +34,9 @@ async function borrowed(timestamp, ethBlock) { } } -async function tvl(timestamp, ethBlock) { +async function tvl(timestamp, ethBlock, _, {api }) { let total = BigNumber(0) - if (!data[ethBlock]) data[ethBlock] = await getData(ethBlock) + if (!data[ethBlock]) data[ethBlock] = await getData(api) const { pools } = await data[ethBlock] pools.forEach(pool => { total = total.plus(pool.reserve) @@ -56,7 +50,7 @@ async function tvl(timestamp, ethBlock) { module.exports = { - doublecounted: false, + timetravel: false, methodology: 'TVL consist of the sum of every pool. The pool value is made up of the NAV (the value of the assets in the pool) and the Pool Reserve (undeployed capital in the pool). The Tinlake subgraph is used to pull the assetValue and reserve values of each pool.', ethereum: { tvl, diff --git a/projects/tipidao/api.js b/projects/tipidao/api.js new file mode 100644 index 00000000000..bea9ee86239 --- /dev/null +++ b/projects/tipidao/api.js @@ -0,0 +1,9 @@ +const index = require('./index') + +module.exports = { + bsc: { + tvl: () => 0, + staking: index.bsc.staking, + } +} + diff --git a/projects/tipidao/index.js b/projects/tipidao/index.js index 843fc1994f2..086376295f2 100644 --- a/projects/tipidao/index.js +++ b/projects/tipidao/index.js @@ -1,15 +1,18 @@ -const { ohmTvl } = require("../helper/ohm"); +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require('../helper/unwrapLPs') const tpd = "0xd0253dbe5606c9fa01db67eb10be5c3675c2b117"; const tpdStaking = "0xAeab776bE63580cB86309CedB49769e6526abbf4"; const treasury = "0x3287f25f8F29e5d65cE566E5a2a1bd336431d8db"; const treasuryTokens = [ - ["0xe9e7cea3dedca5984780bafc599bd69add087d56", false], // BUSD - ["0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c", false], // WBNB - ["0x50bc855ad6a3983589927e5bf3ac0688364ffa64", true] // TPD-BUSD CAKE LP + ADDRESSES.bsc.BUSD, // BUSD + ADDRESSES.bsc.WBNB, // WBNB + "0x50bc855ad6a3983589927e5bf3ac0688364ffa64" // TPD-BUSD CAKE LP ]; module.exports = { - misrepresentedTokens: true, - ...ohmTvl(treasury, treasuryTokens, "bsc", tpdStaking, tpd, undefined, undefined, false) -} \ No newline at end of file + bsc: { + tvl: sumTokensExport({ owner: treasury, tokens: treasuryTokens}), + staking: sumTokensExport({ owner: tpdStaking, tokens: [tpd]}), + } +} diff --git a/projects/titano-swych/index.js b/projects/titano-swych/index.js index b2562009776..94a8ddc0c26 100644 --- a/projects/titano-swych/index.js +++ b/projects/titano-swych/index.js @@ -5,7 +5,6 @@ module.exports = { bsc: { tvl: getUniTVL({ factory: '0x80f112CD8Ac529d6993090A0c9a04E01d495BfBf', - chain: 'bsc', useDefaultCoreAssets: true }) }, diff --git a/projects/titi-finance/index.js b/projects/titi-finance/index.js new file mode 100644 index 00000000000..4642e140c61 --- /dev/null +++ b/projects/titi-finance/index.js @@ -0,0 +1,45 @@ +const ADDRESSES = require('../helper/coreAssets.json'); +const { sumTokensExport } = require('../helper/unknownTokens') + +const ethTiTiToken = "0x3bdffA70f4b4E6985eED50453c7C0D4A15dcEc52"; // TiTi Token +const ethTiTiStaking = "0x5390Dbf4958F21BB317C72744c110977F4c03311"; // TiTi Staking + +const eraTiTiToken = "0x4EBfb78C4780C304dff7de518db630b67e3F044b"; // TiTi Token Era +const eraTiTiStaking = "0x1B05972C2e46288201E0432262bd8e925d4fCF94"; // TiTi Staking Era + +const ethereumLPs = ['0xca4AEf99b3567Dbb631DF0DCd51D446DB7eb63e5'] +const eraLPs = [ + "0x574E2E833A010997840f368edF6542d8950c2788", + "0x228D400F196760432BD8bcE74Fa1e6580aF4BF03", + "0xd4cb4f38de684122Af261ee822Dc1437601e5424", + "0x512f5a62eE69013643f37C12fd8Be391Db7b4550", +] +const lpReservesAbi = 'function getReserves() view returns (uint _reserve0, uint _reserve1)' + +module.exports = { + methodology: `Calculate the reserve-type assets locked in the contract, including the user's stake funds in MarketMakerFund and the reserve of TiUSD issued by the protocol, TiTi-AMMs used to provide liquidity TiUSD is not included`, + ethereum: { + tvl: sumTokensExport({ + owners: [ + "0x49a0c2076DE4801bcadFEf78d0FA63cEC0AD1cB4", // MAMMSwapPair + ], tokens: [ADDRESSES.ethereum.USDC] + }), + staking: sumTokensExport({ owner: ethTiTiStaking, tokens: [ethTiTiToken], lps: ethereumLPs, useDefaultCoreAssets: true, restrictTokenRatio: 5000 }), + pool2: sumTokensExport({ owner: '0x9A132b777FE7af6561BAAb60A03302C697fA8F3B', tokens: ['0x830Ce3859F98104DC600efBFAD90A65386B95404'], lps: ethereumLPs, useDefaultCoreAssets: true, restrictTokenRatio: 1000, resolveLp: true, }), + }, + era: { + tvl: sumTokensExport({ + owners: [ + "0xc856175575F6406b59AD6822c3114494990750DC", // MAMMSwapPair + ], tokens: [ADDRESSES.era.USDC] + }), + staking: sumTokensExport({ owner: eraTiTiStaking, tokens: [eraTiTiToken], lps: eraLPs, useDefaultCoreAssets: true, restrictTokenRatio: 5000, abis: { getReservesABI: lpReservesAbi } }), + pool2: sumTokensExport({ + owners: [ + "0xA690DC59d6afC12d6789f46fc211DdD27f1C7f7c", + "0x2cbCE1EFC624138326877C386692E889D8C7c834", + "0xDc8440CdC50bEe0936bB49De82e80c2439dCEc42" + ], tokens: eraLPs, lps: eraLPs, useDefaultCoreAssets: true, abis: { getReservesABI: lpReservesAbi }, resolveLp: true, restrictTokenRatio: 1000, + }), + }, +} \ No newline at end of file diff --git a/projects/tlchain-decryption/index.js b/projects/tlchain-decryption/index.js new file mode 100644 index 00000000000..f073fabb0d0 --- /dev/null +++ b/projects/tlchain-decryption/index.js @@ -0,0 +1,3 @@ +const { uniTvlExport } = require('../helper/unknownTokens') + +module.exports = uniTvlExport('tlchain', '0x837e7cfe3a85d1419771ebBf975EC78cE9b62f5c') \ No newline at end of file diff --git a/projects/tokemak/index.js b/projects/tokemak/index.js index 4f9956b031d..c65db1ca39b 100644 --- a/projects/tokemak/index.js +++ b/projects/tokemak/index.js @@ -1,26 +1,25 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk') -const { sumTokens, sumTokens2, unwrapCrv, unwrapUniswapLPs, genericUnwrapCvx, } = require('../helper/unwrapLPs') +const { sumTokens2, } = require('../helper/unwrapLPs') const abi = require("../pendle/abi.json"); -const BigNumber = require('bignumber.js') const positions = require('./positions.json'); const cvx_abi = { - "cvxBRP_pid": { "inputs": [], "name": "pid", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, - "cvxBRP_balanceOf": { "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], "name": "balanceOf", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, - "cvxBRP_earned": { "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], "name": "earned", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, - "cvxBRP_rewards": { "inputs": [{ "internalType": "address", "name": "", "type": "address" }], "name": "rewards", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, - "cvxBRP_userRewardPerTokenPaid": { "inputs": [{ "internalType": "address", "name": "", "type": "address" }], "name": "userRewardPerTokenPaid", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, - "cvxBRP_stakingToken": { "inputs": [], "name": "stakingToken", "outputs": [{ "internalType": "address", "name": "stakingToken", "type": "address" }], "stateMutability": "view", "type": "function" }, - "cvxBooster_poolInfo": { "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "name": "poolInfo", "outputs": [{ "internalType": "address", "name": "lptoken", "type": "address" }, { "internalType": "address", "name": "token", "type": "address" }, { "internalType": "address", "name": "gauge", "type": "address" }, { "internalType": "address", "name": "crvRewards", "type": "address" }, { "internalType": "address", "name": "stash", "type": "address" }, { "internalType": "bool", "name": "shutdown", "type": "bool" }], "stateMutability": "view", "type": "function" }, - "stkcvxFRAXBP_lockedStakesOf": {"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"lockedStakesOf","outputs":[{"components":[{"internalType":"bytes32","name":"kek_id","type":"bytes32"},{"internalType":"uint256","name":"start_timestamp","type":"uint256"},{"internalType":"uint256","name":"liquidity","type":"uint256"},{"internalType":"uint256","name":"ending_timestamp","type":"uint256"},{"internalType":"uint256","name":"lock_multiplier","type":"uint256"}],"internalType":"struct FraxUnifiedFarm_ERC20.LockedStake[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"} + cvxBRP_pid: "uint256:pid", + cvxBRP_balanceOf: "function balanceOf(address account) view returns (uint256)", + cvxBRP_earned: "function earned(address account) view returns (uint256)", + cvxBRP_rewards: "function rewards(address) view returns (uint256)", + cvxBRP_userRewardPerTokenPaid: "function userRewardPerTokenPaid(address) view returns (uint256)", + cvxBRP_stakingToken: "address:stakingToken", + cvxBooster_poolInfo: "function poolInfo(uint256) view returns (address lptoken, address token, address gauge, address crvRewards, address stash, bool shutdown)", + stkcvxFRAXBP_lockedStakesOf: "function lockedStakesOf(address account) view returns (tuple(bytes32 kek_id, uint256 start_timestamp, uint256 liquidity, uint256 ending_timestamp, uint256 lock_multiplier)[])", } -const cvxBoosterAddress = "0xF403C135812408BFbE8713b5A23a04b3D48AAE31"; const degenesisContract = "0xc803737D3E12CC4034Dde0B2457684322100Ac38"; const wethPool = "0xD3D13a578a53685B4ac36A1Bab31912D2B2A2F36"; const usdcPool = "0x04bda0cf6ad025948af830e75228ed420b0e860d"; -const usdc = "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"; -const weth = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"; +const usdc = ADDRESSES.ethereum.USDC; +const weth = ADDRESSES.ethereum.WETH; const ohmPool = "0xe7a7D17e2177f66D035d9D50A7f48d8D8E31532D"; const ohm = "0x383518188C0C6d7730D91b2c03a03C837814a899"; const gohmPool = "0x41f6a95Bacf9bC43704c4A4902BA5473A8B00263"; @@ -31,20 +30,20 @@ const fxsPool = "0xADF15Ec41689fc5b6DcA0db7c53c9bFE7981E655"; const fxs = "0x3432B6A60D23Ca0dFCa7761B7ab56459D9C964D0"; const tcrPool = "0x15A629f0665A3Eb97D7aE9A7ce7ABF73AeB79415"; const tcr = "0x9C4A4204B79dd291D6b6571C5BE8BbcD0622F050"; -const toke = "0x2e9d63788249371f1dfc918a52f8d799f4a38c94"; +const toke = ADDRESSES.ethereum.TOKE; const rtoke1 = "0xa760e26aA76747020171fCF8BdA108dFdE8Eb930"; const rtoke2 = "0x96f98ed74639689c3a11daf38ef86e59f43417d3"; const rtoke3 = "0xA374A62DdBd21e3d5716cB04821CB710897c0972"; const sushiPool = "0xf49764c9C5d644ece6aE2d18Ffd9F1E902629777"; -const sushi = "0x6B3595068778DD592e39A122f4f5a5cF09C90fE2"; +const sushi = ADDRESSES.ethereum.SUSHI; const fraxPool = "0x94671A3ceE8C7A12Ea72602978D1Bb84E920eFB2"; -const frax = "0x853d955acef822db058eb8505911ed77f175b99e"; +const frax = ADDRESSES.ethereum.FRAX; const daiPool = "0x0CE34F4c26bA69158BC2eB8Bf513221e44FDfB75"; -const dai = "0x6b175474e89094c44da98b954eedeac495271d0f"; +const dai = ADDRESSES.ethereum.DAI; const feiPool = "0x03DccCd17CC36eE61f9004BCfD7a85F58B2D360D"; const fei = "0x956F47F50A910163D8BF957Cf5846D573E7f87CA"; const lusdPool = "0x9eEe9eE0CBD35014e12E1283d9388a40f69797A3"; -const lusd = "0x5f98805A4E8be255a32880FDeC7F6728C6568bA0"; +const lusd = ADDRESSES.ethereum.LUSD; const wormUstPool = "0x482258099De8De2d0bda84215864800EA7e6B03D"; const wormtust = "0xa693b19d2931d498c5b318df961919bb4aee87a5"; const foxPool = "0x808D3E6b23516967ceAE4f17a5F9038383ED5311"; @@ -52,7 +51,7 @@ const fox = "0xc770eefad204b5180df6a14ee197d99d808ee52d"; const apwPool = "0xDc0b02849Bb8E0F126a216A2840275Da829709B0"; const apw = "0x4104b135dbc9609fc1a9490e61369036497660c8"; const snxPool = "0xeff721Eae19885e17f5B80187d6527aad3fFc8DE"; -const snx = "0xc011a73ee8576fb46f5e1c5751ca3b9fe0af2a6f"; +const snx = ADDRESSES.ethereum.SNX; const gamma = '0x6bea7cfef803d1e3d5f7c0103f7ded065644e197'; const gammaPool = '0x2Fc6e9c1b2C07E18632eFE51879415a580AD22E1'; const mim = '0x99d8a9c45b2eca8864373a26d1459e3dff1e17f3'; @@ -63,14 +62,14 @@ const uni = "0x5fa464cefe8901d66c09b85d5fcdc55b3738c688"; const uniStaking = "0x1b429e75369ea5cd84421c1cc182cee5f3192fd3"; const alusd = "0xBC6DA0FE9aD5f3b0d58160288917AA56653660E9"; const alusdPool = "0x7211508D283353e77b9A7ed2f22334C219AD4b4C"; -const steth = "0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84"; +const steth = ADDRESSES.ethereum.STETH; const crvSteth = "0xDC24316b9AE028F1497c275EB9192a3Ea0f67022"; const myc = "0x4b13006980acb09645131b91d259eaa111eaf5ba"; const mycPool = "0x061aee9ab655e73719577EA1df116D7139b2A7E7"; const visr = "0xF938424F7210f31dF2Aee3011291b658f872e91e"; const visrPool = "0x2d3eADE781c4E203c6028DAC11ABB5711C022029"; -async function tvl(timestamp, block) { +async function tvl(timestamp, block, _, { api }) { const cvxUSTWPool = "0x7e2b9b5244bcfa5108a76d5e7b507cfd5581ad4a"; const cvxFRAXPool = "0xB900EF131301B307dB5eFcbed9DBb50A3e209B2e"; const cvxalUSDPool = "0x02E2151D4F351881017ABdF2DD2b51150841d5B3"; @@ -105,110 +104,56 @@ async function tvl(timestamp, block) { [alusd, alusdPool], [myc, mycPool], [visr, visrPool], - [steth, tokeTreasury] + [steth, tokeTreasury], + [cvxstethPool, tokeManager], + [cvxUSTWPool, tokeManager], + [cvxFRAXPool, tokeManager], + [cvxalUSDPool, tokeManager], ] - const balances = await sumTokens2({ block, tokensAndOwners: toa }) - await Promise.all([ - unwrapCvxSteth(balances, tokeManager, cvxstethPool, block, "ethereum"), - genericUnwrapCvx(balances, tokeManager, cvxUSTWPool, block, "ethereum"), - genericUnwrapCvx(balances, tokeManager, cvxFRAXPool, block, "ethereum"), - genericUnwrapCvx(balances, tokeManager, cvxalUSDPool, block, "ethereum"), - ]) + const balances = {} // cvxcrvFRAX const cvxFraxUsdcPool = "0x7e880867363A7e321f5d260Cade2B0Bb2F717B02"; - const { output: cvxcrvFraxBal } = await sdk.api.abi.call({ + const cvxcrvFraxBal = await api.call({ abi: cvx_abi['cvxBRP_balanceOf'], target: cvxFraxUsdcPool, params: [tokeManager], - chain: "ethereum", - block }); const fraxFraxUsdcPool = "0x963f487796d54d2f27bA6F3Fbe91154cA103b199"; - const { output: treasuryFraxBal } = await sdk.api.abi.call({ + const treasuryFraxBal = await api.call({ abi: cvx_abi['stkcvxFRAXBP_lockedStakesOf'], target: fraxFraxUsdcPool, params: [tokeTreasuryFraxConvexVault], - chain: "ethereum", - block }); - const fraxUsdcBal = BigNumber(cvxcrvFraxBal).plus(BigNumber(treasuryFraxBal[0]['liquidity'])); - balances[cvxcrvFrax] = fraxUsdcBal.toFixed(); /// cvxcvxFXS const cvxcvxFxsPool = "0xf27AFAD0142393e4b3E5510aBc5fe3743Ad669Cb"; - const { output: cvxcvxFxsBal } = await sdk.api.abi.call({ + const cvxcvxFxsBal = await api.call({ abi: cvx_abi['cvxBRP_balanceOf'], target: cvxcvxFxsPool, params: [tokeTreasury], - chain: "ethereum", - block }); - balances[cvxcvxFxs] = cvxcvxFxsBal; + sdk.util.sumSingleBalance(balances, cvxcrvFrax, cvxcrvFraxBal) + sdk.util.sumSingleBalance(balances, cvxcrvFrax, treasuryFraxBal[0]['liquidity']) + sdk.util.sumSingleBalance(balances, cvxcvxFxs, cvxcvxFxsBal) let curveHoldings = positions.exchanges.filter( pool => pool.type == 'Curve') let uniHoldings = positions.exchanges.filter( pool => pool.type != 'Curve') - await lpBalances(block, balances, curveHoldings) - await lpBalances(block, balances, uniHoldings) + const tokens = [] + const calls = [] + lpBalances(curveHoldings, toa, tokens, calls,) + lpBalances(uniHoldings, toa, tokens, calls) + const amountRes = await api.multiCall({ abi: abi.userInfo, calls }) + tokens.forEach((val, i) => sdk.util.sumSingleBalance(balances, val, amountRes[i].amount, api.chain)) - return balances -} - -async function unwrapCvxSteth(balances, holder, cvx_BaseRewardPool, block, chain) { - const [{ output: cvx_LP_bal }, { output: pool_id }] = await Promise.all([ - sdk.api.abi.call({ - abi: cvx_abi['cvxBRP_balanceOf'], - target: cvx_BaseRewardPool, - params: [holder], - block - }), - sdk.api.abi.call({ - abi: cvx_abi['cvxBRP_pid'], - target: cvx_BaseRewardPool, - block - }) - ]) - - const { output: crvPoolInfo } = await sdk.api.abi.call({ - abi: cvx_abi['cvxBooster_poolInfo'], - target: cvxBoosterAddress, - params: [pool_id], - block: block, - }) - const { output: resolvedCrvTotalSupply } = await sdk.api.erc20.totalSupply({ - target: crvPoolInfo.lptoken, - block - }) - - const crvLP_steth_balance = await sdk.api.abi.call({ - abi: 'erc20:balanceOf', - target: steth, - params: crvSteth, - block - }) - sdk.util.sumSingleBalance( - balances, - steth, - BigNumber(crvLP_steth_balance.output) - .times(cvx_LP_bal).div(resolvedCrvTotalSupply).toFixed(0) - ) - const crvLP_eth_balance = await sdk.api.eth.getBalance({ - target: crvSteth, - block - }) - sdk.util.sumSingleBalance( - balances, - weth, - BigNumber(crvLP_eth_balance.output) - .times(cvx_LP_bal).div(resolvedCrvTotalSupply).toFixed(0) - ) + return sumTokens2({ balances, api, tokensAndOwners: toa, }) } -async function lpBalances(block, balances, holdings) { +function lpBalances(holdings, toa, tokens, calls) { const manager = "0xA86e412109f77c45a3BC1c5870b880492Fb86A14" let masterChef switch (holdings[0].type) { @@ -218,52 +163,25 @@ async function lpBalances(block, balances, holdings) { masterChef = "0xc2EdaD668740f1aA35E4D8f227fB8E17dcA888Cd"; break; } - let lpPositions = [] for (let pool of holdings) { - const wallet = (await sdk.api.abi.call({ - block, - target: pool.pool_address, - abi: 'erc20:balanceOf', - params: [manager] - })).output; - - if (wallet > 0) { - holdings[0].type == 'Curve' ? - await unwrapCrv(balances, pool.pool_address, wallet, block) : - lpPositions.push({ balance: wallet, token: pool.pool_address }) - } - - if (!pool.hasOwnProperty('staking')) { + const { pool_address: token } = pool + toa.push([token, manager]) + if (!pool.hasOwnProperty('staking')) continue - } - const staked = (await sdk.api.abi.call({ - block, - target: masterChef, - abi: abi.userInfo, - params: [pool.staking.pool_id, manager] - })).output.amount; - - if (staked > 0) { - holdings[0].type == 'Curve' ? - await unwrapCrv(balances, pool.pool_address, staked, block) : - lpPositions.push({ balance: staked, token: pool.pool_address }) - } + tokens.push(token) + calls.push({ target: masterChef, params: [pool.staking.pool_id, manager] }) } - await unwrapUniswapLPs(balances, lpPositions, block) } -async function staking(timestamp, block) { - let balances = {} - await sumTokens(balances, [ - [toke, rtoke1], [toke, rtoke2], [toke, rtoke3] - ], block) +async function staking(timestamp, block, _, { api }) { let vestedToke = '57238445' - let balance = balances[toke]/1e18 - vestedToke - if (balance < 0) balance = 0 - return { - tokemak: BigNumber(balance).toFixed(0) - } + api.add(ADDRESSES.ethereum.TOKE, vestedToke * 1e18 * -1) + return sumTokens2({ + api, tokensAndOwners: [ + [toke, rtoke1], [toke, rtoke2], [toke, rtoke3] + ] + }) } async function pool2(timestamp, block) { diff --git a/projects/tokenlon/abi.json b/projects/tokenlon/abi.json index d48ab40395b..275042799e1 100644 --- a/projects/tokenlon/abi.json +++ b/projects/tokenlon/abi.json @@ -1,41 +1,5 @@ { - "pmmAddr": { - "inputs": [], - "name": "pmmAddr", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "ammWrapperAddr": { - "inputs": [], - "name": "ammWrapperAddr", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "stakingToken": { - "inputs": [], - "name": "stakingToken", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } + "pmmAddr": "address:pmmAddr", + "ammWrapperAddr": "address:ammWrapperAddr", + "stakingToken": "address:stakingToken" } \ No newline at end of file diff --git a/projects/tokenlon/index.js b/projects/tokenlon/index.js index f610dd037be..d898b00d1ca 100644 --- a/projects/tokenlon/index.js +++ b/projects/tokenlon/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); const { covalentGetTokens } = require("../helper/http"); @@ -29,7 +30,7 @@ const STAGES_STAKING_CONTRACTS = [ // Receives rewards/fee from AMM wrapper via reward distributor on WETH shape, some are sold for LON... const MULTISIG_ONE = "0x3557BD3d422300198719710Cc3f00194E1c20A46"; -const WETH = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"; +const WETH = ADDRESSES.ethereum.WETH; const ethTvl = async (timestamp, block) => { const amm_wrapper_addr = ( @@ -51,8 +52,8 @@ const ethTvl = async (timestamp, block) => { const [ tokens_amm, tokens_pmm] = await Promise.all([covalentGetTokens(amm_wrapper_addr), covalentGetTokens(pmm_addr)]) const toa = [] - tokens_amm.forEach(t => toa.push([t.contract_address, amm_wrapper_addr])) - tokens_pmm.forEach(t => toa.push([t.contract_address, pmm_addr])) + tokens_amm.forEach(t => toa.push([t, amm_wrapper_addr])) + tokens_pmm.forEach(t => toa.push([t, pmm_addr])) return sumTokens2({ tokensAndOwners: toa, block, }); }; @@ -62,15 +63,6 @@ module.exports = { tvl: ethTvl, staking: staking(CONTRACT_FOR_STAKING, LON_TOKEN), pool2: (_, block) => sumTokens2({ tokensAndOwners: STAGES_STAKING_CONTRACTS, block, resolveLP: true }), - treasury: (_, block) => sumTokens2({ owner: MULTISIG_ONE, tokens: [ - '0xdac17f958d2ee523a2206206994597c13d831ec7', - '0x55d31f68975e446a40a2d02ffa4b0e1bfb233c2f', - '0x8E870D67F660D95d5be530380D0eC0bd388289E1', //USDP - '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', //USDC - '0x0000000000085d4780B73119b644AE5ecd22b376', //TUSD - '0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984', //UNI - - ], block, }), }, }; diff --git a/projects/tokensfarm/index.js b/projects/tokensfarm/index.js index a9e6d88c4bf..571d94fd02b 100644 --- a/projects/tokensfarm/index.js +++ b/projects/tokensfarm/index.js @@ -6,7 +6,7 @@ function fetch(chain) { let response = await get('https://api.tokensfarm.com/totals') return toUSDTBalances(response.totals.tvl[chain]); }; -}; +} module.exports = { timetravel: false, diff --git a/projects/tomb-swap/index.js b/projects/tomb-swap/index.js index a4da5e045ee..5d18240374c 100644 --- a/projects/tomb-swap/index.js +++ b/projects/tomb-swap/index.js @@ -5,7 +5,6 @@ const { getUniTVL } = require("../helper/unknownTokens") fantom: { tvl: getUniTVL({ factory: '0xE236f6890F1824fa0a7ffc39b1597A5A6077Cfe9', - chain: 'fantom', useDefaultCoreAssets: true, }) }, diff --git a/projects/tomb/index.js b/projects/tomb/index.js index 584b3f62051..14db39e8c5a 100644 --- a/projects/tomb/index.js +++ b/projects/tomb/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const { sumTokens2 } = require("../helper/unwrapLPs"); @@ -41,12 +42,12 @@ async function staking(timestamp, _b, { [chain]: block }) { async function lif3GenesisTVL(timestamp, _b, { [chain]: block }) { const tokens = [ - '0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83', // WFTM - '0x04068da6c83afcfa0e13ba15a6696662335d5b75', // USDC + ADDRESSES.fantom.WFTM, // WFTM + ADDRESSES.fantom.USDC, // USDC '0x321162Cd933E2Be498Cd2267a90534A804051b11', // BTC '0x74b23882a30290451A17c44f4F05243b6b58C76d', // ETH - '0x8d11ec38a3eb5e956b052f67da8bdc9bef8abf3e', // DAI - '0x82f0b8b456c1a451378467398982d4834b6829c1', // MIM + ADDRESSES.fantom.DAI, // DAI + ADDRESSES.fantom.MIM, // MIM '0x8d7d3409881b51466b483b11ea1b8a03cded89ae', // BASED '0x49c290ff692149a4e16611c694fded42c954ab7a', // BSHARE '0x09e145a1d53c0045f41aeef25d8ff982ae74dd56', // Zoo diff --git a/projects/tonic-cash/config.js b/projects/tonic-cash/config.js new file mode 100644 index 00000000000..7af12226db4 --- /dev/null +++ b/projects/tonic-cash/config.js @@ -0,0 +1,63 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress } = require('../helper/unwrapLPs'); + +module.exports = { + klaytn: [ + { + tokens: [nullAddress], // KLAY + holders: [ + '0x033237b3d6ABCb7d48C5A40Ec3038A53aEc1b77e', + '0x7b853e8387FC6bcFCAa9BDab8d0479E6c9E6782b', + '0x457Caf470fB1031530E8cdD06703da7B1BbCCe04', + '0x9694ea20de96D5E46C8FE1E7975D7a2C7C79Bf2c', + ], + }, + { + tokens: ['0xcee8faf64bb97a73bb51e115aa89c17ffa8dd167'], // oUSDT + holders: [ + '0x528AE79DAe416bf9623B94fA6Baef0FC3dd12ef8', + '0xc69C9bBabEDE59562Cd8a6F92Fa50aFf10D8310e', + '0x503d6D4E14A2A4f78f4c3E51c94F1F53C6bd6D96', + '0x804aA592f7bF0B7EB98db08825D1106eC4822fb3', + ], + }, + { + tokens: ['0x34d21b1e550d73cee41151c77f3c73359527a396'], // oETH + holders: [ + '0x70D8D865d556f7D03c463e296ac706CE11B73d4B', + '0x402f2297f15b6fc9415D6F193ae882a3879b5F09', + '0xCFa2494dddB338c2fd15224B4Eb9668a5C4de695', + '0xD10aaD96548CAa7874e435Db0d9676b64554092b', + ], + }, + ], + wemix: [ + { + tokens: [nullAddress], // WEMIX + holders: [ + '0x033237b3d6ABCb7d48C5A40Ec3038A53aEc1b77e', + '0x7b853e8387FC6bcFCAa9BDab8d0479E6c9E6782b', + '0x457Caf470fB1031530E8cdD06703da7B1BbCCe04', + '0x9694ea20de96D5E46C8FE1E7975D7a2C7C79Bf2c', + ], + }, + { + tokens: [ADDRESSES.wemix.WEMIX_], // WEMIXDollar + holders: [ + '0x144120Ef18d4223Ab3f4695653a5755C23FBF469', + '0xc978f195C838d3344f74DDBA84235130B3091847', + '0xeD4a38cC990a6E5D817C9d89677c886994803d38', + '0xAc04FDbADd7CF8d4BaD0F957d37e3fd0c093A9B6', + ], + }, + { + tokens: [ADDRESSES.shiden.ETH], // ETH + holders: [ + '0x2D3bAeBa85D78D202887D34f5618380e90F3c272', + '0xD2510D275dbca0fe333dAff8Eb51b9105f6aC212', + '0xE1d1c5094d5eEF16E0207834b2E5FDf634278217', + '0xfF30E4d7ec19a45710049033d1E51C1a6848E1FA', + ], + }, + ], +}; diff --git a/projects/tonic-cash/index.js b/projects/tonic-cash/index.js new file mode 100644 index 00000000000..e4a5468b80e --- /dev/null +++ b/projects/tonic-cash/index.js @@ -0,0 +1,11 @@ +const { sumTokensExport } = require('../helper/unwrapLPs'); +const config = require('./config.js'); + +Object.keys(config).forEach((chain) => { + const tokensAndOwners = config[chain].flatMap(({ tokens, holders }) => + holders.flatMap(o => tokens.map(t => [t, o])) + ); + module.exports[chain] = { + tvl: sumTokensExport({ tokensAndOwners }), + }; +}); diff --git a/projects/tonic/index.js b/projects/tonic/index.js new file mode 100644 index 00000000000..6e872c53ff3 --- /dev/null +++ b/projects/tonic/index.js @@ -0,0 +1,45 @@ +const { call, view_account, addTokenBalances, sumSingleBalance } = require('../helper/chain/near'); + +const ORDERBOOK_CONTRACT = 'v1.orderbook.near'; +const PERPS_CONTRACT = 'v1.tonic-perps.near'; +const GET_MARKETS_METHOD = 'list_markets'; +const GET_ASSETS_METHOD = 'get_assets'; +const FT_NEAR = 'wrap.near'; +const NATIVE_NEAR = 'near'; +const RAINBOW_USDC = 'a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48.factory.bridge.near'; +const MARKET_ACTIVE_STATE = 'Active'; + + +async function tvl() { + // Spot orderbook + let listedTokensOrderbook = (await call(ORDERBOOK_CONTRACT, GET_MARKETS_METHOD, {"from_index": 0, "limit": 100})) + .filter(market => market.state === MARKET_ACTIVE_STATE) + .map(market => market['base_token']['token_type']['account_id']) + .filter(token => token && token.length > 0 && token !== NATIVE_NEAR); + listedTokensOrderbook = [...new Set(listedTokensOrderbook)]; + // Used as primary quote currency + listedTokensOrderbook.push(RAINBOW_USDC); + let balances = await addTokenBalances(listedTokensOrderbook, ORDERBOOK_CONTRACT); + + const orderbook_contract_state = await view_account(ORDERBOOK_CONTRACT); + sumSingleBalance(balances, FT_NEAR, orderbook_contract_state['amount']); + + + // Perps + let listedTokensPerps = (await call(PERPS_CONTRACT, GET_ASSETS_METHOD, {})) + .filter(asset => asset.id !== NATIVE_NEAR) + .map(asset => asset.id); + balances = await addTokenBalances(listedTokensPerps, PERPS_CONTRACT, balances); + const perps_contract_state = await view_account(PERPS_CONTRACT); + sumSingleBalance(balances, FT_NEAR, perps_contract_state['amount']); + return balances; +} + + +module.exports = { + timetravel: false, + near: { + tvl, + }, + methodology: 'Sum all tokens deposited into Tonic DEX' +} diff --git a/projects/tonswap/index.js b/projects/tonswap/index.js index aa9c21c1f6f..60d57546e46 100644 --- a/projects/tonswap/index.js +++ b/projects/tonswap/index.js @@ -13,8 +13,11 @@ async function fetch() { (a, c) => new BigNumber(a).plus(c)); return tvl; -}; +} module.exports = { + everscale: { + fetch + }, fetch }; diff --git a/projects/topshelf/index.js b/projects/topshelf/index.js index 8e942053276..86131222768 100644 --- a/projects/topshelf/index.js +++ b/projects/topshelf/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const {getLiquityTvl} = require('../helper/liquity') const sdk = require('@defillama/sdk'); const { sumTokens } = require('../helper/unwrapLPs'); @@ -9,8 +10,8 @@ async function fantomCurveLps(timestamp, ethBlock, chainBlocks){ ["0x8b63f036f5a34226065bc0a7b0ae5bb5eba1ff3d", "0x59f58431d4cba2b7e9e8d78f064a8fa24c5134bf"], //ftm ], chainBlocks.fantom, "fantom", addr=>{ return "fantom:"+{ - "0x6ef78ad4a40e9a6c81b9229de3ecc33ce591bc34":"0x82f0b8b456c1a451378467398982d4834b6829c1", - "0x8b63f036f5a34226065bc0a7b0ae5bb5eba1ff3d":"0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83", + "0x6ef78ad4a40e9a6c81b9229de3ecc33ce591bc34":ADDRESSES.fantom.MIM, + "0x8b63f036f5a34226065bc0a7b0ae5bb5eba1ff3d":ADDRESSES.fantom.WFTM, }[addr.toLowerCase()] }) return balances @@ -20,15 +21,15 @@ module.exports = { timetravel: true, methodology: "Deposited AVAX, BNB and FTM on all three chains as well as deposits in staking pools. g3CRV is replaced by MIM", bsc:{ - tvl: getLiquityTvl("0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c", "0x15102B7579aE3b913B0cbb2edE791fC58C528195", "bsc") + tvl: getLiquityTvl(ADDRESSES.bsc.WBNB, "0x15102B7579aE3b913B0cbb2edE791fC58C528195", "bsc") }, avax:{ - tvl: getLiquityTvl("0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7", "0x41c36D163DB9e58608F4B354FfB3893EF472E9fd", "avax") + tvl: getLiquityTvl(ADDRESSES.avax.WAVAX, "0x41c36D163DB9e58608F4B354FfB3893EF472E9fd", "avax") }, fantom:{ tvl: sdk.util.sumChainTvls([ - getLiquityTvl("0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83", "0x5420d619823b7d836341524C55f3c24B4D497c72", "fantom"), - getLiquityTvl("0x82f0b8b456c1a451378467398982d4834b6829c1", "0x16E900A379873351D6922881388548e4eee5c611", "fantom"), + getLiquityTvl(ADDRESSES.fantom.WFTM, "0x5420d619823b7d836341524C55f3c24B4D497c72", "fantom"), + getLiquityTvl(ADDRESSES.fantom.MIM, "0x16E900A379873351D6922881388548e4eee5c611", "fantom"), fantomCurveLps ]) } diff --git a/projects/toreus/index.js b/projects/toreus/index.js new file mode 100644 index 00000000000..01ee4202325 --- /dev/null +++ b/projects/toreus/index.js @@ -0,0 +1,14 @@ +const { staking } = require("../helper/staking"); +const { aaveExports } = require("../helper/aave"); + +const stakingContract = "0x2911c3a3b497Af71aAcbB9B1E9FD3ee5D50f959D"; +const TOREUS = "0x8549724fcC84ee9ee6c7A676F1Ba2Cc2f43AAF5B"; + +module.exports = { + methodology: + "Counts the tokens locked in the contracts to be used as collateral to borrow or to earn yield. Borrowed coins are not counted towards the TVL, so only the coins actually locked in the contracts are counted. There's multiple reasons behind this but one of the main ones is to avoid inflating the TVL through cycled lending", + kava: { + ...aaveExports("kava", "0xcCe311383b0f4A41c82D8d03a1f4214A3c8E70Bd"), + staking: staking(stakingContract, TOREUS, "kava"), + }, +}; \ No newline at end of file diff --git a/projects/tornadao/index.js b/projects/tornadao/index.js index 9b0a5942798..01531ccddc0 100644 --- a/projects/tornadao/index.js +++ b/projects/tornadao/index.js @@ -1,9 +1,10 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { ohmTvl } = require('../helper/ohm') const treasury = "0x68bb6883B44F4Ab37596b6189FAe354E937D4990" module.exports = ohmTvl(treasury, [ ["0x130966628846bfd36ff31a822705796e8cb8c18d", false],//mim - ["0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7", false],//avax + [ADDRESSES.avax.WAVAX, false],//avax ["0xaef85b5b06b13b79b17fd684b1f04035570a9ae0", true],//joeLP ["0xe750f3b821d4bc696f977756cd3b1b5e0ae00647", true],//joeLP ], "avax", "0x39Af1EB019750aDc3Ea89D80080079F64D5432dB", "0xb80323c7aa915cb960b19b5cca1d88a2132f7bd1") \ No newline at end of file diff --git a/projects/tornado/config.js b/projects/tornado/config.js index 7b54cc4a77f..65df9122a77 100644 --- a/projects/tornado/config.js +++ b/projects/tornado/config.js @@ -1,17 +1,19 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress } = require('../helper/unwrapLPs') + module.exports = { ethereum: [ { - tokens: [], + tokens: [nullAddress], holders: [ "0x12d66f87a04a9e220743712ce6d9bb1b5616b8fc", // 0.1 ETH "0x47ce0c6ed5b0ce3d3a51fdb1c52dc66a7c3c2936", // 1 ETH "0x910cbd523d972eb0a6f4cae4618ad62622b39dbf", // 10 ETH "0xa160cdab225685da1d56aa342ad8841c3b53f291", // 100 ETH ], - checkETHBalance: true, }, { - tokens: '0x6b175474e89094c44da98b954eedeac495271d0f', // DAI + tokens: [ADDRESSES.ethereum.DAI], // DAI holders: [ "0xD4B88Df4D29F5CedD6857912842cff3b20C8Cfa3", "0xFD8610d20aA15b7B2E3Be39B396a1bC3516c7144", @@ -20,7 +22,7 @@ module.exports = { ], }, { - tokens: '0xdac17f958d2ee523a2206206994597c13d831ec7', // USDT + tokens: [ADDRESSES.ethereum.USDT], // USDT holders: [ "0x169AD27A470D064DEDE56a2D3ff727986b15D52B", "0x0836222F2B2B24A3F36f98668Ed8F0B38D1a872f", @@ -29,7 +31,7 @@ module.exports = { ], }, { - tokens: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', // USDC + tokens: [ADDRESSES.ethereum.USDC], // USDC holders: [ "0xd96f2B1c14Db8458374d9Aca76E26c3D18364307", "0x4736dCf1b7A3d580672CcE6E7c65cd5cc9cFBa9D", @@ -37,7 +39,7 @@ module.exports = { ], }, { - tokens: '0x2260fac5e5542a773aa44fbcfedf7c193bc2c599', // WBTC + tokens: [ADDRESSES.ethereum.WBTC], // WBTC holders: [ "0x178169B423a011fff22B9e3F3abeA13414dDD0F1", "0x610B717796ad172B316836AC95a2ffad065CeaB4", @@ -45,7 +47,7 @@ module.exports = { ], }, { - tokens: '0x5d3a536e4d6dbd6114cc1ead35777bab948e3643', // cDAI + tokens: ['0x5d3a536e4d6dbd6114cc1ead35777bab948e3643'], // cDAI holders: [ "0x22aaA7720ddd5388A3c0A3333430953C68f1849b", "0x03893a7c7463AE47D46bc7f091665f1893656003", @@ -56,73 +58,67 @@ module.exports = { ], bsc: [ { - tokens: [], + tokens: [nullAddress], holders: [ "0x84443CFd09A48AF6eF360C6976C5392aC5023a1F", // 0.1 BNB "0xd47438C816c9E7f2E2888E060936a499Af9582b3", // 1 BNB "0x330bdFADE01eE9bF63C209Ee33102DD334618e0a", // 10 BNB "0x1E34A77868E19A6647b1f2F47B51ed72dEDE95DD", // 100 BNB ], - checkETHBalance: true, }, ], polygon: [ { - tokens: [], + tokens: [nullAddress], holders: [ "0x1E34A77868E19A6647b1f2F47B51ed72dEDE95DD", // 100 "0xdf231d99Ff8b6c6CBF4E9B9a945CBAcEF9339178", // 1000 "0xaf4c0B70B2Ea9FB7487C7CbB37aDa259579fe040", // 10000 "0xa5C2254e4253490C54cef0a4347fddb8f75A4998", // 100000 ], - checkETHBalance: true, }, ], optimism: [ { - tokens: [], + tokens: [nullAddress], holders: [ "0x84443CFd09A48AF6eF360C6976C5392aC5023a1F", // 0.1 ETH "0xd47438C816c9E7f2E2888E060936a499Af9582b3", // 1 ETH "0x330bdFADE01eE9bF63C209Ee33102DD334618e0a", // 10 ETH "0x1E34A77868E19A6647b1f2F47B51ed72dEDE95DD", // 100 ETH ], - checkETHBalance: true, }, ], arbitrum: [ { - tokens: [], + tokens: [nullAddress], holders: [ "0x84443CFd09A48AF6eF360C6976C5392aC5023a1F", // 0.1 ETH "0xd47438C816c9E7f2E2888E060936a499Af9582b3", // 1 ETH "0x330bdFADE01eE9bF63C209Ee33102DD334618e0a", // 10 ETH "0x1E34A77868E19A6647b1f2F47B51ed72dEDE95DD", // 100 ETH ], - checkETHBalance: true, }, ], xdai: [ { - tokens: [], + tokens: [nullAddress], holders: [ "0x1E34A77868E19A6647b1f2F47B51ed72dEDE95DD", // 100 "0xdf231d99Ff8b6c6CBF4E9B9a945CBAcEF9339178", // 1000 "0xaf4c0B70B2Ea9FB7487C7CbB37aDa259579fe040", // 10000 "0xa5C2254e4253490C54cef0a4347fddb8f75A4998", // 100000 ], - checkETHBalance: true, }, ], avax: [ { - tokens: [], + tokens: [nullAddress], holders: [ "0x330bdFADE01eE9bF63C209Ee33102DD334618e0a", // 10 "0x1E34A77868E19A6647b1f2F47B51ed72dEDE95DD", // 100 "0xaf8d1839c3c67cf571aa74B5c12398d4901147B3", // 500 ], - checkETHBalance: true, }, ], } \ No newline at end of file diff --git a/projects/tornado/index.js b/projects/tornado/index.js index eac24fae81e..06171665be6 100644 --- a/projects/tornado/index.js +++ b/projects/tornado/index.js @@ -1,27 +1,14 @@ -const {tokenHolderBalances} = require('../helper/tokenholders') +const { sumTokens2, sumTokensExport } = require('../helper/unwrapLPs') -const { ethereum, bsc, polygon, optimism, arbitrum, xdai, avax } = require('./config.js') +const config = require('./config.js') -module.exports={ - ethereum: { - tvl: tokenHolderBalances(ethereum) - }, - bsc: { - tvl: tokenHolderBalances(bsc, 'bsc') - }, - polygon: { - tvl: tokenHolderBalances(polygon, 'polygon') - }, - optimism: { - tvl: tokenHolderBalances(optimism, 'optimism') - }, - arbitrum: { - tvl: tokenHolderBalances(arbitrum, 'arbitrum') - }, - xdai: { - tvl: tokenHolderBalances(xdai, 'xdai') - }, - avax: { - tvl: tokenHolderBalances(avax, 'avax') - }, -} \ No newline at end of file + +module.exports = { +}; + +Object.keys(config).forEach(chain => { + const tokensAndOwners = config[chain].map(({ tokens, holders }) => holders.map(o => tokens.map(t => [t, o])).flat()).flat() + module.exports[chain] = { + tvl: sumTokensExport({ tokensAndOwners }) + } +}) \ No newline at end of file diff --git a/projects/toros/abis.js b/projects/toros/abis.js index 22c868d216d..938c9930d52 100644 --- a/projects/toros/abis.js +++ b/projects/toros/abis.js @@ -1,98 +1,8 @@ -const DHEDGE_FACTORY_ABI = { - inputs: [ - { - internalType: "address", - name: "manager", - type: "address", - }, - ], - name: "getManagedPools", - outputs: [ - { - internalType: "address[]", - name: "managedPools", - type: "address[]", - }, - ], - stateMutability: "view", - type: "function", -}; +const DHEDGE_FACTORY_ABI = + "function getManagedPools(address manager) view returns (address[] managedPools)"; -const TOROS_POOL_ABI = { - inputs: [], - name: "getFundSummary", - outputs: [ - { - components: [ - { - internalType: "string", - name: "name", - type: "string", - }, - { - internalType: "uint256", - name: "totalSupply", - type: "uint256", - }, - { - internalType: "uint256", - name: "totalFundValue", - type: "uint256", - }, - { - internalType: "address", - name: "manager", - type: "address", - }, - { - internalType: "string", - name: "managerName", - type: "string", - }, - { - internalType: "uint256", - name: "creationTime", - type: "uint256", - }, - { - internalType: "bool", - name: "privatePool", - type: "bool", - }, - { - internalType: "uint256", - name: "performanceFeeNumerator", - type: "uint256", - }, - { - internalType: "uint256", - name: "managerFeeNumerator", - type: "uint256", - }, - { - internalType: "uint256", - name: "managerFeeDenominator", - type: "uint256", - }, - { - internalType: "uint256", - name: "exitFeeNumerator", - type: "uint256", - }, - { - internalType: "uint256", - name: "exitFeeDenominator", - type: "uint256", - }, - ], - internalType: "struct PoolLogic.FundSummary", - name: "", - type: "tuple", - }, - ], - stateMutability: "view", - type: "function", -}; +const TOROS_POOL_ABI = + "function getFundSummary() view returns (tuple(string name, uint256 totalSupply, uint256 totalFundValue))"; module.exports = { DHEDGE_FACTORY_ABI, diff --git a/projects/toros/config.js b/projects/toros/config.js index 75bc853c0c3..b914d15c4c1 100644 --- a/projects/toros/config.js +++ b/projects/toros/config.js @@ -1,20 +1,11 @@ -const { - transformPolygonAddress, - transformOptimismAddress, -} = require("../helper/portedTokens"); - const CONFIG_DATA = { polygon: { - transformAddress: transformPolygonAddress, dhedgeFactory: "0xfdc7b8bFe0DD3513Cc669bB8d601Cb83e2F69cB0", torosMultisigManager: "0x090e7fbd87a673ee3d0b6ccacf0e1d94fb90da59", - daiToken: "0x8f3cf7ad23cd3cadbd9735aff958023239c6a063", }, optimism: { - transformAddress: transformOptimismAddress, dhedgeFactory: "0x5e61a079A178f0E5784107a4963baAe0c5a680c6", torosMultisigManager: "0x813123a13d01d3f07d434673fdc89cbba523f14d", - daiToken: "0xda10009cbd5d07dd0cecc66161fc93d7c9000da1", }, }; diff --git a/projects/toros/index.js b/projects/toros/index.js index 0e188dc983a..93b142fa670 100644 --- a/projects/toros/index.js +++ b/projects/toros/index.js @@ -1,58 +1,41 @@ -const sdk = require("@defillama/sdk"); -const BN = require("bignumber.js"); - const { DHEDGE_FACTORY_ABI, TOROS_POOL_ABI } = require("./abis"); const { CONFIG_DATA } = require("./config"); -const getCalculationMethod = (chain) => { - const { transformAddress, dhedgeFactory, torosMultisigManager, daiToken } = - CONFIG_DATA[chain]; - - return async (timestamp, block, chainBlocks) => { - const balances = {}; - const transform = await transformAddress(); +async function tvl(_, _b, _cb, { api, chain }) { + const { dhedgeFactory, torosMultisigManager } = CONFIG_DATA[chain]; - const pools = ( - await sdk.api.abi.call({ - abi: DHEDGE_FACTORY_ABI, - chain, - target: dhedgeFactory, - params: [torosMultisigManager], - block: chainBlocks[chain], - }) - ).output; + const pools = await api.call({ + abi: DHEDGE_FACTORY_ABI, + target: dhedgeFactory, + params: [torosMultisigManager], + }); - const poolSummaries = ( - await sdk.api.abi.multiCall({ - abi: TOROS_POOL_ABI, - calls: pools.map((target) => ({ target, params: [] })), - chain, - block: chainBlocks[chain], - }) - ).output; + const poolSummaries = await api.multiCall({ + abi: TOROS_POOL_ABI, + calls: pools, + }); - const totalValue = poolSummaries - .reduce( - (acc, { output: { totalFundValue } }) => acc.plus(totalFundValue), - new BN(0) - ) - .toFixed(); + const totalValue = poolSummaries.reduce( + (acc, i) => acc + +i.totalFundValue, + 0 + ); - sdk.util.sumSingleBalance(balances, transform(daiToken), totalValue); - - return balances; + return { + tether: totalValue / 1e18, }; -}; +} module.exports = { timetravel: true, + misrepresentedTokens: true, start: 1627776000, // Sunday, August 1, 2021 12:00:00 AM methodology: - "Aggregates total value of each Toros product both on Polygon and Optimism", + "Aggregates total value of each Toros vault both on Polygon and Optimism", polygon: { - tvl: getCalculationMethod("polygon"), + tvl, }, optimism: { - tvl: getCalculationMethod("optimism"), + tvl, }, + hallmarks: [[1674003600, "Optimism Incentives Start"]], }; diff --git a/projects/tortuga/index.js b/projects/tortuga/index.js index 409dba541a4..99a92d21aad 100644 --- a/projects/tortuga/index.js +++ b/projects/tortuga/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { aQuery } = require('../helper/chain/aptos') module.exports = { diff --git a/projects/totemfi/index.js b/projects/totemfi/index.js index 6b4ad4911ce..8243a5925e0 100644 --- a/projects/totemfi/index.js +++ b/projects/totemfi/index.js @@ -1,22 +1,6 @@ -const { get } = require('../helper/http') -const { sumTokens } = require('../helper/unwrapLPs'); -const poolsURL = 'https://new-offchain.totemfi.com/api/v1/pool/?order=desc&order_field=maturity_date&page=0&limit=99&schedule=&filter=network%7Cbsc%7C%3D%3B' -const TOTM = "0x6FF1BFa14A57594a5874B37ff6AC5efbD9F9599A" - -async function tvl(timestamp, ethBlock, chainBlocks) { - const block = chainBlocks["bsc"]; - let balances = {}; - const { pools } = await get(poolsURL) - const tokensAndOwners = pools - .filter(pool => pool.poolCreatedEvent) - .map(pool => [TOTM, pool.poolCreatedEvent.Pool]) - await sumTokens(balances, tokensAndOwners, block, 'bsc') - return balances -} - - module.exports = { bsc: { - tvl, + tvl: () => ({}), + methodology: 'Project is wound down: https://twitter.com/TotemFi/status/1601247760745140224', } } \ No newline at end of file diff --git a/projects/toucan-protocol/config.js b/projects/toucan-protocol/config.js index 3b3034422f4..21fe7468ca1 100644 --- a/projects/toucan-protocol/config.js +++ b/projects/toucan-protocol/config.js @@ -1,12 +1,16 @@ +const ADDRESSES = require('../helper/coreAssets.json') const CONFIG_DATA = { celo: { bct: "0x0CcB0071e8B8B716A2a5998aB4d97b83790873Fe", - nct: "0x02De4766C272abc10Bc88c220D214A26960a7e92", + nct: ADDRESSES.celo.NCT, }, polygon: { bct: "0x2F800Db0fdb5223b3C3f354886d907A671414A7F", nct: "0xD838290e877E0188a4A44700463419ED96c16107", }, + regen: { + nct_bridge: "0xdC1Dfa22824Af4e423a558bbb6C53a31c3c11DCC" + }, }; module.exports = { diff --git a/projects/toucan-protocol/index.js b/projects/toucan-protocol/index.js index b9d92acd196..5b2d8ea7809 100644 --- a/projects/toucan-protocol/index.js +++ b/projects/toucan-protocol/index.js @@ -2,6 +2,8 @@ const sdk = require("@defillama/sdk"); const { default: BigNumber } = require("bignumber.js"); const { CONFIG_DATA } = require("./config"); +const decimals = 1e18; + const getCalculationMethod = (chain) => { return async (timestamp, block, chainBlocks) => { const supplyCalls = [ @@ -18,9 +20,29 @@ const getCalculationMethod = (chain) => { }) ).output; + const bct = BigNumber(supplies[0].output); + const nct = BigNumber(supplies[1].output); + return { - 'toucan-protocol-base-carbon-tonne': BigNumber(supplies[0].output / 1e18).toFixed(0), - 'toucan-protocol-nature-carbon-tonne': BigNumber(supplies[1].output / 1e18).toFixed(0), + 'toucan-protocol-base-carbon-tonne': bct.div(decimals).toFixed(0), + 'toucan-protocol-nature-carbon-tonne': nct.div(decimals).toFixed(0), + }; + }; +}; + +const getRegenCredits = () => { + return async (timestamp, block, chainBlocks) => { + const transferred = (await sdk.api.abi.call({ + abi: 'uint256:totalTransferred', + target: CONFIG_DATA['regen'].nct_bridge, + chain: 'polygon', + block: chainBlocks['polygon'], + })).output; + + const nct = BigNumber(transferred); + + return { + 'toucan-protocol-nature-carbon-tonne': nct.div(decimals).toFixed(0), }; }; }; @@ -34,9 +56,10 @@ module.exports = { polygon: { tvl: getCalculationMethod("polygon") }, + regen: { + tvl: getRegenCredits() + }, hallmarks: [ - [1634842800, "BCT launch"], - [1644330800, "NCT launch"], - [1660147200, "Celo launch"], + [1653429600, "Verra prohibits tokenization"], ] }; diff --git a/projects/tracerdao/abi.json b/projects/tracerdao/abi.json index 1453a114f49..ff69e43d67b 100644 --- a/projects/tracerdao/abi.json +++ b/projects/tracerdao/abi.json @@ -1,34 +1,4 @@ { - "numPools": { - "inputs": [], - "name": "numPools", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "pools": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "pools", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } + "numPools": "uint256:numPools", + "pools": "function pools(uint256) view returns (address)" } \ No newline at end of file diff --git a/projects/tracerdao/index.js b/projects/tracerdao/index.js index cec7c3911b4..ad13ea73a6e 100644 --- a/projects/tracerdao/index.js +++ b/projects/tracerdao/index.js @@ -1,8 +1,9 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); const { sumTokens2 } = require('../helper/unwrapLPs') -const USDC = "0xff970a61a04b1ca14834a43f5de4533ebddb5cc8"; +const USDC = ADDRESSES.arbitrum.USDC; const chain = 'arbitrum' // Both v1 and v2 factories diff --git a/projects/traddify/index.js b/projects/traddify/index.js new file mode 100644 index 00000000000..3979591dbc3 --- /dev/null +++ b/projects/traddify/index.js @@ -0,0 +1,11 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport, nullAddress } = require('../helper/unwrapLPs') + +const contract = "0xA7f3d2dEa7a53E7A9FEbBdE5Cf7C69d39D065030" + +module.exports = { + methodology: `We count the WKAVA on ${contract}`, + kava: { + tvl: sumTokensExport({ tokens: [nullAddress, ADDRESSES.kava.WKAVA, ], owner: contract}) + } +} diff --git a/projects/traderjoe-lb-v2-1/index.js b/projects/traderjoe-lb-v2-1/index.js new file mode 100644 index 00000000000..7dda6cb9d53 --- /dev/null +++ b/projects/traderjoe-lb-v2-1/index.js @@ -0,0 +1,39 @@ +const { sumTokens2 } = require('../helper/unwrapLPs') +const { staking } = require("../helper/staking.js"); + +const factories = { + avax: '0x8e42f2F4101563bF679975178e880FD87d3eFd4e', + arbitrum: '0x8e42f2F4101563bF679975178e880FD87d3eFd4e', + bsc: '0x8e42f2F4101563bF679975178e880FD87d3eFd4e', +} +async function tvl(_, _b, _cb, { api, }) { + const pools = await api.fetchList({ + target: factories[api.chain], + itemAbi: 'function getLBPairAtIndex(uint256) view returns (address)', + lengthAbi: 'uint256:getNumberOfLBPairs', + }) + const tokenA = await api.multiCall({ + abi: 'address:getTokenX', + calls: pools, + }) + const tokenB = await api.multiCall({ + abi: 'address:getTokenY', + calls: pools, + }) + const toa = [] + tokenA.map((_, i) => { + toa.push([tokenA[i], pools[i]]) + toa.push([tokenB[i], pools[i]]) + }) + return sumTokens2({ api, tokensAndOwners: toa, }) +} + +module.exports = { + methodology: 'We count the token balances in in different liquidity book contracts', +} + +Object.keys(factories).forEach(chain => { + module.exports[chain] = { tvl } +}) + +module.exports.arbitrum.staking = staking("0x43646A8e839B2f2766392C1BF8f60F6e587B6960", "0x371c7ec6D8039ff7933a2AA28EB827Ffe1F52f07", "arbitrum") \ No newline at end of file diff --git a/projects/traderjoe-lb/index.js b/projects/traderjoe-lb/index.js new file mode 100644 index 00000000000..25e77227c2c --- /dev/null +++ b/projects/traderjoe-lb/index.js @@ -0,0 +1,36 @@ +const { sumTokens2 } = require('../helper/unwrapLPs') + +const factories = { + avax: '0x6e77932a92582f504ff6c4bdbcef7da6c198aeef', + arbitrum: '0x1886d09c9ade0c5db822d85d21678db67b6c2982', + bsc: '0x43646a8e839b2f2766392c1bf8f60f6e587b6960', +} +async function tvl(_, _b, _cb, { api, }) { + const pools = await api.fetchList({ + target: factories[api.chain], + itemAbi: 'function allLBPairs(uint256) view returns (address)', + lengthAbi: 'uint256:getNumberOfLBPairs', + }) + const tokenA = await api.multiCall({ + abi: 'address:tokenX', + calls: pools, + }) + const tokenB = await api.multiCall({ + abi: 'address:tokenY', + calls: pools, + }) + const toa = [] + tokenA.map((_, i) => { + toa.push([tokenA[i], pools[i]]) + toa.push([tokenB[i], pools[i]]) + }) + return sumTokens2({ api, tokensAndOwners: toa, }) +} + +module.exports = { + methodology: 'We count the token balances in in different liquidity book contracts', +} + +Object.keys(factories).forEach(chain => { + module.exports[chain] = { tvl } +}) \ No newline at end of file diff --git a/projects/traderjoe-lend/index.js b/projects/traderjoe-lend/index.js index 89e30fcc7d3..bd737341daf 100644 --- a/projects/traderjoe-lend/index.js +++ b/projects/traderjoe-lend/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk'); const { getCompoundV2Tvl } = require('../helper/compound'); @@ -6,7 +7,6 @@ const comptroller = "0xdc13687554205E5b89Ac783db14bb5bba4A1eDaC"; module.exports = { timetravel: true, doublecounted: false, - misrepresentedTokens: true, methodology: 'We count liquidity on the pairs and we get that information from the "traderjoe-xyz/exchange" subgraph. The staking portion of TVL includes the JoeTokens within the JoeBar contract.', avax:{ tvl: getCompoundV2Tvl( @@ -14,7 +14,7 @@ module.exports = { "avax", addr => `avax:${addr}`, "0xC22F01ddc8010Ee05574028528614634684EC29e", - "0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7", + ADDRESSES.avax.WAVAX, false ), borrowed: getCompoundV2Tvl( @@ -22,8 +22,8 @@ module.exports = { "avax", addr => `avax:${addr}`, "0xC22F01ddc8010Ee05574028528614634684EC29e", - "0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7", + ADDRESSES.avax.WAVAX, true ), } -}; \ No newline at end of file +}; diff --git a/projects/traderjoe/index.js b/projects/traderjoe/index.js index 104cf355237..fccffafee04 100644 --- a/projects/traderjoe/index.js +++ b/projects/traderjoe/index.js @@ -1,15 +1,14 @@ -const sdk = require('@defillama/sdk'); +const ADDRESSES = require('../helper/coreAssets.json') const { staking } = require('../helper/staking'); -const joeBar = "0x57319d41F71E81F3c65F2a47CA4e001EbAFd4F33"; -const joeToken = "0x6e84a6216eA6dACC71eE8E6b0a5B7322EEbC0fDd"; +const joeBar = ADDRESSES.avax.xJOE; +const joeToken = ADDRESSES.avax.JOE; const { getChainTvl } = require('../helper/getUniSubgraphTvl'); +const { getUniTVL } = require('../helper/unknownTokens'); const graphUrls = { avax: 'https://api.thegraph.com/subgraphs/name/traderjoe-xyz/exchange', }; module.exports = { - timetravel: true, - doublecounted: false, misrepresentedTokens: true, methodology: 'We count liquidity on the pairs and we get that information from the "traderjoe-xyz/exchange" subgraph. The staking portion of TVL includes the JoeTokens within the JoeBar contract.', avax:{ @@ -19,5 +18,8 @@ module.exports = { "liquidityUSD" )('avax'), staking: staking(joeBar, joeToken, "avax"), + }, + bsc: { + tvl: getUniTVL({ factory: '0x4f8bdc85e3eec5b9de67097c3f59b6db025d9986', useDefaultCoreAssets: true, }) } }; \ No newline at end of file diff --git a/projects/trainswap/index.js b/projects/trainswap/index.js new file mode 100644 index 00000000000..3fb73cbfa5c --- /dev/null +++ b/projects/trainswap/index.js @@ -0,0 +1,23 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { getUniTVL, staking } = require('../helper/unknownTokens') +const sdk = require('@defillama/sdk') +const uniTvl = getUniTVL({ factory: '0x15fA42586c30E87CA49f0Fe262bbb73E89da1cad', useDefaultCoreAssets: true, }) +const masterchef = '0x8b804321b8D094D8C9bB3bFF8CC580087E8d13E0' +const train = '0x52DA160e9a8CeF972FF0A797D4902eD67589f64C' +const weth = ADDRESSES.arbitrum.WETH + +module.exports = { + misrepresentedTokens: true, + arbitrum: { + tvl: sdk.util.sumChainTvls([uniTvl, staking({ + owners: [masterchef], + tokens: [weth], + })]), + staking: staking({ + owners: [masterchef], + tokens: [train], + lps: ['0xB4Fdb64D4C54eda23f2f6f8E3d5bbAd172Fd9f86'], + useDefaultCoreAssets: true, + }) + } +}; \ No newline at end of file diff --git a/projects/tranche/index.js b/projects/tranche/index.js index f65dc45eea7..6796d3d525d 100644 --- a/projects/tranche/index.js +++ b/projects/tranche/index.js @@ -1,15 +1,8 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk'); const { sumTokens } = require('../helper/unwrapLPs') -const abi = { - "constant": true, - "inputs": [], - "name": "exchangeRateStored", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" -}; +const abi = "uint256:exchangeRateStored" const cLINK = '0xface851a4921ce59e912d19329929ce6da6eb0c7'; @@ -68,7 +61,7 @@ async function getTokenHolderList(chain) { ] } } -}; +} function tvl(chain) { return { @@ -89,15 +82,15 @@ function tvl(chain) { chain })).output; - balances['0x514910771af9ca656af840dff83e8264ecf986ca'] = + balances[ADDRESSES.ethereum.LINK] = balances[cLINK] * (exchangeRate / 10 ** 28); delete balances[cLINK]; - }; + } return balances; } } -}; +} module.exports = { start: 1621340071, diff --git a/projects/tranchess-ETH/abi.json b/projects/tranchess-ETH/abi.json new file mode 100644 index 00000000000..84274656325 --- /dev/null +++ b/projects/tranchess-ETH/abi.json @@ -0,0 +1,4 @@ +{ + "tokenUnderlying": "address:tokenUnderlying", + "getTotalUnderlying": "uint256:getTotalUnderlying" +} \ No newline at end of file diff --git a/projects/tranchess-ETH/index.js b/projects/tranchess-ETH/index.js new file mode 100644 index 00000000000..5d19aa93fa0 --- /dev/null +++ b/projects/tranchess-ETH/index.js @@ -0,0 +1,19 @@ +const sdk = require('@defillama/sdk') +const abi = require('./abi.json') + +const ETHV2Funds = [ + '0x69c53679EC1C06f3275b64C428e8Cd069a2d3966', // ETH V2 Fund (ETH mainnet) +] + +async function ethereum(timestamp, blockETH, chainBlocks, { api }){ + const tokens = await api.multiCall({ abi: abi.tokenUnderlying, calls: ETHV2Funds}) + const bals = await api.multiCall({ abi: abi.getTotalUnderlying, calls: ETHV2Funds}) + api.addTokens(tokens, bals) +} + +module.exports = { + methodology: `Only counts the staked ETH in ETH fund deployed on Ethereum mainnet.`, + ethereum:{ + tvl: ethereum + } +} \ No newline at end of file diff --git a/projects/tranchess/abi.json b/projects/tranchess/abi.json index f414f1e05b2..694f3bd35ff 100644 --- a/projects/tranchess/abi.json +++ b/projects/tranchess/abi.json @@ -1,104 +1,9 @@ { - "tokenUnderlying": { - "inputs": [], - "name": "tokenUnderlying", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getPrimaryMarketCount": { - "inputs": [], - "name": "getPrimaryMarketCount", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getPrimaryMarketMember": { - "inputs": [ - { - "internalType": "uint256", - "name": "index", - "type": "uint256" - } - ], - "name": "getPrimaryMarketMember", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "currentCreatingUnderlying": { - "inputs": [], - "name": "currentCreatingUnderlying", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getTotalUnderlying": { - "inputs": [], - "name": "getTotalUnderlying", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "quoteAddress": { - "inputs": [], - "name": "quoteAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "allBalances": { - "inputs": [], - "name": "allBalances", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } + "tokenUnderlying": "address:tokenUnderlying", + "getPrimaryMarketCount": "uint256:getPrimaryMarketCount", + "getPrimaryMarketMember": "function getPrimaryMarketMember(uint256 index) view returns (address)", + "currentCreatingUnderlying": "uint256:currentCreatingUnderlying", + "getTotalUnderlying": "uint256:getTotalUnderlying", + "quoteAddress": "address:quoteAddress", + "allBalances": "function allBalances() view returns (uint256, uint256)" } \ No newline at end of file diff --git a/projects/tranquil/index.js b/projects/tranquil/index.js index 0bbbc495d03..9778d78b9b3 100644 --- a/projects/tranquil/index.js +++ b/projects/tranquil/index.js @@ -1,11 +1,12 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const { BigNumber } = require("bignumber.js"); const {compoundExports, getCompoundV2Tvl} = require('../helper/compound') -const { calculateUniTvl } = require('../helper/calculateUniTvl.js'); +const { uniTvlExport } = require('../helper/calculateUniTvl.js'); const { getFixBalancesSync } = require("../helper/portedTokens"); const tqOne = "0x34B9aa82D89AE04f0f546Ca5eC9C93eFE1288940"; // tqONE -const wOne = "0xcf664087a5bb0237a0bad6742852ec6c8d69a27a"; +const wOne = ADDRESSES.harmony.WONE; const stONEAddr = "0x22D62b19b7039333ad773b7185BB61294F3AdC19"; // stONE ERC20 contract const tranqToken = "0xcf1709ad76a79d5a60210f23e81ce2460542a836"; @@ -80,19 +81,6 @@ async function pool2(timestamp, chain, chainBlocks) { return balances; } -async function swapTvl(timestamp, ethBlock, chainBlocks) { - let balances = await calculateUniTvl( - addr => { return `harmony:${addr}`; }, - chainBlocks.harmony, - "harmony", - "0xF166939E9130b03f721B0aE5352CCCa690a7726a", - 0, - true - ); - getFixBalancesSync('harmony')(balances); - return balances; -} - async function tvl(timestamp, chain, chainBlocks) { const transformAddress = addr=>`harmony:${addr}`; const lendingMarketTvlFn = getCompoundV2Tvl("0x6a82A17B48EF6be278BBC56138F35d04594587E3", "harmony", transformAddress, tqOne, wOne, false); @@ -140,8 +128,8 @@ module.exports = { methodology: "TVL includes values locked into TqTokens. Pool2 are the liquidity in the TRANQ-WONE SUSHI LPs. Staking TVL are the xTRANQ tokens locked into the staking contract.", harmony: { tvl: sdk.util.sumChainTvls([ - swapTvl, tvl, + uniTvlExport('0xF166939E9130b03f721B0aE5352CCCa690a7726a', 'harmony', true), ]), borrowed: borrowed, pool2: pool2, diff --git a/projects/trapeza-protocol/index.js b/projects/trapeza-protocol/index.js index 808c5cd9eb9..7e8925d9461 100644 --- a/projects/trapeza-protocol/index.js +++ b/projects/trapeza-protocol/index.js @@ -1,14 +1,18 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { ohmTvl } = require("../helper/ohm"); const fidl = "0x414a36a4b79Ee1D4b454AB798E4179ffC00b1641"; const fidlStaking = "0x2D1E126b0700D419f8B742118Fb4fa1dEc8c4a62"; const treasury = "0x282cBA0034b8Ce7394c0737F0571945e15Ed242E"; const treasuryTokens = [ - ["0xe9e7cea3dedca5984780bafc599bd69add087d56", false], // BUSD + [ADDRESSES.bsc.BUSD, false], // BUSD ["0x08DBeFd8f7ACa80729267a84df012eA0f203cFa8", true] // FIDL-BUSD CAKE LP ]; module.exports = { + hallmarks: [ + [1648684800, "Rug Pull"] + ], misrepresentedTokens: true, ...ohmTvl(treasury, treasuryTokens, "bsc", fidlStaking, fidl, undefined, undefined, false) } \ No newline at end of file diff --git a/projects/trava/abi.json b/projects/trava/abi.json index 09968e0bc16..74d8b62a913 100644 --- a/projects/trava/abi.json +++ b/projects/trava/abi.json @@ -1,186 +1,10 @@ { - "getLendingPool": { - "inputs": [ - { - "internalType": "uint256", - "name": "providerId", - "type": "uint256" - } - ], - "name": "getLendingPool", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getAddressesProviderFactory": { - "inputs": [], - "name": "getAddressesProviderFactory", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getAllPools": { - "inputs": [], - "name": "getAllPools", - "outputs": [ - { - "internalType": "uint256[]", - "name": "", - "type": "uint256[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getReservesList": { - "inputs": [], - "name": "getReservesList", - "outputs": [ - { - "internalType": "address[]", - "name": "", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getReserveData": { - "inputs": [ - { - "internalType": "address", - "name": "asset", - "type": "address" - } - ], - "name": "getReserveData", - "outputs": [ - { - "components": [ - { - "components": [ - { - "internalType": "uint256", - "name": "data", - "type": "uint256" - } - ], - "internalType": "struct DataTypes.ReserveConfigurationMap", - "name": "configuration", - "type": "tuple" - }, - { - "internalType": "uint128", - "name": "liquidityIndex", - "type": "uint128" - }, - { - "internalType": "uint128", - "name": "variableBorrowIndex", - "type": "uint128" - }, - { - "internalType": "uint128", - "name": "currentLiquidityRate", - "type": "uint128" - }, - { - "internalType": "uint128", - "name": "currentVariableBorrowRate", - "type": "uint128" - }, - { - "internalType": "uint40", - "name": "lastUpdateTimestamp", - "type": "uint40" - }, - { - "internalType": "address", - "name": "tTokenAddress", - "type": "address" - }, - { - "internalType": "address", - "name": "variableDebtTokenAddress", - "type": "address" - }, - { - "internalType": "address", - "name": "interestRateStrategyAddress", - "type": "address" - }, - { - "internalType": "uint8", - "name": "id", - "type": "uint8" - } - ], - "internalType": "struct DataTypes.ReserveData", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - "totalSupply": { - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function", - "constant": true - }, - "getAssetPrice": { - "inputs": [ - { - "internalType": "address", - "name": "asset", - "type": "address" - } - ], - "name": "getAssetPrice", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "decimals": { - "constant": true, - "inputs": [], - "name": "decimals", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } + "getLendingPool": "function getLendingPool(uint256 providerId) view returns (address)", + "getAddressesProviderFactory": "address:getAddressesProviderFactory", + "getAllPools": "uint256[]:getAllPools", + "getReservesList": "address[]:getReservesList", + "getReserveData": "function getReserveData(address asset) view returns (tuple(tuple(uint256 data) configuration, uint128 liquidityIndex, uint128 variableBorrowIndex, uint128 currentLiquidityRate, uint128 currentVariableBorrowRate, uint40 lastUpdateTimestamp, address tTokenAddress, address variableDebtTokenAddress, address interestRateStrategyAddress, uint8 id))", + "totalSupply": "uint256:totalSupply", + "getAssetPrice": "function getAssetPrice(address asset) view returns (uint256)", + "decimals": "uint8:decimals" } \ No newline at end of file diff --git a/projects/trava/index.js b/projects/trava/index.js index 78e70b57b1b..11181a71e2e 100644 --- a/projects/trava/index.js +++ b/projects/trava/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk'); const { default: BigNumber } = require('bignumber.js'); const abi = require('./abi.json'); @@ -88,11 +89,11 @@ async function getTVL(block, chain, tTokenList) { let addressToAdd; if (tTokenList[i].reserve == "0xfb6115445Bff7b52FeB98650C87f44907E58f802" && chain == "bsc") { // aave dont have bsc address on coingecko - addressToAdd = "0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9" - } else if (tTokenList[i].reserve == "0x8D11eC38a3EB5E956B052f67Da8Bdc9bef8Abf3E" && chain == "fantom"){ - addressToAdd = "0x6b175474e89094c44da98b954eedeac495271d0f" - } else if (tTokenList[i].reserve == "0x049d68029688eAbF473097a2fC38ef61633A3C7A" && chain == "fantom"){ - addressToAdd = "0xdac17f958d2ee523a2206206994597c13d831ec7" + addressToAdd = ADDRESSES.ethereum.AAVE + } else if (tTokenList[i].reserve == ADDRESSES.fantom.DAI && chain == "fantom"){ + addressToAdd = ADDRESSES.ethereum.DAI + } else if (tTokenList[i].reserve == ADDRESSES.fantom.fUSDT && chain == "fantom"){ + addressToAdd = ADDRESSES.ethereum.USDT } else { addressToAdd = chain + ":" + tTokenList[i].reserve diff --git a/projects/traverse/index.js b/projects/traverse/index.js index eed7bb48b22..443f843bc29 100644 --- a/projects/traverse/index.js +++ b/projects/traverse/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { ohmTvl } = require('../helper/ohm'); const verse = "0xB72ab6f7177bBb41eFcC17D817778d77460259F1"; @@ -5,7 +6,7 @@ const staking = "0x3fb7931f7BFA9f318Fbf2346f568802a76531774"; const treasury = "0x623845e7961F7A2E535885F983a804608b69D026" const treasuryTokens = [ - ["0xd586e7f844cea2f87f50152665bcbc2c279d8d70", false], // DAI + [ADDRESSES.avax.DAI, false], // DAI ["0xbf56ea8a64faf58889584930716e655317d22ea6", true] // VERSE-DAI ]; diff --git a/projects/treasury/1inch.js b/projects/treasury/1inch.js new file mode 100644 index 00000000000..64f8ca4cd5d --- /dev/null +++ b/projects/treasury/1inch.js @@ -0,0 +1,23 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const oneInchTreasury = "0x7951c7ef839e26F63DA87a42C9a87986507f1c07"; +const ONE_INCH = "0x111111111117dC0aa78b770fA6A738034120C302"; + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.USDC,//USDC + ADDRESSES.ethereum.WETH,//WETH + ADDRESSES.ethereum.USDT,//USDT + ADDRESSES.ethereum.DAI,//DAI + ADDRESSES.ethereum.WBTC,//WBTC + ], + owners: [oneInchTreasury], + ownTokens: [ONE_INCH] + }, + arbitrum: { + owners: ['0x71890ac6209fae61e9d66691c47b168b8300a7c5'] + } +}) \ No newline at end of file diff --git a/projects/treasury/3xcalibur.js b/projects/treasury/3xcalibur.js new file mode 100644 index 00000000000..89d7333282e --- /dev/null +++ b/projects/treasury/3xcalibur.js @@ -0,0 +1,12 @@ +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0x5f49174fdeb42959f3234053b18f5c4ad497cc55"; + +module.exports = treasuryExports({ + arbitrum: { + tokens: [ + nullAddress, + ], + owners: [treasury,], + }, +}) \ No newline at end of file diff --git a/projects/treasury/aave.js b/projects/treasury/aave.js new file mode 100644 index 00000000000..0aa792d7d3d --- /dev/null +++ b/projects/treasury/aave.js @@ -0,0 +1,284 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasuryContractsETH = [ + "0x89c51828427f70d77875c6747759fb17ba10ceb0", //Aave Grants DAO + "0xe3d9988f676457123c5fd01297605efdd0cba1ae", //Aave V1 Treasury + "0x464C71f6c2F760DdA6093dCB91C24c39e5d6e18c", //Aave V2 Collector + "0x25f2226b597e8f9514b3f68f00f494cf4f286491", //Aave Ecosystem Reserve + "0xd784927Ff2f95ba542BfC824c8a8a98F3495f6b5", //V2 Incentives Controller +]; + +const treasuryContractsMATIC = [ + "0x7734280A4337F37Fbf4651073Db7c28C80B339e9", //Aave V2 Collector + "0xe8599F3cc5D38a9aD6F3684cd5CEa72f10Dbc383" //Aave V3 Treasury +]; + +const treasuryContractsAvax = [ + "0x467b92aF281d14cB6809913AD016a607b5ba8A36", //Aave V2 Collector + "0x5ba7fd868c40c16f7aDfAe6CF87121E13FC2F7a0" //Aave V3 Treasury +]; + +const treasuryContractsFantom = [ + "0xBe85413851D195fC6341619cD68BfDc26a25b928", //Treasury V3 +]; + +const aaveTreasuryOptimism = ["0xB2289E329D2F85F1eD31Adbb30eA345278F21bcf"] +const aaveTreasuryArbitrum = ["0x053D55f9B5AF8694c503EB288a1B7E552f590710"] + +const AAVE = ADDRESSES.ethereum.AAVE; +const AAVEPOLYGON = '0xD6DF932A45C0f255f85145f286eA0b292B21C90B'; +const AAVEAVAX = '0x63a72806098bd3d9520cc43356dd78afe5d386d9'; +const AAVEARBITRUM = '0xba5ddd1f9d7f570dc94a51479a000e3bce967196'; +const AAVEOPTIMISM = '0x76fb31fb4af56892a25e32cfc43de717950c9278'; +const AAVEFANTOM = "0xf329e36C7bF6E5E86ce2150875a84Ce77f477375"; + + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.USDC, + '0xBcca60bB61934080951369a648Fb03DF4F96263C', // aUSDC + '0xd24946147829DEaA935bE2aD85A3291dbf109c80', // ammUSDC + '0x98C23E9d8f34FEFb1B7BD6a91B7FF122F4e16F5c', // aEthUSDC + ADDRESSES.ethereum.DAI, + '0x028171bca77440897b824ca71d1c56cac55b68a3', // aDAI + '0x79bE75FFC64DD58e66787E4Eae470c8a1FD08ba4', // ammDAI + '0x018008bfb33d285247A21d44E50697654f754e63', // aEthDAI + ADDRESSES.ethereum.USDT, + '0x3ed3b47dd13ec9a98b44e6204a523e766b225811', // aUSDT + '0x17a79792Fe6fE5C95dFE95Fe3fCEE3CAf4fE4Cb7', // ammUSDT + '0xFFC97d72E13E01096502Cb8Eb52dEe56f74DAD7B', // aAAVE + '0xA700b4eB416Be35b2911fd5Dee80678ff64fF6C9', // aEthAAVE + ADDRESSES.ethereum.WBTC, + '0x9ff58f4fFB29fA2266Ab25e75e2A8b3503311656', // aWBTC + '0x13B2f6928D7204328b0E8E4BCd0379aA06EA21FA', // ammWBTC + '0x5Ee5bf7ae06D1Be5997A1A72006FE6C607eC6DE8', // aEthWBTC + ADDRESSES.ethereum.WSTETH, + '0x0B925eD163218f6662a35e0f0371Ac234f9E9371', // aEthwstETH + '0xba100000625a3754423978a60c9317c58a424e3D', // BAL + ADDRESSES.ethereum.WETH, + '0x030bA81f1c18d280636F32af80b9AAd02Cf0854e', // aWETH + '0xf9Fb4AD91812b704Ba883B11d2B576E890a6730A', // ammWETH + '0x4d5F47FA6A74757f35C14fD3a6Ef8E3C9BC514E8', // aEthWETH + ADDRESSES.ethereum.CRV, + '0x8dAE6Cb04688C62d939ed9B68d32Bc62e49970b1', // aCRV + ADDRESSES.ethereum.SNX, + '0x35f6B052C598d933D69A4EEC4D04c73A191fE6c2', // aSNX + ADDRESSES.ethereum.LINK, + '0xa06bC25B5805d5F8d82847D191Cb4Af5A3e873E0', // aLINK + '0x5E8C8A7243651DB1384C0dDfDbE39761E8e7E51a', // aEthLINK + '0xba100000625a3754423978a60c9317c58a424e3d', // BAL + '0x272F97b7a56a387aE942350bBC7Df5700f8a4576', // aBAL + ADDRESSES.ethereum.UNI, + '0xB9D7CB55f463405CDfBe4E90a6D2Df01C2B92BF1', // aUNI + ADDRESSES.ethereum.MKR, + '0xc713e5E149D5D0715DcD1c156a020976e7E56B88', // aMKR + ADDRESSES.ethereum.BUSD, + '0xA361718326c15715591c299427c62086F69923D9', // aBUSD + ADDRESSES.ethereum.FRAX, + '0xd4937682df3C8aEF4FE912A96A74121C0829E664', // aFRAX + ADDRESSES.ethereum.sUSD, + '0x6C5024Cd4F8A59110119C56f8933403A539555EB', // aSUSD + ADDRESSES.ethereum.LUSD, // LUSD + '0xce1871f791548600cb59efbefFC9c38719142079', // aLUSD + '0x056fd409e1d7a124bd7017459dfea2f387b6d5cd', // GUSD + '0xD37EE7e4f452C6638c96536e68090De8cBcdb583', // aGUSD + ADDRESSES.ethereum.TUSD, + '0x101cc05f4A51C0319f570d5E146a8C625198e636', // aTUSD + '0x8e870d67f660d95d5be530380d0ec0bd388289e1', // USDP + '0x2e8F4bdbE3d47d7d7DE490437AeA9915D930F1A3', // aUSDP + '0x111111111117dc0aa78b770fa6a738034120c302', // 1INCH + '0xB29130CBcC3F791f077eAdE0266168E808E5151e', // a1INCH + '0x1494ca1f11d487c2bbe4543e90080aeba4ba3c2b', // DPI + '0x6F634c6135D2EBD550000ac92F494F9CB8183dAe', // aDPI + '0xc18360217d8f7ab5e7c516566761ea12ce7f9d72', // ENS + '0x9a14e23A58edf4EFDcB360f68cd1b95ce2081a2F', // aENS + ADDRESSES.ethereum.STETH, + '0x1982b2F5814301d4e9a8b0201555376e62F82428', // aSTETH + '0xd46ba6d942050d489dbd938a2c909a5d5039a161', // AMPL + '0x1E6bb68Acec8fefBD87D192bE09bb274170a0548', // aAMPL + '0x956f47f50a910163d8bf957cf5846d573e7f87ca', // FEI + '0x683923dB55Fead99A79Fa01A27EeC3cB19679cC3', // aFEI + '0xa693b19d2931d498c5b318df961919bb4aee87a5', // UST + '0xc2e2152647F4C26028482Efaf64b2Aa28779EFC4', // aUST + ADDRESSES.ethereum.BAT, + '0x05Ec93c0365baAeAbF7AefFb0972ea7ECdD39CF1', // aBAT + ADDRESSES.ethereum.CVX, + '0x952749E07d7157bb9644A894dFAF3Bad5eF6D918', // aCVX + '0xf629cbd94d3791c9250152bd8dfbdf380e2a3b9c', // ENJ + '0xaC6Df26a590F08dcC95D5a4705ae8abbc88509Ef', // aENJ + '0x0f5d2fb29fb7d3cfee444a200298f468908cc942', // MANA + '0xa685a61171bb30d4072B338c80Cb7b2c865c873E', // aMANA + '0xdd974d5c2e2928dea5f71b9825b8b646686bd200', // KNC + '0x39C6b3e42d6A679d7D776778Fe880BC9487C2EDA', // aKNC + '0x03ab458634910aad20ef5f1c8ee96f1d6ac54919', // RAI + '0xc9BC48c72154ef3e5425641a3c747242112a46AF', // aRAI + '0x408e41876cccdc0f92210600ef50372656052a38', // REN + '0xCC12AbE4ff81c9378D670De1b57F8e0Dd228D77a', // aREN + '0xd5147bc8e386d91cc5dbe72099dac6c9b99276f5', // RENFIL + '0x514cd6756CCBe28772d4Cb81bC3156BA9d1744aa', // aRENFIL + '0xe41d2489571d322189246dafa5ebde1f4699f498', // ZRX + '0xDf7FF54aAcAcbFf42dfe29DD6144A69b629f8C9e', // aZRX + ADDRESSES.ethereum.YFI, + '0x5165d24277cD063F5ac44Efd447B27025e888f37', // aYFI + '0x8798249c2E607446EfB7Ad49eC89dD1865Ff4272', // xSUSHI + '0xF256CC7847E919FAc9B808cC216cAc87CCF2f47a', // aXSUSHI + ], + owners: treasuryContractsETH, + ownTokens: [AAVE], + }, + polygon: { + tokens: [ + nullAddress, + ADDRESSES.polygon.DAI, + '0x27F8D03b3a2196956ED754baDc28D73be8830A6e', // amDAI + '0x82E64f49Ed5EC1bC6e43DAD4FC8Af9bb3A2312EE', // aPOLDAI + ADDRESSES.polygon.USDC, + '0x1a13F4Ca1d028320A707D99520AbFefca3998b7F', // amUSDC + '0x625E7708f30cA75bfd92586e17077590C60eb4cD', // aPolUSDC + ADDRESSES.polygon.USDT, + '0x60D55F02A771d515e077c9C2403a1ef324885CeC', // amUSDT + '0x6ab707Aca953eDAeFBc4fD23bA73294241490620', // aPolUSDT + '0x1d2a0E5EC8E5bBDCA5CB219e649B565d8e5c3360', // amAAVE + '0xf329e36C7bF6E5E86ce2150875a84Ce77f477375', // aPolAAVE + ADDRESSES.polygon.WBTC, + '0x5c2ed810328349100A66B82b78a1791B101C9D61', // amWBTC + '0x078f358208685046a11C85e8ad32895DED33A249', // aPolWBTC + ADDRESSES.polygon.WETH_1, + '0x28424507fefb6f7f8E9D3860F56504E4e5f5f390', // amWETH + '0xe50fA9b3c56FfB159cB0FCA61F5c9D750e8128c8', // aPolWETH + ADDRESSES.polygon.WMATIC_2, // WMATIC + '0x8dF3aad3a84da6b69A4DA8aeC3eA40d9091B2Ac4', // amWMATIC + '0x6d80113e533a2C0fe82EaBD35f1875DcEA89Ea97', // aPolWMATIC + '0x9a71012B13CA4d3D0Cdc72A177DF3ef03b0E76A3', // BAL + '0xc4195D4060DaEac44058Ed668AA5EfEc50D77ff6', // amBAL + '0x8ffDf2DE812095b1D19CB146E4c004587C0A0692', // aPolBAL + '0x172370d5Cd63279eFa6d502DAB29171933a610AF', // CRV + '0x3Df8f92b7E798820ddcCA2EBEA7BAbda2c90c4aD', // amCRV + '0x513c7E3a9c69cA3e22550eF58AC1C0088e918FFf', // aPolCRV + '0x85955046DF4668e1DD369D2DE9f3AEB98DD2A369', // DPI + '0x81fB82aAcB4aBE262fc57F06fD4c1d2De347D7B1', // amDPI + '0x724dc807b04555b71ed48a6896b6F41593b8C637', // aPolDPI + '0x385eeac5cb85a38a9a07a70c73e0a3271cfb54a7', // GHST + '0x080b5BF8f360F624628E0fb961F4e67c9e3c7CF1', // amGHST + '0x8Eb270e296023E9D92081fdF967dDd7878724424', // aPolGHST + '0x53E0bca35eC356BD5ddDFebbD1Fc0fD03FaBad39', // LINK + '0x0Ca2e42e8c21954af73Bc9af1213E4e81D6a669A', // amLINK + '0x191c10Aa4AF7C30e871E70C95dB0E4eb77237530', // aPolLINK + '0x0b3f868e0be5597d5db7feb59e1cadbb0fdda50a', // SUSHI + '0x21eC9431B5B55c5339Eb1AE7582763087F98FAc2', // amSUSHI + '0xc45A479877e1e9Dfe9FcD4056c699575a1045dAA', // aPolSUSHI + '0xE111178A87A3BFf0c8d18DECBa5798827539Ae99', // EURS + '0x38d693cE1dF5AaDF7bC62595A37D667aD57922e5', // aPolEURS + '0xa3fa99a148fa48d14ed51d610c367c61876997f1', // MAI + '0xeBe517846d0F36eCEd99C735cbF6131e1fEB775D', // aPolMAI + ADDRESSES.polygon.MATICX, // MATICX + '0x80cA0d8C38d2e2BcbaB66aA1648Bd1C7160500FE', // aPolMATICX + '0x3a58a54c066fdc0f2d55fc9c89f0415c92ebf3c4', // stMATIC + '0xEA1132120ddcDDA2F119e99Fa7A27a0d036F7Ac9', // aPolSTMATIC + '0x4e3Decbb3645551B8A19f0eA1678079FCB33fB4c', // jEUR + '0x6533afac2E7BCCB20dca161449A13A32D391fb00', // aPolJEUR + '0xE0B52e49357Fd4DAf2c15e02058DCE6BC0057db4', //agEUR + '0x8437d7C167dFB82ED4Cb79CD44B7a32A1dd95c77', //aPolAGEUR + ], + owners: treasuryContractsMATIC, + ownTokens: [AAVEPOLYGON], + }, + avax: { + tokens: [ + ADDRESSES.avax.DAI, + '0x47AFa96Cdc9fAb46904A55a6ad4bf6660B53c38a', // avDAI + '0x82E64f49Ed5EC1bC6e43DAD4FC8Af9bb3A2312EE', // aAvaDAI + ADDRESSES.avax.USDC_e, + '0x46A51127C3ce23fb7AB1DE06226147F446e4a857', // avUSDC + '0x625E7708f30cA75bfd92586e17077590C60eb4cD', // aAvaUSDC + ADDRESSES.avax.USDT_e, + '0x532E6537FEA298397212F09A61e03311686f548e', // avUSDT + '0x6ab707Aca953eDAeFBc4fD23bA73294241490620', // aAvaUSDT + '0xD45B7c061016102f9FA220502908f2c0f1add1D7', // avAAVE + '0xf329e36C7bF6E5E86ce2150875a84Ce77f477375', // aAvaAAVE + ADDRESSES.avax.WAVAX, + '0xDFE521292EcE2A4f44242efBcD66Bc594CA9714B', // avWAVAX + '0x6d80113e533a2C0fe82EaBD35f1875DcEA89Ea97', // aAvaWAVAX + '0x50b7545627a5162f82a992c33b87adc75187b218', // WBTC + '0x686bEF2417b6Dc32C50a3cBfbCC3bb60E1e9a15D', // aWBTC + '0x078f358208685046a11C85e8ad32895DED33A249', // aAvaWBTC + ADDRESSES.avax.WETH_e, + '0x53f7c5869a859F0AeC3D334ee8B4Cf01E3492f21', // aWETH + '0xe50fA9b3c56FfB159cB0FCA61F5c9D750e8128c8', // aAvaWETH + '0x5947bb275c521040051d82396192181b413227a3', // LINK + '0x191c10Aa4AF7C30e871E70C95dB0E4eb77237530', // aAvaLINK + '0xd24c2ad096400b6fbcd2ad8b24e7acbc21a1da64', // FRAX + '0xc45A479877e1e9Dfe9FcD4056c699575a1045dAA', // aAvaFRAX + '0x5c49b268c9841aff1cc3b0a418ff5c3442ee3f3b', // MAI + '0x8Eb270e296023E9D92081fdF967dDd7878724424', // aAvaMAI + '0x2b2c81e08f1af8835a78bb2a90ae924ace0ea4be', // sAVAX + '0x513c7E3a9c69cA3e22550eF58AC1C0088e918FFf', // aAvaSAVAX + ADDRESSES.avax.BTC_b, + '0x8ffDf2DE812095b1D19CB146E4c004587C0A0692', // aAvaBTC.b + ], + owners: treasuryContractsAvax, + ownTokens: [AAVEAVAX], + }, + arbitrum: { + tokens: [ + ADDRESSES.optimism.DAI, // DAI + '0x82E64f49Ed5EC1bC6e43DAD4FC8Af9bb3A2312EE', // aArbDAI + '0xd22a58f79e9481d1a88e00c343885a588b34b68b', // EURS + '0x6d80113e533a2C0fe82EaBD35f1875DcEA89Ea97', // aArbEURS + ADDRESSES.arbitrum.USDC, // USDC + '0x625E7708f30cA75bfd92586e17077590C60eb4cD', // aArbUSDC + ADDRESSES.arbitrum.USDT, // USDT + '0x6ab707Aca953eDAeFBc4fD23bA73294241490620', // aArbUSDT + '0xf329e36C7bF6E5E86ce2150875a84Ce77f477375', // aArbAAVE + ADDRESSES.arbitrum.LINK, // LINK + '0x191c10Aa4AF7C30e871E70C95dB0E4eb77237530', // aArbLINK + ADDRESSES.arbitrum.WBTC, // WBTC + '0x078f358208685046a11C85e8ad32895DED33A249', // aArbWBTC + ADDRESSES.arbitrum.WETH, // WETH + '0xe50fA9b3c56FfB159cB0FCA61F5c9D750e8128c8', // aArbWETH + ], + owners: aaveTreasuryArbitrum, + ownTokens: [AAVEARBITRUM], + }, + optimism: { + tokens: [ + ADDRESSES.tombchain.FTM, // WETH + '0xe50fA9b3c56FfB159cB0FCA61F5c9D750e8128c8', // aOptWETH + '0x68f180fcce6836688e9084f035309e29bf0a2095', // WBTC + '0x078f358208685046a11C85e8ad32895DED33A249', // aOptWBTC + ADDRESSES.optimism.OP, // OP + '0x513c7E3a9c69cA3e22550eF58AC1C0088e918FFf', // aOptOP + ADDRESSES.optimism.DAI, // DAI + '0x82E64f49Ed5EC1bC6e43DAD4FC8Af9bb3A2312EE', // aOptDAI + ADDRESSES.optimism.sUSD, // sUSD + '0x6d80113e533a2C0fe82EaBD35f1875DcEA89Ea97', // aOptSUSD + ADDRESSES.optimism.USDC, // USDC + '0x625E7708f30cA75bfd92586e17077590C60eb4cD', // aOptUSDC + ADDRESSES.optimism.USDT, // USDT + '0x6ab707Aca953eDAeFBc4fD23bA73294241490620', // aOptUSDT + '0xf329e36C7bF6E5E86ce2150875a84Ce77f477375', // aOptAAVE + '0x350a791bfc2c21f9ed5d10980dad2e2638ffa7f6', // LINK + '0x191c10Aa4AF7C30e871E70C95dB0E4eb77237530', // aOptLINK + ], + owners: aaveTreasuryOptimism, + ownTokens: [AAVEOPTIMISM], + }, + fantom: { + tokens: [ + "0x513c7E3a9c69cA3e22550eF58AC1C0088e918FFf", // aFanCRV + "0x82E64f49Ed5EC1bC6e43DAD4FC8Af9bb3A2312EE", // aFanDAI + "0x191c10Aa4AF7C30e871E70C95dB0E4eb77237530", // aFanLINK + "0xc45A479877e1e9Dfe9FcD4056c699575a1045dAA", // aFanSUSHI + "0x625E7708f30cA75bfd92586e17077590C60eb4cD", // aFanUSDC + "0x6ab707Aca953eDAeFBc4fD23bA73294241490620", // aFanUSDT + "0x078f358208685046a11C85e8ad32895DED33A249", // aFanWBTC + "0xe50fA9b3c56FfB159cB0FCA61F5c9D750e8128c8", // aFanWETH + "0x6d80113e533a2C0fe82EaBD35f1875DcEA89Ea97", // aFanWFTM + ], + owners: treasuryContractsFantom, + ownTokens: [AAVEFANTOM] + }, +}) diff --git a/projects/treasury/aavegotchi.js b/projects/treasury/aavegotchi.js new file mode 100644 index 00000000000..295ca69cecd --- /dev/null +++ b/projects/treasury/aavegotchi.js @@ -0,0 +1,31 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const aavegotchiTreasury2 = "0xFFE6280ae4E864D9aF836B562359FD828EcE8020"; +const treasury2 = "0xfb76e9be55758d0042e003c1e46e186360f0627e" +const GHST = "0x3F382DbD960E3a9bbCeaE22651E88158d2791550"; + + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.DAI//DAI + ], + owners: [aavegotchiTreasury2, treasury2, '0x53c3CA81EA03001a350166D2Cc0fcd9d4c1b7B62'], + ownTokens: [GHST], + }, + polygon: { + tokens: [ + nullAddress, + ADDRESSES.polygon.DAI, + ADDRESSES.polygon.USDC + ], + owners: ['0xb208f8BB431f580CC4b216826AFfB128cd1431aB', '0x27DF5C6dcd360f372e23d5e63645eC0072D0C098', '0x939b67F6F6BE63E09B0258621c5A24eecB92631c', + '0x62DE034b1A69eF853c9d0D8a33D26DF5cF26682E', '0x8c8E076Cd7D2A17Ba2a5e5AF7036c2b2B7F790f6', '0x48eA1d45142fC645fDcf78C133Ac082eF159Fe14', '0x6fb7e0AAFBa16396Ad6c1046027717bcA25F821f', +'0x921D8FDF089775D5AC61b2d6e8f34F1edd554D8f', +'0xa8D00712abE7af3446cdC651c159737cCFB43255', '0xed7cb3973C7bFE4bf78dA8E5f52EB04c0dF53d3B', '0x62DE034b1A69eF853c9d0D8a33D26DF5cF26682E', '0x8c8E076Cd7D2A17Ba2a5e5AF7036c2b2B7F790f6', +'0xAbA69f6E893B18bE066a237f723F43315BBF9D9A'], + ownTokens: ['0x385eeac5cb85a38a9a07a70c73e0a3271cfb54a7'], + }, +}) \ No newline at end of file diff --git a/projects/treasury/abracadabra.js b/projects/treasury/abracadabra.js new file mode 100644 index 00000000000..3f3a8cf07e7 --- /dev/null +++ b/projects/treasury/abracadabra.js @@ -0,0 +1,52 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const mainnetTeamTokens = "0x5A7C5505f3CFB9a0D9A8493EC41bf27EE48c406D"; +const mainnetTreasury = "0xdf2c270f610dc35d8ffda5b453e74db5471e126b"; +const arbitrumTreasury = "0xA71A021EF66B03E45E0d85590432DFCfa1b7174C"; +const SPELL = "0x090185f2135308BaD17527004364eBcC2D37e5F6"; + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + SPELL, + ADDRESSES.ethereum.USDT, // USDT + "0x99d8a9c45b2eca8864373a26d1459e3dff1e17f3", // MIM + ADDRESSES.ethereum.USDC, // USDC + ADDRESSES.ethereum.DAI, // DAI + ADDRESSES.ethereum.CRV, // CRV + ADDRESSES.ethereum.WETH, // wETH + "0x4d224452801aced8b2f0aebe155379bb5d594381", // APE + // Yearn vaults + "0x27B5739e22ad9033bcBf192059122d163b60349D", // st-yCRV + "0xdCD90C7f6324cfa40d7169ef80b12031770B4325", // yvCurve-stETH + "0xa258C4606Ca8206D8aA700cE2143D7db854D168c", // yvWETH + "0xdA816459F1AB5631232FE5e97a05BBBb94970c95", // yvDAI + "0x3B27F92C0e212C671EA351827EDF93DB27cc0c65", // yvUSDT + "0xa354F35829Ae975e850e23e9615b11Da1B3dC4DE", // yvUSDC + "0x27b7b1ad7288079A66d12350c828D3C00A6F07d7", // yvCurve-IronBank + "0x1635b506a88fBF428465Ad65d00e8d6B6E5846C3", // yvCurve-CVXETH + // Stargate pools + "0xdf0770dF86a8034b3EFEf0A1Bb3c889B8332FF56", // S*USDC + "0x38EA452219524Bb87e18dE1C24D3bB59510BD783", // S*USDT + // Magic autocompounders + "0xf35b31B941D94B249EaDED041DB1b05b7097fEb6", // magicAPE + ], + owners: [mainnetTeamTokens, mainnetTreasury], + ownTokens: [SPELL], + }, + arbitrum: { + tokens: [ + nullAddress, + ADDRESSES.arbitrum.ARB, // ARB + ADDRESSES.arbitrum.MIM, // MIM + ADDRESSES.arbitrum.USDC, // USDC + ADDRESSES.arbitrum.USDT, // USDT + // Magic autocompounders + "0x85667409a723684fe1e57dd1abde8d88c2f54214", // magicGLP + ], + owners: [arbitrumTreasury], + ownTokens: [], + }, +}); diff --git a/projects/treasury/across.js b/projects/treasury/across.js new file mode 100644 index 00000000000..02c9135dcfa --- /dev/null +++ b/projects/treasury/across.js @@ -0,0 +1,12 @@ +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0xd16d904b68429b93f1dfcd837f61aedcd224e8f4"; + +module.exports = treasuryExports({ + arbitrum: { + tokens: [ + nullAddress, + ], + owners: [treasury,], + }, +}) \ No newline at end of file diff --git a/projects/treasury/airswap.js b/projects/treasury/airswap.js new file mode 100644 index 00000000000..051822819bd --- /dev/null +++ b/projects/treasury/airswap.js @@ -0,0 +1,20 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0x24b4ce3ad4366b73f839c1b1fd11d1f636514534"; +const treasury2 = "0x8e5a68a73470c07d043b57d0751fba8b0315c12c"; +const treasury3 = "0xf8bb149f9525875fa47b8cc632d368eb600faba3"; + +const AST = "0x27054b13b1b798b345b591a4d22e6562d47ea75a" + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.WETH, + ADDRESSES.ethereum.BUSD + ], + owners: [treasury, treasury2, treasury3], + ownTokens: [AST], + }, +}) \ No newline at end of file diff --git a/projects/treasury/ajira-pay-finance.js b/projects/treasury/ajira-pay-finance.js new file mode 100644 index 00000000000..22270a79d3e --- /dev/null +++ b/projects/treasury/ajira-pay-finance.js @@ -0,0 +1,63 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); +const AJP = "0x9DBC0Ad09184226313FbDe094E7c3DD75c94f997" + +const arb_tokens = [ + ADDRESSES.arbitrum.USDC, ADDRESSES.arbitrum.WETH, + ADDRESSES.arbitrum.WBTC, ADDRESSES.arbitrum.USDT, + ADDRESSES.optimism.DAI, '0x9DBC0Ad09184226313FbDe094E7c3DD75c94f997', + ADDRESSES.arbitrum.ARB, + nullAddress +] + +const bsc_tokens = [ + ADDRESSES.bsc.USDT, ADDRESSES.bsc.WBNB, + ADDRESSES.bsc.BUSD, ADDRESSES.bsc.USDC, + '0xF8A0BF9cF54Bb92F17374d9e9A321E6a111a51bD', '0x9DBC0Ad09184226313FbDe094E7c3DD75c94f997', + nullAddress +] + +const polygon_tokens = [ + ADDRESSES.polygon.USDT, ADDRESSES.polygon.USDC, + ADDRESSES.polygon.WETH_1, ADDRESSES.polygon.WBTC, + ADDRESSES.polygon.WMATIC_1, ADDRESSES.polygon.DAI, + ADDRESSES.polygon.BUSD, '0x9DBC0Ad09184226313FbDe094E7c3DD75c94f997', + nullAddress +] + +const kava_tokens = [ + ADDRESSES.kava.WKAVA, ADDRESSES.telos.ETH, + ADDRESSES.moonriver.USDT, ADDRESSES.kava.axlUSDC, + '0x9DBC0Ad09184226313FbDe094E7c3DD75c94f997', + nullAddress +] + +const owners = { + bsc: '0x12A65dFDD9E94Bd7f7547d1C4365c5c067f47ed0', + arbitrum: '0x396B58574c0760E84E16468457c460bdCC6f8b57', + polygon: '0xd7B2DEcAAcD75ADb92C1ee0C77e2303c815012d0', + kava: '0xdBD5c57F3a0A6eFC7c9E91639D72Cc139c581AB4' +} + +module.exports = treasuryExports({ + kava: { + tokens: kava_tokens, + owners: [owners.kava], + ownTokens: [AJP] + }, + bsc: { + tokens: bsc_tokens, + owners: [owners.bsc], + ownTokens: [AJP], + }, + polygon: { + tokens: polygon_tokens, + owners: [owners.polygon], + ownTokens: [AJP] + }, + arbitrum: { + tokens: arb_tokens, + owners: [owners.arbitrum], + ownTokens: [AJP] + } + }) \ No newline at end of file diff --git a/projects/treasury/alchemix.js b/projects/treasury/alchemix.js new file mode 100644 index 00000000000..f8bfe2ca187 --- /dev/null +++ b/projects/treasury/alchemix.js @@ -0,0 +1,57 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress,treasuryExports } = require("../helper/treasury"); + +const alchemixTreasury = "0x8392F6669292fA56123F71949B52d883aE57e225"; +const ALCX = "0xdBdb4d16EdA451D0503b854CF79D55697F90c8DF"; +const operations_treasury = "0x9e2b6378ee8ad2A4A95Fe481d63CAba8FB0EBBF9" +const treasury2 = "0x9735F7d3Ea56b454b24fFD74C58E9bD85cfaD31B" +const treasury3 = "0xe761bf731A06fE8259FeE05897B2687D56933110" +const treasury4 = "0x06378717d86B8cd2DBa58c87383dA1EDA92d3495" +const treasury5 = "0x3216D2A52f0094AA860ca090BC5C335dE36e6273" + +const treasuryFTM = "0x6b291cf19370a14bbb4491b01091e1e29335e605" +const treasuryOP = "0xc224bf25dcc99236f00843c7d8c4194abe8aa94a" + + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.USDC,//USDC + ADDRESSES.ethereum.DAI,//DAI + '0x028171bCA77440897B824Ca71D1c56caC55b68A3',//aDAI + ADDRESSES.ethereum.WETH,//WETH + ADDRESSES.ethereum.USDT,//USDT + "0xf16aEe6a71aF1A9Bc8F56975A4c2705ca7A782Bc", //20WETH-80ALC + ADDRESSES.ethereum.LUSD, + ADDRESSES.ethereum.CRV, + ADDRESSES.ethereum.YFI, + "0xa258C4606Ca8206D8aA700cE2143D7db854D168c", + "0x3432B6A60D23Ca0dFCa7761B7ab56459D9C964D0", + "0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490", + "0xF1bB87563A122211d40d393eBf1c633c330377F9", //xpremia + "0x3432B6A60D23Ca0dFCa7761B7ab56459D9C964D0", + "0x7f50786A0b15723D741727882ee99a0BF34e3466" + ], + owners: [alchemixTreasury, operations_treasury, treasury2, treasury3, treasury4, treasury5], + ownTokens: [ALCX], + }, + optimism: { + tokens: [ + nullAddress, + ADDRESSES.optimism.USDC,//USDC + ADDRESSES.optimism.OP, + "0x3c8B650257cFb5f272f799F5e2b4e65093a11a05" + ], + owners: [treasuryOP], + }, + fantom: { + tokens: [ + nullAddress, + ADDRESSES.fantom.USDC,//USDC + ADDRESSES.fantom.DAI, + ADDRESSES.fantom.WFTM + ], + owners: [treasuryFTM], + }, +}) diff --git a/projects/treasury/alpacacity.js b/projects/treasury/alpacacity.js new file mode 100644 index 00000000000..b8633e9dcd2 --- /dev/null +++ b/projects/treasury/alpacacity.js @@ -0,0 +1,24 @@ +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasuryContracts = [ + "0xd93DC6B8Ef043C3ad409C6480A57b4851b3C055e", + "0xF30Ccf37c7058Db0026DE9239d373a1c8723210a" +]; +const treasuryContractsBSC = [ + "0x3226dBce6317dF643EB68bbeF379E6B968b3E669", + "0xb9C76Db167Fa6BFd0e6d78063C63B3073C637497", + "0x6F712F28834b82B7781311b42a945a6134112B2A" +]; + +module.exports = treasuryExports({ + ethereum: { + tokens: [ nullAddress, ], + owners: treasuryContracts, + ownTokens: ['0x7cA4408137eb639570F8E647d9bD7B7E8717514A'], + }, + bsc: { + tokens: [ nullAddress, ], + owners: treasuryContractsBSC, + ownTokens: ['0xc5e6689c9c8b02be7c49912ef19e79cf24977f03'], + }, +}) diff --git a/projects/treasury/alyx.js b/projects/treasury/alyx.js new file mode 100644 index 00000000000..6f4efa1681d --- /dev/null +++ b/projects/treasury/alyx.js @@ -0,0 +1,17 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0x576182b7a1b0bC67701ead28a087228c50Aa0982"; + + + +module.exports = treasuryExports({ + bsc: { + tokens: [ + nullAddress, + ADDRESSES.bsc.WBNB, + ADDRESSES.bsc.USDT + ], + owners: [treasury] + }, +}) diff --git a/projects/treasury/antfarm_finance.js b/projects/treasury/antfarm_finance.js new file mode 100644 index 00000000000..451b4119fee --- /dev/null +++ b/projects/treasury/antfarm_finance.js @@ -0,0 +1,13 @@ +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const daoTreasury = "0x529C78Ee582e4293a20Ab60c848506eADd8723D8"; +const ATF = "0x518b63Da813D46556FEa041A88b52e3CAa8C16a8"; +const AGT = "0x0BF43350076F95e0d16120b4D6bdfA1C9D50BDBD"; + +module.exports = treasuryExports({ + ethereum: { + tokens: [nullAddress, ATF, AGT], + owners: [daoTreasury], + ownTokens: [ATF, AGT], + }, +}); diff --git a/projects/treasury/ape-coin.js b/projects/treasury/ape-coin.js new file mode 100644 index 00000000000..3873b31d1d0 --- /dev/null +++ b/projects/treasury/ape-coin.js @@ -0,0 +1,22 @@ + +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0x03ca52e482912308c287d09ec941b996c18668f5"; +const treasury2 = "0x1633b453c3ca5a244c66f4418ff5120282370053" +const APE = "0x4d224452801aced8b2f0aebe155379bb5d594381" + + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.STETH, + + ], + owners: [treasury, treasury2], + ownTokens: [APE], + // resolveLP: true, + // resolveUniV3: true, + }, +}) \ No newline at end of file diff --git a/projects/treasury/apex-protocol.js b/projects/treasury/apex-protocol.js new file mode 100644 index 00000000000..9f1d5f8525f --- /dev/null +++ b/projects/treasury/apex-protocol.js @@ -0,0 +1,12 @@ +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0xae792a7bf5f85a68ffe92bfbfa7a04c72d7cb095"; + +module.exports = treasuryExports({ + arbitrum: { + tokens: [ + nullAddress, + ], + owners: [treasury,], + }, +}) \ No newline at end of file diff --git a/projects/treasury/api3.js b/projects/treasury/api3.js new file mode 100644 index 00000000000..1e9d7a76153 --- /dev/null +++ b/projects/treasury/api3.js @@ -0,0 +1,24 @@ + +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0x556ecbb0311d350491ba0ec7e019c354d7723ce0"; +const treasury2 = "0xd9f80bdb37e6bad114d747e60ce6d2aaf26704ae" +const treasury3 = "0xe7af7c5982e073ac6525a34821fe1b3e8e432099" +const API = "0x0b38210ea11411557c13457d4da7dc6ea731b88a" + + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.STETH, + ADDRESSES.ethereum.USDC, + "0x93ed3fbe21207ec2e8f2d3c3de6e058cb73bc04d" + ], + owners: [treasury, treasury2, treasury3], + ownTokens: [API], + // resolveLP: true, + // resolveUniV3: true, + }, +}) \ No newline at end of file diff --git a/projects/treasury/apollox.js b/projects/treasury/apollox.js new file mode 100644 index 00000000000..24734afccf3 --- /dev/null +++ b/projects/treasury/apollox.js @@ -0,0 +1,22 @@ +const ADDRESSES = require('../helper/coreAssets.json') + +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0x60ede4402a34762d608ad9ba7bd3797f5bfe544c"; + +module.exports = treasuryExports({ + arbitrum: { + owners: [treasury, ], + ownTokens: [ ], + tokens: [ + nullAddress, + ], + }, + bsc: { + owners: [treasury], + ownTokens:['0x78f5d389f5cdccfc41594abab4b0ed02f31398b3'], + tokens: [ + ADDRESSES.bsc.USDT, + ] + } +}); \ No newline at end of file diff --git a/projects/treasury/aragon.js b/projects/treasury/aragon.js new file mode 100644 index 00000000000..92b76bd8aab --- /dev/null +++ b/projects/treasury/aragon.js @@ -0,0 +1,33 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const aragonTreasury = "0xfb633F47A84a1450EE0413f2C32dC1772CcAea3e"; +const ANT = "0xa117000000f279D81A1D3cc75430fAA017FA5A2e"; +const ANT_ETH_LP = "0x9dEF9511fEc79f83AFCBFfe4776B1D817DC775aE" + + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.USDC,//USDC + ADDRESSES.ethereum.DAI,//DAI + ADDRESSES.ethereum.WETH,//WETH + ADDRESSES.ethereum.UNI,//UNI + '0xC18360217D8F7Ab5e7c516566761Ea12Ce7F9D72',//ENS + ADDRESSES.ethereum.BUSD,//BUSD + '0xc944E90C64B2c07662A292be6244BDf05Cda44a7',//GRT + '0x5dbcF33D8c2E976c6b560249878e6F1491Bca25c',//yyDAI+yUSDC+yUSDT+yTUSD + '0xDe30da39c46104798bB5aA3fe8B9e0e1F348163F',//GTC + '0xdd974D5C2e2928deA5F71b9825b8b646686BD200',//KNC + '0x8f8221aFbB33998d8584A2B05749bA73c37a938a',//REQ + '0x24cCeDEBF841544C9e6a62Af4E8c2fA6e5a46FdE',//BlueSparrow + '0x232FB065D9d24c34708eeDbF03724f2e95ABE768',//SHEESHA + '0xaC9Bb427953aC7FDDC562ADcA86CF42D988047Fd',//STT + "0x0f5d2fb29fb7d3cfee444a200298f468908cc942",//MANA + ADDRESSES.ethereum.USDT,//USDT + ], + owners: [aragonTreasury, "0x7ecd1eac2a07974bcbabafee44b5cc44ceee9540", "0xcafe1a77e84698c83ca8931f54a755176ef75f2c"], + ownTokens: [ANT, ANT_ETH_LP], + }, +}) \ No newline at end of file diff --git a/projects/treasury/arbitrum-dao.js b/projects/treasury/arbitrum-dao.js new file mode 100644 index 00000000000..e2fa9c2417e --- /dev/null +++ b/projects/treasury/arbitrum-dao.js @@ -0,0 +1,16 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0xf3fc178157fb3c87548baa86f9d24ba38e649b58"; +const ARB = ADDRESSES.arbitrum.ARB; + +module.exports = treasuryExports({ + arbitrum: { + tokens: [ + nullAddress, + ARB, + ], + owners: [treasury], + ownTokens: [ARB], + }, +}) diff --git a/projects/treasury/archimedes.js b/projects/treasury/archimedes.js new file mode 100644 index 00000000000..058bbb8527e --- /dev/null +++ b/projects/treasury/archimedes.js @@ -0,0 +1,20 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0x29520fd76494Fd155c04Fa7c5532D2B2695D68C6"; +const ARCH = "0x73C69d24ad28e2d43D03CBf35F79fE26EBDE1011" + + + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.USDC,//usdc + ADDRESSES.ethereum.USDT,//usdt + '0x2A8e1E676Ec238d8A992307B495b45B3fEAa5e86',//ousd + ], + owners: [treasury], + ownTokens: [ARCH], + }, +}) \ No newline at end of file diff --git a/projects/treasury/atlas-usv.js b/projects/treasury/atlas-usv.js new file mode 100644 index 00000000000..f5feb2c25f0 --- /dev/null +++ b/projects/treasury/atlas-usv.js @@ -0,0 +1,53 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasuryContractsETH = ["0x8739f0EeF3163C3db7b994d0e301BC375d757aF6"]; + +const treasuryContractsMATIC = ["0x71EF2894E23D7ea7Fd73a3558B3a0bA25689bC86"]; + +const treasuryContractsAvax = ["0x53a73b76F84bc5E27A6d3653503Af98e727e2991"]; + +const treasuryContractsBSC = ["0x4fa7C6f58bb7f30c38d69D7E6fF76911abfd393d"] + + +const USV = "0x88536c9b2c4701b8db824e6a16829d5b5eb84440"; +const USVPOLYGON = '0xac63686230f64bdeaf086fe6764085453ab3023f'; +const USVAVAX = '0xb0a8e082e5f8d2a04e74372c1be47737d85a0e73'; +const USVBSC = '0xaf6162dc717cfc8818efc8d6f46a41cf7042fcba'; + + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.DAI, + ], + owners: treasuryContractsETH, + ownTokens: [USV], + }, + polygon: { + tokens: [ + nullAddress, + '0xa3Fa99A148fA48D14Ed51d610c367C61876997F1', //mimatic + ADDRESSES.polygon.DAI, //DAI + '0x104592a158490a9228070E0A8e5343B499e125D0', // frax + ], + owners: treasuryContractsMATIC, + ownTokens: [USVPOLYGON], + }, + avax: { + tokens: [ + ADDRESSES.avax.DAI, // DAI + ], + owners: treasuryContractsAvax, + ownTokens: [USVAVAX], + }, + bsc: { + tokens: [ + '0x1AF3F329e8BE154074D8769D1FFa4eE058B1DBc3', //DAI + ADDRESSES.bsc.BUSD, //busd + ], + owners: treasuryContractsBSC, + ownTokens: [USVBSC], + }, +}) diff --git a/projects/treasury/augury.js b/projects/treasury/augury.js new file mode 100644 index 00000000000..74fd0ff434e --- /dev/null +++ b/projects/treasury/augury.js @@ -0,0 +1,16 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const DeveloperTeamWallet = "0xE2E26BAc2ff37A7aE219EcEF74C5A1Bf95d5f854"; +const amWMATIC = "0x8df3aad3a84da6b69a4da8aec3ea40d9091b2ac4"; +const OMEN = "0x76e63a3E7Ba1e2E61D3DA86a87479f983dE89a7E"; +const QUICK = "0x831753dd7087cac61ab5644b308642cc1c33dc13"; + + +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +module.exports = treasuryExports({ + polygon: { + tokens: [ nullAddress, amWMATIC, QUICK, ADDRESSES.polygon.USDC, '0x8a953cfe442c5e8855cc6c61b1293fa648bae472', ADDRESSES.polygon.USDT, ], + owners: [DeveloperTeamWallet], + ownTokens: [ OMEN], + }, +}) diff --git a/projects/treasury/aura.js b/projects/treasury/aura.js new file mode 100644 index 00000000000..906185f16f8 --- /dev/null +++ b/projects/treasury/aura.js @@ -0,0 +1,25 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0xfc78f8e1Af80A3bF5A1783BB59eD2d1b10f78cA9"; + +module.exports = treasuryExports({ + ethereum: { + owner: [treasury], + ownTokens: [ + "0xC0c293ce456fF0ED870ADd98a0828Dd4d2903DBF", // AURA + "0xc29562b045D80fD77c69Bec09541F5c16fe20d9d", // B-80AURA-20WETH + "0x0Bf1f1E3ccf6A1089710359E312753b44BBF85f8", // sAURA + ], + tokens: [ + nullAddress, + ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.WETH, + "0xba100000625a3754423978a60c9317c58a424e3D", // BAL + ADDRESSES.ethereum.SAFE, + "0x0d02755a5700414B26FF040e1dE35D337DF56218", // BEND + "0x616e8BfA43F920657B3497DBf40D6b1A02D4608d", // auraBAL + "0x3dd0843A028C86e0b760b1A76929d1C5Ef93a2dd", // B-auraBAL-STABLE + ], + }, +}); diff --git a/projects/treasury/axelar.js b/projects/treasury/axelar.js new file mode 100644 index 00000000000..d9a19ed5d26 --- /dev/null +++ b/projects/treasury/axelar.js @@ -0,0 +1,12 @@ +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0x8d9249e6049bb17c15007bc58a5bec12a5af4346"; + +module.exports = treasuryExports({ + arbitrum: { + tokens: [ + nullAddress, + ], + owners: [treasury,], + }, +}) \ No newline at end of file diff --git a/projects/treasury/badger-dao.js b/projects/treasury/badger-dao.js new file mode 100644 index 00000000000..c1a00ee5dd7 --- /dev/null +++ b/projects/treasury/badger-dao.js @@ -0,0 +1,60 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury_vault = "0xD0A7A8B98957b9CD3cFB9c0425AbE44551158e9e"; +const treasury_ops = "0x042B32Ac6b453485e357938bdC38e0340d4b9276"; +const treasury_voter = "0xA9ed98B5Fb8428d68664f3C5027c62A10d45826b"; +const treasury_dev = "0xB65cef03b9B89f99517643226d76e286ee999e77"; +const treasury_tech = "0x86cbD0ce0c087b482782c181dA8d191De18C8275"; +const treasury_pay = "0x30a9c1D258F6c2D23005e6450E72bDD42C541105"; +const treasury_drip1 = "0xA3Dc099D14722D0e25B3A904427377B4B2ab9fA4"; +const treasury_drip2 = "0xC0D8fD5c722AF68437E7dFc095a980500dC0961D"; +const treasury_bfraxbp = "0xe0705A91984b076C250d410A41f615380aF1C2ed"; +const BADGER = "0x3472A5A71965499acd81997a54BBA8D852C6E53d"; +const DIGG = "0x798D1bE841a82a273720CE31c822C61a67a601C3"; +const treasuryarb = "0xb364bab258ad35dd83c7dd4e8ac78676b7aa1e9f" + +const mapping = { + '0x4efc8ded860bc472fa8d938dc3fd4946bc1a0a18': '0xb460daa847c45f1c4a41cb05bfb3b51c92e41b36', + '0xd7c9c6922db15f47ef3131f2830d8e87f7637210': '0x8eb6c82c3081bbbd45dcac5afa631aac53478b7c', + '0xaad4ee162dbc9c25cca26ba4340b36e3ef7c1a80': '0x1ee442b5326009bb18f2f472d3e0061513d1a0ff', +} + +Object.entries(mapping).forEach(([key, val]) => mapping[key.toLowerCase()] = val) + +const transformAddress = i => { + i = i.toLowerCase() + i = mapping[i] ?? i + return 'ethereum:' + i +} + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.WBTC,//WBTC + ADDRESSES.ethereum.DAI,//DAI + ADDRESSES.ethereum.USDC,//USDC + ADDRESSES.ethereum.USDT,//USDT + ADDRESSES.ethereum.LUSD,//LUSD + "0x9ff58f4fFB29fA2266Ab25e75e2A8b3503311656",//aWBTC + ADDRESSES.ethereum.WETH,//WETH + ADDRESSES.ethereum.RETH,//rETH + "0x25f0b7c3A7A43b409634a5759526560cC3313d75", // cvxBADGERFRAX-f + "0xaad4ee162dbc9c25cca26ba4340b36e3ef7c1a80", // aura50rETH-50BADGER-vault + "0x4efc8ded860bc472fa8d938dc3fd4946bc1a0a18", // aura20WBTC-80BADGER-vault + "0xd7c9c6922db15f47ef3131f2830d8e87f7637210", // aura40WBTC-40DIGG-20graviAURA-vault + ], + owners: [treasury_vault, treasury_ops, treasury_voter, treasury_dev, treasury_tech, treasury_pay, treasury_drip1, treasury_drip2, treasury_bfraxbp], + ownTokens: [BADGER, DIGG], + resolveUniV3: true, + transformAddress, + }, + arbitrum: { + tokens: [ + nullAddress, + "0x11cDb42B0EB46D95f990BeDD4695A6e3fA034978" + ], + owners: [treasuryarb] + } +}) diff --git a/projects/treasury/balancer.js b/projects/treasury/balancer.js new file mode 100644 index 00000000000..c574c04df00 --- /dev/null +++ b/projects/treasury/balancer.js @@ -0,0 +1,36 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const eth = "0x10A19e7eE7d7F8a52822f6817de8ea18204F2e4f"; +const eth2 = "0xb129f73f1afd3a49c701241f374db17ae63b20eb" + +const bal = "0xba100000625a3754423978a60c9317c58a424e3D"; +const abal = "0x272F97b7a56a387aE942350bBC7Df5700f8a4576"; + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.LIDO, + ADDRESSES.ethereum.USDC, + "0xDe30da39c46104798bB5aA3fe8B9e0e1F348163F", // GTC + "0xCFEAead4947f0705A14ec42aC3D44129E1Ef3eD5", // NOTE + ADDRESSES.ethereum.WETH, + "0x2d94AA3e47d9D5024503Ca8491fcE9A2fB4DA198", // BANK + ADDRESSES.ethereum.DAI, + "0x226f7b842E0F0120b7E194D05432b3fd14773a9D", // UNN + ADDRESSES.ethereum.STETH, + ADDRESSES.ethereum.SAFE, + ], + owners: [eth, eth2], + ownTokens: [bal, abal], + }, + arbitrum: { + owners: ['0xaf23dc5983230e9eeaf93280e312e57539d098d0'], + tokens: [ + ADDRESSES.arbitrum.WETH, + ADDRESSES.arbitrum.USDC, + ], + ownTokens: ['0xbc2597d3f1f9565100582cde02e3712d03b8b0f6'], + } +}); diff --git a/projects/treasury/bancor.js b/projects/treasury/bancor.js new file mode 100644 index 00000000000..053db29b9ab --- /dev/null +++ b/projects/treasury/bancor.js @@ -0,0 +1,51 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress,treasuryExports } = require("../helper/treasury"); + +const treasury = "0x649765821D9f64198c905eC0B2B037a4a52Bc373"; + +const BNT = "0x1F573D6Fb3F13d689FF844B4cE37794d79a7FF1C" +const vBNT = "0x48Fb253446873234F2fEBbF9BdeAA72d9d387f94" + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.LINK, + ADDRESSES.ethereum.DAI, + "0x967da4048cD07aB37855c090aAF366e4ce1b9F48", + ADDRESSES.ethereum.SNX, + "0xF629cBd94d3791C9250152BD8dfBDF380E2a3B9c", + "0x4691937a7508860F876c9c0a2a617E7d9E945D4B", + "0x8f8221aFbB33998d8584A2B05749bA73c37a938a", + ADDRESSES.ethereum.YFI, + "0x408e41876cCCDC0F92210600ef50372656052a38", + "0x1559FA1b8F28238FD5D76D9f434ad86FD20D1559", + "0xa1faa113cbE53436Df28FF0aEe54275c13B40975", + ADDRESSES.ethereum.BAT, + "0xc944E90C64B2c07662A292be6244BDf05Cda44a7", + ADDRESSES.ethereum.MATIC, + "0x0f71B8De197A1C84d31de0F1fA7926c365F052B3", + "0xBC19712FEB3a26080eBf6f2F7849b417FdD792CA", + "0xc00e94Cb662C3520282E6f5717214004A7f26888", + "0x0d438F3b5175Bebc262bF23753C1E53d03432bDE", + "0x0F5D2fB29fb7d3CFeE444a200298f468908cC942", + "0x6710c63432A2De02954fc0f851db07146a6c0312", + ADDRESSES.ethereum.AAVE, + ADDRESSES.ethereum.WBTC, + '0x903bef1736cddf2a537176cf3c64579c3867a881', + '0x111111517e4929d3dcbdfa7cce55d30d4b6bc4d6', //ichi + '0x6c6EE5e31d828De241282B9606C8e98Ea48526E2', //hot + '0x275f5Ad03be0Fa221B4C6649B8AeE09a42D9412A', //mona + '0x4a220E6096B25EADb88358cb44068A3248254675', //qnt + '0xC18360217D8F7Ab5e7c516566761Ea12Ce7F9D72', //ENS + '0xb9EF770B6A5e12E45983C5D80545258aA38F3B78', //zcn + '0xd26114cd6EE289AccF82350c8d8487fedB8A0C07', //omg + '0xaA7a9CA87d3694B5755f213B5D04094b8d0F0A6F', //trac + ADDRESSES.ethereum.WSTETH, + '0x4C2e59D098DF7b6cBaE0848d66DE2f8A4889b9C3', //fodl + ADDRESSES.ethereum.MKR, + ], + owners: [treasury], + ownTokens: [BNT, vBNT], + }, +}) diff --git a/projects/treasury/banklessdao.js b/projects/treasury/banklessdao.js new file mode 100644 index 00000000000..fd512861b0a --- /dev/null +++ b/projects/treasury/banklessdao.js @@ -0,0 +1,35 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const banklessDaoTreasury = "0xf26d1Bb347a59F6C283C53156519cC1B1ABacA51"; +const BANK = "0x2d94AA3e47d9D5024503Ca8491fcE9A2fB4DA198"; +const BED = "0x2aF1dF3AB0ab157e1E2Ad8F88A7D04fbea0c7dc6" + + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.USDC,//USDC + '0x81f8f0bb1cB2A06649E51913A151F0E7Ef6FA321',//VITA + ADDRESSES.ethereum.RETH,//rETH + ADDRESSES.ethereum.DAI,//DAI + '0x3541A5C1b04AdABA0B83F161747815cd7B1516bC',//KNIGHT + '0xfb5453340C03db5aDe474b27E68B6a9c6b2823Eb',//ROBOT + ADDRESSES.ethereum.WETH,//WETH + '0xFca59Cd816aB1eaD66534D82bc21E7515cE441CF',//RARI + '0x956F47F50A910163D8BF957Cf5846D573E7f87CA',//FEI + '0x0954906da0Bf32d5479e25f46056d22f08464cab',//INDEX + '0x04Fa0d235C4abf4BcF4787aF4CF447DE572eF828',//UMA + '0xbC396689893D065F41bc2C6EcbeE5e0085233447',//PERP + '0xD56daC73A4d6766464b38ec6D91eB45Ce7457c44',//PAN + ADDRESSES.ethereum.USDT,//USDT + '0x69af81e73A73B40adF4f3d4223Cd9b1ECE623074',//MASK + '0x3Ec8798B81485A254928B70CDA1cf0A2BB0B74D7',//GRO + ADDRESSES.ethereum.SUSHI,//SUSHI + '0xc944E90C64B2c07662A292be6244BDf05Cda44a7',//GRT + ], + owners: [banklessDaoTreasury], + ownTokens: [BANK, BED], + }, +}) \ No newline at end of file diff --git a/projects/treasury/bankofcronos.js b/projects/treasury/bankofcronos.js new file mode 100644 index 00000000000..7a3808f5f36 --- /dev/null +++ b/projects/treasury/bankofcronos.js @@ -0,0 +1,22 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress,treasuryExports } = require("../helper/treasury"); + +const teamTreasury = "0xBacF28BF21B374459C738289559EF89978D08102"; + +const BOC = "0xe5786DDFc4D6DcA0973D1c5b02987cBbac66ed87"; +const pBOC = "0xF93fB4CDB0e40dbF33d2cDbf11D9516f6aDd7e8e"; + +module.exports = treasuryExports({ + cronos: { + tokens: [ + nullAddress, + ADDRESSES.cronos.USDC,//USDC + '0x26043Aaa4D982BeEd7750e2D424547F5D76951d4',//CUSD + '0x5C7F8A570d578ED84E63fdFA7b1eE72dEae1AE23',//WCRO + '0xe44Fd7fCb2b1581822D0c862B68222998a0c299a',//WETH + ADDRESSES.cronos.WBTC,//WBTC + ], + owners: [teamTreasury], + // ownTokens: [BOC, pBOC], + }, +}) diff --git a/projects/treasury/battlefly.js b/projects/treasury/battlefly.js new file mode 100644 index 00000000000..5f4c8cc99dd --- /dev/null +++ b/projects/treasury/battlefly.js @@ -0,0 +1,16 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress,treasuryExports } = require("../helper/treasury"); + +module.exports = treasuryExports({ + arbitrum: { + tokens: [ + nullAddress, + ADDRESSES.arbitrum.USDC, // USDC + ADDRESSES.arbitrum.WETH, // WETH + ADDRESSES.arbitrum.USDT, // USDT + ADDRESSES.optimism.DAI, // DAI + ], + owners: ['0xF5411006eEfD66c213d2fd2033a1d340458B7226'], + ownTokens: ['0x872bAD41CFc8BA731f811fEa8B2d0b9fd6369585', '0x539bde0d7dbd336b79148aa742883198bbf60342'], + }, +}) \ No newline at end of file diff --git a/projects/treasury/beanstalk.js b/projects/treasury/beanstalk.js new file mode 100644 index 00000000000..6aeae1108bb --- /dev/null +++ b/projects/treasury/beanstalk.js @@ -0,0 +1,19 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { treasuryExports, nullAddress } = require("../helper/treasury"); + +const bean = "0xBEA0000029AD1c77D3d5D23Ba2D8893dB9d1Efab"; +const sprout = "0xb7ab3f0667eFF5e2299d39C23Aa0C956e8982235"; +const farms = "0x21DE18B6A8f78eDe6D16C50A167f6B222DC08DF7"; +const tokens = [ + nullAddress, + ADDRESSES.ethereum.SAFE, + ADDRESSES.ethereum.USDC, +]; + +module.exports = treasuryExports({ + ethereum: { + tokens, + owners: [sprout, farms], + ownTokens: [bean], + }, +}); diff --git a/projects/treasury/beefy.js b/projects/treasury/beefy.js new file mode 100644 index 00000000000..fd0004accf5 --- /dev/null +++ b/projects/treasury/beefy.js @@ -0,0 +1,84 @@ +const { getConfig } = require('../helper/cache') +const { sumTokens2, nullAddress, } = require('../helper/unwrapLPs') +const sdk = require('@defillama/sdk') + +const chains = [ + "fuse", + "celo", + "moonbeam", + "aurora", + "harmony", + "ethereum", + "syscoin", + "metis", + "heco", + "moonriver", + "arbitrum", + "kava", + "oasis", + "cronos", + "optimism", + "fantom", + "bsc", + "polygon", + "avax", + "canto" +] + +const chainMap = { + harmony: 'one', + syscoin: 'sys', + oasis: 'emerald', +} + +const getKey = c => chainMap[c] || c + +let config + +async function _getConfig() { + if (!config) config = getConfig('beefy/treasury', 'https://api.beefy.finance/treasury') + return config +} + +module.exports = { +}; + +chains.forEach(chain => { + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const balances = {} + let data = (await _getConfig())[getKey(chain)] || {} + const uniV3Owners = [] + const ownerTokens = Object.entries(data) + .filter(i => { + if (i[0] !== 'validator') return true + api.add(nullAddress, i[1].balances.validator.balance) + }) + .map(([owner, { balances }]) => { + + const tokens = Object.entries(balances).filter(([_, info]) => info.name !== 'BIFI').map(i => i[0] === 'native' ? nullAddress : i[0]) + if (Object.keys(balances).some(i => i.toLowerCase() === '0x8e295789c9465487074a65b1ae9ce0351172393f')) + uniV3Owners.push(owner) + + return [tokens, owner] + }) + if (uniV3Owners.length) await sumTokens2({ api, owners: uniV3Owners, resolveUniV3: true, }) + return sumTokens2({ balances, api, ownerTokens, blacklistedTokens: ['0x8e295789c9465487074a65b1ae9ce0351172393f'], }) + }, + ownTokens: async (_, _b, _cb, { api, }) => { + let BIFI + let data = (await _getConfig())[getKey(chain)] || {} + const owners = [] + Object.entries(data).filter(i => i[0] !== 'validator') + .map(([owner, { balances }]) => { + Object.entries(balances).some(([_, info]) => { + if (info.name !== 'BIFI') return false + BIFI = info.address + owners.push(owner) + }) + }) + if (!BIFI) return {} + return sumTokens2({ api, tokens: [BIFI], owners, blacklistedTokens: ['0x8e295789c9465487074a65b1ae9ce0351172393f'], }) + }, + } +}) \ No newline at end of file diff --git a/projects/treasury/beethovenx.js b/projects/treasury/beethovenx.js new file mode 100644 index 00000000000..9d5a5284838 --- /dev/null +++ b/projects/treasury/beethovenx.js @@ -0,0 +1,63 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const ftm = "0xa1e849b1d6c2fd31c63eef7822e9e0632411ada7"; +const op = "0x2a185c8a3c63d7bfe63ad5d950244ffe9d0a4b60"; +const eth = "0xea06e1b4259730724885a39ce3ca670efb020e26"; + +const ftmTokens = [ + nullAddress, + ADDRESSES.fantom.USDC, // USDC + "0x841FAD6EAe12c286d1Fd18d1d525DFfA75C7EFFE", // BOO + ADDRESSES.fantom.WFTM, // WFTM + "0xc5713B6a0F26bf0fdC1c52B90cd184D950be515C", // LINSPIRIT + "0xde5ed76e7c05ec5e4572cfc88d1acea165109e44", // DEUS + "0xc3f069d7439baf6d4d6e9478d9cc77778e62d147", // FLIBERO + "0xf3A602d30dcB723A74a0198313a7551FEacA7DAc", // BPT-QUARTET + "0x56aD84b777ff732de69E85813DAEE1393a9FFE10", // BPT-FOTO-II + "0xe3f201D4676d1Aec0Baa8c70f8f07F14B73B3Aec", // bTAROT +]; + +const ftmOwnTokens = [ + "0xF24Bcf4d1e507740041C9cFd2DddB29585aDCe1e", // BEETS + "0xeCAa1cBd28459d34B766F9195413Cb20122Fb942", // BPT-STABEET + "0x2Cea0dA40cF133721377bB2b0bF4aDc43715BFC3", // BPT-USDCfBEETS + "0xcdE5a11a4ACB4eE4c805352Cec57E236bdBC3837", // BPT-BEETS-FTM +]; + +const opTokens = [ + nullAddress, + ADDRESSES.optimism.OP, // OP + "0xFdb794692724153d1488CcdBE0C56c252596735F", // LDO + "0xFE8B128bA8C78aabC59d4c64cEE7fF28e9379921", // BAL + "0x38f79beFfC211c6c439b0A3d10A0A673EE63AFb4", // BPT-rETH-ETH-gauge +]; + +const opOwnTokens = [ + "0xEf47a07945D53Ee3a511751375A1ed0B79d6232D", // BPT-STABEET-gauge + "0x97513e975a7fA9072c72C92d8000B0dB90b163c5", // BEETS +]; + +const ethTokens = [ + "0x5c6Ee304399DBdB9C8Ef030aB642B10820DB8F56", // B-80BAL-20WETH + "0x616e8BfA43F920657B3497DBf40D6b1A02D4608d", // auraBAL + "0xA13a9247ea42D743238089903570127DdA72fE44", // bb-a-USD +]; + +module.exports = treasuryExports({ + fantom: { + owners: [ftm], + tokens: ftmTokens, + ownTokens: ftmOwnTokens, + }, + optimism: { + owners: [op], + tokens: opTokens, + ownTokens: opOwnTokens, + }, + ethereum: { + owners: [eth], + tokens: ethTokens, + ownTokens: [], + }, +}); diff --git a/projects/treasury/benddao.js b/projects/treasury/benddao.js new file mode 100644 index 00000000000..9c9dfe75e07 --- /dev/null +++ b/projects/treasury/benddao.js @@ -0,0 +1,14 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.USDC,//USDC + '0x4d224452801aced8b2f0aebe155379bb5d594381',//APE + ], + owners: ['0x472FcC65Fab565f75B1e0E861864A86FE5bcEd7B'], + ownTokens: ['0x0d02755a5700414b26ff040e1de35d337df56218'], + }, +}) \ No newline at end of file diff --git a/projects/treasury/benqi.js b/projects/treasury/benqi.js new file mode 100644 index 00000000000..47823d966fa --- /dev/null +++ b/projects/treasury/benqi.js @@ -0,0 +1,12 @@ +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0x142eB2ed775e6d497aa8D03A2151D016bbfE7Fc2"; +const qi = "0x8729438EB15e2C8B576fCc6AeCdA6A148776C0F5"; + +module.exports = treasuryExports({ + avax: { + tokens: [nullAddress], + owners: [treasury], + ownTokens: [qi], + }, +}); diff --git a/projects/treasury/betswirl.js b/projects/treasury/betswirl.js new file mode 100644 index 00000000000..95726049706 --- /dev/null +++ b/projects/treasury/betswirl.js @@ -0,0 +1,90 @@ +const { sumTokens2 } = require('../helper/unwrapLPs') +const { staking } = require('../helper/staking') + +const banks = { + bsc: [ + [18371153, 1, "0xC7130b9D454243BE816B7f5Ab09E7eF292b0c465"], + [21181038, 2, "0xF26E41e3714eFe1ff03b423f45DCc31a98C21867"], + [23111708, 3, "0x2A555e3AD89571b931FF6c7b8B7E655D62dbC9F8"], + [Infinity, 4, "0xa475f643aa480a3df3e9872b6e80e75ae99b19db"], + ], + polygon: [ + [29120547, 1, "0x72A5b0295EAaCC8c005Ec6a800cB9BECEd73DA0E"], + [32887029, 2, "0x1a54574CBAe9f8a4f9dd19d56687F2266d0C9d31"], + [35722686, 3, "0x2528401607cc0590d31c2fCA129a75dc13b1dbB7"], + [Infinity, 4, "0x999B6D28A9e78C4bE13D51469c49585D6D25be5E"], + ], + avax: [ + [19707470, 2, "0x187De399100aA962F209Aa78621F5138ACA6111f"], + [Infinity, 3, "0x908A71B19B25f3c7Cdc7597136d8f4AC068d4971"], + ], +}; + +function treasury(chain) { + return async (_timestamp, _block, {[chain]: block}, { api }) => { + const abiV1 = 'function getTokens() view returns (tuple(uint8 decimals, address tokenAddress, string name, string symbol, tuple(bool allowed, tuple(uint16 dividend, uint16 referral, uint16 treasury, uint16 team, uint256 dividendAmount, uint256 treasuryAmount, uint256 teamAmount) houseEdgeSplit, uint256 balanceReference, tuple(uint16 thresholdRate, uint16 toTreasury, uint16 toTeam) balanceOverflow) token)[])' + const abiV2 = 'function getTokens() view returns (tuple(uint8 decimals, address tokenAddress, string name, string symbol, tuple(bool allowed, uint16 balanceRisk, address partner, tuple(uint16 dividend, uint16 referral, uint16 partner, uint16 treasury, uint16 team, uint256 dividendAmount, uint256 partnerAmount, uint256 treasuryAmount, uint256 teamAmount, uint256 referralAmount, uint256 minPartnerTransferAmount) houseEdgeSplit, uint256 balanceReference, tuple(uint16 thresholdRate, uint16 toTreasury, uint16 toTeam) balanceOverflow) token)[])' + const currentAbi = 'function getTokens() view returns (tuple(uint8 decimals, address tokenAddress, string name, string symbol, tuple(bool allowed, bool paused, uint16 balanceRisk, uint64 VRFSubId, address partner, uint256 minBetAmount, uint256 minPartnerTransferAmount, tuple(uint16 bank, uint16 dividend, uint16 partner, uint16 treasury, uint16 team, uint256 dividendAmount, uint256 partnerAmount, uint256 treasuryAmount, uint256 teamAmount) houseEdgeSplit) token)[])' + + const ownerTokens = [] + // Some tokens are still on the old contracts. + let oldBankAddress + let abi + if (chain === 'polygon') { + [, , oldBankAddress] = banks.polygon[1] + abi = abiV2 + } else if (chain === 'bsc') { + [, , oldBankAddress] = banks.bsc[2] + abi = currentAbi + } + if (oldBankAddress) { + const tokens = await api.call({ + target: oldBankAddress, + abi, + }); + ownerTokens.push([tokens.map(i => i.tokenAddress), oldBankAddress]) + } + + // Get the Bank for the input block + const [, bankVersion, bankAddressOfBlock] = banks[chain].find( + ([bankLastBlock]) => (block || 999999999999) < bankLastBlock + ); + + // Retrieves all tokens from the Bank contract + if (bankVersion === 1) { + abi = abiV1 + } else if (bankVersion === 2) { + abi = abiV2 + } else { + abi = currentAbi + } + const tokens = await api.call({ + target: bankAddressOfBlock, + abi, + }); + + // Filter BetSwirl's governance token + const tokensWithoutBETS = tokens.filter((token) => token.symbol !== "BETS").map(i => i.tokenAddress) + ownerTokens.push([tokensWithoutBETS, bankAddressOfBlock]) + return sumTokens2({ ownerTokens, api, }) + }; +} + +module.exports = { + methodology: + "BetSwirl has no users TVL yet. However, it includes the bankrolls amounts (each tokens amount in the bank allowing players to bet).", + // The first Bank was deployed on Polygon at tx 0x6b99f617946d2f8c23adcd440cd3309d2da750e52d135853f38a0da11cdc3233 + start: 1648344312, // new Date(Date.UTC(2022, 2, 27, 1, 25, 12)).getTime() / 1e3, + bsc: { + tvl: treasury("bsc"), + ownTokens: staking('0xa475f643aa480a3df3e9872b6e80e75ae99b19db', '0x3e0a7C7dB7bB21bDA290A80c9811DE6d47781671'), + }, + polygon: { + tvl: treasury("polygon"), + ownTokens: staking('0x999B6D28A9e78C4bE13D51469c49585D6D25be5E', '0x9246a5f10a79a5a939b0c2a75a3ad196aafdb43b'), + }, + avax:{ + tvl: treasury("avax"), + ownTokens: staking('0x908A71B19B25f3c7Cdc7597136d8f4AC068d4971', '0xc763f8570A48c4c00C80B76107cbE744dDa67b79'), + }, +}; diff --git a/projects/treasury/bitdao.js b/projects/treasury/bitdao.js new file mode 100644 index 00000000000..6577112ff5a --- /dev/null +++ b/projects/treasury/bitdao.js @@ -0,0 +1,28 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress,treasuryExports } = require("../helper/treasury"); + +const bitdaoTreasury1 = "0x78605Df79524164911C144801f41e9811B7DB73D"; + +const BIT = "0x1A4b46696b2bB4794Eb3D4c26f1c55F9170fa4C5"; + +const LP = "0xC36442b4a4522E871399CD717aBDD847Ab11FE88" + + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.USDC,//USDC + ADDRESSES.ethereum.DAI,//DAI + ADDRESSES.ethereum.WETH,//WETH + ADDRESSES.ethereum.USDT,//USDT + '0x50D1c9771902476076eCFc8B2A83Ad6b9355a4c9',//FTT + '0x8798249c2E607446EfB7Ad49eC89dD1865Ff4272',//xSUSHI + "0x52A8845DF664D76C69d2EEa607CD793565aF42B8", + ], + owners: [bitdaoTreasury1], + ownTokens: [BIT, LP], + resolveLP: true, + resolveUniV3: true, + }, +}) \ No newline at end of file diff --git a/projects/treasury/btcst.js b/projects/treasury/btcst.js new file mode 100644 index 00000000000..f27d3c17538 --- /dev/null +++ b/projects/treasury/btcst.js @@ -0,0 +1,11 @@ +const { staking, } = require("../helper/staking"); + +const treasuryContract = "0xAd3784cD071602d6c9c2980d8e0933466C3F0a0a"; +const BTCST = "0x78650B139471520656b9E7aA7A5e9276814a38e9"; + +module.exports = { + bsc: { + tvl: () => 0, + ownTokens: staking(treasuryContract, BTCST) + }, +}; diff --git a/projects/treasury/camelot.js b/projects/treasury/camelot.js new file mode 100644 index 00000000000..93095c1a398 --- /dev/null +++ b/projects/treasury/camelot.js @@ -0,0 +1,16 @@ + +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0x03ff2d78afb69e0859ec6beb4cf107d3741e97ab"; + +module.exports = treasuryExports({ + arbitrum: { + owners: [treasury, ], + ownTokens: [ + '0x3d9907f9a368ad0a51be60f7da3b97cf940982d8', + ], + tokens: [ + '0x13ad51ed4f1b7e9dc168d8a00cb3f4ddd85efa60', + ], + }, +}); \ No newline at end of file diff --git a/projects/treasury/cap.js b/projects/treasury/cap.js new file mode 100644 index 00000000000..b73b640e8ab --- /dev/null +++ b/projects/treasury/cap.js @@ -0,0 +1,21 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport, nullAddress, } = require('../helper/unwrapLPs') + +const contracts = { + "treasury": "0x283C41b726634fBD6B72aA22741B202DB7E56aaC", + "treasuryV2": "0x1058AFe66BB5b79C295CCCE51016586949Bc4e8d", +}; +const cap = "0x031d35296154279dc1984dcd93e392b1f946737b"; +const usdc = ADDRESSES.arbitrum.USDC; + +module.exports = { + arbitrum: { + tvl: sumTokensExport({ + tokensAndOwners: [ + [usdc, contracts.treasury], + [nullAddress, contracts.treasury], + [nullAddress, contracts.treasuryV2], + ] + }), + } +}; \ No newline at end of file diff --git a/projects/treasury/cat-in-a-box.js b/projects/treasury/cat-in-a-box.js new file mode 100644 index 00000000000..57db7dc595d --- /dev/null +++ b/projects/treasury/cat-in-a-box.js @@ -0,0 +1,12 @@ +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + ], + owners: ['0x98e6475C01D018Ae78c02ef48738f687538226Af'], + ownTokens: ['0x7690202e2C2297bcD03664e31116d1dFfE7e3B73'], + resolveUniV3: true, + }, +}) \ No newline at end of file diff --git a/projects/treasury/cerberusdao.js b/projects/treasury/cerberusdao.js new file mode 100644 index 00000000000..a869183ff5d --- /dev/null +++ b/projects/treasury/cerberusdao.js @@ -0,0 +1,3 @@ +module.exports = require("../cerberusdao/index"); + +delete module.exports.ethereum.staking \ No newline at end of file diff --git a/projects/treasury/chaintools.js b/projects/treasury/chaintools.js new file mode 100644 index 00000000000..808a225cc02 --- /dev/null +++ b/projects/treasury/chaintools.js @@ -0,0 +1,11 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const MULTISIG_ADDRESS = "0xb0Df68E0bf4F54D06A4a448735D2a3d7D97A2222"; +const CTLS_ADDRESS = "0xE155F64B9aD8c81318c313196a60c72e72fD2cD1"; +const { sumTokensExport } = require('../helper/unwrapLPs') + +module.exports = { + ethereum: { + tvl: sumTokensExport({ owners: [MULTISIG_ADDRESS,], tokens: [ADDRESSES.ethereum.WETH, ADDRESSES.null, ADDRESSES.ethereum.USDC,], }), + ownTokens: sumTokensExport({ owners: [MULTISIG_ADDRESS,], tokens: [CTLS_ADDRESS, ], }), + }, +}; diff --git a/projects/treasury/compound.js b/projects/treasury/compound.js new file mode 100644 index 00000000000..c82595909ed --- /dev/null +++ b/projects/treasury/compound.js @@ -0,0 +1,26 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0x3d9819210A31b4961b30EF54bE2aeD79B9c9Cd3B"; +const treasury2 = "0x6d903f6003cca6255d85cca4d3b5e5146dc33925" +const vestingAddress = "0x2775b1c75658Be0F640272CCb8c72ac986009e38"; +const COMP = "0xc00e94Cb662C3520282E6f5717214004A7f26888"; + + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + '0xf650C3d88D12dB855b8bf7D11Be6C55A4e07dCC9',//cUSDT + '0xE41d2489571d322189246DaFA5ebDe1F4699F498',//zrx + '0x39AA39c021dfbaE8faC545936693aC917d5E7563',//cUSDC + '0xc00e94Cb662C3520282E6f5717214004A7f26888', + ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.WBTC, + ADDRESSES.ethereum.UNI, + ADDRESSES.ethereum.DAI + ], + owners: [treasury, vestingAddress, treasury2], + ownTokens: [COMP], + }, +}) \ No newline at end of file diff --git a/projects/treasury/convex.js b/projects/treasury/convex.js new file mode 100644 index 00000000000..f7aafb92a09 --- /dev/null +++ b/projects/treasury/convex.js @@ -0,0 +1,32 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const convexTreasuryVault = "0x1389388d01708118b497f59521f6943Be2541bb7"; +const treasuryARB = "0x6111abf720051309012fcdbc2910054e41dcff8c" + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.CRV, + ADDRESSES.ethereum.SNX, + "0x31429d1856aD1377A8A0079410B297e1a9e214c2", // ANGLE + ADDRESSES.ethereum.LIDO, + "0xdBdb4d16EdA451D0503b854CF79D55697F90c8DF", // ALCX + "0x92E187a03B6CD19CB6AF293ba17F2745Fd2357D5", // DUCK + ADDRESSES.ethereum.FTM, + "0x3472A5A71965499acd81997a54BBA8D852C6E53d", // BADGER + "0xa3BeD4E1c75D00fa6f4E5E6922DB7261B5E9AcD2", // MTA + "0x8207c1FfC5B6804F6024322CcF34F29c3541Ae26", // OGN + "0xCdF7028ceAB81fA0C6971208e83fa7872994beE5", // T + ], + owners: [convexTreasuryVault], + ownTokens: [ADDRESSES.ethereum.CVX, ADDRESSES.ethereum.cvxCRV], + }, + arbitrum: { + tokens: [ + nullAddress, + ], + owners: [treasuryARB], + }, +}); diff --git a/projects/treasury/crabada.js b/projects/treasury/crabada.js new file mode 100644 index 00000000000..bf57db68b18 --- /dev/null +++ b/projects/treasury/crabada.js @@ -0,0 +1,31 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { staking } = require("../helper/staking"); + +const CRA = "0xa32608e873f9ddef944b24798db69d80bbb4d1ed"; + +const treasuryContracts = [ + //mains treasury + "0x96DD95307295e2f72E6382Fc5130F1A8DB74042C", + // Breeding fees + "0x4e57A39Cac2499aBeafd3698F7164eCBFde008eE", + // Marketplace fees + "0x49F6fC3f882e2Cd915E38bA377f8e977c11e0F66", + // Tavern fees + "0x2BA9033E49EC1aa030fA46DE6d6793983945497E", +]; + +const lpTokens = [ + "0xf693248F96Fe03422FEa95aC0aFbBBc4a8FdD172", //TUS + "0x140CAc5f0e05cBEc857e65353839FddD0D8482C1", // WAVAX-CRA JLP + "0x565d20BD591b00EAD0C927e4b6D7DD8A33b0B319", // WAVAX-TUS JLP + "0x21889033414f652f0fD0e0f60a3fc0221d870eE4", // CRA-TUS JLP + "0x134905461773eF228b66CEBd5E1FF06D7CC79B12", // TUS-CRAM JLP + ADDRESSES.avax.USDC_e // USDC +]; + +module.exports = { + avax: { + tvl: staking(treasuryContracts, lpTokens), + ownTokens: staking(treasuryContracts, [CRA]), + }, +}; diff --git a/projects/treasury/cream-finance.js b/projects/treasury/cream-finance.js new file mode 100644 index 00000000000..89e28c3dfb3 --- /dev/null +++ b/projects/treasury/cream-finance.js @@ -0,0 +1,17 @@ +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0x6D5a7597896A703Fe8c85775B23395a48f971305"; +const CREAM = "0x2ba592F78dB6436527729929AAf6c908497cB200"; + + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + "0xc00e94Cb662C3520282E6f5717214004A7f26888",//comp + "0x49D72e3973900A195A155a46441F0C08179FdB64",//CRETH2 + ], + owners: [treasury], + ownTokens: [CREAM], + }, +}) diff --git a/projects/treasury/croblanc.js b/projects/treasury/croblanc.js new file mode 100644 index 00000000000..0d61e2165bb --- /dev/null +++ b/projects/treasury/croblanc.js @@ -0,0 +1,10 @@ +const { staking } = require("../helper/staking"); + +const treasury = "0xb20234c33337537111f4ab6f5EcaD400134aC143"; +const WCRO = "0x5c7f8a570d578ed84e63fdfa7b1ee72deae1ae23"; + +module.exports = { + cronos: { + tvl: staking(treasury, WCRO, "cronos"), + }, +}; diff --git a/projects/treasury/cryptex.js b/projects/treasury/cryptex.js new file mode 100644 index 00000000000..5d7abdcf619 --- /dev/null +++ b/projects/treasury/cryptex.js @@ -0,0 +1,25 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasuryARB = "0x9474b771fb46e538cfed114ca816a3e25bb346cf"; +const treasuryETH = "0xa54074b2cc0e96a43048d4a68472F7F046aC0DA8" +const treasury2 = "0xa70b638B70154EdfCbb8DbbBd04900F328F32c35" +const ctx = "0x321C2fE4446C7c963dc41Dd58879AF648838f98D" +module.exports = treasuryExports({ + arbitrum: { + tokens: [ + nullAddress, + ], + owners: [treasuryARB], + }, + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.LINK + ], + owners: [treasuryETH, treasury2], + ownTokens: [ctx], + + }, +}) \ No newline at end of file diff --git a/projects/treasury/cryptodickbutts.js b/projects/treasury/cryptodickbutts.js new file mode 100644 index 00000000000..49da62aeae8 --- /dev/null +++ b/projects/treasury/cryptodickbutts.js @@ -0,0 +1,23 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress,treasuryExports } = require("../helper/treasury"); + +const treasury = "0xf14d484b29a8ac040feb489afadb4b972422b4e9"; +const dick = "0x22BDc8Ad19aE84d9327E81FAD4F5973b91fbaA60" + + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.USDT,//TETHER + ADDRESSES.ethereum.USDC,//USDC + ADDRESSES.ethereum.WETH, + "0x6d3D490964205c8bC8DeD39e48e88E8Fde45b41f", + "0x0000000000A39bb272e79075ade125fd351887Ac", + ADDRESSES.ethereum.DAI + ], + owners: [treasury], + ownTokens: [dick], + + }, +}) \ No newline at end of file diff --git a/projects/treasury/cthulhufinance.js b/projects/treasury/cthulhufinance.js new file mode 100644 index 00000000000..758e6fe9fac --- /dev/null +++ b/projects/treasury/cthulhufinance.js @@ -0,0 +1,15 @@ +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0x371405Aea16D5916703C74580247196BA9EA531F"; +const CTH = "0xF8e943f646816e4B51279B8934753821ED832Dca"; + + +module.exports = treasuryExports({ + optimism: { + tokens: [ + nullAddress + ], + owners: [treasury], + ownTokens: [CTH], + }, +}) diff --git a/projects/treasury/cubo.js b/projects/treasury/cubo.js new file mode 100644 index 00000000000..86451c3f43c --- /dev/null +++ b/projects/treasury/cubo.js @@ -0,0 +1,21 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasuryContract = "0xb495ffc5acd7e2fd909c23c30d182e6719fbe9ec"; +const CUBO_TOKEN = "0x381d168DE3991c7413d46e3459b48A5221E3dfE4"; +const DAI = ADDRESSES.polygon.DAI +const DRAGON_QUICK = '0xf28164a485b0b2c90639e47b0f377b4a438a16b1' +const MOO_CRV_TriCrypto = '0x5A0801BAd20B6c62d86C566ca90688A6b9ea1d3f' +const MOO_AM3CRV = '0xAA7C2879DaF8034722A0977f13c343aF0883E92e' + + +module.exports = treasuryExports({ + polygon: { + tokens: [ + nullAddress, + DAI, DRAGON_QUICK, MOO_CRV_TriCrypto, MOO_AM3CRV, + ], + owners: [treasuryContract], + ownTokens: [CUBO_TOKEN], + }, +}) \ No newline at end of file diff --git a/projects/treasury/curve.js b/projects/treasury/curve.js new file mode 100644 index 00000000000..61939f23cd8 --- /dev/null +++ b/projects/treasury/curve.js @@ -0,0 +1,13 @@ +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0x25877b9413cc7832a6d142891b50bd53935fef82"; + +module.exports = treasuryExports({ + arbitrum: { + owners: [treasury, ], + ownTokens: [ ], + tokens: [ + nullAddress, + ], + }, +}); \ No newline at end of file diff --git a/projects/treasury/cvi.js b/projects/treasury/cvi.js new file mode 100644 index 00000000000..b783f75290a --- /dev/null +++ b/projects/treasury/cvi.js @@ -0,0 +1,12 @@ +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0x7f4b135782c4a3b1c78c93f23f2016cb5cd96cc8"; + +module.exports = treasuryExports({ + arbitrum: { + tokens: [ + nullAddress, + ], + owners: [treasury,], + }, +}) \ No newline at end of file diff --git a/projects/treasury/defender.js b/projects/treasury/defender.js new file mode 100644 index 00000000000..ac67ec12a6e --- /dev/null +++ b/projects/treasury/defender.js @@ -0,0 +1,12 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require("../helper/unwrapLPs"); + +const treasuryContractsBSC = [ + "0x3068405d5A640028463856D0dbDAE13B41AccE1f", +]; + +module.exports = { + bsc: { + tvl: sumTokensExport({ owners: treasuryContractsBSC, tokens: [ADDRESSES.bsc.ETH]}), + }, +}; diff --git a/projects/treasury/deri-protocol.js b/projects/treasury/deri-protocol.js new file mode 100644 index 00000000000..56243093f9c --- /dev/null +++ b/projects/treasury/deri-protocol.js @@ -0,0 +1,12 @@ +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0x20a5c32ee19bcdb2635455859e64ba5a1d1acab2"; + +module.exports = treasuryExports({ + arbitrum: { + tokens: [ + nullAddress, + ], + owners: [treasury], + }, +}) \ No newline at end of file diff --git a/projects/treasury/dex.js b/projects/treasury/dex.js new file mode 100644 index 00000000000..67ba126788c --- /dev/null +++ b/projects/treasury/dex.js @@ -0,0 +1,28 @@ +const ADDRESSES = require('../helper/coreAssets.json') + +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const TREASURY = "0xa5f3d6a33c5a5bcdff8f81c88ca00f457b699e0f"; +const TOKENS = { + USDEX_USDC_LP: '0x79f3bb5534b8f060b37b3e5dea032a39412f6b10', + DEXSHARE_BNB_LP: '0x65d83463fc023bffbd8ac9a1a2e1037f4bbdb399', + DEXIRA_BNB_LP: '0x01b279a06f5f26bd3f469a3e730097184973fc8a', + DEXSHARE: '0xf4914e6d97a75f014acfcf4072f11be5cffc4ca6', + DEXIRA: '0x147e07976e1ae78287c33aafaab87760d32e50a5', + WDHEX_DEXSARE: '0x6647047433df4cfc9912d092fd155b9d972a4a85', + BNB: ADDRESSES.bsc.WBNB, + USDC: ADDRESSES.bsc.USDC +}; + + +module.exports = treasuryExports({ + bsc: { + tokens: [ + nullAddress, + TOKENS.BNB, + TOKENS.USDC + ], + owners: [TREASURY], + ownTokens: [TOKENS.DEXSHARE,TOKENS.DEXIRA,TOKENS.USDEX_USDC_LP,TOKENS.WDHEX_DEXSARE,TOKENS.DEXIRA_BNB_LP], + }, +}) \ No newline at end of file diff --git a/projects/treasury/dforce.js b/projects/treasury/dforce.js new file mode 100644 index 00000000000..cb23dbea853 --- /dev/null +++ b/projects/treasury/dforce.js @@ -0,0 +1,15 @@ + +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0xc097ea3ea6d6851e8c274ace6373107c5a253f62"; + +module.exports = treasuryExports({ + arbitrum: { + owners: [treasury, ], + ownTokens: [ + ], + tokens: [ + nullAddress, + ], + }, +}); \ No newline at end of file diff --git a/projects/treasury/dfyn.js b/projects/treasury/dfyn.js new file mode 100644 index 00000000000..10d6d79db7f --- /dev/null +++ b/projects/treasury/dfyn.js @@ -0,0 +1,17 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress,treasuryExports } = require("../helper/treasury"); + +const Treasury = "0x5C35D4BcF0827a22370915E75c387EC470338c10"; + + + +module.exports = treasuryExports({ + arbitrum: { + tokens: [ + nullAddress, + ADDRESSES.arbitrum.USDC, + "0x8971dFb268B961a9270632f28B24F2f637c94244" + ], + owners: [Treasury], + }, +}) \ No newline at end of file diff --git a/projects/treasury/dnadollar.js b/projects/treasury/dnadollar.js new file mode 100644 index 00000000000..f18747a6b59 --- /dev/null +++ b/projects/treasury/dnadollar.js @@ -0,0 +1,13 @@ +const { staking } = require("../helper/staking"); + +const treasuryContract = "0x1420287565FD5Ebec8FbD720c17Cd911600449d3"; + +const DNA = "0xcc57f84637b441127f2f74905b9d99821b47b20c"; + + +module.exports = { + cronos: { + tvl: () => ({}), + ownTokens: staking(treasuryContract, DNA, "cronos"), + }, +}; diff --git a/projects/treasury/dodo.js b/projects/treasury/dodo.js new file mode 100644 index 00000000000..1b00da83902 --- /dev/null +++ b/projects/treasury/dodo.js @@ -0,0 +1,30 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress,treasuryExports } = require("../helper/treasury"); + +const dodoTreasury = "0xAB21016BD4127638b8c555e36636449b33dF1C38"; + +const DODO = "0x43dfc4159d86f3a37a5a4b3d4580b888ad7d4ddd"; + + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.USDT,//TETHER + ADDRESSES.ethereum.USDC,//USDC + ], + owners: [dodoTreasury], + ownTokens: [DODO], + }, + arbitrum: { + tokens: [ + nullAddress, + ADDRESSES.arbitrum.WBTC, // WBTC + ADDRESSES.arbitrum.USDC, // USDC + ADDRESSES.arbitrum.WETH, // WETH + ADDRESSES.arbitrum.USDT, // USDT + ], + owners: ['0x01d3e7271c278aa3aa56eeba6a109b2c200679fa'], + ownTokens: ['0x69eb4fa4a2fbd498c257c57ea8b7655a2559a581'], + }, +}) \ No newline at end of file diff --git a/projects/treasury/dopex.js b/projects/treasury/dopex.js new file mode 100644 index 00000000000..2c5eb5e8c89 --- /dev/null +++ b/projects/treasury/dopex.js @@ -0,0 +1,20 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress,treasuryExports } = require("../helper/treasury"); + +const Treasury = "0x2fa6F21eCfE274f594F470c376f5BDd061E08a37"; + +const DPX = "0x6C2C06790b3E3E3c38e12Ee22F8183b37a13EE55"; +const RDPX = "0x32Eb7902D4134bf98A28b963D26de779AF92A212" + + +module.exports = treasuryExports({ + arbitrum: { + tokens: [ + nullAddress, + ADDRESSES.arbitrum.USDT, + '0x7418F5A2621E13c05d1EFBd71ec922070794b90a' + ], + owners: [Treasury], + ownTokens: [DPX, RDPX], + }, +}) \ No newline at end of file diff --git a/projects/treasury/dxdao.js b/projects/treasury/dxdao.js new file mode 100644 index 00000000000..6466ec469c3 --- /dev/null +++ b/projects/treasury/dxdao.js @@ -0,0 +1,28 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0x519b70055af55a007110b4ff99b0ea33071c720a"; +const DXD = "0xa1d65e8fb6e87b60feccbc582f7f97804b725521"; + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + '0x6cAcDB97e3fC8136805a9E7c342d866ab77D0957',//swapr + ADDRESSES.ethereum.DAI,//dai + '0xFe2e637202056d30016725477c5da089Ab0A043A',//seth2 + ADDRESSES.ethereum.USDC,//usdc + ADDRESSES.ethereum.LUSD,//lusd + ADDRESSES.ethereum.STETH,//steth + '0xC18360217D8F7Ab5e7c516566761Ea12Ce7F9D72',//ens + ADDRESSES.ethereum.RETH,//reth + '0x20BC832ca081b91433ff6c17f85701B6e92486c5',//reth2 + '0xEd91879919B71bB6905f23af0A68d231EcF87b14',//dmg + '0x93ED3FBe21207Ec2E8f2d3c3de6e058Cb73Bc04d',//pnk + '0xF5581dFeFD8Fb0e4aeC526bE659CFaB1f8c781dA',//hopr + ADDRESSES.ethereum.WETH,//weth + ], + owners: [treasury], + ownTokens: [DXD], + }, + }) \ No newline at end of file diff --git a/projects/treasury/dydx.js b/projects/treasury/dydx.js new file mode 100644 index 00000000000..cdfb684d8ec --- /dev/null +++ b/projects/treasury/dydx.js @@ -0,0 +1,18 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress,treasuryExports } = require("../helper/treasury"); + +const dydxTreasury = "0xE710CEd57456D3A16152c32835B5FB4E72D9eA5b"; + +const DYDX = "0x92d6c1e31e14520e676a687f0a93788b716beff5"; + + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.USDT,//TETHER + ], + owners: [dydxTreasury], + ownTokens: [DYDX], + }, +}) \ No newline at end of file diff --git a/projects/treasury/ease-org.js b/projects/treasury/ease-org.js new file mode 100644 index 00000000000..159aad99c0c --- /dev/null +++ b/projects/treasury/ease-org.js @@ -0,0 +1,19 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0x1f28ed9d4792a567dad779235c2b766ab84d8e33"; +const EASE = "0xEa5eDef1287AfDF9Eb8A46f9773AbFc10820c61c"; + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.DAI, + ADDRESSES.ethereum.USDC, + '0x7CA51456b20697A0E5Be65e5AEb65dfE90f21150', + '0x43632E3448cd47440fEE797258081414D91A58cE', + ], + owners: [treasury], + ownTokens: [EASE], + }, + }) \ No newline at end of file diff --git a/projects/treasury/elements-fi.js b/projects/treasury/elements-fi.js new file mode 100644 index 00000000000..af18d426e4b --- /dev/null +++ b/projects/treasury/elements-fi.js @@ -0,0 +1,16 @@ + +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0x978982772b8e4055b921bf9295c0d74eb36bc54e"; + +module.exports = treasuryExports({ + arbitrum: { + owners: [treasury, ], + ownTokens: [ + '0x30123A6D38eb4a34B701627211EDE0BFF04Cd618', // ELMT + ], + tokens: [ + nullAddress, + ], + }, +}); \ No newline at end of file diff --git a/projects/treasury/empyreal.js b/projects/treasury/empyreal.js new file mode 100644 index 00000000000..f2a5674abc2 --- /dev/null +++ b/projects/treasury/empyreal.js @@ -0,0 +1,20 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0xF548a58DB6d86d466acd00Fc0F6De3b39Ea129D7"; + + +const EMP= "0x0DDCE00654f968DeD59A444da809F2B234047aB1"; + + +module.exports = treasuryExports({ + arbitrum: { + tokens: [ + nullAddress, + ADDRESSES.arbitrum.ARB, //ARB + ADDRESSES.arbitrum.USDC, //USDC + ], + owners: [treasury], + ownTokens: [EMP], + }, +}) \ No newline at end of file diff --git a/projects/treasury/ens.js b/projects/treasury/ens.js new file mode 100644 index 00000000000..21034401101 --- /dev/null +++ b/projects/treasury/ens.js @@ -0,0 +1,24 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0xFe89cc7aBB2C4183683ab71653C4cdc9B02D44b7"; +const vestingAddress = "0xd7a029db2585553978190db5e85ec724aa4df23f" +const treasury2 = "0x690f0581ececcf8389c223170778cd9d029606f2" + + +const ENS= "0xC18360217D8F7Ab5e7c516566761Ea12Ce7F9D72"; + + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.USDC, //USDC + ADDRESSES.ethereum.DAI, + ADDRESSES.ethereum.LINK + + ], + owners: [treasury, vestingAddress, treasury2], + ownTokens: [ENS], + }, +}) \ No newline at end of file diff --git a/projects/treasury/equilibre.js b/projects/treasury/equilibre.js new file mode 100644 index 00000000000..0cf0ff2f1a8 --- /dev/null +++ b/projects/treasury/equilibre.js @@ -0,0 +1,78 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { treasuryExports, nullAddress } = require("../helper/treasury"); + +const VARA = '0xE1da44C0dA55B075aE8E2e4b6986AdC76Ac77d73' + +const equilibre = [ + '0x3a724E0082b0E833670cF762Ea6bd711bcBdFf37', // TREASURY ETH + '0x79dE631fFb7291Acdb50d2717AE32D44D5D00732', // TREASURY KAVA + '0x283270C265eB3D6e910920AdFf85e746C8063fed', + '0x4722FE058da1D359c1428C8F9B8F5b4531b58D17', + '0xAb7778933fb44514c864b2610b5d7E2A0bD91DDF', + '0x498Dd5A79ab7e19Be1dA81738239214F807E3462', + '0x78B3Ec25D285F7a9EcA8Da8eb6b20Be4d5D70E84', + '0xfcb3E3797A77946891c88A841d35d47c8F22CF53', + '0xd5524479C013d19e440872175400F396f35645fF', + '0x3ca2c227D47DF650ffcD39b64527e7c6e2E91DD1', + '0xc9C384a9E7e28f7Ef55903eb90947fe3ce71D475', + '0xA43Dd020E147F3A9C5cCe6860Cc4f51Ff71B56dc', + '0xb5B0c913acF48Bfb7bcB95e2F4fA241693dea513', + '0x4396c6e2a70c6b3c7b8a1f9e4043632e1c93d430', + '0xF9Ec0C05288d6726e1B3a7ccfcaEAc7b134d5F50' +] + + +const tokens = [ + nullAddress, + //"0xE1da44C0dA55B075aE8E2e4b6986AdC76Ac77d73", // VARA + ADDRESSES.telos.ETH, // USDC + ADDRESSES.kava.WKAVA, // WKAVA + ADDRESSES.shiden.ETH, // DAI + ADDRESSES.moonriver.USDC, // ETH + ADDRESSES.telos.USDC, // WBTC + "0xC19281F22A075E0F10351cd5D6Ea9f0AC63d4327", // BIFI + "0x6c2c113c8cA73dB67224EF4D8C8dFCeC61e52a9C", // LQDR + "0xb84Df10966a5D7e1ab46D9276F55d57bD336AFC7", // MAI + ADDRESSES.kava.USX, // USX + "0x739ca6D71365a08f584c8FC4e1029045Fa8ABC4B", // ACS + "0xd86C8d4279CCaFbec840c782BcC50D201f277419", // MARE + "0x165DBb08de0476271714952C3C1F068693bd60D7", // TAROT + "0x74ccbe53f77b08632ce0cb91d3a545bf6b8e0979", // fBOMB + "0x9d9682577CA889c882412056669bd936894663fd", // swKAVA + "0xABd380327Fe66724FFDa91A87c772FB8D00bE488", // BNB + ADDRESSES.kava.axlUSDC, // axlUSDC + "0xE1E9dB9b4d51A8878f030094F7965edC5eEC7802", // xSHRAP + "0x7ae97042a4a0eb4d1eb370c34bfec71042a056b7", // SLM + "0x06beE9E7238a331B68D83Df3B5B9B16d5DBa83ff", // axlATOM + "0x5E237e61469d1A5b85fA8fba63EB4D4498Ea8dEF", // YFX + "0xEffaE8eB4cA7db99e954adc060B736Db78928467", // GMD + "0x489e54EEc6C228A1457975Eb150A7EFb8350b5bE", // spVARA + "0x443ab8d6ab303ce28f9031be91c19c6b92e59c8a", // TORE Old Toreus + "0x8549724fcC84ee9ee6c7A676F1Ba2Cc2f43AAF5B", // TORE + "0x53a5dD07127739e5038cE81eff24ec503A6CC479", // acsVARA + "0xC09c73F7B32573d178138E76C0e286BA21085c20", // QI + "0x0Fb3E4E84FB78C93E466a2117Be7bc8BC063E430", // CHAM + "0x990e157fC8a492c28F5B50022F000183131b9026", // LION + "0x471F79616569343e8e84a66F342B7B433b958154", // TIGER + "0x38481Fdc1aF61E6E72E0Ff46F069315A59779C65", // BEAR + "0x13db70Ad2f2b7064EbD5B0CAA13Af445a77360f7", // KONK + "0xFa4384b298084A0ef13F378853DEDbB33A857B31", // cpVARA + ADDRESSES.moonriver.USDT, // USDT + "0xde5ed76e7c05ec5e4572cfc88d1acea165109e44", // DEUS + "0xD22a58f79e9481D1a88e00c343885A588b34b68B", // DEXI + "0xde1e704dae0b4051e80dabb26ab6ad6c12262da0", // DEI +]; + + +module.exports = treasuryExports({ + ethereum: { + tokens: [nullAddress], + owners: ['0x8B21Bdb9B1aa2094460851dA19185A989529fBe3'] + }, + kava: { + tokens, + owners: equilibre, + ownTokenOwners: equilibre, + ownTokens: [VARA] + }, +}); diff --git a/projects/treasury/eth-foundation.js b/projects/treasury/eth-foundation.js new file mode 100644 index 00000000000..dfc066dd96f --- /dev/null +++ b/projects/treasury/eth-foundation.js @@ -0,0 +1,20 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae"; +const WETH = ADDRESSES.ethereum.WETH; +const ETH = ADDRESSES.null; + + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.USDC, //USDC + "0xd26114cd6EE289AccF82350c8d8487fedB8A0C07", //OMG + ADDRESSES.ethereum.BNB, //BNB + WETH + ], + owners: [treasury], + }, +}) \ No newline at end of file diff --git a/projects/treasury/ether.js b/projects/treasury/ether.js new file mode 100644 index 00000000000..b4acc5affcc --- /dev/null +++ b/projects/treasury/ether.js @@ -0,0 +1,26 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasuryOP = "0x8ba1f109551bD432803012645Ac136ddd64DBA72"; +const treasuryETH = "0x8ba1f109551bD432803012645Ac136ddd64DBA72" + +module.exports = treasuryExports({ + optimism: { + tokens: [ + nullAddress, + ADDRESSES.optimism.USDC, // USDC + ADDRESSES.optimism.OP + ], + owners: [treasuryOP], + }, + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.USDC, // USDC + ADDRESSES.ethereum.TUSD, + ADDRESSES.ethereum.DAI, + ADDRESSES.ethereum.USDT + ], + owners: [treasuryETH], + }, +}); \ No newline at end of file diff --git a/projects/treasury/ethglobal.js b/projects/treasury/ethglobal.js new file mode 100644 index 00000000000..1fb3aaa9b1a --- /dev/null +++ b/projects/treasury/ethglobal.js @@ -0,0 +1,16 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0x336DEe4022d6CC2F95cfe9e0949B9E0EDDAC457D"; + +module.exports = treasuryExports({ + optimism: { + tokens: [ + nullAddress, + ADDRESSES.optimism.USDC, // USDC + ADDRESSES.optimism.OP + ], + owners: [treasury], + ownTokens: [], + }, +}); diff --git a/projects/treasury/euler.js b/projects/treasury/euler.js new file mode 100644 index 00000000000..1f52231c833 --- /dev/null +++ b/projects/treasury/euler.js @@ -0,0 +1,17 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0xcAD001c30E96765aC90307669d578219D4fb1DCe"; +const eul = "0xd9Fcd98c322942075A5C3860693e9f4f03AAE07b"; + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + ADDRESSES.ethereum.USDC, // USDC + ADDRESSES.ethereum.USDT, // USDT + "0xc944E90C64B2c07662A292be6244BDf05Cda44a7", // GRT + ], + owners: [treasury], + ownTokens: [eul], + }, +}); diff --git a/projects/treasury/evmos-dao.js b/projects/treasury/evmos-dao.js new file mode 100644 index 00000000000..ecc78b01135 --- /dev/null +++ b/projects/treasury/evmos-dao.js @@ -0,0 +1,23 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const community_pool = "0x93354845030274cd4bf1686abd60ab28ec52e1a7"; +const treasury = "0xc3c5156911bf53f12913b68e0532096536b30600"; +const forge_liquidity = "0x4c3c271ca2e841c0051c0402021ddaef3ce666d0"; +const forge_owner = "0x2A72df162bD5B9Ba4cBB4F28bCE590c20db7aEC1"; + +const tokens = [ + nullAddress, + ADDRESSES.evmos.WEVMOS, + ADDRESSES.evmos.STEVMOS, + ADDRESSES.evmos.STRIDE, + ADDRESSES.evmos.AXL_USDC +] + + +module.exports = treasuryExports({ + evmos: { + tokens: tokens, + owners: [community_pool, treasury, forge_liquidity, forge_owner], + }, +}) \ No newline at end of file diff --git a/projects/treasury/exactly.js b/projects/treasury/exactly.js new file mode 100644 index 00000000000..05e34a0f5c6 --- /dev/null +++ b/projects/treasury/exactly.js @@ -0,0 +1,26 @@ +const { sumTokens2 } = require('../helper/unwrapLPs') + +/** @type {Record} */ +const config = { + ethereum: { + auditor: "0x310A2694521f75C7B2b64b5937C16CE65C3EFE01", + }, + optimism: { + auditor: "0xaEb62e6F27BC103702E7BC879AE98bceA56f027E", + }, +}; + +Object.entries(config).forEach(([chain, { auditor }]) => { + module.exports[chain] = { + tvl: async (_, __, ___, { api }) => { + const markets = await api.call({ abi: abis.allMarkets, target: auditor, }); + const treasuries = await api.multiCall({ abi: abis.treasury, calls: markets, }) + return sumTokens2({ api, tokens: markets, owners: treasuries, }) + }, + }; +}); + +const abis = { + allMarkets: "function allMarkets() view returns (address[])", + treasury: "function treasury() view returns (address)", +}; diff --git a/projects/treasury/fantohm-dao.js b/projects/treasury/fantohm-dao.js new file mode 100644 index 00000000000..9aa52d7fdf5 --- /dev/null +++ b/projects/treasury/fantohm-dao.js @@ -0,0 +1,22 @@ +const index = require('../fantOHM/index') +const { ohmTreasury } = require('../helper/treasury') +const { sumTokensExport } = require('../helper/unwrapLPs') + +const fantomTreasuryContract = "0xA3b52d5A6d2f8932a5cD921e09DA840092349D71"; +const fantomGnosisContract = "0x34F93b12cA2e13C6E64f45cFA36EABADD0bA30fC"; +const ethTreasuryContract = "0x9042E869BedCD2BB3EEa241aC0032cadAE8DF006"; + +const ethTradfi3mContract = "0xCD8A46dC7EE4488b441Ae1CD3b5BCa48d5389C12"; +const ethTradfi6mContract = "0xD9fDd86ecc03e34DAf9c645C40DF670406836816" +const ftmTradfi3mContract = "0xEFbe7fe9E8b407a3F0C0451E7669E70cDD0C4C77"; +const ftmTradfi6mContract = "0xB1c77436BC180009709Be00C9e852246476321A3"; +module.exports = ohmTreasury(index) + +module.exports.fantom.ownTokens = sumTokensExport({ + owners: [fantomTreasuryContract, fantomGnosisContract, ftmTradfi3mContract, ftmTradfi6mContract, ], + tokens: ['0x6fc9383486c163fa48becdec79d6058f984f62ca', '0xfa1FBb8Ef55A4855E5688C0eE13aC3f202486286'] +}) +module.exports.ethereum.ownTokens = sumTokensExport({ + owners: [ethTreasuryContract, ethTradfi3mContract, ethTradfi6mContract, ], + tokens: ['0x02B5453D92B730F29a86A0D5ef6e930c4Cf8860B',] +}) \ No newline at end of file diff --git a/projects/treasury/fei-protocol.js b/projects/treasury/fei-protocol.js new file mode 100644 index 00000000000..abc4bb0b95d --- /dev/null +++ b/projects/treasury/fei-protocol.js @@ -0,0 +1,14 @@ +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0x8d5ed43dca8c2f7dfb20cf7b53cc7e593635d7b9"; +const TRIBE = "0xc7283b66Eb1EB5FB86327f08e1B5816b0720212B" + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + ], + owners: [treasury], + ownTokens: [TRIBE], + }, +}) \ No newline at end of file diff --git a/projects/treasury/femboy-dao.js b/projects/treasury/femboy-dao.js new file mode 100644 index 00000000000..274f7e02660 --- /dev/null +++ b/projects/treasury/femboy-dao.js @@ -0,0 +1,10 @@ +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + ], + owners: ['0xf78A448E464a1fEB693D76c9211D2d03ae488206',], + }, +}) \ No newline at end of file diff --git a/projects/treasury/flair-dex.js b/projects/treasury/flair-dex.js new file mode 100644 index 00000000000..e4a699a8198 --- /dev/null +++ b/projects/treasury/flair-dex.js @@ -0,0 +1,23 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const FLDXTreasury = "0xAD276dA5aAad4181B991fd93Bc7dCCFb46811003"; +const FLDX = "0x107D2b7C619202D994a4d044c762Dd6F8e0c5326" + +module.exports = treasuryExports({ + avax: { + tokens: [ + nullAddress, + ADDRESSES.avax.USDt,//USDT + ADDRESSES.avax.USDT_e,//USDT.e + ADDRESSES.avax.WAVAX,//AVAX + ADDRESSES.avax.USDC,//USDC + ADDRESSES.avax.USDC_e,//USDC.e + ADDRESSES.polygon.BUSD,//BUSD + "0x1C1CDF8928824dac36d84B3486D598B9799bA6c0",//aBASED + "0x107D2b7C619202D994a4d044c762Dd6F8e0c5326",//FLDX + ], + owners: [FLDXTreasury], + ownTokens: [FLDX], + }, +}) \ No newline at end of file diff --git a/projects/treasury/flokifi-locker.js b/projects/treasury/flokifi-locker.js new file mode 100644 index 00000000000..775541a1d2d --- /dev/null +++ b/projects/treasury/flokifi-locker.js @@ -0,0 +1,30 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasuryETH = "0x2b9d5c7f2EAD1A221d771Fb6bb5E35Df04D60AB0"; +const treasuryETH2 = "0xea9a5a3Ac7545E1Ddce79fC5803Df0f317A3D0f6" +const flokiETH = "0xcf0C122c6b73ff809C693DB761e7BaeBe62b6a2E" + +const treasuryBSC = "0x17e98a24f992BB7bcd62d6722d714A3C74814B94" +const flokiBSC = "0xfb5B838b6cfEEdC2873aB27866079AC55363D37E" + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + "0xca7c2771D248dCBe09EABE0CE57A62e18dA178c0", + ADDRESSES.ethereum.USDT, + ADDRESSES.ethereum.USDC, + "0x1BD708E01E96d426652b0D50b8c896eaeefee36d" + ], + owners: [treasuryETH, treasuryETH2], + ownTokens: [flokiETH], + }, + bsc: { + tokens: [ + nullAddress, + ], + owners: [treasuryBSC], + ownTokens: [flokiBSC], + }, +}) \ No newline at end of file diff --git a/projects/treasury/floor-dao.js b/projects/treasury/floor-dao.js new file mode 100644 index 00000000000..36ca4677be3 --- /dev/null +++ b/projects/treasury/floor-dao.js @@ -0,0 +1,10 @@ +const floorTreasury1 = "0x91E453f442d25523F42063E1695390e325076ca2"; +const floorTreasury2 = "0xa9d93a5cca9c98512c8c56547866b1db09090326"; + +const FLOOR = "0xf59257e961883636290411c11ec5ae622d19455e"; +const index = require('../floor-dao/index') +const { ohmTreasury } = require('../helper/treasury') +const { staking } = require('../helper/staking') + +module.exports = ohmTreasury(index) +module.exports.ethereum.ownTokens = staking([floorTreasury1, floorTreasury2], FLOOR) diff --git a/projects/treasury/forth-dao.js b/projects/treasury/forth-dao.js new file mode 100644 index 00000000000..c24cbc101c6 --- /dev/null +++ b/projects/treasury/forth-dao.js @@ -0,0 +1,23 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0x223592a191ecfc7fdc38a9256c3bd96e771539a9"; +const treasury2 = "0x77fba179c79de5b7653f68b5039af940ada60ce0" +const FORTH = "0x77FbA179C79De5B7653F68b5039Af940AdA60ce0"; +const AMPL ="0xD46bA6D942050d489DBd938a2C909A5d5039A161" +const LP = "0xc5be99A02C6857f9Eac67BbCE58DF5572498F40c" + + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.USDC,//usdc + ADDRESSES.ethereum.WETH,//weth + '0xBcca60bB61934080951369a648Fb03DF4F96263C',//ausdc + '0xc944E90C64B2c07662A292be6244BDf05Cda44a7' + ], + owners: [treasury, treasury2], + ownTokens: [FORTH, AMPL, LP], + }, +}) \ No newline at end of file diff --git a/projects/treasury/fortress.js b/projects/treasury/fortress.js new file mode 100644 index 00000000000..30bcdc67e5e --- /dev/null +++ b/projects/treasury/fortress.js @@ -0,0 +1,3 @@ +module.exports = require("../fortress/index"); + +delete module.exports.avax.staking \ No newline at end of file diff --git a/projects/treasury/fortunedao.js b/projects/treasury/fortunedao.js new file mode 100644 index 00000000000..c895f4893ff --- /dev/null +++ b/projects/treasury/fortunedao.js @@ -0,0 +1,3 @@ +module.exports = require("../fortunedao"); + +delete module.exports.cronos.staking \ No newline at end of file diff --git a/projects/treasury/frax.js b/projects/treasury/frax.js new file mode 100644 index 00000000000..744f04050e0 --- /dev/null +++ b/projects/treasury/frax.js @@ -0,0 +1,33 @@ +const ADDRESSES = require('../helper/coreAssets.json'); +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0x9AA7Db8E488eE3ffCC9CdFD4f2EaECC8ABeDCB48"; +const fpis = "0xc2544A32872A91F4A553b404C6950e89De901fdb"; +const fxs = "0x3432B6A60D23Ca0dFCa7761B7ab56459D9C964D0"; +const treasuryarb = "0xe61d9ed1e5dc261d1e90a99304fadcef2c76fd10" + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.SAFE, + ], + owners: [ + treasury, + '0x63278bF9AcdFC9fA65CFa2940b89A34ADfbCb4A1', + '0x8D4392F55bC76A046E443eb3bab99887F4366BB0', + '0xa95f86fE0409030136D6b82491822B3D70F890b3', + '0x9AA7Db8E488eE3ffCC9CdFD4f2EaECC8ABeDCB48', + '0x874a873e4891fB760EdFDae0D26cA2c00922C404', + ], + ownTokens: [fpis, fxs, ADDRESSES.ethereum.FRAX], + }, + arbitrum: { + tokens: [ + nullAddress, + ], + owners: [ + treasuryarb, + ], + }, +}); diff --git a/projects/treasury/friendswithbenefits.js b/projects/treasury/friendswithbenefits.js new file mode 100644 index 00000000000..a21757781dc --- /dev/null +++ b/projects/treasury/friendswithbenefits.js @@ -0,0 +1,21 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0x33e626727B9Ecf64E09f600A1E0f5adDe266a0DF"; +const ownTokenTreasury = "0x660F6D6c9BCD08b86B50e8e53B537F2B40f243Bd" +const FWB = "0x35bD01FC9d6D5D81CA9E055Db88Dc49aa2c699A8"; + + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.USDC,//usdc + ADDRESSES.ethereum.WETH,//weth + '0xBcca60bB61934080951369a648Fb03DF4F96263C',//ausdc + '0x9355372396e3F6daF13359B7b607a3374cc638e0',//whale + ], + owners: [treasury, ownTokenTreasury], + ownTokens: [FWB], + }, +}) \ No newline at end of file diff --git a/projects/treasury/futureswap.js b/projects/treasury/futureswap.js new file mode 100644 index 00000000000..dbcde2ecee3 --- /dev/null +++ b/projects/treasury/futureswap.js @@ -0,0 +1,12 @@ +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0xdb08917e0ae9075c6577b6a11d0bb78dfbc381e4"; + +module.exports = treasuryExports({ + arbitrum: { + tokens: [ + nullAddress, + ], + owners: [treasury], + }, +}) \ No newline at end of file diff --git a/projects/treasury/gains.js b/projects/treasury/gains.js new file mode 100644 index 00000000000..f77c9ccd0aa --- /dev/null +++ b/projects/treasury/gains.js @@ -0,0 +1,32 @@ +const { nullAddress,treasuryExports } = require("../helper/treasury"); +const ADDRESSES = require('../helper/coreAssets.json'); + +const GNS = "0x18c11FD286C5EC11c3b683Caa813B77f5163A122" +const multisig = "0xf8e93a7d954f7d31d5fa54bc0eb0e384412a158d" +const treasury = "0x80fd0accC8Da81b0852d2Dca17b5DDab68f22253" +const gnspolygon = "0xE5417Af564e4bFDA1c483642db72007871397896" + +module.exports = treasuryExports({ + arbitrum: { + tokens: [ + nullAddress, + ADDRESSES.arbitrum.USDC, + ADDRESSES.arbitrum.USDC_CIRCLE, + ADDRESSES.arbitrum.DAI, + "0xAAA6C1E32C55A7Bfa8066A6FAE9b42650F262418", + ], + owners: [multisig, treasury], + ownTokens: [GNS], + resolveUniV3: true, + }, + polygon: { + tokens: [ + nullAddress, + ADDRESSES.polygon.DAI, + ADDRESSES.polygon.USDT, + ], + owners: [treasury], + ownTokens: [gnspolygon], + resolveUniV3: true, + }, +}) \ No newline at end of file diff --git a/projects/treasury/galaxygoogle.js b/projects/treasury/galaxygoogle.js new file mode 100644 index 00000000000..fcc803f7d1d --- /dev/null +++ b/projects/treasury/galaxygoogle.js @@ -0,0 +1,56 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); + +const gg = "0xF2F7CE610a091B94d41D69f4fF1129434a82E2f0" + +// https://app.galaxygoggle.money/#/bonds +const treasury = "0xD5F922e23693e552793fE0431F9a95ba67A60A23" +const dao = "0xDEEdd1646984F9372Cc9D3d7E13AC1606cC2B548" +const mim = "0x130966628846BFd36ff31a822705796e8cb8C18D" +const wavax = ADDRESSES.avax.WAVAX +const joe = ADDRESSES.avax.JOE + +async function tvl(timestamp, block, chainBlocks) { + const balances = {}; + + await sumTokensAndLPsSharedOwners( + balances, + [ + [mim, false], + [wavax, false], + [joe, false], + ["0xe9E8d6b6ce6D94Fc9d724711e80784Ec096949Fc", true], // mim-gg + ], + [treasury, dao], + chainBlocks.avax, + 'avax', + addr=>`avax:${addr}` + ); + + return balances; +} + +const bscTreasury = "0xF76C9753507B3Df0867EB02D86d07C6fFcEecaf1"; +const treasuryTokensBSC = [ + [ADDRESSES.bsc.BUSD, false], // BUSD + ["0x13Cf29b3F58f777dDeD38278F7d938401f6b260c", true] // GG-BUSD +] + +async function bscTvl(timestamp, block, chainBlocks) { + let balances = {}; + await sumTokensAndLPsSharedOwners(balances, treasuryTokensBSC, [bscTreasury], chainBlocks.bsc, "bsc", addr=>`bsc:${addr}`); + balances[`avax:${gg}`] = balances["bsc:0xcaf23964ca8db16d816eb314a56789f58fe0e10e"] || 0; + delete balances["bsc:0xcaf23964ca8db16d816eb314a56789f58fe0e10e"]; + return balances; +} + +module.exports = { + avax:{ + tvl, + }, + bsc: { + tvl: bscTvl, + }, + methodology: + "Counts tokens on the treasury for tvl and staked GG for staking", +}; diff --git a/projects/treasury/gale.js b/projects/treasury/gale.js new file mode 100644 index 00000000000..f3929898207 --- /dev/null +++ b/projects/treasury/gale.js @@ -0,0 +1,18 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { staking } = require("../helper/staking"); + +const config = { + bsc: { + windmillContract: "0x0b374F3C618FF06583E7C4a1207bcaF22343737E", + tokenContract: "0x627E86E9eC832b59018Bf91456599e752288Aa97", + liquidityContract: "0x1fC3152de89b0c6c36F0d330b7Be369d6dDB219F", + vaultContract: "0x973Abe726E3e37bbD8501B2D8909Fa59535Babdd", + busd: ADDRESSES.bsc.BUSD, + } +} + +module.exports = { + bsc: { + tvl: staking(config.bsc.vaultContract, config.bsc.busd, "bsc"), + }, +}; diff --git a/projects/treasury/galxe.js b/projects/treasury/galxe.js new file mode 100644 index 00000000000..e134e75e3c6 --- /dev/null +++ b/projects/treasury/galxe.js @@ -0,0 +1,14 @@ + +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0x28fda5fb2ac9436bc4bb8bedafee25a550956de6"; + +module.exports = treasuryExports({ + arbitrum: { + owners: [treasury, ], + ownTokens: [ + ], + tokens: [ + ], + }, +}); \ No newline at end of file diff --git a/projects/treasury/gearbox.js b/projects/treasury/gearbox.js new file mode 100644 index 00000000000..45b2ffaee41 --- /dev/null +++ b/projects/treasury/gearbox.js @@ -0,0 +1,23 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +// Treasury +const treasury = "0x7b065Fcb0760dF0CEA8CFd144e08554F3CeA73D1"; +const GEAR = "0xBa3335588D9403515223F109EdC4eB7269a9Ab5D"; + + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + // Ethereum Assets + nullAddress, + ADDRESSES.ethereum.WETH, + ADDRESSES.ethereum.WBTC, + ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.DAI, + ADDRESSES.ethereum.WSTETH,//wsteth + ], + owners: [treasury], + ownTokens: [GEAR] + }, +}) diff --git a/projects/treasury/geth.js b/projects/treasury/geth.js new file mode 100644 index 00000000000..f8df4036935 --- /dev/null +++ b/projects/treasury/geth.js @@ -0,0 +1,15 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { treasuryExports } = require("../helper/treasury"); + +const treasury = "0x21539334f45Ac41Bd10789942b744a18a4775d6d" // + +module.exports = treasuryExports({ + optimism: { + tokens: [ + ADDRESSES.optimism.OP, + ADDRESSES.optimism.WETH + ], + owners: [treasury], + }, + +}) \ No newline at end of file diff --git a/projects/treasury/gitcoin.js b/projects/treasury/gitcoin.js new file mode 100644 index 00000000000..9b28450fb68 --- /dev/null +++ b/projects/treasury/gitcoin.js @@ -0,0 +1,26 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0x57a8865cfB1eCEf7253c27da6B4BC3dAEE5Be518"; +const vestingAddress = "0x44Aa9c5a034C1499Ec27906E2D427b704b567ffe"; +const treasury2 = "0xde21f729137c5af1b01d73af1dc21effa2b8a0d6" +const GTC = "0xDe30da39c46104798bB5aA3fe8B9e0e1F348163F"; + + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.USDC, //USDC + '0x31c8EAcBFFdD875c74b94b077895Bd78CF1E64A3',//rad + '0xE54f9E6Ab80ebc28515aF8b8233c1aeE6506a15E',//pasta + ADDRESSES.ethereum.DAI, + ADDRESSES.ethereum.UNI, + "0x31c8eacbffdd875c74b94b077895bd78cf1e64a3", + "0xc18360217d8f7ab5e7c516566761ea12ce7f9d72" + + ], + owners: [treasury, vestingAddress, treasury2], + ownTokens: [GTC], + }, +}) \ No newline at end of file diff --git a/projects/treasury/giveth.js b/projects/treasury/giveth.js new file mode 100644 index 00000000000..c7334ea4b45 --- /dev/null +++ b/projects/treasury/giveth.js @@ -0,0 +1,70 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0x4D9339dd97db55e3B9bCBE65dE39fF9c04d1C2cd"; + +module.exports = treasuryExports({ + optimism: { + tokens: [ + nullAddress, + ADDRESSES.optimism.USDC, // USDC + ADDRESSES.optimism.OP, + ADDRESSES.optimism.DAI, + ADDRESSES.optimism.USDT, + ADDRESSES.optimism.WETH + ], + owners: [treasury], + ownTokens: [], + }, + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.USDC, // USDC + ADDRESSES.ethereum.DAI, + ADDRESSES.ethereum.USDT, + ADDRESSES.ethereum.WETH, + "0x7C07F7aBe10CE8e33DC6C5aD68FE033085256A84", //icETH + "0x1d462414fe14cf489c7A21CaC78509f4bF8CD7c0", //can + "0xa117000000f279D81A1D3cc75430fAA017FA5A2e", //ant + "0x19062190B1925b5b6689D7073fDfC8c2976EF8Cb", //bzz + "0xC18360217D8F7Ab5e7c516566761Ea12Ce7F9D72", //ens + "0x2d94AA3e47d9D5024503Ca8491fcE9A2fB4DA198", //bank + "0xDe30da39c46104798bB5aA3fe8B9e0e1F348163F", //gtc + "0x0bc529c00C6401aEF6D220BE8C6Ea1667F6Ad93e", //yfi + "0x7D1AfA7B718fb893dB30A3aBc0Cfc608AaCfeBB0", //matic + "0xDd1Ad9A21Ce722C151A836373baBe42c868cE9a4", //ubi + ], + owners: [treasury], + ownTokens: ["0x900dB999074d9277c5DA2A43F252D74366230DA0"], + }, + polygon: { + tokens: [ + nullAddress, + ADDRESSES.polygon.USDC, // USDC + ADDRESSES.polygon.DAI, + ADDRESSES.polygon.USDT, + ADDRESSES.polygon.WETH, + ADDRESSES.polygon.WMATIC, + "0x18e73A5333984549484348A94f4D219f4faB7b81", //duckies + "0xD6DF932A45C0f255f85145f286eA0b292B21C90B", //aave + "0x53E0bca35eC356BD5ddDFebbD1Fc0fD03FaBad39", //link + "0xb33EaAd8d922B1083446DC23f610c2567fB5180f", //uni + ], + owners: [treasury], + ownTokens: [], + }, + xdai: { + tokens: [ + nullAddress, + "0x71850b7E9Ee3f13Ab46d67167341E4bDc905Eef9", //hny + "0xDDAfbb505ad214D7b80b1f830fcCc89B60fb7A83", //usdc + "0x21a42669643f45Bc0e086b8Fc2ed70c23D67509d", //fox + "0x83FF60E2f93F8eDD0637Ef669C69D5Fb4f64cA8E", //bright + "0x6A023CCd1ff6F2045C3309768eAd9E68F978f6e1", //weth + "0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d", //wxdai + "0x177127622c4A00F3d409B75571e12cB3c8973d3c", //cow + ], + owners: [treasury], + ownTokens: ["0x4f4F9b8D5B4d0Dc10506e5551B0513B61fD59e75"], + } +}); \ No newline at end of file diff --git a/projects/treasury/gnosis-dao.js b/projects/treasury/gnosis-dao.js new file mode 100644 index 00000000000..ff006686465 --- /dev/null +++ b/projects/treasury/gnosis-dao.js @@ -0,0 +1,82 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); +const { mergeExports } = require('../helper/utils'); +const { unwrap4626Tokens, unwrapMakerPositions, unwrapConvexRewardPools, } = require('../helper/unwrapLPs') + +const treasury = "0x4971DD016127F390a3EF6b956Ff944d0E2e1e462"; +const treasury1 = "0x0DA0C3e52C977Ed3cBc641fF02DD271c3ED55aFe"; +const treasury2 = "0x849D52316331967b6fF1198e5E32A0eB168D039d"; +const treasury3 = "0xBc79855178842FDBA0c353494895DEEf509E26bB"; +const GNO = ADDRESSES.ethereum.GNO; + +async function tvl(_, _b, _cb, { api, }) { + const treasury = '0x849d52316331967b6ff1198e5e32a0eb168d039d' + await addAuraTvl() + await unwrapMakerPositions({ api, owner: treasury, blacklistedTokens: [ADDRESSES.ethereum.GNO]}) + await unwrapConvexRewardPools({ api, tokensAndOwners: ['0x0A760466E1B4621579a82a39CB56Dda2F4E70f03', '0xf34DFF761145FF0B05e917811d488B441F33a968',].map(i => [i, treasury])}) + + return api.getBalances() + + async function addAuraTvl() { + const auraDepositVaults = [ + '0x712cc5bed99aa06fc4d5fb50aea3750fa5161d0f', + '0x5209db28b3cf22a944401c83370af7a703fffb08', + '0xd3780729035c5b302f76ced0e7f74cf0fb7c739a', + '0xacada51c320947e7ed1a0d0f6b939b0ff465e4c2', + '0x001b78cec62dcfdc660e06a91eb1bc966541d758', + '0xe4683fe8f53da14ca5dac4251eadfb3aa614d528', + '0x6256518ae9a97c408a03aaf1a244989ce6b937f6', + '0x228054e9c056f024fc724f515a2a8764ae175ed6', + ] + return unwrap4626Tokens({ api, tokensAndOwners: auraDepositVaults.map(i => [i, treasury])}) + } +} + +async function ownTokens(_, _b, _cb, { api, }) { + return unwrapMakerPositions({ api, owner: '0x849d52316331967b6ff1198e5e32a0eb168d039d', skipDebt: true, whitelistedTokens: [ADDRESSES.ethereum.GNO]}) +} + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.DAI,//DAI + '0x5d3a536E4D6DbD6114cc1Ead35777bAB948E3643',//cDAI + '0x39AA39c021dfbaE8faC545936693aC917d5E7563',//cUSDC + '0xc944E90C64B2c07662A292be6244BDf05Cda44a7',//GRT + ADDRESSES.ethereum.CRV, + '0xba100000625a3754423978a60c9317c58a424e3D',//BAL + ADDRESSES.ethereum.CVX, + '0xDEf1CA1fb7FBcDC777520aa7f396b4E015F497aB',//COW + ADDRESSES.ethereum.STETH, + '0xE95A203B1a91a908F9B9CE46459d101078c2c3cb',//ankETH + '0xC18360217D8F7Ab5e7c516566761Ea12Ce7F9D72',//ENS + '0x93ED3FBe21207Ec2E8f2d3c3de6e058Cb73Bc04d',//PNK + ADDRESSES.ethereum.WSTETH, + '0xC0c293ce456fF0ED870ADd98a0828Dd4d2903DBF',//AURA + '0x543Ff227F64Aa17eA132Bf9886cAb5DB55DCAddf',//GEN + '0x255Aa6DF07540Cb5d3d297f0D0D4D84cb52bc8e6',//RDN + '0x6f40d4A6237C257fff2dB00FA0510DeEECd303eb',//INST + '0x6243d8CEA23066d098a15582d81a598b4e8391F4',//FLX + ADDRESSES.ethereum.LIDO, + '0x1982b2F5814301d4e9a8b0201555376e62F82428', + "0xd33526068d116ce69f19a9ee46f0bd304f21a51f", + "0x543ff227f64aa17ea132bf9886cab5db55dcaddf", + "0xde30da39c46104798bb5aa3fe8b9e0e1f348163f", + "0x31c8eacbffdd875c74b94b077895bd78cf1e64a3", + "0x48c3399719b582dd63eb5aadf12a40b4c3f52fa2", + "0x20bc832ca081b91433ff6c17f85701b6e92486c5", + "0x616e8BfA43F920657B3497DBf40D6b1A02D4608d", + "0x9c39809dec7f95f5e0713634a4d0701329b3b4d2", // debt variableDebtWBTC + "0xa13a9247ea42d743238089903570127dda72fe44", + ], + owners: [treasury, treasury1, treasury2, treasury3,], + ownTokens: [GNO], + resolveUniV3: true, + }, +}) + +module.exports = mergeExports([module.exports, { + ethereum: { tvl, ownTokens } +}]) diff --git a/projects/treasury/goblinscash.js b/projects/treasury/goblinscash.js new file mode 100644 index 00000000000..427f269753e --- /dev/null +++ b/projects/treasury/goblinscash.js @@ -0,0 +1,3 @@ +module.exports = require("../goblinscash/index"); + +delete module.exports.smartbch.staking \ No newline at end of file diff --git a/projects/treasury/golem.js b/projects/treasury/golem.js new file mode 100644 index 00000000000..284adb71937 --- /dev/null +++ b/projects/treasury/golem.js @@ -0,0 +1,18 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +// Treasury +const treasury = "0x7da82c7ab4771ff031b66538d2fb9b0b047f6cf9"; +const GLM = "0x7dd9c5cba05e151c895fde1cf355c9a1d5da6429"; + + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + // Ethereum Assets + nullAddress, + ], + owners: [treasury, '0x70a0a7be87deb51e1fab16d4f2bf00be1510e476'], + ownTokens: [GLM] + }, +}) \ No newline at end of file diff --git a/projects/treasury/gooddollar.js b/projects/treasury/gooddollar.js new file mode 100644 index 00000000000..1b2d0ac08ea --- /dev/null +++ b/projects/treasury/gooddollar.js @@ -0,0 +1,60 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const sdk = require("@defillama/sdk"); +const abi = require('../gooddollar/abi.json'); +const BigNumber = require("bignumber.js"); + +const tokens = { + aUSDC: "0xbcca60bb61934080951369a648fb03df4f96263c", + DAI: ADDRESSES.ethereum.DAI, + cDAI: "0x5d3a536E4D6DbD6114cc1Ead35777bAB948E3643", + Gfuse: "0x495d133B938596C9984d462F007B676bDc57eCEC", // GoodDollar on Fuse + FUSE: "0x970b9bb2c0444f5e81e9d0efb84c8ccdcdcaf84d", // Fuse on Mainnet +}; + +const FUSE_STAKING = '0xA199F0C353E25AdF022378B0c208D600f39a6505'; +const RESERVE_ADDRESS = '0xa150a825d425B36329D8294eeF8bD0fE68f8F6E0'; +const COMMUNITY_SAFE = '0x5Eb5f5fE13d1D5e6440DbD5913412299Bc5B5564'; +const GOODDOLLAR_DECIMALS = 2; + +async function fuseTreasury(timestamp, ethBlock, chainBlocks) { + const gdInCommunitySafe = (await sdk.api.erc20.balanceOf({ + target: tokens.Gfuse, + chain: 'fuse', + owner: COMMUNITY_SAFE, + block: chainBlocks['fuse'] + })).output; + + const gdInFuseStaking = (await sdk.api.erc20.balanceOf({ + target: tokens.Gfuse, + chain: 'fuse', + owner: FUSE_STAKING, + block: chainBlocks['fuse'] + })).output; + + const gdTotal = BigNumber(gdInCommunitySafe).plus(gdInFuseStaking); + + let gdInDAI = await convertGoodDollarsToDai(gdTotal, ethBlock); + + const balances = {}; + sdk.util.sumSingleBalance(balances, tokens.DAI, Number(gdInDAI)); + + return balances; +} + +// Required until GoodDollar lists on CoinGecko +async function convertGoodDollarsToDai(gdAmount, ethBlock) { + const gdPriceInDAI = (await sdk.api.abi.call({ + target: RESERVE_ADDRESS, + abi: abi.currentPriceDAI, + block: ethBlock + })).output; + + return await new BigNumber(gdPriceInDAI).times(gdAmount).div(10 ** GOODDOLLAR_DECIMALS); +} + +module.exports = { + fuse: { + tvl: () => 0, + ownTokens: fuseTreasury + }, +} \ No newline at end of file diff --git a/projects/treasury/grabi.js b/projects/treasury/grabi.js new file mode 100644 index 00000000000..ba2213d7654 --- /dev/null +++ b/projects/treasury/grabi.js @@ -0,0 +1,11 @@ +const { treasuryExports } = require("../helper/treasury"); + +const Treasury = "0x7d9ff6cb1bc3491fed7bf279d8532cab594b29e8"; + +module.exports = treasuryExports({ + arbitrum: { + tokens: [], + owners: [Treasury], + ownTokens: ['0x5fd71280b6385157b291b9962f22153fc9e79000'], + }, +}) \ No newline at end of file diff --git a/projects/treasury/guru-network.js b/projects/treasury/guru-network.js new file mode 100644 index 00000000000..f03fa933d57 --- /dev/null +++ b/projects/treasury/guru-network.js @@ -0,0 +1,19 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0x167D87A906dA361A10061fe42bbe89451c2EE584"; + + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.USDC, + '0x777172D858dC1599914a1C4c6c9fC48c99a60990',//solid + ADDRESSES.ethereum.WETH, + ADDRESSES.ethereum.FRAX, + ], + owners: [treasury], + ownTokens: [], + }, +}) \ No newline at end of file diff --git a/projects/treasury/gyro.js b/projects/treasury/gyro.js new file mode 100644 index 00000000000..a9ee20e5ace --- /dev/null +++ b/projects/treasury/gyro.js @@ -0,0 +1,22 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress,treasuryExports } = require("../helper/treasury"); + +const Treasury = "0x8b1522402fece066d83e0f6c97024248be3c8c01"; + +const GYRO = "0x1b239abe619e74232c827fbe5e49a4c072bd869d"; + + +module.exports = treasuryExports({ + bsc: { + tokens: [ + nullAddress, + ADDRESSES.bsc.BUSD,//BUSD + ADDRESSES.bsc.USDT,//BSC-USD + '0x5ca063a7e2bebefeb2bdea42158f5b825f0f9ffb', + '0xa5399084a5f06d308c4527517bbb781c4dce887c', + ], + owners: [Treasury], + ownTokens: [GYRO], + resolveLP: true, + }, +}) \ No newline at end of file diff --git a/projects/treasury/handlefi.js b/projects/treasury/handlefi.js new file mode 100644 index 00000000000..ef62616dfdb --- /dev/null +++ b/projects/treasury/handlefi.js @@ -0,0 +1,12 @@ +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0xac459b2b29401b5a4ea90de4320d0956cf86cdbd"; + +module.exports = treasuryExports({ + arbitrum: { + tokens: [ + nullAddress, + ], + owners: [treasury], + }, +}) \ No newline at end of file diff --git a/projects/treasury/hector.js b/projects/treasury/hector.js new file mode 100644 index 00000000000..4ae2a1187d1 --- /dev/null +++ b/projects/treasury/hector.js @@ -0,0 +1,4 @@ +const index = require('../hector/index') +const { ohmTreasury } = require('../helper/treasury') + +module.exports = ohmTreasury(index) \ No newline at end of file diff --git a/projects/treasury/hegic.js b/projects/treasury/hegic.js new file mode 100644 index 00000000000..6f8d6337f95 --- /dev/null +++ b/projects/treasury/hegic.js @@ -0,0 +1,25 @@ +const { nullAddress, treasuryExports } = require("../helper/treasury"); +const ADDRESSES = require('../helper/coreAssets.json') + +const treasuryARB = "0xf15968a096fc8f47650001585d23bee819b5affb"; +const treasuryETH = "0xd884aca1897ac45515cee6d5fd48f341b4023ace" +const hegic = "0x584bC13c7D411c00c01A62e8019472dE68768430" + +module.exports = treasuryExports({ + arbitrum: { + tokens: [ + nullAddress, + ], + owners: [treasuryARB], + }, + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.WBTC, + ADDRESSES.ethereum.WETH, + ADDRESSES.ethereum.USDC + ], + owners: [treasuryETH], + ownTokens: [hegic], + }, +}) \ No newline at end of file diff --git a/projects/treasury/hop.js b/projects/treasury/hop.js new file mode 100644 index 00000000000..a23e02ec367 --- /dev/null +++ b/projects/treasury/hop.js @@ -0,0 +1,17 @@ +const { nullAddress,treasuryExports } = require("../helper/treasury"); + +module.exports = treasuryExports({ + arbitrum: { + tokens: [ + nullAddress, + ], + owners: ['0xeea8422a08258e73c139fc32a25e10410c14bd7a'], + ownTokens: [], + }, + ethereum: { + tokens: [ + ], + owners: ['0xeea8422a08258e73c139fc32a25e10410c14bd7a'], + ownTokens: ['0xc5102fe9359fd9a28f877a67e36b0f050d81a3cc'], + }, +}) \ No newline at end of file diff --git a/projects/treasury/idle-dao.js b/projects/treasury/idle-dao.js new file mode 100644 index 00000000000..8c059d3c662 --- /dev/null +++ b/projects/treasury/idle-dao.js @@ -0,0 +1,55 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +//eth +const treasury = "0xb0aA1f98523Ec15932dd5fAAC5d86e57115571C7"; +const treasury1 = "0x107A369bc066c77FF061c7d2420618a6ce31B925"; +const treasury2 = "0x69a62C24F16d4914a48919613e8eE330641Bcb94"; +const treasury3 = "0xbecc659bfc6edca552fa1a67451cc6b38a0108e4"; +const treasury4 = "0x076ff8e6402b02855ff82119b53e59bbdd67f0ee"; +const treasury5 = "0xFb3bD022D5DAcF95eE28a6B07825D4Ff9C5b3814" + +const IDLE = "0x875773784af8135ea0ef43b5a374aad105c5d39e"; + +// polygon + +const treasuryPolygon = "0x1d60E17723f8Ca1F76F09126242AcD37a278b514" +const treasuryPolygon1 = "0x61A944Ca131Ab78B23c8449e0A2eF935981D5cF6" + +const IDLEPolygon = "0xc25351811983818c9fe6d8c580531819c8ade90f" + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.USDC, + "0x4da27a545c0c5B758a6BA100e3a049001de870f5", //stkAAVE + ADDRESSES.ethereum.BNB, + "0xc00e94Cb662C3520282E6f5717214004A7f26888",//comp + ADDRESSES.ethereum.sUSD, + "0x03ab458634910AaD20eF5f1C8ee96F1D6ac54919",//RAI + ADDRESSES.ethereum.SUSHI, + ADDRESSES.ethereum.MATIC, + ADDRESSES.ethereum.LIDO, + "0xdBdb4d16EdA451D0503b854CF79D55697F90c8DF",//alcx + ADDRESSES.ethereum.DAI, + ADDRESSES.ethereum.STETH, + ADDRESSES.ethereum.LINK, + ], + owners: [treasury, treasury1, treasury2, treasury3, treasury4, treasury5], + ownTokens: [IDLE], + }, + polygon: { + tokens: [ + nullAddress, + "0xf28164A485B0B2C90639E47b0f377b4a438a16B1",//dquick + ADDRESSES.polygon.DAI, + ADDRESSES.polygon.WMATIC_2,//wmatic + ADDRESSES.polygon.WETH_1, + ADDRESSES.polygon.USDC, + "0x580A84C73811E1839F75d86d75d88cCa0c241fF4",//QI + ], + owners: [treasuryPolygon, treasuryPolygon1], + ownTokens: [IDLEPolygon] + } +}) \ No newline at end of file diff --git a/projects/treasury/illuvium.js b/projects/treasury/illuvium.js new file mode 100644 index 00000000000..78ca8eea09c --- /dev/null +++ b/projects/treasury/illuvium.js @@ -0,0 +1,23 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { treasuryExports, nullAddress } = require("../helper/treasury"); + +const Treasury = "0x58c37a622cdf8ace54d8b25c58223f61d0d738aa"; + +module.exports = treasuryExports({ + arbitrum: { + tokens: [], + owners: [Treasury], + }, + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.USDT, + ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.SUSHI, + ADDRESSES.ethereum.SAFE, + ], + owners: [Treasury], + ownTokens: ['0x767fe9edc9e0df98e07454847909b5e959d7ca0e'], + } +}) \ No newline at end of file diff --git a/projects/treasury/immortal.js b/projects/treasury/immortal.js new file mode 100644 index 00000000000..54ec1ab4131 --- /dev/null +++ b/projects/treasury/immortal.js @@ -0,0 +1,5 @@ +const olympus = require("../immortal/index"); + +module.exports = olympus; + +delete module.exports.celo.staking \ No newline at end of file diff --git a/projects/treasury/impermax.js b/projects/treasury/impermax.js new file mode 100644 index 00000000000..8ec65d3c2a5 --- /dev/null +++ b/projects/treasury/impermax.js @@ -0,0 +1,12 @@ +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0x7f959c082bc30f3ea88187fac1a640438ad7bf20"; + +module.exports = treasuryExports({ + arbitrum: { + tokens: [ + nullAddress, + ], + owners: [treasury,], + }, +}) \ No newline at end of file diff --git a/projects/treasury/index-coop.js b/projects/treasury/index-coop.js new file mode 100644 index 00000000000..30c718a5fb6 --- /dev/null +++ b/projects/treasury/index-coop.js @@ -0,0 +1,29 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0x9467cfADC9DE245010dF95Ec6a585A506A8ad5FC"; +const treasury2 = "0x462a63d4405a6462b157341a78fd1babfd3f8065" +const treasury3 = "0xfafd604d1cc8b6b3b6cc859cf80fd902972371c1" + +const INDEX = "0x0954906da0Bf32d5479e25f46056d22f08464cab"; + + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.SAFE, + ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.DAI, + '0x7C07F7aBe10CE8e33DC6C5aD68FE033085256A84', + '0x056Fd409E1d7A124BD7017459dFEa2F387b6d5Cd', + '0xAa6E8127831c9DE45ae56bB1b0d4D4Da6e5665BD', + '0x39AA39c021dfbaE8faC545936693aC917d5E7563', + ADDRESSES.ethereum.LUSD, + ADDRESSES.ethereum.USDT, + '0x5d3a536E4D6DbD6114cc1Ead35777bAB948E3643' + ], + owners: [treasury, treasury2, treasury3], + ownTokens: [INDEX], + }, +}) \ No newline at end of file diff --git a/projects/treasury/india-covid-relief-fund.js b/projects/treasury/india-covid-relief-fund.js new file mode 100644 index 00000000000..f75c213016c --- /dev/null +++ b/projects/treasury/india-covid-relief-fund.js @@ -0,0 +1,46 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress,treasuryExports } = require("../helper/treasury"); + +const Treasury = "0x68A99f89E475a078645f4BAC491360aFe255Dff1"; +const Treasury_bsc = "0x5C9E5571B17D91e6ACcD4F0c29bBe199Af1f7B09"; +const Treasury_btc = "bc1q220k2449fau0pxu9hfn28q3w4k99ep9hwsa5fa"; +const Treasury_trx = "TSZMcrQzMLdKrgiMPoe2uQMHLeEpkf2j8E" + + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.USDC,//usdc + ADDRESSES.ethereum.USDT,//usdt + ADDRESSES.ethereum.MATIC,//matic + ADDRESSES.ethereum.MKR,//mkr + ADDRESSES.ethereum.GNO,//gno + ADDRESSES.ethereum.DAI,//dai + ], + owners: [Treasury], + }, + bsc: { + tokens: [ + nullAddress, + ADDRESSES.bsc.BUSD,//busd + ADDRESSES.bsc.USDT,//busd usdc + ADDRESSES.bsc.WBNB,//wbnb + ], + owners: [Treasury_bsc] + }, + tron: { + tokens: [ + nullAddress, + ADDRESSES.tron.USDT, + ], + owners: [Treasury_trx] + }, + bitcoin: { + tokens: [ + nullAddress, + ], + owners: [Treasury_btc] + } + //https://cryptorelief.in/transparency +}) \ No newline at end of file diff --git a/projects/treasury/instadapp.js b/projects/treasury/instadapp.js new file mode 100644 index 00000000000..68db6fd8eef --- /dev/null +++ b/projects/treasury/instadapp.js @@ -0,0 +1,33 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress,treasuryExports } = require("../helper/treasury"); + +const Treasury = "0xf81ab897e3940e95d749ff2e1f8d38f9b7cbe3cf"; +const treasuryETH = "0x28849d2b63fa8d361e5fc15cb8abb13019884d09" + +const INST = "0x6f40d4A6237C257fff2dB00FA0510DeEECd303eb" + +module.exports = treasuryExports({ + arbitrum: { + tokens: [ + nullAddress, + ADDRESSES.arbitrum.USDC, + "0x8971dFb268B961a9270632f28B24F2f637c94244", + ADDRESSES.optimism.DAI + ], + owners: [Treasury], + }, + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.STETH, + ADDRESSES.ethereum.WETH, + ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.WBTC, + ADDRESSES.ethereum.DAI, + ADDRESSES.ethereum.WSTETH, + ADDRESSES.ethereum.USDT + ], + owners: [treasuryETH], + ownTokens: [INST], + }, +}) \ No newline at end of file diff --git a/projects/treasury/insure-dao.js b/projects/treasury/insure-dao.js new file mode 100644 index 00000000000..659b49ea458 --- /dev/null +++ b/projects/treasury/insure-dao.js @@ -0,0 +1,12 @@ +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0xd076397ec36f1c92939bd8cda9f9f7734f308c4b"; + +module.exports = treasuryExports({ + arbitrum: { + tokens: [ + nullAddress, + ], + owners: [treasury,], + }, +}) \ No newline at end of file diff --git a/projects/treasury/interport-finance.js b/projects/treasury/interport-finance.js new file mode 100644 index 00000000000..c01abb2763f --- /dev/null +++ b/projects/treasury/interport-finance.js @@ -0,0 +1,18 @@ +const { Indexed } = require("ethers/lib/utils"); +const { nullAddress,treasuryExports } = require("../helper/treasury"); + +const Treasury1 = "0xa67488eEAa9C15a4F6f5A3E98f45041e34310677"; +const Treasury2 = "0x4883A3696768c226EF917BCc32bDBA67F14e2b4c"; + +const ITP = "0x2b1D36f5B61AdDAf7DA7ebbd11B35FD8cfb0DE31"; + + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress + ], + owners: [Treasury1,Treasury2], + ownTokens: [ITP], + }, +}) \ No newline at end of file diff --git a/projects/treasury/inverse.js b/projects/treasury/inverse.js new file mode 100644 index 00000000000..7c00b230190 --- /dev/null +++ b/projects/treasury/inverse.js @@ -0,0 +1,86 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { treasuryExports, nullAddress } = require("../helper/treasury"); + +const inv = "0x41D5D79431A913C4aE7d69a668ecdfE5fF9DFB68"; +const anchorTreasury = "0x926df14a23be491164dcf93f4c468a50ef659d5b"; +const multisig = "0x9D5Df30F475CEA915b1ed4C0CCa59255C897b61B"; +const opmultisig = "0xa283139017a2f5bade8d8e25412c600055d318f8"; +const bnbmultisig = "0xf7da4bc9b7a6bb3653221ae333a9d2a2c2d5bda7"; +const treasury1 = "0x4b6c63e6a94ef26e2df60b89372db2d8e211f1b7" +const treasury2 = "0x943dbdc995add25a1728a482322f9b3c575b16fb" + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.DAI, + ADDRESSES.ethereum.USDC, + "0x865377367054516e17014CcdED1e7d814EDC9ce4", // DOLA + ADDRESSES.ethereum.WBTC, + ADDRESSES.ethereum.WETH, + ADDRESSES.ethereum.YFI, + "0xC0c293ce456fF0ED870ADd98a0828Dd4d2903DBF", // AURA + "0xba100000625a3754423978a60c9317c58a424e3D", // BAL + "0x73968b9a57c6E53d41345FD57a6E6ae27d6CDB2F", // SDT + ADDRESSES.ethereum.cvxFXS, + ADDRESSES.ethereum.CRV, + ADDRESSES.ethereum.CVX, + "0x4C2e59D098DF7b6cBaE0848d66DE2f8A4889b9C3", // FODL + ADDRESSES.ethereum.SAFE, + "0x22915f309EC0182c85cD8331C23bD187fd761360", // DOLA USDC Stable Pool Aura Deposit Vault + "0x7f50786A0b15723D741727882ee99a0BF34e3466", // Stake DAO sdCRV Gauge + "0x445494F823f3483ee62d854eBc9f58d5B9972A25", // 50DOLA-50DBR + "0xb204BF10bc3a5435017D3db247f56dA601dFe08A", // 50DOLA-50WETH + "0x7e05540A61b531793742fde0514e6c136b5fbAfE", // xFODL + "0xAD038Eb671c44b853887A7E32528FaB35dC5D710", // DBR + "0x0a6B1d9F920019BAbc4De3F10c94ECB822106104", + "0x73E02EAAb68a41Ea63bdae9Dbd4b7678827B2352", + "0xC36442b4a4522E871399CD717aBDD847Ab11FE88" + ], + owners: [anchorTreasury, multisig, treasury1, treasury2], + ownTokens: [ + inv, + "0x73E02EAAb68a41Ea63bdae9Dbd4b7678827B2352", // Uniswap INV/ETH LP + "0xA5D7A7690B72a89B7b720E43fC9cBda5419d0C71", // 50INV-50DOLA Aura Deposit Vault + // "0x9c7305eb78a432ced5C4D14Cac27E8Ed569A2e26", // veNFT + ], + resolveUniV3: true, + resolveLP: true, + }, + optimism: { + tokens: [ + nullAddress, + ADDRESSES.optimism.USDC, + "0x8aE125E8653821E851F12A49F7765db9a9ce7384", // DOLA + ], + owners: [opmultisig], + ownTokens: [], + }, + bsc: { + tokens: [ + nullAddress, + ADDRESSES.bsc.WBNB, + "0x2F29Bc0FFAF9bff337b31CBe6CB5Fb3bf12e5840", // DOLA + // "0xfBBF371C9B0B994EebFcC977CEf603F7f31c070D", // veTHE + ], + owners: [bnbmultisig], + ownTokens: [], + }, + arbitrum: { + tokens: [ + nullAddress, + ADDRESSES.arbitrum.DAI, + "0xAAA6C1E32C55A7Bfa8066A6FAE9b42650F262418" + ], + owners: ["0x23dedab98d7828afbd2b7ab8c71089f2c517774a"], + ownTokens: ["0x6A7661795C374c0bFC635934efAddFf3A7Ee23b6"], + }, + polygon: { + tokens: [ + nullAddress, + ADDRESSES.polygon.USDC, + + ], + owners: ["0x5d18b089e838dffbb417a87874435175f3a9b000"], + }, +}); diff --git a/projects/treasury/ipor.js b/projects/treasury/ipor.js new file mode 100644 index 00000000000..f1768ee810a --- /dev/null +++ b/projects/treasury/ipor.js @@ -0,0 +1,43 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { treasuryExports, nullAddress } = require("../helper/treasury"); +const { + unwrapUniswapV3NFTs, + sumTokensExport, + sumTokens, +} = require("../helper/unwrapLPs"); + +const treasury = "0x558c8eb91F6fd83FC5C995572c3515E2DAF7b7e0"; +const operations = "0xB7bE82790d40258Fd028BEeF2f2007DC044F3459"; +const ipor = "0x1e4746dC744503b53b4A082cB3607B169a289090"; +const univ3 = "0xC36442b4a4522E871399CD717aBDD847Ab11FE88"; +const tokens = [ + nullAddress, + ADDRESSES.ethereum.WETH, // WETH +]; + +async function ownTokens(timestamp, block) { + const balances = {}; + const tokensAndOwners = [ + [ipor, treasury], + [ipor, operations], + [ + "0x4acfB448C585F6e1e8F2aB2bD415F399bD1B8e09", // Uniswap IPOR/ETH LP" + operations, + ], + ]; + const nftsAndOwners = [[univ3, operations]]; + await sumTokens(balances, tokensAndOwners, block); + await unwrapUniswapV3NFTs({ balances, nftsAndOwners, block }); + + return balances; +} + +module.exports = { + ethereum: { + tvl: sumTokensExport({ + tokens, + owners: [treasury, operations], + }), + ownTokens, + }, +}; diff --git a/projects/treasury/iq.js b/projects/treasury/iq.js new file mode 100644 index 00000000000..d7e909d3eed --- /dev/null +++ b/projects/treasury/iq.js @@ -0,0 +1,22 @@ +const ADDRESSES = require('../helper/coreAssets.json'); +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0x56398b89d53e8731bca8c1b06886cfb14bd6b654"; +const IQ = "0x579CEa1889991f68aCc35Ff5c3dd0621fF29b0C9" + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.sfrxETH, + ADDRESSES.ethereum.FRAX, + "0x9D45081706102E7aadDD0973268457527722E274", + ADDRESSES.ethereum.WETH, + ADDRESSES.ethereum.WBTC, + "0x3432B6A60D23Ca0dFCa7761B7ab56459D9C964D0", + "0xEF9F994A74CB6EF21C38B13553caa2E3E15F69d0" + ], + owners: [treasury], + ownTokens: [IQ], + }, +}) diff --git a/projects/treasury/jade-protocol.js b/projects/treasury/jade-protocol.js new file mode 100644 index 00000000000..ca55cdf63ca --- /dev/null +++ b/projects/treasury/jade-protocol.js @@ -0,0 +1,56 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0x6f0bc6217faa5a2f503c057ee6964b756a09ae2c"; +const treasury1 = "0xcb0718b150552af8904e7cb1c62758dcb149b072"; + +const treasuryBSC = "0x169169a50d9a8fbf99edacf9aa10297e2b3c92dd"; + +const treasuryAVAX = "0xaeA6B4AAd5e315a40aFD77a1F794F61161499Fa5"; + +const treasuryOP = "0x489f866c0698C8D6879f5C0F527bc8281046042D"; +const treasuryARB = "0x02944e3fb72aa13095d7cebd8389fc74bec8e48e"; +const treasuryARB2 = "0xd012A9C8159b0E7325448eD30B1499FddDAc0F40"; + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.WBTC, + ADDRESSES.ethereum.sfrxETH, + '0x3432B6A60D23Ca0dFCa7761B7ab56459D9C964D0', // FXS + ], + owners: [treasury, treasury1], + }, + bsc: { + tokens: [ + nullAddress, + ADDRESSES.bsc.BUSD, + ], + owners: [treasuryBSC], +}, +avax: { + tokens: [ + nullAddress, + ADDRESSES.avax.USDC, + ], + owners: [treasuryAVAX] +}, +optimism: { + tokens: [ + nullAddress, + ADDRESSES.optimism.USDC, + ], + owners: [treasuryOP] +}, +arbitrum: { + tokens: [ + nullAddress, + ADDRESSES.arbitrum.USDC, + '0x0C4681e6C0235179ec3D4F4fc4DF3d14FDD96017', //rdnt + ADDRESSES.arbitrum.GMX, + ], + owners: [treasuryARB, treasuryARB2] +} +}) \ No newline at end of file diff --git a/projects/treasury/jonesdao.js b/projects/treasury/jonesdao.js new file mode 100644 index 00000000000..087866e55b9 --- /dev/null +++ b/projects/treasury/jonesdao.js @@ -0,0 +1,32 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0xFa82f1bA00b0697227E2Ad6c668abb4C50CA0b1F"; +const jones = "0x10393c20975cF177a3513071bC110f7962CD67da"; + +module.exports = treasuryExports({ + arbitrum: { + tokens: [ + nullAddress, + ADDRESSES.arbitrum.USDC, // USDC + "0x3d9907F9a368ad0a51Be60f7Da3b97cf940982D8", // GRAIL + ADDRESSES.arbitrum.MIM, // MIM + "0x3CAaE25Ee616f2C8E13C74dA0813402eae3F496b", // xGRAIL + "0x616279fF3dBf57A55e3d1F2E309e5D704E4e58Ae", // jGLP-USDC CMLT-LP + "0x2bcd0aac7D98697D8760fB291625829113E354e7", // jUSDC-WETH CMLT-LP + "0x7241bC8035b65865156DDb5EdEf3eB32874a3AF6", // jGLP + "0xe66998533a1992ecE9eA99cDf47686F4fc8458E0", // jUSDC + "0xd2D1162512F927a7e282Ef43a362659E4F2a728F", // sbfGMX + ], + owners: [treasury,], + ownTokens: [jones], + }, + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.USDC, // USDC + ], + owners: [treasury,], + ownTokens: [], + }, +}) diff --git a/projects/treasury/jpegd.js b/projects/treasury/jpegd.js new file mode 100644 index 00000000000..79bbdfd5e43 --- /dev/null +++ b/projects/treasury/jpegd.js @@ -0,0 +1,57 @@ +const sdk = require('@defillama/sdk') +const ADDRESSES = require('../helper/coreAssets.json') +const { treasuryExports, nullAddress } = require("../helper/treasury"); + +const jpegd = "0xE80C0cd204D654CEbe8dd64A4857cAb6Be8345a3"; + +// Owners +const multisig = "0x51C2cEF9efa48e08557A361B52DB34061c025a1B"; +const donationEvent = "0x3b7157E5E732863170597790b4c005436572570F"; +const usdcVault = "0xFD110cf7985f6B7cAb4dc97dF1932495cADa9d08"; +const usdtVault = "0x152DE634FF2f0A6eCBd05cB591cD1eEaCd2900Ed"; +const pethVault = "0x548cAB89eBF34509Ae562BC8cE8D5Cdb4F08c3AD"; + +const treasuryTvl = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.USDT, + ADDRESSES.ethereum.WETH, + ADDRESSES.ethereum.DAI, + ADDRESSES.ethereum.CVX, + ADDRESSES.ethereum.FRAX, + ADDRESSES.ethereum.LINK, + ADDRESSES.ethereum.cvxCRV, + ADDRESSES.ethereum.SAFE, + ADDRESSES.ethereum.vlCVX, + ADDRESSES.ethereum.sfrxETH, + ADDRESSES.ethereum.STETH, + ADDRESSES.ethereum.WSTETH, + ADDRESSES.ethereum.RETH, + "0x836A808d4828586A69364065A1e064609F5078c7", // pETH + // Liquidity positions + "0xC47EBd6c0f68fD5963005D28D0ba533750E5C11B", // pUSDFRAXBP3CRV-f + "0x34eD182D0812D119c92907852D2B429f095A9b07", // JPEGETH-f + "0x9848482da3Ee3076165ce6497eDA906E66bB85C5", // pETH-ETH-f + "0xdB06a76733528761Eda47d356647297bC35a98BD", // JPEGWETH SLP + ], + owners: [multisig, donationEvent, usdcVault, usdtVault, pethVault], + ownTokens: [jpegd], + resolveUniV3: true, + }, +}); + +const liquidityTvl = async (timestamp, ethBlock, chainBlocks, { api }) => { + const troveManager = '0xA39739EF8b0231DbFA0DcdA07d7e29faAbCf4bb2' + const stabilityPool = '0x66017d22b0f8556afdd19fc67041899eb65a21bb' + const troveData = await api.call({ abi: 'function Troves(address) view returns (uint256 debt, uint256 coll,uint256 stake ,uint8 status , uint128 arrayIndex )', target: troveManager, params: multisig }) + const stabilityData = await api.call({ abi: 'function deposits(address) view returns ( uint256 initialValue, address frontEndTag )', target: stabilityPool, params: multisig }) + api.add(ADDRESSES.ethereum.LUSD, troveData.debt * -1) + api.add(ADDRESSES.ethereum.LUSD, stabilityData.initialValue) + api.add(ADDRESSES.null, troveData.coll) + return api.getBalances() +} +treasuryTvl.ethereum.tvl = sdk.util.sumChainTvls([treasuryTvl.ethereum.tvl, liquidityTvl]) + +module.exports = treasuryTvl \ No newline at end of file diff --git a/projects/treasury/just-yield.js b/projects/treasury/just-yield.js new file mode 100644 index 00000000000..48b09d9d24b --- /dev/null +++ b/projects/treasury/just-yield.js @@ -0,0 +1,16 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const Treasury = "0xeCa31b3cbD0C65CC3Ea2DE2338693B74445B0c2C"; + + + +module.exports = treasuryExports({ + arbitrum: { + tokens: [ + nullAddress, + ADDRESSES.arbitrum.WETH,//weth + ], + owners: [Treasury], + }, +}) \ No newline at end of file diff --git a/projects/treasury/keeperdao.js b/projects/treasury/keeperdao.js new file mode 100644 index 00000000000..c4d7f2b540d --- /dev/null +++ b/projects/treasury/keeperdao.js @@ -0,0 +1,26 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const keeperDaoTreasury = "0x9a67F1940164d0318612b497E8e6038f902a00a4"; +const ROOK = "0xfA5047c9c78B8877af97BDcb85Db743fD7313d4a"; + + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.USDC,//USDC + '0xFe2e637202056d30016725477c5da089Ab0A043A',//sETH2 + ADDRESSES.ethereum.DAI,//DAI + ADDRESSES.ethereum.RETH,//rETH + ADDRESSES.ethereum.STETH,//stETH + ADDRESSES.ethereum.WETH,//WETH + ADDRESSES.ethereum.WBTC,//WBTC + '0xdBdb4d16EdA451D0503b854CF79D55697F90c8DF',//ALCX + '0xEB4C2781e4ebA804CE9a9803C67d0893436bB27D',//renBTC + ADDRESSES.ethereum.USDT + ], + owners: [keeperDaoTreasury], + ownTokens: [ROOK], + }, +}) diff --git a/projects/treasury/kei.js b/projects/treasury/kei.js new file mode 100644 index 00000000000..216ff4b95f1 --- /dev/null +++ b/projects/treasury/kei.js @@ -0,0 +1,14 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { treasuryExports } = require("../helper/treasury"); + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + ADDRESSES.ethereum.WETH, + '0x7d87123d92e9df257e0789189e4c4ff67fa6c382', + ], + owners: ['0x3D027824a9Eb4cc5E8f24D97FD8495eA9DC7026F'], + ownTokens: ['0xF75C7a59bCD9bd207C4Ab1BEB0b32EEd3B6392f3'], + resolveLP: true, + }, +}) diff --git a/projects/treasury/king-finance.js b/projects/treasury/king-finance.js new file mode 100644 index 00000000000..6c339ddef46 --- /dev/null +++ b/projects/treasury/king-finance.js @@ -0,0 +1,19 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const TREASURY1 = '0x2eecdb4631c3d2f49d56b4cbfede4c7b23151337' +const TREASURY2 = '0x0af6fef0248d666f0bfd73e65485186526411337' +const TREASURY3 = '0x74f08aF7528Ffb751e3A435ddD779b5C4565e684' +const TREASURY4 = '0xa6449e07ee26d552bc7a2656038cd19b1b691337' + +module.exports = treasuryExports({ + bsc: { + tokens: [ + nullAddress, + ADDRESSES.bsc.WBNB, + ADDRESSES.bsc.USDT, + ], + owners: [TREASURY1, TREASURY2, TREASURY3, TREASURY4,], + ownTokens: ['0x74f08aF7528Ffb751e3A435ddD779b5C4565e684'], + }, +}) \ No newline at end of file diff --git a/projects/treasury/kinza.js b/projects/treasury/kinza.js new file mode 100644 index 00000000000..bf35c967c77 --- /dev/null +++ b/projects/treasury/kinza.js @@ -0,0 +1,14 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0x65FDCD48c4807F67429Bdc731d6964f5553CdB36"; + +module.exports = treasuryExports({ + bsc: { + tokens: [ + nullAddress, + ADDRESSES.bsc.WBNB, + ], + owners: [treasury,], + }, +}) \ No newline at end of file diff --git a/projects/treasury/klima-dao.js b/projects/treasury/klima-dao.js new file mode 100644 index 00000000000..7644248adc0 --- /dev/null +++ b/projects/treasury/klima-dao.js @@ -0,0 +1,29 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress,treasuryExports } = require("../helper/treasury"); + +const klimaTreasury1 = "0x7dd4f0b986f032a44f913bf92c9e8b7c17d77ad7"; + +const KLIMA = "0x4e78011ce80ee02d2c3e649fb657e45898257815"; + + +module.exports = treasuryExports({ + polygon: { + tokens: [ + nullAddress, + '0x2F800Db0fdb5223b3C3f354886d907A671414A7F', // BCT + ADDRESSES.polygon.USDC, // USDC + '0xD838290e877E0188a4A44700463419ED96c16107', // NCT + '0xAa7DbD1598251f856C12f63557A4C4397c253Cea', // MCO2 + '0x2B3eCb0991AF0498ECE9135bcD04013d7993110c', // UBO + '0x6BCa3B77C1909Ce1a4Ba1A20d1103bDe8d222E48', // NBO + '0x5786b267d35F9D011c4750e0B0bA584E1fDbeAD1', // USDC/KLIMA SLP + '0x9803c7aE526049210a1725F7487AF26fE2c24614', // BCT/KLIMA SLP + '0xb2D0D5C86d933b0aceFE9B95bEC160d514d152E1', // NCT/KLIMA SLP + '0x64a3b8cA5A7e406A78e660AE10c7563D9153a739', // MCO2/KLIMA Quickswap LP + '0x5400A05B8B45EaF9105315B4F2e31F806AB706dE', // UBO/KLIMA SLP + '0x251cA6A70cbd93Ccd7039B6b708D4cb9683c266C', // NBO/KLIMA SLP + ], + owners: [klimaTreasury1], + ownTokens: [KLIMA], + }, +}) diff --git a/projects/treasury/koyo.js b/projects/treasury/koyo.js new file mode 100644 index 00000000000..9334b441f32 --- /dev/null +++ b/projects/treasury/koyo.js @@ -0,0 +1,17 @@ +const constants = require("../koyo/constants"); +const { treasuryExports } = require("../helper/treasury"); + +module.exports = treasuryExports({ + boba: { + tokens: Object.values(constants.addresses.boba.tokens), + owners: [constants.addresses.boba.treasury], + ownTokens: [constants.addresses.boba.tokens.KYO], + }, + ethereum: { + tokens: [ + constants.addresses.ethereum.USDC + ], + owners: [constants.addresses.ethereum.treasury], + ownTokens: [], + }, +}) diff --git a/projects/treasury/kromatika.js b/projects/treasury/kromatika.js new file mode 100644 index 00000000000..4138998da87 --- /dev/null +++ b/projects/treasury/kromatika.js @@ -0,0 +1,19 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress,treasuryExports } = require("../helper/treasury"); + +const Treasury = "0x8e35cc21fbcade0a5483ce430e0d5456086a36d3"; + +const KROM = "0x55fF62567f09906A85183b866dF84bf599a4bf70"; + + +module.exports = treasuryExports({ + arbitrum: { + tokens: [ + nullAddress, + ADDRESSES.arbitrum.USDC, + "0x8971dFb268B961a9270632f28B24F2f637c94244" + ], + owners: [Treasury], + ownTokens: [KROM], + }, +}) \ No newline at end of file diff --git a/projects/treasury/kyber.js b/projects/treasury/kyber.js new file mode 100644 index 00000000000..57722bfb52d --- /dev/null +++ b/projects/treasury/kyber.js @@ -0,0 +1,49 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { treasuryExports } = require("../helper/treasury"); + +const treasury = "0xe6a7338cba0a1070adfb22c07115299605454713" +const treasury2 = "0x91c9d4373b077ef8082f468c7c97f2c499e36f5b" +const knc = "0xdeFA4e8a7bcBA345F687a2f1456F5Edd9CE97202" +const kncarb = "0xe4DDDfe67E7164b0FE14E218d80dC4C08eDC01cB" +const kncop = "0xa00E3A3511aAC35cA78530c85007AFCd31753819" +const kncbsc= "0xfe56d5892BDffC7BF58f2E84BE1b2C32D21C308b" + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.WETH, + ADDRESSES.ethereum.USDT + + ], + owners: [treasury, treasury2], + ownTokens: [knc], + }, + arbitrum: { + tokens: [ + ADDRESSES.arbitrum.ARB, + ADDRESSES.arbitrum.WBTC, + ADDRESSES.arbitrum.USDC, + ADDRESSES.arbitrum.USDC_CIRCLE, + "0x3F56e0c36d275367b8C502090EDF38289b3dEa0d" //MAI + ], + owners: [treasury2], + ownTokens: [kncarb], + }, + optimism: { + tokens: [ + ADDRESSES.optimism.OP, + ADDRESSES.optimism.WETH, + "0x8700dAec35aF8Ff88c16BdF0418774CB3D7599B4" + ], + owners: [treasury2], + ownTokens: [kncop], + }, + bsc: { + tokens: [ + ADDRESSES.bsc.WBNB + ], + owners: [treasury2], + ownTokens: [kncbsc], + }, +}) \ No newline at end of file diff --git a/projects/treasury/l2beat.js b/projects/treasury/l2beat.js new file mode 100644 index 00000000000..4b9b5bac739 --- /dev/null +++ b/projects/treasury/l2beat.js @@ -0,0 +1,15 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { treasuryExports } = require("../helper/treasury"); + +const treasury = "0xea78912803be5e356eac2b8e127d4ba87230a48e" // + +module.exports = treasuryExports({ + optimism: { + tokens: [ + ADDRESSES.optimism.OP, + ADDRESSES.optimism.WETH + ], + owners: [treasury], + }, + +}) \ No newline at end of file diff --git a/projects/treasury/leaguedao.js b/projects/treasury/leaguedao.js new file mode 100644 index 00000000000..750746c490c --- /dev/null +++ b/projects/treasury/leaguedao.js @@ -0,0 +1,5 @@ +const olympus = require("../leaguedao/index"); + +module.exports = olympus; + +delete module.exports.ethereum.staking \ No newline at end of file diff --git a/projects/treasury/level.js b/projects/treasury/level.js new file mode 100644 index 00000000000..8ddfe1fee2f --- /dev/null +++ b/projects/treasury/level.js @@ -0,0 +1,36 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { treasuryExports } = require("../helper/treasury"); + +const LVL = '0xb64e280e9d1b5dbec4accedb2257a87b400db149'; + +module.exports = treasuryExports({ + bsc: { + tokens: [ + "0xb5c42f84ab3f786bca9761240546aa9cec1f8821", + ], + owners: [ + '0x8BFf27E9Fa1C28934554e6B5239Fb52776573619', + '0xb07953f23545796710957faec97f05b21146ac2d', + '0x92a0a11a57c28d4c86a629530fd59b83b1276003', + '0x712a2e08c67cd7153f04fdb3037d4696300921d0', + ], + ownTokens: [LVL], + }, + arbitrum: { + tokens: [ + ADDRESSES.arbitrum.WETH, + ADDRESSES.arbitrum.WBTC, + ADDRESSES.arbitrum.USDT, + ADDRESSES.arbitrum.USDC, + ADDRESSES.arbitrum.ARB, + "0x502697AF336F7413Bb4706262e7C506Edab4f3B9", + "0xb076f79f8D1477165E2ff8fa99930381FB7d94c1", + "0x5573405636F4b895E511C9C54aAfbefa0E7Ee458", + ], + owners: [ + '0x635aac65f37a6bbe06a2dde77b0fd2f1748674d4', + '0x4b47ef68180ec46a0b6be4d34fd9d8680bee2b2c', + ], + ownTokens: [LVL], + }, +}) diff --git a/projects/treasury/lido.js b/projects/treasury/lido.js new file mode 100644 index 00000000000..6fa5c3d7d08 --- /dev/null +++ b/projects/treasury/lido.js @@ -0,0 +1,34 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const LidoTreasury = "0x3e40D73EB977Dc6a537aF587D48316feE66E9C8c"; +const LDO = ADDRESSES.ethereum.LIDO; +const treasuryMatic = "0xd65Fa54F8DF43064dfd8dDF223A446fc638800A9" + +const treasurySolana = "GQ3QPrB1RHPRr4Reen772WrMZkHcFM4DL5q44x1BBTFm" +const LDOsol = "HZRCwxP2Vq9PCpPXooayhJ2bxTpo5xfpQrwB1svh332p" + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.DAI,//DAI + ADDRESSES.ethereum.STETH,//stETH + ADDRESSES.ethereum.MATIC,//MATIC + ADDRESSES.ethereum.USDC,//USDC + '0x2eE543b8866F46cC3dC93224C6742a8911a59750',//MVDG + '0xbA6B0dbb2bA8dAA8F5D6817946393Aef8D3A4487',//HSF + '0x232FB065D9d24c34708eeDbF03724f2e95ABE768',//SHEESHA + '0x0d02755a5700414B26FF040e1dE35D337DF56218' //BEND + ], + owners: [LidoTreasury, treasuryMatic], + ownTokens: [LDO], + }, + solana: { + tokens: [ + "7dHbWXmci3dT8UFYWYZweBLXgycu7Y3iL6trKn1Y7ARj" + ], + owners: [treasurySolana], + ownTokens: [LDOsol], + }, +}) diff --git a/projects/treasury/liondex.js b/projects/treasury/liondex.js new file mode 100644 index 00000000000..9e25125f00b --- /dev/null +++ b/projects/treasury/liondex.js @@ -0,0 +1,20 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress,treasuryExports } = require("../helper/treasury"); + +const Treasury = "0x7fca3bf8adc4e143bd789aecda36c0ce34f1d75b"; + +const LION = "0x8eBb85D53e6955e557b7c53acDE1D42fD68561Ec"; + + +module.exports = treasuryExports({ + arbitrum: { + tokens: [ + nullAddress, + ADDRESSES.arbitrum.USDC, + "0x8971dFb268B961a9270632f28B24F2f637c94244", + ], + owners: [Treasury], + ownTokens: [LION], + resolveUniV3: true, + }, +}) \ No newline at end of file diff --git a/projects/treasury/liquity-treasury.js b/projects/treasury/liquity-treasury.js new file mode 100644 index 00000000000..65531105d98 --- /dev/null +++ b/projects/treasury/liquity-treasury.js @@ -0,0 +1,45 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0xF06016D822943C42e3Cb7FC3a6A3B1889C1045f8"; +const treasury2 = "0xcCb2656afB1Cc4cB130e8C8C903ad674069c6FCD"; + +const treasuryOP = "0xd2D4e9024D8C90aB52032a9F1e0d92D4cE20191B"; +const treasuryOP2 = "0x2f593f151aF4bb9A71bcA6cAce1d3c56C2844117"; + +const treasuryARB = "0xc5adb3d91329e1600cbf573485b1d3207bcf6de2" + +const LQTY = "0x6dea81c8171d0ba574754ef6f8b412f2ed88c54d"; + + + + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.DAI,//DAI + ADDRESSES.ethereum.LUSD,//LUSD + ADDRESSES.ethereum.USDC,//usdc + '0xc944E90C64B2c07662A292be6244BDf05Cda44a7',//grt + '0x41545f8b9472D758bB669ed8EaEEEcD7a9C4Ec29',//fort + ], + owners: [treasury, treasury2], + ownTokens: [LQTY], + }, + optimism: { + tokens: [ + nullAddress, + ADDRESSES.optimism.OP, //OP + '0x73cb180bf0521828d8849bc8CF2B920918e23032', //USD+ + '0x3c8B650257cFb5f272f799F5e2b4e65093a11a05',//velo + ], + owners: [treasuryOP, treasuryOP2], + }, + arbitrum: { + tokens: [ + nullAddress, + ], + owners: [treasuryARB], + } +}) \ No newline at end of file diff --git a/projects/treasury/looksrare.js b/projects/treasury/looksrare.js new file mode 100644 index 00000000000..4b906d6894d --- /dev/null +++ b/projects/treasury/looksrare.js @@ -0,0 +1,37 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress } = require("../helper/treasury"); +const { + unwrapUniswapV3NFTs, + sumTokensExport, + sumTokens, +} = require("../helper/unwrapLPs"); + +const treasury = "0xC8C57e4C73c71f72cA0a7e043E5D2D144F98ef13"; +const looks = "0xf4d2888d29D722226FafA5d9B24F9164c092421E"; + +const tokens = [ + nullAddress, + ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.SAFE, +]; + +async function ownTokens(timestamp, block) { + const balances = {}; + const tokensAndOwners = [[looks, treasury]]; + const nftsAndOwners = [ + ["0xC36442b4a4522E871399CD717aBDD847Ab11FE88", treasury], + ]; + await sumTokens(balances, tokensAndOwners, block); + await unwrapUniswapV3NFTs({ balances, nftsAndOwners, block }); + return balances; +} + +module.exports = { + ethereum: { + tvl: sumTokensExport({ + tokens, + owners: [treasury], + }), + ownTokens, + }, +}; diff --git a/projects/treasury/lsdx-finance.js b/projects/treasury/lsdx-finance.js new file mode 100644 index 00000000000..78d3af5d10c --- /dev/null +++ b/projects/treasury/lsdx-finance.js @@ -0,0 +1,19 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const Treasury = "0xb966b7038A2b42A0419457dA4F4d2FBa23097aE1"; +const LSD = "0xfAC77A24E52B463bA9857d6b758ba41aE20e31FF"; + + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.DAI,//DAI + ADDRESSES.ethereum.STETH,//stETH + ADDRESSES.ethereum.USDC,//USDC + ], + owners: [Treasury], + ownTokens: [LSD], + }, +}) \ No newline at end of file diff --git a/projects/treasury/luxor.js b/projects/treasury/luxor.js new file mode 100644 index 00000000000..0c7e5cba3b8 --- /dev/null +++ b/projects/treasury/luxor.js @@ -0,0 +1,5 @@ +const olympus = require("../luxor/index"); + +module.exports = olympus; + +delete module.exports.fantom.staking \ No newline at end of file diff --git a/projects/treasury/lyra.js b/projects/treasury/lyra.js new file mode 100644 index 00000000000..8602d08414c --- /dev/null +++ b/projects/treasury/lyra.js @@ -0,0 +1,37 @@ +const { nullAddress, treasuryExports } = require("../helper/treasury"); +const ADDRESSES = require('../helper/coreAssets.json') + +const treasury_arb = "0x2ccf21e5912e9ecccb0ecdee9744e5c507cf88ae"; +const treasury_eth = "0xEE86E99b42981623236824D33b4235833Afd8044"; +const treasury_op = "0xD4C00FE7657791C2A43025dE483F05E49A5f76A6"; + +const lyra_eth = "0x01BA67AAC7f75f647D94220Cc98FB30FCc5105Bf"; +const lyra_arb = "0x079504b86d38119F859c4194765029F692b7B7aa"; +const lyra_op = "0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb"; + +module.exports = treasuryExports({ + arbitrum: { + tokens: [ + ADDRESSES.arbitrum.USDC, + ADDRESSES.arbitrum.WETH, + ], + owners: [treasury_arb], + ownTokens: [lyra_arb], + }, + ethereum: { + tokens: [ + ADDRESSES.ethereum.USDC, + ], + owners: [treasury_eth], + ownTokens: [lyra_eth], + }, + optimism: { + tokens: [ + ADDRESSES.optimism.OP, + ADDRESSES.optimism.sUSD, + ADDRESSES.optimism.WETH, + ], + owners: [treasury_op], + ownTokens: [lyra_op], + }, +}) \ No newline at end of file diff --git a/projects/treasury/macaron.js b/projects/treasury/macaron.js new file mode 100644 index 00000000000..dfcadb7f6d7 --- /dev/null +++ b/projects/treasury/macaron.js @@ -0,0 +1,14 @@ +const config = require("../macaron/config"); +const { sumTokensExport, } = require("../helper/unwrapLPs"); + +module.exports = {} + +function setChainTVL(chain) { + const { treasury, erc20s, } = config[chain] + + module.exports[chain] = { + tvl: sumTokensExport({ owner: treasury, tokens: erc20s }) + } +} + +Object.keys(config).forEach(setChainTVL) \ No newline at end of file diff --git a/projects/treasury/mahadao.js b/projects/treasury/mahadao.js new file mode 100644 index 00000000000..ad79733cd55 --- /dev/null +++ b/projects/treasury/mahadao.js @@ -0,0 +1,15 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport, nullAddress, } = require("../helper/unwrapLPs.js"); + +const eth = { + weth: ADDRESSES.ethereum.WETH, + arth: "0x8CC0F052fff7eaD7f2EdCCcaC895502E884a8a71", + treasury: "0x43c958affe41d44f0a02ae177b591e93c86adbea", +}; + +module.exports = { + ethereum: { + tvl: sumTokensExport({ owner: eth.treasury, tokens: [eth.weth, nullAddress] }), + ownTokens: sumTokensExport({ owner: eth.treasury, tokens: [eth.arth,] }), + } +}; diff --git a/projects/treasury/maia-dao.js b/projects/treasury/maia-dao.js new file mode 100644 index 00000000000..2bfb210a811 --- /dev/null +++ b/projects/treasury/maia-dao.js @@ -0,0 +1,4 @@ +const index = require('../maia-dao/index') +const { ohmTreasury } = require('../helper/treasury') + +module.exports = ohmTreasury(index) \ No newline at end of file diff --git a/projects/treasury/maker.js b/projects/treasury/maker.js new file mode 100644 index 00000000000..8cd820c29c8 --- /dev/null +++ b/projects/treasury/maker.js @@ -0,0 +1,46 @@ +const { nullAddress } = require("../helper/treasury"); +const { + sumTokensExport, + sumTokens, +} = require("../helper/unwrapLPs"); +const ADDRESSES = require('../helper/coreAssets.json') + +const treasury = "0xBE8E3e3618f7474F8cB1d074A26afFef007E98FB"; +const MKR = ADDRESSES.ethereum.MKR; +const DAI = ADDRESSES.ethereum.DAI + +async function tvl(timestamp, block, chainBlocks, {api}) { + const balances = {}; + const tokensAndOwners = [ + nullAddress, + '0xC18360217D8F7Ab5e7c516566761Ea12Ce7F9D72',//ens + '0x4da27a545c0c5B758a6BA100e3a049001de870f5',//staave + '0xc00e94Cb662C3520282E6f5717214004A7f26888',//comp + ADDRESSES.ethereum.AAVE,//aave + '0x8f8221aFbB33998d8584A2B05749bA73c37a938a',//req + ].map(t=>[t, treasury]) + await sumTokens(balances, tokensAndOwners, block); + + const all = await api.call({target: "0x35d1b3f3d7966a1dfe207aa4514c12a259a0492b", abi: "function dai(address) view returns (uint256)", params: ["0xA950524441892A31ebddF91d3cEEFa04Bf454466"]}) + const vice = await api.call({target: "0x35d1b3f3d7966a1dfe207aa4514c12a259a0492b", abi: "function vice() view returns (uint256)", }) + balances[DAI] = (all-vice)/1e27 + + return balances; +} + + +module.exports = { + ethereum: { + tvl, + ownTokens: sumTokensExport({ + tokens: [MKR], + owners: [treasury], + }), + }, + arbitrum: { + tvl:sumTokensExport({ + tokens: [nullAddress], + owners: ["0x10e6593cdda8c58a1d0f14c5164b376352a55f2f"], + }), + }, +} \ No newline at end of file diff --git a/projects/treasury/mantra-dao.js b/projects/treasury/mantra-dao.js new file mode 100644 index 00000000000..d93b5d4f44b --- /dev/null +++ b/projects/treasury/mantra-dao.js @@ -0,0 +1,26 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0xc8899da25423ac52aa711b97ae04c8888fa1e1d7"; +const treasury2 = "0xd84701828745c98405a3e1153fccea627963859a" +const OM = "0x3593d125a4f7849a1b059e64f4517a86dd60c95d"; + + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.USDC,//USDC + '0xFe2e637202056d30016725477c5da089Ab0A043A',//sETH2 + ADDRESSES.ethereum.DAI,//DAI + ADDRESSES.ethereum.RETH,//rETH + ADDRESSES.ethereum.STETH,//stETH + ADDRESSES.ethereum.WETH,//WETH + ADDRESSES.ethereum.WBTC,//WBTC + '0xdBdb4d16EdA451D0503b854CF79D55697F90c8DF',//ALCX + '0xEB4C2781e4ebA804CE9a9803C67d0893436bB27D'//renBTC + ], + owners: [treasury, treasury2], + ownTokens: [OM], + }, +}) \ No newline at end of file diff --git a/projects/treasury/maple.js b/projects/treasury/maple.js new file mode 100644 index 00000000000..07519efdf3a --- /dev/null +++ b/projects/treasury/maple.js @@ -0,0 +1,17 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { treasuryExports } = require("../helper/treasury"); + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.WETH, + ADDRESSES.ethereum.USDT + ], + owners: [ + "0xa9466EaBd096449d650D5AEB0dD3dA6F52FD0B19", + "0xd6d4Bcde6c816F17889f1Dd3000aF0261B03a196" + ], + ownTokens: ["0x33349b282065b0284d756f0577fb39c158f935e6"], + }, +}) \ No newline at end of file diff --git a/projects/treasury/metacartel.js b/projects/treasury/metacartel.js new file mode 100644 index 00000000000..4a3ba049810 --- /dev/null +++ b/projects/treasury/metacartel.js @@ -0,0 +1,20 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0x4570b4fAF71E23942B8B9F934b47ccEdF7540162"; + + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.WETH,//weth + ADDRESSES.ethereum.USDC,//usdc + '0x6243d8CEA23066d098a15582d81a598b4e8391F4',//flx + ADDRESSES.ethereum.DAI,//dai + '0xfb5453340C03db5aDe474b27E68B6a9c6b2823Eb',//robot + '0x03ab458634910AaD20eF5f1C8ee96F1D6ac54919',//rai + ], + owners: [treasury] + }, +}) \ No newline at end of file diff --git a/projects/treasury/metronome.js b/projects/treasury/metronome.js new file mode 100644 index 00000000000..3864a969388 --- /dev/null +++ b/projects/treasury/metronome.js @@ -0,0 +1,22 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0xc897b98272aa23714464ea2a0bd5180f1b8c0025"; +const vestingAddress = "0xd1DE3F9CD4AE2F23DA941a67cA4C739f8dD9Af33"; +const MET = "0x2Ebd53d035150f328bd754D6DC66B99B0eDB89aa"; + + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + '0x64351fC9810aDAd17A690E4e1717Df5e7e085160',//msETH + ADDRESSES.ethereum.USDC,//usdc + ADDRESSES.ethereum.DAI,//dai + ADDRESSES.ethereum.WETH,//weth + '0x1b40183EFB4Dd766f11bDa7A7c3AD8982e998421',//vsp + ], + owners: [treasury, vestingAddress], + ownTokens: [MET], + }, +}) \ No newline at end of file diff --git a/projects/treasury/mimo-protocol.js b/projects/treasury/mimo-protocol.js new file mode 100644 index 00000000000..4d4d4fcdf12 --- /dev/null +++ b/projects/treasury/mimo-protocol.js @@ -0,0 +1,55 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0x25Fc7ffa8f9da3582a36633d04804F0004706F9b"; +const treasury1 = "0x3De64eed7A43C40E33dc837dec1119DcA0a677b4"; + +const treasurypolygon = "0x2046c0416A558C40cb112E5ebB0Ca764c3C5c32a"; +const treasurypolygon1 = "0x6fb6a0a35b33e230d0149d49858e1a313a2ad4a7"; + +const treasuryfantom = "0x174162ddecE9d0b7B68fd945e38c3372C4C818ba"; +const treasuryfantom1 = "0xA67FC89D5312812D3413A83418fc75ff78148a7E"; + +const MIMO = "0x90b831fa3bebf58e9744a14d638e25b4ee06f9bc"; +const MIMOpolygon = "0xadac33f543267c4d59a8c299cf804c303bc3e4ac"; +const MIMOfantom = "0x1d1764f04de29da6b90ffbef372d1a45596c4855"; + + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.USDT, + ADDRESSES.ethereum.CRV, + ADDRESSES.ethereum.USDC, + '0xba100000625a3754423978a60c9317c58a424e3D',//BAL + ADDRESSES.ethereum.cvxCRV, + '0x6DEA81C8171D0bA574754EF6F8b412F2Ed88c54D',//LQTY + '0x41D5D79431A913C4aE7d69a668ecdfE5fF9DFB68',//INV + '0xcAfE001067cDEF266AfB7Eb5A286dCFD277f3dE5',//PSP + '0x68037790A0229e9Ce6EaA8A99ea92964106C4703',//PAR + '0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490',//3CRV + '0x4104b135DBC9609Fc1A9490E61369036497660c8',//APY + '0xC0c293ce456fF0ED870ADd98a0828Dd4d2903DBF',//AURA + + ], + owners: [treasury, treasury1, treasurypolygon, treasurypolygon1, treasuryfantom, treasuryfantom1], + ownTokens: [MIMO,], + }, + polygon: { + tokens: [ + nullAddress, + ADDRESSES.polygon.USDC + ], + owners: [treasury, treasury1, treasurypolygon, treasurypolygon1, treasuryfantom, treasuryfantom1], + ownTokens: [MIMOpolygon,], + }, + fantom: { + tokens: [ + nullAddress, + ADDRESSES.fantom.USDC + ], + owners: [treasury, treasury1, treasurypolygon, treasurypolygon1, treasuryfantom, treasuryfantom1], + ownTokens: [MIMOfantom,], + } +}) \ No newline at end of file diff --git a/projects/treasury/moret.js b/projects/treasury/moret.js new file mode 100644 index 00000000000..b249a9720cd --- /dev/null +++ b/projects/treasury/moret.js @@ -0,0 +1,18 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress,treasuryExports } = require("../helper/treasury"); + +const treasury = "0x015B5FD572De0a7C1478075e1710a0505184520d"; + +const MOR = "0x43F2acbaE09272021AFC107180Aa0ee313B00D8F"; + +module.exports = treasuryExports({ + polygon: { + tokens: [ + nullAddress, + ADDRESSES.polygon.USDC,//USDC + ADDRESSES.polygon.WETH_1//weth + ], + owners: [treasury], + ownTokens: [MOR], + }, +}) \ No newline at end of file diff --git a/projects/treasury/mstable.js b/projects/treasury/mstable.js new file mode 100644 index 00000000000..ec45cd83673 --- /dev/null +++ b/projects/treasury/mstable.js @@ -0,0 +1,32 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress,treasuryExports } = require("../helper/treasury"); + +const treasury = "0x3dd46846eed8D147841AE162C8425c08BD8E1b41"; +const treasury2 = "0xfcf455d6eb48b3289a712c0b3bc3c7ee0b0ee4c6" +const treasury3 = "0xf6ff1f7fceb2ce6d26687eaab5988b445d0b94a2" +const treasury4 = "0x67905d3e4fec0c85dce68195f66dc8eb32f59179" + +const META = "0xa3BeD4E1c75D00fa6f4E5E6922DB7261B5E9AcD2"; +const mUSD = "0xe2f2a5C287993345a840Db3B0845fbC70f5935a5"; + + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.USDC,//USDC + ADDRESSES.ethereum.DAI,//DAI + ADDRESSES.ethereum.WETH,//WETH + ADDRESSES.ethereum.USDT,//USDT + '0xc00e94Cb662C3520282E6f5717214004A7f26888',//COMP + '0x4da27a545c0c5B758a6BA100e3a049001de870f5',//stkAAVE + '0x7C07F7aBe10CE8e33DC6C5aD68FE033085256A84',//icETH + '0xC18360217D8F7Ab5e7c516566761Ea12Ce7F9D72',//ENS + ADDRESSES.ethereum.UNI,//UNI + '0xC0c293ce456fF0ED870ADd98a0828Dd4d2903DBF',//AURA + ADDRESSES.ethereum.STETH,//stETH + ], + owners: [treasury, treasury2, treasury3, treasury4], + ownTokens: [META, mUSD], + }, +}) \ No newline at end of file diff --git a/projects/treasury/mux.js b/projects/treasury/mux.js new file mode 100644 index 00000000000..84ea7ee755c --- /dev/null +++ b/projects/treasury/mux.js @@ -0,0 +1,11 @@ +const { nullAddress,treasuryExports } = require("../helper/treasury"); + +module.exports = treasuryExports({ + arbitrum: { + tokens: [ + nullAddress, + ], + owners: ['0x029a4a97e892e7270d9b3b90bfef95599bc6bfd6'], + ownTokens: [], + }, +}) \ No newline at end of file diff --git a/projects/treasury/mycelium.js b/projects/treasury/mycelium.js new file mode 100644 index 00000000000..2c78684c461 --- /dev/null +++ b/projects/treasury/mycelium.js @@ -0,0 +1,14 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress,treasuryExports } = require("../helper/treasury"); + +module.exports = treasuryExports({ + arbitrum: { + tokens: [ + nullAddress, + ADDRESSES.arbitrum.WETH, // WETH + '0x432502a764abec914f940916652ce55885323cda', + ], + owners: ['0x9f59e27fd6c8d96dfb89da58c0c98bac07e7a21a'], + ownTokens: ['0xc74fe4c715510ec2f8c61d70d397b32043f55abe'], + }, +}) \ No newline at end of file diff --git a/projects/treasury/nemesis.js b/projects/treasury/nemesis.js new file mode 100644 index 00000000000..ac3e4935c6e --- /dev/null +++ b/projects/treasury/nemesis.js @@ -0,0 +1,18 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress,treasuryExports } = require("../helper/treasury"); + +const nemeTreasury1 = "0xdFFb6FB92E3F54C0DAa59e5af3f47fD58824562a"; + +const NMS = "0x8ac9dc3358a2db19fdd57f433ff45d1fc357afb3"; + + +module.exports = treasuryExports({ + bsc: { + tokens: [ + nullAddress, + ADDRESSES.bsc.BUSD,//BUSD + ], + owners: [nemeTreasury1], + ownTokens: [NMS], + }, +}) \ No newline at end of file diff --git a/projects/treasury/neutra-finance.js b/projects/treasury/neutra-finance.js new file mode 100644 index 00000000000..0d601ec74e3 --- /dev/null +++ b/projects/treasury/neutra-finance.js @@ -0,0 +1,20 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0xfba3b455211a3a09689788Ac3A14B4F8Baf012B4"; +const NEU = "0xdA51015b73cE11F77A115Bb1b8a7049e02dDEcf0"; +const esNEU = "0xdeBB612442159b34c24B7BAF20b1CC3218a06925" +const sbfNEU = "0x44F0685482A7180785e309947176C34D0A3d9187" + +module.exports = treasuryExports({ + arbitrum: { + tokens: [ + nullAddress, + ADDRESSES.arbitrum.USDC, + "0x422B5A91b5Cdef61D3400671CCdd5bE22C7CE655", + ADDRESSES.optimism.DAI, + ], + owners: [treasury], + ownTokens: [NEU, esNEU, sbfNEU], + }, +}) \ No newline at end of file diff --git a/projects/treasury/newland.js b/projects/treasury/newland.js new file mode 100644 index 00000000000..e815cd3cc7a --- /dev/null +++ b/projects/treasury/newland.js @@ -0,0 +1,24 @@ +const { getChainTransform } = require("../helper/portedTokens"); +const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); + +const treasuryAddress = "0xB3FC6B9be3AD6b2917d304d4F5645a311bCFd0A8"; +const erc20Tokens = [ + //MDX + "0x25d2e80cb6b86881fd7e07dd263fb79f4abe033c", + //BOO + "0xff96dccf2763d512b6038dc60b7e96d1a9142507", +]; + +/*** Treasury ***/ +const Treasury = async (timestamp, ethBlock, chainBlocks) => { + const balances = {}; + let transformAddress = await getChainTransform('heco') + await sumTokensAndLPsSharedOwners(balances, erc20Tokens.map(t => [t, false]), [treasuryAddress], chainBlocks["heco"], "heco", transformAddress); + return balances; +}; + +module.exports = { + heco: { + tvl: Treasury, + }, +}; diff --git a/projects/treasury/nexus-mutual.js b/projects/treasury/nexus-mutual.js new file mode 100644 index 00000000000..dde13a0d431 --- /dev/null +++ b/projects/treasury/nexus-mutual.js @@ -0,0 +1,21 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const communityFund = "0x586b9b2F8010b284A0197f392156f1A7Eb5e86e9"; +const treasury = "0xfc64382c9ce89ba1c21692a68000366a35ff0336" +const nxm = "0xd7c49CEE7E9188cCa6AD8FF264C1DA2e69D4Cf3B"; +const wNxm = "0x0d438F3b5175Bebc262bF23753C1E53d03432bDE"; + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.USDT, + "0x2ba592F78dB6436527729929AAf6c908497cB200", // CREAM + ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.SAFE, + ], + ownTokens: [nxm, wNxm], + owners: [communityFund, treasury], + }, +}); diff --git a/projects/treasury/nftx.js b/projects/treasury/nftx.js new file mode 100644 index 00000000000..0782074868a --- /dev/null +++ b/projects/treasury/nftx.js @@ -0,0 +1,16 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const nftxDao = "0x40D73Df4F99bae688CE3C23a01022224FE16C7b2"; +const nftx = "0x87d73E916D7057945c9BcD8cdd94e42A6F47f776" + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.USDC,//USDC + ], + owners: [nftxDao], + ownTokens: [nftx], + }, +}) \ No newline at end of file diff --git a/projects/treasury/notiboy-treasury.js b/projects/treasury/notiboy-treasury.js new file mode 100644 index 00000000000..a1057472c4e --- /dev/null +++ b/projects/treasury/notiboy-treasury.js @@ -0,0 +1,15 @@ +const { nullAddress,treasuryExports } = require("../helper/treasury"); + +const notiboyTreasury = "NOTILXUG675YH2JBO3NP5BXADEWRWHPOM5VBIWE6Z3AQU3QKGKMEPNZJRE"; + +module.exports = treasuryExports({ + algorand: { + tokens: [ + nullAddress, + '31566704', //usdc + '1', // algo + + ], + owners: [notiboyTreasury], + }, +}) \ No newline at end of file diff --git a/projects/treasury/notional.js b/projects/treasury/notional.js new file mode 100644 index 00000000000..472c01ae5a3 --- /dev/null +++ b/projects/treasury/notional.js @@ -0,0 +1,17 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0x086b4ecd75c494dd36641195e89c25373e06d7cb"; +const treasury2 = "0x22341fb5d92d3d801144aa5a925f401a91418a05" +const note = "0xCFEAead4947f0705A14ec42aC3D44129E1Ef3eD5" + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.USDC,//USDC + ], + owners: [treasury], + ownTokens: [note], + }, +}) \ No newline at end of file diff --git a/projects/treasury/nouns.js b/projects/treasury/nouns.js new file mode 100644 index 00000000000..9897ca0b461 --- /dev/null +++ b/projects/treasury/nouns.js @@ -0,0 +1,15 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0x0BC3807Ec262cB779b38D65b38158acC3bfedE10"; + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.USDC, //USDC + ADDRESSES.ethereum.STETH,//stETH + ], + owners: [treasury,], + }, +}) \ No newline at end of file diff --git a/projects/treasury/o2-dao.js b/projects/treasury/o2-dao.js new file mode 100644 index 00000000000..3cf00e27228 --- /dev/null +++ b/projects/treasury/o2-dao.js @@ -0,0 +1,15 @@ +const { treasuryExports, } = require("../helper/treasury"); + + +module.exports = treasuryExports({ + avax: { + tokens: [ + '0x321E7092a180BB43555132ec53AaA65a5bF84251', + '0x7bc2561d69b56fae9760df394a9fa9202c5f1f11', + '0x0da67235dd5787d67955420c84ca1cecd4e5bb3b', + ], + owners: ['0x10c12b7322ac2c5a26bd9929abc6e6b7997570ba'], + resolveLP: true, + ownTokens: ['0xaa2439dbad718c9329a5893a51a708c015f76346'] + }, +}) diff --git a/projects/treasury/o3-swap.js b/projects/treasury/o3-swap.js new file mode 100644 index 00000000000..a8cf7a14d7f --- /dev/null +++ b/projects/treasury/o3-swap.js @@ -0,0 +1,12 @@ +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0xb23d6fc44e40e56cb3b0d2c28ba3d7a170a07a49"; + +module.exports = treasuryExports({ + arbitrum: { + tokens: [ + nullAddress, + ], + owners: [treasury], + }, +}) \ No newline at end of file diff --git a/projects/treasury/oasisswapdex.js b/projects/treasury/oasisswapdex.js new file mode 100644 index 00000000000..b2032aabe23 --- /dev/null +++ b/projects/treasury/oasisswapdex.js @@ -0,0 +1,15 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0xe0a9B8DeF6d85eb7D828f706635402334D564b0f"; +const MultisigTreasury = "0x8B059bF6cE7c279a5BfEc006F439Db1E5c4A924c" + +module.exports = treasuryExports({ + arbitrum: { + tokens: [ + nullAddress, + ADDRESSES.arbitrum.USDC, //USDC + ], + owners: [treasury, MultisigTreasury], + }, +}) \ No newline at end of file diff --git a/projects/treasury/oceanus.js b/projects/treasury/oceanus.js new file mode 100644 index 00000000000..fad7b8de8a3 --- /dev/null +++ b/projects/treasury/oceanus.js @@ -0,0 +1,12 @@ +const { staking } = require("../helper/staking"); + +const treasuryContract = "0xF29EEC2563b1E6a1ed87ff7DDfB164474d1Ecb50"; + +const SEA = "0x41607272ce6f2a42732ae382f00f8f9ce68d78f3"; + +module.exports = { + metis: { + tvl: (async) => ({}), + ownTokens: staking(treasuryContract, SEA, "metis"), + }, +}; diff --git a/projects/treasury/olympulsex.js b/projects/treasury/olympulsex.js new file mode 100644 index 00000000000..bacb8b14a26 --- /dev/null +++ b/projects/treasury/olympulsex.js @@ -0,0 +1,11 @@ +const ADDRESSES = require("../helper/coreAssets.json"); +const { sumTokensExport } = require('../helper/unknownTokens') + +const treasury = "0x767d028d6d49ac86Aba52d23746c6dC5285C4852"; +const LP = '0x2d593b3472d6a5439bC1523a04C2aec314CBc44c' + +module.exports = { + pulse: { + tvl: sumTokensExport({ owner: treasury, tokens: [ADDRESSES.pulse.DAI, LP], useDefaultCoreAssets: true, }), + } +} \ No newline at end of file diff --git a/projects/treasury/olympus-dao.js b/projects/treasury/olympus-dao.js new file mode 100644 index 00000000000..85efc449f79 --- /dev/null +++ b/projects/treasury/olympus-dao.js @@ -0,0 +1,3 @@ +module.exports = require("../olympus/index"); + +delete module.exports.ethereum.staking \ No newline at end of file diff --git a/projects/treasury/omicron.js b/projects/treasury/omicron.js new file mode 100644 index 00000000000..18da6512431 --- /dev/null +++ b/projects/treasury/omicron.js @@ -0,0 +1,3 @@ +module.exports = require("../omicron/index"); + +delete module.exports.arbitrum.staking \ No newline at end of file diff --git a/projects/treasury/ooki.js b/projects/treasury/ooki.js new file mode 100644 index 00000000000..3f036645bc8 --- /dev/null +++ b/projects/treasury/ooki.js @@ -0,0 +1,24 @@ +const treasuryContract = '0xfedC4dD5247B93feb41e899A09C44cFaBec29Cbc' +const { sumTokens2 } = require('../helper/unwrapLPs') + +let TreasureTokens = [ + '0x56d811088235F11C8920698a204A5010a788f4b3', //bzrx + // '0x0De05F6447ab4D22c8827449EE4bA2D5C288379B', //ooki + //'vbzrx': '0xB72B31907C1C95F3650b64b2469e08EdACeE5e8F', vesting tokens not counted + '0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490', //pool3 +] + +async function ethTreasury(timestamp, _block, _, { api }) { + return sumTokens2({ api, owner: treasuryContract, tokens: TreasureTokens }) +} +async function ownTokens(timestamp, _block, _, { api }) { + return sumTokens2({ api, owner: treasuryContract, tokens: ['0x0De05F6447ab4D22c8827449EE4bA2D5C288379B'] }) +} + +module.exports = { + ethereum: { + tvl: ethTreasury, + ownTokens, + }, +}; + diff --git a/projects/treasury/op-foundation.js b/projects/treasury/op-foundation.js new file mode 100644 index 00000000000..8b0283756d7 --- /dev/null +++ b/projects/treasury/op-foundation.js @@ -0,0 +1,23 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0x2501c477d0a35545a387aa4a3eee4292a9a8b3f0"; +const OP = ADDRESSES.optimism.OP + +module.exports = treasuryExports({ + optimism: { + tokens: [ + nullAddress, + ADDRESSES.optimism.USDC + ], + owners: [treasury], + ownTokens: [OP], + }, + ethereum: { + tokens: [ + nullAddress, + ], + owners: [treasury], + ownTokens: [], + }, +}) \ No newline at end of file diff --git a/projects/treasury/open-oceans.js b/projects/treasury/open-oceans.js new file mode 100644 index 00000000000..8b3ce5c8b97 --- /dev/null +++ b/projects/treasury/open-oceans.js @@ -0,0 +1,12 @@ +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0x61e807038ae880d964a15a57c8cc74a634bccc26"; + +module.exports = treasuryExports({ + arbitrum: { + tokens: [ + nullAddress, + ], + owners: [treasury], + }, +}) \ No newline at end of file diff --git a/projects/treasury/openxswap.js b/projects/treasury/openxswap.js new file mode 100644 index 00000000000..a2fd4b84955 --- /dev/null +++ b/projects/treasury/openxswap.js @@ -0,0 +1,20 @@ +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const Treasury = "0x6b479f4bcf0321c370d266b592fd44eb0fc47ca8"; +const OpenX = "0xc3864f98f2a61A7cAeb95b039D031b4E2f55e0e9"; +const xOpenX = "0x2513486f18eeE1498D7b6281f668B955181Dd0D9" + + + +module.exports = treasuryExports({ + optimism: { + tokens: [ + nullAddress, + '0x3c8B650257cFb5f272f799F5e2b4e65093a11a05',//velo + '0x46f21fDa29F1339e0aB543763FF683D399e393eC' + + ], + owners: [Treasury], + ownTokens: [OpenX, xOpenX], + }, +}) \ No newline at end of file diff --git a/projects/treasury/ovr.js b/projects/treasury/ovr.js new file mode 100644 index 00000000000..33f71f57f6f --- /dev/null +++ b/projects/treasury/ovr.js @@ -0,0 +1,18 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { treasuryExports, } = require("../helper/treasury"); + +const OVR = { + eth: "0x21bfbda47a0b4b5b1248c767ee49f7caa9b23697", + polygon: "0x1631244689EC1fEcbDD22fb5916E920dFC9b8D30", +}; + +const DAI = ADDRESSES.ethereum.DAI; +const IBCO = "0x8c19cF0135852BA688643F57d56Be72bB898c411"; + +module.exports = treasuryExports({ + ethereum: { + owners: [IBCO], + tokens: [DAI], + ownTokens: [OVR.eth] + }, +}); diff --git a/projects/treasury/p-network.js b/projects/treasury/p-network.js new file mode 100644 index 00000000000..ee1d1c2a4b5 --- /dev/null +++ b/projects/treasury/p-network.js @@ -0,0 +1,17 @@ +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0x015ed76723aaf0ef9960dd66631d2ecac77e4156"; +const treasury2 = "0xabfd88db78d2503af372cb9c21cdc2f181232b4f" +const treasury3 = "0xdd92eb1478d3189707ab7f4a5ace3a615cdd0476" + +const PNT = "0x89ab32156e46f46d02ade3fecbe5fc4243b9aaed" + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + ], + owners: [treasury, treasury2, treasury3], + ownTokens: [PNT], + }, +}) \ No newline at end of file diff --git a/projects/treasury/paladin-finance.js b/projects/treasury/paladin-finance.js new file mode 100644 index 00000000000..7663eb1611a --- /dev/null +++ b/projects/treasury/paladin-finance.js @@ -0,0 +1,37 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0xb95A4779CceDc53010EF0df8Bf8Ed6aEB0E8c2B2"; +const treasury1 = "0x1Ae6DCBc88d6f81A7BCFcCC7198397D776F3592E"; +const treasurypolygon = "0x6F09B0Cc885f176B06311bD085055A9275957248" + +const PAL = "0xab846fb6c81370327e784ae7cbb6d6a6af6ff4bf"; + + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.USDT, + ADDRESSES.ethereum.CRV, + ADDRESSES.ethereum.USDC, + '0xba100000625a3754423978a60c9317c58a424e3D',//BAL + ADDRESSES.ethereum.cvxCRV, + '0x6DEA81C8171D0bA574754EF6F8b412F2Ed88c54D',//LQTY + '0x41D5D79431A913C4aE7d69a668ecdfE5fF9DFB68',//INV + '0xdBdb4d16EdA451D0503b854CF79D55697F90c8DF',//ALCX + '0x73968b9a57c6E53d41345FD57a6E6ae27d6CDB2F',//SDT + '0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490',//3CRV + '0x4104b135DBC9609Fc1A9490E61369036497660c8',//APY + ADDRESSES.ethereum.LIDO, + + ], + owners: [treasury, treasury1, ], + ownTokens: [PAL], + }, + // polygon: { + // tokens: [ + // nullAddress, + // ] + // } +}) diff --git a/projects/treasury/paraswap.js b/projects/treasury/paraswap.js new file mode 100644 index 00000000000..6ea4c70f4a2 --- /dev/null +++ b/projects/treasury/paraswap.js @@ -0,0 +1,33 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0x5A61D9214adEFD7669428a03A4e8734A00E9F464"; +const treasury2 = "0x6DF5e7b236a4F14e08C27E09202B4d1865905e9b"; +const vesting1 = "0x6a3CCa09b1C2B83834124c8646a68b9Bad2a07b9"; +const vesting2 = "0x348aa814a72970e76d5756a2cdA16e7E8F245aAB"; +const vesting3 = "0xb074094d2e858b25d129989644248f9f6946e081"; +const vesting4 = "0x51d2f2c65d043118eb4329fcbc738943f494609f"; +const PARA = "0xcAfE001067cDEF266AfB7Eb5A286dCFD277f3dE5"; + + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress + ], + owners: [treasury, treasury2, vesting1, vesting2, vesting3, vesting4], + ownTokens: [PARA, "0xcb0e14e96f2cefa8550ad8e4aea344f211e5061d"], + }, + optimism: { + tokens: [ + ADDRESSES.optimism.OP + ], + owners: ["0xb8313eaf73aed8fea1d9930df199b3c1bdb67b47"], + }, + arbitrum: { + tokens: [ + ADDRESSES.arbitrum.ARB + ], + owners: ["0xfe98240ddAEDF78E278C28F1EdD690ee1a774e66"], + }, +}) \ No newline at end of file diff --git a/projects/treasury/parrot-protocol.js b/projects/treasury/parrot-protocol.js new file mode 100644 index 00000000000..3e57af2334d --- /dev/null +++ b/projects/treasury/parrot-protocol.js @@ -0,0 +1,16 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0x0B70A2653B6E7BF44A3c80683E9bD9B90489F92A"; + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.USDC,//USDC + ADDRESSES.ethereum.STETH,//stETH + ADDRESSES.ethereum.WBTC,//WBTC + ], + owners: [treasury], + }, +}) \ No newline at end of file diff --git a/projects/treasury/peardao.js b/projects/treasury/peardao.js new file mode 100644 index 00000000000..19c17a34ccb --- /dev/null +++ b/projects/treasury/peardao.js @@ -0,0 +1,20 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require('../helper/unwrapLPs') + +const BUSD_TOKEN_CONTRACT = ADDRESSES.bsc.BUSD; +const USDT_TOKEN_CONTRACT = ADDRESSES.bsc.USDT; +const USDC_TOKEN_CONTRACT = ADDRESSES.bsc.USDC; +const WBNB_TOKEN_CONTRACT = ADDRESSES.bsc.WBNB; +const BTCB_TOKEN_CONTRACT = ADDRESSES.bsc.BTCB; +const USTC_TOKEN_CONTRACT = '0x23396cF899Ca06c4472205fC903bDB4de249D6fC'; + +const TREASURY_ADDRESS = '0x263e0910C8c1B77B80CB9947B0FAC3735a6FEf4C'; +const tokens = [ + BUSD_TOKEN_CONTRACT, USDC_TOKEN_CONTRACT, USDT_TOKEN_CONTRACT, WBNB_TOKEN_CONTRACT, USTC_TOKEN_CONTRACT, BTCB_TOKEN_CONTRACT, +] + +module.exports = { + bsc: { + tvl: sumTokensExport({ chain: 'bsc', tokens, owner: TREASURY_ADDRESS, }), + } +}; \ No newline at end of file diff --git a/projects/treasury/pegasusfinance.js b/projects/treasury/pegasusfinance.js new file mode 100644 index 00000000000..a60beb31e1b --- /dev/null +++ b/projects/treasury/pegasusfinance.js @@ -0,0 +1,19 @@ +const ADDRESSES = require('../helper/coreAssets.json') + +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasuryContract = "0x680b96DDC962349f59F54FfBDe2696652669ED60"; +const WETH_OPTIMISM = ADDRESSES.tombchain.FTM; + + + +module.exports = treasuryExports({ + optimism: { + tokens: [ + nullAddress, + WETH_OPTIMISM + ], + owners: [treasuryContract], + ownTokens: [], + }, +}) diff --git a/projects/treasury/perion.js b/projects/treasury/perion.js new file mode 100644 index 00000000000..0096978069c --- /dev/null +++ b/projects/treasury/perion.js @@ -0,0 +1,23 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); +const PERC = '0x60bE1e1fE41c1370ADaF5d8e66f07Cf1C2Df2268'; +const treasuryContractsETH = [ + "0x12d73bee50f0b9e06b35fdef93e563c965796482", //Perion Treasury +]; + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.USDC, // USDC + ADDRESSES.ethereum.DAI, + '0x60bE1e1fE41c1370ADaF5d8e66f07Cf1C2Df2268', // PERC + '0x549020a9Cb845220D66d3E9c6D9F9eF61C981102', // SIDIUS + '0x34Be5b8C30eE4fDe069DC878989686aBE9884470', //SENATE + ADDRESSES.ethereum.USDT, //USDT + ADDRESSES.ethereum.STETH, //stETH + ], + owners: treasuryContractsETH, + ownTokens: [PERC], + }, +}) diff --git a/projects/treasury/perpetual-protocol.js b/projects/treasury/perpetual-protocol.js new file mode 100644 index 00000000000..720990d2d43 --- /dev/null +++ b/projects/treasury/perpetual-protocol.js @@ -0,0 +1,24 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const perpProtocolTreasury = "0xD374225abB84DCA94e121F0B8A06B93E39aD7a99"; +const PERP = "0xbC396689893D065F41bc2C6EcbeE5e0085233447"; + + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + '0x3432B6A60D23Ca0dFCa7761B7ab56459D9C964D0',//FXS + '0xca1207647Ff814039530D7d35df0e1Dd2e91Fa84',//DHT + '0x73968b9a57c6E53d41345FD57a6E6ae27d6CDB2F',//SDT + '0x1494CA1F11D487c2bBe4543E90080AeBa4BA3C2b',//DPI + ADDRESSES.ethereum.USDC,//USDC + '0xE0e05c43c097B0982Db6c9d626c4eb9e95C3b9ce',//USF + ADDRESSES.ethereum.DAI,//DAI + '0x1337DEF16F9B486fAEd0293eb623Dc8395dFE46a' //ARMOR + ], + owners: [perpProtocolTreasury], + ownTokens: [PERP], + }, +}) diff --git a/projects/treasury/piedao.js b/projects/treasury/piedao.js new file mode 100644 index 00000000000..89e21dd7039 --- /dev/null +++ b/projects/treasury/piedao.js @@ -0,0 +1,39 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const pieDaoTreasury = "0x3bCF3Db69897125Aa61496Fc8a8B55A5e3f245d5"; +const DOUGH = "0xad32A8e6220741182940c5aBF610bDE99E737b2D"; +const DOUGH_LP = "0xE8846B27988FF52c371D5BD27Bf8DBA4097C93D2" + +const treasury = "0x267070804c46a47aa92a76d59d70c05d30de46e3" + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + '0x31429d1856aD1377A8A0079410B297e1a9e214c2',//ANGLE + '0x8207c1FfC5B6804F6024322CcF34F29c3541Ae26',//OGN + ADDRESSES.ethereum.DAI,//DAI + '0xc7283b66Eb1EB5FB86327f08e1B5816b0720212B',//TRIBE + '0x090185f2135308BaD17527004364eBcC2D37e5F6',//SPELL + ADDRESSES.ethereum.SNX,//SNX + '0xdB25f211AB05b1c97D595516F45794528a807ad8',//EURS + '0xAf5191B0De278C7286d6C7CC6ab6BB8A73bA2Cd6',//STG + '0x41D5D79431A913C4aE7d69a668ecdfE5fF9DFB68',//INV + '0x6243d8CEA23066d098a15582d81a598b4e8391F4',//FLX + '0x674C6Ad92Fd080e4004b2312b45f796a192D27a0',//USDN + '0xa693B19d2931d498c5B318dF961919BB4aee87a5',//UST + '0xE80C0cd204D654CEbe8dd64A4857cAb6Be8345a3',//JPEG + '0xa3BeD4E1c75D00fa6f4E5E6922DB7261B5E9AcD2',//MTA + ADDRESSES.ethereum.GNO,//GNO + '0x01BA67AAC7f75f647D94220Cc98FB30FCc5105Bf',//LYRA + '0x03ab458634910AaD20eF5f1C8ee96F1D6ac54919',//RAI + '0x3472A5A71965499acd81997a54BBA8D852C6E53d',//BADGER + '0x3Ec8798B81485A254928B70CDA1cf0A2BB0B74D7',//GRO + ADDRESSES.ethereum.USDC,//USDC + ADDRESSES.ethereum.STETH //stETH + ], + owners: [pieDaoTreasury, treasury], + ownTokens: [DOUGH, DOUGH_LP], + }, +}) \ No newline at end of file diff --git a/projects/treasury/platypus.js b/projects/treasury/platypus.js new file mode 100644 index 00000000000..96f5b70c33a --- /dev/null +++ b/projects/treasury/platypus.js @@ -0,0 +1,34 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0x068e297e8FF74115C9E1C4b5B83B700FdA5aFdEB"; + +const tokens = [ + nullAddress, + ADDRESSES.avax.DAI, // DAI + "0x2b2C81e08f1Af8835a78Bb2A90AE924ACE0eA4bE", // sAVAX + ADDRESSES.avax.USDC, // USDC + ADDRESSES.avax.USDT_e, // USDT.e + ADDRESSES.polygon.BUSD, // BUSD + ADDRESSES.avax.BTC_b, // BTC.b + ADDRESSES.avax.USDt, // USDt + "0xF7D9281e8e363584973F946201b82ba72C965D27", // yyAVAX + ADDRESSES.avax.JOE, // JOE + "0x026187BdbC6b751003517bcb30Ac7817D5B766f8", // H2O + ADDRESSES.avax.WAVAX, // WAVAX + "0x8729438EB15e2C8B576fCc6AeCdA6A148776C0F5", // QI + "0xd9D90f882CDdD6063959A9d837B05Cb748718A05", // MORE + "0x77777777777d4554c39223C354A05825b2E8Faa3", // YETI +]; + +const ownTokens = [ + "0x22d4002028f537599bE9f666d1c4Fa138522f9c8", // PTP +]; + +module.exports = treasuryExports({ + avax: { + tokens, + owners: [treasury], + ownTokens, + }, +}); diff --git a/projects/treasury/pleasrdao.js b/projects/treasury/pleasrdao.js new file mode 100644 index 00000000000..7278d0f805b --- /dev/null +++ b/projects/treasury/pleasrdao.js @@ -0,0 +1,27 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const pleasrDaoTreasury = "0xF5c27c6fE782cbB5c85989ea3e75754748153459"; +const treasury = "0xf894fea045eccb2927e2e0cb15c12debee9f2be8" +const lp = "0xC36442b4a4522E871399CD717aBDD847Ab11FE88" + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.USDC,//USDC + '0x300a902513815028e97FC79E92082Ce6a98d3b74',//SOX + '0xbA6B0dbb2bA8dAA8F5D6817946393Aef8D3A4487',//HSF + '0xBf9e72eEb5adB8B558334c8672950B7a379D4266',//CUBT + "0xBAac2B4491727D78D2b78815144570b9f2Fe8899", + ADDRESSES.ethereum.USDT, + "0xc96F20099d96b37D7Ede66fF9E4DE59b9B1065b1", + "0x4CD0c43B0D53bc318cc5342b77EB6f124E47f526", + "0x1A4b46696b2bB4794Eb3D4c26f1c55F9170fa4C5", + ADDRESSES.ethereum.DAI + ], + owners: [pleasrDaoTreasury, treasury, lp], + resolveLP: true, + resolveUniV3: true, + }, +}) diff --git a/projects/treasury/plutusdao.js b/projects/treasury/plutusdao.js new file mode 100644 index 00000000000..f7991f1eaba --- /dev/null +++ b/projects/treasury/plutusdao.js @@ -0,0 +1,22 @@ +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0xBbE98D590d7eB99F4a236587f2441826396053d3"; + +const tokens = [ + nullAddress, + "0x10393c20975cF177a3513071bC110f7962CD67da" +]; + +const ownTokens = [ + "0x51318B7D00db7ACc4026C88c3952B66278B6A67F", // PLS + "0xD2826Cc00196d8aEe942A4a97D7987C66c17E7BB", // imxB + "0x6CC0D643C7b8709F468f58F363d73Af6e4971515", // PLS-ETH SLP +]; + +module.exports = treasuryExports({ + arbitrum: { + tokens, + owners: [treasury], + ownTokens + } +}) diff --git a/projects/treasury/pooltogether.js b/projects/treasury/pooltogether.js new file mode 100644 index 00000000000..9e219bf46f4 --- /dev/null +++ b/projects/treasury/pooltogether.js @@ -0,0 +1,69 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress } = require("../helper/treasury"); +const { + unwrapUniswapV3NFTs, + sumTokensExport, + sumTokens, +} = require("../helper/unwrapLPs"); + +const pullTreasury = "0x42cd8312D2BCe04277dD5161832460e95b24262E"; +const vesting = "0x21950E281bDE1714ffd1062ed17c56D4D8de2359"; +const optreasury = "0x8d352083F7094dc51Cd7dA8c5C0985AD6e149629"; +const polytreasury = "0x3feE50d2888F2F7106fcdC0120295EBA3ae59245"; +const POOL = "0x0cEC1A9154Ff802e7934Fc916Ed7Ca50bDE6844e"; + +const tokens = [ + nullAddress, + ADDRESSES.ethereum.USDC, //USDC + ADDRESSES.ethereum.DAI, //DAI + "0x028171bCA77440897B824Ca71D1c56caC55b68A3", //aDAI + ADDRESSES.ethereum.WETH, //WETH + ADDRESSES.ethereum.USDT, //USDT + "0xDe30da39c46104798bB5aA3fe8B9e0e1F348163F", //GTC + "0x4da27a545c0c5B758a6BA100e3a049001de870f5", //stkAAVE + "0xdd4d117723C257CEe402285D3aCF218E9A8236E1", // ptausdc + ADDRESSES.ethereum.STETH, // stETH + "0xD5f60154BEf3564EbFBe9bB236595f0da548a742", // spethwin +]; + +async function ethOwnTokens(timestamp, block) { + const balances = {}; + const tokensAndOwners = [ + [POOL, pullTreasury], + [POOL, vesting], + ]; + const nftsAndOwners = [ + ["0xC36442b4a4522E871399CD717aBDD847Ab11FE88", pullTreasury], + ]; + await sumTokens(balances, tokensAndOwners, block); + await unwrapUniswapV3NFTs({ balances, nftsAndOwners, block }); + return balances; +} + +module.exports = { + ethereum: { + tvl: sumTokensExport({ + tokens, + owners: [pullTreasury, vesting], + }), + ownTokens: ethOwnTokens, + }, + optimism: { + tvl: sumTokensExport({ + tokens: [ + nullAddress, + ADDRESSES.optimism.OP, // OP + ], + owners: [optreasury], + }), + }, + polygon: { + tvl: sumTokensExport({ + tokens: [ + nullAddress, + "0x3A58a54C066FdC0f2D55FC9C89F0415C92eBf3C4", // StMATIC + ], + owners: [polytreasury], + }), + }, +}; diff --git a/projects/treasury/premia.js b/projects/treasury/premia.js new file mode 100644 index 00000000000..c915b7a41c1 --- /dev/null +++ b/projects/treasury/premia.js @@ -0,0 +1,21 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress,treasuryExports } = require("../helper/treasury"); + +module.exports = treasuryExports({ + arbitrum: { + tokens: [ + nullAddress, + ADDRESSES.arbitrum.WBTC, // WBTC + ADDRESSES.arbitrum.USDC, // USDC + ADDRESSES.arbitrum.WETH, // WETH + ADDRESSES.arbitrum.USDT, // USDT + ADDRESSES.optimism.DAI, // DAI + '0x13ad51ed4f1b7e9dc168d8a00cb3f4ddd85efa60', // LDO + ADDRESSES.arbitrum.LINK, // LINK + '0x82e3a8f066a6989666b031d916c43672085b1582', // YEARN + ], + owners: ['0xa079c6b032133b95cf8b3d273d27eeb6b110a469'], + ownTokens: ['0x51fc0f6660482ea73330e414efd7808811a57fa2'], + resolveUniV3: true, + }, +}) \ No newline at end of file diff --git a/projects/treasury/puli.js b/projects/treasury/puli.js new file mode 100644 index 00000000000..810239d770c --- /dev/null +++ b/projects/treasury/puli.js @@ -0,0 +1,26 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport, nullAddress, } = require('../helper/unknownTokens') +// const PULI_TOKEN_STAKING_CONTRACT = '0x864d434308997e9648838d23f3eedf5d0fd17bea'; +const chain = 'bsc' +const TREASURY1 = '0xc569C21b0862B112Ed69bA9d2C6e9Ed86A036f9C' +const TREASURY2 = '0xA017862ADba59aA030b8aA0433eD91D9d909B8B1' + +module.exports = { + bsc: { + tvl: sumTokensExport({ + chain, + tokensAndOwners: [ + [nullAddress, TREASURY1], + [nullAddress, TREASURY2], + [ADDRESSES.bsc.BUSD, TREASURY1], + ['0xC17c30e98541188614dF99239cABD40280810cA3', TREASURY1], + [ADDRESSES.bsc.USDT, TREASURY1], + ['0x3FF5cbE338153063D8251d2B6a22A437EC09Eef3', TREASURY1], + ['0x3FF5cbE338153063D8251d2B6a22A437EC09Eef3', TREASURY2], + [ADDRESSES.bsc.BUSD, TREASURY2], + ['0xC17c30e98541188614dF99239cABD40280810cA3', TREASURY2], + [ADDRESSES.bsc.USDT, TREASURY2], + ], + }) + } +} diff --git a/projects/treasury/push.js b/projects/treasury/push.js new file mode 100644 index 00000000000..25aa7ebb909 --- /dev/null +++ b/projects/treasury/push.js @@ -0,0 +1,21 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0x19Ff5f2C05aC6a303aF6d5002C99686e823EBE72"; +const push = "0xf418588522d5dd018b425E472991E52EBBeEEEEE" + +module.exports = treasuryExports({ + ethereum: { + owners: [treasury], + ownTokens: [push], + tokens: [ + nullAddress, + ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.USDT, + "0xAf31Fd9C3B0350424BF96e551d2D1264d8466205", + ADDRESSES.ethereum.DAI, + ADDRESSES.ethereum.WBTC, + ADDRESSES.ethereum.SAFE, + ], + }, +}); \ No newline at end of file diff --git a/projects/treasury/qidao.js b/projects/treasury/qidao.js new file mode 100644 index 00000000000..09fbde3d486 --- /dev/null +++ b/projects/treasury/qidao.js @@ -0,0 +1,12 @@ +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0xf32e759d5f1c63ed62042497d3a50f044ee0982b"; + +module.exports = treasuryExports({ + arbitrum: { + tokens: [ + nullAddress, + ], + owners: [treasury], + }, +}) \ No newline at end of file diff --git a/projects/treasury/radiant.js b/projects/treasury/radiant.js new file mode 100644 index 00000000000..016b738bff6 --- /dev/null +++ b/projects/treasury/radiant.js @@ -0,0 +1,15 @@ +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0x750129c21c7846cfe0ce2c966d84c0bca5658497"; + +module.exports = treasuryExports({ + arbitrum: { + owners: [treasury, ], + ownTokens: [ + '0x3082cc23568ea640225c2467653db90e9250aaa0', //RDNT + ], + tokens: [ + nullAddress, + ], + }, +}); \ No newline at end of file diff --git a/projects/treasury/railgun.js b/projects/treasury/railgun.js new file mode 100644 index 00000000000..f303f476c7f --- /dev/null +++ b/projects/treasury/railgun.js @@ -0,0 +1,128 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { tokens } = require("../helper/chain/algorand"); +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +// Treasury +const ethTreasury = "0xE8A8B458BcD1Ececc6b6b58F80929b29cCecFF40"; +const bscTreasury = "0xdca05161eE5b5FA6DF170191c88857E70FFB4094"; +const polygonTreasury = "0xdca05161eE5b5FA6DF170191c88857E70FFB4094"; +const arbitrumTreasury = "0x3B374464a714525498e445ba050B91571937bFc8" +//ownTokens +const ethRAIL = "0xe76c6c83af64e4c60245d8c7de953df673a7a33d"; +const polygonRAIL = "0x92A9C92C215092720C731c96D4Ff508c831a714f";// not on coingecko + + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + // Ethereum Assets + nullAddress, + ADDRESSES.ethereum.WETH, + "0x295B42684F90c77DA7ea46336001010F2791Ec8c",//xi + ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.USDT, + ADDRESSES.ethereum.DAI, + "0x3432B6A60D23Ca0dFCa7761B7ab56459D9C964D0",//fxs + ADDRESSES.ethereum.WSTETH, + ADDRESSES.ethereum.CVX, + "0xEB4C2781e4ebA804CE9a9803C67d0893436bB27D",//renbtc + ADDRESSES.ethereum.cvxCRV, + "0x3432B6A60D23Ca0dFCa7761B7ab56459D9C964D0",//wbtc + "0x99D8a9C45b2ecA8864373A26D1459e3Dff1e17F3",//mim + ADDRESSES.ethereum.LUSD, + "0x090185f2135308BaD17527004364eBcC2D37e5F6",//spell + ADDRESSES.ethereum.BUSD, + "0x00a8b738E453fFd858a7edf03bcCfe20412f0Eb0",//albt + ADDRESSES.ethereum.SNX, + "0x509A38b7a1cC0dcd83Aa9d06214663D9eC7c7F4a",//bst + ADDRESSES.ethereum.INU, + ADDRESSES.ethereum.LINK, + "0x21381e026Ad6d8266244f2A583b35F9E4413FA2a",//form + ADDRESSES.ethereum.TOKE, + "0x767FE9EDC9E0dF98E07454847909b5E959D7ca0E",//ilv + ADDRESSES.ethereum.MKR, + "0xc5fb36dd2fb59d3b98deff88425a3f425ee469ed",//tsuka + ADDRESSES.ethereum.FRAX, + "0x2223bF1D7c19EF7C06DAB88938EC7B85952cCd89",//kxa + "0x0f2d719407fdbeff09d87557abb7232601fd9f29",//syn + "0x7aE1D57b58fA6411F32948314BadD83583eE0e8C",//paper + "0xf65B5C5104c4faFD4b709d9D60a185eAE063276c",//tru + "0x3597bfd533a99c9aa083587b074434e61eb0a258",//dent + "0xcc8fa225d80b9c7d42f96e9570156c65d6caaa25",//slp + ADDRESSES.ethereum.UNI, + ADDRESSES.ethereum.MATIC, + "0x9aE380F0272E2162340a5bB646c354271c0F5cFC",//cnc + "0x07bac35846e5ed502aa91adf6a9e7aa210f2dcbe",//erowan + "0xfb7b4564402e5500db5bb6d63ae671302777c75a",//dext + "0x33349b282065b0284d756f0577fb39c158f935e6",//mpl + "0x1f573d6fb3f13d689ff844b4ce37794d79a7ff1c",//bnt + "0xBC19712FEB3a26080eBf6f2F7849b417FdD792CA",//boring + "0x34F7Da1243A4Aaa69DE3639a2f124Fa56f4DD5cd",//tess + ], + owners: [ethTreasury], + ownTokens: [ethRAIL] + }, + bsc: { + tokens: [ + // bsc Assets + nullAddress, + ADDRESSES.bsc.WBNB, + ADDRESSES.bsc.BUSD, + "0x1AF3F329e8BE154074D8769D1FFa4eE058B1DBc3",//dai + ADDRESSES.bsc.USDT, + "0x39cC67690D0F2d4aCD68d3d9B612a80D780b84c0",//agro + "0xbF7c81FFF98BbE61B40Ed186e4AfD6DDd01337fe",//egld + ADDRESSES.bsc.USDC, + "0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82",//cake + "0xAdBAF88B39D37Dc68775eD1541F1bf83A5A45feB",//coti + "0xBfACD29427fF376FF3BC22dfFB29866277cA5Fb4",//pstn + "0x9A2f5556e9A637e8fBcE886d8e3cf8b316a1D8a2",//bidr + "0xC9849E6fdB743d08fAeE3E34dd2D1bc69EA11a51",//bunny + ], + owners: [bscTreasury], + ownTokens: [] + }, + polygon: { + tokens: [ + // polygon Assets + nullAddress, + ADDRESSES.polygon.WETH_1, + ADDRESSES.polygon.USDC, + ADDRESSES.polygon.USDT, + ADDRESSES.polygon.DAI, + "0x1a3acf6D19267E2d3e7f898f42803e90C9219062",//fxs + ADDRESSES.polygon.WBTC, + "0xE5417Af564e4bFDA1c483642db72007871397896",//gns + "0x2C89bbc92BD86F8075d1DEcc58C7F4E0107f286b",//avax + "0x53E0bca35eC356BD5ddDFebbD1Fc0fD03FaBad39",//link + "0xfe712251173A2cd5F5bE2B46Bb528328EA3565E1",//mvi + ADDRESSES.polygon.WMATIC_2, + "0x752d59604d72b6DC44196f4A39A3f07779417407",//methmoon + "0x8f006D1e1D9dC6C98996F50a4c810F17a47fBF19",//nsfw + ADDRESSES.fantom.renBTC, + "0x9c891326Fd8b1a713974f73bb604677E1E63396D",//islami + "0x45c32fA6DF82ead1e2EF74d17b76547EDdFaFF89",//frax + "0xB0B195aEFA3650A6908f15CdaC7D92F8a5791B0B",//bob + "0x580A84C73811E1839F75d86d75d88cCa0c241fF4",//qi + "0x980111ae1B84E50222C8843e3A7a038F36Fecd2b",//stack + ADDRESSES.polygon.QUICK, + "0x6C0AB120dBd11BA701AFF6748568311668F63FE0",//apw + "0xE0339c80fFDE91F3e20494Df88d4206D86024cdF",//elon + ], + owners: [polygonTreasury], + ownTokens: [polygonRAIL] + }, + arbitrum: { + tokens: [ + // arbitrum assets + nullAddress, + ADDRESSES.arbitrum.WETH, + ADDRESSES.arbitrum.WBTC, + ADDRESSES.arbitrum.USDT, + ADDRESSES.arbitrum.USDC + ], + owners: [arbitrumTreasury], + ownTokens: [] + }, +}) + diff --git a/projects/treasury/rarible.js b/projects/treasury/rarible.js new file mode 100644 index 00000000000..c1cc92f36ef --- /dev/null +++ b/projects/treasury/rarible.js @@ -0,0 +1,23 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress,treasuryExports } = require("../helper/treasury"); + +const rarTreasury = "0xFDfF6b56CcE39482032b27140252FF4F16432785"; +const rarTreasury1 = "0x1cf0dF2A5A20Cd61d68d4489eEBbf85b8d39e18a"; + +const RARI = "0xFca59Cd816aB1eaD66534D82bc21E7515cE441CF"; + + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.USDC,//USDC + ADDRESSES.ethereum.DAI,//DAI + '0x028171bCA77440897B824Ca71D1c56caC55b68A3',//aDAI + ADDRESSES.ethereum.WETH,//WETH + ADDRESSES.ethereum.USDT,//USDT + ], + owners: [rarTreasury, rarTreasury1], + ownTokens: [RARI], + }, +}) \ No newline at end of file diff --git a/projects/treasury/redacted.js b/projects/treasury/redacted.js new file mode 100644 index 00000000000..0dcf99dcbd1 --- /dev/null +++ b/projects/treasury/redacted.js @@ -0,0 +1,52 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0x086c98855df3c78c6b481b6e1d47bef42e9ac36b" +const treasury2 = "0xa52fd396891e7a74b641a2cb1a6999fcf56b077e" +const treasury3 = "0x42e39157ec770197013e619c0eea8e1139f332db" +const treasury4 = "0xa722ebccd25adb06e5d0190b240d1f4039839822" +const treasury5OP = "0x2e33a660742e813ad948fb9f7d682fe461e5fbf3" +const treasury6ARB = "0x64769c53ff91b83fe9830776a4b85a1f4e1edaad" +const BTRF = "0xc55126051B22eBb829D00368f4B12Bde432de5Da" + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.USDT, + "0x2ba592F78dB6436527729929AAf6c908497cB200", // CREAM + ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.SAFE, + "0xaa0C3f5F7DFD688C6E646F66CD2a6B66ACdbE434", + ADDRESSES.ethereum.DAI, + "0xaCe78D9BaB82b6B4783120Dba82aa10B040A14D9", + "0xBCe0Cf87F513102F22232436CCa2ca49e815C3aC", + ADDRESSES.ethereum.CRV, + ], + ownTokens: [BTRF], + owners: [treasury, treasury2,treasury3,treasury4], + }, + optimism: { + tokens: [ + nullAddress, + ADDRESSES.optimism.OP, + "0xaf9fe3b5ccdae78188b1f8b9a49da7ae9510f151", // DHT + ADDRESSES.optimism.USDC, + "0x3f56e0c36d275367b8c502090edf38289b3dea0d", // QI + "0x97513e975a7fa9072c72c92d8000b0db90b163c5", //BEETS + "0x39fde572a18448f8139b7788099f0a0740f51205", //OATH + "0x00a35fd824c717879bf370e70ac6868b95870dfb", //IB + "0x3c8b650257cfb5f272f799f5e2b4e65093a11a05", //VELO + ], + owners: [treasury5OP], + }, + arbitrum: { + tokens: [ + nullAddress, + ADDRESSES.arbitrum.WETH, + ADDRESSES.arbitrum.USDC, + "0x10393c20975cf177a3513071bc110f7962cd67da", // JONES + ], + owners: [treasury6ARB], + }, +}); \ No newline at end of file diff --git a/projects/treasury/relay.js b/projects/treasury/relay.js new file mode 100644 index 00000000000..41c93ce3605 --- /dev/null +++ b/projects/treasury/relay.js @@ -0,0 +1,12 @@ +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0xf803dce584b7ecb57f90af0b85e67dac7e0da6d9"; + +module.exports = treasuryExports({ + arbitrum: { + tokens: [ + nullAddress, + ], + owners: [treasury,], + }, +}) \ No newline at end of file diff --git a/projects/treasury/revoke.js b/projects/treasury/revoke.js new file mode 100644 index 00000000000..1fae8c0fcc9 --- /dev/null +++ b/projects/treasury/revoke.js @@ -0,0 +1,83 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0xe126b3E5d052f1F575828f61fEBA4f4f2603652a" // + +module.exports = treasuryExports({ + optimism: { + tokens: [ + nullAddress, + ADDRESSES.optimism.DAI, + ADDRESSES.optimism.WETH, + ADDRESSES.optimism.USDT, + ADDRESSES.optimism.USDC, + "0x8700dAec35aF8Ff88c16BdF0418774CB3D7599B4", //snx + ], + owners: [treasury], + }, + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.USDC, + "0xC18360217D8F7Ab5e7c516566761Ea12Ce7F9D72", //ens + "0xDd1Ad9A21Ce722C151A836373baBe42c868cE9a4", //ubi + "0x7aE1D57b58fA6411F32948314BadD83583eE0e8C", //paper + "0xb24cd494faE4C180A89975F1328Eab2a7D5d8f11", //code + "0x6243d8CEA23066d098a15582d81a598b4e8391F4", //flx + "0xc4De189Abf94c57f396bD4c52ab13b954FebEfD8", //b20 + "0xad32A8e6220741182940c5aBF610bDE99E737b2D", //dough + "0x90DE74265a416e1393A450752175AED98fe11517", //udt + "0x6fB3e0A217407EFFf7Ca062D46c26E5d60a14d69", //iotx + "0x5dD57Da40e6866C9FcC34F4b6DDC89F1BA740DfE", //bright + "0xc770EEfAd204B5180dF6a14Ee197D99d808ee52d", //fox + "0xdBdb4d16EdA451D0503b854CF79D55697F90c8DF", //alcx + "0x4F14cDBd815B79E9624121f564f24685c6B1211b", //anfd + "0xE41d2489571d322189246DaFA5ebDe1F4699F498", //zrx + "0x7b35Ce522CB72e4077BaeB96Cb923A5529764a00", //imx + ], + owners: [treasury], + }, + bsc: { + tokens: [ + nullAddress, + "0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56", //busd + "0xF68C9Df95a18B2A5a5fa1124d79EEEffBaD0B6Fa", //any + ], + owners: [treasury], + }, + polygon: { + tokens: [ + nullAddress, + "0xc2132D05D31c914a87C6611C10748AEb04B58e8F", //usdt + "0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063", //dai + "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174", //usdc + "0x8dF3aad3a84da6b69A4DA8aeC3eA40d9091B2Ac4", //ammatic + ], + owners: [treasury], + }, + arbitrum: { + tokens: [ + nullAddress, + "0x912CE59144191C1204E64559FE8253a0e49E6548", //arb + "0x539bdE0d7Dbd336b79148AA742883198BBF60342", //magic + "0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8", //usdc + "0x1F52145666C862eD3E2f1Da213d479E61b2892af", //fuc + ], + owners: [treasury], + }, + arbitrum_nova: { + tokens: [ + nullAddress, + "0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1", //dai + ], + owners: [treasury], + }, + xdai: { + tokens: [ + nullAddress, + "0x71850b7E9Ee3f13Ab46d67167341E4bDc905Eef9", //hny + ], + owners: [treasury], + }, + +}) \ No newline at end of file diff --git a/projects/treasury/revoluzion.js b/projects/treasury/revoluzion.js new file mode 100644 index 00000000000..dc8b4b0ef4d --- /dev/null +++ b/projects/treasury/revoluzion.js @@ -0,0 +1,17 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport, } = require('../helper/unknownTokens') +const REVOLUZION_TOKEN_CONTRACT = '0x7D89c67d3c4E72E8c5c64BE201dC225F99d16aCa'; +const REVOLUZION_DIAMOND_HAND_CONTRACT = '0xA72a15369Fe9840a20c40F18b1695eF168fFFa77'; +const REVOLUZION_DIVIDEND_CONTRACT = '0x23259212B5CD09A511440b9DD472d339C716dEb5'; +const BUSD = ADDRESSES.bsc.BUSD + +module.exports = { + bsc: { + tvl: sumTokensExport({ + tokensAndOwners: [ + [BUSD, REVOLUZION_DIAMOND_HAND_CONTRACT], + [BUSD, REVOLUZION_DIVIDEND_CONTRACT], + ], + }) + } +} diff --git a/projects/treasury/ribbon.js b/projects/treasury/ribbon.js new file mode 100644 index 00000000000..899bc9c364f --- /dev/null +++ b/projects/treasury/ribbon.js @@ -0,0 +1,36 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +// Treasury +const treasury = "0xDAEada3d210D2f45874724BeEa03C7d4BBD41674"; +const treasury2 = "0x42c1357aaa3243ea30c713cdfed115d09f10a71d" +const treasury3 = "0x6adeb4fddb63f08e03d6f5b9f653be8b65341b35" +const RBN = "0x6123B0049F904d730dB3C36a31167D9d4121fA6B"; + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + // Ethereum Assets + nullAddress, + ADDRESSES.ethereum.WSTETH, + ADDRESSES.ethereum.LIDO, + ADDRESSES.ethereum.WETH, + ADDRESSES.ethereum.WBTC, + ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.RETH, + ADDRESSES.ethereum.STETH, + "0xba100000625a3754423978a60c9317c58a424e3D", // BAL + "0x4d224452801ACEd8B2F0aebE155379bb5D594381", // APE + "0x090185f2135308BaD17527004364eBcC2D37e5F6", // SPELL + ADDRESSES.ethereum.UNI, + ADDRESSES.ethereum.SAFE, + "0xa354F35829Ae975e850e23e9615b11Da1B3dC4DE", // yvUSDC + "0x25751853Eab4D0eB3652B5eB6ecB102A2789644B", // rETH-THETA + ], + owners: [treasury, treasury2, treasury3], + ownTokens: [ + RBN, + "0xd590931466cdD6d488A25da1E89dD0539723800c", // 50RBN-50USDC + ], + }, +}); diff --git a/projects/treasury/rotki.js b/projects/treasury/rotki.js new file mode 100644 index 00000000000..3420dd3cda8 --- /dev/null +++ b/projects/treasury/rotki.js @@ -0,0 +1,42 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0x9531C059098e3d194fF87FebB587aB07B30B1306"; + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.USDC, // USDC + ADDRESSES.ethereum.USDT, + ADDRESSES.ethereum.DAI, + "0xC18360217D8F7Ab5e7c516566761Ea12Ce7F9D72", + "0x8290333ceF9e6D528dD5618Fb97a76f268f3EDD4", + "0xc5102fE9359FD9a28f877a67E36B0F050d81a3CC", + ADDRESSES.ethereum.sUSD, + ADDRESSES.ethereum.MKR + ], + owners: [treasury], + ownTokens: [], + }, + optimism: { + tokens: [ + nullAddress, + ADDRESSES.optimism.USDC, + ADDRESSES.optimism.USDT, + ADDRESSES.optimism.OP + ], + owners: [treasury] + }, + arbitrum: { + tokens: [ + nullAddress, + ADDRESSES.arbitrum.USDC, + ADDRESSES.arbitrum.USDT, + ADDRESSES.arbitrum.ARB, + ADDRESSES.arbitrum.DAI, + ADDRESSES.arbitrum.WETH + ], + owners: [treasury] + }, +}); \ No newline at end of file diff --git a/projects/treasury/router.js b/projects/treasury/router.js new file mode 100644 index 00000000000..ad39b2f0636 --- /dev/null +++ b/projects/treasury/router.js @@ -0,0 +1,12 @@ +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0xdb8f4c4c68e5e5eb501fee1adaa87ee767bcade7"; + +module.exports = treasuryExports({ + arbitrum: { + tokens: [ + nullAddress, + ], + owners: [treasury,], + }, +}) \ No newline at end of file diff --git a/projects/treasury/saddle.js b/projects/treasury/saddle.js new file mode 100644 index 00000000000..21e629170a4 --- /dev/null +++ b/projects/treasury/saddle.js @@ -0,0 +1,15 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress,treasuryExports } = require("../helper/treasury"); + +module.exports = treasuryExports({ + arbitrum: { + tokens: [ + '0x5575552988a3a80504bbaeb1311674fcfd40ad4b', + '0x2cab3abfc1670d1a452df502e216a66883cdf079', + '0x17fc002b466eec40dae837fc4be5c67993ddbd6f', + ADDRESSES.arbitrum.USDC, + ], + owners: ['0x8e6e84ddab9d13a17806d34b097102605454d147'], + ownTokens: [], + }, +}) \ No newline at end of file diff --git a/projects/treasury/safe.js b/projects/treasury/safe.js new file mode 100644 index 00000000000..f86dddf3eb6 --- /dev/null +++ b/projects/treasury/safe.js @@ -0,0 +1,15 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress,treasuryExports } = require("../helper/treasury"); + +const treasury = "0x3EDf6868d7c42863E44072DaEcC16eCA2804Dea1" // + +module.exports = treasuryExports({ + optimism: { + tokens: [ + nullAddress, + ADDRESSES.optimism.OP, + ], + owners: [treasury], + }, + +}) \ No newline at end of file diff --git a/projects/treasury/sakai-vault.js b/projects/treasury/sakai-vault.js new file mode 100644 index 00000000000..a2645697341 --- /dev/null +++ b/projects/treasury/sakai-vault.js @@ -0,0 +1,17 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const Treasury = "0x6b269c07e8f94f0fa1769cbd362879afea0206db"; +const SAKAI = "0x43B35e89d15B91162Dea1C51133C4c93bdd1C4aF"; + + +module.exports = treasuryExports({ + bsc: { + tokens: [ + nullAddress, + ADDRESSES.bsc.USDT + ], + owners: [Treasury], + ownTokens: [SAKAI], + }, +}) \ No newline at end of file diff --git a/projects/treasury/savvy.js b/projects/treasury/savvy.js new file mode 100644 index 00000000000..2ce17b21a62 --- /dev/null +++ b/projects/treasury/savvy.js @@ -0,0 +1,18 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0x4f54cab19b61138e3c622a0bd671c687481ec030"; +const SVY = "0x43aB8f7d2A8Dd4102cCEA6b438F6d747b1B9F034" +module.exports = treasuryExports({ + arbitrum: { + tokens: [ + nullAddress, + ADDRESSES.arbitrum.USDC, + ADDRESSES.arbitrum.WBTC, + ADDRESSES.arbitrum.WETH, + ADDRESSES.arbitrum.USDC_CIRCLE + ], + owners: [treasury,], + ownTokens: [SVY], + }, +}) \ No newline at end of file diff --git a/projects/treasury/shapeshift.js b/projects/treasury/shapeshift.js new file mode 100644 index 00000000000..2ae2fc6b4e0 --- /dev/null +++ b/projects/treasury/shapeshift.js @@ -0,0 +1,26 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress,treasuryExports } = require("../helper/treasury"); + +const shaTreasury = "0x90A48D5CF7343B08dA12E067680B4C6dbfE551Be"; + +const LP = "0x470e8de2eBaef52014A47Cb5E6aF86884947F08c" +const FOX = "0xc770EEfAd204B5180dF6a14Ee197D99d808ee52d"; +const tFOX = "0x808D3E6b23516967ceAE4f17a5F9038383ED5311" + + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.USDC,//USDC + ADDRESSES.ethereum.DAI,//DAI + ADDRESSES.ethereum.LUSD,//LUSD + ADDRESSES.ethereum.WETH,//WETH + ADDRESSES.ethereum.USDT,//USDT + '0x6f80310CA7F2C654691D1383149Fa1A57d8AB1f8',//SILO + ADDRESSES.ethereum.TOKE,//TOKE + ], + owners: [shaTreasury], + ownTokens: [FOX, LP, tFOX], + }, +}) \ No newline at end of file diff --git a/projects/treasury/shibui.js b/projects/treasury/shibui.js new file mode 100644 index 00000000000..851bc8f5d46 --- /dev/null +++ b/projects/treasury/shibui.js @@ -0,0 +1,61 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); + +const CHAINS = ["boba"]; + +const Boba_SHIBUI = "0xf08ad7c3f6b1c6843ba027ad54ed8ddb6d71169b"; + +const Boba_BOBA = ADDRESSES.boba.BOBA; +const Boba_USDT = ADDRESSES.boba.USDT; +const Boba_SHIBUI_WETH = "0xcE9F38532B3d1e00a88e1f3347601dBC632E7a82"; +const Boba_SHIBUI_USDT = "0x3f714fe1380ee2204ca499d1d8a171cbdfc39eaa"; +const Boba_4Koyo = "0xDAb3Fc342A242AdD09504bea790f9b026Aa1e709"; + +const CHAIN_ORGANISED_DATA = { + boba: () => { + + return [ + { + treasuryTokens: [ + [Boba_BOBA, false], + [Boba_USDT, false], + [Boba_SHIBUI_WETH, true], + [Boba_SHIBUI_USDT, true], + ], + treasuryKoyoTokens: [Boba_4Koyo], + treasuryAddresses: [ + "0x9596E01Ad72d2B0fF13fe473cfcc48D3e4BB0f70", // Hot treasury + ], + gaugeTokens: [Boba_SHIBUI_USDT], + gaugeAddresses: [ + "0x6b8f4Fa6E44e923f5A995A87e4d79B3Bb9f8aaa3", // SHIBUI-USDT<>WAGMIv3 + ], + }, + true, + ]; + }, +}; + +module.exports = { + start: 394825, + + boba: { + tvl: async (timestamp, _ethBlock, chainBlocks) => { + const chain = CHAINS[0]; + const [data, koyoAssets] = CHAIN_ORGANISED_DATA[chain](); + + const balances = {}; + const block = chainBlocks[chain]; + + await sumTokensAndLPsSharedOwners( + balances, + data.treasuryTokens, + data.treasuryAddresses, + block, + chain + ); + + return balances; + }, + }, +} diff --git a/projects/treasury/silo-finance.js b/projects/treasury/silo-finance.js new file mode 100644 index 00000000000..61f3cabaa3f --- /dev/null +++ b/projects/treasury/silo-finance.js @@ -0,0 +1,25 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { simulateTransaction } = require("@project-serum/anchor/dist/cjs/utils/rpc"); +const { nullAddress,treasuryExports } = require("../helper/treasury"); + +const treasury = "0xdff2aea378e41632e45306a6de26a7e0fd93ab07"; +const treasury2 = "0xe1f03b7b0ebf84e9b9f62a1db40f1efb8faa7d22" + +const SILO = "0x6f80310CA7F2C654691D1383149Fa1A57d8AB1f8" + + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.USDC,//USDC + ADDRESSES.ethereum.DAI,//DAI + ADDRESSES.ethereum.LUSD,//LUSD + ADDRESSES.ethereum.WETH,//WETH + ADDRESSES.ethereum.USDT,//USDT + ADDRESSES.ethereum.TOKE,//TOKE + ], + owners: [treasury, treasury2], + ownTokens: [SILO], + }, +}) \ No newline at end of file diff --git a/projects/treasury/snapshot.js b/projects/treasury/snapshot.js new file mode 100644 index 00000000000..8b51b040029 --- /dev/null +++ b/projects/treasury/snapshot.js @@ -0,0 +1,16 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0x3E87e5BCE4dEb09FeE5045EF15E18f873212E6A7"; + +module.exports = treasuryExports({ + optimism: { + tokens: [ + nullAddress, + ADDRESSES.optimism.USDC, // USDC + ADDRESSES.optimism.OP, + ], + owners: [treasury], + ownTokens: [], + }, +}); \ No newline at end of file diff --git a/projects/treasury/spartacus.js b/projects/treasury/spartacus.js new file mode 100644 index 00000000000..b81b51ec622 --- /dev/null +++ b/projects/treasury/spartacus.js @@ -0,0 +1,19 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress,treasuryExports } = require("../helper/treasury"); + +const sparTreasury1 = "0x8CFA87aD11e69E071c40D58d2d1a01F862aE01a8"; + +const SPA = "0x5602df4a94eb6c680190accfa2a475621e0ddbdc"; + + +module.exports = treasuryExports({ + fantom: { + tokens: [ + nullAddress, + ADDRESSES.fantom.DAI,//DAI + ADDRESSES.fantom.WFTM,//WFTM + ], + owners: [sparTreasury1], + ownTokens: [SPA], + }, +}) \ No newline at end of file diff --git a/projects/treasury/sperax.js b/projects/treasury/sperax.js new file mode 100644 index 00000000000..94df3b01e2c --- /dev/null +++ b/projects/treasury/sperax.js @@ -0,0 +1,11 @@ +const { nullAddress,treasuryExports } = require("../helper/treasury"); + +module.exports = treasuryExports({ + arbitrum: { + tokens: [ + nullAddress, + ], + owners: ['0x8898a38eb8e3104f7c98622b55260e014b3a0217'], + ownTokens: [], + }, +}) \ No newline at end of file diff --git a/projects/treasury/sphere-finance.js b/projects/treasury/sphere-finance.js new file mode 100644 index 00000000000..90f11a4e5f6 --- /dev/null +++ b/projects/treasury/sphere-finance.js @@ -0,0 +1,63 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress,treasuryExports } = require("../helper/treasury"); + +const investment_treasury_polygon = "0x20d61737f972eecb0af5f0a85ab358cd083dd56a" +const liquid_pool_treasury_polygon = "0x1a2ce410a034424b784d4b228f167a061b94cff4" +const rfv_treasury = "0x826b8d2d523e7af40888754e3de64348c00b99f4" +const treasuryBSC = "0x124e8498a25eb6407c616188632d40d80f8e50b0" +const treasuryARB ="0xA6efac6a6715CcCE780f8D9E7ea174C4d85dbE02" +const treasuryOP = "0x93b0a33911de79b897eb0439f223935af5a60c24" +const treasuryCH = "0x74b514bc1b9480e1daca0f83a1e42b86291eadef" +const multisig = "0x79e51953f023df68fc46170d1ee47fd5a49d3b6e" + +module.exports = treasuryExports({ + polygon: { + tokens: [ + nullAddress, + ADDRESSES.polygon.WMATIC_1, + "0x236eeC6359fb44CCe8f97E99387aa7F8cd5cdE1f", + ADDRESSES.polygon.WETH_1, + ADDRESSES.polygon.WMATIC, + ADDRESSES.polygon.USDC + + ], + owners: [investment_treasury_polygon, liquid_pool_treasury_polygon, rfv_treasury, treasuryCH, multisig], + ownTokens: ["0x17e9C5b37283ac5fBE527011CeC257b832f03eb3", "0x8D546026012bF75073d8A586f24A5d5ff75b9716"], + }, + bsc: { + tokens: [ + nullAddress, + "0xe80772Eaf6e2E18B651F160Bc9158b2A5caFCA65", + "0x52F24a5e03aee338Da5fd9Df68D2b6FAe1178827", + ADDRESSES.bsc.BUSD, + "0xF4C8E32EaDEC4BFe97E0F595AdD0f4450a863a11" + ], + owners: [treasuryBSC], + ownTokens: [], + }, + arbitrum: { + tokens: [ + nullAddress, + "0xe80772Eaf6e2E18B651F160Bc9158b2A5caFCA65", + ADDRESSES.arbitrum.USDC, + ADDRESSES.arbitrum.USDT, + ADDRESSES.arbitrum.GMX, + ADDRESSES.arbitrum.WBTC, + "0x15b2fb8f08E4Ac1Ce019EADAe02eE92AeDF06851", + "0xC36442b4a4522E871399CD717aBDD847Ab11FE88" + ], + owners: [treasuryARB], + ownTokens: [], + resolveUniV3: true, + }, + optimism: { + tokens: [ + nullAddress, + ADDRESSES.optimism.OP, + ADDRESSES.optimism.USDC, + "0x73cb180bf0521828d8849bc8CF2B920918e23032" + ], + owners: [treasuryOP], + ownTokens: [], + }, +}) \ No newline at end of file diff --git a/projects/treasury/spherium.js b/projects/treasury/spherium.js new file mode 100644 index 00000000000..a347f04b2b0 --- /dev/null +++ b/projects/treasury/spherium.js @@ -0,0 +1,12 @@ +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0x2c41fb81cfc64cd1373058f2a13289819641d223"; + +module.exports = treasuryExports({ + arbitrum: { + tokens: [ + nullAddress, + ], + owners: [treasury,], + }, +}) \ No newline at end of file diff --git a/projects/treasury/spiral-dao.js b/projects/treasury/spiral-dao.js new file mode 100644 index 00000000000..06d3ccc42f3 --- /dev/null +++ b/projects/treasury/spiral-dao.js @@ -0,0 +1,44 @@ +const sdk = require('@defillama/sdk') +const utils = require('../helper/utils'); +const { ethers } = require("ethers"); +const ADDRESSES = require('../helper/coreAssets.json') +const { USDC } = ADDRESSES.ethereum + + +// treasury address: 0xc47ec74a753acb09e4679979afc428cde0209639 +async function tvl(_, _1, _2, { api }) { + let balances = {}; + + const toWei = async(address, balance) => { + if (!+balance > 0) return; + const decimals = await api.call({ + abi: 'erc20:decimals', + target: address, + }) + return ethers.utils.parseUnits((balance >> 0).toString(), decimals).toString() + } + + const response = await utils.fetchURL('https://api.spiral.farm/data/eth/treasury'); + if (response.data.success) { + for (let [address, info] of Object.entries(response.data.tokens)){ + if (address === 'eth'){ + await sdk.util.sumSingleBalance(balances, 'ethereum', info.totalAmount) + } else { + await sdk.util.sumSingleBalance(balances, address, await toWei(address, info.totalAmount)) + } + + } + await sdk.util.sumSingleBalance(balances, USDC, + await toWei(USDC, response.data.extraUsdValues.tokenRedeemContractUsdcBalance)) + await sdk.util.sumSingleBalance(balances, USDC, response.data.extraUsdValues.bribes) + } + + return balances; +} + +module.exports = { + timetravel: false, + ethereum: { + tvl + } +} \ No newline at end of file diff --git a/projects/treasury/spookyswap.js b/projects/treasury/spookyswap.js new file mode 100644 index 00000000000..3df62f4649f --- /dev/null +++ b/projects/treasury/spookyswap.js @@ -0,0 +1,19 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { treasuryExports, nullAddress } = require("../helper/treasury"); + +const multisig = "0x1A11f5DF739bEca4974aCE4d8E5CE5ef5D854889"; + +module.exports = treasuryExports({ + fantom: { + tokens: [ + nullAddress, + ADDRESSES.fantom.DAI, // DAI + "0x74b23882a30290451A17c44f4F05243b6b58C76d", // ETH + "0xF24Bcf4d1e507740041C9cFd2DddB29585aDCe1e", // BEETS + ADDRESSES.fantom.WFTM, // WFTM + ADDRESSES.fantom.USDC, // USDC + ], + owners: [multisig], + ownTokens: ["0x841FAD6EAe12c286d1Fd18d1d525DFfA75C7EFFE"], + }, +}); diff --git a/projects/treasury/spool-protocol.js b/projects/treasury/spool-protocol.js new file mode 100644 index 00000000000..3fede6fcf47 --- /dev/null +++ b/projects/treasury/spool-protocol.js @@ -0,0 +1,19 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { treasuryExports, nullAddress } = require("../helper/treasury"); + +const treasury = "0xf6bc2e3b1f939c435d9769d078a6e5048aabd463"; +const SPOOL = "0x40803cEA2b2A32BdA1bE61d3604af6a814E70976" +const LP = "0xF3b675df63FB4889180d290A338fc15C0766fd64" + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.DAI, + ADDRESSES.ethereum.USDC + + ], + owners: [treasury], + ownTokens: [SPOOL, LP], + }, +}); diff --git a/projects/treasury/stakedao.js b/projects/treasury/stakedao.js new file mode 100644 index 00000000000..c091f6d25d5 --- /dev/null +++ b/projects/treasury/stakedao.js @@ -0,0 +1,113 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { treasuryExports, nullAddress } = require("../helper/treasury"); + +const eth = "0xF930EBBd05eF8b25B1797b9b2109DDC9B0d43063"; +const poly = "0xdA2D2f638D6fcbE306236583845e5822554c02EA"; +const avax = "0x69D6C2ACb2485D629E184BC4E1DD972D8DDD8669"; +const arbitrumTreasury = "0xfdb1157ac847d334b8912df1cd24a93ee22ff3d0" + +const ethTokens = [ + nullAddress, + ADDRESSES.ethereum.USDC, + "0x31429d1856aD1377A8A0079410B297e1a9e214c2", // ANGLE + ADDRESSES.ethereum.CRV, + "0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490", // 3CRV + "0xc2544A32872A91F4A553b404C6950e89De901fdb", // FPIS + "0xba100000625a3754423978a60c9317c58a424e3D", // BAL + "0xdBdb4d16EdA451D0503b854CF79D55697F90c8DF", // ALCX + ADDRESSES.ethereum.WETH, + "0x65Ef703f5594D2573eb71Aaf55BC0CB548492df4", // MULTI + "0x1a7e4e63778B4f12a199C062f3eFdD288afCBce8", // agEUR + "0xcAfE001067cDEF266AfB7Eb5A286dCFD277f3dE5", // PSP + "0x4104b135DBC9609Fc1A9490E61369036497660c8", // APW + ADDRESSES.ethereum.LINK, + "0x579CEa1889991f68aCc35Ff5c3dd0621fF29b0C9", // IQ + ADDRESSES.ethereum.AAVE, + "0x1b40183EFB4Dd766f11bDa7A7c3AD8982e998421", // VSP + "0x6f80310CA7F2C654691D1383149Fa1A57d8AB1f8", // SILO + "0xd632f22692FaC7611d2AA1C0D552930D43CAEd3B", // FRAX3CRV-f + ADDRESSES.ethereum.SAFE, + "0x318C3a9373419aA57c7C8aa53Eef92814e975F51", // 90D-StakeDAO-sdFRAX3CRV-f-0 + "0x43E54C2E7b3e294De3A155785F52AB49d87B9922", // asdCRV + "0xA13a9247ea42D743238089903570127DdA72fE44", // bb-a-USD + "0x7B50775383d3D6f0215A8F290f2C9e2eEBBEceb2", // bb-a-USD + "0x2d011aDf89f0576C9B722c28269FcB5D50C2d179", // B-sdBAL-STABLE + "0xdEa1fc87b6F4536e852AEa73aEb8F4aC0cF843C3", // CNV + "0xA3D87FffcE63B53E0d54fAa1cc983B7eB0b74A9c", // eCRV + "0x06325440D014e39736583c165C2963BA99fAf14E", // steCRV + "0x6788f608CfE5CfCD02e6152eC79505341E0774be", // sdAPWAPW-f + "0x8c524635d52bd7b1Bd55E062303177a7d916C046", // sdFXSFXS-f + "0x6a69FfD1353Fa129f7F9932BB68Fa7bE88F3888A", // sdYFIYFI-f-gauge + "0x93Dede06AE3B5590aF1d4c111BC54C3f717E4b35", // gALCX + "0x9994E35Db50125E0DF82e4c2dde62496CE330999", // MORPHO + "0x9B85d6e87350c021616Ae3DA78b9B1335c68283A", // sd3EURpool-f-gauge + "0x752B4c6e92d96467fE9b9a2522EF07228E00F87c", // sdANGLE + "0x26f01FE3BE55361b0643bc9d5D60980E37A2770D", // sdAPW + "0x76fB1951F3395031B3ec703a16567ab92E792770", // sdB-sdBAL-STABLE-gauge + "0xF24d8651578a55b0C119B9910759a351A3458895", // sdBal + "0xBe77585F4159e674767Acf91284160E8C09b96D8", // sdcrvFRAX-gauge + "0x5af15DA84A4a6EDf2d9FA6720De921E1026E37b7", // sdFRAX3CRV-f + "0xA7Ae691A17CA71Ca24b2D21De117213c2b64A54b", // sdeCRV-gauge + "0xfA51194E8eafc40523574A65C1e4606E1432408B", // sdFRAX3CRV-f-gauge + "0x4eB7440E6b9341505f86096EFB4019EAb287f611", // fsdeursCRV-27 + "0xaF32c61C4a2F79b16D8D1D36455196115F454A9b", // sdsanDAI_EUR-gauge + "0xB6261Be83EA2D58d8dd4a73f3F1A353fa1044Ef7", // sdsanFRAX_EUR-gauge + "0xAC9978DB68E11EbB9Ffdb65F31053A69522B6320", // sdsanUSDC_EUR-gauge + "0x1E3923A498de30ff8C5Ac8bfAb1De9AFa58fDE5d", // sdsdAGAG-f-gauge + "0xE55843a90672f7d8218285e51EE8fF8E233F35d5", // sdANGLE-gauge + "0x3E8C72655e48591d93e6dfdA16823dB0fF23d859", // sdBal-gauge + "0x7f50786A0b15723D741727882ee99a0BF34e3466", // sdCRV-gauge + "0x531167aBE95375Ec212f2b5417EF05a9953410C1", // sdsdCRVCRV-f-gauge + "0xF3C6e8fbB946260e8c2a55d48a5e01C82fD63106", // sdFXS-gauge + "0xb10DE77F94AFd8080FB7b563ee0d6388291F07Fb", // sdsdFXSFXS-f-gauge + "0xaA25cb1b10b8252480Cc6A3b17C22e6C0E00Bcb4", // sdBTCCoveredCallV2 + "0xc10B7CA0383F0357EdEED233Dc806B5229DCF4a5", // sdETHCoveredCallV2 +]; + +const ethOwnTokens = [ + "0x73968b9a57c6E53d41345FD57a6E6ae27d6CDB2F", // SDT + "0xB3a33E69582623F650e54Cc1cf4e439473A28D26", // sdsdtfraxbp-f-gauge + "0xC891a1BaCF802127874054e703b386346fE94b00", // sdSDTETH-f-gauge + "0x60355587a8D4aa67c2E64060Ab36e566B9bCC000", // SDTETH-f-gauge +]; + +const polyTokens = [ + nullAddress, + "0xE0B52e49357Fd4DAf2c15e02058DCE6BC0057db4", // agEUR + "0x900F717EA076E1E7a484ad9DD2dB81CEEc60eBF1", // ANGLE + "0x8437d7C167dFB82ED4Cb79CD44B7a32A1dd95c77", // aPolAGEUR + "0x5aa0197D0d3E05c4aA070dfA2f54Cd67A447173A", // fagEUR-1 +]; + +const arbTokens = [ + nullAddress, + ADDRESSES.arbitrum.ARB, //arb + "0x11cDb42B0EB46D95f990BeDD4695A6e3fA034978", //crv +] + +const avaxTokens = [nullAddress]; + +module.exports = treasuryExports({ + ethereum: { + tokens: ethTokens, + ownTokens: ethOwnTokens, + ownTokenOwners: [eth], + owners: [eth], + }, + polygon: { + tokens: polyTokens, + ownTokens: [], + ownTokenOwners: [poly], + owners: [poly], + }, + avax: { + tokens: avaxTokens, + ownTokens: [], + ownTokenOwners: [avax], + owners: [avax], + }, + arbitrum: { + tokens: arbTokens, + owners: [arbitrumTreasury,], + }, +}); diff --git a/projects/treasury/stargate-finance.js b/projects/treasury/stargate-finance.js new file mode 100644 index 00000000000..5fc1120b250 --- /dev/null +++ b/projects/treasury/stargate-finance.js @@ -0,0 +1,11 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const index = require('../stargate-finance/index') +const { treasuryExports } = require('../helper/treasury') + +module.exports = treasuryExports({ + bsc: { + owner: '0xA2B48Ad28c09cc64CcCf9eD73e1EfceD052877d5', + tokens: [ADDRESSES.bsc.USDT, ADDRESSES.bsc.BUSD, '0xd397a40884ce00e662b419673e0b15cae628877f', '0x41516dca7efe69518ec414de35e5aa067788de3d',], + resolveLP: true, + } +}) \ No newline at end of file diff --git a/projects/treasury/stargate.js b/projects/treasury/stargate.js new file mode 100644 index 00000000000..b9ddbaa5bf5 --- /dev/null +++ b/projects/treasury/stargate.js @@ -0,0 +1,153 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const eth = "0x65bb797c2B9830d891D87288F029ed8dACc19705"; +const bsc = "0x6e690075eedBC52244Dd4822D9F7887d4f27442F"; +const avax = "0x2B065946d41ADf43BBc3BaF8118ae94Ed19D7A40"; +const polygon = "0x47290DE56E71DC6f46C26e50776fe86cc8b21656"; +const arbitrum = "0x9CD50907aeb5D16F29Bddf7e1aBb10018Ee8717d"; +const optimism = "0x392AC17A9028515a3bFA6CCe51F8b70306C6bd43"; +const fantom = "0x2351BBCb7cF7Ee9D18AF2Be0d106BFc5D47A9E85"; +const metis = "0x90c3DFD4Ea593336DBB9F925f73413e6EE84c90E"; + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.USDC, + "0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490", // 3CRV DAI/USDC/USDT + "0x73968b9a57c6E53d41345FD57a6E6ae27d6CDB2F", // SDT + ADDRESSES.ethereum.cvxCRV, + ADDRESSES.ethereum.SAFE, + "0xFCc5c47bE19d06BF83eB04298b026F81069ff65b", // yCRV + "0x616e8BfA43F920657B3497DBf40D6b1A02D4608d", // auraBAl + "0xA13a9247ea42D743238089903570127DdA72fE44", // bb-a-USD + ADDRESSES.ethereum.cvxFXS, + "0x3175Df0976dFA876431C2E9eE6Bc45b65d3473CC", // crvFRAX + "0xfA0F307783AC21C39E939ACFF795e27b650F6e68", // S*FRAX + "0x0Faf1d2d3CED330824de3B8200fc8dc6E397850d", // S*DAI + "0x692953e758c3669290cb1677180c64183cEe374e", // S*USDD + "0xE8F55368C82D38bbbbDb5533e7F56AfC2E978CC2", // S*LUSD + "0x9cef9a0b1bE0D289ac9f4a98ff317c33EAA84eb8", // S*MAI + "0x5af15DA84A4a6EDf2d9FA6720De921E1026E37b7", // sdFRAX3CRV-f + "0x7f50786A0b15723D741727882ee99a0BF34e3466", // sdCRV-gauge + "0x101816545F6bd2b1076434B54383a1E633390A2E", // S*SGETH + "0x590d4f8A68583639f215f675F3a259Ed84790580", // S*sUSD + "0x38EA452219524Bb87e18dE1C24D3bB59510BD783", // S*USDT + "0xdf0770dF86a8034b3EFEf0A1Bb3c889B8332FF56", // S*USDC + ], + ownTokens: [ + "0xAf5191B0De278C7286d6C7CC6ab6BB8A73bA2Cd6", // STG + "0x341bb10D8f5947f3066502DC8125d9b8949FD3D6", // yvCurve-STG-USDC + "0x9de1c3D446237ab9BaFF74127eb4F303802a2683", // STG/FRAXBP-f + "0x95d16646311fDe101Eb9F897fE06AC881B7Db802", // STGUSDC-f-gauge + "0xaa8D332531B5B953938AA412730e7536178b4783", // aura50STG-50bb-a-USD-vault + "0x6cCA86CC27EB8c7C2d10B0672FE392CFC88e62ff", // STG-USDC Cake-LP + "0xA89B9c336764c9Ae5f64Bc19688601341974bc22", // sdSTGUSDC-f-gauge + ], + owners: [eth], + }, + bsc: { + tokens: [ + nullAddress, + ADDRESSES.bsc.USDT, + "0x98a5737749490856b401DB5Dc27F522fC314A4e1", // S*BUSD + "0x4e145a589e4c03cBe3d28520e4BF3089834289Df", // S*USDD + "0x7BfD7f2498C4796f10b6C611D9db393D3052510C", // S*MAI + "0x9aA83081AA06AF7208Dcc7A4cB72C94d057D2cda", // S*USDT + ], + ownTokens: [ + "0xBCEA09e9e882eC2Bb6dCE07c4e6669968846CaBD", // STG-BUSD Cake-LP + "0xB0D502E938ed5f4df2E681fE6E419ff29631d62b", // STG + ], + owners: [bsc], + }, + avax: { + tokens: [ + nullAddress, + "0x1c272232Df0bb6225dA87f4dEcD9d37c32f63Eea", // S*FRAX + ADDRESSES.avax.USDC, + "0x8736f92646B2542B3e5F3c63590cA7Fe313e283B", // S*MAI + "0x29e38769f23701A2e4A8Ef0492e19dA4604Be62c", // S*USDt + "0xEAe5c2F6B25933deB62f754f239111413A0A25ef", // S*USDt + "0x1205f31718499dBf1fCa446663B532Ef87481fe1", // S*USDC + ], + ownTokens: [ + "0x2F6F07CDcf3588944Bf4C42aC74ff24bF56e7590", // STG + "0x330f77BdA60D8daB14d2bb4F6248251443722009", // STG-USDC JLP + ], + owners: [avax], + }, + polygon: { + tokens: [ + nullAddress, + ADDRESSES.polygon.USDC, + "0x1c272232Df0bb6225dA87f4dEcD9d37c32f63Eea", // S*DAI + "0x29e38769f23701A2e4A8Ef0492e19dA4604Be62c", // S*USDT + "0x8736f92646B2542B3e5F3c63590cA7Fe313e283B", // S*miMATIC + "0x9E2d266D6c90F6C0D80a88159b15958f7135B8Af", // SSX + "0x1205f31718499dBf1fCa446663B532Ef87481fe1", // S*USDC + ], + ownTokens: [ + "0x2F6F07CDcf3588944Bf4C42aC74ff24bF56e7590", // STG + "0xA34Ec05DA1E4287FA351c74469189345990a3F0C", // STG-USDC SLP + ], + owners: [polygon], + }, + arbitrum: { + owners: [arbitrum], + tokens: [ + nullAddress, + ADDRESSES.arbitrum.USDC, + "0xaa4BF442F024820B2C28Cd0FD72b82c63e66F56C", // S*FRAX + "0xF39B7Be294cB36dE8c510e267B82bb588705d977", // S*MAI + "0x915A55e36A01285A14f05dE6e81ED9cE89772f8e", // S*SGETH + "0xB6CfcF89a7B22988bfC96632aC2A9D6daB60d641", // S*USDT + "0x892785f33CdeE22A30AEF750F285E18c18040c3e", // S*USDC + ], + ownTokens: [ + "0x6694340fc020c5E6B96567843da2df01b2CE1eb6", // STG + "0x3a4c6D2404b5eb14915041e01F63200a82f4a343", // 50STG-50USDC + ], + }, + optimism: { + owners: [optimism], + tokens: [ + nullAddress, + ADDRESSES.optimism.OP, + ADDRESSES.optimism.USDC, + "0x165137624F1f692e69659f944BF69DE02874ee27", // S*DAI + "0x368605D9C6243A80903b9e326f1Cddde088B8924", // S*FRAX + "0x3533F5e279bDBf550272a199a223dA798D9eff78", // S*LUSD + "0x5421FA1A48f9FF81e4580557E86C7C0D24C18036", // S*MAI + "0xd22363e3762cA7339569F3d33EADe20127D5F98C", // S*SGETH + "0x2F8bC9081c7FCFeC25b9f41a50d97EaA592058ae", // S*sUSD + "0xDecC0c09c3B5f6e92EF4184125D5648a66E35298", // S*USDC + ], + ownTokens: [ + "0x296F55F8Fb28E498B858d0BcDA06D955B2Cb3f97", // STG + "0xec376c3856a4232bB6Ed9752d29402DDCD09A9A3", // STG/USDC RAKIS-5 + "0xE7D2E422098D8b3AF11695A734d347563ae160Cb", // bb-STG-USD-gauge + ], + resolveUniV3: true, + }, + fantom: { + owners: [fantom], + tokens: [ + nullAddress, + ADDRESSES.fantom.USDC, + "0x12edeA9cd262006cC3C4E77c90d2CD2DD4b1eb97", // S*USDC + ], + ownTokens: [ + "0x2F6F07CDcf3588944Bf4C42aC74ff24bF56e7590", // STG + "0x0a80C53AfC6DE9dfB2017781436BfE5090F4aCB4", // STG-USDC spLP + ], + }, + metis: { + owners: [metis], + tokens: [ + ADDRESSES.metis.Metis, + ], + ownTokens: [], + }, +}); diff --git a/projects/treasury/stealcam.js b/projects/treasury/stealcam.js new file mode 100644 index 00000000000..58a84e10596 --- /dev/null +++ b/projects/treasury/stealcam.js @@ -0,0 +1,10 @@ +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +module.exports = treasuryExports({ + arbitrum: { + owners: ['0x2f60c9cee6450a8090e17a79e3dd2615a1c419eb',], + tokens: [ + nullAddress, + ], + }, +}); \ No newline at end of file diff --git a/projects/treasury/sudoswap.js b/projects/treasury/sudoswap.js new file mode 100644 index 00000000000..902d6e480c7 --- /dev/null +++ b/projects/treasury/sudoswap.js @@ -0,0 +1,23 @@ +const { nullAddress, treasuryExports } = require("../helper/treasury"); +const ADDRESSES = require('../helper/coreAssets.json') + +const treasury = "0xb16c1342E617A5B6E4b631EB114483FDB289c0A4" //pair factor1 +const treasury2 = "0xA020d57aB0448Ef74115c112D18a9C231CC86000" //pair factor2 +const treasury3 = "0x6853f8865BA8e9FBd9C8CCE3155ce5023fB7EEB0" //sudo governance +const SUDO = "0x3446Dd70B2D52A6Bf4a5a192D9b0A161295aB7F9" + +module.exports = treasuryExports({ + ethereum: { + owners: [treasury, treasury2, treasury3], + ownTokens: [SUDO], + tokens: [ + nullAddress, + ADDRESSES.ethereum.WETH, + ADDRESSES.ethereum.DAI, + ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.USDT, + ADDRESSES.ethereum.FRAX, + "0xb23d80f5FefcDDaa212212F028021B41DEd428CF", //PRIME + ], + }, +}); \ No newline at end of file diff --git a/projects/treasury/sushiswap.js b/projects/treasury/sushiswap.js new file mode 100644 index 00000000000..ee1e6fcbe82 --- /dev/null +++ b/projects/treasury/sushiswap.js @@ -0,0 +1,17 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const sushiSwapTreasury = "0xe94B5EEC1fA96CEecbD33EF5Baa8d00E4493F4f3"; +const SUSHI = ADDRESSES.ethereum.SUSHI; + + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.USDC,//USDC + ], + owners: [sushiSwapTreasury], + ownTokens: [SUSHI], + }, +}) diff --git a/projects/treasury/synapse.js b/projects/treasury/synapse.js new file mode 100644 index 00000000000..1404982bf37 --- /dev/null +++ b/projects/treasury/synapse.js @@ -0,0 +1,144 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const arbtreasury = "0x1d9bfc24d9e7eeda4119ceca11eaf4c24e622e62"; +const arbtreasury2 = "0x940279D22EB27415F2b0A0Ee6287749b5B19F43D"; +const arbSYN = "0x080F6AEd32Fc474DD5717105Dba5ea57268F46eb" +//const AuroraTreasury = "0xbb227Fcf45F9Dc5deF87208C534EAB1006d8Cc8d"; +const avaxTreasury = "0xd7aDA77aa0f82E6B3CF5bF9208b0E5E1826CD79C"; +const avaxSYN = "0x1f1E7c893855525b303f99bDF5c3c05Be09ca251" +//const bobaTreasury = "0xbb227Fcf45F9Dc5deF87208C534EAB1006d8Cc8d"; +const bscTreasury = "0xA316d83e67EEfD136f4C077de1cD4163A681F8A8"; +//const CantoTreasury = "0x02BA7A3Cd181a103Ba5702e708cF22de4Fa70254" +//const CronosTreasury = "0x7f91f3111b2009eC7c079Be213570330a37e8aeC" +//const DFKTreasury = "0x2E62c47f502f512C75bd5Ecd70799EFB0Fe7BAA3" +//const DogechainTreasury = "0x8f17b483982d1cc09296aed8f1b09ad830358a8d" +const FantomTreasury = "0x224002428cF0BA45590e0022DF4b06653058F22F" +const fantomSYN = "0xE55e19Fb4F2D85af758950957714292DAC1e25B2" +const HarmonyTreasury = "0x0172e7190Bbc0C2Aa98E4d1281d41D0c07178605" +//const KlaytnTreasury = "0x8f17b483982d1cc09296aed8f1b09ad830358a8d" +const MainnetTreasury = "0x67F60b0891EBD842Ebe55E4CCcA1098d7Aac1A55" +const mainnetSYN = "0x0f2D719407FdBeFF09D87557AbB7232601FD9F29" +const mainnetsynethLP = "0x4A86C01d67965f8cB3d0AAA2c655705E64097C31" +const MetisTreasury = "0xEAEC50eBe1c2A981ED8be02C36b0863Fae322975" +const metisSYN = ADDRESSES.metis.SYN +//const MoonbeamTreasury = "0xbb227Fcf45F9Dc5deF87208C534EAB1006d8Cc8d" +//const MoonriverTreasury = "0x4bA30618fDcb184eC01a9B3CAe258CFc5786E70E" +const OptimismTreasury = "0x2431CBdc0792F5485c4cb0a9bEf06C4f21541D52" +const PolygonTreasury = "0xBdD38B2eaae34C9FCe187909e81e75CBec0dAA7A" +const polygonSYN = "0xf8F9efC0db77d8881500bb06FF5D6ABc3070E695" + +module.exports = treasuryExports({ + arbitrum: { + tokens: [ + nullAddress, + //"0x080F6AEd32Fc474DD5717105Dba5ea57268F46eb",//syn + ADDRESSES.arbitrum.WETH, + ADDRESSES.optimism.DAI, + ADDRESSES.arbitrum.nUSD, + ADDRESSES.arbitrum.USDT, + ADDRESSES.arbitrum.USDC, + ], + owners: [arbtreasury, arbtreasury2], + ownTokens: [arbSYN] + }, + avax: { + tokens: [ + nullAddress, + //"0x1f1E7c893855525b303f99bDF5c3c05Be09ca251",//syn + ADDRESSES.avax.WAVAX, + ADDRESSES.avax.DAI, + ADDRESSES.avax.USDC_e, + ADDRESSES.avax.USDT_e, + + ], + owners: [avaxTreasury], + ownTokens: [avaxSYN] + }, + bsc: { + tokens: [ + nullAddress, + ADDRESSES.bsc.USDC, + ADDRESSES.bsc.BUSD, + ADDRESSES.fantom.fUSDT, + ADDRESSES.bsc.BTCB, + "0x54261774905f3e6E9718f2ABb10ed6555cae308a",//anybtc + "0x42F6f551ae042cBe50C739158b4f0CAC0Edb9096",//nrv + ADDRESSES.bsc.USDT, + "0x23396cF899Ca06c4472205fC903bDB4de249D6fC",//ustc + ], + owners: [bscTreasury] + }, + fantom: { + tokens: [ + nullAddress, + //"0xE55e19Fb4F2D85af758950957714292DAC1e25B2",//syn + "0x74b23882a30290451A17c44f4F05243b6b58C76d",//eth + ADDRESSES.fantom.USDC, + ADDRESSES.fantom.WFTM, + ], + owners: [FantomTreasury], + ownTokens: [fantomSYN] + }, + harmony: { + tokens: [ + nullAddress + ], + owners: [HarmonyTreasury] + }, + ethereum: { + tokens: [ + nullAddress, + //"0x0f2D719407FdBeFF09D87557AbB7232601FD9F29",//syn + ADDRESSES.ethereum.USDC, + "0x0ab87046fBb341D058F17CBC4c1133F25a20a52f",//gohm + ADDRESSES.ethereum.FRAX, + ADDRESSES.ethereum.WETH, + ADDRESSES.ethereum.DAI, + ADDRESSES.ethereum.USDT, + "0x98585dFc8d9e7D48F0b1aE47ce33332CF4237D96",//newo + "0x71Ab77b7dbB4fa7e017BC15090b2163221420282",//high + ADDRESSES.ethereum.WBTC, + "0x73968b9a57c6E53d41345FD57a6E6ae27d6CDB2F",//sdt + "0xBAac2B4491727D78D2b78815144570b9f2Fe8899",//dog + "0x02B5453D92B730F29a86A0D5ef6e930c4Cf8860B",//usdb + "0x1a7e4e63778B4f12a199C062f3eFdD288afCBce8",//ageur + "0x0642026E7f0B6cCaC5925b4E7Fa61384250e1701",//h2o + "0xb753428af26E81097e7fD17f40c88aaA3E04902c",//sfi + ADDRESSES.ethereum.LINK, + ], + owners: [MainnetTreasury], + ownTokens: [mainnetSYN, mainnetsynethLP] + }, + metis: { + tokens: [ + nullAddress, + //ADDRESSES.metis.SYN, + "0xFB21B70922B9f6e3C6274BcD6CB1aa8A0fe20B80",//gohm + ADDRESSES.metis.m_USDC, + ], + owners: [MetisTreasury], + ownTokens: [metisSYN] + }, + optimism: { + tokens: [ + nullAddress, + ADDRESSES.optimism.OP, + "0x809DC529f07651bD43A172e8dB6f4a7a0d771036",//neth + ], + owners: [OptimismTreasury] + }, + polygon: { + tokens: [ + nullAddress, + ADDRESSES.polygon.USDC, + ADDRESSES.polygon.USDT, + ADDRESSES.polygon.WMATIC_2, + ADDRESSES.polygon.DAI, + "0xd8cA34fd379d9ca3C6Ee3b3905678320F5b45195",//gohm + //"0xf8F9efC0db77d8881500bb06FF5D6ABc3070E695",//syn + ], + owners: [PolygonTreasury], + ownTokens: [polygonSYN] + } +}) \ No newline at end of file diff --git a/projects/treasury/synthetix.js b/projects/treasury/synthetix.js new file mode 100644 index 00000000000..59ca84616c6 --- /dev/null +++ b/projects/treasury/synthetix.js @@ -0,0 +1,27 @@ +const ADDRESSES = require('../helper/coreAssets.json'); +const { nullAddress,treasuryExports } = require("../helper/treasury"); + +const synthetixTreasury = "0x99f4176ee457afedffcb1839c7ab7a030a5e4a92"; +const treasury = "0xeb3107117fead7de89cd14d463d340a2e6917769" + +const SNX = ADDRESSES.ethereum.SNX; + + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.DAI, + ADDRESSES.ethereum.CVX, + ADDRESSES.ethereum.WETH, + ADDRESSES.ethereum.USDT, + ADDRESSES.ethereum.sUSD, + ADDRESSES.ethereum.LIDO, + '0x31c8EAcBFFdD875c74b94b077895Bd78CF1E64A3',//RAD + '0x3C0FFFF15EA30C35d7A85B85c0782D6c94e1d238' + ], + owners: [synthetixTreasury, treasury], + ownTokens: [SNX], + }, +}) \ No newline at end of file diff --git a/projects/treasury/teddy.js b/projects/treasury/teddy.js new file mode 100644 index 00000000000..ba323bc6c5d --- /dev/null +++ b/projects/treasury/teddy.js @@ -0,0 +1,11 @@ +const { staking } = require("../helper/staking"); + +const treasuryContract = "0xb4Fbc7839ce88029c8c1c6274660118e27B6f982"; +const TEDDY = "0x094bd7b2d99711a1486fb94d4395801c6d0fddcc"; + +module.exports = { + avax: { + tvl: () => 0, + ownTokens: staking(treasuryContract, TEDDY), + }, +}; diff --git a/projects/treasury/templar-dao.js b/projects/treasury/templar-dao.js new file mode 100644 index 00000000000..207bd8b25df --- /dev/null +++ b/projects/treasury/templar-dao.js @@ -0,0 +1,52 @@ +const ADDRESSES = require("../helper/coreAssets.json"); +const { treasuryExports } = require("../helper/treasury"); +const { nullAddress } = require("../helper/unwrapLPs"); + +const bscOwner = "0xEA724deA000b5e5206d28f4BC2dAD5f2FA1fe788"; +const bscTreasuryContract = "0xd01e8D805BB310F06411e70Fd50eB58cAe2B4C27"; + +const bscTokens = { + BUSD: ADDRESSES.bsc.BUSD, + WBNB: ADDRESSES.bsc.WBNB, + MIM: "0xfe19f0b51438fd612f6fd59c1dbb3ea319f433ba", + TM: "0x194d1D62d8d798Fcc81A6435e6d13adF8bcC2966", + DAI: "0x1AF3F329e8BE154074D8769D1FFa4eE058B1DBc3", + TEM: "0x19e6BfC1A6e4B042Fb20531244D47E252445df01", + VBUSD: "0x95c78222B3D6e262426483D42CfA53685A67Ab9D", + VBTC: "0x882C173bC7Ff3b7786CA16dfeD3DFFfb9Ee7847B", +}; + +const LP = "0xEA724deA000b5e5206d28f4BC2dAD5f2FA1fe788"; + +const ethTokens = { + USDC: ADDRESSES.ethereum.USDC, + USDT: ADDRESSES.ethereum.USDT, +}; +const ethOwner = "0x4Bd973e98585b003c31f4C8b9d6eAC5d3293B1e5"; + +module.exports = treasuryExports({ + bsc: { + tokens: [ + nullAddress, + bscTokens.TM, + bscTokens.DAI, + bscTokens.BUSD, + bscTokens.WBNB, + bscTokens.VBUSD, + bscTokens.VBTC, + ], + owners: [bscOwner, bscTreasuryContract], + ownTokens: ['0x19e6BfC1A6e4B042Fb20531244D47E252445df01'], + resolveUniV3: true, + }, + ethereum: { + owner: ethOwner, + tokens: [ + nullAddress, + ethTokens.USDC, + ethTokens.USDT, + ADDRESSES.ethereum.WBTC, + ], + resolveUniV3: true, + }, +}); \ No newline at end of file diff --git a/projects/treasury/tempus-finance.js b/projects/treasury/tempus-finance.js new file mode 100644 index 00000000000..d1fdf753407 --- /dev/null +++ b/projects/treasury/tempus-finance.js @@ -0,0 +1,20 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0xab40a7e3cef4afb323ce23b6565012ac7c76bfef"; +const TEMP = "0xA36FDBBAE3c9d55a1d67EE5821d53B50B63A1aB9" +const LP = "0x514f35a92A13bc7093f299AF5D8ebb1387E42D6B" + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.STETH, + + ], + owners: [treasury, LP], + ownTokens: [TEMP], + resolveLP: true, + resolveUniV3: true, + }, +}) \ No newline at end of file diff --git a/projects/treasury/thales.js b/projects/treasury/thales.js new file mode 100644 index 00000000000..bf0446e5e29 --- /dev/null +++ b/projects/treasury/thales.js @@ -0,0 +1,50 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress,treasuryExports } = require("../helper/treasury"); + +const Treasury_ARB = "0x2902E381c9Caacd17d25a2e008db0a9a4687FDBF"; +const Treasury_ETH = "0xdac09f37e132d91b962f30e6ec40d2d08b82b0fa"; +const Treasury_OP = "0x489863b61c625a15c74fb4c21486bacb4a3937ab"; +const Treasury_POLYGON = "0x4aad282dac74d79e41fd12833b1fad7a18c778ed"; +const Treasury_MULTICHAIN = "0x1777c6d588fd931751762836811529c0073d6376"; +const THALE_ARB = "0xE85B662Fe97e8562f4099d8A1d5A92D4B453bF30"; +const THALES_ETH = "0x8947da500eb47f82df21143d0c01a29862a8c3c5"; +const THALES_OP = "0x217d47011b23bb961eb6d93ca9945b7501a5bb11"; + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + "0x8e870d67f660d95d5be530380d0ec0bd388289e1", + ADDRESSES.ethereum.USDT, + ADDRESSES.ethereum.USDC + ], + owners: [Treasury_ETH, Treasury_MULTICHAIN], + ownTokens: [THALES_ETH], + }, + optimism: { + tokens: [ + nullAddress, + ADDRESSES.optimism.USDC, + ADDRESSES.optimism.OP, + "0x350a791bfc2c21f9ed5d10980dad2e2638ffa7f6" + ], + owners: [Treasury_OP, Treasury_MULTICHAIN], + ownTokens: [THALES_OP], + }, + arbitrum: { + tokens: [ + nullAddress, + ADDRESSES.arbitrum.USDC, + "0x8971dFb268B961a9270632f28B24F2f637c94244" + ], + owners: [Treasury_ARB, Treasury_MULTICHAIN], + ownTokens: [THALE_ARB], + }, + polygon: { + tokens: [ + nullAddress, + ADDRESSES.polygon.USDC + ], + owners: [Treasury_POLYGON], + }, +}) \ No newline at end of file diff --git a/projects/treasury/thellamas.js b/projects/treasury/thellamas.js new file mode 100644 index 00000000000..02ef046b4e2 --- /dev/null +++ b/projects/treasury/thellamas.js @@ -0,0 +1,33 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); +const { mergeExports } = require('../helper/utils'); +const { genericUnwrapCvxRewardPool } = require('../helper/unwrapLPs') + +const Treasury = "0x73eb240a06f0e0747c698a219462059be6aaccc8"; + +module.exports = mergeExports([treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.CVX, + ADDRESSES.ethereum.WETH, + ADDRESSES.ethereum.CRV, + "0xaa0C3f5F7DFD688C6E646F66CD2a6B66ACdbE434", + "0x7f50786A0b15723D741727882ee99a0BF34e3466", + "0x0148CF564318272c2Bad048488F90dF4e3769f32", + "0x9aE380F0272E2162340a5bB646c354271c0F5cFC" + ], + owners: [Treasury], + ownTokens: ['0xe127ce638293fa123be79c25782a5652581db234'], + }, +}), { + ethereum: { + tvl: async (_, _1, _2, { api }) => { + const lockedCVXBal = await api.call({ abi: 'erc20:balanceOf', target: ADDRESSES.ethereum.vlCVX, params: Treasury }) + api.add(ADDRESSES.ethereum.CVX, lockedCVXBal) + await genericUnwrapCvxRewardPool({ api, owner: Treasury, pool: '0x39D78f11b246ea4A1f68573c3A5B64E83Cff2cAe'}) + return api.getBalances() + } + } +}]) \ No newline at end of file diff --git a/projects/treasury/themis-capital-ohm.js b/projects/treasury/themis-capital-ohm.js new file mode 100644 index 00000000000..455b1de5be8 --- /dev/null +++ b/projects/treasury/themis-capital-ohm.js @@ -0,0 +1,13 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require('../helper/unknownTokens') + +module.exports = { + misrepresentedTokens: true, + filecoin: { + tvl: sumTokensExport({ + owner: '0x0e511806C7AC38cF6d1EeAa9Ee51027e44Dcbf94', + tokens: [ADDRESSES.filecoin.USDT, '0x45680718F6BdB7Ec3A7dF7D61587aC7C3fB49d50'], + useDefaultCoreAssets: true, + }) + }, +}; \ No newline at end of file diff --git a/projects/treasury/tipidao.js b/projects/treasury/tipidao.js new file mode 100644 index 00000000000..9190d18a5dd --- /dev/null +++ b/projects/treasury/tipidao.js @@ -0,0 +1,3 @@ +module.exports = require("../tipidao/index"); + +delete module.exports.bsc.staking \ No newline at end of file diff --git a/projects/treasury/tokemak.js b/projects/treasury/tokemak.js new file mode 100644 index 00000000000..d5a0b47f5d6 --- /dev/null +++ b/projects/treasury/tokemak.js @@ -0,0 +1,30 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0x8b4334d4812C530574Bd4F2763FcD22dE94A969B"; + +const tokens = [ + nullAddress, + ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.STETH, + "0x9C4A4204B79dd291D6b6571C5BE8BbcD0622F050", // TCR + "0x4104b135DBC9609Fc1A9490E61369036497660c8", // APW + "0x73968b9a57c6E53d41345FD57a6E6ae27d6CDB2F", // SDT + "0xE1573B9D29e2183B1AF0e743Dc2754979A40D237", // Uniswap FXS/FRAX LP + ADDRESSES.ethereum.LIDO, + ADDRESSES.ethereum.SAFE, + "0xaa0C3f5F7DFD688C6E646F66CD2a6B66ACdbE434", // stkCvxCrv + "0x04906695D6D12CF5459975d7C3C03356E4Ccd460", // sOHM +]; + +const ownTokens = [ + ADDRESSES.ethereum.TOKE, +]; + +module.exports = treasuryExports({ + ethereum: { + tokens, + ownTokens, + owners: [treasury], + }, +}); diff --git a/projects/treasury/tokenIon.js b/projects/treasury/tokenIon.js new file mode 100644 index 00000000000..17d29fb2aaf --- /dev/null +++ b/projects/treasury/tokenIon.js @@ -0,0 +1,41 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokens2 } = require("../helper/unwrapLPs"); + +// Receives rewards/fee from AMM wrapper via reward distributor on WETH shape, some are sold for LON... +const MULTISIG_ONE = "0x3557BD3d422300198719710Cc3f00194E1c20A46"; + +module.exports = { + ethereum: { + tvl: (_, block) => sumTokens2({ owner: MULTISIG_ONE, tokens: [ + ADDRESSES.ethereum.USDT, + '0x55d31f68975e446a40a2d02ffa4b0e1bfb233c2f', + '0x8E870D67F660D95d5be530380D0eC0bd388289E1', //USDP + ADDRESSES.ethereum.USDC, //USDC + ADDRESSES.ethereum.TUSD, //TUSD + ADDRESSES.ethereum.UNI, //UNI + ADDRESSES.ethereum.WBTC, // WBTC + ADDRESSES.ethereum.MATIC, // MATIC + ADDRESSES.ethereum.BUSD, // BUSD + '0x956F47F50A910163D8BF957Cf5846D573E7f87CA', // FEI + ADDRESSES.ethereum.DAI, // DAI + '0xba100000625a3754423978a60c9317c58a424e3D', // BAL + ADDRESSES.ethereum.FTM, // FTM + '0xdd974D5C2e2928deA5F71b9825b8b646686BD200', // KNC + ADDRESSES.ethereum.AAVE, // AAVE + ADDRESSES.ethereum.CRV, // CRV + '0x0F5D2fB29fb7d3CFeE444a200298f468908cC942', // MANA + ADDRESSES.ethereum.LINK, // LINK + '0xc944E90C64B2c07662A292be6244BDf05Cda44a7', // GRT + '0xc944E90C64B2c07662A292be6244BDf05Cda44a7', // UMA + ADDRESSES.ethereum.SUSHI, // SUSHI + ADDRESSES.ethereum.WETH, // WETH + '0xE41d2489571d322189246DaFA5ebDe1F4699F498', // zRX + '0x408e41876cCCDC0F92210600ef50372656052a38', // ren + '0xc00e94Cb662C3520282E6f5717214004A7f26888', // COMP + '0xd26114cd6EE289AccF82350c8d8487fedB8A0C07', // OMG + '0x03ab458634910AaD20eF5f1C8ee96F1D6ac54919', // RAI + '0xBBbbCA6A901c926F240b89EacB641d8Aec7AEafD', // LRC + + ], block, }), + }, +}; diff --git a/projects/treasury/tornado-cash.js b/projects/treasury/tornado-cash.js new file mode 100644 index 00000000000..f9ccdff5b88 --- /dev/null +++ b/projects/treasury/tornado-cash.js @@ -0,0 +1,16 @@ +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0x5efda50f22d34F262c29268506C5Fa42cB56A1Ce"; +const vesting = "0x179f48C78f57A3A78f0608cC9197B8972921d1D2"; +const TORN = "0x77777FeDdddFfC19Ff86DB637967013e6C6A116C"; + + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress + ], + owners: [treasury, vesting], + ownTokens: [TORN], + }, +}) \ No newline at end of file diff --git a/projects/treasury/traderjoe.js b/projects/treasury/traderjoe.js new file mode 100644 index 00000000000..588f8fa3915 --- /dev/null +++ b/projects/treasury/traderjoe.js @@ -0,0 +1,14 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { treasuryExports, nullAddress } = require("../helper/treasury"); + +const multisig = "0xD858eBAa943b4C2fb06BA0Ba8920A132fd2410eE"; +const multisig2 = "0x799d4C5E577cF80221A076064a2054430D2af5cD"; +const multisig3 = "0x8F38558188FAe593E8E6347F124351CF4fDd032D" + +module.exports = treasuryExports({ + avax: { + tokens: [nullAddress, ADDRESSES.avax.USDC], + owners: [multisig, multisig2, multisig3], + ownTokens: [ADDRESSES.avax.JOE], + }, +}); diff --git a/projects/treasury/tranchess.js b/projects/treasury/tranchess.js new file mode 100644 index 00000000000..cd1614fa5ce --- /dev/null +++ b/projects/treasury/tranchess.js @@ -0,0 +1,37 @@ +const { nullAddress, treasuryExports } = require("../helper/treasury"); +const ADDRESSES = require('../helper/coreAssets.json') + +const treasuryETH = "0x1bf019a44a708fbeba7adc79bdad3d0769ff3a7b"; +const CHESS = "0xD6123271F980D966B00cA4FCa6C2c021f05e2E73" +const qETH = "0x93ef1Ea305D11A9b2a3EbB9bB4FCc34695292E7d"; + +//BSC CHAIN + +const treasuryBSC = "0x1bf019a44a708fbeba7adc79bdad3d0769ff3a7b"; +const CHESSB = "0x20de22029ab63cf9A7Cf5fEB2b737Ca1eE4c82A6" + + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.WETH, + "0x04248AAbca09E9a1a3D5129a7ba05b7F17DE7684", + "0xC764B55852F8849Ae69923e45ce077A576bF9a8d" + ], + owners: [treasuryETH], + ownTokens: [CHESS, qETH], + }, + bsc: { + tokens: [ + nullAddress, + ADDRESSES.bsc.ETH, + ADDRESSES.bsc.USDC, + ADDRESSES.bsc.BUSD, + ADDRESSES.bsc.BTCB + ], + owners: [treasuryBSC], + ownTokens: [CHESSB], + }, +}) \ No newline at end of file diff --git a/projects/treasury/treasure-dao.js b/projects/treasury/treasure-dao.js new file mode 100644 index 00000000000..cd6f1ff3eeb --- /dev/null +++ b/projects/treasury/treasure-dao.js @@ -0,0 +1,35 @@ +const ADDRESSES = require('../helper/coreAssets.json') + +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0x0eb5b03c0303f2f47cd81d7be4275af8ed347576"; +const treasury2 = "0x1054e9d9091dc55a1738f9c8fc0c79e59e222804" +const treasury3 = "0x482729215aaf99b3199e41125865821ed5a4978a" +const treasury4 = "0x64bfb08217b30b70f287a1b7f0670bdd49f8a13f" +const treasury5 = "0x81fa605235e4c32d8b440eebe43d82e9e083166b" +const treasury6 = "0xdb6ab450178babcf0e467c1f3b436050d907e233" +const treasury7 = "0xe8409cd2abae06871d166e808d75addb0537033a" + +const treasuryETH = "0xec834bd1f492a8bd5aa71023550c44d4fb14632a" +const MAGICETH = "0xb0c7a3ba49c7a6eaba6cd4a96c55a1391070ac9a" + +module.exports = treasuryExports({ + arbitrum: { + owners: [treasury, treasury2, treasury3, treasury4, treasury5, treasury6, treasury7 ], + ownTokens: [ + "0x539bde0d7dbd336b79148aa742883198bbf60342", // MAGIC + "0x872bAD41CFc8BA731f811fEa8B2d0b9fd6369585", // GFLY + ], + tokens: [ + nullAddress, + ADDRESSES.arbitrum.USDC, // USDC + ADDRESSES.arbitrum.WETH, // WETH + "0xb7e50106a5bd3cf21af210a755f9c8740890a8c9", // SLP + ], + }, + ethereum: { + tokens: [nullAddress, ADDRESSES.ethereum.USDC], + owners: [treasuryETH], + ownTokens: [MAGICETH], + }, +}); \ No newline at end of file diff --git a/projects/treasury/umamifinance.js b/projects/treasury/umamifinance.js new file mode 100644 index 00000000000..31ad7cfa380 --- /dev/null +++ b/projects/treasury/umamifinance.js @@ -0,0 +1,49 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const owners = [ + "0xb137d135dc8482b633265c21191f50a4ba26145d", // Main treasury + "0x8e52ca5a7a9249431f03d60d79dda5eab4930178", // ARB DAO delegate + "0xb0b4bd94d656353a30773ac883591ddbabc0c0ba", // Previous ARBI multisig +]; +const ethowners = "0x9478d820e8d38ca96610b7fcbe377822c2f60f2c" + +const ownTokens = [ + "0x1622bF67e6e5747b81866fE0b85178a93C7F86e3", // UMAMI + "0x2AdAbD6E8Ce3e82f52d9998a7f64a90d294A92A4", // mUMAMI + "0x1922C36F3bc762Ca300b4a46bB2102F84B1684aB", // cmUMAMI +]; + +module.exports = treasuryExports({ + arbitrum: { + tokens: [ + nullAddress, + ADDRESSES.arbitrum.fsGLP, // fsGLP + ADDRESSES.arbitrum.USDC, // USDC + ADDRESSES.arbitrum.USDT, // USDT + ADDRESSES.arbitrum.WETH, // wETH + ADDRESSES.arbitrum.GMX, // GMX + "0x55ff62567f09906a85183b866df84bf599a4bf70", // KROM + "0x3d9907f9a368ad0a51be60f7da3b97cf940982d8", // GRAIL + "0x3CAaE25Ee616f2C8E13C74dA0813402eae3F496b", // xGRAIL + ADDRESSES.arbitrum.ARB, // ARB + "0x3e6648c5a70a150a88bce65f4ad4d506fe15d2af", //spell + "0x10010078a54396f62c96df8532dc2b4847d47ed3", //hnd + "0x32eb7902d4134bf98a28b963d26de779af92a212", //rpdx + "0xd4d42f0b6def4ce0383636770ef773390d85c61a",//sushi + "0x2cab3abfc1670d1a452df502e216a66883cdf079",//l2dao + "0x539bde0d7dbd336b79148aa742883198bbf60342",//magic + "0x6694340fc020c5e6b96567843da2df01b2ce1eb6",//stg + ], + owners, + ownTokens, + }, + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.USDC,//usdc + ], + owners: [ethowners] + + }, +}); diff --git a/projects/treasury/uniswap.js b/projects/treasury/uniswap.js new file mode 100644 index 00000000000..d202db5cef4 --- /dev/null +++ b/projects/treasury/uniswap.js @@ -0,0 +1,24 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress,treasuryExports } = require("../helper/treasury"); + +const uniTreasury1 = "0x1a9c8182c09f50c8318d769245bea52c32be35bc"; +const uniTreasury2 = "0x4b4e140D1f131fdaD6fb59C13AF796fD194e4135"; +const uniTreasury3 = "0x3D30B1aB88D487B0F3061F40De76845Bec3F1e94"; + +const UNI = ADDRESSES.ethereum.UNI; + + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.USDC,//USDC + ADDRESSES.ethereum.DAI,//DAI + '0x028171bCA77440897B824Ca71D1c56caC55b68A3',//aDAI + ADDRESSES.ethereum.WETH,//WETH + ADDRESSES.ethereum.USDT,//USDT + ], + owners: [uniTreasury1, uniTreasury2, uniTreasury3], + ownTokens: [UNI], + }, +}) \ No newline at end of file diff --git a/projects/treasury/uwulend.js b/projects/treasury/uwulend.js new file mode 100644 index 00000000000..a4c392cab22 --- /dev/null +++ b/projects/treasury/uwulend.js @@ -0,0 +1,31 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0xc671a6b1415de6549b05775ee4156074731190c6"; +const uwu = "0x55C08ca52497e2f1534B59E2917BF524D4765257"; +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + "0x29127fE04ffa4c32AcAC0fFe17280ABD74eAC313", // SIFU + ADDRESSES.ethereum.USDT, // USDT + ADDRESSES.ethereum.DAI, // DAI + "0x99D8a9C45b2ecA8864373A26D1459e3Dff1e17F3", // MIM + ADDRESSES.ethereum.WBTC, // WBTC + "0xb95BD0793bCC5524AF358ffaae3e38c3903C7626", // uDAI + "0x24959F75d7BDA1884f1Ec9861f644821Ce233c7D", // uUSDT + "0x8C240C385305aeb2d5CeB60425AABcb3488fa93d", // uFRAX + "0x67fadbD9Bf8899d7C578db22D7af5e2E500E13e5", // uWETH + "0xaDFa5Fa0c51d11B54C8a0B6a15F47987BD500086", // uLUSD + "0x6Ace5c946a3Abd8241f31f182c479e67A4d8Fc8d", // uWBTC + "0xC4BF704f51aa4ce1AA946FfE15646f9B271ba0fa", // uWMEMO + "0xdb1A8f07f6964EFcFfF1Aa8025b8ce192Ba59Eba", // uCRV + "0xC480a11A524E4DB27c6d4E814b4D9B3646bC12Fc", // uMIM + "0x02738ef3f8d8D3161DBBEDbda25574154c560dAe", // uSIFU + "0x8028Ea7da2ea9BCb9288C1F6f603169B8AEa90A6", // uSIFUM + "0x243387a7036bfcB09f9bF4EcEd1E60765D31aA70", // uSSPELL + ], + owners: [treasury], + ownToken: [uwu], + }, +}); diff --git a/projects/treasury/vaporfi.js b/projects/treasury/vaporfi.js new file mode 100644 index 00000000000..45e958c8e57 --- /dev/null +++ b/projects/treasury/vaporfi.js @@ -0,0 +1,16 @@ +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasuryContract = "0x20b0013dcBB9697a8C3D0Be2cfb004d6bD023B87"; +const WAVAX_VPND_JPL = "0x4cd20F3e2894Ed1A0F4668d953a98E689c647bfE"; +const VPND = "0x83a283641C6B4DF383BCDDf807193284C84c5342"; + + +module.exports = treasuryExports({ + avax: { + tokens: [ + nullAddress + ], + owners: [treasuryContract], + ownTokens: [VPND,WAVAX_VPND_JPL], + }, +}) diff --git a/projects/treasury/velodrome.js b/projects/treasury/velodrome.js new file mode 100644 index 00000000000..36a7ae4f263 --- /dev/null +++ b/projects/treasury/velodrome.js @@ -0,0 +1,43 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { treasuryExports, nullAddress } = require("../helper/treasury"); + +const team = "0xb074ec6c37659525EEf2Fb44478077901F878012"; +const treasury = "0xe7D7ce84D45e43F06cD5CaA1d9c42374b8776fb0"; + +const tokens = [ + nullAddress, + ADDRESSES.optimism.OP, // OP + ADDRESSES.optimism.USDC, // USDC + ADDRESSES.tombchain.FTM, // WETH + "0x73cb180bf0521828d8849bc8CF2B920918e23032", // USD+ + ADDRESSES.optimism.sUSD, // sUSD + ADDRESSES.optimism.sETH, // sETH + "0xB153FB3d196A8eB25522705560ac152eeEc57901", // MIM + ADDRESSES.optimism.USDT, // USDT + "0xd52f94DF742a6F4B4C8b033369fE13A41782Bf44", // L2DAO + "0x9485aca5bbBE1667AD97c7fE7C4531a624C8b1ED", // agEUR + "0xc3864f98f2a61A7cAeb95b039D031b4E2f55e0e9", // OpenX + "0x61BAADcF22d2565B0F471b291C475db5555e0b76", // AELIN + "0x79AF5dd14e855823FA3E9ECAcdF001D99647d043", // jEUR + "0xc40F949F8a4e094D1b49a23ea9241D289B7b2819", // LUSD + ADDRESSES.moonbeam.MAI, // MAI + "0x3F56e0c36d275367b8C502090EDF38289b3dEa0d", // QI + "0x9Bcef72be871e61ED4fBbc7630889beE758eb81D", // rETH + "0xE3AB61371ECc88534C522922a026f2296116C109", // SPELL + "0xcB59a0A753fDB7491d5F3D794316F1adE197B21E", // TUSD + "0x1F32b1c2345538c0c6f582fCB022739c4A194Ebb", // wstETH +]; + +const ownTokens = [ + "0x3c8B650257cFb5f272f799F5e2b4e65093a11a05", // VELO + "0xe8537b6FF1039CB9eD0B71713f697DDbaDBb717d", // vAMM-VELO/USDC +]; + +module.exports = treasuryExports({ + optimism: { + tokens, + ownTokens, + owners: [team, treasury], + ownTokenOwners: [team, treasury] + }, +}); diff --git a/projects/treasury/venus.js b/projects/treasury/venus.js new file mode 100644 index 00000000000..e4ff6d42dea --- /dev/null +++ b/projects/treasury/venus.js @@ -0,0 +1,25 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress,treasuryExports } = require("../helper/treasury"); + +const venusTreasury = "0xF322942f644A996A617BD29c16bd7d231d9F35E9"; + +const XVS = "0xcf6bb5389c92bdda8a3747ddb454cb7a64626c63"; +const venusBTC = "0x882C173bC7Ff3b7786CA16dfeD3DFFfb9Ee7847B"; +const VAI = "0x4BD17003473389A42DAF6a0a729f6Fdb328BbBd7" + + +module.exports = treasuryExports({ + bsc: { + tokens: [ + nullAddress, + ADDRESSES.bsc.USDT,//bsc-usdc + ADDRESSES.bsc.USDC,//usdc + ADDRESSES.bsc.BTCB,//BTCB + '0x1AF3F329e8BE154074D8769D1FFa4eE058B1DBc3',//DAI + ADDRESSES.bsc.BETH,//BETH + + ], + owners: [venusTreasury], + ownTokens: [XVS, venusBTC, VAI], + }, +}) \ No newline at end of file diff --git a/projects/treasury/vesta.js b/projects/treasury/vesta.js new file mode 100644 index 00000000000..5a5ab9cbba3 --- /dev/null +++ b/projects/treasury/vesta.js @@ -0,0 +1,18 @@ + +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0xc9032419aa502fafa107775dca8b7d07575d9db5"; + +module.exports = treasuryExports({ + arbitrum: { + owners: [treasury, ], + ownTokens: [ + '0xa684cd057951541187f288294a1e1c2646aa2d24', // + ], + tokens: [ + nullAddress, + '0x625e7708f30ca75bfd92586e17077590c60eb4cd', + '0x8D9bA570D6cb60C7e3e0F31343Efe75AB8E65FB1', + ], + }, +}); \ No newline at end of file diff --git a/projects/treasury/void.js b/projects/treasury/void.js new file mode 100644 index 00000000000..b03ab9f1d14 --- /dev/null +++ b/projects/treasury/void.js @@ -0,0 +1,19 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0xf0a793024Ac47e421EB8c4673212dfCcE42f4a97"; +const tokenReflectionsAwardAddress = "0x78cCb45a43731cf989C740e9cb31f3d192Bd0f8b" + +module.exports = treasuryExports({ + fantom: { + owners: [treasury, tokenReflectionsAwardAddress], + ownTokens: [ + "0x80F2B8CdbC470c4DB4452Cc7e4a62F5277Db7061", // VOID + ], + tokens: [ + nullAddress, + ADDRESSES.fantom.DAI, // DAI + "0xfC66Ac63D414d3CF3dcdDa9e60742F6E789205e3", // SpookySwap VOID-DAI LP + ], + }, +}); \ No newline at end of file diff --git a/projects/treasury/volta-dao.js b/projects/treasury/volta-dao.js new file mode 100644 index 00000000000..e2923296206 --- /dev/null +++ b/projects/treasury/volta-dao.js @@ -0,0 +1,4 @@ +module.exports = require("../volta-dao/index"); + +delete module.exports.avax.staking +delete module.exports.fantom.staking \ No newline at end of file diff --git a/projects/treasury/volta.js b/projects/treasury/volta.js new file mode 100644 index 00000000000..7d82d482de3 --- /dev/null +++ b/projects/treasury/volta.js @@ -0,0 +1,25 @@ +const ADDRESSES = require('../helper/coreAssets.json') + +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0xB9665f6E5e3413B3a75Cc209556830E446fF9969"; + +module.exports = treasuryExports({ + arbitrum: { + owners: [treasury, ], + ownTokens: [ + "0x417a1aFD44250314BffB11ff68E989775e990ab6", // VOLTA + "0xb1781BF9C582A71269c6098E4155Ea8b15B35305", // VOLT + ], + tokens: [ + nullAddress, + ADDRESSES.arbitrum.USDT, // USDT + ADDRESSES.optimism.DAI, // DAI + ADDRESSES.arbitrum.USDC, // USDC + "0xd85E038593d7A098614721EaE955EC2022B9B91B", // gDAI + "0xd92Be5A1c565Db5256cDD537B875ED46111Bd8b0", // VOLT2USD3CRV-f + ADDRESSES.arbitrum.WETH, // WETH + "0x39ff5098081FBE1ab241c31Fe0a9974FE9891d04", // voltGNS + ], + }, +}); \ No newline at end of file diff --git a/projects/treasury/wagmi.js b/projects/treasury/wagmi.js new file mode 100644 index 00000000000..4d21dca03bd --- /dev/null +++ b/projects/treasury/wagmi.js @@ -0,0 +1,18 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0xd2135CfB216b74109775236E36d4b433F1DF507B"; + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.USDC, // USDC + ADDRESSES.ethereum.USDT, + ADDRESSES.ethereum.DAI, + "0x8290333ceF9e6D528dD5618Fb97a76f268f3EDD4" + ], + owners: [treasury], + ownTokens: [], + }, +}); \ No newline at end of file diff --git a/projects/treasury/wagmidao.js b/projects/treasury/wagmidao.js new file mode 100644 index 00000000000..f254a652833 --- /dev/null +++ b/projects/treasury/wagmidao.js @@ -0,0 +1,78 @@ +const sdk = require("@defillama/sdk"); +const abi = require("../wagmidao/abi.json"); +const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); +const { + getFixBalancesSync, +} = require("../helper/portedTokens"); + +const bondContracts = [ + //Bond 1USDC + "0xe443F63564216f60625520465F1324043fcC47b9", + //Bond GMI-1USDC + "0x8c4300a7A71efF73b24DCd8f849f82A8B36b5D8a", + //Bond WONE + "0xa31a22d9dec269f512cf62b83039190fbe67f7d2", + //Bond 1ETH + "0x08d44C114e3C0102ace43e9656f478DD4a71cD1D", + //Bond FAM + "0xEfb7DDE5261100a32657C9606507a130257D93c6", +]; + +const GMI = "0x8750f5651af49950b5419928fecefca7c82141e3"; + +const Treasury = async (timesamp, ethBlock, chainBlocks) => { + const balances = {}; + + const tokenAddresses = ( + await sdk.api.abi.multiCall({ + abi: abi.principal, + calls: bondContracts.map((bond) => ({ + target: bond, + })), + chain: "harmony", + block: chainBlocks["harmony"], + }) + ).output.map((t) => t.output); + + const tokenBalances = ( + await sdk.api.abi.multiCall({ + abi: abi.totalPrincipalReceived, + calls: bondContracts.map((bond) => ({ + target: bond, + })), + chain: "harmony", + block: chainBlocks["harmony"], + }) + ).output.map((b) => b.output); + + const lpPositions = []; + tokenAddresses.forEach((token, idx) => { + if (token == "0x73919726cC9d988cEa1a378772e5f775dF33C049") { + lpPositions.push({ token, balance: tokenBalances[idx] }); + } else { + sdk.util.sumSingleBalance( + balances, + `harmony:${token}`, + tokenBalances[idx] + ); + } + }); + + await unwrapUniswapLPs( + balances, + lpPositions, + chainBlocks["harmony"], + "harmony", + ); + + getFixBalancesSync('harmony')(balances); + + return balances; +}; + +module.exports = { + harmony: { + tvl: Treasury, + }, + methodology: "Counts liquidity on the Farms through Factory Contract, and counts Treasury as it is determined by bonding of assets. Staking refers to the staked GMI tokens", +}; diff --git a/projects/treasury/we-piggy.js b/projects/treasury/we-piggy.js new file mode 100644 index 00000000000..9be17cb8c9f --- /dev/null +++ b/projects/treasury/we-piggy.js @@ -0,0 +1,12 @@ +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0x0d189fd8d46e43b2f13390de95d4f8e185eb3914"; + +module.exports = treasuryExports({ + arbitrum: { + tokens: [ + nullAddress, + ], + owners: [treasury,], + }, +}) \ No newline at end of file diff --git a/projects/treasury/wonderland.js b/projects/treasury/wonderland.js new file mode 100644 index 00000000000..3ddeda97ea0 --- /dev/null +++ b/projects/treasury/wonderland.js @@ -0,0 +1,119 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports, } = require("../helper/treasury"); +const sdk = require('@defillama/sdk') + +const TIME = "0xb54f16fb19478766a268f172c9480f8da1a7c9c3" +// Sources: https://wl-l.ink/Zapper/Treasury and https://docs.wonderland.money/ecosystem/contracts +const treasuries = [ + "0x1c46450211cb2646cc1da3c5242422967ed9e04c", "0x355d72fb52ad4591b2066e43e89a7a38cf5cb341", "0xb6b80f4ea8fb4117928d3c819e8ac6f1a3837baf", + "0x88bbe6de858b179841c8f49a56b99fb0522a263a", "0x32b5d1f1331f857d583b05ef50ab9636cdc090d9", "0x1de8a4c781ac134c1a7640aabe5929f4e1fe2f5b", + "0x694497072b2c43b737ae70bbd52694d61377344c", "0x004016b53f127c8f6f64cbf66330765dcf5dbe2a", "0xb96e3bf7d8939e9e17adcc26fdf47b6c7391eb6a", + "0xba90fabdde85191ae04bfdd8022f6d7b1f86c2f4", "0x5a4a936e90caf09590ac402b6e8d5435a5092a7a", "0x1724b987feb9651c466d9e66be4b74a7cedbf372" +] + +const ethWallet = '0x355d72fb52ad4591b2066e43e89a7a38cf5cb341' + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.USDC,//USDC + '0x55c08ca52497e2f1534b59e2917bf524d4765257', // uwu + ADDRESSES.ethereum.cvxFXS, // cvxFXS + '0x3E04863DBa602713Bb5d0edbf7DB7C3A9A2B6027', // SLP + ADDRESSES.ethereum.DAI,//DAI + '0x028171bCA77440897B824Ca71D1c56caC55b68A3',//aDAI + ADDRESSES.ethereum.WETH,//WETH + ADDRESSES.ethereum.USDT,//USDT + '0xFcF8eda095e37A41e002E266DaAD7efC1579bc0A',//flex + '0xdB25f211AB05b1c97D595516F45794528a807ad8',//eurs + '0xAf5191B0De278C7286d6C7CC6ab6BB8A73bA2Cd6',//stg + '0x29127fe04ffa4c32acac0ffe17280abd74eac313',//sifu + '0x6dea81c8171d0ba574754ef6f8b412f2ed88c54d',//LQTY + '0x51144708b82eA3b5b1002C9DC38b71ec63b7e670',// uwu lend token + '0xdb1a8f07f6964efcfff1aa8025b8ce192ba59eba',// uwu lend token + '0x8c240c385305aeb2d5ceb60425aabcb3488fa93d',// uwu lend token + '0xc480a11a524e4db27c6d4e814b4d9b3646bc12fc',// uwu lend token + '0x8028ea7da2ea9bcb9288c1f6f603169b8aea90a6',// uwu lend token + '0x243387a7036bfcb09f9bf4eced1e60765d31aa70',// uwu lend token + '0xadfa5fa0c51d11b54c8a0b6a15f47987bd500086',// uwu lend token + '0x02738ef3f8d8d3161dbbedbda25574154c560dae',// uwu lend token + '0x6ace5c946a3abd8241f31f182c479e67a4d8fc8d',// uwu lend token + '0x67fadbd9bf8899d7c578db22d7af5e2e500e13e5',// uwu lend token + ], + owners: [ethWallet], + ownTokens: ['0x3b79a28264fc52c7b4cea90558aa0b162f7faf57'], + }, + avax: { + tokens: [ + nullAddress, + ADDRESSES.avax.USDT_e,//usdte + "0x39fC9e94Caeacb435842FADeDeCB783589F50f5f",//knc + "0x63682bdc5f875e9bf69e201550658492c9763f89",//bsgg + ADDRESSES.avax.USDC,//USDC + ADDRESSES.avax.USDC_e,//USDC.e + "0x9e295b5b976a184b14ad8cd72413ad846c299660",//fsGLP + ], + owners: treasuries, + ownTokens: [TIME, '0x0da67235dd5787d67955420c84ca1cecd4e5bb3b'], + }, + arbitrum: { + tokens: [ + nullAddress, + ADDRESSES.arbitrum.WETH,//weth + ADDRESSES.arbitrum.GMX,//gmx + "0xd2D1162512F927a7e282Ef43a362659E4F2a728F",//sbfGMX + ], + owners: treasuries + }, + polygon: { + tokens: [ + nullAddress, + // "0xb08b3603C5F2629eF83510E6049eDEeFdc3A2D91",//cpool + ], + owners: treasuries + }, + bsc: { + tokens: [ + nullAddress, + ADDRESSES.bsc.USDC,//USDC + ], + owners: treasuries + }, + fantom: { + tokens: [ + nullAddress, + ], + owners: treasuries + }, + optimism: { + tokens: [ + nullAddress, + ADDRESSES.moonbeam.MAI,//MAI + ADDRESSES.tombchain.FTM,//WETH + ADDRESSES.optimism.USDT,//USDT + ], + owners: treasuries + } +}) + +module.exports.ethereum.tvl = sdk.util.sumChainTvls([module.exports.ethereum.tvl, uwuPositions]) +async function uwuPositions(_, _b, _cb, { api, }) { + // + // LUSD in stability pool + const {initialValue : LUSDBal} = await api.call({ abi: "function deposits(address) view returns (uint256 initialValue, address frontEndTag)", target: '0x66017D22b0f8556afDd19FC67041899Eb65a21bb', params: ethWallet }) + const uwuLPLocked= await api.call({ abi:"function lockedBalances(address user) view returns (uint256 total, uint256 unlockable, uint256 locked, tuple(uint256 amount, uint256 unlockTime)[] lockData)", target: '0x0a7b2a21027f92243c5e5e777aa30bb7969b0188', params: ethWallet }) + const [uDAI, vdDAI, uUSDT, vdUSDT] = await api.multiCall({ + abi: 'erc20:balanceOf', calls: [ + { target: '0xb95bd0793bcc5524af358ffaae3e38c3903c7626', params: ethWallet }, + { target: '0x1254b1fd988a1168e44a4588bb503a867f8e410f', params: ethWallet }, + { target: '0x24959f75d7bda1884f1ec9861f644821ce233c7d', params: ethWallet }, + { target: '0xaac1d67f1c17ec01593d76e831c51a4f458dc160', params: ethWallet }, + ] + }) + api.add(ADDRESSES.ethereum.LUSD, LUSDBal) + api.add('0x3E04863DBa602713Bb5d0edbf7DB7C3A9A2B6027', uwuLPLocked.total) + api.add('0xb95bd0793bcc5524af358ffaae3e38c3903c7626', +uDAI - vdDAI) + api.add('0x24959f75d7bda1884f1ec9861f644821ce233c7d', +uUSDT - vdUSDT) + return api.getBalances() +} \ No newline at end of file diff --git a/projects/treasury/woofi.js b/projects/treasury/woofi.js new file mode 100644 index 00000000000..b80784a143c --- /dev/null +++ b/projects/treasury/woofi.js @@ -0,0 +1,39 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasuryAVAX = "0xb54382c680b0ad037c9f441a8727ca6006fe2dd0"; +const treasuryETH = "0xfa2d1f15557170f6c4a4c5249e77f534184cdb79" +const WOO = "0x4691937a7508860F876c9c0a2a617E7d9E945D4B" +const WOOBSC= "0x4691937a7508860F876c9c0a2a617E7d9E945D4B" +const LP = "0x2FC8bC3eE171eD5610ba3093909421E90b47Fc07" +const treasuryBSC = "0xfd899c7c5ed84537e2acfc998ce26c3797654ae8" + +module.exports = treasuryExports({ + avax: { + tokens: [ + nullAddress, + ADDRESSES.avax.USDC_e + ], + owners: [treasuryAVAX], + }, + ethereum: { + tokens: [ + nullAddress, + "0x43Dfc4159D86F3A37A5A4B3D4580b888ad7d4DDd", + ADDRESSES.ethereum.USDC + + ], + owners: [treasuryETH], + ownTokens: [WOO, LP], + resolveLP: true, + resolveUniV3: true, + }, + bsc: { + tokens: [ + nullAddress, + ADDRESSES.bsc.USDC + ], + owners: [treasuryBSC], + ownTokens: [WOOBSC], + }, +}) \ No newline at end of file diff --git a/projects/treasury/x7.js b/projects/treasury/x7.js new file mode 100644 index 00000000000..58a178aa508 --- /dev/null +++ b/projects/treasury/x7.js @@ -0,0 +1,19 @@ +const { sumTokensExport, nullAddress } = require("../helper/unwrapLPs"); + +const owners = Object.values({ + X7TreasurySplitterAddress: "0x70006b785aa87821331a974c3d5af81cde5bb999", + DeveloperMultiSigWalletAddress: + "0x5cf4288bf373bbe17f76948e39baf33b9f6ac2e0", + CommmunityMultiSigWalletAddress: + "0x7063E83dF5349833A21f744398fD39D42fbC00f8", + LendingPoolReserveAddress: "0x7Ca54e9Aa3128bF15f764fa0f0f93e72b5267000", + RewardsPoolAddress: "0x70000299ee8910ccacd97b1bb560e34f49c9e4f7", +}) + +module.exports = {}; + +['arbitrum', 'polygon', 'ethereum', 'bsc', 'optimism'].forEach(chain => { + module.exports[chain] = { + tvl: sumTokensExport({ owners, tokens: [nullAddress], }) + } +}) \ No newline at end of file diff --git a/projects/treasury/xeus.js b/projects/treasury/xeus.js new file mode 100644 index 00000000000..c627ecbf56e --- /dev/null +++ b/projects/treasury/xeus.js @@ -0,0 +1,4 @@ +const index = require('../xeus/index') +const { ohmTreasury } = require('../helper/treasury') + +module.exports = ohmTreasury(index) \ No newline at end of file diff --git a/projects/treasury/y2k.js b/projects/treasury/y2k.js new file mode 100644 index 00000000000..f757f76f14e --- /dev/null +++ b/projects/treasury/y2k.js @@ -0,0 +1,19 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress,treasuryExports } = require("../helper/treasury"); + +module.exports = treasuryExports({ + arbitrum: { + tokens: [ + nullAddress, + ADDRESSES.arbitrum.USDC, // USDC + ADDRESSES.arbitrum.WETH, // WETH + ADDRESSES.arbitrum.USDT, // USDT + ADDRESSES.optimism.DAI, // DAI + '0x569061e2d807881f4a33e1cbe1063bc614cb75a4', + '0xfb5e6d0c1dfed2ba000fbc040ab8df3615ac329c', + '0xfb5e6d0c1dfed2ba000fbc040ab8df3615ac329c', + ], + owners: ['0x5c84cf4d91dc0acde638363ec804792bb2108258'], + ownTokens: ['0x65c936f008bc34fe819bce9fa5afd9dc2d49977f'], + }, +}) \ No newline at end of file diff --git a/projects/treasury/yam-finance.js b/projects/treasury/yam-finance.js new file mode 100644 index 00000000000..21299347f54 --- /dev/null +++ b/projects/treasury/yam-finance.js @@ -0,0 +1,18 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress,treasuryExports } = require("../helper/treasury"); + +const treasury ="0x744d16d200175d20e6d8e5f405aefb4eb7a962d1" +const treasury2 = "0x97990b693835da58a281636296d2bf02787dea17" +const YAM = "0x0AaCfbeC6a24756c20D41914F2caba817C0d8521" + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.USDC, + + ], + owners: [treasury, treasury2], + ownTokens: [YAM], + }, +}) \ No newline at end of file diff --git a/projects/treasury/yearn.js b/projects/treasury/yearn.js new file mode 100644 index 00000000000..7889fee6fbc --- /dev/null +++ b/projects/treasury/yearn.js @@ -0,0 +1,33 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress,treasuryExports } = require("../helper/treasury"); + +const yearnTreasury = "0x93a62da5a14c80f265dabc077fcee437b1a0efde"; +const yearnTreasury1 = "0xFEB4acf3df3cDEA7399794D0869ef76A6EfAff52"; +const yearnTreasuryarb = "0xb6bc033d34733329971b938fef32fad7e98e56ad"; + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.DAI, + '0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490',//3crv + ADDRESSES.ethereum.WETH, + ADDRESSES.ethereum.USDT, + ADDRESSES.ethereum.CRV, + '0xba100000625a3754423978a60c9317c58a424e3D',//BAL + '0x31429d1856aD1377A8A0079410B297e1a9e214c2',//ANGLE + ADDRESSES.ethereum.sUSD, + ADDRESSES.ethereum.WBTC, + ], + owners: [yearnTreasury,yearnTreasury1], + ownTokens: [ADDRESSES.ethereum.YFI], + fetchTokens: true, + }, + arbitrum: { + tokens: [ + nullAddress + ], + owners: [yearnTreasuryarb] + } +}) \ No newline at end of file diff --git a/projects/treasury/yield-guild-game.js b/projects/treasury/yield-guild-game.js new file mode 100644 index 00000000000..d9d8cae7d2e --- /dev/null +++ b/projects/treasury/yield-guild-game.js @@ -0,0 +1,57 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const Treasury = "0xe30ed74c6633a1b0d34a71c50889f9f0fdb7d68a"; +const YGG = "0x25f8087EAD173b73D6e8B84329989A8eEA16CF73"; +const Treasury1 = "0xf0103243f4d22b5696588646b21313d85916a16a" +const Treasury2 = "0x16b281438c5984a46d94acc6c4b31e252a03dfcf" +const Treasury3 = "0xcafeacdadd29f55ce935492e20f1f982df3fb51d" +const Treasury4 = "0x23eb4e02c29e69452718cd5caf2255488bc7ce3a" +const Treasury5 = "0xb981290d9d804075986482f0302c03a3cd2aff32" +const Treasury6 = "0x21653e2f0472afaf64ec85f585f0db4ab83a83f0" +const Treasury7 = "0x8e8d8015a7ffa49c83ee7a8773b0f69380cc6552" + + +const treasurySolana = "GvAm8xG5BSWXy286jWXWzYpN2xzPADQEoK9U8dQCDtzt" +const treasurySolana1 = "3fGSv3VdKvf7KSMt1o9Lb3dZ4YK9ScUTWktcrC4JJBTq" + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.DAI,//DAI + ADDRESSES.ethereum.STETH,//stETH + ADDRESSES.ethereum.MATIC,//MATIC + ADDRESSES.ethereum.USDC,//USDC + ADDRESSES.ethereum.USDT, + '0x61E90A50137E1F645c9eF4a0d3A4f01477738406',//loka + '0xbA6B0dbb2bA8dAA8F5D6817946393Aef8D3A4487',//HSF + '0x232FB065D9d24c34708eeDbF03724f2e95ABE768',//SHEESHA + '0x0d02755a5700414B26FF040e1dE35D337DF56218' //BEND + ], + owners: [Treasury, Treasury1, Treasury2, Treasury3, Treasury5, Treasury6, Treasury7], + ownTokens: [YGG], + }, + solana: { + tokens: [ + "7dHbWXmci3dT8UFYWYZweBLXgycu7Y3iL6trKn1Y7ARj" + ], + owners: [treasurySolana, treasurySolana1], + }, + optimism: { + tokens: [ + ADDRESSES.optimism.OP, + ADDRESSES.optimism.WETH + ], + owners: [Treasury1], + }, + polygon: { + tokens: [ + ADDRESSES.polygon.WETH_1, + "0x8dF3aad3a84da6b69A4DA8aeC3eA40d9091B2Ac4", + ADDRESSES.polygon.WMATIC_2, + "0x0b3F868E0BE5597D5DB7fEB59E1CADBb0fdDa50a" + ], + owners: [Treasury2, Treasury4], + }, +}) \ No newline at end of file diff --git a/projects/treasury/zachxtb-theman.js b/projects/treasury/zachxtb-theman.js new file mode 100644 index 00000000000..bb7338de540 --- /dev/null +++ b/projects/treasury/zachxtb-theman.js @@ -0,0 +1,41 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasuryOP = "0x9D727911B54C455B0071A7B682FcF4Bc444B5596"; +const treasuryETH = "0x9D727911B54C455B0071A7B682FcF4Bc444B5596" +const treasuryARB = "0x9D727911B54C455B0071A7B682FcF4Bc444B5596" + +module.exports = treasuryExports({ + optimism: { + tokens: [ + nullAddress, + ADDRESSES.optimism.USDC, // USDC + ADDRESSES.optimism.OP + ], + owners: [treasuryOP], + }, + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.USDC, // USDC + ADDRESSES.ethereum.WETH, + ADDRESSES.ethereum.TUSD, + ADDRESSES.ethereum.DAI, + ADDRESSES.ethereum.USDT, + "0xE80C0cd204D654CEbe8dd64A4857cAb6Be8345a3", + ADDRESSES.ethereum.WBTC, + "0xC0c293ce456fF0ED870ADd98a0828Dd4d2903DBF", //AURA + "0xB6eD7644C69416d67B522e20bC294A9a9B405B31", //0XBTC + ], + owners: [treasuryETH], + }, + arbitrum: { + tokens: [ + nullAddress, + ADDRESSES.arbitrum.USDC, // USDC + ADDRESSES.arbitrum.USDC_CIRCLE, + ADDRESSES.arbitrum.WETH + ], + owners: [treasuryARB], + }, +}); \ No newline at end of file diff --git a/projects/treasury/zero-swap.js b/projects/treasury/zero-swap.js new file mode 100644 index 00000000000..634bfcdb6c2 --- /dev/null +++ b/projects/treasury/zero-swap.js @@ -0,0 +1,12 @@ +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0x70f4f7a85100348fc33f1d8005703c8953bc67fd"; + +module.exports = treasuryExports({ + arbitrum: { + tokens: [ + nullAddress, + ], + owners: [treasury,], + }, +}) \ No newline at end of file diff --git a/projects/treasury/zigzag.js b/projects/treasury/zigzag.js new file mode 100644 index 00000000000..5164d62cab2 --- /dev/null +++ b/projects/treasury/zigzag.js @@ -0,0 +1,11 @@ +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + ], + owners: ['0xF203f949C1c4cA53B960C1ba33cB6455Bb9b0079'], + ownTokens: ['0xc91a71a1ffa3d8b22ba615ba1b9c01b2bbbf55ad'], + }, +}) diff --git a/projects/treasury/zyber-swap.js b/projects/treasury/zyber-swap.js new file mode 100644 index 00000000000..a313ffcc4bd --- /dev/null +++ b/projects/treasury/zyber-swap.js @@ -0,0 +1,12 @@ +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0x5be4fb908a43d61b1c8086fe62e39ae8ec483926"; + +module.exports = treasuryExports({ + arbitrum: { + tokens: [ + nullAddress, + ], + owners: [treasury,], + }, +}) \ No newline at end of file diff --git a/projects/treedefi/abi.json b/projects/treedefi/abi.json index 023bd2e8959..46be3a9df55 100644 --- a/projects/treedefi/abi.json +++ b/projects/treedefi/abi.json @@ -1,54 +1,4 @@ { - "poolInfo": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "poolInfo", - "outputs": [ - { - "internalType": "contract IBEP20", - "name": "lpToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "allocPoint", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastRewardBlock", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accTreePerShare", - "type": "uint256" - }, - { - "internalType": "uint16", - "name": "depositFeeBP", - "type": "uint16" - } - ], - "stateMutability": "view", - "type": "function" - }, - "poolLength": { - "inputs": [], - "name": "poolLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -} + "poolInfo": "function poolInfo(uint256) view returns (address lpToken, uint256 allocPoint, uint256 lastRewardBlock, uint256 accTreePerShare, uint16 depositFeeBP)", + "poolLength": "uint256:poolLength" +} \ No newline at end of file diff --git a/projects/treehousefinance/index.js b/projects/treehousefinance/index.js index 538fb4b77c3..86ec1db83e5 100644 --- a/projects/treehousefinance/index.js +++ b/projects/treehousefinance/index.js @@ -6,4 +6,7 @@ const leaf = "0x1777850a0c498D38424CeA45fd324C68f06D0830" module.exports = { ...masterChefExports(chef, "avax", leaf, false), methodology: "TVL includes all farms in MasterChef contract", + hallmarks: [ + [1647043200, "Rug Pull"] + ] } \ No newline at end of file diff --git a/projects/tribe3/index.js b/projects/tribe3/index.js new file mode 100644 index 00000000000..ef871bd6ded --- /dev/null +++ b/projects/tribe3/index.js @@ -0,0 +1,15 @@ +const ADDRESSES = require('../helper/coreAssets.json'); +const { sumTokensExport } = require('../helper/sumTokens'); + +module.exports = { + arbitrum: { + tvl: sumTokensExport({ + tokensAndOwners: [ + // DEX + [ADDRESSES.arbitrum.WETH, '0x01b6407adf740d135ddf1ebdd1529407845773f3'], + // Insurance fund + [ADDRESSES.arbitrum.WETH, '0x3af692a5ab2da34f742686bd4a77b5e609ee9ec6'], + ] + }) + }, +}; diff --git a/projects/trickortreat/index.js b/projects/trickortreat/index.js index fee39b78019..a54b8a2d279 100644 --- a/projects/trickortreat/index.js +++ b/projects/trickortreat/index.js @@ -1,4 +1,3 @@ -const sdk = require("@defillama/sdk"); const {addFundsInMasterChef} = require("../helper/masterchef"); const {pool2BalanceFromMasterChefExports} = require("../helper/pool2"); const {staking} = require("../helper/staking"); @@ -6,42 +5,9 @@ const {staking} = require("../helper/staking"); const masterchef = "0x2755AC6BD7BDbaCbdE08504f45f73D150Ee660F5"; const trick = "0xA5aFce54270D9afA6a80464bBD383BE506888e6A"; -const translate = { - "fantom:0x8D11eC38a3EB5E956B052f67Da8Bdc9bef8Abf3E": "0x6b175474e89094c44da98b954eedeac495271d0f", - "fantom:0xb3654dc3D10Ea7645f8319668E8F54d2574FBdC8": "0x514910771af9ca656af840dff83e8264ecf986ca" -} - -const wMEMO = "0x0da67235dd5787d67955420c84ca1cecd4e5bb3b" -const time = "avax:0xb54f16fb19478766a268f172c9480f8da1a7c9c3"; - -const wsSPA= "0x89346b51a54263cf2e92da79b1863759efa68692"; -const spa = "fantom:0x5602df4a94eb6c680190accfa2a475621e0ddbdc"; - async function tvl (timestamp, block, chainBlocks) { let balances = {}; await addFundsInMasterChef(balances, masterchef, chainBlocks.fantom, "fantom", addr=>`fantom:${addr}`, undefined, [trick], true, true, trick); - for (let key in translate) { - balances[translate[key]] = balances[key]; - delete balances[key] - } - const memo = (await sdk.api.abi.call({ - target: wMEMO, - params: [balances["fantom:0xDDc0385169797937066bBd8EF409b5B3c0dFEB52"]], - abi:{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"wMEMOToMEMO","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}, - block: chainBlocks.avax, - chain: "avax", - })).output; - balances[time] = memo - delete balances["fantom:0xDDc0385169797937066bBd8EF409b5B3c0dFEB52"]; - const sSPA = (await sdk.api.abi.call({ - target: wsSPA, - params:[balances["fantom:0x89346B51A54263cF2e92dA79B1863759eFa68692"]], - abi: {"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"wOHMTosOHM","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}, - block: chainBlocks.fantom, - chain: "fantom" - })).output; - balances[spa] = sSPA; - delete balances["fantom:0x89346B51A54263cF2e92dA79B1863759eFa68692"]; return balances; } diff --git a/projects/tropicalfinance/index.js b/projects/tropicalfinance/index.js index 0b1c154cb28..b86658f4e0a 100644 --- a/projects/tropicalfinance/index.js +++ b/projects/tropicalfinance/index.js @@ -1,18 +1,19 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk'); const { getUniTVL } = require('../helper/unknownTokens') const { default: BigNumber } = require('bignumber.js'); const { staking } = require('../helper/staking') -const WBCH = "0x3743eC0673453E5009310C727Ba4eaF7b3a1cc04"; -const DAIQUIRI = "0x24d8d5Cbc14FA6A740c3375733f0287188F8dF3b"; +const WBCH = ADDRESSES.smartbch.WBCH; +const DAIQUIRI = ADDRESSES.smartbch.DAIQUIRI; const MARGARITA = "0xe935C33b314330C773f9A135C0c8D8E857588609"; const FACTORY = "0x138504000feaEd02AD75B1e8BDb904f51C445F4C"; const MASTERCHEF_DAIQUIRI = "0xE4D74Af73114F72bD0172fc7904852Ee2E2b47B0"; const MASTERCHEF_MARGARITA = "0x428a6C7dEEdB7c26948c1e72Bba8d5FB5e7b6B0A" const COREASSETNAME = "bitcoin-cash"; const CHAIN = "smartbch"; -const FLEXUSD = "0x7b2B3C5308ab5b2a1d9a94d20D35CCDf61e05b72"; -const LAW = "0x0b00366fBF7037E9d75E4A569ab27dAB84759302"; +const FLEXUSD = ADDRESSES.smartbch.flexUSD; +const LAW = ADDRESSES.smartbch.LAW; const CLY = "0x7642Df81b5BEAeEb331cc5A104bd13Ba68c34B91"; const bchMasterChef = async (timestamp, ethBlock, {[CHAIN]: block}) => { @@ -39,7 +40,7 @@ module.exports = { methodology: "Factory address (" + FACTORY + ") is used to find the LP pairs on smartBCH. TVL is equal to DEX liquidity plus the staked amounts across Pools and Farms in Daiquiri and Margarita Masterchefs. Non-native tokens staked in masterchefs are counted towards staking.", smartbch: { tvl: sdk.util.sumChainTvls([bchDexTvl, bchMasterChef]), - masterchef: bchMasterChef, + // masterchef: bchMasterChef, staking: sdk.util.sumChainTvls([ staking(MASTERCHEF_DAIQUIRI, DAIQUIRI, "smartbch", "tropical-finance", 18), staking(MASTERCHEF_DAIQUIRI, FLEXUSD, "smartbch", "flex-usd", 18), diff --git a/projects/tropykus-zkevm/index.js b/projects/tropykus-zkevm/index.js new file mode 100644 index 00000000000..70dce7d0755 --- /dev/null +++ b/projects/tropykus-zkevm/index.js @@ -0,0 +1,6 @@ +const { aaveExports } = require('../helper/aave'); + +module.exports = { + methodology: `Counts the tokens locked in the contracts to be used as collateral to borrow or to earn yield. Borrowed coins are not counted towards the TVL, so only the coins actually locked in the contracts are counted. There's multiple reasons behind this but one of the main ones is to avoid inflating the TVL through cycled lending`, + polygon_zkevm: aaveExports("polygon_zkevm", "0x4Dac514F520D051551372d277d1b2Fa3cF2AfdFF"), +} \ No newline at end of file diff --git a/projects/tropykus/index.js b/projects/tropykus/index.js index 28c69da162d..f0bb4e9dbd7 100644 --- a/projects/tropykus/index.js +++ b/projects/tropykus/index.js @@ -1,7 +1,5 @@ const { usdCompoundExports } = require('../helper/compound') module.exports = { - rsk: { - ...usdCompoundExports("0x962308fEf8edFaDD705384840e7701F8f39eD0c0", "rsk"), - } -} + rsk: usdCompoundExports("0x962308fEf8edFaDD705384840e7701F8f39eD0c0", "rsk"), +} \ No newline at end of file diff --git a/projects/troydefi/index.js b/projects/troydefi/index.js index 20082ec3481..74c165ff966 100644 --- a/projects/troydefi/index.js +++ b/projects/troydefi/index.js @@ -5,5 +5,5 @@ const token = "0x576BB65B52425d59AC4c702376F88c527f5C7773"; module.exports = { misrepresentedTokens: true, - ...masterChefExports(masterchef, "bsc", token, false) + ...masterChefExports(masterchef, "bsc", token) } \ No newline at end of file diff --git a/projects/truefeedback/index.js b/projects/truefeedback/index.js new file mode 100644 index 00000000000..b8df3732208 --- /dev/null +++ b/projects/truefeedback/index.js @@ -0,0 +1,12 @@ +const { staking } = require('../helper/staking') + +module.exports = { + celo: { + tvl: () => 0, + staking: staking('0x588069878442856b683ab39f410ed96b72fb542a', '0xbdd31effb9e9f7509feaac5b4091b31645a47e4b', undefined, 'truefeedbackchain', 18), + }, + kava: { + staking: staking('0x067543c3D97753dDA22A2cF6a806f47BD6A17B6A', '0xbd10F04B8b5027761fCAAd42421aD5d0787211Ee', undefined, 'truefeedbackchain', 18), + }, +}; + diff --git a/projects/truefi/abi.json b/projects/truefi/abi.json index 32ab22b3840..79f9b905687 100644 --- a/projects/truefi/abi.json +++ b/projects/truefi/abi.json @@ -1,93 +1,9 @@ { - "token": { - "inputs": [], - "name": "token", - "outputs": [ - { - "internalType": "contract ERC20", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getPortfolios": { - "inputs": [], - "name": "getPortfolios", - "outputs": [ - { - "internalType": "contract IManagedPortfolio[]", - "name": "", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - "loansValue": { - "inputs": [], - "name": "loansValue", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "currencyBalance": { - "inputs": [], - "name": "currencyBalance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "underlyingToken": { - "inputs": [], - "name": "underlyingToken", - "outputs": [ - { - "internalType": "contract IERC20WithDecimals", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "illiquidValue": { - "inputs": [], - "name": "illiquidValue", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "liquidValue": { - "inputs": [], - "name": "liquidValue", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } + "token": "address:token", + "getPortfolios": "address[]:getPortfolios", + "loansValue": "uint256:loansValue", + "currencyBalance": "uint256:currencyBalance", + "underlyingToken": "address:underlyingToken", + "illiquidValue": "uint256:illiquidValue", + "liquidValue": "uint256:liquidValue" } \ No newline at end of file diff --git a/projects/trufin-trustake/index.js b/projects/trufin-trustake/index.js new file mode 100644 index 00000000000..e218d2f7b67 --- /dev/null +++ b/projects/trufin-trustake/index.js @@ -0,0 +1,24 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const abi = { + "totalShares": "uint256:totalShares", + "sharePrice": "function sharePrice() external view returns (uint256, uint256)", + "getDust": "uint256:getDust" +} + +const TRUSTAKE_CONTRACT_ADDR = "0xa43a7c62d56df036c187e1966c03e2799d8987ed" +const MATIC_TOKEN_ADDR = ADDRESSES.ethereum.MATIC + +async function tvl(timestamp, block, chainBlocks, { api }) { + const totalSupply = (await api.call({ abi: 'erc20:totalSupply', target: TRUSTAKE_CONTRACT_ADDR, })) + const sharePriceArray = (await api.call({ abi: abi.sharePrice, target: TRUSTAKE_CONTRACT_ADDR, })) + const dust = (await api.call({ abi: abi.getDust, target: TRUSTAKE_CONTRACT_ADDR, })) + const sharePrice = sharePriceArray[0] / sharePriceArray[1] / 1e18 + api.add(MATIC_TOKEN_ADDR, (totalSupply * sharePrice) + +dust) +} + +module.exports = { + methodology: `Counts the TVL of MATIC tokens in TruFin's TruStake vault.`, + ethereum: { + tvl + } +} diff --git a/projects/trufin/abi.json b/projects/trufin/abi.json new file mode 100644 index 00000000000..041894711c6 --- /dev/null +++ b/projects/trufin/abi.json @@ -0,0 +1,5 @@ +{ + "totalShares": "uint256:totalShares", + "sharePrice": "uint256:sharePrice", + "getDust": "uint256:getDust" +} diff --git a/projects/trufin/index.js b/projects/trufin/index.js new file mode 100644 index 00000000000..89ea9c5f50f --- /dev/null +++ b/projects/trufin/index.js @@ -0,0 +1,20 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const abi = require('./abi.json') + +const TRUSTAKE_CONTRACT_ADDR = "0xcfab8530ccf1f9936daede537d6ebbc75289006d" +const MATIC_TOKEN_ADDR = ADDRESSES.ethereum.MATIC + +async function tvl(timestamp, block, chainBlocks, { api }) { + const totalShares = (await api.call({ abi: abi.totalShares, target: TRUSTAKE_CONTRACT_ADDR, })) + const sharePrice = (await api.call({ abi: abi.sharePrice, target: TRUSTAKE_CONTRACT_ADDR, })) + const dust = (await api.call({ abi: abi.getDust, target: TRUSTAKE_CONTRACT_ADDR, })) + + api.add(MATIC_TOKEN_ADDR, (totalShares * sharePrice / 1e18) + +dust) +} + +module.exports = { + methodology: `Counts the TVL of MATIC tokens in TruFin's TruStake vault.`, + ethereum: { + tvl + } +} diff --git a/projects/trustswap/abi.json b/projects/trustswap/abi.json index 8f41a2bc924..08f8f5b06df 100644 --- a/projects/trustswap/abi.json +++ b/projects/trustswap/abi.json @@ -1,28 +1,4 @@ -{ - "token": { - "inputs": [], - "name": "token", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "currentTotalStake": { - "inputs": [], - "name": "currentTotalStake", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } +{ + "token": "address:token", + "currentTotalStake": "uint256:currentTotalStake" } \ No newline at end of file diff --git a/projects/trustswap/index.js b/projects/trustswap/index.js index 850c19ffa2b..56d6468f50c 100644 --- a/projects/trustswap/index.js +++ b/projects/trustswap/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); @@ -5,9 +6,9 @@ const staking_contract = "0x5A753021CE28CBC5A7c51f732ba83873D673d8cC"; const assets = [ // other tokens which probably for some reason was sent to the contract accidentally - "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", - "0xdac17f958d2ee523a2206206994597c13d831ec7", - "0x1f9840a85d5af5bf1d1762f925bdaddc4201f984", + ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.USDT, + ADDRESSES.ethereum.UNI, ]; const stakingTvl = async (timestamp, ethBlock, chainBlocks) => { @@ -50,7 +51,7 @@ async function ethTvl(timestamp, ethBlock, chainBlocks) { } return balances -}; +} module.exports = { diff --git a/projects/trxStakingGovernance/index.js b/projects/trxStakingGovernance/index.js index 55803d7611d..d551d855899 100644 --- a/projects/trxStakingGovernance/index.js +++ b/projects/trxStakingGovernance/index.js @@ -21,5 +21,8 @@ async function fetch(){ } module.exports = { + tron: { + fetch + }, fetch } \ No newline at end of file diff --git a/projects/tsunami-fi/index.js b/projects/tsunami-fi/index.js new file mode 100644 index 00000000000..b02dee7d69c --- /dev/null +++ b/projects/tsunami-fi/index.js @@ -0,0 +1,15 @@ +const { function_view, hexToString } = require('../helper/chain/aptos') + +async function tvl(_, _b, _cb, { api, }) { + const [data] = await function_view({ functionStr: '0x1786191d0ce793debfdef9890868abdcdc7053f982ccdd102a72732b3082f31d::basket::get_all_basket_coins_by_basket', type_arguments: ['0x1786191d0ce793debfdef9890868abdcdc7053f982ccdd102a72732b3082f31d::baskets::Basket1'] }) + data.forEach(({ coin_type_info: { account_address, module_name, struct_name }, reserve_amount, margin_occupied_amount, }) => { + const token = `${account_address}::${hexToString(module_name)}::${hexToString(struct_name)}` + api.add(token, reserve_amount) + // api.add(token, margin_occupied_amount * -1) + }) +} + + +module.exports = { + aptos: { tvl } +} \ No newline at end of file diff --git a/projects/ttswap/index.js b/projects/ttswap/index.js index 2e8e21b791a..3d55c03325e 100644 --- a/projects/ttswap/index.js +++ b/projects/ttswap/index.js @@ -1,19 +1,43 @@ -const sdk = require("@defillama/sdk"); -const utils = require("../helper/utils"); -const { toUSDTBalances } = require("../helper/balances"); +const { transformDexBalances } = require("../helper/portedTokens") +const { getLogs } = require('../helper/cache/getLogs') +const { nullAddress } = require("../helper/tokenMapping") +const sdk = require('@defillama/sdk') +const { sliceIntoChunks } = require("../helper/utils") -const api_url = "https://ttswap.space/api/info/?1634761489353"; +async function tvl(_, _b, _cb, { api, }) { + const factory = '0xcE393b11872EE5020828e443f6Ec9DE58CD8b6c5' + const logs = await getLogs({ + api, + target: factory, + topic: 'NewExchange(address,address)', + eventAbi: 'event NewExchange(address indexed token, address indexed exchange)', + onlyArgs: true, + fromBlock: 13154136, + }) + const calls = logs.map(i => ({ target: i.token, params: i.exchange })).filter(i => i.target.toLowerCase() !== '0xcE393b11872EE5020828e443f6Ec9DE58CD8b6c5'.toLowerCase()) + const allToken1Res = await api.multiCall({ abi: 'erc20:balanceOf', calls }) + const tokenFilter = (_, i) => allToken1Res[i] && +allToken1Res[i] > 0 + const token1s = calls.map(i => i.target).filter(tokenFilter) + const exchanges = calls.map(i => i.params).filter(tokenFilter) + const token1Res = allToken1Res.filter(tokenFilter) + let { output: token0Res } = await sdk.api.eth.getBalances({ ...api, targets: exchanges, }) + token0Res = token0Res.map(i => i.balance) -const thundercoreTvl = async () => { - const tvl = (await utils.fetchURL(api_url)).data.data.overview.liquidity; - return toUSDTBalances(tvl); -}; + sdk.log(token1s.length) + const data = [] + token1s.map((v, i) => { + data.push({ + token0: nullAddress, + token1: v, + token0Bal: token0Res[i], + token1Bal: token1Res[i], + }) + }) + // const pairs = (await api.fetchList({ lengthAbi: 'uint256:tokenCount', itemAbi: "function getTokenWithId(uint256 token_id) view returns (address out)", target: factory })).filter(i => i !== nullAddress) + return transformDexBalances({ chain: api.chain, data }) +} module.exports = { - timetravel: false, - thundercore: { - tvl: thundercoreTvl, - }, - methodology: - "Counts the liquidity on all pairs. Metrics come from https://ttswap.space/#/stats", + misrepresentedTokens: true, + thundercore: { tvl }, } diff --git a/projects/turbos/index.js b/projects/turbos/index.js new file mode 100644 index 00000000000..a3bd84d7152 --- /dev/null +++ b/projects/turbos/index.js @@ -0,0 +1,32 @@ +const sui = require("../helper/chain/sui"); +const axios = require("axios"); + +async function getPoolFactoryConfig() { + const result = await axios.get( + "https://s3.amazonaws.com/app.turbos.finance/sdk/contract.json" + ); + return result.data.mainnet.contract.PoolConfig; +} + +async function tvl(_timestamp, _block, _chainBlocks, { api }) { + // const poolFactoryConfig = await getPoolFactoryConfig(); + const poolFactoryConfig = '0xc294552b2765353bcafa7c359cd28fd6bc237662e5db8f09877558d81669170c'; + const parent = await sui.getObject(poolFactoryConfig); + const poolFields = await sui.getDynamicFieldObjects({ + parent: parent.fields.pools.fields.id.id, + }); + const poolIds = poolFields.map((item) => item.fields.value.fields.pool_id); + const poolList = await sui.getObjects(poolIds); + poolList.forEach(({ type, fields }) => { + const [coinA, coinB] = type.replace(">", "").split("<")[1].split(", "); + api.add(coinA, fields.coin_a); + api.add(coinB, fields.coin_b); + }); +} + +module.exports = { + timetravel: false, + sui: { + tvl, + }, +}; diff --git a/projects/twindex/index.js b/projects/twindex/index.js index 91e3df84b74..44b14678398 100644 --- a/projects/twindex/index.js +++ b/projects/twindex/index.js @@ -1,15 +1,10 @@ const sdk = require("@defillama/sdk"); -const {calculateUniTvl} = require('../helper/calculateUniTvl.js') +const {uniTvlExport} = require('../helper/calculateUniTvl.js') const TWX = '0x41171d5770c4c68686d1af042ada88a45b02f82b' const MASTER_CHEF = '0x22A5C7376C76D2D7ddC88D314912217B20d6eEc0' const FACTORY_BSC = "0x4E66Fda7820c53C1a2F601F84918C375205Eac3E"; -async function bscTvl(timestamp, block, chainBlocks) { - return calculateUniTvl(addr=>`bsc:${addr}`, chainBlocks['bsc'], 'bsc', FACTORY_BSC, 0, true); -} - - async function poolsTvl(timestamp, ethBlock, chainBlocks) { const balances = {}; const stakedTWX = sdk.api.erc20.balanceOf({ @@ -25,7 +20,7 @@ async function poolsTvl(timestamp, ethBlock, chainBlocks) { module.exports = { misrepresentedTokens: true, bsc:{ - tvl: bscTvl, + tvl: uniTvlExport(FACTORY_BSC, 'bsc', true), staking: poolsTvl }, methodology: "TVL comes from the DEX liquidity pools, staking TVL is accounted as the TWX on 0x41171D5770C4c68686d1aF042Ada88a45B02f82b", diff --git a/projects/twtstake/index.js b/projects/twtstake/index.js new file mode 100644 index 00000000000..f0bfae4ff69 --- /dev/null +++ b/projects/twtstake/index.js @@ -0,0 +1,16 @@ +const { staking } = require("../helper/staking"); +const TWT_STAKE_CONTRACT = '0x5e7c3c55eb5c0ee10817d70e414f4b1ee22d5ce3'; +const TWT_TOKEN_CONTRACT = '0x4b0f1812e5df2a09796481ff14017e6005508003'; + +module.exports = { + hallmarks: [ + [1681948800, "TWTStake Flagged on Twitter"] + ], + timetravel: true, + misrepresentedTokens: false, + methodology: 'Counts the number of TWT tokens in the TWT Stake contract.', + start: 1000235, + bsc: { + tvl: staking(TWT_STAKE_CONTRACT,TWT_TOKEN_CONTRACT,"bsc") + } +}; diff --git a/projects/typus-finance/index.js b/projects/typus-finance/index.js new file mode 100644 index 00000000000..35b1a2c78a5 --- /dev/null +++ b/projects/typus-finance/index.js @@ -0,0 +1,48 @@ +const sui = require("../helper/chain/sui"); + +// const TYPUS_DOV_SINGLE_REGISTRY = +// "0xb44c0fa1ab40f7699be3dce02475965a636ed850348435abb3b797b273f6c551"; +const SINGLE_DEPOSIT_VAULT_REGISTRY = + "0x4ae62c4d67f9f5d7077626fcc6d450535c4df710da455a0a2bd2226558832629"; +const SINGLE_BID_VAULT_REGISTRY = + "0x2c8cdd00ced47e717420cd2fc54990b3b38e115e34a9209271063a59ddeeb059"; + +async function tvl(_, _1, _2, { api }) { + const depositVaultFields = await sui.getDynamicFieldObjects({ + parent: SINGLE_DEPOSIT_VAULT_REGISTRY, + }); + + const depositVaultIds = depositVaultFields.map((item) => item.fields.id.id); + + const depositVaults = await sui.getObjects(depositVaultIds); + + depositVaults.forEach(({ type, fields: { value: { fields }} }) => { + const coin = type.replace(">>", "").split(", ")[2]; + api.add(coin, fields.active_sub_vault.fields.balance) + api.add(coin, fields.deactivating_sub_vault.fields.balance) + api.add(coin, fields.inactive_sub_vault.fields.balance) + api.add(coin, fields.warmup_sub_vault.fields.balance) + }); + + const bidVaultFields = await sui.getDynamicFieldObjects({ + parent: SINGLE_BID_VAULT_REGISTRY, + }); + + const bidVaultIds = bidVaultFields.map((item) => item.fields.id.id); + + const bidVaults = await sui.getObjects(bidVaultIds); + + bidVaults.forEach(({ type, fields: { value: { fields }} }) => { + const coin = type.replace(">>", "").split(", ")[2]; + api.add(coin, fields.bidder_sub_vault.fields.balance) + api.add(coin, fields.premium_sub_vault.fields.balance) + api.add(coin, fields.performance_fee_sub_vault.fields.balance) + }); +} + +module.exports = { + timetravel: false, + sui: { + tvl, + }, +}; diff --git a/projects/tzwrap/tokens.js b/projects/tzwrap/tokens.js index 13277cf5743..4a9de541973 100644 --- a/projects/tzwrap/tokens.js +++ b/projects/tzwrap/tokens.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') // info taken from https://indexer.app.tzwrap.com/v1/configuration module.exports = [ @@ -5,126 +6,126 @@ module.exports = [ "ethereumSymbol": "LEO", "ethereumName": "Bitfinex LEO Token", "ethereumContractAddress": "0x2af5d2ad76741191d15dfe7bf6ac92d4bd912ca3", - "tezosWrappingContract": "KT18fp5rcTW7mbWDmzFwjLDUhs5MeJmagDSZ" + "tezosWrappingContract": ADDRESSES.tezos.AAVE }, { "ethereumSymbol": "BUSD", "ethereumName": "Binance USD", - "ethereumContractAddress": "0x4fabb145d64652a948d72533023f6e7a623c7c53", - "tezosWrappingContract": "KT1UsSfaXyqcjSVPeiD7U1bWgKy3taYN7NWY" + "ethereumContractAddress": ADDRESSES.ethereum.BUSD, + "tezosWrappingContract": ADDRESSES.tezos.WETH_e }, { "ethereumSymbol": "LINK", "ethereumName": "ChainLink Token", - "ethereumContractAddress": "0x514910771af9ca656af840dff83e8264ecf986ca", - "tezosWrappingContract": "KT1UsSfaXyqcjSVPeiD7U1bWgKy3taYN7NWY" + "ethereumContractAddress": ADDRESSES.ethereum.LINK, + "tezosWrappingContract": ADDRESSES.tezos.WETH_e }, { "ethereumSymbol": "DAI", "ethereumName": "Dai Stablecoin", - "ethereumContractAddress": "0x6b175474e89094c44da98b954eedeac495271d0f", - "tezosWrappingContract": "KT1UsSfaXyqcjSVPeiD7U1bWgKy3taYN7NWY" + "ethereumContractAddress": ADDRESSES.ethereum.DAI, + "tezosWrappingContract": ADDRESSES.tezos.WETH_e }, { "ethereumSymbol": "SUSHI", "ethereumName": "SushiToken", - "ethereumContractAddress": "0x6b3595068778dd592e39a122f4f5a5cf09c90fe2", - "tezosWrappingContract": "KT18fp5rcTW7mbWDmzFwjLDUhs5MeJmagDSZ" + "ethereumContractAddress": ADDRESSES.ethereum.SUSHI, + "tezosWrappingContract": ADDRESSES.tezos.AAVE }, { "ethereumSymbol": "HT", "ethereumName": "Huobi Token", "ethereumContractAddress": "0x6f259637dcd74c767781e37bc6133cd6a68aa161", - "tezosWrappingContract": "KT18fp5rcTW7mbWDmzFwjLDUhs5MeJmagDSZ" + "tezosWrappingContract": ADDRESSES.tezos.AAVE }, { "ethereumSymbol": "OKB", "ethereumName": "OKB", "ethereumContractAddress": "0x75231f58b43240c9718dd58b4967c5114342a86c", - "tezosWrappingContract": "KT18fp5rcTW7mbWDmzFwjLDUhs5MeJmagDSZ" + "tezosWrappingContract": ADDRESSES.tezos.AAVE }, { "ethereumSymbol": "AAVE", "ethereumName": "Aave Token", - "ethereumContractAddress": "0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9", - "tezosWrappingContract": "KT18fp5rcTW7mbWDmzFwjLDUhs5MeJmagDSZ" + "ethereumContractAddress": ADDRESSES.ethereum.AAVE, + "tezosWrappingContract": ADDRESSES.tezos.AAVE }, { "ethereumSymbol": "PAX", "ethereumName": "Paxos Standard", "ethereumContractAddress": "0x8e870d67f660d95d5be530380d0ec0bd388289e1", - "tezosWrappingContract": "KT18fp5rcTW7mbWDmzFwjLDUhs5MeJmagDSZ" + "tezosWrappingContract": ADDRESSES.tezos.AAVE }, { "ethereumSymbol": "MKR", "ethereumName": "Maker", - "ethereumContractAddress": "0x9f8f72aa9304c8b593d555f12ef6589cc3a579a2", - "tezosWrappingContract": "KT18fp5rcTW7mbWDmzFwjLDUhs5MeJmagDSZ" + "ethereumContractAddress": ADDRESSES.ethereum.MKR, + "tezosWrappingContract": ADDRESSES.tezos.AAVE }, { "ethereumSymbol": "HUSD", "ethereumName": "HUSD", "ethereumContractAddress": "0xdf574c24545e5ffecb9a659c229253d4111d87e1", - "tezosWrappingContract": "KT18fp5rcTW7mbWDmzFwjLDUhs5MeJmagDSZ" + "tezosWrappingContract": ADDRESSES.tezos.AAVE }, { "ethereumSymbol": "UNI", "ethereumName": "Uniswap", - "ethereumContractAddress": "0x1f9840a85d5af5bf1d1762f925bdaddc4201f984", - "tezosWrappingContract": "KT18fp5rcTW7mbWDmzFwjLDUhs5MeJmagDSZ" + "ethereumContractAddress": ADDRESSES.ethereum.UNI, + "tezosWrappingContract": ADDRESSES.tezos.AAVE }, { "ethereumSymbol": "WBTC", "ethereumName": "Wrapped BTC", - "ethereumContractAddress": "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599", - "tezosWrappingContract": "KT1UsSfaXyqcjSVPeiD7U1bWgKy3taYN7NWY" + "ethereumContractAddress": ADDRESSES.ethereum.WBTC, + "tezosWrappingContract": ADDRESSES.tezos.WETH_e }, { "ethereumSymbol": "FTT", "ethereumName": "FTX Token", "ethereumContractAddress": "0x50d1c9771902476076ecfc8b2a83ad6b9355a4c9", - "tezosWrappingContract": "KT18fp5rcTW7mbWDmzFwjLDUhs5MeJmagDSZ" + "tezosWrappingContract": ADDRESSES.tezos.AAVE }, { "ethereumSymbol": "MATIC", "ethereumName": "Matic Token", - "ethereumContractAddress": "0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0", - "tezosWrappingContract": "KT1UsSfaXyqcjSVPeiD7U1bWgKy3taYN7NWY" + "ethereumContractAddress": ADDRESSES.ethereum.MATIC, + "tezosWrappingContract": ADDRESSES.tezos.WETH_e }, { "ethereumSymbol": "CRO", "ethereumName": "Crypto.com Coin", "ethereumContractAddress": "0xa0b73e1ff0b80914ab6fe0444e65848c4c34450b", - "tezosWrappingContract": "KT18fp5rcTW7mbWDmzFwjLDUhs5MeJmagDSZ" + "tezosWrappingContract": ADDRESSES.tezos.AAVE }, { "ethereumSymbol": "USDC", "ethereumName": "USD Coin", - "ethereumContractAddress": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", - "tezosWrappingContract": "KT1UsSfaXyqcjSVPeiD7U1bWgKy3taYN7NWY" + "ethereumContractAddress": ADDRESSES.ethereum.USDC, + "tezosWrappingContract": ADDRESSES.tezos.WETH_e }, { "ethereumSymbol": "CEL", "ethereumName": "Celsius Network", "ethereumContractAddress": "0xaaaebe6fe48e54f431b0c390cfaf0b017d09d42d", - "tezosWrappingContract": "KT18fp5rcTW7mbWDmzFwjLDUhs5MeJmagDSZ" + "tezosWrappingContract": ADDRESSES.tezos.AAVE }, { "ethereumSymbol": "COMP", "ethereumName": "Compound", "ethereumContractAddress": "0xc00e94cb662c3520282e6f5717214004a7f26888", - "tezosWrappingContract": "KT18fp5rcTW7mbWDmzFwjLDUhs5MeJmagDSZ" + "tezosWrappingContract": ADDRESSES.tezos.AAVE }, { "ethereumSymbol": "WETH", "ethereumName": "Wrapped Ether", - "ethereumContractAddress": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", - "tezosWrappingContract": "KT1UsSfaXyqcjSVPeiD7U1bWgKy3taYN7NWY" + "ethereumContractAddress": ADDRESSES.ethereum.WETH, + "tezosWrappingContract": ADDRESSES.tezos.WETH_e }, { "ethereumSymbol": "USDT", "ethereumName": "Tether USD", - "ethereumContractAddress": "0xdac17f958d2ee523a2206206994597c13d831ec7", - "tezosWrappingContract": "KT1UsSfaXyqcjSVPeiD7U1bWgKy3taYN7NWY" + "ethereumContractAddress": ADDRESSES.ethereum.USDT, + "tezosWrappingContract": ADDRESSES.tezos.WETH_e } ] \ No newline at end of file diff --git a/projects/ubiquitydao/index.js b/projects/ubiquitydao/index.js index c66363cdce9..7b31e8314de 100644 --- a/projects/ubiquitydao/index.js +++ b/projects/ubiquitydao/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const crvPool = "0x20955CB69Ae1515962177D164dfC9522feef567E"; @@ -25,7 +26,7 @@ async function tvl(timestamp, block) { poolBalances.forEach((p) => { let token = p.input.target; if (token === "0x0F644658510c95CB46955e55D7BA9DDa9E9fBEc6") { - token = "0x6b175474e89094c44da98b954eedeac495271d0f"; + token = ADDRESSES.ethereum.DAI; } sdk.util.sumSingleBalance(balances, token, p.output); }); diff --git a/projects/ultronStakingHub/index.js b/projects/ultronStakingHub/index.js index 8a513d3f66f..28d215e849f 100644 --- a/projects/ultronStakingHub/index.js +++ b/projects/ultronStakingHub/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { staking } = require('../helper/unknownTokens') @@ -7,7 +8,7 @@ module.exports = { tvl: () => ({}), staking: staking({ owner: '0xd130811147bb87f313c555e5281b94b9e71b480a', - tokens: ['0x3a4F06431457de873B588846d139EC0d86275d54'], + tokens: [ADDRESSES.ultron.wULX], chain: 'ultron' }) } diff --git a/projects/ultronSwap/index.js b/projects/ultronSwap/index.js index 18e1c342a9c..163c65779ab 100644 --- a/projects/ultronSwap/index.js +++ b/projects/ultronSwap/index.js @@ -1,17 +1,16 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { getUniTVL, staking } = require('../helper/unknownTokens') module.exports = { misrepresentedTokens: true, ultron: { tvl: getUniTVL({ - chain: 'ultron', useDefaultCoreAssets: true, factory: '0xe1F0D4a5123Fd0834Be805d84520DFDCd8CF00b7', }), staking: staking({ owner: '0xf26E50c26Ed51AbeC4078380Ed1F13440011F2A1', - tokens: ['0x3a4F06431457de873B588846d139EC0d86275d54'], - chain: 'ultron' + tokens: [ADDRESSES.ultron.wULX], }) } }; \ No newline at end of file diff --git a/projects/uma/abi.json b/projects/uma/abi.json index ca16680cfe5..2fde3e235d3 100644 --- a/projects/uma/abi.json +++ b/projects/uma/abi.json @@ -1,54 +1,6 @@ { - "collateralCurrency": { - "inputs": [], - "name": "collateralCurrency", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "collateralToken": { - "inputs": [], - "name": "collateralToken", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "l1Token": { - "inputs": [], - "name": "l1Token", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "balanceOf": { - "inputs": [], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -} + "collateralCurrency": "address:collateralCurrency", + "collateralToken": "address:collateralToken", + "l1Token": "address:l1Token", + "balanceOf": "uint256:balanceOf" +} \ No newline at end of file diff --git a/projects/uma/index.js b/projects/uma/index.js index 302f117b489..f498c342af7 100644 --- a/projects/uma/index.js +++ b/projects/uma/index.js @@ -2,7 +2,8 @@ const sdk = require("@defillama/sdk"); const { sumTokens } = require("../helper/unwrapLPs"); const { requery } = require("../helper/requery"); const { getChainTransform } = require("../helper/portedTokens"); -const { getBlock } = require("../helper/getBlock"); +const { getBlock } = require("../helper/http"); +const { getLogs } = require('../helper/cache/getLogs') const abi = require("./abi"); const ethLspCreators = [ @@ -28,19 +29,18 @@ const ethEmpCreators = [ ]; // Captures TVL for EMP contracts on Ethereum -async function ethEmp(timestamp, block) { +async function ethEmp(timestamp, block, _1, { api }) { const balances = {}; for (let i = 0; i < ethEmpCreators.length; i++) { - const logs = await sdk.api.util.getLogs({ + const logs = await getLogs({ target: ethEmpCreators[i], topic: "CreatedExpiringMultiParty(address,address)", - keys: ["topics"], fromBlock: 9937650, - toBlock: block, + api, }); const collaterals = await sdk.api.abi.multiCall({ - calls: logs.output.map((poolLog) => ({ - target: `0x${poolLog[1].slice(26)}`, + calls: logs.map((poolLog) => ({ + target: `0x${poolLog.topics[1].slice(26)}`, })), block, abi: abi.collateralCurrency, @@ -58,19 +58,18 @@ async function ethEmp(timestamp, block) { } // Captures TVL for LSP contracts on Ethereum -async function ethLsp(timestamp, block) { +async function ethLsp(timestamp, block, _1, { api }) { const balances = {}; for (let i = 0; i < ethLspCreators.length; i++) { - const logs = await sdk.api.util.getLogs({ + const logs = await getLogs({ target: ethLspCreators[i], topic: "CreatedLongShortPair(address,address,address,address)", - keys: ["topics"], fromBlock: 12736035, - toBlock: block, + api, }); const collaterals = await sdk.api.abi.multiCall({ - calls: logs.output.map((poolLog) => ({ - target: `0x${poolLog[1].slice(26)}`, + calls: logs.map((poolLog) => ({ + target: `0x${poolLog.topics[1].slice(26)}`, })), block, abi: abi.collateralToken, @@ -88,22 +87,21 @@ async function ethLsp(timestamp, block) { } // Captures TVL for LSP contracts on Polygon -async function polygonLsp(timestamp, block, chainBlocks) { +async function polygonLsp(timestamp, block, chainBlocks, { api }) { const balances = {}; const transform = await getChainTransform('polygon'); + block = await getBlock(timestamp, "polygon", chainBlocks); + for (let i = 0; i < polygonLspCreators.length; i++) { - block = await getBlock(timestamp, "polygon", chainBlocks); - const logs = await sdk.api.util.getLogs({ + const logs = await getLogs({ target: polygonLspCreators[i], topic: "CreatedLongShortPair(address,address,address,address)", - keys: ["topics"], fromBlock: 16241492, - toBlock: block, - chain: "polygon", + api, }); const collaterals = await sdk.api.abi.multiCall({ - calls: logs.output.map((poolLog) => ({ - target: `0x${poolLog[1].slice(26)}`, + calls: logs.map((poolLog) => ({ + target: `0x${poolLog.topics[1].slice(26)}`, })), block, abi: abi.collateralToken, @@ -124,26 +122,24 @@ async function polygonLsp(timestamp, block, chainBlocks) { } // Captures TVL for LSP contracts on Boba -async function bobaLsp(timestamp, block, chainBlocks) { +async function bobaLsp(timestamp, block, chainBlocks, { api }) { const chain = "boba"; const balances = {}; const transform = await getChainTransform(chain); + block = await getBlock(timestamp, chain, chainBlocks); for (let i = 0; i < bobaLspCreators.length; i++) { const lspCreatorAddress = bobaLspCreators[i]; - block = await getBlock(timestamp, chain, chainBlocks); - const logs = await sdk.api.util.getLogs({ + const logs = await getLogs({ target: lspCreatorAddress, topic: "CreatedLongShortPair(address,address,address,address)", - keys: ["topics"], fromBlock: 291475, - toBlock: block, - chain, + api, }); const collaterals = await sdk.api.abi.multiCall({ - calls: logs.output.map((poolLog) => ({ - target: `0x${poolLog[1].slice(26)}`, + calls: logs.map((poolLog) => ({ + target: `0x${poolLog.topics[1].slice(26)}`, })), block, abi: abi.collateralToken, diff --git a/projects/umamifinance/abi.json b/projects/umamifinance/abi.json index 69b6adba53f..dda88359cae 100644 --- a/projects/umamifinance/abi.json +++ b/projects/umamifinance/abi.json @@ -1,15 +1,3 @@ { - "totalAssets": { - "inputs": [], - "name": "totalAssets", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -} + "totalAssets": "uint256:totalAssets" +} \ No newline at end of file diff --git a/projects/umamifinance/index.js b/projects/umamifinance/index.js index d7ff13b5a5d..c5c87f57c8d 100644 --- a/projects/umamifinance/index.js +++ b/projects/umamifinance/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { stakings } = require("../helper/staking"); const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); @@ -8,9 +9,18 @@ const mUMAMI = "0x2adabd6e8ce3e82f52d9998a7f64a90d294a92a4"; // UMAMI staking from when it was still ohm fork with rebasing mechanics. // There's still some staked tokens that are yet not unstaked and migrated. const OHM_STAKING_sUMAMI = "0xc9ecFeF2fac1E38b951B8C5f59294a8366Dfbd81"; +// glpUSDC vault is now deprecated const glpUSDC = "0x2e2153fd13459eba1f277ab9acd624f045d676ce"; -const glpInitBlock = 18703806 -const USDC = "0xff970a61a04b1ca14834a43f5de4533ebddb5cc8"; +const glpInitBlock = 18703806; +const USDC = ADDRESSES.arbitrum.USDC; + +const v2Vaults = [ + "0x727eD4eF04bB2a96Ec77e44C1a91dbB01B605e42", + "0xbb84D79159D6bBE1DE148Dc82640CaA677e06126", + "0x6a89FaF99587a12E6bB0351F2fA9006c6Cd12257", + "0xe0A21a475f8DA0ee7FA5af8C1809D8AC5257607d", + "0x37c0705A65948EA5e0Ae1aDd13552BCaD7711A23", +]; module.exports = { doublecounted: true, @@ -18,8 +28,8 @@ module.exports = { start: 1657027865, // UMAMI deployment block ts arbitrum: { staking: stakings([mUMAMI, OHM_STAKING_sUMAMI], UMAMI, "arbitrum"), - tvl: async (_, _b, { arbitrum: block }) => { - const balances = {} + tvl: async (_, _b, { arbitrum: block }, { api }) => { + const balances = {}; if (!block || block > glpInitBlock + 10) { const totalAssets = await sdk.api.abi.call({ @@ -28,10 +38,24 @@ module.exports = { chain: "arbitrum", block, }); - sdk.util.sumSingleBalance(balances, `arbitrum:${USDC}`, totalAssets.output) + sdk.util.sumSingleBalance( + balances, + `arbitrum:${USDC}`, + totalAssets.output + ); + } + + const assets = await api.multiCall({ abi: 'address:asset', calls: v2Vaults }); + const bals = await api.multiCall({ abi: 'uint256:totalAssets', calls: v2Vaults }); + for (let i = 0; i < assets.length; i++) { + sdk.util.sumSingleBalance( + balances, + `arbitrum:${assets[i]}`, + bals[i] + ); } - return balances + return balances; }, }, }; diff --git a/projects/umbria/abi.json b/projects/umbria/abi.json index 9f2d9aabafa..a3f8771ea5b 100644 --- a/projects/umbria/abi.json +++ b/projects/umbria/abi.json @@ -1,36 +1,3 @@ { - "poolInfo": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "poolInfo", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "lpToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "allocPoint", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastRewardBlock", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "rewardPerShare", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } + "poolInfo": "function poolInfo(uint256) view returns (address lpToken, uint256 allocPoint, uint256 lastRewardBlock, uint256 rewardPerShare)" } \ No newline at end of file diff --git a/projects/umee/index.js b/projects/umee/index.js new file mode 100644 index 00000000000..1fc6c6de6fd --- /dev/null +++ b/projects/umee/index.js @@ -0,0 +1,51 @@ +const sdk = require("@defillama/sdk"); +const { transformBalances } = require("../helper/portedTokens"); +const { aaveV2Export } = require("../helper/aave"); +const { queryV1Beta1 } = require("../helper/chain/cosmos"); + +let data; + +async function getData() { + if (!data) data = _getData() + return data + async function _getData() { + const { registry } = await queryV1Beta1({ url: '/leverage/v1/registered_tokens', chain: 'umee'}) + return Promise.all(registry.map(async i => { + const res = await queryV1Beta1({ url: '/leverage/v1/market_summary?denom='+i.base_denom, chain: 'umee'}) + return { + base_denom: i.base_denom, + borrowed: parseInt(res.borrowed), + supplied: parseInt(res.supplied), + exponent: parseInt(i.exponent), + } + })) + } +} + +async function tvl() { + const balances = {}; + const data = await getData(); + data.forEach((i) => + sdk.util.sumSingleBalance(balances, i.base_denom, i.supplied - i.borrowed) + ); + return transformBalances("umee", balances); +} + +async function borrowed() { + const balances = {}; + const data = await getData(); + data.forEach((i) => + sdk.util.sumSingleBalance(balances, i.base_denom, i.borrowed) + ); + return transformBalances("umee", balances); +} + +module.exports = { + timetravel: false, + methodology: "Total supplied assets - total borrowed assets", + umee: { + tvl, + borrowed, + }, + ethereum: aaveV2Export('0xe296db0a0e9a225202717e9812bf29ca4f333ba6', { fromBlock: 14216544, }), +}; diff --git a/projects/unamano/index.js b/projects/unamano/index.js new file mode 100644 index 00000000000..8b64744266e --- /dev/null +++ b/projects/unamano/index.js @@ -0,0 +1,16 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokens2 } = require('../helper/unwrapLPs') + +const abis = { + poolInfo: "function poolInfo(uint256) view returns (address candyToken, uint256 startBlock, uint256 endBlock, uint256 lastRewardBlock, uint256 accPerShare, uint256 candyPerBlock, uint256 lpSupply, uint256 candyBalance, uint256 le12, tuple(address creator, uint256 unlockTime, uint256 maximumStaking, uint8 status, address multisignatureWallet, address assetManagementAddr) una)", + poolLength: "uint256:poolLength", +} + +module.exports = { + ethereum:{ + tvl: async (_, b, cb, { api }) => { + const info = await api.fetchList({ lengthAbi: abis.poolLength, itemAbi: abis.poolInfo, target: '0x078aadff42c94b01f135b0ab1d4b794902c67c3f'}) + return sumTokens2({ api, tokens: [ADDRESSES.ethereum.STETH], owners: info.map(i => i.una.assetManagementAddr)}) + }, + }, +} diff --git a/projects/unbk/fantom-yields.js b/projects/unbk/fantom-yields.js index 8fff40fe1e5..9112413a9bb 100644 --- a/projects/unbk/fantom-yields.js +++ b/projects/unbk/fantom-yields.js @@ -1,13 +1,14 @@ +const ADDRESSES = require('../helper/coreAssets.json') module.exports = { fyields: [ { - yieldBearingAsset: "0x82f0B8B456c1A451378467398982d4834b6829c1", //MIM + yieldBearingAsset: ADDRESSES.fantom.MIM, //MIM yieldProxy: "0xf730167FC2aF7a02db63d3e8CE54179A70Ea72b7", chain: "fantom", router: "0xa2E7017FA7f38BE3eE2F6BBcA09BDBF286Bb46DD", }, { - yieldBearingAsset: "0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83", //WFTM + yieldBearingAsset: ADDRESSES.fantom.WFTM, //WFTM yieldProxy: "0xa6Dd261D8801457d4B66a6b5C262E04931C36E99", chain: "fantom", router: "0xa2E7017FA7f38BE3eE2F6BBcA09BDBF286Bb46DD", @@ -25,7 +26,7 @@ module.exports = { router: "0xa2E7017FA7f38BE3eE2F6BBcA09BDBF286Bb46DD", }, { - yieldBearingAsset: "0x04068DA6C83AFCFA0e13ba15A6696662335D5B75", //USDC + yieldBearingAsset: ADDRESSES.fantom.USDC, //USDC yieldProxy: "0xc0Cf1846134D90CDA5eC8244fe8c992F7A96500F", chain: "fantom", router: "0xa2E7017FA7f38BE3eE2F6BBcA09BDBF286Bb46DD", @@ -37,13 +38,13 @@ module.exports = { router: "0xa2E7017FA7f38BE3eE2F6BBcA09BDBF286Bb46DD", }, { - yieldBearingAsset: "0x049d68029688eAbF473097a2fC38ef61633A3C7A", //fUSDT + yieldBearingAsset: ADDRESSES.fantom.fUSDT, //fUSDT yieldProxy: "0xD30303241c53097FEa1f6D75f4f0a77FEF22d435", chain: "fantom", router: "0xa2E7017FA7f38BE3eE2F6BBcA09BDBF286Bb46DD", }, { - yieldBearingAsset: "0x8D11eC38a3EB5E956B052f67Da8Bdc9bef8Abf3E", //DAI + yieldBearingAsset: ADDRESSES.fantom.DAI, //DAI yieldProxy: "0xf58e5571FaEB95C703e0eBb4fDFC2eb7dB18FC53", chain: "fantom", router: "0xa2E7017FA7f38BE3eE2F6BBcA09BDBF286Bb46DD", diff --git a/projects/unbk/router-abi.js b/projects/unbk/router-abi.js index 17e292ec6e4..6533394b04d 100644 --- a/projects/unbk/router-abi.js +++ b/projects/unbk/router-abi.js @@ -1,26 +1,3 @@ module.exports = { - routerAbi: { - inputs: [ - { - internalType: "address", - name: "token", - type: "address", - }, - { - internalType: "address", - name: "account", - type: "address", - }, - ], - name: "totalVaultBalance", - outputs: [ - { - internalType: "uint256", - name: "balance", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, -}; + routerAbi: "function totalVaultBalance(address token, address account) view returns (uint256 balance)", +} \ No newline at end of file diff --git a/projects/unfederalreserve/index.js b/projects/unfederalreserve/index.js index 0796d56e0bd..baf5f92b33a 100644 --- a/projects/unfederalreserve/index.js +++ b/projects/unfederalreserve/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const {fullCoumpoundExports} = require('../helper/compound') -module.exports=fullCoumpoundExports("0x3105D328c66d8d55092358cF595d54608178E9B5", "ethereum", "0xFaCecE87e14B50eafc85C44C01702F5f485CA460", "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2") \ No newline at end of file +module.exports=fullCoumpoundExports("0x3105D328c66d8d55092358cF595d54608178E9B5", "ethereum", "0xFaCecE87e14B50eafc85C44C01702F5f485CA460", ADDRESSES.ethereum.WETH) \ No newline at end of file diff --git a/projects/unicrypt-v3/index.js b/projects/unicrypt-v3/index.js new file mode 100644 index 00000000000..ef338a99b76 --- /dev/null +++ b/projects/unicrypt-v3/index.js @@ -0,0 +1,27 @@ +const sdk = require('@defillama/sdk') +const { sumTokens2 } = require('../helper/unwrapLPs') +const { getCoreAssets } = require('../helper/tokenMapping') + +const config = { + ethereum: { reserves: ['0x231278edd38b00b07fbd52120cef685b9baebcc1'] }, + arbitrum: { reserves: ['0xfa104eb3925a27e6263e05acc88f2e983a890637'] }, + bsc: { reserves: ['0x0D29598EC01fa03665feEAD91d4Fb423F393886c'] }, + polygon: { reserves: ['0xc22218406983bf88bb634bb4bf15fa4e0a1a8c84'] }, +} + +module.exports = { + misrepresentedTokens: true, +} + +Object.keys(config).forEach(chain => { + const { reserves } = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const uniV3WhitelistedTokens = await getCoreAssets(api.chain) + const tempBalances = await sumTokens2({ api, owners: reserves, resolveUniV3: true, uniV3WhitelistedTokens, }) + const balances = {} // we multiple core assets value by 2 as positions are spread between 0 - ∞ + Object.entries(tempBalances).forEach(([token, balance]) => sdk.util.sumSingleBalance(balances, token, balance * 2)) + return balances + } + } +}) \ No newline at end of file diff --git a/projects/unicrypt/abis.js b/projects/unicrypt/abis.js index cdb523e6c69..ff1c2097654 100644 --- a/projects/unicrypt/abis.js +++ b/projects/unicrypt/abis.js @@ -1,74 +1,8 @@ -const getNumLockedTokens = { - "inputs": [], - "name": "getNumLockedTokens", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" -} - -const lockedTokensLength = { - "inputs": [], - "name": "lockedTokensLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" -} - -const getLockedTokenAtIndex = { - "inputs": [ - { - "internalType": "uint256", - "name": "_index", - "type": "uint256" - } - ], - "name": "getLockedTokenAtIndex", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" -} - - -const lockedToken = { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "lockedTokens", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" -} - - +const getNumLockedTokens = "uint256:getNumLockedTokens" +const lockedTokensLength = "uint256:lockedTokensLength" +const getLockedTokenAtIndex = 'function getLockedTokenAtIndex(uint256 _index) view returns (address)' +const lockedToken = 'function lockedTokens(uint256) view returns (address)' module.exports = { getLockedTokenAtIndex, diff --git a/projects/unicrypt/api.js b/projects/unicrypt/api.js index 018965088ee..047786b8e12 100644 --- a/projects/unicrypt/api.js +++ b/projects/unicrypt/api.js @@ -11,4 +11,4 @@ module.exports = { module.exports.bsc.pool2 = indexExports.bsc.pool2 module.exports.ethereum.pool2 = indexExports.ethereum.pool2 module.exports.ethereum.staking = indexExports.ethereum.staking -module.exports.xdai.pool2 = indexExports.xdai.pool2 \ No newline at end of file +module.exports.xdai.pool2 = indexExports.xdai.pool2 diff --git a/projects/unicrypt/apiCache.js b/projects/unicrypt/apiCache.js index 45fc7f34e2b..ee8b0331937 100644 --- a/projects/unicrypt/apiCache.js +++ b/projects/unicrypt/apiCache.js @@ -2,8 +2,9 @@ const sdk = require('@defillama/sdk'); const { config, protocolPairs, tokens, stakingContracts, ethereumContractData, bscContractData, polygonContractData, avalancheContractData, gnosisContractData } = require('./config') -const { getCache, setCache, vestingHelper } = require('../helper/cache'); -const project = 'unicrypt' + const { getCache, setCache, } = require("../helper/cache") + const { vestingHelper, } = require("../helper/unknownTokens") +const project = 'bulky/unicrypt' const { stakings } = require("../helper/staking"); const { pool2s } = require("../helper/pool2"); @@ -14,7 +15,7 @@ function tvl(args) { for (let i = 0; i < args.length; i++) { const chain = args[i].chain const contract = args[i].contract.toLowerCase() - const cache = getCache(project, chain) + const cache = await getCache(project, chain) if (!cache.vaults) cache.vaults = {} if (!cache.vaults[contract]) cache.vaults[contract] = { tokens: [] } const cCache = cache.vaults[contract] @@ -61,7 +62,7 @@ function tvl(args) { for (const [token, balance] of Object.entries(balances)) sdk.util.sumSingleBalance(totalBalances, token, balance) - setCache(project, chain, cache) + await setCache(project, chain, cache) } return totalBalances } diff --git a/projects/unicrypt/config.js b/projects/unicrypt/config.js index 27173207d19..bf1944cc9a3 100644 --- a/projects/unicrypt/config.js +++ b/projects/unicrypt/config.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') // const { ethereum } = require(".") const { getNumLockedTokens, getLockedTokenAtIndex, @@ -24,7 +25,7 @@ const { getNumLockedTokens, getLockedTokenAtIndex, const tokens = { uncx_eth: '0xaDB2437e6F65682B85F814fBc12FeC0508A7B1D0', - weth: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2' + weth: ADDRESSES.ethereum.WETH } const governanceTokens = { // UNCX diff --git a/projects/unidex/index.js b/projects/unidex/index.js index 19f7e85f575..f290b1702d9 100644 --- a/projects/unidex/index.js +++ b/projects/unidex/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens2, nullAddress, } = require('../helper/unwrapLPs') async function FantomTvl(_time, _ethBlock, { fantom: block }) { @@ -6,13 +7,52 @@ async function FantomTvl(_time, _ethBlock, { fantom: block }) { "usdcPool": "0x7A494C755911Ce06444C47248108439a06Ac028C", "daiPool": "0xc451df1b05828519c014cb967ef1a614bd41834d", }; - const usdc = "0x04068da6c83afcfa0e13ba15a6696662335d5b75"; - const dai = "0x8D11eC38a3EB5E956B052f67Da8Bdc9bef8Abf3E"; + const usdc = ADDRESSES.fantom.USDC; + const dai = ADDRESSES.fantom.DAI; const chain = 'fantom' const tokens = [usdc, dai, nullAddress] const owners = Object.values(contracts) return sumTokens2({ chain, block, tokens, owners, }) -}; +} + +async function ArbitrumTvl(_time, _ethBlock, { arbitrum: block }) { + const contracts = { + "ethPool": "0xdAF7D157F5c6E0F1d7917Ca02a7C185cEF81e6d0", + "usdcPool": "0x09E122453A079bc2Be621769ae7799e53dA0054E", + "daiPool": "0xb764729C6bEbd6E60E151F2c46aFce7D6Ff513fD", + "usdtPool": "0x9f6B9e253De52C5fD6c65283ff472b15520a7070", + "wbtcPool": "0xe736742Eb62F271c48F4a26168FD8F356AeE68db", + "arbPool": "0xF1Cb521C753e41906073eBEd30FE34BCB00845f8", + "mimPool": "0x266B30394da3D99a846dD30A2F7C50bb523c5dE1", + "gdaiPool": "0x7638Db20715c5AC09f52bE1E3a4DBb220680BdFd", + "ramPool": "0x914172b52262E867D8f2959D884e0ea73795B2c6", + "maiPool": "0xEfD0B28810dC3cdD88763f40DCc44462bb85Cf32", + "gmxPool": "0xDaa78E776D3788F9FBABDAc02aa6De45f7BC50C6", + "wstethPool": "0x53C6c525a635eF56Bce43d4523D90aACE551D81b", + "gnsPool": "0x13ff1aB07540b1681173003E361D046530506c11", + "capPool": "0x99DDb3E66A592579B9D46a47824042F62D690a9e", + "unshethPool": "0x5372Af9b4E9d4b9C016574Dad0f2406Dfe023D5F", + }; + const usdc = ADDRESSES.arbitrum.USDC; + const dai = ADDRESSES.optimism.DAI; + const usdt = ADDRESSES.arbitrum.USDT; + const wbtc = ADDRESSES.arbitrum.WBTC; + const arb = ADDRESSES.arbitrum.ARB; + const mim = ADDRESSES.arbitrum.MIM; + const gdai = "0xd85e038593d7a098614721eae955ec2022b9b91b"; + const ram = "0xaaa6c1e32c55a7bfa8066a6fae9b42650f262418"; + const mai = "0x5979D7b546E38E414F7E9822514be443A4800529"; + const gmx = ADDRESSES.arbitrum.GMX; + const wsteth = "0x5979D7b546E38E414F7E9822514be443A4800529"; + const gns = "0x18c11FD286C5EC11c3b683Caa813B77f5163A122"; + const cap = "0x031d35296154279dc1984dcd93e392b1f946737b"; + const unsheth = "0x0Ae38f7E10A43B5b2fB064B42a2f4514cbA909ef"; + + const chain = 'arbitrum' + const tokens = [usdc, dai, nullAddress, usdt, wbtc, arb, mim, gdai, ram, mai, gmx, wsteth, gns, cap, unsheth] + const owners = Object.values(contracts) + return sumTokens2({ chain, block, tokens, owners, }) +} async function BobaTvl(_time, _ethBlock, { boba: block }) { const contracts = { @@ -22,47 +62,61 @@ async function BobaTvl(_time, _ethBlock, { boba: block }) { const tokens = [nullAddress] const owners = Object.values(contracts) return sumTokens2({ chain, block, tokens, owners, }) -}; +} async function MetisTvl(_time, _ethBlock, { metis: block }) { const contracts = { "metisPool": "0x9Ba3db52BC401F4EF8ba23e56268C3AdE0290837", "wethPool": "0xb3D7D548dA38Dac2876Da57842a3cbaaf9a3bD96", }; - const weth = "0x420000000000000000000000000000000000000a"; + const weth = ADDRESSES.metis.WETH; const chain = 'metis' const tokens = [weth, nullAddress] const owners = Object.values(contracts) return sumTokens2({ chain, block, tokens, owners, }) -}; +} async function OpTvl(_time, _ethBlock, { optimism: block }) { const contracts = { "daiPool": "0xCdDF71750E596b4C38785afFEc3bd4C9bff43f6F", }; - const dai = "0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1"; + const dai = ADDRESSES.optimism.DAI; const chain = 'optimism' const tokens = [dai] const owners = Object.values(contracts) return sumTokens2({ chain, block, tokens, owners, }) -}; +} + +async function zkSyncTvl(_time, _ethBlock, { era: block }) { + const contracts = { + "usdcPool": "0xa41A6a4A04E711B53a82E594CeB525e89206627A", + }; + const usdc = ADDRESSES.era.USDC; + const chain = 'era' + const tokens = [usdc] + const owners = Object.values(contracts) + return sumTokens2({ chain, block, tokens, owners, }) +} async function BscTvl(_time, _ethBlock, { bsc: block }) { const contracts = { "busdPool": "0xa8D4bd632f394CED42BD439Bc34F09198072e519", }; - const busd = "0xe9e7cea3dedca5984780bafc599bd69add087d56"; + const busd = ADDRESSES.bsc.BUSD; const chain = 'bsc' const tokens = [busd] const owners = Object.values(contracts) return sumTokens2({ chain, block, tokens, owners, }) -}; +} module.exports = { methodology: "Assets staked in the pool and trading contracts", fantom: { tvl: FantomTvl }, + arbitrum: { + tvl: ArbitrumTvl + }, boba: { tvl: BobaTvl }, @@ -72,6 +126,9 @@ module.exports = { optimism: { tvl: OpTvl }, + era: { + tvl: zkSyncTvl + }, bsc: { tvl: BscTvl }, diff --git a/projects/unieth/index.js b/projects/unieth/index.js new file mode 100644 index 00000000000..fefa981271c --- /dev/null +++ b/projects/unieth/index.js @@ -0,0 +1,25 @@ +const { nullAddress } = require("../helper/tokenMapping"); + +const UNIETH_TOKEN = '0xf1376bcef0f78459c0ed0ba5ddce976f1ddf51f4'; +const UNIETH_STAKING = "0x4beFa2aA9c305238AA3E0b5D17eB20C045269E9d"; + +async function tvl(_, _1, _2, { api }) { + const totalSupply = await api.call({ + abi: 'erc20:totalSupply', + target: UNIETH_TOKEN, + }); + + const exchangeRatio = await api.call({ + abi: 'function exchangeRatio() external view returns (uint256)', + target: UNIETH_STAKING, + }); + + api.add(nullAddress, totalSupply * exchangeRatio / 1e18) +} + +module.exports = { + methodology: 'Counts the total ethers staked with RockX Staking Contract.', + ethereum: { + tvl, + } +}; diff --git a/projects/unifarm/helper.js b/projects/unifarm/helper.js index 719d58fcb4b..d73021b1fb8 100644 --- a/projects/unifarm/helper.js +++ b/projects/unifarm/helper.js @@ -9,8 +9,8 @@ const waitTime = 301 async function getAllV1Data() { return v1Data - if (!allV1Data) allV1Data = _getAllV1Data() - return allV1Data + // if (!allV1Data) allV1Data = _getAllV1Data() + // return allV1Data async function _getAllV1Data() { const data = {} diff --git a/projects/unifarm/index.js b/projects/unifarm/index.js index d4774b75362..755158db0cc 100644 --- a/projects/unifarm/index.js +++ b/projects/unifarm/index.js @@ -13,7 +13,7 @@ async function tvl(chain, block) { tokensAndOwners.push(...await getV2Calls(chain)) tokensAndOwners.push(...await createCallForSetu(chain)) return sumTokens2({ balances, tokensAndOwners, chain, block, resolveLP: true, }) -}; +} module.exports = { timetravel: false, diff --git a/projects/unifi-protocol-staking/index.js b/projects/unifi-protocol-staking/index.js new file mode 100644 index 00000000000..b52edc38924 --- /dev/null +++ b/projects/unifi-protocol-staking/index.js @@ -0,0 +1,32 @@ + + +const { get } = require('../helper/http') +const { toUSDTBalances } = require('../helper/balances') +let _stakedResponse + +const mapping = { + harmony: 'Harmony', + icon: 'Icon', + ontology: 'Ontology', + tron: 'Tron', + iotex: 'IoTeX', +} + +module.exports = { + timetravel: false, + misrepresentedTokens: true, +} + +function stakingChain(chain) { + module.exports[chain] = { + tvl: async () => { + if (!_stakedResponse) _stakedResponse = get('https://data.unifi.report/api/stake-data/grouped') + const { results } = await _stakedResponse + const blockchainName = mapping[chain] + const { delegated_stake_usd } = results.find(i => i.blockchain === blockchainName) + return toUSDTBalances(delegated_stake_usd) + } + } +} + +Object.keys(mapping).forEach(stakingChain) \ No newline at end of file diff --git a/projects/unifi-protocol/index.js b/projects/unifi-protocol/index.js index 1c08c6e1704..a40d5fe2aa8 100644 --- a/projects/unifi-protocol/index.js +++ b/projects/unifi-protocol/index.js @@ -1,43 +1,36 @@ const { getUniTVL } = require('../helper/unknownTokens') const { staking } = require('../helper/staking') -const { getTokenBalance } = require('../helper/chain/tron'); -const { toUSDTBalances } = require('../helper/balances') -const { get } = require('../helper/http') -const { mergeExports } = require('../helper/utils') const dexExports = { + timetravel: false, + misrepresentedTokens: true, avax: { tvl: getUniTVL({ factory: '0x839547067bc885db205F5fA42dcFeEcDFf5A8530', - chain: 'avax', useDefaultCoreAssets: true, }), }, bsc: { tvl: getUniTVL({ factory: '0xA5Ba037Ec16c45f8ae09e013C1849554C01385f5', - chain: 'bsc', useDefaultCoreAssets: true, }), }, iotex: { tvl: getUniTVL({ factory: '0x839547067bc885db205F5fA42dcFeEcDFf5A8530', - chain: 'iotex', useDefaultCoreAssets: true, }), }, ontology_evm: { tvl: getUniTVL({ factory: '0x839547067bc885db205F5fA42dcFeEcDFf5A8530', - chain: 'ontology_evm', useDefaultCoreAssets: true, }), }, ethereum: { tvl: getUniTVL({ factory: '0x08e7974CacF66C5a92a37c221A15D3c30C7d97e0', - chain: 'ethereum', useDefaultCoreAssets: true, }), staking: staking('0x2e2fb3db9ecdb9b7d9eb05e00964c8941f7171a7', '0x441761326490cACF7aF299725B6292597EE822c2') @@ -45,71 +38,33 @@ const dexExports = { fantom: { tvl: getUniTVL({ factory: '0x839547067bc885db205F5fA42dcFeEcDFf5A8530', - chain: 'fantom', useDefaultCoreAssets: true, }), }, harmony: { tvl: getUniTVL({ factory: '0x7aB6ef0cE51a2aDc5B673Bad7218C01AE9B04695', - chain: 'harmony', useDefaultCoreAssets: true, }), }, polygon: { tvl: getUniTVL({ factory: '0x4FEE52912f81B78C3CdcB723728926ED6a893D27', - chain: 'polygon', useDefaultCoreAssets: true, }), }, bittorrent: { tvl: getUniTVL({ factory: '0xCAaB36C77841647dC9955B3b1D03710E9B9F127f', - chain: 'bittorrent', useDefaultCoreAssets: true, }), }, tron: { - tvl: async () => { - return { - "tether": await getTokenBalance('TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t', 'TDrFhbM8kDiPtSx3Cgd71K3qwwu77bRdYQ'), - "tron": await getTokenBalance('TNUC9Qb1rRpS5CbWLmNMxXBjyFoydXjWFR', 'TDrFhbM8kDiPtSx3Cgd71K3qwwu77bRdYQ'), - } - } + tvl: getUniTVL({ + factory: 'TUtmsH4DZewoihrybFU2RG1pdW9sBhuSRZ', + useDefaultCoreAssets: true, + }), }, } - -let _stakedResponse - -const mapping = { - harmony: 'Harmony', - icon: 'Icon', - ontology: 'Ontology', - tron: 'Tron', - iotex: 'IoTeX', -} - -const stakingExports = {} - -function stakingChain(chain) { - stakingExports[chain] = { - tvl: async () => { - if (!_stakedResponse) _stakedResponse = get('https://data.unifi.report/api/stake-data/grouped') - const { results } = await _stakedResponse - const blockchainName = mapping[chain] - const { delegated_stake_usd } = results.find(i => i.blockchain === blockchainName) - return toUSDTBalances(delegated_stake_usd) - } - } -} - -Object.keys(mapping).forEach(stakingChain) - -module.exports = mergeExports([{ - timetravel: false, -}, - dexExports, - stakingExports, -]) +module.exports = dexExports \ No newline at end of file diff --git a/projects/unilend/index.js b/projects/unilend/index.js index 9974805c756..9d63407e3dc 100644 --- a/projects/unilend/index.js +++ b/projects/unilend/index.js @@ -1,3 +1,4 @@ +const { getConfig } = require('../helper/cache') const { fetchURL } = require("../helper/utils"); const { transformPolygonAddress, @@ -10,7 +11,7 @@ const UnilendContract = "0x13A145D215182924c89F2aBc7D358DCc72F8F788"; const API_URL = "https://unilend.finance/list.json"; const calcTvl = async (balances, Id, block, chain, transformAddr) => { - const tokenList = (await fetchURL(API_URL)).data.tokens + const tokenList = (await getConfig('unilend', API_URL)).tokens .filter((CHAIN) => CHAIN.chainId == Id) .map((token) => token.address); diff --git a/projects/union-finance/index.js b/projects/union-finance/index.js index 8aeb941a0bb..4b6a8e473cf 100644 --- a/projects/union-finance/index.js +++ b/projects/union-finance/index.js @@ -1,146 +1,56 @@ -const sdk = require("@defillama/sdk"); + +const ADDRESSES = require('../helper/coreAssets.json') const config = { ethereum: { userManager: "0x49c910Ba694789B58F53BFF80633f90B8631c195", - DAI: "0x6b175474e89094c44da98b954eedeac495271d0f", + DAI: ADDRESSES.ethereum.DAI, uDAI: "0x954F20DF58347b71bbC10c94827bE9EbC8706887", }, arbitrum: { userManager: "0xb71F3D4342AaE0b8D531E14D2CF2F45d6e458A5F", - DAI: "0x6b175474e89094c44da98b954eedeac495271d0f", + DAI: ADDRESSES.optimism.DAI, uDAI: "0x954F20DF58347b71bbC10c94827bE9EbC8706887", }, + optimism: { + userManager: "0x8E195D65b9932185Fcc76dB5144534e0f3597628", + DAI: ADDRESSES.optimism.DAI, + uDAI: "0xE478b5e7A423d7CDb224692d0a816CA146A744b2", + }, }; const abi = { - totalStaked: { - inputs: [], - name: "totalStaked", - outputs: [{ internalType: "uint256", name: "", type: "uint256" }], - stateMutability: "view", - type: "function", - }, - totalRedeemable: { - inputs: [], - name: "totalRedeemable", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, - totalReserves: { - inputs: [], - name: "totalReserves", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, - totalBorrows: { - inputs: [], - name: "totalBorrows", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, + totalStaked: "uint256:totalStaked", + totalRedeemable: "uint256:totalRedeemable", + totalReserves: "uint256:totalReserves", + totalBorrows: "uint256:totalBorrows", }; -function tvl(chain) { - return async function (_, __, chainBlocks) { - const chainBlock = chainBlocks[chain]; - - const { userManager, uDAI } = config[chain]; - - const totalStaked = ( - await sdk.api.abi.call({ - abi: abi.totalStaked, - target: userManager, - params: [], - chain, - block: chainBlock, - }) - ).output; - - const totalRedeemable = ( - await sdk.api.abi.call({ - abi: abi.totalRedeemable, - target: uDAI, - params: [], - chain, - block: chainBlock, - }) - ).output; - - const totalReserves = ( - await sdk.api.abi.call({ - abi: abi.totalReserves, - target: uDAI, - params: [], - chain, - block: chainBlock, - }) - ).output; - - const total = [totalStaked, totalRedeemable, totalReserves].reduce( - (acc, n) => Number(n) + Number(acc), - 0 - ); - - return { - [config[chain].DAI]: total, - }; - }; +async function tvl() { + const { api } = arguments[3] + const { userManager, DAI, uDAI } = config[api.chain] + const bals = await api.batchCall([ + { target: userManager, abi: abi.totalStaked }, + { target: uDAI, abi: abi.totalRedeemable }, + { target: uDAI, abi: abi.totalReserves }, + ]) + bals.forEach(i => api.add(DAI, i)) } -function borrowing(chain) { - return async function (_, __, chainBlocks) { - const chainBlock = chainBlocks[chain]; - - const { uDAI } = config[chain]; - - const totalBorrows = ( - await sdk.api.abi.call({ - abi: abi.totalBorrows, - target: uDAI, - params: [], - chain, - block: chainBlock, - }) - ).output; - - return { - [config[chain].DAI]: totalBorrows, - }; - }; +async function borrowed() { + const { api } = arguments[3] + const { DAI, uDAI } = config[api.chain] + const borrows = await api.call({ target: uDAI, abi: abi.totalBorrows, }) + api.add(DAI, borrows) } module.exports = { - timetravel: true, - misrepresentedTokens: false, - methodology: "Counts the tokens locked in the contracts to be used to underwrite or to borrow. Borrowed coins are not counted towards the TVL, so only the coins actually locked in the contracts are counted.", - ethereum: { - tvl: tvl("ethereum"), - borrowed: borrowing("ethereum"), - }, - arbitrum: { - tvl: tvl("arbitrum"), - borrowed: borrowing("arbitrum"), - }, + methodology: + "Counts the tokens locked in the contracts to be used to underwrite or to borrow. Borrowed coins are not counted towards the TVL, so only the coins actually locked in the contracts are counted.", }; + +Object.keys(config).forEach(chain => { + module.exports[chain] = { + tvl, borrowed, + } +}) diff --git a/projects/unipilot/abis/getPositionDetails.json b/projects/unipilot/abis/getPositionDetails.json deleted file mode 100644 index 4ec3397f3d7..00000000000 --- a/projects/unipilot/abis/getPositionDetails.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "inputs": [], - "name": "getPositionDetails", - "outputs": [ - { - "internalType": "uint256", - "name": "amount0", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "amount1", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "fees0", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "fees1", - "type": "uint256" - }, - { - "internalType": "uint128", - "name": "baseLiquidity", - "type": "uint128" - }, - { - "internalType": "uint128", - "name": "rangeLiquidity", - "type": "uint128" - } - ], - "stateMutability": "nonpayable", - "type": "function" -} diff --git a/projects/unipilot/index.js b/projects/unipilot/index.js index d5470bc33c9..6a2f2b63389 100644 --- a/projects/unipilot/index.js +++ b/projects/unipilot/index.js @@ -1,9 +1,9 @@ -const sdk = require("@defillama/sdk"); -const { request, gql } = require("graphql-request"); - -const { getChainTransform } = require("../helper/portedTokens"); +const { cachedGraphQuery } = require('../helper/cache') +const { getLogs } = require("../helper/cache/getLogs"); +const { sumTokens2 } = require("../helper/unwrapLPs"); const { staking } = require("../helper/staking"); -const getPositionDetails = require("./abis/getPositionDetails.json"); +const getPositionDetails = + "function getPositionDetails() returns (uint256 amount0, uint256 amount1, uint256 fees0, uint256 fees1, uint128 baseLiquidity, uint128 rangeLiquidity)"; const FACTORY_ADDRESSES = { ethereum: { @@ -13,17 +13,30 @@ const FACTORY_ADDRESSES = { polygon: { activeFactory: "0x95b77505b38f8a261ada04f54b8d0cda08904708", passiveFactory: "0x2536527121fc1048ae5d45327a34241a355a6a95", + activeFactoryQ: "0xC99fA77AB721817Da9dD3C3b4F8ecB13772FCECE", + passiveFactoryQ: "0xbd712D4dbd4b8d0cD2A98aDb0f9fC2928031b16F", + }, + arbitrum: { + activeFactory: "0xca69c359e3297aa855e77f83e071feab17f0ede6", + passiveFactory: "0x6900c436cf15d6d0016dc71a5ce5ade843031efd", + }, + bsc: { + activeFactory: "0x9c7cB0BB03044D6c1c472b26058bFA61B9956D22", + passiveFactory: "0x6900c436CF15D6D0016dC71A5CE5ADe843031eFd", + }, + polygon_zkevm: { + activeFactoryQ: "0xC99fA77AB721817Da9dD3C3b4F8ecB13772FCECE", + passiveFactoryQ: "0xbd712D4dbd4b8d0cD2A98aDb0f9fC2928031b16F", + }, + dogechain: { + activeFactoryQ: "0x16C6D274e076c7b36a4D3fEE2f9AB2E12d220bd5", + passiveFactoryQ: "0x30BeB7A1d66CBE9594E159979F0c7e31A9F68e74", }, }; -const GRAPH_URLS = { - polygon: - "https://api.thegraph.com/subgraphs/name/unipilotvoirstudio/stats-v2-polygon", -}; - +const DEFAULT_VAULT_CREATION_TOPIC = "VaultCreated(address,address,uint16,uint24,address)"; const VAULT_CREATION_TOPIC = { ethereum: "VaultCreated(address,address,uint24,address)", - polygon: "VaultCreated(address,address,uint16,uint24,address)", }; const PILOT_STAKING_CONTRACT = "0xc9256e6e85ad7ac18cd9bd665327fc2062703628"; @@ -37,39 +50,45 @@ const START_BLOCKS = { polygon: { activeFactory: 34288237, passiveFactory: 34371363, + activeFactoryQ: 42886155, + passiveFactoryQ: 42212527, + }, + arbitrum: { + activeFactory: 59667444, + passiveFactory: 58774134, + }, + bsc: { + activeFactory: 27139991, + passiveFactory: 27140068, + }, + polygon_zkevm: { + activeFactoryQ: 300919, + passiveFactoryQ: 209294, + }, + dogechain: { + activeFactoryQ: 12700049, + passiveFactoryQ: 12829893, }, }; -const vaultQuery = gql` - { - vaults { - id - token0 { - id - } - token1 { - id - } - } - } -`; - -async function getVaultLogs(chain, block, factoryType) { - const vaults = {}; - - const vaultLogs = ( - await sdk.api.util.getLogs({ - target: FACTORY_ADDRESSES[chain][factoryType], - topic: VAULT_CREATION_TOPIC[chain], - keys: [], - fromBlock: START_BLOCKS[chain][factoryType], - toBlock: block, - chain, - }) - ).output; +async function getVaultLogs(vaults, factoryType, api) { + const chain = api.chain + let topic = DEFAULT_VAULT_CREATION_TOPIC + if (VAULT_CREATION_TOPIC[chain]) + topic = VAULT_CREATION_TOPIC[chain] + + if (factoryType === "activeFactoryQ" || factoryType === "passiveFactoryQ") + topic = 'VaultCreated(address,address,uint16,address)' + + const vaultLogs = await getLogs({ + target: FACTORY_ADDRESSES[chain][factoryType], + topic, + fromBlock: START_BLOCKS[chain][factoryType], + api, + }); for (let log of vaultLogs) { - vaults[`0x${log.topics[3].substr(-40)}`] = { + vaults[`0x${log.topics[3].substr(-40)}`.toLowerCase()] = { token0Address: `0x${log.topics[1].substr(-40)}`, token1Address: `0x${log.topics[2].substr(-40)}`, }; @@ -78,113 +97,54 @@ async function getVaultLogs(chain, block, factoryType) { return vaults; } -function protocolTvl(chain) { - return async (timestamp, block, chainBlocks) => { - const balances = {}; - let vaults = {}; - if (chain === "ethereum") { - const activeVaultLogs = await getVaultLogs( - chain, - chainBlocks[chain], - "activeFactory" - ); - const passiveVaultLogs = await getVaultLogs( - chain, - chainBlocks[chain], - "passiveFactory" - ); - vaults = { ...activeVaultLogs, ...passiveVaultLogs }; - } else { - //extract vault details from graph for chains other than ethereum - const res = await request(GRAPH_URLS[chain], vaultQuery); - vaults = res.vaults.reduce((accum, vault) => { - accum[vault.id] = { - token0Address: vault.token0.id, - token1Address: vault.token1.id, - }; - return accum; - }, {}); - } - const vaultCalls = []; - const balanceCalls = []; - - for (let vault of Object.keys(vaults)) { - vaultCalls.push({ - target: vault, - }); - balanceCalls.push({ - target: vaults[vault].token0Address, - params: vault, - }); - balanceCalls.push({ - target: vaults[vault].token1Address, - params: vault, - }); - } - - //get vault reserves(amount, fees) from contract - const vaultReserves = await sdk.api.abi.multiCall({ - chain, - abi: getPositionDetails, - calls: vaultCalls, - block: chainBlocks[chain], - }); - - //get vault balances (remaining asset) - const vaultBalances = await sdk.api.abi.multiCall({ - chain, - abi: "erc20:balanceOf", - calls: balanceCalls, - block: chainBlocks[chain], - }); - - const chainTransform = await getChainTransform(chain); - - //sum vault reserves (amount+fees) - for (let reserve of vaultReserves.output) { - let vaultAddress = reserve.input.target; - let address0 = vaults[vaultAddress].token0Address; - let address1 = vaults[vaultAddress].token1Address; - - //amount - sdk.util.sumSingleBalance( - balances, - chainTransform(address0), - reserve.output.amount0 - ); - sdk.util.sumSingleBalance( - balances, - chainTransform(address0), - reserve.output.fees0 - ); - - //fees - sdk.util.sumSingleBalance( - balances, - chainTransform(address1), - reserve.output.amount1 - ); - sdk.util.sumSingleBalance( - balances, - chainTransform(address1), - reserve.output.fees1 - ); - } - - //vsum vault balances - sdk.util.sumMultiBalanceOf(balances, vaultBalances, true); - - return balances; - }; +async function tvl(timestamp, block, chainBlocks, { api }) { + let vaults = {}; + if (api.chain === "dogechain") { + const res = await cachedGraphQuery('unipilot/'+api.chain, 'https://apis.unipilot.io:5000/subgraphs/name/hamzabhatti125/stats-dogechain', `{ + vaults { + token0 { + id + } + token1 { + id + } + id + } + }`) + res.vaults.forEach(({ token0, token1, id }) => { + vaults[id] = { + token0Address: token0.id, + token1Address: token1.id, + } + }) + } else { + for (const label of Object.keys(START_BLOCKS[api.chain])) + await getVaultLogs(vaults, label, api) + + } + + const ownerTokens = Object.entries(vaults).map(([v, i]) => [[i.token0Address, i.token1Address], v]) + const vaultKeys = Object.keys(vaults) + + //get vault reserves(amount, fees) from contract + const vaultReserves = await api.multiCall({ abi: getPositionDetails, calls: vaultKeys, }) + + vaultKeys.forEach((v, i) => { + i = vaultReserves[i] + api.add(vaults[v].token0Address, i.amount0) + api.add(vaults[v].token0Address, i.fees0) + api.add(vaults[v].token1Address, i.amount1) + api.add(vaults[v].token1Address, i.fees1) + }) + return sumTokens2({ api, ownerTokens }) } module.exports = { - misrepresentedTokens: true, - ethereum: { - tvl: protocolTvl("ethereum"), - staking: staking(PILOT_STAKING_CONTRACT, PILOT, "ethereum"), - }, - polygon: { - tvl: protocolTvl("polygon"), - }, + doublecounted: true, }; + +Object.keys(FACTORY_ADDRESSES).forEach(chain => { + module.exports[chain] = { tvl } +}) + +module.exports.ethereum.staking = staking(PILOT_STAKING_CONTRACT, PILOT) \ No newline at end of file diff --git a/projects/unipower/index.js b/projects/unipower/index.js index e0767b8c946..7d582b450f3 100644 --- a/projects/unipower/index.js +++ b/projects/unipower/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const { staking } = require("../helper/staking"); @@ -8,7 +9,7 @@ const POWER_eth = "0xF2f9A7e93f845b3ce154EfbeB64fB9346FCCE509"; // ETH Prime Part const ethPrimeContract = "0xe40e1531a4B56fB65571AD2ca43Dc0048a316a2D"; -const WETH = "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"; +const WETH = ADDRESSES.ethereum.WETH; // PowerDAO Part const liquidityVaultContracts = [ diff --git a/projects/uniswap-v2/index.js b/projects/uniswap-v2/index.js index 45ebbd5f84f..567703e8d2f 100644 --- a/projects/uniswap-v2/index.js +++ b/projects/uniswap-v2/index.js @@ -1,7 +1,7 @@ const { getChainTvl } = require('../helper/getUniSubgraphTvl'); const v2graph = getChainTvl({ - ethereum: 'https://api.thegraph.com/subgraphs/name/ianlapham/uniswapv2' + ethereum: 'https://api.thegraph.com/subgraphs/name/ianlapham/uniswap-v2-dev' }) module.exports = { diff --git a/projects/uniswap/index.js b/projects/uniswap/index.js index c4489069d3b..2d44b64835c 100644 --- a/projects/uniswap/index.js +++ b/projects/uniswap/index.js @@ -1,7 +1,6 @@ const { request, gql } = require('graphql-request'); -const { getBlock } = require('../helper/getBlock'); +const { getBlock } = require('../helper/http'); const { sumTokens2 } = require('../helper/unwrapLPs') -const { log } = require('../helper/utils') const graphs = { ethereum: "https://api.thegraph.com/subgraphs/name/uniswap/uniswap-v3", @@ -9,18 +8,19 @@ const graphs = { arbitrum: 'https://api.thegraph.com/subgraphs/name/ianlapham/arbitrum-dev', polygon: "https://api.thegraph.com/subgraphs/name/ianlapham/uniswap-v3-polygon", celo: "https://api.thegraph.com/subgraphs/name/jesse-sawa/uniswap-celo", + bsc: "https://api.thegraph.com/subgraphs/name/ianlapham/uniswap-v3-bsc", + avax: "https://api.thegraph.com/subgraphs/name/lynnshaoyu/uniswap-v3-avax", } const blacklists = { - ethereum: ['0xa850478adaace4c08fc61de44d8cf3b64f359bec', '0x055284a4ca6532ecc219ac06b577d540c686669d', '0x8c0411f2ad5470a66cb2e9c64536cfb8dcd54d51', '0x277667eb3e34f134adf870be9550e9f323d0dc24','0x4c83a7f819a5c37d64b4c5a2f8238ea082fa1f4e','0x290a6a7460b308ee3f19023d2d00de604bcf5b42','0x4b5ab61593a2401b1075b90c04cbcdd3f87ce011','0x582d23c7ec6b59afd041a522ff64ff081e8c0d2d','0x1f98431c8ad98523631ae4a59f267346ea31f984',], - arbitrum: ['0xd4d2f4110878a33ea5b97f0665e518253446161a',], + ethereum: ['0xa850478adaace4c08fc61de44d8cf3b64f359bec', '0x055284a4ca6532ecc219ac06b577d540c686669d', '0x8c0411f2ad5470a66cb2e9c64536cfb8dcd54d51', '0x277667eb3e34f134adf870be9550e9f323d0dc24','0x4c83a7f819a5c37d64b4c5a2f8238ea082fa1f4e','0x290a6a7460b308ee3f19023d2d00de604bcf5b42','0x4b5ab61593a2401b1075b90c04cbcdd3f87ce011','0x582d23c7ec6b59afd041a522ff64ff081e8c0d2d','0x1f98431c8ad98523631ae4a59f267346ea31f984', '0xaf44e10ed87d90f28bff2d1fbef1f64b090f5ebb', ], + arbitrum: ['0xd4d2f4110878a33ea5b97f0665e518253446161a', '0xB50721BCf8d664c30412Cfbc6cf7a15145234ad1', ], polygon: ['0x8d52c2d70a7c28a9daac2ff12ad9bfbf041cd318', '0x1f98431c8ad98523631ae4a59f267346ea31f984','0xd5302a8ead77b85ea3326b45f4714e0b3432b233','0xc951ab482ff11d8df636742e1f1c3fc8037427a9', ], } function v3TvlPaged(chain) { return async (_, _b, { [chain]: block }) => { block = await getBlock(_, chain, { [chain]: block }) - log('Fetching data for block: ',chain, block) const balances = {} const size = 1000 let lastId = '' @@ -50,12 +50,11 @@ function v3TvlPaged(chain) { const blacklisted = blacklists[chain] || [] do { - const res = await request(graphs[chain], graphQueryPaged, { lastId, block: block - 500 }); + const res = await request(graphs[chain], graphQueryPaged, { lastId, block: block - 5000 }); pools = res.pools const tokensAndOwners = pools.map(i => ([[i.token0.id, i.id], [i.token1.id, i.id]])).flat() - log(chain, block, lastId, pools.length) await sumTokens2({ balances, tokensAndOwners, chain, block, blacklistedTokens: blacklisted }) - lastId = pools[pools.length - 1].id + lastId = pools[pools.length - 1]?.id } while (pools.length === size) return balances @@ -64,22 +63,22 @@ function v3TvlPaged(chain) { module.exports = { methodology: `Counts the tokens locked on AMM pools, pulling the data from the 'ianlapham/uniswapv2' subgraph`, - misrepresentedTokens: true, timetravel: false, hallmarks: [ + [1588610042, "UNI V2 Launch"], [1598412107, "SushiSwap launch"], [1599535307, "SushiSwap migration"], [1600226507, "LM starts"], [1605583307, "LM ends"], - [1617333707, "FEI launch"] + [1617333707, "FEI launch"], + [1620156420, "UNI V3 Launch"] ] } -const chains = ['ethereum', 'arbitrum', 'optimism', 'polygon', 'celo'] -// const chains = ['celo'] +const chains = ['ethereum', 'arbitrum', 'optimism', 'polygon', 'celo', 'bsc', 'avax'] chains.forEach(chain => { module.exports[chain] = { tvl: v3TvlPaged(chain) } -}) \ No newline at end of file +}) diff --git a/projects/uniswap/v1.js b/projects/uniswap/v1.js index 48c2232ba8c..2ddde5bdf00 100644 --- a/projects/uniswap/v1.js +++ b/projects/uniswap/v1.js @@ -1,19 +1,19 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk'); const BigNumber = require('bignumber.js'); +const { getLogs } = require('../helper/cache/getLogs') const START_BLOCK = 6627917; const FACTORY = '0xc0a47dFe034B400B47bDaD5FecDa2621de6c4d95'; -const ETH = '0x0000000000000000000000000000000000000000'.toLowerCase(); +const ETH = ADDRESSES.null.toLowerCase(); -async function tvl(timestamp, block) { - const logs = (await sdk.api.util - .getLogs({ - keys: [], - toBlock: block, +async function tvl(timestamp, block, _1, { api }) { + const logs = (await getLogs({ + api, target: FACTORY, fromBlock: START_BLOCK, topic: 'NewExchange(address,address)', - })).output; + })); const exchanges = {}; logs.forEach((log) => { @@ -48,7 +48,6 @@ async function tvl(timestamp, block) { return tokenBalances.reduce( (accumulator, tokenBalance) => { if(tokenBalance.output === null){ - console.log("excluded", tokenBalance.input.target) return accumulator } const balanceBigNumber = new BigNumber(tokenBalance.output) @@ -66,7 +65,7 @@ async function tvl(timestamp, block) { ).toFixed(), } ) -}; +} module.exports={ tvl diff --git a/projects/uniswap/v3/index.js b/projects/uniswap/v3/index.js index 4e0687b3327..131be2aff32 100644 --- a/projects/uniswap/v3/index.js +++ b/projects/uniswap/v3/index.js @@ -8,8 +8,7 @@ const graphUrls = { optimism: "https://api.thegraph.com/subgraphs/name/ianlapham/uniswap-optimism-dev", arbitrum: 'https://api.thegraph.com/subgraphs/name/ianlapham/arbitrum-dev', } - -const { getBlock } = require('../../helper/getBlock'); +const { getLogs } = require('../../helper/cache/getLogs') const FACTORY = '0x1F98431c8aD98523631AE4a59f267346ea31F984'; // same on all chains const startBlocks = { @@ -19,19 +18,17 @@ const startBlocks = { } function chainTvl(chain) { - return async (timestamp, ethBlock, chainBlocks) => { + return async (timestamp, ethBlock, chainBlocks, { api }) => { const START_BLOCK = startBlocks[chain] - const block = await getBlock(timestamp, chain, chainBlocks) const logs = ( - await sdk.api.util.getLogs({ - keys: [], - toBlock: block, + await getLogs({ + api, target: FACTORY, fromBlock: START_BLOCK, - chain, topic: 'PoolCreated(address,address,uint24,int24,address)', }) - ).output + ) + const block = api.block const pairAddresses = [] const token0Addresses = [] @@ -92,7 +89,6 @@ function chainTvl(chain) { chain, }) ) - //console.log(tokenBalances.output.filter(t=>t.success== false)) let transform = id=>id if(chain === "optimism"){ transform = await transformOptimismAddress() diff --git a/projects/unite-finance/index.js b/projects/unite-finance/index.js index de2c75d2d94..4a4c7b4a8e1 100644 --- a/projects/unite-finance/index.js +++ b/projects/unite-finance/index.js @@ -17,7 +17,7 @@ const uDexLPs = [ "0xeE2208256800398424a45Fe9F135AD0b60DeAE0C", // uniteOneLpAddress "0xe302A970E80094a3abB820Eda275FAC5848b5bdA", //ushareOneLpAddress ] -const getReservesABI = { "inputs": [], "name": "getReserves", "outputs": [{ "internalType": "uint256", "name": "_reserve0", "type": "uint256" }, { "internalType": "uint256", "name": "_reserve1", "type": "uint256" }], "stateMutability": "view", "type": "function" } +const getReservesABI ='function getReserves() view returns (uint256 _reserve0, uint256 _reserve1)' async function OnePool2(timestamp, _block, { [chain]: block }) { const balances = await sumTokens2({ diff --git a/projects/united-farmers/index.js b/projects/united-farmers/index.js deleted file mode 100644 index d96dbc82143..00000000000 --- a/projects/united-farmers/index.js +++ /dev/null @@ -1,17 +0,0 @@ -const {calculateUniTvl} = require("../helper/calculateUniTvl"); -const {stakingUnknownPricedLP} = require("../helper/staking"); - -const ufx = "0x44b3efa6c6ca47badb3197b0ab675e4396e40023"; -const factory = "0x2fcd5b3b7a5088509babc9910ed2f1b6fe5775b6"; -const masterchef = "0x9327B522F6710b858Eb55352f4E52B62B8C2fB26"; - -async function tvl(timestamp, block, chainBlocks) { - return await calculateUniTvl(addr=>`bsc:${addr}`, chainBlocks.bsc, "bsc", factory, 0, true); -} - -module.exports = { - bsc: { - tvl, - staking: stakingUnknownPricedLP(masterchef, ufx, "bsc", "0xD8d18A4045AdaDEc926E0A3c289E22850993cA7B", addr=>`bsc:${addr}`) - } -} \ No newline at end of file diff --git a/projects/unitrade/abi.json b/projects/unitrade/abi.json index 9616451272e..b6f491606c0 100644 --- a/projects/unitrade/abi.json +++ b/projects/unitrade/abi.json @@ -1,58 +1,5 @@ { - "abiGetActiveOrdersLength": { - "inputs": [], - "name": "getActiveOrdersLength", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - "abiGetOrderId": { - "inputs": [ - { "internalType": "uint256", "name": "index", "type": "uint256" } - ], - "name": "getActiveOrderId", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - "abiGetOrder": { - "inputs": [ - { "internalType": "uint256", "name": "orderId", "type": "uint256" } - ], - "name": "getOrder", - "outputs": [ - { - "internalType": "enum UniTradeOrderBook.OrderType", - "name": "orderType", - "type": "uint8" - }, - { "internalType": "address payable", "name": "maker", "type": "address" }, - { "internalType": "address", "name": "tokenIn", "type": "address" }, - { "internalType": "address", "name": "tokenOut", "type": "address" }, - { - "internalType": "uint256", - "name": "amountInOffered", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "amountOutExpected", - "type": "uint256" - }, - { "internalType": "uint256", "name": "executorFee", "type": "uint256" }, - { - "internalType": "uint256", - "name": "totalEthDeposited", - "type": "uint256" - }, - { - "internalType": "enum UniTradeOrderBook.OrderState", - "name": "orderState", - "type": "uint8" - }, - { "internalType": "bool", "name": "deflationary", "type": "bool" } - ], - "stateMutability": "view", - "type": "function" - } -} + "abiGetActiveOrdersLength": "uint256:getActiveOrdersLength", + "abiGetOrderId": "function getActiveOrderId(uint256 index) view returns (uint256)", + "abiGetOrder": "function getOrder(uint256 orderId) view returns (uint8 orderType, address maker, address tokenIn, address tokenOut, uint256 amountInOffered, uint256 amountOutExpected, uint256 executorFee, uint256 totalEthDeposited, uint8 orderState, bool deflationary)" +} \ No newline at end of file diff --git a/projects/unitrade/gateway.abi.json b/projects/unitrade/gateway.abi.json index 58908c0ef07..c3cb2419d5f 100644 --- a/projects/unitrade/gateway.abi.json +++ b/projects/unitrade/gateway.abi.json @@ -1,28 +1,4 @@ { "address": "0x64B17B166090B8F9BA19C13Bf8D5dA951b2d653D", - "abi": [ - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "tokens", - "outputs": [ - { - "internalType": "address", - "name": "tokenAddress", - "type": "address" - }, - { - "internalType": "enum Gateway.ReleaseMethod", - "name": "releaseMethod", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }] + "abi": "function tokens(uint256) view returns (address tokenAddress, uint8 releaseMethod)" } \ No newline at end of file diff --git a/projects/unitrade/index.js b/projects/unitrade/index.js index 6cf2c0e97c4..9c1c0a89621 100644 --- a/projects/unitrade/index.js +++ b/projects/unitrade/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); const gatewayAbi = require("./gateway.abi.json"); @@ -59,11 +60,12 @@ async function tvl(_, block) { //fetching first 10 gateway tokens and formatting output (temp fix until we can fetch addedTokens.length ) const gatewayTokens = ( await sdk.api.abi.multiCall({ - abi: gatewayAbi.abi.filter((item) => item.name === "tokens")[0], + abi: gatewayAbi.abi, calls: new Array(10).fill(null).map((_, index) => ({ target: UNITRADE_BRIDGE, params: index, })), + permitFailure: true, }) ).output .filter((item) => item.output !== null) @@ -90,7 +92,7 @@ async function tvl(_, block) { const combinedETHBalances = parseInt(ethBalanceGateway) + parseInt(ethBalanceOrderbook); - balances["0x0000000000000000000000000000000000000000"] = combinedETHBalances.toFixed(0); + balances[ADDRESSES.null] = combinedETHBalances.toFixed(0); return balances; } diff --git a/projects/universe-finance/index.js b/projects/universe-finance/index.js index 8cd18de5fc9..9ebe6976d27 100644 --- a/projects/universe-finance/index.js +++ b/projects/universe-finance/index.js @@ -1,10 +1,10 @@ const sdk = require("@defillama/sdk"); -const utils = require("../helper/utils"); +const { getConfig } = require('../helper/cache') const vaultsUrl = "https://raw.githubusercontent.com/UniverseFinance/UniverseFinanceProtocol/main/doc/vaultAddress.json"; -const token0Abi = require("../helper/abis/token0.json"); -const token1Abi = require("../helper/abis/token1.json"); +const token0Abi = 'address:token0' +const token1Abi = 'address:token1' function eth(timestamp, ethBlock, chainBlocks) { return chainTvl(timestamp, ethBlock, chainBlocks, "ethereum"); @@ -18,9 +18,9 @@ function matic(timestamp, ethBlock, chainBlocks) { async function chainTvl(timestamp, ethBlock, chainBlocks, chain) { const block = chain == "ethereum" ? ethBlock : chainBlocks[chain]; let balances = {}; - let resp = await utils.fetchURL(vaultsUrl); + let resp = await getConfig('Universe', vaultsUrl); - let allVaults = resp.data.filter(vault => vault.type > 0).map((vault) => ({ + let allVaults = resp.filter(vault => vault.type > 0).map((vault) => ({ address: vault.address, name: vault.name, getTotalAmounts: vault.getTotalAmounts, @@ -99,6 +99,7 @@ async function chainTvl(timestamp, ethBlock, chainBlocks, chain) { } module.exports = { + doublecounted: true, methodology: "Vault TVL consists of the tokens in the vault contract and the total amount in the UNI V3 pool through the getTotalAmounts ABI call", ethereum: { tvl: eth, diff --git a/projects/universe/index.js b/projects/universe/index.js index aeffbf3a429..69951205154 100644 --- a/projects/universe/index.js +++ b/projects/universe/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk'); const {unwrapUniswapLPs} = require('../helper/unwrapLPs') @@ -5,13 +6,13 @@ const STAKING_ADDRESS = '0x2d615795a8bdb804541C69798F13331126BA0c09'; const USDC_TOKEN = { symbol: 'USDC', - address: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', + address: ADDRESSES.ethereum.USDC, decimals: 6, }; const AAVE_TOKEN = { symbol: 'AAVE', - address: '0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9', + address: ADDRESSES.ethereum.AAVE, decimals: 18, }; @@ -29,19 +30,19 @@ const COMP_TOKEN = { const SNX_TOKEN = { symbol: 'SNX', - address: '0xc011a73ee8576fb46f5e1c5751ca3b9fe0af2a6f', + address: ADDRESSES.ethereum.SNX, decimals: 18, }; const SUSHI_TOKEN = { symbol: 'SUSHI', - address: '0x6b3595068778dd592e39a122f4f5a5cf09c90fe2', + address: ADDRESSES.ethereum.SUSHI, decimals: 18, }; const LINK_TOKEN = { symbol: 'LINK', - address: '0x514910771af9ca656af840dff83e8264ecf986ca', + address: ADDRESSES.ethereum.LINK, decimals: 18, }; @@ -57,23 +58,6 @@ const USDC_XYZ_SUSHI_LP_TOKEN = { decimals: 18, }; -// Unused but will leave it because they added it to the PR -function createAbiViewItemFor(name, inputs, outputs) { - return { - name, - type: 'function', - stateMutability: 'view', - inputs: inputs.map(input => ({ - name: '', - type: input, - })), - outputs: outputs.map(output => ({ - name: '', - type: output, - })), - }; -} - async function pool2(_timestamp, block) { const balance = await sdk.api.abi.call({ abi: 'erc20:balanceOf', diff --git a/projects/uniwhale/index.js b/projects/uniwhale/index.js new file mode 100644 index 00000000000..d384ff2f869 --- /dev/null +++ b/projects/uniwhale/index.js @@ -0,0 +1,12 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const USDT = ADDRESSES.bsc.USDT; +const UNIWHALE_LIQUIDITY_POOL = "0xBdeCAFd9096D43616a8E0eB8F3fa0865fD4769E7"; +const UNIWHALE_MARGIN_POOL = "0xBB1B941aB76fAE4e9F552B860eFaC1F367AC9bCc"; +const { sumTokensExport } = require('../helper/unwrapLPs') + +module.exports = { + start: 1677833673, + bsc: { + tvl: sumTokensExport({ owners: [UNIWHALE_LIQUIDITY_POOL, UNIWHALE_MARGIN_POOL, ], tokens: [USDT]}), + }, +}; diff --git a/projects/uniwswap-unia/index.js b/projects/uniwswap-unia/index.js new file mode 100644 index 00000000000..5715b6ec4a7 --- /dev/null +++ b/projects/uniwswap-unia/index.js @@ -0,0 +1,19 @@ +const { masterchefExports } = require('../helper/unknownTokens') + +module.exports = { + arbitrum: masterchefExports({ + chain: 'arbitrum', + masterchef: '0x231A584095dbFb73A0201d6573260Bc646566c98', + useDefaultCoreAssets: true, + nativeToken: '0xe547fab4d5ceafd29e2653cb19e6ae8ed9c8589b', + }).arbitrum, + ethpow: masterchefExports({ + chain: 'ethpow', + masterchef: '0xC07707C7AC7E383CE344C090F915F0a083764C94', + useDefaultCoreAssets: true, + nativeToken: '0x2a0cf46ecaaead92487577e9b737ec63b0208a33', + }).ethpow, +} + +module.exports.misrepresentedTokens = true +module.exports.doublecounted = true \ No newline at end of file diff --git a/projects/uniwswap/index.js b/projects/uniwswap/index.js index 3f39b8fb282..0d570f8fc29 100644 --- a/projects/uniwswap/index.js +++ b/projects/uniwswap/index.js @@ -4,7 +4,6 @@ module.exports = { misrepresentedTokens: true, ethpow: { tvl: getUniTVL({ - chain: 'ethpow', useDefaultCoreAssets: true, factory: '0xaBC4325bAD182076EAa5877c68437833d596D3Ee', }) diff --git a/projects/unizen/abi.json b/projects/unizen/abi.json index 6464a0ddf9d..550700d1c6f 100644 --- a/projects/unizen/abi.json +++ b/projects/unizen/abi.json @@ -1,31 +1,3 @@ { - "stakeableTokens": { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "stakeableTokens", - "outputs": [ - { - "internalType": "uint256", - "name": "totalValueLocked", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "weight", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "active", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - } + "stakeableTokens": "function stakeableTokens(address) view returns (uint256 totalValueLocked, uint256 weight, bool active)" } \ No newline at end of file diff --git a/projects/unknown/abi.js b/projects/unknown/abi.js index b8f314135d2..10553fac9d4 100644 --- a/projects/unknown/abi.js +++ b/projects/unknown/abi.js @@ -1,160 +1,5 @@ module.exports = { - penPoolsData: { - "inputs": [], - "name": "unkwnPoolsData", - "outputs": [ - { - "components": [ - { - "internalType": "address", - "name": "id", - "type": "address" - }, - { - "internalType": "address", - "name": "stakingAddress", - "type": "address" - }, - { - "internalType": "uint256", - "name": "stakedTotalSupply", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" - }, - { - "components": [ - { - "internalType": "address", - "name": "id", - "type": "address" - }, - { - "internalType": "string", - "name": "symbol", - "type": "string" - }, - { - "internalType": "bool", - "name": "stable", - "type": "bool" - }, - { - "internalType": "address", - "name": "token0Address", - "type": "address" - }, - { - "internalType": "address", - "name": "token1Address", - "type": "address" - }, - { - "internalType": "address", - "name": "gaugeAddress", - "type": "address" - }, - { - "internalType": "address", - "name": "bribeAddress", - "type": "address" - }, - { - "internalType": "address[]", - "name": "bribeTokensAddresses", - "type": "address[]" - }, - { - "internalType": "address", - "name": "fees", - "type": "address" - }, - { - "internalType": "uint256", - "name": "totalSupply", - "type": "uint256" - } - ], - "internalType": "struct IConeLens.Pool", - "name": "poolData", - "type": "tuple" - } - ], - "internalType": "struct UnkwnLens.UnkwnPoolData[]", - "name": "", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - poolsReservesInfo: { - "inputs": [ - { - "internalType": "address[]", - "name": "_poolsAddresses", - "type": "address[]" - } - ], - "name": "poolsReservesInfo", - "outputs": [ - { - "components": [ - { - "internalType": "address", - "name": "id", - "type": "address" - }, - { - "internalType": "address", - "name": "token0Address", - "type": "address" - }, - { - "internalType": "address", - "name": "token1Address", - "type": "address" - }, - { - "internalType": "uint256", - "name": "token0Reserve", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "token1Reserve", - "type": "uint256" - }, - { - "internalType": "uint8", - "name": "token0Decimals", - "type": "uint8" - }, - { - "internalType": "uint8", - "name": "token1Decimals", - "type": "uint8" - } - ], - "internalType": "struct IConeLens.PoolReserveData[]", - "name": "", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - locked: { - "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "name": "locked", - "outputs": [ - { "internalType": "int128", "name": "amount", "type": "int128" }, - { "internalType": "uint256", "name": "end", "type": "uint256" } - ], - "stateMutability": "view", - "type": "function" - }, + penPoolsData: "function unkwnPoolsData() view returns (tuple(address id, address stakingAddress, uint256 stakedTotalSupply, uint256 totalSupply, tuple(address id, string symbol, bool stable, address token0Address, address token1Address, address gaugeAddress, address bribeAddress, address[] bribeTokensAddresses, address fees, uint256 totalSupply) poolData)[])", + poolsReservesInfo: "function poolsReservesInfo(address[] _poolsAddresses) view returns (tuple(address id, address token0Address, address token1Address, uint256 token0Reserve, uint256 token1Reserve, uint8 token0Decimals, uint8 token1Decimals)[])", + locked: "function locked(uint256) view returns (int128 amount, uint256 end)", } \ No newline at end of file diff --git a/projects/unlimited-trade/index.js b/projects/unlimited-trade/index.js new file mode 100644 index 00000000000..d8dbac40ac9 --- /dev/null +++ b/projects/unlimited-trade/index.js @@ -0,0 +1,21 @@ +const { sumTokens2 } = require('../helper/unwrapLPs') + +const config = { + arbitrum: { + pools: [ + '0x1eBB487B42530D511091DC6bC4359ee767ad0d16', // bluechip + '0x0155d3f48e51e108f0dfF56F6EFBeA1A870B3cE7', // altcoin + '0x20A1012B79e8F3cA3f802533c07934eF97398dA7', // degen + ], + } +} + +Object.keys(config).forEach(chain => { + const { pools } = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const tokens = await api.multiCall({ abi: 'address:asset', calls: pools}) + return sumTokens2({ api, tokensAndOwners2: [tokens, pools] }) + } + } +}) \ No newline at end of file diff --git a/projects/unlockd/helper/address.js b/projects/unlockd/helper/address.js new file mode 100644 index 00000000000..66c67ebd2a0 --- /dev/null +++ b/projects/unlockd/helper/address.js @@ -0,0 +1,12 @@ +const UiPoolDataProvider = { + ethereum: "0xA7Cb07CD8BC197Fb3623A121FFF854f300a4195c", +}; + +const LendPoolAddressProvider = { + ethereum: "0xE6cd031FB0D9A79FD8CD3035B9228F78ff459B07", +}; + +module.exports = { + UiPoolDataProvider, + LendPoolAddressProvider, +}; diff --git a/projects/unlockd/index.js b/projects/unlockd/index.js new file mode 100644 index 00000000000..9ab6171456e --- /dev/null +++ b/projects/unlockd/index.js @@ -0,0 +1,41 @@ +const sdk = require("@defillama/sdk"); + +const abi = { + getSimpleReservesData: "function getSimpleReservesData(address provider) view returns (tuple(address underlyingAsset, string name, string symbol, uint256 decimals, uint256 reserveFactor, bool borrowingEnabled, bool isActive, bool isFrozen, uint128 liquidityIndex, uint128 variableBorrowIndex, uint128 liquidityRate, uint128 variableBorrowRate, uint40 lastUpdateTimestamp, address uTokenAddress, address debtTokenAddress, address interestRateAddress, uint256 availableLiquidity, uint256 totalVariableDebt, uint256 priceInEth, uint256 variableRateSlope1, uint256 variableRateSlope2)[])", + getSimpleNftsData: "function getSimpleNftsData(address provider) view returns (tuple(address underlyingAsset, string name, string symbol, bool isActive, bool isFrozen, address uNftAddress, uint256 totalCollateral)[])", +} +const address = require("./helper/address"); +const chain = 'ethereum' + +async function tvl(_, _1, _2, { api }) { + const balances = {} + const simpleReservesData = await api.call({ + target: address.UiPoolDataProvider[chain], + params: [address.LendPoolAddressProvider[chain]], + abi: abi.getSimpleReservesData, + }); + simpleReservesData.map(i => sdk.util.sumSingleBalance(balances, i.underlyingAsset, i.availableLiquidity, chain)) + + return balances; +} + +async function borrowed(_, _1, _2, { api }) { + const balances = {} + const simpleReservesData = await api.call({ + target: address.UiPoolDataProvider[chain], + params: [address.LendPoolAddressProvider[chain]], + abi: abi.getSimpleReservesData, + }) + simpleReservesData.map(i => sdk.util.sumSingleBalance(balances, i.underlyingAsset, i.totalVariableDebt, chain)) + + return balances; +} + +module.exports = { + timetravel: true, + methodology: `Counts the tokens locked in the contracts to be used as collateral to borrow or to earn yield. Borrowed coins are not counted towards the TVL`, + ethereum: { + tvl, + borrowed, + }, +}; diff --git a/projects/uno-farm/apps.json b/projects/uno-farm/apps.json new file mode 100644 index 00000000000..abfc31e8f6c --- /dev/null +++ b/projects/uno-farm/apps.json @@ -0,0 +1,84 @@ +{ + "polygon": [ + { + "poolInfoABI": [ + "function lpToken(uint256) view returns (address lpToken)" + ], + "masterChefs": ["0x0769fd68dFb93167989C6f7254cd0D766Fb2841F"], + "factory": "0xb8698FbDFcd6044fA9C56938a50D7D0FDD22e8F0", + "getLPAddress": ["((a) => a)"], + "name": "sushiswap" + }, + { + "poolInfoABI": [ + "function lpToken(uint256) view returns (address lpToken)" + ], + "masterChefs": ["0x54aff400858Dcac39797a81894D9920f16972D1D"], + "factory": "0x35E19FD59212985209339aDD9fe0649604ffB7Be", + "getLPAddress": ["((a) => a)"], + "name": "apeswap" + }, + { + "name": "balancer", + "factory": "0xBAE4733e8E761DE20DF4Cd2c62823776489957e8" + }, + { + "name": "quickswap", + "factory": "0x56888a3c0BC31a0b83bCd6cCd4dC2726E26239D7" + } + ], + "bsc": [ + { + "poolInfoABI": [ + "function lpToken(uint256) view returns (address lpToken)" + ], + "masterChefs": ["0xa5f8C5Dbd5F286960b9d90548680aE5ebFf07652"], + "factory": "0xd62c64a8846d704c7775679982219e477dcB564A", + "getLPAddress": ["((a) => a)"], + "name": "pancakeswap" + }, + { + "poolInfoABI": [ + "function poolInfo(uint256) view returns (address lpToken, uint256 allocPoint, uint256 lastRewardBlock, uint256 accWeVEPerShare)" + ], + "masterChefs": ["0x5c8D727b265DBAfaba67E050f2f739cAeEB4A6F9"], + "factory": "0x50cE50F5c2835D3A9c257A27D814E8d2C039449b", + "getLPAddress": ["((a) => a[0])"], + "name": "apeswap" + } + ], + "aurora": [ + { + "poolInfoABI": [ + "function lpToken(uint256) view returns (address lpToken)" + ], + "masterChefs": ["0x3838956710bcc9D122Dd23863a0549ca8D5675D6"], + "factory": "0x552f55dDbCD8a5e2ae6f07b5e369675A62c1F957", + "getLPAddress": ["((a) => a)"], + "name": "Trisolaris Stable" + }, + { + "poolInfoABI": [ + "function poolInfo(uint256) view returns (address lpToken, uint256 allocPoint, uint256 lastRewardBlock, uint256 accWeVEPerShare)", + "function lpToken(uint256) view returns (address lpToken)" + ], + "masterChefs": ["0x1f1Ed214bef5E83D8f5d0eB5D7011EB965D0D79B","0x3838956710bcc9D122Dd23863a0549ca8D5675D6"], + "factory": "0x64c9899fcdB6f9565Ba69B0939Aec51e320C5489", + "getLPAddress": ["((a) => a[0])","((a) => a)"], + "name": "Trisolaris Standard" + } + + ], + "avax":[ + { + "poolInfoABI": [ + "function poolInfo(uint256) view returns (address lpToken, uint256 allocPoint, uint256 lastRewardBlock, uint256 accWeVEPerShare)", + "function poolInfo(uint256) view returns (address lpToken, uint96 allocPoint, uint256 accJoePerShare, uint256 accJoePerFactorPerShare, uint64 lastRewardTimestamp, address rewarder, uint32 veJoeShareBp, uint256 totalFactor, uint256 totalLpSupply)" + ], + "masterChefs": ["0x188bED1968b795d5c9022F6a0bb5931Ac4c18F00","0x4483f0b6e2F5486D06958C20f8C39A7aBe87bf8F"], + "factory": "0x6Eae93D177BFDDAF5ee238F55C36A847A35E62A0", + "getLPAddress": ["((a) => a[0])","((a) => a[0])"], + "name": "Traderjoe" + } + ] +} diff --git a/projects/uno-farm/index.js b/projects/uno-farm/index.js new file mode 100644 index 00000000000..b277c242c84 --- /dev/null +++ b/projects/uno-farm/index.js @@ -0,0 +1,107 @@ +const { sumTokens2 } = require("../helper/unwrapLPs"); +const sdk = require("@defillama/sdk"); +const { + getUnoFarms, + getFullInfoBalancerUnoFarm, + getFullInfoQuickswapUnoFarm, +} = require("./uno-helplers"); +const { getUserMasterChefBalances } = require("../helper/masterchef"); +const apps = require("./apps.json"); + +async function defaultTVL({ balances, chain, block, app }) { + const farms = await getUnoFarms({ chain, block, factory: app.factory }); + const promises = []; + + for (let k = 0; k < app.masterChefs.length; k++) { + for (let i = 0; i < farms.length; i++) { + promises.push( + getUserMasterChefBalances({ + balances, + masterChefAddress: app.masterChefs[k], + userAddres: farms[i], + block, + chain, + poolInfoABI: app.poolInfoABI[k], + getLPAddress: app.getLPAddress[k] ? eval(app.getLPAddress[k]) : null, + }) + ); + } + } + await Promise.all(promises); +} + +async function balancerTVL({ balances, chain, block, app }) { + const farms = await getFullInfoBalancerUnoFarm({ + chain, + block, + factory: app.factory, + }); + + const tokensAndOwners = farms.map((v) => [v.gauge, v.farm]); + await sumTokens2({ balances, block, chain, tokensAndOwners }); +} + +async function quickswapTVL({ balances, chain, block, app }) { + const transform = (addr) => chain + ":" + addr; + const farms = await getFullInfoQuickswapUnoFarm({ + chain, + block, + factory: app.factory, + }); + const balanceOfFarmCalls = farms.map((v) => ({ + target: v.lpToken, + params: v.farm, + })); + const balanceOfFarm = ( + await sdk.api.abi.multiCall({ + block, + calls: balanceOfFarmCalls, + abi: "erc20:balanceOf", + chain, + }) + ).output.map((a) => a.output); + farms.map((v, i) => { + sdk.util.sumSingleBalance( + balances, + transform(v.stakeToken), + balanceOfFarm[i] + ); + }); +} + +async function tvl(_, _1, chainBlocks, { api }) { + const chain = api.chain; + const block = chainBlocks[chain]; + let balances = {}; + const promises = []; + const arrayOfApps = apps[chain]; + for (let j = 0; j < arrayOfApps.length; j++) { + const app = arrayOfApps[j]; + if (app.name == "balancer") { + promises.push(balancerTVL({ balances, chain, block, app })); + } else if (app.name == "quickswap") { + promises.push(quickswapTVL({ balances, chain, block, app })); + } else { + promises.push(defaultTVL({ balances, chain, block, app })); + } + } + await Promise.all(promises); + return balances; +} + +module.exports = { + start: 1656018000, + timetravel: true, + polygon: { + tvl, + }, + bsc: { + tvl, + }, + aurora: { + tvl, + }, + avax: { + tvl, + }, +}; diff --git a/projects/uno-farm/uno-helplers/abis/UnoFactory.json b/projects/uno-farm/uno-helplers/abis/UnoFactory.json new file mode 100644 index 00000000000..eb7abdfdded --- /dev/null +++ b/projects/uno-farm/uno-helplers/abis/UnoFactory.json @@ -0,0 +1,5 @@ +{ + "Farms": "function Farms(address) view returns (address lpToken)", + "pools": "function pools(uint256) view returns (address lpToken)", + "poolLength": "uint256:poolLength" +} diff --git a/projects/uno-farm/uno-helplers/abis/UnoFarmBalancer.json b/projects/uno-farm/uno-helplers/abis/UnoFarmBalancer.json new file mode 100644 index 00000000000..8f5e73c6af5 --- /dev/null +++ b/projects/uno-farm/uno-helplers/abis/UnoFarmBalancer.json @@ -0,0 +1,4 @@ +{ + "gauge": "function gauge() view returns (address gauge)", + "streamer": "function streamer() view returns (address streamer)" +} diff --git a/projects/uno-farm/uno-helplers/abis/UnoFarmQuickswap.json b/projects/uno-farm/uno-helplers/abis/UnoFarmQuickswap.json new file mode 100644 index 00000000000..3e0a46f7448 --- /dev/null +++ b/projects/uno-farm/uno-helplers/abis/UnoFarmQuickswap.json @@ -0,0 +1,3 @@ +{ + "lpPair": "function lpPair() view returns (address lpPair)" +} diff --git a/projects/uno-farm/uno-helplers/index.js b/projects/uno-farm/uno-helplers/index.js new file mode 100644 index 00000000000..083c370e87d --- /dev/null +++ b/projects/uno-farm/uno-helplers/index.js @@ -0,0 +1,161 @@ +const sdk = require("@defillama/sdk"); + +const abi = require("./abis/UnoFactory.json"); +const UnoFarmBalancerABI = require("./abis/UnoFarmBalancer.json"); +const UnoFarmQuickswapABI = require("./abis/UnoFarmQuickswap.json"); + +async function getUnoFarms({ + factory, + chain, + block, + getFarms = null, + getLPAddress = null, +}) { + const poolLength = ( + await sdk.api.abi.call({ + abi: abi.poolLength, + target: factory, + block, + chain, + }) + ).output; + const dummyArray = Array.from(Array(Number(poolLength)).keys()); + const lpCalls = dummyArray.map((i) => ({ target: factory, params: i })); + const lpTokens = ( + await sdk.api.abi.multiCall({ + block, + calls: lpCalls, + abi: abi.pools, + chain, + }) + ).output.map((a) => (getLPAddress ? getLPAddress(a.output) : a.output)); + const farmsCalls = lpTokens.map((i) => ({ target: factory, params: i })); + const farms = ( + await sdk.api.abi.multiCall({ + block, + calls: farmsCalls, + abi: abi.Farms, + chain, + }) + ).output.map((a) => (getFarms ? getFarms(a.output) : a.output)); + return farms; +} + +async function getUnoFarmsAndTheirLpTokens({ + factory, + chain, + block, + getFarms = null, + getLPAddress = null, +}) { + const poolLength = ( + await sdk.api.abi.call({ + abi: abi.poolLength, + target: factory, + block, + chain, + }) + ).output; + const dummyArray = Array.from(Array(Number(poolLength)).keys()); + const lpCalls = dummyArray.map((i) => ({ target: factory, params: i })); + const lpTokens = ( + await sdk.api.abi.multiCall({ + block, + calls: lpCalls, + abi: abi.pools, + chain, + }) + ).output.map((a) => (getLPAddress ? getLPAddress(a.output) : a.output)); + const farmsCalls = lpTokens.map((i) => ({ target: factory, params: i })); + const farms = ( + await sdk.api.abi.multiCall({ + block, + calls: farmsCalls, + abi: abi.Farms, + chain, + }) + ).output.map((a) => (getFarms ? getFarms(a.output) : a.output)); + return farms.map((v, i) => ({ + farm: v, + lpToken: lpTokens[i], + })); +} + +async function getFullInfoBalancerUnoFarm({ + factory, + chain, + block, + getFarms = null, + getLPAddress = null, +}) { + const dataFarms = await getUnoFarmsAndTheirLpTokens({ + factory, + chain, + block, + getFarms, + getLPAddress, + }); + const gaugeCalls = dataFarms.map((v) => ({ target: v.farm })); + const streamerCalls = dataFarms.map((v) => ({ target: v.farm })); + const gauges = ( + await sdk.api.abi.multiCall({ + block, + calls: gaugeCalls, + abi: UnoFarmBalancerABI.gauge, + chain, + }) + ).output.map((a) => a.output); + const streamers = ( + await sdk.api.abi.multiCall({ + block, + calls: streamerCalls, + abi: UnoFarmBalancerABI.streamer, + chain, + permitFailure: true, + }) + ).output.map((a) => a.output); + + return dataFarms.map((v, i) => ({ + ...v, + gauge: gauges[i], + streamer: streamers[i], + })); +} +async function getFullInfoQuickswapUnoFarm({ + factory, + chain, + block, + getFarms = null, + getLPAddress = null, + }) { + const dataFarms = await getUnoFarmsAndTheirLpTokens({ + factory, + chain, + block, + getFarms, + getLPAddress, + }); + const stakeTokenCalls = dataFarms.map((v) => ({ target: v.farm })); + const stakeTokens = ( + await sdk.api.abi.multiCall({ + block, + calls: stakeTokenCalls, + abi: UnoFarmQuickswapABI.lpPair, + chain, + permitFailure: true, + }) + ).output.map((a) => a.output); + + + return dataFarms.map((v, i) => ({ + ...v, + stakeToken: stakeTokens[i], + })).filter(v=>v.stakeToken !== null); + } + +module.exports = { + getUnoFarms, + getUnoFarmsAndTheirLpTokens, + getFullInfoBalancerUnoFarm, + getFullInfoQuickswapUnoFarm, +}; diff --git a/projects/unore/index.js b/projects/unore/index.js index 4b27e45a65b..5c753ee175d 100644 --- a/projects/unore/index.js +++ b/projects/unore/index.js @@ -1,78 +1,55 @@ -const sdk = require('@defillama/sdk'); -const { sumTokens2, } = require('../helper/unwrapLPs') +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokens2, nullAddress, } = require('../helper/unwrapLPs') -// BSC pools -const riskPools = [ - '0xEcE9f1A3e8bb72b94c4eE072D227b9c9ba4cd750', - '0x0b5C802ecA88161B5daed08e488C83d819a0cD02', - '0x2cd32dF1C436f8dE6e09d1A9851945c56bcEd32a' -] - -const bscTokens = ['0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d'] // BUSD - -// ETHEREUM pools -const ethTokens = [ - '0x474021845c4643113458ea4414bdb7fb74a01a77', // UNO - '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', // USDC - '0xdac17f958d2ee523a2206206994597c13d831ec7' // USDT -] - -// SSRP, SSIP pools(risk pools) on ethereum -const ethRiskPools = [ - '0x1eECc8C8298ed9Bd46c147D44E2D7A7BfACE2034', // UNO SSRP - '0xbd3E70819A8Add92B06d6d92A06DcdA9249DF2a3', // UNO SSIP - '0x920d510d5c70c01989b66f4e24687dddb988ddae', // USDT SSIP - '0xfdfaa453ef3709d2c26ecf43786a14ab8bf27e36' // USDC SSIP -] const ethSSIPEth = '0x29B4b8674D93b36Bf651d0b86A8e5bE3c378aCF4' - -// KAVA pools -// tokens -const kavaTokens = [ - '0xfA9343C3897324496A05fC75abeD6bAC29f8A40f', // USDC -] -// risk pools -const kavaRiskPools = [ - '0x6cEC77829F474b56c327655f3281739De112B019' -] - const kavaSSIPKava = '0x112a295B0fCd382E47E98E8271e45979EDf952b6' -async function eth(timestamp, block) { - const balances = {} - - let _ethBalance = await sdk.api.eth.getBalance({ target: ethSSIPEth, block }) - balances['ethereum'] = _ethBalance.output / 1e18 - - return sumTokens2({ balances, block, owners: ethRiskPools, tokens: ethTokens }) -} - -async function bsc(timestamp, ethBlock, chainBlocks) { - const chain = 'bsc' - const block = chainBlocks[chain] - return sumTokens2({ chain, block, owners: riskPools, tokens: bscTokens }) -} - -async function kava(timestamp, ethBlock, chainBlocks) { - const chain = 'kava' - const block = chainBlocks[chain] - const balances = {} - - let _kavaBalance = await sdk.api.eth.getBalance({ target: kavaSSIPKava, chain, block }) - balances['kava'] = _kavaBalance.output / 1e18 - - return sumTokens2({ balances, chain, block, owners: kavaRiskPools, tokens: kavaTokens }) -} - -module.exports = { - start: 1632122867, // Sep-20-2021 07:27:47 AM +UTC +const config = { ethereum: { - tvl: eth + uToken: '0x474021845c4643113458ea4414bdb7fb74a01a77', + tokensAndOwners: [ + [nullAddress, ethSSIPEth], + [ADDRESSES.ethereum.USDT, '0x920d510d5c70c01989b66f4e24687dddb988ddae'], + [ADDRESSES.ethereum.USDC, '0xfdfaa453ef3709d2c26ecf43786a14ab8bf27e36'], + ], + pools: [ + '0x1eECc8C8298ed9Bd46c147D44E2D7A7BfACE2034', // UNO SSRP + '0xbd3E70819A8Add92B06d6d92A06DcdA9249DF2a3', // UNO SSIP + '0x920d510d5c70c01989b66f4e24687dddb988ddae', // USDT SSIP + '0xfdfaa453ef3709d2c26ecf43786a14ab8bf27e36' // USDC SSIP + ], }, bsc: { - tvl: bsc + uToken: '0x474021845C4643113458ea4414bdb7fB74A01A77', + tokensAndOwners: [ + [ADDRESSES.bsc.USDC, '0xEcE9f1A3e8bb72b94c4eE072D227b9c9ba4cd750'], + [ADDRESSES.bsc.USDC, '0x0b5C802ecA88161B5daed08e488C83d819a0cD02'], + [ADDRESSES.bsc.USDC, '0x2cd32dF1C436f8dE6e09d1A9851945c56bcEd32a'], + [ADDRESSES.bsc.USDC, '0xFC9a02a13B19F65219034AB03ADcD8CAdf275f35'], + [ADDRESSES.bsc.USDC, '0x456d60a7E2a2DA97BDb43759Cf63f7acbC3a700a'], + ], + pools: [ + '0xFC9a02a13B19F65219034AB03ADcD8CAdf275f35', // Zeus V2 + '0x456d60a7E2a2DA97BDb43759Cf63f7acbC3a700a' // Ares V2 + ], }, kava: { - tvl: kava + tokensAndOwners: [ + [nullAddress, kavaSSIPKava], + [ADDRESSES.telos.ETH, '0x6cEC77829F474b56c327655f3281739De112B019'], + ] } +} + +module.exports = { + start: 1626100000, // Sep-20-2021 07:27:47 AM +UTC }; + +Object.keys(config).forEach(chain => { + const { pools, uToken, tokensAndOwners, } = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api,}) => sumTokens2({api, tokensAndOwners}) + } + if (uToken) + module.exports[chain].staking = async (_, _b, _cb, { api,}) => sumTokens2({api, tokens: [uToken], owners: pools}) +}) \ No newline at end of file diff --git a/projects/unsheth/index.js b/projects/unsheth/index.js new file mode 100644 index 00000000000..08fbcab65a8 --- /dev/null +++ b/projects/unsheth/index.js @@ -0,0 +1,26 @@ +const { sumTokens2 } = require("../helper/unwrapLPs"); +const { getLogs } = require('../helper/cache/getLogs') + +// upgraded LSDVault V2 +const LSDVAULT_CONTRACT_V1 = "0xE76Ffee8722c21b390eebe71b67D95602f58237F"; +const LSDVAULT_CONTRACT_V2 = "0x51A80238B5738725128d3a3e06Ab41c1d4C05C74"; + +async function tvl(timestamp, block, chainBlocks, { api }) { + const logs = await getLogs({ + api, + target: LSDVAULT_CONTRACT_V2, + topics: ['0xe5b3d6de4d7a3162af7ca9115e3e57964a3c605b53efa503cfcba6dd9ceb9e3c'], + eventAbi: 'event LSDAdded(address lsd)', + onlyArgs: true, + fromBlock: 16951456, + }) + const lsdAddresses = logs.map(i => i.lsd) + const lsds_v1= await api.fetchList({ lengthAbi: 'uint256:tabs', itemAbi: 'function supportedLSDs(uint256) returns (address)', target: LSDVAULT_CONTRACT_V1}) + return sumTokens2({ api, ownerTokens: [[lsdAddresses, LSDVAULT_CONTRACT_V2], [lsds_v1, LSDVAULT_CONTRACT_V1]]}); +} + +module.exports = { + ethereum: { + tvl, + }, +}; // node test.js projects/unsheth/index.js diff --git a/projects/unusdao/index.js b/projects/unusdao/index.js index a364d66d35b..0b0855278cc 100644 --- a/projects/unusdao/index.js +++ b/projects/unusdao/index.js @@ -1,11 +1,12 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { ohmTvl } = require("../helper/ohm"); const udo = "0xB91Ec4F9D7D12A1aC145A7Ae3b78AFb45856C9c8"; const treasuryContract = "0x01CDdb5C0986B8521F93A9A5C6d84D6994a82742"; const stakingContract = "0xC34AF465Aac5928afec7e3642BD8Ca7873a7F2b2"; -const busd = "0xe9e7cea3dedca5984780bafc599bd69add087d56"; -const usdt = "0x55d398326f99059ff775485246999027b3197955"; +const busd = ADDRESSES.bsc.BUSD; +const usdt = ADDRESSES.bsc.USDT; const udoBusd = "0x364952dC20b5720b7fd3e73141cF6A85d9af8643"; module.exports = { diff --git a/projects/urdex/index.js b/projects/urdex/index.js new file mode 100644 index 00000000000..4e2c3b29786 --- /dev/null +++ b/projects/urdex/index.js @@ -0,0 +1,21 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require("../helper/unwrapLPs"); +const { staking } = require("../helper/staking"); + +const Contracts = { + Pool: "0xF67D3a53a110a764DCa7123b9f3FC5B404566577", + Chef: "0x235dB7AFE577A239150160ab7429bC3D6e25fdAa", + Tokens: { + BTC: ADDRESSES.arbitrum.WBTC, + USDT: ADDRESSES.arbitrum.USDT, + WETH: ADDRESSES.arbitrum.WETH + }, + URD_USDT_LP: "0xA8eC0aa8fe4287E768Fd382845442Fa29F2886ef" +} + +module.exports = { + arbitrum: { + tvl: sumTokensExport({ owner: Contracts.Pool, tokens: Object.values(Contracts.Tokens) }), + pool2: staking(Contracts.Chef, Contracts.URD_USDT_LP) + } +}; diff --git a/projects/usesugarswap/index.js b/projects/usesugarswap/index.js new file mode 100644 index 00000000000..d87d2f49dee --- /dev/null +++ b/projects/usesugarswap/index.js @@ -0,0 +1,12 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports = { + misrepresentedTokens: true, + era: { + tvl: getUniTVL({ + factory: '0x0A592988aBE9017a3c0285B9aa251A4bE8683394', + fetchBalances: true, + useDefaultCoreAssets: true, + }) + }, +}; \ No newline at end of file diff --git a/projects/uswap-me/index.js b/projects/uswap-me/index.js new file mode 100644 index 00000000000..dfec3ae19a2 --- /dev/null +++ b/projects/uswap-me/index.js @@ -0,0 +1,11 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +// https://uswap.me/analytics/ +module.exports = { + tron: { + tvl: getUniTVL({ + factory: 'TQ4F8Gr1qRKcMva64qYweAJNAVtgfj6ZJd', + useDefaultCoreAssets: true, + }), + }, +} diff --git a/projects/uwu-cash/index.js b/projects/uwu-cash/index.js new file mode 100644 index 00000000000..9c7196ddd5c --- /dev/null +++ b/projects/uwu-cash/index.js @@ -0,0 +1,11 @@ +const { sumTokensExport, nullAddress } = require('../helper/sumTokens') + +// https://docs.uwu.cash/developers/deployed-contracts +module.exports = { + stacks: { + tvl: sumTokensExport({ + owners: ['SP2AKWJYC7BNY18W1XXKPGP0YVEK63QJG4793Z2D4.uwu-factory-v1-1-0'], + tokens: [nullAddress] + }), + } +}; \ No newline at end of file diff --git a/projects/uwulend/index.js b/projects/uwulend/index.js index 966f472b6e2..c5d4b0ba0be 100644 --- a/projects/uwulend/index.js +++ b/projects/uwulend/index.js @@ -1,4 +1,10 @@ const { aaveChainTvl } = require("../helper/aave"); +const { stakings } = require("../helper/staking"); + +const PoolV1 = "0x7c0bF1108935e7105E218BBB4f670E5942c5e237"; +const PoolV2 = "0x0a7B2A21027F92243C5e5E777aa30BB7969b0188"; + +const SLP = "0x3E04863DBa602713Bb5d0edbf7DB7C3A9A2B6027"; function lending(borrowed) { return async (timestamp, ethBlock, chainBlocks) => { @@ -15,9 +21,10 @@ function lending(borrowed) { module.exports = { timetravel: true, methodology: - "Counts the tokens locked in the contracts to be used as collateral to borrow or to earn yield. Borrowed coins are not counted towards the TVL, so only the coins actually locked in the contracts are counted. There's multiple reasons behind this but one of the main ones is to avoid inflating the TVL through cycled lending", + "Counts the tokens locked in the contracts to be used as collateral to borrow or to earn yield. Borrowed coins are not counted towards the TVL, so only the coins actually locked in the contracts are counted. There's multiple reasons behind this but one of the main ones is to avoid inflating the TVL through cycled lending. The staking TVL is the protocol's revenue sharing pool locking UwU-ETH LP (SLP) tokens.", ethereum: { tvl: lending(false), borrowed: lending(true), + pool2: stakings([PoolV1, PoolV2], [SLP], "ethereum"), }, }; diff --git a/projects/v3s-finance/abi.json b/projects/v3s-finance/abi.json index e8abaa83bae..cc025528803 100644 --- a/projects/v3s-finance/abi.json +++ b/projects/v3s-finance/abi.json @@ -1,102 +1,7 @@ { - "poolLength": { - "inputs": [], - "name": "poolLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "token0": { - "constant": true, - "inputs": [], - "name": "token0", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "token1": { - "constant": true, - "inputs": [], - "name": "token1", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "wantLockedTotal": { - "inputs": [], - "name": "wantLockedTotal", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "poolInfo": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "poolInfo", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "want", - "type": "address" - }, - { - "internalType": "uint256", - "name": "allocPoint", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastRewardTime", - "type": "uint256" - }, - { - "internalType": "address", - "name": "strategy", - "type": "address" - }, - { - "internalType": "uint256", - "name": "earlyWithdrawFee", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "earlyWithdrawTime", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } + "poolLength": "uint256:poolLength", + "token0": "address:token0", + "token1": "address:token1", + "wantLockedTotal": "uint256:wantLockedTotal", + "poolInfo": "function poolInfo(uint256) view returns (address want, uint256 allocPoint, uint256 lastRewardTime, address strategy, uint256 earlyWithdrawFee, uint256 earlyWithdrawTime)" } \ No newline at end of file diff --git a/projects/v3s-finance/index.js b/projects/v3s-finance/index.js index e6a8449fb36..b2a10dca2b7 100644 --- a/projects/v3s-finance/index.js +++ b/projects/v3s-finance/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { addFundsInMasterChef } = require("../helper/masterchef"); const { stakingUnknownPricedLP, stakingPricedLP } = require("../helper/staking"); const farmUtils = require("./farm-utils"); @@ -14,7 +15,7 @@ const v3sVvspAddress = "0x57b975364140e4a8d1C96FAa00225b855BaB0E8E"; const vShareCroAddress = "0xcb0704BC4E885384ac96F0ED22B9204C3adD91AD" const vShareRewardsAddr = "0x569608516A81C0B1247310A3E0CD001046dA0663"; -const usdc = "0xc21223249CA28397B4B6541dfFaEcC539BfF0c59".toLowerCase(); +const usdc = ADDRESSES.cronos.USDC.toLowerCase(); async function tvl(timestamp, block, chainBlocks) { let balances = {}; diff --git a/projects/vacusfinance/abi.js b/projects/vacusfinance/abi.js index 365241bbc46..4a9cfe72360 100644 --- a/projects/vacusfinance/abi.js +++ b/projects/vacusfinance/abi.js @@ -1,69 +1,4 @@ module.exports = { - poolInfo2: { - "inputs": [ - { - "internalType": "uint256", - "name": "_pid", - "type": "uint256" - } - ], - "name": "poolInfo2", - "outputs": [ - { - "internalType": "address", - "name": "lpToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "allocPoint", - "type": "uint256" - }, - { - "internalType": "address", - "name": "strat0", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount0", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "share0", - "type": "uint256" - }, - { - "internalType": "address", - "name": "strat1", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount1", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "share1", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - poolLength: { - "inputs": [], - "name": "poolLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, + poolInfo2: "function poolInfo2(uint256 _pid) view returns (address lpToken, uint256 allocPoint, address strat0, uint256 amount0, uint256 share0, address strat1, uint256 amount1, uint256 share1)", + poolLength: "uint256:poolLength", } \ No newline at end of file diff --git a/projects/vacusfinance/index.js b/projects/vacusfinance/index.js index fda3f91a78b..eec2b7b6b11 100644 --- a/projects/vacusfinance/index.js +++ b/projects/vacusfinance/index.js @@ -85,6 +85,9 @@ async function staking(_, _b, { [chain]: block }) { module.exports = { + hallmarks: [ + [1665187200, "Rug Pull"] + ], misrepresentedTokens: true, avax: { tvl, diff --git a/projects/valkyrie/index.js b/projects/valkyrie/index.js index 5b0ebb0ebce..b9afd1299ce 100644 --- a/projects/valkyrie/index.js +++ b/projects/valkyrie/index.js @@ -1,37 +1,7 @@ -const { getBalance, unwrapLp } = require("../helper/chain/terra"); - -const holderToken = "terra1w6xf64nlmy3fevmmypx6w2fa34ue74hlye3chk"; -const token = "terra1dy9kmlm4anr92e42mrkjwzyvfqwz66un00rwr5"; - -const holderlp = "terra1ude6ggsvwrhefw2dqjh4j6r7fdmu9nk6nf2z32"; -const pair = "terra17fysmcl52xjrs8ldswhz7n6mt37r9cmpcguack"; // VKR-UST lp - -async function staking(timestamp, _, { terra: block }) { - const tokenBalance = await getBalance(token, holderToken, block); - - return { - "valkyrie-protocol": (tokenBalance) / 1e6, - }; -} - -async function pool2(timestamp,_, { terra: block }) { - const ustBalances = {}; - const balance = await getBalance(pair, holderlp, block); - await unwrapLp(ustBalances, pair, balance, block); - - return { - terrausd: (ustBalances.uusd * 2) / 1e6, - }; -} - module.exports = { terra: { tvl: () => ({}), - staking: staking, - pool2: pool2, }, - misrepresentedTokens: true, - timetravel: true, }; module.exports.hallmarks = [ [1651881600, "UST depeg"], diff --git a/projects/valleyswap/index.js b/projects/valleyswap/index.js index 74264a8ffb2..93f82ef8a9b 100644 --- a/projects/valleyswap/index.js +++ b/projects/valleyswap/index.js @@ -1,14 +1,17 @@ const { getUniTVL } = require('../helper/unknownTokens') module.exports = { - timetravel: true, start: 411656, oasis: { tvl: getUniTVL({ factory: '0xa25464822b505968eEc9A45C43765228c701d35f', - chain: 'oasis', useDefaultCoreAssets: true, + blacklistedTokens: ['0x6Cb9750a92643382e020eA9a170AbB83Df05F30B', '0x94fbffe5698db6f54d6ca524dbe673a7729014be'], }), }, misrepresentedTokens: true, + hallmarks: [ + [1681743600,"Remove Fake USDT"], + [1654214400, "EvoDefi bridge depeg"] + ], }; diff --git a/projects/valueliquid/abis/getCurrentTokens.json b/projects/valueliquid/abis/getCurrentTokens.json deleted file mode 100644 index 20f64867fa3..00000000000 --- a/projects/valueliquid/abis/getCurrentTokens.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "constant": true, - "inputs": [], - "name": "getCurrentTokens", - "outputs": [ - { - "internalType": "address[]", - "name": "tokens", - "type": "address[]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" -} diff --git a/projects/valueliquid/index.js b/projects/valueliquid/index.js index c2747850094..58741993519 100644 --- a/projects/valueliquid/index.js +++ b/projects/valueliquid/index.js @@ -1,36 +1,7 @@ -const sdk = require('@defillama/sdk') -const { sumTokens2 } = require('../helper/unwrapLPs') - -const getCurrentTokens = require('./abis/getCurrentTokens.json') - -const tvl = async (_, block) => { - const logs = ( - await sdk.api.util.getLogs({ - keys: [], - toBlock: block, - target: '0xebc44681c125d63210a33d30c55fd3d37762675b', - fromBlock: 10961776, - topic: 'LOG_NEW_POOL(address,address)', - }) - ).output - - const pools = logs - .map((log) => `0x${log.topics[2].substring(26)}`) - const calls = pools.map(i => ({ target: i })) - const { output: tokens } = await sdk.api.abi.multiCall({ - abi: getCurrentTokens, - calls, - block, - }) - const toa = [] - tokens.forEach(({ output, input: { target } }) => { - output.forEach(i => toa.push([i, target])) - }) - return sumTokens2({ block, tokensAndOwners: toa, }) -} +const { v1Tvl } = require('../helper/balancer') module.exports = { start: 1601440616, // 09/30/2020 @ 4:36am (UTC) - ethereum: { tvl } + ethereum: { tvl: v1Tvl('0xebc44681c125d63210a33d30c55fd3d37762675b', 10961776) } }; diff --git a/projects/vampireswap/index.js b/projects/vampireswap/index.js index 262500b3cbb..86019c71b04 100644 --- a/projects/vampireswap/index.js +++ b/projects/vampireswap/index.js @@ -1,18 +1,11 @@ -const {calculateUniTvl} = require('../helper/calculateUniTvl.js') -const {transformFantomAddress} = require('../helper/portedTokens.js'); -const { staking, stakingPricedLP } = require('../helper/staking.js'); +const {uniTvlExport} = require('../helper/calculateUniTvl.js') +const { stakingPricedLP } = require('../helper/staking.js'); const factory = '0xdf0a0a62995ae821d7a5cf88c4112c395fc41358' -async function tvl(_timestamp, _ethBlock, chainBlocks){ - const transform = await transformFantomAddress(); - - const balances = await calculateUniTvl(transform, chainBlocks['fantom'], 'fantom', factory, 23006319, true); - return balances -} module.exports = { fantom:{ staking: stakingPricedLP("0xa9d452E3CEA2b06d7DBE812A6C3ec81cf52334dD", "0x97058c0B5ff0E0E350e241EBc63b55906a9EADbc", "fantom", "0x8fa291be663a069e6289f844944752cd011ec719", "wrapped-fantom", false), - tvl, + tvl:uniTvlExport(factory, 'fantom', true), }, } \ No newline at end of file diff --git a/projects/vanswap/index.js b/projects/vanswap/index.js index ea99b9f0ef8..e1f34428677 100644 --- a/projects/vanswap/index.js +++ b/projects/vanswap/index.js @@ -10,7 +10,6 @@ module.exports = { misrepresentedTokens: true, vision: { tvl: getUniTVL({ - chain: 'vision', useDefaultCoreAssets: true, factory: '0xF6D67482DEDE4D208F74CCD0E6592764014F546F', }), diff --git a/projects/vapordex/index.js b/projects/vapordex/index.js new file mode 100644 index 00000000000..f63294655e7 --- /dev/null +++ b/projects/vapordex/index.js @@ -0,0 +1,3 @@ + +const { uniTvlExport } = require('../helper/unknownTokens') +module.exports = uniTvlExport('avax', '0xc009a670e2b02e21e7e75ae98e254f467f7ae257') \ No newline at end of file diff --git a/projects/vaporfi/index.js b/projects/vaporfi/index.js index 62e851f5b3a..05c7f48f6da 100644 --- a/projects/vaporfi/index.js +++ b/projects/vaporfi/index.js @@ -1,17 +1,6 @@ -const sdk = require("@defillama/sdk"); -const { staking } = require("../helper/staking"); -const { pool2 } = require("../helper/pool2"); - -const treasuryContract = "0x20b0013dcBB9697a8C3D0Be2cfb004d6bD023B87"; -const WAVAX_VPND_JPL = "0x4cd20F3e2894Ed1A0F4668d953a98E689c647bfE"; -const VPND = "0x83a283641C6B4DF383BCDDf807193284C84c5342"; module.exports = { avax: { - treasury: sdk.util.sumChainTvls([ - staking(treasuryContract, VPND, "avax"), - pool2(treasuryContract, WAVAX_VPND_JPL, "avax"), - ]), tvl: (async) => ({}), }, methodology: "Counts liquidty on the Treasury trough Treasury Contract", diff --git a/projects/vaultka/index.js b/projects/vaultka/index.js new file mode 100644 index 00000000000..24c744a0303 --- /dev/null +++ b/projects/vaultka/index.js @@ -0,0 +1,81 @@ +module.exports = { + misrepresentedTokens: true, + hallmarks: [ + [1688342964,"Launch Sake Vault"] + ], + arbitrum: { + tvl: async (_, _b, _cb, { api }) => { + const vaults = [ + "0x0081772FD29E4838372CbcCdD020f53954f5ECDE", // VodkaVault + "0x6df0018b0449bB4468BfAE8507E13021a7aa0583", // WaterVault + ]; + const bals = await api.multiCall({ + abi: "int256:getVaultMarketValue", + calls: vaults, + }); + + const addresses = { + whiskey: "0x6532eFCC1d617e094957247d188Ae6d54093718A", + whiskeyWater: "0xa100E02e861132C4703ae96D6868664f27Eaa431", + sake: "0x45BeC5Bb0EE87181A7Aa20402C66A6dC4A923758", + sakeWater: "0x6b367F9EB22B2E6074E9548689cddaF9224FC0Ab", + }; + + const contractAbis = { + gainsBalance: "function getGainsBalance() view returns (uint256)", + gTokenPrice: "function gTokenPrice() view returns (uint256)", + wWaterBalance: "function balanceOfDAI() public view returns (uint256)", + vlpBalance: "function getVlpBalance() public view returns (uint256)", + stakedVlpBalance: + "function getStakedVlpBalance() public view returns (uint256)", + vlpPrice: "function getVLPPrice() public view returns (uint256)", + waterUSDCBal: "function balanceOfUSDC() public view returns (uint256)", + }; + + const whiskeyGainsBalance = await api.call({ + abi: contractAbis.gainsBalance, + target: addresses.whiskey, + }); + + const whiskeyGTokenPrice = await api.call({ + abi: contractAbis.gTokenPrice, + target: addresses.whiskey, + }); + + const whiskeyWaterDaiBal = await api.call({ + abi: contractAbis.wWaterBalance, + target: addresses.whiskeyWater, + }); + + const sakeWaterUSDCBal = await api.call({ + abi: contractAbis.waterUSDCBal, + target: addresses.sakeWater, + }); + + const vlpBal = await api.call({ + abi: contractAbis.vlpBalance, + target: addresses.sake, + }); + + const StakedVLPBal = await api.call({ + abi: contractAbis.stakedVlpBalance, + target: addresses.sake, + }); + + const sakeVLPPrice = await api.call({ + abi: contractAbis.vlpPrice, + target: addresses.sake, + }); + + return { + tether: bals.reduce((a, i) => a + i / 1e6, 0), + dai: + (whiskeyGainsBalance * whiskeyGTokenPrice) / 1e36 + + whiskeyWaterDaiBal / 1e18, + "usd-coin": + ((vlpBal + StakedVLPBal) * sakeVLPPrice) / 1e18 / 1e5 + + sakeWaterUSDCBal / 1e6, + }; + }, + }, +}; diff --git a/projects/veax/index.js b/projects/veax/index.js new file mode 100644 index 00000000000..f3b6a24ca3b --- /dev/null +++ b/projects/veax/index.js @@ -0,0 +1,14 @@ +const { sumTokens, call, } = require('../helper/chain/near') + +const tvl = async (_, _1, _2, { api }) => { + const contract = 'veax.near' + const tokens = await call(contract, 'get_verified_tokens') + return sumTokens({ owners: [contract], tokens}) +} + +module.exports = { + timetravel: false, + near: { + tvl, + } +} \ No newline at end of file diff --git a/projects/vector/abi.json b/projects/vector/abi.json deleted file mode 100644 index ad470bf0fcf..00000000000 --- a/projects/vector/abi.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "inputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "name": "getDepositTokensForShares", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" -} \ No newline at end of file diff --git a/projects/vector/index.js b/projects/vector/index.js index 706386f05f6..97308458c8d 100644 --- a/projects/vector/index.js +++ b/projects/vector/index.js @@ -1,89 +1,165 @@ const sdk = require("@defillama/sdk"); -const { transformAvaxAddress, } = require("../helper/portedTokens"); -const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); +const { unwrapUniswapLPs, unwrapLPsAuto } = require("../helper/unwrapLPs"); const { pool2 } = require("../helper/pool2"); -const { staking } = require("../helper/staking.js"); -const abi = require("./abi.json"); +const { staking, stakings } = require("../helper/staking.js"); +const abi = + "function getDepositTokensForShares(uint256 amount, address token) view returns (uint256)"; const contracts = require("./contracts.json"); - -async function tvl(timestamp, block, chainBlocks) { +const vectorContracts = require("./vectorContracts.json"); +////Platypus info +const platypusPoolsInfo = vectorContracts.PTP.pools; +const PtpMainStakingAddress = vectorContracts.PTP.main_staking.address; +const MasterPlatypusAddress = vectorContracts.PTP.master_platypus.address; +///Joe Info +const JoeMainStakingAddress = vectorContracts.JOE.main_staking.address; +const JoePoolsInfo = vectorContracts.JOE.pools; +///Vector Info +const masterchefAddress = vectorContracts.PROTOCOL.masterchief.address; +const OldLockerAddress = vectorContracts.PTP.old_locker.address; +const LockerAddress = vectorContracts.PTP.locker.address; +const VectorPoolsInfo = vectorContracts.PROTOCOL.pools; +const VectorStakingPools = [ + VectorPoolsInfo.VTX, + VectorPoolsInfo.XPTP, + VectorPoolsInfo.ZJOE, +]; +const VectorLPPools = [ + VectorPoolsInfo.AVAX_VTX, + VectorPoolsInfo.PTP_XPTP, + VectorPoolsInfo.JOE_ZJOE, +]; +async function tvl(timestamp, block, chainBlocks, { api }) { const balances = {}; - const transform = await transformAvaxAddress(); - - const masterChefBalances = ( - await sdk.api.abi.multiCall({ - calls: Object.keys(contracts.markets).map((token) => ({ - target: token, - params: [contracts.contracts.masterchef], + const transform = (addr) => "avax:" + addr; + //GET PLATYPUS BALANCES + const platypusPIDs = ( + await api.multiCall({ + calls: Object.values(platypusPoolsInfo).map((pool) => ({ + target: MasterPlatypusAddress, + params: [pool.lp], })), - abi: "erc20:balanceOf", - chain: "avax", - block: chainBlocks.avax, + abi: "function getPoolId(address) view returns (uint256)", + }) + ); + //console.log("platypusPIDS:", platypusPIDs); + const platypusBalancesOutputs = ( + await api.multiCall({ + calls: platypusPIDs.map((pool) => ({ + target: MasterPlatypusAddress, + params: [pool, PtpMainStakingAddress], + })), + abi: "function userInfo(uint256,address) view returns (uint256,uint256,uint256,uint256)", }) - ).output; - const stakingCalls = masterChefBalances.map((b) => ({ - params: [b.output, contracts.markets[b.input.target].underlying], + ); + //console.log("platypusBalancesOutputs:", platypusBalancesOutputs); + const platypusBalances = Object.values(platypusPoolsInfo).map((pool, i) => ({ + balance: platypusBalancesOutputs[i][0], + token: pool.token.address, + isLP: false, })); - - const underlyingBalances = ( - await sdk.api.abi.multiCall({ - calls: stakingCalls, - target: contracts.contracts.mainStaking, - abi, - chain: "avax", - block: chainBlocks.avax, + //console.log("platypusBalances:", platypusBalances); + //GET JOE BALANCES + const joeBalancesOutputs = ( + await api.multiCall({ + calls: Object.values(JoePoolsInfo).map((pool) => ({ + target: masterchefAddress, + params: [pool.receipt.address], + })), + abi: "function getPoolInfo(address) view returns (uint256,uint256,uint256,uint256)", }) - ).output; + ); + //console.log("joeBalancesOutputs:", joeBalancesOutputs); + const joeBalances = Object.values(JoePoolsInfo).map((pool, i) => ({ + balance: joeBalancesOutputs[i][2], //balance + token: pool.token.address, //underlying lp token + isLP: true, + })); + //console.log("joeBalances:", joeBalances); + //GET VECTOR CORE BALANCES + const masterChefBalancesOutput = ( + await api.multiCall({ + calls: [...VectorStakingPools, ...VectorLPPools].map((pool) => ({ + target: pool.token.address, + params: [masterchefAddress], + })), + abi: "erc20:balanceOf", + }) + ); + //console.log("masterChefBalancesOutput:", masterChefBalancesOutput); + const masterChefBalances = [...VectorStakingPools, ...VectorLPPools].map( + (pool, i) => ({ + balance: masterChefBalancesOutput[i], + token: pool.token.address, + isLP: pool.token.contract === "IJoePair", + }) + ); + //console.log("masterChefBalances:", masterChefBalances); + //GET OLD LOCKER BALANCES + const oldLockerBalancesOutput = ( + await api.multiCall({ + calls: [ + { + target: "0x601B89a43EBBE26FA48d91F43eD63D08831d17CD", + params: [], + }, + ], + abi: "function totalSupply() view returns (uint256)", + }) + ); + //console.log("oldLockerBalancesOutput:", oldLockerBalancesOutput); + //GET NEW LOCKER BALANCES + const newLockerBalancesOutput = ( + await api.multiCall({ + calls: [ + { + target: LockerAddress, + params: [], + }, + ], + abi: "function totalLocked() view returns (uint256)", + }) + ); + //console.log("newLockerBalancesOutput:", newLockerBalancesOutput); + const lockerBalances = [ + { + balance: oldLockerBalancesOutput[0], + token: vectorContracts.tokens.VTX.address, + isLP: false, + }, + { + balance: newLockerBalancesOutput[0], + token: vectorContracts.tokens.VTX.address, + isLP: false, + }, + ]; + //console.log("lockerBalances:", lockerBalances); + const AllBalances = [ + ...platypusBalances, + ...joeBalances, + ...masterChefBalances, + ...lockerBalances, + ]; - for (let i = 0; i < underlyingBalances.length; i++) { - const info = Object.values(contracts.markets)[i]; - if (info.isLP) { - await unwrapUniswapLPs( - balances, - [ - { - balance: masterChefBalances[i].output, - token: info.isJoeLP - ? info.underlying - : Object.keys(contracts.markets)[i], - }, - ], - chainBlocks.avax, - "avax", - transform - ); - } else if (info.noUnderlying) { - sdk.util.sumSingleBalance( - balances, - transform(Object.keys(contracts.markets)[i]), - masterChefBalances[i].output - ); - } else { - sdk.util.sumSingleBalance( - balances, - transform(underlyingBalances[i].input.params[1]), - underlyingBalances[i].output - ); - } + for (let i = 0; i < AllBalances.length; i++) { + const info = AllBalances[i]; + sdk.util.sumSingleBalance(balances, transform(info.token), info.balance); } - return balances + return unwrapLPsAuto({ api, balances}); } module.exports = { doublecounted: true, avax: { tvl, - staking: staking( - contracts.contracts.masterchef, - contracts.contracts.VTX, + /* staking: stakings( + [masterchefAddress, LockerAddress], + [vectorContracts.tokens.VTX.address], "avax", "avax:0x5817D4F0b62A59b17f75207DA1848C2cE75e7AF4" - ), - pool2: pool2( + ), */ //No More Staking of VTX + pool2: staking( contracts.contracts.masterchef, contracts.contracts.pool2, - "avax", - (a) => `avax:${a}` ), }, }; diff --git a/projects/vector/vectorContracts.json b/projects/vector/vectorContracts.json new file mode 100644 index 00000000000..a340d22abcf --- /dev/null +++ b/projects/vector/vectorContracts.json @@ -0,0 +1,1792 @@ +{ + "ACCOUNTS": { + "deployer": "0xdd5cf30f56C37d3243A23543dC5bd5eE576970e2", + "ptp_multisig": "0x5b382F33926813B81C9861B2A2ec9bE9D24d33bf", + "born": "0xE2e60A1bF02c7A2a0bA45791cF30B99F2A6aFaa0", + "multisig_vector": "0x3bd639c8893106a0656b8764e269008b93c53c35", + "deployer_multisig": "0x1aB96ce023b73E37D0031821b0c613b8b37D10A9" + }, + "PTP": { + "main_staking": { + "address": "0x8B3d9F0017FA369cD8C164D0Cc078bf4cA588aE5", + "contract": "MainStaking", + "should_be_upgraded": true + }, + "proxy_admin": { + "address": "0x90212d5fbc7Cff1CF476221B706681ADfe3f1a0B", + "contract": "ProxyAdmin" + }, + "old_locker": { + "address": "0x574679Ec54972cf6d705E0a71467Bb5BB362919D", + "contract": "Locker", + "ignore_connect": true + }, + "locker": { + "address": "0xF99264cbf9652824B3412FA21E8cBEB69c3ea0a7", + "contract": "LockerV2", + "should_be_upgraded": true + }, + "stable_staking": { + "address": "0x66357dcace80431aee0a7507e2e361b7e2402370", + "ignore_connect": true + }, + "master_platypus": { + "address": "0xff6934aac9c94e1c39358d4fdcf70aeca77d0ab0", + "contract": "MasterPlatypus" + }, + "ptp_staking": { + "address": "0x5857019c749147EEE22b1Fe63500F237F3c1B692", + "contract": "IPTPStaking" + }, + "nft": { + "address": "0x6A04a578247e15e3c038AcF2686CA00A624a5aa0", + "contract": "IPTPNft" + }, + "smart_convertor": { + "address": "0xb3f5A30e6D57573eC060487a0Cb90421D196D1cB", + "contract": "IxTokenConvertor" + }, + "zapper": { + "address": "0x66e66cADB63943C1587fA6274BD89Ad22072c094", + "contract": "AvaxZapper" + }, + "bribe_manager": { + "address": "0xDFDA9a6a113aD32Cfbe34ea85DddBB74cb22768c", + "contract": "BribeManager", + "should_be_upgraded": true + }, + "apr_helper": { + "address": "0xD303B4CBf706650eB1A8B73683065aDA3f9d306A", + "contract": "APRHelper" + }, + "proxy_admin_helper": { + "address": "0xF15bAc7dd9C0941d2e13C91C0208bDb7020593A8", + "contract": "ProxyAdmin" + }, + "proxy_admin_locker": { + "address": "0x51f8283A7Ff9e5CFa3045FFd5EB5F4D1071Bb1E3", + "contract": "ProxyAdmin" + }, + "proxy_admin_bribe_manager": { + "address": "0x51f8283A7Ff9e5CFa3045FFd5EB5F4D1071Bb1E3", + "contract": "ProxyAdmin" + }, + "pools": { + "USDTe": { + "token": { + "address": "0xc7198437980c041c805A1EDcbA50c1Ce5db95118", + "contract": "IERC20" + }, + "platypus_rewarder": { + "address": "0x0000000000000000000000000000000000000000", + "ignore_connect": true + }, + "rewarder": { + "address": "0xF98578C210C8c7d9cBE8624Db9052d4F861aF3aC", + "contract": "BaseRewardPool" + }, + "receipt": { + "address": "0xB0e2d7d733e013e9005E1fc3Be70B30c58c7359b", + "contract": "IERC20" + }, + "helper": { + "address": "0x68ec440B32a7c919Cf7BaBb8B6dd57f2e697D9B6", + "contract": "IPoolHelperV4" + }, + "asset": { + "address": "0xc7198437980c041c805A1EDcbA50c1Ce5db95118", + "contract": "IERC20" + }, + "bribe": { + "address": "0x4eac0Da0dc31a0fd5072F7742e840a8c9387b1b5", + "contract": "IBribe" + }, + "compounder": { + "address": "0x085a687ad31d0707B5f3CAeF24B36b27F44D789b", + "contract": "ICompounderPTP" + }, + "pid": 0, + "lp": "0x0D26D103c91F63052Fbca88aAF01d5304Ae40015" + }, + "BUSD": { + "token": { + "address": "0x9C9e5fD8bbc25984B178FdCE6117Defa39d2db39", + "contract": "IERC20" + }, + "platypus_rewarder": { + "address": "0x0000000000000000000000000000000000000000", + "ignore_connect": true + }, + "rewarder": { + "address": "0x7D0Ab3500948d83dFC6F44013d8fa1695165Bd85", + "contract": "BaseRewardPool" + }, + "receipt": { + "address": "0xe6c06eb3B6f21FE59Eda663374906952066D12A6", + "contract": "IERC20" + }, + "helper": { + "address": "0xf353dCB1bA5983D1CE51Af0F005686F466f83F26", + "contract": "IPoolHelperV4" + }, + "asset": { + "address": "0x9C9e5fD8bbc25984B178FdCE6117Defa39d2db39", + "contract": "IERC20" + }, + "bribe": { + "address": "0xF2c78269DDF9368BfDA204BC9C0d3782d96c6581", + "contract": "IBribe" + }, + "compounder": { + "address": "0x8FC24d0a62F36da3A2199Db17B1EF536CD2c4B52", + "contract": "ICompounderPTP" + }, + "pid": 24, + "lp": "0xe23F8CCDeB4e8Ce5d9fE76782718cD85D12689C8" + }, + "USDCe": { + "token": { + "address": "0xA7D7079b0FEaD91F3e65f86E8915Cb59c1a4C664", + "contract": "IERC20" + }, + "platypus_rewarder": { + "address": "0x0000000000000000000000000000000000000000", + "ignore_connect": true + }, + "rewarder": { + "address": "0x80acC5CF95E8e9223aC322bf0b489B2828420A8b", + "contract": "BaseRewardPool" + }, + "receipt": { + "address": "0xc641350D40256120BED47cF0AD24B5ce01D04af3", + "contract": "IERC20" + }, + "helper": { + "address": "0x10D5bd311403B7a268e19A5f737Ad935e0684b7B", + "contract": "IPoolHelperV4" + }, + "asset": { + "address": "0xA7D7079b0FEaD91F3e65f86E8915Cb59c1a4C664", + "contract": "IERC20" + }, + "bribe": { + "address": "0x1eaffB61971992744223638B9f4a2FAB1c3F1072", + "contract": "IBribe" + }, + "compounder": { + "address": "0xb212D0cf57569cfC87AC3dBD60eF49EA5635BCa2", + "contract": "ICompounderPTP" + }, + "pid": 1, + "lp": "0x909B0ce4FaC1A0dCa78F8Ca7430bBAfeEcA12871" + }, + "DAIe": { + "token": { + "address": "0xd586E7F844cEa2F87f50152665BCbc2C279D8d70", + "contract": "IERC20" + }, + "platypus_rewarder": { + "address": "0x0000000000000000000000000000000000000000", + "ignore_connect": true + }, + "rewarder": { + "address": "0x42FF74b00B57b8e087CF60cDfAe27EE4Df11b0ca", + "contract": "BaseRewardPool" + }, + "receipt": { + "address": "0x2FdC25cEc50Dab4E1ECCFa1Be40509ae049cEaE0", + "contract": "IERC20" + }, + "helper": { + "address": "0x397Cb236f65Be601eBf63aB6387546cB21a52276", + "contract": "IPoolHelperV4" + }, + "asset": { + "address": "0xd586E7F844cEa2F87f50152665BCbc2C279D8d70", + "contract": "IERC20" + }, + "bribe": { + "address": "0xd9C3cd6e8F56b48132bBF2a519feD7d617f5561A", + "contract": "IBribe" + }, + "compounder": { + "address": "0xbD01815214569666b0D39E0acb765a15cd4972cf", + "contract": "ICompounderPTP" + }, + "pid": 2, + "lp": "0xc1Daa16E6979C2D1229cB1fd0823491eA44555Be" + }, + "USDC": { + "token": { + "address": "0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E", + "contract": "IERC20" + }, + "platypus_rewarder": { + "address": "0x0000000000000000000000000000000000000000", + "ignore_connect": true + }, + "rewarder": { + "address": "0x145fF33FbEf61e87D9E033AB86AB38a7acC04C2E", + "contract": "BaseRewardPool" + }, + "receipt": { + "address": "0x0ADab2F0455987098059Cfc10875C010800c659F", + "contract": "IERC20" + }, + "helper": { + "address": "0xE5011Ab29612531727406d35cd9BcCE34fAEdC30", + "contract": "IPoolHelperV4" + }, + "asset": { + "address": "0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E", + "contract": "IERC20" + }, + "bribe": { + "address": "0x7b655819d00B71c0F409A45317b0b7aaC9E612e6", + "contract": "IBribe" + }, + "compounder": { + "address": "0x31D02ae36379d5F98f6eB7B385BFd42Ee0a6d352", + "contract": "ICompounderPTP" + }, + "pid": 4, + "lp": "0xAEf735B1E7EcfAf8209ea46610585817Dc0a2E16" + }, + "USDT": { + "token": { + "address": "0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7", + "contract": "IERC20" + }, + "platypus_rewarder": { + "address": "0x0000000000000000000000000000000000000000", + "ignore_connect": true + }, + "rewarder": { + "address": "0x39532F44adBD6197d8C2198F6F54e71F6B046449", + "contract": "BaseRewardPool" + }, + "receipt": { + "address": "0x3A51459e72e03c8D4213201feE9F5a2300b3D1fF", + "contract": "IERC20" + }, + "helper": { + "address": "0x817933fd1b0274300d0aCE6749e45814c7cBa695", + "contract": "IPoolHelperV4" + }, + "asset": { + "address": "0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7", + "contract": "IERC20" + }, + "bribe": { + "address": "0xbb9a4E7C8172BbdDeed00066Ec8A007690cd1705", + "contract": "IBribe" + }, + "compounder": { + "address": "0xAcae576E40677cd2c3950783cCC71A13B9b2723C", + "contract": "ICompounderPTP" + }, + "pid": 5, + "lp": "0x776628A5C37335608DD2a9538807b9bba3869E14" + }, + "FRAX": { + "token": { + "address": "0xD24C2Ad096400B6FBcd2ad8B24E7acBc21A1da64", + "contract": "IERC20" + }, + "platypus_rewarder": { + "address": "0x0000000000000000000000000000000000000000", + "ignore_connect": true + }, + "rewarder": { + "address": "0xF53243FD1bD8D6d12A482C1609283166DD38B47E", + "contract": "BaseRewardPool" + }, + "receipt": { + "address": "0x245260481a824A6C0103B0d840EB87B8c6cA0e72", + "contract": "IERC20" + }, + "helper": { + "address": "0x254E536beA1eA2BB7BbB890d0f8b71aF067305cD", + "contract": "IPoolHelperV4" + }, + "asset": { + "address": "0xD24C2Ad096400B6FBcd2ad8B24E7acBc21A1da64", + "contract": "IERC20" + }, + "bribe": { + "address": "0x0000000000000000000000000000000000000000", + "ignore_connect": true, + "contract": "IBribe" + }, + "compounder": { + "address": "0xf942175Deaa32aca0D12b967F5eB85ed65B94a10", + "contract": "ICompounderPTP" + }, + "pid": 6, + "lp": "0x6FD4b4c38ED80727EcD0d58505565F9e422c965f" + }, + "MIM": { + "token": { + "address": "0x130966628846BFd36ff31a822705796e8cb8C18D", + "contract": "IERC20" + }, + "platypus_rewarder": { + "address": "0x0000000000000000000000000000000000000000", + "ignore_connect": true + }, + "rewarder": { + "address": "0x20e3C7DB33AD5eDa3cc573C328fc7FB089043a0f", + "contract": "BaseRewardPool" + }, + "receipt": { + "address": "0x6e3Ce3bCa4a388298FeC0C526Fff7b71A77407Da", + "contract": "IERC20" + }, + "helper": { + "address": "0x3A7E94F11D742e3E7021a769A9C12cA21039E9D9", + "contract": "IPoolHelperV4" + }, + "asset": { + "address": "0x130966628846BFd36ff31a822705796e8cb8C18D", + "contract": "IERC20" + }, + "bribe": { + "address": "0x0000000000000000000000000000000000000000", + "ignore_connect": true, + "contract": "IBribe" + }, + "compounder": { + "address": "0x3C4a0f96673f1b510107bbf2892ED66325CeF57d", + "contract": "ICompounderPTP" + }, + "pid": 10, + "lp": "0xF01cEA00598d87Cb9792a01B040d04b0bd8Ca781" + }, + "MONEY": { + "token": { + "address": "0x0f577433bf59560ef2a79c124e9ff99fca258948", + "contract": "IERC20" + }, + "platypus_rewarder": { + "address": "0x01D12ce674b8963e3940F0d2517f9283f65a16a9" + }, + "rewarder": { + "address": "0xaE82B6F7de1c535C1352681f232925953E8160Fe", + "contract": "BaseRewardPool" + }, + "receipt": { + "address": "0x7777bA66fBbE6244e6392Cb151D87271647040ea", + "contract": "IERC20" + }, + "helper": { + "address": "0xFA7eBdAB8eFF56AeFc28AB2Df67Fb5B9C43F387a", + "contract": "IPoolHelperV4" + }, + "asset": { + "address": "0x0f577433bf59560ef2a79c124e9ff99fca258948", + "contract": "IERC20" + }, + "bribe": { + "address": "0x21eb980ECbA80eb1992c0d210B0fed26f1ACCb3f", + "contract": "IBribe" + }, + "compounder": { + "address": "0x1A72c4611Aa7261A8e3bE8FFa9f891d8D4Fb7594", + "contract": "ICompounderPTP" + }, + "pid": 20, + "lp": "0xE08947eE864Af325D9F98743B3b905875Ae0Ec99" + }, + "USDC_MONEY": { + "token": { + "address": "0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E", + "contract": "IERC20" + }, + "platypus_rewarder": { + "address": "0x16837b7600F35f00C2c335bd73c4A82AfB23672B" + }, + "rewarder": { + "address": "0xb9B7fe8A95a837aaE12b17160B9D9430E0727026", + "contract": "BaseRewardPool" + }, + "receipt": { + "address": "0xDa460594b7447E1F04a00d44DFf2ead80bB26a16", + "contract": "IERC20" + }, + "helper": { + "address": "0x7FFA4b93eA03182BE0EAC8569390D44096ac11B2", + "contract": "IPoolHelperV4" + }, + "asset": { + "address": "0x551C259Bf4D88edFdAbb04179342a73dAa759583", + "contract": "IERC20" + }, + "bribe": { + "address": "0x0Cb7cAeeC467d69982c0FFc8369D1682fd1e5277", + "contract": "IBribe" + }, + "compounder": { + "address": "0x53ccA4921522e43EF6652420c3eEC6FBfE987a55", + "contract": "ICompounderPTP" + }, + "pid": 21, + "lp": "0x551C259Bf4D88edFdAbb04179342a73dAa759583" + }, + "USDC_MIM": { + "token": { + "address": "0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E", + "contract": "IERC20" + }, + "platypus_rewarder": { + "address": "0x0000000000000000000000000000000000000000", + "ignore_connect": true + }, + "rewarder": { + "address": "0xF896540F7Eadd5684e803011eA989f803ca87039", + "contract": "BaseRewardPool" + }, + "receipt": { + "address": "0x3f941f31828E251aC24b445c5E318DEB691b5B68", + "contract": "IERC20" + }, + "helper": { + "address": "0xfB09b3390c9217A911c0a490ff52E273B125C52F", + "contract": "IPoolHelperV4" + }, + "asset": { + "address": "0x4E5704991b43C1D33b9Ccd1BC33B211bf068385A", + "contract": "IERC20" + }, + "bribe": { + "address": "0x0000000000000000000000000000000000000000", + "ignore_connect": true, + "contract": "IBribe" + }, + "compounder": { + "address": "0x258104124CFfDe7fB18fE2814294a9f8E1507364", + "contract": "ICompounderPTP" + }, + "pid": 11, + "lp": "0x4E5704991b43C1D33b9Ccd1BC33B211bf068385A" + }, + "USDC_FRAX": { + "token": { + "address": "0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E", + "contract": "IERC20" + }, + "platypus_rewarder": { + "address": "0x0000000000000000000000000000000000000000", + "ignore_connect": true + }, + "rewarder": { + "address": "0x6004149e0A7D76E4224f8949164CBfFabdc7C78e", + "contract": "BaseRewardPool" + }, + "receipt": { + "address": "0x6D46346250A46516c0c1f51709c0330476069b41", + "contract": "IERC20" + }, + "helper": { + "address": "0x70cFAD7977BCA25e98f97E429Da76a54e20d325f", + "contract": "IPoolHelperV4" + }, + "asset": { + "address": "0x035D7D7F209B5d18e2AB5C2072E85B32e1D43760", + "contract": "IERC20" + }, + "bribe": { + "address": "0x0000000000000000000000000000000000000000", + "ignore_connect": true, + "contract": "IBribe" + }, + "compounder": { + "address": "0x785bC3B4118B1DfD91A9D45144953503AC385c14", + "contract": "ICompounderPTP" + }, + "pid": 7, + "lp": "0x035D7D7F209B5d18e2AB5C2072E85B32e1D43760" + }, + "AVAX_SAVAX": { + "token": { + "address": "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7", + "contract": "IERC20" + }, + "platypus_rewarder": { + "address": "0xdAe72ae3C79305e803Ea0eFc6962aF903Eca6b23" + }, + "rewarder": { + "address": "0x90e8fd47847ddD6A3106480a2476869bE7E80894", + "contract": "BaseRewardPool" + }, + "receipt": { + "address": "0x25DD42103b7DA808e68A2bae5e14F48871488a85", + "contract": "IERC20" + }, + "helper": { + "address": "0xab42ed09F43DDa849aa7F62500885A973A38a8Bc", + "contract": "IPoolHelperV4" + }, + "asset": { + "address": "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7", + "contract": "IERC20" + }, + "bribe": { + "address": "0x901A1Ed26036E1405BC465217bc714Fa2168BD6A", + "contract": "IBribe" + }, + "bonus_reward": { + "address": "0x8729438eb15e2c8b576fcc6aecda6a148776c0f5", + "contract": "IERC20" + }, + "compounder": { + "address": "0xe2406Af0E26769D3231682C80D4bB7bBdF329A88", + "contract": "ICompounderPTP" + }, + "pid": 12, + "lp": "0xC73eeD4494382093C6a7C284426A9a00f6C79939" + }, + "SAVAX": { + "token": { + "address": "0x2b2C81e08f1Af8835a78Bb2A90AE924ACE0eA4bE", + "contract": "IERC20" + }, + "platypus_rewarder": { + "address": "0x3643644C14b77ca475A80305717Bf91dbA76bbFf" + }, + "rewarder": { + "address": "0x90a0bF7D1926D222A5ff64725ca4FBCE8CF67Fd9", + "contract": "BaseRewardPool" + }, + "receipt": { + "address": "0x8Aa347D9A2Bb8e32342f50939236251853604C79", + "contract": "IERC20" + }, + "helper": { + "address": "0x91F78865b239432A1F1Cc1fFeC0Ac6203079E6D7", + "contract": "IPoolHelperV4" + }, + "asset": { + "address": "0x2b2C81e08f1Af8835a78Bb2A90AE924ACE0eA4bE", + "contract": "IERC20" + }, + "bribe": { + "address": "0x99249a48a52c7b380644d3466c92ffc68F76047A", + "contract": "IBribe" + }, + "bonus_reward": { + "address": "0x8729438eb15e2c8b576fcc6aecda6a148776c0f5", + "contract": "IERC20" + }, + "compounder": { + "address": "0x1636bE3843E86826cB6aDC141B5d40d782763B85", + "contract": "ICompounderPTP" + }, + "pid": 13, + "lp": "0xA2A7EE49750Ff12bb60b407da2531dB3c50A1789" + }, + "YUSD": { + "token": { + "address": "0x111111111111ed1d73f860f57b2798b683f2d325", + "contract": "IERC20" + }, + "platypus_rewarder": { + "address": "0xEF76fcA8e9DABB6EFBe0eA528121a62d7173d0ea" + }, + "rewarder": { + "address": "0xa94679E1A08c944F951775b57C9C2075B15071e5", + "contract": "BaseRewardPool" + }, + "receipt": { + "address": "0x42eCB16906851C94D7De3d8Fa153F64459b2F09d", + "contract": "IERC20" + }, + "helper": { + "address": "0x3BC14c2cBeDB1e34e2787Eb0AaB0C1ACfa276Ddf", + "contract": "IPoolHelperV4" + }, + "asset": { + "address": "0x111111111111ed1d73f860f57b2798b683f2d325", + "contract": "IERC20" + }, + "bribe": { + "address": "0x933faf47D3bbf4955462Ddc8cb523209e09224f1", + "contract": "IBribe" + }, + "bonus_reward": { + "address": "0x77777777777d4554c39223C354A05825b2E8Faa3", + "contract": "IERC20" + }, + "compounder": { + "address": "0xe859d1755f9FA62d8959BCab8a6E28F99c1CCAdD", + "contract": "ICompounderPTP" + }, + "pid": 16, + "lp": "0x7716307350c0819eD05C3e7f6c478b27CAED5361" + }, + "USDC_YUSD": { + "token": { + "address": "0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e", + "contract": "IERC20" + }, + "platypus_rewarder": { + "address": "0xD70612fd592612db0F02E38C7Af12df5B6A9344b" + }, + "rewarder": { + "address": "0x607adA91A98a6c263E08D250bc9143ba81166a5a", + "contract": "BaseRewardPool" + }, + "receipt": { + "address": "0xbB720b2e8623C2351302Fe03C9DFD44945CeF738", + "contract": "IERC20" + }, + "helper": { + "address": "0xC0D8965935D02Bf0Ec0A6DCE698ad70dF261cDA4", + "contract": "IPoolHelperV4" + }, + "asset": { + "address": "0x4b851118a4A4948799f24d0CBE17FA3dad09e2D5", + "contract": "IERC20" + }, + "bribe": { + "address": "0x9a4003DDDcf2C4ECd5e2916730Dee618a1Df9142", + "contract": "IBribe" + }, + "bonus_reward": { + "address": "0x77777777777d4554c39223C354A05825b2E8Faa3", + "contract": "IERC20" + }, + "compounder": { + "address": "0x8F9b2A7Ae089AA01636996eBAf276f48feFDb916", + "contract": "ICompounderPTP" + }, + "pid": 17, + "lp": "0x4b851118a4A4948799f24d0CBE17FA3dad09e2D5" + }, + "WBTCe": { + "token": { + "address": "0x50b7545627a5162F82A992c33b87aDc75187B218", + "contract": "IERC20" + }, + "platypus_rewarder": { + "address": "0x4Eb6CA3EC872f973d6337cf13D0a73F862BDE8Fa" + }, + "rewarder": { + "address": "0x3BA605dfA4Eb51fc2Cfeb1d81860D8b5045F914c", + "contract": "BaseRewardPool" + }, + "receipt": { + "address": "0x77A3eAA4045ef334A5d87deb2f4AE506c85dceA1", + "contract": "IERC20" + }, + "helper": { + "address": "0x34555D0d46F2D1B69E015078Cf572A08f73533A4", + "contract": "IPoolHelperV4" + }, + "asset": { + "address": "0x50b7545627a5162F82A992c33b87aDc75187B218", + "contract": "IERC20" + }, + "bribe": { + "address": "0x0000000000000000000000000000000000000000", + "ignore_connect": true, + "contract": "IBribe" + }, + "bonus_reward": { + "address": "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7", + "contract": "IERC20" + }, + "compounder": { + "address": "0x3c2e602CE3176a696E7EeE221CC6DE15Fa3210A5", + "contract": "ICompounderPTP" + }, + "pid": 19, + "lp": "0xc09c12093b037866Bf68C9474EcDb5113160fBcE" + }, + "BTCb": { + "token": { + "address": "0x152b9d0FdC40C096757F570A51E494bd4b943E50", + "contract": "IERC20" + }, + "platypus_rewarder": { + "address": "0x21295E87d2323e477E0373716D918E0061Bc928A" + }, + "rewarder": { + "address": "0x4bCB7E0A31CB466FcF4D37d8642a290eBBe2017F", + "contract": "BaseRewardPool" + }, + "receipt": { + "address": "0x9554903a1Ad1E42781008eAb66aC163818B8ecB1", + "contract": "IERC20" + }, + "helper": { + "address": "0x21cD49b0A23584DDD00E5dF9ADA6814135B3D8cD", + "contract": "IPoolHelperV4" + }, + "asset": { + "address": "0x152b9d0FdC40C096757F570A51E494bd4b943E50", + "contract": "IERC20" + }, + "bribe": { + "address": "0x0000000000000000000000000000000000000000", + "ignore_connect": true, + "contract": "IBribe" + }, + "bonus_reward": { + "address": "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7", + "contract": "IERC20" + }, + "compounder": { + "address": "0x06643947740f932B54b6832cC3b8Aa600E547461", + "contract": "ICompounderPTP" + }, + "pid": 18, + "lp": "0x209a0399A2905900C0d1a9a382fe23e37024dC84" + }, + "yyAVAX": { + "token": { + "address": "0xF7D9281e8e363584973F946201b82ba72C965D27", + "contract": "IERC20" + }, + "platypus_rewarder": { + "address": "0x0000000000000000000000000000000000000000", + "ignore_connect": true + }, + "rewarder": { + "address": "0x8b95af4835b44b91C788D51F4A71bD0eeA9c8Bf2", + "contract": "BaseRewardPool" + }, + "receipt": { + "address": "0xca815D56D9b04B9FED10A3A67e0dBfF696c43FDD", + "contract": "IERC20" + }, + "helper": { + "address": "0x210155f514A94D84eC4c45cCA8eb30063c216811", + "contract": "IPoolHelperV4" + }, + "asset": { + "address": "0xF7D9281e8e363584973F946201b82ba72C965D27", + "contract": "IERC20" + }, + "bribe": { + "address": "0x3D0798Ffea1b441731f95F1D5287DC0Aee3b12A5", + "contract": "IBribe" + }, + "compounder": { + "address": "0xc08986C33A714545330424fd5Fa132A8110E5E4F", + "contract": "ICompounderPTP" + }, + "pid": 23, + "lp": "0x3BEB0D3DB537b79D377131Ce81950B683d382Ec9" + }, + "AVAX_yyAVAX": { + "token": { + "address": "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7", + "contract": "IERC20" + }, + "platypus_rewarder": { + "address": "0x0000000000000000000000000000000000000000", + "ignore_connect": true + }, + "rewarder": { + "address": "0x4f2f2BfbA52A4bD66D51eB15668c2146733905a7", + "contract": "BaseRewardPool" + }, + "receipt": { + "address": "0x343f4280d39E0aD8Ca9dEfd87ADeA88baDc1EFf4", + "contract": "IERC20" + }, + "helper": { + "address": "0xAF224FD9cF65e869E150013529694be18bE7b418", + "contract": "IPoolHelperV4" + }, + "asset": { + "address": "0x12141b8FD20b4bBdd5F4e911bF91575258A3eABD", + "contract": "IERC20" + }, + "bribe": { + "address": "0x2aD5fC90F95f236F5276E795A5A46381bFE5aa92", + "contract": "IBribe" + }, + "compounder": { + "address": "0x51092084b97FA8cF8fD64d205DA66B12E63D9b3f", + "contract": "ICompounderPTP" + }, + "pid": 22, + "lp": "0x12141b8FD20b4bBdd5F4e911bF91575258A3eABD" + }, + "axlUSDC": { + "token": { + "address": "0xfaB550568C688d5D8A52C7d794cb93Edc26eC0eC", + "contract": "IERC20" + }, + "platypus_rewarder": { + "address": "0x0000000000000000000000000000000000000000", + "ignore_connect": true + }, + "rewarder": { + "address": "0x2bE48FBf5bf01325d8F6AF61F784742C051D7f3d", + "contract": "BaseRewardPool" + }, + "receipt": { + "address": "0x92A5A8e598FbaB8cfb1C6F7B6C098E984606E1d9", + "contract": "IERC20" + }, + "helper": { + "address": "0xB987A78368607202257c12E4AFCa9b0E812Ab50A", + "contract": "IPoolHelperV4" + }, + "asset": { + "address": "0xfaB550568C688d5D8A52C7d794cb93Edc26eC0eC", + "contract": "IERC20" + }, + "bribe": { + "address": "0x4627357bf31bbf570d15688c3505D5B4E7a81E0F", + "contract": "IBribe" + }, + "compounder": { + "address": "0xCd51d2d19A8788E576A7a63A4bBEa3F3f746963d", + "contract": "ICompounderPTP" + }, + "pid": 26, + "lp": "0xC97d830Cc15B35D361985a48d8d9e52A56B0f94F" + }, + "axlUSDC_USDC": { + "token": { + "address": "0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E", + "contract": "IERC20" + }, + "platypus_rewarder": { + "address": "0x0000000000000000000000000000000000000000", + "ignore_connect": true + }, + "rewarder": { + "address": "0x6E0c0211D62914E403D800bdCDc246fAA2fb6FCf", + "contract": "BaseRewardPool" + }, + "receipt": { + "address": "0x16c29A86859BaD6459e5F3480Fa98A00972f5D88", + "contract": "IERC20" + }, + "helper": { + "address": "0xd961d30b77323f1cEeA16AceB1f34e04c166d73f", + "contract": "IPoolHelperV4" + }, + "asset": { + "address": "0x7ECE2e39fC384d15e7004d84687dA67218A39a74", + "contract": "IERC20" + }, + "bribe": { + "address": "0x099eA314Ce7D017D8dba5f6A5ECD4E5C0393d945", + "contract": "IBribe" + }, + "compounder": { + "address": "0x845B58b2760dE2930b15d3269e67B37a6997CaaC", + "contract": "ICompounderPTP" + }, + "pid": 27, + "lp": "0x7ECE2e39fC384d15e7004d84687dA67218A39a74" + }, + "ankrAvax": { + "token": { + "address": "0xc3344870d52688874b06d844E0C36cc39FC727F6", + "contract": "IERC20" + }, + "platypus_rewarder": { + "address": "0x0000000000000000000000000000000000000000", + "ignore_connect": true + }, + "rewarder": { + "address": "0x462EF7A3d147f08B22444F1198Db40d211316Ca4", + "contract": "BaseRewardPool" + }, + "receipt": { + "address": "0x6B763b16b183654D4cdd72cb002beD1b4A61e575", + "contract": "IERC20" + }, + "helper": { + "address": "0xa90debe08c978e93cD3b51b93fc256e52d2Bd73A", + "contract": "IPoolHelperV4" + }, + "asset": { + "address": "0xc3344870d52688874b06d844E0C36cc39FC727F6", + "contract": "IERC20" + }, + "bribe": { + "address": "0x7b35229e2451220237f3121464713F3446E740F1", + "contract": "IBribe" + }, + "compounder": { + "address": "0xe5187908159280D3aaA4503863723c9275BE3ECa", + "contract": "ICompounderPTP" + }, + "pid": 28, + "lp": "0x542dd5F38fcb3AAb28d6418CF3e1d36329A79aC7" + }, + "AVAX_ankrAvax": { + "token": { + "address": "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7", + "contract": "IERC20" + }, + "platypus_rewarder": { + "address": "0x0000000000000000000000000000000000000000", + "ignore_connect": true + }, + "rewarder": { + "address": "0x78021C378f9178a9467A2bC4d55a49353993a7D0", + "contract": "BaseRewardPool" + }, + "receipt": { + "address": "0xB6AD1EC2def4617380C60bc9f145dEc820D5b831", + "contract": "IERC20" + }, + "helper": { + "address": "0x4C0b285d8429c5c8Db4d40BAD37079293d0E2688", + "contract": "IPoolHelperV4" + }, + "asset": { + "address": "0xad589CFB73922700Dc46cA39CDF83B9618ac91E0", + "contract": "IERC20" + }, + "bribe": { + "address": "0x623908104457d232F526a2d6e021e537Cb38229f", + "contract": "IBribe" + }, + "compounder": { + "address": "0x7021B6192f456Ce92D8570B7943c51E4510A1cF7", + "contract": "ICompounderPTP" + }, + "pid": 29, + "lp": "0xad589CFB73922700Dc46cA39CDF83B9618ac91E0" + } + } + }, + "tokens": { + "BUSD": { + "address": "0x9C9e5fD8bbc25984B178FdCE6117Defa39d2db39", + "contract": "IERC20" + }, + "yyAVAX": { + "address": "0xF7D9281e8e363584973F946201b82ba72C965D27", + "contract": "IERC20" + }, + "QI": { + "address": "0x8729438eb15e2c8b576fcc6aecda6a148776c0f5", + "contract": "IERC20" + }, + "UST": { + "address": "0xb599c3590f42f8f995ecfa0f85d2980b76862fc1", + "contract": "IERC20" + }, + "VTX": { + "address": "0x5817D4F0b62A59b17f75207DA1848C2cE75e7AF4", + "contract": "IERC20" + }, + "XPTP": { + "address": "0x060556209E507d30f2167a101bFC6D256Ed2f3e1", + "contract": "IERC20" + }, + "PTP": { + "address": "0x22d4002028f537599be9f666d1c4fa138522f9c8", + "contract": "IERC20" + }, + "PTP_XPTP": { + "address": "0xc4b7121b4fc065decd26c33fb32e42c543e8850d", + "contract": "IERC20" + }, + "locker": { + "address": "0xF99264cbf9652824B3412FA21E8cBEB69c3ea0a7", + "contract": "LockerV2" + }, + "USDTe": { + "address": "0xc7198437980c041c805A1EDcbA50c1Ce5db95118", + "contract": "IERC20" + }, + "USDCe": { + "address": "0xA7D7079b0FEaD91F3e65f86E8915Cb59c1a4C664", + "contract": "IERC20" + }, + "DAIe": { + "address": "0xd586E7F844cEa2F87f50152665BCbc2C279D8d70", + "contract": "IERC20" + }, + "USDC": { + "address": "0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E", + "contract": "IERC20" + }, + "USDT": { + "address": "0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7", + "contract": "IERC20" + }, + "FRAX": { + "address": "0xD24C2Ad096400B6FBcd2ad8B24E7acBc21A1da64", + "contract": "IERC20" + }, + "MIM": { + "address": "0x130966628846BFd36ff31a822705796e8cb8C18D", + "contract": "IERC20" + }, + "SAVAX": { + "address": "0x2b2C81e08f1Af8835a78Bb2A90AE924ACE0eA4bE", + "contract": "IERC20" + }, + "WAVAX": { + "address": "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7", + "contract": "IERC20" + }, + "YUSD": { + "address": "0x111111111111ed1d73f860f57b2798b683f2d325", + "contract": "IERC20" + }, + "JOE": { + "address": "0x6e84a6216eA6dACC71eE8E6b0a5B7322EEbC0fDd", + "contract": "IERC20" + }, + "ZJOE": { + "address": "0x769bfeb9fAacD6Eb2746979a8dD0b7e9920aC2A4", + "contract": "IERC20" + }, + "JOE_ZJOE": { + "address": "0xcf80e302282c1e449fd745fad1e43faffe480536", + "contract": "IJoePair" + }, + "JOE_WAVAX": { + "address": "0x454e67025631c065d3cfad6d71e6892f74487a15", + "contract": "IJoePair" + }, + "BNB_WAVAX": { + "address": "0xeb8eB6300c53C3AddBb7382Ff6c6FbC4165B0742", + "contract": "IJoePair" + }, + "JOE_USDC": { + "address": "0x3bc40d4307cD946157447CD55d70ee7495bA6140", + "contract": "IJoePair" + }, + "LINKe_AVAX": { + "address": "0x6F3a0C89f611Ef5dC9d96650324ac633D02265D3", + "contract": "IJoePair" + }, + "MIM_AVAX": { + "address": "0x781655d802670bbA3c89aeBaaEa59D3182fD755D", + "contract": "IJoePair" + }, + "USDC_AVAX": { + "address": "0xf4003F4efBE8691B60249E6afbD307aBE7758adb", + "contract": "IJoePair" + }, + "USDCe_AVAX": { + "address": "0xA389f9430876455C36478DeEa9769B7Ca4E3DDB1", + "contract": "IJoePair" + }, + "USDC_USDCe": { + "address": "0x2A8A315e82F85D1f0658C5D66A452Bbdd9356783", + "contract": "IJoePair" + }, + "USDTe_AVAX": { + "address": "0xeD8CBD9F0cE3C6986b22002F03c6475CEb7a6256", + "contract": "IJoePair" + }, + "USDT_AVAX": { + "address": "0xbb4646a764358ee93c2a9c4a147d5aDEd527ab73", + "contract": "IJoePair" + }, + "USDT_USDTe": { + "address": "0x74b651eff97871ea99fcc14423e611d85eb0ea93", + "contract": "IJoePair" + }, + "WETHe_AVAX": { + "address": "0xFE15c2695F1F920da45C30AAE47d11dE51007AF9", + "contract": "IJoePair" + }, + "WBTCe_AVAX": { + "address": "0xd5a37dc5c9a396a03dd1136fc76a1a02b1c88ffa", + "contract": "IJoePair" + }, + "BTCb_AVAX": { + "address": "0x2fd81391e30805cc7f2ec827013ce86dc591b806", + "contract": "IJoePair" + }, + "MONEY": { + "address": "0x0f577433bf59560ef2a79c124e9ff99fca258948", + "contract": "IERC20" + }, + "YETI": { + "address": "0x77777777777d4554c39223C354A05825b2E8Faa3", + "contract": "IERC20" + }, + "MORE": { + "address": "0xd9D90f882CDdD6063959A9d837B05Cb748718A05", + "contract": "IERC20" + }, + "axlUSDC": { + "address": "0xfaB550568C688d5D8A52C7d794cb93Edc26eC0eC", + "contract": "IERC20" + }, + "AVAX_VTX": { + "address": "0x9EF0C12b787F90F59cBBE0b611B82D30CAB92929", + "contract": "IERC20" + } + }, + "JOE": { + "rush": { + "address": "0xD8C17F800bC78A74344DD5CB13f200054Ec7Cab7", + "contract": "JoeRush", + "ignore_connect": true + }, + "proxy_admin": { + "address": "0xE175df2a34e56AEABd6515099e9781c40C291270", + "contract": "TimelockedProxyAdmin" + }, + "main_staking": { + "address": "0x0E25c07748f727D6CCcD7D2711fD7bD13d13422d", + "contract": "MainStakingJoe", + "should_be_upgraded": true + }, + "smart_convertor": { + "address": "0x6b3DcE7C2189Fc3d3586aE884C09B817C0BC5275", + "contract": "IxTokenConvertor" + }, + "pools": { + "JOE_WAVAX": { + "token": { + "address": "0x454e67025631c065d3cfad6d71e6892f74487a15", + "contract": "IJoePair" + }, + "joe_rewarder": { + "address": "0x0000000000000000000000000000000000000000", + "ignore_connect": true + }, + "rewarder": { + "address": "0xa1F11b791eDEF517Aa86e1d3159314f670D2B441", + "contract": "BaseRewardPool" + }, + "receipt": { + "address": "0x4e179E5B027e9FABaf5159f02d8e11063519f65e", + "contract": "IERC20" + }, + "helper": { + "address": "0x77cCb5E2002c1Fc83CbBB4b777d7842e8fdD679e", + "contract": "IPoolHelperJoe" + }, + "compounder": { + "address": "0xCeDC0614c8C6c23C371e2279BcdeEa711EF28872", + "contract": "ICompounderJoe" + }, + "pid": 6 + }, + "BNB_WAVAX": { + "token": { + "address": "0xeb8eB6300c53C3AddBb7382Ff6c6FbC4165B0742", + "contract": "IJoePair" + }, + "joe_rewarder": { + "address": "0x0000000000000000000000000000000000000000", + "ignore_connect": true + }, + "rewarder": { + "address": "0x2101Ea09dA37acB4fEcba35A239E3D9B841E86fb", + "contract": "BaseRewardPool" + }, + "receipt": { + "address": "0xAC55A9Ad2256482771D545805732C818Dc38808c", + "contract": "IERC20" + }, + "helper": { + "address": "0x3fAFa93a8C54be14CDB1b2bd8D31cdBB18Fd2Cc4", + "contract": "IPoolHelperJoe" + }, + "compounder": { + "address": "0x0000000000000000000000000000000000000000", + "contract": "ICompounderJoe", + "ignore_connect": true + }, + "pid": 11, + "is_deprecated": true + }, + "JOE_USDC": { + "token": { + "address": "0x3bc40d4307cD946157447CD55d70ee7495bA6140", + "contract": "IJoePair" + }, + "joe_rewarder": { + "address": "0x0000000000000000000000000000000000000000", + "ignore_connect": true + }, + "rewarder": { + "address": "0x32C2235176cB6688568bA36B284bC882B0b71E11", + "contract": "BaseRewardPool" + }, + "receipt": { + "address": "0xaac6b032048CC892e22bFCb85a60F431Eee83c03", + "contract": "IERC20" + }, + "helper": { + "address": "0xaE96157fCE4115fec87e396875d97Af0BB5C043e", + "contract": "IPoolHelperJoe" + }, + "compounder": { + "address": "0x36869fDd71BBd5Ca323253a3ecbe66E84931573a", + "contract": "ICompounderJoe" + }, + "pid": 7 + }, + "LINKe_AVAX": { + "token": { + "address": "0x6F3a0C89f611Ef5dC9d96650324ac633D02265D3", + "contract": "IJoePair" + }, + "joe_rewarder": { + "address": "0x0000000000000000000000000000000000000000", + "ignore_connect": true + }, + "rewarder": { + "address": "0xCCD38cEFc15F70DCb068Ad7011CeaA201A27749B", + "contract": "BaseRewardPool" + }, + "receipt": { + "address": "0x155C615007E5e39BFb51105E8dbe0d86eD2ECb7D", + "contract": "IERC20" + }, + "helper": { + "address": "0xE9c5400d49Ba2d51e181f6cF631B67b248361Ce1", + "contract": "IPoolHelperJoe" + }, + "compounder": { + "address": "0x0000000000000000000000000000000000000000", + "contract": "ICompounderJoe", + "ignore_connect": true + }, + "pid": 10, + "is_deprecated": true + }, + "MIM_AVAX": { + "token": { + "address": "0x781655d802670bbA3c89aeBaaEa59D3182fD755D", + "contract": "IJoePair" + }, + "joe_rewarder": { + "address": "0x0000000000000000000000000000000000000000", + "ignore_connect": true + }, + "rewarder": { + "address": "0xf1d98e716f7fe0D11B19bc7c1567ec65c4cF505B", + "contract": "BaseRewardPool" + }, + "receipt": { + "address": "0x12C6aE3b4675ADEe0971C194ED9844B141980653", + "contract": "IERC20" + }, + "helper": { + "address": "0x3343019824364cbB6E2f893b1A06E3AcA7D2f318", + "contract": "IPoolHelperJoe" + }, + "compounder": { + "address": "0x0000000000000000000000000000000000000000", + "contract": "ICompounderJoe", + "ignore_connect": true + }, + "pid": 4, + "is_deprecated": true + }, + "USDC_AVAX": { + "token": { + "address": "0xf4003F4efBE8691B60249E6afbD307aBE7758adb", + "contract": "IJoePair" + }, + "joe_rewarder": { + "address": "0x0000000000000000000000000000000000000000", + "ignore_connect": true + }, + "rewarder": { + "address": "0xb81941bd8E538167885a9C3e18fa2B799Df2e625", + "contract": "BaseRewardPool" + }, + "receipt": { + "address": "0x08a7f16ad042365965D61F2518eAd2dEe281a1F6", + "contract": "IERC20" + }, + "helper": { + "address": "0x7854B77c252dA067AcB59C4A25DCd407764Bd8eE", + "contract": "IPoolHelperJoe" + }, + "compounder": { + "address": "0xdbDA79C99fC544b837eDdA65961d33F10E0e08f5", + "contract": "ICompounderJoe" + }, + "pid": 0 + }, + "USDCe_AVAX": { + "token": { + "address": "0xA389f9430876455C36478DeEa9769B7Ca4E3DDB1", + "contract": "IJoePair" + }, + "rewarder": { + "address": "0x8675dd283448519ca068d4be4DE046539277aDE0", + "contract": "BaseRewardPool" + }, + "joe_rewarder": { + "address": "0x0000000000000000000000000000000000000000", + "ignore_connect": true + }, + "receipt": { + "address": "0x530Eb6170D2F96310414A96a647F970BcD2CD85C", + "contract": "IERC20" + }, + "helper": { + "address": "0xea583064B2f938F537dC9E72F0617257d73D451e", + "contract": "IPoolHelperJoe" + }, + "compounder": { + "address": "0x0000000000000000000000000000000000000000", + "contract": "ICompounderJoe", + "ignore_connect": true + }, + "pid": 3, + "is_deprecated": true + }, + "USDC_USDCe": { + "token": { + "address": "0x2A8A315e82F85D1f0658C5D66A452Bbdd9356783", + "contract": "IJoePair" + }, + "joe_rewarder": { + "address": "0x0000000000000000000000000000000000000000", + "ignore_connect": true + }, + "rewarder": { + "address": "0x2c3f4A7f3b95F4415Cd16dce4568D81Ba8DAff2a", + "contract": "BaseRewardPool" + }, + "receipt": { + "address": "0xd5978FCB43F87afE4281254CAA29bCD218cba1cF", + "contract": "IERC20" + }, + "helper": { + "address": "0x3A7ECC70867c8E1fBf19aF72BAA39fEA555221D9", + "contract": "IPoolHelperJoe" + }, + "compounder": { + "address": "0xD4AcEc488687cC33D0df541D1746127C7d7A8f57", + "contract": "ICompounderJoe" + }, + "pid": 8 + }, + "USDTe_AVAX": { + "token": { + "address": "0xeD8CBD9F0cE3C6986b22002F03c6475CEb7a6256", + "contract": "IJoePair" + }, + "joe_rewarder": { + "address": "0x0000000000000000000000000000000000000000", + "ignore_connect": true + }, + "rewarder": { + "address": "0x21f411770E3c6F741f779d53D145d940408c299c", + "contract": "BaseRewardPool" + }, + "receipt": { + "address": "0xac3046c161fc65F453123C55543DA8d6B18e687C", + "contract": "IERC20" + }, + "helper": { + "address": "0xea767c7437D8d4bb315d87c2155c8C7f1D7c7e0f", + "contract": "IPoolHelperJoe" + }, + "compounder": { + "address": "0x0000000000000000000000000000000000000000", + "contract": "ICompounderJoe", + "ignore_connect": true + }, + "pid": 2, + "is_deprecated": true + }, + "USDT_AVAX": { + "token": { + "address": "0xbb4646a764358ee93c2a9c4a147d5aDEd527ab73", + "contract": "IJoePair" + }, + "joe_rewarder": { + "address": "0x0000000000000000000000000000000000000000", + "ignore_connect": true + }, + "rewarder": { + "address": "0xcFCE02bA8373Fd986088c5003B2f67FEc00f8D82", + "contract": "BaseRewardPool" + }, + "receipt": { + "address": "0x490cFC0F6849de81eB3Adb62332C682bF7A4e118", + "contract": "IERC20" + }, + "helper": { + "address": "0xfC1300fe68BC0b419b1eacE7f971B63F3186D489", + "contract": "IPoolHelperJoe" + }, + "compounder": { + "address": "0x25274DE030F87b420636E061Ad2d460BD7c9eaa4", + "contract": "ICompounderJoe" + }, + "pid": 12 + }, + "USDT_USDTe": { + "token": { + "address": "0x74b651eff97871ea99fcc14423e611d85eb0ea93", + "contract": "IJoePair" + }, + "joe_rewarder": { + "address": "0x0000000000000000000000000000000000000000", + "ignore_connect": true + }, + "rewarder": { + "address": "0x762eCc77D40fAe6b77EEea820663689f1A3c3BE0", + "contract": "BaseRewardPool" + }, + "receipt": { + "address": "0xFB6aE9fD38725E44bD8a76E617cBf801957d9006", + "contract": "IERC20" + }, + "helper": { + "address": "0x4eCaC544293a1b53c78918AF7502ec44aCE0A46b", + "contract": "IPoolHelperJoe" + }, + "compounder": { + "address": "0xA779CF720F570111fBe66a583366C0F0AdE26D33", + "contract": "ICompounderJoe" + }, + "pid": 9 + }, + "WBTCe_AVAX": { + "token": { + "address": "0xd5a37dc5c9a396a03dd1136fc76a1a02b1c88ffa", + "contract": "IJoePair" + }, + "joe_rewarder": { + "address": "0x0000000000000000000000000000000000000000", + "ignore_connect": true + }, + "rewarder": { + "address": "0x5619433DF588fB1D2B70b2ec5B56eA5F52bBac51", + "contract": "BaseRewardPool" + }, + "receipt": { + "address": "0x47bb23D30081a2d55E49B20276897AC7A5F1064d", + "contract": "IERC20" + }, + "helper": { + "address": "0x4117202eF61d362863331a780cA8848f3eA0E7e7", + "contract": "IPoolHelperJoe" + }, + "compounder": { + "address": "0x0000000000000000000000000000000000000000", + "contract": "ICompounderJoe", + "ignore_connect": true + }, + "pid": 5, + "is_deprecated": true + }, + "WETHe_AVAX": { + "token": { + "address": "0xFE15c2695F1F920da45C30AAE47d11dE51007AF9", + "contract": "IJoePair" + }, + "joe_rewarder": { + "address": "0x0000000000000000000000000000000000000000", + "ignore_connect": true + }, + "rewarder": { + "address": "0x086D2B19d5701Dcc42335Fc98d7350B8b07Cee86", + "contract": "BaseRewardPool" + }, + "receipt": { + "address": "0x9e54E1eCbCd85b5E6145414E1b88086cFC66006B", + "contract": "IERC20" + }, + "helper": { + "address": "0xE61cD11F0D8a480C1e53a1624c57D47fD0143948", + "contract": "IPoolHelperJoe" + }, + "compounder": { + "address": "0xe473110e60eFB177026e118177f1efBAb269cf33", + "contract": "ICompounderJoe" + }, + "pid": 1 + }, + "BTCb_AVAX": { + "token": { + "address": "0x2fd81391e30805cc7f2ec827013ce86dc591b806", + "contract": "IJoePair" + }, + "joe_rewarder": { + "address": "0xc548b26226b3ad77906bdDffc82023EC8Db69e49" + }, + "rewarder": { + "address": "0xcc8442f2741353089f584197b7b1997111219Cc9", + "contract": "BaseRewardPool" + }, + "receipt": { + "address": "0xD5817AC3027B1958961903238b374EcD8a5537A8", + "contract": "IERC20" + }, + "helper": { + "address": "0x1e893e5711F50a9D7C132f6E4752c7335bDFDBF8", + "contract": "IPoolHelperJoe" + }, + "compounder": { + "address": "0x942A265b4966d714f7f5b2c82AfB04250a5DB263", + "contract": "ICompounderJoe" + }, + "pid": 13 + }, + "BUSD_AVAX": { + "token": { + "address": "0xf57971383560715CcCF94E0C639125Ae0e955e60", + "contract": "IJoePair" + }, + "joe_rewarder": { + "address": "0x0000000000000000000000000000000000000000", + "ignore_connect": true + }, + "rewarder": { + "address": "0x7585a7314fec3d5988be0a57B1E3d9E458745c4A", + "contract": "BaseRewardPool" + }, + "receipt": { + "address": "0xbf84b23Aa332b5cdcA184595aCCC75b79B170f1D", + "contract": "IERC20" + }, + "helper": { + "address": "0x6570C94a92D41b5B518Faa4Ed6b0a5C48Fac80C8", + "contract": "IPoolHelperJoe" + }, + "compounder": { + "address": "0xACFf1a7556113b11Ea0cE92b2E8317bAe53a3f18", + "contract": "ICompounderJoe" + }, + "pid": 14 + } + } + }, + "MISC": { + "ROUTER_JOE": { + "address": "0x60aE616a2155Ee3d9A68541Ba4544862310933d4", + "contract": "IJoeRouter02" + }, + "FACTORY_JOE": { + "address": "0x9Ad6C38BE94206cA50bb0d90783181662f0Cfa10", + "contract": "IJoeFactory" + } + }, + "PROTOCOL": { + "masterchief": { + "address": "0x423D0FE33031aA4456a17b150804aA57fc157d97", + "contract": "MasterChefVTX", + "should_be_upgraded": true + }, + "manual_compound": { + "address": "0x7034Fe86d8dAE3A42F2E3e808fF3ec271a749a77", + "contract": "ManualCompound" + }, + "old_manual_compound": { + "address": "0x43c5FF0B7D62498795Ff4Ce1727fE9841f76255A", + "contract": "ManualCompoundOld", + "ignore_connect": true + }, + "idgaf": { + "address": "0xB5C3547e1120FCA52329F14989dafa78cae4Ce7A", + "contract": "DelegateVotePool", + "should_be_upgraded": true + }, + "swap_helper": { + "address": "0xC3193F9eE0921ef463D47a9d967e69Cf47510d8f", + "contract": "SwapHelper", + "should_be_upgraded": true + }, + "fee_seller": { + "address": "0x6B43c8320f5b27EA1289c874F7fA240B58576D40", + "contract": "FeeSeller" + }, + "LVTX_compounder": { + "address": "0x5EDb70609f7BE94f8b0cd7BeD1E01908901d54C6", + "contract": "LVTXAutoCompound", + "should_be_upgraded": true + }, + "multi_caller": { + "address": "0x620D852E99151FaC09414ff161a618bD76a15140", + "contract": "IMultiCaller" + }, + "pools": { + "VTX": { + "token": { + "address": "0x5817D4F0b62A59b17f75207DA1848C2cE75e7AF4", + "contract": "IERC20" + }, + "rewarder": { + "address": "0xfB8695245BD05993c0bEce1b7056B75D88777c11", + "contract": "BaseRewardPool" + }, + "helper": { + "address": "0x49964537f89A6fe56dD85480704C9Bf9c19b9Cc0", + "contract": "SimplePoolHelper" + } + }, + "LOCKER": { + "token": { + "address": "0x5817D4F0b62A59b17f75207DA1848C2cE75e7AF4", + "contract": "IERC20" + }, + "rewarder": { + "address": "0x58B31B8e3fB3365df3e86527Ee7B009D37E5C851", + "contract": "BaseRewardPoolLocker" + }, + "helper": { + "address": "0x17D152DF9Eb78D3A441D2aeeE9BDE3350072Bbd1", + "contract": "SimpleLockerHelper" + } + }, + "OLD_LOCKER": { + "token": { + "address": "0x5817D4F0b62A59b17f75207DA1848C2cE75e7AF4", + "contract": "IERC20" + }, + "rewarder": { + "address": "0x601B89a43EBBE26FA48d91F43eD63D08831d17CD", + "contract": "BaseRewardPool" + } + }, + "XPTP": { + "token": { + "address": "0x060556209E507d30f2167a101bFC6D256Ed2f3e1", + "contract": "IERC20" + }, + "rewarder": { + "address": "0xFF2ea93A0131A037DDe900b3F361B1F24a870Ff4", + "contract": "BaseRewardPool" + }, + "receipt": { + "address": "0x060556209E507d30f2167a101bFC6D256Ed2f3e1", + "contract": "IERC20" + }, + "helper": { + "address": "0x44A6B6D38068EeBb5d6FB03D6C45f08b9e565b8D", + "contract": "SimplePoolHelper" + }, + "convert_and_stake_helper": { + "address": "0x59ABD174467E69C283b9bbd452A9caa208DAD1f9", + "contract": "ConvertAndStakeHelper" + }, + "compounder": { + "address": "0x6124B5F5Fc897a9a64a750ED24cBdC421eB79CF5", + "contract": "xCoreCompounder", + "should_be_upgraded": true + }, + "compounder_rewarder": { + "address": "0x96137066e4642FA62dc4b6F637870BF68E924cE7", + "contract": "BaseRewardPool" + } + }, + "ZJOE": { + "token": { + "address": "0x769bfeb9fAacD6Eb2746979a8dD0b7e9920aC2A4", + "contract": "IERC20" + }, + "helper": { + "address": "0xb8C481ef38E6e3BA41Da11e497d7f241ee748D60", + "contract": "SimplePoolHelper" + }, + "rewarder": { + "address": "0x73f6b0Fb5721356d79CCf9414De8cAAC074e0110", + "contract": "BaseRewardPool" + }, + "convert_and_stake_helper": { + "address": "0xE65dA011F2B6Df19BbE34447CA679Ac934173E97", + "contract": "ConvertAndStakeHelper" + }, + "compounder": { + "address": "0x5531d779EC044866890d54d9727f048cE22107bb", + "contract": "xCoreCompounder", + "should_be_upgraded": true + }, + "compounder_rewarder": { + "address": "0xe4955afa872a24307f1E6F325fefC2Bf736cf43d", + "contract": "BaseRewardPool" + } + }, + "PTP_XPTP": { + "token": { + "address": "0xc4b7121b4fc065decd26c33fb32e42c543e8850d", + "contract": "IJoePair" + }, + "helper": { + "address": "0xDeb40C4cCE16309Ce9dee41418eCCFA0f2fdAB89", + "contract": "SimplePoolHelper" + }, + "compounder": { + "address": "0xC65fE0E394DbA2901112ccf1D528ED4296EF0B46", + "contract": "xCoreLpCompounder", + "should_be_upgraded": true + }, + "compounder_rewarder": { + "address": "0x3C87D3F5BBbe90ca0C24738139f73B9F803640d3", + "contract": "BaseRewardPool" + } + }, + "JOE_ZJOE": { + "token": { + "address": "0xcf80e302282c1e449fd745fad1e43faffe480536", + "contract": "IJoePair" + }, + "helper": { + "address": "0x3833B5Ce11061376c7b908251e12cE536f8389Aa", + "contract": "SimplePoolHelper" + }, + "compounder": { + "address": "0xd0925c4817352ddEfef69A06dc9a60f4Ad86fADc", + "contract": "xCoreLpCompounder", + "should_be_upgraded": true + }, + "compounder_rewarder": { + "address": "0x29533103f344C334C0617f6b7bCf294BD16AaDcd", + "contract": "BaseRewardPool" + } + }, + "AVAX_VTX": { + "token": { + "address": "0x9EF0C12b787F90F59cBBE0b611B82D30CAB92929", + "contract": "IJoePair" + }, + "helper": { + "address": "0xFf891136B41EB6E5c47499609656894b19533D5F", + "contract": "SimplePoolHelper" + }, + "compounder": { + "address": "0xa8e00e1f1Ca0df4600f6117072A03E3BF8Fc8886", + "contract": "xCoreLpCompounder" + }, + "compounder_rewarder": { + "address": "0x6E52692ECAF1A0c73fBAaD9eDc20b165D24D78F7", + "contract": "BaseRewardPool" + } + } + }, + "proxy_admin": { + "address": "0x51f8283A7Ff9e5CFa3045FFd5EB5F4D1071Bb1E3", + "contract": "ProxyAdmin" + } + }, + "LIBS": { + "ERC20FactoryLib": { + "address": "0x2ddC95E41d01DDD3268cd91A35A7bd7d0849d7Fc", + "contract": "ERC20FactoryLib" + }, + "PoolHelperJoeFactoryLib": { + "address": "0x69CdE7a07e3FFb839Ca69F635174c725F006E98B", + "contract": "PoolHelperJoeFactoryLib" + }, + "PoolHelperFactoryLib": { + "address": "0xbb43bfFacA26E105Bf6E5f1e933F67955af354C0", + "contract": "PoolHelperFactoryLib" + } + }, + "testing_contract": { + "address": "", + "contract": "MasterChefVTX" + } +} diff --git a/projects/vee-finance/index.js b/projects/vee-finance/index.js index 9f162992291..e8b32ad3ef8 100644 --- a/projects/vee-finance/index.js +++ b/projects/vee-finance/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const {getCompoundV2Tvl} = require('../helper/compound') const sdk = require('@defillama/sdk') @@ -7,16 +8,16 @@ module.exports={ tvl: sdk.util.sumChainTvls([ //V1&V2 on Avalanche getCompoundV2Tvl("0xA67DFeD73025b0d61F2515c531dd8D25D4Cfd0Db", "avax", addr=>`avax:${addr}`), - getCompoundV2Tvl("0x43AAd7d8Bc661dfA70120865239529ED92Faa054", "avax", addr=>`avax:${addr}`, "0x6481490DBb6Bd0e8b7CB7E1317470f6d08aDa5A2", "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7"), + getCompoundV2Tvl("0x43AAd7d8Bc661dfA70120865239529ED92Faa054", "avax", addr=>`avax:${addr}`, "0x6481490DBb6Bd0e8b7CB7E1317470f6d08aDa5A2", ADDRESSES.avax.WAVAX), getCompoundV2Tvl("0xAF7f6F7a1295dEDF52a01F5c3f04Ad1b502CdA6a", "avax", addr=>`avax:${addr}`), - getCompoundV2Tvl("0xeEf69Cab52480D2BD2D4A3f3E8F5CcfF2923f6eF", "avax", addr=>`avax:${addr}`, "0x125605c515e3f75CAd62d3613c97A76F13d73A64", "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7"), + getCompoundV2Tvl("0xeEf69Cab52480D2BD2D4A3f3E8F5CcfF2923f6eF", "avax", addr=>`avax:${addr}`, "0x125605c515e3f75CAd62d3613c97A76F13d73A64", ADDRESSES.avax.WAVAX), ]) }, heco: { tvl: sdk.util.sumChainTvls([ //V1 on Heco getCompoundV2Tvl("0x484C6e804cD4Cc27fCFbCf06748d6b4BCA47db84", "heco", addr=>`heco:${addr}`), - getCompoundV2Tvl("0x2a144ACaef8fb9258e4f2c2018945a76fE7342E2", "heco", addr=>`heco:${addr}`, "0x0F75aBfef98dAaa7A8170ddA97c8100a65ABA3cC", "0x5545153CCFcA01fbd7Dd11C0b23ba694D9509A6F"), + getCompoundV2Tvl("0x2a144ACaef8fb9258e4f2c2018945a76fE7342E2", "heco", addr=>`heco:${addr}`, "0x0F75aBfef98dAaa7A8170ddA97c8100a65ABA3cC", ADDRESSES.heco.WHT), ]) } } diff --git a/projects/vega-protocol/index.js b/projects/vega-protocol/index.js new file mode 100644 index 00000000000..d3cf44ee983 --- /dev/null +++ b/projects/vega-protocol/index.js @@ -0,0 +1,64 @@ +const { getLogs } = require('../helper/cache/getLogs') +const { sumTokens2 } = require('../helper/unwrapLPs') + +const assetListedEvent = "event Asset_Listed(address indexed asset_source, bytes32 indexed vega_asset_id, uint256 nonce)" +const BigNumber = require("bignumber.js"); + +const config = { + ethereum: { + fromBlock: 17343884, + vega: '0xcb84d72e61e383767c4dfeb2d8ff7f4fb89abc6e', + stakingContract: '0x195064D33f09e0c42cF98E665D9506e0dC17de68', + assetPool: '0xA226E2A13e07e750EfBD2E5839C5c3Be80fE7D4d', + bridge: '0x23872549cE10B40e31D6577e0A920088B0E0666a', + vestingContract: '0x23d1bFE8fA50a167816fBD79D7932577c06011f4' + } +} + +const contractAbis = { + "totalStaked": "function total_staked() view returns (uint256)", + "balanceOf": "function balanceOf(address account) view returns (uint256)" +} + +module.exports = { +}; + +Object.keys(config).forEach(chain => { + const { bridge, fromBlock, vega, stakingContract, assetPool, vestingContract } = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const logs = await getLogs({ + api, + target: bridge, + topics: ['0x4180d77d05ff0d31650c548c23f2de07a3da3ad42e3dd6edd817b438a150452e'], + eventAbi: assetListedEvent, + onlyArgs: true, + fromBlock, + }) + const blacklistedTokens = [] + if (vega) blacklistedTokens.push(vega) + return sumTokens2({ api, blacklistedTokens, owner: assetPool, tokens: logs.map(i => i.asset_source) }) + }, + //staking: staking(stakingContract, vega) + staking: async (_, _b, cb, { chain, block, api } = {}) => { + + const vegaStakedInVesting = await api.call({ + abi: contractAbis.totalStaked, + target: vestingContract + }) + + const vegaStakedInStaking = await api.call({ + abi: contractAbis.balanceOf, + target: vega, + params: stakingContract + }) + + return { + '0xcb84d72e61e383767c4dfeb2d8ff7f4fb89abc6e': BigNumber(vegaStakedInVesting).plus(BigNumber(vegaStakedInStaking)).toFixed(0) + } + + } + } + +}) + diff --git a/projects/vela-exchange/index.js b/projects/vela-exchange/index.js new file mode 100644 index 00000000000..47facb09501 --- /dev/null +++ b/projects/vela-exchange/index.js @@ -0,0 +1,36 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { staking } = require("../helper/staking") +const { graphQuery } = require('../helper/http') + +const VELA = '0x088cd8f5eF3652623c22D48b1605DCfE860Cd704' + +const endpoint = "https://api.thegraph.com/subgraphs/name/velaexchange/vela-exchange-official" +async function staking_() { + const { api } = arguments[3] + + const query = ` + query { + poolInfos(where: { + id: "all" + }) { + pid1 + pid2 + pid3 + } + } + `; + const graphRes = (await graphQuery(endpoint, query)).poolInfos.find(x => true); + api.add(VELA, graphRes?.pid2) + api.add(VELA, graphRes?.pid3) +} + +module.exports = { + methodology: "Counts USDC deposited to trade and to mint VLP. Staking counts VELA and esVELA deposited to earn esVELA", + arbitrum: { + tvl: staking('0xC4ABADE3a15064F9E3596943c699032748b13352', ADDRESSES.arbitrum.USDC), + staking: staking_ + }, + hallmarks: [ + [Math.floor(new Date('2023-04-13') / 1e3), 'Refunded tokens to VLP holders & traders'], + ], +} diff --git a/projects/velaro/index.js b/projects/velaro/index.js index 4224944c978..9c9bc2b6a7d 100644 --- a/projects/velaro/index.js +++ b/projects/velaro/index.js @@ -1,23 +1,23 @@ -const { sumTokens2 } = require('../helper/unwrapLPs') -const chain = 'velas' +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require('../helper/unwrapLPs') module.exports = { + hallmarks: [ + [1668556800, "USDV hack"] + ], velas: { - tvl: async (_, _b, { [chain]: block }) => { - return sumTokens2({ - tokensAndOwners: [ - ['0xe41c4324dCbD2926481101f8580D13930AFf8A75', '0xbd183a60274289A7c20250a890500D2a37dEf319'], // VLX - ['0xaBf26902Fd7B624e0db40D31171eA9ddDf078351', '0x2Fee5293050FFfC3bd583d59f077e2b4900F57c8'], // WAG - ['0x639A647fbe20b6c8ac19E48E2de44ea792c62c5C', '0x899F26dc6Bc085fb9cB82AAdF25Db8820F272ED4'], // WBTC - ['0x7b714BC5dD176EaA198fe6C07E415a87A40dc858', '0x7171d1E1097d726E5f4BBc8236A8E108E21024e3'], // WAG_VLXVDGT - ['0x72eB7CA07399Ec402c5b7aa6A65752B6A1Dc0C27', '0x1e217990818518Dc37B0fFA2ffE3AA110b02F18c'], // ASTRO - ['0x2B8e9cD44C9e09D936149549a8d207c918ecB5C4', '0xc0D16c7Cd5Fc18526Dc78Ea530e56129EB979C96'], // BNB - ['0xc9b3aA6E91d70f4ca0988D643Ca2bB93851F3de4', '0x92C2cA50f74A8Fe36b4DCffB2cc6A274fA61CB34'], // FTM - ['0x6ab0B8C1a35F9F4Ce107cCBd05049CB1Dbd99Ec5', '0xd10f8CD5d56aaa58f59B25C928f372F66899e9B3'], // MATIC - ['0xc111c29A988AE0C0087D97b33C6E6766808A3BD3', '0x4368d9F91C40EA8Ac9F11A4f9289889f56D32Df8'], // BUSD - ], - resolveLP: true, - chain, block - }) - } - }, + tvl: sumTokensExport({ + tokensAndOwners: [ + [ADDRESSES.velas.WVLX, '0xbd183a60274289A7c20250a890500D2a37dEf319'], // VLX + ['0xaBf26902Fd7B624e0db40D31171eA9ddDf078351', '0x2Fee5293050FFfC3bd583d59f077e2b4900F57c8'], // WAG + [ADDRESSES.moonriver.ETH, '0x899F26dc6Bc085fb9cB82AAdF25Db8820F272ED4'], // WBTC + ['0x7b714BC5dD176EaA198fe6C07E415a87A40dc858', '0x7171d1E1097d726E5f4BBc8236A8E108E21024e3'], // WAG_VLXVDGT + ['0x72eB7CA07399Ec402c5b7aa6A65752B6A1Dc0C27', '0x1e217990818518Dc37B0fFA2ffE3AA110b02F18c'], // ASTRO + [ADDRESSES.velas._BNB, '0xc0D16c7Cd5Fc18526Dc78Ea530e56129EB979C96'], // BNB + [ADDRESSES.velas.FTM, '0x92C2cA50f74A8Fe36b4DCffB2cc6A274fA61CB34'], // FTM + [ADDRESSES.velas._MATIC, '0xd10f8CD5d56aaa58f59B25C928f372F66899e9B3'], // MATIC + [ADDRESSES.velas.BUSD, '0x4368d9F91C40EA8Ac9F11A4f9289889f56D32Df8'], // BUSD + ], + resolveLP: true, + }) + } } diff --git a/projects/velocimeter-v2/index.js b/projects/velocimeter-v2/index.js new file mode 100644 index 00000000000..180101696e5 --- /dev/null +++ b/projects/velocimeter-v2/index.js @@ -0,0 +1,26 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports = { + misrepresentedTokens: true, + canto: { + tvl: getUniTVL({ + factory: '0xF80909DF0A01ff18e4D37BF682E40519B21Def46', + useDefaultCoreAssets: true, + hasStablePools: true, + }) + }, + pulse: { + tvl: getUniTVL({ + factory: '0x6B4449C74a9aF269A5f72B88B2B7B8604685D9B9', + useDefaultCoreAssets: true, + hasStablePools: true, + }) + }, + base: { + tvl: getUniTVL({ + factory: '0xe21Aac7F113Bd5DC2389e4d8a8db854a87fD6951', + useDefaultCoreAssets: true, + hasStablePools: true, + }) + }, +} diff --git a/projects/velocore-v2/index.js b/projects/velocore-v2/index.js new file mode 100644 index 00000000000..70b58a07e58 --- /dev/null +++ b/projects/velocore-v2/index.js @@ -0,0 +1,21 @@ +const { sumTokens2 } = require('../helper/unwrapLPs'); + +module.exports = { + linea: { + tvl: async (_, _1, _2, { api }) => { + const a = await api.call({ + abi: "function canonicalPools(address user, uint256 begin, uint256 maxLength) returns (tuple(address gauge, tuple(address pool, string poolType, bytes32[] lpTokens, uint256[] mintedLPTokens, bytes32[] listedTokens, uint256[] reserves, bytes poolParams) poolData, bool killed, uint256 totalVotes, uint256 userVotes, uint256 userClaimable, uint256 emissionRate, uint256 userEmissionRate, uint256 stakedValueInHubToken, uint256 userStakedValueInHubToken, uint256 averageInterestRatePerSecond, uint256 userInterestRatePerSecond, bytes32[] stakeableTokens, uint256[] stakedAmounts, uint256[] userStakedAmounts, bytes32[] underlyingTokens, uint256[] stakedUnderlying, uint256[] userUnderlying, tuple(bytes32[] tokens, uint256[] rates, uint256[] userClaimable, uint256[] userRates)[] bribes)[] gaugeDataArray)", + target: "0x2AB2398303B79884B8eC18A145EBd496145dfeEC", + params: ["0x2AB2398303B79884B8eC18A145EBd496145dfeEC", 0, 1000] + }); + let tokens = a.map(g => g.poolData.listedTokens).flat().map(i => '0x' + i.slice(2 + 24)) + return sumTokens2({ + owner: "0x1d0188c4B276A09366D05d6Be06aF61a73bC7535", tokens, blacklistedTokens: [ + '0x2441488a43e9F35289564c2c9f8c783F3c6bb596', + '0x226398c89a2BA3C30689939EF9c4984c4a4d314A', + ], api, + }) + }, + }, + methodology: "counts tokens in the vault.", +}; \ No newline at end of file diff --git a/projects/velocore/index.js b/projects/velocore/index.js new file mode 100644 index 00000000000..68510d13c4b --- /dev/null +++ b/projects/velocore/index.js @@ -0,0 +1,15 @@ +const { getUniTVL } = require('../helper/unknownTokens'); +const { stakings } = require("../helper/staking"); +const { stakingPricedLP } = require('../helper/staking'); +const sdk = require('@defillama/sdk') +const factv1=getUniTVL({ factory: '0xF5719b1Ea3C9bF6491E22C49379E31060d0FbFc1', useDefaultCoreAssets: true, hasStablePools: true }); +const factv2=getUniTVL({ factory: '0xE140EaC2bB748c8F456719a457F26636617Bb0E9', useDefaultCoreAssets: true, hasStablePools: true }); + +module.exports = { + misrepresentedTokens: true, + era: { + tvl: sdk.util.sumChainTvls([factv1, factv2]), + staking: stakings(["0xbdE345771Eb0c6adEBc54F41A169ff6311fE096F"], ["0x85D84c774CF8e9fF85342684b0E795Df72A24908"], 'era','velocore',18) + }, + methodology: "Counts liquidity in pools", +}; \ No newline at end of file diff --git a/projects/velodrome-v2/index.js b/projects/velodrome-v2/index.js new file mode 100644 index 00000000000..06cff58a15c --- /dev/null +++ b/projects/velodrome-v2/index.js @@ -0,0 +1,14 @@ +const { uniTvlExport } = require('../helper/calculateUniTvl.js') + +module.exports = { + misrepresentedTokens: true, + optimism: { + tvl: uniTvlExport("0xF1046053aa5682b4F9a81b5481394DA16BE5FF5a", undefined, undefined, { + allPairsLength: 'uint256:allPoolsLength', + allPairs: 'function allPools(uint256) view returns (address)', + }, { fetchBalances: true, useDefaultCoreAssets: true, hasStablePools: true, }), + }, + hallmarks: [ + [1687465883, "v2 Migration on OP Mainnet"], // https://twitter.com/VelodromeFi/status/1671979216039202816 + ] +} diff --git a/projects/velodrome/index.js b/projects/velodrome/index.js index 93fe01c2e28..9665ffd8bfb 100644 --- a/projects/velodrome/index.js +++ b/projects/velodrome/index.js @@ -2,11 +2,8 @@ const {uniTvlExport} = require('../helper/calculateUniTvl.js') module.exports = { misrepresentedTokens: true, - doublecounted: false, - timetravel: true, - incentivized: true, optimism: { - tvl: uniTvlExport("0x25CbdDb98b35ab1FF77413456B31EC81A6B6B746", "optimism"), + tvl: uniTvlExport("0x25CbdDb98b35ab1FF77413456B31EC81A6B6B746", undefined, true, undefined, { useDefaultCoreAssets: true, hasStablePools: true, }), }, hallmarks:[ [1657760400, "First OP grant awarded"], diff --git a/projects/velvet-capital/index.js b/projects/velvet-capital/index.js new file mode 100644 index 00000000000..c1e89e22376 --- /dev/null +++ b/projects/velvet-capital/index.js @@ -0,0 +1,29 @@ +const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') +const { getConfig } = require('../helper/cache') + +async function tvl(_, _b, _cb, { api, }) { + const response = await getConfig('velvet-capital', "https://defivas.xyz/api/portfolio") + const indexes = response.data; + const ownerTokens = [] + const [vaults, tokens, libraries] = await Promise.all([ + api.multiCall({ abi: 'address:vault', calls: indexes }), + api.multiCall({ abi: 'address[]:getTokens', calls: indexes }), + api.multiCall({ abi: 'address:indexSwapLibrary', calls: indexes }), + ]) + + const tokenMetadatas = await api.multiCall({ abi: 'address:tokenMetadata', calls: libraries }) + + await Promise.all(tokens.map(async (tokens, i) => { + const vault = vaults[i] + const tokenMetadata = tokenMetadatas[i] + const tokenRes = await api.multiCall({ abi: 'function vTokens(address) public view returns(address)', target: tokenMetadata, calls: tokens }) + const vaultTokens = tokenRes.map((t, j) => (t !== nullAddress) ? t : tokens[j]) + ownerTokens.push([vaultTokens, vault]) + })) + return sumTokens2({ api, ownerTokens }) +} + +module.exports = { + methodology: 'calculates overall value deposited across different protocol portfolios', + bsc: { tvl } +} \ No newline at end of file diff --git a/projects/vendor-finance-v2/index.js b/projects/vendor-finance-v2/index.js new file mode 100644 index 00000000000..798c0dc417d --- /dev/null +++ b/projects/vendor-finance-v2/index.js @@ -0,0 +1,54 @@ +const { getLogs } = require("../helper/cache/getLogs"); + +const abi = { + lendBalance: "function lendBalance() view returns (uint256)", + colBalance: "function colBalance() view returns (uint256)" +} + +async function tvl(timestamp, block, chainBlocks, { api }) { + const { factory, fromBlock } = config[api.chain] + const logs = await getLogs({ + api, + target: factory, + topics: ['0xee5c84cc965f1ed0b60a1a4a5a02cf02830b6262b89a9063fda05b63ce8b2f8b'], + fromBlock, + onlyArgs: true, + eventAbi: 'event DeployPool(address poolAddress,address deployer,address implementation,(address feesManager,bytes32 strategy,address oracle,address treasury,address posTracker),(uint8 poolType,address owner,uint48 expiry,address colToken,uint48 protocolFee,address lendToken,uint48 ltv,uint48 pauseTime,uint256 lendRatio,address[] allowlist,bytes32 feeRatesAndType))' + }) + + // lend assets may be stored in AAVE if the lender chooses so we can't + // rely on balanceOf calls to get lend balances. Each pool has a + // lendBalance and colBalance method that returns the token balances + // that are in the pool and are currently in AAVE that belong to the pool + + // get lend balances returned from the lendBalance method + const lendOutput = await api.multiCall({ abi: abi.lendBalance, calls: logs.map(i => i.poolAddress), }); + + // get col balances returned from the colBalance method + const colOutput = await api.multiCall({ abi: abi.colBalance, calls: logs.map(i => i.poolAddress), }); + + console.log(lendOutput, colOutput) + lendOutput.forEach((res, i) => { + // extract collateral and lend tokens + const lendToken = logs[i][4].lendToken; + const colToken = logs[i][4].colToken; + // add collateral and lend token balances returned from contract calls + api.add(lendToken, res) + api.add(colToken, colOutput[i]) + }); +} + +const config = { + arbitrum: { factory: '0x0b2B8Fbf3dfd6237921A89355cfc08f107bFbf98', fromBlock: 88774917 } + // ethereum: { factory: '0x928cf648069082D9AEf25ddB2bF10D25bf1C1D73', fromBlock: 16545630, }, +} + +module.exports = { + doublecounted: true, + methodology: 'The sum of the balance of all listed collateral and lend tokens in all deployed pools.', + start: 88774917, +}; + +Object.keys(config).forEach(chain => { + module.exports[chain] = { tvl } +}); \ No newline at end of file diff --git a/projects/vendor-finance/cmUmami.abi.json b/projects/vendor-finance/cmUmami.abi.json deleted file mode 100644 index 99c33b94d76..00000000000 --- a/projects/vendor-finance/cmUmami.abi.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "inputs": [{ "internalType": "uint256", "name": "amount", "type": "uint256" }], - "name": "getDepositTokensForShares", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" -} \ No newline at end of file diff --git a/projects/vendor-finance/index.js b/projects/vendor-finance/index.js index e8c2090753c..50665e7dcf5 100644 --- a/projects/vendor-finance/index.js +++ b/projects/vendor-finance/index.js @@ -1,91 +1,39 @@ -const sdk = require('@defillama/sdk'); -const ethers = require('ethers') -const axios = require("axios"); -const { transformArbitrumAddress } = require("../helper/portedTokens"); -const cmUmamiABI = require("./cmUmami.abi.json"); -const { default: BigNumber } = require('bignumber.js'); +const { getLogs } = require("../helper/cache/getLogs"); const { sumTokens2 } = require('../helper/unwrapLPs') -async function getPools() { - - // make graph request to get pools - const url = "https://api.thegraph.com/subgraphs/name/0xtaiga/vendor-finance"; - const request = await axios.post(url, - { - query: ` - { - pools (first: 300) { - id, - _colToken, - _lendToken - } - } - ` - } - ); - // extract pools - return(request.data.data.pools); - -} - -async function tvl(timestamp, block, chainBlocks) { - - const transform = await transformArbitrumAddress(); - const chain = "arbitrum"; - - // collateral and lend tokens - const tokens = { - USDC: "0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8", - USDT: "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9", - DAI: "0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1", - MIM: "0xFEa7a6a0B346362BF88A9e4A88416B77a57D6c2A", - FRAX: "0x17FC002b466eEc40DaE837Fc4bE5c67993ddBd6F", - WETH: "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1", - WBTC: "0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f", - DPX: "0x6c2c06790b3e3e3c38e12ee22f8183b37a13ee55", - CRV: "0x11cDb42B0EB46D95f990BeDD4695A6e3fA034978", - UMAMI: "0x1622bF67e6e5747b81866fE0b85178a93C7F86e3", - SPELL: "0x3E6648C5a70A150A88bCE65F4aD4d506Fe15d2AF", - CMUMAMI: "0x1922C36F3bc762Ca300b4a46bB2102F84B1684aB" - } +async function tvl(timestamp, block, chainBlocks, { api }) { + const { factory, fromBlock } = config[api.chain] + const logs = await getLogs({ + api, + target: factory, + topics: ['0x17a6639825270a6a0f6172df6127d5ca0ef5649412ba2ae4225acd2b584425ca'], + fromBlock, + eventAbi: 'event DeployPool (address _poolAddress, address _deployer, uint256 _mintRatio, address _colToken, address _lendToken, uint48 _protocolFee, uint48 _protocolColFee, uint48 _expiry, address[] _borrowers)' + }) block = chainBlocks.arbitrum; const balances = {}; - const pools = await getPools(); const tokensAndOwners = [] - for (const pool of pools) { - - // get collateral and lend token - const colToken = ethers.utils.getAddress(pool._colToken); - const lendToken = ethers.utils.getAddress(pool._lendToken); - const poolAddress = pool.id; - tokensAndOwners.push([lendToken, poolAddress]) - tokensAndOwners.push([colToken, poolAddress]) + for (const { args: { _poolAddress, _colToken, _lendToken, _expiry }} of logs) { + if (_expiry < timestamp) continue; + tokensAndOwners.push([_colToken, _poolAddress]) + tokensAndOwners.push([_lendToken, _poolAddress]) } - await sumTokens2({ tokensAndOwners, chain, block, balances, }); - const cUMAMI = 'arbitrum:0x1922c36f3bc762ca300b4a46bb2102f84b1684ab' - if (balances[cUMAMI]) { - // get cmUmami price per share for later - const { output: pps} = await sdk.api.abi.call({ - abi: cmUmamiABI, - target: tokens.CMUMAMI, - params: [1000000000], - chain, block - }) - const umamiBal = balances[cUMAMI] * pps / 1e9 - delete balances[cUMAMI] - sdk.util.sumSingleBalance(balances, transform(tokens.UMAMI), BigNumber(umamiBal).toFixed(0)) - } + return sumTokens2({ tokensAndOwners, api, balances, }); +} - return balances +const config = { + arbitrum: { factory: '0xf0dbf74cef39e5cd4e54d0ffd59075024c7d8857', fromBlock: 20274088, }, + ethereum: { factory: '0x928cf648069082D9AEf25ddB2bF10D25bf1C1D73', fromBlock: 16545630, }, } module.exports = { methodology: 'The sum of the balance of all listed collateral and lend tokens in all deployed pools.', start: 20274088, - arbitrum: { - tvl - } -}; \ No newline at end of file +}; + +Object.keys(config).forEach(chain => { + module.exports[chain] = { tvl } +}) \ No newline at end of file diff --git a/projects/veniceswap/index.js b/projects/veniceswap/index.js new file mode 100644 index 00000000000..7969b1f669b --- /dev/null +++ b/projects/veniceswap/index.js @@ -0,0 +1,8 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports = { + methodology: `Uses factory(0x5a75C65a96445eD0a4dDC1C1E35DF24B1DA3fe6a) address and whitelisted tokens address to find and price Liquidity Pool pairs`, + findora: { + tvl: getUniTVL({ factory: '0x5a75C65a96445eD0a4dDC1C1E35DF24B1DA3fe6a', chain: 'findora', useDefaultCoreAssets: true }), + }, +}; \ No newline at end of file diff --git a/projects/venofinance/index.js b/projects/venofinance/index.js new file mode 100644 index 00000000000..af33e240d25 --- /dev/null +++ b/projects/venofinance/index.js @@ -0,0 +1,44 @@ +const sdk = require('@defillama/sdk') +const { staking } = require("../helper/staking.js"); + +const fountain_contract_address = "0xb4be51216f4926ab09ddf4e64bc20f499fd6ca95" +const reservoir_contract_address = "0x21179329c1dcfd36ffe0862cca2c7e85538cca07" +const vno_contract_address = "0xdb7d0a1ec37de1de924f8e8adac6ed338d4404e9" + +async function tvl(timestamp, ethBlock, chainBlocks, {api}) { + + + const lcro_contract_address = '0x9Fae23A2700FEeCd5b93e43fDBc03c76AA7C08A6'; + const latom_contract_address = '0xac974ee7fc5d083112c809ccb3fce4a4f385750d'; + + const block = chainBlocks.cronos + + const cro_pooled = await sdk.api.abi.call({ + abi: "uint256:getTotalPooledCro", + target: lcro_contract_address, + block: block, + chain: 'cronos' + }) + + const atom_pooled = await sdk.api.abi.call({ + abi: "uint256:getTotalPooledToken", + target: latom_contract_address, + block: block, + chain: 'cronos' + }) + + return { + 'crypto-com-chain': Number(cro_pooled.output) / 1e18, + "cosmos": Number(atom_pooled.output) / 1e6 + }; +} + +module.exports = { + timetravel: true, + misrepresentedTokens: false, + methodology: 'TVL counts CRO staked by the protocol.', + cronos: { + tvl , + staking: staking([fountain_contract_address, reservoir_contract_address], vno_contract_address) + } +} \ No newline at end of file diff --git a/projects/venus-isolated-pools/index.js b/projects/venus-isolated-pools/index.js new file mode 100644 index 00000000000..7b51fbceb9f --- /dev/null +++ b/projects/venus-isolated-pools/index.js @@ -0,0 +1,32 @@ +const { cachedGraphQuery } = require('../helper/cache') +const sdk = require('@defillama/sdk') +const { compoundExports2 } = require('../helper/compound') +const config = { + bsc: { + endpoint: 'https://api.thegraph.com/subgraphs/name/venusprotocol/venus-isolated-pools', + } +} + +Object.keys(config).forEach(chain => { + module.exports[chain] = { tvl, borrowed, } +}) + +async function getPools(api) { + const { endpoint } = config[api.chain] + const { pools } = await cachedGraphQuery('venus-v4', endpoint, `{ pools { id }}`) + return pools.map(i => i.id) +} + +async function tvl(...args) { + const [_, _b, _cb, { api, }] = args + const pools = await getPools(api) + const tvls = pools.map(i => compoundExports2({ comptroller: i, fetchBalances: true, })) + return sdk.util.sumChainTvls(tvls.map(i => i.tvl))(...args) +} + +async function borrowed(...args) { + const [_, _b, _cb, { api, }] = args + const pools = await getPools(api) + const tvls = pools.map(i => compoundExports2({ comptroller: i, fetchBalances: true, })) + return sdk.util.sumChainTvls(tvls.map(i => i.borrowed))(...args) +} \ No newline at end of file diff --git a/projects/veplus/index.js b/projects/veplus/index.js new file mode 100644 index 00000000000..92d2c84362e --- /dev/null +++ b/projects/veplus/index.js @@ -0,0 +1,13 @@ +const { getUniTVL } = require('../helper/unknownTokens.js') + +module.exports = { + misrepresentedTokens: true, + bsc:{ + tvl: getUniTVL({ + useDefaultCoreAssets: true, + hasStablePools: true, + fetchBalances: true, + factory: '0x5Bcd9eE6C31dEf33334b255EE7A767B6EEDcBa4b', + }), + }, +} \ No newline at end of file diff --git a/projects/verified-credits/index.js b/projects/verified-credits/index.js new file mode 100644 index 00000000000..fcbdb2067e3 --- /dev/null +++ b/projects/verified-credits/index.js @@ -0,0 +1,6 @@ +const { masterchefExports } = require('../helper/unknownTokens') + +module.exports = masterchefExports({ + chain: 'kava', + masterchef: '0x0a3b0C346cEE826aa0eBEf78c1eBcB9BE07aD2eb', +}) \ No newline at end of file diff --git a/projects/versedex/index.js b/projects/versedex/index.js index 7c63e3d356b..12b7031ab72 100644 --- a/projects/versedex/index.js +++ b/projects/versedex/index.js @@ -1,11 +1,12 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { getUniTVL } = require('../helper/unknownTokens') -const FLEXUSD = "0x7b2B3C5308ab5b2a1d9a94d20D35CCDf61e05b72"; -const WBCH = "0x3743eC0673453E5009310C727Ba4eaF7b3a1cc04"; +const FLEXUSD = ADDRESSES.smartbch.flexUSD; +const WBCH = ADDRESSES.smartbch.WBCH; const SBCH_FACTORY = "0x16bc2B187D7C7255b647830C05a6283f2B9A3AF8"; -const DAI = "0x6B175474E89094C44Da98b954EedeAC495271d0F"; -const WETH = "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"; +const DAI = ADDRESSES.ethereum.DAI; +const WETH = ADDRESSES.ethereum.WETH; const ETH_FACTORY = "0xee3E9E46E34a27dC755a63e2849C9913Ee1A06E2"; module.exports = { diff --git a/projects/vertex/index.js b/projects/vertex/index.js new file mode 100644 index 00000000000..5aaf3dfc833 --- /dev/null +++ b/projects/vertex/index.js @@ -0,0 +1,22 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokens2, sumTokensExport } = require('../helper/unwrapLPs') + +const config = { + "querier": "0x1693273B443699bee277eCbc60e2C8027E91995d", + "feeCalculator": "0x2259440579447D0625a5E28dfF3E743d207e8890", + "clearinghouse": "0xAE1ec28d6225dCE2ff787dcb8CE11cF6D3AE064f", + "clearinghouseLiq": "0xca007C51Fc14eEA88252Cc4FD71e91E44026F020", + "endpoint": "0xbbEE07B3e8121227AfCFe1E2B82772246226128e", + "spotEngine": "0x32d91Af2B17054D575A7bF1ACfa7615f41CCEfaB", + "perpEngine": "0xb74C78cca0FADAFBeE52B2f48A67eE8c834b5fd1" +} + + +module.exports = { + arbitrum: { + tvl: sumTokensExport({ + owners: [config.clearinghouse, config.endpoint], + tokens: [ADDRESSES.arbitrum.WBTC, ADDRESSES.arbitrum.WETH, ADDRESSES.arbitrum.USDC, ADDRESSES.arbitrum.ARB], + }) + } +} \ No newline at end of file diff --git a/projects/vesper/abi.json b/projects/vesper/abi.json index c85584ad1b3..680414d4abd 100644 --- a/projects/vesper/abi.json +++ b/projects/vesper/abi.json @@ -1,76 +1,7 @@ { - "token": { - "constant": true, - "inputs": [], - "name": "token", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "totalValue": { - "inputs": [], - "name": "totalValue", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "pools": { - "inputs": [], - "name": "pools", - "outputs": [ - { - "internalType": "contract IAddressList", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "length": { - "inputs": [], - "name": "length", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "at": { - "inputs": [ - { - "internalType": "uint256", - "name": "index", - "type": "uint256" - } - ], - "name": "at", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } + "token": "address:token", + "totalValue": "uint256:totalValue", + "pools": "address:pools", + "length": "uint256:length", + "at": "function at(uint256 index) view returns (address)" } \ No newline at end of file diff --git a/projects/vesper/index.js b/projects/vesper/index.js index b28b7bc5085..dae3a61ab05 100644 --- a/projects/vesper/index.js +++ b/projects/vesper/index.js @@ -1,7 +1,7 @@ const sdk = require("@defillama/sdk") const abi = require('./abi.json') const { getChainTransform } = require('../helper/portedTokens') -const http = require('../helper/http') +const { getConfig } = require("../helper/cache") const chainConfig = { ethereum: { @@ -15,6 +15,9 @@ const chainConfig = { polygon: { api: ['https://api-polygon.vesper.finance/pools?stages=prod'], }, + optimism: { + api: ['https://api-optimism.vesper.finance/pools'] + }, } function getChainExports(chain) { @@ -29,8 +32,11 @@ function getChainExports(chain) { const poolSet = new Set() - for (const url of api) - (await http.get(url)).forEach(pool => poolSet.add(pool.address)) // add pools from our contracts list + for (let i = 0;i< api.length;i++) { + const key = ['vesper', chain, i].join('/') + const data = await getConfig(key, api[i]) + data.forEach(pool => poolSet.add(pool.address)) // add pools from our contracts list + } if (stakingPool) poolSet.delete(stakingPool) const poolList = [...poolSet] @@ -67,5 +73,5 @@ function getChainExports(chain) { module.exports = { start: 1608667205, // December 22 2020 at 8:00 PM UTC - ...['ethereum', 'avax', 'polygon'].reduce((acc, chain) => ({ ...acc, ...getChainExports(chain) }), {}) + ...['ethereum', 'avax', 'polygon','optimism'].reduce((acc, chain) => ({ ...acc, ...getChainExports(chain) }), {}) }; diff --git a/projects/vesq/index.js b/projects/vesq/index.js index e6463432539..01cf8e6b395 100644 --- a/projects/vesq/index.js +++ b/projects/vesq/index.js @@ -1,10 +1,11 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { ohmTvl } = require('../helper/ohm') const treasury = "0x8c7290399cecbbbf31e471951cc4c2ce91f5073c" const vsq_token = "0x29f1e986fca02b7e54138c04c4f503dddd250558" const stakingAddress = "0x2f3e9e54bd4513d1b49a6d915f9a83310638cfc2" const treasuryTokens = [ - ["0x8f3cf7ad23cd3cadbd9735aff958023239c6a063", false], //DAI + [ADDRESSES.polygon.DAI, false], //DAI ["0x2e1ad108ff1d8c782fcbbb89aad783ac49586756", false], //TUSD ["0xa3fa99a148fa48d14ed51d610c367c61876997f1", false], //MAI ["0x45c32fa6df82ead1e2ef74d17b76547eddfaff89", false], //FRAX diff --git a/projects/vesta/getEntireSystemColl.abi.json b/projects/vesta/getEntireSystemColl.abi.json deleted file mode 100644 index 091696af713..00000000000 --- a/projects/vesta/getEntireSystemColl.abi.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "inputs": [ - { - "internalType": "address", - "name": "_asset", - "type": "address" - } - ], - "name": "getEntireSystemColl", - "outputs": [ - { - "internalType": "uint256", - "name": "entireSystemColl", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" -} diff --git a/projects/vesta/index.js b/projects/vesta/index.js index 7a98e2a6489..a970a8fdfe1 100644 --- a/projects/vesta/index.js +++ b/projects/vesta/index.js @@ -1,15 +1,14 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); -const getEntireSystemCollAbi = require("./getEntireSystemColl.abi.json"); -const vestaFarmingAbi = require("./vestaFarming.abi.json"); -const { sumBalancerLps, unwrapCrv } = require("../helper/unwrapLPs.js"); +const { sumBalancerLps, } = require("../helper/unwrapLPs.js"); const { transformArbitrumAddress } = require("../helper/portedTokens"); const VaultTokens = { gOHM: "0x8d9ba570d6cb60c7e3e0f31343efe75ab8e65fb1", - ETH: "0x0000000000000000000000000000000000000000", - renBTC: "0xdbf31df14b66535af65aac99c32e9ea844e14501", + ETH: ADDRESSES.null, + renBTC: ADDRESSES.fantom.renBTC, DPX: "0x6c2c06790b3e3e3c38e12ee22f8183b37a13ee55", - GMX: "0xfc5a1a6eb076a2c7ad06ed22c90d7e710e35ad0a", + GMX: ADDRESSES.arbitrum.GMX, GLP: "0x2f546ad4edd93b956c8999be404cdcafde3e89ae" } @@ -33,7 +32,8 @@ async function tvl(_, block, chainBlocks) { const balances = {} const calls = Object.values(VaultTokens).map(token => ({ params: [token] })) const { output } = await sdk.api.abi.multiCall({ - calls, block, chain: 'arbitrum', target: TROVE_MANAGER_ADDRESS, abi: getEntireSystemCollAbi, + calls, block, chain: 'arbitrum', target: TROVE_MANAGER_ADDRESS, abi: "function getEntireSystemColl(address _asset) view returns (uint256 entireSystemColl)" + , }) output.forEach(({ input: { params: [token] }, output }) => { @@ -45,21 +45,20 @@ async function tvl(_, block, chainBlocks) { }) return balances; -}; +} -async function pool2(_timestamp, block, chainBlocks) { +async function pool2(_timestamp, block, chainBlocks, { api }) { block = chainBlocks.arbitrum; const balances = {}; const transform = await transformArbitrumAddress(); await sumBalancerLps(balances, [[LP_VSTA_ETH_ADDRESS, VSTA_FARMING_ADDRESS]], chainBlocks.arbitrum, chain, transform); const curveBalances = ( - await sdk.api.abi.call({ target: VST_FARMING_ADDRESS, abi: vestaFarmingAbi, block, params: [], chain, }) + await sdk.api.abi.call({ target: VST_FARMING_ADDRESS, abi: "uint256:totalStaked", block, params: [], chain, }) ).output; - - await unwrapCrv(balances, LP_VST_FRAX_ADDRESS, curveBalances, block, chain, transform); + sdk.util.sumSingleBalance(balances,LP_VST_FRAX_ADDRESS,curveBalances, api.chain) return balances; -}; +} module.exports = { arbitrum: { diff --git a/projects/vesta/vestaFarming.abi.json b/projects/vesta/vestaFarming.abi.json deleted file mode 100644 index 0e2ad49a4f0..00000000000 --- a/projects/vesta/vestaFarming.abi.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "type": "function", - "name": "totalStaked", - "inputs": [], - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "constant": null, - "stateMutability": "view" -} diff --git a/projects/vestige/index.js b/projects/vestige/index.js new file mode 100644 index 00000000000..83431a19890 --- /dev/null +++ b/projects/vestige/index.js @@ -0,0 +1,34 @@ +const axios = require("axios"); + +async function fetch() { + //Get all the vaults in the protocol + const assetsUrl = "https://free-api.vestige.fi/assets/locked"; + const assetsResponse = await axios.get(assetsUrl); + const assets = assetsResponse.data; + + let tvl = 0; + + await Promise.all( + assets.map(async (asset) => { + const assetId = asset.asset_id; + const supplyInTvlLocked = asset.supply_in_tvl_locked; + const priceUrl = `https://free-api.vestige.fi/asset/${assetId}/price`; + const priceResponse = await axios.get(priceUrl); + const price = priceResponse.data.USD; + tvl += supplyInTvlLocked * price * 2; + }) + ); + tvl = tvl.toFixed(6) + return tvl; + +} + +module.exports = { + timetravel:false, + misrepresentedTokens:true, + methodology:`Counts tokens in LPs only, transforms the price to USD and * them by 2 to account for the other side.`, + algorand: { + fetch + }, + fetch +}; diff --git a/projects/vesync/index.js b/projects/vesync/index.js new file mode 100644 index 00000000000..27e269878ad --- /dev/null +++ b/projects/vesync/index.js @@ -0,0 +1,32 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { getUniTVL } = require('../helper/unknownTokens'); + +const GET_AMOUNT_OUT = "function getAmountOut(uint amountIn, address tokenIn, address tokenOut) external view returns (uint amount, bool stable)"; + +const VOTING_ESCROW = "0x1925AB9F9bcdB9E2D2861cc7C4c157645126D9d9"; +const VS = "0x5756A28E2aAe01F600FC2C01358395F5C1f8ad3A"; +const ROUTER = "0x6C31035D62541ceba2Ac587ea09891d1645D6D07"; +const USDC = ADDRESSES.era.USDC; + +module.exports = { + misrepresentedTokens: true, + era: { + tvl: getUniTVL({ + factory: '0x529Bd7Fc43285B96f1e8d5158626d1F15bb8A834', + useDefaultCoreAssets: true, + hasStablePools: true, + fetchBalances: true, + }), + staking: async (_, _b, cb, { api } = {}) => { + const vsBalance = await api.call({ target: VS, abi: 'erc20:balanceOf', params: VOTING_ESCROW, }) + + // Use 1 VS as input to get the conversion rate from VS to USDC + const [conversionRate] = await api.call({ target: ROUTER, abi: GET_AMOUNT_OUT, params: [''+1e18, VS, USDC] }) + + return { + "usd-coin": vsBalance *conversionRate / 1e24 + } + } + }, + methodology: "TVL is total liquidity of all liquidity pools. Staking TVL is the value of VS tokens locked in the voting escrow (veVS) contract.", +}; \ No newline at end of file diff --git a/projects/vett/index.js b/projects/vett/index.js new file mode 100644 index 00000000000..5abf1b50a29 --- /dev/null +++ b/projects/vett/index.js @@ -0,0 +1,27 @@ +const sdk = require("@defillama/sdk"); + + +const chain = "thundercore"; +const posStaking = "0xC3C857a9E5Be042C8acF4F2827Aa053e93b5d039" +const posABI = { + getTTPoolAbi: "uint256:getTTPool" +} + +async function tvl(_timestamp, _b, { thundercore: block }) { + const params = { chain, block, target: posStaking, } + // staking pool = balanceOf(posStaking) + sum(voterStakings) - sum(userUnstakings) + const ttTvl = await sdk.api2.abi.call({ + ...params, + abi: posABI.getTTPoolAbi, + }); + return { + "thunder-token": ttTvl / 1e18, + }; +} + +module.exports = { + methodology: 'calculate the total amount of TT locked in the veTT contract', + thundercore: { + tvl, + }, +} \ No newline at end of file diff --git a/projects/vexchange/abi.json b/projects/vexchange/abi.json index f41d62de0a9..0b9812b9bb5 100644 --- a/projects/vexchange/abi.json +++ b/projects/vexchange/abi.json @@ -1,76 +1,8 @@ { - "balanceOf": { - "constant": true, - "inputs": [ - { - "name": "_owner", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "name": "balance", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "allPairsLength": { - "constant": true, - "inputs": [], - "name": "allPairsLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "allPairs": { - "constant": true, - "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "name": "allPairs", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "token0": { - "constant": true, - "inputs": [], - "name": "token0", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "token1": { - "constant": true, - "inputs": [], - "name": "token1", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "getReserves": { - "constant": true, - "inputs": [], - "name": "getReserves", - "outputs": [ - { "internalType": "uint112", "name": "_reserve0", "type": "uint112" }, - { "internalType": "uint112", "name": "_reserve1", "type": "uint112" }, - { "internalType": "uint32", "name": "_blockTimestampLast", "type": "uint32" } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } -} + "balanceOf": "function balanceOf(address _owner) view returns (uint256 balance)", + "allPairsLength": "uint256:allPairsLength", + "allPairs": "function allPairs(uint256) view returns (address)", + "token0": "address:token0", + "token1": "address:token1", + "getReserves": "function getReserves() view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast)" +} \ No newline at end of file diff --git a/projects/vidya/index.js b/projects/vidya/index.js new file mode 100644 index 00000000000..6d1bfe23eaf --- /dev/null +++ b/projects/vidya/index.js @@ -0,0 +1,36 @@ +const { + sumTokensExport +} = require('../helper/unwrapLPs'); + +// Vidya +const VIDYA_TOKEN = '0x3D3D35bb9bEC23b06Ca00fe472b50E7A4c692C30'; +const GNOSIS_SAFE = '0x17F0ABD8535Ba8846a82B1462F95C384A7d2193C'; + +// Generator +const SINGLE_SIDE_TELLER = '0x4E053ac1F6F34A73F5Bbd876eFd20525EAcB5382'; +const LP_TELLER = '0xD9BecdB8290077fAf79A2637a5f2FDf5033b2486'; +const VAULT = '0xe4684AFE69bA238E3de17bbd0B1a64Ce7077da42'; + +// Games +const VIDYAFLUX = '0x34317e2Da45FeC7c525aCa8dAbF22CbC877128a3'; +const INVENTORYV2 = '0x9680223F7069203E361f55fEFC89B7c1A952CDcc'; +const LEMONADESTAND = '0xf1261B8aD1a1c1856F0DE117Cd90BAc64b386285'; + +// LPs +const UNISWAP_PAIR = '0xDA3706c9A099077e6BC389D1baf918565212A54D'; +const UNISWAP_PAIR_CRAMER = '0x507C7d56c69bEDC528c3AA00b018656D20605663'; + +module.exports = { + methodology: 'Counts the total number of tokens locked in staking contracts, game contracts and project treasury.', + ethereum: { + tvl: () => ({}), + staking: sumTokensExport({ + owners: [SINGLE_SIDE_TELLER, VAULT, VIDYAFLUX, INVENTORYV2, LEMONADESTAND, ], + tokens: [VIDYA_TOKEN,], + }), + pool2: sumTokensExport({ + owners: [LP_TELLER, ], + tokens: [UNISWAP_PAIR, UNISWAP_PAIR_CRAMER], + }), + } +}; diff --git a/projects/vigor/index.js b/projects/vigor/index.js index a705f5f2fef..48e089925db 100644 --- a/projects/vigor/index.js +++ b/projects/vigor/index.js @@ -1,18 +1,26 @@ const { get_account_tvl } = require("../helper/chain/eos") +const sdk = require('@defillama/sdk') +const account1 = 'vigorlending' +const tokens1 = [ + ["eosio.token", "EOS", "eos"], + ["tethertether", "USDT", "tether"], + ["everipediaiq", "IQ", "everipedia"], + ["btc.ptokens", "PBTC", "bitcoin"], + ["eth.ptokens", "PETH", "ethereum"], +]; + +const account2 = 'vigorstaking' +const tokens2 = [ + ["eosio.token", "EOS", "eos"], + ["tethertether", "USDT", "tether"], +]; module.exports = { timetravel: false, eos: { - tvl: async () => { - const account = 'vigorlending' - const tokens = [ - ["eosio.token", "EOS", "eos"], - ["tethertether", "USDT", "tether"], - ["everipediaiq", "IQ", "everipedia"], - ["btc.ptokens", "PBTC", "bitcoin"], - ["eth.ptokens", "PETH", "ethereum"], - ]; - return get_account_tvl(account, tokens) - } + tvl: sdk.util.sumChainTvls([ + () => get_account_tvl(account1, tokens1), + () => get_account_tvl(account2, tokens2), + ]) }, } diff --git a/projects/viperswap/index.js b/projects/viperswap/index.js index b4d71f304a2..bb20492c95e 100644 --- a/projects/viperswap/index.js +++ b/projects/viperswap/index.js @@ -1,23 +1,16 @@ -const { calculateUniTvl } = require("../helper/calculateUniTvl"); -const { getFixBalancesSync } = require("../helper/portedTokens"); +const ADDRESSES = require('../helper/coreAssets.json') +const { uniTvlExport } = require("../helper/calculateUniTvl"); const { staking } = require("../helper/staking"); const factory = "0x7d02c116b98d0965ba7b642ace0183ad8b8d2196"; -const viper = "0xea589e93ff18b1a1f1e9bac7ef3e86ab62addc79"; +const viper = ADDRESSES.harmony.VIPER; const xviper = "0xe064a68994e9380250cfee3e8c0e2ac5c0924548"; -async function tvl(timestamp, block, chainBlocks) { - let balances = await calculateUniTvl(addr => { - return `harmony:${addr}`; - }, chainBlocks.harmony, "harmony", factory, 0, true); - getFixBalancesSync('harmony')(balances); - return balances; -} module.exports = { harmony: { - tvl, - staking: staking(xviper, viper, "harmony") + tvl: uniTvlExport(factory, 'harmony', true), + staking: staking(xviper, viper) }, hallmarks:[ [1655991120, "Horizon bridge Hack $100m"], diff --git a/projects/vires/index.js b/projects/vires/index.js index b4fadca537b..dead9c5c394 100644 --- a/projects/vires/index.js +++ b/projects/vires/index.js @@ -1,6 +1,6 @@ const { wavesAdapter } = require('../helper/chain/wavesAdapter') -const endpoint = "http://51.158.191.108:8002/api/v1/history/vires" +const endpoint = "/vires" module.exports = { timetravel: false, diff --git a/projects/visor/abis/hypeRegistry.json b/projects/visor/abis/hypeRegistry.json new file mode 100644 index 00000000000..9603089dad7 --- /dev/null +++ b/projects/visor/abis/hypeRegistry.json @@ -0,0 +1,4 @@ +{ + "counter": "int256:counter", + "hypeByIndex": "function hypeByIndex(uint256 index) view returns (address, uint256)" +} \ No newline at end of file diff --git a/projects/visor/abis/hypervisor.json b/projects/visor/abis/hypervisor.json index ddc6c5b098c..f8a8cb88c01 100644 --- a/projects/visor/abis/hypervisor.json +++ b/projects/visor/abis/hypervisor.json @@ -1,109 +1,4 @@ { - "getCurrentTotalStakeUnits": { - "inputs": [], - "name": "getCurrentTotalStakeUnits", - "outputs": [ - { - "internalType": "uint256", - "name": "totalStakeUnits", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getHyperVisorData": { - "inputs": [], - "name": "getHypervisorData", - "outputs": [ - { - "components": [ - { - "internalType": "address", - "name": "stakingToken", - "type": "address" - }, - { - "internalType": "address", - "name": "rewardToken", - "type": "address" - }, - { - "internalType": "address", - "name": "rewardPool", - "type": "address" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "floor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "ceiling", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "time", - "type": "uint256" - } - ], - "internalType": "struct IHypervisor.RewardScaling", - "name": "rewardScaling", - "type": "tuple" - }, - { - "internalType": "uint256", - "name": "rewardSharesOutstanding", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalStake", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalStakeUnits", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastUpdate", - "type": "uint256" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "duration", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "start", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "shares", - "type": "uint256" - } - ], - "internalType": "struct IHypervisor.RewardSchedule[]", - "name": "rewardSchedules", - "type": "tuple[]" - } - ], - "internalType": "struct IHypervisor.HypervisorData", - "name": "hypervisor", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - } + "getCurrentTotalStakeUnits": "uint256:getCurrentTotalStakeUnits", + "getHyperVisorData": "function getHypervisorData() view returns (tuple(address stakingToken, address rewardToken, address rewardPool, tuple(uint256 floor, uint256 ceiling, uint256 time) rewardScaling, uint256 rewardSharesOutstanding, uint256 totalStake, uint256 totalStakeUnits, uint256 lastUpdate, tuple(uint256 duration, uint256 start, uint256 shares)[] rewardSchedules) hypervisor)" } \ No newline at end of file diff --git a/projects/visor/abis/tokens.json b/projects/visor/abis/tokens.json new file mode 100644 index 00000000000..628463c86b5 --- /dev/null +++ b/projects/visor/abis/tokens.json @@ -0,0 +1,4 @@ +{ + "token1": "address:token1", + "token0": "address:token0" +} \ No newline at end of file diff --git a/projects/visor/index.js b/projects/visor/index.js index 65f598673c5..51197f2e0ab 100644 --- a/projects/visor/index.js +++ b/projects/visor/index.js @@ -1,192 +1,148 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const hypervisorAbi = require("./abis/hypervisor.json"); -const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); const { staking } = require("../helper/staking"); -const { getChainTransform } = require("../helper/portedTokens"); -const { request, gql } = require("graphql-request"); - -const getTotalAmounts = require("./abis/getTotalAmounts.json"); - -//get their pool addresses from the subgraph -const GRAPH_URL = { - ethereum: "https://api.thegraph.com/subgraphs/name/gammastrategies/gamma", - polygon: "https://api.thegraph.com/subgraphs/name/gammastrategies/polygon", - optimism: "https://api.thegraph.com/subgraphs/name/gammastrategies/optimism", - arbitrum: "https://api.thegraph.com/subgraphs/name/gammastrategies/arbitrum", - celo: "https://api.thegraph.com/subgraphs/name/gammastrategies/celo", +const getTotalAmounts = + "function getTotalAmounts() view returns (uint256 total0, uint256 total1)"; +const hypeRegistry = require("./abis/hypeRegistry.json"); +const { getUniqueAddresses } = require("../helper/utils"); + +/* Pools for initial LM program in 2021 */ +const LIQUIDITY_MINING_POOLS = [ + "0x64fcdd0de44f4bd04c039b0664fb95ef033d4efb", // GAMMA/ETH UNI-V2 + "0x96c105e9e9eab36eb8e2f851a5dabfbbd397c085", // USDC + "0xebae3cb14ce6c2f26b40b747fd92ccaf03b98659", // USDT + "0xf178d88d2f6f97ca32f92b465987068e1cce41c5", // DAI +]; + +/* List of hypervisor registries by chain + One chain can have multiple registries for different underlying DEXes */ +const HYPE_REGISTRY = { + ethereum: [ + "0x31ccdb5bd6322483bebd0787e1dabd1bf1f14946", // Uniswap + ], + polygon: [ + "0x0Ac4C7b794f3D7e7bF1093A4f179bA792CF15055", // Uniswap + "0xAeC731F69Fa39aD84c7749E913e3bC227427Adfd", // Quickswap + "0xcAC19d43C9558753d7535978A370055614Ce832E", // Retro + "0x97686103B3E7238Ca6c2C439146B30adBd84a593", // Sushiswap + "0x7b9c2f68f16c3618bb45616fb98d83f94fd7062e", // Ascent + ], + polygon_zkevm: [ + "0xD08B593eb3460B7aa5Ce76fFB0A3c5c938fd89b8", // Quickswap + ], + optimism: [ + "0xF5BFA20F4A77933fEE0C7bB7F39E7642A070d599", // Uniswap + ], + arbitrum: [ + "0x66CD859053c458688044d816117D5Bdf42A56813", // Uniswap + "0x37595FCaF29E4fBAc0f7C1863E3dF2Fe6e2247e9", // Zyberswap + "0x0f867F14b39a5892A39841a03bA573426DE4b1d0", // Sushiswap + "0x34Ffbd9Db6B9bD8b095A0d156de69a2AD2944666", // Ramses + "0xa216C2b6554A0293f69A1555dd22f4b7e60Fe907", // Camelot + ], + bsc: [ + "0x0b4645179C1b668464Df01362fC6219a7ab3234c", // Uniswap + "0xd4bcFC023736Db5617E5638748E127581d5929bd", // Thena + ], + moonbeam: [ + "0xB7dfC304D9cd88D98A262cE5B6a39Bb9d6611063", // Beamswap + "0x6002D7714e8038f2058e8162b0b86c0b19c31908", // Stellaswap + ], + celo: [ + "0x0F548d7AD1A0CB30D1872b8C18894484d76e1569", // Uniswap + ], + avax: [ + "0x3FE6F25DA67DC6AD2a5117a691f9951eA14d6f15", // Glacier + ], + fantom: [ + "0xf874d4957861e193aec9937223062679c14f9aca", // Spiritswap + ], + mantle: [ + "0x683292172E2175bd08e3927a5e72FC301b161300", // FusionX + ], }; -const liquidityMiningQuery = gql` - { - hypervisors(first: 10) { - id - stakingToken { - id - symbol - } - totalStakedAmount - } - } -`; - -const uniV3HypervisorQuery = gql` - { - uniswapV3Hypervisors(first: 1000) { - id - pool { - token0 { - id - } - token1 { - id - } - } - } - } -`; - -async function tvlEthereum(timestamp, block, chainBlocks) { - const balances = {}; - - const tvls = await Promise.all([ - tvlLiquidityMining(timestamp, block), - tvlUniV3(timestamp, chainBlocks, "ethereum"), - ]); - - // Ethereum TVL - for (const currTvl of tvls) { - for (let [token, amount] of Object.entries(currTvl)) { - sdk.util.sumSingleBalance(balances, token, amount); - } - } - - return balances; -} - -async function tvlPolygon(timestamp, block, chainBlocks) { - return await tvlUniV3(timestamp, chainBlocks, "polygon"); -} - -async function tvlOptimism(timestamp, block, chainBlocks) { - return await tvlUniV3(timestamp, chainBlocks, "optimism"); -} - -async function tvlArbitrum(timestamp, block, chainBlocks) { - return await tvlUniV3(timestamp, chainBlocks, "arbitrum"); -} - -async function tvlCelo(timestamp, block, chainBlocks) { - return await tvlUniV3(timestamp, chainBlocks, "celo"); -} +/* List of bad addresses added to registries that need to be excluded manually */ +const blacklist = { + ethereum: [ADDRESSES.ethereum.WBTC], + polygon: ["0xa9782a2c9c3fb83937f14cdfac9a6d23946c9255"], +}; /*Tokens staked in Visors*/ -async function tvlLiquidityMining(timestamp, block) { +async function tvlLiquidityMining(_timestamp, _block, _, { api }) { const balances = {}; //get the staking pool contracts, and the respective token addresses - const resp = await request(GRAPH_URL["ethereum"], liquidityMiningQuery); - - for (let i = 0; i < resp.hypervisors.length; i++) { - const curr = resp.hypervisors[i]; - const stakingPoolAddr = curr.id; - const tokenAddr = curr.stakingToken.id; - - const tokenLocked = await sdk.api.abi.call({ - target: stakingPoolAddr, - abi: hypervisorAbi["getHyperVisorData"], - block: block, - }); - - if (curr.stakingToken.symbol == "UNI-V2") { - await unwrapUniswapLPs( - balances, - [ - { - token: tokenAddr, - balance: tokenLocked.output.totalStake, - }, - ], - block - ); - } else { - balances[tokenAddr] = tokenLocked.output.totalStake; - } - } - + const bals = await api.multiCall({ + abi: hypervisorAbi.getHyperVisorData, + calls: LIQUIDITY_MINING_POOLS, + }); + bals.forEach(({ stakingToken, totalStake }, i) => + sdk.util.sumSingleBalance(balances, stakingToken, totalStake, api.chain) + ); return balances; } -/*Tokens deposited in Uniswap V3 positions managed by Visor*/ -async function tvlUniV3(timestamp, chainBlocks, chain) { - const balances = {}; - - const resp = await request(GRAPH_URL[chain], uniV3HypervisorQuery); +/*Tokens deposited in Uniswap V3-like LP positions managed by Gamma Strategies*/ +async function tvlUniV3(api) { + const targets = HYPE_REGISTRY[api.chain]; + + // Bulk fetch lists for all registries the chain and flatten into one array + let hypervisors = await Promise.all( + targets.map((target) => + api.fetchList({ + lengthAbi: hypeRegistry.counter, + itemAbi: hypeRegistry.hypeByIndex, + target, + }) + ) + ).then((data) => data.flat()); + + // Filter out invalid hypervisors, valid hypervisors have hypeIndex > 0 + hypervisors = hypervisors + .filter((hypervisor) => hypervisor[1] > 0) + .map((i) => i[0]); + + return getHypervisorBalances({ hypervisors, api }); +} - const hypervisorAddresses = []; - const token0Addresses = []; - const token1Addresses = []; +async function tvlWrapper(_, _b, _cb, { api }) { + return tvlUniV3(api); +} - for (let hypervisor of resp.uniswapV3Hypervisors) { - token0Addresses.push(hypervisor.pool.token0.id.toLowerCase()); - token1Addresses.push(hypervisor.pool.token1.id.toLowerCase()); - hypervisorAddresses.push(hypervisor.id.toLowerCase()); +async function getHypervisorBalances({ hypervisors, api, balances = {} }) { + hypervisors = getUniqueAddresses(hypervisors); + if (blacklist[api.chain]) { + const blacklistSet = new Set( + blacklist[api.chain].map((i) => i.toLowerCase()) + ); + hypervisors = hypervisors.filter((i) => !blacklistSet.has(i.toLowerCase())); } - - const hypervisors = {}; - // add token0Addresses - token0Addresses.forEach((token0Address, i) => { - const hypervisorAddress = hypervisorAddresses[i]; - hypervisors[hypervisorAddress] = { - token0Address: token0Address, - }; - }); - - // add token1Addresses - token1Addresses.forEach((token1Address, i) => { - const hypervisorAddress = hypervisorAddresses[i]; - hypervisors[hypervisorAddress] = { - ...(hypervisors[hypervisorAddress] || {}), - token1Address: token1Address, - }; + const supplies = await api.multiCall({ + abi: "erc20:totalSupply", + calls: hypervisors, + permitFailure: true, }); + hypervisors = hypervisors.filter((_, i) => +supplies[i] > 0); - let hypervisorCalls = []; - - for (let hypervisor of Object.keys(hypervisors)) { - hypervisorCalls.push({ - target: hypervisor, - }); - } - - // Call getTotalAmounts on hypervisor contract - const hypervisorBalances = await sdk.api.abi.multiCall({ - chain: chain, - abi: getTotalAmounts, - calls: hypervisorCalls, - block: chainBlocks[chain], + const [token0s, token1s, bals] = await Promise.all([ + api.multiCall({ calls: hypervisors, abi: "address:token0" }), + api.multiCall({ calls: hypervisors, abi: "address:token1" }), + api.multiCall({ calls: hypervisors, abi: getTotalAmounts }), + ]); + bals.forEach(({ total0, total1 }, i) => { + sdk.util.sumSingleBalance(balances, token0s[i], total0, api.chain); + sdk.util.sumSingleBalance(balances, token1s[i], total1, api.chain); }); - - const chainTransform = await getChainTransform(chain); - - // Sum up balance0 and balance1 for each hypervisor - for (let balance of hypervisorBalances.output) { - let hypervisorAddress = balance.input.target; - let address0 = hypervisors[hypervisorAddress].token0Address; - let address1 = hypervisors[hypervisorAddress].token1Address; - let balance0 = balance.output.total0; - let balance1 = balance.output.total1; - - sdk.util.sumSingleBalance(balances, chainTransform(address0), balance0); - sdk.util.sumSingleBalance(balances, chainTransform(address1), balance1); - } - return balances; } module.exports = { + doublecounted: true, start: 1616679762, // (Mar-25-2021 01:42:42 PM +UTC) ethereum: { - tvl: tvlEthereum, + tvl: sdk.util.sumChainTvls([tvlLiquidityMining, tvlWrapper]), staking: staking( "0x26805021988f1a45dc708b5fb75fc75f21747d8c", "0x6bea7cfef803d1e3d5f7c0103f7ded065644e197", @@ -194,15 +150,33 @@ module.exports = { ), }, polygon: { - tvl: tvlPolygon, + tvl: tvlWrapper, + }, + polygon_zkevm: { + tvl: tvlWrapper, }, optimism: { - tvl: tvlOptimism, + tvl: tvlWrapper, }, arbitrum: { - tvl: tvlArbitrum, + tvl: tvlWrapper, + }, + bsc: { + tvl: tvlWrapper, + }, + moonbeam: { + tvl: tvlWrapper, }, celo: { - tvl: tvlCelo, + tvl: tvlWrapper, + }, + avax: { + tvl: tvlWrapper, + }, + fantom: { + tvl: tvlWrapper, + }, + mantle: { + tvl: tvlWrapper, }, }; diff --git a/projects/vitcswap/api.js b/projects/vitcswap/api.js new file mode 100644 index 00000000000..5b9feb1800f --- /dev/null +++ b/projects/vitcswap/api.js @@ -0,0 +1,15 @@ +const { get } = require('../helper/http') + +async function tvl() { + return { + tether: (await get('https://vite-api.thomiz.dev/tvl/vitcswap')).tvl + } +} + +module.exports = { + timetravel: false, + misrepresentedTokens: true, + vite:{ + tvl + }, +} \ No newline at end of file diff --git a/projects/vitcswap/index.js b/projects/vitcswap/index.js index 5b9feb1800f..3d38d833104 100644 --- a/projects/vitcswap/index.js +++ b/projects/vitcswap/index.js @@ -1,15 +1,6 @@ -const { get } = require('../helper/http') - -async function tvl() { - return { - tether: (await get('https://vite-api.thomiz.dev/tvl/vitcswap')).tvl - } -} +const { getExports } = require('../helper/heroku-api') module.exports = { timetravel: false, - misrepresentedTokens: true, - vite:{ - tvl - }, + ...getExports("vitcswap", ['vite']), } \ No newline at end of file diff --git a/projects/vivaleva/index.js b/projects/vivaleva/index.js new file mode 100644 index 00000000000..018dc603349 --- /dev/null +++ b/projects/vivaleva/index.js @@ -0,0 +1,87 @@ +const vaults = [ + { + symbol: "ibETH", + decimals: 18, + baseTokenAddress: "0x5aea5775959fbc2557cc8789bc1bf90a239d9a91", + address: "0x23FDd6487a17abB8360E8Da8b1B370C94ee94Cc2", + }, + { + symbol: "ibUSDC", + decimals: 6, + baseTokenAddress: "0x3355df6D4c9C3035724Fd0e3914dE96A5a83aaf4", + address: "0x0755DA5D9e9A722A9e5cc4bb83742387ae2990a5", + }, +]; +const syncswapWorkers = [ + { + name: "ETH-USDC Syncswap Farm", + address: "0x39356ed5dC2F7Ea897296e07E97b59Af9C8153Ec", + farmingTokenAddress: "0x5aea5775959fbc2557cc8789bc1bf90a239d9a91", + baseTokenAddress: "0x3355df6D4c9C3035724Fd0e3914dE96A5a83aaf4", + lpToken: "0x80115c708E12eDd42E504c1cD52Aea96C547c05c", + }, + { + name: "USDC-ETH Syncswap Farm", + address: "0x3A613EFAe4a6A6447A9D784E398730811a57af6e", + farmingTokenAddress: "0x3355df6D4c9C3035724Fd0e3914dE96A5a83aaf4", + baseTokenAddress: "0x5aea5775959fbc2557cc8789bc1bf90a239d9a91", + lpToken: "0x80115c708E12eDd42E504c1cD52Aea96C547c05c", + }, + { + name: "USDT-ETH Syncswap Farm", + address: "0x95C78e21Beb54314fe5A4571E7361f6c6A144B2f", + farmingTokenAddress: "0x493257fd37edb34451f62edf8d2a0c418852ba4c", + baseTokenAddress: "0x5aea5775959fbc2557cc8789bc1bf90a239d9a91", + lpToken: "0xd3D91634Cf4C04aD1B76cE2c06F7385A897F54D3", + }, + { + name: "USDT-USDC Syncswap Farm", + address: "0xfbF4BcD3266Af20B72dc484F6D7Dc13855885ba0", + farmingTokenAddress: "0x493257fd37edb34451f62edf8d2a0c418852ba4c", + baseTokenAddress: "0x3355df6D4c9C3035724Fd0e3914dE96A5a83aaf4", + lpToken: "0x0E595bfcAfb552F83E25d24e8a383F88c1Ab48A4", + }, +]; + +module.exports = { + timetravel: false, + misrepresentedTokens: true, + era: { + async tvl(_, _1, _2, { api }) { + const vaultBalances = await api.multiCall({ + abi: "uint256:vaultBalance", + calls: vaults.map((v) => v.address), + }); + + vaults.forEach((v, i) => { + api.add(v.baseTokenAddress, vaultBalances[i]); + }); + + const [ + syncswapWorkerBalances, + syncswapReserves, + syncswapLpTotalSupplies, + token0s, + token1s, + ] = await Promise.all([ + api.multiCall({ abi: "uint256:totalStakedLpBalance", calls: syncswapWorkers.map((v) => v.address), }), + api.multiCall({ abi: "function getReserves() view returns (uint256, uint256)", calls: syncswapWorkers.map((v) => v.lpToken), }), + api.multiCall({ abi: "uint256:totalSupply", calls: syncswapWorkers.map((v) => v.lpToken), }), + api.multiCall({ abi: "address:token0", calls: syncswapWorkers.map((v) => v.lpToken), }), + api.multiCall({ abi: "address:token1", calls: syncswapWorkers.map((v) => v.lpToken), }), + ]); + + syncswapWorkers.forEach((w, i) => { + const token0 = token0s[i] + const token1 = token1s[i] + const lpBalance = BigInt(syncswapWorkerBalances[i]) + const totalSupply = BigInt(syncswapLpTotalSupplies[i]) + const [r0, r1] = syncswapReserves[i].map(BigInt); + const underlying0 = String(lpBalance * r0 / totalSupply); + const underlying1 = String(lpBalance * r1 / totalSupply); + api.add(token0, underlying0); + api.add(token1, underlying1); + }); + }, + }, +}; diff --git a/projects/void/index.js b/projects/void/index.js new file mode 100644 index 00000000000..ec5904fe5f6 --- /dev/null +++ b/projects/void/index.js @@ -0,0 +1,10 @@ + +module.exports = { + fantom: { + tvl: () => 0, + staking: async (_, _1, _2, { api }) => { + const bal = await api.call({ abi: 'uint256:getTotalInvested', target: '0xe0d4ed2613f6c8737234d28d24b9c5d7f106bd28' }) + api.add('0x80F2B8CdbC470c4DB4452Cc7e4a62F5277Db7061', bal) + }, + } +} \ No newline at end of file diff --git a/projects/volmex/index.js b/projects/volmex/index.js index f664bd9e6b4..257e0d3063f 100644 --- a/projects/volmex/index.js +++ b/projects/volmex/index.js @@ -1,8 +1,9 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk') const {sumTokens} = require('../helper/unwrapLPs') -const dai = "0x6b175474e89094c44da98b954eedeac495271d0f" -const usdc = "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" +const dai = ADDRESSES.ethereum.DAI +const usdc = ADDRESSES.ethereum.USDC async function eth(timestamp, block) { const balances = {} await sumTokens(balances, [ @@ -14,8 +15,8 @@ async function eth(timestamp, block) { return balances } -const polygonDai = "0x8f3cf7ad23cd3cadbd9735aff958023239c6a063" -const polygonUsdc = "0x2791bca1f2de4661ed88a30c99a7a9449aa84174" +const polygonDai = ADDRESSES.polygon.DAI +const polygonUsdc = ADDRESSES.polygon.USDC async function polygon(timestamp, block, chainBlocks) { const balances = {} await sumTokens(balances, [ @@ -27,8 +28,8 @@ async function polygon(timestamp, block, chainBlocks) { return balances } -const arbitrumDai = "0xda10009cbd5d07dd0cecc66161fc93d7c9000da1" -const arbitrumUsdc = "0xff970a61a04b1ca14834a43f5de4533ebddb5cc8" +const arbitrumDai = ADDRESSES.optimism.DAI +const arbitrumUsdc = ADDRESSES.arbitrum.USDC async function arbitrum(timestamp, block, chainBlocks) { const balances = {} await sumTokens(balances, [ diff --git a/projects/volta-dao/api.js b/projects/volta-dao/api.js new file mode 100644 index 00000000000..f7b075a2e5f --- /dev/null +++ b/projects/volta-dao/api.js @@ -0,0 +1,12 @@ +const index = require('./index') + +module.exports = { + fantom: { + tvl: () => 0, + staking: index.fantom.staking, + }, + avax: { + tvl: () => 0, + staking: index.avax.staking, + }, +} \ No newline at end of file diff --git a/projects/volta-dao/index.js b/projects/volta-dao/index.js index 43c7b4bca93..07edfae28ea 100644 --- a/projects/volta-dao/index.js +++ b/projects/volta-dao/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { stakingUnknownPricedLP } = require("../helper/staking"); const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); const sdk = require("@defillama/sdk"); @@ -7,7 +8,7 @@ const ftmToken = "0x4c9993c7107495020c2ce9a13d11839f48ecd2e6"; const ftmStaking = "0xc6a54adddf7463f73a4c5a8e3e480bc798cf8a09"; const ftmTreasury = "0x05ab17e4dfa87ef4ac487ed20cfcc2ae75c2a792"; const ftmTokens = [ - ["0x8d11ec38a3eb5e956b052f67da8bdc9bef8abf3e", false], + [ADDRESSES.fantom.DAI, false], ["0x78b51a1fd7524186982c2cb8982df312b1e896a8", true] ]; @@ -15,7 +16,7 @@ const avaxToken = "0x4c9993c7107495020c2ce9a13d11839f48ecd2e6"; const avaxStaking = "0xfae672012b90cfb6bf245ac072a3aca374604b17"; const avaxTreasury = "0x05ab17e4dfa87ef4ac487ed20cfcc2ae75c2a792"; const avaxTokens = [ - ["0xd586e7f844cea2f87f50152665bcbc2c279d8d70", false], + [ADDRESSES.avax.DAI, false], ["0x26e7c9b2890440866d7d3f8f84b1ccaff443b9d8", true] ] @@ -41,8 +42,8 @@ async function tokenPrice(block, chain, lp, unlisted, listed) { async function ftmTvl (timestamp, block, chainBlocks) { let balances = {}; await sumTokensAndLPsSharedOwners(balances, ftmTokens, [ftmTreasury], chainBlocks.fantom, "fantom", addr=>`fantom:${addr}`); - const ratio = await tokenPrice(chainBlocks.fantom, "fantom", "0x78b51a1fd7524186982c2cb8982df312b1e896a8", ftmToken, "0x8d11ec38a3eb5e956b052f67da8bdc9bef8abf3e"); - sdk.util.sumSingleBalance(balances, "fantom:0x8d11ec38a3eb5e956b052f67da8bdc9bef8abf3e", BigNumber(balances["fantom:0x4c9993c7107495020c2ce9a13d11839f48ecd2e6"]).times(ratio).toFixed(0)); + const ratio = await tokenPrice(chainBlocks.fantom, "fantom", "0x78b51a1fd7524186982c2cb8982df312b1e896a8", ftmToken, ADDRESSES.fantom.DAI); + sdk.util.sumSingleBalance(balances, "fantom:" + ADDRESSES.fantom.DAI, BigNumber(balances["fantom:0x4c9993c7107495020c2ce9a13d11839f48ecd2e6"]).times(ratio).toFixed(0)); delete balances["fantom:0x4c9993c7107495020c2ce9a13d11839f48ecd2e6"]; return balances; } @@ -50,8 +51,8 @@ async function ftmTvl (timestamp, block, chainBlocks) { async function avaxTvl (timestamp, block, chainBlocks) { let balances = {}; await sumTokensAndLPsSharedOwners(balances, avaxTokens, [avaxTreasury], chainBlocks.avax, "avax", addr=>`avax:${addr}`); - const ratio = await tokenPrice(chainBlocks.avax,"avax", "0x26e7c9b2890440866d7d3f8f84b1ccaff443b9d8", avaxToken, "0xd586e7f844cea2f87f50152665bcbc2c279d8d70"); - sdk.util.sumSingleBalance(balances, "avax:0xd586e7f844cea2f87f50152665bcbc2c279d8d70", BigNumber(balances["avax:0x4c9993c7107495020c2ce9a13d11839f48ecd2e6"]).times(ratio).toFixed(0)); + const ratio = await tokenPrice(chainBlocks.avax,"avax", "0x26e7c9b2890440866d7d3f8f84b1ccaff443b9d8", avaxToken, ADDRESSES.avax.DAI); + sdk.util.sumSingleBalance(balances, "avax:" + ADDRESSES.avax.DAI, BigNumber(balances["avax:0x4c9993c7107495020c2ce9a13d11839f48ecd2e6"]).times(ratio).toFixed(0)); delete balances["avax:0x4c9993c7107495020c2ce9a13d11839f48ecd2e6"]; return balances; } diff --git a/projects/volta-finance/index.js b/projects/volta-finance/index.js new file mode 100644 index 00000000000..24aff5ca3b4 --- /dev/null +++ b/projects/volta-finance/index.js @@ -0,0 +1,22 @@ +const { sumTokens2 } = require('../helper/unwrapLPs') +const vaults = [ + '0xb4ff7E61F825A5B80E20F6070fCC959Ea136Ed88' +] + +const erc4626 = [ + '0x39ff5098081FBE1ab241c31Fe0a9974FE9891d04', // voltGNS +] + +async function tvl(_, _1, _2, { api }) { + const collaterals = await api.multiCall({ abi: 'address:collateral', calls: vaults}) + const assets = await api.multiCall({ abi: 'address:asset', calls: erc4626}) + const bals = await api.multiCall({ abi: 'uint256:totalAssets', calls: erc4626}) + api.addTokens(assets, bals) + return sumTokens2({ api, tokensAndOwners2: [collaterals, vaults]}) +} + +module.exports = { + doublecounted: true, + methodology: "counts the tokens used as collateral in vaults for VOLT stablecoin loans", + arbitrum: { tvl, } +}; \ No newline at end of file diff --git a/projects/voltz/index.js b/projects/voltz/index.js index 1054ea1c8fc..afbc7607e4f 100644 --- a/projects/voltz/index.js +++ b/projects/voltz/index.js @@ -1,32 +1,38 @@ -const sdk = require('@defillama/sdk'); -const ethers = require("ethers"); const { sumTokens2 } = require('../helper/unwrapLPs') +const { getLogs } = require('../helper/cache/getLogs') -async function getTokensAndOwners(block) { - const Factory = '0x6a7a5c3824508D03F0d2d24E0482Bea39E08CcAF' - const { output: logs } = await sdk.api.util.getLogs({ - keys: [], - toBlock: block, - target: Factory, - fromBlock: 14878442, +async function getTokensAndOwners(api) { + const { factory, fromBlock } = config[api.chain] + const logs = await getLogs({ + api, + target: factory, + fromBlock, + onlyArgs: true, topic: 'IrsInstance(address,address,uint256,uint256,int24,address,address,address,uint8,uint8)', + eventAbi: 'event IrsInstance (address indexed underlyingToken, address indexed rateOracle, uint256 termStartTimestampWad, uint256 termEndTimestampWad, int24 tickSpacing, address marginEngine, address vamm, address fcm, uint8 yieldBearingProtocolID, uint8 underlyingTokenDecimals)', }) - let iface = new ethers.utils.Interface(['event IrsInstance (address indexed underlyingToken, address indexed rateOracle, uint256 termStartTimestampWad, uint256 termEndTimestampWad, int24 tickSpacing, address marginEngine, address vamm, address fcm, uint8 yieldBearingProtocolID, uint8 underlyingTokenDecimals)']) - return logs.map((log) => iface.parseLog(log).args).map(i => ([i[0], i[5]])) + return logs.map(i => ([i.underlyingToken, i.marginEngine])) } -async function tvl(_, block) { - return sumTokens2({ - tokensAndOwners: await getTokensAndOwners(block), - block, - }); +async function tvl(_, block, _1, { api }) { + return sumTokens2({ api, tokensAndOwners: await getTokensAndOwners(api), }) } module.exports = { - ethereum: { - tvl, - }, methodology: `It takes the list of all the Margin Engines deployed by the Voltz Factory and aggregates their token holdings. These token holdings represent the margin that supports liquidity provider and trader positions in Voltz interest rate swap pools.`, -}; \ No newline at end of file +}; + +const config = { + ethereum: { factory: '0x6a7a5c3824508D03F0d2d24E0482Bea39E08CcAF', fromBlock: 14878442 }, + arbitrum: { factory: '0xda66a7584da7210fd26726EFb12585734F7688c1', fromBlock: 60246384 }, + avax: { factory: '0xda66a7584da7210fd26726EFb12585734F7688c1', fromBlock: 30096058 }, +} + +module.exports = { +}; + +Object.keys(config).forEach(chain => { + module.exports[chain] = { tvl } +}) \ No newline at end of file diff --git a/projects/voodoo-trade/index.js b/projects/voodoo-trade/index.js new file mode 100644 index 00000000000..241542fd87f --- /dev/null +++ b/projects/voodoo-trade/index.js @@ -0,0 +1,13 @@ +const { gmxExports } = require("../helper/gmx"); +const { pool2 } = require("../helper/pool2"); + +const vault = "0x40cbDDAED8b0d7Ee3cF347aAb09Bf4a8cFa15F01"; +const lpToken = "0xC42437A6da389D88799A9e706da3EA6628342295"; +const stakedLpTokenTracker = "0xBf47b011C36F29e7C65b6cf34c1d838EA1b67069"; + +module.exports = { + fantom: { + tvl: gmxExports({ vault }), + pool2: pool2(stakedLpTokenTracker, lpToken,), + }, +}; \ No newline at end of file diff --git a/projects/vortex/http.js b/projects/vortex/http.js deleted file mode 100644 index 7f14ed634ff..00000000000 --- a/projects/vortex/http.js +++ /dev/null @@ -1,23 +0,0 @@ -const axios = require("axios"); - -module.exports = (baseURL, options = {}) => { - const defaultOptions = { - baseURL, - }; - - const opts = Object.assign({}, defaultOptions, options); - - const http = axios.create(opts); - - http.interceptors.response.use((response) => { - const { data } = response; - - if (typeof data === "object" && !Array.isArray(data) && data !== null) { - if ("data" in data) return data.data.data; - } - - return data; - }); - - return http; -}; diff --git a/projects/vortex/index.js b/projects/vortex/index.js index 1cb747647fe..bcd4d59b93c 100644 --- a/projects/vortex/index.js +++ b/projects/vortex/index.js @@ -1,29 +1,16 @@ -const host = 'https://api.vortex.network/v1/graphql' -const { sumTokens2, } = require('../helper/chain/tezos') -const { GraphQLClient, gql } = require('graphql-request') -const half_hour = 30 * 60 -const half_day = 12 * 60 * 60 - -async function tvl(ts) { - var graphQLClient = new GraphQLClient(host) - - var query = gql` - query tvl_per_pool($start: bigint = "", $end: bigint = "") { data: pair { id pairDayData (order_by: {date: desc}, where: {date: {_gte: $start, _lte: $end}}) { tvl: reserveUsd timestamp: date } } } - `; - - var { data } = await graphQLClient.request(query, { start: ts - half_day, end: ts + half_hour }) - const accounts = data.map(i => i.id) - return sumTokens2({ owners: accounts, includeTezos: true, }) -} +const { sumTokens2, getStorage, getBigMapById, } = require('../helper/chain/tezos') async function staking() { return sumTokens2({ owners: ['KT1Cp18EbxDk2WcbC1YVUyGuwuvtzyujwu4U']}) } - module.exports = { tezos: { - tvl, + tvl: async () => { + const data = await getStorage('KT1UnRsTyHVGADQWDgvENL3e9i6RMnTVfmia') + const swaps = await getBigMapById(data.swaps); + return sumTokens2({ owners: Object.values(swaps), includeTezos: true, }) + }, staking, - }, -}; + } +} diff --git a/projects/vortex/queries.js b/projects/vortex/queries.js deleted file mode 100644 index 5874a0b9168..00000000000 --- a/projects/vortex/queries.js +++ /dev/null @@ -1,74 +0,0 @@ -module.exports = { - getTotalFarmsTvl: () => ({ - query: ` - query total_farm_rewards_tvl { - data: smartlinkDayDataAggregate { - aggregate { - sum { - total: farmsTvl - } - } - } - } - `, - }), - getFarmsTvl: () => ({ - query: ` - query farms_tvl { - data: farm { - address: id - totalStaked: totalLpStake - liquidity { - totalSupply - pairs { - reserve0 - } - } - } - } - `, - }), - getFarmsV2Tvl: () => ({ - query: ` - query farms_v2_tvl { - data: farmV2(where: {liquidity: {id: {_is_null: false}, pairs: {id: {_is_null: false}}}}) { - address - totalStaked: totalInputStake - liquidity { - totalSupply - pairs { - reserve0 - } - } - } - } - `, - }), - tvlPerPool: (start, end) => ({ - query: ` - query tvl_per_pool($start: bigint = "", $end: bigint = "") { - data: pair { - id - pairDayData (order_by: {date: desc}, where: {date: {_gte: $start, _lte: $end}}) { - tvl: reserveUsd - timestamp: date - } - } - } - `, - variables: { start, end }, - }), - getTotalStakingTvl: () => ({ - query: ` - query total_staking_tvl { - data: smartlinkDayDataAggregate { - aggregate { - sum { - total: stakeTvl - } - } - } - } - `, - }), -}; diff --git a/projects/vortex/vortex.api.js b/projects/vortex/vortex.api.js deleted file mode 100644 index 323d674d199..00000000000 --- a/projects/vortex/vortex.api.js +++ /dev/null @@ -1,43 +0,0 @@ -const http = require("./http"); -const queries = require("./queries"); -const baseUrl = "https://api.smartlink.so/v1"; - -const endpoint = "graphql"; -const api = http(baseUrl); - -function formatDate(unixTimestamp) { - const timestamp = unixTimestamp ? unixTimestamp * 1000 : Date.now() - return new Date(timestamp).toISOString().slice(0, 10) -} - -const getTotalStakingTvl = async () => { - const response = await api.post(endpoint, { - ...queries.getTotalStakingTvl(), - }); - - return response.aggregate.sum.total || 0; -}; - -const getDexTvl = async () => { - const today = Math.floor(Date.now() / 1000); - const start = today - 1 * 24 * 3600; // from one day ago - const todayStr = formatDate(today) - let tvl = 0 - - const poolsTvl = await api.post(endpoint, { - ...queries.tvlPerPool(start, today), - }); - - poolsTvl.forEach(pool => { - const todayTvl = pool.pairDayData.find(i => formatDate(i.timestamp) === todayStr) - if (todayTvl) - tvl += todayTvl.tvl - }) - - return tvl; -}; - -module.exports = { - getTotalStakingTvl, - getDexTvl, -}; diff --git a/projects/votium/index.js b/projects/votium/index.js deleted file mode 100644 index 41cb7b55bd3..00000000000 --- a/projects/votium/index.js +++ /dev/null @@ -1,34 +0,0 @@ -const sdk = require("@defillama/sdk"); -const utils = require("../helper/utils"); -const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); - -const multiMerkleStashContracts = "0x378Ba9B73309bE80BF4C2c027aAD799766a7ED5A"; -const votiumBribeContract = "0x19BBC3463Dd8d07f55438014b021Fb457EBD4595"; - -const API_URL = - "https://raw.githubusercontent.com/oo-00/Votium/main/utils/voteCalculator/tokens.json"; - -async function ethTvl() { - const balances = {}; - - const tokenAddresses = (await utils.fetchURL(API_URL)).data.map( - (addr) => addr.value - ); - - for (const token of tokenAddresses) { - await sumTokensAndLPsSharedOwners( - balances, - [[token, false]], - [multiMerkleStashContracts, votiumBribeContract], - ); - } - - return balances; -} - -module.exports = { - ethereum: { - tvl: ethTvl, - }, - methodology: "Counts tvl of Tokens used for Delegating on Convex Snapshot through MultiMerkleStash Contract", -}; diff --git a/projects/vovo/index.js b/projects/vovo/index.js index ac0d7b01c35..4dca1c51e7c 100644 --- a/projects/vovo/index.js +++ b/projects/vovo/index.js @@ -1,39 +1,9 @@ const sdk = require("@defillama/sdk"); const chain = "arbitrum"; -const balanceABI = { - inputs: [ - { - internalType: "bool", - name: "isMax", - type: "bool", - }, - ], - name: "balance", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", -}; +const balanceABI = 'function balance(bool isMax) view returns (uint256)'; -const getGlpPriceABI = { - inputs: [], - name: "getGlpPrice", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", -}; +const getGlpPriceABI = "uint256:getGlpPrice"; const usdcVaults = [ "0x9ba57a1D3f6C61Ff500f598F16b97007EB02E346", diff --git a/projects/vultureswap/index.js b/projects/vultureswap/index.js index 502671c9da6..2c03cf2dd46 100644 --- a/projects/vultureswap/index.js +++ b/projects/vultureswap/index.js @@ -1,15 +1,10 @@ -const {calculateUniTvl} = require("../helper/calculateUniTvl") +const { uniTvlExport } = require("../helper/calculateUniTvl") -const vultr = "0x8A07A7C25CF225Ed06d5e5Ad253C96D824B588D0"; -const masterchef = "0x4AEC2311b365CB5a8434dAAcb205c299d561f82a"; const factory = "0x45523BD2aB7E563E3a0F286be1F766e77546d579"; -async function tvl (timestamp, block, chainBlocks) { - return calculateUniTvl(addr=>`cronos:${addr}`, chainBlocks.cronos, "cronos", factory, 0, true); -} module.exports = { cronos: { - tvl + tvl: uniTvlExport(factory, 'cronos', true) } } \ No newline at end of file diff --git a/projects/vvs-finance/index.js b/projects/vvs-finance/index.js index 7abc0334da3..74b04fc0b7b 100644 --- a/projects/vvs-finance/index.js +++ b/projects/vvs-finance/index.js @@ -5,7 +5,6 @@ module.exports={ methodology: "Factory address (0x3b44b2a187a7b3824131f8db5a74194d0a42fc15) is used to find the LP pairs. TVL is equal to the liquidity on the AMM.", cronos: { tvl: getUniTVL({ - chain: 'cronos', factory: '0x3b44b2a187a7b3824131f8db5a74194d0a42fc15', useDefaultCoreAssets: true, }) diff --git a/projects/vyfi-dex/index.js b/projects/vyfi-dex/index.js new file mode 100644 index 00000000000..b2b638d69e4 --- /dev/null +++ b/projects/vyfi-dex/index.js @@ -0,0 +1,24 @@ +const { toUSDTBalances } = require("../helper/balances"); +const { fetchURL } = require("../helper/utils"); + + +async function getLPData() { + const tvl = await fetchURL("https://api.vyfi.io/analytics"); + + return {cardano:tvl.data.lp.totalLpTvl}; +} + +async function vyfiStaking() { + const tvl = await fetchURL("https://api.vyfi.io/analytics?filter=bar"); + + return {cardano:tvl.data.bar.tvl}; +} + +module.exports = { + misrepresentedTokens: true, + timetravel: false, + cardano: { + tvl:getLPData, + staking: vyfiStaking + }, +}; \ No newline at end of file diff --git a/projects/vyfi/index.js b/projects/vyfi/index.js index b29eab7199c..b09183c250d 100644 --- a/projects/vyfi/index.js +++ b/projects/vyfi/index.js @@ -1,20 +1,47 @@ const { toUSDTBalances } = require("../helper/balances"); const { fetchURL } = require("../helper/utils"); +async function getStakingData() { + const data = await fetchURL("https://api.vyfi.io/analytics"); + + let tvl = 0; -async function staking(){ - const tvl = await fetchURL("https://4tnn0ogfdi.execute-api.us-east-1.amazonaws.com/prod/analytics") - if(tvl.data.tokenVaults.totalValueLocked<=0){ - throw new Error("vyfi tvl is below 0") + // Include the total value locked in nftVaults and nftVaultsV2 and lpVaults + tvl += data.data.nftVaults.totalValueLocked; + tvl += data.data.nftVaultsV2.totalValueLocked; + tvl += data.data.lpVaultsV2.totalValueLocked; + + for (const vault of data.data.tokenVaults.vaults.concat(data.data.tokenVaultsV2.vaults)) { + if (vault.project !== 'vyfi') { + tvl += vault.totalVaultValue; } - return toUSDTBalances(tvl.data.tokenVaults.totalValueLocked) + } + + return toUSDTBalances(tvl); } -module.exports={ - misrepresentedTokens: true, - timetravel: false, - cardano:{ - tvl: ()=>({}), - staking + +async function getVYFIVaultsData() { + const data = await fetchURL("https://api.vyfi.io/analytics"); + + let tvl = 0; + for (const vault of data.data.tokenVaults.vaults.concat(data.data.tokenVaultsV2.vaults)) { + if (vault.project === 'vyfi') { + tvl += vault.totalVaultValue; } -} \ No newline at end of file + } + + return toUSDTBalances(tvl); +} + + + + +module.exports = { + misrepresentedTokens: true, + timetravel: false, + cardano: { + tvl: getStakingData, + staking: getVYFIVaultsData + }, +}; diff --git a/projects/w3swap/index.js b/projects/w3swap/index.js index 349e4a76be7..39bfb8281f3 100644 --- a/projects/w3swap/index.js +++ b/projects/w3swap/index.js @@ -5,7 +5,6 @@ module.exports = { bsc: { tvl: getUniTVL({ factory: '0xD04A80baeeF12fD7b1D1ee6b1f8ad354f81bc4d7', - chain: 'bsc', useDefaultCoreAssets: true }) }, diff --git a/projects/wagmi-com/index.js b/projects/wagmi-com/index.js new file mode 100644 index 00000000000..3a6fa572d74 --- /dev/null +++ b/projects/wagmi-com/index.js @@ -0,0 +1,6 @@ +const { uniV3Export } = require("../helper/uniswapV3"); + +module.exports = uniV3Export({ + era: { factory: '0x31be61CE896e8770B21e7A1CAFA28402Dd701995', fromBlock: 1351075, }, + fantom: { factory: '0xaf20f5f19698f1D19351028cd7103B63D30DE7d7', fromBlock: 60063058, }, +}) \ No newline at end of file diff --git a/projects/wagmidao/abi.json b/projects/wagmidao/abi.json index 4ac2ce0f330..dfb64a6b42b 100644 --- a/projects/wagmidao/abi.json +++ b/projects/wagmidao/abi.json @@ -1,47 +1,5 @@ { - "principal": { - "stateMutability": "view", - "type": "function", - "name": "principal", - "inputs": [], - "outputs": [ - { - "name": "", - "internalType": "address", - "type": "address" - } - ], - "constant": true, - "signature": "0xba5d3078" - }, - "totalPrincipalReceived": { - "stateMutability": "view", - "inputs": [], - "outputs": [ - { - "type": "uint256", - "internalType": "uint256", - "name": "" - } - ], - "type": "function", - "name": "totalPrincipalReceived", - "constant": true, - "signature": "0xb1c7a664" - }, - "balanceOf": { - "type": "function", - "name": "balanceOf", - "inputs": [], - "stateMutability": "view", - "outputs": [ - { - "name": "", - "type": "uint256", - "internalType": "uint256" - } - ], - "constant": true, - "signature": "0x722713f7" - } + "principal": "address:principal", + "totalPrincipalReceived": "uint256:totalPrincipalReceived", + "balanceOf": "uint256:balanceOf" } \ No newline at end of file diff --git a/projects/wagmidao/index.js b/projects/wagmidao/index.js index 5d34c7bc61a..2c0bf2849cb 100644 --- a/projects/wagmidao/index.js +++ b/projects/wagmidao/index.js @@ -1,10 +1,9 @@ const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); -const { calculateUniTvl } = require("../helper/calculateUniTvl"); +const { uniTvlExport } = require("../helper/calculateUniTvl"); const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); const { getFixBalancesSync, - getChainTransform, } = require("../helper/portedTokens"); const factory = "0xfe33b03a49a1fcd095a8434dd625c2d2735e84b8"; @@ -25,7 +24,6 @@ const bondContracts = [ ]; const GMI = "0x8750f5651af49950b5419928fecefca7c82141e3"; -const FAM = "0x53cba17b4159461a8f9bc0ed5785654370549b7d"; const Treasury = async (timesamp, ethBlock, chainBlocks) => { const balances = {}; @@ -105,27 +103,10 @@ const Staking = async (chainBlocks) => { return balances; }; -async function harmonyTvl(timestamp, _ethBlock, {harmony: block}) { - let transformAddress = await getChainTransform('harmony'); - const balances = await calculateUniTvl( - transformAddress, - block, - "harmony", - factory, - 0, - true - ); - - getFixBalancesSync('harmony')(balances); - - return balances; -} - module.exports = { - timetravel: true, harmony: { staking: Staking, - tvl: sdk.util.sumChainTvls([harmonyTvl, Treasury]), + tvl: sdk.util.sumChainTvls([uniTvlExport(factory, 'harmony', true),]), }, methodology: "Counts liquidity on the Farms through Factory Contract, and counts Treasury as it is determined by bonding of assets. Staking refers to the staked GMI tokens", }; diff --git a/projects/wagyuswap/index.js b/projects/wagyuswap/index.js index 37f12ea337d..fc91b7d2dcc 100644 --- a/projects/wagyuswap/index.js +++ b/projects/wagyuswap/index.js @@ -4,7 +4,7 @@ module.exports = { misrepresentedTokens: true, velas: { tvl: getUniTVL({ - factory: '0x69f3212344a38b35844cce4864c2af9c717f35e3', chain: 'velas', useDefaultCoreAssets: true, + factory: '0x69f3212344a38b35844cce4864c2af9c717f35e3', useDefaultCoreAssets: true, blacklist: ['0xcd7509b76281223f5b7d3ad5d47f8d7aa5c2b9bf'], }) }, diff --git a/projects/wardenswap/index.js b/projects/wardenswap/index.js index 478b68f9974..32557f48fb0 100644 --- a/projects/wardenswap/index.js +++ b/projects/wardenswap/index.js @@ -7,7 +7,6 @@ module.exports = { methodology: "TVL is calculated from total liquidity of WardenSwap's active pools listed on our farm page https://farm.wardenswap.finance/?t=1&s=1/#/farm, excluding pools at PancakeSwap and inactive pools are not included, plus total warden staked in Warden pool", bsc:{ tvl: getUniTVL({ - chain: 'bsc', factory: '0x3657952d7bA5A0A4799809b5B6fdfF9ec5B46293', useDefaultCoreAssets: true, }), diff --git a/projects/warp/index.js b/projects/warp/index.js index 2ea1842d6d7..3be4c1a74d8 100644 --- a/projects/warp/index.js +++ b/projects/warp/index.js @@ -1,34 +1,29 @@ -const sdk = require('@defillama/sdk') -const { sumTokensAndLPsSharedOwners } = require('../helper/unwrapLPs') +const { sumTokens2, } = require('../helper/unwrapLPs') +const { getLogs } = require('../helper/cache/getLogs') -function isLP(symbol){ - return symbol.includes('LP') || symbol === "UNI-V2" -} - -async function tvl(_timestamp, block){ - const balances = {} - for(const group of tokenHolderMap){ - const holders = await sdk.api.util.getLogs({ - ...group.holders.logConfig, - keys: [], - toBlock: block - }).then(logs=>logs.output.map((poolLog) => `0x${poolLog.data.substr(26, 40)}`)) - const tokens = await sdk.api.abi.multiCall({ - calls: holders.map(h=>({target: h})), - block, - abi: group.tokens.abi +async function tvl(_timestamp, block, _1, { api }) { + const owners = [] + const tokens = [] + for (const group of tokenHolderMap) { + let holders = await getLogs({ + ...group.logConfig, + api, + }).then(logs => logs.map((poolLog) => `0x${poolLog.data.substr(26, 40)}`)) + const _tokens = await api.multiCall({ abi: 'address:LPtoken', calls: holders, permitFailure: true, }) + const failedHolders = holders.filter((holder, i) => { + if (_tokens[i]) { + owners.push(holder) + tokens.push(_tokens[i]) + return false + } + return true }) - const symbols = (await sdk.api.abi.multiCall({ - calls: tokens.output.map(t=>({target: t.output})), - block, - abi: 'erc20:symbol' - })).output - await sumTokensAndLPsSharedOwners(balances, - tokens.output.map((t, i)=>[t.output, isLP(symbols[i].output)]), - holders, block - ) + + const _tokens2 = await api.multiCall({ abi: 'address:stablecoin', calls: failedHolders }) + owners.push(...failedHolders) + tokens.push(..._tokens2) } - return balances + return sumTokens2({ api, tokensAndOwners2: [tokens, owners], }) } module.exports = { @@ -38,111 +33,31 @@ module.exports = { const tokenHolderMap = [ { - holders: { - pullFromLogs: true, - logConfig: { - target: "0x6C74E2A1074ABe18969Be37210B93e681A40b35A", - topic: "NewLPVault(address)", - fromBlock: 11803584, - }, - transform: (poolLog) => `0x${poolLog.substr(26, 40)}`, - }, - tokens: { - pullFromPools: true, - abi: { - inputs: [], - name: "LPtoken", - outputs: [ - { - internalType: "contract IUniswapV2ERC20", - name: "", - type: "address", - }, - ], - stateMutability: "view", - type: "function", - }, + logConfig: { + target: "0x6C74E2A1074ABe18969Be37210B93e681A40b35A", + topic: "NewLPVault(address)", + fromBlock: 11803584, }, }, { - holders: { - pullFromLogs: true, - logConfig: { - target: "0x6C74E2A1074ABe18969Be37210B93e681A40b35A", - topic: "NewSCVault(address,address)", - fromBlock: 11803584, - }, - transform: (poolLog) => `0x${poolLog.substr(26, 40)}`, - }, - tokens: { - pullFromPools: true, - abi: { - inputs: [], - name: "stablecoin", - outputs: [ - { - internalType: "contract ERC20", - name: "", - type: "address", - }, - ], - stateMutability: "view", - type: "function", - }, + logConfig: { + target: "0x6C74E2A1074ABe18969Be37210B93e681A40b35A", + topic: "NewSCVault(address,address)", + fromBlock: 11803584, }, }, { - holders: { - pullFromLogs: true, - logConfig: { - target: "0x8E0Fa7c5C7Fa86A059e865A90b50a90351df716a", - topic: "NewLPVault(address)", - fromBlock: 11654924, - }, - transform: (poolLog) => `0x${poolLog.substr(26, 40)}`, - }, - tokens: { - pullFromPools: true, - abi: { - inputs: [], - name: "LPtoken", - outputs: [ - { - internalType: "contract IUniswapV2ERC20", - name: "", - type: "address", - }, - ], - stateMutability: "view", - type: "function", - }, + logConfig: { + target: "0x8E0Fa7c5C7Fa86A059e865A90b50a90351df716a", + topic: "NewLPVault(address)", + fromBlock: 11654924, }, }, { - holders: { - pullFromLogs: true, - logConfig: { - target: "0x8E0Fa7c5C7Fa86A059e865A90b50a90351df716a", - topic: "NewSCVault(address,address)", - fromBlock: 11654924, - }, - transform: (poolLog) => `0x${poolLog.substr(26, 40)}`, - }, - tokens: { - pullFromPools: true, - abi: { - inputs: [], - name: "stablecoin", - outputs: [ - { - internalType: "contract ERC20", - name: "", - type: "address", - }, - ], - stateMutability: "view", - type: "function", - }, + logConfig: { + target: "0x8E0Fa7c5C7Fa86A059e865A90b50a90351df716a", + topic: "NewSCVault(address,address)", + fromBlock: 11654924, }, }, ] diff --git a/projects/warpbond/index.js b/projects/warpbond/index.js index efa604cbba0..8622bba30e9 100644 --- a/projects/warpbond/index.js +++ b/projects/warpbond/index.js @@ -1,10 +1,11 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { ohmTvl } = require("../helper/ohm"); const token = "0x3F46a70adB395cddb81FF9bFE3B62aDae1B44816"; const stakingContract = "0xA828eB4565819d3A134930CffbFD17f3bEE61F6a"; const treasury = "0x64a999BF3405f53074Fe5F89aCB09B5E9b35F5d7"; const treasuryTokens = [ - ["0x8f3cf7ad23cd3cadbd9735aff958023239c6a063", false], // DAI + [ADDRESSES.polygon.DAI, false], // DAI ["0xa3fa99a148fa48d14ed51d610c367c61876997f1", false], // miMATIC ["0x2c9aed5b029dfd6b83c1214e528a276f41b8b527", true] // WARP-DAI SLP ] diff --git a/projects/wasabi/index.js b/projects/wasabi/index.js new file mode 100644 index 00000000000..44cc6d902e4 --- /dev/null +++ b/projects/wasabi/index.js @@ -0,0 +1,21 @@ +const { getLogs } = require('../helper/cache/getLogs') +const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') + +async function tvl(_, _b, _cb, { api, }) { + const logs = await getLogs({ + api, + target: '0x8e2b50413a53f50e2a059142a9be060294961e40', + topics: ['0xd02da1bec30f7f750aa0a131745dfb9ce96767c45a192dc26409f5d690e0b967'], + eventAbi: 'event NewPool(address poolAddress, address indexed nftAddress, address indexed owner)', + onlyArgs: true, + fromBlock: 17082136, + }) + const ownerTokens = logs.map(i => [[i.nftAddress, nullAddress], i.poolAddress]) + return sumTokens2({ api, ownerTokens, }) +} + +module.exports = { + ethereum: { + tvl + } +} \ No newline at end of file diff --git a/projects/wasabix/abi.json b/projects/wasabix/abi.json index e288b7d98f0..eb1ac6ea3e7 100644 --- a/projects/wasabix/abi.json +++ b/projects/wasabix/abi.json @@ -1,82 +1,5 @@ { - "getPoolTotalDeposited": { - "constant": true, - "inputs": [ - { - "internalType": "uint256", - "name": "_poolId", - "type": "uint256" - } - ], - "name": "getPoolTotalDeposited", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "totalDeposited": { - "constant": true, - "inputs":[], - "name":"totalDeposited", - "outputs":[{"internalType":"uint256","name":"","type":"uint256"}], - "payable": false, - "stateMutability":"view", - "type":"function" - }, - "poolInfo": { - "constant": true, - "inputs":[{"internalType":"uint256","name":"","type":"uint256"}], - "name":"poolInfo", - "outputs": [{ - "internalType": "contract IERC20", - "name": "lpToken", - "type": "address" - }, { - "internalType": "uint256", - "name": "allocPoint", - "type": "uint256" - }, { - "internalType": "uint256", - "name": "lastRewardBlock", - "type": "uint256" - }, { - "internalType": "uint256", - "name": "accRewardPerShare", - "type": "uint256" - }, { - "internalType": "uint256", - "name": "workingSupply", - "type": "uint256" - }, { - "internalType": "uint256", - "name": "totalDeposited", - "type": "uint256" - }, { - "internalType": "bool", - "name": "needVesting", - "type": "bool" - }, { - "internalType": "uint256", - "name": "earlyWithdrawFee", - "type": "uint256" - }, { - "internalType": "uint256", - "name": "withdrawLock", - "type": "uint256" - }, { - "internalType": "bool", - "name": "veBoostEnabled", - "type": "bool" - }], - "payable": false, - "stateMutability":"view", - "type":"function" - } -} - \ No newline at end of file + "getPoolTotalDeposited": "function getPoolTotalDeposited(uint256 _poolId) view returns (uint256)", + "totalDeposited": "uint256:totalDeposited", + "poolInfo": "function poolInfo(uint256) view returns (address lpToken, uint256 allocPoint, uint256 lastRewardBlock, uint256 accRewardPerShare, uint256 workingSupply, uint256 totalDeposited, bool needVesting, uint256 earlyWithdrawFee, uint256 withdrawLock, bool veBoostEnabled)" +} \ No newline at end of file diff --git a/projects/wasabix/index.js b/projects/wasabix/index.js index d24f8161f50..0d8ec1e772a 100644 --- a/projects/wasabix/index.js +++ b/projects/wasabix/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); const { sumTokens } = require("../helper/unwrapLPs") @@ -7,7 +8,7 @@ const { pool2s } = require('../helper/pool2') const tokens = { dai: { token:'DAI', - address:'0x6b175474e89094c44da98b954eedeac495271d0f', + address:ADDRESSES.ethereum.DAI, decimals:18, correspondingMintableToken: 'waUSD' }, @@ -19,13 +20,13 @@ const tokens = { }, wbtc: { token:'wBTC', - address:'0x2260fac5e5542a773aa44fbcfedf7c193bc2c599', + address:ADDRESSES.ethereum.WBTC, decimals:8, correspondingMintableToken: 'waBTC' }, lusd: { token:'LUSD', - address:'0x5f98805a4e8be255a32880fdec7f6728c6568ba0', + address:ADDRESSES.ethereum.LUSD, decimals:18, correspondingMintableToken: 'waLUSD' }, @@ -48,7 +49,7 @@ const tokens = { }, weth: { token:'WETH', - address:'0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', + address:ADDRESSES.ethereum.WETH, decimals:18, correspondingMintableToken: 'waETH' }, @@ -65,7 +66,7 @@ const tokens = { }, usdc: { token: 'usdc', - address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', + address: ADDRESSES.ethereum.USDC, decimals: 6 } } @@ -221,7 +222,7 @@ const tokensPolygon = { }, usdc: { token: 'USDC', - address: '0x2791bca1f2de4661ed88a30c99a7a9449aa84174', + address: ADDRESSES.polygon.USDC, decimals: 6, }, pusd: { @@ -335,7 +336,7 @@ const tokensBSC = { }, wbnb: { token:'WBNB', - address:'0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c', + address:ADDRESSES.bsc.WBNB, decimals:18, correspondingMintableToken: 'waBNB' }, @@ -347,7 +348,7 @@ const tokensBSC = { }, busd: { token: 'BUSD', - address: '0xe9e7cea3dedca5984780bafc599bd69add087d56', + address: ADDRESSES.bsc.BUSD, decimals: 18, correspondingMintableToken: 'waBUSD' } @@ -371,7 +372,7 @@ const collectorsBSC = [ }, ] -const busd = 'bsc:0xe9e7cea3dedca5984780bafc599bd69add087d56' +const busd = 'bsc:' + ADDRESSES.bsc.BUSD async function bsc(timestamp, block, chainBlocks) { let balances = {}; @@ -453,8 +454,6 @@ async function polygon(timestamp, block, chainBlocks) { // sdk.util.sumSingleBalance(balances, _.find(vaultCalls, {target: poolAddr}).token, totalDeposited); } - // console.log('vaultTvl', vaultTvl) - //collectors for(let collector of collectorsPolygon) { diff --git a/projects/waterdendy/index.js b/projects/waterdendy/index.js new file mode 100644 index 00000000000..53e80602fb4 --- /dev/null +++ b/projects/waterdendy/index.js @@ -0,0 +1,5 @@ +const { masterchefExports } = require('../helper/unknownTokens') + +const STAKING_CONTRACT_ARBITRUM = "0xD0834fF6122FF8dcf38E3eB79372C00FAeAFa08B"; //MASTERCHEF ARBITRUM + +module.exports = masterchefExports({ chain: 'arbitrum', masterchef: STAKING_CONTRACT_ARBITRUM, nativeToken: '0x88692aD37c48e8F4c821b71484AE3C2878C2A2C6', useDefaultCoreAssets: true, }) \ No newline at end of file diff --git a/projects/waterfallbsc/index.js b/projects/waterfallbsc/index.js index e5be9f666f4..b1b1d213fae 100644 --- a/projects/waterfallbsc/index.js +++ b/projects/waterfallbsc/index.js @@ -1,8 +1,14 @@ const {masterChefExports} = require("../helper/masterchef"); +//const arbitrumExports = require("../waterfall-arbitrum"); const token = "0xFdf36F38F5aD1346B7f5E4098797cf8CAE8176D0"; const masterchef = "0x49a21E7Ae826CD5F0c0Cb1dC942d1deD66d21191"; +const chef = "0xe9960f14B5f0713D1d530C1fF079A7adAb7c076D" +const waterfall = "0xedBF59b40336244c6ea94A11a6B0cF6864c87E83" +const waterfallWethLP = "0x29519bcfd1d702363e9Ad63dBd2331C3C7f4A9f7" +const waterfallUsdcLP = "0x18B60b6b6a14D7C33D5086fA84871d519136C064"; module.exports = { - ...masterChefExports(masterchef, "bsc", token, false) + ...masterChefExports(masterchef, "bsc", token, false), + ...masterChefExports( chef, "arbitrum", waterfall, false), } // node test.js projects/waterfallbsc/index.js \ No newline at end of file diff --git a/projects/waterfalldefi/abi.json b/projects/waterfalldefi/abi.json index 894e1088a84..0cd4655f2a9 100644 --- a/projects/waterfalldefi/abi.json +++ b/projects/waterfalldefi/abi.json @@ -1,98 +1,5 @@ { - "tranchesAuto": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "tranches", - "outputs": [ - { - "internalType": "uint256", - "name": "target", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "principal", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "autoPrincipal", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "validPercent", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "apy", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "fee", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "autoValid", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "tranchesNonAuto": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "tranches", - "outputs": [ - { - "internalType": "uint256", - "name": "target", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "principal", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "apy", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "fee", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "cycleActive": { - "inputs": [], - "name": "active", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - } + "tranchesAuto": "function tranches(uint256) view returns (uint256 target, uint256 principal, uint256 autoPrincipal, uint256 validPercent, uint256 apy, uint256 fee, uint256 autoValid)", + "tranchesNonAuto": "function tranches(uint256) view returns (uint256 target, uint256 principal, uint256 apy, uint256 fee)", + "cycleActive": "bool:active" } \ No newline at end of file diff --git a/projects/waterfalldefi/index.js b/projects/waterfalldefi/index.js index 1da3e51a6cc..e4f68b7560c 100644 --- a/projects/waterfalldefi/index.js +++ b/projects/waterfalldefi/index.js @@ -1,22 +1,21 @@ const sdk = require('@defillama/sdk') const BN = require('bignumber.js'); const abi = require("./abi.json"); -const { transformBscAddress, transformAvaxAddress, getChainTransform } = require('../helper/portedTokens'); -const axios = require("axios"); const url = "https://raw.githubusercontent.com/WaterfallDefi/product-addresses/master/main.json"; let _response -const { sumTokens2 } = require('../helper/unwrapLPs') +const { sumTokens2 } = require('../helper/unwrapLPs'); +const { getConfig } = require('../helper/cache'); async function getAddresses(url) { - if (!_response) _response = axios.get(url) + if (!_response) _response = getConfig('waterfalldefi', url) let res = await _response; - return res.data; + return res; } const addressTransform = { - bsc: transformBscAddress, - avax: transformAvaxAddress + bsc: addr => 'bsc:'+addr, + avax: addr => 'avax:'+addr } async function bscStaking(timestamp, block, chainBlocks) { @@ -47,7 +46,7 @@ async function avaxTVL(timestamp, block, chainBlocks) { } async function calcInactiveTrancheBalances(balances, product, chain, block) { - const transform = await addressTransform[chain](); + const transform = addressTransform[chain]; let calls = []; for (const currency of product.currency) { calls.push({ diff --git a/projects/waterloan/index.js b/projects/waterloan/index.js index 678564d2b0f..5208580da9a 100644 --- a/projects/waterloan/index.js +++ b/projects/waterloan/index.js @@ -1,15 +1,16 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { getV2Reserves, getTvl, getBorrowed } = require("../helper/aave"); const addressesProviderRegistry = { "csc": "0x9D15cf1a8ebF191A0df57fA0362ba535F371883b", "smartbch": "0xF7d79dC3A3e78745abEbE5A0e8d4735F02A854B9" } -const USDT = "0x398dcA951cD4fc18264d995DCD171aa5dEbDa129"; +const USDT = ADDRESSES.csc.USDT; const USDC = "0xF335B2440e62A953a42865aDf7bD73F4C6671A7b"; -const FLEXUSD = "0x7b2B3C5308ab5b2a1d9a94d20D35CCDf61e05b72"; +const FLEXUSD = ADDRESSES.smartbch.flexUSD; const EBEN = "0x77CB87b57F54667978Eb1B199b28a0db8C8E1c0B"; -const WBCH = "0x3743eC0673453E5009310C727Ba4eaF7b3a1cc04"; +const WBCH = ADDRESSES.smartbch.WBCH; const MIST = "0x5fA664f69c2A4A3ec94FaC3cBf7049BD9CA73129"; function waterloan(chain, borrowed) { @@ -42,14 +43,14 @@ function waterloan(chain, borrowed) { } const erc20Map = { - "0xE6f8988d30614afE4F7124b76477Add79c665822": + [ADDRESSES.csc.WCET]: "0x081f67afa0ccf8c7b17540767bbe95df2ba8d97f", // CET "0x1D7C98750A47762FA8B45c6E3744aC6704F44698": "0x2731d151CBDf84A8A4C6d9D0BaE74012Db51E428", // IFT - "0x398dcA951cD4fc18264d995DCD171aa5dEbDa129": - "0xdac17f958d2ee523a2206206994597c13d831ec7", // USDT + [ADDRESSES.csc.USDT]: + ADDRESSES.ethereum.USDT, // USDT "0xF335B2440e62A953a42865aDf7bD73F4C6671A7b": - "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", // USDC + ADDRESSES.ethereum.USDC, // USDC "0x9F4165009e93b7f5BA61A477ad08Cd3D1aD8aa36": "0x0b342c51d1592c41068d5d4b4da4a68c0a04d5a4", // ONES diff --git a/projects/wavelength/index.js b/projects/wavelength/index.js index f4cb7021541..7bfbb0d19cf 100644 --- a/projects/wavelength/index.js +++ b/projects/wavelength/index.js @@ -1,4 +1,6 @@ +const { onChainTvl } = require('../helper/balancer') + const { graphQuery } = require('../helper/http') const endpoint = 'https://teste.testeborabora.cyou/graphql' @@ -8,12 +10,13 @@ let _response async function fetch() { if (!_response) _response = graphQuery(endpoint, query) const response = await _response - return +response.embrGetProtocolData.totalLiquidity + return { tether: +response.embrGetProtocolData.totalLiquidity } } module.exports = { + misrepresentedTokens: true, velas:{ - fetch + // tvl: onChainTvl('0xa4a48dfcae6490afe9c779bf0f324b48683e488c', 56062385) + tvl: fetch, }, - fetch } \ No newline at end of file diff --git a/projects/waves-exchange/index.js b/projects/waves-exchange/index.js index 1d7cce86135..754db289339 100644 --- a/projects/waves-exchange/index.js +++ b/projects/waves-exchange/index.js @@ -1,29 +1,24 @@ -const { sumSingleBalance } = require('@defillama/sdk/build/generalUtil') -const { get } = require('../helper/http') -const { fixBalancesTokens: { waves: wavesMapping } } = require('../helper/tokenMapping') +const { get } = require("../helper/http"); +const { toUSDTBalances } = require("../helper/balances"); +const endpoint = + "https://mainnet-dev.wvservices.exchange/api/v1/investments/tvl"; -const endpoint = "https://waves.exchange/api/v1/liquidity_pools/stats" - -async function tvl() { - const balances = {} - const data = (await get(endpoint)).items - data.forEach(item => { - sumSingleBalance(balances, getTokenId(item.amount_asset_id), +item.amount_asset_balance) - sumSingleBalance(balances, getTokenId(item.price_asset_id), +item.price_asset_balance) - }) - - return balances -} - -function getTokenId(token) { - if (wavesMapping[token]) return wavesMapping[token].coingeckoId - return token +function tvl(isStaking) { + return async () => + toUSDTBalances( + (await get(endpoint)).products + .filter(p => p.product_id == "wx_staking" == isStaking) + .map(p => p.tvl) + .reduce((p, c) => Number(p) + Number(c), 0), + ); } module.exports = { - timetravel: false, - waves: { - tvl - }, -} \ No newline at end of file + misrepresentedTokens: true, + timetravel: false, + waves: { + tvl: tvl(false), + staking: tvl(true), + }, +}; diff --git a/projects/weave/index.js b/projects/weave/index.js new file mode 100644 index 00000000000..2412fc89137 --- /dev/null +++ b/projects/weave/index.js @@ -0,0 +1,24 @@ +const ADDRESSES = require('../helper/coreAssets.json') + +const WKAVA = ADDRESSES.kava.WKAVA; +const STRATEGY_CONTRACT = '0x9633a42E4f73F465DD421b22C09E2787493DaAdA' + +async function tvl(_, _1, _2, { api }) { + const strategyBalance = await api.call({ + abi: 'erc20:balanceOf', + target: WKAVA, + params: [STRATEGY_CONTRACT], + }); + + api.add(WKAVA, strategyBalance) +} + +module.exports = { + timetravel: true, + misrepresentedTokens: false, + methodology: 'gets the balance of the strategy contract', + start: 5793963, + kava: { + tvl, + } +}; \ No newline at end of file diff --git a/projects/weldfinance/index.js b/projects/weldfinance/index.js index 65068204514..92063288183 100644 --- a/projects/weldfinance/index.js +++ b/projects/weldfinance/index.js @@ -1,8 +1,57 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { masterchefExports, } = require("../helper/unknownTokens") +const sdk = require('@defillama/sdk') + +async function verifyTvl() { + let [ + usdkSupply, + briseSupply, + ] = await sdk.api2.abi.multiCall({ + abi: 'erc20:totalSupply', chain: 'kava', + calls: [ADDRESSES.kava.USDk, ADDRESSES.kava.kBRISE,] + }) + usdkSupply /= 1e18 + briseSupply /= 1e18 + + const fireBlockAccount = '0x07B8F3e3D3fCf5b6D8cf1a49B92047008EE991E8' + const fireBlockHotAccount = '0x5e14128aC1192B31F2f9026D7130F446D0546D9c' + + const bals = await sdk.api2.abi.multiCall({ + abi: 'erc20:balanceOf', + calls: [ + { target: ADDRESSES.ethereum.USDC, params: fireBlockAccount }, + { target: ADDRESSES.ethereum.USDT, params: fireBlockAccount }, + ], + }) + + const balsPoly = await sdk.api2.abi.multiCall({ + abi: 'erc20:balanceOf', + chain: 'polygon', + calls: [ + { target: ADDRESSES.polygon.USDC, params: fireBlockAccount }, + { target: ADDRESSES.polygon.USDT, params: fireBlockAccount }, + ], + }) + + const res = await sdk.api.eth.getBalances({ targets: [fireBlockAccount, fireBlockHotAccount], chain: 'bitgert', }) + let { output: briseBacking2 } = await sdk.api.erc20.balanceOf({ target: '0x8FFf93E810a2eDaaFc326eDEE51071DA9d398E83', owner: fireBlockHotAccount, chain: 'bsc', }) + const briseBacking = res.output.reduce((a, i) => (a + +i.balance/1e18), 0) + briseBacking2 /= 1e9 + const backing = [...bals, ...balsPoly].reduce((a, i) => a + i / 1e6, 0) + + sdk.log('usdk supply: ', usdkSupply, 'usdk backing: ', backing, 'diff', backing - usdkSupply) + sdk.log('BRISE supply: ', briseSupply, 'BRISE backing: ', (+briseBacking + +briseBacking2) , 'diff', (+briseBacking + +briseBacking2) - briseSupply) + + if (usdkSupply > backing) throw new Error('USDk supply is higher than backing') + if ((briseSupply > (+briseBacking + +briseBacking2))) throw new Error('BRISE supply is higher than backing') + return {} +} module.exports = masterchefExports({ chain: 'kava', useDefaultCoreAssets: true, masterchef: '0xAbF3edbDf79dAfBBd9AaDBe2efEC078E557762D7', - nativeToken: '0xa0EEDa2e3075092d66384fe8c91A1Da4bcA21788' -}) \ No newline at end of file + nativeToken: ADDRESSES.kava.KFT +}) + +module.exports.kava.tvl = sdk.util.sumChainTvls([module.exports.kava.tvl, verifyTvl]) \ No newline at end of file diff --git a/projects/welnance/index.js b/projects/welnance/index.js index 30180898bee..6766cf201bb 100644 --- a/projects/welnance/index.js +++ b/projects/welnance/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { compoundExports } = require("../helper/compound"); const comptroller = "0xdc21c1dAF3277f07fFA6EB09fCD3E07EDc36DC0A"; @@ -9,7 +10,7 @@ module.exports = { ...compoundExports( comptroller, "bsc", "0x38e22c429e62530cbB59B90bF14a71346C727752", - "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c" + ADDRESSES.bsc.WBNB ), }, methodology: diff --git a/projects/wemix-fi/index.js b/projects/wemix-fi/index.js new file mode 100644 index 00000000000..b81e72be37f --- /dev/null +++ b/projects/wemix-fi/index.js @@ -0,0 +1,3 @@ +const { uniTvlExport } = require('../helper/unknownTokens') + +module.exports = uniTvlExport('wemix', '0xe1F36C7B919c9f893E2Cd30b471434Aa2494664A') \ No newline at end of file diff --git a/projects/wemix-lend/index.js b/projects/wemix-lend/index.js new file mode 100644 index 00000000000..94298ddd35a --- /dev/null +++ b/projects/wemix-lend/index.js @@ -0,0 +1,10 @@ +const {compoundExports} = require('../helper/compound'); +const { nullAddress } = require('../helper/tokenMapping'); + +const compound = "0x929620a759a564e3C273e8a4efCDa5806da168F2"; +const cETH = "0x34b9B18fDBE2aBC6DfB41A7f6d39B5E511ce3e23"; +const chain = "wemix"; + +module.exports = { + wemix: compoundExports(compound, chain, cETH, nullAddress), +}; \ No newline at end of file diff --git a/projects/wemix-staking/index.js b/projects/wemix-staking/index.js new file mode 100644 index 00000000000..e8ed83adc89 --- /dev/null +++ b/projects/wemix-staking/index.js @@ -0,0 +1,11 @@ +const ADDRESSES = require("../helper/coreAssets.json"); +const { staking } = require("../helper/staking"); + +const wwemix = ADDRESSES.wemix.WWEMIX; +const stakingContract = "0x6F3f44B0Cf7C751f2a44Faf6bFdd08e499Eb0973"; + +module.exports = { + wemix: { + tvl: staking(stakingContract, wwemix), + }, +}; diff --git a/projects/westater/index.js b/projects/westater/index.js index b81e9297d09..7af5102ff5f 100644 --- a/projects/westater/index.js +++ b/projects/westater/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { unwrapUniswapLPs } = require('../helper/unwrapLPs'); const BigNumber = require("bignumber.js"); @@ -35,7 +36,7 @@ const farms = [ ] function transform(tokenAddress){ - if(tokenAddress === "0x5545153ccfca01fbd7dd11c0b23ba694d9509a6f"){ + if(tokenAddress === ADDRESSES.heco.WHT){ return "0x6f259637dcd74c767781e37bc6133cd6a68aa161" } else { return `heco:${tokenAddress}` diff --git a/projects/westater/index.json b/projects/westater/index.json index 5f2446bb41f..7e8058d689a 100644 --- a/projects/westater/index.json +++ b/projects/westater/index.json @@ -1,15 +1,3 @@ { - "totalSupply": { - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } + "totalSupply": "uint256:totalSupply" } \ No newline at end of file diff --git a/projects/whalegame/index.js b/projects/whalegame/index.js new file mode 100644 index 00000000000..e3922dded61 --- /dev/null +++ b/projects/whalegame/index.js @@ -0,0 +1,26 @@ + +const ADDRESSES = require("../helper/coreAssets.json"); + +const GAME_CONTRACT_ADDRESS = "0xF1baf16Db25405856f5379246Beba2B694e1449D"; + +async function tvl(_, _1, _2, { api }) { + const whaleTokenAddress = await api.call({ abi: abi.whaleToken, target: GAME_CONTRACT_ADDRESS, }); + const owners = [GAME_CONTRACT_ADDRESS, whaleTokenAddress] + + owners.push(...await api.fetchList({ itemAbi: abi.vestingContractforRound, lengthAbi: abi.round, target: GAME_CONTRACT_ADDRESS, })) + return api.sumTokens({ tokens: [ADDRESSES.null], owners, blacklistedOwners: [ADDRESSES.null] }) +} + +module.exports = { + methodology: + "Counts the amount of ETH in the Game Pot, WHALE Rewards Contract and unclaimed ETH in vesting contracts", + ethereum: { + tvl, + }, +}; + +const abi = { + "vestingContractforRound": "function vestingContractForRound(uint256) view returns (address)", + "round": "uint256:round", + "whaleToken": "address:whaleToken" +} \ No newline at end of file diff --git a/projects/whaleloans/index.js b/projects/whaleloans/index.js index 55733256f1b..4812fe0571e 100644 --- a/projects/whaleloans/index.js +++ b/projects/whaleloans/index.js @@ -1,18 +1,3 @@ -// const { ohmTvl } = require('../helper/ohm') - -// const treasury = "0x39914b5b0687882659d74b7a82e07Ca3acBf9a8c" -// module.exports = ohmTvl(treasury, [ -// //WBNB -// ["0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c", false], -// //BUSD -// ["0xe9e7cea3dedca5984780bafc599bd69add087d56", false], -// //USDC -// ["0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d", false], -// //PancakeLP -// ["0x63D9DEf04dcBf82870f46f50db5C1eFeCcb1Cd63", true], -// ], "bsc", "0x5132e14a2673DA61581364d792E90B926F10bC8e", "0xfAAec9f866Fa7f34a2c31c2B11D1723Ad4a46446", undefined, undefined, true) - - // NOTE: treasury is emptied, token is worthless, adapter is left alone for historical data module.exports = { bsc: { diff --git a/projects/whaleswap/index.js b/projects/whaleswap/index.js index 11f3a6e882d..a7ae009ecbd 100644 --- a/projects/whaleswap/index.js +++ b/projects/whaleswap/index.js @@ -4,12 +4,10 @@ const pod = '0xdded222297b3d08dafdac8f65eeb799b2674c78f' module.exports = { bsc: { tvl: getUniTVL({ - chain: 'bsc', factory: '0xabc26f8364cc0dd728ac5c23fa40886fda3dd121', useDefaultCoreAssets: true, }), staking: staking( { - chain: 'bsc', owners: ["0xdEe627eaaB378ec57ECfB94b389B718ef3687c0D", "0xdc8715aCFB63cd0BD01a2C3e7De514845FdbcDF7"], tokens: [pod], useDefaultCoreAssets: true, @@ -18,16 +16,68 @@ module.exports = { }, fantom: { tvl: getUniTVL({ - chain: 'fantom', factory: '0xabc26f8364cc0dd728ac5c23fa40886fda3dd121', useDefaultCoreAssets: true, }), staking: staking( { - chain: 'fantom', owners: ["0xdEe627eaaB378ec57ECfB94b389B718ef3687c0D", "0xdc8715aCFB63cd0BD01a2C3e7De514845FdbcDF7"], tokens: [pod], useDefaultCoreAssets: true, lps: ['0x48eD248c981d6a97Ba84e21Dd02685951423f59B'] }) }, + arbitrum: { + tvl: getUniTVL({ + factory: '0xabc26f8364cc0dd728ac5c23fa40886fda3dd121', + useDefaultCoreAssets: true, + }), + staking: staking( { + owners: ["0xdEe627eaaB378ec57ECfB94b389B718ef3687c0D", "0xdc8715aCFB63cd0BD01a2C3e7De514845FdbcDF7"], + tokens: [pod], + useDefaultCoreAssets: true, + lps: ['0x70348dAEB1cC0DD873481690823552590b71873A'] + }) + }, + optimism: { + tvl: getUniTVL({ + factory: '0xabc26f8364cc0dd728ac5c23fa40886fda3dd121', + useDefaultCoreAssets: true, + }), + staking: staking( { + owners: ["0xdEe627eaaB378ec57ECfB94b389B718ef3687c0D", "0xdc8715aCFB63cd0BD01a2C3e7De514845FdbcDF7"], + tokens: [pod], + useDefaultCoreAssets: true, + lps: ['0xD6E83C3b484F9bd4755e1AD7Bc1a401f6e63e176'] + }) + }, + avax: { + tvl: getUniTVL({ + factory: '0xabc26f8364cc0dd728ac5c23fa40886fda3dd121', + useDefaultCoreAssets: true, + }), + staking: staking( { + owners: ["0xdEe627eaaB378ec57ECfB94b389B718ef3687c0D", "0xdc8715aCFB63cd0BD01a2C3e7De514845FdbcDF7"], + tokens: [pod], + useDefaultCoreAssets: true, + lps: ['0xA81c921479baD1980e6e47267EeE949a987AB29e'] + }) + }, + polygon: { + tvl: getUniTVL({ + factory: '0xabc26f8364cc0dd728ac5c23fa40886fda3dd121', + useDefaultCoreAssets: true, + }), + staking: staking( { + owners: ["0xdEe627eaaB378ec57ECfB94b389B718ef3687c0D", "0xdc8715aCFB63cd0BD01a2C3e7De514845FdbcDF7"], + tokens: [pod], + useDefaultCoreAssets: true, + lps: ['0x12B880dBDB3e7f49f30644D78e4119fDA510BDfF'] + }) + }, + kava: { + tvl: getUniTVL({ + factory: '0xabc26f8364cc0dd728ac5c23fa40886fda3dd121', + useDefaultCoreAssets: true, + }) + }, } diff --git a/projects/wheat.js b/projects/wheat.js deleted file mode 100644 index da3caf11b52..00000000000 --- a/projects/wheat.js +++ /dev/null @@ -1,15 +0,0 @@ -const utils = require('./helper/utils'); - -/* * * * * * * * -* ==> Correct adapter needs to be created. -* -*****************/ -async function fetch() { - var tvl = await utils.fetchURL('https://api.growthdefi.com/tvl/wheat-tvl') - return tvl.data.TVL; -} - -module.exports = { - fetch, - methodology: `TVL for Wheat Protocol is achieved by making calls to their API: https://api.growthdefi.com/tvl/wheat-tvl` -} diff --git a/projects/whiteheart/index.js b/projects/whiteheart/index.js index 54c398a7b4f..e9b818adb84 100644 --- a/projects/whiteheart/index.js +++ b/projects/whiteheart/index.js @@ -1,11 +1,12 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const whbtc = "0xf19c3FAFB0171484d2301Af1838cB5C6Ea739dC4" const wheth = "0x33827D2d2a0f4533AC26083E6eaAe71D417cbBA0" const writeUSDC = "0xda0606037834f4279Dc590434231F1E01C468629" -const weth = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2" -const wbtc = "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599" -const usdc = "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" +const weth = ADDRESSES.ethereum.WETH +const wbtc = ADDRESSES.ethereum.WBTC +const usdc = ADDRESSES.ethereum.USDC async function tvl(_timestamp, ethBlock) { const balances = {}; diff --git a/projects/whitehole-finance/index.js b/projects/whitehole-finance/index.js new file mode 100644 index 00000000000..c255bb56ad8 --- /dev/null +++ b/projects/whitehole-finance/index.js @@ -0,0 +1,5 @@ +const { compoundExports2 } = require("../helper/compound"); + +module.exports = { + arbitrum: compoundExports2({ comptroller: '0x1d019f2d14bdb81bab7ba4ec7e20868e669c32b1', abis: { getAllMarkets: 'address[]:allMarkets', totalBorrows: 'uint256:totalBorrow' } }), +}; diff --git a/projects/whitewhale-dex/index.js b/projects/whitewhale-dex/index.js new file mode 100644 index 00000000000..60ad7f57955 --- /dev/null +++ b/projects/whitewhale-dex/index.js @@ -0,0 +1,24 @@ +const { getFactoryTvl } = require('../terraswap/factoryTvl') + +const factory = { + terra2: "terra1f4cr4sr5eulp3f2us8unu6qv8a5rhjltqsg7ujjx6f2mrlqh923sljwhn3", + juno: "juno14m9rd2trjytvxvu4ldmqvru50ffxsafs8kequmfky7jh97uyqrxqs5xrnx", + injective: "inj1x22q8lfhz7qcvtzs0dakhgx2th64l79kfye5lk", + comdex: "comdex1gurgpv8savnfw66lckwzn4zk7fp394lpe667dhu7aw48u40lj6jswv4mft", + chihuahua: "chihuahua1s8ehad3r9wxyk08ls2nmz8mqh4vlfmaxd2nw0crxwh04t4l5je4s8ljv0j", +} + +module.exports = { + timetravel: false, + misrepresentedTokens: true, + methodology: "Liquidity on the DEX", + hallmarks: [ + [1651881600, "UST depeg"], + ] +} + + +Object.keys(factory).forEach(chain => { + const contract = factory[chain] + module.exports[chain] = { tvl: getFactoryTvl(contract) } +}) \ No newline at end of file diff --git a/projects/whitewhale/index.js b/projects/whitewhale/index.js index c53f0be50c7..8fce410596f 100644 --- a/projects/whitewhale/index.js +++ b/projects/whitewhale/index.js @@ -1,38 +1,11 @@ -const { fetchURL } = require('../helper/utils') -const { toUSDTBalances } = require('../helper/balances'); - -const vaults = [ - "https://lcd.terra.dev/wasm/contracts/terra1ec3r2esp9cqekqqvn0wd6nwrjslnwxm7fh8egy/store?query_msg=%7B%22pool_state%22:%7B%7D%7D" -] +const { sumTokens } = require('../helper/chain/cosmos') async function tvl() { - let pool_state = {} - let tvl = {} - await Promise.all(vaults.map(async vault => { - pool_state = await fetchURL(vault) - tvl = Number(pool_state.data.result.total_value_in_ust) / 1e6 - })) - // console.log(Number(pool_state.data.result.total_value_in_ust) / 1e6) - return { - terrausd: tvl - } -} - -async function staking() { - const staked = await fetchURL( - `https://lcd.terra.dev/wasm/contracts/terra12897djskt9rge8dtmm86w654g7kzckkd698608/store?query_msg=%7B%22balance%22:%7B%22address%22:%22terra1xrk6v2tfjrhjz2dsfecj40ps7ayanjx970gy0j%22%7D%7D` - ) - // console.log(Number(staked.data.result.balance) / 1e6) - return { - "white-whale": Number(staked.data.result.balance) / 1e6 - } + return sumTokens({chain: 'terra', owner: 'terra1ec3r2esp9cqekqqvn0wd6nwrjslnwxm7fh8egy'}) } module.exports = { - timetravel: false, - misrepresentedTokens: true, terra: { - staking, tvl }, hallmarks:[ diff --git a/projects/wigoswap/index.js b/projects/wigoswap/index.js index ee64a6899fa..36f4d5b22e3 100644 --- a/projects/wigoswap/index.js +++ b/projects/wigoswap/index.js @@ -1,21 +1,10 @@ const sdk = require('@defillama/sdk') -const {calculateUniTvl} = require('../helper/calculateUniTvl.js') -//const {transformFantomAddress} = require('../helper/portedTokens.js'); +const {uniTvlExport} = require('../helper/calculateUniTvl.js') const factory = '0xC831A5cBfb4aC2Da5ed5B194385DFD9bF5bFcBa7' const wigoToken = '0xE992bEAb6659BFF447893641A378FbbF031C5bD6' const masterFarmer = '0xA1a938855735C0651A6CfE2E93a32A28A236d0E9' -async function tvl(_timestamp, _ethBlock, chainBlocks){ - // const transform = await transformFantomAddress(); - - const balances = await calculateUniTvl(addr=>{ - addr = addr.toLowerCase(); - return `fantom:${addr}`; - }, chainBlocks['fantom'], 'fantom', factory, 28898932, true); - return balances -} - async function staking(_timestamp, _ethBlock, chainBlocks) { const balances = {} const stakedWigo = sdk.api.erc20.balanceOf({ @@ -30,11 +19,9 @@ async function staking(_timestamp, _ethBlock, chainBlocks) { } module.exports = { - timetravel: true, - misrepresentedTokens: true, methodology: 'The factory address (0xC831A5cBfb4aC2Da5ed5B194385DFD9bF5bFcBa7) is used find the pairs and sum the liquidity of the AMM. Staking accounts for the WIGO locked in MasterFarmer (0xA1a938855735C0651A6CfE2E93a32A28A236d0E9).', fantom: { staking, - tvl + tvl: uniTvlExport(factory, 'fantom', true) }, } \ No newline at end of file diff --git a/projects/wildcredit/abi.json b/projects/wildcredit/abi.json index db503743718..3fc08ca225f 100644 --- a/projects/wildcredit/abi.json +++ b/projects/wildcredit/abi.json @@ -1,185 +1,13 @@ { - "factory": { - "inputs": [], - "name": "factory", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "tokenA": { - "inputs": [], - "name": "tokenA", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "tokenB": { - "inputs": [], - "name": "tokenB", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "totalDebt": { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "totalDebt", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "totalSupplyAmount": { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "totalSupplyAmount", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "totalDebtAmount": { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "totalDebtAmount", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "balanceOf": { - "inputs": [ - { "internalType": "address", "name": "owner", "type": "address" } - ], - "name": "balanceOf", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - "tokenOfOwnerByIndex": { - "inputs": [ - { "internalType": "address", "name": "owner", "type": "address" }, - { "internalType": "uint256", "name": "index", "type": "uint256" } - ], - "name": "tokenOfOwnerByIndex", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - "getPool": { - "inputs": [ - { "internalType": "address", "name": "", "type": "address" }, - { "internalType": "address", "name": "", "type": "address" }, - { "internalType": "uint24", "name": "", "type": "uint24" } - ], - "name": "getPool", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - "slot0": { - "inputs": [], - "name": "slot0", - "outputs": [ - { "internalType": "uint160", "name": "sqrtPriceX96", "type": "uint160" }, - { "internalType": "int24", "name": "tick", "type": "int24" }, - { - "internalType": "uint16", - "name": "observationIndex", - "type": "uint16" - }, - { - "internalType": "uint16", - "name": "observationCardinality", - "type": "uint16" - }, - { - "internalType": "uint16", - "name": "observationCardinalityNext", - "type": "uint16" - }, - { "internalType": "uint8", "name": "feeProtocol", "type": "uint8" }, - { "internalType": "bool", "name": "unlocked", "type": "bool" } - ], - "stateMutability": "view", - "type": "function" - }, - "positions": { - "inputs": [ - { "internalType": "uint256", "name": "tokenId", "type": "uint256" } - ], - "name": "positions", - "outputs": [ - { "internalType": "uint96", "name": "nonce", "type": "uint96" }, - { "internalType": "address", "name": "operator", "type": "address" }, - { "internalType": "address", "name": "token0", "type": "address" }, - { "internalType": "address", "name": "token1", "type": "address" }, - { "internalType": "uint24", "name": "fee", "type": "uint24" }, - { "internalType": "int24", "name": "tickLower", "type": "int24" }, - { "internalType": "int24", "name": "tickUpper", "type": "int24" }, - { "internalType": "uint128", "name": "liquidity", "type": "uint128" }, - { - "internalType": "uint256", - "name": "feeGrowthInside0LastX128", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "feeGrowthInside1LastX128", - "type": "uint256" - }, - { "internalType": "uint128", "name": "tokensOwed0", "type": "uint128" }, - { "internalType": "uint128", "name": "tokensOwed1", "type": "uint128" } - ], - "stateMutability": "view", - "type": "function" - } -} + "factory": "address:factory", + "tokenA": "address:tokenA", + "tokenB": "address:tokenB", + "totalDebt": "function totalDebt(address) view returns (uint256)", + "totalSupplyAmount": "function totalSupplyAmount(address) view returns (uint256)", + "totalDebtAmount": "function totalDebtAmount(address) view returns (uint256)", + "balanceOf": "function balanceOf(address owner) view returns (uint256)", + "tokenOfOwnerByIndex": "function tokenOfOwnerByIndex(address owner, uint256 index) view returns (uint256)", + "getPool": "function getPool(address, address, uint24) view returns (address)", + "slot0": "function slot0() view returns (uint160 sqrtPriceX96, int24 tick, uint16 observationIndex, uint16 observationCardinality, uint16 observationCardinalityNext, uint8 feeProtocol, bool unlocked)", + "positions": "function positions(uint256 tokenId) view returns (uint96 nonce, address operator, address token0, address token1, uint24 fee, int24 tickLower, int24 tickUpper, uint128 liquidity, uint256 feeGrowthInside0LastX128, uint256 feeGrowthInside1LastX128, uint128 tokensOwed0, uint128 tokensOwed1)" +} \ No newline at end of file diff --git a/projects/wildcredit/abis.json b/projects/wildcredit/abis.json index 97a78acaf16..5b8cf77a16f 100644 --- a/projects/wildcredit/abis.json +++ b/projects/wildcredit/abis.json @@ -1,232 +1,12 @@ -[ - { - "inputs": [ - { - "internalType": "address", - "name": "_lendingPairMaster", - "type": "address" - }, - { - "internalType": "address", - "name": "_lpTokenMaster", - "type": "address" - }, - { - "internalType": "contract IController", - "name": "_controller", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipTransferConfirmed", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipTransferInitiated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "pair", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "tokenA", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "tokenB", - "type": "address" - } - ], - "name": "PairCreated", - "type": "event" - }, - { - "inputs": [], - "name": "acceptOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "controller", - "outputs": [ - { - "internalType": "contract IController", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_tokenA", - "type": "address" - }, - { - "internalType": "address", - "name": "_tokenB", - "type": "address" - } - ], - "name": "createPair", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "isOwner", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "lendingPairMaster", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "lpTokenMaster", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "pairByTokens", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "pendingOwner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } -] \ No newline at end of file +{ + "acceptOwnership": "function acceptOwnership()", + "controller": "address:controller", + "createPair": "function createPair(address _tokenA, address _tokenB) returns (address)", + "isOwner": "bool:isOwner", + "lendingPairMaster": "address:lendingPairMaster", + "lpTokenMaster": "address:lpTokenMaster", + "owner": "address:owner", + "pairByTokens": "function pairByTokens(address, address) view returns (address)", + "pendingOwner": "address:pendingOwner", + "transferOwnership": "function transferOwnership(address _newOwner)" +} \ No newline at end of file diff --git a/projects/wildcredit/index.js b/projects/wildcredit/index.js index 0b1f7d6c8c4..f80994d3c8d 100644 --- a/projects/wildcredit/index.js +++ b/projects/wildcredit/index.js @@ -2,6 +2,7 @@ const sdk = require("@defillama/sdk"); const { default: BigNumber } = require("bignumber.js"); const abi = require("./abi.json"); const { unwrapUniswapV3NFTs } = require('../helper/unwrapLPs') +const { getLogs } = require('../helper/cache/getLogs') BigNumber.config({ EXPONENTIAL_AT: 100 }) @@ -28,39 +29,31 @@ const calculateTokenTotal = async (balances, block, pairs, abi) => { } } -const getPairsMapping = {} - -const getPairs = async (toBlock) => { - if (!getPairsMapping[toBlock]) getPairsMapping[toBlock] = _getPairs() - return getPairsMapping[toBlock] - - async function _getPairs() { - const logs = (await sdk.api.util.getLogs({ - target: PAIR_FACTORY, - topic: 'PairCreated(address,address,address)', - keys: [], - fromBlock: START_BLOCK, - toBlock, - })).output - - return logs.map(log => { - return { - pair: `0x${log.topics[1].substr(-40).toLowerCase()}`, - tokenA: `0x${log.topics[2].substr(-40).toLowerCase()}`, - tokenB: `0x${log.topics[3].substr(-40).toLowerCase()}` - } - }) - } +const getPairs = async (api) => { + const logs = (await getLogs({ + target: PAIR_FACTORY, + topic: 'PairCreated(address,address,address)', + fromBlock: START_BLOCK, + api, + })) + + return logs.map(log => { + return { + pair: `0x${log.topics[1].substr(-40).toLowerCase()}`, + tokenA: `0x${log.topics[2].substr(-40).toLowerCase()}`, + tokenB: `0x${log.topics[3].substr(-40).toLowerCase()}` + } + }) } -const ethTvl = async (timestamp, ethBlock, chainBlocks) => { +const ethTvl = async (timestamp, ethBlock, chainBlocks, { api }) => { const balances = {}; - const pairs = await getPairs(ethBlock) + const pairs = await getPairs(api) await calculateTokenTotal(balances, ethBlock, getTokenPairs(pairs, 'tokenA'), abi.totalSupplyAmount) await calculateTokenTotal(balances, ethBlock, getTokenPairs(pairs, 'tokenB'), abi.totalSupplyAmount) - await unwrapUniswapV3NFTs({ balances, nftsAndOwners: pairs.map(pair => [UNI_V3_POSITION_MANAGER, pair.pair, ]), block: ethBlock, }) + await unwrapUniswapV3NFTs({ balances, nftsAndOwners: pairs.map(pair => [UNI_V3_POSITION_MANAGER, pair.pair,]), block: ethBlock, }) return balances; }; @@ -69,10 +62,10 @@ function getTokenPairs(pairs, key) { return pairs.map(p => ({ pair: p.pair, token: p[key] })) } -const borrowed = async (timestamp, ethBlock, chainBlocks) => { +const borrowed = async (timestamp, ethBlock, chainBlocks, { api }) => { const balances = {}; - const pairs = await getPairs(ethBlock) + const pairs = await getPairs(api) await calculateTokenTotal(balances, ethBlock, getTokenPairs(pairs, 'tokenA'), abi.totalDebtAmount) await calculateTokenTotal(balances, ethBlock, getTokenPairs(pairs, 'tokenB'), abi.totalDebtAmount) diff --git a/projects/winery-swap/index.js b/projects/winery-swap/index.js index 5f89afcd75c..9dbca80e985 100644 --- a/projects/winery-swap/index.js +++ b/projects/winery-swap/index.js @@ -5,7 +5,6 @@ module.exports = { bsc: { tvl: getUniTVL({ factory: '0x79C342FddBBF376cA6B4EFAc7aaA457D6063F8Cb', - chain: 'bsc', useDefaultCoreAssets: true }) }, diff --git a/projects/wingriders/index.js b/projects/wingriders/index.js index fd0bab38903..6474f940492 100644 --- a/projects/wingriders/index.js +++ b/projects/wingriders/index.js @@ -4,40 +4,33 @@ const headers = { "Accept-Encoding": "gzip, deflate, br", }; -async function tvl() { - const liquidityPoolLocked = ( - await axios.post( - "https://explorer.mainnet.wingriders.com/api/bulk/paymentCredentials/adaBalance", - { - paymentCredentials: [ - "e6c90a5923713af5786963dee0fdffd830ca7e0c86a041d9e5833e91", - ], - }, - { headers } - ) - ).data.balance; - const requestLocked = ( - await axios.post( - "https://explorer.mainnet.wingriders.com/api/bulk/paymentCredentials/adaBalance", - { - paymentCredentials: [ - "86ae9eebd8b97944a45201e4aec1330a72291af2d071644bba015959", - ], - }, - { headers } +/** @returns {Promise<{tvl: string, staking: string}>} */ +async function getTvlBreakdown() { + const res = await axios.post( + 'https://api.mainnet.wingriders.com/graphql', + { + query: '{tvlBreakdown {tvl, staking}}' + }, + { headers } ) - ).data.balance; - return { - cardano: - (parseInt(liquidityPoolLocked, 10) * 2) / 1e6 + - parseInt(requestLocked, 10) / 1e6, - }; + return res.data.data.tvlBreakdown +} + +async function tvl() { + const tvlBreakdown = await getTvlBreakdown() + return {cardano: Number(tvlBreakdown.tvl)} +} + +async function staking() { + const tvlBreakdown = await getTvlBreakdown() + return {cardano: Number(tvlBreakdown.staking)} } module.exports = { timetravel: false, cardano: { tvl, + staking, }, hallmarks: [ [1659312000,"Nomad Bridge Hack"] diff --git a/projects/winr-protocol/index.js b/projects/winr-protocol/index.js new file mode 100644 index 00000000000..f743a7e34c3 --- /dev/null +++ b/projects/winr-protocol/index.js @@ -0,0 +1,9 @@ +const { gmxExports } = require('../helper/gmx') +const WINR_VAULT_CONTRACT = "0x8c50528F4624551Aad1e7A265d6242C3b06c9Fca"; + +module.exports = { + start: 67057671, + arbitrum: { + tvl: gmxExports({ vault: WINR_VAULT_CONTRACT }), + }, +}; diff --git a/projects/witswap/index.js b/projects/witswap/index.js index 9c38c054c6c..4190acfc322 100644 --- a/projects/witswap/index.js +++ b/projects/witswap/index.js @@ -14,6 +14,6 @@ async function tvl(_timestamp, ethBlock){ module.exports = { ethereum:{ - tvl + tvl: () => ({}), //Project is dead }, -} \ No newline at end of file +} diff --git a/projects/wojakfinance/index.js b/projects/wojakfinance/index.js index aa2b248c4a6..077cf3c07ac 100644 --- a/projects/wojakfinance/index.js +++ b/projects/wojakfinance/index.js @@ -14,7 +14,6 @@ module.exports = { dogechain: { tvl: getUniTVL({ factory: '0xc7c86B4f940Ff1C13c736b697e3FbA5a6Bc979F9', - chain, useDefaultCoreAssets: true, }), staking: staking({ diff --git a/projects/wombat-exchange/config.js b/projects/wombat-exchange/config.js new file mode 100644 index 00000000000..e11f0b7b3fe --- /dev/null +++ b/projects/wombat-exchange/config.js @@ -0,0 +1,55 @@ +module.exports = { + bsc: { + wom: "0xAD6742A35fB341A9Cc6ad674738Dd8da98b94Fb1", + veWom: "0x3DA62816dD31c56D9CdF22C6771ddb892cB5b0Cc", + pools: { + mainPool: "0x312bc7eaaf93f1c60dc5afc115fccde161055fb0", + bnbPool: "0x0029b7e8e9eD8001c868AA09c74A1ac6269D4183", + sidePool: "0x0520451B19AD0bb00eD35ef391086A692CFC74B2", + wmxWom: "0xeEB5a751E0F5231Fc21c7415c4A4c6764f67ce2e", + mWOM: "0x083640c5dBD5a8dDc30100FB09B45901e12f9f55", + qWOM: "0x2c5464b9052319e3d76f8279031f04e4B7fd7955", + Innovation: "0x48f6A8a0158031BaF8ce3e45344518f1e69f2A14", + BNBx: "0x8df1126de13bcfef999556899F469d64021adBae", + stkBNB: "0xB0219A90EF6A24a237bC038f7B7a6eAc5e01edB0", + iUSD: "0x277E777F7687239B092c8845D4d2cd083a33C903", + axlUSDC: "0x8ad47d7ab304272322513eE63665906b64a49dA2", + USDD: "0x05f727876d7C123B9Bb41507251E2Afd81EAD09A", + BOB: "0xeA6cDd9e8819BbF7f8791E7D084d9F0a6Afa7892", + frxETH: "0x2Ea772346486972E7690219c190dAdDa40Ac5dA4", + stableGuildPool: "0x9498563e47D7CFdFa22B818bb8112781036c201C", // USD+ pool + mim: "0xb8b1b72a9b9ba90e2539348fec1ad6b265f9f684", + ankrBNB: "0x6f1c689235580341562cdc3304e923cc8fad5bfa", + bnby: "0xbed9B758A681d73a95Ab4c01309C63aa16297b80", + smartHAY: "0xa61dccC6c6E34C8Fbf14527386cA35589e9b8C27", + wBETH: "0x8b892b6Ea1d0e5B29b719d6Bd6eb9354f1cDE060", + ankrETH: "0x1b507b97c89eDE3E40d1b2Ed92972197c6276D35", + rbnb: "0x0592083B285aa75B9c8BaD2485C6cCCF93cCC348", + SnBNB: "0xF1e604e9A31c3b575f91CF008445B7ce06BF3fef", + }, + }, + arbitrum: { + wom: "0x7b5eb3940021ec0e8e463d5dbb4b7b09a89ddf96", + veWom: "0x488B34F704a601DAeEf14135146a3dA79F2d3EFC", + pools: { + mainPool: "0xc6bc781e20f9323012f6e422bdf552ff06ba6cd1", + wmxWom: "0xEE9b42b40852a53c7361F527e638B485D49750cD", + mWOM: "0x90eCddEC4E4116E30769A4e1EA52c319aca338B6", + qWOM: "0x12Fa5AB079CFf564d599466d39715D35d90Af978", + overnight: "0xCF20fDA54e37f3fB456930f02fb07FccF49e4849", // USD+ pool + frxETH: "0x20D7ee728900848752FA280fAD51aF40c47302f1", + frax: "0x4a8686df475D4c44324210FFA3Fc1DEA705296e0", // FRAX-MAI-USD+ + bob: "0x917caF2b4D6040a9D67A5F8CEfC4F89d1b214c1A", + mim: "0x29eeB257a2A6eCDE2984aCeDF80A1B687f18eC91", + jUSDC: "0xc7a6bA5F28993BaDb566007bD2E0CB253c431974", + ankrETH: "0xB9bdfE449Da096256Fe7954Ef61A18eE195Db77B", + wstETH: "0xe14302040c0A1eb6fB5A4A79EfA46D60029358d9", + pendle: "0xe7159f15e7b1d6045506B228A1ed2136dcc56F48", + fUSD: "0x956454C7BE9318863297309183C79b793D370401", + }, + }, + hallmarks: [ + [1662417125, "Liquidity Mining Start"], + [1680674400, "Arbitrum Launching"], + ], +}; diff --git a/projects/wombat-exchange/index.js b/projects/wombat-exchange/index.js index 5c4853836dc..ab4f03a3f8f 100644 --- a/projects/wombat-exchange/index.js +++ b/projects/wombat-exchange/index.js @@ -1,88 +1,28 @@ -const sdk = require("@defillama/sdk"); +const config = require("./config"); const { staking } = require("../helper/staking"); const { sumTokens2 } = require("../helper/unwrapLPs"); -// Wombat Asset Address -// Main Pool -const Asset_P01_BUSD = "0xF319947eCe3823b790dd87b0A509396fE325745a"; -const Asset_P01_DAI = "0x9d0a463d5dcb82008e86bf506eb048708a15dd84"; -const Asset_P01_USDC = "0xb43ee2863370a56d3b7743edcd8407259100b8e2"; -const Asset_P01_USDT = "0x4f95fe57bea74b7f642cf9c097311959b9b988f7"; - -// BNB Pool -const Asset_P02_WBNB = "0x74f019a5c4ed2c2950ce16fad7af838549092c5b"; -const Asset_P02_BNBx = "0x10f7c62f47f19e3ce08fef38f74e3c0bb31fc24f"; -const Asset_P02_aBNBc = "0x9d2dead9547eb65aa78e239647a0c783f296406b"; -const Asset_P02_stkBNB = "0xc496f42ea6fc72af434f48469b847a469fe0d17f"; - -// Side Pool -const Asset_P03_BUSD = "0xa649be04619a8f3b3475498e1ac15c90c9661c1a"; -const Asset_P03_HAY = "0x1fa71df4b344ffa5755726ea7a9a56fbbee0d38b"; - -// wmxWom Pool -const Asset_P04_WOM = "0xf9bdc872d75f76b946e0770f96851b1f2f653cac"; -const Asset_P04_wmxWOM = "0x3c42e4f84573ab8c88c8e479b7dc38a7e678d688"; - -// mWOM Pool -const Asset_P05_WOM = "0xEABa290B154aF45DE72FDf2a40E56349e4E68AC2"; -const Asset_P05_mWOM = "0x1f502fF26dB12F8e41B373f36Dc0ABf2D7F6723E"; - -// qWOM Pool -const Asset_P06_WOM = "0xB5c9368545A26b91d5f7340205e5d9559f48Bcf8"; -const Asset_P06_qWOM = "0x87073ba87517E7ca981AaE3636754bCA95C120E4"; - -// underlyingToken Address -const BUSD = "0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56"; -const DAI = "0x1AF3F329e8BE154074D8769D1FFa4eE058B1DBc3"; -const USDC = "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d"; -const USDT = "0x55d398326f99059fF775485246999027B3197955"; -const WBNB = "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c"; -const BNBx = "0x1bdd3cf7f79cfb8edbb955f20ad99211551ba275"; -const aBNBc = "0xe85afccdafbe7f2b096f268e31cce3da8da2990a"; -const stkBNB = "0xc2e9d07f66a89c44062459a47a0d2dc038e4fb16"; -const HAY = "0x0782b6d8c4551b9760e74c0545a9bcd90bdc41e5"; -const WOM = "0xAD6742A35fB341A9Cc6ad674738Dd8da98b94Fb1"; -const wmxWOM = "0x0415023846Ff1C6016c4d9621de12b24B2402979"; -const mWOM = "0x027a9d301fb747cd972cfb29a63f3bda551dfc5c"; -const qWOM = "0x0fE34B8aaAf3f522A6088E278936D10F934c0b19"; -const chain = "bsc"; - -async function tvl(_t, _, { bsc: block }) { - const toa = [ - [BUSD, Asset_P01_BUSD], - [BUSD, Asset_P03_BUSD], - [DAI, Asset_P01_DAI], - [USDC, Asset_P01_USDC], - [USDT, Asset_P01_USDT], - [WBNB, Asset_P02_WBNB], - [BNBx, Asset_P02_BNBx], - [aBNBc, Asset_P02_aBNBc], - [stkBNB, Asset_P02_stkBNB], - [HAY, Asset_P03_HAY], - [WOM, Asset_P04_WOM], - [wmxWOM, Asset_P04_wmxWOM], - [WOM, Asset_P05_WOM], - [mWOM, Asset_P05_mWOM], - [WOM, Asset_P06_WOM], - [qWOM, Asset_P06_qWOM], - ]; - let balances = await sumTokens2({ tokensAndOwners: toa, chain, block }); - - return balances; -} - -module.exports = { - bsc: { - tvl, - staking: staking( - "0x3DA62816dD31c56D9CdF22C6771ddb892cB5b0Cc", - "0xAD6742A35fB341A9Cc6ad674738Dd8da98b94Fb1", - "bsc" - ), - }, - hallmarks: [ - [1662417125, "Liquidity Mining Start"], - [1663120800, "Staking Pool Start"], - [1663725600, "Side Pool Start"], - ], -}; +Object.keys(config).forEach((chain) => { + const arg = config[chain]; + module.exports[chain] = { + tvl: async (_, _b, { [chain]: block }, { api }) => { + const pools = Object.values(arg["pools"]); + + let allUnderlying = await api.multiCall({ abi: "address[]:getTokens", calls: pools, }); + + const tokens = []; + const calls = []; + pools.forEach((v, i) => { + allUnderlying[i].forEach((t) => { + tokens.push(t); + calls.push({ target: v, params: t }); + }); + }); + const wTokens = await api.multiCall({ abi: "function addressOfAsset(address) view returns (address)", calls, }); + return sumTokens2({ api, tokensAndOwners2: [tokens, wTokens], }); + }, + staking: staking(arg["veWom"], arg["wom"],), + }; +}); + +module.exports["hallmarks"] = config["hallmarks"]; diff --git a/projects/wombex/abi.json b/projects/wombex/abi.json index 1e4331f366c..9acdaaa3f7e 100644 --- a/projects/wombex/abi.json +++ b/projects/wombex/abi.json @@ -1,171 +1,9 @@ { - "userInfo": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "userInfo", - "outputs": [ - { - "internalType": "uint128", - "name": "amount", - "type": "uint128" - }, - { - "internalType": "uint128", - "name": "factor", - "type": "uint128" - }, - { - "internalType": "uint128", - "name": "rewardDebt", - "type": "uint128" - }, - { - "internalType": "uint128", - "name": "pendingWom", - "type": "uint128" - } - ], - "stateMutability": "view", - "type": "function" - }, - "poolLength": { - "inputs": [], - "name": "poolLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "poolInfo": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "poolInfo", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "lpToken", - "type": "address" - }, - { - "internalType": "uint96", - "name": "allocPoint", - "type": "uint96" - }, - { - "internalType": "contract IMultiRewarder", - "name": "rewarder", - "type": "address" - }, - { - "internalType": "uint256", - "name": "sumOfFactors", - "type": "uint256" - }, - { - "internalType": "uint104", - "name": "accWomPerShare", - "type": "uint104" - }, - { - "internalType": "uint104", - "name": "accWomPerFactorShare", - "type": "uint104" - }, - { - "internalType": "uint40", - "name": "lastRewardTimestamp", - "type": "uint40" - } - ], - "stateMutability": "view", - "type": "function" - }, - "pool": { - "inputs": [], - "name": "pool", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "lockedSupply": { - "inputs": [], - "name": "lockedSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "underlyingToken": { - "inputs": [], - "name": "underlyingToken", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "quotePotentialWithdraw": { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "liquidity", - "type": "uint256" - } - ], - "name": "quotePotentialWithdraw", - "outputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "fee", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -} + "userInfo": "function userInfo(uint256, address) view returns (uint128 amount, uint128 factor, uint128 rewardDebt, uint128 pendingWom)", + "poolLength": "uint256:poolLength", + "poolInfo": "function poolInfo(uint256) view returns (address lpToken, uint96 allocPoint, address rewarder, uint256 sumOfFactors, uint104 accWomPerShare, uint104 accWomPerFactorShare, uint40 lastRewardTimestamp)", + "pool": "address:pool", + "lockedSupply": "uint256:lockedSupply", + "underlyingToken": "address:underlyingToken", + "quotePotentialWithdraw": "function quotePotentialWithdraw(address token, uint256 liquidity) view returns (uint256 amount, uint256 fee)" +} \ No newline at end of file diff --git a/projects/wombex/config.js b/projects/wombex/config.js new file mode 100644 index 00000000000..ca77b5027a7 --- /dev/null +++ b/projects/wombex/config.js @@ -0,0 +1,18 @@ +module.exports = { + bsc: { + masterWombat: "0x489833311676B566f888119c29bd997Dc6C95830", + voterProxy: "0xE3a7FB9C6790b02Dcfa03B6ED9cda38710413569", + wmxLocker: "0xd4E596c0d5aD06724f4980ff9B73438FEb1504EE", + wmx: '0xa75d9ca2a0a1d547409d82e1b06618ec284a2ced', + wom: '0xAD6742A35fB341A9Cc6ad674738Dd8da98b94Fb1', + veWom: '0x3DA62816dD31c56D9CdF22C6771ddb892cB5b0Cc', + }, + arbitrum: { + masterWombat: "0x62A83C6791A3d7950D823BB71a38e47252b6b6F4", + voterProxy: "0x24D2f6be2bF9cdf3627f720cf09D4551580C1eC1", + wmxLocker: "0xdD76cE773ce8Bd29d32c8389197e98a6e4C1C1A5", + wmx: '0x5190f06eacefa2c552dc6bd5e763b81c73293293', + wom: '0x7b5eb3940021ec0e8e463d5dbb4b7b09a89ddf96', + veWom: '0x488B34F704a601DAeEf14135146a3dA79F2d3EFC', + }, +}; diff --git a/projects/wombex/index.js b/projects/wombex/index.js index 178e421a766..79095b827db 100644 --- a/projects/wombex/index.js +++ b/projects/wombex/index.js @@ -1,110 +1,60 @@ -const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); const { staking } = require("../helper/staking"); -const { ethers: {BigNumber} } = require("ethers") +const config = require("./config"); -const masterWombat = "0xE2C07d20AF0Fb50CAE6cDD615CA44AbaAA31F9c8"; -const voterProxy = "0xE3a7FB9C6790b02Dcfa03B6ED9cda38710413569"; -const wmxLocker = "0xd4E596c0d5aD06724f4980ff9B73438FEb1504EE"; -const wmx = '0xa75d9ca2a0a1d547409d82e1b06618ec284a2ced'; -const wom = '0xAD6742A35fB341A9Cc6ad674738Dd8da98b94Fb1'; -const veWom = '0x3DA62816dD31c56D9CdF22C6771ddb892cB5b0Cc'; -const chain = "bsc"; +async function voterProxyBalances(masterWombat, voterProxy, wmxLocker, wmx, wom, veWom, api) { + let masterWombatPoolInfos = await api.fetchList({ lengthAbi: abi.poolLength, itemAbi: abi.poolInfo, target: masterWombat }) -async function voterProxyBalances(block) { - const poolLength = await sdk.api.abi.call({ - abi: abi.poolLength, - target: masterWombat, - params: [], - block, - chain - }).then(l => parseInt(l.output.toString())); - - const masterWombatPoolInfos = await sdk.api.abi.multiCall({ - block, - abi: abi.poolInfo, - calls: Array.from(Array(poolLength).keys()).map((pid) => ({ target: masterWombat, params: [pid] })), - chain, - }); - - const masterWombatVoterProxyBalances = await sdk.api.abi.multiCall({ - block, + const proxyBalanceCalls = masterWombatPoolInfos.map((_, i) => ({ target: masterWombat, params: [i, voterProxy] })) + let masterWombatVoterProxyBalances = await api.multiCall({ abi: abi.userInfo, - calls: Array.from(Array(poolLength).keys()).map((pid) => ({ target: masterWombat, params: [pid, voterProxy] })), - chain, - }); - - const lpTokenTargets = masterWombatPoolInfos.output.map((pool) => ({ target: pool.output.lpToken, params: [] })); - - const lpPools = await sdk.api.abi.multiCall({ - block, - abi: abi.pool, - calls: lpTokenTargets, - chain, - }); - - const underlyingTokens = await sdk.api.abi.multiCall({ - block, - abi: abi.underlyingToken, - calls: lpTokenTargets, - chain, - }); - - const underlyingAmounts = await sdk.api.abi.multiCall({ - block, + calls: proxyBalanceCalls, + }) + + masterWombatPoolInfos = masterWombatPoolInfos.filter((_, i) => +masterWombatVoterProxyBalances[i].amount > 0) + masterWombatVoterProxyBalances = masterWombatVoterProxyBalances.filter((_, i) => +masterWombatVoterProxyBalances[i].amount > 0) + const lpTokens = masterWombatPoolInfos.map((pool) => pool.lpToken); + const lpPools = await api.multiCall({ abi: abi.pool, calls: lpTokens, }); + const underlyingTokens = await api.multiCall({ abi: abi.underlyingToken, calls: lpTokens, }) + const underlyingAmounts = await api.multiCall({ abi: abi.quotePotentialWithdraw, - calls: lpPools.output.map((pool, index) => { - return { - target: pool.output, - params: [underlyingTokens.output[index].output, masterWombatVoterProxyBalances.output[index].output.amount], - }; - }), - chain, - }); - return underlyingAmounts.output + calls: lpPools.map((pool, index) => ({ + target: pool, + params: [underlyingTokens[index], '' + 1e18], + })), + }) + underlyingAmounts .map((a, i) => { - if (masterWombatVoterProxyBalances.output[i].output.amount === '0') return; - return ({amount: a.output.amount, token: underlyingTokens.output[i].output}) - }).filter(i => i); + api.add(underlyingTokens[i], a!==null? a.amount * masterWombatVoterProxyBalances[i].amount / 1e18: 0) + }) } -async function veWomBalance(block) { - return sdk.api.erc20.balanceOf({ - owner: voterProxy, - target: veWom, - block, - chain, - }).then(s => s.output); +async function veWomBalance(masterWombat, voterProxy, wmxLocker, wmx, wom, veWom, api) { + const womBal = await api.call({ abi: 'erc20:balanceOf', target: veWom, params: voterProxy }) + api.add(veWom, womBal) } -async function tvl(timestamp, ethereumBlock, chainBlocks) { - const block = chainBlocks[chain]; - - let balances = {}; - balances[`${chain}:${wom}`] = await veWomBalance(block); - - const vpBalances = await voterProxyBalances(block); - vpBalances.forEach(b => { - if (balances[`${chain}:${b.token}`]) { - balances[`${chain}:${b.token}`] = BigNumber.from(balances[`${chain}:${b.token}`]).add(BigNumber.from(b.amount)).toString(); - } else { - balances[`${chain}:${b.token}`] = b.amount; - } - }); +async function veWomBalanceCrutch(masterWombat, voterProxy, wmxLocker, wmx, wom, veWom, api) { + const womBal = await api.call({ abi: 'erc20:balanceOf', target: veWom, params: voterProxy }) + api.add(wom, womBal) +} - return balances; +async function tvl(masterWombat, voterProxy, wmxLocker, wmx, wom, veWom, timestamp, ethereumBlock, chainBlocks, { api }) { + await veWomBalance(masterWombat, voterProxy, wmxLocker, wmx, wom, veWom, api) + await voterProxyBalances(masterWombat, voterProxy, wmxLocker, wmx, wom, veWom, api) + await veWomBalanceCrutch(masterWombat, voterProxy, wmxLocker, wmx, wom, veWom, api) } module.exports = { methodology: - "TVL of Wombex Finance consists of Wombat LP tokens staked in MasterWombat, WOM tokens locked in veWOM, and WMX tokens locked in Wombex Vote Lock contract.", - bsc: { - tvl, - staking: staking( - wmxLocker, - wmx, - chain - ), - }, + "TVL of Wombex Finance consists of Wombat LP tokens staked in MasterWombat, WOM tokens locked in veWOM, and WMX tokens locked in Wombex Vote Lock contract. Until proper accounting of veWom can be established on account of it lacking a listed price, veWom is added to the tally of WOM.", }; + +Object.keys(config).forEach((chain) => { + const { masterWombat, voterProxy, wmxLocker, wmx, wom, veWom } = config[chain]; + module.exports[chain] = { + tvl: tvl.bind(null, masterWombat, voterProxy, wmxLocker, wmx, wom, veWom), + staking: staking(wmxLocker, wmx) + } +}) \ No newline at end of file diff --git a/projects/wonderland/api.js b/projects/wonderland/api.js new file mode 100644 index 00000000000..606277d1561 --- /dev/null +++ b/projects/wonderland/api.js @@ -0,0 +1,4 @@ +const index = require('./index') +const { ohmStaking } = require('../helper/treasury') + +module.exports = ohmStaking(index) \ No newline at end of file diff --git a/projects/wonderland/index.js b/projects/wonderland/index.js index fc10d71b1fe..f988c0317cc 100644 --- a/projects/wonderland/index.js +++ b/projects/wonderland/index.js @@ -1,92 +1,86 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { stakings } = require("../helper/staking"); const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); -const { staking } = require("../helper/staking"); -const sdk = require('@defillama/sdk') -const TimeStaking = "0x4456B87Af11e87E329AB7d7C7A246ed1aC2168B9" -const time = "0xb54f16fB19478766A268F172C9480f8da1a7c9C3" +const TimeStaking = "0x4456B87Af11e87E329AB7d7C7A246ed1aC2168B9"; +const RevenueSharingFarm = "0xC172c84587bEa6d593269bFE08632bf2Da2Bc0f6"; +const TIME = "0xb54f16fB19478766A268F172C9480f8da1a7c9C3"; +const wMEMO = "0x0da67235dd5787d67955420c84ca1cecd4e5bb3b"; -// https://app.wonderland.money/#/bonds -const treasury = "0x1c46450211CB2646cc1DA3c5242422967eD9e04c" -const dao = "0x78a9e536EBdA08b5b9EDbE5785C9D1D50fA3278C" -const mim = "0x130966628846BFd36ff31a822705796e8cb8C18D" -const wavax = "0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7" -const wMEMO = "0x0da67235dd5787d67955420c84ca1cecd4e5bb3b" +const Treasury_Eth = "0x355D72Fb52AD4591B2066E43e89A7A38CF5cb341"; +const Treasury_Avax = "0x88bbE6dE858B179841c8f49a56b99fb0522a263a"; -async function tvl(timestamp, ethBlock, chainBlocks) { +async function avaxTvl(timestamp, ethBlock, chainBlocks) { const balances = {}; - const transform = addr => addr.toLowerCase() === "0x130966628846bfd36ff31a822705796e8cb8c18d" ? "0x99d8a9c45b2eca8864373a26d1459e3dff1e17f3" : `avax:${addr}` + const transform = (addr) => + addr.toLowerCase() === ADDRESSES.avax.USDt + ? [ADDRESSES.ethereum.USDT]: `avax:${addr}`; await sumTokensAndLPsSharedOwners( balances, [ - [mim, false], - [wavax, false], - ["0x113f413371fC4CC4C9d6416cf1DE9dFd7BF747Df", true], // mim-time - ["0x781655d802670bba3c89aebaaea59d3182fd755d", true], // wavax-mim - ["0x8ea6dd9482a49791e8c3d0f7c515bbd3be702f74", true], // MIM-WETH - ["0xf64e1c5B6E17031f5504481Ac8145F4c3eab4917", true], // wavax-time - ["0x49d5c2bdffac6ce2bfdb6640f4f80f226bc10bab", false], // WETH - ["0x4d308c46ea9f234ea515cc51f16fba776451cac8", true], // wmemo-mim - - ["0xc7198437980c041c805a1edcba50c1ce5db95118", false], // USDT - ["0xce1bffbd5374dac86a2893119683f4911a2f7814", false], // SPELL - ["0x6e84a6216ea6dacc71ee8e6b0a5b7322eebc0fdd", false], // JOE - ["0xcbb424fd93cdec0ef330d8a8c985e8b147f62339", true], // wavax-mim - ["0x6cb6cb160bd629aaf07d2e51b3a435d909d01dd0", true], // mim-time - ["0xb599E3Cc5e7730865E74d78F2b9B67fDC627b743", true], // mim-?? + [ADDRESSES.avax.USDt, false], + [ADDRESSES.avax.USDC_e, false], + ["0x39fC9e94Caeacb435842FADeDeCB783589F50f5f", false], // KNC + ["0x63682bDC5f875e9bF69E201550658492C9763F89", false], // BSGG ["0x0da67235dd5787d67955420c84ca1cecd4e5bb3b", false], //wMEMO ], - [treasury, dao], + [Treasury_Avax], chainBlocks.avax, - 'avax', + "avax", transform ); - const wmemoAddress = transform(wMEMO) - const memo = await sdk.api.abi.call({ - target: wMEMO, - abi: { "inputs": [{ "internalType": "uint256", "name": "_amount", "type": "uint256" }], "name": "wMEMOToMEMO", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, - chain:'avax', - block: chainBlocks.avax, - params: [balances[wmemoAddress]] - }) - balances[transform(time)] = memo.output - delete balances[wmemoAddress] + const wmemoAddress = transform(wMEMO); + delete balances[wmemoAddress]; return balances; } -const ethTransforms = { - "0x26fa3fffb6efe8c1e69103acb4044c26b9a106a9": "0x090185f2135308bad17527004364ebcc2d37e5f6" -} - async function ethTvl(timestamp, ethBlock, chainBlocks) { const balances = {}; await sumTokensAndLPsSharedOwners( balances, [ - ["0x4e3fbd56cd56c3e72c1403e103b45db9da5b9d2b", false], //cvx - ["0x99d8a9c45b2eca8864373a26d1459e3dff1e17f3", false], //mim - ["0x26fa3fffb6efe8c1e69103acb4044c26b9a106a9", false], // sSPELL + [ADDRESSES.ethereum.LUSD, false], + ["0x3432B6A60D23Ca0dFCa7761B7ab56459D9C964D0", false], // FRAX + [ADDRESSES.ethereum.CVX, false], + [ADDRESSES.ethereum.cvxCRV, false], + ["0x55C08ca52497e2f1534B59E2917BF524D4765257", false], // UwU + ["0x69570f3E84f51Ea70b7B68055c8d667e77735a25", false], // BSGG + ["0x04906695D6D12CF5459975d7C3C03356E4Ccd460", false], // sOHM + ["0x29127fE04ffa4c32AcAC0fFe17280ABD74eAC313", false], // sifu + [ADDRESSES.ethereum.TUSD, false], + ["0x66761Fa41377003622aEE3c7675Fc7b5c1C2FaC5", false], // CPOOL + ["0xdBdb4d16EdA451D0503b854CF79D55697F90c8DF", false], // ALCX + ["0xdB25f211AB05b1c97D595516F45794528a807ad8", false], // EURS + [ADDRESSES.ethereum.GNO, false], // GNO + ["0x41D5D79431A913C4aE7d69a668ecdfE5fF9DFB68", false], // INV + ["0xE80C0cd204D654CEbe8dd64A4857cAb6Be8345a3", false], // JPEG + ["0x0C10bF8FcB7Bf5412187A595ab97a3609160b5c6", false], // USDD + ["0xAf5191B0De278C7286d6C7CC6ab6BB8A73bA2Cd6", false], // STG + ["0x6243d8CEA23066d098a15582d81a598b4e8391F4", false], // FLX + [ADDRESSES.ethereum.SNX, false], + [ADDRESSES.ethereum.USDT, false], + [ADDRESSES.ethereum.DAI, false], ], - ["0x355d72fb52ad4591b2066e43e89a7a38cf5cb341"], + [Treasury_Eth], ethBlock, - 'ethereum', - addr=>ethTransforms[addr.toLowerCase()]??addr + "ethereum" ); - return balances -} + return balances; +} module.exports = { - avax:{ - tvl, - staking: staking(TimeStaking, time, "avax") + avax: { + tvl: avaxTvl, + staking: stakings([TimeStaking, RevenueSharingFarm], [TIME, wMEMO], "avax"), }, - ethereum:{ - tvl:ethTvl + ethereum: { + tvl: ethTvl, }, methodology: - "Counts tokens on the treasury for tvl and staked TIME for staking", + "Counts tokens on the treasury for TVL, Staked TIME for Staking and Revenue Sharing Farm.", }; diff --git a/projects/wonderly/abi.json b/projects/wonderly/abi.json new file mode 100644 index 00000000000..4295301b309 --- /dev/null +++ b/projects/wonderly/abi.json @@ -0,0 +1,9 @@ +{ + "bank": { + "usableFtmBalance": "uint256:usableCollateralBalance", + "usableEthBalance": "uint256:usableCollateralBalance" + }, + "multiFeeDistribution": { + "totalSupply": "uint256:totalSupply" + } +} diff --git a/projects/wonderly/index.js b/projects/wonderly/index.js new file mode 100644 index 00000000000..7e4c030d206 --- /dev/null +++ b/projects/wonderly/index.js @@ -0,0 +1,172 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const Abis = require("./abi.json"); +const sdk = require("@defillama/sdk"); +const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); +const { staking } = require("../helper/staking"); + +const Contracts = { + fantom: { + wftm: ADDRESSES.fantom.WFTM, + gfx: "0xB6d8Ff34968e0712c56DE561b2f9Debd526a348c", + bank: "0xeE5b6F97faaEB7f56Df1B433CC46d69e5659dF0B", + multiFeeDistribution: "0x29f3e86280014d703BCaE532b6751fFa9Fca0df9", + chef: "0x6646346DEe3cfb1C479a65009B9ed6DA47D41771", + lps: [ + "0x63B560616CcCc218ade162bB580579f55c3320bb", // GFX_FTM_LP + "0x8b74df2ffa35464cb6cb96888ff8eecae29f728f", // GFTM_FTM_LP + ], + }, + arbitrum: { + weth: ADDRESSES.arbitrum.WETH, + afx: "0x42972EdecD94BDD19A622A6a419bDDed2de56E08", + bank: "0xd73509D1B57bD99121AB30040227d51d295C159e", + multiFeeDistribution: "0x564DdF4206994FA0Ad0d11947095cA3dfcb905e2", + chef: "0x952470bfA5326A31301396dF9c05ea774685562a", + lps: [ + "0xa6bd5B143c2dEC9BDB7F1355AB0d6290B5B11608", // AFX_ETH_LP + "0x0e4a0caEb84A9c2904704d02738d40a82BE3c8Cb", // XETH_ETH_LP + "0x68a69ca6825B626DD627457f5915E111031496a4", // XETH_AFX_LP + ], + }, +}; + +async function calcFantomTvl(timestamp, ethBlock, chainBlocks) { + const fantomBlock = chainBlocks.fantom; + const fantomChain = "fantom"; + + const fantomBankBalance = await sdk.api.abi.call({ + target: Contracts.fantom.bank, + abi: Abis.bank.usableFtmBalance, + chain: fantomChain, + block: fantomBlock, + }); + + return { + [`fantom:${Contracts.fantom.wftm}`]: + +fantomBankBalance.output, + }; +} + +async function calcArbitrumTvl(timestamp, ethBlock, chainBlocks) { + const arbitrumBlock = chainBlocks.arbitrum; + const arbitrumChain = "arbitrum"; + + const arbitrumBankBalance = await sdk.api.abi.call({ + target: Contracts.arbitrum.bank, + abi: Abis.bank.usableEthBalance, + chain: arbitrumChain, + block: arbitrumBlock, + }); + + return { + [`arbitrum:${Contracts.arbitrum.weth}`]: + +arbitrumBankBalance.output + }; +} + +async function calcFantomStakingTvl(timestamp, ethBlock, chainBlocks) { + const fantomBlock = chainBlocks.fantom; + const fantomChain = "fantom"; + + const fantomStakingData = await sdk.api.abi.call({ + target: Contracts.fantom.multiFeeDistribution, + abi: Abis.multiFeeDistribution.totalSupply, + chain: fantomChain, + block: fantomBlock, + }); + + return { + [`fantom:${Contracts.fantom.gfx}`]: fantomStakingData.output, + }; +} + +async function calcArbitrumStakingTvl(timestamp, ethBlock, chainBlocks) { + const arbitrumBlock = chainBlocks.arbitrum; + const arbitrumChain = "arbitrum"; + + const arbitrumStakingData = await sdk.api.abi.call({ + target: Contracts.arbitrum.multiFeeDistribution, + abi: Abis.multiFeeDistribution.totalSupply, + chain: arbitrumChain, + block: arbitrumBlock, + }); + + return { + [`arbitrum:${Contracts.arbitrum.afx}`]: arbitrumStakingData.output, + }; +} + +async function calcPool2(masterchef, lps, block, chain) { + let balances = {}; + const lpBalances = ( + await sdk.api.abi.multiCall({ + calls: lps.map((p) => ({ + target: p, + params: masterchef, + })), + abi: "erc20:balanceOf", + block, + chain, + }) + ).output; + let lpPositions = []; + lpBalances.forEach((p) => { + lpPositions.push({ + balance: p.output, + token: p.input.target, + }); + }); + await unwrapUniswapLPs( + balances, + lpPositions, + block, + chain, + (addr) => `${chain}:${addr}` + ); + return balances; +} + +async function arbitrumPool2(timestamp, block, chainBlocks) { + const farm = await calcPool2( + Contracts.arbitrum.chef, + Contracts.arbitrum.lps, + chainBlocks.arbitrum, + "arbitrum" + ); + return { ...farm }; +} + +async function fantomPool2(timestamp, block, chainBlocks) { + const farm = await calcPool2( + Contracts.fantom.chef, + Contracts.fantom.lps, + chainBlocks.fantom, + "fantom" + ); + return { ...farm }; +} + +module.exports = { + fantom: { + tvl: calcFantomTvl, + pool2: fantomPool2, + staking: calcFantomStakingTvl, + }, + arbitrum: { + tvl: calcArbitrumTvl, + pool2: arbitrumPool2, + staking: calcArbitrumStakingTvl + } +}; + +module.exports = { + fantom: { + tvl: () => ({}), + }, + arbitrum: { + tvl: () => ({}), + }, + hallmarks: [ + [Math.floor(new Date('2023-02-15')/1e3), 'Project rugged'], + ], +} \ No newline at end of file diff --git a/projects/woo-cex/index.js b/projects/woo-cex/index.js new file mode 100644 index 00000000000..d905a62a604 --- /dev/null +++ b/projects/woo-cex/index.js @@ -0,0 +1,34 @@ +const { cexExports } = require('../helper/cex') + +const owners = [ + '0x0d83f81bc9f1e8252f87a4109bbf0d90171c81df', + '0x63DFE4e34A3bFC00eB0220786238a7C6cEF8Ffc4', + '0xE505Bf08C03cc0FA4e0FDFa2487E2c11085b3FD9', + '0xea319fd75766f5180018f8e760f51c3d3c457496', +] + +const config = { + bitcoin: { + owners: [ + 'bc1qh78w4qq9v2dqntjtxne97kp9u2485jdqrfsghh', + 'bc1qm4hycszv0v0qel3swxqyp57nkpnnrda4rc55lm' + ], + }, + ethereum: { owners }, + fantom: { owners }, + avax: { owners }, + bsc: { owners }, + arbitrum: { owners }, + polygon: { owners }, + optimism: { owners }, + tron: { + owners: [ + 'TDZeVyGHgN5bErmWumuYRtXCrYMoUzKF7L', + 'TSC2VZai39isPj5DzByYgaBtjpBHbDcTgd' + ] + }, + //lunc/luna terra143zgtv9ntwcfkslrjfp6c5nvdtl8lqmvff5wz6 // terra1t2gpws06d6yjauwhqy0cqtu2g5gwtghlw60ht4 +} + +module.exports = cexExports(config) +module.exports.methodology = 'This wallets where provide by WOO team' \ No newline at end of file diff --git a/projects/woofi-earn/index.js b/projects/woofi-earn/index.js index ac189be384d..fdb802a815d 100644 --- a/projects/woofi-earn/index.js +++ b/projects/woofi-earn/index.js @@ -6,7 +6,7 @@ module.exports = { misrepresentedTokens: true, }; -(['fantom', 'bsc', 'avax', 'polygon', 'arbitrum', ]).forEach(chain => { +(['fantom', 'bsc', 'avax', 'polygon', 'arbitrum', 'optimism', ]).forEach(chain => { module.exports[chain] = { tvl: async () => { let data = await get('https://fi-api.woo.org/yield?network=' + chain) diff --git a/projects/worldmobiletoken/index.js b/projects/worldmobiletoken/index.js new file mode 100644 index 00000000000..6629d963e52 --- /dev/null +++ b/projects/worldmobiletoken/index.js @@ -0,0 +1,14 @@ +const { sumTokensExport } = require("../helper/chain/cardano"); + +const scriptAddresses = [ + 'addr1w82u502esm0zmv77t0csd6jrgr6wupy5zr7pdwdczpyerpgf6r666', +]; + +module.exports = { + methodology: 'Counts amount of WMT locked; converted by the price of ADA sitting in the orderbook.', + timetravel: false, + cardano: { + tvl: () => 0, + staking: sumTokensExport({ scripts: scriptAddresses, }) + }, +}; diff --git a/projects/wowswap/abi.json b/projects/wowswap/abi.json index ddf64be68f9..5f7c0369545 100644 --- a/projects/wowswap/abi.json +++ b/projects/wowswap/abi.json @@ -1,247 +1,15 @@ { - "getAllLendables": { - "inputs": [], - "name": "getAllLendables", - "outputs": [ - { - "internalType": "bytes32[]", - "name": "", - "type": "bytes32[]" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - "getAllShortables": { - "inputs": [], - "name": "getAllShortables", - "outputs": [ - { - "internalType": "bytes32[]", - "name": "", - "type": "bytes32[]" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - "getAllProxyLendables": { - "inputs": [], - "name": "getAllProxyLendables", - "outputs": [ - { - "internalType": "bytes32[]", - "name": "", - "type": "bytes32[]" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - "getAllTradables": { - "inputs": [], - "name": "getAllTradables", - "outputs": [ - { - "internalType": "bytes32[]", - "name": "", - "type": "bytes32[]" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - "getPair": { - "inputs": [ - { - "internalType": "address", - "name": "lendable", - "type": "address" - }, - { - "internalType": "address", - "name": "tradable", - "type": "address" - } - ], - "name": "getPair", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getRoutablePair": { - "inputs": [ - { - "internalType": "address", - "name": "lendable", - "type": "address" - }, - { - "internalType": "address", - "name": "proxyLendable", - "type": "address" - }, - { - "internalType": "address", - "name": "tradable", - "type": "address" - } - ], - "name": "getRoutablePair", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getRoutableShortingPair": { - "inputs": [ - { - "internalType": "address", - "name": "lendable", - "type": "address" - }, - { - "internalType": "address", - "name": "proxyLendable", - "type": "address" - }, - { - "internalType": "address", - "name": "tradable", - "type": "address" - } - ], - "name": "getRoutableShortingPair", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getShortingPair": { - "inputs": [ - { - "internalType": "address", - "name": "lendable", - "type": "address" - }, - { - "internalType": "address", - "name": "tradable", - "type": "address" - } - ], - "name": "getShortingPair", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getReserve": { - "inputs": [ - { - "internalType": "address", - "name": "lendable", - "type": "address" - } - ], - "name": "getReserve", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "balanceOf": { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "token0": { - "inputs": [], - "name": "token0", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "token1": { - "inputs": [], - "name": "token1", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getReserves": { - "inputs": [], - "name": "getReserves", - "outputs": [ - { - "internalType": "uint112", - "name": "_reserve0", - "type": "uint112" - }, - { - "internalType": "uint112", - "name": "_reserve1", - "type": "uint112" - }, - { - "internalType": "uint32", - "name": "_blockTimestampLast", - "type": "uint32" - } - ], - "stateMutability": "view", - "type": "function" - } + "getAllLendables": "function getAllLendables() returns (bytes32[])", + "getAllShortables": "function getAllShortables() returns (bytes32[])", + "getAllProxyLendables": "function getAllProxyLendables() returns (bytes32[])", + "getAllTradables": "function getAllTradables() returns (bytes32[])", + "getPair": "function getPair(address lendable, address tradable) view returns (address)", + "getRoutablePair": "function getRoutablePair(address lendable, address proxyLendable, address tradable) view returns (address)", + "getRoutableShortingPair": "function getRoutableShortingPair(address lendable, address proxyLendable, address tradable) view returns (address)", + "getShortingPair": "function getShortingPair(address lendable, address tradable) view returns (address)", + "getReserve": "function getReserve(address lendable) view returns (address)", + "balanceOf": "function balanceOf(address account) view returns (uint256)", + "token0": "address:token0", + "token1": "address:token1", + "getReserves": "function getReserves() view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast)" } \ No newline at end of file diff --git a/projects/wowswap/constants.js b/projects/wowswap/constants.js index 84db9ded233..8e29e0ff8ad 100644 --- a/projects/wowswap/constants.js +++ b/projects/wowswap/constants.js @@ -1,4 +1,5 @@ -const ADDRESS_ZERO = "0x0000000000000000000000000000000000000000" +const ADDRESSES = require('../helper/coreAssets.json') +const ADDRESS_ZERO = ADDRESSES.null const chains = { "ethereum": { @@ -25,7 +26,7 @@ const chains = { "heco": { reserveFactory: "0x518C21A2Edc710b0c627DBbCb0Af34531Dd1724a", pairFactory: "0x86fEA7A7c7f2503cdDb4Ad0E4e7977E8bDcb1872", - WOW: "0xeFAeeE334F0Fd1712f9a8cc375f427D9Cdd40d73", + WOW: ADDRESSES.telos.USDT, xWOW: "0x72c0A253C84ADa1b1379b2A66ce51862d9bf159B", WOWLP: "0x5E5f16A910B7b44f4F8090798BaADEfBC1388253" }, @@ -55,7 +56,7 @@ const chains = { pairFactory: "0xA53230B6B6e7f4FDD0f65Af954F891A77351baBF", WOW: "0x527805F51C448155DfBDee04bD950036A52a21f0", xWOW: "0x3B642654c6a2C1ECe1d33cBF0EDBfDD970AEC35f", - WOWLP: "0x0000000000000000000000000000000000000000" + WOWLP: ADDRESSES.null } }; diff --git a/projects/wowswap/protocol.js b/projects/wowswap/protocol.js index 7c4eb50ee42..ad1004d21de 100644 --- a/projects/wowswap/protocol.js +++ b/projects/wowswap/protocol.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); const BigNumber = require("bignumber.js"); @@ -46,7 +47,7 @@ async function getLiquidity(data, chain, block) { } async function getStakedLiquidity(chain, block) { - if (chains[chain].WOWLP === "0x0000000000000000000000000000000000000000") { + if (chains[chain].WOWLP === ADDRESSES.null) { const stakedLiquidity = await getLiquidity( { [chains[chain].WOW]: chains[chain].xWOW }, chain, diff --git a/projects/wraithswap/index.js b/projects/wraithswap/index.js index e8c292a3646..5fbf90eb5e4 100644 --- a/projects/wraithswap/index.js +++ b/projects/wraithswap/index.js @@ -1,27 +1,13 @@ -const { calculateUniTvl } = require("../helper/calculateUniTvl"); +const { uniTvlExport } = require("../helper/calculateUniTvl"); const { stakingUnknownPricedLP } = require("../helper/staking"); const factory = "0xCC738D2fDE18fe66773b84c8E6C869aB233766D1" const masterchef = "0x37b106f101a63D9d06e53140E52Eb6F8A3aC5bBc" const wra = "0x4cf098d3775bd78a4508a13e126798da5911b6cd" -const translate = { - "fantom:0x8d11ec38a3eb5e956b052f67da8bdc9bef8abf3e": "0x6b175474e89094c44da98b954eedeac495271d0f", - "fantom:0xb3654dc3d10ea7645f8319668e8f54d2574fbdc8": "0x514910771af9ca656af840dff83e8264ecf986ca", -} - -async function tvl(timestamp, block, chainBlocks) { - let balances = await calculateUniTvl(addr=>`fantom:${addr}`, chainBlocks.fantom, "fantom", factory, 0, true); - for (let key in translate) { - balances[translate[key]] = balances[key]; - delete balances[key] - } - return balances -} - module.exports = { fantom: { - tvl, + tvl: uniTvlExport(factory, 'fantom', true), staking: stakingUnknownPricedLP(masterchef, wra, "fantom", "0x6a80BD3eb550adcfF4f2f5f12a1bB213c1Ef57fA") } } \ No newline at end of file diff --git a/projects/wspp/index.js b/projects/wspp/index.js index 73971474054..d86a957cb30 100644 --- a/projects/wspp/index.js +++ b/projects/wspp/index.js @@ -1,7 +1,7 @@ const { masterchefExports, sumUnknownTokens } = require("../helper/unknownTokens") const sdk = require('@defillama/sdk'); -const poolAddressesABI = { "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "name": "poolAddresses", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" } +const poolAddressesABI = 'function poolAddresses(uint256) view returns (address)' const config = { bsc: { diff --git a/projects/wtfdex/index.js b/projects/wtfdex/index.js new file mode 100644 index 00000000000..49fc8bb614c --- /dev/null +++ b/projects/wtfdex/index.js @@ -0,0 +1,13 @@ +const { staking } = require("../helper/staking"); + +const MasterChefContract = "0x8F4Ed4Cf0300E22c739d2E5A22220497B123b66e"; +const WTFX = "0x4e6482b05D13085f1C4A7e2Ef612ba43104f71b9"; + +const { getUniTVL } = require('../helper/unknownTokens') +module.exports = { + methodology: `Uses factory(0x63FD0a6acBfFB128E7BC7753BFA3B8639A233d50) address and whitelisted tokens address to find and price Liquidity Pool pairs`, + arbitrum: { + tvl: getUniTVL({ factory: '0x63FD0a6acBfFB128E7BC7753BFA3B8639A233d50', useDefaultCoreAssets: true }), + staking: staking(MasterChefContract, WTFX, "arbitrum"), + } +}; diff --git a/projects/wyndao-dex/index.js b/projects/wyndao-dex/index.js new file mode 100644 index 00000000000..3c025df1ec1 --- /dev/null +++ b/projects/wyndao-dex/index.js @@ -0,0 +1,27 @@ +const { get } = require('../helper/http') +const { transformDexBalances } = require('../helper/portedTokens') + +module.exports = { + timetravel: false, + misrepresentedTokens: true, + juno: { + tvl: async () => { + const data = await get('https://api.wynddao.com/pools') + return transformDexBalances({ + chain: 'juno', + data: Object.values(data).map(i => ({ + token0: i[0].token ?? i[0].native, + token0Bal: i[0].amount ?? 0, + token1: i[1].token ?? i[1].native, + token1Bal: i[1].amount ?? 0, + })) + }) + }, + staking: async () => { + const data = await get('https://lcd-juno.cosmostation.io/wasm/contract/juno1mkw83sv6c7sjdvsaplrzc8yaes9l42p4mhy0ssuxjnyzl87c9eps7ce3m9/smart/7b2262616c616e6365223a7b2261646472657373223a226a756e6f317379396d6c7734377734346639347a6561376739387935666634637674633872667637356a677770686c65743833776c66347373613035306d76227d7d?encoding=UTF-8') + return { + 'wynd': JSON.parse(atob(data.result.smart)).balance / 1e6 + } + } + } +} \ No newline at end of file diff --git a/projects/wyndao-lsd/index.js b/projects/wyndao-lsd/index.js new file mode 100644 index 00000000000..0832bd56669 --- /dev/null +++ b/projects/wyndao-lsd/index.js @@ -0,0 +1,12 @@ +const { get } = require('../helper/http') +const { queryContract, totalSupply } = require('../helper/chain/cosmos') + +module.exports = { + timetravel: false, + juno: { + tvl: async (_, _1, _2, { api }) => { + let { supply: { bond_denom, total_bonded }} = await queryContract({ chain: api.chain, contract: 'juno1snv8z7j75jwfce4uhkjh5fedpxjnrx9v20ffflzws57atshr79yqnw032r', data: { supply: {}}}) + api.add(bond_denom, total_bonded) + } + } +} \ No newline at end of file diff --git a/projects/x2y2/index.js b/projects/x2y2/index.js index b54f618a101..d87ce2aea0d 100644 --- a/projects/x2y2/index.js +++ b/projects/x2y2/index.js @@ -1,52 +1,17 @@ -const sdk = require("@defillama/sdk"); -const abi = require("../helper/abis/chainlink.json"); const { staking } = require("../helper/staking"); -const { nftPriceFeeds, tokens } = require('../helper/tokenMapping'); +const { sumTokens2 } = require('../helper/unwrapLPs') // Example X2Y2 staking tx: X2Y2 staking goes from wallet to X2Y2 FeeSharingSystem then to the 0xb329 TokenDistributor contract // https://etherscan.io/token/0x1e4ede388cbc9f4b5c79681b7f94d36a11abebc9?a=0xb329e39ebefd16f40d38f07643652ce17ca5bac1#readContract const X2Y2 = "0x1e4ede388cbc9f4b5c79681b7f94d36a11abebc9"; const X2Y2_staking = "0xb329e39ebefd16f40d38f07643652ce17ca5bac1"; -// Lending vault -const XY3 = "0xC28F7Ee92Cd6619e8eEC6A70923079fBAFb86196"; +// Lending vaults +const XY3_v1 = "0xC28F7Ee92Cd6619e8eEC6A70923079fBAFb86196"; +const XY3_v2 = "0xFa4D5258804D7723eb6A934c11b1bd423bC31623" -async function getTVL(balances, chain, timestamp, chainBlocks) { - // Get deposited collateral - const { output: positions } = await sdk.api.abi.multiCall({ - calls: nftPriceFeeds[chain].map((priceFeed) => ({ - target: priceFeed.token, params: [XY3] - })), - abi: "erc20:balanceOf", - block: chainBlocks[chain], - chain, - }); - - // Get floor prices from Chainlink feeds - const { output: floorPrices } = await sdk.api.abi.multiCall({ - calls: nftPriceFeeds[chain].map((priceFeed) => ({ - target: priceFeed.oracle, - })), - abi: abi.latestAnswer, - block: chainBlocks[chain], - chain, - }); - - let collateralValueETH = 0; - for (let i = 0; i < positions.length; i++) { - const floorPrice = floorPrices[i].output; - const position = Number(positions[i].output); - collateralValueETH += position * floorPrice; - } - - sdk.util.sumSingleBalance(balances, tokens.weth, collateralValueETH); - return balances; -} - -async function tvl(timestamp, block, chainBlocks) { - const balances = {}; - await getTVL(balances, "ethereum", timestamp, chainBlocks); - return balances; +async function tvl(timestamp, block, chainBlocks, { api }) { + return sumTokens2({ api, owners: [XY3_v1, XY3_v2], resolveNFTs: true}) } module.exports = { diff --git a/projects/x7/index.js b/projects/x7/index.js new file mode 100644 index 00000000000..1d1ae33ace6 --- /dev/null +++ b/projects/x7/index.js @@ -0,0 +1,5 @@ +module.exports = { + ethereum: { + tvl: () => ({}), + }, +}; diff --git a/projects/xWeowns/index.js b/projects/xWeowns/index.js index 8824aae28a2..a1a4736db23 100644 --- a/projects/xWeowns/index.js +++ b/projects/xWeowns/index.js @@ -1,9 +1,10 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const contracts = { "xWeowns": "0xaBA0Bb586335B938a7a817A900017D891268d32c", "USDT": "0x32D2b9bBCf25525b8D7E92CBAB14Ca1a5f347B14", - "USDTethereum": "0xdac17f958d2ee523a2206206994597c13d831ec7" + "USDTethereum": ADDRESSES.ethereum.USDT }; async function tvl(timestamp, block, chainBlocks) { @@ -17,11 +18,10 @@ async function tvl(timestamp, block, chainBlocks) { chain: 'lachain' })).output }; -}; +} module.exports = { - doublecounted: false, lachain: { - tvl + tvl: () => 0, } }; \ No newline at end of file diff --git a/projects/xWinFinance/Helper.js b/projects/xWinFinance/Helper.js new file mode 100644 index 00000000000..4636c161219 --- /dev/null +++ b/projects/xWinFinance/Helper.js @@ -0,0 +1,72 @@ +const token = { + XWIN: '0xd88ca08d8eec1e9e09562213ae83a7853ebb5d28' +}; + +const Strategies = { + xSCA: "0x0a652784DF3f8Abde85dAEeee77D1EA97f5c5B24", + xDCA: "0x482ae949E4a70953fCa090717b68359b73b8602a", + xWinBBMA: "0x5EFaaBc34a3ba66f1fD02F056AC457AeBaF57D55", + xWinIRT: "0x5A8a66DF53DF88844c60829967b88d00eD208E08", + xCAKE_V: "0x1d2430bBfe86432E36A7C7286E99f78546F23De9", + xETH_V: "0x0C34Aa4e36983aB6ec11bC557A3B8cF79A7a9Ae7", + xUSDC_V: "0xcBca44d60c5A2b3c56ACfB51aFC66Ea04b8a2742", + xBUSD_V: "0xf4979C043df6f7d5dA929DeAB11b220A82886395", + xBTC_V: "0x7A0dEc70473602Cd0EF3Dc3d909b6Dc3FA42116C", + xUSDT_V: "0x8B7fcACB99124F009c8470FDa6f5fcF60277BDB2", + xADA_V: "0x605926F795FD9B4c3A8B1A2db33cBE01c66bA83f", + xBTC_O: "0x69764856e82180150f5366be610E40c2f812d7D6", + xUSDT_O: "0xCEbd365e4BFd8589Fd6BDe21898DB35a8095f956", +}; + +const PublicVault = { + fDEFI: "0x61d5722290F8755b2f31D260064658D6Ad837F37", + fMIV: "0x0A0817454710102F2bcB2215D616cBe3aFf495e5", + fxDollar: "0xFa4d4B4243dDA1F5f4d09269f61D57d02470635C", + fBTCETH: "0x284b4aDD0C9669f635EA64418C216821c45D0B48", + fvUSDT: "0xE949d266E8740470a15DFB1F40A795b5a2b63f02", + fCombo: "0x4d4F948C8E9Ec3d1cE1B80d598f57F8c75c64e4a", + fTACombo: "0xaaFF5eFe1376474a520FFe9129d8Aa8d7422AAbe", +}; + +const PrivateVault = { + Vault1: "0xa74c70d0bf531171360e603e6441faeb71b117d1", + Vault2: "0x834672c33291fd6932c1786e0c5fd4a3b921dc00", + Vault3: "0xc1908cf72426c0d6c48a4930bef681bb6621c106", + Vault4: "0x774c1ba3c31af51e4596fcaf9f90eaf167aee34c", + Vault5: "0x69f69df395c05202ec935999d072fa390defc31f", + Vault6: "0xb3c713a845378484f66e3f2ad608e3438675ff7c", + Vault7: "0xc5782a89ad76fe0b68cd67dcc4b294fcb5307415", + Vault8: "0xbddd3ff6f5902171faebb34e9ee084341c94a1e6", + Vault9: "0xe6eff8492c6832c1da6f76d3cc3288951021a7b5", + Vault10: "0x42289b0356470bdc0a93d6710f0bcf8bc0868f96", + Vault11: "0x90aadea5b2f10c4c53139fe4cf8005ffe5ed8d47", + Vault12: "0xbff5506a0c604cbf231646838f2f29118210e236", + Vault13: "0xeb23a52115e5ac9ed9085a1c0b25ec29529eef3b", +}; + +const farms = { + MasterChefAddress: "0xD09774e3d5Dc02fa969896c53D3Cbb5bC8900A60", + BuddyChefAddress: "0x4B87a60fC5a94e5ac886867977e29c9711C2E903", + LockStakingAddress: "0xa4AE0DCC89Af9855946C0b2ad4A10FF27125a9Fc", + PriceMasterAddr: "0xB1233713FeA0984fff84c7456d2cCed43e5e48E2", +}; + +const abi = { + getVaultValues: + "function getVaultValuesInUSD() public view returns (uint vaultValue)", + poolLength: "function poolLength() view returns (uint)", + poolInfoMaster: + "function poolInfo(uint256) view returns (address, uint256, uint256, uint256, uint256, uint256)", + balance: "function balanceOf(address) view returns (uint256)", + decimals: "function decimals() view returns (uint8)", + getPrice: "function getPrice(address, address) view returns (uint rate)", +}; + +module.exports = { + Strategies, + PublicVault, + PrivateVault, + farms, + abi, + token, +}; diff --git a/projects/xWinFinance/index.js b/projects/xWinFinance/index.js new file mode 100644 index 00000000000..6ac76cf048b --- /dev/null +++ b/projects/xWinFinance/index.js @@ -0,0 +1,27 @@ +const { sumTokens2, sumTokensExport, } = require('../helper/unwrapLPs') +const Helper = require("./Helper.js"); +const { farms: { MasterChefAddress, LockStakingAddress }, abi, token: { XWIN } } = require('./Helper.js'); + +async function tvl(_, _1, _2, { api }) { + const vaults = [ + ...Object.values(Helper.Strategies), + ...Object.values(Helper.PublicVault), + ...Object.values(Helper.PrivateVault), + ] + const bals = await api.multiCall({ abi: 'uint256:getVaultValues', calls: vaults}) + const tokens = await api.multiCall({ abi: 'address:baseToken', calls: vaults}) + api.addTokens(tokens, bals) +} + +async function pool2(_, _1, _2, { api }) { + const data = await api.fetchList({ lengthAbi: abi.poolLength, itemAbi: abi.poolInfoMaster, target: MasterChefAddress, }) + return sumTokens2({ api, owner: MasterChefAddress, tokens: data.map(i => i[0]), resolveLP: true, blacklistedTokens: [XWIN, LockStakingAddress] }) +} + +module.exports = { + bsc: { + tvl, + pool2, + staking: sumTokensExport({ owners: [MasterChefAddress, LockStakingAddress], tokens: [XWIN]}) + }, +}; diff --git a/projects/xbacked/index.js b/projects/xbacked/index.js new file mode 100644 index 00000000000..81211b02bac --- /dev/null +++ b/projects/xbacked/index.js @@ -0,0 +1,12 @@ +const { get } = require('../helper/http'); + +module.exports = { + timetravel: false, + misrepresentedTokens: true, + methodology: "Sums the total locked collateral value in usd across all vaults.", + algorand: { + tvl: async () => { + return { tether: await get('http://mainnet.collector.xbacked.io:4001/api/v1/getTVL') }; + } + }, +} \ No newline at end of file diff --git a/projects/xbank/index.js b/projects/xbank/index.js new file mode 100644 index 00000000000..c9e3f5ef784 --- /dev/null +++ b/projects/xbank/index.js @@ -0,0 +1,8 @@ +const { compoundExports2 } = require('../helper/compound'); + +module.exports = { + era: compoundExports2({ + comptroller: '0xC6d329a2C3f8cFDECAe7FeEc387fa633C6520991', + cether: '0xE4622A57Ab8F4168b80015BBA28fA70fb64fa246', + }) +}; \ No newline at end of file diff --git a/projects/xbluefinance/index.js b/projects/xbluefinance/index.js new file mode 100644 index 00000000000..9649d9da6a4 --- /dev/null +++ b/projects/xbluefinance/index.js @@ -0,0 +1,8 @@ +const { masterchefExports } = require('../helper/unknownTokens') + +module.exports = masterchefExports({ + chain: 'arbitrum', + useDefaultCoreAssets: true, + masterchef: '0xd139490F63d220CacA960DA9E40Ad59Fc3AdcB15', + nativeToken: '0x50AA7A13B28EeA97dc6C3f5E8aaa7fE512e7306D', +}) \ No newline at end of file diff --git a/projects/xcadnetwork/index.js b/projects/xcadnetwork/index.js deleted file mode 100644 index c10c924fff0..00000000000 --- a/projects/xcadnetwork/index.js +++ /dev/null @@ -1,51 +0,0 @@ -const { - getZilliqaBalance, - getBalances, -} = require('../helper/chain/zilliqa') - -// taken from https://swap.xcadnetwork.com/_next/data/E6YkkwWJMYjzQhGDTm38j/pool-overview.json -const TOKENS = [ - "0x153feaddc48871108e286de3304b9597c817b456", // XCAD - "0x818ca2e217e060ad17b7bd0124a483a1f66930a9", // zUSDT - "0x201C44B426D85fB2c382563483140825Fd81b9b5", // zOPUL - "0x31bFa2054B7199F936733f9054DBCE259a3c335a", // Lunr - "0x9945a0da3dc74e364da4ea96946c99336013eeb5", // Heroes Of Lowhelm - "0xbf79e16872fad92c16810ddd2a7b9b6858c7b756", // CARBON Token - "0x3a683fdc022b26d755c70e9ed7cfcc446658018b", // PackagePortal Token - "0x91228A48AEA4E4071B9C6444Eb08B021399CfF7c", // Unifees Token - "0xa3eAFd5021F6B9c36fD02Ed58aa1d015F2238791", // ZILStream - "0xa845C1034CD077bD8D32be0447239c7E4be6cb21", // Governance ZIL - "0xb393C898b3d261C362a4987CaE5a833232AA666E", // Score - "0x173Ca6770Aa56EB00511Dac8e6E13B3D7f16a5a5", // XSGD - "0xaCb721d989c095c64A24d16DfD23b08D738e2552", // REDChillies - "0x75fA7D8BA6BEd4a68774c758A5e43Cfb6633D9d6", // zWBTC - "0x2cA315F4329654614d1E8321f9C252921192c5f2", // zETH - "0x4268C34dA6Ad41a4cDeAa25cdEF6531Ed0c9a1A2", // BLOX - "0x2fc7167c3Baff89E2805Aef72636ccD98eE6Bbb2", // DeMons - "0x32339fa037f7ae1DfFF25e13c6451a80289D61F4", // Brokoli - "0xC6Bb661eDA683BdC792b3e456A206a92cc3cB92e", // DUCKDUCK - "0x9bd504b1445fdb8f4a643453ec1459bb9a2f988a", // XIDR - "0x54aE64e2092749fb8d25470ffc1d4D6A19c6f2Ab", // Okipad - "0x083196549637fAf95C91EcCD157E60430e69E1A7" // Sparda Wallet -] - -const DEX_CONTRACT_ADDRESS = '0x1fb1a4fd7ba94b1617641d6022ba48cafa77eef0' - -async function tvl() { - const balances = {} - const allContracts = [DEX_CONTRACT_ADDRESS, - // ...SUB_CONTRACT - ] - balances['zilliqa'] = await getZilliqaBalance(DEX_CONTRACT_ADDRESS) - await getBalances(TOKENS, allContracts, balances) - return balances -} - -module.exports = { - zilliqa: { - tvl, - }, - timetravel: false, - misrepresentedTokens: true, - methodology: 'Summed up all the tokens deposited in their dex contract and those controlled by their dex' -} \ No newline at end of file diff --git a/projects/xcarnival/helper/abis/index.js b/projects/xcarnival/helper/abis/index.js index 3389ccebb07..f6139a8a208 100644 --- a/projects/xcarnival/helper/abis/index.js +++ b/projects/xcarnival/helper/abis/index.js @@ -1,60 +1,7 @@ -const XETH_ABI = [{ - "inputs": [], - "name": "totalBorrows", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }] -const PRICEORACLE_ABI = [{ - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "prices", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }] +const XETH_ABI = 'uint256:totalBorrows' +const PRICEORACLE_ABI = 'function prices(address, address) view returns (uint256)' -const ERC721_ABI = [{ - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }] +const ERC721_ABI = 'function balanceOf(address owner) view returns (uint256)' module.exports = { XETH_ABI, PRICEORACLE_ABI, diff --git a/projects/xcarnival/helper/index.js b/projects/xcarnival/helper/index.js index 9495189c3c7..fb4c973d574 100644 --- a/projects/xcarnival/helper/index.js +++ b/projects/xcarnival/helper/index.js @@ -16,9 +16,7 @@ async function getTVL(balances, chain, timestamp, chainBlocks) { target: PRICEORACLE, params: [address, "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE"], })), - abi: abi.PRICEORACLE_ABI.find( - (a) => a.name === "prices" - ), + abi: abi.PRICEORACLE_ABI, block, chain, }), @@ -27,9 +25,7 @@ async function getTVL(balances, chain, timestamp, chainBlocks) { target: address, params: [XNFT], })), - abi: abi.ERC721_ABI.find( - (a) => a.name === "balanceOf" - ), + abi: abi.ERC721_ABI, block, chain, }) @@ -51,9 +47,7 @@ async function getBorrowed(balances, chain, timestamp, chainBlocks) { sdk.api.abi.call({ target: XETH, params: [], - abi: abi.XETH_ABI.find( - (a) => a.name === "totalBorrows" - ), + abi: abi.XETH_ABI, block, chain, }), diff --git a/projects/xdai/index.js b/projects/xdai/index.js index e0c3d9fd9e6..a3cb007350d 100644 --- a/projects/xdai/index.js +++ b/projects/xdai/index.js @@ -1,30 +1,10 @@ -const sdk = require('@defillama/sdk'); -const axios = require('axios'); -const { getBlock } = require('../helper/getBlock'); - -async function balancesInAddress(address, chain, chainId, block) { - const allTokens = (await axios.get(`https://api.covalenthq.com/v1/${chainId}/address/${address}/balances_v2/?&key=ckey_72cd3b74b4a048c9bc671f7c5a6`)).data.data.items - .filter(t=>t.contract_address !== "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee") - - const balanceOfOmniBridge = block > 10590093 - ? await sdk.api.abi.multiCall({ - block, - calls: allTokens.map((token) => ({ - target: token.contract_address, - params: omniBridge - })), - chain, - abi: 'erc20:balanceOf' - }) - : { output: [] }; - const balances = {} - sdk.util.sumMultiBalanceOf(balances, balanceOfOmniBridge) - return balances -} +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokens2 } = require('../helper/unwrapLPs') +const { covalentGetTokens } = require('../helper/http'); const tokenAddresses = [ - '0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359', // SAI - '0x6b175474e89094c44da98b954eedeac495271d0f', // DAI + ADDRESSES.ethereum.SAI, + ADDRESSES.ethereum.DAI, //'0x06af07097c9eeb7fd685c692751d5C66db49c215' // CHAI "0x5d3a536E4D6DbD6114cc1Ead35777bAB948E3643", // cDAI ]; @@ -32,47 +12,21 @@ const omniBridge = '0x88ad09518695c6c3712AC10a214bE5109a655671'; const xDaiBridge = '0x4aa42145Aa6Ebf72e164C9bBC74fbD3788045016'; const owlToken = '0x1a5f9352af8af974bfc03399e3767df6370d82e4'; const owlBridge = '0xed7e6720ac8525ac1aeee710f08789d02cd87ecb' -async function eth(timestamp, block) { - let balances = {}; - block = await getBlock(timestamp, 'ethereum', { ethereum: block }) - - if (block > 10590093) { - balances = await balancesInAddress(omniBridge, 'ethereum', 1, block) +async function eth(timestamp, block, _, { api }) { + const ownerTokens = [ + [tokenAddresses, xDaiBridge], + [[owlToken], owlBridge], + ] + if (!block || block > 10590093) { + const tokens = await covalentGetTokens(omniBridge, 'ethereum') + ownerTokens.push([tokens, omniBridge]) } - const balanceOfXdaiBridge = await sdk.api.abi.multiCall({ - block, - calls: tokenAddresses.map((token) => ({ - target: token, - params: xDaiBridge - })), - abi: 'erc20:balanceOf' - }); - - sdk.util.sumMultiBalanceOf(balances, balanceOfXdaiBridge) - - const owlOnAmb = await sdk.api.erc20.balanceOf({ - target: owlToken, - owner: owlBridge, - block - }) - sdk.util.sumSingleBalance(balances, owlToken, owlOnAmb.output) - - return balances; -} - -const bscOmniBridge = '0xF0b456250DC9990662a6F25808cC74A6d1131Ea9' -async function bsc(timestamp, ethBlock, chainBlocks) { - return balancesInAddress(bscOmniBridge, 'bsc', 56, chainBlocks['bsc']) + return sumTokens2({ api, ownerTokens }); } module.exports = { ethereum: { tvl: eth }, - /* - bsc: { - tvl: bsc - }, - */ start: 1539028166, }; diff --git a/projects/xdao.js b/projects/xdao.js deleted file mode 100644 index 7fbf86bc563..00000000000 --- a/projects/xdao.js +++ /dev/null @@ -1,74 +0,0 @@ -const sdk = require("@defillama/sdk"); -const { get } = require('./helper/http') -const { PromisePool } = require('@supercharge/promise-pool') -const { sumTokens2, } = require('./helper/unwrapLPs') -const { getParamCalls, log } = require('./helper/utils') - -const factoryAddress = "0x72cc6E4DE47f673062c41C67505188144a0a3D84"; - -const config = { - ethereum: { - chainId: 1, blacklistedTokens: [ - '0x71eeba415a523f5c952cc2f06361d5443545ad28', // XDAO - ] - }, - bsc: { chainId: 56, }, - polygon: { chainId: 137, blacklistedTokens: [ - '0x0b91b07beb67333225a5ba0259d55aee10e3a578', // MNEP - '0x29e3e6ad4eeadf767919099ee23c907946435a70', // TNDR - ] }, - avax: { chainId: 43114, }, - fantom: { chainId: 250, }, - heco: { chainId: 128, }, - astar: { chainId: 592, }, -} - -module.exports = {}; - -Object.keys(config).forEach(chain => { - const { blacklistedTokens } = config[chain] - module.exports[chain] = { - tvl: async (_, _b, { [chain]: block }) => { - const { output: numberOfDaos } = await sdk.api.abi.call({ - target: factoryAddress, - abi: abis.numberOfDaos, - chain, block, - }) - - const calls = getParamCalls(numberOfDaos) - - let { output: daos } = await sdk.api.abi.multiCall({ - target: factoryAddress, - abi: abis.daoAt, calls, chain, block, - }) - if (daos.some(i => !i.success)) throw new Error('Error fetching dao address: ', JSON.stringify(i.input)) - - daos = daos.map(i => i.output) - log(chain, numberOfDaos) - const tokensAndOwners = [] - await PromisePool - .withConcurrency(31) - .for(daos) - .process(addDao) - - log(chain, 'fetching balances count', tokensAndOwners.length) - return sumTokens2({ tokensAndOwners, chain, block, blacklistedTokens, }); - - async function addDao(dao) { - (await getTokens(chain, dao)).forEach(i => tokensAndOwners.push([i, dao])) - } - } - } -}) - -const abis = { - daoAt: { "inputs": [{ "internalType": "uint256", "name": "_i", "type": "uint256" }], "name": "daoAt", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, - numberOfDaos: { "inputs": [], "name": "numberOfDaos", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, -} - -async function getTokens(chain, address) { - const { chainId, } = config[chain] - return ( - await get(`https://api.covalenthq.com/v1/${chainId}/address/${address}/balances_v2/?&key=ckey_72cd3b74b4a048c9bc671f7c5a6`)) - .data.items.filter(i => +i.balance > 0).map((t) => t.contract_address); -} diff --git a/projects/xdao/apiCache.js b/projects/xdao/apiCache.js index 5df3317c755..add2daa1eb3 100644 --- a/projects/xdao/apiCache.js +++ b/projects/xdao/apiCache.js @@ -1,11 +1,11 @@ const sdk = require("@defillama/sdk"); -const { get } = require('../helper/http') +const { covalentGetTokens } = require('../helper/http') const { PromisePool } = require('@supercharge/promise-pool') -const { sumTokens2, unwrapUniswapV3NFTs } = require('../helper/unwrapLPs') +const { sumTokens2, } = require('../helper/unwrapLPs') const { log, getUniqueAddresses } = require('../helper/utils') const { getCache, setCache, } = require("../helper/cache"); -const project = 'xdao' +const project = 'bulky/xdao' const factoryAddress = "0x72cc6E4DE47f673062c41C67505188144a0a3D84"; const ONE_DAY = 24 * 60 * 60 * 1000 @@ -39,7 +39,7 @@ Object.keys(config).forEach(chain => { const { blacklistedTokens } = config[chain] module.exports[chain] = { tvl: async (_, _b, { [chain]: block }) => { - const cache = getCache(project, chain) + const cache = await getCache(project, chain) if (!cache.daos) cache.daos = {} const { output: numberOfDaos } = await sdk.api.abi.call({ target: factoryAddress, @@ -57,7 +57,7 @@ Object.keys(config).forEach(chain => { target: factoryAddress, abi: abis.daoAt, calls, chain, block, }) - if (daos.some(i => !i.success)) throw new Error('Error fetching dao address: ', JSON.stringify(i.input)) + if (daos.some(i => !i.success)) throw new Error('Error fetching dao address: ') daos = daos.map(i => i.output) daos = [daos, Object.keys(cache.daos)].flat() @@ -69,7 +69,7 @@ Object.keys(config).forEach(chain => { .for(daos) .process(addDao) - setCache(project, chain, cache) + await setCache(project, chain, cache) log(chain, 'fetching balances count', tokensAndOwners.length) return sumTokens2({ tokensAndOwners, chain, block, blacklistedTokens, }) @@ -79,7 +79,7 @@ Object.keys(config).forEach(chain => { const timeNow = +Date.now() if (!time || timeNow > (time + cacheDuration)) { - tokens = await getTokens(chain, dao) + tokens = await covalentGetTokens(dao, chain) cache.daos[dao] = { time: timeNow, tokens } } tokens.forEach(i => tokensAndOwners.push([i, dao])) @@ -89,13 +89,6 @@ Object.keys(config).forEach(chain => { }) const abis = { - daoAt: { "inputs": [{ "internalType": "uint256", "name": "_i", "type": "uint256" }], "name": "daoAt", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, - numberOfDaos: { "inputs": [], "name": "numberOfDaos", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, -} - -async function getTokens(chain, address) { - const { chainId, } = config[chain] - return ( - await get(`https://api.covalenthq.com/v1/${chainId}/address/${address}/balances_v2/?&key=ckey_72cd3b74b4a048c9bc671f7c5a6`)) - .data.items.filter(i => +i.balance > 0).map((t) => t.contract_address); + daoAt: "function daoAt(uint256 _i) view returns (address)", + numberOfDaos: "uint256:numberOfDaos", } diff --git a/projects/xdefi/index.js b/projects/xdefi/index.js index 18f13c5b450..37708c2ce2d 100644 --- a/projects/xdefi/index.js +++ b/projects/xdefi/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const BigNumber = require('bignumber.js') const { GraphQLClient, gql, request } = require('graphql-request') @@ -61,10 +62,10 @@ async function fetch() { } ` const ethAddress = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"; - const wethAddress = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"; - const usdt = "0xdac17f958d2ee523a2206206994597c13d831ec7" - const dai = "0x6b175474e89094c44da98b954eedeac495271d0f" - const usdc = "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" + const wethAddress = ADDRESSES.ethereum.WETH; + const usdt = ADDRESSES.ethereum.USDT + const dai = ADDRESSES.ethereum.DAI + const usdc = ADDRESSES.ethereum.USDC const { tokenPrices } = await request(xdexApi, tokenPriceQuery, { ids: Object.keys(tokenDataWithLocked).concat(wethAddress) }) @@ -93,5 +94,8 @@ async function fetch() { } module.exports = { + ethereum: { + fetch + }, fetch } diff --git a/projects/xdollar-finance/getEntireSystemColl.abi.json b/projects/xdollar-finance/getEntireSystemColl.abi.json deleted file mode 100644 index 57b2a328f03..00000000000 --- a/projects/xdollar-finance/getEntireSystemColl.abi.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "inputs": [], - "name": "getEntireSystemColl", - "outputs": [ - { - "internalType": "uint256", - "name": "entireSystemColl", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" -} diff --git a/projects/xdollar-finance/index.js b/projects/xdollar-finance/index.js index 9bf815aed2f..ed756af0d47 100644 --- a/projects/xdollar-finance/index.js +++ b/projects/xdollar-finance/index.js @@ -1,28 +1,28 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const BigNumber = require('bignumber.js') const { transformBalances } = require('../helper/portedTokens.js') -const getEntireSystemCollAbi = require("./getEntireSystemColl.abi.json") const { staking } = require('../helper/staking') const {getLiquityTvl} = require('../helper/liquity') -const ETH_ADDR = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"; -const BTC_ADDR = "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599"; -const USDC_ADDR = "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"; +const ETH_ADDR = ADDRESSES.ethereum.WETH; +const BTC_ADDR = ADDRESSES.ethereum.WBTC; +const USDC_ADDR = ADDRESSES.ethereum.USDC; const iotexTMs = { - "0x366D48c04B0d315acF27Bd358558e92D4e2E9f3D": "0xa00744882684c3e4747faefd68d283ea44099d03", // WIOTX - "0x7204e2f210865aA1854F33B3532ab2DEb386CB59": "0xa00744882684c3e4747faefd68d283ea44099d03", // WIOTX v2 + "0x366D48c04B0d315acF27Bd358558e92D4e2E9f3D": ADDRESSES.iotex.WIOTX, // WIOTX + "0x7204e2f210865aA1854F33B3532ab2DEb386CB59": ADDRESSES.iotex.WIOTX, // WIOTX v2 } const iotexStableAPs = { - "0x8Af0EE5A98609fEdaf301Af74d3ca4Da614eaD43": "0x84abcb2832be606341a50128aeb1db43aa017449", // BUSD_b - "0xF524F844216069b167d65DCe68B24F3358260BD5": "0x6fbcdc1169b5130c59e72e51ed68a84841c98cd1", // USDT - // "0x206aAF608d1DD7eA9Db4b8460B2Bf8647522f90a": "0xd6070ae98b8069de6b494332d1a1a81b6179d960", // any - "0x84724DAEC2943B1FDd5250ffcF64dfa290606250": "0x84abcb2832be606341a50128aeb1db43aa017449", // BUSD_b v2 - "0xc67cF429b055D664c7Ba06c9F5D17d0692C554fC": "0x6fbcdc1169b5130c59e72e51ed68a84841c98cd1", // USDT v2 + "0x8Af0EE5A98609fEdaf301Af74d3ca4Da614eaD43": ADDRESSES.iotex.BUSD_bsc, // BUSD_b + "0xF524F844216069b167d65DCe68B24F3358260BD5": ADDRESSES.iotex.ioUSDT, // USDT + // "0x206aAF608d1DD7eA9Db4b8460B2Bf8647522f90a": ADDRESSES.iotex.anyXIM, // any + "0x84724DAEC2943B1FDd5250ffcF64dfa290606250": ADDRESSES.iotex.BUSD_bsc, // BUSD_b v2 + "0xc67cF429b055D664c7Ba06c9F5D17d0692C554fC": ADDRESSES.iotex.ioUSDT, // USDT v2 } const ethStables = { - "0xC0eb7718fF1B5fBF11cd314CbC212c167bF341DB": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", // USDC + "0xC0eb7718fF1B5fBF11cd314CbC212c167bF341DB": ADDRESSES.ethereum.USDC, // USDC } // node test.js projects/xdollar-finance/index.js @@ -39,7 +39,7 @@ const iotexTvl = async (timestamp, ethBlock, chainBlocks) => { let getCollResults = await sdk.api.abi.multiCall({ block: chainBlocks.iotex, calls: calls, - abi: getEntireSystemCollAbi, + abi: "uint256:getEntireSystemColl", chain: 'iotex' }); @@ -125,15 +125,15 @@ module.exports = { ]) }, arbitrum: { - tvl: getLiquityTvl('0x82aF49447D8a07e3bd95BD0d56f35241523fBab1',"0x561d2d58bdad7a723a2cf71e8909a409dc2112ec", "arbitrum"), + tvl: getLiquityTvl(ADDRESSES.arbitrum.WETH,"0x561d2d58bdad7a723a2cf71e8909a409dc2112ec", "arbitrum"), staking: staking('0xc3fbc4056689cfab3f23809aa25004899ff4d75a','0x9eF758aC000a354479e538B8b2f01b917b8e89e7', 'arbitrum'), }, polygon: { - tvl: getLiquityTvl('0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270',"0x68738A47d40C34d890168aB7B612A6f649f395e4", "polygon"), + tvl: getLiquityTvl(ADDRESSES.polygon.WMATIC_2,"0x68738A47d40C34d890168aB7B612A6f649f395e4", "polygon"), staking: staking('0x3509f19581afedeff07c53592bc0ca84e4855475','0x3dc7b06dd0b1f08ef9acbbd2564f8605b4868eea', 'polygon'), }, avax: { - tvl: getLiquityTvl('0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7',"0x561d2d58bdad7a723a2cf71e8909a409dc2112ec", "avax"), + tvl: getLiquityTvl(ADDRESSES.avax.WAVAX,"0x561d2d58bdad7a723a2cf71e8909a409dc2112ec", "avax"), staking: staking('0x68738a47d40c34d890168ab7b612a6f649f395e4','0x9ef758ac000a354479e538b8b2f01b917b8e89e7', 'avax', 'polygon:0x3dc7b06dd0b1f08ef9acbbd2564f8605b4868eea'), }, hallmarks: [ diff --git a/projects/xenophon/index.js b/projects/xenophon/index.js index 006529b1288..e7f1c07465e 100644 --- a/projects/xenophon/index.js +++ b/projects/xenophon/index.js @@ -1,10 +1,11 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { ohmTvl } = require("../helper/ohm"); const xph = "0x3e29633846E8b857B7f6d7f293F895186804264b"; const treasury = "0x4b69C32450cE85d76aC94215fb81C21B434696eA"; const staking = "0xE90afe3349E42f416406c592f4B7192265085695"; const treasurytokens = [ - ["0xe9e7cea3dedca5984780bafc599bd69add087d56", false], // BUSD + [ADDRESSES.bsc.BUSD, false], // BUSD ["0x5866d1032b5b6001429Bf2A47B830bDC0DD138EA", true] // XPH-BUSD CAKE LP ] diff --git a/projects/xensa/abi.json b/projects/xensa/abi.json deleted file mode 100644 index 1658e1b0b86..00000000000 --- a/projects/xensa/abi.json +++ /dev/null @@ -1,304 +0,0 @@ -{ - "getReservesList":{"inputs":[],"name":"getReservesList","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"}, - "getAMMReserveData":{"inputs":[{"internalType":"address","name":"asset","type":"address"}],"name":"getReserveData","outputs":[{"components":[{"components":[{"internalType":"uint256","name":"data","type":"uint256"}],"internalType":"struct DataTypes.ReserveConfigurationMap","name":"configuration","type":"tuple"},{"internalType":"uint128","name":"liquidityIndex","type":"uint128"},{"internalType":"uint128","name":"variableBorrowIndex","type":"uint128"},{"internalType":"uint128","name":"currentLiquidityRate","type":"uint128"},{"internalType":"uint128","name":"currentVariableBorrowRate","type":"uint128"},{"internalType":"uint128","name":"currentStableBorrowRate","type":"uint128"},{"internalType":"uint40","name":"lastUpdateTimestamp","type":"uint40"},{"internalType":"address","name":"aTokenAddress","type":"address"},{"internalType":"address","name":"stableDebtTokenAddress","type":"address"},{"internalType":"address","name":"variableDebtTokenAddress","type":"address"},{"internalType":"address","name":"interestRateStrategyAddress","type":"address"},{"internalType":"uint8","name":"id","type":"uint8"}],"internalType":"struct DataTypes.ReserveData","name":"","type":"tuple"}],"stateMutability":"view","type":"function"}, - "getCurrentTokens":{"constant":true,"inputs":[],"name":"getCurrentTokens","outputs":[{"internalType":"address[]","name":"tokens","type":"address[]"}],"payable":false,"stateMutability":"view","type":"function"}, - "getReserveData": { - "constant": true, - "inputs": [ - { - "internalType": "address", - "name": "_reserve", - "type": "address" - } - ], - "name": "getReserveData", - "outputs": [ - { - "internalType": "uint256", - "name": "totalLiquidity", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "availableLiquidity", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalBorrowsStable", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalBorrowsVariable", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "liquidityRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "variableBorrowRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "stableBorrowRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "averageStableBorrowRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "utilizationRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "liquidityIndex", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "variableBorrowIndex", - "type": "uint256" - }, - { - "internalType": "address", - "name": "aTokenAddress", - "type": "address" - }, - { - "internalType": "uint40", - "name": "lastUpdateTimestamp", - "type": "uint40" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "getReserveConfigurationData": { - "constant": true, - "inputs": [ - { - "internalType": "address", - "name": "_reserve", - "type": "address" - } - ], - "name": "getReserveConfigurationData", - "outputs": [ - { - "internalType": "uint256", - "name": "ltv", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "liquidationThreshold", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "liquidationBonus", - "type": "uint256" - }, - { - "internalType": "address", - "name": "interestRateStrategyAddress", - "type": "address" - }, - { - "internalType": "bool", - "name": "usageAsCollateralEnabled", - "type": "bool" - }, - { - "internalType": "bool", - "name": "borrowingEnabled", - "type": "bool" - }, - { - "internalType": "bool", - "name": "stableBorrowRateEnabled", - "type": "bool" - }, - { - "internalType": "bool", - "name": "isActive", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "getReserves": { - "constant": true, - "inputs": [], - "name": "getReserves", - "outputs": [ - { - "internalType": "address[]", - "name": "", - "type": "address[]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "getAddressesProvidersList": { - "inputs": [], - "name": "getAddressesProvidersList", - "outputs": [ - { - "internalType": "address[]", - "name": "", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getAddress": { - "inputs": [ - { - "internalType": "bytes32", - "name": "id", - "type": "bytes32" - } - ], - "name": "getAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getAllATokens": { - "inputs": [], - "name": "getAllATokens", - "outputs": [ - { - "components": [ - { - "internalType": "string", - "name": "symbol", - "type": "string" - }, - { - "internalType": "address", - "name": "tokenAddress", - "type": "address" - } - ], - "internalType": "struct AaveProtocolDataProvider.TokenData[]", - "name": "", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getUnderlying": { - "inputs": [], - "name": "UNDERLYING_ASSET_ADDRESS", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getReserveDataV2": { - "inputs": [ - { - "internalType": "address", - "name": "asset", - "type": "address" - } - ], - "name": "getReserveData", - "outputs": [ - { - "internalType": "uint256", - "name": "availableLiquidity", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalStableDebt", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalVariableDebt", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "liquidityRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "variableBorrowRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "stableBorrowRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "averageStableBorrowRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "liquidityIndex", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "variableBorrowIndex", - "type": "uint256" - }, - { - "internalType": "uint40", - "name": "lastUpdateTimestamp", - "type": "uint40" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getBPool": { - "inputs": [], - "name": "bPool", - "outputs": [ - { - "internalType": "contract IBPool", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } -} diff --git a/projects/xensa/index.js b/projects/xensa/index.js index 0e0c3af865e..177f675e992 100644 --- a/projects/xensa/index.js +++ b/projects/xensa/index.js @@ -1,50 +1,21 @@ -const sdk = require("@defillama/sdk"); -const abi = require('./abi.json'); + +const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') const _xensaCoreAddress = '0xd1242313461dd533279f0cac0dbc06ecdb878a79'; -async function tvl(timestamp, _ethBlock, chainBlocks) { - const block = chainBlocks.okexchain +async function tvl(timestamp, _ethBlock, chainBlocks, { api }) { const reserves_xensa = ( - await sdk.api.abi.call({ + await api.call({ target: _xensaCoreAddress, - abi: abi["getReserves"], - block, - chain: 'okexchain' + abi: "address[]:getReserves", }) - ).output.filter(addr=>addr!=="0x1111111111111111111111111111111111111111"); - - const balance_okt = ( - await sdk.api.eth.getBalance({ - target: _xensaCoreAddress, - block, - chain: 'okexchain' - }) - ).output; - - - const balanceOfResults = await sdk.api.abi.multiCall({ - block, - chain: 'okexchain', - calls: reserves_xensa.map((reserve) => ({ - target: reserve, - params: _xensaCoreAddress, - })), - abi: "erc20:balanceOf", - }) - - const balances = {}; - balances['okexchain:0x8f8526dbfd6e38e3d8307702ca8469bae6c56c15'] = balance_okt - const transform = addr=>`okexchain:${addr}`// await transformAddress() - sdk.util.sumMultiBalanceOf(balances, balanceOfResults, true, transform) - - return balances; - + ).filter(addr=>addr!=="0x1111111111111111111111111111111111111111") + return sumTokens2({ api, owner: _xensaCoreAddress, tokens: [...reserves_xensa, nullAddress], resolveLP: true, }) } module.exports = { methodology: 'Using the same methodology applied to other lending platforms, TVL for Xensa consists deposits made to the protocol and borrowed tokens are not counted.', okexchain:{ - tvl, + tvl: () => 0 }, }; diff --git a/projects/xeus/api.js b/projects/xeus/api.js new file mode 100644 index 00000000000..606277d1561 --- /dev/null +++ b/projects/xeus/api.js @@ -0,0 +1,4 @@ +const index = require('./index') +const { ohmStaking } = require('../helper/treasury') + +module.exports = ohmStaking(index) \ No newline at end of file diff --git a/projects/xeus/index.js b/projects/xeus/index.js index 2449252fbcd..835a285d08a 100644 --- a/projects/xeus/index.js +++ b/projects/xeus/index.js @@ -1,9 +1,10 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { ohmTvl } = require('../helper/ohm') const treasury = "0xF1081555011689cCCfa29CCA6a9E6AFcB907B0bC" module.exports = ohmTvl(treasury, [ //BUSD - ["0xe9e7cea3dedca5984780bafc599bd69add087d56", false], + [ADDRESSES.bsc.BUSD, false], //DAI ["0xE50c40B0B84946D7491337613059F181700ddBEa", false], //pancakeswap LP diff --git a/projects/xlsd/index.js b/projects/xlsd/index.js new file mode 100644 index 00000000000..6b2d0f04b4d --- /dev/null +++ b/projects/xlsd/index.js @@ -0,0 +1,12 @@ +const { sumTokensExport } = require("../helper/unwrapLPs"); + +const LSD_TOKENS = ['0xf40F19CAFaAA25bF9B52134646c6E325E76E0e93']; +const STAKING_POOL_ADDRESS = ['0x61CeC27ba136347ddA0AEDBe29a9b8219C32fF04']; + +module.exports = { + methodology: "TVL of Staked ETH & LSD tokens in the StakingPool contracts", + arbitrum: { + tvl: () => ({}), + staking: sumTokensExport({ tokensAndOwners2: [LSD_TOKENS, STAKING_POOL_ADDRESS], }), + }, +}; diff --git a/projects/xpla/index.js b/projects/xpla/index.js new file mode 100644 index 00000000000..19430cd40f3 --- /dev/null +++ b/projects/xpla/index.js @@ -0,0 +1,10 @@ +const { getFactoryTvl } = require('../terraswap/factoryTvl') + +module.exports = { + timetravel: false, + misrepresentedTokens: true, + methodology: "Liquidity on the DEX", + xpla: { + tvl: getFactoryTvl('xpla1j33xdql0h4kpgj2mhggy4vutw655u90z7nyj4afhxgj4v5urtadq44e3vd') + }, +} \ No newline at end of file diff --git a/projects/xrayswap/index.js b/projects/xrayswap/index.js index 26a4cc64032..3040d33a6d4 100644 --- a/projects/xrayswap/index.js +++ b/projects/xrayswap/index.js @@ -3,7 +3,4 @@ const { masterChefExports } = require("../helper/masterchef"); const masterchef = "0xD35a150Ec317a8a187C52FC1164b4D15C0851b84"; const token = "0x12C415aAFB1A521B42251e972BB7Ce6795F7669b"; -module.exports = { - misrepresentedTokens: true, - ...masterChefExports(masterchef, "bsc", token, false) -} \ No newline at end of file +module.exports = masterChefExports(masterchef, "bsc", token) \ No newline at end of file diff --git a/projects/xrune/abi.json b/projects/xrune/abi.json index 0ea9aac049a..7e755d4472c 100644 --- a/projects/xrune/abi.json +++ b/projects/xrune/abi.json @@ -1,53 +1,5 @@ { - "getPrice": { - "constant": true, - "inputs": [ - { - "internalType": "address", - "name": "asset", - "type": "address" - } - ], - "name": "getPrice", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "getTotal": { - "constant": true, - "inputs": [], - "name": "getTotal", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "getPoolAddress": { - "constant": true, - "inputs": [], - "name": "getPoolAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } -} + "getPrice": "function getPrice(address asset) view returns (uint256)", + "getTotal": "uint256:getTotal", + "getPoolAddress": "address:getPoolAddress" +} \ No newline at end of file diff --git a/projects/xsigma/index.js b/projects/xsigma/index.js index fd9b1ed9393..03f70664281 100644 --- a/projects/xsigma/index.js +++ b/projects/xsigma/index.js @@ -1,12 +1,13 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const { staking } = require("../helper/staking"); const { pool2 } = require("../helper/pool2"); const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); const SigThreePoolContract = "0x3333333ACdEdBbC9Ad7bda0876e60714195681c5"; -const USDC = "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"; -const DAI = "0x6b175474e89094c44da98b954eedeac495271d0f"; -const USDT = "0xdac17f958d2ee523a2206206994597c13d831ec7"; +const USDC = ADDRESSES.ethereum.USDC; +const DAI = ADDRESSES.ethereum.DAI; +const USDT = ADDRESSES.ethereum.USDT; const sigMasterchefContract = "0x98C32b59a0AC00Cd33750427b1A317eBcf84D0F7"; const SIG = "0x7777777777697cfeecf846a76326da79cc606517"; diff --git a/projects/xspswap/index.js b/projects/xspswap/index.js index 02e4b711e3e..045b5af23bd 100644 --- a/projects/xspswap/index.js +++ b/projects/xspswap/index.js @@ -5,7 +5,6 @@ module.exports = { xdc: { tvl: getUniTVL({ factory: '0x347D14b13a68457186b2450bb2a6c2Fd7B38352f', - chain: 'xdc', useDefaultCoreAssets: true, }) }, diff --git a/projects/xtoken/abi.json b/projects/xtoken/abi.json index 7b6927416b9..f4acdaab000 100644 --- a/projects/xtoken/abi.json +++ b/projects/xtoken/abi.json @@ -1,158 +1,13 @@ { - "getFundHoldings": { - "inputs": [], - "name": "getFundHoldings", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getNav": { - "inputs": [], - "name": "getNav", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - "totalAllocatedNav": { - "inputs": [], - "name": "totalAllocatedNav", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - "getBufferBalance": { - "inputs": [], - "name": "getBufferBalance", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - "getRewardsContributionToNav": { - "inputs": [], - "name": "getRewardsContributionToNav", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - "getFundKncBalanceTwei": { - "inputs": [], - "name": "getFundKncBalanceTwei", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "debtBalanceOf": { - "constant": true, - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "currencyKey", - "type": "bytes32" - } - ], - "name": "debtBalanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function", - "signature": "0xd37c4d8b" - }, - "getEthBalance": { - "constant": true, - "inputs": [], - "name": "getEthBalance", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "getSnxBalance": { - "constant": true, - "inputs": [], - "name": "getSnxBalance", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "getFundBalances": { - "inputs": [], - "name": "getFundBalances", - "outputs": [ - { - "internalType": "uint256", - "name": "marketBalance", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "bufferBalance", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "quoteExactInputSingle": { - "inputs": [ - { - "internalType": "address", - "name": "tokenIn", - "type": "address" - }, - { - "internalType": "address", - "name": "tokenOut", - "type": "address" - }, - { - "internalType": "uint24", - "name": "fee", - "type": "uint24" - }, - { - "internalType": "uint256", - "name": "amountIn", - "type": "uint256" - }, - { - "internalType": "uint160", - "name": "sqrtPriceLimitX96", - "type": "uint160" - } - ], - "name": "quoteExactInputSingle", - "outputs": [ - { - "internalType": "uint256", - "name": "amountOut", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - } + "getFundHoldings": "uint256:getFundHoldings", + "getNav": "uint256:getNav", + "totalAllocatedNav": "uint256:totalAllocatedNav", + "getBufferBalance": "uint256:getBufferBalance", + "getRewardsContributionToNav": "uint256:getRewardsContributionToNav", + "getFundKncBalanceTwei": "uint256:getFundKncBalanceTwei", + "debtBalanceOf": "function debtBalanceOf(address account, bytes32 currencyKey) view returns (uint256)", + "getEthBalance": "uint256:getEthBalance", + "getSnxBalance": "uint256:getSnxBalance", + "getFundBalances": "function getFundBalances() view returns (uint256 marketBalance, uint256 bufferBalance)", + "quoteExactInputSingle": "function quoteExactInputSingle(address tokenIn, address tokenOut, uint24 fee, uint256 amountIn, uint160 sqrtPriceLimitX96) returns (uint256 amountOut)" } \ No newline at end of file diff --git a/projects/xtoken/constants.js b/projects/xtoken/constants.js index 361fec40dd5..fbfb91c1456 100644 --- a/projects/xtoken/constants.js +++ b/projects/xtoken/constants.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const DEC_18 = 10 ** 18; const xaaveaAddr = "0x80DC468671316E50D4E9023D3db38D3105c1C146"; const xaavebAddr = "0x704De5696dF237c5B9ba0De9ba7e0C63dA8eA0Df"; @@ -18,35 +19,35 @@ const xu3lpfAddr = "0x4296d40183356A770Fd8cA3Ba0592f0163BE9CA3"; const xu3lpgAddr = "0x28ce95124FB0d5Febe6Ab258072848f5fe1010eC"; const xu3lphAddr = "0x9ed880b7F75a220C0450E4884521ba8d500eb4bb"; const ethrsi6040Addr = "0x93E01899c10532d76C0E864537a1D26433dBbDdB"; -const sUsdAddr = "0x57ab1e02fee23774580c119740129eac7081e9d3"; +const sUsdAddr = ADDRESSES.ethereum.sUSD_OLD; const xbntaAddr = "0x6949f1118FB09aD2567fF675f96DbB3B6985ACd0"; const alphaAddr = "0xa1faa113cbe53436df28ff0aee54275c13b40975"; const bntAddr = "0x1F573D6Fb3F13d689FF844B4cE37794d79a7FF1C"; const kncAddr = "0xdd974d5c2e2928dea5f71b9825b8b646686bd200"; const snxAddr = "0xDC01020857afbaE65224CfCeDb265d1216064c59"; -const wbtcAddr = "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599"; -const wethAddr = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"; -const snxTokenAddr = "0xc011a73ee8576fb46f5e1c5751ca3b9fe0af2a6f"; +const wbtcAddr = ADDRESSES.ethereum.WBTC; +const wethAddr = ADDRESSES.ethereum.WETH; +const snxTokenAddr = ADDRESSES.ethereum.SNX; const inchAddr = "0x111111111117dc0aa78b770fa6a738034120c302"; -const usdcAddr = "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"; -const aaveAddr = "0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9"; +const usdcAddr = ADDRESSES.ethereum.USDC; +const aaveAddr = ADDRESSES.ethereum.AAVE; const xtkAddress = "0x7F3EDcdD180Dbe4819Bd98FeE8929b5cEdB3AdEB"; const xu3lpaAddrArbitrum = "0x9F8cFc08f781e1576A05d4d3669b3E6FF22913FF"; const xu3lpbAddrArbitrum = "0x216D135926f5EC9E5924564A342580B0b5A3bdc6"; const xbtc3xAddrArbitrum = "0x93B135416A1796707b273ad709099d47ADDA18D6"; const xeth3xAddrArbitrum = "0xc4C251c7d7c2F1165176e3BF503276fB0df05daa"; -const wbtcAddrArbitrum = "0x2f2a2543b76a4166549f7aab2e75bef0aefc5b0f"; -const wethAddrArbitrum = "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1"; +const wbtcAddrArbitrum = ADDRESSES.arbitrum.WBTC; +const wethAddrArbitrum = ADDRESSES.arbitrum.WETH; const X_ETH_3X = "xETH3x" const X_BTC_3X = "xBTC3x" const WBTC = "wbtc"; const WETH = "weth"; const QUOTER_ADDRESS = '0xb27308f9F90D607463bb33eA1BeBb41C27CE5AB6' -const usdcAddress = '0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8' -const wethAddress = '0x82aF49447D8a07e3bd95BD0d56f35241523fBab1' -const usdtAddress = '0xdac17f958d2ee523a2206206994597c13d831ec7'; +const usdcAddress = ADDRESSES.arbitrum.USDC +const wethAddress = ADDRESSES.arbitrum.WETH +const usdtAddress = ADDRESSES.ethereum.USDT; const COINGECKO_API_URL = 'https://api.coingecko.com/api/v3/coins'; const urls = { "mainnet": "https://api.thegraph.com/subgraphs/name/xtokenmarket/terminal-mainnet", diff --git a/projects/xtoken/index.js b/projects/xtoken/index.js index 860d0d25071..c73eaf05fa2 100644 --- a/projects/xtoken/index.js +++ b/projects/xtoken/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json'); const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); const terminal = require("./terminal"); @@ -13,7 +14,6 @@ const { xinchbAddr, xkncaAddr, xkncbAddr, - xsnxaAddr, xsnxaAdminAddr, xsnxaTradeAccountingAddr, xu3lpaAddr, @@ -32,8 +32,6 @@ const { inchAddr, usdcAddr, aaveAddr, - usdtAddress, - xtkAddress } = require("./constants"); const BigNumber = require('bignumber.js'); const xu3lps = [ @@ -177,14 +175,14 @@ async function tvl(timestamp, block) { })).output; sdk.util.sumSingleBalance( balances, - "0x57ab1ec28d129707052df4df418d58a2d46d5f51", + ADDRESSES.ethereum.sUSD, xsnxaSusdRaw ); Object.keys(balances).forEach(key => balances[key] = BigNumber(balances[key]).toFixed(0)) return terminal.getData("mainnet", block, balances); -}; +} async function fetchOptimism() { return terminal.getData("optimism"); diff --git a/projects/xusdmoney/index.js b/projects/xusdmoney/index.js index 1c024953cf4..9a08db546eb 100644 --- a/projects/xusdmoney/index.js +++ b/projects/xusdmoney/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { staking } = require("../helper/staking"); const { pool2s } = require("../helper/pool2"); const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); @@ -13,9 +14,9 @@ const collateralPoolContracts = [ "0x75aAf03CBF330e2b3F0623c55B7a528CFCAE8d75", ]; -const WETH = "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"; -const DAI = "0x6B175474E89094C44Da98b954EedeAC495271d0F"; -const USDC = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"; +const WETH = ADDRESSES.ethereum.WETH; +const DAI = ADDRESSES.ethereum.DAI; +const USDC = ADDRESSES.ethereum.USDC; //const XUS = "0x875650dd46b60c592d5a69a6719e4e4187a3ca81"; const stakingContract = "0x6049B0831F8da67f3FE80f5FA07BD300E8f2F22C"; diff --git a/projects/xy-finance/index.js b/projects/xy-finance/index.js index 85f13231077..82d35b1847f 100644 --- a/projects/xy-finance/index.js +++ b/projects/xy-finance/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens2 } = require('../helper/unwrapLPs') const config = { @@ -40,6 +41,15 @@ const config = { klaytn: { chainId: '8217', }, + wemix: { + chainId: '1111', + }, + era: { + chainId: '324', + }, + polygon_zkevm: { + chainId: '1101', + }, } const ethAddress = '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE' @@ -51,11 +61,11 @@ const yPoolDepositContract = { }, "USDT": { "contractAddress": "0x8e921191a9dc6832C1c360C7c7B019eFB7c29B2d", - "tokenAddress": "0xdAC17F958D2ee523a2206206994597C13D831ec7" + "tokenAddress": ADDRESSES.ethereum.USDT }, "USDC": { "contractAddress": "0xdD8B0995Cc92c7377c7bce2A097EC70f45A192D5", - "tokenAddress": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48" + "tokenAddress": ADDRESSES.ethereum.USDC }, "XY": { "contractAddress": "0x7fE09D2310A647c7C5043daE2053ff86956cE952", @@ -73,49 +83,49 @@ const yPoolDepositContract = { }, "USDT": { "contractAddress": "0x74A0EEA77e342323aA463098e959612d3Fe6E686", - "tokenAddress": "0x66e428c3f67a68878562e79A0234c1F83c208770" + "tokenAddress": ADDRESSES.cronos.USDT }, "USDC": { "contractAddress": "0x44a54941E572C526a599B0ebe27A14A5BF159333", - "tokenAddress": "0xc21223249CA28397B4B6541dfFaEcC539BfF0c59" + "tokenAddress": ADDRESSES.cronos.USDC } }, "56": { "ETH": { "contractAddress": "0xa0ffc7eDB9DAa9C0831Cdf35b658e767ace33939", - "tokenAddress": "0x2170Ed0880ac9A755fd29B2688956BD959F933F8" + "tokenAddress": ADDRESSES.bsc.ETH }, "USDT": { "contractAddress": "0xD195070107d853e55Dad9A2e6e7E970c400E67b8", - "tokenAddress": "0x55d398326f99059fF775485246999027B3197955" + "tokenAddress": ADDRESSES.bsc.USDT }, "USDC": { "contractAddress": "0x27C12BCb4538b12fdf29AcB968B71dF7867b3F64", - "tokenAddress": "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d" + "tokenAddress": ADDRESSES.bsc.USDC } }, "108": { "USDT": { "contractAddress": "0x74A0EEA77e342323aA463098e959612d3Fe6E686", - "tokenAddress": "0x4f3C8E20942461e2c3Bdd8311AC57B0c222f2b82" + "tokenAddress": ADDRESSES.thundercore.TT_USDT }, "USDC": { "contractAddress": "0x2641911948e0780e615A9465188D975Fa4A72f2c", - "tokenAddress": "0x22e89898A04eaf43379BeB70bf4E38b1faf8A31e" + "tokenAddress": ADDRESSES.thundercore.TT_USDC } }, "137": { "ETH": { "contractAddress": "0x29d91854B1eE21604119ddc02e4e3690b9100017", - "tokenAddress": "0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619" + "tokenAddress": ADDRESSES.polygon.WETH_1 }, "USDT": { "contractAddress": "0x3243278E0F93cD6F88FC918E0714baF7169AFaB8", - "tokenAddress": "0xc2132D05D31c914a87C6611C10748AEb04B58e8F" + "tokenAddress": ADDRESSES.polygon.USDT }, "USDC": { "contractAddress": "0xf4137e5D07b476e5A30f907C3e31F9FAAB00716b", - "tokenAddress": "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174" + "tokenAddress": ADDRESSES.polygon.USDC } }, "250": { @@ -125,21 +135,21 @@ const yPoolDepositContract = { }, "USDT": { "contractAddress": "0xC255563d3Bc3Ed7dBbb8EaE076690497bfBf7Ef8", - "tokenAddress": "0x049d68029688eAbF473097a2fC38ef61633A3C7A" + "tokenAddress": ADDRESSES.fantom.fUSDT }, "USDC": { "contractAddress": "0x3A459695D49cD6B9637bC85B7ebbb04c5c3038c0", - "tokenAddress": "0x04068DA6C83AFCFA0e13ba15A6696662335D5B75" + "tokenAddress": ADDRESSES.fantom.USDC } }, "321": { "USDT": { "contractAddress": "0xF526EFc174b512e66243Cb52524C1BE720144e8d", - "tokenAddress": "0x0039f574eE5cC39bdD162E9A88e3EB1f111bAF48" + "tokenAddress": ADDRESSES.kcc.USDT }, "USDC": { "contractAddress": "0xa274931559Fb054bF60e0C44355D3558bB8bC2E6", - "tokenAddress": "0x980a5AfEf3D17aD98635F6C5aebCBAedEd3c3430" + "tokenAddress": ADDRESSES.kcc.USDC } }, "42161": { @@ -149,25 +159,25 @@ const yPoolDepositContract = { }, "USDT": { "contractAddress": "0x7a483730AD5a845ED2962c49DE38Be1661D47341", - "tokenAddress": "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9" + "tokenAddress": ADDRESSES.arbitrum.USDT }, "USDC": { "contractAddress": "0x680ab543ACd0e52035E9d409014dd57861FA1eDf", - "tokenAddress": "0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8" + "tokenAddress": ADDRESSES.arbitrum.USDC } }, "43114": { "ETH": { "contractAddress": "0xEFaaf68a9a8b7D93bb15D29c8B77FCe87Fcc91b8", - "tokenAddress": "0x49D5c2BdFfac6CE2BFdB6640F4F80f226bc10bAB" + "tokenAddress": ADDRESSES.avax.WETH_e }, "USDT": { "contractAddress": "0x3D2d1ce29B8bC997733D318170B68E63150C6586", - "tokenAddress": "0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7" + "tokenAddress": ADDRESSES.avax.USDt }, "USDC": { "contractAddress": "0x21ae3E63E06D80c69b09d967d88eD9a98c07b4e4", - "tokenAddress": "0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E" + "tokenAddress": ADDRESSES.avax.USDC } }, "10": { @@ -177,41 +187,71 @@ const yPoolDepositContract = { }, "USDT": { "contractAddress": "0xF526EFc174b512e66243Cb52524C1BE720144e8d", - "tokenAddress": "0x94b008aA00579c1307B0EF2c499aD98a8ce58e58" + "tokenAddress": ADDRESSES.optimism.USDT }, "USDC": { "contractAddress": "0x1e4992E1Be86c9d8ed7dcBFcF3665FE568dE98Ab", - "tokenAddress": "0x7F5c764cBc14f9669B88837ca1490cCa17c31607" + "tokenAddress": ADDRESSES.optimism.USDC } }, "592": { "USDT": { "contractAddress": "0xF526EFc174b512e66243Cb52524C1BE720144e8d", - "tokenAddress": "0x3795C36e7D12A8c252A20C5a7B455f7c57b60283" + "tokenAddress": ADDRESSES.astar.USDT }, "USDC": { "contractAddress": "0xD236639F5B00BC6711aC799bac5AceaF788b2Aa3", - "tokenAddress": "0x6a2d262D56735DbA19Dd70682B39F6bE9a931D98" + "tokenAddress": ADDRESSES.moonbeam.USDC } }, "1285": { "USDT": { "contractAddress": "0xF526EFc174b512e66243Cb52524C1BE720144e8d", - "tokenAddress": "0xB44a9B6905aF7c801311e8F4E76932ee959c663C" + "tokenAddress": ADDRESSES.moonriver.USDT }, "USDC": { "contractAddress": "0x680ab543ACd0e52035E9d409014dd57861FA1eDf", - "tokenAddress": "0xE3F5a90F9cb311505cd691a46596599aA1A0AD7D" + "tokenAddress": ADDRESSES.moonriver.USDC } }, "8217": { "USDT": { "contractAddress": "0xF526EFc174b512e66243Cb52524C1BE720144e8d", - "tokenAddress": "0xceE8FAF64bB97a73bb51E115Aa89C17FfA8dD167" + "tokenAddress": ADDRESSES.klaytn.oUSDT }, "USDC": { "contractAddress": "0xB238d4339a44f93aBCF4071A9bB0f55D2403Fd84", - "tokenAddress": "0x754288077D0fF82AF7a5317C7CB8c444D421d103" + "tokenAddress": ADDRESSES.klaytn.oUSDC + } + }, + "1111": { + "USDT": { + "contractAddress": "0xA5Cb30E5d30A9843B6481fFd8D8D35DDED3a3251", + "tokenAddress": "0xA649325Aa7C5093d12D6F98EB4378deAe68CE23F" + }, + "USDC": { + "contractAddress": "0x3243278E0F93cD6F88FC918E0714baF7169AFaB8", + "tokenAddress": ADDRESSES.moonriver.USDC + } + }, + "324": { + "ETH": { + "contractAddress": "0x935283A00FBF8E40fd2f8C432A488F6ADDC8dB67", + "tokenAddress": ethAddress + }, + "USDC": { + "contractAddress": "0x75167284361c8D61Be7E4402f4953e2b112233cb", + "tokenAddress": ADDRESSES.era.USDC + } + }, + "1101": { + "ETH": { + "contractAddress": "0x9fE77412aA5c6Ba67fF3095bBc534884F9a61a38", + "tokenAddress": ethAddress + }, + "USDC": { + "contractAddress": "0x1acCfC3a45313f8F862BE7fbe9aB25f20A93d598", + "tokenAddress": ADDRESSES.polygon_zkevm.USDC } }, } diff --git a/projects/y2b-finance/index.js b/projects/y2b-finance/index.js new file mode 100644 index 00000000000..e90457e14ac --- /dev/null +++ b/projects/y2b-finance/index.js @@ -0,0 +1,32 @@ +const { sumTokens2, sumTokensExport } = require('../helper/unwrapLPs') +const { getLogs } = require('../helper/cache/getLogs') + +async function tvl(timestamp, _b, chainBlocks, { api }) { + const logs = await getLogs({ + api, + fromBlock: 16310967, + eventAbi: 'event MarketCreated(uint256 indexed mIndex, address hedge, address risk, address token, string name, int256 strikePrice)', + topics: ['0xf38f00404415af51ddd0dd57ce975d015de2f40ba8a087ac48cd7552b7580f32'], + target: '0xF33C13DA4425629C3F10635E4f935D8020F97D1f', + }) + + const vaults = logs.map(({ args }) => ([args.hedge, args.risk])).flat() + const tokens = await api.multiCall({ + abi: 'address:asset', + calls: vaults, + }) + const tokensAndOwners = tokens.map((token, i) => ([token, vaults[i]])) + + return sumTokens2({ api, tokensAndOwners }) +} + + +module.exports = { + hallmarks: [ + [1673913600, "Rug Pull"] + ], + ethereum: { + tvl, + // staking: sumTokensExport({ owners: [], tokens: ['0xF9C12B27cE5058ab98ce11BD53900f84E18C0650']}) + } +} diff --git a/projects/y2k-finance/index.js b/projects/y2k-finance/index.js new file mode 100644 index 00000000000..148b5c573b3 --- /dev/null +++ b/projects/y2k-finance/index.js @@ -0,0 +1,32 @@ +const { sumTokens2, sumTokensExport } = require('../helper/unwrapLPs') +const { getLogs } = require('../helper/cache/getLogs') + +const chain = 'arbitrum' + +async function tvl(timestamp, _b, chainBlocks, { api }) { + const logs = await getLogs({ + api, + fromBlock: 33934273, + eventAbi: 'event MarketCreated(uint256 indexed mIndex, address hedge, address risk, address token, string name, int256 strikePrice)', + topics: ['0xf38f00404415af51ddd0dd57ce975d015de2f40ba8a087ac48cd7552b7580f32'], + target: '0x984e0eb8fb687afa53fc8b33e12e04967560e092', + }) + + const vaults = logs.map(({ args }) => ([args.hedge, args.risk])).flat() + const tokens = await api.multiCall({ + abi: 'address:asset', + calls: vaults, + }) + const tokensAndOwners = tokens.map((token, i) => ([token, vaults[i]])) + + return sumTokens2({ api, tokensAndOwners }) +} + + +module.exports = { + arbitrum: { + tvl, + // staking: sumTokensExport({ chain, owners: [], tokens: ['0x65c936f008BC34fE819bce9Fa5afD9dc2d49977f']}), + pool2: sumTokensExport({ chain, owners: ['0xaefd22d0153e69f3316dca9095e7279b3a2f8af2', '0xbDAA858Fd7b0DC05F8256330fAcB35de86283cA0',], tokens: ['0x569061e2d807881f4a33e1cbe1063bc614cb75a4']}) + } +} diff --git a/projects/y2k-v2/index.js b/projects/y2k-v2/index.js new file mode 100644 index 00000000000..da3dc9bf377 --- /dev/null +++ b/projects/y2k-v2/index.js @@ -0,0 +1,50 @@ +const { sumTokens2, sumTokensExport } = require('../helper/unwrapLPs') +const { getLogs } = require('../helper/cache/getLogs') + +const chain = 'arbitrum' + +async function tvl(timestamp, _b, chainBlocks, { api }) { + const logs = await getLogs({ + api, + fromBlock: 33934273, + eventAbi: 'event MarketCreated(uint256 indexed mIndex, address hedge, address risk, address token, string name, int256 strikePrice)', + topics: ['0xf38f00404415af51ddd0dd57ce975d015de2f40ba8a087ac48cd7552b7580f32'], + target: '0x984e0eb8fb687afa53fc8b33e12e04967560e092', + }) + + const vaults = logs.map(({ args }) => ([args.hedge, args.risk])).flat() + const tokens = await api.multiCall({ + abi: 'address:asset', + calls: vaults, + }) + const tokensAndOwners = tokens.map((token, i) => ([token, vaults[i]])) + + return sumTokens2({ api, tokensAndOwners }) +} + +const config = { + arbitrum: { factory: '0xC3179AC01b7D68aeD4f27a19510ffe2bfb78Ab3e', fromBlock: 96059531 , }, +} + + +Object.keys(config).forEach(chain => { + const { factory, fromBlock} = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const logs = await getLogs({ + api, + target: factory, + topics: ['0xe8066e93c2c1e100c0c76002a546075b7c6b53025db53708875180c81afda250'], + eventAbi: 'event MarketCreated (uint256 indexed marketId, address premium, address collateral, address underlyingAsset, address token, string name, uint256 strike, address controller)', + onlyArgs: true, + fromBlock, + }) + const premiums = logs.map(i => i.premium) + const collaterals = logs.map(i => i.collateral) + const pTokens = await api.multiCall({ abi: 'address:asset', calls: premiums }) + const cTokens = await api.multiCall({ abi: 'address:asset', calls: collaterals }) + return sumTokens2({ api, tokensAndOwners2: [[...pTokens, ...cTokens], [...premiums, ...collaterals]] }) + } + } +}) + diff --git a/projects/y2r/index.js b/projects/y2r/index.js index d955b05601c..83d4af303a5 100644 --- a/projects/y2r/index.js +++ b/projects/y2r/index.js @@ -2,27 +2,31 @@ const sdk = require('@defillama/sdk') const { unwrapUniswapLPs } = require("../helper/unwrapLPs") const { transformBalances, } = require('../helper/portedTokens') -const clpAddresses = { - CantoNoteLP: '0x3C96dCfd875253A37acB3D2B102b6f328349b16B', - CantoAtomLP: '0xC0D6574b2fe71eED8Cd305df0DA2323237322557', - NoteUSDTLP: '0xf0cd6b5cE8A01D1B81F1d8B76643866c5816b49F', - NoteUSDCLP: '0xD6a97e43FC885A83E97d599796458A331E580800', - CantoETHLP: '0xb49A395B39A0b410675406bEE7bD06330CB503E3', -} const vaultAddresses = { - CantoNoteLP: '0xe9F857be65E73c0bc86BCbb35cA8aFAB4d70e178', - CantoAtomLP: '0x698880B18B237BD042440BCB23e0134a38d3295b', - NoteUSDTLP: '0x72987Fa687496F3797d944BFCfddAdBe306581AE', - NoteUSDCLP: '0x541ebf0a46c3138098bcebe1698dA3FDb6BA8f8A', - CantoETHLP: '0x3f1CbcF0495928b0f347b50ceCFd8641BBc44A7f', + CantoNoteLP: '0x89Dc2cc570E40E9cCE0364ecf0e14347215156fF', + CantoAtomLP: '0x1442261A3ed64620B10c3c015a4C7553422137EA', + NoteUSDTLP: '0xd6Cb001d4aB7939Ab766ea577D7978FcE1212529', + NoteUSDCLP: '0xD6F6c81C5885a143227D24E4B3555AdbD696e1a2', + CantoETHLP: '0xd535845D5aA2b6B81aa8f5AA048358afbC93a33C', + + vCantoFlow: '0xa492DFa8D448f4B0d998a416A30FC4678d057304', + vNoteFlow: '0x4DF1ACfBadf2ebA8BE500205dF435f8445359aB3', + vNoteCanto: '0x64A982A8A750CC3D9a83b8276423adB1a8d07251', + vCantoAtom: '0x671aDb6af35Bc8508d67DBE8683a7eb8612b7aB9', + vCantoETH: '0xDE08DC04e2DeC9f1d9E3E79Ee609184CF101169b', + vCINUCanto: '0x8de89E06EF165Df31AF819873AB6FB62540155bd', + vCBONKCanto: '0x2ec3f5b72A2eb8765386A68c11BefBd9701583E4', + vETHFlow: '0xfa91ff70E06ceE35e85eBAC7223E1A92ad51cEEC', + vCantoSomm: '0x6D5FD9991c85bF1256D76F4b254558d2851058ef', + vCantoGrav: '0xB3A7c46283AC1538a6dcd2a9eBa7691181a2fC4e', + vFlowUSDT: '0xE1b05d4f2A61c32B3deAD4fc6BA0f07d595a4f8B', } const lps = Object.keys(vaultAddresses) const chain = 'canto' async function tvl(_, _b, { canto: block }) { - const calls = lps.map(k => ({ target: clpAddresses[k], })) - const calls2 = lps.map(k => ({ params: vaultAddresses[k], target: clpAddresses[k] })) + const calls = lps.map(k => ({ target: vaultAddresses[k], })) const lpPositions = [] const balances = {} @@ -30,8 +34,8 @@ async function tvl(_, _b, { canto: block }) { { output: token, }, { output: balance, }, ] = await Promise.all([ - sdk.api.abi.multiCall({ abi: abis.underlying, calls, chain, block, }), - sdk.api.abi.multiCall({ abi: abis.balanceOfUnderlying, calls: calls2, chain, block, }), + sdk.api.abi.multiCall({ abi: abis.want, calls, chain, block, }), + sdk.api.abi.multiCall({ abi: abis.balance, calls, chain, block, }), ]) balance.forEach(({ output, }, i) => lpPositions.push({ token: token[i].output, balance: output, })) @@ -47,7 +51,7 @@ module.exports = { }, }; -const abis = { - balanceOfUnderlying: { "type": "function", "stateMutability": "nonpayable", "outputs": [{ "type": "uint256", "name": "", "internalType": "uint256" }], "name": "balanceOfUnderlying", "inputs": [{ "type": "address", "name": "owner", "internalType": "address" }] }, - underlying: { "type": "function", "stateMutability": "view", "outputs": [{ "type": "address", "name": "", "internalType": "address" }], "name": "underlying", "inputs": [] }, +const abis ={ + balance: "function balance() returns (uint256)", + want: "address:want", } \ No newline at end of file diff --git a/projects/yama-finance/index.js b/projects/yama-finance/index.js new file mode 100644 index 00000000000..ff97168556e --- /dev/null +++ b/projects/yama-finance/index.js @@ -0,0 +1,27 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { getLogs } = require('../helper/cache/getLogs') +const { sumTokens2 } = require('../helper/unwrapLPs') + +async function tvl(_, _b, _cb, { api, }) { + const CDP = '0x1cd97ee98f3423222f7b4cddb383f2ee2907e628' + const logs = await getLogs({ + api, + target: CDP, + topic: 'AddCollateralType(uint256,address,address,uint256,uint256,uint256,uint256,bool,bool)', + eventAbi: 'event AddCollateralType(uint256 indexed collateralTypeId, address indexed token, address priceSource, uint256 debtFloor, uint256 debtCeiling, uint256 collateralRatio, uint256 interestRate, bool borrowingEnabled, bool allowlistEnabled)', + onlyArgs: true, + fromBlock: 72920436, + }) + + const ownerTokens = [ + [[ADDRESSES.arbitrum.USDT], '0x0e1Ddf8D61f0570Bf786594077CD431c727335A9'], // psm module + ] + + ownerTokens.push([logs.map(i => i.token), CDP]) + + return sumTokens2({ api, ownerTokens}) +} + +module.exports = { arbitrum: { tvl }} +module.exports.methodology = "mooGmxGLP in CDP Module and USDT in PSM"; + diff --git a/projects/yaxis/abi.js b/projects/yaxis/abi.js index 0621de10fed..bd2535b7fd5 100644 --- a/projects/yaxis/abi.js +++ b/projects/yaxis/abi.js @@ -1,55 +1,8 @@ const abi = { - yAxisBar: { - name: "availableBalance", - inputs: [], - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, - yAxisMetaVault: { - name: "balance", - inputs: [], - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, - votingEscrow: { - name: "supply", - inputs: [], - outputs: [ - { - type: "uint256", - name: "", - }, - ], - stateMutability: "view", - type: "function", - }, - vault: { - inputs: [], - name: "balanceOfThis", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, + yAxisBar: "uint256:availableBalance", + yAxisMetaVault: "uint256:balance", + votingEscrow: "uint256:supply", + vault: "uint256:balanceOfThis", }; module.exports = { abi }; diff --git a/projects/yaxis/index.js b/projects/yaxis/index.js index 24ab1f70e06..92680466484 100644 --- a/projects/yaxis/index.js +++ b/projects/yaxis/index.js @@ -1,162 +1,36 @@ +const { staking } = require('../helper/staking') +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const BigNumber = require("bignumber.js"); -const { unwrapCrv, unwrapUniswapLPs, unwrapYearn } = require("../helper/unwrapLPs"); +const { unwrapUniswapLPs, } = require("../helper/unwrapLPs"); const { abi } = require("../yaxis/abi.js"); const constants = require("../yaxis/constants.js"); async function tvl(timestamp, block) { - const balances = {}; - - // 1. MetaVault (LEGACY v2) - LP-3POOL-CURVE - const metaVault = ( - await sdk.api.abi.call({ - target: constants.METAVAULT, - abi: abi.yAxisMetaVault, - block: block, - }) - ).output; - - sdk.util.sumSingleBalance( - balances, - constants.CURRENCIES["LP-3POOL-CURVE"], - metaVault - ); - - // 3. VAULTS - - const vaults = ( - await sdk.api.abi.multiCall({ - calls: constants.VAULTS.map(({ vaultTokenContract }) => ({ - target: vaultTokenContract, - })), - abi: "erc20:totalSupply", - block: block, - }) - ).output.map((val) => val.output); - - await Promise.all( - constants.VAULTS.map(async (vault, index) => { - await unwrapCrv(balances, vault.tokenContract, vaults[index]); - }) - ); - - // Add ALETH eth balance - - const alethVault = ( - await sdk.api.erc20.totalSupply({ - target: "0xeF84fAc432846Ad5f6f1bD4caCcF2849e2818e66", - block, - }) - ).output; - - const crvTotalSupply = ( - await sdk.api.erc20.totalSupply({ - target: "0xC4C319E2D4d66CcA4464C0c2B32c9Bd23ebe784e", - block, - }) - ).output; - - const eth = ( - await sdk.api.eth.getBalance({ - target: "0xC4C319E2D4d66CcA4464C0c2B32c9Bd23ebe784e", - block, - }) - ).output; - - balances["0x0000000000000000000000000000000000000000"] = BigNumber(alethVault) - .multipliedBy(eth) - .dividedBy(crvTotalSupply) - .toFixed(0); - - return balances; -} - -async function pool2(time, block) { - const balances = {}; - // 4. LPs - const uniswapLPs = ( - await sdk.api.abi.multiCall({ - calls: constants.UNISWAP_LPS.map((lp) => ({ - target: lp.address, - params: [lp.staking] - })), - abi: "erc20:balanceOf", - block: block, - }) - ).output.map((val) => val.output); - - const lpPositions = []; - - constants.UNISWAP_LPS.forEach((lp, index) => { - lpPositions.push({ - balance: uniswapLPs[index], - token: lp.address, - }); - }); - - await unwrapUniswapLPs(balances, lpPositions, block); - - return balances + const { api } = arguments[3] + const token = await api.call({ abi: 'address:want', target: constants.METAVAULT}) + const bal = await api.call({ abi: 'uint256:balance', target: constants.METAVAULT}) + api.add(token, bal) + const tokens = await api.multiCall({ abi: 'address:token', calls: constants.VAULTS.map(v => v.vault)}) + const bals = await api.multiCall({ abi: 'uint256:balance', calls: constants.VAULTS.map(v => v.vault)}) + api.addTokens(tokens, bals) } -async function staking(time, block) { - const balances = {}; - - // 2. sYAX (LEGACY v1) - YAXIS - const sYAX = ( - await sdk.api.abi.call({ - target: constants.BAR, - abi: abi.yAxisBar, - block: block, - }) - ).output; - - sdk.util.sumSingleBalance(balances, constants.CURRENCIES["YAXIS"], sYAX); - - // sYAXIS (LEGACY v2) - YAXIS - const sYAXIS = ( - await sdk.api.erc20.totalSupply({ - target: constants.STAKING.YAXIS, - block, - }) - ).output; - - sdk.util.sumSingleBalance(balances, constants.CURRENCIES["YAXIS"], sYAXIS); - - // Voting Escrow (v3) - YAXIS - const veYAXIS = ( - await sdk.api.abi.call({ - target: constants.VOTING_ESCROW, - abi: abi.votingEscrow, - block, - }) - ).output; - - sdk.util.sumSingleBalance(balances, constants.CURRENCIES["YAXIS"], veYAXIS); - - // Add YAXIS vault - const yaxisVault = ( - await sdk.api.erc20.totalSupply({ - target: constants.YAXIS_GAUGE, - block, - }) - ).output; - - sdk.util.sumSingleBalance( - balances, - constants.CURRENCIES["YAXIS"], - yaxisVault - ); - - return balances +async function staking_(time, block) { + const { api } = arguments[3] + const token = constants.CURRENCIES["YAXIS"] + api.add(token, await api.call({ abi: abi.votingEscrow, target: constants.VOTING_ESCROW})) + api.add(token, await api.call({ abi: abi.yAxisBar, target: constants.BAR})) + api.add(token, await api.call({ abi: 'erc20:totalSupply', target: constants.STAKING.YAXIS})) + api.add(token, await api.call({ abi: 'erc20:totalSupply', target: constants.YAXIS_GAUGE})) } module.exports = { doublecounted: true, ethereum: { tvl, - staking, - pool2 + staking: staking_, + pool2: staking(constants.UNISWAP_LPS.map(i => i.staking), constants.UNISWAP_LPS.map(i => i.address)) }, start: 1600185600, // 09/16/2020 @ 12:00am (UTC+8) }; diff --git a/projects/yearn/index.js b/projects/yearn/index.js index 0bead9e08a1..c7830be7d32 100644 --- a/projects/yearn/index.js +++ b/projects/yearn/index.js @@ -1,100 +1,72 @@ +const { sumTokens2 } = require('../helper/unwrapLPs') const axios = require('axios') -const { getApiTvl } = require('../helper/historicalApi') +const { getConfig } = require('../helper/cache') +const { sumERC4626Vaults } = require('../helper/erc4626') -async function ethereum(timestamp) { - return getApiTvl(timestamp, async () => { - const tvl = await axios.get('https://api.yearn.finance/v1/chains/1/vaults/all') - return tvl.data.reduce((all, vault) => all + vault.tvl.tvl, 0) - }, async () => { - /* - Outdated as of Dec 2022 - const historicalTvls = Object.entries((await axios.get('https://yearn.science/v1/tvl')).data) - .map(([date, tvl]) => [Date.parse(date)/1000, tvl]).sort(([date1], [date2]) => date1 - date2); - */ - const ibTvl = await axios.post("https://yearn.vision/api/ds/query", { "queries": [{ "datasource": { "uid": "PBFE396EC0B189D67", "type": "prometheus" }, "expr": "(sum(ironbank{network=\"ETH\", param=\"tvl\"}) or vector(0))", "utcOffsetSec": 0, "datasourceId": 1 }], "from": "1639958400000", "to": Date.now().toString() }) - const totalTvl = await axios.post("https://yearn.vision/api/ds/query", { "queries": [{ "datasource": { "uid": "PBFE396EC0B189D67", "type": "prometheus" }, "expr": "(sum(ironbank{network=\"ETH\", param=\"tvl\"}) or vector(0)) + (sum(yearn_vault{network=\"ETH\", param=\"tvl\"}) or vector(0))", "utcOffsetSec": 0, "datasourceId": 1 }], "from": "1639958400000", "to": Date.now().toString() }) - const result = [] - const [tvlTimestamps, tvls] = totalTvl.data.results.A.frames[0].data.values - const [ibTimestamps, ib] = ibTvl.data.results.A.frames[0].data.values - tvlTimestamps.forEach((time, index) => { - const ibIndex = ibTimestamps.indexOf(time) - const tvl = tvls[index] - ib[ibIndex] - result.push({ - date: Math.round(time / 1000), - totalLiquidityUSD: tvl - }) - }) - return result - }) -} - -async function fantom(timestamp) { - return getApiTvl(timestamp, async () => { - const tvl = await axios.get('https://api.yearn.finance/v1/chains/250/vaults/all') - const total = tvl.data.reduce((all, vault) => all + vault.tvl.tvl, 0) - if(total === 0){ throw new Error("TVL can't be 0")} - return total - }, async () => { - const totalTvl = await axios.post("https://yearn.vision/api/ds/query", {"queries":[{"datasource":{"uid":"PBFE396EC0B189D67","type":"prometheus"},"expr":"(sum(ironbank{network=\"FTM\", param=\"tvl\"}) or vector(0)) + (sum(yearn_vault{network=\"FTM\", param=\"tvl\"}) or vector(0))", "utcOffsetSec":0,"datasourceId":1}],"from":"1642091361529","to": Date.now().toString() }) - const result = [] - const [tvlTimestamps, tvls] = totalTvl.data.results.A.frames[0].data.values - tvlTimestamps.forEach((time, index) => { - const tvl = tvls[index] - result.push({ - date: Math.round(time / 1000), - totalLiquidityUSD: tvl - }) - }) - return result - }) -} +const v1Vaults = [ + '0x597aD1e0c13Bfe8025993D9e79C69E1c0233522e', + '0x5dbcF33D8c2E976c6b560249878e6F1491Bca25c', + '0x37d19d1c4E1fa9DC47bD1eA12f742a0887eDa74a', + '0xACd43E627e64355f1861cEC6d3a6688B31a6F952', + '0x2f08119C6f07c006695E079AAFc638b8789FAf18', + '0xBA2E7Fed597fd0E3e70f5130BcDbbFE06bB94fe1', + '0x2994529C0652D127b7842094103715ec5299bBed', + '0x7Ff566E1d69DEfF32a7b244aE7276b9f90e9D0f6', + '0xe1237aA7f535b0CC33Fd973D66cBf830354D16c7', + '0x9cA85572E6A3EbF24dEDd195623F188735A5179f', + '0xec0d8D3ED5477106c6D4ea27D90a60e594693C90', + '0x629c759D1E83eFbF63d84eb3868B564d9521C129', + '0x0FCDAeDFb8A7DfDa2e9838564c5A1665d856AFDF', + '0xcC7E70A958917cCe67B4B87a8C30E6297451aE98', + '0x98B058b2CBacF5E99bC7012DF757ea7CFEbd35BC', + '0xE0db48B4F71752C4bEf16De1DBD042B82976b8C7', + '0x5334e150B938dd2b6bd040D9c4a03Cff0cED3765', + '0xFe39Ce91437C76178665D64d7a2694B0f6f17fE3', + '0xF6C9E9AF314982A4b38366f4AbfAa00595C5A6fC', + '0xA8B1Cb4ed612ee179BDeA16CCa6Ba596321AE52D', + '0x46AFc2dfBd1ea0c0760CAD8262A5838e803A37e5', + '0x5533ed0a3b83F70c3c4a1f69Ef5546D3D4713E44', + '0x8e6741b456a074F0Bc45B8b82A755d4aF7E965dF', + '0x03403154afc09Ce8e44C3B185C82C6aD5f86b9ab', + '0xE625F5923303f1CE7A43ACFEFd11fd12f30DbcA4', + '0xBacB69571323575C6a5A3b4F9EEde1DC7D31FBc1', + '0x1B5eb1173D2Bf770e50F10410C9a96F7a8eB6e75', + '0x96Ea6AF74Af09522fCB4c28C269C26F59a31ced6', +] +const blacklist = [ + '0xbD17B1ce622d73bD438b9E658acA5996dc394b0d', + '0xc5bDdf9843308380375a611c18B50Fb9341f502A', + '0x07FB4756f67bD46B748b16119E802F1f880fb2CC', + '0x7F83935EcFe4729c4Ea592Ab2bC1A32588409797', + '0x123964EbE096A920dae00Fb795FFBfA0c9Ff4675', + '0x39546945695DCb1c037C836925B355262f551f55', + ...v1Vaults, +] -async function arbitrum(timestamp) { - return getApiTvl(timestamp, async () => { - const tvl = await axios.get('https://api.yearn.finance/v1/chains/42161/vaults/all') - const total = tvl.data.reduce((all, vault) => all + vault.tvl.tvl, 0) - if(total === 0){ throw new Error("TVL can't be 0")} - return total - }, async () => { - const totalTvl = await axios.post("https://yearn.vision/api/ds/query", {"queries":[{"datasource":{"uid":"PBFE396EC0B189D67","type":"prometheus"},"expr":"(sum(ironbank{network=\"AETH\", param=\"tvl\"}) or vector(0)) + (sum(yearn_vault{network=\"AETH\", param=\"tvl\"}) or vector(0))", "utcOffsetSec":0,"datasourceId":1}],"from":"1645565848000","to": Date.now().toString() }) - const result = [] - const [tvlTimestamps, tvls] = totalTvl.data.results.A.frames[0].data.values - tvlTimestamps.forEach((time, index) => { - const tvl = tvls[index] - result.push({ - date: Math.round(time / 1000), - totalLiquidityUSD: tvl - }) - }) - return result - }) -} - -async function optimism(timestamp) { - return getApiTvl(timestamp, async () => { - const tvl = await axios.get('https://api.yearn.finance/v1/chains/10/vaults/all') - const total = tvl.data.reduce((all, vault) => all + vault.tvl.tvl, 0) - if(total === 0){ throw new Error("TVL can't be 0")} - return total - }, async () => { - throw new Error("No historical data for optimism") - }) +async function tvl(timestamp, _, _1, { api }) { + const data = await getConfig('yearn/' + api.chain, `https://api.yearn.finance/v1/chains/${api.chainId}/vaults/all`) + const vaults = data.map(i => i.address).filter(i => !blacklist.includes(i)) + await sumERC4626Vaults({ api, vaults, abi: { asset: 'address:token', } }) + if (api.chain === 'ethereum') { + const tokens = await api.multiCall({ abi: 'address:token', calls: v1Vaults }) + let bals = await api.multiCall({ abi: 'erc20:totalSupply', calls: v1Vaults }) + const ratio = await api.multiCall({ abi: 'uint256:getPricePerFullShare', calls: v1Vaults }) + bals = bals.map((bal, i) => bal * ratio[i] / 1e18) + api.addTokens(tokens, bals) + } + return sumTokens2({ api, resolveLP: true,}) } module.exports = { - doublecounted: true, - misrepresentedTokens: true, - timetravel: false, - fantom: { - tvl: fantom - }, - ethereum: { - tvl: ethereum - }, - arbitrum: { - tvl: arbitrum - }, - optimism: { - tvl: optimism - }, + doublecounted: true, + misrepresentedTokens: true, + timetravel: false, + fantom: { tvl }, + ethereum: { tvl }, + arbitrum: { tvl }, + optimism: { tvl }, + hallmarks: [ + [1594944000, "YFI token Launch"], + ] }; + diff --git a/projects/yel/config/abi.json b/projects/yel/config/abi.json index 87e8ee0f4d6..e3893b937aa 100644 --- a/projects/yel/config/abi.json +++ b/projects/yel/config/abi.json @@ -1,135 +1,11 @@ { - "getReserves": { - "inputs": [], - "name": "getReserves", - "outputs": [ - { - "internalType": "uint112", - "name": "_reserve0", - "type": "uint112" - }, - { - "internalType": "uint112", - "name": "_reserve1", - "type": "uint112" - }, - { - "internalType": "uint32", - "name": "_blockTimestampLast", - "type": "uint32" - } - ], - "stateMutability": "view", - "type": "function" - }, - "poolInfo": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "poolInfo", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "stakingToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "stakingTokenTotalAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accYelPerShare", - "type": "uint256" - }, - { - "internalType": "uint32", - "name": "lastRewardTime", - "type": "uint32" - }, - { - "internalType": "uint16", - "name": "allocPoint", - "type": "uint16" - } - ], - "stateMutability": "view", - "type": "function" - }, + "getReserves": "function getReserves() view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast)", + "poolInfo": "function poolInfo(uint256) view returns (address stakingToken, uint256 stakingTokenTotalAmount, uint256 accYelPerShare, uint32 lastRewardTime, uint16 allocPoint)", "externalFarming": { - "totalLP": { - "inputs": [], - "name": "totalLP", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "lpToken": { - "inputs": [], - "name": "lpToken", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "token1": { - "constant": true, - "inputs": [], - "name": "token1", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "token0": { - "constant": true, - "inputs": [], - "name": "token0", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "totalSupply": { - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } + "totalLP": "uint256:totalLP", + "lpToken": "address:lpToken", + "token1": "address:token1", + "token0": "address:token0", + "totalSupply": "uint256:totalSupply" } -} +} \ No newline at end of file diff --git a/projects/yetiFinance/curve_get_virtual_price.abi.json b/projects/yetiFinance/curve_get_virtual_price.abi.json deleted file mode 100644 index 0f37e54bee0..00000000000 --- a/projects/yetiFinance/curve_get_virtual_price.abi.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "stateMutability": "view", - "type": "function", - "name": "get_virtual_price", - "inputs": [], - "outputs": [{ - "name": "", - "type": "uint256" - }] -} \ No newline at end of file diff --git a/projects/yetiFinance/farmPoolTotalSupply.abi.json b/projects/yetiFinance/farmPoolTotalSupply.abi.json deleted file mode 100644 index 3d66206c4dd..00000000000 --- a/projects/yetiFinance/farmPoolTotalSupply.abi.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } \ No newline at end of file diff --git a/projects/yetiFinance/fetchPrice_v.abi.json b/projects/yetiFinance/fetchPrice_v.abi.json deleted file mode 100644 index 4b5ecbd6378..00000000000 --- a/projects/yetiFinance/fetchPrice_v.abi.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "inputs": [], - "name": "fetchPrice_v", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } \ No newline at end of file diff --git a/projects/yetiFinance/getAllCollateral.abi.json b/projects/yetiFinance/getAllCollateral.abi.json deleted file mode 100644 index da2dc155ac8..00000000000 --- a/projects/yetiFinance/getAllCollateral.abi.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "inputs": [], - "name": "getAllCollateral", - "outputs": [ - { - "internalType": "address[]", - "name": "", - "type": "address[]" - }, - { - "internalType": "uint256[]", - "name": "", - "type": "uint256[]" - } - ], - "stateMutability": "view", - "type": "function" -} \ No newline at end of file diff --git a/projects/yetiFinance/getPrice.abi.json b/projects/yetiFinance/getPrice.abi.json deleted file mode 100644 index 6a84f8dddce..00000000000 --- a/projects/yetiFinance/getPrice.abi.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "inputs": [ - { - "internalType": "address", - "name": "_collateral", - "type": "address" - } - ], - "name": "getPrice", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } \ No newline at end of file diff --git a/projects/yetiFinance/getReserves.json b/projects/yetiFinance/getReserves.json deleted file mode 100644 index 452a51147d2..00000000000 --- a/projects/yetiFinance/getReserves.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "inputs": [], - "name": "getReserves", - "outputs": [{ - "internalType": "uint112", - "name": "_reserve0", - "type": "uint112" - }, { - "internalType": "uint112", - "name": "_reserve1", - "type": "uint112" - }, { - "internalType": "uint32", - "name": "_blockTimestampLast", - "type": "uint32" - }], - "stateMutability": "view", - "type": "function" -} \ No newline at end of file diff --git a/projects/yetiFinance/index.js b/projects/yetiFinance/index.js index e6daef60ebc..19dd2536765 100644 --- a/projects/yetiFinance/index.js +++ b/projects/yetiFinance/index.js @@ -1,16 +1,12 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); -const getAllCollateralAbi = require("./getAllCollateral.abi.json"); -const fetchPrice_vAbi = require("./fetchPrice_v.abi.json") -const farmPoolTotalSupplyAbi = require("./farmPoolTotalSupply.abi.json") -const curve_get_virtual_priceAbi = require("./curve_get_virtual_price.abi.json") -const getPriceAbi = require("./getPrice.abi.json"); -const getReservesAbi = require("./getReserves.json") - -const YUSD_TOKEN_ADDRESS = "0x111111111111ed1D73f860F57b2798b683f2d325"; -const YUSD_PRICEFEED_ADDRESS = "0x38C67a46304b9ad4A0A210A65a640213505bd1Dc"; -// StabilityPool holds deposited YUSD -const STABILITY_POOL_ADDRESS = "0xFFffFfffFff5d3627294FeC5081CE5C5D7fA6451"; +const getAllCollateralAbi = 'function getAllCollateral() view returns (address[], uint256[])' +const fetchPrice_vAbi = "uint256:fetchPrice_v" +const farmPoolTotalSupplyAbi = "uint256:totalSupply" +const curve_get_virtual_priceAbi = "uint256:get_virtual_price" +const getPriceAbi = 'function getPrice(address _collateral) view returns (uint256)' +const getReservesAbi = 'function getReserves() view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast)' // YetiController knows the price of the collateral const YETI_CONTROLLER_ADDRESS = "0xcCCCcCccCCCc053fD8D1fF275Da4183c2954dBe3"; @@ -39,26 +35,6 @@ const chain = 'avax' */ async function tvl(_, _block, chainBlocks) { const block = chainBlocks[chain] - // const YUSDInStabilityPool = ( - // await sdk.api.erc20.balanceOf({ - // target: YUSD_TOKEN_ADDRESS, - // owner: STABILITY_POOL_ADDRESS, - // block, - // chain:"avax" - // }) - // ).output; - - // const YUSDPrice = ( - // await sdk.api.abi.call({ - // target: YUSD_PRICEFEED_ADDRESS, - // abi: fetchPrice_vAbi, - // block, - // chain: "avax" - // }) - // ).output - - // const stabilityPoolYUSDTvl = +YUSDInStabilityPool * +YUSDPrice / (10 ** 18) - const activePoolCollaterals = ( await sdk.api.abi.call({ target: ACTIVE_POOL_ADDRESS, @@ -139,7 +115,7 @@ async function tvl(_, _block, chainBlocks) { return { // In USDC, USDC has decimal of 6 - ["avax:0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E"]: total / (10 ** 12) + ["avax:" + ADDRESSES.avax.USDC]: total / (10 ** 12) } } @@ -177,7 +153,7 @@ async function pool2(_, _block, chainBlocks) { const pool2ValueUSD = (YETIReserve * YETIPrice + AVAXReserve * AVAXPrice) / 10 ** 18 return { // In USDC, USDC has decimal of 6 - ["avax:0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E"]: pool2ValueUSD / (10 ** 12) + ["avax:" + ADDRESSES.avax.USDC]: pool2ValueUSD / (10 ** 12) } } @@ -204,7 +180,7 @@ async function staking(_, _block, chainBlocks) { const stakingUSD = veYETIBalance * YETIPrice / (10 ** 18) return { // In USDC, USDC has decimal of 6 - ["avax:0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E"]: stakingUSD / (10 ** 12) + ["avax:" + ADDRESSES.avax.USDC]: stakingUSD / (10 ** 12) } } diff --git a/projects/yfdai/index.js b/projects/yfdai/index.js index cd4c07a6f5e..839ffc7445c 100644 --- a/projects/yfdai/index.js +++ b/projects/yfdai/index.js @@ -1,11 +1,12 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk') const {sumTokens} = require('../helper/unwrapLPs') const yfdaiTokenAddress = "0xf4CD3d3Fda8d7Fd6C5a500203e38640A70Bf9577"; const YfDaiStakingAdddress = "0x44d771D0C998f524ff39aB6Df64B72bce1d09566"; const YfDaiSafetradeStakingAddress = "0x4599cDa238Fb71573fd5A0076C199320e09BCfF0"; -const weth = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2" -const dai = "0x6b175474e89094c44da98b954eedeac495271d0f" +const weth = ADDRESSES.ethereum.WETH +const dai = ADDRESSES.ethereum.DAI const wethVault = "0x290e5484601986667dC6cA72119f2B85260Ca92E" const daiVault = "0x7e537E8B5028a32166F06C8664cdE9D608487428" const YfDaiETHLP72HRSVault = "0x75E9F410e8d1D7240b67ec6FE35FA37580b814d9"; diff --git a/projects/yfii/abi.json b/projects/yfii/abi.json index 546b4502788..2163bf4331d 100644 --- a/projects/yfii/abi.json +++ b/projects/yfii/abi.json @@ -1,32 +1,4 @@ { - "token": { - "constant": true, - "inputs": [], - "name": "token", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "balance" : { - "constant": true, - "inputs": [], - "name": "balance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } -} + "token": "address:token", + "balance": "uint256:balance" +} \ No newline at end of file diff --git a/projects/yieldbank/index.js b/projects/yieldbank/index.js new file mode 100644 index 00000000000..b1bbddb0d8c --- /dev/null +++ b/projects/yieldbank/index.js @@ -0,0 +1,36 @@ +const utils = require('../helper/utils'); +const { toUSDTBalances } = require('../helper/balances'); +let _response + +function fetchChain(chainId, staking) { + return async () => { + if (!_response) _response = utils.fetchURL('https://api.yieldbank.xyz/tvl') + const response = await _response; + + let tvl = 0; + const chain = response.data[chainId]; + for (const vault in chain) { + const isYIELDBANK = vault.includes("yieldbank") + if ((isYIELDBANK && staking) || (!isYIELDBANK && !staking)) { + tvl += Number(chain[vault]); + } + } + + + return toUSDTBalances(tvl); + } +} + +const chains = { + kava: 2222 +} + +module.exports = { + timetravel: false, + misrepresentedTokens: true, + doublecounted: true, + ...Object.fromEntries(Object.entries(chains).map(chain => [chain[0], { + tvl: fetchChain(chain[1], false), + staking: fetchChain(chain[1], true), + }])) +} diff --git a/projects/yieldis/abi.json b/projects/yieldis/abi.json deleted file mode 100644 index 1e937314195..00000000000 --- a/projects/yieldis/abi.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "pricePerShare": { - "input": [], - "name": "pricePerShare", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -} \ No newline at end of file diff --git a/projects/yieldis/index.js b/projects/yieldis/index.js index 17ee2d887f6..f09ab5350c8 100644 --- a/projects/yieldis/index.js +++ b/projects/yieldis/index.js @@ -1,104 +1,80 @@ -const sdk = require("@defillama/sdk"); -const abi = require("./abi.json"); -const { GraphQLClient, gql } = require('graphql-request') -const { transformArbitrumAddress } = require("../helper/portedTokens"); -const { getBlock } = require('../helper/getBlock') +const { getLogs } = require('../helper/cache/getLogs') +const { sumTokens2 } = require('../helper/unwrapLPs') +const { eulerTokens } = require('../helper/tokenMapping') -const wrappedAssetHandlers = { - // yvUSDC - '0xa354f35829ae975e850e23e9615b11da1b3dc4de': async (amount, block) => { - const pricePerShare = await sdk.api.abi.call({ - target: '0xa354f35829ae975e850e23e9615b11da1b3dc4de', - abi: abi.pricePerShare, - block, - }) - - const usdcAmount = amount / (pricePerShare.output / 1e6) - return { amount: usdcAmount, asset: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48' } +const config = { + arbitrum: { + ladle: '0x16E25cf364CeCC305590128335B8f327975d0560', + fromBlock: 31012, + oldPools: new Set([ + '0x7Fc2c417021d46a4790463030Fb01A948D54Fc04', + '0xf76906AA78ECD4FcFB8a7923fB40fA42c07F20D6', + '0x6651f8E1ff6863Eb366a319F9A94191346D0e323', + '0x8C8A448FD8d3e44224d97146B25F4DeC425af309', + '0xFCb9B8C5160Cf2999f9879D8230dCed469E72eeb', + '0x13aB946C6A9645EDfF2A33880e0Fc37f67122170', + '0x0FA29EEb169CDE6c779326d7b16c54529ECA1DD5', + ].map(i => i.toLowerCase())), + }, + ethereum: { + ladle: '0x6cB18fF2A33e981D1e38A663Ca056c0a5265066A', + fromBlock: 13461529, + oldPools: new Set([ + '0x3771C99c087a81dF4633b50D8B149aFaA83E3c9E', + '0x2e4B70D0F020E62885E82bf75bc123e1Aa8c79cA', + '0x407353d527053F3a6140AAA7819B93Af03114227', + '0x80142add3A597b1eD1DE392A56B2cef3d8302797', + '0x5D14Ab14adB3a3D9769a67a1D09634634bdE4C9B', + '0xEf82611C6120185D3BF6e020D1993B49471E7da0', + '0x341B0976F962eC34eEaF31cdF2464Ab3B15B6301', + '0xc3348D8449d13C364479B1F114bcf5B73DFc0dc6', + '0x6BaC09a67Ed1e1f42c29563847F77c28ec3a04FC', + '0xf5Fd5A9Db9CcCc6dc9f5EF1be3A859C39983577C', + '0xA4d45197E3261721B8A8d901489Df5d4D2E79eD7', + '0x4b32C37Be5949e77ba3726E863a030BD77942A97', + ].map(i => i.toLowerCase())), + blacklistedTokens: [ + '0x1344A36A1B56144C3Bc62E7757377D288fDE0369', + ...eulerTokens + ], }, } -const getTVL = async (subgraph, block, transformAddress = a => a) => { - const endpoint = `https://api.thegraph.com/subgraphs/name/${subgraph}` - const graphQLClient = new GraphQLClient(endpoint) - - var query = gql` - query($block: Int!){ - assets(block: { number: $block }) { - id - totalCollateral - totalInPools - decimals - } - - pools(block: { number: $block }) { - fyTokenReserves - fyToken { - underlyingAddress - underlyingAsset { - decimals - } - } - currentFYTokenPriceInBase - } - _meta { - block { - number - } - } - } - `; - - const data = await graphQLClient.request(query, { block }); - - const output = {} - for (const asset of data.assets) { - let amount = (parseFloat(asset.totalCollateral) + parseFloat(asset.totalInPools)) * (10 ** asset.decimals) - let assetAddress = asset.id - if (wrappedAssetHandlers[assetAddress]) { - ({ amount, asset: assetAddress } = await wrappedAssetHandlers[assetAddress](amount, block)) - } - const transformedAddr = await transformAddress(assetAddress) - output[transformedAddr] = (output[transformedAddr] || 0) + amount - } - - for (const pool of data.pools) { - if (!pool.fyToken.underlyingAsset) { - continue - } +module.exports = { + hallmarks: [ + [Math.floor(new Date('2023-03-13') / 1e3), 'Euler was hacked'], + ], +}; - let amount = pool.fyTokenReserves * pool.currentFYTokenPriceInBase * (10 ** pool.fyToken.underlyingAsset.decimals) - let assetAddress = pool.fyToken.underlyingAddress +Object.keys(config).forEach(chain => { + const { ladle, fromBlock, oldPools, blacklistedTokens, } = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const logs = await getLogs({ + target: ladle, fromBlock, api, + topic: 'PoolAdded(bytes6,address)', + eventAbi: 'event PoolAdded(bytes6 indexed seriesId, address indexed pool)', + onlyArgs: true, + extraKey: 'PoolAdded', + }) + const joinLogs = await getLogs({ + target: ladle, fromBlock, api, + topic: 'JoinAdded(bytes6,address)', + eventAbi: 'event JoinAdded(bytes6 indexed assetId, address indexed join)', + onlyArgs: true, + extraKey: 'JoinAdded', + }) + const joins = joinLogs.map(i => i[1]) + const assets = await api.multiCall({ abi: 'address:asset', calls: joins }) - if (wrappedAssetHandlers[assetAddress]) { - ({ amount, asset: assetAddress } = await wrappedAssetHandlers[assetAddress](amount, block)) + const pools = [...new Set(logs.map(i => i.pool))] + const newPools = pools.filter(i => !oldPools.has(i.toLowerCase())) + const tokens = await api.multiCall({ abi: 'address:base', calls: pools }) + const sharesTokens = await api.multiCall({ abi: 'address:sharesToken', calls: newPools }) + const tokensAndOwners = sharesTokens.map((v, i) => [v, newPools[i]]) + tokens.forEach((v, i) => tokensAndOwners.push([v, pools[i]])) + assets.forEach((v, i) => tokensAndOwners.push([v, joins[i]])) + return sumTokens2({ api, tokensAndOwners, blacklistedTokens }) } - - const transformedAddr = await transformAddress(assetAddress) - output[transformedAddr] = (output[transformedAddr] || 0) + amount } - - return output -} - -const ethTvl = async (timestamp, ethBlock, chainBlocks) => { - const block = await getBlock(timestamp, 'ethereum', chainBlocks) - return getTVL('yieldprotocol/v2-mainnet', ethBlock) -}; - -const arbTvl = async (timestamp, ethBlock, chainBlocks) => { - const block = await getBlock(timestamp, 'arbitrum', chainBlocks) - return getTVL('yieldprotocol/v2-arbitrum', block, (await transformArbitrumAddress())) -}; - -module.exports = { - misrepresentedTokens: true, - ethereum: { - tvl: ethTvl, - }, - arbitrum: { - tvl: arbTvl, - }, - methodology: - "Counts tvl on the Pools and Joins through PoolFactory and Joinfactory Contracts", -}; +}) \ No newline at end of file diff --git a/projects/yieldly/index.js b/projects/yieldly/index.js index 285bb3a877f..82a8b77cd66 100644 --- a/projects/yieldly/index.js +++ b/projects/yieldly/index.js @@ -50,8 +50,9 @@ async function pool2() { module.exports = { timetravel: false, algorand: { - tvl, - staking, - pool2, - } + tvl: () => ({}), + }, + hallmarks: [ + [Math.floor(new Date('2023-08-02')/1e3), 'Project pivoted to be being a NFT marketplace.'], + ], }; diff --git a/projects/yieldwolf/abi.json b/projects/yieldwolf/abi.json index 310d785843f..3a05e9d8c73 100644 --- a/projects/yieldwolf/abi.json +++ b/projects/yieldwolf/abi.json @@ -1,67 +1,6 @@ { - "poolInfo": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "poolInfo", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "stakeToken", - "type": "address" - }, - { - "internalType": "contract IYieldWolfStrategy", - "name": "strategy", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "poolLength": { - "inputs": [], - "name": "poolLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "totalStakeTokens": { - "inputs": [], - "name": "totalStakeTokens", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "symbol": { - "constant": true, - "inputs": [], - "name": "symbol", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } + "poolInfo": "function poolInfo(uint256) view returns (address stakeToken, address strategy)", + "poolLength": "uint256:poolLength", + "totalStakeTokens": "uint256:totalStakeTokens", + "symbol": "string:symbol" } \ No newline at end of file diff --git a/projects/yieldyak-staked-avax/index.js b/projects/yieldyak-staked-avax/index.js index 70e254bbe28..a7d151829a1 100644 --- a/projects/yieldyak-staked-avax/index.js +++ b/projects/yieldyak-staked-avax/index.js @@ -1,47 +1,29 @@ +const ADDRESSES = require('../helper/coreAssets.json') -const sdk = require("@defillama/sdk"); -const BigNumber = require("bignumber.js"); - -const gAVAX = require("../geode/abis/avax/gAVAX.json"); const yieldYak_id = "45756385483164763772015628191198800763712771278583181747295544980036831301432"; -async function avax(timestamp, ethBlock, chainBlocks) { - const chain = "avax"; - const block = chainBlocks[chain]; - - const supply = ( - await sdk.api.abi.call({ - abi: gAVAX.abi.find((abi) => abi.name === "totalSupply"), - params: [yieldYak_id], - target: gAVAX.address, - chain, - block, - }) - ).output; +async function avax(timestamp, ethBlock, chainBlocks, { api }) { - const price = ( - await sdk.api.abi.call({ - abi: gAVAX.abi.find((abi) => abi.name === "pricePerShare"), - params: [yieldYak_id], - target: gAVAX.address, - chain, - block, - }) - ).output; + const supply = await api.call({ + abi: "function totalSupply(uint256 id) view returns (uint256)", + params: yieldYak_id, + target: "0x6026a85e11bd895c934af02647e8c7b4ea2d9808", + }) - const TotalBalance = BigNumber(supply).times(price).dividedBy(1e18); + const price = await api.call({ + abi: "function pricePerShare(uint256 _id) view returns (uint256)", + params: yieldYak_id, + target: "0x6026a85e11bd895c934af02647e8c7b4ea2d9808", + }) return { - "avax:0x0000000000000000000000000000000000000000": TotalBalance + ["avax:" + ADDRESSES.null]: supply * price / 1e18 }; } module.exports = { start: 1658869201, - misrepresentedTokens: false, - methodology: - "Total Supply and Underlying Price of the derivative is multiplied, resulting in number of staked Avax tokens.", - timetravel: true, + methodology: "Total Supply and Underlying Price of the derivative is multiplied, resulting in number of staked Avax tokens.", doublecounted: true, avax: { tvl: avax, diff --git a/projects/yieldyak/abi.json b/projects/yieldyak/abi.json index 16f8984b9d8..c64c45205ed 100644 --- a/projects/yieldyak/abi.json +++ b/projects/yieldyak/abi.json @@ -1,6 +1,6 @@ { - "depositToken":{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IERC20"}],"name":"depositToken","inputs":[]}, - "totalDeposits":{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"totalDeposits","inputs":[]}, - "token": {"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IERC20"}],"name":"token","inputs":[]}, - "getRatio": {"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getRatio","inputs":[]} + "depositToken": "address:depositToken", + "totalDeposits": "uint256:totalDeposits", + "token": "address:token", + "getRatio": "uint256:getRatio" } \ No newline at end of file diff --git a/projects/yieldyak/index.js b/projects/yieldyak/index.js index 9f247579971..2b2922662c7 100644 --- a/projects/yieldyak/index.js +++ b/projects/yieldyak/index.js @@ -1,12 +1,6 @@ const sdk = require('@defillama/sdk'); -const { unwrapUniswapLPs, unwrapCrv, unwrapLPsAuto } = require('../helper/unwrapLPs') -const abi = require('./abi.json') const { request, gql } = require("graphql-request"); -const { transformAvaxAddress } = require('../helper/portedTokens'); -const { default: BigNumber } = require('bignumber.js'); const { staking } = require('../helper/staking'); -const { addFundsInMasterChef } = require('../helper/masterchef'); -const { requery } = require('../helper/requery'); const graphUrl = 'https://api.thegraph.com/subgraphs/name/yieldyak/reinvest-tracker' const graphQuery = gql` @@ -22,29 +16,28 @@ query get_tvl($block: Int) { } `; -async function tvl(timestamp, ethBlock, chainBlocks) { - const chain = 'avax' +async function tvl(timestamp, ethBlock, chainBlocks, { api }) { const block = chainBlocks.avax; const farms = (await request(graphUrl, graphQuery, { block })).farms - const transformAddress = await transformAvaxAddress() const balances = {} - farms.forEach(i => sdk.util.sumSingleBalance(balances, transformAddress(i.depositToken.id), i.depositTokenBalance)) - await unwrapLPsAuto({ balances, chain, block, blacklistedLPs: ['0xca87bf3ec55372d9540437d7a86a7750b42c02f4']}) + farms.forEach(i => sdk.util.sumSingleBalance(balances, i.depositToken.id, i.depositTokenBalance, 'avax')) + delete balances['avax:0x59414b3089ce2af0010e7523dea7e2b35d776ec7'] + + // TODO: remove this code, it is no longer necessary + const stakedGLP = 'avax:0x5643f4b25e36478ee1e90418d5343cb6591bcb9d' + if (balances[stakedGLP]) { + balances['avax:0x01234181085565ed162a948b6a5e88758cd7c7b8'] = balances[stakedGLP] + delete balances[stakedGLP] + } return balances } const masterYak = "0x0cf605484A512d3F3435fed77AB5ddC0525Daf5f" const yakToken = "0x59414b3089ce2af0010e7523dea7e2b35d776ec7" -async function pool2(time, ethBlock, chainBlocks) { - const balances = {} - await addFundsInMasterChef(balances, masterYak, chainBlocks.avax, "avax", addr => `avax:${addr}`, undefined, [yakToken]) - return balances -} module.exports = { avax:{ tvl, - staking: staking(masterYak, yakToken, "avax"), - pool2 + staking: staking(masterYak, yakToken), } } \ No newline at end of file diff --git a/projects/yodeswap/api.js b/projects/yodeswap/api.js new file mode 100644 index 00000000000..3e7fa96fba5 --- /dev/null +++ b/projects/yodeswap/api.js @@ -0,0 +1,12 @@ +const { getUniTVL, } = require('../helper/unknownTokens') + +module.exports = { + misrepresentedTokens: true, + dogechain: { + tvl: getUniTVL({ + factory: '0xAaA04462e35f3e40D798331657cA015169e005d7', + useDefaultCoreAssets: true, + queryBatched: 1000, + }), + } +} diff --git a/projects/yodeswap/index.js b/projects/yodeswap/index.js index 20a97dcaddb..af5dbcab608 100644 --- a/projects/yodeswap/index.js +++ b/projects/yodeswap/index.js @@ -1,24 +1,21 @@ -const { getUniTVL, staking, } = require('../helper/unknownTokens') +const { staking, } = require('../helper/unknownTokens') +const { getExports } = require('../helper/heroku-api') const chain = 'dogechain' const YodeDEX = '0x6FC4563460d5f45932C473334d5c1C5B4aEA0E01' const lps = ['0x2Dd53abcFEBE71a9Cd5dFF4f44458E14707F9280'] - module.exports = { + timetravel: false, misrepresentedTokens: true, - dogechain: { - tvl: getUniTVL({ - chain, - factory: '0xAaA04462e35f3e40D798331657cA015169e005d7', - useDefaultCoreAssets: true, - }), - staking: staking({ - chain, - owner: '0x707Ee40734454162b7720B665Fa2aA0f7c2C6983', - tokens: [YodeDEX], - useDefaultCoreAssets: true, - lps, - }) - } + ...getExports("yodeswap", ['dogechain']), } + + +module.exports.dogechain.staking = staking({ + chain, + owner: '0x707Ee40734454162b7720B665Fa2aA0f7c2C6983', + tokens: [YodeDEX], + useDefaultCoreAssets: true, + lps, +}) diff --git a/projects/yogi/index.js b/projects/yogi/index.js index 9a5ad8e2de9..42e4bd530b5 100644 --- a/projects/yogi/index.js +++ b/projects/yogi/index.js @@ -1,38 +1,3 @@ -const sdk = require('@defillama/sdk'); -const { blockQuery } = require('../helper/graph') -const { toUSDTBalances } = require('../helper/balances'); -const { gql } = require('graphql-request'); - -const endpoints = { - bsc: 'https://api.thegraph.com/subgraphs/name/yogi-fi/bsc', - polygon: 'https://api.thegraph.com/subgraphs/name/yogi-fi/polygon', -} - -const query = gql` -query get_tvl($block: Int) { - balancers( - first: 5, - block: { number: $block } - ) { - totalLiquidity, - totalSwapVolume - } - } -`; - -async function getChainTvl(chain, block) { - const results = await blockQuery(endpoints[chain], query, block, 800) - - return toUSDTBalances(results.balancers[0].totalLiquidity); -} - -async function bsc(timestamp, block, chainBlocks) { - return getChainTvl('bsc', chainBlocks['bsc']); -} - -async function polygon(timestamp, block, chainBlocks) { - return getChainTvl('polygon', chainBlocks['polygon']); -} module.exports = { hallmarks: [ diff --git a/projects/yokaiswap/index.js b/projects/yokaiswap/index.js index d19e1e34299..3bdfac89696 100644 --- a/projects/yokaiswap/index.js +++ b/projects/yokaiswap/index.js @@ -21,43 +21,11 @@ async function fetch() { return toUSDTBalances(data.yokaiFactories[0].totalLiquidityUSD); } -/* -async function staking() { - const response = await axios.get( - "https://www.yokaiswap.com/api/pool_total_staked" - ); - return toUSDTBalances(response.data/1e18); -} -*/ -const getReservesABI = { - "constant": true, - "inputs": [], - "name": "getReserves", - "outputs": [ - { - "internalType": "uint112", - "name": "reserve0", - "type": "uint112" - }, - { - "internalType": "uint112", - "name": "reserve1", - "type": "uint112" - }, - { - "internalType": "uint32", - "name": "blockTimestampLast", - "type": "uint32" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" -} +const getReservesABI = 'function getReserves() view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast)' // had to be disabled till we get multicall working -const tvl_v0 = getUniTVL({ chain: 'godwoken', factory: '0x5ef0d2d41a5f3d5a083bc776f94282667c27b794', useDefaultCoreAssets: false, abis: { getReservesABI }}) +const tvl_v0 = getUniTVL({ chain: 'godwoken', factory: '0x5ef0d2d41a5f3d5a083bc776f94282667c27b794', useDefaultCoreAssets: false, abis: { getReserves: getReservesABI }}) const tvl_v1 = getUniTVL({ chain: 'godwoken_v1', factory: '0x7ec2d60880d83614dd4013D39CF273107f30624c', useDefaultCoreAssets: true, }) module.exports = { diff --git a/projects/yoshi-exchange/index.js b/projects/yoshi-exchange/index.js index 48dd2abdaa4..eddf65b737b 100644 --- a/projects/yoshi-exchange/index.js +++ b/projects/yoshi-exchange/index.js @@ -1,33 +1,20 @@ -const {calculateUniTvl} = require('../helper/calculateUniTvl.js') -const {transformFantomAddress, transformBscAddress} = require('../helper/portedTokens.js'); +const {uniTvlExport} = require('../helper/calculateUniTvl.js') -const chains = ['fantom', 'bsc']; const factoryData = { fantom: { factory: '0xc5bc174cb6382fbab17771d05e6a918441deceea', - block: 19757372, - transform: transformFantomAddress }, bsc: { factory: '0x542b6524abf0bd47dc191504e38400ec14d0290c', - block: 13159231, - transform: transformBscAddress } }; -function generateTvlFunction(chain, data) { - - async function tvl(_timestamp, _ethBlock, chainBlocks){ - const transform = await data.transform(); - - return calculateUniTvl(transform, chainBlocks[chain], chain, data.factory, data.block, true); - } - return tvl; -} - let tvls = {}; -Object.entries(factoryData).forEach(([chain, data]) => tvls[chain] = {tvl: generateTvlFunction(chain, data)}); +Object.entries(factoryData).forEach(([chain, data]) => tvls[chain] = {tvl: uniTvlExport(data.factory, chain, undefined, undefined, { + useDefaultCoreAssets: true, +})}); module.exports = { - ...tvls + ...tvls, + misrepresentedTokens: true, } diff --git a/projects/youswap/index.js b/projects/youswap/index.js index 3ab5db2d0c8..cd23c1f4254 100644 --- a/projects/youswap/index.js +++ b/projects/youswap/index.js @@ -2,12 +2,12 @@ const { uniTvlExport } = require('../helper/calculateUniTvl'); module.exports = { heco: { - tvl: uniTvlExport('0x9f1cd0e59e78f5288e2fcf43030c9010d4f2991d', 'heco'), + tvl: uniTvlExport('0x9f1cd0e59e78f5288e2fcf43030c9010d4f2991d', 'heco', true), }, bsc: { - tvl: uniTvlExport('0x137f34df5bcdb30f5e858fc77cb7ab60f8f7a09a', 'bsc'), + tvl: uniTvlExport('0x137f34df5bcdb30f5e858fc77cb7ab60f8f7a09a', 'bsc', true), }, ethereum: { - tvl: uniTvlExport('0xa7028337d3da1f04d638cc3b4dd09411486b49ea', 'ethereum'), + tvl: uniTvlExport('0xa7028337d3da1f04d638cc3b4dd09411486b49ea', 'ethereum', true), }, } diff --git a/projects/youves/data.js b/projects/youves/data.js index da96bf4da34..6ffea66b2b6 100644 --- a/projects/youves/data.js +++ b/projects/youves/data.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const Ss = { id: 'tez', name: 'Tezos', @@ -275,47 +276,47 @@ const Ss = { }), youToken: Object.assign(Object.assign({ }, ws), { - contractAddress: 'KT1Xobej4mc6XgEjDoJoHtTKgbD1ELMvcQuL' + contractAddress: ADDRESSES.tezos.YOU }), uusdToken: Object.assign(Object.assign({ }, Ds), { - contractAddress: 'KT1XRPEPXbZK25r3Htzp2o1x7xdMMmfocKNW' + contractAddress: ADDRESSES.tezos.uUSD }), udefiToken: Object.assign(Object.assign({ }, ks), { - contractAddress: 'KT1XRPEPXbZK25r3Htzp2o1x7xdMMmfocKNW' + contractAddress: ADDRESSES.tezos.uUSD }), ubtcToken: Object.assign(Object.assign({ }, Ns), { - contractAddress: 'KT1XRPEPXbZK25r3Htzp2o1x7xdMMmfocKNW' + contractAddress: ADDRESSES.tezos.uUSD }), tzbtcToken: Object.assign(Object.assign({ }, Bs), { - contractAddress: 'KT1PWx2mnDueood7fEmfbBDKx1D9BAnnXitn' + contractAddress: ADDRESSES.tezos.tzBTC }), kusdToken: Object.assign(Object.assign({ }, Rs), { - contractAddress: 'KT1K9gCRgaLRFKTErYt1wVxA3Frb9FjasjTV' + contractAddress: ADDRESSES.tezos.kUSD }), usdtzToken: Object.assign(Object.assign({ }, Ps), { - contractAddress: 'KT1LN4LPSqTMS7Sd2CJw4bbDGRkMv2t68Fy9' + contractAddress: ADDRESSES.tezos.USDtz }), usdtToken: Object.assign(Object.assign({ }, Fd), { - contractAddress: 'KT1XnTn74bUtxHfDtBmm2bGZAQfhPbvKWR8o' + contractAddress: ADDRESSES.tezos.USDt }), wusdcToken: Object.assign(Object.assign({ }, xs), { - contractAddress: 'KT18fp5rcTW7mbWDmzFwjLDUhs5MeJmagDSZ' + contractAddress: ADDRESSES.tezos.AAVE }), wwbtcToken: Object.assign(Object.assign({ }, Ms), { - contractAddress: 'KT18fp5rcTW7mbWDmzFwjLDUhs5MeJmagDSZ' + contractAddress: ADDRESSES.tezos.AAVE }), plentyToken: Object.assign(Object.assign({ }, Os), { - contractAddress: 'KT1GRSvLoikDsXujKgZPsGLX8k8VvR2Tq95b' + contractAddress: ADDRESSES.tezos.PLENTY }), tzbtcLP: Object.assign(Object.assign({ }, Ts), { diff --git a/projects/youves/index.js b/projects/youves/index.js index 1567c968064..f111fd00fb1 100644 --- a/projects/youves/index.js +++ b/projects/youves/index.js @@ -1,10 +1,9 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { GraphQLClient, gql } = require("graphql-request"); const sdk = require("@defillama/sdk") -const { addDexPosition, getTokenBalances, resolveLPPosition, getStorage, convertBalances, usdtAddressTezos, } = require('../helper/chain/tezos') -const { getFixBalances } = require('../helper/portedTokens') +const { addDexPosition, resolveLPPosition, getStorage, usdtAddressTezos, } = require('../helper/chain/tezos') const { dexes, farms } = require('./data') const { PromisePool } = require('@supercharge/promise-pool'); -const { default: BigNumber } = require("bignumber.js"); let graphQLClient const indexer = "https://youves-mainnet-indexer.prod.gke.papers.tech/v1/graphql" @@ -27,7 +26,7 @@ const engines = { const uDEFI_LP = 'KT1H8sJY2VzrbiX4pYeUVsoMUd4iGw2DV7XH' const uDEFI_TOKEN = 'KT1XRPEPXbZK25r3Htzp2o1x7xdMMmfocKNW-1' -const tzBTC_TOKEN = 'KT1PWx2mnDueood7fEmfbBDKx1D9BAnnXitn' +const tzBTC_TOKEN = ADDRESSES.tezos.tzBTC async function fetchBalance(balances, token, engineAddress, decimals = 0, sharePrice) { @@ -49,12 +48,12 @@ async function fetchBalance(balances, token, engineAddress, decimals = 0, shareP if (token === 'tzbtc-lp') { const balancetZ = balance * sharePrice.xtzPool / sharePrice.lqtTotal const balanceBTC = balance * sharePrice.tokenPool / sharePrice.lqtTotal - sdk.util.sumSingleBalance(balances, 'tezos', balancetZ / 1e6) - sdk.util.sumSingleBalance(balances, sharePrice.tokenAddress, balanceBTC) + sdk.util.sumSingleBalance(balances, 'tezos', balancetZ / 1e6, 'tezos') + sdk.util.sumSingleBalance(balances, sharePrice.tokenAddress, balanceBTC, 'tezos') return; } - sdk.util.sumSingleBalance(balances, token, balance) + sdk.util.sumSingleBalance(balances, token, balance, 'tezos') } @@ -67,7 +66,7 @@ async function tvl() { const balances = {} const sharePrice = await getTzBTCLPSharePrice() await Promise.all([ - // fetchBalance(balances, 'KT1XRPEPXbZK25r3Htzp2o1x7xdMMmfocKNW', engines.uDefiuUSDV2, 0), // disabling this because backing of uUSD is already counted in tvl + // fetchBalance(balances, ADDRESSES.tezos.uUSD, engines.uDefiuUSDV2, 0), // disabling this because backing of uUSD is already counted in tvl fetchBalance(balances, usdtAddressTezos, engines.uUSDUSDtV3, 0), fetchBalance(balances, tzBTC_TOKEN, engines.uUSDtzBTCV2, 0), fetchBalance(balances, tzBTC_TOKEN, engines.uUSDtzBTCV3, 0), @@ -83,12 +82,11 @@ async function tvl() { fetchBalance(balances, 'tzbtc-lp', engines.uDefitzBTCLPV2, 0, sharePrice), ]) - return convertBalances(balances) + return balances } async function pool2() { const balances = {} - const fixBalances = await getFixBalances('tezos') const youvesLPs = dexes.map(i => i.contractAddress).filter(i => i) let eligibleFarms = farms.filter(i => !youvesLPs.includes(i.lpToken)).map(({ farmContract, lpToken: { contractAddress } }) => ({ farmContract, contractAddress })) @@ -103,21 +101,9 @@ async function pool2() { promises.push(resolveLPPosition({ balances, lpToken: contractAddress, owner: farmContract, ignoreList: youvesLPs })) await Promise.all(promises) - fixBalances(balances) - if (balances[`tezos:${uDEFI_TOKEN}`]) { - const uDefiPrice = await getUDefiPriceTEZ() - - sdk.util.sumSingleBalance(balances, 'tezos', +BigNumber(balances[`tezos:${uDEFI_TOKEN}`]).multipliedBy(uDefiPrice).toFixed(0)) - delete balances[`tezos:${uDEFI_TOKEN}`] - } return balances } -async function getUDefiPriceTEZ() { - const poolTokens = await getTokenBalances(uDEFI_LP) - return BigNumber(poolTokens.tezos).dividedBy(poolTokens[uDEFI_TOKEN]) -} - module.exports = { timetravel: false, tezos: { diff --git a/projects/yslio/abi.json b/projects/yslio/abi.json index f4f30bb6489..09358681e39 100644 --- a/projects/yslio/abi.json +++ b/projects/yslio/abi.json @@ -1,74 +1,5 @@ { - "poolInfo": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "poolInfo", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "lpToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "allocPoint", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastRewardBlock", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accsYSLPerShare", - "type": "uint256" - }, - { - "internalType": "contract IStrategy", - "name": "strat", - "type": "address" - }, - { - "internalType": "bool", - "name": "isActive", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - "poolLength": { - "inputs": [], - "name": "poolLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "symbol": { - "constant": true, - "inputs": [], - "name": "symbol", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } + "poolInfo": "function poolInfo(uint256) view returns (address lpToken, uint256 allocPoint, uint256 lastRewardBlock, uint256 accsYSLPerShare, address strat, bool isActive)", + "poolLength": "uint256:poolLength", + "symbol": "string:symbol" } \ No newline at end of file diff --git a/projects/ysmart/index.js b/projects/ysmart/index.js new file mode 100644 index 00000000000..e7b5ff08e8f --- /dev/null +++ b/projects/ysmart/index.js @@ -0,0 +1,15 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require("../helper/unwrapLPs"); + +const masterchef = "0x705A71efadD12faDac67600b666D8c0347848BD3"; +const token_USDC = ADDRESSES.telos.ETH; +const token_USDT = ADDRESSES.moonriver.USDT; + +module.exports = { + kava: { + tvl: sumTokensExport({ + owner: masterchef, + tokens: [token_USDC, token_USDT] + }) + } +} diff --git a/projects/yupana/index.js b/projects/yupana/index.js index a5dd0fc13a8..0ee11631b3b 100644 --- a/projects/yupana/index.js +++ b/projects/yupana/index.js @@ -1,13 +1,10 @@ const sdk = require("@defillama/sdk") const { - convertBalances, getStorage, getBigMapById, sumTokens2, } = require("../helper/chain/tezos"); -const { default: BigNumber } = require("bignumber.js"); const YUPANA_CORE = "KT1Rk86CX85DjBKmuyBhrCyNsHyudHVtASec"; -const wTEZ = "KT1UpeXdK6AJbX58GJ92pLZVCucn2DR8Nu4b"; async function tvl() { return sumTokens2({ owners: [YUPANA_CORE], includeTezos: true, }) @@ -19,7 +16,7 @@ async function borrowed() { const tokens_map = await getBigMapById(storage.storage.tokens); for (const id in tokens_map) { const token = tokens_map[id]; - const token_borrows = new BigNumber(token.totalBorrowsF).div(10 ** 18); + const token_borrows = token.totalBorrowsF / 1e18; let token_address; if (token.mainToken.fA2) token_address = @@ -27,14 +24,12 @@ async function borrowed() { (token.mainToken.fA2.nat > 0 ? "-" + token.mainToken.fA2.nat : ""); else token_address = `${token.mainToken.fA12}`; - sdk.util.sumSingleBalance(balances, token_address, +token_borrows.toFixed(0) - ); + sdk.util.sumSingleBalance(balances, token_address, token_borrows, 'tezos'); } - return convertBalances(balances) + return balances } module.exports = { - misrepresentedTokens: true, timetravel: false, tezos: { tvl, diff --git a/projects/zabufinance/abi.json b/projects/zabufinance/abi.json index e56e8057ce5..c64f68c28f5 100644 --- a/projects/zabufinance/abi.json +++ b/projects/zabufinance/abi.json @@ -1,49 +1,4 @@ { - "poolInfo": { - "type": "function", - "stateMutability": "view", - "outputs": [ - { - "type": "address", - "name": "lpToken", - "internalType": "contract IERC20" - }, - { - "type": "uint256", - "name": "allocPoint", - "internalType": "uint256" - }, - { - "type": "uint256", - "name": "lastRewardBlock", - "internalType": "uint256" - }, - { - "type": "uint256", - "name": "accRewardPerShare", - "internalType": "uint256" - } - ], - "name": "poolInfo", - "inputs": [ - { - "type": "uint256", - "name": "", - "internalType": "uint256" - } - ] - }, - "poolLength": { - "type": "function", - "stateMutability": "view", - "outputs": [ - { - "type": "uint256", - "name": "", - "internalType": "uint256" - } - ], - "name": "poolLength", - "inputs": [] - } + "poolInfo": "function poolInfo(uint256) view returns (address lpToken, uint256 allocPoint, uint256 lastRewardBlock, uint256 accRewardPerShare)", + "poolLength": "uint256:poolLength" } \ No newline at end of file diff --git a/projects/zencha/index.js b/projects/zencha/index.js index 3c356cddf85..ba465503945 100644 --- a/projects/zencha/index.js +++ b/projects/zencha/index.js @@ -1,19 +1,20 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens } = require("../helper/unwrapLPs"); const swapFlashLoan = '0x2D027B49B8960810F84D5fE172d07FFf62311852'; const tokens = { DAI: { - boba: '0xf74195bb8a5cf652411867c5c2c5b8c2a402be35', - eth: '0x6b175474e89094c44da98b954eedeac495271d0f' + boba: ADDRESSES.boba.DAI, + eth: ADDRESSES.ethereum.DAI }, USDT: { - boba: '0x5de1677344d3cb0d7d465c10b72a8f60699c062d', - eth: '0xdac17f958d2ee523a2206206994597c13d831ec7' + boba: ADDRESSES.boba.USDT, + eth: ADDRESSES.ethereum.USDT }, USDC: { - boba: '0x66a2a913e447d6b4bf33efbec43aaef87890fbbc', - eth: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48' + boba: ADDRESSES.boba.USDC, + eth: ADDRESSES.ethereum.USDC } }; @@ -21,11 +22,11 @@ function transform(address) { for (let token of Object.keys(tokens)) { if (tokens[token].boba == address) { return tokens[token].eth; - }; - }; + } + } return address; -}; +} async function tvl(timestamp, block, chainBlocks) { block = chainBlocks.boba; @@ -44,7 +45,7 @@ async function tvl(timestamp, block, chainBlocks) { ); return balances; -}; +} module.exports = { boba: { diff --git a/projects/zeniq-swap/index.js b/projects/zeniq-swap/index.js new file mode 100644 index 00000000000..98a75efaab2 --- /dev/null +++ b/projects/zeniq-swap/index.js @@ -0,0 +1,3 @@ +const { uniTvlExport } = require('../helper/unknownTokens') + +module.exports = uniTvlExport('zeniq', '0x7D0cbcE25EaaB8D5434a53fB3B42077034a9bB99') \ No newline at end of file diff --git a/projects/zenith/contracts.json b/projects/zenith/contracts.json new file mode 100644 index 00000000000..4bdfd42b7fa --- /dev/null +++ b/projects/zenith/contracts.json @@ -0,0 +1,32 @@ +{ + "admin": "0x3a11537C0e1f1cc80820a1EEd973bB367Bf3276A", + "ZTH": "0x00000000A82B4758df44fcB124e26a9B441E59a0", + "masterChef": "0xb9e7008FA856D66680BeE9E0a24da407D9d7fAD5", + "esZTH": "0x4DC377c2B63d06fF47BBd2B3B1177cfAC1906b1e", + "treasury": "0x648F3eC98da4De19b92598CF384662d494D881AB", + "ZTHETHPairV2":"0xAC0155CBd306e41C1287E2c53e1306178397b823", + "config": { + "startTime": 1683469800 + }, + "stakePools": [ + { + "pid": 0, + "name":"ETH", + "asset": "0x0000000000000000000000000000000000000000" + }, + { + "pid": 1, + "name":"ZTH-ETH", + "asset": "0xAC0155CBd306e41C1287E2c53e1306178397b823" + }, + { + "pid": 4, + "name":"stETH", + "asset": "0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84" + }, { + "pid": 5, + "name":"rETH", + "asset": "0xae78736Cd615f374D3085123A210448E74Fc6393" + } + ] +} diff --git a/projects/zenith/index.js b/projects/zenith/index.js new file mode 100644 index 00000000000..ebfeb702f70 --- /dev/null +++ b/projects/zenith/index.js @@ -0,0 +1,18 @@ +const { stakings } = require("../helper/staking"); +const { pool2s } = require("../helper/pool2"); + +const contracts = require("./contracts.json"); + +var pool2= [contracts.ZTHETHPairV2]; +var stakeTokens=[]; +contracts.stakePools.forEach(r=> {if(r.asset!=contracts.ZTHETHPairV2) stakeTokens.push(r.asset) }); + + +module.exports = { + methodology: + "TVL is comprised of tokens deposited to Zenith protocol as collateral, similar to Compound Finance and other lending protocols the borrowed tokens are not counted as TVL.", + ethereum: { + pool2: pool2s([contracts.masterChef], pool2), + tvl: stakings([contracts.masterChef], stakeTokens), + }, +}; diff --git a/projects/zenithswap/index.js b/projects/zenithswap/index.js new file mode 100644 index 00000000000..99c9cc5c8b9 --- /dev/null +++ b/projects/zenithswap/index.js @@ -0,0 +1,15 @@ +const { getUniTVL } = require('../helper/unknownTokens') +const { staking } = require('../helper/staking') + +const MASTER_CHEF = '0xa3b19C3aFD545900B778Cc7B3e2dC35848672aC2' +const ZSP_TOKEN = '0xb2dcbd5258a22385240e4ac13fc6726b66f0de96' + +module.exports = { + misrepresentedTokens: true, + methodology: + "Factory address (0x8F086a081621bbc13B6d02A9e1123212CF07fdf8) is used to find the LP pairs. TVL is equal to the liquidity on the AMM.", + arbitrum: { + tvl: getUniTVL({ factory: '0x8F086a081621bbc13B6d02A9e1123212CF07fdf8', chain: 'arbitrum', useDefaultCoreAssets: true }), + staking: staking( MASTER_CHEF, ZSP_TOKEN, 'arbitrum') + }, +}; \ No newline at end of file diff --git a/projects/zenlink/abis/StableSwap.json b/projects/zenlink/abis/StableSwap.json index 62bb9133491..0c0c5107fc8 100644 --- a/projects/zenlink/abis/StableSwap.json +++ b/projects/zenlink/abis/StableSwap.json @@ -1,28 +1,4 @@ { - "getTokens": { - "inputs": [], - "name": "getTokens", - "outputs": [ - { - "internalType": "contract IERC20[]", - "name": "", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getTokenBalances": { - "inputs": [], - "name": "getTokenBalances", - "outputs": [ - { - "internalType": "uint256[]", - "name": "", - "type": "uint256[]" - } - ], - "stateMutability": "view", - "type": "function" - } + "getTokens": "address[]:getTokens", + "getTokenBalances": "uint256[]:getTokenBalances" } \ No newline at end of file diff --git a/projects/zenlink/abis/factory.json b/projects/zenlink/abis/factory.json deleted file mode 100644 index 98792352936..00000000000 --- a/projects/zenlink/abis/factory.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "allPairs": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "allPairs", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "allPairsLength": { - "inputs": [], - "name": "allPairsLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -} diff --git a/projects/zenlink/abis/getReserves.json b/projects/zenlink/abis/getReserves.json deleted file mode 100644 index 62bc851ba00..00000000000 --- a/projects/zenlink/abis/getReserves.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "inputs": [], - "name": "getReserves", - "outputs": [ - { - "internalType": "uint112", - "name": "_reserve0", - "type": "uint112" - }, - { - "internalType": "uint112", - "name": "_reserve1", - "type": "uint112" - } - ], - "stateMutability": "view", - "type": "function" -} diff --git a/projects/zenlink/abis/stake.json b/projects/zenlink/abis/stake.json deleted file mode 100644 index 2817fe780bb..00000000000 --- a/projects/zenlink/abis/stake.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "stakeToken": { - "inputs": [], - "name": "STAKED_TOKEN", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "totalStakedAmount": { - "inputs": [], - "name": "totalStakedAmount", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -} \ No newline at end of file diff --git a/projects/zenlink/abis/token0.json b/projects/zenlink/abis/token0.json deleted file mode 100644 index 310e9325924..00000000000 --- a/projects/zenlink/abis/token0.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "inputs": [], - "name": "token0", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" -} \ No newline at end of file diff --git a/projects/zenlink/abis/token1.json b/projects/zenlink/abis/token1.json deleted file mode 100644 index 4d4b70cbd47..00000000000 --- a/projects/zenlink/abis/token1.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "inputs": [], - "name": "token1", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" -} \ No newline at end of file diff --git a/projects/zenlink/getUsdTvl.js b/projects/zenlink/getUsdTvl.js deleted file mode 100644 index 40d9ea82a78..00000000000 --- a/projects/zenlink/getUsdTvl.js +++ /dev/null @@ -1,364 +0,0 @@ -const sdk = require('@defillama/sdk'); -const token0 = require('./abis/token0.json'); -const token1 = require('./abis/token1.json'); -const getReserves = require('./abis/getReserves.json'); -const factoryAbi = require('./abis/factory.json'); -const stableSwapAbi = require('./abis/StableSwap.json'); - -const { getBlock } = require('../helper/getBlock'); - - -async function getStableSwapPool( - chain, - block, - address = [], - stablePoolTokenMap - ) { - const contractAddress = address; - const [tokensOutput, balancesOutput] = await Promise.all([ - sdk.api.abi - .multiCall({ - abi: stableSwapAbi.getTokens, - chain, - calls: contractAddress.map((contract) => ({ - target: contract, - })), - block, - }) - .then(({ output }) => output), - sdk.api.abi - .multiCall({ - abi: stableSwapAbi.getTokenBalances, - chain, - calls: contractAddress.map((contract) => ({ - target: contract, - })), - }) - .then(({ output }) => output) - ]); - - const tokensList = tokensOutput.map((item) => item.output); - const balancesList = balancesOutput.map((item) => item.output); - - const tokenAmountArray = tokensList.flatMap((item, index) => { - const tokens = Object.values(item); - const balances = Object.values(balancesList[index]); - - return tokens.map((r, i) => { - let token = r.toLowerCase(); - if(stablePoolTokenMap[token]) { - token = stablePoolTokenMap[token] - } - - const amount = balances[i]; - return { - token, - amount, - } - }); - }); - return tokenAmountArray; -}; - -async function requery(results, chain, block, abi) { - if (results.some(r => !r.success)) { - const failed = results.map((r, i) => [r, i]).filter(r => !r[0].success) - const newResults = await sdk.api.abi - .multiCall({ - abi, - chain, - calls: failed.map((f) => f[0].input), - block, - }).then(({ output }) => output); - failed.forEach((f, i) => { - results[f[1]] = newResults[i] - }) - } -} - -function sum(balances, token, amount) { - if (balances[token] === undefined) { - balances[token] = 0 - } - balances[token] += Number(amount) -} - -function setPrice(prices, address, coreAmount, tokenAmount) { - if (prices[address] !== undefined) { - const currentCoreAmount = prices[address][0] - if (coreAmount < currentCoreAmount) { - return - } - } - prices[address] = [Number(coreAmount), Number(coreAmount) / Number(tokenAmount)] -} - -function calculateMoonriverTvl ( - FACTORY, - chain, - tokenChainMap = {}, - allowUndefinedBlock = true, - stableSwapContractAddress = [] -) { - return async (timestamp, ethBlock, chainBlocks) => { - const block = await getBlock(timestamp, chain, chainBlocks, allowUndefinedBlock) - - let pairAddresses; - const pairLength = (await sdk.api.abi.call({ - target: FACTORY, - abi: factoryAbi.allPairsLength, - chain, - block - })).output - if (pairLength === null) { - throw new Error("allPairsLength() failed") - } - const pairNums = Array.from(Array(Number(pairLength)).keys()) - { - const pairs = (await sdk.api.abi.multiCall({ - abi: factoryAbi.allPairs, - chain, - calls: pairNums.map(num => ({ - target: FACTORY, - params: [num] - })), - block - })).output - await requery(pairs, chain, block, factoryAbi.allPairs); - pairAddresses = pairs.map(result => result.output.toLowerCase()) - } - - const [token0Addresses, token1Addresses, reserves] = await Promise.all([ - sdk.api.abi - .multiCall({ - abi: token0, - chain, - calls: pairAddresses.map((pairAddress) => ({ - target: pairAddress, - })), - block, - }) - .then(({ output }) => output), - sdk.api.abi - .multiCall({ - abi: token1, - chain, - calls: pairAddresses.map((pairAddress) => ({ - target: pairAddress, - })), - block, - }) - .then(({ output }) => output), - sdk.api.abi - .multiCall({ - abi: getReserves, - chain, - calls: pairAddresses.map((pairAddress) => ({ - target: pairAddress, - })), - block, - }).then(({ output }) => output), - ]); - await requery(token0Addresses, chain, block, token0); - await requery(token1Addresses, chain, block, token1); - await requery(reserves, chain, block, getReserves); - - const pairs = {}; - // add token0Addresses - token0Addresses.forEach((token0Address) => { - const tokenAddress = token0Address.output.toLowerCase(); - - const pairAddress = token0Address.input.target.toLowerCase(); - pairs[pairAddress] = { - token0Address: tokenAddress, - } - }); - - // add token1Addresses - token1Addresses.forEach((token1Address) => { - const tokenAddress = token1Address.output.toLowerCase(); - const pairAddress = token1Address.input.target.toLowerCase(); - pairs[pairAddress] = { - ...(pairs[pairAddress] || {}), - token1Address: tokenAddress, - } - }); - - const balances = {} - for (let i = 0; i < reserves.length; i++) { - const pairAddress = reserves[i].input.target.toLowerCase(); - const pair = pairs[pairAddress]; - const token0Address = pair.token0Address.toLowerCase() - const token1Address = pair.token1Address.toLowerCase() - const reserveAmounts = reserves[i].output - let token0ChainAddress = `${chain}:${token0Address}`; - let token1ChainAddress = `${chain}:${token1Address}`; - if(tokenChainMap[token0Address]) { - token0ChainAddress = tokenChainMap[token0Address]; - } - if(tokenChainMap[token1Address]) { - token1ChainAddress = tokenChainMap[token1Address]; - } - sum(balances, token0ChainAddress, reserveAmounts[0]) - sum(balances, token1ChainAddress, reserveAmounts[1]) - } - - const result = await getStableSwapPool(chain, block, stableSwapContractAddress); - - result.map((item) => { - sum(balances, `${chain}:${item.token}`, Number(item.amount)) - }) - - return balances; - } -} - -function calculateUsdTvl( - FACTORY, - chain, - coreAssetRaw, - whitelistRaw, - allowUndefinedBlock = true, - coreAssetName, - decimals = 18, - stableSwapContractAddress = [], - stablePoolTokenMap = {}, -) { - const whitelist = whitelistRaw.map(t => t.toLowerCase()) - const coreAsset = coreAssetRaw.toLowerCase() - return async (timestamp, ethBlock, chainBlocks) => { - const block = await getBlock(timestamp, chain, chainBlocks, allowUndefinedBlock) - - let pairAddresses; - const pairLength = (await sdk.api.abi.call({ - target: FACTORY, - abi: factoryAbi.allPairsLength, - chain, - block - })).output - if (pairLength === null) { - throw new Error("allPairsLength() failed") - } - const pairNums = Array.from(Array(Number(pairLength)).keys()) - { - const pairs = (await sdk.api.abi.multiCall({ - abi: factoryAbi.allPairs, - chain, - calls: pairNums.map(num => ({ - target: FACTORY, - params: [num] - })), - block - })).output - await requery(pairs, chain, block, factoryAbi.allPairs); - pairAddresses = pairs.map(result => result.output.toLowerCase()) - } - - const [token0Addresses, token1Addresses, reserves] = await Promise.all([ - sdk.api.abi - .multiCall({ - abi: token0, - chain, - calls: pairAddresses.map((pairAddress) => ({ - target: pairAddress, - })), - block, - }) - .then(({ output }) => output), - sdk.api.abi - .multiCall({ - abi: token1, - chain, - calls: pairAddresses.map((pairAddress) => ({ - target: pairAddress, - })), - block, - }) - .then(({ output }) => output), - sdk.api.abi - .multiCall({ - abi: getReserves, - chain, - calls: pairAddresses.map((pairAddress) => ({ - target: pairAddress, - })), - block, - }).then(({ output }) => output), - ]); - await requery(token0Addresses, chain, block, token0); - await requery(token1Addresses, chain, block, token1); - await requery(reserves, chain, block, getReserves); - - const pairs = {}; - // add token0Addresses - token0Addresses.forEach((token0Address) => { - const tokenAddress = token0Address.output.toLowerCase(); - - const pairAddress = token0Address.input.target.toLowerCase(); - pairs[pairAddress] = { - token0Address: tokenAddress, - } - }); - - // add token1Addresses - token1Addresses.forEach((token1Address) => { - const tokenAddress = token1Address.output.toLowerCase(); - const pairAddress = token1Address.input.target.toLowerCase(); - pairs[pairAddress] = { - ...(pairs[pairAddress] || {}), - token1Address: tokenAddress, - } - }); - - const balances = {} - let coreBalance = 0 - const prices = {} - for (let i = 0; i < reserves.length; i++) { - const pairAddress = reserves[i].input.target.toLowerCase(); - const pair = pairs[pairAddress]; - const token0Address = pair.token0Address.toLowerCase() - const token1Address = pair.token1Address.toLowerCase() - const reserveAmounts = reserves[i].output - if (token0Address === coreAsset) { - coreBalance += Number(reserveAmounts[0]) * 2 - if (whitelist.includes(token1Address)) { - setPrice(prices, token1Address, reserveAmounts[0], reserveAmounts[1]) - } - } else if (token1Address === coreAsset) { - coreBalance += Number(reserveAmounts[1]) * 2 - if (whitelist.includes(token0Address)) { - setPrice(prices, token0Address, reserveAmounts[1], reserveAmounts[0]) - } - } else { - const whitelistedToken0 = whitelist.find(t => t === token0Address) - const whitelistedToken1 = whitelist.find(t => t === token1Address) - if (whitelistedToken0 !== undefined) { - sum(balances, whitelistedToken0, Number(reserveAmounts[0]) * 2) - } else if (whitelistedToken1 !== undefined) { - sum(balances, whitelistedToken1, Number(reserveAmounts[1]) * 2) - } - } - } - - const result = await getStableSwapPool(chain, block, stableSwapContractAddress, stablePoolTokenMap); - - result.map((item) => { - sum(balances, item.token, Number(item.amount)) - }) - - Object.entries(balances).forEach(([address, amount]) => { - const price = prices[address]; - if (price !== undefined) { - coreBalance += price[1] * (amount ?? 0) - } - }) - return { - [coreAssetName]: (coreBalance) / (10 ** decimals) - } - } -} - -module.exports = { - calculateMoonriverTvl, - calculateUsdTvl, -}; diff --git a/projects/zenlink/index.js b/projects/zenlink/index.js index 0a956b689a1..e901a4723f2 100644 --- a/projects/zenlink/index.js +++ b/projects/zenlink/index.js @@ -1,163 +1,60 @@ -const { calculateUsdTvl, calculateMoonriverTvl } = require('./getUsdTvl') - -const tokenChainMap = { - '0x3b25bc1dc591d24d60560d0135d6750a561d4764': '0xc3d088842dcf02c13699f936bb83dfbbc6f721ab', // vETH -} - - -const moonriverStablePoolTokenMap = { - "0xffc7780c34b450d917d557e728f033033cb4fa8c": "0xffffffff1fcacbd218edc0eba20fc2308c778080", // stKSM -> xcKSM +const sdk = require('@defillama/sdk') +const { getUniTVL } = require('../helper/unknownTokens') +const getReserves = 'function getReserves() view returns (uint112 _reserve0, uint112 _reserve1)'; +const stableSwapAbi = require('./abis/StableSwap.json'); + + +function getStableSwapPool(contracts) { + return async (_, _1, _2, { api }) => { + const tokensArray = await api.multiCall({ abi: stableSwapAbi.getTokens, calls: contracts }) + const balsArray = await api.multiCall({ abi: stableSwapAbi.getTokenBalances, calls: contracts }) + tokensArray.map((v, i) => api.addTokens(v, balsArray[i])) + return api.getBalances() + } } - const MoonriverStableSwapContractAddress = [ - "0x7BDE79AD4ae9023AC771F435A1DC6efdF3F434D1", // USDT/USDC/xcAUSD/FRAX - "0xd38A007F60817635163637411353BB1987209827", // xcKSM/stKSM - ]; + "0x7BDE79AD4ae9023AC771F435A1DC6efdF3F434D1", // USDT/USDC/xcAUSD/FRAX + "0xd38A007F60817635163637411353BB1987209827", // xcKSM/stKSM +]; const MoonbeamStableSwapContractAddress = [ - '0x68bed2c54Fd0e6Eeb70cFA05723EAE7c06805EC5', // 4pool - ]; + '0x68bed2c54Fd0e6Eeb70cFA05723EAE7c06805EC5', // 4pool +]; const AstarStableSwapContractAddress = [ - '0xb0Fa056fFFb74c0FB215F86D691c94Ed45b686Aa', // 4pool + '0xb0Fa056fFFb74c0FB215F86D691c94Ed45b686Aa', // 4pool ]; -function sumMultiPoolVersionTvl(poolTvls) { - const total = {}; - poolTvls.forEach((tvlVersion) => { - Object.entries(tvlVersion).forEach(([assetName, balance]) => { - if(!total[assetName]) { - total[assetName] = 0; - } - total[assetName] += balance; - }); - }); - return total; -}; - -async function calcuteMoonriverTvl(timestamp, ethBlock, chainBlocks) { - const v1Tvl = await calculateUsdTvl( - "0xf36AE63d89983E3aeA8AaaD1086C3280eb01438D", - "moonriver", - "0x98878b06940ae243284ca214f92bb71a2b032b8a", - [ - "0xe3f5a90f9cb311505cd691a46596599aa1a0ad7d", // USDC - "0xb44a9b6905af7c801311e8f4e76932ee959c663c", // USDT - "0xffffffffa1b026a00fbaa67c86d5d1d5bf8d8228", // xcAUSD - "0x1a93b23281cc1cde4c4741353f3064709a16197d", // FRAX - "0xffffffff1fcacbd218edc0eba20fc2308c778080", // xcKSM - "0x639a647fbe20b6c8ac19e48e2de44ea792c62c5c", // ETH - ], - true, - "moonriver", - 18, - MoonriverStableSwapContractAddress, - moonriverStablePoolTokenMap - )(timestamp, ethBlock, chainBlocks); - - const v2Tvl = await calculateUsdTvl( - "0x28Eaa01DC747C4e9D37c5ca473E7d167E90F8d38", - "moonriver", - "0x98878b06940ae243284ca214f92bb71a2b032b8a", - [ - "0xe3f5a90f9cb311505cd691a46596599aa1a0ad7d", // USDC - "0xb44a9b6905af7c801311e8f4e76932ee959c663c", // USDT - "0xffffffffa1b026a00fbaa67c86d5d1d5bf8d8228", // xcAUSD - "0x1a93b23281cc1cde4c4741353f3064709a16197d", // FRAX - "0xffffffff1fcacbd218edc0eba20fc2308c778080", // xcKSM - "0x639a647fbe20b6c8ac19e48e2de44ea792c62c5c", // ETH - ], - true, - "moonriver", - 18, - [], - {} - )(timestamp, ethBlock, chainBlocks); - const tvlTotal = sumMultiPoolVersionTvl([ - v1Tvl, - v2Tvl - ]); - return tvlTotal; -}; - - -async function calcuteMoonbeamTvl(timestamp, ethBlock, chainBlocks) { - const v1Tvl = await calculateUsdTvl( - "0xF49255205Dfd7933c4D0f25A57D40B1511F92fEF", - "moonbeam", - "0xacc15dc74880c9944775448304b263d191c6077f", - [ - "0x8f552a71efe5eefc207bf75485b356a0b3f01ec9", // madUSDC - "0xc234a67a4f840e61ade794be47de455361b52413", // madDAI - "0x8e70cd5b4ff3f62659049e74b6649c6603a0e594", //madUSDT - "0x818ec0A7Fe18Ff94269904fCED6AE3DaE6d6dC0b", // anyUSDC - "0xefaeee334f0fd1712f9a8cc375f427d9cdd40d73", // anyUSDT - "0x765277eebeca2e31912c9946eae1021199b39c61", // anyDAI - "0xffffffff52c56a9257bb97f4b2b6f7b2d624ecda", // xcAUSD - "0x322e86852e492a7ee17f28a78c663da38fb33bfb", // FRAX - "0x81ecac0d6be0550a00ff064a4f9dd2400585fe9c", // ceUSDT - "0x6a2d262d56735dba19dd70682b39f6be9a931d98" // ceUSDC - ], - true, - "moonbeam", - 18, - MoonbeamStableSwapContractAddress - )(timestamp, ethBlock, chainBlocks); - - const v2Tvl = await calculateUsdTvl( - "0x079710316b06BBB2c0FF4bEFb7D2DaC206c716A0", - "moonbeam", - "0xacc15dc74880c9944775448304b263d191c6077f", - [ - "0x8f552a71efe5eefc207bf75485b356a0b3f01ec9", // madUSDC - "0xc234a67a4f840e61ade794be47de455361b52413", // madDAI - "0x8e70cd5b4ff3f62659049e74b6649c6603a0e594", //madUSDT - "0x818ec0A7Fe18Ff94269904fCED6AE3DaE6d6dC0b", // anyUSDC - "0xefaeee334f0fd1712f9a8cc375f427d9cdd40d73", // anyUSDT - "0x765277eebeca2e31912c9946eae1021199b39c61", // anyDAI - "0xffffffff52c56a9257bb97f4b2b6f7b2d624ecda", // xcAUSD - "0x322e86852e492a7ee17f28a78c663da38fb33bfb", // FRAX - "0x81ecac0d6be0550a00ff064a4f9dd2400585fe9c", // ceUSDT - "0x6a2d262d56735dba19dd70682b39f6be9a931d98" // ceUSDC - ], - true, - "moonbeam", - 18, - [] - )(timestamp, ethBlock, chainBlocks); - const tvlTotal = sumMultiPoolVersionTvl([ - v1Tvl, - v2Tvl - ]); - return tvlTotal; -}; +const uniArgs = { + useDefaultCoreAssets: true, abis: { getReserves }, blacklistedTokens: [ + MoonbeamStableSwapContractAddress, + MoonriverStableSwapContractAddress, + AstarStableSwapContractAddress, + ].flat() +} module.exports = { - methodology: "Get all pairs from the Factory Contract then get the reserve0 token amount and reserve1 token amount in one pair. Update the total balance of each token by reserve0 and reserve1. Repeat 2 ~ 3 for each pairs.", - misrepresentedTokens: true, - moonriver: { - tvl: calcuteMoonriverTvl - }, - moonbeam: { - tvl: calcuteMoonbeamTvl - }, - astar: { - tvl: calculateUsdTvl( - "0x7BAe21fB8408D534aDfeFcB46371c3576a1D5717", - "astar", - "0xaeaaf0e2c81af264101b9129c00f4440ccf0f720", - [ - "0x3795c36e7d12a8c252a20c5a7b455f7c57b60283", // USDT - "0x6a2d262d56735dba19dd70682b39f6be9a931d98", // USDC - "0x6de33698e9e9b787e09d3bd7771ef63557e148bb", // DAI - "0x733ebcc6df85f8266349defd0980f8ced9b45f35", // BAI - "0x4bf769b05e832fcdc9053fffbc78ca889acb5e1e" // BUSD - ], - true, - "astar", - 18, - AstarStableSwapContractAddress - ) - } + methodology: "Get all pairs from the Factory Contract then get the reserve0 token amount and reserve1 token amount in one pair. Update the total balance of each token by reserve0 and reserve1. Repeat 2 ~ 3 for each pairs.", + misrepresentedTokens: true, + moonriver: { + tvl: sdk.util.sumChainTvls([ + getUniTVL({ factory: '0xf36AE63d89983E3aeA8AaaD1086C3280eb01438D', ...uniArgs, }), + getUniTVL({ factory: '0x28Eaa01DC747C4e9D37c5ca473E7d167E90F8d38', ...uniArgs, }), + getStableSwapPool(MoonriverStableSwapContractAddress), + ]) + }, + moonbeam: { + tvl: sdk.util.sumChainTvls([ + getUniTVL({ factory: '0xF49255205Dfd7933c4D0f25A57D40B1511F92fEF', ...uniArgs, }), + getUniTVL({ factory: '0x079710316b06BBB2c0FF4bEFb7D2DaC206c716A0', ...uniArgs, }), + getStableSwapPool(MoonbeamStableSwapContractAddress), + ]) + }, + astar: { + tvl: sdk.util.sumChainTvls([ + getUniTVL({ factory: '0x7BAe21fB8408D534aDfeFcB46371c3576a1D5717', ...uniArgs, }), + getStableSwapPool(AstarStableSwapContractAddress), + ]) + }, } diff --git a/projects/zerodex/index.js b/projects/zerodex/index.js index e4b1543c449..f30abae68f2 100644 --- a/projects/zerodex/index.js +++ b/projects/zerodex/index.js @@ -2,16 +2,20 @@ const { getUniTVL } = require('../helper/unknownTokens'); module.exports = { avax: { tvl: getUniTVL( { - chain: 'avax', factory: '0x2Ef422F30cdb7c5F1f7267AB5CF567A88974b308', useDefaultCoreAssets: true, }) }, bsc: { tvl: getUniTVL( { - chain: 'bsc', factory: '0x52abdb3536a3a966056e096f2572b2755df26eac', useDefaultCoreAssets: true, }) }, + polygon: { + tvl: getUniTVL( { + factory: '0x6fd98cf211134081fe02f551d64cf89671d5443b', + useDefaultCoreAssets: true, + }) + }, }; \ No newline at end of file diff --git a/projects/zerolend/index.js b/projects/zerolend/index.js new file mode 100644 index 00000000000..76516fa3472 --- /dev/null +++ b/projects/zerolend/index.js @@ -0,0 +1,7 @@ +const { aaveExports } = require("../helper/aave"); + +module.exports = { + era: aaveExports("era", undefined, undefined, [ + "0xB73550bC1393207960A385fC8b34790e5133175E", + ]), +}; diff --git a/projects/zeroshift/index.js b/projects/zeroshift/index.js index bf34a371675..425f78fda67 100644 --- a/projects/zeroshift/index.js +++ b/projects/zeroshift/index.js @@ -1,10 +1,11 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { ohmTvl } = require("../helper/ohm"); const zrst = "0xf436Ea4C4f2e49F0679895aEAE39dab698350eAa"; const stakingContract = "0xe41450704aB574968714b7548E9BcfF31A2183e0"; const treasury = "0x197123D62A2252c0Ac668a72BAAe39AF333843E0"; const treasuryTokens = [ - ["0xd586e7f844cea2f87f50152665bcbc2c279d8d70", false], // DAI + [ADDRESSES.avax.DAI, false], // DAI ["0xeebb1784296ad9f965e90e2cc3c4cf588daebc2d", true] // ZRST-DAI JLP ] diff --git a/projects/zerotwohm/index.js b/projects/zerotwohm/index.js deleted file mode 100644 index 791c0323960..00000000000 --- a/projects/zerotwohm/index.js +++ /dev/null @@ -1,21 +0,0 @@ -const { ohmTvl } = require("../helper/ohm"); - -const stakingContract = "0x06B4dFAbAf0fb0Cf813526572cc86B2695c9D050"; -const Z2O = "0xdb96f8efd6865644993505318cc08FF9C42fb9aC"; - -const treasury = "0x00eFcbd55b59b5D08F3a7501C0Ddad34a57A3611"; -const treasuryTokens = [ - ["0x82af49447d8a07e3bd95bd0d56f35241523fbab1", false], // WETH - ["0x17fc002b466eec40dae837fc4be5c67993ddbd6f", false], // FRAX - ["0x2f2a2543b76a4166549f7aab2e75bef0aefc5b0f", false], // WBTC - ["0xfea7a6a0b346362bf88a9e4a88416b77a57d6c2a", false], // MIM - ["0x79f12596b78f9e982bdab6e2d83d4bc155672372", false], // chMIM - ["0x739ca6d71365a08f584c8fc4e1029045fa8abc4b", false], // wsOHM - ["0x40c938444c725EA6eb6992ca71F94b6945b43335", true], // Z2O-MIM SLP -]; - -module.exports = { - misrepresentedTokens: true, - ...ohmTvl(treasury, treasuryTokens, "arbitrum", stakingContract, Z2O), - methodology: "Counts as TVL all the assets deposited on the reasury", -}; diff --git a/projects/zest-protocol/abi.json b/projects/zest-protocol/abi.json index 4bdaad47b49..89cd4fbd2f7 100644 --- a/projects/zest-protocol/abi.json +++ b/projects/zest-protocol/abi.json @@ -1,51 +1,11 @@ { "bank": { - "usableCollateralBalance": { - "inputs": [], - "name": "usableCollateralBalance", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - } + "usableCollateralBalance": "uint256:usableCollateralBalance" }, "multiFeeDistribution": { - "totalSupply": { - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } + "totalSupply": "uint256:totalSupply" }, "pair": { - "getReserves": { - "inputs": [], - "name": "getReserves", - "outputs": [ - { - "internalType": "uint112", - "name": "_reserve0", - "type": "uint112" - }, - { - "internalType": "uint112", - "name": "_reserve1", - "type": "uint112" - }, - { - "internalType": "uint32", - "name": "_blockTimestampLast", - "type": "uint32" - } - ], - "stateMutability": "view", - "type": "function" - } + "getReserves": "function getReserves() view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast)" } } diff --git a/projects/zest-protocol/index.js b/projects/zest-protocol/index.js index 3ecc9598c10..dee057d6a7f 100644 --- a/projects/zest-protocol/index.js +++ b/projects/zest-protocol/index.js @@ -1,15 +1,16 @@ +const ADDRESSES = require('../helper/coreAssets.json') const Abis = require("./abi.json"); const sdk = require("@defillama/sdk"); const BigNumber = require("bignumber.js"); const Contracts = { fantom: { - wftm: "0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83", + wftm: ADDRESSES.fantom.WFTM, wethBank: "0xB717b014BC34fc904396585CbF4FC1B0BBe603B4", weth: "0x74b23882a30290451A17c44f4F05243b6b58C76d", zsp: "0x2C26617034C840C9412CD67aE0Fc68A6755D00BF", ftmz: "0x9e219b51891e2c62ea8a2ea438d331eae7c68484", - usdc: "0x04068DA6C83AFCFA0e13ba15A6696662335D5B75", + usdc: ADDRESSES.fantom.USDC, bank: "0x9fc3E5259Ba18BD13366D0728a256E703869F21D", multiFeeDistribution: "0x1b6deD5c603d66800B0DDf566Ec316a344C7BcaD", chef: "0xFdAa392FCF8946e8e658B9f36ffbE6659cB40edf", diff --git a/projects/zeus-finance/index.js b/projects/zeus-finance/index.js index 1563cc128d9..a0be4f5b22d 100644 --- a/projects/zeus-finance/index.js +++ b/projects/zeus-finance/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const {addFundsInMasterChef} = require("../helper/masterchef"); const {stakingUnknownPricedLP} = require("../helper/staking"); const {pool2BalanceFromMasterChefExports} = require("../helper/pool2") @@ -9,7 +10,7 @@ async function tvl(timestamp, block, chainBlocks) { let balances = {}; await addFundsInMasterChef(balances, masterchef, chainBlocks.cronos, "cronos", addr=>{ if (addr.toLowerCase() === "0xf2001b145b43032aaf5ee2884e456ccd805f677d") { - return "0x6b175474e89094c44da98b954eedeac495271d0f" + return ADDRESSES.ethereum.DAI } return `cronos:${addr}` }, undefined, [token], true, true, token); diff --git a/projects/zeus/index.js b/projects/zeus/index.js deleted file mode 100644 index d708dae54cf..00000000000 --- a/projects/zeus/index.js +++ /dev/null @@ -1,27 +0,0 @@ -const abi = require("../helper/abis/masterchef.json") -const { transformFantomAddress } = require("../helper/portedTokens"); -const { addFundsInMasterChef } = require("../helper/masterchef"); -const { staking } = require("../helper/staking"); -const { pool2Exports } = require('../helper/pool2') - - -const chef = "0x70C460D876895e72D28ee3125Cac556dC98aD2E1" -const zeus = "0xa5b92ef6d735a2B8A90ADB13EA96d8C9b18613D0" -const zeusFtmLP = "0x921230059Fc5181F95619f1EACaf13Bd30cd0ddD"; - -async function tvl(timestamp, block, chainBlocks) { - const balances = {} - const transformAddress = await transformFantomAddress(); - await addFundsInMasterChef(balances, chef, chainBlocks.fantom, "fantom", transformAddress, abi.poolInfo, [zeus, zeusFtmLP]); - return balances; -} - -module.exports = { - methodology: "TVL includes all farms in MasterChef contract", - fantom: { - tvl, - staking: staking(chef, zeus, "fantom"), - pool2: pool2Exports(chef, [zeusFtmLP], "fantom"), - }, - -} \ No newline at end of file diff --git a/projects/zharta/index.js b/projects/zharta/index.js new file mode 100644 index 00000000000..995b2d646c4 --- /dev/null +++ b/projects/zharta/index.js @@ -0,0 +1,19 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport, } = require('../helper/unwrapLPs') + +// Vaults +const collateralVault = "0xA79da8c90Aa480B3716C23145154CA6eF5Fc29C1"; +const punkVault = "0x94925030F48aDfc3e4A65a2E0A7444733406c144"; +const LP_CORE = "0xe3c959bc97b92973d5367dbf4ce1b7b9660ee271"; +const appraisalVault = "0xA79da8c90Aa480B3716C23145154CA6eF5Fc29C1"; + +module.exports = { + methodology: `Counts the floor value of all deposited NFTs with Chainlink price feeds. Borrowed coins are not counted towards the TVL`, + ethereum: { + tvl: sumTokensExport({ + owners: [collateralVault, punkVault, appraisalVault, LP_CORE], + tokens: [ADDRESSES.ethereum.WETH], + resolveNFTs: true, + }), + } +} \ No newline at end of file diff --git a/projects/zigzag/index.js b/projects/zigzag/index.js index e3cb3c1fa4b..691d0a386eb 100644 --- a/projects/zigzag/index.js +++ b/projects/zigzag/index.js @@ -1,5 +1,7 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { get } = require('../helper/http') const { toUSDTBalances } = require('../helper/balances') +const { sumTokensExport } = require('../helper/unwrapLPs') async function offers() { const markets = await get('https://zigzag-exchange.herokuapp.com/api/v1/markets') @@ -19,5 +21,15 @@ module.exports = { zksync: { offers, tvl: async () => ({}) + }, + arbitrum: { + tvl: sumTokensExport({ owner: '0xf4037f59c92c9893c43c2372286699430310cfe7', tokens: [ + ADDRESSES.arbitrum.USDC, + ADDRESSES.arbitrum.WETH, + ADDRESSES.arbitrum.USDT, + ADDRESSES.arbitrum.WBTC, + ADDRESSES.arbitrum.ARB, + ADDRESSES.arbitrum.LINK, + ]}) } } diff --git a/projects/zilch/abi.js b/projects/zilch/abi.js new file mode 100644 index 00000000000..2f98db614d8 --- /dev/null +++ b/projects/zilch/abi.js @@ -0,0 +1,90 @@ +module.exports = { + poolLength: { + "inputs": [], + "name": "poolLength", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function", + "constant": true + }, + poolInfo: { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "poolInfo", + "outputs": [ + { + "internalType": "contract IAsset", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "baseAllocPoint", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastRewardTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "accZilchPerShare", + "type": "uint256" + }, + { + "internalType": "contract IRewarder", + "name": "rewarder", + "type": "address" + }, + { + "internalType": "uint256", + "name": "sumOfFactors", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "accZilchPerFactorShare", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "adjustedAllocPoint", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function", + "constant": true + }, + underlyingToken: { + "inputs": [], + "name": "underlyingToken", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function", + "constant": true + }, +} \ No newline at end of file diff --git a/projects/zilch/index.js b/projects/zilch/index.js new file mode 100644 index 00000000000..8a8e5e957c4 --- /dev/null +++ b/projects/zilch/index.js @@ -0,0 +1,22 @@ +const abi = require('./abi') +const { sumTokens2 } = require('../helper/unwrapLPs') +const farm = "0xa65D04f79633BeBdC4Dd785498269e8ABD6A1476" + +async function tvl(_, _b, _cb, { api }) { + const poolInfos = await api.fetchList({ lengthAbi: abi.poolLength, itemAbi: abi.poolInfo, target: farm }) + let pools = poolInfos.map(i => i.lpToken) + const stakingPools = pools.slice(0, 3) + pools = pools.slice(3) + const stakingTokens = await api.multiCall({ abi: abi.underlyingToken, calls: stakingPools }) + const tokens = await api.multiCall({ abi: 'address:want', calls: pools }) + const bals = await api.multiCall({ abi: 'uint256:balanceOf', calls: pools }) + api.addTokens(tokens, bals) + return sumTokens2({ api, tokensAndOwners2: [stakingTokens, stakingPools] }) +} + +module.exports = { + era: { + tvl, + } +} + diff --git a/projects/zipswap/index.js b/projects/zipswap/index.js index c6269018044..85b36c0a30c 100644 --- a/projects/zipswap/index.js +++ b/projects/zipswap/index.js @@ -1,18 +1,39 @@ const { getUniTVL } = require('../helper/unknownTokens') +const { transformDexBalances } = require('../helper/portedTokens') +const uniswapAbi = require('../helper/abis/uniswap') +const sdk = require('@defillama/sdk') + +async function opTvl(_, _b, {optimism: block}) { + const chain = 'optimism' + const factory = '0x8BCeDD62DD46F1A76F8A1633d4f5B76e0CDa521E' + const data = [] + const length = await sdk.api2.abi.call({ abi: uniswapAbi.allPairsLength, target: factory, chain, block, }) + const pairCalls = [] + for (let i = 0; i < length;i++) + if (i !== 67) pairCalls.push(i) + + const calls = await sdk.api2.abi.multiCall({ block, chain, abi: uniswapAbi.allPairs, calls: pairCalls, target: factory }) + const token0s = await sdk.api2.abi.multiCall({ abi: uniswapAbi.token0, chain, block, calls }) + const token1s = await sdk.api2.abi.multiCall({ abi: uniswapAbi.token1, chain, block, calls }) + const reserves = await sdk.api2.abi.multiCall({ abi: uniswapAbi.getReserves, chain, block, calls }) + reserves.forEach(({ _reserve0, _reserve1}, i) => { + data.push({ + token0: token0s[i], + token1: token1s[i], + token1Bal: _reserve1, + token0Bal: _reserve0, + }) + }) + return transformDexBalances({ chain, data, }) +} module.exports = { misrepresentedTokens: true, optimism: { - tvl: getUniTVL({ - chain: 'optimism', - factory: '0x8BCeDD62DD46F1A76F8A1633d4f5B76e0CDa521E', - useDefaultCoreAssets: true, - skipPair: [67], - }), + tvl: opTvl, }, arbitrum: { tvl: getUniTVL({ - chain: 'arbitrum', factory: '0x9e343Bea27a12B23523ad88333a1B0f68cc1F05E', useDefaultCoreAssets: true, }), diff --git a/projects/zircon-gamma/index.js b/projects/zircon-gamma/index.js index 51bd7d05790..86eb8d368f5 100644 --- a/projects/zircon-gamma/index.js +++ b/projects/zircon-gamma/index.js @@ -1,8 +1,45 @@ const { getUniTVL } = require('../helper/unknownTokens') +const { getLogs, getAddress } = require('../helper/cache/getLogs') +const { sumTokens2 } = require('../helper/unwrapLPs') +const sdk = require('@defillama/sdk') + +const movrUniTvl = getUniTVL({ chain: 'moonriver', factory: '0x6B6071Ccc534fcee7B699aAb87929fAF8806d5bd', useDefaultCoreAssets: true, }) +const bscUniTvl = getUniTVL({ chain: 'bsc', factory: '0x18b7f6A60d5BEE3c3a953A3f213eEa25F7eF43E9', useDefaultCoreAssets: true, }) + +async function tvl(_, _b, _cb, { api, }) { + const logs = await getLogs({ + api, + target: '0x09f8E0aeA93Bcb511276A166e6e57E02e5cc1E0a', + topics: ['0xab83557b3a718996d408afe08287d09bafed3590c7ae61a430d518d3199d4590'], + fromBlock: 3587214, + }) + const tokens = logs.map(i => i.topics.slice(1).map(getAddress)) + const pools = logs.map(i => '0x' + i.data.slice(154, 194)) + + return sumTokens2({ api, ownerTokens: tokens.map((v, i) => ([v, pools[i]])) }) +} + + +async function bscTvl(_, _b, _cb, { api, }) { + const logs = await getLogs({ + api, + target: '0x05d5E46F9d17591f7eaCdfE43E3d6a8F789Df698', + topics: ["0xab83557b3a718996d408afe08287d09bafed3590c7ae61a430d518d3199d4590"], + fromBlock: 25836698, + }) + + const tokens = logs.map(i => i.topics.slice(1).map(getAddress)) + const pools = logs.map(i => '0x' + i.data.slice(154, 194)) + + return sumTokens2({ api, ownerTokens: tokens.map((v, i) => ([v, pools[i]])) }) +} module.exports = { misrepresentedTokens: true, moonriver: { - tvl: getUniTVL({ chain: 'moonriver', factory: '0x6B6071Ccc534fcee7B699aAb87929fAF8806d5bd', useDefaultCoreAssets: true, }), + tvl: sdk.util.sumChainTvls([tvl, movrUniTvl]), }, + bsc: { + tvl: sdk.util.sumChainTvls([bscTvl, bscUniTvl]), + } }; diff --git a/projects/zk-swap-dex/index.js b/projects/zk-swap-dex/index.js new file mode 100644 index 00000000000..ea67a2ab965 --- /dev/null +++ b/projects/zk-swap-dex/index.js @@ -0,0 +1,30 @@ +const { getLogs } = require('../helper/cache/getLogs') +const { sumTokens2 } = require('../helper/unwrapLPs') + +const FACTORY = '0x91C94381a0F0B7F03d911676bD59d32Bb3410060' +const CHAIN = 'era' + +async function getFactoryLogs(api) { + return getLogs({ + api, + target: FACTORY, + fromBlock: 7891758, + topic: 'PoolCreated(address,address,uint24,int24,address)', + eventAbi: 'event PoolCreated(address indexed token0,address indexed token1,uint24 indexed swapFeeUnits,int24 tickDistance,address pool)', + onlyArgs: true, + }) +} + +async function tvl(timestamp, ethBlock, chainBlocks, { api }) { + const factoryLogs = await getFactoryLogs(api) + let balanceRequests = [] + factoryLogs.forEach(({ token0, token1, pool}) => { + balanceRequests.push([token0, pool]) + balanceRequests.push([token1, pool]) + }) + return sumTokens2({ chain: CHAIN, ethBlock, tokensAndOwners: balanceRequests }) +} + +module.exports = { + era: { tvl, } +} diff --git a/projects/zk-swap/index.js b/projects/zk-swap/index.js new file mode 100644 index 00000000000..0dde03d9ab3 --- /dev/null +++ b/projects/zk-swap/index.js @@ -0,0 +1,21 @@ +const { getUniTVL } = require('../helper/unknownTokens') +const { stakingUnknownPricedLP } = require("../helper/staking"); + +const factory = "0x5da48a338647e2DD79329b557b5729D8496aD83D"; +const masterchef = "0x7bA76d4e4cBD4A9B7E3fd9a3B7Db067a51ca9682"; +const zks = "0xAbdb137D013b8B328FA43Fc04a6fA340D1CeA733"; + +module.exports = { + misrepresentedTokens: true, + era: { + tvl: getUniTVL({ factory, useDefaultCoreAssets: true, fetchBalances: true, }), + staking: stakingUnknownPricedLP( + masterchef, + zks, + "era", + "0x8489727b22Dd7eF8BbC91E0E88ee781cb2B27274", + (addr) => `era:${addr}` + ), + }, +}; + diff --git a/projects/zkBoost/abi.js b/projects/zkBoost/abi.js new file mode 100644 index 00000000000..5a0e0d59590 --- /dev/null +++ b/projects/zkBoost/abi.js @@ -0,0 +1,5 @@ +module.exports = { + getTotalLockCount: "uint256:getTotalLockCount", + getLock: "function getLock(uint256 index) view returns (tuple(uint256 id, address token, address owner, uint256 amount, uint256 lockDate, uint256 unlockDate))", + getLockAt: "function getLockAt(uint256 index) view returns (tuple(uint256 id, address token, address owner, uint256 amount, uint256 lockDate, uint256 tgeDate, uint256 tgeBps, uint256 cycle, uint256 cycleBps, uint256 unlockedAmount, string description))", +} \ No newline at end of file diff --git a/projects/zkBoost/config.js b/projects/zkBoost/config.js new file mode 100644 index 00000000000..c9bb7bc2dcd --- /dev/null +++ b/projects/zkBoost/config.js @@ -0,0 +1,7 @@ +module.exports = { + era: { + vaults: [ + '0x4d2528305C135A056D7e2A0e8BD1946273Fb89D7' + ] + } +} \ No newline at end of file diff --git a/projects/zkBoost/index.js b/projects/zkBoost/index.js new file mode 100644 index 00000000000..5076afaa9d2 --- /dev/null +++ b/projects/zkBoost/index.js @@ -0,0 +1,18 @@ +const abi = require('./abi') +const config = require('./config') +const { sumTokens2 } = require("../helper/unwrapLPs") + +module.exports = {} + +Object.keys(config).forEach(chain => { + module.exports[chain] = { + tvl: async (timestamp, _block, { [chain]: block }, { api }) => { + const { vaults, } = config[chain] + for (const vault of vaults) { + const data = await api.fetchList({ lengthAbi: abi.getTotalLockCount, itemAbi: abi.getLockAt, target: vault }) + await sumTokens2({ api, owner: vault, tokens: data.map(i => i.token), resolveLP: true, }) + } + return api.getBalances() + } + } +}) \ No newline at end of file diff --git a/projects/zkSwap-finance/index.js b/projects/zkSwap-finance/index.js new file mode 100644 index 00000000000..b115f0565d3 --- /dev/null +++ b/projects/zkSwap-finance/index.js @@ -0,0 +1,11 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports = { + era: { + tvl: getUniTVL({ + factory: '0x3a76e377ED58c8731F9DF3A36155942438744Ce3', + fetchBalances: true, + }) + }, + methodology: "TVL is total liquidity of all liquidity pools." +}; diff --git a/projects/zkasino/index.js b/projects/zkasino/index.js new file mode 100644 index 00000000000..c7c6831921c --- /dev/null +++ b/projects/zkasino/index.js @@ -0,0 +1,38 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport, nullAddress, } = require('../helper/unwrapLPs') + +// https://docs.zkasino.io/developer/contracts +const owners = [ + '0x51e99A0D09EeCa8d7EFEc3062AC024B6d0989959', + '0x0A112b111eb22D1cc0AF42fF68398A55e0B69A16', + '0x6AcB199B7C8C67832F516f70D25fcD9d6db0Ae9d', + '0x34433F8fE4D2acbF9e1E0EDb3284679FEE4ff4B5', + '0x8696a4418D4182D0F97CE11F4536905Df00792C2', + '0x178c1D16A434DC76fE45e121b6e7872de21E4263', + '0x89Ecd415f6cFDb72e276ebD2D2bADD984B06d2A8', + '0x1B1b637B64820637BB42c5803813Dc2ecC5DF5C4', +] + +const config = { + bsc: { + tokens: [ADDRESSES.bsc.BUSD, nullAddress,] + }, + polygon: { + tokens: [ADDRESSES.polygon.USDC, nullAddress,] + }, + fantom: { + tokens: [ADDRESSES.fantom.USDC, nullAddress,] + }, + arbitrum: { + tokens: [ADDRESSES.arbitrum.USDT, ADDRESSES.arbitrum.USDC, '0xADA42bb73b42e0472A994218fb3799dFCDA21237', ADDRESSES.arbitrum.ARB, nullAddress,] + } +} + +module.exports = {}; + +Object.keys(config).forEach(chain => { + const { tokens } = config[chain] + module.exports[chain] = { + tvl: sumTokensExport({ owners, tokens }) + } +}) diff --git a/projects/zkbob-cdp/index.js b/projects/zkbob-cdp/index.js new file mode 100644 index 00000000000..c8fb337571f --- /dev/null +++ b/projects/zkbob-cdp/index.js @@ -0,0 +1,11 @@ +const { sumTokensExport } = require('../helper/unwrapLPs') + +module.exports = { + polygon: { + tvl: sumTokensExport({ + blacklistedTokens: ['0xB0B195aEFA3650A6908f15CdaC7D92F8a5791B0B'], + owner: '0xFDBC53080AFb08d7a3A2420e902c8AeC05E4aE73', + resolveUniV3: true + }) + } +} \ No newline at end of file diff --git a/projects/zkbob/index.js b/projects/zkbob/index.js index bd154281939..e3983c16cab 100644 --- a/projects/zkbob/index.js +++ b/projects/zkbob/index.js @@ -1,13 +1,23 @@ const { sumTokensExport } = require('../helper/unwrapLPs') +const ADDRESSES = require('../helper/coreAssets.json') module.exports = { polygon: { tvl: sumTokensExport({ - chain: 'polygon', tokens: [ '0xB0B195aEFA3650A6908f15CdaC7D92F8a5791B0B', // BOB + ADDRESSES.polygon.USDC, ], owner: '0x72e6b59d4a90ab232e55d4bb7ed2dd17494d62fb' - }) - } + }), + }, + optimism: { + tvl: sumTokensExport({ + tokens: [ + '0xb0b195aefa3650a6908f15cdac7d92f8a5791b0b', // BOB + ADDRESSES.optimism.WETH_1, + ], + owners: ['0x1ca8c2b9b20e18e86d5b9a72370fc6c91814c97c', '0x58320A55bbc5F89E5D0c92108F762Ac0172C5992'] + }), + }, } \ No newline at end of file diff --git a/projects/zkdefi/index.js b/projects/zkdefi/index.js new file mode 100644 index 00000000000..e560c45f138 --- /dev/null +++ b/projects/zkdefi/index.js @@ -0,0 +1,12 @@ +const { getUniTVL } = require("../helper/unknownTokens"); + +module.exports = { + misrepresentedTokens: true, + polygon_zkevm: { + tvl: getUniTVL({ + fetchBalances: true, + useDefaultCoreAssets: true, + factory: "0xfDC8ec444F482Fe8aFe0a00114548DC9ff729568", + }), + }, +}; diff --git a/projects/zkdx/index.js b/projects/zkdx/index.js new file mode 100644 index 00000000000..1bb227c9cce --- /dev/null +++ b/projects/zkdx/index.js @@ -0,0 +1,15 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const {staking} = require("../helper/staking"); + +module.exports = { + methodology: 'zkDX counts the staking values as tvl', + start: 3744214, + era: { + tvl: staking( + ["0x79033C597B7d8e752a7511cF24512f4A7217C0B8", "0xd6cce119B45Efcb378a4735a96aE08826A37ca1c", + "0xDC9e925D2BB683d47203eCEddBD1d733EC035CaE","0xA9C595C8F718898f7eb96964Bc92517365c901C9"], + [ADDRESSES.era.WETH, ADDRESSES.era.USDC] + ) + + } +}; diff --git a/projects/zkevmswap/index.js b/projects/zkevmswap/index.js new file mode 100644 index 00000000000..95b0648319a --- /dev/null +++ b/projects/zkevmswap/index.js @@ -0,0 +1,11 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports = { + misrepresentedTokens: true, + polygon_zkevm: { + tvl: getUniTVL({ + factory: '0x213c25900f365F1BE338Df478CD82beF7Fd43F85', + useDefaultCoreAssets: true, + }) + }, +} \ No newline at end of file diff --git a/projects/zkfox/index.js b/projects/zkfox/index.js new file mode 100644 index 00000000000..2668449fd5b --- /dev/null +++ b/projects/zkfox/index.js @@ -0,0 +1,5 @@ +const { compoundExports } = require('../helper/compound') + +module.exports = { + era: compoundExports("0xc3D157Ee5D602E9CEAF6eA4c15C9b52B313A1364"), +} diff --git a/projects/zklend/abi.js b/projects/zklend/abi.js new file mode 100644 index 00000000000..9a3879ef628 --- /dev/null +++ b/projects/zklend/abi.js @@ -0,0 +1,25 @@ +const market = [ + { + "name": "get_total_debt_for_token", + "type": "function", + "inputs": [ + { + "name": "token", + "type": "felt" + } + ], + "outputs": [ + { + "name": "debt", + "type": "felt" + } + ], + "stateMutability": "view" + }, +] +const marketAbi = {} +market.forEach(i => marketAbi[i.name] = i) + +module.exports = { + marketAbi +} \ No newline at end of file diff --git a/projects/zklend/index.js b/projects/zklend/index.js new file mode 100644 index 00000000000..2f62c986dcf --- /dev/null +++ b/projects/zklend/index.js @@ -0,0 +1,38 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { BigNumber } = require("bignumber.js"); +const { multiCall, sumTokens } = require('../helper/chain/starknet') +const { marketAbi } = require('./abi'); + +const valueToBigNumber = (amount) => { + if (amount instanceof BigNumber) { + return amount; + } + return new BigNumber(amount); +} +const market = '0x4c0a5193d58f74fbace4b74dcf65481e734ed1714121bdc571da345540efa05' + +const assets = [ + ADDRESSES.starknet.WBTC, + ADDRESSES.starknet.ETH, + ADDRESSES.starknet.USDC, + ADDRESSES.starknet.DAI, + ADDRESSES.starknet.USDT +] + +async function tvl(_, _1, _2, { api }) { + return sumTokens({ api, owner: market, tokens: assets }) +} + +async function borrowed(_, _1, _2, { api }) { + let data = await multiCall({ calls: assets, target: market, abi: marketAbi.get_total_debt_for_token }); + data = data.map(i => valueToBigNumber(i).toNumber()) + api.addTokens(assets, data) +} + +module.exports = { + methodology: 'Value of user supplied asset on zkLend is considered as TVL', + starknet: { + tvl, + borrowed + }, +} diff --git a/projects/zkmoonswap/index.js b/projects/zkmoonswap/index.js new file mode 100644 index 00000000000..ae6dfcc8b01 --- /dev/null +++ b/projects/zkmoonswap/index.js @@ -0,0 +1,11 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports = { + misrepresentedTokens: true, + polygon_zkevm: { + tvl: getUniTVL({ + factory: '0x49841094F19659e044671825d7ecb3B79368e6E5', + useDefaultCoreAssets: true, + }) + }, +} diff --git a/projects/zks-miner/index.js b/projects/zks-miner/index.js new file mode 100644 index 00000000000..9591eaf13e1 --- /dev/null +++ b/projects/zks-miner/index.js @@ -0,0 +1,16 @@ +const { nullAddress } = require('../helper/tokenMapping'); +const { sumTokensExport } = require('../helper/unwrapLPs') + +const SILVER_MINER = "0x0B78a504D62391A1cBe92db6de4E4A1d5AE87732"; +const DIAMOND_MINER = "0x755747467d97619a670e228eBEc8eFE285c37F01"; +const GOLD_MINER = "0x340e443C85ecd7eB1E918744D4A35A1e6101bbd4"; + +module.exports = { + hallmarks: [ + [1682726400, "Rug Pull"] + ], + methodology: 'TLV silver, diamond and gold is total amount miner deposit to contract silver, diamond and gold', + era: { + tvl: sumTokensExport({ owners: [SILVER_MINER, DIAMOND_MINER, GOLD_MINER,], tokens: [nullAddress] }) + }, +} diff --git a/projects/zkswap-2/index.js b/projects/zkswap-2/index.js new file mode 100644 index 00000000000..98b210d6cba --- /dev/null +++ b/projects/zkswap-2/index.js @@ -0,0 +1,9 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +const factory = "0xeeE1Af1CE68D280e9cAfD861B7d4af776798F18d"; +const zks = ""; + +module.exports = { + misrepresentedTokens: true, + era: { tvl: getUniTVL({ factory, useDefaultCoreAssets: true, fetchBalances: true }) }, +}; \ No newline at end of file diff --git a/projects/zkswap/index.js b/projects/zkswap/index.js index fe86d4ebac2..e76444b1cd8 100644 --- a/projects/zkswap/index.js +++ b/projects/zkswap/index.js @@ -3,8 +3,8 @@ const BigNumber = require('bignumber.js') const v1TVL = require('./v1'); const v2TVL = require('./v2'); -async function tvl(timestamp, block) { - const [v1, v2] = await Promise.all([v1TVL(timestamp, block), v2TVL(timestamp, block)]); +async function tvl(timestamp, block, _1, { api }) { + const [v1, v2] = await Promise.all([v1TVL(timestamp, block, _1, { api }), v2TVL(timestamp, block, _1, { api })]); const tokenAddresses = new Set(Object.keys(v1).concat(Object.keys(v2))); diff --git a/projects/zkswap/v1.js b/projects/zkswap/v1.js index d0bdc13b1ad..1157345192d 100644 --- a/projects/zkswap/v1.js +++ b/projects/zkswap/v1.js @@ -1,28 +1,28 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk'); +const { getLogs } = require('../helper/cache/getLogs') const MAIN = '0x8ECa806Aecc86CE90Da803b080Ca4E3A9b8097ad'; const GOVERNANCE = '0x02ecef526f806f06357659fFD14834fe82Ef4B04'; const START_BLOCK = 11841962; -module.exports = async function tvl(timestamp, block) { +module.exports = async function tvl(timestamp, block, _1, { api }) { // ETH const ETHBalance = (await sdk.api.eth.getBalance({target: MAIN, block})).output; const balances = { - '0x0000000000000000000000000000000000000000': ETHBalance + [ADDRESSES.null]: ETHBalance } // ERC20 const topic = 'NewToken(address,uint16)'; const logs = ( - await sdk.api.util - .getLogs({ - keys: [], - toBlock: block, + await getLogs({ + api, target: GOVERNANCE, fromBlock: START_BLOCK, topic, }) - ).output; + ); const tokenAddresses = logs.map(log => `0x${log.topics[1].slice(64 - 40 + 2, 64 + 2)}`.toLowerCase()); diff --git a/projects/zkswap/v2.js b/projects/zkswap/v2.js index 4d70e79b750..6f26e8d5b99 100644 --- a/projects/zkswap/v2.js +++ b/projects/zkswap/v2.js @@ -1,28 +1,28 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk'); +const { getLogs } = require('../helper/cache/getLogs') const MAIN = '0x6dE5bDC580f55Bc9dAcaFCB67b91674040A247e3'; const GOVERNANCE = '0x86E527BC3C43E6Ba3eFf3A8CAd54A7Ed09cD8E8B'; const START_BLOCK = 12810001 ; -module.exports = async function tvl(timestamp, block) { +module.exports = async function tvl(timestamp, block, _1, { api }) { // ETH const ETHBalance = (await sdk.api.eth.getBalance({target: MAIN, block})).output; const balances = { - '0x0000000000000000000000000000000000000000': ETHBalance + [ADDRESSES.null]: ETHBalance } // ERC20 const topic = 'NewToken(address,uint16)'; const logs = ( - await sdk.api.util - .getLogs({ - keys: [], - toBlock: block, + await getLogs({ + api, target: GOVERNANCE, fromBlock: START_BLOCK, topic, }) - ).output; + ); const tokenAddresses = logs.map(log => `0x${log.topics[1].slice(64 - 40 + 2, 64 + 2)}`.toLowerCase()); diff --git a/projects/zlot/abi.json b/projects/zlot/abi.json index f4fa0bc5372..ef92259041e 100644 --- a/projects/zlot/abi.json +++ b/projects/zlot/abi.json @@ -1,15 +1,3 @@ { - "totalUnderlying": { - "inputs": [], - "name": "totalUnderlying", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } + "totalUnderlying": "uint256:totalUnderlying" } \ No newline at end of file diff --git a/projects/zodiac/index.js b/projects/zodiac/index.js index 7d212946661..65949d4dc7b 100644 --- a/projects/zodiac/index.js +++ b/projects/zodiac/index.js @@ -1,11 +1,15 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { ohmTvl } = require("../helper/ohm"); const treasuryAddress = "0xf73055C88f8cF87E0cfaE6773665943083609640"; -const USDT = "0x55d398326f99059ff775485246999027b3197955"; +const USDT = ADDRESSES.bsc.USDT; const Staking = "0x1450d20E99F7e8c27864a8D9e6E3d0694ed567DA"; const ZD = "0x98051143830fa99848E7059E97AcB03B3cc62403"; const ZD_USDT_POOL = "0x4cb107576c7f3d59e3355ce760af5cbc36cf5e0d"; +module.exports.hallmarks=[ + [1641254400,"Rug Pull"] +], module.exports = ohmTvl(treasuryAddress, [ [USDT, false], [ZD_USDT_POOL, true], diff --git a/projects/zomb2/index.js b/projects/zomb2/index.js index 594f0a938b9..54cd40a12a1 100644 --- a/projects/zomb2/index.js +++ b/projects/zomb2/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { zombiTvl } = require("../zombi/zombi"); const token = "0xA87bcE04d4a396DF40cC1be3a21CF04592C08290"; @@ -14,7 +15,7 @@ const pool2LPs = [ ]; const listedTokenGeneris = [ - '0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83',//wftm + ADDRESSES.fantom.WFTM,//wftm '0x74b23882a30290451A17c44f4F05243b6b58C76d',//weth '0x841FAD6EAe12c286d1Fd18d1d525DFfA75C7EFFE',//boo '0xaD996A45fd2373ed0B10Efa4A8eCB9de445A4302',//alpaca diff --git a/projects/zombi/index.js b/projects/zombi/index.js index e0acab24b2b..c8f7f81b8f3 100644 --- a/projects/zombi/index.js +++ b/projects/zombi/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { zombiTvl } = require("./zombi"); const token = "0xda5db6c2a2fd53a2d3fc4246bbd8acce5f93bae1"; @@ -11,12 +12,15 @@ const pool2LPs = [ "0x5db45a30732cf98fda72b9b91a0c554dc1f2e83b" ]; const listedTokenGeneris = [ - '0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83',//wftm + ADDRESSES.fantom.WFTM,//wftm '0x74b23882a30290451A17c44f4F05243b6b58C76d',//weth '0x841FAD6EAe12c286d1Fd18d1d525DFfA75C7EFFE',//boo '0xaD996A45fd2373ed0B10Efa4A8eCB9de445A4302'//alpaca ] module.exports = { + hallmarks: [ + [1646870400, "Rug Pull"] + ], ...zombiTvl(token, share, rewardPool, rewardPoolGeneris, masonry, pool2LPs, listedTokenGeneris, "fantom", undefined, false, "0xe577DF94b4Ea94399B7438e27EA1Ba81717464A0") } diff --git a/projects/zombi/zombi.js b/projects/zombi/zombi.js index a7fb79c69b4..eca87e7e4fb 100644 --- a/projects/zombi/zombi.js +++ b/projects/zombi/zombi.js @@ -1,7 +1,7 @@ const { stakingUnknownPricedLP } = require("../helper/staking"); const sdk = require("@defillama/sdk"); -const token0Abi = require("../helper/abis/token0.json"); -const token1Abi = require("../helper/abis/token1.json"); +const token0Abi = 'address:token0' +const token1Abi = 'address:token1' const { default: BigNumber } = require("bignumber.js"); function zombiTvl(token, share, rewardPool, rewardPool2, masonry, pool2LPs, listedTokenGeneris, chain = "ethereum", transform = undefined, tokensOnCoingecko = true, lpWithShare = undefined) { diff --git a/projects/zombie-network/index.js b/projects/zombie-network/index.js index 16e1693b764..1a34a8c9edb 100644 --- a/projects/zombie-network/index.js +++ b/projects/zombie-network/index.js @@ -36,7 +36,7 @@ async function getTvl(timestamp, ethBlock, chainBlocks) { sdk.util.sumSingleBalance(balances.staking, 'klay-token', staking ) return balances -}; +} module.exports = { klaytn: diff --git a/projects/zomma/index.js b/projects/zomma/index.js new file mode 100644 index 00000000000..ee54fb7411d --- /dev/null +++ b/projects/zomma/index.js @@ -0,0 +1,16 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require("../helper/sumTokens"); + +const ZOMMA_CONTRACT_old = "0x709051774c60c0527dbaf880f41425eae036efaf"; +const ZOMMA_CONTRACT = "0x7bf1f1c2d8caa200b068747487cb9bf109e529f1"; +const USDC_CONTRACT = ADDRESSES.era.USDC; + +module.exports = { + methodology: "TVL is calculated as the sum of USDC deposited by traders and the liquidity in the Pools.", + era: { + tvl: sumTokensExport({ + owners: [ZOMMA_CONTRACT,ZOMMA_CONTRACT_old], + tokens: [USDC_CONTRACT], + }), + }, +}; \ No newline at end of file diff --git a/projects/zoodao/abis/battle-arena-abi.json b/projects/zoodao/abis/battle-arena-abi.json new file mode 100644 index 00000000000..fd649c183b0 --- /dev/null +++ b/projects/zoodao/abis/battle-arena-abi.json @@ -0,0 +1,3 @@ +{ + "sharesToTokens": "function sharesToTokens(uint256 sharesAmount) public returns (uint256 tokens)" +} diff --git a/projects/zoodao/index.js b/projects/zoodao/index.js new file mode 100644 index 00000000000..5da95abe179 --- /dev/null +++ b/projects/zoodao/index.js @@ -0,0 +1,32 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const battleArenaAbi = require('./abis/battle-arena-abi.json'); +const { stakings } = require('../helper/staking'); + +const VAULT_CONTRACT = '0x1C55649f73CDA2f72CEf3DD6C5CA3d49EFcF484C'; +const BATTLE_ARENA_CONTRACT = '0x0ADeb5A930875606F325e114FD5147148e042828'; +const FRAX_TOKEN = ADDRESSES.moonbeam.FRAX +const ZOODAO_TOKEN = "0x7cd3e6e1A69409deF0D78D17a492e8e143F40eC5" +const VE_ZOO_CONTRACT = "0x1bd77c71568f723d6906ea80fee45f1f52834c15" +const X_ZOO_CONTRACT = "0x1c535c24f911a8741018cf09f3030ab6e1b910cf" + +const stakingContracts = [ + BATTLE_ARENA_CONTRACT, + VE_ZOO_CONTRACT, + X_ZOO_CONTRACT +]; + +async function tvl(_, _1, _2, { api }) { + const vaultStablecoinStaked = await api.call({ abi: 'erc20:balanceOf', target: VAULT_CONTRACT, params: [BATTLE_ARENA_CONTRACT] }); + + // convert m.FRAX to FRAX + const totalFRAX = await api.call({ abi: battleArenaAbi.sharesToTokens, target: BATTLE_ARENA_CONTRACT, params: [vaultStablecoinStaked] }); + api.add(FRAX_TOKEN, totalFRAX) +} + +module.exports = { + methodology: "Counts the supplied value of FRAX and ZOO through ZooDAO's contracts", + moonbeam: { + tvl, + staking: stakings(stakingContracts, ZOODAO_TOKEN) + }, +}; diff --git a/projects/zoodex/index.js b/projects/zoodex/index.js index 4eb9267bd00..581fcbe7278 100644 --- a/projects/zoodex/index.js +++ b/projects/zoodex/index.js @@ -1,16 +1,9 @@ -const {calculateUniTvl} = require('../helper/calculateUniTvl.js') -const {transformFantomAddress} = require('../helper/portedTokens.js') +const {uniTvlExport} = require('../helper/calculateUniTvl.js') const factory = '0x6178C3B21F7cA1adD84c16AD35452c85a85F5df4' -async function tvl(_timestamp, _ethBlock, chainBlocks){ - const transform = await transformFantomAddress(); - - const balances = await calculateUniTvl(transform, chainBlocks['fantom'], 'fantom', factory, 7280058, true); - return balances -} module.exports = { fantom:{ - tvl, + tvl: uniTvlExport(factory, 'fantom', true), }, } diff --git a/projects/zoomswap/index.js b/projects/zoomswap/index.js index 051fbfcbe80..28f2a440b51 100644 --- a/projects/zoomswap/index.js +++ b/projects/zoomswap/index.js @@ -1,7 +1,8 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { masterChefExports, } = require("../helper/masterchef") const { mergeExports, } = require("../helper/utils") -const token1 = "0x86702a7f8898B172de396eB304d7D81207127915"; +const token1 = ADDRESSES.iotex.ZOOM; const token2 = "0xf87aed04889a1dd0159d9C22B0D57b345Ab16dDD"; const masterchef1 = "0x92F1a54835436Ad1858018f11d017fCE31756C17"; const masterchef2 = "0x1ba725d2ba56482f11fee3642f1c739d25018e4d"; diff --git a/projects/zootopia-finance/index.js b/projects/zootopia-finance/index.js index c07d0c3ad27..19ae5d28849 100644 --- a/projects/zootopia-finance/index.js +++ b/projects/zootopia-finance/index.js @@ -1,19 +1,23 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens2 } = require('../helper/unwrapLPs') // ztp swap address const SWAP_ADDR = "0xCdD4396527b6681775173839002E6af201885CB8"; // stable coin address -const BUSD = "0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56"; +const BUSD = ADDRESSES.bsc.BUSD; const DAI = "0x1AF3F329e8BE154074D8769D1FFa4eE058B1DBc3"; -const USDC = "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d"; -const USDT = "0x55d398326f99059fF775485246999027B3197955"; +const USDC = ADDRESSES.bsc.USDC; +const USDT = ADDRESSES.bsc.USDT; async function tvl(timestamp, ethereumBlock, { bsc: block }) { return sumTokens2({ chain: 'bsc', block, owner: SWAP_ADDR, tokens: [BUSD, DAI, USDC, USDT,]}) } module.exports = { + hallmarks: [ + [1667174400, "Rug Pull"] + ], bsc: { tvl, }, diff --git a/projects/zswap-plus/index.js b/projects/zswap-plus/index.js new file mode 100644 index 00000000000..0e827ed1803 --- /dev/null +++ b/projects/zswap-plus/index.js @@ -0,0 +1,7 @@ +const { getUniTVL } = require("../helper/unknownTokens") + +module.exports = { + avax: { + tvl: getUniTVL({ factory: '0xcDE3F9e6D452be6d955B1C7AaAEE3cA397EAc469', useDefaultCoreAssets: true}) + } +} \ No newline at end of file diff --git a/projects/zunami/abi.json b/projects/zunami/abi.json index 7257a2e083d..fcec271d50a 100644 --- a/projects/zunami/abi.json +++ b/projects/zunami/abi.json @@ -1,15 +1,3 @@ { - "totalHoldings": { - "inputs": [], - "name": "totalHoldings", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -} + "totalHoldings": "uint256:totalHoldings" +} \ No newline at end of file diff --git a/projects/zunami/index.js b/projects/zunami/index.js index 87864284088..01315f8b56b 100644 --- a/projects/zunami/index.js +++ b/projects/zunami/index.js @@ -1,23 +1,32 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); const zunamiContract = "0x2ffCC661011beC72e1A9524E12060983E74D14ce"; +const zunamiApsContract = "0xCaB49182aAdCd843b037bBF885AD56A3162698Bd"; const zunamiHoldingsDecimals = 18; -const usdt = "0xdAC17F958D2ee523a2206206994597C13D831ec7"; +const usdt = ADDRESSES.ethereum.USDT; const usdtDecimals = 6; async function ethTvl(timestamp, block) { - const totalHoldings = (await sdk.api.abi.call({ + const totalHoldingsOmnipool = (await sdk.api.abi.call({ block, abi: abi.totalHoldings, target: zunamiContract, })).output / 10 ** (zunamiHoldingsDecimals - usdtDecimals); + const totalHoldingsAps = (await sdk.api.abi.call({ + block, + abi: abi.totalHoldings, + target: zunamiApsContract, + })).output / 10 ** (zunamiHoldingsDecimals - usdtDecimals); + + const totalHoldings = totalHoldingsOmnipool + totalHoldingsAps; return { [usdt]: totalHoldings, }; -}; +} module.exports = { misrepresentedTokens: true, diff --git a/projects/zyberswap-stableswap/index.js b/projects/zyberswap-stableswap/index.js new file mode 100644 index 00000000000..a2bbc8b15e4 --- /dev/null +++ b/projects/zyberswap-stableswap/index.js @@ -0,0 +1,20 @@ +const { getLogs } = require('../helper/cache/getLogs') +const { sumTokens2 } = require('../helper/unwrapLPs') + +async function tvl(_, _b, _cb, { api, }) { + const logs = await getLogs({ + api, + target: '0xc25e230afb1b67162350cd405add199a002c6abd', + topics: ['0x0838512b7934222cec571cf3fde1cf3e9e864bbc431bd5d1ef4d9ed3079093d9'], + fromBlock: 59965885, + eventAbi: 'event NewSwapPool (address indexed deployer, address swapAddress, address[] pooledTokens)', + onlyArgs: true, + }) + return sumTokens2({ api, ownerTokens: logs.map(i => ([i.pooledTokens, i.swapAddress]))}) +} + +module.exports = { + arbitrum: { + tvl + } +}; diff --git a/projects/zyberswap-v3/index.js b/projects/zyberswap-v3/index.js new file mode 100644 index 00000000000..1cace364a18 --- /dev/null +++ b/projects/zyberswap-v3/index.js @@ -0,0 +1,14 @@ +const { uniV3Export } = require('../helper/uniswapV3') + +module.exports = uniV3Export({ + arbitrum: { + factory: '0x9c2abd632771b433e5e7507bcaa41ca3b25d8544', + fromBlock: 62714800, + isAlgebra: true, + }, + optimism: { + factory: '0x0c8f7b0cb986b31c67d994fb5c224592a03a4afd', + fromBlock: 105900073, + isAlgebra: true, + } +}) diff --git a/projects/zyberswap/index.js b/projects/zyberswap/index.js new file mode 100644 index 00000000000..a7761c1c82e --- /dev/null +++ b/projects/zyberswap/index.js @@ -0,0 +1,20 @@ +const { getUniTVL, sumTokensExport } = require('../helper/unknownTokens') +const ZYBER = "0x3B475F6f2f41853706afc9Fa6a6b8C5dF1a2724c"; + + +const dexTVL = getUniTVL({ factory: '0xaC2ee06A14c52570Ef3B9812Ed240BCe359772e7', useDefaultCoreAssets: true }) + + +module.exports = { + misrepresentedTokens: true, + methodology: `Uses factory(0xaC2ee06A14c52570Ef3B9812Ed240BCe359772e7) address and whitelisted tokens address to find and price Liquidity Pool pairs. We also have our native token $ZYB staking, StableSwap, Earn and Vaults.`, + arbitrum: { + tvl: dexTVL, + staking: sumTokensExport({ + owners: ['0xEFf77E179f6abb49a5bf0EC25c920B495e110C3b', '0x9BA666165867E916Ee7Ed3a3aE6C19415C2fBDDD', '0x9CB8Ed8102B6c65D8CAE931394352d7a676ce12a'], + tokens: [ZYBER], + }) + } +}; + + From 376cb816d123d7b135b8f929a65ca1db7c09d832 Mon Sep 17 00:00:00 2001 From: power-f-god Date: Thu, 3 Aug 2023 11:48:52 +0100 Subject: [PATCH 0648/1974] chore: Sync repo - final. --- .eslintrc.js | 19 +++++++++++++++++++ .github/workflows/getFileList.js | 5 +++-- .github/workflows/test.yml | 13 ++++++++++--- 3 files changed, 32 insertions(+), 5 deletions(-) create mode 100644 .eslintrc.js diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 00000000000..a58107f1509 --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,19 @@ +module.exports = { + "env": { + "node": true, + "commonjs": true, + "es2021": true + }, + "extends": "eslint:recommended", + "overrides": [ + ], + "parserOptions": { + "ecmaVersion": "latest" + }, + ignorePatterns: ['projects/test/*'], + "rules": { + "no-case-declarations": "off", + "no-unused-vars": "off", + "no-prototype-builtins": "off", + } +} diff --git a/.github/workflows/getFileList.js b/.github/workflows/getFileList.js index a41d90b1d0d..8a3070869bc 100644 --- a/.github/workflows/getFileList.js +++ b/.github/workflows/getFileList.js @@ -4,11 +4,12 @@ const fileSet = new Set(); [...MODIFIED, ...ADDED].forEach(file => { const [root, dir] = file.split('/') - if (root === 'projects' && dir !=='helper' && dir !== 'config') fileSet.add(root + '/' + dir) + if (dir === 'treasury' || dir === 'entities') fileSet.add(file) + else if (root === 'projects' && dir !=='helper' && dir !== 'config') fileSet.add(root + '/' + dir) }) console.log(JSON.stringify([...fileSet])) function parse(data) { return data.replace('[', '').replace(']', '').split(',') -} \ No newline at end of file +} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f3a9ccf8459..328af5536a4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -13,6 +13,9 @@ jobs: - name: Check out repository code uses: actions/checkout@v2 - name: Run changes files through test script + env: + LLAMA_DEBUG_MODE: "true" + BSC_RPC: https://rpc.ankr.com/bsc,https://bsc-dataseed4.binance.org run: | RUN_FILES=$( MODIFIED=${{ steps.file_changes.outputs.files_modified}} \ @@ -25,8 +28,9 @@ jobs: exit 0 fi - npm remove typescript @types/async-retry @types/bn.js ts-node @solendprotocol/solend-sdk - npm ci --omit=dev + npm remove typescript @types/async-retry @types/bn.js ts-node @solendprotocol/solend-sdk @hover-labs/kolibri-js + # npm ci --omit=dev + npm ci # npm update @defillama/sdk for i in $(echo $RUN_FILES | tr -d '"[]' | tr "," "\n") @@ -41,4 +45,7 @@ jobs: echo -n $i echo ' doesnt run' } - done \ No newline at end of file + done + + - name: Run ESLint + uses: eslint/github-action@v0 From 31f70165bbf1bd83a8f9b5854020cef6ba75b043 Mon Sep 17 00:00:00 2001 From: power-f-god Date: Thu, 3 Aug 2023 11:57:34 +0100 Subject: [PATCH 0649/1974] chore: Re-update endpoint URL. --- projects/clearpool/index.js | 98 +++++++++++++++++++------------------ 1 file changed, 50 insertions(+), 48 deletions(-) diff --git a/projects/clearpool/index.js b/projects/clearpool/index.js index 90df70d23ad..52364f2b5c2 100644 --- a/projects/clearpool/index.js +++ b/projects/clearpool/index.js @@ -4,25 +4,23 @@ const sdk = require("@defillama/sdk"); const { sumTokens } = require("../helper/unwrapLPs"); const abi = require("./abi.json"); -const { getConfig } = require('../helper/cache') +const { getConfig } = require("../helper/cache"); -const { stakings } = require('../helper/staking') -const { getLogs } = require('../helper/cache/getLogs') +const { stakings } = require("../helper/staking"); +const { getLogs } = require("../helper/cache/getLogs"); const PoolFactory = "0xde204e5a060ba5d3b63c7a4099712959114c2d48"; const START_BLOCK = 14443222; -const polygonPoolURL = 'https://app.clearpool.finance/api/pools' +const polygonPoolURL = "https://clearpool.finance/api/pools"; const ethereumTVL = async (timestamp, block, chainBlocks, { api }) => { const balances = {}; - const Logs = ( - await getLogs({ - api, - target: PoolFactory, - topic: "PoolCreated(address,address,address)", - fromBlock: START_BLOCK, - }) - ); + const Logs = await getLogs({ + api, + target: PoolFactory, + topic: "PoolCreated(address,address,address)", + fromBlock: START_BLOCK, + }); const tokensAndOwners = []; for (let i = 0; i < Logs.length; i++) { const pool = "0x" + Logs[i].topics[1].substring(26, 66); @@ -35,40 +33,40 @@ const ethereumTVL = async (timestamp, block, chainBlocks, { api }) => { const ethereumBorrowed = async (timestamp, block, _, { api }) => { const totalBorrowed = {}; - const Logs = ( - await getLogs({ - api, - target: PoolFactory, - topic: "PoolCreated(address,address,address)", - fromBlock: START_BLOCK, - }) - ); + const Logs = await getLogs({ + api, + target: PoolFactory, + topic: "PoolCreated(address,address,address)", + fromBlock: START_BLOCK, + }); - const pools = [] - const tokens = [] + const pools = []; + const tokens = []; for (let i = 0; i < Logs.length; i++) { const pool = "0x" + Logs[i].topics[1].substring(26, 66); const token = "0x" + Logs[i].topics[3].substring(26, 66); - pools.push(pool) - tokens.push(token) + pools.push(pool); + tokens.push(token); } const { output: borrowed } = await sdk.api.abi.multiCall({ abi: abi.borrows, - calls: pools.map(i => ({ target: i })), + calls: pools.map((i) => ({ target: i })), block, - }) + }); - borrowed.forEach((data, i) => sdk.util.sumSingleBalance(totalBorrowed, tokens[i], data.output)) + borrowed.forEach((data, i) => + sdk.util.sumSingleBalance(totalBorrowed, tokens[i], data.output) + ); return totalBorrowed; }; -const polygonTvl = async (timestamp, _, { polygon: block }) => { +const polygonTvl = async (timestamp, _, { polygon: block }) => { const balances = {}; - const chain = 'polygon' - const poolAllData = await getConfig('clearpool-polygon',polygonPoolURL) - const poolData = poolAllData["137"] + const chain = "polygon"; + const poolAllData = await getConfig("clearpool-polygon", polygonPoolURL); + const poolData = poolAllData["137"]; const tokensAndOwners = []; for (let i = 0; i < poolData.length; i++) { @@ -80,36 +78,40 @@ const polygonTvl = async (timestamp, _, { polygon: block }) => { return balances; }; -const polygonBorrowed = async (timestamp, _, { polygon: block }) => { - const chain = 'polygon' - const poolAllData = await getConfig('clearpool-polygon',polygonPoolURL) - const poolData = poolAllData["137"] +const polygonBorrowed = async (timestamp, _, { polygon: block }) => { + const chain = "polygon"; + const poolAllData = await getConfig("clearpool-polygon", polygonPoolURL); + const poolData = poolAllData["137"]; const totalBorrowed = {}; - const pools = [] - const tokens = [] + const pools = []; + const tokens = []; for (let i = 0; i < poolData.length; i++) { const pool = poolData[i].address; const token = poolData[i].currencyAddress; - pools.push(pool) - tokens.push(token) + pools.push(pool); + tokens.push(token); } const { output: borrowed } = await sdk.api.abi.multiCall({ abi: abi.borrows, - calls: pools.map(i => ({ target: i })), - chain, block, - }) - - borrowed.forEach((data, i) => sdk.util.sumSingleBalance(totalBorrowed, chain + ':' + tokens[i], data.output)) + calls: pools.map((i) => ({ target: i })), + chain, + block, + }); + + borrowed.forEach((data, i) => + sdk.util.sumSingleBalance( + totalBorrowed, + chain + ":" + tokens[i], + data.output + ) + ); return totalBorrowed; }; - -const singleStakingContracts = [ - "0x629E39da1Db5654fe59cAE31d48CAEBB8dC2A9c6", -]; +const singleStakingContracts = ["0x629E39da1Db5654fe59cAE31d48CAEBB8dC2A9c6"]; const CPOOL = "0x66761fa41377003622aee3c7675fc7b5c1c2fac5"; From 6df664d789c3dd067b5eeed54f73888c61187982 Mon Sep 17 00:00:00 2001 From: "andreapn.eth" Date: Thu, 3 Aug 2023 19:10:44 +0700 Subject: [PATCH 0650/1974] DackieSwap CLMM integrate with Defillama - update --- projects/dackieswap/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/dackieswap/index.js b/projects/dackieswap/index.js index bcfaa2ff21a..c45139ef1ff 100644 --- a/projects/dackieswap/index.js +++ b/projects/dackieswap/index.js @@ -3,6 +3,6 @@ const { uniV3Export } = require('../helper/uniswapV3') module.exports = uniV3Export({ base: { factory: '0x3D237AC6D2f425D2E890Cc99198818cc1FA48870', - fromBlock: 2124844, + fromBlock: 1759510, } }) \ No newline at end of file From 2c14f53fe68acf676e1faffdb43f366489b3eb40 Mon Sep 17 00:00:00 2001 From: define Date: Thu, 3 Aug 2023 15:03:09 +0100 Subject: [PATCH 0651/1974] adapter spartadex --- projects/spartadex/index.js | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 projects/spartadex/index.js diff --git a/projects/spartadex/index.js b/projects/spartadex/index.js new file mode 100644 index 00000000000..a62e0523b0d --- /dev/null +++ b/projects/spartadex/index.js @@ -0,0 +1,6 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports = { + misrepresentedTokens: true, + arbitrum: { tvl: getUniTVL({ factory: '0xFe8EC10Fe07A6a6f4A2584f8cD9FE232930eAF55', useDefaultCoreAssets: true, fetchBalances: true, }), }, +} \ No newline at end of file From 3377be54058b92277a4a3fe31312c350507042b7 Mon Sep 17 00:00:00 2001 From: define Date: Thu, 3 Aug 2023 15:10:38 +0100 Subject: [PATCH 0652/1974] fix sturdy problem --- projects/sturdy/index.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/projects/sturdy/index.js b/projects/sturdy/index.js index 55d9f32cb5b..73cb695f252 100644 --- a/projects/sturdy/index.js +++ b/projects/sturdy/index.js @@ -8,13 +8,12 @@ module.exports = mergeExports([ }, { misrepresentedTokens: true, - hallmarks: [ - [Math.floor(new Date('2023-06-11')/1e3), 'Protocol was hacked'], - ], ethereum: aaveV2Export('0xA422CA380bd70EeF876292839222159E41AAEe17', { useOracle: true }), fantom: aaveV2Export('0x7ff2520cd7b76e8c49b5db51505b842d665f3e9a', { useOracle: true, baseCurrency: ADDRESSES.fantom.DAI }), methodology: "Counts the tokens locked in the contracts to be used as collateral to borrow or to earn yield. Borrowed coins are not counted towards the TVL, so only the coins actually locked in the contracts are counted. There's multiple reasons behind this but one of the main ones is to avoid inflating the TVL through cycled lending.. TVL is calculated by getting the market addresses from comptroller and calling the getCash() on-chain method to get the amount of tokens locked in each of these addresses, then we get the price of each token from coingecko. To view the Borrowed amounts along with the currently liquidity, click the 'Borrowed' check box", } ]) - +module.exports.hallmarks = [ + [Math.floor(new Date('2023-06-11')/1e3), 'Protocol was hacked'], +] module.exports.doublecounted = true From f57df7a04022618c61cd33b7cf19c00ef35e5c6a Mon Sep 17 00:00:00 2001 From: power-f-god Date: Thu, 3 Aug 2023 15:21:42 +0100 Subject: [PATCH 0653/1974] feat(projects/clearpool): Implement `zkEVM` `tvl` and `borrowed`. --- projects/clearpool/index.js | 64 +++++++++++++++++++++++++++++++++++-- 1 file changed, 61 insertions(+), 3 deletions(-) diff --git a/projects/clearpool/index.js b/projects/clearpool/index.js index 52364f2b5c2..86b78009782 100644 --- a/projects/clearpool/index.js +++ b/projects/clearpool/index.js @@ -13,7 +13,7 @@ const PoolFactory = "0xde204e5a060ba5d3b63c7a4099712959114c2d48"; const START_BLOCK = 14443222; const polygonPoolURL = "https://clearpool.finance/api/pools"; -const ethereumTVL = async (timestamp, block, chainBlocks, { api }) => { +const ethereumTvl = async (timestamp, block, chainBlocks, { api }) => { const balances = {}; const Logs = await getLogs({ api, @@ -111,14 +111,68 @@ const polygonBorrowed = async (timestamp, _, { polygon: block }) => { return totalBorrowed; }; -const singleStakingContracts = ["0x629E39da1Db5654fe59cAE31d48CAEBB8dC2A9c6"]; +const polygonZkEvmTvl = async (timestamp, _, { polygon: block }) => { + const balances = {}; + const chain = "polygon_zkevm"; + const poolAllData = await getConfig( + "clearpool-polygon-zkevm", + polygonPoolURL + ); + const poolData = poolAllData["1101"]; + const tokensAndOwners = []; + for (let i = 0; i < poolData.length; i++) { + const pool = poolData[i].address; + const token = poolData[i].currencyAddress; + tokensAndOwners.push([token, pool]); + } + await sumTokens(balances, tokensAndOwners, block, chain); + return balances; +}; + +const polygonZkEvmBorrowed = async (timestamp, _, { polygon: block }) => { + const chain = "polygon_zkevm"; + const poolAllData = await getConfig( + "clearpool-polygon-zkevm", + polygonPoolURL + ); + const poolData = poolAllData["1101"]; + const totalBorrowed = {}; + + const pools = []; + const tokens = []; + + for (let i = 0; i < poolData.length; i++) { + const pool = poolData[i].address; + const token = poolData[i].currencyAddress; + pools.push(pool); + tokens.push(token); + } + + const { output: borrowed } = await sdk.api.abi.multiCall({ + abi: abi.borrows, + calls: pools.map((i) => ({ target: i })), + chain, + block, + }); + + borrowed.forEach((data, i) => + sdk.util.sumSingleBalance( + totalBorrowed, + chain + ":" + tokens[i], + data.output + ) + ); + return totalBorrowed; +}; + +const singleStakingContracts = ["0x629E39da1Db5654fe59cAE31d48CAEBB8dC2A9c6"]; const CPOOL = "0x66761fa41377003622aee3c7675fc7b5c1c2fac5"; module.exports = { timetravel: false, ethereum: { - tvl: ethereumTVL, + tvl: ethereumTvl, borrowed: ethereumBorrowed, staking: stakings(singleStakingContracts, CPOOL), }, @@ -126,5 +180,9 @@ module.exports = { tvl: polygonTvl, borrowed: polygonBorrowed, }, + polygon_zkevm: { + tvl: polygonZkEvmTvl, + borrowed: polygonZkEvmBorrowed, + }, methodology: "We count liquidity by USDC deposited on the pools contracts", }; From c9058cd82550eda8d68aa8c70e38d24b23e70f2c Mon Sep 17 00:00:00 2001 From: MagnateFi <126637939+MagnateArb@users.noreply.github.com> Date: Thu, 3 Aug 2023 22:40:12 +0800 Subject: [PATCH 0654/1974] Add Magnate Finance on BASE --- projects/Magnate/index.js | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 projects/Magnate/index.js diff --git a/projects/Magnate/index.js b/projects/Magnate/index.js new file mode 100644 index 00000000000..5f81be136cd --- /dev/null +++ b/projects/Magnate/index.js @@ -0,0 +1,9 @@ +const { compoundExports2 } = require("../helper/compound"); + +module.exports = { + base: compoundExports2({ + comptroller: "0x9C1925d9fA1E9ba7aa57db36B15E29C07f5d85e2", + fetchBalances: true, + cether: '0x68725461357B7e5e059A224B3b2fC45F3654c889', + }), +}; From 05593913dc49c0fff21249bb20900a1d969af66b Mon Sep 17 00:00:00 2001 From: Dan Hsu Date: Fri, 4 Aug 2023 01:11:33 +0800 Subject: [PATCH 0655/1974] feature: add locked lp from aftermath --- package-lock.json | 1088 +++++++++++++++++++++++++++++ projects/bucket-protocol/index.js | 43 ++ 2 files changed, 1131 insertions(+) diff --git a/package-lock.json b/package-lock.json index 6a48860ffb1..e70677fc6b5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,6 +15,7 @@ "@solana/web3.js": "^1.36.0", "@solendprotocol/solend-sdk": "^0.6.2", "@supercharge/promise-pool": "^2.1.0", + "aftermath-sdk": "^0.0.156", "aws-sdk": "^2.1268.0", "axios": "^0.27.2", "bignumber.js": "^9.0.1", @@ -39,6 +40,18 @@ "ts-node": "^10.8.1" } }, + "node_modules/@aptos-labs/aptos-client": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/@aptos-labs/aptos-client/-/aptos-client-0.0.2.tgz", + "integrity": "sha512-FgKZb5zDPz8MmAcVxXzYhxP6OkzuIPoDRJp48YJ8+vrZ9EOZ35HaWGN2M3u+GPdnFE9mODFqkxw3azh3kHGZjQ==", + "dependencies": { + "axios": "0.27.2", + "got": "^11.0.0" + }, + "engines": { + "node": ">=15.10.0" + } + }, "node_modules/@babel/runtime": { "version": "7.20.7", "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.20.7.tgz", @@ -935,6 +948,28 @@ "node": ">=11" } }, + "node_modules/@noble/curves": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.1.0.tgz", + "integrity": "sha512-091oBExgENk/kGj3AZmtBDMpxQPDtxQABR2B9lb1JbVTs6ytdzZNwvhxQ4MWasRNEzlbEH8jCWFCwhF/Obj5AA==", + "dependencies": { + "@noble/hashes": "1.3.1" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@noble/curves/node_modules/@noble/hashes": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.1.tgz", + "integrity": "sha512-EbqwksQwz9xDRGfDST86whPBgM65E0OH/pCgqW0GBVzO22bNE+NuIbeTb714+IfSjU3aRk47EUvXIb5bTsenKA==", + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, "node_modules/@noble/ed25519": { "version": "1.7.1", "resolved": "https://registry.npmjs.org/@noble/ed25519/-/ed25519-1.7.1.tgz", @@ -1093,6 +1128,115 @@ "@solana/web3.js": "^1.30.2" } }, + "node_modules/@pythnetwork/price-service-client": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/@pythnetwork/price-service-client/-/price-service-client-1.6.1.tgz", + "integrity": "sha512-2Hrk/ZN7aSxajptCELrc6yc55fe1biEK8e/wujJIQJgPiw2CnnkyfUuGydgzaFdPUzkkOMN55C2kFN3+FUsjEQ==", + "dependencies": { + "@pythnetwork/price-service-sdk": "*", + "@types/ws": "^8.5.3", + "axios": "=1.1.0", + "axios-retry": "~3.3.0", + "isomorphic-ws": "^4.0.1", + "ts-log": "^2.2.4", + "ws": "^8.6.0" + } + }, + "node_modules/@pythnetwork/price-service-client/node_modules/@types/ws": { + "version": "8.5.5", + "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.5.tgz", + "integrity": "sha512-lwhs8hktwxSjf9UaZ9tG5M03PGogvFaH8gUgLNbN9HKIg0dvv6q+gkSuJ8HN4/VbyxkuLzCjlN7GquQ0gUJfIg==", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@pythnetwork/price-service-client/node_modules/axios": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.1.0.tgz", + "integrity": "sha512-hsJgcqz4JY7f+HZ4cWTrPZ6tZNCNFPTRx1MjRqu/hbpgpHdSCUpLVuplc+jE/h7dOvyANtw/ERA3HC2Rz/QoMg==", + "dependencies": { + "follow-redirects": "^1.15.0", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" + } + }, + "node_modules/@pythnetwork/price-service-client/node_modules/ws": { + "version": "8.13.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz", + "integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/@pythnetwork/price-service-sdk": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@pythnetwork/price-service-sdk/-/price-service-sdk-1.3.0.tgz", + "integrity": "sha512-MCHKBh/oa/ACBcOgHSv/rCoc0KP2ul1/dKNEWs9jkbXeUUOGmim62tgjv7vYRIodktG+uN9T41rIN03mIJWzvg==" + }, + "node_modules/@pythnetwork/pyth-aptos-js": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@pythnetwork/pyth-aptos-js/-/pyth-aptos-js-1.2.0.tgz", + "integrity": "sha512-hGLrcQdNxIZb5yNpJZTwdqP9yNdDx4trrMvGjqFqRq16VqXWwWocgWl9DqgHtnoqy2xZuBP+jio8fGjYgdyfhg==", + "dependencies": { + "@pythnetwork/price-service-client": "*", + "aptos": "^1.3.14", + "buffer": "^6.0.3" + } + }, + "node_modules/@pythnetwork/pyth-aptos-js/node_modules/buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" + } + }, + "node_modules/@pythnetwork/pyth-aptos-js/node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, "node_modules/@scure/base": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.1.tgz", @@ -1146,6 +1290,17 @@ "@scure/base": "~1.1.0" } }, + "node_modules/@sindresorhus/is": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.6.0.tgz", + "integrity": "sha512-t09vSN3MdfsyCHoFcTRCH/iUtG7OJ0CsjzB8cjAmKc/va/kIgeDI/TxsigdncE/4be734m0cvIYwNaV4i2XqAw==", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sindresorhus/is?sponsor=1" + } + }, "node_modules/@solana/buffer-layout": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/@solana/buffer-layout/-/buffer-layout-4.0.1.tgz", @@ -1442,6 +1597,11 @@ "node": ">=4.2.0" } }, + "node_modules/@suchipi/femver": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@suchipi/femver/-/femver-1.0.0.tgz", + "integrity": "sha512-bprE8+K5V+DPX7q2e2K57ImqNBdfGHDIWaGI5xHxZoxbKOuQZn4wzPiUxOAHnsUr3w3xHrWXwN7gnG/iIuEMIg==" + }, "node_modules/@supercharge/promise-pool": { "version": "2.3.2", "resolved": "https://registry.npmjs.org/@supercharge/promise-pool/-/promise-pool-2.3.2.tgz", @@ -1450,6 +1610,17 @@ "node": ">=8" } }, + "node_modules/@szmarczak/http-timer": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-4.0.6.tgz", + "integrity": "sha512-4BAffykYOgO+5nzBWYwE3W90sBgLJoUPRWWcL8wlyiM8IB8ipJz3UMJ9KXQd1RKQXpKp8Tutn80HZtWsu2u76w==", + "dependencies": { + "defer-to-connect": "^2.0.0" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/@tsconfig/node10": { "version": "1.0.9", "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz", @@ -1492,6 +1663,17 @@ "@types/node": "*" } }, + "node_modules/@types/cacheable-request": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/@types/cacheable-request/-/cacheable-request-6.0.3.tgz", + "integrity": "sha512-IQ3EbTzGxIigb1I3qPZc1rWJnH0BmSKv5QYTalEwweFvyBDLSAe24zP0le/hyi7ecGfZVlIVAg4BZqb8WBwKqw==", + "dependencies": { + "@types/http-cache-semantics": "*", + "@types/keyv": "^3.1.4", + "@types/node": "*", + "@types/responselike": "^1.0.0" + } + }, "node_modules/@types/connect": { "version": "3.4.35", "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.35.tgz", @@ -1500,11 +1682,32 @@ "@types/node": "*" } }, + "node_modules/@types/http-cache-semantics": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@types/http-cache-semantics/-/http-cache-semantics-4.0.1.tgz", + "integrity": "sha512-SZs7ekbP8CN0txVG2xVRH6EgKmEm31BOxA07vkFaETzZz1xh+cbt8BcI0slpymvwhx5dlFnQG2rTlPVQn+iRPQ==" + }, + "node_modules/@types/keyv": { + "version": "3.1.4", + "resolved": "https://registry.npmjs.org/@types/keyv/-/keyv-3.1.4.tgz", + "integrity": "sha512-BQ5aZNSCpj7D6K2ksrRCTmKRLEpnPvWDiLPfoGyhZ++8YtiK9d/3DBKPJgry359X/P1PfruyYwvnvwFjuEiEIg==", + "dependencies": { + "@types/node": "*" + } + }, "node_modules/@types/node": { "version": "18.11.18", "resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.18.tgz", "integrity": "sha512-DHQpWGjyQKSHj3ebjFI/wRKcqQcdR+MoFBygntYOZytCqNfkd2ZC4ARDJ2DQqhjH5p85Nnd3jhUJIXrszFX/JA==" }, + "node_modules/@types/responselike": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@types/responselike/-/responselike-1.0.0.tgz", + "integrity": "sha512-85Y2BjiufFzaMIlvJDvTTB8Fxl2xfLo4HgmHzVBz08w4wDePCTjYw66PdrolO0kzli3yam/YCgRufyo1DdQVTA==", + "dependencies": { + "@types/node": "*" + } + }, "node_modules/@types/retry": { "version": "0.12.2", "resolved": "https://registry.npmjs.org/@types/retry/-/retry-0.12.2.tgz", @@ -1554,6 +1757,131 @@ "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-3.0.0.tgz", "integrity": "sha512-H7wUZRn8WpTq9jocdxQ2c8x2sKo9ZVmzfRE13GiNJXfp7NcKYEdvl3vspKjXox6RIG2VtaRe4JFvxG4rqp2Zuw==" }, + "node_modules/aftermath-sdk": { + "version": "0.0.156", + "resolved": "https://registry.npmjs.org/aftermath-sdk/-/aftermath-sdk-0.0.156.tgz", + "integrity": "sha512-hkKEuGY6Tw9k+LHfuPmb7rmcmpBSGX/9f8NDyaf3Qdbny8g0547i20ZxfSI5qVC0lHw9nTT5GBphGeNXbAd/GA==", + "dependencies": { + "@mysten/sui.js": "^0.28.0", + "@pythnetwork/pyth-aptos-js": "^1.0.0", + "dayjs": "^1.11.7", + "deep-copy-ts": "^0.5.4" + } + }, + "node_modules/aftermath-sdk/node_modules/@mysten/bcs": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/@mysten/bcs/-/bcs-0.6.0.tgz", + "integrity": "sha512-kw5GVjtonq7+CU8M2E2N3ndvWhSltDsMzXjy6WECAib1kr+FL9wn7dTmsw84QQjRslspKt1BGhNb+/CpLZp1cQ==", + "dependencies": { + "bs58": "^5.0.0" + } + }, + "node_modules/aftermath-sdk/node_modules/@mysten/sui.js": { + "version": "0.28.0", + "resolved": "https://registry.npmjs.org/@mysten/sui.js/-/sui.js-0.28.0.tgz", + "integrity": "sha512-JYqsmwBvYcyi7SXME3hlPbY0AfJvoxpoUXJqOFQB+olIAqpXUOfYp5ARTSKsA8X847JuH/1Ol5jh2uaG41MjdA==", + "dependencies": { + "@mysten/bcs": "0.6.0", + "@noble/hashes": "^1.1.5", + "@noble/secp256k1": "^1.7.0", + "@scure/bip32": "^1.1.1", + "@scure/bip39": "^1.1.0", + "@suchipi/femver": "^1.0.0", + "bs58": "^5.0.0", + "cross-fetch": "^3.1.5", + "jayson": "^4.0.0", + "js-sha3": "^0.8.0", + "rpc-websockets": "^7.5.0", + "superstruct": "^1.0.3", + "tweetnacl": "^1.0.3" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/aftermath-sdk/node_modules/@noble/hashes": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.1.tgz", + "integrity": "sha512-EbqwksQwz9xDRGfDST86whPBgM65E0OH/pCgqW0GBVzO22bNE+NuIbeTb714+IfSjU3aRk47EUvXIb5bTsenKA==", + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/aftermath-sdk/node_modules/@scure/bip32": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.3.1.tgz", + "integrity": "sha512-osvveYtyzdEVbt3OfwwXFr4P2iVBL5u1Q3q4ONBfDY/UpOuXmOlbgwc1xECEboY8wIays8Yt6onaWMUdUbfl0A==", + "dependencies": { + "@noble/curves": "~1.1.0", + "@noble/hashes": "~1.3.1", + "@scure/base": "~1.1.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/aftermath-sdk/node_modules/@types/node": { + "version": "12.20.55", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.55.tgz", + "integrity": "sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==" + }, + "node_modules/aftermath-sdk/node_modules/base-x": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/base-x/-/base-x-4.0.0.tgz", + "integrity": "sha512-FuwxlW4H5kh37X/oW59pwTzzTKRzfrrQwhmyspRM7swOEZcHtDZSCt45U6oKgtuFE+WYPblePMVIPR4RZrh/hw==" + }, + "node_modules/aftermath-sdk/node_modules/bs58": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/bs58/-/bs58-5.0.0.tgz", + "integrity": "sha512-r+ihvQJvahgYT50JD05dyJNKlmmSlMoOGwn1lCcEzanPglg7TxYjioQUYehQ9mAR/+hOSd2jRc/Z2y5UxBymvQ==", + "dependencies": { + "base-x": "^4.0.0" + } + }, + "node_modules/aftermath-sdk/node_modules/jayson": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/jayson/-/jayson-4.1.0.tgz", + "integrity": "sha512-R6JlbyLN53Mjku329XoRT2zJAE6ZgOQ8f91ucYdMCD4nkGCF9kZSrcGXpHIU4jeKj58zUZke2p+cdQchU7Ly7A==", + "dependencies": { + "@types/connect": "^3.4.33", + "@types/node": "^12.12.54", + "@types/ws": "^7.4.4", + "commander": "^2.20.3", + "delay": "^5.0.0", + "es6-promisify": "^5.0.0", + "eyes": "^0.1.8", + "isomorphic-ws": "^4.0.1", + "json-stringify-safe": "^5.0.1", + "JSONStream": "^1.3.5", + "uuid": "^8.3.2", + "ws": "^7.4.5" + }, + "bin": { + "jayson": "bin/jayson.js" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/aftermath-sdk/node_modules/superstruct": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/superstruct/-/superstruct-1.0.3.tgz", + "integrity": "sha512-8iTn3oSS8nRGn+C2pgXSKPI3jmpm6FExNazNpjvqS6ZUJQCej3PUXEKM8NjHBOs54ExM+LPW/FBRhymrdcCiSg==", + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/aftermath-sdk/node_modules/uuid": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "bin": { + "uuid": "dist/bin/uuid" + } + }, "node_modules/agentkeepalive": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.2.1.tgz", @@ -1607,6 +1935,38 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, + "node_modules/aptos": { + "version": "1.16.0", + "resolved": "https://registry.npmjs.org/aptos/-/aptos-1.16.0.tgz", + "integrity": "sha512-6VUeIFryLGz2bTSs1dIDRbuDsirbCV9hbJK+wBIcpQrl+iz9Zp7MlIAnIPqzYe8jURzAwOM/nZ796gEomBdNIw==", + "dependencies": { + "@aptos-labs/aptos-client": "^0.0.2", + "@noble/hashes": "1.1.3", + "@scure/bip39": "1.1.0", + "eventemitter3": "^5.0.1", + "form-data": "4.0.0", + "tweetnacl": "1.0.3" + }, + "engines": { + "node": ">=11.0.0" + } + }, + "node_modules/aptos/node_modules/@noble/hashes": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.1.3.tgz", + "integrity": "sha512-CE0FCR57H2acVI5UOzIGSSIYxZ6v/HOhDR0Ro9VLyhnzLwx0o8W1mmgaqlEUx4049qJDlIBRztv5k+MM8vbO3A==", + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ] + }, + "node_modules/aptos/node_modules/eventemitter3": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.1.tgz", + "integrity": "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==" + }, "node_modules/arg": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", @@ -1683,6 +2043,15 @@ "form-data": "^4.0.0" } }, + "node_modules/axios-retry": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/axios-retry/-/axios-retry-3.3.1.tgz", + "integrity": "sha512-RohAUQTDxBSWLFEnoIG/6bvmy8l3TfpkclgStjl5MDCMBDgapAWCmr1r/9harQfWC8bzLC8job6UcL1A1Yc+/Q==", + "dependencies": { + "@babel/runtime": "^7.15.4", + "is-retry-allowed": "^2.2.0" + } + }, "node_modules/balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", @@ -1853,6 +2222,31 @@ "node": ">=6.14.2" } }, + "node_modules/cacheable-lookup": { + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/cacheable-lookup/-/cacheable-lookup-5.0.4.tgz", + "integrity": "sha512-2/kNscPhpcxrOigMZzbiWF7dz8ilhb/nIHU3EyZiXWXpeq/au8qJ8VhdftMkty3n7Gj6HIGalQG8oiBNB3AJgA==", + "engines": { + "node": ">=10.6.0" + } + }, + "node_modules/cacheable-request": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-7.0.4.tgz", + "integrity": "sha512-v+p6ongsrp0yTGbJXjgxPow2+DL93DASP4kXCDKb8/bwRtt9OEF3whggkkDkGNzgcWy2XaF4a8nZglC7uElscg==", + "dependencies": { + "clone-response": "^1.0.2", + "get-stream": "^5.1.0", + "http-cache-semantics": "^4.0.0", + "keyv": "^4.0.0", + "lowercase-keys": "^2.0.0", + "normalize-url": "^6.0.1", + "responselike": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/call-bind": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", @@ -1898,6 +2292,17 @@ "url": "https://github.com/chalk/chalk?sponsor=1" } }, + "node_modules/clone-response": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/clone-response/-/clone-response-1.0.3.tgz", + "integrity": "sha512-ROoL94jJH2dUVML2Y/5PEDNaSHgeOdSDicUyS7izcF63G6sTc/FTjLub4b8Il9S8S0beOfYt0TaA5qvFK+w0wA==", + "dependencies": { + "mimic-response": "^1.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/color-convert": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", @@ -1985,6 +2390,11 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/dayjs": { + "version": "1.11.9", + "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.9.tgz", + "integrity": "sha512-QvzAURSbQ0pKdIye2txOzNaHmxtUBXerpY0FJsFXUMKbIZeFm5ht1LS/jFsrncjnmtv8HsG0W2g6c0zUjZWmpA==" + }, "node_modules/debug": { "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", @@ -2001,12 +2411,50 @@ } } }, + "node_modules/decompress-response": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz", + "integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==", + "dependencies": { + "mimic-response": "^3.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/decompress-response/node_modules/mimic-response": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz", + "integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/deep-copy-ts": { + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/deep-copy-ts/-/deep-copy-ts-0.5.4.tgz", + "integrity": "sha512-YJbPjw0YqdosorpCsa6copy1p/gJsFT9Q6Zq0tLi7D0nXh6Y/usjeIQZfkzV3HVuqY0Hl/5gM7TwgIbIWvEjlA==" + }, "node_modules/deep-is": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", "dev": true }, + "node_modules/defer-to-connect": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-2.0.1.tgz", + "integrity": "sha512-4tvttepXG1VaYGrRibk5EwJd1t4udunSOVMdLSAL6mId1ix438oPwPZMALY41FCijukO1L0twNcGsdzS7dHgDg==", + "engines": { + "node": ">=10" + } + }, "node_modules/delay": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/delay/-/delay-5.0.0.tgz", @@ -2091,6 +2539,14 @@ "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" }, + "node_modules/end-of-stream": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", + "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", + "dependencies": { + "once": "^1.4.0" + } + }, "node_modules/es6-promise": { "version": "4.2.8", "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", @@ -2562,6 +3018,20 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/get-stream": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", + "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", + "dependencies": { + "pump": "^3.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/glob": { "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", @@ -2619,6 +3089,30 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/got": { + "version": "11.8.6", + "resolved": "https://registry.npmjs.org/got/-/got-11.8.6.tgz", + "integrity": "sha512-6tfZ91bOr7bOXnK7PRDCGBLa1H4U080YHNaAQ2KsMGlLEzRbk44nsZF2E1IeRc3vtJHPVbKCYgdFbaGO2ljd8g==", + "dependencies": { + "@sindresorhus/is": "^4.0.0", + "@szmarczak/http-timer": "^4.0.5", + "@types/cacheable-request": "^6.0.1", + "@types/responselike": "^1.0.0", + "cacheable-lookup": "^5.0.3", + "cacheable-request": "^7.0.2", + "decompress-response": "^6.0.0", + "http2-wrapper": "^1.0.0-beta.5.2", + "lowercase-keys": "^2.0.0", + "p-cancelable": "^2.0.0", + "responselike": "^2.0.0" + }, + "engines": { + "node": ">=10.19.0" + }, + "funding": { + "url": "https://github.com/sindresorhus/got?sponsor=1" + } + }, "node_modules/graceful-fs": { "version": "4.2.10", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", @@ -2766,6 +3260,23 @@ "unix-dgram": "2.x" } }, + "node_modules/http-cache-semantics": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.1.tgz", + "integrity": "sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ==" + }, + "node_modules/http2-wrapper": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/http2-wrapper/-/http2-wrapper-1.0.3.tgz", + "integrity": "sha512-V+23sDMr12Wnz7iTcDeJr3O6AIxlnvT/bmaAAAP/Xda35C90p9599p0F1eHR/N1KILWSoWVAiOMFjBBXaXSMxg==", + "dependencies": { + "quick-lru": "^5.1.1", + "resolve-alpn": "^1.0.0" + }, + "engines": { + "node": ">=10.19.0" + } + }, "node_modules/humanize-ms": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz", @@ -2918,6 +3429,17 @@ "node": ">=8" } }, + "node_modules/is-retry-allowed": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/is-retry-allowed/-/is-retry-allowed-2.2.0.tgz", + "integrity": "sha512-XVm7LOeLpTW4jV19QSH38vkswxoLud8sQ57YwJVTPWdiaI9I8keEhGFpBlslyVsgdQy4Opg8QOLb8YRgsyZiQg==", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/is-typed-array": { "version": "1.1.10", "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.10.tgz", @@ -3061,6 +3583,11 @@ "bignumber.js": "^9.0.0" } }, + "node_modules/json-buffer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", + "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==" + }, "node_modules/json-schema-traverse": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", @@ -3124,6 +3651,14 @@ "resolved": "https://registry.npmjs.org/just-performance/-/just-performance-4.3.0.tgz", "integrity": "sha512-L7RjvtJsL0QO8xFs5wEoDDzzJwoiowRw6Rn/GnvldlchS2JQr9wFYPiwZcDfrbbujEKqKN0tvENdbjXdYhDp5Q==" }, + "node_modules/keyv": { + "version": "4.5.3", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.3.tgz", + "integrity": "sha512-QCiSav9WaX1PgETJ+SpNnx2PRRapJ/oRSXM4VO5OGYGSjrxbKPVFVhB3l2OCbLCk329N8qyAtsJjSjvVBWzEug==", + "dependencies": { + "json-buffer": "3.0.1" + } + }, "node_modules/levn": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", @@ -3179,6 +3714,14 @@ "tslib": "^2.0.3" } }, + "node_modules/lowercase-keys": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz", + "integrity": "sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==", + "engines": { + "node": ">=8" + } + }, "node_modules/lunr": { "version": "2.3.9", "resolved": "https://registry.npmjs.org/lunr/-/lunr-2.3.9.tgz", @@ -3222,6 +3765,14 @@ "node": ">= 0.6" } }, + "node_modules/mimic-response": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", + "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==", + "engines": { + "node": ">=4" + } + }, "node_modules/minimalistic-assert": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", @@ -3314,6 +3865,17 @@ "node-gyp-build-test": "build-test.js" } }, + "node_modules/normalize-url": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-6.1.0.tgz", + "integrity": "sha512-DlL+XwOy3NxAQ8xuC0okPgK46iuVNAK01YN7RueYBqqFeGsBjV9XmCAzAdgt+667bCl5kPh9EqKKDwnaPG1I7A==", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", @@ -3339,6 +3901,14 @@ "node": ">= 0.8.0" } }, + "node_modules/p-cancelable": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-2.1.1.tgz", + "integrity": "sha512-BZOr3nRQHOntUjTrH8+Lh54smKHoHyur8We1V8DSMVrl5A2malOOwuJRnKRDjSnkoeBh4at6BwEnb5I7Jl31wg==", + "engines": { + "node": ">=8" + } + }, "node_modules/p-limit": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", @@ -3436,6 +4006,20 @@ "node": ">=0.4.0" } }, + "node_modules/proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" + }, + "node_modules/pump": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", + "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", + "dependencies": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, "node_modules/punycode": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz", @@ -3470,6 +4054,17 @@ } ] }, + "node_modules/quick-lru": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-5.1.1.tgz", + "integrity": "sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA==", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/rechoir": { "version": "0.6.2", "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", @@ -3516,6 +4111,11 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/resolve-alpn": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/resolve-alpn/-/resolve-alpn-1.2.1.tgz", + "integrity": "sha512-0a1F4l73/ZFZOakJnQ3FvkJ2+gSTQWz/r2KE5OdDY0TxPm5h4GkqkWWfM47T7HsbnOtcJVEF4epCVy6u7Q3K+g==" + }, "node_modules/resolve-from": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", @@ -3525,6 +4125,17 @@ "node": ">=4" } }, + "node_modules/responselike": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/responselike/-/responselike-2.0.1.tgz", + "integrity": "sha512-4gl03wn3hj1HP3yzgdI7d3lCkF95F21Pz4BPGvKHinyQzALR5CapwC8yIi0Rh58DEMQ/SguC03wFj2k0M/mHhw==", + "dependencies": { + "lowercase-keys": "^2.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/reusify": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", @@ -3831,6 +4442,11 @@ "node": ">=14.0.0" } }, + "node_modules/ts-log": { + "version": "2.2.5", + "resolved": "https://registry.npmjs.org/ts-log/-/ts-log-2.2.5.tgz", + "integrity": "sha512-PGcnJoTBnVGy6yYNFxWVNkdcAuAMstvutN9MgDJIV6L0oG8fB+ZNNy1T+wJzah8RPGor1mZuPQkVfXNDpy9eHA==" + }, "node_modules/ts-node": { "version": "10.9.1", "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz", @@ -3879,6 +4495,11 @@ "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.1.tgz", "integrity": "sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==" }, + "node_modules/tweetnacl": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-1.0.3.tgz", + "integrity": "sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw==" + }, "node_modules/type-check": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", @@ -4176,6 +4797,15 @@ } }, "dependencies": { + "@aptos-labs/aptos-client": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/@aptos-labs/aptos-client/-/aptos-client-0.0.2.tgz", + "integrity": "sha512-FgKZb5zDPz8MmAcVxXzYhxP6OkzuIPoDRJp48YJ8+vrZ9EOZ35HaWGN2M3u+GPdnFE9mODFqkxw3azh3kHGZjQ==", + "requires": { + "axios": "0.27.2", + "got": "^11.0.0" + } + }, "@babel/runtime": { "version": "7.20.7", "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.20.7.tgz", @@ -4751,6 +5381,21 @@ } } }, + "@noble/curves": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.1.0.tgz", + "integrity": "sha512-091oBExgENk/kGj3AZmtBDMpxQPDtxQABR2B9lb1JbVTs6ytdzZNwvhxQ4MWasRNEzlbEH8jCWFCwhF/Obj5AA==", + "requires": { + "@noble/hashes": "1.3.1" + }, + "dependencies": { + "@noble/hashes": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.1.tgz", + "integrity": "sha512-EbqwksQwz9xDRGfDST86whPBgM65E0OH/pCgqW0GBVzO22bNE+NuIbeTb714+IfSjU3aRk47EUvXIb5bTsenKA==" + } + } + }, "@noble/ed25519": { "version": "1.7.1", "resolved": "https://registry.npmjs.org/@noble/ed25519/-/ed25519-1.7.1.tgz", @@ -4866,6 +5511,77 @@ "buffer": "^6.0.1" } }, + "@pythnetwork/price-service-client": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/@pythnetwork/price-service-client/-/price-service-client-1.6.1.tgz", + "integrity": "sha512-2Hrk/ZN7aSxajptCELrc6yc55fe1biEK8e/wujJIQJgPiw2CnnkyfUuGydgzaFdPUzkkOMN55C2kFN3+FUsjEQ==", + "requires": { + "@pythnetwork/price-service-sdk": "*", + "@types/ws": "^8.5.3", + "axios": "=1.1.0", + "axios-retry": "~3.3.0", + "isomorphic-ws": "^4.0.1", + "ts-log": "^2.2.4", + "ws": "^8.6.0" + }, + "dependencies": { + "@types/ws": { + "version": "8.5.5", + "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.5.tgz", + "integrity": "sha512-lwhs8hktwxSjf9UaZ9tG5M03PGogvFaH8gUgLNbN9HKIg0dvv6q+gkSuJ8HN4/VbyxkuLzCjlN7GquQ0gUJfIg==", + "requires": { + "@types/node": "*" + } + }, + "axios": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.1.0.tgz", + "integrity": "sha512-hsJgcqz4JY7f+HZ4cWTrPZ6tZNCNFPTRx1MjRqu/hbpgpHdSCUpLVuplc+jE/h7dOvyANtw/ERA3HC2Rz/QoMg==", + "requires": { + "follow-redirects": "^1.15.0", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" + } + }, + "ws": { + "version": "8.13.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz", + "integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==", + "requires": {} + } + } + }, + "@pythnetwork/price-service-sdk": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@pythnetwork/price-service-sdk/-/price-service-sdk-1.3.0.tgz", + "integrity": "sha512-MCHKBh/oa/ACBcOgHSv/rCoc0KP2ul1/dKNEWs9jkbXeUUOGmim62tgjv7vYRIodktG+uN9T41rIN03mIJWzvg==" + }, + "@pythnetwork/pyth-aptos-js": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@pythnetwork/pyth-aptos-js/-/pyth-aptos-js-1.2.0.tgz", + "integrity": "sha512-hGLrcQdNxIZb5yNpJZTwdqP9yNdDx4trrMvGjqFqRq16VqXWwWocgWl9DqgHtnoqy2xZuBP+jio8fGjYgdyfhg==", + "requires": { + "@pythnetwork/price-service-client": "*", + "aptos": "^1.3.14", + "buffer": "^6.0.3" + }, + "dependencies": { + "buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "requires": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" + } + }, + "ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==" + } + } + }, "@scure/base": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.1.tgz", @@ -4897,6 +5613,11 @@ "@scure/base": "~1.1.0" } }, + "@sindresorhus/is": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.6.0.tgz", + "integrity": "sha512-t09vSN3MdfsyCHoFcTRCH/iUtG7OJ0CsjzB8cjAmKc/va/kIgeDI/TxsigdncE/4be734m0cvIYwNaV4i2XqAw==" + }, "@solana/buffer-layout": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/@solana/buffer-layout/-/buffer-layout-4.0.1.tgz", @@ -5084,11 +5805,24 @@ } } }, + "@suchipi/femver": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@suchipi/femver/-/femver-1.0.0.tgz", + "integrity": "sha512-bprE8+K5V+DPX7q2e2K57ImqNBdfGHDIWaGI5xHxZoxbKOuQZn4wzPiUxOAHnsUr3w3xHrWXwN7gnG/iIuEMIg==" + }, "@supercharge/promise-pool": { "version": "2.3.2", "resolved": "https://registry.npmjs.org/@supercharge/promise-pool/-/promise-pool-2.3.2.tgz", "integrity": "sha512-f5+C7zv+QQivcUO1FH5lXi7GcuJ3CFuJF3Eg06iArhUs5ma0szCLEQwIY4+VQyh7m/RLVZdzvr4E4ZDnLe9MNg==" }, + "@szmarczak/http-timer": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-4.0.6.tgz", + "integrity": "sha512-4BAffykYOgO+5nzBWYwE3W90sBgLJoUPRWWcL8wlyiM8IB8ipJz3UMJ9KXQd1RKQXpKp8Tutn80HZtWsu2u76w==", + "requires": { + "defer-to-connect": "^2.0.0" + } + }, "@tsconfig/node10": { "version": "1.0.9", "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz", @@ -5131,6 +5865,17 @@ "@types/node": "*" } }, + "@types/cacheable-request": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/@types/cacheable-request/-/cacheable-request-6.0.3.tgz", + "integrity": "sha512-IQ3EbTzGxIigb1I3qPZc1rWJnH0BmSKv5QYTalEwweFvyBDLSAe24zP0le/hyi7ecGfZVlIVAg4BZqb8WBwKqw==", + "requires": { + "@types/http-cache-semantics": "*", + "@types/keyv": "^3.1.4", + "@types/node": "*", + "@types/responselike": "^1.0.0" + } + }, "@types/connect": { "version": "3.4.35", "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.35.tgz", @@ -5139,11 +5884,32 @@ "@types/node": "*" } }, + "@types/http-cache-semantics": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@types/http-cache-semantics/-/http-cache-semantics-4.0.1.tgz", + "integrity": "sha512-SZs7ekbP8CN0txVG2xVRH6EgKmEm31BOxA07vkFaETzZz1xh+cbt8BcI0slpymvwhx5dlFnQG2rTlPVQn+iRPQ==" + }, + "@types/keyv": { + "version": "3.1.4", + "resolved": "https://registry.npmjs.org/@types/keyv/-/keyv-3.1.4.tgz", + "integrity": "sha512-BQ5aZNSCpj7D6K2ksrRCTmKRLEpnPvWDiLPfoGyhZ++8YtiK9d/3DBKPJgry359X/P1PfruyYwvnvwFjuEiEIg==", + "requires": { + "@types/node": "*" + } + }, "@types/node": { "version": "18.11.18", "resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.18.tgz", "integrity": "sha512-DHQpWGjyQKSHj3ebjFI/wRKcqQcdR+MoFBygntYOZytCqNfkd2ZC4ARDJ2DQqhjH5p85Nnd3jhUJIXrszFX/JA==" }, + "@types/responselike": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@types/responselike/-/responselike-1.0.0.tgz", + "integrity": "sha512-85Y2BjiufFzaMIlvJDvTTB8Fxl2xfLo4HgmHzVBz08w4wDePCTjYw66PdrolO0kzli3yam/YCgRufyo1DdQVTA==", + "requires": { + "@types/node": "*" + } + }, "@types/retry": { "version": "0.12.2", "resolved": "https://registry.npmjs.org/@types/retry/-/retry-0.12.2.tgz", @@ -5182,6 +5948,109 @@ "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-3.0.0.tgz", "integrity": "sha512-H7wUZRn8WpTq9jocdxQ2c8x2sKo9ZVmzfRE13GiNJXfp7NcKYEdvl3vspKjXox6RIG2VtaRe4JFvxG4rqp2Zuw==" }, + "aftermath-sdk": { + "version": "0.0.156", + "resolved": "https://registry.npmjs.org/aftermath-sdk/-/aftermath-sdk-0.0.156.tgz", + "integrity": "sha512-hkKEuGY6Tw9k+LHfuPmb7rmcmpBSGX/9f8NDyaf3Qdbny8g0547i20ZxfSI5qVC0lHw9nTT5GBphGeNXbAd/GA==", + "requires": { + "@mysten/sui.js": "^0.28.0", + "@pythnetwork/pyth-aptos-js": "^1.0.0", + "dayjs": "^1.11.7", + "deep-copy-ts": "^0.5.4" + }, + "dependencies": { + "@mysten/bcs": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/@mysten/bcs/-/bcs-0.6.0.tgz", + "integrity": "sha512-kw5GVjtonq7+CU8M2E2N3ndvWhSltDsMzXjy6WECAib1kr+FL9wn7dTmsw84QQjRslspKt1BGhNb+/CpLZp1cQ==", + "requires": { + "bs58": "^5.0.0" + } + }, + "@mysten/sui.js": { + "version": "0.28.0", + "resolved": "https://registry.npmjs.org/@mysten/sui.js/-/sui.js-0.28.0.tgz", + "integrity": "sha512-JYqsmwBvYcyi7SXME3hlPbY0AfJvoxpoUXJqOFQB+olIAqpXUOfYp5ARTSKsA8X847JuH/1Ol5jh2uaG41MjdA==", + "requires": { + "@mysten/bcs": "0.6.0", + "@noble/hashes": "^1.1.5", + "@noble/secp256k1": "^1.7.0", + "@scure/bip32": "^1.1.1", + "@scure/bip39": "^1.1.0", + "@suchipi/femver": "^1.0.0", + "bs58": "^5.0.0", + "cross-fetch": "^3.1.5", + "jayson": "^4.0.0", + "js-sha3": "^0.8.0", + "rpc-websockets": "^7.5.0", + "superstruct": "^1.0.3", + "tweetnacl": "^1.0.3" + } + }, + "@noble/hashes": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.1.tgz", + "integrity": "sha512-EbqwksQwz9xDRGfDST86whPBgM65E0OH/pCgqW0GBVzO22bNE+NuIbeTb714+IfSjU3aRk47EUvXIb5bTsenKA==" + }, + "@scure/bip32": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.3.1.tgz", + "integrity": "sha512-osvveYtyzdEVbt3OfwwXFr4P2iVBL5u1Q3q4ONBfDY/UpOuXmOlbgwc1xECEboY8wIays8Yt6onaWMUdUbfl0A==", + "requires": { + "@noble/curves": "~1.1.0", + "@noble/hashes": "~1.3.1", + "@scure/base": "~1.1.0" + } + }, + "@types/node": { + "version": "12.20.55", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.55.tgz", + "integrity": "sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==" + }, + "base-x": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/base-x/-/base-x-4.0.0.tgz", + "integrity": "sha512-FuwxlW4H5kh37X/oW59pwTzzTKRzfrrQwhmyspRM7swOEZcHtDZSCt45U6oKgtuFE+WYPblePMVIPR4RZrh/hw==" + }, + "bs58": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/bs58/-/bs58-5.0.0.tgz", + "integrity": "sha512-r+ihvQJvahgYT50JD05dyJNKlmmSlMoOGwn1lCcEzanPglg7TxYjioQUYehQ9mAR/+hOSd2jRc/Z2y5UxBymvQ==", + "requires": { + "base-x": "^4.0.0" + } + }, + "jayson": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/jayson/-/jayson-4.1.0.tgz", + "integrity": "sha512-R6JlbyLN53Mjku329XoRT2zJAE6ZgOQ8f91ucYdMCD4nkGCF9kZSrcGXpHIU4jeKj58zUZke2p+cdQchU7Ly7A==", + "requires": { + "@types/connect": "^3.4.33", + "@types/node": "^12.12.54", + "@types/ws": "^7.4.4", + "commander": "^2.20.3", + "delay": "^5.0.0", + "es6-promisify": "^5.0.0", + "eyes": "^0.1.8", + "isomorphic-ws": "^4.0.1", + "json-stringify-safe": "^5.0.1", + "JSONStream": "^1.3.5", + "uuid": "^8.3.2", + "ws": "^7.4.5" + } + }, + "superstruct": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/superstruct/-/superstruct-1.0.3.tgz", + "integrity": "sha512-8iTn3oSS8nRGn+C2pgXSKPI3jmpm6FExNazNpjvqS6ZUJQCej3PUXEKM8NjHBOs54ExM+LPW/FBRhymrdcCiSg==" + }, + "uuid": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==" + } + } + }, "agentkeepalive": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.2.1.tgz", @@ -5219,6 +6088,31 @@ "color-convert": "^2.0.1" } }, + "aptos": { + "version": "1.16.0", + "resolved": "https://registry.npmjs.org/aptos/-/aptos-1.16.0.tgz", + "integrity": "sha512-6VUeIFryLGz2bTSs1dIDRbuDsirbCV9hbJK+wBIcpQrl+iz9Zp7MlIAnIPqzYe8jURzAwOM/nZ796gEomBdNIw==", + "requires": { + "@aptos-labs/aptos-client": "^0.0.2", + "@noble/hashes": "1.1.3", + "@scure/bip39": "1.1.0", + "eventemitter3": "^5.0.1", + "form-data": "4.0.0", + "tweetnacl": "1.0.3" + }, + "dependencies": { + "@noble/hashes": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.1.3.tgz", + "integrity": "sha512-CE0FCR57H2acVI5UOzIGSSIYxZ6v/HOhDR0Ro9VLyhnzLwx0o8W1mmgaqlEUx4049qJDlIBRztv5k+MM8vbO3A==" + }, + "eventemitter3": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.1.tgz", + "integrity": "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==" + } + } + }, "arg": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", @@ -5285,6 +6179,15 @@ "form-data": "^4.0.0" } }, + "axios-retry": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/axios-retry/-/axios-retry-3.3.1.tgz", + "integrity": "sha512-RohAUQTDxBSWLFEnoIG/6bvmy8l3TfpkclgStjl5MDCMBDgapAWCmr1r/9harQfWC8bzLC8job6UcL1A1Yc+/Q==", + "requires": { + "@babel/runtime": "^7.15.4", + "is-retry-allowed": "^2.2.0" + } + }, "balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", @@ -5401,6 +6304,25 @@ "node-gyp-build": "^4.3.0" } }, + "cacheable-lookup": { + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/cacheable-lookup/-/cacheable-lookup-5.0.4.tgz", + "integrity": "sha512-2/kNscPhpcxrOigMZzbiWF7dz8ilhb/nIHU3EyZiXWXpeq/au8qJ8VhdftMkty3n7Gj6HIGalQG8oiBNB3AJgA==" + }, + "cacheable-request": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-7.0.4.tgz", + "integrity": "sha512-v+p6ongsrp0yTGbJXjgxPow2+DL93DASP4kXCDKb8/bwRtt9OEF3whggkkDkGNzgcWy2XaF4a8nZglC7uElscg==", + "requires": { + "clone-response": "^1.0.2", + "get-stream": "^5.1.0", + "http-cache-semantics": "^4.0.0", + "keyv": "^4.0.0", + "lowercase-keys": "^2.0.0", + "normalize-url": "^6.0.1", + "responselike": "^2.0.0" + } + }, "call-bind": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", @@ -5431,6 +6353,14 @@ "supports-color": "^7.1.0" } }, + "clone-response": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/clone-response/-/clone-response-1.0.3.tgz", + "integrity": "sha512-ROoL94jJH2dUVML2Y/5PEDNaSHgeOdSDicUyS7izcF63G6sTc/FTjLub4b8Il9S8S0beOfYt0TaA5qvFK+w0wA==", + "requires": { + "mimic-response": "^1.0.0" + } + }, "color-convert": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", @@ -5500,6 +6430,11 @@ "resolved": "https://registry.npmjs.org/crypto-hash/-/crypto-hash-1.3.0.tgz", "integrity": "sha512-lyAZ0EMyjDkVvz8WOeVnuCPvKVBXcMv1l5SVqO1yC7PzTwrD/pPje/BIRbWhMoPe436U+Y2nD7f5bFx0kt+Sbg==" }, + "dayjs": { + "version": "1.11.9", + "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.9.tgz", + "integrity": "sha512-QvzAURSbQ0pKdIye2txOzNaHmxtUBXerpY0FJsFXUMKbIZeFm5ht1LS/jFsrncjnmtv8HsG0W2g6c0zUjZWmpA==" + }, "debug": { "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", @@ -5508,12 +6443,37 @@ "ms": "2.1.2" } }, + "decompress-response": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz", + "integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==", + "requires": { + "mimic-response": "^3.1.0" + }, + "dependencies": { + "mimic-response": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz", + "integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==" + } + } + }, + "deep-copy-ts": { + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/deep-copy-ts/-/deep-copy-ts-0.5.4.tgz", + "integrity": "sha512-YJbPjw0YqdosorpCsa6copy1p/gJsFT9Q6Zq0tLi7D0nXh6Y/usjeIQZfkzV3HVuqY0Hl/5gM7TwgIbIWvEjlA==" + }, "deep-is": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", "dev": true }, + "defer-to-connect": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-2.0.1.tgz", + "integrity": "sha512-4tvttepXG1VaYGrRibk5EwJd1t4udunSOVMdLSAL6mId1ix438oPwPZMALY41FCijukO1L0twNcGsdzS7dHgDg==" + }, "delay": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/delay/-/delay-5.0.0.tgz", @@ -5579,6 +6539,14 @@ } } }, + "end-of-stream": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", + "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", + "requires": { + "once": "^1.4.0" + } + }, "es6-promise": { "version": "4.2.8", "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", @@ -5934,6 +6902,14 @@ "has-symbols": "^1.0.3" } }, + "get-stream": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", + "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", + "requires": { + "pump": "^3.0.0" + } + }, "glob": { "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", @@ -5973,6 +6949,24 @@ "get-intrinsic": "^1.1.3" } }, + "got": { + "version": "11.8.6", + "resolved": "https://registry.npmjs.org/got/-/got-11.8.6.tgz", + "integrity": "sha512-6tfZ91bOr7bOXnK7PRDCGBLa1H4U080YHNaAQ2KsMGlLEzRbk44nsZF2E1IeRc3vtJHPVbKCYgdFbaGO2ljd8g==", + "requires": { + "@sindresorhus/is": "^4.0.0", + "@szmarczak/http-timer": "^4.0.5", + "@types/cacheable-request": "^6.0.1", + "@types/responselike": "^1.0.0", + "cacheable-lookup": "^5.0.3", + "cacheable-request": "^7.0.2", + "decompress-response": "^6.0.0", + "http2-wrapper": "^1.0.0-beta.5.2", + "lowercase-keys": "^2.0.0", + "p-cancelable": "^2.0.0", + "responselike": "^2.0.0" + } + }, "graceful-fs": { "version": "4.2.10", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", @@ -6084,6 +7078,20 @@ "unix-dgram": "2.x" } }, + "http-cache-semantics": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.1.tgz", + "integrity": "sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ==" + }, + "http2-wrapper": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/http2-wrapper/-/http2-wrapper-1.0.3.tgz", + "integrity": "sha512-V+23sDMr12Wnz7iTcDeJr3O6AIxlnvT/bmaAAAP/Xda35C90p9599p0F1eHR/N1KILWSoWVAiOMFjBBXaXSMxg==", + "requires": { + "quick-lru": "^5.1.1", + "resolve-alpn": "^1.0.0" + } + }, "humanize-ms": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz", @@ -6191,6 +7199,11 @@ "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", "dev": true }, + "is-retry-allowed": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/is-retry-allowed/-/is-retry-allowed-2.2.0.tgz", + "integrity": "sha512-XVm7LOeLpTW4jV19QSH38vkswxoLud8sQ57YwJVTPWdiaI9I8keEhGFpBlslyVsgdQy4Opg8QOLb8YRgsyZiQg==" + }, "is-typed-array": { "version": "1.1.10", "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.10.tgz", @@ -6309,6 +7322,11 @@ "bignumber.js": "^9.0.0" } }, + "json-buffer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", + "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==" + }, "json-schema-traverse": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", @@ -6361,6 +7379,14 @@ "resolved": "https://registry.npmjs.org/just-performance/-/just-performance-4.3.0.tgz", "integrity": "sha512-L7RjvtJsL0QO8xFs5wEoDDzzJwoiowRw6Rn/GnvldlchS2JQr9wFYPiwZcDfrbbujEKqKN0tvENdbjXdYhDp5Q==" }, + "keyv": { + "version": "4.5.3", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.3.tgz", + "integrity": "sha512-QCiSav9WaX1PgETJ+SpNnx2PRRapJ/oRSXM4VO5OGYGSjrxbKPVFVhB3l2OCbLCk329N8qyAtsJjSjvVBWzEug==", + "requires": { + "json-buffer": "3.0.1" + } + }, "levn": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", @@ -6407,6 +7433,11 @@ "tslib": "^2.0.3" } }, + "lowercase-keys": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz", + "integrity": "sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==" + }, "lunr": { "version": "2.3.9", "resolved": "https://registry.npmjs.org/lunr/-/lunr-2.3.9.tgz", @@ -6438,6 +7469,11 @@ "mime-db": "1.52.0" } }, + "mimic-response": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", + "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==" + }, "minimalistic-assert": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", @@ -6508,6 +7544,11 @@ "integrity": "sha512-2iGbaQBV+ITgCz76ZEjmhUKAKVf7xfY1sRl4UiKQspfZMH2h06SyhNsnSVy50cwkFQDGLyif6m/6uFXHkOZ6rg==", "optional": true }, + "normalize-url": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-6.1.0.tgz", + "integrity": "sha512-DlL+XwOy3NxAQ8xuC0okPgK46iuVNAK01YN7RueYBqqFeGsBjV9XmCAzAdgt+667bCl5kPh9EqKKDwnaPG1I7A==" + }, "once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", @@ -6530,6 +7571,11 @@ "word-wrap": "^1.2.3" } }, + "p-cancelable": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-2.1.1.tgz", + "integrity": "sha512-BZOr3nRQHOntUjTrH8+Lh54smKHoHyur8We1V8DSMVrl5A2malOOwuJRnKRDjSnkoeBh4at6BwEnb5I7Jl31wg==" + }, "p-limit": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", @@ -6597,6 +7643,20 @@ "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", "peer": true }, + "proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" + }, + "pump": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", + "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", + "requires": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, "punycode": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz", @@ -6613,6 +7673,11 @@ "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", "dev": true }, + "quick-lru": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-5.1.1.tgz", + "integrity": "sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA==" + }, "rechoir": { "version": "0.6.2", "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", @@ -6644,12 +7709,25 @@ "supports-preserve-symlinks-flag": "^1.0.0" } }, + "resolve-alpn": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/resolve-alpn/-/resolve-alpn-1.2.1.tgz", + "integrity": "sha512-0a1F4l73/ZFZOakJnQ3FvkJ2+gSTQWz/r2KE5OdDY0TxPm5h4GkqkWWfM47T7HsbnOtcJVEF4epCVy6u7Q3K+g==" + }, "resolve-from": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", "dev": true }, + "responselike": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/responselike/-/responselike-2.0.1.tgz", + "integrity": "sha512-4gl03wn3hj1HP3yzgdI7d3lCkF95F21Pz4BPGvKHinyQzALR5CapwC8yIi0Rh58DEMQ/SguC03wFj2k0M/mHhw==", + "requires": { + "lowercase-keys": "^2.0.0" + } + }, "reusify": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", @@ -6861,6 +7939,11 @@ "resolved": "https://registry.npmjs.org/ts-custom-error/-/ts-custom-error-3.3.1.tgz", "integrity": "sha512-5OX1tzOjxWEgsr/YEUWSuPrQ00deKLh6D7OTWcvNHm12/7QPyRh8SYpyWvA4IZv8H/+GQWQEh/kwo95Q9OVW1A==" }, + "ts-log": { + "version": "2.2.5", + "resolved": "https://registry.npmjs.org/ts-log/-/ts-log-2.2.5.tgz", + "integrity": "sha512-PGcnJoTBnVGy6yYNFxWVNkdcAuAMstvutN9MgDJIV6L0oG8fB+ZNNy1T+wJzah8RPGor1mZuPQkVfXNDpy9eHA==" + }, "ts-node": { "version": "10.9.1", "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz", @@ -6887,6 +7970,11 @@ "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.1.tgz", "integrity": "sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==" }, + "tweetnacl": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-1.0.3.tgz", + "integrity": "sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw==" + }, "type-check": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", diff --git a/projects/bucket-protocol/index.js b/projects/bucket-protocol/index.js index 6a64a7d49ff..fd63bbf5196 100644 --- a/projects/bucket-protocol/index.js +++ b/projects/bucket-protocol/index.js @@ -5,11 +5,35 @@ const MAINNET_PROTOCOL_ID = const BUCK = "0xce7ff77a83ea0cb6fd39bd8748e2ec89a3f41e8efdc3f4eb123e0ca37b184db2::buck::BUCK"; +const AF_LP_IDs = [ + "0xe2569ee20149c2909f0f6527c210bc9d97047fe948d34737de5420fab2db7062", + "0x885e09419b395fcf5c8ee5e2b7c77e23b590e58ef3d61260b6b4eb44bbcc8c62", +]; + +const AF_POOL_IDs = [ + "0xdeacf7ab460385d4bcb567f183f916367f7d43666a2c72323013822eb3c57026", + "0xeec6b5fb1ddbbe2eb1bdcd185a75a8e67f52a5295704dd73f3e447394775402b", +]; + async function tvl(_, _1, _2, { api }) { const protocolFields = await sui.getDynamicFieldObjects({ parent: MAINNET_PROTOCOL_ID, }); + const aflpObjs = await sui.getObjects(AF_LP_IDs); + + const stakedList = aflpObjs.map((aflp) => aflp.fields.staked); + + const pools = await sui.queryEvents({ + eventType: + "0xefe170ec0be4d762196bedecd7a065816576198a6527c99282a2551aaa7da38c::events::CreatedPoolEvent", + transform: (i) => i.pool_id, + }); + const poolData = await sui.getObjects(pools); + const buckPoolData = AF_POOL_IDs.map((id) => + poolData.find((pool) => pool.fields.id.id === id) + ); + const bucketList = protocolFields.filter((item) => item.type.includes("Bucket") ); @@ -24,6 +48,25 @@ async function tvl(_, _1, _2, { api }) { for (const tank of tankList) { api.add(BUCK, tank.fields.reserve); } + + for (const [ + index, + { + fields: { + type_names: tokens, + normalized_balances: bals, + lp_supply, + decimal_scalars, + }, + }, + ] of buckPoolData.entries()) { + bals.forEach((v, i) => { + const value = Math.floor( + (v * stakedList[index]) / lp_supply.fields.value / decimal_scalars[i] + ); + api.add("0x" + tokens[i], value); + }); + } } module.exports = { From 4e9e69757f6576dc95b3b71d473fa9e5e054ce42 Mon Sep 17 00:00:00 2001 From: Dan Hsu Date: Fri, 4 Aug 2023 01:24:09 +0800 Subject: [PATCH 0656/1974] fix: return package-lock.json --- package-lock.json | 1092 +-------------------------------------------- 1 file changed, 2 insertions(+), 1090 deletions(-) diff --git a/package-lock.json b/package-lock.json index 609a0bb540b..37383e00d9e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,7 +15,6 @@ "@solana/web3.js": "^1.36.0", "@solendprotocol/solend-sdk": "^0.6.2", "@supercharge/promise-pool": "^2.1.0", - "aftermath-sdk": "^0.0.156", "aws-sdk": "^2.1268.0", "axios": "^0.27.2", "bignumber.js": "^9.0.1", @@ -40,18 +39,6 @@ "ts-node": "^10.8.1" } }, - "node_modules/@aptos-labs/aptos-client": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/@aptos-labs/aptos-client/-/aptos-client-0.0.2.tgz", - "integrity": "sha512-FgKZb5zDPz8MmAcVxXzYhxP6OkzuIPoDRJp48YJ8+vrZ9EOZ35HaWGN2M3u+GPdnFE9mODFqkxw3azh3kHGZjQ==", - "dependencies": { - "axios": "0.27.2", - "got": "^11.0.0" - }, - "engines": { - "node": ">=15.10.0" - } - }, "node_modules/@babel/runtime": { "version": "7.20.7", "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.20.7.tgz", @@ -948,28 +935,6 @@ "node": ">=11" } }, - "node_modules/@noble/curves": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.1.0.tgz", - "integrity": "sha512-091oBExgENk/kGj3AZmtBDMpxQPDtxQABR2B9lb1JbVTs6ytdzZNwvhxQ4MWasRNEzlbEH8jCWFCwhF/Obj5AA==", - "dependencies": { - "@noble/hashes": "1.3.1" - }, - "funding": { - "url": "https://paulmillr.com/funding/" - } - }, - "node_modules/@noble/curves/node_modules/@noble/hashes": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.1.tgz", - "integrity": "sha512-EbqwksQwz9xDRGfDST86whPBgM65E0OH/pCgqW0GBVzO22bNE+NuIbeTb714+IfSjU3aRk47EUvXIb5bTsenKA==", - "engines": { - "node": ">= 16" - }, - "funding": { - "url": "https://paulmillr.com/funding/" - } - }, "node_modules/@noble/ed25519": { "version": "1.7.1", "resolved": "https://registry.npmjs.org/@noble/ed25519/-/ed25519-1.7.1.tgz", @@ -1128,115 +1093,6 @@ "@solana/web3.js": "^1.30.2" } }, - "node_modules/@pythnetwork/price-service-client": { - "version": "1.6.1", - "resolved": "https://registry.npmjs.org/@pythnetwork/price-service-client/-/price-service-client-1.6.1.tgz", - "integrity": "sha512-2Hrk/ZN7aSxajptCELrc6yc55fe1biEK8e/wujJIQJgPiw2CnnkyfUuGydgzaFdPUzkkOMN55C2kFN3+FUsjEQ==", - "dependencies": { - "@pythnetwork/price-service-sdk": "*", - "@types/ws": "^8.5.3", - "axios": "=1.1.0", - "axios-retry": "~3.3.0", - "isomorphic-ws": "^4.0.1", - "ts-log": "^2.2.4", - "ws": "^8.6.0" - } - }, - "node_modules/@pythnetwork/price-service-client/node_modules/@types/ws": { - "version": "8.5.5", - "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.5.tgz", - "integrity": "sha512-lwhs8hktwxSjf9UaZ9tG5M03PGogvFaH8gUgLNbN9HKIg0dvv6q+gkSuJ8HN4/VbyxkuLzCjlN7GquQ0gUJfIg==", - "dependencies": { - "@types/node": "*" - } - }, - "node_modules/@pythnetwork/price-service-client/node_modules/axios": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.1.0.tgz", - "integrity": "sha512-hsJgcqz4JY7f+HZ4cWTrPZ6tZNCNFPTRx1MjRqu/hbpgpHdSCUpLVuplc+jE/h7dOvyANtw/ERA3HC2Rz/QoMg==", - "dependencies": { - "follow-redirects": "^1.15.0", - "form-data": "^4.0.0", - "proxy-from-env": "^1.1.0" - } - }, - "node_modules/@pythnetwork/price-service-client/node_modules/ws": { - "version": "8.13.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz", - "integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==", - "engines": { - "node": ">=10.0.0" - }, - "peerDependencies": { - "bufferutil": "^4.0.1", - "utf-8-validate": ">=5.0.2" - }, - "peerDependenciesMeta": { - "bufferutil": { - "optional": true - }, - "utf-8-validate": { - "optional": true - } - } - }, - "node_modules/@pythnetwork/price-service-sdk": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@pythnetwork/price-service-sdk/-/price-service-sdk-1.3.0.tgz", - "integrity": "sha512-MCHKBh/oa/ACBcOgHSv/rCoc0KP2ul1/dKNEWs9jkbXeUUOGmim62tgjv7vYRIodktG+uN9T41rIN03mIJWzvg==" - }, - "node_modules/@pythnetwork/pyth-aptos-js": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@pythnetwork/pyth-aptos-js/-/pyth-aptos-js-1.2.0.tgz", - "integrity": "sha512-hGLrcQdNxIZb5yNpJZTwdqP9yNdDx4trrMvGjqFqRq16VqXWwWocgWl9DqgHtnoqy2xZuBP+jio8fGjYgdyfhg==", - "dependencies": { - "@pythnetwork/price-service-client": "*", - "aptos": "^1.3.14", - "buffer": "^6.0.3" - } - }, - "node_modules/@pythnetwork/pyth-aptos-js/node_modules/buffer": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", - "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "dependencies": { - "base64-js": "^1.3.1", - "ieee754": "^1.2.1" - } - }, - "node_modules/@pythnetwork/pyth-aptos-js/node_modules/ieee754": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", - "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, "node_modules/@scure/base": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.1.tgz", @@ -1290,17 +1146,6 @@ "@scure/base": "~1.1.0" } }, - "node_modules/@sindresorhus/is": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.6.0.tgz", - "integrity": "sha512-t09vSN3MdfsyCHoFcTRCH/iUtG7OJ0CsjzB8cjAmKc/va/kIgeDI/TxsigdncE/4be734m0cvIYwNaV4i2XqAw==", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sindresorhus/is?sponsor=1" - } - }, "node_modules/@solana/buffer-layout": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/@solana/buffer-layout/-/buffer-layout-4.0.1.tgz", @@ -1597,11 +1442,6 @@ "node": ">=4.2.0" } }, - "node_modules/@suchipi/femver": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@suchipi/femver/-/femver-1.0.0.tgz", - "integrity": "sha512-bprE8+K5V+DPX7q2e2K57ImqNBdfGHDIWaGI5xHxZoxbKOuQZn4wzPiUxOAHnsUr3w3xHrWXwN7gnG/iIuEMIg==" - }, "node_modules/@supercharge/promise-pool": { "version": "2.3.2", "resolved": "https://registry.npmjs.org/@supercharge/promise-pool/-/promise-pool-2.3.2.tgz", @@ -1610,17 +1450,6 @@ "node": ">=8" } }, - "node_modules/@szmarczak/http-timer": { - "version": "4.0.6", - "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-4.0.6.tgz", - "integrity": "sha512-4BAffykYOgO+5nzBWYwE3W90sBgLJoUPRWWcL8wlyiM8IB8ipJz3UMJ9KXQd1RKQXpKp8Tutn80HZtWsu2u76w==", - "dependencies": { - "defer-to-connect": "^2.0.0" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/@tsconfig/node10": { "version": "1.0.9", "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz", @@ -1663,17 +1492,6 @@ "@types/node": "*" } }, - "node_modules/@types/cacheable-request": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/@types/cacheable-request/-/cacheable-request-6.0.3.tgz", - "integrity": "sha512-IQ3EbTzGxIigb1I3qPZc1rWJnH0BmSKv5QYTalEwweFvyBDLSAe24zP0le/hyi7ecGfZVlIVAg4BZqb8WBwKqw==", - "dependencies": { - "@types/http-cache-semantics": "*", - "@types/keyv": "^3.1.4", - "@types/node": "*", - "@types/responselike": "^1.0.0" - } - }, "node_modules/@types/connect": { "version": "3.4.35", "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.35.tgz", @@ -1682,32 +1500,11 @@ "@types/node": "*" } }, - "node_modules/@types/http-cache-semantics": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/@types/http-cache-semantics/-/http-cache-semantics-4.0.1.tgz", - "integrity": "sha512-SZs7ekbP8CN0txVG2xVRH6EgKmEm31BOxA07vkFaETzZz1xh+cbt8BcI0slpymvwhx5dlFnQG2rTlPVQn+iRPQ==" - }, - "node_modules/@types/keyv": { - "version": "3.1.4", - "resolved": "https://registry.npmjs.org/@types/keyv/-/keyv-3.1.4.tgz", - "integrity": "sha512-BQ5aZNSCpj7D6K2ksrRCTmKRLEpnPvWDiLPfoGyhZ++8YtiK9d/3DBKPJgry359X/P1PfruyYwvnvwFjuEiEIg==", - "dependencies": { - "@types/node": "*" - } - }, "node_modules/@types/node": { "version": "18.11.18", "resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.18.tgz", "integrity": "sha512-DHQpWGjyQKSHj3ebjFI/wRKcqQcdR+MoFBygntYOZytCqNfkd2ZC4ARDJ2DQqhjH5p85Nnd3jhUJIXrszFX/JA==" }, - "node_modules/@types/responselike": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@types/responselike/-/responselike-1.0.0.tgz", - "integrity": "sha512-85Y2BjiufFzaMIlvJDvTTB8Fxl2xfLo4HgmHzVBz08w4wDePCTjYw66PdrolO0kzli3yam/YCgRufyo1DdQVTA==", - "dependencies": { - "@types/node": "*" - } - }, "node_modules/@types/retry": { "version": "0.12.2", "resolved": "https://registry.npmjs.org/@types/retry/-/retry-0.12.2.tgz", @@ -1757,131 +1554,6 @@ "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-3.0.0.tgz", "integrity": "sha512-H7wUZRn8WpTq9jocdxQ2c8x2sKo9ZVmzfRE13GiNJXfp7NcKYEdvl3vspKjXox6RIG2VtaRe4JFvxG4rqp2Zuw==" }, - "node_modules/aftermath-sdk": { - "version": "0.0.156", - "resolved": "https://registry.npmjs.org/aftermath-sdk/-/aftermath-sdk-0.0.156.tgz", - "integrity": "sha512-hkKEuGY6Tw9k+LHfuPmb7rmcmpBSGX/9f8NDyaf3Qdbny8g0547i20ZxfSI5qVC0lHw9nTT5GBphGeNXbAd/GA==", - "dependencies": { - "@mysten/sui.js": "^0.28.0", - "@pythnetwork/pyth-aptos-js": "^1.0.0", - "dayjs": "^1.11.7", - "deep-copy-ts": "^0.5.4" - } - }, - "node_modules/aftermath-sdk/node_modules/@mysten/bcs": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/@mysten/bcs/-/bcs-0.6.0.tgz", - "integrity": "sha512-kw5GVjtonq7+CU8M2E2N3ndvWhSltDsMzXjy6WECAib1kr+FL9wn7dTmsw84QQjRslspKt1BGhNb+/CpLZp1cQ==", - "dependencies": { - "bs58": "^5.0.0" - } - }, - "node_modules/aftermath-sdk/node_modules/@mysten/sui.js": { - "version": "0.28.0", - "resolved": "https://registry.npmjs.org/@mysten/sui.js/-/sui.js-0.28.0.tgz", - "integrity": "sha512-JYqsmwBvYcyi7SXME3hlPbY0AfJvoxpoUXJqOFQB+olIAqpXUOfYp5ARTSKsA8X847JuH/1Ol5jh2uaG41MjdA==", - "dependencies": { - "@mysten/bcs": "0.6.0", - "@noble/hashes": "^1.1.5", - "@noble/secp256k1": "^1.7.0", - "@scure/bip32": "^1.1.1", - "@scure/bip39": "^1.1.0", - "@suchipi/femver": "^1.0.0", - "bs58": "^5.0.0", - "cross-fetch": "^3.1.5", - "jayson": "^4.0.0", - "js-sha3": "^0.8.0", - "rpc-websockets": "^7.5.0", - "superstruct": "^1.0.3", - "tweetnacl": "^1.0.3" - }, - "engines": { - "node": ">=16" - } - }, - "node_modules/aftermath-sdk/node_modules/@noble/hashes": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.1.tgz", - "integrity": "sha512-EbqwksQwz9xDRGfDST86whPBgM65E0OH/pCgqW0GBVzO22bNE+NuIbeTb714+IfSjU3aRk47EUvXIb5bTsenKA==", - "engines": { - "node": ">= 16" - }, - "funding": { - "url": "https://paulmillr.com/funding/" - } - }, - "node_modules/aftermath-sdk/node_modules/@scure/bip32": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.3.1.tgz", - "integrity": "sha512-osvveYtyzdEVbt3OfwwXFr4P2iVBL5u1Q3q4ONBfDY/UpOuXmOlbgwc1xECEboY8wIays8Yt6onaWMUdUbfl0A==", - "dependencies": { - "@noble/curves": "~1.1.0", - "@noble/hashes": "~1.3.1", - "@scure/base": "~1.1.0" - }, - "funding": { - "url": "https://paulmillr.com/funding/" - } - }, - "node_modules/aftermath-sdk/node_modules/@types/node": { - "version": "12.20.55", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.55.tgz", - "integrity": "sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==" - }, - "node_modules/aftermath-sdk/node_modules/base-x": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/base-x/-/base-x-4.0.0.tgz", - "integrity": "sha512-FuwxlW4H5kh37X/oW59pwTzzTKRzfrrQwhmyspRM7swOEZcHtDZSCt45U6oKgtuFE+WYPblePMVIPR4RZrh/hw==" - }, - "node_modules/aftermath-sdk/node_modules/bs58": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/bs58/-/bs58-5.0.0.tgz", - "integrity": "sha512-r+ihvQJvahgYT50JD05dyJNKlmmSlMoOGwn1lCcEzanPglg7TxYjioQUYehQ9mAR/+hOSd2jRc/Z2y5UxBymvQ==", - "dependencies": { - "base-x": "^4.0.0" - } - }, - "node_modules/aftermath-sdk/node_modules/jayson": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/jayson/-/jayson-4.1.0.tgz", - "integrity": "sha512-R6JlbyLN53Mjku329XoRT2zJAE6ZgOQ8f91ucYdMCD4nkGCF9kZSrcGXpHIU4jeKj58zUZke2p+cdQchU7Ly7A==", - "dependencies": { - "@types/connect": "^3.4.33", - "@types/node": "^12.12.54", - "@types/ws": "^7.4.4", - "commander": "^2.20.3", - "delay": "^5.0.0", - "es6-promisify": "^5.0.0", - "eyes": "^0.1.8", - "isomorphic-ws": "^4.0.1", - "json-stringify-safe": "^5.0.1", - "JSONStream": "^1.3.5", - "uuid": "^8.3.2", - "ws": "^7.4.5" - }, - "bin": { - "jayson": "bin/jayson.js" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/aftermath-sdk/node_modules/superstruct": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/superstruct/-/superstruct-1.0.3.tgz", - "integrity": "sha512-8iTn3oSS8nRGn+C2pgXSKPI3jmpm6FExNazNpjvqS6ZUJQCej3PUXEKM8NjHBOs54ExM+LPW/FBRhymrdcCiSg==", - "engines": { - "node": ">=14.0.0" - } - }, - "node_modules/aftermath-sdk/node_modules/uuid": { - "version": "8.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", - "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", - "bin": { - "uuid": "dist/bin/uuid" - } - }, "node_modules/agentkeepalive": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.2.1.tgz", @@ -1935,38 +1607,6 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, - "node_modules/aptos": { - "version": "1.16.0", - "resolved": "https://registry.npmjs.org/aptos/-/aptos-1.16.0.tgz", - "integrity": "sha512-6VUeIFryLGz2bTSs1dIDRbuDsirbCV9hbJK+wBIcpQrl+iz9Zp7MlIAnIPqzYe8jURzAwOM/nZ796gEomBdNIw==", - "dependencies": { - "@aptos-labs/aptos-client": "^0.0.2", - "@noble/hashes": "1.1.3", - "@scure/bip39": "1.1.0", - "eventemitter3": "^5.0.1", - "form-data": "4.0.0", - "tweetnacl": "1.0.3" - }, - "engines": { - "node": ">=11.0.0" - } - }, - "node_modules/aptos/node_modules/@noble/hashes": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.1.3.tgz", - "integrity": "sha512-CE0FCR57H2acVI5UOzIGSSIYxZ6v/HOhDR0Ro9VLyhnzLwx0o8W1mmgaqlEUx4049qJDlIBRztv5k+MM8vbO3A==", - "funding": [ - { - "type": "individual", - "url": "https://paulmillr.com/funding/" - } - ] - }, - "node_modules/aptos/node_modules/eventemitter3": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.1.tgz", - "integrity": "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==" - }, "node_modules/arg": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", @@ -2043,15 +1683,6 @@ "form-data": "^4.0.0" } }, - "node_modules/axios-retry": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/axios-retry/-/axios-retry-3.3.1.tgz", - "integrity": "sha512-RohAUQTDxBSWLFEnoIG/6bvmy8l3TfpkclgStjl5MDCMBDgapAWCmr1r/9harQfWC8bzLC8job6UcL1A1Yc+/Q==", - "dependencies": { - "@babel/runtime": "^7.15.4", - "is-retry-allowed": "^2.2.0" - } - }, "node_modules/balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", @@ -2222,31 +1853,6 @@ "node": ">=6.14.2" } }, - "node_modules/cacheable-lookup": { - "version": "5.0.4", - "resolved": "https://registry.npmjs.org/cacheable-lookup/-/cacheable-lookup-5.0.4.tgz", - "integrity": "sha512-2/kNscPhpcxrOigMZzbiWF7dz8ilhb/nIHU3EyZiXWXpeq/au8qJ8VhdftMkty3n7Gj6HIGalQG8oiBNB3AJgA==", - "engines": { - "node": ">=10.6.0" - } - }, - "node_modules/cacheable-request": { - "version": "7.0.4", - "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-7.0.4.tgz", - "integrity": "sha512-v+p6ongsrp0yTGbJXjgxPow2+DL93DASP4kXCDKb8/bwRtt9OEF3whggkkDkGNzgcWy2XaF4a8nZglC7uElscg==", - "dependencies": { - "clone-response": "^1.0.2", - "get-stream": "^5.1.0", - "http-cache-semantics": "^4.0.0", - "keyv": "^4.0.0", - "lowercase-keys": "^2.0.0", - "normalize-url": "^6.0.1", - "responselike": "^2.0.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/call-bind": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", @@ -2292,17 +1898,6 @@ "url": "https://github.com/chalk/chalk?sponsor=1" } }, - "node_modules/clone-response": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/clone-response/-/clone-response-1.0.3.tgz", - "integrity": "sha512-ROoL94jJH2dUVML2Y/5PEDNaSHgeOdSDicUyS7izcF63G6sTc/FTjLub4b8Il9S8S0beOfYt0TaA5qvFK+w0wA==", - "dependencies": { - "mimic-response": "^1.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/color-convert": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", @@ -2390,11 +1985,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/dayjs": { - "version": "1.11.9", - "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.9.tgz", - "integrity": "sha512-QvzAURSbQ0pKdIye2txOzNaHmxtUBXerpY0FJsFXUMKbIZeFm5ht1LS/jFsrncjnmtv8HsG0W2g6c0zUjZWmpA==" - }, "node_modules/debug": { "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", @@ -2411,50 +2001,12 @@ } } }, - "node_modules/decompress-response": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz", - "integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==", - "dependencies": { - "mimic-response": "^3.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/decompress-response/node_modules/mimic-response": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz", - "integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/deep-copy-ts": { - "version": "0.5.4", - "resolved": "https://registry.npmjs.org/deep-copy-ts/-/deep-copy-ts-0.5.4.tgz", - "integrity": "sha512-YJbPjw0YqdosorpCsa6copy1p/gJsFT9Q6Zq0tLi7D0nXh6Y/usjeIQZfkzV3HVuqY0Hl/5gM7TwgIbIWvEjlA==" - }, "node_modules/deep-is": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", "dev": true }, - "node_modules/defer-to-connect": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-2.0.1.tgz", - "integrity": "sha512-4tvttepXG1VaYGrRibk5EwJd1t4udunSOVMdLSAL6mId1ix438oPwPZMALY41FCijukO1L0twNcGsdzS7dHgDg==", - "engines": { - "node": ">=10" - } - }, "node_modules/delay": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/delay/-/delay-5.0.0.tgz", @@ -2539,14 +2091,6 @@ "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" }, - "node_modules/end-of-stream": { - "version": "1.4.4", - "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", - "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", - "dependencies": { - "once": "^1.4.0" - } - }, "node_modules/es6-promise": { "version": "4.2.8", "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", @@ -3018,20 +2562,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/get-stream": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", - "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", - "dependencies": { - "pump": "^3.0.0" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/glob": { "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", @@ -3089,30 +2619,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/got": { - "version": "11.8.6", - "resolved": "https://registry.npmjs.org/got/-/got-11.8.6.tgz", - "integrity": "sha512-6tfZ91bOr7bOXnK7PRDCGBLa1H4U080YHNaAQ2KsMGlLEzRbk44nsZF2E1IeRc3vtJHPVbKCYgdFbaGO2ljd8g==", - "dependencies": { - "@sindresorhus/is": "^4.0.0", - "@szmarczak/http-timer": "^4.0.5", - "@types/cacheable-request": "^6.0.1", - "@types/responselike": "^1.0.0", - "cacheable-lookup": "^5.0.3", - "cacheable-request": "^7.0.2", - "decompress-response": "^6.0.0", - "http2-wrapper": "^1.0.0-beta.5.2", - "lowercase-keys": "^2.0.0", - "p-cancelable": "^2.0.0", - "responselike": "^2.0.0" - }, - "engines": { - "node": ">=10.19.0" - }, - "funding": { - "url": "https://github.com/sindresorhus/got?sponsor=1" - } - }, "node_modules/graceful-fs": { "version": "4.2.10", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", @@ -3256,25 +2762,8 @@ "engines": { "node": ">=6.0.0" }, - "optionalDependencies": { - "unix-dgram": "2.x" - } - }, - "node_modules/http-cache-semantics": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.1.tgz", - "integrity": "sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ==" - }, - "node_modules/http2-wrapper": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/http2-wrapper/-/http2-wrapper-1.0.3.tgz", - "integrity": "sha512-V+23sDMr12Wnz7iTcDeJr3O6AIxlnvT/bmaAAAP/Xda35C90p9599p0F1eHR/N1KILWSoWVAiOMFjBBXaXSMxg==", - "dependencies": { - "quick-lru": "^5.1.1", - "resolve-alpn": "^1.0.0" - }, - "engines": { - "node": ">=10.19.0" + "optionalDependencies": { + "unix-dgram": "2.x" } }, "node_modules/humanize-ms": { @@ -3429,17 +2918,6 @@ "node": ">=8" } }, - "node_modules/is-retry-allowed": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/is-retry-allowed/-/is-retry-allowed-2.2.0.tgz", - "integrity": "sha512-XVm7LOeLpTW4jV19QSH38vkswxoLud8sQ57YwJVTPWdiaI9I8keEhGFpBlslyVsgdQy4Opg8QOLb8YRgsyZiQg==", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/is-typed-array": { "version": "1.1.10", "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.10.tgz", @@ -3583,11 +3061,6 @@ "bignumber.js": "^9.0.0" } }, - "node_modules/json-buffer": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", - "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==" - }, "node_modules/json-schema-traverse": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", @@ -3651,14 +3124,6 @@ "resolved": "https://registry.npmjs.org/just-performance/-/just-performance-4.3.0.tgz", "integrity": "sha512-L7RjvtJsL0QO8xFs5wEoDDzzJwoiowRw6Rn/GnvldlchS2JQr9wFYPiwZcDfrbbujEKqKN0tvENdbjXdYhDp5Q==" }, - "node_modules/keyv": { - "version": "4.5.3", - "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.3.tgz", - "integrity": "sha512-QCiSav9WaX1PgETJ+SpNnx2PRRapJ/oRSXM4VO5OGYGSjrxbKPVFVhB3l2OCbLCk329N8qyAtsJjSjvVBWzEug==", - "dependencies": { - "json-buffer": "3.0.1" - } - }, "node_modules/levn": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", @@ -3714,14 +3179,6 @@ "tslib": "^2.0.3" } }, - "node_modules/lowercase-keys": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz", - "integrity": "sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==", - "engines": { - "node": ">=8" - } - }, "node_modules/lunr": { "version": "2.3.9", "resolved": "https://registry.npmjs.org/lunr/-/lunr-2.3.9.tgz", @@ -3765,14 +3222,6 @@ "node": ">= 0.6" } }, - "node_modules/mimic-response": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", - "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==", - "engines": { - "node": ">=4" - } - }, "node_modules/minimalistic-assert": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", @@ -3865,17 +3314,6 @@ "node-gyp-build-test": "build-test.js" } }, - "node_modules/normalize-url": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-6.1.0.tgz", - "integrity": "sha512-DlL+XwOy3NxAQ8xuC0okPgK46iuVNAK01YN7RueYBqqFeGsBjV9XmCAzAdgt+667bCl5kPh9EqKKDwnaPG1I7A==", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", @@ -3901,14 +3339,6 @@ "node": ">= 0.8.0" } }, - "node_modules/p-cancelable": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-2.1.1.tgz", - "integrity": "sha512-BZOr3nRQHOntUjTrH8+Lh54smKHoHyur8We1V8DSMVrl5A2malOOwuJRnKRDjSnkoeBh4at6BwEnb5I7Jl31wg==", - "engines": { - "node": ">=8" - } - }, "node_modules/p-limit": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", @@ -4006,20 +3436,6 @@ "node": ">=0.4.0" } }, - "node_modules/proxy-from-env": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", - "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" - }, - "node_modules/pump": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", - "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", - "dependencies": { - "end-of-stream": "^1.1.0", - "once": "^1.3.1" - } - }, "node_modules/punycode": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz", @@ -4054,17 +3470,6 @@ } ] }, - "node_modules/quick-lru": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-5.1.1.tgz", - "integrity": "sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA==", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/rechoir": { "version": "0.6.2", "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", @@ -4111,11 +3516,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/resolve-alpn": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/resolve-alpn/-/resolve-alpn-1.2.1.tgz", - "integrity": "sha512-0a1F4l73/ZFZOakJnQ3FvkJ2+gSTQWz/r2KE5OdDY0TxPm5h4GkqkWWfM47T7HsbnOtcJVEF4epCVy6u7Q3K+g==" - }, "node_modules/resolve-from": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", @@ -4125,17 +3525,6 @@ "node": ">=4" } }, - "node_modules/responselike": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/responselike/-/responselike-2.0.1.tgz", - "integrity": "sha512-4gl03wn3hj1HP3yzgdI7d3lCkF95F21Pz4BPGvKHinyQzALR5CapwC8yIi0Rh58DEMQ/SguC03wFj2k0M/mHhw==", - "dependencies": { - "lowercase-keys": "^2.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/reusify": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", @@ -4442,11 +3831,6 @@ "node": ">=14.0.0" } }, - "node_modules/ts-log": { - "version": "2.2.5", - "resolved": "https://registry.npmjs.org/ts-log/-/ts-log-2.2.5.tgz", - "integrity": "sha512-PGcnJoTBnVGy6yYNFxWVNkdcAuAMstvutN9MgDJIV6L0oG8fB+ZNNy1T+wJzah8RPGor1mZuPQkVfXNDpy9eHA==" - }, "node_modules/ts-node": { "version": "10.9.1", "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz", @@ -4495,11 +3879,6 @@ "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.1.tgz", "integrity": "sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==" }, - "node_modules/tweetnacl": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-1.0.3.tgz", - "integrity": "sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw==" - }, "node_modules/type-check": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", @@ -4797,15 +4176,6 @@ } }, "dependencies": { - "@aptos-labs/aptos-client": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/@aptos-labs/aptos-client/-/aptos-client-0.0.2.tgz", - "integrity": "sha512-FgKZb5zDPz8MmAcVxXzYhxP6OkzuIPoDRJp48YJ8+vrZ9EOZ35HaWGN2M3u+GPdnFE9mODFqkxw3azh3kHGZjQ==", - "requires": { - "axios": "0.27.2", - "got": "^11.0.0" - } - }, "@babel/runtime": { "version": "7.20.7", "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.20.7.tgz", @@ -5381,21 +4751,6 @@ } } }, - "@noble/curves": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.1.0.tgz", - "integrity": "sha512-091oBExgENk/kGj3AZmtBDMpxQPDtxQABR2B9lb1JbVTs6ytdzZNwvhxQ4MWasRNEzlbEH8jCWFCwhF/Obj5AA==", - "requires": { - "@noble/hashes": "1.3.1" - }, - "dependencies": { - "@noble/hashes": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.1.tgz", - "integrity": "sha512-EbqwksQwz9xDRGfDST86whPBgM65E0OH/pCgqW0GBVzO22bNE+NuIbeTb714+IfSjU3aRk47EUvXIb5bTsenKA==" - } - } - }, "@noble/ed25519": { "version": "1.7.1", "resolved": "https://registry.npmjs.org/@noble/ed25519/-/ed25519-1.7.1.tgz", @@ -5511,77 +4866,6 @@ "buffer": "^6.0.1" } }, - "@pythnetwork/price-service-client": { - "version": "1.6.1", - "resolved": "https://registry.npmjs.org/@pythnetwork/price-service-client/-/price-service-client-1.6.1.tgz", - "integrity": "sha512-2Hrk/ZN7aSxajptCELrc6yc55fe1biEK8e/wujJIQJgPiw2CnnkyfUuGydgzaFdPUzkkOMN55C2kFN3+FUsjEQ==", - "requires": { - "@pythnetwork/price-service-sdk": "*", - "@types/ws": "^8.5.3", - "axios": "=1.1.0", - "axios-retry": "~3.3.0", - "isomorphic-ws": "^4.0.1", - "ts-log": "^2.2.4", - "ws": "^8.6.0" - }, - "dependencies": { - "@types/ws": { - "version": "8.5.5", - "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.5.tgz", - "integrity": "sha512-lwhs8hktwxSjf9UaZ9tG5M03PGogvFaH8gUgLNbN9HKIg0dvv6q+gkSuJ8HN4/VbyxkuLzCjlN7GquQ0gUJfIg==", - "requires": { - "@types/node": "*" - } - }, - "axios": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.1.0.tgz", - "integrity": "sha512-hsJgcqz4JY7f+HZ4cWTrPZ6tZNCNFPTRx1MjRqu/hbpgpHdSCUpLVuplc+jE/h7dOvyANtw/ERA3HC2Rz/QoMg==", - "requires": { - "follow-redirects": "^1.15.0", - "form-data": "^4.0.0", - "proxy-from-env": "^1.1.0" - } - }, - "ws": { - "version": "8.13.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz", - "integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==", - "requires": {} - } - } - }, - "@pythnetwork/price-service-sdk": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@pythnetwork/price-service-sdk/-/price-service-sdk-1.3.0.tgz", - "integrity": "sha512-MCHKBh/oa/ACBcOgHSv/rCoc0KP2ul1/dKNEWs9jkbXeUUOGmim62tgjv7vYRIodktG+uN9T41rIN03mIJWzvg==" - }, - "@pythnetwork/pyth-aptos-js": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@pythnetwork/pyth-aptos-js/-/pyth-aptos-js-1.2.0.tgz", - "integrity": "sha512-hGLrcQdNxIZb5yNpJZTwdqP9yNdDx4trrMvGjqFqRq16VqXWwWocgWl9DqgHtnoqy2xZuBP+jio8fGjYgdyfhg==", - "requires": { - "@pythnetwork/price-service-client": "*", - "aptos": "^1.3.14", - "buffer": "^6.0.3" - }, - "dependencies": { - "buffer": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", - "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", - "requires": { - "base64-js": "^1.3.1", - "ieee754": "^1.2.1" - } - }, - "ieee754": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", - "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==" - } - } - }, "@scure/base": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.1.tgz", @@ -5613,11 +4897,6 @@ "@scure/base": "~1.1.0" } }, - "@sindresorhus/is": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.6.0.tgz", - "integrity": "sha512-t09vSN3MdfsyCHoFcTRCH/iUtG7OJ0CsjzB8cjAmKc/va/kIgeDI/TxsigdncE/4be734m0cvIYwNaV4i2XqAw==" - }, "@solana/buffer-layout": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/@solana/buffer-layout/-/buffer-layout-4.0.1.tgz", @@ -5805,24 +5084,11 @@ } } }, - "@suchipi/femver": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@suchipi/femver/-/femver-1.0.0.tgz", - "integrity": "sha512-bprE8+K5V+DPX7q2e2K57ImqNBdfGHDIWaGI5xHxZoxbKOuQZn4wzPiUxOAHnsUr3w3xHrWXwN7gnG/iIuEMIg==" - }, "@supercharge/promise-pool": { "version": "2.3.2", "resolved": "https://registry.npmjs.org/@supercharge/promise-pool/-/promise-pool-2.3.2.tgz", "integrity": "sha512-f5+C7zv+QQivcUO1FH5lXi7GcuJ3CFuJF3Eg06iArhUs5ma0szCLEQwIY4+VQyh7m/RLVZdzvr4E4ZDnLe9MNg==" }, - "@szmarczak/http-timer": { - "version": "4.0.6", - "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-4.0.6.tgz", - "integrity": "sha512-4BAffykYOgO+5nzBWYwE3W90sBgLJoUPRWWcL8wlyiM8IB8ipJz3UMJ9KXQd1RKQXpKp8Tutn80HZtWsu2u76w==", - "requires": { - "defer-to-connect": "^2.0.0" - } - }, "@tsconfig/node10": { "version": "1.0.9", "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz", @@ -5865,17 +5131,6 @@ "@types/node": "*" } }, - "@types/cacheable-request": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/@types/cacheable-request/-/cacheable-request-6.0.3.tgz", - "integrity": "sha512-IQ3EbTzGxIigb1I3qPZc1rWJnH0BmSKv5QYTalEwweFvyBDLSAe24zP0le/hyi7ecGfZVlIVAg4BZqb8WBwKqw==", - "requires": { - "@types/http-cache-semantics": "*", - "@types/keyv": "^3.1.4", - "@types/node": "*", - "@types/responselike": "^1.0.0" - } - }, "@types/connect": { "version": "3.4.35", "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.35.tgz", @@ -5884,32 +5139,11 @@ "@types/node": "*" } }, - "@types/http-cache-semantics": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/@types/http-cache-semantics/-/http-cache-semantics-4.0.1.tgz", - "integrity": "sha512-SZs7ekbP8CN0txVG2xVRH6EgKmEm31BOxA07vkFaETzZz1xh+cbt8BcI0slpymvwhx5dlFnQG2rTlPVQn+iRPQ==" - }, - "@types/keyv": { - "version": "3.1.4", - "resolved": "https://registry.npmjs.org/@types/keyv/-/keyv-3.1.4.tgz", - "integrity": "sha512-BQ5aZNSCpj7D6K2ksrRCTmKRLEpnPvWDiLPfoGyhZ++8YtiK9d/3DBKPJgry359X/P1PfruyYwvnvwFjuEiEIg==", - "requires": { - "@types/node": "*" - } - }, "@types/node": { "version": "18.11.18", "resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.18.tgz", "integrity": "sha512-DHQpWGjyQKSHj3ebjFI/wRKcqQcdR+MoFBygntYOZytCqNfkd2ZC4ARDJ2DQqhjH5p85Nnd3jhUJIXrszFX/JA==" }, - "@types/responselike": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@types/responselike/-/responselike-1.0.0.tgz", - "integrity": "sha512-85Y2BjiufFzaMIlvJDvTTB8Fxl2xfLo4HgmHzVBz08w4wDePCTjYw66PdrolO0kzli3yam/YCgRufyo1DdQVTA==", - "requires": { - "@types/node": "*" - } - }, "@types/retry": { "version": "0.12.2", "resolved": "https://registry.npmjs.org/@types/retry/-/retry-0.12.2.tgz", @@ -5948,109 +5182,6 @@ "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-3.0.0.tgz", "integrity": "sha512-H7wUZRn8WpTq9jocdxQ2c8x2sKo9ZVmzfRE13GiNJXfp7NcKYEdvl3vspKjXox6RIG2VtaRe4JFvxG4rqp2Zuw==" }, - "aftermath-sdk": { - "version": "0.0.156", - "resolved": "https://registry.npmjs.org/aftermath-sdk/-/aftermath-sdk-0.0.156.tgz", - "integrity": "sha512-hkKEuGY6Tw9k+LHfuPmb7rmcmpBSGX/9f8NDyaf3Qdbny8g0547i20ZxfSI5qVC0lHw9nTT5GBphGeNXbAd/GA==", - "requires": { - "@mysten/sui.js": "^0.28.0", - "@pythnetwork/pyth-aptos-js": "^1.0.0", - "dayjs": "^1.11.7", - "deep-copy-ts": "^0.5.4" - }, - "dependencies": { - "@mysten/bcs": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/@mysten/bcs/-/bcs-0.6.0.tgz", - "integrity": "sha512-kw5GVjtonq7+CU8M2E2N3ndvWhSltDsMzXjy6WECAib1kr+FL9wn7dTmsw84QQjRslspKt1BGhNb+/CpLZp1cQ==", - "requires": { - "bs58": "^5.0.0" - } - }, - "@mysten/sui.js": { - "version": "0.28.0", - "resolved": "https://registry.npmjs.org/@mysten/sui.js/-/sui.js-0.28.0.tgz", - "integrity": "sha512-JYqsmwBvYcyi7SXME3hlPbY0AfJvoxpoUXJqOFQB+olIAqpXUOfYp5ARTSKsA8X847JuH/1Ol5jh2uaG41MjdA==", - "requires": { - "@mysten/bcs": "0.6.0", - "@noble/hashes": "^1.1.5", - "@noble/secp256k1": "^1.7.0", - "@scure/bip32": "^1.1.1", - "@scure/bip39": "^1.1.0", - "@suchipi/femver": "^1.0.0", - "bs58": "^5.0.0", - "cross-fetch": "^3.1.5", - "jayson": "^4.0.0", - "js-sha3": "^0.8.0", - "rpc-websockets": "^7.5.0", - "superstruct": "^1.0.3", - "tweetnacl": "^1.0.3" - } - }, - "@noble/hashes": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.1.tgz", - "integrity": "sha512-EbqwksQwz9xDRGfDST86whPBgM65E0OH/pCgqW0GBVzO22bNE+NuIbeTb714+IfSjU3aRk47EUvXIb5bTsenKA==" - }, - "@scure/bip32": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.3.1.tgz", - "integrity": "sha512-osvveYtyzdEVbt3OfwwXFr4P2iVBL5u1Q3q4ONBfDY/UpOuXmOlbgwc1xECEboY8wIays8Yt6onaWMUdUbfl0A==", - "requires": { - "@noble/curves": "~1.1.0", - "@noble/hashes": "~1.3.1", - "@scure/base": "~1.1.0" - } - }, - "@types/node": { - "version": "12.20.55", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.55.tgz", - "integrity": "sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==" - }, - "base-x": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/base-x/-/base-x-4.0.0.tgz", - "integrity": "sha512-FuwxlW4H5kh37X/oW59pwTzzTKRzfrrQwhmyspRM7swOEZcHtDZSCt45U6oKgtuFE+WYPblePMVIPR4RZrh/hw==" - }, - "bs58": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/bs58/-/bs58-5.0.0.tgz", - "integrity": "sha512-r+ihvQJvahgYT50JD05dyJNKlmmSlMoOGwn1lCcEzanPglg7TxYjioQUYehQ9mAR/+hOSd2jRc/Z2y5UxBymvQ==", - "requires": { - "base-x": "^4.0.0" - } - }, - "jayson": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/jayson/-/jayson-4.1.0.tgz", - "integrity": "sha512-R6JlbyLN53Mjku329XoRT2zJAE6ZgOQ8f91ucYdMCD4nkGCF9kZSrcGXpHIU4jeKj58zUZke2p+cdQchU7Ly7A==", - "requires": { - "@types/connect": "^3.4.33", - "@types/node": "^12.12.54", - "@types/ws": "^7.4.4", - "commander": "^2.20.3", - "delay": "^5.0.0", - "es6-promisify": "^5.0.0", - "eyes": "^0.1.8", - "isomorphic-ws": "^4.0.1", - "json-stringify-safe": "^5.0.1", - "JSONStream": "^1.3.5", - "uuid": "^8.3.2", - "ws": "^7.4.5" - } - }, - "superstruct": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/superstruct/-/superstruct-1.0.3.tgz", - "integrity": "sha512-8iTn3oSS8nRGn+C2pgXSKPI3jmpm6FExNazNpjvqS6ZUJQCej3PUXEKM8NjHBOs54ExM+LPW/FBRhymrdcCiSg==" - }, - "uuid": { - "version": "8.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", - "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==" - } - } - }, "agentkeepalive": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.2.1.tgz", @@ -6088,31 +5219,6 @@ "color-convert": "^2.0.1" } }, - "aptos": { - "version": "1.16.0", - "resolved": "https://registry.npmjs.org/aptos/-/aptos-1.16.0.tgz", - "integrity": "sha512-6VUeIFryLGz2bTSs1dIDRbuDsirbCV9hbJK+wBIcpQrl+iz9Zp7MlIAnIPqzYe8jURzAwOM/nZ796gEomBdNIw==", - "requires": { - "@aptos-labs/aptos-client": "^0.0.2", - "@noble/hashes": "1.1.3", - "@scure/bip39": "1.1.0", - "eventemitter3": "^5.0.1", - "form-data": "4.0.0", - "tweetnacl": "1.0.3" - }, - "dependencies": { - "@noble/hashes": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.1.3.tgz", - "integrity": "sha512-CE0FCR57H2acVI5UOzIGSSIYxZ6v/HOhDR0Ro9VLyhnzLwx0o8W1mmgaqlEUx4049qJDlIBRztv5k+MM8vbO3A==" - }, - "eventemitter3": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.1.tgz", - "integrity": "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==" - } - } - }, "arg": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", @@ -6179,15 +5285,6 @@ "form-data": "^4.0.0" } }, - "axios-retry": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/axios-retry/-/axios-retry-3.3.1.tgz", - "integrity": "sha512-RohAUQTDxBSWLFEnoIG/6bvmy8l3TfpkclgStjl5MDCMBDgapAWCmr1r/9harQfWC8bzLC8job6UcL1A1Yc+/Q==", - "requires": { - "@babel/runtime": "^7.15.4", - "is-retry-allowed": "^2.2.0" - } - }, "balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", @@ -6304,25 +5401,6 @@ "node-gyp-build": "^4.3.0" } }, - "cacheable-lookup": { - "version": "5.0.4", - "resolved": "https://registry.npmjs.org/cacheable-lookup/-/cacheable-lookup-5.0.4.tgz", - "integrity": "sha512-2/kNscPhpcxrOigMZzbiWF7dz8ilhb/nIHU3EyZiXWXpeq/au8qJ8VhdftMkty3n7Gj6HIGalQG8oiBNB3AJgA==" - }, - "cacheable-request": { - "version": "7.0.4", - "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-7.0.4.tgz", - "integrity": "sha512-v+p6ongsrp0yTGbJXjgxPow2+DL93DASP4kXCDKb8/bwRtt9OEF3whggkkDkGNzgcWy2XaF4a8nZglC7uElscg==", - "requires": { - "clone-response": "^1.0.2", - "get-stream": "^5.1.0", - "http-cache-semantics": "^4.0.0", - "keyv": "^4.0.0", - "lowercase-keys": "^2.0.0", - "normalize-url": "^6.0.1", - "responselike": "^2.0.0" - } - }, "call-bind": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", @@ -6353,14 +5431,6 @@ "supports-color": "^7.1.0" } }, - "clone-response": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/clone-response/-/clone-response-1.0.3.tgz", - "integrity": "sha512-ROoL94jJH2dUVML2Y/5PEDNaSHgeOdSDicUyS7izcF63G6sTc/FTjLub4b8Il9S8S0beOfYt0TaA5qvFK+w0wA==", - "requires": { - "mimic-response": "^1.0.0" - } - }, "color-convert": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", @@ -6430,11 +5500,6 @@ "resolved": "https://registry.npmjs.org/crypto-hash/-/crypto-hash-1.3.0.tgz", "integrity": "sha512-lyAZ0EMyjDkVvz8WOeVnuCPvKVBXcMv1l5SVqO1yC7PzTwrD/pPje/BIRbWhMoPe436U+Y2nD7f5bFx0kt+Sbg==" }, - "dayjs": { - "version": "1.11.9", - "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.9.tgz", - "integrity": "sha512-QvzAURSbQ0pKdIye2txOzNaHmxtUBXerpY0FJsFXUMKbIZeFm5ht1LS/jFsrncjnmtv8HsG0W2g6c0zUjZWmpA==" - }, "debug": { "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", @@ -6443,37 +5508,12 @@ "ms": "2.1.2" } }, - "decompress-response": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz", - "integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==", - "requires": { - "mimic-response": "^3.1.0" - }, - "dependencies": { - "mimic-response": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz", - "integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==" - } - } - }, - "deep-copy-ts": { - "version": "0.5.4", - "resolved": "https://registry.npmjs.org/deep-copy-ts/-/deep-copy-ts-0.5.4.tgz", - "integrity": "sha512-YJbPjw0YqdosorpCsa6copy1p/gJsFT9Q6Zq0tLi7D0nXh6Y/usjeIQZfkzV3HVuqY0Hl/5gM7TwgIbIWvEjlA==" - }, "deep-is": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", "dev": true }, - "defer-to-connect": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-2.0.1.tgz", - "integrity": "sha512-4tvttepXG1VaYGrRibk5EwJd1t4udunSOVMdLSAL6mId1ix438oPwPZMALY41FCijukO1L0twNcGsdzS7dHgDg==" - }, "delay": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/delay/-/delay-5.0.0.tgz", @@ -6539,14 +5579,6 @@ } } }, - "end-of-stream": { - "version": "1.4.4", - "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", - "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", - "requires": { - "once": "^1.4.0" - } - }, "es6-promise": { "version": "4.2.8", "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", @@ -6902,14 +5934,6 @@ "has-symbols": "^1.0.3" } }, - "get-stream": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", - "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", - "requires": { - "pump": "^3.0.0" - } - }, "glob": { "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", @@ -6949,24 +5973,6 @@ "get-intrinsic": "^1.1.3" } }, - "got": { - "version": "11.8.6", - "resolved": "https://registry.npmjs.org/got/-/got-11.8.6.tgz", - "integrity": "sha512-6tfZ91bOr7bOXnK7PRDCGBLa1H4U080YHNaAQ2KsMGlLEzRbk44nsZF2E1IeRc3vtJHPVbKCYgdFbaGO2ljd8g==", - "requires": { - "@sindresorhus/is": "^4.0.0", - "@szmarczak/http-timer": "^4.0.5", - "@types/cacheable-request": "^6.0.1", - "@types/responselike": "^1.0.0", - "cacheable-lookup": "^5.0.3", - "cacheable-request": "^7.0.2", - "decompress-response": "^6.0.0", - "http2-wrapper": "^1.0.0-beta.5.2", - "lowercase-keys": "^2.0.0", - "p-cancelable": "^2.0.0", - "responselike": "^2.0.0" - } - }, "graceful-fs": { "version": "4.2.10", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", @@ -7078,20 +6084,6 @@ "unix-dgram": "2.x" } }, - "http-cache-semantics": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.1.tgz", - "integrity": "sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ==" - }, - "http2-wrapper": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/http2-wrapper/-/http2-wrapper-1.0.3.tgz", - "integrity": "sha512-V+23sDMr12Wnz7iTcDeJr3O6AIxlnvT/bmaAAAP/Xda35C90p9599p0F1eHR/N1KILWSoWVAiOMFjBBXaXSMxg==", - "requires": { - "quick-lru": "^5.1.1", - "resolve-alpn": "^1.0.0" - } - }, "humanize-ms": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz", @@ -7199,11 +6191,6 @@ "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", "dev": true }, - "is-retry-allowed": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/is-retry-allowed/-/is-retry-allowed-2.2.0.tgz", - "integrity": "sha512-XVm7LOeLpTW4jV19QSH38vkswxoLud8sQ57YwJVTPWdiaI9I8keEhGFpBlslyVsgdQy4Opg8QOLb8YRgsyZiQg==" - }, "is-typed-array": { "version": "1.1.10", "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.10.tgz", @@ -7322,11 +6309,6 @@ "bignumber.js": "^9.0.0" } }, - "json-buffer": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", - "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==" - }, "json-schema-traverse": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", @@ -7379,14 +6361,6 @@ "resolved": "https://registry.npmjs.org/just-performance/-/just-performance-4.3.0.tgz", "integrity": "sha512-L7RjvtJsL0QO8xFs5wEoDDzzJwoiowRw6Rn/GnvldlchS2JQr9wFYPiwZcDfrbbujEKqKN0tvENdbjXdYhDp5Q==" }, - "keyv": { - "version": "4.5.3", - "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.3.tgz", - "integrity": "sha512-QCiSav9WaX1PgETJ+SpNnx2PRRapJ/oRSXM4VO5OGYGSjrxbKPVFVhB3l2OCbLCk329N8qyAtsJjSjvVBWzEug==", - "requires": { - "json-buffer": "3.0.1" - } - }, "levn": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", @@ -7433,11 +6407,6 @@ "tslib": "^2.0.3" } }, - "lowercase-keys": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz", - "integrity": "sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==" - }, "lunr": { "version": "2.3.9", "resolved": "https://registry.npmjs.org/lunr/-/lunr-2.3.9.tgz", @@ -7469,11 +6438,6 @@ "mime-db": "1.52.0" } }, - "mimic-response": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", - "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==" - }, "minimalistic-assert": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", @@ -7544,11 +6508,6 @@ "integrity": "sha512-2iGbaQBV+ITgCz76ZEjmhUKAKVf7xfY1sRl4UiKQspfZMH2h06SyhNsnSVy50cwkFQDGLyif6m/6uFXHkOZ6rg==", "optional": true }, - "normalize-url": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-6.1.0.tgz", - "integrity": "sha512-DlL+XwOy3NxAQ8xuC0okPgK46iuVNAK01YN7RueYBqqFeGsBjV9XmCAzAdgt+667bCl5kPh9EqKKDwnaPG1I7A==" - }, "once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", @@ -7571,11 +6530,6 @@ "word-wrap": "^1.2.3" } }, - "p-cancelable": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-2.1.1.tgz", - "integrity": "sha512-BZOr3nRQHOntUjTrH8+Lh54smKHoHyur8We1V8DSMVrl5A2malOOwuJRnKRDjSnkoeBh4at6BwEnb5I7Jl31wg==" - }, "p-limit": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", @@ -7643,20 +6597,6 @@ "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", "peer": true }, - "proxy-from-env": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", - "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" - }, - "pump": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", - "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", - "requires": { - "end-of-stream": "^1.1.0", - "once": "^1.3.1" - } - }, "punycode": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz", @@ -7673,11 +6613,6 @@ "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", "dev": true }, - "quick-lru": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-5.1.1.tgz", - "integrity": "sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA==" - }, "rechoir": { "version": "0.6.2", "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", @@ -7709,25 +6644,12 @@ "supports-preserve-symlinks-flag": "^1.0.0" } }, - "resolve-alpn": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/resolve-alpn/-/resolve-alpn-1.2.1.tgz", - "integrity": "sha512-0a1F4l73/ZFZOakJnQ3FvkJ2+gSTQWz/r2KE5OdDY0TxPm5h4GkqkWWfM47T7HsbnOtcJVEF4epCVy6u7Q3K+g==" - }, "resolve-from": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", "dev": true }, - "responselike": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/responselike/-/responselike-2.0.1.tgz", - "integrity": "sha512-4gl03wn3hj1HP3yzgdI7d3lCkF95F21Pz4BPGvKHinyQzALR5CapwC8yIi0Rh58DEMQ/SguC03wFj2k0M/mHhw==", - "requires": { - "lowercase-keys": "^2.0.0" - } - }, "reusify": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", @@ -7939,11 +6861,6 @@ "resolved": "https://registry.npmjs.org/ts-custom-error/-/ts-custom-error-3.3.1.tgz", "integrity": "sha512-5OX1tzOjxWEgsr/YEUWSuPrQ00deKLh6D7OTWcvNHm12/7QPyRh8SYpyWvA4IZv8H/+GQWQEh/kwo95Q9OVW1A==" }, - "ts-log": { - "version": "2.2.5", - "resolved": "https://registry.npmjs.org/ts-log/-/ts-log-2.2.5.tgz", - "integrity": "sha512-PGcnJoTBnVGy6yYNFxWVNkdcAuAMstvutN9MgDJIV6L0oG8fB+ZNNy1T+wJzah8RPGor1mZuPQkVfXNDpy9eHA==" - }, "ts-node": { "version": "10.9.1", "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz", @@ -7970,11 +6887,6 @@ "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.1.tgz", "integrity": "sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==" }, - "tweetnacl": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-1.0.3.tgz", - "integrity": "sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw==" - }, "type-check": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", From 1205067b71e0c7a062c75b32092acbd06589006b Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Thu, 3 Aug 2023 19:04:36 +0100 Subject: [PATCH 0657/1974] add chronos v2 --- projects/chronos-v2/index.js | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 projects/chronos-v2/index.js diff --git a/projects/chronos-v2/index.js b/projects/chronos-v2/index.js new file mode 100644 index 00000000000..6d1c771b80c --- /dev/null +++ b/projects/chronos-v2/index.js @@ -0,0 +1,8 @@ +const { uniV3Export } = require("../helper/uniswapV3"); + +module.exports = uniV3Export({ + arbitrum: { + factory: "0x4Db9D624F67E00dbF8ef7AE0e0e8eE54aF1dee49", + fromBlock: 114041129, + }, +}); From bb53ae9641ac43dfc0db25b85685f8834e2c7409 Mon Sep 17 00:00:00 2001 From: Michalis Kargakis Date: Thu, 3 Aug 2023 21:22:19 +0200 Subject: [PATCH 0658/1974] Track X2Y2 v3 contract --- projects/x2y2/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/x2y2/index.js b/projects/x2y2/index.js index d87ce2aea0d..c2cd6d6135c 100644 --- a/projects/x2y2/index.js +++ b/projects/x2y2/index.js @@ -9,9 +9,10 @@ const X2Y2_staking = "0xb329e39ebefd16f40d38f07643652ce17ca5bac1"; // Lending vaults const XY3_v1 = "0xC28F7Ee92Cd6619e8eEC6A70923079fBAFb86196"; const XY3_v2 = "0xFa4D5258804D7723eb6A934c11b1bd423bC31623" +const XY3_v3 = "0xB81965DdFdDA3923f292a47A1be83ba3A36B5133" async function tvl(timestamp, block, chainBlocks, { api }) { - return sumTokens2({ api, owners: [XY3_v1, XY3_v2], resolveNFTs: true}) + return sumTokens2({ api, owners: [XY3_v1, XY3_v2, XY3_v3], resolveNFTs: true}) } module.exports = { From b201a58e00a3257d766df757e51a887d60a2c52d Mon Sep 17 00:00:00 2001 From: Michalis Kargakis Date: Thu, 3 Aug 2023 21:33:58 +0200 Subject: [PATCH 0659/1974] Document Drops pools --- projects/drops/index.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/projects/drops/index.js b/projects/drops/index.js index 409bd05a7d5..77a541b8197 100644 --- a/projects/drops/index.js +++ b/projects/drops/index.js @@ -11,11 +11,17 @@ const tokensAddress = { }; const UniControllers = [ - ["0x7312a3bc8733b068989ef44bac6344f07cfcde7f", '0x05231980914B702083B9Ac08002325654F6eb95B',], + // Pool 0 ["0x79b56CB219901DBF42bB5951a0eDF27465F96206", '0x4aE7413182849D062B72518928a4b2DE87F0e411',], + // Pool 1 ["0xB70FB69a522ed8D4613C4C720F91F93a836EE2f5", '0xD72929e284E8bc2f7458A6302bE961B91bccB339',], + // Pool 2 ["0x9dEb56b9DD04822924B90ad15d01EE50415f8bC7", '0x0a1EF7feD1B691253F9367daf682BA08A9D2fD9C',], + // Pool 3 + ["0x7312a3bc8733b068989ef44bac6344f07cfcde7f", '0x05231980914B702083B9Ac08002325654F6eb95B',], + // Pool 4 ["0x3903E6EcD8bc610D5a01061B1Dc31affD21F81C6", '0x588C13e685e44B22DC6647937481C816E5FeE086',], + // Pool 5 ["0x896b8019f5ea3caaAb23cDA0A09B405ed8361E8b", '0x777ECcD3fCf4FfA3b12f45a384852608DF2619a0',], ].map(([comptroller, cether]) => ({ ethereum: compoundExports2({ comptroller, cether, blacklistedTokens: [tokensAddress.drop] }) })) From 921f121c0a850432e114b5c5e8d8bfdb0d32eb58 Mon Sep 17 00:00:00 2001 From: Michalis Kargakis Date: Thu, 3 Aug 2023 21:58:24 +0200 Subject: [PATCH 0660/1974] Add Immutable X OMI hallmark --- projects/immutablex/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/immutablex/index.js b/projects/immutablex/index.js index b13c4128c7c..24af90d83a2 100644 --- a/projects/immutablex/index.js +++ b/projects/immutablex/index.js @@ -14,4 +14,7 @@ const tokens = [ module.exports = { ethereum: { tvl: sumTokensExport({ owners, tokens }) }, + hallmarks: [ + [1643241600, "OMI migration"], + ], }; From 77817a254a3c77c91cba4d6fdbe5b860d0a93165 Mon Sep 17 00:00:00 2001 From: Andrew Date: Fri, 4 Aug 2023 10:50:59 +0800 Subject: [PATCH 0661/1974] Add f(x) Protocol TVL --- projects/fx-Protocol/index.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 projects/fx-Protocol/index.js diff --git a/projects/fx-Protocol/index.js b/projects/fx-Protocol/index.js new file mode 100644 index 00000000000..63bf76d99c3 --- /dev/null +++ b/projects/fx-Protocol/index.js @@ -0,0 +1,27 @@ +const sdk = require("@defillama/sdk"); +const { default: BigNumber } = require("bignumber.js"); + +const stETHTreasury = "0x0e5CAA5c889Bdf053c9A76395f62267E653AFbb0"; +const stETH = "0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84"; + +async function tvl(timestamp, block, _, { api }) { + let balances = {}; + const totalSupply = ( + await sdk.api.abi.call({ + target: stETH, + block, + abi: "erc20:balanceOf", + chain: "ethereum", + params: stETHTreasury, + }) + ).output; + sdk.util.sumSingleBalance(balances, stETH, totalSupply); + return balances; +} + +module.exports = { + doublecounted: true, + ethereum: { + tvl, + }, +}; From b24d098419f766a365271e3cf1eee2f1bc5a6291 Mon Sep 17 00:00:00 2001 From: happywomwom-wombat <129473631+happywomwom-wombat@users.noreply.github.com> Date: Fri, 4 Aug 2023 11:57:54 +0800 Subject: [PATCH 0662/1974] add ethereum config (#6) --- projects/wombat-exchange/config.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/projects/wombat-exchange/config.js b/projects/wombat-exchange/config.js index 4704bcfa092..72f607c2b15 100644 --- a/projects/wombat-exchange/config.js +++ b/projects/wombat-exchange/config.js @@ -26,7 +26,7 @@ module.exports = { ankrETH: "0x1b507b97c89eDE3E40d1b2Ed92972197c6276D35", rbnb: "0x0592083B285aa75B9c8BaD2485C6cCCF93cCC348", SnBNB: "0xF1e604e9A31c3b575f91CF008445B7ce06BF3fef", - USDS: "0x0c735f84BD7EDA8F8176236091AF8068Bb6C41dE" + USDS: "0x0c735f84BD7EDA8F8176236091AF8068Bb6C41dE", }, }, arbitrum: { @@ -49,6 +49,16 @@ module.exports = { fUSD: "0x956454C7BE9318863297309183C79b793D370401", }, }, + ethereum: { + wom: "0xc0B314a8c08637685Fc3daFC477b92028c540CFB", + pools: { + frax: "0x9c02eaf31EFE3FeE36ebE5AEBCa12Ca979dF25cC", + agEUR: "0x0020A8890e723CD94660A5404C4BCCBB91680db6", + frxETH: "0x3161f40EA6c0C4cC8b2433d6D530EF255816E854", + wstETH: "0xF8E32cA46AC28799c8FB7DCe1Ac11A4541160734", + ETHx: "0x647CC8816C2d60A5fF4d1ffeF27a5b3637d5ac81", + }, + }, hallmarks: [ [1662417125, "Liquidity Mining Start"], [1680674400, "Arbitrum Launching"], From 1c9d854871aa4adb1fe3ad6353eec3eb32cbeab6 Mon Sep 17 00:00:00 2001 From: define Date: Fri, 4 Aug 2023 09:50:07 +0100 Subject: [PATCH 0663/1974] fix error tetu --- projects/tetu-pawnshop/index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/projects/tetu-pawnshop/index.js b/projects/tetu-pawnshop/index.js index c99f56f73e0..17b9b4df764 100644 --- a/projects/tetu-pawnshop/index.js +++ b/projects/tetu-pawnshop/index.js @@ -16,7 +16,6 @@ Object.keys(config).forEach(chain => { const tokens = posData.map(pos => ([pos.collateral.collateralToken, pos.acquired.acquiredToken, pos.depositToken])).flat() console.log(tokens) return sumTokens2({ api, owner: shop, tokens, resolveUniV3: true, blacklistedTokens: ['0xc36442b4a4522e871399cd717abdd847ab11fe88']}) - return {} } } }) From ef424f37256094061eb5ba4d277ad22e76305e13 Mon Sep 17 00:00:00 2001 From: happywomwom-wombat <129473631+happywomwom-wombat@users.noreply.github.com> Date: Fri, 4 Aug 2023 16:51:33 +0800 Subject: [PATCH 0664/1974] Feat/ethereum (#7) * add ethereum config * add empty address for veWom * solve confict * correct vewom address --- projects/wombat-exchange/config.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/wombat-exchange/config.js b/projects/wombat-exchange/config.js index 72f607c2b15..8ed95093fdf 100644 --- a/projects/wombat-exchange/config.js +++ b/projects/wombat-exchange/config.js @@ -51,6 +51,7 @@ module.exports = { }, ethereum: { wom: "0xc0B314a8c08637685Fc3daFC477b92028c540CFB", + veWom: "0xEF0B4d9Dba6ea82B59437Fe5E37b16A2896aAF94", pools: { frax: "0x9c02eaf31EFE3FeE36ebE5AEBCa12Ca979dF25cC", agEUR: "0x0020A8890e723CD94660A5404C4BCCBB91680db6", From bf86c732838a69e2ac13c28a6e7f4d3dcf9edccb Mon Sep 17 00:00:00 2001 From: define Date: Fri, 4 Aug 2023 10:43:16 +0100 Subject: [PATCH 0665/1974] adapter zkdx finance --- projects/zkdx-finance/index.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 projects/zkdx-finance/index.js diff --git a/projects/zkdx-finance/index.js b/projects/zkdx-finance/index.js new file mode 100644 index 00000000000..961dda96225 --- /dev/null +++ b/projects/zkdx-finance/index.js @@ -0,0 +1,12 @@ +const { gmxExports } = require("../helper/gmx"); +const { staking } = require("../helper/staking"); + +const zkStaking = "0xA258D1CfeCaDD96C763dfa50284525f1529cfB35"; +const zkZKE = "0x7b3e1236c39ddD2e61cF6Da6ac6D11193238ccB0"; + +module.exports = { + era: { + tvl: gmxExports({ vault: '0xBC918775C20959332c503d51a9251C2405d9cF88' }), + staking: staking(zkStaking, zkZKE, "era"), + }, +}; \ No newline at end of file From 366b64668e7725542c309e173f267cb32ffd4fac Mon Sep 17 00:00:00 2001 From: define Date: Fri, 4 Aug 2023 13:08:46 +0100 Subject: [PATCH 0666/1974] test dackieswap --- projects/dackieswap/index.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/projects/dackieswap/index.js b/projects/dackieswap/index.js index c45139ef1ff..b6505ee57ad 100644 --- a/projects/dackieswap/index.js +++ b/projects/dackieswap/index.js @@ -1,8 +1,5 @@ -const { uniV3Export } = require('../helper/uniswapV3') +const { uniV3Export } = require("../helper/uniswapV3"); module.exports = uniV3Export({ - base: { - factory: '0x3D237AC6D2f425D2E890Cc99198818cc1FA48870', - fromBlock: 1759510, - } -}) \ No newline at end of file + base: { factory: "0x3D237AC6D2f425D2E890Cc99198818cc1FA48870", fromBlock: 2031627, }, +}); \ No newline at end of file From 744c1b66b9c59106365663059487aa91ca24c4c8 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Fri, 4 Aug 2023 19:44:45 +0100 Subject: [PATCH 0667/1974] update methodology --- projects/baseswap/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/baseswap/index.js b/projects/baseswap/index.js index 0080ffa9b8f..975aa6f2c31 100644 --- a/projects/baseswap/index.js +++ b/projects/baseswap/index.js @@ -7,7 +7,7 @@ const dexTVL = getUniTVL({ factory: FACTORY, useDefaultCoreAssets: true, fetchBa module.exports = { misrepresentedTokens: true, - methodology: `Uses factory(${FACTORY}) address and whitelisted tokens address to find and price Liquidity Pool pairs. We also have our native token $ARX staking.`, + methodology: `Uses factory(${FACTORY}) address and whitelisted tokens address to find and price Liquidity Pool pairs. We also have our native token $BSWAP staking.`, base: { tvl: dexTVL, } From 6c694a7b8137edca10ee4caf914b420b6864a7b9 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Sat, 5 Aug 2023 16:05:30 +0100 Subject: [PATCH 0668/1974] add mainnet --- projects/traderjoe-lb-v2-1/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/traderjoe-lb-v2-1/index.js b/projects/traderjoe-lb-v2-1/index.js index 7dda6cb9d53..47c1c48d218 100644 --- a/projects/traderjoe-lb-v2-1/index.js +++ b/projects/traderjoe-lb-v2-1/index.js @@ -5,6 +5,7 @@ const factories = { avax: '0x8e42f2F4101563bF679975178e880FD87d3eFd4e', arbitrum: '0x8e42f2F4101563bF679975178e880FD87d3eFd4e', bsc: '0x8e42f2F4101563bF679975178e880FD87d3eFd4e', + ethereum: '0xDC8d77b69155c7E68A95a4fb0f06a71FF90B943a' } async function tvl(_, _b, _cb, { api, }) { const pools = await api.fetchList({ From 987f7be8cbdcaff770340563c5d91eaf096342b6 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Sat, 5 Aug 2023 17:35:32 +0100 Subject: [PATCH 0669/1974] add usdt --- projects/vertex/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/vertex/index.js b/projects/vertex/index.js index 5aaf3dfc833..be5f71e6af9 100644 --- a/projects/vertex/index.js +++ b/projects/vertex/index.js @@ -16,7 +16,7 @@ module.exports = { arbitrum: { tvl: sumTokensExport({ owners: [config.clearinghouse, config.endpoint], - tokens: [ADDRESSES.arbitrum.WBTC, ADDRESSES.arbitrum.WETH, ADDRESSES.arbitrum.USDC, ADDRESSES.arbitrum.ARB], + tokens: [ADDRESSES.arbitrum.WBTC, ADDRESSES.arbitrum.WETH, ADDRESSES.arbitrum.USDC, ADDRESSES.arbitrum.ARB, ADDRESSES.arbitrum.USDT], }) } } \ No newline at end of file From a370d440a977067d3d651efb811057456f8020f2 Mon Sep 17 00:00:00 2001 From: Cookiedev Date: Sun, 6 Aug 2023 00:06:34 +0200 Subject: [PATCH 0670/1974] added cookiebase --- projects/cookiebase/index.js | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 projects/cookiebase/index.js diff --git a/projects/cookiebase/index.js b/projects/cookiebase/index.js new file mode 100644 index 00000000000..a864a15c24c --- /dev/null +++ b/projects/cookiebase/index.js @@ -0,0 +1,6 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports = { + misrepresentedTokens: true, + base: { tvl: getUniTVL({ factory: '0x05b00D63DbC67874ad44d039213b7DAfB999d184', useDefaultCoreAssets: true, fetchBalances: true, }), }, +} \ No newline at end of file From f00e121169881207d46a1f2db14dbc953c7e589b Mon Sep 17 00:00:00 2001 From: Roman Date: Sun, 6 Aug 2023 14:09:31 +0500 Subject: [PATCH 0671/1974] added base chain for USD+ and DAI+ --- projects/overnight-daiPlus/index.js | 2 ++ projects/overnight-usdPlus/index.js | 2 ++ 2 files changed, 4 insertions(+) diff --git a/projects/overnight-daiPlus/index.js b/projects/overnight-daiPlus/index.js index 8bf8a4b5705..8e6cabc3654 100644 --- a/projects/overnight-daiPlus/index.js +++ b/projects/overnight-daiPlus/index.js @@ -4,11 +4,13 @@ const sdk = require("@defillama/sdk"); const m2m = { optimism: "0x8416d215b71a5C91b04E326140bbbDcDa82C01da", arbitrum: "0xF04124F4226389d1Bf3ad7AcB54da05fF4078c8b", + base: "0x7a62315519A39d562c1E49EB35b300d2E6742f86" } const assets = { optimism: ADDRESSES.optimism.DAI, //DAI arbitrum: ADDRESSES.optimism.DAI, //DAI + base: "0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb" //DAI } const abi = "uint256:totalNetAssets" diff --git a/projects/overnight-usdPlus/index.js b/projects/overnight-usdPlus/index.js index 3bc1210b190..a1e367115e8 100644 --- a/projects/overnight-usdPlus/index.js +++ b/projects/overnight-usdPlus/index.js @@ -7,6 +7,7 @@ const m2m = { optimism: "0x9Af655c4DBe940962F776b685d6700F538B90fcf", arbitrum: "0x9Af655c4DBe940962F776b685d6700F538B90fcf", era: "0x240aad990FFc5F04F11593fF4dCF1fF714d6fc80", + base: "0x1F4947Cd5A5c058DD5EA6Fd1CCd5c311aDa9E6Fb" } const assets = { @@ -15,6 +16,7 @@ const assets = { optimism: ADDRESSES.optimism.USDC, //USDC arbitrum: ADDRESSES.arbitrum.USDC, //USDC era: ADDRESSES.era.USDC, + base: "0xd9aaec86b65d86f6a7b5b1b0c42ffa531710b6ca" //USDC } const abi = "uint256:totalNetAssets" From 0e5660d2791dbc681aa18b00a2fffa896be654a1 Mon Sep 17 00:00:00 2001 From: oxSaturn Date: Sun, 6 Aug 2023 21:48:32 +0800 Subject: [PATCH 0672/1974] add mantle chain for velocimeter --- projects/velocimeter-v2/index.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/projects/velocimeter-v2/index.js b/projects/velocimeter-v2/index.js index 180101696e5..8b973d0e350 100644 --- a/projects/velocimeter-v2/index.js +++ b/projects/velocimeter-v2/index.js @@ -23,4 +23,11 @@ module.exports = { hasStablePools: true, }) }, + mantle: { + tvl: getUniTVL({ + factory: '0x99F9a4A96549342546f9DAE5B2738EDDcD43Bf4C', + useDefaultCoreAssets: true, + hasStablePools: true, + }) + } } From cb06fc49f88cda7741584fd7907c8197977da5ad Mon Sep 17 00:00:00 2001 From: define Date: Sun, 6 Aug 2023 15:28:50 +0100 Subject: [PATCH 0673/1974] add new factory pearlfi --- projects/pearlfi/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/pearlfi/index.js b/projects/pearlfi/index.js index 200be55a86e..d75ee332e05 100644 --- a/projects/pearlfi/index.js +++ b/projects/pearlfi/index.js @@ -5,6 +5,6 @@ module.exports = { misrepresentedTokens: true, methodology: `Uses factory(0xd541Bc203Cc2B85810d9b8E6a534eed1615528E2) address to count liquidity in pools as TVL.`, polygon: { - tvl: getUniTVL({ factory: '0xd541Bc203Cc2B85810d9b8E6a534eed1615528E2', useDefaultCoreAssets: true, hasStablePools: true }), + tvl: getUniTVL({ factory: '0xEaF188cdd22fEEBCb345DCb529Aa18CA9FcB4FBd', useDefaultCoreAssets: true, hasStablePools: true }), } }; \ No newline at end of file From 7b142054ca2362287be223e017759c7bca50ab3c Mon Sep 17 00:00:00 2001 From: tec05 Date: Sun, 6 Aug 2023 17:04:10 -0400 Subject: [PATCH 0674/1974] Add Base TVL (#7039) --- projects/archly-finance/index.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/projects/archly-finance/index.js b/projects/archly-finance/index.js index 42cfa21734e..f7c0b3001d9 100644 --- a/projects/archly-finance/index.js +++ b/projects/archly-finance/index.js @@ -36,6 +36,16 @@ module.exports = { restrictTokenRatio: 100, }) }, + base: { + tvl: getUniTVL({ factory: ARCHLY_FACTORY_OTHER, seDefaultCoreAssets: true, hasStablePools: true, }), + staking: sumTokensExport({ + owner: "0x4c01dF6B9be381BA2a687D0ED5c40039dEEaf0a9", + tokens: [ARCHLY_ARC_TOKEN_OTHER], + lps: ['0x80dd4A2837AF3233176704142Fb44a216e170Ab3'], + coreAssets: [ADDRESSES.base.WETH], + restrictTokenRatio: 100, + }) + }, bsc: { tvl: getUniTVL({ factory: ARCHLY_FACTORY_OTHER, seDefaultCoreAssets: true, hasStablePools: true, }), staking: sumTokensExport({ From 4b4ede0b10a652b4b7b560f4bf0568509a39548c Mon Sep 17 00:00:00 2001 From: Curbis Norris <130688524+curbisn@users.noreply.github.com> Date: Sun, 6 Aug 2023 14:05:11 -0700 Subject: [PATCH 0675/1974] Add new contracts for Dexilla (#7038) * add Dexilla project * Update contract * update timestamp * add optimism chain * add V.4 contracts * add zk contracts * add arbitrum contracts * add base chain * add v.5 contracts --- projects/dexilla/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/dexilla/index.js b/projects/dexilla/index.js index 697f812e448..f58f340d4c0 100644 --- a/projects/dexilla/index.js +++ b/projects/dexilla/index.js @@ -9,6 +9,7 @@ const config = { '0x16412BE389278B81594027E77FF9b61b2d200caa', '0xE0D2833D9ED879D16BfC1cEc3573293770b8abBB', '0x66831746E2F5a3CfC2A6E2b9eB5Ea8b7dd78Ee6A', + '0x795205f3D4C2132532a3a379cFA747c7A5B1aA90', ], }, optimism: { @@ -20,6 +21,7 @@ const config = { '0x2d10b03854e970d3772434FF1133BCb3E59Ca4b8', '0x2BF9D7e4173B882335b464e2fB38f5b57768ab61', '0x44F1C33ED3bf77A5883cBEce1c1b34E71425CE84', + '0x6f1D074bf170fcDDE7712Bb8da4C70C5Be86884A', ], }, arbitrum: { @@ -28,6 +30,7 @@ const config = { '0x8C9DBB80f12D0425eAf127FCC1D92FB21Cb4CE4C', '0x66A724fa0CEB8adfa064afEf5102A2e04E4264c6', '0x5dD2a1C1Fb25E30928C901a28Ceaf53E59B606dD', + '0xb56F90d3038AAD5B5E8de9be3008C7CCEA2D6600', ], }, base:{ From fd18047c278da374d7e990668419ec13ce486e0a Mon Sep 17 00:00:00 2001 From: kexley <87971154+kexleyBeefy@users.noreply.github.com> Date: Sun, 6 Aug 2023 22:05:51 +0100 Subject: [PATCH 0676/1974] Add Beefy Base (#7037) --- projects/beefy/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/beefy/index.js b/projects/beefy/index.js index 45d036bf390..a3ec1b779c4 100644 --- a/projects/beefy/index.js +++ b/projects/beefy/index.js @@ -46,6 +46,7 @@ const chains = { moonriver: 1285, kava: 2222, canto: 7700, + base: 8453, arbitrum: 42161, celo: 42220, oasis: 42262, From 8d986cf35a550fd668afdb1180e830285e256d30 Mon Sep 17 00:00:00 2001 From: TJ <58812386+TJ-2@users.noreply.github.com> Date: Sun, 6 Aug 2023 22:06:31 +0100 Subject: [PATCH 0677/1974] Add Meridian-Finance (#7036) --- projects/meridian/index.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 projects/meridian/index.js diff --git a/projects/meridian/index.js b/projects/meridian/index.js new file mode 100644 index 00000000000..6bfafaf219c --- /dev/null +++ b/projects/meridian/index.js @@ -0,0 +1,28 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const sdk = require("@defillama/sdk"); + +const ETH_ADDRESS = ADDRESSES.null; +const TROVE_MANAGER_ADDRESS = "0x56a901FdF67FC52e7012eb08Cfb47308490A982C"; + +async function tvl(_, chainBlocks) { + const troveEthTvl = ( + await sdk.api.abi.call({ + target: TROVE_MANAGER_ADDRESS, + abi: "uint256:getEntireSystemColl", + block: chainBlocks["base"], + chain: "base" + }) + ).output; + + return { + [ETH_ADDRESS]: troveEthTvl, + }; +} + +module.exports = { + timetravel: true, + start: 1691074571, + base: { + tvl, + } +}; From ec89c35111bc82e472a698b2d61dfbf467ab31c0 Mon Sep 17 00:00:00 2001 From: Viktor <99098789+combased-dev@users.noreply.github.com> Date: Mon, 7 Aug 2023 00:17:50 +0300 Subject: [PATCH 0678/1974] jewelswap-farm-update (#7016) --- projects/jewelswap-lev-farming/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/projects/jewelswap-lev-farming/index.js b/projects/jewelswap-lev-farming/index.js index 4d78f06a9d8..48c4d1acf62 100644 --- a/projects/jewelswap-lev-farming/index.js +++ b/projects/jewelswap-lev-farming/index.js @@ -47,12 +47,14 @@ async function tvl() { case "FARM-9ed1f9": lpToken = "ALP-5f9191"; break; case "FARM-ccefc2": lpToken = "ALP-0fe50a"; break; case "FARM-795466": lpToken = "ALP-afc922"; break; + case "FARM-b637f0": lpToken = "ALP-713ae8"; break; + case "FARM-83c131": lpToken = "ALP-f7dee1"; break; default: lpToken = null; } if (lpToken) api.add(lpToken, nft.balance) }) await oneDexFarm(api) - return sumTokens({ owners: [LENDING_POOL_FARMS], balances: api.getBalances() }) + return sumTokens({ owners: [LENDING_POOL_FARMS], balances: api.getBalances() }) } async function oneDexFarm(api) { From fdb74a2a2b593b273273a6eb1249b1284a768a9a Mon Sep 17 00:00:00 2001 From: define Date: Mon, 7 Aug 2023 10:18:47 +0100 Subject: [PATCH 0679/1974] add something pancake --- projects/pancake-swap/index.js | 3 +++ projects/pancakeswap-v3/index.js | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/projects/pancake-swap/index.js b/projects/pancake-swap/index.js index 6de8621a3d4..4b9acfdb142 100644 --- a/projects/pancake-swap/index.js +++ b/projects/pancake-swap/index.js @@ -97,4 +97,7 @@ module.exports = { era: { tvl: getUniTVL({ factory: '0xd03D8D566183F0086d8D09A84E1e30b58Dd5619d', useDefaultCoreAssets: true, }) }, + arbitrum: { + tvl: getUniTVL({ factory: '0x02a84c1b3BBD7401a5f7fa98a384EBC70bB5749E', useDefaultCoreAssets: true, }) + }, } diff --git a/projects/pancakeswap-v3/index.js b/projects/pancakeswap-v3/index.js index 2e2afab9811..16c47181498 100644 --- a/projects/pancakeswap-v3/index.js +++ b/projects/pancakeswap-v3/index.js @@ -12,5 +12,6 @@ module.exports = uniV3Export({ ethereum: { factory: '0x0bfbcf9fa4f9c56b0f40a671ad40e0805a091865', fromBlock: 16950685, }, polygon_zkevm: { factory: '0x0BFbCF9fa4f9C56B0F40a671Ad40E0805A091865', fromBlock: 750148, }, linea: { factory: '0x0BFbCF9fa4f9C56B0F40a671Ad40E0805A091865', fromBlock: 1445, }, - era: { factory: '0x1BB72E0CbbEA93c08f535fc7856E0338D7F7a8aB', fromBlock: 9413438, } + era: { factory: '0x1BB72E0CbbEA93c08f535fc7856E0338D7F7a8aB', fromBlock: 9413438, }, + arbitrum: {factory: '0x0BFbCF9fa4f9C56B0F40a671Ad40E0805A091865', fromBlock: 101028949} }) From 8dbc78ce7bbff9ce27387dcdf143a66bcee55668 Mon Sep 17 00:00:00 2001 From: daedboi <87483308+daedboi@users.noreply.github.com> Date: Mon, 7 Aug 2023 12:40:48 +0300 Subject: [PATCH 0680/1974] Add new Fantom contract --- projects/morphex-old/index.js | 15 +++++++++++++++ projects/morphex/index.js | 4 ++-- 2 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 projects/morphex-old/index.js diff --git a/projects/morphex-old/index.js b/projects/morphex-old/index.js new file mode 100644 index 00000000000..cb3e5dde3df --- /dev/null +++ b/projects/morphex-old/index.js @@ -0,0 +1,15 @@ +const { staking } = require("../helper/staking"); +const { gmxExports } = require("../helper/gmx"); + +// Fantom (Multichain) +const vaultAddressFantom = "0x3CB54f0eB62C371065D739A34a775CC16f46563e"; +const stakingAddressFantom = "0xa4157E273D88ff16B3d8Df68894e1fd809DbC007"; +const tokenAddressMPXFantom = "0x66eEd5FF1701E6ed8470DC391F05e27B1d0657eb"; + +module.exports = { + methodology: "Morphex liquidity is calculated by the value of tokens in the MLP pool. TVL also includes MPX staked.", + fantom: { + staking: staking(stakingAddressFantom, tokenAddressMPXFantom, "fantom"), + tvl: gmxExports({ vault: vaultAddressFantom }) + } +}; diff --git a/projects/morphex/index.js b/projects/morphex/index.js index bc99181130b..bed29dddf1c 100644 --- a/projects/morphex/index.js +++ b/projects/morphex/index.js @@ -1,8 +1,8 @@ const { staking } = require("../helper/staking"); const { gmxExports } = require("../helper/gmx"); -// Fantom -const vaultAddressFantom = "0x3CB54f0eB62C371065D739A34a775CC16f46563e"; +// Fantom (New MLP with Axelar and LayerZero assets) +const vaultAddressFantom = "0x245cD6d33578de9aF75a3C0c636c726b1A8cbdAa"; const stakingAddressFantom = "0xa4157E273D88ff16B3d8Df68894e1fd809DbC007"; const tokenAddressMPXFantom = "0x66eEd5FF1701E6ed8470DC391F05e27B1d0657eb"; From 6806e8b56abbeb9274989da279f600fa7dc304ac Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 7 Aug 2023 15:24:23 +0530 Subject: [PATCH 0681/1974] Morphex (#7047) * Add BSC for Morphex * Add new Fantom contract * merge listings * minor fix --------- Co-authored-by: daedboi <87483308+daedboi@users.noreply.github.com> --- projects/morphex/index.js | 8 +++++--- projects/tetu-pawnshop/index.js | 1 - 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/projects/morphex/index.js b/projects/morphex/index.js index bc99181130b..2e0276be689 100644 --- a/projects/morphex/index.js +++ b/projects/morphex/index.js @@ -1,10 +1,12 @@ const { staking } = require("../helper/staking"); const { gmxExports } = require("../helper/gmx"); +const sdk = require('@defillama/sdk') -// Fantom -const vaultAddressFantom = "0x3CB54f0eB62C371065D739A34a775CC16f46563e"; +// Fantom (New MLP with Axelar and LayerZero assets) +const vaultAddressFantom = "0x245cD6d33578de9aF75a3C0c636c726b1A8cbdAa"; const stakingAddressFantom = "0xa4157E273D88ff16B3d8Df68894e1fd809DbC007"; const tokenAddressMPXFantom = "0x66eEd5FF1701E6ed8470DC391F05e27B1d0657eb"; +const vaultAddressFantomMultichain = "0x3CB54f0eB62C371065D739A34a775CC16f46563e"; // BNB Chain const vaultAddressBSC = "0x46940Dc651bFe3F2CC3E04cf9dC5579B50Cf0765"; @@ -15,7 +17,7 @@ module.exports = { methodology: "Morphex liquidity is calculated by the value of tokens in the MLP pool. TVL also includes MPX staked.", fantom: { staking: staking(stakingAddressFantom, tokenAddressMPXFantom, "fantom"), - tvl: gmxExports({ vault: vaultAddressFantom }) + tvl: sdk.util.sumChainTvls([gmxExports({ vault: vaultAddressFantom }), gmxExports({ vault: vaultAddressFantomMultichain })]) }, bsc: { staking: staking(stakingAddressBSC, tokenAddressMPXBSC, "bsc"), diff --git a/projects/tetu-pawnshop/index.js b/projects/tetu-pawnshop/index.js index 17b9b4df764..986e7e16298 100644 --- a/projects/tetu-pawnshop/index.js +++ b/projects/tetu-pawnshop/index.js @@ -14,7 +14,6 @@ Object.keys(config).forEach(chain => { const posIds = await api.fetchList({ itemAbi: abi.openPositions, lengthAbi: abi.openPositionsSize, target: shop }) const posData = await api.multiCall({ abi: abi.positions, calls: posIds, target: shop }) const tokens = posData.map(pos => ([pos.collateral.collateralToken, pos.acquired.acquiredToken, pos.depositToken])).flat() - console.log(tokens) return sumTokens2({ api, owner: shop, tokens, resolveUniV3: true, blacklistedTokens: ['0xc36442b4a4522e871399cd717abdd847ab11fe88']}) } } From babc9609aa750bdd4d2bcf22338765e140d11c3d Mon Sep 17 00:00:00 2001 From: Jason Liang Date: Mon, 7 Aug 2023 18:01:41 +0800 Subject: [PATCH 0682/1974] add soswap (#7044) Co-authored-by: earlbtc --- projects/soswap/index.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 projects/soswap/index.js diff --git a/projects/soswap/index.js b/projects/soswap/index.js new file mode 100644 index 00000000000..cfcd1b56dc3 --- /dev/null +++ b/projects/soswap/index.js @@ -0,0 +1,15 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +const FACTORY = "0x539db2B4FE8016DB2594d7CfbeAb4d2B730b723E" + + +const dexTVL = getUniTVL({ factory: FACTORY, useDefaultCoreAssets: true }) + + +module.exports = { + misrepresentedTokens: true, + methodology: `Uses factory(${FACTORY}) address and whitelisted tokens address to find and price Liquidity Pool pairs.`, + base: { + tvl: dexTVL + } +}; \ No newline at end of file From 8f9c7a38f54864ff205ca1c44d38d34607375349 Mon Sep 17 00:00:00 2001 From: TJakubek <39831436+TJakubek@users.noreply.github.com> Date: Mon, 7 Aug 2023 12:02:32 +0200 Subject: [PATCH 0683/1974] fix enosys ethereum-songbird USDT bridge address (#7043) --- projects/enosys-bridge/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/enosys-bridge/index.js b/projects/enosys-bridge/index.js index 2013c011449..d67772ce7ea 100644 --- a/projects/enosys-bridge/index.js +++ b/projects/enosys-bridge/index.js @@ -3,5 +3,5 @@ const ADDRESSES = require('../helper/coreAssets.json') module.exports = { xdc: { tvl: sumTokensExport({ owner: '0xd5308a4bb2d7121a26d0bd11257245f0efda2bc4', tokens: [ADDRESSES.xdc.WXDC] }) }, - ethereum: { tvl: sumTokensExport({ owner: '0xb3902647015c17fc3c2f5ca5f5cb68bbf2d9b1e2', tokens: [ADDRESSES.ethereum.USDT] }) }, + ethereum: { tvl: sumTokensExport({ owner: '0x8936761f2903ed1af2b269e6fa3a79ebb0162c51', tokens: [ADDRESSES.ethereum.USDT] }) }, } \ No newline at end of file From 97550ad81c8898c6a23e6300695d3a8aa4776187 Mon Sep 17 00:00:00 2001 From: define Date: Mon, 7 Aug 2023 11:31:02 +0100 Subject: [PATCH 0684/1974] test echodex v3 --- projects/echodex-v3/index.js | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 projects/echodex-v3/index.js diff --git a/projects/echodex-v3/index.js b/projects/echodex-v3/index.js new file mode 100644 index 00000000000..811562c32d1 --- /dev/null +++ b/projects/echodex-v3/index.js @@ -0,0 +1,5 @@ +const { uniV3Export } = require('../helper/uniswapV3') + +module.exports = uniV3Export({ + linea: { factory: '0x559Fa53Be355835a038aC303A750E8788668636B', fromBlock: 120029, }, +}) \ No newline at end of file From af50a05838ddb2337c68b55d56989c425c30e1d4 Mon Sep 17 00:00:00 2001 From: zhouJF <58616306+jfzhou5@users.noreply.github.com> Date: Mon, 7 Aug 2023 18:40:49 +0800 Subject: [PATCH 0685/1974] feat: add moonbeam TVL (#7040) --- projects/paraspace/helper/address.js | 4 ++++ projects/paraspace/index.js | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/projects/paraspace/helper/address.js b/projects/paraspace/helper/address.js index 5d313c70713..e11bd044695 100644 --- a/projects/paraspace/helper/address.js +++ b/projects/paraspace/helper/address.js @@ -25,4 +25,8 @@ module.exports = { UiPoolDataProvider: "0x451E3288a2dcD91b001cd831dD75109D524578b6", PoolAddressProvider: "0xc11B2F53E119634c8755855e56D323C4F6dfd23d", }, + moonbeam: { + UiPoolDataProvider: "0x8CE5F6F4268A756b6656F576d0F9Cf4fD73CBb52", + PoolAddressProvider: "0x086C77cEc639bEBbfCC0a3467736636c3F755a96", + } }; diff --git a/projects/paraspace/index.js b/projects/paraspace/index.js index 83dfe189914..64d008693b5 100644 --- a/projects/paraspace/index.js +++ b/projects/paraspace/index.js @@ -21,5 +21,9 @@ module.exports = { era: { tvl, borrowed, + }, + moonbeam: { + tvl, + borrowed, } }; From 9880721ffbf6f71e6c3a2e2d9b65b14856b06791 Mon Sep 17 00:00:00 2001 From: Astrarizon <111271396+astrarizon@users.noreply.github.com> Date: Mon, 7 Aug 2023 14:01:46 +0300 Subject: [PATCH 0686/1974] Add PulsarMoney Adapter (#7029) * added adapter for pulsar-money tvl * added owner address * minor fix * minor fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/helper/chain/elrond.js | 5 +++-- projects/pulsar-money/index.js | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 projects/pulsar-money/index.js diff --git a/projects/helper/chain/elrond.js b/projects/helper/chain/elrond.js index c489ccff681..3dfdbdd2185 100644 --- a/projects/helper/chain/elrond.js +++ b/projects/helper/chain/elrond.js @@ -55,7 +55,8 @@ async function getTokens({ address, balances = {}, tokens = [], blacklistedToken return balances } -async function sumTokens({ owners = [], tokens = [], balances = {}, blacklistedTokens = [], tokensAndOwners = [], whitelistedTokens = [] }) { +async function sumTokens({ owner, owners = [], tokens = [], balances = {}, blacklistedTokens = [], tokensAndOwners = [], whitelistedTokens = [] }) { + if (owner) owners.push(owner) if (tokensAndOwners.length) { await Promise.all(tokensAndOwners.map(([token, owner]) => sumTokens({ owners: [owner], tokens: [token], balances, blacklistedTokens, whitelistedTokens, }))) return balances @@ -80,7 +81,7 @@ async function getTokenData(token) { return data } -async function sumTokensExport(...args) { +function sumTokensExport(...args) { return () => sumTokens(...args) } diff --git a/projects/pulsar-money/index.js b/projects/pulsar-money/index.js new file mode 100644 index 00000000000..0f44a6929ac --- /dev/null +++ b/projects/pulsar-money/index.js @@ -0,0 +1,14 @@ +const { sumTokensExport } = require("../helper/chain/elrond"); +const { getCoreAssets } = require('../helper/tokenMapping') + +// const API_URL = "https://pulsar-money-prod.herokuapp.com/metrics/tvl"; + +const vault = 'erd1qqqqqqqqqqqqqpgq39rqpn2xvm0ykl2ccaa4h5zk5c9r647wdteswmap9l' + +module.exports = { + timetravel: false, + elrond: { + tvl: sumTokensExport({ owner: vault, whitelistedTokens: getCoreAssets('elrond')}), + vesting: sumTokensExport({ owner: vault, blacklistedTokens: getCoreAssets('elrond')}), + }, +}; \ No newline at end of file From 49550712ba811e1d6f1ef57245c8b4a6243a83d4 Mon Sep 17 00:00:00 2001 From: Defi-Moses <103143573+Defi-Moses@users.noreply.github.com> Date: Mon, 7 Aug 2023 12:07:43 +0100 Subject: [PATCH 0687/1974] Adding base tvl to the Synapse Adapter (#7027) * adding base tvl * minor fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/synapse/config.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/projects/synapse/config.js b/projects/synapse/config.js index af2ca176fc6..1900b561fa2 100644 --- a/projects/synapse/config.js +++ b/projects/synapse/config.js @@ -415,4 +415,24 @@ module.exports = { ] } }, + base: { + tvl: { + bridge: { + address: '0xf07d1C752fAb503E47FEF309bf14fbDD3E867089', + tokens: [ + // '0xb554A55358fF0382Fb21F0a478C3546d1106Be8c', // nETH + ADDRESSES.null, + ] + }, + pools: [ + { + pool: '0x6223bD82010E2fB69F329933De20897e7a4C225f', + tokens: [ + // "0xb554A55358fF0382Fb21F0a478C3546d1106Be8c", // nETH + "0x4200000000000000000000000000000000000006", //base WETH + ] + }, + ] + } + }, } From d3e409d66d67b109adedafe5a24cca12aeeaeafa Mon Sep 17 00:00:00 2001 From: define Date: Mon, 7 Aug 2023 12:23:55 +0100 Subject: [PATCH 0688/1974] add wemix new address --- projects/wemix-staking/index.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/projects/wemix-staking/index.js b/projects/wemix-staking/index.js index e8ed83adc89..c1f15349fe4 100644 --- a/projects/wemix-staking/index.js +++ b/projects/wemix-staking/index.js @@ -1,11 +1,14 @@ const ADDRESSES = require("../helper/coreAssets.json"); const { staking } = require("../helper/staking"); +const { nullAddress } = require("../helper/unwrapLPs"); const wwemix = ADDRESSES.wemix.WWEMIX; -const stakingContract = "0x6F3f44B0Cf7C751f2a44Faf6bFdd08e499Eb0973"; +const stakingContractDIOS = "0x6F3f44B0Cf7C751f2a44Faf6bFdd08e499Eb0973"; +const stakingContractGRAND = "0xBEd789c6008F788a28fc222C83082D67033Daf7F" + module.exports = { wemix: { - tvl: staking(stakingContract, wwemix), + tvl: staking([stakingContractDIOS, stakingContractGRAND],[wwemix, nullAddress]), }, }; From 94b4a0858e0eee5c0ab30f045d788ab9c6a4a490 Mon Sep 17 00:00:00 2001 From: define Date: Mon, 7 Aug 2023 12:46:34 +0100 Subject: [PATCH 0689/1974] add hallmark to wemix staking --- projects/wemix-staking/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/wemix-staking/index.js b/projects/wemix-staking/index.js index c1f15349fe4..c700b253fc7 100644 --- a/projects/wemix-staking/index.js +++ b/projects/wemix-staking/index.js @@ -8,6 +8,9 @@ const stakingContractGRAND = "0xBEd789c6008F788a28fc222C83082D67033Daf7F" module.exports = { + hallmarks: [ + [1690070405,"WONDER Staking Live"] + ], wemix: { tvl: staking([stakingContractDIOS, stakingContractGRAND],[wwemix, nullAddress]), }, From ce7c76f1c13bf5b3ca2f052df3e58c4ab18ec667 Mon Sep 17 00:00:00 2001 From: "jayden.x" Date: Mon, 7 Aug 2023 20:39:43 +0800 Subject: [PATCH 0690/1974] add synclub-staked-bnb --- projects/synclub-staked-bnb/index.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 projects/synclub-staked-bnb/index.js diff --git a/projects/synclub-staked-bnb/index.js b/projects/synclub-staked-bnb/index.js new file mode 100644 index 00000000000..038d0f559cb --- /dev/null +++ b/projects/synclub-staked-bnb/index.js @@ -0,0 +1,15 @@ +const { nullAddress } = require('../helper/tokenMapping'); +async function bscTvl(timestamp, block, chainBlocks, { api }) { + const bal = await api.call({ abi: 'erc20:totalSupply', target: '0xB0b84D294e0C75A6abe60171b70edEb2EFd14A1B' }) + const tvl = await api.call({ abi: 'function convertSnBnbToBnb(uint256 _amountInBnbX) external view returns (uint256)', target: '0x1adB950d8bB3dA4bE104211D5AB038628e477fE6' , params:[bal]}) + return { + ['bsc:' + nullAddress]: tvl + }; +} + +module.exports = { + methodology: 'We aggregated the assets staked across synclub staking protocols', + bsc: { + tvl: bscTvl + } +} From c96eddc5544670f0a641bddcd3e3be182275dc76 Mon Sep 17 00:00:00 2001 From: FoxyDev42 <92840280+FoxyDev42@users.noreply.github.com> Date: Mon, 7 Aug 2023 18:43:10 +0530 Subject: [PATCH 0691/1974] Update index.js (#7019) --- projects/citrus/index.js | 250 ++++++++++++++++++++++++++------------- 1 file changed, 171 insertions(+), 79 deletions(-) diff --git a/projects/citrus/index.js b/projects/citrus/index.js index 66c4689d55d..4f377e1272c 100644 --- a/projects/citrus/index.js +++ b/projects/citrus/index.js @@ -26,10 +26,10 @@ async function getStats() { // const idl = await getConfig('citrus-idl', 'https://gist.githubusercontent.com/FoxyDev42/5f23cd03eab33e0d73f6f6227912451e/raw/03e68f7543dc4dd399d7b61e15881c1a6792eb4a/citrus-account.json'); const program = new Program(idl, programId, provider) const loans = await program.account.loan.all() - const activeLoans = loans.filter(loan => Object.keys(loan.account.status)[0] === 'active'); + const activeLoans = loans.filter(loan => ['active', 'onSale'].includes(Object.keys(loan.account.status)[0])); const openOffers = loans.filter(loan => Object.keys(loan.account.status)[0] === 'waitingForBorrower'); const activeLoansTotal = activeLoans.map(loan => loan.account.loanTerms.principal).reduce((a, b) => a.add(b)); - const openOffersTotal = openOffers.map(loan => loan.account.loanTerms.principal).reduce((a, b) => a.add(b)); + const openOffersTotal = openOffers.map(loan => loan.account.ltvTerms ? loan.account.ltvTerms.maxOffer : loan.account.loanTerms.principal).reduce((a, b) => a.add(b)); // const activeLoansNFTs = activeLoans.map(loan => loan.account.collectionConfig.toBase58()).reduce((a, b) => a + parseFloat(collectionsById[b]?.floor), 0); // const tvl = openOffersTotal.toNumber() + activeLoansNFTs * 1e9; const tvl = openOffersTotal.toNumber() @@ -61,164 +61,256 @@ const idl = { instructions: [], accounts: [ { - name: 'loan', - type: { - kind: 'struct', - fields: [ + "name": "collectionConfig", + "type": { + "kind": "struct", + "fields": [ { - name: 'bump', - type: 'u8' + "name": "collectionKey", + "type": { + "option": "publicKey" + } }, { - name: 'lender', - type: 'publicKey' + "name": "creators", + "type": { + "option": { + "array": [ + "publicKey", + 3 + ] + } + } }, { - name: 'borrower', - type: 'publicKey' + "name": "merkleRoot", + "type": { + "option": { + "array": [ + "u8", + 32 + ] + } + } }, { - name: 'mint', - type: 'publicKey' + "name": "feeReduction", + "type": { + "option": "u16" + } + } + ] + } + }, + { + "name": "loan", + "type": { + "kind": "struct", + "fields": [ + { + "name": "bump", + "type": "u8" + }, + { + "name": "lender", + "type": "publicKey" + }, + { + "name": "borrower", + "type": "publicKey" }, { - name: 'collectionConfig', - type: 'publicKey' + "name": "mint", + "type": "publicKey" }, { - name: 'status', - type: { - defined: 'LoanStatus' + "name": "collectionConfig", + "type": "publicKey" + }, + { + "name": "status", + "type": { + "defined": "LoanStatus" } }, { - name: 'loanTerms', - type: { - defined: 'LoanTerms' + "name": "loanTerms", + "type": { + "defined": "LoanTerms" } }, { - name: 'creationTime', - type: 'i64' + "name": "creationTime", + "type": "i64" }, { - name: 'startTime', - type: 'i64' + "name": "startTime", + "type": "i64" }, { - name: 'endTime', - type: 'i64' + "name": "endTime", + "type": "i64" }, { - name: 'fox', - type: 'bool' + "name": "fox", + "type": "bool" }, { - name: 'mortgage', - type: 'bool' + "name": "mortgage", + "type": "bool" }, { - name: 'private', - type: 'bool' + "name": "private", + "type": "bool" }, { - name: 'offerType', - type: { - defined: 'OfferType' + "name": "offerType", + "type": { + "defined": "OfferType" } }, { - name: 'listingPrice', - type: 'u64' + "name": "listingPrice", + "type": "u64" }, { - name: 'ltvTerms', - type: { - option: { - defined: 'LtvTerms' + "name": "ltvTerms", + "type": { + "option": { + "defined": "LtvTerms" } } + }, + { + "name": "pool", + "type": "bool" } ] } + }, + { + "name": "borrowAuthority", + "type": { + "kind": "struct", + "fields": [] + } } ], types: [ { - name: 'LoanTerms', - type: { - kind: 'struct', - fields: [ + "name": "LoanTerms", + "type": { + "kind": "struct", + "fields": [ { - name: 'apyBps', - type: 'u64' + "name": "apyBps", + "type": "u64" }, { - name: 'duration', - type: 'u64' + "name": "duration", + "type": "u64" }, { - name: 'principal', - type: 'u64' + "name": "principal", + "type": "u64" } ] } }, { - name: 'LtvTerms', - type: { - kind: 'struct', - fields: [ + "name": "LtvTerms", + "type": { + "kind": "struct", + "fields": [ { - name: 'ltvBps', - type: 'u64' + "name": "ltvBps", + "type": "u64" }, { - name: 'maxOffer', - type: 'u64' + "name": "maxOffer", + "type": "u64" } ] } }, { - name: 'LoanStatus', - type: { - kind: 'enum', - variants: [ + "name": "MerkleData", + "type": { + "kind": "struct", + "fields": [ { - name: 'WaitingForBorrower' + "name": "index", + "type": "u64" }, { - name: 'WaitingForLender' + "name": "proof", + "type": { + "vec": { + "array": [ + "u8", + 32 + ] + } + } + } + ] + } + }, + { + "name": "Cpi", + "type": { + "kind": "struct", + "fields": [ + { + "name": "data", + "type": "bytes" }, { - name: 'Active' + "name": "numAccounts", + "type": "u8" + } + ] + } + }, + { + "name": "LoanStatus", + "type": { + "kind": "enum", + "variants": [ + { + "name": "WaitingForBorrower" }, { - name: 'Repaid' + "name": "WaitingForLender" }, { - name: 'Defaulted' + "name": "Active" }, { - name: 'OnSale' + "name": "Repaid" + }, + { + "name": "Defaulted" + }, + { + "name": "OnSale" } ] } }, { - name: 'OfferType', - type: { - kind: 'enum', - variants: [ + "name": "OfferType", + "type": { + "kind": "enum", + "variants": [ { - name: 'Global' + "name": "Global" }, { - name: 'Mortgage' + "name": "Mortgage" }, { - name: 'Borrow' + "name": "Borrow" } ] } @@ -226,4 +318,4 @@ const idl = { ], events: [], errors: [] -}; \ No newline at end of file +}; From 06205fbd635a5366c19e752ba7063f0c974948aa Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 7 Aug 2023 18:54:00 +0530 Subject: [PATCH 0692/1974] Boobs-fi (#7054) * Add files via upload * minor fix --------- Co-authored-by: xIceyyx <77045488+xIceyyx@users.noreply.github.com> --- projects/boobs-fi/index.js | 10 ++++++++++ projects/helper/utils.js | 1 + 2 files changed, 11 insertions(+) create mode 100644 projects/boobs-fi/index.js diff --git a/projects/boobs-fi/index.js b/projects/boobs-fi/index.js new file mode 100644 index 00000000000..a27808bd614 --- /dev/null +++ b/projects/boobs-fi/index.js @@ -0,0 +1,10 @@ +const { masterchefExports } = require("../helper/unknownTokens"); + +module.exports = masterchefExports({ + chain: "base", + masterchef: "0xF40E05313592008Def7B7e247fbe1177aE902c5A", + nativeTokens: ["0x66b70221b22925c4663C46cd15f2f2EaaC822CEB"], + useDefaultCoreAssets: true, + poolInfoABI: "function poolInfo(uint256) view returns (address)", + getToken: (i) => i, +}); \ No newline at end of file diff --git a/projects/helper/utils.js b/projects/helper/utils.js index b97c5129d20..ecd89033f10 100644 --- a/projects/helper/utils.js +++ b/projects/helper/utils.js @@ -62,6 +62,7 @@ function isLP(symbol, token, chain) { if (chain === 'ethpow' && ['LFG_LP'].includes(symbol)) return true if (chain === 'aurora' && ['wLP'].includes(symbol)) return true if (chain === 'oasis' && ['LPT'].includes(symbol)) return true + if (chain === 'base' && ['RCKT-V2'].includes(symbol)) return true if (chain === 'wan' && ['WSLP'].includes(symbol)) return true if (chain === 'polygon' && ['MbtLP'].includes(symbol)) return true if (chain === 'ethereum' && ['SUDO-LP'].includes(symbol)) return false From 44802f927cf6168222b20a125f21196ebea9530c Mon Sep 17 00:00:00 2001 From: 0xtekgrinder <72015889+0xtekgrinder@users.noreply.github.com> Date: Mon, 7 Aug 2023 15:24:44 +0200 Subject: [PATCH 0693/1974] Add Paladin Dullahan (#7053) * feat: add paladin dullahan * feat: update methodology for paladin-dullahan * minor fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/paladinfinance-dullahan/index.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 projects/paladinfinance-dullahan/index.js diff --git a/projects/paladinfinance-dullahan/index.js b/projects/paladinfinance-dullahan/index.js new file mode 100644 index 00000000000..ccaed4a4f9d --- /dev/null +++ b/projects/paladinfinance-dullahan/index.js @@ -0,0 +1,16 @@ +const ADDRESSES = require('../helper/coreAssets.json'); + +const DULLAHAN_VAULT = "0x167c606be99DBf5A8aF61E1983E5B309e8FA2Ae7"; + +async function tvl(timestamp, block, _, { api },) { + api.add(ADDRESSES.ethereum.AAVE, await api.call({ target: DULLAHAN_VAULT, abi: 'uint256:totalAssets' })); +} + +module.exports = { + doublecounted: true, + methodology: "Amount of stkAAVE owned by the vault", + ethereum: { + tvl, + }, + start: 17824291 +}; From dc1bf1cd6d7cfa74fcadef6c5d03c893b2dd280e Mon Sep 17 00:00:00 2001 From: mooncakeater <140960979+mooncakeater@users.noreply.github.com> Date: Mon, 7 Aug 2023 16:27:44 +0300 Subject: [PATCH 0694/1974] Added mooncakefi linea market (#7049) --- projects/mooncakefi/index.js | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 projects/mooncakefi/index.js diff --git a/projects/mooncakefi/index.js b/projects/mooncakefi/index.js new file mode 100644 index 00000000000..e4fb304c1ed --- /dev/null +++ b/projects/mooncakefi/index.js @@ -0,0 +1,7 @@ +const { aaveExports } = require("../helper/aave"); + +module.exports = { + linea: aaveExports("linea", undefined, undefined, [ + "0x593C2d762B1CDe79101D946Ca7816eeaF17Ad744", + ]), +}; From 94bb080d020ad4e8061a6f166ad23bdf8af43781 Mon Sep 17 00:00:00 2001 From: Velocore Dex <128014130+velocore@users.noreply.github.com> Date: Mon, 7 Aug 2023 22:32:13 +0900 Subject: [PATCH 0695/1974] change velocore-v2 addresses (#7001) --- projects/velocore-v2/index.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/projects/velocore-v2/index.js b/projects/velocore-v2/index.js index 70b58a07e58..9ae34206b90 100644 --- a/projects/velocore-v2/index.js +++ b/projects/velocore-v2/index.js @@ -5,17 +5,17 @@ module.exports = { tvl: async (_, _1, _2, { api }) => { const a = await api.call({ abi: "function canonicalPools(address user, uint256 begin, uint256 maxLength) returns (tuple(address gauge, tuple(address pool, string poolType, bytes32[] lpTokens, uint256[] mintedLPTokens, bytes32[] listedTokens, uint256[] reserves, bytes poolParams) poolData, bool killed, uint256 totalVotes, uint256 userVotes, uint256 userClaimable, uint256 emissionRate, uint256 userEmissionRate, uint256 stakedValueInHubToken, uint256 userStakedValueInHubToken, uint256 averageInterestRatePerSecond, uint256 userInterestRatePerSecond, bytes32[] stakeableTokens, uint256[] stakedAmounts, uint256[] userStakedAmounts, bytes32[] underlyingTokens, uint256[] stakedUnderlying, uint256[] userUnderlying, tuple(bytes32[] tokens, uint256[] rates, uint256[] userClaimable, uint256[] userRates)[] bribes)[] gaugeDataArray)", - target: "0x2AB2398303B79884B8eC18A145EBd496145dfeEC", - params: ["0x2AB2398303B79884B8eC18A145EBd496145dfeEC", 0, 1000] + target: "0xaA18cDb16a4DD88a59f4c2f45b5c91d009549e06", + params: ["0xaA18cDb16a4DD88a59f4c2f45b5c91d009549e06", 0, 1000] }); let tokens = a.map(g => g.poolData.listedTokens).flat().map(i => '0x' + i.slice(2 + 24)) return sumTokens2({ owner: "0x1d0188c4B276A09366D05d6Be06aF61a73bC7535", tokens, blacklistedTokens: [ - '0x2441488a43e9F35289564c2c9f8c783F3c6bb596', - '0x226398c89a2BA3C30689939EF9c4984c4a4d314A', + '0xcc22F6AA610D1b2a0e89EF228079cB3e1831b1D1', + '0xAeC06345b26451bdA999d83b361BEaaD6eA93F87', ], api, }) }, }, methodology: "counts tokens in the vault.", -}; \ No newline at end of file +}; From 208c2c14bcbbf53ada94d63557decbcf1786aea5 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 7 Aug 2023 19:47:15 +0530 Subject: [PATCH 0696/1974] Unlockd (#7055) * fix: addresses updated * fix: function variable names * fix: addresses, abis, and code * fix: TVL number was only getting the available liquidity * fix console.log and try catch * code refactor --------- Co-authored-by: fepvenancio --- projects/unlockd/helper/abi/UNFTRegistry.json | 4 ++ .../helper/abi/UiPoolDataProvider.json | 5 ++ projects/unlockd/helper/abi/abi.js | 7 +++ projects/unlockd/helper/address.js | 12 ----- projects/unlockd/helper/addresses.js | 7 +++ projects/unlockd/helper/index.js | 35 ++++++++++++++ projects/unlockd/index.js | 46 +++---------------- 7 files changed, 65 insertions(+), 51 deletions(-) create mode 100644 projects/unlockd/helper/abi/UNFTRegistry.json create mode 100644 projects/unlockd/helper/abi/UiPoolDataProvider.json create mode 100644 projects/unlockd/helper/abi/abi.js delete mode 100644 projects/unlockd/helper/address.js create mode 100644 projects/unlockd/helper/addresses.js create mode 100644 projects/unlockd/helper/index.js diff --git a/projects/unlockd/helper/abi/UNFTRegistry.json b/projects/unlockd/helper/abi/UNFTRegistry.json new file mode 100644 index 00000000000..772fbb9d438 --- /dev/null +++ b/projects/unlockd/helper/abi/UNFTRegistry.json @@ -0,0 +1,4 @@ +{ + "getUNFTAssetList": "function getUNFTAssetList() external view returns (address[] memory)", + "uNftProxys": "function uNftProxys(address) view returns (address)" + } \ No newline at end of file diff --git a/projects/unlockd/helper/abi/UiPoolDataProvider.json b/projects/unlockd/helper/abi/UiPoolDataProvider.json new file mode 100644 index 00000000000..fa1443acf07 --- /dev/null +++ b/projects/unlockd/helper/abi/UiPoolDataProvider.json @@ -0,0 +1,5 @@ +{ + "getSimpleReservesData": "function getSimpleReservesData(address provider) view returns (tuple(address underlyingAsset, string name, string symbol, uint256 decimals, uint256 reserveFactor, bool borrowingEnabled, bool isActive, bool isFrozen, uint128 liquidityIndex, uint128 variableBorrowIndex, uint128 liquidityRate, uint128 variableBorrowRate, uint40 lastUpdateTimestamp, address bTokenAddress, address debtTokenAddress, address interestRateAddress, uint256 availableLiquidity, uint256 totalVariableDebt, uint256 priceInEth, uint256 variableRateSlope1, uint256 variableRateSlope2)[])", + "getSimpleNftsData": "function getSimpleNftsData(address provider) view returns (tuple(address underlyingAsset, string name, string symbol, uint256 ltv, uint256 liquidationThreshold, uint256 liquidationBonus, uint256 redeemDuration, uint256 auctionDuration, uint256 redeemFine, uint256 redeemThreshold, bool isActive, bool isFrozen, address bNftAddress, uint256 priceInEth, uint256 totalCollateral)[])" +} + diff --git a/projects/unlockd/helper/abi/abi.js b/projects/unlockd/helper/abi/abi.js new file mode 100644 index 00000000000..d8ff45774ed --- /dev/null +++ b/projects/unlockd/helper/abi/abi.js @@ -0,0 +1,7 @@ +const UiPoolDataProvider = require("./UiPoolDataProvider.json"); +const UNFTRegistry = require("./UNFTRegistry.json"); + +module.exports = { + UiPoolDataProvider, + UNFTRegistry, +}; diff --git a/projects/unlockd/helper/address.js b/projects/unlockd/helper/address.js deleted file mode 100644 index 66c67ebd2a0..00000000000 --- a/projects/unlockd/helper/address.js +++ /dev/null @@ -1,12 +0,0 @@ -const UiPoolDataProvider = { - ethereum: "0xA7Cb07CD8BC197Fb3623A121FFF854f300a4195c", -}; - -const LendPoolAddressProvider = { - ethereum: "0xE6cd031FB0D9A79FD8CD3035B9228F78ff459B07", -}; - -module.exports = { - UiPoolDataProvider, - LendPoolAddressProvider, -}; diff --git a/projects/unlockd/helper/addresses.js b/projects/unlockd/helper/addresses.js new file mode 100644 index 00000000000..528f167bee5 --- /dev/null +++ b/projects/unlockd/helper/addresses.js @@ -0,0 +1,7 @@ +module.exports = { + ethereum: { + UiPoolDataProvider: "0xD726b93865393fb3B345C66Da3EB5999B5aC4754", + LendPoolAddressProvider: "0xE6cd031FB0D9A79FD8CD3035B9228F78ff459B07", + UNFTRegistry: "0x255f25335662c88Fcc7deC402cADf2f4f0E08300", + }, +}; \ No newline at end of file diff --git a/projects/unlockd/helper/index.js b/projects/unlockd/helper/index.js new file mode 100644 index 00000000000..909a327257a --- /dev/null +++ b/projects/unlockd/helper/index.js @@ -0,0 +1,35 @@ +const abi = require("./abi/abi"); +const address = require("./addresses"); +const { sumTokens2 } = require("../../helper/unwrapLPs") + +async function tvl(chain, timestamp, chainBlocks, { api }) { + const tokens = await api.call({ target: address.ethereum.UNFTRegistry, abi: abi.UNFTRegistry.getUNFTAssetList, }) + const owners = (await api.multiCall({ abi: 'function getUNFTAddresses(address) view returns (address proxy, address impl)', calls: tokens, target: address.ethereum.UNFTRegistry,})).map(i => i.proxy) + + const reservesData = await api.call({ + target: address.ethereum.UiPoolDataProvider, + params: [address.ethereum.LendPoolAddressProvider], + abi: abi.UiPoolDataProvider.getSimpleReservesData + }) + + reservesData.forEach(({ underlyingAsset, availableLiquidity }) => api.add(underlyingAsset, availableLiquidity)) + + return sumTokens2({ api, tokensAndOwners2: [tokens, owners] }); +} + +async function borrowed(chain, timestamp, chainBlocks, { api }) { + const reservesData = await api.call({ + target: address.ethereum.UiPoolDataProvider, + params: [address.ethereum.LendPoolAddressProvider], + abi: abi.UiPoolDataProvider.getSimpleReservesData + }) + + reservesData.forEach(({ underlyingAsset, totalVariableDebt }) => api.add(underlyingAsset, totalVariableDebt)) +} + +module.exports = { + tvl, + borrowed, +}; + + diff --git a/projects/unlockd/index.js b/projects/unlockd/index.js index 9ab6171456e..b6f939f11d6 100644 --- a/projects/unlockd/index.js +++ b/projects/unlockd/index.js @@ -1,41 +1,9 @@ -const sdk = require("@defillama/sdk"); - -const abi = { - getSimpleReservesData: "function getSimpleReservesData(address provider) view returns (tuple(address underlyingAsset, string name, string symbol, uint256 decimals, uint256 reserveFactor, bool borrowingEnabled, bool isActive, bool isFrozen, uint128 liquidityIndex, uint128 variableBorrowIndex, uint128 liquidityRate, uint128 variableBorrowRate, uint40 lastUpdateTimestamp, address uTokenAddress, address debtTokenAddress, address interestRateAddress, uint256 availableLiquidity, uint256 totalVariableDebt, uint256 priceInEth, uint256 variableRateSlope1, uint256 variableRateSlope2)[])", - getSimpleNftsData: "function getSimpleNftsData(address provider) view returns (tuple(address underlyingAsset, string name, string symbol, bool isActive, bool isFrozen, address uNftAddress, uint256 totalCollateral)[])", -} -const address = require("./helper/address"); -const chain = 'ethereum' - -async function tvl(_, _1, _2, { api }) { - const balances = {} - const simpleReservesData = await api.call({ - target: address.UiPoolDataProvider[chain], - params: [address.LendPoolAddressProvider[chain]], - abi: abi.getSimpleReservesData, - }); - simpleReservesData.map(i => sdk.util.sumSingleBalance(balances, i.underlyingAsset, i.availableLiquidity, chain)) - - return balances; -} - -async function borrowed(_, _1, _2, { api }) { - const balances = {} - const simpleReservesData = await api.call({ - target: address.UiPoolDataProvider[chain], - params: [address.LendPoolAddressProvider[chain]], - abi: abi.getSimpleReservesData, - }) - simpleReservesData.map(i => sdk.util.sumSingleBalance(balances, i.underlyingAsset, i.totalVariableDebt, chain)) - - return balances; -} +const { tvl, borrowed } = require("./helper/index.js"); module.exports = { - timetravel: true, - methodology: `Counts the tokens locked in the contracts to be used as collateral to borrow or to earn yield. Borrowed coins are not counted towards the TVL`, - ethereum: { - tvl, - borrowed, - }, -}; + methodology: `Counts the tokens locked in the contracts to be used as collateral to borrow or to earn yield. Borrowed coins are not counted towards the TVL`, + ethereum: { + tvl, + borrowed, + }, +}; \ No newline at end of file From 3dc16d293b04a08c114bbcc4c7f9278acbb1c9c4 Mon Sep 17 00:00:00 2001 From: define Date: Mon, 7 Aug 2023 16:47:22 +0100 Subject: [PATCH 0697/1974] new wallets binance --- projects/binance/config.js | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/projects/binance/config.js b/projects/binance/config.js index b063348ad47..c7a58a90adc 100644 --- a/projects/binance/config.js +++ b/projects/binance/config.js @@ -18,7 +18,12 @@ const assetList = [ ["BTC", "BTC", "3JFJPpH8Chwo7CDbyYQ4XcfgcjEP1FGRMJ"], ["BTC", "BTC", "34HpHYiyQwg69gFmCq2BGHjF1DZnZnBeBP"], ["BTC", "BTC", "bc1qm34lsc65zpw79lxes69zkqmk6ee3ewf0j77s3h"], - // ["BTC", "BTC", "38Xnrq8MZiKmYmwobbYdZQ5nnCbX1qvQfE"], old wallet that moved 3.1b to new one + ["BTC", "BTC", "38Xnrq8MZiKmYmwobbYdZQ5nnCbX1qvQfE"], // added again on 07/08/2023 + ["BTC", "BTC", "34GUzCVLbdkMQ2UdVTaA4nxPwoovVS7y2J"], // add on 07/08/2023 + ["BTC", "BTC", "3AtnehKDkFPC1bKvdrEVPSRGCtxQH8F1R8"], // add on 07/08/2023 + ["BTC", "BTC", "3CySuFKbBS29M7rE5iJakZRNqb3msMeFoN"], // add on 07/08/2023 + ["BTC", "BTC", "3Me9QACjioepv2L2oKTC9QQ87NH6vFe1Zj"], // add on 07/08/2023 + ["BTC", "BTC", "3NXCvmLGz9SxYi6TnjbBQfQMcwiZ1iQETa"], // add on 07/08/2023 ["BTC", "BTC", "3EbJfpmFgufYtzW9UFvf1GAfm2ted1Rwnr"], ["BTC", "BTC", "38DN2uFMZPiHLHJigfv4kWC9JWJrNnhLcn"], ["BTC", "BTC", "3Qxak1CZhLyZ7GVckKphLURdLBCjMfz9bA"], @@ -46,6 +51,7 @@ const assetList = [ ["USDT", "ETH", "0xdfd5293d8e347dfe59e90efd55b2956a1343963d"], ["USDT", "ETH", "0x9696f59e4d72e237be84ffd425dcad154bf96976"], ["USDT", "ETH", "0x4976a4a02f38326660d17bf34b431dc6e2eb2327"], + ["USDT", "ETH", "0xBE0eB53F46cd790Cd13851d5EFf43D12404d33E8"], // add on 07/08/2023 ["USDT", "TRX", "TMuA6YqfCeX8EhbfYEg5y7S4DqzSJireY9"], ["USDT", "TRX", "TWd4WrZ9wn84f5x1hZhL4DHvk738ns5jwb"], ["USDC", "TRX", "TWd4WrZ9wn84f5x1hZhL4DHvk738ns5jwb"], @@ -94,8 +100,9 @@ const assetList = [ // ["BNB", "BEP2", "bnb1u70jtt2umum4ag3vcpw2h8v8levm47t0mtjwmh"], ["BNB", "BEP2", "bnb1xrfwzlu9c5208lhtn7ywt0mjrhjh4nt4fjyqxy"], ["BNB", "BEP20", "0xf977814e90da44bfa03b6295a0616a897441acec"], - // ["BNB", "BEP20", "0xBE0eB53F46cd790Cd13851d5EFf43D12404d33E8"], + ["BNB", "BEP20", "0xBE0eB53F46cd790Cd13851d5EFf43D12404d33E8"], // ADD BACK 07/08/2023 ["BNB", "BEP20", "0x5a52e96bacdabb82fd05763e25335261b270efcb"], + ["ETH", "BEP20", "0x5a52E96BAcdaBb82fd05763E25335261B270Efcb"], //add on 07/08/2023 ["BNB", "BEP20", "0x3c783c21a0383057d128bae431894a5c19f9cf06"], ["BNB", "BEP20", "0xdccf3b77da55107280bd850ea519df3705d1a75a"], ["BNB", "BEP20", "0x8894e0a0c962cb723c1976a4421c95949be2d4e3"], @@ -142,6 +149,7 @@ const assetList = [ ["CHZ", "BEP2", "bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz"], ["WRX", "BEP2", "bnb1u2agwjat20494fmc6jnuau0ls937cfjn4pjwtn"], ["WRX", "BEP2", "bnb142q467df6jun6rt5u2ar58sp47hm5f9wvz2cvg"], + ["WRX", "ETH", "0xBE0eB53F46cd790Cd13851d5EFf43D12404d33E8"], // add on 07/08/2023 ["BTC", "BEP2", "bnb1lsmt5a8vqqus5fwslx8pyyemgjtg4y6ugj308t"], ["LTC", "BEP2", "bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz"], ["USDT", "BEP2", "bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz"], @@ -150,6 +158,7 @@ const assetList = [ ["BUSD", "BEP20", "0x8894e0a0c962cb723c1976a4421c95949be2d4e3"], ["BTC", "BEP20", "0xf977814e90da44bfa03b6295a0616a897441acec"], ["LINK", "BEP20", "0x5a52e96bacdabb82fd05763e25335261b270efcb"], + ["BTC", "BEP20", "0x5a52E96BAcdaBb82fd05763E25335261B270Efcb"], //add on 07/08/2023 ["BTC", "ETH", "0x21a31ee1afc51d94c2efccaa2092ad1028285549"], ["MASK", "BEP20", "0x5a52e96bacdabb82fd05763e25335261b270efcb"], ["BTC", "ETH", "0xdfd5293d8e347dfe59e90efd55b2956a1343963d"], @@ -179,6 +188,7 @@ const assetList = [ ["SHIB", "BEP20", "0xf977814e90da44bfa03b6295a0616a897441acec"], ["CHZ", "ETH", "0xbe0eb53f46cd790cd13851d5eff43d12404d33e8"], ["CHZ", "ETH", "0x28c6c06298d514db089934071355e5743bf21d60"], + ["ENJ", "ETH", "0xBE0eB53F46cd790Cd13851d5EFf43D12404d33E8"], // add on 07/08/2023 ["CHZ", "ETH", "0x21a31ee1afc51d94c2efccaa2092ad1028285549"], ["1INCH", "BEP20", "0x8894e0a0c962cb723c1976a4421c95949be2d4e3"], ["CRV", "ETH", "0x28c6c06298d514db089934071355e5743bf21d60"], @@ -270,6 +280,7 @@ const assetList = [ ["USDT", "BEP20", "0xeb2d2f1b8c558a40207669291fda468e50c8a0bb"], ["CRV", "ETH", "0xf977814e90da44bfa03b6295a0616a897441acec"], ["BNB", "ETH", "0x28c6c06298d514db089934071355e5743bf21d60"], + ["USDT", "ETH", "0x5a52e96bacdabb82fd05763e25335261b270efcb"], //add on 07/08/2023 ["CHR", "ETH", "0x5a52e96bacdabb82fd05763e25335261b270efcb"], ["CVP", "ETH", "0xf977814e90da44bfa03b6295a0616a897441acec"], ["XRP", "BEP20", "0xe2fc31f816a9b94326492132018c3aecc4a93ae1"], @@ -284,6 +295,8 @@ const assetList = [ ["LTC", "LTC", "MSeDRiNoH5Afr9b9rNo837hYzpxBXXqMZf"], ["LTC", "LTC", "M8T1B2Z97gVdvmfkQcAtYbEepune1tzGua"], ["LTC", "LTC", "LZEjckteAtWrugbsy9zU8VHEZ4iUiXo9Nm"], + ["LTC", "LTC", "MDwD5wYdeuoisfoaWKgeHK4Gq3YkbaCypJ"], //add on 07/08/2023 + ["LTC", "LTC", "MVfJZDUEnPniCTYgidV7qW9EaPJoDMjb6b"], //add on 07/08/2023 ["MATIC", "MATIC", "0xf977814e90da44bfa03b6295a0616a897441acec"], ["USDT", "MATIC", "0xe7804c37c13166ff0b37f5ae0bb07a3aebb6e245"], ["BUSD", "MATIC", "0xf977814e90da44bfa03b6295a0616a897441acec"], @@ -429,5 +442,5 @@ module.exports = { }, aptos: { owners: getOwners('APT') - }, + } } \ No newline at end of file From 41461443d07f6bfa5beb7b7bcb0f53ef8d3f9762 Mon Sep 17 00:00:00 2001 From: Define101 <93603962+Define101@users.noreply.github.com> Date: Mon, 7 Aug 2023 16:57:20 +0100 Subject: [PATCH 0698/1974] new wallets binance (#7057) --- projects/binance/config.js | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/projects/binance/config.js b/projects/binance/config.js index b063348ad47..c7a58a90adc 100644 --- a/projects/binance/config.js +++ b/projects/binance/config.js @@ -18,7 +18,12 @@ const assetList = [ ["BTC", "BTC", "3JFJPpH8Chwo7CDbyYQ4XcfgcjEP1FGRMJ"], ["BTC", "BTC", "34HpHYiyQwg69gFmCq2BGHjF1DZnZnBeBP"], ["BTC", "BTC", "bc1qm34lsc65zpw79lxes69zkqmk6ee3ewf0j77s3h"], - // ["BTC", "BTC", "38Xnrq8MZiKmYmwobbYdZQ5nnCbX1qvQfE"], old wallet that moved 3.1b to new one + ["BTC", "BTC", "38Xnrq8MZiKmYmwobbYdZQ5nnCbX1qvQfE"], // added again on 07/08/2023 + ["BTC", "BTC", "34GUzCVLbdkMQ2UdVTaA4nxPwoovVS7y2J"], // add on 07/08/2023 + ["BTC", "BTC", "3AtnehKDkFPC1bKvdrEVPSRGCtxQH8F1R8"], // add on 07/08/2023 + ["BTC", "BTC", "3CySuFKbBS29M7rE5iJakZRNqb3msMeFoN"], // add on 07/08/2023 + ["BTC", "BTC", "3Me9QACjioepv2L2oKTC9QQ87NH6vFe1Zj"], // add on 07/08/2023 + ["BTC", "BTC", "3NXCvmLGz9SxYi6TnjbBQfQMcwiZ1iQETa"], // add on 07/08/2023 ["BTC", "BTC", "3EbJfpmFgufYtzW9UFvf1GAfm2ted1Rwnr"], ["BTC", "BTC", "38DN2uFMZPiHLHJigfv4kWC9JWJrNnhLcn"], ["BTC", "BTC", "3Qxak1CZhLyZ7GVckKphLURdLBCjMfz9bA"], @@ -46,6 +51,7 @@ const assetList = [ ["USDT", "ETH", "0xdfd5293d8e347dfe59e90efd55b2956a1343963d"], ["USDT", "ETH", "0x9696f59e4d72e237be84ffd425dcad154bf96976"], ["USDT", "ETH", "0x4976a4a02f38326660d17bf34b431dc6e2eb2327"], + ["USDT", "ETH", "0xBE0eB53F46cd790Cd13851d5EFf43D12404d33E8"], // add on 07/08/2023 ["USDT", "TRX", "TMuA6YqfCeX8EhbfYEg5y7S4DqzSJireY9"], ["USDT", "TRX", "TWd4WrZ9wn84f5x1hZhL4DHvk738ns5jwb"], ["USDC", "TRX", "TWd4WrZ9wn84f5x1hZhL4DHvk738ns5jwb"], @@ -94,8 +100,9 @@ const assetList = [ // ["BNB", "BEP2", "bnb1u70jtt2umum4ag3vcpw2h8v8levm47t0mtjwmh"], ["BNB", "BEP2", "bnb1xrfwzlu9c5208lhtn7ywt0mjrhjh4nt4fjyqxy"], ["BNB", "BEP20", "0xf977814e90da44bfa03b6295a0616a897441acec"], - // ["BNB", "BEP20", "0xBE0eB53F46cd790Cd13851d5EFf43D12404d33E8"], + ["BNB", "BEP20", "0xBE0eB53F46cd790Cd13851d5EFf43D12404d33E8"], // ADD BACK 07/08/2023 ["BNB", "BEP20", "0x5a52e96bacdabb82fd05763e25335261b270efcb"], + ["ETH", "BEP20", "0x5a52E96BAcdaBb82fd05763E25335261B270Efcb"], //add on 07/08/2023 ["BNB", "BEP20", "0x3c783c21a0383057d128bae431894a5c19f9cf06"], ["BNB", "BEP20", "0xdccf3b77da55107280bd850ea519df3705d1a75a"], ["BNB", "BEP20", "0x8894e0a0c962cb723c1976a4421c95949be2d4e3"], @@ -142,6 +149,7 @@ const assetList = [ ["CHZ", "BEP2", "bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz"], ["WRX", "BEP2", "bnb1u2agwjat20494fmc6jnuau0ls937cfjn4pjwtn"], ["WRX", "BEP2", "bnb142q467df6jun6rt5u2ar58sp47hm5f9wvz2cvg"], + ["WRX", "ETH", "0xBE0eB53F46cd790Cd13851d5EFf43D12404d33E8"], // add on 07/08/2023 ["BTC", "BEP2", "bnb1lsmt5a8vqqus5fwslx8pyyemgjtg4y6ugj308t"], ["LTC", "BEP2", "bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz"], ["USDT", "BEP2", "bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz"], @@ -150,6 +158,7 @@ const assetList = [ ["BUSD", "BEP20", "0x8894e0a0c962cb723c1976a4421c95949be2d4e3"], ["BTC", "BEP20", "0xf977814e90da44bfa03b6295a0616a897441acec"], ["LINK", "BEP20", "0x5a52e96bacdabb82fd05763e25335261b270efcb"], + ["BTC", "BEP20", "0x5a52E96BAcdaBb82fd05763E25335261B270Efcb"], //add on 07/08/2023 ["BTC", "ETH", "0x21a31ee1afc51d94c2efccaa2092ad1028285549"], ["MASK", "BEP20", "0x5a52e96bacdabb82fd05763e25335261b270efcb"], ["BTC", "ETH", "0xdfd5293d8e347dfe59e90efd55b2956a1343963d"], @@ -179,6 +188,7 @@ const assetList = [ ["SHIB", "BEP20", "0xf977814e90da44bfa03b6295a0616a897441acec"], ["CHZ", "ETH", "0xbe0eb53f46cd790cd13851d5eff43d12404d33e8"], ["CHZ", "ETH", "0x28c6c06298d514db089934071355e5743bf21d60"], + ["ENJ", "ETH", "0xBE0eB53F46cd790Cd13851d5EFf43D12404d33E8"], // add on 07/08/2023 ["CHZ", "ETH", "0x21a31ee1afc51d94c2efccaa2092ad1028285549"], ["1INCH", "BEP20", "0x8894e0a0c962cb723c1976a4421c95949be2d4e3"], ["CRV", "ETH", "0x28c6c06298d514db089934071355e5743bf21d60"], @@ -270,6 +280,7 @@ const assetList = [ ["USDT", "BEP20", "0xeb2d2f1b8c558a40207669291fda468e50c8a0bb"], ["CRV", "ETH", "0xf977814e90da44bfa03b6295a0616a897441acec"], ["BNB", "ETH", "0x28c6c06298d514db089934071355e5743bf21d60"], + ["USDT", "ETH", "0x5a52e96bacdabb82fd05763e25335261b270efcb"], //add on 07/08/2023 ["CHR", "ETH", "0x5a52e96bacdabb82fd05763e25335261b270efcb"], ["CVP", "ETH", "0xf977814e90da44bfa03b6295a0616a897441acec"], ["XRP", "BEP20", "0xe2fc31f816a9b94326492132018c3aecc4a93ae1"], @@ -284,6 +295,8 @@ const assetList = [ ["LTC", "LTC", "MSeDRiNoH5Afr9b9rNo837hYzpxBXXqMZf"], ["LTC", "LTC", "M8T1B2Z97gVdvmfkQcAtYbEepune1tzGua"], ["LTC", "LTC", "LZEjckteAtWrugbsy9zU8VHEZ4iUiXo9Nm"], + ["LTC", "LTC", "MDwD5wYdeuoisfoaWKgeHK4Gq3YkbaCypJ"], //add on 07/08/2023 + ["LTC", "LTC", "MVfJZDUEnPniCTYgidV7qW9EaPJoDMjb6b"], //add on 07/08/2023 ["MATIC", "MATIC", "0xf977814e90da44bfa03b6295a0616a897441acec"], ["USDT", "MATIC", "0xe7804c37c13166ff0b37f5ae0bb07a3aebb6e245"], ["BUSD", "MATIC", "0xf977814e90da44bfa03b6295a0616a897441acec"], @@ -429,5 +442,5 @@ module.exports = { }, aptos: { owners: getOwners('APT') - }, + } } \ No newline at end of file From 3102532d217023612a93638e75510f43b618a28b Mon Sep 17 00:00:00 2001 From: vpivin <140244395+vpivin@users.noreply.github.com> Date: Mon, 7 Aug 2023 12:11:49 -0400 Subject: [PATCH 0699/1974] Add Zkera.Finance (#7015) * Create index.js * bugfix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/zkera-fi/index.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 projects/zkera-fi/index.js diff --git a/projects/zkera-fi/index.js b/projects/zkera-fi/index.js new file mode 100644 index 00000000000..bc9aa117fc2 --- /dev/null +++ b/projects/zkera-fi/index.js @@ -0,0 +1,14 @@ +const { staking } = require("../helper/staking"); +const { gmxExports } = require("../helper/gmx"); + +//ZKera +const zkVault = "0xBC918775C20959332c503d51a9251C2405d9cF88"; +const zkStaking = "0xA258D1CfeCaDD96C763dfa50284525f1529cfB35"; +const zkZKE = "0x7b3e1236c39ddD2e61cF6Da6ac6D11193238ccB0"; + +module.exports = { + era: { + staking: staking(zkStaking, zkZKE), + tvl: gmxExports({ vault: zkVault }) + } +} From 72611b824608019fd6bb6233c0335d35c74e553f Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 7 Aug 2023 18:18:20 +0200 Subject: [PATCH 0700/1974] uniswap: track base --- projects/uniswap/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/uniswap/index.js b/projects/uniswap/index.js index 2d44b64835c..91213f7bbb2 100644 --- a/projects/uniswap/index.js +++ b/projects/uniswap/index.js @@ -10,6 +10,7 @@ const graphs = { celo: "https://api.thegraph.com/subgraphs/name/jesse-sawa/uniswap-celo", bsc: "https://api.thegraph.com/subgraphs/name/ianlapham/uniswap-v3-bsc", avax: "https://api.thegraph.com/subgraphs/name/lynnshaoyu/uniswap-v3-avax", + base: "https://api.studio.thegraph.com/query/48211/uniswap-v3-base/v0.0.1", } const blacklists = { @@ -75,7 +76,7 @@ module.exports = { ] } -const chains = ['ethereum', 'arbitrum', 'optimism', 'polygon', 'celo', 'bsc', 'avax'] +const chains = ['ethereum', 'arbitrum', 'optimism', 'polygon', 'celo', 'bsc', 'avax', 'base', ] chains.forEach(chain => { module.exports[chain] = { From 6f1ea1e89fcb4883e47c72b80c8343c0c12dfd5f Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 7 Aug 2023 18:31:09 +0200 Subject: [PATCH 0701/1974] uniswap: fix base --- projects/uniswap/index.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/projects/uniswap/index.js b/projects/uniswap/index.js index 91213f7bbb2..98fc5f4426e 100644 --- a/projects/uniswap/index.js +++ b/projects/uniswap/index.js @@ -1,6 +1,7 @@ const { request, gql } = require('graphql-request'); const { getBlock } = require('../helper/http'); const { sumTokens2 } = require('../helper/unwrapLPs') +const { uniV3Export } = require('../helper/uniswapV3') const graphs = { ethereum: "https://api.thegraph.com/subgraphs/name/uniswap/uniswap-v3", @@ -73,10 +74,14 @@ module.exports = { [1605583307, "LM ends"], [1617333707, "FEI launch"], [1620156420, "UNI V3 Launch"] - ] + ], + ...uniV3Export({ + base: { factory: '0x33128a8fc17869897dce68ed026d694621f6fdfd', fromBlock:1371680, } + }) } -const chains = ['ethereum', 'arbitrum', 'optimism', 'polygon', 'celo', 'bsc', 'avax', 'base', ] +const chains = [ 'avax', ] +module.exports.chains = chains chains.forEach(chain => { module.exports[chain] = { From 298c8025121e1603d335dbebf70dda4c2587001b Mon Sep 17 00:00:00 2001 From: define Date: Mon, 7 Aug 2023 17:59:37 +0100 Subject: [PATCH 0702/1974] delete duplicated --- projects/zkera-fi/index.js | 14 -------------- 1 file changed, 14 deletions(-) delete mode 100644 projects/zkera-fi/index.js diff --git a/projects/zkera-fi/index.js b/projects/zkera-fi/index.js deleted file mode 100644 index bc9aa117fc2..00000000000 --- a/projects/zkera-fi/index.js +++ /dev/null @@ -1,14 +0,0 @@ -const { staking } = require("../helper/staking"); -const { gmxExports } = require("../helper/gmx"); - -//ZKera -const zkVault = "0xBC918775C20959332c503d51a9251C2405d9cF88"; -const zkStaking = "0xA258D1CfeCaDD96C763dfa50284525f1529cfB35"; -const zkZKE = "0x7b3e1236c39ddD2e61cF6Da6ac6D11193238ccB0"; - -module.exports = { - era: { - staking: staking(zkStaking, zkZKE), - tvl: gmxExports({ vault: zkVault }) - } -} From 1bb5a484e1ee94ced21341d565fb0691cd033116 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Mon, 7 Aug 2023 20:38:25 +0100 Subject: [PATCH 0703/1974] readd chains --- projects/uniswap/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/uniswap/index.js b/projects/uniswap/index.js index 98fc5f4426e..bd02521c151 100644 --- a/projects/uniswap/index.js +++ b/projects/uniswap/index.js @@ -80,7 +80,7 @@ module.exports = { }) } -const chains = [ 'avax', ] +const chains = [ 'ethereum', 'arbitrum', 'optimism', 'polygon', 'celo', 'bsc', 'avax', ] module.exports.chains = chains chains.forEach(chain => { From 808c89f7f1acf8327507e140601ede662d5d96f0 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Mon, 7 Aug 2023 20:45:58 +0100 Subject: [PATCH 0704/1974] another fix --- projects/uniswap/index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/projects/uniswap/index.js b/projects/uniswap/index.js index bd02521c151..4530e7d213c 100644 --- a/projects/uniswap/index.js +++ b/projects/uniswap/index.js @@ -81,7 +81,6 @@ module.exports = { } const chains = [ 'ethereum', 'arbitrum', 'optimism', 'polygon', 'celo', 'bsc', 'avax', ] -module.exports.chains = chains chains.forEach(chain => { module.exports[chain] = { From 7732661f8274cc8ff0ac65c7f8c3cddeda63d518 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Mon, 7 Aug 2023 22:45:39 +0100 Subject: [PATCH 0705/1974] add stUSDT --- projects/helper/cex.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/projects/helper/cex.js b/projects/helper/cex.js index ec7e42bf1a9..1cab1ef267a 100644 --- a/projects/helper/cex.js +++ b/projects/helper/cex.js @@ -90,13 +90,15 @@ const defaultTokens = { '0xd417144312dbf50465b1c641d016962017ef6240',// cqt '0xcb84d72e61e383767c4dfeb2d8ff7f4fb89abc6e', //VEGA '0xcccd1ba9f7acd6117834e0d28f25645decb1736a', //ecox + '0x25ec98773d7b4ced4cafab96a2a1c0945f145e10', // stUSDT ], tron: [ nullAddress, ADDRESSES.tron.USDT, // USDT ADDRESSES.tron.USDC, // USDC 'TFptbWaARrWTX5Yvy3gNG5Lm8BmhPx82Bt', //wbt - ADDRESSES.tron.TUSD + ADDRESSES.tron.TUSD, + 'TThzxNRLrW2Brp9DcTQU8i4Wd9udCWEdZ3', // stUSDT ], polygon: [ nullAddress, From bc050cae272aa8c8daeef6736cbfbc05d2a22170 Mon Sep 17 00:00:00 2001 From: neuron team <141687054+goneuronxyz@users.noreply.github.com> Date: Tue, 8 Aug 2023 00:20:53 +0100 Subject: [PATCH 0706/1974] Added neuron integration --- projects/neuron/index.js | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 projects/neuron/index.js diff --git a/projects/neuron/index.js b/projects/neuron/index.js new file mode 100644 index 00000000000..cb4ba163e9e --- /dev/null +++ b/projects/neuron/index.js @@ -0,0 +1,37 @@ +const { getConfig } = require('../helper/cache') + +const { chainExports } = require('../helper/exports'); +const { sumTokens } = require("../helper/unwrapLPs"); + +const http_api_url = 'https://brain.goneuron.xyz/api_special/getChainTVL'; +const operator = '0xebb14128e98b2966EAb5b7da3a83e8c2edca0313'; +const chainIds = { + arbitrum : 42161, + optimism : 10, + linea : 59144, + base: 8453, +}; + +function chainTvl(chain) { + return async (timestamp, ethBlock, {[chain]: block}) => { + const balances = {}; + const transformAddress = id=>`${chain}:${id}`; + + const url = `${http_api_url}?chainId=${chainIds[chain]}`; + const neuron_response = await getConfig('neuron/'+chain, url); + + const tokensAndOwners = neuron_response.map(subArray => [subArray[0], operator]); + + await sumTokens(balances, tokensAndOwners, block, chain, transformAddress); + + return balances + }; +} + +module.exports = chainExports(chainTvl, [ + 'arbitrum', + 'optimism', + 'linea', + 'base', +]), +module.exports.methodology = 'neuron TVL is made of token balances of the neuron Outpost constracts. The deployed tokens are retrieved using HTTP REST API.' From 809a99c9aab95459d33f61f030bec7c8e80fce37 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Tue, 8 Aug 2023 01:18:05 +0100 Subject: [PATCH 0707/1974] add huobi address --- projects/huobi/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/huobi/index.js b/projects/huobi/index.js index b9c5b0d2beb..3aebb40b91d 100644 --- a/projects/huobi/index.js +++ b/projects/huobi/index.js @@ -45,6 +45,7 @@ const config = { 'TF2fmSbg5HAD34KPUH7WtWCxxvgXHohzYM', 'THZovMcKoZaV9zzFTWteQYd2f3NEvnzxAM', 'TZ1SsapyhKNWaVLca6P2qgVzkHTdk6nkXa', + 'TDvf1dSBhR7dEskJs17HxGHheJrjXhiFyM', ] }, algorand: { From 7129d34589c272b03bea034c4d7e97192fa89bd5 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Tue, 8 Aug 2023 04:36:40 +0100 Subject: [PATCH 0708/1974] add usdc --- projects/reax-one-synth/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/projects/reax-one-synth/index.js b/projects/reax-one-synth/index.js index 5c66fb96bb9..c3630448270 100644 --- a/projects/reax-one-synth/index.js +++ b/projects/reax-one-synth/index.js @@ -9,7 +9,9 @@ module.exports = { ADDRESSES.mantle.WETH, ADDRESSES.mantle.USDT, '0xCAbAE6f6Ea1ecaB08Ad02fE02ce9A44F09aebfA2', - ADDRESSES.mantle.WMNT + ADDRESSES.mantle.WMNT, + ADDRESSES.mantle.USDC + ] }), } From d000cbfa2033481a18e4eb198cc47460a9921568 Mon Sep 17 00:00:00 2001 From: define Date: Tue, 8 Aug 2023 11:09:33 +0100 Subject: [PATCH 0709/1974] test huobi --- projects/huobi/index.js | 40 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/projects/huobi/index.js b/projects/huobi/index.js index 3aebb40b91d..96e8385d13b 100644 --- a/projects/huobi/index.js +++ b/projects/huobi/index.js @@ -8,7 +8,11 @@ const config = { '1KVpuCfhftkzJ67ZUegaMuaYey7qni7pPj', //These 3 addresses has 48,555 #Bitcoin. This is only less than 3% of the total high value assets we have, including btc, usd, stablecoins, T-bills.. According to Justin Sun https://twitter.com/justinsuntron/status/1590311559242612743 '14XKsv8tT6tt8P8mfDQZgNF8wtN5erNu5D', - '1LXzGrDQqKqVBqxfGDUyhC6rTRBN5s8Sbj' + '1LXzGrDQqKqVBqxfGDUyhC6rTRBN5s8Sbj', + '1HckjUpRGcrrRAtFaaCAUaGjsPx9oYmLaZ', // add on 08/08/2023 (we defillama) + '1L15W6b9vkxV81xW5HDtmMBycrdiettHEL', // add on 08/08/2023 (we defillama) + '14o5ywJJmLPJe8egNo7a5fSdtEgarkus33', // add on 08/08/2023 (we defillama) + '1BuiWj9wPbQwNY97xU53LRPhzqNQccSquM', // add on 08/08/2023 (we defillama) ], }, ethereum: { @@ -21,7 +25,29 @@ const config = { '0xE4818f8fDe0C977A01DA4Fa467365B8bF22b071E', '0x5C985E89DDe482eFE97ea9f1950aD149Eb73829B', '0xc589b275e60dda57ad7e117c6dd837ab524a5666', - ] + '0x6b2286fc3a9265bab3f064808022aca54de4b6ce', // add on 08/08/2023 (we defillama) + '0x3d655889d197125fb90dcb72e4a287a8410ed1b9', // add on 08/08/2023 (we defillama) + '0x2abc22eb9a09ebbe7b41737ccde147f586efeb6a', // add on 08/08/2023 (we defillama) + '0xa5d7f0f7027fa8f4d1be8042e1e43bbdec36951e', // add on 08/08/2023 (we defillama) + '0xeee28d484628d41a82d01e21d12e2e78d69920da', // add on 08/08/2023 (we defillama) + '0x6748f50f686bfbca6fe8ad62b22228b87f31ff2b', // add on 08/08/2023 (we defillama) + '0x34189c75cbb13bdb4f5953cda6c3045cfca84a9e', // add on 08/08/2023 (we defillama) + '0x1062a747393198f70f71ec65a582423dba7e5ab3', // add on 08/08/2023 (we defillama) + '0xab5c66752a9e8167967685f1450532fb96d5d24f', // add on 08/08/2023 (we defillama) + '0xdb0e89a9b003a28a4055ef772e345e8089987bfd', // add on 08/08/2023 (we defillama) + '0xfdb16996831753d5331ff813c29a93c76834a0ad', // add on 08/08/2023 (we defillama) + '0x46705dfff24256421a05d056c29e81bdc09723b8', // add on 08/08/2023 (we defillama) + '0xfd54078badd5653571726c3370afb127351a6f26', // add on 08/08/2023 (we defillama) + '0x07ef60deca209ea0f3f3f08c1ad21a6db5ef9d33', // add on 08/08/2023 (we defillama) + '0x18916e1a2933cb349145a280473a5de8eb6630cb', // add on 08/08/2023 (we defillama) + '0xfa4b5be3f2f84f56703c42eb22142744e95a2c58', // add on 08/08/2023 (we defillama) + '0x0a98fb70939162725ae66e626fe4b52cff62c2e5', // add on 08/08/2023 (we defillama) + '0x918800e018a0eeea672740f88a60091c7d327a79', // add on 08/08/2023 (we defillama) + '0xadb2b42f6bd96f5c65920b9ac88619dce4166f94', // add on 08/08/2023 (we defillama) + '0x42dc966b7ecc3c6cc73e7bc04862859d5bddce65', // add on 08/08/2023 (we defillama) + '0xe8d8a02601f54acb6fb69537be1f1d7cc76ccd8c', // add on 08/08/2023 (we defillama) + '0xf881bcb3705926cea9c598ab05a837cf41a833a9', // add on 08/08/2023 (we defillama) + ] }, polygon: { owners: ['0xd70250731a72c33bfb93016e3d1f0ca160df7e42'] @@ -29,9 +55,11 @@ const config = { litecoin: { owners: ['MNky8PL58UjL14mcZm3ESvEkYQkzMY9kfu'] }, + /* solana: { owners: ['88xTWZMeKfiTgbfEmPLdsUCQcZinwUfk25EBQZ21XMAZ'] }, + */ tron: { owners: [ 'TYh6mgoMNZTCsgpYHBz7gttEfrQmDMABub', @@ -46,6 +74,8 @@ const config = { 'THZovMcKoZaV9zzFTWteQYd2f3NEvnzxAM', 'TZ1SsapyhKNWaVLca6P2qgVzkHTdk6nkXa', 'TDvf1dSBhR7dEskJs17HxGHheJrjXhiFyM', + 'TUJGLHo3rq4EAUY1LHRhNkHPX8qmrv9WFs', // add on 08/08/2023 (we defillama) + 'TRSXRWudzfzY4jH7AaMowdMNUXDkHisbcd' // add on 08/08/2023 (we defillama) ] }, algorand: { @@ -60,6 +90,12 @@ const config = { ripple: { owners: ['rKUDvXFJMFu65LqPTH3Yfpii4rbKT9bSQT'], }, + arbitrum: { + owners: ['0xf2dbc42875e7764edbd89732a15214a9a0deb085'], + }, + optimism: { + owners: ['0x9ef21be1c270aa1c3c3d750f458442397fbffcb6'], + }, } module.exports = cexExports(config) From bf3ace9feb3cd3e8311f238b997735f38a591de3 Mon Sep 17 00:00:00 2001 From: define Date: Tue, 8 Aug 2023 11:16:35 +0100 Subject: [PATCH 0710/1974] add methodology --- projects/huobi/index.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/projects/huobi/index.js b/projects/huobi/index.js index 96e8385d13b..8808b331f05 100644 --- a/projects/huobi/index.js +++ b/projects/huobi/index.js @@ -55,11 +55,9 @@ const config = { litecoin: { owners: ['MNky8PL58UjL14mcZm3ESvEkYQkzMY9kfu'] }, - /* solana: { owners: ['88xTWZMeKfiTgbfEmPLdsUCQcZinwUfk25EBQZ21XMAZ'] }, - */ tron: { owners: [ 'TYh6mgoMNZTCsgpYHBz7gttEfrQmDMABub', @@ -99,3 +97,4 @@ const config = { } module.exports = cexExports(config) +module.exports.methodology = 'We added the wallets from here https://github.com/huobiapi/Tool-Node.js-VerifyAddress/blob/main/snapshot/huobi_por_20230701.csv . We are not tracking 3 wallets, 2 on Heco Chain, 1 on BTTC chain. We also count stUSDT.' From 5e24f2927292525c7a6228d8ed4d87bf3e54057f Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 8 Aug 2023 16:33:34 +0530 Subject: [PATCH 0711/1974] Sable (#7067) * init sable folder * update tvl and pool2 * refactor liquity forks --------- Co-authored-by: marty-sable --- projects/aquarius/index.js | 4 +- projects/defihalal/index.js | 6 +- projects/fluity/index.js | 9 +- projects/helper/liquity.js | 27 ++--- projects/piggy/index.js | 7 +- projects/sable-finance/index.js | 16 +++ projects/teddy/index.js | 8 +- projects/topshelf/index.js | 29 ++--- projects/xdollar-finance/index.js | 174 +++++++----------------------- 9 files changed, 85 insertions(+), 195 deletions(-) create mode 100644 projects/sable-finance/index.js diff --git a/projects/aquarius/index.js b/projects/aquarius/index.js index 9b6d3c19353..211b724d865 100644 --- a/projects/aquarius/index.js +++ b/projects/aquarius/index.js @@ -1,12 +1,10 @@ -const ADDRESSES = require('../helper/coreAssets.json') const {getLiquityTvl} = require('../helper/liquity') -const FTM_ADDRESS = ADDRESSES.fantom.WFTM; const TROVE_MANAGER_ADDRESS = "0xC87D230B3239d1A90463463d8adDFD70709D391b"; module.exports = { fantom: { - tvl: getLiquityTvl(FTM_ADDRESS,TROVE_MANAGER_ADDRESS,"fantom"), + tvl: getLiquityTvl(TROVE_MANAGER_ADDRESS), }, methodology: `Aquarius does not run its own web interface deposits for it's TVL are made at third-party frontend operators incetivized with the AQU token. TVL consists of deposits made to mint aUSD.` }; diff --git a/projects/defihalal/index.js b/projects/defihalal/index.js index a7bd51a86ca..d909ac8fda1 100644 --- a/projects/defihalal/index.js +++ b/projects/defihalal/index.js @@ -1,12 +1,8 @@ -const ADDRESSES = require('../helper/coreAssets.json') const {getLiquityTvl} = require('../helper/liquity') -//USDH TOKEN ADDRESS ON POLYGON MAINNET -const USDH_TOKEN_ADDRESS = "0x92B27abe3C96d3B1266f881b3B0886e68645F51F"; - module.exports = { methodology: "Deposited Matic and USDH, USDH is not listed on CoinGecko and has been replaced with TUSD", polygon:{ - tvl: getLiquityTvl(ADDRESSES.polygon.WMATIC_2, "0xd8a3e8c70091d6231a63e671a6ce8ea44e143d24", "polygon") + tvl: getLiquityTvl("0xd8a3e8c70091d6231a63e671a6ce8ea44e143d24") } }; diff --git a/projects/fluity/index.js b/projects/fluity/index.js index 97621c18829..47ef61763d2 100644 --- a/projects/fluity/index.js +++ b/projects/fluity/index.js @@ -1,11 +1,8 @@ -const ADDRESSES = require('../helper/coreAssets.json') const { getLiquityTvl } = require("../helper/liquity"); - -const BNB_ADDRESS = ADDRESSES.bsc.WBNB; -// TroveManager has a record of total system collateral const TROVE_MANAGER_ADDRESS = "0xe041c4099C0d6dcfC52C56A556EE4289D2E4b7C5"; module.exports = { bsc: { - tvl: getLiquityTvl(BNB_ADDRESS,TROVE_MANAGER_ADDRESS,"bsc") -}} + tvl: getLiquityTvl(TROVE_MANAGER_ADDRESS) + } +} diff --git a/projects/helper/liquity.js b/projects/helper/liquity.js index f6622f316b1..032d038a34a 100644 --- a/projects/helper/liquity.js +++ b/projects/helper/liquity.js @@ -1,21 +1,12 @@ -const sdk = require("@defillama/sdk"); - -function getLiquityTvl(ETH_ADDRESS, TROVE_MANAGER_ADDRESS, chain) { - return async (_, ethBlock, chainBlocks) => { - const block = chainBlocks[chain] - - const troveEthTvl = ( - await sdk.api.abi.call({ - target: TROVE_MANAGER_ADDRESS, - abi: "uint256:getEntireSystemColl", - block, - chain, - }) - ).output; - - return { - [chain+':'+ETH_ADDRESS]: troveEthTvl, - }; +const { nullAddress } = require("./tokenMapping") + +function getLiquityTvl(TROVE_MANAGER_ADDRESS, { nonNativeCollateralToken = false, abis = {} } = {}) { + return async (_, ethBlock, chainBlocks, { api }) => { + const activePool = await api.call({ target: TROVE_MANAGER_ADDRESS, abi: abis.activePool ?? "address:activePool", }) + const defaultPool = await api.call({ target: TROVE_MANAGER_ADDRESS, abi: "address:defaultPool", }) + let token = nullAddress + if (nonNativeCollateralToken) token = await api.call({ target: TROVE_MANAGER_ADDRESS, abi: abis.collateralToken ?? "address:collateralToken", }) + return api.sumTokens({ owners: [activePool, defaultPool], tokens: [token] }) } } diff --git a/projects/piggy/index.js b/projects/piggy/index.js index ea209dff27a..de62d6ac685 100644 --- a/projects/piggy/index.js +++ b/projects/piggy/index.js @@ -1,16 +1,11 @@ -const ADDRESSES = require('../helper/coreAssets.json') const {getLiquityTvl} = require('../helper/liquity') -const BNB_ADDRESS = ADDRESSES.bsc.WBNB; - -// TroveManager holds total system collateral (deposited BNB) const TROVE_MANAGER_ADDRESS = "0xb283466d09177c5C6507785d600caFDFa538C65C"; module.exports = { deadFrom: 1648765747, start: 1623145388, bsc: { - tvl: getLiquityTvl(BNB_ADDRESS, TROVE_MANAGER_ADDRESS, "bsc") + tvl: getLiquityTvl(TROVE_MANAGER_ADDRESS) }, - }; diff --git a/projects/sable-finance/index.js b/projects/sable-finance/index.js new file mode 100644 index 00000000000..449a02a487b --- /dev/null +++ b/projects/sable-finance/index.js @@ -0,0 +1,16 @@ +const { getLiquityTvl } = require("../helper/liquity"); +const { pool2 } = require("../helper/pool2"); + + +// Contract address where view function to get total BNB collateral deposited is located +const SABLE_TROVE_MANAGER = '0xEC035081376ce975Ba9EAF28dFeC7c7A4c483B85' +// Contract address for Pool2 where SABLE-BNB LP tokens are staked +const SABLE_LP_STAKING = '0xFbc81aEB7e5c11d4A60a0690Db9F36F93E25B16C' +// Contract address for Pancake SABLE-BNB LP +const PANCAKE_SABLE_BNB = '0xa0D4e270D9EB4E41f7aB02337c21692D7eECCCB0' + +module.exports = { + bsc: { + tvl: getLiquityTvl(SABLE_TROVE_MANAGER), + pool2: pool2(SABLE_LP_STAKING, PANCAKE_SABLE_BNB) +}} \ No newline at end of file diff --git a/projects/teddy/index.js b/projects/teddy/index.js index 3f93e997c0e..769649c4a91 100644 --- a/projects/teddy/index.js +++ b/projects/teddy/index.js @@ -1,20 +1,14 @@ -const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const { staking } = require("../helper/staking"); const { pool2 } = require("../helper/pool2"); const {getLiquityTvl} = require('../helper/liquity') -const treasuryContract = "0xb4Fbc7839ce88029c8c1c6274660118e27B6f982"; - const stakingContract = "0xb4387D93B5A9392f64963cd44389e7D9D2E1053c"; const TEDDY = "0x094bd7b2d99711a1486fb94d4395801c6d0fddcc"; const stakingPool2Contract = "0x9717Ff7406Be065EA177bA9ab1bE704060Af8370"; const WAVAX_TSD_PGL = "0x67E395B6ACd948931eeE8F52C7c1Fe537E7f1a7a"; -const NATIVE_ADDRESS = ADDRESSES.avax.WAVAX; -//const LUSD_TOKEN_ADDRESS = ADDRESSES.ethereum.LUSD; - const TROVE_MANAGER_ADDRESS = "0xd22b04395705144Fd12AfFD854248427A2776194"; module.exports = { @@ -24,7 +18,7 @@ module.exports = { //staking(STABILITY_POOL_ADDRESS, TSD, "avax"), ]), pool2: pool2(stakingPool2Contract, WAVAX_TSD_PGL, "avax"), - tvl: getLiquityTvl(NATIVE_ADDRESS,TROVE_MANAGER_ADDRESS,"avax"), + tvl: getLiquityTvl(TROVE_MANAGER_ADDRESS), }, methodology: "Get tokens on stability pool and troves, TSD has been replaced by LUSD", diff --git a/projects/topshelf/index.js b/projects/topshelf/index.js index 86131222768..0944151978e 100644 --- a/projects/topshelf/index.js +++ b/projects/topshelf/index.js @@ -1,35 +1,36 @@ const ADDRESSES = require('../helper/coreAssets.json') -const {getLiquityTvl} = require('../helper/liquity') +const { getLiquityTvl } = require('../helper/liquity') const sdk = require('@defillama/sdk'); const { sumTokens } = require('../helper/unwrapLPs'); -async function fantomCurveLps(timestamp, ethBlock, chainBlocks){ +async function fantomCurveLps(timestamp, ethBlock, chainBlocks) { const balances = {} await sumTokens(balances, [ ["0x6ef78ad4a40e9a6c81b9229de3ecc33ce591bc34", "0xce42b2ee38f3434be68d1d6258a4d8959a6716ab"], //usd ["0x8b63f036f5a34226065bc0a7b0ae5bb5eba1ff3d", "0x59f58431d4cba2b7e9e8d78f064a8fa24c5134bf"], //ftm - ], chainBlocks.fantom, "fantom", addr=>{ - return "fantom:"+{ - "0x6ef78ad4a40e9a6c81b9229de3ecc33ce591bc34":ADDRESSES.fantom.MIM, - "0x8b63f036f5a34226065bc0a7b0ae5bb5eba1ff3d":ADDRESSES.fantom.WFTM, + ], chainBlocks.fantom, "fantom", addr => { + return "fantom:" + { + "0x6ef78ad4a40e9a6c81b9229de3ecc33ce591bc34": ADDRESSES.fantom.MIM, + "0x8b63f036f5a34226065bc0a7b0ae5bb5eba1ff3d": ADDRESSES.fantom.WFTM, }[addr.toLowerCase()] }) return balances } +const options = { nonNativeCollateralToken: true} + module.exports = { - timetravel: true, methodology: "Deposited AVAX, BNB and FTM on all three chains as well as deposits in staking pools. g3CRV is replaced by MIM", - bsc:{ - tvl: getLiquityTvl(ADDRESSES.bsc.WBNB, "0x15102B7579aE3b913B0cbb2edE791fC58C528195", "bsc") + bsc: { + tvl: getLiquityTvl("0x15102B7579aE3b913B0cbb2edE791fC58C528195", options) }, - avax:{ - tvl: getLiquityTvl(ADDRESSES.avax.WAVAX, "0x41c36D163DB9e58608F4B354FfB3893EF472E9fd", "avax") + avax: { + tvl: getLiquityTvl("0x41c36D163DB9e58608F4B354FfB3893EF472E9fd", options) }, - fantom:{ + fantom: { tvl: sdk.util.sumChainTvls([ - getLiquityTvl(ADDRESSES.fantom.WFTM, "0x5420d619823b7d836341524C55f3c24B4D497c72", "fantom"), - getLiquityTvl(ADDRESSES.fantom.MIM, "0x16E900A379873351D6922881388548e4eee5c611", "fantom"), + getLiquityTvl("0x5420d619823b7d836341524C55f3c24B4D497c72", options), + getLiquityTvl("0x16E900A379873351D6922881388548e4eee5c611", options), fantomCurveLps ]) } diff --git a/projects/xdollar-finance/index.js b/projects/xdollar-finance/index.js index ed756af0d47..c7cfe729bf0 100644 --- a/projects/xdollar-finance/index.js +++ b/projects/xdollar-finance/index.js @@ -1,142 +1,44 @@ -const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); -const BigNumber = require('bignumber.js') -const { transformBalances } = require('../helper/portedTokens.js') const { staking } = require('../helper/staking') +const { getLiquityTvl } = require('../helper/liquity') -const {getLiquityTvl} = require('../helper/liquity') - -const ETH_ADDR = ADDRESSES.ethereum.WETH; -const BTC_ADDR = ADDRESSES.ethereum.WBTC; -const USDC_ADDR = ADDRESSES.ethereum.USDC; - -const iotexTMs = { - "0x366D48c04B0d315acF27Bd358558e92D4e2E9f3D": ADDRESSES.iotex.WIOTX, // WIOTX - "0x7204e2f210865aA1854F33B3532ab2DEb386CB59": ADDRESSES.iotex.WIOTX, // WIOTX v2 -} -const iotexStableAPs = { - "0x8Af0EE5A98609fEdaf301Af74d3ca4Da614eaD43": ADDRESSES.iotex.BUSD_bsc, // BUSD_b - "0xF524F844216069b167d65DCe68B24F3358260BD5": ADDRESSES.iotex.ioUSDT, // USDT - // "0x206aAF608d1DD7eA9Db4b8460B2Bf8647522f90a": ADDRESSES.iotex.anyXIM, // any - "0x84724DAEC2943B1FDd5250ffcF64dfa290606250": ADDRESSES.iotex.BUSD_bsc, // BUSD_b v2 - "0xc67cF429b055D664c7Ba06c9F5D17d0692C554fC": ADDRESSES.iotex.ioUSDT, // USDT v2 -} -const ethStables = { - "0xC0eb7718fF1B5fBF11cd314CbC212c167bF341DB": ADDRESSES.ethereum.USDC, // USDC -} -// node test.js projects/xdollar-finance/index.js - -const iotexTvl = async (timestamp, ethBlock, chainBlocks) => { - const balances = {}; - const calls = []; - const transform = i => i - for (const troveManager in iotexTMs) { - calls.push({ - target: troveManager - }) - } - - let getCollResults = await sdk.api.abi.multiCall({ - block: chainBlocks.iotex, - calls: calls, - abi: "uint256:getEntireSystemColl", - chain: 'iotex' - }); - - getCollResults.output.forEach((getColl) => { - let address = iotexTMs[getColl.input.target] - let amount = getColl.output - - address = transform(address); - - if (address == 'iotex') { - amount = parseInt(amount / 1e18) - } - - balances[address] = BigNumber(balances[address]|| 0).plus(amount).toFixed() - }); - - const balanceOfCalls = [] - for (const activePool in iotexStableAPs) { - balanceOfCalls.push({ - target: iotexStableAPs[activePool], - params: activePool - }) - } - - let balanceOfResults = await sdk.api.abi.multiCall({ - block: chainBlocks.iotex, - calls: balanceOfCalls, - abi: 'erc20:balanceOf', - chain: 'iotex' - }); - - balanceOfResults.output.forEach((balanceOf) => { - let address = balanceOf.input.target - let amount = balanceOf.output - - address = transform(address); - - balances[address] = BigNumber(balances[address]|| 0).plus(amount).toFixed() - }); - - return transformBalances('iotex', balances) -}; - - -const ethStableCollat = async (timestamp, ethBlock, chainBlocks) => { - const balances = {}; - - const balanceOfCalls = [] - for (const activePool in ethStables) { - balanceOfCalls.push({ - target: ethStables[activePool], - params: activePool - }) - } - - let balanceOfResults = await sdk.api.abi.multiCall({ - block: ethBlock, - calls: balanceOfCalls, - abi: 'erc20:balanceOf', - chain: 'ethereum' - }); - - balanceOfResults.output.forEach((balanceOf) => { - let address = balanceOf.input.target - let amount = balanceOf.output - - balances[address] = BigNumber(balances[address]|| 0).plus(amount).toFixed() - }); - - return balances; -}; - +const optionsStable = { nonNativeCollateralToken: true, abis: { collateralToken: 'address:collTokenAddress', activePool: 'address:stableCollActivePool' } } +const options = { nonNativeCollateralToken: true, abis: { collateralToken: 'address:collToken' } } +const optionsIOTX = { nonNativeCollateralToken: true, abis: { collateralToken: 'address:collTokenAddress' } } module.exports = { - iotex: { - tvl: iotexTvl, - }, - ethereum: { - tvl: sdk.util.sumChainTvls([ - getLiquityTvl(ETH_ADDR,"0x7ee5175dFBD7c66Aa00043493334845376E43a8a", "ethereum"), - getLiquityTvl(BTC_ADDR,"0x675CD7d43d7665f851997B7F0f2B0265a213BAB8", "ethereum"), - ethStableCollat - ]) - }, - arbitrum: { - tvl: getLiquityTvl(ADDRESSES.arbitrum.WETH,"0x561d2d58bdad7a723a2cf71e8909a409dc2112ec", "arbitrum"), - staking: staking('0xc3fbc4056689cfab3f23809aa25004899ff4d75a','0x9eF758aC000a354479e538B8b2f01b917b8e89e7', 'arbitrum'), - }, - polygon: { - tvl: getLiquityTvl(ADDRESSES.polygon.WMATIC_2,"0x68738A47d40C34d890168aB7B612A6f649f395e4", "polygon"), - staking: staking('0x3509f19581afedeff07c53592bc0ca84e4855475','0x3dc7b06dd0b1f08ef9acbbd2564f8605b4868eea', 'polygon'), - }, - avax: { - tvl: getLiquityTvl(ADDRESSES.avax.WAVAX,"0x561d2d58bdad7a723a2cf71e8909a409dc2112ec", "avax"), - staking: staking('0x68738a47d40c34d890168ab7b612a6f649f395e4','0x9ef758ac000a354479e538b8b2f01b917b8e89e7', 'avax', 'polygon:0x3dc7b06dd0b1f08ef9acbbd2564f8605b4868eea'), - }, - hallmarks: [ - [Math.floor(new Date('2022-10-30')/1e3), 'XUSD is no longer counted as part of tvl'], - ], + iotex: { + tvl: sdk.util.sumChainTvls([ + ...[ + '0x9831a3BF768f32202bBFA5369F888DC88CB31b41', + '0x511D2869910ECE987095eCb5aB4b58c38213Ed51', + '0x0BD0cdBf61975f4Cc3E77f595dA8CE4F5f559D0e', + '0x705CA68990e63a54C6df0131DBf5e10517abF3ce', + ].map(i => getLiquityTvl(i, optionsStable)), + getLiquityTvl('0x366D48c04B0d315acF27Bd358558e92D4e2E9f3D', optionsIOTX), + getLiquityTvl('0x7204e2f210865aA1854F33B3532ab2DEb386CB59', optionsIOTX), + ]), + }, + ethereum: { + tvl: sdk.util.sumChainTvls([ + getLiquityTvl("0x7ee5175dFBD7c66Aa00043493334845376E43a8a", options), + getLiquityTvl("0x675CD7d43d7665f851997B7F0f2B0265a213BAB8", options), + getLiquityTvl("0x1e49892c0d0D4455bbbA633EeDaDd6d26224369e", optionsStable), + ]) + }, + arbitrum: { + tvl: getLiquityTvl("0x561d2d58bdad7a723a2cf71e8909a409dc2112ec"), + staking: staking('0xc3fbc4056689cfab3f23809aa25004899ff4d75a', '0x9eF758aC000a354479e538B8b2f01b917b8e89e7'), + }, + polygon: { + tvl: getLiquityTvl("0x68738A47d40C34d890168aB7B612A6f649f395e4"), + staking: staking('0x3509f19581afedeff07c53592bc0ca84e4855475', '0x3dc7b06dd0b1f08ef9acbbd2564f8605b4868eea'), + }, + avax: { + tvl: getLiquityTvl("0x561d2d58bdad7a723a2cf71e8909a409dc2112ec"), + staking: staking('0x68738a47d40c34d890168ab7b612a6f649f395e4', '0x9ef758ac000a354479e538b8b2f01b917b8e89e7'), + }, + hallmarks: [ + [Math.floor(new Date('2022-10-30') / 1e3), 'XUSD is no longer counted as part of tvl'], + ], }; From 365a88d7dcabdc0d9bf8c6f368c83375b7d1379c Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 8 Aug 2023 17:05:39 +0530 Subject: [PATCH 0712/1974] Crowdswap-1 (#7069) * BLOC-1844 * lint fix --------- Co-authored-by: ajalalniya --- projects/crowdswap/index.js | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/projects/crowdswap/index.js b/projects/crowdswap/index.js index 101bca241e5..700cf23a608 100644 --- a/projects/crowdswap/index.js +++ b/projects/crowdswap/index.js @@ -7,27 +7,30 @@ const CROWD = "0x483dd3425278C1f79F377f1034d9d2CaE55648B6"; const BscCROWD = "0xA5d4B64a639d93b660cdA04D331374dA1108F8f5"; async function tvl(_, _b, _cb, { api, }) { - const { factory, fromBlock } = config[api.chain] + const { factories } = config[api.chain] + const ownerTokens = [] - const logs = await getLogs({ - api, - target: factory, - topics: ['0x0d3648bd0f6ba80134a33ba9275ac585d9d315f0ad8355cddefde31afa28d0e9'], - fromBlock, - }) - const pools = logs.map(i => getAddress(i.data.slice(0, 64 + 2))) - const token0s = await api.multiCall({ abi: 'address:token0', calls: pools }) - const token1s = await api.multiCall({ abi: 'address:token1', calls: pools }) - const tokensAndOwners = pools.map((pool, i) => [[token0s[i], pool], [token1s[i], pool]]).flat() - return sumTokens2({ api, tokensAndOwners }) + for (const { factory, fromBlock } of factories) { + const logs = await getLogs({ + api, + target: factory, + topics: ['0x0d3648bd0f6ba80134a33ba9275ac585d9d315f0ad8355cddefde31afa28d0e9'], + fromBlock, + }) + const pools = logs.map(i => getAddress(i.data.slice(0, 64 + 2))) + const token0s = await api.multiCall({ abi: 'address:token0', calls: pools }) + const token1s = await api.multiCall({ abi: 'address:token1', calls: pools }) + pools.map((pool, i) => ownerTokens.push([[token0s[i], token1s[i]], pool])) + } + return sumTokens2({ api, ownerTokens }) } const config = { - ethereum: { factory: '0xBeA843A2DC516c6F38F159a6a55e80Ec40Cf2286', fromBlock: 16882649, }, - arbitrum: { factory: '0x9ff74eea1e7f0f8ee437b70d68f7cdc1a1030642', fromBlock: 91681087, }, - polygon: { factory: '0xab7dac1daf712693539d770a967a9bc7ba47470c', fromBlock: 37984740, }, - bsc: { factory: '0x08f65111cb9b517b10e5c1e63cb2224467e7988a', fromBlock: 25927093, }, - era: { factory: '0x049D3809043d137591687170Fc323DBcDFe83283', fromBlock: 2714942, }, + ethereum: { factories: [{ factory: '0xBeA843A2DC516c6F38F159a6a55e80Ec40Cf2286', fromBlock: 16882649, },], }, + arbitrum: { factories: [{ factory: '0x9ff74eea1e7f0f8ee437b70d68f7cdc1a1030642', fromBlock: 91681087, }, { factory: '0xd61B1c7974DFBC4eD60ea5625f0Ba08E7C80D99a', fromBlock: 114501051, },], }, + polygon: { factories: [{ factory: '0xab7dac1daf712693539d770a967a9bc7ba47470c', fromBlock: 37984740, }, { factory: '0x14Fb5ABeA0578B37D9E1A831Bb7e77Bd3d7684a6', fromBlock: 45261628, },], }, + bsc: { factories: [{ factory: '0x08f65111cb9b517b10e5c1e63cb2224467e7988a', fromBlock: 25927093, },], }, + era: { factories: [{ factory: '0x049D3809043d137591687170Fc323DBcDFe83283', fromBlock: 2714942, },], }, } Object.keys(config).forEach(chain => { From 0d9e1540baeee20581fc8a807618ca33dbb9dbae Mon Sep 17 00:00:00 2001 From: chainupk <121842069+chainupk@users.noreply.github.com> Date: Tue, 8 Aug 2023 19:36:48 +0800 Subject: [PATCH 0713/1974] Added Swap Pool Balance and Contract Balance (#7064) * updated nodedao etehreum tvl calculations * included balance in contract and the amount in SWAP pool * minor fix --------- Co-authored-by: zhenhao goh Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/hashking/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/projects/hashking/index.js b/projects/hashking/index.js index 036bf811bad..f2c4d6a0118 100644 --- a/projects/hashking/index.js +++ b/projects/hashking/index.js @@ -7,7 +7,11 @@ module.exports = { const validators = await api.call({ target: owner, abi: 'function beneficiarys() public view returns (address [] memory)'}) const bals = await api.multiCall({ abi: 'uint256:totalStakingFil', calls: validators}) bals.forEach(i => api.add(nullAddress, i)) - return sumTokens2({ api, owners: [owner], tokens: [nullAddress]}) + const wFILContract = "0xD9A724840a46370c01a50C1E511087ab3a07FB53" + const totalSupply = await api.call({ target: wFILContract, abi: 'uint256:totalSupply'}) + const liquidStakingContract = "0xe012F3957226894B1a2a44b3ef5070417a069dC2" + api.add(nullAddress, totalSupply) + return sumTokens2({ api, owners: [owner, liquidStakingContract,], tokens: [nullAddress]}) } } } \ No newline at end of file From 456993fdb428e1d74519034a1bd3e116852642db Mon Sep 17 00:00:00 2001 From: Britt Cyr Date: Tue, 8 Aug 2023 09:35:28 -0400 Subject: [PATCH 0714/1974] Include reverse vaults in staking options vaults (#7062) --- projects/dual/index.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/projects/dual/index.js b/projects/dual/index.js index cf0656a03cb..5d9e03c50be 100644 --- a/projects/dual/index.js +++ b/projects/dual/index.js @@ -26,7 +26,8 @@ async function tvl() { const soTokenAccounts = stakingOptionsAccounts .map(i => parseSoState(i.account.data)) - .map(i => i.vault) + .map(i => [i.vault, i.reverseVault]) + .flat() const gsoProgramID = new PublicKey("DuALd6fooWzVDkaTsQzDAxPGYCnLrnWamdNNTNxicdX8"); let gsoAccounts = await connection.getProgramAccounts(gsoProgramID, { @@ -87,10 +88,21 @@ function parseSoState(buf) { new PublicKey("4yx1NJ4Vqf2zT1oVLk4SySBhhDJXmXFt88ncm4gPxtL7") )[0].toBase58(); + // TODO: If the reverse vault does not exist, do not include. + const reverseVault = PublicKey.findProgramAddressSync( + [ + Buffer.from(anchor.utils.bytes.utf8.encode("so-reverse-vault")), + Buffer.from(anchor.utils.bytes.utf8.encode(soName)), + baseMint.toBuffer(), + ], + new PublicKey("4yx1NJ4Vqf2zT1oVLk4SySBhhDJXmXFt88ncm4gPxtL7") + )[0].toBase58(); + return { soName, baseMint, vault, + reverseVault, }; } From 9c2ece643f4a69320bc4f462a5313717d7e18d17 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 8 Aug 2023 15:43:22 +0200 Subject: [PATCH 0715/1974] bugfix --- projects/neuron/index.js | 23 ++++------------------- 1 file changed, 4 insertions(+), 19 deletions(-) diff --git a/projects/neuron/index.js b/projects/neuron/index.js index cb4ba163e9e..2cd52616304 100644 --- a/projects/neuron/index.js +++ b/projects/neuron/index.js @@ -1,7 +1,5 @@ const { getConfig } = require('../helper/cache') - const { chainExports } = require('../helper/exports'); -const { sumTokens } = require("../helper/unwrapLPs"); const http_api_url = 'https://brain.goneuron.xyz/api_special/getChainTVL'; const operator = '0xebb14128e98b2966EAb5b7da3a83e8c2edca0313'; @@ -13,25 +11,12 @@ const chainIds = { }; function chainTvl(chain) { - return async (timestamp, ethBlock, {[chain]: block}) => { - const balances = {}; - const transformAddress = id=>`${chain}:${id}`; - - const url = `${http_api_url}?chainId=${chainIds[chain]}`; + return async (timestamp, ethBlock, {[chain]: block}, { api }) => { + const url = `${http_api_url}?chainId=${api.getChainId()}`; const neuron_response = await getConfig('neuron/'+chain, url); - - const tokensAndOwners = neuron_response.map(subArray => [subArray[0], operator]); - - await sumTokens(balances, tokensAndOwners, block, chain, transformAddress); - - return balances + return api.sumTokens({ owner: operator, tokens: neuron_response.map(i => i[0]) }) }; } -module.exports = chainExports(chainTvl, [ - 'arbitrum', - 'optimism', - 'linea', - 'base', -]), +module.exports = chainExports(chainTvl, Object.keys(chainIds)), module.exports.methodology = 'neuron TVL is made of token balances of the neuron Outpost constracts. The deployed tokens are retrieved using HTTP REST API.' From c98ba2dd46514123bd21808c85d9f64b8de2973c Mon Sep 17 00:00:00 2001 From: neuron team <141687054+goneuronxyz@users.noreply.github.com> Date: Tue, 8 Aug 2023 14:44:00 +0100 Subject: [PATCH 0716/1974] Added neuron integration (#7061) * Added neuron integration * bugfix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/neuron/index.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 projects/neuron/index.js diff --git a/projects/neuron/index.js b/projects/neuron/index.js new file mode 100644 index 00000000000..2cd52616304 --- /dev/null +++ b/projects/neuron/index.js @@ -0,0 +1,22 @@ +const { getConfig } = require('../helper/cache') +const { chainExports } = require('../helper/exports'); + +const http_api_url = 'https://brain.goneuron.xyz/api_special/getChainTVL'; +const operator = '0xebb14128e98b2966EAb5b7da3a83e8c2edca0313'; +const chainIds = { + arbitrum : 42161, + optimism : 10, + linea : 59144, + base: 8453, +}; + +function chainTvl(chain) { + return async (timestamp, ethBlock, {[chain]: block}, { api }) => { + const url = `${http_api_url}?chainId=${api.getChainId()}`; + const neuron_response = await getConfig('neuron/'+chain, url); + return api.sumTokens({ owner: operator, tokens: neuron_response.map(i => i[0]) }) + }; +} + +module.exports = chainExports(chainTvl, Object.keys(chainIds)), +module.exports.methodology = 'neuron TVL is made of token balances of the neuron Outpost constracts. The deployed tokens are retrieved using HTTP REST API.' From 4462a0685360c5bab4074d3d56a0d27fef362298 Mon Sep 17 00:00:00 2001 From: Aleksei Lushnikov Date: Tue, 8 Aug 2023 14:44:41 +0100 Subject: [PATCH 0717/1974] symbiosis adds Base portal liquidity, add WETH on Mantle chain (#7065) --- projects/helper/coreAssets.json | 3 ++- projects/symbiosis-finance/config.js | 11 +++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index 714a50dad61..02928a6ca46 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -1345,6 +1345,7 @@ "WETH": "0xe5D7C2a44FfDDf6b295A15c148167daaAf5Cf34f" }, "base": { - "WETH": "0x4200000000000000000000000000000000000006" + "WETH": "0x4200000000000000000000000000000000000006", + "USDbC": "0xd9aAEc86B65D86f6A7B5B1b0c42FFA531710b6CA" } } diff --git a/projects/symbiosis-finance/config.js b/projects/symbiosis-finance/config.js index d344a09f57a..9ebd6e8f9a8 100644 --- a/projects/symbiosis-finance/config.js +++ b/projects/symbiosis-finance/config.js @@ -169,6 +169,7 @@ module.exports = { name: 'mantle', tokens: [ ADDRESSES.mantle.USDC, + ADDRESSES.mantle.WETH, ], holders: [ '0x292fC50e4eB66C3f6514b9E402dBc25961824D62', // portal v2 @@ -183,5 +184,15 @@ module.exports = { '0x292fC50e4eB66C3f6514b9E402dBc25961824D62', // portal v2 ] }, + { + name: 'base', + tokens: [ + ADDRESSES.base.WETH, + ADDRESSES.base.USDbC, + ], + holders: [ + '0x5Aa5f7f84eD0E5db0a4a85C3947eA16B53352FD4', // portal v2 + ] + }, ] } \ No newline at end of file From 5924ff1bce3daeab4e282a953c2bdb78e2ebe60c Mon Sep 17 00:00:00 2001 From: AntiHeroFinance <141676757+AntiHeroFinance@users.noreply.github.com> Date: Tue, 8 Aug 2023 22:02:13 +0800 Subject: [PATCH 0718/1974] AntiHero Finance (#7060) * Listng AntiHero Finance * rename file --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/antihero-fi/index.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 projects/antihero-fi/index.js diff --git a/projects/antihero-fi/index.js b/projects/antihero-fi/index.js new file mode 100644 index 00000000000..1973a1222cf --- /dev/null +++ b/projects/antihero-fi/index.js @@ -0,0 +1,18 @@ +const { compoundExports } = require("../helper/compound"); +const { staking } = require("../helper/staking"); + +const unitroller = "0x3646bF53C17EbBE4ce5e389Cd3c73Bc818Ff7e46"; + +module.exports = { + methodology: + "Same as Compound Finance, we just count all the tokens supplied (not borrowed money) on the lending markets", + arbitrum: { + ...compoundExports(unitroller, "arbitrum"), + staking: staking( + [ + "0x2117E6449b3C50B70705bF1566383b1a94bd5192", + ], + "0x9d15bb4351E95A3FE213E48B410BA1aB7CF8Ce45" + ), + }, +}; \ No newline at end of file From 387e4ffb75c9263b929d582f9aafe25f61b569fd Mon Sep 17 00:00:00 2001 From: sky2krva <136867714+sky2krva@users.noreply.github.com> Date: Tue, 8 Aug 2023 22:31:24 +0800 Subject: [PATCH 0719/1974] Add KRAV protocol tvl (#7070) * Add KRAV protocol tvl * update krav --------- Co-authored-by: yuhuakukude Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/krav/index.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 projects/krav/index.js diff --git a/projects/krav/index.js b/projects/krav/index.js new file mode 100644 index 00000000000..088afa3364a --- /dev/null +++ b/projects/krav/index.js @@ -0,0 +1,28 @@ +const { getLogs } = require('../helper/cache/getLogs') +const { sumTokensExport } = require('../helper/unwrapLPs') + +const KRAV = '0xbe3111856e4aca828593274ea6872f27968c8dd6' +const config = { + base: { factory: '0xFfD88F38025e02f9d2eB7F0875060F6B4a20980a', fromBlock: 2300044, KRAV: '0xbe3111856e4aca828593274ea6872f27968c8dd6', kravPool: '0x3e558c2378aa7d405b2ed67f510d390bcdbf4d96' }, +} + +Object.keys(config).forEach(chain => { + const { factory, fromBlock, KRAV, kravPool } = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const logs = await getLogs({ + api, + target: factory, + topics: ['0x5c81c71af616b8773a312ce82b16990e78cb55072a05427bc7fb08bbae50959d'], + eventAbi: 'event QuantoCreated(uint256, int256, address token, address, address, address, address, address, address, address pool, address)', + onlyArgs: true, + fromBlock, + }) + return api.sumTokens({ tokensAndOwners: logs.map(i => [i.token, i.pool]), blacklistedTokens: [KRAV] }) + } + } + if (kravPool) + module.exports[chain].staking = sumTokensExport({ owner: kravPool, tokens: [KRAV]}) +}) + + From eeaad15acc4a814970698497743aab4e2fcbbb55 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 8 Aug 2023 17:14:17 +0200 Subject: [PATCH 0720/1974] kyber: track linea --- projects/gainsNetwork.js | 4 ++-- projects/kyber-classic/index.js | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/projects/gainsNetwork.js b/projects/gainsNetwork.js index 25ddb327f6a..d031fe7b9d6 100644 --- a/projects/gainsNetwork.js +++ b/projects/gainsNetwork.js @@ -23,11 +23,11 @@ async function polyTvl(_, _b, _cb, { api }) { ]; return sumTokens2({ api, tokensAndOwners }); } -async function arbiTvl(_, _b, cb) { +async function arbiTvl(_, _b, cb, { api}) { const tokensAndOwners = [ [tokens.arbitrum.DAI, "0xd85E038593d7A098614721EaE955EC2022B9B91B"], ]; - return sumTokens2({ chain: "arbitrum", tokensAndOwners }); + return sumTokens2({ api, tokensAndOwners }); } // node test.js projects/gainsNetwork.js module.exports = { diff --git a/projects/kyber-classic/index.js b/projects/kyber-classic/index.js index 21151fe0e07..b5cbdd9c6d9 100644 --- a/projects/kyber-classic/index.js +++ b/projects/kyber-classic/index.js @@ -38,6 +38,7 @@ const chains = { velas: { factory: "0xD9bfE9979e9CA4b2fe84bA5d4Cf963bBcB376974" }, oasis: { factory: "0xD9bfE9979e9CA4b2fe84bA5d4Cf963bBcB376974" }, bittorrent: { factory: "0xD9bfE9979e9CA4b2fe84bA5d4Cf963bBcB376974" }, + linea: { factory: "0x1c758af0688502e49140230f6b0ebd376d429be5" }, }; function classic(chain) { From c850c0fdd6b597797a1543d079748994ff03b997 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 8 Aug 2023 17:25:41 +0200 Subject: [PATCH 0721/1974] track https://phoenixfi.app/ --- projects/phoenixfi-app/index.js | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 projects/phoenixfi-app/index.js diff --git a/projects/phoenixfi-app/index.js b/projects/phoenixfi-app/index.js new file mode 100644 index 00000000000..fb9fc59ce8c --- /dev/null +++ b/projects/phoenixfi-app/index.js @@ -0,0 +1,9 @@ +const { nullAddress } = require('../helper/tokenMapping') +const { sumTokensExport } = require('../helper/chain/ergo') + +module.exports = { + timetravel: false, + ergo: { + tvl: sumTokensExport({ owner: 'TZPn3oLcgqXcSLXXguTKqW6TXsMC9brGikXUrMfygBTPdeLgbKLkWj63EQ8rUQQodcVveRjDSigJ3CVd8yjeBwY4jQLr6ZMxDXTPn7V42zNTskCp18maQwN3p4S82tezBcJnTdWoSzeQVbqhARUyNNFjKdyKc6Z49XKkQL7jktSJcG4fnFayBqPZRhQMEB1ZZ12bU2rX5SkQj5jE65N2ZFCTi6WbNeNWWZQYPtZv8fGVLmNdhxgg968LYPLNLBJVa7rUo6Nyce4CszBYq44bD14rvKMZXq1zQ6ZjkFRfmXjDFg92MsXGuENuZdPnTgKJ7Cdct3EP4UFjgZx1PQSauX8own7pPEAf9MBRdF84WNqo9cbZhvrhUVvispD6bP2AoCZWKkrppi1atoV22RPxbouC1rkpsKW287HAXxfiwP8VKVDRUi1aVjRvFP13RpyrBf9cu1z44xnJwTC9ui38XPAUjz4DWp87mGh6JC54z2Mqyk2nEaai7nBP4fPW53XSExd5AK5JC9fVyfdrRtiR5ADkcc2yqXrF', tokens: [nullAddress] }) + }, +} From da8071afa063cadd14bd13b720d19155416e526f Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 8 Aug 2023 17:53:18 +0200 Subject: [PATCH 0722/1974] fix tron rpc issue --- projects/helper/cex.js | 2 +- projects/helper/unwrapLPs.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/helper/cex.js b/projects/helper/cex.js index 1cab1ef267a..f67e75673e7 100644 --- a/projects/helper/cex.js +++ b/projects/helper/cex.js @@ -96,7 +96,7 @@ const defaultTokens = { nullAddress, ADDRESSES.tron.USDT, // USDT ADDRESSES.tron.USDC, // USDC - 'TFptbWaARrWTX5Yvy3gNG5Lm8BmhPx82Bt', //wbt + // 'TFptbWaARrWTX5Yvy3gNG5Lm8BmhPx82Bt', //wbt ADDRESSES.tron.TUSD, 'TThzxNRLrW2Brp9DcTQU8i4Wd9udCWEdZ3', // stUSDT ], diff --git a/projects/helper/unwrapLPs.js b/projects/helper/unwrapLPs.js index ffe169255a8..eb9ae76f0aa 100644 --- a/projects/helper/unwrapLPs.js +++ b/projects/helper/unwrapLPs.js @@ -733,7 +733,7 @@ async function sumTokens2({ log(chain, 'summing tokens', tokensAndOwners.length) if (chain === 'tron') { - const tokensAndOwnersChunks = sliceIntoChunks(tokensAndOwners, 3) + const tokensAndOwnersChunks = sliceIntoChunks(tokensAndOwners, 1) for (const toa of tokensAndOwnersChunks) { await sumTokens(balances, toa, block, chain, transformAddress, { resolveLP, unwrapAll, blacklistedLPs, skipFixBalances: true, abis, permitFailure, }) } From 91b1ea95d5c604ae055a3177afb5f46433a02040 Mon Sep 17 00:00:00 2001 From: Define101 <93603962+Define101@users.noreply.github.com> Date: Tue, 8 Aug 2023 16:56:41 +0100 Subject: [PATCH 0723/1974] test huobi (#7066) * test huobi * add methodology * fix tron rpc issue --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/helper/cex.js | 2 +- projects/helper/unwrapLPs.js | 2 +- projects/huobi/index.js | 39 ++++++++++++++++++++++++++++++++++-- 3 files changed, 39 insertions(+), 4 deletions(-) diff --git a/projects/helper/cex.js b/projects/helper/cex.js index 1cab1ef267a..f67e75673e7 100644 --- a/projects/helper/cex.js +++ b/projects/helper/cex.js @@ -96,7 +96,7 @@ const defaultTokens = { nullAddress, ADDRESSES.tron.USDT, // USDT ADDRESSES.tron.USDC, // USDC - 'TFptbWaARrWTX5Yvy3gNG5Lm8BmhPx82Bt', //wbt + // 'TFptbWaARrWTX5Yvy3gNG5Lm8BmhPx82Bt', //wbt ADDRESSES.tron.TUSD, 'TThzxNRLrW2Brp9DcTQU8i4Wd9udCWEdZ3', // stUSDT ], diff --git a/projects/helper/unwrapLPs.js b/projects/helper/unwrapLPs.js index ffe169255a8..eb9ae76f0aa 100644 --- a/projects/helper/unwrapLPs.js +++ b/projects/helper/unwrapLPs.js @@ -733,7 +733,7 @@ async function sumTokens2({ log(chain, 'summing tokens', tokensAndOwners.length) if (chain === 'tron') { - const tokensAndOwnersChunks = sliceIntoChunks(tokensAndOwners, 3) + const tokensAndOwnersChunks = sliceIntoChunks(tokensAndOwners, 1) for (const toa of tokensAndOwnersChunks) { await sumTokens(balances, toa, block, chain, transformAddress, { resolveLP, unwrapAll, blacklistedLPs, skipFixBalances: true, abis, permitFailure, }) } diff --git a/projects/huobi/index.js b/projects/huobi/index.js index 3aebb40b91d..8808b331f05 100644 --- a/projects/huobi/index.js +++ b/projects/huobi/index.js @@ -8,7 +8,11 @@ const config = { '1KVpuCfhftkzJ67ZUegaMuaYey7qni7pPj', //These 3 addresses has 48,555 #Bitcoin. This is only less than 3% of the total high value assets we have, including btc, usd, stablecoins, T-bills.. According to Justin Sun https://twitter.com/justinsuntron/status/1590311559242612743 '14XKsv8tT6tt8P8mfDQZgNF8wtN5erNu5D', - '1LXzGrDQqKqVBqxfGDUyhC6rTRBN5s8Sbj' + '1LXzGrDQqKqVBqxfGDUyhC6rTRBN5s8Sbj', + '1HckjUpRGcrrRAtFaaCAUaGjsPx9oYmLaZ', // add on 08/08/2023 (we defillama) + '1L15W6b9vkxV81xW5HDtmMBycrdiettHEL', // add on 08/08/2023 (we defillama) + '14o5ywJJmLPJe8egNo7a5fSdtEgarkus33', // add on 08/08/2023 (we defillama) + '1BuiWj9wPbQwNY97xU53LRPhzqNQccSquM', // add on 08/08/2023 (we defillama) ], }, ethereum: { @@ -21,7 +25,29 @@ const config = { '0xE4818f8fDe0C977A01DA4Fa467365B8bF22b071E', '0x5C985E89DDe482eFE97ea9f1950aD149Eb73829B', '0xc589b275e60dda57ad7e117c6dd837ab524a5666', - ] + '0x6b2286fc3a9265bab3f064808022aca54de4b6ce', // add on 08/08/2023 (we defillama) + '0x3d655889d197125fb90dcb72e4a287a8410ed1b9', // add on 08/08/2023 (we defillama) + '0x2abc22eb9a09ebbe7b41737ccde147f586efeb6a', // add on 08/08/2023 (we defillama) + '0xa5d7f0f7027fa8f4d1be8042e1e43bbdec36951e', // add on 08/08/2023 (we defillama) + '0xeee28d484628d41a82d01e21d12e2e78d69920da', // add on 08/08/2023 (we defillama) + '0x6748f50f686bfbca6fe8ad62b22228b87f31ff2b', // add on 08/08/2023 (we defillama) + '0x34189c75cbb13bdb4f5953cda6c3045cfca84a9e', // add on 08/08/2023 (we defillama) + '0x1062a747393198f70f71ec65a582423dba7e5ab3', // add on 08/08/2023 (we defillama) + '0xab5c66752a9e8167967685f1450532fb96d5d24f', // add on 08/08/2023 (we defillama) + '0xdb0e89a9b003a28a4055ef772e345e8089987bfd', // add on 08/08/2023 (we defillama) + '0xfdb16996831753d5331ff813c29a93c76834a0ad', // add on 08/08/2023 (we defillama) + '0x46705dfff24256421a05d056c29e81bdc09723b8', // add on 08/08/2023 (we defillama) + '0xfd54078badd5653571726c3370afb127351a6f26', // add on 08/08/2023 (we defillama) + '0x07ef60deca209ea0f3f3f08c1ad21a6db5ef9d33', // add on 08/08/2023 (we defillama) + '0x18916e1a2933cb349145a280473a5de8eb6630cb', // add on 08/08/2023 (we defillama) + '0xfa4b5be3f2f84f56703c42eb22142744e95a2c58', // add on 08/08/2023 (we defillama) + '0x0a98fb70939162725ae66e626fe4b52cff62c2e5', // add on 08/08/2023 (we defillama) + '0x918800e018a0eeea672740f88a60091c7d327a79', // add on 08/08/2023 (we defillama) + '0xadb2b42f6bd96f5c65920b9ac88619dce4166f94', // add on 08/08/2023 (we defillama) + '0x42dc966b7ecc3c6cc73e7bc04862859d5bddce65', // add on 08/08/2023 (we defillama) + '0xe8d8a02601f54acb6fb69537be1f1d7cc76ccd8c', // add on 08/08/2023 (we defillama) + '0xf881bcb3705926cea9c598ab05a837cf41a833a9', // add on 08/08/2023 (we defillama) + ] }, polygon: { owners: ['0xd70250731a72c33bfb93016e3d1f0ca160df7e42'] @@ -46,6 +72,8 @@ const config = { 'THZovMcKoZaV9zzFTWteQYd2f3NEvnzxAM', 'TZ1SsapyhKNWaVLca6P2qgVzkHTdk6nkXa', 'TDvf1dSBhR7dEskJs17HxGHheJrjXhiFyM', + 'TUJGLHo3rq4EAUY1LHRhNkHPX8qmrv9WFs', // add on 08/08/2023 (we defillama) + 'TRSXRWudzfzY4jH7AaMowdMNUXDkHisbcd' // add on 08/08/2023 (we defillama) ] }, algorand: { @@ -60,6 +88,13 @@ const config = { ripple: { owners: ['rKUDvXFJMFu65LqPTH3Yfpii4rbKT9bSQT'], }, + arbitrum: { + owners: ['0xf2dbc42875e7764edbd89732a15214a9a0deb085'], + }, + optimism: { + owners: ['0x9ef21be1c270aa1c3c3d750f458442397fbffcb6'], + }, } module.exports = cexExports(config) +module.exports.methodology = 'We added the wallets from here https://github.com/huobiapi/Tool-Node.js-VerifyAddress/blob/main/snapshot/huobi_por_20230701.csv . We are not tracking 3 wallets, 2 on Heco Chain, 1 on BTTC chain. We also count stUSDT.' From 76282cf931630dbc66a3be6f99f13407e6e722fd Mon Sep 17 00:00:00 2001 From: Curbis Norris <130688524+curbisn@users.noreply.github.com> Date: Tue, 8 Aug 2023 12:03:44 -0400 Subject: [PATCH 0724/1974] Dexilla: add AXL/USDC.e on Arbitrum chain (#7072) * add Dexilla project * Update contract * update timestamp * add optimism chain * add V.4 contracts * add zk contracts * add arbitrum contracts * add base chain * add v.5 contracts * add AXL/USDC.e contract on arbitrum chain --- projects/dexilla/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/dexilla/index.js b/projects/dexilla/index.js index f58f340d4c0..b46d44ffdd0 100644 --- a/projects/dexilla/index.js +++ b/projects/dexilla/index.js @@ -31,6 +31,7 @@ const config = { '0x66A724fa0CEB8adfa064afEf5102A2e04E4264c6', '0x5dD2a1C1Fb25E30928C901a28Ceaf53E59B606dD', '0xb56F90d3038AAD5B5E8de9be3008C7CCEA2D6600', + '0x51c0378f913Fe3b79580E54AE5FB8682b856b5B6', ], }, base:{ From ab8412bcd2cce7d0ac99fc6455f007caa5ec6ce1 Mon Sep 17 00:00:00 2001 From: Rudy <33031003+rudy5348@users.noreply.github.com> Date: Wed, 9 Aug 2023 02:22:19 +0800 Subject: [PATCH 0725/1974] update raydium tvl func (#7071) * update raydium tvl func * minor refactor --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/aldrin/index.js | 9 ++++--- projects/helper/solana.js | 41 ++++++++++++++++++++++++++++++-- projects/openbook/index.js | 9 ++----- projects/raydium.js | 48 +++++++++++++++++++++++++++++--------- projects/serum.js | 10 ++------ 5 files changed, 84 insertions(+), 33 deletions(-) diff --git a/projects/aldrin/index.js b/projects/aldrin/index.js index 5683eb5ac49..411e02164a9 100644 --- a/projects/aldrin/index.js +++ b/projects/aldrin/index.js @@ -1,7 +1,6 @@ const { Program } = require("@project-serum/anchor"); -const { getProvider, sumTokens2, } = require("../helper/solana"); +const { getProvider, sumTokens2, blacklistedTokens_default} = require("../helper/solana"); const idl = require('./idl.json') -const blacklistedTokens = ['A7rqejP8LKN8syXMr4tvcKjs2iJ4WtZjXNs1e6qP3m9g'] async function tvl() { const provider = getProvider() @@ -11,9 +10,9 @@ async function tvl() { const pairsV2 = await programV2.account.pool.all() const tokenAccounts = [] const addPool = ({ account }) => { - if (!blacklistedTokens.includes(account.quoteTokenMint.toString())) + if (!blacklistedTokens_default.includes(account.quoteTokenMint.toString())) tokenAccounts.push(account.quoteTokenVault.toString()) - if (!blacklistedTokens.includes(account.baseTokenMint.toString())) + if (!blacklistedTokens_default.includes(account.baseTokenMint.toString())) tokenAccounts.push(account.baseTokenVault.toString()) } pairs.forEach(addPool) @@ -22,7 +21,7 @@ async function tvl() { } async function staking() { - return sumTokens2({ tokenAccounts: ['BAhtu6WzzTY72abMwNcjm8P6QvASaQNWnLY94ma69ocu'], blacklistedTokens: ['A7rqejP8LKN8syXMr4tvcKjs2iJ4WtZjXNs1e6qP3m9g'] }) + return sumTokens2({ tokenAccounts: ['BAhtu6WzzTY72abMwNcjm8P6QvASaQNWnLY94ma69ocu'] }) } module.exports = { diff --git a/projects/helper/solana.js b/projects/helper/solana.js index e7e2a773128..45d660eec40 100644 --- a/projects/helper/solana.js +++ b/projects/helper/solana.js @@ -9,7 +9,8 @@ const { AnchorProvider: Provider, Wallet, } = require("@project-serum/anchor"); const { sleep, sliceIntoChunks, log, } = require('./utils') const { decodeAccount } = require('./utils/solana/layout') -const sdk = require('@defillama/sdk') +const sdk = require('@defillama/sdk'); +const { TOKEN_PROGRAM_ID } = require('@project-serum/anchor/dist/cjs/utils/token'); const blacklistedTokens_default = [ 'CowKesoLUaHSbAMaUxJUj7eodHHsaLsS65cy8NFyRDGP', @@ -17,6 +18,8 @@ const blacklistedTokens_default = [ 'SNSNkV9zfG5ZKWQs6x4hxvBRV6s8SqMfSGCtECDvdMd', // SNS 'A7rqejP8LKN8syXMr4tvcKjs2iJ4WtZjXNs1e6qP3m9g', // ZION '2HeykdKjzHKGm2LKHw8pDYwjKPiFEoXAz74dirhUgQvq', // SAO + 'EP2aYBDD4WvdhnwWLUMyqU69g1ePtEjgYK6qyEAFCHTx', //KRILL + 'C5xtJBKm24WTt3JiXrvguv7vHCe7CknDB7PNabp4eYX6', //TINY ] let connection, provider @@ -94,6 +97,29 @@ async function getTokenDecimals(tokens) { return res } +function formOwnerBalanceQuery(owner, programId = TOKEN_PROGRAM_ID) { + return { + jsonrpc: "2.0", + id: 1, + method: "getTokenAccountsByOwner", + params: [ + owner, + { programId: String(programId) }, + { encoding: "jsonParsed", }, + ], + } +} +async function getOwnerAllAccount(owner) { + const tokenBalance = await axios.post(endpoint(), formOwnerBalanceQuery(owner)); + return tokenBalance.data.result.value.map(i => ({ + account: i.pubkey, + mint: i.account.data.parsed.info.mint, + amount: i.account.data.parsed.info.tokenAmount.amount, + uiAmount: i.account.data.parsed.info.tokenAmount.uiAmount, + decimals: i.account.data.parsed.info.tokenAmount.decimals, + })) +} + function formTokenBalanceQuery(token, account) { return { jsonrpc: "2.0", @@ -322,11 +348,20 @@ async function sumTokens2({ blacklistedTokens = [], allowError = false, }) { + blacklistedTokens.push(...blacklistedTokens_default) if (!tokensAndOwners.length) { if (owner) tokensAndOwners = tokens.map(t => [t, owner]) if (owners.length) tokensAndOwners = tokens.map(t => owners.map(o => [t, o])).flat() } - blacklistedTokens.push(...blacklistedTokens_default) + if (!tokensAndOwners.length && !tokens.length && (owner || owners.length > 0)) { + for (const _owner of [...owners, owner]) { + const data = await getOwnerAllAccount(_owner) + for (const item of data) { + if (blacklistedTokens.includes(item.mint) || +item.amount < 1e6) continue; + sdk.util.sumSingleBalance(balances, 'solana:' + item.mint, item.amount) + } + } + } tokensAndOwners = tokensAndOwners.filter(([token]) => !blacklistedTokens.includes(token)) @@ -415,4 +450,6 @@ module.exports = { readBigUInt64LE, decodeAccount, getValidGeckoSolTokens, + getOwnerAllAccount, + blacklistedTokens_default, }; diff --git a/projects/openbook/index.js b/projects/openbook/index.js index 072f8a7bae0..9db8cf748e1 100644 --- a/projects/openbook/index.js +++ b/projects/openbook/index.js @@ -1,12 +1,7 @@ -const { getConnection, decodeAccount, } = require('../helper/solana') +const { getConnection, decodeAccount, blacklistedTokens_default, } = require('../helper/solana') const sdk = require('@defillama/sdk') const { PublicKey } = require("@solana/web3.js") -const blacklistedTokens = new Set([ - '674PmuiDtgKx3uKuJ1B16f9m5L84eFvNwj3xDMvHcbo7', // $WOOD - 'SNSNkV9zfG5ZKWQs6x4hxvBRV6s8SqMfSGCtECDvdMd', // SNS - 'A7rqejP8LKN8syXMr4tvcKjs2iJ4WtZjXNs1e6qP3m9g', // ZION - 'NGK3iHqqQkyRZUj4uhJDQqEyKKcZ7mdawWpqwMffM3s', //YAKU -]) +const blacklistedTokens = new Set(blacklistedTokens_default) async function tvl(_, _1, _2, { api }) { const connection = getConnection() diff --git a/projects/raydium.js b/projects/raydium.js index 972f9f94e70..74391c855aa 100644 --- a/projects/raydium.js +++ b/projects/raydium.js @@ -1,6 +1,6 @@ -const { getConnection, sumTokens2, decodeAccount, getValidGeckoSolTokens, sumTokens, } = require("./helper/solana"); +const { getConnection, sumTokens2, decodeAccount, } = require("./helper/solana"); const { PublicKey, } = require("@solana/web3.js"); -const sdk = require('@defillama/sdk') +const sdk = require('@defillama/sdk'); const CLMM = 'CAMMCzo5YL8w4VFF8KVHrK22GGUsp5VTaW7grrKgrWqK' const AmmV4 = '675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8' @@ -33,21 +33,47 @@ async function tvlCLMM() { async function ammV4Tvl() { const owner = '5Q544fKrFoe6tsEbD7S8EmxGTJYAKtTVhAW5Q5pge4j1' - return sumTokens2({ owner, tokens: [...await getValidGeckoSolTokens()], blacklistedTokens: [ - '674PmuiDtgKx3uKuJ1B16f9m5L84eFvNwj3xDMvHcbo7', // $WOOD - 'SNSNkV9zfG5ZKWQs6x4hxvBRV6s8SqMfSGCtECDvdMd', // SNS - 'A7rqejP8LKN8syXMr4tvcKjs2iJ4WtZjXNs1e6qP3m9g', // ZION - 'RdFHYW7mPJouuSpb5vEzUfbHeQedmQMuCoHN4VQkUDn', // LUCHOW - 'RFn7mUjf24UFMBdDVmoggAii4gyHdRDDqmKzGVbkd8c', // FOUR - 'FTD9EisrsMt5TW5wSTMqyXLh2o7xTb6KNuTiXgHhw8Q8', // POLYPLAY - ]}) + return sumTokens2({ owner }) +} + +async function ammV2V3() { + return sumTokens2({ tokenAccounts: [ + // v2 + '8tA74jqYPNmr8pcvZE3FBxmLMDqFMvZryny8XojCD5CE', + '7t51g6PFAfnBtWqooQhHErneVqQb4SN1QuPnG7iGa87M', + '5fHS778vozoDDYzzJz2xYG39whTzGGW6bF71GVxRyMXi', + 'CzVe191iLM2E31DBW7isXpZBPtcufRRsaxNRc8uShcEs', + 'G2zmxUhRGn12fuePJy9QsmJKem6XCRnmAEkf8G6xcRTj', + 'H617sH2JNjMqPhRxsu43C8vDYfjZrFuoMEKdJyMu7V3t', + 'CJukFFmH9FZ98uzFkUNgqRn8xUmSBTUETEDUMxZXk6p8', + 'DoZyq9uo3W4WWBZJvPCvfB5cCBFvjU9oq3DdYjNgJNRX', + 'Gej1jXVRMdDKWSxmEZ78KJp5jruGJfR9dV3beedXe3BG', + 'FUDEbQKfMTfAaKS3dGdPEacfcC9bRpa5gmmDW8KNoUKp', + '3NAqRJFepsd2dae98Yj7uALQxiV1YRcZJoUcuXErK1FF', + '9RPGJb7pSyiLKKACmeoSgqeypiEymZneBHWbHerQC9Qm', + '7r5YjMLMnmoYkD1bkyYq374yiTBG9XwBHMwi5ZVDptre', + '6vMeQvJcC3VEGvtZ2TDXcShZerevxkqfW43yjX14vmSz', + 'CvcqJtGdS9C1jKKFzgCi5p8qsnR5BZCohWvYMBJXcnJ8', + 'AiYm8jzb2WB4HTTFTHX1XCS7uVSQM5XWnMsure5sMeQY', + // v3 + 'DujWhSxnwqFd3TrLfScyUhJ3FdoaHrmoiVE6kU4ETQyL', + 'D6F5CDaLDCHHWfE8kMLbMNAFULXLfM572AGDx2a6KeXc', + 'Eg6sR9H28cFaek5DVdgxxDcRKKbS85XvCFEzzkdmYNhq', + '8g2nHtayS2JnRxaAY5ugsYC8CwiZutQrNWA9j2oH8UVM', + 'DTQTBTSy3tiy7kZZWgaczWxs9snnTVTi8DBYBzjaVwbj', + 'Bk2G4zhjB7VmRsaBwh2ijPwq6tavMHALEq4guogxsosT', + 'ENjXaFNDiLTh44Gs89ZtfUH2i5MGLLkfYbSY7TmP4Du3', + '9uzWJD2WqJYSmB6UHSyPMskFGoP5L6hB7FxqUdYP4Esm', + 'Fy6SnHwAkxoGMhUH2cLu2biqAnHmaAwFDDww9k6gq5ws', + 'GoRindEPofTJ3axsonTnbyf7cFwdFdG1A3MG9ENyBZsn', + ] }) } module.exports = { timetravel: false, hallmarks: [[1667865600, "FTX collapse"]], solana: { - tvl: sdk.util.sumChainTvls([tvlCLMM, ammStableTvl, ammV4Tvl]), + tvl: sdk.util.sumChainTvls([tvlCLMM, ammStableTvl, ammV4Tvl, ammV2V3]), staking: () => sumTokens2({ tokenAccounts: ['8tnpAECxAT9nHBqR1Ba494Ar5dQMPGhL31MmPJz1zZvY']}) }, }; \ No newline at end of file diff --git a/projects/serum.js b/projects/serum.js index 38fb4171994..dc0bc16b90d 100644 --- a/projects/serum.js +++ b/projects/serum.js @@ -1,14 +1,8 @@ -const { getConnection, decodeAccount, } = require('./helper/solana') +const { getConnection, decodeAccount, blacklistedTokens_default } = require('./helper/solana') const sdk = require('@defillama/sdk') const { PublicKey } = require("@solana/web3.js") -const blacklistedTokens = new Set([ - '674PmuiDtgKx3uKuJ1B16f9m5L84eFvNwj3xDMvHcbo7', // $WOOD - 'SNSNkV9zfG5ZKWQs6x4hxvBRV6s8SqMfSGCtECDvdMd', // SNS - 'A7rqejP8LKN8syXMr4tvcKjs2iJ4WtZjXNs1e6qP3m9g', // ZION - 'NGK3iHqqQkyRZUj4uhJDQqEyKKcZ7mdawWpqwMffM3s', //YAKU - 'EP2aYBDD4WvdhnwWLUMyqU69g1ePtEjgYK6qyEAFCHTx', //KRILL -]) +const blacklistedTokens = new Set(blacklistedTokens_default) async function tvl(_, _1, _2, { api }) { const connection = getConnection() From 8d03258d4de86b7dc3f1d14b9057f6e35d954bdd Mon Sep 17 00:00:00 2001 From: DCota <32775237+DaigaroCota@users.noreply.github.com> Date: Tue, 8 Aug 2023 14:25:44 -0400 Subject: [PATCH 0726/1974] feat(fujidao-v2): add yield vaults and refactor to make it functional (#7073) --- projects/fujidao-v2/index.js | 84 ++++++++++++++++++++++++++---------- 1 file changed, 61 insertions(+), 23 deletions(-) diff --git a/projects/fujidao-v2/index.js b/projects/fujidao-v2/index.js index b91df7b9210..5611dc01365 100644 --- a/projects/fujidao-v2/index.js +++ b/projects/fujidao-v2/index.js @@ -2,23 +2,28 @@ const { getLogs } = require('../helper/cache/getLogs') const config = { ethereum: [ - { borrowFactory: '0x24E72207a078558BF9018dcF97D7f580E79B9221', borrowStartBlock: 17690796 }, + { borrowFactory: '0x24E72207a078558BF9018dcF97D7f580E79B9221', startBlock: 17690796 }, + { yieldFactory: '0xc349fd29AeD02ec862DfC03AF16e786798d8Aa1b', startBlock: 17812787 }, ], xdai: [ - { borrowFactory: '0xBeaa4b2cE11cc2F8a059341DaD422814B66d1aD0', borrowStartBlock: 28448319 }, - { borrowFactory: '0xeAcb50131a46a7b8C750c03ba336f2632fDb0344', borrowStartBlock: 28911067 }, + { borrowFactory: '0xeAcb50131a46a7b8C750c03ba336f2632fDb0344', startBlock: 28911067 }, + { yieldFactory: '0xf3AC23Fd2437394FDfD257Ac5931cA8fBc8B573C', startBlock: 29161909 }, + ], arbitrum: [ - { borrowFactory: '0x2855666fbc5f526269b1f5dc73dfc8e11acb67f1', borrowStartBlock: 101069692 }, - { borrowFactory: '0x2bb069a248Ba1c62062143462AE7bDB5C4360E3d', borrowStartBlock: 110400709 }, + { borrowFactory: '0x2855666fbc5f526269b1f5dc73dfc8e11acb67f1', startBlock: 101069692 }, + { borrowFactory: '0x2bb069a248Ba1c62062143462AE7bDB5C4360E3d', startBlock: 110400709 }, + { yieldFactory: '0x1cbf7f06c04226488B4D5b2d5EA5C8B965130500', startBlock: 115128235}, ], optimism: [ - { borrowFactory: '0xC377e6e13426739f14E411dD88Af8056e2DcabA4', borrowStartBlock: 105577184 }, - { borrowFactory: '0x1cbf7f06c04226488B4D5b2d5EA5C8B965130500', borrowStartBlock: 106780843 }, + { borrowFactory: '0xC377e6e13426739f14E411dD88Af8056e2DcabA4', startBlock: 105577184 }, + { borrowFactory: '0x1cbf7f06c04226488B4D5b2d5EA5C8B965130500', startBlock: 106780843 }, + { yieldFactory: '0x0D766AC0F6cE0591b073CB61A808b83f38F71340', startBlock: 107435743 }, ], polygon: [ - { borrowFactory: '0x157A03942e4F88c0357e4Afc1da46E9Cc12DB1D5', borrowStartBlock: 43896122 }, - { borrowFactory: '0x6Ed2428624da78cfE2daeC70BE171D1752cDEfF8', borrowStartBlock: 44986739 }, + { borrowFactory: '0x157A03942e4F88c0357e4Afc1da46E9Cc12DB1D5', startBlock: 43896122 }, + { borrowFactory: '0x6Ed2428624da78cfE2daeC70BE171D1752cDEfF8', startBlock: 44986739 }, + { yieldFactory: '0x645650030cDea7e2BC91F170261Ac5cd8DF50fD3', startBlock: 45583153 }, ], } @@ -28,50 +33,83 @@ module.exports = { Object.keys(config).forEach(chain => { const factories = config[chain] + const bfactories = factories.filter( factory => factory.hasOwnProperty('borrowFactory')) + const yfactories = factories.filter( factory => factory.hasOwnProperty('yieldFactory')) + module.exports[chain] = { tvl: async (_, _b, _cb, { api, }) => { - let logs = []; - for (let i = 0; i < factories.length; i++) { - const { borrowFactory, borrowStartBlock } = factories[i]; + let blogs = []; + for (let i = 0; i < bfactories.length; i++) { + const { borrowFactory, startBlock } = bfactories[i]; const interlogs = await getLogs({ api, target: borrowFactory, topics: ['0x89d38637357ca536d5c3f7cfcf4738f465b8b6bf51af92d02cb9fa8eb093f368'], eventAbi: 'event DeployBorrowingVault (address indexed vault, address indexed asset, address indexed debtAsset, string name, string symbol, bytes32 salt)', onlyArgs: true, - fromBlock: borrowStartBlock, + fromBlock: startBlock, extraKey: 'borrow-vault' }) interlogs.forEach(log => { - logs.push(log); + blogs.push(log); }) } - const vaults = logs.map(log => log.vault) - const assets = logs.map(log => log.asset) - const debtAssets = logs.map(log => log.debtAsset) + + let ylogs = []; + for (let i = 0; i < yfactories.length; i++) { + const { yieldFactory, startBlock } = yfactories[i]; + const interlogs = await getLogs({ + api, + target: yieldFactory, + topics: ['0x14ae025703048a936103023525911fe390af421a739fbf9971e78f41abafb32e'], + eventAbi: 'event DeployYieldVault (address indexed vault, address indexed asset, string name, string symbol, bytes32 salt)', + onlyArgs: true, + fromBlock: startBlock, + extraKey: 'yield-vault' + }) + interlogs.forEach(log => { + ylogs.push(log); + }) + } + + const bvaults = blogs.map(log => log.vault) + const yvaults = ylogs.map(log => log.vault) + const vaults = bvaults.concat(yvaults) + + const bassets = blogs.map(log => log.asset) + const yassets = ylogs.map(log => log.asset) + const assets = bassets.concat(yassets) + + const debtAssets = blogs.map(log => log.debtAsset) + const bals = await api.multiCall({ abi: 'uint256:totalAssets', calls: vaults }) - const debtBals = await api.multiCall({ abi: 'uint256:totalDebt', calls: vaults, permitFailure: true, }) + const debtBals = await api.multiCall({ abi: 'uint256:totalDebt', calls: bvaults, permitFailure: true, }) + bals.forEach((bal, i) => { + api.add(assets[i], bal) + }) + + debtAssets.forEach((bal, i) => { if (!debtBals[i]) { if (+bal === 0) return; - throw new Error(`No debt balance for ${vaults[i]}`) + throw new Error(`No debt balance for ${bvaults[i]}`) } - api.add(assets[i], bal) api.add(debtAssets[i], debtBals[i] * -1) }) + return api.getBalances() }, borrowed: async (_, _b, _cb, { api, }) => { let logs = []; - for (let i = 0; i < factories.length; i++) { - const { borrowFactory, borrowStartBlock } = factories[i]; + for (let i = 0; i < bfactories.length; i++) { + const { borrowFactory, startBlock } = bfactories[i]; const interlogs = await getLogs({ api, target: borrowFactory, topics: ['0x89d38637357ca536d5c3f7cfcf4738f465b8b6bf51af92d02cb9fa8eb093f368'], eventAbi: 'event DeployBorrowingVault (address indexed vault, address indexed asset, address indexed debtAsset, string name, string symbol, bytes32 salt)', onlyArgs: true, - fromBlock: borrowStartBlock, + fromBlock: startBlock, extraKey: 'borrow-vault' }) interlogs.forEach(log => { From c7437a557074d2447fb920f36ef2694b72b68de9 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 8 Aug 2023 20:41:10 +0200 Subject: [PATCH 0727/1974] track https://www.aquarius.loan/ --- projects/aquarius-loan/index.js | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 projects/aquarius-loan/index.js diff --git a/projects/aquarius-loan/index.js b/projects/aquarius-loan/index.js new file mode 100644 index 00000000000..3b5bf67d45c --- /dev/null +++ b/projects/aquarius-loan/index.js @@ -0,0 +1,5 @@ +const { compoundExports2 } = require("../helper/compound"); + +module.exports = { + core: compoundExports2({ comptroller: '0x6056Eb6a5634468647B8cB892d3DaA5F816939FC', cether: '0x03ef96f537a7cda4411c8643afd9d8814d5b4906'}) +}; \ No newline at end of file From f3e7d5f3d8e142ec2fe2cf48d7b35fbca2a326cb Mon Sep 17 00:00:00 2001 From: neuron team <141687054+goneuronxyz@users.noreply.github.com> Date: Tue, 8 Aug 2023 20:03:11 +0100 Subject: [PATCH 0728/1974] Updated for new api format --- projects/neuron/index.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/projects/neuron/index.js b/projects/neuron/index.js index 2cd52616304..634e5caa9dd 100644 --- a/projects/neuron/index.js +++ b/projects/neuron/index.js @@ -12,9 +12,10 @@ const chainIds = { function chainTvl(chain) { return async (timestamp, ethBlock, {[chain]: block}, { api }) => { - const url = `${http_api_url}?chainId=${api.getChainId()}`; - const neuron_response = await getConfig('neuron/'+chain, url); - return api.sumTokens({ owner: operator, tokens: neuron_response.map(i => i[0]) }) + const urlTvl = `${http_api_url}?chainId=${api.getChainId()}`; + const neuron_response_tvl = await getConfig('neuron/'+chain, urlTvl); + var [address, tokensAndAmounts] = neuron_response_tvl; + return api.sumTokens({ owner: address, tokens: tokensAndAmounts.map(i => i[0]) }) }; } From c900a398d517a9e3856c2db1c9ac6d2851c94be4 Mon Sep 17 00:00:00 2001 From: neuron team <141687054+goneuronxyz@users.noreply.github.com> Date: Tue, 8 Aug 2023 20:20:28 +0100 Subject: [PATCH 0729/1974] Updated implementation per advice from DL team --- projects/neuron/index.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/projects/neuron/index.js b/projects/neuron/index.js index 634e5caa9dd..fc1e66d05f6 100644 --- a/projects/neuron/index.js +++ b/projects/neuron/index.js @@ -10,12 +10,20 @@ const chainIds = { base: 8453, }; +const outpostAddresses = { + 42161 : "0x2395e53b250f091f38858ca9e75398181d45682b", + 10 : "0x2395e53b250f091f38858ca9e75398181d45682b", + 59144 : "0x2395e53b250f091f38858ca9e75398181d45682b", + 8453 : "0xe204912f188514ab33ba75c96bc81fe973db1046", +}; + function chainTvl(chain) { return async (timestamp, ethBlock, {[chain]: block}, { api }) => { const urlTvl = `${http_api_url}?chainId=${api.getChainId()}`; const neuron_response_tvl = await getConfig('neuron/'+chain, urlTvl); var [address, tokensAndAmounts] = neuron_response_tvl; - return api.sumTokens({ owner: address, tokens: tokensAndAmounts.map(i => i[0]) }) + const outpostAddress = outpostAddresses[api.getChainId()]; + return api.sumTokens({ owner: outpostAddress, tokens: tokensAndAmounts.map(i => i[0]) }) }; } From 89c3d4a92374624b2e62363c8a21a5184773cee5 Mon Sep 17 00:00:00 2001 From: 0xFantomMenace <93462858+0xFantomMenace@users.noreply.github.com> Date: Tue, 8 Aug 2023 14:22:28 -0500 Subject: [PATCH 0730/1974] Adds Granary Base deployment (#7075) Adds Granary Base deployment --- projects/the-granary/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/the-granary/index.js b/projects/the-granary/index.js index 3846ff7536c..6678a9db972 100644 --- a/projects/the-granary/index.js +++ b/projects/the-granary/index.js @@ -19,4 +19,5 @@ module.exports = { metis: v2("metis", "0x37133A8dCA96400c249102E59B11e25b0F663Ee0"), arbitrum: v2("arbitrum", "0x512f582fFCCF3C14bD872152EeAe60866dCB2A1e"), bsc: v2("bsc", "0x7c8E7536c5044E1B3693eB564C6dE3a3CE58bbDa"), + base: v2("base", "0x5C93B799D31d3d6a7C977f75FDB88d069565A55b"), } From e7c28e6018294b5c6de8e0f55d86fdc72b34819f Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 8 Aug 2023 22:59:45 +0200 Subject: [PATCH 0731/1974] fix x2y2 --- projects/helper/unwrapLPs.js | 1 - projects/helper/whitelistedNfts.js | 10 ++++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/projects/helper/unwrapLPs.js b/projects/helper/unwrapLPs.js index eb9ae76f0aa..851b56b53e1 100644 --- a/projects/helper/unwrapLPs.js +++ b/projects/helper/unwrapLPs.js @@ -696,7 +696,6 @@ async function sumTokens2({ if (!owners || !owners.length) owners = [owner] const cTokens = (await Promise.all(owners.map(i => covalentGetTokens(i, api.chain)))).flat() tokens = [...cTokens, ...tokens] - console.log('cTokens', cTokens.length) } if (resolveNFTs) { diff --git a/projects/helper/whitelistedNfts.js b/projects/helper/whitelistedNfts.js index a53389c888c..eda0963a838 100644 --- a/projects/helper/whitelistedNfts.js +++ b/projects/helper/whitelistedNfts.js @@ -85,6 +85,16 @@ const ethereum = [ // Wrapped Ether rock '0xa3f5998047579334607c47a6a2889bf87a17fc02', + + // DeGods + '0x8821BeE2ba0dF28761AffF119D66390D594CD280', + + // Captains + '0x769272677faB02575E84945F03Eca517ACc544Cc', + '0xE012Baf811CF9c05c408e879C399960D1f305903', // KODA + '0x790B2cF29Ed4F310bf7641f013C65D4560d28371', // Otherdeed + '0x3bf2922f4520a8BA0c2eFC3D2a1539678DaD5e9D', // ON1 + '0x39ee2c7b3cb80254225884ca001F57118C8f21B6', // Potatoz ].map(i => i.toLowerCase()) const AB_OLD_COLLECTIONS = ["0x059edd72cd353df5106d2b9cc5ab83a52287ac3a:0:999999","0x059edd72cd353df5106d2b9cc5ab83a52287ac3a:1000000:1999999","0x059edd72cd353df5106d2b9cc5ab83a52287ac3a:2000000:2999999"] From 2ad1a61a36cc045d7b546003ecfcabeae27abd87 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 8 Aug 2023 23:50:28 +0200 Subject: [PATCH 0732/1974] enzyme: track polygon --- projects/enzyme/index.js | 55 ++++++++++++++++++---------------------- projects/helper/cache.js | 29 ++++++++++++++++++--- projects/helper/http.js | 19 +------------- 3 files changed, 51 insertions(+), 52 deletions(-) diff --git a/projects/enzyme/index.js b/projects/enzyme/index.js index 5c08572d058..71238a4f5fe 100644 --- a/projects/enzyme/index.js +++ b/projects/enzyme/index.js @@ -1,40 +1,33 @@ -const { getConfig } = require('../helper/cache') -const { sumTokens } = require('../helper/unwrapLPs') -const cwADA_ETH = '0x64875aaa68d1d5521666c67d692ee0b926b08b2f' -const cwADA_POLY = 'polygon:0x64875aaa68d1d5521666c67d692ee0b926b08b2f' -const cwDOGE_ETH = '0xf9e293d5d793ddc1ae4f778761e0b3e4aa7cf2dd' -const cwDOGE_POLY = 'polygon:0x9bd9ad490dd3a52f096d229af4483b94d63be618' +const { cachedGraphQuery } = require('../helper/cache') +const { sumTokens2 } = require('../helper/unwrapLPs') -async function getData() { - return getConfig('enzyme', 'https://app.enzyme.finance/api/v1/network-asset-balances?network=ethereum') +const config = { + polygon: { endpoint: 'https://api.thegraph.com/subgraphs/name/enzymefinance/enzyme-core-polygon' }, + ethereum: { endpoint: 'https://api.thegraph.com/subgraphs/name/enzymefinance/enzyme-core' }, } +const query = `query get_accounts($lastId: String!) { + vaults( + first: 1000 + where: {id_gt: $lastId} + ) { id trackedAssets { id } } +}` -async function tvl(ts, block) { - const tokens = await getData() - const tokensAndOwners = [] - const balances = {} - const vaultsObj = {} - tokens.forEach(({ id, vaults }) => { - vaults.forEach(vault => { - tokensAndOwners.push([id, vault]) - vaultsObj[vault] = true +async function tvl(ts, block, _, { api }) { + const { endpoint } = config[api.chain] + const vaults = await cachedGraphQuery('enzyme/' + api.chain, endpoint, query, { fetchById: true, }) + console.log(api.chain, vaults.length) + return sumTokens2({ + api, ownerTokens: vaults.map(i => { + return [i.trackedAssets.map(i => i.id), i.id] }) }) - await sumTokens(balances, tokensAndOwners, block,) - - if (balances[cwADA_ETH]) { - balances[cwADA_POLY] = balances[cwADA_ETH] - delete balances[cwADA_ETH] - } - - if (balances[cwDOGE_ETH]) { - balances[cwDOGE_POLY] = balances[cwDOGE_ETH] - delete balances[cwDOGE_ETH] - } - return balances } + module.exports = { timetravel: false, - ethereum: { tvl } -} +}; + +Object.keys(config).forEach(chain => { + module.exports[chain] = { tvl } +}) \ No newline at end of file diff --git a/projects/helper/cache.js b/projects/helper/cache.js index 7ce6fc4d554..d4c98d46775 100644 --- a/projects/helper/cache.js +++ b/projects/helper/cache.js @@ -89,7 +89,7 @@ async function configPost(project, endpoint, data) { } -async function cachedGraphQuery(project, endpoint, query, { variables } = {}) { +async function cachedGraphQuery(project, endpoint, query, { variables, fetchById } = {}) { if (!project || !endpoint) throw new Error('Missing parameters') const key = 'config-cache' const cacheKey = getKey(key, project) @@ -98,7 +98,11 @@ async function cachedGraphQuery(project, endpoint, query, { variables } = {}) { async function _cachedGraphQuery() { try { - const json = await graphql.request(endpoint, query, { variables }) + let json + if (!fetchById) + json = await graphql.request(endpoint, query, { variables }) + else + json = await graphFetchById({ endpoint, query, }) await setCache(key, project, json) return json } catch (e) { @@ -109,6 +113,25 @@ async function cachedGraphQuery(project, endpoint, query, { variables } = {}) { } } + +async function graphFetchById({ endpoint, query, params = {}, api, options: { useBlock = false, safeBlockLimit = 100 } = {} }) { + if (useBlock && !params.block) + params.block = await api.getBlock() - safeBlockLimit + + let data = [] + let lastId = "" + let response; + do { + const res = await graphql.request(endpoint, query, { variables: { ...params, lastId }}) + Object.keys(res).forEach(key => response = res[key]) + data.push(...response) + lastId = response[response.length - 1]?.id + sdk.log(data.length, response.length) + } while (lastId) + return data +} + + module.exports = { - getCache, setCache, getConfig, configPost, cachedGraphQuery, + getCache, setCache, getConfig, configPost, cachedGraphQuery, graphFetchById, } \ No newline at end of file diff --git a/projects/helper/http.js b/projects/helper/http.js index 09a9bb3eb27..772b3ce92c7 100644 --- a/projects/helper/http.js +++ b/projects/helper/http.js @@ -2,7 +2,7 @@ const axios = require("axios") const { request, GraphQLClient, } = require("graphql-request") const sdk = require('@defillama/sdk') const { getEnv } = require('./env') -const { getCache: cGetCache, setCache } = require('./cache') +const { getCache: cGetCache, setCache, graphFetchById, } = require('./cache') const chainIds = { 'ethereum': 1, @@ -104,23 +104,6 @@ async function blockQuery(endpoint, query, { api, blockCatchupLimit = 500, }) { } } -async function graphFetchById({ endpoint, query, params = {}, api, options: { useBlock = false, safeBlockLimit = 100 } = {} }) { - if (useBlock && !params.block) - params.block = await api.getBlock() - safeBlockLimit - - let data = [] - let lastId = "" - let response; - do { - const res = await request(endpoint, query, { ...params, lastId }) - Object.keys(res).forEach(key => response = res[key]) - data.push(...response) - lastId = response[response.length - 1]?.id - sdk.log(data.length, response.length) - } while (lastId) - return data -} - module.exports = { get, getCache, From bca38d24249bf02e22c0e9d8be030d5be52ea2b8 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 9 Aug 2023 03:24:28 +0530 Subject: [PATCH 0733/1974] Alienbase (#7078) * added alienswap * minor fix --------- Co-authored-by: 0xanimewaifu <0xanimewaifu@gmail.com> --- projects/alienbase/index.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 projects/alienbase/index.js diff --git a/projects/alienbase/index.js b/projects/alienbase/index.js new file mode 100644 index 00000000000..e344d420477 --- /dev/null +++ b/projects/alienbase/index.js @@ -0,0 +1,18 @@ +const { getUniTVL } = require('../helper/unknownTokens') +const ALB = "0x1dd2d631c92b1aCdFCDd51A0F7145A50130050C4"; +const FACTORY = "0x3E84D913803b02A4a7f027165E8cA42C14C0FdE7" + +const dexTVL = getUniTVL({ + factory: FACTORY, + useDefaultCoreAssets: true, + fetchBalances: true, +}) + + +module.exports = { + misrepresentedTokens: true, + methodology: `Uses Uniswap-style factory address to find and price liquidity pairs.`, + base: { + tvl: dexTVL, + } +}; From c0a49e7090ff38fa69971f53fac81583d3233d4e Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 9 Aug 2023 00:08:18 +0200 Subject: [PATCH 0734/1974] kyber: track linea --- projects/kyber/index.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/projects/kyber/index.js b/projects/kyber/index.js index da8c75df7c8..658e6b188e8 100644 --- a/projects/kyber/index.js +++ b/projects/kyber/index.js @@ -26,14 +26,19 @@ const chains = { optimism: { graphId: "optimism", }, + linea: { + graphId: 'linea' + } }; async function fetchPools(chain) { - const url = - chain == "cronos" - ? "https://cronos-graph.kyberengineering.io/subgraphs/name/kybernetwork/kyberswap-elastic-cronos" - : `https://api.thegraph.com/subgraphs/name/kybernetwork/kyberswap-elastic-${chain}`; + let url + switch (chain) { + case "linea": url = 'https://graph-query.linea.build/subgraphs/name/kybernetwork/kyberswap-elastic-linea'; break; + case "cronos": url = 'https://cronos-graph.kyberengineering.io/subgraphs/name/kybernetwork/kyberswap-elastic-cronos'; break; + default: url = `https://api.thegraph.com/subgraphs/name/kybernetwork/kyberswap-elastic-${chain}`; + } let length let lastId = '' let toa = []; From 97cbcd555de37a45e738eabba106f8506ceb0295 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 9 Aug 2023 00:40:28 +0200 Subject: [PATCH 0735/1974] fix sushiswap --- projects/sushiswap/api.js | 1 - 1 file changed, 1 deletion(-) diff --git a/projects/sushiswap/api.js b/projects/sushiswap/api.js index bded00d1074..977473cc2f4 100644 --- a/projects/sushiswap/api.js +++ b/projects/sushiswap/api.js @@ -73,7 +73,6 @@ module.exports = { tvl: getUniTVL({ factory: '0x43eA90e2b786728520e4f930d2A71a477BF2737C', useDefaultCoreAssets: true, }), }, arbitrum_nova: { tvl, }, - base: { tvl, }, //moved kava to trident adapter //kava: { // tvl: kavaTridentTvl, //}, } From 3adbeb8e43218d0308ec912dcc207876cadfc645 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 9 Aug 2023 01:24:44 +0200 Subject: [PATCH 0736/1974] fix sushi v3 --- projects/sushiswap-v3/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/projects/sushiswap-v3/index.js b/projects/sushiswap-v3/index.js index 30af1c0e74b..de5341e54c4 100644 --- a/projects/sushiswap-v3/index.js +++ b/projects/sushiswap-v3/index.js @@ -61,5 +61,9 @@ module.exports = uniV3Export({ base: { factory: "0xc35DADB65012eC5796536bD9864eD8773aBc74C4", fromBlock: 1759510, + blacklistedTokens: [ + '0xcfca86136af5611e4bd8f82d83c7800ca65d875b', + '0x0b0fd8317735dd9fe611fbc7e1d138149f8ebcea', + ] }, }); From 799e85f0d823d4693a7754d3924bd9cf950c9f4d Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 9 Aug 2023 02:00:15 +0200 Subject: [PATCH 0737/1974] fix conic --- projects/conic-omnipool/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/conic-omnipool/index.js b/projects/conic-omnipool/index.js index c473908b1b5..6c08c92267e 100644 --- a/projects/conic-omnipool/index.js +++ b/projects/conic-omnipool/index.js @@ -8,7 +8,7 @@ module.exports = { ethereum: { tvl: async (_, _b, _cb, { api, }) => { const balances = {} - const pools = await api.call({ abi: 'address[]:listPools', target: '0x013A3Da6591d3427F164862793ab4e388F9B587e' }) + const pools = (await api.call({ abi: 'address[]:listPools', target: '0x013A3Da6591d3427F164862793ab4e388F9B587e' })).filter(i => i !== '0xb652710eab40B6Ed32D6c32053fC37eF234562c2') const bals = await api.multiCall({ abi: 'uint256:totalUnderlying', calls: pools }) const tokens = await api.multiCall({ abi: 'address:underlying', calls: pools }) bals.forEach((v, i) => sdk.util.sumSingleBalance(balances,tokens[i],v, api.chain)) From 62c25879175112dd8ab4055507b660d64f963f49 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 9 Aug 2023 02:03:04 +0200 Subject: [PATCH 0738/1974] fix jarvis --- projects/jarvis/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/jarvis/index.js b/projects/jarvis/index.js index d7f10a09634..236a7b7767a 100644 --- a/projects/jarvis/index.js +++ b/projects/jarvis/index.js @@ -99,6 +99,7 @@ async function tvl(timestamp, ethBlock, chainBlocks, { api, }) { if (version === 6) { const blacklistedPools = [ '0x63B5891895A57C31d5Ec2a8A5521b6EE67700f9F', + '0x1493607042C5725cEf277A83CFC94caA4fc6278F', ].map(i => i.toLowerCase()) const calls = liquidityPools.filter(i => !blacklistedPools.includes(i.toLowerCase())).map(a => ({ target: a })) const collateralTokens = await api.multiCall({ From 4fb98b0664e7dee30195aa74714cbf696459e85a Mon Sep 17 00:00:00 2001 From: trung2891 <62927315+trung2891@users.noreply.github.com> Date: Wed, 9 Aug 2023 14:55:53 +0700 Subject: [PATCH 0739/1974] Add Orchai Protocol (#7079) * add Orchai Protocol * add methology --- projects/orchai/index.js | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 projects/orchai/index.js diff --git a/projects/orchai/index.js b/projects/orchai/index.js new file mode 100644 index 00000000000..db95b2869d9 --- /dev/null +++ b/projects/orchai/index.js @@ -0,0 +1,32 @@ +const { queryContract } = require("../helper/chain/cosmos"); + +const addresses = { + orai: { + tvlContract: + "orai1ez359uvv5p7l2ssgadzjk2pfuune9rrhu72ehwdsu4h2qhqf9jlsxw7e0f", + }, +}; + +// Orai +async function oraiTVL() { + let tokensDelegated = await queryContract({ + contract: addresses.orai.tvlContract, + chain: "orai", + data: { liquid_stake_tvl: {} }, + }); + + let balances = {}; + for (let item of tokensDelegated) { + balances[`${item.token}`] = item.amount; + } + + return balances; +} + +module.exports = { + timetravel: false, + methodology: "Staked tokens are counted as TVL", + orai: { + tvl: oraiTVL, + }, +}; From 897dabc2f95123ed2f87e1cf4835262a0f4624f4 Mon Sep 17 00:00:00 2001 From: define Date: Wed, 9 Aug 2023 12:43:59 +0100 Subject: [PATCH 0740/1974] add hallmarks --- projects/cypher-trade/index.js | 3 +++ projects/steadefi/index.js | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/projects/cypher-trade/index.js b/projects/cypher-trade/index.js index 3aeacaabae7..9bfb75654bb 100644 --- a/projects/cypher-trade/index.js +++ b/projects/cypher-trade/index.js @@ -14,6 +14,9 @@ async function tvl() { } module.exports = { + hallmarks: [ + [1691373600,"exploit/security incident"] //https://twitter.com/cypher_protocol/status/1688641036476731393 + ], timetravel: false, solana: { tvl, }, } diff --git a/projects/steadefi/index.js b/projects/steadefi/index.js index 7937b60d9b0..02e4e45d928 100644 --- a/projects/steadefi/index.js +++ b/projects/steadefi/index.js @@ -14,7 +14,9 @@ const config = { arbitrum: { fsglp: ADDRESSES.arbitrum.fsGLP }, avax: { fsglp: '0x9e295B5B976a184B14aD8cd72413aD846C299660' }, } - +module.exports.hallmarks = [ + [1691373600, "Steadefi exploited"], +], module.exports = { }; From 32619af3e0f22a8f7c15eb1b066d39c710830ba3 Mon Sep 17 00:00:00 2001 From: 0xngmi <80541789+0xngmi@users.noreply.github.com> Date: Wed, 9 Aug 2023 14:15:58 +0100 Subject: [PATCH 0741/1974] add xdai to aura --- projects/aura-finance/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/aura-finance/index.js b/projects/aura-finance/index.js index fca63047ec3..dc2de2ee841 100644 --- a/projects/aura-finance/index.js +++ b/projects/aura-finance/index.js @@ -64,6 +64,7 @@ const config = { arbitrum: { factory: '0x6817149cb753bf529565b4d023d7507ed2ff4bc0', fromBlock: 72942741, voterProxy: '0xc181edc719480bd089b94647c2dc504e2700a2b0'}, optimism: { factory: '0xa523f47A933D5020b23629dDf689695AA94612Dc', fromBlock: 83239534, voterProxy: '0xc181edc719480bd089b94647c2dc504e2700a2b0'}, polygon: { factory: '0x22625eedd92c81a219a83e1dc48f88d54786b017', fromBlock: 40687417, voterProxy: '0xC181Edc719480bd089b94647c2Dc504e2700a2B0'}, + xdai: { factory: '0x83E443EF4f9963C77bd860f94500075556668cb8', fromBlock: 27088527, voterProxy: '0xC181Edc719480bd089b94647c2Dc504e2700a2B0'}, } module.exports = { From 7add4e5d116642921a3d03c2088be41e502d8403 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 9 Aug 2023 16:58:33 +0200 Subject: [PATCH 0742/1974] fix broken adapters --- projects/helper/cache.js | 5 ++++- projects/helper/chain/cosmos.js | 11 +++++++++++ projects/loop-finance/index.js | 3 ++- projects/terraswap/factoryTvl.js | 12 +++++++++++- projects/wyndao-dex/index.js | 23 ++++++----------------- 5 files changed, 34 insertions(+), 20 deletions(-) diff --git a/projects/helper/cache.js b/projects/helper/cache.js index d4c98d46775..7536bc9280d 100644 --- a/projects/helper/cache.js +++ b/projects/helper/cache.js @@ -58,7 +58,10 @@ async function getConfig(project, endpoint) { async function _getConfig() { try { const { data: json } = await axios.get(endpoint) - await setCache(key, project, json) + const strData = typeof json === 'string' ? json : JSON.stringify(json) + let isValidData = strData.length > 42 + if (isValidData) // sometimes we get bad data/empty object, we dont overwrite cache with it + await setCache(key, project, json) return json } catch (e) { // sdk.log(e) diff --git a/projects/helper/chain/cosmos.js b/projects/helper/chain/cosmos.js index 65de317ef8d..7f3c4ebf6c0 100644 --- a/projects/helper/chain/cosmos.js +++ b/projects/helper/chain/cosmos.js @@ -97,6 +97,16 @@ async function getBalance({ token, owner, block, chain } = {}) { return Number(data.balance); } +async function sumCW20Tokens({ balances = {}, tokens, owner, block, chain } = {}) { + await Promise.all( + tokens.map(async (token) => { + const balance = await getBalance({ token, owner, block, chain, }); + sdk.util.sumSingleBalance(balances, token, balance, chain); + }) + ); + return balances; +} + async function getDenomBalance({ denom, owner, block, chain } = {}) { let endpoint = `${getEndpoint(chain)}/bank/balances/${owner}`; if (block !== undefined) { @@ -221,4 +231,5 @@ module.exports = { sumTokens, getTokenBalance, getToken, + sumCW20Tokens, }; diff --git a/projects/loop-finance/index.js b/projects/loop-finance/index.js index d3c7e7d6ba1..25dca3759a2 100644 --- a/projects/loop-finance/index.js +++ b/projects/loop-finance/index.js @@ -1,6 +1,7 @@ const sdk = require("@defillama/sdk"); const { queryContract, getTokenBalance, getToken, } = require("../helper/chain/cosmos"); const { transformDexBalances } = require('../helper/portedTokens') +const TS = require('../terraswap/factoryTvl') async function getPairs(chain, factory) { let data = { pairs: { limit: 30 } } @@ -45,7 +46,7 @@ module.exports = { misrepresentedTokens: true, timetravel: false, terra: { tvl: sdk.util.sumChainTvls([getFactoryTvl(queries.factory0), getFactoryTvl(queries.factory1)]) }, - juno: { tvl: getFactoryTvl('juno1p4dmvjtdf3qw9394k7zl65eg8g5ehzvdxnvm9hd3ju7a7aslrmdqaspeak') }, + juno: { tvl: TS.getFactoryTvl('juno1p4dmvjtdf3qw9394k7zl65eg8g5ehzvdxnvm9hd3ju7a7aslrmdqaspeak') }, hallmarks: [ [1651881600, "UST depeg"], ] diff --git a/projects/terraswap/factoryTvl.js b/projects/terraswap/factoryTvl.js index 354f1dee529..3f24e067a3f 100644 --- a/projects/terraswap/factoryTvl.js +++ b/projects/terraswap/factoryTvl.js @@ -2,8 +2,18 @@ const { queryContract } = require('../helper/chain/cosmos') const { PromisePool } = require('@supercharge/promise-pool') const { transformDexBalances } = require('../helper/portedTokens') +function extractTokenInfo(asset) { + const { native_token, token, native } = asset.info + for (const tObject of [native_token, token, native]) { + if (!tObject) continue + if (typeof tObject === 'string') return tObject + const token = tObject.denom || tObject.contract_addr + if (token) return token + } +} + function getAssetInfo(asset) { - return [asset.info.native_token?.denom ?? asset.info.token?.contract_addr, Number(asset.amount)] + return [extractTokenInfo(asset), Number(asset.amount)] } async function getAllPairs(factory, chain) { diff --git a/projects/wyndao-dex/index.js b/projects/wyndao-dex/index.js index 3c025df1ec1..74f3a87da0e 100644 --- a/projects/wyndao-dex/index.js +++ b/projects/wyndao-dex/index.js @@ -1,27 +1,16 @@ -const { get } = require('../helper/http') -const { transformDexBalances } = require('../helper/portedTokens') +const { getFactoryTvl } = require('../terraswap/factoryTvl') +const { getBalance, } = require('../helper/chain/cosmos') module.exports = { timetravel: false, misrepresentedTokens: true, + methodology: "Liquidity on the DEX", juno: { - tvl: async () => { - const data = await get('https://api.wynddao.com/pools') - return transformDexBalances({ - chain: 'juno', - data: Object.values(data).map(i => ({ - token0: i[0].token ?? i[0].native, - token0Bal: i[0].amount ?? 0, - token1: i[1].token ?? i[1].native, - token1Bal: i[1].amount ?? 0, - })) - }) - }, + tvl: getFactoryTvl("juno16adshp473hd9sruwztdqrtsfckgtd69glqm6sqk0hc4q40c296qsxl3u3s",), staking: async () => { - const data = await get('https://lcd-juno.cosmostation.io/wasm/contract/juno1mkw83sv6c7sjdvsaplrzc8yaes9l42p4mhy0ssuxjnyzl87c9eps7ce3m9/smart/7b2262616c616e6365223a7b2261646472657373223a226a756e6f317379396d6c7734377734346639347a6561376739387935666634637674633872667637356a677770686c65743833776c66347373613035306d76227d7d?encoding=UTF-8') return { - 'wynd': JSON.parse(atob(data.result.smart)).balance / 1e6 + 'wynd': await getBalance({ chain: 'juno', token: 'juno1mkw83sv6c7sjdvsaplrzc8yaes9l42p4mhy0ssuxjnyzl87c9eps7ce3m9', owner: 'juno1sy9mlw47w44f94zea7g98y5ff4cvtc8rfv75jgwphlet83wlf4ssa050mv' }) / 1e6 } } - } + }, } \ No newline at end of file From f70898747514859743efe8836731a605c906afc4 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 9 Aug 2023 17:14:03 +0200 Subject: [PATCH 0743/1974] fix broken adapters --- projects/helper/liquity.js | 5 +++-- projects/polycat/index.js | 4 ++++ projects/stabilizefi/index.js | 37 ++++++++++------------------------- 3 files changed, 17 insertions(+), 29 deletions(-) diff --git a/projects/helper/liquity.js b/projects/helper/liquity.js index 032d038a34a..385ecef5038 100644 --- a/projects/helper/liquity.js +++ b/projects/helper/liquity.js @@ -1,11 +1,12 @@ const { nullAddress } = require("./tokenMapping") -function getLiquityTvl(TROVE_MANAGER_ADDRESS, { nonNativeCollateralToken = false, abis = {} } = {}) { +function getLiquityTvl(TROVE_MANAGER_ADDRESS, { nonNativeCollateralToken = false, abis = {}, collateralToken, } = {}) { return async (_, ethBlock, chainBlocks, { api }) => { const activePool = await api.call({ target: TROVE_MANAGER_ADDRESS, abi: abis.activePool ?? "address:activePool", }) const defaultPool = await api.call({ target: TROVE_MANAGER_ADDRESS, abi: "address:defaultPool", }) let token = nullAddress - if (nonNativeCollateralToken) token = await api.call({ target: TROVE_MANAGER_ADDRESS, abi: abis.collateralToken ?? "address:collateralToken", }) + if (collateralToken) token = collateralToken + else if (nonNativeCollateralToken) token = await api.call({ target: TROVE_MANAGER_ADDRESS, abi: abis.collateralToken ?? "address:collateralToken", }) return api.sumTokens({ owners: [activePool, defaultPool], tokens: [token] }) } } diff --git a/projects/polycat/index.js b/projects/polycat/index.js index 0f423b4a9ca..4c1a49bfdaa 100644 --- a/projects/polycat/index.js +++ b/projects/polycat/index.js @@ -9,6 +9,10 @@ module.exports = yieldHelper({ masterchef: vaultchef, nativeToken: fish, blacklistedTokens: ['0xd76D74DE1EF47E6A390FA53b3b11ef095d0c738c'], + getTokenBalances: async ({ api, poolIds, }) => { + const lockedTotals = await api.multiCall({ abi: 'uint256:wantLockedTotal', calls: poolIds, permitFailure: true }) + return lockedTotals.map(i => i ?? 0) + }, abis: { poolInfo: abi.poolInfo } diff --git a/projects/stabilizefi/index.js b/projects/stabilizefi/index.js index f7ad8696a57..5f8a27d7eaa 100644 --- a/projects/stabilizefi/index.js +++ b/projects/stabilizefi/index.js @@ -11,45 +11,28 @@ const FARM_ADDRESS_SET_USDC = "0xAA31D7Bc8186888D9Eebb5524C47268E4bC87496" const LP_ADDRESS_SET_USDC = "0x31fa3838788A07607D95C9c640D041eAec649f50" // system coll -const AVAX_ADDRESS = ADDRESSES.avax.WAVAX; const AVAX_TROVE_MANAGER_ADDRESS = "0x7551A127C41C85E1412EfE263Cadb49900b0668C"; - -const ETH_ADDRESS = ADDRESSES.avax.WETH_e; const ETH_TROVE_MANAGER_ADDRESS = "0x7837C2dB2d004eB10E608d95B2Efe8cb57fd40b4"; - const BTC_ADDRESS = '0x50b7545627a5162f82a992c33b87adc75187b218'; const BTC_TROVE_MANAGER_ADDRESS = "0x56c194F1fB30F8cdd49E7351fC9C67d8C762a86F"; - -const DAI_ADDRESS = ADDRESSES.avax.DAI; const DAI_TROVE_MANAGER_ADDRESS = "0x54b35c002468a5Cc2BD1428C011857d26463ecbC"; - // --- staking --- -async function stakingTvl(_, _ethBlock, chainBlocks) { - const StakesBalance = ( - await sdk.api.abi.call({ - target: TOKEN_STAKING_ADDRESS, - abi: "uint256:totalTokenStaked", - block: chainBlocks['avax'], - chain: 'avax' - }) - ).output; - - return { - [SET_ADDRESS] : StakesBalance} - +async function stakingTvl(_, _ethBlock, chainBlocks, { api }) { + const StakesBalance = await api.call({ target: TOKEN_STAKING_ADDRESS, abi: "uint256:totalTokenStaked", }) + return { [SET_ADDRESS]: StakesBalance } } +const options = { nonNativeCollateralToken: true } module.exports = { - avax:{ + avax: { tvl: sdk.util.sumChainTvls([ - getLiquityTvl(ETH_ADDRESS,ETH_TROVE_MANAGER_ADDRESS,"avax",addr => 'avax:'+addr), - getLiquityTvl(BTC_ADDRESS,BTC_TROVE_MANAGER_ADDRESS,"avax"), - getLiquityTvl(AVAX_ADDRESS,AVAX_TROVE_MANAGER_ADDRESS,"avax"), - getLiquityTvl(DAI_ADDRESS,DAI_TROVE_MANAGER_ADDRESS,"avax"), + getLiquityTvl(ETH_TROVE_MANAGER_ADDRESS, { ...options, collateralToken: ADDRESSES.avax.WETH_e }), + getLiquityTvl(BTC_TROVE_MANAGER_ADDRESS, { ...options, collateralToken: BTC_ADDRESS }), + getLiquityTvl(AVAX_TROVE_MANAGER_ADDRESS), + getLiquityTvl(DAI_TROVE_MANAGER_ADDRESS, { ...options, collateralToken: ADDRESSES.avax.DAI }), ]), - pool2: pool2(FARM_ADDRESS_SET_USDC,LP_ADDRESS_SET_USDC,"avax"), + pool2: pool2(FARM_ADDRESS_SET_USDC, LP_ADDRESS_SET_USDC), staking: stakingTvl } - }; From 02da3c6636a6ac89aa3e82ee45dc894f1a180cd5 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 9 Aug 2023 21:41:37 +0530 Subject: [PATCH 0744/1974] Aura (#7092) * list aura network * minor fix --------- Co-authored-by: ThienLK --- projects/halotrade/index.js | 10 ++++++++++ projects/helper/chain/cosmos.js | 1 + projects/helper/chains.json | 1 + projects/helper/portedTokens.js | 2 +- projects/helper/tokenMapping.js | 3 +++ 5 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 projects/halotrade/index.js diff --git a/projects/halotrade/index.js b/projects/halotrade/index.js new file mode 100644 index 00000000000..9c8d1af110f --- /dev/null +++ b/projects/halotrade/index.js @@ -0,0 +1,10 @@ +const { getFactoryTvl } = require('../terraswap/factoryTvl') + +module.exports = { + timetravel: false, + misrepresentedTokens: true, + methodology: "Liquidity on the DEX", + aura: { + tvl: getFactoryTvl("aura18qwll06qjgkfl5s5ym4rtpz8jy2tl849ghgx402tm4w9v55wu5asn0mqhv",) + }, +} // node test.js projects/hallotrade/index.js \ No newline at end of file diff --git a/projects/helper/chain/cosmos.js b/projects/helper/chain/cosmos.js index 7f3c4ebf6c0..0cbf7435286 100644 --- a/projects/helper/chain/cosmos.js +++ b/projects/helper/chain/cosmos.js @@ -30,6 +30,7 @@ const endPoints = { neutron: "https://rest-kralum.neutron-1.neutron.org", quasar: "https://quasar-api.polkachu.com", gravitybridge: "https://rest.cosmos.directory/gravitybridge", + aura: "https://lcd.aura.network", }; const chainSubpaths = { diff --git a/projects/helper/chains.json b/projects/helper/chains.json index 9cbc34087b8..fe0610ee688 100644 --- a/projects/helper/chains.json +++ b/projects/helper/chains.json @@ -5,6 +5,7 @@ "arbitrum", "arbitrum_nova", "astar", + "aura", "aurora", "avax", "base", diff --git a/projects/helper/portedTokens.js b/projects/helper/portedTokens.js index 47fac2291bc..ffe213ac405 100644 --- a/projects/helper/portedTokens.js +++ b/projects/helper/portedTokens.js @@ -144,6 +144,7 @@ async function getChainTransform(chain) { if (chain === 'stacks' && addr.startsWith('SP')) return chainStr if (chain === 'tezos' && addr.startsWith('KT1')) return chainStr if (chain === 'terra2' && addr.startsWith('terra1')) return chainStr + if (chain === 'aura' && addr.startsWith('aura')) return chainStr if (chain === 'algorand' && /^\d+$/.test(addr)) return chainStr if (addr.startsWith('0x') || ['solana', 'kava'].includes(chain)) return chainStr return addr @@ -184,7 +185,6 @@ async function transformDexBalances({ chain, data, balances = {}, restrictTokenR if (!withMetadata) return transformBalances(chain, balances) - return { prices, updateBalances, diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 6a5f2c0bd91..d7e4b053728 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -52,6 +52,9 @@ const fixBalancesTokens = { telos: { [ADDRESSES.telos.WTLOS_1]: { coingeckoId: "telos", decimals: 18 }, }, + aura: { + 'uaura': { coingeckoId: 'aura-network', decimals: 6 }, + }, } ibcChains.forEach(chain => fixBalancesTokens[chain] = { ...ibcMappings, ...(fixBalancesTokens[chain] || {}) }) From 825c031e1e062fa98adcfe310f844d872c8065be Mon Sep 17 00:00:00 2001 From: daniel-kung <68729021+daniel-kung@users.noreply.github.com> Date: Thu, 10 Aug 2023 00:15:05 +0800 Subject: [PATCH 0745/1974] add protocol lsd (#7056) * add protocol lsd * minor fix * add lsdFil --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/lsdFil/index.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 projects/lsdFil/index.js diff --git a/projects/lsdFil/index.js b/projects/lsdFil/index.js new file mode 100644 index 00000000000..d3d8de886af --- /dev/null +++ b/projects/lsdFil/index.js @@ -0,0 +1,22 @@ +const MINT_TOKEN_CONTRACT = '0xcE5805CF6C84F71D2897f632E0Aa60d2430cCd2A'; +const MINT_CLUB_BOND_CONTRACT = '0x7187b3B1314375909B775d72fB7214Cb71a7D907'; + + +async function tvl(_, _1, _2, { api }) { + const collateralBalance = await api.call({ + abi: 'erc20:balanceOf', + target: MINT_TOKEN_CONTRACT, + params: [MINT_CLUB_BOND_CONTRACT], + }); + + api.add(MINT_TOKEN_CONTRACT, collateralBalance) +} + +module.exports = { + timetravel: true, + misrepresentedTokens: false, + methodology: 'counts the number of MINT tokens in the Club Bonding contract.', + filecoin: { + tvl, + } +}; \ No newline at end of file From ae298f8183faf5d9bcc55bad948da84de284615f Mon Sep 17 00:00:00 2001 From: Astrarizon <111271396+astrarizon@users.noreply.github.com> Date: Wed, 9 Aug 2023 19:32:49 +0300 Subject: [PATCH 0746/1974] Added SocialPayments and SmartTransfers modules TVL (#7091) * added adapter for pulsar-money tvl * added owner address * minor fix * minor fix * added SocialPayments and SmartTransfers modules TVL * minor fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/helper/chain/elrond.js | 2 +- projects/helper/coreAssets.json | 1 + projects/pulsar-money/index.js | 22 +++++++++++++++++----- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/projects/helper/chain/elrond.js b/projects/helper/chain/elrond.js index 3dfdbdd2185..af22209a263 100644 --- a/projects/helper/chain/elrond.js +++ b/projects/helper/chain/elrond.js @@ -63,7 +63,7 @@ async function sumTokens({ owner, owners = [], tokens = [], balances = {}, black } await Promise.all(owners.map(i => getTokens({ address: i, balances, tokens, blacklistedTokens, whitelistedTokens, }))) - if (!tokens.length || tokens.includes(nullAddress)) + if ((!tokens.length || tokens.includes(nullAddress)) && (!whitelistedTokens.length || whitelistedTokens.includes(nullAddress)) && (!blacklistedTokens.length || !blacklistedTokens.includes(nullAddress))) await Promise.all(owners.map(async i => { const bal = await getElrondBalance(i) sdk.util.sumSingleBalance(balances, nullAddress, bal, chain) diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index 02928a6ca46..42ed92af525 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -1218,6 +1218,7 @@ "USDT": "USDT" }, "elrond": { + "EGLD": "0x0000000000000000000000000000000000000000", "WEGLD": "WEGLD-bd4d79", "USDC": "USDC-c76f1f" }, diff --git a/projects/pulsar-money/index.js b/projects/pulsar-money/index.js index 0f44a6929ac..c4d0436d0ca 100644 --- a/projects/pulsar-money/index.js +++ b/projects/pulsar-money/index.js @@ -1,14 +1,26 @@ const { sumTokensExport } = require("../helper/chain/elrond"); -const { getCoreAssets } = require('../helper/tokenMapping') +const { getCoreAssets } = require("../helper/tokenMapping"); // const API_URL = "https://pulsar-money-prod.herokuapp.com/metrics/tvl"; -const vault = 'erd1qqqqqqqqqqqqqpgq39rqpn2xvm0ykl2ccaa4h5zk5c9r647wdteswmap9l' +const vault = "erd1qqqqqqqqqqqqqpgq39rqpn2xvm0ykl2ccaa4h5zk5c9r647wdteswmap9l"; +const socialPayments = + "erd1qqqqqqqqqqqqqpgq85tlmqudva0fyawkkuc6qga60kclzyzj60ws7kxxf5"; +const smartTransfers = + "erd1qqqqqqqqqqqqqpgqd6l8ayd0zxfekl53geyxgjzjxu3ceyca60wsje6asx"; + +const ADDRESSES = [vault, socialPayments, smartTransfers]; module.exports = { timetravel: false, elrond: { - tvl: sumTokensExport({ owner: vault, whitelistedTokens: getCoreAssets('elrond')}), - vesting: sumTokensExport({ owner: vault, blacklistedTokens: getCoreAssets('elrond')}), + tvl: sumTokensExport({ + owners: ADDRESSES, + whitelistedTokens: getCoreAssets("elrond"), + }), + vesting: sumTokensExport({ + owners: ADDRESSES, + blacklistedTokens: getCoreAssets("elrond"), + }), }, -}; \ No newline at end of file +}; From 6d6de12f6d5c547002debfa038ec85df3ceb1329 Mon Sep 17 00:00:00 2001 From: x0s0l <90217496+x0s0l@users.noreply.github.com> Date: Wed, 9 Aug 2023 13:37:57 -0300 Subject: [PATCH 0747/1974] Add Moonwell's deployment on Base (#7090) * Merging into Moonwell and adding Base chain * adds the base protocol to moonwell folder and splits apollo to another folder --------- Co-authored-by: Luke Youngblood --- projects/moonwell-apollo/index.js | 28 ++++++++++++++++++++ projects/moonwell-artemis/index.js | 28 -------------------- projects/moonwell/index.js | 42 ++++++++++++++++++++---------- 3 files changed, 56 insertions(+), 42 deletions(-) create mode 100644 projects/moonwell-apollo/index.js delete mode 100644 projects/moonwell-artemis/index.js diff --git a/projects/moonwell-apollo/index.js b/projects/moonwell-apollo/index.js new file mode 100644 index 00000000000..ef0aec34753 --- /dev/null +++ b/projects/moonwell-apollo/index.js @@ -0,0 +1,28 @@ +const { usdCompoundExports } = require('../helper/compound') +const { staking } = require('../helper/staking') + +const moonriverConfig = { + comptroller: '0x0b7a0EAA884849c6Af7a129e899536dDDcA4905E', + chain: 'moonriver', + nativeTokenMarket: '0x6a1A771C7826596652daDC9145fEAaE62b1cd07f', + + stakingContract: '0xCd76e63f3AbFA864c53b4B98F57c1aA6539FDa3a', + stakingTokenAddress: '0xBb8d88bcD9749636BC4D2bE22aaC4Bb3B01A58F1' +} + +// Moonriver +const moonriverTVL = usdCompoundExports( + moonriverConfig.comptroller, + moonriverConfig.chain, + moonriverConfig.nativeTokenMarket +) + +const moonriverStaking = staking( + moonriverConfig.stakingContract, + moonriverConfig.stakingTokenAddress, + 'moonriver' +) + +module.exports = { + moonriver: { ...moonriverTVL, staking: moonriverStaking } +} diff --git a/projects/moonwell-artemis/index.js b/projects/moonwell-artemis/index.js deleted file mode 100644 index 1873bf7a0e7..00000000000 --- a/projects/moonwell-artemis/index.js +++ /dev/null @@ -1,28 +0,0 @@ -const { usdCompoundExports } = require('../helper/compound') -const { staking } = require('../helper/staking'); - - -const moonbeamConfig = { - comptroller: "0x8E00D5e02E65A19337Cdba98bbA9F84d4186a180", - chain: "moonbeam", - nativeTokenMarket: "0x091608f4e4a15335145be0A279483C0f8E4c7955", - - stakingContract: "0x8568A675384d761f36eC269D695d6Ce4423cfaB1", - stakingTokenAddress: "0x511aB53F793683763E5a8829738301368a2411E3" -} - -// Moonbeam -const moonbeamTVL = usdCompoundExports( - moonbeamConfig.comptroller, - moonbeamConfig.chain, - moonbeamConfig.nativeTokenMarket, -) - -const moonbeamStaking = staking(moonbeamConfig.stakingContract, moonbeamConfig.stakingTokenAddress, 'moonbeam') - -module.exports = { - moonbeam: { ...moonbeamTVL, staking: moonbeamStaking, }, - hallmarks: [ - [1659312000,"Nomad Bridge Exploit"], - ], -} \ No newline at end of file diff --git a/projects/moonwell/index.js b/projects/moonwell/index.js index 37fcf153585..0554398a790 100644 --- a/projects/moonwell/index.js +++ b/projects/moonwell/index.js @@ -1,24 +1,38 @@ const { usdCompoundExports } = require('../helper/compound') const { staking } = require('../helper/staking'); -const moonriverConfig = { - comptroller: "0x0b7a0EAA884849c6Af7a129e899536dDDcA4905E", - chain: "moonriver", - nativeTokenMarket: "0x6a1A771C7826596652daDC9145fEAaE62b1cd07f", +const moonbeamConfig = { + comptroller: '0x8E00D5e02E65A19337Cdba98bbA9F84d4186a180', + chain: 'moonbeam', + nativeTokenMarket: '0x091608f4e4a15335145be0A279483C0f8E4c7955', - stakingContract: "0xCd76e63f3AbFA864c53b4B98F57c1aA6539FDa3a", - stakingTokenAddress: "0xBb8d88bcD9749636BC4D2bE22aaC4Bb3B01A58F1" + stakingContract: '0x8568A675384d761f36eC269D695d6Ce4423cfaB1', + stakingTokenAddress: '0x511aB53F793683763E5a8829738301368a2411E3' } -// Moonriver -const moonriverTVL = usdCompoundExports( - moonriverConfig.comptroller, - moonriverConfig.chain, - moonriverConfig.nativeTokenMarket, +// Moonbeam +const moonbeamTVL = usdCompoundExports( + moonbeamConfig.comptroller, + moonbeamConfig.chain, + moonbeamConfig.nativeTokenMarket ) -const moonriverStaking = staking(moonriverConfig.stakingContract, moonriverConfig.stakingTokenAddress, 'moonriver') +const moonbeamStaking = staking( + moonbeamConfig.stakingContract, + moonbeamConfig.stakingTokenAddress, + 'moonbeam' +) + +const baseConfig = { + comptroller: '0xfBb21d0380beE3312B33c4353c8936a0F13EF26C', + chain: 'base' +} + +// Moonbeam +const baseTVL = usdCompoundExports(baseConfig.comptroller, baseConfig.chain) module.exports = { - moonriver: { ...moonriverTVL, staking: moonriverStaking, }, -} \ No newline at end of file + moonbeam: { ...moonbeamTVL, staking: moonbeamStaking }, + base: { ...baseTVL }, + hallmarks: [[1659312000, 'Nomad Bridge Exploit']] +} From 9630eb556c960c5d3094151df5f6aa8cf4b9656d Mon Sep 17 00:00:00 2001 From: Javier NFT Date: Wed, 9 Aug 2023 18:43:49 +0200 Subject: [PATCH 0748/1974] jexchange: update pools (#7080) --- projects/jexchange/index.js | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/projects/jexchange/index.js b/projects/jexchange/index.js index e3c5ac34eca..769f413ce46 100644 --- a/projects/jexchange/index.js +++ b/projects/jexchange/index.js @@ -1,8 +1,20 @@ -const { sumTokensExport } = require('../helper/sumTokens') +const { sumTokens } = require("../helper/chain/elrond"); + +async function tvl() { + const owners = [ + "erd1qqqqqqqqqqqqqpgqmmxzmktd09gq0hldtczerlv444ykt3pz6avsnys6m9", + "erd1qqqqqqqqqqqqqpgqdh6jeeyamfhq66u7rmkyc48q037kk8n26avs400gg8", + "erd1qqqqqqqqqqqqqpgqpa3pdmemt5l2ex80g7pksr2ettt955d66avsz76hyt", + "erd1qqqqqqqqqqqqqpgq5nmzpdkpr6c5q894f553n49t0uc67vc96avsxgjl3v", + "erd1qqqqqqqqqqqqqpgqru6tkedsjjszrkkanctgq9m6rm2ple436avs0qj07m", + "erd1qqqqqqqqqqqqqpgquenuwz852khuxcau49md27wk2qp03v4s6avsdvmxkc", + ]; + return sumTokens({ owners }); +} module.exports = { timetravel: false, elrond: { - tvl: sumTokensExport({ chain: 'elrond', owner: 'erd1qqqqqqqqqqqqqpgqmmxzmktd09gq0hldtczerlv444ykt3pz6avsnys6m9', }) - } -} \ No newline at end of file + tvl, + }, +}; From f73443e0804ad4806e32c2c237baa620b307fc85 Mon Sep 17 00:00:00 2001 From: franzns <93920061+franzns@users.noreply.github.com> Date: Wed, 9 Aug 2023 19:01:23 +0200 Subject: [PATCH 0749/1974] Fix Beets treasury (#7081) * adapt treasury assets * add BPTs, remove own tokens * adding wallet tokens --- projects/treasury/beethovenx.js | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/projects/treasury/beethovenx.js b/projects/treasury/beethovenx.js index 9d5a5284838..1a564f0bfe4 100644 --- a/projects/treasury/beethovenx.js +++ b/projects/treasury/beethovenx.js @@ -1,4 +1,4 @@ -const ADDRESSES = require('../helper/coreAssets.json') +const ADDRESSES = require("../helper/coreAssets.json"); const { nullAddress, treasuryExports } = require("../helper/treasury"); const ftm = "0xa1e849b1d6c2fd31c63eef7822e9e0632411ada7"; @@ -10,17 +10,22 @@ const ftmTokens = [ ADDRESSES.fantom.USDC, // USDC "0x841FAD6EAe12c286d1Fd18d1d525DFfA75C7EFFE", // BOO ADDRESSES.fantom.WFTM, // WFTM + "0x91a40c733c97a6e1bf876eaf9ed8c08102eb491f", // lzDAI + "0x28a92dde19D9989F39A49905d7C9C2FAc7799bDf", // lzUSDC + "0xcc1b99dDAc1a33c201a742A1851662E87BC7f22C", // lzUSDT + "0xf1648C50d2863f780c57849D812b4B7686031A3D", // lzWBTC + "0x695921034f0387eAc4e11620EE91b1b15A6A09fE", // lzWETH "0xc5713B6a0F26bf0fdC1c52B90cd184D950be515C", // LINSPIRIT "0xde5ed76e7c05ec5e4572cfc88d1acea165109e44", // DEUS "0xc3f069d7439baf6d4d6e9478d9cc77778e62d147", // FLIBERO "0xf3A602d30dcB723A74a0198313a7551FEacA7DAc", // BPT-QUARTET "0x56aD84b777ff732de69E85813DAEE1393a9FFE10", // BPT-FOTO-II "0xe3f201D4676d1Aec0Baa8c70f8f07F14B73B3Aec", // bTAROT + "0x838229095fa83bcd993ef225d01a990e3bc197a8", // BPT-lzFOTO ]; const ftmOwnTokens = [ "0xF24Bcf4d1e507740041C9cFd2DddB29585aDCe1e", // BEETS - "0xeCAa1cBd28459d34B766F9195413Cb20122Fb942", // BPT-STABEET "0x2Cea0dA40cF133721377bB2b0bF4aDc43715BFC3", // BPT-USDCfBEETS "0xcdE5a11a4ACB4eE4c805352Cec57E236bdBC3837", // BPT-BEETS-FTM ]; @@ -28,19 +33,31 @@ const ftmOwnTokens = [ const opTokens = [ nullAddress, ADDRESSES.optimism.OP, // OP + ADDRESSES.optimism.USDC, "0xFdb794692724153d1488CcdBE0C56c252596735F", // LDO "0xFE8B128bA8C78aabC59d4c64cEE7fF28e9379921", // BAL + "0xEf47a07945D53Ee3a511751375A1ed0B79d6232D", // BPT-STABEET-gauge "0x38f79beFfC211c6c439b0A3d10A0A673EE63AFb4", // BPT-rETH-ETH-gauge + "0x61ac9315a1Ae71633E95Fb35601B59180eC8d61d", // BPT-rETH-ETH-aura-vault + "0x9f43f726dF654E033B04c39989af90ab44875fEB", // BPT-wstETH-ETH-CL-aura-vault + "0x23Ca0306B21ea71552B148cf3c4db4Fc85AE1929", // BPT-3stable + "0x88726Ff53eE2dc7F55C17FBd93521B8B92519f49", // BPT-3stable-gauge ]; const opOwnTokens = [ - "0xEf47a07945D53Ee3a511751375A1ed0B79d6232D", // BPT-STABEET-gauge "0x97513e975a7fA9072c72C92d8000B0dB90b163c5", // BEETS ]; const ethTokens = [ + ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.DAI, + ADDRESSES.ethereum.USDT, + ADDRESSES.ethereum.WETH, + ADDRESSES.ethereum.WBTC, "0x5c6Ee304399DBdB9C8Ef030aB642B10820DB8F56", // B-80BAL-20WETH + "0xc128a9954e6c874ea3d62ce62b468ba073093f25", // veBAL "0x616e8BfA43F920657B3497DBf40D6b1A02D4608d", // auraBAL + "0x3fa73f1e5d8a792c80f426fc8f84fbf7ce9bbcac", // vlAURA "0xA13a9247ea42D743238089903570127DdA72fE44", // bb-a-USD ]; From e084a4b64a3766aa606362f74986cf8ed5ad0aa0 Mon Sep 17 00:00:00 2001 From: Rhinestone Cowboy <42247026+AntwuanDixon@users.noreply.github.com> Date: Thu, 10 Aug 2023 01:02:04 +0800 Subject: [PATCH 0750/1974] feature: add wETH.e address to sumTokens2 array (#7082) --- projects/struct-finance/index.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/projects/struct-finance/index.js b/projects/struct-finance/index.js index 891238abff3..4f9528e73f9 100644 --- a/projects/struct-finance/index.js +++ b/projects/struct-finance/index.js @@ -18,7 +18,12 @@ async function tvl(ts, _, __, { api }) { return sumTokens2({ api, owners: vaults, - tokens: [ADDRESSES.avax.BTC_b, ADDRESSES.avax.USDC, addresses.token.fsGlp], + tokens: [ + ADDRESSES.avax.BTC_b, + ADDRESSES.avax.USDC, + ADDRESSES.avax.WETH_e, + addresses.token.fsGlp, + ], }); } From 99d755360866e2959ab3b33f3c0b6c22688071f9 Mon Sep 17 00:00:00 2001 From: Francesco Primerano <67144388+pf55351@users.noreply.github.com> Date: Wed, 9 Aug 2023 19:05:24 +0200 Subject: [PATCH 0751/1974] Add WAVAX WSOL and WMPL (#7089) --- projects/folks-finance/v2/constants.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/projects/folks-finance/v2/constants.js b/projects/folks-finance/v2/constants.js index 34f404a4d1e..93fe35ba2c0 100644 --- a/projects/folks-finance/v2/constants.js +++ b/projects/folks-finance/v2/constants.js @@ -49,6 +49,21 @@ const pools = [ appId: 1067289481, assetId: 887406851, }, + //WAVAX + { + appId: 1166977433, + assetId: 893309613, + }, + //WSOL + { + appId: 1166980669, + assetId: 887648583, + }, + //WMPL + { + appId: 1166982094, + assetId: 1163259470, + }, ]; const oracleAppId = 1040271396; From 8f648eb2c26434e5b61db6648e7ab2ea095f1ba8 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 9 Aug 2023 20:15:56 +0200 Subject: [PATCH 0752/1974] calc: track osmosis --- projects/calculated-finance/index.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/projects/calculated-finance/index.js b/projects/calculated-finance/index.js index 67ed812a2d4..4e7df9cf8af 100644 --- a/projects/calculated-finance/index.js +++ b/projects/calculated-finance/index.js @@ -1,6 +1,4 @@ -const { get } = require("../helper/http"); -const { sumTokens, endPoints } = require('../helper/chain/cosmos') - +const { sumTokens, } = require('../helper/chain/cosmos') async function tvl() { const owners = [ @@ -13,4 +11,9 @@ module.exports = { kujira: { tvl, }, + osmosis: { + tvl: async () => { + return sumTokens({ owners: ['osmo1zacxlu90sl6j2zf90uctpddhfmux84ryrw794ywnlcwx2zeh5a4q67qtc9'], chain: 'osmosis' }) + } + }, } \ No newline at end of file From 65eae41333ba40eb084e9a8a9a57101372462476 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 9 Aug 2023 20:51:13 +0200 Subject: [PATCH 0753/1974] track https://app.preon.finance --- projects/preon/index.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 projects/preon/index.js diff --git a/projects/preon/index.js b/projects/preon/index.js new file mode 100644 index 00000000000..6cf63e11d94 --- /dev/null +++ b/projects/preon/index.js @@ -0,0 +1,17 @@ +const { sumTokensExport } = require('../helper/unwrapLPs') +const ADDRESSES = require('../helper/coreAssets.json') + +const config = { + arbitrum: { + ownerTokens: [ + [[ADDRESSES.null, '0x82aF49447D8a07e3bd95BD0d56f35241523fBab1', '0xe50fa9b3c56ffb159cb0fca61f5c9d750e8128c8'], '0xA2Ce28868A852f4B01903B5de07d4835feFe9086'], + [['0x8ffdf2de812095b1d19cb146e4c004587c0a0692', '0x93b346b6bc2548da6a1e7d98e9a421b42541425b', ], '0x8AD15574A87e30061f24977faaA2d99bC45A3169'], + ], + } +} + +Object.keys(config).forEach(chain => { + module.exports[chain] = { + tvl: sumTokensExport(config[chain]) + } +}) \ No newline at end of file From a43ba93d2dd07164f1e2070b7b6cc49134d6c5bf Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 9 Aug 2023 22:45:41 +0200 Subject: [PATCH 0754/1974] track gmx-v2 --- projects/gmx-v2/index.js | 11 +++++++++++ projects/helper/gmx.js | 30 ++++++++++++++++++++++++++++-- 2 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 projects/gmx-v2/index.js diff --git a/projects/gmx-v2/index.js b/projects/gmx-v2/index.js new file mode 100644 index 00000000000..1f48c0ef882 --- /dev/null +++ b/projects/gmx-v2/index.js @@ -0,0 +1,11 @@ +const { gmxExportsV2 } = require('../helper/gmx') + + +module.exports = { + arbitrum: { + tvl: gmxExportsV2({ eventEmitter: '0xc8ee91a54287db53897056e12d9819156d3822fb', fromBlock: 107737756, }), + }, + avax:{ + tvl: gmxExportsV2({ eventEmitter: '0xDb17B211c34240B014ab6d61d4A31FA0C0e20c26', fromBlock: 32162455, }), + }, +}; diff --git a/projects/helper/gmx.js b/projects/helper/gmx.js index 07295c3c566..c324d620494 100644 --- a/projects/helper/gmx.js +++ b/projects/helper/gmx.js @@ -1,4 +1,5 @@ const { sumTokens2 } = require('./unwrapLPs') +const { getLogs } = require('../helper/cache/getLogs') function gmxExports({ vault, blacklistedTokens = [], abis = {} }) { abis = { ...defaultAbis, ...abis} @@ -15,9 +16,34 @@ function gmxExports({ vault, blacklistedTokens = [], abis = {} }) { const defaultAbis = { allWhitelistedTokensLength: 'uint256:allWhitelistedTokensLength', - allWhitelistedTokens: 'function allWhitelistedTokens(uint256) view returns (address)' + allWhitelistedTokens: 'function allWhitelistedTokens(uint256) view returns (address)', + EventLog1: "event EventLog1(address msgSender, string eventName, string indexed eventNameHash, bytes32 indexed topic1, tuple(tuple(tuple(string key, address value)[] items, tuple(string key, address[] value)[] arrayItems) addressItems, tuple(tuple(string key, uint256 value)[] items, tuple(string key, uint256[] value)[] arrayItems) uintItems, tuple(tuple(string key, int256 value)[] items, tuple(string key, int256[] value)[] arrayItems) intItems, tuple(tuple(string key, bool value)[] items, tuple(string key, bool[] value)[] arrayItems) boolItems, tuple(tuple(string key, bytes32 value)[] items, tuple(string key, bytes32[] value)[] arrayItems) bytes32Items, tuple(tuple(string key, bytes value)[] items, tuple(string key, bytes[] value)[] arrayItems) bytesItems, tuple(tuple(string key, string value)[] items, tuple(string key, string[] value)[] arrayItems) stringItems) eventData)", +} + + +function gmxExportsV2({ eventEmitter, fromBlock, blacklistedTokens = [], abis = {} }) { + // https://github.com/gmx-io/gmx-synthetics/blob/main/contracts/market/MarketFactory.sol#L87C19-L87C31 + // https://github.com/gmx-io/gmx-synthetics/tree/main/deployments/arbitrum + abis = { ...defaultAbis, ...abis} + return async (ts, _block, _, { api }) => { + const logs = await getLogs({ + api, + target: eventEmitter, + topics: ['0x137a44067c8961cd7e1d876f4754a5a3a75989b4552f1843fc69c3b372def160', '0xad5d762f1fc581b3e684cf095d93d3a2c10754f60124b09bec8bf3d76473baaf',], // need both else too many logs + eventAbi: defaultAbis.EventLog1, + onlyArgs: true, + fromBlock, + }) + + const ownerTokens = logs.map(i => { + const [market, index, long, short] = i[4].addressItems.items.map(i => i.value) + return [[long, short, ], market] + }) + return api.sumTokens({ownerTokens, blacklistedTokens, }) + } } module.exports = { - gmxExports + gmxExports, + gmxExportsV2, } From 6b62ddfd89013771e499099367f34f23cd1784fa Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 10 Aug 2023 00:18:23 +0200 Subject: [PATCH 0755/1974] stargate: track base --- projects/stargatefinance/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/projects/stargatefinance/index.js b/projects/stargatefinance/index.js index 5c6978ff5bf..c83ed2090e3 100644 --- a/projects/stargatefinance/index.js +++ b/projects/stargatefinance/index.js @@ -30,6 +30,10 @@ const CONFIG = { metis:{ router: '0x2F6F07CDcf3588944Bf4C42aC74ff24bF56e7590', }, + base:{ + router: '0x45f1A95A4D3f3836523F5c83673c797f4d4d263B', + etherToken: '0x224d8fd7ab6ad4c6eb4611ce56ef35dec2277f03', + }, } module.exports = { From e4197f2f45a7357d4abd4e8d408d5bded60b3088 Mon Sep 17 00:00:00 2001 From: cochilli <138674364+cochilli@users.noreply.github.com> Date: Thu, 10 Aug 2023 02:28:28 +0200 Subject: [PATCH 0756/1974] add cochilli (#7094) --- projects/cochilli/index.js | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 projects/cochilli/index.js diff --git a/projects/cochilli/index.js b/projects/cochilli/index.js new file mode 100644 index 00000000000..71eb4b5f81f --- /dev/null +++ b/projects/cochilli/index.js @@ -0,0 +1,10 @@ +const { sumTokensExport } = require('../helper/unwrapLPs'); + +const owner = "0x8D5b64b8D8904E4aEc79F10468F347534D2A1b79"; // vault address +const tokens = ["0xd9aAEc86B65D86f6A7B5B1b0c42FFA531710b6CA"]; // USDC + +module.exports = { + base: { + tvl: sumTokensExport({ owner, tokens }), + }, +}; From a92f86aa81c93bfadc8043cbbac4f8936e201e41 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 10 Aug 2023 04:05:15 +0200 Subject: [PATCH 0757/1974] code refactor --- projects/bond-appetit.js | 14 +-- projects/defiplaza.js | 21 ++--- projects/jexchange/index.js | 7 +- projects/polymarket.js | 75 ---------------- projects/rift-finance/index.js | 151 ++++++--------------------------- projects/sheepdex/abi.json | 4 - projects/sheepdex/index.js | 53 +----------- projects/snowball/index.js | 6 +- projects/timeswap/index.js | 6 +- projects/yieldyak/index.js | 44 +++------- projects/yokaiswap/index.js | 28 +----- 11 files changed, 58 insertions(+), 351 deletions(-) delete mode 100644 projects/sheepdex/abi.json diff --git a/projects/bond-appetit.js b/projects/bond-appetit.js index 49b5cebfb2a..ead5a60c507 100644 --- a/projects/bond-appetit.js +++ b/projects/bond-appetit.js @@ -1,17 +1,5 @@ -const { GraphQLClient, } = require('graphql-request') - -async function fetch() { - var endpoint = 'https://cache.bondappetit.io/api' - var graphQLClient = new GraphQLClient(endpoint) - - var query = ` { getTVL } `; - var results = await graphQLClient.request(query) - return parseFloat(results.getTVL) -} - module.exports = { ethereum: { - fetch + tvl: () => ({}) }, - fetch } diff --git a/projects/defiplaza.js b/projects/defiplaza.js index 6aa8bda1367..e58f93cf19a 100644 --- a/projects/defiplaza.js +++ b/projects/defiplaza.js @@ -1,22 +1,11 @@ -const { request, } = require('graphql-request'); -const { toUSDTBalances } = require('./helper/balances'); +const { cachedGraphQuery } = require('./helper/cache') const graphUrl = 'https://api.thegraph.com/subgraphs/name/omegasyndicate/defiplaza'; -const graphQuery = ` - query get_tvl($timestamp: Int) { - hourlies(first: 1, orderBy: date, orderDirection: desc, where:{date_lte: $timestamp}) { - totalValueLockedUSD - } - } -`; -async function tvl(timestamp, block) { - const { hourlies } = await request(graphUrl, graphQuery, { - timestamp, - }); - const usdTvl = Number(hourlies[0].totalValueLockedUSD); - - return toUSDTBalances(usdTvl); +async function tvl(timestamp, block, _, { api }) { + const { pools } = await cachedGraphQuery('defiplaza', graphUrl, '{ pools { id tokens { id } }}'); + const ownerTokens = pools.map(pool => [pool.tokens.map(token => token.id), pool.id]); + return api.sumTokens({ ownerTokens}) } module.exports = { diff --git a/projects/jexchange/index.js b/projects/jexchange/index.js index 769f413ce46..fad040c25ca 100644 --- a/projects/jexchange/index.js +++ b/projects/jexchange/index.js @@ -1,13 +1,12 @@ const { sumTokens } = require("../helper/chain/elrond"); +const { getConfig } = require('../helper/cache') async function tvl() { + const pools = await getConfig('jexchange', 'https://api.jexchange.io/pools') const owners = [ + ...pools.map(pool => pool.sc_address), "erd1qqqqqqqqqqqqqpgqmmxzmktd09gq0hldtczerlv444ykt3pz6avsnys6m9", "erd1qqqqqqqqqqqqqpgqdh6jeeyamfhq66u7rmkyc48q037kk8n26avs400gg8", - "erd1qqqqqqqqqqqqqpgqpa3pdmemt5l2ex80g7pksr2ettt955d66avsz76hyt", - "erd1qqqqqqqqqqqqqpgq5nmzpdkpr6c5q894f553n49t0uc67vc96avsxgjl3v", - "erd1qqqqqqqqqqqqqpgqru6tkedsjjszrkkanctgq9m6rm2ple436avs0qj07m", - "erd1qqqqqqqqqqqqqpgquenuwz852khuxcau49md27wk2qp03v4s6avsdvmxkc", ]; return sumTokens({ owners }); } diff --git a/projects/polymarket.js b/projects/polymarket.js index 55d4f557f61..39c70a6c4d6 100644 --- a/projects/polymarket.js +++ b/projects/polymarket.js @@ -1,80 +1,5 @@ const ADDRESSES = require('./helper/coreAssets.json') const sdk = require("@defillama/sdk"); -const { request, } = require("graphql-request"); -const { BigNumber } = require("bignumber.js"); -const utils = require('./helper/utils'); - - -// Can retrieve https://strapi-matic.poly.market/markets?active=true&_sort=end_date:desc -// Old graphql https://api.thegraph.com/subgraphs/name/tokenunion/polymarket-matic -// New graphql https://api.thegraph.com/subgraphs/name/polymarket/matic-markets-5 - -// Useful resources : https://polymarketwhales.info/markets and https://polymarket.com/ - -// # block: { number: $block } -const graphUrl = 'https://api.thegraph.com/subgraphs/name/polymarket/matic-markets-5' -const graphQuery = ` -query GET_POLYMARKET($skip: Int, $block: Int) { - conditions( - first: 1000 - skip: $skip - block: { number: $block } - ) { - id - oracle - questionId - outcomeSlotCount - resolutionTimestamp - fixedProductMarketMakers( - orderBy: creationTimestamp - ) - { - id - creationTimestamp - collateralToken { - id name symbol decimals - } - liquidityParameter - scaledLiquidityParameter - collateralVolume - scaledCollateralVolume - } - } -} -`; - -async function getMarketsLiquidity_graphql(timestamp, block, chainBlocks) { - let scaledLiquidityParameterSum = BigNumber(0) - let skip = 0 - // Continue querying graph while end not reached. Hard cap: skip = 5000 - while (skip !== -1) { - const { conditions } = await request( - graphUrl, - graphQuery, - {skip, block} - ); - skip += 1000 - console.log(`${conditions && conditions.length} conditions found for skip: ${skip}`) - if (conditions && conditions.length > 0) { - conditions.forEach(condition => { - condition.fixedProductMarketMakers.forEach(fpmm => { - console.log(fpmm) - scaledLiquidityParameterSum = scaledLiquidityParameterSum.plus(BigNumber(fpmm.scaledLiquidityParameter)) - }) - }) - } - else { - // Stop criteria: no conditions returned by graphql api - skip = -1 - } - } - - return scaledLiquidityParameterSum -} - -// After a market resolves, then the winning market participants can withdraw their share based on the redemption rate and their contribution at the closing of the market. All participants do not do it immediately though, so volume of every market should be accounted for in TVL -// const polymarket_api_url = 'https://strapi-matic.poly.market/markets?_limit=-1&_sort=closed_time:desc' // &active=true - const conditionalTokensContract = '0x4D97DCd97eC945f40cF65F87097ACe5EA0476045' const polygonUsdcContract = ADDRESSES.polygon.USDC diff --git a/projects/rift-finance/index.js b/projects/rift-finance/index.js index a0500ce2edb..7e0e424af9c 100644 --- a/projects/rift-finance/index.js +++ b/projects/rift-finance/index.js @@ -1,9 +1,5 @@ -const sdk = require("@defillama/sdk"); - -const { getBlock } = require("../helper/http"); -const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); -const { getChainTransform } = require("../helper/portedTokens"); -const { request, gql } = require("graphql-request"); +const { cachedGraphQuery } = require('../helper/cache') +const { sumTokens2 } = require('../helper/unwrapLPs') const NETWORKS = require("./networks"); @@ -15,152 +11,53 @@ const masterChefAbi = { userInfo: "function userInfo(uint256 pid, address user) view returns (tuple(uint256 amount, uint256 rewardDebt))", } -function getAbi(obj, fnName) { - return obj[fnName]; -} - -function addressToId(address) { - return address.toLowerCase(); -} +async function tvl(timestamp, chainBlocks, _, { api }) { + const chain = api.chain -async function getChainBalances(timestamp, chainBlocks, chain) { - const block = await getBlock(timestamp, chain, chainBlocks); - const balances = {}; - const transform = await getChainTransform(chain); + const { graphUrl } = NETWORKS[chain]; - const { coreAddress, graphUrl } = NETWORKS[chain]; - - const query = gql` - query get_vaults($coreAddr: String) { - core(id: $coreAddr) { + const query = ` + query get_vaults{ + cores{ vaults { id type - token0 { - id - } - token1 { - id - } - pair { - id - } + token0 { id } + token1 { id } + pair { id } } } } `; - const queryResult = await request(graphUrl, query, { - coreAddr: addressToId(coreAddress), - }); - - await Promise.all(queryResult.core.vaults.map(async vault => { - - // Get balances. - const token0Bal = ( - await sdk.api.abi.call({ - chain, - block, - target: vault.token0.id, - abi: "erc20:balanceOf", - params: [vault.id], - }) - ).output; + const { cores } = await cachedGraphQuery('rift-fi/' + chain, graphUrl, query); + const toa = [] - const token1Bal = ( - await sdk.api.abi.call({ - chain, - block, - target: vault.token1.id, - abi: "erc20:balanceOf", - params: [vault.id], - }) - ).output; - - const pairBal = ( - await sdk.api.abi.call({ - chain, - block, - target: vault.pair.id, - abi: "erc20:balanceOf", - params: [vault.id], - }) - ).output; - - // Add token balances. - sdk.util.sumSingleBalance(balances, transform(vault.token0.id), token0Bal); - sdk.util.sumSingleBalance(balances, transform(vault.token1.id), token1Bal); - - // Unwrap and add pair balances. - await unwrapUniswapLPs( - balances, - [{ balance: pairBal, token: vault.pair.id }], - block, - chain, - transform - ); + await Promise.all(cores[0].vaults.map(async vault => { + toa.push([vault.token0.id, vault.id]) + toa.push([vault.token1.id, vault.id]) + toa.push([vault.pair.id, vault.id]) // Look for MasterChef balance. if (vault.type === "SUSHI_SWAP") { - const rewarder = ( - await sdk.api.abi.call({ - chain, - block, - target: vault.id, - abi: getAbi(riftVaultAbi, "rewarder"), - params: [], - }) - ).output; - - const pid = ( - await sdk.api.abi.call({ - chain, - block, - target: vault.id, - abi: getAbi(riftVaultAbi, "pid"), - params: [], - }) - ).output; + const rewarder = await api.call({ target: vault.id, abi: riftVaultAbi.rewarder, }) - const { amount: masterChefBal } = ( - await sdk.api.abi.call({ - chain, - block, - target: rewarder, - abi: getAbi(masterChefAbi, "userInfo"), - params: [pid, vault.id], - }) - ).output; + const pid = await api.call({ target: vault.id, abi: riftVaultAbi.pid, }) - // Unwrap and add MasterChef balances. - await unwrapUniswapLPs( - balances, - [{ balance: masterChefBal, token: vault.pair.id }], - block, - chain, - transform - ); + const { amount: masterChefBal } = await api.call({ target: rewarder, abi: masterChefAbi.userInfo, params: [pid, vault.id], }) + api.add(vault.pair.id, masterChefBal) } })) - return balances; + return sumTokens2({ api, tokensAndOwners: toa, resolveLP: true }); } -async function aurora(timestamp, block, chainBlocks) { - return getChainBalances(timestamp, chainBlocks, "aurora"); -} - -async function ethereum(timestamp, block, chainBlocks) { - return getChainBalances(timestamp, chainBlocks, "ethereum"); -} module.exports = { - timetravel: true, - misrepresentedTokens: false, aurora: { - tvl: aurora, + tvl, }, ethereum: { - tvl: ethereum, + tvl, }, }; diff --git a/projects/sheepdex/abi.json b/projects/sheepdex/abi.json deleted file mode 100644 index df726d82f30..00000000000 --- a/projects/sheepdex/abi.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "token0": "address:token0", - "token1": "address:token1" -} \ No newline at end of file diff --git a/projects/sheepdex/index.js b/projects/sheepdex/index.js index 57c5b19745c..b1eb1bf0f2c 100644 --- a/projects/sheepdex/index.js +++ b/projects/sheepdex/index.js @@ -1,50 +1,5 @@ -const sdk = require("@defillama/sdk"); -const abi = require("./abi.json"); -const { GraphQLClient, gql } = require("graphql-request"); -const { sumTokens2 } = require('../helper/unwrapLPs') +const { uniV3Export } = require("../helper/uniswapV3"); -const SpeFactory = "0x571521f8c16f3c4eD5f2490f19187bA7A5A3CBDf"; -const SPC = "0x6a428ff9bfec2c8f676b8c905d49146c6106af90"; - -const bscTvl = async (_, _b, { bsc: block }) => { - const chain = 'bsc' - var endpoint = "https://api.thegraph.com/subgraphs/name/hfersss/sheepdexv1"; - var graphQLClient = new GraphQLClient(endpoint); - - var query = gql` - { - pools { - id - } - } - `; - - const pools = ( - await graphQLClient.request(query) - ).pools.map((pool) => pool.id); - const { output: token0s } = await sdk.api.abi.multiCall({ - abi: abi.token0, - calls: pools.map(i => ({ target: i})), - chain, block, - }) - const { output: token1s } = await sdk.api.abi.multiCall({ - abi: abi.token1, - calls: pools.map(i => ({ target: i})), - chain, block, - }) - const toa = [] - token0s.forEach((_, i) => { - toa.push([token0s[i].output, pools[i]]) - toa.push([token1s[i].output, pools[i]]) - }) - return sumTokens2({ chain, block, tokensAndOwners: toa, }) -}; - -module.exports = { - misrepresentedTokens: true, - bsc: { - tvl: bscTvl, - }, - methodology: - "Counts liquidity on the AMM Pools, pulling data from the chart -> https://info.sheepdex.org/#/", -}; +module.exports = uniV3Export({ + bsc: { factory: '0x571521f8c16f3c4ed5f2490f19187ba7a5a3cbdf', fromBlock: 11640600, } +}) diff --git a/projects/snowball/index.js b/projects/snowball/index.js index 618c5a5980c..7415e260de4 100644 --- a/projects/snowball/index.js +++ b/projects/snowball/index.js @@ -1,4 +1,4 @@ -const { request, gql } = require("graphql-request"); +const { cachedGraphQuery } = require('../helper/cache') const { sumTokens2 } = require("../helper/unwrapLPs"); const { staking } = require('../helper/staking.js'); @@ -6,7 +6,7 @@ const abi = require('./abi.json') const API_URL = `https://api.snowapi.net/graphql` -const query = gql` +const query = ` query { SnowglobeContracts { pair @@ -54,7 +54,7 @@ async function getSnowglobeBalances(snowglobes, api) { } async function tvl(_timestamp, _ethereumBlock, chainBlocks, { api }) { - let data = await request(API_URL, query); + const data = await cachedGraphQuery('snowball', API_URL, query) const deprecatedSnowglobes = data.DeprecatedContracts.filter(contract => contract.kind === "Snowglobe").map(contract => ({ pair: contract.pair, snowglobeAddress: contract.contractAddresses[0] })); const deprecatedStablevaults = data.DeprecatedContracts.filter(contract => contract.kind === "Stablevault").map(contract => ({ swapAddress: contract.contractAddresses[2] })); diff --git a/projects/timeswap/index.js b/projects/timeswap/index.js index 43f21f7c237..1abceddcde5 100644 --- a/projects/timeswap/index.js +++ b/projects/timeswap/index.js @@ -1,5 +1,5 @@ -const { request, gql } = require("graphql-request"); const { sumTokens2 } = require('../helper/unwrapLPs') +const { cachedGraphQuery } = require('../helper/cache') const GRAPH_URLS = { polygon: @@ -8,7 +8,7 @@ const GRAPH_URLS = { function chainTvl(chain) { return async (timestamp, _ethBlock, chainBlocks, { api }) => { - const query = gql` + const query = ` { pairs { id @@ -23,7 +23,7 @@ function chainTvl(chain) { `; const pairs = ( - await request(GRAPH_URLS[chain], query) + await cachedGraphQuery('timeswap/'+api.chain, GRAPH_URLS[chain], query) ).pairs.map((pair) => ({ address: pair.id, asset: pair.asset.id, diff --git a/projects/yieldyak/index.js b/projects/yieldyak/index.js index 2b2922662c7..5b9438a288f 100644 --- a/projects/yieldyak/index.js +++ b/projects/yieldyak/index.js @@ -1,43 +1,25 @@ -const sdk = require('@defillama/sdk'); -const { request, gql } = require("graphql-request"); const { staking } = require('../helper/staking'); +const { cachedGraphQuery } = require('../helper/cache') const graphUrl = 'https://api.thegraph.com/subgraphs/name/yieldyak/reinvest-tracker' -const graphQuery = gql` -query get_tvl($block: Int) { - farms(first: 1000) { - id - name - depositToken { - id - } - depositTokenBalance - } -} -`; +const graphQuery = `{ farms(first: 1000) { id }}`; async function tvl(timestamp, ethBlock, chainBlocks, { api }) { - const block = chainBlocks.avax; - const farms = (await request(graphUrl, graphQuery, { block })).farms - const balances = {} - farms.forEach(i => sdk.util.sumSingleBalance(balances, i.depositToken.id, i.depositTokenBalance, 'avax')) - delete balances['avax:0x59414b3089ce2af0010e7523dea7e2b35d776ec7'] - - // TODO: remove this code, it is no longer necessary - const stakedGLP = 'avax:0x5643f4b25e36478ee1e90418d5343cb6591bcb9d' - if (balances[stakedGLP]) { - balances['avax:0x01234181085565ed162a948b6a5e88758cd7c7b8'] = balances[stakedGLP] - delete balances[stakedGLP] - } - return balances + const { farms } = await cachedGraphQuery('yieldyak', graphUrl, graphQuery) + const tokens = await api.multiCall({ abi: 'address:depositToken', calls: farms.map(i => i.id), permitFailure: true, }) + const vals = await api.multiCall({ abi: 'uint256:totalDeposits', calls: farms.map(i => i.id), permitFailure: true, }) + tokens.forEach((token, i) => { + if (!token || !vals[i]) return; + api.add(token, vals[i]) + }) } const masterYak = "0x0cf605484A512d3F3435fed77AB5ddC0525Daf5f" const yakToken = "0x59414b3089ce2af0010e7523dea7e2b35d776ec7" module.exports = { - avax:{ - tvl, - staking: staking(masterYak, yakToken), - } + avax: { + tvl, + staking: staking(masterYak, yakToken), + } } \ No newline at end of file diff --git a/projects/yokaiswap/index.js b/projects/yokaiswap/index.js index 3bdfac89696..30382f3e84a 100644 --- a/projects/yokaiswap/index.js +++ b/projects/yokaiswap/index.js @@ -1,31 +1,7 @@ -const { GraphQLClient, gql } = require("graphql-request"); -const { toUSDTBalances } = require("../helper/balances"); const { getUniTVL, sumTokensExport } = require('../helper/unknownTokens') -const sdk = require('@defillama/sdk') -const axios = require("axios"); - -async function fetch() { - const endpoint = - "https://v0.yokaiswap.com/subgraphs/name/yokaiswap/exchange"; - const graphQLClient = new GraphQLClient(endpoint); - - const query = gql` - query yokaiFactories { - yokaiFactories { - totalLiquidityUSD - } - } - `; - - const data = await graphQLClient.request(query); - - return toUSDTBalances(data.yokaiFactories[0].totalLiquidityUSD); -} - -const getReservesABI = 'function getReserves() view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast)' // had to be disabled till we get multicall working -const tvl_v0 = getUniTVL({ chain: 'godwoken', factory: '0x5ef0d2d41a5f3d5a083bc776f94282667c27b794', useDefaultCoreAssets: false, abis: { getReserves: getReservesABI }}) +const tvl_v0 = getUniTVL({ chain: 'godwoken', factory: '0x5ef0d2d41a5f3d5a083bc776f94282667c27b794', useDefaultCoreAssets: true}) const tvl_v1 = getUniTVL({ chain: 'godwoken_v1', factory: '0x7ec2d60880d83614dd4013D39CF273107f30624c', useDefaultCoreAssets: true, }) module.exports = { @@ -33,7 +9,7 @@ module.exports = { misrepresentedTokens: true, methodology: `Finds TotalLiquidityUSD using the YokaiSwap subgraph "https://www.yokaiswap.com/subgraphs/name/yokaiswap/exchange". Staking accounts for the YOK locked in MasterChef (0x62493bFa183bB6CcD4b4e856230CF72f68299469).`, godwoken: { - tvl: fetch, + tvl: tvl_v0, //staking, }, godwoken_v1: { From 2924e886047665d483a28bca094fe936fee43074 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 10 Aug 2023 04:16:31 +0200 Subject: [PATCH 0758/1974] rug marginswap --- projects/marginswap/index.js | 49 +++--------------------------------- 1 file changed, 4 insertions(+), 45 deletions(-) diff --git a/projects/marginswap/index.js b/projects/marginswap/index.js index 74a709ed78a..a576ab3b5a9 100644 --- a/projects/marginswap/index.js +++ b/projects/marginswap/index.js @@ -1,55 +1,14 @@ -const sdk = require("@defillama/sdk"); -const { GraphQLClient, gql } = require("graphql-request"); - -function getChainTvl(chain) { - return async (timestamp, ethBlock, chainBlocks) => { - const balances = {}; - - var api = `https://api.thegraph.com/subgraphs/name/marginswap/marginswap-v2-${ - chain === "avax" ? "avalanche" : chain - }`; - - var graphQLClient = new GraphQLClient(api); - - var query = gql` - { - aggregatedBalances { - balance - token - } - } - `; - - const data = ( - await graphQLClient.request(query) - ).aggregatedBalances; - - data.forEach((data) => { - sdk.util.sumSingleBalance( - balances, - `${chain}:${data.token}`, - data.balance - ); - }); - - return balances; - }; -} - module.exports = { - misrepresentedTokens: true, ethereum: { - tvl: getChainTvl("ethereum"), + tvl: () => ({}), }, bsc: { - tvl: getChainTvl("bsc"), + tvl: () => ({}), }, avax: { - tvl: getChainTvl("avax"), + tvl: () => ({}), }, polygon: { - tvl: getChainTvl("polygon"), + tvl: () => ({}), }, - methodology: - "Counts liquidity of deposits, pulling data from Analytics Subgraphs", }; From 4161447d0f13a37e81d338d713f8e3fa19cf1e18 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 10 Aug 2023 04:24:16 +0200 Subject: [PATCH 0759/1974] refactor maffin --- projects/kei-finance/index.js | 31 ---------------------- projects/maffin/index.js | 49 ++++++++--------------------------- 2 files changed, 11 insertions(+), 69 deletions(-) diff --git a/projects/kei-finance/index.js b/projects/kei-finance/index.js index 6c29579d47a..9baab1b5c3a 100644 --- a/projects/kei-finance/index.js +++ b/projects/kei-finance/index.js @@ -1,38 +1,7 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const sdk = require("@defillama/sdk"); -const { request, } = require("graphql-request"); -const { BigNumber } = require("bignumber.js"); - -const TOKEN_ADDRESS = "0xF75C7a59bCD9bd207C4Ab1BEB0b32EEd3B6392f3"; -const TREASURY_ADDRESS = "0x3D027824a9Eb4cc5E8f24D97FD8495eA9DC7026F"; -const WETH_ADDRESS = ADDRESSES.ethereum.WETH; - -const config = { - ethereum: { - subgraph: 'https://api.thegraph.com/subgraphs/name/kei-finance/core', - } -} - -const graphQuery = ` - query GetStakingDetails { - staking(id:"staking") { - totalPrincipal - totalRewards - } - } -`; module.exports = { ethereum: { tvl: () => 0, staking: () => 0, - /* staking: async () => { - const { staking } = await request( - config.ethereum.subgraph, - graphQuery - ) - - return { [TOKEN_ADDRESS]: BigNumber(staking.totalPrincipal).plus(BigNumber(staking.totalRewards)) }; - }, */ } }; diff --git a/projects/maffin/index.js b/projects/maffin/index.js index 18d3f0afaf7..2e8eddc9129 100644 --- a/projects/maffin/index.js +++ b/projects/maffin/index.js @@ -1,45 +1,18 @@ -const sdk = require("@defillama/sdk"); -const { request, gql } = require("graphql-request"); - +const { getLogs } = require('../helper/cache/getLogs') const MAFFIN_HUB = "0x6690384822afF0B65fE0C21a809F187F5c3fcdd8"; -async function tvl(_, block) { - const graphQuery = gql` - query poolQuery { - tokens { - id - } - } - `; - const tokens = ( - await request( - "https://api.thegraph.com/subgraphs/name/muffinfi/muffin-mainnet", - graphQuery - ) - ).tokens.map(({ id }) => id); - - const tokensBalances = await Promise.all( - tokens.map( - async (token) => - ( - await sdk.api.abi.call({ - target: token, - abi: "erc20:balanceOf", - params: MAFFIN_HUB, - block, - }) - ).output - ) - ); - - const balances = {}; - - tokens.forEach((token, i) => (balances[token] = tokensBalances[i])); - return balances; +async function tvl(_, block, _1, { api }) { + const logs = await getLogs({ + api, + target: MAFFIN_HUB, + topic: 'PoolCreated(address,address,bytes32)', + eventAbi: 'event PoolCreated(address indexed token0, address indexed token1, bytes32 indexed poolId)', + onlyArgs: true, + fromBlock: 15459725, + }) + return api.sumTokens({ owner: MAFFIN_HUB, tokens: logs.map(log => log.token0).concat(logs.map(log => log.token1)), }) } module.exports = { - timetravel: true, - misrepresentedTokens: true, methodology: `Counts the tokens balances of the MaffinHub contract`, ethereum: { tvl, From 1b7e125772bf5e87a62da364d2a0195f7f218a50 Mon Sep 17 00:00:00 2001 From: deboguer-jng <71242057+deboguer-jng@users.noreply.github.com> Date: Thu, 10 Aug 2023 01:50:32 -0700 Subject: [PATCH 0760/1974] Feat/update arbitrove tvl (#7095) * implemented tvl function for arbitrove or APL token * code refactor * feat: update arbitrove tvl --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/arbitrove/index.js | 44 +++++++++++++++++++++++++++++-------- 1 file changed, 35 insertions(+), 9 deletions(-) diff --git a/projects/arbitrove/index.js b/projects/arbitrove/index.js index 08ae691e021..ed109810b04 100644 --- a/projects/arbitrove/index.js +++ b/projects/arbitrove/index.js @@ -1,21 +1,47 @@ -const { getLogs } = require('../helper/cache/getLogs'); -const { nullAddress, } = require('../helper/unwrapLPs'); -const ALP_TOKEN = '0xb49B6A3Fd1F4bB510Ef776de7A88A9e65904478A'; + +const sdk = require("@defillama/sdk"); +const { getLogs } = require("../helper/cache/getLogs"); +const { nullAddress } = require("../helper/unwrapLPs"); +const ALP_TOKEN = "0xb49B6A3Fd1F4bB510Ef776de7A88A9e65904478A"; +const getAmountAcrossStrategies = + "function getAmountAcrossStrategies(address coin) view returns (uint256)"; async function tvl(_, _b, _cb, { api }) { const logs = await getLogs({ api, target: ALP_TOKEN, - topic: 'SetCoinCap(address,uint256)', - eventAbi: 'event SetCoinCap(address indexed coin, uint256 indexed cap)', + topic: "SetCoinCap(address,uint256)", + eventAbi: "event SetCoinCap(address indexed coin, uint256 indexed cap)", onlyArgs: true, fromBlock: 67635825, - }) - return api.sumTokens({ owners: [ALP_TOKEN], tokens: [nullAddress, ...logs.map(l => l.coin)]}) + }); + + const tokens = logs.map((l) => l.coin); + let tokenBalances = {}; + + for (const token of tokens) { + const { output: balance } = await sdk.api.abi.call({ + target: ALP_TOKEN, + abi: getAmountAcrossStrategies, + chain: "arbitrum", + params: [token], + }); + + tokenBalances[`arbitrum:${token}`] = balance; + } + + const { output: ethBalance } = await sdk.api.eth.getBalance({ + target: ALP_TOKEN, + chain: "arbitrum", + }); + + tokenBalances[`arbitrum:${nullAddress}`] = ethBalance; + + return tokenBalances; } module.exports = { arbitrum: { tvl, - } -} \ No newline at end of file + }, +}; From 55ce512c4bcacfb2c53c57d5cbb009316b2b86fe Mon Sep 17 00:00:00 2001 From: Bob Baxley Date: Thu, 10 Aug 2023 10:52:15 +0200 Subject: [PATCH 0761/1974] add maverick base factory (#7096) --- projects/maverick/index.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/projects/maverick/index.js b/projects/maverick/index.js index c79bd0e4edc..30744e13448 100644 --- a/projects/maverick/index.js +++ b/projects/maverick/index.js @@ -70,4 +70,12 @@ module.exports = maverickTVL({ }, ], }, + base: { + factories: [ + { + address: "0xB2855783a346735e4AAe0c1eb894DEf861Fa9b45", + startBlock: 1489614, + }, + ], + }, }); From 5d922617069389dbf59712ae44fbd797bcd84cd3 Mon Sep 17 00:00:00 2001 From: 0xHofmann <129036776+0xhofmann@users.noreply.github.com> Date: Thu, 10 Aug 2023 17:57:55 +0900 Subject: [PATCH 0762/1974] psy added (#7098) --- projects/psy/index.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 projects/psy/index.js diff --git a/projects/psy/index.js b/projects/psy/index.js new file mode 100644 index 00000000000..d9f345d4c36 --- /dev/null +++ b/projects/psy/index.js @@ -0,0 +1,21 @@ +const { sumTokens2 } = require("../helper/unwrapLPs"); + +const activePool = "0x8726F6Aa2857Ed2E13829f2c9c5355aE190d1E23"; +const tokenAddresses = [ + '0x95ab45875cffdba1e5f451b950bc2e42c0053f39' // sfrxETH +] + + +async function tvl(_, _1, _2, { api }) { + return sumTokens2({ api, tokens: tokenAddresses, owner: activePool}) +} + +module.exports = { + methodology: + "Adds up the total value locked as collateral on the Gravita platform", + start: 1689519600, // Sun Jul 16 2023 15:00:00 GMT+0000 + arbitrum: { + tvl, + }, +}; + From da509411f53a0bc4156c94daafe7fb75980b0909 Mon Sep 17 00:00:00 2001 From: define Date: Thu, 10 Aug 2023 10:44:26 +0100 Subject: [PATCH 0763/1974] update hallmark --- projects/wemix-staking/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/wemix-staking/index.js b/projects/wemix-staking/index.js index c700b253fc7..686584ced59 100644 --- a/projects/wemix-staking/index.js +++ b/projects/wemix-staking/index.js @@ -9,7 +9,7 @@ const stakingContractGRAND = "0xBEd789c6008F788a28fc222C83082D67033Daf7F" module.exports = { hallmarks: [ - [1690070405,"WONDER Staking Live"] + [1687478400,"WONDER Staking Live"] ], wemix: { tvl: staking([stakingContractDIOS, stakingContractGRAND],[wwemix, nullAddress]), From 7ffdce6a13a8397663c89c4a02dac3f460d213fc Mon Sep 17 00:00:00 2001 From: Velocore Dex <128014130+velocore@users.noreply.github.com> Date: Thu, 10 Aug 2023 19:02:27 +0900 Subject: [PATCH 0764/1974] add stable tvl for velocore-v2 (#7097) --- projects/velocore-v2/index.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/projects/velocore-v2/index.js b/projects/velocore-v2/index.js index 9ae34206b90..f311990613d 100644 --- a/projects/velocore-v2/index.js +++ b/projects/velocore-v2/index.js @@ -8,7 +8,12 @@ module.exports = { target: "0xaA18cDb16a4DD88a59f4c2f45b5c91d009549e06", params: ["0xaA18cDb16a4DD88a59f4c2f45b5c91d009549e06", 0, 1000] }); - let tokens = a.map(g => g.poolData.listedTokens).flat().map(i => '0x' + i.slice(2 + 24)) + const b = await api.call({ + abi: "function wombatGauges(address user) returns (tuple(address gauge, tuple(address pool, string poolType, bytes32[] lpTokens, uint256[] mintedLPTokens, bytes32[] listedTokens, uint256[] reserves, bytes poolParams) poolData, bool killed, uint256 totalVotes, uint256 userVotes, uint256 userClaimable, uint256 emissionRate, uint256 userEmissionRate, uint256 stakedValueInHubToken, uint256 userStakedValueInHubToken, uint256 averageInterestRatePerSecond, uint256 userInterestRatePerSecond, bytes32[] stakeableTokens, uint256[] stakedAmounts, uint256[] userStakedAmounts, bytes32[] underlyingTokens, uint256[] stakedUnderlying, uint256[] userUnderlying, tuple(bytes32[] tokens, uint256[] rates, uint256[] userClaimable, uint256[] userRates)[] bribes)[] gaugeDataArray)", + target: "0xaA18cDb16a4DD88a59f4c2f45b5c91d009549e06", + params: ["0xaA18cDb16a4DD88a59f4c2f45b5c91d009549e06"] + }); + let tokens = a.concat(b).map(g => g.poolData.listedTokens).flat().map(i => '0x' + i.slice(2 + 24)) return sumTokens2({ owner: "0x1d0188c4B276A09366D05d6Be06aF61a73bC7535", tokens, blacklistedTokens: [ '0xcc22F6AA610D1b2a0e89EF228079cB3e1831b1D1', From f92f51d2b5d4f78d70238ae10cdda830e64ae857 Mon Sep 17 00:00:00 2001 From: define Date: Thu, 10 Aug 2023 12:04:36 +0100 Subject: [PATCH 0765/1974] add base chain to cap-v4 --- projects/cap-v4/index.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/projects/cap-v4/index.js b/projects/cap-v4/index.js index bd6f77f4738..2b1b97f572a 100644 --- a/projects/cap-v4/index.js +++ b/projects/cap-v4/index.js @@ -5,6 +5,9 @@ const vault = "0xba9736a3fc948f8c489a7e975114eaf2b7f1c3fc"; const fundStore = "0xe00975A0D7def3FAE93832cc72D5ff50432fc857"; const cap = "0x031d35296154279dc1984dcd93e392b1f946737b"; +const fundStoreBase = "0x8508ea3bf4a8ec12cf6a6799421b725300f9a6dd" + + module.exports = { arbitrum: { tvl: sumTokensExport({ owners: [vault, fundStore], tokens: [ @@ -13,4 +16,10 @@ module.exports = { ]}), staking: sumTokensExport({ owners: [vault, fundStore], tokens: [cap]}) }, + base: { + tvl: sumTokensExport({ owners: [fundStoreBase], tokens: [ + nullAddress, + ADDRESSES.base.WETH,//WETH + ]}), + }, } From 2d0607af0c69c5a9aa41eb63752a92b6ce7f74e0 Mon Sep 17 00:00:00 2001 From: Aleksei Lushnikov Date: Thu, 10 Aug 2023 13:31:59 +0100 Subject: [PATCH 0766/1974] symbiosis adds USDC to linea (#7100) --- projects/helper/coreAssets.json | 3 ++- projects/symbiosis-finance/config.js | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index 42ed92af525..9f4f31697f0 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -1343,7 +1343,8 @@ "USDC": "0x09Bc4E0D864854c6aFB6eB9A9cdF58aC190D0dF9" }, "linea": { - "WETH": "0xe5D7C2a44FfDDf6b295A15c148167daaAf5Cf34f" + "WETH": "0xe5D7C2a44FfDDf6b295A15c148167daaAf5Cf34f", + "USDC": "0x176211869cA2b568f2A7D4EE941E073a821EE1ff" }, "base": { "WETH": "0x4200000000000000000000000000000000000006", diff --git a/projects/symbiosis-finance/config.js b/projects/symbiosis-finance/config.js index 9ebd6e8f9a8..8f1935d5059 100644 --- a/projects/symbiosis-finance/config.js +++ b/projects/symbiosis-finance/config.js @@ -179,6 +179,7 @@ module.exports = { name: 'linea', tokens: [ ADDRESSES.linea.WETH, + ADDRESSES.linea.USDC, ], holders: [ '0x292fC50e4eB66C3f6514b9E402dBc25961824D62', // portal v2 From c8328e8b87db0778d80c2fbfe2cda1d7b785b4c5 Mon Sep 17 00:00:00 2001 From: define Date: Thu, 10 Aug 2023 14:29:23 +0100 Subject: [PATCH 0767/1974] add cap treasury base chain --- projects/treasury/cap.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/projects/treasury/cap.js b/projects/treasury/cap.js index b73b640e8ab..d02000cb4c0 100644 --- a/projects/treasury/cap.js +++ b/projects/treasury/cap.js @@ -4,10 +4,12 @@ const { sumTokensExport, nullAddress, } = require('../helper/unwrapLPs') const contracts = { "treasury": "0x283C41b726634fBD6B72aA22741B202DB7E56aaC", "treasuryV2": "0x1058AFe66BB5b79C295CCCE51016586949Bc4e8d", + "treasuryBase": "0x764E7f8798D8193bEd69030AE66eb304968C3F93" }; const cap = "0x031d35296154279dc1984dcd93e392b1f946737b"; const usdc = ADDRESSES.arbitrum.USDC; + module.exports = { arbitrum: { tvl: sumTokensExport({ @@ -17,5 +19,12 @@ module.exports = { [nullAddress, contracts.treasuryV2], ] }), + }, + base: { + tvl: sumTokensExport({ + tokensAndOwners: [ + [nullAddress, contracts.treasuryBase], + ] + }), } }; \ No newline at end of file From 8b72b6a5130c82ebe32db36520b33aee0ff2e432 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 10 Aug 2023 16:42:05 +0200 Subject: [PATCH 0768/1974] refactor smart-credit --- projects/fantom.js | 62 +-------------- projects/helper/cache/getLogs.js | 5 ++ projects/smartcredit.js | 130 +++++++++++++++++++++---------- projects/yearn/index.js | 1 - 4 files changed, 96 insertions(+), 102 deletions(-) diff --git a/projects/fantom.js b/projects/fantom.js index 6e9fa43e0e2..f545522bfb6 100644 --- a/projects/fantom.js +++ b/projects/fantom.js @@ -1,65 +1,5 @@ -const ADDRESSES = require('./helper/coreAssets.json') -const { get } = require('./helper/http') -const { GraphQLClient, } = require("graphql-request"); -const BigNumber = require("bignumber.js"); - async function fetch() { - const endpoint = "https://xapi3.fantom.network/api"; - const graphQLClient = new GraphQLClient(endpoint); - - const query = ` - query getToken($token: Address!) { - erc20Token(token: $token) { - address - name - symbol - decimals - totalSupply - totalDeposit - totalDebt - } - } - `; - - var tokens = [ - { - address: ADDRESSES.fantom.WFTM, - symbol: "WFTM", - }, - { - address: "0x69c744d3444202d35a2783929a0f930f2fbb05ad", - symbol: "SFTM", - }, - { - address: "0xad84341756bf337f5a0164515b1f6f993d194e1f", - symbol: "FUSD", - }, - ]; - - let price_feed = await get( - "https://api.coingecko.com/api/v3/simple/price?ids=fantom&vs_currencies=usd&include_market_cap=true&include_24hr_vol=true&include_24hr_change=true" - ) - - const wData = await graphQLClient.request(query, { - token: tokens[0].address, - }); - const sData = await graphQLClient.request(query, { - token: tokens[1].address, - }); - const fData = await graphQLClient.request(query, { - token: tokens[2].address, - }); - - let tvl = new BigNumber(wData.erc20Token.totalDeposit) - .plus(new BigNumber(sData.erc20Token.totalDeposit)) - .div(10 ** 18) - .toNumber(); - const result = ( - tvl * price_feed.fantom.usd + - new BigNumber(fData.erc20Token.totalSupply).div(10 ** 18).toNumber() - ).toFixed(2); - - return result; + return 0; } module.exports = { diff --git a/projects/helper/cache/getLogs.js b/projects/helper/cache/getLogs.js index 59451142503..8f28ab8a740 100644 --- a/projects/helper/cache/getLogs.js +++ b/projects/helper/cache/getLogs.js @@ -23,6 +23,11 @@ async function getLogs({ target, iface = new ethers.utils.Interface([eventAbi]) if (typeof eventAbi === 'object') sdk.log(iface.format(ethers.utils.FormatTypes.full)) + if (!topics?.length) { + const fragment = iface.fragments[0] + topics = undefined + topic = `${fragment.name}(${fragment.inputs.map(i => i.type).join(',')})` + } } target = target.toLowerCase() diff --git a/projects/smartcredit.js b/projects/smartcredit.js index 1ce29666deb..7c4654b1118 100644 --- a/projects/smartcredit.js +++ b/projects/smartcredit.js @@ -1,55 +1,47 @@ const ADDRESSES = require('./helper/coreAssets.json') -const { GraphQLClient, } = require('graphql-request') -const sdk = require('@defillama/sdk') -const { default: BigNumber } = require('bignumber.js') +const { cachedGraphQuery } = require('./helper/cache') +const { getLogs } = require('./helper/cache/getLogs') const endPoint = 'https://d2c7awq32ho327.cloudfront.net/graphql' -const queryBody = '{\n collateralsStatistics {\n lockedCollateralAmount\n lockedCollateralValueInUSD\n unlockedCollateralAmount\n unlockedCollateralValueInUSD\n minCollateralRatio\n currency {\n symbol\n exchangeRate\n ethAddress\n decimalPlaces\n }\n }\n underlyingsStatistics {\n totalBorrowedAmount\n totalBorrowedValueInUSD\n totalLendedAmount\n totalLendedValueInUSD\n maxAPY\n minInterestRate\n currency {\n symbol\n exchangeRate\n ethAddress\n decimalPlaces\n }\n }\n}' const SMART_CREDIT = '0x72e9D9038cE484EE986FEa183f8d8Df93f9aDA13'.toLowerCase() - -var graphQLClient = new GraphQLClient(endPoint) - -async function getStats() { - return await graphQLClient.request(queryBody) +const factory = '0x31ba589072278D82207212702De9A1C2B9D42c28' +const fromBlock = 14575305 +const factoryAbi = { + "FixedIncomeFundCreationComplete": "event FixedIncomeFundCreationComplete(address indexed fixedIncomeFund, bytes32 indexed salt)", + "LoanContractCreated": "event LoanContractCreated(address indexed creditLine, address indexed borrower, bytes32 salt, bytes32 _type)", + "createCreditLine": "function createCreditLine(bytes32 _type, bytes32 _salt) returns (address _creditLine)", + "createNFTLoan": "function createNFTLoan(bytes32 _type, bytes32 _salt, tuple(address assetAddress, uint256 loanAmount, uint256 loanTerm, uint256 interestRate, address collateralAddress, uint256 collateralId) _loanRequest) returns (address _loanContract)", + "createFixedIncomeFund": "function createFixedIncomeFund(bytes32 _type, bytes32 _salt, uint256[4] _ratios) returns (address _fixedIncomeFund)", + "investFixedIncomeFundToCompound": "function investFixedIncomeFundToCompound(address[] _fixedIncomeFunds)" } -function replaceEth(addr) { - if (addr.toLowerCase() === '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee') - return ADDRESSES.null - return addr +const loanAbi = { + "getLoanData": "function getLoanData(bytes32 _loanId) view returns (bytes32 loanId, uint256 currentCollateralAmount, uint256 loanEnded, uint256 outstandingAmount)", } -async function tvl() { - const balances = {} - const stats = await getStats() - stats.underlyingsStatistics.forEach(item => { - if (item.currency.ethAddress.toLowerCase() === SMART_CREDIT) return - sdk.util.sumSingleBalance(balances, replaceEth(item.currency.ethAddress), BigNumber(item.totalLendedAmount).minus(item.totalBorrowedAmount).toFixed(0)) - }) - stats.collateralsStatistics.forEach(item => { - sdk.util.sumSingleBalance(balances, replaceEth(item.currency.ethAddress), BigNumber(item.lockedCollateralAmount).plus(item.unlockedCollateralAmount).toFixed(0)) - }) - return balances +const fixedIncomeAbi = { + "getCurrencyAddress": "address:getCurrencyAddress", + "getCompoundAddress": "address:getCompoundAddress", + "fixedIncomeFundBalance": "uint256:fixedIncomeFundBalance" } -async function staking() { - const balances = {} - const stats = await getStats() - stats.underlyingsStatistics.forEach(item => { - if (item.currency.ethAddress.toLowerCase() !== SMART_CREDIT) return - sdk.util.sumSingleBalance(balances, replaceEth(item.currency.ethAddress), BigNumber(item.totalLendedAmount).minus(item.totalBorrowedAmount).toFixed(0)) - }) - return balances -} +const transformNull = i => i.toLowerCase() === '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee' ? ADDRESSES.null : i -async function borrowed() { - const balances = {} - const stats = await getStats() - stats.underlyingsStatistics.forEach(item => { - sdk.util.sumSingleBalance(balances, replaceEth(item.currency.ethAddress), BigNumber(item.totalBorrowedAmount).toFixed(0)) - }) - return balances +async function staking(_, _b, _cb, { api }) { + let { loanRequests } = await cachedGraphQuery('smart-credit', endPoint, `{ + loanRequests { + id, + contractAddress, + loanStatus, + liquidationStatus, + underlying { ethAddress }, + collateral { ethAddress } + } + }`) + loanRequests = loanRequests.filter(i => i) + const ownerTokens = loanRequests.map(i => [[i.underlying.ethAddress, i.collateral.ethAddress].map(transformNull), i.contractAddress]) + return api.sumTokens({ ownerTokens, whitelistedTokens: [SMART_CREDIT] }) } module.exports = { @@ -59,4 +51,62 @@ module.exports = { staking, borrowed, } +} + +async function tvl(_, _b, _cb, { api, }) { + await fixedIncomeTvl(api) + await loanTvl(api) + return api.getBalances() +} + + +async function fixedIncomeTvl(api) { + const logs = await getLogs({ + api, + target: factory, + eventAbi: factoryAbi.FixedIncomeFundCreationComplete, + onlyArgs: true, + fromBlock, + extraKey: 'fixedIncomeFund', + }) + const pools = logs.map(l => l.fixedIncomeFund) + const tokens = (await api.multiCall({ abi: fixedIncomeAbi.getCurrencyAddress, calls: pools })).map(transformNull) + + await api.sumTokens({ tokensAndOwners2: [tokens, pools], blacklistedTokens: [SMART_CREDIT] }) +} + +async function loanTvl(api) { + let { loanRequests } = await cachedGraphQuery('smart-credit', endPoint, `{ + loanRequests { + id, + contractAddress, + loanStatus, + liquidationStatus, + underlying { ethAddress }, + collateral { ethAddress } + } + }`) + loanRequests = loanRequests.filter(i => i) + const ownerTokens = loanRequests.map(i => [[i.underlying.ethAddress, i.collateral.ethAddress].map(transformNull), i.contractAddress]) + return api.sumTokens({ ownerTokens, blacklistedTokens: [SMART_CREDIT] }) +} + +async function borrowed(_, _b, _cb, { api, }) { + let { loanRequests } = await cachedGraphQuery('smart-credit', endPoint, `{ + loanRequests { + id, + contractAddress, + loanStatus, + liquidationStatus, + underlying { ethAddress }, + collateral { ethAddress } + } + }`) + loanRequests = loanRequests.filter(i => i) + const calls = loanRequests.map(i => ({ target: i.contractAddress, params: [i.id] })) + const loanInfos = await api.multiCall({ abi: loanAbi.getLoanData, calls}) + loanInfos.forEach((i, idx) => { + if (i.outstandingAmount === '0') return + api.add(loanRequests[idx].underlying.ethAddress, i.outstandingAmount) + }) } \ No newline at end of file diff --git a/projects/yearn/index.js b/projects/yearn/index.js index c7830be7d32..9d0f130bb01 100644 --- a/projects/yearn/index.js +++ b/projects/yearn/index.js @@ -1,5 +1,4 @@ const { sumTokens2 } = require('../helper/unwrapLPs') -const axios = require('axios') const { getConfig } = require('../helper/cache') const { sumERC4626Vaults } = require('../helper/erc4626') From b6815654af45ba7dea89a0993c22f3b768ec3b1a Mon Sep 17 00:00:00 2001 From: Krunal Amin Date: Thu, 10 Aug 2023 13:43:25 -0500 Subject: [PATCH 0769/1974] add base (#7108) --- projects/unidex/index.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/projects/unidex/index.js b/projects/unidex/index.js index f290b1702d9..1df2fa0db35 100644 --- a/projects/unidex/index.js +++ b/projects/unidex/index.js @@ -64,6 +64,16 @@ async function BobaTvl(_time, _ethBlock, { boba: block }) { return sumTokens2({ chain, block, tokens, owners, }) } +async function BaseTvl(_time, _ethBlock, { base: block }) { + const contracts = { + "ethpool": "0x9Ba3db52BC401F4EF8ba23e56268C3AdE0290837", + }; + const chain = 'base' + const tokens = [nullAddress] + const owners = Object.values(contracts) + return sumTokens2({ chain, block, tokens, owners, }) +} + async function MetisTvl(_time, _ethBlock, { metis: block }) { const contracts = { "metisPool": "0x9Ba3db52BC401F4EF8ba23e56268C3AdE0290837", @@ -117,6 +127,9 @@ module.exports = { arbitrum: { tvl: ArbitrumTvl }, + base: { + tvl: BaseTvl + }, boba: { tvl: BobaTvl }, From 90604332e8a9f2d1df6c69001ee731947d0c477a Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 11 Aug 2023 00:20:48 +0530 Subject: [PATCH 0770/1974] Bounce (#7109) * Add bounce ethereum tvl * Add bounce staking * code refactor --------- Co-authored-by: yuhuakukude --- projects/bounce/index.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 projects/bounce/index.js diff --git a/projects/bounce/index.js b/projects/bounce/index.js new file mode 100644 index 00000000000..8e0fb8ff817 --- /dev/null +++ b/projects/bounce/index.js @@ -0,0 +1,17 @@ + +const { sumTokensExport } = require('../helper/unwrapLPs') + +const AUCTION = '0xA9B1Eb5908CfC3cdf91F9B8B3a74108598009096' +const AUCTION_ETH_SLP = '0x0f8086d08a69ebd8e3a130a87a3b6a260723976f' + +const STAKING_ADDRESS = '0x98945BC69A554F8b129b09aC8AfDc2cc2431c48E' +const STAKING_LP_ADDRESS = '0xbe5a88b573290e548759520a083a61051b258451' +const MULTI_SIG_ADDRESS = '0xc9297466C6c7acc799Fb869806C53398b8B10680' + +module.exports = { + ethereum: { + tvl: sumTokensExport({}), + pool2: sumTokensExport({ owner: STAKING_LP_ADDRESS, tokens: [AUCTION_ETH_SLP] }), + staking: sumTokensExport({ owner: STAKING_ADDRESS, tokens: [AUCTION] }), + }, +} From ba80f71b7347e0f82a6723656342958fcd4a1d84 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 11 Aug 2023 00:27:01 +0530 Subject: [PATCH 0771/1974] minor refactor (#7110) * gravita: add Arbitrum deployment * minor refactor --------- Co-authored-by: lutr0 <> --- projects/gravita-protocol/index.js | 29 ++++++++++++---------------- projects/spiritswap-lending/index.js | 2 -- 2 files changed, 12 insertions(+), 19 deletions(-) diff --git a/projects/gravita-protocol/index.js b/projects/gravita-protocol/index.js index 64be6b783b8..41d39f04615 100644 --- a/projects/gravita-protocol/index.js +++ b/projects/gravita-protocol/index.js @@ -1,28 +1,23 @@ const { sumTokens2 } = require("../helper/unwrapLPs"); -const ADMIN_CONTRACT_ADDRESS = "0xf7Cc67326F9A1D057c1e4b110eF6c680B13a1f53"; - -/** - * Returns an array of addresses containing the collateral tokens accepted by the platform. - */ -async function _getCollateralAddresses(api) { - return api.call({ - abi: "function getValidCollateral() external view returns (address[])", - target: ADMIN_CONTRACT_ADDRESS, - }); -} +const ADMIN_ADDRESSES = { + ethereum: "0xf7Cc67326F9A1D057c1e4b110eF6c680B13a1f53", + arbitrum: "0x4928c8F8c20A1E3C295DddBe05095A9aBBdB3d14", +}; async function tvl(_, _1, _2, { api }) { - const collAddresses = await _getCollateralAddresses(api); - const pool = await api.call({ abi: 'address:activePool', target: ADMIN_CONTRACT_ADDRESS}) - return sumTokens2({ api, tokens: collAddresses, owner: pool}) + const chainAddress = ADMIN_ADDRESSES[api.chain]; + const collAddresses = await api.call({ abi: "address[]:getValidCollateral", target: chainAddress, }); + const pool = await api.call({ abi: 'address:activePool', target: chainAddress }) + return sumTokens2({ api, tokens: collAddresses, owner: pool }) } module.exports = { methodology: "Adds up the total value locked as collateral on the Gravita platform", start: 1684256400, // Tuesday, May 15, 2023 17:00 GMT - ethereum: { - tvl, - }, }; + +Object.keys(ADMIN_ADDRESSES).forEach(chain => { + module.exports[chain] = { tvl } +}) diff --git a/projects/spiritswap-lending/index.js b/projects/spiritswap-lending/index.js index 07d3007feb2..0a5dcc4d3d5 100644 --- a/projects/spiritswap-lending/index.js +++ b/projects/spiritswap-lending/index.js @@ -10,8 +10,6 @@ const unitroller_fantom = "0x892701d128d63c9856A9Eb5d967982F78FD3F2AE" const olalending = usdCompoundExports(unitroller_fantom, "fantom", "0xed8F2C964b47D4d607a429D4eeA972B186E6f111", abis) module.exports = { - timetravel: true, - doublecounted: false, fantom:{ tvl: olalending.tvl, borrowed: olalending.borrowed From 85eab96e2a38b3f023f098cf81cc9ce1df328447 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 10 Aug 2023 21:26:52 +0200 Subject: [PATCH 0772/1974] track sweep & flip --- projects/sweep-n-flip/index.js | 37 ++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 projects/sweep-n-flip/index.js diff --git a/projects/sweep-n-flip/index.js b/projects/sweep-n-flip/index.js new file mode 100644 index 00000000000..3bd713c6d0f --- /dev/null +++ b/projects/sweep-n-flip/index.js @@ -0,0 +1,37 @@ + +const { getLogs } = require('../helper/cache/getLogs') +const { transformDexBalances } = require('../helper/portedTokens') + +const factory = '0x16eD649675e6Ed9F1480091123409B4b8D228dC1' +module.exports = { + misrepresentedTokens: true, + methodology: 'TVL counts the liquidity of the pools on each chain.', +} + +const config = { + ethereum: { fromBlock: 12965000, }, + polygon: { fromBlock: 12965000, }, + arbitrum: { fromBlock: 101851523, }, +} + +Object.keys(config).forEach(chain => { + const { fromBlock } = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + let logs = await getLogs({ + api, + target: factory, + eventAbi: "event PairCreated(address indexed token0, address indexed token1, address pair, uint256)", + onlyArgs: true, + fromBlock, + }) + let pairs = logs.map(log => log.pair) + const names = await api.multiCall({ abi: 'string:name', calls: pairs }) + logs = logs.filter((pair, i) => names[i] === 'SweepnFlip LPs') + pairs = logs.map(log => log.pair) + const bals0 = await api.multiCall({ abi: 'erc20:balanceOf', calls: pairs.map((pair, i) => ({ target: logs[i].token0, params: pair })) }) + const bals1 = await api.multiCall({ abi: 'erc20:balanceOf', calls: pairs.map((pair, i) => ({ target: logs[i].token1, params: pair })) }) + return transformDexBalances({ chain, data: logs.map((l, i) => ({ token0Bal: bals0[i], token1Bal: bals1[i], token0: l.token0, token1: l.token1 })) }) + } + } +}) \ No newline at end of file From 3406112080662baea63e38f3be45dafd48702a58 Mon Sep 17 00:00:00 2001 From: fextr <34183870+fextr@users.noreply.github.com> Date: Thu, 10 Aug 2023 15:25:20 -0700 Subject: [PATCH 0773/1974] fetch total tvl & change methodology description for zunami (#7086) * fetch total zunami tvl * calculate total tvl for zunami * code refactor --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/zunami/index.js | 33 +++++++++------------------------ 1 file changed, 9 insertions(+), 24 deletions(-) diff --git a/projects/zunami/index.js b/projects/zunami/index.js index 01315f8b56b..bf9139c3d41 100644 --- a/projects/zunami/index.js +++ b/projects/zunami/index.js @@ -1,31 +1,16 @@ const ADDRESSES = require('../helper/coreAssets.json') -const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); const zunamiContract = "0x2ffCC661011beC72e1A9524E12060983E74D14ce"; const zunamiApsContract = "0xCaB49182aAdCd843b037bBF885AD56A3162698Bd"; -const zunamiHoldingsDecimals = 18; +const zethOmnipoolContract = "0x9dE83985047ab3582668320A784F6b9736c6EEa7"; +const zethApsContract = "0x8fc72dcfbf39FE686c96f47C697663EE08C78380" -const usdt = ADDRESSES.ethereum.USDT; -const usdtDecimals = 6; - -async function ethTvl(timestamp, block) { - const totalHoldingsOmnipool = (await sdk.api.abi.call({ - block, - abi: abi.totalHoldings, - target: zunamiContract, - })).output / 10 ** (zunamiHoldingsDecimals - usdtDecimals); - const totalHoldingsAps = (await sdk.api.abi.call({ - block, - abi: abi.totalHoldings, - target: zunamiApsContract, - })).output / 10 ** (zunamiHoldingsDecimals - usdtDecimals); - - const totalHoldings = totalHoldingsOmnipool + totalHoldingsAps; - - return { - [usdt]: totalHoldings, - }; +async function ethTvl(timestamp, block, _, { api }) { + api.add(ADDRESSES.ethereum.DAI, await api.call({ abi: abi.totalHoldings, target: zunamiContract, })) + api.add(ADDRESSES.ethereum.DAI, await api.call({ abi: abi.totalHoldings, target: zunamiApsContract, })) + api.add(ADDRESSES.null, await api.call({ abi: abi.totalHoldings, target: zethOmnipoolContract, })) + api.add(ADDRESSES.null, await api.call({ abi: abi.totalHoldings, target: zethApsContract, })) } module.exports = { @@ -33,5 +18,5 @@ module.exports = { ethereum: { tvl: ethTvl, }, - methodology: "Counts tvl deposited throuth Strategies Contract", -}; + methodology: "Total value of digital assets that are locked in Zunami Omnipools", +}; \ No newline at end of file From abd9f05f0b7899e5ec42e2e084b6da16131e0e82 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Thu, 10 Aug 2023 23:29:58 +0100 Subject: [PATCH 0774/1974] add winding down hallmark --- projects/oin-finance/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/oin-finance/index.js b/projects/oin-finance/index.js index 369dccdcdcd..11ece371590 100644 --- a/projects/oin-finance/index.js +++ b/projects/oin-finance/index.js @@ -86,6 +86,9 @@ function getStaking(chain, configs) { } module.exports = { + hallmarks: [ + [1675036800, "Winding down announced"] + ], timetravel: false, ethereum: { tvl: getStaking('ethereum', [ From 86baee6f42371ed9c5c84efa43503521c90d7fa0 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 11 Aug 2023 04:03:27 +0530 Subject: [PATCH 0775/1974] Locus-fi (#7112) * init * added idea to gitignore * added idea to gitignore * fixed lido pool address * code refactor --------- Co-authored-by: Ivan Borisov <2622610@gmail.com> --- projects/locus/index.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 projects/locus/index.js diff --git a/projects/locus/index.js b/projects/locus/index.js new file mode 100644 index 00000000000..c5dc06ff5c7 --- /dev/null +++ b/projects/locus/index.js @@ -0,0 +1,26 @@ +const { sumERC4626VaultsExport } = require('../helper/erc4626') + +module.exports = { + doublecounted: true, +} + +const config = { + ethereum: { + lvTokens: { + lvETH: "0x3edbE670D03C4A71367dedA78E73EA4f8d68F2E4", + lvDCI: "0xf62A24EbE766d0dA04C9e2aeeCd5E86Fac049B7B" + } + }, + arbitrum: { + lvTokens: { + lvAYI: "0xBE55f53aD3B48B3ca785299f763d39e8a12B1f98" + }, + } +} + +Object.keys(config).forEach(chain => { + const { lvTokens } = config[chain] + module.exports[chain] = { + tvl: sumERC4626VaultsExport({ vaults: Object.values(lvTokens), abi: { asset: 'address:token' } }) + } +}) \ No newline at end of file From d1b1c199ffeab0624c42b94cb82893d84522ea4a Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 11 Aug 2023 04:18:55 +0530 Subject: [PATCH 0776/1974] Glitter (#7113) * Testing Update * Updated all vaults * code refactor --------- Co-authored-by: Andrew Carl --- projects/glitter-finance/index.js | 42 ++++++++++++++++++++----------- projects/helper/solana.js | 3 ++- projects/raydium.js | 2 +- 3 files changed, 30 insertions(+), 17 deletions(-) diff --git a/projects/glitter-finance/index.js b/projects/glitter-finance/index.js index 10fbbb5e50a..e72c3ee1ec4 100644 --- a/projects/glitter-finance/index.js +++ b/projects/glitter-finance/index.js @@ -1,17 +1,29 @@ -const ADDRESSES = require('../helper/coreAssets.json') -//Solana Helpers -const { sumTokensExport, } = require("../helper/sumTokens") -//addresses -const SOLANA_VAULT = "7xCU4nvqu3Nz3BBQckKzibp3kBav4xbkuqQ3WM9CBHdJ"; -const ALGO_VAULT = "R7VCOR74LCUIFH5WKCCMZOS7ADLSDBQJ42YURFPDT3VGYTVNBNG7AIYTCQ"; +const { treasuryExports, } = require("../helper/treasury") + +const ETHEREUM_VAULT = "0xa234acbd98a917f6dda69298e0e7290380006cf1"; +const ARBITRUM_VAULT = "0x446c264ed8888dad27f5452094d2ceadb1e038ea"; +const ZKEVM_VAULT = "0x175355fa6fa82f1bb6868cd885da13069c4e861c"; +const POLYGON_VAULT = "0x72decebe0597740551396d3c9e7546cfc97971e9"; +const AVALANCHE_VAULT = "0xa234acbd98a917f6dda69298e0e7290380006cf1"; +const BINANCE_VAULT = "0x446c264ed8888dad27f5452094d2ceadb1e038ea"; +const OPTIMISM_VAULT = "0x446c264ed8888dad27f5452094d2ceadb1e038ea"; module.exports = { - hallmarks: [ - [1661337600, "SPL Vault Migration (V2 Expansion)"], - ], - timetravel: false, - methodology: - "TVL counts tokens and native assets locked in Glitter-Finance bridge vaults. CoinGecko is used to find the price of tokens in USD.", - solana: { tvl: sumTokensExport({ solOwners: [SOLANA_VAULT], }) }, - algorand: { tvl: sumTokensExport({ owners: [ALGO_VAULT] }) }, -}; \ No newline at end of file + hallmarks: [ + [1661337600, "SPL Vault Migration (V2 Expansion)"], + ], + timetravel: false, + methodology: + "TVL counts tokens and native assets locked in Glitter-Finance bridge vaults. CoinGecko is used to find the price of tokens in USD.", + ...treasuryExports({ + solana: { + owners: ['7xCU4nvqu3Nz3BBQckKzibp3kBav4xbkuqQ3WM9CBHdJ'], + }, + algorand: { + owner: 'R7VCOR74LCUIFH5WKCCMZOS7ADLSDBQJ42YURFPDT3VGYTVNBNG7AIYTCQ', + }, + ethereum: { + tokensAndOwners: [['0x68f0c0003f1826c4e9646df7e1ecf3707fee0581', ETHEREUM_VAULT]], + }, + }), +}; diff --git a/projects/helper/solana.js b/projects/helper/solana.js index 45d660eec40..624dbc43b97 100644 --- a/projects/helper/solana.js +++ b/projects/helper/solana.js @@ -347,13 +347,14 @@ async function sumTokens2({ solOwners = [], blacklistedTokens = [], allowError = false, + getAllTokenAccounts = false, }) { blacklistedTokens.push(...blacklistedTokens_default) if (!tokensAndOwners.length) { if (owner) tokensAndOwners = tokens.map(t => [t, owner]) if (owners.length) tokensAndOwners = tokens.map(t => owners.map(o => [t, o])).flat() } - if (!tokensAndOwners.length && !tokens.length && (owner || owners.length > 0)) { + if (!tokensAndOwners.length && !tokens.length && (owner || owners.length > 0) && getAllTokenAccounts) { for (const _owner of [...owners, owner]) { const data = await getOwnerAllAccount(_owner) for (const item of data) { diff --git a/projects/raydium.js b/projects/raydium.js index 74391c855aa..cad0631e7c3 100644 --- a/projects/raydium.js +++ b/projects/raydium.js @@ -33,7 +33,7 @@ async function tvlCLMM() { async function ammV4Tvl() { const owner = '5Q544fKrFoe6tsEbD7S8EmxGTJYAKtTVhAW5Q5pge4j1' - return sumTokens2({ owner }) + return sumTokens2({ owner, getAllTokenAccounts: true }) } async function ammV2V3() { From c01194900b492808bfecdf5e44baceacea1e8b47 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 11 Aug 2023 01:51:48 +0200 Subject: [PATCH 0777/1974] add hallmark --- projects/kperp-exchange/index.js | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/projects/kperp-exchange/index.js b/projects/kperp-exchange/index.js index 208b98c27ea..676c610d547 100644 --- a/projects/kperp-exchange/index.js +++ b/projects/kperp-exchange/index.js @@ -1,16 +1,8 @@ -const {staking} = require('../helper/staking') -const { gmxExports } = require('../helper/gmx') -const { unknownTombs, sumTokensExport } = require("../helper/unknownTokens") - -// Kava -const kavaVault = '0xA64227152CBF5f0F9d48E8a54a28D0DDBd8D5e38'; -const kavaStaking = '0x0ccf044c5fc03b2527F1f2BBaa588bCb27158522'; // Staked KPE, sKPE -const kavaKPE = '0x3817e3f374bABcB0CFa5A39EB59d97aDc6812098'; -const kavaKpeUsdcPool = '0x9321922ae0e4Ad4642707cAc5bBaECF9C26f2B18' - module.exports = { kava: { - staking: sumTokensExport({ owner: kavaStaking, tokens: [kavaKPE],lps: [kavaKpeUsdcPool], useDefaultCoreAssets: true, }), - tvl: gmxExports({ vault: kavaVault, }) + tvl: () => ({}), }, + hallmarks: [ + [Math.floor(new Date('2023-02-23')/1e3), 'Project decided to wind down.'], + ], }; From 6bfcb11837c4cb475308e4bb013ba7a22455c8e7 Mon Sep 17 00:00:00 2001 From: huyhtfiber <105899473+huyhtfiber@users.noreply.github.com> Date: Fri, 11 Aug 2023 16:03:57 +0700 Subject: [PATCH 0778/1974] add iceswap on basechain (#7118) Co-authored-by: Huy Hoang --- projects/iceswap/index.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 projects/iceswap/index.js diff --git a/projects/iceswap/index.js b/projects/iceswap/index.js new file mode 100644 index 00000000000..eb2acf7e1db --- /dev/null +++ b/projects/iceswap/index.js @@ -0,0 +1,12 @@ +const { getUniTVL } = require("../helper/unknownTokens"); +const FACTORY = "0x79b8F15a3bEEcd5014B748499Ec89692665ea368"; + +const dexTVL = getUniTVL({ factory: FACTORY, useDefaultCoreAssets: true, fetchBalances: true, }) + +module.exports = { + misrepresentedTokens: true, + methodology: `Uses factory(${FACTORY}) address and whitelisted tokens address to find and price Liquidity Pool pairs. We also have our native token $IKE staking.`, + base: { + tvl: dexTVL, + }, +} \ No newline at end of file From b330cb222aebff5a690c661ed0f96a54d5cdec65 Mon Sep 17 00:00:00 2001 From: Long Nguyen Date: Fri, 11 Aug 2023 16:09:10 +0700 Subject: [PATCH 0779/1974] feat(minswap): query by script hash instead of address (#7115) Signed-off-by: Nguyen Le Vu Long --- projects/minswap/index.js | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/projects/minswap/index.js b/projects/minswap/index.js index 2d53b7b01ad..7861b2340b5 100644 --- a/projects/minswap/index.js +++ b/projects/minswap/index.js @@ -1,20 +1,11 @@ const { getAdaInAddress } = require("../helper/chain/cardano"); -const { getConfig } = require('../helper/cache') + +const POOL_SCRIPT_HASH = "script1uychk9f04tqngfhx4qlqdlug5ntzen3uzc62kzj7cyesjk0d9me" +const ORDER_SCRIPT_HASH = "script15ew2tzjwn364l2pszu7j5h9w63v2crrnl97m074w9elrkxhah0e" async function tvl() { - const res = await getConfig("minswap", "https://api-mainnet-prod.minswap.org/dex-addresses") - const poolAddresses = res.pools - const orderAddresses = res.orders - let liquidityPoolLocked = 0 - for (const addr of poolAddresses) { - const adaLocked = await getAdaInAddress(addr) - liquidityPoolLocked += adaLocked - } - let batchOrderLocked = 0 - for (const addr of orderAddresses) { - const adaLocked = await getAdaInAddress(addr) - batchOrderLocked += adaLocked - } + const liquidityPoolLocked = await getAdaInAddress(POOL_SCRIPT_HASH) + const batchOrderLocked = await getAdaInAddress(ORDER_SCRIPT_HASH) return { cardano: (liquidityPoolLocked * 2) + batchOrderLocked, }; From a9767ef9f89eb4c0d2ec48d2a653bc5a2a21f885 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 11 Aug 2023 14:39:44 +0530 Subject: [PATCH 0780/1974] jewelswap: add farm? (#7114) --- projects/jewelswap-lev-farming/index.js | 35 ++++++++++++++----------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/projects/jewelswap-lev-farming/index.js b/projects/jewelswap-lev-farming/index.js index 48c4d1acf62..c150672c44c 100644 --- a/projects/jewelswap-lev-farming/index.js +++ b/projects/jewelswap-lev-farming/index.js @@ -8,6 +8,7 @@ const JEWEL_ONEDEX_FARM_SC_ADDRESS = "erd1qqqqqqqqqqqqqpgqm7exdla3rzshywy99pvlxz const LENDING_POOL_FARMS = "erd1qqqqqqqqqqqqqpgq96n4gxvmw8nxgxud8nv8qmms5namspc5vmusg930sh"; const FARMS = "erd1qqqqqqqqqqqqqpgqlnxy2hmvs8qxr6ezq2wmggn7ev62cjp6vmusvdral4"; +const FARMS2 = "erd1qqqqqqqqqqqqqpgqx6833qjac6uqztgsa8jhlztexucke0hrdfys6wd7qt"; const jewelOnedexFarmAbiRegistry = AbiRegistry.create(JEWEL_ONEDEX_FARM_SC_ABI); const jewelOnedexFarmSmartContract = new SmartContract({ @@ -39,22 +40,26 @@ const proxyProvider = new ProxyNetworkProvider(networkConfig.gatewayUrl, { async function tvl() { const { api } = arguments[3] - const nfts = await getNFTs(FARMS) - nfts.forEach(nft => { - let lpToken - switch (nft.collection) { - case "FARM-e5ffde": lpToken = "ALP-2d0cf8"; break; - case "FARM-9ed1f9": lpToken = "ALP-5f9191"; break; - case "FARM-ccefc2": lpToken = "ALP-0fe50a"; break; - case "FARM-795466": lpToken = "ALP-afc922"; break; - case "FARM-b637f0": lpToken = "ALP-713ae8"; break; - case "FARM-83c131": lpToken = "ALP-f7dee1"; break; - default: lpToken = null; - } - if (lpToken) api.add(lpToken, nft.balance) - }) + addNfts(await getNFTs(FARMS)) + addNfts(await getNFTs(FARMS2)) await oneDexFarm(api) - return sumTokens({ owners: [LENDING_POOL_FARMS], balances: api.getBalances() }) + return sumTokens({ owners: [LENDING_POOL_FARMS, ], balances: api.getBalances() }) + + function addNfts(nfts) { + nfts.forEach(nft => { + let lpToken + switch (nft.collection) { + case "FARM-e5ffde": lpToken = "ALP-2d0cf8"; break; + case "FARM-9ed1f9": lpToken = "ALP-5f9191"; break; + case "FARM-ccefc2": lpToken = "ALP-0fe50a"; break; + case "FARM-795466": lpToken = "ALP-afc922"; break; + case "FARM-b637f0": lpToken = "ALP-713ae8"; break; + case "FARM-83c131": lpToken = "ALP-f7dee1"; break; + default: lpToken = null; + } + if (lpToken) api.add(lpToken, nft.balance) + }) + } } async function oneDexFarm(api) { From 7c2ce4623d1ccdd3b87c8b08eb6e442418be9cc8 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 11 Aug 2023 12:23:54 +0200 Subject: [PATCH 0781/1974] code refactor --- projects/adamantfinance/index.js | 3 -- projects/astriddao/index.js | 3 -- projects/avault/index.js | 4 +- projects/blindex/index.js | 3 -- projects/celerbridge/index.js | 3 -- projects/eklipse/index.js | 4 +- projects/euphoria/index.js | 3 -- projects/helper/dexpad.js | 5 +-- projects/helper/masterchef.js | 6 +-- projects/helper/ohm.js | 4 +- projects/jioswap/index.js | 5 --- projects/kavacave/index.js | 5 --- projects/kleva/index.js | 4 +- projects/kogefarm/index.js | 5 --- projects/kronos/index.js | 4 +- projects/multichainMiner.js | 5 +-- projects/multiplierfinance/index.js | 7 +-- projects/ohmw/index.js | 12 ++---- projects/onedaofinance/index.js | 28 +++--------- projects/orcus/index.js | 5 --- projects/parrotegg/index.js | 4 +- projects/polkaex/index.js | 2 - projects/quartzdefi/index.js | 4 -- projects/ramp/index.js | 4 +- projects/reverse/index.js | 19 ++------ projects/rubyfinance/index.js | 3 -- projects/single/index.js | 7 --- projects/stablekoi/index.js | 7 +-- projects/starswap/index.js | 3 -- projects/synapse/index.js | 3 +- projects/tectonic/index.js | 4 +- projects/tranquil/index.js | 3 +- projects/treasury/wagmidao.js | 7 --- projects/wagmidao/index.js | 67 ----------------------------- projects/yieldwolf/index.js | 3 -- 35 files changed, 28 insertions(+), 230 deletions(-) diff --git a/projects/adamantfinance/index.js b/projects/adamantfinance/index.js index 20226bf6248..15dc1d2d71c 100644 --- a/projects/adamantfinance/index.js +++ b/projects/adamantfinance/index.js @@ -7,7 +7,6 @@ const { unwrapUniswapLPs, unwrapLPsAuto, } = require("../helper/unwrapLPs"); const { transformPolygonAddress, getChainTransform, - getFixBalances, } = require("../helper/portedTokens"); const { staking: stakingUnknown, } = require("../helper/unknownTokens"); @@ -153,7 +152,6 @@ const tvl = async (timestamp, chain, chainBlocks, lpAddressesIgnored) => { const block = chainBlocks[chain]; const transformAddress = await getChainTransform(chain) - const fixBalances = await getFixBalances(chain) let balances = {}; let resp = await getConfig('adamant-fi/'+chain, vaultsUrl[chain]); @@ -170,7 +168,6 @@ const tvl = async (timestamp, chain, chainBlocks, lpAddressesIgnored) => { })); balances = await uniTvl(balances, chain, block, uniVaults, lpAddressesIgnored, transformAddress); - fixBalances(balances) return balances; }; diff --git a/projects/astriddao/index.js b/projects/astriddao/index.js index 6e1bb69e272..00dd6869931 100644 --- a/projects/astriddao/index.js +++ b/projects/astriddao/index.js @@ -1,6 +1,5 @@ const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens } = require('../helper/unwrapLPs') -const { getFixBalances } = require('../helper/portedTokens') const chain = 'astar' @@ -196,8 +195,6 @@ async function tvl(ts, _block, chainBlocks ) { balances = translateBalancesForBridgeToken(balances); - (await getFixBalances(chain))(balances) - return balances } diff --git a/projects/avault/index.js b/projects/avault/index.js index a7a14d47391..efeb58752fe 100644 --- a/projects/avault/index.js +++ b/projects/avault/index.js @@ -1,6 +1,6 @@ const sdk = require("@defillama/sdk"); const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); -const { getChainTransform, getFixBalances } = require("../helper/portedTokens"); +const { getChainTransform, } = require("../helper/portedTokens"); const { getConfig } = require('../helper/cache') const { vaultsBase } = require("./avault-vault-utils"); @@ -11,7 +11,6 @@ async function tvl(_, _b, chainBlocks) { const chainArr = Object.keys(vaultsInfo); const chain = "astar"; const chainLocal = chain; - const fixBalances = await getFixBalances(chainLocal); const vaultAddressArr = Object.values(vaultsInfo[chainLocal]); const transformAddress = await getChainTransform(chainLocal); const { wantedLocked, wantedAddresses, vaultName } = await vaultsBase( @@ -42,7 +41,6 @@ async function tvl(_, _b, chainBlocks) { chainLocal, transformAddress ); - fixBalances(balances); return balances; } diff --git a/projects/blindex/index.js b/projects/blindex/index.js index 72bbfb23f8f..bd223ac7697 100644 --- a/projects/blindex/index.js +++ b/projects/blindex/index.js @@ -3,7 +3,6 @@ const sdk = require("@defillama/sdk"); const abi = require("../helper/abis/blindex.json"); const { formatAddressChecksum } = require("../helper/formatAddressChecksum.js"); const { getUniTVL, getTokenPrices, } = require("../helper/unknownTokens"); -const { getFixBalances } = require('../helper/portedTokens') //------------------------------------------------------------------------------------------------------------- // How to add a new chain? // 1. Add it to the chains global array @@ -206,8 +205,6 @@ async function tvl(chainName, block) { const balances = sumBalances(balancesArray); const { updateBalances } = await getTokenPrices({ chain, block, useDefaultCoreAssets: true, lps: [blindexBTCLP] }) // get blindex price from LP await updateBalances(balances) - const fixBalances = await getFixBalances(chain) - fixBalances(balances) return balances } diff --git a/projects/celerbridge/index.js b/projects/celerbridge/index.js index 4ee0a323bf0..d65334b8025 100644 --- a/projects/celerbridge/index.js +++ b/projects/celerbridge/index.js @@ -1,7 +1,6 @@ const ADDRESSES = require('../helper/coreAssets.json') const { chainExports } = require("../helper/exports"); const { sumTokens } = require("../helper/unwrapLPs"); -const { getFixBalances } = require('../helper/portedTokens') const ethers = require("ethers") const { config } = require('@defillama/sdk/build/api'); @@ -528,8 +527,6 @@ function chainTvl(chain) { .forEach(owner => toa.push([token[chain], owner])) }) const balances = await sumTokens({}, toa, block, chain) - const fixBalances = await getFixBalances(chain) - fixBalances(balances) return balances }; } diff --git a/projects/eklipse/index.js b/projects/eklipse/index.js index e67d2091f27..5128eea390d 100644 --- a/projects/eklipse/index.js +++ b/projects/eklipse/index.js @@ -1,7 +1,7 @@ const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk') const BigNumber = require('bignumber.js') -const { getChainTransform, getFixBalances, } = require('../helper/portedTokens') +const { getChainTransform, } = require('../helper/portedTokens') const { toUSDTBalances } = require('../helper/balances') const { sumTokens } = require('../helper/unwrapLPs') const vaults = require('./vaults') @@ -88,7 +88,6 @@ async function staking(timestamp, ethBlock, chainBlocks) { async function pool2(timestamp, ethBlock, chainBlocks) { const block = chainBlocks[chain] const transformAddress = await getChainTransform(chain) - const fixBalances = await getFixBalances(chain) const balances = {} // Unwrap USDT-EKL LP position @@ -103,7 +102,6 @@ async function pool2(timestamp, ethBlock, chainBlocks) { const KLAY_LP_totalSupply = (await sdk.api.erc20.totalSupply({ target: KLAY_PAIR, block, chain, })).output balances[transformAddress(W_KLAY_ADDRESS)] = BigNumber(KLAY_Tokens).multipliedBy(2).multipliedBy(KLAY_LP_Tokens).dividedBy(KLAY_LP_totalSupply).toFixed(0) - fixBalances(balances) return balances } diff --git a/projects/euphoria/index.js b/projects/euphoria/index.js index 44d47569e4a..ffdca2cfece 100644 --- a/projects/euphoria/index.js +++ b/projects/euphoria/index.js @@ -1,7 +1,6 @@ const { staking } = require('../helper/staking'); const { sumTokensAndLPsSharedOwners } = require('../helper/unwrapLPs'); const { getChainTransform } = require('../helper/portedTokens'); -const { getFixBalances } = require('../helper/portedTokens'); const wagmiAddresses = { staking: '0x95066025af40F7f7832f61422802cD1e13C23753', @@ -44,8 +43,6 @@ async function tvl(time, ethBlock, {harmony: block}) { transform ); - (await getFixBalances('harmony'))(balances); - return balances; } diff --git a/projects/helper/dexpad.js b/projects/helper/dexpad.js index def2795bf5e..6c83c2dcd00 100644 --- a/projects/helper/dexpad.js +++ b/projects/helper/dexpad.js @@ -6,7 +6,7 @@ const { unwrapUniswapLPs } = require("./unwrapLPs"); const getPairFactory = 'function getPair(address, address) view returns (address)' const { isLP } = require("./utils"); -const { getChainTransform, getFixBalances } = require("./portedTokens"); +const { getChainTransform, } = require("./portedTokens"); async function getDexPadLpsCoreValue( block, @@ -272,9 +272,6 @@ async function getLPsTrackedValue( return obj; }, {}); // console.log("after",balances) - if(chain === 'kava'){ - return (await getFixBalances(chain))(balances) - } return balances; } diff --git a/projects/helper/masterchef.js b/projects/helper/masterchef.js index b4bf0c70a5f..a389f9565b5 100644 --- a/projects/helper/masterchef.js +++ b/projects/helper/masterchef.js @@ -7,7 +7,7 @@ const token1Abi = 'address:token1' const getReservesAbi = 'function getReserves() view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast)' const userInfoAbi = 'function userInfo(uint256, address) view returns (uint256 amount, uint256 rewardDebt)' const { default: BigNumber } = require('bignumber.js'); -const { getChainTransform, getFixBalances } = require('../helper/portedTokens'); +const { getChainTransform, } = require('../helper/portedTokens'); async function getPoolInfo(masterChef, block, chain, poolInfoAbi = abi.poolInfo) { const poolLength = ( @@ -269,10 +269,6 @@ function masterChefExports(masterChef, chain, stakingTokenRaw, tokenIsOnCoingeck }) } - if (['smartbch', 'cronos', 'avax'].includes(chain)) { - const fixBalances = await getFixBalances(chain) - Object.values(balances).map(fixBalances) - } return balances } diff --git a/projects/helper/ohm.js b/projects/helper/ohm.js index 839cfa06ea1..59ed5d23121 100644 --- a/projects/helper/ohm.js +++ b/projects/helper/ohm.js @@ -1,6 +1,5 @@ const { staking, stakingUnknownPricedLP } = require('./staking') const { sumTokensAndLPsSharedOwners, sumLPWithOnlyOneTokenOtherThanKnown } = require('./unwrapLPs') -const { getFixBalances } = require('./portedTokens') function ohmTvl(treasury, treasuryTokens, chain = 'ethereum', stakingAddress, stakingToken, transformOriginal = undefined, fix, tokenOnCoingecko = true) { let transform = transformOriginal @@ -13,8 +12,7 @@ function ohmTvl(treasury, treasuryTokens, chain = 'ethereum', stakingAddress, st sumLPWithOnlyOneTokenOtherThanKnown(balances, t[0], treasury, stakingToken, block, chain, transform) )) } - if (!fix) fix = await getFixBalances(chain) - fix(balances) + if (fix) fix(balances) return balances } return { diff --git a/projects/jioswap/index.js b/projects/jioswap/index.js index c339ab95052..082928f6afd 100644 --- a/projects/jioswap/index.js +++ b/projects/jioswap/index.js @@ -1,8 +1,5 @@ const { sumTokens2 } = require("../helper/unwrapLPs"); const config = require("./config"); -const { getFixBalances } = require("../helper/portedTokens"); -const sdk = require('@defillama/sdk') - module.exports = { misrepresentedTokens: true, @@ -27,8 +24,6 @@ Object.keys(config).forEach((chain) => { block, blacklistedTokens, }); - const fixBalances = await getFixBalances(chain); - fixBalances(balances); return balances; }, }; diff --git a/projects/kavacave/index.js b/projects/kavacave/index.js index fd5cfc7840f..d9485f8168e 100644 --- a/projects/kavacave/index.js +++ b/projects/kavacave/index.js @@ -2,8 +2,6 @@ const sdk = require("@defillama/sdk"); const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); const kavaabi = require("./kavaAbi.json"); const abiGeneral = require("../helper/abis/masterchef.json"); -const { getFixBalances } = require("../helper/portedTokens"); - const masterChef = { kava: "0xf17BBB9698b50156Ee437E01e22D7C2080184934" @@ -65,9 +63,6 @@ async function getTokensInMasterChef(time, ethBlock, chainBlocks, chain) { }); await unwrapUniswapLPs(balances, lpPositions, block, chain, transformAddress); - // console.log(balances) - const fixbalances = await getFixBalances(chain); - fixbalances(balances); return balances; } diff --git a/projects/kleva/index.js b/projects/kleva/index.js index af03f8240a9..c9188c10ecf 100644 --- a/projects/kleva/index.js +++ b/projects/kleva/index.js @@ -3,7 +3,7 @@ const { getConfig } = require('../helper/cache') const { userInfos } = require('./FairLaunch') -const { getChainTransform, getFixBalances } = require('../helper/portedTokens') +const { getChainTransform } = require('../helper/portedTokens') const { getTokenPrices } = require('../helper/unknownTokens') const kExports = require('../kleva-lend') @@ -19,7 +19,6 @@ async function getWorkers() { // - multicall 'userInfos' on FairLaunch contract with lpPoolId & workerAddress async function getFarmingTVL(data, balances,) { const transform = await getChainTransform(chain) - const fixBalances = await getFixBalances(chain) const balancesTemp = {} const lps = [] @@ -47,7 +46,6 @@ async function getFarmingTVL(data, balances,) { await updateBalances(balancesTemp) - await fixBalances(balancesTemp) Object.entries(balancesTemp).forEach(([token, value]) => sdk.util.sumSingleBalance(balances, token, value)) return balances diff --git a/projects/kogefarm/index.js b/projects/kogefarm/index.js index f98988fc8e2..8a901ea0144 100644 --- a/projects/kogefarm/index.js +++ b/projects/kogefarm/index.js @@ -1,8 +1,6 @@ const sdk = require('@defillama/sdk') const abi = require('./abi.json') -const utils = require('../helper/utils') const { unwrapUniswapLPs, } = require('../helper/unwrapLPs') -const { getFixBalances } = require('../helper/portedTokens') const { getConfig } = require('../helper/cache') const { @@ -631,9 +629,6 @@ const kavaTvl = async (timestamp, block, chainBlocks) => { transformAddress, ) - const fixBalances = await getFixBalances('kava') - fixBalances(balances) - await unwrapCrvLPs( balances, crvPositions, diff --git a/projects/kronos/index.js b/projects/kronos/index.js index 42e422342bb..79f4f291f1d 100644 --- a/projects/kronos/index.js +++ b/projects/kronos/index.js @@ -1,6 +1,6 @@ const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); -const { getChainTransform, getFixBalances } = require("../helper/portedTokens") +const { getChainTransform, } = require("../helper/portedTokens") const KDAI = ADDRESSES.klaytn.KDAI; const KSD = ADDRESSES.klaytn.KSD; @@ -71,7 +71,6 @@ async function getTvl(timestamp, ethBlock, chainBlocks) { tvl: {} } const transform = await getChainTransform(chain) - const fixBalances = await getFixBalances(chain) await Promise.all(LPs.map(lp => addToBalance({ balances: balances.tvl, @@ -95,7 +94,6 @@ async function getTvl(timestamp, ethBlock, chainBlocks) { const staking = stakingBalance * tokenPrice / 10 ** 18 sdk.util.sumSingleBalance(balances.staking, 'tether', staking) - fixBalances(balances.tvl) return balances } diff --git a/projects/multichainMiner.js b/projects/multichainMiner.js index 2b58694579d..024fc376097 100644 --- a/projects/multichainMiner.js +++ b/projects/multichainMiner.js @@ -1,7 +1,6 @@ const ADDRESSES = require('./helper/coreAssets.json') const sdk = require("@defillama/sdk"); -const { getChainTransform, - getFixBalances } = require("./helper/portedTokens"); +const { getChainTransform, } = require("./helper/portedTokens"); const minedTokens = { 'cake': '0x0e09fabb73bd3ade0a17ecc321fd13a19e81ce82', @@ -48,13 +47,11 @@ Object.keys(config).forEach(chain => { tvl: async (_, _b, { [chain]: block }) => { const balances = {} const transform = await getChainTransform(chain) - const fixBalances = await getFixBalances(chain) const calls = keys.map(i => ({ target: minerContracts[i] })) const { output: bals } = await sdk.api.abi.multiCall({ abi, calls, chain, block, }) bals.forEach((data, i) => sdk.util.sumSingleBalance(balances, transform(minedTokens[keys[i]]), data.output)) - fixBalances(balances) return balances } } diff --git a/projects/multiplierfinance/index.js b/projects/multiplierfinance/index.js index b8209c44070..2eb0e191d80 100644 --- a/projects/multiplierfinance/index.js +++ b/projects/multiplierfinance/index.js @@ -2,7 +2,6 @@ const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') const { getParamCalls } = require('../helper/utils') -const { getFixBalancesSync } = require('../helper/portedTokens') const YieldContract = "0xE4Baf69B887843aB6A0e82E8BAeA49010fF619af"; const LendingPool = "0xbc3534b076EDB8E8Ef254D81b81DC193c53057F7"; @@ -57,8 +56,7 @@ async function borrowed(_, _b, { bsc: block }) { const balances = {} const data = await getReservesData(block) data.forEach(i => sdk.util.sumSingleBalance(balances,'bsc:'+i.token,i.totalBorrowsVariable)) - const fix = getFixBalancesSync(chain) - return fix(balances) + return balances } async function tvlV2(_, _b, { bsc: block }) { @@ -84,8 +82,7 @@ async function borrowedV2(_, _b, { bsc: block }) { sdk.util.sumSingleBalance(balances,'bsc:'+i.token,supplyVariable[idx].output) sdk.util.sumSingleBalance(balances,'bsc:'+i.token,supplyStable[idx].output) }) - const fix = getFixBalancesSync(chain) - return fix(balances) + return balances } diff --git a/projects/ohmw/index.js b/projects/ohmw/index.js index 92a987cc952..15fa36da811 100644 --- a/projects/ohmw/index.js +++ b/projects/ohmw/index.js @@ -1,14 +1,8 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const { ohmTvl } = require('../helper/ohm') -const { getFixBalancesSync } = require('../helper/portedTokens') - module.exports= { hallmarks: [ [1670457600, "Rug Pull"] ], - ...ohmTvl("0xE0Fe9Af0208ba444F81eDF348F23bd1A91Dc395E", [ - ["0x11bbB41B3E8baf7f75773DB7428d5AcEe25FEC75", false], // USDC - [ADDRESSES.ethereum.WETH, false], // WETH - ["0x2569134cbe40da06C1c9c1A24A7E1D2641099cA6", true], // OHMW-ETHW SLP - ], "ethpow", "0x55C07a8AB97DAF79D478fE2bC2090858F0708AFF", "0xA5174cB46A15bD7d90Af7664372b1f4207a9ABea",undefined, getFixBalancesSync('ethpow')) + ethpow: { + tvl: () => ({}), + } } \ No newline at end of file diff --git a/projects/onedaofinance/index.js b/projects/onedaofinance/index.js index fdccd8a4a4c..db9e5a10517 100644 --- a/projects/onedaofinance/index.js +++ b/projects/onedaofinance/index.js @@ -1,25 +1,7 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const { ohmTvl } = require('../helper/ohm') -const { getFixBalancesSync } = require('../helper/portedTokens') -const replacements = { - "0x224e64ec1bdce3870a6a6c777edd450454068fec":"0xa47c8bf37f92abed4a126bda807a7b7498661acd", //UST -} - -module.exports= { - deadFrom: 1648765747, - - ...ohmTvl("0xcdC825e5Fc3D5af362dAF887D4EDc4c73c072EdE", [ - ["0xe176ebe47d621b984a73036b9da5d834411ef734", false], // BUSD - ["0xef977d2f931c1978db5f6747666fa1eacb0d0339", false], // DAI - ["0xeb6c08ccb4421b6088e581ce04fcfbed15893ac3", false], // FRAX - ["0x34f21378a6fc29acc1eacb82bc5f7dec794ce537", true], // ODAO-ETH SLP - ["0x171ff11b53674958c273bcfccbc731aa6cae96f8", true], // ODAO-WONE SLP - ["0x4f658217f163509115b6e1fbba37cd9aefbdba12", true], // ODAO-DAI SLP - ["0x3c2b8be99c50593081eaa2a724f0b8285f5aba8f", false], // USDT - ["0x985458e523db3d53125813ed68c274899e9dfab4", false], // USDC - [ADDRESSES.harmony.WONE, false], // WONE - ["0x224e64ec1bdce3870a6a6c777edd450454068fec", false] // WUST -], "harmony", "0x9cAc73eA219e5F8a96485c937E2C8A617f7F4f37", "0x947394294F75D7502977AC6813FD99f77C2931ec",addr=>{ - return replacements[addr] || `harmony:${addr}`}, getFixBalancesSync('harmony')) +module.exports = { + deadFrom: 1648765747, + harmony: { + tvl: () => ({}), + } } \ No newline at end of file diff --git a/projects/orcus/index.js b/projects/orcus/index.js index 84c5a3f6b3b..f00d7bd7c8f 100644 --- a/projects/orcus/index.js +++ b/projects/orcus/index.js @@ -1,7 +1,6 @@ const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens } = require('../helper/unwrapLPs') const { getTokenPrices } = require('../helper/unknownTokens') -const { getFixBalances } = require('../helper/portedTokens') const { createIncrementArray } = require('../helper/utils') const masterChefABI = require('../helper/abis/masterchef.json') const abi = require('./abi') @@ -21,7 +20,6 @@ async function getTVL(chainBlocks) { const balances = {} const pool2Balances = {} const stakeBalances = {} - const fixBalances = await getFixBalances(chain) const block = chainBlocks[chain] // resolve masterchef @@ -34,19 +32,16 @@ async function getTVL(chainBlocks) { } = await getTokenPrices({ block, chain, lps: pools, useDefaultCoreAssets: true, }) await updateBalances(pool2Balances) - await fixBalances(pool2Balances) // resolve pool2 await sumTokens(stakeBalances, [[ORU, STAKE_ADDRESS]], block, chain) await updateBalances(stakeBalances) - await fixBalances(stakeBalances) // resolve bank await sumTokens(balances, [[USDC, BANK_SAFE], [ibUSDC, BANK_SAFE]], block, chain) await updateBalances(balances) - await fixBalances(balances) return { tvl: balances, diff --git a/projects/parrotegg/index.js b/projects/parrotegg/index.js index 5b1eaeccd25..ff8b61eb23e 100644 --- a/projects/parrotegg/index.js +++ b/projects/parrotegg/index.js @@ -1,4 +1,4 @@ -const { transformArbitrumAddress, transformPolygonAddress, getChainTransform, getFixBalancesSync, transformBalances, } = require("../helper/portedTokens"); +const { transformArbitrumAddress, transformPolygonAddress, getChainTransform, transformBalances, } = require("../helper/portedTokens"); const { addFundsInMasterChef } = require('../helper/masterchef'); const STAKING_CONTRACT_ARBITRUM = "0x1cCf20F4eE3EFD291267c07268BEcbFDFd192311"; //MASTERCHEF ARBITRUM const STAKING_CONTRACT_IOTEX = "0x83E7e97C4e92D56c0653f92d9b0c0B70288119b8"; // MASTERCHEF IOTEX @@ -38,8 +38,6 @@ const harmonyTvl = async (timestamp, ethBlock, chainBlocks) => { delete balances['0xC36769DFcDF05B2949F206FC34C8870707D33C89']; //TOKEN ADDRESS delete balances['0xC36769DFcDF05B2949F206FC34C8870707D33C89']; //TOKEN ADDRESS - getFixBalancesSync('harmony')(balances); - return balances; }; diff --git a/projects/polkaex/index.js b/projects/polkaex/index.js index efa127ba806..1f30dff5d77 100644 --- a/projects/polkaex/index.js +++ b/projects/polkaex/index.js @@ -1,7 +1,6 @@ const ADDRESSES = require('../helper/coreAssets.json') const { getUniTVL } = require('../helper/unknownTokens') const { stakings } = require("../helper/staking"); -const { getFixBalances } = require('../helper/portedTokens'); const FACTORIES = { astar: "0x1E66b3e7141bDF8c414F91269a3A99d098D2d356", @@ -103,7 +102,6 @@ module.exports = { )(timestamp, _ethBlock, chainBlocks); const result = { ...pkexStaking, ...dotStaking }; - (await getFixBalances("astar"))(result); return result; }, }, diff --git a/projects/quartzdefi/index.js b/projects/quartzdefi/index.js index c3042666ad6..b9913df2ab7 100644 --- a/projects/quartzdefi/index.js +++ b/projects/quartzdefi/index.js @@ -53,10 +53,6 @@ async function harmonyPool2(timestamp, block, chainBlocks) { }); await unwrapUniswapLPs(balances, lpPositions, block, chain, addr=>{ - addr = addr.toLowerCase(); - if (addr === "0x224e64ec1bdce3870a6a6c777edd450454068fec") { - return "0xa47c8bf37f92abed4a126bda807a7b7498661acd"; - } return `harmony:${addr}`; }); diff --git a/projects/ramp/index.js b/projects/ramp/index.js index 2540a22a075..f75c9278f41 100644 --- a/projects/ramp/index.js +++ b/projects/ramp/index.js @@ -1,7 +1,7 @@ const sdk = require('@defillama/sdk'); const abi = require('./abi.json'); const axios = require("axios"); -const { getChainTransform, getFixBalances } = require('../helper/portedTokens') +const { getChainTransform, } = require('../helper/portedTokens') async function getConfig(network) { return await axios.get('https://config.rampdefi.com/config/appv2/priceInfo').then(response => response.data[network]); @@ -15,7 +15,6 @@ function getChainTVL(chain) { delete tokens.RUSD delete tokens.RAMP const transform = await getChainTransform(chain) - const fixBalances = await getFixBalances(chain) const calls = [] @@ -37,7 +36,6 @@ function getChainTVL(chain) { sdk.util.sumSingleBalance(balances, token, balance) }) - fixBalances(balances) return balances } } diff --git a/projects/reverse/index.js b/projects/reverse/index.js index 2c24179def4..315a8389f0a 100644 --- a/projects/reverse/index.js +++ b/projects/reverse/index.js @@ -1,16 +1,3 @@ -const { ohmTvl } = require('../helper/ohm') -const { getFixBalancesSync } = require('../helper/portedTokens') - -const replacements = { - "0x224e64ec1bdce3870a6a6c777edd450454068fec":"0xa47c8bf37f92abed4a126bda807a7b7498661acd", //UST -} - -const treasury = "0xa3904e99b6012eb883db1090d02d4e954539ec61" -module.exports = ohmTvl(treasury, [ - ["0xcde0a00302cf22b3ac367201fbd114cefa1729b4", true], - ["0x4dabf6c57a8bea012f1eaa1259ceed2a62ac7df2", true], - ["0xf8838fcc026d8e1f40207acf5ec1da0341c37fe2", true], - ["0x224e64ec1bdce3870a6a6c777edd450454068fec", false], -], "harmony", "0xeea71889c062c135014ec34825a1958c87a2ac61", "0xed0b4b0f0e2c17646682fc98ace09feb99af3ade", addr=>{ - return replacements[addr] ?? `harmony:${addr}` -}, getFixBalancesSync('harmony')) \ No newline at end of file +module.exports = { + harmony: { tvl: () => ({}) }, +} \ No newline at end of file diff --git a/projects/rubyfinance/index.js b/projects/rubyfinance/index.js index f26ba2153f1..566941f3125 100644 --- a/projects/rubyfinance/index.js +++ b/projects/rubyfinance/index.js @@ -1,7 +1,6 @@ const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); -const { getFixBalances } = require("../helper/portedTokens"); const { getTokenPrices } = require("../helper/unknownTokens") const { stakingUnknownPricedLP } = require("../helper/staking") @@ -53,7 +52,6 @@ async function calcPool2(genesisPool, rewardPool, lps, block, chain) { ); await updateBalances(balances, { resolveLP: true }); - (await getFixBalances(chain))(balances); return balances; } @@ -76,7 +74,6 @@ async function calcKava(rewardPool, block, chain) { wkavaRewardBalance ); - (await getFixBalances(chain))(balances); return balances; } diff --git a/projects/single/index.js b/projects/single/index.js index dd73cbed6d1..54da257086e 100644 --- a/projects/single/index.js +++ b/projects/single/index.js @@ -1,5 +1,4 @@ const { sumTokens2 } = require("../helper/unwrapLPs") -const { getFixBalances } = require("../helper/portedTokens") const { getUserMasterChefBalances } = require("../helper/masterchef") const { getUserCraftsmanV2Balances, getUserCamelotMasterBalances } = require("./helpers") const vvsPoolInfoABI = 'function poolInfo(uint256) view returns (address lpToken, uint256 allocPoint, uint256 lastRewardBlock, uint256 accVVSPerShare)' @@ -55,12 +54,10 @@ const getHelpers = (chain) => { const { pools, } = await fetchDataOnce() let balances = {} - const fixBalances = await getFixBalances(chain) const block = chainBlocks[chain] const tokensAndOwners = pools.filter(pool => !pool.isLP).map(pool => [pool.tokenContract, pool.address]) await sumTokens2({ balances, tokensAndOwners, block, chain }) - fixBalances(balances) return balances } @@ -70,7 +67,6 @@ const getHelpers = (chain) => { const balances = {} const block = chainBlocks[chain] - const fixBalances = await getFixBalances(chain) for (const wMasterChef of wmasterchefs) { await getWMasterChefBalances(wMasterChef, { balances, block, chain, excludePool2: true, pool2Tokens: [SINGLE_TOKEN] }) @@ -78,7 +74,6 @@ const getHelpers = (chain) => { const tokensAndOwners = vaults.map(({ token, address }) => [token, address]) await sumTokens2({ balances, tokensAndOwners, block, chain }) // Add lending pool tokens to balances - fixBalances(balances) return balances } @@ -88,7 +83,6 @@ const getHelpers = (chain) => { const balances = {} const block = chainBlocks[chain] - const fixBalances = await getFixBalances(chain) const tokensAndOwners = pools.filter(pool => pool.isLP).map(pool => [pool.tokenContract, pool.address]) await sumTokens2({ balances, tokensAndOwners, block, chain, resolveLP: true }) // Add staked lp tokens to balances @@ -96,7 +90,6 @@ const getHelpers = (chain) => { await getWMasterChefBalances(wMasterChef, { balances, block, chain, onlyPool2: true, pool2Tokens: [SINGLE_TOKEN] }) } - fixBalances(balances) return balances } diff --git a/projects/stablekoi/index.js b/projects/stablekoi/index.js index fba993ed4a0..1d575933f52 100644 --- a/projects/stablekoi/index.js +++ b/projects/stablekoi/index.js @@ -1,6 +1,5 @@ const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens } = require("../helper/unwrapLPs"); -const { getFixBalances } = require("../helper/portedTokens"); const { GraphQLClient, gql } = require("graphql-request"); const abi = require("./abi.json"); const sdk = require("@defillama/sdk"); @@ -12,27 +11,25 @@ const chain = "godwoken"; async function tvl(ts, _block, chainBlocks) { const balances = {}; - const fixBalances = await getFixBalances(chain); const tokensAndOwners = []; const poolInfo = await getConfig('stable-koi-v0', "https://app.stablekoi.com/lists/poollist.json"); poolInfo.forEach((pool) => { pool.tokens.forEach((token) => tokensAndOwners.push([token, pool.address])); }); await sumTokens(balances, tokensAndOwners, chainBlocks[chain], chain); - return fixBalances(balances); + return balances } async function tvl_v1(ts, _block, chainBlocks) { const balances = {}; const chain = "godwoken_v1"; - const fixBalances = await getFixBalances(chain); const tokensAndOwners = []; // const poolInfo = await get('https://app-v1.stablekoi.com/api/pools'); v1Pools.forEach((pool) => { pool.tokens.forEach((token) => tokensAndOwners.push([token.address, pool.address])); }); await sumTokens(balances, tokensAndOwners, chainBlocks[chain], chain); - return fixBalances(balances); + return balances } const yokaiInfoAPI = diff --git a/projects/starswap/index.js b/projects/starswap/index.js index 5fb6aa0cacb..ac2cb5cd49d 100644 --- a/projects/starswap/index.js +++ b/projects/starswap/index.js @@ -1,5 +1,4 @@ const { getUniTVL, getTokenPrices, } = require('../helper/unknownTokens') -const { getFixBalances } = require('../helper/portedTokens') const sdk = require('@defillama/sdk') const FACTORIES = "0x0b657e81a0C3E903cbe1228579fBd49AC5D81Ac1" @@ -31,11 +30,9 @@ module.exports = { }) const balances = { [chain + ':' + TOKENS.STAR] : totalStakedTokens } - const transform = await getFixBalances(chain) const { updateBalances } = await getTokenPrices({ chain, block, useDefaultCoreAssets: true, lps: [ ASTAR_LP ], allLps: true }) await updateBalances(balances) - transform(balances) return balances } } diff --git a/projects/synapse/index.js b/projects/synapse/index.js index d5a5ed90fce..e47d3ba76bf 100644 --- a/projects/synapse/index.js +++ b/projects/synapse/index.js @@ -2,7 +2,7 @@ const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens, } = require("../helper/unwrapLPs") const { sumTokens: sumTokensCosmos, } = require('../helper/chain/cosmos') const sdk = require("@defillama/sdk") -const { getChainTransform, getFixBalances } = require("../helper/portedTokens") +const { getChainTransform, } = require("../helper/portedTokens") const config = require("./config") const nullAddress = ADDRESSES.null @@ -32,7 +32,6 @@ Object.keys(config).forEach(chain => { const balance = await sdk.api.eth.getBalance({ target: address, block, chain }) sdk.util.sumSingleBalance(balances, transform(nullAddress), balance.output) } - (await getFixBalances(chain))(balances); return balances } }) diff --git a/projects/tectonic/index.js b/projects/tectonic/index.js index 95ea019deff..d1935303d3d 100644 --- a/projects/tectonic/index.js +++ b/projects/tectonic/index.js @@ -1,7 +1,7 @@ const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); const { sumTokens2, nullAddress } = require("../helper/unwrapLPs"); -const { getChainTransform, getFixBalances } = require("../helper/portedTokens"); +const { getChainTransform, } = require("../helper/portedTokens"); const tcro = "0xeAdf7c01DA7E93FdB5f16B0aa9ee85f978e89E95"; @@ -30,7 +30,6 @@ async function tvl(ts, _, { [chain]: block }) { async function borrowed(timestamp, block, chainBlocks) { block = chainBlocks[chain] const transform = await getChainTransform(chain) - const fixBlances = await getFixBalances(chain) const calls = [...markets, tcro].map(i => ({ target: i })) const { output: tokens } = await sdk.api.abi.multiCall({ abi: abi.underlying, @@ -45,7 +44,6 @@ async function borrowed(timestamp, block, chainBlocks) { sdk.util.sumSingleBalance(balances, transform(data.output), borrowed[i].output) }) sdk.util.sumSingleBalance(balances, transform(nullAddress), borrowed[markets.length].output) - fixBlances(balances) return balances } diff --git a/projects/tranquil/index.js b/projects/tranquil/index.js index 9778d78b9b3..8c578c5c7c2 100644 --- a/projects/tranquil/index.js +++ b/projects/tranquil/index.js @@ -1,9 +1,8 @@ const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const { BigNumber } = require("bignumber.js"); -const {compoundExports, getCompoundV2Tvl} = require('../helper/compound') +const { getCompoundV2Tvl} = require('../helper/compound') const { uniTvlExport } = require('../helper/calculateUniTvl.js'); -const { getFixBalancesSync } = require("../helper/portedTokens"); const tqOne = "0x34B9aa82D89AE04f0f546Ca5eC9C93eFE1288940"; // tqONE const wOne = ADDRESSES.harmony.WONE; diff --git a/projects/treasury/wagmidao.js b/projects/treasury/wagmidao.js index f254a652833..1e22136dc14 100644 --- a/projects/treasury/wagmidao.js +++ b/projects/treasury/wagmidao.js @@ -1,9 +1,6 @@ const sdk = require("@defillama/sdk"); const abi = require("../wagmidao/abi.json"); const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); -const { - getFixBalancesSync, -} = require("../helper/portedTokens"); const bondContracts = [ //Bond 1USDC @@ -18,8 +15,6 @@ const bondContracts = [ "0xEfb7DDE5261100a32657C9606507a130257D93c6", ]; -const GMI = "0x8750f5651af49950b5419928fecefca7c82141e3"; - const Treasury = async (timesamp, ethBlock, chainBlocks) => { const balances = {}; @@ -65,8 +60,6 @@ const Treasury = async (timesamp, ethBlock, chainBlocks) => { "harmony", ); - getFixBalancesSync('harmony')(balances); - return balances; }; diff --git a/projects/wagmidao/index.js b/projects/wagmidao/index.js index 2c0bf2849cb..fc5fc5a3d4f 100644 --- a/projects/wagmidao/index.js +++ b/projects/wagmidao/index.js @@ -1,80 +1,13 @@ const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); const { uniTvlExport } = require("../helper/calculateUniTvl"); -const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); -const { - getFixBalancesSync, -} = require("../helper/portedTokens"); const factory = "0xfe33b03a49a1fcd095a8434dd625c2d2735e84b8"; const masterChef = "0xf046e84439813bb0a26fb26944001c7bb4490771"; const stakingContract = "0xaa2c3396cc6b3dc7b857e6bf1c30eb9717066366"; -const bondContracts = [ - //Bond 1USDC - "0xe443F63564216f60625520465F1324043fcC47b9", - //Bond GMI-1USDC - "0x8c4300a7A71efF73b24DCd8f849f82A8B36b5D8a", - //Bond WONE - "0xa31a22d9dec269f512cf62b83039190fbe67f7d2", - //Bond 1ETH - "0x08d44C114e3C0102ace43e9656f478DD4a71cD1D", - //Bond FAM - "0xEfb7DDE5261100a32657C9606507a130257D93c6", -]; - const GMI = "0x8750f5651af49950b5419928fecefca7c82141e3"; -const Treasury = async (timesamp, ethBlock, chainBlocks) => { - const balances = {}; - - const tokenAddresses = ( - await sdk.api.abi.multiCall({ - abi: abi.principal, - calls: bondContracts.map((bond) => ({ - target: bond, - })), - chain: "harmony", - block: chainBlocks["harmony"], - }) - ).output.map((t) => t.output); - - const tokenBalances = ( - await sdk.api.abi.multiCall({ - abi: abi.totalPrincipalReceived, - calls: bondContracts.map((bond) => ({ - target: bond, - })), - chain: "harmony", - block: chainBlocks["harmony"], - }) - ).output.map((b) => b.output); - - const lpPositions = []; - tokenAddresses.forEach((token, idx) => { - if (token == "0x73919726cC9d988cEa1a378772e5f775dF33C049") { - lpPositions.push({ token, balance: tokenBalances[idx] }); - } else { - sdk.util.sumSingleBalance( - balances, - `harmony:${token}`, - tokenBalances[idx] - ); - } - }); - - await unwrapUniswapLPs( - balances, - lpPositions, - chainBlocks["harmony"], - "harmony", - ); - - getFixBalancesSync('harmony')(balances); - - return balances; -}; - const Staking = async (chainBlocks) => { const balances = {}; diff --git a/projects/yieldwolf/index.js b/projects/yieldwolf/index.js index 7b820c7a031..22782306ded 100644 --- a/projects/yieldwolf/index.js +++ b/projects/yieldwolf/index.js @@ -3,7 +3,6 @@ const abi = require("./abi.json"); const { unwrapLPsAuto } = require("../helper/unwrapLPs"); const { getChainTransform, - getFixBalances, } = require("../helper/portedTokens"); const vaultsContractPolygon = "0xBF65023BcF48Ad0ab5537Ea39C9242de499386c9"; @@ -48,8 +47,6 @@ const calcTvl = async (chain, block, masterchef, ignoreAddresses = []) => { }) await unwrapLPsAuto({ balances, block, chain, transformAddress }) - const fixBalances = await getFixBalances(chain) - fixBalances(balances) return balances }; From a72c75318ddab5e05a4b01e2eaf404132d97b3fd Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 11 Aug 2023 13:05:28 +0200 Subject: [PATCH 0782/1974] update aevo --- projects/aevo-xyz/index.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/projects/aevo-xyz/index.js b/projects/aevo-xyz/index.js index 3d2e14f5a6b..8686b554a1b 100644 --- a/projects/aevo-xyz/index.js +++ b/projects/aevo-xyz/index.js @@ -3,6 +3,14 @@ const { sumTokensExport } = require("../helper/unwrapLPs"); module.exports = { ethereum: { - tvl: sumTokensExport({ owner: '0x4082C9647c098a6493fb499EaE63b5ce3259c574', tokens: [ADDRESSES.ethereum.USDC]}) + tvl: sumTokensExport({ owner: '0x4082C9647c098a6493fb499EaE63b5ce3259c574', tokens: [ + ADDRESSES.null, + ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.USDT, + ADDRESSES.ethereum.WBTC, + ADDRESSES.ethereum.DAI, + ADDRESSES.ethereum.WETH, + ADDRESSES.ethereum.STETH, + ]}) } } \ No newline at end of file From 3c66905c5ca0fb84c6901af8432c2adc6b6967db Mon Sep 17 00:00:00 2001 From: define Date: Fri, 11 Aug 2023 14:06:32 +0100 Subject: [PATCH 0783/1974] add perp adapter for swapbased --- projects/swapbased-perp/index.js | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 projects/swapbased-perp/index.js diff --git a/projects/swapbased-perp/index.js b/projects/swapbased-perp/index.js new file mode 100644 index 00000000000..d1b63dfa8d5 --- /dev/null +++ b/projects/swapbased-perp/index.js @@ -0,0 +1,8 @@ +//const {staking} = require('../helper/staking') +const { gmxExports } = require('../helper/gmx') + +module.exports = { + base:{ + tvl: gmxExports({ vault: '0x210b49f74040A385840a3276E81bA9010954d064', }) + } +}; \ No newline at end of file From 9763784bae69ce9f6643dd98124fde2fde145865 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 11 Aug 2023 16:11:46 +0200 Subject: [PATCH 0784/1974] minor fix --- projects/onedaofinance/index.js | 1 + projects/reverse/index.js | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/projects/onedaofinance/index.js b/projects/onedaofinance/index.js index db9e5a10517..4ac70845488 100644 --- a/projects/onedaofinance/index.js +++ b/projects/onedaofinance/index.js @@ -3,5 +3,6 @@ module.exports = { deadFrom: 1648765747, harmony: { tvl: () => ({}), + staking: () => ({}), } } \ No newline at end of file diff --git a/projects/reverse/index.js b/projects/reverse/index.js index 315a8389f0a..2d4225a114f 100644 --- a/projects/reverse/index.js +++ b/projects/reverse/index.js @@ -1,3 +1,6 @@ module.exports = { - harmony: { tvl: () => ({}) }, + harmony: { + tvl: () => ({}), + staking: () => ({}), + }, } \ No newline at end of file From 9c2a763e04cb1c9614bebe20c87a11c087921d52 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Fri, 11 Aug 2023 15:52:48 +0100 Subject: [PATCH 0785/1974] remove unused entry --- projects/steadefi/index.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/projects/steadefi/index.js b/projects/steadefi/index.js index 02e4e45d928..37871293006 100644 --- a/projects/steadefi/index.js +++ b/projects/steadefi/index.js @@ -14,10 +14,11 @@ const config = { arbitrum: { fsglp: ADDRESSES.arbitrum.fsGLP }, avax: { fsglp: '0x9e295B5B976a184B14aD8cd72413aD846C299660' }, } -module.exports.hallmarks = [ - [1691373600, "Steadefi exploited"], -], + module.exports = { + hallmarks : [ + [1691373600, "Steadefi exploited"], + ], }; Object.keys(config).forEach(chain => { From 02091229a391bafe961ed16d076a91d9caf3d6ce Mon Sep 17 00:00:00 2001 From: gaspare100 Date: Fri, 11 Aug 2023 17:40:15 +0100 Subject: [PATCH 0786/1974] Scrub-Invest Temporarily remove pool until new one is created (#7123) --- projects/scrubinvest/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/scrubinvest/index.js b/projects/scrubinvest/index.js index eae68ef0d16..27e6a794bcf 100644 --- a/projects/scrubinvest/index.js +++ b/projects/scrubinvest/index.js @@ -47,7 +47,7 @@ async function tvl(_, _b, _cb, { api, }) { [ADDRESSES.moonriver.USDC, '0x1504B9EDdD57Ed8252b3b3b407DdE27B72A80790'], [ADDRESSES.kava.WKAVA, '0xC05021F3b3601BF33aB59dc75577B85985ACaab7'], // New Scrub Pool - ['0x471F79616569343e8e84a66F342B7B433b958154', '0x67041094c4fc1492A1AB988Fb8De0ab4A0a4A080'], + //['0x471F79616569343e8e84a66F342B7B433b958154', '0x67041094c4fc1492A1AB988Fb8De0ab4A0a4A080'], // WETH From 229dc0b166e3c78bd3772bc6ec2011596c5c2a06 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 11 Aug 2023 23:09:54 +0530 Subject: [PATCH 0787/1974] Ithil (#7125) * add ithil * minor refactor --------- Co-authored-by: OxMarco <> --- projects/ithil/index.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 projects/ithil/index.js diff --git a/projects/ithil/index.js b/projects/ithil/index.js new file mode 100644 index 00000000000..d5d0327b89c --- /dev/null +++ b/projects/ithil/index.js @@ -0,0 +1,27 @@ +const { sumERC4626VaultsExport } = require('../helper/erc4626') + +const config = { + arbitrum: { + vaults: { + USDC: '0x6b416C9727fb248C3097b5c1D10c39a7EBDFf239', + USDT: '0x8b002cf7380403329627149aA3D730E633BF1D33', + DAI: '0xdC4c8Bfbf326d5F87fCB58D1a6E5B6E23992E61d', + WETH: '0xE8FEB169cc9ffbF3873EbfD31e34144672D9D7D0', + WBTC: '0xd5687bfa0b5EBc020dc726282cFD94086701DF94', + } + }, +} +module.exports = { + methodology: 'We calculate the TVL as the sum of (deposits + loans + locked profits - losses) for each vault available', + start: 119401838, + hallmarks: [ + [1691649008, "private mainnet launch"] + ], +} + +Object.keys(config).forEach(chain => { + const { vaults } = config[chain] + module.exports[chain] = { + tvl: sumERC4626VaultsExport({ vaults: Object.values(vaults) }) + } +}) \ No newline at end of file From 920d114cbce0ed3f25f5dabfc47d4230048ac2e1 Mon Sep 17 00:00:00 2001 From: linchuan Date: Sat, 12 Aug 2023 01:43:08 +0800 Subject: [PATCH 0788/1974] add edebase (#7120) --- projects/edebase/index.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 projects/edebase/index.js diff --git a/projects/edebase/index.js b/projects/edebase/index.js new file mode 100644 index 00000000000..233084d09a0 --- /dev/null +++ b/projects/edebase/index.js @@ -0,0 +1,16 @@ +const sdk = require('@defillama/sdk'); +const { gmxExports } = require("../helper/gmx"); +const { sumTokens2 } = require('../helper/unwrapLPs'); + +module.exports = { + base: { + tvl: sdk.util.sumChainTvls([ + async (_, _1, _2, { api }) => { + const vault = '0x251705b174386009ac82e08eAFDd7A9987e50e5d' + const VaultStorage = '0xd878eA6c7aA749c88ad127852423BA8c508bcE08' + const tokens = await api.call({ abi: 'address[]:fundingTokenList', target: VaultStorage}) + return sumTokens2({ api, owner: vault, tokens, }) + }, + ]) + }, +} From 917d27db6bcc06122b006e2f1590d2feed32cb5d Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 11 Aug 2023 20:54:00 +0200 Subject: [PATCH 0789/1974] fix baseswap --- projects/baseswap/index.js | 2 +- projects/helper/cache/uniswap.js | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/projects/baseswap/index.js b/projects/baseswap/index.js index 975aa6f2c31..233217ac685 100644 --- a/projects/baseswap/index.js +++ b/projects/baseswap/index.js @@ -2,7 +2,7 @@ const { getUniTVL } = require('../helper/unknownTokens') const BSWAP = "0x78a087d713Be963Bf307b18F2Ff8122EF9A63ae9"; const FACTORY = "0xFDa619b6d20975be80A10332cD39b9a4b0FAa8BB" -const dexTVL = getUniTVL({ factory: FACTORY, useDefaultCoreAssets: true, fetchBalances: true, }) +const dexTVL = getUniTVL({ factory: FACTORY, useDefaultCoreAssets: true, fetchBalances: true, permitFailure: true }) module.exports = { diff --git a/projects/helper/cache/uniswap.js b/projects/helper/cache/uniswap.js index 933eda835e5..9af98486e41 100644 --- a/projects/helper/cache/uniswap.js +++ b/projects/helper/cache/uniswap.js @@ -17,6 +17,7 @@ function getUniTVL({ coreAssets, blacklist = [], factory, blacklistedTokens, waitBetweenCalls, hasStablePools = false, stablePoolSymbol = 'sAMM', + permitFailure = false, }) { let updateCache = false @@ -83,9 +84,9 @@ function getUniTVL({ coreAssets, blacklist = [], factory, blacklistedTokens, calls.push({ target: cache.token0s[i], params: owner }) calls.push({ target: cache.token1s[i], params: owner }) }) - const bals = await api.multiCall({ abi: 'erc20:balanceOf', calls, }) + const bals = await api.multiCall({ abi: 'erc20:balanceOf', calls, permitFailure, }) for (let i = 0; i < bals.length; i++) { - reserves.push({ _reserve0: bals[i], _reserve1: bals[i + 1] }) + reserves.push({ _reserve0: bals[i] ?? 0, _reserve1: bals[i + 1] ?? 0 }) i++ } } else From 9b1bf68edb887906b857e8474b121b700fc764af Mon Sep 17 00:00:00 2001 From: Raul <42917076+elRaulito@users.noreply.github.com> Date: Fri, 11 Aug 2023 21:13:25 +0200 Subject: [PATCH 0790/1974] Update index.js (#7126) --- projects/fluidtokens/index.js | 38 +++++------------------------------ 1 file changed, 5 insertions(+), 33 deletions(-) diff --git a/projects/fluidtokens/index.js b/projects/fluidtokens/index.js index 7ac1e750fae..d6ecd11bfaf 100644 --- a/projects/fluidtokens/index.js +++ b/projects/fluidtokens/index.js @@ -62,38 +62,10 @@ async function tvl() { async function borrowed( ts //timestamp in seconds ) { - const data = await get("https://api.fluidtokens.com/get-active-loans"); - let SC1_tvl = 0; - let SC2_tvl = 0; - - const timeNow = ts * 1e3; - data - .filter((i) => { - //select SC1 active inputs - return i.SCversion == 1 && i.timeToEndLoan >= timeNow; - }) - .forEach((i) => { - SC1_tvl += +i.loanData.AMOUNT; - }); - data - .filter((i) => { - //select SC2 inputs - return i.SCversion == 2; - }) - .filter((x) => { - return ( - //filter by active loans - x.activeLoanData.lendDate + - x.loanRequestData.loanDuration * - 3.6 * - 1e6 /* hours in milliseconds */ >= - timeNow - ); - }) - .forEach((x) => { - SC2_tvl += parseInt(x.loanRequestData.loanAmnt); - }); - + const data = await get("https://api.fluidtokens.com/get-ft-stats"); + let SC_tvl = parseInt(data.active_loans_volume); + + const dataOffers = await get("https://api.fluidtokens.com/get-available-collection-offers"); let SC_offers_tvl = 0; @@ -102,7 +74,7 @@ async function borrowed( }); return { - cardano: (SC1_tvl + SC2_tvl) / 1e6, + cardano: (SC_tvl) / 1e6, }; } From 337ba98a023aa80e0ebbde8d73a47c89d21ca7cc Mon Sep 17 00:00:00 2001 From: Landon Gingerich Date: Fri, 11 Aug 2023 14:14:31 -0500 Subject: [PATCH 0791/1974] Add Bybit address for zkSync Era (#7127) --- projects/bybit/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/projects/bybit/index.js b/projects/bybit/index.js index bf28963a3ce..b0b809ffc08 100644 --- a/projects/bybit/index.js +++ b/projects/bybit/index.js @@ -53,7 +53,10 @@ const config = { }, optimism: { owners: ['0xf89d7b9c864f589bbF53a82105107622B35EaA40'] - } + }, + era: { + owners: ['0xf89d7b9c864f589bbF53a82105107622B35EaA40'] + }, } module.exports = cexExports(config) \ No newline at end of file From a76bd6b8cbe24e8b394878750908dea8dc3d9266 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 11 Aug 2023 23:52:47 +0200 Subject: [PATCH 0792/1974] fix broken adapters --- projects/crunchynetwork/index.js | 27 ++++++++++---------- projects/goose.js | 27 ++++++++++---------- projects/helper/env.js | 1 + projects/ladex-exchange/index.js | 7 +++--- projects/lemuriafinance.js | 43 ++++++++++++++------------------ 5 files changed, 50 insertions(+), 55 deletions(-) diff --git a/projects/crunchynetwork/index.js b/projects/crunchynetwork/index.js index 9c445da7521..277cd4cd045 100644 --- a/projects/crunchynetwork/index.js +++ b/projects/crunchynetwork/index.js @@ -1,4 +1,3 @@ -const BigNumber = require("bignumber.js"); const { get } = require('../helper/http') const { RPC_ENDPOINT } = require('../helper/chain/tezos') const { PromisePool } = require('@supercharge/promise-pool') @@ -7,7 +6,8 @@ const { PromisePool } = require('@supercharge/promise-pool') // TVL = sum(crunchFarm.poolBalance / quipuLP.total_supply * quipuLP.tez_pool * 2 * XTZUSD) async function fetchFarmsTvl() { const farms = await get(RPC_ENDPOINT + '/v1/contracts/KT1KnuE87q1EKjPozJ5sRAjQA24FPsP57CE3/bigmaps/farms/keys?limit=1000') - const items = farms.map(farm => [farm.value.poolToken.address, farm.value.poolBalance]); + const items = farms.map(farm => [farm.value.poolToken.address, farm.value.poolBalance]).filter(item => item[1] !== "0") + console.log("items", items) return getAllLPToTez(items); } @@ -27,30 +27,31 @@ async function getAllLPToTez(items) { if (errors && errors.length) throw errors[0] - return results.reduce((previous, current) => previous.plus(current), new BigNumber(0)).multipliedBy(2) + return results.reduce((previous, current) => previous +current, 0) * 2 } async function lpToTez(lpTokenAddress, lpTokens) { if (lpTokens === "0") { - return new BigNumber(0); + return 0 } const tokenStorage = await get(RPC_ENDPOINT + `/v1/contracts/${lpTokenAddress}/storage?limit=1000`); - if (!tokenStorage.dex_lambdas) { - return new BigNumber(0); - } - - const tokenBalance = new BigNumber(lpTokens); - const tokenTotalSupply = new BigNumber(tokenStorage.storage.total_supply); - const lpTezValue = new BigNumber(tokenStorage.storage.tez_pool); - return tokenBalance.dividedBy(tokenTotalSupply).multipliedBy(lpTezValue); + if (!tokenStorage.dex_lambdas) + return 0 + + + const tokenBalance = lpTokens + const tokenTotalSupply = tokenStorage.storage.total_supply + const lpTezValue = tokenStorage.storage.tez_pool + if (!lpTezValue || !tokenBalance || !tokenTotalSupply) return 0 + return lpTezValue * tokenBalance /tokenTotalSupply } async function tvl() { const farmsTvl = await fetchFarmsTvl(); const deepFreezersTvl = await fetchDeepFreezersTvl(); return { - tezos: farmsTvl.plus(deepFreezersTvl).shiftedBy(-6).toFixed(0) + tezos: (farmsTvl + deepFreezersTvl ) / 1e6 }; } diff --git a/projects/goose.js b/projects/goose.js index 3f669731e78..0872f9d1591 100644 --- a/projects/goose.js +++ b/projects/goose.js @@ -1,19 +1,18 @@ -const utils = require('./helper/utils'); -/* * * * * * * * -* ==> Correct adapter needs to be created. -* -*****************/ - -async function fetch() { - let response = await utils.fetchURL('https://api.goosedefi.com/getTVL') - return parseFloat(response.data); +const { getConfig } = require('./helper/cache') +const { sumUnknownTokens } = require('./helper/unknownTokens') +async function tvl(_, _b, _cb, { api, }) { + let data = await getConfig('goosedefi', 'https://api.goosedefi.com/vaults/getGusdVaultsData') + const pools = data.map(i => i.stratAddress) + const tokens = data.map(i => i.stakeTokenAddress) + // const tokens = await api.multiCall({ abi: 'address:pairAddress', calls: pools}) + const bals = await api.multiCall({ abi: 'uint256:wantLockedTotal', calls: pools}) + api.addTokens(tokens, bals) + return sumUnknownTokens({ api, useDefaultCoreAssets: true, resolveLP: true, }) } module.exports = { - bsc: { - fetch - }, - fetch -} + misrepresentedTokens: true, + bsc: { tvl }, +}; diff --git a/projects/helper/env.js b/projects/helper/env.js index d1cd406d5c5..0e283b382d6 100644 --- a/projects/helper/env.js +++ b/projects/helper/env.js @@ -10,6 +10,7 @@ const DEFAULTS = { SUI_RPC: 'https://fullnode.mainnet.sui.io/', MULTIVERSX_RPC: 'https://api.multiversx.com', PGN_RPC: 'https://rpc.publicgoods.network', + LACHAIN_RPC: 'https://rpc-mainnet.lachain.io', } const ENV_KEYS = [ diff --git a/projects/ladex-exchange/index.js b/projects/ladex-exchange/index.js index 9c3789a87b7..04976dce93a 100644 --- a/projects/ladex-exchange/index.js +++ b/projects/ladex-exchange/index.js @@ -1,9 +1,8 @@ const { getUniTVL } = require('../helper/unknownTokens') - const factory_contract = "0xD707d9038C1d976d3a01c770f01CB73a1fd305Cd" module.exports = { - lachain: { - tvl: getUniTVL({ factory: factory_contract, chain: 'lachain', useDefaultCoreAssets: true }), - } + lachain: { + tvl: getUniTVL({ factory: factory_contract, chain: 'lachain', useDefaultCoreAssets: true }), + } }; diff --git a/projects/lemuriafinance.js b/projects/lemuriafinance.js index 7d492ccf653..75745d2532e 100644 --- a/projects/lemuriafinance.js +++ b/projects/lemuriafinance.js @@ -1,27 +1,22 @@ -const utils = require("./helper/utils"); - var chainId; - var vault; - async function fetch() { - const response = await utils.fetchURL("https://api.lemuria.finance/tvl"); +const { getConfig } = require('./helper/cache') +const { sumUnknownTokens } = require('./helper/unknownTokens') - let tvl = 0; - for (chainId in response.data) { - const chain = response.data[chainId]; +async function tvl(_, _b, _cb, { api, }) { + let data = await getConfig('lemuria', 'https://raw.githubusercontent.com/lemuriafinance/lemuria-frontend-pub/main/src/features/configure/vault/milkomeda_pools.js') + data = JSON.parse(data.slice(data.indexOf('[')).replaceAll('\'', '"').replaceAll(/\n\s+(\w+)/g, '"$1"').split('\n').map(i => i.replaceAll(/\s+\/\/.*/g, '').trim()).join('').replaceAll(';', '').replaceAll(/\,(\]|\})/g, '$1')) + const pools = data.map(i => i.earnContractAddress) + const tokens = await api.multiCall({ abi: 'address:want', calls: pools}) + const bals = await api.multiCall({ abi: 'uint256:balance', calls: pools}) + api.addTokens(tokens, bals) + return sumUnknownTokens({ api, useDefaultCoreAssets: true, resolveLP: true, }) +} - for (vault in chain) { - tvl += chain[vault]; - } - } - - return tvl; - } - - module.exports = { - methodology: - 'TVL data is pulled from the Lemuria Financial API "https://api.lemuria.finance/tvl".', - milkomeda: { - fetch - }, - fetch, - }; +module.exports = { + misrepresentedTokens: true, + methodology: + 'TVL data is pulled from the Lemuria Financial API "https://api.lemuria.finance/tvl".', + milkomeda: { + tvl + }, +}; From c274cf9940b6fcc50ffd935c8be414694dad6ec9 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Sat, 12 Aug 2023 02:24:03 +0200 Subject: [PATCH 0793/1974] track https://app.aark.digital --- projects/aark/index.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 projects/aark/index.js diff --git a/projects/aark/index.js b/projects/aark/index.js new file mode 100644 index 00000000000..2804e27bc51 --- /dev/null +++ b/projects/aark/index.js @@ -0,0 +1,13 @@ +const ADDRESSES = require('../helper/coreAssets.json') +async function tvl(_, _b, _cb, { api, }) { + + const VAULT_CONTRACT_ADDRESS = '0x7A5df878e195D09F1C0bbba702Cfdf0ac9d0a835' + return api.sumTokens({ owner: VAULT_CONTRACT_ADDRESS, tokens: [ + ADDRESSES.arbitrum.WETH, + ADDRESSES.arbitrum.USDC, + ] }) +} + +module.exports = { + arbitrum: { tvl }, +} \ No newline at end of file From b2aa3b106b81ff6e8bc6368df8a27385e60a0926 Mon Sep 17 00:00:00 2001 From: basetrade <142084947+0xbasetrade@users.noreply.github.com> Date: Sun, 13 Aug 2023 01:12:29 +0700 Subject: [PATCH 0794/1974] add basetrade.xyz (#7128) --- projects/basetrade/index.js | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 projects/basetrade/index.js diff --git a/projects/basetrade/index.js b/projects/basetrade/index.js new file mode 100644 index 00000000000..97dd0a81817 --- /dev/null +++ b/projects/basetrade/index.js @@ -0,0 +1,7 @@ +const { gmxExports } = require('../helper/gmx') + +module.exports = { + base:{ + tvl: gmxExports({ vault: '0x3a384968A2fea56d0394F9B349ab8D0c839ddc04', }) + }, +}; \ No newline at end of file From b2cf00ff3eb86c3995f44f11261b27b5d9b4d7ef Mon Sep 17 00:00:00 2001 From: define Date: Sat, 12 Aug 2023 20:49:00 +0100 Subject: [PATCH 0795/1974] huobi exclude HBTC --- projects/huobi/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/projects/huobi/index.js b/projects/huobi/index.js index 8808b331f05..603ba73d4a6 100644 --- a/projects/huobi/index.js +++ b/projects/huobi/index.js @@ -47,7 +47,10 @@ const config = { '0x42dc966b7ecc3c6cc73e7bc04862859d5bddce65', // add on 08/08/2023 (we defillama) '0xe8d8a02601f54acb6fb69537be1f1d7cc76ccd8c', // add on 08/08/2023 (we defillama) '0xf881bcb3705926cea9c598ab05a837cf41a833a9', // add on 08/08/2023 (we defillama) - ] + ], + blacklistedTokens: [ + '0x0316eb71485b0ab14103307bf65a021042c6d380', // HBTC , we already track their backed BTC (1btc wallet on the list) + ] }, polygon: { owners: ['0xd70250731a72c33bfb93016e3d1f0ca160df7e42'] From 98acfca84625fd42f36f06416664b14082edf8eb Mon Sep 17 00:00:00 2001 From: take3315 <114322307+take3315@users.noreply.github.com> Date: Mon, 14 Aug 2023 03:31:09 +0800 Subject: [PATCH 0796/1974] add yamato.fi (#7129) --- projects/yamato/index.js | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 projects/yamato/index.js diff --git a/projects/yamato/index.js b/projects/yamato/index.js new file mode 100644 index 00000000000..d66d2c6debf --- /dev/null +++ b/projects/yamato/index.js @@ -0,0 +1,30 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const sdk = require("@defillama/sdk"); + +const ETH_ADDRESS = ADDRESSES.null; +// POOL holds total system collateral (deposited ETH) +const YAMATO_CONTRACT_ADDRESS = "0x02Fe72b2E9fF717EbF3049333B184E9Cd984f257"; + +async function tvl(_, block) { + + const poolETHTvl = ( + await sdk.api.abi.call({ + target: YAMATO_CONTRACT_ADDRESS, + abi: "uint256:getStates", + block, + }) + ).output; + + return { + [ETH_ADDRESS]: poolETHTvl, + }; +} + +module.exports = { + timetravel: true, + start: 1690387200, + ethereum: { + tvl, + } + +}; From e3c3caa62b5e469f902a3f2e06cf3718b92411cc Mon Sep 17 00:00:00 2001 From: SimsalaCrypto <94809733+SimsalaCrypto@users.noreply.github.com> Date: Sun, 13 Aug 2023 21:43:32 +0200 Subject: [PATCH 0797/1974] - added Polygon TVL (#7131) * - added Polygon TVL * - added formatting --- projects/preon/index.js | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/projects/preon/index.js b/projects/preon/index.js index 6cf63e11d94..a2a8eb8f40e 100644 --- a/projects/preon/index.js +++ b/projects/preon/index.js @@ -1,17 +1,16 @@ -const { sumTokensExport } = require('../helper/unwrapLPs') +const {sumTokensExport} = require('../helper/unwrapLPs') const ADDRESSES = require('../helper/coreAssets.json') const config = { - arbitrum: { - ownerTokens: [ - [[ADDRESSES.null, '0x82aF49447D8a07e3bd95BD0d56f35241523fBab1', '0xe50fa9b3c56ffb159cb0fca61f5c9d750e8128c8'], '0xA2Ce28868A852f4B01903B5de07d4835feFe9086'], - [['0x8ffdf2de812095b1d19cb146e4c004587c0a0692', '0x93b346b6bc2548da6a1e7d98e9a421b42541425b', ], '0x8AD15574A87e30061f24977faaA2d99bC45A3169'], - ], - } + arbitrum: { + ownerTokens: [[[ADDRESSES.null, '0x82aF49447D8a07e3bd95BD0d56f35241523fBab1', '0xe50fa9b3c56ffb159cb0fca61f5c9d750e8128c8'], '0xA2Ce28868A852f4B01903B5de07d4835feFe9086'], [['0x8ffdf2de812095b1d19cb146e4c004587c0a0692', '0x93b346b6bc2548da6a1e7d98e9a421b42541425b',], '0x8AD15574A87e30061f24977faaA2d99bC45A3169'],], + }, polygon: { + ownerTokens: [[[ADDRESSES.null, '0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270', '0x6d80113e533a2C0fe82EaBD35f1875DcEA89Ea97'], '0x82CD73E9cc96cC12569D412cC2480E4d5962AfF5'],], + } } Object.keys(config).forEach(chain => { - module.exports[chain] = { - tvl: sumTokensExport(config[chain]) - } + module.exports[chain] = { + tvl: sumTokensExport(config[chain]) + } }) \ No newline at end of file From 7de6015199dce7c5b2aab202a319e68e6ad4e32e Mon Sep 17 00:00:00 2001 From: Strategic Reserve Date: Sun, 13 Aug 2023 12:46:05 -0700 Subject: [PATCH 0798/1974] Update index.js (#7134) Add Linea, Rollux --- projects/visor/index.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/projects/visor/index.js b/projects/visor/index.js index 51197f2e0ab..0162d4b9f3c 100644 --- a/projects/visor/index.js +++ b/projects/visor/index.js @@ -61,6 +61,12 @@ const HYPE_REGISTRY = { mantle: [ "0x683292172E2175bd08e3927a5e72FC301b161300", // FusionX ], + rollux: [ + "0x683292172E2175bd08e3927a5e72FC301b161300", // PegaSys + ], + linea: [ + "0xc27ddd78fc49875fe6f844b72bbf31dfbb099881", // Lynex + ], }; /* List of bad addresses added to registries that need to be excluded manually */ @@ -179,4 +185,10 @@ module.exports = { mantle: { tvl: tvlWrapper, }, + rollux: { + tvl: tvlWrapper, + }, + linea: { + tvl: tvlWrapper, + }, }; From 79ece8c00331b84e9a0ab48ee62c2b05a9b06d64 Mon Sep 17 00:00:00 2001 From: leo42 Date: Mon, 14 Aug 2023 09:30:35 +0200 Subject: [PATCH 0799/1974] Adding minted amount of cBTC on Cardano (#7132) * Adding minted amount of cBTC on Cardano * spelling fix * change decimals --- projects/anetabtc/index.js | 9 ++++++++- projects/helper/chain/cardano/blockfrost.js | 6 ++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/projects/anetabtc/index.js b/projects/anetabtc/index.js index c635356d983..354f78b0778 100644 --- a/projects/anetabtc/index.js +++ b/projects/anetabtc/index.js @@ -1,9 +1,16 @@ const { sumTokensExport } = require('../helper/sumTokens') +const { getTokensMinted } = require("../helper/chain/cardano/blockfrost"); + +const cBTC = "4190b2941d9be04acc69c39739bd5acc66d60ccab480d8e20bc87e3763425443" + +async function tvl(){ + return { bitcoin : (await getTokensMinted(cBTC)/100_000_000) } +} module.exports = { timetravel: false, cardano: { - tvl: () => ({}), + tvl, staking: sumTokensExport({ tokens: ['b34b3ea80060ace9427bda98690a73d33840e27aaa8d6edb7f0c757a634e455441'], owner: 'addr1w8p79rekquuw5kmdg4z36y9gpnm88k5huddwqluk9mjjeqgc3xmss'}) }, ergo: { diff --git a/projects/helper/chain/cardano/blockfrost.js b/projects/helper/chain/cardano/blockfrost.js index eb6d0d8b438..ba36f3b59e3 100644 --- a/projects/helper/chain/cardano/blockfrost.js +++ b/projects/helper/chain/cardano/blockfrost.js @@ -70,6 +70,11 @@ async function getTxsMetadata(utxo) { return data } +async function getTokensMinted(tokenId){ + const {data} = await axiosObj.get(`assets/${tokenId}`) + return Number(data.quantity) +} + module.exports = { getAssets, getAddressesUTXOs, @@ -77,4 +82,5 @@ module.exports = { getTxsMetadata, assetsAddresses, addressesUtxosAssetAll, + getTokensMinted, } From 4381fbdbc8a3d31b406c23c35e96a526e7ec282f Mon Sep 17 00:00:00 2001 From: ridgy <141413336+ridgyyyy@users.noreply.github.com> Date: Mon, 14 Aug 2023 09:30:48 +0200 Subject: [PATCH 0800/1974] Add Goblin Bank (#7136) * Add Goblin Bank * minor fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/helper/env.js | 2 -- projects/thegoblins/index.js | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 projects/thegoblins/index.js diff --git a/projects/helper/env.js b/projects/helper/env.js index 0e283b382d6..44bee1d2b5f 100644 --- a/projects/helper/env.js +++ b/projects/helper/env.js @@ -9,8 +9,6 @@ const DEFAULTS = { APTOS_RPC: 'https://aptos-mainnet.pontem.network', SUI_RPC: 'https://fullnode.mainnet.sui.io/', MULTIVERSX_RPC: 'https://api.multiversx.com', - PGN_RPC: 'https://rpc.publicgoods.network', - LACHAIN_RPC: 'https://rpc-mainnet.lachain.io', } const ENV_KEYS = [ diff --git a/projects/thegoblins/index.js b/projects/thegoblins/index.js new file mode 100644 index 00000000000..b8b6d32dc7e --- /dev/null +++ b/projects/thegoblins/index.js @@ -0,0 +1,16 @@ +const bank = '0xceF63C8507004a8d079daE3c83e369De0Adfa7Aa' + +async function tvl(timestamp, block, chainBlocks, { api }) { + const [bankToken, bankBalance] = await Promise.all([ + api.multiCall({ abi: 'address:baseToken', calls: [bank], }), + api.multiCall({ abi: 'uint256:getLastUpdatedModulesBalance', calls: [bank], }), + ]) + api.addTokens(bankToken, bankBalance) +} + +module.exports = { + methodology: 'Gets the total balance in the Goblin Bank from the amount allocated in the different strategies.', + arbitrum: { + tvl, + } +}; \ No newline at end of file From dd2495825bf9852083ff4ae4fb18655fddbb47bb Mon Sep 17 00:00:00 2001 From: basofinace <142125643+basofinace@users.noreply.github.com> Date: Mon, 14 Aug 2023 15:30:59 +0800 Subject: [PATCH 0801/1974] Baso (#7133) * create baso-index.js Title: Added TVL Calculation for BASO Project on Base Chain Description: - Introduced TVL calculation logic specifically for the BASO project on the Base chain. - Integrated the relevant smart contracts and data sources from the BASO project to fetch necessary data. - Updated helper methods to support and format BASO's data for proper TVL representation. * Add BASO TVL at Base Chain - Introduced TVL calculation logic specifically for the BASO project on the Base chain. - Integrated the relevant smart contracts and data sources from the BASO project to fetch necessary data. - Updated helper methods to support and format BASO's data for proper TVL representation. * Add BASO TVL at Base Chain Introduced TVL calculation logic specifically for the BASO project on the Base chain. - Integrated the relevant smart contracts and data sources from the BASO project to fetch necessary data. - Updated helper methods to support and format BASO's data for proper TVL representation. * minor fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/baso/index.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 projects/baso/index.js diff --git a/projects/baso/index.js b/projects/baso/index.js new file mode 100644 index 00000000000..2527b77e439 --- /dev/null +++ b/projects/baso/index.js @@ -0,0 +1,13 @@ +const { getUniTVL } = require('../helper/unknownTokens.js') + +module.exports = { + misrepresentedTokens: true, + base: { + tvl: getUniTVL({ + factory: '0xcEFbebF0b85B1638C19b01cE2A02C262F421B07d', + useDefaultCoreAssets: true, + hasStablePools: true, + fetchBalances: true, + }) + } +} \ No newline at end of file From d1e57696c22a4728405e032b07efe9468cfef277 Mon Sep 17 00:00:00 2001 From: Mooncake Luke <140960979+mooncakeater@users.noreply.github.com> Date: Mon, 14 Aug 2023 10:31:10 +0300 Subject: [PATCH 0802/1974] Added base market for Mooncake Fi (#7135) * Added mooncakefi linea market * Added base market for mooncake --- projects/mooncakefi/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/mooncakefi/index.js b/projects/mooncakefi/index.js index e4fb304c1ed..e20d11bdf43 100644 --- a/projects/mooncakefi/index.js +++ b/projects/mooncakefi/index.js @@ -4,4 +4,7 @@ module.exports = { linea: aaveExports("linea", undefined, undefined, [ "0x593C2d762B1CDe79101D946Ca7816eeaF17Ad744", ]), + base: aaveExports("base", undefined, undefined, [ + "0x32aB5e8ad83d4afbEe7103d7ed4A9CAF7B76F195", + ]), }; From 2162f1e7163a04b22d3738315536da9e9c86168d Mon Sep 17 00:00:00 2001 From: Kevin Cheng Date: Mon, 14 Aug 2023 00:33:34 -0700 Subject: [PATCH 0803/1974] Add Compound v3 market for Base (#7137) * Add market for Base * lint fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- .eslintrc.js | 1 + projects/compound-v3/index.js | 7 +++++-- projects/lemuriafinance.js | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index a58107f1509..73cae073d2f 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -14,6 +14,7 @@ module.exports = { "rules": { "no-case-declarations": "off", "no-unused-vars": "off", + "no-useless-escape": "warn", "no-prototype-builtins": "off", } } diff --git a/projects/compound-v3/index.js b/projects/compound-v3/index.js index 137669d1c23..0dc45280342 100644 --- a/projects/compound-v3/index.js +++ b/projects/compound-v3/index.js @@ -12,6 +12,9 @@ module.exports = compoundV3Exports({ markets: ['0xA5EDBDD9646f8dFF606d7448e414884C7d905dCA'], }, polygon: { - markets:["0xF25212E676D1F7F89Cd72fFEe66158f541246445"], + markets: ["0xF25212E676D1F7F89Cd72fFEe66158f541246445"], + }, + base: { + markets: ["0x9c4ec768c28520B50860ea7a15bd7213a9fF58bf"], } -}) \ No newline at end of file +}) diff --git a/projects/lemuriafinance.js b/projects/lemuriafinance.js index 75745d2532e..76f5306adb4 100644 --- a/projects/lemuriafinance.js +++ b/projects/lemuriafinance.js @@ -4,7 +4,7 @@ const { sumUnknownTokens } = require('./helper/unknownTokens') async function tvl(_, _b, _cb, { api, }) { let data = await getConfig('lemuria', 'https://raw.githubusercontent.com/lemuriafinance/lemuria-frontend-pub/main/src/features/configure/vault/milkomeda_pools.js') - data = JSON.parse(data.slice(data.indexOf('[')).replaceAll('\'', '"').replaceAll(/\n\s+(\w+)/g, '"$1"').split('\n').map(i => i.replaceAll(/\s+\/\/.*/g, '').trim()).join('').replaceAll(';', '').replaceAll(/\,(\]|\})/g, '$1')) + data = JSON.parse(data.slice(data.indexOf('[')).replaceAll('\'', '"').replaceAll(/\n\s+(\w+)/g, '"$1"').split('\n').map(i => i.replaceAll(/\s+\/\/.*/g, '').trim()).join('').replaceAll(';', '').replaceAll(/,(\]|\})/g, '$1')) const pools = data.map(i => i.earnContractAddress) const tokens = await api.multiCall({ abi: 'address:want', calls: pools}) const bals = await api.multiCall({ abi: 'uint256:balance', calls: pools}) From e92add487d43a8637fd032c1279631a7ad89ee1f Mon Sep 17 00:00:00 2001 From: PRDT Finance <87976805+PRDTfinance@users.noreply.github.com> Date: Mon, 14 Aug 2023 09:44:48 +0200 Subject: [PATCH 0804/1974] Update index.js (#7138) Added new classic contracts --- projects/prdt/index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/projects/prdt/index.js b/projects/prdt/index.js index 2a7560fb5ed..f9c7471af6c 100644 --- a/projects/prdt/index.js +++ b/projects/prdt/index.js @@ -11,6 +11,7 @@ const config = { predictionBTC: "0x3Df33217F0f82c99fF3ff448512F22cEf39CC208", predictionPRO: "0x599974D3f2948b50545Fb5aa77C9e0bddc230ADE", predictionPROV2: "0x22dB94d719659d7861612E0f43EE28C9FF9909C7", + predictionclassicV3: "0x00199E444155f6a06d74CF36315419d39b874f5c", }), }, polygon: { @@ -19,6 +20,7 @@ const config = { predictionMATIC: "0x59e0aD27d0F58A15128051cAA1D2917aA71AB864", predictionPRO: "0x764C3Ea13e7457261E5C1AaD597F281f3e738240", predictionPROV2: "0x8251E5EBc2d2C20f6a116144800D569FAF75d746", + predictionclassicv3: "0x9f9564BE7b566dfE4B091a83a591752102aF3F33", }), }, }; From 856666ad9895a8c75459720c13c513da7e588068 Mon Sep 17 00:00:00 2001 From: ThroneDEX <141527512+ThroneDEX@users.noreply.github.com> Date: Mon, 14 Aug 2023 13:15:17 +0530 Subject: [PATCH 0805/1974] Added Throne-V3 (#7139) --- projects/throne-v3/index.js | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 projects/throne-v3/index.js diff --git a/projects/throne-v3/index.js b/projects/throne-v3/index.js new file mode 100644 index 00000000000..5f31b298739 --- /dev/null +++ b/projects/throne-v3/index.js @@ -0,0 +1,8 @@ +const { uniV3Export } = require("../helper/uniswapV3"); + +module.exports = uniV3Export({ + base: { + factory: "0xe8839bf8175812691c6578c0fc80e721bc3e00fb", + fromBlock: 2146977, + }, +}); From 3f9b078a97d30a5fb1b5bbdcc2e1453e255ea3ae Mon Sep 17 00:00:00 2001 From: define Date: Mon, 14 Aug 2023 10:14:14 +0100 Subject: [PATCH 0806/1974] rename hallmark paraspace --- projects/paraspace/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/paraspace/index.js b/projects/paraspace/index.js index 64d008693b5..aef0be50d32 100644 --- a/projects/paraspace/index.js +++ b/projects/paraspace/index.js @@ -3,7 +3,7 @@ const { tvl, borrowed } = require("./helper/index"); module.exports = { hallmarks: [ [Math.floor(new Date('2023-03-17') / 1e3), 'Whitehat hack'], - [Math.floor(new Date('2023-05-10') / 1e3), 'CEO drama'], + [Math.floor(new Date('2023-05-10') / 1e3), 'Team Dispute'], ], methodology: `TVL includes ERC-20 and ERC-721 tokens that have been supplied as well as ERC-20 tokens that are supplied for lending.`, ethereum: { From 6f58df2345a76981eae43c3d08f80dd49f247132 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 14 Aug 2023 11:16:30 +0200 Subject: [PATCH 0807/1974] minor refactor --- projects/cochilli/index.js | 3 ++- projects/fx-Protocol/index.js | 3 ++- projects/lsdFil/index.js | 3 ++- projects/navi/index.js | 3 ++- projects/overnight-usdPlus/index.js | 2 +- projects/synapse/config.js | 2 +- projects/treasury/giveth.js | 10 +++++----- projects/treasury/revoke.js | 14 +++++++------- projects/vivaleva/index.js | 21 +++++++++++---------- 9 files changed, 33 insertions(+), 28 deletions(-) diff --git a/projects/cochilli/index.js b/projects/cochilli/index.js index 71eb4b5f81f..cbd91810366 100644 --- a/projects/cochilli/index.js +++ b/projects/cochilli/index.js @@ -1,7 +1,8 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokensExport } = require('../helper/unwrapLPs'); const owner = "0x8D5b64b8D8904E4aEc79F10468F347534D2A1b79"; // vault address -const tokens = ["0xd9aAEc86B65D86f6A7B5B1b0c42FFA531710b6CA"]; // USDC +const tokens = [ADDRESSES.base.USDbC]; // USDC module.exports = { base: { diff --git a/projects/fx-Protocol/index.js b/projects/fx-Protocol/index.js index 63bf76d99c3..ed10b8a1ba7 100644 --- a/projects/fx-Protocol/index.js +++ b/projects/fx-Protocol/index.js @@ -1,8 +1,9 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const { default: BigNumber } = require("bignumber.js"); const stETHTreasury = "0x0e5CAA5c889Bdf053c9A76395f62267E653AFbb0"; -const stETH = "0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84"; +const stETH = ADDRESSES.ethereum.STETH; async function tvl(timestamp, block, _, { api }) { let balances = {}; diff --git a/projects/lsdFil/index.js b/projects/lsdFil/index.js index d3d8de886af..e5819712f44 100644 --- a/projects/lsdFil/index.js +++ b/projects/lsdFil/index.js @@ -1,4 +1,5 @@ -const MINT_TOKEN_CONTRACT = '0xcE5805CF6C84F71D2897f632E0Aa60d2430cCd2A'; +const ADDRESSES = require('../helper/coreAssets.json') +const MINT_TOKEN_CONTRACT = ADDRESSES.filecoin.WFIL; const MINT_CLUB_BOND_CONTRACT = '0x7187b3B1314375909B775d72fB7214Cb71a7D907'; diff --git a/projects/navi/index.js b/projects/navi/index.js index 7acf22c3d17..35fee63bdd8 100644 --- a/projects/navi/index.js +++ b/projects/navi/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sui = require("../helper/chain/sui") const reserves = [ @@ -6,7 +7,7 @@ const reserves = [ ] const decimalShift = { - '0x5d4b302506645c37ff133b98c4b50a5ae14841659738d6d733d59d0d217a93bf::coin::COIN': -3, // USDC + [ADDRESSES.sui.USDC]: -3, // USDC } diff --git a/projects/overnight-usdPlus/index.js b/projects/overnight-usdPlus/index.js index a1e367115e8..8b93b94b726 100644 --- a/projects/overnight-usdPlus/index.js +++ b/projects/overnight-usdPlus/index.js @@ -16,7 +16,7 @@ const assets = { optimism: ADDRESSES.optimism.USDC, //USDC arbitrum: ADDRESSES.arbitrum.USDC, //USDC era: ADDRESSES.era.USDC, - base: "0xd9aaec86b65d86f6a7b5b1b0c42ffa531710b6ca" //USDC + base: ADDRESSES.base.USDbC //USDC } const abi = "uint256:totalNetAssets" diff --git a/projects/synapse/config.js b/projects/synapse/config.js index 1900b561fa2..e16d4ef4dac 100644 --- a/projects/synapse/config.js +++ b/projects/synapse/config.js @@ -429,7 +429,7 @@ module.exports = { pool: '0x6223bD82010E2fB69F329933De20897e7a4C225f', tokens: [ // "0xb554A55358fF0382Fb21F0a478C3546d1106Be8c", // nETH - "0x4200000000000000000000000000000000000006", //base WETH + ADDRESSES.optimism.WETH_1, //base WETH ] }, ] diff --git a/projects/treasury/giveth.js b/projects/treasury/giveth.js index c7334ea4b45..83ab582d266 100644 --- a/projects/treasury/giveth.js +++ b/projects/treasury/giveth.js @@ -30,8 +30,8 @@ module.exports = treasuryExports({ "0xC18360217D8F7Ab5e7c516566761Ea12Ce7F9D72", //ens "0x2d94AA3e47d9D5024503Ca8491fcE9A2fB4DA198", //bank "0xDe30da39c46104798bB5aA3fe8B9e0e1F348163F", //gtc - "0x0bc529c00C6401aEF6D220BE8C6Ea1667F6Ad93e", //yfi - "0x7D1AfA7B718fb893dB30A3aBc0Cfc608AaCfeBB0", //matic + ADDRESSES.ethereum.YFI, //yfi + ADDRESSES.ethereum.MATIC, //matic "0xDd1Ad9A21Ce722C151A836373baBe42c868cE9a4", //ubi ], owners: [treasury], @@ -57,11 +57,11 @@ module.exports = treasuryExports({ tokens: [ nullAddress, "0x71850b7E9Ee3f13Ab46d67167341E4bDc905Eef9", //hny - "0xDDAfbb505ad214D7b80b1f830fcCc89B60fb7A83", //usdc + ADDRESSES.xdai.USDC, //usdc "0x21a42669643f45Bc0e086b8Fc2ed70c23D67509d", //fox "0x83FF60E2f93F8eDD0637Ef669C69D5Fb4f64cA8E", //bright - "0x6A023CCd1ff6F2045C3309768eAd9E68F978f6e1", //weth - "0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d", //wxdai + ADDRESSES.xdai.WETH, //weth + ADDRESSES.xdai.WXDAI, //wxdai "0x177127622c4A00F3d409B75571e12cB3c8973d3c", //cow ], owners: [treasury], diff --git a/projects/treasury/revoke.js b/projects/treasury/revoke.js index 1fae8c0fcc9..a20d7fa5536 100644 --- a/projects/treasury/revoke.js +++ b/projects/treasury/revoke.js @@ -40,7 +40,7 @@ module.exports = treasuryExports({ bsc: { tokens: [ nullAddress, - "0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56", //busd + ADDRESSES.bsc.BUSD, //busd "0xF68C9Df95a18B2A5a5fa1124d79EEEffBaD0B6Fa", //any ], owners: [treasury], @@ -48,9 +48,9 @@ module.exports = treasuryExports({ polygon: { tokens: [ nullAddress, - "0xc2132D05D31c914a87C6611C10748AEb04B58e8F", //usdt - "0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063", //dai - "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174", //usdc + ADDRESSES.polygon.USDT, //usdt + ADDRESSES.polygon.DAI, //dai + ADDRESSES.polygon.USDC, //usdc "0x8dF3aad3a84da6b69A4DA8aeC3eA40d9091B2Ac4", //ammatic ], owners: [treasury], @@ -58,9 +58,9 @@ module.exports = treasuryExports({ arbitrum: { tokens: [ nullAddress, - "0x912CE59144191C1204E64559FE8253a0e49E6548", //arb + ADDRESSES.arbitrum.ARB, //arb "0x539bdE0d7Dbd336b79148AA742883198BBF60342", //magic - "0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8", //usdc + ADDRESSES.arbitrum.USDC, //usdc "0x1F52145666C862eD3E2f1Da213d479E61b2892af", //fuc ], owners: [treasury], @@ -68,7 +68,7 @@ module.exports = treasuryExports({ arbitrum_nova: { tokens: [ nullAddress, - "0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1", //dai + ADDRESSES.optimism.DAI, //dai ], owners: [treasury], }, diff --git a/projects/vivaleva/index.js b/projects/vivaleva/index.js index 018dc603349..ea3fec09fa2 100644 --- a/projects/vivaleva/index.js +++ b/projects/vivaleva/index.js @@ -1,14 +1,15 @@ +const ADDRESSES = require('../helper/coreAssets.json') const vaults = [ { symbol: "ibETH", decimals: 18, - baseTokenAddress: "0x5aea5775959fbc2557cc8789bc1bf90a239d9a91", + baseTokenAddress: ADDRESSES.era.WETH, address: "0x23FDd6487a17abB8360E8Da8b1B370C94ee94Cc2", }, { symbol: "ibUSDC", decimals: 6, - baseTokenAddress: "0x3355df6D4c9C3035724Fd0e3914dE96A5a83aaf4", + baseTokenAddress: ADDRESSES.era.USDC, address: "0x0755DA5D9e9A722A9e5cc4bb83742387ae2990a5", }, ]; @@ -16,29 +17,29 @@ const syncswapWorkers = [ { name: "ETH-USDC Syncswap Farm", address: "0x39356ed5dC2F7Ea897296e07E97b59Af9C8153Ec", - farmingTokenAddress: "0x5aea5775959fbc2557cc8789bc1bf90a239d9a91", - baseTokenAddress: "0x3355df6D4c9C3035724Fd0e3914dE96A5a83aaf4", + farmingTokenAddress: ADDRESSES.era.WETH, + baseTokenAddress: ADDRESSES.era.USDC, lpToken: "0x80115c708E12eDd42E504c1cD52Aea96C547c05c", }, { name: "USDC-ETH Syncswap Farm", address: "0x3A613EFAe4a6A6447A9D784E398730811a57af6e", - farmingTokenAddress: "0x3355df6D4c9C3035724Fd0e3914dE96A5a83aaf4", - baseTokenAddress: "0x5aea5775959fbc2557cc8789bc1bf90a239d9a91", + farmingTokenAddress: ADDRESSES.era.USDC, + baseTokenAddress: ADDRESSES.era.WETH, lpToken: "0x80115c708E12eDd42E504c1cD52Aea96C547c05c", }, { name: "USDT-ETH Syncswap Farm", address: "0x95C78e21Beb54314fe5A4571E7361f6c6A144B2f", - farmingTokenAddress: "0x493257fd37edb34451f62edf8d2a0c418852ba4c", - baseTokenAddress: "0x5aea5775959fbc2557cc8789bc1bf90a239d9a91", + farmingTokenAddress: ADDRESSES.era.USDT, + baseTokenAddress: ADDRESSES.era.WETH, lpToken: "0xd3D91634Cf4C04aD1B76cE2c06F7385A897F54D3", }, { name: "USDT-USDC Syncswap Farm", address: "0xfbF4BcD3266Af20B72dc484F6D7Dc13855885ba0", - farmingTokenAddress: "0x493257fd37edb34451f62edf8d2a0c418852ba4c", - baseTokenAddress: "0x3355df6D4c9C3035724Fd0e3914dE96A5a83aaf4", + farmingTokenAddress: ADDRESSES.era.USDT, + baseTokenAddress: ADDRESSES.era.USDC, lpToken: "0x0E595bfcAfb552F83E25d24e8a383F88c1Ab48A4", }, ]; From 3d49776290fb92bc32b5be169d74daacd85b8327 Mon Sep 17 00:00:00 2001 From: Vojtch Date: Mon, 14 Aug 2023 11:24:57 +0200 Subject: [PATCH 0808/1974] add pwndao (#7121) * add pwndao * minor fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/pwn/index.js | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 projects/pwn/index.js diff --git a/projects/pwn/index.js b/projects/pwn/index.js new file mode 100644 index 00000000000..fccdba65dba --- /dev/null +++ b/projects/pwn/index.js @@ -0,0 +1,33 @@ +const { sumTokensExport } = require("../helper/unwrapLPs"); + +const PWN_ALPHA_MAINNET = "0x45DB28b2d4878Ad124c037d4558AcF5Db3bBa6A5"; +const PWN_BETA_MAINNET = "0xb98eFE56deCCeb1BeC9fAEeAF62500deb0953474"; +const PWN_BETA_POLYGON = "0xaF0d978275a2e7e3109F8C6307Ffd281774C623E"; +const PWN_BUNDLER_MAINNET = "0x19e3293196aee99BB3080f28B9D3b4ea7F232b8d"; +const PWN_BUNDLER_POLYGON = "0xe52405604bF644349f57b36Ca6E85cf095faB8dA"; +const PWN_V1_SIMPLE_LOAN = "0x50160ff9c19fbE2B5643449e1A321cAc15af2b2C"; + +module.exports = { + misrepresentedTokens: true, + methodology: `Sums up all the tokens deposited in the PWN Protocol. NFTs are resolved to their floor price using Chainlink price feeds.`, + ethereum: { + tvl: sumTokensExport({ + owners: [ + PWN_ALPHA_MAINNET, + PWN_BETA_MAINNET, + PWN_BUNDLER_MAINNET, + PWN_V1_SIMPLE_LOAN, + ], + resolveNFTs: true, + resolveArtBlocks: true, + }), + }, + // resolveNFTs: true is currently unsupported on Polygon + // https://discord.com/channels/823822164956151810/823885412425793587/1139362819012304956 + polygon: { + tvl: sumTokensExport({ + owners: [PWN_BETA_POLYGON, PWN_BUNDLER_POLYGON, PWN_V1_SIMPLE_LOAN], + fetchCoValentTokens: true, + }), + }, +}; From d7c90748fcd6e64483e98cf0e221c7333387cd68 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 14 Aug 2023 11:31:03 +0200 Subject: [PATCH 0809/1974] zunami was hacked --- projects/zunami/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/zunami/index.js b/projects/zunami/index.js index bf9139c3d41..f4f7125d207 100644 --- a/projects/zunami/index.js +++ b/projects/zunami/index.js @@ -18,5 +18,8 @@ module.exports = { ethereum: { tvl: ethTvl, }, + hallmarks: [ + [Math.floor(new Date('2023-08-13')/1e3), 'Project was hacked for $2M'], + ], methodology: "Total value of digital assets that are locked in Zunami Omnipools", }; \ No newline at end of file From adc7c8247850a0e74347a3d38d5d9710a372c844 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 14 Aug 2023 11:40:32 +0200 Subject: [PATCH 0810/1974] teahouse: track polygon --- projects/teahouse-v3/index.js | 2 +- projects/teahouse/index.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/teahouse-v3/index.js b/projects/teahouse-v3/index.js index 25f35be4e02..92ef625a682 100644 --- a/projects/teahouse-v3/index.js +++ b/projects/teahouse-v3/index.js @@ -17,7 +17,7 @@ async function getVaultContractsAddress(chain) { return plAddress; } -const chains = ["ethereum", "optimism", "arbitrum"]; +const chains = ["ethereum", "optimism", "arbitrum", 'polygon']; chains.forEach((chain) => { module.exports[chain] = { diff --git a/projects/teahouse/index.js b/projects/teahouse/index.js index 62853ef81d4..518812cd3a6 100644 --- a/projects/teahouse/index.js +++ b/projects/teahouse/index.js @@ -18,7 +18,7 @@ async function getVaultContractsAddress(chain) { } -const chains = ["ethereum", "optimism", "arbitrum"]; +const chains = ["ethereum", "optimism", "arbitrum", 'polygon']; chains.forEach((chain) => { module.exports[chain] = { From a5e3c0c823da8b008282df61af01350d6a5de1cc Mon Sep 17 00:00:00 2001 From: TiTi Protocol <82432369+titimoney@users.noreply.github.com> Date: Mon, 14 Aug 2023 17:48:16 +0800 Subject: [PATCH 0811/1974] update Base network (#7143) --- projects/titi-finance/index.js | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/projects/titi-finance/index.js b/projects/titi-finance/index.js index 4642e140c61..9822cfa2648 100644 --- a/projects/titi-finance/index.js +++ b/projects/titi-finance/index.js @@ -7,13 +7,21 @@ const ethTiTiStaking = "0x5390Dbf4958F21BB317C72744c110977F4c03311"; // TiTi const eraTiTiToken = "0x4EBfb78C4780C304dff7de518db630b67e3F044b"; // TiTi Token Era const eraTiTiStaking = "0x1B05972C2e46288201E0432262bd8e925d4fCF94"; // TiTi Staking Era +const baseTiTiToken = "0x57bec9e5b5f2e3c4c925949f516527e8fbc83cf2"; // TiTi Token Era +const baseTiTiStaking = "0xbc8007792690621a3217196217337129161Db176"; // TiTi Staking Era + const ethereumLPs = ['0xca4AEf99b3567Dbb631DF0DCd51D446DB7eb63e5'] const eraLPs = [ "0x574E2E833A010997840f368edF6542d8950c2788", "0x228D400F196760432BD8bcE74Fa1e6580aF4BF03", "0xd4cb4f38de684122Af261ee822Dc1437601e5424", "0x512f5a62eE69013643f37C12fd8Be391Db7b4550", + "0xEDbC01C6eF70Ef3c1448d543A2Ed438a9d564d93", + "0x64FD534e47aF3B234f7476A7C26B611c05d475a9", + "0x10095115B58F5562A16476435363bf56E7dBAD20" ] +const baseLPs = ['0x19bdf948b8E72d0Fa61156f2119CE0dfb7D40D3b'] + const lpReservesAbi = 'function getReserves() view returns (uint _reserve0, uint _reserve1)' module.exports = { @@ -38,8 +46,20 @@ module.exports = { owners: [ "0xA690DC59d6afC12d6789f46fc211DdD27f1C7f7c", "0x2cbCE1EFC624138326877C386692E889D8C7c834", - "0xDc8440CdC50bEe0936bB49De82e80c2439dCEc42" + "0xDc8440CdC50bEe0936bB49De82e80c2439dCEc42", + "0x68524201E392AEB91d256fa67a3A2b2cdCdcECf9", + "0x959A0715698540f03FCBb2A54b4C98a8032Da3a5", + "0xf65279AC29f92931F0EDED9dD4bb61A176b236Ca" ], tokens: eraLPs, lps: eraLPs, useDefaultCoreAssets: true, abis: { getReservesABI: lpReservesAbi }, resolveLp: true, restrictTokenRatio: 1000, }), }, + base: { + tvl: sumTokensExport({ + owners: [ + "0x159089d1b385572Fdc2a42Bf7664309f6eEf5Edc", // MAMMSwapPair + ], tokens: [ADDRESSES.base.USDbC] + }), + staking: sumTokensExport({ owner: baseTiTiStaking, tokens: [baseTiTiToken], lps: baseLPs, useDefaultCoreAssets: true, restrictTokenRatio: 5000 }), + pool2: sumTokensExport({ owner: '0xF58EC1aB2b0128286DeA0A2B31BfFbeE4EFE4b75', tokens: ['0x19bdf948b8E72d0Fa61156f2119CE0dfb7D40D3b'], lps: baseLPs, useDefaultCoreAssets: true, restrictTokenRatio: 1000, resolveLp: true, }), + }, } \ No newline at end of file From 093e9a5c65cb3f084240fcadc4c7aa71580fac17 Mon Sep 17 00:00:00 2001 From: veljkoTNFT <92369096+veljkoTNFT@users.noreply.github.com> Date: Mon, 14 Aug 2023 11:49:10 +0200 Subject: [PATCH 0812/1974] Update tangible liquidity fetching (#6992) * update tangible liquidity fetch * tangible: code refactor --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/tangible/abi.js | 1 + projects/tangible/index.js | 201 +++++++++++++++++++++++-------------- 2 files changed, 126 insertions(+), 76 deletions(-) diff --git a/projects/tangible/abi.js b/projects/tangible/abi.js index 01f5e4cfdb3..01b3bb957b4 100644 --- a/projects/tangible/abi.js +++ b/projects/tangible/abi.js @@ -7,4 +7,5 @@ module.exports = { getTokenByIndex: "function tokenByIndex(uint256 index) view returns (uint256)", getTnftCustody: "function tnftCustody(uint256) view returns (bool)", getItemPriceBatchTokenIds: "function itemPriceBatchTokenIds(address nft, address paymentUSDToken, uint256[] tokenIds) view returns (uint256[] weSellAt, uint256[] weSellAtStock, uint256[] weBuyAt, uint256[] weBuyAtStock, uint256[] lockedAmount)", + getPair: "function getPair(address _pair, address _account) view returns (tuple(address pair_address, string symbol, string name, uint256 decimals, bool stable, uint256 total_supply, address token0, string token0_symbol, uint256 token0_decimals, uint256 reserve0, uint256 claimable0, address token1, string token1_symbol, uint256 token1_decimals, uint256 reserve1, uint256 claimable1, address gauge, uint256 gauge_total_supply, address fee, address bribe, uint256 emissions, address emissions_token, uint256 emissions_token_decimals, uint256 account_lp_balance, uint256 account_token0_balance, uint256 account_token1_balance, uint256 account_gauge_balance, uint256 account_gauge_earned) _pairInfo)", } \ No newline at end of file diff --git a/projects/tangible/index.js b/projects/tangible/index.js index 2b5411090f5..2649a55e75d 100644 --- a/projects/tangible/index.js +++ b/projects/tangible/index.js @@ -1,110 +1,159 @@ -const sdk = require('@defillama/sdk'); -const { getParamCalls } = require('../helper/utils') +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require('../helper/unwrapLPs') +const { getConfig } = require('../helper/cache') -const {apGetAddress, getPriceManager, getCategories, - getTreasuryValue, getTotalSupply, getTokenByIndex, getTnftCustody, - getItemPriceBatchTokenIds} = require("./abi.js"); +// doc: https://docs.tangible.store/real-usd/real-usd-v3-contracts-and-addresses +const TNGBL = '0x49e6A20f1BBdfEeC2a8222E052000BbB14EE6007'.toLowerCase() +const USDR = '0x40379a439d4f6795b6fc9aa5687db461677a2dba'.toLowerCase() + +const { apGetAddress, getPriceManager, getCategories, + getTotalSupply, getTokenByIndex, getTnftCustody, + getItemPriceBatchTokenIds, getPair } = require("./abi.js"); const ADDRESS_PROVIDER_ADDRESS = "0xE95BCf65478d6ba44C5F57740CfA50EA443619eA"; const FACTORY_ADDRESS = "0xB0E54b88BB0043A938563fe8A77F4ddE2eB0cFc0"; -const chain = 'polygon' -async function tvl(_, _b, {polygon: block}) { - //get all needed addresses - const priceManagerAddress = (await sdk.api.abi.call({ - abi: getPriceManager, - target: FACTORY_ADDRESS, - chain, block, - })).output +const insuranceConfig = { + ethereum: { + owner: '0x5d35A37E5842F6b3072893A3f7Bf0e1d1FF80179', + tokens: [ADDRESSES.null], + }, + polygon: { + owner: '0xD1758fbABAE91c805BE76D56548A584EF68B81f0', + tokens: [ADDRESSES.polygon.DAI, ADDRESSES.polygon.USDC, ADDRESSES.polygon.USDT, ADDRESSES.null, ADDRESSES.polygon.WETH, ADDRESSES.polygon.WMATIC], + }, + optimism: { + owner: '0x7f922242d919feF0da0e40e3Cb4B7f7D3c97a63e', + tokens: [ADDRESSES.null, ADDRESSES.optimism.OP, ADDRESSES.optimism.USDC,], + }, +} - // we itterate through these to get prices - const tnftContractsAddresses = (await sdk.api.abi.call({ - abi: getCategories, - target: FACTORY_ADDRESS, - chain, block, - })).output +async function tvl(_, _b, _cb, { api }) { + await Promise.all([ + treasuryTvl, + insuranceTvl, + rwaTVL, + tangiblePOL + ].map(fn => fn(api))) +} +async function treasuryTvl(api) { //treasury address to get total value in treasury - const usdrTreasuryAddress = (await sdk.api.abi.call({ + const usdrTreasuryAddress = await api.call({ abi: apGetAddress, target: ADDRESS_PROVIDER_ADDRESS, params: ["0xc83e4fd410f80be983b083c99898391186b0893751a26a9a1e5fdcb9d4129701"],//keccak of USDRTreasury - chain, block, - })).output + }) + await api.sumTokens({ owner: usdrTreasuryAddress, tokens: [ADDRESSES.polygon.DAI] }) +} + +async function insuranceTvl(api) { + await unwrapBalancerToken(api) + return api.sumTokens(insuranceConfig.polygon) +} + +async function rwaTVL(api) { + //get all needed addresses + const priceManagerAddress = await api.call({ abi: getPriceManager, target: FACTORY_ADDRESS, }) + + // we itterate through these to get prices + const tnftContractsAddresses = await api.call({ abi: getCategories, target: FACTORY_ADDRESS, }) //underlying to get decimals - const underlyingAddress = (await sdk.api.abi.call({ + const underlyingAddress = await api.call({ abi: apGetAddress, target: ADDRESS_PROVIDER_ADDRESS, params: ["0xadbe96ac53cb4ca392e9ee5a7e23c7d7c8450cb015ceaad4d4677fae1c0bb1a4"], //keccak of underlying - chain, block, - })).output - - //first get total treasury value - // it is in underlyting token, and that is currently DAI 18 decimals - const totalTreasuryValue = (await sdk.api.abi.call({ - abi: getTreasuryValue, - target: usdrTreasuryAddress, - chain, block, - })).output - - //we reduce by these because these amounts are contained in value of tnfts - let tvl = totalTreasuryValue.total - - totalTreasuryValue.rwa - - totalTreasuryValue.rwaEscrow - - totalTreasuryValue.rwaVaults + }) //now we fetch value of all tnfts ever minted await Promise.all(tnftContractsAddresses.map(async (tnft) => { - - //fetch totalSupply - const totalSupply = (await sdk.api.abi.call({ - abi: getTotalSupply, - target: tnft, - chain, block, - })).output + //fetch all token ids let ids = []; - const tokenCalls = getParamCalls(totalSupply) - const { output: tokenIds } = await sdk.api.abi.multiCall({ - target: tnft, - abi: getTokenByIndex, - calls: tokenCalls, - chain, block, - }) - const custodyCalls = tokenIds.map(i => ({ params: i.output})) - const { output: inTangibleCustody } = await sdk.api.abi.multiCall({ - target: tnft, - abi: getTnftCustody, - calls: custodyCalls, - chain, block, - }) - - inTangibleCustody.forEach(({ input: { params: [tokenId] }, output }) => { - if (output) ids.push(tokenId) + const tokenIds = await api.fetchList({ target: tnft, itemAbi: getTokenByIndex, lengthAbi: getTotalSupply, }) + if (!tokenIds.length) return; + const inTangibleCustody = await api.multiCall({ target: tnft, abi: getTnftCustody, calls: tokenIds, }) + inTangibleCustody.forEach((v, i) => { + if (v) ids.push(tokenIds[i]) }) // now fetch all prices - const prices = (await sdk.api.abi.call({ + const prices = await api.call({ abi: getItemPriceBatchTokenIds, target: priceManagerAddress, params: [tnft, underlyingAddress, ids], - chain, block, - })).output + }) - for(let i = 0; i < prices.weSellAt.length; i++) - tvl += +prices.weSellAt[i] + +prices.lockedAmount[i] - + for (let i = 0; i < prices.weSellAt.length; i++) { + api.add(underlyingAddress, prices.weSellAt[i]) // how can get the rwa value instead of the price you are willing to sell at? + api.add(underlyingAddress, prices.lockedAmount[i]) // what is this amount? + } })) - return { - tether: tvl/1e18 - } +} + +async function tangiblePOL(api) { + + //pearl pair api address + const pearlPairApi = await api.call({ + abi: apGetAddress, + target: ADDRESS_PROVIDER_ADDRESS, + params: ["0xd1e0c1a56a62f2e6553b45bde148c89c51a01f766c23f4bb2c612bd2c822f711"],//keccak of paerl api address + }) + + const { data } = await getConfig('tangible', "https://api.pearl.exchange/api/v15/pools"); + const pools = data.filter( + (pool) => + (["DAI", "USDC", "USDT"].includes(pool.token0.symbol) && + pool.token1.symbol === "USDR") || + (["DAI", "USDC", "USDT"].includes(pool.token1.symbol) && + pool.token0.symbol === "USDR"), + ).map(i => i.address) + + const multisigAddress = "0x100fCC635acf0c22dCdceF49DD93cA94E55F0c71" + const [lpBals, tokens0, tokens1, totalSupplies, reserves] = await Promise.all([ + api.multiCall({ abi: getPair, target: pearlPairApi, calls: pools.map(p => ({ params: [p, multisigAddress]})) }), + api.multiCall({ abi: 'address:token0', calls: pools }), + api.multiCall({ abi: 'address:token1', calls: pools }), + api.multiCall({ abi: 'uint256:totalSupply', calls: pools }), + api.multiCall({ abi: "function getReserves() view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast)", calls: pools }), + ]) + + const blacklist = [USDR, TNGBL] + lpBals.forEach((lpBal, i) => { + const ratio = lpBal.account_gauge_balance / totalSupplies[i] + if (!blacklist.includes(tokens0[i].toLowerCase())) + api.add(tokens0[i], reserves[i]._reserve0 * ratio) + + if (!blacklist.includes(tokens1[i].toLowerCase())) + api.add(tokens1[i], reserves[i]._reserve1 * ratio) + + }) } module.exports = { misrepresentedTokens: true, - polygon: { - tvl, - } -}; \ No newline at end of file + polygon: { tvl, }, + ethereum: { tvl: sumTokensExport(insuranceConfig.ethereum) }, + optimism: { tvl: sumTokensExport(insuranceConfig.optimism) }, +} + +async function unwrapBalancerToken(api) { + const owner = insuranceConfig.polygon.owner + const gauge = '0x07222e30b751c1ab4a730745afe19810cfd762c0' + const balancerToken = '0x9f9f548354b7c66dc9a9f3373077d86aaaccf8f2' + const [lpSupply, lpTokens] = await api.batchCall([ + { abi: 'erc20:totalSupply', target: balancerToken }, + { abi: 'erc20:balanceOf', target: gauge, params: owner }, + ]) + const ratio = lpTokens / lpSupply + + const poolId = await api.call({ abi: 'function getPoolId() view returns (bytes32)', target: balancerToken }) + const vault = await api.call({ abi: 'address:getVault', target: balancerToken }) + const [tokens, bals] = await api.call({ abi: 'function getPoolTokens(bytes32) view returns (address[], uint256[],uint256)', target: vault, params: poolId }) + tokens.forEach((v, i) => { + if (v.toLowerCase() === TNGBL) return; + api.add(v, bals[i] * ratio) + }) +} \ No newline at end of file From 76545f5c5021ad076fd21fcf89cacddc388965fd Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 14 Aug 2023 15:19:56 +0530 Subject: [PATCH 0813/1974] Angle (#7141) * feat: add transmuter tvl * feat: add transmuter and treasury * refactor angle - exclude agEUR from tvl --------- Co-authored-by: Baptiste Guerin --- projects/angle/addresses.js | 116 ++++++++++++++++++++++++++++++++++++ projects/angle/index.js | 49 ++++++++++----- 2 files changed, 151 insertions(+), 14 deletions(-) create mode 100644 projects/angle/addresses.js diff --git a/projects/angle/addresses.js b/projects/angle/addresses.js new file mode 100644 index 00000000000..80d5cb3b515 --- /dev/null +++ b/projects/angle/addresses.js @@ -0,0 +1,116 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const TreasuryTokenAddresses = { + governor: { + arbitrum: [ + ADDRESSES.arbitrum.USDC, + '0xe4DDDfe67E7164b0FE14E218d80dC4C08eDC01cB', + // '0xFA5Ed56A203466CbBC2430a43c66b9D8723528E7', // agEUR + ], + ethereum: [ + // '0x1a7e4e63778B4f12a199C062f3eFdD288afCBce8', // agEUR + '0x1aBaEA1f7C830bD89Acc67eC4af516284b1bC33c', + ADDRESSES.ethereum.CRV, + '0xc00e94Cb662C3520282E6f5717214004A7f26888', + ADDRESSES.ethereum.CVX, + '0x875773784Af8135eA0ef43b5a374AaD105c5D39e', + '0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490', + '0x3432B6A60D23Ca0dFCa7761B7ab56459D9C964D0', + '0x73968b9a57c6E53d41345FD57a6E6ae27d6CDB2F', + '0x4da27a545c0c5B758a6BA100e3a049001de870f5', + ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.DAI, + '0xBa3436Fd341F2C8A928452Db3C5A3670d1d5Cc73', + '0x3175Df0976dFA876431C2E9eE6Bc45b65d3473CC', + '0xD1b5651E55D4CeeD36251c61c50C889B36F6abB5', + '0x402F878BDd1f5C66FdAF0fabaBcF74741B68ac36', + '0x2F123cF3F37CE3328CC9B5b8415f9EC5109b45e7', + ], + optimism: [ + '0x3c8b650257cfb5f272f799f5e2b4e65093a11a05', + // '0x9485aca5bbBE1667AD97c7fE7C4531a624C8b1ED', // agEUR + ], + polygon: [ + ADDRESSES.polygon.USDC, + // '0xE0B52e49357Fd4DAf2c15e02058DCE6BC0057db4' + ], + avax: [ + // '0xAEC8318a9a59bAEb39861d10ff6C7f7bf1F96C57', // agEUR + ], + xdai: [ + // '0x4b1E2c2762667331Bc91648052F646d1b0d35984' + ], + bsc: [ + // '0x12f31B73D812C6Bb0d735a218c086d44D5fe5f89' + ], + celo: [ + // '0xC16B81Af351BA9e64C1a069E3Ab18c244A1E3049', // agEUR + ], + }, + guardian: { + arbitrum: [ + // '0xFA5Ed56A203466CbBC2430a43c66b9D8723528E7', + ADDRESSES.arbitrum.USDC, + '0x463913D3a3D3D291667D53B8325c598Eb88D3B0e', + ], + ethereum: [ + // '0x1a7e4e63778B4f12a199C062f3eFdD288afCBce8', + '0x1aBaEA1f7C830bD89Acc67eC4af516284b1bC33c', + ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.CRV, + ADDRESSES.ethereum.CVX, + '0x2F123cF3F37CE3328CC9B5b8415f9EC5109b45e7', + ], + optimism: [ + '0x1db2466d9f5e10d7090e7152b68d62703a2245f0', + ADDRESSES.optimism.USDC, + // '0x9485aca5bbBE1667AD97c7fE7C4531a624C8b1ED', // agEUR + ], + polygon: [ + // '0xE0B52e49357Fd4DAf2c15e02058DCE6BC0057db4' + ], + avax: [ + ADDRESSES.avax.USDC, + // '0xAEC8318a9a59bAEb39861d10ff6C7f7bf1F96C57', // agEUR + ], + xdai: [ + // '0x4b1E2c2762667331Bc91648052F646d1b0d35984' + ], + bsc: [ + // '0x12f31B73D812C6Bb0d735a218c086d44D5fe5f89', + ADDRESSES.bsc.USDT, + '0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82', + ], + celo: [ + // '0xC16B81Af351BA9e64C1a069E3Ab18c244A1E3049', // agEUR + '0xD8763CBa276a3738E6DE85b4b3bF5FDed6D6cA73' + ], + }, +}; + +const governorAddress = { + arbitrum: '0xAA2DaCCAb539649D1839772C625108674154df0B', + ethereum: '0xdC4e6DFe07EFCa50a197DF15D9200883eF4Eb1c8', + optimism: '0x3245d3204EEB67afba7B0bA9143E8081365e08a6', + polygon: '0xdA2D2f638D6fcbE306236583845e5822554c02EA', + avax: '0x43a7947A1288e65fAF30D8dDb3ca61Eaabd41613', + xdai: '0x0F70EeD1Bb51d5eDB1a2E46142638df959bAFD69', + bsc: '0x0128eA927198f39e4955DdB01Fd62E8De6B3e6a4', + celo: '0x2ba5a55DBDAD03023e6872A8D57c458E9399bFE1', +} + +const guardianAddress = { + arbitrum: '0x55F01DDaE74b60e3c255BD2f619FEbdFce560a9C', + ethereum: '0x0C2553e4B9dFA9f83b1A6D3EAB96c4bAaB42d430', + optimism: '0xD245678e417aEE2d91763F6f4eFE570FF52fD080', + polygon: '0x3b9D32D0822A6351F415BeaB05251c1457FF6f8D', + avax: '0xCcD44983f597aE4d4E2B70CF979597D63a10870D', + xdai: '0xf0A31faec2B4fC6396c65B1aF1F6A71E653f11F0', + bsc: '0x371Ac6dB8063e6076890ef032A4A3cFCF226F548', + celo: '0x434153aA505959BCD5aAa7c17445EB8d835086f5', +} + +module.exports = { + TreasuryTokenAddresses, + governorAddress, + guardianAddress, +} \ No newline at end of file diff --git a/projects/angle/index.js b/projects/angle/index.js index bbbd16e6657..7ccf24f94a3 100644 --- a/projects/angle/index.js +++ b/projects/angle/index.js @@ -5,6 +5,8 @@ const { getConfig } = require("../helper/cache"); const { sumTokens2 } = require("../helper/unwrapLPs"); const { getUniqueAddresses } = require("../helper/tokenMapping"); +const { TreasuryTokenAddresses, governorAddress, guardianAddress } = require("./addresses.js"); + const ANGLE = "0x31429d1856ad1377a8a0079410b297e1a9e214c2"; const veANGLE = "0x0C462Dbb9EC8cD1630f1728B2CFD2769d09f0dd5"; @@ -13,21 +15,16 @@ const poolManagers_abi = { token: "address:token", }; +const transmuter_abi = { + getCollateralList: "address[]:getCollateralList", +} + // get Borrowing module vault managers list -async function getVaultManagersFromAPI(chain) { - const chainIds = { - ethereum: 1, - polygon: 137, - optimism: 10, - arbitrum: 42161, - fantom: 250, - avax: 43114, - }; - let chainId = chainIds[chain]; +async function getVaultManagersFromAPI(api) { let calls = []; let result = await getConfig( - "angle/" + chain, - "https://api.angle.money/v1/vaultManagers?chainId=" + chainId + "angle/" + api.chain, + "https://api.angle.money/v1/vaultManagers?chainId=" + api.chainId ); for (const data of Object.values(result)) { @@ -37,8 +34,9 @@ async function getVaultManagersFromAPI(chain) { return calls; } -async function tvl(_, _1, _2, { api }) { +async function tvl(timestamp, _1, _2, { api }) { const chain = api.chain + const balances = {}; const tokensAndOwners = []; if (chain === "ethereum") { @@ -53,6 +51,7 @@ async function tvl(_, _1, _2, { api }) { frax: "0x6b4eE7352406707003bC6f6b96595FD35925af48", // FRAX weth: "0x3f66867b4b6eCeBA0dBb6776be15619F73BC30A2", // WETH }, + transmuter: "0x00253582b2a3FE112feEC532221d9708c64cEFAb", }; // count the USDC in pool manager contract @@ -89,10 +88,32 @@ async function tvl(_, _1, _2, { api }) { ]) const eurocBalance = eurocBal * (+sdagEUREUROCTVL + +cvxagEUREUROCstakerTVL) / totPoolTokenSupply sdk.util.sumSingleBalance(balances, EUROC, eurocBalance); + + // Transmuter + if (timestamp > 1691656362) { + let collaterals = await api.call({ abi: transmuter_abi["getCollateralList"], target: agEUR.transmuter, }); + + collaterals.forEach((collateral, i) => { + tokensAndOwners.push([collateral, agEUR.transmuter]); + }); + } } // Borrowing module tokensAndOwners.push(...(await getVaultManagersFromAPI(chain))); + + // Treasury - Governor + const governorTokens = TreasuryTokenAddresses['governor'][chain] + governorTokens.forEach((token) => { + tokensAndOwners.push([token, governorAddress[chain]]); + }); + + // Treasury - Guardian + const guardianTokens = TreasuryTokenAddresses['guardian'][chain] + guardianTokens.forEach((token) => { + tokensAndOwners.push([token, guardianAddress[chain]]); + }); + return sumTokens2({ balances, api, tokensAndOwners }); } @@ -112,7 +133,7 @@ module.exports = { methodology: `TVL is retrieved on-chain by querying the total assets managed by the Core module, and the balances of the vaultManagers of the Borrowing module.`, }; -["ethereum", "polygon", "optimism", "arbitrum", "avax"].forEach((chain) => { +["ethereum", "polygon", "optimism", "arbitrum", "avax", "celo", "bsc", "xdai"].forEach((chain) => { if (!module.exports[chain]) module.exports[chain] = {}; module.exports[chain].tvl = tvl }); From e60e513eba9ad9db9884cf26129eddc3ef46d0ac Mon Sep 17 00:00:00 2001 From: define Date: Mon, 14 Aug 2023 12:16:44 +0100 Subject: [PATCH 0814/1974] add throne v2 adapter --- projects/throne-v2/index.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 projects/throne-v2/index.js diff --git a/projects/throne-v2/index.js b/projects/throne-v2/index.js new file mode 100644 index 00000000000..bfc9aa69da1 --- /dev/null +++ b/projects/throne-v2/index.js @@ -0,0 +1,18 @@ +const { getUniTVL } = require('../helper/unknownTokens') +const OATH = "0x798aCF1BD6E556F0C3cd72e77b3d169D26a28ab5"; +const FACTORY = "0xe4806BdD8E010828324928d25587721F6B58BEA2" + +const dexTVL = getUniTVL({ + factory: FACTORY, + useDefaultCoreAssets: true, + fetchBalances: true, +}) + + +module.exports = { + misrepresentedTokens: true, + methodology: `Uses Uniswap-style factory address to find and price liquidity pairs.`, + base: { + tvl: dexTVL, + } +}; \ No newline at end of file From 95a3dfb9b34d7230cfef4138d64b76d515f91f1f Mon Sep 17 00:00:00 2001 From: Merlin <39942523+merlincdj@users.noreply.github.com> Date: Mon, 14 Aug 2023 22:12:07 +0800 Subject: [PATCH 0815/1974] feat: WOOFi add Linea and Base (#7148) --- projects/woofi.js | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/projects/woofi.js b/projects/woofi.js index f3bd2151c28..bb8453bae1c 100644 --- a/projects/woofi.js +++ b/projects/woofi.js @@ -44,7 +44,7 @@ const wooPPConfig = { ADDRESSES.arbitrum.USDT, ], optimism: [ - ADDRESSES.tombchain.FTM, // WETH + ADDRESSES.optimism.WETH_1, // WETH '0x68f180fcCe6836688e9084f035309E29Bf0A2095', // WBTC ADDRESSES.optimism.OP, // OP ADDRESSES.optimism.USDC, // USDC @@ -60,6 +60,14 @@ const wooPPConfig = { ADDRESSES.polygon_zkevm.WETH, ADDRESSES.polygon_zkevm.USDC, ], + linea: [ + ADDRESSES.linea.WETH, + ADDRESSES.linea.USDC, + ], + base: [ + ADDRESSES.base.WETH, + ADDRESSES.base.USDbC, + ], } const chainConfig = { @@ -117,6 +125,18 @@ const chainConfig = { stakingContract: null, stakingContractV2: null, }, + linea: { + wooPPContract: '0xF5d215d9C84778F85746D15762DaF39B9E83a2d6', + woo: null, + stakingContract: null, + stakingContractV2: null, + }, + base: { + wooPPContract: '0xb130a49065178465931d4f887056328CeA5D723f', + woo: null, + stakingContract: null, + stakingContractV2: null, + }, } Object.keys(chainConfig).forEach(chain => { From 0f522c22ee29db683959f0f6deb311701aaf6aeb Mon Sep 17 00:00:00 2001 From: synthswapdev <141114700+synthswapdev@users.noreply.github.com> Date: Mon, 14 Aug 2023 16:12:23 +0200 Subject: [PATCH 0816/1974] add synthswap v3 tracking (#7147) * feat: add Synthswap * feat: add synthswap v3 tracking --- projects/synthswap-v3/index.js | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 projects/synthswap-v3/index.js diff --git a/projects/synthswap-v3/index.js b/projects/synthswap-v3/index.js new file mode 100644 index 00000000000..cbe8e141bf4 --- /dev/null +++ b/projects/synthswap-v3/index.js @@ -0,0 +1,9 @@ +const { uniV3Export } = require('../helper/uniswapV3') + +module.exports = uniV3Export({ + base: { + factory: '0xa37359e63d1aa44c0acb2a4605d3b45785c97ee3', + fromBlock: 2095251, + isAlgebra: true, + }, +}) From 49c6073aa92d3ec1df7a6159b1706db60d9cc0d5 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 14 Aug 2023 19:46:01 +0530 Subject: [PATCH 0817/1974] Gyroscope (#7149) * Update Gyroscope adapter * minor fix --------- Co-authored-by: Josh Guha --- projects/gyroscope/index.js | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/projects/gyroscope/index.js b/projects/gyroscope/index.js index 89f84e68323..9f5847eca15 100644 --- a/projects/gyroscope/index.js +++ b/projects/gyroscope/index.js @@ -1,25 +1,14 @@ const { transformBalances } = require('../helper/portedTokens') const sdk = require('@defillama/sdk') - -const GYRO_POOL_ADDRESSES = [ - "0x17f1ef81707811ea15d9ee7c741179bbe2a63887", - "0x97469e6236bd467cd147065f77752b00efadce8a", - "0xdac42eeb17758daa38caf9a3540c808247527ae3", - "0xf0ad209e2e969eaaa8c882aac71f02d8a047d5c2", - "0xfa9ee04a5545d8e0a26b30f5ca5cbecd75ea645f", - "0xee278d943584dd8640eaf4cc6c7a5c80c0073e85" -] +const { getConfig } = require('../helper/cache') async function tvl(_, _b, _cb, { api, }) { const balances = {} - const poolIds = await api.multiCall({ - abi: 'function getPoolId() view returns (bytes32)', - calls: GYRO_POOL_ADDRESSES, - }) + const poolIds = (await getConfig(`gyroscope/${api.chain}`, `https://app.gyro.finance/whitelist/${api.chain}.json`)) const vault = await api.call({ - target: GYRO_POOL_ADDRESSES[0], + target: poolIds[0].slice(0, 42), abi: 'address:getVault', }) const data = await api.multiCall({ @@ -29,9 +18,9 @@ async function tvl(_, _b, _cb, { api, }) { }) data.forEach(i => { - i.tokens.forEach((t, j) => sdk.util.sumSingleBalance(balances,t,i.balances[j])) + i.tokens.forEach((t, j) => sdk.util.sumSingleBalance(balances, t, i.balances[j])) }) - + return transformBalances(api.chain, balances) } @@ -39,5 +28,11 @@ module.exports = { methodology: 'sum of all the tokens locked in CLPs', polygon: { tvl + }, + optimism: { + tvl + }, + ethereum: { + tvl } } \ No newline at end of file From 916b41f3e95fc817abcda21942d8491dadf53f7c Mon Sep 17 00:00:00 2001 From: fextr <34183870+fextr@users.noreply.github.com> Date: Mon, 14 Aug 2023 07:28:57 -0700 Subject: [PATCH 0818/1974] remove aps from total holdings because of hack (#7150) --- projects/zunami/index.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/projects/zunami/index.js b/projects/zunami/index.js index f4f7125d207..12811e2f8f6 100644 --- a/projects/zunami/index.js +++ b/projects/zunami/index.js @@ -2,15 +2,11 @@ const ADDRESSES = require('../helper/coreAssets.json') const abi = require("./abi.json"); const zunamiContract = "0x2ffCC661011beC72e1A9524E12060983E74D14ce"; -const zunamiApsContract = "0xCaB49182aAdCd843b037bBF885AD56A3162698Bd"; const zethOmnipoolContract = "0x9dE83985047ab3582668320A784F6b9736c6EEa7"; -const zethApsContract = "0x8fc72dcfbf39FE686c96f47C697663EE08C78380" async function ethTvl(timestamp, block, _, { api }) { api.add(ADDRESSES.ethereum.DAI, await api.call({ abi: abi.totalHoldings, target: zunamiContract, })) - api.add(ADDRESSES.ethereum.DAI, await api.call({ abi: abi.totalHoldings, target: zunamiApsContract, })) api.add(ADDRESSES.null, await api.call({ abi: abi.totalHoldings, target: zethOmnipoolContract, })) - api.add(ADDRESSES.null, await api.call({ abi: abi.totalHoldings, target: zethApsContract, })) } module.exports = { From bdb6fb8ea993f71c383cbd6c5d5db83e20b0bed6 Mon Sep 17 00:00:00 2001 From: TJ <58812386+TJ-2@users.noreply.github.com> Date: Tue, 15 Aug 2023 07:47:32 +0100 Subject: [PATCH 0819/1974] add meridian-trade (#7156) * add meridian-trade * minor fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/meridian-trade/index.js | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 projects/meridian-trade/index.js diff --git a/projects/meridian-trade/index.js b/projects/meridian-trade/index.js new file mode 100644 index 00000000000..f4c28ef79e8 --- /dev/null +++ b/projects/meridian-trade/index.js @@ -0,0 +1,9 @@ +const { gmxExports } = require('../helper/gmx') + +const Vault = '0x853a8cE6B6338f5B0A14BCfc97F9D68396099C9C'; + +module.exports = { + base: { + tvl: gmxExports({ vault: Vault, blacklistedTokens: ['0x5e06ea564efcb3158a85dbf0b9e017cb003ff56f'] }) + }, +}; From 7f6f2e69b2143595ab286d190f81e8e99bd3adc8 Mon Sep 17 00:00:00 2001 From: skydest <139523103+skydest@users.noreply.github.com> Date: Tue, 15 Aug 2023 14:47:42 +0800 Subject: [PATCH 0820/1974] Update skydex index.js (#7155) * Update index.js * Update index.js * minor fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/skydex/index.js | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/projects/skydex/index.js b/projects/skydex/index.js index 52156dd304b..9463b49a7ae 100644 --- a/projects/skydex/index.js +++ b/projects/skydex/index.js @@ -1,22 +1,31 @@ const { sumTokens2 } = require("../helper/unwrapLPs"); -const pools = [ - "0xe59eA42466f3dD0ea620A622701085983A068863", - "0x33b4424A65cfE19CDf0Dff4E54e399782327a1b6", -]; +const config = { + era: { + pools: [ + "0xe59eA42466f3dD0ea620A622701085983A068863", + "0x33b4424A65cfE19CDf0Dff4E54e399782327a1b6", + ] + }, + base: { + pools: [ + "0x40e004A3312259EE0cA3F457d67D13d4FEec311E", + "0xBDA235257f1cFb3833594cB8faE394BC1826caD3", + ] + }, +} const blacklistedTokens = [] async function tvl(timestamp, ethereumBlock, chainBlocks, { api }) { - const tokensArray = await api.multiCall({ abi: "address[]:getTokens", calls: pools}) + const { pools } = config[api.chain] + const tokensArray = await api.multiCall({ abi: "address[]:getTokens", calls: pools }) const tokens = tokensArray.flat() - const calls = tokensArray.map((t, i)=> t.map((token) => ({ target: pools[i], params: token }))).flat() - const owners = await api.multiCall({ abi:"function assetOf(address) view returns (address)", calls}) + const calls = tokensArray.map((t, i) => t.map((token) => ({ target: pools[i], params: token }))).flat() + const owners = await api.multiCall({ abi: "function assetOf(address) view returns (address)", calls }) return sumTokens2({ api, tokensAndOwners2: [tokens, owners], blacklistedTokens }); } -module.exports = { - era: { - tvl, - }, -}; +Object.keys(config).forEach(chain => { + module.exports[chain] = { tvl } +}) \ No newline at end of file From 3dfe386cf6fcc488c04be545d04d230925dcfcd6 Mon Sep 17 00:00:00 2001 From: WarlockDeFi <142273979+WarlockDeFi@users.noreply.github.com> Date: Tue, 15 Aug 2023 07:47:51 +0100 Subject: [PATCH 0821/1974] feat: add bryan on base adapter (#7153) * Create index.js * minor fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/bryanonbase/index.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 projects/bryanonbase/index.js diff --git a/projects/bryanonbase/index.js b/projects/bryanonbase/index.js new file mode 100644 index 00000000000..3b457a245ab --- /dev/null +++ b/projects/bryanonbase/index.js @@ -0,0 +1,24 @@ +const { sumTokensExport } = require('../helper/unknownTokens') +const ADDRESSES = require('../helper/coreAssets.json') + +const stakingETHContract = "0x9acDDdbEBED00107B3eF2931607F131F392f6996"; + +const stakingBRYANContract = "0x32e5594F14de658b0d577D6560fA0d9C6F1aa724"; +const BRYAN = "0xB75445A717D5A8c268f37045162837CFe72Ac337"; + +const stakingPool2Contract = "0x5DFF152F94E0EADeD36201f1D5AC37382f3Cf51D"; +const BRYAN_WETH_SLP = "0xbCA1647EA6C7eB6916a5B33E21467ff78Bf5Ec55"; + +const stakeBryanEarnWeth = "0xC0c8BCAf6c1baE2d4A35f4D89A8EAc9A9E5D4Db0" +const stakeLpEarnWeth = "0xCf4543777342D93BEde085292E46D847BC59dc07" + +module.exports = { + misrepresentedTokens: true, + base: { + tvl: sumTokensExport({ owners: [stakingETHContract, stakeLpEarnWeth, stakeBryanEarnWeth], tokens: [ADDRESSES.base.WETH], }), + pool2: sumTokensExport({ owners: [stakingPool2Contract, stakeLpEarnWeth, ], tokens: [BRYAN_WETH_SLP], useDefaultCoreAssets: true, }), + pool2: sumTokensExport({ owners: [stakingBRYANContract, stakeBryanEarnWeth], tokens: [BRYAN], lps: [BRYAN_WETH_SLP], useDefaultCoreAssets: true, }), + }, + methodology: + "Counts as TVL the ETH asset deposited through StakingETH Contract, and we count Staking and Pool2 parts in the same way", +}; From 4c99e5ce2f32e25293ecc1414b51ec621f623fc2 Mon Sep 17 00:00:00 2001 From: Han Yang Date: Tue, 15 Aug 2023 21:54:12 +0800 Subject: [PATCH 0822/1974] add sanctum TVL calculation (#7159) --- projects/sanctum/index.js | 25 +++++++++++++++++++++++ projects/sanctum/partialIdl.js | 37 ++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 projects/sanctum/index.js create mode 100644 projects/sanctum/partialIdl.js diff --git a/projects/sanctum/index.js b/projects/sanctum/index.js new file mode 100644 index 00000000000..a17b518c8f6 --- /dev/null +++ b/projects/sanctum/index.js @@ -0,0 +1,25 @@ +const { Program } = require("@project-serum/anchor"); +const { getProvider, getMultipleAccountsRaw } = require("../helper/solana"); +const partialIdl = require("./partialIdl"); + +const PROGRAM_ADDR = "unpXTU2Ndrc7WWNyEhQWe4udTzSibLPi25SXv2xbCHQ"; +const POOL_ADDR = "FypPtwbY3FUfzJUtXHSyVRokVKG2jKtH29FmK4ebxRSd"; +const SOL_RESERVES = "3rBnnH9TTgd3xwu48rnzGsaQkSr1hR64nY71DrDt6VrQ"; + +async function tvl() { + const program = new Program(partialIdl, PROGRAM_ADDR, getProvider()); + const [poolAccount, reservesAccount] = await getMultipleAccountsRaw([ + POOL_ADDR, + SOL_RESERVES, + ]); + const pool = program.coder.accounts.decode("pool", Buffer.from(poolAccount.data[0], poolAccount.data[1])); + return { + solana: (reservesAccount.lamports + pool.incomingStake.toNumber()) / 1e9, + } +} + +module.exports = { + timetravel: false, + methodology: "TVL is calculated by summing total incoming stake from stake accounts that were instant unstaked but not yet reclaimed, and the pool's SOL reserves.", + solana: { tvl, }, +} diff --git a/projects/sanctum/partialIdl.js b/projects/sanctum/partialIdl.js new file mode 100644 index 00000000000..05929a7f51f --- /dev/null +++ b/projects/sanctum/partialIdl.js @@ -0,0 +1,37 @@ +module.exports = { + accounts: [ + { + "name": "pool", + "type": { + "kind": "struct", + "fields": [ + { + "name": "feeAuthority", + "docs": [ + "The authority authorized to set fees" + ], + "type": "publicKey" + }, + { + "name": "lpMint", + "docs": [ + "The pool's lp token mint" + ], + "type": "publicKey" + }, + { + "name": "incomingStake", + "docs": [ + "The last known value of total number of lamports in stake accounts", + "owned by the pool that have not been reclaimed yet.", + "The total SOL owned by a pool accounted for can be calculated by taking", + "incoming_stake + pool_sol_reserves.lamports" + ], + "type": "u64" + } + ] + } + }, + ], + instructions: [], +} From e181f5b65888894478b942dd00425e6d21418e1d Mon Sep 17 00:00:00 2001 From: yuhuakukude <15577334054@163.com> Date: Tue, 15 Aug 2023 21:54:23 +0800 Subject: [PATCH 0823/1974] update bounce tvl (#7157) * update bounce tvl * update bounce tvl * bugfix * update bounce tvl --------- Co-authored-by: yuhuakukude Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/bounce/index.js | 14 ++++++++++++-- projects/bryanonbase/index.js | 2 +- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/projects/bounce/index.js b/projects/bounce/index.js index 8e0fb8ff817..b572929d67c 100644 --- a/projects/bounce/index.js +++ b/projects/bounce/index.js @@ -1,16 +1,26 @@ const { sumTokensExport } = require('../helper/unwrapLPs') +const ADDRESSES = require("../helper/coreAssets.json"); const AUCTION = '0xA9B1Eb5908CfC3cdf91F9B8B3a74108598009096' const AUCTION_ETH_SLP = '0x0f8086d08a69ebd8e3a130a87a3b6a260723976f' const STAKING_ADDRESS = '0x98945BC69A554F8b129b09aC8AfDc2cc2431c48E' const STAKING_LP_ADDRESS = '0xbe5a88b573290e548759520a083a61051b258451' -const MULTI_SIG_ADDRESS = '0xc9297466C6c7acc799Fb869806C53398b8B10680' + +const BOUNCE_V1 = '0x73282A63F0e3D7e9604575420F777361ecA3C86A' +const BOUNCE_V1_PRO = '0x6fe40f415448d930166f9110D3bBe2146383bC66' + +const v1config = { + ethereum: { + tokens: [ADDRESSES.ethereum.USDT, ADDRESSES.ethereum.USDC], + owners: [BOUNCE_V1, BOUNCE_V1_PRO], + } +} module.exports = { ethereum: { - tvl: sumTokensExport({}), + tvl: sumTokensExport({ ...v1config.ethereum }), pool2: sumTokensExport({ owner: STAKING_LP_ADDRESS, tokens: [AUCTION_ETH_SLP] }), staking: sumTokensExport({ owner: STAKING_ADDRESS, tokens: [AUCTION] }), }, diff --git a/projects/bryanonbase/index.js b/projects/bryanonbase/index.js index 3b457a245ab..a5b0e5e5258 100644 --- a/projects/bryanonbase/index.js +++ b/projects/bryanonbase/index.js @@ -17,7 +17,7 @@ module.exports = { base: { tvl: sumTokensExport({ owners: [stakingETHContract, stakeLpEarnWeth, stakeBryanEarnWeth], tokens: [ADDRESSES.base.WETH], }), pool2: sumTokensExport({ owners: [stakingPool2Contract, stakeLpEarnWeth, ], tokens: [BRYAN_WETH_SLP], useDefaultCoreAssets: true, }), - pool2: sumTokensExport({ owners: [stakingBRYANContract, stakeBryanEarnWeth], tokens: [BRYAN], lps: [BRYAN_WETH_SLP], useDefaultCoreAssets: true, }), + staking: sumTokensExport({ owners: [stakingBRYANContract, stakeBryanEarnWeth], tokens: [BRYAN], lps: [BRYAN_WETH_SLP], useDefaultCoreAssets: true, }), }, methodology: "Counts as TVL the ETH asset deposited through StakingETH Contract, and we count Staking and Pool2 parts in the same way", From 56f967488fccfc9bfb710c3e6bddb5b297a76214 Mon Sep 17 00:00:00 2001 From: Mike Richards Date: Tue, 15 Aug 2023 22:36:26 +0800 Subject: [PATCH 0824/1974] Add MantaDAO Adapter (#6886) * Add MantaDAO Adaptor * Remove unnecessary try/catch * code refactor --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/helper/chain/cosmos.js | 11 ++- projects/treasury/mantadao.js | 126 ++++++++++++++++++++++++++++++++ 2 files changed, 133 insertions(+), 4 deletions(-) create mode 100644 projects/treasury/mantadao.js diff --git a/projects/helper/chain/cosmos.js b/projects/helper/chain/cosmos.js index 0cbf7435286..8a2f74d88ee 100644 --- a/projects/helper/chain/cosmos.js +++ b/projects/helper/chain/cosmos.js @@ -119,7 +119,7 @@ async function getDenomBalance({ denom, owner, block, chain } = {}) { return balance ? Number(balance.amount) : 0; } -async function getBalance2({ balances = {}, owner, block, chain } = {}) { +async function getBalance2({ balances = {}, owner, block, chain, tokens, blacklistedTokens, } = {}) { const subpath = chainSubpaths[chain] || "cosmos"; let endpoint = `${getEndpoint( chain @@ -130,8 +130,11 @@ async function getBalance2({ balances = {}, owner, block, chain } = {}) { const { data: { balances: data }, } = await axios.get(endpoint); - for (const { denom, amount } of data) + for (const { denom, amount } of data) { + if (blacklistedTokens?.includes(denom)) continue; + if (tokens && !tokens.includes(denom)) continue; sdk.util.sumSingleBalance(balances, denom, amount); + } return balances; } @@ -204,14 +207,14 @@ async function queryContractStore({ return query(url, block, chain); } -async function sumTokens({ balances = {}, owners = [], chain, owner }) { +async function sumTokens({ balances = {}, owners = [], chain, owner, tokens, blacklistedTokens, }) { if (owner) owners = [owner] log(chain, "fetching balances for ", owners.length); let parallelLimit = 25; const { errors } = await PromisePool.withConcurrency(parallelLimit) .for(owners) - .process(async (owner) => getBalance2({ balances, owner, chain })); + .process(async (owner) => getBalance2({ balances, owner, chain, tokens, blacklistedTokens, })); if (errors && errors.length) throw errors[0]; return transformBalances(chain, balances); diff --git a/projects/treasury/mantadao.js b/projects/treasury/mantadao.js new file mode 100644 index 00000000000..985a1be4446 --- /dev/null +++ b/projects/treasury/mantadao.js @@ -0,0 +1,126 @@ +const { getConfig } = require("../helper/cache"); +const { sumTokens, queryContract, queryV1Beta1, getDenomBalance, getBalance2 } = require('../helper/chain/cosmos'); +const axios = require('axios'); +const owners = ["kujira15e682nq9jees29rm9j3h030af86lq2qtlejgphlspzqcvs9whf2q00nua5"] + +async function tvl(_, _1, _2, { api }) { + + // Get base balances of DAO treasury + await sumTokens({ + balances: api.getBalances(), + owners: owners, + chain: 'kujira', + blacklistedTokens: ['factory/kujira1643jxg8wasy5cfcn7xm8rd742yeazcksqlg4d7/umnta'] + }); + + // Get value of DAOs Protocol-Owned-Liquidity + await calcPOLValue(api) +} + +async function calcPOLValue(api) { + const treasury = ["kujira15e682nq9jees29rm9j3h030af86lq2qtlejgphlspzqcvs9whf2q00nua5"] + + // Get list of all BOW LP Pools + const contracts = await getConfig("mantadao/contracts", "https://raw.githubusercontent.com/Team-Kujira/kujira.js/master/src/resources/contracts.json"); + const bowPools = contracts["kaiyo-1"].bow.map(x => x.address) + + // Get list of total supply of all native denoms + let supplyData = await queryV1Beta1({ chain: 'kujira', url: '/bank/v1beta1/supply' }); + + let denomSupply = supplyData.supply; + let paginationKey = supplyData.pagination.next_key; + + while (paginationKey) { + supplyData = await queryV1Beta1({ + chain: 'kujira', + paginationKey: paginationKey, + url: '/bank/v1beta1/supply' + }); + denomSupply = denomSupply.concat(supplyData.supply); + paginationKey = supplyData.pagination.next_key; + } + + // Get all balances of treasury + const treasuryBalances = await getBalance2({ + owner: treasury, + chain: 'kujira' + }) + + // Calculate outputs of each LP balance + let treasuryLPDenomBalances = await Promise.all( + bowPools.map(async (pool) => { + const lpDenom = `factory/${pool}/ulp`; + + if (treasuryBalances.hasOwnProperty(lpDenom)) { + + const lpDenomSupply = denomSupply.find((supply) => supply.denom == lpDenom) + + + if (lpDenomSupply) { + const supply = lpDenomSupply.amount; + + const poolQuery = JSON.stringify({ pool: {} }); + + let poolBalances; + + poolBalances = await queryPoolContract({ contract: pool, chain: 'kujira', data: poolQuery }); + + const balances = poolBalances.balances; + const coin0OutRatio = parseInt(balances[0]) / parseInt(supply); + const coin1OutRatio = parseInt(balances[1]) / parseInt(supply); + + const treasuryLPBalance = treasuryBalances[lpDenom]; + + + const coin0Out = coin0OutRatio * treasuryLPBalance; + const coin1Out = coin1OutRatio * treasuryLPBalance; + + const configQuery = JSON.stringify({ config: {} }) + const poolConfig = await queryContract({ contract: pool, chain: 'kujira', data: configQuery }); + + + const denom0 = poolConfig.denoms[0]; + const denom1 = poolConfig.denoms[1]; + + api.add(denom0, parseInt(coin0Out)) + api.add(denom1, parseInt(coin1Out)) + delete api.getBalances()['kujira:'+lpDenom.replaceAll('/', ':')]; + } + } + }) + ); + + treasuryLPDenomBalances = treasuryLPDenomBalances.filter(Boolean); + + return treasuryLPDenomBalances; + +} + + +// Need hardcoded endpoint as half the suggested ones don't support proper gas limit for Kujira +async function queryPoolContract({ contract, chain, data }) { + if (typeof data !== "string") data = JSON.stringify(data); + data = Buffer.from(data).toString("base64"); + return ( + await axios.get( + `https://kuji-api.kleomedes.network/cosmwasm/wasm/v1/contract/${contract}/smart/${data}` + ) + ).data.data; +} + + +async function ownTokens(_, _1, _2, { api }) { + return sumTokens({ + owners: owners, + chain: 'kujira', + tokens: ['factory/kujira1643jxg8wasy5cfcn7xm8rd742yeazcksqlg4d7/umnta'] + }); +} + +module.exports = { + timetravel: false, + kujira: { + tvl, + ownTokens, + }, +} From 20c9204d812b5c46e32bfcc3a61e5b9b5b568035 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 15 Aug 2023 17:48:02 +0200 Subject: [PATCH 0825/1974] fix broken adapters --- projects/clearpool/index.js | 202 ++++++------------------------------ projects/helper/cache.js | 17 +-- 2 files changed, 44 insertions(+), 175 deletions(-) diff --git a/projects/clearpool/index.js b/projects/clearpool/index.js index 86b78009782..c0b251746c3 100644 --- a/projects/clearpool/index.js +++ b/projects/clearpool/index.js @@ -1,188 +1,52 @@ // npm i -f // node test.js projects/clearpool/index.js -const sdk = require("@defillama/sdk"); -const { sumTokens } = require("../helper/unwrapLPs"); const abi = require("./abi.json"); -const { getConfig } = require("../helper/cache"); const { stakings } = require("../helper/staking"); const { getLogs } = require("../helper/cache/getLogs"); -const PoolFactory = "0xde204e5a060ba5d3b63c7a4099712959114c2d48"; -const START_BLOCK = 14443222; -const polygonPoolURL = "https://clearpool.finance/api/pools"; - -const ethereumTvl = async (timestamp, block, chainBlocks, { api }) => { - const balances = {}; - const Logs = await getLogs({ - api, - target: PoolFactory, - topic: "PoolCreated(address,address,address)", - fromBlock: START_BLOCK, - }); - const tokensAndOwners = []; - for (let i = 0; i < Logs.length; i++) { - const pool = "0x" + Logs[i].topics[1].substring(26, 66); - const token = "0x" + Logs[i].topics[3].substring(26, 66); - tokensAndOwners.push([token, pool]); - } - await sumTokens(balances, tokensAndOwners, block); - return balances; -}; - -const ethereumBorrowed = async (timestamp, block, _, { api }) => { - const totalBorrowed = {}; - const Logs = await getLogs({ - api, - target: PoolFactory, - topic: "PoolCreated(address,address,address)", - fromBlock: START_BLOCK, - }); - - const pools = []; - const tokens = []; - - for (let i = 0; i < Logs.length; i++) { - const pool = "0x" + Logs[i].topics[1].substring(26, 66); - const token = "0x" + Logs[i].topics[3].substring(26, 66); - pools.push(pool); - tokens.push(token); - } - - const { output: borrowed } = await sdk.api.abi.multiCall({ - abi: abi.borrows, - calls: pools.map((i) => ({ target: i })), - block, - }); - - borrowed.forEach((data, i) => - sdk.util.sumSingleBalance(totalBorrowed, tokens[i], data.output) - ); - return totalBorrowed; -}; - -const polygonTvl = async (timestamp, _, { polygon: block }) => { - const balances = {}; - const chain = "polygon"; - const poolAllData = await getConfig("clearpool-polygon", polygonPoolURL); - const poolData = poolAllData["137"]; +const singleStakingContracts = ["0x629E39da1Db5654fe59cAE31d48CAEBB8dC2A9c6"]; +const CPOOL = "0x66761fa41377003622aee3c7675fc7b5c1c2fac5"; - const tokensAndOwners = []; - for (let i = 0; i < poolData.length; i++) { - const pool = poolData[i].address; - const token = poolData[i].currencyAddress; - tokensAndOwners.push([token, pool]); - } - await sumTokens(balances, tokensAndOwners, block, chain); - return balances; -}; +module.exports = { + methodology: "We count liquidity by USDC deposited on the pools contracts", +} -const polygonBorrowed = async (timestamp, _, { polygon: block }) => { - const chain = "polygon"; - const poolAllData = await getConfig("clearpool-polygon", polygonPoolURL); - const poolData = poolAllData["137"]; - const totalBorrowed = {}; +const config = { + ethereum: { factory: '0xde204e5a060ba5d3b63c7a4099712959114c2d48', fromBlock: 14443222 }, + polygon_zkevm: { factory: '0xCE3Fec90A05992dF1357651FEF6D143FeeC7Ca16', fromBlock: 302970 }, + polygon: { factory: '0x215CCa938dF02c9814BE2D39A285B941FbdA79bA', fromBlock: 31128013 }, +} - const pools = []; - const tokens = []; +Object.keys(config).forEach(chain => { + const { fromBlock, factory } = config[chain] - for (let i = 0; i < poolData.length; i++) { - const pool = poolData[i].address; - const token = poolData[i].currencyAddress; - pools.push(pool); - tokens.push(token); + const tvl = async (timestamp, block, chainBlocks, { api }) => { + const { pools, tokens } = await _getLogs(api) + return api.sumTokens({ tokensAndOwners2: [tokens, pools] }) } - const { output: borrowed } = await sdk.api.abi.multiCall({ - abi: abi.borrows, - calls: pools.map((i) => ({ target: i })), - chain, - block, - }); - - borrowed.forEach((data, i) => - sdk.util.sumSingleBalance( - totalBorrowed, - chain + ":" + tokens[i], - data.output - ) - ); - return totalBorrowed; -}; - -const polygonZkEvmTvl = async (timestamp, _, { polygon: block }) => { - const balances = {}; - const chain = "polygon_zkevm"; - const poolAllData = await getConfig( - "clearpool-polygon-zkevm", - polygonPoolURL - ); - const poolData = poolAllData["1101"]; - - const tokensAndOwners = []; - for (let i = 0; i < poolData.length; i++) { - const pool = poolData[i].address; - const token = poolData[i].currencyAddress; - tokensAndOwners.push([token, pool]); + async function _getLogs(api) { + const logs = await getLogs({ + api, + target: factory, + fromBlock, + eventAbi: 'event PoolCreated(address indexed pool, address indexed owner, address indexed token)', + onlyArgs: true + }) + const pools = logs.map(log => log.pool) + const tokens = logs.map(log => log.token) + return { pools, tokens } } - await sumTokens(balances, tokensAndOwners, block, chain); - return balances; -}; - -const polygonZkEvmBorrowed = async (timestamp, _, { polygon: block }) => { - const chain = "polygon_zkevm"; - const poolAllData = await getConfig( - "clearpool-polygon-zkevm", - polygonPoolURL - ); - const poolData = poolAllData["1101"]; - const totalBorrowed = {}; - - const pools = []; - const tokens = []; - for (let i = 0; i < poolData.length; i++) { - const pool = poolData[i].address; - const token = poolData[i].currencyAddress; - pools.push(pool); - tokens.push(token); + const borrowed = async (timestamp, block, _, { api }) => { + const { pools, tokens } = await _getLogs(api) + const bals = await api.multiCall({ abi: abi.borrows, calls: pools }) + api.addTokens(tokens, bals) } - const { output: borrowed } = await sdk.api.abi.multiCall({ - abi: abi.borrows, - calls: pools.map((i) => ({ target: i })), - chain, - block, - }); + module.exports[chain] = { tvl, borrowed } +}) - borrowed.forEach((data, i) => - sdk.util.sumSingleBalance( - totalBorrowed, - chain + ":" + tokens[i], - data.output - ) - ); - return totalBorrowed; -}; - -const singleStakingContracts = ["0x629E39da1Db5654fe59cAE31d48CAEBB8dC2A9c6"]; -const CPOOL = "0x66761fa41377003622aee3c7675fc7b5c1c2fac5"; - -module.exports = { - timetravel: false, - ethereum: { - tvl: ethereumTvl, - borrowed: ethereumBorrowed, - staking: stakings(singleStakingContracts, CPOOL), - }, - polygon: { - tvl: polygonTvl, - borrowed: polygonBorrowed, - }, - polygon_zkevm: { - tvl: polygonZkEvmTvl, - borrowed: polygonZkEvmBorrowed, - }, - methodology: "We count liquidity by USDC deposited on the pools contracts", -}; +module.exports.ethereum.staking = stakings(singleStakingContracts, CPOOL) diff --git a/projects/helper/cache.js b/projects/helper/cache.js index 7536bc9280d..0890b08b74e 100644 --- a/projects/helper/cache.js +++ b/projects/helper/cache.js @@ -48,6 +48,13 @@ async function setCache(project, chain, cache, { const configCache = {} +async function _setCache(project, chain, json) { + const strData = typeof json === 'string' ? json : JSON.stringify(json) + let isValidData = strData.length > 42 + if (isValidData) // sometimes we get bad data/empty object, we dont overwrite cache with it + await setCache(key, project, json) +} + async function getConfig(project, endpoint) { if (!project || !endpoint) throw new Error('Missing parameters') const key = 'config-cache' @@ -58,10 +65,8 @@ async function getConfig(project, endpoint) { async function _getConfig() { try { const { data: json } = await axios.get(endpoint) - const strData = typeof json === 'string' ? json : JSON.stringify(json) - let isValidData = strData.length > 42 - if (isValidData) // sometimes we get bad data/empty object, we dont overwrite cache with it - await setCache(key, project, json) + if (!json) throw new Error('Invalid data') + await _setCache(key, project, json) return json } catch (e) { // sdk.log(e) @@ -81,7 +86,7 @@ async function configPost(project, endpoint, data) { async function _configPost() { try { const { data: json } = await axios.post(endpoint, data) - await setCache(key, project, json) + await _setCache(key, project, json) return json } catch (e) { // sdk.log(e) @@ -106,7 +111,7 @@ async function cachedGraphQuery(project, endpoint, query, { variables, fetchById json = await graphql.request(endpoint, query, { variables }) else json = await graphFetchById({ endpoint, query, }) - await setCache(key, project, json) + await _setCache(key, project, json) return json } catch (e) { // sdk.log(e) From 0584e8e9ea84bd0daa1d29f3309607ed0a1bc4a9 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 15 Aug 2023 17:51:07 +0200 Subject: [PATCH 0826/1974] fix quicksilver --- projects/quicksilver/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/quicksilver/index.js b/projects/quicksilver/index.js index 8a1aa8b3e22..819af075451 100644 --- a/projects/quicksilver/index.js +++ b/projects/quicksilver/index.js @@ -4,6 +4,7 @@ const { get } = require("../helper/http"); const coinGeckoIds = { uatom: "cosmos", uosmo: "osmosis", + usomm: "sommelier", uregen: "regen", ujuno: "juno-network", ustars: "stargaze" From c07178b6486c6e602a225c65a34961675dcce46a Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Wed, 16 Aug 2023 02:33:58 +0100 Subject: [PATCH 0827/1974] add cookiebase-farm --- projects/cookiebase-farm/index.js | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 projects/cookiebase-farm/index.js diff --git a/projects/cookiebase-farm/index.js b/projects/cookiebase-farm/index.js new file mode 100644 index 00000000000..848b493e559 --- /dev/null +++ b/projects/cookiebase-farm/index.js @@ -0,0 +1,10 @@ +const { masterchefExports } = require("../helper/unknownTokens"); + +module.exports = masterchefExports({ + chain: "base", + masterchef: "0x0544b381F24eaC255ED1e2Ab2a67f10D2502921a", + nativeTokens: ["0x614747C53CB1636b4b962E15e1D66D3214621100"], + useDefaultCoreAssets: true, + poolInfoABI: "function poolInfo(uint256) view returns (address)", + getToken: (i) => i, +}); \ No newline at end of file From f41b5631a3f79067a6b2d2a790051cece8c9e3d4 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 16 Aug 2023 08:01:38 +0200 Subject: [PATCH 0828/1974] cache: bugfix --- projects/helper/cache.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/helper/cache.js b/projects/helper/cache.js index 0890b08b74e..e9fe334919c 100644 --- a/projects/helper/cache.js +++ b/projects/helper/cache.js @@ -52,7 +52,7 @@ async function _setCache(project, chain, json) { const strData = typeof json === 'string' ? json : JSON.stringify(json) let isValidData = strData.length > 42 if (isValidData) // sometimes we get bad data/empty object, we dont overwrite cache with it - await setCache(key, project, json) + await setCache(project, chain, json) } async function getConfig(project, endpoint) { From 6bfeef50cc8cfbddb04d45ebcd45ff6fd8a03f99 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 16 Aug 2023 11:53:14 +0530 Subject: [PATCH 0829/1974] Liquid-collective (#7167) --- projects/liquid-collective/index.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 projects/liquid-collective/index.js diff --git a/projects/liquid-collective/index.js b/projects/liquid-collective/index.js new file mode 100644 index 00000000000..3d1074545cf --- /dev/null +++ b/projects/liquid-collective/index.js @@ -0,0 +1,14 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const token = '0x8c1BEd5b9a0928467c9B1341Da1D7BD5e10b6549' + +async function tvl(_, _1, _2, { api }) { + const supply = await api.call({ abi: 'uint256:totalUnderlyingSupply', target: token, }); + api.add(ADDRESSES.null, supply) +} + +module.exports = { + methodology: 'Retrieve the total underlying ETH supply', + ethereum: { + tvl + } +} From cf1b3deac3d6ee0cb335ee42b44b1b221aa3f45a Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 16 Aug 2023 12:07:55 +0530 Subject: [PATCH 0830/1974] Omnibtc (#7168) * Add OmniBTC * feat: computing OmniBTC TVL using on-chain data * feat: fix exports names * feat: fix tvl calculate * feat: fix eslint * omnibtc: code refactor --------- Co-authored-by: 0xhelloweb3 <1245816264@qq.com> --- projects/helper/chain/sui.js | 4 +-- projects/omnibtc/index.js | 69 ++++++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+), 2 deletions(-) create mode 100644 projects/omnibtc/index.js diff --git a/projects/helper/chain/sui.js b/projects/helper/chain/sui.js index a90941f0f24..c824cb584a4 100644 --- a/projects/helper/chain/sui.js +++ b/projects/helper/chain/sui.js @@ -50,9 +50,9 @@ async function getObjects(objectIds) { return objectIds.map(i => result.find(j => j.data.objectId === i)?.data?.content) } -async function getDynamicFieldObject(parent, id) { +async function getDynamicFieldObject(parent, id, { idType = '0x2::object::ID' } = {}) { return (await call('suix_getDynamicFieldObject', [parent, { - "type": "0x2::object::ID", + "type": idType, "value": id }])).content } diff --git a/projects/omnibtc/index.js b/projects/omnibtc/index.js new file mode 100644 index 00000000000..16a2e909119 --- /dev/null +++ b/projects/omnibtc/index.js @@ -0,0 +1,69 @@ +const ADDRESSES = require("../helper/coreAssets.json"); +const sui = require("../helper/chain/sui"); + +const RESERVE_DYNAMIC_TABLE = + "0x6ce8b223c47b5037d6791819694b32619ab0edfa5da139d21e416781cae487aa"; + +const decimalShift = { + [ADDRESSES.sui.USDC]: -2, + [ADDRESSES.sui.SUI]: 1, +}; + +const SUI_TOKENS = [ + { + symbol: "SUI", + poolId: 3, + address: ADDRESSES.sui.SUI, + }, + { + symbol: "USDC", + poolId: 8, + address: ADDRESSES.sui.USDC, + }, +]; + +// Helper function to retrieve data based on poolId +async function fetchDataBasedOnPoolId() { + const getObject = ({ poolId }) => sui.getDynamicFieldObject(RESERVE_DYNAMIC_TABLE, poolId.toString(), { idType: 'u16' }) + return Promise.all(SUI_TOKENS.map(getObject)) +} + +// Calculate and add to API +function calculateAndAdd(objectsList, type, indexName, api) { + objectsList.forEach((object, index) => { + const { address } = SUI_TOKENS[index]; + + const dataFields = object.fields.value.fields; + + const total_supply = dataFields.otoken_scaled?.fields?.total_supply || 0; + const total_borrow = dataFields.dtoken_scaled?.fields?.total_supply || 0; + const indexValue = dataFields[indexName] || 0; + + const shiftValue = 10 ** (decimalShift[address] ?? 0); + const mainValue = type === "tvl" ? (total_supply - total_borrow) : total_borrow; + + const amount = (mainValue * shiftValue * indexValue) / Math.pow(10, 27); + + api.add(address, amount); + }); +} + +async function tvl() { + const { api } = arguments[3]; + const objectsList = await fetchDataBasedOnPoolId(); + calculateAndAdd(objectsList, "tvl", "current_liquidity_index", api); +} + +async function borrow() { + const { api } = arguments[3]; + const objectsList = await fetchDataBasedOnPoolId(); + calculateAndAdd(objectsList, "borrow", "current_borrow_index", api); +} + +module.exports = { + timetravel: false, + sui: { + tvl, + borrowed: borrow, + }, +}; From 3ffdbc678990c8bcdc950fd41996ff113029f7a3 Mon Sep 17 00:00:00 2001 From: firebomb1 <88804546+firebomb1@users.noreply.github.com> Date: Wed, 16 Aug 2023 08:41:44 +0200 Subject: [PATCH 0831/1974] chore: add shapeshift fox farm v7 (#7161) --- projects/shapeshift/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/shapeshift/index.js b/projects/shapeshift/index.js index 8e6a4836e81..08b977c490e 100644 --- a/projects/shapeshift/index.js +++ b/projects/shapeshift/index.js @@ -9,6 +9,7 @@ const stakingUNIv2Contracts = [ "0x24FD7FB95dc742e23Dc3829d3e656FEeb5f67fa0", // v4 "0xC14eaA8284feFF79EDc118E06caDBf3813a7e555", // v5 "0xEbB1761Ad43034Fd7FaA64d84e5BbD8cB5c40b68", // v6 + "0x5939783dbf3e9f453a69bc9ddc1e492efac1fbcb", // v7 ]; const stakingFoxy = "0xee77aa3Fd23BbeBaf94386dD44b548e9a785ea4b"; From 34fb0ed6419788fb7aba57a4be5dbc6c3bf61141 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 16 Aug 2023 18:11:27 +0530 Subject: [PATCH 0832/1974] astroport: track sei (#7164) * astroport: track sei * minor fix --- projects/astroport/index.js | 3 +++ projects/helper/chain/cosmos.js | 2 +- projects/helper/chains.json | 1 + projects/helper/coreAssets.json | 10 ++++++++++ projects/helper/tokenMapping.js | 2 +- projects/terraswap/factoryTvl.js | 2 +- 6 files changed, 17 insertions(+), 3 deletions(-) diff --git a/projects/astroport/index.js b/projects/astroport/index.js index 981dfb0ace8..02573dbacc7 100644 --- a/projects/astroport/index.js +++ b/projects/astroport/index.js @@ -13,4 +13,7 @@ module.exports = { neutron: { tvl: getFactoryTvl("neutron1hptk0k5kng7hjy35vmh009qd5m6l33609nypgf2yc6nqnewduqasxplt4e") }, + sei: { + tvl: getFactoryTvl("sei1xr3rq8yvd7qplsw5yx90ftsr2zdhg4e9z60h5duusgxpv72hud3shh3qfl") + }, } // node test.js projects/astroport/index.js \ No newline at end of file diff --git a/projects/helper/chain/cosmos.js b/projects/helper/chain/cosmos.js index 8a2f74d88ee..34e967b25c8 100644 --- a/projects/helper/chain/cosmos.js +++ b/projects/helper/chain/cosmos.js @@ -1,5 +1,4 @@ const axios = require("axios"); -const { default: BigNumber } = require("bignumber.js"); const sdk = require("@defillama/sdk"); const { transformBalances } = require("../portedTokens"); const { PromisePool } = require("@supercharge/promise-pool"); @@ -30,6 +29,7 @@ const endPoints = { neutron: "https://rest-kralum.neutron-1.neutron.org", quasar: "https://quasar-api.polkachu.com", gravitybridge: "https://rest.cosmos.directory/gravitybridge", + sei: "https://rest.sei-apis.com", aura: "https://lcd.aura.network", }; diff --git a/projects/helper/chains.json b/projects/helper/chains.json index fe0610ee688..53240c13496 100644 --- a/projects/helper/chains.json +++ b/projects/helper/chains.json @@ -176,6 +176,7 @@ "rvn", "rpg", "secret", + "sei", "shiden", "sifchain", "smartbch", diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index 9f4f31697f0..df372962eac 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -1349,5 +1349,15 @@ "base": { "WETH": "0x4200000000000000000000000000000000000006", "USDbC": "0xd9aAEc86B65D86f6A7B5B1b0c42FFA531710b6CA" + }, + "sei": { + "SEI": "usei", + "WETH": "factory/sei189adguawugk3e55zn63z8r9ll29xrjwca636ra7v7gxuzn98sxyqwzt47l/4tLQqCLaoKKfNFuPjA9o39YbKUwhR1F8N29Tz3hEbfP2", + "USDCet": "factory/sei189adguawugk3e55zn63z8r9ll29xrjwca636ra7v7gxuzn98sxyqwzt47l/Hq4tuDzhRBnxw3tFA5n6M52NVMVcC19XggbyDiJKCD6H", + "USDCso": "factory/sei189adguawugk3e55zn63z8r9ll29xrjwca636ra7v7gxuzn98sxyqwzt47l/9fELvUhFo6yWL34ZaLgPbCPzdk9MD1tAzMycgH45qShH", + "USDCar": "factory/sei189adguawugk3e55zn63z8r9ll29xrjwca636ra7v7gxuzn98sxyqwzt47l/7edDfnf4mku8So3t4Do215GNHwASEwCWrdhM5GqD51xZ", + "USDTet": "factory/sei189adguawugk3e55zn63z8r9ll29xrjwca636ra7v7gxuzn98sxyqwzt47l/HktfLoADCk9mnjv7XJiN4YXK9ayE6xinLzt8wzcsR2rY", + "USDTbs": "factory/sei189adguawugk3e55zn63z8r9ll29xrjwca636ra7v7gxuzn98sxyqwzt47l/871jbn9unTavWsAe83f2Ma9GJWSv6BKsyWYLiQ6z3Pva", + "WBTC": "factory/sei189adguawugk3e55zn63z8r9ll29xrjwca636ra7v7gxuzn98sxyqwzt47l/7omXa4gryZ5NiBmLep7JsTtTtANCVKXwT9vbN91aS1br" } } diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index d7e4b053728..0ad33027ac8 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -16,7 +16,7 @@ coreAssets = JSON.parse(JSON.stringify(coreAssets)) // carbon: https://api-insights.carbon.network/info/denom_gecko_map // orbit brige: https://bridge.orbitchain.io/open/v1/api/monitor/rawTokenList -const ibcChains = ['ibc', 'terra', 'terra2', 'crescent', 'osmosis', 'kujira', 'stargaze', 'juno', 'injective', 'cosmos', 'comdex', 'stargaze', 'umee', 'orai', 'persistence', 'fxcore', 'neutron', 'quasar', 'chihuahua',] +const ibcChains = ['ibc', 'terra', 'terra2', 'crescent', 'osmosis', 'kujira', 'stargaze', 'juno', 'injective', 'cosmos', 'comdex', 'stargaze', 'umee', 'orai', 'persistence', 'fxcore', 'neutron', 'quasar', 'chihuahua', 'sei'] const caseSensitiveChains = [...ibcChains, 'solana', 'tezos', 'ton', 'algorand', 'aptos', 'near', 'bitcoin', 'waves', 'tron', 'litecoin', 'polkadot', 'ripple', 'elrond', 'cardano', 'stacks', 'sui', 'ergo',] const distressedAssts = new Set(Object.values({ diff --git a/projects/terraswap/factoryTvl.js b/projects/terraswap/factoryTvl.js index 3f24e067a3f..a29df76e9f1 100644 --- a/projects/terraswap/factoryTvl.js +++ b/projects/terraswap/factoryTvl.js @@ -37,7 +37,7 @@ async function getAllPairs(factory, chain) { dtos.push(pairDto) }) await PromisePool - .withConcurrency(31) + .withConcurrency(25) .for(allPairs) .process(getPairPool) return dtos From efa860c058c3978e034a3ffbea4bce26bde216b6 Mon Sep 17 00:00:00 2001 From: AlgoRai Finance <114914798+AlgoRai@users.noreply.github.com> Date: Wed, 16 Aug 2023 20:43:39 +0800 Subject: [PATCH 0833/1974] Add new strategy vaults (#7170) * Update tvl for ethereum on algorai-finance. * Add PEPE vault * Add new strategy vaults --------- Co-authored-by: Vitali Co-authored-by: Giorgi --- projects/algorai-finance/constants.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/projects/algorai-finance/constants.js b/projects/algorai-finance/constants.js index 975079ea9af..2be17c34296 100644 --- a/projects/algorai-finance/constants.js +++ b/projects/algorai-finance/constants.js @@ -50,6 +50,21 @@ const vaults = [ assetDecimals: 4, coingecko: 'pepe', }, + { + vaultID: 1146813039, + assetDecimals: 6, + coingecko: 'algorand', + }, + { + vaultID: 1170260887, + assetDecimals: 6, + coingecko: 'usd-coin', + }, + { + vaultID: 1170261298, + assetDecimals: 6, + coingecko: 'usd-coin', + } ]; From 52e35aedf0cabfa269c4f4f931bbb9681160b5cd Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 16 Aug 2023 18:22:47 +0530 Subject: [PATCH 0834/1974] Vivaleva (#7171) --- projects/vivaleva/index.js | 63 ++++++-------------------------------- 1 file changed, 9 insertions(+), 54 deletions(-) diff --git a/projects/vivaleva/index.js b/projects/vivaleva/index.js index ea3fec09fa2..639952f994b 100644 --- a/projects/vivaleva/index.js +++ b/projects/vivaleva/index.js @@ -1,58 +1,13 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const vaults = [ - { - symbol: "ibETH", - decimals: 18, - baseTokenAddress: ADDRESSES.era.WETH, - address: "0x23FDd6487a17abB8360E8Da8b1B370C94ee94Cc2", - }, - { - symbol: "ibUSDC", - decimals: 6, - baseTokenAddress: ADDRESSES.era.USDC, - address: "0x0755DA5D9e9A722A9e5cc4bb83742387ae2990a5", - }, -]; -const syncswapWorkers = [ - { - name: "ETH-USDC Syncswap Farm", - address: "0x39356ed5dC2F7Ea897296e07E97b59Af9C8153Ec", - farmingTokenAddress: ADDRESSES.era.WETH, - baseTokenAddress: ADDRESSES.era.USDC, - lpToken: "0x80115c708E12eDd42E504c1cD52Aea96C547c05c", - }, - { - name: "USDC-ETH Syncswap Farm", - address: "0x3A613EFAe4a6A6447A9D784E398730811a57af6e", - farmingTokenAddress: ADDRESSES.era.USDC, - baseTokenAddress: ADDRESSES.era.WETH, - lpToken: "0x80115c708E12eDd42E504c1cD52Aea96C547c05c", - }, - { - name: "USDT-ETH Syncswap Farm", - address: "0x95C78e21Beb54314fe5A4571E7361f6c6A144B2f", - farmingTokenAddress: ADDRESSES.era.USDT, - baseTokenAddress: ADDRESSES.era.WETH, - lpToken: "0xd3D91634Cf4C04aD1B76cE2c06F7385A897F54D3", - }, - { - name: "USDT-USDC Syncswap Farm", - address: "0xfbF4BcD3266Af20B72dc484F6D7Dc13855885ba0", - farmingTokenAddress: ADDRESSES.era.USDT, - baseTokenAddress: ADDRESSES.era.USDC, - lpToken: "0x0E595bfcAfb552F83E25d24e8a383F88c1Ab48A4", - }, -]; +const { getConfig } = require('../helper/cache') module.exports = { timetravel: false, - misrepresentedTokens: true, era: { async tvl(_, _1, _2, { api }) { - const vaultBalances = await api.multiCall({ - abi: "uint256:vaultBalance", - calls: vaults.map((v) => v.address), - }); + const data = await getConfig('vivaleva', "https://sbb.sooho.io/api/v1/external/vivaleva/defiLlama") + const vaults = data.vaults; + const syncswapWorkers = data.syncSwapWorkers; + const vaultBalances = await api.multiCall({ abi: "uint256:vaultBalance", calls: vaults.map((v) => v.address), }); vaults.forEach((v, i) => { api.add(v.baseTokenAddress, vaultBalances[i]); @@ -66,10 +21,10 @@ module.exports = { token1s, ] = await Promise.all([ api.multiCall({ abi: "uint256:totalStakedLpBalance", calls: syncswapWorkers.map((v) => v.address), }), - api.multiCall({ abi: "function getReserves() view returns (uint256, uint256)", calls: syncswapWorkers.map((v) => v.lpToken), }), - api.multiCall({ abi: "uint256:totalSupply", calls: syncswapWorkers.map((v) => v.lpToken), }), - api.multiCall({ abi: "address:token0", calls: syncswapWorkers.map((v) => v.lpToken), }), - api.multiCall({ abi: "address:token1", calls: syncswapWorkers.map((v) => v.lpToken), }), + api.multiCall({ abi: "function getReserves() view returns (uint256, uint256)", calls: syncswapWorkers.map((v) => v.lpTokenAddress), }), + api.multiCall({ abi: "uint256:totalSupply", calls: syncswapWorkers.map((v) => v.lpTokenAddress), }), + api.multiCall({ abi: "address:token0", calls: syncswapWorkers.map((v) => v.lpTokenAddress), }), + api.multiCall({ abi: "address:token1", calls: syncswapWorkers.map((v) => v.lpTokenAddress), }), ]); syncswapWorkers.forEach((w, i) => { From ac97f321271aa143a308e365692bd4446ed21425 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 16 Aug 2023 18:40:18 +0530 Subject: [PATCH 0835/1974] Term-finance (#7172) * Adds term-finance adapter to defillama. * minor refactor --------- Co-authored-by: Robert Chu Co-authored-by: g1nt0ki --- projects/term-finance/index.js | 35 ++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 projects/term-finance/index.js diff --git a/projects/term-finance/index.js b/projects/term-finance/index.js new file mode 100644 index 00000000000..89633d41637 --- /dev/null +++ b/projects/term-finance/index.js @@ -0,0 +1,35 @@ +const { cachedGraphQuery } = require('../helper/cache') + +const graphs = { + ethereum: + "https://api.studio.thegraph.com/query/33765/term-finance-mainnet/version/latest", +}; + +const query = ` +query poolQuery($lastId: ID) { + termRepoCollaterals( + first: 1000, + where: { + id_gt: $lastId, + term_: { delisted: false } + } + ) { + term { termRepoLocker } + collateralToken + } +}` + +module.exports = { + methodology: `Counts the collateral tokens locked in Term Finance's term repos.`, + // hallmarks: [[1588610042, "TermFinance Launch"]], +}; + +Object.keys(graphs).forEach(chain => { + const host = graphs[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const data = await cachedGraphQuery(`term-finance-${chain}`, host, query, { fetchById: true }) + return api.sumTokens( { tokensAndOwners: data.map(i => [i.collateralToken, i.term.termRepoLocker])}) + } + } +}) From 5a8c8531940a7aaf11132bcc16544a2e59cae46f Mon Sep 17 00:00:00 2001 From: g1nt0ki Date: Wed, 16 Aug 2023 15:37:14 +0200 Subject: [PATCH 0836/1974] track https://www.onering.tools/ --- projects/one-ring-tools/index.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 projects/one-ring-tools/index.js diff --git a/projects/one-ring-tools/index.js b/projects/one-ring-tools/index.js new file mode 100644 index 00000000000..bfe3dc5016e --- /dev/null +++ b/projects/one-ring-tools/index.js @@ -0,0 +1,16 @@ +const { sumTokens2 } = require("../helper/unwrapLPs"); +const STAKING_LP_USDC_DOLA = "0x33ff52D1c4b6973CD5AF41ad53Dd92D99D31D3c3"; +const LP_USDC_DOLA = "0xB720FBC32d60BB6dcc955Be86b98D8fD3c4bA645"; + +async function tvl(_, _1, _2, { api }) { + const lpBal = await api.call({ abi: 'erc20:balanceOf', target: '0xa1034ed2c9eb616d6f7f318614316e64682e7923', params: STAKING_LP_USDC_DOLA}) + api.add(LP_USDC_DOLA, lpBal) + return sumTokens2({ api, resolveLP: true, }) +} + +module.exports = { + methodology: "Calculate TVL of staking lp product", + optimism: { + tvl, + }, +}; From f4967b5662c47e084597b9a01879e3be10d00f70 Mon Sep 17 00:00:00 2001 From: g1nt0ki Date: Wed, 16 Aug 2023 15:41:13 +0200 Subject: [PATCH 0837/1974] add hallmark --- projects/swirllend/index.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/projects/swirllend/index.js b/projects/swirllend/index.js index 5f394d4dad9..0aa2de2dc64 100644 --- a/projects/swirllend/index.js +++ b/projects/swirllend/index.js @@ -12,4 +12,11 @@ module.exports = { fetchBalances: true, cether: '0x91067b912f89dfca50c3f5529dbeb78b63c6a2e5', }), + + hallmarks: [ + [Math.floor(new Date('2023-09-q6')/1e3), 'Project Rugged!'], + ], }; + +module.exports.base.borrowed = () => ({}) +module.exports.linea.borrowed = () => ({}) From 4d53d64739ed4275d1ccd8a9bc92b1769d3914a2 Mon Sep 17 00:00:00 2001 From: g1nt0ki Date: Wed, 16 Aug 2023 15:42:28 +0200 Subject: [PATCH 0838/1974] bugfix --- projects/swirllend/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/swirllend/index.js b/projects/swirllend/index.js index 0aa2de2dc64..fe8166e5d62 100644 --- a/projects/swirllend/index.js +++ b/projects/swirllend/index.js @@ -14,7 +14,7 @@ module.exports = { }), hallmarks: [ - [Math.floor(new Date('2023-09-q6')/1e3), 'Project Rugged!'], + [Math.floor(new Date('2023-09-16')/1e3), 'Project Rugged!'], ], }; From 4c25df8dc42dbef9298a6141b28db53abebba226 Mon Sep 17 00:00:00 2001 From: k4rr0ws <119109251+k4rr0ws@users.noreply.github.com> Date: Wed, 16 Aug 2023 10:13:23 -0400 Subject: [PATCH 0839/1974] impls.finance adapter (#7173) * impls.finance adapter * code refactor --------- Co-authored-by: Kairos Co-authored-by: g1nt0ki --- projects/implsfinance/abi.json | 5 ++++ projects/implsfinance/index.js | 46 ++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 projects/implsfinance/abi.json create mode 100644 projects/implsfinance/index.js diff --git a/projects/implsfinance/abi.json b/projects/implsfinance/abi.json new file mode 100644 index 00000000000..184e0f6aa23 --- /dev/null +++ b/projects/implsfinance/abi.json @@ -0,0 +1,5 @@ +{ + "LPtoken": "address:LPtoken", + "balanceLPinSystem": "uint256:balanceLPinSystem", + "stakingToken": "address:stakingToken" +} \ No newline at end of file diff --git a/projects/implsfinance/index.js b/projects/implsfinance/index.js new file mode 100644 index 00000000000..51f14be488a --- /dev/null +++ b/projects/implsfinance/index.js @@ -0,0 +1,46 @@ +const abi = require("./abi.json"); +const { sumTokens2 } = require("../helper/unwrapLPs"); +const { sumTokensExport } = require('../helper/unknownTokens') + +const coreRewards = "0xF32c5c83e19640ad414dC5922C0F9182F4695D69"; +const plsRewards = "0xD7ba719d28079253e96b57A6518C41eeA2Be048d"; +const IMPLS = "0x5f63BC3d5bd234946f18d24e98C324f629D9d60e"; + +const vaults = [ + //PulseX DAI/PLS + "0xb098D878471c451Ccb521E391f7C98bD4709bfe9", + + //PulseX PLSX/PLS + "0x97248ba432ED71FC933374884BcF8Ac0C42b5Df9", + + //PulseX HEX/PLS + "0x9A563280F4Cc938e426ec220a2659cF7AE125ab6", + + //Daytona TONI/PLS + "0x3ed45e98b9358E9cd39f06726F382eA1155656f5", + +]; + +/*** Staking of native token IMPLS and IMPLS/PLS LP TVL Portion ***/ +const pool2 = async (timestamp, ethBlock, chainBlocks, { api }) => { + const staking_lpToken = await api.call({ abi: abi.stakingToken, target: coreRewards, }) + return sumTokens2({ api, tokens: [staking_lpToken], owners: [coreRewards, plsRewards] }) +}; + + +/*** vaults TVL portion ***/ +const plsTvl = async (timestamp, ethBlock, chainBlocks, { api }) => { + const tokens = await api.multiCall({ abi: abi.LPtoken, calls: vaults}) + const bals = await api.multiCall({ abi: abi.balanceLPinSystem, calls: vaults}) + api.addTokens(tokens, bals) +}; + +module.exports = { + doublecounted: true, + pulse: { + tvl: plsTvl, + staking: sumTokensExport({ owners: [coreRewards, plsRewards], tokens: [IMPLS], useDefaultCoreAssets: true, lps: ['0xf121E6e093E2C070F2d982F85726084A776A963f'] }), + pool2, + }, + methodology: `The TVL is made up of the core rewards yield farm and LP deposits in our auto compounding vault strategies.`, +}; From 61ddafee1e3d2c92aef6822931944d352eb06730 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Wed, 16 Aug 2023 17:17:35 +0100 Subject: [PATCH 0840/1974] add friendtech --- projects/friendtech/index.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 projects/friendtech/index.js diff --git a/projects/friendtech/index.js b/projects/friendtech/index.js new file mode 100644 index 00000000000..7fb68a73090 --- /dev/null +++ b/projects/friendtech/index.js @@ -0,0 +1,14 @@ +const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') + +const contract = "0xcf205808ed36593aa40a44f10c7f7c2f67d4a4d4" + +async function tvl(time, ethBlock, _b, {api}) { + return sumTokens2({ tokens: [nullAddress], owner: contract, api }) +} + +module.exports = { + methodology: `We count the ETH on ${contract}`, + base: { + tvl + } +} \ No newline at end of file From e793e3afa60be1240584be672b046e58da557ce3 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Wed, 16 Aug 2023 17:34:11 +0100 Subject: [PATCH 0841/1974] add binaryswap --- projects/binaryswap/index.js | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 projects/binaryswap/index.js diff --git a/projects/binaryswap/index.js b/projects/binaryswap/index.js new file mode 100644 index 00000000000..a5892450f56 --- /dev/null +++ b/projects/binaryswap/index.js @@ -0,0 +1,7 @@ +const {getUniTVL} = require("../helper/unknownTokens"); + +module.exports = { + op_bnb: { + tvl: getUniTVL({ factory: "0xd50aaE6C73E2486B0Da718D23F35Dcf5aad25911", useDefaultCoreAssets: true,}) + }, +}; \ No newline at end of file From be69f973e9ff2e7a2cfd1b0889ce38db86fc64b0 Mon Sep 17 00:00:00 2001 From: 0xngmi <80541789+0xngmi@users.noreply.github.com> Date: Wed, 16 Aug 2023 17:38:05 +0100 Subject: [PATCH 0842/1974] add thorchain pause --- projects/thorchain/index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/projects/thorchain/index.js b/projects/thorchain/index.js index dce3ed2f531..a019d050246 100644 --- a/projects/thorchain/index.js +++ b/projects/thorchain/index.js @@ -90,7 +90,8 @@ async function tvl(_, _1, _2, { api }) { module.exports = { hallmarks: [ - [1658145600, "Kill Switch"] //https://twitter.com/THORChain/status/1549078524253847553?ref_src=twsrc%5Etfw%7Ctwcamp%5Etweetembed%7Ctwterm%5E1549078524253847553%7Ctwgr%5Edf22fb0a2751e6182143d32b477f2b7f759b8a9f%7Ctwcon%5Es1_&ref_url=https%3A%2F%2Ffinance.yahoo.com%2Fnews%2Fthorchain-phases-support-rune-tokens-123034231.html + [1626656400, "Protocol paused"], + [1631754000, "Protocol resumed"], ], timetravel: false, thorchain: { @@ -101,4 +102,4 @@ module.exports = { Object.keys(chainMapping).map(getDChain).forEach(chain => { module.exports[chain] = {tvl } -}) \ No newline at end of file +}) From 476161a2bcca67880be25a550fbdc02e96813f24 Mon Sep 17 00:00:00 2001 From: v2 Swap <141723211+v2swap@users.noreply.github.com> Date: Wed, 16 Aug 2023 22:58:04 +0500 Subject: [PATCH 0843/1974] Add v2swap (#7174) * Add v2swap added v2swap (a uniswap V2 fork) and the way to calculate its TVL * code refactor --------- Co-authored-by: g1nt0ki --- package-lock.json | 12 ++++++------ projects/helper/chains.json | 1 + projects/helper/tokenMapping.js | 3 +++ projects/v2swap/index.js | 13 +++++++++++++ 4 files changed, 23 insertions(+), 6 deletions(-) create mode 100644 projects/v2swap/index.js diff --git a/package-lock.json b/package-lock.json index 37383e00d9e..30200992eed 100644 --- a/package-lock.json +++ b/package-lock.json @@ -63,9 +63,9 @@ } }, "node_modules/@defillama/sdk": { - "version": "4.0.43", - "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.43.tgz", - "integrity": "sha512-SS311nPgkIOEbqWe3n2kT8n3UKyLQhQmJcEhlMhv6XnPhIBk4l7kLQXQmOYHpetAZmvUxOVnQwZbl75vh2EM5w==", + "version": "4.0.45", + "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.45.tgz", + "integrity": "sha512-cdHNvl3kvucjkjCA2+baHSVQ86wjFdB3wMFS713xKn05b0f712hVM3m2zKzr4MzBBJu825Fpozl9H2kmUzVdvw==", "dependencies": { "@supercharge/promise-pool": "^2.1.0", "ethers": "^5.4.5", @@ -4194,9 +4194,9 @@ } }, "@defillama/sdk": { - "version": "4.0.43", - "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.43.tgz", - "integrity": "sha512-SS311nPgkIOEbqWe3n2kT8n3UKyLQhQmJcEhlMhv6XnPhIBk4l7kLQXQmOYHpetAZmvUxOVnQwZbl75vh2EM5w==", + "version": "4.0.45", + "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.45.tgz", + "integrity": "sha512-cdHNvl3kvucjkjCA2+baHSVQ86wjFdB3wMFS713xKn05b0f712hVM3m2zKzr4MzBBJu825Fpozl9H2kmUzVdvw==", "requires": { "@supercharge/promise-pool": "^2.1.0", "ethers": "^5.4.5", diff --git a/projects/helper/chains.json b/projects/helper/chains.json index 53240c13496..f087562349a 100644 --- a/projects/helper/chains.json +++ b/projects/helper/chains.json @@ -144,6 +144,7 @@ "ontology", "ontology_evm", "onus", + "op_bnb", "optimism", "ore", "orai", diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 0ad33027ac8..c82dfcec840 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -55,6 +55,9 @@ const fixBalancesTokens = { aura: { 'uaura': { coingeckoId: 'aura-network', decimals: 6 }, }, + op_bnb: { + '0xa457653a7dbe1fdf314e30327d6ec0c5b2cfbd8a': { coingeckoId: 'binance-coin', decimals: 18 }, + }, } ibcChains.forEach(chain => fixBalancesTokens[chain] = { ...ibcMappings, ...(fixBalancesTokens[chain] || {}) }) diff --git a/projects/v2swap/index.js b/projects/v2swap/index.js new file mode 100644 index 00000000000..80092fa4fe5 --- /dev/null +++ b/projects/v2swap/index.js @@ -0,0 +1,13 @@ +const { getUniTVL } = require('../helper/unknownTokens') +const FACTORY = "0x4811110638201b5878abe23e406DdA9De9Ad7B20" // This factory is on opBNB Mainnet (Chain Id: 204) + +const dexTVL = getUniTVL({ factory: FACTORY, useDefaultCoreAssets: true, fetchBalances: true, permitFailure: true }) + + +module.exports = { + misrepresentedTokens: true, + methodology: `Uses factory(${FACTORY}) address to find and price Liquidity Pool pairs.`, + op_bnb: { + tvl: dexTVL, + } +}; \ No newline at end of file From 11d3801a18aaf6cc41ce793f88765f9cb156e440 Mon Sep 17 00:00:00 2001 From: g1nt0ki Date: Wed, 16 Aug 2023 20:03:05 +0200 Subject: [PATCH 0844/1974] hotfix for op_bnb --- projects/helper/tokenMapping.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index c82dfcec840..5bba7aeeef9 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -56,7 +56,8 @@ const fixBalancesTokens = { 'uaura': { coingeckoId: 'aura-network', decimals: 6 }, }, op_bnb: { - '0xa457653a7dbe1fdf314e30327d6ec0c5b2cfbd8a': { coingeckoId: 'binance-coin', decimals: 18 }, + '0xa457653a7dbe1fdf314e30327d6ec0c5b2cfbd8a': { coingeckoId: 'binancecoin', decimals: 18 }, + '0x4200000000000000000000000000000000000006': { coingeckoId: 'binancecoin', decimals: 18 }, }, } From 2e397bccc5c131923bcc338aad327272d8f70e94 Mon Sep 17 00:00:00 2001 From: TJakubek <39831436+TJakubek@users.noreply.github.com> Date: Wed, 16 Aug 2023 20:38:30 +0200 Subject: [PATCH 0845/1974] Enosys - adding newest flare-ethereum usdt bridge (#7177) --- projects/enosys-bridge/index.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/projects/enosys-bridge/index.js b/projects/enosys-bridge/index.js index d67772ce7ea..eb3059006db 100644 --- a/projects/enosys-bridge/index.js +++ b/projects/enosys-bridge/index.js @@ -3,5 +3,11 @@ const ADDRESSES = require('../helper/coreAssets.json') module.exports = { xdc: { tvl: sumTokensExport({ owner: '0xd5308a4bb2d7121a26d0bd11257245f0efda2bc4', tokens: [ADDRESSES.xdc.WXDC] }) }, - ethereum: { tvl: sumTokensExport({ owner: '0x8936761f2903ed1af2b269e6fa3a79ebb0162c51', tokens: [ADDRESSES.ethereum.USDT] }) }, + ethereum: { tvl: sumTokensExport({ + tokensAndOwners: [ + [ADDRESSES.ethereum.USDT,'0x8936761f2903ed1af2b269e6fa3a79ebb0162c51'], + [ADDRESSES.ethereum.USDT, '0x37aca97a99d1b4260a5e9821d0ef14947fb68970'] + ]} + ) + }, } \ No newline at end of file From b144a4a67ea6b65bf3e9c8103630238b9ee18b88 Mon Sep 17 00:00:00 2001 From: Bridge <142407089+Bridge-LZ@users.noreply.github.com> Date: Wed, 16 Aug 2023 19:41:51 +0100 Subject: [PATCH 0846/1974] add Bridge (#7176) * add Bridge * code refactor --------- Co-authored-by: g1nt0ki --- projects/bridge-lz/index.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 projects/bridge-lz/index.js diff --git a/projects/bridge-lz/index.js b/projects/bridge-lz/index.js new file mode 100644 index 00000000000..9754a1d2f19 --- /dev/null +++ b/projects/bridge-lz/index.js @@ -0,0 +1,17 @@ +const { sumTokensExport, nullAddress } = require("../helper/unwrapLPs"); + +const ADMIN_ADDRESSES = { + base: "0x233dc79F924c35AcB4524BaC4A883c8CE11A75B2", + optimism: "0x233dc79F924c35AcB4524BaC4A883c8CE11A75B2", +} + +module.exports = { + methodology: + "Adds up the total value locked as collateral on the Bridge platform" +} + +Object.keys(ADMIN_ADDRESSES).forEach(chain => { + module.exports[chain] = { + tvl: sumTokensExport({ owner: ADMIN_ADDRESSES[chain], tokens: [nullAddress]}) + } +}) \ No newline at end of file From 5f6d321e2fefca1aa042d6d896195c0a1f868f9a Mon Sep 17 00:00:00 2001 From: g1nt0ki Date: Wed, 16 Aug 2023 20:47:22 +0200 Subject: [PATCH 0847/1974] fix hallmark --- projects/swirllend/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/swirllend/index.js b/projects/swirllend/index.js index fe8166e5d62..ec5925e93ec 100644 --- a/projects/swirllend/index.js +++ b/projects/swirllend/index.js @@ -14,7 +14,7 @@ module.exports = { }), hallmarks: [ - [Math.floor(new Date('2023-09-16')/1e3), 'Project Rugged!'], + [Math.floor(new Date('2023-08-16')/1e3), 'Project Rugged!'], ], }; From 5d20be32bbaad8bae8a4554726664c4118ee15cf Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Wed, 16 Aug 2023 21:45:32 +0100 Subject: [PATCH 0848/1974] optimism staking for paraswap --- projects/paraswap.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/projects/paraswap.js b/projects/paraswap.js index 488964c1399..e6d8b68a042 100644 --- a/projects/paraswap.js +++ b/projects/paraswap.js @@ -1,5 +1,6 @@ const {sumTokens2, } = require("./helper/unwrapLPs.js") const { getConfig } = require("./helper/cache.js") +const { stakings } = require("./helper/staking.js") // PSP staking for sPSP in each PMM pool (used for signalling amon other things) const PSP = '0xcafe001067cdef266afb7eb5a286dcfd277f3de5' @@ -25,4 +26,9 @@ module.exports = { pool2: safetyModuleStaking, tvl: () => ({}), }, + optimism: { + staking: stakings(["0x8C934b7dBc782568d14ceaBbEAeDF37cB6348615"], "0xd3594E879B358F430E20F82bea61e83562d49D48", "optimism"), + pool2: stakings(["0x26Ee65874f5DbEfa629EB103E7BbB2DEAF4fB2c8"], "0x11f0b5cca01b0f0a9fe6265ad6e8ee3419c68440", "optimism"), + tvl: () => ({}), + }, } From a2103c3d3f9dafc909aa5a507ac561c8d3f406a0 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Wed, 16 Aug 2023 23:37:22 +0100 Subject: [PATCH 0849/1974] add brewlabs treasury --- projects/treasury/brewlabs.js | 47 +++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 projects/treasury/brewlabs.js diff --git a/projects/treasury/brewlabs.js b/projects/treasury/brewlabs.js new file mode 100644 index 00000000000..f2c681e28ef --- /dev/null +++ b/projects/treasury/brewlabs.js @@ -0,0 +1,47 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const bscTreasury = "0x5Ac58191F3BBDF6D037C6C6201aDC9F99c93C53A"; +const ethTreasury = "0x64961Ffd0d84b2355eC2B5d35B0d8D8825A774dc"; +const polygonTreasury = "0x3f0DaF02b9cF0DBa7aeF41C1531450Fda01E8ae9"; +const BREWLABS = "0x6aAc56305825f712Fd44599E59f2EdE51d42C3e7"; +const ethBREWLABS = "0xdAd33e12e61dC2f2692F2c12e6303B5Ade7277Ba"; + + +module.exports = treasuryExports({ + bsc: { + tokens: [ + nullAddress, + '0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56',//busd + '0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c',//wbnb + '0x55d398326f99059fF775485246999027B3197955',//bsc-usd + '0x9d7107c8E30617CAdc11f9692A19C82ae8bbA938',//roo + '0xF14D3692B0055Db9Ca4c04065165d59B87E763f1',//mbc + '0xe91a8D2c584Ca93C7405F15c22CdFE53C29896E3',//dext + '0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82',//cake + ], + owners: [bscTreasury], + ownTokens: [BREWLABS], + }, + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.USDC, + '0x4FD51Cb87ffEFDF1711112b5Bd8aB682E54988eA',//wpt + ADDRESSES.ethereum.USDT, + '0x235C8EE913d93c68D2902a8e0b5a643755705726',//bag + ADDRESSES.ethereum.WETH, + '0x9d7107c8E30617CAdc11f9692A19C82ae8bbA938',//roo + '0x089729b0786C8803cff972c16e402f3344d079eA',//bgpt + ], + owners: [ethTreasury], + ownTokens: [ethBREWLABS], + }, + polygon: { + tokens: [ + nullAddress, + ], + owners: [polygonTreasury], + ownTokens: [], + }, +}) \ No newline at end of file From 4e888cd7025f49ce753f6f41eb00a9667ae0515e Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 17 Aug 2023 07:55:37 +0200 Subject: [PATCH 0850/1974] op_bnb fix --- package-lock.json | 12 ++++++------ projects/helper/coreAssets.json | 3 +++ projects/helper/tokenMapping.js | 4 ---- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/package-lock.json b/package-lock.json index 30200992eed..5153cb6bb19 100644 --- a/package-lock.json +++ b/package-lock.json @@ -63,9 +63,9 @@ } }, "node_modules/@defillama/sdk": { - "version": "4.0.45", - "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.45.tgz", - "integrity": "sha512-cdHNvl3kvucjkjCA2+baHSVQ86wjFdB3wMFS713xKn05b0f712hVM3m2zKzr4MzBBJu825Fpozl9H2kmUzVdvw==", + "version": "4.0.46", + "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.46.tgz", + "integrity": "sha512-CC3dnZg9xYQP5gyx5CeKI0YF1877SH7pEwVn1hHguMJbOUJQERmbXSCI6yDDBUBoBB/Ai8o8yhdPgrFRT8Wt4A==", "dependencies": { "@supercharge/promise-pool": "^2.1.0", "ethers": "^5.4.5", @@ -4194,9 +4194,9 @@ } }, "@defillama/sdk": { - "version": "4.0.45", - "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.45.tgz", - "integrity": "sha512-cdHNvl3kvucjkjCA2+baHSVQ86wjFdB3wMFS713xKn05b0f712hVM3m2zKzr4MzBBJu825Fpozl9H2kmUzVdvw==", + "version": "4.0.46", + "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.46.tgz", + "integrity": "sha512-CC3dnZg9xYQP5gyx5CeKI0YF1877SH7pEwVn1hHguMJbOUJQERmbXSCI6yDDBUBoBB/Ai8o8yhdPgrFRT8Wt4A==", "requires": { "@supercharge/promise-pool": "^2.1.0", "ethers": "^5.4.5", diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index df372962eac..141b37135f0 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -1359,5 +1359,8 @@ "USDTet": "factory/sei189adguawugk3e55zn63z8r9ll29xrjwca636ra7v7gxuzn98sxyqwzt47l/HktfLoADCk9mnjv7XJiN4YXK9ayE6xinLzt8wzcsR2rY", "USDTbs": "factory/sei189adguawugk3e55zn63z8r9ll29xrjwca636ra7v7gxuzn98sxyqwzt47l/871jbn9unTavWsAe83f2Ma9GJWSv6BKsyWYLiQ6z3Pva", "WBTC": "factory/sei189adguawugk3e55zn63z8r9ll29xrjwca636ra7v7gxuzn98sxyqwzt47l/7omXa4gryZ5NiBmLep7JsTtTtANCVKXwT9vbN91aS1br" + }, + "op_bnb": { + "WBNB": "0x4200000000000000000000000000000000000006" } } diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 5bba7aeeef9..0ad33027ac8 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -55,10 +55,6 @@ const fixBalancesTokens = { aura: { 'uaura': { coingeckoId: 'aura-network', decimals: 6 }, }, - op_bnb: { - '0xa457653a7dbe1fdf314e30327d6ec0c5b2cfbd8a': { coingeckoId: 'binancecoin', decimals: 18 }, - '0x4200000000000000000000000000000000000006': { coingeckoId: 'binancecoin', decimals: 18 }, - }, } ibcChains.forEach(chain => fixBalancesTokens[chain] = { ...ibcMappings, ...(fixBalancesTokens[chain] || {}) }) From 1b470741cc4a121727d10ce38be2f814e17b3826 Mon Sep 17 00:00:00 2001 From: Tan Date: Thu, 17 Aug 2023 02:03:07 -0400 Subject: [PATCH 0851/1974] Add duckpools (#7178) * Add duckpools * Fix duckpools implementation * fix imports * add nullAddress * fix import * erg pool * just erg * only sigusd * only sigrsv * only quacks * final fix * add collateral contracts --- projects/duckpools.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 projects/duckpools.js diff --git a/projects/duckpools.js b/projects/duckpools.js new file mode 100644 index 00000000000..67e09bfe3fa --- /dev/null +++ b/projects/duckpools.js @@ -0,0 +1,26 @@ +const { sumTokensExport } = require("./helper/chain/ergo"); +const { nullAddress } = require("./helper/tokenMapping"); + +module.exports = { + timetravel: false, + ergo: { + tvl: sumTokensExport({ + owners: [ + "3F9bBReNRNpy8HU2PNNRbCdHgzj6F5WgDmKSRAg7bkW3qaJ3VrjQkfqVX8BxikVHLUe7YeXhYSZ6AvwA2Wze8yBQJbK4rvfbsDnm2kdebdTfJUJgVQxyPmvwqwExyoP2TQHpQQLqqwsYgTXPKjnWySGbPtAxRgaoHiJiAmg8jp5AK2LHagDmM2XMyjYy8G8BLSA2t3XmvuWeEt5HPtDN53iigDNv3HZ9FGJXJVJRg3iF5Jnq7tk1xS18PJeSdadmQtZrfSYiET3ojE7SDstGPKB8gczd6b8SGgfc4sXyCg6jxPwXQQDHRNk7JHXeKs4LoSxnHy1WSLqfvHZ6hTef3NjCpLkewoSLEQVSMhWcZMZhcD2zFxeeN3SqT9UAg2n2yGKiXb2c7kDtneXNPgqJj2U2hCNQT6EKpBQphahQ3md7LdoixmcLVDGwkbe73SWQr43eusEooLtigYB9ySAoSTzgbxFbdtF7yXY6jX7hCDu34WyPpvw8e4JEt4fRz8NVtUS7V2BoM8qBoVV65EYfRvTcdP8g5aTRhbjig91aJpZYHu8W1xupGgZeHtRtFs6fw7Cks2zS4fvsxcP4TBL77TaNzzpAvd3HBfK2oW34Qk4eHPFyUukX322dn1nPnFYS6kWqMof2M4rMHT9N1xKCEKPG4HecKoomAnvMDhMQxictrp3FyFR5h3zUWNhULA9HTi9Aj9XXCEyDt5gSTNQdBSrM7uvbBMjeJWdkrpuFFMYNA9yoQZn4AZqvjLj3ZfTVBs5NGyZu997GhRCzGhTmrkxJwDXdCJ62EjE9b6ZJkCkqwxzMJgKtm9TyKyPpS2kqUjD2cCBPHakyVeo9WYdj5Y25FWq7VZBEzqBuECwpXuXWyM3tECRi52uQkBDnhRhfwpPkZJXqjB2ns4HcmVHYk14e9fLiFXPxGs4Q4db9D2igM4beGTdu4HiNAaeH1xMNyLEy4fPUFx41RH77nFqxaxHJiqMdSUioiCfQbxH2Pn7rSaMJNfB1HeXKzfobc4mmTRnu5yyzpSRHFTBc4yVbrdtoVZS86fty5rwUBHuhiiabpUyHdEWygKDdoiAFZ7Unio8uPsDEmG26eZc6kcrt2WmwV6xkGYKk374j6tLTPSJyC4DhjAdSKpQiLzEaRuJN1qdB8hZpBZhuFoziertayGN6sEARegJf67182CPZy6QXwcUyiZJ3GD2g9365o64ThDgvnU61jHeUrgMqYn3LDU6PRgwG2n7dGnqPLbTRAo6mxnPT1oPtDC5JZ7tCgvyj5BCN6HUB6wAxwdvSSDkJiSPkKbCTs7JSwfidpFBpEuaSKm5syBZshGmkpT3dRUgC9qFaVmQQCxfM4zBtRecYHwsnK6RvoMmdVLpFbe3WQED5NKC8ir6eGWumFYdKP82cYfuRy5vke9WVxYrcsec7a5BUj2uhcn7Taeej3k3rvUXDeGT12ht484s4PwtGr1LKxKtGszdJSBucWfwu667bZw2nQm8hd55uKEQJPscMk2KEcA7JfsoWGLWpcTG7mBRHnJw1qC5d339di3a4MoNbmax8HXG4hiPEVMrrt48aYWSoKS9uwCPZCbAkanxrY3DGr6SiSdvU6r9EVcLffVEpEWJaw6Yh45jPiZyMRGc9AVgLzUagw8qedrbxjR4KJUi9AGsH9ondzQGM9ds2NYPfAwpeDH1vLqwKbRYcKjdL6regdmXwdveJsKzUwDY4x1UmHe", + "6Q6fbqfbMAogw42DWDtKuKt9frSKdqW92cmiPbeF2SnuYCS9Ca43ZAiJvR7KjZoWJZZTvABJafgBobWJmGkqMNgFsnp9YQS3RjCagcJdgr6nisusAAuz2wEpxXazzQPYdstFxNiW9ewnL6usAry4nyaydtEUuCaBf3yvPsdGTh9w9x4PLcj9rd71JzNBx9yS8hVd4H61hKXZgE51UQqsrQp9o3qYp4b219R1x6Cvj3ejvBDYanjomykDi8KLv9doW4BgzSqvoTf5hiHK5rcbt4Kf97bZD5hEyWZidNW2R1hpJM67tG2uNt4XxstCptGvH1Kp3ehBm5v1N7CEcUdJQBqHTrZ4Bj7Fwkg1vK7NZQExqHEE9MnuRmHPYtn4SKegR31WTUgR9RcHZ9QgW1a4adT3eR679mjWSDYmRMAt6BjLGK66a1oaZfunFDRz8fDU3hzhoSphTzo2wDvFLWKqsCW7GWY4FPnvnGJBEyet8vd2VwLYoXtHjivhoZYubiHbWFewng7iNeYy1wHWETrLyK4L149yqVVgL3EK6p9e9TURurcKvxFurp6FGFsfEniMdc1z8n3qAXizxKEQLkqmLYd2KBVmF1uXwYhphPha8pcLx59zJfEtxww5Ch6JhTRxmDkfBqXP4Qcvz3b9rFWBsqGVDyKPm3BkjXrrxgv3H2Ryi8WJMKFBNDCZ4YxmeegAfAqgNPbaaLzvYygQRzZ12xxKuqAKcLTSEu5ETwi6BMGpgXArxDbs4utwZahsecVAcn7qBWwnF3ropdSTLBUzwW22udy2CXaXgcpRaQi5dufF93dnWZpHc5ApKUXdN7yorTELjh5yq1RauiQ48zWH3zA4WixyZMJ7raGA7HoNh1mewqfSLyFHGGUgfUTynj4xjVgLyQWZ1yBixjF8ByFeuqXK81ExDnFiqF4zVgZRWE2bKJyBViw7i9BvJL4kPRbKm5WLkAUv92QKuRuLSxnjY2KBG46unAVsAsKoDHKeqsaBTKAcka4kn37pwtefTadqt1zJiUEJLoNoH1wp2P93fWqCVN8gaRdcZRJ1kLoq2sGbznpGSK8ULBBqmpDXcdjC7tNAPMp87eYXsNxT5HFX38yjKFheyVPNSMxj784r1TuGe6MC7PPjHdXbVNFsh7aRKTdRPUiDdrZhqZ7zgfziQsZR3izSVgjDS4u5rjT5NjNQn8r3LzNfaXPtpoCCp3Y8f5zwF9kFpu61ZgwhiSuTRARth8su8kfibqZqmE99LcEMzRd3KvzUcLLcDA86Xmz2XbLaMRxJ72yZNd17a2KN5sYpjhUi7yb2XtKsDpfHA14wsDcFsefC1BzpQpjQ7sgrHxpQPNU2dFujjjF7pEySaVHiVfvvXxd2LcT4WfXcdksLfpxyZVuepWdNMFYkypzHV17Q7ca5h2SQY3DCjkShmqozZLACGkRUyTH16PPHtDAicofcAenoV34HECXcyy4kqdCLrFMSBsVs3gRGt2hY5j2d1Uo8MU6wo2iSkziWCJwGtP9TQ2saiY7kY4DYTYV6ZN3tpM1wrdhaxw1fcrLnqinQXL1U1WzHNDi9JTK1c5ESUct5dWf6tLdLWpDemX1NMP2RCDTe1TSYYWyHRCX3Akog3dEqZKTk6nofanV4Vw1MjJZWHaeXMVcvr8g3sN9vpwjyQ18WQ8ErtNzTzYiChd4gr7pwCc74kdCuD519s8zAa89XYnodqCiejgaxutY33TYSp9atpgXKUmtDaeV3UzQnx", + "4z9dZrkxdYok1tkUF56Emr1XAzzi7VY8rTzxZ4qtv7VACufMJDQmbBVsgAjVhCwtjXtKAW4bhLMvZJ8NQwsMcHQXjEP9EN9TnNHL8P6bQjWy2oNLnTrigaCi58SQG5BQhEN1RG4akwss16eHTZw3nhhpNqrhe2y2TBvr3JukYdWJXWN1An7ZZ8pzV6ma9GkrXHoFui6eWqn8PYM87HMRDivdjt9wQQuRDSgvV4BXBxheCiWyL9bKtKs1EoLybK76UyVykiF2CZGZ192bPXrBGrNaucz5xBV67sp7zD1X7V3vnw9kZ86Ldwik57VKUMDHwUniSZaQ5yiVc1PxBXMuuTfgtvff1vFDhXhYaspeGCrvcDDC3QNPkKvXddpteqYCzvp83wk119wuPccYJ21hAz6QQj1Znz6d1L6LFSeoykXoR3SiAw9E69LYa5vocSTasVqqhQJhZnygtSA1zPxCKaFtJ7CpVyW62Fy81hfboVXfdAFJvM8LKag2aJHErEeWgT7wX5KtDK1cHwvNbqfGqDBr8zYgGQ6K7YG4n9e4B3R9knAb9qdouKpR7D2x5NMfuY6RxHzgnG2Kpzg2cA7gLJVWXeDK6KiN92ddcjTfgdR4K7kPVbwYvbXEtKmXAWVfx6ngizxmDg4R8ZAV4pTwWxb1wjgqpycErXXrSYUBy7WRkRMhkihnp3Ysfz1XpdHunQCYYAeUTvaGPnaebwJVaTKy9rv3DTmyCiS7qrfNxxPr3BrcrdzVxA49g3Rkevn4v2ECeLppgsyB2YeC38gCWES4GSebzRmgHZ2jqwTd3arCU1ZyZTv2inM26ey3csxDRzbvA9V31V9AWZreqryqsB76NX5iJnmzpfyBw9XqGXACfQanWydtPmWBok9bDvVS94B7LYdoCnJwFMeS4NvT3PouWMLWrBaHJ2xWgWxisVAbhEjxrKpc4SepkmndfkYdi6rUabaBVbPgFjb9eZttHpn6tY97SyeZqZ5cBeoRwL2ywMD6VFUijfw2bNGNKG384kEkqTEscgZ4zZYapvFgVh1mM7yKQJ6ZMbPpWfTtqzJfBsoewrfJCVnneeVNxPydR4yXeVGTUDUChuD29dxytjzA7ucXATq6hpdLzYgBou611fWLKdCMHsLptzCMo3FZ5qHyPGoTwx2N14iTqFTs4yMimhCSvUsRtWyh8ALh2GjRjCgRKW1aYMNUTcGAfgs63mTyENCatGofQocHYCPxThaAiMvHfxK6MhGH5uni16iwPsTLGzKtSa73X4jiA4mk1KbAn6HTTnz49SAy3SqJC41owi4NULGvHFz3J8hMdUgK9K1X9opJnW1Ma6oirQQU6NsR9FXjzMMBRsyRF4FRjjty6t17Mikn7irP6dMSfapigJwTdq63T6opUAswEVM7WYxVB74Co5G4nTGrAPBoZMHHkqF5LH9Yyw1r5BSRgvAqTTq5SHt7KsQMTD16MKcMFcwVVqMiPLVAa4YHjYpCFfG5MKG7vMsE9p62G3w5pdcPMD2AG2KsTqYc521DkmvknQe8CAojTS9Dd1zzKM9vWkj9ror77CaYi8TE1oZufpqsBUWw5syBmpXrMzWoBm1qT4bcYy6npTmfFfG2NVbdZYgCEGAnzCEykuMuNXtd5WAfML5MwWoXbRuwWo7gzXnHZCtur3yM67ZPQZqWrvz2PJ6QU841VN9bVV9T1YptceyTKWkrjpnd64VbUpiXbe1cCCA8GuKcJwq5d7sw6uYQjU9tsrHr1v9ZiVoN", + "6Q6fbqfbMAogw42DWDtKuKt9frSKdqW92cmiPbeF2SnuYCS9Ca43ZAiJvR7Kjfp99STcigCqWYCTt7JzqeFASVd7q9nWZacKKe8bGKNN4o7y4Pzd6mZ9foAEXKzybfc2HDuvG2oCoxoAMC4dsnnvNwjAY8kYozoSdCfX6BrWj1NF6unYaMCo8es9sZJiUS6j26F8irUz4yNjPpLKgxxGxBUTGvgo2qRW59xHS6BQruPfPsJjvEYvSz2AeaVqxnw1jgtvBjX2ERB2pfNakZ3zC3B6aNSPFZNsA7QZBXUgvG9q1A8KXLMJXTYJ4RPYk7BcHoAvjdUj391nt1chC9g3P2vUZFo2DAzoDwbNtqr22ueNX8vhC743CAUVzvDSei3KXp4MFLeWuiAYEd7vvSMVPLMdy8Ak73McqJLH1hGPzTKsuDxeNmuxbpNGuuRzHSPNeo2mUcL7afg9z2mkZM6KLYQ4VTsRMXG9NT6Qx218xy4ok9qcBwaNnZzyoeHa28Hkm4urRwj1pDvUNj3pxodzvLVYQdGZ46TXf41MLsWL5oBRWXEKSpNZt3XLDeK1V3bvoSKxyHWUskVWKqtdYkdb1wc6pt9r5WH1Ndjk5RQ3whG4kW17rr63CuATNBRxtwt7wsCno8bRnLtnnLEyMK6KhBVRHKpPHRQELGecp7d8Ze8zoYo4Vz2VFQQ7uzaGDrRuyKgPhNhUh9rHk3CSounphWzc4CqGxqqyt6JST7YvBxDZDVDnDzJNGgVjXwJfTXmkz6PFwohCjZRr5JvBtQ7vJ7Y9kCRoq67uWrPUB2jzTYJ9NWTNpeN8z4rCU2h1i7m5KhKwuHEJheuLVpmFXYRQsFiVW3128jRidN52JqbPbSnvaDJ1UrXHd6yqzV8Xr6C9bKecv4s61maHp3t12WFovqSg5VzJAH2cwyyxDatLniGBuFb71jjumt6iNvvxBsE6zcLTr46ujspUXv7aNmsa2df8th8m1iHDDL4xnSKetRFgUN8DBUUSudyBZrS9PU58noS8gvH543YDVQLczvTaA6c6TDtCXvXeHUu3i1BEvbQAX7jcFJao4U1fTX7Cvb8DRehy9RLtsvZvjh9fWkGtmf6dmjgKWnzWTiZ8ibNheZ8wkMWUWafDRCr42kKmRzFNuirg8y9YaXfLBMYbvkQ3kwkVmC4kgyFF2MhaEzwVm5EXEZVX6QZYxKWnhrZbzVXuWGDu3Eb3uRLfPuhm7GhdeLbhK6dm6eYZb717KPwKpqBChZs4Mo6Jsi9HzxycPG1FzXDgruXaAt1esQDvoS2MYc5NPqkPSeuv5L2EHMEq2FwiwcJhPHABTTYEfH7SYmCsatXtkgRce6o8DVVT5Rd45xWoiNKxCeGU2apPHKv117fo4mQUhBNftKVNBytGGu1RRsrCknQVCFJzeWxCc2CFs1nPz6oxt1EueU7jmMu4qnaU8BBbzdgJ3DaKeVysVhNsuqPvqUcvYhnmVFK5RPJHxiLA5Vp65zWHvL69AmWKGxP9EsFY1tqLqSPGfgJ3Xvz16v1Kg2kbCda7ZGk6sn1e4ry8UkhQLkfFQxqFnHxgTn85Dfp9kWwVsRPKxM4EwQmPHNKpWg7rT2NdWz8D9Ggm5yV92YarSWQZGAWFuUV7pW4zZ3vmsn9Ay51mh2C4VFHWEGjnH91cNwpgNBVWt2AtVeW3uL78fDiYfG5iprTFyySLBc4rdHQZQofhdyz9p1hAJGC4iRFyi2RoNX8GsX9GrAAnt", + "U2qJxzZiTGZmLdq3KoUQQYgtqfd7qf7ijBRfVevSbwayZhthUkoGASnJWhTz557fLDhMBomwj3bz7m7FSn5m7mj7eJJd8yF6HZJSe6BLzMAa5L81zgPWHo3ree6atV8zjxNbaaKPpiRkkPJT3wuS15ue4jc12jCwjiwa2TtWgA7D5AamU6iytVu2HKTDgvYcQCkF3PhrYRMVmx5Z2zDDLhx1dbJuraLGyPv1CW5VMvzBKA5FhYD2EY85UUQ6wBDMnitksVsXC7XCo3MEENBQBFQLFcSN2BzYRXx7kUhigdo79SFyKBJdXtc2i51hvEvanAYVogkNFvW3XPDKbSvXg3CCo8T9nQgVqMEALfTNpu1AYvCWG7Z9m6Fd4evXQgr26oqfnkkXrrXtJz6qszucM1WEwYN1CGy6BTy9n5ssKEWabx1XwomuN9pYV5wpUjEDKLKJ4zLmutuaQKps3ji2bQBjSxtREFib9Az5h5jAPTFvLckWteMfQXrNFVzWSBqK1os2LM7PVVvS5BwoWupHzVsfc1ZFKAyjmJaEXZJUJ4cDmzZzamJcC3xFtEsf3F7aWmMJkgbjZSPB2gEQU2HDg8Vr1u4rMRHVEXYdXt8ZB2fvnDiMbZAb8SWJZnfD536NcEnRFqGnFuLG7UNVqgKGbkUfv8BGcaH6R9wfq8t2WyRyJm2eNVAu6No5Zrhuxar6XQHkSL16vnsXzbD3TFAoJiFZnAJzrga8hPf9jDnbLSpVa2GPPR5yMoQ2RdrdAQ3GkZqtTdbyYoSH77wJ8rvGRk9DFhFzGBPD5qcyrJ4yMugwHpQPQWHrYf2HpyAGRUornTt4uLn7PLiHBE5AfsKTsiqLrT675engFvGasaHTsnWoS7SEBsKvNvF1tHETbCd7Ehf58ZpmzRJ1FotubzLwRxzNHs9HZpfpPsSr2Gm5h6m7WZCAgHvoVvfRd646K2sSxJBc5mAWzxNMFJ9ZYRUnZsKuoGDgtxEX7cD27sJepL7RLPoofMuiFmnKBVgmpSeP58vMp1SDVerqz1WXumepYwoLaK5co9HuXfP9MS65KqHrDALE5kTRi97n5kC2JvvqzeruPVY8U1yNsn1wC1Q9meZxBjeB8jkX9SWNP5dFvqmJMiJ3Wt98QJQxkxKeubt8oC36Dzobb6FDncTBDgiTAQVUZ9tS3GQ6spx6PBBPLdEDixuZoNGAmKzCaffCQ6LPvMFHhawStFY19DmsMykLqP84ZnzsARpjV68RHGZzV9uwxHMhppnVNVWeNTdr4egkjFNVJ7qBLxjTbaoxn7EEgcTuRUbie5T7EFc2djNUxBqB6P2Wa1aWisXeP4Sd6z946mwqEKp3yZTFkQsFAM4v7BXv4WebGocWMVU49UzVsmdznPmoBBR1xqyGxjKk2va3WwCHTJxbmV7NVWtcpWbePxCKRFhvA16AcPHfeuuJejJVQuDwpqfRagt8DTNxNukyqtrMgk1xvZpVhtJWEsoeUoYa2gED5T4ywNZjCEgC89qc2gjbr2JgRcmQ1zQoCXj4Cii2D8wdh1CRAxjMbERj8fBmKwpseKWSYmsjohFFLyFRsKRb3mE36kPp8c4GULKJfDnVVh9SQKqKB9aT6wNW7LXTtMjtovJrjKQvxTytihvHCNeuJ43ds5Kvz5CcNudzGZTwUon7L41Y6djHZrvZ5YY1Yn4nKKeVNxbsvCtpm26Z35BNdRzf9Hk3iceBsBWFw8we4aLxzaK7YVZVFo7qnNWcYtEznJ4FqMq76jGYSfdKMaQQuUTuq6uYDKj7WW3FxJdLgqBTjYsJcNe4yaxyfNoBdCjtkXcEahuRBAZ7WxAmXCwkqAXKxoqrJbiCN9UBvheQTK16DzyjaursnfvJS196PFZnNZZgceYCvpQ6PGaz2fnPSChN5vXzC39an8mFXn5NPDgPG5WWPtJHj52G6bW5p9CqM5f6DMekz8APCxY195dAkytj7GFLh8GWqZo9GjTMdMELB9QLcFBzJgXWWPQGyLZ6HE5BGEAPatmMhq9VG2R1YzRSYf7h7naxycNazqeDdCUb3PnfxHzosz1JLmnNUt3kvgK8P3e1wfsqts7U3X3U9vFsxnkciRuaapm2evjtnKwPqPXhpXcodJ5UjVeaCfiV6xoatDyt8mmFo7VEP7D3KJxMRGnypVWzNh5QYQsF4xtLqBhm6PbK75DZfUNr3v7YNqLoPzYbxzvhtx8BRPHpC6GnqfegkFqgYLUZTfY1CDWDEdNeWVCEb1BNdWTm5vTHCS3GrpV7rW6UrNrTfJZV6HXFuLDRR74pVb2APgLGtEqxobpe9N9VKw2jq1kfGqCfjWAZLrHdZnWUbvUq16i4SsoRKFgaXiGMw3SMF3NkMn6z2xQL1PPs29d52", + "5Nr9d8S1RDp6crFDoBxSWJPv6MkK2kC1eGCs4KGePfmTADrKJG4USaojjLyj2yCC7iSpaB51hq4roGA5xkD4gQBN4cRgbAVKYYq3xhGjWwzAT9p5PhLz2LShXysuF3qTTN25pmpy11uZsrRjiYExhFbKJeih5mkEHAzTHCS9jWaCsodVzPSSbZeScqYtgERen1ZNruRun3kdU7jCiWQ3TXPUAs3CD7XK7VjzoVGbugTGErXdBVeEpubtDnQRv6VSNrCgAadw3xyXJfpwzZj3HwAUHzxcPqzXfLvGyjjDtx5dBWCgdKJfqoPNnW44SWxtWsHo5uNCC2EDeKxnyKvopx3tGhopCXMJnhSc4GYBpuKabYoRE6vn9R455acRhc6SJzYx7UwcfaipL73LNXig4oPEdoQvpAEu9SkF2GCXY5ReaBRjShou6eZW7HcTp5qbuEnxFhnpcshh892XQw73uFGQ4wALacAynQNTPHhzfgCN1sE2SgYfphtdLoHXDS2HXKMaydMmcV9SHac59DmLd7VWP2v5rWr89U4PBfTVw7exNzJCNfZfFWSrZ2V2SwB8U4MN8hS5xYX76dQbZQDUk6BrtpEW9xTZWHVjBR7bzBsEWJNovv6SWbfkDEiVMJfhWwWJJ7kG5xjPCa4QicQ1CuYeCS13ukd7t3DAqko9K41XmhxDzC5r8z89KQKSBK5FnVpWLHYqxdfE3NcGKcBFJhMYyZvkaaRaFazfkH3bhGFeyg6W2LJeroTo5NNiE8oPMkAwzdZDbfo1ZDmDbWV6uvSjVERsG1d1GL6ay5VJsCCgxTyaQnEMMxxiqcWFi8M5xdHRxTZaThf8SJ7NocAdwJsT5YRrcaefoZWm9ZkbWw4SRXUxM7x4BhR9i9PAMxg83j1MWQMj1qgC6gsZ6cZ7BsJKWNJzXojEwxfun7QHqZd2pLHDjb1bpWtqRcgfQWgGvSgWQQSjQTpmvxavPz8sDDGdhrReM1fWuxYQNLPmSxZ7ZJmackFGJTjnCgxyJkHv3iHQ5u3vPA4uiuRJPQLV8oRdhWci1YjcPCRRSamygAKnkt2rQyxwouhx87Z8KTmj8S5j2JReinzMZFenAfVkMGnPdGqPGrMbo9cpvf1YAFriKAAHeiUR63wjyLcozw1BvcGpyv3nNQZkUD34k447KDu9aQzPjTwxswAsdUMoxqSkn8UtwFBDWSMrXdDA99udFQbW3dpPeazGki1SDQ33t15JKKUiNwknPuLjRzHDKhq4uvqmEEQ9Uraz53UsbazJrGhRoVG1UyTJ8ZkJ6D4KVgDr29PQ65sA2PgbqDyWttezKXgoQ5Fy9pS9JUBopkqFGsqLzS4mC63GFbPxsq6isXcsngj6NNjBh3UAho7dXoCCX7bJujyvYJir4cG2nGroCug6poGP3djPMxW24n652Ct7ms3RvwZ821j4GSUQyrXeLz2urH2dUV7dq2MceABcrZ3o1BCQQUFFeMPV7AogMtk5bXRAZAs2oBTsN6qeC6RiRL2gMkYEMWy8eEFfGwqpaTtdy2Zejx3t2AbRw1dSPMn2T7K6PVoZrWtTy9VgV1udEMsSqtTkgZAmnKyxyvWL8TqVZufU7RSNTD74DBUktZCrKT5ef7icD5UvAKs2xJqN6n2omB1dcwPEQXwXS7ZbrWHUTbVFVpU1jNR6rwSaJRWsrdgoTqfacGKpe8q2PfH115iuVsYwvnRfyHWcdSWyff3Z3tH1dcHowpxCK4ZhDCAXNcvS9fsqvmnH2SKMqsNkW4cmqGFhAaHSNAdFhbW615sseaSCEmg6pusZuVRPNL6Kjd2tQnvgWtRivr5iEakiu8YM3mTrZFsPpwVmG25bFM8BcdUTAPcQebDX1wQ4e3RWuo5vTVQUSKDzpUMKRopPUhpDUpntgaxZWhL2dkj687wy2AbA7efC64BJvqaaU4SAXGUjetkkSCpF74hMLjsdKMXQh8ADZFY7wNbRZsFe3qtzL2zpWzdTGbFJtGdxVwCXArDJaRfTdYtnx1yzT7jnFMYHbMQXypH4vbc2wrgweFH8J933ut8xhn7qMDCTnnpweMmcPRX5ca6yr2hUTZVyRT7eD4Dr9z5pd3BRB9FF3uVh2kscCweqShEbGpRg2ND1yGBKLVhpeT7LZQmKn7quPG4bc5aYqaYXbhNQBbH8rXUR57GLTqPLDbYV2WZWUp9bQ5m4SnQDjeut2i3MD7Ph8Ysi2mha2YoTBVZHw4SYLpoDrmwbM94HFahn8eR8ntvyWWwERUauPzHXQUDrw7YgUF7qeJ64mycoyvBbHupiLDLqrLfnWbY73EBNon62obbp3ExmGwENB2GZeq1gRnYQHgCqwosVyPnt3yDc7pVoZDDWob4d5wdK36hJbezmLuiz4KKMEpPUETSfgLsrK96YwywT4C7mrEwS4JhXVNQV1S9E2iHjoMaWsWNfzLf83p8", + "5Nr9d8S1RDp6crFDoBxSWJPv6MkK2kC1eGCs4KGePfmTADrKJG4USaojjLyhLdCyeCTTsxY4Rya8nBa6VZnhW29cyzZ2t9A3kPbbnhvsr4XSeg1j3eVMaw4oVh98qW1erbeTEShFKHqJufRqCBaynweCPcPXRCr5kZWvw9REV4hUn84BdA6RpjKuRvSmNFHQTGidpqQx2YM8RBR49SFMdNgKuivJjMkFv32eAKtaRsUb4Gn764sgDMnCAoqX9HXn3N2zwDqwwutfbsTtUW35vF22NXVdeYbkqJwXAZ9CNjJifM9xA3EEjFwPBkDw9ZC6iaXGjmTGxzp8jqTdMAq5BswGB4mMS7ob4jq2ecnqywM6zZVU145Uizjf357jzoQgxkYPbXKcVoaj3btooCG5gHs9br9KArXr1FC7acVauEoLCsxbhF9ZuaKxuJJoCophcuPK3rKUjKDWePBPcDjAGi32Zgw8wDPP64FmSKUBjt6w8z9kqN3WmbP3LRHfcJTagFMeFFXsY8nCqh4txPstFf3sMfBXJgJdUek3wFJrd1oefR1CQhPvwJoLnE4bKZMCwuoCZ4Rja1ry58vL6q3ELptnisUVPo8pXYaFVW4n4NdcVmuudZQTxW9j1p8pHhbKvaHNNj96jbbQNJGrURZSa27YbTHTsamKobNi7A1FWUVC1DH8wgVUKT3ci6TUpKvCoUeTrbvvRPQoBg6okrRbpNqf4GjpPUUnku5SHoavR971t4PDnDT69CV6YHdtXqfuEk16F3CZm2qpeEeRDk2j57fkgiAMDQFQp2HgtC4SQUmstV7fQgkHzBL5FMzTw2iXGChcNDgmDkSKkG3RrybT73HTZKNu46DGxeMZ4yvYvoXRHGnHfTbbhKgRsjZSM86KW632zqfBR5mZxR5uNVs1XKcUK1ABj1bxWa9rNizpg9bY8tpY2166HaeNrtAebMjqnSws9NbpdV3ReAVnbLEd6EDiMkZMixCKd5UB1bcnvMdFWAhkpvsvC9x17hmM8qWRZxmV25RE3dQ9zmjEzbkoM5yd3e6DvVGExvw9Es3SJWaF3GSW2bvF7KTG4e8ZnXARufuhiFwFVNPoWdUFP3fPB5UuUsumcNJe61dLUfHHkkowaVebt43E15i8yKpA26zwAYqBTwbbFGBj8fdf3wXjHsv4tpRCAm3YZmYmzMMJTcefUAMiLaycPbjLKSteriBVwwVo3gMfaUBUYzaFtfoHuRiX5dCS5qTX3gXwvrfAVRMMo2BVNhxUjSNtDkVKB311c5U9Sc5p6LRQqB8uaaEXzZfeQh5CYUXUi3zPW1LtnzcUKurAmGtWzvfKDzZ69Nrq72MYSeYWBfeQH6ALMf6BDY9USMfMnHYeahGu1gzeWBWVcDnnCguhgSBTbd1MYR9BD8o2cMTB1WsgXhNnY6h64URmRbyYm6Xzat87LFoZeDhfA92Hk2L2Q1ksHCJPEWXFeuPjYDK4ZBzufC3mA4KjDjkLxk8n1cyCuptv7x2TCGVkdipDnQs9dN3o2wyrVaUS5wfiJJ3wpScEPYwPAe537mNXw6ETe2y4aBzoL86Uu2bzANSmmcocSdMzi5gjPpZekfbjnQDCgb96GTGc3vE8oDCy7Pcadk1sstrLYeLsVBWQAxBjJimqHt7NDsMaSvCqWk8BRq78CbrfDWmnRcJ6m5bBMG455RuWC4zVy6ALPiS3KSNLczA6Kpd3EhKd9aAXgU8oS6fAwUpXerFT5PnJdKCq5LjcyyiysR4kFbfCxK291XKrBKTSapMNSdxoMaTgdpAh6C4Rcbon5D5cfsStDYQCFxWpsNgd39AMe2yaktrgydDqR2Yc4sGtxirYM6PWNKPywgCjLMvTF7KLTY1CJTBVsKLS8KwJksKoYijeCFUbaXvbrAbGJiMo1Y1MDbUryT1pn3ZcnX9xPZV4rQbKDTzi2dPDHDUTbBCzMVExefkL4GVMSurKWaJhc1LdJFVwGN8BgfZsqFGNmEyqhgDnTtda6wyFLQyCHKT6io6JBsB8t95NysxqtGhvqGLtU4GB2GMVxXf1sSdJdUEZYw8pqjCc6KpE818RRPWAqMCuWNQtj12DNnqcpS9m8Yg5nBYaJggLyhdUnjMANHRFc8XuyjF2rkknhkRqy1zAvcDSB9r7RqDCJ7Qr7ra7K2TmPTa1shjjDes87rzhigdWWeSnwggKuafN3dE9MrkxsmThaHEEjHddEbBynxvAZMpmx5phKGMrarCgQXguXrMYuumjJjXaUZyDaM7VbV1R9g1oSyyHJ5DWiBrBezEkgRRCNQkwyqBDiFyggScfi9bvb8UQraKEJiHnXfqtwPA48tavGDFP5QSGRwyhT9LLhajzNXEhJi4ogohRCwnFDfVdipmoSUZVQ5Fs9t1uo6sonmxp7C797TqC9UZkppdCXtUe3r7WjYV2t92ZKYF9GyETqU7VKJ3", + "5Nr9d8S1RDp6crFDoBxSWJPv6MkK2kC1eGCs4KGePfmTADrKJG4USaojjLygAtDi6w13Ejgtt8RFgPLhTRaxyNx2VDinWjiySF4ZX7eRpNUT7YRBxuHQHGt6X19Seg1ViRtDmMNKB3CSNZNo2ADXR9TKcvRvm89h2MfZHPj8eYt5gvzmaLmJGiyCT5Wi5rscvpC43rgzZRWHAB4pNJnWh9b3uh3cLZJJFuxAeEegxRR1xwHSSXqfhEagLYmR4T6s6ngKajszeudm4D9orBfKbDH3RLw8ESvSyKLTHTBZk2cdqnQAP2oMCGcyd3WNfBEcoquFzTUFRC8zRTnPRVFax6gCmkgqApCPoovzrkQQdiVXcL5JgeoG2vK4qWWzL8mfsWeYKWmsFGjL23VkEhTc5RzqcVDVaani3UXn87pAfQfQdisa2uWxqoeJQQ3YKUy8tjzXcA4HKDtTDUPP985ekdo3i4CGFxH2q8kgLFzuRHLjXZTjuxWGxLUjYZMHWENp39Bx3yuE9dRaCXac7wo3WTDHcqVouhtNuJftWizkfPAVs5WyHuxBzFW68RhGmWTpm17cW7jpJ6HvhL2Fptms4jkVaGKL4TVFTN5R6P7b4XYuz1XhHFfRTL5Tfm5cJwo6HopZQJVYGd4QtkPdipwzMeFvyiVLTWqUmqk6q4W64XYuqDDhiaNtyFqRN8bfyMW31fvfWxvhoqjh4g3rBG692rMfiK5eg7c46oVfkVSDQ3NykeGPJjQ9DGDNYYhT8Hkt4XUDrHY3MnchP6gho39HX7ydkhZSKcwytwbNwTD7636qgjZ8vbZxx33341V6Uy6ics4HX5FJQ2TtzjJMLizG47EGzdkS7jXAr1jM1Z7npqmajKLNmTCeMshbneNhoEgJyMXcCkt5aieyefGxPuP9GFKRHitLocCU8z8wiX4wX9EZtX8kB9ZiYRoHyqnkVmJuJ1R4GpMmkX5ZeghopALXEfLL6zXnbVGiYnHhVonUcrHhbQzoQYoAiCL4M7crTVLhgrfSPip7xn7VGn7rH9Ft2bF6e2q1mCpi3FzJCtzWpHHZwqjdjbPPp7MkCfvzG1T8HZmEAab5ctzJVoUNG4xndShJmSiz58Hw6STgr7B62jwXvn1j1nEGWxoDSr9bp7Mn7e26b9qBrfPMtbnxuP92YgXGwuAMbs857FWpHpeBQu9qyXpNEs8wboCEovQ326qL8FHFRbCEfh6HyGJ9ECxxHfNFSntpD4utEDqECEqhAGc4CL2nxQqc5TBSoz7sGWjvUsFBTXd6pQAqc2tvsD644CoRGjCqqwaevnQLMP5xbZRsSGj6c3VnDGRS1Y7zFLHKBTtPdktDLN5e1Sun2n1cNxEcrffVNznotLzKkWUaPBf6P55GskkmezoG3ArtM5hHgePAWxz9hCzRp7PRHu7auzq7p6vcYuFjrEfEP3kWbjZmihw8vB8FEzNa39SJhJ54r4DXYc6MmBc7nihDg4UP95w895Tee6WzUfMDorq3KMZc4NtC9yiDnJiStVBSNCnpMLtKpdJv7tavLCwxrM3NaspYJYfJJ3xcdjoXRRjZNaaUGBWK8JBFDFimo2TCLtjoTeb4Hqx6Nc1LRnxxkPzZiDLQWua2KA9JVJFHEaiGWqXFAJSbazqpVwzRi7LCnudZZHPFNvUSxDacr8p5C6J9RhXi5jy27yszditKvTYyS55uUqVvt8oHbx6a3qWnBuSxC9J7WePtCBjQHZZrnSy3m1xghCiRMoRqwCs9Bzbbud5yTp2pB7SE57WTYdCCfYnD866ZwAMfkR1KfbC5FDYGCMCgTS2EPUUqQqzmhsooASnEQfhm7gWzup7kHHkqzPnsxxiceYKW5ViWFWUQX5NmFZr16KRVTBpjBx8kNtmGzsxaf7MgDpGDMo9zj4hDYPK47aY2zagCf8C2f1aWYpdZFkeA27sYR41dWZzNycvre9oyTVrDxgDQpmT4MUaRzaXD59tC1RSCNn77EzAR5zaNoxWoBQN1atyCXMR8KiB7y73CbJTms8obdqSNm3dZKMPDgksKReJ3ZHqjBBPQey2xEQFrpMAGjRXeYUz1BpHUttS9LC78jKurkP1voNChGspqk5rt6N1MZnFKWv91RYfUZG9bDmrj1itT8yaGthPLhcg6KJ4rLsxQYnWWPvC3bXZxEJ54MAaXKUaXZzJDRQe3cZCvJcx1cjmMdrCNnpqQhtuVW2g6dg3pudozJ3mmSj9gpUC75ijwS4zoWgyX7uG8tPjKeH4THV41EWJqK2hA7Tc42UusUS1DitGdCcCNjAVBaheVRMAjLTrbSrAanrH1qE8c3Mu3nScoUFzH8qx6HxAKNzVKSQN1YdbRwwMEFbw2AwjGsjEzoJbnhZgT7nqDR4V7Q65sHueZftoxm2WCzThrGthNXhHSpgzijvuphdAA6mXDpo4odf4Xg9QsL2deE4p", + ], + tokens: [ + nullAddress, + "03faf2cb329f2e90d6d23b58d91bbb6c046aa143261cc21f52fbe2824bfcbf04", + "003bd19d0187117f130b62e1bcab0939929ff5c7709f843c5c4dd158949285d0", + "089990451bb430f05a85f4ef3bcb6ebf852b3d6ee68d86d78658b9ccef20074f", + ], + }), + }, +}; From d73d773667112746350df6a2e62a91ebaa585f9a Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Thu, 17 Aug 2023 07:25:19 +0100 Subject: [PATCH 0852/1974] add hallmark --- projects/spiritswap-lending/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/spiritswap-lending/index.js b/projects/spiritswap-lending/index.js index 0a5dcc4d3d5..d2d37e71439 100644 --- a/projects/spiritswap-lending/index.js +++ b/projects/spiritswap-lending/index.js @@ -10,6 +10,9 @@ const unitroller_fantom = "0x892701d128d63c9856A9Eb5d967982F78FD3F2AE" const olalending = usdCompoundExports(unitroller_fantom, "fantom", "0xed8F2C964b47D4d607a429D4eeA972B186E6f111", abis) module.exports = { + hallmarks: [ + [1693526400, "Lending Network deprecated"] + ], fantom:{ tvl: olalending.tvl, borrowed: olalending.borrowed From 44a1bc11f48d3c7580620f92dc5896bddbeeca15 Mon Sep 17 00:00:00 2001 From: qinghuan <1245816264@qq.com> Date: Thu, 17 Aug 2023 14:29:03 +0800 Subject: [PATCH 0853/1974] feat: update multi chain (#7183) * feat: update multi chain * feat: fix tvl export * feat: fix tvl export * feat: export multi chain contract token balance * feat: refactor export code * feat: add default token --- projects/omnibtc/index.js | 80 +++++++++++++++++++++++++++++---------- 1 file changed, 60 insertions(+), 20 deletions(-) diff --git a/projects/omnibtc/index.js b/projects/omnibtc/index.js index 16a2e909119..78444de6f40 100644 --- a/projects/omnibtc/index.js +++ b/projects/omnibtc/index.js @@ -1,31 +1,36 @@ +const { sumTokensExport } = require("../helper/sumTokens"); const ADDRESSES = require("../helper/coreAssets.json"); const sui = require("../helper/chain/sui"); const RESERVE_DYNAMIC_TABLE = "0x6ce8b223c47b5037d6791819694b32619ab0edfa5da139d21e416781cae487aa"; -const decimalShift = { +const POOLS = { + arbitrum: "0x53eCC006a0073b3351E9e38d94f052E3864C7935", + base: "0x68953027738216A63B39D55B18C02FeD5c329Dfa", + optimism: "0x233DDEce6a96c49ecE6Ad9ae820690fE62a28975", + polygon: "0xC3Eb696184b8927D677D8AB390A26563De4798c3", +}; +const DEFAULT_TOKEN = "0x0000000000000000000000000000000000000000"; + +const DECIMAL_SHIFTS = { [ADDRESSES.sui.USDC]: -2, [ADDRESSES.sui.SUI]: 1, }; const SUI_TOKENS = [ - { - symbol: "SUI", - poolId: 3, - address: ADDRESSES.sui.SUI, - }, - { - symbol: "USDC", - poolId: 8, - address: ADDRESSES.sui.USDC, - }, + { symbol: "SUI", poolId: 3, address: ADDRESSES.sui.SUI }, + { symbol: "USDC", poolId: 8, address: ADDRESSES.sui.USDC }, ]; -// Helper function to retrieve data based on poolId async function fetchDataBasedOnPoolId() { - const getObject = ({ poolId }) => sui.getDynamicFieldObject(RESERVE_DYNAMIC_TABLE, poolId.toString(), { idType: 'u16' }) - return Promise.all(SUI_TOKENS.map(getObject)) + return Promise.all( + SUI_TOKENS.map(({ poolId }) => + sui.getDynamicFieldObject(RESERVE_DYNAMIC_TABLE, poolId.toString(), { + idType: "u16", + }) + ) + ); } // Calculate and add to API @@ -39,8 +44,9 @@ function calculateAndAdd(objectsList, type, indexName, api) { const total_borrow = dataFields.dtoken_scaled?.fields?.total_supply || 0; const indexValue = dataFields[indexName] || 0; - const shiftValue = 10 ** (decimalShift[address] ?? 0); - const mainValue = type === "tvl" ? (total_supply - total_borrow) : total_borrow; + const shiftValue = 10 ** (DECIMAL_SHIFTS[address] ?? 0); + const mainValue = + type === "tvl" ? total_supply - total_borrow : total_borrow; const amount = (mainValue * shiftValue * indexValue) / Math.pow(10, 27); @@ -48,13 +54,13 @@ function calculateAndAdd(objectsList, type, indexName, api) { }); } -async function tvl() { +async function suiTvl() { const { api } = arguments[3]; const objectsList = await fetchDataBasedOnPoolId(); calculateAndAdd(objectsList, "tvl", "current_liquidity_index", api); } -async function borrow() { +async function suiBorrow() { const { api } = arguments[3]; const objectsList = await fetchDataBasedOnPoolId(); calculateAndAdd(objectsList, "borrow", "current_borrow_index", api); @@ -62,8 +68,42 @@ async function borrow() { module.exports = { timetravel: false, + arbitrum: { + tvl: sumTokensExport({ + owner: POOLS.arbitrum, + tokens: [ + DEFAULT_TOKEN, + ADDRESSES.arbitrum.ARB, + ADDRESSES.arbitrum.USDC, + ADDRESSES.arbitrum.USDT, + ], + }), + }, + base: { + tvl: sumTokensExport({ + owner: POOLS.base, + tokens: [DEFAULT_TOKEN, ADDRESSES.base.USDbC], + }), + }, + optimism: { + tvl: sumTokensExport({ + owner: POOLS.optimism, + tokens: [ + DEFAULT_TOKEN, + ADDRESSES.optimism.OP, + ADDRESSES.optimism.USDC, + ADDRESSES.optimism.USDT, + ], + }), + }, + polygon: { + tvl: sumTokensExport({ + owner: POOLS.polygon, + tokens: [DEFAULT_TOKEN, ADDRESSES.polygon.USDC, ADDRESSES.polygon.USDT], + }), + }, sui: { - tvl, - borrowed: borrow, + tvl: suiTvl, + borrowed: suiBorrow, }, }; From c83532245b05403d51a7be3fa1daa2d911c30f4c Mon Sep 17 00:00:00 2001 From: Nova-Ratio <114068172+Nova-Ratio@users.noreply.github.com> Date: Thu, 17 Aug 2023 11:27:52 +0300 Subject: [PATCH 0854/1974] Add SeaSwap Dex (#7179) * Add seaswap adapter * Update sei network rest api * rest.cosmos.directory is unreachable --------- Co-authored-by: findolor Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/black-whale/index.js | 11 ++------ projects/helper/chain/cosmos.js | 41 +++++++++++++++++++----------- projects/seaswap/index.js | 45 +++++++++++++++++++++++++++++++++ projects/treasury/mantadao.js | 23 +++-------------- 4 files changed, 76 insertions(+), 44 deletions(-) create mode 100644 projects/seaswap/index.js diff --git a/projects/black-whale/index.js b/projects/black-whale/index.js index a52a308a82f..fc5f93c022e 100644 --- a/projects/black-whale/index.js +++ b/projects/black-whale/index.js @@ -1,14 +1,7 @@ -const { get } = require("../helper/http"); -const { sumTokens, endPoints } = require('../helper/chain/cosmos') - +const { sumTokens, endPoints, queryContracts } = require('../helper/chain/cosmos') async function tvl() { - const { contracts: blackWhaleVaults } = await get(endPoints.kujira + "/cosmwasm/wasm/v1/code/21/contracts?pagination.limit=100"); - - const owners = [ - ...blackWhaleVaults, - ] - return sumTokens({ owners, chain: 'kujira' }) + return sumTokens({ owners: await queryContracts({ codeId: 21, chain: 'kujira' }), chain: 'kujira' }) } module.exports = { diff --git a/projects/helper/chain/cosmos.js b/projects/helper/chain/cosmos.js index 34e967b25c8..f7929ba55f8 100644 --- a/projects/helper/chain/cosmos.js +++ b/projects/helper/chain/cosmos.js @@ -12,15 +12,16 @@ const endPoints = { crescent: "https://mainnet.crescent.network:1317", osmosis: "https://lcd.osmosis.zone", cosmos: "https://cosmoshub-lcd.stakely.io", - kujira: "https://rest.cosmos.directory/kujira", + kujira: "https://kuji-api.kleomedes.network", comdex: "https://rest.comdex.one", - terra: "https://rest.cosmos.directory/terra", - terra2: "https://rest.cosmos.directory/terra2", + terra: "https://terraclassic-lcd-server-01.stakely.io", + terra2: "https://lcd-terra2.whispernode.com:443", umee: "https://umee-api.polkachu.com", orai: "https://lcd.orai.io", juno: "https://lcd-juno.cosmostation.io", cronos: "https://lcd-crypto-org.cosmostation.io", - chihuahua: "https://rest.cosmos.directory/chihuahua", + // chihuahua: "https://rest.cosmos.directory/chihuahua", + chihuahua: "https://api.chihuahua.wtf", injective: "https://lcd-injective.whispernode.com:443", migaloo: "https://migaloo-api.polkachu.com", fxcore: "https://fx-rest.functionx.io", @@ -28,8 +29,8 @@ const endPoints = { kava: "https://api2.kava.io", neutron: "https://rest-kralum.neutron-1.neutron.org", quasar: "https://quasar-api.polkachu.com", - gravitybridge: "https://rest.cosmos.directory/gravitybridge", - sei: "https://rest.sei-apis.com", + gravitybridge: "https://gravitychain.io:1317", + sei: "https://sei-api.polkachu.com", aura: "https://lcd.aura.network", }; @@ -40,7 +41,14 @@ const chainSubpaths = { kava: "kava", }; -function getEndpoint(chain) { +// some contract calls need endpoint with higher gas limit +const highGasLimitEndpoints = { + 'sei1xr3rq8yvd7qplsw5yx90ftsr2zdhg4e9z60h5duusgxpv72hud3shh3qfl': "https://rest.sei-apis.com", +} + +function getEndpoint(chain, { contract } = {}) { + const highGasEndpoint = highGasLimitEndpoints[contract] + if (contract && highGasEndpoint) return highGasEndpoint if (!endPoints[chain]) throw new Error("Chain not found: " + chain); return endPoints[chain]; } @@ -51,7 +59,6 @@ async function query(url, block, chain) { if (block !== undefined) { endpoint += `&height=${block - (block % 100)}`; } - console.log(endpoint); return (await axios.get(endpoint)).data.result; } @@ -162,17 +169,21 @@ async function queryContract({ contract, chain, data }) { data = Buffer.from(data).toString("base64"); return ( await axios.get( - `${getEndpoint(chain)}/cosmwasm/wasm/v1/contract/${contract}/smart/${data}` + `${getEndpoint(chain, { contract })}/cosmwasm/wasm/v1/contract/${contract}/smart/${data}` ) ).data.data; } -async function queryContracts({ chain, codeId }) { - return ( - await axios.get( - `${getEndpoint(chain)}/cosmwasm/wasm/v1/code/${codeId}/contracts` - ) - ).data.contracts; +async function queryContracts({ chain, codeId, }) { + let paginationKey = undefined + const res = [] + do { + let endpoint = `${getEndpoint(chain)}/cosmwasm/wasm/v1/code/${codeId}/contracts?${paginationKey ? `pagination.key=${paginationKey}` : ""}` + const { data: { contracts, pagination } } = await axios.get(endpoint) + paginationKey = pagination.next_key + res.push(...contracts) + } while (paginationKey) + return res } function getAssetInfo(asset) { diff --git a/projects/seaswap/index.js b/projects/seaswap/index.js new file mode 100644 index 00000000000..cf8d5a9f1c2 --- /dev/null +++ b/projects/seaswap/index.js @@ -0,0 +1,45 @@ +const { queryContracts, queryContract, sumTokens, } = require("../helper/chain/cosmos") +const { transformDexBalances } = require('../helper/portedTokens') +const { PromisePool } = require('@supercharge/promise-pool'); +const { sliceIntoChunks, sleep } = require("../helper/utils"); + +const POOL_CONTRACT_CODE_ID = 64; + +function extractTokenInfo(asset) { + const { native_token, token, native, cw20, } = asset + for (const tObject of [native_token, token, native, cw20]) { + if (!tObject) continue + if (typeof tObject === 'string') return tObject + const token = tObject.denom || tObject.contract_addr + if (token) return token + } +} + +module.exports = { + timetravel: false, + methodology: "Liquidity on the DEX", + sei: { + tvl: async (_, _1, _2, { api, }) => { + const chain = api.chain + const contracts = await queryContracts({ chain, codeId: POOL_CONTRACT_CODE_ID }) + /* const data = [] + const getPairPool = (async (pair) => { + const res = await queryContract({ contract: pair, chain, data: { info: {} } }) + const { token1_denom, token2_denom, token1_reserve, token2_reserve } = res + data.push({ + token0: extractTokenInfo(token1_denom), + token1: extractTokenInfo(token2_denom), + token0Bal: token1_reserve, + token1Bal: token2_reserve, + }) + }) + await PromisePool + .withConcurrency(25) + .for(contracts) + .process(getPairPool) + return transformDexBalances({ chain, data }) */ + + return sumTokens({ chain, owners: contracts }) + }, + }, +}; diff --git a/projects/treasury/mantadao.js b/projects/treasury/mantadao.js index 985a1be4446..ae6646d4128 100644 --- a/projects/treasury/mantadao.js +++ b/projects/treasury/mantadao.js @@ -1,6 +1,5 @@ const { getConfig } = require("../helper/cache"); -const { sumTokens, queryContract, queryV1Beta1, getDenomBalance, getBalance2 } = require('../helper/chain/cosmos'); -const axios = require('axios'); +const { sumTokens, queryContract, queryV1Beta1, getBalance2 } = require('../helper/chain/cosmos'); const owners = ["kujira15e682nq9jees29rm9j3h030af86lq2qtlejgphlspzqcvs9whf2q00nua5"] async function tvl(_, _1, _2, { api }) { @@ -59,11 +58,9 @@ async function calcPOLValue(api) { if (lpDenomSupply) { const supply = lpDenomSupply.amount; - const poolQuery = JSON.stringify({ pool: {} }); - let poolBalances; - poolBalances = await queryPoolContract({ contract: pool, chain: 'kujira', data: poolQuery }); + poolBalances = await queryContract({ contract: pool, chain: 'kujira', data: { pool: {}} }); const balances = poolBalances.balances; const coin0OutRatio = parseInt(balances[0]) / parseInt(supply); @@ -75,8 +72,7 @@ async function calcPOLValue(api) { const coin0Out = coin0OutRatio * treasuryLPBalance; const coin1Out = coin1OutRatio * treasuryLPBalance; - const configQuery = JSON.stringify({ config: {} }) - const poolConfig = await queryContract({ contract: pool, chain: 'kujira', data: configQuery }); + const poolConfig = await queryContract({ contract: pool, chain: 'kujira', data: { config:{}} }); const denom0 = poolConfig.denoms[0]; @@ -96,19 +92,6 @@ async function calcPOLValue(api) { } - -// Need hardcoded endpoint as half the suggested ones don't support proper gas limit for Kujira -async function queryPoolContract({ contract, chain, data }) { - if (typeof data !== "string") data = JSON.stringify(data); - data = Buffer.from(data).toString("base64"); - return ( - await axios.get( - `https://kuji-api.kleomedes.network/cosmwasm/wasm/v1/contract/${contract}/smart/${data}` - ) - ).data.data; -} - - async function ownTokens(_, _1, _2, { api }) { return sumTokens({ owners: owners, From 60dd7849767e130105685e16c667cbabca750771 Mon Sep 17 00:00:00 2001 From: FlitSwap <142413956+flitswap@users.noreply.github.com> Date: Thu, 17 Aug 2023 16:34:25 +0800 Subject: [PATCH 0855/1974] Add FlitSwap on OpBNB (#7182) * Add files via upload * fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/FlitSwap/index.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 projects/FlitSwap/index.js diff --git a/projects/FlitSwap/index.js b/projects/FlitSwap/index.js new file mode 100644 index 00000000000..f72478cc59a --- /dev/null +++ b/projects/FlitSwap/index.js @@ -0,0 +1,12 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports = { + misrepresentedTokens: true, + op_bnb: { + tvl: getUniTVL({ + fetchBalances: true, + useDefaultCoreAssets: true, + factory: '0x243f0218EF4cB8FC922ddd6d44e2DdE5b95DCa89', + }) + } +} \ No newline at end of file From 29968e526c02c307a2b38cc52888d01206da8607 Mon Sep 17 00:00:00 2001 From: Opankeswap <142486128+Opankeswap@users.noreply.github.com> Date: Thu, 17 Aug 2023 16:02:09 +0700 Subject: [PATCH 0856/1974] OpankeSwap (#7186) Co-authored-by: tinhp115 --- projects/OpankeSwap/index.js | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 projects/OpankeSwap/index.js diff --git a/projects/OpankeSwap/index.js b/projects/OpankeSwap/index.js new file mode 100644 index 00000000000..c9448b22425 --- /dev/null +++ b/projects/OpankeSwap/index.js @@ -0,0 +1,10 @@ +const { getUniTVL } = require("../helper/unknownTokens"); + +module.exports = { + op_bnb: { + tvl: getUniTVL({ + factory: "0x4523A7f5414bAc9BfbDfc6eF0932Bf580C3cf9f1", + useDefaultCoreAssets: true, + }), + }, +}; From 94f0e5abb282013cefbee737eca13ca50d09dc11 Mon Sep 17 00:00:00 2001 From: ABEx Admin <121482405+abex-admin@users.noreply.github.com> Date: Thu, 17 Aug 2023 17:14:39 +0800 Subject: [PATCH 0857/1974] Add abex finance tvl (#7185) --- projects/abex-finance/index.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 projects/abex-finance/index.js diff --git a/projects/abex-finance/index.js b/projects/abex-finance/index.js new file mode 100644 index 00000000000..11224bdd483 --- /dev/null +++ b/projects/abex-finance/index.js @@ -0,0 +1,28 @@ +const sui = require("../helper/chain/sui"); + +const DEPOSIT_VAULT_REGISTRY = + "0x3c6595e543c4766dd63b5b2fa918516bac2920bc1944da068be031dced46a18d"; + +async function tvl(_, _1, _2, { api }) { + const depositVaultFields = await sui.getDynamicFieldObjects({ + parent: DEPOSIT_VAULT_REGISTRY, + }); + + const depositVaultIds = depositVaultFields.map((item) => item.fields.id.id); + + const depositVaults = await sui.getObjects(depositVaultIds); + + depositVaults.forEach(({ type, fields: { value: { fields }} }) => { + const splitPieces = type.split("<") + const coin = splitPieces[splitPieces.length - 1].replace(">>", "") + api.add(coin, fields.liquidity) + api.add(coin, fields.reserved_amount) + }); +} + +module.exports = { + timetravel: false, + sui: { + tvl, + }, +}; From f2f4543bc3c5971a0fe634321ea2d702c01b9efa Mon Sep 17 00:00:00 2001 From: define Date: Thu, 17 Aug 2023 10:19:29 +0100 Subject: [PATCH 0858/1974] add metapool eth --- projects/metapool-eth/index.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 projects/metapool-eth/index.js diff --git a/projects/metapool-eth/index.js b/projects/metapool-eth/index.js new file mode 100644 index 00000000000..20d524bbca6 --- /dev/null +++ b/projects/metapool-eth/index.js @@ -0,0 +1,14 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const token = '0x48afbbd342f64ef8a9ab1c143719b63c2ad81710' + +async function tvl(_, _1, _2, { api }) { + const supply = await api.call({ abi: 'uint256:totalSupply', target: token, }); + api.add(ADDRESSES.null, supply) +} + +module.exports = { + methodology: 'Retrieve the total underlying ETH supply', + ethereum: { + tvl + } +} \ No newline at end of file From 1e18775b3bb645ae14c0d8953ff1088bb1c5c7a5 Mon Sep 17 00:00:00 2001 From: Opankeswap <142486128+Opankeswap@users.noreply.github.com> Date: Thu, 17 Aug 2023 16:28:20 +0700 Subject: [PATCH 0859/1974] OpankeSwap (#7188) Co-authored-by: tinhp115 From da7d6cdde153512330acfbf8249740fb363dc0ea Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 17 Aug 2023 11:30:14 +0200 Subject: [PATCH 0860/1974] minor fix --- projects/OpankeSwap/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/OpankeSwap/index.js b/projects/OpankeSwap/index.js index c9448b22425..210be546c0c 100644 --- a/projects/OpankeSwap/index.js +++ b/projects/OpankeSwap/index.js @@ -4,7 +4,8 @@ module.exports = { op_bnb: { tvl: getUniTVL({ factory: "0x4523A7f5414bAc9BfbDfc6eF0932Bf580C3cf9f1", - useDefaultCoreAssets: true, + useDefaultCoreAssets: false, + fetchBalances: true, }), }, }; From db9128703af1e71ab08ca330cf8ef1c42241cbc7 Mon Sep 17 00:00:00 2001 From: Winson Cheng <83229800+0xKMG@users.noreply.github.com> Date: Thu, 17 Aug 2023 17:30:59 +0800 Subject: [PATCH 0861/1974] add TVL for new Vaultka Vaults - SakeV2 (#7184) * add hallmark for the project * update Vaultka newvault TVL --- projects/vaultka/index.js | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/projects/vaultka/index.js b/projects/vaultka/index.js index 24c744a0303..c8d752c106f 100644 --- a/projects/vaultka/index.js +++ b/projects/vaultka/index.js @@ -1,8 +1,6 @@ module.exports = { misrepresentedTokens: true, - hallmarks: [ - [1688342964,"Launch Sake Vault"] - ], + hallmarks: [[1688342964, "Launch Sake Vault"]], arbitrum: { tvl: async (_, _b, _cb, { api }) => { const vaults = [ @@ -19,6 +17,8 @@ module.exports = { whiskeyWater: "0xa100E02e861132C4703ae96D6868664f27Eaa431", sake: "0x45BeC5Bb0EE87181A7Aa20402C66A6dC4A923758", sakeWater: "0x6b367F9EB22B2E6074E9548689cddaF9224FC0Ab", + sakeV2: "0xc53A53552191BeE184557A15f114a87a757e5b6F", + sakeWaterV2: "0x806e8538FC05774Ea83d9428F778E423F6492475", }; const contractAbis = { @@ -67,6 +67,21 @@ module.exports = { target: addresses.sake, }); + const sakeWaterUSDCBalV2 = await api.call({ + abi: contractAbis.waterUSDCBal, + target: addresses.sakeWaterV2, + }); + + const vlpBalV2 = await api.call({ + abi: contractAbis.vlpBalance, + target: addresses.sakeV2, + }); + + const StakedVLPBalV2 = await api.call({ + abi: contractAbis.stakedVlpBalance, + target: addresses.sakeV2, + }); + return { tether: bals.reduce((a, i) => a + i / 1e6, 0), dai: @@ -74,7 +89,9 @@ module.exports = { whiskeyWaterDaiBal / 1e18, "usd-coin": ((vlpBal + StakedVLPBal) * sakeVLPPrice) / 1e18 / 1e5 + - sakeWaterUSDCBal / 1e6, + sakeWaterUSDCBal / 1e6 + + ((vlpBalV2 + StakedVLPBalV2) * sakeVLPPrice) / 1e18 / 1e5 + + sakeWaterUSDCBalV2 / 1e6, }; }, }, From 6782a5942380084ed083cb9d0daf57f1b8d27977 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 17 Aug 2023 12:31:49 +0200 Subject: [PATCH 0862/1974] Solid-world (#7190) * modify SolidWorld tvl * code refactor --------- Co-authored-by: Andrei Stefan --- projects/solid-world/abi.json | 4 + projects/solid-world/batch-valuation.js | 31 +++++++ .../solid-world/categories-and-batches.js | 76 ++++++++++++++++++ projects/solid-world/config.js | 2 + .../forward-contract-batch-supply.js | 80 +++++++++++++++++++ projects/solid-world/index.js | 35 +++----- projects/solid-world/math.js | 60 ++++++++++++++ 7 files changed, 266 insertions(+), 22 deletions(-) create mode 100644 projects/solid-world/batch-valuation.js create mode 100644 projects/solid-world/categories-and-batches.js create mode 100644 projects/solid-world/forward-contract-batch-supply.js create mode 100644 projects/solid-world/math.js diff --git a/projects/solid-world/abi.json b/projects/solid-world/abi.json index 5b52c1fc79a..de077462e31 100644 --- a/projects/solid-world/abi.json +++ b/projects/solid-world/abi.json @@ -1,5 +1,9 @@ { "getTotalAmounts": "function getTotalAmounts() external view returns (uint256 total0, uint256 total1)", + "getBatchCategory": "function getBatchCategory(uint256 batchId) external view returns (uint256 categoryId)", + "getBatch": "function getBatch(uint256 batchId) external view returns (uint256 id, uint256 projectId, uint256 collateralizedCredits, address supplier, uint32 certificationDate, uint16 vintage, uint8 status, uint24 batchTA, bool isAccumulating)", + "getCategory": "function getCategory(uint256 categoryId) external view returns (uint256 volumeCoefficient, uint40 decayPerSecond, uint16 maxDepreciation, uint24 averageTA, uint32 lastCollateralizationTimestamp, uint256 totalCollateralized, uint256 lastCollateralizationMomentum)", + "getCategoryToken": "function getCategoryToken(uint256 categoryId) external view returns (address token)", "totalSupply": "uint256:totalSupply", "balanceOf": "erc20:balanceOf", "token0": "address:token0", diff --git a/projects/solid-world/batch-valuation.js b/projects/solid-world/batch-valuation.js new file mode 100644 index 00000000000..80564b015db --- /dev/null +++ b/projects/solid-world/batch-valuation.js @@ -0,0 +1,31 @@ +const { computeValuation } = require("./math"); + +async function valuateBatches(batches, categories, batchesSupply) { + const batchValuationDetails = batches.flatMap((batch) => { + const category = categories[batch.categoryId]; + const supply = batchesSupply[batch.id.toString()]; + return [ + { + creditsAmount: batch.collateralizedCredits.toString(), + timeAppreciation: batch.batchTA.toString(), + certificationDate: batch.certificationDate.toString() + "000", + crispToken: category.token + }, + { + creditsAmount: supply.minus(batch.collateralizedCredits.toString()).toString(), + timeAppreciation: category.averageTA.toString(), + certificationDate: batch.certificationDate.toString() + "000", + crispToken: category.token + } + ]; + }); + + return batchValuationDetails.map(({ crispToken, ...details }) => ({ + crispToken, + amount: computeValuation(details) + })); +} + +module.exports = { + valuateBatches +}; diff --git a/projects/solid-world/categories-and-batches.js b/projects/solid-world/categories-and-batches.js new file mode 100644 index 00000000000..23a950466df --- /dev/null +++ b/projects/solid-world/categories-and-batches.js @@ -0,0 +1,76 @@ +const { config } = require("./config"); +const abi = require("./abi.json"); + +async function fetchCategoriesAndBatches(api, batchIds) { + const allCategoryIds = new Set(); + const allBatches = []; + + for (let i = 0; i < batchIds.length; i += 10) { + const ids = batchIds.slice(i, i + 10); + const [categoryIds, batches] = await fetchCategoryIdsAndBatches(api, ids); + categoryIds.forEach(id => allCategoryIds.add(id.toString())); + allBatches.push(...batches); + } + + const categories = await fetchCategories(api, Array.from(allCategoryIds)); + + return [categories, allBatches]; +} + +async function fetchCategoryIdsAndBatches(api, forwardContractBatchIds) { + const [categoryIds, batches] = await Promise.all([ + api.multiCall({ + calls: forwardContractBatchIds.map(id => ({ + target: config[api.chain].SolidWorldManager, + params: [id] + })), + abi: abi.getBatchCategory + }), + api.multiCall({ + calls: forwardContractBatchIds.map(id => ({ + target: config[api.chain].SolidWorldManager, + params: [id] + })), + abi: abi.getBatch + }) + ]); + + batches.forEach((batch, i) => { + batch.categoryId = categoryIds[i].toString(); + }); + + return [categoryIds, batches]; +} + +async function fetchCategories(api, categoryIds) { + const [categories, categoryTokens] = await Promise.all([ + api.multiCall({ + calls: categoryIds.map(id => ({ + target: config[api.chain].SolidWorldManager, + params: [id] + })), + abi: abi.getCategory + }), + api.multiCall({ + calls: categoryIds.map(id => ({ + target: config[api.chain].SolidWorldManager, + params: [id] + })), + abi: abi.getCategoryToken + }) + ] + ); + + const result = {}; + categoryIds.forEach((id, i) => { + const category = categories[i]; + category.token = categoryTokens[i]; + result[id] = category; + }); + + return result; +} + +module.exports = { + fetchCategoriesAndBatches +}; diff --git a/projects/solid-world/config.js b/projects/solid-world/config.js index f1b5182f65a..62aebe23f23 100644 --- a/projects/solid-world/config.js +++ b/projects/solid-world/config.js @@ -1,5 +1,7 @@ const config = { polygon: { + SolidWorldManager: "0xe967aEBdbf137C2ddD4aaF076E87177c4EBEB851", + ForwardContractBatchToken: "0x029090aC92b0BAAF20Ccef615BAfD268f08Db8fA", pools: [ { crispToken: "0xEF6Ab48ef8dFe984FAB0d5c4cD6AFF2E54dfdA14", diff --git a/projects/solid-world/forward-contract-batch-supply.js b/projects/solid-world/forward-contract-batch-supply.js new file mode 100644 index 00000000000..20f4fb7a45b --- /dev/null +++ b/projects/solid-world/forward-contract-batch-supply.js @@ -0,0 +1,80 @@ +const { getLogs } = require("../helper/cache/getLogs"); +const { config } = require("./config"); +const BigNumber = require("bignumber.js"); + +const nullTopic = '0x0000000000000000000000000000000000000000000000000000000000000000' +const abis = { + transferSingle: "event TransferSingle (address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value)", + transferBatch: "event TransferBatch (address indexed operator, address indexed from, address indexed to, uint256[] ids, uint256[] values)", +} + +async function fetchForwardContractBatchSupplies(api) { + const mintLogs = await getLogs({ + api, + onlyArgs: true, + fromBlock: 42782566, + topics: ['0xc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62', null, nullTopic], + eventAbi: abis.transferSingle, + extraKey: 'mint-transfer-single', + target: config[api.chain].ForwardContractBatchToken + }); + const burnLogs = await getLogs({ + api, + onlyArgs: true, + fromBlock: 42782566, + topics: ['0xc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62', null, null, nullTopic], + eventAbi: abis.transferSingle, + extraKey: 'burn-transfer-single', + target: config[api.chain].ForwardContractBatchToken + }); + const transferBatchBurnLogs = await getLogs({ + api, + onlyArgs: true, + fromBlock: 42782566, + topics: ["0x4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb", null, null, nullTopic], + eventAbi: abis.transferBatch, + extraKey: 'burn-transfer-batch', + target: config[api.chain].ForwardContractBatchToken + }); + + const supply = {}; + + mintLogs + .forEach(mint => { + const batchId = mint.id.toString(); + supply[batchId] = (supply[batchId] || BigNumber(0)).plus(mint.value.toString()); + }); + burnLogs + .map(burn => { + const batchId = burn.id.toString(); + if (!supply[batchId]) { + throw new Error(`Burned batch ${batchId} without minting it first.`); + } + + supply[batchId] = supply[batchId].minus(burn.value.toString()); + + if (supply[batchId].isNegative()) { + throw new Error(`Burned more than minted for batch ${batchId}`); + } + }); + + transferBatchBurnLogs + .forEach(batchBurn => batchBurn.ids.forEach((burnId, i) => { + const batchId = burnId.toString(); + if (!supply[batchId]) { + throw new Error(`Burned batch ${batchId} without minting it first.`); + } + + supply[batchId] = supply[batchId].minus(batchBurn.values[i].toString()); + + if (supply[batchId].isNegative()) { + throw new Error(`Burned more than minted for batch ${batchId}`); + } + })); + + return supply; +} + +module.exports = { + fetchForwardContractBatchSupplies +}; diff --git a/projects/solid-world/index.js b/projects/solid-world/index.js index 7694ec1fb4a..902c2fec282 100644 --- a/projects/solid-world/index.js +++ b/projects/solid-world/index.js @@ -1,21 +1,18 @@ -const sdk = require("@defillama/sdk"); -const BigNumber = require("bignumber.js"); const { config } = require("./config"); const abi = require("./abi.json"); +const { fetchForwardContractBatchSupplies } = require("./forward-contract-batch-supply"); +const { fetchCategoriesAndBatches } = require("./categories-and-batches"); +const { valuateBatches } = require("./batch-valuation"); +// the value of the current on-chain forward credits, based on their exchange rate to CRISP tokens async function tvl(timestamp, ethBlock, _, { api }) { - const chainConfig = config[api.chain]; - const crispSupplies = await api.multiCall({ - calls: chainConfig.pools.map(pool => pool.crispToken), - abi: abi.totalSupply - }); + const batchSupplies = await fetchForwardContractBatchSupplies(api); + const [categories, batches] = await fetchCategoriesAndBatches(api, Object.keys(batchSupplies)); + const batchesValuation = await valuateBatches(batches, categories, batchSupplies); - const TVL = {}; - chainConfig.pools.forEach(({ crispToken }, i) => { - sdk.util.sumSingleBalance(TVL, crispToken, crispSupplies[i], api.chain); + batchesValuation.forEach(({ crispToken, amount }) => { + api.add(crispToken, amount) }); - - return TVL; } async function pool2(timestamp, ethBlock, _, { api }) { @@ -42,22 +39,16 @@ async function pool2(timestamp, ethBlock, _, { api }) { stakedAmount: stakedAmounts[i] })); - const TVL = {}; poolStats.forEach((e) => { - sdk.util.sumSingleBalance(TVL, e.token0, adjustAmount(e.totalAmount.total0, e.stakedAmount, e.totalSupply), api.chain); - sdk.util.sumSingleBalance(TVL, e.token1, adjustAmount(e.totalAmount.total1, e.stakedAmount, e.totalSupply), api.chain); + const ratio = e.stakedAmount /e.totalSupply + api.add(e.token0, e.totalAmount.total0 *ratio) + api.add(e.token1, e.totalAmount.total1 *ratio) }); - - return TVL; -} - -function adjustAmount(amount, numerator, denominator) { - return BigNumber(amount).times(numerator).div(denominator).toFixed(0); } module.exports = { start: 1684477800, // Fri May 19 2023 06:30:00 GMT+0000 - methodology: "TVL is a measure of the health of the Solid World ecosystem. It's the total amount of value that is locked up in our staking contract, and it's calculated by adding up the value of all the LP tokens that are staked. The LP tokens represent the amount of liquidity that has been provided to the Solid World platform.", + methodology: `TVL is a measure of the health of the Solid World ecosystem. The TVL can be looked at from 2 perspectives. The 1st perspective, "RWA" valuation, represents the total value of the tokenized forward carbon credits, and is computed as the present value of the on-chain forward credits (ERC1155), based on their exchange rate to CRISP tokens (ERC20) and subsequent USDC value, summed-up.The 2nd perspective, "pool2", represents the total value locked up in our staking contract, and it's calculated by adding up the value of all the LP tokens that are staked. The LP tokens represent the amount of liquidity that has been provided to the Solid World platform.`, polygon: { tvl, pool2 diff --git a/projects/solid-world/math.js b/projects/solid-world/math.js new file mode 100644 index 00000000000..945690bec8d --- /dev/null +++ b/projects/solid-world/math.js @@ -0,0 +1,60 @@ +const BigNumber = require("bignumber.js"); +const SECONDS_IN_WEEK = 604800; +const DAYS_IN_YEAR = 365; + +function computeTimeAppreciationDiscount( + timeAppreciation, + certificationDate +) { + const yearsTillCertification = yearsBetween(certificationDate); + if (yearsTillCertification === 0) { + return 1; + } + + // adjusting for 6 decimals + const timeAppreciationPercentage = Number(timeAppreciation) / 1_000_000; + return Math.pow(1 - timeAppreciationPercentage, yearsTillCertification); +} + +function yearsBetween( + endDate, + startDate = new Date().getTime() +) { + endDate = Number(endDate); + + if (endDate <= startDate) { + return 0; + } + + const diff = endDate - startDate; + return toYears(Math.floor(diff / 1000)); +} + +function toYears(seconds) { + const weeks = Math.floor(seconds / SECONDS_IN_WEEK); + if (weeks === 0) { + return 0; + } + + const days = weeks * 7; + + return days / DAYS_IN_YEAR; +} + + +// creditsAmount * 10e18 * (1 - timeAppreciation) ** yearsTillCertification +function computeValuation({ creditsAmount, timeAppreciation, certificationDate }) { + const timeAppreciationDiscount = computeTimeAppreciationDiscount( + timeAppreciation, + certificationDate + ); + + return BigNumber(creditsAmount) + .times(BigNumber(10).pow(18)) + .times(timeAppreciationDiscount) + .toFixed(0); +} + +module.exports = { + computeValuation +}; From 163f6b49829d21999f4dbcc747f24dcb0026c643 Mon Sep 17 00:00:00 2001 From: Tempest Capital <129153004+TempestGit@users.noreply.github.com> Date: Thu, 17 Aug 2023 18:35:25 +0800 Subject: [PATCH 0863/1974] Add Tempest on OP (#7189) --- projects/tempest/index.js | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 projects/tempest/index.js diff --git a/projects/tempest/index.js b/projects/tempest/index.js new file mode 100644 index 00000000000..b2419c658cc --- /dev/null +++ b/projects/tempest/index.js @@ -0,0 +1,8 @@ +const { compoundExports2 } = require('../helper/compound'); + +module.exports = { + optimism: compoundExports2({ + comptroller: '0x505E91a70aA5036677A71b2Af8D1881B85181EAE', + cether: '0x736440033C4C1C8A21e0B238989FE24bEC502014', + }) +}; \ No newline at end of file From 1f95dcf817a1b4851d003b2a8e23adedffb742c3 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 17 Aug 2023 13:56:26 +0200 Subject: [PATCH 0864/1974] fix broken adapters --- projects/helper/balancer.js | 4 +++- projects/helper/cache.js | 1 + projects/helper/cache/getLogs.js | 9 ++++++--- projects/klex/index.js | 2 +- projects/quicksilver/index.js | 4 ++-- projects/tlchain-decryption/index.js | 3 ++- 6 files changed, 15 insertions(+), 8 deletions(-) diff --git a/projects/helper/balancer.js b/projects/helper/balancer.js index e673c9385a5..21633cc2dec 100644 --- a/projects/helper/balancer.js +++ b/projects/helper/balancer.js @@ -1,7 +1,7 @@ const { sumTokens2 } = require('./unwrapLPs'); const { getLogs } = require('./cache/getLogs') -function onChainTvl(vault, fromBlock, { blacklistedTokens = [], preLogTokens = [] } = {}) { +function onChainTvl(vault, fromBlock, { blacklistedTokens = [], preLogTokens = [], onlyUseExistingCache } = {}) { return async (_, _1, _2, { api }) => { const logs = await getLogs({ api, @@ -11,6 +11,7 @@ function onChainTvl(vault, fromBlock, { blacklistedTokens = [], preLogTokens = [ eventAbi: 'event PoolRegistered(bytes32 indexed poolId, address indexed poolAddress, uint8 specialization)', onlyArgs: true, extraKey: 'PoolRegistered', + onlyUseExistingCache, }) const logs2 = await getLogs({ api, @@ -20,6 +21,7 @@ function onChainTvl(vault, fromBlock, { blacklistedTokens = [], preLogTokens = [ eventAbi: 'event TokensRegistered(bytes32 indexed poolId, address[] tokens, address[] assetManagers)', onlyArgs: true, extraKey: 'TokensRegistered', + onlyUseExistingCache, }) const tokens = logs2.map(i => i.tokens).flat() diff --git a/projects/helper/cache.js b/projects/helper/cache.js index e9fe334919c..532b7644fba 100644 --- a/projects/helper/cache.js +++ b/projects/helper/cache.js @@ -49,6 +49,7 @@ async function setCache(project, chain, cache, { const configCache = {} async function _setCache(project, chain, json) { + if (!json || json?.error?.message) return; const strData = typeof json === 'string' ? json : JSON.stringify(json) let isValidData = strData.length > 42 if (isValidData) // sometimes we get bad data/empty object, we dont overwrite cache with it diff --git a/projects/helper/cache/getLogs.js b/projects/helper/cache/getLogs.js index 8f28ab8a740..cb5c553ab60 100644 --- a/projects/helper/cache/getLogs.js +++ b/projects/helper/cache/getLogs.js @@ -7,11 +7,14 @@ const cacheFolder = 'logs' async function getLogs({ target, topic, keys = [], fromBlock, toBlock, topics, - api, eventAbi, onlyArgs = false, extraKey, skipCache = false, }) { + api, eventAbi, onlyArgs = false, extraKey, skipCache = false, onlyUseExistingCache = false, }) { if (!api) throw new Error('Missing sdk api object!') if (!target) throw new Error('Missing target!') if (!fromBlock) throw new Error('Missing fromBlock!') - await api.getBlock() + if (onlyUseExistingCache) + toBlock = 1e11 + else + await api.getBlock() const block = api.block const chain = api.chain ?? 'ethereum' if (!toBlock) toBlock = block @@ -37,7 +40,7 @@ async function getLogs({ target, let response // if no new data nees to be fetched - if (cache.fromBlock && cache.toBlock > toBlock) + if ((cache.fromBlock && cache.toBlock > toBlock) || onlyUseExistingCache) response = cache.logs.filter(i => i.blockNumber < toBlock && i.blockNumber >= fromBlock) else response = await fetchLogs() diff --git a/projects/klex/index.js b/projects/klex/index.js index 9474c709c37..be31f9aab5a 100644 --- a/projects/klex/index.js +++ b/projects/klex/index.js @@ -9,7 +9,7 @@ function v2(chain) { return async (time, ethBlock, chainBlocks, param4) => { const block = chainBlocks[chain] const { data: v2Tokens } = await configPost('kex/klaytn', 'https://graph-prod.klex.finance/subgraphs/name/klex-staging-2-mainnet', { query: '{ pools { name tokensList address }}' }) - if (!v2Tokens) return onChainTvl('0xb519Cf56C63F013B0320E89e1004A8DE8139dA27', 99368355)(time, ethBlock, chainBlocks, param4) + if (!v2Tokens) return onChainTvl('0xb519Cf56C63F013B0320E89e1004A8DE8139dA27', 99368355, { onlyUseExistingCache: true, })(time, ethBlock, chainBlocks, param4) const tokens = []; const blacklist = [] for (const { address, tokensList } of v2Tokens.pools) { diff --git a/projects/quicksilver/index.js b/projects/quicksilver/index.js index 819af075451..dfc8fec7888 100644 --- a/projects/quicksilver/index.js +++ b/projects/quicksilver/index.js @@ -14,10 +14,10 @@ async function tvl() { const balances = {}; const { zones } = await get( - "https://rest.cosmos.directory/quicksilver/quicksilver/interchainstaking/v1/zones" + "https://api-quicksilver.takeshi.team/quicksilver/interchainstaking/v1/zones" ); const { supply } = await get( - "https://rest.cosmos.directory/quicksilver/cosmos/bank/v1beta1/supply" + "https://api-quicksilver.takeshi.team/cosmos/bank/v1beta1/supply" ); zones.map((zone) => { diff --git a/projects/tlchain-decryption/index.js b/projects/tlchain-decryption/index.js index f073fabb0d0..9db2ada9507 100644 --- a/projects/tlchain-decryption/index.js +++ b/projects/tlchain-decryption/index.js @@ -1,3 +1,4 @@ const { uniTvlExport } = require('../helper/unknownTokens') -module.exports = uniTvlExport('tlchain', '0x837e7cfe3a85d1419771ebBf975EC78cE9b62f5c') \ No newline at end of file +module.exports = uniTvlExport('tlchain', '0x837e7cfe3a85d1419771ebBf975EC78cE9b62f5c') +module.exports.tlchain.tvl = () => ({}) \ No newline at end of file From 703fe523990f98444535499b5b8ff4bedbe1e9bc Mon Sep 17 00:00:00 2001 From: Dizz0 <83427844+Dizz02@users.noreply.github.com> Date: Thu, 17 Aug 2023 16:38:08 +0200 Subject: [PATCH 0865/1974] added FuzioNetwork DEX (#7191) * Add files via upload * Update index.js * Update index.js * Update index.js * Update index.js * Update index.js * added FuzioNetwork adapter * 3434243 * code refactor --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/FuzioNetwork/index.js | 9 +++++++ projects/seaswap/index.js | 40 ++------------------------------ projects/terraswap/factoryTvl.js | 14 +++++++++-- 3 files changed, 23 insertions(+), 40 deletions(-) create mode 100644 projects/FuzioNetwork/index.js diff --git a/projects/FuzioNetwork/index.js b/projects/FuzioNetwork/index.js new file mode 100644 index 00000000000..ab11ecd78cb --- /dev/null +++ b/projects/FuzioNetwork/index.js @@ -0,0 +1,9 @@ +const { getSeiDexTvl } = require('../terraswap/factoryTvl') + +module.exports = { + timetravel: false, + methodology: "Liquidity on the DEX", + sei: { + tvl: getSeiDexTvl(86), + }, +} diff --git a/projects/seaswap/index.js b/projects/seaswap/index.js index cf8d5a9f1c2..4150f3c4b9a 100644 --- a/projects/seaswap/index.js +++ b/projects/seaswap/index.js @@ -1,45 +1,9 @@ -const { queryContracts, queryContract, sumTokens, } = require("../helper/chain/cosmos") -const { transformDexBalances } = require('../helper/portedTokens') -const { PromisePool } = require('@supercharge/promise-pool'); -const { sliceIntoChunks, sleep } = require("../helper/utils"); - -const POOL_CONTRACT_CODE_ID = 64; - -function extractTokenInfo(asset) { - const { native_token, token, native, cw20, } = asset - for (const tObject of [native_token, token, native, cw20]) { - if (!tObject) continue - if (typeof tObject === 'string') return tObject - const token = tObject.denom || tObject.contract_addr - if (token) return token - } -} +const { getSeiDexTvl } = require('../terraswap/factoryTvl') module.exports = { timetravel: false, methodology: "Liquidity on the DEX", sei: { - tvl: async (_, _1, _2, { api, }) => { - const chain = api.chain - const contracts = await queryContracts({ chain, codeId: POOL_CONTRACT_CODE_ID }) - /* const data = [] - const getPairPool = (async (pair) => { - const res = await queryContract({ contract: pair, chain, data: { info: {} } }) - const { token1_denom, token2_denom, token1_reserve, token2_reserve } = res - data.push({ - token0: extractTokenInfo(token1_denom), - token1: extractTokenInfo(token2_denom), - token0Bal: token1_reserve, - token1Bal: token2_reserve, - }) - }) - await PromisePool - .withConcurrency(25) - .for(contracts) - .process(getPairPool) - return transformDexBalances({ chain, data }) */ - - return sumTokens({ chain, owners: contracts }) - }, + tvl: getSeiDexTvl(64), }, }; diff --git a/projects/terraswap/factoryTvl.js b/projects/terraswap/factoryTvl.js index a29df76e9f1..05122a51b66 100644 --- a/projects/terraswap/factoryTvl.js +++ b/projects/terraswap/factoryTvl.js @@ -1,4 +1,4 @@ -const { queryContract } = require('../helper/chain/cosmos') +const { queryContract, queryContracts, sumTokens } = require('../helper/chain/cosmos') const { PromisePool } = require('@supercharge/promise-pool') const { transformDexBalances } = require('../helper/portedTokens') @@ -57,6 +57,16 @@ function getFactoryTvl(factory) { } } + +function getSeiDexTvl(codeId) { + return async (_, _1, _2, { api }) => { + const chain = api.chain + const contracts = await queryContracts({ chain, codeId, }) + return sumTokens({ chain, owners: contracts }) + } +} + module.exports = { - getFactoryTvl + getFactoryTvl, + getSeiDexTvl, } From 922d6b078d2dda67d5d6bb438b61e6d9878e0ca8 Mon Sep 17 00:00:00 2001 From: lilchizh <55549631+lilchizh@users.noreply.github.com> Date: Thu, 17 Aug 2023 21:38:41 +0700 Subject: [PATCH 0866/1974] Add Lynex V3 (#7192) --- projects/lynex/index.js | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 projects/lynex/index.js diff --git a/projects/lynex/index.js b/projects/lynex/index.js new file mode 100644 index 00000000000..850029d67a3 --- /dev/null +++ b/projects/lynex/index.js @@ -0,0 +1,5 @@ +const { uniV3Export } = require("../helper/uniswapV3"); + +module.exports = uniV3Export({ + linea: { factory: "0x622b2c98123D303ae067DB4925CD6282B3A08D0F", fromBlock: 143660, isAlgebra: true, }, +}); From 86e540628965130f34cc032d7b2cbddb87e6a135 Mon Sep 17 00:00:00 2001 From: rrr-source <84952562+rrr-source@users.noreply.github.com> Date: Thu, 17 Aug 2023 23:44:05 +0500 Subject: [PATCH 0867/1974] added linea chain for USD+ and USDT+ (#7194) --- projects/helper/coreAssets.json | 3 ++- projects/overnight-usdPlus/index.js | 6 ++++-- projects/overnight-usdtPlus/index.js | 2 ++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index 141b37135f0..9e115258ae6 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -1344,7 +1344,8 @@ }, "linea": { "WETH": "0xe5D7C2a44FfDDf6b295A15c148167daaAf5Cf34f", - "USDC": "0x176211869cA2b568f2A7D4EE941E073a821EE1ff" + "USDC": "0x176211869cA2b568f2A7D4EE941E073a821EE1ff", + "USDT": "0xA219439258ca9da29E9Cc4cE5596924745e12B93" }, "base": { "WETH": "0x4200000000000000000000000000000000000006", diff --git a/projects/overnight-usdPlus/index.js b/projects/overnight-usdPlus/index.js index 8b93b94b726..dae6f282020 100644 --- a/projects/overnight-usdPlus/index.js +++ b/projects/overnight-usdPlus/index.js @@ -7,7 +7,8 @@ const m2m = { optimism: "0x9Af655c4DBe940962F776b685d6700F538B90fcf", arbitrum: "0x9Af655c4DBe940962F776b685d6700F538B90fcf", era: "0x240aad990FFc5F04F11593fF4dCF1fF714d6fc80", - base: "0x1F4947Cd5A5c058DD5EA6Fd1CCd5c311aDa9E6Fb" + base: "0x1F4947Cd5A5c058DD5EA6Fd1CCd5c311aDa9E6Fb", + linea: "0x1F4947Cd5A5c058DD5EA6Fd1CCd5c311aDa9E6Fb" } const assets = { @@ -16,7 +17,8 @@ const assets = { optimism: ADDRESSES.optimism.USDC, //USDC arbitrum: ADDRESSES.arbitrum.USDC, //USDC era: ADDRESSES.era.USDC, - base: ADDRESSES.base.USDbC //USDC + base: ADDRESSES.base.USDbC, //USDC + linea: ADDRESSES.linea.USDC //USDC } const abi = "uint256:totalNetAssets" diff --git a/projects/overnight-usdtPlus/index.js b/projects/overnight-usdtPlus/index.js index 7b6e5ecf188..4a8586ff9b7 100644 --- a/projects/overnight-usdtPlus/index.js +++ b/projects/overnight-usdtPlus/index.js @@ -3,10 +3,12 @@ const sdk = require("@defillama/sdk"); const m2m = { bsc: "0xF3434f6a11AA950150AF3e4962E39E6281496EF9", + linea: "0x3d67655A49Adb0F44530233Cbf8375D33FfAde41" } const assets = { bsc: ADDRESSES.bsc.USDT, //USDT + linea: ADDRESSES.linea.USDT //USDT } const abi = "uint256:totalNetAssets" From 38f3a0336162f4a84ad892023468807415413b3c Mon Sep 17 00:00:00 2001 From: PixelSwapDex <142522818+PixelSwapDex@users.noreply.github.com> Date: Fri, 18 Aug 2023 01:47:34 +0700 Subject: [PATCH 0868/1974] abc (#7195) --- projects/pixelswap/index.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 projects/pixelswap/index.js diff --git a/projects/pixelswap/index.js b/projects/pixelswap/index.js new file mode 100644 index 00000000000..16a5cf869cd --- /dev/null +++ b/projects/pixelswap/index.js @@ -0,0 +1,23 @@ +const { getUniTVL } = require('../helper/unknownTokens') +const FACTORY = "0xD07739a9E9C46D3DedeD97c0edC49cea8BAB1Bb9" + +const dexTVL = getUniTVL({ + factory: FACTORY, + useDefaultCoreAssets: true, + fetchBalances: true, +}) + + +module.exports = { + misrepresentedTokens: true, + methodology: `Uses Uniswap-style factory address to find and price liquidity pairs.`, + base: { + tvl: dexTVL, + }, + op_bnb: { + tvl: dexTVL, + }, + linea: { + tvl: dexTVL, + } +}; \ No newline at end of file From a1a9787d5f8452a4d03621bbf76b0da292c38afe Mon Sep 17 00:00:00 2001 From: BAS3Dio <142523144+BAS3Dio@users.noreply.github.com> Date: Thu, 17 Aug 2023 14:51:26 -0400 Subject: [PATCH 0869/1974] Adding BAS3D.io (#7193) * Adding BAS3D.io * minor fix --------- Co-authored-by: Kairos Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/bas3d/abi.json | 5 +++++ projects/bas3d/index.js | 43 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 projects/bas3d/abi.json create mode 100644 projects/bas3d/index.js diff --git a/projects/bas3d/abi.json b/projects/bas3d/abi.json new file mode 100644 index 00000000000..184e0f6aa23 --- /dev/null +++ b/projects/bas3d/abi.json @@ -0,0 +1,5 @@ +{ + "LPtoken": "address:LPtoken", + "balanceLPinSystem": "uint256:balanceLPinSystem", + "stakingToken": "address:stakingToken" +} \ No newline at end of file diff --git a/projects/bas3d/index.js b/projects/bas3d/index.js new file mode 100644 index 00000000000..8fe6c882087 --- /dev/null +++ b/projects/bas3d/index.js @@ -0,0 +1,43 @@ +const abi = require("./abi.json"); +const { sumTokensExport, sumUnknownTokens } = require('../helper/unknownTokens') + +const coreRewards = "0x3a7D3D2b49CAA7EF2C116C64711265eab0C755c0"; +const ethRewards = "0x5EeA01cDCAF548e639B9B5d66FBcbeD2a2a12beD"; +const BAS3D = "0xC4743d049891ea4333F8b559D09a93c3511f0762"; + +const vaults = [ + //BaseSwap.fi ETH/USDC + "0x2BF271D886febBc072087cDCB014Ae0dE8897c76", + + //BaseSwap.fi BSWAP/ETH + "0x106FB0C0c2e7249B36af8f0EdcBcc85CA82031Ea", + + //BaseSwap.fi DAI/USDC + "0x8Fff31D7601A279F7D83b38f83a0bf62c384Eb4A", +]; + +/*** Staking of native token BAS3D and BAS3D/ETH LP TVL Portion ***/ +const pool2 = async (timestamp, ethBlock, chainBlocks, { api }) => { + const staking_lpToken = await api.call({ abi: abi.stakingToken, target: coreRewards, }) + return sumUnknownTokens({ api, tokens: [staking_lpToken], owners: [coreRewards, ethRewards], useDefaultCoreAssets: true }) +}; + + +/*** vaults TVL portion ***/ +const bas3dTVL = async (timestamp, ethBlock, chainBlocks, { api }) => { + const tokens = await api.multiCall({ abi: abi.LPtoken, calls: vaults}) + const bals = await api.multiCall({ abi: abi.balanceLPinSystem, calls: vaults}) + api.addTokens(tokens, bals) + return sumUnknownTokens({ api, useDefaultCoreAssets: true, resolveLP: true, }) +}; + +module.exports = { + misrepresentedTokens: true, + doublecounted: true, + base: { + tvl: bas3dTVL, + staking: sumTokensExport({ owners: [coreRewards, ethRewards], tokens: [BAS3D], useDefaultCoreAssets: true, lps: ['0xfD77Af39aA9802fCc4c7933DA9754D9edB14afC0'] }), + pool2, + }, + methodology: `TVL is counted from the deposits into our yield farm and vaults`, +}; From 8282167ae15ade6e7cbc102f9fded2f67ec41a5b Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 17 Aug 2023 22:05:23 +0200 Subject: [PATCH 0870/1974] update unicrypt --- projects/unicrypt-v3/index.js | 8 ++++---- projects/unicrypt/apiCache.js | 8 +++----- projects/unicrypt/config.js | 11 +++++++++++ projects/unicrypt/index.js | 3 ++- 4 files changed, 20 insertions(+), 10 deletions(-) diff --git a/projects/unicrypt-v3/index.js b/projects/unicrypt-v3/index.js index ef338a99b76..1aa98b6f552 100644 --- a/projects/unicrypt-v3/index.js +++ b/projects/unicrypt-v3/index.js @@ -3,10 +3,10 @@ const { sumTokens2 } = require('../helper/unwrapLPs') const { getCoreAssets } = require('../helper/tokenMapping') const config = { - ethereum: { reserves: ['0x231278edd38b00b07fbd52120cef685b9baebcc1'] }, - arbitrum: { reserves: ['0xfa104eb3925a27e6263e05acc88f2e983a890637'] }, - bsc: { reserves: ['0x0D29598EC01fa03665feEAD91d4Fb423F393886c'] }, - polygon: { reserves: ['0xc22218406983bf88bb634bb4bf15fa4e0a1a8c84'] }, + ethereum: { reserves: ['0x231278edd38b00b07fbd52120cef685b9baebcc1', '0x7f5c649856f900d15c83741f45ae46f5c6858234'] }, + arbitrum: { reserves: ['0xfa104eb3925a27e6263e05acc88f2e983a890637', '0xcb8b00d4018ad6031e28a44bf74616014bfb62ec'] }, + bsc: { reserves: ['0x0D29598EC01fa03665feEAD91d4Fb423F393886c', '0xf1f7f21e2ea80ab110d0f95faa64655688341990'] }, + polygon: { reserves: ['0xc22218406983bf88bb634bb4bf15fa4e0a1a8c84', '0xd8207e9449647a9668ad3f8ecb97a1f929f81fd1'] }, } module.exports = { diff --git a/projects/unicrypt/apiCache.js b/projects/unicrypt/apiCache.js index ee8b0331937..9065e8b6dbd 100644 --- a/projects/unicrypt/apiCache.js +++ b/projects/unicrypt/apiCache.js @@ -1,7 +1,7 @@ const sdk = require('@defillama/sdk'); const { config, protocolPairs, tokens, stakingContracts, ethereumContractData, bscContractData, polygonContractData, - avalancheContractData, gnosisContractData } = require('./config') + avalancheContractData, gnosisContractData,arbitrumContractData, } = require('./config') const { getCache, setCache, } = require("../helper/cache") const { vestingHelper, } = require("../helper/unknownTokens") const project = 'bulky/unicrypt' @@ -69,7 +69,6 @@ function tvl(args) { } module.exports = { - timetravel: true, methodology: `Counts each LP pair's native token and stable balance, adjusted to reflect locked pair's value. @@ -98,9 +97,8 @@ module.exports = { polygon: { tvl: tvl(polygonContractData) }, - avax: { - tvl: tvl(avalancheContractData) - }, + avax: { tvl: tvl(avalancheContractData) }, + arbitrum: { tvl: tvl(arbitrumContractData) }, xdai: { tvl: tvl(gnosisContractData), pool2: pool2s([config.honeyswap.locker], diff --git a/projects/unicrypt/config.js b/projects/unicrypt/config.js index bf1944cc9a3..9b0fd29eaef 100644 --- a/projects/unicrypt/config.js +++ b/projects/unicrypt/config.js @@ -223,6 +223,16 @@ const gnosisContractData = [ } ] +const arbitrumContractData = [ + { + chain: 'arbitrum', + contract: '0x275720567E5955F5f2D53A7A1Ab8a0Fc643dE50E', + getNumLockedTokensABI: getNumLockedTokens, + getLockedTokenAtIndexABI: getLockedTokenAtIndex, + pool2: [], + } + +] module.exports = { @@ -231,6 +241,7 @@ module.exports = { polygonContractData, avalancheContractData, gnosisContractData, + arbitrumContractData, governanceTokens, stakingContracts, protocolPairs, diff --git a/projects/unicrypt/index.js b/projects/unicrypt/index.js index 2d23b1439ea..cad60cc7056 100644 --- a/projects/unicrypt/index.js +++ b/projects/unicrypt/index.js @@ -1,7 +1,7 @@ const sdk = require('@defillama/sdk'); const { config, protocolPairs, tokens, stakingContracts, ethereumContractData, bscContractData, polygonContractData, - avalancheContractData, gnosisContractData } = require('./config') + avalancheContractData, gnosisContractData, arbitrumContractData, } = require('./config') const { stakings } = require("../helper/staking"); const { pool2s } = require("../helper/pool2"); @@ -94,6 +94,7 @@ module.exports = { avax: { tvl: tvl(avalancheContractData) }, + arbitrum: { tvl: tvl(arbitrumContractData) }, xdai: { tvl: tvl(gnosisContractData), pool2: pool2s([config.honeyswap.locker], From 3b6e96cffdedd6ea72e1fe81d308f973486c414f Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Fri, 18 Aug 2023 00:33:03 +0100 Subject: [PATCH 0871/1974] add swapbased cl listing --- projects/swapbased-cl/index.js | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 projects/swapbased-cl/index.js diff --git a/projects/swapbased-cl/index.js b/projects/swapbased-cl/index.js new file mode 100644 index 00000000000..bcab4fee1be --- /dev/null +++ b/projects/swapbased-cl/index.js @@ -0,0 +1,9 @@ +const { uniV3Export } = require("../helper/uniswapV3"); + +module.exports = uniV3Export({ + base: { + factory: "0xC207628E5e2b59E9C690071e68c7C1c4193b0252", + fromBlock: 2435487, + isAlgebra: true, + }, +}); \ No newline at end of file From 320ae3e9fa1e0e98bc7d037c4705436b31d52268 Mon Sep 17 00:00:00 2001 From: yashvik <39464729+waverune@users.noreply.github.com> Date: Fri, 18 Aug 2023 05:17:06 +0530 Subject: [PATCH 0872/1974] update: adds base chain factory (#7196) --- projects/timeswap-v2/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/projects/timeswap-v2/index.js b/projects/timeswap-v2/index.js index d07b58ca7a8..9c0a5609661 100644 --- a/projects/timeswap-v2/index.js +++ b/projects/timeswap-v2/index.js @@ -84,6 +84,10 @@ const config = { polygon_zkevm: { factory: "0x406d3Dfcbe20b642c2262b29b960822975371502", fromBlock: 1787343, + }, + base: { + factory: "0x406d3Dfcbe20b642c2262b29b960822975371502", + fromBlock: 2493999, } }; From 6c2b93f5eb09837fb5e06687cc7ecbb179effcb7 Mon Sep 17 00:00:00 2001 From: 0xfee1dead <58794405+xasai@users.noreply.github.com> Date: Fri, 18 Aug 2023 11:43:15 +0600 Subject: [PATCH 0873/1974] DeNet File Token (DE) (#7180) * Added $DE DeNet File Token adapter * fixed typo * upd * upd methodology * upd methodology; removed dexes from tvl * count DE tokens insidie DeNet contracts as staking --------- Co-authored-by: xasai --- projects/DeNet/index.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 projects/DeNet/index.js diff --git a/projects/DeNet/index.js b/projects/DeNet/index.js new file mode 100644 index 00000000000..a906c8da65e --- /dev/null +++ b/projects/DeNet/index.js @@ -0,0 +1,24 @@ +const { sumTokensExport } = require("../helper/unwrapLPs"); +const DE_TOKEN_ADDRESS = '0x081Ec4c0e30159C8259BAD8F4887f83010a681DC'; + +const owners = [ + '0x6261e1aac369cd694093455f9e2b65b31acedda1', // veDE + '0x1a9b54A3075119f1546C52cA0940551A6ce5d2D0', // Payments for DeNet storage +] + +module.exports = { + start: 1691761595, // Friday, 11-Aug-23 13:46:35 UTC + methodology: "Total amount of DE tokens used for DeNet storage payments", + timetravel: true, + misrepresentedTokens: false, + + polygon: { + tvl: () => ({}), + staking: sumTokensExport({ + owners: owners, + tokens: [DE_TOKEN_ADDRESS] + }), + } +}; + + // LLAMA_DEBUG_MODE="true" node test.js projects/DeNet/index.js From fa1e2ea292f186cee9e35b03cc0a904253ea1528 Mon Sep 17 00:00:00 2001 From: Alonso Villegas Date: Fri, 18 Aug 2023 00:43:44 -0500 Subject: [PATCH 0874/1974] add fourdex (#7197) --- projects/fourdex/index.js | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 projects/fourdex/index.js diff --git a/projects/fourdex/index.js b/projects/fourdex/index.js new file mode 100644 index 00000000000..b4e580a8d3c --- /dev/null +++ b/projects/fourdex/index.js @@ -0,0 +1,11 @@ +const { getUniTVL } = require("../helper/unknownTokens"); + +module.exports = { + op_bnb: { + tvl: getUniTVL({ + factory: "0x0f93649C2BA0F64fA939eCe899f1afD0b15C7Bd2", + useDefaultCoreAssets: true, + fetchBalances: true, + }), + }, +}; From c18eb81a7c2deb5cc9bc7a00e693f224f7b263e8 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 18 Aug 2023 08:28:49 +0200 Subject: [PATCH 0875/1974] fix broken adapters --- projects/helper/chain/cosmos.js | 6 +++--- projects/ibcx/index.js | 10 ++++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/projects/helper/chain/cosmos.js b/projects/helper/chain/cosmos.js index f7929ba55f8..a4e8347b47c 100644 --- a/projects/helper/chain/cosmos.js +++ b/projects/helper/chain/cosmos.js @@ -10,7 +10,7 @@ const { log } = require("../utils"); // https://cosmos-chain.directory/chains const endPoints = { crescent: "https://mainnet.crescent.network:1317", - osmosis: "https://lcd.osmosis.zone", + osmosis: "https://osmosis-api.polkachu.com", cosmos: "https://cosmoshub-lcd.stakely.io", kujira: "https://kuji-api.kleomedes.network", comdex: "https://rest.comdex.one", @@ -20,8 +20,8 @@ const endPoints = { orai: "https://lcd.orai.io", juno: "https://lcd-juno.cosmostation.io", cronos: "https://lcd-crypto-org.cosmostation.io", - // chihuahua: "https://rest.cosmos.directory/chihuahua", - chihuahua: "https://api.chihuahua.wtf", + chihuahua: "https://rest.cosmos.directory/chihuahua", + // chihuahua: "https://api.chihuahua.wtf", injective: "https://lcd-injective.whispernode.com:443", migaloo: "https://migaloo-api.polkachu.com", fxcore: "https://fx-rest.functionx.io", diff --git a/projects/ibcx/index.js b/projects/ibcx/index.js index f56f733457d..6544d6de364 100644 --- a/projects/ibcx/index.js +++ b/projects/ibcx/index.js @@ -1,4 +1,6 @@ const axios = require('axios') +const { endPoints } = require('../helper/chain/cosmos') + const contractAddresses = [ "osmo1yhd9tzp09d833u7ray4pc6wwp72aewtt2xwakszn3lzlf2klnlwscjwhxt", // uibcx @@ -12,23 +14,23 @@ const contractAddresses = [ async function tvl() { const { api } = arguments[3] for (const contractAddress of contractAddresses) { - const contractBalances = (await axios.get(`https://lcd.osmosis.zone/cosmos/bank/v1beta1/balances/${contractAddress}`)).data.balances + const contractBalances = (await axios.get(`${endPoints.osmosis}/cosmos/bank/v1beta1/balances/${contractAddress}`)).data.balances for (const coin of contractBalances) { // stUMEE not be listed on coingecko so we convert stUMEE to the corresponding amount of UMEE base on pool stUMEE/UMEE if (coin.denom == "ibc/02F196DA6FD0917DD5FEA249EE61880F4D941EE9059E7964C5C9B50AF103800F") { - const spotPrice = (await axios.get(`https://lcd.osmosis.zone/osmosis/gamm/v2/pools/1035/prices?base_asset_denom=ibc/67795E528DF67C5606FC20F824EA39A6EF55BA133F4DC79C90A8C47A0901E17C"e_asset_denom=${coin.denom}`)).data.spot_price + const spotPrice = (await axios.get(`${endPoints.osmosis}/osmosis/gamm/v2/pools/1035/prices?base_asset_denom=ibc/67795E528DF67C5606FC20F824EA39A6EF55BA133F4DC79C90A8C47A0901E17C"e_asset_denom=${coin.denom}`)).data.spot_price coin.denom = "ibc/67795E528DF67C5606FC20F824EA39A6EF55BA133F4DC79C90A8C47A0901E17C" // UMEE coin.amount = coin.amount * spotPrice } // stEVMOS not be listed on coingecko so we convert stEVMOS to the corresponding amount of EVMOS base on pool stEVMOS/EVMOS if (coin.denom == "ibc/C5579A9595790017C600DD726276D978B9BF314CF82406CE342720A9C7911A01") { - const spotPrice = (await axios.get(`https://lcd.osmosis.zone/osmosis/gamm/v2/pools/922/prices?base_asset_denom=ibc/6AE98883D4D5D5FF9E50D7130F1305DA2FFA0C652D1DD9C123657C6B4EB2DF8A"e_asset_denom=${coin.denom}`)).data.spot_price + const spotPrice = (await axios.get(`${endPoints.osmosis}/osmosis/gamm/v2/pools/922/prices?base_asset_denom=ibc/6AE98883D4D5D5FF9E50D7130F1305DA2FFA0C652D1DD9C123657C6B4EB2DF8A"e_asset_denom=${coin.denom}`)).data.spot_price coin.denom = "ibc/6AE98883D4D5D5FF9E50D7130F1305DA2FFA0C652D1DD9C123657C6B4EB2DF8A" // EVMOS coin.amount = coin.amount * spotPrice } api.add(coin.denom, coin.amount) } - + } } From 155f8e0a95c677d8e93477a082a36dc20d637afc Mon Sep 17 00:00:00 2001 From: flashburst <82953782+flashburst@users.noreply.github.com> Date: Fri, 18 Aug 2023 13:16:35 +0530 Subject: [PATCH 0876/1974] Updated adapter for tvl on bsc (#7198) --- projects/neptune-mutual/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/neptune-mutual/index.js b/projects/neptune-mutual/index.js index b8f0c9a47f8..72aa286f2e9 100644 --- a/projects/neptune-mutual/index.js +++ b/projects/neptune-mutual/index.js @@ -8,11 +8,13 @@ const abi = { const vaultFactories = { ethereum: "0x0150b57aa8cc6fcbc110f07eef0c85731d8aacf4", arbitrum: "0x0150b57aa8cc6fcbc110f07eef0c85731d8aacf4", + bsc: "0x0150b57aa8cc6fcbc110f07eef0c85731d8aacf4", }; const fromBlocks = { ethereum: 15912005, arbitrum: 54210090, + bsc: 29123165, }; async function tvl(_, block, _1, { api, chain }) { @@ -39,4 +41,5 @@ module.exports = { start: 1667260800, // Nov 01 2022 @ 12:00am (UTC) ethereum: { tvl }, arbitrum: { tvl }, + bsc: { tvl }, }; From 80de4d6c066be89b179435d7e8802468c82c4a18 Mon Sep 17 00:00:00 2001 From: richard-luigiswap <142534010+richard-luigiswap@users.noreply.github.com> Date: Fri, 18 Aug 2023 15:46:13 +0700 Subject: [PATCH 0877/1974] add LuigiSwap on opBNB (#7200) --- projects/LuigiSwap/index.js | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 projects/LuigiSwap/index.js diff --git a/projects/LuigiSwap/index.js b/projects/LuigiSwap/index.js new file mode 100644 index 00000000000..1eceb0a4364 --- /dev/null +++ b/projects/LuigiSwap/index.js @@ -0,0 +1,11 @@ +const { getUniTVL } = require("../helper/unknownTokens"); + +module.exports = { + op_bnb: { + tvl: getUniTVL({ + factory: "0x0dAe6d22182c20AB9150a4DCB3160591Dc41027a", + useDefaultCoreAssets: false, + fetchBalances: true, + }), + }, +}; \ No newline at end of file From 231606f84e7546228f03e3531b88772aff98f2cd Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 18 Aug 2023 10:51:58 +0200 Subject: [PATCH 0878/1974] fix hadouken --- projects/helper/cache.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/helper/cache.js b/projects/helper/cache.js index 532b7644fba..9b93ca5a158 100644 --- a/projects/helper/cache.js +++ b/projects/helper/cache.js @@ -112,6 +112,7 @@ async function cachedGraphQuery(project, endpoint, query, { variables, fetchById json = await graphql.request(endpoint, query, { variables }) else json = await graphFetchById({ endpoint, query, }) + if (!json) throw new error('Empty JSON') await _setCache(key, project, json) return json } catch (e) { From 8b08a8ff3117e9791c6cf2c8e031da4b67256ecc Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 18 Aug 2023 10:52:56 +0200 Subject: [PATCH 0879/1974] minor fix --- projects/LuigiSwap/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/LuigiSwap/index.js b/projects/LuigiSwap/index.js index 1eceb0a4364..b0894d586d6 100644 --- a/projects/LuigiSwap/index.js +++ b/projects/LuigiSwap/index.js @@ -4,7 +4,7 @@ module.exports = { op_bnb: { tvl: getUniTVL({ factory: "0x0dAe6d22182c20AB9150a4DCB3160591Dc41027a", - useDefaultCoreAssets: false, + useDefaultCoreAssets: true, fetchBalances: true, }), }, From 36cf76d384b883f2d102e0450228a1beb89fe15b Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 18 Aug 2023 10:57:49 +0200 Subject: [PATCH 0880/1974] minor fix --- projects/LuigiSwap/index.js | 1 + projects/OpankeSwap/index.js | 3 ++- projects/daomaker-swap/index.js | 4 ++-- projects/printy/index.js | 3 ++- projects/sealightswap/index.js | 2 +- 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/projects/LuigiSwap/index.js b/projects/LuigiSwap/index.js index b0894d586d6..c21035cc955 100644 --- a/projects/LuigiSwap/index.js +++ b/projects/LuigiSwap/index.js @@ -1,6 +1,7 @@ const { getUniTVL } = require("../helper/unknownTokens"); module.exports = { + misrepresentedTokens: true, op_bnb: { tvl: getUniTVL({ factory: "0x0dAe6d22182c20AB9150a4DCB3160591Dc41027a", diff --git a/projects/OpankeSwap/index.js b/projects/OpankeSwap/index.js index 210be546c0c..a523d98fdf9 100644 --- a/projects/OpankeSwap/index.js +++ b/projects/OpankeSwap/index.js @@ -1,10 +1,11 @@ const { getUniTVL } = require("../helper/unknownTokens"); module.exports = { + misrepresentedTokens: true, op_bnb: { tvl: getUniTVL({ factory: "0x4523A7f5414bAc9BfbDfc6eF0932Bf580C3cf9f1", - useDefaultCoreAssets: false, + useDefaultCoreAssets: true, fetchBalances: true, }), }, diff --git a/projects/daomaker-swap/index.js b/projects/daomaker-swap/index.js index 74c23d97f8b..f7fc1f7b870 100644 --- a/projects/daomaker-swap/index.js +++ b/projects/daomaker-swap/index.js @@ -1,10 +1,10 @@ const { getUniTVL } = require('../helper/unknownTokens') module.exports = { - misrepresentedTokens: false, + misrepresentedTokens: true, bsc: { tvl: getUniTVL({ - factory: '0x940BEb635cbEeC04720AC97FADb97205676e6aa4', useDefaultCoreAssets: false, + factory: '0x940BEb635cbEeC04720AC97FADb97205676e6aa4', useDefaultCoreAssets: true, }) }, }; \ No newline at end of file diff --git a/projects/printy/index.js b/projects/printy/index.js index 2e07502f02c..99808dd3aff 100644 --- a/projects/printy/index.js +++ b/projects/printy/index.js @@ -1,8 +1,9 @@ const { uniTvlExport } = require("../helper/calculateUniTvl.js"); module.exports = { + misrepresentedTokens: true, avax: { - tvl: uniTvlExport("0xc62Ca231Cd2b0c530C622269dA02374134511a36", "avax", undefined, undefined, { hasStablePools: true, useDefaultCoreAssets: false, }), + tvl: uniTvlExport("0xc62Ca231Cd2b0c530C622269dA02374134511a36", "avax", undefined, undefined, { hasStablePools: true, useDefaultCoreAssets: true, }), }, }; diff --git a/projects/sealightswap/index.js b/projects/sealightswap/index.js index 34a57823e2a..8b68084027b 100644 --- a/projects/sealightswap/index.js +++ b/projects/sealightswap/index.js @@ -5,7 +5,7 @@ module.exports = { polygon: { tvl: getUniTVL({ factory: '0xd0B30Fc63169bAaa3702ad7ec33EBe3f9e8627c0', - useDefaultCoreAssets: false + useDefaultCoreAssets: true }) }, }; \ No newline at end of file From f28bf12c096ca1014783126ec0a2b7438455f41f Mon Sep 17 00:00:00 2001 From: Bruno Wu Date: Fri, 18 Aug 2023 11:31:27 +0100 Subject: [PATCH 0881/1974] Add New Chains to Gridex --- projects/gridex/index.js | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/projects/gridex/index.js b/projects/gridex/index.js index 576048cb3da..37411b045fb 100644 --- a/projects/gridex/index.js +++ b/projects/gridex/index.js @@ -4,6 +4,7 @@ const { stakings } = require("../helper/staking"); const stakingContract = ["0x035E9062286FD19460B3E22970ebB5691EED2C25"]; const GDX = ["0x2F27118E3D2332aFb7d165140Cf1bB127eA6975d"]; +const factory = "0x32d1F0Dce675902f89D72251DB4AB1d728efa19c"; module.exports = { methodology: `Counts the tokens locked on order book grid`, @@ -18,14 +19,35 @@ module.exports = { }; const config = { - arbitrum: { - factory: "0x32d1F0Dce675902f89D72251DB4AB1d728efa19c", - fromBlock: 64404349, + // arbitrum: { + // factory, + // fromBlock: 64404349, + // hasStaking: true, + // }, + linea: { + factory, + fromBlock: 98996, + hasStaking: false, + }, + // polygon: { + // factory, + // fromBlock: 44421440, + // hasStaking: false, + // }, + // optimism: { + // factory, + // fromBlock: 94046133, + // hasStaking: false, + // }, + base: { + factory, + fromBlock: 2047839, + hasStaking: false, }, }; Object.keys(config).forEach((chain) => { - const { factory, fromBlock } = config[chain]; + const { factory, fromBlock, hasStaking } = config[chain]; module.exports[chain] = { tvl: async (_, _b, _cb, { api }) => { const logs = await getLogs({ @@ -43,6 +65,6 @@ Object.keys(config).forEach((chain) => { const ownerTokens = logs.map((i) => [[i.token0, i.token1], i.grid]); return sumTokens2({ api, ownerTokens }); }, - staking: stakings(stakingContract, GDX), + staking: hasStaking ? stakings(stakingContract, GDX) : undefined, }; }); From 192cfb79209b4ca32aeefea41c3fa0ca16d00b35 Mon Sep 17 00:00:00 2001 From: Bruno Wu Date: Fri, 18 Aug 2023 11:36:24 +0100 Subject: [PATCH 0882/1974] Uncomment other available chains --- projects/gridex/index.js | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/projects/gridex/index.js b/projects/gridex/index.js index 37411b045fb..7bfc331537f 100644 --- a/projects/gridex/index.js +++ b/projects/gridex/index.js @@ -19,26 +19,26 @@ module.exports = { }; const config = { - // arbitrum: { - // factory, - // fromBlock: 64404349, - // hasStaking: true, - // }, + arbitrum: { + factory, + fromBlock: 64404349, + hasStaking: true, + }, linea: { factory, fromBlock: 98996, hasStaking: false, }, - // polygon: { - // factory, - // fromBlock: 44421440, - // hasStaking: false, - // }, - // optimism: { - // factory, - // fromBlock: 94046133, - // hasStaking: false, - // }, + polygon: { + factory, + fromBlock: 44421440, + hasStaking: false, + }, + optimism: { + factory, + fromBlock: 94046133, + hasStaking: false, + }, base: { factory, fromBlock: 2047839, From 3df01aea27d9f123b289c97c0aa13b0345aa4241 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 18 Aug 2023 15:36:53 +0200 Subject: [PATCH 0883/1974] bugfix --- projects/helper/cache.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/helper/cache.js b/projects/helper/cache.js index 9b93ca5a158..becc0980f64 100644 --- a/projects/helper/cache.js +++ b/projects/helper/cache.js @@ -112,7 +112,7 @@ async function cachedGraphQuery(project, endpoint, query, { variables, fetchById json = await graphql.request(endpoint, query, { variables }) else json = await graphFetchById({ endpoint, query, }) - if (!json) throw new error('Empty JSON') + if (!json) throw new Error('Empty JSON') await _setCache(key, project, json) return json } catch (e) { From 12cc7423d17ff48aa1f2eb7d1028ddad8e225b25 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 18 Aug 2023 15:45:41 +0200 Subject: [PATCH 0884/1974] Bucket (#7205) --- projects/bucket-protocol/index.js | 61 +++++++++++++++++++++++-------- 1 file changed, 46 insertions(+), 15 deletions(-) diff --git a/projects/bucket-protocol/index.js b/projects/bucket-protocol/index.js index fd63bbf5196..893a04fffc1 100644 --- a/projects/bucket-protocol/index.js +++ b/projects/bucket-protocol/index.js @@ -15,24 +15,30 @@ const AF_POOL_IDs = [ "0xeec6b5fb1ddbbe2eb1bdcd185a75a8e67f52a5295704dd73f3e447394775402b", ]; +const KRIYA_LP_IDS = [ + "0xcc39bcc2c438a79beb2656ff043714a60baf89ba37592bef2e14ee8bca0cf007", + "0xae1910e5bcb13a4f5b12688f0da939b9c9d3e8a9e8d0a2e02c818f6a94e598fd", +]; + +const KRIYA_POOL_IDs = [ + "0x3c334f9d1b969767007d26bc886786f9f197ffb14771f7903cd8772c46d08dea", + "0xbb4a712b3353176092cdfe3dd2d1251b725f9372e954248e5dd2eb2ab6a5f21a", +]; + async function tvl(_, _1, _2, { api }) { const protocolFields = await sui.getDynamicFieldObjects({ parent: MAINNET_PROTOCOL_ID, }); const aflpObjs = await sui.getObjects(AF_LP_IDs); + const aflStakedList = aflpObjs.map((aflp) => aflp.fields.staked); + const buckAfPoolData = await sui.getObjects(AF_POOL_IDs); - const stakedList = aflpObjs.map((aflp) => aflp.fields.staked); - - const pools = await sui.queryEvents({ - eventType: - "0xefe170ec0be4d762196bedecd7a065816576198a6527c99282a2551aaa7da38c::events::CreatedPoolEvent", - transform: (i) => i.pool_id, - }); - const poolData = await sui.getObjects(pools); - const buckPoolData = AF_POOL_IDs.map((id) => - poolData.find((pool) => pool.fields.id.id === id) + const kriyalpObjs = await sui.getObjects(KRIYA_LP_IDS); + const kriyaStakedList = kriyalpObjs.map( + (kriyalp) => kriyalp.fields.staked.fields.lsp.fields.balance ); + const kriyalpPoolData = await sui.getObjects(KRIYA_POOL_IDs); const bucketList = protocolFields.filter((item) => item.type.includes("Bucket") @@ -45,9 +51,9 @@ async function tvl(_, _1, _2, { api }) { api.add(coin, bucket.fields.collateral_vault); } - for (const tank of tankList) { + /* for (const tank of tankList) { api.add(BUCK, tank.fields.reserve); - } + } */ for (const [ index, @@ -59,14 +65,39 @@ async function tvl(_, _1, _2, { api }) { decimal_scalars, }, }, - ] of buckPoolData.entries()) { + ] of buckAfPoolData.entries()) { bals.forEach((v, i) => { const value = Math.floor( - (v * stakedList[index]) / lp_supply.fields.value / decimal_scalars[i] + (v * aflStakedList[index]) / lp_supply.fields.value / decimal_scalars[i] ); - api.add("0x" + tokens[i], value); + + const token = "0x" + tokens[i] + if (token !== BUCK) api.add(token, value); }); } + + for (const [ + index, + { + type, + fields: { lsp_supply, token_x, token_y }, + }, + ] of kriyalpPoolData.entries()) { + const tokens = type.split("<").pop()?.replace(">", "")?.split(",") ?? []; + const x = tokens[0].trim(); + const y = tokens[1].trim(); + + const xVal = Math.floor( + (token_x * kriyaStakedList[index]) / lsp_supply.fields.value + ); + const yVal = Math.floor( + (token_y * kriyaStakedList[index]) / lsp_supply.fields.value + ); + + console.log(x, y) + if (x !== BUCK) api.add(x, xVal); + if (y !== BUCK) api.add(y, yVal); + } } module.exports = { From 3dd0cc58ba1f3f825d756e2bf8a2ebe99bfa88a4 Mon Sep 17 00:00:00 2001 From: KnightDEXDev <142595722+KnightDEXDev@users.noreply.github.com> Date: Fri, 18 Aug 2023 17:46:05 +0400 Subject: [PATCH 0885/1974] add knightdex tvl (#7203) * add knightdex tvl * minor fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/knightdex/index.js | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 projects/knightdex/index.js diff --git a/projects/knightdex/index.js b/projects/knightdex/index.js new file mode 100644 index 00000000000..dade05359cd --- /dev/null +++ b/projects/knightdex/index.js @@ -0,0 +1,7 @@ +const {getUniTVL} = require("../helper/unknownTokens"); + +module.exports = { + op_bnb: { + tvl: getUniTVL({factory: "0xAe9F4488CC751637b18070c5453a3b7Acc137a3b", useDefaultCoreAssets: true, fetchBalances: true, }) + }, +} From 7ba011af25da5ba596959dd1488e70a4fe7f6883 Mon Sep 17 00:00:00 2001 From: unclesamFi <142605182+unclesamFi@users.noreply.github.com> Date: Fri, 18 Aug 2023 23:06:14 +0800 Subject: [PATCH 0886/1974] Unclesam Finance (#7207) Name (to be shown on DefiLlama):UncleSam Protocol Twitter Link:https://twitter.com/unclesamfi List of audit links if any: https://github.com/freshcoins/Smart-Contract-Audits/blob/main/UncleSam_0x80a3d4999b2836a5ac90b4742da133f5f5f6c27d.pdf Website Link: https://unclesam.finance/ Logo (High resolution, will be shown with rounded borders):https://www.unclesam.finance/favicon.svg Chain:base Short Description (to be shown on DefiLlama): Secure money markets for all crypto assets built on Base Chain. Token address and ticker if any:0x80A3d4999B2836a5ac90B4742Da133F5F5F6C27D Category (full list at https://defillama.com/categories) *Please choose only one:Lending Oracle used (Chainlink/Band/API3/TWAP or any other that you are using):Chainlink --- projects/unclesam.js | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 projects/unclesam.js diff --git a/projects/unclesam.js b/projects/unclesam.js new file mode 100644 index 00000000000..2be1b9b90fd --- /dev/null +++ b/projects/unclesam.js @@ -0,0 +1,10 @@ +const { compoundExports } = require("./helper/compound"); +const unitroller = "0x0cDD860ca594982443E737AC7A0B84f18C477E05"; + +module.exports = { + methodology: + "Same as Compound Finance", + base: { + ...compoundExports(unitroller, "base"), + }, +}; From dd93eb2e31672fd6e75f6d4e10c54f1e9728ef43 Mon Sep 17 00:00:00 2001 From: Bridge <142407089+Bridge-LZ@users.noreply.github.com> Date: Fri, 18 Aug 2023 16:49:59 +0100 Subject: [PATCH 0887/1974] tracking linea (#7206) --- projects/bridge-lz/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/bridge-lz/index.js b/projects/bridge-lz/index.js index 9754a1d2f19..f23006e1821 100644 --- a/projects/bridge-lz/index.js +++ b/projects/bridge-lz/index.js @@ -3,6 +3,7 @@ const { sumTokensExport, nullAddress } = require("../helper/unwrapLPs"); const ADMIN_ADDRESSES = { base: "0x233dc79F924c35AcB4524BaC4A883c8CE11A75B2", optimism: "0x233dc79F924c35AcB4524BaC4A883c8CE11A75B2", + linea: "0x233dc79F924c35AcB4524BaC4A883c8CE11A75B2", } module.exports = { @@ -14,4 +15,4 @@ Object.keys(ADMIN_ADDRESSES).forEach(chain => { module.exports[chain] = { tvl: sumTokensExport({ owner: ADMIN_ADDRESSES[chain], tokens: [nullAddress]}) } -}) \ No newline at end of file +}) From 326f2aa2168f12c6e015cf8a59b6df9822b779e8 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Fri, 18 Aug 2023 23:55:23 +0100 Subject: [PATCH 0888/1974] add baseswap treasury --- projects/treasury/baseswap.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 projects/treasury/baseswap.js diff --git a/projects/treasury/baseswap.js b/projects/treasury/baseswap.js new file mode 100644 index 00000000000..bf51ef7f989 --- /dev/null +++ b/projects/treasury/baseswap.js @@ -0,0 +1,13 @@ +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0xAF1823bACd8EDDA3b815180a61F8741fA4aBc6Dd"; + +module.exports = treasuryExports({ + base: { + tokens: [ + nullAddress, + "0xd9aAEc86B65D86f6A7B5B1b0c42FFA531710b6CA", //USDbC + ], + owners: [treasury,], + }, +}) \ No newline at end of file From a638748a952177925324597005751344cb6ecf03 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Sat, 19 Aug 2023 08:27:11 +0200 Subject: [PATCH 0889/1974] cache uniswap graph res --- projects/helper/cache.js | 4 +-- projects/uniswap/index.js | 51 +++++++++++++++------------------------ 2 files changed, 22 insertions(+), 33 deletions(-) diff --git a/projects/helper/cache.js b/projects/helper/cache.js index becc0980f64..58eaf4731ce 100644 --- a/projects/helper/cache.js +++ b/projects/helper/cache.js @@ -98,7 +98,7 @@ async function configPost(project, endpoint, data) { } -async function cachedGraphQuery(project, endpoint, query, { variables, fetchById } = {}) { +async function cachedGraphQuery(project, endpoint, query, { variables = {}, fetchById, } = {}) { if (!project || !endpoint) throw new Error('Missing parameters') const key = 'config-cache' const cacheKey = getKey(key, project) @@ -111,7 +111,7 @@ async function cachedGraphQuery(project, endpoint, query, { variables, fetchById if (!fetchById) json = await graphql.request(endpoint, query, { variables }) else - json = await graphFetchById({ endpoint, query, }) + json = await graphFetchById({ endpoint, query, params: variables }) if (!json) throw new Error('Empty JSON') await _setCache(key, project, json) return json diff --git a/projects/uniswap/index.js b/projects/uniswap/index.js index 4530e7d213c..cb8074493c0 100644 --- a/projects/uniswap/index.js +++ b/projects/uniswap/index.js @@ -1,7 +1,5 @@ -const { request, gql } = require('graphql-request'); -const { getBlock } = require('../helper/http'); -const { sumTokens2 } = require('../helper/unwrapLPs') const { uniV3Export } = require('../helper/uniswapV3') +const { cachedGraphQuery } = require('../helper/cache') const graphs = { ethereum: "https://api.thegraph.com/subgraphs/name/uniswap/uniswap-v3", @@ -15,21 +13,18 @@ const graphs = { } const blacklists = { - ethereum: ['0xa850478adaace4c08fc61de44d8cf3b64f359bec', '0x055284a4ca6532ecc219ac06b577d540c686669d', '0x8c0411f2ad5470a66cb2e9c64536cfb8dcd54d51', '0x277667eb3e34f134adf870be9550e9f323d0dc24','0x4c83a7f819a5c37d64b4c5a2f8238ea082fa1f4e','0x290a6a7460b308ee3f19023d2d00de604bcf5b42','0x4b5ab61593a2401b1075b90c04cbcdd3f87ce011','0x582d23c7ec6b59afd041a522ff64ff081e8c0d2d','0x1f98431c8ad98523631ae4a59f267346ea31f984', '0xaf44e10ed87d90f28bff2d1fbef1f64b090f5ebb', ], - arbitrum: ['0xd4d2f4110878a33ea5b97f0665e518253446161a', '0xB50721BCf8d664c30412Cfbc6cf7a15145234ad1', ], - polygon: ['0x8d52c2d70a7c28a9daac2ff12ad9bfbf041cd318', '0x1f98431c8ad98523631ae4a59f267346ea31f984','0xd5302a8ead77b85ea3326b45f4714e0b3432b233','0xc951ab482ff11d8df636742e1f1c3fc8037427a9', ], + ethereum: ['0xa850478adaace4c08fc61de44d8cf3b64f359bec', '0x055284a4ca6532ecc219ac06b577d540c686669d', '0x8c0411f2ad5470a66cb2e9c64536cfb8dcd54d51', '0x277667eb3e34f134adf870be9550e9f323d0dc24', '0x4c83a7f819a5c37d64b4c5a2f8238ea082fa1f4e', '0x290a6a7460b308ee3f19023d2d00de604bcf5b42', '0x4b5ab61593a2401b1075b90c04cbcdd3f87ce011', '0x582d23c7ec6b59afd041a522ff64ff081e8c0d2d', '0x1f98431c8ad98523631ae4a59f267346ea31f984', '0xaf44e10ed87d90f28bff2d1fbef1f64b090f5ebb',], + arbitrum: ['0xd4d2f4110878a33ea5b97f0665e518253446161a', '0xB50721BCf8d664c30412Cfbc6cf7a15145234ad1',], + polygon: ['0x8d52c2d70a7c28a9daac2ff12ad9bfbf041cd318', '0x1f98431c8ad98523631ae4a59f267346ea31f984', '0xd5302a8ead77b85ea3326b45f4714e0b3432b233', '0xc951ab482ff11d8df636742e1f1c3fc8037427a9',], } function v3TvlPaged(chain) { - return async (_, _b, { [chain]: block }) => { - block = await getBlock(_, chain, { [chain]: block }) - const balances = {} - const size = 1000 - let lastId = '' - let pools - let graphQueryPaged = gql` + return async (_, _b, _2, { api }) => { + const block = await api.getBlock() + + let graphQueryPaged = ` query poolQuery($lastId: String, $block: Int) { - pools(block: { number: $block } first:${size} where: {id_gt: $lastId totalValueLockedUSD_gt: 100}) { + pools(block: { number: $block } first:1000 where: {id_gt: $lastId totalValueLockedUSD_gt: 100}) { id token0 { id } token1 { id } @@ -37,29 +32,23 @@ function v3TvlPaged(chain) { } ` - if (chain === 'celo') // we dont care about block - graphQueryPaged = gql` + if (chain === 'celo') // we dont care about block + graphQueryPaged = ` query poolQuery($lastId: String) { - pools(first:${size} where: {id_gt: $lastId totalValueLockedUSD_gt: 100}) { + pools(first:1000 where: {id_gt: $lastId totalValueLockedUSD_gt: 100}) { id token0 { id } token1 { id } } } ` - - // remove the bad pools + + const pools = await cachedGraphQuery('uniswap-v3/' + api.chain, graphs[chain], graphQueryPaged, { variables: { block: block - 500 }, fetchById: true }) const blacklisted = blacklists[chain] || [] - do { - const res = await request(graphs[chain], graphQueryPaged, { lastId, block: block - 5000 }); - pools = res.pools - const tokensAndOwners = pools.map(i => ([[i.token0.id, i.id], [i.token1.id, i.id]])).flat() - await sumTokens2({ balances, tokensAndOwners, chain, block, blacklistedTokens: blacklisted }) - lastId = pools[pools.length - 1]?.id - } while (pools.length === size) + const tokensAndOwners = pools.map(i => ([[i.token0.id, i.id], [i.token1.id, i.id]])).flat() + return api.sumTokens({ tokensAndOwners, blacklistedTokens: blacklisted }) - return balances } } @@ -75,12 +64,12 @@ module.exports = { [1617333707, "FEI launch"], [1620156420, "UNI V3 Launch"] ], - ...uniV3Export({ - base: { factory: '0x33128a8fc17869897dce68ed026d694621f6fdfd', fromBlock:1371680, } - }) + ...uniV3Export({ + base: { factory: '0x33128a8fc17869897dce68ed026d694621f6fdfd', fromBlock: 1371680, } + }) } -const chains = [ 'ethereum', 'arbitrum', 'optimism', 'polygon', 'celo', 'bsc', 'avax', ] +const chains = ['ethereum', 'arbitrum', 'optimism', 'polygon', 'celo', 'bsc', 'avax',] chains.forEach(chain => { module.exports[chain] = { From c6c88ae952e11f238a5a5ba2256f9c30fe2968a7 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Sun, 20 Aug 2023 17:11:11 +0200 Subject: [PATCH 0890/1974] fix justlend --- projects/helper/unwrapLPs.js | 1 + projects/justlend.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/helper/unwrapLPs.js b/projects/helper/unwrapLPs.js index 851b56b53e1..84caf17f429 100644 --- a/projects/helper/unwrapLPs.js +++ b/projects/helper/unwrapLPs.js @@ -376,6 +376,7 @@ async function sumBalancerLps(balances, tokensAndOwners, block, chain, transform } async function getTrxBalance(account) { + if (account === '0x2c7c9963111905d29eb8da37d28b0f53a7bb5c28') account = 'TE2RzoSV3wFK99w6J9UnnZ4vLfXYoxvRwP' const data = await get('https://apilist.tronscan.org/api/account?address=' + account) return data.balance + (data.totalFrozen || 0) } diff --git a/projects/justlend.js b/projects/justlend.js index f609798c856..ca90788a59f 100644 --- a/projects/justlend.js +++ b/projects/justlend.js @@ -2,5 +2,5 @@ const { compoundExports2 } = require('./helper/compound') const ADDRESSES = require('./helper/coreAssets.json') module.exports = { - tron: compoundExports2({ comptroller: 'TGjYzgCyPobsNS9n6WcbdLVR9dH7mWqFx7', cether: '0x2c7c9963111905d29eb8da37d28b0f53a7bb5c28', cetheEquivalent: ADDRESSES.tron.WTRX, transformAdressRaw: i => 'tron:' + i }), + tron: compoundExports2({ comptroller: 'TGjYzgCyPobsNS9n6WcbdLVR9dH7mWqFx7', cether: '0x2c7c9963111905d29eb8da37d28b0f53a7bb5c28', cetheEquivalent: ADDRESSES.null, transformAdressRaw: i => 'tron:' + i }), }; From 85efcc9e46b585a82d9d6af9ea05d8c42a7b0937 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Sun, 20 Aug 2023 19:32:38 +0200 Subject: [PATCH 0891/1974] fix terra issue --- projects/helper/chain/cosmos.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/helper/chain/cosmos.js b/projects/helper/chain/cosmos.js index a4e8347b47c..0d65792835d 100644 --- a/projects/helper/chain/cosmos.js +++ b/projects/helper/chain/cosmos.js @@ -14,8 +14,8 @@ const endPoints = { cosmos: "https://cosmoshub-lcd.stakely.io", kujira: "https://kuji-api.kleomedes.network", comdex: "https://rest.comdex.one", - terra: "https://terraclassic-lcd-server-01.stakely.io", - terra2: "https://lcd-terra2.whispernode.com:443", + terra: "https://rest.cosmos.directory/terra", + terra2: "https://terra-lcd.publicnode.com", umee: "https://umee-api.polkachu.com", orai: "https://lcd.orai.io", juno: "https://lcd-juno.cosmostation.io", From 5d24aca2628ed761c56b5e934213635cee99cf9b Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Sun, 20 Aug 2023 20:56:09 +0100 Subject: [PATCH 0892/1974] add meowl treasury --- projects/treasury/meowl.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 projects/treasury/meowl.js diff --git a/projects/treasury/meowl.js b/projects/treasury/meowl.js new file mode 100644 index 00000000000..e17d0e8afe6 --- /dev/null +++ b/projects/treasury/meowl.js @@ -0,0 +1,15 @@ +const ADDRESSES = require('../helper/coreAssets.json'); +const { nullAddress } = require('../helper/tokenMapping'); +const { treasuryExports } = require("../helper/treasury"); + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress + ], + owners: [ + "0x842618c3f6E3E12edc5F02CC17561293e10CEb7d", + ], + ownTokens: ["0x1F1F26C966F483997728bEd0F9814938b2B5E294"], + }, +}) \ No newline at end of file From efca3c24acf9a00982eecba12a88960b85a93dd7 Mon Sep 17 00:00:00 2001 From: 0xPeche <114630968+0xpeche@users.noreply.github.com> Date: Sun, 20 Aug 2023 22:27:53 +0200 Subject: [PATCH 0893/1974] add meowl tvl (#7208) --- projects/meowl/index.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 projects/meowl/index.js diff --git a/projects/meowl/index.js b/projects/meowl/index.js new file mode 100644 index 00000000000..dacb86ee890 --- /dev/null +++ b/projects/meowl/index.js @@ -0,0 +1,13 @@ +const { staking } = require("../helper/staking"); +const { pool2 } = require("../helper/pool2"); + +const MEOWL = "0x1f1f26c966f483997728bed0f9814938b2b5e294"; +const stakingContract = "0x679a376dab6318d62de3c87292e207532c8607a9"; + +module.exports = { + methodology: `TVL for MEOWL consists of the staking of MEOWL tokens`, + ethereum: { + tvl: () => ({}), + staking: staking(stakingContract, MEOWL, "ethereum"), + } +} \ No newline at end of file From 457f611c3bba8ba2083af253f9cb893c499d8ad4 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 21 Aug 2023 08:32:26 +0200 Subject: [PATCH 0894/1974] yama: track polgon_zkevm --- projects/yama-finance/index.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/projects/yama-finance/index.js b/projects/yama-finance/index.js index ff97168556e..1c91958269b 100644 --- a/projects/yama-finance/index.js +++ b/projects/yama-finance/index.js @@ -3,18 +3,18 @@ const { getLogs } = require('../helper/cache/getLogs') const { sumTokens2 } = require('../helper/unwrapLPs') async function tvl(_, _b, _cb, { api, }) { - const CDP = '0x1cd97ee98f3423222f7b4cddb383f2ee2907e628' + const { CDP, fromBlock, PSM, USDT } = config[api.chain] const logs = await getLogs({ api, target: CDP, topic: 'AddCollateralType(uint256,address,address,uint256,uint256,uint256,uint256,bool,bool)', eventAbi: 'event AddCollateralType(uint256 indexed collateralTypeId, address indexed token, address priceSource, uint256 debtFloor, uint256 debtCeiling, uint256 collateralRatio, uint256 interestRate, bool borrowingEnabled, bool allowlistEnabled)', onlyArgs: true, - fromBlock: 72920436, + fromBlock, }) const ownerTokens = [ - [[ADDRESSES.arbitrum.USDT], '0x0e1Ddf8D61f0570Bf786594077CD431c727335A9'], // psm module + [[USDT], PSM], // psm module ] ownerTokens.push([logs.map(i => i.token), CDP]) @@ -25,3 +25,12 @@ async function tvl(_, _b, _cb, { api, }) { module.exports = { arbitrum: { tvl }} module.exports.methodology = "mooGmxGLP in CDP Module and USDT in PSM"; +const config = { + arbitrum: { CDP: '0x1cd97ee98f3423222f7b4cddb383f2ee2907e628', USDT: ADDRESSES.arbitrum.USDT, fromBlock: 72920436, PSM: '0x0e1Ddf8D61f0570Bf786594077CD431c727335A9'}, + polygon_zkevm: { CDP: '0x36C4E69aacBd10C28beBe4cAd2188f3809CB5226', USDT: '0x1E4a5963aBFD975d8c9021ce480b42188849D41d', fromBlock: 3678493, PSM: '0x896cd0b08AdC23cA7F9e5dAaA82ca6e6Ea8576D5'}, +} + +Object.keys(config).forEach(chain => { + module.exports[chain] = { tvl } +}) + From dfaf3ed07594d01ab9bf29251d8a29b5c015267a Mon Sep 17 00:00:00 2001 From: MagnateFi <126637939+MagnateArb@users.noreply.github.com> Date: Mon, 21 Aug 2023 14:34:38 +0800 Subject: [PATCH 0895/1974] Update index.js (#7209) Add MAG staking for TVL calculation --- projects/Magnate/index.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/projects/Magnate/index.js b/projects/Magnate/index.js index 5f81be136cd..d9eaafc1ccd 100644 --- a/projects/Magnate/index.js +++ b/projects/Magnate/index.js @@ -1,4 +1,6 @@ const { compoundExports2 } = require("../helper/compound"); +const { staking } = require('../helper/staking') +const { pool2 } = require('../helper/pool2') module.exports = { base: compoundExports2({ @@ -7,3 +9,6 @@ module.exports = { cether: '0x68725461357B7e5e059A224B3b2fC45F3654c889', }), }; + +module.exports.base.staking = staking('0xaa8578b6F2860EbA5685090A3E002430ba046a4C', '0x2DC1cDa9186a4993bD36dE60D08787c0C382BEAD', 'base') +module.exports.base.pool2 = pool2('0x3B87B63b5E84e6F9A173D15ad4cdB3263B550064', '0xC2dced7Ce908652d3b55D55555DcE96b6cdCB191', 'base') From c4299b8c12bec433a0ffe06a43bd6fa9f37807d0 Mon Sep 17 00:00:00 2001 From: Mobydex <141993159+mobydex-labs@users.noreply.github.com> Date: Mon, 21 Aug 2023 15:37:41 +0900 Subject: [PATCH 0896/1974] Add files via upload (#7210) * Add files via upload * minor fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/mobydex/index.js | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 projects/mobydex/index.js diff --git a/projects/mobydex/index.js b/projects/mobydex/index.js new file mode 100644 index 00000000000..5aac8a274a1 --- /dev/null +++ b/projects/mobydex/index.js @@ -0,0 +1,11 @@ +const { getUniTVL } = require("../helper/unknownTokens"); + +module.exports = { + op_bnb: { + tvl: getUniTVL({ + factory: "0x9864C78acCe7837Ad1DA8f9BbECcf2dbE562e698", + useDefaultCoreAssets: true, + fetchBalances: true, + }), + }, +}; From 77a63670952ae4b1aa26f6067314c9d8e91a347b Mon Sep 17 00:00:00 2001 From: EnergonDex <142735569+EnergonDex@users.noreply.github.com> Date: Mon, 21 Aug 2023 08:45:35 +0200 Subject: [PATCH 0897/1974] Add Energon Dex (#7214) * Add files via upload * Add files via upload * minor fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/energondex/index.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 projects/energondex/index.js diff --git a/projects/energondex/index.js b/projects/energondex/index.js new file mode 100644 index 00000000000..c296374609a --- /dev/null +++ b/projects/energondex/index.js @@ -0,0 +1,23 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { getUniTVL, staking } = require('../helper/unknownTokens') +const sdk = require('@defillama/sdk') +const uniTvl = getUniTVL({ factory: '0xBfAe4f07C099798F23f5aC6773532fB637B68Ad7', useDefaultCoreAssets: true, fetchBalances: true, }) +const masterchef = '0x9A40F8374cf840cb1d76DD085E250D86641FB6a3' +const egd = '0xF8F85beB4121fDAa9229141e5D5e4B782d8819D8' +const weth = ADDRESSES.base.WETH + +module.exports = { + misrepresentedTokens: true, + base: { + tvl: sdk.util.sumChainTvls([uniTvl, staking({ + owners: [masterchef], + tokens: [weth], + })]), + staking: staking({ + owners: [masterchef], + tokens: [egd], + lps: ['0x7A7923281B5E56c41b11393689Be1d74E79098c0'], + useDefaultCoreAssets: true, + }) + } +}; \ No newline at end of file From c96ee711a026538acff2b43bb5eff862f97d2923 Mon Sep 17 00:00:00 2001 From: Bridge <142407089+Bridge-LZ@users.noreply.github.com> Date: Mon, 21 Aug 2023 07:46:12 +0100 Subject: [PATCH 0898/1974] add Bridge ethereum tracking (#7213) --- projects/bridge-lz/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/bridge-lz/index.js b/projects/bridge-lz/index.js index f23006e1821..72800e09d88 100644 --- a/projects/bridge-lz/index.js +++ b/projects/bridge-lz/index.js @@ -1,6 +1,7 @@ const { sumTokensExport, nullAddress } = require("../helper/unwrapLPs"); const ADMIN_ADDRESSES = { + ethereum: "0x233dc79F924c35AcB4524BaC4A883c8CE11A75B2", base: "0x233dc79F924c35AcB4524BaC4A883c8CE11A75B2", optimism: "0x233dc79F924c35AcB4524BaC4A883c8CE11A75B2", linea: "0x233dc79F924c35AcB4524BaC4A883c8CE11A75B2", From 654e7220b3bb6f6e7f48feb44dafe68161da9e7c Mon Sep 17 00:00:00 2001 From: define Date: Mon, 21 Aug 2023 12:53:09 +0100 Subject: [PATCH 0899/1974] add core chain to sushiswap --- projects/sushiswap-v3/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/projects/sushiswap-v3/index.js b/projects/sushiswap-v3/index.js index de5341e54c4..e2d1c1a371d 100644 --- a/projects/sushiswap-v3/index.js +++ b/projects/sushiswap-v3/index.js @@ -66,4 +66,8 @@ module.exports = uniV3Export({ '0x0b0fd8317735dd9fe611fbc7e1d138149f8ebcea', ] }, + core: { + factory: "0xc35DADB65012eC5796536bD9864eD8773aBc74C4", + fromBlock: 5211850, + }, }); From 05b8c944012c95ab81e14b8f6b188339bd714c5c Mon Sep 17 00:00:00 2001 From: "3.141592653589793238462643383279" Date: Mon, 21 Aug 2023 20:13:52 +0700 Subject: [PATCH 0900/1974] feat: separate scallop pool from scallop (#7212) --- projects/scallop-pool/active-pools.json | 22 +++++++++ projects/scallop-pool/index.js | 62 +++++++++++++++++++++++++ projects/scallop/index.js | 58 ----------------------- 3 files changed, 84 insertions(+), 58 deletions(-) create mode 100644 projects/scallop-pool/active-pools.json create mode 100644 projects/scallop-pool/index.js diff --git a/projects/scallop-pool/active-pools.json b/projects/scallop-pool/active-pools.json new file mode 100644 index 00000000000..60edfb61066 --- /dev/null +++ b/projects/scallop-pool/active-pools.json @@ -0,0 +1,22 @@ +[ + { + "base": "SoLKL9GATA3iSJxkn2Z3ossP4ktgwFoQoTYBSXUzyRs", + "coingeckoId": "solana" + }, + { + "base": "USDCYdkkgP2zJ3jwF6mzwMpxngaqKi2jfvxPjodrMLi", + "coingeckoId": "usd-coin" + }, + { + "base": "USDTSdRp4ETB4cKe6YG3XcitKXhgvnbgeWcwzTiRCuu", + "coingeckoId": "usd-coin" + }, + { + "base": "ETHrj1rqFbiVbHBypZjuG46J6pS5PyL5f6m6v2VniBJV", + "coingeckoId": "ethereum" + }, + { + "base": "BTCwQoswFGLoX9igmJFfUJrKgAGJkbt5iVF2czw2Qpxn", + "coingeckoId": "bitcoin" + } +] \ No newline at end of file diff --git a/projects/scallop-pool/index.js b/projects/scallop-pool/index.js new file mode 100644 index 00000000000..71a85b037c2 --- /dev/null +++ b/projects/scallop-pool/index.js @@ -0,0 +1,62 @@ +const anchor = require("@project-serum/anchor"); +const { PublicKey } = require("@solana/web3.js"); +const activePoolBases = require("./active-pools.json"); +const { getConnection, decodeAccount } = require("../helper/solana"); +const sdk = require('@defillama/sdk') + +const SCALLOP_PROGRAM_ID = new PublicKey("SCPv1LabixHirZbX6s7Zj3oiBogadWZvGUKRvXD3Zec"); + +// seeds +const COUPON_SEED = "coupon_seed"; +const POOL_AUTHORITY = "pool_authority_seed"; + +function getTokenGeckoId(mintAuthority) { + for (let i = 0; i < activePoolBases.length; i++) { + const pubkey = new PublicKey(activePoolBases[i].base) + const [couponMintAuthority, _couponMintAuthorityBump] = PublicKey.findProgramAddressSync([ + anchor.utils.bytes.utf8.encode(POOL_AUTHORITY), + pubkey.toBytes() + ], SCALLOP_PROGRAM_ID); + if (couponMintAuthority.equals(mintAuthority)) + return activePoolBases[i].coingeckoId; + } +} + +async function solanaTvl() { + const connection = getConnection() + + // at Scallop, coupon representing deposited amount of a pool + let couponAddresses = []; + for (let i = 0; i < activePoolBases.length; i++) { + const pubkey = new PublicKey(activePoolBases[i].base) + const [couponAddress, _couponAddressBump] = PublicKey.findProgramAddressSync([ + anchor.utils.bytes.utf8.encode(COUPON_SEED), + pubkey.toBytes() + ], SCALLOP_PROGRAM_ID); + couponAddresses.push(couponAddress); + } + + const balances = {} + const coupons = await connection.getMultipleAccountsInfo(couponAddresses); + coupons.forEach((curr) => { + if (curr === null) + return; + + if (curr.data.length !== 82) // invalid mint + return; + + const mintInfo = decodeAccount('mint', curr); + const geckoId = getTokenGeckoId(mintInfo.mintAuthority) + if (!geckoId) return; + const amount = (mintInfo.supply.toString() / Math.pow(10, mintInfo.decimals)) + sdk.util.sumSingleBalance(balances, geckoId, amount) + }); + return balances; +} + +module.exports = { + timetravel: false, + solana: { + tvl: solanaTvl, + }, + } \ No newline at end of file diff --git a/projects/scallop/index.js b/projects/scallop/index.js index 5d7ad92a46e..56edb8f2775 100644 --- a/projects/scallop/index.js +++ b/projects/scallop/index.js @@ -1,63 +1,8 @@ -const anchor = require("@project-serum/anchor"); -const { PublicKey } = require("@solana/web3.js"); -const activePoolBases = require("./active-pools.json"); -const { getConnection, decodeAccount } = require("../helper/solana"); const sui = require("../helper/chain/sui"); -const sdk = require('@defillama/sdk') const BigNumber = require("bignumber.js"); -const SCALLOP_PROGRAM_ID = new PublicKey("SCPv1LabixHirZbX6s7Zj3oiBogadWZvGUKRvXD3Zec"); - -// seeds -const COUPON_SEED = "coupon_seed"; -const POOL_AUTHORITY = "pool_authority_seed"; - const SCALLOP_SUI_MARKET_ID = "0xa757975255146dc9686aa823b7838b507f315d704f428cbadad2f4ea061939d9" -function getTokenGeckoId(mintAuthority) { - for (let i = 0; i < activePoolBases.length; i++) { - const pubkey = new PublicKey(activePoolBases[i].base) - const [couponMintAuthority, _couponMintAuthorityBump] = PublicKey.findProgramAddressSync([ - anchor.utils.bytes.utf8.encode(POOL_AUTHORITY), - pubkey.toBytes() - ], SCALLOP_PROGRAM_ID); - if (couponMintAuthority.equals(mintAuthority)) - return activePoolBases[i].coingeckoId; - } -} - -async function solanaTvl() { - const connection = getConnection() - - // at Scallop, coupon representing deposited amount of a pool - let couponAddresses = []; - for (let i = 0; i < activePoolBases.length; i++) { - const pubkey = new PublicKey(activePoolBases[i].base) - const [couponAddress, _couponAddressBump] = PublicKey.findProgramAddressSync([ - anchor.utils.bytes.utf8.encode(COUPON_SEED), - pubkey.toBytes() - ], SCALLOP_PROGRAM_ID); - couponAddresses.push(couponAddress); - } - - const balances = {} - const coupons = await connection.getMultipleAccountsInfo(couponAddresses); - coupons.forEach((curr) => { - if (curr === null) - return; - - if (curr.data.length !== 82) // invalid mint - return; - - const mintInfo = decodeAccount('mint', curr); - const geckoId = getTokenGeckoId(mintInfo.mintAuthority) - if (!geckoId) return; - const amount = (mintInfo.supply.toString() / Math.pow(10, mintInfo.decimals)) - sdk.util.sumSingleBalance(balances, geckoId, amount) - }); - return balances; -} - async function suiBorrowed() { const { api } = arguments[3] const object = await sui.getObject(SCALLOP_SUI_MARKET_ID) @@ -105,9 +50,6 @@ async function suiTvl() { module.exports = { timetravel: false, - solana: { - tvl: solanaTvl, - }, sui: { tvl: suiTvl, borrowed: suiBorrowed, From dd480368e0baa7e5d92622a56d4cc159325bb286 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 21 Aug 2023 15:23:06 +0200 Subject: [PATCH 0901/1974] Mendi (#7227) --- projects/mendi-finance/index.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 projects/mendi-finance/index.js diff --git a/projects/mendi-finance/index.js b/projects/mendi-finance/index.js new file mode 100644 index 00000000000..cc5132525b1 --- /dev/null +++ b/projects/mendi-finance/index.js @@ -0,0 +1,17 @@ +const { compoundExports2 } = require("../helper/compound"); +const { staking } = require("../helper/staking"); + +module.exports = { + methodology: + "Same as Compound Finance, we just count all the tokens supplied (not borrowed money) on the lending markets", + linea: { + ...compoundExports2({ comptroller: '0x1b4d3b0421dDc1eB216D230Bc01527422Fb93103'}), + staking: staking( + [ + "0x150b1e51738cdf0ccfe472594c62d7d6074921ca", + "0xcf8dedcdc62317beaedfbee3c77c08425f284486", + ], + "0x43e8809ea748eff3204ee01f08872f063e44065f" + ), + }, +}; From 36b8c819d6c77f9e162a1723bc548fc5ea8eada6 Mon Sep 17 00:00:00 2001 From: Tempest Capital <129153004+TempestGit@users.noreply.github.com> Date: Mon, 21 Aug 2023 21:25:08 +0800 Subject: [PATCH 0902/1974] Update index.js (#7219) Add TVL on Base Chain --- projects/tempest/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/projects/tempest/index.js b/projects/tempest/index.js index b2419c658cc..a3b893ead32 100644 --- a/projects/tempest/index.js +++ b/projects/tempest/index.js @@ -4,5 +4,9 @@ module.exports = { optimism: compoundExports2({ comptroller: '0x505E91a70aA5036677A71b2Af8D1881B85181EAE', cether: '0x736440033C4C1C8A21e0B238989FE24bEC502014', + }), + base: compoundExports2({ + comptroller: '0x70Ee857E659806D9c19431b0dF96D813Bc98321b', + cether: '0x6283829589A6A02981B425fd2e86D22F012191aC', }) -}; \ No newline at end of file +}; From 934b199b3123e2c2e4db66e0cdf585d01a819d29 Mon Sep 17 00:00:00 2001 From: cochilli <138674364+cochilli@users.noreply.github.com> Date: Mon, 21 Aug 2023 13:35:55 +0000 Subject: [PATCH 0903/1974] cochilli: update contract address (#7220) * update the cochilli contract address * minor fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/cochilli/index.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/projects/cochilli/index.js b/projects/cochilli/index.js index cbd91810366..d99135f7d7b 100644 --- a/projects/cochilli/index.js +++ b/projects/cochilli/index.js @@ -1,11 +1,10 @@ const ADDRESSES = require('../helper/coreAssets.json') const { sumTokensExport } = require('../helper/unwrapLPs'); -const owner = "0x8D5b64b8D8904E4aEc79F10468F347534D2A1b79"; // vault address const tokens = [ADDRESSES.base.USDbC]; // USDC module.exports = { - base: { - tvl: sumTokensExport({ owner, tokens }), + base: { // sum vault balances + tvl: sumTokensExport({ owners: ['0x8D5b64b8D8904E4aEc79F10468F347534D2A1b79', '0xcE42C112e617c9BB1Bd8238D6Bb83B89e112fDbc'], tokens }), }, }; From 904358e3c25bbe89cdf13825b977aafacf3bf5ef Mon Sep 17 00:00:00 2001 From: PixelSwapDex <142522818+PixelSwapDex@users.noreply.github.com> Date: Mon, 21 Aug 2023 20:37:51 +0700 Subject: [PATCH 0904/1974] Adding more chain support on PixelSwap with Zkync and Arbitrum One (#7222) * abc * Abc --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/pixelswap/index.js | 31 ++++++++++++------------------- 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/projects/pixelswap/index.js b/projects/pixelswap/index.js index 16a5cf869cd..6635b2c73d6 100644 --- a/projects/pixelswap/index.js +++ b/projects/pixelswap/index.js @@ -1,23 +1,16 @@ const { getUniTVL } = require('../helper/unknownTokens') const FACTORY = "0xD07739a9E9C46D3DedeD97c0edC49cea8BAB1Bb9" - -const dexTVL = getUniTVL({ - factory: FACTORY, - useDefaultCoreAssets: true, - fetchBalances: true, -}) - +const ZKSYNC_FACTORY = "0x8435bd22e705DCeFCf6EF8b921E6dB534a4E9902" +const dexTVL = getUniTVL({ factory: FACTORY, useDefaultCoreAssets: true, fetchBalances: true, }) module.exports = { - misrepresentedTokens: true, - methodology: `Uses Uniswap-style factory address to find and price liquidity pairs.`, - base: { - tvl: dexTVL, - }, - op_bnb: { - tvl: dexTVL, - }, - linea: { - tvl: dexTVL, - } -}; \ No newline at end of file + misrepresentedTokens: true, + methodology: `Uses Uniswap-style factory address to find and price liquidity pairs.`, + base: { tvl: dexTVL, }, + op_bnb: { tvl: dexTVL, }, + linea: { tvl: dexTVL, }, + arbitrum: { tvl: dexTVL, }, + era: { + tvl: getUniTVL({ factory: ZKSYNC_FACTORY, useDefaultCoreAssets: true, fetchBalances: true, }) + } +} \ No newline at end of file From 1399985d8e593b1cec8a76eb87f02c20703a4fa7 Mon Sep 17 00:00:00 2001 From: shinobu1729 <123061580+shinobu1729@users.noreply.github.com> Date: Mon, 21 Aug 2023 20:38:07 +0700 Subject: [PATCH 0905/1974] add orange-finance (#7221) * add orange-finance * minor fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/orange-finance/index.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 projects/orange-finance/index.js diff --git a/projects/orange-finance/index.js b/projects/orange-finance/index.js new file mode 100644 index 00000000000..caca39fb403 --- /dev/null +++ b/projects/orange-finance/index.js @@ -0,0 +1,24 @@ +const ADDRESSES = require("../helper/coreAssets.json"); + +const VAULTS = [ + "0xb9c5425084671221d7d5a547dbf1bdcec26c8b7d", //Camelot ETH-USDC.e DN Vault + "0x1c99416c7243563ebEDCBEd91ec8532fF74B9a39", //UniswapV3 ETH-USDC.e Dynamic Hedge Vault +]; + +async function tvl(_, _1, _2, { api }) { + const totalAssets = await api.multiCall({ abi: "uint256:totalAssets", calls: VAULTS }) + + totalAssets.forEach((i) => api.add(ADDRESSES.arbitrum.USDC, i)) +} + +module.exports = { + doublecounted: true, + start: 107356480, + arbitrum: { + tvl, + }, + hallmarks: [ + [1682680200, "Orange Alpha Vault Launch"], //2023 Apr 28 + [1688385600, "Camelot Vault Launch"], //2023 Jul 3 + ], +}; From bbdaa02a4fa0b003501739bd82ea98a2ea98cbb3 Mon Sep 17 00:00:00 2001 From: zenafi <142791103+zenafi@users.noreply.github.com> Date: Mon, 21 Aug 2023 19:15:16 +0530 Subject: [PATCH 0906/1974] Add Zena-V2 (#7226) * Add Zena-V2 * minor fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/zena-v2/index.js | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 projects/zena-v2/index.js diff --git a/projects/zena-v2/index.js b/projects/zena-v2/index.js new file mode 100644 index 00000000000..811b45603cb --- /dev/null +++ b/projects/zena-v2/index.js @@ -0,0 +1,7 @@ +const {getUniTVL} = require("../helper/unknownTokens"); + +module.exports = { + op_bnb: { + tvl: getUniTVL({ factory: "0x8b4FC88973E5b8348640d35E49b1e9cE8AAc180A", useDefaultCoreAssets: true, fetchBalances: true, }) + }, +}; From 68d4e3a5c4ca2adbffffd0c13a6c69031a8333a1 Mon Sep 17 00:00:00 2001 From: Raccoon Finance <142802559+RaccoonYields@users.noreply.github.com> Date: Mon, 21 Aug 2023 21:45:26 +0800 Subject: [PATCH 0907/1974] Listing Raccoon Finance (#7225) * Listing Raccoon Finance * minor fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/racoon/index.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 projects/racoon/index.js diff --git a/projects/racoon/index.js b/projects/racoon/index.js new file mode 100644 index 00000000000..8743246e345 --- /dev/null +++ b/projects/racoon/index.js @@ -0,0 +1,17 @@ +const { yieldHelper, } = require("../helper/yieldHelper") + +const vault = '0xe798458bbE3282b38C8df1372a17E829927adACe' +const raccoon = '0x1299aA83ECa28D799349e9946D38C84D310b7450' + +module.exports = yieldHelper({ + project: 'raccoon-finance', + chain: 'base', + masterchef: vault, + nativeToken: raccoon, + abis: { + poolInfo: 'function poolInfo(uint256) view returns (address want, uint256 , uint256 , uint256 , uint256 , uint256 , uint256 , uint256 amount, uint256 , address strat)', + poolLength: 'function poolLength() view returns (uint256)', + getReservesABI: 'function getReserves() view returns (uint112 _reserve0, uint112 _reserve1)', + }, + useDefaultCoreAssets: true, +}) \ No newline at end of file From b2fb4b2cee1f8315d5491bbdcfcb047464b8738a Mon Sep 17 00:00:00 2001 From: Baptiste Guerin <38328426+BaptistG@users.noreply.github.com> Date: Mon, 21 Aug 2023 18:18:59 +0200 Subject: [PATCH 0908/1974] [Angle] Fix borrow module data (#7230) --- projects/angle/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/angle/index.js b/projects/angle/index.js index 7ccf24f94a3..9d5cf87c75c 100644 --- a/projects/angle/index.js +++ b/projects/angle/index.js @@ -100,7 +100,7 @@ async function tvl(timestamp, _1, _2, { api }) { } // Borrowing module - tokensAndOwners.push(...(await getVaultManagersFromAPI(chain))); + tokensAndOwners.push(...(await getVaultManagersFromAPI(api))); // Treasury - Governor const governorTokens = TreasuryTokenAddresses['governor'][chain] From 2e43ddbd858b6a9e6a1df5e0885dc324225ca825 Mon Sep 17 00:00:00 2001 From: CookieCrispies <141340002+CookieCrispies@users.noreply.github.com> Date: Mon, 21 Aug 2023 18:20:35 +0200 Subject: [PATCH 0909/1974] update (#7229) --- projects/chocobase/index.js | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 projects/chocobase/index.js diff --git a/projects/chocobase/index.js b/projects/chocobase/index.js new file mode 100644 index 00000000000..d41ea68e46d --- /dev/null +++ b/projects/chocobase/index.js @@ -0,0 +1,10 @@ +const { masterchefExports } = require("../helper/unknownTokens"); + +module.exports = masterchefExports({ + chain: "base", + masterchef: "0x03B03cB12C3C9079BD6f1F155BD3348e99692d9b", + nativeTokens: ["0x6d6080492D0Bd40F1e44cc16791CC1664357f685"], + useDefaultCoreAssets: true, + poolInfoABI: "function poolInfo(uint256) view returns (address)", + getToken: (i) => i, +}); \ No newline at end of file From 7415c5d2f074bc80a2408bd7aa9e87fc3b089d77 Mon Sep 17 00:00:00 2001 From: techyderp <138676931+techyderp@users.noreply.github.com> Date: Tue, 22 Aug 2023 02:47:01 +0530 Subject: [PATCH 0910/1974] Added Base chain to DerpDEX adapter (#7232) --- projects/DerpDEX/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/projects/DerpDEX/index.js b/projects/DerpDEX/index.js index 7c09f1f6abd..2ea1f9eee1a 100644 --- a/projects/DerpDEX/index.js +++ b/projects/DerpDEX/index.js @@ -5,4 +5,8 @@ module.exports = uniV3Export({ factory: "0x52a1865eb6903bc777a02ae93159105015ca1517", fromBlock: 7790768, }, + base: { + factory: "0xeddef4273518b137cdbcb3a7fa1c6a688303dfe2", + fromBlock: 2753388 + } }); From f4c0aacf775eae33245955be3fddd116eb0d5d4d Mon Sep 17 00:00:00 2001 From: BalloonSwap <142835392+BalloonSwap@users.noreply.github.com> Date: Tue, 22 Aug 2023 11:25:18 +0700 Subject: [PATCH 0911/1974] Create Index.js (#7236) --- projects/Balloonswap/Index.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 projects/Balloonswap/Index.js diff --git a/projects/Balloonswap/Index.js b/projects/Balloonswap/Index.js new file mode 100644 index 00000000000..baa82d524c5 --- /dev/null +++ b/projects/Balloonswap/Index.js @@ -0,0 +1,12 @@ +const { getUniTVL } = require("../helper/unknownTokens"); + +module.exports = { + misrepresentedTokens: true, + op_bnb: { + tvl: getUniTVL({ + factory: "0xCF8B8Ca7B70880c90C635672eB3D4882a52B4890", + useDefaultCoreAssets: true, + fetchBalances: true, + }), + }, +}; From 40697b9e1340f33a3732cbc5a7cae4b00a174273 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Tue, 22 Aug 2023 05:34:19 +0100 Subject: [PATCH 0912/1974] name to lowercase --- projects/{Balloonswap => balloonswap}/Index.js | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename projects/{Balloonswap => balloonswap}/Index.js (100%) diff --git a/projects/Balloonswap/Index.js b/projects/balloonswap/Index.js similarity index 100% rename from projects/Balloonswap/Index.js rename to projects/balloonswap/Index.js From bf50fd4aa3755ddf199ba08499a52de8baa569b5 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Tue, 22 Aug 2023 05:35:29 +0100 Subject: [PATCH 0913/1974] name to lowercase --- projects/balloonswap/{Index.js => index.js} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename projects/balloonswap/{Index.js => index.js} (100%) diff --git a/projects/balloonswap/Index.js b/projects/balloonswap/index.js similarity index 100% rename from projects/balloonswap/Index.js rename to projects/balloonswap/index.js From 415fb6b8effa81d5a293b1506309adddaefb9a76 Mon Sep 17 00:00:00 2001 From: BalloonSwap <142835392+BalloonSwap@users.noreply.github.com> Date: Tue, 22 Aug 2023 14:00:48 +0700 Subject: [PATCH 0914/1974] Create Index.js (#7235) * Create Index.js * minor fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> From b95db6deff42cebafc8347d8887df69a7d68bd3b Mon Sep 17 00:00:00 2001 From: Kevin Cheng Date: Tue, 22 Aug 2023 00:03:35 -0700 Subject: [PATCH 0915/1974] Add Compound v3 WETH market for Base (#7231) * Add WETH market on Base for Compound v3 * Fix * minor fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/compound-v3/index.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/projects/compound-v3/index.js b/projects/compound-v3/index.js index 0dc45280342..a6451d72173 100644 --- a/projects/compound-v3/index.js +++ b/projects/compound-v3/index.js @@ -1,20 +1,22 @@ const { compoundV3Exports } = require('../helper/compoundV3') -const markets = [ - "0xc3d688B66703497DAA19211EEdff47f25384cdc3", // USDC Market - '0xa17581a9e3356d9a858b789d68b4d866e593ae94', // ETH Market -] module.exports = compoundV3Exports({ ethereum: { - markets, + markets: [ + '0xc3d688B66703497DAA19211EEdff47f25384cdc3', // USDC Market + '0xa17581a9e3356d9a858b789d68b4d866e593ae94', // ETH Market + ], }, arbitrum: { markets: ['0xA5EDBDD9646f8dFF606d7448e414884C7d905dCA'], }, polygon: { - markets: ["0xF25212E676D1F7F89Cd72fFEe66158f541246445"], + markets: ['0xF25212E676D1F7F89Cd72fFEe66158f541246445'], }, base: { - markets: ["0x9c4ec768c28520B50860ea7a15bd7213a9fF58bf"], + markets: [ + '0x9c4ec768c28520B50860ea7a15bd7213a9fF58bf', // USDbC Market + '0x46e6b214b524310239732D51387075E0e70970bf', // ETH Market + ], } }) From a61cf867f24709b60bf794e217be65b29790952d Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 22 Aug 2023 09:06:54 +0200 Subject: [PATCH 0916/1974] Intswap (#7228) * Add files via upload * intswap code refactor --------- Co-authored-by: intswap <118870032+intswapamm@users.noreply.github.com> --- projects/intswap/index.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 projects/intswap/index.js diff --git a/projects/intswap/index.js b/projects/intswap/index.js new file mode 100644 index 00000000000..9b82fb08760 --- /dev/null +++ b/projects/intswap/index.js @@ -0,0 +1,23 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { getLogs } = require('../helper/cache/getLogs') + +async function tvl(_, _b, _cb, { api, }) { + const logs = await getLogs({ + api, + target: '0xb9a8213d237c768e88bf89d690a9222df439dcc1', + topics: ['0xbc9687dc21b69bf8e01370b9f0ae1625f6bf5244fc230fa3ad4c06350deb634d'], // NewPair event + onlyArgs: true, + fromBlock: 9675402, + }) + + await api.sumTokens({ owners: logs.map(i => '0x' + i.data.slice(-40)), tokens: [ADDRESSES.null] }) + const bal = api.getBalances() + api.add(ADDRESSES.null, bal[api.chain + ':'+ADDRESSES.null ?? 0]) + return bal +} + +module.exports = { + misrepresentedTokens: true, + methodology: 'Sum up all the ETH in pools', + era: { tvl, } +} From cdde70dd97f9c5d65a6ce45da7f1b43c3ccc9252 Mon Sep 17 00:00:00 2001 From: fextr <34183870+fextr@users.noreply.github.com> Date: Tue, 22 Aug 2023 03:36:11 -0700 Subject: [PATCH 0917/1974] zunami treasury (#7240) --- projects/treasury/zunami.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 projects/treasury/zunami.js diff --git a/projects/treasury/zunami.js b/projects/treasury/zunami.js new file mode 100644 index 00000000000..04bc565e908 --- /dev/null +++ b/projects/treasury/zunami.js @@ -0,0 +1,21 @@ +const { nullAddress, treasuryExports } = require("../helper/treasury"); +const ADDRESSES = require("../helper/coreAssets.json"); + +const treasury = "0xb056b9a45f09b006ec7a69770a65339586231a34"; + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.USDT, + ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.FRAX, + ADDRESSES.ethereum.CRV, + ADDRESSES.ethereum.CVX, + ADDRESSES.ethereum.vlCVX, + "0x73968b9a57c6E53d41345FD57a6E6ae27d6CDB2F", // SDT + "0x3432B6A60D23Ca0dFCa7761B7ab56459D9C964D0" // FXS + ], + owners: [treasury] + } +}); \ No newline at end of file From 056a98ea175ef9fefa4b61a21fdd23cfc07119f1 Mon Sep 17 00:00:00 2001 From: YFX <73627416+yfxcom@users.noreply.github.com> Date: Tue, 22 Aug 2023 18:56:40 +0800 Subject: [PATCH 0918/1974] yfx-v3 commit (#7237) * yfx-v3 commit * refactor code --------- Co-authored-by: yfxcom Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/amyfinance/index.js | 3 +-- projects/brinc/index.js | 6 +----- projects/helper/portedTokens.js | 5 ----- projects/jaguarswap.js | 3 +-- projects/parrotegg/index.js | 4 ++-- projects/tenderize/index.js | 3 +-- projects/uniswap/v3/index.js | 5 ++--- projects/vesta/index.js | 5 ++--- projects/yfx-v3/index.js | 15 +++++++++++++++ 9 files changed, 25 insertions(+), 24 deletions(-) create mode 100644 projects/yfx-v3/index.js diff --git a/projects/amyfinance/index.js b/projects/amyfinance/index.js index 421728d03d3..83f5b25bc10 100644 --- a/projects/amyfinance/index.js +++ b/projects/amyfinance/index.js @@ -1,6 +1,5 @@ const ADDRESSES = require('../helper/coreAssets.json') const { sumTokensAndLPsSharedOwners } = require('../helper/unwrapLPs'); -const { transformArbitrumAddress } = require('../helper/portedTokens'); const tokens = [ [ADDRESSES.arbitrum.USDC, false], //USDC @@ -27,7 +26,7 @@ const aibContracts = [ async function tvl(timestamp, ethBlock, {arbitrum: block}) { let balances = {}; - const transformAdress = await transformArbitrumAddress(); + const transformAdress = i => `arbitrum:${i}` await sumTokensAndLPsSharedOwners(balances, tokens, aibContracts, block, "arbitrum", transformAdress); diff --git a/projects/brinc/index.js b/projects/brinc/index.js index 4fdceccc955..f707a7bd22c 100644 --- a/projects/brinc/index.js +++ b/projects/brinc/index.js @@ -1,15 +1,11 @@ const ADDRESSES = require('../helper/coreAssets.json') -const { stakingPricedLP } = require('../helper/staking') const {sumTokensAndLPsSharedOwners} = require('../helper/unwrapLPs') -const { transformArbitrumAddress } = require("../helper/portedTokens"); - - const treasury = "0xB5de3f06aF62D8428a8BF7b4400Ea42aD2E0bc53" async function tvl(time, ethBlock, chainBlocks){ const balances = {}; - const transformAddress = await transformArbitrumAddress(); + const transformAddress = i => `arbitrum:${i}` await sumTokensAndLPsSharedOwners(balances, [ [ADDRESSES.optimism.DAI, false], //dai diff --git a/projects/helper/portedTokens.js b/projects/helper/portedTokens.js index ffe213ac405..a720f27a6a7 100644 --- a/projects/helper/portedTokens.js +++ b/projects/helper/portedTokens.js @@ -30,10 +30,6 @@ async function transformOptimismAddress() { return transformChainAddress(transformTokens.optimism, "optimism") } -async function transformArbitrumAddress() { - return transformChainAddress(transformTokens.arbitrum, "arbitrum") -} - async function transformInjectiveAddress() { return addr => { if (addr.includes('ibc/')) return addr.replace(/.*ibc\//, 'ibc/').replace(/\//g, ':') @@ -266,7 +262,6 @@ module.exports = { transformBscAddress, transformPolygonAddress, transformOptimismAddress, - transformArbitrumAddress, transformCeloAddress, stripTokenHeader, getFixBalancesSync, diff --git a/projects/jaguarswap.js b/projects/jaguarswap.js index 79e794beccb..7c26145934f 100644 --- a/projects/jaguarswap.js +++ b/projects/jaguarswap.js @@ -1,4 +1,3 @@ -const { transformArbitrumAddress } = require("./helper/portedTokens"); const { addFundsInMasterChef } = require('./helper/masterchef'); const { staking } = require("./helper/staking"); const STAKING_CONTRACT = "0xAd60A8cb60e052196F5B968B4bd4328A67Df27d3"; @@ -6,7 +5,7 @@ const JAGUAR = '0x31535F7A83083E3f34899F356ECC7246FBF2E82D' const arbitrumTvl = async (timestamp, ethBlock, { arbitrum: block }) => { const balances = {}; - const transformAddress = await transformArbitrumAddress(); + const transformAddress = i => `arbitrum:${i}` await addFundsInMasterChef( balances, STAKING_CONTRACT, block, 'arbitrum', transformAddress, undefined, [JAGUAR]); return balances; diff --git a/projects/parrotegg/index.js b/projects/parrotegg/index.js index ff8b61eb23e..a13f029ceb3 100644 --- a/projects/parrotegg/index.js +++ b/projects/parrotegg/index.js @@ -1,4 +1,4 @@ -const { transformArbitrumAddress, transformPolygonAddress, getChainTransform, transformBalances, } = require("../helper/portedTokens"); +const { transformPolygonAddress, getChainTransform, transformBalances, } = require("../helper/portedTokens"); const { addFundsInMasterChef } = require('../helper/masterchef'); const STAKING_CONTRACT_ARBITRUM = "0x1cCf20F4eE3EFD291267c07268BEcbFDFd192311"; //MASTERCHEF ARBITRUM const STAKING_CONTRACT_IOTEX = "0x83E7e97C4e92D56c0653f92d9b0c0B70288119b8"; // MASTERCHEF IOTEX @@ -7,7 +7,7 @@ const STAKING_CONTRACT_HARMONY = "0xFb15945E38a11450AF5E3FF20355D71Da72FfE8a"; const arbitrumTvl = async (timestamp, ethBlock, chainBlocks) => { const balances = {}; - const transformAddress = await transformArbitrumAddress(); + const transformAddress = i => `arbitrum:${i}` await addFundsInMasterChef( balances, STAKING_CONTRACT_ARBITRUM, chainBlocks.arbitrum, 'arbitrum', transformAddress); diff --git a/projects/tenderize/index.js b/projects/tenderize/index.js index 63c9f30a960..b8f550de624 100644 --- a/projects/tenderize/index.js +++ b/projects/tenderize/index.js @@ -1,7 +1,6 @@ const sdk = require('@defillama/sdk'); const { GraphQLClient, gql } = require('graphql-request'); const BigNumber = require('bignumber.js'); -const { transformArbitrumAddress } = require('../helper/portedTokens'); const ethereumEndpoint = 'https://api.thegraph.com/subgraphs/name/tenderize/tenderize-ethereum'; @@ -49,7 +48,7 @@ async function fetchArbitrum(timestamp, ethBlock, chainBlocks) { chain: 'arbitrum' }); - const tokenAddress = (await transformArbitrumAddress())(config.steak); + const tokenAddress = (i => `arbitrum:${i}`)(config.steak); tvlData[tokenAddress] = addBNstr( result.tenderizer.currentPrincipal, token1Balance.output diff --git a/projects/uniswap/v3/index.js b/projects/uniswap/v3/index.js index 131be2aff32..e7981b4a2fc 100644 --- a/projects/uniswap/v3/index.js +++ b/projects/uniswap/v3/index.js @@ -1,6 +1,5 @@ -const { getChainTvl } = require('../../helper/getUniSubgraphTvl'); const sdk = require('@defillama/sdk') -const {transformOptimismAddress, transformArbitrumAddress} = require('../../helper/portedTokens') +const {transformOptimismAddress,} = require('../../helper/portedTokens') const oldOptPools = require('./oldUniPools.json') const graphUrls = { @@ -93,7 +92,7 @@ function chainTvl(chain) { if(chain === "optimism"){ transform = await transformOptimismAddress() } else if(chain === "arbitrum"){ - transform = await transformArbitrumAddress() + transform = i => `arbitrum:${i}` } let balances = {}; diff --git a/projects/vesta/index.js b/projects/vesta/index.js index a970a8fdfe1..04867fa7c61 100644 --- a/projects/vesta/index.js +++ b/projects/vesta/index.js @@ -1,7 +1,6 @@ const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const { sumBalancerLps, } = require("../helper/unwrapLPs.js"); -const { transformArbitrumAddress } = require("../helper/portedTokens"); const VaultTokens = { gOHM: "0x8d9ba570d6cb60c7e3e0f31343efe75ab8e65fb1", @@ -28,7 +27,7 @@ const chain = "arbitrum"; async function tvl(_, block, chainBlocks) { block = chainBlocks.arbitrum; - const transform = await transformArbitrumAddress() + const transform = i => `arbitrum:${i}` const balances = {} const calls = Object.values(VaultTokens).map(token => ({ params: [token] })) const { output } = await sdk.api.abi.multiCall({ @@ -50,7 +49,7 @@ async function tvl(_, block, chainBlocks) { async function pool2(_timestamp, block, chainBlocks, { api }) { block = chainBlocks.arbitrum; const balances = {}; - const transform = await transformArbitrumAddress(); + const transform = i => `arbitrum:${i}` await sumBalancerLps(balances, [[LP_VSTA_ETH_ADDRESS, VSTA_FARMING_ADDRESS]], chainBlocks.arbitrum, chain, transform); const curveBalances = ( diff --git a/projects/yfx-v3/index.js b/projects/yfx-v3/index.js new file mode 100644 index 00000000000..3788ed02b6e --- /dev/null +++ b/projects/yfx-v3/index.js @@ -0,0 +1,15 @@ +const manager = '0x29bd0372A8A087e4d34d4098259Cd298d554BAc4'; +const vault = '0x48F4B8f77b1E0EFBBF17b2082F12829b87FD1933'; + +async function tvl(timestamp, block, chainBlocks, { api }) { + let pools = await api.call({ target: manager, abi: "address[]:getAllPools", }); + const tokens = await api.multiCall({ abi: 'address:getBaseAsset', calls: pools }) + return api.sumTokens({ owner: vault, tokens}) +} + +module.exports = { + methodology: 'Count balance of each pool from the Vault', + arbitrum: { + tvl, + }, +} \ No newline at end of file From a2541bd5639750681f3ed094e6134c4f575cafa2 Mon Sep 17 00:00:00 2001 From: "@armoking" Date: Tue, 22 Aug 2023 15:11:51 +0400 Subject: [PATCH 0919/1974] polygon_zkevm chain for MellowProtocol --- projects/MellowProtocol/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/projects/MellowProtocol/index.js b/projects/MellowProtocol/index.js index fced703a119..f4b1007c85e 100644 --- a/projects/MellowProtocol/index.js +++ b/projects/MellowProtocol/index.js @@ -9,6 +9,10 @@ const config = { polygon: { registry: '0xd3d0e85f225348a2006270daf624d8c46cae4e1f', fromBlock: 31243728, + }, + polygon_zkevm: { + registry: '0xc02a7B4658861108f9837007b2DF2007d6977116', + fromBlock: 2665891, } } From 116ff59346f7e62efb2d554bf6791a2ad99e4f59 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 22 Aug 2023 17:11:13 +0200 Subject: [PATCH 0920/1974] remove redundant code (#7252) --- projects/2omb-finance/index.js | 3 +- projects/GotchiVault/index.js | 3 +- projects/aavegotchi/index.js | 3 +- projects/adamantfinance/index.js | 3 +- projects/astralfarm/index.js | 3 +- projects/atlendis/index.js | 5 +-- projects/auguryfinance/index.js | 3 +- projects/babypigfinance/index.js | 3 +- projects/baksdao/index.js | 3 +- projects/bitBTC.js | 3 +- projects/brahmafi/index.js | 3 +- projects/btcst/index.js | 3 +- projects/cake-monster/index.js | 3 +- projects/cashcow/index.js | 5 +-- projects/cashcowprotocol/index.js | 3 +- projects/cemetery/index.js | 3 +- projects/chargedefi/index.js | 3 +- projects/coffin/index.js | 5 +-- projects/cream/index.js | 3 +- projects/cupid/index.js | 3 +- projects/cvi/index.js | 3 +- projects/cybertime/index.js | 5 +-- projects/darkmatter/index.js | 3 +- projects/deltatheta/index.js | 10 +---- projects/demodyfi/index.js | 3 +- projects/deri/index.js | 3 +- projects/double/index.js | 3 +- projects/dracoforce/index.js | 3 +- projects/dungeonswap/index.js | 3 +- projects/ester/index.js | 3 +- projects/ethichub/index.js | 55 --------------------------- projects/exodia/index.js | 6 +-- projects/fantompup/index.js | 3 +- projects/geist/index.js | 3 +- projects/gemmine/index.js | 3 +- projects/gogocoin/index.js | 12 ++---- projects/helper/portedTokens.js | 29 -------------- projects/jetfuelfinance/index.js | 4 +- projects/jetmine/index.js | 3 +- projects/kebab-finance/index.js | 3 +- projects/kingdefi/index.js | 9 +---- projects/klima-dao/index.js | 3 +- projects/knightsfantom/index.js | 3 +- projects/lavafall/index.js | 3 +- projects/lemma/index.js | 3 +- projects/liquiddriver/index.js | 7 ++-- projects/luchadores/index.js | 3 +- projects/luckychip/index.js | 3 +- projects/malt-money/index.js | 3 +- projects/manarium/index.js | 3 +- projects/market.xyz/index.js | 12 ++---- projects/marsecosystem/index.js | 4 +- projects/marshamallowdefi/index.js | 3 +- projects/merlinlab/index.js | 3 +- projects/mint-club/index.js | 23 ++--------- projects/mobiusfinance/index.js | 3 +- projects/mockingbird/index.js | 3 +- projects/moneyrainfinance/index.js | 3 +- projects/monster/index.js | 5 +-- projects/morpheusswap/index.js | 2 +- projects/mover/index.js | 4 +- projects/mymine/index.js | 3 +- projects/nightmare/index.js | 3 +- projects/olivedao/index.js | 5 +-- projects/one-ring/index.js | 8 +--- projects/oraichain.js | 4 +- projects/parrotegg/index.js | 4 +- projects/phantom-finance/index.js | 3 +- projects/planet-finance/index.js | 3 +- projects/polyquail/index.js | 3 +- projects/polyroll.js | 5 +-- projects/polywhale/index.js | 3 +- projects/potluckprotocol/index.js | 3 +- projects/purefi/index.js | 3 +- projects/radial/index.js | 3 +- projects/retrodefi/index.js | 10 ++--- projects/revault/index.js | 3 +- projects/risq.js | 3 +- projects/sapphire/index.js | 3 +- projects/scarecrow/index.js | 3 +- projects/scream/index.js | 3 +- projects/sculptor-finance/index.js | 3 +- projects/seeder/index.js | 3 +- projects/shadecash/index.js | 3 +- projects/singularityDAO/masterchef.js | 3 +- projects/solidex/index.js | 1 - projects/spadefinance/index.js | 3 +- projects/spectrefi/index.js | 3 +- projects/squidstake/index.js | 3 +- projects/stakesteak/index.js | 3 +- projects/tenet/index.js | 3 +- projects/the-sandbox.js | 11 +----- projects/tidalfinance/index.js | 3 +- projects/timewarp/index.js | 3 +- projects/treedefi/index.js | 3 +- projects/umbria/index.js | 5 +-- projects/unbk/index.js | 3 +- projects/unbound/index.js | 1 - projects/undeadfinance/index.js | 3 +- projects/unilend/index.js | 9 +---- projects/unirexfinance/index.js | 3 +- projects/uniswap/v3/index.js | 9 +---- projects/universeftm/index.js | 3 +- projects/uplift/index.js | 3 +- projects/valas/index.js | 3 +- projects/veritable.js | 3 +- projects/waterfallfinance/index.js | 5 +-- projects/xmaspast/index.js | 3 +- projects/yslio/index.js | 3 +- 109 files changed, 130 insertions(+), 383 deletions(-) diff --git a/projects/2omb-finance/index.js b/projects/2omb-finance/index.js index 952bf70c142..582b0c9499e 100644 --- a/projects/2omb-finance/index.js +++ b/projects/2omb-finance/index.js @@ -1,7 +1,6 @@ const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); -const { transformFantomAddress } = require("../helper/portedTokens"); const { staking } = require("../helper/staking"); const { pool2Exports } = require("../helper/pool2"); @@ -72,7 +71,7 @@ const omb3Tvl = async (chainBlocks) => { if (!Object.keys(balances).length) throw new Error('Bad length, something is wrong') - const transformAddress = await transformFantomAddress(); + const transformAddress = i => `fantom:${i}` await unwrapUniswapLPs( balances, diff --git a/projects/GotchiVault/index.js b/projects/GotchiVault/index.js index 8d5f80f2b85..2d74620efdf 100644 --- a/projects/GotchiVault/index.js +++ b/projects/GotchiVault/index.js @@ -1,5 +1,4 @@ const sdk = require('@defillama/sdk'); -const { transformPolygonAddress } = require('../helper/portedTokens'); const abi = require("./abi.json"); const { request, gql } = require("graphql-request"); const { getBlock } = require('../helper/http') @@ -60,7 +59,7 @@ async function getGotchisCollateral(timestamp, block) { async function tvl(timestamp, _, chainBlocks) { const balances = {}; const block = await getBlock(timestamp, 'polygon', chainBlocks) - const transform = await transformPolygonAddress(); + const transform = i => `polygon:${i}`; const collateralBalance = (await sdk.api.abi.call({ abi: abi.totalGHST, diff --git a/projects/aavegotchi/index.js b/projects/aavegotchi/index.js index 8b7b6879eaf..2e73808d4e8 100644 --- a/projects/aavegotchi/index.js +++ b/projects/aavegotchi/index.js @@ -1,7 +1,6 @@ const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const { staking } = require("../helper/staking"); -const { transformPolygonAddress } = require("../helper/portedTokens"); const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); const { request, gql } = require("graphql-request"); const { getBlock } = require('../helper/http') @@ -92,7 +91,7 @@ const polygonTvl = async (_, _block, chainBlocks) => { const balances = {}; const block = await getBlock(_, 'polygon', chainBlocks) - 500 - let transformAddress = await transformPolygonAddress(); + let transformAddress = i => `polygon:${i}`; await sumTokensAndLPsSharedOwners( balances, diff --git a/projects/adamantfinance/index.js b/projects/adamantfinance/index.js index 15dc1d2d71c..4c98c04dde8 100644 --- a/projects/adamantfinance/index.js +++ b/projects/adamantfinance/index.js @@ -5,7 +5,6 @@ const { stakings } = require("../helper/staking"); const { getConfig } = require('../helper/cache') const { unwrapUniswapLPs, unwrapLPsAuto, } = require("../helper/unwrapLPs"); const { - transformPolygonAddress, getChainTransform, } = require("../helper/portedTokens"); const { staking: stakingUnknown, } = require("../helper/unknownTokens"); @@ -99,7 +98,7 @@ async function calcPool2_staking_rewards( async function pool2Polygon(timestamp, block, chainBlocks) { const balances = {}; - const transformAddress = await transformPolygonAddress(); + const transformAddress = i => `polygon:${i}`; await calcPool2_staking_rewards( balances, vaultAddresses_polygon, diff --git a/projects/astralfarm/index.js b/projects/astralfarm/index.js index 2ed1ea443bd..5373b10cb83 100644 --- a/projects/astralfarm/index.js +++ b/projects/astralfarm/index.js @@ -1,5 +1,4 @@ const abi = require("../helper/abis/masterchef.json") -const { transformFantomAddress } = require("../helper/portedTokens"); const { addFundsInMasterChef } = require("../helper/masterchef"); const { staking, stakingPricedLP } = require("../helper/staking"); const { pool2Exports } = require('../helper/pool2') @@ -11,7 +10,7 @@ const astralFtmLP = "0x93E7752e611B2cD808E546E7FdA5512a89A91d4D" async function tvl(timestamp, block, chainBlocks) { const balances = {} - const transformAddress = await transformFantomAddress(); + const transformAddress = i => `fantom:${i}`; await addFundsInMasterChef(balances, chef, chainBlocks.fantom, "fantom", transformAddress, abi.poolInfo, [astral, astralFtmLP],true,true,astral); return balances; } diff --git a/projects/atlendis/index.js b/projects/atlendis/index.js index 6b326d26f78..215253223df 100644 --- a/projects/atlendis/index.js +++ b/projects/atlendis/index.js @@ -1,5 +1,4 @@ const { GraphQLClient, gql } = require('graphql-request') -const { transformPolygonAddress } = require('../helper/portedTokens'); const { getBlock } = require('../helper/http') const sdk = require('@defillama/sdk') @@ -60,14 +59,14 @@ async function fetchData(block, balances, transform, borrowed = false) { async function tvl(timestamp, _, chainBlocks) { const balances = {}; const block = await getBlock(timestamp, 'polygon', chainBlocks) - const transform = await transformPolygonAddress(); + const transform = i => `polygon:${i}`; await fetchData(block, balances, transform); return balances; } async function borrowed(timestamp, _, chainBlocks) { const balances = {}; - const transform = await transformPolygonAddress(); + const transform = i => `polygon:${i}`; const block = await getBlock(timestamp, 'polygon', chainBlocks) await fetchData(block, balances, transform, true); return balances; diff --git a/projects/auguryfinance/index.js b/projects/auguryfinance/index.js index 0693db6b8d8..5848473726b 100644 --- a/projects/auguryfinance/index.js +++ b/projects/auguryfinance/index.js @@ -1,7 +1,6 @@ const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); -const { transformPolygonAddress } = require("../helper/portedTokens"); const MasterAugur = "0x6ad70613d14c34aa69E1604af91c39e0591a132e"; @@ -62,7 +61,7 @@ const polygonTvl = async (timestamp, ethBlock, chainBlocks) => { } } - const transformAddress = await transformPolygonAddress(); + const transformAddress = i => `polygon:${i}`; await unwrapUniswapLPs( balances, diff --git a/projects/babypigfinance/index.js b/projects/babypigfinance/index.js index 9caa54c9a08..5d99c59023c 100644 --- a/projects/babypigfinance/index.js +++ b/projects/babypigfinance/index.js @@ -1,4 +1,3 @@ -const { transformFantomAddress } = require("../helper/portedTokens"); const { addFundsInMasterChef } = require("../helper/masterchef"); const { staking } = require("../helper/staking"); const { pool2 } = require('../helper/pool2') @@ -10,7 +9,7 @@ const fbabypigFtmLP = "0xc56a420486f547a5adc1dd64b4a13051baa4a8e0" async function tvl(timestamp, block, chainBlocks) { const balances = {} - const transformAddress = await transformFantomAddress(); + const transformAddress = i => `fantom:${i}`; await addFundsInMasterChef(balances, chef, chainBlocks.fantom, "fantom", transformAddress, undefined, [fbabypig, fbabypigFtmLP]) return balances; } diff --git a/projects/baksdao/index.js b/projects/baksdao/index.js index 7cfcef74600..852e8304050 100644 --- a/projects/baksdao/index.js +++ b/projects/baksdao/index.js @@ -1,6 +1,5 @@ const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens, } = require('../helper/unwrapLPs') -const { transformBscAddress, } = require('../helper/portedTokens'); const chain = 'bsc' @@ -22,7 +21,7 @@ async function tvl(timestamp, ethBlock, chainBlocks) { [token, DEPOSIT_CONTRACT], [token, BANK_ADDRESS], ]).flat() - const transform = await transformBscAddress() + const transform = i => `bsc:${i}` await sumTokens( balances, diff --git a/projects/bitBTC.js b/projects/bitBTC.js index 70f8700d0e0..47680715dfe 100644 --- a/projects/bitBTC.js +++ b/projects/bitBTC.js @@ -1,6 +1,5 @@ const ADDRESSES = require('./helper/coreAssets.json') const sdk = require("@defillama/sdk"); -const { transformOptimismAddress } = require('./helper/portedTokens'); const WBTC = "0x68f180fcce6836688e9084f035309e29bf0a2095"; const bitANT = ADDRESSES.optimism.BitANT; @@ -33,7 +32,7 @@ const stakingContracts = [ ]; async function findBalances(contracts, block) { - const transform = await transformOptimismAddress(); + const transform = i => `optimism:${i}`; const balances = {}; const balanceOfs = (await sdk.api.abi.multiCall({ diff --git a/projects/brahmafi/index.js b/projects/brahmafi/index.js index 05b5cf689df..5aaaf960142 100644 --- a/projects/brahmafi/index.js +++ b/projects/brahmafi/index.js @@ -5,7 +5,6 @@ const { getERC4626VaultFundsByChain, getL1VaultOnlyFundsByChain, } = require("./helper"); -const { transformPolygonAddress } = require("../helper/portedTokens"); const MAX_BPS = 1e3; const sdk = require("@defillama/sdk"); @@ -37,7 +36,7 @@ const ethTvl = async (_, block) => { const polygonTvl = async (_, _b, { polygon: block }) => { const balances = {}; - const transform = await transformPolygonAddress(); + const transform = i => `polygon:${i}`; const vaultFunds = await getERC4626VaultFundsByChain("polygon", block); const l1OnlyVaultFunds = await getL1VaultOnlyFundsByChain("polygon", block); diff --git a/projects/btcst/index.js b/projects/btcst/index.js index 7f3c3f51725..f533d4bdf92 100644 --- a/projects/btcst/index.js +++ b/projects/btcst/index.js @@ -1,6 +1,5 @@ const ADDRESSES = require('../helper/coreAssets.json') const { stakings } = require("../helper/staking"); -const { transformBscAddress } = require("../helper/portedTokens"); const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); const BTCST = "0x78650B139471520656b9E7aA7A5e9276814a38e9"; @@ -34,7 +33,7 @@ const listOfTokens = [ async function bscTvl(chainBlocks) { const balances = {}; - const transformAddress = await transformBscAddress(); + const transformAddress = i => `bsc:${i}`; for (const token of listOfTokens) { await sumTokensAndLPsSharedOwners( balances, diff --git a/projects/cake-monster/index.js b/projects/cake-monster/index.js index 1fab5287452..22ecfa780ee 100644 --- a/projects/cake-monster/index.js +++ b/projects/cake-monster/index.js @@ -1,12 +1,11 @@ const sdk = require("@defillama/sdk"); const BigNumber = require("bignumber.js"); -const { transformBscAddress } = require("../helper/portedTokens"); const CM_TOKEN_CONTRACT = "0x8A5d7FCD4c90421d21d30fCC4435948aC3618B2f"; const CM_STAKING_CONTRACT = "0xF7CDDF60CD076d4d64c613489aA00dCCf1E518F6"; async function staking(timestamp, block, chainBlocks) { const balances = {}; - const transform = await transformBscAddress(); + const transform = i => `bsc:${i}`; const stakingBalance = ( await sdk.api.abi.call({ diff --git a/projects/cashcow/index.js b/projects/cashcow/index.js index 9f662a787bd..19bb4b5cf0b 100644 --- a/projects/cashcow/index.js +++ b/projects/cashcow/index.js @@ -1,7 +1,6 @@ const ADDRESSES = require('../helper/coreAssets.json') const abi = require("./abi.json"); -const { getCompoundV2Tvl, compoundExports } = require("../helper/compound"); -const { transformBscAddress } = require("../helper/portedTokens"); +const { compoundExports } = require("../helper/compound"); const { addFundsInMasterChef } = require("../helper/masterchef"); const comptroller = "0x44f2A790aCB1bE42d3F7864e9F73762556eb895E"; @@ -12,7 +11,7 @@ const stakingChef = "0xbfcaB1627c4fB86A055DE4B8a56D46e625F51C0B"; const stakingPools = async (timestamp, ethBlock, chainBlocks) => { const balances = {}; - let transformAddress = await transformBscAddress(); + let transformAddress = i => `bsc:${i}`; await addFundsInMasterChef( balances, diff --git a/projects/cashcowprotocol/index.js b/projects/cashcowprotocol/index.js index 9ffe6f9e720..f97730ffcc9 100644 --- a/projects/cashcowprotocol/index.js +++ b/projects/cashcowprotocol/index.js @@ -1,11 +1,10 @@ -const { transformBscAddress } = require("../helper/portedTokens"); const { addFundsInMasterChef } = require("../helper/masterchef"); const MasterChef = "0x94098E24FCf4701237CF58ef2A222C1cF5003c86"; const bscTvl = async (timestamp, ethBlock, chainBlocks) => { const balances = {}; - let transformAddress = await transformBscAddress(); + let transformAddress = i => `bsc:${i}`; await addFundsInMasterChef( balances, diff --git a/projects/cemetery/index.js b/projects/cemetery/index.js index cf94ed96647..76ffc87efa7 100644 --- a/projects/cemetery/index.js +++ b/projects/cemetery/index.js @@ -1,5 +1,4 @@ const abi = require("../helper/abis/masterchef.json") -const { transformFantomAddress } = require("../helper/portedTokens"); const { addFundsInMasterChef } = require("../helper/masterchef"); const { staking } = require("../helper/staking"); const { pool2Exports } = require('../helper/pool2') @@ -12,7 +11,7 @@ const hauntUsdcLP = "0x95b70d9ed25ffe2560b8ab182ec71bc712f55c72"; async function tvl(timestamp, block, chainBlocks) { const balances = {} - const transformAddress = await transformFantomAddress(); + const transformAddress = i => `fantom:${i}`; await addFundsInMasterChef(balances, hauntchef, chainBlocks.fantom, "fantom", transformAddress, abi.poolInfo, [haunt, hauntFtmLP, hauntUsdcLP]); return balances; } diff --git a/projects/chargedefi/index.js b/projects/chargedefi/index.js index 9a398d5527a..be1c6841ba0 100644 --- a/projects/chargedefi/index.js +++ b/projects/chargedefi/index.js @@ -1,5 +1,4 @@ const sdk = require("@defillama/sdk"); -const { transformBscAddress } = require("../helper/portedTokens"); const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); const { pool2Exports } = require("../helper/pool2"); const { staking } = require("../helper/staking"); @@ -19,7 +18,7 @@ const staticBUSDFarmStrategyAddress = "0x53eE388f037876850D4fd60307FBA02e203A1C0 async function tvl(timestamp, block, chainBlocks) { const balances = {}; let lpPositions = []; - let transformAddress = await transformBscAddress(); + let transformAddress = i => `bsc:${i}`; // Static-BUSD Boardroom TVL const staticBUSDBoardroomBalance = sdk.api.erc20 diff --git a/projects/coffin/index.js b/projects/coffin/index.js index 142116d8f6c..fac91276594 100644 --- a/projects/coffin/index.js +++ b/projects/coffin/index.js @@ -2,7 +2,6 @@ const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const { staking } = require("../helper/staking"); const { addFundsInMasterChef } = require("../helper/masterchef"); -const { transformFantomAddress } = require("../helper/portedTokens"); const MasterChefV1Contract = "0x155482Bd4e5128082D61a2384935D4BBDcb0E7a7"; const MasterChefV2Contract = "0x2447115E9Ba73bd2877821BF69E09259664a2bd5"; @@ -14,7 +13,7 @@ const ftmTvl = async (timestamp, ethBlock, chainBlocks) => { const balances = {}; - let transformAddress = await transformFantomAddress(); + let transformAddress = i => `fantom:${i}`; await addFundsInMasterChef( balances, @@ -31,7 +30,7 @@ const ftmTvl = async (timestamp, ethBlock, chainBlocks) => { const v2TVL = async (timestamp, ethBlock, chainBlocks) => { let balances = {}; - let transformAddress = await transformFantomAddress(); + let transformAddress = i => `fantom:${i}`; await addFundsInMasterChef( balances, MasterChefV2Contract, diff --git a/projects/cream/index.js b/projects/cream/index.js index 8b8baf84c44..9de10783b74 100644 --- a/projects/cream/index.js +++ b/projects/cream/index.js @@ -3,7 +3,6 @@ const sdk = require("@defillama/sdk"); const utils = require("../helper/utils"); const { unwrapUniswapLPs, nullAddress } = require("../helper/unwrapLPs"); const { getCompoundV2Tvl, compoundExports } = require("../helper/compound"); -const { transformBscAddress } = require('../helper/portedTokens') const { getConfig } = require('../helper/cache') const abiCerc20 = require("./cerc20.json"); @@ -111,7 +110,7 @@ async function lending(block, chain, borrowed) { }) ).output; - const transformAdress = await transformBscAddress() + const transformAdress = i => `bsc:${i}` const lpPositions = []; cashValues.map((cashVal, idx) => { if (tokens_bsc[idx].underlying_symbol === "Cake-LP") { diff --git a/projects/cupid/index.js b/projects/cupid/index.js index e4aa051f526..cf7ae0a3bef 100644 --- a/projects/cupid/index.js +++ b/projects/cupid/index.js @@ -1,5 +1,4 @@ const abi = require("../helper/abis/masterchef.json") -const { transformFantomAddress } = require("../helper/portedTokens"); const { addFundsInMasterChef } = require("../helper/masterchef"); const { staking } = require("../helper/staking"); const { pool2Exports } = require('../helper/pool2') @@ -12,7 +11,7 @@ const cupidUsdcLP = "0xd30ce73f7294be94f9d76d308d5400f3483e369f"; async function tvl(timestamp, block, chainBlocks) { const balances = {} - const transformAddress = await transformFantomAddress(); + const transformAddress = i => `fantom:${i}`; await addFundsInMasterChef(balances, cupidchef, chainBlocks.fantom, "fantom", transformAddress, abi.poolInfo, [cupid, cupidFtmLP, cupidUsdcLP]); return balances; } diff --git a/projects/cvi/index.js b/projects/cvi/index.js index 7e1ca8a1c28..4793b4421a8 100644 --- a/projects/cvi/index.js +++ b/projects/cvi/index.js @@ -2,7 +2,6 @@ const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const { staking, stakings } = require("../helper/staking"); const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); -const { transformPolygonAddress } = require("../helper/portedTokens"); /*** Ethereum Addresses ***/ const stakingContract = "0xDb3130952eD9b5fa7108deDAAA921ae8f59beaCb"; @@ -99,7 +98,7 @@ async function ethTvl(timestamp, block) { async function polygonTvl(timestamp, block, chainBlocks) { const balances = {}; - const transformAddress = await transformPolygonAddress(); + const transformAddress = i => `polygon:${i}`; await sumTokensAndLPsSharedOwners( balances, [ diff --git a/projects/cybertime/index.js b/projects/cybertime/index.js index 55af3af2809..a75765238fb 100644 --- a/projects/cybertime/index.js +++ b/projects/cybertime/index.js @@ -1,7 +1,6 @@ const abi = require("./abi.json"); const { pool2s } = require("../helper/pool2"); const { addFundsInMasterChef } = require("../helper/masterchef"); -const { transformBscAddress } = require("../helper/portedTokens"); const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); const pool2FarmContracts = [ @@ -57,7 +56,7 @@ const farms = [ const Staking = async (chainBlocks) => { const balances = {}; - let transformAddress = await transformBscAddress(); + let transformAddress = i => `bsc:${i}`; await sumTokensAndLPsSharedOwners( balances, [ @@ -79,7 +78,7 @@ const Staking = async (chainBlocks) => { const bscTvl = async (chainBlocks) => { const balances = {}; - let transformAddress = await transformBscAddress(); + let transformAddress = i => `bsc:${i}`; for (const farm of farms) { await addFundsInMasterChef( balances, diff --git a/projects/darkmatter/index.js b/projects/darkmatter/index.js index e1eeba67c86..a6002c66fa4 100644 --- a/projects/darkmatter/index.js +++ b/projects/darkmatter/index.js @@ -1,4 +1,3 @@ -const { transformFantomAddress } = require("../helper/portedTokens"); const { addFundsInMasterChef } = require("../helper/masterchef"); const { unwrapLPsAuto } = require("../helper/unwrapLPs"); const { staking } = require("../helper/staking"); @@ -11,7 +10,7 @@ const dmdFtmLP = "0xF10F0EeB144Eb223DD8Ae7d5dd7f3327E63A3C94" async function tvl(timestamp, block, chainBlocks) { const balances = {} - const transformAddress = await transformFantomAddress(); + const transformAddress = i => `fantom:${i}`; await addFundsInMasterChef(balances, chef, chainBlocks.fantom, "fantom", transformAddress, undefined, [dmd, dmdFtmLP]) await unwrapLPsAuto({ balances, block: chainBlocks.fantom, chain: 'fantom', transformAddress}) return balances; diff --git a/projects/deltatheta/index.js b/projects/deltatheta/index.js index f5bd9fc63dd..3c48fab2203 100644 --- a/projects/deltatheta/index.js +++ b/projects/deltatheta/index.js @@ -1,8 +1,4 @@ const sdk = require('@defillama/sdk'); -const { - transformBscAddress, - transformPolygonAddress, -} = require('../helper/portedTokens'); const { covalentGetTokens } = require('../helper/http'); // Delta.theta Factory ABI (for needed calls) @@ -19,11 +15,7 @@ const range = (n) => Array.from({ length: n }, (_, i) => i); function tvl(chain) { return async (_, __, chainBlocks) => { // Prepare transform function for the selected chain - const transform = await ( - chain === 'bsc' - ? transformBscAddress() - : transformPolygonAddress() - ); + const transform = i => `${chain}:${i}`; // Parse factory's pairs length const pairsLength = (await sdk.api.abi.call({ diff --git a/projects/demodyfi/index.js b/projects/demodyfi/index.js index 0cf6579008f..84e7f8613fb 100644 --- a/projects/demodyfi/index.js +++ b/projects/demodyfi/index.js @@ -4,7 +4,6 @@ const sdk = require("@defillama/sdk"); const BigNumber = require("bignumber.js"); const wGLMR = ADDRESSES.moonbeam.WGLMR; const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); -const { transformBscAddress } = require("../helper/portedTokens"); async function dmodBscStakingPool(timestamp, block, chainBlocks) { const stakingBalance = new BigNumber( @@ -61,7 +60,7 @@ async function dmodEthereumStakingPool(timestamp, block, chainBlocks) { return { 'demodyfi': stakingBalance.div(new BigNumber(10).pow(decimals)).toFixed(0) }; } async function dmodBscLPPool(timestamp, block, chainBlocks) { - const transform = await transformBscAddress(); + const transform = i => `bsc:${i}`; const balances = {}; const lpTokenbalance = new BigNumber( diff --git a/projects/deri/index.js b/projects/deri/index.js index 5174dc0b717..952d3d2cdb8 100644 --- a/projects/deri/index.js +++ b/projects/deri/index.js @@ -1,6 +1,5 @@ const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); -const { transformPolygonAddress } = require("../helper/portedTokens"); const abi = require("./abi"); async function perpetualPool( @@ -201,7 +200,7 @@ async function bsc(timestamp, ethBlock, chainBlocks) { } async function polygon(timestamp, ethBlock, chainBlocks) { let balances = {}; - const transform = await transformPolygonAddress(); + const transform = i => `polygon:${i}`; for (let [key, contract] of Object.entries(polygonContracts)) { if (contract.lite === true) { await perpetualPoolLite( diff --git a/projects/double/index.js b/projects/double/index.js index d3bb83837e4..00a94139c85 100644 --- a/projects/double/index.js +++ b/projects/double/index.js @@ -1,5 +1,4 @@ const sdk = require("@defillama/sdk"); -const { transformBscAddress } = require('../helper/portedTokens'); const { unwrapUniswapLPs } = require('../helper/unwrapLPs'); const abis = require("./abis.json"); @@ -24,7 +23,7 @@ async function staking(timestamp, block, chainBlocks) { function tvl(pool2 = false) { return async (timestamp, block, chainBlocks) => { const balances = {}; - const transform = await transformBscAddress(); + const transform = i => `bsc:${i}`; const noPairs = (await sdk.api.abi.call({ target: '0xb5737A06c330c22056C77a4205D16fFD1436c81b', // BaseV1Factory diff --git a/projects/dracoforce/index.js b/projects/dracoforce/index.js index 5a73ff88009..637a3eba322 100644 --- a/projects/dracoforce/index.js +++ b/projects/dracoforce/index.js @@ -1,5 +1,4 @@ const abi = require("../helper/abis/masterchef.json") -const { transformFantomAddress } = require("../helper/portedTokens"); const { addFundsInMasterChef } = require("../helper/masterchef"); const { staking } = require("../helper/staking"); const { pool2Exports } = require('../helper/pool2') @@ -12,7 +11,7 @@ const dracoUsdcLP = "0x8562e3032753edf3edf5f4d11bc079b43c9b224c"; async function tvl(timestamp, block, chainBlocks) { const balances = {} - const transformAddress = await transformFantomAddress(); + const transformAddress = i => `fantom:${i}`; await addFundsInMasterChef(balances, chef, chainBlocks.fantom, "fantom", transformAddress, abi.poolInfo, [draco, dracoFtmLP, dracoUsdcLP]); return balances; } diff --git a/projects/dungeonswap/index.js b/projects/dungeonswap/index.js index 9d50922d021..82fca6f1a36 100644 --- a/projects/dungeonswap/index.js +++ b/projects/dungeonswap/index.js @@ -1,13 +1,12 @@ const sdk = require("@defillama/sdk"); const { addFundsInMasterChef } = require("../helper/masterchef"); -const { transformBscAddress } = require("../helper/portedTokens"); const MasterChefContract = "0x3720F1F9a02BFB4dD6afb9030eB826B4392D321F"; const bscTvl = async (chainBlocks) => { const balances = {}; - let transformAddress = await transformBscAddress(); + let transformAddress = i => `bsc:${i}`; await addFundsInMasterChef( balances, diff --git a/projects/ester/index.js b/projects/ester/index.js index 96534ae88da..77de65192b1 100644 --- a/projects/ester/index.js +++ b/projects/ester/index.js @@ -3,7 +3,6 @@ const abi = require("./abi.json"); const { staking } = require("../helper/staking"); const { pool2 } = require("../helper/pool2"); const { addFundsInMasterChef } = require("../helper/masterchef"); -const { transformFantomAddress } = require("../helper/portedTokens"); const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); const esterStakingChefContract = "0x78e9D247541ff7c365b50D2eE0defdd622016498"; @@ -15,7 +14,7 @@ const esterVaultFarmContract = "0xA6151b608f49Feb960e951F1C87F4C766850de31"; const ftmTvl = async (chainBlocks) => { const balances = {}; - let transformAddress = await transformFantomAddress(); + let transformAddress = i => `fantom:${i}`; await addFundsInMasterChef( balances, diff --git a/projects/ethichub/index.js b/projects/ethichub/index.js index cdb3f2eb90f..fb380061df8 100644 --- a/projects/ethichub/index.js +++ b/projects/ethichub/index.js @@ -1,72 +1,17 @@ const ADDRESSES = require('../helper/coreAssets.json') -const sdk = require('@defillama/sdk'); -const { transformCeloAddress } = require('../helper/portedTokens'); const { pool2 } = require("../helper/pool2"); const { stakings } = require('../helper/staking'); // Mainnet const ETHIX_TOKEN = '0xFd09911130e6930Bf87F2B0554c44F400bD80D3e'; -const COLLATERAL_RESERVE_MAINNET = '0xb97Ef216006d72128576D662CFFEd2B4406E3518'; const STAKED_ETHIX_MAINNET = '0x5b2bbbe7DFD83aA1f1CD0c498690E6EcC939CC2D'; const ETHIX_WETH_UNIV2 = '0xb14b9464b52F502b0edF51bA3A529bC63706B458'; const STAKED_UETHIX_MAINNET = '0x89cea15F68950DF830dFE3630d635a9eD79478F5'; -const MINIMICE_ETH = '0x21320683556BB718c8909080489F598120C554D9'; const ORIGINATOR_BRAZIL = '0x3B61CD481Be3BA62a9a544c49d6C09FCb804d0e3'; const ORIGINATOR_HONDURAS = '0x7435C0232A69270D19F8E4010571175c3f1dd955'; // Celo const ETHIX_TOKEN_CELO = ADDRESSES.celo.ETHIX; -const COLLATERAL_RESERVE_CELO = '0xA14B1D7E28C4F9518eb7757ddeE35a18423e1567'; const STAKED_ETHIX_CELO = '0xCb16E29d0B667BaD7266E5d0Cd59b711b6273C6B'; -const MINIMICE_CELO = '0x0f497a790429685a3CfD43b841865Ee185378ff0'; - -async function tvlMainnet(timestamp, block, chainBlocks) { - const balances = {}; - - const collateralBalanceMainnet = (await sdk.api.abi.call({ - abi: 'erc20:balanceOf', - chain: 'ethereum', - target: ETHIX_TOKEN, - params: [COLLATERAL_RESERVE_MAINNET], - block: chainBlocks['ethereum'], - })).output; - sdk.util.sumSingleBalance(balances, ETHIX_TOKEN, collateralBalanceMainnet); - - const minimiceBalanceMainnet = (await sdk.api.abi.call({ - abi: 'erc20:balanceOf', - chain: 'ethereum', - target: ETHIX_TOKEN, - params: [MINIMICE_ETH], - block: chainBlocks['ethereum'], - })).output; - sdk.util.sumSingleBalance(balances, ETHIX_TOKEN, minimiceBalanceMainnet); - - return balances; -} - -async function tvlCelo(timestamp, block, chainBlocks) { - const balances = {}; - const transform = await transformCeloAddress(); - - const collateralBalanceCelo = (await sdk.api.abi.call({ - abi: 'erc20:balanceOf', - chain: 'celo', - target: ETHIX_TOKEN_CELO, - params: [COLLATERAL_RESERVE_CELO], - block: chainBlocks['celo'], - })).output; - sdk.util.sumSingleBalance(balances, transform(ETHIX_TOKEN_CELO), collateralBalanceCelo); - - const minimiceBalanceCelo = (await sdk.api.abi.call({ - abi: 'erc20:balanceOf', - chain: 'celo', - target: ETHIX_TOKEN_CELO, - params: [MINIMICE_CELO], - block: chainBlocks['celo'], - })).output; - sdk.util.sumSingleBalance(balances, transform(ETHIX_TOKEN_CELO), minimiceBalanceCelo); - - return balances; -} module.exports = { timetravel: true, diff --git a/projects/exodia/index.js b/projects/exodia/index.js index 496b19b8b17..5d633e30a55 100644 --- a/projects/exodia/index.js +++ b/projects/exodia/index.js @@ -1,8 +1,6 @@ const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens } = require("../helper/unwrapLPs"); const sdk = require('@defillama/sdk'); -const { transformFantomAddress } = require("../helper/portedTokens"); -const { request, gql } = require("graphql-request"); const ExodStaking = "0x8b8d40f98a2f14e2dd972b3f2e2a2cc227d1e3be" const exod = "0x3b57f3feaaf1e8254ec680275ee6e7727c7413c7" @@ -65,7 +63,7 @@ const getPoolTokens = async (block) => { const staking = async (timestamp, ethBlock, chainBlocks) => { const balances = {}; - const transformAddress = await transformFantomAddress(); + const transformAddress = i => `fantom:${i}`; await sumTokens(balances, [[exod, ExodStaking]], chainBlocks.fantom, 'fantom', transformAddress) @@ -74,7 +72,7 @@ const staking = async (timestamp, ethBlock, chainBlocks) => { async function tvl(timestamp, block, chainBlocks) { const balances = {}; - const transformAddress = await transformFantomAddress(); + const transformAddress = i => `fantom:${i}`; const treasuryBalances = await getPoolTokens(chainBlocks.fantom) const tokens = [mai, dai, wftm, gohm, exod, wsexod] diff --git a/projects/fantompup/index.js b/projects/fantompup/index.js index df6017a13cb..0aef18f8318 100644 --- a/projects/fantompup/index.js +++ b/projects/fantompup/index.js @@ -1,5 +1,4 @@ const abi = require("../helper/abis/masterchef.json") -const { transformFantomAddress } = require("../helper/portedTokens"); const { addFundsInMasterChef } = require("../helper/masterchef"); const { staking } = require("../helper/staking"); const { pool2Exports } = require('../helper/pool2') @@ -13,7 +12,7 @@ const fPupSpookyLP = "0xc2F40ba0cfdAe59E4E16727862C7a0f249fcAaF2"; async function tvl(timestamp, block, chainBlocks) { const balances = {} - const transformAddress = await transformFantomAddress(); + const transformAddress = i => `fantom:${i}`; await addFundsInMasterChef(balances, chef, chainBlocks.fantom, "fantom", transformAddress, abi.poolInfo, [fpup, fPupFwingsFtmLP, fPupFwingsUsdcLP, fPupSpookyLP]); return balances; } diff --git a/projects/geist/index.js b/projects/geist/index.js index 7596e5a3d75..412fc9f4e11 100644 --- a/projects/geist/index.js +++ b/projects/geist/index.js @@ -1,7 +1,6 @@ const { staking } = require("../helper/staking"); const { pool2 } = require("../helper/pool2"); const { aaveChainTvl } = require("../helper/aave"); -const { transformFantomAddress } = require("../helper/portedTokens"); const stakingContract = "0x49c93a95dbcc9A6A4D8f77E59c038ce5020e82f8"; const GEIST = "0xd8321aa83fb0a4ecd6348d4577431310a6e0814d"; @@ -11,7 +10,7 @@ const GEIST_WFTM_spLP = "0x668AE94D0870230AC007a01B471D02b2c94DDcB9"; function lending(borrowed) { return async (timestamp, ethBlock, chainBlocks) => { - const transform = await transformFantomAddress(); + const transform = i => `fantom:${i}`; return aaveChainTvl( "fantom", "0x4CF8E50A5ac16731FA2D8D9591E195A285eCaA82", diff --git a/projects/gemmine/index.js b/projects/gemmine/index.js index d7af9bb1554..60f23db39b9 100644 --- a/projects/gemmine/index.js +++ b/projects/gemmine/index.js @@ -1,5 +1,4 @@ const abi = require("../helper/abis/masterchef.json") -const { transformFantomAddress } = require("../helper/portedTokens"); const { addFundsInMasterChef } = require("../helper/masterchef"); const { staking } = require("../helper/staking"); const { pool2Exports } = require('../helper/pool2') @@ -11,7 +10,7 @@ const gemmineFtmLP = "0xBc2c0E34BF4955eB8967504d0f873b40D1d75Ef9"; async function tvl(timestamp, block, chainBlocks) { const balances = {} - const transformAddress = await transformFantomAddress(); + const transformAddress = i => `fantom:${i}`; await addFundsInMasterChef(balances, chef, chainBlocks.fantom, "fantom", transformAddress, abi.poolInfo, [gemmine, gemmineFtmLP]); return balances; } diff --git a/projects/gogocoin/index.js b/projects/gogocoin/index.js index 3a19f7d9c2f..46d2bfea51b 100644 --- a/projects/gogocoin/index.js +++ b/projects/gogocoin/index.js @@ -1,14 +1,8 @@ const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk'); -const { - transformPolygonAddress -} = require('../helper/portedTokens'); const { pool2 } = require('../helper/pool2'); -const { - sumChainTvls -} = require('@defillama/sdk/build/generalUtil'); const USDC_POOL_STAKING_CONTRACT = '0x7FCf0f2dcEc385FCCEd98240A8A4bEC8e91da7D1' const GOVERNANCE_STAKING_CONTRACT = '0xd46206003FfB72Fe5FEB04373328C62e2bF864f9' @@ -20,7 +14,7 @@ const chain = 'polygon' async function chainTVL(timestamp, block, chainBlocks) { const balances = {} - const transform = await transformPolygonAddress(); + const transform = i => `polygon:${i}`; const USDCPool = await sdk.api.abi.call({ target: USDC_POOL_STAKING_CONTRACT, @@ -35,7 +29,7 @@ async function chainTVL(timestamp, block, chainBlocks) { async function stakingX(timestamp, block, chainBlocks) { const balances = {} - const transform = await transformPolygonAddress(); + const transform = i => `polygon:${i}`; const totalGOGOLocked = await sdk.api.abi.call({ target: GOVERNANCE_STAKING_CONTRACT, @@ -50,7 +44,7 @@ async function stakingX(timestamp, block, chainBlocks) { } async function pool2X(...args) { - const transform = await transformPolygonAddress(); + const transform = i => `polygon:${i}`; return pool2(LP_STAKING_CONTRACT, LP_TOKEN_USDC, chain, transform)(...args) } diff --git a/projects/helper/portedTokens.js b/projects/helper/portedTokens.js index a720f27a6a7..5354d84ba7b 100644 --- a/projects/helper/portedTokens.js +++ b/projects/helper/portedTokens.js @@ -10,26 +10,6 @@ const { distressedAssts, } = require('./tokenMapping') -async function transformFantomAddress() { - return transformChainAddress(transformTokens.fantom, "fantom") -} - -async function transformBscAddress() { - return transformChainAddress(transformTokens.bsc, "bsc") -} - -async function transformPolygonAddress() { - return transformChainAddress(transformTokens.polygon, "polygon") -} - -async function transformCeloAddress() { - return transformChainAddress(transformTokens.celo, "celo") -} - -async function transformOptimismAddress() { - return transformChainAddress(transformTokens.optimism, "optimism") -} - async function transformInjectiveAddress() { return addr => { if (addr.includes('ibc/')) return addr.replace(/.*ibc\//, 'ibc/').replace(/\//g, ':') @@ -85,10 +65,6 @@ for (const chain of Object.keys(fixBalancesTokens)) { } const chainTransforms = { - fantom: transformFantomAddress, - bsc: transformBscAddress, - polygon: transformPolygonAddress, - optimism: transformOptimismAddress, injective: transformInjectiveAddress, }; @@ -258,11 +234,6 @@ async function transformDexBalances({ chain, data, balances = {}, restrictTokenR module.exports = { getChainTransform, getFixBalances, - transformFantomAddress, - transformBscAddress, - transformPolygonAddress, - transformOptimismAddress, - transformCeloAddress, stripTokenHeader, getFixBalancesSync, transformBalances, diff --git a/projects/jetfuelfinance/index.js b/projects/jetfuelfinance/index.js index 75a48a0cc4d..ff15a4a38a5 100644 --- a/projects/jetfuelfinance/index.js +++ b/projects/jetfuelfinance/index.js @@ -2,9 +2,7 @@ const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); -const { transformBscAddress } = require("../helper/portedTokens"); const { compoundExports } = require("../helper/compound"); -const {uniTvlExport} = require("../helper/calculateUniTvl"); // Jetswap section //const factory = "0x0eb58E5c8aA63314ff5547289185cC4583DfCBD5"; @@ -85,7 +83,7 @@ const bscTvl = async (timestamp, block, chainBlocks) => { }); }); - const transformAddress = await transformBscAddress(); + const transformAddress = i => `bsc:${i}`; await unwrapUniswapLPs( balances, diff --git a/projects/jetmine/index.js b/projects/jetmine/index.js index ae10e14e122..5e4935cb138 100644 --- a/projects/jetmine/index.js +++ b/projects/jetmine/index.js @@ -1,5 +1,4 @@ const abi = require("../helper/abis/masterchef.json") -const { transformFantomAddress } = require("../helper/portedTokens"); const { addFundsInMasterChef } = require("../helper/masterchef"); const { staking } = require("../helper/staking"); const { pool2Exports } = require('../helper/pool2') @@ -11,7 +10,7 @@ const jetmineFtmLP = "0x9f0121654bb430192CF2Fc2fc5B6673C97d5DFA3"; async function tvl(timestamp, block, chainBlocks) { const balances = {} - const transformAddress = await transformFantomAddress(); + const transformAddress = i => `fantom:${i}`; await addFundsInMasterChef(balances, chef, chainBlocks.fantom, "fantom", transformAddress, abi.poolInfo, [jetmine, jetmineFtmLP]); return balances; } diff --git a/projects/kebab-finance/index.js b/projects/kebab-finance/index.js index 23f7c2281f8..9bd2d0bcd4d 100644 --- a/projects/kebab-finance/index.js +++ b/projects/kebab-finance/index.js @@ -1,5 +1,4 @@ const sdk = require("@defillama/sdk"); -const { transformBscAddress } = require("../helper/portedTokens"); const { addFundsInMasterChef } = require("../helper/masterchef"); const masterchef = "0x76FCeffFcf5325c6156cA89639b17464ea833ECd"; @@ -8,7 +7,7 @@ const poolInfoAbi = 'function poolInfo(uint256) view returns (address lpToken, u async function tvl(timestamp, block, chainBlocks) { let balances = {}; - const transform = await transformBscAddress(); + const transform = i => `bsc:${i}`; await addFundsInMasterChef( balances, masterchef, diff --git a/projects/kingdefi/index.js b/projects/kingdefi/index.js index 3911bfebb91..c359c06e841 100644 --- a/projects/kingdefi/index.js +++ b/projects/kingdefi/index.js @@ -1,10 +1,5 @@ -const sdk = require("@defillama/sdk"); const { staking } = require("../helper/staking"); const { addFundsInMasterChef } = require("../helper/masterchef"); -const { - transformBscAddress, - transformPolygonAddress, -} = require("../helper/portedTokens"); const masterChefContract_bsc = "0x49A44ea2B4126CC1C53C47Ed7f9a5905Cbecae8d"; //const masterChefContract_bscexp = "0x50302F18132d98ea4B0f7Fd2d98e0B1b5d3a3A60"; @@ -17,8 +12,8 @@ function calctvl(chain) { return async (chainBlocks) => { const balances = {}; - const transformAddress_bsc = await transformBscAddress(); - const transformAddress_polygon = await transformPolygonAddress(); + const transformAddress_bsc = i => `bsc:${i}`; + const transformAddress_polygon = i => `polygon:${i}`; await addFundsInMasterChef( balances, diff --git a/projects/klima-dao/index.js b/projects/klima-dao/index.js index f630499ac73..38eca521123 100644 --- a/projects/klima-dao/index.js +++ b/projects/klima-dao/index.js @@ -1,7 +1,6 @@ const ADDRESSES = require('../helper/coreAssets.json') const { staking } = require('../helper/staking') const { sumTokensAndLPsSharedOwners } = require('../helper/unwrapLPs') -const { transformPolygonAddress } = require('../helper/portedTokens') const treasury = "0x7Dd4f0B986F032A44F913BF92c9e8b7c17D77aD7" @@ -9,7 +8,7 @@ const daoWallet = "0x65A5076C0BA74e5f3e069995dc3DAB9D197d995c" async function tvl(time, ethBlock, chainBlocks) { const balances = {} - const transform = await transformPolygonAddress() + const transform = i => `polygon:${i}` await sumTokensAndLPsSharedOwners(balances, [ ["0x2f800db0fdb5223b3c3f354886d907a671414a7f", false], // BCT ["0xD838290e877E0188a4A44700463419ED96c16107", false], // NCT diff --git a/projects/knightsfantom/index.js b/projects/knightsfantom/index.js index 7056fc5e34d..f04b541261c 100644 --- a/projects/knightsfantom/index.js +++ b/projects/knightsfantom/index.js @@ -1,5 +1,4 @@ const abi = require("../helper/abis/masterchef.json") -const { transformFantomAddress } = require("../helper/portedTokens"); const { addFundsInMasterChef } = require("../helper/masterchef"); const { staking } = require("../helper/staking"); const { pool2Exports } = require('../helper/pool2') @@ -11,7 +10,7 @@ const knightsFtmLP = "0x26ac59ee36965db597167c4a1b1b4367285aa4e3"; async function tvl(timestamp, block, chainBlocks) { const balances = {} - const transformAddress = await transformFantomAddress(); + const transformAddress = i => `fantom:${i}`; await addFundsInMasterChef(balances, chef, chainBlocks.fantom, "fantom", transformAddress, abi.poolInfo, [knights, knightsFtmLP]); return balances; } diff --git a/projects/lavafall/index.js b/projects/lavafall/index.js index b28e98c04c4..21394a29f08 100644 --- a/projects/lavafall/index.js +++ b/projects/lavafall/index.js @@ -1,5 +1,4 @@ const abi = require("../helper/abis/masterchef.json") -const { transformFantomAddress } = require("../helper/portedTokens"); const { addFundsInMasterChef } = require("../helper/masterchef"); const { staking } = require("../helper/staking"); const { pool2Exports } = require('../helper/pool2') @@ -12,7 +11,7 @@ const lavafallUsdcLP = "0x697B07a3c13D4fb23974ce56c353493AAF6bCaf1"; async function tvl(timestamp, block, chainBlocks) { const balances = {} - const transformAddress = await transformFantomAddress(); + const transformAddress = i => `fantom:${i}`; await addFundsInMasterChef(balances, chef, chainBlocks.fantom, "fantom", transformAddress, abi.poolInfo, [lavafall, lavafallFtmLP, lavafallUsdcLP]); return balances; } diff --git a/projects/lemma/index.js b/projects/lemma/index.js index 34c94851cf7..172e7cd52c4 100644 --- a/projects/lemma/index.js +++ b/projects/lemma/index.js @@ -1,6 +1,5 @@ const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk'); -const { transformOptimismAddress } = require('../helper/portedTokens'); const perpV2VaultABI = require('./abis/perpV2Vault.json'); const perpLemmaWrapperABI = require('./abis/perpLemmaWrapper.json'); const USDC = ADDRESSES.optimism.USDC; @@ -25,7 +24,7 @@ const perpLemmaWrappers = [ //tracks only tvl on optimism (v2) as v1 (on arbitrum) is getting deprecated async function tvl(timestamp, block, chainBlocks) { const balances = {}; - const transform = await transformOptimismAddress(); + const transform = i => `optimism:${i}`; for (let i = 0; i < tokens.length; i++) { const token = tokens[i]; diff --git a/projects/liquiddriver/index.js b/projects/liquiddriver/index.js index 58f10a34192..0a49e538b39 100644 --- a/projects/liquiddriver/index.js +++ b/projects/liquiddriver/index.js @@ -1,8 +1,7 @@ const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); -const { unwrapUniswapLPs, sumTokens2 } = require("../helper/unwrapLPs"); -const { transformFantomAddress, transformBscAddress } = require("../helper/portedTokens"); +const { sumTokens2 } = require("../helper/unwrapLPs"); const { addFundsInMasterChef } = require("../helper/masterchef"); const { staking } = require("../helper/staking"); const BigNumber = require("bignumber.js"); @@ -58,7 +57,7 @@ const shadowChefAddresses = [ const masterchefTvl = async (timestamp, ethBlock, chainBlocks) => { const balances = {}; - const transformAddress = await transformFantomAddress(); + const transformAddress = i => `fantom:${i}`; await addFundsInMasterChef( balances, @@ -74,7 +73,7 @@ const masterchefTvl = async (timestamp, ethBlock, chainBlocks) => { const hundredchefTvl = async (timestamp, ethBlock, chainBlocks, { api }) => { const balances = {}; - const transformAddress = await transformFantomAddress(); + const transformAddress = i => `fantom:${i}`; const hdaiChefAddress = "0x79364E45648Db09eE9314E47b2fD31c199Eb03B9"; const husdcChefAddress = "0x9A07fB107b9d8eA8B82ECF453Efb7cFb85A66Ce9"; diff --git a/projects/luchadores/index.js b/projects/luchadores/index.js index db8609511e0..bd1ae44477f 100644 --- a/projects/luchadores/index.js +++ b/projects/luchadores/index.js @@ -2,7 +2,6 @@ const ADDRESSES = require('../helper/coreAssets.json') const { staking } = require('../helper/staking'); const { pool2s } = require('../helper/pool2'); const {sumTokensAndLPsSharedOwners} = require('../helper/unwrapLPs'); -const {transformPolygonAddress} = require('../helper/portedTokens'); // multisigs const treasury = "0x0Cb11b92Fa5C30eAfe4aE84B7BB4dF3034C38b9d"; @@ -31,7 +30,7 @@ const WMATIC_LUCHA_Balancer_polygon = "0x924EC7ed38080E40396c46F6206A6d77D0B9f72 async function tvl(time, ethBlock, chainBlocks){ const balances = {}; - const transform = await transformPolygonAddress(); + const transform = i => `polygon:${i}`; await sumTokensAndLPsSharedOwners(balances, [ // [LUCHA_polygon, false], [MATIC_polygon, false], diff --git a/projects/luckychip/index.js b/projects/luckychip/index.js index 249858c4a6a..b994cd79397 100644 --- a/projects/luckychip/index.js +++ b/projects/luckychip/index.js @@ -1,7 +1,6 @@ const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens } = require('../helper/unwrapLPs') const sdk = require('@defillama/sdk') -const { transformBscAddress } = require('../helper/portedTokens'); const { staking } = require("../helper/staking"); const tokenHolderMap = [ @@ -31,7 +30,7 @@ function normalizeArray(arrayOrString){ } async function tvl(timestamp, ethBlock, chainBlocks) { - const transform = await transformBscAddress(); + const transform = i => `bsc:${i}`; const block = chainBlocks.bsc; const tokensAndHolders = [] diff --git a/projects/malt-money/index.js b/projects/malt-money/index.js index 59d674a7c0a..03045e4485d 100644 --- a/projects/malt-money/index.js +++ b/projects/malt-money/index.js @@ -1,6 +1,5 @@ const sdk = require("@defillama/sdk"); const {unwrapUniswapLPs} = require('../helper/unwrapLPs') -const {transformPolygonAddress} = require('../helper/portedTokens') const axios = require('axios') const maitFarm = '0x539618aa29c95c28c0b04abb9025815c014a9db9' @@ -9,7 +8,7 @@ const treasury = '0xe444a7d44065b06ac551623d56ba610a44a20013' async function tvl(timestamp, block, chainBlocks) { let balances = {} let lpPositions = [] - let transformAddress = await transformPolygonAddress() + let transformAddress = i => `polygon:${i}` let maitFarmTokens = (await axios.get(`https://api.covalenthq.com/v1/137/address/${maitFarm}/balances_v2/?&key=ckey_72cd3b74b4a048c9bc671f7c5a6`)).data.data.items let treasuryTokens = (await axios.get(`https://api.covalenthq.com/v1/137/address/${treasury}/balances_v2/?&key=ckey_72cd3b74b4a048c9bc671f7c5a6`)).data.data.items diff --git a/projects/manarium/index.js b/projects/manarium/index.js index 42b2e4bc057..279b6f556fe 100644 --- a/projects/manarium/index.js +++ b/projects/manarium/index.js @@ -1,11 +1,10 @@ const sdk = require('@defillama/sdk'); -const { transformBscAddress } = require('../helper/portedTokens'); const ARI_TOKEN_CONTRACT = '0xc80a0a55caf6a7bfb4ee22f9380c4077312c4a35'; const ARI_STAKING_CONTRACT = '0x0C3542f48D26CF67e2DAc78f5588D12649F4D255'; async function tvl(timestamp, block, chainBlocks){ const balances = {}; - const transform = await transformBscAddress(); + const transform = i => `bsc:${i}`; const collateralBalance = (await sdk.api.abi.call({ abi: 'erc20:balanceOf', diff --git a/projects/market.xyz/index.js b/projects/market.xyz/index.js index c9509632160..d47593c0530 100644 --- a/projects/market.xyz/index.js +++ b/projects/market.xyz/index.js @@ -1,10 +1,6 @@ const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const abi = require("./abi"); -const { - transformPolygonAddress, - transformFantomAddress, -} = require("../helper/portedTokens"); const fusePoolLensAddress = { polygon: "0x0e76288Ac7fD4643290Bc857E26A4E7BfBd5aADF", @@ -49,27 +45,27 @@ async function getFusePools( async function polygonTvl(timestamp, block, chainBlocks) { const balances = {}; - const transform = await transformPolygonAddress(); + const transform = i => `polygon:${i}`; block = chainBlocks.polygon; await getFusePools(timestamp, block, balances, false, "polygon", transform); return balances; } async function polygonBorrowed(timestamp, block, chainBlocks) { const balances = {}; - const transform = await transformPolygonAddress(); + const transform = i => `polygon:${i}`; block = chainBlocks.polygon; await getFusePools(timestamp, block, balances, true, "polygon", transform); return balances; } async function fantomTvl(timestamp, _, {fantom: block}) { const balances = {}; - const transform = await transformFantomAddress(); + const transform = i => `fantom:${i}`; await getFusePools(timestamp, block, balances, false, "fantom", transform); return balances; } async function fantomBorrowed(timestamp, _, {fantom: block}) { const balances = {}; - const transform = await transformFantomAddress(); + const transform = i => `fantom:${i}`; await getFusePools(timestamp, block, balances, true, "fantom", transform); return balances; } diff --git a/projects/marsecosystem/index.js b/projects/marsecosystem/index.js index 11d3e500fa7..9dd4c72672a 100644 --- a/projects/marsecosystem/index.js +++ b/projects/marsecosystem/index.js @@ -1,7 +1,5 @@ const sdk = require("@defillama/sdk"); -const utils = require('../helper/utils'); const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); -const { transformBscAddress } = require("../helper/portedTokens"); const { getConfig } = require('../helper/cache') const abi = require("./abi.json"); @@ -32,7 +30,7 @@ async function calculate(chainBlocks, localPools, remotePools) { }) ).output.map(v => v.output); - const transformAdress = await transformBscAddress(); + const transformAdress = i => `bsc:${i}`; const lpPositions = []; diff --git a/projects/marshamallowdefi/index.js b/projects/marshamallowdefi/index.js index ee767645b30..0091462f328 100644 --- a/projects/marshamallowdefi/index.js +++ b/projects/marshamallowdefi/index.js @@ -1,7 +1,6 @@ const abi = require("./abi.json"); const { staking } = require("../helper/staking"); const { pool2s } = require("../helper/pool2"); -const { transformBscAddress } = require("../helper/portedTokens"); const { addFundsInMasterChef } = require("../helper/masterchef"); // --- Farms Addresses --- @@ -52,7 +51,7 @@ const Pool2 = async (...params) => { const bscTvl = async (chainBlocks) => { const balances = {}; - let transformAddress = await transformBscAddress(); + let transformAddress = i => `bsc:${i}`; await addFundsInMasterChef( balances, masterChefFarms, diff --git a/projects/merlinlab/index.js b/projects/merlinlab/index.js index 6bb70709499..9ffdc4aad74 100644 --- a/projects/merlinlab/index.js +++ b/projects/merlinlab/index.js @@ -1,6 +1,5 @@ const sdk = require("@defillama/sdk"); const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); -const { transformBscAddress } = require("../helper/portedTokens"); const stakingABI = require("./staking.json"); const vaultABI = require("./vault.json"); @@ -75,7 +74,7 @@ const bscTvl = async (timestamp, ethBlock, chainBlocks) => { balance: amount, })); - const transformAdress = await transformBscAddress(); + const transformAdress = i => `bsc:${i}`; await unwrapUniswapLPs( balances, diff --git a/projects/mint-club/index.js b/projects/mint-club/index.js index 3470f89d8ec..f199a72e7b1 100644 --- a/projects/mint-club/index.js +++ b/projects/mint-club/index.js @@ -1,27 +1,10 @@ -const sdk = require('@defillama/sdk'); -const { transformBscAddress } = require('../helper/portedTokens'); +const { sumTokensExport } = require('../helper/unwrapLPs'); const MINT_TOKEN_CONTRACT = '0x1f3Af095CDa17d63cad238358837321e95FC5915'; const MINT_CLUB_BOND_CONTRACT = '0x8BBac0C7583Cc146244a18863E708bFFbbF19975'; -async function tvl(timestamp, block, chainBlocks) { - const balances = {}; - const transform = await transformBscAddress(); - - const collateralBalance = (await sdk.api.abi.call({ - abi: 'erc20:balanceOf', - chain: 'bsc', - target: MINT_TOKEN_CONTRACT, - params: [MINT_CLUB_BOND_CONTRACT], - block: chainBlocks['bsc'], - })).output; - - sdk.util.sumSingleBalance(balances, transform(MINT_TOKEN_CONTRACT), collateralBalance) - - return balances; -} - module.exports = { bsc: { - tvl, + tvl: () => ({}), + staking: sumTokensExport({ owner: MINT_CLUB_BOND_CONTRACT, tokens: [MINT_TOKEN_CONTRACT]}) } }; // node test.js projects/mint-club/index.js \ No newline at end of file diff --git a/projects/mobiusfinance/index.js b/projects/mobiusfinance/index.js index ce29bcbbc2f..7e5e053480a 100644 --- a/projects/mobiusfinance/index.js +++ b/projects/mobiusfinance/index.js @@ -1,7 +1,6 @@ const ADDRESSES = require('../helper/coreAssets.json') const formatBytes32String = require('ethers').utils.formatBytes32String; const { sumTokens, } = require('../helper/unwrapLPs') -const { transformPolygonAddress } = require('../helper/portedTokens') const ResolverAddr = "0x1E02cdbbA6729B6470de81Ad4D2cCA4c514521b9" const ResolverJson = { @@ -20,7 +19,7 @@ async function tvl(ts, _block, { polygon: block }) { const stakeStr = formatBytes32String("Stake") const motStr = formatBytes32String("MOT") const balances = {} - const transform = await transformPolygonAddress() + const transform = i => `polygon:${i}` const [ MobiusAddr, diff --git a/projects/mockingbird/index.js b/projects/mockingbird/index.js index 91c9a90ecf0..15266f23d2f 100644 --- a/projects/mockingbird/index.js +++ b/projects/mockingbird/index.js @@ -1,5 +1,4 @@ const abi = require("../helper/abis/masterchef.json") -const { transformFantomAddress } = require("../helper/portedTokens"); const { addFundsInMasterChef } = require("../helper/masterchef"); const { staking } = require("../helper/staking"); const { pool2Exports } = require('../helper/pool2') @@ -11,7 +10,7 @@ const mockingbirdFtmLP = "0x04701bEef0caf3B623B3965323Ce3caa4B2b2d7D"; async function tvl(timestamp, block, chainBlocks) { const balances = {} - const transformAddress = await transformFantomAddress(); + const transformAddress = i => `fantom:${i}`; await addFundsInMasterChef(balances, chef, chainBlocks.fantom, "fantom", transformAddress, abi.poolInfo, [mockingbird, mockingbirdFtmLP]); return balances; } diff --git a/projects/moneyrainfinance/index.js b/projects/moneyrainfinance/index.js index 3a99eff550f..57d78e92585 100644 --- a/projects/moneyrainfinance/index.js +++ b/projects/moneyrainfinance/index.js @@ -1,5 +1,4 @@ const abi = require("../helper/abis/masterchef.json") -const { transformFantomAddress } = require("../helper/portedTokens"); const { addFundsInMasterChef } = require("../helper/masterchef"); const { staking } = require("../helper/staking"); const { pool2Exports } = require('../helper/pool2') @@ -12,7 +11,7 @@ const moneyrainUsdcLP = "0x8e9d1a921f91c1f0d33c881d34de8d40a472be23"; async function tvl(timestamp, block, chainBlocks) { const balances = {} - const transformAddress = await transformFantomAddress(); + const transformAddress = i => `fantom:${i}`; await addFundsInMasterChef(balances, chef, chainBlocks.fantom, "fantom", transformAddress, abi.poolInfo, [moneyrain, moneyrainFtmLP, moneyrainUsdcLP]); return balances; } diff --git a/projects/monster/index.js b/projects/monster/index.js index 9fda274909a..37beb68f776 100644 --- a/projects/monster/index.js +++ b/projects/monster/index.js @@ -1,5 +1,4 @@ const sdk = require("@defillama/sdk"); -const { transformFantomAddress } = require("../helper/portedTokens"); const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); const MST_TOKEN_CONTRACT = "0x152888854378201e173490956085c711f1DeD565"; const VE_CONTRACT = "0xc8034b3dF18Ea4d607E86D6b6Bf23E2A8Ed70F89"; @@ -10,7 +9,7 @@ const LP_STAKING_2 = "0xc13926C5CB2636a29381Da874b1e2686163DC226"; async function staking(timestamp, block, chainBlocks) { const balances = {}; - const transform = await transformFantomAddress(); + const transform = i => `fantom:${i}`; const collateralBalance = ( await sdk.api.abi.call({ @@ -33,7 +32,7 @@ async function staking(timestamp, block, chainBlocks) { async function pool2(timestamp, block, chainBlocks) { const balances = {}; - const transform = await transformFantomAddress(); + const transform = i => `fantom:${i}`; const balance1 = ( await sdk.api.abi.call({ diff --git a/projects/morpheusswap/index.js b/projects/morpheusswap/index.js index a92e6351967..1a5033e8e0d 100644 --- a/projects/morpheusswap/index.js +++ b/projects/morpheusswap/index.js @@ -8,7 +8,7 @@ const morph = "0x0789ff5ba37f72abc4d561d00648acadc897b32d" async function tvl(timestamp, block, chainBlocks, api) { const balances = {} - const transformAddress = addr=>`fantom:${addr}` //await transformFantomAddress(); + const transformAddress = addr=>`fantom:${addr}` //i => `fantom:${i}`; if(chainBlocks.fantom<21182441){ // Factory deployment block await addFundsInMasterChef(balances, chef, chainBlocks.fantom, "fantom", transformAddress, abi.poolInfo, [morph]) } else { diff --git a/projects/mover/index.js b/projects/mover/index.js index 9da9737c5fb..915a3b7f12c 100644 --- a/projects/mover/index.js +++ b/projects/mover/index.js @@ -6,8 +6,6 @@ const savingsPlusPoolAbi = require("./savingsPlusPoolAbi.json"); const { staking } = require("../helper/staking"); const { pool2 } = require("../helper/pool2"); -const { transformPolygonAddress } = require('../helper/portedTokens'); - const treasuryContract = "0x94F748BfD1483750a7dF01aCD993213Ab64C960F"; const MOVER = "0x3FA729B4548beCBAd4EaB6EF18413470e6D5324C"; @@ -44,7 +42,7 @@ async function tvlEth(timestamp, block) { async function tvlPolygon(timestamp, block, chainBlocks) { const balances = {}; - const transform = await transformPolygonAddress(); + const transform = i => `polygon:${i}`; let savingsPlusStakedUSDC = (await sdk.api.abi.call({ chain: "polygon", diff --git a/projects/mymine/index.js b/projects/mymine/index.js index 51be03acd12..0e917d0aa71 100644 --- a/projects/mymine/index.js +++ b/projects/mymine/index.js @@ -1,5 +1,4 @@ const abi = require("../helper/abis/masterchef.json") -const { transformFantomAddress } = require("../helper/portedTokens"); const { addFundsInMasterChef } = require("../helper/masterchef"); const { staking } = require("../helper/staking"); const { pool2Exports } = require('../helper/pool2') @@ -11,7 +10,7 @@ const mymineFtmLP = "0xeBe2b687ABAc62b2f0f2414b8345d907FBfFA83a"; async function tvl(timestamp, block, chainBlocks) { const balances = {} - const transformAddress = await transformFantomAddress(); + const transformAddress = i => `fantom:${i}`; await addFundsInMasterChef(balances, chef, chainBlocks.fantom, "fantom", transformAddress, abi.poolInfo, [mymine, mymineFtmLP]); return balances; } diff --git a/projects/nightmare/index.js b/projects/nightmare/index.js index be948559b7f..1462d033034 100644 --- a/projects/nightmare/index.js +++ b/projects/nightmare/index.js @@ -1,5 +1,4 @@ const abi = require("../helper/abis/masterchef.json") -const { transformFantomAddress } = require("../helper/portedTokens"); const { addFundsInMasterChef } = require("../helper/masterchef"); const { staking } = require("../helper/staking"); const { pool2Exports } = require('../helper/pool2') @@ -12,7 +11,7 @@ const fearUsdcLP = "0x69e22277cc54581410bd425058b272808a505f11"; async function tvl(timestamp, block, chainBlocks) { const balances = {} - const transformAddress = await transformFantomAddress(); + const transformAddress = i => `fantom:${i}`; await addFundsInMasterChef(balances, fearchef, chainBlocks.fantom, "fantom", transformAddress, abi.poolInfo, [fear, fearFtmLP, fearUsdcLP]); return balances; } diff --git a/projects/olivedao/index.js b/projects/olivedao/index.js index 77654254acb..254a06f8794 100644 --- a/projects/olivedao/index.js +++ b/projects/olivedao/index.js @@ -1,6 +1,5 @@ const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); -const {transformPolygonAddress} = require('../helper/portedTokens'); const ethPool = "0x8e300739960457B532Af3bEd62475B790e0Dee5E" const usdcPool = "0x05a37e1745926D8725A6C5dbD7Fd9873Dd9E356e" @@ -21,8 +20,8 @@ async function tvl(_timestamp, ethBlock, chainBlocks) { abi: "erc20:balanceOf", chain: 'polygon' }); - const usdc = await (await transformPolygonAddress())(usdcMatic); - const eth = await (await transformPolygonAddress())(wethMatic); + const usdc = await (i => `polygon:${i}`)(usdcMatic); + const eth = await (i => `polygon:${i}`)(wethMatic); sdk.util.sumSingleBalance(balances, usdc, underlyingBalances.output[0].output) sdk.util.sumSingleBalance(balances, eth, underlyingBalances.output[1].output) diff --git a/projects/one-ring/index.js b/projects/one-ring/index.js index 7742ba6a291..1a178c5cd84 100644 --- a/projects/one-ring/index.js +++ b/projects/one-ring/index.js @@ -1,10 +1,6 @@ const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); -const { - transformFantomAddress, - transformPolygonAddress, -} = require("../helper/portedTokens"); const VAULT_CONTRACT_FANTOM = "0x4e332D616b5bA1eDFd87c899E534D996c336a2FC"; const DAI_ADDRSSS_FANTOM = ADDRESSES.fantom.DAI; const VAULT_CONTRACT_POLYGON = "0x6C89E1cD0aa5F62cA2260709BC3895A4Cb735f6c"; @@ -13,7 +9,7 @@ const DAI_ADDRESS_POLYGON = ADDRESSES.polygon.DAI; async function tvlFantom(timestamp, block, chainBlocks) { const balances = {}; - const transform = await transformFantomAddress(); + const transform = i => `fantom:${i}`; const balanceWithInvested = ( await sdk.api.abi.call({ @@ -37,7 +33,7 @@ async function tvlFantom(timestamp, block, chainBlocks) { async function tvlPolygon(timestamp, block, chainBlocks) { const balances = {}; - const transform = await transformPolygonAddress(); + const transform = i => `polygon:${i}`; const balanceWithInvested = ( await sdk.api.abi.call({ diff --git a/projects/oraichain.js b/projects/oraichain.js index 26db097ac40..f58d2731858 100644 --- a/projects/oraichain.js +++ b/projects/oraichain.js @@ -1,8 +1,6 @@ const ADDRESSES = require('./helper/coreAssets.json') const sdk = require("@defillama/sdk"); const { unwrapUniswapLPs } = require("./helper/unwrapLPs") -const { transformBscAddress } = require("./helper/portedTokens"); -const BigNumber = require('bignumber.js'); const { sumSingleBalance } = require("@defillama/sdk/build/generalUtil"); const usdtAddress = ADDRESSES.ethereum.USDT; @@ -87,7 +85,7 @@ async function ethTvl(timestamp, ethBlock, chainBlocks) { } async function bscTvl(timestamp, ethBlock, chainBlocks) { - return await tvl(chainBlocks, 'bsc', await transformBscAddress()); + return await tvl(chainBlocks, 'bsc', i => `bsc:${i}`); } module.exports = { diff --git a/projects/parrotegg/index.js b/projects/parrotegg/index.js index a13f029ceb3..1b6aca544a7 100644 --- a/projects/parrotegg/index.js +++ b/projects/parrotegg/index.js @@ -1,4 +1,4 @@ -const { transformPolygonAddress, getChainTransform, transformBalances, } = require("../helper/portedTokens"); +const { getChainTransform, transformBalances, } = require("../helper/portedTokens"); const { addFundsInMasterChef } = require('../helper/masterchef'); const STAKING_CONTRACT_ARBITRUM = "0x1cCf20F4eE3EFD291267c07268BEcbFDFd192311"; //MASTERCHEF ARBITRUM const STAKING_CONTRACT_IOTEX = "0x83E7e97C4e92D56c0653f92d9b0c0B70288119b8"; // MASTERCHEF IOTEX @@ -19,7 +19,7 @@ const arbitrumTvl = async (timestamp, ethBlock, chainBlocks) => { const polygonTvl = async (timestamp, ethBlock, chainBlocks) => { const balances = {}; - const transformAddress = await transformPolygonAddress(); + const transformAddress = i => `polygon:${i}`; await addFundsInMasterChef( balances, STAKING_CONTRACT_POLYGON, chainBlocks.polygon, 'polygon', transformAddress); diff --git a/projects/phantom-finance/index.js b/projects/phantom-finance/index.js index 48212740d3b..3eff94b14dc 100644 --- a/projects/phantom-finance/index.js +++ b/projects/phantom-finance/index.js @@ -1,5 +1,4 @@ const abi = require("../helper/abis/masterchef.json") -const { transformFantomAddress } = require("../helper/portedTokens"); const { addFundsInMasterChef } = require("../helper/masterchef"); const { staking } = require("../helper/staking"); const { pool2Exports } = require('../helper/pool2') @@ -12,7 +11,7 @@ const phantomUsdcLP = "0x0e5c18cdea0201b4cdab908238d5e06180d7969a"; async function tvl(timestamp, block, chainBlocks) { const balances = {} - const transformAddress = await transformFantomAddress(); + const transformAddress = i => `fantom:${i}`; await addFundsInMasterChef(balances, phantomchef, chainBlocks.fantom, "fantom", transformAddress, abi.poolInfo, [phantom, phantomFtmLP, phantomUsdcLP]); return balances; } diff --git a/projects/planet-finance/index.js b/projects/planet-finance/index.js index 4b6b0b38149..0d49445c62f 100644 --- a/projects/planet-finance/index.js +++ b/projects/planet-finance/index.js @@ -4,7 +4,6 @@ const abi = require("./abi.json"); const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); const { staking } = require("../helper/staking.js"); const { getPoolInfo } = require("../helper/masterchef.js"); -const { transformBscAddress } = require("../helper/portedTokens"); const replacements = { [ADDRESSES.bsc.beltBNB]: @@ -21,7 +20,7 @@ const replacements = { async function tvl(timestamp, ethBlock, chainBlocks) { let balances = {}; const lps = []; - const transform = await transformBscAddress(); + const transform = i => `bsc:${i}`; const [poolInfo1, poolInfo2] = await Promise.all([ await getPoolInfo( diff --git a/projects/polyquail/index.js b/projects/polyquail/index.js index b89a022f11e..ca5691b6643 100644 --- a/projects/polyquail/index.js +++ b/projects/polyquail/index.js @@ -3,7 +3,6 @@ const abi = require("./abi.json"); const { staking } = require("../helper/staking"); const { pool2BalanceFromMasterChefExports } = require("../helper/pool2"); const { addFundsInMasterChef } = require("../helper/masterchef"); -const { transformPolygonAddress } = require("../helper/portedTokens"); const masterChefKWIL = "0xeA038416Ed234593960704ddeD73B78f7D578AA0"; const KWIL = "0x252656AdC9E22C697Ce6c08cA9065FBEe5E394e7"; @@ -17,7 +16,7 @@ const CHK = "0x6116A2A8Ea71890Cf749823Ee9DEC991930a9eEa"; async function polygonTvl(timestamp, block, chainBlocks) { const balances = {}; - const transformAddress = await transformPolygonAddress(); + const transformAddress = i => `polygon:${i}`; await addFundsInMasterChef( balances, diff --git a/projects/polyroll.js b/projects/polyroll.js index 3a81dcc7f81..fbdbf7ffca8 100644 --- a/projects/polyroll.js +++ b/projects/polyroll.js @@ -1,6 +1,5 @@ const ADDRESSES = require('./helper/coreAssets.json') const { sumTokensAndLPsSharedOwners } = require('./helper/unwrapLPs'); -const { transformPolygonAddress } = require('./helper/portedTokens'); const tokens = [ [ADDRESSES.polygon.WMATIC_2, false], //WMATIC @@ -16,7 +15,7 @@ const fundedContracts = [ '0xC96D9032770010f5f3D167cA4eeca84a0Bca0Fa2' //miner ]; async function tvl(timestamp, block, chainBlocks) { - const transform = await transformPolygonAddress(); + const transform = i => `polygon:${i}`; const balances = {}; block = chainBlocks.polygon; @@ -32,7 +31,7 @@ async function tvl(timestamp, block, chainBlocks) { return balances; } async function staking(timestamp, block, chainBlocks) { - const transform = await transformPolygonAddress(); + const transform = i => `polygon:${i}`; const balances = {}; block = chainBlocks.polygon; diff --git a/projects/polywhale/index.js b/projects/polywhale/index.js index d372edc4923..16ee945e3f9 100644 --- a/projects/polywhale/index.js +++ b/projects/polywhale/index.js @@ -1,5 +1,4 @@ const sdk = require("@defillama/sdk"); -const { transformPolygonAddress } = require("../helper/portedTokens"); const { addFundsInMasterChef } = require("../helper/masterchef"); const { pool2 } = require("../helper/pool2"); @@ -10,7 +9,7 @@ const krillUsdcLP = "0x6405Ebc22cB0899FC21f414085Ac4044B4721a0d"; async function tvl(timestamp, chain, chainBlocks) { let balances = {}; - const transformAddress = await transformPolygonAddress(); + const transformAddress = i => `polygon:${i}`; await addFundsInMasterChef( balances, masterchef, diff --git a/projects/potluckprotocol/index.js b/projects/potluckprotocol/index.js index 03f25519b57..0f0e69b8696 100644 --- a/projects/potluckprotocol/index.js +++ b/projects/potluckprotocol/index.js @@ -1,5 +1,4 @@ const abi = require("./abi.json"); -const { transformFantomAddress } = require("../helper/portedTokens"); const { addFundsInMasterChef } = require("../helper/masterchef"); const { staking } = require("../helper/staking"); @@ -11,7 +10,7 @@ const token = { } async function tvlFantom(timestamp, block, chainBlocks) { const balances = {} - const transformAddress = await transformFantomAddress(); + const transformAddress = i => `fantom:${i}`; await addFundsInMasterChef(balances, chef["fantom"], chainBlocks.fantom, "fantom", transformAddress, abi.poolInfo, [token["fantom"]]) return balances; } diff --git a/projects/purefi/index.js b/projects/purefi/index.js index 06796eef76d..5fc915f2cc5 100644 --- a/projects/purefi/index.js +++ b/projects/purefi/index.js @@ -1,5 +1,4 @@ const { staking, stakings } = require("../helper/staking"); -const { transformPolygonAddress } = require("../helper/portedTokens"); const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); /*** Ethereum Addresses ***/ @@ -55,7 +54,7 @@ const farmingStakingContracts_polygon = [ const polygonTvl = async (chainBlocks) => { const balances = {}; - let transformAddress = await transformPolygonAddress(); + let transformAddress = i => `polygon:${i}`; await sumTokensAndLPsSharedOwners( balances, [ diff --git a/projects/radial/index.js b/projects/radial/index.js index 778a92ce848..3ba2035c4e1 100644 --- a/projects/radial/index.js +++ b/projects/radial/index.js @@ -8,7 +8,6 @@ const { const sdk = require("@defillama/sdk"); const { default: BigNumber } = require("bignumber.js"); const { handleYearnTokens } = require("../creditum/helper.js"); - const { transformFantomAddress } = require("../helper/portedTokens"); const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); const tokenAbi = 'address:token' @@ -28,7 +27,7 @@ const { const stakingToken = "0xf04d7f53933becbf51ddf1f637fe7ecaf3d4ff94"; async function tvl(timestamp, ethBlock, {[chain]: block}) { - const transform = await transformFantomAddress(); + const transform = i => `fantom:${i}`; const poolInfo = await getPoolInfo( masterChef, diff --git a/projects/retrodefi/index.js b/projects/retrodefi/index.js index 8a36b244fd4..89f107c654a 100644 --- a/projects/retrodefi/index.js +++ b/projects/retrodefi/index.js @@ -3,10 +3,6 @@ const abi = require("./abi.json"); const { staking } = require("../helper/staking"); const { pool2s } = require("../helper/pool2"); const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); -const { - transformBscAddress, - transformPolygonAddress, -} = require("../helper/portedTokens"); const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); // --- BSC Addresses --- @@ -143,7 +139,7 @@ const calcTvl = async ( const bscStaking = async (chainBlocks) => { const balances = {}; - const transformAddress = await transformBscAddress(); + const transformAddress = i => `bsc:${i}`; for (const token of stakingTokensBsc) { await sumTokensAndLPsSharedOwners( balances, @@ -167,7 +163,7 @@ const polygonStaking = async (...params) => { const bscTvl = async (chainBlocks) => { const balances = {}; - const transformAddress = await transformBscAddress(); + const transformAddress = i => `bsc:${i}`; await calcTvl( balances, @@ -184,7 +180,7 @@ const bscTvl = async (chainBlocks) => { const polygonTvl = async (chainBlocks) => { const balances = {}; - const transformAddress = await transformPolygonAddress(); + const transformAddress = i => `polygon:${i}`; await calcTvl( balances, diff --git a/projects/revault/index.js b/projects/revault/index.js index aeed5967a97..a878bd5e805 100644 --- a/projects/revault/index.js +++ b/projects/revault/index.js @@ -1,5 +1,4 @@ const sdk = require('@defillama/sdk'); -const { transformBscAddress } = require('../helper/portedTokens'); const REVA_CHEF = "0xd7550285532f1642511b16Df858546F2593d638B"; const REVA_CHEF_ABI = require("./RevaChef.json"); const { unwrapUniswapLPs } = require('../helper/unwrapLPs'); @@ -16,7 +15,7 @@ async function tvl(timestamp, _, { bsc: block }) { const tokenAddresses = Array.from( new Set(config.tokens.map((token) => token.address))); - const transform = await transformBscAddress(); + const transform = i => `bsc:${i}`; const calls = tokenAddresses.map((tokenAddress) => ({ params: tokenAddress, diff --git a/projects/risq.js b/projects/risq.js index 4a66cec738c..1b120e99088 100644 --- a/projects/risq.js +++ b/projects/risq.js @@ -1,6 +1,5 @@ const ADDRESSES = require('./helper/coreAssets.json') const sdk = require("@defillama/sdk"); -const { transformBscAddress } = require('./helper/portedTokens'); const bnbPool = "0x55D10490C500FBF334C0fD91A0b205a5D64b9367"; //BNB_POOL const WBNBAddresss = ADDRESSES.bsc.WBNB; @@ -30,7 +29,7 @@ const tokens = [ ]; // node test.js projects/a.js async function tvl(_timestamp, ethBlock, chainBlocks) { - const transform = await transformBscAddress(); + const transform = i => `bsc:${i}`; let balances = {}; const vaultBalances = (await sdk.api.abi.multiCall({ diff --git a/projects/sapphire/index.js b/projects/sapphire/index.js index f8843cd0749..804b6bf32f6 100644 --- a/projects/sapphire/index.js +++ b/projects/sapphire/index.js @@ -1,5 +1,4 @@ const sdk = require("@defillama/sdk"); -const { transformFantomAddress } = require("../helper/portedTokens"); const { addFundsInMasterChef } = require("../helper/masterchef"); const { stakings } = require('../helper/staking') const poolInfo = 'function poolInfo(uint256) view returns (address lpToken, uint256 allocPoint, uint256 lastRewardBlock, uint256 accfSapphirePerShare, uint16 depositFeeBP, uint256 lpSupply)' @@ -13,7 +12,7 @@ const sapphireWarFtmLP = "0x16d6A8A53195208f5038421091d5a9dEf9647250" async function tvl(timestamp, block, chainBlocks) { const balances = {} - const transformAddress = await transformFantomAddress() + const transformAddress = i => `fantom:${i}` await addFundsInMasterChef(balances, chef, chainBlocks.fantom, "fantom", transformAddress, poolInfo, [sapphire, sapphireFtmLP]) await addFundsInMasterChef(balances, sapphireWarChef, chainBlocks.fantom, "fantom", transformAddress, poolInfo, [sapphireWar, sapphireWarFtmLP]) return balances; diff --git a/projects/scarecrow/index.js b/projects/scarecrow/index.js index b42d396fdaf..4a15550f9a3 100644 --- a/projects/scarecrow/index.js +++ b/projects/scarecrow/index.js @@ -1,5 +1,4 @@ const abi = require("../helper/abis/masterchef.json") -const { transformFantomAddress } = require("../helper/portedTokens"); const { addFundsInMasterChef } = require("../helper/masterchef"); const { staking } = require("../helper/staking"); const { pool2Exports } = require('../helper/pool2') @@ -12,7 +11,7 @@ const scareUsdcLP = "0xC4C9a74b10Ca90DbA51a4ec69c7b3CE6709bAebf"; async function tvl(timestamp, block, chainBlocks) { const balances = {} - const transformAddress = await transformFantomAddress(); + const transformAddress = i => `fantom:${i}`; await addFundsInMasterChef(balances, chef, chainBlocks.fantom, "fantom", transformAddress, abi.poolInfo, [scare, scareFtmLP, scareUsdcLP]); return balances; } diff --git a/projects/scream/index.js b/projects/scream/index.js index 26b8f3ef017..f289189ed26 100644 --- a/projects/scream/index.js +++ b/projects/scream/index.js @@ -1,11 +1,10 @@ const ADDRESSES = require('../helper/coreAssets.json') const { getCompoundV2Tvl } = require('../helper/compound') -const { transformFantomAddress } = require('../helper/portedTokens') const { staking } = require('../helper/staking') function lending(borrowed) { return async (...params) => { - const transformAdress = await transformFantomAddress() + const transformAdress = i => `fantom:${i}` const balances = await getCompoundV2Tvl("0x260e596dabe3afc463e75b6cc05d8c46acacfb09", "fantom", addr => { if (addr === "0xAd84341756Bf337f5a0164515b1f6F993D194E1f") { return ADDRESSES.ethereum.TUSD diff --git a/projects/sculptor-finance/index.js b/projects/sculptor-finance/index.js index 2b1b1025158..5a3d12117fb 100644 --- a/projects/sculptor-finance/index.js +++ b/projects/sculptor-finance/index.js @@ -1,7 +1,6 @@ const { staking } = require("../helper/staking"); const { pool2 } = require("../helper/pool2"); const { aaveChainTvl } = require("../helper/aave"); -const { transformBscAddress } = require("../helper/portedTokens"); const stakingContract = "0xd4F7F739488f5C9930A60e85afbE26a8B71BA795"; const SCULPT = "0xAd3E02e83b886543D1171FF446C130D52068C106"; @@ -11,7 +10,7 @@ const SCULPT_BNB = "0xB1F3bE619648B4a2dF6ddaCFD42B051F21bF3dc8"; function lending(borrowed) { return async (timestamp, ethBlock, chainBlocks) => { - const transform = await transformBscAddress(); + const transform = i => `bsc:${i}`; return aaveChainTvl( "bsc", "0xa1eBB37b5A19050A192c38C82f25f4aBf0158F39", diff --git a/projects/seeder/index.js b/projects/seeder/index.js index adf7db32942..890469c13af 100644 --- a/projects/seeder/index.js +++ b/projects/seeder/index.js @@ -1,7 +1,6 @@ const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); -const { transformBscAddress } = require("../helper/portedTokens"); const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); const farmContract = "0x1aF28E7b1A03fA107961897a28449F4F9768ac75"; @@ -100,7 +99,7 @@ const bscTvl = async (chainBlocks) => { } }); - const transformAddress = await transformBscAddress(); + const transformAddress = i => `bsc:${i}`; await unwrapUniswapLPs( balances, diff --git a/projects/shadecash/index.js b/projects/shadecash/index.js index f03bb42deb5..8e4f538428f 100644 --- a/projects/shadecash/index.js +++ b/projects/shadecash/index.js @@ -1,7 +1,6 @@ const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens } = require('../helper/unwrapLPs') const addresses = require('./contracts.json') -const { transformFantomAddress } = require("../helper/portedTokens"); const sdk = require('@defillama/sdk'); const {staking} = require('../helper/staking'); const {pool2} = require('../helper/pool2') @@ -39,7 +38,7 @@ async function tvl(_, _ethBlock, chainBlocks) { await sumTokens(balances, calls, chainBlocks['fantom'], "fantom"); // TRANSFORM ADDRESSES - let transformAddress = await transformFantomAddress(); + let transformAddress = i => `fantom:${i}`; Object.keys(balances).map(k => { let transformed = transformAddress(k); if(k.toLowerCase() === tokens.xBOO.toLowerCase()){ diff --git a/projects/singularityDAO/masterchef.js b/projects/singularityDAO/masterchef.js index 23891f73891..9aaeb171d75 100644 --- a/projects/singularityDAO/masterchef.js +++ b/projects/singularityDAO/masterchef.js @@ -1,7 +1,6 @@ const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); const { sumTokens } = require("../helper/unwrapLPs"); -const { transformBscAddress } = require("../helper/portedTokens"); async function addFundsInMasterChef({ balances, @@ -30,7 +29,7 @@ async function addFundsInMasterChef({ chain, }) ).output; - const transform = await transformBscAddress(); + const transform = i => `bsc:${i}`; const tokensAndOwners = response .map((r) => [r.output, masterchef]) .filter(([token]) => !skipTokens.includes(token)); diff --git a/projects/solidex/index.js b/projects/solidex/index.js index 40e4d55b2a8..f5ba9f164a0 100644 --- a/projects/solidex/index.js +++ b/projects/solidex/index.js @@ -1,5 +1,4 @@ const sdk = require("@defillama/sdk"); -const { transformFantomAddress } = require('../helper/portedTokens'); const { unwrapUniswapLPs, sumTokens } = require('../helper/unwrapLPs'); const abis = require("./abis.json"); diff --git a/projects/spadefinance/index.js b/projects/spadefinance/index.js index e49d8db310f..304d6baa296 100644 --- a/projects/spadefinance/index.js +++ b/projects/spadefinance/index.js @@ -1,5 +1,4 @@ const abi = require("../helper/abis/masterchef.json") -const { transformFantomAddress } = require("../helper/portedTokens"); const { addFundsInMasterChef } = require("../helper/masterchef"); const { staking, stakingPricedLP } = require("../helper/staking"); const { pool2Exports } = require('../helper/pool2') @@ -12,7 +11,7 @@ const spadeUsdcLP = "0x8080233587CE98d6CA094823aB77AE20dA5f35Ac"; async function tvl(timestamp, block, chainBlocks) { const balances = {} - const transformAddress = await transformFantomAddress(); + const transformAddress = i => `fantom:${i}`; await addFundsInMasterChef(balances, spadechef, chainBlocks.fantom, "fantom", transformAddress, abi.poolInfo, [spade, spadeFtmLP, spadeUsdcLP], true, true, spade); return balances; } diff --git a/projects/spectrefi/index.js b/projects/spectrefi/index.js index 3ace2e821ab..156c4c0bf2c 100644 --- a/projects/spectrefi/index.js +++ b/projects/spectrefi/index.js @@ -1,5 +1,4 @@ const abi = require("../helper/abis/masterchef.json") -const { transformFantomAddress } = require("../helper/portedTokens"); const { addFundsInMasterChef } = require("../helper/masterchef"); const { staking } = require("../helper/staking"); const { pool2Exports } = require('../helper/pool2') @@ -12,7 +11,7 @@ const spectUsdcLP = "0xb326bbaC9Ca368FF20D0Fe1a51fF25f5F9C1E310"; async function tvl(timestamp, block, chainBlocks) { const balances = {} - const transformAddress = await transformFantomAddress(); + const transformAddress = i => `fantom:${i}`; await addFundsInMasterChef(balances, chef, chainBlocks.fantom, "fantom", transformAddress, abi.poolInfo, [spect, spectFtmLP, spectUsdcLP]); return balances; } diff --git a/projects/squidstake/index.js b/projects/squidstake/index.js index c2bcdd77b96..b0eea47cd06 100644 --- a/projects/squidstake/index.js +++ b/projects/squidstake/index.js @@ -1,6 +1,5 @@ const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); -const { transformBscAddress } = require("../helper/portedTokens"); const { addFundsInMasterChef } = require("../helper/masterchef"); const { BigNumber } = require("bignumber.js"); const { stakingPricedLP } = require("../helper/staking"); @@ -20,7 +19,7 @@ const getReserves = 'function getReserves() view returns (uint112 _reserve0, uin async function tvl(timestamp, chain, chainBlocks) { let balances = {}; - const transformedAddress = await transformBscAddress(); + const transformedAddress = i => `bsc:${i}`; await addFundsInMasterChef( balances, diff --git a/projects/stakesteak/index.js b/projects/stakesteak/index.js index f254b23a9ce..013673ec782 100644 --- a/projects/stakesteak/index.js +++ b/projects/stakesteak/index.js @@ -2,7 +2,6 @@ const ADDRESSES = require('../helper/coreAssets.json') const {addFundsInMasterChef} = require('../helper/masterchef') const sdk = require('@defillama/sdk') const {staking} = require('../helper/staking') -const {transformFantomAddress} = require('../helper/portedTokens') const poolInfoAbi = 'function getPoolInfo(uint256 _pid) view returns (tuple(address stakingToken, uint256 stakingTokenTotalAmount, uint32 lastRewardTime, uint256[] AccRewardsPerShare, uint256[] AllocPoints))' const tusd = ADDRESSES.ethereum.TUSD @@ -19,7 +18,7 @@ async function tvl(_t, _b, chainBlocks){ const balances = { [tusd]: fusd.output } - const transform = await transformFantomAddress() + const transform = i => `fantom:${i}` await addFundsInMasterChef(balances, '0x5bC37CAAA3b490b65F5A50E2553f4312126A8b7e', block, 'fantom', transform, poolInfoAbi, [ifusd,"0xa0828eE559110b041DEdbf10Ae0cf42274251de1"]) return balances } diff --git a/projects/tenet/index.js b/projects/tenet/index.js index ac528f09bf3..83ea2652209 100644 --- a/projects/tenet/index.js +++ b/projects/tenet/index.js @@ -2,7 +2,6 @@ const abi = require("./abi.json"); const { staking } = require("../helper/staking"); const { pool2BalanceFromMasterChefExports } = require("../helper/pool2"); const { addFundsInMasterChef } = require("../helper/masterchef"); -const { transformBscAddress } = require("../helper/portedTokens"); const farmContract = "0xdA842fad0BDb105c88399e845aD4D00dE3AEb911"; const TEN = "0x74159651a992952e2bf340d7628459aa4593fc05"; @@ -32,7 +31,7 @@ const ethTvl = async (chainBlocks) => { const bscTvl = async (chainBlocks) => { const balances = {}; - let transformAddress = await transformBscAddress(); + let transformAddress = i => `bsc:${i}`; await addFundsInMasterChef( balances, farmContract_bsc, diff --git a/projects/the-sandbox.js b/projects/the-sandbox.js index 12d24729c82..0f6b6e59f49 100644 --- a/projects/the-sandbox.js +++ b/projects/the-sandbox.js @@ -1,6 +1,4 @@ -const sdk = require("@defillama/sdk"); const { pool2 } = require("./helper/pool2"); -const transformPolygonAddress = (id) => `polygon:${id}`; // Staking on Mainnet: uni-v2 const SAND_ETH_univ2 = "0x3dd49f67E9d5Bc4C5E6634b3F70BfD9dc1b6BD74"; @@ -12,16 +10,11 @@ const SAND_MATIC_quick_staking = "0x4ab071c42c28c4858c4bac171f06b13586b20f30"; module.exports = { polygon: { tvl: () => ({}), - pool2: pool2( - SAND_MATIC_quick_staking, - SAND_MATIC_quick, - "polygon", - transformPolygonAddress - ), + pool2: pool2(SAND_MATIC_quick_staking, SAND_MATIC_quick,), }, ethereum: { tvl: () => ({}), - pool2: pool2(SAND_ETH_univ2_staking, SAND_ETH_univ2, "ethereum"), + pool2: pool2(SAND_ETH_univ2_staking, SAND_ETH_univ2), }, methodology: "SAND LP on quickswap and uniswap-v2 can be staked as pool2 - only component of the Sandbox TVL at the moment", diff --git a/projects/tidalfinance/index.js b/projects/tidalfinance/index.js index fa4fb8eefbd..a84081065a5 100644 --- a/projects/tidalfinance/index.js +++ b/projects/tidalfinance/index.js @@ -1,7 +1,6 @@ const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); -const { transformPolygonAddress } = require("../helper/portedTokens"); const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); // Contracts @@ -17,7 +16,7 @@ const TIDAL = "0xB41EC2c036f8a42DA384DDE6ADA79884F8b84b26"; const staking = async (timestamp, ethBlock, chainBlocks) => { const balances = {}; - const transformAddress = await transformPolygonAddress(); + const transformAddress = i => `polygon:${i}`; await sumTokensAndLPsSharedOwners( balances, diff --git a/projects/timewarp/index.js b/projects/timewarp/index.js index e9b8db79a91..33eafdae0c5 100644 --- a/projects/timewarp/index.js +++ b/projects/timewarp/index.js @@ -1,7 +1,6 @@ const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); -const { transformBscAddress } = require("../helper/portedTokens"); const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); const TimeWarpPool_LP_UNISWAP_ETH = @@ -22,7 +21,7 @@ const calcTvl = async (balances, chain, block, TimeWarpPool) => { }) ).output; - const transformAddress = await transformBscAddress(); + const transformAddress = i => `bsc:${i}`; await sumTokensAndLPsSharedOwners( balances, diff --git a/projects/treedefi/index.js b/projects/treedefi/index.js index 86696fb77cb..7e5ce18b708 100644 --- a/projects/treedefi/index.js +++ b/projects/treedefi/index.js @@ -1,12 +1,11 @@ const abi = require("./abi.json"); -const { transformBscAddress } = require("../helper/portedTokens"); const { addFundsInMasterChef } = require("../helper/masterchef"); const MASTERCHEF_CONTRACT = "0xA9a438B8b2E41B3bf322DBA139aF9490DC226953"; async function bscTvl(timestamp, block, chainBlocks) { let balances = {}; - const transformAddress = await transformBscAddress(); + const transformAddress = i => `bsc:${i}`; await addFundsInMasterChef( balances, diff --git a/projects/umbria/index.js b/projects/umbria/index.js index 7a2c1456e23..097c1ab4b84 100644 --- a/projects/umbria/index.js +++ b/projects/umbria/index.js @@ -1,10 +1,7 @@ const abi = require("./abi.json"); -const utils = require("../helper/utils"); -const { fetchChainExports } = require("../helper/exports"); const { staking } = require("../helper/staking"); const { pool2BalanceFromMasterChefExports } = require("../helper/pool2"); const { addFundsInMasterChef } = require("../helper/masterchef"); -const { transformPolygonAddress } = require("../helper/portedTokens"); const farmContract = "0xdF9401225cC62d474C559E9c4558Fb193137bCEB"; const UMBR = "0xa4bbe66f151b22b167127c770016b15ff97dd35c"; @@ -34,7 +31,7 @@ const ethTvl = async (chainBlocks) => { const polygonTvl = async (chainBlocks) => { const balances = {}; - const transformAddress = await transformPolygonAddress(); + const transformAddress = i => `polygon:${i}`; await addFundsInMasterChef( balances, farmContract_polygon, diff --git a/projects/unbk/index.js b/projects/unbk/index.js index a26a763d885..106b45655f1 100644 --- a/projects/unbk/index.js +++ b/projects/unbk/index.js @@ -1,5 +1,4 @@ const sdk = require("@defillama/sdk"); -const { transformFantomAddress } = require("../helper/portedTokens"); const fantomYields = require("./fantom-yields"); const { routerAbi } = require("./router-abi"); @@ -30,7 +29,7 @@ async function getBalance(balances, fyield, chainBlocks, transform) { async function getBalanceIn(chainBlocks, balances, chainName) { if (chainName == "fantom") { - const transform = await transformFantomAddress(); + const transform = i => `fantom:${i}`; const { fyields } = fantomYields; await getTotalBalance(balances, fyields, chainBlocks, transform); } diff --git a/projects/unbound/index.js b/projects/unbound/index.js index c836cb79b2b..be951d9483e 100644 --- a/projects/unbound/index.js +++ b/projects/unbound/index.js @@ -1,6 +1,5 @@ const { GraphQLClient, gql } = require('graphql-request') const { staking } = require("../helper/staking"); -//const { transformPolygonAddress } = require('../helper/portedTokens'); const ETH_STAKING_ADDR = '0x94515758819F4D5119f75EEeB7F6bfdCAdc5e835' diff --git a/projects/undeadfinance/index.js b/projects/undeadfinance/index.js index 8b8e6ccffab..e4f6a6e3e24 100644 --- a/projects/undeadfinance/index.js +++ b/projects/undeadfinance/index.js @@ -1,5 +1,4 @@ const abi = require("../helper/abis/masterchef.json") -const { transformFantomAddress } = require("../helper/portedTokens"); const { addFundsInMasterChef } = require("../helper/masterchef"); const { staking } = require("../helper/staking"); const { pool2Exports } = require('../helper/pool2') @@ -12,7 +11,7 @@ const undeadUsdcLP = "0xc756b9bcc8113ab78a15b4d2c923ca8e4992371e"; async function tvl(timestamp, block, chainBlocks) { const balances = {} - const transformAddress = await transformFantomAddress(); + const transformAddress = i => `fantom:${i}`; await addFundsInMasterChef(balances, chef, chainBlocks.fantom, "fantom", transformAddress, abi.poolInfo, [undead, undeadFtmLP, undeadUsdcLP]); return balances; } diff --git a/projects/unilend/index.js b/projects/unilend/index.js index 9d63407e3dc..9055c53dab2 100644 --- a/projects/unilend/index.js +++ b/projects/unilend/index.js @@ -1,9 +1,4 @@ const { getConfig } = require('../helper/cache') -const { fetchURL } = require("../helper/utils"); -const { - transformPolygonAddress, - transformBscAddress, -} = require("../helper/portedTokens"); const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); const UnilendContract = "0x13A145D215182924c89F2aBc7D358DCc72F8F788"; @@ -38,7 +33,7 @@ const ethTvl = async () => { const polygonTvl = async (chainBlocks) => { const balances = {}; - const transformAddress = await transformPolygonAddress(); + const transformAddress = i => `polygon:${i}`; await calcTvl( balances, 137, @@ -53,7 +48,7 @@ const polygonTvl = async (chainBlocks) => { const bscTvl = async (chainBlocks) => { const balances = {}; - const transformAddress = await transformBscAddress(); + const transformAddress = i => `bsc:${i}`; await calcTvl(balances, 56, chainBlocks["bsc"], "bsc", transformAddress); return balances; diff --git a/projects/unirexfinance/index.js b/projects/unirexfinance/index.js index 5893fb9b0b5..87d8fb0ff44 100644 --- a/projects/unirexfinance/index.js +++ b/projects/unirexfinance/index.js @@ -1,5 +1,4 @@ const abi = require("../helper/abis/masterchef.json") -const { transformFantomAddress } = require("../helper/portedTokens"); const { addFundsInMasterChef } = require("../helper/masterchef"); const { staking } = require("../helper/staking"); const { pool2Exports } = require('../helper/pool2') @@ -12,7 +11,7 @@ const funirexUsdcLP = "0xed16cf3f8b5f05a3bc26fed6ba8b650fef2246ce"; async function tvl(timestamp, block, chainBlocks) { const balances = {} - const transformAddress = await transformFantomAddress(); + const transformAddress = i => `fantom:${i}`; await addFundsInMasterChef(balances, chef, chainBlocks.fantom, "fantom", transformAddress, abi.poolInfo, [funirex, funirexFtmLP, funirexUsdcLP]); return balances; } diff --git a/projects/uniswap/v3/index.js b/projects/uniswap/v3/index.js index e7981b4a2fc..ae228d1d00b 100644 --- a/projects/uniswap/v3/index.js +++ b/projects/uniswap/v3/index.js @@ -1,12 +1,5 @@ const sdk = require('@defillama/sdk') -const {transformOptimismAddress,} = require('../../helper/portedTokens') const oldOptPools = require('./oldUniPools.json') - -const graphUrls = { - ethereum: "https://api.thegraph.com/subgraphs/name/uniswap/uniswap-v3", - optimism: "https://api.thegraph.com/subgraphs/name/ianlapham/uniswap-optimism-dev", - arbitrum: 'https://api.thegraph.com/subgraphs/name/ianlapham/arbitrum-dev', -} const { getLogs } = require('../../helper/cache/getLogs') const FACTORY = '0x1F98431c8aD98523631AE4a59f267346ea31F984'; // same on all chains @@ -90,7 +83,7 @@ function chainTvl(chain) { ) let transform = id=>id if(chain === "optimism"){ - transform = await transformOptimismAddress() + transform = i => `optimism:${i}` } else if(chain === "arbitrum"){ transform = i => `arbitrum:${i}` } diff --git a/projects/universeftm/index.js b/projects/universeftm/index.js index d893f7535ac..7c8d6bf5e0b 100644 --- a/projects/universeftm/index.js +++ b/projects/universeftm/index.js @@ -1,5 +1,4 @@ const abi = require("../helper/abis/masterchef.json") -const { transformFantomAddress } = require("../helper/portedTokens"); const { addFundsInMasterChef } = require("../helper/masterchef"); const { staking, stakingPricedLP } = require("../helper/staking"); const { pool2Exports } = require('../helper/pool2') @@ -12,7 +11,7 @@ const universeUsdcLP = "0xf6d442bcb58bedb27fa128405ff808951d3111dc"; async function tvl(timestamp, block, chainBlocks) { const balances = {} - const transformAddress = await transformFantomAddress(); + const transformAddress = i => `fantom:${i}`; await addFundsInMasterChef(balances, chef, chainBlocks.fantom, "fantom", transformAddress, abi.poolInfo, [universe, universeFtmLP, universeUsdcLP],true,true,universe); return balances; } diff --git a/projects/uplift/index.js b/projects/uplift/index.js index fde496c40c2..9aad9687ef7 100644 --- a/projects/uplift/index.js +++ b/projects/uplift/index.js @@ -1,12 +1,11 @@ const sdk = require("@defillama/sdk"); -const { transformBscAddress } = require("../helper/portedTokens"); const LIFT_TOKEN_CONTRACT = "0x513C3200F227ebB62e3B3d00B7a83779643a71CF"; const LIFT_STAKING_CONTRACT = "0x49C5b5f3aba18A4bCcF57AA1567ac5Bd46e82381"; async function tvl(timestamp, block, chainBlocks) { const balances = {}; - const transform = await transformBscAddress(); + const transform = i => `bsc:${i}`; const collateralBalance = ( await sdk.api.abi.call({ diff --git a/projects/valas/index.js b/projects/valas/index.js index fe3714a89f2..108399f5291 100644 --- a/projects/valas/index.js +++ b/projects/valas/index.js @@ -1,7 +1,6 @@ const { staking } = require("../helper/staking"); const { pool2 } = require("../helper/pool2"); const { aaveChainTvl } = require("../helper/aave"); -const { transformBscAddress } = require("../helper/portedTokens"); const stakingContract = "0x685D3b02b9b0F044A3C01Dbb95408FC2eB15a3b3"; const VALAS = "0xB1EbdD56729940089Ecc3aD0BBEEB12b6842ea6F"; @@ -11,7 +10,7 @@ const VALAS_BNB_pLP = "0x829F540957DFC652c4466a7F34de611E172e64E8"; function lending(borrowed) { return async (timestamp, ethBlock, chainBlocks) => { - const transform = await transformBscAddress(); + const transform = i => `bsc:${i}`; return aaveChainTvl( "bsc", "0x99E41A7F2Dd197187C8637D1D151Dc396261Bc14", diff --git a/projects/veritable.js b/projects/veritable.js index 950bf35b87f..ee30669d1aa 100644 --- a/projects/veritable.js +++ b/projects/veritable.js @@ -1,5 +1,4 @@ const { addFundsInMasterChef } = require("./helper/masterchef") -const { transformPolygonAddress } = require("./helper/portedTokens"); const token = "0x6397835430a5a5f8530F30C412CB217CE3f0943b"; const masterchef = "0xE139E30D5C375C59140DFB6FD3bdC91B9406201c"; @@ -7,7 +6,7 @@ const abi = 'function poolInfo(uint256) view returns (address lpToken, uint256 a async function tvl(timestamp, blokc, chainBlocks) { const balances = {}; - const transform = await transformPolygonAddress(); + const transform = i => `polygon:${i}`; await addFundsInMasterChef( balances, diff --git a/projects/waterfallfinance/index.js b/projects/waterfallfinance/index.js index 9fba4027697..e0babe9fa2a 100644 --- a/projects/waterfallfinance/index.js +++ b/projects/waterfallfinance/index.js @@ -1,7 +1,6 @@ const abi = require("../helper/abis/masterchef.json") -const { transformFantomAddress } = require("../helper/portedTokens"); const { addFundsInMasterChef } = require("../helper/masterchef"); -const { staking, stakingPricedLP } = require("../helper/staking"); +const { stakingPricedLP } = require("../helper/staking"); const { pool2Exports } = require('../helper/pool2') @@ -12,7 +11,7 @@ const waterfallUsdcLP = "0x7080f230f42b3b76828ba6392b50433edc0909fa"; async function tvl(timestamp, block, chainBlocks) { const balances = {} - const transformAddress = await transformFantomAddress(); + const transformAddress = i => `fantom:${i}`; await addFundsInMasterChef(balances, chef, chainBlocks.fantom, "fantom", transformAddress, abi.poolInfo, [waterfall, waterfallFtmLP, waterfallUsdcLP]); return balances; } diff --git a/projects/xmaspast/index.js b/projects/xmaspast/index.js index 743a012251e..d03ea1b26ca 100644 --- a/projects/xmaspast/index.js +++ b/projects/xmaspast/index.js @@ -1,5 +1,4 @@ const abi = require("../helper/abis/masterchef.json") -const { transformFantomAddress } = require("../helper/portedTokens"); const { addFundsInMasterChef } = require("../helper/masterchef"); const { staking, stakingPricedLP } = require("../helper/staking"); const { pool2Exports } = require('../helper/pool2') @@ -12,7 +11,7 @@ const xpastUsdcLP = "0x73B019D2B6fD28D85eeAD4E85909d69Cc0472D5F"; async function tvl(timestamp, block, chainBlocks) { const balances = {} - const transformAddress = await transformFantomAddress(); + const transformAddress = i => `fantom:${i}`; await addFundsInMasterChef(balances, chef, chainBlocks.fantom, "fantom", transformAddress, abi.poolInfo, [xpast, xpastFtmLP, xpastUsdcLP]); return balances; } diff --git a/projects/yslio/index.js b/projects/yslio/index.js index 0f79c49617e..089a920e2b1 100644 --- a/projects/yslio/index.js +++ b/projects/yslio/index.js @@ -1,7 +1,6 @@ const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); -const { transformBscAddress } = require("../helper/portedTokens"); const masterChefContract = "0xEE7Bc7727436D839634845766f567fa354ba8C56"; @@ -68,7 +67,7 @@ const bscTvl = async (chainBlocks) => { sdk.util.sumSingleBalance(balances, `bsc:${lpToken}`, strat_bal); } } - const transformAddress = await transformBscAddress(); + const transformAddress = i => `bsc:${i}`; await unwrapUniswapLPs( balances, lpPositions, From 42fcdc93793b2ea8e687522dbd6fe2e55d55fa33 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 22 Aug 2023 17:14:08 +0200 Subject: [PATCH 0921/1974] fix cake monster --- projects/cake-monster/index.js | 34 ++-------------------------------- 1 file changed, 2 insertions(+), 32 deletions(-) diff --git a/projects/cake-monster/index.js b/projects/cake-monster/index.js index 22ecfa780ee..891e9024d6d 100644 --- a/projects/cake-monster/index.js +++ b/projects/cake-monster/index.js @@ -1,43 +1,13 @@ -const sdk = require("@defillama/sdk"); -const BigNumber = require("bignumber.js"); +const { staking } = require('../helper/staking') const CM_TOKEN_CONTRACT = "0x8A5d7FCD4c90421d21d30fCC4435948aC3618B2f"; const CM_STAKING_CONTRACT = "0xF7CDDF60CD076d4d64c613489aA00dCCf1E518F6"; -async function staking(timestamp, block, chainBlocks) { - const balances = {}; - const transform = i => `bsc:${i}`; - - const stakingBalance = ( - await sdk.api.abi.call({ - abi: "erc20:balanceOf", - chain: "bsc", - target: CM_TOKEN_CONTRACT, - params: [CM_STAKING_CONTRACT], - block: chainBlocks["bsc"], - }) - ).output; - - let stakingBalanceCorrected = new BigNumber(stakingBalance) - .minus(new BigNumber(1000000000).times(10 ** 18)) - .toFixed(); - - sdk.util.sumSingleBalance( - balances, - transform(CM_TOKEN_CONTRACT), - stakingBalanceCorrected - ); - - return balances; -} - module.exports = { - timetravel: true, - misrepresentedTokens: false, methodology: "counts the number of $MONSTA tokens in the Cake Monster Staking contract, excluding the amount reserved for the staking rewards.", start: 15765654, bsc: { tvl: () => ({}), - staking, + staking: staking(CM_STAKING_CONTRACT, CM_TOKEN_CONTRACT), }, }; From dca661a3648c3bf986fccd328532785fe935bbd5 Mon Sep 17 00:00:00 2001 From: CuanSwap <126179832+cuanswap@users.noreply.github.com> Date: Tue, 22 Aug 2023 22:16:55 +0700 Subject: [PATCH 0922/1974] Create index.js (#7251) * Create index.js * minor fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/cuanswap/index.js | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 projects/cuanswap/index.js diff --git a/projects/cuanswap/index.js b/projects/cuanswap/index.js new file mode 100644 index 00000000000..d6e1a4e6cf5 --- /dev/null +++ b/projects/cuanswap/index.js @@ -0,0 +1,11 @@ +const { getUniTVL, } = require('../helper/unknownTokens') + +module.exports = { + misrepresentedTokens: true, + core: { + tvl: getUniTVL({ factory: '0x23556027Ad3C3e76160AcA51e8098C395a6d815C', useDefaultCoreAssets: true, fetchBalances: true, }), + }, + op_bnb: { + tvl: getUniTVL({ factory: '0x43cC4516B1b549a47B493D06Fc28f6C58BC4e888', useDefaultCoreAssets: true, fetchBalances: true, }) + }, +}; From aab583987d235744c425d3f4b2a863cf37e7b4d9 Mon Sep 17 00:00:00 2001 From: Andrey Borzenkov <99496217+armoking32@users.noreply.github.com> Date: Tue, 22 Aug 2023 19:18:47 +0400 Subject: [PATCH 0923/1974] polygon_zkevm chain for MellowProtocol (#7242) --- projects/MellowProtocol/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/projects/MellowProtocol/index.js b/projects/MellowProtocol/index.js index fced703a119..f4b1007c85e 100644 --- a/projects/MellowProtocol/index.js +++ b/projects/MellowProtocol/index.js @@ -9,6 +9,10 @@ const config = { polygon: { registry: '0xd3d0e85f225348a2006270daf624d8c46cae4e1f', fromBlock: 31243728, + }, + polygon_zkevm: { + registry: '0xc02a7B4658861108f9837007b2DF2007d6977116', + fromBlock: 2665891, } } From 3fd87374fec4b4d9bf353875d573d0a2693ad7b2 Mon Sep 17 00:00:00 2001 From: Zyberswap-Arbitrum <121235717+Zyberswap-Arbitrum@users.noreply.github.com> Date: Tue, 22 Aug 2023 17:19:46 +0200 Subject: [PATCH 0924/1974] feat: add synthswap perps (#7239) --- projects/synthswap-perps/index.js | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 projects/synthswap-perps/index.js diff --git a/projects/synthswap-perps/index.js b/projects/synthswap-perps/index.js new file mode 100644 index 00000000000..bbbc13fcfca --- /dev/null +++ b/projects/synthswap-perps/index.js @@ -0,0 +1,7 @@ +const { gmxExports } = require('../helper/gmx') + +module.exports = { + base:{ + tvl: gmxExports({ vault: '0xB70cf5E6eCd1733448912A9f251D35A17aF94fF6', }) + } +}; \ No newline at end of file From 65ec370cbeeeb51eca2c202f9336bbc3a14a20d9 Mon Sep 17 00:00:00 2001 From: vooi-io <139384141+vooi-io@users.noreply.github.com> Date: Tue, 22 Aug 2023 16:44:29 +0100 Subject: [PATCH 0925/1974] vooi initial adds linea pool (#7243) --- projects/helper/coreAssets.json | 3 ++- projects/vooi/config.js | 16 ++++++++++++++++ projects/vooi/index.js | 13 +++++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 projects/vooi/config.js create mode 100644 projects/vooi/index.js diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index 9e115258ae6..4edb5a57907 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -1345,7 +1345,8 @@ "linea": { "WETH": "0xe5D7C2a44FfDDf6b295A15c148167daaAf5Cf34f", "USDC": "0x176211869cA2b568f2A7D4EE941E073a821EE1ff", - "USDT": "0xA219439258ca9da29E9Cc4cE5596924745e12B93" + "USDT": "0xA219439258ca9da29E9Cc4cE5596924745e12B93", + "DAI": "0x4AF15ec2A0BD43Db75dd04E62FAA3B8EF36b00d5" }, "base": { "WETH": "0x4200000000000000000000000000000000000006", diff --git a/projects/vooi/config.js b/projects/vooi/config.js new file mode 100644 index 00000000000..b6202af87ea --- /dev/null +++ b/projects/vooi/config.js @@ -0,0 +1,16 @@ +const ADDRESSES = require('../helper/coreAssets.json') +module.exports = { + chains: [ + { + name: 'linea', + tokens: [ + ADDRESSES.linea.USDT, + ADDRESSES.linea.USDC, + ADDRESSES.linea.DAI, + ], + holders: [ + '0xBc7f67fA9C72f9fcCf917cBCEe2a50dEb031462A', + ] + } + ] +} \ No newline at end of file diff --git a/projects/vooi/index.js b/projects/vooi/index.js new file mode 100644 index 00000000000..ad67742e601 --- /dev/null +++ b/projects/vooi/index.js @@ -0,0 +1,13 @@ +const config = require("./config"); +const { sumTokensExport } = require('../helper/unwrapLPs') + +module.exports = { + methodology: 'Counts the amount of assets locked in VOOI pools', +}; + +config.chains.forEach(chainInfo => { + const {name: chain, tokens, holders} = chainInfo + module.exports[chain] = { + tvl: sumTokensExport({ chain, tokens, owners: holders }) + } +}) From 2f4ac801472493446d7907ec6ed23e45160ad2c1 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Tue, 22 Aug 2023 16:44:50 +0100 Subject: [PATCH 0926/1974] add univ2 tokens --- projects/treasury/maker.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/treasury/maker.js b/projects/treasury/maker.js index 8cd820c29c8..4439f4b7dda 100644 --- a/projects/treasury/maker.js +++ b/projects/treasury/maker.js @@ -6,6 +6,7 @@ const { const ADDRESSES = require('../helper/coreAssets.json') const treasury = "0xBE8E3e3618f7474F8cB1d074A26afFef007E98FB"; +const daiMKRLP = "0x517F9dD285e75b599234F7221227339478d0FcC8"; const MKR = ADDRESSES.ethereum.MKR; const DAI = ADDRESSES.ethereum.DAI @@ -33,7 +34,7 @@ module.exports = { ethereum: { tvl, ownTokens: sumTokensExport({ - tokens: [MKR], + tokens: [MKR,daiMKRLP], owners: [treasury], }), }, From 819bd57c100cadb71ee0c33937da63bad1cbce0f Mon Sep 17 00:00:00 2001 From: Vojtch Date: Tue, 22 Aug 2023 18:29:42 +0200 Subject: [PATCH 0927/1974] Update: PWN (#7241) * update pwn * minor fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/helper/http.js | 4 ++-- projects/helper/unwrapLPs.js | 2 +- projects/pwn/index.js | 25 +++++++++++++++++++++++-- 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/projects/helper/http.js b/projects/helper/http.js index 772b3ce92c7..3a8f84f7597 100644 --- a/projects/helper/http.js +++ b/projects/helper/http.js @@ -52,8 +52,8 @@ async function graphQuery(endpoint, graphQuery, params = {}, { timestamp, chain, return request(endpoint, graphQuery, params) } -async function covalentGetTokens(address, chain = 'ethereum') { - let chainId = chainIds[chain] +async function covalentGetTokens(address, chain = 'ethereum', chainId) { + chainId = chainId ?? chainIds[chain] if (!chainId) throw new Error('Missing chain to chain id mapping:' + chain) if (!address) throw new Error('Missing adddress') diff --git a/projects/helper/unwrapLPs.js b/projects/helper/unwrapLPs.js index 84caf17f429..be0d3e197da 100644 --- a/projects/helper/unwrapLPs.js +++ b/projects/helper/unwrapLPs.js @@ -695,7 +695,7 @@ async function sumTokens2({ if (fetchCoValentTokens) { if (!api) throw new Error('Missing arg: api') if (!owners || !owners.length) owners = [owner] - const cTokens = (await Promise.all(owners.map(i => covalentGetTokens(i, api.chain)))).flat() + const cTokens = (await Promise.all(owners.map(i => covalentGetTokens(i, api.chain, api.chainId)))).flat() tokens = [...cTokens, ...tokens] } diff --git a/projects/pwn/index.js b/projects/pwn/index.js index fccdba65dba..9406d8b8a43 100644 --- a/projects/pwn/index.js +++ b/projects/pwn/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokensExport } = require("../helper/unwrapLPs"); const PWN_ALPHA_MAINNET = "0x45DB28b2d4878Ad124c037d4558AcF5Db3bBa6A5"; @@ -5,7 +6,11 @@ const PWN_BETA_MAINNET = "0xb98eFE56deCCeb1BeC9fAEeAF62500deb0953474"; const PWN_BETA_POLYGON = "0xaF0d978275a2e7e3109F8C6307Ffd281774C623E"; const PWN_BUNDLER_MAINNET = "0x19e3293196aee99BB3080f28B9D3b4ea7F232b8d"; const PWN_BUNDLER_POLYGON = "0xe52405604bF644349f57b36Ca6E85cf095faB8dA"; +const PWN_BUNDLER_CRONOS = "0x973E09e96E64E4bf17e383a8A497Fb566284c707"; +const PWN_BUNDLER_BASE = "0x6fD3f5439aB1C103599385929d5f4c19acdBd264"; const PWN_V1_SIMPLE_LOAN = "0x50160ff9c19fbE2B5643449e1A321cAc15af2b2C"; +const PWN_V1_1_SIMPLE_LOAN_A = "0x57c88D78f6D08b5c88b4A3b7BbB0C1AA34c3280A"; // Polygon and Mainnet +const PWN_V1_1_SIMPLE_LOAN_B = "0x4188C513fd94B0458715287570c832d9560bc08a"; // Cronos and Base module.exports = { misrepresentedTokens: true, @@ -17,17 +22,33 @@ module.exports = { PWN_BETA_MAINNET, PWN_BUNDLER_MAINNET, PWN_V1_SIMPLE_LOAN, + PWN_V1_1_SIMPLE_LOAN_A, ], resolveNFTs: true, resolveArtBlocks: true, }), }, - // resolveNFTs: true is currently unsupported on Polygon + // resolveNFTs: true is currently unsupported on Polygon, Cronos and Base // https://discord.com/channels/823822164956151810/823885412425793587/1139362819012304956 polygon: { tvl: sumTokensExport({ - owners: [PWN_BETA_POLYGON, PWN_BUNDLER_POLYGON, PWN_V1_SIMPLE_LOAN], + owners: [ + PWN_BETA_POLYGON, + PWN_BUNDLER_POLYGON, + PWN_V1_SIMPLE_LOAN, + PWN_V1_1_SIMPLE_LOAN_A, + ], fetchCoValentTokens: true, }), }, + cronos: { + tvl: sumTokensExport({ + owners: [PWN_BUNDLER_CRONOS, PWN_V1_1_SIMPLE_LOAN_B], fetchCoValentTokens: true, + }), + }, + base: { + tvl: sumTokensExport({ + owners: [PWN_BUNDLER_BASE, PWN_V1_1_SIMPLE_LOAN_B], fetchCoValentTokens: true, + }), + }, }; From 1d19ee41d2f71e1be37e24ee2d28b30b346679e2 Mon Sep 17 00:00:00 2001 From: croissantgames <97343931+croissantgames@users.noreply.github.com> Date: Tue, 22 Aug 2023 22:33:27 +0530 Subject: [PATCH 0928/1974] fix: logs (#7253) Co-authored-by: croissant --- projects/bagelswap/index.js | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 projects/bagelswap/index.js diff --git a/projects/bagelswap/index.js b/projects/bagelswap/index.js new file mode 100644 index 00000000000..d4dffc81fdf --- /dev/null +++ b/projects/bagelswap/index.js @@ -0,0 +1,8 @@ +const { uniV3Export } = require("../helper/uniswapV3"); + +module.exports = uniV3Export({ + base: { + factory: "0xFAa5F5F4a3c6ed4446F7B6014322C954d218690C", + fromBlock: 2523289, + }, +}); From 9dc889fcb3c7f195bfa553f63b6ddf36eb55c003 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Tue, 22 Aug 2023 18:23:45 +0100 Subject: [PATCH 0929/1974] add base to aave v3 --- projects/aave/v3.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/projects/aave/v3.js b/projects/aave/v3.js index ec94b29bcd0..5261e5e4701 100644 --- a/projects/aave/v3.js +++ b/projects/aave/v3.js @@ -8,6 +8,8 @@ function v3(chain) { params = ['0xbaA999AC55EAce41CcAE355c77809e68Bb345170', undefined, ['0x7B4EB56E7CD4b454BA8ff71E4518426369a138a3']] else if (chain === 'metis') params = ['0x9E7B73ffD9D2026F3ff4212c29E209E09C8A91F5', undefined, ['0x99411FC17Ad1B56f49719E3850B2CDcc0f9bBFd8']] + else if (chain === 'base') + params = ['0x2f6571d3Eb9a4e350C68C36bCD2afe39530078E2', undefined, ['0x2d8A3C5677189723C4cB8873CfC9C8976FDF38Ac']] const section = borrowed => aaveChainTvl(chain, ...params, borrowed, true); return { tvl: section(false), @@ -18,7 +20,7 @@ function v3(chain) { module.exports = { methodology: `Counts the tokens locked in the contracts to be used as collateral to borrow or to earn yield. Borrowed coins are not counted towards the TVL, so only the coins actually locked in the contracts are counted. There's multiple reasons behind this but one of the main ones is to avoid inflating the TVL through cycled lending`, avax: v3("avax"), - ...["optimism", "fantom", "harmony", "arbitrum", "polygon", "ethereum", "metis"].reduce((t, c) => ({ ...t, [c]: v3(c) }), {}), + ...["optimism", "fantom", "harmony", "arbitrum", "polygon", "ethereum", "metis", "base"].reduce((t, c) => ({ ...t, [c]: v3(c) }), {}), hallmarks: [ [1659630089, "Start OP Rewards"], [1650471689, "Start AVAX Rewards"] From d9bc7b09b05c6721f89c7a3bfa67ac1d9742603a Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Tue, 22 Aug 2023 18:53:53 +0100 Subject: [PATCH 0930/1974] add more treasury addresses --- projects/helper/tokenMapping.js | 4 ++++ projects/treasury/paladin-finance.js | 20 +++++++++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 0ad33027ac8..524b2ac59fd 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -32,6 +32,7 @@ const transformTokens = { '0xe0b469cb3eda0ece9e425cfeda4df986a55ea9f8': ADDRESSES.ethereum.WETH, [ADDRESSES.ethereum.vlCVX]: ADDRESSES.ethereum.CVX, }, + // Sample Code // cronos: { // "0x065de42e28e42d90c2052a1b49e7f83806af0e1f": "0x123", // CRK token is mispriced @@ -55,6 +56,9 @@ const fixBalancesTokens = { aura: { 'uaura': { coingeckoId: 'aura-network', decimals: 6 }, }, + arbitrum: { + '0x1509706a6c66CA549ff0cB464de88231DDBe213B': { coingeckoId: 'aura-finance', decimals: 18 } + }, } ibcChains.forEach(chain => fixBalancesTokens[chain] = { ...ibcMappings, ...(fixBalancesTokens[chain] || {}) }) diff --git a/projects/treasury/paladin-finance.js b/projects/treasury/paladin-finance.js index 7663eb1611a..b2c1cf2cee4 100644 --- a/projects/treasury/paladin-finance.js +++ b/projects/treasury/paladin-finance.js @@ -3,6 +3,8 @@ const { nullAddress, treasuryExports } = require("../helper/treasury"); const treasury = "0xb95A4779CceDc53010EF0df8Bf8Ed6aEB0E8c2B2"; const treasury1 = "0x1Ae6DCBc88d6f81A7BCFcCC7198397D776F3592E"; +const treasury2 = "0x0482a2d6e2f895125b7237de70c675cd55fe17ca"; +const treasuryarb = "0x8E4aD455225Dae1A78AB375FCb9eD9d94A4BE859" const treasurypolygon = "0x6F09B0Cc885f176B06311bD085055A9275957248" const PAL = "0xab846fb6c81370327e784ae7cbb6d6a6af6ff4bf"; @@ -24,11 +26,27 @@ module.exports = treasuryExports({ '0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490',//3CRV '0x4104b135DBC9609Fc1A9490E61369036497660c8',//APY ADDRESSES.ethereum.LIDO, + '0xC0c293ce456fF0ED870ADd98a0828Dd4d2903DBF',//AURA + '0xCdF7028ceAB81fA0C6971208e83fa7872994beE5',//T + '0x30D20208d987713f46DFD34EF128Bb16C404D10f',//SD + '0x875773784Af8135eA0ef43b5a374AaD105c5D39e',//IDLE + '0x15f74458aE0bFdAA1a96CA1aa779D715Cc1Eefe4',//GRAI + '0xBa3335588D9403515223F109EdC4eB7269a9Ab5D',//GEAR ], - owners: [treasury, treasury1, ], + owners: [treasury, treasury1, treasury2], ownTokens: [PAL], }, + arbitrum: { + tokens: [ + nullAddress, + '0x1509706a6c66CA549ff0cB464de88231DDBe213B',//AURA + '0x040d1EdC9569d4Bab2D15287Dc5A4F10F56a56B8',//BAL + '0xf0cb2dc0db5e6c66B9a70Ac27B06b878da017028',//OHM + '0x912CE59144191C1204E64559FE8253a0e49E6548',//ARB + ], + owners: [treasuryarb] + } // polygon: { // tokens: [ // nullAddress, From b42107bed2225e544581ed9545d7e2301037852a Mon Sep 17 00:00:00 2001 From: JasonMohanCryptobuild Date: Wed, 23 Aug 2023 00:58:56 +0700 Subject: [PATCH 0931/1974] update TVL for PySwap Exchange --- package-lock.json | 4439 +------------------------------------- projects/pyswap/index.js | 19 + 2 files changed, 47 insertions(+), 4411 deletions(-) create mode 100644 projects/pyswap/index.js diff --git a/package-lock.json b/package-lock.json index 5153cb6bb19..316218460e7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,4180 +1,8 @@ { "name": "defillama-adapters", "version": "1.0.0", - "lockfileVersion": 2, + "lockfileVersion": 1, "requires": true, - "packages": { - "": { - "name": "defillama-adapters", - "version": "1.0.0", - "hasInstallScript": true, - "license": "ISC", - "dependencies": { - "@defillama/sdk": "latest", - "@project-serum/anchor": "^0.25.0", - "@solana/web3.js": "^1.36.0", - "@solendprotocol/solend-sdk": "^0.6.2", - "@supercharge/promise-pool": "^2.1.0", - "aws-sdk": "^2.1268.0", - "axios": "^0.27.2", - "bignumber.js": "^9.0.1", - "blakejs": "^1.2.1", - "bn.js": "^5.2.1", - "borsh": "^0.7.0", - "dotenv": "^8.6.0", - "ethers": "^5.6.5", - "graphql": "^16.6.0", - "graphql-request": "^4.0.0", - "hi-base32": "^0.5.1", - "js-sha512": "^0.8.0", - "limiter": "2.1.0", - "starknet": "^4.17.1", - "tron-format-address": "^0.1.8", - "typescript": "^4.7.4" - }, - "devDependencies": { - "@types/async-retry": "^1.4.5", - "@types/bn.js": "^5.1.0", - "eslint": "^8.32.0", - "ts-node": "^10.8.1" - } - }, - "node_modules/@babel/runtime": { - "version": "7.20.7", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.20.7.tgz", - "integrity": "sha512-UF0tvkUtxwAgZ5W/KrkHf0Rn0fdnLDU9ScxBrEVNUprE/MzirjK4MJUX1/BVDv00Sv8cljtukVK1aky++X1SjQ==", - "dependencies": { - "regenerator-runtime": "^0.13.11" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@cspotcode/source-map-support": { - "version": "0.8.1", - "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", - "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", - "dev": true, - "dependencies": { - "@jridgewell/trace-mapping": "0.3.9" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/@defillama/sdk": { - "version": "4.0.46", - "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.46.tgz", - "integrity": "sha512-CC3dnZg9xYQP5gyx5CeKI0YF1877SH7pEwVn1hHguMJbOUJQERmbXSCI6yDDBUBoBB/Ai8o8yhdPgrFRT8Wt4A==", - "dependencies": { - "@supercharge/promise-pool": "^2.1.0", - "ethers": "^5.4.5", - "node-fetch": "^2.6.7", - "tron-format-address": "^0.1.11" - } - }, - "node_modules/@eslint/eslintrc": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.4.1.tgz", - "integrity": "sha512-XXrH9Uarn0stsyldqDYq8r++mROmWRI1xKMXa640Bb//SY1+ECYX6VzT6Lcx5frD0V30XieqJ0oX9I2Xj5aoMA==", - "dev": true, - "dependencies": { - "ajv": "^6.12.4", - "debug": "^4.3.2", - "espree": "^9.4.0", - "globals": "^13.19.0", - "ignore": "^5.2.0", - "import-fresh": "^3.2.1", - "js-yaml": "^4.1.0", - "minimatch": "^3.1.2", - "strip-json-comments": "^3.1.1" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/@ethersproject/abi": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/abi/-/abi-5.7.0.tgz", - "integrity": "sha512-351ktp42TiRcYB3H1OP8yajPeAQstMW/yCFokj/AthP9bLHzQFPlOrxOcwYEDkUAICmOHljvN4K39OMTMUa9RA==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/address": "^5.7.0", - "@ethersproject/bignumber": "^5.7.0", - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/constants": "^5.7.0", - "@ethersproject/hash": "^5.7.0", - "@ethersproject/keccak256": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/properties": "^5.7.0", - "@ethersproject/strings": "^5.7.0" - } - }, - "node_modules/@ethersproject/abstract-provider": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/abstract-provider/-/abstract-provider-5.7.0.tgz", - "integrity": "sha512-R41c9UkchKCpAqStMYUpdunjo3pkEvZC3FAwZn5S5MGbXoMQOHIdHItezTETxAO5bevtMApSyEhn9+CHcDsWBw==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/bignumber": "^5.7.0", - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/networks": "^5.7.0", - "@ethersproject/properties": "^5.7.0", - "@ethersproject/transactions": "^5.7.0", - "@ethersproject/web": "^5.7.0" - } - }, - "node_modules/@ethersproject/abstract-signer": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/abstract-signer/-/abstract-signer-5.7.0.tgz", - "integrity": "sha512-a16V8bq1/Cz+TGCkE2OPMTOUDLS3grCpdjoJCYNnVBbdYEMSgKrU0+B90s8b6H+ByYTBZN7a3g76jdIJi7UfKQ==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/abstract-provider": "^5.7.0", - "@ethersproject/bignumber": "^5.7.0", - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/properties": "^5.7.0" - } - }, - "node_modules/@ethersproject/address": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/address/-/address-5.7.0.tgz", - "integrity": "sha512-9wYhYt7aghVGo758POM5nqcOMaE168Q6aRLJZwUmiqSrAungkG74gSSeKEIR7ukixesdRZGPgVqme6vmxs1fkA==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/bignumber": "^5.7.0", - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/keccak256": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/rlp": "^5.7.0" - } - }, - "node_modules/@ethersproject/base64": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/base64/-/base64-5.7.0.tgz", - "integrity": "sha512-Dr8tcHt2mEbsZr/mwTPIQAf3Ai0Bks/7gTw9dSqk1mQvhW3XvRlmDJr/4n+wg1JmCl16NZue17CDh8xb/vZ0sQ==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/bytes": "^5.7.0" - } - }, - "node_modules/@ethersproject/basex": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/basex/-/basex-5.7.0.tgz", - "integrity": "sha512-ywlh43GwZLv2Voc2gQVTKBoVQ1mti3d8HK5aMxsfu/nRDnMmNqaSJ3r3n85HBByT8OpoY96SXM1FogC533T4zw==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/properties": "^5.7.0" - } - }, - "node_modules/@ethersproject/bignumber": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/bignumber/-/bignumber-5.7.0.tgz", - "integrity": "sha512-n1CAdIHRWjSucQO3MC1zPSVgV/6dy/fjL9pMrPP9peL+QxEg9wOsVqwD4+818B6LUEtaXzVHQiuivzRoxPxUGw==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "bn.js": "^5.2.1" - } - }, - "node_modules/@ethersproject/bytes": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/bytes/-/bytes-5.7.0.tgz", - "integrity": "sha512-nsbxwgFXWh9NyYWo+U8atvmMsSdKJprTcICAkvbBffT75qDocbuggBU0SJiVK2MuTrp0q+xvLkTnGMPK1+uA9A==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/logger": "^5.7.0" - } - }, - "node_modules/@ethersproject/constants": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/constants/-/constants-5.7.0.tgz", - "integrity": "sha512-DHI+y5dBNvkpYUMiRQyxRBYBefZkJfo70VUkUAsRjcPs47muV9evftfZ0PJVCXYbAiCgght0DtcF9srFQmIgWA==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/bignumber": "^5.7.0" - } - }, - "node_modules/@ethersproject/contracts": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/contracts/-/contracts-5.7.0.tgz", - "integrity": "sha512-5GJbzEU3X+d33CdfPhcyS+z8MzsTrBGk/sc+G+59+tPa9yFkl6HQ9D6L0QMgNTA9q8dT0XKxxkyp883XsQvbbg==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/abi": "^5.7.0", - "@ethersproject/abstract-provider": "^5.7.0", - "@ethersproject/abstract-signer": "^5.7.0", - "@ethersproject/address": "^5.7.0", - "@ethersproject/bignumber": "^5.7.0", - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/constants": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/properties": "^5.7.0", - "@ethersproject/transactions": "^5.7.0" - } - }, - "node_modules/@ethersproject/hash": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/hash/-/hash-5.7.0.tgz", - "integrity": "sha512-qX5WrQfnah1EFnO5zJv1v46a8HW0+E5xuBBDTwMFZLuVTx0tbU2kkx15NqdjxecrLGatQN9FGQKpb1FKdHCt+g==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/abstract-signer": "^5.7.0", - "@ethersproject/address": "^5.7.0", - "@ethersproject/base64": "^5.7.0", - "@ethersproject/bignumber": "^5.7.0", - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/keccak256": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/properties": "^5.7.0", - "@ethersproject/strings": "^5.7.0" - } - }, - "node_modules/@ethersproject/hdnode": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/hdnode/-/hdnode-5.7.0.tgz", - "integrity": "sha512-OmyYo9EENBPPf4ERhR7oj6uAtUAhYGqOnIS+jE5pTXvdKBS99ikzq1E7Iv0ZQZ5V36Lqx1qZLeak0Ra16qpeOg==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/abstract-signer": "^5.7.0", - "@ethersproject/basex": "^5.7.0", - "@ethersproject/bignumber": "^5.7.0", - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/pbkdf2": "^5.7.0", - "@ethersproject/properties": "^5.7.0", - "@ethersproject/sha2": "^5.7.0", - "@ethersproject/signing-key": "^5.7.0", - "@ethersproject/strings": "^5.7.0", - "@ethersproject/transactions": "^5.7.0", - "@ethersproject/wordlists": "^5.7.0" - } - }, - "node_modules/@ethersproject/json-wallets": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/json-wallets/-/json-wallets-5.7.0.tgz", - "integrity": "sha512-8oee5Xgu6+RKgJTkvEMl2wDgSPSAQ9MB/3JYjFV9jlKvcYHUXZC+cQp0njgmxdHkYWn8s6/IqIZYm0YWCjO/0g==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/abstract-signer": "^5.7.0", - "@ethersproject/address": "^5.7.0", - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/hdnode": "^5.7.0", - "@ethersproject/keccak256": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/pbkdf2": "^5.7.0", - "@ethersproject/properties": "^5.7.0", - "@ethersproject/random": "^5.7.0", - "@ethersproject/strings": "^5.7.0", - "@ethersproject/transactions": "^5.7.0", - "aes-js": "3.0.0", - "scrypt-js": "3.0.1" - } - }, - "node_modules/@ethersproject/keccak256": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/keccak256/-/keccak256-5.7.0.tgz", - "integrity": "sha512-2UcPboeL/iW+pSg6vZ6ydF8tCnv3Iu/8tUmLLzWWGzxWKFFqOBQFLo6uLUv6BDrLgCDfN28RJ/wtByx+jZ4KBg==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/bytes": "^5.7.0", - "js-sha3": "0.8.0" - } - }, - "node_modules/@ethersproject/logger": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/logger/-/logger-5.7.0.tgz", - "integrity": "sha512-0odtFdXu/XHtjQXJYA3u9G0G8btm0ND5Cu8M7i5vhEcE8/HmF4Lbdqanwyv4uQTr2tx6b7fQRmgLrsnpQlmnig==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ] - }, - "node_modules/@ethersproject/networks": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/@ethersproject/networks/-/networks-5.7.1.tgz", - "integrity": "sha512-n/MufjFYv3yFcUyfhnXotyDlNdFb7onmkSy8aQERi2PjNcnWQ66xXxa3XlS8nCcA8aJKJjIIMNJTC7tu80GwpQ==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/logger": "^5.7.0" - } - }, - "node_modules/@ethersproject/pbkdf2": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/pbkdf2/-/pbkdf2-5.7.0.tgz", - "integrity": "sha512-oR/dBRZR6GTyaofd86DehG72hY6NpAjhabkhxgr3X2FpJtJuodEl2auADWBZfhDHgVCbu3/H/Ocq2uC6dpNjjw==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/sha2": "^5.7.0" - } - }, - "node_modules/@ethersproject/properties": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/properties/-/properties-5.7.0.tgz", - "integrity": "sha512-J87jy8suntrAkIZtecpxEPxY//szqr1mlBaYlQ0r4RCaiD2hjheqF9s1LVE8vVuJCXisjIP+JgtK/Do54ej4Sw==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/logger": "^5.7.0" - } - }, - "node_modules/@ethersproject/providers": { - "version": "5.7.2", - "resolved": "https://registry.npmjs.org/@ethersproject/providers/-/providers-5.7.2.tgz", - "integrity": "sha512-g34EWZ1WWAVgr4aptGlVBF8mhl3VWjv+8hoAnzStu8Ah22VHBsuGzP17eb6xDVRzw895G4W7vvx60lFFur/1Rg==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/abstract-provider": "^5.7.0", - "@ethersproject/abstract-signer": "^5.7.0", - "@ethersproject/address": "^5.7.0", - "@ethersproject/base64": "^5.7.0", - "@ethersproject/basex": "^5.7.0", - "@ethersproject/bignumber": "^5.7.0", - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/constants": "^5.7.0", - "@ethersproject/hash": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/networks": "^5.7.0", - "@ethersproject/properties": "^5.7.0", - "@ethersproject/random": "^5.7.0", - "@ethersproject/rlp": "^5.7.0", - "@ethersproject/sha2": "^5.7.0", - "@ethersproject/strings": "^5.7.0", - "@ethersproject/transactions": "^5.7.0", - "@ethersproject/web": "^5.7.0", - "bech32": "1.1.4", - "ws": "7.4.6" - } - }, - "node_modules/@ethersproject/random": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/random/-/random-5.7.0.tgz", - "integrity": "sha512-19WjScqRA8IIeWclFme75VMXSBvi4e6InrUNuaR4s5pTF2qNhcGdCUwdxUVGtDDqC00sDLCO93jPQoDUH4HVmQ==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/logger": "^5.7.0" - } - }, - "node_modules/@ethersproject/rlp": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/rlp/-/rlp-5.7.0.tgz", - "integrity": "sha512-rBxzX2vK8mVF7b0Tol44t5Tb8gomOHkj5guL+HhzQ1yBh/ydjGnpw6at+X6Iw0Kp3OzzzkcKp8N9r0W4kYSs9w==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/logger": "^5.7.0" - } - }, - "node_modules/@ethersproject/sha2": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/sha2/-/sha2-5.7.0.tgz", - "integrity": "sha512-gKlH42riwb3KYp0reLsFTokByAKoJdgFCwI+CCiX/k+Jm2mbNs6oOaCjYQSlI1+XBVejwH2KrmCbMAT/GnRDQw==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "hash.js": "1.1.7" - } - }, - "node_modules/@ethersproject/signing-key": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/signing-key/-/signing-key-5.7.0.tgz", - "integrity": "sha512-MZdy2nL3wO0u7gkB4nA/pEf8lu1TlFswPNmy8AiYkfKTdO6eXBJyUdmHO/ehm/htHw9K/qF8ujnTyUAD+Ry54Q==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/properties": "^5.7.0", - "bn.js": "^5.2.1", - "elliptic": "6.5.4", - "hash.js": "1.1.7" - } - }, - "node_modules/@ethersproject/solidity": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/solidity/-/solidity-5.7.0.tgz", - "integrity": "sha512-HmabMd2Dt/raavyaGukF4XxizWKhKQ24DoLtdNbBmNKUOPqwjsKQSdV9GQtj9CBEea9DlzETlVER1gYeXXBGaA==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/bignumber": "^5.7.0", - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/keccak256": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/sha2": "^5.7.0", - "@ethersproject/strings": "^5.7.0" - } - }, - "node_modules/@ethersproject/strings": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/strings/-/strings-5.7.0.tgz", - "integrity": "sha512-/9nu+lj0YswRNSH0NXYqrh8775XNyEdUQAuf3f+SmOrnVewcJ5SBNAjF7lpgehKi4abvNNXyf+HX86czCdJ8Mg==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/constants": "^5.7.0", - "@ethersproject/logger": "^5.7.0" - } - }, - "node_modules/@ethersproject/transactions": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/transactions/-/transactions-5.7.0.tgz", - "integrity": "sha512-kmcNicCp1lp8qanMTC3RIikGgoJ80ztTyvtsFvCYpSCfkjhD0jZ2LOrnbcuxuToLIUYYf+4XwD1rP+B/erDIhQ==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/address": "^5.7.0", - "@ethersproject/bignumber": "^5.7.0", - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/constants": "^5.7.0", - "@ethersproject/keccak256": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/properties": "^5.7.0", - "@ethersproject/rlp": "^5.7.0", - "@ethersproject/signing-key": "^5.7.0" - } - }, - "node_modules/@ethersproject/units": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/units/-/units-5.7.0.tgz", - "integrity": "sha512-pD3xLMy3SJu9kG5xDGI7+xhTEmGXlEqXU4OfNapmfnxLVY4EMSSRp7j1k7eezutBPH7RBN/7QPnwR7hzNlEFeg==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/bignumber": "^5.7.0", - "@ethersproject/constants": "^5.7.0", - "@ethersproject/logger": "^5.7.0" - } - }, - "node_modules/@ethersproject/wallet": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/wallet/-/wallet-5.7.0.tgz", - "integrity": "sha512-MhmXlJXEJFBFVKrDLB4ZdDzxcBxQ3rLyCkhNqVu3CDYvR97E+8r01UgrI+TI99Le+aYm/in/0vp86guJuM7FCA==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/abstract-provider": "^5.7.0", - "@ethersproject/abstract-signer": "^5.7.0", - "@ethersproject/address": "^5.7.0", - "@ethersproject/bignumber": "^5.7.0", - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/hash": "^5.7.0", - "@ethersproject/hdnode": "^5.7.0", - "@ethersproject/json-wallets": "^5.7.0", - "@ethersproject/keccak256": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/properties": "^5.7.0", - "@ethersproject/random": "^5.7.0", - "@ethersproject/signing-key": "^5.7.0", - "@ethersproject/transactions": "^5.7.0", - "@ethersproject/wordlists": "^5.7.0" - } - }, - "node_modules/@ethersproject/web": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/@ethersproject/web/-/web-5.7.1.tgz", - "integrity": "sha512-Gueu8lSvyjBWL4cYsWsjh6MtMwM0+H4HvqFPZfB6dV8ctbP9zFAO73VG1cMWae0FLPCtz0peKPpZY8/ugJJX2w==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/base64": "^5.7.0", - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/properties": "^5.7.0", - "@ethersproject/strings": "^5.7.0" - } - }, - "node_modules/@ethersproject/wordlists": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/wordlists/-/wordlists-5.7.0.tgz", - "integrity": "sha512-S2TFNJNfHWVHNE6cNDjbVlZ6MgE17MIxMbMg2zv3wn+3XSJGosL1m9ZVv3GXCf/2ymSsQ+hRI5IzoMJTG6aoVA==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/hash": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/properties": "^5.7.0", - "@ethersproject/strings": "^5.7.0" - } - }, - "node_modules/@humanwhocodes/config-array": { - "version": "0.11.8", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.8.tgz", - "integrity": "sha512-UybHIJzJnR5Qc/MsD9Kr+RpO2h+/P1GhOwdiLPXK5TWk5sgTdu88bTD9UP+CKbPPh5Rni1u0GjAdYQLemG8g+g==", - "dev": true, - "dependencies": { - "@humanwhocodes/object-schema": "^1.2.1", - "debug": "^4.1.1", - "minimatch": "^3.0.5" - }, - "engines": { - "node": ">=10.10.0" - } - }, - "node_modules/@humanwhocodes/module-importer": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", - "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", - "dev": true, - "engines": { - "node": ">=12.22" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/nzakas" - } - }, - "node_modules/@humanwhocodes/object-schema": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", - "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", - "dev": true - }, - "node_modules/@jridgewell/resolve-uri": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz", - "integrity": "sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==", - "dev": true, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@jridgewell/sourcemap-codec": { - "version": "1.4.14", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz", - "integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==", - "dev": true - }, - "node_modules/@jridgewell/trace-mapping": { - "version": "0.3.9", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", - "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", - "dev": true, - "dependencies": { - "@jridgewell/resolve-uri": "^3.0.3", - "@jridgewell/sourcemap-codec": "^1.4.10" - } - }, - "node_modules/@marinade.finance/marinade-ts-sdk": { - "version": "3.1.4", - "resolved": "https://registry.npmjs.org/@marinade.finance/marinade-ts-sdk/-/marinade-ts-sdk-3.1.4.tgz", - "integrity": "sha512-gnjgQyBHev9nUROlirazTHved9nUzs3WEHqu50yYceYZucKAXvFltE2YgOywGNTfrLI/MMsWIQLmurwDFdbDnA==", - "dependencies": { - "@project-serum/anchor": "^0.18.2", - "@solana/spl-token": "^0.1.8", - "bignumber.js": "^9.1.0", - "borsh": "^0.6.0", - "bs58": "^5.0.0" - } - }, - "node_modules/@marinade.finance/marinade-ts-sdk/node_modules/@project-serum/anchor": { - "version": "0.18.2", - "resolved": "https://registry.npmjs.org/@project-serum/anchor/-/anchor-0.18.2.tgz", - "integrity": "sha512-uyjiN/3Ipp+4hrZRm/hG18HzGLZyvP790LXrCsGO3IWxSl28YRhiGEpKnZycfMW94R7nxdUoE3wY67V+ZHSQBQ==", - "dependencies": { - "@project-serum/borsh": "^0.2.2", - "@solana/web3.js": "^1.17.0", - "base64-js": "^1.5.1", - "bn.js": "^5.1.2", - "bs58": "^4.0.1", - "buffer-layout": "^1.2.0", - "camelcase": "^5.3.1", - "crypto-hash": "^1.3.0", - "eventemitter3": "^4.0.7", - "find": "^0.3.0", - "js-sha256": "^0.9.0", - "pako": "^2.0.3", - "snake-case": "^3.0.4", - "toml": "^3.0.0" - }, - "engines": { - "node": ">=11" - } - }, - "node_modules/@marinade.finance/marinade-ts-sdk/node_modules/@project-serum/anchor/node_modules/bs58": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/bs58/-/bs58-4.0.1.tgz", - "integrity": "sha512-Ok3Wdf5vOIlBrgCvTq96gBkJw+JUEzdBgyaza5HLtPm7yTHkjRy8+JzNyHF7BHa0bNWOQIp3m5YF0nnFcOIKLw==", - "dependencies": { - "base-x": "^3.0.2" - } - }, - "node_modules/@marinade.finance/marinade-ts-sdk/node_modules/borsh": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/borsh/-/borsh-0.6.0.tgz", - "integrity": "sha512-sl5k89ViqsThXQpYa9XDtz1sBl3l1lI313cFUY1HKr+wvMILnb+58xpkqTNrYbelh99dY7K8usxoCusQmqix9Q==", - "dependencies": { - "bn.js": "^5.2.0", - "bs58": "^4.0.0", - "text-encoding-utf-8": "^1.0.2" - } - }, - "node_modules/@marinade.finance/marinade-ts-sdk/node_modules/borsh/node_modules/bs58": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/bs58/-/bs58-4.0.1.tgz", - "integrity": "sha512-Ok3Wdf5vOIlBrgCvTq96gBkJw+JUEzdBgyaza5HLtPm7yTHkjRy8+JzNyHF7BHa0bNWOQIp3m5YF0nnFcOIKLw==", - "dependencies": { - "base-x": "^3.0.2" - } - }, - "node_modules/@marinade.finance/marinade-ts-sdk/node_modules/bs58": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/bs58/-/bs58-5.0.0.tgz", - "integrity": "sha512-r+ihvQJvahgYT50JD05dyJNKlmmSlMoOGwn1lCcEzanPglg7TxYjioQUYehQ9mAR/+hOSd2jRc/Z2y5UxBymvQ==", - "dependencies": { - "base-x": "^4.0.0" - } - }, - "node_modules/@marinade.finance/marinade-ts-sdk/node_modules/bs58/node_modules/base-x": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/base-x/-/base-x-4.0.0.tgz", - "integrity": "sha512-FuwxlW4H5kh37X/oW59pwTzzTKRzfrrQwhmyspRM7swOEZcHtDZSCt45U6oKgtuFE+WYPblePMVIPR4RZrh/hw==" - }, - "node_modules/@mithraic-labs/psy-american": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/@mithraic-labs/psy-american/-/psy-american-0.2.3.tgz", - "integrity": "sha512-NsDfb9QNuLKNqRnq8rWAoD2Y3ouAEsAPFfwP28SmDVfkugvj03nvQtjotFLlH2TsE31YonG+gauhpeeGKZyyuw==", - "dependencies": { - "@project-serum/anchor": "^0.24.2", - "@project-serum/serum": "^0.13.60", - "@solana/spl-token": "^0.1.8", - "@solana/web3.js": "^1.28.0" - } - }, - "node_modules/@mithraic-labs/psy-american/node_modules/@project-serum/anchor": { - "version": "0.24.2", - "resolved": "https://registry.npmjs.org/@project-serum/anchor/-/anchor-0.24.2.tgz", - "integrity": "sha512-0/718g8/DnEuwAidUwh5wLYphUYXhUbiClkuRNhvNoa+1Y8a4g2tJyxoae+emV+PG/Gikd/QUBNMkIcimiIRTA==", - "dependencies": { - "@project-serum/borsh": "^0.2.5", - "@solana/web3.js": "^1.36.0", - "base64-js": "^1.5.1", - "bn.js": "^5.1.2", - "bs58": "^4.0.1", - "buffer-layout": "^1.2.2", - "camelcase": "^5.3.1", - "cross-fetch": "^3.1.5", - "crypto-hash": "^1.3.0", - "eventemitter3": "^4.0.7", - "js-sha256": "^0.9.0", - "pako": "^2.0.3", - "snake-case": "^3.0.4", - "toml": "^3.0.0" - }, - "engines": { - "node": ">=11" - } - }, - "node_modules/@noble/ed25519": { - "version": "1.7.1", - "resolved": "https://registry.npmjs.org/@noble/ed25519/-/ed25519-1.7.1.tgz", - "integrity": "sha512-Rk4SkJFaXZiznFyC/t77Q0NKS4FL7TLJJsVG2V2oiEq3kJVeTdxysEe/yRWSpnWMe808XRDJ+VFh5pt/FN5plw==", - "funding": [ - { - "type": "individual", - "url": "https://paulmillr.com/funding/" - } - ] - }, - "node_modules/@noble/hashes": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.1.5.tgz", - "integrity": "sha512-LTMZiiLc+V4v1Yi16TD6aX2gmtKszNye0pQgbaLqkvhIqP7nVsSaJsWloGQjJfJ8offaoP5GtX3yY5swbcJxxQ==", - "funding": [ - { - "type": "individual", - "url": "https://paulmillr.com/funding/" - } - ] - }, - "node_modules/@noble/secp256k1": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/@noble/secp256k1/-/secp256k1-1.7.0.tgz", - "integrity": "sha512-kbacwGSsH/CTout0ZnZWxnW1B+jH/7r/WAAKLBtrRJ/+CUH7lgmQzl3GTrQua3SGKWNSDsS6lmjnDpIJ5Dxyaw==", - "funding": [ - { - "type": "individual", - "url": "https://paulmillr.com/funding/" - } - ] - }, - "node_modules/@nodelib/fs.scandir": { - "version": "2.1.5", - "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", - "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", - "dev": true, - "dependencies": { - "@nodelib/fs.stat": "2.0.5", - "run-parallel": "^1.1.9" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/@nodelib/fs.stat": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", - "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", - "dev": true, - "engines": { - "node": ">= 8" - } - }, - "node_modules/@nodelib/fs.walk": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", - "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", - "dev": true, - "dependencies": { - "@nodelib/fs.scandir": "2.1.5", - "fastq": "^1.6.0" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/@project-serum/anchor": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/@project-serum/anchor/-/anchor-0.25.0.tgz", - "integrity": "sha512-E6A5Y/ijqpfMJ5psJvbw0kVTzLZFUcOFgs6eSM2M2iWE1lVRF18T6hWZVNl6zqZsoz98jgnNHtVGJMs+ds9A7A==", - "dependencies": { - "@project-serum/borsh": "^0.2.5", - "@solana/web3.js": "^1.36.0", - "base64-js": "^1.5.1", - "bn.js": "^5.1.2", - "bs58": "^4.0.1", - "buffer-layout": "^1.2.2", - "camelcase": "^5.3.1", - "cross-fetch": "^3.1.5", - "crypto-hash": "^1.3.0", - "eventemitter3": "^4.0.7", - "js-sha256": "^0.9.0", - "pako": "^2.0.3", - "snake-case": "^3.0.4", - "superstruct": "^0.15.4", - "toml": "^3.0.0" - }, - "engines": { - "node": ">=11" - } - }, - "node_modules/@project-serum/borsh": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/@project-serum/borsh/-/borsh-0.2.5.tgz", - "integrity": "sha512-UmeUkUoKdQ7rhx6Leve1SssMR/Ghv8qrEiyywyxSWg7ooV7StdpPBhciiy5eB3T0qU1BXvdRNC8TdrkxK7WC5Q==", - "dependencies": { - "bn.js": "^5.1.2", - "buffer-layout": "^1.2.0" - }, - "engines": { - "node": ">=10" - }, - "peerDependencies": { - "@solana/web3.js": "^1.2.0" - } - }, - "node_modules/@project-serum/serum": { - "version": "0.13.65", - "resolved": "https://registry.npmjs.org/@project-serum/serum/-/serum-0.13.65.tgz", - "integrity": "sha512-BHRqsTqPSfFB5p+MgI2pjvMBAQtO8ibTK2fYY96boIFkCI3TTwXDt2gUmspeChKO2pqHr5aKevmexzAcXxrSRA==", - "dependencies": { - "@project-serum/anchor": "^0.11.1", - "@solana/spl-token": "^0.1.6", - "@solana/web3.js": "^1.21.0", - "bn.js": "^5.1.2", - "buffer-layout": "^1.2.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/@project-serum/serum/node_modules/@project-serum/anchor": { - "version": "0.11.1", - "resolved": "https://registry.npmjs.org/@project-serum/anchor/-/anchor-0.11.1.tgz", - "integrity": "sha512-oIdm4vTJkUy6GmE6JgqDAuQPKI7XM4TPJkjtoIzp69RZe0iAD9JP2XHx7lV1jLdYXeYHqDXfBt3zcq7W91K6PA==", - "dependencies": { - "@project-serum/borsh": "^0.2.2", - "@solana/web3.js": "^1.17.0", - "base64-js": "^1.5.1", - "bn.js": "^5.1.2", - "bs58": "^4.0.1", - "buffer-layout": "^1.2.0", - "camelcase": "^5.3.1", - "crypto-hash": "^1.3.0", - "eventemitter3": "^4.0.7", - "find": "^0.3.0", - "js-sha256": "^0.9.0", - "pako": "^2.0.3", - "snake-case": "^3.0.4", - "toml": "^3.0.0" - }, - "engines": { - "node": ">=11" - } - }, - "node_modules/@pythnetwork/client": { - "version": "2.8.0", - "resolved": "https://registry.npmjs.org/@pythnetwork/client/-/client-2.8.0.tgz", - "integrity": "sha512-YqqZSDDsEApC/F4H5ejcl8OCr7gsWv0noTK8YABT8pCtFRTQxXBP0r2S8KQMaIw1x97Mue/jkYybdMeFQzPjCw==", - "dependencies": { - "buffer": "^6.0.1" - }, - "peerDependencies": { - "@solana/web3.js": "^1.30.2" - } - }, - "node_modules/@scure/base": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.1.tgz", - "integrity": "sha512-ZxOhsSyxYwLJj3pLZCefNitxsj093tb2vq90mp2txoYeBqbcjDjqFhyM8eUjq/uFm6zJ+mUuqxlS2FkuSY1MTA==", - "funding": [ - { - "type": "individual", - "url": "https://paulmillr.com/funding/" - } - ] - }, - "node_modules/@scure/bip32": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.1.0.tgz", - "integrity": "sha512-ftTW3kKX54YXLCxH6BB7oEEoJfoE2pIgw7MINKAs5PsS6nqKPuKk1haTF/EuHmYqG330t5GSrdmtRuHaY1a62Q==", - "funding": [ - { - "type": "individual", - "url": "https://paulmillr.com/funding/" - } - ], - "dependencies": { - "@noble/hashes": "~1.1.1", - "@noble/secp256k1": "~1.6.0", - "@scure/base": "~1.1.0" - } - }, - "node_modules/@scure/bip32/node_modules/@noble/secp256k1": { - "version": "1.6.3", - "resolved": "https://registry.npmjs.org/@noble/secp256k1/-/secp256k1-1.6.3.tgz", - "integrity": "sha512-T04e4iTurVy7I8Sw4+c5OSN9/RkPlo1uKxAomtxQNLq8j1uPAqnsqG1bqvY3Jv7c13gyr6dui0zmh/I3+f/JaQ==", - "funding": [ - { - "type": "individual", - "url": "https://paulmillr.com/funding/" - } - ] - }, - "node_modules/@scure/bip39": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.1.0.tgz", - "integrity": "sha512-pwrPOS16VeTKg98dYXQyIjJEcWfz7/1YJIwxUEPFfQPtc86Ym/1sVgQ2RLoD43AazMk2l/unK4ITySSpW2+82w==", - "funding": [ - { - "type": "individual", - "url": "https://paulmillr.com/funding/" - } - ], - "dependencies": { - "@noble/hashes": "~1.1.1", - "@scure/base": "~1.1.0" - } - }, - "node_modules/@solana/buffer-layout": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/@solana/buffer-layout/-/buffer-layout-4.0.1.tgz", - "integrity": "sha512-E1ImOIAD1tBZFRdjeM4/pzTiTApC0AOBGwyAMS4fwIodCWArzJ3DWdoh8cKxeFM2fElkxBh2Aqts1BPC373rHA==", - "dependencies": { - "buffer": "~6.0.3" - }, - "engines": { - "node": ">=5.10" - } - }, - "node_modules/@solana/buffer-layout/node_modules/buffer": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", - "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "dependencies": { - "base64-js": "^1.3.1", - "ieee754": "^1.2.1" - } - }, - "node_modules/@solana/buffer-layout/node_modules/ieee754": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", - "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, - "node_modules/@solana/spl-token": { - "version": "0.1.8", - "resolved": "https://registry.npmjs.org/@solana/spl-token/-/spl-token-0.1.8.tgz", - "integrity": "sha512-LZmYCKcPQDtJgecvWOgT/cnoIQPWjdH+QVyzPcFvyDUiT0DiRjZaam4aqNUyvchLFhzgunv3d9xOoyE34ofdoQ==", - "dependencies": { - "@babel/runtime": "^7.10.5", - "@solana/web3.js": "^1.21.0", - "bn.js": "^5.1.0", - "buffer": "6.0.3", - "buffer-layout": "^1.2.0", - "dotenv": "10.0.0" - }, - "engines": { - "node": ">= 10" - } - }, - "node_modules/@solana/spl-token/node_modules/buffer": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", - "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "dependencies": { - "base64-js": "^1.3.1", - "ieee754": "^1.2.1" - } - }, - "node_modules/@solana/spl-token/node_modules/dotenv": { - "version": "10.0.0", - "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-10.0.0.tgz", - "integrity": "sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q==", - "engines": { - "node": ">=10" - } - }, - "node_modules/@solana/spl-token/node_modules/ieee754": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", - "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, - "node_modules/@solana/web3.js": { - "version": "1.72.0", - "resolved": "https://registry.npmjs.org/@solana/web3.js/-/web3.js-1.72.0.tgz", - "integrity": "sha512-xMoCk0y/GpiQhHbRjMcrd5NpmkwhAA0c01id7lrr6nhNdz6Uc/CywPdBeZw3Qz6BVZ/qlUoerpKPWeiXqMUjwA==", - "dependencies": { - "@babel/runtime": "^7.12.5", - "@noble/ed25519": "^1.7.0", - "@noble/hashes": "^1.1.2", - "@noble/secp256k1": "^1.6.3", - "@solana/buffer-layout": "^4.0.0", - "agentkeepalive": "^4.2.1", - "bigint-buffer": "^1.1.5", - "bn.js": "^5.0.0", - "borsh": "^0.7.0", - "bs58": "^4.0.1", - "buffer": "6.0.1", - "fast-stable-stringify": "^1.0.0", - "jayson": "^3.4.4", - "node-fetch": "2", - "rpc-websockets": "^7.5.0", - "superstruct": "^0.14.2" - }, - "engines": { - "node": ">=12.20.0" - } - }, - "node_modules/@solana/web3.js/node_modules/superstruct": { - "version": "0.14.2", - "resolved": "https://registry.npmjs.org/superstruct/-/superstruct-0.14.2.tgz", - "integrity": "sha512-nPewA6m9mR3d6k7WkZ8N8zpTWfenFH3q9pA2PkuiZxINr9DKB2+40wEQf0ixn8VaGuJ78AB6iWOtStI+/4FKZQ==" - }, - "node_modules/@solendprotocol/solend-sdk": { - "version": "0.6.9", - "resolved": "https://registry.npmjs.org/@solendprotocol/solend-sdk/-/solend-sdk-0.6.9.tgz", - "integrity": "sha512-KToDqIDsn11hdNY3M/Lew5spSF2ML2S8q5H21pwjVxFW1BV01Mgm0Y1sD6pLnQ9epQUAqxtbGj1oUETs6bqFMQ==", - "dependencies": { - "@marinade.finance/marinade-ts-sdk": "^3.1.1", - "@mithraic-labs/psy-american": "^0.2.1", - "@project-serum/anchor": "^0.24.2", - "@pythnetwork/client": "^2.5.1", - "@solana/buffer-layout": "^4.0.0", - "@solana/spl-token": "^0.1.8", - "@solana/web3.js": "^1.66.2", - "axios": "^0.24.0", - "bignumber.js": "^9.0.2", - "bn.js": "^5.2.0", - "buffer": "^6.0.3", - "buffer-layout": "^1.2.0", - "hot-shots": "^9.3.0", - "isomorphic-fetch": "^3.0.0", - "jsbi": "^4.3.0", - "typedoc-plugin-cname": "^1.0.1" - } - }, - "node_modules/@solendprotocol/solend-sdk/node_modules/@project-serum/anchor": { - "version": "0.24.2", - "resolved": "https://registry.npmjs.org/@project-serum/anchor/-/anchor-0.24.2.tgz", - "integrity": "sha512-0/718g8/DnEuwAidUwh5wLYphUYXhUbiClkuRNhvNoa+1Y8a4g2tJyxoae+emV+PG/Gikd/QUBNMkIcimiIRTA==", - "dependencies": { - "@project-serum/borsh": "^0.2.5", - "@solana/web3.js": "^1.36.0", - "base64-js": "^1.5.1", - "bn.js": "^5.1.2", - "bs58": "^4.0.1", - "buffer-layout": "^1.2.2", - "camelcase": "^5.3.1", - "cross-fetch": "^3.1.5", - "crypto-hash": "^1.3.0", - "eventemitter3": "^4.0.7", - "js-sha256": "^0.9.0", - "pako": "^2.0.3", - "snake-case": "^3.0.4", - "toml": "^3.0.0" - }, - "engines": { - "node": ">=11" - } - }, - "node_modules/@solendprotocol/solend-sdk/node_modules/axios": { - "version": "0.24.0", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.24.0.tgz", - "integrity": "sha512-Q6cWsys88HoPgAaFAVUb0WpPk0O8iTeisR9IMqy9G8AbO4NlpVknrnQS03zzF9PGAWgO3cgletO3VjV/P7VztA==", - "dependencies": { - "follow-redirects": "^1.14.4" - } - }, - "node_modules/@solendprotocol/solend-sdk/node_modules/buffer": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", - "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "dependencies": { - "base64-js": "^1.3.1", - "ieee754": "^1.2.1" - } - }, - "node_modules/@solendprotocol/solend-sdk/node_modules/ieee754": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", - "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, - "node_modules/@solendprotocol/solend-sdk/node_modules/typedoc": { - "version": "0.20.37", - "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.20.37.tgz", - "integrity": "sha512-9+qDhdc4X00qTNOtii6QX2z7ndAeWVOso7w3MPSoSJdXlVhpwPfm1yEp4ooKuWA9fiQILR8FKkyjmeqa13hBbw==", - "peer": true, - "dependencies": { - "colors": "^1.4.0", - "fs-extra": "^9.1.0", - "handlebars": "^4.7.7", - "lodash": "^4.17.21", - "lunr": "^2.3.9", - "marked": "~2.0.3", - "minimatch": "^3.0.0", - "progress": "^2.0.3", - "shelljs": "^0.8.4", - "shiki": "^0.9.3", - "typedoc-default-themes": "^0.12.10" - }, - "bin": { - "typedoc": "bin/typedoc" - }, - "engines": { - "node": ">= 10.8.0" - }, - "peerDependencies": { - "typescript": "3.9.x || 4.0.x || 4.1.x || 4.2.x" - } - }, - "node_modules/@solendprotocol/solend-sdk/node_modules/typedoc-plugin-cname": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/typedoc-plugin-cname/-/typedoc-plugin-cname-1.0.1.tgz", - "integrity": "sha512-f97SS5RzDCVBa7Frg1VketIMAkEl3OTvBs9wM8lLEkJVWCIG2yXnszglA82on39gFwQ1tyq8tiuxRgb4569GpA==", - "peerDependencies": { - "typedoc": "^0.20.27" - } - }, - "node_modules/@solendprotocol/solend-sdk/node_modules/typescript": { - "version": "4.2.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.2.4.tgz", - "integrity": "sha512-V+evlYHZnQkaz8TRBuxTA92yZBPotr5H+WhQ7bD3hZUndx5tGOa1fuCgeSjxAzM1RiN5IzvadIXTVefuuwZCRg==", - "peer": true, - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=4.2.0" - } - }, - "node_modules/@supercharge/promise-pool": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/@supercharge/promise-pool/-/promise-pool-2.3.2.tgz", - "integrity": "sha512-f5+C7zv+QQivcUO1FH5lXi7GcuJ3CFuJF3Eg06iArhUs5ma0szCLEQwIY4+VQyh7m/RLVZdzvr4E4ZDnLe9MNg==", - "engines": { - "node": ">=8" - } - }, - "node_modules/@tsconfig/node10": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz", - "integrity": "sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==", - "dev": true - }, - "node_modules/@tsconfig/node12": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", - "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==", - "dev": true - }, - "node_modules/@tsconfig/node14": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", - "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==", - "dev": true - }, - "node_modules/@tsconfig/node16": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.3.tgz", - "integrity": "sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ==", - "dev": true - }, - "node_modules/@types/async-retry": { - "version": "1.4.5", - "resolved": "https://registry.npmjs.org/@types/async-retry/-/async-retry-1.4.5.tgz", - "integrity": "sha512-YrdjSD+yQv7h6d5Ip+PMxh3H6ZxKyQk0Ts+PvaNRInxneG9PFVZjFg77ILAN+N6qYf7g4giSJ1l+ZjQ1zeegvA==", - "dev": true, - "dependencies": { - "@types/retry": "*" - } - }, - "node_modules/@types/bn.js": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/@types/bn.js/-/bn.js-5.1.1.tgz", - "integrity": "sha512-qNrYbZqMx0uJAfKnKclPh+dTwK33KfLHYqtyODwd5HnXOjnkhc4qgn3BrK6RWyGZm5+sIFE7Q7Vz6QQtJB7w7g==", - "dev": true, - "dependencies": { - "@types/node": "*" - } - }, - "node_modules/@types/connect": { - "version": "3.4.35", - "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.35.tgz", - "integrity": "sha512-cdeYyv4KWoEgpBISTxWvqYsVy444DOqehiF3fM3ne10AmJ62RSyNkUnxMJXHQWRQQX2eR94m5y1IZyDwBjV9FQ==", - "dependencies": { - "@types/node": "*" - } - }, - "node_modules/@types/node": { - "version": "18.11.18", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.18.tgz", - "integrity": "sha512-DHQpWGjyQKSHj3ebjFI/wRKcqQcdR+MoFBygntYOZytCqNfkd2ZC4ARDJ2DQqhjH5p85Nnd3jhUJIXrszFX/JA==" - }, - "node_modules/@types/retry": { - "version": "0.12.2", - "resolved": "https://registry.npmjs.org/@types/retry/-/retry-0.12.2.tgz", - "integrity": "sha512-XISRgDJ2Tc5q4TRqvgJtzsRkFYNJzZrhTdtMoGVBttwzzQJkPnS3WWTFc7kuDRoPtPakl+T+OfdEUjYJj7Jbow==", - "dev": true - }, - "node_modules/@types/ws": { - "version": "7.4.7", - "resolved": "https://registry.npmjs.org/@types/ws/-/ws-7.4.7.tgz", - "integrity": "sha512-JQbbmxZTZehdc2iszGKs5oC3NFnjeay7mtAWrdt7qNtAVK0g19muApzAy4bm9byz79xa2ZnO/BOBC2R8RC5Lww==", - "dependencies": { - "@types/node": "*" - } - }, - "node_modules/acorn": { - "version": "8.8.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.1.tgz", - "integrity": "sha512-7zFpHzhnqYKrkYdUjF1HI1bzd0VygEGX8lFk4k5zVMqHEoES+P+7TKI+EvLO9WVMJ8eekdO0aDEK044xTXwPPA==", - "dev": true, - "bin": { - "acorn": "bin/acorn" - }, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/acorn-jsx": { - "version": "5.3.2", - "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", - "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", - "dev": true, - "peerDependencies": { - "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" - } - }, - "node_modules/acorn-walk": { - "version": "8.2.0", - "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", - "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", - "dev": true, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/aes-js": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-3.0.0.tgz", - "integrity": "sha512-H7wUZRn8WpTq9jocdxQ2c8x2sKo9ZVmzfRE13GiNJXfp7NcKYEdvl3vspKjXox6RIG2VtaRe4JFvxG4rqp2Zuw==" - }, - "node_modules/agentkeepalive": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.2.1.tgz", - "integrity": "sha512-Zn4cw2NEqd+9fiSVWMscnjyQ1a8Yfoc5oBajLeo5w+YBHgDUcEBY2hS4YpTz6iN5f/2zQiktcuM6tS8x1p9dpA==", - "dependencies": { - "debug": "^4.1.0", - "depd": "^1.1.2", - "humanize-ms": "^1.2.1" - }, - "engines": { - "node": ">= 8.0.0" - } - }, - "node_modules/ajv": { - "version": "6.12.6", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", - "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", - "dev": true, - "dependencies": { - "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" - } - }, - "node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/arg": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", - "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", - "dev": true - }, - "node_modules/argparse": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", - "dev": true - }, - "node_modules/asynckit": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" - }, - "node_modules/at-least-node": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz", - "integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==", - "peer": true, - "engines": { - "node": ">= 4.0.0" - } - }, - "node_modules/available-typed-arrays": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz", - "integrity": "sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/aws-sdk": { - "version": "2.1283.0", - "resolved": "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.1283.0.tgz", - "integrity": "sha512-YlxTF0T9X8AcNrOzFPVOPnX1jNtHZjYHRUCfpsVwqdajHDGGruVsVppgBYXEiCRuTQNUhcJTUx0J0uKBhKQZIA==", - "dependencies": { - "buffer": "4.9.2", - "events": "1.1.1", - "ieee754": "1.1.13", - "jmespath": "0.16.0", - "querystring": "0.2.0", - "sax": "1.2.1", - "url": "0.10.3", - "util": "^0.12.4", - "uuid": "8.0.0", - "xml2js": "0.4.19" - }, - "engines": { - "node": ">= 10.0.0" - } - }, - "node_modules/aws-sdk/node_modules/buffer": { - "version": "4.9.2", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-4.9.2.tgz", - "integrity": "sha512-xq+q3SRMOxGivLhBNaUdC64hDTQwejJ+H0T/NB1XMtTVEwNTrfFF3gAxiyW0Bu/xWEGhjVKgUcMhCrUy2+uCWg==", - "dependencies": { - "base64-js": "^1.0.2", - "ieee754": "^1.1.4", - "isarray": "^1.0.0" - } - }, - "node_modules/axios": { - "version": "0.27.2", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.27.2.tgz", - "integrity": "sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==", - "dependencies": { - "follow-redirects": "^1.14.9", - "form-data": "^4.0.0" - } - }, - "node_modules/balanced-match": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" - }, - "node_modules/base-x": { - "version": "3.0.9", - "resolved": "https://registry.npmjs.org/base-x/-/base-x-3.0.9.tgz", - "integrity": "sha512-H7JU6iBHTal1gp56aKoaa//YUxEaAOUiydvrV/pILqIHXTtqxSkATOnDA2u+jZ/61sD+L/412+7kzXRtWukhpQ==", - "dependencies": { - "safe-buffer": "^5.0.1" - } - }, - "node_modules/base64-js": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", - "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, - "node_modules/bech32": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/bech32/-/bech32-1.1.4.tgz", - "integrity": "sha512-s0IrSOzLlbvX7yp4WBfPITzpAU8sqQcpsmwXDiKwrG4r491vwCO/XpejasRNl0piBMe/DvP4Tz0mIS/X1DPJBQ==" - }, - "node_modules/bigint-buffer": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/bigint-buffer/-/bigint-buffer-1.1.5.tgz", - "integrity": "sha512-trfYco6AoZ+rKhKnxA0hgX0HAbVP/s808/EuDSe2JDzUnCp/xAsli35Orvk67UrTEcwuxZqYZDmfA2RXJgxVvA==", - "hasInstallScript": true, - "dependencies": { - "bindings": "^1.3.0" - }, - "engines": { - "node": ">= 10.0.0" - } - }, - "node_modules/bignumber.js": { - "version": "9.1.1", - "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.1.1.tgz", - "integrity": "sha512-pHm4LsMJ6lzgNGVfZHjMoO8sdoRhOzOH4MLmY65Jg70bpxCKu5iOHNJyfF6OyvYw7t8Fpf35RuzUyqnQsj8Vig==", - "engines": { - "node": "*" - } - }, - "node_modules/bindings": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", - "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", - "dependencies": { - "file-uri-to-path": "1.0.0" - } - }, - "node_modules/blakejs": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/blakejs/-/blakejs-1.2.1.tgz", - "integrity": "sha512-QXUSXI3QVc/gJME0dBpXrag1kbzOqCjCX8/b54ntNyW6sjtoqxqRk3LTmXzaJoh71zMsDCjM+47jS7XiwN/+fQ==" - }, - "node_modules/bn.js": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", - "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==" - }, - "node_modules/borsh": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/borsh/-/borsh-0.7.0.tgz", - "integrity": "sha512-CLCsZGIBCFnPtkNnieW/a8wmreDmfUtjU2m9yHrzPXIlNbqVs0AQrSatSG6vdNYUqdc83tkQi2eHfF98ubzQLA==", - "dependencies": { - "bn.js": "^5.2.0", - "bs58": "^4.0.0", - "text-encoding-utf-8": "^1.0.2" - } - }, - "node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "node_modules/brorand": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", - "integrity": "sha512-cKV8tMCEpQs4hK/ik71d6LrPOnpkpGBR0wzxqr68g2m/LB2GxVYQroAjMJZRVM1Y4BCjCKc3vAamxSzOY2RP+w==" - }, - "node_modules/bs58": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/bs58/-/bs58-4.0.1.tgz", - "integrity": "sha512-Ok3Wdf5vOIlBrgCvTq96gBkJw+JUEzdBgyaza5HLtPm7yTHkjRy8+JzNyHF7BHa0bNWOQIp3m5YF0nnFcOIKLw==", - "dependencies": { - "base-x": "^3.0.2" - } - }, - "node_modules/buffer": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.1.tgz", - "integrity": "sha512-rVAXBwEcEoYtxnHSO5iWyhzV/O1WMtkUYWlfdLS7FjU4PnSJJHEfHXi/uHPI5EwltmOA794gN3bm3/pzuctWjQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "dependencies": { - "base64-js": "^1.3.1", - "ieee754": "^1.2.1" - } - }, - "node_modules/buffer-layout": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/buffer-layout/-/buffer-layout-1.2.2.tgz", - "integrity": "sha512-kWSuLN694+KTk8SrYvCqwP2WcgQjoRCiF5b4QDvkkz8EmgD+aWAIceGFKMIAdmF/pH+vpgNV3d3kAKorcdAmWA==", - "engines": { - "node": ">=4.5" - } - }, - "node_modules/buffer/node_modules/ieee754": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", - "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, - "node_modules/bufferutil": { - "version": "4.0.7", - "resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.7.tgz", - "integrity": "sha512-kukuqc39WOHtdxtw4UScxF/WVnMFVSQVKhtx3AjZJzhd0RGZZldcrfSEbVsWWe6KNH253574cq5F+wpv0G9pJw==", - "hasInstallScript": true, - "optional": true, - "dependencies": { - "node-gyp-build": "^4.3.0" - }, - "engines": { - "node": ">=6.14.2" - } - }, - "node_modules/call-bind": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", - "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", - "dependencies": { - "function-bind": "^1.1.1", - "get-intrinsic": "^1.0.2" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/callsites": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", - "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/camelcase": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", - "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", - "engines": { - "node": ">=6" - } - }, - "node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/colors": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz", - "integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==", - "peer": true, - "engines": { - "node": ">=0.1.90" - } - }, - "node_modules/combined-stream": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", - "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", - "dependencies": { - "delayed-stream": "~1.0.0" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/commander": { - "version": "2.20.3", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", - "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==" - }, - "node_modules/concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" - }, - "node_modules/create-require": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", - "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", - "dev": true - }, - "node_modules/cross-fetch": { - "version": "3.1.5", - "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.1.5.tgz", - "integrity": "sha512-lvb1SBsI0Z7GDwmuid+mU3kWVBwTVUbe7S0H52yaaAdQOXq2YktTCZdlAcNKFzE6QtRz0snpw9bNiPeOIkkQvw==", - "dependencies": { - "node-fetch": "2.6.7" - } - }, - "node_modules/cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", - "dev": true, - "dependencies": { - "path-key": "^3.1.0", - "shebang-command": "^2.0.0", - "which": "^2.0.1" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/crypto-hash": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/crypto-hash/-/crypto-hash-1.3.0.tgz", - "integrity": "sha512-lyAZ0EMyjDkVvz8WOeVnuCPvKVBXcMv1l5SVqO1yC7PzTwrD/pPje/BIRbWhMoPe436U+Y2nD7f5bFx0kt+Sbg==", - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/debug": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", - "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", - "dependencies": { - "ms": "2.1.2" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/deep-is": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", - "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", - "dev": true - }, - "node_modules/delay": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/delay/-/delay-5.0.0.tgz", - "integrity": "sha512-ReEBKkIfe4ya47wlPYf/gu5ib6yUG0/Aez0JQZQz94kiWtRQvZIQbTiehsnwHvLSWJnQdhVeqYue7Id1dKr0qw==", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/delayed-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/depd": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", - "integrity": "sha512-7emPTl6Dpo6JRXOXjLRxck+FlLRX5847cLKEn00PLAgc3g2hTZZgr+e4c2v6QpSmLeFP3n5yUo7ft6avBK/5jQ==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/diff": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", - "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", - "dev": true, - "engines": { - "node": ">=0.3.1" - } - }, - "node_modules/doctrine": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", - "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", - "dev": true, - "dependencies": { - "esutils": "^2.0.2" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/dot-case": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/dot-case/-/dot-case-3.0.4.tgz", - "integrity": "sha512-Kv5nKlh6yRrdrGvxeJ2e5y2eRUpkUosIW4A2AS38zwSz27zu7ufDwQPi5Jhs3XAlGNetl3bmnGhQsMtkKJnj3w==", - "dependencies": { - "no-case": "^3.0.4", - "tslib": "^2.0.3" - } - }, - "node_modules/dotenv": { - "version": "8.6.0", - "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.6.0.tgz", - "integrity": "sha512-IrPdXQsk2BbzvCBGBOTmmSH5SodmqZNt4ERAZDmW4CT+tL8VtvinqywuANaFu4bOMWki16nqf0e4oC0QIaDr/g==", - "engines": { - "node": ">=10" - } - }, - "node_modules/elliptic": { - "version": "6.5.4", - "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz", - "integrity": "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==", - "dependencies": { - "bn.js": "^4.11.9", - "brorand": "^1.1.0", - "hash.js": "^1.0.0", - "hmac-drbg": "^1.0.1", - "inherits": "^2.0.4", - "minimalistic-assert": "^1.0.1", - "minimalistic-crypto-utils": "^1.0.1" - } - }, - "node_modules/elliptic/node_modules/bn.js": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" - }, - "node_modules/es6-promise": { - "version": "4.2.8", - "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", - "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==" - }, - "node_modules/es6-promisify": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/es6-promisify/-/es6-promisify-5.0.0.tgz", - "integrity": "sha512-C+d6UdsYDk0lMebHNR4S2NybQMMngAOnOwYBQjTOiv0MkoJMP0Myw2mgpDLBcpfCmRLxyFqYhS/CfOENq4SJhQ==", - "dependencies": { - "es6-promise": "^4.0.3" - } - }, - "node_modules/escape-string-regexp": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", - "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/eslint": { - "version": "8.32.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.32.0.tgz", - "integrity": "sha512-nETVXpnthqKPFyuY2FNjz/bEd6nbosRgKbkgS/y1C7LJop96gYHWpiguLecMHQ2XCPxn77DS0P+68WzG6vkZSQ==", - "dev": true, - "dependencies": { - "@eslint/eslintrc": "^1.4.1", - "@humanwhocodes/config-array": "^0.11.8", - "@humanwhocodes/module-importer": "^1.0.1", - "@nodelib/fs.walk": "^1.2.8", - "ajv": "^6.10.0", - "chalk": "^4.0.0", - "cross-spawn": "^7.0.2", - "debug": "^4.3.2", - "doctrine": "^3.0.0", - "escape-string-regexp": "^4.0.0", - "eslint-scope": "^7.1.1", - "eslint-utils": "^3.0.0", - "eslint-visitor-keys": "^3.3.0", - "espree": "^9.4.0", - "esquery": "^1.4.0", - "esutils": "^2.0.2", - "fast-deep-equal": "^3.1.3", - "file-entry-cache": "^6.0.1", - "find-up": "^5.0.0", - "glob-parent": "^6.0.2", - "globals": "^13.19.0", - "grapheme-splitter": "^1.0.4", - "ignore": "^5.2.0", - "import-fresh": "^3.0.0", - "imurmurhash": "^0.1.4", - "is-glob": "^4.0.0", - "is-path-inside": "^3.0.3", - "js-sdsl": "^4.1.4", - "js-yaml": "^4.1.0", - "json-stable-stringify-without-jsonify": "^1.0.1", - "levn": "^0.4.1", - "lodash.merge": "^4.6.2", - "minimatch": "^3.1.2", - "natural-compare": "^1.4.0", - "optionator": "^0.9.1", - "regexpp": "^3.2.0", - "strip-ansi": "^6.0.1", - "strip-json-comments": "^3.1.0", - "text-table": "^0.2.0" - }, - "bin": { - "eslint": "bin/eslint.js" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/eslint-scope": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.1.1.tgz", - "integrity": "sha512-QKQM/UXpIiHcLqJ5AOyIW7XZmzjkzQXYE54n1++wb0u9V/abW3l9uQnxX8Z5Xd18xyKIMTUAyQ0k1e8pz6LUrw==", - "dev": true, - "dependencies": { - "esrecurse": "^4.3.0", - "estraverse": "^5.2.0" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - } - }, - "node_modules/eslint-utils": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-3.0.0.tgz", - "integrity": "sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==", - "dev": true, - "dependencies": { - "eslint-visitor-keys": "^2.0.0" - }, - "engines": { - "node": "^10.0.0 || ^12.0.0 || >= 14.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/mysticatea" - }, - "peerDependencies": { - "eslint": ">=5" - } - }, - "node_modules/eslint-utils/node_modules/eslint-visitor-keys": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", - "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", - "dev": true, - "engines": { - "node": ">=10" - } - }, - "node_modules/eslint-visitor-keys": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz", - "integrity": "sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA==", - "dev": true, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - } - }, - "node_modules/espree": { - "version": "9.4.1", - "resolved": "https://registry.npmjs.org/espree/-/espree-9.4.1.tgz", - "integrity": "sha512-XwctdmTO6SIvCzd9810yyNzIrOrqNYV9Koizx4C/mRhf9uq0o4yHoCEU/670pOxOL/MSraektvSAji79kX90Vg==", - "dev": true, - "dependencies": { - "acorn": "^8.8.0", - "acorn-jsx": "^5.3.2", - "eslint-visitor-keys": "^3.3.0" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/esquery": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.4.0.tgz", - "integrity": "sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w==", - "dev": true, - "dependencies": { - "estraverse": "^5.1.0" - }, - "engines": { - "node": ">=0.10" - } - }, - "node_modules/esrecurse": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", - "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", - "dev": true, - "dependencies": { - "estraverse": "^5.2.0" - }, - "engines": { - "node": ">=4.0" - } - }, - "node_modules/estraverse": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", - "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", - "dev": true, - "engines": { - "node": ">=4.0" - } - }, - "node_modules/esutils": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", - "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/ethereum-cryptography": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-1.1.2.tgz", - "integrity": "sha512-XDSJlg4BD+hq9N2FjvotwUET9Tfxpxc3kWGE2AqUG5vcbeunnbImVk3cj6e/xT3phdW21mE8R5IugU4fspQDcQ==", - "dependencies": { - "@noble/hashes": "1.1.2", - "@noble/secp256k1": "1.6.3", - "@scure/bip32": "1.1.0", - "@scure/bip39": "1.1.0" - } - }, - "node_modules/ethereum-cryptography/node_modules/@noble/hashes": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.1.2.tgz", - "integrity": "sha512-KYRCASVTv6aeUi1tsF8/vpyR7zpfs3FUzy2Jqm+MU+LmUKhQ0y2FpfwqkCcxSg2ua4GALJd8k2R76WxwZGbQpA==", - "funding": [ - { - "type": "individual", - "url": "https://paulmillr.com/funding/" - } - ] - }, - "node_modules/ethereum-cryptography/node_modules/@noble/secp256k1": { - "version": "1.6.3", - "resolved": "https://registry.npmjs.org/@noble/secp256k1/-/secp256k1-1.6.3.tgz", - "integrity": "sha512-T04e4iTurVy7I8Sw4+c5OSN9/RkPlo1uKxAomtxQNLq8j1uPAqnsqG1bqvY3Jv7c13gyr6dui0zmh/I3+f/JaQ==", - "funding": [ - { - "type": "individual", - "url": "https://paulmillr.com/funding/" - } - ] - }, - "node_modules/ethers": { - "version": "5.7.2", - "resolved": "https://registry.npmjs.org/ethers/-/ethers-5.7.2.tgz", - "integrity": "sha512-wswUsmWo1aOK8rR7DIKiWSw9DbLWe6x98Jrn8wcTflTVvaXhAMaB5zGAXy0GYQEQp9iO1iSHWVyARQm11zUtyg==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/abi": "5.7.0", - "@ethersproject/abstract-provider": "5.7.0", - "@ethersproject/abstract-signer": "5.7.0", - "@ethersproject/address": "5.7.0", - "@ethersproject/base64": "5.7.0", - "@ethersproject/basex": "5.7.0", - "@ethersproject/bignumber": "5.7.0", - "@ethersproject/bytes": "5.7.0", - "@ethersproject/constants": "5.7.0", - "@ethersproject/contracts": "5.7.0", - "@ethersproject/hash": "5.7.0", - "@ethersproject/hdnode": "5.7.0", - "@ethersproject/json-wallets": "5.7.0", - "@ethersproject/keccak256": "5.7.0", - "@ethersproject/logger": "5.7.0", - "@ethersproject/networks": "5.7.1", - "@ethersproject/pbkdf2": "5.7.0", - "@ethersproject/properties": "5.7.0", - "@ethersproject/providers": "5.7.2", - "@ethersproject/random": "5.7.0", - "@ethersproject/rlp": "5.7.0", - "@ethersproject/sha2": "5.7.0", - "@ethersproject/signing-key": "5.7.0", - "@ethersproject/solidity": "5.7.0", - "@ethersproject/strings": "5.7.0", - "@ethersproject/transactions": "5.7.0", - "@ethersproject/units": "5.7.0", - "@ethersproject/wallet": "5.7.0", - "@ethersproject/web": "5.7.1", - "@ethersproject/wordlists": "5.7.0" - } - }, - "node_modules/eventemitter3": { - "version": "4.0.7", - "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", - "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==" - }, - "node_modules/events": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/events/-/events-1.1.1.tgz", - "integrity": "sha512-kEcvvCBByWXGnZy6JUlgAp2gBIUjfCAV6P6TgT1/aaQKcmuAEC4OZTV1I4EWQLz2gxZw76atuVyvHhTxvi0Flw==", - "engines": { - "node": ">=0.4.x" - } - }, - "node_modules/extract-files": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/extract-files/-/extract-files-9.0.0.tgz", - "integrity": "sha512-CvdFfHkC95B4bBBk36hcEmvdR2awOdhhVUYH6S/zrVj3477zven/fJMYg7121h4T1xHZC+tetUpubpAhxwI7hQ==", - "engines": { - "node": "^10.17.0 || ^12.0.0 || >= 13.7.0" - }, - "funding": { - "url": "https://github.com/sponsors/jaydenseric" - } - }, - "node_modules/eyes": { - "version": "0.1.8", - "resolved": "https://registry.npmjs.org/eyes/-/eyes-0.1.8.tgz", - "integrity": "sha512-GipyPsXO1anza0AOZdy69Im7hGFCNB7Y/NGjDlZGJ3GJJLtwNSb2vrzYrTYJRrRloVx7pl+bhUaTB8yiccPvFQ==", - "engines": { - "node": "> 0.1.90" - } - }, - "node_modules/fast-deep-equal": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", - "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", - "dev": true - }, - "node_modules/fast-json-stable-stringify": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", - "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", - "dev": true - }, - "node_modules/fast-levenshtein": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", - "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", - "dev": true - }, - "node_modules/fast-stable-stringify": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fast-stable-stringify/-/fast-stable-stringify-1.0.0.tgz", - "integrity": "sha512-wpYMUmFu5f00Sm0cj2pfivpmawLZ0NKdviQ4w9zJeR8JVtOpOxHmLaJuj0vxvGqMJQWyP/COUkF75/57OKyRag==" - }, - "node_modules/fastq": { - "version": "1.15.0", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.15.0.tgz", - "integrity": "sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==", - "dev": true, - "dependencies": { - "reusify": "^1.0.4" - } - }, - "node_modules/file-entry-cache": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", - "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", - "dev": true, - "dependencies": { - "flat-cache": "^3.0.4" - }, - "engines": { - "node": "^10.12.0 || >=12.0.0" - } - }, - "node_modules/file-uri-to-path": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", - "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==" - }, - "node_modules/find": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/find/-/find-0.3.0.tgz", - "integrity": "sha512-iSd+O4OEYV/I36Zl8MdYJO0xD82wH528SaCieTVHhclgiYNe9y+yPKSwK+A7/WsmHL1EZ+pYUJBXWTL5qofksw==", - "dependencies": { - "traverse-chain": "~0.1.0" - } - }, - "node_modules/find-up": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", - "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", - "dev": true, - "dependencies": { - "locate-path": "^6.0.0", - "path-exists": "^4.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/flat-cache": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz", - "integrity": "sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==", - "dev": true, - "dependencies": { - "flatted": "^3.1.0", - "rimraf": "^3.0.2" - }, - "engines": { - "node": "^10.12.0 || >=12.0.0" - } - }, - "node_modules/flatted": { - "version": "3.2.7", - "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.7.tgz", - "integrity": "sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==", - "dev": true - }, - "node_modules/follow-redirects": { - "version": "1.15.2", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", - "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==", - "funding": [ - { - "type": "individual", - "url": "https://github.com/sponsors/RubenVerborgh" - } - ], - "engines": { - "node": ">=4.0" - }, - "peerDependenciesMeta": { - "debug": { - "optional": true - } - } - }, - "node_modules/for-each": { - "version": "0.3.3", - "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", - "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", - "dependencies": { - "is-callable": "^1.1.3" - } - }, - "node_modules/form-data": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", - "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", - "dependencies": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.8", - "mime-types": "^2.1.12" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/fs-extra": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", - "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", - "peer": true, - "dependencies": { - "at-least-node": "^1.0.0", - "graceful-fs": "^4.2.0", - "jsonfile": "^6.0.1", - "universalify": "^2.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" - }, - "node_modules/function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" - }, - "node_modules/get-intrinsic": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.3.tgz", - "integrity": "sha512-QJVz1Tj7MS099PevUG5jvnt9tSkXN8K14dxQlikJuPt4uD9hHAHjLyLBiLR5zELelBdD9QNRAXZzsJx0WaDL9A==", - "dependencies": { - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.3" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/glob": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", - "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/glob-parent": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", - "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", - "dev": true, - "dependencies": { - "is-glob": "^4.0.3" - }, - "engines": { - "node": ">=10.13.0" - } - }, - "node_modules/globals": { - "version": "13.19.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.19.0.tgz", - "integrity": "sha512-dkQ957uSRWHw7CFXLUtUHQI3g3aWApYhfNR2O6jn/907riyTYKVBmxYVROkBcY614FSSeSJh7Xm7SrUWCxvJMQ==", - "dev": true, - "dependencies": { - "type-fest": "^0.20.2" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/gopd": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", - "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", - "dependencies": { - "get-intrinsic": "^1.1.3" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/graceful-fs": { - "version": "4.2.10", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", - "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", - "peer": true - }, - "node_modules/grapheme-splitter": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz", - "integrity": "sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==", - "dev": true - }, - "node_modules/graphql": { - "version": "16.6.0", - "resolved": "https://registry.npmjs.org/graphql/-/graphql-16.6.0.tgz", - "integrity": "sha512-KPIBPDlW7NxrbT/eh4qPXz5FiFdL5UbaA0XUNz2Rp3Z3hqBSkbj0GVjwFDztsWVauZUWsbKHgMg++sk8UX0bkw==", - "engines": { - "node": "^12.22.0 || ^14.16.0 || ^16.0.0 || >=17.0.0" - } - }, - "node_modules/graphql-request": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/graphql-request/-/graphql-request-4.3.0.tgz", - "integrity": "sha512-2v6hQViJvSsifK606AliqiNiijb1uwWp6Re7o0RTyH+uRTv/u7Uqm2g4Fjq/LgZIzARB38RZEvVBFOQOVdlBow==", - "dependencies": { - "cross-fetch": "^3.1.5", - "extract-files": "^9.0.0", - "form-data": "^3.0.0" - }, - "peerDependencies": { - "graphql": "14 - 16" - } - }, - "node_modules/graphql-request/node_modules/form-data": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.1.tgz", - "integrity": "sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==", - "dependencies": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.8", - "mime-types": "^2.1.12" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/handlebars": { - "version": "4.7.7", - "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.7.tgz", - "integrity": "sha512-aAcXm5OAfE/8IXkcZvCepKU3VzW1/39Fb5ZuqMtgI/hT8X2YgoMvBY5dLhq/cpOvw7Lk1nK/UF71aLG/ZnVYRA==", - "peer": true, - "dependencies": { - "minimist": "^1.2.5", - "neo-async": "^2.6.0", - "source-map": "^0.6.1", - "wordwrap": "^1.0.0" - }, - "bin": { - "handlebars": "bin/handlebars" - }, - "engines": { - "node": ">=0.4.7" - }, - "optionalDependencies": { - "uglify-js": "^3.1.4" - } - }, - "node_modules/has": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", - "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", - "dependencies": { - "function-bind": "^1.1.1" - }, - "engines": { - "node": ">= 0.4.0" - } - }, - "node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/has-symbols": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", - "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/has-tostringtag": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.0.tgz", - "integrity": "sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==", - "dependencies": { - "has-symbols": "^1.0.2" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/hash.js": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", - "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==", - "dependencies": { - "inherits": "^2.0.3", - "minimalistic-assert": "^1.0.1" - } - }, - "node_modules/hi-base32": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/hi-base32/-/hi-base32-0.5.1.tgz", - "integrity": "sha512-EmBBpvdYh/4XxsnUybsPag6VikPYnN30td+vQk+GI3qpahVEG9+gTkG0aXVxTjBqQ5T6ijbWIu77O+C5WFWsnA==" - }, - "node_modules/hmac-drbg": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", - "integrity": "sha512-Tti3gMqLdZfhOQY1Mzf/AanLiqh1WTiJgEj26ZuYQ9fbkLomzGchCws4FyrSd4VkpBfiNhaE1On+lOz894jvXg==", - "dependencies": { - "hash.js": "^1.0.3", - "minimalistic-assert": "^1.0.0", - "minimalistic-crypto-utils": "^1.0.1" - } - }, - "node_modules/hot-shots": { - "version": "9.3.0", - "resolved": "https://registry.npmjs.org/hot-shots/-/hot-shots-9.3.0.tgz", - "integrity": "sha512-e4tgWptiBvlIMnAX0ORe+dNEt0HznD+T2ckzXDUwCBsU7uWr2mwq5UtoT+Df5r9hD5S/DuP8rTxJUQvqAFSFKA==", - "engines": { - "node": ">=6.0.0" - }, - "optionalDependencies": { - "unix-dgram": "2.x" - } - }, - "node_modules/humanize-ms": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz", - "integrity": "sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ==", - "dependencies": { - "ms": "^2.0.0" - } - }, - "node_modules/ieee754": { - "version": "1.1.13", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.13.tgz", - "integrity": "sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg==" - }, - "node_modules/ignore": { - "version": "5.2.4", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.4.tgz", - "integrity": "sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==", - "dev": true, - "engines": { - "node": ">= 4" - } - }, - "node_modules/import-fresh": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", - "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", - "dev": true, - "dependencies": { - "parent-module": "^1.0.0", - "resolve-from": "^4.0.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/imurmurhash": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", - "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", - "dev": true, - "engines": { - "node": ">=0.8.19" - } - }, - "node_modules/inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", - "dependencies": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "node_modules/inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" - }, - "node_modules/interpret": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.4.0.tgz", - "integrity": "sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==", - "peer": true, - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/is-arguments": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.1.tgz", - "integrity": "sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA==", - "dependencies": { - "call-bind": "^1.0.2", - "has-tostringtag": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-callable": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", - "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-core-module": { - "version": "2.11.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.11.0.tgz", - "integrity": "sha512-RRjxlvLDkD1YJwDbroBHMb+cukurkDWNyHx7D3oNB5x9rb5ogcksMC5wHCadcXoo67gVr/+3GFySh3134zi6rw==", - "peer": true, - "dependencies": { - "has": "^1.0.3" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-generator-function": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.10.tgz", - "integrity": "sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A==", - "dependencies": { - "has-tostringtag": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-glob": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", - "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", - "dev": true, - "dependencies": { - "is-extglob": "^2.1.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-path-inside": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", - "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/is-typed-array": { - "version": "1.1.10", - "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.10.tgz", - "integrity": "sha512-PJqgEHiWZvMpaFZ3uTc8kHPM4+4ADTlDniuQL7cU/UDA0Ql7F70yGfHph3cLNe+c9toaigv+DFzTJKhc2CtO6A==", - "dependencies": { - "available-typed-arrays": "^1.0.5", - "call-bind": "^1.0.2", - "for-each": "^0.3.3", - "gopd": "^1.0.1", - "has-tostringtag": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==" - }, - "node_modules/isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", - "dev": true - }, - "node_modules/isomorphic-fetch": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/isomorphic-fetch/-/isomorphic-fetch-3.0.0.tgz", - "integrity": "sha512-qvUtwJ3j6qwsF3jLxkZ72qCgjMysPzDfeV240JHiGZsANBYd+EEuu35v7dfrJ9Up0Ak07D7GGSkGhCHTqg/5wA==", - "dependencies": { - "node-fetch": "^2.6.1", - "whatwg-fetch": "^3.4.1" - } - }, - "node_modules/isomorphic-ws": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/isomorphic-ws/-/isomorphic-ws-4.0.1.tgz", - "integrity": "sha512-BhBvN2MBpWTaSHdWRb/bwdZJ1WaehQ2L1KngkCkfLUGF0mAWAT1sQUQacEmQ0jXkFw/czDXPNQSL5u2/Krsz1w==", - "peerDependencies": { - "ws": "*" - } - }, - "node_modules/jayson": { - "version": "3.7.0", - "resolved": "https://registry.npmjs.org/jayson/-/jayson-3.7.0.tgz", - "integrity": "sha512-tfy39KJMrrXJ+mFcMpxwBvFDetS8LAID93+rycFglIQM4kl3uNR3W4lBLE/FFhsoUCEox5Dt2adVpDm/XtebbQ==", - "dependencies": { - "@types/connect": "^3.4.33", - "@types/node": "^12.12.54", - "@types/ws": "^7.4.4", - "commander": "^2.20.3", - "delay": "^5.0.0", - "es6-promisify": "^5.0.0", - "eyes": "^0.1.8", - "isomorphic-ws": "^4.0.1", - "json-stringify-safe": "^5.0.1", - "JSONStream": "^1.3.5", - "lodash": "^4.17.20", - "uuid": "^8.3.2", - "ws": "^7.4.5" - }, - "bin": { - "jayson": "bin/jayson.js" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/jayson/node_modules/@types/node": { - "version": "12.20.55", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.55.tgz", - "integrity": "sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==" - }, - "node_modules/jayson/node_modules/uuid": { - "version": "8.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", - "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", - "bin": { - "uuid": "dist/bin/uuid" - } - }, - "node_modules/jmespath": { - "version": "0.16.0", - "resolved": "https://registry.npmjs.org/jmespath/-/jmespath-0.16.0.tgz", - "integrity": "sha512-9FzQjJ7MATs1tSpnco1K6ayiYE3figslrXA72G2HQ/n76RzvYlofyi5QM+iX4YRs/pu3yzxlVQSST23+dMDknw==", - "engines": { - "node": ">= 0.6.0" - } - }, - "node_modules/js-sdsl": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/js-sdsl/-/js-sdsl-4.2.0.tgz", - "integrity": "sha512-dyBIzQBDkCqCu+0upx25Y2jGdbTGxE9fshMsCdK0ViOongpV+n5tXRcZY9v7CaVQ79AGS9KA1KHtojxiM7aXSQ==", - "dev": true, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/js-sdsl" - } - }, - "node_modules/js-sha256": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/js-sha256/-/js-sha256-0.9.0.tgz", - "integrity": "sha512-sga3MHh9sgQN2+pJ9VYZ+1LPwXOxuBJBA5nrR5/ofPfuiJBE2hnjsaN8se8JznOmGLN2p49Pe5U/ttafcs/apA==" - }, - "node_modules/js-sha3": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz", - "integrity": "sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q==" - }, - "node_modules/js-sha512": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/js-sha512/-/js-sha512-0.8.0.tgz", - "integrity": "sha512-PWsmefG6Jkodqt+ePTvBZCSMFgN7Clckjd0O7su3I0+BW2QWUTJNzjktHsztGLhncP2h8mcF9V9Y2Ha59pAViQ==" - }, - "node_modules/js-yaml": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", - "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", - "dev": true, - "dependencies": { - "argparse": "^2.0.1" - }, - "bin": { - "js-yaml": "bin/js-yaml.js" - } - }, - "node_modules/jsbi": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/jsbi/-/jsbi-4.3.0.tgz", - "integrity": "sha512-SnZNcinB4RIcnEyZqFPdGPVgrg2AcnykiBy0sHVJQKHYeaLUvi3Exj+iaPpLnFVkDPZIV4U0yvgC9/R4uEAZ9g==" - }, - "node_modules/json-bigint": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/json-bigint/-/json-bigint-1.0.0.tgz", - "integrity": "sha512-SiPv/8VpZuWbvLSMtTDU8hEfrZWg/mH/nV/b4o0CYbSxu1UIQPLdwKOCIyLQX+VIPO5vrLX3i8qtqFyhdPSUSQ==", - "dependencies": { - "bignumber.js": "^9.0.0" - } - }, - "node_modules/json-schema-traverse": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", - "dev": true - }, - "node_modules/json-stable-stringify-without-jsonify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", - "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", - "dev": true - }, - "node_modules/json-stringify-safe": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", - "integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==" - }, - "node_modules/jsonc-parser": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.2.0.tgz", - "integrity": "sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w==", - "peer": true - }, - "node_modules/jsonfile": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", - "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", - "peer": true, - "dependencies": { - "universalify": "^2.0.0" - }, - "optionalDependencies": { - "graceful-fs": "^4.1.6" - } - }, - "node_modules/jsonparse": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/jsonparse/-/jsonparse-1.3.1.tgz", - "integrity": "sha512-POQXvpdL69+CluYsillJ7SUhKvytYjW9vG/GKpnf+xP8UWgYEM/RaMzHHofbALDiKbbP1W8UEYmgGl39WkPZsg==", - "engines": [ - "node >= 0.2.0" - ] - }, - "node_modules/JSONStream": { - "version": "1.3.5", - "resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.5.tgz", - "integrity": "sha512-E+iruNOY8VV9s4JEbe1aNEm6MiszPRr/UfcHMz0TQh1BXSxHK+ASV1R6W4HpjBhSeS+54PIsAMCBmwD06LLsqQ==", - "dependencies": { - "jsonparse": "^1.2.0", - "through": ">=2.2.7 <3" - }, - "bin": { - "JSONStream": "bin.js" - }, - "engines": { - "node": "*" - } - }, - "node_modules/just-performance": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/just-performance/-/just-performance-4.3.0.tgz", - "integrity": "sha512-L7RjvtJsL0QO8xFs5wEoDDzzJwoiowRw6Rn/GnvldlchS2JQr9wFYPiwZcDfrbbujEKqKN0tvENdbjXdYhDp5Q==" - }, - "node_modules/levn": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", - "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", - "dev": true, - "dependencies": { - "prelude-ls": "^1.2.1", - "type-check": "~0.4.0" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/limiter": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/limiter/-/limiter-2.1.0.tgz", - "integrity": "sha512-361TYz6iay6n+9KvUUImqdLuFigK+K79qrUtBsXhJTLdH4rIt/r1y8r1iozwh8KbZNpujbFTSh74mJ7bwbAMOw==", - "dependencies": { - "just-performance": "4.3.0" - } - }, - "node_modules/locate-path": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", - "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", - "dev": true, - "dependencies": { - "p-locate": "^5.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/lodash": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" - }, - "node_modules/lodash.merge": { - "version": "4.6.2", - "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", - "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", - "dev": true - }, - "node_modules/lower-case": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/lower-case/-/lower-case-2.0.2.tgz", - "integrity": "sha512-7fm3l3NAF9WfN6W3JOmf5drwpVqX78JtoGJ3A6W0a6ZnldM41w2fV5D490psKFTpMds8TJse/eHLFFsNHHjHgg==", - "dependencies": { - "tslib": "^2.0.3" - } - }, - "node_modules/lunr": { - "version": "2.3.9", - "resolved": "https://registry.npmjs.org/lunr/-/lunr-2.3.9.tgz", - "integrity": "sha512-zTU3DaZaF3Rt9rhN3uBMGQD3dD2/vFQqnvZCDv4dl5iOzq2IZQqTxu90r4E5J+nP70J3ilqVCrbho2eWaeW8Ow==", - "peer": true - }, - "node_modules/make-error": { - "version": "1.3.6", - "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", - "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", - "dev": true - }, - "node_modules/marked": { - "version": "2.0.7", - "resolved": "https://registry.npmjs.org/marked/-/marked-2.0.7.tgz", - "integrity": "sha512-BJXxkuIfJchcXOJWTT2DOL+yFWifFv2yGYOUzvXg8Qz610QKw+sHCvTMYwA+qWGhlA2uivBezChZ/pBy1tWdkQ==", - "peer": true, - "bin": { - "marked": "bin/marked" - }, - "engines": { - "node": ">= 8.16.2" - } - }, - "node_modules/mime-db": { - "version": "1.52.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", - "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/mime-types": { - "version": "2.1.35", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", - "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", - "dependencies": { - "mime-db": "1.52.0" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/minimalistic-assert": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", - "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==" - }, - "node_modules/minimalistic-crypto-utils": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", - "integrity": "sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg==" - }, - "node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, - "node_modules/minimist": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.7.tgz", - "integrity": "sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g==", - "peer": true, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" - }, - "node_modules/nan": { - "version": "2.17.0", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.17.0.tgz", - "integrity": "sha512-2ZTgtl0nJsO0KQCjEpxcIr5D+Yv90plTitZt9JBfQvVJDS5seMl3FOvsh3+9CoYWXf/1l5OaZzzF6nDm4cagaQ==", - "optional": true - }, - "node_modules/natural-compare": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", - "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", - "dev": true - }, - "node_modules/neo-async": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", - "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", - "peer": true - }, - "node_modules/no-case": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/no-case/-/no-case-3.0.4.tgz", - "integrity": "sha512-fgAN3jGAh+RoxUGZHTSOLJIqUc2wmoBwGR4tbpNAKmmovFoWq0OdRkb0VkldReO2a2iBT/OEulG9XSUc10r3zg==", - "dependencies": { - "lower-case": "^2.0.2", - "tslib": "^2.0.3" - } - }, - "node_modules/node-fetch": { - "version": "2.6.7", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", - "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", - "dependencies": { - "whatwg-url": "^5.0.0" - }, - "engines": { - "node": "4.x || >=6.0.0" - }, - "peerDependencies": { - "encoding": "^0.1.0" - }, - "peerDependenciesMeta": { - "encoding": { - "optional": true - } - } - }, - "node_modules/node-gyp-build": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.5.0.tgz", - "integrity": "sha512-2iGbaQBV+ITgCz76ZEjmhUKAKVf7xfY1sRl4UiKQspfZMH2h06SyhNsnSVy50cwkFQDGLyif6m/6uFXHkOZ6rg==", - "optional": true, - "bin": { - "node-gyp-build": "bin.js", - "node-gyp-build-optional": "optional.js", - "node-gyp-build-test": "build-test.js" - } - }, - "node_modules/once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", - "dependencies": { - "wrappy": "1" - } - }, - "node_modules/optionator": { - "version": "0.9.1", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", - "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==", - "dev": true, - "dependencies": { - "deep-is": "^0.1.3", - "fast-levenshtein": "^2.0.6", - "levn": "^0.4.1", - "prelude-ls": "^1.2.1", - "type-check": "^0.4.0", - "word-wrap": "^1.2.3" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/p-limit": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", - "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", - "dev": true, - "dependencies": { - "yocto-queue": "^0.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/p-locate": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", - "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", - "dev": true, - "dependencies": { - "p-limit": "^3.0.2" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/pako": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/pako/-/pako-2.1.0.tgz", - "integrity": "sha512-w+eufiZ1WuJYgPXbV/PO3NCMEc3xqylkKHzp8bxp1uW4qaSNQUkwmLLEc3kKsfz8lpV1F8Ht3U1Cm+9Srog2ug==" - }, - "node_modules/parent-module": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", - "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", - "dev": true, - "dependencies": { - "callsites": "^3.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/path-exists": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/path-is-absolute": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/path-key": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", - "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/path-parse": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", - "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", - "peer": true - }, - "node_modules/prelude-ls": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", - "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", - "dev": true, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/progress": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", - "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", - "peer": true, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/punycode": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz", - "integrity": "sha512-RofWgt/7fL5wP1Y7fxE7/EmTLzQVnB0ycyibJ0OOHIlJqTNzglYFxVwETOcIoJqJmpDXJ9xImDv+Fq34F/d4Dw==" - }, - "node_modules/querystring": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz", - "integrity": "sha512-X/xY82scca2tau62i9mDyU9K+I+djTMUsvwf7xnUX5GLvVzgJybOJf4Y6o9Zx3oJK/LSXg5tTZBjwzqVPaPO2g==", - "deprecated": "The querystring API is considered Legacy. new code should use the URLSearchParams API instead.", - "engines": { - "node": ">=0.4.x" - } - }, - "node_modules/queue-microtask": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", - "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, - "node_modules/rechoir": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", - "integrity": "sha512-HFM8rkZ+i3zrV+4LQjwQ0W+ez98pApMGM3HUrN04j3CqzPOzl9nmP15Y8YXNm8QHGv/eacOVEjqhmWpkRV0NAw==", - "peer": true, - "dependencies": { - "resolve": "^1.1.6" - }, - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/regenerator-runtime": { - "version": "0.13.11", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz", - "integrity": "sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==" - }, - "node_modules/regexpp": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz", - "integrity": "sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==", - "dev": true, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/mysticatea" - } - }, - "node_modules/resolve": { - "version": "1.22.1", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.1.tgz", - "integrity": "sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw==", - "peer": true, - "dependencies": { - "is-core-module": "^2.9.0", - "path-parse": "^1.0.7", - "supports-preserve-symlinks-flag": "^1.0.0" - }, - "bin": { - "resolve": "bin/resolve" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/resolve-from": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", - "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/reusify": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", - "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", - "dev": true, - "engines": { - "iojs": ">=1.0.0", - "node": ">=0.10.0" - } - }, - "node_modules/rimraf": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", - "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", - "dev": true, - "dependencies": { - "glob": "^7.1.3" - }, - "bin": { - "rimraf": "bin.js" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/rpc-websockets": { - "version": "7.5.0", - "resolved": "https://registry.npmjs.org/rpc-websockets/-/rpc-websockets-7.5.0.tgz", - "integrity": "sha512-9tIRi1uZGy7YmDjErf1Ax3wtqdSSLIlnmL5OtOzgd5eqPKbsPpwDP5whUDO2LQay3Xp0CcHlcNSGzacNRluBaQ==", - "dependencies": { - "@babel/runtime": "^7.17.2", - "eventemitter3": "^4.0.7", - "uuid": "^8.3.2", - "ws": "^8.5.0" - }, - "funding": { - "type": "paypal", - "url": "https://paypal.me/kozjak" - }, - "optionalDependencies": { - "bufferutil": "^4.0.1", - "utf-8-validate": "^5.0.2" - } - }, - "node_modules/rpc-websockets/node_modules/uuid": { - "version": "8.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", - "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", - "bin": { - "uuid": "dist/bin/uuid" - } - }, - "node_modules/rpc-websockets/node_modules/ws": { - "version": "8.11.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.11.0.tgz", - "integrity": "sha512-HPG3wQd9sNQoT9xHyNCXoDUa+Xw/VevmY9FoHyQ+g+rrMn4j6FB4np7Z0OhdTgjx6MgQLK7jwSy1YecU1+4Asg==", - "engines": { - "node": ">=10.0.0" - }, - "peerDependencies": { - "bufferutil": "^4.0.1", - "utf-8-validate": "^5.0.2" - }, - "peerDependenciesMeta": { - "bufferutil": { - "optional": true - }, - "utf-8-validate": { - "optional": true - } - } - }, - "node_modules/run-parallel": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", - "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "dependencies": { - "queue-microtask": "^1.2.2" - } - }, - "node_modules/safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, - "node_modules/sax": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.1.tgz", - "integrity": "sha512-8I2a3LovHTOpm7NV5yOyO8IHqgVsfK4+UuySrXU8YXkSRX7k6hCV9b3HrkKCr3nMpgj+0bmocaJJWpvp1oc7ZA==" - }, - "node_modules/scrypt-js": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/scrypt-js/-/scrypt-js-3.0.1.tgz", - "integrity": "sha512-cdwTTnqPu0Hyvf5in5asVdZocVDTNRmR7XEcJuIzMjJeSHybHl7vpB66AzwTaIg6CLSbtjcxc8fqcySfnTkccA==" - }, - "node_modules/shebang-command": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", - "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", - "dev": true, - "dependencies": { - "shebang-regex": "^3.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/shebang-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", - "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/shelljs": { - "version": "0.8.5", - "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.5.tgz", - "integrity": "sha512-TiwcRcrkhHvbrZbnRcFYMLl30Dfov3HKqzp5tO5b4pt6G/SezKcYhmDg15zXVBswHmctSAQKznqNW2LO5tTDow==", - "peer": true, - "dependencies": { - "glob": "^7.0.0", - "interpret": "^1.0.0", - "rechoir": "^0.6.2" - }, - "bin": { - "shjs": "bin/shjs" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/shiki": { - "version": "0.9.15", - "resolved": "https://registry.npmjs.org/shiki/-/shiki-0.9.15.tgz", - "integrity": "sha512-/Y0z9IzhJ8nD9nbceORCqu6NgT9X6I8Fk8c3SICHI5NbZRLdZYFaB233gwct9sU0vvSypyaL/qaKvzyQGJBZSw==", - "peer": true, - "dependencies": { - "jsonc-parser": "^3.0.0", - "vscode-oniguruma": "^1.6.1", - "vscode-textmate": "5.2.0" - } - }, - "node_modules/snake-case": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/snake-case/-/snake-case-3.0.4.tgz", - "integrity": "sha512-LAOh4z89bGQvl9pFfNF8V146i7o7/CqFPbqzYgP+yYzDIDeS9HaNFtXABamRW+AQzEVODcvE79ljJ+8a9YSdMg==", - "dependencies": { - "dot-case": "^3.0.4", - "tslib": "^2.0.3" - } - }, - "node_modules/source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "peer": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/starknet": { - "version": "4.17.1", - "resolved": "https://registry.npmjs.org/starknet/-/starknet-4.17.1.tgz", - "integrity": "sha512-xihdf+pWUCdKK30r+fNLfg+5RHHpTNw20gvrucbcPPDnsDr2bjwtFu3UjXOtHnbys6qF8fW3ttMkctRoQ5J6Xg==", - "dependencies": { - "@ethersproject/bytes": "^5.6.1", - "bn.js": "^5.2.1", - "elliptic": "^6.5.4", - "ethereum-cryptography": "^1.0.3", - "hash.js": "^1.1.7", - "isomorphic-fetch": "^3.0.0", - "json-bigint": "^1.0.0", - "minimalistic-assert": "^1.0.1", - "pako": "^2.0.4", - "ts-custom-error": "^3.3.1", - "url-join": "^4.0.1" - } - }, - "node_modules/strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/strip-json-comments": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", - "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", - "dev": true, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/superstruct": { - "version": "0.15.5", - "resolved": "https://registry.npmjs.org/superstruct/-/superstruct-0.15.5.tgz", - "integrity": "sha512-4AOeU+P5UuE/4nOUkmcQdW5y7i9ndt1cQd/3iUe+LTz3RxESf/W/5lg4B74HbDMMv8PHnPnGCQFH45kBcrQYoQ==" - }, - "node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/supports-preserve-symlinks-flag": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", - "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", - "peer": true, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/text-encoding-utf-8": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/text-encoding-utf-8/-/text-encoding-utf-8-1.0.2.tgz", - "integrity": "sha512-8bw4MY9WjdsD2aMtO0OzOCY3pXGYNx2d2FfHRVUKkiCPDWjKuOlhLVASS+pD7VkLTVjW268LYJHwsnPFlBpbAg==" - }, - "node_modules/text-table": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", - "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", - "dev": true - }, - "node_modules/through": { - "version": "2.3.8", - "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", - "integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==" - }, - "node_modules/toml": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/toml/-/toml-3.0.0.tgz", - "integrity": "sha512-y/mWCZinnvxjTKYhJ+pYxwD0mRLVvOtdS2Awbgxln6iEnt4rk0yBxeSBHkGJcPucRiG0e55mwWp+g/05rsrd6w==" - }, - "node_modules/tr46": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", - "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" - }, - "node_modules/traverse-chain": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/traverse-chain/-/traverse-chain-0.1.0.tgz", - "integrity": "sha512-up6Yvai4PYKhpNp5PkYtx50m3KbwQrqDwbuZP/ItyL64YEWHAvH6Md83LFLV/GRSk/BoUVwwgUzX6SOQSbsfAg==" - }, - "node_modules/tron-format-address": { - "version": "0.1.11", - "resolved": "https://registry.npmjs.org/tron-format-address/-/tron-format-address-0.1.11.tgz", - "integrity": "sha512-Jx2i3R1yXrEMQsfc2jueAI71ivnySzdeva6SiSM/pddwj8TK7PVABSP6s/iYcTRI63GxJEgGMmOJXNNKoBmbQw==" - }, - "node_modules/ts-custom-error": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/ts-custom-error/-/ts-custom-error-3.3.1.tgz", - "integrity": "sha512-5OX1tzOjxWEgsr/YEUWSuPrQ00deKLh6D7OTWcvNHm12/7QPyRh8SYpyWvA4IZv8H/+GQWQEh/kwo95Q9OVW1A==", - "engines": { - "node": ">=14.0.0" - } - }, - "node_modules/ts-node": { - "version": "10.9.1", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz", - "integrity": "sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==", - "dev": true, - "dependencies": { - "@cspotcode/source-map-support": "^0.8.0", - "@tsconfig/node10": "^1.0.7", - "@tsconfig/node12": "^1.0.7", - "@tsconfig/node14": "^1.0.0", - "@tsconfig/node16": "^1.0.2", - "acorn": "^8.4.1", - "acorn-walk": "^8.1.1", - "arg": "^4.1.0", - "create-require": "^1.1.0", - "diff": "^4.0.1", - "make-error": "^1.1.1", - "v8-compile-cache-lib": "^3.0.1", - "yn": "3.1.1" - }, - "bin": { - "ts-node": "dist/bin.js", - "ts-node-cwd": "dist/bin-cwd.js", - "ts-node-esm": "dist/bin-esm.js", - "ts-node-script": "dist/bin-script.js", - "ts-node-transpile-only": "dist/bin-transpile.js", - "ts-script": "dist/bin-script-deprecated.js" - }, - "peerDependencies": { - "@swc/core": ">=1.2.50", - "@swc/wasm": ">=1.2.50", - "@types/node": "*", - "typescript": ">=2.7" - }, - "peerDependenciesMeta": { - "@swc/core": { - "optional": true - }, - "@swc/wasm": { - "optional": true - } - } - }, - "node_modules/tslib": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.1.tgz", - "integrity": "sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==" - }, - "node_modules/type-check": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", - "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", - "dev": true, - "dependencies": { - "prelude-ls": "^1.2.1" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/type-fest": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", - "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/typedoc-default-themes": { - "version": "0.12.10", - "resolved": "https://registry.npmjs.org/typedoc-default-themes/-/typedoc-default-themes-0.12.10.tgz", - "integrity": "sha512-fIS001cAYHkyQPidWXmHuhs8usjP5XVJjWB8oZGqkTowZaz3v7g3KDZeeqE82FBrmkAnIBOY3jgy7lnPnqATbA==", - "peer": true, - "engines": { - "node": ">= 8" - } - }, - "node_modules/typescript": { - "version": "4.9.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.4.tgz", - "integrity": "sha512-Uz+dTXYzxXXbsFpM86Wh3dKCxrQqUcVMxwU54orwlJjOpO3ao8L7j5lH+dWfTwgCwIuM9GQ2kvVotzYJMXTBZg==", - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=4.2.0" - } - }, - "node_modules/uglify-js": { - "version": "3.17.4", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.17.4.tgz", - "integrity": "sha512-T9q82TJI9e/C1TAxYvfb16xO120tMVFZrGA3f9/P4424DNu6ypK103y0GPFVa17yotwSyZW5iYXgjYHkGrJW/g==", - "optional": true, - "peer": true, - "bin": { - "uglifyjs": "bin/uglifyjs" - }, - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/universalify": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", - "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==", - "peer": true, - "engines": { - "node": ">= 10.0.0" - } - }, - "node_modules/unix-dgram": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/unix-dgram/-/unix-dgram-2.0.6.tgz", - "integrity": "sha512-AURroAsb73BZ6CdAyMrTk/hYKNj3DuYYEuOaB8bYMOHGKupRNScw90Q5C71tWJc3uE7dIeXRyuwN0xLLq3vDTg==", - "hasInstallScript": true, - "optional": true, - "dependencies": { - "bindings": "^1.5.0", - "nan": "^2.16.0" - }, - "engines": { - "node": ">=0.10.48" - } - }, - "node_modules/uri-js": { - "version": "4.4.1", - "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", - "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", - "dev": true, - "dependencies": { - "punycode": "^2.1.0" - } - }, - "node_modules/uri-js/node_modules/punycode": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.2.0.tgz", - "integrity": "sha512-LN6QV1IJ9ZhxWTNdktaPClrNfp8xdSAYS0Zk2ddX7XsXZAxckMHPCBcHRo0cTcEIgYPRiGEkmji3Idkh2yFtYw==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/url": { - "version": "0.10.3", - "resolved": "https://registry.npmjs.org/url/-/url-0.10.3.tgz", - "integrity": "sha512-hzSUW2q06EqL1gKM/a+obYHLIO6ct2hwPuviqTTOcfFVc61UbfJ2Q32+uGL/HCPxKqrdGB5QUwIe7UqlDgwsOQ==", - "dependencies": { - "punycode": "1.3.2", - "querystring": "0.2.0" - } - }, - "node_modules/url-join": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/url-join/-/url-join-4.0.1.tgz", - "integrity": "sha512-jk1+QP6ZJqyOiuEI9AEWQfju/nB2Pw466kbA0LEZljHwKeMgd9WrAEgEGxjPDD2+TNbbb37rTyhEfrCXfuKXnA==" - }, - "node_modules/utf-8-validate": { - "version": "5.0.10", - "resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.10.tgz", - "integrity": "sha512-Z6czzLq4u8fPOyx7TU6X3dvUZVvoJmxSQ+IcrlmagKhilxlhZgxPK6C5Jqbkw1IDUmFTM+cz9QDnnLTwDz/2gQ==", - "hasInstallScript": true, - "optional": true, - "dependencies": { - "node-gyp-build": "^4.3.0" - }, - "engines": { - "node": ">=6.14.2" - } - }, - "node_modules/util": { - "version": "0.12.5", - "resolved": "https://registry.npmjs.org/util/-/util-0.12.5.tgz", - "integrity": "sha512-kZf/K6hEIrWHI6XqOFUiiMa+79wE/D8Q+NCNAWclkyg3b4d2k7s0QGepNjiABc+aR3N1PAyHL7p6UcLY6LmrnA==", - "dependencies": { - "inherits": "^2.0.3", - "is-arguments": "^1.0.4", - "is-generator-function": "^1.0.7", - "is-typed-array": "^1.1.3", - "which-typed-array": "^1.1.2" - } - }, - "node_modules/uuid": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.0.0.tgz", - "integrity": "sha512-jOXGuXZAWdsTH7eZLtyXMqUb9EcWMGZNbL9YcGBJl4MH4nrxHmZJhEHvyLFrkxo+28uLb/NYRcStH48fnD0Vzw==", - "bin": { - "uuid": "dist/bin/uuid" - } - }, - "node_modules/v8-compile-cache-lib": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", - "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", - "dev": true - }, - "node_modules/vscode-oniguruma": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/vscode-oniguruma/-/vscode-oniguruma-1.7.0.tgz", - "integrity": "sha512-L9WMGRfrjOhgHSdOYgCt/yRMsXzLDJSL7BPrOZt73gU0iWO4mpqzqQzOz5srxqTvMBaR0XZTSrVWo4j55Rc6cA==", - "peer": true - }, - "node_modules/vscode-textmate": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/vscode-textmate/-/vscode-textmate-5.2.0.tgz", - "integrity": "sha512-Uw5ooOQxRASHgu6C7GVvUxisKXfSgW4oFlO+aa+PAkgmH89O3CXxEEzNRNtHSqtXFTl0nAC1uYj0GMSH27uwtQ==", - "peer": true - }, - "node_modules/webidl-conversions": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", - "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" - }, - "node_modules/whatwg-fetch": { - "version": "3.6.2", - "resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-3.6.2.tgz", - "integrity": "sha512-bJlen0FcuU/0EMLrdbJ7zOnW6ITZLrZMIarMUVmdKtsGvZna8vxKYaexICWPfZ8qwf9fzNq+UEIZrnSaApt6RA==" - }, - "node_modules/whatwg-url": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", - "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", - "dependencies": { - "tr46": "~0.0.3", - "webidl-conversions": "^3.0.0" - } - }, - "node_modules/which": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "dev": true, - "dependencies": { - "isexe": "^2.0.0" - }, - "bin": { - "node-which": "bin/node-which" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/which-typed-array": { - "version": "1.1.9", - "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.9.tgz", - "integrity": "sha512-w9c4xkx6mPidwp7180ckYWfMmvxpjlZuIudNtDf4N/tTAUB8VJbX25qZoAsrtGuYNnGw3pa0AXgbGKRB8/EceA==", - "dependencies": { - "available-typed-arrays": "^1.0.5", - "call-bind": "^1.0.2", - "for-each": "^0.3.3", - "gopd": "^1.0.1", - "has-tostringtag": "^1.0.0", - "is-typed-array": "^1.1.10" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/word-wrap": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", - "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/wordwrap": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", - "integrity": "sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q==", - "peer": true - }, - "node_modules/wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" - }, - "node_modules/ws": { - "version": "7.4.6", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.4.6.tgz", - "integrity": "sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A==", - "engines": { - "node": ">=8.3.0" - }, - "peerDependencies": { - "bufferutil": "^4.0.1", - "utf-8-validate": "^5.0.2" - }, - "peerDependenciesMeta": { - "bufferutil": { - "optional": true - }, - "utf-8-validate": { - "optional": true - } - } - }, - "node_modules/xml2js": { - "version": "0.4.19", - "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.19.tgz", - "integrity": "sha512-esZnJZJOiJR9wWKMyuvSE1y6Dq5LCuJanqhxslH2bxM6duahNZ+HMpCLhBQGZkbX6xRf8x1Y2eJlgt2q3qo49Q==", - "dependencies": { - "sax": ">=0.6.0", - "xmlbuilder": "~9.0.1" - } - }, - "node_modules/xmlbuilder": { - "version": "9.0.7", - "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-9.0.7.tgz", - "integrity": "sha512-7YXTQc3P2l9+0rjaUbLwMKRhtmwg1M1eDf6nag7urC7pIPYLD9W/jmzQ4ptRSUbodw5S0jfoGTflLemQibSpeQ==", - "engines": { - "node": ">=4.0" - } - }, - "node_modules/yn": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", - "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/yocto-queue": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", - "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - } - }, "dependencies": { "@babel/runtime": { "version": "7.20.7", @@ -5055,32 +883,20 @@ "version": "0.20.37", "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.20.37.tgz", "integrity": "sha512-9+qDhdc4X00qTNOtii6QX2z7ndAeWVOso7w3MPSoSJdXlVhpwPfm1yEp4ooKuWA9fiQILR8FKkyjmeqa13hBbw==", - "peer": true, "requires": { - "colors": "^1.4.0", - "fs-extra": "^9.1.0", - "handlebars": "^4.7.7", "lodash": "^4.17.21", - "lunr": "^2.3.9", - "marked": "~2.0.3", - "minimatch": "^3.0.0", - "progress": "^2.0.3", - "shelljs": "^0.8.4", - "shiki": "^0.9.3", - "typedoc-default-themes": "^0.12.10" + "minimatch": "^3.0.0" } }, "typedoc-plugin-cname": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/typedoc-plugin-cname/-/typedoc-plugin-cname-1.0.1.tgz", - "integrity": "sha512-f97SS5RzDCVBa7Frg1VketIMAkEl3OTvBs9wM8lLEkJVWCIG2yXnszglA82on39gFwQ1tyq8tiuxRgb4569GpA==", - "requires": {} + "integrity": "sha512-f97SS5RzDCVBa7Frg1VketIMAkEl3OTvBs9wM8lLEkJVWCIG2yXnszglA82on39gFwQ1tyq8tiuxRgb4569GpA==" }, "typescript": { "version": "4.2.4", "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.2.4.tgz", - "integrity": "sha512-V+evlYHZnQkaz8TRBuxTA92yZBPotr5H+WhQ7bD3hZUndx5tGOa1fuCgeSjxAzM1RiN5IzvadIXTVefuuwZCRg==", - "peer": true + "integrity": "sha512-V+evlYHZnQkaz8TRBuxTA92yZBPotr5H+WhQ7bD3hZUndx5tGOa1fuCgeSjxAzM1RiN5IzvadIXTVefuuwZCRg==" } } }, @@ -5158,6 +974,15 @@ "@types/node": "*" } }, + "JSONStream": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.5.tgz", + "integrity": "sha512-E+iruNOY8VV9s4JEbe1aNEm6MiszPRr/UfcHMz0TQh1BXSxHK+ASV1R6W4HpjBhSeS+54PIsAMCBmwD06LLsqQ==", + "requires": { + "jsonparse": "^1.2.0", + "through": ">=2.2.7 <3" + } + }, "acorn": { "version": "8.8.1", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.1.tgz", @@ -5168,8 +993,7 @@ "version": "5.3.2", "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", - "dev": true, - "requires": {} + "dev": true }, "acorn-walk": { "version": "8.2.0", @@ -5236,12 +1060,6 @@ "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" }, - "at-least-node": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz", - "integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==", - "peer": true - }, "available-typed-arrays": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz", @@ -5446,12 +1264,6 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, - "colors": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz", - "integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==", - "peer": true - }, "combined-stream": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", @@ -5902,22 +1714,11 @@ "mime-types": "^2.1.12" } }, - "fs-extra": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", - "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", - "peer": true, - "requires": { - "at-least-node": "^1.0.0", - "graceful-fs": "^4.2.0", - "jsonfile": "^6.0.1", - "universalify": "^2.0.0" - } - }, "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "dev": true }, "function-bind": { "version": "1.1.1", @@ -5938,6 +1739,7 @@ "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "dev": true, "requires": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", @@ -5973,12 +1775,6 @@ "get-intrinsic": "^1.1.3" } }, - "graceful-fs": { - "version": "4.2.10", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", - "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", - "peer": true - }, "grapheme-splitter": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz", @@ -6012,19 +1808,6 @@ } } }, - "handlebars": { - "version": "4.7.7", - "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.7.tgz", - "integrity": "sha512-aAcXm5OAfE/8IXkcZvCepKU3VzW1/39Fb5ZuqMtgI/hT8X2YgoMvBY5dLhq/cpOvw7Lk1nK/UF71aLG/ZnVYRA==", - "peer": true, - "requires": { - "minimist": "^1.2.5", - "neo-async": "^2.6.0", - "source-map": "^0.6.1", - "uglify-js": "^3.1.4", - "wordwrap": "^1.0.0" - } - }, "has": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", @@ -6123,6 +1906,7 @@ "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "dev": true, "requires": { "once": "^1.3.0", "wrappy": "1" @@ -6133,12 +1917,6 @@ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" }, - "interpret": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.4.0.tgz", - "integrity": "sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==", - "peer": true - }, "is-arguments": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.1.tgz", @@ -6153,15 +1931,6 @@ "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==" }, - "is-core-module": { - "version": "2.11.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.11.0.tgz", - "integrity": "sha512-RRjxlvLDkD1YJwDbroBHMb+cukurkDWNyHx7D3oNB5x9rb5ogcksMC5wHCadcXoo67gVr/+3GFySh3134zi6rw==", - "peer": true, - "requires": { - "has": "^1.0.3" - } - }, "is-extglob": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", @@ -6226,8 +1995,7 @@ "isomorphic-ws": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/isomorphic-ws/-/isomorphic-ws-4.0.1.tgz", - "integrity": "sha512-BhBvN2MBpWTaSHdWRb/bwdZJ1WaehQ2L1KngkCkfLUGF0mAWAT1sQUQacEmQ0jXkFw/czDXPNQSL5u2/Krsz1w==", - "requires": {} + "integrity": "sha512-BhBvN2MBpWTaSHdWRb/bwdZJ1WaehQ2L1KngkCkfLUGF0mAWAT1sQUQacEmQ0jXkFw/czDXPNQSL5u2/Krsz1w==" }, "jayson": { "version": "3.7.0", @@ -6237,13 +2005,13 @@ "@types/connect": "^3.4.33", "@types/node": "^12.12.54", "@types/ws": "^7.4.4", + "JSONStream": "^1.3.5", "commander": "^2.20.3", "delay": "^5.0.0", "es6-promisify": "^5.0.0", "eyes": "^0.1.8", "isomorphic-ws": "^4.0.1", "json-stringify-safe": "^5.0.1", - "JSONStream": "^1.3.5", "lodash": "^4.17.20", "uuid": "^8.3.2", "ws": "^7.4.5" @@ -6326,36 +2094,11 @@ "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", "integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==" }, - "jsonc-parser": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.2.0.tgz", - "integrity": "sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w==", - "peer": true - }, - "jsonfile": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", - "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", - "peer": true, - "requires": { - "graceful-fs": "^4.1.6", - "universalify": "^2.0.0" - } - }, "jsonparse": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/jsonparse/-/jsonparse-1.3.1.tgz", "integrity": "sha512-POQXvpdL69+CluYsillJ7SUhKvytYjW9vG/GKpnf+xP8UWgYEM/RaMzHHofbALDiKbbP1W8UEYmgGl39WkPZsg==" }, - "JSONStream": { - "version": "1.3.5", - "resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.5.tgz", - "integrity": "sha512-E+iruNOY8VV9s4JEbe1aNEm6MiszPRr/UfcHMz0TQh1BXSxHK+ASV1R6W4HpjBhSeS+54PIsAMCBmwD06LLsqQ==", - "requires": { - "jsonparse": "^1.2.0", - "through": ">=2.2.7 <3" - } - }, "just-performance": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/just-performance/-/just-performance-4.3.0.tgz", @@ -6407,24 +2150,12 @@ "tslib": "^2.0.3" } }, - "lunr": { - "version": "2.3.9", - "resolved": "https://registry.npmjs.org/lunr/-/lunr-2.3.9.tgz", - "integrity": "sha512-zTU3DaZaF3Rt9rhN3uBMGQD3dD2/vFQqnvZCDv4dl5iOzq2IZQqTxu90r4E5J+nP70J3ilqVCrbho2eWaeW8Ow==", - "peer": true - }, "make-error": { "version": "1.3.6", "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", "dev": true }, - "marked": { - "version": "2.0.7", - "resolved": "https://registry.npmjs.org/marked/-/marked-2.0.7.tgz", - "integrity": "sha512-BJXxkuIfJchcXOJWTT2DOL+yFWifFv2yGYOUzvXg8Qz610QKw+sHCvTMYwA+qWGhlA2uivBezChZ/pBy1tWdkQ==", - "peer": true - }, "mime-db": { "version": "1.52.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", @@ -6456,12 +2187,6 @@ "brace-expansion": "^1.1.7" } }, - "minimist": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.7.tgz", - "integrity": "sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g==", - "peer": true - }, "ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", @@ -6479,12 +2204,6 @@ "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", "dev": true }, - "neo-async": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", - "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", - "peer": true - }, "no-case": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/no-case/-/no-case-3.0.4.tgz", @@ -6512,6 +2231,7 @@ "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dev": true, "requires": { "wrappy": "1" } @@ -6571,7 +2291,8 @@ "path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==" + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "dev": true }, "path-key": { "version": "3.1.1", @@ -6579,24 +2300,12 @@ "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", "dev": true }, - "path-parse": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", - "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", - "peer": true - }, "prelude-ls": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", "dev": true }, - "progress": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", - "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", - "peer": true - }, "punycode": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz", @@ -6613,15 +2322,6 @@ "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", "dev": true }, - "rechoir": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", - "integrity": "sha512-HFM8rkZ+i3zrV+4LQjwQ0W+ez98pApMGM3HUrN04j3CqzPOzl9nmP15Y8YXNm8QHGv/eacOVEjqhmWpkRV0NAw==", - "peer": true, - "requires": { - "resolve": "^1.1.6" - } - }, "regenerator-runtime": { "version": "0.13.11", "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz", @@ -6633,17 +2333,6 @@ "integrity": "sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==", "dev": true }, - "resolve": { - "version": "1.22.1", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.1.tgz", - "integrity": "sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw==", - "peer": true, - "requires": { - "is-core-module": "^2.9.0", - "path-parse": "^1.0.7", - "supports-preserve-symlinks-flag": "^1.0.0" - } - }, "resolve-from": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", @@ -6686,8 +2375,7 @@ "ws": { "version": "8.11.0", "resolved": "https://registry.npmjs.org/ws/-/ws-8.11.0.tgz", - "integrity": "sha512-HPG3wQd9sNQoT9xHyNCXoDUa+Xw/VevmY9FoHyQ+g+rrMn4j6FB4np7Z0OhdTgjx6MgQLK7jwSy1YecU1+4Asg==", - "requires": {} + "integrity": "sha512-HPG3wQd9sNQoT9xHyNCXoDUa+Xw/VevmY9FoHyQ+g+rrMn4j6FB4np7Z0OhdTgjx6MgQLK7jwSy1YecU1+4Asg==" } } }, @@ -6730,28 +2418,6 @@ "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", "dev": true }, - "shelljs": { - "version": "0.8.5", - "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.5.tgz", - "integrity": "sha512-TiwcRcrkhHvbrZbnRcFYMLl30Dfov3HKqzp5tO5b4pt6G/SezKcYhmDg15zXVBswHmctSAQKznqNW2LO5tTDow==", - "peer": true, - "requires": { - "glob": "^7.0.0", - "interpret": "^1.0.0", - "rechoir": "^0.6.2" - } - }, - "shiki": { - "version": "0.9.15", - "resolved": "https://registry.npmjs.org/shiki/-/shiki-0.9.15.tgz", - "integrity": "sha512-/Y0z9IzhJ8nD9nbceORCqu6NgT9X6I8Fk8c3SICHI5NbZRLdZYFaB233gwct9sU0vvSypyaL/qaKvzyQGJBZSw==", - "peer": true, - "requires": { - "jsonc-parser": "^3.0.0", - "vscode-oniguruma": "^1.6.1", - "vscode-textmate": "5.2.0" - } - }, "snake-case": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/snake-case/-/snake-case-3.0.4.tgz", @@ -6761,12 +2427,6 @@ "tslib": "^2.0.3" } }, - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "peer": true - }, "starknet": { "version": "4.17.1", "resolved": "https://registry.npmjs.org/starknet/-/starknet-4.17.1.tgz", @@ -6791,7 +2451,7 @@ "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", "dev": true, "requires": { - "ansi-regex": "5.0.1" + "ansi-regex": "^5.0.1" } }, "strip-json-comments": { @@ -6814,12 +2474,6 @@ "has-flag": "^4.0.0" } }, - "supports-preserve-symlinks-flag": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", - "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", - "peer": true - }, "text-encoding-utf-8": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/text-encoding-utf-8/-/text-encoding-utf-8-1.0.2.tgz", @@ -6902,30 +2556,11 @@ "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", "dev": true }, - "typedoc-default-themes": { - "version": "0.12.10", - "resolved": "https://registry.npmjs.org/typedoc-default-themes/-/typedoc-default-themes-0.12.10.tgz", - "integrity": "sha512-fIS001cAYHkyQPidWXmHuhs8usjP5XVJjWB8oZGqkTowZaz3v7g3KDZeeqE82FBrmkAnIBOY3jgy7lnPnqATbA==", - "peer": true - }, "typescript": { "version": "4.9.4", "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.4.tgz", "integrity": "sha512-Uz+dTXYzxXXbsFpM86Wh3dKCxrQqUcVMxwU54orwlJjOpO3ao8L7j5lH+dWfTwgCwIuM9GQ2kvVotzYJMXTBZg==" }, - "uglify-js": { - "version": "3.17.4", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.17.4.tgz", - "integrity": "sha512-T9q82TJI9e/C1TAxYvfb16xO120tMVFZrGA3f9/P4424DNu6ypK103y0GPFVa17yotwSyZW5iYXgjYHkGrJW/g==", - "optional": true, - "peer": true - }, - "universalify": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", - "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==", - "peer": true - }, "unix-dgram": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/unix-dgram/-/unix-dgram-2.0.6.tgz", @@ -6999,18 +2634,6 @@ "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", "dev": true }, - "vscode-oniguruma": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/vscode-oniguruma/-/vscode-oniguruma-1.7.0.tgz", - "integrity": "sha512-L9WMGRfrjOhgHSdOYgCt/yRMsXzLDJSL7BPrOZt73gU0iWO4mpqzqQzOz5srxqTvMBaR0XZTSrVWo4j55Rc6cA==", - "peer": true - }, - "vscode-textmate": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/vscode-textmate/-/vscode-textmate-5.2.0.tgz", - "integrity": "sha512-Uw5ooOQxRASHgu6C7GVvUxisKXfSgW4oFlO+aa+PAkgmH89O3CXxEEzNRNtHSqtXFTl0nAC1uYj0GMSH27uwtQ==", - "peer": true - }, "webidl-conversions": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", @@ -7058,22 +2681,16 @@ "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", "dev": true }, - "wordwrap": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", - "integrity": "sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q==", - "peer": true - }, "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "dev": true }, "ws": { "version": "7.4.6", "resolved": "https://registry.npmjs.org/ws/-/ws-7.4.6.tgz", - "integrity": "sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A==", - "requires": {} + "integrity": "sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A==" }, "xml2js": { "version": "0.4.19", diff --git a/projects/pyswap/index.js b/projects/pyswap/index.js new file mode 100644 index 00000000000..116d4cd484a --- /dev/null +++ b/projects/pyswap/index.js @@ -0,0 +1,19 @@ +const { sumTokensExport } = require("../helper/unwrapLPs"); + +const native_staking_contract = "0xFFD687B05E7178647d4Bb7734e93748dF4A3341a"; +const pys_staking_contract = "0x18E2fA8c010b56779285336D0920F1027f0bDBbb"; + +const assets = [ + "0x4200000000000000000000000000000000000006", + "0x0000000000000000000000000000000000000000", // This is address of native token +]; +const PY_SWAP = '0x2928CBA5b5e5B48113281263FC037c7a5d8E1EDf' + +const owners = [native_staking_contract, pys_staking_contract] + +module.exports = { + op_bnb: { + tvl: sumTokensExport({ owners, tokens: assets }), + staking: sumTokensExport({ owners, tokens: [PY_SWAP] }), + }, +}; \ No newline at end of file From f29adb13b7ce4f76bdd777254b54da9f4b2b647e Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Tue, 22 Aug 2023 19:04:09 +0100 Subject: [PATCH 0932/1974] add adapter --- projects/spacefi-zksync/index.js | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 projects/spacefi-zksync/index.js diff --git a/projects/spacefi-zksync/index.js b/projects/spacefi-zksync/index.js new file mode 100644 index 00000000000..91ca50e6c01 --- /dev/null +++ b/projects/spacefi-zksync/index.js @@ -0,0 +1,11 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports = { + misrepresentedTokens: true, + era: { + tvl: getUniTVL({ + factory: '0x0700Fb51560CfC8F896B2c812499D17c5B0bF6A7', + useDefaultCoreAssets: true, + }) + }, +}; From 2293e8270ad8171c7faa27a978e7653b5b4ef86d Mon Sep 17 00:00:00 2001 From: JasonMohanCryptobuild Date: Wed, 23 Aug 2023 01:16:34 +0700 Subject: [PATCH 0933/1974] Revert "update TVL for PySwap Exchange" This reverts commit b42107bed2225e544581ed9545d7e2301037852a. --- package-lock.json | 4439 +++++++++++++++++++++++++++++++++++++- projects/pyswap/index.js | 19 - 2 files changed, 4411 insertions(+), 47 deletions(-) delete mode 100644 projects/pyswap/index.js diff --git a/package-lock.json b/package-lock.json index 316218460e7..5153cb6bb19 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,8 +1,4180 @@ { "name": "defillama-adapters", "version": "1.0.0", - "lockfileVersion": 1, + "lockfileVersion": 2, "requires": true, + "packages": { + "": { + "name": "defillama-adapters", + "version": "1.0.0", + "hasInstallScript": true, + "license": "ISC", + "dependencies": { + "@defillama/sdk": "latest", + "@project-serum/anchor": "^0.25.0", + "@solana/web3.js": "^1.36.0", + "@solendprotocol/solend-sdk": "^0.6.2", + "@supercharge/promise-pool": "^2.1.0", + "aws-sdk": "^2.1268.0", + "axios": "^0.27.2", + "bignumber.js": "^9.0.1", + "blakejs": "^1.2.1", + "bn.js": "^5.2.1", + "borsh": "^0.7.0", + "dotenv": "^8.6.0", + "ethers": "^5.6.5", + "graphql": "^16.6.0", + "graphql-request": "^4.0.0", + "hi-base32": "^0.5.1", + "js-sha512": "^0.8.0", + "limiter": "2.1.0", + "starknet": "^4.17.1", + "tron-format-address": "^0.1.8", + "typescript": "^4.7.4" + }, + "devDependencies": { + "@types/async-retry": "^1.4.5", + "@types/bn.js": "^5.1.0", + "eslint": "^8.32.0", + "ts-node": "^10.8.1" + } + }, + "node_modules/@babel/runtime": { + "version": "7.20.7", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.20.7.tgz", + "integrity": "sha512-UF0tvkUtxwAgZ5W/KrkHf0Rn0fdnLDU9ScxBrEVNUprE/MzirjK4MJUX1/BVDv00Sv8cljtukVK1aky++X1SjQ==", + "dependencies": { + "regenerator-runtime": "^0.13.11" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@cspotcode/source-map-support": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", + "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", + "dev": true, + "dependencies": { + "@jridgewell/trace-mapping": "0.3.9" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@defillama/sdk": { + "version": "4.0.46", + "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.46.tgz", + "integrity": "sha512-CC3dnZg9xYQP5gyx5CeKI0YF1877SH7pEwVn1hHguMJbOUJQERmbXSCI6yDDBUBoBB/Ai8o8yhdPgrFRT8Wt4A==", + "dependencies": { + "@supercharge/promise-pool": "^2.1.0", + "ethers": "^5.4.5", + "node-fetch": "^2.6.7", + "tron-format-address": "^0.1.11" + } + }, + "node_modules/@eslint/eslintrc": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.4.1.tgz", + "integrity": "sha512-XXrH9Uarn0stsyldqDYq8r++mROmWRI1xKMXa640Bb//SY1+ECYX6VzT6Lcx5frD0V30XieqJ0oX9I2Xj5aoMA==", + "dev": true, + "dependencies": { + "ajv": "^6.12.4", + "debug": "^4.3.2", + "espree": "^9.4.0", + "globals": "^13.19.0", + "ignore": "^5.2.0", + "import-fresh": "^3.2.1", + "js-yaml": "^4.1.0", + "minimatch": "^3.1.2", + "strip-json-comments": "^3.1.1" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@ethersproject/abi": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/abi/-/abi-5.7.0.tgz", + "integrity": "sha512-351ktp42TiRcYB3H1OP8yajPeAQstMW/yCFokj/AthP9bLHzQFPlOrxOcwYEDkUAICmOHljvN4K39OMTMUa9RA==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/address": "^5.7.0", + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/constants": "^5.7.0", + "@ethersproject/hash": "^5.7.0", + "@ethersproject/keccak256": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/strings": "^5.7.0" + } + }, + "node_modules/@ethersproject/abstract-provider": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/abstract-provider/-/abstract-provider-5.7.0.tgz", + "integrity": "sha512-R41c9UkchKCpAqStMYUpdunjo3pkEvZC3FAwZn5S5MGbXoMQOHIdHItezTETxAO5bevtMApSyEhn9+CHcDsWBw==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/networks": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/transactions": "^5.7.0", + "@ethersproject/web": "^5.7.0" + } + }, + "node_modules/@ethersproject/abstract-signer": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/abstract-signer/-/abstract-signer-5.7.0.tgz", + "integrity": "sha512-a16V8bq1/Cz+TGCkE2OPMTOUDLS3grCpdjoJCYNnVBbdYEMSgKrU0+B90s8b6H+ByYTBZN7a3g76jdIJi7UfKQ==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/abstract-provider": "^5.7.0", + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0" + } + }, + "node_modules/@ethersproject/address": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/address/-/address-5.7.0.tgz", + "integrity": "sha512-9wYhYt7aghVGo758POM5nqcOMaE168Q6aRLJZwUmiqSrAungkG74gSSeKEIR7ukixesdRZGPgVqme6vmxs1fkA==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/keccak256": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/rlp": "^5.7.0" + } + }, + "node_modules/@ethersproject/base64": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/base64/-/base64-5.7.0.tgz", + "integrity": "sha512-Dr8tcHt2mEbsZr/mwTPIQAf3Ai0Bks/7gTw9dSqk1mQvhW3XvRlmDJr/4n+wg1JmCl16NZue17CDh8xb/vZ0sQ==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bytes": "^5.7.0" + } + }, + "node_modules/@ethersproject/basex": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/basex/-/basex-5.7.0.tgz", + "integrity": "sha512-ywlh43GwZLv2Voc2gQVTKBoVQ1mti3d8HK5aMxsfu/nRDnMmNqaSJ3r3n85HBByT8OpoY96SXM1FogC533T4zw==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/properties": "^5.7.0" + } + }, + "node_modules/@ethersproject/bignumber": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/bignumber/-/bignumber-5.7.0.tgz", + "integrity": "sha512-n1CAdIHRWjSucQO3MC1zPSVgV/6dy/fjL9pMrPP9peL+QxEg9wOsVqwD4+818B6LUEtaXzVHQiuivzRoxPxUGw==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "bn.js": "^5.2.1" + } + }, + "node_modules/@ethersproject/bytes": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/bytes/-/bytes-5.7.0.tgz", + "integrity": "sha512-nsbxwgFXWh9NyYWo+U8atvmMsSdKJprTcICAkvbBffT75qDocbuggBU0SJiVK2MuTrp0q+xvLkTnGMPK1+uA9A==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/logger": "^5.7.0" + } + }, + "node_modules/@ethersproject/constants": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/constants/-/constants-5.7.0.tgz", + "integrity": "sha512-DHI+y5dBNvkpYUMiRQyxRBYBefZkJfo70VUkUAsRjcPs47muV9evftfZ0PJVCXYbAiCgght0DtcF9srFQmIgWA==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bignumber": "^5.7.0" + } + }, + "node_modules/@ethersproject/contracts": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/contracts/-/contracts-5.7.0.tgz", + "integrity": "sha512-5GJbzEU3X+d33CdfPhcyS+z8MzsTrBGk/sc+G+59+tPa9yFkl6HQ9D6L0QMgNTA9q8dT0XKxxkyp883XsQvbbg==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/abi": "^5.7.0", + "@ethersproject/abstract-provider": "^5.7.0", + "@ethersproject/abstract-signer": "^5.7.0", + "@ethersproject/address": "^5.7.0", + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/constants": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/transactions": "^5.7.0" + } + }, + "node_modules/@ethersproject/hash": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/hash/-/hash-5.7.0.tgz", + "integrity": "sha512-qX5WrQfnah1EFnO5zJv1v46a8HW0+E5xuBBDTwMFZLuVTx0tbU2kkx15NqdjxecrLGatQN9FGQKpb1FKdHCt+g==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/abstract-signer": "^5.7.0", + "@ethersproject/address": "^5.7.0", + "@ethersproject/base64": "^5.7.0", + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/keccak256": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/strings": "^5.7.0" + } + }, + "node_modules/@ethersproject/hdnode": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/hdnode/-/hdnode-5.7.0.tgz", + "integrity": "sha512-OmyYo9EENBPPf4ERhR7oj6uAtUAhYGqOnIS+jE5pTXvdKBS99ikzq1E7Iv0ZQZ5V36Lqx1qZLeak0Ra16qpeOg==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/abstract-signer": "^5.7.0", + "@ethersproject/basex": "^5.7.0", + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/pbkdf2": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/sha2": "^5.7.0", + "@ethersproject/signing-key": "^5.7.0", + "@ethersproject/strings": "^5.7.0", + "@ethersproject/transactions": "^5.7.0", + "@ethersproject/wordlists": "^5.7.0" + } + }, + "node_modules/@ethersproject/json-wallets": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/json-wallets/-/json-wallets-5.7.0.tgz", + "integrity": "sha512-8oee5Xgu6+RKgJTkvEMl2wDgSPSAQ9MB/3JYjFV9jlKvcYHUXZC+cQp0njgmxdHkYWn8s6/IqIZYm0YWCjO/0g==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/abstract-signer": "^5.7.0", + "@ethersproject/address": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/hdnode": "^5.7.0", + "@ethersproject/keccak256": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/pbkdf2": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/random": "^5.7.0", + "@ethersproject/strings": "^5.7.0", + "@ethersproject/transactions": "^5.7.0", + "aes-js": "3.0.0", + "scrypt-js": "3.0.1" + } + }, + "node_modules/@ethersproject/keccak256": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/keccak256/-/keccak256-5.7.0.tgz", + "integrity": "sha512-2UcPboeL/iW+pSg6vZ6ydF8tCnv3Iu/8tUmLLzWWGzxWKFFqOBQFLo6uLUv6BDrLgCDfN28RJ/wtByx+jZ4KBg==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bytes": "^5.7.0", + "js-sha3": "0.8.0" + } + }, + "node_modules/@ethersproject/logger": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/logger/-/logger-5.7.0.tgz", + "integrity": "sha512-0odtFdXu/XHtjQXJYA3u9G0G8btm0ND5Cu8M7i5vhEcE8/HmF4Lbdqanwyv4uQTr2tx6b7fQRmgLrsnpQlmnig==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ] + }, + "node_modules/@ethersproject/networks": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/@ethersproject/networks/-/networks-5.7.1.tgz", + "integrity": "sha512-n/MufjFYv3yFcUyfhnXotyDlNdFb7onmkSy8aQERi2PjNcnWQ66xXxa3XlS8nCcA8aJKJjIIMNJTC7tu80GwpQ==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/logger": "^5.7.0" + } + }, + "node_modules/@ethersproject/pbkdf2": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/pbkdf2/-/pbkdf2-5.7.0.tgz", + "integrity": "sha512-oR/dBRZR6GTyaofd86DehG72hY6NpAjhabkhxgr3X2FpJtJuodEl2auADWBZfhDHgVCbu3/H/Ocq2uC6dpNjjw==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/sha2": "^5.7.0" + } + }, + "node_modules/@ethersproject/properties": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/properties/-/properties-5.7.0.tgz", + "integrity": "sha512-J87jy8suntrAkIZtecpxEPxY//szqr1mlBaYlQ0r4RCaiD2hjheqF9s1LVE8vVuJCXisjIP+JgtK/Do54ej4Sw==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/logger": "^5.7.0" + } + }, + "node_modules/@ethersproject/providers": { + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/@ethersproject/providers/-/providers-5.7.2.tgz", + "integrity": "sha512-g34EWZ1WWAVgr4aptGlVBF8mhl3VWjv+8hoAnzStu8Ah22VHBsuGzP17eb6xDVRzw895G4W7vvx60lFFur/1Rg==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/abstract-provider": "^5.7.0", + "@ethersproject/abstract-signer": "^5.7.0", + "@ethersproject/address": "^5.7.0", + "@ethersproject/base64": "^5.7.0", + "@ethersproject/basex": "^5.7.0", + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/constants": "^5.7.0", + "@ethersproject/hash": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/networks": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/random": "^5.7.0", + "@ethersproject/rlp": "^5.7.0", + "@ethersproject/sha2": "^5.7.0", + "@ethersproject/strings": "^5.7.0", + "@ethersproject/transactions": "^5.7.0", + "@ethersproject/web": "^5.7.0", + "bech32": "1.1.4", + "ws": "7.4.6" + } + }, + "node_modules/@ethersproject/random": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/random/-/random-5.7.0.tgz", + "integrity": "sha512-19WjScqRA8IIeWclFme75VMXSBvi4e6InrUNuaR4s5pTF2qNhcGdCUwdxUVGtDDqC00sDLCO93jPQoDUH4HVmQ==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0" + } + }, + "node_modules/@ethersproject/rlp": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/rlp/-/rlp-5.7.0.tgz", + "integrity": "sha512-rBxzX2vK8mVF7b0Tol44t5Tb8gomOHkj5guL+HhzQ1yBh/ydjGnpw6at+X6Iw0Kp3OzzzkcKp8N9r0W4kYSs9w==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0" + } + }, + "node_modules/@ethersproject/sha2": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/sha2/-/sha2-5.7.0.tgz", + "integrity": "sha512-gKlH42riwb3KYp0reLsFTokByAKoJdgFCwI+CCiX/k+Jm2mbNs6oOaCjYQSlI1+XBVejwH2KrmCbMAT/GnRDQw==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "hash.js": "1.1.7" + } + }, + "node_modules/@ethersproject/signing-key": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/signing-key/-/signing-key-5.7.0.tgz", + "integrity": "sha512-MZdy2nL3wO0u7gkB4nA/pEf8lu1TlFswPNmy8AiYkfKTdO6eXBJyUdmHO/ehm/htHw9K/qF8ujnTyUAD+Ry54Q==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "bn.js": "^5.2.1", + "elliptic": "6.5.4", + "hash.js": "1.1.7" + } + }, + "node_modules/@ethersproject/solidity": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/solidity/-/solidity-5.7.0.tgz", + "integrity": "sha512-HmabMd2Dt/raavyaGukF4XxizWKhKQ24DoLtdNbBmNKUOPqwjsKQSdV9GQtj9CBEea9DlzETlVER1gYeXXBGaA==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/keccak256": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/sha2": "^5.7.0", + "@ethersproject/strings": "^5.7.0" + } + }, + "node_modules/@ethersproject/strings": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/strings/-/strings-5.7.0.tgz", + "integrity": "sha512-/9nu+lj0YswRNSH0NXYqrh8775XNyEdUQAuf3f+SmOrnVewcJ5SBNAjF7lpgehKi4abvNNXyf+HX86czCdJ8Mg==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/constants": "^5.7.0", + "@ethersproject/logger": "^5.7.0" + } + }, + "node_modules/@ethersproject/transactions": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/transactions/-/transactions-5.7.0.tgz", + "integrity": "sha512-kmcNicCp1lp8qanMTC3RIikGgoJ80ztTyvtsFvCYpSCfkjhD0jZ2LOrnbcuxuToLIUYYf+4XwD1rP+B/erDIhQ==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/address": "^5.7.0", + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/constants": "^5.7.0", + "@ethersproject/keccak256": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/rlp": "^5.7.0", + "@ethersproject/signing-key": "^5.7.0" + } + }, + "node_modules/@ethersproject/units": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/units/-/units-5.7.0.tgz", + "integrity": "sha512-pD3xLMy3SJu9kG5xDGI7+xhTEmGXlEqXU4OfNapmfnxLVY4EMSSRp7j1k7eezutBPH7RBN/7QPnwR7hzNlEFeg==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/constants": "^5.7.0", + "@ethersproject/logger": "^5.7.0" + } + }, + "node_modules/@ethersproject/wallet": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/wallet/-/wallet-5.7.0.tgz", + "integrity": "sha512-MhmXlJXEJFBFVKrDLB4ZdDzxcBxQ3rLyCkhNqVu3CDYvR97E+8r01UgrI+TI99Le+aYm/in/0vp86guJuM7FCA==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/abstract-provider": "^5.7.0", + "@ethersproject/abstract-signer": "^5.7.0", + "@ethersproject/address": "^5.7.0", + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/hash": "^5.7.0", + "@ethersproject/hdnode": "^5.7.0", + "@ethersproject/json-wallets": "^5.7.0", + "@ethersproject/keccak256": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/random": "^5.7.0", + "@ethersproject/signing-key": "^5.7.0", + "@ethersproject/transactions": "^5.7.0", + "@ethersproject/wordlists": "^5.7.0" + } + }, + "node_modules/@ethersproject/web": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/@ethersproject/web/-/web-5.7.1.tgz", + "integrity": "sha512-Gueu8lSvyjBWL4cYsWsjh6MtMwM0+H4HvqFPZfB6dV8ctbP9zFAO73VG1cMWae0FLPCtz0peKPpZY8/ugJJX2w==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/base64": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/strings": "^5.7.0" + } + }, + "node_modules/@ethersproject/wordlists": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/wordlists/-/wordlists-5.7.0.tgz", + "integrity": "sha512-S2TFNJNfHWVHNE6cNDjbVlZ6MgE17MIxMbMg2zv3wn+3XSJGosL1m9ZVv3GXCf/2ymSsQ+hRI5IzoMJTG6aoVA==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/hash": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/strings": "^5.7.0" + } + }, + "node_modules/@humanwhocodes/config-array": { + "version": "0.11.8", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.8.tgz", + "integrity": "sha512-UybHIJzJnR5Qc/MsD9Kr+RpO2h+/P1GhOwdiLPXK5TWk5sgTdu88bTD9UP+CKbPPh5Rni1u0GjAdYQLemG8g+g==", + "dev": true, + "dependencies": { + "@humanwhocodes/object-schema": "^1.2.1", + "debug": "^4.1.1", + "minimatch": "^3.0.5" + }, + "engines": { + "node": ">=10.10.0" + } + }, + "node_modules/@humanwhocodes/module-importer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", + "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", + "dev": true, + "engines": { + "node": ">=12.22" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@humanwhocodes/object-schema": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", + "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", + "dev": true + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz", + "integrity": "sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==", + "dev": true, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.4.14", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz", + "integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==", + "dev": true + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", + "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", + "dev": true, + "dependencies": { + "@jridgewell/resolve-uri": "^3.0.3", + "@jridgewell/sourcemap-codec": "^1.4.10" + } + }, + "node_modules/@marinade.finance/marinade-ts-sdk": { + "version": "3.1.4", + "resolved": "https://registry.npmjs.org/@marinade.finance/marinade-ts-sdk/-/marinade-ts-sdk-3.1.4.tgz", + "integrity": "sha512-gnjgQyBHev9nUROlirazTHved9nUzs3WEHqu50yYceYZucKAXvFltE2YgOywGNTfrLI/MMsWIQLmurwDFdbDnA==", + "dependencies": { + "@project-serum/anchor": "^0.18.2", + "@solana/spl-token": "^0.1.8", + "bignumber.js": "^9.1.0", + "borsh": "^0.6.0", + "bs58": "^5.0.0" + } + }, + "node_modules/@marinade.finance/marinade-ts-sdk/node_modules/@project-serum/anchor": { + "version": "0.18.2", + "resolved": "https://registry.npmjs.org/@project-serum/anchor/-/anchor-0.18.2.tgz", + "integrity": "sha512-uyjiN/3Ipp+4hrZRm/hG18HzGLZyvP790LXrCsGO3IWxSl28YRhiGEpKnZycfMW94R7nxdUoE3wY67V+ZHSQBQ==", + "dependencies": { + "@project-serum/borsh": "^0.2.2", + "@solana/web3.js": "^1.17.0", + "base64-js": "^1.5.1", + "bn.js": "^5.1.2", + "bs58": "^4.0.1", + "buffer-layout": "^1.2.0", + "camelcase": "^5.3.1", + "crypto-hash": "^1.3.0", + "eventemitter3": "^4.0.7", + "find": "^0.3.0", + "js-sha256": "^0.9.0", + "pako": "^2.0.3", + "snake-case": "^3.0.4", + "toml": "^3.0.0" + }, + "engines": { + "node": ">=11" + } + }, + "node_modules/@marinade.finance/marinade-ts-sdk/node_modules/@project-serum/anchor/node_modules/bs58": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/bs58/-/bs58-4.0.1.tgz", + "integrity": "sha512-Ok3Wdf5vOIlBrgCvTq96gBkJw+JUEzdBgyaza5HLtPm7yTHkjRy8+JzNyHF7BHa0bNWOQIp3m5YF0nnFcOIKLw==", + "dependencies": { + "base-x": "^3.0.2" + } + }, + "node_modules/@marinade.finance/marinade-ts-sdk/node_modules/borsh": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/borsh/-/borsh-0.6.0.tgz", + "integrity": "sha512-sl5k89ViqsThXQpYa9XDtz1sBl3l1lI313cFUY1HKr+wvMILnb+58xpkqTNrYbelh99dY7K8usxoCusQmqix9Q==", + "dependencies": { + "bn.js": "^5.2.0", + "bs58": "^4.0.0", + "text-encoding-utf-8": "^1.0.2" + } + }, + "node_modules/@marinade.finance/marinade-ts-sdk/node_modules/borsh/node_modules/bs58": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/bs58/-/bs58-4.0.1.tgz", + "integrity": "sha512-Ok3Wdf5vOIlBrgCvTq96gBkJw+JUEzdBgyaza5HLtPm7yTHkjRy8+JzNyHF7BHa0bNWOQIp3m5YF0nnFcOIKLw==", + "dependencies": { + "base-x": "^3.0.2" + } + }, + "node_modules/@marinade.finance/marinade-ts-sdk/node_modules/bs58": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/bs58/-/bs58-5.0.0.tgz", + "integrity": "sha512-r+ihvQJvahgYT50JD05dyJNKlmmSlMoOGwn1lCcEzanPglg7TxYjioQUYehQ9mAR/+hOSd2jRc/Z2y5UxBymvQ==", + "dependencies": { + "base-x": "^4.0.0" + } + }, + "node_modules/@marinade.finance/marinade-ts-sdk/node_modules/bs58/node_modules/base-x": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/base-x/-/base-x-4.0.0.tgz", + "integrity": "sha512-FuwxlW4H5kh37X/oW59pwTzzTKRzfrrQwhmyspRM7swOEZcHtDZSCt45U6oKgtuFE+WYPblePMVIPR4RZrh/hw==" + }, + "node_modules/@mithraic-labs/psy-american": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/@mithraic-labs/psy-american/-/psy-american-0.2.3.tgz", + "integrity": "sha512-NsDfb9QNuLKNqRnq8rWAoD2Y3ouAEsAPFfwP28SmDVfkugvj03nvQtjotFLlH2TsE31YonG+gauhpeeGKZyyuw==", + "dependencies": { + "@project-serum/anchor": "^0.24.2", + "@project-serum/serum": "^0.13.60", + "@solana/spl-token": "^0.1.8", + "@solana/web3.js": "^1.28.0" + } + }, + "node_modules/@mithraic-labs/psy-american/node_modules/@project-serum/anchor": { + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@project-serum/anchor/-/anchor-0.24.2.tgz", + "integrity": "sha512-0/718g8/DnEuwAidUwh5wLYphUYXhUbiClkuRNhvNoa+1Y8a4g2tJyxoae+emV+PG/Gikd/QUBNMkIcimiIRTA==", + "dependencies": { + "@project-serum/borsh": "^0.2.5", + "@solana/web3.js": "^1.36.0", + "base64-js": "^1.5.1", + "bn.js": "^5.1.2", + "bs58": "^4.0.1", + "buffer-layout": "^1.2.2", + "camelcase": "^5.3.1", + "cross-fetch": "^3.1.5", + "crypto-hash": "^1.3.0", + "eventemitter3": "^4.0.7", + "js-sha256": "^0.9.0", + "pako": "^2.0.3", + "snake-case": "^3.0.4", + "toml": "^3.0.0" + }, + "engines": { + "node": ">=11" + } + }, + "node_modules/@noble/ed25519": { + "version": "1.7.1", + "resolved": "https://registry.npmjs.org/@noble/ed25519/-/ed25519-1.7.1.tgz", + "integrity": "sha512-Rk4SkJFaXZiznFyC/t77Q0NKS4FL7TLJJsVG2V2oiEq3kJVeTdxysEe/yRWSpnWMe808XRDJ+VFh5pt/FN5plw==", + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ] + }, + "node_modules/@noble/hashes": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.1.5.tgz", + "integrity": "sha512-LTMZiiLc+V4v1Yi16TD6aX2gmtKszNye0pQgbaLqkvhIqP7nVsSaJsWloGQjJfJ8offaoP5GtX3yY5swbcJxxQ==", + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ] + }, + "node_modules/@noble/secp256k1": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/@noble/secp256k1/-/secp256k1-1.7.0.tgz", + "integrity": "sha512-kbacwGSsH/CTout0ZnZWxnW1B+jH/7r/WAAKLBtrRJ/+CUH7lgmQzl3GTrQua3SGKWNSDsS6lmjnDpIJ5Dxyaw==", + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ] + }, + "node_modules/@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, + "dependencies": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, + "dependencies": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@project-serum/anchor": { + "version": "0.25.0", + "resolved": "https://registry.npmjs.org/@project-serum/anchor/-/anchor-0.25.0.tgz", + "integrity": "sha512-E6A5Y/ijqpfMJ5psJvbw0kVTzLZFUcOFgs6eSM2M2iWE1lVRF18T6hWZVNl6zqZsoz98jgnNHtVGJMs+ds9A7A==", + "dependencies": { + "@project-serum/borsh": "^0.2.5", + "@solana/web3.js": "^1.36.0", + "base64-js": "^1.5.1", + "bn.js": "^5.1.2", + "bs58": "^4.0.1", + "buffer-layout": "^1.2.2", + "camelcase": "^5.3.1", + "cross-fetch": "^3.1.5", + "crypto-hash": "^1.3.0", + "eventemitter3": "^4.0.7", + "js-sha256": "^0.9.0", + "pako": "^2.0.3", + "snake-case": "^3.0.4", + "superstruct": "^0.15.4", + "toml": "^3.0.0" + }, + "engines": { + "node": ">=11" + } + }, + "node_modules/@project-serum/borsh": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/@project-serum/borsh/-/borsh-0.2.5.tgz", + "integrity": "sha512-UmeUkUoKdQ7rhx6Leve1SssMR/Ghv8qrEiyywyxSWg7ooV7StdpPBhciiy5eB3T0qU1BXvdRNC8TdrkxK7WC5Q==", + "dependencies": { + "bn.js": "^5.1.2", + "buffer-layout": "^1.2.0" + }, + "engines": { + "node": ">=10" + }, + "peerDependencies": { + "@solana/web3.js": "^1.2.0" + } + }, + "node_modules/@project-serum/serum": { + "version": "0.13.65", + "resolved": "https://registry.npmjs.org/@project-serum/serum/-/serum-0.13.65.tgz", + "integrity": "sha512-BHRqsTqPSfFB5p+MgI2pjvMBAQtO8ibTK2fYY96boIFkCI3TTwXDt2gUmspeChKO2pqHr5aKevmexzAcXxrSRA==", + "dependencies": { + "@project-serum/anchor": "^0.11.1", + "@solana/spl-token": "^0.1.6", + "@solana/web3.js": "^1.21.0", + "bn.js": "^5.1.2", + "buffer-layout": "^1.2.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@project-serum/serum/node_modules/@project-serum/anchor": { + "version": "0.11.1", + "resolved": "https://registry.npmjs.org/@project-serum/anchor/-/anchor-0.11.1.tgz", + "integrity": "sha512-oIdm4vTJkUy6GmE6JgqDAuQPKI7XM4TPJkjtoIzp69RZe0iAD9JP2XHx7lV1jLdYXeYHqDXfBt3zcq7W91K6PA==", + "dependencies": { + "@project-serum/borsh": "^0.2.2", + "@solana/web3.js": "^1.17.0", + "base64-js": "^1.5.1", + "bn.js": "^5.1.2", + "bs58": "^4.0.1", + "buffer-layout": "^1.2.0", + "camelcase": "^5.3.1", + "crypto-hash": "^1.3.0", + "eventemitter3": "^4.0.7", + "find": "^0.3.0", + "js-sha256": "^0.9.0", + "pako": "^2.0.3", + "snake-case": "^3.0.4", + "toml": "^3.0.0" + }, + "engines": { + "node": ">=11" + } + }, + "node_modules/@pythnetwork/client": { + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/@pythnetwork/client/-/client-2.8.0.tgz", + "integrity": "sha512-YqqZSDDsEApC/F4H5ejcl8OCr7gsWv0noTK8YABT8pCtFRTQxXBP0r2S8KQMaIw1x97Mue/jkYybdMeFQzPjCw==", + "dependencies": { + "buffer": "^6.0.1" + }, + "peerDependencies": { + "@solana/web3.js": "^1.30.2" + } + }, + "node_modules/@scure/base": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.1.tgz", + "integrity": "sha512-ZxOhsSyxYwLJj3pLZCefNitxsj093tb2vq90mp2txoYeBqbcjDjqFhyM8eUjq/uFm6zJ+mUuqxlS2FkuSY1MTA==", + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ] + }, + "node_modules/@scure/bip32": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.1.0.tgz", + "integrity": "sha512-ftTW3kKX54YXLCxH6BB7oEEoJfoE2pIgw7MINKAs5PsS6nqKPuKk1haTF/EuHmYqG330t5GSrdmtRuHaY1a62Q==", + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ], + "dependencies": { + "@noble/hashes": "~1.1.1", + "@noble/secp256k1": "~1.6.0", + "@scure/base": "~1.1.0" + } + }, + "node_modules/@scure/bip32/node_modules/@noble/secp256k1": { + "version": "1.6.3", + "resolved": "https://registry.npmjs.org/@noble/secp256k1/-/secp256k1-1.6.3.tgz", + "integrity": "sha512-T04e4iTurVy7I8Sw4+c5OSN9/RkPlo1uKxAomtxQNLq8j1uPAqnsqG1bqvY3Jv7c13gyr6dui0zmh/I3+f/JaQ==", + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ] + }, + "node_modules/@scure/bip39": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.1.0.tgz", + "integrity": "sha512-pwrPOS16VeTKg98dYXQyIjJEcWfz7/1YJIwxUEPFfQPtc86Ym/1sVgQ2RLoD43AazMk2l/unK4ITySSpW2+82w==", + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ], + "dependencies": { + "@noble/hashes": "~1.1.1", + "@scure/base": "~1.1.0" + } + }, + "node_modules/@solana/buffer-layout": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@solana/buffer-layout/-/buffer-layout-4.0.1.tgz", + "integrity": "sha512-E1ImOIAD1tBZFRdjeM4/pzTiTApC0AOBGwyAMS4fwIodCWArzJ3DWdoh8cKxeFM2fElkxBh2Aqts1BPC373rHA==", + "dependencies": { + "buffer": "~6.0.3" + }, + "engines": { + "node": ">=5.10" + } + }, + "node_modules/@solana/buffer-layout/node_modules/buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" + } + }, + "node_modules/@solana/buffer-layout/node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/@solana/spl-token": { + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/@solana/spl-token/-/spl-token-0.1.8.tgz", + "integrity": "sha512-LZmYCKcPQDtJgecvWOgT/cnoIQPWjdH+QVyzPcFvyDUiT0DiRjZaam4aqNUyvchLFhzgunv3d9xOoyE34ofdoQ==", + "dependencies": { + "@babel/runtime": "^7.10.5", + "@solana/web3.js": "^1.21.0", + "bn.js": "^5.1.0", + "buffer": "6.0.3", + "buffer-layout": "^1.2.0", + "dotenv": "10.0.0" + }, + "engines": { + "node": ">= 10" + } + }, + "node_modules/@solana/spl-token/node_modules/buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" + } + }, + "node_modules/@solana/spl-token/node_modules/dotenv": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-10.0.0.tgz", + "integrity": "sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q==", + "engines": { + "node": ">=10" + } + }, + "node_modules/@solana/spl-token/node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/@solana/web3.js": { + "version": "1.72.0", + "resolved": "https://registry.npmjs.org/@solana/web3.js/-/web3.js-1.72.0.tgz", + "integrity": "sha512-xMoCk0y/GpiQhHbRjMcrd5NpmkwhAA0c01id7lrr6nhNdz6Uc/CywPdBeZw3Qz6BVZ/qlUoerpKPWeiXqMUjwA==", + "dependencies": { + "@babel/runtime": "^7.12.5", + "@noble/ed25519": "^1.7.0", + "@noble/hashes": "^1.1.2", + "@noble/secp256k1": "^1.6.3", + "@solana/buffer-layout": "^4.0.0", + "agentkeepalive": "^4.2.1", + "bigint-buffer": "^1.1.5", + "bn.js": "^5.0.0", + "borsh": "^0.7.0", + "bs58": "^4.0.1", + "buffer": "6.0.1", + "fast-stable-stringify": "^1.0.0", + "jayson": "^3.4.4", + "node-fetch": "2", + "rpc-websockets": "^7.5.0", + "superstruct": "^0.14.2" + }, + "engines": { + "node": ">=12.20.0" + } + }, + "node_modules/@solana/web3.js/node_modules/superstruct": { + "version": "0.14.2", + "resolved": "https://registry.npmjs.org/superstruct/-/superstruct-0.14.2.tgz", + "integrity": "sha512-nPewA6m9mR3d6k7WkZ8N8zpTWfenFH3q9pA2PkuiZxINr9DKB2+40wEQf0ixn8VaGuJ78AB6iWOtStI+/4FKZQ==" + }, + "node_modules/@solendprotocol/solend-sdk": { + "version": "0.6.9", + "resolved": "https://registry.npmjs.org/@solendprotocol/solend-sdk/-/solend-sdk-0.6.9.tgz", + "integrity": "sha512-KToDqIDsn11hdNY3M/Lew5spSF2ML2S8q5H21pwjVxFW1BV01Mgm0Y1sD6pLnQ9epQUAqxtbGj1oUETs6bqFMQ==", + "dependencies": { + "@marinade.finance/marinade-ts-sdk": "^3.1.1", + "@mithraic-labs/psy-american": "^0.2.1", + "@project-serum/anchor": "^0.24.2", + "@pythnetwork/client": "^2.5.1", + "@solana/buffer-layout": "^4.0.0", + "@solana/spl-token": "^0.1.8", + "@solana/web3.js": "^1.66.2", + "axios": "^0.24.0", + "bignumber.js": "^9.0.2", + "bn.js": "^5.2.0", + "buffer": "^6.0.3", + "buffer-layout": "^1.2.0", + "hot-shots": "^9.3.0", + "isomorphic-fetch": "^3.0.0", + "jsbi": "^4.3.0", + "typedoc-plugin-cname": "^1.0.1" + } + }, + "node_modules/@solendprotocol/solend-sdk/node_modules/@project-serum/anchor": { + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@project-serum/anchor/-/anchor-0.24.2.tgz", + "integrity": "sha512-0/718g8/DnEuwAidUwh5wLYphUYXhUbiClkuRNhvNoa+1Y8a4g2tJyxoae+emV+PG/Gikd/QUBNMkIcimiIRTA==", + "dependencies": { + "@project-serum/borsh": "^0.2.5", + "@solana/web3.js": "^1.36.0", + "base64-js": "^1.5.1", + "bn.js": "^5.1.2", + "bs58": "^4.0.1", + "buffer-layout": "^1.2.2", + "camelcase": "^5.3.1", + "cross-fetch": "^3.1.5", + "crypto-hash": "^1.3.0", + "eventemitter3": "^4.0.7", + "js-sha256": "^0.9.0", + "pako": "^2.0.3", + "snake-case": "^3.0.4", + "toml": "^3.0.0" + }, + "engines": { + "node": ">=11" + } + }, + "node_modules/@solendprotocol/solend-sdk/node_modules/axios": { + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.24.0.tgz", + "integrity": "sha512-Q6cWsys88HoPgAaFAVUb0WpPk0O8iTeisR9IMqy9G8AbO4NlpVknrnQS03zzF9PGAWgO3cgletO3VjV/P7VztA==", + "dependencies": { + "follow-redirects": "^1.14.4" + } + }, + "node_modules/@solendprotocol/solend-sdk/node_modules/buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" + } + }, + "node_modules/@solendprotocol/solend-sdk/node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/@solendprotocol/solend-sdk/node_modules/typedoc": { + "version": "0.20.37", + "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.20.37.tgz", + "integrity": "sha512-9+qDhdc4X00qTNOtii6QX2z7ndAeWVOso7w3MPSoSJdXlVhpwPfm1yEp4ooKuWA9fiQILR8FKkyjmeqa13hBbw==", + "peer": true, + "dependencies": { + "colors": "^1.4.0", + "fs-extra": "^9.1.0", + "handlebars": "^4.7.7", + "lodash": "^4.17.21", + "lunr": "^2.3.9", + "marked": "~2.0.3", + "minimatch": "^3.0.0", + "progress": "^2.0.3", + "shelljs": "^0.8.4", + "shiki": "^0.9.3", + "typedoc-default-themes": "^0.12.10" + }, + "bin": { + "typedoc": "bin/typedoc" + }, + "engines": { + "node": ">= 10.8.0" + }, + "peerDependencies": { + "typescript": "3.9.x || 4.0.x || 4.1.x || 4.2.x" + } + }, + "node_modules/@solendprotocol/solend-sdk/node_modules/typedoc-plugin-cname": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/typedoc-plugin-cname/-/typedoc-plugin-cname-1.0.1.tgz", + "integrity": "sha512-f97SS5RzDCVBa7Frg1VketIMAkEl3OTvBs9wM8lLEkJVWCIG2yXnszglA82on39gFwQ1tyq8tiuxRgb4569GpA==", + "peerDependencies": { + "typedoc": "^0.20.27" + } + }, + "node_modules/@solendprotocol/solend-sdk/node_modules/typescript": { + "version": "4.2.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.2.4.tgz", + "integrity": "sha512-V+evlYHZnQkaz8TRBuxTA92yZBPotr5H+WhQ7bD3hZUndx5tGOa1fuCgeSjxAzM1RiN5IzvadIXTVefuuwZCRg==", + "peer": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + }, + "node_modules/@supercharge/promise-pool": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/@supercharge/promise-pool/-/promise-pool-2.3.2.tgz", + "integrity": "sha512-f5+C7zv+QQivcUO1FH5lXi7GcuJ3CFuJF3Eg06iArhUs5ma0szCLEQwIY4+VQyh7m/RLVZdzvr4E4ZDnLe9MNg==", + "engines": { + "node": ">=8" + } + }, + "node_modules/@tsconfig/node10": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz", + "integrity": "sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==", + "dev": true + }, + "node_modules/@tsconfig/node12": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", + "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==", + "dev": true + }, + "node_modules/@tsconfig/node14": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", + "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==", + "dev": true + }, + "node_modules/@tsconfig/node16": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.3.tgz", + "integrity": "sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ==", + "dev": true + }, + "node_modules/@types/async-retry": { + "version": "1.4.5", + "resolved": "https://registry.npmjs.org/@types/async-retry/-/async-retry-1.4.5.tgz", + "integrity": "sha512-YrdjSD+yQv7h6d5Ip+PMxh3H6ZxKyQk0Ts+PvaNRInxneG9PFVZjFg77ILAN+N6qYf7g4giSJ1l+ZjQ1zeegvA==", + "dev": true, + "dependencies": { + "@types/retry": "*" + } + }, + "node_modules/@types/bn.js": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/@types/bn.js/-/bn.js-5.1.1.tgz", + "integrity": "sha512-qNrYbZqMx0uJAfKnKclPh+dTwK33KfLHYqtyODwd5HnXOjnkhc4qgn3BrK6RWyGZm5+sIFE7Q7Vz6QQtJB7w7g==", + "dev": true, + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/connect": { + "version": "3.4.35", + "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.35.tgz", + "integrity": "sha512-cdeYyv4KWoEgpBISTxWvqYsVy444DOqehiF3fM3ne10AmJ62RSyNkUnxMJXHQWRQQX2eR94m5y1IZyDwBjV9FQ==", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/node": { + "version": "18.11.18", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.18.tgz", + "integrity": "sha512-DHQpWGjyQKSHj3ebjFI/wRKcqQcdR+MoFBygntYOZytCqNfkd2ZC4ARDJ2DQqhjH5p85Nnd3jhUJIXrszFX/JA==" + }, + "node_modules/@types/retry": { + "version": "0.12.2", + "resolved": "https://registry.npmjs.org/@types/retry/-/retry-0.12.2.tgz", + "integrity": "sha512-XISRgDJ2Tc5q4TRqvgJtzsRkFYNJzZrhTdtMoGVBttwzzQJkPnS3WWTFc7kuDRoPtPakl+T+OfdEUjYJj7Jbow==", + "dev": true + }, + "node_modules/@types/ws": { + "version": "7.4.7", + "resolved": "https://registry.npmjs.org/@types/ws/-/ws-7.4.7.tgz", + "integrity": "sha512-JQbbmxZTZehdc2iszGKs5oC3NFnjeay7mtAWrdt7qNtAVK0g19muApzAy4bm9byz79xa2ZnO/BOBC2R8RC5Lww==", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/acorn": { + "version": "8.8.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.1.tgz", + "integrity": "sha512-7zFpHzhnqYKrkYdUjF1HI1bzd0VygEGX8lFk4k5zVMqHEoES+P+7TKI+EvLO9WVMJ8eekdO0aDEK044xTXwPPA==", + "dev": true, + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-jsx": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "dev": true, + "peerDependencies": { + "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, + "node_modules/acorn-walk": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", + "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", + "dev": true, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/aes-js": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-3.0.0.tgz", + "integrity": "sha512-H7wUZRn8WpTq9jocdxQ2c8x2sKo9ZVmzfRE13GiNJXfp7NcKYEdvl3vspKjXox6RIG2VtaRe4JFvxG4rqp2Zuw==" + }, + "node_modules/agentkeepalive": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.2.1.tgz", + "integrity": "sha512-Zn4cw2NEqd+9fiSVWMscnjyQ1a8Yfoc5oBajLeo5w+YBHgDUcEBY2hS4YpTz6iN5f/2zQiktcuM6tS8x1p9dpA==", + "dependencies": { + "debug": "^4.1.0", + "depd": "^1.1.2", + "humanize-ms": "^1.2.1" + }, + "engines": { + "node": ">= 8.0.0" + } + }, + "node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/arg": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", + "dev": true + }, + "node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" + }, + "node_modules/at-least-node": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz", + "integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==", + "peer": true, + "engines": { + "node": ">= 4.0.0" + } + }, + "node_modules/available-typed-arrays": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz", + "integrity": "sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/aws-sdk": { + "version": "2.1283.0", + "resolved": "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.1283.0.tgz", + "integrity": "sha512-YlxTF0T9X8AcNrOzFPVOPnX1jNtHZjYHRUCfpsVwqdajHDGGruVsVppgBYXEiCRuTQNUhcJTUx0J0uKBhKQZIA==", + "dependencies": { + "buffer": "4.9.2", + "events": "1.1.1", + "ieee754": "1.1.13", + "jmespath": "0.16.0", + "querystring": "0.2.0", + "sax": "1.2.1", + "url": "0.10.3", + "util": "^0.12.4", + "uuid": "8.0.0", + "xml2js": "0.4.19" + }, + "engines": { + "node": ">= 10.0.0" + } + }, + "node_modules/aws-sdk/node_modules/buffer": { + "version": "4.9.2", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-4.9.2.tgz", + "integrity": "sha512-xq+q3SRMOxGivLhBNaUdC64hDTQwejJ+H0T/NB1XMtTVEwNTrfFF3gAxiyW0Bu/xWEGhjVKgUcMhCrUy2+uCWg==", + "dependencies": { + "base64-js": "^1.0.2", + "ieee754": "^1.1.4", + "isarray": "^1.0.0" + } + }, + "node_modules/axios": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.27.2.tgz", + "integrity": "sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==", + "dependencies": { + "follow-redirects": "^1.14.9", + "form-data": "^4.0.0" + } + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" + }, + "node_modules/base-x": { + "version": "3.0.9", + "resolved": "https://registry.npmjs.org/base-x/-/base-x-3.0.9.tgz", + "integrity": "sha512-H7JU6iBHTal1gp56aKoaa//YUxEaAOUiydvrV/pILqIHXTtqxSkATOnDA2u+jZ/61sD+L/412+7kzXRtWukhpQ==", + "dependencies": { + "safe-buffer": "^5.0.1" + } + }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/bech32": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/bech32/-/bech32-1.1.4.tgz", + "integrity": "sha512-s0IrSOzLlbvX7yp4WBfPITzpAU8sqQcpsmwXDiKwrG4r491vwCO/XpejasRNl0piBMe/DvP4Tz0mIS/X1DPJBQ==" + }, + "node_modules/bigint-buffer": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/bigint-buffer/-/bigint-buffer-1.1.5.tgz", + "integrity": "sha512-trfYco6AoZ+rKhKnxA0hgX0HAbVP/s808/EuDSe2JDzUnCp/xAsli35Orvk67UrTEcwuxZqYZDmfA2RXJgxVvA==", + "hasInstallScript": true, + "dependencies": { + "bindings": "^1.3.0" + }, + "engines": { + "node": ">= 10.0.0" + } + }, + "node_modules/bignumber.js": { + "version": "9.1.1", + "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.1.1.tgz", + "integrity": "sha512-pHm4LsMJ6lzgNGVfZHjMoO8sdoRhOzOH4MLmY65Jg70bpxCKu5iOHNJyfF6OyvYw7t8Fpf35RuzUyqnQsj8Vig==", + "engines": { + "node": "*" + } + }, + "node_modules/bindings": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", + "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", + "dependencies": { + "file-uri-to-path": "1.0.0" + } + }, + "node_modules/blakejs": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/blakejs/-/blakejs-1.2.1.tgz", + "integrity": "sha512-QXUSXI3QVc/gJME0dBpXrag1kbzOqCjCX8/b54ntNyW6sjtoqxqRk3LTmXzaJoh71zMsDCjM+47jS7XiwN/+fQ==" + }, + "node_modules/bn.js": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", + "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==" + }, + "node_modules/borsh": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/borsh/-/borsh-0.7.0.tgz", + "integrity": "sha512-CLCsZGIBCFnPtkNnieW/a8wmreDmfUtjU2m9yHrzPXIlNbqVs0AQrSatSG6vdNYUqdc83tkQi2eHfF98ubzQLA==", + "dependencies": { + "bn.js": "^5.2.0", + "bs58": "^4.0.0", + "text-encoding-utf-8": "^1.0.2" + } + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/brorand": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", + "integrity": "sha512-cKV8tMCEpQs4hK/ik71d6LrPOnpkpGBR0wzxqr68g2m/LB2GxVYQroAjMJZRVM1Y4BCjCKc3vAamxSzOY2RP+w==" + }, + "node_modules/bs58": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/bs58/-/bs58-4.0.1.tgz", + "integrity": "sha512-Ok3Wdf5vOIlBrgCvTq96gBkJw+JUEzdBgyaza5HLtPm7yTHkjRy8+JzNyHF7BHa0bNWOQIp3m5YF0nnFcOIKLw==", + "dependencies": { + "base-x": "^3.0.2" + } + }, + "node_modules/buffer": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.1.tgz", + "integrity": "sha512-rVAXBwEcEoYtxnHSO5iWyhzV/O1WMtkUYWlfdLS7FjU4PnSJJHEfHXi/uHPI5EwltmOA794gN3bm3/pzuctWjQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" + } + }, + "node_modules/buffer-layout": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/buffer-layout/-/buffer-layout-1.2.2.tgz", + "integrity": "sha512-kWSuLN694+KTk8SrYvCqwP2WcgQjoRCiF5b4QDvkkz8EmgD+aWAIceGFKMIAdmF/pH+vpgNV3d3kAKorcdAmWA==", + "engines": { + "node": ">=4.5" + } + }, + "node_modules/buffer/node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/bufferutil": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.7.tgz", + "integrity": "sha512-kukuqc39WOHtdxtw4UScxF/WVnMFVSQVKhtx3AjZJzhd0RGZZldcrfSEbVsWWe6KNH253574cq5F+wpv0G9pJw==", + "hasInstallScript": true, + "optional": true, + "dependencies": { + "node-gyp-build": "^4.3.0" + }, + "engines": { + "node": ">=6.14.2" + } + }, + "node_modules/call-bind": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", + "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "dependencies": { + "function-bind": "^1.1.1", + "get-intrinsic": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/camelcase": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", + "engines": { + "node": ">=6" + } + }, + "node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/colors": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz", + "integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==", + "peer": true, + "engines": { + "node": ">=0.1.90" + } + }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==" + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" + }, + "node_modules/create-require": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", + "dev": true + }, + "node_modules/cross-fetch": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.1.5.tgz", + "integrity": "sha512-lvb1SBsI0Z7GDwmuid+mU3kWVBwTVUbe7S0H52yaaAdQOXq2YktTCZdlAcNKFzE6QtRz0snpw9bNiPeOIkkQvw==", + "dependencies": { + "node-fetch": "2.6.7" + } + }, + "node_modules/cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/crypto-hash": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/crypto-hash/-/crypto-hash-1.3.0.tgz", + "integrity": "sha512-lyAZ0EMyjDkVvz8WOeVnuCPvKVBXcMv1l5SVqO1yC7PzTwrD/pPje/BIRbWhMoPe436U+Y2nD7f5bFx0kt+Sbg==", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/deep-is": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "dev": true + }, + "node_modules/delay": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/delay/-/delay-5.0.0.tgz", + "integrity": "sha512-ReEBKkIfe4ya47wlPYf/gu5ib6yUG0/Aez0JQZQz94kiWtRQvZIQbTiehsnwHvLSWJnQdhVeqYue7Id1dKr0qw==", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/depd": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", + "integrity": "sha512-7emPTl6Dpo6JRXOXjLRxck+FlLRX5847cLKEn00PLAgc3g2hTZZgr+e4c2v6QpSmLeFP3n5yUo7ft6avBK/5jQ==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "dev": true, + "engines": { + "node": ">=0.3.1" + } + }, + "node_modules/doctrine": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", + "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", + "dev": true, + "dependencies": { + "esutils": "^2.0.2" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/dot-case": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/dot-case/-/dot-case-3.0.4.tgz", + "integrity": "sha512-Kv5nKlh6yRrdrGvxeJ2e5y2eRUpkUosIW4A2AS38zwSz27zu7ufDwQPi5Jhs3XAlGNetl3bmnGhQsMtkKJnj3w==", + "dependencies": { + "no-case": "^3.0.4", + "tslib": "^2.0.3" + } + }, + "node_modules/dotenv": { + "version": "8.6.0", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.6.0.tgz", + "integrity": "sha512-IrPdXQsk2BbzvCBGBOTmmSH5SodmqZNt4ERAZDmW4CT+tL8VtvinqywuANaFu4bOMWki16nqf0e4oC0QIaDr/g==", + "engines": { + "node": ">=10" + } + }, + "node_modules/elliptic": { + "version": "6.5.4", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz", + "integrity": "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==", + "dependencies": { + "bn.js": "^4.11.9", + "brorand": "^1.1.0", + "hash.js": "^1.0.0", + "hmac-drbg": "^1.0.1", + "inherits": "^2.0.4", + "minimalistic-assert": "^1.0.1", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "node_modules/elliptic/node_modules/bn.js": { + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", + "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" + }, + "node_modules/es6-promise": { + "version": "4.2.8", + "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", + "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==" + }, + "node_modules/es6-promisify": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/es6-promisify/-/es6-promisify-5.0.0.tgz", + "integrity": "sha512-C+d6UdsYDk0lMebHNR4S2NybQMMngAOnOwYBQjTOiv0MkoJMP0Myw2mgpDLBcpfCmRLxyFqYhS/CfOENq4SJhQ==", + "dependencies": { + "es6-promise": "^4.0.3" + } + }, + "node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint": { + "version": "8.32.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.32.0.tgz", + "integrity": "sha512-nETVXpnthqKPFyuY2FNjz/bEd6nbosRgKbkgS/y1C7LJop96gYHWpiguLecMHQ2XCPxn77DS0P+68WzG6vkZSQ==", + "dev": true, + "dependencies": { + "@eslint/eslintrc": "^1.4.1", + "@humanwhocodes/config-array": "^0.11.8", + "@humanwhocodes/module-importer": "^1.0.1", + "@nodelib/fs.walk": "^1.2.8", + "ajv": "^6.10.0", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.2", + "debug": "^4.3.2", + "doctrine": "^3.0.0", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^7.1.1", + "eslint-utils": "^3.0.0", + "eslint-visitor-keys": "^3.3.0", + "espree": "^9.4.0", + "esquery": "^1.4.0", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^6.0.1", + "find-up": "^5.0.0", + "glob-parent": "^6.0.2", + "globals": "^13.19.0", + "grapheme-splitter": "^1.0.4", + "ignore": "^5.2.0", + "import-fresh": "^3.0.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "is-path-inside": "^3.0.3", + "js-sdsl": "^4.1.4", + "js-yaml": "^4.1.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.4.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.1.2", + "natural-compare": "^1.4.0", + "optionator": "^0.9.1", + "regexpp": "^3.2.0", + "strip-ansi": "^6.0.1", + "strip-json-comments": "^3.1.0", + "text-table": "^0.2.0" + }, + "bin": { + "eslint": "bin/eslint.js" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-scope": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.1.1.tgz", + "integrity": "sha512-QKQM/UXpIiHcLqJ5AOyIW7XZmzjkzQXYE54n1++wb0u9V/abW3l9uQnxX8Z5Xd18xyKIMTUAyQ0k1e8pz6LUrw==", + "dev": true, + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, + "node_modules/eslint-utils": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-3.0.0.tgz", + "integrity": "sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==", + "dev": true, + "dependencies": { + "eslint-visitor-keys": "^2.0.0" + }, + "engines": { + "node": "^10.0.0 || ^12.0.0 || >= 14.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/mysticatea" + }, + "peerDependencies": { + "eslint": ">=5" + } + }, + "node_modules/eslint-utils/node_modules/eslint-visitor-keys": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", + "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/eslint-visitor-keys": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz", + "integrity": "sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA==", + "dev": true, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, + "node_modules/espree": { + "version": "9.4.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.4.1.tgz", + "integrity": "sha512-XwctdmTO6SIvCzd9810yyNzIrOrqNYV9Koizx4C/mRhf9uq0o4yHoCEU/670pOxOL/MSraektvSAji79kX90Vg==", + "dev": true, + "dependencies": { + "acorn": "^8.8.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^3.3.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/esquery": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.4.0.tgz", + "integrity": "sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w==", + "dev": true, + "dependencies": { + "estraverse": "^5.1.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "dependencies": { + "estraverse": "^5.2.0" + }, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/ethereum-cryptography": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-1.1.2.tgz", + "integrity": "sha512-XDSJlg4BD+hq9N2FjvotwUET9Tfxpxc3kWGE2AqUG5vcbeunnbImVk3cj6e/xT3phdW21mE8R5IugU4fspQDcQ==", + "dependencies": { + "@noble/hashes": "1.1.2", + "@noble/secp256k1": "1.6.3", + "@scure/bip32": "1.1.0", + "@scure/bip39": "1.1.0" + } + }, + "node_modules/ethereum-cryptography/node_modules/@noble/hashes": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.1.2.tgz", + "integrity": "sha512-KYRCASVTv6aeUi1tsF8/vpyR7zpfs3FUzy2Jqm+MU+LmUKhQ0y2FpfwqkCcxSg2ua4GALJd8k2R76WxwZGbQpA==", + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ] + }, + "node_modules/ethereum-cryptography/node_modules/@noble/secp256k1": { + "version": "1.6.3", + "resolved": "https://registry.npmjs.org/@noble/secp256k1/-/secp256k1-1.6.3.tgz", + "integrity": "sha512-T04e4iTurVy7I8Sw4+c5OSN9/RkPlo1uKxAomtxQNLq8j1uPAqnsqG1bqvY3Jv7c13gyr6dui0zmh/I3+f/JaQ==", + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ] + }, + "node_modules/ethers": { + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/ethers/-/ethers-5.7.2.tgz", + "integrity": "sha512-wswUsmWo1aOK8rR7DIKiWSw9DbLWe6x98Jrn8wcTflTVvaXhAMaB5zGAXy0GYQEQp9iO1iSHWVyARQm11zUtyg==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/abi": "5.7.0", + "@ethersproject/abstract-provider": "5.7.0", + "@ethersproject/abstract-signer": "5.7.0", + "@ethersproject/address": "5.7.0", + "@ethersproject/base64": "5.7.0", + "@ethersproject/basex": "5.7.0", + "@ethersproject/bignumber": "5.7.0", + "@ethersproject/bytes": "5.7.0", + "@ethersproject/constants": "5.7.0", + "@ethersproject/contracts": "5.7.0", + "@ethersproject/hash": "5.7.0", + "@ethersproject/hdnode": "5.7.0", + "@ethersproject/json-wallets": "5.7.0", + "@ethersproject/keccak256": "5.7.0", + "@ethersproject/logger": "5.7.0", + "@ethersproject/networks": "5.7.1", + "@ethersproject/pbkdf2": "5.7.0", + "@ethersproject/properties": "5.7.0", + "@ethersproject/providers": "5.7.2", + "@ethersproject/random": "5.7.0", + "@ethersproject/rlp": "5.7.0", + "@ethersproject/sha2": "5.7.0", + "@ethersproject/signing-key": "5.7.0", + "@ethersproject/solidity": "5.7.0", + "@ethersproject/strings": "5.7.0", + "@ethersproject/transactions": "5.7.0", + "@ethersproject/units": "5.7.0", + "@ethersproject/wallet": "5.7.0", + "@ethersproject/web": "5.7.1", + "@ethersproject/wordlists": "5.7.0" + } + }, + "node_modules/eventemitter3": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", + "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==" + }, + "node_modules/events": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/events/-/events-1.1.1.tgz", + "integrity": "sha512-kEcvvCBByWXGnZy6JUlgAp2gBIUjfCAV6P6TgT1/aaQKcmuAEC4OZTV1I4EWQLz2gxZw76atuVyvHhTxvi0Flw==", + "engines": { + "node": ">=0.4.x" + } + }, + "node_modules/extract-files": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/extract-files/-/extract-files-9.0.0.tgz", + "integrity": "sha512-CvdFfHkC95B4bBBk36hcEmvdR2awOdhhVUYH6S/zrVj3477zven/fJMYg7121h4T1xHZC+tetUpubpAhxwI7hQ==", + "engines": { + "node": "^10.17.0 || ^12.0.0 || >= 13.7.0" + }, + "funding": { + "url": "https://github.com/sponsors/jaydenseric" + } + }, + "node_modules/eyes": { + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/eyes/-/eyes-0.1.8.tgz", + "integrity": "sha512-GipyPsXO1anza0AOZdy69Im7hGFCNB7Y/NGjDlZGJ3GJJLtwNSb2vrzYrTYJRrRloVx7pl+bhUaTB8yiccPvFQ==", + "engines": { + "node": "> 0.1.90" + } + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true + }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true + }, + "node_modules/fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", + "dev": true + }, + "node_modules/fast-stable-stringify": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fast-stable-stringify/-/fast-stable-stringify-1.0.0.tgz", + "integrity": "sha512-wpYMUmFu5f00Sm0cj2pfivpmawLZ0NKdviQ4w9zJeR8JVtOpOxHmLaJuj0vxvGqMJQWyP/COUkF75/57OKyRag==" + }, + "node_modules/fastq": { + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.15.0.tgz", + "integrity": "sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==", + "dev": true, + "dependencies": { + "reusify": "^1.0.4" + } + }, + "node_modules/file-entry-cache": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", + "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", + "dev": true, + "dependencies": { + "flat-cache": "^3.0.4" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + } + }, + "node_modules/file-uri-to-path": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", + "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==" + }, + "node_modules/find": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/find/-/find-0.3.0.tgz", + "integrity": "sha512-iSd+O4OEYV/I36Zl8MdYJO0xD82wH528SaCieTVHhclgiYNe9y+yPKSwK+A7/WsmHL1EZ+pYUJBXWTL5qofksw==", + "dependencies": { + "traverse-chain": "~0.1.0" + } + }, + "node_modules/find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "dependencies": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/flat-cache": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz", + "integrity": "sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==", + "dev": true, + "dependencies": { + "flatted": "^3.1.0", + "rimraf": "^3.0.2" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + } + }, + "node_modules/flatted": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.7.tgz", + "integrity": "sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==", + "dev": true + }, + "node_modules/follow-redirects": { + "version": "1.15.2", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", + "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, + "node_modules/for-each": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", + "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", + "dependencies": { + "is-callable": "^1.1.3" + } + }, + "node_modules/form-data": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/fs-extra": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", + "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", + "peer": true, + "dependencies": { + "at-least-node": "^1.0.0", + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" + }, + "node_modules/function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" + }, + "node_modules/get-intrinsic": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.3.tgz", + "integrity": "sha512-QJVz1Tj7MS099PevUG5jvnt9tSkXN8K14dxQlikJuPt4uD9hHAHjLyLBiLR5zELelBdD9QNRAXZzsJx0WaDL9A==", + "dependencies": { + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/globals": { + "version": "13.19.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.19.0.tgz", + "integrity": "sha512-dkQ957uSRWHw7CFXLUtUHQI3g3aWApYhfNR2O6jn/907riyTYKVBmxYVROkBcY614FSSeSJh7Xm7SrUWCxvJMQ==", + "dev": true, + "dependencies": { + "type-fest": "^0.20.2" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/gopd": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", + "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", + "dependencies": { + "get-intrinsic": "^1.1.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.10", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", + "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", + "peer": true + }, + "node_modules/grapheme-splitter": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz", + "integrity": "sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==", + "dev": true + }, + "node_modules/graphql": { + "version": "16.6.0", + "resolved": "https://registry.npmjs.org/graphql/-/graphql-16.6.0.tgz", + "integrity": "sha512-KPIBPDlW7NxrbT/eh4qPXz5FiFdL5UbaA0XUNz2Rp3Z3hqBSkbj0GVjwFDztsWVauZUWsbKHgMg++sk8UX0bkw==", + "engines": { + "node": "^12.22.0 || ^14.16.0 || ^16.0.0 || >=17.0.0" + } + }, + "node_modules/graphql-request": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/graphql-request/-/graphql-request-4.3.0.tgz", + "integrity": "sha512-2v6hQViJvSsifK606AliqiNiijb1uwWp6Re7o0RTyH+uRTv/u7Uqm2g4Fjq/LgZIzARB38RZEvVBFOQOVdlBow==", + "dependencies": { + "cross-fetch": "^3.1.5", + "extract-files": "^9.0.0", + "form-data": "^3.0.0" + }, + "peerDependencies": { + "graphql": "14 - 16" + } + }, + "node_modules/graphql-request/node_modules/form-data": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.1.tgz", + "integrity": "sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/handlebars": { + "version": "4.7.7", + "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.7.tgz", + "integrity": "sha512-aAcXm5OAfE/8IXkcZvCepKU3VzW1/39Fb5ZuqMtgI/hT8X2YgoMvBY5dLhq/cpOvw7Lk1nK/UF71aLG/ZnVYRA==", + "peer": true, + "dependencies": { + "minimist": "^1.2.5", + "neo-async": "^2.6.0", + "source-map": "^0.6.1", + "wordwrap": "^1.0.0" + }, + "bin": { + "handlebars": "bin/handlebars" + }, + "engines": { + "node": ">=0.4.7" + }, + "optionalDependencies": { + "uglify-js": "^3.1.4" + } + }, + "node_modules/has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dependencies": { + "function-bind": "^1.1.1" + }, + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/has-symbols": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", + "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-tostringtag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.0.tgz", + "integrity": "sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==", + "dependencies": { + "has-symbols": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hash.js": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", + "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==", + "dependencies": { + "inherits": "^2.0.3", + "minimalistic-assert": "^1.0.1" + } + }, + "node_modules/hi-base32": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/hi-base32/-/hi-base32-0.5.1.tgz", + "integrity": "sha512-EmBBpvdYh/4XxsnUybsPag6VikPYnN30td+vQk+GI3qpahVEG9+gTkG0aXVxTjBqQ5T6ijbWIu77O+C5WFWsnA==" + }, + "node_modules/hmac-drbg": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", + "integrity": "sha512-Tti3gMqLdZfhOQY1Mzf/AanLiqh1WTiJgEj26ZuYQ9fbkLomzGchCws4FyrSd4VkpBfiNhaE1On+lOz894jvXg==", + "dependencies": { + "hash.js": "^1.0.3", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "node_modules/hot-shots": { + "version": "9.3.0", + "resolved": "https://registry.npmjs.org/hot-shots/-/hot-shots-9.3.0.tgz", + "integrity": "sha512-e4tgWptiBvlIMnAX0ORe+dNEt0HznD+T2ckzXDUwCBsU7uWr2mwq5UtoT+Df5r9hD5S/DuP8rTxJUQvqAFSFKA==", + "engines": { + "node": ">=6.0.0" + }, + "optionalDependencies": { + "unix-dgram": "2.x" + } + }, + "node_modules/humanize-ms": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz", + "integrity": "sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ==", + "dependencies": { + "ms": "^2.0.0" + } + }, + "node_modules/ieee754": { + "version": "1.1.13", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.13.tgz", + "integrity": "sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg==" + }, + "node_modules/ignore": { + "version": "5.2.4", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.4.tgz", + "integrity": "sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==", + "dev": true, + "engines": { + "node": ">= 4" + } + }, + "node_modules/import-fresh": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", + "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", + "dev": true, + "dependencies": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", + "dev": true, + "engines": { + "node": ">=0.8.19" + } + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "node_modules/interpret": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.4.0.tgz", + "integrity": "sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==", + "peer": true, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/is-arguments": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.1.tgz", + "integrity": "sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA==", + "dependencies": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-callable": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", + "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-core-module": { + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.11.0.tgz", + "integrity": "sha512-RRjxlvLDkD1YJwDbroBHMb+cukurkDWNyHx7D3oNB5x9rb5ogcksMC5wHCadcXoo67gVr/+3GFySh3134zi6rw==", + "peer": true, + "dependencies": { + "has": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-generator-function": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.10.tgz", + "integrity": "sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A==", + "dependencies": { + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-path-inside": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", + "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-typed-array": { + "version": "1.1.10", + "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.10.tgz", + "integrity": "sha512-PJqgEHiWZvMpaFZ3uTc8kHPM4+4ADTlDniuQL7cU/UDA0Ql7F70yGfHph3cLNe+c9toaigv+DFzTJKhc2CtO6A==", + "dependencies": { + "available-typed-arrays": "^1.0.5", + "call-bind": "^1.0.2", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==" + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true + }, + "node_modules/isomorphic-fetch": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/isomorphic-fetch/-/isomorphic-fetch-3.0.0.tgz", + "integrity": "sha512-qvUtwJ3j6qwsF3jLxkZ72qCgjMysPzDfeV240JHiGZsANBYd+EEuu35v7dfrJ9Up0Ak07D7GGSkGhCHTqg/5wA==", + "dependencies": { + "node-fetch": "^2.6.1", + "whatwg-fetch": "^3.4.1" + } + }, + "node_modules/isomorphic-ws": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/isomorphic-ws/-/isomorphic-ws-4.0.1.tgz", + "integrity": "sha512-BhBvN2MBpWTaSHdWRb/bwdZJ1WaehQ2L1KngkCkfLUGF0mAWAT1sQUQacEmQ0jXkFw/czDXPNQSL5u2/Krsz1w==", + "peerDependencies": { + "ws": "*" + } + }, + "node_modules/jayson": { + "version": "3.7.0", + "resolved": "https://registry.npmjs.org/jayson/-/jayson-3.7.0.tgz", + "integrity": "sha512-tfy39KJMrrXJ+mFcMpxwBvFDetS8LAID93+rycFglIQM4kl3uNR3W4lBLE/FFhsoUCEox5Dt2adVpDm/XtebbQ==", + "dependencies": { + "@types/connect": "^3.4.33", + "@types/node": "^12.12.54", + "@types/ws": "^7.4.4", + "commander": "^2.20.3", + "delay": "^5.0.0", + "es6-promisify": "^5.0.0", + "eyes": "^0.1.8", + "isomorphic-ws": "^4.0.1", + "json-stringify-safe": "^5.0.1", + "JSONStream": "^1.3.5", + "lodash": "^4.17.20", + "uuid": "^8.3.2", + "ws": "^7.4.5" + }, + "bin": { + "jayson": "bin/jayson.js" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/jayson/node_modules/@types/node": { + "version": "12.20.55", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.55.tgz", + "integrity": "sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==" + }, + "node_modules/jayson/node_modules/uuid": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "bin": { + "uuid": "dist/bin/uuid" + } + }, + "node_modules/jmespath": { + "version": "0.16.0", + "resolved": "https://registry.npmjs.org/jmespath/-/jmespath-0.16.0.tgz", + "integrity": "sha512-9FzQjJ7MATs1tSpnco1K6ayiYE3figslrXA72G2HQ/n76RzvYlofyi5QM+iX4YRs/pu3yzxlVQSST23+dMDknw==", + "engines": { + "node": ">= 0.6.0" + } + }, + "node_modules/js-sdsl": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/js-sdsl/-/js-sdsl-4.2.0.tgz", + "integrity": "sha512-dyBIzQBDkCqCu+0upx25Y2jGdbTGxE9fshMsCdK0ViOongpV+n5tXRcZY9v7CaVQ79AGS9KA1KHtojxiM7aXSQ==", + "dev": true, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/js-sdsl" + } + }, + "node_modules/js-sha256": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/js-sha256/-/js-sha256-0.9.0.tgz", + "integrity": "sha512-sga3MHh9sgQN2+pJ9VYZ+1LPwXOxuBJBA5nrR5/ofPfuiJBE2hnjsaN8se8JznOmGLN2p49Pe5U/ttafcs/apA==" + }, + "node_modules/js-sha3": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz", + "integrity": "sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q==" + }, + "node_modules/js-sha512": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/js-sha512/-/js-sha512-0.8.0.tgz", + "integrity": "sha512-PWsmefG6Jkodqt+ePTvBZCSMFgN7Clckjd0O7su3I0+BW2QWUTJNzjktHsztGLhncP2h8mcF9V9Y2Ha59pAViQ==" + }, + "node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dev": true, + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/jsbi": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/jsbi/-/jsbi-4.3.0.tgz", + "integrity": "sha512-SnZNcinB4RIcnEyZqFPdGPVgrg2AcnykiBy0sHVJQKHYeaLUvi3Exj+iaPpLnFVkDPZIV4U0yvgC9/R4uEAZ9g==" + }, + "node_modules/json-bigint": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-bigint/-/json-bigint-1.0.0.tgz", + "integrity": "sha512-SiPv/8VpZuWbvLSMtTDU8hEfrZWg/mH/nV/b4o0CYbSxu1UIQPLdwKOCIyLQX+VIPO5vrLX3i8qtqFyhdPSUSQ==", + "dependencies": { + "bignumber.js": "^9.0.0" + } + }, + "node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true + }, + "node_modules/json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", + "dev": true + }, + "node_modules/json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==" + }, + "node_modules/jsonc-parser": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.2.0.tgz", + "integrity": "sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w==", + "peer": true + }, + "node_modules/jsonfile": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", + "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", + "peer": true, + "dependencies": { + "universalify": "^2.0.0" + }, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/jsonparse": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/jsonparse/-/jsonparse-1.3.1.tgz", + "integrity": "sha512-POQXvpdL69+CluYsillJ7SUhKvytYjW9vG/GKpnf+xP8UWgYEM/RaMzHHofbALDiKbbP1W8UEYmgGl39WkPZsg==", + "engines": [ + "node >= 0.2.0" + ] + }, + "node_modules/JSONStream": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.5.tgz", + "integrity": "sha512-E+iruNOY8VV9s4JEbe1aNEm6MiszPRr/UfcHMz0TQh1BXSxHK+ASV1R6W4HpjBhSeS+54PIsAMCBmwD06LLsqQ==", + "dependencies": { + "jsonparse": "^1.2.0", + "through": ">=2.2.7 <3" + }, + "bin": { + "JSONStream": "bin.js" + }, + "engines": { + "node": "*" + } + }, + "node_modules/just-performance": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/just-performance/-/just-performance-4.3.0.tgz", + "integrity": "sha512-L7RjvtJsL0QO8xFs5wEoDDzzJwoiowRw6Rn/GnvldlchS2JQr9wFYPiwZcDfrbbujEKqKN0tvENdbjXdYhDp5Q==" + }, + "node_modules/levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "dependencies": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/limiter": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/limiter/-/limiter-2.1.0.tgz", + "integrity": "sha512-361TYz6iay6n+9KvUUImqdLuFigK+K79qrUtBsXhJTLdH4rIt/r1y8r1iozwh8KbZNpujbFTSh74mJ7bwbAMOw==", + "dependencies": { + "just-performance": "4.3.0" + } + }, + "node_modules/locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "dependencies": { + "p-locate": "^5.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" + }, + "node_modules/lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", + "dev": true + }, + "node_modules/lower-case": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/lower-case/-/lower-case-2.0.2.tgz", + "integrity": "sha512-7fm3l3NAF9WfN6W3JOmf5drwpVqX78JtoGJ3A6W0a6ZnldM41w2fV5D490psKFTpMds8TJse/eHLFFsNHHjHgg==", + "dependencies": { + "tslib": "^2.0.3" + } + }, + "node_modules/lunr": { + "version": "2.3.9", + "resolved": "https://registry.npmjs.org/lunr/-/lunr-2.3.9.tgz", + "integrity": "sha512-zTU3DaZaF3Rt9rhN3uBMGQD3dD2/vFQqnvZCDv4dl5iOzq2IZQqTxu90r4E5J+nP70J3ilqVCrbho2eWaeW8Ow==", + "peer": true + }, + "node_modules/make-error": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", + "dev": true + }, + "node_modules/marked": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/marked/-/marked-2.0.7.tgz", + "integrity": "sha512-BJXxkuIfJchcXOJWTT2DOL+yFWifFv2yGYOUzvXg8Qz610QKw+sHCvTMYwA+qWGhlA2uivBezChZ/pBy1tWdkQ==", + "peer": true, + "bin": { + "marked": "bin/marked" + }, + "engines": { + "node": ">= 8.16.2" + } + }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/minimalistic-assert": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", + "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==" + }, + "node_modules/minimalistic-crypto-utils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", + "integrity": "sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg==" + }, + "node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/minimist": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.7.tgz", + "integrity": "sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g==", + "peer": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "node_modules/nan": { + "version": "2.17.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.17.0.tgz", + "integrity": "sha512-2ZTgtl0nJsO0KQCjEpxcIr5D+Yv90plTitZt9JBfQvVJDS5seMl3FOvsh3+9CoYWXf/1l5OaZzzF6nDm4cagaQ==", + "optional": true + }, + "node_modules/natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", + "dev": true + }, + "node_modules/neo-async": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", + "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", + "peer": true + }, + "node_modules/no-case": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/no-case/-/no-case-3.0.4.tgz", + "integrity": "sha512-fgAN3jGAh+RoxUGZHTSOLJIqUc2wmoBwGR4tbpNAKmmovFoWq0OdRkb0VkldReO2a2iBT/OEulG9XSUc10r3zg==", + "dependencies": { + "lower-case": "^2.0.2", + "tslib": "^2.0.3" + } + }, + "node_modules/node-fetch": { + "version": "2.6.7", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", + "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, + "node_modules/node-gyp-build": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.5.0.tgz", + "integrity": "sha512-2iGbaQBV+ITgCz76ZEjmhUKAKVf7xfY1sRl4UiKQspfZMH2h06SyhNsnSVy50cwkFQDGLyif6m/6uFXHkOZ6rg==", + "optional": true, + "bin": { + "node-gyp-build": "bin.js", + "node-gyp-build-optional": "optional.js", + "node-gyp-build-test": "build-test.js" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/optionator": { + "version": "0.9.1", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", + "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==", + "dev": true, + "dependencies": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.3" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "dependencies": { + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/pako": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/pako/-/pako-2.1.0.tgz", + "integrity": "sha512-w+eufiZ1WuJYgPXbV/PO3NCMEc3xqylkKHzp8bxp1uW4qaSNQUkwmLLEc3kKsfz8lpV1F8Ht3U1Cm+9Srog2ug==" + }, + "node_modules/parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "dependencies": { + "callsites": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "peer": true + }, + "node_modules/prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/progress": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", + "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", + "peer": true, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/punycode": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz", + "integrity": "sha512-RofWgt/7fL5wP1Y7fxE7/EmTLzQVnB0ycyibJ0OOHIlJqTNzglYFxVwETOcIoJqJmpDXJ9xImDv+Fq34F/d4Dw==" + }, + "node_modules/querystring": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz", + "integrity": "sha512-X/xY82scca2tau62i9mDyU9K+I+djTMUsvwf7xnUX5GLvVzgJybOJf4Y6o9Zx3oJK/LSXg5tTZBjwzqVPaPO2g==", + "deprecated": "The querystring API is considered Legacy. new code should use the URLSearchParams API instead.", + "engines": { + "node": ">=0.4.x" + } + }, + "node_modules/queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/rechoir": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", + "integrity": "sha512-HFM8rkZ+i3zrV+4LQjwQ0W+ez98pApMGM3HUrN04j3CqzPOzl9nmP15Y8YXNm8QHGv/eacOVEjqhmWpkRV0NAw==", + "peer": true, + "dependencies": { + "resolve": "^1.1.6" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/regenerator-runtime": { + "version": "0.13.11", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz", + "integrity": "sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==" + }, + "node_modules/regexpp": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz", + "integrity": "sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/mysticatea" + } + }, + "node_modules/resolve": { + "version": "1.22.1", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.1.tgz", + "integrity": "sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw==", + "peer": true, + "dependencies": { + "is-core-module": "^2.9.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "dev": true, + "engines": { + "iojs": ">=1.0.0", + "node": ">=0.10.0" + } + }, + "node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/rpc-websockets": { + "version": "7.5.0", + "resolved": "https://registry.npmjs.org/rpc-websockets/-/rpc-websockets-7.5.0.tgz", + "integrity": "sha512-9tIRi1uZGy7YmDjErf1Ax3wtqdSSLIlnmL5OtOzgd5eqPKbsPpwDP5whUDO2LQay3Xp0CcHlcNSGzacNRluBaQ==", + "dependencies": { + "@babel/runtime": "^7.17.2", + "eventemitter3": "^4.0.7", + "uuid": "^8.3.2", + "ws": "^8.5.0" + }, + "funding": { + "type": "paypal", + "url": "https://paypal.me/kozjak" + }, + "optionalDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": "^5.0.2" + } + }, + "node_modules/rpc-websockets/node_modules/uuid": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "bin": { + "uuid": "dist/bin/uuid" + } + }, + "node_modules/rpc-websockets/node_modules/ws": { + "version": "8.11.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.11.0.tgz", + "integrity": "sha512-HPG3wQd9sNQoT9xHyNCXoDUa+Xw/VevmY9FoHyQ+g+rrMn4j6FB4np7Z0OhdTgjx6MgQLK7jwSy1YecU1+4Asg==", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": "^5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "queue-microtask": "^1.2.2" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/sax": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.1.tgz", + "integrity": "sha512-8I2a3LovHTOpm7NV5yOyO8IHqgVsfK4+UuySrXU8YXkSRX7k6hCV9b3HrkKCr3nMpgj+0bmocaJJWpvp1oc7ZA==" + }, + "node_modules/scrypt-js": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/scrypt-js/-/scrypt-js-3.0.1.tgz", + "integrity": "sha512-cdwTTnqPu0Hyvf5in5asVdZocVDTNRmR7XEcJuIzMjJeSHybHl7vpB66AzwTaIg6CLSbtjcxc8fqcySfnTkccA==" + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/shelljs": { + "version": "0.8.5", + "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.5.tgz", + "integrity": "sha512-TiwcRcrkhHvbrZbnRcFYMLl30Dfov3HKqzp5tO5b4pt6G/SezKcYhmDg15zXVBswHmctSAQKznqNW2LO5tTDow==", + "peer": true, + "dependencies": { + "glob": "^7.0.0", + "interpret": "^1.0.0", + "rechoir": "^0.6.2" + }, + "bin": { + "shjs": "bin/shjs" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/shiki": { + "version": "0.9.15", + "resolved": "https://registry.npmjs.org/shiki/-/shiki-0.9.15.tgz", + "integrity": "sha512-/Y0z9IzhJ8nD9nbceORCqu6NgT9X6I8Fk8c3SICHI5NbZRLdZYFaB233gwct9sU0vvSypyaL/qaKvzyQGJBZSw==", + "peer": true, + "dependencies": { + "jsonc-parser": "^3.0.0", + "vscode-oniguruma": "^1.6.1", + "vscode-textmate": "5.2.0" + } + }, + "node_modules/snake-case": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/snake-case/-/snake-case-3.0.4.tgz", + "integrity": "sha512-LAOh4z89bGQvl9pFfNF8V146i7o7/CqFPbqzYgP+yYzDIDeS9HaNFtXABamRW+AQzEVODcvE79ljJ+8a9YSdMg==", + "dependencies": { + "dot-case": "^3.0.4", + "tslib": "^2.0.3" + } + }, + "node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "peer": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/starknet": { + "version": "4.17.1", + "resolved": "https://registry.npmjs.org/starknet/-/starknet-4.17.1.tgz", + "integrity": "sha512-xihdf+pWUCdKK30r+fNLfg+5RHHpTNw20gvrucbcPPDnsDr2bjwtFu3UjXOtHnbys6qF8fW3ttMkctRoQ5J6Xg==", + "dependencies": { + "@ethersproject/bytes": "^5.6.1", + "bn.js": "^5.2.1", + "elliptic": "^6.5.4", + "ethereum-cryptography": "^1.0.3", + "hash.js": "^1.1.7", + "isomorphic-fetch": "^3.0.0", + "json-bigint": "^1.0.0", + "minimalistic-assert": "^1.0.1", + "pako": "^2.0.4", + "ts-custom-error": "^3.3.1", + "url-join": "^4.0.1" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/superstruct": { + "version": "0.15.5", + "resolved": "https://registry.npmjs.org/superstruct/-/superstruct-0.15.5.tgz", + "integrity": "sha512-4AOeU+P5UuE/4nOUkmcQdW5y7i9ndt1cQd/3iUe+LTz3RxESf/W/5lg4B74HbDMMv8PHnPnGCQFH45kBcrQYoQ==" + }, + "node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "peer": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/text-encoding-utf-8": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/text-encoding-utf-8/-/text-encoding-utf-8-1.0.2.tgz", + "integrity": "sha512-8bw4MY9WjdsD2aMtO0OzOCY3pXGYNx2d2FfHRVUKkiCPDWjKuOlhLVASS+pD7VkLTVjW268LYJHwsnPFlBpbAg==" + }, + "node_modules/text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", + "dev": true + }, + "node_modules/through": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==" + }, + "node_modules/toml": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/toml/-/toml-3.0.0.tgz", + "integrity": "sha512-y/mWCZinnvxjTKYhJ+pYxwD0mRLVvOtdS2Awbgxln6iEnt4rk0yBxeSBHkGJcPucRiG0e55mwWp+g/05rsrd6w==" + }, + "node_modules/tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" + }, + "node_modules/traverse-chain": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/traverse-chain/-/traverse-chain-0.1.0.tgz", + "integrity": "sha512-up6Yvai4PYKhpNp5PkYtx50m3KbwQrqDwbuZP/ItyL64YEWHAvH6Md83LFLV/GRSk/BoUVwwgUzX6SOQSbsfAg==" + }, + "node_modules/tron-format-address": { + "version": "0.1.11", + "resolved": "https://registry.npmjs.org/tron-format-address/-/tron-format-address-0.1.11.tgz", + "integrity": "sha512-Jx2i3R1yXrEMQsfc2jueAI71ivnySzdeva6SiSM/pddwj8TK7PVABSP6s/iYcTRI63GxJEgGMmOJXNNKoBmbQw==" + }, + "node_modules/ts-custom-error": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/ts-custom-error/-/ts-custom-error-3.3.1.tgz", + "integrity": "sha512-5OX1tzOjxWEgsr/YEUWSuPrQ00deKLh6D7OTWcvNHm12/7QPyRh8SYpyWvA4IZv8H/+GQWQEh/kwo95Q9OVW1A==", + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/ts-node": { + "version": "10.9.1", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz", + "integrity": "sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==", + "dev": true, + "dependencies": { + "@cspotcode/source-map-support": "^0.8.0", + "@tsconfig/node10": "^1.0.7", + "@tsconfig/node12": "^1.0.7", + "@tsconfig/node14": "^1.0.0", + "@tsconfig/node16": "^1.0.2", + "acorn": "^8.4.1", + "acorn-walk": "^8.1.1", + "arg": "^4.1.0", + "create-require": "^1.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "v8-compile-cache-lib": "^3.0.1", + "yn": "3.1.1" + }, + "bin": { + "ts-node": "dist/bin.js", + "ts-node-cwd": "dist/bin-cwd.js", + "ts-node-esm": "dist/bin-esm.js", + "ts-node-script": "dist/bin-script.js", + "ts-node-transpile-only": "dist/bin-transpile.js", + "ts-script": "dist/bin-script-deprecated.js" + }, + "peerDependencies": { + "@swc/core": ">=1.2.50", + "@swc/wasm": ">=1.2.50", + "@types/node": "*", + "typescript": ">=2.7" + }, + "peerDependenciesMeta": { + "@swc/core": { + "optional": true + }, + "@swc/wasm": { + "optional": true + } + } + }, + "node_modules/tslib": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.1.tgz", + "integrity": "sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==" + }, + "node_modules/type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "dependencies": { + "prelude-ls": "^1.2.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/typedoc-default-themes": { + "version": "0.12.10", + "resolved": "https://registry.npmjs.org/typedoc-default-themes/-/typedoc-default-themes-0.12.10.tgz", + "integrity": "sha512-fIS001cAYHkyQPidWXmHuhs8usjP5XVJjWB8oZGqkTowZaz3v7g3KDZeeqE82FBrmkAnIBOY3jgy7lnPnqATbA==", + "peer": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/typescript": { + "version": "4.9.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.4.tgz", + "integrity": "sha512-Uz+dTXYzxXXbsFpM86Wh3dKCxrQqUcVMxwU54orwlJjOpO3ao8L7j5lH+dWfTwgCwIuM9GQ2kvVotzYJMXTBZg==", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + }, + "node_modules/uglify-js": { + "version": "3.17.4", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.17.4.tgz", + "integrity": "sha512-T9q82TJI9e/C1TAxYvfb16xO120tMVFZrGA3f9/P4424DNu6ypK103y0GPFVa17yotwSyZW5iYXgjYHkGrJW/g==", + "optional": true, + "peer": true, + "bin": { + "uglifyjs": "bin/uglifyjs" + }, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/universalify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", + "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==", + "peer": true, + "engines": { + "node": ">= 10.0.0" + } + }, + "node_modules/unix-dgram": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/unix-dgram/-/unix-dgram-2.0.6.tgz", + "integrity": "sha512-AURroAsb73BZ6CdAyMrTk/hYKNj3DuYYEuOaB8bYMOHGKupRNScw90Q5C71tWJc3uE7dIeXRyuwN0xLLq3vDTg==", + "hasInstallScript": true, + "optional": true, + "dependencies": { + "bindings": "^1.5.0", + "nan": "^2.16.0" + }, + "engines": { + "node": ">=0.10.48" + } + }, + "node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, + "dependencies": { + "punycode": "^2.1.0" + } + }, + "node_modules/uri-js/node_modules/punycode": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.2.0.tgz", + "integrity": "sha512-LN6QV1IJ9ZhxWTNdktaPClrNfp8xdSAYS0Zk2ddX7XsXZAxckMHPCBcHRo0cTcEIgYPRiGEkmji3Idkh2yFtYw==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/url": { + "version": "0.10.3", + "resolved": "https://registry.npmjs.org/url/-/url-0.10.3.tgz", + "integrity": "sha512-hzSUW2q06EqL1gKM/a+obYHLIO6ct2hwPuviqTTOcfFVc61UbfJ2Q32+uGL/HCPxKqrdGB5QUwIe7UqlDgwsOQ==", + "dependencies": { + "punycode": "1.3.2", + "querystring": "0.2.0" + } + }, + "node_modules/url-join": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/url-join/-/url-join-4.0.1.tgz", + "integrity": "sha512-jk1+QP6ZJqyOiuEI9AEWQfju/nB2Pw466kbA0LEZljHwKeMgd9WrAEgEGxjPDD2+TNbbb37rTyhEfrCXfuKXnA==" + }, + "node_modules/utf-8-validate": { + "version": "5.0.10", + "resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.10.tgz", + "integrity": "sha512-Z6czzLq4u8fPOyx7TU6X3dvUZVvoJmxSQ+IcrlmagKhilxlhZgxPK6C5Jqbkw1IDUmFTM+cz9QDnnLTwDz/2gQ==", + "hasInstallScript": true, + "optional": true, + "dependencies": { + "node-gyp-build": "^4.3.0" + }, + "engines": { + "node": ">=6.14.2" + } + }, + "node_modules/util": { + "version": "0.12.5", + "resolved": "https://registry.npmjs.org/util/-/util-0.12.5.tgz", + "integrity": "sha512-kZf/K6hEIrWHI6XqOFUiiMa+79wE/D8Q+NCNAWclkyg3b4d2k7s0QGepNjiABc+aR3N1PAyHL7p6UcLY6LmrnA==", + "dependencies": { + "inherits": "^2.0.3", + "is-arguments": "^1.0.4", + "is-generator-function": "^1.0.7", + "is-typed-array": "^1.1.3", + "which-typed-array": "^1.1.2" + } + }, + "node_modules/uuid": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.0.0.tgz", + "integrity": "sha512-jOXGuXZAWdsTH7eZLtyXMqUb9EcWMGZNbL9YcGBJl4MH4nrxHmZJhEHvyLFrkxo+28uLb/NYRcStH48fnD0Vzw==", + "bin": { + "uuid": "dist/bin/uuid" + } + }, + "node_modules/v8-compile-cache-lib": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", + "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", + "dev": true + }, + "node_modules/vscode-oniguruma": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/vscode-oniguruma/-/vscode-oniguruma-1.7.0.tgz", + "integrity": "sha512-L9WMGRfrjOhgHSdOYgCt/yRMsXzLDJSL7BPrOZt73gU0iWO4mpqzqQzOz5srxqTvMBaR0XZTSrVWo4j55Rc6cA==", + "peer": true + }, + "node_modules/vscode-textmate": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/vscode-textmate/-/vscode-textmate-5.2.0.tgz", + "integrity": "sha512-Uw5ooOQxRASHgu6C7GVvUxisKXfSgW4oFlO+aa+PAkgmH89O3CXxEEzNRNtHSqtXFTl0nAC1uYj0GMSH27uwtQ==", + "peer": true + }, + "node_modules/webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" + }, + "node_modules/whatwg-fetch": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-3.6.2.tgz", + "integrity": "sha512-bJlen0FcuU/0EMLrdbJ7zOnW6ITZLrZMIarMUVmdKtsGvZna8vxKYaexICWPfZ8qwf9fzNq+UEIZrnSaApt6RA==" + }, + "node_modules/whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/which-typed-array": { + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.9.tgz", + "integrity": "sha512-w9c4xkx6mPidwp7180ckYWfMmvxpjlZuIudNtDf4N/tTAUB8VJbX25qZoAsrtGuYNnGw3pa0AXgbGKRB8/EceA==", + "dependencies": { + "available-typed-arrays": "^1.0.5", + "call-bind": "^1.0.2", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "has-tostringtag": "^1.0.0", + "is-typed-array": "^1.1.10" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/word-wrap": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", + "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/wordwrap": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", + "integrity": "sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q==", + "peer": true + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" + }, + "node_modules/ws": { + "version": "7.4.6", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.4.6.tgz", + "integrity": "sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A==", + "engines": { + "node": ">=8.3.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": "^5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/xml2js": { + "version": "0.4.19", + "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.19.tgz", + "integrity": "sha512-esZnJZJOiJR9wWKMyuvSE1y6Dq5LCuJanqhxslH2bxM6duahNZ+HMpCLhBQGZkbX6xRf8x1Y2eJlgt2q3qo49Q==", + "dependencies": { + "sax": ">=0.6.0", + "xmlbuilder": "~9.0.1" + } + }, + "node_modules/xmlbuilder": { + "version": "9.0.7", + "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-9.0.7.tgz", + "integrity": "sha512-7YXTQc3P2l9+0rjaUbLwMKRhtmwg1M1eDf6nag7urC7pIPYLD9W/jmzQ4ptRSUbodw5S0jfoGTflLemQibSpeQ==", + "engines": { + "node": ">=4.0" + } + }, + "node_modules/yn": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + } + }, "dependencies": { "@babel/runtime": { "version": "7.20.7", @@ -883,20 +5055,32 @@ "version": "0.20.37", "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.20.37.tgz", "integrity": "sha512-9+qDhdc4X00qTNOtii6QX2z7ndAeWVOso7w3MPSoSJdXlVhpwPfm1yEp4ooKuWA9fiQILR8FKkyjmeqa13hBbw==", + "peer": true, "requires": { + "colors": "^1.4.0", + "fs-extra": "^9.1.0", + "handlebars": "^4.7.7", "lodash": "^4.17.21", - "minimatch": "^3.0.0" + "lunr": "^2.3.9", + "marked": "~2.0.3", + "minimatch": "^3.0.0", + "progress": "^2.0.3", + "shelljs": "^0.8.4", + "shiki": "^0.9.3", + "typedoc-default-themes": "^0.12.10" } }, "typedoc-plugin-cname": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/typedoc-plugin-cname/-/typedoc-plugin-cname-1.0.1.tgz", - "integrity": "sha512-f97SS5RzDCVBa7Frg1VketIMAkEl3OTvBs9wM8lLEkJVWCIG2yXnszglA82on39gFwQ1tyq8tiuxRgb4569GpA==" + "integrity": "sha512-f97SS5RzDCVBa7Frg1VketIMAkEl3OTvBs9wM8lLEkJVWCIG2yXnszglA82on39gFwQ1tyq8tiuxRgb4569GpA==", + "requires": {} }, "typescript": { "version": "4.2.4", "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.2.4.tgz", - "integrity": "sha512-V+evlYHZnQkaz8TRBuxTA92yZBPotr5H+WhQ7bD3hZUndx5tGOa1fuCgeSjxAzM1RiN5IzvadIXTVefuuwZCRg==" + "integrity": "sha512-V+evlYHZnQkaz8TRBuxTA92yZBPotr5H+WhQ7bD3hZUndx5tGOa1fuCgeSjxAzM1RiN5IzvadIXTVefuuwZCRg==", + "peer": true } } }, @@ -974,15 +5158,6 @@ "@types/node": "*" } }, - "JSONStream": { - "version": "1.3.5", - "resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.5.tgz", - "integrity": "sha512-E+iruNOY8VV9s4JEbe1aNEm6MiszPRr/UfcHMz0TQh1BXSxHK+ASV1R6W4HpjBhSeS+54PIsAMCBmwD06LLsqQ==", - "requires": { - "jsonparse": "^1.2.0", - "through": ">=2.2.7 <3" - } - }, "acorn": { "version": "8.8.1", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.1.tgz", @@ -993,7 +5168,8 @@ "version": "5.3.2", "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", - "dev": true + "dev": true, + "requires": {} }, "acorn-walk": { "version": "8.2.0", @@ -1060,6 +5236,12 @@ "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" }, + "at-least-node": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz", + "integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==", + "peer": true + }, "available-typed-arrays": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz", @@ -1264,6 +5446,12 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, + "colors": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz", + "integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==", + "peer": true + }, "combined-stream": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", @@ -1714,11 +5902,22 @@ "mime-types": "^2.1.12" } }, + "fs-extra": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", + "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", + "peer": true, + "requires": { + "at-least-node": "^1.0.0", + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + } + }, "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", - "dev": true + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" }, "function-bind": { "version": "1.1.1", @@ -1739,7 +5938,6 @@ "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "dev": true, "requires": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", @@ -1775,6 +5973,12 @@ "get-intrinsic": "^1.1.3" } }, + "graceful-fs": { + "version": "4.2.10", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", + "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", + "peer": true + }, "grapheme-splitter": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz", @@ -1808,6 +6012,19 @@ } } }, + "handlebars": { + "version": "4.7.7", + "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.7.tgz", + "integrity": "sha512-aAcXm5OAfE/8IXkcZvCepKU3VzW1/39Fb5ZuqMtgI/hT8X2YgoMvBY5dLhq/cpOvw7Lk1nK/UF71aLG/ZnVYRA==", + "peer": true, + "requires": { + "minimist": "^1.2.5", + "neo-async": "^2.6.0", + "source-map": "^0.6.1", + "uglify-js": "^3.1.4", + "wordwrap": "^1.0.0" + } + }, "has": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", @@ -1906,7 +6123,6 @@ "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", - "dev": true, "requires": { "once": "^1.3.0", "wrappy": "1" @@ -1917,6 +6133,12 @@ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" }, + "interpret": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.4.0.tgz", + "integrity": "sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==", + "peer": true + }, "is-arguments": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.1.tgz", @@ -1931,6 +6153,15 @@ "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==" }, + "is-core-module": { + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.11.0.tgz", + "integrity": "sha512-RRjxlvLDkD1YJwDbroBHMb+cukurkDWNyHx7D3oNB5x9rb5ogcksMC5wHCadcXoo67gVr/+3GFySh3134zi6rw==", + "peer": true, + "requires": { + "has": "^1.0.3" + } + }, "is-extglob": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", @@ -1995,7 +6226,8 @@ "isomorphic-ws": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/isomorphic-ws/-/isomorphic-ws-4.0.1.tgz", - "integrity": "sha512-BhBvN2MBpWTaSHdWRb/bwdZJ1WaehQ2L1KngkCkfLUGF0mAWAT1sQUQacEmQ0jXkFw/czDXPNQSL5u2/Krsz1w==" + "integrity": "sha512-BhBvN2MBpWTaSHdWRb/bwdZJ1WaehQ2L1KngkCkfLUGF0mAWAT1sQUQacEmQ0jXkFw/czDXPNQSL5u2/Krsz1w==", + "requires": {} }, "jayson": { "version": "3.7.0", @@ -2005,13 +6237,13 @@ "@types/connect": "^3.4.33", "@types/node": "^12.12.54", "@types/ws": "^7.4.4", - "JSONStream": "^1.3.5", "commander": "^2.20.3", "delay": "^5.0.0", "es6-promisify": "^5.0.0", "eyes": "^0.1.8", "isomorphic-ws": "^4.0.1", "json-stringify-safe": "^5.0.1", + "JSONStream": "^1.3.5", "lodash": "^4.17.20", "uuid": "^8.3.2", "ws": "^7.4.5" @@ -2094,11 +6326,36 @@ "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", "integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==" }, + "jsonc-parser": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.2.0.tgz", + "integrity": "sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w==", + "peer": true + }, + "jsonfile": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", + "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", + "peer": true, + "requires": { + "graceful-fs": "^4.1.6", + "universalify": "^2.0.0" + } + }, "jsonparse": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/jsonparse/-/jsonparse-1.3.1.tgz", "integrity": "sha512-POQXvpdL69+CluYsillJ7SUhKvytYjW9vG/GKpnf+xP8UWgYEM/RaMzHHofbALDiKbbP1W8UEYmgGl39WkPZsg==" }, + "JSONStream": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.5.tgz", + "integrity": "sha512-E+iruNOY8VV9s4JEbe1aNEm6MiszPRr/UfcHMz0TQh1BXSxHK+ASV1R6W4HpjBhSeS+54PIsAMCBmwD06LLsqQ==", + "requires": { + "jsonparse": "^1.2.0", + "through": ">=2.2.7 <3" + } + }, "just-performance": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/just-performance/-/just-performance-4.3.0.tgz", @@ -2150,12 +6407,24 @@ "tslib": "^2.0.3" } }, + "lunr": { + "version": "2.3.9", + "resolved": "https://registry.npmjs.org/lunr/-/lunr-2.3.9.tgz", + "integrity": "sha512-zTU3DaZaF3Rt9rhN3uBMGQD3dD2/vFQqnvZCDv4dl5iOzq2IZQqTxu90r4E5J+nP70J3ilqVCrbho2eWaeW8Ow==", + "peer": true + }, "make-error": { "version": "1.3.6", "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", "dev": true }, + "marked": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/marked/-/marked-2.0.7.tgz", + "integrity": "sha512-BJXxkuIfJchcXOJWTT2DOL+yFWifFv2yGYOUzvXg8Qz610QKw+sHCvTMYwA+qWGhlA2uivBezChZ/pBy1tWdkQ==", + "peer": true + }, "mime-db": { "version": "1.52.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", @@ -2187,6 +6456,12 @@ "brace-expansion": "^1.1.7" } }, + "minimist": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.7.tgz", + "integrity": "sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g==", + "peer": true + }, "ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", @@ -2204,6 +6479,12 @@ "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", "dev": true }, + "neo-async": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", + "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", + "peer": true + }, "no-case": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/no-case/-/no-case-3.0.4.tgz", @@ -2231,7 +6512,6 @@ "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", - "dev": true, "requires": { "wrappy": "1" } @@ -2291,8 +6571,7 @@ "path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", - "dev": true + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==" }, "path-key": { "version": "3.1.1", @@ -2300,12 +6579,24 @@ "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", "dev": true }, + "path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "peer": true + }, "prelude-ls": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", "dev": true }, + "progress": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", + "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", + "peer": true + }, "punycode": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz", @@ -2322,6 +6613,15 @@ "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", "dev": true }, + "rechoir": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", + "integrity": "sha512-HFM8rkZ+i3zrV+4LQjwQ0W+ez98pApMGM3HUrN04j3CqzPOzl9nmP15Y8YXNm8QHGv/eacOVEjqhmWpkRV0NAw==", + "peer": true, + "requires": { + "resolve": "^1.1.6" + } + }, "regenerator-runtime": { "version": "0.13.11", "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz", @@ -2333,6 +6633,17 @@ "integrity": "sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==", "dev": true }, + "resolve": { + "version": "1.22.1", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.1.tgz", + "integrity": "sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw==", + "peer": true, + "requires": { + "is-core-module": "^2.9.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + } + }, "resolve-from": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", @@ -2375,7 +6686,8 @@ "ws": { "version": "8.11.0", "resolved": "https://registry.npmjs.org/ws/-/ws-8.11.0.tgz", - "integrity": "sha512-HPG3wQd9sNQoT9xHyNCXoDUa+Xw/VevmY9FoHyQ+g+rrMn4j6FB4np7Z0OhdTgjx6MgQLK7jwSy1YecU1+4Asg==" + "integrity": "sha512-HPG3wQd9sNQoT9xHyNCXoDUa+Xw/VevmY9FoHyQ+g+rrMn4j6FB4np7Z0OhdTgjx6MgQLK7jwSy1YecU1+4Asg==", + "requires": {} } } }, @@ -2418,6 +6730,28 @@ "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", "dev": true }, + "shelljs": { + "version": "0.8.5", + "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.5.tgz", + "integrity": "sha512-TiwcRcrkhHvbrZbnRcFYMLl30Dfov3HKqzp5tO5b4pt6G/SezKcYhmDg15zXVBswHmctSAQKznqNW2LO5tTDow==", + "peer": true, + "requires": { + "glob": "^7.0.0", + "interpret": "^1.0.0", + "rechoir": "^0.6.2" + } + }, + "shiki": { + "version": "0.9.15", + "resolved": "https://registry.npmjs.org/shiki/-/shiki-0.9.15.tgz", + "integrity": "sha512-/Y0z9IzhJ8nD9nbceORCqu6NgT9X6I8Fk8c3SICHI5NbZRLdZYFaB233gwct9sU0vvSypyaL/qaKvzyQGJBZSw==", + "peer": true, + "requires": { + "jsonc-parser": "^3.0.0", + "vscode-oniguruma": "^1.6.1", + "vscode-textmate": "5.2.0" + } + }, "snake-case": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/snake-case/-/snake-case-3.0.4.tgz", @@ -2427,6 +6761,12 @@ "tslib": "^2.0.3" } }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "peer": true + }, "starknet": { "version": "4.17.1", "resolved": "https://registry.npmjs.org/starknet/-/starknet-4.17.1.tgz", @@ -2451,7 +6791,7 @@ "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", "dev": true, "requires": { - "ansi-regex": "^5.0.1" + "ansi-regex": "5.0.1" } }, "strip-json-comments": { @@ -2474,6 +6814,12 @@ "has-flag": "^4.0.0" } }, + "supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "peer": true + }, "text-encoding-utf-8": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/text-encoding-utf-8/-/text-encoding-utf-8-1.0.2.tgz", @@ -2556,11 +6902,30 @@ "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", "dev": true }, + "typedoc-default-themes": { + "version": "0.12.10", + "resolved": "https://registry.npmjs.org/typedoc-default-themes/-/typedoc-default-themes-0.12.10.tgz", + "integrity": "sha512-fIS001cAYHkyQPidWXmHuhs8usjP5XVJjWB8oZGqkTowZaz3v7g3KDZeeqE82FBrmkAnIBOY3jgy7lnPnqATbA==", + "peer": true + }, "typescript": { "version": "4.9.4", "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.4.tgz", "integrity": "sha512-Uz+dTXYzxXXbsFpM86Wh3dKCxrQqUcVMxwU54orwlJjOpO3ao8L7j5lH+dWfTwgCwIuM9GQ2kvVotzYJMXTBZg==" }, + "uglify-js": { + "version": "3.17.4", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.17.4.tgz", + "integrity": "sha512-T9q82TJI9e/C1TAxYvfb16xO120tMVFZrGA3f9/P4424DNu6ypK103y0GPFVa17yotwSyZW5iYXgjYHkGrJW/g==", + "optional": true, + "peer": true + }, + "universalify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", + "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==", + "peer": true + }, "unix-dgram": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/unix-dgram/-/unix-dgram-2.0.6.tgz", @@ -2634,6 +6999,18 @@ "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", "dev": true }, + "vscode-oniguruma": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/vscode-oniguruma/-/vscode-oniguruma-1.7.0.tgz", + "integrity": "sha512-L9WMGRfrjOhgHSdOYgCt/yRMsXzLDJSL7BPrOZt73gU0iWO4mpqzqQzOz5srxqTvMBaR0XZTSrVWo4j55Rc6cA==", + "peer": true + }, + "vscode-textmate": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/vscode-textmate/-/vscode-textmate-5.2.0.tgz", + "integrity": "sha512-Uw5ooOQxRASHgu6C7GVvUxisKXfSgW4oFlO+aa+PAkgmH89O3CXxEEzNRNtHSqtXFTl0nAC1uYj0GMSH27uwtQ==", + "peer": true + }, "webidl-conversions": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", @@ -2681,16 +7058,22 @@ "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", "dev": true }, + "wordwrap": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", + "integrity": "sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q==", + "peer": true + }, "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", - "dev": true + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" }, "ws": { "version": "7.4.6", "resolved": "https://registry.npmjs.org/ws/-/ws-7.4.6.tgz", - "integrity": "sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A==" + "integrity": "sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A==", + "requires": {} }, "xml2js": { "version": "0.4.19", diff --git a/projects/pyswap/index.js b/projects/pyswap/index.js deleted file mode 100644 index 116d4cd484a..00000000000 --- a/projects/pyswap/index.js +++ /dev/null @@ -1,19 +0,0 @@ -const { sumTokensExport } = require("../helper/unwrapLPs"); - -const native_staking_contract = "0xFFD687B05E7178647d4Bb7734e93748dF4A3341a"; -const pys_staking_contract = "0x18E2fA8c010b56779285336D0920F1027f0bDBbb"; - -const assets = [ - "0x4200000000000000000000000000000000000006", - "0x0000000000000000000000000000000000000000", // This is address of native token -]; -const PY_SWAP = '0x2928CBA5b5e5B48113281263FC037c7a5d8E1EDf' - -const owners = [native_staking_contract, pys_staking_contract] - -module.exports = { - op_bnb: { - tvl: sumTokensExport({ owners, tokens: assets }), - staking: sumTokensExport({ owners, tokens: [PY_SWAP] }), - }, -}; \ No newline at end of file From d706462ab500e593dca87ee82efda9fa8205c1ac Mon Sep 17 00:00:00 2001 From: JasonMohanCryptobuild Date: Wed, 23 Aug 2023 01:17:16 +0700 Subject: [PATCH 0934/1974] update TVL for PySwap Exchange --- projects/pyswap/index.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 projects/pyswap/index.js diff --git a/projects/pyswap/index.js b/projects/pyswap/index.js new file mode 100644 index 00000000000..116d4cd484a --- /dev/null +++ b/projects/pyswap/index.js @@ -0,0 +1,19 @@ +const { sumTokensExport } = require("../helper/unwrapLPs"); + +const native_staking_contract = "0xFFD687B05E7178647d4Bb7734e93748dF4A3341a"; +const pys_staking_contract = "0x18E2fA8c010b56779285336D0920F1027f0bDBbb"; + +const assets = [ + "0x4200000000000000000000000000000000000006", + "0x0000000000000000000000000000000000000000", // This is address of native token +]; +const PY_SWAP = '0x2928CBA5b5e5B48113281263FC037c7a5d8E1EDf' + +const owners = [native_staking_contract, pys_staking_contract] + +module.exports = { + op_bnb: { + tvl: sumTokensExport({ owners, tokens: assets }), + staking: sumTokensExport({ owners, tokens: [PY_SWAP] }), + }, +}; \ No newline at end of file From 4143eb3218aca702417a40253701ff00d8e5841f Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 22 Aug 2023 20:25:56 +0200 Subject: [PATCH 0935/1974] update tectonic --- projects/tectonic/index.js | 63 +++++--------------------------------- 1 file changed, 8 insertions(+), 55 deletions(-) diff --git a/projects/tectonic/index.js b/projects/tectonic/index.js index d1935303d3d..e2d08f0e55e 100644 --- a/projects/tectonic/index.js +++ b/projects/tectonic/index.js @@ -1,55 +1,8 @@ -const sdk = require("@defillama/sdk"); -const abi = require("./abi.json"); -const { sumTokens2, nullAddress } = require("../helper/unwrapLPs"); -const { getChainTransform, } = require("../helper/portedTokens"); - -const tcro = "0xeAdf7c01DA7E93FdB5f16B0aa9ee85f978e89E95"; - -const markets = [ - '0x543F4Db9BD26C9Eb6aD4DD1C33522c966C625774', // WETH - '0x67fD498E94d95972a4A2a44AccE00a000AF7Fe00', // WBTC - '0xB3bbf1bE947b245Aef26e3B6a9D777d7703F4c8e', // USDC - '0xA683fdfD9286eeDfeA81CF6dA14703DA683c44E5', // USDT - '0xE1c4c56f772686909c28C319079D41adFD6ec89b', // DAI - '0x4bD41f188f6A05F02b46BB2a1f8ba776e528F9D2', // TUSD - '0xfe6934FDf050854749945921fAA83191Bccf20Ad', // TONIC -] - -const chain = 'cronos' -async function tvl(ts, _, { [chain]: block }) { - const calls = markets.map(i => ({ target: i })) - const { output: tokens } = await sdk.api.abi.multiCall({ - abi: abi.underlying, - calls, chain, block, - }) - const toa = tokens.map(i => ([i.output, i.input.target])) - toa.push([nullAddress, tcro]) - return sumTokens2({ tokensAndOwners: toa, chain, block, }) -} - -async function borrowed(timestamp, block, chainBlocks) { - block = chainBlocks[chain] - const transform = await getChainTransform(chain) - const calls = [...markets, tcro].map(i => ({ target: i })) - const { output: tokens } = await sdk.api.abi.multiCall({ - abi: abi.underlying, - calls: markets.map(i => ({ target: i })), chain, block, - }) - const { output: borrowed } = await sdk.api.abi.multiCall({ - abi: abi.totalBorrows, - calls, chain, block, - }) - const balances = {} - tokens.forEach((data, i) => { - sdk.util.sumSingleBalance(balances, transform(data.output), borrowed[i].output) - }) - sdk.util.sumSingleBalance(balances, transform(nullAddress), borrowed[markets.length].output) - return balances -} - -module.exports = { - cronos: { - tvl, - borrowed, - }, -}; +const { mergeExports } = require('../helper/utils') +const { compoundExports2 } = require('../helper/compound') + +module.exports = mergeExports([ + { cronos: compoundExports2({ comptroller: '0xb3831584acb95ed9ccb0c11f677b5ad01deaeec0', cether: '0xeadf7c01da7e93fdb5f16b0aa9ee85f978e89e95', }),}, + { cronos: compoundExports2({ comptroller: '0x8312A8d5d1deC499D00eb28e1a2723b13aA53C1e', cether: '0xf4ff4b8ee660d4276eda17e79094a7cc519e9606', }),}, + { cronos: compoundExports2({ comptroller: '0x7E0067CEf1e7558daFbaB3B1F8F6Fa75Ff64725f', cether: '0x972173afb7eefb80a0815831b318a643442ad0c1', }),}, +]); From aaacd659050c7d9e0228c21d969de924065d0992 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Wed, 23 Aug 2023 01:03:52 +0100 Subject: [PATCH 0936/1974] update adapter --- projects/spacefi/index.js | 6 ------ 1 file changed, 6 deletions(-) diff --git a/projects/spacefi/index.js b/projects/spacefi/index.js index 7816f2d015b..4e0c7a437a6 100644 --- a/projects/spacefi/index.js +++ b/projects/spacefi/index.js @@ -8,10 +8,4 @@ module.exports = { useDefaultCoreAssets: true, }) }, - era: { - tvl: getUniTVL({ - factory: '0x0700Fb51560CfC8F896B2c812499D17c5B0bF6A7', - useDefaultCoreAssets: true, - }) - }, }; From 228063435397701ed26b15e03043c4f1965878ff Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Wed, 23 Aug 2023 05:03:46 +0100 Subject: [PATCH 0937/1974] add treasury --- projects/treasury/tranche-finance.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 projects/treasury/tranche-finance.js diff --git a/projects/treasury/tranche-finance.js b/projects/treasury/tranche-finance.js new file mode 100644 index 00000000000..9088971b77b --- /dev/null +++ b/projects/treasury/tranche-finance.js @@ -0,0 +1,13 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { treasuryExports, nullAddress } = require("../helper/treasury"); + +const treasury = "0x4632E2E1Ea012fD5d84804c3B36eC12560eCC0aA"; +const SLICE = "0x0AeE8703D34DD9aE107386d3eFF22AE75Dd616D1" + +module.exports = treasuryExports({ + ethereum: { + tokens: [nullAddress], + owners: [treasury], + ownTokens: [SLICE], + }, +}); \ No newline at end of file From c10384af43e939e5b72ae3546ddda980c62d1d2f Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 23 Aug 2023 08:52:47 +0200 Subject: [PATCH 0938/1974] fix uniswap --- projects/uniswap/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/uniswap/index.js b/projects/uniswap/index.js index cb8074493c0..253dffcc6f6 100644 --- a/projects/uniswap/index.js +++ b/projects/uniswap/index.js @@ -24,7 +24,7 @@ function v3TvlPaged(chain) { let graphQueryPaged = ` query poolQuery($lastId: String, $block: Int) { - pools(block: { number: $block } first:1000 where: {id_gt: $lastId totalValueLockedUSD_gt: 100}) { + pools(block: { number: $block } first:1000 where: {id_gt: $lastId totalValueLockedUSD_gt: 100} subgraphError: allow) { id token0 { id } token1 { id } From dd205f96072c4f8815946521551ad9a4479fb7b0 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 23 Aug 2023 11:15:15 +0200 Subject: [PATCH 0939/1974] fix matrixdock --- projects/matrixdock/index.js | 5 ++++- projects/uniswap/index.js | 5 +++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/projects/matrixdock/index.js b/projects/matrixdock/index.js index 941c4020be3..92c5f6297c9 100644 --- a/projects/matrixdock/index.js +++ b/projects/matrixdock/index.js @@ -1,9 +1,12 @@ +const ADDRESSES = require('../helper/coreAssets.json') + module.exports = { + misrepresentedTokens: true, ethereum: { tvl: async (...args) => { const { api } = args[3] const STBT = '0x530824DA86689C9C17CdC2871Ff29B058345b44a' - api.add(STBT, await api.call({ target: STBT, abi: 'erc20:totalSupply'})) + api.add(ADDRESSES.ethereum.USDT, await api.call({ target: '0xad4A9bED9a5E2c1c9a6E43D35Db53c83873dd901', abi: 'uint256:latestAnswer'}) / 1e12) } } } \ No newline at end of file diff --git a/projects/uniswap/index.js b/projects/uniswap/index.js index 253dffcc6f6..03dad7c5fb2 100644 --- a/projects/uniswap/index.js +++ b/projects/uniswap/index.js @@ -65,11 +65,12 @@ module.exports = { [1620156420, "UNI V3 Launch"] ], ...uniV3Export({ - base: { factory: '0x33128a8fc17869897dce68ed026d694621f6fdfd', fromBlock: 1371680, } + base: { factory: '0x33128a8fc17869897dce68ed026d694621f6fdfd', fromBlock: 1371680, }, + celo: { factory: '0xAfE208a311B21f13EF87E33A90049fC17A7acDEc', fromBlock: 13916355, }, }) } -const chains = ['ethereum', 'arbitrum', 'optimism', 'polygon', 'celo', 'bsc', 'avax',] +const chains = ['ethereum', 'arbitrum', 'optimism', 'polygon', 'bsc', 'avax',] chains.forEach(chain => { module.exports[chain] = { From 9d3ae72998fda04a9d4277756e9c247f8972b674 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 23 Aug 2023 11:23:26 +0200 Subject: [PATCH 0940/1974] track astrovault.io (#7258) --- projects/astrovault/index.js | 67 +++++++++++++++++++++++++++++++++ projects/helper/chain/cosmos.js | 1 + projects/helper/chains.json | 1 + projects/helper/coreAssets.json | 4 ++ projects/helper/tokenMapping.js | 4 +- 5 files changed, 75 insertions(+), 2 deletions(-) create mode 100644 projects/astrovault/index.js diff --git a/projects/astrovault/index.js b/projects/astrovault/index.js new file mode 100644 index 00000000000..21383daea90 --- /dev/null +++ b/projects/astrovault/index.js @@ -0,0 +1,67 @@ +const { queryContract, } = require("../helper/chain/cosmos"); +const { PromisePool } = require('@supercharge/promise-pool') +const { transformDexBalances } = require('../helper/portedTokens') + +const STABLE_FACTORY_ARCHWAY = "archway19yzx44k7w7gsjjhumkd4sh9r0z6lscq583hgpu9s4yyl00z9lahq0ptra0"; +const STANDARD_FACTORY_ARCHWAY = "archway1cq6tgc32az7zpq5w7t2d89taekkn9q95g2g79ka6j46ednw7xkkq7n55a2"; +const HYBRID_FACTORY_ARCHWAY = "archway1zlc00gjw4ecan3tkk5g0lfd78gyfldh4hvkv2g8z5qnwlkz9vqmsdfvs7q"; + +async function tvl(_, _1, _2, { api }) { + const { chain } = api + for (const factory of [STABLE_FACTORY_ARCHWAY, STANDARD_FACTORY_ARCHWAY, HYBRID_FACTORY_ARCHWAY]) { + let allPools = []; + let pagesRemaining = true; + let start_after = null; + const key = factory === STANDARD_FACTORY_ARCHWAY ? 'pairs' : 'pools' + + while (pagesRemaining) { + const poolsList = await queryContract({ + contract: factory, + chain, + data: { [key]: { limit: 20, start_after } }, + }); + + const fetchedPools = poolsList[key]; + allPools.push(...fetchedPools) + if (fetchedPools.length == 0) { + pagesRemaining = false; + } else { + start_after = fetchedPools[fetchedPools.length - 1].asset_infos; + } + } + const poolAssets = [] + + const getPoolAssetsState = (async (pool) => { + const poolState = await queryContract({ contract: pool.contract_addr, chain, data: { pool: {} } }) + const poolAssetsInfo = + { + token0: poolState.assets[0].info.token ? poolState.assets[0].info.token.contract_addr : poolState.assets[0].info.native_token.denom, + token0Bal: poolState.assets[0].amount, + token1: poolState.assets[1].info.token ? poolState.assets[1].info.token.contract_addr : poolState.assets[1].info.native_token.denom, + token1Bal: poolState.assets[1].amount, + } + poolAssets.push(poolAssetsInfo) + }) + + await PromisePool + .withConcurrency(20) + .for(allPools) + .process(getPoolAssetsState) + + if (factory === STANDARD_FACTORY_ARCHWAY) await transformDexBalances({ chain, data: poolAssets, balances: api.getBalances() }) + else { + poolAssets.forEach(({ token0, token0Bal, token1, token1Bal }) => { + api.add(token0, token0Bal) + api.add(token1, token1Bal) + }) + } + } +} + +module.exports = { + timetravel: false, + misrepresentedTokens: true, + archway: { + tvl, + } +} \ No newline at end of file diff --git a/projects/helper/chain/cosmos.js b/projects/helper/chain/cosmos.js index 0d65792835d..e4d28b4e37f 100644 --- a/projects/helper/chain/cosmos.js +++ b/projects/helper/chain/cosmos.js @@ -32,6 +32,7 @@ const endPoints = { gravitybridge: "https://gravitychain.io:1317", sei: "https://sei-api.polkachu.com", aura: "https://lcd.aura.network", + archway: "https://api.mainnet.archway.io", }; const chainSubpaths = { diff --git a/projects/helper/chains.json b/projects/helper/chains.json index f087562349a..20bb2ffd89f 100644 --- a/projects/helper/chains.json +++ b/projects/helper/chains.json @@ -4,6 +4,7 @@ "aptos", "arbitrum", "arbitrum_nova", + "archway", "astar", "aura", "aurora", diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index 4edb5a57907..9ce2227753e 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -1191,6 +1191,7 @@ "OSMO_3": "0471F1C4E7AFD3F07702BEF6DC365268D64570F7C1FDC98EA6098DD6DE59817B", "UST_2": "B448C0CA358B958301D328CCDC5D5AD642FC30A6D3AE106FF721DB315F3DDE5C", "AXL_USDC_1": "F082B65C88E4B6D5EF1DB243CDA1D331D002759E938A0F5CD3FFDC5D53B3E349", + "AXL_USDC_2": "E21808AEBCB7E02F594897100186C126E3BC9A36B0974196AF116750A4573F06", "BLD": "11F940BCDFD7CFBFD7EDA13F25DA95D308286D441209D780C9863FD4271514EB" }, "starknet": { @@ -1364,5 +1365,8 @@ }, "op_bnb": { "WBNB": "0x4200000000000000000000000000000000000006" + }, + "archway": { + "ARCH": "aarch" } } diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 524b2ac59fd..23354f77330 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -16,7 +16,7 @@ coreAssets = JSON.parse(JSON.stringify(coreAssets)) // carbon: https://api-insights.carbon.network/info/denom_gecko_map // orbit brige: https://bridge.orbitchain.io/open/v1/api/monitor/rawTokenList -const ibcChains = ['ibc', 'terra', 'terra2', 'crescent', 'osmosis', 'kujira', 'stargaze', 'juno', 'injective', 'cosmos', 'comdex', 'stargaze', 'umee', 'orai', 'persistence', 'fxcore', 'neutron', 'quasar', 'chihuahua', 'sei'] +const ibcChains = ['ibc', 'terra', 'terra2', 'crescent', 'osmosis', 'kujira', 'stargaze', 'juno', 'injective', 'cosmos', 'comdex', 'stargaze', 'umee', 'orai', 'persistence', 'fxcore', 'neutron', 'quasar', 'chihuahua', 'sei', 'archway'] const caseSensitiveChains = [...ibcChains, 'solana', 'tezos', 'ton', 'algorand', 'aptos', 'near', 'bitcoin', 'waves', 'tron', 'litecoin', 'polkadot', 'ripple', 'elrond', 'cardano', 'stacks', 'sui', 'ergo',] const distressedAssts = new Set(Object.values({ @@ -93,7 +93,7 @@ function getCoreAssets(chain = 'ethereum') { Object.keys(fixBalancesTokens[chain] || {}), ].flat() let addresses = getUniqueAddresses(tokens, chain) - if (ibcChains.includes(chain)) addresses.push(...coreAssets.ibc) + if (ibcChains.includes(chain)) addresses.push(...coreAssets.ibc.map(i => 'ibc/' + i)) if (anyswapTokenBlacklist[chain]) addresses = addresses.filter(i => !anyswapTokenBlacklist[chain].includes(i)) return addresses } From 9d59b492f6d94a5ea5e657de187c7a3994eb9d6a Mon Sep 17 00:00:00 2001 From: FedexSwap <142971509+FedexSwap@users.noreply.github.com> Date: Wed, 23 Aug 2023 16:26:05 +0700 Subject: [PATCH 0941/1974] fedex (#7259) Co-authored-by: contact.celestial2021 --- projects/fedex/index.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 projects/fedex/index.js diff --git a/projects/fedex/index.js b/projects/fedex/index.js new file mode 100644 index 00000000000..b32d4f1ec2c --- /dev/null +++ b/projects/fedex/index.js @@ -0,0 +1,12 @@ +const { getUniTVL } = require("../helper/unknownTokens"); + +module.exports = { + misrepresentedTokens: true, + op_bnb: { + tvl: getUniTVL({ + factory: "0xfb3AD00B272449AF3ea44e5C6ADbdfaB1655A046", + useDefaultCoreAssets: true, + fetchBalances: true, + }), + }, +}; From 3ef86855bdf0234c6675ceed36bd2126438ef2ba Mon Sep 17 00:00:00 2001 From: define Date: Wed, 23 Aug 2023 11:37:45 +0100 Subject: [PATCH 0942/1974] fbi dprk --- projects/entities/fbi-dprk.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 projects/entities/fbi-dprk.js diff --git a/projects/entities/fbi-dprk.js b/projects/entities/fbi-dprk.js new file mode 100644 index 00000000000..6d2684e661e --- /dev/null +++ b/projects/entities/fbi-dprk.js @@ -0,0 +1,16 @@ +const { cexExports } = require('../helper/cex') + +const config = { + bitcoin: { + owners: [ + "3LU8wRu4ZnXP4UM8Yo6kkTiGHM9BubgyiG", + "39idqitN9tYNmq3wYanwg3MitFB5TZCjWu", + "3AAUBbKJorvNhEUFhKnep9YTwmZECxE4Nk", + "3PjNaSeP8GzLjGeu51JR19Q2Lu8W2Te9oc", + "3NbdrezMzAVVfXv5MTQJn4hWqKhYCTCJoB", + "34VXKa5upLWVYMXmgid6bFM4BaQXHxSUoL" + ], + }, +} + +module.exports = cexExports(config) \ No newline at end of file From d77d4ca6ebf5820d182e60339aa5b45f04b05a7d Mon Sep 17 00:00:00 2001 From: define Date: Wed, 23 Aug 2023 11:39:15 +0100 Subject: [PATCH 0943/1974] missing --- projects/entities/fbi-dprk.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/entities/fbi-dprk.js b/projects/entities/fbi-dprk.js index 6d2684e661e..2b717134e93 100644 --- a/projects/entities/fbi-dprk.js +++ b/projects/entities/fbi-dprk.js @@ -2,7 +2,7 @@ const { cexExports } = require('../helper/cex') const config = { bitcoin: { - owners: [ + owners: [ //source https://www.fbi.gov/news/press-releases/fbi-identifies-cryptocurrency-funds-stolen-by-dprk "3LU8wRu4ZnXP4UM8Yo6kkTiGHM9BubgyiG", "39idqitN9tYNmq3wYanwg3MitFB5TZCjWu", "3AAUBbKJorvNhEUFhKnep9YTwmZECxE4Nk", From 5fb0d87b59b8dc814500047ce47ad6fa3e725a8c Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 23 Aug 2023 14:23:23 +0200 Subject: [PATCH 0944/1974] minor fix --- projects/pyswap/index.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/projects/pyswap/index.js b/projects/pyswap/index.js index 116d4cd484a..c60822ff312 100644 --- a/projects/pyswap/index.js +++ b/projects/pyswap/index.js @@ -9,11 +9,9 @@ const assets = [ ]; const PY_SWAP = '0x2928CBA5b5e5B48113281263FC037c7a5d8E1EDf' -const owners = [native_staking_contract, pys_staking_contract] - module.exports = { op_bnb: { - tvl: sumTokensExport({ owners, tokens: assets }), - staking: sumTokensExport({ owners, tokens: [PY_SWAP] }), + tvl: sumTokensExport({ owner: native_staking_contract, tokens: assets }), + staking: sumTokensExport({ owner: pys_staking_contract, tokens: [PY_SWAP] }), }, -}; \ No newline at end of file +}; From 2c99398e27f4eb2f18fa051bd980364399cd91b2 Mon Sep 17 00:00:00 2001 From: JasonMohanCryptobuild <142928319+JasonMohanCryptobuild@users.noreply.github.com> Date: Wed, 23 Aug 2023 20:28:52 +0700 Subject: [PATCH 0945/1974] update TVL for PySwap Exchange (#7255) * update TVL for PySwap Exchange * Revert "update TVL for PySwap Exchange" This reverts commit b42107bed2225e544581ed9545d7e2301037852a. * update TVL for PySwap Exchange * minor fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/pyswap/index.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 projects/pyswap/index.js diff --git a/projects/pyswap/index.js b/projects/pyswap/index.js new file mode 100644 index 00000000000..c60822ff312 --- /dev/null +++ b/projects/pyswap/index.js @@ -0,0 +1,17 @@ +const { sumTokensExport } = require("../helper/unwrapLPs"); + +const native_staking_contract = "0xFFD687B05E7178647d4Bb7734e93748dF4A3341a"; +const pys_staking_contract = "0x18E2fA8c010b56779285336D0920F1027f0bDBbb"; + +const assets = [ + "0x4200000000000000000000000000000000000006", + "0x0000000000000000000000000000000000000000", // This is address of native token +]; +const PY_SWAP = '0x2928CBA5b5e5B48113281263FC037c7a5d8E1EDf' + +module.exports = { + op_bnb: { + tvl: sumTokensExport({ owner: native_staking_contract, tokens: assets }), + staking: sumTokensExport({ owner: pys_staking_contract, tokens: [PY_SWAP] }), + }, +}; From 03b9cf01dd0750b94ef27882822887d7f1122157 Mon Sep 17 00:00:00 2001 From: baklavaspace <93024988+baklavaspace@users.noreply.github.com> Date: Wed, 23 Aug 2023 22:30:20 +0800 Subject: [PATCH 0946/1974] add baklava-space project (#7260) * Create index.js * Delete projects/BaklavaSpace directory * Create index.js Create baklava-sapce sdk adapter. Calculate TVL on Avalanche and FunctionX yield vaults. * Create abi.json * code refactor --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/baklava-space/index.js | 54 +++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 projects/baklava-space/index.js diff --git a/projects/baklava-space/index.js b/projects/baklava-space/index.js new file mode 100644 index 00000000000..9063790606b --- /dev/null +++ b/projects/baklava-space/index.js @@ -0,0 +1,54 @@ +const { staking } = require('../helper/staking'); +const { sumERC4626VaultsExport } = require('../helper/erc4626'); +const { pool2 } = require('../helper/pool2') + +const config = { + avax: { + vaults: [ + '0xf160C07c5a7e80F9bFA61f9554FF449b8B3eD990', + '0x7a2e6F95cA2B90CDC52f92dda8A7F2d0C2663264', + ], + pgVaults: [ + '0x91CCbbC44221ddb70f54d9E911C4fE80be944232', + '0xD146D2b9E017585faBbE0943e122b07FaefF1380', + '0xd0Cf7b1071c7c12a7c36ca4CA863B2583D9C338A', + '0x0D382907A342c0ac2DD735a0F8defe59A28D5DE4', + '0xeccFBE23903932DE517b0eb1f80d9e8779A864E0', + '0x17bc0557D5946b1304f8c0b5af18f4FadDBf9D49', + '0xc331aF15574d80a4a34FEd8Ee1369E7900dCD47E', + '0x9841c066021Bfb9D1c79e8E82A597Dd133d8804F', + '0x9841c066021Bfb9D1c79e8E82A597Dd133d8804F', + ], + tjVaults: [ + '0xFec19beb4e68B4c93622c51d4ad8AF804fe421AA', + '0x2d3147AC6dB2a8DfeE1946a9D59b1B0CBc3489c9', + '0xBFd13f98A84C59D42D2086298100D4d7A715733D', + '0x5cBD2724A4398748615a2ad62ff80607dAC233fC', + ], + }, +} + +const bavaStakingRewards = "0x2F445C4cC8E114893279fa515C291A3d02160b02" +const bavaToken = "0xe19A1684873faB5Fb694CfD06607100A632fF21c" + +module.exports = { + doublecounted: true, + methodology: `Counts liquidty on the bava staking and lptoken staking on Avalanche and fx token staking on FunctionX`, + functionx: { tvl: sumERC4626VaultsExport({ vaults: ['0x5c24B402b4b4550CF94227813f3547B94774c1CB'] }) } +}; + +Object.keys(config).forEach(chain => { + const { vaults, pgVaults, tjVaults, } = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const vInfo = await api.multiCall({ abi: 'function vaultInfo() view returns (address token, uint256 bal)', calls: vaults }) + vInfo.forEach(i => api.add(i.token, i.bal)) + const pgInfos = await api.multiCall({ abi: 'function vaultInfo() view returns (address token, address, uint256 bal, uint256, bool, bool)', calls: [pgVaults, tjVaults].flat() }) + pgInfos.forEach(i => api.add(i.token, i.bal)) + } + } +}) + + +module.exports.avax.staking = staking(bavaStakingRewards, bavaToken) +module.exports.avax.pool2 = pool2('0xdcedb18047945de1f05f649569b3d2b0e648d9c8', '0x2c3601fe09c23df8beb8216298d1502c985e376f') From 581d05496d3a7cf9c4a4fa8f96bcb09f57f628e7 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 23 Aug 2023 17:23:40 +0200 Subject: [PATCH 0947/1974] track hydradx --- projects/helper/chains.json | 1 + projects/hydradx/api.js | 69 +++++++++++++++++++++++++++++++++++++ projects/hydradx/index.js | 6 ++++ 3 files changed, 76 insertions(+) create mode 100644 projects/hydradx/api.js create mode 100644 projects/hydradx/index.js diff --git a/projects/helper/chains.json b/projects/helper/chains.json index 20bb2ffd89f..1447315a8bb 100644 --- a/projects/helper/chains.json +++ b/projects/helper/chains.json @@ -90,6 +90,7 @@ "hoo", "hpb", "hydra", + "hydradx", "icon", "icp", "injective", diff --git a/projects/hydradx/api.js b/projects/hydradx/api.js new file mode 100644 index 00000000000..6fa74d93c17 --- /dev/null +++ b/projects/hydradx/api.js @@ -0,0 +1,69 @@ +const { ApiPromise, WsProvider } = require("@polkadot/api"); + +const omnipoolAccountId = "7L53bUTBbfuj14UpdCNPwmgzzHSsrsTWBHX5pys32mVWM3C1" + +async function tvl() { + const { api: _api } = arguments[3] + const provider = new WsProvider("wss://hydradx-rpc.dwellir.com"); + const api = await ApiPromise.create({ provider, }); + await api.isReady + // const assetCount = +await api.query.assetRegistry.nextAssetId() // doesnt work + const assetMetadata = [] + let i = 0; + let hasMore = true; + do { + const meta = await api.query.assetRegistry.assetMetadataMap(i) + if (meta.isNone) { + hasMore = false + break + } + + assetMetadata.push(meta) + i++ + } while (hasMore) + assetMetadata.forEach((meta, i) => assetMetadata[i] = { + symbol: meta.unwrap().symbol.toHuman(), + decimals: +meta.unwrap().decimals, + assetId: i, + }) + assetMetadata.shift() + + const hdxBalance = await api.query.system.account(omnipoolAccountId) + add('hydradx', hdxBalance.data.free / 1e12) + for (const { decimals, assetId, symbol } of assetMetadata) { + const cgId = cgMapping[symbol] + if (cgId) { + const bal = await api.query.tokens.accounts(omnipoolAccountId, assetId) + add(cgId, bal.free / (10 ** decimals)) + } else { + console.log(`No mapping for ${symbol}, skipping it`) + } + } + + function add(token, bal) { + _api.add(token, bal, { skipChain: true }) + } +} + +module.exports = { + hydradx: { tvl }, +} + +const cgMapping = { + DAI: 'dai', + INTR: 'interlay', + GLMR: 'moonbeam', + vDOT: 'voucher-dot', + ZTG: 'zeitgeist', + CFG: 'centrifuge', + BNC: 'bifrost-native-coin', + WETH: 'ethereum', + DOT: 'polkadot', + APE: 'apecoin', + USDC: 'usd-coin', + USDT: 'tether', + ASTR: 'astar', + WBTC: 'wrapped-bitcoin', + iBTC: 'interbtc', +} + diff --git a/projects/hydradx/index.js b/projects/hydradx/index.js new file mode 100644 index 00000000000..19c6b1e1546 --- /dev/null +++ b/projects/hydradx/index.js @@ -0,0 +1,6 @@ +const { getExports } = require('../helper/heroku-api') + +module.exports = { + timetravel: false, + ...getExports("hydradx", ['hydradx']), +} \ No newline at end of file From 48e6d32a8b193104094ec8d04a03fbd71c28ab77 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 23 Aug 2023 17:36:36 +0200 Subject: [PATCH 0948/1974] hydradx: bugfix --- projects/hydradx/api.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/projects/hydradx/api.js b/projects/hydradx/api.js index 6fa74d93c17..e816a336412 100644 --- a/projects/hydradx/api.js +++ b/projects/hydradx/api.js @@ -40,6 +40,8 @@ async function tvl() { } } + return api.getBalances() + function add(token, bal) { _api.add(token, bal, { skipChain: true }) } From 402d35d8399ca1a76ac27607d727d0beb1772613 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 23 Aug 2023 17:37:20 +0200 Subject: [PATCH 0949/1974] hydradx: bugfix [again] --- projects/hydradx/api.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/hydradx/api.js b/projects/hydradx/api.js index e816a336412..c0751165bff 100644 --- a/projects/hydradx/api.js +++ b/projects/hydradx/api.js @@ -40,7 +40,7 @@ async function tvl() { } } - return api.getBalances() + return _api.getBalances() function add(token, bal) { _api.add(token, bal, { skipChain: true }) From 3a088357db6b44ae2d45334533de0cf2d5f60500 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 23 Aug 2023 17:50:19 +0200 Subject: [PATCH 0950/1974] track ARS staking --- projects/aquarius-loan/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/projects/aquarius-loan/index.js b/projects/aquarius-loan/index.js index 3b5bf67d45c..4c4217b9115 100644 --- a/projects/aquarius-loan/index.js +++ b/projects/aquarius-loan/index.js @@ -1,5 +1,8 @@ const { compoundExports2 } = require("../helper/compound"); +const { staking } = require('../helper/staking') module.exports = { core: compoundExports2({ comptroller: '0x6056Eb6a5634468647B8cB892d3DaA5F816939FC', cether: '0x03ef96f537a7cda4411c8643afd9d8814d5b4906'}) -}; \ No newline at end of file +}; + +module.exports.core.staking = staking('0x959C7898318DC3c8fD11cbC5000f4e36F75144EC', '0x204e2D49b7cDA6d93301bcF667A2Da28Fb0e5780') \ No newline at end of file From cd99fae378da37fb52538bee6d1cdc0505618d95 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 23 Aug 2023 23:12:14 +0200 Subject: [PATCH 0951/1974] fix ars staking --- projects/aquarius-loan/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/aquarius-loan/index.js b/projects/aquarius-loan/index.js index 4c4217b9115..ed95b861842 100644 --- a/projects/aquarius-loan/index.js +++ b/projects/aquarius-loan/index.js @@ -1,8 +1,8 @@ const { compoundExports2 } = require("../helper/compound"); -const { staking } = require('../helper/staking') +const { stakingUnknownPricedLP } = require('../helper/staking') module.exports = { core: compoundExports2({ comptroller: '0x6056Eb6a5634468647B8cB892d3DaA5F816939FC', cether: '0x03ef96f537a7cda4411c8643afd9d8814d5b4906'}) }; -module.exports.core.staking = staking('0x959C7898318DC3c8fD11cbC5000f4e36F75144EC', '0x204e2D49b7cDA6d93301bcF667A2Da28Fb0e5780') \ No newline at end of file +module.exports.core.staking = stakingUnknownPricedLP('0x959C7898318DC3c8fD11cbC5000f4e36F75144EC', '0x204e2D49b7cDA6d93301bcF667A2Da28Fb0e5780', 'core', '0xeaf1a065f85cf02547002d26aa42ee4516e21aa1') \ No newline at end of file From 718c2ea6f07cd1b5016877cf255de1c0d7b827c5 Mon Sep 17 00:00:00 2001 From: Elliot Shiu Date: Wed, 23 Aug 2023 21:25:04 -0700 Subject: [PATCH 0952/1974] sommelier: add turbosweth cellar (#7263) --- projects/sommelier/index.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/projects/sommelier/index.js b/projects/sommelier/index.js index a263c6bd29a..fb86facea0d 100644 --- a/projects/sommelier/index.js +++ b/projects/sommelier/index.js @@ -48,6 +48,10 @@ const cellarsV2 = [ { id: FRAXIMAL, startBlock: 17589948 }, ]; +// v2.5 Cellars +const TURBO_SWETH = "0xd33dad974b938744dac81fe00ac67cb5aa13958e"; +const cellarsV2p5 = [{ id: TURBO_SWETH, startBlock: 17910374 }]; + async function tvl(timestamp, block, chainBlocks, { api }) { const balances = {}; const baseOptions = { balances, chainBlocks }; @@ -70,6 +74,13 @@ async function tvl(timestamp, block, chainBlocks, { api }) { cellars: filterActiveCellars(cellarsV2, block), }); + // no change in sumTvl implementation from v2 to v2.5 + await v2.sumTvl({ + ...baseOptions, + api, + cellars: filterActiveCellars(cellarsV2p5, block), + }); + return balances; } From dd02a2b45fdc0900902a9efdffaa08ff0fd2dfb0 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 24 Aug 2023 13:14:33 +0200 Subject: [PATCH 0953/1974] linea: pancakeswap-v3 --- projects/pancakeswap-v3/index.js | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/projects/pancakeswap-v3/index.js b/projects/pancakeswap-v3/index.js index 16c47181498..a6974738f6d 100644 --- a/projects/pancakeswap-v3/index.js +++ b/projects/pancakeswap-v3/index.js @@ -1,17 +1,20 @@ const { uniV3Export } = require('../helper/uniswapV3') module.exports = uniV3Export({ - bsc: { factory: '0x0bfbcf9fa4f9c56b0f40a671ad40e0805a091865', fromBlock: 26956207, blacklistedTokens: [ - '0x860368babf32129c18306a70ce7db10c5b437072', - '0xc476d3961f77645464acccce404eb17815a80878', - '0xf8c7f403829cc0f9a37f126a3da41358c232acdf', - '0x95e7c70b58790a1cbd377bc403cd7e9be7e0afb1', - '0x454f4597582df557c2757403f47d3f3bbb890d43', - '0x121a3fba8456ebce13964363ba35fea00c2aa3d2', - ] }, + bsc: { + factory: '0x0bfbcf9fa4f9c56b0f40a671ad40e0805a091865', fromBlock: 26956207, blacklistedTokens: [ + '0x860368babf32129c18306a70ce7db10c5b437072', + '0xc476d3961f77645464acccce404eb17815a80878', + '0xf8c7f403829cc0f9a37f126a3da41358c232acdf', + '0x95e7c70b58790a1cbd377bc403cd7e9be7e0afb1', + '0x454f4597582df557c2757403f47d3f3bbb890d43', + '0x121a3fba8456ebce13964363ba35fea00c2aa3d2', + ] + }, ethereum: { factory: '0x0bfbcf9fa4f9c56b0f40a671ad40e0805a091865', fromBlock: 16950685, }, polygon_zkevm: { factory: '0x0BFbCF9fa4f9C56B0F40a671Ad40E0805A091865', fromBlock: 750148, }, linea: { factory: '0x0BFbCF9fa4f9C56B0F40a671Ad40E0805A091865', fromBlock: 1445, }, era: { factory: '0x1BB72E0CbbEA93c08f535fc7856E0338D7F7a8aB', fromBlock: 9413438, }, - arbitrum: {factory: '0x0BFbCF9fa4f9C56B0F40a671Ad40E0805A091865', fromBlock: 101028949} + arbitrum: { factory: '0x0BFbCF9fa4f9C56B0F40a671Ad40E0805A091865', fromBlock: 101028949, }, + linea: { factory: '0x0BFbCF9fa4f9C56B0F40a671Ad40E0805A091865', fromBlock: 1444, }, }) From 5aae6cd71f896c67f44d34b42be81260d3a441e3 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 24 Aug 2023 13:31:55 +0200 Subject: [PATCH 0954/1974] disable borrowed in wanlend v1 --- projects/wanlend/index.js | 35 +++++++++-------------------------- 1 file changed, 9 insertions(+), 26 deletions(-) diff --git a/projects/wanlend/index.js b/projects/wanlend/index.js index 237951be70b..c8d704e8fb9 100644 --- a/projects/wanlend/index.js +++ b/projects/wanlend/index.js @@ -1,29 +1,12 @@ -const { compoundExports } = require("../helper/compound"); -const sdk = require("@defillama/sdk"); +const { compoundExports2 } = require("../helper/compound"); +const { mergeExports } = require("../helper/utils"); +const cetheEquivalent='0xdabd997ae5e4799be47d6e69d9431615cba28f48' +const tvlV1 = compoundExports2( { comptroller: '0x21c72522005ccf570f40acaa04b448918aecc2ad', cether: '0xE8548014f731194764AF27C8edc9bbAA7d2f4C46', cetheEquivalent}) +const tvlV2 = compoundExports2( { comptroller: '0xd6980C52C20Fb106e54cC6c8AE04c089C3F6B9d6', cether: '0x48c42529c4c8e3d10060e04240e9ec6cd0eb1218', cetheEquivalent}) +delete tvlV1.borrowed -const { tvl: v1Tvl, borrowed: v1Borrowed } = compoundExports( - "0x21c72522005ccf570f40acaa04b448918aecc2ad", - "wan", - "0xE8548014f731194764AF27C8edc9bbAA7d2f4C46", - "0xdabd997ae5e4799be47d6e69d9431615cba28f48", - -); - -const { tvl: v2Tvl, borrowed: v2Borrowed } = compoundExports( - "0xd6980C52C20Fb106e54cC6c8AE04c089C3F6B9d6", - "wan", - "0x48c42529c4c8e3d10060e04240e9ec6cd0eb1218", - "0xdabd997ae5e4799be47d6e69d9431615cba28f48", - -); - -module.exports = { - timetravel: true, - incentivized: false, +module.exports = mergeExports([{ methodology: `As in Compound Finance, TVL counts the tokens locked in the contracts to be used as collateral to borrow or to earn yield. Borrowed coins are counted as "Borrowed" TVL and can be toggled towards the regular TVL.`, - wan: { - tvl: sdk.util.sumChainTvls([v1Tvl,v2Tvl]), - borrowed: sdk.util.sumChainTvls([v1Borrowed,v2Borrowed]), - }, -}; + wan: tvlV1, +}, { wan: tvlV2}]) From ac68faec2012e3ba94279e26226d61e97d76cf41 Mon Sep 17 00:00:00 2001 From: Esteban <32603471+estebgonza@users.noreply.github.com> Date: Thu, 24 Aug 2023 14:13:36 +0200 Subject: [PATCH 0955/1974] Smardex: Register the factory on Base mainnet (#7266) * feat(smardex): update multichain tvl * feat: support base * chore: remove eof line --- projects/SmarDex/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/SmarDex/index.js b/projects/SmarDex/index.js index e7b845dd073..f654f4f6d53 100644 --- a/projects/SmarDex/index.js +++ b/projects/SmarDex/index.js @@ -6,6 +6,7 @@ const config = { bsc: '0xA8EF6FEa013034E62E2C4A9Ec1CDb059fE23Af33', polygon: '0x9A1e1681f6D59Ca051776410465AfAda6384398f', arbitrum: '0x41A00e3FbE7F479A99bA6822704d9c5dEB611F22', + base: '0xdd4536dD9636564D891c919416880a3e250f975A', } Object.keys(config).forEach(chain => { From bbbb51ef70fc73371e836caac9c255a75baa9e86 Mon Sep 17 00:00:00 2001 From: TJakubek <39831436+TJakubek@users.noreply.github.com> Date: Thu, 24 Aug 2023 14:13:51 +0200 Subject: [PATCH 0956/1974] Enosys - adding newest locked pools (#7265) --- projects/flarefarm/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/projects/flarefarm/index.js b/projects/flarefarm/index.js index bd5a66bcf26..cbda1c8ff9b 100644 --- a/projects/flarefarm/index.js +++ b/projects/flarefarm/index.js @@ -30,7 +30,9 @@ async function farmTvl(timestamp, ethblock, { [chain]: block }) { [EXFI, "0x61128b44C299b0f7a752BF6278f44f1EcefD9109"], ['0x3233642aCf7664a69c33e5a6FFAb321608d7A65f','0xF81B465C562ED3f54Aea772D8A56FAF93884ea2E'], [EXFI, "0x3B346b0b091fA8813f60Cd6e81b95b63375e22f5"], - ['0xc41aA3ac0e6efcb780cd4696E7eC3B8193BB46E1', "0xa275DD75C1182055C7039b839cC0Da017c78933a"] + ['0xc41aA3ac0e6efcb780cd4696E7eC3B8193BB46E1', "0xa275DD75C1182055C7039b839cC0Da017c78933a"], + [EXFI,"0x74C09E58AB2fb74dF729000e36D338016396ee67"], + ['0xcD15C231b8A0Bae40bD7938AE5eA8e43f1e9a15F',"0x0E437e1c7371b2ac0f3040e2B5866c9cb2e6EA64"], ]; return sumUnknownTokens({ tokensAndOwners: tokens, chain, block, useDefaultCoreAssets: true, }) From 01595d61df205db24cf6ae6139b32388931d9b6d Mon Sep 17 00:00:00 2001 From: Sooraj hoysal <78635921+hoysal08@users.noreply.github.com> Date: Thu, 24 Aug 2023 17:44:30 +0530 Subject: [PATCH 0957/1974] added fxdx on base (#7264) Co-authored-by: hoysal08 --- projects/fxdx/index.js | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/projects/fxdx/index.js b/projects/fxdx/index.js index 21aabc73263..df991145e8e 100644 --- a/projects/fxdx/index.js +++ b/projects/fxdx/index.js @@ -2,13 +2,23 @@ const sdk = require('@defillama/sdk') const { gmxExports } = require("../helper/gmx") const { sumTokensExport, nullAddress } = require('../helper/unwrapLPs') -const optimismvault = "0x10235996C4DAbCE8430a71Cbc06571bd475A1d0C"; -const customWETH = '0xd158b0f013230659098e58b66b602dff8f7ff120' -const wethTvl = sumTokensExport({ owner: customWETH, tokens: [nullAddress]}) -const gmxTVL = gmxExports({ vault: optimismvault, blacklistedTokens: [customWETH] }) +const vaultOp = "0x10235996C4DAbCE8430a71Cbc06571bd475A1d0C"; +const customWETHOp = "0xd158b0f013230659098e58b66b602dff8f7ff120"; + +const VaultBase = "0x1ce0EBd2b95221b924765456fdE017B076E79dbe"; +const customWETHBase ="0xd6c5469A7cc587E1E89A841FB7c102FF1370C05F"; + +const wethTvlOp = sumTokensExport({ owner: customWETHOp, tokens: [nullAddress]}) +const fxdxTVLOp = gmxExports({ vault: vaultOp, blacklistedTokens: [customWETHOp] }) + +const wethTvlBase = sumTokensExport({ owner: customWETHBase, tokens: [nullAddress]}) +const fxdxTVLBase = gmxExports({ vault: VaultBase, blacklistedTokens: [customWETHBase] }) module.exports = { optimism: { - tvl: sdk.util.sumChainTvls([gmxTVL, wethTvl]), + tvl: sdk.util.sumChainTvls([fxdxTVLOp, wethTvlOp]), }, + base:{ + tvl: sdk.util.sumChainTvls([fxdxTVLBase, wethTvlBase]), + } }; From c90496676d558aefab9421a6a17d1e80968a5154 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 24 Aug 2023 14:31:25 +0200 Subject: [PATCH 0958/1974] fix broken adapters --- projects/fodl/index.js | 47 +++++---------------------------- projects/fujidao-v2/index.js | 10 ++++--- projects/helper/chain/cosmos.js | 1 + projects/quicksilver/index.js | 5 ++-- projects/wavelength/index.js | 5 ++-- 5 files changed, 18 insertions(+), 50 deletions(-) diff --git a/projects/fodl/index.js b/projects/fodl/index.js index a9de64d7ee0..7c92ee96c46 100644 --- a/projects/fodl/index.js +++ b/projects/fodl/index.js @@ -1,8 +1,6 @@ -const sdk = require("@defillama/sdk"); -const BigNumber = require("bignumber.js") const abi = require('./abi.json') const { sumTokensExport } = require('../helper/unwrapLPs'); -const { log } = require("../helper/utils"); +const { sliceIntoChunks } = require("@defillama/sdk/build/util"); // taken from https://app.fodl.finance/config.json const config = { @@ -37,45 +35,12 @@ module.exports = { Object.keys(config).forEach(chain => { const { position_nft, lens_contract, pool2, staking, } = config[chain] module.exports[chain] = { - tvl: async (_, _b, { [chain]: block }) => { - // Get number of positions opened by users by querying the supply of ERC721 tokens - const erc721_supply = (await sdk.api.abi.call({ target: position_nft, abi: 'erc20:totalSupply', block, chain, })).output; - log(`${erc721_supply} position ownership ERC 721 existing`) - - // Get all positions contracts addresses - const positionsCalls = [...Array(parseInt(erc721_supply)).keys()].map(t => ({ target: position_nft, params: t })) - const positionsAddresses = ( - await sdk.api.abi.multiCall({ - calls: positionsCalls, - abi: abi['tokenByIndex'], - block, chain, - }) - ).output - - - // FODL uses flashloans to leverage the user provided collateral. TVL should count only what the user brought in, which is supplyAmount of supplyTokenAddress - // const usersSuppliedBalances = usersPositions.map(t => ({[t.supplyTokenAddress]: t.supplyAmount})) - const balances = {} - - // console.log(positionsAddresses.map(t => t.output).slice(0,5)) - // The call to getPositionsMetadata only accounts for max 192 positions - const calls = positionsAddresses.map(i => ({ params: [[i.output]] })) - const { output: data } = await sdk.api.abi.multiCall({ - target: lens_contract, - abi: abi.getPositionsMetadata, - calls, block, chain, - }) - data.forEach(({ output, input, success }) => { - if (!success) { - // log(chain, `failed for ${input.params}`) - return; - } - // log(output[0]) - // if (+output[0].positionValue > 0) - sdk.util.sumSingleBalance(balances, chain + ':' + output[0].supplyTokenAddress, output[0].supplyAmount) - // sdk.util.sumSingleBalance(balances, chain + ':' + output[0].borrowTokenAddress, output[0].borrowAmount) + tvl: async (_, _b, { [chain]: block }, { api }) => { + const positions = await api.fetchList({ lengthAbi: 'erc20:totalSupply', itemAbi: abi.tokenByIndex, target: position_nft,}) + const data = await api.multiCall({ abi: abi.getPositionsMetadata, calls: sliceIntoChunks(positions, 10).map(i => ({params: [i]})), target: lens_contract,}) + data.forEach(j => { + j.forEach(i => api.add(i.supplyTokenAddress, i.supplyAmount)) }) - return balances } } diff --git a/projects/fujidao-v2/index.js b/projects/fujidao-v2/index.js index 5611dc01365..d3f8e186a90 100644 --- a/projects/fujidao-v2/index.js +++ b/projects/fujidao-v2/index.js @@ -91,8 +91,9 @@ Object.keys(config).forEach(chain => { debtAssets.forEach((bal, i) => { if (!debtBals[i]) { - if (+bal === 0) return; - throw new Error(`No debt balance for ${bvaults[i]}`) + return; + // if (+bal === 0) return; + // throw new Error(`No debt balance for ${bvaults[i]}`) } api.add(debtAssets[i], debtBals[i] * -1) }) @@ -122,8 +123,9 @@ Object.keys(config).forEach(chain => { const debtBals = (await api.multiCall({ abi: 'uint256:totalDebt', calls: vaults, permitFailure: true, })) bals.forEach((bal, i) => { if (!debtBals[i]) { - if (+bal === 0) return; - throw new Error(`No debt balance for ${vaults[i]}`) + return; + // if (+bal === 0) return; + // throw new Error(`No debt balance for ${vaults[i]}`) } api.add(debtAssets[i], debtBals[i]) }) diff --git a/projects/helper/chain/cosmos.js b/projects/helper/chain/cosmos.js index e4d28b4e37f..28e3f75f0e5 100644 --- a/projects/helper/chain/cosmos.js +++ b/projects/helper/chain/cosmos.js @@ -21,6 +21,7 @@ const endPoints = { juno: "https://lcd-juno.cosmostation.io", cronos: "https://lcd-crypto-org.cosmostation.io", chihuahua: "https://rest.cosmos.directory/chihuahua", + quicksilver: "https://rest.cosmos.directory/quicksilver", // chihuahua: "https://api.chihuahua.wtf", injective: "https://lcd-injective.whispernode.com:443", migaloo: "https://migaloo-api.polkachu.com", diff --git a/projects/quicksilver/index.js b/projects/quicksilver/index.js index dfc8fec7888..107cae4b627 100644 --- a/projects/quicksilver/index.js +++ b/projects/quicksilver/index.js @@ -1,5 +1,6 @@ const sdk = require("@defillama/sdk"); const { get } = require("../helper/http"); +const { endPoints } = require("../helper/chain/cosmos"); const coinGeckoIds = { uatom: "cosmos", @@ -14,10 +15,10 @@ async function tvl() { const balances = {}; const { zones } = await get( - "https://api-quicksilver.takeshi.team/quicksilver/interchainstaking/v1/zones" + endPoints.quicksilver + "/quicksilver/interchainstaking/v1/zones" ); const { supply } = await get( - "https://api-quicksilver.takeshi.team/cosmos/bank/v1beta1/supply" + endPoints.quicksilver + "/cosmos/bank/v1beta1/supply" ); zones.map((zone) => { diff --git a/projects/wavelength/index.js b/projects/wavelength/index.js index 7bfbb0d19cf..ea5c8b6f637 100644 --- a/projects/wavelength/index.js +++ b/projects/wavelength/index.js @@ -14,9 +14,8 @@ async function fetch() { } module.exports = { - misrepresentedTokens: true, velas:{ - // tvl: onChainTvl('0xa4a48dfcae6490afe9c779bf0f324b48683e488c', 56062385) - tvl: fetch, + tvl: onChainTvl('0xa4a48dfcae6490afe9c779bf0f324b48683e488c', 56062385, { onlyUseExistingCache: true, }) + // tvl: fetch, }, } \ No newline at end of file From 9a01a272d2a141f2fee8fa546bd56958534990e5 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 24 Aug 2023 16:57:17 +0200 Subject: [PATCH 0959/1974] fix sentiment --- projects/helper/cache.js | 2 +- projects/helper/utils/graphql.js | 1 + projects/sentiment/index.js | 9 +++++---- projects/vooi/index.js | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/projects/helper/cache.js b/projects/helper/cache.js index 58eaf4731ce..4bf3560a09a 100644 --- a/projects/helper/cache.js +++ b/projects/helper/cache.js @@ -124,7 +124,7 @@ async function cachedGraphQuery(project, endpoint, query, { variables = {}, fetc } -async function graphFetchById({ endpoint, query, params = {}, api, options: { useBlock = false, safeBlockLimit = 100 } = {} }) { +async function graphFetchById({ endpoint, query, params = {}, api, options: { useBlock = false, safeBlockLimit = 500 } = {} }) { if (useBlock && !params.block) params.block = await api.getBlock() - safeBlockLimit diff --git a/projects/helper/utils/graphql.js b/projects/helper/utils/graphql.js index 88400d8efae..e9a2c82f81e 100644 --- a/projects/helper/utils/graphql.js +++ b/projects/helper/utils/graphql.js @@ -2,6 +2,7 @@ const axios = require("axios"); async function request(endpoint, query, { variables, withMetadata = false } = {}) { const { data: result } = await axios.post(endpoint, { query, variables }) + if (result.errors) throw new Error(result.errors[0].message) return withMetadata ? result : result.data } diff --git a/projects/sentiment/index.js b/projects/sentiment/index.js index c0c8973ab54..c2cce24352f 100644 --- a/projects/sentiment/index.js +++ b/projects/sentiment/index.js @@ -1,5 +1,5 @@ const ADDRESSES = require('../helper/coreAssets.json') -const { graphFetchById } = require('../helper/http') +const { cachedGraphQuery } = require('../helper/cache') async function tvl(timestamp, ethBlock, { arbitrum: block }, { api }) { const tokens = await api.call({ target: "0x17b07cfbab33c0024040e7c299f8048f4a49679b", abi: "address[]:getAllLTokens", }) @@ -8,7 +8,7 @@ async function tvl(timestamp, ethBlock, { arbitrum: block }, { api }) { api.addTokens(assets, totalAssets) // const userAccounts = await api.call({ target: "0x17b07cfbab33c0024040e7c299f8048f4a49679b", abi: "address[]:getAllAccounts", }) - const data = await graphFetchById({ endpoint: 'https://api.thegraph.com/subgraphs/name/r0ohafza/sentiment', query, api, options: { useBlock: true, } }) + const data = await cachedGraphQuery('sentiment', 'https://api.thegraph.com/subgraphs/name/r0ohafza/sentiment', query, { fetchById: true, }) const userAccounts = data.map(i => i.id) const [equity, borrows] = await Promise.all([ api.multiCall({ target: "0xc0ac97A0eA320Aa1E32e9DEd16fb580Ef3C078Da", calls: userAccounts, abi: "function getBalance(address account) view returns (uint256)", permitFailure: true, }), @@ -19,20 +19,21 @@ async function tvl(timestamp, ethBlock, { arbitrum: block }, { api }) { const borrow = borrows[i] ?? 0 api.add(ADDRESSES.arbitrum.WETH, equity_ - borrow) } + return api.getBalances() } module.exports = { misrepresentedTokens: true, + timetravel: false, arbitrum: { tvl, }, hallmarks: [ [Math.floor(new Date('2023-04-04') / 1e3), '1M hack'], ], }; -const query = `query get_accounts($lastId: String!, $block: Int!) { +const query = `query get_accounts($lastId: String!) { accounts( first: 1000 - block: {number: $block} where: {and: [{id_gt: $lastId}, {or: [{balance_gt: 0}, {debt_gt: 0}]}]} ) { id diff --git a/projects/vooi/index.js b/projects/vooi/index.js index ad67742e601..b48bd8f7d12 100644 --- a/projects/vooi/index.js +++ b/projects/vooi/index.js @@ -8,6 +8,6 @@ module.exports = { config.chains.forEach(chainInfo => { const {name: chain, tokens, holders} = chainInfo module.exports[chain] = { - tvl: sumTokensExport({ chain, tokens, owners: holders }) + tvl: sumTokensExport({ tokens, owners: holders }) } }) From 93d4cb2d2ae890e9db9dac250d2827faf73b8d4b Mon Sep 17 00:00:00 2001 From: define Date: Thu, 24 Aug 2023 16:52:43 +0100 Subject: [PATCH 0960/1974] remove duplicated --- projects/pancakeswap-v3/index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/projects/pancakeswap-v3/index.js b/projects/pancakeswap-v3/index.js index a6974738f6d..a9ca977649b 100644 --- a/projects/pancakeswap-v3/index.js +++ b/projects/pancakeswap-v3/index.js @@ -16,5 +16,4 @@ module.exports = uniV3Export({ linea: { factory: '0x0BFbCF9fa4f9C56B0F40a671Ad40E0805A091865', fromBlock: 1445, }, era: { factory: '0x1BB72E0CbbEA93c08f535fc7856E0338D7F7a8aB', fromBlock: 9413438, }, arbitrum: { factory: '0x0BFbCF9fa4f9C56B0F40a671Ad40E0805A091865', fromBlock: 101028949, }, - linea: { factory: '0x0BFbCF9fa4f9C56B0F40a671Ad40E0805A091865', fromBlock: 1444, }, }) From fa86dc07f45956e8750971178f90b84dd6dd4400 Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Thu, 24 Aug 2023 17:09:25 +0100 Subject: [PATCH 0961/1974] pendle optimism --- projects/pendle/v2.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/projects/pendle/v2.js b/projects/pendle/v2.js index 73ff88c91cd..7f8a7ccce8b 100644 --- a/projects/pendle/v2.js +++ b/projects/pendle/v2.js @@ -16,6 +16,10 @@ const config = { factory: "0x2bEa6BfD8fbFF45aA2a893EB3B6d85D10EFcC70E", fromBlock: 29484286, }, + optimism: { + factory: '0x17F100fB4bE2707675c6439468d38249DD993d58', + fromBlock: 108061448, + } }; module.exports = {}; @@ -71,7 +75,7 @@ Object.keys(config).forEach((chain) => { api.add(v.uAsset.toLowerCase(), value); }); let balances = api.getBalances(); - const bridged = `arbitrum:${steth}`; + const bridged = `${chain}:${steth}`; if (bridged in balances) { balances[steth] = balances[bridged]; delete balances[bridged]; From 1a453116277ca6abf93b0d86441a5b6051e10412 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Thu, 24 Aug 2023 18:24:14 +0100 Subject: [PATCH 0962/1974] remove borrowed --- projects/nexon/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/projects/nexon/index.js b/projects/nexon/index.js index dd0d3c3cbfe..ffa04159681 100644 --- a/projects/nexon/index.js +++ b/projects/nexon/index.js @@ -7,6 +7,10 @@ module.exports = { ], era: compoundExports('0x0171cA5b372eb510245F5FA214F5582911934b3D', 'era', '0x1BbD33384869b30A323e15868Ce46013C82B86FB', nullAddress, undefined, undefined, { resolveLPs: true, + blacklistedTokens: [ + "0x3355df6d4c9c3035724fd0e3914de96a5a83aaf4", + nullAddress + ], abis: { getReservesABI: 'function getReserves() view returns (uint112 _reserve0, uint112 _reserve1)' } From bc3a69a525077a748aa11ac11d0c8a9740a4dc5b Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Thu, 24 Aug 2023 18:31:51 +0100 Subject: [PATCH 0963/1974] update to remove borrowed only --- projects/nexon/index.js | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/projects/nexon/index.js b/projects/nexon/index.js index ffa04159681..95ebb362e16 100644 --- a/projects/nexon/index.js +++ b/projects/nexon/index.js @@ -1,18 +1,22 @@ const { compoundExports } = require('../helper/compound'); const { nullAddress } = require('../helper/tokenMapping'); +const comptroller = "0x0171cA5b372eb510245F5FA214F5582911934b3D" + +const abis = { + getReservesABI: 'function getReserves() view returns (uint112 _reserve0, uint112 _reserve1)' +} + +const lendingMarket = compoundExports(comptroller, 'era', '0x1BbD33384869b30A323e15868Ce46013C82B86FB', nullAddress, undefined, undefined, { + resolveLPs: true, abis +}) + module.exports = { hallmarks: [ [1690243200, "read-only Reentrancy Attack"] ], - era: compoundExports('0x0171cA5b372eb510245F5FA214F5582911934b3D', 'era', '0x1BbD33384869b30A323e15868Ce46013C82B86FB', nullAddress, undefined, undefined, { - resolveLPs: true, - blacklistedTokens: [ - "0x3355df6d4c9c3035724fd0e3914de96a5a83aaf4", - nullAddress - ], - abis: { - getReservesABI: 'function getReserves() view returns (uint112 _reserve0, uint112 _reserve1)' - } - }), + era: { + tvl: lendingMarket.tvl, + borrowed: ()=>({}) + } }; \ No newline at end of file From 2a03fc628c8a4e767aeabe20e78e918a41b62a94 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 24 Aug 2023 20:52:55 +0200 Subject: [PATCH 0964/1974] fix quickswap v3 --- projects/helper/uniswapV3.js | 4 ++-- projects/quickswap-v3/index.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/projects/helper/uniswapV3.js b/projects/helper/uniswapV3.js index 1075b062b8c..ebad767c37d 100644 --- a/projects/helper/uniswapV3.js +++ b/projects/helper/uniswapV3.js @@ -16,7 +16,7 @@ function uniV3Export(config) { const exports = {} Object.keys(config).forEach(chain => { - let { factory: target, fromBlock, topics, eventAbi, isAlgebra, blacklistedTokens = [] } = config[chain] + let { factory: target, fromBlock, topics, eventAbi, isAlgebra, blacklistedTokens = [], permitFailure, } = config[chain] if (!topics) topics = isAlgebra ? algebraConfig.topics : uniswapConfig.topics if (!eventAbi) eventAbi = isAlgebra ? algebraConfig.eventAbi : uniswapConfig.eventAbi @@ -31,7 +31,7 @@ function uniV3Export(config) { onlyArgs: true, }) - return sumTokens2({ api, ownerTokens: logs.map(i => [[i.token0, i.token1], i.pool]), blacklistedTokens, permitFailure: logs.length > 5000 }) + return sumTokens2({ api, ownerTokens: logs.map(i => [[i.token0, i.token1], i.pool]), blacklistedTokens, permitFailure: permitFailure || logs.length > 2000 }) } } }) diff --git a/projects/quickswap-v3/index.js b/projects/quickswap-v3/index.js index 647708069a3..be6da30c086 100644 --- a/projects/quickswap-v3/index.js +++ b/projects/quickswap-v3/index.js @@ -1,7 +1,7 @@ const { uniV3Export } = require('../helper/uniswapV3') const { cachedGraphQuery } = require('../helper/cache') module.exports = uniV3Export({ - polygon: { factory: '0x411b0facc3489691f28ad58c47006af5e3ab3a28', fromBlock: 32610688, isAlgebra: true, }, + polygon: { factory: '0x411b0facc3489691f28ad58c47006af5e3ab3a28', fromBlock: 32610688, isAlgebra: true, permitFailure: true, }, dogechain: { factory: '0xd2480162aa7f02ead7bf4c127465446150d58452', fromBlock: 837574, isAlgebra: true, }, polygon_zkevm: { factory: '0x4B9f4d2435Ef65559567e5DbFC1BbB37abC43B57', fromBlock: 300, isAlgebra: true, }, }) @@ -19,7 +19,7 @@ async function tvl(_, _b, _cb, { api, }) { } }`) const ownerTokens = pools.map(p=>[[p.token0.id, p.token1.id], p.id]) - return api.sumTokens({ ownerTokens }) + return api.sumTokens({ ownerTokens, }) } module.exports.dogechain.tvl = tvl \ No newline at end of file From 964622b8ccea6f26da9f9ec07eecbf9fdda9c2e1 Mon Sep 17 00:00:00 2001 From: Pablo Veyrat <50438397+sogipec@users.noreply.github.com> Date: Thu, 24 Aug 2023 22:12:43 +0200 Subject: [PATCH 0965/1974] fix: angle methodology description (#7270) --- projects/angle/index.js | 87 +++++++++++++++++++++++++++++------------ 1 file changed, 63 insertions(+), 24 deletions(-) diff --git a/projects/angle/index.js b/projects/angle/index.js index 9d5cf87c75c..855b9e7dbb3 100644 --- a/projects/angle/index.js +++ b/projects/angle/index.js @@ -1,11 +1,15 @@ -const ADDRESSES = require('../helper/coreAssets.json') +const ADDRESSES = require("../helper/coreAssets.json"); const sdk = require("@defillama/sdk"); const { staking } = require("../helper/staking"); const { getConfig } = require("../helper/cache"); const { sumTokens2 } = require("../helper/unwrapLPs"); const { getUniqueAddresses } = require("../helper/tokenMapping"); -const { TreasuryTokenAddresses, governorAddress, guardianAddress } = require("./addresses.js"); +const { + TreasuryTokenAddresses, + governorAddress, + guardianAddress, +} = require("./addresses.js"); const ANGLE = "0x31429d1856ad1377a8a0079410b297e1a9e214c2"; const veANGLE = "0x0C462Dbb9EC8cD1630f1728B2CFD2769d09f0dd5"; @@ -17,7 +21,7 @@ const poolManagers_abi = { const transmuter_abi = { getCollateralList: "address[]:getCollateralList", -} +}; // get Borrowing module vault managers list async function getVaultManagersFromAPI(api) { @@ -35,18 +39,16 @@ async function getVaultManagersFromAPI(api) { } async function tvl(timestamp, _1, _2, { api }) { - const chain = api.chain + const chain = api.chain; const balances = {}; const tokensAndOwners = []; if (chain === "ethereum") { - // Registry will be released in next sdk of Angle + graphql endpoint to come const agEUR = { contract: "0x1a7e4e63778B4f12a199C062f3eFdD288afCBce8", stableMasterFront: "0x5adDc89785D75C86aB939E9e15bfBBb7Fc086A87", poolManagers: { dai: "0xc9daabC677F3d1301006e723bD21C60be57a5915", // DAI - // usdc: "0xe9f183FC656656f1F17af1F2b0dF79b8fF9ad8eD", // USDC disabled because of EULER hack fei: "0x53b981389Cfc5dCDA2DC2e903147B5DD0E985F44", // FEI frax: "0x6b4eE7352406707003bC6f6b96595FD35925af48", // FRAX weth: "0x3f66867b4b6eCeBA0dBb6776be15619F73BC30A2", // WETH @@ -55,8 +57,13 @@ async function tvl(timestamp, _1, _2, { api }) { }; // count the USDC in pool manager contract - tokensAndOwners.push([ADDRESSES.ethereum.USDC, '0xe9f183FC656656f1F17af1F2b0dF79b8fF9ad8eD']) // add USDC in USDC manager - const poolManagers = getUniqueAddresses([agEUR].map(i => Object.values(i.poolManagers)).flat()) + tokensAndOwners.push([ + ADDRESSES.ethereum.USDC, + "0xe9f183FC656656f1F17af1F2b0dF79b8fF9ad8eD", + ]); // add USDC in USDC manager + const poolManagers = getUniqueAddresses( + [agEUR].map((i) => Object.values(i.poolManagers)).flat() + ); let assets = await api.multiCall({ calls: poolManagers, @@ -78,20 +85,43 @@ async function tvl(timestamp, _1, _2, { api }) { const cvxagEUREUROCstaker = "0xA91fccC1ec9d4A2271B7A86a7509Ca05057C1A98"; const AngleagEUREUROCStaker = "0xC1e8Dba1cbF29f1CaA8343CAe96d5AdFD9bca736"; // pool TVL - const [agEurBal, eurocBal, totPoolTokenSupply, sdagEUREUROCTVL, cvxagEUREUROCstakerTVL] = await Promise.all([ - api.call({ abi: 'erc20:balanceOf', target: agEUR.contract, params: curvePool }), - api.call({ abi: 'erc20:balanceOf', target: EUROC, params: curvePool }), - api.call({ abi: 'erc20:totalSupply', target: curvePool }), + const [ + agEurBal, + eurocBal, + totPoolTokenSupply, + sdagEUREUROCTVL, + cvxagEUREUROCstakerTVL, + ] = await Promise.all([ + api.call({ + abi: "erc20:balanceOf", + target: agEUR.contract, + params: curvePool, + }), + api.call({ abi: "erc20:balanceOf", target: EUROC, params: curvePool }), + api.call({ abi: "erc20:totalSupply", target: curvePool }), // Angle holdings of Curve agEUREUROC LP tokens (staked on Stake DAO and Convex) - api.call({ abi: 'erc20:balanceOf', target: sdagEUREUROC, params: AngleagEUREUROCStaker }), - api.call({ abi: 'erc20:balanceOf', target: cvxagEUREUROCstaker, params: AngleagEUREUROCStaker }), - ]) - const eurocBalance = eurocBal * (+sdagEUREUROCTVL + +cvxagEUREUROCstakerTVL) / totPoolTokenSupply + api.call({ + abi: "erc20:balanceOf", + target: sdagEUREUROC, + params: AngleagEUREUROCStaker, + }), + api.call({ + abi: "erc20:balanceOf", + target: cvxagEUREUROCstaker, + params: AngleagEUREUROCStaker, + }), + ]); + const eurocBalance = + (eurocBal * (+sdagEUREUROCTVL + +cvxagEUREUROCstakerTVL)) / + totPoolTokenSupply; sdk.util.sumSingleBalance(balances, EUROC, eurocBalance); // Transmuter if (timestamp > 1691656362) { - let collaterals = await api.call({ abi: transmuter_abi["getCollateralList"], target: agEUR.transmuter, }); + let collaterals = await api.call({ + abi: transmuter_abi["getCollateralList"], + target: agEUR.transmuter, + }); collaterals.forEach((collateral, i) => { tokensAndOwners.push([collateral, agEUR.transmuter]); @@ -103,13 +133,13 @@ async function tvl(timestamp, _1, _2, { api }) { tokensAndOwners.push(...(await getVaultManagersFromAPI(api))); // Treasury - Governor - const governorTokens = TreasuryTokenAddresses['governor'][chain] + const governorTokens = TreasuryTokenAddresses["governor"][chain]; governorTokens.forEach((token) => { tokensAndOwners.push([token, governorAddress[chain]]); }); // Treasury - Guardian - const guardianTokens = TreasuryTokenAddresses['guardian'][chain] + const guardianTokens = TreasuryTokenAddresses["guardian"][chain]; guardianTokens.forEach((token) => { tokensAndOwners.push([token, guardianAddress[chain]]); }); @@ -124,16 +154,25 @@ If not, the API call defaults to mainnet and the blockchain calls fail and retur module.exports = { hallmarks: [ - [Math.floor(new Date('2023-03-13') / 1e3), 'Euler was hacked'], - [Math.floor(new Date('2023-08-02') / 1e3), 'Migration to v2 (Transmuter)'], + [Math.floor(new Date("2023-03-13") / 1e3), "Euler was hacked"], + [Math.floor(new Date("2023-08-02") / 1e3), "Migration to v2 (Transmuter)"], ], ethereum: { staking: staking(veANGLE, ANGLE, "ethereum"), }, - methodology: `TVL is retrieved on-chain by querying the total assets managed by the Core module, and the balances of the vaultManagers of the Borrowing module.`, + methodology: `TVL is retrieved on-chain by getting the total assets managed by the Transmuter, the balances of the vaultManagers of the Borrowing module and of the governance addresses of the protocol.`, }; -["ethereum", "polygon", "optimism", "arbitrum", "avax", "celo", "bsc", "xdai"].forEach((chain) => { +[ + "ethereum", + "polygon", + "optimism", + "arbitrum", + "avax", + "celo", + "bsc", + "xdai", +].forEach((chain) => { if (!module.exports[chain]) module.exports[chain] = {}; - module.exports[chain].tvl = tvl + module.exports[chain].tvl = tvl; }); From 3c6c74b9cb8a2af2344a1380ef3ba7054f8bc537 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 24 Aug 2023 22:22:22 +0200 Subject: [PATCH 0966/1974] ww: track SEI & migaloo --- projects/helper/coreAssets.json | 3 +++ projects/helper/tokenMapping.js | 2 +- projects/whitewhale-dex/index.js | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index 9ce2227753e..6fd835034d2 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -1368,5 +1368,8 @@ }, "archway": { "ARCH": "aarch" + }, + "migaloo": { + "WHALE": "uwhale" } } diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 23354f77330..0d923c71565 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -16,7 +16,7 @@ coreAssets = JSON.parse(JSON.stringify(coreAssets)) // carbon: https://api-insights.carbon.network/info/denom_gecko_map // orbit brige: https://bridge.orbitchain.io/open/v1/api/monitor/rawTokenList -const ibcChains = ['ibc', 'terra', 'terra2', 'crescent', 'osmosis', 'kujira', 'stargaze', 'juno', 'injective', 'cosmos', 'comdex', 'stargaze', 'umee', 'orai', 'persistence', 'fxcore', 'neutron', 'quasar', 'chihuahua', 'sei', 'archway'] +const ibcChains = ['ibc', 'terra', 'terra2', 'crescent', 'osmosis', 'kujira', 'stargaze', 'juno', 'injective', 'cosmos', 'comdex', 'stargaze', 'umee', 'orai', 'persistence', 'fxcore', 'neutron', 'quasar', 'chihuahua', 'sei', 'archway', 'migaloo', ] const caseSensitiveChains = [...ibcChains, 'solana', 'tezos', 'ton', 'algorand', 'aptos', 'near', 'bitcoin', 'waves', 'tron', 'litecoin', 'polkadot', 'ripple', 'elrond', 'cardano', 'stacks', 'sui', 'ergo',] const distressedAssts = new Set(Object.values({ diff --git a/projects/whitewhale-dex/index.js b/projects/whitewhale-dex/index.js index 60ad7f57955..e8c04b8ffa1 100644 --- a/projects/whitewhale-dex/index.js +++ b/projects/whitewhale-dex/index.js @@ -6,6 +6,8 @@ const factory = { injective: "inj1x22q8lfhz7qcvtzs0dakhgx2th64l79kfye5lk", comdex: "comdex1gurgpv8savnfw66lckwzn4zk7fp394lpe667dhu7aw48u40lj6jswv4mft", chihuahua: "chihuahua1s8ehad3r9wxyk08ls2nmz8mqh4vlfmaxd2nw0crxwh04t4l5je4s8ljv0j", + migaloo: "migaloo1z89funaazn4ka8vrmmw4q27csdykz63hep4ay8q2dmlspc6wtdgq92u369", + sei: "sei1tcx434euh2aszzfsjxqzvjmc4cww54rxvfvv8v7jz353rg779l2st699q0", } module.exports = { From eece31adc74fe7d2fb5b7cea468f40f44272184b Mon Sep 17 00:00:00 2001 From: charq <73696209+buchaoqun@users.noreply.github.com> Date: Fri, 25 Aug 2023 06:41:27 +0800 Subject: [PATCH 0967/1974] add mantle network (#7267) --- projects/solv-protocol-v3/index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/projects/solv-protocol-v3/index.js b/projects/solv-protocol-v3/index.js index d013e6c040a..8d803bec7a7 100644 --- a/projects/solv-protocol-v3/index.js +++ b/projects/solv-protocol-v3/index.js @@ -7,6 +7,7 @@ const graphUrlList = { ethereum: 'https://api.studio.thegraph.com/query/40045/solv-payable-factory-prod/version/latest', bsc: 'https://api.thegraph.com/subgraphs/name/slov-payable/solv-v3-earn-factory', arbitrum: 'https://api.studio.thegraph.com/query/40045/solv-payable-factory-arbitrum/version/latest', + mantle: 'https://graph.fusionx.finance/subgraphs/id/QmfV5npZ5X2tZ4qR9DCLAhrFum6wANF7cnJDrZMpkNLfMo', } const filterSlot = [ @@ -149,7 +150,7 @@ async function getGraphData(timestamp, chain) { pools: poolList }; } - -['ethereum', 'bsc', 'arbitrum'].forEach(chain => { +// node test.js projects/solv-protocol-v3 +['ethereum', 'bsc', 'arbitrum', 'mantle'].forEach(chain => { module.exports[chain] = { tvl } }) \ No newline at end of file From fac9d8d77a54d25044906df788f1a880603803af Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Fri, 25 Aug 2023 04:06:46 +0100 Subject: [PATCH 0968/1974] update to new vault contract --- projects/gplx/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/gplx/index.js b/projects/gplx/index.js index 1d18f4a4033..10f194b0a1c 100644 --- a/projects/gplx/index.js +++ b/projects/gplx/index.js @@ -5,6 +5,6 @@ module.exports = { [1687320000, "Token supply compromise"] ], pulse:{ - tvl: gmxExports({ vault: '0xC2311efFE60b0dC2491148Ff1bd46F08D64ADC98', }) + tvl: gmxExports({ vault: '0x4a305E6F8724Cb5F0106C8CdC90e9C6CA6429083', }) } }; \ No newline at end of file From b7d692b0ca8a79cc42292a01b7baac7b81ef7f96 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Fri, 25 Aug 2023 04:13:42 +0100 Subject: [PATCH 0969/1974] add hallmark --- projects/gplx/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/gplx/index.js b/projects/gplx/index.js index 10f194b0a1c..d3fdf92a1e0 100644 --- a/projects/gplx/index.js +++ b/projects/gplx/index.js @@ -2,7 +2,8 @@ const { gmxExports } = require('../helper/gmx') module.exports = { hallmarks: [ - [1687320000, "Token supply compromise"] + [1687320000, "Token supply compromise"], + [1692921600, "Protocol relauch"] ], pulse:{ tvl: gmxExports({ vault: '0x4a305E6F8724Cb5F0106C8CdC90e9C6CA6429083', }) From cbb9bff9181d929c77ce0bf3eff9913b63e4d520 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Fri, 25 Aug 2023 05:41:51 +0100 Subject: [PATCH 0970/1974] fix date --- projects/gplx/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/gplx/index.js b/projects/gplx/index.js index d3fdf92a1e0..dda68608d4f 100644 --- a/projects/gplx/index.js +++ b/projects/gplx/index.js @@ -3,7 +3,7 @@ const { gmxExports } = require('../helper/gmx') module.exports = { hallmarks: [ [1687320000, "Token supply compromise"], - [1692921600, "Protocol relauch"] + [1692835200, "Protocol relauch"] ], pulse:{ tvl: gmxExports({ vault: '0x4a305E6F8724Cb5F0106C8CdC90e9C6CA6429083', }) From 32b1f9a0763918b0046840d62abca1f87ea4b7d2 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 25 Aug 2023 08:46:14 +0200 Subject: [PATCH 0971/1974] Magnate rugged --- projects/Magnate/index.js | 21 +++++++++------------ projects/helper/chain/cosmos.js | 1 + projects/helper/tokenMapping.js | 2 +- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/projects/Magnate/index.js b/projects/Magnate/index.js index d9eaafc1ccd..707b662419e 100644 --- a/projects/Magnate/index.js +++ b/projects/Magnate/index.js @@ -1,14 +1,11 @@ -const { compoundExports2 } = require("../helper/compound"); -const { staking } = require('../helper/staking') -const { pool2 } = require('../helper/pool2') - module.exports = { - base: compoundExports2({ - comptroller: "0x9C1925d9fA1E9ba7aa57db36B15E29C07f5d85e2", - fetchBalances: true, - cether: '0x68725461357B7e5e059A224B3b2fC45F3654c889', - }), + base: { + tvl:() => ({}), + staking:() => ({}), + pool2:() => ({}), + borrowed:() => ({}), + }, + hallmarks: [ + [Math.floor(new Date('2023-08-25')/1e3), 'Project Rugged'], + ], }; - -module.exports.base.staking = staking('0xaa8578b6F2860EbA5685090A3E002430ba046a4C', '0x2DC1cDa9186a4993bD36dE60D08787c0C382BEAD', 'base') -module.exports.base.pool2 = pool2('0x3B87B63b5E84e6F9A173D15ad4cdB3263B550064', '0xC2dced7Ce908652d3b55D55555DcE96b6cdCB191', 'base') diff --git a/projects/helper/chain/cosmos.js b/projects/helper/chain/cosmos.js index 28e3f75f0e5..30860fa8049 100644 --- a/projects/helper/chain/cosmos.js +++ b/projects/helper/chain/cosmos.js @@ -21,6 +21,7 @@ const endPoints = { juno: "https://lcd-juno.cosmostation.io", cronos: "https://lcd-crypto-org.cosmostation.io", chihuahua: "https://rest.cosmos.directory/chihuahua", + stargaze: "https://api-stargaze.ezstaking.dev", quicksilver: "https://rest.cosmos.directory/quicksilver", // chihuahua: "https://api.chihuahua.wtf", injective: "https://lcd-injective.whispernode.com:443", diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 0d923c71565..9bdead0fb34 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -16,7 +16,7 @@ coreAssets = JSON.parse(JSON.stringify(coreAssets)) // carbon: https://api-insights.carbon.network/info/denom_gecko_map // orbit brige: https://bridge.orbitchain.io/open/v1/api/monitor/rawTokenList -const ibcChains = ['ibc', 'terra', 'terra2', 'crescent', 'osmosis', 'kujira', 'stargaze', 'juno', 'injective', 'cosmos', 'comdex', 'stargaze', 'umee', 'orai', 'persistence', 'fxcore', 'neutron', 'quasar', 'chihuahua', 'sei', 'archway', 'migaloo', ] +const ibcChains = ['ibc', 'terra', 'terra2', 'crescent', 'osmosis', 'kujira', 'stargaze', 'juno', 'injective', 'cosmos', 'comdex', 'umee', 'orai', 'persistence', 'fxcore', 'neutron', 'quasar', 'chihuahua', 'sei', 'archway', 'migaloo', ] const caseSensitiveChains = [...ibcChains, 'solana', 'tezos', 'ton', 'algorand', 'aptos', 'near', 'bitcoin', 'waves', 'tron', 'litecoin', 'polkadot', 'ripple', 'elrond', 'cardano', 'stacks', 'sui', 'ergo',] const distressedAssts = new Set(Object.values({ From 710cc68cc5e16e087c6e288f30f4a2cf3a67d0bc Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 25 Aug 2023 10:36:43 +0200 Subject: [PATCH 0972/1974] refactor onx --- projects/config/onx/avalanche/index.js | 48 ---- projects/config/onx/avalanche/vaults.js | 88 ++----- projects/config/onx/constant.js | 62 +---- projects/config/onx/ethereum/farmTvl.js | 99 -------- projects/config/onx/ethereum/farms.js | 78 ------ projects/config/onx/ethereum/index.js | 319 ++++-------------------- projects/config/onx/ethereum/prices.js | 55 ---- projects/config/onx/ethereum/vaults.js | 87 ++----- projects/config/onx/fantom/index.js | 89 ------- projects/config/onx/fantom/vaults.js | 83 ++---- projects/config/onx/polygon/index.js | 50 ---- projects/config/onx/polygon/vaults.js | 88 ++----- projects/helper/ankr/chainAddresses.js | 10 - projects/helper/ankr/networks.js | 84 ------- projects/helper/ankr/utils.js | 75 ------ projects/onx.js | 40 +-- 16 files changed, 147 insertions(+), 1208 deletions(-) delete mode 100644 projects/config/onx/avalanche/index.js delete mode 100644 projects/config/onx/ethereum/farmTvl.js delete mode 100644 projects/config/onx/ethereum/farms.js delete mode 100644 projects/config/onx/ethereum/prices.js delete mode 100644 projects/config/onx/fantom/index.js delete mode 100644 projects/config/onx/polygon/index.js delete mode 100644 projects/helper/ankr/chainAddresses.js delete mode 100644 projects/helper/ankr/networks.js delete mode 100644 projects/helper/ankr/utils.js diff --git a/projects/config/onx/avalanche/index.js b/projects/config/onx/avalanche/index.js deleted file mode 100644 index 82644c500b6..00000000000 --- a/projects/config/onx/avalanche/index.js +++ /dev/null @@ -1,48 +0,0 @@ -const BigNumber = require('bignumber.js'); -const { ZERO, getVautsTvl, } = require('../../../helper/ankr/utils'); -const { vaults } = require('./vaults'); -const { request, gql } = require("graphql-request"); - -const getQuickQuery = (pairAddress) => gql` - query pairs { - pairs(where: { id: "${pairAddress}"} ) { - id - reserveUSD - volumeUSD - totalSupply - } - }` -; - -const url = 'https://api.thegraph.com/subgraphs/name/traderjoe-xyz/exchange'; - -const getPairsData = async (pairAddress) => { - try { - const result = await request(url, getQuickQuery(pairAddress)); - const last = result.pairs.length; - return result && result.pairs ? result.pairs[last - 1] : {}; - } catch (e) { - console.error(e); - } - - return {}; -}; - -const getTraderJoePoolPrice = async (vault) => { - if (!vault.pool) { - return ZERO; - } - - const data = await getPairsData(vault.pool); - const { reserveUSD, totalSupply } = data; - - return reserveUSD && totalSupply ? new BigNumber(reserveUSD).div(totalSupply).div(1e18) : ZERO; -}; - -const getAvalancheTvl = async () => { - return getVautsTvl(vaults, getTraderJoePoolPrice); -}; - -module.exports = { - getAvalancheTvl, -} \ No newline at end of file diff --git a/projects/config/onx/avalanche/vaults.js b/projects/config/onx/avalanche/vaults.js index 4f9f685be20..8440ae3433e 100644 --- a/projects/config/onx/avalanche/vaults.js +++ b/projects/config/onx/avalanche/vaults.js @@ -1,93 +1,45 @@ -const createVaultModel = (poolAddress, vaultAddress) => { - return { - pool: poolAddress, - vault: vaultAddress, - chain: 'avax', - } -} - const vaults = [ //usdcAvax - { - ...createVaultModel('0xa389f9430876455c36478deea9769b7ca4e3ddb1', '0x8025d4deDa0C7512d44438a7DC597612B4108F07'), - }, + ['0xa389f9430876455c36478deea9769b7ca4e3ddb1', '0x8025d4deDa0C7512d44438a7DC597612B4108F07'], //wethAvax - { - ...createVaultModel('0xfe15c2695f1f920da45c30aae47d11de51007af9', '0xf7AcA362510b327bDAca693611353b6a837cBDB2'), - }, + ['0xfe15c2695f1f920da45c30aae47d11de51007af9', '0xf7AcA362510b327bDAca693611353b6a837cBDB2'], //avaxUsdte - { - ...createVaultModel('0xed8cbd9f0ce3c6986b22002f03c6475ceb7a6256', '0x897Fb124aCdF5A685d9258645ffee0058464817A'), - }, + ['0xed8cbd9f0ce3c6986b22002f03c6475ceb7a6256', '0x897Fb124aCdF5A685d9258645ffee0058464817A'], //joeAvax [not available] - { - ...createVaultModel('0x454e67025631c065d3cfad6d71e6892f74487a15', '0x02e9bc3EF29A3f51EdE6e4c4F70fdcb894CD6Cf5'), - }, + ['0x454e67025631c065d3cfad6d71e6892f74487a15', '0x02e9bc3EF29A3f51EdE6e4c4F70fdcb894CD6Cf5'], //wBtcAvax - { - ...createVaultModel('0xd5a37dc5c9a396a03dd1136fc76a1a02b1c88ffa', '0x8922E41342C6160fAf4dC40f2c1fCFCd94E98779'), - }, + ['0xd5a37dc5c9a396a03dd1136fc76a1a02b1c88ffa', '0x8922E41342C6160fAf4dC40f2c1fCFCd94E98779'], //linkAvax - { - ...createVaultModel('0x6f3a0c89f611ef5dc9d96650324ac633d02265d3', '0x55F42961b3aD4E2A08f1780C7434dd8EC5f7FcE4'), - }, + ['0x6f3a0c89f611ef5dc9d96650324ac633d02265d3', '0x55F42961b3aD4E2A08f1780C7434dd8EC5f7FcE4'], //joeUsdce - { - ...createVaultModel('0x67926d973cd8ee876ad210faaf7dffa99e414acf', '0xD9F63Cc588822cD3eF802D900808E946d13CE609'), - }, + ['0x67926d973cd8ee876ad210faaf7dffa99e414acf', '0xD9F63Cc588822cD3eF802D900808E946d13CE609'], //bnbAvax - { - ...createVaultModel('0xeb8eb6300c53c3addbb7382ff6c6fbc4165b0742', '0x4decafaCD4591e52f85e8FE69F82F2400176BB33'), - }, + ['0xeb8eb6300c53c3addbb7382ff6c6fbc4165b0742', '0x4decafaCD4591e52f85e8FE69F82F2400176BB33'], //joeUsdte - { - ...createVaultModel('0x1643de2efb8e35374d796297a9f95f64c082a8ce', '0xfD127Bc3b6153b043fFD8d7f38272593700b124c'), - }, + ['0x1643de2efb8e35374d796297a9f95f64c082a8ce', '0xfD127Bc3b6153b043fFD8d7f38272593700b124c'], // //spellAvax [not available] - // { - // ...createVaultModel('0x62cf16bf2bc053e7102e2ac1dee5029b94008d99', '0x9eE877279DFE8e5F20614db88e50CD72B4efDEAD'), - // }, + ['0x62cf16bf2bc053e7102e2ac1dee5029b94008d99', '0x9eE877279DFE8e5F20614db88e50CD72B4efDEAD'], // //xavaAvax [not available] - // { - // ...createVaultModel('0x72c3438cf1c915ecf5d9f17a6ed346b273d5bf71', '0x54720637Fa477eD87Cd06F674247a649A5168eB6'), - // }, + ['0x72c3438cf1c915ecf5d9f17a6ed346b273d5bf71', '0x54720637Fa477eD87Cd06F674247a649A5168eB6'], //linkeUsdce - { - ...createVaultModel('0xb9f425bc9af072a91c423e31e9eb7e04f226b39d', '0x62CA6F1640776070ECa70E09d9AF27352a43a5D8'), - }, + ['0xb9f425bc9af072a91c423e31e9eb7e04f226b39d', '0x62CA6F1640776070ECa70E09d9AF27352a43a5D8'], //wethUsdce - { - ...createVaultModel('0x199fb78019a08af2cb6a078409d0c8233eba8a0c', '0x2C858E3181988f2E4458f14768aE204E5BF2Ee0e'), - }, + ['0x199fb78019a08af2cb6a078409d0c8233eba8a0c', '0x2C858E3181988f2E4458f14768aE204E5BF2Ee0e'], //pefiAvax [not available] - { - ...createVaultModel('0xb78c8238bd907c42be45aebdb4a8c8a5d7b49755', '0x276F74C24Cc4443Ecb4967Db77572BE50aeD4117'), - }, + ['0xb78c8238bd907c42be45aebdb4a8c8a5d7b49755', '0x276F74C24Cc4443Ecb4967Db77572BE50aeD4117'], //wbtceAvax - { - ...createVaultModel('0x62475f52add016a06b398aa3b2c2f2e540d36859', '0x008E6bf114D686713dC233487e360A158433e519'), - }, + ['0x62475f52add016a06b398aa3b2c2f2e540d36859', '0x008E6bf114D686713dC233487e360A158433e519'], //aaveAvax - { - ...createVaultModel('0xc3e6d9f7a3a5e3e223356383c7c055ee3f26a34f', '0xE7c34e1946A10a3A28BEd4B0Cb5B7F0d85F5368D'), - }, + ['0xc3e6d9f7a3a5e3e223356383c7c055ee3f26a34f', '0xE7c34e1946A10a3A28BEd4B0Cb5B7F0d85F5368D'], //qiAvax - { - ...createVaultModel('0x2774516897ac629ad3ed9dcac7e375dda78412b9', '0x0240269d999301d03aAe390104584F7517f52ECd'), - }, + ['0x2774516897ac629ad3ed9dcac7e375dda78412b9', '0x0240269d999301d03aAe390104584F7517f52ECd'], // //avaxBoo [not available] - // { - // ...createVaultModel('0xebf50b8089a0c5e7c5de23f644fcd723818f65b3', '0xB4a805Ad532BB92501507C9eAc27FD0BAe4d68A1'), - // }, + ['0xebf50b8089a0c5e7c5de23f644fcd723818f65b3', '0xB4a805Ad532BB92501507C9eAc27FD0BAe4d68A1'], // //maiAvax [not available] - // { - // ...createVaultModel('0x23ddca8de11eccd8000263f008a92e10dc1f21e8', '0x2071fD6779B701aa71c4a48b8f37970160e5FE75'), - // }, + ['0x23ddca8de11eccd8000263f008a92e10dc1f21e8', '0x2071fD6779B701aa71c4a48b8f37970160e5FE75'], // //h20Avax [not available] - // { - // ...createVaultModel('0x9615a11eaa912eae869e9c1097df263fc3e105f3', '0x6b42A98af10C2E94a6951c94b8Ac5B5EEB23c8AF'), - // }, + ['0x9615a11eaa912eae869e9c1097df263fc3e105f3', '0x6b42A98af10C2E94a6951c94b8Ac5B5EEB23c8AF'], ] module.exports = { diff --git a/projects/config/onx/constant.js b/projects/config/onx/constant.js index 9b3c7b565cb..49f50ba4e5b 100644 --- a/projects/config/onx/constant.js +++ b/projects/config/onx/constant.js @@ -1,68 +1,22 @@ -const ADDRESSES = require('../../helper/coreAssets.json') const tokenAddresses = { onx: "0xe0ad1806fd3e7edf6ff52fdb822432e847411033", sOnx: "0xa99f0ad2a539b2867fcfea47f7e71f240940b47c", onxFarm: "0x168f8469ac17dd39cd9a2c2ead647f814a488ce9", onxTripleFarm: "0x30D1A19EA928cCf46634cBC2944D2D89Be636f22", - usdWethPair: "0x0d4a11d5eeaac28ec3f61d100daf4d40471f1852", onxWethSushiPair: "0x62f22A47e5D2F8b71cC44fD85863753618312f67", - wethAethPair: "0x6147805e1011417b93e5d693424a62a70d09d0e5", - ankrWethPair: "0x5201883feeb05822ce25c9af8ab41fc78ca73fa9", pool: "0x47F3E6C1Ef0cBe69502167095b592e61de108BaA", aethToken: "0xE95A203B1a91a908F9B9CE46459d101078c2c3cb", onsToken: "0xfC97C0c12438B6E4CF246cD831b02FeF4950DCAD", - daiToken: ADDRESSES.ethereum.DAI, - fraxToken: ADDRESSES.ethereum.FRAX, - usdcToken: ADDRESSES.ethereum.USDC, - aethPairEth: "0x6147805e1011417B93e5D693424a62A70d09d0E5", - aethPairOns: "0x5022BbC26B3Bc8c8d2F1F7dB9ee3A2B4631b9b18", - aethPairOne: "0x5BD4D1f8D46Ad6ae1e6b694eb64f7583C1cB1A74", oneVault: "0x3BdF1977d87EDAD8e0617efCEa958F6d43A4C30E", - wethToken: ADDRESSES.ethereum.WETH, - bondPairEth: "0xb17b1342579e4bce6b6e9a426092ea57d33843d9", - sushiPairEth: "0xce84867c3c02b05dc570d0135103d3fb9cc19433", - fantom: { - usdcBooPair: '0xf8cb2980120469d79958151daa45eb937c6e1ed6', - }, onePools: [ - { - title: 'aeth', - address: '0x54c532E367031F56c401C6024aC4ABEfF2b03534', - }, - { - title: 'weth', - address: '0xbc2346C3c7F3998A12A1c8E7Be44734EcC832763', - }, - { - title: 'onx', - address: '0x5e60d73437aCCC3294a8Edf59639c1Dc1BaF0d75', - }, - { - title: 'dai', - address: '0xe64796FCc97c33A2193Ba60f013F3fA5D4712d56', - }, - { - title: 'frax', - address: '0xe659fA84e0C687760245046BA63329d44320997c', - }, - { - title: 'usdc', - address: '0x19Eb6536777713aCdAcA8dd9A3AD9843D74E9E3b', - }, - ], - onsPools: [ - { - title: 'aethPairOne', - address: '0x1B72255a11DF705Bb598E670830E03A19F2D242f', - }, - { - title: 'aethPairOns', - address: '0x7058EE5467edef417746aab0B8cabbbE36eF1798', - }, - { - title: 'aethPairEth', - address: '0x9792eE4c36a622a8CF9566b037c57519A9fe8a56', - }, + '0x54c532E367031F56c401C6024aC4ABEfF2b03534', + '0xbc2346C3c7F3998A12A1c8E7Be44734EcC832763', + '0xe64796FCc97c33A2193Ba60f013F3fA5D4712d56', + '0xe659fA84e0C687760245046BA63329d44320997c', + '0x19Eb6536777713aCdAcA8dd9A3AD9843D74E9E3b', + '0x1B72255a11DF705Bb598E670830E03A19F2D242f', + '0x7058EE5467edef417746aab0B8cabbbE36eF1798', + '0x9792eE4c36a622a8CF9566b037c57519A9fe8a56', ] }; diff --git a/projects/config/onx/ethereum/farmTvl.js b/projects/config/onx/ethereum/farmTvl.js deleted file mode 100644 index 8ef48b5f27e..00000000000 --- a/projects/config/onx/ethereum/farmTvl.js +++ /dev/null @@ -1,99 +0,0 @@ -const BigNumber = require('bignumber.js'); -const { ZERO, getTotalSupplyOf, } = require('../../../helper/ankr/utils'); -const sdk = require("@defillama/sdk") - -const getSymbolPrice = ( - symbol, - wethPrice, - onxPrice, - aEthPrice, - ankrPrice, - sushiPrice = ZERO, - bondPrice = ZERO, -) => { - if (symbol === 'WETH' || symbol === 'ETH') { - return wethPrice; - } - if (symbol === 'aETHc') { - return aEthPrice; - } - if (symbol === 'ONX') { - return onxPrice; - } - if (symbol === 'ANKR') { - return ankrPrice; - } - if (symbol === 'SUSHI' || symbol === 'xSUSHI' || symbol === 'xSushi') { - return sushiPrice; - } - if (symbol === 'BOND') { - return bondPrice; - } - if (['USDC', 'DAI', 'FRAX'].includes(symbol)) { - return new BigNumber(1); - } - return new BigNumber(0); -}; - -async function getUsdBalance( - balance, - farm, - wEthPrice, - onxPrice, - aEthPrice, - ankrPrice, - sushiPrice, - bondPrice, -) { - let subSymbol2Decimal = 18; - - if (!farm.isLpToken) { - return new BigNumber(balance) - .times(getSymbolPrice(farm.title, wEthPrice, onxPrice, aEthPrice, ankrPrice, sushiPrice, bondPrice)) - .div(1e18); - } else { - const totalSupply = await getTotalSupplyOf(farm.address); - - if (!totalSupply.isZero()) { - - const { output: subBalance1 } = await sdk.api.erc20.balanceOf({ target: farm.subTokenAddresses1, owner: farm.address }); - const subSymbol1Price = getSymbolPrice( - farm.subTokenSymbol1, - wEthPrice, - onxPrice, - aEthPrice, - ankrPrice, - sushiPrice, - bondPrice, - ); - - const { output: subBalance2 } = await sdk.api.erc20.balanceOf({ target: farm.subTokenAddresses2, owner: farm.address }); - const subSymbol2Price = getSymbolPrice( - farm.subTokenSymbol2, - wEthPrice, - onxPrice, - aEthPrice, - ankrPrice, - sushiPrice, - bondPrice, - ); - - if (farm.subTokenSymbol2 === 'USDC') { - subSymbol2Decimal = 6; - } - - const sum = new BigNumber(subBalance1) - .times(subSymbol1Price) - .div(1e18) - .plus(new BigNumber(subBalance2).times(subSymbol2Price).div(new BigNumber(10).pow(subSymbol2Decimal))); - - return BigNumber(balance).times(sum).div(totalSupply); - } else { - return ZERO; - } - } -} - -module.exports = { - getUsdBalance -} \ No newline at end of file diff --git a/projects/config/onx/ethereum/farms.js b/projects/config/onx/ethereum/farms.js deleted file mode 100644 index 414bd79bb8e..00000000000 --- a/projects/config/onx/ethereum/farms.js +++ /dev/null @@ -1,78 +0,0 @@ -const ADDRESSES = require('../../../helper/coreAssets.json') - -const rawFarms = [ - {//0 - pid: 4, - title: 'onxEthLp', - address: '0x62f22A47e5D2F8b71cC44fD85863753618312f67', - isLpToken: false, - subTokenSymbol1: 'UNI-V2', - subTokenSymbol2: 'UNI-V2', - subTokenAddresses1: '0x62f22A47e5D2F8b71cC44fD85863753618312f67', - subTokenAddresses2: '0x62f22A47e5D2F8b71cC44fD85863753618312f67', - }, - {//1 - pid: 1, - title: 'aETHc', - address: '0xE95A203B1a91a908F9B9CE46459d101078c2c3cb', - isLpToken: false, - subTokenSymbol1: 'aETHc', - subTokenSymbol2: 'aETHc', - subTokenAddresses1: '0xE95A203B1a91a908F9B9CE46459d101078c2c3cb', - subTokenAddresses2: '0xE95A203B1a91a908F9B9CE46459d101078c2c3cb', - }, - {//2 - pid: 0, - title: 'ANKR', - address: '0x8290333ceF9e6D528dD5618Fb97a76f268f3EDD4', - isLpToken: false, - subTokenSymbol1: 'ANKR', - subTokenSymbol2: 'ANKR', - subTokenAddresses1: '0xE95A203B1a91a908F9B9CE46459d101078c2c3cb', - subTokenAddresses2: ADDRESSES.ethereum.USDC, - }, - {//3 - title: 'onxEthSlpMulti', - address: '0x0652687E87a4b8b5370b05bc298Ff00d205D9B5f', - isLpToken: false, - subTokenSymbol1: 'SLP', - subTokenSymbol2: 'SLP', - subTokenAddresses1: '0x0652687E87a4b8b5370b05bc298Ff00d205D9B5f', - subTokenAddresses2: '0x0652687E87a4b8b5370b05bc298Ff00d205D9B5f', - isCustomFarmContract: true, - }, - {//4 - pid: 7, - title: 'xSushi', - address: '0x8798249c2E607446EfB7Ad49eC89dD1865Ff4272', - isLpToken: false, - subTokenSymbol1: 'xSushi', - subTokenSymbol2: 'xSushi', - subTokenAddresses1: '0x8798249c2E607446EfB7Ad49eC89dD1865Ff4272', - subTokenAddresses2: '0x8798249c2E607446EfB7Ad49eC89dD1865Ff4272', - }, - {//5 - pid: 8, - title: 'BOND', - address: '0x0391d2021f89dc339f60fff84546ea23e337750f', - isLpToken: false, - subTokenSymbol1: 'BOND', - subTokenSymbol2: 'BOND', - subTokenAddresses1: '0x0391d2021f89dc339f60fff84546ea23e337750f', - subTokenAddresses2: '0x0391d2021f89dc339f60fff84546ea23e337750f', - }, - {//6 - pid: 6, - title: 'onxEthSlp', - address: '0x0652687E87a4b8b5370b05bc298Ff00d205D9B5f', - isLpToken: false, - subTokenSymbol1: 'SLP', - subTokenSymbol2: 'SLP', - subTokenAddresses1: '0x0652687E87a4b8b5370b05bc298Ff00d205D9B5f', - subTokenAddresses2: '0x0652687E87a4b8b5370b05bc298Ff00d205D9B5f', - }, -]; - -module.exports = { - farms: rawFarms, -} \ No newline at end of file diff --git a/projects/config/onx/ethereum/index.js b/projects/config/onx/ethereum/index.js index 7cecaebc2a7..c757e25111d 100644 --- a/projects/config/onx/ethereum/index.js +++ b/projects/config/onx/ethereum/index.js @@ -1,295 +1,62 @@ -const BigNumber = require('bignumber.js'); -const { toUSDTBalances } = require('./../../../helper/balances'); -const sdk = require("@defillama/sdk"); const tokenAddresses = require('../constant'); -const { getVautsTvl, getBalanceOf, getReserves } = require('../../../helper/ankr/utils'); -const { ZERO, vaults } = require('./vaults'); -const { request, gql } = require("graphql-request"); -const { getUsdBalance } = require('./farmTvl'); -const { getWethPrice, - getOnxPrice, - getBondPrice, - getAethPrice, - getOnePrice, - getOnsPrice, - getAnkrPrice, - getSushiPrice } = require('./prices'); -const { farms } = require('./farms'); +const { vaults } = require('./vaults'); +const { staking } = require('../../../helper/staking') +const ADDRESSES = require('../../../helper/coreAssets.json') -const getStakeTvl = async (onxPrice) => { - const balance = new BigNumber(await getBalanceOf(tokenAddresses.sOnx, tokenAddresses.onx)); - return toUSDTBalances(onxPrice.times(balance).div(1e18)); -} - -const getEthereumStaking = async () => { - const wethPrice = await getWethPrice(); - const onxPrice = (await getOnxPrice()).times(wethPrice); - return getStakeTvl(onxPrice); -} - -const getEthereumBorrows = async () => { - const wethPrice = await getWethPrice(); - - let { output: borrowsTvl } = await sdk.api.abi.call({ - target: tokenAddresses.pool, - abi: 'uint256:totalBorrow' - }) - borrowsTvl = new BigNumber(borrowsTvl).div(1e18); - return toUSDTBalances(wethPrice.times(borrowsTvl)); -} - - -const onsPoolLPs = { - aethPairOne: tokenAddresses.aethPairOne, - aethPairOns: tokenAddresses.aethPairOns, - aethPairEth: tokenAddresses.aethPairEth, -} - - -const getOnePoolsTvl = async (price) => { - let totalBalance = new BigNumber(0); - let { onePools } = tokenAddresses; - onePools = await Promise.all( - onePools.map(async (farm) => { - let balance = new BigNumber(0); - let tokenBalance = new BigNumber(); - switch (farm.title) { - case 'aeth': - tokenBalance = new BigNumber(await getBalanceOf(farm.address, tokenAddresses.aethToken)); - balance = tokenBalance.times(price.aethPrice); - break; - case 'weth': - tokenBalance = new BigNumber(await getBalanceOf(farm.address, tokenAddresses.wethToken)); - balance = tokenBalance.times(price.wethPrice); - break; - case 'onx': - tokenBalance = new BigNumber(await getBalanceOf(farm.address, tokenAddresses.onx)); - balance = tokenBalance.times(price.onxPrice); - break; - case 'dai': - tokenBalance = new BigNumber(await getBalanceOf(farm.address, tokenAddresses.daiToken)); - balance = tokenBalance.times(1); - break; - case 'frax': - tokenBalance = new BigNumber(await getBalanceOf(farm.address, tokenAddresses.fraxToken)); - balance = tokenBalance.times(1); - break; - case 'usdc': - tokenBalance = new BigNumber(await getBalanceOf(farm.address, tokenAddresses.usdcToken)); - balance = tokenBalance.times(1).div(1e6); - break; - } - if (farm.title !== 'usdc') balance = balance.div(1e18); - totalBalance = totalBalance.plus(balance); - }) - ); - return totalBalance; -} - -const getOnsPoolsTvl = async (price) => { - let totalBalance = new BigNumber(0); - let { onsPools } = tokenAddresses; - onsPools = await Promise.all( - onsPools.map(async (farm) => { - let balance = new BigNumber(0); - let sum = new BigNumber(0); - const totalSupply = new BigNumber((await sdk.api.erc20.totalSupply({ target: onsPoolLPs[farm.title] })).output); - const tokenBalance = new BigNumber((await sdk.api.erc20.balanceOf({ target: onsPoolLPs[farm.title], owner: farm.address })).output); - const { reserve0, reserve1 } = await getReserves(onsPoolLPs[farm.title]); - - if (farm.title === 'aethPairOne') { - sum = new BigNumber(reserve0).times(price.aethPrice).plus(new BigNumber(reserve1).times(price.onePrice)); - } else if (farm.title === 'aethPairOns') { - sum = new BigNumber(reserve0).times(price.aethPrice).plus(new BigNumber(reserve1).times(price.onsPrice)); - } else if (farm.title === 'aethPairEth') { - sum = new BigNumber(reserve0).times(price.wethPrice).plus(new BigNumber(reserve1).times(price.aethPrice)); - } - balance = sum.times(tokenBalance).div(totalSupply).div(1e18); - totalBalance = totalBalance.plus(balance); - }) - ); - return totalBalance; -} +const getEthereumStaking = staking(tokenAddresses.sOnx, tokenAddresses.onx) -const getOneVaultTvl = async (wethPrice, aethPrice, onsPrice) => { - const onsValue = new BigNumber(await getBalanceOf(tokenAddresses.oneVault, tokenAddresses.onsToken) - ).times(onsPrice).div(1e18); - const aEthValue = new BigNumber(await getBalanceOf(tokenAddresses.oneVault, tokenAddresses.aethToken) - ).times(aethPrice).div(1e18); - return onsValue.plus(aEthValue); +const getEthereumBorrows = async (_, _1, _2, { api }) => { + api.add(ADDRESSES.null, await api.call({ target: tokenAddresses.pool, abi: 'uint256:totalBorrow' })) } -const getLendingTvl = async (wethPrice) => { - let { output: totalStake } = await sdk.api.abi.call({ - target: tokenAddresses.pool, - abi: 'uint256:totalStake' - }) - let { output: totalBorrow } = await sdk.api.abi.call({ - target: tokenAddresses.pool, - abi: 'uint256:totalPledge' - }) - return new BigNumber(totalBorrow).plus(totalStake).times(wethPrice).div(1e18); +async function getEthereumPoolTvl() { + const { api } = arguments[3] + const pools = ['0xAdb6d1cB866a52C5E8C1e79Ff8e0559c12F4D7a3'] + const tokens = ['0x0652687e87a4b8b5370b05bc298ff00d205d9b5f'] + const bals = await api.multiCall({ abi: 'uint256:underlyingBalanceWithInvestment', calls: pools }) + api.addTokens(tokens, bals) + return api.sumTokens({ owners: [tokenAddresses.onxFarm, tokenAddresses.onxTripleFarm], tokens: ['0x0652687e87a4b8b5370b05bc298ff00d205d9b5f', tokenAddresses.onxWethSushiPair] }) } -const getQuickQuery = (pairAddress) => gql` - query pairs { - pairs(where: { id: "${pairAddress}"} ) { - id - reserveUSD - trackedReserveETH - volumeUSD - untrackedVolumeUSD - totalSupply - } - }` - ; - -const url = 'https://api.thegraph.com/subgraphs/name/sushiswap/exchange'; +async function ethTvl(_, _b, _cb, { api, }) { + await Promise.all([addFarmTvl, addOnePoolTvl, addVaultTvl, addOneVaultTvl, ethStakeTvl ].map(i => i())) -const getPairsData = async (pairAddress) => { - try { - const result = await request(url, getQuickQuery(pairAddress)); - const last = result.pairs.length; - return result && result.pairs ? result.pairs[last - 1] : {}; - } catch (e) { - console.error(e); + async function ethStakeTvl() { + let totalStake = await api.call({ target: tokenAddresses.pool, abi: 'uint256:totalStake' }) + let totalBorrow = await api.call({ target: tokenAddresses.pool, abi: 'uint256:totalPledge' }) + api.add(ADDRESSES.null, totalStake - totalBorrow) } - return {}; -}; - -const getSushiPoolPrice = async (vault) => { - if (!vault.pool) - return ZERO; - - const data = await getPairsData(vault.pool); - const { reserveUSD, totalSupply } = data; - - return new BigNumber(reserveUSD).div(totalSupply).div(1e18); -}; - -const getEthereumVautsTvl = async () => { - return getVautsTvl(vaults, getSushiPoolPrice); -}; - -const getFarmsTvl = async (price) => { - const { wethPrice, onxPrice, aethPrice, ankrPrice, bondPrice, sushiPrice } = price; - - let totalBalance = new BigNumber(0); - await Promise.all( - farms.map(async (farm) => { - const address = !farm.isCustomFarmContract ? tokenAddresses.onxFarm : tokenAddresses.onxTripleFarm; - const balance = await getBalanceOf(address, farm.address); - const usdBalance = await getUsdBalance( - balance, - farm, - wethPrice, - onxPrice, - aethPrice, - ankrPrice, - sushiPrice, - bondPrice - ); - - totalBalance = totalBalance.plus(usdBalance); - }) - ); - return totalBalance; -} - -const getOnxEthLpTvl = async () => { - const wethPrice = await getWethPrice(); - const onxPrice = (await getOnxPrice()).times(wethPrice); - const aethPrice = (await getAethPrice()).times(wethPrice); - const ankrPrice = (await getAnkrPrice()).times(wethPrice); - const bondPrice = (await getBondPrice()).times(wethPrice); - const sushiPrice = (await getSushiPrice()).times(wethPrice); - - const farm = farms.find(farm => farm.pid === 4); - - const address = !farm.isCustomFarmContract ? tokenAddresses.onxFarm : tokenAddresses.onxTripleFarm; - const balance = await getBalanceOf(address, farm.address); - - const tvl = await getUsdBalance( - balance, - farm, - wethPrice, - onxPrice, - aethPrice, - ankrPrice, - sushiPrice, - bondPrice - ); - - return toUSDTBalances(tvl); -} - -const getOnxEthSLpTvl = async () => { - return getVautsTvl(vaults.filter(vault => vault.title === 'OnxEthSlp'), getSushiPoolPrice); -} - -function getEthereumPoolTvl() { - return sdk.util.sumChainTvls([getOnxEthLpTvl, getOnxEthSLpTvl]); -} - -const getEthereumTvl = async () => { - let netTvl = new BigNumber(0); - - const wethPrice = await getWethPrice(); - const aethPrice = (await getAethPrice()).times(wethPrice) - const [ - onxPrice, - ankrPrice, - bondPrice, - sushiPrice, - onePrice, - onsPrice, - ] = await Promise.all([ - (await getOnxPrice()).times(wethPrice), - (await getAnkrPrice()).times(wethPrice), - (await getBondPrice()).times(wethPrice), - (await getSushiPrice()).times(wethPrice), - (await getOnePrice()).times(aethPrice), - (await getOnsPrice()).times(aethPrice), - ]) - - const [ - farmsTvl, - onePoolsTvl, - onsPoolsTvl, - oneVaultTvl, - lendingTvl, - ] = await Promise.all([ - getFarmsTvl({ wethPrice, onxPrice, aethPrice, ankrPrice, bondPrice, sushiPrice }), - getOnePoolsTvl({ aethPrice, wethPrice, onxPrice }), - getOnsPoolsTvl({ aethPrice, onePrice, onsPrice, wethPrice }), - getOneVaultTvl(wethPrice, aethPrice, onsPrice), - getLendingTvl(wethPrice), - ]) - - const tvl = netTvl - .plus(farmsTvl) - .plus(lendingTvl) - .plus(oneVaultTvl) - .plus(onePoolsTvl) - .plus(onsPoolsTvl); + async function addVaultTvl() { + const pools = vaults.map(i => i[1]) + const tokens = vaults.map(i => i[0]) + const bals = await api.multiCall({ abi: 'uint256:underlyingBalanceWithInvestment', calls: pools }) + api.addTokens(tokens, bals) + } - return toUSDTBalances(tvl); -} + async function addFarmTvl() { + const farm = '0x168f8469ac17dd39cd9a2c2ead647f814a488ce9' + const pools = await api.fetchList({ lengthAbi: 'uint256:poolLength', itemAbi: 'function poolInfo(uint256) view returns (address token, uint256,uint256,uint256)', target: farm }) + return api.sumTokens({ owner: farm, tokens: pools.map(i => i.token), blacklistedTokens: ['0x0652687e87a4b8b5370b05bc298ff00d205d9b5f', tokenAddresses.onxWethSushiPair] }) + } + async function addOnePoolTvl() { + const pools = tokenAddresses.onePools + const tokens = await api.multiCall({ abi: 'address:stakingToken', calls: pools }) + return api.sumTokens({ tokensAndOwners2: [tokens, pools] }) + } -function getEthereumTvlEx() { - return sdk.util.sumChainTvls([ - getEthereumTvl, - getEthereumVautsTvl - ]); + async function addOneVaultTvl() { + const vault = tokenAddresses.oneVault + const aETH = await api.call({ abi: 'address:aEth', target: vault }) + const aETHb = await api.call({ abi: 'address:aETHb', target: vault }) + return api.sumTokens({ tokens: [aETH, aETHb], owner: vault }) + } } module.exports = { getEthereumStaking, - getEthereumTvl, - getEthereumTvlEx, getEthereumPoolTvl, getEthereumBorrows, - getEthereumVautsTvl -} \ No newline at end of file + ethTvl, +} diff --git a/projects/config/onx/ethereum/prices.js b/projects/config/onx/ethereum/prices.js deleted file mode 100644 index d4297674f23..00000000000 --- a/projects/config/onx/ethereum/prices.js +++ /dev/null @@ -1,55 +0,0 @@ -const BigNumber = require('bignumber.js'); -const { getReserves } = require('../../../helper/ankr/utils'); - -const tokenAddresses = require('../constant'); - -const getWethPrice = async () => { - const { reserve0, reserve1 } = await getReserves(tokenAddresses.usdWethPair); - return new BigNumber(reserve1).times(1e12).div(new BigNumber(reserve0)) -} - -const getOnxPrice = async () => { - const { reserve0, reserve1 } = await getReserves(tokenAddresses.onxWethSushiPair); - return new BigNumber(reserve0).div(new BigNumber(reserve1)) -} - -const getBondPrice = async () => { - const { reserve0, reserve1 } = await getReserves(tokenAddresses.bondPairEth); - return new BigNumber(reserve1).div(new BigNumber(reserve0)); -} - -const getAethPrice = async () => { - const { reserve0, reserve1 } = await getReserves(tokenAddresses.wethAethPair); - return new BigNumber(reserve0).div(new BigNumber(reserve1)) -} - -const getOnePrice = async () => { - const { reserve0, reserve1 } = await getReserves(tokenAddresses.aethPairOne); - return new BigNumber(reserve1).div(new BigNumber(reserve0)) -} - -const getOnsPrice = async () => { - const { reserve0, reserve1 } = await getReserves(tokenAddresses.aethPairOns); - return new BigNumber(reserve0).div(new BigNumber(reserve1)) -} - -const getAnkrPrice = async () => { - const { reserve0, reserve1 } = await getReserves(tokenAddresses.ankrWethPair); - return new BigNumber(reserve1).div(new BigNumber(reserve0)); -} - -const getSushiPrice = async () => { - const { reserve0, reserve1 } = await getReserves(tokenAddresses.sushiPairEth); - return new BigNumber(reserve1).div(new BigNumber(reserve0)); -} - -module.exports = { - getWethPrice, - getOnxPrice, - getBondPrice, - getAethPrice, - getOnePrice, - getOnsPrice, - getAnkrPrice, - getSushiPrice, -} \ No newline at end of file diff --git a/projects/config/onx/ethereum/vaults.js b/projects/config/onx/ethereum/vaults.js index fc33046e560..e4523e5deb0 100644 --- a/projects/config/onx/ethereum/vaults.js +++ b/projects/config/onx/ethereum/vaults.js @@ -1,79 +1,22 @@ -const createVaultModel = (poolAddress, vaultAddress) => { - return { - pool: poolAddress, - vault: vaultAddress, - chain: 'ethereum', - } -} - const vaults = [ - { - title: 'OnxEthSlp', - ...createVaultModel('0x0652687e87a4b8b5370b05bc298ff00d205d9b5f', '0xAdb6d1cB866a52C5E8C1e79Ff8e0559c12F4D7a3'), - }, - { - title: 'WBtcWethSlp', - ...createVaultModel('0xceff51756c56ceffca006cd410b03ffc46dd3a58', '0x2abCe7c4C77e215fcCc189E02Fc5D2A30b52a06a'), - }, - { - title: 'UsdcEthSlp', - ...createVaultModel('0x397ff1542f962076d0bfe58ea045ffa2d347aca0', '0x637c871C559ade45b37074fCF3B8081Ec81c55FC'), - }, - { - title: 'UsdtEthSlp', - ...createVaultModel('0x06da0fd433c1a5d7a4faa01111c044910a184553', '0xeAaE5CEfce1092eb3eA1DA7622B3cF4fb20B8b81'), - }, + ['0xceff51756c56ceffca006cd410b03ffc46dd3a58', '0x2abCe7c4C77e215fcCc189E02Fc5D2A30b52a06a'], + ['0x397ff1542f962076d0bfe58ea045ffa2d347aca0', '0x637c871C559ade45b37074fCF3B8081Ec81c55FC'], + ['0x06da0fd433c1a5d7a4faa01111c044910a184553', '0xeAaE5CEfce1092eb3eA1DA7622B3cF4fb20B8b81'], - { - title: 'SushiEthSlp', - ...createVaultModel('0x795065dcc9f64b5614c407a6efdc400da6221fb0', '0xdC6f222c4504C43225a89b84E3aae15Ad0DFDF0F'), - }, - { - title: 'XsushiEthSlp', - ...createVaultModel('0x36e2fcccc59e5747ff63a03ea2e5c0c2c14911e7', '0x10A8dc3C0Db7BDFE1Db36d113c2685e60daaFEb8'), - }, - { - title: 'AEthcEthSlp', - ...createVaultModel('0xfa5bc40c3bd5afa8bc2fe6b84562fee16fb2df5f', '0x6901Aac9813f3EfAae32F44E9b579f08A12707AD'), - }, - { - title: 'AnkrEthSlp', - ...createVaultModel('0x1241f4a348162d99379a23e73926cf0bfcbf131e', '0x121eF4eEc2bb4D5eD91347166F02c0763af1C49A'), - }, - { - title: 'YfiEthSlp',//0 - ...createVaultModel('0x088ee5007c98a9677165d78dd2109ae4a3d04d0c', '0x431b1F5356EcAc2D86b2313907B747B16D11066f'), - }, + ['0x795065dcc9f64b5614c407a6efdc400da6221fb0', '0xdC6f222c4504C43225a89b84E3aae15Ad0DFDF0F'], + ['0x36e2fcccc59e5747ff63a03ea2e5c0c2c14911e7', '0x10A8dc3C0Db7BDFE1Db36d113c2685e60daaFEb8'], + ['0xfa5bc40c3bd5afa8bc2fe6b84562fee16fb2df5f', '0x6901Aac9813f3EfAae32F44E9b579f08A12707AD'], + ['0x1241f4a348162d99379a23e73926cf0bfcbf131e', '0x121eF4eEc2bb4D5eD91347166F02c0763af1C49A'], + ['0x088ee5007c98a9677165d78dd2109ae4a3d04d0c', '0x431b1F5356EcAc2D86b2313907B747B16D11066f'], - { - title: 'DaiEthSlp', - ...createVaultModel('0xc3d03e4f041fd4cd388c549ee2a29a9e5075882f', '0x5EA1b54C522f279ecC0182d9b35229d6435D42b7'), - }, - { - title: 'AaveEthSlp',//0 - ...createVaultModel('0xd75ea151a61d06868e31f8988d28dfe5e9df57b4', '0x9DB4AFCABdB25C89424c88e720dD47D6be43BdBe'), - }, - { - title: 'LinkEthSlp', - ...createVaultModel('0xc40d16476380e4037e6b1a2594caf6a6cc8da967', '0xbd3a37e3690ad4e145c39983D0Aaf8bd5f5e2F29'), - }, - { - title: 'CompEthSlp',//0 - ...createVaultModel('0x31503dcb60119a812fee820bb7042752019f2355', '0x8d47f6fd4602B1ecF7928C0f1AEF9C215E3596b4'), - }, - { - title: 'CompEthSlp',//0 - ...createVaultModel('0x31503dcb60119a812fee820bb7042752019f2355', '0x8d47f6fd4602B1ecF7928C0f1AEF9C215E3596b4'), - }, + ['0xc3d03e4f041fd4cd388c549ee2a29a9e5075882f', '0x5EA1b54C522f279ecC0182d9b35229d6435D42b7'], + ['0xd75ea151a61d06868e31f8988d28dfe5e9df57b4', '0x9DB4AFCABdB25C89424c88e720dD47D6be43BdBe'], + ['0xc40d16476380e4037e6b1a2594caf6a6cc8da967', '0xbd3a37e3690ad4e145c39983D0Aaf8bd5f5e2F29'], + ['0x31503dcb60119a812fee820bb7042752019f2355', '0x8d47f6fd4602B1ecF7928C0f1AEF9C215E3596b4'], + ['0x31503dcb60119a812fee820bb7042752019f2355', '0x8d47f6fd4602B1ecF7928C0f1AEF9C215E3596b4'], - { - title: 'MkrEthSlp',//0 - ...createVaultModel('0xba13afecda9beb75de5c56bbaf696b880a5a50dd', '0x659217CdA99658AeBA399B4a79FB03D96B3c46bC'), - }, - { - title: 'AlphaEthSlp', - ...createVaultModel('0xf55c33d94150d93c2cfb833bcca30be388b14964', '0xcedB7921013A012c5538C0d2925a90AA817Bef4D'), - }, + ['0xba13afecda9beb75de5c56bbaf696b880a5a50dd', '0x659217CdA99658AeBA399B4a79FB03D96B3c46bC'], + ['0xf55c33d94150d93c2cfb833bcca30be388b14964', '0xcedB7921013A012c5538C0d2925a90AA817Bef4D'], ] module.exports = { diff --git a/projects/config/onx/fantom/index.js b/projects/config/onx/fantom/index.js deleted file mode 100644 index 8505036c520..00000000000 --- a/projects/config/onx/fantom/index.js +++ /dev/null @@ -1,89 +0,0 @@ -const tokenAddresses = require('../constant'); -const BigNumber = require('bignumber.js'); -const { ZERO, fromWei, getVautsTvl, } = require('../../../helper/ankr/utils'); -const { vaults } = require('./vaults'); -const { EXCHANGE_TYPE } = require('../vault'); -const { request, gql } = require("graphql-request"); -const sdk = require("@defillama/sdk") - - -const getBooPrice = async () => { - return fetchPriceData(tokenAddresses.fantom.usdcBooPair, true, 1e12); -}; - -const fetchPriceData = async (pairAddress, viceVersa = false, multiplier = 1,) => { - const { reserve0, reserve1 } = await getReserves(pairAddress); - const isValid = !new BigNumber(reserve0).eq(ZERO) && !new BigNumber(reserve1).eq(ZERO); - - if (isValid) { - return (viceVersa - ? new BigNumber(reserve0).div(new BigNumber(reserve1)) - : new BigNumber(reserve1).div(new BigNumber(reserve0)) - ).times(multiplier); - } else { - return ZERO; - } -}; - -const getReserves = async (pairAddress) => { - const { output: { _reserve0, _reserve1, _blockTimestampLast } } = await sdk.api.abi.call({ - chain: 'fantom', - target: pairAddress, - abi: 'function getReserves() view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast)' - }) - return { reserve0: _reserve0, reserve1: _reserve1, blockTimestampLast: _blockTimestampLast }; -}; - -const getUniPairQuery = (pairAddress) => gql` -query pairDayDatas { - pairDayDatas(first: 1000, skip: 0, orderBy: date, orderDirection: asc, where: {pairAddress: "${pairAddress}"}) { - id - date - dailyVolumeToken0 - dailyVolumeToken1 - dailyVolumeUSD - reserveUSD - totalSupply - __typename - } -} -`; - -const url = 'https://api.thegraph.com/subgraphs/name/eerieeight/spookyswap'; - -const getPairsData = async (pairAddress) => { - try { - const result = await request(url, getUniPairQuery(pairAddress)); - const last = result.pairDayDatas.length; - return result && result.pairDayDatas ? result.pairDayDatas[last - 2] : {}; - } catch (e) { - console.error(e); - } - - return {}; -}; - -const getSpookyPoolPrice = async (vault) => { - if (!vault.pool) { - return ZERO; - } - if (vault.exchangeType == EXCHANGE_TYPE.SPOOKYSWAP) { - const data = await getPairsData(vault.pool); - const { reserveUSD, totalSupply } = data; - const result = totalSupply ? fromWei(new BigNumber(reserveUSD).div(totalSupply)) : ZERO; - return result; - } else if (vault.exchangeType == EXCHANGE_TYPE.SPOOKYSWAP_SINGLE) { - return fromWei(await getBooPrice()); - } else { - return ZERO; - } -}; - -const getFantomTvl = async () => { - return getVautsTvl(vaults, getSpookyPoolPrice); -}; - -module.exports = { - getBooPrice, - getFantomTvl, -} \ No newline at end of file diff --git a/projects/config/onx/fantom/vaults.js b/projects/config/onx/fantom/vaults.js index 5c5c5270217..73cfd84fb0e 100644 --- a/projects/config/onx/fantom/vaults.js +++ b/projects/config/onx/fantom/vaults.js @@ -1,87 +1,40 @@ -const { EXCHANGE_TYPE } = require('../vault'); - -const createVaultModel = (poolAddress, vaultAddress, exchangeType = EXCHANGE_TYPE.SPOOKYSWAP) => { - return { - pool: poolAddress, - vault: vaultAddress, - exchangeType, - chain: 'fantom', - } -} - const vaults = [ //xBoo - { - ...createVaultModel('0x841fad6eae12c286d1fd18d1d525dffa75c7effe', '0x95d0d6A7D75A5b086d2823C38F6Dd80a50fD0d93', EXCHANGE_TYPE.SPOOKYSWAP_SINGLE), - }, + ['0x841fad6eae12c286d1fd18d1d525dffa75c7effe', '0x95d0d6A7D75A5b086d2823C38F6Dd80a50fD0d93',], //BooFtm - { - ...createVaultModel('0xec7178f4c41f346b2721907f5cf7628e388a7a58', '0x62CA6F1640776070ECa70E09d9AF27352a43a5D8'), - }, + ['0xec7178f4c41f346b2721907f5cf7628e388a7a58', '0x62CA6F1640776070ECa70E09d9AF27352a43a5D8'], //UsdcFtm - { - ...createVaultModel('0x2b4c76d0dc16be1c31d4c1dc53bf9b45987fc75c', '0x6b42A98af10C2E94a6951c94b8Ac5B5EEB23c8AF'), - }, + ['0x2b4c76d0dc16be1c31d4c1dc53bf9b45987fc75c', '0x6b42A98af10C2E94a6951c94b8Ac5B5EEB23c8AF'], //fUsdtFtm - { - ...createVaultModel('0x5965E53aa80a0bcF1CD6dbDd72e6A9b2AA047410', '0xC033338F7605B1555b1d3FC2a3626b2b76a0E042'), - }, + ['0x5965E53aa80a0bcF1CD6dbDd72e6A9b2AA047410', '0xC033338F7605B1555b1d3FC2a3626b2b76a0E042'], //DaiFtm - { - ...createVaultModel('0xe120ffBDA0d14f3Bb6d6053E90E63c572A66a428', '0xf1Ba3EF65262ee4058462E65A3A09a7571193400'), - }, + ['0xe120ffBDA0d14f3Bb6d6053E90E63c572A66a428', '0xf1Ba3EF65262ee4058462E65A3A09a7571193400'], //btc - { - ...createVaultModel('0xFdb9Ab8B9513Ad9E419Cf19530feE49d412C3Ee3', '0x0f16CBDaF6c8115cDde59876cF232903E95D488A'), - }, + ['0xFdb9Ab8B9513Ad9E419Cf19530feE49d412C3Ee3', '0x0f16CBDaF6c8115cDde59876cF232903E95D488A'], //eth - { - ...createVaultModel('0xf0702249F4D3A25cD3DED7859a165693685Ab577', '0x7396241a8a45E6252A2b5bBB571CBdfF599E16F1'), - }, + ['0xf0702249F4D3A25cD3DED7859a165693685Ab577', '0x7396241a8a45E6252A2b5bBB571CBdfF599E16F1'], //link - { - ...createVaultModel('0x89d9bC2F2d091CfBFc31e333D6Dc555dDBc2fd29', '0x8D20fB2F4F96E897Fed7E3E50f8A403aFc59dA23'), - }, + ['0x89d9bC2F2d091CfBFc31e333D6Dc555dDBc2fd29', '0x8D20fB2F4F96E897Fed7E3E50f8A403aFc59dA23'], //aave - { - ...createVaultModel('0xeBF374bB21D83Cf010cC7363918776aDF6FF2BF6', '0xE663F7d6AFB3A3Ef458D5c4a068E29368a46Eb87'), - }, + ['0xeBF374bB21D83Cf010cC7363918776aDF6FF2BF6', '0xE663F7d6AFB3A3Ef458D5c4a068E29368a46Eb87'], //sushi - { - ...createVaultModel('0xf84E313B36E86315af7a06ff26C8b20e9EB443C3', '0x32B750721Ad93f62b21402526354d53ac46953C2'), - }, + ['0xf84E313B36E86315af7a06ff26C8b20e9EB443C3', '0x32B750721Ad93f62b21402526354d53ac46953C2'], //crv - { - ...createVaultModel('0xB471Ac6eF617e952b84C6a9fF5de65A9da96C93B', '0x424B1AE0AF693d4577dde25081E970cb656013C7'), - }, + ['0xB471Ac6eF617e952b84C6a9fF5de65A9da96C93B', '0x424B1AE0AF693d4577dde25081E970cb656013C7'], //bnb - { - ...createVaultModel('0x956DE13EA0FA5b577E4097Be837BF4aC80005820', '0x1fA1B8D94B922e3C9821f66363a75237c36096af'), - }, + ['0x956DE13EA0FA5b577E4097Be837BF4aC80005820', '0x1fA1B8D94B922e3C9821f66363a75237c36096af'], //any - { - ...createVaultModel('0x5c021D9cfaD40aaFC57786b409A9ce571de375b4', '0xE41718b549B935358A2f62acbD289F3dcccABB18'), - }, + ['0x5c021D9cfaD40aaFC57786b409A9ce571de375b4', '0xE41718b549B935358A2f62acbD289F3dcccABB18'], //mim - { - ...createVaultModel('0x6f86e65b255c9111109d2D2325ca2dFc82456efc', '0xfB271303B157d2e3d91CF86C7956eb46180d62E5'), - }, + ['0x6f86e65b255c9111109d2D2325ca2dFc82456efc', '0xfB271303B157d2e3d91CF86C7956eb46180d62E5'], //yfi - { - ...createVaultModel('0x0845c0bFe75691B1e21b24351aAc581a7FB6b7Df', '0x4CddFEf40f13F16520b7f98f269f772560A8fb9a'), - }, + ['0x0845c0bFe75691B1e21b24351aAc581a7FB6b7Df', '0x4CddFEf40f13F16520b7f98f269f772560A8fb9a'], //btcEth - { - ...createVaultModel('0xEc454EdA10accdD66209C57aF8C12924556F3aBD', '0x58bC3B5949C6784819A606645d616D8D2dA7594B'), - }, + ['0xEc454EdA10accdD66209C57aF8C12924556F3aBD', '0x58bC3B5949C6784819A606645d616D8D2dA7594B'], //spell - { - ...createVaultModel('0x78f82c16992932EfDd18d93f889141CcF326DBc2', '0x4aFa2C780d0d2b139886A532d1D1959f4D316ee7'), - }, + ['0x78f82c16992932EfDd18d93f889141CcF326DBc2', '0x4aFa2C780d0d2b139886A532d1D1959f4D316ee7'], //joe - { - ...createVaultModel('0xd518737Ff601c2A7C67F55EbbEb0a4e3fF5C0C35', '0xbE0093F744287Ea0478cc75c6320043a8b79E845'), - }, + ['0xd518737Ff601c2A7C67F55EbbEb0a4e3fF5C0C35', '0xbE0093F744287Ea0478cc75c6320043a8b79E845'], ] module.exports = { diff --git a/projects/config/onx/polygon/index.js b/projects/config/onx/polygon/index.js deleted file mode 100644 index dc0d2e84c4a..00000000000 --- a/projects/config/onx/polygon/index.js +++ /dev/null @@ -1,50 +0,0 @@ -const BigNumber = require('bignumber.js'); -const { ZERO, getVautsTvl, } = require('../../../helper/ankr/utils'); -const { vaults } = require('./vaults'); -const { request, gql } = require("graphql-request"); - -const getQuickQuery = (pairAddress) => gql` - query pairs { - pairs(where: { id: "${pairAddress}"} ) { - id - reserveUSD - trackedReserveETH - volumeUSD - untrackedVolumeUSD - totalSupply - } - }` -; - -const url = 'https://polygon.furadao.org/subgraphs/name/quickswap'; - -const getPairsData = async (pairAddress) => { - try { - const result = await request(url, getQuickQuery(pairAddress)); - const last = result.pairs.length; - return result && result.pairs ? result.pairs[last - 1] : {}; - } catch (e) { - console.error(e); - } - - return {}; -}; - -const getQuickPoolPrice = async (vault) => { - if (!vault.pool) { - return ZERO; - } - - const data = await getPairsData(vault.pool); - const { reserveUSD, totalSupply } = data; - - return reserveUSD && totalSupply ? new BigNumber(reserveUSD).div(totalSupply).div(1e18) : ZERO; -}; - -const getPolygonTvl = async () => { - return getVautsTvl(vaults, getQuickPoolPrice); -}; - -module.exports = { - getPolygonTvl, -} \ No newline at end of file diff --git a/projects/config/onx/polygon/vaults.js b/projects/config/onx/polygon/vaults.js index 8c455defbd4..1da4897cb8d 100644 --- a/projects/config/onx/polygon/vaults.js +++ b/projects/config/onx/polygon/vaults.js @@ -1,92 +1,44 @@ -const createVaultModel = (poolAddress, vaultAddress) => { - return { - pool: poolAddress, - vault: vaultAddress, - chain: 'polygon', - } -} - const vaults = [ //dualMaticUsdc - { - ...createVaultModel('0x6e7a5fafcec6bb1e78bae2a1f0b612012bf14827', '0x36D14424Cc5a18893e93A0f8FdD42DC40562887E'), - }, + ['0x6e7a5fafcec6bb1e78bae2a1f0b612012bf14827', '0x36D14424Cc5a18893e93A0f8FdD42DC40562887E'], //dualMaticEth - { - ...createVaultModel('0xadbf1854e5883eb8aa7baf50705338739e558e5b', '0xfe51dE20719d05152Ace63a069446Bb5C89511DB'), - }, + ['0xadbf1854e5883eb8aa7baf50705338739e558e5b', '0xfe51dE20719d05152Ace63a069446Bb5C89511DB'], //dualMaticUsdt - { - ...createVaultModel('0x604229c960e5cacf2aaeac8be68ac07ba9df81c3', '0x067E7586Eb8733bF108167C15cBAbee4c629C37A'), - }, + ['0x604229c960e5cacf2aaeac8be68ac07ba9df81c3', '0x067E7586Eb8733bF108167C15cBAbee4c629C37A'], //dualMaticQuick - { - ...createVaultModel('0x019ba0325f1988213d448b3472fa1cf8d07618d7', '0x849031F78970639F8Dc9Dc3E962e0d0079D1051c'), - }, + ['0x019ba0325f1988213d448b3472fa1cf8d07618d7', '0x849031F78970639F8Dc9Dc3E962e0d0079D1051c'], //EthUsdc - { - ...createVaultModel('0x853ee4b2a13f8a742d64c8f088be7ba2131f670d', '0x185A1cfdb7173b224d08E61F1Cb21Fd5Fd6ee8CD'), - }, + ['0x853ee4b2a13f8a742d64c8f088be7ba2131f670d', '0x185A1cfdb7173b224d08E61F1Cb21Fd5Fd6ee8CD'], //wBtcEth - { - ...createVaultModel('0xdc9232e2df177d7a12fdff6ecbab114e2231198d', '0xf1ba3ef65262ee4058462e65a3a09a7571193400'), - }, + ['0xdc9232e2df177d7a12fdff6ecbab114e2231198d', '0xf1ba3ef65262ee4058462e65a3a09a7571193400'], //ethUsdt - { - ...createVaultModel('0xf6422b997c7f54d1c6a6e103bcb1499eea0a7046', '0x353856185fBB65a098b971B6d492CC3c245D9a59'), - }, + ['0xf6422b997c7f54d1c6a6e103bcb1499eea0a7046', '0x353856185fBB65a098b971B6d492CC3c245D9a59'], //quickEth - { - ...createVaultModel('0x1bd06b96dd42ada85fdd0795f3b4a79db914add5', '0x9767218525A443AE1B04A2a84Cf2f6D646C2fA06'), - }, + ['0x1bd06b96dd42ada85fdd0795f3b4a79db914add5', '0x9767218525A443AE1B04A2a84Cf2f6D646C2fA06'], //aaveEth - { - ...createVaultModel('0x90bc3e68ba8393a3bf2d79309365089975341a43', '0xbB760a23924a23e5270c659349c753d16e7C1078'), - }, + ['0x90bc3e68ba8393a3bf2d79309365089975341a43', '0xbB760a23924a23e5270c659349c753d16e7C1078'], //ethDai - { - ...createVaultModel('0x4a35582a710e1f4b2030a3f826da20bfb6703c09', '0x0d553115D2c1E2b734d66De1Eba4BAe1a88cB175'), - }, + ['0x4a35582a710e1f4b2030a3f826da20bfb6703c09', '0x0d553115D2c1E2b734d66De1Eba4BAe1a88cB175'], //wbtcUsdc - { - ...createVaultModel('0xf6a637525402643b0654a54bead2cb9a83c8b498', '0x248Eecc8286A8C6484B4A87e1F32f0bc2d7971D4'), - }, + ['0xf6a637525402643b0654a54bead2cb9a83c8b498', '0x248Eecc8286A8C6484B4A87e1F32f0bc2d7971D4'], //linkEth - { - ...createVaultModel('0x5ca6ca6c3709e1e6cfe74a50cf6b2b6ba2dadd67', '0x58bC3B5949C6784819A606645d616D8D2dA7594B'), - }, + ['0x5ca6ca6c3709e1e6cfe74a50cf6b2b6ba2dadd67', '0x58bC3B5949C6784819A606645d616D8D2dA7594B'], //usdcQuick - { - ...createVaultModel('0x1f1e4c845183ef6d50e9609f16f6f9cae43bc9cb', '0x7E9dA60002dAF64778C78Ac90dD5bdc9391acb00'), - }, + ['0x1f1e4c845183ef6d50e9609f16f6f9cae43bc9cb', '0x7E9dA60002dAF64778C78Ac90dD5bdc9391acb00'], //usdcUsdt - { - ...createVaultModel('0x2cf7252e74036d1da831d11089d326296e64a728', '0x1a130be9a0E9046936E5461D3e8727b6aF7d0C2C'), - }, + ['0x2cf7252e74036d1da831d11089d326296e64a728', '0x1a130be9a0E9046936E5461D3e8727b6aF7d0C2C'], //avaxMatic - { - ...createVaultModel('0xeb477ae74774b697b5d515ef8ca09e24fee413b5', '0x8D20fB2F4F96E897Fed7E3E50f8A403aFc59dA23'), - }, + ['0xeb477ae74774b697b5d515ef8ca09e24fee413b5', '0x8D20fB2F4F96E897Fed7E3E50f8A403aFc59dA23'], //solMatic - { - ...createVaultModel('0x898386dd8756779a4ba4f1462891b92dd76b78ef', '0x0A1EfAF7dd833F9D8EF9f2f095bf1d6C725FF110'), - }, + ['0x898386dd8756779a4ba4f1462891b92dd76b78ef', '0x0A1EfAF7dd833F9D8EF9f2f095bf1d6C725FF110'], //bnbUsdc - { - ...createVaultModel('0x40a5df3e37152d4daf279e0450289af76472b02e', '0x43bE6849BC355735D77238AcfDBcEB7bE8673f02'), - }, + ['0x40a5df3e37152d4daf279e0450289af76472b02e', '0x43bE6849BC355735D77238AcfDBcEB7bE8673f02'], //ftmMatic - { - ...createVaultModel('0xd2b61a42d3790533fedc2829951a65120624034a', '0xF020de990036D5aE107860592Bde0E53892F1531'), - }, + ['0xd2b61a42d3790533fedc2829951a65120624034a', '0xF020de990036D5aE107860592Bde0E53892F1531'], //daiUsdc - { - ...createVaultModel('0xf04adbf75cdfc5ed26eea4bbbb991db002036bdd', '0x260e6fB68C787CdA2E9ea104f9e3a3923E4119f6'), - }, + ['0xf04adbf75cdfc5ed26eea4bbbb991db002036bdd', '0x260e6fB68C787CdA2E9ea104f9e3a3923E4119f6'], //daiUsdt - { - ...createVaultModel('0x59153f27eefe07e5ece4f9304ebba1da6f53ca88', '0x32B750721Ad93f62b21402526354d53ac46953C2'), - }, + ['0x59153f27eefe07e5ece4f9304ebba1da6f53ca88', '0x32B750721Ad93f62b21402526354d53ac46953C2'], ] module.exports = { diff --git a/projects/helper/ankr/chainAddresses.js b/projects/helper/ankr/chainAddresses.js deleted file mode 100644 index 6f2fdbb2fe8..00000000000 --- a/projects/helper/ankr/chainAddresses.js +++ /dev/null @@ -1,10 +0,0 @@ -const ADDRESSES = require('../coreAssets.json') -const coinAddresses = { - weth: ADDRESSES.ethereum.WETH, //Ethereum - ftm: ADDRESSES.ethereum.FTM, //Fantom - matic: ADDRESSES.ethereum.MATIC, //Matic - dot: ADDRESSES.ethereum.MATIC, //DOT - avax: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", //Avalanche -}; - -module.exports = coinAddresses; \ No newline at end of file diff --git a/projects/helper/ankr/networks.js b/projects/helper/ankr/networks.js deleted file mode 100644 index 8545c7ac819..00000000000 --- a/projects/helper/ankr/networks.js +++ /dev/null @@ -1,84 +0,0 @@ -const SupportedChainId = { - MAINNET: 1, - ROPSTEN: 3, - MATIC: 137, - MATIC_TESTNET: 80001, - LOCAL_TESTNET: 31337, - BSC: 56, - FANTOM: 250, - AVALANCHE: 0xa86a, -} - -const SUPPORTED_NETWORKS = { - [SupportedChainId.MAINNET]: { - chainId: '0x1', //1 - chainName: 'Ethereum', - nativeCurrency: { - name: 'Ethereum', - symbol: 'ETH', - decimals: 18, - }, - rpcUrls: ['https://mainnet.infura.io/v3'], - blockExplorerUrls: ['https://etherscan.com'], - }, - [SupportedChainId.BSC]: { - chainId: '0x38', //56 - chainName: 'Binance Smart Chain', - nativeCurrency: { - name: 'Binance Coin', - symbol: 'BNB', - decimals: 18, - }, - rpcUrls: ['https://bsc-dataseed.binance.org'], - blockExplorerUrls: ['https://bscscan.com'], - }, - [SupportedChainId.MATIC]: { - chainId: '0x89', //137 - chainName: 'Matic', - nativeCurrency: { - name: 'Matic', - symbol: 'MATIC', - decimals: 18, - }, - rpcUrls: ['https://polygon-rpc.com'], - blockExplorerUrls: ['https://explorer-mainnet.maticvigil.com'], - }, - [SupportedChainId.FANTOM]: { - chainId: '0xFA', //250 - chainName: 'Fantom', - nativeCurrency: { - name: 'FTM', - symbol: 'FTM', - decimals: 18, - }, - rpcUrls: ['https://rpc.ftm.tools/'], - blockExplorerUrls: ['https://ftmscan.com/'], - }, - [SupportedChainId.AVALANCHE]: { - chainId: '0xa86a', //43114 - chainName: 'Avalanche', - nativeCurrency: { - name: 'AVAX', - symbol: 'AVAX', - decimals: 18, - }, - rpcUrls: ['https://api.avax.network/ext/bc/C/rpc'], - blockExplorerUrls: ['https://avascan.info/blockchain/c/'], - }, -}; - -const ethereumRpcUrl = SUPPORTED_NETWORKS[SupportedChainId.MAINNET].rpcUrls[0]; -const fantomRpcUrl = SUPPORTED_NETWORKS[SupportedChainId.FANTOM].rpcUrls[0]; -const polygonRpcUrl = SUPPORTED_NETWORKS[SupportedChainId.MATIC].rpcUrls[0]; -const avalancheRpcUrl = SUPPORTED_NETWORKS[SupportedChainId.AVALANCHE].rpcUrls[0]; -const binanceRpcUrl = SUPPORTED_NETWORKS[SupportedChainId.BSC].rpcUrls[0]; - -module.exports = { - SupportedChainId, - SUPPORTED_NETWORKS, - ethereumRpcUrl, - fantomRpcUrl, - polygonRpcUrl, - avalancheRpcUrl, - binanceRpcUrl, -} \ No newline at end of file diff --git a/projects/helper/ankr/utils.js b/projects/helper/ankr/utils.js deleted file mode 100644 index 2c658b9cfdd..00000000000 --- a/projects/helper/ankr/utils.js +++ /dev/null @@ -1,75 +0,0 @@ -const BigNumber = require('bignumber.js'); -const { toUSDTBalances } = require('../balances'); -const sdk = require("@defillama/sdk") - -const ZERO = new BigNumber(0); - -const ONE_COIN = 1e18; - -const fromWei = (v) => { - if (v) { - return new BigNumber(v).div(1e18); - } - return new BigNumber(0); -}; - -const getVautsTvl = async (vaults, getPrice) => { - const vaultsMap = await Promise.all(vaults.map(async (item) => { - const { vault, chain } = item - let { output: underlyingBalanceWithInvestment } = await sdk.api.abi.call({ - chain, - target: vault, - abi: 'uint256:underlyingBalanceWithInvestment' - }) - - underlyingBalanceWithInvestment = new BigNumber(underlyingBalanceWithInvestment); - - const usd = await getPrice(item); - - return usd.multipliedBy(underlyingBalanceWithInvestment) - })); - return toUSDTBalances(vaultsMap.reduce((acc, item) => acc.plus(item), new BigNumber(ZERO))); -} - -function numberWithCommas(x) { - return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ','); -} - -const formatDecimal = (value, decimal = 18, numPoint = 4, precision = 2) => { - const data = new BigNumber(value).dividedBy(new BigNumber(10).pow(decimal)); - if (data.isGreaterThan(1)) { - return numberWithCommas(data.dp(precision, 1).toNumber()); - } - return data.dp(numPoint, 1).toNumber(); -}; - -const getReserves = async (pairAddress) => { - const { output: { _reserve0, _reserve1, _blockTimestampLast } } = await sdk.api.abi.call({ - target: pairAddress, - abi: 'function getReserves() view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast)' - }) - return { reserve0: _reserve0, reserve1: _reserve1, blockTimestampLast: _blockTimestampLast }; -}; - - -const getTotalSupplyOf = async (contract, chain) => { - const { output: totalSupply } = await sdk.api.erc20.totalSupply({ target: contract }) - return new BigNumber(totalSupply); -}; - -const getBalanceOf = async (account, contract) => { - const { output } = await sdk.api.erc20.balanceOf({ target: contract, owner: account, }) - return new BigNumber(output); -}; - -module.exports = { - ZERO, - ONE_COIN, - fromWei, - getVautsTvl, - formatDecimal, - numberWithCommas, - getReserves, - getTotalSupplyOf, - getBalanceOf, -} \ No newline at end of file diff --git a/projects/onx.js b/projects/onx.js index 894c31e17ce..aef62aa6804 100644 --- a/projects/onx.js +++ b/projects/onx.js @@ -1,25 +1,31 @@ -const sdk = require("@defillama/sdk"); -const { getEthereumTvlEx, getEthereumStaking, getEthereumPoolTvl, getEthereumBorrows, } = require('./config/onx/ethereum'); -const { getFantomTvl } = require('./config/onx/fantom'); -const { getPolygonTvl } = require('./config/onx/polygon'); -const { getAvalancheTvl } = require('./config/onx/avalanche'); +const { ethTvl, getEthereumStaking, getEthereumPoolTvl, getEthereumBorrows, } = require('./config/onx/ethereum'); +const { vaults: fVaults } = require('./config/onx/fantom/vaults'); +const { vaults: pVaults } = require('./config/onx/polygon/vaults'); +const { vaults: aVaults } = require('./config/onx/avalanche/vaults'); module.exports = { - timetravel: false, doublecounted: true, ethereum: { - tvl: getEthereumTvlEx(), + tvl: ethTvl, staking: getEthereumStaking, - pool2: getEthereumPoolTvl(), + pool2: getEthereumPoolTvl, borrowed: getEthereumBorrows, }, - fantom: { - tvl: getFantomTvl, - }, - polygon: { - tvl: getPolygonTvl, - }, - avax:{ - tvl: getAvalancheTvl, - }, + polygon: { tvl, }, + avax: { tvl, }, + fantom: { tvl, }, }; + +const config = { + polygon: { vaults: pVaults }, + avax: { vaults: aVaults }, + fantom: { vaults: fVaults }, +} + +async function tvl(_, _1_, _2_, { api }) { + const { vaults } = config[api.chain] + const pools = vaults.map(i => i[1]) + const tokens = vaults.map(i => i[0]) + const bals = await api.multiCall({ abi: 'uint256:underlyingBalanceWithInvestment', calls: pools }) + api.addTokens(tokens, bals) +} \ No newline at end of file From 2f8a78129ddb0bc294753e962fb6737ae3d0aef3 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 25 Aug 2023 11:30:50 +0200 Subject: [PATCH 0973/1974] update ethereumclassic rpc --- projects/helper/env.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/helper/env.js b/projects/helper/env.js index 44bee1d2b5f..0cfd407d40b 100644 --- a/projects/helper/env.js +++ b/projects/helper/env.js @@ -9,6 +9,7 @@ const DEFAULTS = { APTOS_RPC: 'https://aptos-mainnet.pontem.network', SUI_RPC: 'https://fullnode.mainnet.sui.io/', MULTIVERSX_RPC: 'https://api.multiversx.com', + ETHEREUMCLASSIC_RPC: 'https://etc.etcdesktop.com,https://etc.rivet.link', } const ENV_KEYS = [ From dbe501d178ee7c114f165ec8f0d6dd78e5d11d2b Mon Sep 17 00:00:00 2001 From: Antoine Bellanger Date: Fri, 25 Aug 2023 12:15:26 +0200 Subject: [PATCH 0974/1974] Update SwissBorg addresses --- projects/swissborg/index.js | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/projects/swissborg/index.js b/projects/swissborg/index.js index c5e1bf63ff1..e58819ecf65 100644 --- a/projects/swissborg/index.js +++ b/projects/swissborg/index.js @@ -11,6 +11,8 @@ const config = { '0xcDE4c1b984F3F02f997ECfF9980B06316de2577d', '0x6cf9aa65ebad7028536e353393630e2340ca6049', '0x7153D2ef9F14a6b1Bb2Ed822745f65E58d836C3F', + '0xff4606bd3884554cdbdabd9b6e25e2fad4f6fc54', + '0x22bF0A4C4eff418b3306AbFeE20813D0b6E8Dc74', ], }, bitcoin: { @@ -34,12 +36,14 @@ const config = { owners: [ 'dc6b4c8821dbe652b763e3bfadfea548137b29b97408c8b411ad72acff94e63f', '1c0dc521827821f1695538ff9312df15f32837bbfe95bc937f9faaafd4125552', + '9b23bfd45a028e7a28326007b221cf8bd8b288630dde5ca714a0524f4865db89', ], }, solana: { owners: [ '2E1UKoiiZPwsp4vn6tUh5k61kG2UqYpT7oBrFaJUJXXd', '2XxP4kS2vfkiMvpLpGNxry3fPUYimsuAmSbqL1KnuwZ8', + 'Cet3t77x2BBVSmiEFm8ZPoDSngbpso2RuWPL79Ky7SpA', ], }, polkadot: { @@ -61,9 +65,34 @@ const config = { ], }, bsc: { - owners: ['0x5770815B0c2a09A43C9E5AEcb7e2f3886075B605'] + owners: [ + '0x5770815B0c2a09A43C9E5AEcb7e2f3886075B605', + '0x94596096320A6B4EaB43556AD1Ed8c4c3d51C9aA', + '0x87cbc48075d7aa1760Ac71C41e8Bc289b6A31F56', + '0xcDE4c1b984F3F02f997ECfF9980B06316de2577d', + '0x7153D2ef9F14a6b1Bb2Ed822745f65E58d836C3F', + '0xff4606bd3884554cdbdabd9b6e25e2fad4f6fc54', + ] + }, + avax: { + owners: [ + '0x87cbc48075d7aa1760Ac71C41e8Bc289b6A31F56', + '0xcDE4c1b984F3F02f997ECfF9980B06316de2577d', + '0x7153D2ef9F14a6b1Bb2Ed822745f65E58d836C3F', + ] + }, + polygon: { + owners: [ + '0x87cbc48075d7aa1760Ac71C41e8Bc289b6A31F56', + '0xcDE4c1b984F3F02f997ECfF9980B06316de2577d', + ] + }, + moonbeam: { + owners: [ + '0x87cbc48075d7aa1760Ac71C41e8Bc289b6A31F56', + ] } } module.exports = cexExports(config) -module.exports.methodology = 'We are not counting money in defi Protocols. In this case around $47m in AAVE v3 (Avalanche chain), and around $3.43m in Stargate. We are also not counting around $19.2m in the Alpaca Finance protocol (bsc chain). We may also not counting a few small token balances. This data was collected on 20/11/22 ' \ No newline at end of file +module.exports.methodology = 'The list of wallets can be found at https://github.com/SwissBorg/pub. We also publish monthly our Proof of Liabilities at https://swissborg.com/proof-of-liabilities/audits.' \ No newline at end of file From 9834f456328ba4fb9b39c307d8d76743c7624bc2 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 25 Aug 2023 15:10:45 +0200 Subject: [PATCH 0975/1974] stop relying on trongrid --- projects/helper/chain/tron.js | 11 ++++++++++- projects/helper/unwrapLPs.js | 8 ++------ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/projects/helper/chain/tron.js b/projects/helper/chain/tron.js index 02f07792cd4..411c578211b 100644 --- a/projects/helper/chain/tron.js +++ b/projects/helper/chain/tron.js @@ -1,10 +1,19 @@ -const { get, } = require('../http') +const { get, post, } = require('../http') async function getStakedTron(account) { const data = await get(`https://apilist.tronscan.org/api/vote?candidate=${account}`) return data.totalVotes } +async function getTrxBalance(account) { + const data = await post('https://api.trongrid.io/wallet/getaccount', { + address: account, + visible: true, + }) + return data.balance + (data.frozen?.reduce((t, { frozen_balance }) => t + frozen_balance, 0) ?? 0) +} + module.exports = { getStakedTron, + getTrxBalance, } diff --git a/projects/helper/unwrapLPs.js b/projects/helper/unwrapLPs.js index be0d3e197da..d4ada23874b 100644 --- a/projects/helper/unwrapLPs.js +++ b/projects/helper/unwrapLPs.js @@ -12,6 +12,7 @@ const { isLP, log, } = require('./utils') const { sumArtBlocks, whitelistedNFTs, } = require('./nft') const wildCreditABI = require('../wildcredit/abi.json'); const { covalentGetTokens, get } = require("./http"); +const { getTrxBalance } = require("./chain/tron"); const { sliceIntoChunks } = require('@defillama/sdk/build/util'); const lpReservesAbi = 'function getReserves() view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast)' @@ -375,12 +376,6 @@ async function sumBalancerLps(balances, tokensAndOwners, block, chain, transform }) } -async function getTrxBalance(account) { - if (account === '0x2c7c9963111905d29eb8da37d28b0f53a7bb5c28') account = 'TE2RzoSV3wFK99w6J9UnnZ4vLfXYoxvRwP' - const data = await get('https://apilist.tronscan.org/api/account?address=' + account) - return data.balance + (data.totalFrozen || 0) -} - const nullAddress = ADDRESSES.null const gasTokens = [nullAddress, '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee', '0xbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb'] /* @@ -407,6 +402,7 @@ async function sumTokens(balances = {}, tokensAndOwners, block, chain = "ethereu if (ethBalanceInputs.length) { if (chain === "tron") { const ethBalances = await Promise.all(ethBalanceInputs.map(getTrxBalance)) + console.log(ethBalances) ethBalances.forEach(balance => sdk.util.sumSingleBalance(balances, transformAddress(nullAddress), balance)) } else { const { output: ethBalances } = await sdk.api.eth.getBalances({ targets: ethBalanceInputs, chain, block }) From 68595ffd4f75ea84fcf3dfd6907debc2993b85aa Mon Sep 17 00:00:00 2001 From: Knightswap <93270632+Knightswap@users.noreply.github.com> Date: Fri, 25 Aug 2023 19:16:00 +0530 Subject: [PATCH 0976/1974] added adapter for knightswap-lending protocol (#7279) * added adapter for knightswap-lending protocol * code refactor --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/knightswap-lending/index.js | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 projects/knightswap-lending/index.js diff --git a/projects/knightswap-lending/index.js b/projects/knightswap-lending/index.js new file mode 100644 index 00000000000..c6412cd5527 --- /dev/null +++ b/projects/knightswap-lending/index.js @@ -0,0 +1,8 @@ +const {compoundExports2} = require('../helper/compound'); + +const unitroller_bsc = "0x4f92913b86d5e79593fa2e475a8232b22ef17ed1" + +module.exports = { + bsc:compoundExports2({ comptroller: unitroller_bsc}), + methodology: "Counts the tokens locked in the contracts to be used as collateral to borrow or to earn yield. Borrowed coins are not counted towards the TVL, so only the coins actually locked in the contracts are counted. There's multiple reasons behind this but one of the main ones is to avoid inflating the TVL through cycled lending.. TVL is calculated by getting the market addresses from comptroller and calling the getCash() on-chain method to get the amount of tokens locked in each of these addresses, then we get the price of each token from coingecko. To view the Borrowed amounts along with the currently liquidity, click the 'Borrowed' check box", +} \ No newline at end of file From dba251f84581e9a236b2caa9a7ecbe1cc1483720 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 25 Aug 2023 16:21:36 +0200 Subject: [PATCH 0977/1974] remove log message --- projects/helper/unwrapLPs.js | 1 - 1 file changed, 1 deletion(-) diff --git a/projects/helper/unwrapLPs.js b/projects/helper/unwrapLPs.js index d4ada23874b..f7ff7cb5109 100644 --- a/projects/helper/unwrapLPs.js +++ b/projects/helper/unwrapLPs.js @@ -402,7 +402,6 @@ async function sumTokens(balances = {}, tokensAndOwners, block, chain = "ethereu if (ethBalanceInputs.length) { if (chain === "tron") { const ethBalances = await Promise.all(ethBalanceInputs.map(getTrxBalance)) - console.log(ethBalances) ethBalances.forEach(balance => sdk.util.sumSingleBalance(balances, transformAddress(nullAddress), balance)) } else { const { output: ethBalances } = await sdk.api.eth.getBalances({ targets: ethBalanceInputs, chain, block }) From 903d511632e58e3e52731b0c9235ba1a7e13a165 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 25 Aug 2023 18:19:13 +0200 Subject: [PATCH 0978/1974] sunswap-v2: revert change --- projects/sunswap-v2/index.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/projects/sunswap-v2/index.js b/projects/sunswap-v2/index.js index 055990fcfc9..2c432b713da 100644 --- a/projects/sunswap-v2/index.js +++ b/projects/sunswap-v2/index.js @@ -1,7 +1,5 @@ const { getUniTVL } = require('../helper/unknownTokens.js') -process.env.TRON_RPC="https://rpc.ankr.com/http/tron/wallet/triggerconstantcontract" - module.exports = { timetravel: false, misrepresentedTokens: true, From 79cd64e0f3be0611f05b3781442e91a2eea96d56 Mon Sep 17 00:00:00 2001 From: Dozer <71271486+dev-dozer@users.noreply.github.com> Date: Fri, 25 Aug 2023 21:57:39 +0300 Subject: [PATCH 0979/1974] added new BASE chain (#7283) --- projects/interport-finance/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/interport-finance/index.js b/projects/interport-finance/index.js index def75747fb5..bf57456783e 100644 --- a/projects/interport-finance/index.js +++ b/projects/interport-finance/index.js @@ -6,13 +6,14 @@ const usdcVault = '0x5b45B414c6CD2a3341bE70Ba22BE786b0124003F'; const defaultVaults = [usdtVault, usdcVault]; const config = { era: { vaults: ['0xc724832c5ed81599aE3E4EBC0eC4f87A285B5838'] }, + base: { vaults: [usdcVault] }, } module.exports = { methodology: 'Interport TVL is calculated by summing the USDT and USDC balance of the vaults contracts, ITP token balance in the ITP Revenue Share contract and LP token balance in the LP Revenue Share contract.', }; -['ethereum', 'avax', 'bsc', 'fantom', 'arbitrum', 'polygon', 'polygon_zkevm', 'era'].forEach(chain => { +['ethereum', 'avax', 'bsc', 'fantom', 'arbitrum', 'polygon', 'polygon_zkevm', 'base', 'era'].forEach(chain => { module.exports[chain] = { tvl: async (_, _1, _2, { api }) => { const vaults = config[chain]?.vaults || defaultVaults From 36d8a1116653e9941df62298ac7d4590224c0a96 Mon Sep 17 00:00:00 2001 From: Jay Welsh Date: Fri, 25 Aug 2023 21:00:48 +0200 Subject: [PATCH 0980/1974] feat(silo): add support for latest silo deployments (#7274) --- projects/silo/index.js | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/projects/silo/index.js b/projects/silo/index.js index d7089c1a700..eb25a23488a 100644 --- a/projects/silo/index.js +++ b/projects/silo/index.js @@ -7,12 +7,28 @@ const getAssetStateAbi = 'function getAssetsWithState() view returns (address[] const config = { ethereum: { - START_BLOCK: 15307294, - SILO_FACTORY: '0x4D919CEcfD4793c0D47866C8d0a02a0950737589', + factories: [ + { + START_BLOCK: 15307294, + SILO_FACTORY: '0x4D919CEcfD4793c0D47866C8d0a02a0950737589', // Silo Ethereum (Original) + }, + { + START_BLOCK: 17391885, + SILO_FACTORY: '0x6d4A256695586F61b77B09bc3D28333A91114d5a' // Silo Ethereum (Convex Factory) + }, + { + START_BLOCK: 17782576, + SILO_FACTORY: '0x2c0fA05281730EFd3ef71172d8992500B36b56eA' // Silo Ethereum (LLAMA Edition) + } + ] }, arbitrum: { - START_BLOCK: 51894508, - SILO_FACTORY: '0x4166487056A922D784b073d4d928a516B074b719', + factories: [ + { + START_BLOCK: 51894508, + SILO_FACTORY: '0x4166487056A922D784b073d4d928a516B074b719', // Silo Arbitrum (Original) + } + ] }, } @@ -47,15 +63,17 @@ async function borrowed(_, block, _1, { api }) { async function getSilos(api) { const chain = api.chain - const { SILO_FACTORY, START_BLOCK, } = config[chain] - const logs = ( - await getLogs({ + let logs = []; + for(let factory of config[chain].factories) { + const { SILO_FACTORY, START_BLOCK, } = factory; + let logChunk = await getLogs({ api, target: SILO_FACTORY, fromBlock: START_BLOCK, topic: 'NewSiloCreated(address,address,uint128)', }) - ) + logs = [...logs, ...logChunk]; + } return logs.map((log) => `0x${log.topics[1].substring(26)}`).filter((address) => fallbackBlacklist.indexOf(address.toLowerCase()) === -1); } From ff6e7f6e53bd27d5cbdfd05e1f141a57cb0ddf11 Mon Sep 17 00:00:00 2001 From: DeFi-dev <137463793+WemadeDeFiDev@users.noreply.github.com> Date: Sat, 26 Aug 2023 04:22:44 +0900 Subject: [PATCH 0981/1974] Kurrency klaytn (#7278) * add kurrency-klaytn project * fix bug for CDPManager * merge kurrency listings * lint fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/kurrency/index.js | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/projects/kurrency/index.js b/projects/kurrency/index.js index 90a91a83c18..30b8ede26cd 100644 --- a/projects/kurrency/index.js +++ b/projects/kurrency/index.js @@ -1,17 +1,23 @@ async function tvl(_, _b, _cb, { api, }) { - const cdpManager = '0x1B18d5a2f35B431aACa02B58eE9E4B7FBa9b098d' - const PSM = '0xbdd0b6212505bcD15C38839cf338E40aeCd95b13' + const { PSM, cdpManager, getCollateralInfo } = config[api.chain] const ids = await api.call({ abi: abi.getCollateralIds, target: cdpManager }) const psmTokens = await api.call({ abi: abi.getPSMTokens, target: PSM }) const psmInfos = await api.multiCall({ abi: abi.getPSMTokenInfo, calls: psmTokens, target: PSM }) - const infos = await api.multiCall({ abi: abi.getCollateralInfo, calls: ids, target: cdpManager }) + const infos = await api.multiCall({ abi: getCollateralInfo, calls: ids, target: cdpManager }) infos.forEach(info => api.add(info.token, info.balance)) psmInfos.forEach((info, i) => api.add(psmTokens[i], info.balance)) } -module.exports = { +const config = { wemix: { - tvl + cdpManager: '0x1B18d5a2f35B431aACa02B58eE9E4B7FBa9b098d', + PSM: '0xbdd0b6212505bcD15C38839cf338E40aeCd95b13', + getCollateralInfo: "function getCollateralInfo(uint256 collateralId) view returns (tuple(address token, address investor, uint256 balance, uint256 maxLTV, uint256 liquidationLTV, uint256 debtCeiling, uint256 interestRate, uint256 liquidationBonusRate, uint256 lastUpdateTime, uint256 lastVaultId, tuple(uint256 originalDebt, uint256 debt, uint256 debtShare) debtInfo) collateralInfo)", + }, + klaytn: { + cdpManager: '0x1962862De07BCf48680913a47F45A80022e6869a', + PSM: '0x90Da6Ed29eCCA4CFa0BE8Da50623de5aB86c285b', + getCollateralInfo: "function getCollateralInfo(uint256 collateralId) view returns (tuple(address token, address investor, bool isLeverage, uint256 balance, uint256 maxLTV, uint256 liquidationLTV, uint256 debtCeiling, uint256 interestRate, uint256 liquidationBonusRate, uint256 lastUpdateTime, uint256 lastVaultId, tuple(uint256 originalDebt, uint256 debt, uint256 debtShare) debtInfo) collateralInfo)", } }; @@ -19,5 +25,8 @@ const abi = { "getCollateralIds": "uint256[]:getCollateralIds", "getPSMTokenInfo": "function getPSMTokenInfo(address token) view returns (tuple(uint256 mintLimit, uint256 minReserve, uint256 balance, uint256 mintAmount, uint256 collateralId, address investor) tokenInfo)", "getPSMTokens": "address[]:getPSMTokens", - "getCollateralInfo": "function getCollateralInfo(uint256 collateralId) view returns (tuple(address token, address investor, uint256 balance, uint256 maxLTV, uint256 liquidationLTV, uint256 debtCeiling, uint256 interestRate, uint256 liquidationBonusRate, uint256 lastUpdateTime, uint256 lastVaultId, tuple(uint256 originalDebt, uint256 debt, uint256 debtShare) debtInfo) collateralInfo)", -} \ No newline at end of file +} + +Object.keys(config).forEach(chain => { + module.exports[chain] = { tvl } +}) \ No newline at end of file From e73bf6c650bcd445ffeb37cf494a3311ce0cf589 Mon Sep 17 00:00:00 2001 From: Racoon <100084606+racoon-supply-rac@users.noreply.github.com> Date: Fri, 25 Aug 2023 16:18:42 -0400 Subject: [PATCH 0982/1974] Added Racoon.Bet project (#7282) * Added Racoon.Bet * Fixed Racoon.Bet: Test is working * code refactor --------- Co-authored-by: RACSUP Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/helper/chain/cosmos.js | 1 + projects/racoon-bet/index.js | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 projects/racoon-bet/index.js diff --git a/projects/helper/chain/cosmos.js b/projects/helper/chain/cosmos.js index 30860fa8049..703e28c9106 100644 --- a/projects/helper/chain/cosmos.js +++ b/projects/helper/chain/cosmos.js @@ -222,6 +222,7 @@ async function queryContractStore({ } async function sumTokens({ balances = {}, owners = [], chain, owner, tokens, blacklistedTokens, }) { + if (!tokens?.length) tokens = undefined; if (owner) owners = [owner] log(chain, "fetching balances for ", owners.length); let parallelLimit = 25; diff --git a/projects/racoon-bet/index.js b/projects/racoon-bet/index.js new file mode 100644 index 00000000000..82cfe818165 --- /dev/null +++ b/projects/racoon-bet/index.js @@ -0,0 +1,16 @@ +const { sumTokensExport } = require('../helper/sumTokens') + +const config = { + juno: { owner: 'juno1puyjxrxkkwc9ms63a297vx2aln4kqsaeegnclknt99py59elandses9f3j', }, + migaloo: { owner: 'migaloo1q6vmqprwvay5p3l0d763v50ufunt7fwfnfwp85wne5xan4meeqpsdvzyvy', }, + chihuahua: { owner: 'chihuahua18s2dazpmva4t38rtnrlj3gjpsntmcdrk6v9220kt4yxckhqus3vssqsrgp', }, +} + +module.exports = { + timetravel: false, +} + +Object.keys(config).forEach(chain => { + const { owner } = config[chain] + module.exports[chain] = { tvl: sumTokensExport({ owner }) } +}) \ No newline at end of file From c1096722892f7ae942872ec329df9ee80ce44376 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 25 Aug 2023 22:19:44 +0200 Subject: [PATCH 0983/1974] Revert "Added Racoon.Bet project (#7282)" (#7285) This reverts commit e73bf6c650bcd445ffeb37cf494a3311ce0cf589. --- projects/helper/chain/cosmos.js | 1 - projects/racoon-bet/index.js | 16 ---------------- 2 files changed, 17 deletions(-) delete mode 100644 projects/racoon-bet/index.js diff --git a/projects/helper/chain/cosmos.js b/projects/helper/chain/cosmos.js index 703e28c9106..30860fa8049 100644 --- a/projects/helper/chain/cosmos.js +++ b/projects/helper/chain/cosmos.js @@ -222,7 +222,6 @@ async function queryContractStore({ } async function sumTokens({ balances = {}, owners = [], chain, owner, tokens, blacklistedTokens, }) { - if (!tokens?.length) tokens = undefined; if (owner) owners = [owner] log(chain, "fetching balances for ", owners.length); let parallelLimit = 25; diff --git a/projects/racoon-bet/index.js b/projects/racoon-bet/index.js deleted file mode 100644 index 82cfe818165..00000000000 --- a/projects/racoon-bet/index.js +++ /dev/null @@ -1,16 +0,0 @@ -const { sumTokensExport } = require('../helper/sumTokens') - -const config = { - juno: { owner: 'juno1puyjxrxkkwc9ms63a297vx2aln4kqsaeegnclknt99py59elandses9f3j', }, - migaloo: { owner: 'migaloo1q6vmqprwvay5p3l0d763v50ufunt7fwfnfwp85wne5xan4meeqpsdvzyvy', }, - chihuahua: { owner: 'chihuahua18s2dazpmva4t38rtnrlj3gjpsntmcdrk6v9220kt4yxckhqus3vssqsrgp', }, -} - -module.exports = { - timetravel: false, -} - -Object.keys(config).forEach(chain => { - const { owner } = config[chain] - module.exports[chain] = { tvl: sumTokensExport({ owner }) } -}) \ No newline at end of file From c4d8f8fd0f2066975ee1e5c5ef1e7101cff8f914 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 25 Aug 2023 22:30:38 +0200 Subject: [PATCH 0984/1974] cosmos: sumTokens fix bug --- projects/helper/chain/cosmos.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/projects/helper/chain/cosmos.js b/projects/helper/chain/cosmos.js index 30860fa8049..a521744dff5 100644 --- a/projects/helper/chain/cosmos.js +++ b/projects/helper/chain/cosmos.js @@ -3,6 +3,7 @@ const sdk = require("@defillama/sdk"); const { transformBalances } = require("../portedTokens"); const { PromisePool } = require("@supercharge/promise-pool"); const { log } = require("../utils"); +const ADDRESSES = require('../coreAssets.json') // where to find chain info // https://proxy.atomscan.com/chains.json @@ -222,6 +223,7 @@ async function queryContractStore({ } async function sumTokens({ balances = {}, owners = [], chain, owner, tokens, blacklistedTokens, }) { + if (!tokens?.length || (tokens?.length === 1 && tokens[0] === ADDRESSES.null)) tokens = undefined; if (owner) owners = [owner] log(chain, "fetching balances for ", owners.length); let parallelLimit = 25; From ca22f05e1095be8c022d66a797b533dfaa5cb8e0 Mon Sep 17 00:00:00 2001 From: Autotronic <138796740+AutoTronicProject@users.noreply.github.com> Date: Sat, 26 Aug 2023 05:52:23 +0900 Subject: [PATCH 0985/1974] Autotronic Listing (#7284) * Autotronic Listing * code refactor --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/autotronic/index.js | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 projects/autotronic/index.js diff --git a/projects/autotronic/index.js b/projects/autotronic/index.js new file mode 100644 index 00000000000..d286623eb35 --- /dev/null +++ b/projects/autotronic/index.js @@ -0,0 +1,7 @@ +const { getUniTVL } = require('../helper/unknownTokens') +module.exports = { + start: 1692842880, + base: { + tvl: getUniTVL({ factory: '0x55b3409335B81E7A8B7C085Bbb4047DDc23f7257', useDefaultCoreAssets: true, fetchBalances: true, }), + }, +}; \ No newline at end of file From cf566cb80b949c816940155228019ae26aa5cb4c Mon Sep 17 00:00:00 2001 From: define Date: Sat, 26 Aug 2023 12:04:20 +0100 Subject: [PATCH 0986/1974] add badidea treasury --- projects/treasury/badidea.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 projects/treasury/badidea.js diff --git a/projects/treasury/badidea.js b/projects/treasury/badidea.js new file mode 100644 index 00000000000..fdaa7899620 --- /dev/null +++ b/projects/treasury/badidea.js @@ -0,0 +1,20 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const TREASURY1 = '0xe5F6f7181EEc4C2A8ae59e5dE2aFeD32E9ea3250' +const TREASURY2 = '0xA41f36D9F8c9eD352Ed80105C921D55559C2F8E9' +const TREASURY3 = '0xBA07DbA88B9d3700c169cE82Ced3C1bF4791b3b6' +const TREASURY4 = '0x7A748CE254bb2E377aaFd24b81Eb4442c1a57734' +const TREASURY5 = '0x33a733B6b613A2178109F2353B6369D2d3a86b0e' +const TREASURY6 = '0x22F519e33550A0F521DF80080f8Aabe22e63131d' +const BAD = '0x32b86b99441480a7E5BD3A26c124ec2373e3F015' + + + +module.exports = treasuryExports({ + ethereum: { + tokens: [nullAddress, ADDRESSES.ethereum.USDC, ADDRESSES.ethereum.USDT, ], + owners: [TREASURY1, TREASURY2, TREASURY3, TREASURY4, TREASURY5, TREASURY6], + ownTokens: [BAD], + }, +}); \ No newline at end of file From 97e9e550456909a56cff732e69f49931f0ef9c40 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Sat, 26 Aug 2023 18:56:00 +0200 Subject: [PATCH 0987/1974] tron getBalances - rely on @defillama/sdk --- package-lock.json | 12 ++++++------ projects/helper/unwrapLPs.js | 10 +++++----- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5153cb6bb19..c0f80871d0c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -63,9 +63,9 @@ } }, "node_modules/@defillama/sdk": { - "version": "4.0.46", - "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.46.tgz", - "integrity": "sha512-CC3dnZg9xYQP5gyx5CeKI0YF1877SH7pEwVn1hHguMJbOUJQERmbXSCI6yDDBUBoBB/Ai8o8yhdPgrFRT8Wt4A==", + "version": "4.0.47", + "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.47.tgz", + "integrity": "sha512-Uarp7y5WJHlEARc6YI2RdwCftxa5ytLafxkKTbafnacQ/xshdqku15glnxm+xxV24ED6w9RBhOvcPBEn/h6SZQ==", "dependencies": { "@supercharge/promise-pool": "^2.1.0", "ethers": "^5.4.5", @@ -4194,9 +4194,9 @@ } }, "@defillama/sdk": { - "version": "4.0.46", - "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.46.tgz", - "integrity": "sha512-CC3dnZg9xYQP5gyx5CeKI0YF1877SH7pEwVn1hHguMJbOUJQERmbXSCI6yDDBUBoBB/Ai8o8yhdPgrFRT8Wt4A==", + "version": "4.0.47", + "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.47.tgz", + "integrity": "sha512-Uarp7y5WJHlEARc6YI2RdwCftxa5ytLafxkKTbafnacQ/xshdqku15glnxm+xxV24ED6w9RBhOvcPBEn/h6SZQ==", "requires": { "@supercharge/promise-pool": "^2.1.0", "ethers": "^5.4.5", diff --git a/projects/helper/unwrapLPs.js b/projects/helper/unwrapLPs.js index f7ff7cb5109..f9d32ddf055 100644 --- a/projects/helper/unwrapLPs.js +++ b/projects/helper/unwrapLPs.js @@ -400,13 +400,13 @@ async function sumTokens(balances = {}, tokensAndOwners, block, chain = "ethereu ethBalanceInputs = getUniqueAddresses(ethBalanceInputs, chain) if (ethBalanceInputs.length) { - if (chain === "tron") { - const ethBalances = await Promise.all(ethBalanceInputs.map(getTrxBalance)) - ethBalances.forEach(balance => sdk.util.sumSingleBalance(balances, transformAddress(nullAddress), balance)) - } else { + // if (chain === "tron") { + // const ethBalances = await Promise.all(ethBalanceInputs.map(getTrxBalance)) + // ethBalances.forEach(balance => sdk.util.sumSingleBalance(balances, transformAddress(nullAddress), balance)) + // } else { const { output: ethBalances } = await sdk.api.eth.getBalances({ targets: ethBalanceInputs, chain, block }) ethBalances.forEach(({ balance }) => sdk.util.sumSingleBalance(balances, transformAddress(nullAddress), balance)) - } + // } } const balanceOfTokens = await sdk.api.abi.multiCall({ From c84efdea74444313409c1c2af1b2388a90e4e139 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Sat, 26 Aug 2023 19:50:55 +0200 Subject: [PATCH 0988/1974] disable server-rebuild --- .github/workflows/alert.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/alert.yml b/.github/workflows/alert.yml index 491259c75eb..8616527c944 100644 --- a/.github/workflows/alert.yml +++ b/.github/workflows/alert.yml @@ -11,5 +11,5 @@ jobs: - uses: actions/checkout@v2 - name: Update unlisted run: curl https://born-to-llama.herokuapp.com/refresh - - name: Deploy to server - run: curl https://born-to-llama.herokuapp.com/rebuild-server + # - name: Deploy to server + # run: curl https://born-to-llama.herokuapp.com/rebuild-server From d3f1cbacfad1c94b96990c0a402c82f287e562bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20K=C3=B6nekamp?= Date: Sun, 27 Aug 2023 04:35:32 +0100 Subject: [PATCH 0989/1974] Implement Altitude TVL Across Multiple Chains MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit • Added support to fetch the Total Value Locked (TVL) of Altitude contracts across multiple chains, including Ethereum, BSC, Polygon, Arbitrum, Avax, Optimism, and Fantom. • Introduced a dynamic lookup for chain-specific contract addresses and block numbers. • Optimized the TVL retrieval process by incorporating chain-specific path counts to prevent unnecessary API calls. • Refactored the codebase to align with the new adapter export specification, ensuring each chain's TVL is appropriately nested under its respective chain key. • Handled potential issues with ABI compatibility and chain support. Enhanced error handling to provide more meaningful feedback during testing and debugging. --- projects/altitude/abi.json | 995 +++++++++++++++++++++++++++++++++++++ projects/altitude/index.js | 69 +++ 2 files changed, 1064 insertions(+) create mode 100644 projects/altitude/abi.json create mode 100644 projects/altitude/index.js diff --git a/projects/altitude/abi.json b/projects/altitude/abi.json new file mode 100644 index 00000000000..4ce8fbe59e2 --- /dev/null +++ b/projects/altitude/abi.json @@ -0,0 +1,995 @@ +[ + { + "inputs": [ + { "internalType": "address", "name": "_endpoint", "type": "address" }, + { "internalType": "address", "name": "_altitudeFee", "type": "address" }, + { + "internalType": "address", + "name": "_altitudeFactory", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint16", + "name": "_dstChainId", + "type": "uint16" + }, + { + "indexed": false, + "internalType": "address", + "name": "_dstToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "AddLiquidity", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint16", + "name": "_srcChainId", + "type": "uint16" + }, + { + "indexed": false, + "internalType": "address", + "name": "_srcToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "_to", + "type": "address" + } + ], + "name": "Callback_RemoveLiquidityRemote_Confirm", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint16", + "name": "_srcChainId", + "type": "uint16" + }, + { + "indexed": false, + "internalType": "address", + "name": "_srcToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "_to", + "type": "address" + } + ], + "name": "Callback_RemoveLiquidityRemote_Revoke", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint16", + "name": "_srcChainId", + "type": "uint16" + }, + { + "indexed": false, + "internalType": "address", + "name": "_srcToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "_to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_rebalanceFee", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_protocolFee", + "type": "uint256" + } + ], + "name": "Callback_Swap_Confirm", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint16", + "name": "_srcChainId", + "type": "uint16" + }, + { + "indexed": false, + "internalType": "address", + "name": "_srcToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "_to", + "type": "address" + } + ], + "name": "Callback_Swap_Revoke", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint16", + "name": "_srcChainId", + "type": "uint16" + }, + { + "indexed": false, + "internalType": "address", + "name": "_srcToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "Remote_AddLiquidity", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint16", + "name": "_srcChainId", + "type": "uint16" + }, + { + "indexed": false, + "internalType": "address", + "name": "_srcToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "Remote_RemoveLiquidityLocal", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint16", + "name": "_srcChainId", + "type": "uint16" + }, + { + "indexed": false, + "internalType": "address", + "name": "_srcToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "_to", + "type": "address" + } + ], + "name": "Remote_RemoveLiquidityRemote", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint16", + "name": "_srcChainId", + "type": "uint16" + }, + { + "indexed": false, + "internalType": "address", + "name": "_srcToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "_to", + "type": "address" + } + ], + "name": "Remote_Swap", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint16", + "name": "_dstChainId", + "type": "uint16" + }, + { + "indexed": false, + "internalType": "address", + "name": "_dstToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "RemoveLiquidityLocal", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint16", + "name": "_dstChainId", + "type": "uint16" + }, + { + "indexed": false, + "internalType": "address", + "name": "_dstToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "_to", + "type": "address" + } + ], + "name": "RemoveLiquidityRemote", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint16", + "name": "_dstChainId", + "type": "uint16" + }, + { + "indexed": false, + "internalType": "address", + "name": "_dstToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "_to", + "type": "address" + } + ], + "name": "RemoveLiquidityRemote_Confirm", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint16", + "name": "_dstChainId", + "type": "uint16" + }, + { + "indexed": false, + "internalType": "address", + "name": "_dstToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "_to", + "type": "address" + } + ], + "name": "RemoveLiquidityRemote_Revoke", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint16", + "name": "_dstChainId", + "type": "uint16" + }, + { + "indexed": false, + "internalType": "address", + "name": "_dstToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "_to", + "type": "bytes" + } + ], + "name": "Swap", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint16", + "name": "_dstChainId", + "type": "uint16" + }, + { + "indexed": false, + "internalType": "address", + "name": "_dstToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "_to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_rebalanceReward", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_rebalanceFee", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_protocolFee", + "type": "uint256" + } + ], + "name": "Swap_Confirm", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint16", + "name": "_dstChainId", + "type": "uint16" + }, + { + "indexed": false, + "internalType": "address", + "name": "_dstToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "_to", + "type": "address" + } + ], + "name": "Swap_Revoke", + "type": "event" + }, + { "stateMutability": "payable", "type": "fallback" }, + { + "inputs": [ + { "internalType": "uint16", "name": "_dstChainId", "type": "uint16" }, + { "internalType": "address", "name": "_dstToken", "type": "address" } + ], + "name": "activateChainPath", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "_srcToken", "type": "address" }, + { "internalType": "uint16", "name": "_dstChainId", "type": "uint16" }, + { "internalType": "address", "name": "_dstToken", "type": "address" }, + { "internalType": "string", "name": "_name", "type": "string" }, + { "internalType": "string", "name": "_symbol", "type": "string" } + ], + "name": "addChainPath", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint16", "name": "_dstChainId", "type": "uint16" }, + { "internalType": "address", "name": "_dstToken", "type": "address" }, + { "internalType": "uint256", "name": "_amount", "type": "uint256" } + ], + "name": "addLiquidity", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "altitudeFactory", + "outputs": [ + { "internalType": "contract IFactory", "name": "", "type": "address" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "altitudeFee", + "outputs": [ + { "internalType": "contract IAltitudeFee", "name": "", "type": "address" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint16", "name": "", "type": "uint16" }, + { "internalType": "address", "name": "", "type": "address" } + ], + "name": "chainPathIndexLookup", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "name": "chainPaths", + "outputs": [ + { "internalType": "bool", "name": "ready", "type": "bool" }, + { "internalType": "address", "name": "srcToken", "type": "address" }, + { "internalType": "uint16", "name": "dstChainId", "type": "uint16" }, + { "internalType": "address", "name": "dstToken", "type": "address" }, + { + "internalType": "uint256", + "name": "remoteLiquidity", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "localLiquidity", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rewardPoolSize", + "type": "uint256" + }, + { "internalType": "address", "name": "lpToken", "type": "address" }, + { "internalType": "bool", "name": "stopSwap", "type": "bool" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "_Id", "type": "uint256" }], + "name": "confirmPendingTransaction", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint16", "name": "_dstChainId", "type": "uint16" }, + { "internalType": "address", "name": "_dstToken", "type": "address" }, + { "internalType": "uint256", "name": "_amount", "type": "uint256" } + ], + "name": "depositRewardPool", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint16", "name": "_dstChainId", "type": "uint16" }, + { "internalType": "address", "name": "_dstToken", "type": "address" }, + { "internalType": "bool", "name": "_enable", "type": "bool" } + ], + "name": "emergencyStopSwap", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "feeTo", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint16", "name": "_srcChainId", "type": "uint16" }, + { "internalType": "bytes", "name": "_srcAddress", "type": "bytes" } + ], + "name": "forceResumeReceive", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint16", "name": "", "type": "uint16" }, + { "internalType": "uint8", "name": "", "type": "uint8" } + ], + "name": "gasLookup", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint16", "name": "_dstChainId", "type": "uint16" }, + { "internalType": "address", "name": "_dstToken", "type": "address" } + ], + "name": "getChainPath", + "outputs": [ + { + "components": [ + { "internalType": "bool", "name": "ready", "type": "bool" }, + { "internalType": "address", "name": "srcToken", "type": "address" }, + { "internalType": "uint16", "name": "dstChainId", "type": "uint16" }, + { "internalType": "address", "name": "dstToken", "type": "address" }, + { + "internalType": "uint256", + "name": "remoteLiquidity", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "localLiquidity", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rewardPoolSize", + "type": "uint256" + }, + { "internalType": "address", "name": "lpToken", "type": "address" }, + { "internalType": "bool", "name": "stopSwap", "type": "bool" } + ], + "internalType": "struct Altitude.ChainPath", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint16", "name": "_dstChainId", "type": "uint16" }, + { "internalType": "address", "name": "_dstToken", "type": "address" }, + { "internalType": "uint256", "name": "_amount", "type": "uint256" } + ], + "name": "getFees", + "outputs": [ + { "internalType": "uint256", "name": "rebalanceFee", "type": "uint256" }, + { "internalType": "uint256", "name": "protocolFee", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint16", "name": "_dstChainId", "type": "uint16" }, + { "internalType": "address", "name": "_dstToken", "type": "address" }, + { "internalType": "uint256", "name": "_amount", "type": "uint256" } + ], + "name": "getRebalanceReward", + "outputs": [ + { + "internalType": "uint256", + "name": "rebalanceReward", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "layerZeroEndpoint", + "outputs": [ + { + "internalType": "contract ILayerZeroEndpoint", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint16", "name": "_srcChainId", "type": "uint16" }, + { "internalType": "bytes", "name": "_srcAddress", "type": "bytes" }, + { "internalType": "uint64", "name": "", "type": "uint64" }, + { "internalType": "bytes", "name": "_payload", "type": "bytes" } + ], + "name": "lzReceive", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "", "type": "address" }, + { "internalType": "uint256", "name": "", "type": "uint256" } + ], + "name": "pendingTransactions", + "outputs": [ + { "internalType": "uint8", "name": "txType", "type": "uint8" }, + { "internalType": "uint16", "name": "dstChainId", "type": "uint16" }, + { "internalType": "address", "name": "dstToken", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" }, + { "internalType": "bytes", "name": "from", "type": "bytes" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint8", "name": "_type", "type": "uint8" }, + { "internalType": "uint16", "name": "_dstChainId", "type": "uint16" }, + { "internalType": "address", "name": "_dstToken", "type": "address" }, + { "internalType": "bytes", "name": "_from", "type": "bytes" }, + { "internalType": "uint256", "name": "_nativeForDst", "type": "uint256" }, + { "internalType": "bytes", "name": "_addressOnDst", "type": "bytes" } + ], + "name": "quoteLayerZeroFee", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint16", "name": "_dstChainId", "type": "uint16" }, + { "internalType": "address", "name": "_dstToken", "type": "address" }, + { "internalType": "uint256", "name": "_amount", "type": "uint256" } + ], + "name": "removeLiquidityLocal", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint16", "name": "_dstChainId", "type": "uint16" }, + { "internalType": "address", "name": "_dstToken", "type": "address" }, + { "internalType": "uint256", "name": "_amount", "type": "uint256" }, + { "internalType": "uint256", "name": "_nativeForDst", "type": "uint256" }, + { "internalType": "bytes", "name": "_addressOnDst", "type": "bytes" } + ], + "name": "removeLiquidityRemote", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "_Id", "type": "uint256" }], + "name": "revokePendingTransaction", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint16", "name": "_version", "type": "uint16" }, + { "internalType": "uint16", "name": "_chainId", "type": "uint16" }, + { "internalType": "uint256", "name": "_configType", "type": "uint256" }, + { "internalType": "bytes", "name": "_config", "type": "bytes" } + ], + "name": "setConfig", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_newFeeContract", + "type": "address" + } + ], + "name": "setFeeContract", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "_feeTo", "type": "address" } + ], + "name": "setFeeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint16", "name": "_dstChainId", "type": "uint16" }, + { "internalType": "uint8", "name": "_functionType", "type": "uint8" }, + { "internalType": "uint256", "name": "_gasAmount", "type": "uint256" } + ], + "name": "setGasAmount", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint16", "name": "version", "type": "uint16" } + ], + "name": "setReceiveVersion", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint16", "name": "version", "type": "uint16" } + ], + "name": "setSendVersion", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint16", "name": "_dstChainId", "type": "uint16" }, + { + "internalType": "bytes", + "name": "_dstAltitudeAddress", + "type": "bytes" + } + ], + "name": "setTrustedRemoteLookup", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint16", "name": "_dstChainId", "type": "uint16" }, + { "internalType": "address", "name": "_dstToken", "type": "address" }, + { "internalType": "uint256", "name": "_amount", "type": "uint256" }, + { "internalType": "uint256", "name": "_nativeForDst", "type": "uint256" }, + { "internalType": "bytes", "name": "_addressOnDst", "type": "bytes" } + ], + "name": "swap", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "newOwner", "type": "address" } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint16", "name": "", "type": "uint16" }], + "name": "trustedRemoteLookup", + "outputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "_user", "type": "address" } + ], + "name": "viewPendingTx", + "outputs": [ + { + "components": [ + { "internalType": "uint8", "name": "txType", "type": "uint8" }, + { "internalType": "uint16", "name": "dstChainId", "type": "uint16" }, + { "internalType": "address", "name": "dstToken", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" }, + { "internalType": "bytes", "name": "from", "type": "bytes" } + ], + "internalType": "struct Altitude.PendingTx[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint16", "name": "_dstChainId", "type": "uint16" }, + { "internalType": "address", "name": "_dstToken", "type": "address" }, + { "internalType": "uint256", "name": "_amount", "type": "uint256" }, + { "internalType": "address", "name": "_to", "type": "address" } + ], + "name": "withdrawRewardPool", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { "stateMutability": "payable", "type": "receive" } +] diff --git a/projects/altitude/index.js b/projects/altitude/index.js new file mode 100644 index 00000000000..0bc26a94837 --- /dev/null +++ b/projects/altitude/index.js @@ -0,0 +1,69 @@ +const abi = require("./abi.json"); + +const CHAINS = { + ethereum: "0xF80E51AFb613D764FA61751Affd3313C190A86BB", + bsc: "0xF80E51AFb613D764FA61751Affd3313C190A86BB", + polygon: "0xF80E51AFb613D764FA61751Affd3313C190A86BB", + arbitrum: "0xF80E51AFb613D764FA61751Affd3313C190A86BB", + avax: "0xF80E51AFb613D764FA61751Affd3313C190A86BB", + optimism: "0xF80E51AFb613D764FA61751Affd3313C190A86BB", + fantom: "0xF80E51AFb613D764FA61751Affd3313C190A86BB" +}; + +const BLOCK_NUMBERS = { + ethereum: 17641746, + bsc: 29753860, + polygon: 44790231, + arbitrum: 108765120, + avax: 32293273, + optimism: 106566230, + fantom: 65647962 +}; + +const PATH_COUNT = { + ethereum: 14, + bsc: 2, + polygon: 3, + arbitrum: 4, + avax: 2, + optimism: 2, + fantom: 1 +}; + +const chainPathsABI = abi.find(item => item.name === "chainPaths"); + +async function getTvlForChain(chain, contractAddress, { api }) { + let chainTvl = {}; + for (let i = 0; i < PATH_COUNT[chain]; i++) { + const result = await api.call({ + abi: chainPathsABI, + target: contractAddress, + params: [i], + block: BLOCK_NUMBERS[chain], + chain, + skipCache: true + }); + const tokenAddress = result[1]; + const balance = result[5]; + if (!chainTvl[tokenAddress]) { + chainTvl[tokenAddress] = BigInt(balance); + } else { + chainTvl[tokenAddress] += BigInt(balance); + } + } + return chainTvl; +} + +const exportedObject = { + methodology: + "Fetches the localLiquidity of each token in the Altitude contract across multiple chains and computes the TVL." +}; + +for (const chain of Object.keys(CHAINS)) { + exportedObject[chain] = { + tvl: async (timestamp, block, chainBlocks, { api }) => + await getTvlForChain(chain, CHAINS[chain], { api }) + }; +} + +module.exports = exportedObject; From 9617f5c6fb67959259487fa0e7322d24f3ef582a Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Sun, 27 Aug 2023 20:27:13 +0200 Subject: [PATCH 0990/1974] rely on r2 cache --- projects/helper/cache.js | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/projects/helper/cache.js b/projects/helper/cache.js index 4bf3560a09a..3d91c7eb63c 100644 --- a/projects/helper/cache.js +++ b/projects/helper/cache.js @@ -8,38 +8,40 @@ function getKey(project, chain) { return `cache/${project}/${chain}.json` } +function getFileKey(project, chain) { + return `${Bucket}/${getKey(project, chain)}` +} + function getLink(project, chain) { return `https://${Bucket}.s3.eu-central-1.amazonaws.com/${getKey(project, chain)}` } async function getCache(project, chain, { _ } = {}) { const Key = getKey(project, chain) + const fileKey = getFileKey(project, chain) try { - const { data: json } = await axios.get(getLink(project, chain)) + const json = await sdk.cache.readCache(fileKey) + if (!json || Object.keys(json).length === 0) throw new Error('Invalid data') return json } catch (e) { - sdk.log('failed to fetch data from s3 bucket:', Key) - // sdk.log(e) - return {} + try { + const { data: json } = await axios.get(getLink(project, chain)) + await sdk.cache.writeCache(fileKey, json) + return json + } catch (e) { + sdk.log('failed to fetch data from s3 bucket:', Key) + // sdk.log(e) + return {} + } } } -async function setCache(project, chain, cache, { - ContentType = 'application/json', - ACL = 'public-read' -} = {}) { - +async function setCache(project, chain, cache) { const Key = getKey(project, chain) try { - await new aws.S3() - .upload({ - Bucket, Key, - Body: JSON.stringify(cache), - ACL, ContentType, - }).promise(); - + await sdk.cache.writeCache(getFileKey(project, chain), cache) } catch (e) { sdk.log('failed to write data to s3 bucket: ', Key) // sdk.log(e) From 91a9b374ce7ce93b8c28cbed997d0132e7753e2c Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Sun, 27 Aug 2023 20:50:17 +0200 Subject: [PATCH 0991/1974] temporarily break harvest --- projects/harvest.js | 8 +++++++- projects/harvest/api.js | 6 ++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/projects/harvest.js b/projects/harvest.js index 1b837eb852c..d2fe771dd49 100644 --- a/projects/harvest.js +++ b/projects/harvest.js @@ -29,4 +29,10 @@ Object.keys(chains).forEach(chain => { return { tether: tvl } } } -}) \ No newline at end of file +}) + +module.exports.ethereum = { + tvl: () => { + throw new Error('Method not implemented') + } +} \ No newline at end of file diff --git a/projects/harvest/api.js b/projects/harvest/api.js index f37db4d8155..ed865971c45 100644 --- a/projects/harvest/api.js +++ b/projects/harvest/api.js @@ -7,3 +7,9 @@ module.exports = { misrepresentedTokens: true, ...getExports("harvest", chainKeys), } + +module.exports.ethereum = { + tvl: () => { + throw new Error('Method not implemented') + } +} \ No newline at end of file From 468bc872920a360605bfa1e5ba2082a60a8d1dba Mon Sep 17 00:00:00 2001 From: Michalis Kargakis Date: Mon, 28 Aug 2023 00:01:10 +0300 Subject: [PATCH 0992/1974] Add Tribe hallmark (#7290) https://twitter.com/Tribe3Official/status/1694621185714311310 --- projects/tribe3/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/tribe3/index.js b/projects/tribe3/index.js index ef871bd6ded..03121b7b6ff 100644 --- a/projects/tribe3/index.js +++ b/projects/tribe3/index.js @@ -12,4 +12,7 @@ module.exports = { ] }) }, + hallmarks: [ + [1692835200, "v1 shutdown"], + ], }; From d6316f009e9bb2f783bf43c47e18e4d63c73f8dd Mon Sep 17 00:00:00 2001 From: Strategic Reserve Date: Sun, 27 Aug 2023 14:04:29 -0700 Subject: [PATCH 0993/1974] Add BASE support (#7291) --- projects/visor/index.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/projects/visor/index.js b/projects/visor/index.js index 0162d4b9f3c..505dfbedd0a 100644 --- a/projects/visor/index.js +++ b/projects/visor/index.js @@ -67,6 +67,9 @@ const HYPE_REGISTRY = { linea: [ "0xc27ddd78fc49875fe6f844b72bbf31dfbb099881", // Lynex ], + base: [ + "0x1E86A593E55215957C4755f1BE19a229AF3286f6", // SynthSwap + ], }; /* List of bad addresses added to registries that need to be excluded manually */ @@ -191,4 +194,7 @@ module.exports = { linea: { tvl: tvlWrapper, }, + base: { + tvl: tvlWrapper, + }, }; From cc4eec4a57507c62697f39f0ef7680d6d70a72ad Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 28 Aug 2023 10:10:19 +0200 Subject: [PATCH 0994/1974] update stellaxyz --- package-lock.json | 2846 ++++++++++++++++++++++++++++++-- projects/stellaxyz-io/index.js | 33 +- 2 files changed, 2722 insertions(+), 157 deletions(-) diff --git a/package-lock.json b/package-lock.json index c0f80871d0c..400b4081291 100644 --- a/package-lock.json +++ b/package-lock.json @@ -39,6 +39,728 @@ "ts-node": "^10.8.1" } }, + "node_modules/@aws-crypto/crc32": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@aws-crypto/crc32/-/crc32-3.0.0.tgz", + "integrity": "sha512-IzSgsrxUcsrejQbPVilIKy16kAT52EwB6zSaI+M3xxIhKh5+aldEyvI+z6erM7TCLB2BJsFrtHjp6/4/sr+3dA==", + "dependencies": { + "@aws-crypto/util": "^3.0.0", + "@aws-sdk/types": "^3.222.0", + "tslib": "^1.11.1" + } + }, + "node_modules/@aws-crypto/crc32/node_modules/tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" + }, + "node_modules/@aws-crypto/crc32c": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@aws-crypto/crc32c/-/crc32c-3.0.0.tgz", + "integrity": "sha512-ENNPPManmnVJ4BTXlOjAgD7URidbAznURqD0KvfREyc4o20DPYdEldU1f5cQ7Jbj0CJJSPaMIk/9ZshdB3210w==", + "dependencies": { + "@aws-crypto/util": "^3.0.0", + "@aws-sdk/types": "^3.222.0", + "tslib": "^1.11.1" + } + }, + "node_modules/@aws-crypto/crc32c/node_modules/tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" + }, + "node_modules/@aws-crypto/ie11-detection": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@aws-crypto/ie11-detection/-/ie11-detection-3.0.0.tgz", + "integrity": "sha512-341lBBkiY1DfDNKai/wXM3aujNBkXR7tq1URPQDL9wi3AUbI80NR74uF1TXHMm7po1AcnFk8iu2S2IeU/+/A+Q==", + "dependencies": { + "tslib": "^1.11.1" + } + }, + "node_modules/@aws-crypto/ie11-detection/node_modules/tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" + }, + "node_modules/@aws-crypto/sha1-browser": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@aws-crypto/sha1-browser/-/sha1-browser-3.0.0.tgz", + "integrity": "sha512-NJth5c997GLHs6nOYTzFKTbYdMNA6/1XlKVgnZoaZcQ7z7UJlOgj2JdbHE8tiYLS3fzXNCguct77SPGat2raSw==", + "dependencies": { + "@aws-crypto/ie11-detection": "^3.0.0", + "@aws-crypto/supports-web-crypto": "^3.0.0", + "@aws-crypto/util": "^3.0.0", + "@aws-sdk/types": "^3.222.0", + "@aws-sdk/util-locate-window": "^3.0.0", + "@aws-sdk/util-utf8-browser": "^3.0.0", + "tslib": "^1.11.1" + } + }, + "node_modules/@aws-crypto/sha1-browser/node_modules/tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" + }, + "node_modules/@aws-crypto/sha256-browser": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@aws-crypto/sha256-browser/-/sha256-browser-3.0.0.tgz", + "integrity": "sha512-8VLmW2B+gjFbU5uMeqtQM6Nj0/F1bro80xQXCW6CQBWgosFWXTx77aeOF5CAIAmbOK64SdMBJdNr6J41yP5mvQ==", + "dependencies": { + "@aws-crypto/ie11-detection": "^3.0.0", + "@aws-crypto/sha256-js": "^3.0.0", + "@aws-crypto/supports-web-crypto": "^3.0.0", + "@aws-crypto/util": "^3.0.0", + "@aws-sdk/types": "^3.222.0", + "@aws-sdk/util-locate-window": "^3.0.0", + "@aws-sdk/util-utf8-browser": "^3.0.0", + "tslib": "^1.11.1" + } + }, + "node_modules/@aws-crypto/sha256-browser/node_modules/tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" + }, + "node_modules/@aws-crypto/sha256-js": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@aws-crypto/sha256-js/-/sha256-js-3.0.0.tgz", + "integrity": "sha512-PnNN7os0+yd1XvXAy23CFOmTbMaDxgxXtTKHybrJ39Y8kGzBATgBFibWJKH6BhytLI/Zyszs87xCOBNyBig6vQ==", + "dependencies": { + "@aws-crypto/util": "^3.0.0", + "@aws-sdk/types": "^3.222.0", + "tslib": "^1.11.1" + } + }, + "node_modules/@aws-crypto/sha256-js/node_modules/tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" + }, + "node_modules/@aws-crypto/supports-web-crypto": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@aws-crypto/supports-web-crypto/-/supports-web-crypto-3.0.0.tgz", + "integrity": "sha512-06hBdMwUAb2WFTuGG73LSC0wfPu93xWwo5vL2et9eymgmu3Id5vFAHBbajVWiGhPO37qcsdCap/FqXvJGJWPIg==", + "dependencies": { + "tslib": "^1.11.1" + } + }, + "node_modules/@aws-crypto/supports-web-crypto/node_modules/tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" + }, + "node_modules/@aws-crypto/util": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@aws-crypto/util/-/util-3.0.0.tgz", + "integrity": "sha512-2OJlpeJpCR48CC8r+uKVChzs9Iungj9wkZrl8Z041DWEWvyIHILYKCPNzJghKsivj+S3mLo6BVc7mBNzdxA46w==", + "dependencies": { + "@aws-sdk/types": "^3.222.0", + "@aws-sdk/util-utf8-browser": "^3.0.0", + "tslib": "^1.11.1" + } + }, + "node_modules/@aws-crypto/util/node_modules/tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" + }, + "node_modules/@aws-sdk/client-s3": { + "version": "3.400.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-s3/-/client-s3-3.400.0.tgz", + "integrity": "sha512-lnv0pb79Czl8fCMs/z7yM56LvoKTri1I4jX/V33trHMFKPQDoy8i24wxG8+TZl3MUmnUyoQS7tlukh7IFkii1Q==", + "dependencies": { + "@aws-crypto/sha1-browser": "3.0.0", + "@aws-crypto/sha256-browser": "3.0.0", + "@aws-crypto/sha256-js": "3.0.0", + "@aws-sdk/client-sts": "3.398.0", + "@aws-sdk/credential-provider-node": "3.398.0", + "@aws-sdk/middleware-bucket-endpoint": "3.398.0", + "@aws-sdk/middleware-expect-continue": "3.398.0", + "@aws-sdk/middleware-flexible-checksums": "3.400.0", + "@aws-sdk/middleware-host-header": "3.398.0", + "@aws-sdk/middleware-location-constraint": "3.398.0", + "@aws-sdk/middleware-logger": "3.398.0", + "@aws-sdk/middleware-recursion-detection": "3.398.0", + "@aws-sdk/middleware-sdk-s3": "3.398.0", + "@aws-sdk/middleware-signing": "3.398.0", + "@aws-sdk/middleware-ssec": "3.398.0", + "@aws-sdk/middleware-user-agent": "3.398.0", + "@aws-sdk/signature-v4-multi-region": "3.398.0", + "@aws-sdk/types": "3.398.0", + "@aws-sdk/util-endpoints": "3.398.0", + "@aws-sdk/util-user-agent-browser": "3.398.0", + "@aws-sdk/util-user-agent-node": "3.398.0", + "@aws-sdk/xml-builder": "3.310.0", + "@smithy/config-resolver": "^2.0.5", + "@smithy/eventstream-serde-browser": "^2.0.5", + "@smithy/eventstream-serde-config-resolver": "^2.0.5", + "@smithy/eventstream-serde-node": "^2.0.5", + "@smithy/fetch-http-handler": "^2.0.5", + "@smithy/hash-blob-browser": "^2.0.5", + "@smithy/hash-node": "^2.0.5", + "@smithy/hash-stream-node": "^2.0.5", + "@smithy/invalid-dependency": "^2.0.5", + "@smithy/md5-js": "^2.0.5", + "@smithy/middleware-content-length": "^2.0.5", + "@smithy/middleware-endpoint": "^2.0.5", + "@smithy/middleware-retry": "^2.0.5", + "@smithy/middleware-serde": "^2.0.5", + "@smithy/middleware-stack": "^2.0.0", + "@smithy/node-config-provider": "^2.0.5", + "@smithy/node-http-handler": "^2.0.5", + "@smithy/protocol-http": "^2.0.5", + "@smithy/smithy-client": "^2.0.5", + "@smithy/types": "^2.2.2", + "@smithy/url-parser": "^2.0.5", + "@smithy/util-base64": "^2.0.0", + "@smithy/util-body-length-browser": "^2.0.0", + "@smithy/util-body-length-node": "^2.1.0", + "@smithy/util-defaults-mode-browser": "^2.0.5", + "@smithy/util-defaults-mode-node": "^2.0.5", + "@smithy/util-retry": "^2.0.0", + "@smithy/util-stream": "^2.0.5", + "@smithy/util-utf8": "^2.0.0", + "@smithy/util-waiter": "^2.0.5", + "fast-xml-parser": "4.2.5", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@aws-sdk/client-sso": { + "version": "3.398.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-sso/-/client-sso-3.398.0.tgz", + "integrity": "sha512-CygL0jhfibw4kmWXG/3sfZMFNjcXo66XUuPC4BqZBk8Rj5vFoxp1vZeMkDLzTIk97Nvo5J5Bh+QnXKhub6AckQ==", + "dependencies": { + "@aws-crypto/sha256-browser": "3.0.0", + "@aws-crypto/sha256-js": "3.0.0", + "@aws-sdk/middleware-host-header": "3.398.0", + "@aws-sdk/middleware-logger": "3.398.0", + "@aws-sdk/middleware-recursion-detection": "3.398.0", + "@aws-sdk/middleware-user-agent": "3.398.0", + "@aws-sdk/types": "3.398.0", + "@aws-sdk/util-endpoints": "3.398.0", + "@aws-sdk/util-user-agent-browser": "3.398.0", + "@aws-sdk/util-user-agent-node": "3.398.0", + "@smithy/config-resolver": "^2.0.5", + "@smithy/fetch-http-handler": "^2.0.5", + "@smithy/hash-node": "^2.0.5", + "@smithy/invalid-dependency": "^2.0.5", + "@smithy/middleware-content-length": "^2.0.5", + "@smithy/middleware-endpoint": "^2.0.5", + "@smithy/middleware-retry": "^2.0.5", + "@smithy/middleware-serde": "^2.0.5", + "@smithy/middleware-stack": "^2.0.0", + "@smithy/node-config-provider": "^2.0.5", + "@smithy/node-http-handler": "^2.0.5", + "@smithy/protocol-http": "^2.0.5", + "@smithy/smithy-client": "^2.0.5", + "@smithy/types": "^2.2.2", + "@smithy/url-parser": "^2.0.5", + "@smithy/util-base64": "^2.0.0", + "@smithy/util-body-length-browser": "^2.0.0", + "@smithy/util-body-length-node": "^2.1.0", + "@smithy/util-defaults-mode-browser": "^2.0.5", + "@smithy/util-defaults-mode-node": "^2.0.5", + "@smithy/util-retry": "^2.0.0", + "@smithy/util-utf8": "^2.0.0", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@aws-sdk/client-sts": { + "version": "3.398.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-sts/-/client-sts-3.398.0.tgz", + "integrity": "sha512-/3Pa9wLMvBZipKraq3AtbmTfXW6q9kyvhwOno64f1Fz7kFb8ijQFMGoATS70B2pGEZTlxkUqJFWDiisT6Q6dFg==", + "dependencies": { + "@aws-crypto/sha256-browser": "3.0.0", + "@aws-crypto/sha256-js": "3.0.0", + "@aws-sdk/credential-provider-node": "3.398.0", + "@aws-sdk/middleware-host-header": "3.398.0", + "@aws-sdk/middleware-logger": "3.398.0", + "@aws-sdk/middleware-recursion-detection": "3.398.0", + "@aws-sdk/middleware-sdk-sts": "3.398.0", + "@aws-sdk/middleware-signing": "3.398.0", + "@aws-sdk/middleware-user-agent": "3.398.0", + "@aws-sdk/types": "3.398.0", + "@aws-sdk/util-endpoints": "3.398.0", + "@aws-sdk/util-user-agent-browser": "3.398.0", + "@aws-sdk/util-user-agent-node": "3.398.0", + "@smithy/config-resolver": "^2.0.5", + "@smithy/fetch-http-handler": "^2.0.5", + "@smithy/hash-node": "^2.0.5", + "@smithy/invalid-dependency": "^2.0.5", + "@smithy/middleware-content-length": "^2.0.5", + "@smithy/middleware-endpoint": "^2.0.5", + "@smithy/middleware-retry": "^2.0.5", + "@smithy/middleware-serde": "^2.0.5", + "@smithy/middleware-stack": "^2.0.0", + "@smithy/node-config-provider": "^2.0.5", + "@smithy/node-http-handler": "^2.0.5", + "@smithy/protocol-http": "^2.0.5", + "@smithy/smithy-client": "^2.0.5", + "@smithy/types": "^2.2.2", + "@smithy/url-parser": "^2.0.5", + "@smithy/util-base64": "^2.0.0", + "@smithy/util-body-length-browser": "^2.0.0", + "@smithy/util-body-length-node": "^2.1.0", + "@smithy/util-defaults-mode-browser": "^2.0.5", + "@smithy/util-defaults-mode-node": "^2.0.5", + "@smithy/util-retry": "^2.0.0", + "@smithy/util-utf8": "^2.0.0", + "fast-xml-parser": "4.2.5", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@aws-sdk/credential-provider-env": { + "version": "3.398.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-env/-/credential-provider-env-3.398.0.tgz", + "integrity": "sha512-Z8Yj5z7FroAsR6UVML+XUdlpoqEe9Dnle8c2h8/xWwIC2feTfIBhjLhRVxfbpbM1pLgBSNEcZ7U8fwq5l7ESVQ==", + "dependencies": { + "@aws-sdk/types": "3.398.0", + "@smithy/property-provider": "^2.0.0", + "@smithy/types": "^2.2.2", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@aws-sdk/credential-provider-ini": { + "version": "3.398.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-ini/-/credential-provider-ini-3.398.0.tgz", + "integrity": "sha512-AsK1lStK3nB9Cn6S6ODb1ktGh7SRejsNVQVKX3t5d3tgOaX+aX1Iwy8FzM/ZEN8uCloeRifUGIY9uQFygg5mSw==", + "dependencies": { + "@aws-sdk/credential-provider-env": "3.398.0", + "@aws-sdk/credential-provider-process": "3.398.0", + "@aws-sdk/credential-provider-sso": "3.398.0", + "@aws-sdk/credential-provider-web-identity": "3.398.0", + "@aws-sdk/types": "3.398.0", + "@smithy/credential-provider-imds": "^2.0.0", + "@smithy/property-provider": "^2.0.0", + "@smithy/shared-ini-file-loader": "^2.0.0", + "@smithy/types": "^2.2.2", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@aws-sdk/credential-provider-node": { + "version": "3.398.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-node/-/credential-provider-node-3.398.0.tgz", + "integrity": "sha512-odmI/DSKfuWUYeDnGTCEHBbC8/MwnF6yEq874zl6+owoVv0ZsYP8qBHfiJkYqrwg7wQ7Pi40sSAPC1rhesGwzg==", + "dependencies": { + "@aws-sdk/credential-provider-env": "3.398.0", + "@aws-sdk/credential-provider-ini": "3.398.0", + "@aws-sdk/credential-provider-process": "3.398.0", + "@aws-sdk/credential-provider-sso": "3.398.0", + "@aws-sdk/credential-provider-web-identity": "3.398.0", + "@aws-sdk/types": "3.398.0", + "@smithy/credential-provider-imds": "^2.0.0", + "@smithy/property-provider": "^2.0.0", + "@smithy/shared-ini-file-loader": "^2.0.0", + "@smithy/types": "^2.2.2", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@aws-sdk/credential-provider-process": { + "version": "3.398.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-process/-/credential-provider-process-3.398.0.tgz", + "integrity": "sha512-WrkBL1W7TXN508PA9wRXPFtzmGpVSW98gDaHEaa8GolAPHMPa5t2QcC/z/cFpglzrcVv8SA277zu9Z8tELdZhg==", + "dependencies": { + "@aws-sdk/types": "3.398.0", + "@smithy/property-provider": "^2.0.0", + "@smithy/shared-ini-file-loader": "^2.0.0", + "@smithy/types": "^2.2.2", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@aws-sdk/credential-provider-sso": { + "version": "3.398.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-sso/-/credential-provider-sso-3.398.0.tgz", + "integrity": "sha512-2Dl35587xbnzR/GGZqA2MnFs8+kS4wbHQO9BioU0okA+8NRueohNMdrdQmQDdSNK4BfIpFspiZmFkXFNyEAfgw==", + "dependencies": { + "@aws-sdk/client-sso": "3.398.0", + "@aws-sdk/token-providers": "3.398.0", + "@aws-sdk/types": "3.398.0", + "@smithy/property-provider": "^2.0.0", + "@smithy/shared-ini-file-loader": "^2.0.0", + "@smithy/types": "^2.2.2", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@aws-sdk/credential-provider-web-identity": { + "version": "3.398.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-web-identity/-/credential-provider-web-identity-3.398.0.tgz", + "integrity": "sha512-iG3905Alv9pINbQ8/MIsshgqYMbWx+NDQWpxbIW3W0MkSH3iAqdVpSCteYidYX9G/jv2Um1nW3y360ib20bvNg==", + "dependencies": { + "@aws-sdk/types": "3.398.0", + "@smithy/property-provider": "^2.0.0", + "@smithy/types": "^2.2.2", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@aws-sdk/middleware-bucket-endpoint": { + "version": "3.398.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-bucket-endpoint/-/middleware-bucket-endpoint-3.398.0.tgz", + "integrity": "sha512-+iDHiRofK/vIY94RWAXkSnR4rBPzc2dPHmLp+FDKywq1y708H9W7TOT37dpn+KSFeO4k2FfddFjzWBHsaeakCA==", + "dependencies": { + "@aws-sdk/types": "3.398.0", + "@aws-sdk/util-arn-parser": "3.310.0", + "@smithy/protocol-http": "^2.0.5", + "@smithy/types": "^2.2.2", + "@smithy/util-config-provider": "^2.0.0", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@aws-sdk/middleware-expect-continue": { + "version": "3.398.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-expect-continue/-/middleware-expect-continue-3.398.0.tgz", + "integrity": "sha512-d6he+Qqwh1yqml9duXSv5iKJ2lS0PVrF2UEsVew2GFxfUif0E/davTZJjvWtnelbuIGcTP+wDKVVjLwBN2sN/g==", + "dependencies": { + "@aws-sdk/types": "3.398.0", + "@smithy/protocol-http": "^2.0.5", + "@smithy/types": "^2.2.2", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@aws-sdk/middleware-flexible-checksums": { + "version": "3.400.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-flexible-checksums/-/middleware-flexible-checksums-3.400.0.tgz", + "integrity": "sha512-lpsumd5/G+eAMTr61h/cJQZ8+i+xzC6OG3bvUcbRHqcjN49XgeNLcPfYcr6Rzf0QHxmuCN4te/4XGU3Fif2YVA==", + "dependencies": { + "@aws-crypto/crc32": "3.0.0", + "@aws-crypto/crc32c": "3.0.0", + "@aws-sdk/types": "3.398.0", + "@smithy/is-array-buffer": "^2.0.0", + "@smithy/protocol-http": "^2.0.5", + "@smithy/types": "^2.2.2", + "@smithy/util-utf8": "^2.0.0", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@aws-sdk/middleware-host-header": { + "version": "3.398.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-host-header/-/middleware-host-header-3.398.0.tgz", + "integrity": "sha512-m+5laWdBaxIZK2ko0OwcCHJZJ5V1MgEIt8QVQ3k4/kOkN9ICjevOYmba751pHoTnbOYB7zQd6D2OT3EYEEsUcA==", + "dependencies": { + "@aws-sdk/types": "3.398.0", + "@smithy/protocol-http": "^2.0.5", + "@smithy/types": "^2.2.2", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@aws-sdk/middleware-location-constraint": { + "version": "3.398.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-location-constraint/-/middleware-location-constraint-3.398.0.tgz", + "integrity": "sha512-it+olJf1Lf2bmH8OL/N1jMOFB0zEVYs4rIzgFrluTRCuPatRuDi4LsXS8zqYxkBa05JE8JmqwW5gCzAmWyLLqw==", + "dependencies": { + "@aws-sdk/types": "3.398.0", + "@smithy/types": "^2.2.2", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@aws-sdk/middleware-logger": { + "version": "3.398.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-logger/-/middleware-logger-3.398.0.tgz", + "integrity": "sha512-CiJjW+FL12elS6Pn7/UVjVK8HWHhXMfvHZvOwx/Qkpy340sIhkuzOO6fZEruECDTZhl2Wqn81XdJ1ZQ4pRKpCg==", + "dependencies": { + "@aws-sdk/types": "3.398.0", + "@smithy/types": "^2.2.2", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@aws-sdk/middleware-recursion-detection": { + "version": "3.398.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-recursion-detection/-/middleware-recursion-detection-3.398.0.tgz", + "integrity": "sha512-7QpOqPQAZNXDXv6vsRex4R8dLniL0E/80OPK4PPFsrCh9btEyhN9Begh4i1T+5lL28hmYkztLOkTQ2N5J3hgRQ==", + "dependencies": { + "@aws-sdk/types": "3.398.0", + "@smithy/protocol-http": "^2.0.5", + "@smithy/types": "^2.2.2", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@aws-sdk/middleware-sdk-s3": { + "version": "3.398.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-sdk-s3/-/middleware-sdk-s3-3.398.0.tgz", + "integrity": "sha512-yweSMc/TyiFtqc52hFMKQJvTm3i1KCoW5mB3o/Sla6zsHBh+nS6TTaBmo+2kcDIR7AKODwW+FLCTHWiazb7J3Q==", + "dependencies": { + "@aws-sdk/types": "3.398.0", + "@aws-sdk/util-arn-parser": "3.310.0", + "@smithy/protocol-http": "^2.0.5", + "@smithy/types": "^2.2.2", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@aws-sdk/middleware-sdk-sts": { + "version": "3.398.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-sdk-sts/-/middleware-sdk-sts-3.398.0.tgz", + "integrity": "sha512-+JH76XHEgfVihkY+GurohOQ5Z83zVN1nYcQzwCFnCDTh4dG4KwhnZKG+WPw6XJECocY0R+H0ivofeALHvVWJtQ==", + "dependencies": { + "@aws-sdk/middleware-signing": "3.398.0", + "@aws-sdk/types": "3.398.0", + "@smithy/types": "^2.2.2", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@aws-sdk/middleware-signing": { + "version": "3.398.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-signing/-/middleware-signing-3.398.0.tgz", + "integrity": "sha512-O0KqXAix1TcvZBFt1qoFkHMUNJOSgjJTYS7lFTRKSwgsD27bdW2TM2r9R8DAccWFt5Amjkdt+eOwQMIXPGTm8w==", + "dependencies": { + "@aws-sdk/types": "3.398.0", + "@smithy/property-provider": "^2.0.0", + "@smithy/protocol-http": "^2.0.5", + "@smithy/signature-v4": "^2.0.0", + "@smithy/types": "^2.2.2", + "@smithy/util-middleware": "^2.0.0", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@aws-sdk/middleware-ssec": { + "version": "3.398.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-ssec/-/middleware-ssec-3.398.0.tgz", + "integrity": "sha512-QtKr/hPcRugKSIZAH4+7hbUfdW7Lg+OQvD25nJn7ic1JHRZ+eDctEFxdsmnt68lE6aZxOcHCWHAW6/umcA93Dw==", + "dependencies": { + "@aws-sdk/types": "3.398.0", + "@smithy/types": "^2.2.2", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@aws-sdk/middleware-user-agent": { + "version": "3.398.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-user-agent/-/middleware-user-agent-3.398.0.tgz", + "integrity": "sha512-nF1jg0L+18b5HvTcYzwyFgfZQQMELJINFqI0mi4yRKaX7T5a3aGp5RVLGGju/6tAGTuFbfBoEhkhU3kkxexPYQ==", + "dependencies": { + "@aws-sdk/types": "3.398.0", + "@aws-sdk/util-endpoints": "3.398.0", + "@smithy/protocol-http": "^2.0.5", + "@smithy/types": "^2.2.2", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@aws-sdk/signature-v4-multi-region": { + "version": "3.398.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/signature-v4-multi-region/-/signature-v4-multi-region-3.398.0.tgz", + "integrity": "sha512-8fTqTxRDWE03T7ClaWlCfbwuSae//01XMNVy2a9g5QgaelQh7ZZyU3ZIJiV8gIj8v6ZM0NGn9Bz1liI/vmNmcw==", + "dependencies": { + "@aws-sdk/types": "3.398.0", + "@smithy/protocol-http": "^2.0.5", + "@smithy/signature-v4": "^2.0.0", + "@smithy/types": "^2.2.2", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "@aws-sdk/signature-v4-crt": "^3.118.0" + }, + "peerDependenciesMeta": { + "@aws-sdk/signature-v4-crt": { + "optional": true + } + } + }, + "node_modules/@aws-sdk/token-providers": { + "version": "3.398.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/token-providers/-/token-providers-3.398.0.tgz", + "integrity": "sha512-nrYgjzavGCKJL/48Vt0EL+OlIc5UZLfNGpgyUW9cv3XZwl+kXV0QB+HH0rHZZLfpbBgZ2RBIJR9uD5ieu/6hpQ==", + "dependencies": { + "@aws-crypto/sha256-browser": "3.0.0", + "@aws-crypto/sha256-js": "3.0.0", + "@aws-sdk/middleware-host-header": "3.398.0", + "@aws-sdk/middleware-logger": "3.398.0", + "@aws-sdk/middleware-recursion-detection": "3.398.0", + "@aws-sdk/middleware-user-agent": "3.398.0", + "@aws-sdk/types": "3.398.0", + "@aws-sdk/util-endpoints": "3.398.0", + "@aws-sdk/util-user-agent-browser": "3.398.0", + "@aws-sdk/util-user-agent-node": "3.398.0", + "@smithy/config-resolver": "^2.0.5", + "@smithy/fetch-http-handler": "^2.0.5", + "@smithy/hash-node": "^2.0.5", + "@smithy/invalid-dependency": "^2.0.5", + "@smithy/middleware-content-length": "^2.0.5", + "@smithy/middleware-endpoint": "^2.0.5", + "@smithy/middleware-retry": "^2.0.5", + "@smithy/middleware-serde": "^2.0.5", + "@smithy/middleware-stack": "^2.0.0", + "@smithy/node-config-provider": "^2.0.5", + "@smithy/node-http-handler": "^2.0.5", + "@smithy/property-provider": "^2.0.0", + "@smithy/protocol-http": "^2.0.5", + "@smithy/shared-ini-file-loader": "^2.0.0", + "@smithy/smithy-client": "^2.0.5", + "@smithy/types": "^2.2.2", + "@smithy/url-parser": "^2.0.5", + "@smithy/util-base64": "^2.0.0", + "@smithy/util-body-length-browser": "^2.0.0", + "@smithy/util-body-length-node": "^2.1.0", + "@smithy/util-defaults-mode-browser": "^2.0.5", + "@smithy/util-defaults-mode-node": "^2.0.5", + "@smithy/util-retry": "^2.0.0", + "@smithy/util-utf8": "^2.0.0", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@aws-sdk/types": { + "version": "3.398.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/types/-/types-3.398.0.tgz", + "integrity": "sha512-r44fkS+vsEgKCuEuTV+TIk0t0m5ZlXHNjSDYEUvzLStbbfUFiNus/YG4UCa0wOk9R7VuQI67badsvvPeVPCGDQ==", + "dependencies": { + "@smithy/types": "^2.2.2", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@aws-sdk/util-arn-parser": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-arn-parser/-/util-arn-parser-3.310.0.tgz", + "integrity": "sha512-jL8509owp/xB9+Or0pvn3Fe+b94qfklc2yPowZZIFAkFcCSIdkIglz18cPDWnYAcy9JGewpMS1COXKIUhZkJsA==", + "dependencies": { + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@aws-sdk/util-endpoints": { + "version": "3.398.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-endpoints/-/util-endpoints-3.398.0.tgz", + "integrity": "sha512-Fy0gLYAei/Rd6BrXG4baspCnWTUSd0NdokU1pZh4KlfEAEN1i8SPPgfiO5hLk7+2inqtCmqxVJlfqbMVe9k4bw==", + "dependencies": { + "@aws-sdk/types": "3.398.0", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@aws-sdk/util-locate-window": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-locate-window/-/util-locate-window-3.310.0.tgz", + "integrity": "sha512-qo2t/vBTnoXpjKxlsC2e1gBrRm80M3bId27r0BRB2VniSSe7bL1mmzM+/HFtujm0iAxtPM+aLEflLJlJeDPg0w==", + "dependencies": { + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@aws-sdk/util-user-agent-browser": { + "version": "3.398.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-user-agent-browser/-/util-user-agent-browser-3.398.0.tgz", + "integrity": "sha512-A3Tzx1tkDHlBT+IgxmsMCHbV8LM7SwwCozq2ZjJRx0nqw3MCrrcxQFXldHeX/gdUMO+0Oocb7HGSnVODTq+0EA==", + "dependencies": { + "@aws-sdk/types": "3.398.0", + "@smithy/types": "^2.2.2", + "bowser": "^2.11.0", + "tslib": "^2.5.0" + } + }, + "node_modules/@aws-sdk/util-user-agent-node": { + "version": "3.398.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-user-agent-node/-/util-user-agent-node-3.398.0.tgz", + "integrity": "sha512-RTVQofdj961ej4//fEkppFf4KXqKGMTCqJYghx3G0C/MYXbg7MGl7LjfNGtJcboRE8pfHHQ/TUWBDA7RIAPPlQ==", + "dependencies": { + "@aws-sdk/types": "3.398.0", + "@smithy/node-config-provider": "^2.0.5", + "@smithy/types": "^2.2.2", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "aws-crt": ">=1.0.0" + }, + "peerDependenciesMeta": { + "aws-crt": { + "optional": true + } + } + }, + "node_modules/@aws-sdk/util-utf8-browser": { + "version": "3.259.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-utf8-browser/-/util-utf8-browser-3.259.0.tgz", + "integrity": "sha512-UvFa/vR+e19XookZF8RzFZBrw2EUkQWxiBW0yYQAhvk3C+QVGl0H3ouca8LDBlBfQKXwmW3huo/59H8rwb1wJw==", + "dependencies": { + "tslib": "^2.3.1" + } + }, + "node_modules/@aws-sdk/xml-builder": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/xml-builder/-/xml-builder-3.310.0.tgz", + "integrity": "sha512-TqELu4mOuSIKQCqj63fGVs86Yh+vBx5nHRpWKNUNhB2nPTpfbziTs5c1X358be3peVWA4wPxW7Nt53KIg1tnNw==", + "dependencies": { + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, "node_modules/@babel/runtime": { "version": "7.20.7", "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.20.7.tgz", @@ -63,13 +785,16 @@ } }, "node_modules/@defillama/sdk": { - "version": "4.0.47", - "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.47.tgz", - "integrity": "sha512-Uarp7y5WJHlEARc6YI2RdwCftxa5ytLafxkKTbafnacQ/xshdqku15glnxm+xxV24ED6w9RBhOvcPBEn/h6SZQ==", + "version": "4.0.50", + "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.50.tgz", + "integrity": "sha512-cjn6zWCQ+NOgMgtJErD59Aj+r+ukGVCgqT3353P6ylosXrIEMfySdjxcaW7xIwhoT1WxiMbQau492ycWXH7YEg==", "dependencies": { + "@aws-sdk/client-s3": "^3.400.0", "@supercharge/promise-pool": "^2.1.0", "ethers": "^5.4.5", + "lzma-native": "^8.0.6", "node-fetch": "^2.6.7", + "p-limit": "^3.0.0", "tron-format-address": "^0.1.11" } }, @@ -1025,125 +1750,724 @@ "toml": "^3.0.0" }, "engines": { - "node": ">=11" + "node": ">=11" + } + }, + "node_modules/@project-serum/borsh": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/@project-serum/borsh/-/borsh-0.2.5.tgz", + "integrity": "sha512-UmeUkUoKdQ7rhx6Leve1SssMR/Ghv8qrEiyywyxSWg7ooV7StdpPBhciiy5eB3T0qU1BXvdRNC8TdrkxK7WC5Q==", + "dependencies": { + "bn.js": "^5.1.2", + "buffer-layout": "^1.2.0" + }, + "engines": { + "node": ">=10" + }, + "peerDependencies": { + "@solana/web3.js": "^1.2.0" + } + }, + "node_modules/@project-serum/serum": { + "version": "0.13.65", + "resolved": "https://registry.npmjs.org/@project-serum/serum/-/serum-0.13.65.tgz", + "integrity": "sha512-BHRqsTqPSfFB5p+MgI2pjvMBAQtO8ibTK2fYY96boIFkCI3TTwXDt2gUmspeChKO2pqHr5aKevmexzAcXxrSRA==", + "dependencies": { + "@project-serum/anchor": "^0.11.1", + "@solana/spl-token": "^0.1.6", + "@solana/web3.js": "^1.21.0", + "bn.js": "^5.1.2", + "buffer-layout": "^1.2.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@project-serum/serum/node_modules/@project-serum/anchor": { + "version": "0.11.1", + "resolved": "https://registry.npmjs.org/@project-serum/anchor/-/anchor-0.11.1.tgz", + "integrity": "sha512-oIdm4vTJkUy6GmE6JgqDAuQPKI7XM4TPJkjtoIzp69RZe0iAD9JP2XHx7lV1jLdYXeYHqDXfBt3zcq7W91K6PA==", + "dependencies": { + "@project-serum/borsh": "^0.2.2", + "@solana/web3.js": "^1.17.0", + "base64-js": "^1.5.1", + "bn.js": "^5.1.2", + "bs58": "^4.0.1", + "buffer-layout": "^1.2.0", + "camelcase": "^5.3.1", + "crypto-hash": "^1.3.0", + "eventemitter3": "^4.0.7", + "find": "^0.3.0", + "js-sha256": "^0.9.0", + "pako": "^2.0.3", + "snake-case": "^3.0.4", + "toml": "^3.0.0" + }, + "engines": { + "node": ">=11" + } + }, + "node_modules/@pythnetwork/client": { + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/@pythnetwork/client/-/client-2.8.0.tgz", + "integrity": "sha512-YqqZSDDsEApC/F4H5ejcl8OCr7gsWv0noTK8YABT8pCtFRTQxXBP0r2S8KQMaIw1x97Mue/jkYybdMeFQzPjCw==", + "dependencies": { + "buffer": "^6.0.1" + }, + "peerDependencies": { + "@solana/web3.js": "^1.30.2" + } + }, + "node_modules/@scure/base": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.1.tgz", + "integrity": "sha512-ZxOhsSyxYwLJj3pLZCefNitxsj093tb2vq90mp2txoYeBqbcjDjqFhyM8eUjq/uFm6zJ+mUuqxlS2FkuSY1MTA==", + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ] + }, + "node_modules/@scure/bip32": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.1.0.tgz", + "integrity": "sha512-ftTW3kKX54YXLCxH6BB7oEEoJfoE2pIgw7MINKAs5PsS6nqKPuKk1haTF/EuHmYqG330t5GSrdmtRuHaY1a62Q==", + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ], + "dependencies": { + "@noble/hashes": "~1.1.1", + "@noble/secp256k1": "~1.6.0", + "@scure/base": "~1.1.0" + } + }, + "node_modules/@scure/bip32/node_modules/@noble/secp256k1": { + "version": "1.6.3", + "resolved": "https://registry.npmjs.org/@noble/secp256k1/-/secp256k1-1.6.3.tgz", + "integrity": "sha512-T04e4iTurVy7I8Sw4+c5OSN9/RkPlo1uKxAomtxQNLq8j1uPAqnsqG1bqvY3Jv7c13gyr6dui0zmh/I3+f/JaQ==", + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ] + }, + "node_modules/@scure/bip39": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.1.0.tgz", + "integrity": "sha512-pwrPOS16VeTKg98dYXQyIjJEcWfz7/1YJIwxUEPFfQPtc86Ym/1sVgQ2RLoD43AazMk2l/unK4ITySSpW2+82w==", + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ], + "dependencies": { + "@noble/hashes": "~1.1.1", + "@scure/base": "~1.1.0" + } + }, + "node_modules/@smithy/abort-controller": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@smithy/abort-controller/-/abort-controller-2.0.5.tgz", + "integrity": "sha512-byVZ2KWLMPYAZGKjRpniAzLcygJO4ruClZKdJTuB0eCB76ONFTdptBHlviHpAZXknRz7skYWPfcgO9v30A1SyA==", + "dependencies": { + "@smithy/types": "^2.2.2", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@smithy/chunked-blob-reader": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@smithy/chunked-blob-reader/-/chunked-blob-reader-2.0.0.tgz", + "integrity": "sha512-k+J4GHJsMSAIQPChGBrjEmGS+WbPonCXesoqP9fynIqjn7rdOThdH8FAeCmokP9mxTYKQAKoHCLPzNlm6gh7Wg==", + "dependencies": { + "tslib": "^2.5.0" + } + }, + "node_modules/@smithy/chunked-blob-reader-native": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@smithy/chunked-blob-reader-native/-/chunked-blob-reader-native-2.0.0.tgz", + "integrity": "sha512-HM8V2Rp1y8+1343tkZUKZllFhEQPNmpNdgFAncbTsxkZ18/gqjk23XXv3qGyXWp412f3o43ZZ1UZHVcHrpRnCQ==", + "dependencies": { + "@smithy/util-base64": "^2.0.0", + "tslib": "^2.5.0" + } + }, + "node_modules/@smithy/config-resolver": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@smithy/config-resolver/-/config-resolver-2.0.5.tgz", + "integrity": "sha512-n0c2AXz+kjALY2FQr7Zy9zhYigXzboIh1AuUUVCqFBKFtdEvTwnwPXrTDoEehLiRTUHNL+4yzZ3s+D0kKYSLSg==", + "dependencies": { + "@smithy/types": "^2.2.2", + "@smithy/util-config-provider": "^2.0.0", + "@smithy/util-middleware": "^2.0.0", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@smithy/credential-provider-imds": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@smithy/credential-provider-imds/-/credential-provider-imds-2.0.5.tgz", + "integrity": "sha512-KFcf/e0meFkQNyteJ65f1G19sgUEY1e5zL7hyAEUPz2SEfBmC9B37WyRq87G3MEEsvmAWwCRu7nFFYUKtR3svQ==", + "dependencies": { + "@smithy/node-config-provider": "^2.0.5", + "@smithy/property-provider": "^2.0.5", + "@smithy/types": "^2.2.2", + "@smithy/url-parser": "^2.0.5", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@smithy/eventstream-codec": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@smithy/eventstream-codec/-/eventstream-codec-2.0.5.tgz", + "integrity": "sha512-iqR6OuOV3zbQK8uVs9o+9AxhVk8kW9NAxA71nugwUB+kTY9C35pUd0A5/m4PRT0Y0oIW7W4kgnSR3fdYXQjECw==", + "dependencies": { + "@aws-crypto/crc32": "3.0.0", + "@smithy/types": "^2.2.2", + "@smithy/util-hex-encoding": "^2.0.0", + "tslib": "^2.5.0" + } + }, + "node_modules/@smithy/eventstream-serde-browser": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@smithy/eventstream-serde-browser/-/eventstream-serde-browser-2.0.5.tgz", + "integrity": "sha512-8NU51y94qFJbxL6SmvgWDfITHO/svvbAigkLYk2pckX17TGCSf4EXuGpGLliJp5Ljh5+vASC7mUH2jYX7MWBxA==", + "dependencies": { + "@smithy/eventstream-serde-universal": "^2.0.5", + "@smithy/types": "^2.2.2", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@smithy/eventstream-serde-config-resolver": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@smithy/eventstream-serde-config-resolver/-/eventstream-serde-config-resolver-2.0.5.tgz", + "integrity": "sha512-u3gvukRaTH4X6tsryuZ4T1WGIEP34fPaTTzphFDJe8GJz/k11oBW1MPnkcaucBMxLnObK9swCF85j5cp1Kj1oA==", + "dependencies": { + "@smithy/types": "^2.2.2", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@smithy/eventstream-serde-node": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@smithy/eventstream-serde-node/-/eventstream-serde-node-2.0.5.tgz", + "integrity": "sha512-/C8jb+k/vKUBIe80D30vzjvRXlJf76kG2AJY7/NwiqWuD2usRuuDFCDaswXdVsSh9P1+FeaxZ48chsK10yDryQ==", + "dependencies": { + "@smithy/eventstream-serde-universal": "^2.0.5", + "@smithy/types": "^2.2.2", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@smithy/eventstream-serde-universal": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@smithy/eventstream-serde-universal/-/eventstream-serde-universal-2.0.5.tgz", + "integrity": "sha512-+vHvbQtlSVYTQ/20tNpVaKi0EpTR7E8GoEUHJypRZIRgiT03b3h2MAWk+SNaqMrCJrYG9vKLkJFzDylRlUvDWg==", + "dependencies": { + "@smithy/eventstream-codec": "^2.0.5", + "@smithy/types": "^2.2.2", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@smithy/fetch-http-handler": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@smithy/fetch-http-handler/-/fetch-http-handler-2.0.5.tgz", + "integrity": "sha512-EzFoMowdBNy1VqtvkiXgPFEdosIAt4/4bgZ8uiDiUyfhmNXq/3bV+CagPFFBsgFOR/X2XK4zFZHRsoa7PNHVVg==", + "dependencies": { + "@smithy/protocol-http": "^2.0.5", + "@smithy/querystring-builder": "^2.0.5", + "@smithy/types": "^2.2.2", + "@smithy/util-base64": "^2.0.0", + "tslib": "^2.5.0" + } + }, + "node_modules/@smithy/hash-blob-browser": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@smithy/hash-blob-browser/-/hash-blob-browser-2.0.5.tgz", + "integrity": "sha512-ZVAUBtJXGf9bEko4/RwWcTK6d3b/ZmQMxJMrxOOcQhVDiqny9zI0mzgstO4Oxz3135R7S3V/bbGw3w3woCYpQg==", + "dependencies": { + "@smithy/chunked-blob-reader": "^2.0.0", + "@smithy/chunked-blob-reader-native": "^2.0.0", + "@smithy/types": "^2.2.2", + "tslib": "^2.5.0" + } + }, + "node_modules/@smithy/hash-node": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@smithy/hash-node/-/hash-node-2.0.5.tgz", + "integrity": "sha512-mk551hIywBITT+kXruRNXk7f8Fy7DTzBjZJSr/V6nolYKmUHIG3w5QU6nO9qPYEQGKc/yEPtkpdS28ndeG93lA==", + "dependencies": { + "@smithy/types": "^2.2.2", + "@smithy/util-buffer-from": "^2.0.0", + "@smithy/util-utf8": "^2.0.0", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@smithy/hash-stream-node": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@smithy/hash-stream-node/-/hash-stream-node-2.0.5.tgz", + "integrity": "sha512-XiR4Aoux5kXy8OWPLQisKy3GPmm0l6deHepvPvr4MUzIwa5XWazG3JdbZXy+mk93CvEZrOwKPHU5Kul6QybJiQ==", + "dependencies": { + "@smithy/types": "^2.2.2", + "@smithy/util-utf8": "^2.0.0", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@smithy/invalid-dependency": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@smithy/invalid-dependency/-/invalid-dependency-2.0.5.tgz", + "integrity": "sha512-0wEi+JT0hM+UUwrJVYbqjuGFhy5agY/zXyiN7BNAJ1XoCDjU5uaNSj8ekPWsXd/d4yM6NSe8UbPd8cOc1+3oBQ==", + "dependencies": { + "@smithy/types": "^2.2.2", + "tslib": "^2.5.0" + } + }, + "node_modules/@smithy/is-array-buffer": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@smithy/is-array-buffer/-/is-array-buffer-2.0.0.tgz", + "integrity": "sha512-z3PjFjMyZNI98JFRJi/U0nGoLWMSJlDjAW4QUX2WNZLas5C0CmVV6LJ01JI0k90l7FvpmixjWxPFmENSClQ7ug==", + "dependencies": { + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@smithy/md5-js": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@smithy/md5-js/-/md5-js-2.0.5.tgz", + "integrity": "sha512-k5EOte/Ye2r7XBVaXv2rhiehk6l3T4uRiPF+pnxKEc+G9Fwd1xAXBDZrtOq1syFPBKBmVfNszG4nevngST7NKg==", + "dependencies": { + "@smithy/types": "^2.2.2", + "@smithy/util-utf8": "^2.0.0", + "tslib": "^2.5.0" + } + }, + "node_modules/@smithy/middleware-content-length": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@smithy/middleware-content-length/-/middleware-content-length-2.0.5.tgz", + "integrity": "sha512-E7VwV5H02fgZIUGRli4GevBCAPvkyEI/fgl9SU47nPPi3DAAX3nEtUb8xfGbXjOcJ5BdSUoWWZn42tEd/blOqA==", + "dependencies": { + "@smithy/protocol-http": "^2.0.5", + "@smithy/types": "^2.2.2", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@smithy/middleware-endpoint": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@smithy/middleware-endpoint/-/middleware-endpoint-2.0.5.tgz", + "integrity": "sha512-tyzDuoNTbsMQCq5Xkc4QOt6e2GACUllQIV8SQ5fc59FtOIV9/vbf58/GxVjZm2o8+MMbdDBANjTDZe/ijZKfyA==", + "dependencies": { + "@smithy/middleware-serde": "^2.0.5", + "@smithy/types": "^2.2.2", + "@smithy/url-parser": "^2.0.5", + "@smithy/util-middleware": "^2.0.0", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@smithy/middleware-retry": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@smithy/middleware-retry/-/middleware-retry-2.0.5.tgz", + "integrity": "sha512-ulIfbFyzQTVnJbLjUl1CTSi0etg6tej/ekwaLp0Gn8ybUkDkKYa+uB6CF/m2J5B6meRwyJlsryR+DjaOVyiicg==", + "dependencies": { + "@smithy/protocol-http": "^2.0.5", + "@smithy/service-error-classification": "^2.0.0", + "@smithy/types": "^2.2.2", + "@smithy/util-middleware": "^2.0.0", + "@smithy/util-retry": "^2.0.0", + "tslib": "^2.5.0", + "uuid": "^8.3.2" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@smithy/middleware-retry/node_modules/uuid": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "bin": { + "uuid": "dist/bin/uuid" + } + }, + "node_modules/@smithy/middleware-serde": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@smithy/middleware-serde/-/middleware-serde-2.0.5.tgz", + "integrity": "sha512-in0AA5sous74dOfTGU9rMJBXJ0bDVNxwdXtEt5lh3FVd2sEyjhI+rqpLLRF1E4ixbw3RSEf80hfRpcPdjg4vvQ==", + "dependencies": { + "@smithy/types": "^2.2.2", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@smithy/middleware-stack": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@smithy/middleware-stack/-/middleware-stack-2.0.0.tgz", + "integrity": "sha512-31XC1xNF65nlbc16yuh3wwTudmqs6qy4EseQUGF8A/p2m/5wdd/cnXJqpniy/XvXVwkHPz/GwV36HqzHtIKATQ==", + "dependencies": { + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@smithy/node-config-provider": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@smithy/node-config-provider/-/node-config-provider-2.0.5.tgz", + "integrity": "sha512-LRtjV9WkhONe2lVy+ipB/l1GX60ybzBmFyeRUoLUXWKdnZ3o81jsnbKzMK8hKq8eFSWPk+Lmyx6ZzCQabGeLxg==", + "dependencies": { + "@smithy/property-provider": "^2.0.5", + "@smithy/shared-ini-file-loader": "^2.0.5", + "@smithy/types": "^2.2.2", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@smithy/node-http-handler": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@smithy/node-http-handler/-/node-http-handler-2.0.5.tgz", + "integrity": "sha512-lZm5DZf4b3V0saUw9WTC4/du887P6cy2fUyQgQQKRRV6OseButyD5yTzeMmXE53CaXJBMBsUvvIQ0hRVxIq56w==", + "dependencies": { + "@smithy/abort-controller": "^2.0.5", + "@smithy/protocol-http": "^2.0.5", + "@smithy/querystring-builder": "^2.0.5", + "@smithy/types": "^2.2.2", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@smithy/property-provider": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@smithy/property-provider/-/property-provider-2.0.5.tgz", + "integrity": "sha512-cAFSUhX6aiHcmpWfrCLKvwBtgN1F6A0N8qY/8yeSi0LRLmhGqsY1/YTxFE185MCVzYbqBGXVr9TBv4RUcIV4rA==", + "dependencies": { + "@smithy/types": "^2.2.2", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@smithy/protocol-http": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@smithy/protocol-http/-/protocol-http-2.0.5.tgz", + "integrity": "sha512-d2hhHj34mA2V86doiDfrsy2fNTnUOowGaf9hKb0hIPHqvcnShU4/OSc4Uf1FwHkAdYF3cFXTrj5VGUYbEuvMdw==", + "dependencies": { + "@smithy/types": "^2.2.2", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@smithy/querystring-builder": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@smithy/querystring-builder/-/querystring-builder-2.0.5.tgz", + "integrity": "sha512-4DCX9krxLzATj+HdFPC3i8pb7XTAWzzKqSw8aTZMjXjtQY+vhe4azMAqIvbb6g7JKwIkmkRAjK6EXO3YWSnJVQ==", + "dependencies": { + "@smithy/types": "^2.2.2", + "@smithy/util-uri-escape": "^2.0.0", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@smithy/querystring-parser": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@smithy/querystring-parser/-/querystring-parser-2.0.5.tgz", + "integrity": "sha512-C2stCULH0r54KBksv3AWcN8CLS3u9+WsEW8nBrvctrJ5rQTNa1waHkffpVaiKvcW2nP0aIMBPCobD/kYf/q9mA==", + "dependencies": { + "@smithy/types": "^2.2.2", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@smithy/service-error-classification": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@smithy/service-error-classification/-/service-error-classification-2.0.0.tgz", + "integrity": "sha512-2z5Nafy1O0cTf69wKyNjGW/sNVMiqDnb4jgwfMG8ye8KnFJ5qmJpDccwIbJNhXIfbsxTg9SEec2oe1cexhMJvw==", + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@smithy/shared-ini-file-loader": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@smithy/shared-ini-file-loader/-/shared-ini-file-loader-2.0.5.tgz", + "integrity": "sha512-Mvtk6FwMtfbKRC4YuSsIqRYp9WTxsSUJVVo2djgyhcacKGMqicHDWSAmgy3sDrKv+G/G6xTZCPwm6pJARtdxVg==", + "dependencies": { + "@smithy/types": "^2.2.2", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@smithy/signature-v4": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@smithy/signature-v4/-/signature-v4-2.0.5.tgz", + "integrity": "sha512-ABIzXmUDXK4n2c9cXjQLELgH2RdtABpYKT+U131e2I6RbCypFZmxIHmIBufJzU2kdMCQ3+thBGDWorAITFW04A==", + "dependencies": { + "@smithy/eventstream-codec": "^2.0.5", + "@smithy/is-array-buffer": "^2.0.0", + "@smithy/types": "^2.2.2", + "@smithy/util-hex-encoding": "^2.0.0", + "@smithy/util-middleware": "^2.0.0", + "@smithy/util-uri-escape": "^2.0.0", + "@smithy/util-utf8": "^2.0.0", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@smithy/smithy-client": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@smithy/smithy-client/-/smithy-client-2.0.5.tgz", + "integrity": "sha512-kCTFr8wfOAWKDzGvfBElc6shHigWtHNhMQ1IbosjC4jOlayFyZMSs2PysKB+Ox/dhQ41KqOzgVjgiQ+PyWqHMQ==", + "dependencies": { + "@smithy/middleware-stack": "^2.0.0", + "@smithy/types": "^2.2.2", + "@smithy/util-stream": "^2.0.5", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@smithy/types": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/@smithy/types/-/types-2.2.2.tgz", + "integrity": "sha512-4PS0y1VxDnELGHGgBWlDksB2LJK8TG8lcvlWxIsgR+8vROI7Ms8h1P4FQUx+ftAX2QZv5g1CJCdhdRmQKyonyw==", + "dependencies": { + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@smithy/url-parser": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@smithy/url-parser/-/url-parser-2.0.5.tgz", + "integrity": "sha512-OdMBvZhpckQSkugCXNJQCvqJ71wE7Ftxce92UOQLQ9pwF6hoS5PLL7wEfpnuEXtStzBqJYkzu1C1ZfjuFGOXAA==", + "dependencies": { + "@smithy/querystring-parser": "^2.0.5", + "@smithy/types": "^2.2.2", + "tslib": "^2.5.0" + } + }, + "node_modules/@smithy/util-base64": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@smithy/util-base64/-/util-base64-2.0.0.tgz", + "integrity": "sha512-Zb1E4xx+m5Lud8bbeYi5FkcMJMnn+1WUnJF3qD7rAdXpaL7UjkFQLdmW5fHadoKbdHpwH9vSR8EyTJFHJs++tA==", + "dependencies": { + "@smithy/util-buffer-from": "^2.0.0", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@smithy/util-body-length-browser": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@smithy/util-body-length-browser/-/util-body-length-browser-2.0.0.tgz", + "integrity": "sha512-JdDuS4ircJt+FDnaQj88TzZY3+njZ6O+D3uakS32f2VNnDo3vyEuNdBOh/oFd8Df1zSZOuH1HEChk2AOYDezZg==", + "dependencies": { + "tslib": "^2.5.0" + } + }, + "node_modules/@smithy/util-body-length-node": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@smithy/util-body-length-node/-/util-body-length-node-2.1.0.tgz", + "integrity": "sha512-/li0/kj/y3fQ3vyzn36NTLGmUwAICb7Jbe/CsWCktW363gh1MOcpEcSO3mJ344Gv2dqz8YJCLQpb6hju/0qOWw==", + "dependencies": { + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@smithy/util-buffer-from": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@smithy/util-buffer-from/-/util-buffer-from-2.0.0.tgz", + "integrity": "sha512-/YNnLoHsR+4W4Vf2wL5lGv0ksg8Bmk3GEGxn2vEQt52AQaPSCuaO5PM5VM7lP1K9qHRKHwrPGktqVoAHKWHxzw==", + "dependencies": { + "@smithy/is-array-buffer": "^2.0.0", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@smithy/util-config-provider": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@smithy/util-config-provider/-/util-config-provider-2.0.0.tgz", + "integrity": "sha512-xCQ6UapcIWKxXHEU4Mcs2s7LcFQRiU3XEluM2WcCjjBtQkUN71Tb+ydGmJFPxMUrW/GWMgQEEGipLym4XG0jZg==", + "dependencies": { + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@smithy/util-defaults-mode-browser": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@smithy/util-defaults-mode-browser/-/util-defaults-mode-browser-2.0.5.tgz", + "integrity": "sha512-yciP6TPttLsj731aHTvekgyuCGXQrEAJibEwEWAh3kzaDsfGAVCuZSBlyvC2Dl3TZmHKCOQwHV8mIE7KQCTPuQ==", + "dependencies": { + "@smithy/property-provider": "^2.0.5", + "@smithy/types": "^2.2.2", + "bowser": "^2.11.0", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">= 10.0.0" } }, - "node_modules/@project-serum/borsh": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/@project-serum/borsh/-/borsh-0.2.5.tgz", - "integrity": "sha512-UmeUkUoKdQ7rhx6Leve1SssMR/Ghv8qrEiyywyxSWg7ooV7StdpPBhciiy5eB3T0qU1BXvdRNC8TdrkxK7WC5Q==", + "node_modules/@smithy/util-defaults-mode-node": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@smithy/util-defaults-mode-node/-/util-defaults-mode-node-2.0.5.tgz", + "integrity": "sha512-M07t99rWasXt+IaDZDyP3BkcoEm/mgIE1RIMASrE49LKSNxaVN7PVcgGc77+4uu2kzBAyqJKy79pgtezuknyjQ==", "dependencies": { - "bn.js": "^5.1.2", - "buffer-layout": "^1.2.0" + "@smithy/config-resolver": "^2.0.5", + "@smithy/credential-provider-imds": "^2.0.5", + "@smithy/node-config-provider": "^2.0.5", + "@smithy/property-provider": "^2.0.5", + "@smithy/types": "^2.2.2", + "tslib": "^2.5.0" }, "engines": { - "node": ">=10" - }, - "peerDependencies": { - "@solana/web3.js": "^1.2.0" + "node": ">= 10.0.0" } }, - "node_modules/@project-serum/serum": { - "version": "0.13.65", - "resolved": "https://registry.npmjs.org/@project-serum/serum/-/serum-0.13.65.tgz", - "integrity": "sha512-BHRqsTqPSfFB5p+MgI2pjvMBAQtO8ibTK2fYY96boIFkCI3TTwXDt2gUmspeChKO2pqHr5aKevmexzAcXxrSRA==", + "node_modules/@smithy/util-hex-encoding": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@smithy/util-hex-encoding/-/util-hex-encoding-2.0.0.tgz", + "integrity": "sha512-c5xY+NUnFqG6d7HFh1IFfrm3mGl29lC+vF+geHv4ToiuJCBmIfzx6IeHLg+OgRdPFKDXIw6pvi+p3CsscaMcMA==", "dependencies": { - "@project-serum/anchor": "^0.11.1", - "@solana/spl-token": "^0.1.6", - "@solana/web3.js": "^1.21.0", - "bn.js": "^5.1.2", - "buffer-layout": "^1.2.0" + "tslib": "^2.5.0" }, "engines": { - "node": ">=10" + "node": ">=14.0.0" } }, - "node_modules/@project-serum/serum/node_modules/@project-serum/anchor": { - "version": "0.11.1", - "resolved": "https://registry.npmjs.org/@project-serum/anchor/-/anchor-0.11.1.tgz", - "integrity": "sha512-oIdm4vTJkUy6GmE6JgqDAuQPKI7XM4TPJkjtoIzp69RZe0iAD9JP2XHx7lV1jLdYXeYHqDXfBt3zcq7W91K6PA==", + "node_modules/@smithy/util-middleware": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@smithy/util-middleware/-/util-middleware-2.0.0.tgz", + "integrity": "sha512-eCWX4ECuDHn1wuyyDdGdUWnT4OGyIzV0LN1xRttBFMPI9Ff/4heSHVxneyiMtOB//zpXWCha1/SWHJOZstG7kA==", "dependencies": { - "@project-serum/borsh": "^0.2.2", - "@solana/web3.js": "^1.17.0", - "base64-js": "^1.5.1", - "bn.js": "^5.1.2", - "bs58": "^4.0.1", - "buffer-layout": "^1.2.0", - "camelcase": "^5.3.1", - "crypto-hash": "^1.3.0", - "eventemitter3": "^4.0.7", - "find": "^0.3.0", - "js-sha256": "^0.9.0", - "pako": "^2.0.3", - "snake-case": "^3.0.4", - "toml": "^3.0.0" + "tslib": "^2.5.0" }, "engines": { - "node": ">=11" + "node": ">=14.0.0" } }, - "node_modules/@pythnetwork/client": { - "version": "2.8.0", - "resolved": "https://registry.npmjs.org/@pythnetwork/client/-/client-2.8.0.tgz", - "integrity": "sha512-YqqZSDDsEApC/F4H5ejcl8OCr7gsWv0noTK8YABT8pCtFRTQxXBP0r2S8KQMaIw1x97Mue/jkYybdMeFQzPjCw==", + "node_modules/@smithy/util-retry": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@smithy/util-retry/-/util-retry-2.0.0.tgz", + "integrity": "sha512-/dvJ8afrElasuiiIttRJeoS2sy8YXpksQwiM/TcepqdRVp7u4ejd9C4IQURHNjlfPUT7Y6lCDSa2zQJbdHhVTg==", "dependencies": { - "buffer": "^6.0.1" + "@smithy/service-error-classification": "^2.0.0", + "tslib": "^2.5.0" }, - "peerDependencies": { - "@solana/web3.js": "^1.30.2" + "engines": { + "node": ">= 14.0.0" } }, - "node_modules/@scure/base": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.1.tgz", - "integrity": "sha512-ZxOhsSyxYwLJj3pLZCefNitxsj093tb2vq90mp2txoYeBqbcjDjqFhyM8eUjq/uFm6zJ+mUuqxlS2FkuSY1MTA==", - "funding": [ - { - "type": "individual", - "url": "https://paulmillr.com/funding/" - } - ] + "node_modules/@smithy/util-stream": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@smithy/util-stream/-/util-stream-2.0.5.tgz", + "integrity": "sha512-ylx27GwI05xLpYQ4hDIfS15vm+wYjNN0Sc2P0FxuzgRe8v0BOLHppGIQ+Bezcynk8C9nUzsUue3TmtRhjut43g==", + "dependencies": { + "@smithy/fetch-http-handler": "^2.0.5", + "@smithy/node-http-handler": "^2.0.5", + "@smithy/types": "^2.2.2", + "@smithy/util-base64": "^2.0.0", + "@smithy/util-buffer-from": "^2.0.0", + "@smithy/util-hex-encoding": "^2.0.0", + "@smithy/util-utf8": "^2.0.0", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } }, - "node_modules/@scure/bip32": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.1.0.tgz", - "integrity": "sha512-ftTW3kKX54YXLCxH6BB7oEEoJfoE2pIgw7MINKAs5PsS6nqKPuKk1haTF/EuHmYqG330t5GSrdmtRuHaY1a62Q==", - "funding": [ - { - "type": "individual", - "url": "https://paulmillr.com/funding/" - } - ], + "node_modules/@smithy/util-uri-escape": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@smithy/util-uri-escape/-/util-uri-escape-2.0.0.tgz", + "integrity": "sha512-ebkxsqinSdEooQduuk9CbKcI+wheijxEb3utGXkCoYQkJnwTnLbH1JXGimJtUkQwNQbsbuYwG2+aFVyZf5TLaw==", "dependencies": { - "@noble/hashes": "~1.1.1", - "@noble/secp256k1": "~1.6.0", - "@scure/base": "~1.1.0" + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" } }, - "node_modules/@scure/bip32/node_modules/@noble/secp256k1": { - "version": "1.6.3", - "resolved": "https://registry.npmjs.org/@noble/secp256k1/-/secp256k1-1.6.3.tgz", - "integrity": "sha512-T04e4iTurVy7I8Sw4+c5OSN9/RkPlo1uKxAomtxQNLq8j1uPAqnsqG1bqvY3Jv7c13gyr6dui0zmh/I3+f/JaQ==", - "funding": [ - { - "type": "individual", - "url": "https://paulmillr.com/funding/" - } - ] + "node_modules/@smithy/util-utf8": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@smithy/util-utf8/-/util-utf8-2.0.0.tgz", + "integrity": "sha512-rctU1VkziY84n5OXe3bPNpKR001ZCME2JCaBBFgtiM2hfKbHFudc/BkMuPab8hRbLd0j3vbnBTTZ1igBf0wgiQ==", + "dependencies": { + "@smithy/util-buffer-from": "^2.0.0", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } }, - "node_modules/@scure/bip39": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.1.0.tgz", - "integrity": "sha512-pwrPOS16VeTKg98dYXQyIjJEcWfz7/1YJIwxUEPFfQPtc86Ym/1sVgQ2RLoD43AazMk2l/unK4ITySSpW2+82w==", - "funding": [ - { - "type": "individual", - "url": "https://paulmillr.com/funding/" - } - ], + "node_modules/@smithy/util-waiter": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@smithy/util-waiter/-/util-waiter-2.0.5.tgz", + "integrity": "sha512-1lkkUmI/bhaDX+LIT3RiUNAn+NzPmsWjE7beMq0oQ3H1/CffaILIN67riDA0aE1YBj6xll7uWMIy4tJqc+peXw==", "dependencies": { - "@noble/hashes": "~1.1.1", - "@scure/base": "~1.1.0" + "@smithy/abort-controller": "^2.0.5", + "@smithy/types": "^2.2.2", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" } }, "node_modules/@solana/buffer-layout": { @@ -1768,6 +3092,11 @@ "text-encoding-utf-8": "^1.0.2" } }, + "node_modules/bowser": { + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/bowser/-/bowser-2.11.0.tgz", + "integrity": "sha512-AlcaJBi/pqqJBIQ8U9Mcpc9i8Aqxn88Skv5d+xBX006BY5u8N3mGLHa5Lgppa7L/HfwgwLgZ6NYs+Ag6uUmJRA==" + }, "node_modules/brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -2415,6 +3744,27 @@ "resolved": "https://registry.npmjs.org/fast-stable-stringify/-/fast-stable-stringify-1.0.0.tgz", "integrity": "sha512-wpYMUmFu5f00Sm0cj2pfivpmawLZ0NKdviQ4w9zJeR8JVtOpOxHmLaJuj0vxvGqMJQWyP/COUkF75/57OKyRag==" }, + "node_modules/fast-xml-parser": { + "version": "4.2.5", + "resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-4.2.5.tgz", + "integrity": "sha512-B9/wizE4WngqQftFPmdaMYlXoJlJOYxGQOanC77fq9k8+Z0v5dDSVh+3glErdIROP//s/jgb7ZuxKfB8nVyo0g==", + "funding": [ + { + "type": "paypal", + "url": "https://paypal.me/naturalintelligence" + }, + { + "type": "github", + "url": "https://github.com/sponsors/NaturalIntelligence" + } + ], + "dependencies": { + "strnum": "^1.0.5" + }, + "bin": { + "fxparser": "src/cli/cli.js" + } + }, "node_modules/fastq": { "version": "1.15.0", "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.15.0.tgz", @@ -3185,6 +4535,23 @@ "integrity": "sha512-zTU3DaZaF3Rt9rhN3uBMGQD3dD2/vFQqnvZCDv4dl5iOzq2IZQqTxu90r4E5J+nP70J3ilqVCrbho2eWaeW8Ow==", "peer": true }, + "node_modules/lzma-native": { + "version": "8.0.6", + "resolved": "https://registry.npmjs.org/lzma-native/-/lzma-native-8.0.6.tgz", + "integrity": "sha512-09xfg67mkL2Lz20PrrDeNYZxzeW7ADtpYFbwSQh9U8+76RIzx5QsJBMy8qikv3hbUPfpy6hqwxt6FcGK81g9AA==", + "hasInstallScript": true, + "dependencies": { + "node-addon-api": "^3.1.0", + "node-gyp-build": "^4.2.1", + "readable-stream": "^3.6.0" + }, + "bin": { + "lzmajs": "bin/lzmajs" + }, + "engines": { + "node": ">=10.0.0" + } + }, "node_modules/make-error": { "version": "1.3.6", "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", @@ -3284,6 +4651,11 @@ "tslib": "^2.0.3" } }, + "node_modules/node-addon-api": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-3.2.1.tgz", + "integrity": "sha512-mmcei9JghVNDYydghQmeDX8KoAm0FAiYyIcUt/N4nhyAipB17pllZQDOJD2fotxABnt4Mdz+dKTO7eftLg4d0A==" + }, "node_modules/node-fetch": { "version": "2.6.7", "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", @@ -3307,7 +4679,6 @@ "version": "4.5.0", "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.5.0.tgz", "integrity": "sha512-2iGbaQBV+ITgCz76ZEjmhUKAKVf7xfY1sRl4UiKQspfZMH2h06SyhNsnSVy50cwkFQDGLyif6m/6uFXHkOZ6rg==", - "optional": true, "bin": { "node-gyp-build": "bin.js", "node-gyp-build-optional": "optional.js", @@ -3343,7 +4714,6 @@ "version": "3.1.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", - "dev": true, "dependencies": { "yocto-queue": "^0.1.0" }, @@ -3470,6 +4840,19 @@ } ] }, + "node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/rechoir": { "version": "0.6.2", "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", @@ -3734,6 +5117,14 @@ "url-join": "^4.0.1" } }, + "node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, "node_modules/strip-ansi": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", @@ -3758,6 +5149,11 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/strnum": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/strnum/-/strnum-1.0.5.tgz", + "integrity": "sha512-J8bbNyKKXl5qYcR36TIO8W3mVGVHrmmxsd5PAItGkmyzwJvybiw2IVq5nqd0i4LSNSkB/sx9VHllbfFdr9k1JA==" + }, "node_modules/superstruct": { "version": "0.15.5", "resolved": "https://registry.npmjs.org/superstruct/-/superstruct-0.15.5.tgz", @@ -3875,9 +5271,9 @@ } }, "node_modules/tslib": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.1.tgz", - "integrity": "sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==" + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", + "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==" }, "node_modules/type-check": { "version": "0.4.0", @@ -4017,6 +5413,11 @@ "which-typed-array": "^1.1.2" } }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" + }, "node_modules/uuid": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.0.0.tgz", @@ -4145,37 +5546,671 @@ "xmlbuilder": "~9.0.1" } }, - "node_modules/xmlbuilder": { - "version": "9.0.7", - "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-9.0.7.tgz", - "integrity": "sha512-7YXTQc3P2l9+0rjaUbLwMKRhtmwg1M1eDf6nag7urC7pIPYLD9W/jmzQ4ptRSUbodw5S0jfoGTflLemQibSpeQ==", - "engines": { - "node": ">=4.0" + "node_modules/xmlbuilder": { + "version": "9.0.7", + "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-9.0.7.tgz", + "integrity": "sha512-7YXTQc3P2l9+0rjaUbLwMKRhtmwg1M1eDf6nag7urC7pIPYLD9W/jmzQ4ptRSUbodw5S0jfoGTflLemQibSpeQ==", + "engines": { + "node": ">=4.0" + } + }, + "node_modules/yn": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + } + }, + "dependencies": { + "@aws-crypto/crc32": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@aws-crypto/crc32/-/crc32-3.0.0.tgz", + "integrity": "sha512-IzSgsrxUcsrejQbPVilIKy16kAT52EwB6zSaI+M3xxIhKh5+aldEyvI+z6erM7TCLB2BJsFrtHjp6/4/sr+3dA==", + "requires": { + "@aws-crypto/util": "^3.0.0", + "@aws-sdk/types": "^3.222.0", + "tslib": "^1.11.1" + }, + "dependencies": { + "tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" + } + } + }, + "@aws-crypto/crc32c": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@aws-crypto/crc32c/-/crc32c-3.0.0.tgz", + "integrity": "sha512-ENNPPManmnVJ4BTXlOjAgD7URidbAznURqD0KvfREyc4o20DPYdEldU1f5cQ7Jbj0CJJSPaMIk/9ZshdB3210w==", + "requires": { + "@aws-crypto/util": "^3.0.0", + "@aws-sdk/types": "^3.222.0", + "tslib": "^1.11.1" + }, + "dependencies": { + "tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" + } + } + }, + "@aws-crypto/ie11-detection": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@aws-crypto/ie11-detection/-/ie11-detection-3.0.0.tgz", + "integrity": "sha512-341lBBkiY1DfDNKai/wXM3aujNBkXR7tq1URPQDL9wi3AUbI80NR74uF1TXHMm7po1AcnFk8iu2S2IeU/+/A+Q==", + "requires": { + "tslib": "^1.11.1" + }, + "dependencies": { + "tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" + } + } + }, + "@aws-crypto/sha1-browser": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@aws-crypto/sha1-browser/-/sha1-browser-3.0.0.tgz", + "integrity": "sha512-NJth5c997GLHs6nOYTzFKTbYdMNA6/1XlKVgnZoaZcQ7z7UJlOgj2JdbHE8tiYLS3fzXNCguct77SPGat2raSw==", + "requires": { + "@aws-crypto/ie11-detection": "^3.0.0", + "@aws-crypto/supports-web-crypto": "^3.0.0", + "@aws-crypto/util": "^3.0.0", + "@aws-sdk/types": "^3.222.0", + "@aws-sdk/util-locate-window": "^3.0.0", + "@aws-sdk/util-utf8-browser": "^3.0.0", + "tslib": "^1.11.1" + }, + "dependencies": { + "tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" + } + } + }, + "@aws-crypto/sha256-browser": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@aws-crypto/sha256-browser/-/sha256-browser-3.0.0.tgz", + "integrity": "sha512-8VLmW2B+gjFbU5uMeqtQM6Nj0/F1bro80xQXCW6CQBWgosFWXTx77aeOF5CAIAmbOK64SdMBJdNr6J41yP5mvQ==", + "requires": { + "@aws-crypto/ie11-detection": "^3.0.0", + "@aws-crypto/sha256-js": "^3.0.0", + "@aws-crypto/supports-web-crypto": "^3.0.0", + "@aws-crypto/util": "^3.0.0", + "@aws-sdk/types": "^3.222.0", + "@aws-sdk/util-locate-window": "^3.0.0", + "@aws-sdk/util-utf8-browser": "^3.0.0", + "tslib": "^1.11.1" + }, + "dependencies": { + "tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" + } + } + }, + "@aws-crypto/sha256-js": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@aws-crypto/sha256-js/-/sha256-js-3.0.0.tgz", + "integrity": "sha512-PnNN7os0+yd1XvXAy23CFOmTbMaDxgxXtTKHybrJ39Y8kGzBATgBFibWJKH6BhytLI/Zyszs87xCOBNyBig6vQ==", + "requires": { + "@aws-crypto/util": "^3.0.0", + "@aws-sdk/types": "^3.222.0", + "tslib": "^1.11.1" + }, + "dependencies": { + "tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" + } + } + }, + "@aws-crypto/supports-web-crypto": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@aws-crypto/supports-web-crypto/-/supports-web-crypto-3.0.0.tgz", + "integrity": "sha512-06hBdMwUAb2WFTuGG73LSC0wfPu93xWwo5vL2et9eymgmu3Id5vFAHBbajVWiGhPO37qcsdCap/FqXvJGJWPIg==", + "requires": { + "tslib": "^1.11.1" + }, + "dependencies": { + "tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" + } + } + }, + "@aws-crypto/util": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@aws-crypto/util/-/util-3.0.0.tgz", + "integrity": "sha512-2OJlpeJpCR48CC8r+uKVChzs9Iungj9wkZrl8Z041DWEWvyIHILYKCPNzJghKsivj+S3mLo6BVc7mBNzdxA46w==", + "requires": { + "@aws-sdk/types": "^3.222.0", + "@aws-sdk/util-utf8-browser": "^3.0.0", + "tslib": "^1.11.1" + }, + "dependencies": { + "tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" + } + } + }, + "@aws-sdk/client-s3": { + "version": "3.400.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-s3/-/client-s3-3.400.0.tgz", + "integrity": "sha512-lnv0pb79Czl8fCMs/z7yM56LvoKTri1I4jX/V33trHMFKPQDoy8i24wxG8+TZl3MUmnUyoQS7tlukh7IFkii1Q==", + "requires": { + "@aws-crypto/sha1-browser": "3.0.0", + "@aws-crypto/sha256-browser": "3.0.0", + "@aws-crypto/sha256-js": "3.0.0", + "@aws-sdk/client-sts": "3.398.0", + "@aws-sdk/credential-provider-node": "3.398.0", + "@aws-sdk/middleware-bucket-endpoint": "3.398.0", + "@aws-sdk/middleware-expect-continue": "3.398.0", + "@aws-sdk/middleware-flexible-checksums": "3.400.0", + "@aws-sdk/middleware-host-header": "3.398.0", + "@aws-sdk/middleware-location-constraint": "3.398.0", + "@aws-sdk/middleware-logger": "3.398.0", + "@aws-sdk/middleware-recursion-detection": "3.398.0", + "@aws-sdk/middleware-sdk-s3": "3.398.0", + "@aws-sdk/middleware-signing": "3.398.0", + "@aws-sdk/middleware-ssec": "3.398.0", + "@aws-sdk/middleware-user-agent": "3.398.0", + "@aws-sdk/signature-v4-multi-region": "3.398.0", + "@aws-sdk/types": "3.398.0", + "@aws-sdk/util-endpoints": "3.398.0", + "@aws-sdk/util-user-agent-browser": "3.398.0", + "@aws-sdk/util-user-agent-node": "3.398.0", + "@aws-sdk/xml-builder": "3.310.0", + "@smithy/config-resolver": "^2.0.5", + "@smithy/eventstream-serde-browser": "^2.0.5", + "@smithy/eventstream-serde-config-resolver": "^2.0.5", + "@smithy/eventstream-serde-node": "^2.0.5", + "@smithy/fetch-http-handler": "^2.0.5", + "@smithy/hash-blob-browser": "^2.0.5", + "@smithy/hash-node": "^2.0.5", + "@smithy/hash-stream-node": "^2.0.5", + "@smithy/invalid-dependency": "^2.0.5", + "@smithy/md5-js": "^2.0.5", + "@smithy/middleware-content-length": "^2.0.5", + "@smithy/middleware-endpoint": "^2.0.5", + "@smithy/middleware-retry": "^2.0.5", + "@smithy/middleware-serde": "^2.0.5", + "@smithy/middleware-stack": "^2.0.0", + "@smithy/node-config-provider": "^2.0.5", + "@smithy/node-http-handler": "^2.0.5", + "@smithy/protocol-http": "^2.0.5", + "@smithy/smithy-client": "^2.0.5", + "@smithy/types": "^2.2.2", + "@smithy/url-parser": "^2.0.5", + "@smithy/util-base64": "^2.0.0", + "@smithy/util-body-length-browser": "^2.0.0", + "@smithy/util-body-length-node": "^2.1.0", + "@smithy/util-defaults-mode-browser": "^2.0.5", + "@smithy/util-defaults-mode-node": "^2.0.5", + "@smithy/util-retry": "^2.0.0", + "@smithy/util-stream": "^2.0.5", + "@smithy/util-utf8": "^2.0.0", + "@smithy/util-waiter": "^2.0.5", + "fast-xml-parser": "4.2.5", + "tslib": "^2.5.0" + } + }, + "@aws-sdk/client-sso": { + "version": "3.398.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-sso/-/client-sso-3.398.0.tgz", + "integrity": "sha512-CygL0jhfibw4kmWXG/3sfZMFNjcXo66XUuPC4BqZBk8Rj5vFoxp1vZeMkDLzTIk97Nvo5J5Bh+QnXKhub6AckQ==", + "requires": { + "@aws-crypto/sha256-browser": "3.0.0", + "@aws-crypto/sha256-js": "3.0.0", + "@aws-sdk/middleware-host-header": "3.398.0", + "@aws-sdk/middleware-logger": "3.398.0", + "@aws-sdk/middleware-recursion-detection": "3.398.0", + "@aws-sdk/middleware-user-agent": "3.398.0", + "@aws-sdk/types": "3.398.0", + "@aws-sdk/util-endpoints": "3.398.0", + "@aws-sdk/util-user-agent-browser": "3.398.0", + "@aws-sdk/util-user-agent-node": "3.398.0", + "@smithy/config-resolver": "^2.0.5", + "@smithy/fetch-http-handler": "^2.0.5", + "@smithy/hash-node": "^2.0.5", + "@smithy/invalid-dependency": "^2.0.5", + "@smithy/middleware-content-length": "^2.0.5", + "@smithy/middleware-endpoint": "^2.0.5", + "@smithy/middleware-retry": "^2.0.5", + "@smithy/middleware-serde": "^2.0.5", + "@smithy/middleware-stack": "^2.0.0", + "@smithy/node-config-provider": "^2.0.5", + "@smithy/node-http-handler": "^2.0.5", + "@smithy/protocol-http": "^2.0.5", + "@smithy/smithy-client": "^2.0.5", + "@smithy/types": "^2.2.2", + "@smithy/url-parser": "^2.0.5", + "@smithy/util-base64": "^2.0.0", + "@smithy/util-body-length-browser": "^2.0.0", + "@smithy/util-body-length-node": "^2.1.0", + "@smithy/util-defaults-mode-browser": "^2.0.5", + "@smithy/util-defaults-mode-node": "^2.0.5", + "@smithy/util-retry": "^2.0.0", + "@smithy/util-utf8": "^2.0.0", + "tslib": "^2.5.0" + } + }, + "@aws-sdk/client-sts": { + "version": "3.398.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-sts/-/client-sts-3.398.0.tgz", + "integrity": "sha512-/3Pa9wLMvBZipKraq3AtbmTfXW6q9kyvhwOno64f1Fz7kFb8ijQFMGoATS70B2pGEZTlxkUqJFWDiisT6Q6dFg==", + "requires": { + "@aws-crypto/sha256-browser": "3.0.0", + "@aws-crypto/sha256-js": "3.0.0", + "@aws-sdk/credential-provider-node": "3.398.0", + "@aws-sdk/middleware-host-header": "3.398.0", + "@aws-sdk/middleware-logger": "3.398.0", + "@aws-sdk/middleware-recursion-detection": "3.398.0", + "@aws-sdk/middleware-sdk-sts": "3.398.0", + "@aws-sdk/middleware-signing": "3.398.0", + "@aws-sdk/middleware-user-agent": "3.398.0", + "@aws-sdk/types": "3.398.0", + "@aws-sdk/util-endpoints": "3.398.0", + "@aws-sdk/util-user-agent-browser": "3.398.0", + "@aws-sdk/util-user-agent-node": "3.398.0", + "@smithy/config-resolver": "^2.0.5", + "@smithy/fetch-http-handler": "^2.0.5", + "@smithy/hash-node": "^2.0.5", + "@smithy/invalid-dependency": "^2.0.5", + "@smithy/middleware-content-length": "^2.0.5", + "@smithy/middleware-endpoint": "^2.0.5", + "@smithy/middleware-retry": "^2.0.5", + "@smithy/middleware-serde": "^2.0.5", + "@smithy/middleware-stack": "^2.0.0", + "@smithy/node-config-provider": "^2.0.5", + "@smithy/node-http-handler": "^2.0.5", + "@smithy/protocol-http": "^2.0.5", + "@smithy/smithy-client": "^2.0.5", + "@smithy/types": "^2.2.2", + "@smithy/url-parser": "^2.0.5", + "@smithy/util-base64": "^2.0.0", + "@smithy/util-body-length-browser": "^2.0.0", + "@smithy/util-body-length-node": "^2.1.0", + "@smithy/util-defaults-mode-browser": "^2.0.5", + "@smithy/util-defaults-mode-node": "^2.0.5", + "@smithy/util-retry": "^2.0.0", + "@smithy/util-utf8": "^2.0.0", + "fast-xml-parser": "4.2.5", + "tslib": "^2.5.0" + } + }, + "@aws-sdk/credential-provider-env": { + "version": "3.398.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-env/-/credential-provider-env-3.398.0.tgz", + "integrity": "sha512-Z8Yj5z7FroAsR6UVML+XUdlpoqEe9Dnle8c2h8/xWwIC2feTfIBhjLhRVxfbpbM1pLgBSNEcZ7U8fwq5l7ESVQ==", + "requires": { + "@aws-sdk/types": "3.398.0", + "@smithy/property-provider": "^2.0.0", + "@smithy/types": "^2.2.2", + "tslib": "^2.5.0" + } + }, + "@aws-sdk/credential-provider-ini": { + "version": "3.398.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-ini/-/credential-provider-ini-3.398.0.tgz", + "integrity": "sha512-AsK1lStK3nB9Cn6S6ODb1ktGh7SRejsNVQVKX3t5d3tgOaX+aX1Iwy8FzM/ZEN8uCloeRifUGIY9uQFygg5mSw==", + "requires": { + "@aws-sdk/credential-provider-env": "3.398.0", + "@aws-sdk/credential-provider-process": "3.398.0", + "@aws-sdk/credential-provider-sso": "3.398.0", + "@aws-sdk/credential-provider-web-identity": "3.398.0", + "@aws-sdk/types": "3.398.0", + "@smithy/credential-provider-imds": "^2.0.0", + "@smithy/property-provider": "^2.0.0", + "@smithy/shared-ini-file-loader": "^2.0.0", + "@smithy/types": "^2.2.2", + "tslib": "^2.5.0" + } + }, + "@aws-sdk/credential-provider-node": { + "version": "3.398.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-node/-/credential-provider-node-3.398.0.tgz", + "integrity": "sha512-odmI/DSKfuWUYeDnGTCEHBbC8/MwnF6yEq874zl6+owoVv0ZsYP8qBHfiJkYqrwg7wQ7Pi40sSAPC1rhesGwzg==", + "requires": { + "@aws-sdk/credential-provider-env": "3.398.0", + "@aws-sdk/credential-provider-ini": "3.398.0", + "@aws-sdk/credential-provider-process": "3.398.0", + "@aws-sdk/credential-provider-sso": "3.398.0", + "@aws-sdk/credential-provider-web-identity": "3.398.0", + "@aws-sdk/types": "3.398.0", + "@smithy/credential-provider-imds": "^2.0.0", + "@smithy/property-provider": "^2.0.0", + "@smithy/shared-ini-file-loader": "^2.0.0", + "@smithy/types": "^2.2.2", + "tslib": "^2.5.0" + } + }, + "@aws-sdk/credential-provider-process": { + "version": "3.398.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-process/-/credential-provider-process-3.398.0.tgz", + "integrity": "sha512-WrkBL1W7TXN508PA9wRXPFtzmGpVSW98gDaHEaa8GolAPHMPa5t2QcC/z/cFpglzrcVv8SA277zu9Z8tELdZhg==", + "requires": { + "@aws-sdk/types": "3.398.0", + "@smithy/property-provider": "^2.0.0", + "@smithy/shared-ini-file-loader": "^2.0.0", + "@smithy/types": "^2.2.2", + "tslib": "^2.5.0" + } + }, + "@aws-sdk/credential-provider-sso": { + "version": "3.398.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-sso/-/credential-provider-sso-3.398.0.tgz", + "integrity": "sha512-2Dl35587xbnzR/GGZqA2MnFs8+kS4wbHQO9BioU0okA+8NRueohNMdrdQmQDdSNK4BfIpFspiZmFkXFNyEAfgw==", + "requires": { + "@aws-sdk/client-sso": "3.398.0", + "@aws-sdk/token-providers": "3.398.0", + "@aws-sdk/types": "3.398.0", + "@smithy/property-provider": "^2.0.0", + "@smithy/shared-ini-file-loader": "^2.0.0", + "@smithy/types": "^2.2.2", + "tslib": "^2.5.0" + } + }, + "@aws-sdk/credential-provider-web-identity": { + "version": "3.398.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-web-identity/-/credential-provider-web-identity-3.398.0.tgz", + "integrity": "sha512-iG3905Alv9pINbQ8/MIsshgqYMbWx+NDQWpxbIW3W0MkSH3iAqdVpSCteYidYX9G/jv2Um1nW3y360ib20bvNg==", + "requires": { + "@aws-sdk/types": "3.398.0", + "@smithy/property-provider": "^2.0.0", + "@smithy/types": "^2.2.2", + "tslib": "^2.5.0" + } + }, + "@aws-sdk/middleware-bucket-endpoint": { + "version": "3.398.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-bucket-endpoint/-/middleware-bucket-endpoint-3.398.0.tgz", + "integrity": "sha512-+iDHiRofK/vIY94RWAXkSnR4rBPzc2dPHmLp+FDKywq1y708H9W7TOT37dpn+KSFeO4k2FfddFjzWBHsaeakCA==", + "requires": { + "@aws-sdk/types": "3.398.0", + "@aws-sdk/util-arn-parser": "3.310.0", + "@smithy/protocol-http": "^2.0.5", + "@smithy/types": "^2.2.2", + "@smithy/util-config-provider": "^2.0.0", + "tslib": "^2.5.0" + } + }, + "@aws-sdk/middleware-expect-continue": { + "version": "3.398.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-expect-continue/-/middleware-expect-continue-3.398.0.tgz", + "integrity": "sha512-d6he+Qqwh1yqml9duXSv5iKJ2lS0PVrF2UEsVew2GFxfUif0E/davTZJjvWtnelbuIGcTP+wDKVVjLwBN2sN/g==", + "requires": { + "@aws-sdk/types": "3.398.0", + "@smithy/protocol-http": "^2.0.5", + "@smithy/types": "^2.2.2", + "tslib": "^2.5.0" + } + }, + "@aws-sdk/middleware-flexible-checksums": { + "version": "3.400.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-flexible-checksums/-/middleware-flexible-checksums-3.400.0.tgz", + "integrity": "sha512-lpsumd5/G+eAMTr61h/cJQZ8+i+xzC6OG3bvUcbRHqcjN49XgeNLcPfYcr6Rzf0QHxmuCN4te/4XGU3Fif2YVA==", + "requires": { + "@aws-crypto/crc32": "3.0.0", + "@aws-crypto/crc32c": "3.0.0", + "@aws-sdk/types": "3.398.0", + "@smithy/is-array-buffer": "^2.0.0", + "@smithy/protocol-http": "^2.0.5", + "@smithy/types": "^2.2.2", + "@smithy/util-utf8": "^2.0.0", + "tslib": "^2.5.0" + } + }, + "@aws-sdk/middleware-host-header": { + "version": "3.398.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-host-header/-/middleware-host-header-3.398.0.tgz", + "integrity": "sha512-m+5laWdBaxIZK2ko0OwcCHJZJ5V1MgEIt8QVQ3k4/kOkN9ICjevOYmba751pHoTnbOYB7zQd6D2OT3EYEEsUcA==", + "requires": { + "@aws-sdk/types": "3.398.0", + "@smithy/protocol-http": "^2.0.5", + "@smithy/types": "^2.2.2", + "tslib": "^2.5.0" + } + }, + "@aws-sdk/middleware-location-constraint": { + "version": "3.398.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-location-constraint/-/middleware-location-constraint-3.398.0.tgz", + "integrity": "sha512-it+olJf1Lf2bmH8OL/N1jMOFB0zEVYs4rIzgFrluTRCuPatRuDi4LsXS8zqYxkBa05JE8JmqwW5gCzAmWyLLqw==", + "requires": { + "@aws-sdk/types": "3.398.0", + "@smithy/types": "^2.2.2", + "tslib": "^2.5.0" + } + }, + "@aws-sdk/middleware-logger": { + "version": "3.398.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-logger/-/middleware-logger-3.398.0.tgz", + "integrity": "sha512-CiJjW+FL12elS6Pn7/UVjVK8HWHhXMfvHZvOwx/Qkpy340sIhkuzOO6fZEruECDTZhl2Wqn81XdJ1ZQ4pRKpCg==", + "requires": { + "@aws-sdk/types": "3.398.0", + "@smithy/types": "^2.2.2", + "tslib": "^2.5.0" + } + }, + "@aws-sdk/middleware-recursion-detection": { + "version": "3.398.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-recursion-detection/-/middleware-recursion-detection-3.398.0.tgz", + "integrity": "sha512-7QpOqPQAZNXDXv6vsRex4R8dLniL0E/80OPK4PPFsrCh9btEyhN9Begh4i1T+5lL28hmYkztLOkTQ2N5J3hgRQ==", + "requires": { + "@aws-sdk/types": "3.398.0", + "@smithy/protocol-http": "^2.0.5", + "@smithy/types": "^2.2.2", + "tslib": "^2.5.0" + } + }, + "@aws-sdk/middleware-sdk-s3": { + "version": "3.398.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-sdk-s3/-/middleware-sdk-s3-3.398.0.tgz", + "integrity": "sha512-yweSMc/TyiFtqc52hFMKQJvTm3i1KCoW5mB3o/Sla6zsHBh+nS6TTaBmo+2kcDIR7AKODwW+FLCTHWiazb7J3Q==", + "requires": { + "@aws-sdk/types": "3.398.0", + "@aws-sdk/util-arn-parser": "3.310.0", + "@smithy/protocol-http": "^2.0.5", + "@smithy/types": "^2.2.2", + "tslib": "^2.5.0" + } + }, + "@aws-sdk/middleware-sdk-sts": { + "version": "3.398.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-sdk-sts/-/middleware-sdk-sts-3.398.0.tgz", + "integrity": "sha512-+JH76XHEgfVihkY+GurohOQ5Z83zVN1nYcQzwCFnCDTh4dG4KwhnZKG+WPw6XJECocY0R+H0ivofeALHvVWJtQ==", + "requires": { + "@aws-sdk/middleware-signing": "3.398.0", + "@aws-sdk/types": "3.398.0", + "@smithy/types": "^2.2.2", + "tslib": "^2.5.0" + } + }, + "@aws-sdk/middleware-signing": { + "version": "3.398.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-signing/-/middleware-signing-3.398.0.tgz", + "integrity": "sha512-O0KqXAix1TcvZBFt1qoFkHMUNJOSgjJTYS7lFTRKSwgsD27bdW2TM2r9R8DAccWFt5Amjkdt+eOwQMIXPGTm8w==", + "requires": { + "@aws-sdk/types": "3.398.0", + "@smithy/property-provider": "^2.0.0", + "@smithy/protocol-http": "^2.0.5", + "@smithy/signature-v4": "^2.0.0", + "@smithy/types": "^2.2.2", + "@smithy/util-middleware": "^2.0.0", + "tslib": "^2.5.0" + } + }, + "@aws-sdk/middleware-ssec": { + "version": "3.398.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-ssec/-/middleware-ssec-3.398.0.tgz", + "integrity": "sha512-QtKr/hPcRugKSIZAH4+7hbUfdW7Lg+OQvD25nJn7ic1JHRZ+eDctEFxdsmnt68lE6aZxOcHCWHAW6/umcA93Dw==", + "requires": { + "@aws-sdk/types": "3.398.0", + "@smithy/types": "^2.2.2", + "tslib": "^2.5.0" + } + }, + "@aws-sdk/middleware-user-agent": { + "version": "3.398.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-user-agent/-/middleware-user-agent-3.398.0.tgz", + "integrity": "sha512-nF1jg0L+18b5HvTcYzwyFgfZQQMELJINFqI0mi4yRKaX7T5a3aGp5RVLGGju/6tAGTuFbfBoEhkhU3kkxexPYQ==", + "requires": { + "@aws-sdk/types": "3.398.0", + "@aws-sdk/util-endpoints": "3.398.0", + "@smithy/protocol-http": "^2.0.5", + "@smithy/types": "^2.2.2", + "tslib": "^2.5.0" + } + }, + "@aws-sdk/signature-v4-multi-region": { + "version": "3.398.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/signature-v4-multi-region/-/signature-v4-multi-region-3.398.0.tgz", + "integrity": "sha512-8fTqTxRDWE03T7ClaWlCfbwuSae//01XMNVy2a9g5QgaelQh7ZZyU3ZIJiV8gIj8v6ZM0NGn9Bz1liI/vmNmcw==", + "requires": { + "@aws-sdk/types": "3.398.0", + "@smithy/protocol-http": "^2.0.5", + "@smithy/signature-v4": "^2.0.0", + "@smithy/types": "^2.2.2", + "tslib": "^2.5.0" + } + }, + "@aws-sdk/token-providers": { + "version": "3.398.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/token-providers/-/token-providers-3.398.0.tgz", + "integrity": "sha512-nrYgjzavGCKJL/48Vt0EL+OlIc5UZLfNGpgyUW9cv3XZwl+kXV0QB+HH0rHZZLfpbBgZ2RBIJR9uD5ieu/6hpQ==", + "requires": { + "@aws-crypto/sha256-browser": "3.0.0", + "@aws-crypto/sha256-js": "3.0.0", + "@aws-sdk/middleware-host-header": "3.398.0", + "@aws-sdk/middleware-logger": "3.398.0", + "@aws-sdk/middleware-recursion-detection": "3.398.0", + "@aws-sdk/middleware-user-agent": "3.398.0", + "@aws-sdk/types": "3.398.0", + "@aws-sdk/util-endpoints": "3.398.0", + "@aws-sdk/util-user-agent-browser": "3.398.0", + "@aws-sdk/util-user-agent-node": "3.398.0", + "@smithy/config-resolver": "^2.0.5", + "@smithy/fetch-http-handler": "^2.0.5", + "@smithy/hash-node": "^2.0.5", + "@smithy/invalid-dependency": "^2.0.5", + "@smithy/middleware-content-length": "^2.0.5", + "@smithy/middleware-endpoint": "^2.0.5", + "@smithy/middleware-retry": "^2.0.5", + "@smithy/middleware-serde": "^2.0.5", + "@smithy/middleware-stack": "^2.0.0", + "@smithy/node-config-provider": "^2.0.5", + "@smithy/node-http-handler": "^2.0.5", + "@smithy/property-provider": "^2.0.0", + "@smithy/protocol-http": "^2.0.5", + "@smithy/shared-ini-file-loader": "^2.0.0", + "@smithy/smithy-client": "^2.0.5", + "@smithy/types": "^2.2.2", + "@smithy/url-parser": "^2.0.5", + "@smithy/util-base64": "^2.0.0", + "@smithy/util-body-length-browser": "^2.0.0", + "@smithy/util-body-length-node": "^2.1.0", + "@smithy/util-defaults-mode-browser": "^2.0.5", + "@smithy/util-defaults-mode-node": "^2.0.5", + "@smithy/util-retry": "^2.0.0", + "@smithy/util-utf8": "^2.0.0", + "tslib": "^2.5.0" + } + }, + "@aws-sdk/types": { + "version": "3.398.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/types/-/types-3.398.0.tgz", + "integrity": "sha512-r44fkS+vsEgKCuEuTV+TIk0t0m5ZlXHNjSDYEUvzLStbbfUFiNus/YG4UCa0wOk9R7VuQI67badsvvPeVPCGDQ==", + "requires": { + "@smithy/types": "^2.2.2", + "tslib": "^2.5.0" + } + }, + "@aws-sdk/util-arn-parser": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-arn-parser/-/util-arn-parser-3.310.0.tgz", + "integrity": "sha512-jL8509owp/xB9+Or0pvn3Fe+b94qfklc2yPowZZIFAkFcCSIdkIglz18cPDWnYAcy9JGewpMS1COXKIUhZkJsA==", + "requires": { + "tslib": "^2.5.0" + } + }, + "@aws-sdk/util-endpoints": { + "version": "3.398.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-endpoints/-/util-endpoints-3.398.0.tgz", + "integrity": "sha512-Fy0gLYAei/Rd6BrXG4baspCnWTUSd0NdokU1pZh4KlfEAEN1i8SPPgfiO5hLk7+2inqtCmqxVJlfqbMVe9k4bw==", + "requires": { + "@aws-sdk/types": "3.398.0", + "tslib": "^2.5.0" + } + }, + "@aws-sdk/util-locate-window": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-locate-window/-/util-locate-window-3.310.0.tgz", + "integrity": "sha512-qo2t/vBTnoXpjKxlsC2e1gBrRm80M3bId27r0BRB2VniSSe7bL1mmzM+/HFtujm0iAxtPM+aLEflLJlJeDPg0w==", + "requires": { + "tslib": "^2.5.0" + } + }, + "@aws-sdk/util-user-agent-browser": { + "version": "3.398.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-user-agent-browser/-/util-user-agent-browser-3.398.0.tgz", + "integrity": "sha512-A3Tzx1tkDHlBT+IgxmsMCHbV8LM7SwwCozq2ZjJRx0nqw3MCrrcxQFXldHeX/gdUMO+0Oocb7HGSnVODTq+0EA==", + "requires": { + "@aws-sdk/types": "3.398.0", + "@smithy/types": "^2.2.2", + "bowser": "^2.11.0", + "tslib": "^2.5.0" } }, - "node_modules/yn": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", - "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", - "dev": true, - "engines": { - "node": ">=6" + "@aws-sdk/util-user-agent-node": { + "version": "3.398.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-user-agent-node/-/util-user-agent-node-3.398.0.tgz", + "integrity": "sha512-RTVQofdj961ej4//fEkppFf4KXqKGMTCqJYghx3G0C/MYXbg7MGl7LjfNGtJcboRE8pfHHQ/TUWBDA7RIAPPlQ==", + "requires": { + "@aws-sdk/types": "3.398.0", + "@smithy/node-config-provider": "^2.0.5", + "@smithy/types": "^2.2.2", + "tslib": "^2.5.0" } }, - "node_modules/yocto-queue": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", - "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "@aws-sdk/util-utf8-browser": { + "version": "3.259.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-utf8-browser/-/util-utf8-browser-3.259.0.tgz", + "integrity": "sha512-UvFa/vR+e19XookZF8RzFZBrw2EUkQWxiBW0yYQAhvk3C+QVGl0H3ouca8LDBlBfQKXwmW3huo/59H8rwb1wJw==", + "requires": { + "tslib": "^2.3.1" } - } - }, - "dependencies": { + }, + "@aws-sdk/xml-builder": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/xml-builder/-/xml-builder-3.310.0.tgz", + "integrity": "sha512-TqELu4mOuSIKQCqj63fGVs86Yh+vBx5nHRpWKNUNhB2nPTpfbziTs5c1X358be3peVWA4wPxW7Nt53KIg1tnNw==", + "requires": { + "tslib": "^2.5.0" + } + }, "@babel/runtime": { "version": "7.20.7", "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.20.7.tgz", @@ -4194,13 +6229,16 @@ } }, "@defillama/sdk": { - "version": "4.0.47", - "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.47.tgz", - "integrity": "sha512-Uarp7y5WJHlEARc6YI2RdwCftxa5ytLafxkKTbafnacQ/xshdqku15glnxm+xxV24ED6w9RBhOvcPBEn/h6SZQ==", + "version": "4.0.50", + "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.50.tgz", + "integrity": "sha512-cjn6zWCQ+NOgMgtJErD59Aj+r+ukGVCgqT3353P6ylosXrIEMfySdjxcaW7xIwhoT1WxiMbQau492ycWXH7YEg==", "requires": { + "@aws-sdk/client-s3": "^3.400.0", "@supercharge/promise-pool": "^2.1.0", "ethers": "^5.4.5", + "lzma-native": "^8.0.6", "node-fetch": "^2.6.7", + "p-limit": "^3.0.0", "tron-format-address": "^0.1.11" } }, @@ -4897,6 +6935,487 @@ "@scure/base": "~1.1.0" } }, + "@smithy/abort-controller": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@smithy/abort-controller/-/abort-controller-2.0.5.tgz", + "integrity": "sha512-byVZ2KWLMPYAZGKjRpniAzLcygJO4ruClZKdJTuB0eCB76ONFTdptBHlviHpAZXknRz7skYWPfcgO9v30A1SyA==", + "requires": { + "@smithy/types": "^2.2.2", + "tslib": "^2.5.0" + } + }, + "@smithy/chunked-blob-reader": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@smithy/chunked-blob-reader/-/chunked-blob-reader-2.0.0.tgz", + "integrity": "sha512-k+J4GHJsMSAIQPChGBrjEmGS+WbPonCXesoqP9fynIqjn7rdOThdH8FAeCmokP9mxTYKQAKoHCLPzNlm6gh7Wg==", + "requires": { + "tslib": "^2.5.0" + } + }, + "@smithy/chunked-blob-reader-native": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@smithy/chunked-blob-reader-native/-/chunked-blob-reader-native-2.0.0.tgz", + "integrity": "sha512-HM8V2Rp1y8+1343tkZUKZllFhEQPNmpNdgFAncbTsxkZ18/gqjk23XXv3qGyXWp412f3o43ZZ1UZHVcHrpRnCQ==", + "requires": { + "@smithy/util-base64": "^2.0.0", + "tslib": "^2.5.0" + } + }, + "@smithy/config-resolver": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@smithy/config-resolver/-/config-resolver-2.0.5.tgz", + "integrity": "sha512-n0c2AXz+kjALY2FQr7Zy9zhYigXzboIh1AuUUVCqFBKFtdEvTwnwPXrTDoEehLiRTUHNL+4yzZ3s+D0kKYSLSg==", + "requires": { + "@smithy/types": "^2.2.2", + "@smithy/util-config-provider": "^2.0.0", + "@smithy/util-middleware": "^2.0.0", + "tslib": "^2.5.0" + } + }, + "@smithy/credential-provider-imds": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@smithy/credential-provider-imds/-/credential-provider-imds-2.0.5.tgz", + "integrity": "sha512-KFcf/e0meFkQNyteJ65f1G19sgUEY1e5zL7hyAEUPz2SEfBmC9B37WyRq87G3MEEsvmAWwCRu7nFFYUKtR3svQ==", + "requires": { + "@smithy/node-config-provider": "^2.0.5", + "@smithy/property-provider": "^2.0.5", + "@smithy/types": "^2.2.2", + "@smithy/url-parser": "^2.0.5", + "tslib": "^2.5.0" + } + }, + "@smithy/eventstream-codec": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@smithy/eventstream-codec/-/eventstream-codec-2.0.5.tgz", + "integrity": "sha512-iqR6OuOV3zbQK8uVs9o+9AxhVk8kW9NAxA71nugwUB+kTY9C35pUd0A5/m4PRT0Y0oIW7W4kgnSR3fdYXQjECw==", + "requires": { + "@aws-crypto/crc32": "3.0.0", + "@smithy/types": "^2.2.2", + "@smithy/util-hex-encoding": "^2.0.0", + "tslib": "^2.5.0" + } + }, + "@smithy/eventstream-serde-browser": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@smithy/eventstream-serde-browser/-/eventstream-serde-browser-2.0.5.tgz", + "integrity": "sha512-8NU51y94qFJbxL6SmvgWDfITHO/svvbAigkLYk2pckX17TGCSf4EXuGpGLliJp5Ljh5+vASC7mUH2jYX7MWBxA==", + "requires": { + "@smithy/eventstream-serde-universal": "^2.0.5", + "@smithy/types": "^2.2.2", + "tslib": "^2.5.0" + } + }, + "@smithy/eventstream-serde-config-resolver": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@smithy/eventstream-serde-config-resolver/-/eventstream-serde-config-resolver-2.0.5.tgz", + "integrity": "sha512-u3gvukRaTH4X6tsryuZ4T1WGIEP34fPaTTzphFDJe8GJz/k11oBW1MPnkcaucBMxLnObK9swCF85j5cp1Kj1oA==", + "requires": { + "@smithy/types": "^2.2.2", + "tslib": "^2.5.0" + } + }, + "@smithy/eventstream-serde-node": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@smithy/eventstream-serde-node/-/eventstream-serde-node-2.0.5.tgz", + "integrity": "sha512-/C8jb+k/vKUBIe80D30vzjvRXlJf76kG2AJY7/NwiqWuD2usRuuDFCDaswXdVsSh9P1+FeaxZ48chsK10yDryQ==", + "requires": { + "@smithy/eventstream-serde-universal": "^2.0.5", + "@smithy/types": "^2.2.2", + "tslib": "^2.5.0" + } + }, + "@smithy/eventstream-serde-universal": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@smithy/eventstream-serde-universal/-/eventstream-serde-universal-2.0.5.tgz", + "integrity": "sha512-+vHvbQtlSVYTQ/20tNpVaKi0EpTR7E8GoEUHJypRZIRgiT03b3h2MAWk+SNaqMrCJrYG9vKLkJFzDylRlUvDWg==", + "requires": { + "@smithy/eventstream-codec": "^2.0.5", + "@smithy/types": "^2.2.2", + "tslib": "^2.5.0" + } + }, + "@smithy/fetch-http-handler": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@smithy/fetch-http-handler/-/fetch-http-handler-2.0.5.tgz", + "integrity": "sha512-EzFoMowdBNy1VqtvkiXgPFEdosIAt4/4bgZ8uiDiUyfhmNXq/3bV+CagPFFBsgFOR/X2XK4zFZHRsoa7PNHVVg==", + "requires": { + "@smithy/protocol-http": "^2.0.5", + "@smithy/querystring-builder": "^2.0.5", + "@smithy/types": "^2.2.2", + "@smithy/util-base64": "^2.0.0", + "tslib": "^2.5.0" + } + }, + "@smithy/hash-blob-browser": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@smithy/hash-blob-browser/-/hash-blob-browser-2.0.5.tgz", + "integrity": "sha512-ZVAUBtJXGf9bEko4/RwWcTK6d3b/ZmQMxJMrxOOcQhVDiqny9zI0mzgstO4Oxz3135R7S3V/bbGw3w3woCYpQg==", + "requires": { + "@smithy/chunked-blob-reader": "^2.0.0", + "@smithy/chunked-blob-reader-native": "^2.0.0", + "@smithy/types": "^2.2.2", + "tslib": "^2.5.0" + } + }, + "@smithy/hash-node": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@smithy/hash-node/-/hash-node-2.0.5.tgz", + "integrity": "sha512-mk551hIywBITT+kXruRNXk7f8Fy7DTzBjZJSr/V6nolYKmUHIG3w5QU6nO9qPYEQGKc/yEPtkpdS28ndeG93lA==", + "requires": { + "@smithy/types": "^2.2.2", + "@smithy/util-buffer-from": "^2.0.0", + "@smithy/util-utf8": "^2.0.0", + "tslib": "^2.5.0" + } + }, + "@smithy/hash-stream-node": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@smithy/hash-stream-node/-/hash-stream-node-2.0.5.tgz", + "integrity": "sha512-XiR4Aoux5kXy8OWPLQisKy3GPmm0l6deHepvPvr4MUzIwa5XWazG3JdbZXy+mk93CvEZrOwKPHU5Kul6QybJiQ==", + "requires": { + "@smithy/types": "^2.2.2", + "@smithy/util-utf8": "^2.0.0", + "tslib": "^2.5.0" + } + }, + "@smithy/invalid-dependency": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@smithy/invalid-dependency/-/invalid-dependency-2.0.5.tgz", + "integrity": "sha512-0wEi+JT0hM+UUwrJVYbqjuGFhy5agY/zXyiN7BNAJ1XoCDjU5uaNSj8ekPWsXd/d4yM6NSe8UbPd8cOc1+3oBQ==", + "requires": { + "@smithy/types": "^2.2.2", + "tslib": "^2.5.0" + } + }, + "@smithy/is-array-buffer": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@smithy/is-array-buffer/-/is-array-buffer-2.0.0.tgz", + "integrity": "sha512-z3PjFjMyZNI98JFRJi/U0nGoLWMSJlDjAW4QUX2WNZLas5C0CmVV6LJ01JI0k90l7FvpmixjWxPFmENSClQ7ug==", + "requires": { + "tslib": "^2.5.0" + } + }, + "@smithy/md5-js": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@smithy/md5-js/-/md5-js-2.0.5.tgz", + "integrity": "sha512-k5EOte/Ye2r7XBVaXv2rhiehk6l3T4uRiPF+pnxKEc+G9Fwd1xAXBDZrtOq1syFPBKBmVfNszG4nevngST7NKg==", + "requires": { + "@smithy/types": "^2.2.2", + "@smithy/util-utf8": "^2.0.0", + "tslib": "^2.5.0" + } + }, + "@smithy/middleware-content-length": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@smithy/middleware-content-length/-/middleware-content-length-2.0.5.tgz", + "integrity": "sha512-E7VwV5H02fgZIUGRli4GevBCAPvkyEI/fgl9SU47nPPi3DAAX3nEtUb8xfGbXjOcJ5BdSUoWWZn42tEd/blOqA==", + "requires": { + "@smithy/protocol-http": "^2.0.5", + "@smithy/types": "^2.2.2", + "tslib": "^2.5.0" + } + }, + "@smithy/middleware-endpoint": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@smithy/middleware-endpoint/-/middleware-endpoint-2.0.5.tgz", + "integrity": "sha512-tyzDuoNTbsMQCq5Xkc4QOt6e2GACUllQIV8SQ5fc59FtOIV9/vbf58/GxVjZm2o8+MMbdDBANjTDZe/ijZKfyA==", + "requires": { + "@smithy/middleware-serde": "^2.0.5", + "@smithy/types": "^2.2.2", + "@smithy/url-parser": "^2.0.5", + "@smithy/util-middleware": "^2.0.0", + "tslib": "^2.5.0" + } + }, + "@smithy/middleware-retry": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@smithy/middleware-retry/-/middleware-retry-2.0.5.tgz", + "integrity": "sha512-ulIfbFyzQTVnJbLjUl1CTSi0etg6tej/ekwaLp0Gn8ybUkDkKYa+uB6CF/m2J5B6meRwyJlsryR+DjaOVyiicg==", + "requires": { + "@smithy/protocol-http": "^2.0.5", + "@smithy/service-error-classification": "^2.0.0", + "@smithy/types": "^2.2.2", + "@smithy/util-middleware": "^2.0.0", + "@smithy/util-retry": "^2.0.0", + "tslib": "^2.5.0", + "uuid": "^8.3.2" + }, + "dependencies": { + "uuid": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==" + } + } + }, + "@smithy/middleware-serde": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@smithy/middleware-serde/-/middleware-serde-2.0.5.tgz", + "integrity": "sha512-in0AA5sous74dOfTGU9rMJBXJ0bDVNxwdXtEt5lh3FVd2sEyjhI+rqpLLRF1E4ixbw3RSEf80hfRpcPdjg4vvQ==", + "requires": { + "@smithy/types": "^2.2.2", + "tslib": "^2.5.0" + } + }, + "@smithy/middleware-stack": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@smithy/middleware-stack/-/middleware-stack-2.0.0.tgz", + "integrity": "sha512-31XC1xNF65nlbc16yuh3wwTudmqs6qy4EseQUGF8A/p2m/5wdd/cnXJqpniy/XvXVwkHPz/GwV36HqzHtIKATQ==", + "requires": { + "tslib": "^2.5.0" + } + }, + "@smithy/node-config-provider": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@smithy/node-config-provider/-/node-config-provider-2.0.5.tgz", + "integrity": "sha512-LRtjV9WkhONe2lVy+ipB/l1GX60ybzBmFyeRUoLUXWKdnZ3o81jsnbKzMK8hKq8eFSWPk+Lmyx6ZzCQabGeLxg==", + "requires": { + "@smithy/property-provider": "^2.0.5", + "@smithy/shared-ini-file-loader": "^2.0.5", + "@smithy/types": "^2.2.2", + "tslib": "^2.5.0" + } + }, + "@smithy/node-http-handler": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@smithy/node-http-handler/-/node-http-handler-2.0.5.tgz", + "integrity": "sha512-lZm5DZf4b3V0saUw9WTC4/du887P6cy2fUyQgQQKRRV6OseButyD5yTzeMmXE53CaXJBMBsUvvIQ0hRVxIq56w==", + "requires": { + "@smithy/abort-controller": "^2.0.5", + "@smithy/protocol-http": "^2.0.5", + "@smithy/querystring-builder": "^2.0.5", + "@smithy/types": "^2.2.2", + "tslib": "^2.5.0" + } + }, + "@smithy/property-provider": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@smithy/property-provider/-/property-provider-2.0.5.tgz", + "integrity": "sha512-cAFSUhX6aiHcmpWfrCLKvwBtgN1F6A0N8qY/8yeSi0LRLmhGqsY1/YTxFE185MCVzYbqBGXVr9TBv4RUcIV4rA==", + "requires": { + "@smithy/types": "^2.2.2", + "tslib": "^2.5.0" + } + }, + "@smithy/protocol-http": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@smithy/protocol-http/-/protocol-http-2.0.5.tgz", + "integrity": "sha512-d2hhHj34mA2V86doiDfrsy2fNTnUOowGaf9hKb0hIPHqvcnShU4/OSc4Uf1FwHkAdYF3cFXTrj5VGUYbEuvMdw==", + "requires": { + "@smithy/types": "^2.2.2", + "tslib": "^2.5.0" + } + }, + "@smithy/querystring-builder": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@smithy/querystring-builder/-/querystring-builder-2.0.5.tgz", + "integrity": "sha512-4DCX9krxLzATj+HdFPC3i8pb7XTAWzzKqSw8aTZMjXjtQY+vhe4azMAqIvbb6g7JKwIkmkRAjK6EXO3YWSnJVQ==", + "requires": { + "@smithy/types": "^2.2.2", + "@smithy/util-uri-escape": "^2.0.0", + "tslib": "^2.5.0" + } + }, + "@smithy/querystring-parser": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@smithy/querystring-parser/-/querystring-parser-2.0.5.tgz", + "integrity": "sha512-C2stCULH0r54KBksv3AWcN8CLS3u9+WsEW8nBrvctrJ5rQTNa1waHkffpVaiKvcW2nP0aIMBPCobD/kYf/q9mA==", + "requires": { + "@smithy/types": "^2.2.2", + "tslib": "^2.5.0" + } + }, + "@smithy/service-error-classification": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@smithy/service-error-classification/-/service-error-classification-2.0.0.tgz", + "integrity": "sha512-2z5Nafy1O0cTf69wKyNjGW/sNVMiqDnb4jgwfMG8ye8KnFJ5qmJpDccwIbJNhXIfbsxTg9SEec2oe1cexhMJvw==" + }, + "@smithy/shared-ini-file-loader": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@smithy/shared-ini-file-loader/-/shared-ini-file-loader-2.0.5.tgz", + "integrity": "sha512-Mvtk6FwMtfbKRC4YuSsIqRYp9WTxsSUJVVo2djgyhcacKGMqicHDWSAmgy3sDrKv+G/G6xTZCPwm6pJARtdxVg==", + "requires": { + "@smithy/types": "^2.2.2", + "tslib": "^2.5.0" + } + }, + "@smithy/signature-v4": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@smithy/signature-v4/-/signature-v4-2.0.5.tgz", + "integrity": "sha512-ABIzXmUDXK4n2c9cXjQLELgH2RdtABpYKT+U131e2I6RbCypFZmxIHmIBufJzU2kdMCQ3+thBGDWorAITFW04A==", + "requires": { + "@smithy/eventstream-codec": "^2.0.5", + "@smithy/is-array-buffer": "^2.0.0", + "@smithy/types": "^2.2.2", + "@smithy/util-hex-encoding": "^2.0.0", + "@smithy/util-middleware": "^2.0.0", + "@smithy/util-uri-escape": "^2.0.0", + "@smithy/util-utf8": "^2.0.0", + "tslib": "^2.5.0" + } + }, + "@smithy/smithy-client": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@smithy/smithy-client/-/smithy-client-2.0.5.tgz", + "integrity": "sha512-kCTFr8wfOAWKDzGvfBElc6shHigWtHNhMQ1IbosjC4jOlayFyZMSs2PysKB+Ox/dhQ41KqOzgVjgiQ+PyWqHMQ==", + "requires": { + "@smithy/middleware-stack": "^2.0.0", + "@smithy/types": "^2.2.2", + "@smithy/util-stream": "^2.0.5", + "tslib": "^2.5.0" + } + }, + "@smithy/types": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/@smithy/types/-/types-2.2.2.tgz", + "integrity": "sha512-4PS0y1VxDnELGHGgBWlDksB2LJK8TG8lcvlWxIsgR+8vROI7Ms8h1P4FQUx+ftAX2QZv5g1CJCdhdRmQKyonyw==", + "requires": { + "tslib": "^2.5.0" + } + }, + "@smithy/url-parser": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@smithy/url-parser/-/url-parser-2.0.5.tgz", + "integrity": "sha512-OdMBvZhpckQSkugCXNJQCvqJ71wE7Ftxce92UOQLQ9pwF6hoS5PLL7wEfpnuEXtStzBqJYkzu1C1ZfjuFGOXAA==", + "requires": { + "@smithy/querystring-parser": "^2.0.5", + "@smithy/types": "^2.2.2", + "tslib": "^2.5.0" + } + }, + "@smithy/util-base64": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@smithy/util-base64/-/util-base64-2.0.0.tgz", + "integrity": "sha512-Zb1E4xx+m5Lud8bbeYi5FkcMJMnn+1WUnJF3qD7rAdXpaL7UjkFQLdmW5fHadoKbdHpwH9vSR8EyTJFHJs++tA==", + "requires": { + "@smithy/util-buffer-from": "^2.0.0", + "tslib": "^2.5.0" + } + }, + "@smithy/util-body-length-browser": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@smithy/util-body-length-browser/-/util-body-length-browser-2.0.0.tgz", + "integrity": "sha512-JdDuS4ircJt+FDnaQj88TzZY3+njZ6O+D3uakS32f2VNnDo3vyEuNdBOh/oFd8Df1zSZOuH1HEChk2AOYDezZg==", + "requires": { + "tslib": "^2.5.0" + } + }, + "@smithy/util-body-length-node": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@smithy/util-body-length-node/-/util-body-length-node-2.1.0.tgz", + "integrity": "sha512-/li0/kj/y3fQ3vyzn36NTLGmUwAICb7Jbe/CsWCktW363gh1MOcpEcSO3mJ344Gv2dqz8YJCLQpb6hju/0qOWw==", + "requires": { + "tslib": "^2.5.0" + } + }, + "@smithy/util-buffer-from": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@smithy/util-buffer-from/-/util-buffer-from-2.0.0.tgz", + "integrity": "sha512-/YNnLoHsR+4W4Vf2wL5lGv0ksg8Bmk3GEGxn2vEQt52AQaPSCuaO5PM5VM7lP1K9qHRKHwrPGktqVoAHKWHxzw==", + "requires": { + "@smithy/is-array-buffer": "^2.0.0", + "tslib": "^2.5.0" + } + }, + "@smithy/util-config-provider": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@smithy/util-config-provider/-/util-config-provider-2.0.0.tgz", + "integrity": "sha512-xCQ6UapcIWKxXHEU4Mcs2s7LcFQRiU3XEluM2WcCjjBtQkUN71Tb+ydGmJFPxMUrW/GWMgQEEGipLym4XG0jZg==", + "requires": { + "tslib": "^2.5.0" + } + }, + "@smithy/util-defaults-mode-browser": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@smithy/util-defaults-mode-browser/-/util-defaults-mode-browser-2.0.5.tgz", + "integrity": "sha512-yciP6TPttLsj731aHTvekgyuCGXQrEAJibEwEWAh3kzaDsfGAVCuZSBlyvC2Dl3TZmHKCOQwHV8mIE7KQCTPuQ==", + "requires": { + "@smithy/property-provider": "^2.0.5", + "@smithy/types": "^2.2.2", + "bowser": "^2.11.0", + "tslib": "^2.5.0" + } + }, + "@smithy/util-defaults-mode-node": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@smithy/util-defaults-mode-node/-/util-defaults-mode-node-2.0.5.tgz", + "integrity": "sha512-M07t99rWasXt+IaDZDyP3BkcoEm/mgIE1RIMASrE49LKSNxaVN7PVcgGc77+4uu2kzBAyqJKy79pgtezuknyjQ==", + "requires": { + "@smithy/config-resolver": "^2.0.5", + "@smithy/credential-provider-imds": "^2.0.5", + "@smithy/node-config-provider": "^2.0.5", + "@smithy/property-provider": "^2.0.5", + "@smithy/types": "^2.2.2", + "tslib": "^2.5.0" + } + }, + "@smithy/util-hex-encoding": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@smithy/util-hex-encoding/-/util-hex-encoding-2.0.0.tgz", + "integrity": "sha512-c5xY+NUnFqG6d7HFh1IFfrm3mGl29lC+vF+geHv4ToiuJCBmIfzx6IeHLg+OgRdPFKDXIw6pvi+p3CsscaMcMA==", + "requires": { + "tslib": "^2.5.0" + } + }, + "@smithy/util-middleware": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@smithy/util-middleware/-/util-middleware-2.0.0.tgz", + "integrity": "sha512-eCWX4ECuDHn1wuyyDdGdUWnT4OGyIzV0LN1xRttBFMPI9Ff/4heSHVxneyiMtOB//zpXWCha1/SWHJOZstG7kA==", + "requires": { + "tslib": "^2.5.0" + } + }, + "@smithy/util-retry": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@smithy/util-retry/-/util-retry-2.0.0.tgz", + "integrity": "sha512-/dvJ8afrElasuiiIttRJeoS2sy8YXpksQwiM/TcepqdRVp7u4ejd9C4IQURHNjlfPUT7Y6lCDSa2zQJbdHhVTg==", + "requires": { + "@smithy/service-error-classification": "^2.0.0", + "tslib": "^2.5.0" + } + }, + "@smithy/util-stream": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@smithy/util-stream/-/util-stream-2.0.5.tgz", + "integrity": "sha512-ylx27GwI05xLpYQ4hDIfS15vm+wYjNN0Sc2P0FxuzgRe8v0BOLHppGIQ+Bezcynk8C9nUzsUue3TmtRhjut43g==", + "requires": { + "@smithy/fetch-http-handler": "^2.0.5", + "@smithy/node-http-handler": "^2.0.5", + "@smithy/types": "^2.2.2", + "@smithy/util-base64": "^2.0.0", + "@smithy/util-buffer-from": "^2.0.0", + "@smithy/util-hex-encoding": "^2.0.0", + "@smithy/util-utf8": "^2.0.0", + "tslib": "^2.5.0" + } + }, + "@smithy/util-uri-escape": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@smithy/util-uri-escape/-/util-uri-escape-2.0.0.tgz", + "integrity": "sha512-ebkxsqinSdEooQduuk9CbKcI+wheijxEb3utGXkCoYQkJnwTnLbH1JXGimJtUkQwNQbsbuYwG2+aFVyZf5TLaw==", + "requires": { + "tslib": "^2.5.0" + } + }, + "@smithy/util-utf8": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@smithy/util-utf8/-/util-utf8-2.0.0.tgz", + "integrity": "sha512-rctU1VkziY84n5OXe3bPNpKR001ZCME2JCaBBFgtiM2hfKbHFudc/BkMuPab8hRbLd0j3vbnBTTZ1igBf0wgiQ==", + "requires": { + "@smithy/util-buffer-from": "^2.0.0", + "tslib": "^2.5.0" + } + }, + "@smithy/util-waiter": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@smithy/util-waiter/-/util-waiter-2.0.5.tgz", + "integrity": "sha512-1lkkUmI/bhaDX+LIT3RiUNAn+NzPmsWjE7beMq0oQ3H1/CffaILIN67riDA0aE1YBj6xll7uWMIy4tJqc+peXw==", + "requires": { + "@smithy/abort-controller": "^2.0.5", + "@smithy/types": "^2.2.2", + "tslib": "^2.5.0" + } + }, "@solana/buffer-layout": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/@solana/buffer-layout/-/buffer-layout-4.0.1.tgz", @@ -5349,6 +7868,11 @@ "text-encoding-utf-8": "^1.0.2" } }, + "bowser": { + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/bowser/-/bowser-2.11.0.tgz", + "integrity": "sha512-AlcaJBi/pqqJBIQ8U9Mcpc9i8Aqxn88Skv5d+xBX006BY5u8N3mGLHa5Lgppa7L/HfwgwLgZ6NYs+Ag6uUmJRA==" + }, "brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -5822,6 +8346,14 @@ "resolved": "https://registry.npmjs.org/fast-stable-stringify/-/fast-stable-stringify-1.0.0.tgz", "integrity": "sha512-wpYMUmFu5f00Sm0cj2pfivpmawLZ0NKdviQ4w9zJeR8JVtOpOxHmLaJuj0vxvGqMJQWyP/COUkF75/57OKyRag==" }, + "fast-xml-parser": { + "version": "4.2.5", + "resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-4.2.5.tgz", + "integrity": "sha512-B9/wizE4WngqQftFPmdaMYlXoJlJOYxGQOanC77fq9k8+Z0v5dDSVh+3glErdIROP//s/jgb7ZuxKfB8nVyo0g==", + "requires": { + "strnum": "^1.0.5" + } + }, "fastq": { "version": "1.15.0", "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.15.0.tgz", @@ -6413,6 +8945,16 @@ "integrity": "sha512-zTU3DaZaF3Rt9rhN3uBMGQD3dD2/vFQqnvZCDv4dl5iOzq2IZQqTxu90r4E5J+nP70J3ilqVCrbho2eWaeW8Ow==", "peer": true }, + "lzma-native": { + "version": "8.0.6", + "resolved": "https://registry.npmjs.org/lzma-native/-/lzma-native-8.0.6.tgz", + "integrity": "sha512-09xfg67mkL2Lz20PrrDeNYZxzeW7ADtpYFbwSQh9U8+76RIzx5QsJBMy8qikv3hbUPfpy6hqwxt6FcGK81g9AA==", + "requires": { + "node-addon-api": "^3.1.0", + "node-gyp-build": "^4.2.1", + "readable-stream": "^3.6.0" + } + }, "make-error": { "version": "1.3.6", "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", @@ -6494,6 +9036,11 @@ "tslib": "^2.0.3" } }, + "node-addon-api": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-3.2.1.tgz", + "integrity": "sha512-mmcei9JghVNDYydghQmeDX8KoAm0FAiYyIcUt/N4nhyAipB17pllZQDOJD2fotxABnt4Mdz+dKTO7eftLg4d0A==" + }, "node-fetch": { "version": "2.6.7", "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", @@ -6505,8 +9052,7 @@ "node-gyp-build": { "version": "4.5.0", "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.5.0.tgz", - "integrity": "sha512-2iGbaQBV+ITgCz76ZEjmhUKAKVf7xfY1sRl4UiKQspfZMH2h06SyhNsnSVy50cwkFQDGLyif6m/6uFXHkOZ6rg==", - "optional": true + "integrity": "sha512-2iGbaQBV+ITgCz76ZEjmhUKAKVf7xfY1sRl4UiKQspfZMH2h06SyhNsnSVy50cwkFQDGLyif6m/6uFXHkOZ6rg==" }, "once": { "version": "1.4.0", @@ -6534,7 +9080,6 @@ "version": "3.1.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", - "dev": true, "requires": { "yocto-queue": "^0.1.0" } @@ -6613,6 +9158,16 @@ "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", "dev": true }, + "readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + }, "rechoir": { "version": "0.6.2", "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", @@ -6785,6 +9340,14 @@ "url-join": "^4.0.1" } }, + "string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "requires": { + "safe-buffer": "~5.2.0" + } + }, "strip-ansi": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", @@ -6800,6 +9363,11 @@ "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", "dev": true }, + "strnum": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/strnum/-/strnum-1.0.5.tgz", + "integrity": "sha512-J8bbNyKKXl5qYcR36TIO8W3mVGVHrmmxsd5PAItGkmyzwJvybiw2IVq5nqd0i4LSNSkB/sx9VHllbfFdr9k1JA==" + }, "superstruct": { "version": "0.15.5", "resolved": "https://registry.npmjs.org/superstruct/-/superstruct-0.15.5.tgz", @@ -6883,9 +9451,9 @@ } }, "tslib": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.1.tgz", - "integrity": "sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==" + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", + "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==" }, "type-check": { "version": "0.4.0", @@ -6988,6 +9556,11 @@ "which-typed-array": "^1.1.2" } }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" + }, "uuid": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.0.0.tgz", @@ -7098,8 +9671,7 @@ "yocto-queue": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", - "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", - "dev": true + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==" } } } diff --git a/projects/stellaxyz-io/index.js b/projects/stellaxyz-io/index.js index 915e42eb5e7..4bb1910d5e9 100644 --- a/projects/stellaxyz-io/index.js +++ b/projects/stellaxyz-io/index.js @@ -1,36 +1,29 @@ const { sumTokens2 } = require('../helper/unwrapLPs') const { getLogs, getAddress } = require('../helper/cache/getLogs'); +const { cachedGraphQuery } = require('../helper/cache') const config = { arbitrum: { - lendingContracts: [ - '0x3251f402cc06b33e742f08e1adbe0d2e4c1ea2fa', - '0x36569fbc5a9d4c59d71e81d46db24256a09d1ad6', - '0x5ecb93b3ef882bf42fee65541942d50a7dab4b33', - '0x8e57143d14bae132210cfeec58d0c48875f7d415', - '0xab416e57ec74e87295b8a1507745a954b0bb9f02', - ], - factory: '0x573a89fBc6b4a5B11a55DC9814A1018a3A9cD0CA', - fromBlock: 101291920, + endpoint: 'https://graph.stellaxyz.io/v1/graphql', + // factory: '0x573a89fBc6b4a5B11a55DC9814A1018a3A9cD0CA', + // fromBlock: 101291920, } } -module.exports = { -}; +const query = `query GET_ALL_LENDING_POOLS{ pools: lending_pool_registry( where: {_or: [{is_launched: {_eq: true}}], chain_id: {_eq: 42161}, is_deprecated: {_eq: false}} ) { tokenName: lending_token_name poolAddress: pool_address }}` +const strategyQuery = `query Strategy { strategy( where: {chain_id: {_eq: 42161 }, _or: [{is_launched: {_eq: true}}]} order_by: {display_priority: asc} ) { id name strategyAddress: strategy_address }}` Object.keys(config).forEach(chain => { - const { lendingContracts, factory, fromBlock, } = config[chain] + const { endpoint, factory, fromBlock, } = config[chain] module.exports[chain] = { tvl: async (_, _b, _cb, { api, }) => { - const logs = await getLogs({ - api, - target: factory, - topics: ['0x0803371633b57311f58d10924711080d2dae75ab17c5c0c262af3887cfca00bb'], - fromBlock, - }) + const { pools } = await cachedGraphQuery('stellaxyz/lending-pool/'+api.chain, endpoint, query) + const { strategy } = await cachedGraphQuery('stellaxyz/strategy/'+api.chain, endpoint, strategyQuery) + const lendingContracts = pools.map(i => i.poolAddress) + const strategies = strategy.map(i => i.strategyAddress) + // const logs = await getLogs({ api, target: factory, topics: ['0x0803371633b57311f58d10924711080d2dae75ab17c5c0c262af3887cfca00bb'], fromBlock, }) - const strategies = logs.map(i => getAddress(i.data.slice(64, 64 * 2 + 2))) - const positionManagers = await api.multiCall({ abi: 'address:positionManager', calls: strategies}) + const positionManagers = await api.multiCall({ abi: 'address:positionManager', calls: strategies }) const tokens = await api.multiCall({ abi: 'address:depositToken', calls: lendingContracts }) await sumTokens2({ api, tokensAndOwners2: [tokens, lendingContracts] }) From d1da36e27384dcaf168a75d7a70e0dd96cedcfb5 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 28 Aug 2023 11:11:50 +0200 Subject: [PATCH 0995/1974] fix harvest adapter --- projects/harvest.js | 35 ++++++++++++++--------------------- projects/harvest/api.js | 14 +------------- projects/helper/unwrapLPs.js | 4 +++- 3 files changed, 18 insertions(+), 35 deletions(-) diff --git a/projects/harvest.js b/projects/harvest.js index d2fe771dd49..0f6c50a5639 100644 --- a/projects/harvest.js +++ b/projects/harvest.js @@ -1,4 +1,5 @@ -const { get } = require('./helper/http') +const { getConfig } = require('./helper/cache') +const { sumTokens2 } = require('./helper/unwrapLPs') // historical tvl on https://ethparser-api.herokuapp.com/api/transactions/history/alltvl?network=eth const endpoint = "https://api.harvest.finance/vaults?key=41e90ced-d559-4433-b390-af424fdc76d6" @@ -6,33 +7,25 @@ const chains = { ethereum: 'eth', // bsc: 'bsc', arbitrum: 'arbitrum', + base: 'base', polygon: 'matic' } -let _response - module.exports = {} Object.keys(chains).forEach(chain => { module.exports[chain] = { - tvl: async () => { - chain = chains[chain] - if (!_response) _response = get(endpoint) - const response = await _response - var tvl = 0; - Object.values(response[chain]).map(item => { - if(item.id === "convex_pETH"){ - return - } - const poolTvl = parseFloat(item.totalValueLocked ?? 0) - tvl += poolTvl + tvl: async (_, _1, _2, { api }) => { + const response = await getConfig('harvest', endpoint) + const vaults = Object.values(response[chains[chain]]).map(i => i.vaultAddress) + const strategy = await api.multiCall({ abi: 'address:strategy', calls: vaults }) + const tokensV = await api.multiCall({ abi: 'address:underlying', calls: vaults, permitFailure: true }) + const tokens = await api.multiCall({ abi: 'address:underlying', calls: strategy, permitFailure: true }) + const bals2 = await api.multiCall({ abi: 'uint256:underlyingBalanceWithInvestment', calls: vaults, permitFailure: true }) + tokens.forEach((token, idx) => { + if (!token) token = tokensV[idx] + if (token) api.add(token, bals2[idx]) }) - return { tether: tvl } + return sumTokens2({ api, resolveLP: true, owners: vaults, resolveUniV3: true }) } } }) - -module.exports.ethereum = { - tvl: () => { - throw new Error('Method not implemented') - } -} \ No newline at end of file diff --git a/projects/harvest/api.js b/projects/harvest/api.js index ed865971c45..4236a13518d 100644 --- a/projects/harvest/api.js +++ b/projects/harvest/api.js @@ -1,15 +1,3 @@ -const { getExports } = require('../helper/heroku-api') const indexExports = require('../harvest') -const chainKeys = Object.keys(indexExports).filter(chain => typeof indexExports[chain] === 'object' && indexExports[chain].tvl) -module.exports = { - timetravel: false, - misrepresentedTokens: true, - ...getExports("harvest", chainKeys), -} - -module.exports.ethereum = { - tvl: () => { - throw new Error('Method not implemented') - } -} \ No newline at end of file +module.exports = indexExports \ No newline at end of file diff --git a/projects/helper/unwrapLPs.js b/projects/helper/unwrapLPs.js index f9d32ddf055..59dc17eb6a4 100644 --- a/projects/helper/unwrapLPs.js +++ b/projects/helper/unwrapLPs.js @@ -12,7 +12,6 @@ const { isLP, log, } = require('./utils') const { sumArtBlocks, whitelistedNFTs, } = require('./nft') const wildCreditABI = require('../wildcredit/abi.json'); const { covalentGetTokens, get } = require("./http"); -const { getTrxBalance } = require("./chain/tron"); const { sliceIntoChunks } = require('@defillama/sdk/build/util'); const lpReservesAbi = 'function getReserves() view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast)' @@ -193,6 +192,7 @@ async function sumLPWithOnlyOneTokenOtherThanKnown(balances, lpToken, owner, tok const PANCAKE_NFT_ADDRESS = '0x46A15B0b27311cedF172AB29E4f4766fbE7F4364' async function unwrapUniswapV3NFTs({ balances = {}, nftsAndOwners = [], block, chain = 'ethereum', owner, nftAddress, owners, blacklistedTokens = [], whitelistedTokens = [], }) { + // https://docs.uniswap.org/contracts/v3/reference/deployments if (!nftsAndOwners.length) { if (!nftAddress) switch (chain) { @@ -202,6 +202,8 @@ async function unwrapUniswapV3NFTs({ balances = {}, nftsAndOwners = [], block, c case 'arbitrum': nftAddress = '0xC36442b4a4522E871399CD717aBDD847Ab11FE88'; break; case 'bsc': nftAddress = [PANCAKE_NFT_ADDRESS, '0x7b8a01b39d58278b5de7e48c8449c9f4f5170613']; break; case 'evmos': nftAddress = '0x5fe5daaa011673289847da4f76d63246ddb2965d'; break; + case 'celo': nftAddress = '0x3d79EdAaBC0EaB6F08ED885C05Fc0B014290D95A'; break; + case 'base': nftAddress = '0x03a520b32C04BF3bEEf7BEb72E919cf822Ed34f1'; break; default: throw new Error('missing default uniswap nft address') } From 039450758945b97dc52aeb58964a78fc42e255ee Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 28 Aug 2023 11:17:11 +0200 Subject: [PATCH 0996/1974] pancakeswap: track base --- projects/pancake-swap/index.js | 17 ++++++++--------- projects/pancakeswap-v3/index.js | 12 +++++++----- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/projects/pancake-swap/index.js b/projects/pancake-swap/index.js index 4b9acfdb142..64ef85fea41 100644 --- a/projects/pancake-swap/index.js +++ b/projects/pancake-swap/index.js @@ -70,6 +70,10 @@ async function tvl(timestamp, ethBlock, chainBlocks) { } } +const defaultExport = { + tvl: getUniTVL({ factory: '0x02a84c1b3BBD7401a5f7fa98a384EBC70bB5749E', useDefaultCoreAssets: true, }) +} + module.exports = { timetravel: false, misrepresentedTokens: true, @@ -82,12 +86,8 @@ module.exports = { staking: stakings(["0x556B9306565093C855AEA9AE92A594704c2Cd59e"], "0x152649ea73beab28c5b49b26eb48f7ead6d4c898", "ethereum"), tvl: getUniTVL({ factory: '0x1097053Fd2ea711dad45caCcc45EfF7548fCB362', useDefaultCoreAssets: true, }) }, - polygon_zkevm: { - tvl: getUniTVL({ factory: '0x02a84c1b3BBD7401a5f7fa98a384EBC70bB5749E', useDefaultCoreAssets: true, }) - }, - linea: { - tvl: getUniTVL({ factory: '0x02a84c1b3BBD7401a5f7fa98a384EBC70bB5749E', useDefaultCoreAssets: true, }) - }, + polygon_zkevm: defaultExport, + linea: defaultExport, aptos: dexExport({ account: '0xc7efb4076dbe143cbcd98cfaaa929ecfc8f299203dfff63b95ccb6bfe19850fa', poolStr: 'swap::TokenPairReserve', @@ -97,7 +97,6 @@ module.exports = { era: { tvl: getUniTVL({ factory: '0xd03D8D566183F0086d8D09A84E1e30b58Dd5619d', useDefaultCoreAssets: true, }) }, - arbitrum: { - tvl: getUniTVL({ factory: '0x02a84c1b3BBD7401a5f7fa98a384EBC70bB5749E', useDefaultCoreAssets: true, }) - }, + arbitrum: defaultExport, + base: defaultExport, } diff --git a/projects/pancakeswap-v3/index.js b/projects/pancakeswap-v3/index.js index a9ca977649b..b4d8f73c3c2 100644 --- a/projects/pancakeswap-v3/index.js +++ b/projects/pancakeswap-v3/index.js @@ -1,8 +1,9 @@ const { uniV3Export } = require('../helper/uniswapV3') +const factory = '0x0bfbcf9fa4f9c56b0f40a671ad40e0805a091865' module.exports = uniV3Export({ bsc: { - factory: '0x0bfbcf9fa4f9c56b0f40a671ad40e0805a091865', fromBlock: 26956207, blacklistedTokens: [ + factory, fromBlock: 26956207, blacklistedTokens: [ '0x860368babf32129c18306a70ce7db10c5b437072', '0xc476d3961f77645464acccce404eb17815a80878', '0xf8c7f403829cc0f9a37f126a3da41358c232acdf', @@ -11,9 +12,10 @@ module.exports = uniV3Export({ '0x121a3fba8456ebce13964363ba35fea00c2aa3d2', ] }, - ethereum: { factory: '0x0bfbcf9fa4f9c56b0f40a671ad40e0805a091865', fromBlock: 16950685, }, - polygon_zkevm: { factory: '0x0BFbCF9fa4f9C56B0F40a671Ad40E0805A091865', fromBlock: 750148, }, - linea: { factory: '0x0BFbCF9fa4f9C56B0F40a671Ad40E0805A091865', fromBlock: 1445, }, + ethereum: { factory, fromBlock: 16950685, }, + polygon_zkevm: { factory, fromBlock: 750148, }, + linea: { factory, fromBlock: 1445, }, era: { factory: '0x1BB72E0CbbEA93c08f535fc7856E0338D7F7a8aB', fromBlock: 9413438, }, - arbitrum: { factory: '0x0BFbCF9fa4f9C56B0F40a671Ad40E0805A091865', fromBlock: 101028949, }, + arbitrum: { factory, fromBlock: 101028949, }, + base: { factory, fromBlock: 2912007, }, }) From a071064bbe67868f184719d097c1e136da3f9ce1 Mon Sep 17 00:00:00 2001 From: define Date: Mon, 28 Aug 2023 11:08:05 +0100 Subject: [PATCH 0997/1974] loot dao treasury adapter --- projects/treasury/loot-dao.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 projects/treasury/loot-dao.js diff --git a/projects/treasury/loot-dao.js b/projects/treasury/loot-dao.js new file mode 100644 index 00000000000..55725908549 --- /dev/null +++ b/projects/treasury/loot-dao.js @@ -0,0 +1,17 @@ +const ADDRESSES = require('../helper/coreAssets.json') + +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0x8cFDF9E9f7EA8c0871025318407A6f1Fbc5d5a18"; + + +module.exports = treasuryExports({ + ethereum: { + tokens: [nullAddress, ADDRESSES.ethereum.USDC, ADDRESSES.ethereum.WETH], + owners: [treasury], + }, + polygon: { + tokens: [nullAddress, "0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619"], //weth + owners: [treasury], + }, +}); \ No newline at end of file From f859cf2dcc8a8813108b0c62e87dd31e01ae8acf Mon Sep 17 00:00:00 2001 From: define Date: Mon, 28 Aug 2023 11:42:08 +0100 Subject: [PATCH 0998/1974] add own tokens loot-dao --- projects/treasury/loot-dao.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/treasury/loot-dao.js b/projects/treasury/loot-dao.js index 55725908549..733e874b1e9 100644 --- a/projects/treasury/loot-dao.js +++ b/projects/treasury/loot-dao.js @@ -3,7 +3,7 @@ const ADDRESSES = require('../helper/coreAssets.json') const { nullAddress, treasuryExports } = require("../helper/treasury"); const treasury = "0x8cFDF9E9f7EA8c0871025318407A6f1Fbc5d5a18"; - +const loot = "0xFF9C1b15B16263C61d017ee9F65C50e4AE0113D7" module.exports = treasuryExports({ ethereum: { @@ -13,5 +13,6 @@ module.exports = treasuryExports({ polygon: { tokens: [nullAddress, "0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619"], //weth owners: [treasury], + ownTokens: [loot] // loot }, }); \ No newline at end of file From 9ecbbd606e7c9499dc7d7e92d0cd44472786c6ec Mon Sep 17 00:00:00 2001 From: define Date: Mon, 28 Aug 2023 11:47:06 +0100 Subject: [PATCH 0999/1974] fix loot-dao treasury --- projects/treasury/loot-dao.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/treasury/loot-dao.js b/projects/treasury/loot-dao.js index 733e874b1e9..14c83c4308b 100644 --- a/projects/treasury/loot-dao.js +++ b/projects/treasury/loot-dao.js @@ -9,10 +9,10 @@ module.exports = treasuryExports({ ethereum: { tokens: [nullAddress, ADDRESSES.ethereum.USDC, ADDRESSES.ethereum.WETH], owners: [treasury], + ownTokens: [loot] // loot }, polygon: { tokens: [nullAddress, "0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619"], //weth owners: [treasury], - ownTokens: [loot] // loot }, }); \ No newline at end of file From 8ed4c5b46efc0f236cf1601796acc93d0abef865 Mon Sep 17 00:00:00 2001 From: define Date: Mon, 28 Aug 2023 12:58:17 +0100 Subject: [PATCH 1000/1974] update nouns treasury --- projects/treasury/nouns.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/projects/treasury/nouns.js b/projects/treasury/nouns.js index 9897ca0b461..abf32559b5e 100644 --- a/projects/treasury/nouns.js +++ b/projects/treasury/nouns.js @@ -2,6 +2,7 @@ const ADDRESSES = require('../helper/coreAssets.json') const { nullAddress, treasuryExports } = require("../helper/treasury"); const treasury = "0x0BC3807Ec262cB779b38D65b38158acC3bfedE10"; +const treasury1 = "0xb1a32FC9F9D8b2cf86C068Cae13108809547ef71" module.exports = treasuryExports({ ethereum: { @@ -9,7 +10,9 @@ module.exports = treasuryExports({ nullAddress, ADDRESSES.ethereum.USDC, //USDC ADDRESSES.ethereum.STETH,//stETH + ADDRESSES.ethereum.RETH, + "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0" //wstETH ], - owners: [treasury,], + owners: [treasury, treasury1], }, }) \ No newline at end of file From e257d520efd7740fc2cdfd315b87957925e67075 Mon Sep 17 00:00:00 2001 From: define Date: Mon, 28 Aug 2023 13:34:29 +0100 Subject: [PATCH 1001/1974] add turbo sweth vault --- projects/sommelier/index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/projects/sommelier/index.js b/projects/sommelier/index.js index fb86facea0d..45459971199 100644 --- a/projects/sommelier/index.js +++ b/projects/sommelier/index.js @@ -34,6 +34,7 @@ const REAL_YIELD_SNX = "0xcbf2250f33c4161e18d4a2fa47464520af5216b5"; const REAL_YIELD_ENS = "0x18ea937aba6053bc232d9ae2c42abe7a8a2be440"; const REAL_YIELD_BTC = "0x0274a704a6d9129f90a62ddc6f6024b33ecdad36"; const FRAXIMAL = "0xdbe19d1c3f21b1bb250ca7bdae0687a97b5f77e6"; +const Turbo_swETH = "0xd33dAd974b938744dAC81fE00ac67cb5AA13958E" const cellarsV2 = [ { id: DEFI_STARS, startBlock: 17181497 }, @@ -46,6 +47,7 @@ const cellarsV2 = [ { id: REAL_YIELD_ENS, startBlock: 17377190 }, { id: REAL_YIELD_BTC, startBlock: 17667535 }, { id: FRAXIMAL, startBlock: 17589948 }, + { id: Turbo_swETH, startBlock: 17892468} ]; // v2.5 Cellars From a7df2265e070e4e884e58d21ec8fd8e7e20c4820 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 28 Aug 2023 14:59:48 +0200 Subject: [PATCH 1002/1974] Voltswap-v2 (#7304) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * create stMTRG * rename * add voltswap-v2 on base * minor fix --------- Co-authored-by: 崔棉大师 <1046166@qq.com> --- projects/voltswap-v2/index.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/projects/voltswap-v2/index.js b/projects/voltswap-v2/index.js index 7582301c814..35491a14cd7 100644 --- a/projects/voltswap-v2/index.js +++ b/projects/voltswap-v2/index.js @@ -1,8 +1,7 @@ const { getUniTVL } = require('../helper/unknownTokens') module.exports = { - meter: { - tvl: getUniTVL({ factory: '0xb33dE8C0843F90655ad6249F20B473a627443d21', chain: 'meter', useDefaultCoreAssets: true, }), - }, + meter: { tvl: getUniTVL({ factory: '0xb33dE8C0843F90655ad6249F20B473a627443d21', useDefaultCoreAssets: true, }), }, + base: { tvl: getUniTVL({ factory: '0x2A5478bE24F9E536cCb91DBF650EFD6cE6C00398', useDefaultCoreAssets: true, }), }, misrepresentedTokens: true, } \ No newline at end of file From ac304a5bbeb874394279120a244ba2b350e8ecde Mon Sep 17 00:00:00 2001 From: Archi Finance <122597109+ArchiFinance@users.noreply.github.com> Date: Mon, 28 Aug 2023 21:03:04 +0800 Subject: [PATCH 1003/1974] Add new pool (#7297) --- projects/archi-finance/index.js | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/projects/archi-finance/index.js b/projects/archi-finance/index.js index d3fe4961367..8173203939f 100644 --- a/projects/archi-finance/index.js +++ b/projects/archi-finance/index.js @@ -12,20 +12,14 @@ const addresses = { "0x7674Ccf6cAE51F20d376644C42cd69EC7d4324f4", // usdt pool "0x179bD8d1d654DB8aa1603f232E284FF8d53a0688", - // usdc pool + // usdc.e pool "0xa7490e0828Ed39DF886b9032ebBF98851193D79c", // wbtc pool "0xee54A31e9759B0F7FDbF48221b72CD9F3aEA00AB", - // dai pool - "0x4262BA30d5c1bba98e9E9fc3c40602a7E09Ca49F", - // link pool - "0xB86a783C329d5D0CE84093757586F5Fd5364cd71", - // uni pool - "0xAf2a336AE86eF90a3958F4bFC6EFc23cD6190951", - // frax pool - "0x2032998a5312B88f6b4d2b86638Be31B20d1B573", - // mim pool - "0xbd70E8712264D6A62a7A6BD255A59992068adCAd" + // wstETH pool + "0x61Ea41f0BffeE903BB90c69b69d4A833c7fb9d8a", + // rETH pool + "0xe0eD03E13C6b92D7555c560123Cb48aBE60713fE", ] } From d4daf599f3ca470a49a014c2ea6d0d991b8f534a Mon Sep 17 00:00:00 2001 From: xiaodong <81516175+javaandfly@users.noreply.github.com> Date: Mon, 28 Aug 2023 21:04:07 +0800 Subject: [PATCH 1004/1974] add navi USDT coin (#7294) --- projects/navi/index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/projects/navi/index.js b/projects/navi/index.js index 35fee63bdd8..229fba18c35 100644 --- a/projects/navi/index.js +++ b/projects/navi/index.js @@ -2,12 +2,14 @@ const ADDRESSES = require('../helper/coreAssets.json') const sui = require("../helper/chain/sui") const reserves = [ - "0xab644b5fd11aa11e930d1c7bc903ef609a9feaf9ffe1b23532ad8441854fbfaf", - "0xeb3903f7748ace73429bd52a70fff278aac1725d3b58afa781f25ce3450ac203", + "0xab644b5fd11aa11e930d1c7bc903ef609a9feaf9ffe1b23532ad8441854fbfaf", // Reserve For SUI + "0xeb3903f7748ace73429bd52a70fff278aac1725d3b58afa781f25ce3450ac203", // Reserve For USDC + "0xb8c5eab02a0202f638958cc79a69a2d30055565caad1684b3c8bbca3bddcb322", // Reserve For USDT ] const decimalShift = { [ADDRESSES.sui.USDC]: -3, // USDC + [ADDRESSES.sui.USDT]: -3, // USDT } From d3cef029b9a7079d419422e9d80d93e7874b29d2 Mon Sep 17 00:00:00 2001 From: bof195 <113489791+bof195@users.noreply.github.com> Date: Mon, 28 Aug 2023 20:06:08 +0700 Subject: [PATCH 1005/1974] add sdk adapter for project liquid finance protocol (#7295) --- projects/liquid-finance-arch/index.js | 35 +++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 projects/liquid-finance-arch/index.js diff --git a/projects/liquid-finance-arch/index.js b/projects/liquid-finance-arch/index.js new file mode 100644 index 00000000000..fa4966eda38 --- /dev/null +++ b/projects/liquid-finance-arch/index.js @@ -0,0 +1,35 @@ +const { queryContract } = require("../helper/chain/cosmos"); +const ADDRESSES = require("../helper/coreAssets.json"); + +const STAKING_CONTRACT = + "archway1p3wrpsrxldc6laecc8r3ck52cmg3chu06mmm3thqvt6exy36f79q575rsq"; +const SWAP_CONTRACT = + "archway1ywv0gxrw3kv25kn9f05dtqf6577fer5pc2vewvgcagpm5p8l4kuqc4qfp6"; + +async function tvl(_, _1, _2, { api }) { + const { chain } = api; + + const statusStakingInfo = await queryContract({ + contract: STAKING_CONTRACT, + chain, + data: { status_info: {} }, + }); + + const statusSwapInfo = await queryContract({ + contract: SWAP_CONTRACT, + chain, + data: { status_info: {} }, + }); + + api.add(ADDRESSES.archway.ARCH, statusStakingInfo.native.amount); + api.add(ADDRESSES.archway.ARCH, statusSwapInfo.liquidity); +} + +module.exports = { + methodology: + "TVL equals the sum of ARCH staked in the Stake Pool and ARCH in the Instant Unstaking Queue, multiplied by the current ARCH price.", + timetravel: false, + archway: { + tvl, + }, +}; From 3337bee391a25067894dca62bc351e76fadf4ede Mon Sep 17 00:00:00 2001 From: Xops Finance <143371015+XopsFinance@users.noreply.github.com> Date: Mon, 28 Aug 2023 20:07:37 +0700 Subject: [PATCH 1006/1974] add xops finance, the dex on opbnb chain (#7293) --- projects/xops-finance/index.js | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 projects/xops-finance/index.js diff --git a/projects/xops-finance/index.js b/projects/xops-finance/index.js new file mode 100644 index 00000000000..a4b175f52c5 --- /dev/null +++ b/projects/xops-finance/index.js @@ -0,0 +1,7 @@ +const {getUniTVL} = require("../helper/unknownTokens"); + +module.exports = { + op_bnb: { + tvl: getUniTVL({ factory: "0x6b5F5C4E0076c5841726a3B20B87Eb0709741842", useDefaultCoreAssets: true,}) + }, +}; \ No newline at end of file From 52d8ca9bd4a6fbfcb2e7c30aabe9f3406b7f1976 Mon Sep 17 00:00:00 2001 From: algofi-infra <95378983+algofi-infra@users.noreply.github.com> Date: Mon, 28 Aug 2023 09:08:19 -0400 Subject: [PATCH 1007/1974] remove defly from algofi project as it is no longer rolls up under algofi (#7292) --- projects/algofi/index.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/projects/algofi/index.js b/projects/algofi/index.js index 00dda959e4f..e0e5746637c 100644 --- a/projects/algofi/index.js +++ b/projects/algofi/index.js @@ -75,16 +75,13 @@ async function staking() { // voting escrow let votingEscrowGlobalState = await getAppGlobalState(900653165) - let deflyState = await getAppGlobalState(641499935) let opulState = await getAppGlobalState(674526408) let totalLockedBank = votingEscrowGlobalState[marketStrings.total_locked] - let totalDefly = deflyState[marketStrings.underlying_cash] - deflyState[marketStrings.underlying_reserves] let totalOpul = opulState[marketStrings.underlying_cash] - opulState[marketStrings.underlying_reserves] const balance = totalLockedBank * price / (10 ** decimals) return { [geckoId]: balance, - defly: totalDefly / 1e6, opulous: totalOpul / 1e10, } } From 9b5f1d0aed8771511157dfac640d17c66e1cc3a1 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 28 Aug 2023 15:14:19 +0200 Subject: [PATCH 1008/1974] Alienbase-1 (#7305) * stableswap * separate stableswap * code refactor --------- Co-authored-by: 0xanimewaifu <0xanimewaifu@gmail.com> --- projects/alienbase-stableswap/index.js | 13 +++++++++++++ projects/alienbase/index.js | 8 +------- projects/helper/coreAssets.json | 3 ++- 3 files changed, 16 insertions(+), 8 deletions(-) create mode 100644 projects/alienbase-stableswap/index.js diff --git a/projects/alienbase-stableswap/index.js b/projects/alienbase-stableswap/index.js new file mode 100644 index 00000000000..f9761d2a15e --- /dev/null +++ b/projects/alienbase-stableswap/index.js @@ -0,0 +1,13 @@ +const pools = Object.values({ + 'aUsdc-Dai': '0x927860797d07b1C46fbBe7f6f73D45C7E1BFBb27', +}) + +async function tvl(_, _b, _cb, { api, }) { + const tokens = await api.multiCall({ abi: 'address[]:getTokens', calls: pools }) + return api.sumTokens({ ownerTokens: tokens.map((t, i) => [t, pools[i]]) }) +} + +module.exports = { + methodology: `Queries balances of StableSwap pools and sums their total value`, + base: { tvl, } +}; \ No newline at end of file diff --git a/projects/alienbase/index.js b/projects/alienbase/index.js index e344d420477..c63f3e5b158 100644 --- a/projects/alienbase/index.js +++ b/projects/alienbase/index.js @@ -2,17 +2,11 @@ const { getUniTVL } = require('../helper/unknownTokens') const ALB = "0x1dd2d631c92b1aCdFCDd51A0F7145A50130050C4"; const FACTORY = "0x3E84D913803b02A4a7f027165E8cA42C14C0FdE7" -const dexTVL = getUniTVL({ - factory: FACTORY, - useDefaultCoreAssets: true, - fetchBalances: true, -}) - module.exports = { misrepresentedTokens: true, methodology: `Uses Uniswap-style factory address to find and price liquidity pairs.`, base: { - tvl: dexTVL, + tvl: getUniTVL({ factory: FACTORY, useDefaultCoreAssets: true, fetchBalances: true, }), } }; diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index 6fd835034d2..bb855720992 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -1351,7 +1351,8 @@ }, "base": { "WETH": "0x4200000000000000000000000000000000000006", - "USDbC": "0xd9aAEc86B65D86f6A7B5B1b0c42FFA531710b6CA" + "USDbC": "0xd9aAEc86B65D86f6A7B5B1b0c42FFA531710b6CA", + "DAI": "0x50c5725949a6f0c72e6c4a641f24049a917db0cb" }, "sei": { "SEI": "usei", From bad609ed85dd0c15062cd07a92dae70e61e0c80f Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 28 Aug 2023 15:43:47 +0200 Subject: [PATCH 1009/1974] Altitude (#7306) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Implement Altitude TVL Across Multiple Chains • Added support to fetch the Total Value Locked (TVL) of Altitude contracts across multiple chains, including Ethereum, BSC, Polygon, Arbitrum, Avax, Optimism, and Fantom. • Introduced a dynamic lookup for chain-specific contract addresses and block numbers. • Optimized the TVL retrieval process by incorporating chain-specific path counts to prevent unnecessary API calls. • Refactored the codebase to align with the new adapter export specification, ensuring each chain's TVL is appropriately nested under its respective chain key. • Handled potential issues with ABI compatibility and chain support. Enhanced error handling to provide more meaningful feedback during testing and debugging. * code refactor --------- Co-authored-by: Christoph Könekamp --- projects/altitude/index.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 projects/altitude/index.js diff --git a/projects/altitude/index.js b/projects/altitude/index.js new file mode 100644 index 00000000000..e2e7a7ab5f5 --- /dev/null +++ b/projects/altitude/index.js @@ -0,0 +1,25 @@ +const contract = '0xF80E51AFb613D764FA61751Affd3313C190A86BB' + +const CHAINS = ["ethereum", "bsc", "polygon", "arbitrum", "avax", "optimism", "fantom"] +const chainPathsAbi = "function chainPaths(uint256) view returns (bool ready, address srcToken, uint16 dstChainId, address dstToken, uint256 remoteLiquidity, uint256 localLiquidity, uint256 rewardPoolSize, address lpToken, bool stopSwap)" + +CHAINS.forEach(chain => { + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const tokens = [] + let hasMoreTokens = false + let currentStart = 0 + const fetchSize = 5 + do { + let res = await api.fetchList({ itemAbi: chainPathsAbi, target: contract, itemCount: fetchSize + currentStart, start: currentStart, permitFailure: true}) + res = res.filter(i => i).map(i => i.srcToken) + tokens.push(...res) + currentStart += fetchSize + hasMoreTokens = res.length === fetchSize + } while (hasMoreTokens) + return api.sumTokens({ owner: contract, tokens }) + } + } +}) + +module.exports.methodology = "Fetches the localLiquidity of each token in the Altitude contract across multiple chains and computes the TVL." From 8253a02a5370dade7284dbb12d24cd8bfdda905c Mon Sep 17 00:00:00 2001 From: define Date: Mon, 28 Aug 2023 14:53:07 +0100 Subject: [PATCH 1010/1974] remove duplicated --- projects/sommelier/index.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/projects/sommelier/index.js b/projects/sommelier/index.js index 45459971199..5a851a3c1f4 100644 --- a/projects/sommelier/index.js +++ b/projects/sommelier/index.js @@ -34,7 +34,7 @@ const REAL_YIELD_SNX = "0xcbf2250f33c4161e18d4a2fa47464520af5216b5"; const REAL_YIELD_ENS = "0x18ea937aba6053bc232d9ae2c42abe7a8a2be440"; const REAL_YIELD_BTC = "0x0274a704a6d9129f90a62ddc6f6024b33ecdad36"; const FRAXIMAL = "0xdbe19d1c3f21b1bb250ca7bdae0687a97b5f77e6"; -const Turbo_swETH = "0xd33dAd974b938744dAC81fE00ac67cb5AA13958E" + const cellarsV2 = [ { id: DEFI_STARS, startBlock: 17181497 }, @@ -47,7 +47,6 @@ const cellarsV2 = [ { id: REAL_YIELD_ENS, startBlock: 17377190 }, { id: REAL_YIELD_BTC, startBlock: 17667535 }, { id: FRAXIMAL, startBlock: 17589948 }, - { id: Turbo_swETH, startBlock: 17892468} ]; // v2.5 Cellars From 9c4f055d4986b802917ef8604880051efcad17f2 Mon Sep 17 00:00:00 2001 From: wael hanfi <39636233+waelhanfi@users.noreply.github.com> Date: Mon, 28 Aug 2023 15:54:35 +0100 Subject: [PATCH 1011/1974] Main (#7308) * add moonbiz project * minor fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/moonbiz/index.js | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 projects/moonbiz/index.js diff --git a/projects/moonbiz/index.js b/projects/moonbiz/index.js new file mode 100644 index 00000000000..e316ff8a826 --- /dev/null +++ b/projects/moonbiz/index.js @@ -0,0 +1,5 @@ +const { uniTvlExport } = require("../helper/unknownTokens"); + +const factory = "0x9B2593839E1390ECee3B348a47B3D93b2Ec2834C"; + +module.exports = uniTvlExport('bsc', factory, { fetchBalances: true, }) From 139df464114d2212c3172f455222101af1494e42 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 28 Aug 2023 16:58:23 +0200 Subject: [PATCH 1012/1974] Paraspace-2 (#7309) * feat: add moonbeam TVL * feat: seperate paraspace-v1 and paraspace-v2 * rename bakc to paraspace * fix: . * blacklist cape again --------- Co-authored-by: jfzhou5 <1241330802@qq.com> Co-authored-by: zhouJF <58616306+jfzhou5@users.noreply.github.com> --- projects/paraspace-ape-staking-v2/index.js | 59 +++++++++++++++++++ .../helper/abis/ApeCoinStaking.json | 3 + projects/paraspace-v2/helper/abis/ERC721.json | 3 + .../helper/abis/UiPoolDataProvider.json | 4 ++ projects/paraspace-v2/helper/abis/index.js | 9 +++ projects/paraspace-v2/helper/address.js | 15 +++++ projects/paraspace-v2/helper/index.js | 50 ++++++++++++++++ projects/paraspace-v2/index.js | 10 ++++ 8 files changed, 153 insertions(+) create mode 100644 projects/paraspace-ape-staking-v2/index.js create mode 100644 projects/paraspace-v2/helper/abis/ApeCoinStaking.json create mode 100644 projects/paraspace-v2/helper/abis/ERC721.json create mode 100644 projects/paraspace-v2/helper/abis/UiPoolDataProvider.json create mode 100644 projects/paraspace-v2/helper/abis/index.js create mode 100644 projects/paraspace-v2/helper/address.js create mode 100644 projects/paraspace-v2/helper/index.js create mode 100644 projects/paraspace-v2/index.js diff --git a/projects/paraspace-ape-staking-v2/index.js b/projects/paraspace-ape-staking-v2/index.js new file mode 100644 index 00000000000..603c53a4352 --- /dev/null +++ b/projects/paraspace-ape-staking-v2/index.js @@ -0,0 +1,59 @@ +const abi = require("../paraspace-v2/helper/abis"); +const address = require("../paraspace-v2/helper/address"); +const sdk = require("@defillama/sdk"); + +async function tvl(_, _1, _cb, { api }) { + const { + UiPoolDataProvider, + PoolAddressProvider, + ApeCoinStaking, + ApeCoin, + P2PPairStaking, + cAPE, + Bayc, + Bakc, + Mayc, + } = address[api.chain]; + let [reservesData] = await api.call({ + target: UiPoolDataProvider, + params: PoolAddressProvider, + abi: abi.UiPoolDataProvider.getReservesData, + }); + + const nMAYC = reservesData.find( + (r) => r.underlyingAsset.toLowerCase() === Mayc.toLowerCase() + ).xTokenAddress; + const nBAYC = reservesData.find( + (r) => r.underlyingAsset.toLowerCase() === Bayc.toLowerCase() + ).xTokenAddress; + const nBAKC = reservesData.find( + (r) => r.underlyingAsset.toLowerCase() === Bakc.toLowerCase() + ).xTokenAddress; + + const stakedAddress = [nBAYC, nMAYC, nBAKC, P2PPairStaking, cAPE]; + + const balances = {}; + + const allStakes = await api.multiCall({ + calls: stakedAddress, + target: ApeCoinStaking, + abi: abi.ApeCoinStaking.getAllStakes, + }); + const otherPools = {} + allStakes.flat().forEach(({ poolId, tokenId, deposited }) => { + if (poolId === '0') { + sdk.util.sumSingleBalance(balances, ApeCoin, deposited, api.chain) + return; + } + otherPools[`${poolId}-${tokenId}`] = deposited + }) + Object.values(otherPools).forEach(v => sdk.util.sumSingleBalance(balances, ApeCoin, v, api.chain)) + + return balances; +} + +module.exports = { + ethereum: { + tvl, + }, +}; diff --git a/projects/paraspace-v2/helper/abis/ApeCoinStaking.json b/projects/paraspace-v2/helper/abis/ApeCoinStaking.json new file mode 100644 index 00000000000..ed67d317f66 --- /dev/null +++ b/projects/paraspace-v2/helper/abis/ApeCoinStaking.json @@ -0,0 +1,3 @@ +{ + "getAllStakes": "function getAllStakes(address _address) external view returns (tuple(uint256 poolId, uint256 tokenId, uint256 deposited, uint256 unclaimed, uint256 rewards24hr, tuple(uint256 mainTokenId, uint256 mainTypePoolId))[])" +} diff --git a/projects/paraspace-v2/helper/abis/ERC721.json b/projects/paraspace-v2/helper/abis/ERC721.json new file mode 100644 index 00000000000..60574c05f11 --- /dev/null +++ b/projects/paraspace-v2/helper/abis/ERC721.json @@ -0,0 +1,3 @@ +{ + "tokenOfOwnerByIndex": "function tokenOfOwnerByIndex(address owner, uint256 index) view returns (uint256)" +} \ No newline at end of file diff --git a/projects/paraspace-v2/helper/abis/UiPoolDataProvider.json b/projects/paraspace-v2/helper/abis/UiPoolDataProvider.json new file mode 100644 index 00000000000..5172ed11532 --- /dev/null +++ b/projects/paraspace-v2/helper/abis/UiPoolDataProvider.json @@ -0,0 +1,4 @@ +{ + "getReservesData": "function getReservesData(address provider) view returns (tuple(address underlyingAsset, string name, string symbol, uint256 decimals, uint256 baseLTVasCollateral, uint256 reserveLiquidationThreshold, uint256 reserveLiquidationBonus, uint256 reserveFactor, bool usageAsCollateralEnabled, bool borrowingEnabled, bool auctionEnabled, bool isActive, bool isFrozen, bool isPaused, bool isAtomicPricing, uint128 liquidityIndex, uint128 variableBorrowIndex, uint128 liquidityRate, uint128 variableBorrowRate, uint40 lastUpdateTimestamp, address xTokenAddress, address variableDebtTokenAddress, address interestRateStrategyAddress, address auctionStrategyAddress, address timeLockStrategyAddress, uint256 availableLiquidity, uint256 totalScaledVariableDebt, uint256 priceInMarketReferenceCurrency, address priceOracle, uint256 variableRateSlope1, uint256 variableRateSlope2, uint256 baseVariableBorrowRate, uint256 optimalUsageRatio, uint128 accruedToTreasury, uint256 borrowCap, uint256 supplyCap, uint8 assetType, tuple(uint256 minThreshold, uint256 midThreshold, uint48 minWaitTime, uint48 midWaitTime, uint48 maxWaitTime, uint48 poolPeriodWaitTime, uint256 poolPeriodLimit, uint256 period, uint128 totalAmountInCurrentPeriod, uint48 lastResetTimestamp) timeLockStrategyData)[], tuple(uint256 marketReferenceCurrencyUnit, int256 marketReferenceCurrencyPriceInUsd, int256 networkBaseTokenPriceInUsd, uint8 networkBaseTokenPriceDecimals))", + "getUniswapV3LpTokenData": "function getUniswapV3LpTokenData(address provider, address lpTokenAddress, uint256 tokenId) view returns (tuple(address token0, address token1, uint24 feeRate, int24 positionTickLower, int24 positionTickUpper, int24 currentTick, uint128 liquidity, uint256 liquidityToken0Amount, uint256 liquidityToken1Amount, uint256 lpFeeToken0Amount, uint256 lpFeeToken1Amount, uint256 tokenPrice, uint256 baseLTVasCollateral, uint256 reserveLiquidationThreshold))" +} diff --git a/projects/paraspace-v2/helper/abis/index.js b/projects/paraspace-v2/helper/abis/index.js new file mode 100644 index 00000000000..a6790156187 --- /dev/null +++ b/projects/paraspace-v2/helper/abis/index.js @@ -0,0 +1,9 @@ +const UiPoolDataProvider = require("./UiPoolDataProvider.json"); +const ERC721 = require("./ERC721.json"); +const ApeCoinStaking = require("./ApeCoinStaking.json"); + +module.exports = { + UiPoolDataProvider, + ERC721, + ApeCoinStaking +}; diff --git a/projects/paraspace-v2/helper/address.js b/projects/paraspace-v2/helper/address.js new file mode 100644 index 00000000000..b51e68b54e4 --- /dev/null +++ b/projects/paraspace-v2/helper/address.js @@ -0,0 +1,15 @@ +module.exports = { + ethereum: { + UniV3Pos: "0xC36442b4a4522E871399CD717aBDD847Ab11FE88", + Bayc: "0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D", + Mayc: "0x60E4d786628Fea6478F785A6d7e704777c86a7c6", + Bakc: "0xba30E5F9Bb24caa003E9f2f0497Ad287FDF95623", + ApeCoinStaking: "0x5954aB967Bc958940b7EB73ee84797Dc8a2AFbb9", + ApeCoin: "0x4d224452801ACEd8B2F0aebE155379bb5D594381", + + UiPoolDataProvider: "0xC60e48ddb7C1af0508332FB42d84B51F981e274c", + PoolAddressProvider: "0xfae470A311f61944346BbB8709CDc2398506Be46", + cAPE: "0x2E9045e7c001056cbcF5eD837F96A8630075a04D", + P2PPairStaking: "0x4F773f3FC89b73B34FB57EBc667a245D5e3812F6", + }, +}; diff --git a/projects/paraspace-v2/helper/index.js b/projects/paraspace-v2/helper/index.js new file mode 100644 index 00000000000..8f336773a8e --- /dev/null +++ b/projects/paraspace-v2/helper/index.js @@ -0,0 +1,50 @@ +const sdk = require("@defillama/sdk"); +const { sumTokens2, } = require('../../helper/unwrapLPs') + +const abi = require("./abis"); +const address = require("./address"); + +async function tvl(_, _1, _cb, { api, }) { + const { UiPoolDataProvider, PoolAddressProvider, UniV3Pos, P2PPairStaking, Bayc, Bakc, Mayc } = address[api.chain] + let [reservesData] = await api.call({ + target: UiPoolDataProvider, + params: PoolAddressProvider, + abi: abi.UiPoolDataProvider.getReservesData, + }) + + const balances = {}; + if (UniV3Pos) { + const isUniV3XToken = i => i.underlyingAsset.toLowerCase() === UniV3Pos.toLowerCase() + + const uniswapOwners = reservesData.filter(isUniV3XToken).map(i => i.xTokenAddress) + reservesData = reservesData.filter(i => !isUniV3XToken(i)) + await sumTokens2({ chain: api.chain, api, balances, owners: uniswapOwners, resolveUniV3: true}) + } + let toa = reservesData.map(i => ([i.underlyingAsset, i.xTokenAddress])) + if (api.chain === "ethereum") { + toa.push(...[[Bayc, P2PPairStaking], [Mayc, P2PPairStaking], [Bakc, P2PPairStaking]]) + } + return sumTokens2({ chain: api.chain, balances, tokensAndOwners: toa, blacklistedTokens: ['0x0000000000000000000000000000000000000001'] }) +} + +async function borrowed(_, _1, _cb, { api, }) { + const { UiPoolDataProvider, PoolAddressProvider, } = address[api.chain] + let [reservesData] = await api.call({ + target: UiPoolDataProvider, + params: PoolAddressProvider, + abi: abi.UiPoolDataProvider.getReservesData, + }) + + const balances = {}; + + reservesData.forEach((d) => { + sdk.util.sumSingleBalance(balances, d.underlyingAsset, d.totalScaledVariableDebt * d.variableBorrowIndex * 1e-27, api.chain) + }) + + return balances; +} + +module.exports = { + tvl, + borrowed, +}; diff --git a/projects/paraspace-v2/index.js b/projects/paraspace-v2/index.js new file mode 100644 index 00000000000..60f2fc9b06c --- /dev/null +++ b/projects/paraspace-v2/index.js @@ -0,0 +1,10 @@ +const { tvl, borrowed } = require("./helper/index"); + +module.exports = { + hallmarks: [], + methodology: `TVL includes ERC-20 and ERC-721 tokens that have been supplied as well as ERC-20 tokens that are supplied for lending.`, + ethereum: { + tvl, + borrowed, + }, +}; From e5b4854d9cfa94207341640ef824452b9f5ceea5 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Mon, 28 Aug 2023 22:54:31 +0100 Subject: [PATCH 1013/1974] add hallmark --- projects/racoon/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/projects/racoon/index.js b/projects/racoon/index.js index 8743246e345..9b74fcd2531 100644 --- a/projects/racoon/index.js +++ b/projects/racoon/index.js @@ -14,4 +14,7 @@ module.exports = yieldHelper({ getReservesABI: 'function getReserves() view returns (uint112 _reserve0, uint112 _reserve1)', }, useDefaultCoreAssets: true, -}) \ No newline at end of file +}), +module.exports.hallmarks = [ + [1693180800, "Rug Pull"] +] \ No newline at end of file From 318c7f5af31399a33469d804e424db6c388a6bf9 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Tue, 29 Aug 2023 02:54:35 +0100 Subject: [PATCH 1014/1974] add adapter --- projects/aerodrome/index.js | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 projects/aerodrome/index.js diff --git a/projects/aerodrome/index.js b/projects/aerodrome/index.js new file mode 100644 index 00000000000..d4cc5635360 --- /dev/null +++ b/projects/aerodrome/index.js @@ -0,0 +1,11 @@ +const { uniTvlExport } = require('../helper/calculateUniTvl.js') + +module.exports = { + misrepresentedTokens: true, + base: { + tvl: uniTvlExport("0x420DD381b31aEf6683db6B902084cB0FFECe40Da", undefined, undefined, { + allPairsLength: 'uint256:allPoolsLength', + allPairs: 'function allPools(uint256) view returns (address)', + }, { fetchBalances: true, useDefaultCoreAssets: true, hasStablePools: true, }), + }, +} \ No newline at end of file From 4b5ff6834c8590a5083f247450a9523cb4f7636c Mon Sep 17 00:00:00 2001 From: magicMax007 <118804823+magicMax007@users.noreply.github.com> Date: Tue, 29 Aug 2023 11:16:28 +0800 Subject: [PATCH 1015/1974] add astarter (#7296) Co-authored-by: magic --- projects/astarter/index.js | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 projects/astarter/index.js diff --git a/projects/astarter/index.js b/projects/astarter/index.js new file mode 100644 index 00000000000..a6af44f7404 --- /dev/null +++ b/projects/astarter/index.js @@ -0,0 +1,38 @@ +// const { getAdaInAddress } = require("../helper/chain/cardano"); +const axios = require("axios"); + + +const POOL_ID = "pool1drkls8s0zzjydyv3qpjsdj58w3sw02w9wg0pckrsnuazyef2hca" +// TODO Waiting for dex to deploy the main network +// const DEX_BATHCER_SCRIPT = "" +// const DEX_POOL_SCRIPT = "" + +async function tvl() { + // const batchOrderLocked = await getAdaInAddress(DEX_BATHCER_SCRIPT) + // const liquidityPoolLocked = await getAdaInAddress(DEX_POOL_SCRIPT) + const ISPOLocked = await getPoolStake(POOL_ID) + return { + // cardano: ISPOLocked + (liquidityPoolLocked * 2) + batchOrderLocked, + cardano: ISPOLocked, + }; +} + +async function getPoolStake(poolId) { + try { + // https://api.koios.rest/#post-/pool_info + const response = await axios.post('https://api.koios.rest/api/v0/pool_info', { + "_pool_bech32_ids": [poolId] + }); + return response.data[0].live_stake / 1e6; + } catch (error) { + console.error('Error fetching pool info:', error); + throw error; + } +} + +module.exports = { + timetravel: false, + cardano: { + tvl, + } +}; From f2c3aa2d7c49439518e792928fd668cad592ac73 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Tue, 29 Aug 2023 04:17:54 +0100 Subject: [PATCH 1016/1974] remove try-catch --- projects/astarter/index.js | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/projects/astarter/index.js b/projects/astarter/index.js index a6af44f7404..3d036211ec0 100644 --- a/projects/astarter/index.js +++ b/projects/astarter/index.js @@ -1,16 +1,14 @@ -// const { getAdaInAddress } = require("../helper/chain/cardano"); const axios = require("axios"); - -const POOL_ID = "pool1drkls8s0zzjydyv3qpjsdj58w3sw02w9wg0pckrsnuazyef2hca" +const POOL_ID = "pool1drkls8s0zzjydyv3qpjsdj58w3sw02w9wg0pckrsnuazyef2hca"; // TODO Waiting for dex to deploy the main network -// const DEX_BATHCER_SCRIPT = "" -// const DEX_POOL_SCRIPT = "" +// const DEX_BATHCER_SCRIPT = ""; +// const DEX_POOL_SCRIPT = ""; async function tvl() { - // const batchOrderLocked = await getAdaInAddress(DEX_BATHCER_SCRIPT) - // const liquidityPoolLocked = await getAdaInAddress(DEX_POOL_SCRIPT) - const ISPOLocked = await getPoolStake(POOL_ID) + // const batchOrderLocked = await getAdaInAddress(DEX_BATHCER_SCRIPT); + // const liquidityPoolLocked = await getAdaInAddress(DEX_POOL_SCRIPT); + const ISPOLocked = await getPoolStake(POOL_ID); return { // cardano: ISPOLocked + (liquidityPoolLocked * 2) + batchOrderLocked, cardano: ISPOLocked, @@ -18,16 +16,10 @@ async function tvl() { } async function getPoolStake(poolId) { - try { - // https://api.koios.rest/#post-/pool_info - const response = await axios.post('https://api.koios.rest/api/v0/pool_info', { - "_pool_bech32_ids": [poolId] - }); - return response.data[0].live_stake / 1e6; - } catch (error) { - console.error('Error fetching pool info:', error); - throw error; - } + const response = await axios.post('https://api.koios.rest/api/v0/pool_info', { + "_pool_bech32_ids": [poolId] + }); + return response.data[0].live_stake / 1e6; } module.exports = { From c8d15b42ed1793673f806f1d6a31c5896a260c9b Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 29 Aug 2023 12:57:19 +0200 Subject: [PATCH 1017/1974] Use ankr api to get token list (#7313) --- package-lock.json | 104 +-- projects/alkemi/index.js | 2 - projects/alyx-finance/index.js | 100 --- projects/ambient-finance/index.js | 5 - projects/avely-finance-staking/index.js | 1 - projects/avely-finance-swap/index.js | 3 - projects/babylon-finance/helper.js | 2 +- projects/babylon-finance/index.js | 1 - projects/bao/index.js | 1 - projects/brewlabs/index.js | 1 - projects/bucket-protocol/index.js | 1 - projects/comb/index.js | 1 - projects/crunchynetwork/index.js | 1 - projects/curve/historical/index.js | 3 +- projects/debridge/index.js | 1 - projects/defi-basket/api.js | 17 +- projects/dehive/index.js | 2 +- projects/deltatheta/index.js | 56 +- projects/dextf/v1.js | 8 +- projects/diamond/index.js | 2 +- projects/dotdot/index.js | 2 - projects/elementfi/index.js | 2 +- projects/entities/a16z-cold.js | 4 +- projects/entities/akg-ventures.js | 4 +- projects/entities/animoca-brands.js | 4 +- projects/entities/arca.js | 4 +- projects/entities/axia8-venture.js | 4 +- projects/entities/binance-labs.js | 4 +- projects/entities/block-one.js | 4 +- projects/entities/blockchain-capital.js | 4 +- projects/entities/chain-capital.js | 4 +- projects/entities/coin98-venture.js | 4 +- projects/entities/defiance-capital.js | 4 +- projects/entities/delphi-digital.js | 4 +- projects/entities/digital-finance-group.js | 4 +- projects/entities/dragonfly-capital.js | 4 +- projects/entities/fbg-capital.js | 4 +- projects/entities/fbi-dprk.js | 4 +- projects/entities/fenbushi-capital.js | 4 +- projects/entities/framework-ventures.js | 4 +- projects/entities/genesis-trading.js | 4 +- projects/entities/id-capital.js | 4 +- projects/entities/jump-capital.js | 4 +- projects/entities/mechanism-capital.js | 4 +- projects/entities/mt-gox.js | 4 +- projects/entities/multi-chain-capital.js | 4 +- projects/entities/ngc-ventures.js | 4 +- projects/entities/pantera-capital.js | 4 +- projects/entities/paradigm-capital.js | 4 +- projects/entities/plutus-vc.js | 4 +- projects/entities/polychain-capital.js | 4 +- projects/entities/silkroad-fbifunds.js | 4 +- projects/entropyfi/index.js | 2 - projects/enzyme/index.js | 1 - projects/equilibrium/api.js | 2 - projects/eris-protocol/index.js | 3 +- projects/ethalend/index.js | 1 - projects/filet/index.js | 1 - projects/fraxfinance/index.js | 21 - projects/friktion/index.js | 5 +- projects/handlefi/index.js | 1 - projects/hector/index.js | 4 +- projects/helper/chain/obyte.js | 4 +- projects/helper/dexpad.js | 2 - projects/helper/env.js | 1 + projects/helper/getChainList.js | 9 +- projects/helper/http.js | 46 +- projects/helper/portedTokens.js | 10 +- projects/helper/solana.js | 8 +- projects/helper/token.js | 136 ++++ projects/helper/treasury.js | 61 +- projects/helper/unwrapLPs.js | 72 +-- projects/helper/utils.js | 11 +- projects/helper/utils/enigma.js | 2 +- projects/helper/utils/solana/layout.js | 2 - projects/hydradx/api.js | 3 +- projects/idex/index.js | 37 +- projects/kogefarm/abi.json | 11 +- projects/kogefarm/helper.js | 267 -------- projects/kogefarm/index.js | 713 +-------------------- projects/kokonut-swap/index.js | 3 +- projects/kromatika/index.js | 1 - projects/maker/index.js | 2 +- projects/metf-finance/index.js | 1 - projects/muuu/tvl.js | 1 - projects/nested/index.js | 1 - projects/nftx/index.js | 2 - projects/ocean-protocol/index.js | 1 - projects/parallel-lending/api.js | 4 - projects/piedao/pieDAO.js | 1 - projects/polymarket.js | 2 +- projects/pwn/index.js | 2 +- projects/quasar/index.js | 21 +- projects/rabbitfinance/index.js | 7 +- projects/railgun/index.js | 7 +- projects/rari/index.js | 8 - projects/rehold-v2/index.js | 14 +- projects/rehold/index.js | 12 +- projects/revest/index.js | 110 ++-- projects/rocketpool/index.js | 3 - projects/sablier-v2/index.js | 3 - projects/sablier/index.js | 4 +- projects/stackswap/api.js | 2 - projects/stakedao/index.js | 2 - projects/sudoswap/index.js | 2 +- projects/superfluid.js | 2 +- projects/tokenlon/index.js | 40 +- projects/treasury/yearn.js | 1 - projects/vector/index.js | 10 - projects/vendor-finance-v2/index.js | 1 - projects/wing.js | 1 - projects/wormhole.js | 3 +- projects/xdai/index.js | 7 +- projects/xdao/apiCache.js | 79 +-- utils/testInteractive.js | 6 +- 115 files changed, 426 insertions(+), 1812 deletions(-) create mode 100644 projects/helper/token.js delete mode 100644 projects/kogefarm/helper.js diff --git a/package-lock.json b/package-lock.json index 400b4081291..96836ba9f01 100644 --- a/package-lock.json +++ b/package-lock.json @@ -785,14 +785,13 @@ } }, "node_modules/@defillama/sdk": { - "version": "4.0.50", - "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.50.tgz", - "integrity": "sha512-cjn6zWCQ+NOgMgtJErD59Aj+r+ukGVCgqT3353P6ylosXrIEMfySdjxcaW7xIwhoT1WxiMbQau492ycWXH7YEg==", + "version": "4.0.51", + "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.51.tgz", + "integrity": "sha512-Pd88pt2FXIgLLANWqKPtDlhdisQYntYBeUAv88BSdahWretvtqkKAv6Ecqz2gXRcTk4mwBpl6K7FU3j0rzY7TQ==", "dependencies": { "@aws-sdk/client-s3": "^3.400.0", "@supercharge/promise-pool": "^2.1.0", "ethers": "^5.4.5", - "lzma-native": "^8.0.6", "node-fetch": "^2.6.7", "p-limit": "^3.0.0", "tron-format-address": "^0.1.11" @@ -4535,23 +4534,6 @@ "integrity": "sha512-zTU3DaZaF3Rt9rhN3uBMGQD3dD2/vFQqnvZCDv4dl5iOzq2IZQqTxu90r4E5J+nP70J3ilqVCrbho2eWaeW8Ow==", "peer": true }, - "node_modules/lzma-native": { - "version": "8.0.6", - "resolved": "https://registry.npmjs.org/lzma-native/-/lzma-native-8.0.6.tgz", - "integrity": "sha512-09xfg67mkL2Lz20PrrDeNYZxzeW7ADtpYFbwSQh9U8+76RIzx5QsJBMy8qikv3hbUPfpy6hqwxt6FcGK81g9AA==", - "hasInstallScript": true, - "dependencies": { - "node-addon-api": "^3.1.0", - "node-gyp-build": "^4.2.1", - "readable-stream": "^3.6.0" - }, - "bin": { - "lzmajs": "bin/lzmajs" - }, - "engines": { - "node": ">=10.0.0" - } - }, "node_modules/make-error": { "version": "1.3.6", "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", @@ -4651,11 +4633,6 @@ "tslib": "^2.0.3" } }, - "node_modules/node-addon-api": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-3.2.1.tgz", - "integrity": "sha512-mmcei9JghVNDYydghQmeDX8KoAm0FAiYyIcUt/N4nhyAipB17pllZQDOJD2fotxABnt4Mdz+dKTO7eftLg4d0A==" - }, "node_modules/node-fetch": { "version": "2.6.7", "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", @@ -4679,6 +4656,7 @@ "version": "4.5.0", "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.5.0.tgz", "integrity": "sha512-2iGbaQBV+ITgCz76ZEjmhUKAKVf7xfY1sRl4UiKQspfZMH2h06SyhNsnSVy50cwkFQDGLyif6m/6uFXHkOZ6rg==", + "optional": true, "bin": { "node-gyp-build": "bin.js", "node-gyp-build-optional": "optional.js", @@ -4840,19 +4818,6 @@ } ] }, - "node_modules/readable-stream": { - "version": "3.6.2", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", - "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", - "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - }, - "engines": { - "node": ">= 6" - } - }, "node_modules/rechoir": { "version": "0.6.2", "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", @@ -5117,14 +5082,6 @@ "url-join": "^4.0.1" } }, - "node_modules/string_decoder": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", - "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", - "dependencies": { - "safe-buffer": "~5.2.0" - } - }, "node_modules/strip-ansi": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", @@ -5413,11 +5370,6 @@ "which-typed-array": "^1.1.2" } }, - "node_modules/util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" - }, "node_modules/uuid": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.0.0.tgz", @@ -6229,14 +6181,13 @@ } }, "@defillama/sdk": { - "version": "4.0.50", - "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.50.tgz", - "integrity": "sha512-cjn6zWCQ+NOgMgtJErD59Aj+r+ukGVCgqT3353P6ylosXrIEMfySdjxcaW7xIwhoT1WxiMbQau492ycWXH7YEg==", + "version": "4.0.51", + "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.51.tgz", + "integrity": "sha512-Pd88pt2FXIgLLANWqKPtDlhdisQYntYBeUAv88BSdahWretvtqkKAv6Ecqz2gXRcTk4mwBpl6K7FU3j0rzY7TQ==", "requires": { "@aws-sdk/client-s3": "^3.400.0", "@supercharge/promise-pool": "^2.1.0", "ethers": "^5.4.5", - "lzma-native": "^8.0.6", "node-fetch": "^2.6.7", "p-limit": "^3.0.0", "tron-format-address": "^0.1.11" @@ -8945,16 +8896,6 @@ "integrity": "sha512-zTU3DaZaF3Rt9rhN3uBMGQD3dD2/vFQqnvZCDv4dl5iOzq2IZQqTxu90r4E5J+nP70J3ilqVCrbho2eWaeW8Ow==", "peer": true }, - "lzma-native": { - "version": "8.0.6", - "resolved": "https://registry.npmjs.org/lzma-native/-/lzma-native-8.0.6.tgz", - "integrity": "sha512-09xfg67mkL2Lz20PrrDeNYZxzeW7ADtpYFbwSQh9U8+76RIzx5QsJBMy8qikv3hbUPfpy6hqwxt6FcGK81g9AA==", - "requires": { - "node-addon-api": "^3.1.0", - "node-gyp-build": "^4.2.1", - "readable-stream": "^3.6.0" - } - }, "make-error": { "version": "1.3.6", "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", @@ -9036,11 +8977,6 @@ "tslib": "^2.0.3" } }, - "node-addon-api": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-3.2.1.tgz", - "integrity": "sha512-mmcei9JghVNDYydghQmeDX8KoAm0FAiYyIcUt/N4nhyAipB17pllZQDOJD2fotxABnt4Mdz+dKTO7eftLg4d0A==" - }, "node-fetch": { "version": "2.6.7", "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", @@ -9052,7 +8988,8 @@ "node-gyp-build": { "version": "4.5.0", "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.5.0.tgz", - "integrity": "sha512-2iGbaQBV+ITgCz76ZEjmhUKAKVf7xfY1sRl4UiKQspfZMH2h06SyhNsnSVy50cwkFQDGLyif6m/6uFXHkOZ6rg==" + "integrity": "sha512-2iGbaQBV+ITgCz76ZEjmhUKAKVf7xfY1sRl4UiKQspfZMH2h06SyhNsnSVy50cwkFQDGLyif6m/6uFXHkOZ6rg==", + "optional": true }, "once": { "version": "1.4.0", @@ -9158,16 +9095,6 @@ "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", "dev": true }, - "readable-stream": { - "version": "3.6.2", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", - "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", - "requires": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - } - }, "rechoir": { "version": "0.6.2", "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", @@ -9340,14 +9267,6 @@ "url-join": "^4.0.1" } }, - "string_decoder": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", - "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", - "requires": { - "safe-buffer": "~5.2.0" - } - }, "strip-ansi": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", @@ -9556,11 +9475,6 @@ "which-typed-array": "^1.1.2" } }, - "util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" - }, "uuid": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.0.0.tgz", diff --git a/projects/alkemi/index.js b/projects/alkemi/index.js index dda8ab3dd4d..e30d6514c4b 100644 --- a/projects/alkemi/index.js +++ b/projects/alkemi/index.js @@ -38,8 +38,6 @@ async function tvl(timestamp, block) { }; const alkQueries = alkCombos(); - //console.log(alkQueries); // for debugging - //console.table(alkQueries); // for debugging const wethEarnOpen = '0x8125afd067094cD573255f82795339b9fe2A40ab'; const wethEarn = '0x1f52453B32BFab737247114D56d756A6c37dd9Ef'; diff --git a/projects/alyx-finance/index.js b/projects/alyx-finance/index.js index cd272ea6ed6..adaef80d5b2 100644 --- a/projects/alyx-finance/index.js +++ b/projects/alyx-finance/index.js @@ -1,5 +1,3 @@ -const { BN } = require("bn.js"); -const { request, gql } = require("graphql-request"); const { sumTokensExport } = require("../helper/unknownTokens"); const masterchefAddress = "0x7Bd2f7641b875872c7c04ee3B426F753C7093aD5"; @@ -7,104 +5,6 @@ const alyxToken = "0x2701C7cBf3220FFF6e6CEaabbCD9B932Eb11E3Ff"; const alyx_bsc_lp = "0xf5Ea0B5AafC6eDACA15909a02C1e16bCaCd74C1e" const treasury = "0x576182b7a1b0bC67701ead28a087228c50Aa0982"; -const marketplace = "https://api.thegraph.com/subgraphs/name/alyxfinance/alyx-marketplace"; -const nftLending = "https://api.thegraph.com/subgraphs/name/alyxfinance/alyx-nft-lending"; -const bonds = "https://api.thegraph.com/subgraphs/name/alyxfinance/alyx-bonds" -const coinflip = "https://api.thegraph.com/subgraphs/name/alyxfinance/alyx-coinflip"; -const roll = "https://api.thegraph.com/subgraphs/name/alyxfinance/alyx-rollgame"; - -const marketplaceQuery = gql` - query volumeStat { - volumeStat(id: "total") { - bid - listing - period - sold - } - } -`; - -const nftLendingQuery = gql` - query volumeStat { - volumeStat(id: "total") { - closeLoan - createLoan - id - liquidateLoan - period - reduceLoan - repayLoan - } - } -`; - -const bondsQuery = gql` - query volumeStat { - volumeStat(id: "total") { - redemption - period - id - creation - } - } -`; - -const coinflipQuery = gql` -query volumeStat { - query coinFlipAllTimeDataAggregateds { - betAmount - token - id - } -} -`; - -async function getMarketplaceData() { - try { - const { volumeStat: data } = await request(marketplace, marketplaceQuery); - data.total = (new BN(data.listing).add(new BN(data.bid)).add(new BN(data.sold))).toString(10) - console.log("marketplace", data) - return data - } catch (err) { - console.error(err.response) - } -} - - -async function getNFTLendingData() { - try { - const { volumeStat: data } = await request(nftLending, nftLendingQuery); - data.total = (new BN(data.closeLoan).add(new BN(data.createLoan)).add(new BN(data.liquidateLoan))).add(new BN(data.reduceLoan)).add(new BN(data.repayLoan)).toString(10) - console.log("NFTlending", data) - return data - } catch (err) { - console.error(err.response) - } -} - -async function getBondsData() { - try { - const { volumeStat: data } = await request(bonds, bondsQuery); - data.total = (new BN(data.redemption).add(new BN(data.creation)).toString(10)); - console.log("bonds", data) - return data - } catch (err) { - console.error(err.response) - } -} - -// Will be used in future -async function totalVolume(timestamp, block) { - try { - const marketplaceVolume = await getMarketplaceData(); - const nftlendingVolume = await getNFTLendingData(); - const bondsVolume = await getBondsData(); - return marketplaceVolume.total.add(nftlendingVolume.total.add(bondsVolume.total)) - } catch (err) { - console.error(err.response) - } -} - module.exports = { misrepresentedTokens: true, bsc: { diff --git a/projects/ambient-finance/index.js b/projects/ambient-finance/index.js index d1bfef53300..54dabd9607c 100644 --- a/projects/ambient-finance/index.js +++ b/projects/ambient-finance/index.js @@ -1,12 +1,7 @@ const { sumTokens2 } = require('../helper/unwrapLPs'); -const { covalentGetTokens } = require("../helper/http"); const { cachedGraphQuery } = require("../helper/cache"); const vault = "0xAaAaAAAaA24eEeb8d57D431224f73832bC34f688" -const tvlV1 = async (_, _1, _2, { api }) => { - const tokens = await covalentGetTokens(vault, api.chain) - return sumTokens2({ api, owner: vault, tokens, }) -} async function tvl(_, _b, _cb, { api, }) { diff --git a/projects/avely-finance-staking/index.js b/projects/avely-finance-staking/index.js index 2c90a7a32ca..032a81e5c0a 100644 --- a/projects/avely-finance-staking/index.js +++ b/projects/avely-finance-staking/index.js @@ -44,7 +44,6 @@ function prepareQuery(fields) { }); }); - //console.log(query) return query; } diff --git a/projects/avely-finance-swap/index.js b/projects/avely-finance-swap/index.js index 22c8ce7e8df..d00365cfa19 100644 --- a/projects/avely-finance-swap/index.js +++ b/projects/avely-finance-swap/index.js @@ -22,10 +22,8 @@ async function tvl() { [STZIL_CONTRACT_ADDRESS_LEGACY] ] }); - //console.log(query) const data = await call(query) - //console.log(data) //(* POOL token -> Pair{zil_reserve, token_reserve} *) //https://github.com/avely-finance/avely-contracts/blob/main/contracts/source/aswap.scilla#L301 @@ -39,7 +37,6 @@ async function tvl() { // [STZIL_CONTRACT_ADDRESS]: BigNumber(token_reserve).shiftedBy(DECIMALS * -1), 'zilliqa': zil_reserve / 1e12, } - //console.log(balances) return balances } diff --git a/projects/babylon-finance/helper.js b/projects/babylon-finance/helper.js index 963d56cda36..7abdcfe65af 100644 --- a/projects/babylon-finance/helper.js +++ b/projects/babylon-finance/helper.js @@ -38,7 +38,7 @@ async function unwrapUniswapV3LPs(balances, univ3_Positions, block, chain = 'eth }); } catch (e) { - console.log(`Failed to get data for LP token vault at ${univ3_Position.vault} on chain ${chain}`) + sdk.log(`Failed to get data for LP token vault at ${univ3_Position.vault} on chain ${chain}`) throw e } })) diff --git a/projects/babylon-finance/index.js b/projects/babylon-finance/index.js index 052152b42c5..2aab4e84f6d 100644 --- a/projects/babylon-finance/index.js +++ b/projects/babylon-finance/index.js @@ -17,7 +17,6 @@ async function tvl(timestamp, ethBlock, chainBlocks) { block: ethBlock, chain: 'ethereum' }) - // console.log('gardens (public and private)', gardens) const gardensToIgnore = ["0xB0EE8C61c78aA9B7ED138bcC6bce7ABeC8470038", "0xF0AF08d7bc6e4aE42b84771aE3f9DA7D8e58b083", "0x4f5721Ce7F02586D67eA0CC6003e889E974DC9A0", "0xab051B83eecA40084855e289E2531D22F9AffD21"] gardens = gardens.filter(i => !gardensToIgnore.includes(i)) diff --git a/projects/bao/index.js b/projects/bao/index.js index 99f5b39a741..a8e39d745db 100644 --- a/projects/bao/index.js +++ b/projects/bao/index.js @@ -60,7 +60,6 @@ async function getTvl(chain, block, ethBlock) { sdk.util.sumSingleBalance(ethBalances, bareToken, balance) }) - // console.log(JSON.stringify(ethBalances, null, 2)); // resolve LPs if (chain === 'xdai') await Promise.all([ diff --git a/projects/brewlabs/index.js b/projects/brewlabs/index.js index 19854398771..0f7c826de5e 100644 --- a/projects/brewlabs/index.js +++ b/projects/brewlabs/index.js @@ -39,7 +39,6 @@ async function getStakingPools(chain, poolType) { async function _getPools() { const poolTypeStr = poolType === 'pool2' ? 'farms' : 'pools' const pools = await post(`${api_endpoint}/${poolTypeStr}`, { chainId: chains[chain]}) - console.log(pools, `brewlabs ${chain} ${poolType} pools: ${pools.length}`) setCache(`brewlabs/pools`, chain, pools) return pools } diff --git a/projects/bucket-protocol/index.js b/projects/bucket-protocol/index.js index 893a04fffc1..e05abb313a9 100644 --- a/projects/bucket-protocol/index.js +++ b/projects/bucket-protocol/index.js @@ -94,7 +94,6 @@ async function tvl(_, _1, _2, { api }) { (token_y * kriyaStakedList[index]) / lsp_supply.fields.value ); - console.log(x, y) if (x !== BUCK) api.add(x, xVal); if (y !== BUCK) api.add(y, yVal); } diff --git a/projects/comb/index.js b/projects/comb/index.js index 14d8c3d12a7..d8150e82c11 100644 --- a/projects/comb/index.js +++ b/projects/comb/index.js @@ -48,7 +48,6 @@ async function tvl(_, _1, _2, { api }) { delete balances[token] } }) - console.log(prices, balances) return balances } diff --git a/projects/crunchynetwork/index.js b/projects/crunchynetwork/index.js index 277cd4cd045..1f60ebab7c7 100644 --- a/projects/crunchynetwork/index.js +++ b/projects/crunchynetwork/index.js @@ -7,7 +7,6 @@ const { PromisePool } = require('@supercharge/promise-pool') async function fetchFarmsTvl() { const farms = await get(RPC_ENDPOINT + '/v1/contracts/KT1KnuE87q1EKjPozJ5sRAjQA24FPsP57CE3/bigmaps/farms/keys?limit=1000') const items = farms.map(farm => [farm.value.poolToken.address, farm.value.poolBalance]).filter(item => item[1] !== "0") - console.log("items", items) return getAllLPToTez(items); } diff --git a/projects/curve/historical/index.js b/projects/curve/historical/index.js index f08307340c1..3b94eb94e86 100644 --- a/projects/curve/historical/index.js +++ b/projects/curve/historical/index.js @@ -5,6 +5,7 @@ const axios = require("axios"); const web3 = new Web3(`https://eth.llamarpc.com`); const abis = require('./abis.js') const { toUSDTBalances } = require('../../helper/balances') +const sdk = require('@defillama/sdk') let swaps = [ @@ -192,7 +193,7 @@ async function tvlFunc(timestamp, block) { tvl += parseFloat(poolAmount ) } } catch(e){ - console.log(item.name, i, "failed") + sdk.log(item.name, i, "failed") } }) ) diff --git a/projects/debridge/index.js b/projects/debridge/index.js index 085f7fe0beb..7b44e2e076d 100644 --- a/projects/debridge/index.js +++ b/projects/debridge/index.js @@ -20,7 +20,6 @@ function chainTvl(chain) { const url = `${http_api_url}?chainId=${chainIds[chain]}`; const debridge_response = await getConfig('debridge/'+chain,url); - // console.log(debridge_response) const tokensAndOwners = debridge_response .filter(t => !t.tokenName.startsWith('deBridge ')) .map(t => [t.tokenAddress, debridgeGate]); diff --git a/projects/defi-basket/api.js b/projects/defi-basket/api.js index b94b845549e..35559f2bb62 100644 --- a/projects/defi-basket/api.js +++ b/projects/defi-basket/api.js @@ -1,6 +1,4 @@ const { sumTokens2 } = require('../helper/unwrapLPs') -const { covalentGetTokens } = require('../helper/http') -const { PromisePool } = require('@supercharge/promise-pool') const factory = '0xee13c86ee4eb1ec3a05e2cc3ab70576f31666b3b' const blacklistedTokens = [ @@ -13,20 +11,7 @@ async function tvl(_, _1,_2, { api }) { lengthAbi: abis.tokenCounter, target: factory, }) - const tokensAndOwners = [] - const { errors } = await PromisePool - .withConcurrency(31) - .for(wallets) - .process(addWallet) - - if (errors && errors.length) - throw errors[0] - - return sumTokens2({ tokensAndOwners, api, blacklistedTokens, }); - - async function addWallet(wallet) { - (await covalentGetTokens(wallet, 'polygon')).forEach(i => tokensAndOwners.push([i, wallet])) - } + return sumTokens2({ owners: wallets, fetchCoValentTokens: true, api, blacklistedTokens, }); } module.exports = { diff --git a/projects/dehive/index.js b/projects/dehive/index.js index b4d448f0386..d3c800c2aaf 100644 --- a/projects/dehive/index.js +++ b/projects/dehive/index.js @@ -201,7 +201,7 @@ async function chainTvl(chain, chainBlocks, exportType) { calculateTvlFunction = impulseStakingTvl; break; default: - console.log('unknown tvl type', JSON.stringify(staking, null, 4)); + sdk.log('unknown tvl type', JSON.stringify(staking, null, 4)); return; } if ( diff --git a/projects/deltatheta/index.js b/projects/deltatheta/index.js index 3c48fab2203..39df1c05ef6 100644 --- a/projects/deltatheta/index.js +++ b/projects/deltatheta/index.js @@ -1,6 +1,3 @@ -const sdk = require('@defillama/sdk'); -const { covalentGetTokens } = require('../helper/http'); - // Delta.theta Factory ABI (for needed calls) const factoryABI = require('./factory.abi'); const { sumTokens2 } = require('../helper/unwrapLPs'); @@ -8,55 +5,14 @@ const { sumTokens2 } = require('../helper/unwrapLPs'); // Delta.theta Factory Address (On all chains) const FACTORY_ADDRESS = '0x000000000092126dc1bcec881165f92169733106'; -// Idk why, but convenient [...Array(10).keys()] method is not working in adapter testing -const range = (n) => Array.from({ length: n }, (_, i) => i); - // TVL function generator (for BSC & POLYGON chains) -function tvl(chain) { - return async (_, __, chainBlocks) => { - // Prepare transform function for the selected chain - const transform = i => `${chain}:${i}`; - - // Parse factory's pairs length - const pairsLength = (await sdk.api.abi.call({ - abi: factoryABI.pairsLength, - chain, - target: FACTORY_ADDRESS, - params: [], - block: chainBlocks[chain], - })).output; - - const pairsOutput = (await sdk.api.abi.multiCall({ - abi: factoryABI.pairsList, - chain, - calls: range(pairsLength).map((index) => ({ - target: FACTORY_ADDRESS, - params: [index] - })), - block: chainBlocks[chain], - requery: true - })).output - const pairs = pairsOutput.map(result => result.output.toLowerCase()) - console.log(chain, pairs) - const toa = [] - - await Promise.all(range(pairsLength).map( - async (i) => { - // Parse tokens list for each of pair addresses - const tokens = await covalentGetTokens(pairs[i], chain); - tokens.forEach(t => toa.push([t, pairs[i]])) - })); - - return sumTokens2({ chain, block: chainBlocks[chain], tokensAndOwners: toa, }); - }; +async function tvl(_, __, chainBlocks, { api }) { + const pairs = await api.fetchList({ lengthAbi: factoryABI.pairsLength, itemAbi: factoryABI.pairsList, target: FACTORY_ADDRESS }) + return sumTokens2({ api, owners: pairs, fetchCoValentTokens: true, blacklistedTokens: ['0x3a06212763caf64bf101daa4b0cebb0cd393fa1a'], permitFailure: true }); } + module.exports = { methodology: 'Parsing the balances of all tokens on the pair addresses of decentralized exchange Delta.theta', - start: 0, - bsc: { - tvl: tvl('bsc'), - }, - polygon: { - tvl: tvl('polygon'), - }, + bsc: { tvl }, + polygon: { tvl }, }; diff --git a/projects/dextf/v1.js b/projects/dextf/v1.js index 77de8b5ef36..9be4c382fd2 100644 --- a/projects/dextf/v1.js +++ b/projects/dextf/v1.js @@ -1,9 +1,5 @@ -const { sumTokens2 } = require('../helper/unwrapLPs') -const { covalentGetTokens } = require('../helper/http') +const { sumTokensExport } = require('../helper/unwrapLPs') const vaultAddress = "0x86C077092018077Df34FF44D5D7d3f9A2DF03bEf" -module.exports = async function tvl(timestamp, block) { - const tokens = await covalentGetTokens(vaultAddress) - return sumTokens2({ block, owner: vaultAddress, tokens,}) -}; +module.exports = { ethereum: { tvl: sumTokensExport({ owner: vaultAddress, fetchCoValentTokens: true, }), } } diff --git a/projects/diamond/index.js b/projects/diamond/index.js index c2fb34ce3d4..2bd2bb78131 100644 --- a/projects/diamond/index.js +++ b/projects/diamond/index.js @@ -77,7 +77,7 @@ async function getTotalPositionValue(block) { positionValues += +positionValue; } catch (e) { - console.log('trouble fetchng info for ', id) + sdk.log('trouble fetchng info for ', id) console.error(e) } }) diff --git a/projects/dotdot/index.js b/projects/dotdot/index.js index 12dd3c075c2..a905c9f0d7a 100644 --- a/projects/dotdot/index.js +++ b/projects/dotdot/index.js @@ -113,13 +113,11 @@ async function resolveEpsLP({ try { factory = (await sdk.api.abi.call({ target: token, abi: abis.factory, chain, block })).output } catch { - console.log('TRYING OTHER ABI') factory = (await sdk.api.abi.call({ target: token, abi: abis.factory2, chain, block })).output } try { minter = (await sdk.api.abi.call({ target: token, abi: abis.minter, chain, block })).output } catch { - console.log('no minter') return } // node test.js projects/dotdot/index.js diff --git a/projects/elementfi/index.js b/projects/elementfi/index.js index a600ce884f4..3d75438b06c 100644 --- a/projects/elementfi/index.js +++ b/projects/elementfi/index.js @@ -62,7 +62,7 @@ async function tvl(timestamp, block, _, { api }) { balances[token.toLowerCase()] = balances[token.toLowerCase()] ? new bn(balances[token.toLowerCase()]).plus(poolTokens.balances[i]) : poolTokens.balances[i]; } } catch (e) { - console.log(e) + sdk.log(e) } })) diff --git a/projects/entities/a16z-cold.js b/projects/entities/a16z-cold.js index 58642a2fb01..821ab2f252d 100644 --- a/projects/entities/a16z-cold.js +++ b/projects/entities/a16z-cold.js @@ -1,4 +1,4 @@ -const { cexExports } = require('../helper/cex') +const { treasuryExports } = require("../helper/treasury") const config = { ethereum: { @@ -11,4 +11,4 @@ const config = { }, } -module.exports = cexExports(config) \ No newline at end of file +module.exports = treasuryExports(config) \ No newline at end of file diff --git a/projects/entities/akg-ventures.js b/projects/entities/akg-ventures.js index 9bee71c5249..3e73dd85129 100644 --- a/projects/entities/akg-ventures.js +++ b/projects/entities/akg-ventures.js @@ -1,4 +1,4 @@ -const { cexExports } = require('../helper/cex') +const { treasuryExports } = require("../helper/treasury") const config = { ethereum: { @@ -9,4 +9,4 @@ const config = { }, } -module.exports = cexExports(config) \ No newline at end of file +module.exports = treasuryExports(config) \ No newline at end of file diff --git a/projects/entities/animoca-brands.js b/projects/entities/animoca-brands.js index ffce59fb8c4..10980983c34 100644 --- a/projects/entities/animoca-brands.js +++ b/projects/entities/animoca-brands.js @@ -1,4 +1,4 @@ -const { cexExports } = require('../helper/cex') +const { treasuryExports } = require("../helper/treasury") const config = { ethereum: { @@ -9,4 +9,4 @@ const config = { }, } -module.exports = cexExports(config) \ No newline at end of file +module.exports = treasuryExports(config) \ No newline at end of file diff --git a/projects/entities/arca.js b/projects/entities/arca.js index 3a88c096408..3cfe10e5d09 100644 --- a/projects/entities/arca.js +++ b/projects/entities/arca.js @@ -1,4 +1,4 @@ -const { cexExports } = require('../helper/cex') +const { treasuryExports } = require("../helper/treasury") const config = { ethereum: { @@ -19,4 +19,4 @@ const config = { ], }, } -module.exports = cexExports(config) \ No newline at end of file +module.exports = treasuryExports(config) \ No newline at end of file diff --git a/projects/entities/axia8-venture.js b/projects/entities/axia8-venture.js index 5bd34c5bece..0af4bfeefaf 100644 --- a/projects/entities/axia8-venture.js +++ b/projects/entities/axia8-venture.js @@ -1,4 +1,4 @@ -const { cexExports } = require('../helper/cex') +const { treasuryExports } = require("../helper/treasury") const config = { ethereum: { @@ -14,4 +14,4 @@ const config = { }, } -module.exports = cexExports(config) \ No newline at end of file +module.exports = treasuryExports(config) \ No newline at end of file diff --git a/projects/entities/binance-labs.js b/projects/entities/binance-labs.js index 24f8d7b6738..2e7162829f0 100644 --- a/projects/entities/binance-labs.js +++ b/projects/entities/binance-labs.js @@ -1,4 +1,4 @@ -const { cexExports } = require('../helper/cex') +const { treasuryExports } = require("../helper/treasury") const config = { ethereum: { @@ -9,4 +9,4 @@ const config = { }, } -module.exports = cexExports(config) \ No newline at end of file +module.exports = treasuryExports(config) \ No newline at end of file diff --git a/projects/entities/block-one.js b/projects/entities/block-one.js index f21dc32d1f2..211db25ba6c 100644 --- a/projects/entities/block-one.js +++ b/projects/entities/block-one.js @@ -1,4 +1,4 @@ -const { cexExports } = require('../helper/cex') +const { treasuryExports } = require("../helper/treasury") const config = { ethereum: { @@ -9,4 +9,4 @@ const config = { }, } -module.exports = cexExports(config) \ No newline at end of file +module.exports = treasuryExports(config) \ No newline at end of file diff --git a/projects/entities/blockchain-capital.js b/projects/entities/blockchain-capital.js index b08e4bf1beb..6853a9c2c19 100644 --- a/projects/entities/blockchain-capital.js +++ b/projects/entities/blockchain-capital.js @@ -1,4 +1,4 @@ -const { cexExports } = require('../helper/cex') +const { treasuryExports } = require("../helper/treasury") const config = { ethereum: { @@ -11,4 +11,4 @@ const config = { }, } -module.exports = cexExports(config) \ No newline at end of file +module.exports = treasuryExports(config) \ No newline at end of file diff --git a/projects/entities/chain-capital.js b/projects/entities/chain-capital.js index b4a544351ce..8955b5b6fa5 100644 --- a/projects/entities/chain-capital.js +++ b/projects/entities/chain-capital.js @@ -1,4 +1,4 @@ -const { cexExports } = require('../helper/cex') +const { treasuryExports } = require("../helper/treasury") const config = { ethereum: { @@ -19,4 +19,4 @@ const config = { }, } -module.exports = cexExports(config) \ No newline at end of file +module.exports = treasuryExports(config) \ No newline at end of file diff --git a/projects/entities/coin98-venture.js b/projects/entities/coin98-venture.js index c09aff9559b..64ed6ff4f9a 100644 --- a/projects/entities/coin98-venture.js +++ b/projects/entities/coin98-venture.js @@ -1,4 +1,4 @@ -const { cexExports } = require('../helper/cex') +const { treasuryExports } = require("../helper/treasury") const config = { ethereum: { @@ -25,4 +25,4 @@ const config = { }, } -module.exports = cexExports(config) \ No newline at end of file +module.exports = treasuryExports(config) \ No newline at end of file diff --git a/projects/entities/defiance-capital.js b/projects/entities/defiance-capital.js index 92043e314d7..fbc4bac0b09 100644 --- a/projects/entities/defiance-capital.js +++ b/projects/entities/defiance-capital.js @@ -1,4 +1,4 @@ -const { cexExports } = require('../helper/cex') +const { treasuryExports } = require("../helper/treasury") const config = { ethereum: { @@ -29,4 +29,4 @@ const config = { }, } -module.exports = cexExports(config) \ No newline at end of file +module.exports = treasuryExports(config) \ No newline at end of file diff --git a/projects/entities/delphi-digital.js b/projects/entities/delphi-digital.js index 3e2938aa339..a86340d3eda 100644 --- a/projects/entities/delphi-digital.js +++ b/projects/entities/delphi-digital.js @@ -1,4 +1,4 @@ -const { cexExports } = require('../helper/cex') +const { treasuryExports } = require("../helper/treasury") const config = { ethereum: { @@ -19,4 +19,4 @@ const config = { }, } -module.exports = cexExports(config) \ No newline at end of file +module.exports = treasuryExports(config) \ No newline at end of file diff --git a/projects/entities/digital-finance-group.js b/projects/entities/digital-finance-group.js index 88a171642b0..1a09d213127 100644 --- a/projects/entities/digital-finance-group.js +++ b/projects/entities/digital-finance-group.js @@ -1,4 +1,4 @@ -const { cexExports } = require('../helper/cex') +const { treasuryExports } = require("../helper/treasury") const config = { ethereum: { @@ -19,4 +19,4 @@ const config = { }, } -module.exports = cexExports(config) \ No newline at end of file +module.exports = treasuryExports(config) \ No newline at end of file diff --git a/projects/entities/dragonfly-capital.js b/projects/entities/dragonfly-capital.js index ab3e8939e83..7b1e3c2ed25 100644 --- a/projects/entities/dragonfly-capital.js +++ b/projects/entities/dragonfly-capital.js @@ -1,4 +1,4 @@ -const { cexExports } = require('../helper/cex') +const { treasuryExports } = require("../helper/treasury") const config = { ethereum: { @@ -15,4 +15,4 @@ const config = { }, } -module.exports = cexExports(config) \ No newline at end of file +module.exports = treasuryExports(config) \ No newline at end of file diff --git a/projects/entities/fbg-capital.js b/projects/entities/fbg-capital.js index bbeb547dfa0..9793937d6f1 100644 --- a/projects/entities/fbg-capital.js +++ b/projects/entities/fbg-capital.js @@ -1,4 +1,4 @@ -const { cexExports } = require('../helper/cex') +const { treasuryExports } = require("../helper/treasury") const config = { ethereum: { @@ -15,4 +15,4 @@ const config = { }, } -module.exports = cexExports(config) \ No newline at end of file +module.exports = treasuryExports(config) \ No newline at end of file diff --git a/projects/entities/fbi-dprk.js b/projects/entities/fbi-dprk.js index 2b717134e93..cab5e937732 100644 --- a/projects/entities/fbi-dprk.js +++ b/projects/entities/fbi-dprk.js @@ -1,4 +1,4 @@ -const { cexExports } = require('../helper/cex') +const { treasuryExports } = require("../helper/treasury") const config = { bitcoin: { @@ -13,4 +13,4 @@ const config = { }, } -module.exports = cexExports(config) \ No newline at end of file +module.exports = treasuryExports(config) \ No newline at end of file diff --git a/projects/entities/fenbushi-capital.js b/projects/entities/fenbushi-capital.js index cf891120209..1554a127c95 100644 --- a/projects/entities/fenbushi-capital.js +++ b/projects/entities/fenbushi-capital.js @@ -1,4 +1,4 @@ -const { cexExports } = require('../helper/cex') +const { treasuryExports } = require("../helper/treasury") const config = { ethereum: { @@ -15,4 +15,4 @@ const config = { }, } -module.exports = cexExports(config) \ No newline at end of file +module.exports = treasuryExports(config) \ No newline at end of file diff --git a/projects/entities/framework-ventures.js b/projects/entities/framework-ventures.js index 7f966027618..c9ee2e14b40 100644 --- a/projects/entities/framework-ventures.js +++ b/projects/entities/framework-ventures.js @@ -1,4 +1,4 @@ -const { cexExports } = require('../helper/cex') +const { treasuryExports } = require("../helper/treasury") const config = { ethereum: { @@ -8,4 +8,4 @@ const config = { }, } -module.exports = cexExports(config) \ No newline at end of file +module.exports = treasuryExports(config) \ No newline at end of file diff --git a/projects/entities/genesis-trading.js b/projects/entities/genesis-trading.js index b81ca876135..9db63c5cbb4 100644 --- a/projects/entities/genesis-trading.js +++ b/projects/entities/genesis-trading.js @@ -1,4 +1,4 @@ -const { cexExports } = require('../helper/cex') +const { treasuryExports } = require("../helper/treasury") const config = { ethereum: { @@ -22,4 +22,4 @@ const config = { }, } -module.exports = cexExports(config) \ No newline at end of file +module.exports = treasuryExports(config) \ No newline at end of file diff --git a/projects/entities/id-capital.js b/projects/entities/id-capital.js index bf2e8dfb902..ef223011099 100644 --- a/projects/entities/id-capital.js +++ b/projects/entities/id-capital.js @@ -1,4 +1,4 @@ -const { cexExports } = require('../helper/cex') +const { treasuryExports } = require("../helper/treasury") const config = { ethereum: { @@ -31,4 +31,4 @@ const config = { }, } -module.exports = cexExports(config) \ No newline at end of file +module.exports = treasuryExports(config) \ No newline at end of file diff --git a/projects/entities/jump-capital.js b/projects/entities/jump-capital.js index bc480ed7afb..9beb7bf1dfd 100644 --- a/projects/entities/jump-capital.js +++ b/projects/entities/jump-capital.js @@ -1,5 +1,5 @@ -const { cexExports } = require('../helper/cex') +const { treasuryExports } = require("../helper/treasury") const config = { ethereum: { @@ -22,4 +22,4 @@ const config = { }, } -module.exports = cexExports(config) \ No newline at end of file +module.exports = treasuryExports(config) \ No newline at end of file diff --git a/projects/entities/mechanism-capital.js b/projects/entities/mechanism-capital.js index 032dee922f4..9ba8906dcb7 100644 --- a/projects/entities/mechanism-capital.js +++ b/projects/entities/mechanism-capital.js @@ -1,4 +1,4 @@ -const { cexExports } = require('../helper/cex') +const { treasuryExports } = require("../helper/treasury") const config = { ethereum: { @@ -10,4 +10,4 @@ const config = { }, } -module.exports = cexExports(config) \ No newline at end of file +module.exports = treasuryExports(config) \ No newline at end of file diff --git a/projects/entities/mt-gox.js b/projects/entities/mt-gox.js index 3adb8f92247..df5b55172cd 100644 --- a/projects/entities/mt-gox.js +++ b/projects/entities/mt-gox.js @@ -1,4 +1,4 @@ -const { cexExports } = require('../helper/cex') +const { treasuryExports } = require("../helper/treasury") const config = { bitcoin: { @@ -11,4 +11,4 @@ const config = { }, } -module.exports = cexExports(config) \ No newline at end of file +module.exports = treasuryExports(config) \ No newline at end of file diff --git a/projects/entities/multi-chain-capital.js b/projects/entities/multi-chain-capital.js index f345ba0ea67..826886250bb 100644 --- a/projects/entities/multi-chain-capital.js +++ b/projects/entities/multi-chain-capital.js @@ -1,4 +1,4 @@ -const { cexExports } = require('../helper/cex') +const { treasuryExports } = require("../helper/treasury") const config = { ethereum: { @@ -28,4 +28,4 @@ const config = { }, } -module.exports = cexExports(config) \ No newline at end of file +module.exports = treasuryExports(config) \ No newline at end of file diff --git a/projects/entities/ngc-ventures.js b/projects/entities/ngc-ventures.js index 22f732c1cde..844a2d886f4 100644 --- a/projects/entities/ngc-ventures.js +++ b/projects/entities/ngc-ventures.js @@ -1,4 +1,4 @@ -const { cexExports } = require('../helper/cex') +const { treasuryExports } = require("../helper/treasury") const config = { ethereum: { @@ -28,4 +28,4 @@ const config = { }, } -module.exports = cexExports(config) \ No newline at end of file +module.exports = treasuryExports(config) \ No newline at end of file diff --git a/projects/entities/pantera-capital.js b/projects/entities/pantera-capital.js index 11a1f6c5146..bf5fa494ef0 100644 --- a/projects/entities/pantera-capital.js +++ b/projects/entities/pantera-capital.js @@ -1,4 +1,4 @@ -const { cexExports } = require('../helper/cex') +const { treasuryExports } = require("../helper/treasury") const config = { ethereum: { @@ -9,4 +9,4 @@ const config = { }, } -module.exports = cexExports(config) \ No newline at end of file +module.exports = treasuryExports(config) \ No newline at end of file diff --git a/projects/entities/paradigm-capital.js b/projects/entities/paradigm-capital.js index d70a67f182f..87bf71148c8 100644 --- a/projects/entities/paradigm-capital.js +++ b/projects/entities/paradigm-capital.js @@ -1,4 +1,4 @@ -const { cexExports } = require('../helper/cex') +const { treasuryExports } = require("../helper/treasury") const config = { ethereum: { @@ -12,4 +12,4 @@ const config = { }, } -module.exports = cexExports(config) \ No newline at end of file +module.exports = treasuryExports(config) \ No newline at end of file diff --git a/projects/entities/plutus-vc.js b/projects/entities/plutus-vc.js index b14fd8ea902..8c56bcb1d03 100644 --- a/projects/entities/plutus-vc.js +++ b/projects/entities/plutus-vc.js @@ -1,4 +1,4 @@ -const { cexExports } = require('../helper/cex') +const { treasuryExports } = require("../helper/treasury") const config = { ethereum: { @@ -13,4 +13,4 @@ const config = { }, } -module.exports = cexExports(config) \ No newline at end of file +module.exports = treasuryExports(config) \ No newline at end of file diff --git a/projects/entities/polychain-capital.js b/projects/entities/polychain-capital.js index 9e513bd9273..ee4cd1560f5 100644 --- a/projects/entities/polychain-capital.js +++ b/projects/entities/polychain-capital.js @@ -1,4 +1,4 @@ -const { cexExports } = require('../helper/cex') +const { treasuryExports } = require("../helper/treasury") const config = { ethereum: { @@ -10,4 +10,4 @@ const config = { } -module.exports = cexExports(config) \ No newline at end of file +module.exports = treasuryExports(config) \ No newline at end of file diff --git a/projects/entities/silkroad-fbifunds.js b/projects/entities/silkroad-fbifunds.js index 3adb8f92247..df5b55172cd 100644 --- a/projects/entities/silkroad-fbifunds.js +++ b/projects/entities/silkroad-fbifunds.js @@ -1,4 +1,4 @@ -const { cexExports } = require('../helper/cex') +const { treasuryExports } = require("../helper/treasury") const config = { bitcoin: { @@ -11,4 +11,4 @@ const config = { }, } -module.exports = cexExports(config) \ No newline at end of file +module.exports = treasuryExports(config) \ No newline at end of file diff --git a/projects/entropyfi/index.js b/projects/entropyfi/index.js index 3f7373cd0e9..7beb9c6df31 100644 --- a/projects/entropyfi/index.js +++ b/projects/entropyfi/index.js @@ -31,7 +31,6 @@ const poolsTvl = async (timestamp, ethBlock, chainBlocks) => { chain: "polygon", block, }); - console.log(`Number of entropy pools: ${allPoolsLength}`); // Get aTokens used as collateral in each pool, and retrieve the amount of aTokens held by each pool const allPools = allPoolsOutput.map((o) => o.output); @@ -45,7 +44,6 @@ const poolsTvl = async (timestamp, ethBlock, chainBlocks) => { poolsaTokens[idx].output, pool, ]); - // console.log(tokensAndOwners) await sumTokens( balances, tokensAndOwners, diff --git a/projects/enzyme/index.js b/projects/enzyme/index.js index 71238a4f5fe..80508934f36 100644 --- a/projects/enzyme/index.js +++ b/projects/enzyme/index.js @@ -15,7 +15,6 @@ const query = `query get_accounts($lastId: String!) { async function tvl(ts, block, _, { api }) { const { endpoint } = config[api.chain] const vaults = await cachedGraphQuery('enzyme/' + api.chain, endpoint, query, { fetchById: true, }) - console.log(api.chain, vaults.length) return sumTokens2({ api, ownerTokens: vaults.map(i => { return [i.trackedAssets.map(i => i.id), i.id] diff --git a/projects/equilibrium/api.js b/projects/equilibrium/api.js index d5ec233bdf9..45f1595d10b 100644 --- a/projects/equilibrium/api.js +++ b/projects/equilibrium/api.js @@ -87,8 +87,6 @@ async function tvl() { return acc; }, {}); - console.log(JSON.stringify(result)); - return result; } diff --git a/projects/eris-protocol/index.js b/projects/eris-protocol/index.js index e8ffe72bfed..568be2d54eb 100644 --- a/projects/eris-protocol/index.js +++ b/projects/eris-protocol/index.js @@ -3,6 +3,7 @@ const { getBalance, getBalance2, } = require("../helper/chain/cosmos"); +const sdk = require('@defillama/sdk') // For testing run // node test.js projects/eris-protocol/index.js @@ -275,7 +276,7 @@ async function productsTvl(chain) { } catch (error) { let url = error?.response?.config?.url; if (url) { - console.log("Issue calling", error?.response?.config?.url); + sdk.log("Issue calling", error?.response?.config?.url); } throw error; } diff --git a/projects/ethalend/index.js b/projects/ethalend/index.js index d3b4da469be..79d7fe5394f 100644 --- a/projects/ethalend/index.js +++ b/projects/ethalend/index.js @@ -71,7 +71,6 @@ async function tvl(chain, block, chainId) { for (let i = 0; i < vaults.length; i++) { const underlying = underlyings.output[i].output const total = totals.output[i].output - // console.log(underlying, total, underlyings.output[i].input) if (underlying === curvePool) { sdk.util.sumSingleBalance(balances, "polygon:0x2e1ad108ff1d8c782fcbbb89aad783ac49586756", total) } else { diff --git a/projects/filet/index.js b/projects/filet/index.js index 3b17ce993dd..0ca7a04008f 100644 --- a/projects/filet/index.js +++ b/projects/filet/index.js @@ -82,7 +82,6 @@ module.exports = { mixin: { tvl: async (_, _1, _2, { api }) => { const tvlData = await fetchURL(filetAPI) - console.log("tvlData:",tvlData.data.data.mixinTvl) return { ["filecoin"]: new BigNumber(tvlData.data.data.mixinTvl), } diff --git a/projects/fraxfinance/index.js b/projects/fraxfinance/index.js index 0bc23dc4264..471fb0d5e0a 100644 --- a/projects/fraxfinance/index.js +++ b/projects/fraxfinance/index.js @@ -113,27 +113,6 @@ async function addUSDCPools(api, balances) { }) } -async function addAMOMinter(api, balances) { - const amoMinter = '0xcf37B62109b537fa0Cb9A90Af4CA72f6fb85E241' - let allAMOAddresses = await api.call({ target: amoMinter, abi: 'address[]:allAMOAddresses' }) - const amos = allAMOAddresses.filter(i => i !== nullAddress) - const blacklist = new Set([ - '0x66635DC1EdEfF19e839f152a67278151Aa6e1B61', // aave AMO - INVESTOR_AMO, - ].map(i => i.toLowerCase())) - const dollBallAbi = 'function dollarBalances() view returns (uint256 frax_val_e18, uint256 collat_val_e18)' - const res = await api.multiCall({ abi: dollBallAbi, calls: amos.filter(i => blacklist.has(i.toLowerCase())) }) - const table = [] - res.forEach((v, i) => { - table.push([amos[i], Number(v.collat_val_e18 / 1e24).toFixed(3)]) - sdk.util.sumSingleBalance(balances, USDC, v.collat_val_e18 / 1e12, api.chain) - }) - table.sort((a, b) => +b[1] - +a[1]) - console.log(amos.length) - console.table(table) - -} - async function addInvestorAMO(api, balances) { return sumTokens2({ balances, diff --git a/projects/friktion/index.js b/projects/friktion/index.js index bc5f02b0e86..6472db59fe5 100644 --- a/projects/friktion/index.js +++ b/projects/friktion/index.js @@ -1,4 +1,5 @@ const axios = require("axios"); +const sdk = require('@defillama/sdk') async function tvl() { const friktionSnapshotResponse = await axios.get( "https://raw.githubusercontent.com/Friktion-Labs/mainnet-tvl-snapshots/main/friktionSnapshot.json" @@ -16,12 +17,12 @@ async function tvl() { Object.keys(friktionSnapshot.coinsByCoingeckoId).length > 5 ) ) { - console.log(friktionSnapshot); + sdk.log(friktionSnapshot); throw new Error("Unexpected shape of friktionShapshot"); } if (!friktionSnapshot.totalTvlUSD || friktionSnapshot.totalTvlUSD < 1000) { - console.log(friktionSnapshot); + sdk.log(friktionSnapshot); throw new Error("Unexpected totalTvlUSD"); } diff --git a/projects/handlefi/index.js b/projects/handlefi/index.js index 3af9a05cf02..411ce977eee 100644 --- a/projects/handlefi/index.js +++ b/projects/handlefi/index.js @@ -71,7 +71,6 @@ async function ethereum_tvl(timestamp, ethBlock, chainBlocks) { chain: "ethereum", }), ]) - //console.log(`Rari Fuse pool #${fuse_pool_id}: balances of underlying of comptroller markets`, underlying.map((t, i) => t.output + ': ' + balance[i].output)) underlying.forEach((t, i) => { sdk.util.sumSingleBalance(balances, t.output, balance[i].output) diff --git a/projects/hector/index.js b/projects/hector/index.js index 832893cab3d..25f11f1697a 100644 --- a/projects/hector/index.js +++ b/projects/hector/index.js @@ -3,12 +3,10 @@ const contracts = require("./contracts.json"); const { sumTokens2, unwrapLPsAuto } = require("../helper/unwrapLPs"); const abi = require("./abi.json"); const { genericUnwrapCvx } = require("../helper/unwrapLPs"); -const { covalentGetTokens } = require('../helper/http') async function walletBalances(api) { const { owners = [], blacklistedTokens } = contracts.tokenHolders[api.chain] - const tokens = await Promise.all(owners.map(i => covalentGetTokens(i, api.chain))) - return sumTokens2({ api, ownerTokens: owners.map((v, i) => [tokens[i], v]), blacklistedTokens, resolveLP: false, }) + return sumTokens2({ api, owners, fetchCoValentTokens: true, blacklistedTokens, tokenConfig: { onlyWhitelisted: false, } }) } async function deployedBalances(api) { switch (api.chain) { diff --git a/projects/helper/chain/obyte.js b/projects/helper/chain/obyte.js index 99d1aa4f9c3..3156c249afb 100644 --- a/projects/helper/chain/obyte.js +++ b/projects/helper/chain/obyte.js @@ -63,12 +63,12 @@ function summingBaseAABalancesToTvl(assetMetadata, exchangeRates) { const baseCurrency = (asset === "base") ? "GBYTE" : asset const usdRate = exchangeRates[`${baseCurrency}_USD`] ?? 0 const usdValue = assetDetails.balance / Math.pow(10, decimals) * usdRate - // console.log(` ${assetMetadata[asset]?.symbol ?? asset} = ${usdValue.toFixed(2)}`) + // sdk.log(` ${assetMetadata[asset]?.symbol ?? asset} = ${usdValue.toFixed(2)}`) return total + usdValue } const summingAddressTvl = (total, [address, addressDetails]) => { - // console.log(`${address}:`) + // sdk.log(`${address}:`) return total + Object.entries(addressDetails.assets) .filter(([asset, assetDetails]) => !assetDetails.selfIssued) .reduce(summingAssetTvl, 0) diff --git a/projects/helper/dexpad.js b/projects/helper/dexpad.js index 6c83c2dcd00..47cb835d00b 100644 --- a/projects/helper/dexpad.js +++ b/projects/helper/dexpad.js @@ -264,14 +264,12 @@ async function getLPsTrackedValue( ); let formattedWhitelist = trackedTokens.map(addr => `${chain}:${addr}`); - // console.log("before", balances) balances = Object.keys(balances) .filter(balance => formattedWhitelist.includes(balance)) .reduce((obj, balance) => { obj[balance] = balances[balance]; return obj; }, {}); - // console.log("after",balances) return balances; } diff --git a/projects/helper/env.js b/projects/helper/env.js index 0cfd407d40b..44eea928a6c 100644 --- a/projects/helper/env.js +++ b/projects/helper/env.js @@ -10,6 +10,7 @@ const DEFAULTS = { SUI_RPC: 'https://fullnode.mainnet.sui.io/', MULTIVERSX_RPC: 'https://api.multiversx.com', ETHEREUMCLASSIC_RPC: 'https://etc.etcdesktop.com,https://etc.rivet.link', + ANKR_API_KEY: '79258ce7f7ee046decc3b5292a24eb4bf7c910d7e39b691384c7ce0cfb839a01', } const ENV_KEYS = [ diff --git a/projects/helper/getChainList.js b/projects/helper/getChainList.js index e094c40e304..badd8772e42 100644 --- a/projects/helper/getChainList.js +++ b/projects/helper/getChainList.js @@ -5,6 +5,7 @@ const projectsFolder = path.join(__dirname, '..') const files = fs.readdirSync(projectsFolder, { withFileTypes: true }) const whitelistedKeys = require('./whitelistedExportKeys.json') +const sdk = require('@defillama/sdk') const projectNames = [] const rModules = [] @@ -29,10 +30,10 @@ files.forEach(i => { projectNames.push(i.name) return; } - console.log('Adapter wrong? ', i.name) + sdk.log('Adapter wrong? ', i.name) } catch (e) { // console.error(e) - console.log('error in', i.name) + sdk.log('error in', i.name) } }) @@ -42,7 +43,7 @@ function getModule(fPath, projectName) { delete module.hallmarks if (typeof module.tvl === 'function') { const chainsWithTVL = Object.keys(module).filter(chain => typeof module[chain] === 'object' && typeof module[chain].tvl === 'function') - if (chainsWithTVL.length) console.log('I am confused:', projectName, chainsWithTVL) + if (chainsWithTVL.length) sdk.log('I am confused:', projectName, chainsWithTVL) else module.ethereum = { tvl: module.tvl } delete module.tvl } @@ -75,8 +76,6 @@ rModules.forEach((module, i) => { }) }) -// console.log(`projectMissingChainNames count: `, projectMissingChainNames.length, projectMissingChainNames.join(', ')) -// console.log(`Chain count: `, Object.keys(chainCount).length) const chainCountTable = Object.keys(chainCount).map((chain) => [chain, chainCount[chain].length, chainCount[chain]]).sort((a, b) => b[1] - a[1]) const keyCountTable = Object.keys(keysCount).map((key) => [key, keysCount[key].length, keysCount[key]]).sort((a, b) => b[1] - a[1]) console.table(chainCountTable) diff --git a/projects/helper/http.js b/projects/helper/http.js index 3a8f84f7597..7edd83c8e85 100644 --- a/projects/helper/http.js +++ b/projects/helper/http.js @@ -2,17 +2,6 @@ const axios = require("axios") const { request, GraphQLClient, } = require("graphql-request") const sdk = require('@defillama/sdk') const { getEnv } = require('./env') -const { getCache: cGetCache, setCache, graphFetchById, } = require('./cache') - -const chainIds = { - 'ethereum': 1, - 'optimism': 10, - 'bsc': 56, - 'polygon': 137, - 'arbitrum': 42161, - 'fantom': 250, - 'avax': 43114, -} const getCacheData = {} @@ -52,38 +41,6 @@ async function graphQuery(endpoint, graphQuery, params = {}, { timestamp, chain, return request(endpoint, graphQuery, params) } -async function covalentGetTokens(address, chain = 'ethereum', chainId) { - chainId = chainId ?? chainIds[chain] - if (!chainId) throw new Error('Missing chain to chain id mapping:' + chain) - if (!address) throw new Error('Missing adddress') - - const timeNow = +Date.now() - const THREE_DAYS = 3 * 24 * 3600 * 1000 - const project = 'covalent-cache' - const key = `${address}/${chain}` - const cache = (await cGetCache(project, key)) ?? {} - if (!cache.timestamp || (cache.timestamp + THREE_DAYS) < timeNow) { - cache.data = await _covalentGetTokens() - cache.timestamp = timeNow - await setCache(project, key, cache) - } - - return cache.data - - async function _covalentGetTokens() { - const { - data: { items } - } = await get(`https://api.covalenthq.com/v1/${chainId}/address/${address}/balances_v2/?&key=${getEnv('COVALENT_KEY')}`) - let table = {} - items - .filter(i => +i.balance > 0) - .forEach(i => table[i.contract_name || 'null'] = i.contract_address) - return items - .filter(i => +i.balance > 0) - .map(i => i.contract_address.toLowerCase()) - } -} - async function blockQuery(endpoint, query, { api, blockCatchupLimit = 500, }) { const graphQLClient = new GraphQLClient(endpoint) await api.getBlock() @@ -104,14 +61,13 @@ async function blockQuery(endpoint, query, { api, blockCatchupLimit = 500, }) { } } + module.exports = { get, getCache, post, blockQuery, graphQuery, - covalentGetTokens, - graphFetchById, getBlock, getWithMetadata, } diff --git a/projects/helper/portedTokens.js b/projects/helper/portedTokens.js index 5354d84ba7b..33d03cbdfe7 100644 --- a/projects/helper/portedTokens.js +++ b/projects/helper/portedTokens.js @@ -29,9 +29,7 @@ function fixBalances(balances, mapping, { chain, } = {}) { const { coingeckoId, decimals } = mapping[tokenKey] || {}; if (!coingeckoId) { if (removeUnmapped && (tokenKey.startsWith('0x') || token.startsWith(chain + ':'))) { - console.log( - `Removing token from balances, it is not part of whitelist: ${tokenKey}` - ); + sdk.log(`Removing token from balances, it is not part of whitelist: ${tokenKey}`); delete balances[token]; } return; @@ -82,11 +80,7 @@ function transformChainAddress( if (!addr.startsWith('0x')) return addr addr = addr.toLowerCase(); if (!mapping[addr] && skipUnmapped) { - console.log( - "Mapping for addr %s not found in chain %s, returning garbage address", - addr, - chain - ); + sdk.log("Mapping for addr %s not found in chain %s, returning garbage address", addr, chain); return "0x1000000000000000000000000000000000000001"; } if (chain === 'ethereum') return mapping[addr] ? mapping[addr] : addr diff --git a/projects/helper/solana.js b/projects/helper/solana.js index 624dbc43b97..c4452713c2f 100644 --- a/projects/helper/solana.js +++ b/projects/helper/solana.js @@ -145,9 +145,9 @@ async function getTokenBalances(tokensAndAccounts) { const body = tokensAndAccounts.map(([token, account]) => formTokenBalanceQuery(token, account)) const tokenBalances = await axios.post(endpoint(), body); const balances = {} - tokenBalances.data.forEach((v, i )=> { - if (!v.result) console.log(v, tokensAndAccounts[i]) - } ) + // tokenBalances.data.forEach((v, i )=> { + // if (!v.result) sdk.log(v, tokensAndAccounts[i]) + // } ) tokenBalances.data.forEach(({ result: { value } }) => { value.forEach(({ account: { data: { parsed: { info: { mint, tokenAmount: { amount } } } } } }) => { sdk.util.sumSingleBalance(balances, mint, amount) @@ -171,7 +171,6 @@ async function getTokenAccountBalances(tokenAccounts, { individual = false, chun log('Null account: skipping it') return; } - console.log(data.data.map(i => i.result.value)[i], tokenAccounts[i].toString()) if (allowError) return; } const { data: { parsed: { info: { mint, tokenAmount: { amount } } } } } = value @@ -269,7 +268,6 @@ async function getMultipleAccountBuffers(labeledAddresses) { } // Uncomment and paste into a hex editor to do some reverse engineering - // console.log(`${labels[index]}: ${results[labels[index]].toString("hex")}`); }); return results; diff --git a/projects/helper/token.js b/projects/helper/token.js new file mode 100644 index 00000000000..cb9db66ac0b --- /dev/null +++ b/projects/helper/token.js @@ -0,0 +1,136 @@ +const axios = require("axios") +const { getEnv } = require('./env') +const { getUniqueAddresses } = require('./utils') +const { get } = require('./http') +const { getCache, setCache, } = require('./cache') +const ADDRESSES = require('../helper/coreAssets.json') +const sdk = require('@defillama/sdk') + +async function covalentGetTokens(address, api, { + onlyWhitelisted = true, + useCovalent = false, +} = {}) { + const chainId = api?.chainId + const chain = api?.chain + if (!chainId) throw new Error('Missing chain to chain id mapping:' + api.chain) + if (!address) throw new Error('Missing adddress') + + if (!useCovalent) { + if (!ankrChainMapping[chain]) throw new Error('Chain Not supported: ' + chain) + const tokens = await ankrGetTokens(address, { onlyWhitelisted }) + return tokens[ankrChainMapping[chain]] ?? [] + } + + const timeNow = +Date.now() + const THREE_DAYS = 3 * 24 * 3600 * 1000 + const project = 'covalent-cache' + const key = `${address}/${chain}` + const cache = (await getCache(project, key)) ?? {} + if (!cache.timestamp || (cache.timestamp + THREE_DAYS) < timeNow) { + cache.data = await _covalentGetTokens() + cache.timestamp = timeNow + await setCache(project, key, cache) + } + + return cache.data + + async function _covalentGetTokens() { + const { + data: { items } + } = await get(`https://api.covalenthq.com/v1/${chainId}/address/${address}/balances_v2/?&key=${getEnv('COVALENT_KEY')}`) + let table = {} + items + .filter(i => +i.balance > 0) + .forEach(i => table[i.contract_name || 'null'] = i.contract_address) + return items + .filter(i => +i.balance > 0) + .map(i => i.contract_address.toLowerCase()) + } +} + +const ankrTokenCalls = {} + +const ankrChainMapping = { + ethereum: 'eth', + base: 'base', + bsc: 'bsc', + arbitrum: 'arbitrum', + optimism: 'optimism', + fantom: 'fantom', + polygon: 'polygon', + polygon_zkevm: 'polygon_zkevm', + era: 'zksync_era', + avax: 'avalanche', +} + +async function ankrGetTokens(address, { onlyWhitelisted = true } = {}) { + address = address.toLowerCase() + + if (!ankrTokenCalls[address]) ankrTokenCalls[address] = _call() + return ankrTokenCalls[address] + + async function _call() { + const project = 'ankr-cache' + const key = onlyWhitelisted ? address : `${address}/all` + const timeNow = Math.floor(Date.now() / 1e3) + const THREE_DAYS = 3 * 24 * 3600 + const cache = (await getCache(project, key)) ?? {} + if (cache.timestamp && (timeNow - cache.timestamp) < THREE_DAYS) + return cache.tokens + + sdk.log('Pulling tokens for ' + address) + + const options = { + method: 'POST', + url: `https://rpc.ankr.com/multichain/${getEnv('ANKR_API_KEY')}`, + params: { ankr_getAccountBalance: '' }, + headers: { accept: 'application/json', 'content-type': 'application/json' }, + data: { + jsonrpc: '2.0', + method: 'ankr_getAccountBalance', + params: { + onlyWhitelisted, + nativeFirst: true, + skipSyncCheck: true, + walletAddress: address + }, + id: 42 + } + }; + const tokens = {} + const { data: { result: { assets } } } = await axios.request(options) + const tokenCache = { timestamp: timeNow, tokens, } + for (const asset of assets) { + const { contractAddress, blockchain } = asset + if (!tokens[blockchain]) tokens[blockchain] = [] + tokens[blockchain].push(contractAddress ?? ADDRESSES.null) + } + for (const [chain, values] of Object.entries(tokens)) { + tokens[chain] = getUniqueAddresses(values) + } + + await setCache(project, key, tokenCache) + return tokens + } +} + +async function getComplexTreasury(owners) { + const networks = ["ethereum", "polygon", "optimism", "gnosis", "binance-smart-chain", "fantom", "avalanche", "arbitrum", + "celo", "harmony", "moonriver", "bitcoin", "cronos", "aurora", "evmos"] + const data = await axios.get(`https://api.zapper.xyz/v2/balances/apps?${owners.map(a => `addresses=${a}`).join("&")}&${networks.map(a => `networks=${a}`).join("&")}`, { + headers: { + Authorization: `Basic ${btoa(process.env.ZAPPER_API_KEY)}` + } + }) + let sum = 0 + data.data.forEach(d => { + sum += d.balanceUSD + }) + return sum +} + + +module.exports = { + covalentGetTokens, + ankrChainMapping, +} diff --git a/projects/helper/treasury.js b/projects/helper/treasury.js index c8c22f74c83..4cf1052fbff 100644 --- a/projects/helper/treasury.js +++ b/projects/helper/treasury.js @@ -1,63 +1,47 @@ const ADDRESSES = require('./coreAssets.json') -const { sumTokensExport, nullAddress, } = require('../helper/sumTokens') -const { covalentGetTokens } = require('./http') -const axios = require("axios") +const { sumTokensExport, nullAddress, } = require('./sumTokens') +const { ankrChainMapping } = require('./token') const ARB = ADDRESSES.arbitrum.ARB; function treasuryExports(config) { const chains = Object.keys(config) - const exportObj = { } + const exportObj = {} chains.forEach(chain => { - let { ownTokenOwners = [], ownTokens = [], owners = [], fetchTokens = false, tokens = [], blacklistedTokens = [] } = config[chain] - if (chain === 'solana') config[chain].solOwners = owners - if (chain === 'solana') config[chain].solOwners = owners - const tvlConfig = { ...config[chain] } - tvlConfig.blacklistedTokens = [...ownTokens, ...blacklistedTokens] - if(fetchTokens === true){ - exportObj[chain] = { tvl: async (_, _b, _cb, { api }) => { - const tokens = await Promise.all(owners.map(address=>covalentGetTokens(address, chain))) - const uniqueTokens = new Set([...config[chain].tokens, ...tokens.flat()]) - tvlConfig.tokens = Array.from(uniqueTokens) - return sumTokensExport(tvlConfig)(_, _b, _cb, api) - }} - } else { - if (chain === 'arbitrum') { - tvlConfig.tokens = [...tokens, ARB] + let { ownTokenOwners = [], ownTokens = [], owners = [], tokens = [], blacklistedTokens = [] } = config[chain] + if (chain === 'solana') config[chain].solOwners = owners + if (chain === 'solana') config[chain].solOwners = owners + const tvlConfig = { ...config[chain], } + if (config[chain].fetchCoValentTokens !== false && ankrChainMapping[chain]) { + tvlConfig.fetchCoValentTokens = true + const { tokenConfig } = config[chain] + if (!tokenConfig) { + tvlConfig.tokenConfig = { onlyWhitelisted: false, } } - exportObj[chain] = { tvl: sumTokensExport(tvlConfig) } } + tvlConfig.blacklistedTokens = [...ownTokens, ...blacklistedTokens] + + if (chain === 'arbitrum') { + tvlConfig.tokens = [...tokens, ARB] + } + exportObj[chain] = { tvl: sumTokensExport(tvlConfig) } + if (ownTokens.length > 0) { const { solOwners, ...otherOptions } = config[chain] - const options = { ...otherOptions, owners: [...owners, ...ownTokenOwners], tokens: ownTokens, chain, uniV3WhitelistedTokens: ownTokens} + const options = { ...otherOptions, owners: [...owners, ...ownTokenOwners], tokens: ownTokens, chain, uniV3WhitelistedTokens: ownTokens } exportObj[chain].ownTokens = sumTokensExport(options) } }) return exportObj } -async function getComplexTreasury(owners){ - const networks = ["ethereum", "polygon", "optimism", "gnosis", "binance-smart-chain", "fantom", "avalanche", "arbitrum", - "celo", "harmony", "moonriver", "bitcoin", "cronos", "aurora", "evmos"] - const data = await axios.get(`https://api.zapper.xyz/v2/balances/apps?${owners.map(a=>`addresses=${a}`).join("&")}&${networks.map(a=>`networks=${a}`).join("&")}`, { - headers:{ - Authorization: `Basic ${btoa(process.env.ZAPPER_API_KEY)}` - } - }) - let sum = 0 - data.data.forEach(d=>{ - sum+=d.balanceUSD - }) - return sum -} - function ohmStaking(exports) { const dummyTvl = () => ({}) const newExports = {} Object.entries(exports).forEach(([chain, value]) => { if (typeof value === 'object' && typeof value.tvl === 'function') { - newExports[chain] = { ...value, tvl: dummyTvl} + newExports[chain] = { ...value, tvl: dummyTvl } } else { newExports[chain] = value } @@ -70,7 +54,7 @@ function ohmTreasury(exports) { const newExports = {} Object.entries(exports).forEach(([chain, value]) => { if (typeof value === 'object' && typeof value.staking === 'function') { - newExports[chain] = { ...value,} + newExports[chain] = { ...value, } delete newExports[chain].staking } else { newExports[chain] = value @@ -82,7 +66,6 @@ function ohmTreasury(exports) { module.exports = { nullAddress, treasuryExports, - getComplexTreasury, ohmTreasury, ohmStaking, } diff --git a/projects/helper/unwrapLPs.js b/projects/helper/unwrapLPs.js index 59dc17eb6a4..273aefb5007 100644 --- a/projects/helper/unwrapLPs.js +++ b/projects/helper/unwrapLPs.js @@ -11,8 +11,7 @@ const creamAbi = require('./abis/cream.json') const { isLP, log, } = require('./utils') const { sumArtBlocks, whitelistedNFTs, } = require('./nft') const wildCreditABI = require('../wildcredit/abi.json'); -const { covalentGetTokens, get } = require("./http"); -const { sliceIntoChunks } = require('@defillama/sdk/build/util'); +const { covalentGetTokens, } = require("./token"); const lpReservesAbi = 'function getReserves() view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast)' const lpSuppliesAbi = "uint256:totalSupply" @@ -24,7 +23,7 @@ const token1Abi = "address:token1" token }[] */ -async function unwrapUniswapLPs(balances, lpPositions, block, chain = 'ethereum', transformAddress = null, excludeTokensRaw = [], retry = false, uni_type = 'standard',) { +async function unwrapUniswapLPs(balances, lpPositions, block, chain = 'ethereum', transformAddress = null, excludeTokensRaw = [], uni_type = 'standard',) { if (!transformAddress) transformAddress = await getChainTransform(chain) const api = new sdk.ChainApi({ chain, block }) @@ -406,8 +405,8 @@ async function sumTokens(balances = {}, tokensAndOwners, block, chain = "ethereu // const ethBalances = await Promise.all(ethBalanceInputs.map(getTrxBalance)) // ethBalances.forEach(balance => sdk.util.sumSingleBalance(balances, transformAddress(nullAddress), balance)) // } else { - const { output: ethBalances } = await sdk.api.eth.getBalances({ targets: ethBalanceInputs, chain, block }) - ethBalances.forEach(({ balance }) => sdk.util.sumSingleBalance(balances, transformAddress(nullAddress), balance)) + const { output: ethBalances } = await sdk.api.eth.getBalances({ targets: ethBalanceInputs, chain, block }) + ethBalances.forEach(({ balance }) => sdk.util.sumSingleBalance(balances, transformAddress(nullAddress), balance)) // } } @@ -615,7 +614,7 @@ async function unwrapLPsAuto({ api, balances, block, chain = "ethereum", transfo token1 = token1_.output.toLowerCase() supply = supply_.output } catch (e) { - console.log('Unable to resolve LP: ', lpToken); + sdk.log('Unable to resolve LP: ', lpToken); throw e } @@ -639,7 +638,7 @@ async function unwrapLPsAuto({ api, balances, block, chain = "ethereum", transfo sdk.util.sumSingleBalance(balances, transformAddress(token0), token0Balance) sdk.util.sumSingleBalance(balances, transformAddress(token1), token1Balance) } catch (e) { - console.log(`Failed to get data for LP token at ${lpPosition.token} on chain ${chain}`) + sdk.log(`Failed to get data for LP token at ${lpPosition.token} on chain ${chain}`) throw e } }) @@ -675,6 +674,7 @@ async function sumTokens2({ resolveNFTs = false, permitFailure = false, fetchCoValentTokens = false, + tokenConfig = {}, }) { if (api) { chain = api.chain ?? chain @@ -684,41 +684,39 @@ async function sumTokens2({ balances = {} } + if (owner) owners.push(owner) + tokens = getUniqueAddresses(tokens, chain) + owners = getUniqueAddresses(owners, chain) + if (owners.length) tokensAndOwners.push(...tokens.map(t => owners.map(o => [t, o])).flat()) + if (resolveArtBlocks || resolveNFTs) { if (!api) throw new Error('Missing arg: api') await sumArtBlocks({ balances, api, owner, owners, }) } if (fetchCoValentTokens) { - if (!api) throw new Error('Missing arg: api') - if (!owners || !owners.length) owners = [owner] - const cTokens = (await Promise.all(owners.map(i => covalentGetTokens(i, api.chain, api.chainId)))).flat() - tokens = [...cTokens, ...tokens] + const cTokens = (await Promise.all(owners.map(i => covalentGetTokens(i, api, tokenConfig)))) + cTokens.forEach((tokens, i) => ownerTokens.push([tokens, owners[i]])) } if (resolveNFTs) { - if (!api) throw new Error('Missing arg: api') - if (!owners || !owners.length) owners = [owner] - const nftTokens = (await Promise.all(owners.map(i => covalentGetTokens(i, api.chain)))).flat() - return sumTokens2({ balances, api, owners, tokens: [...nftTokens, ...tokens, ...(whitelistedNFTs[api.chain] || [])], }) + const coreNftTokens = whitelistedNFTs[api.chain] ?? [] + const nftTokens = await Promise.all(owners.map(i => covalentGetTokens(i, api))) + nftTokens.forEach((tokens, i) => ownerTokens.push([[tokens, coreNftTokens].flat(), owners[i]])) } - if (!tokensAndOwners.length) { - tokens = getUniqueAddresses(tokens, chain) - owners = getUniqueAddresses(owners, chain) - if (owner) tokensAndOwners = tokens.map(t => [t, owner]) - if (owners.length) tokensAndOwners = tokens.map(t => owners.map(o => [t, o])).flat() - if (ownerTokens.length) { - ownerTokens.map(([tokens, owner]) => { - if (typeof owner !== 'string') throw new Error('invalid config', owner) - if (!Array.isArray(tokens)) throw new Error('invalid config', tokens) - tokens.forEach(t => tokensAndOwners.push([t, owner])) - }) - } - if (tokensAndOwners2.length) { - const [_tokens, _owners] = tokensAndOwners2 - _tokens.forEach((v, i) => tokensAndOwners.push([v, _owners[i]])) - } + + if (ownerTokens.length) { + ownerTokens.map(([tokens, owner]) => { + if (typeof owner !== 'string') throw new Error('invalid config', owner) + if (!Array.isArray(tokens)) throw new Error('invalid config', tokens) + tokens.forEach(t => tokensAndOwners.push([t, owner])) + }) + } + + if (tokensAndOwners2.length) { + const [_tokens, _owners] = tokensAndOwners2 + _tokens.forEach((v, i) => tokensAndOwners.push([v, _owners[i]])) } if (resolveUniV3 || uniV3nftsAndOwners.length) @@ -729,14 +727,8 @@ async function sumTokens2({ tokensAndOwners = getUniqueToA(tokensAndOwners) log(chain, 'summing tokens', tokensAndOwners.length) - if (chain === 'tron') { - const tokensAndOwnersChunks = sliceIntoChunks(tokensAndOwners, 1) - for (const toa of tokensAndOwnersChunks) { - await sumTokens(balances, toa, block, chain, transformAddress, { resolveLP, unwrapAll, blacklistedLPs, skipFixBalances: true, abis, permitFailure, }) - } - } else { - await sumTokens(balances, tokensAndOwners, block, chain, transformAddress, { resolveLP, unwrapAll, blacklistedLPs, skipFixBalances: true, abis, permitFailure, }) - } + await sumTokens(balances, tokensAndOwners, block, chain, transformAddress, { resolveLP, unwrapAll, blacklistedLPs, skipFixBalances: true, abis, permitFailure, }) + if (!skipFixBalances) { const fixBalances = await getFixBalances(chain) @@ -752,7 +744,7 @@ async function sumTokens2({ } function sumTokensExport({ balances, tokensAndOwners, tokensAndOwners2, tokens, owner, owners, transformAddress, unwrapAll, resolveLP, blacklistedLPs, blacklistedTokens, skipFixBalances, ownerTokens, resolveUniV3, resolveArtBlocks, resolveNFTs, fetchCoValentTokens, ...args }) { - return async (_, _b, _cb, { api }) => sumTokens2({ api, balances, tokensAndOwners, tokensAndOwners2, tokens, owner, owners, transformAddress, unwrapAll, resolveLP, blacklistedLPs, blacklistedTokens, skipFixBalances, ownerTokens, resolveUniV3, resolveArtBlocks, resolveNFTs, fetchCoValentTokens, ...args,}) + return async (_, _b, _cb, { api }) => sumTokens2({ api, balances, tokensAndOwners, tokensAndOwners2, tokens, owner, owners, transformAddress, unwrapAll, resolveLP, blacklistedLPs, blacklistedTokens, skipFixBalances, ownerTokens, resolveUniV3, resolveArtBlocks, resolveNFTs, fetchCoValentTokens, ...args, }) } async function unwrapBalancerToken({ api, chain, block, balancerToken, owner, balances = {}, isBPool = false, isV2 = true }) { diff --git a/projects/helper/utils.js b/projects/helper/utils.js index ecd89033f10..2408239b142 100644 --- a/projects/helper/utils.js +++ b/projects/helper/utils.js @@ -46,10 +46,11 @@ const blacklisted_LPS = [ '0xCC8Fa225D80b9c7D42F96e9570156c65D6cAAa25', '0xaee4164c1ee46ed0bbc34790f1a3d1fc87796668', '0x93669cfce302c9971169f8106c850181a217b72b', + '0x253f67aacaf0213a750e3b1704e94ff9accee10b', ].map(i => i.toLowerCase()) function isLP(symbol, token, chain) { - // console.log(symbol, chain, token) + // sdk.log(symbol, chain, token) if (!symbol) return false if (token && blacklisted_LPS.includes(token.toLowerCase()) || symbol.includes('HOP-LP-')) return false if (chain === 'bsc' && ['OLP', 'DLP', 'MLP', 'LP', 'Stable-LP'].includes(symbol)) return false @@ -64,7 +65,7 @@ function isLP(symbol, token, chain) { if (chain === 'oasis' && ['LPT'].includes(symbol)) return true if (chain === 'base' && ['RCKT-V2'].includes(symbol)) return true if (chain === 'wan' && ['WSLP'].includes(symbol)) return true - if (chain === 'polygon' && ['MbtLP'].includes(symbol)) return true + if (chain === 'polygon' && ['MbtLP', 'GLP', ].includes(symbol)) return true if (chain === 'ethereum' && ['SUDO-LP'].includes(symbol)) return false if (chain === 'dogechain' && ['DST-V2'].includes(symbol)) return true if (chain === 'harmony' && ['HLP'].includes(symbol)) return true @@ -185,7 +186,7 @@ async function diplayUnknownTable({ tvlResults = {}, tvlBalances = {}, storedKey try { await debugBalances({ balances, chain: storedKey, log, tableLabel, withETH: false, }) } catch (e) { - // console.log(e) + // sdk.log(e) log('failed to fetch prices for', balances) } } @@ -243,7 +244,7 @@ async function debugBalances({ balances = {}, chain, log = false, tableLabel = ' }) if (tokens.length > 100) { - console.log('too many unknowns') + sdk.log('too many unknowns') return; } @@ -281,7 +282,7 @@ async function debugBalances({ balances = {}, chain, log = false, tableLabel = ' logObj.push({ name, symbol, balance, label, decimals: decimal }) }) - console.log('Balance table for [%s] %s', chain, tableLabel) + sdk.log('Balance table for [%s] %s', chain, tableLabel) console.table(logObj) } diff --git a/projects/helper/utils/enigma.js b/projects/helper/utils/enigma.js index 68e098f1785..4a1d1d8c22c 100644 --- a/projects/helper/utils/enigma.js +++ b/projects/helper/utils/enigma.js @@ -64,7 +64,7 @@ class EnigmaUtils { return new Uint8Array(); } const txEncryptionKey = await this.getTxEncryptionKey(nonce); - //console.log(`decrypt tx encryption key: ${Encoding.toHex(txEncryptionKey)}`); + //sdk.log(`decrypt tx encryption key: ${Encoding.toHex(txEncryptionKey)}`); const siv = await miscreant.SIV.importKey(txEncryptionKey, "AES-SIV", cryptoProvider); const plaintext = await siv.open(ciphertext, [new Uint8Array()]); return plaintext; diff --git a/projects/helper/utils/solana/layout.js b/projects/helper/utils/solana/layout.js index bf14f62c905..8f02e596508 100644 --- a/projects/helper/utils/solana/layout.js +++ b/projects/helper/utils/solana/layout.js @@ -7,8 +7,6 @@ const { INVESTIN_FUND_DATA, } = require('./layouts/investin-layout') const { MARKET_STATE_LAYOUT_V3, } = require('./layouts/openbook-layout') const { ReserveLayout, ReserveLayoutLarix, MintLayout, AccountLayout, TokenSwapLayout, } = require('./layouts/mixed-layout') -// console.log(RAYDIUM_LIQUIDITY_STATE_LAYOUT_CLMM.span, 'RAYDIUM_LIQUIDITY_STATE_LAYOUT_CLMM') - const parseReserve = (info) => { const pubkey = PublicKey.default const { data } = info; diff --git a/projects/hydradx/api.js b/projects/hydradx/api.js index c0751165bff..c1b629e9c05 100644 --- a/projects/hydradx/api.js +++ b/projects/hydradx/api.js @@ -1,4 +1,5 @@ const { ApiPromise, WsProvider } = require("@polkadot/api"); +const sdk = require('@defillama/sdk') const omnipoolAccountId = "7L53bUTBbfuj14UpdCNPwmgzzHSsrsTWBHX5pys32mVWM3C1" @@ -36,7 +37,7 @@ async function tvl() { const bal = await api.query.tokens.accounts(omnipoolAccountId, assetId) add(cgId, bal.free / (10 ** decimals)) } else { - console.log(`No mapping for ${symbol}, skipping it`) + sdk.log(`No mapping for ${symbol}, skipping it`) } } diff --git a/projects/idex/index.js b/projects/idex/index.js index 5934dddce88..f68cc99f501 100644 --- a/projects/idex/index.js +++ b/projects/idex/index.js @@ -1,58 +1,33 @@ const ADDRESSES = require('../helper/coreAssets.json') -/*================================================== - Modules - ==================================================*/ -const { covalentGetTokens, get } = require("../helper/http") const { sumTokens2 } = require("../helper/unwrapLPs") const { getConfig } = require('../helper/cache') const IDEX_ETHEREUM_CUSTODY_CONTRACT = "0xE5c405C5578d84c5231D3a9a29Ef4374423fA0c2"; const IDEX_POLYGON_CUSTODY_CONTRACT = "0x3bcc4eca0a40358558ca8d1bcd2d1dbde63eb468"; -/*================================================== - TVL - ==================================================*/ - -async function tvl(_timestamp, block, chain) { +async function tvl(_timestamp, block, chain, { api }) { + chain = api.chain let tokens = [ADDRESSES.null] let owner switch (chain) { case 'polygon': - const assets = await getConfig('idex/polygon','https://api-matic.idex.io/v1/assets') + const assets = await getConfig('idex/polygon', 'https://api-matic.idex.io/v1/assets') assets.forEach(t => tokens.push(t.contractAddress)) owner = IDEX_POLYGON_CUSTODY_CONTRACT break; case 'ethereum': owner = IDEX_ETHEREUM_CUSTODY_CONTRACT - const ethAssets = await covalentGetTokens(owner) - ethAssets - .filter(t => t !== '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee' && t !== '0x7b0c06043468469967dba22d1af33d77d44056c8') - .forEach(t => tokens.push(t)) break; default: throw new Error('Unknown chain ' + chain); } - const res = await sumTokens2({ chain, block, tokens, owner }) - return res + return sumTokens2({ api, tokens, owner, fetchCoValentTokens: chain === 'ethereum' }) } -/*================================================== - Exports - ==================================================*/ - -const ethereumTvl = (_timestamp, block, chainBlocks) => tvl(_timestamp, block, 'ethereum') -const polygonTvl = (_timestamp, block, chainBlocks) => tvl(_timestamp, chainBlocks.polygon, 'polygon') - module.exports = { - ethereum: { - start: 1603166400, - tvl: ethereumTvl, - }, - polygon: { - start: 1638316800, - tvl: polygonTvl, - }, + ethereum: { tvl, }, + polygon: { tvl, }, }; diff --git a/projects/kogefarm/abi.json b/projects/kogefarm/abi.json index 475566dac80..71060436964 100644 --- a/projects/kogefarm/abi.json +++ b/projects/kogefarm/abi.json @@ -1,13 +1,4 @@ { "balance": "uint256:balance", - "balanceOf": "function balanceOf(address _owner) view returns (uint256 balance)", - "token": "address:token", - "symbol": "string:symbol", - "getPoolTokens": "function getPoolTokens(bytes32 poolId) view returns (address[] tokens, uint256[] balances, uint256 lastChangeBlock)", - "getPoolId": "function getPoolId() view returns (bytes32)", - "totalSupply": "uint256:totalSupply", - "getRatio": "uint256:getRatio", - "poolLength": "uint256:poolLength", - "poolInfo": "function poolInfo(uint256) view returns (address lpToken, uint256 allocPoint, uint256 lastRewardBlock, uint256 accRewardPerShare)", - "totalLiquidity": "uint256:totalLiquidity" + "token": "address:token" } \ No newline at end of file diff --git a/projects/kogefarm/helper.js b/projects/kogefarm/helper.js deleted file mode 100644 index da16dff3bf7..00000000000 --- a/projects/kogefarm/helper.js +++ /dev/null @@ -1,267 +0,0 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const BigNumber = require('bignumber.js') -const sdk = require('@defillama/sdk') -const abi = require('./abi.json') - -function transformAddressKF(chain = 'polygon') { - return (addr) => { - // WETH - if (addr.toLowerCase() === ADDRESSES.polygon.WETH_1) { - return ADDRESSES.null - } - - // Special cases since coingecko doesn't find them - if ( - // fUSDT - (chain === 'fantom' && - addr.toLowerCase() === ADDRESSES.fantom.fUSDT) || - (chain === 'moonriver' && - addr.toLowerCase() === '0xe936caa7f6d9f5c9e907111fcaf7c351c184cda7') - ) { - // USDT - return `ethereum:0xdac17f958d2ee523a2206206994597c13d831ec7` - } - if ( - // renbtc on Fantom - (chain === 'fantom' && - addr.toLowerCase() === ADDRESSES.fantom.renBTC) - ) { - // renbtc on Polygon - return `polygon:0xDBf31dF14B66535aF65AaC99C32e9eA844e14501` - } - if ( - // staked spell on Fantom - (chain === 'fantom' && - addr.toLowerCase() === '0xbb29d2a58d880af8aa5859e30470134deaf84f2b') - ) { - // spell on Fantom - return `fantom:0x468003B688943977e6130F4F68F23aad939a1040` - } - if ( - // Dai on Fantom - (chain === 'fantom' && - addr.toLowerCase() === ADDRESSES.fantom.DAI) - ) { - // Dai on Eth - return `ethereum:0x6b175474e89094c44da98b954eedeac495271d0f` - } - if ( - // wMemo on Fantom - (chain === 'fantom' && - addr.toLowerCase() === '0xddc0385169797937066bbd8ef409b5b3c0dfeb52') - ) { - // Time on avax (per Wonderland docs, staked time = Memo at a 1:1 ratio) - return `avax:0xb54f16fb19478766a268f172c9480f8da1a7c9c3` - } - if ( - chain === 'moonriver' && - addr.toLowerCase() === '0x748134b5f553f2bcbd78c6826de99a70274bdeb3' // USDC.m - ) { - // USDC - return `ethereum:0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48` - } - if ( - chain === 'moonriver' && - addr.toLowerCase() === '0x15b9ca9659f5dff2b7d35a98dd0790a3cbb3d445' // DOT.m - ) { - // BSC DOT - return `bsc:0x7083609fce4d1d8dc0c979aab8c869ea2c873402` - } - if ( - chain === 'moonriver' && - addr.toLowerCase() === '0x9a92b5ebf1f6f6f7d93696fcd44e5cf75035a756' // FINN - ) { - // FINN - return `moonriver:0x9a92b5ebf1f6f6f7d93696fcd44e5cf75035a756` - } - if ( - chain === 'moonriver' && - addr.toLowerCase() === '0x576fde3f61b7c97e381c94e7a03dbc2e08af1111' // ETH.M - ) { - // WETH - return `ethereum:0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2` - } - if ( - chain === 'moonriver' && - addr.toLowerCase() === '0x78f811a431d248c1edcf6d95ec8551879b2897c3' // BTC.m - ) { - // WBTC - return `ethereum:0x2260fac5e5542a773aa44fbcfedf7c193bc2c599` - } - if ( - chain === 'moonriver' && - addr.toLowerCase() === '0x9d5bc9b873aed984e2b6a64d4792249d68bba2fe' // XRP.m - ) { - // Binance-Peg XRP - return `bsc:0x1d2f0da169ceb9fc7b3144628db156f3f6c60dbe` - } - if ( - chain === 'moonriver' && - addr.toLowerCase() === '0xc005a7a1502c9de16ccdaba7cda0cee4ac304993' // AVAX.m - ) { - // WAVAX - return `avax:0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7` - } - // Special case for MIM, since coingecko doesn't find - if (addr.toLowerCase() === ADDRESSES.fantom.MIM) { - // MIM - return `ethereum:0x99d8a9c45b2eca8864373a26d1459e3dff1e17f3` - } - // Special case for LINK, since coingecko doesn't find - if (addr.toLowerCase() === '0xb3654dc3d10ea7645f8319668e8f54d2574fbdc8') { - // LINK - return `ethereum:0x514910771af9ca656af840dff83e8264ecf986ca` - } - // Special case for Bella, since coingecko doesn't find - if ( - chain === 'polygon' && - addr.toLowerCase() === '0x28c388fb1f4fa9f9eb445f0579666849ee5eeb42') { - return `ethereum:0xa91ac63d040deb1b7a5e4d4134ad23eb0ba07e14` - } - // Special case for SFI, since coingecko doesn't find - if ( - chain === 'polygon' && - addr.toLowerCase() === '0x35b937583f04a24963eb685f728a542240f28dd8') { - return `ethereum:0xb753428af26e81097e7fd17f40c88aaa3e04902c` - } - // Special case for Impermax, since coingecko doesn't find - if ( - chain === 'polygon' && - addr.toLowerCase() === '0x60bb3d364b765c497c8ce50ae0ae3f0882c5bd05') { - return `ethereum:0x7b35ce522cb72e4077baeb96cb923a5529764a00` - } - // Special case for Avax, since coingecko doesn't find - if ( - chain === 'polygon' && - addr.toLowerCase() === '0x2c89bbc92bd86f8075d1decc58c7f4e0107f286b') { - return `avax:0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7` - } - // Special case for sUSDT, since coingecko doesn't find - if ( - chain === 'polygon' && - addr.toLowerCase() === '0x29e38769f23701a2e4a8ef0492e19da4604be62c') { - return `polygon:0xc2132d05d31c914a87c6611c10748aeb04b58e8f` - } - // Special case for sUSDC, since coingecko doesn't find - if ( - chain === 'polygon' && - addr.toLowerCase() === '0x1205f31718499dbf1fca446663b532ef87481fe1') { - return `polygon:0x2791bca1f2de4661ed88a30c99a7a9449aa84174` - } - - return `${chain}:${addr}` - } -} - -async function getSinglePositions( - balances, - lpPositions, - block, - chain = 'ethereum', - transformAddress = (addr) => addr, -) { - await Promise.all( - lpPositions.map((lpPosition) => { - const underlyingToken = lpPosition.token - const underlyingTokenBalance = lpPosition.balance - sdk.util.sumSingleBalance( - balances, - transformAddress(underlyingToken), - underlyingTokenBalance, - ) - }), - ) -} - -async function unwrapCrvLPs( - balances, - lpPositions, - block, - chain = 'ethereum', -) { - await Promise.all( - lpPositions.map(async (lp) => { - const underlyingToken = lp.token - const underlyingTokenBalance = lp.balance - sdk.util.sumSingleBalance(balances,underlyingToken,underlyingTokenBalance, chain) - }), - ) -} - -async function unwrapBalancerLPs( - vaultAddress, - balances, - lpPositions, - block, - chain = 'ethereum', - transformAddress = (addr) => addr, -) { - const vaultBalances = ( - await sdk.api.abi.multiCall({ - chain, - block, - abi: abi.balance, - calls: lpPositions.map((lp) => ({ target: lp.vaultAddr })), - }) - ).output - const poolIds = ( - await sdk.api.abi.multiCall({ - chain, - block, - abi: abi.getPoolId, - calls: lpPositions.map((lp) => ({ target: lp.token })), - }) - ).output - const poolTokens = ( - await sdk.api.abi.multiCall({ - chain, - block, - abi: abi.getPoolTokens, - calls: poolIds.map((e) => ({ target: vaultAddress, params: [e.output] })), - }) - ).output - const totalSupply = ( - await sdk.api.abi.multiCall({ - chain, - block, - abi: abi.totalSupply, - calls: lpPositions.map((e) => ({ target: e.token })), - }) - ).output - - await Promise.all( - poolTokens.map(async (lp, idx) => { - try { - const tokens = lp.output.tokens - - const tokenBalances = tokens.map((t, tidx) => - BigNumber(lp.output['1'][tidx]) - .times( - BigNumber(lpPositions[idx].balance).div(totalSupply[idx].output), - ) - .integerValue(), - ) - - tokenBalances.forEach(async (tokenBalance, tidx) => { - sdk.util.sumSingleBalance( - balances, - await transformAddress(tokens[tidx].toLowerCase()), - tokenBalance.toFixed(0), - ) - }) - } catch (e) { - console.log( - `Failed to get data for LP token at ${lpPositions[idx].token} on chain ${chain}`, - ) - throw e - } - }), - ) -} - -module.exports = { - transformAddressKF, - getSinglePositions, - unwrapBalancerLPs, - unwrapCrvLPs, -} diff --git a/projects/kogefarm/index.js b/projects/kogefarm/index.js index 8a901ea0144..afaceb25389 100644 --- a/projects/kogefarm/index.js +++ b/projects/kogefarm/index.js @@ -1,659 +1,9 @@ -const sdk = require('@defillama/sdk') +const { sumUnknownTokens } = require('../helper/unknownTokens') const abi = require('./abi.json') -const { unwrapUniswapLPs, } = require('../helper/unwrapLPs') const { getConfig } = require('../helper/cache') -const { - transformAddressKF, - getSinglePositions, - unwrapBalancerLPs, - unwrapCrvLPs, -} = require('./helper.js') - -const current_polygon_vaults_url = - 'https://raw.githubusercontent.com/kogecoin/vault-contracts/main/vaultaddresses' -const current_fantom_vaults_url = - 'https://raw.githubusercontent.com/kogecoin/vault-contracts/main/ftm_vault_addresses.json' -const current_moonriver_vaults_url = - 'https://raw.githubusercontent.com/kogecoin/vault-contracts/main/movr_vault_addresses.json' -const current_kava_vaults_url = - 'https://raw.githubusercontent.com/kogecoin/vault-contracts/main/kava_vault_addresses.json' - -const beethovenX = '0x20dd72Ed959b6147912C2e529F0a0C651c33c9ce' - -const ftm_CrvVaultAddr = [ - '0x0a5E266afB071CB0F69310706154F2893a208D1c', - '0x4Ef103DF324b20604e13170377233DDecD15074B', -] -const movr_CrvVaultAddr = [] -const ftm_BalancerForks = [ - { - name: 'beethoven', - vault: beethovenX, - }, -] -const movr_BalancerForks = [] -const kava_BalancerForks = [] -const kava_CrvVaultAddr = [] - -const polygonMasterChef = (masterChef, pid) => async ( - timestamp, - block, - chainBlocks, -) => { - const balances = {} - - const lp_addresses = ( - await sdk.api.abi.multiCall({ - chain: 'polygon', - block: chainBlocks['polygon'], - calls: [ - { - target: masterChef, - params: [pid], - }, - ], - abi: abi.poolInfo, - }) - ).output.map((val) => val.output.lpToken) - - const lp_symbols = ( - await sdk.api.abi.multiCall({ - chain: 'polygon', - block: chainBlocks['polygon'], - calls: lp_addresses.map((address) => ({ - target: address, - })), - abi: abi.symbol, - }) - ).output.map((val) => val.output) - - const vault_balances = ( - await sdk.api.abi.multiCall({ - chain: 'polygon', - block: chainBlocks['polygon'], - calls: lp_addresses.map((lp) => ({ - target: lp, - params: masterChef, - })), - abi: 'erc20:balanceOf', - }) - ).output.map((val) => val.output) - - const lpPositions = [] - const singlePositions = [] - - lp_addresses.forEach((v, idx) => { - if (lp_symbols[idx] === 'UNI-V2') { - lpPositions.push({ - vaultAddr: lp_addresses[idx], - balance: vault_balances[idx], - token: lp_addresses[idx], - }) - } else if (lp_addresses[idx] !== '') { - singlePositions.push({ - vaultAddr: lp_addresses[idx], - balance: vault_balances[idx], - token: lp_addresses[idx], - }) - } - }) - - const transformAddress = transformAddressKF() - - await unwrapUniswapLPs( - balances, - lpPositions, - chainBlocks['polygon'], - 'polygon', - transformAddress, - ) - - await getSinglePositions( - balances, - singlePositions, - chainBlocks['polygon'], - 'polygon', - transformAddress, - ) - - return balances -} - -const polygonTvl = ({ include, exclude }) => async ( - timestamp, - block, - chainBlocks, -) => { - const balances = {} - -/* const vaults_full = (await utils.fetchURL(current_polygon_vaults_url)).data - let vaults = vaults_full.map( v => v['vault']) */ - let vaults = (await getConfig('kogefarm/polygon',current_polygon_vaults_url)) - - if (include) { - vaults = include - } - if (exclude) { - vaults = vaults.filter( - (v) => !exclude.find((e) => e.toLowerCase() === v.toLowerCase()), - ) - } - - const lp_addresses = ( - await sdk.api.abi.multiCall({ - chain: 'polygon', - block: chainBlocks['polygon'], - calls: vaults.map((vaultAddr) => ({ - target: vaultAddr, - })), - abi: abi.token, - }) - ).output.map((val) => val.output) - - const lp_symbols = ( - await sdk.api.abi.multiCall({ - chain: 'polygon', - block: chainBlocks['polygon'], - calls: lp_addresses.map((address) => ({ - target: address, - })), - abi: abi.symbol, - }) - ).output.map((val) => val.output) - - const vault_balances = ( - await sdk.api.abi.multiCall({ - chain: 'polygon', - block: chainBlocks['polygon'], - calls: vaults.map((vaultAddr) => ({ - target: vaultAddr, - })), - abi: abi.balance, - }) - ).output.map((val) => val.output) - - const lpPositions = [] - const singlePositions = [] - const crvPositions = [] - - vaults.forEach((v, idx) => { - if ( - lp_symbols[idx] === 'UNI-V2' || - (lp_symbols[idx] === 'DFYNLP') | - (lp_symbols[idx] === 'SLP') | - (lp_symbols[idx] === 'WLP') | - (lp_symbols[idx] === 'ELP') | - (lp_symbols[idx] === 'FLP') | - (lp_symbols[idx] === 'pWINGS-LP') | - (lp_symbols[idx] === 'APE-LP') | - (lp_symbols[idx] === 'GLP') | - (lp_symbols[idx] === 'Cafe-LP') - ) { - lpPositions.push({ - vaultAddr: vaults[idx], - balance: vault_balances[idx], - token: lp_addresses[idx], - }) - } else if ((lp_symbols[idx] === 'crvUSDBTCETH') | (lp_symbols[idx] === 'am3CRV') | (lp_symbols[idx] === 'btcCRV')) { - crvPositions.push({ - vaultAddr: vaults[idx], - balance: vault_balances[idx], - token: lp_addresses[idx], - }) - } else if (vaults[idx] !== '') { - singlePositions.push({ - vaultAddr: vaults[idx], - balance: vault_balances[idx], - token: lp_addresses[idx], - }) - } - }) - - const transformAddress = transformAddressKF() - - await unwrapUniswapLPs( - balances, - lpPositions, - chainBlocks['polygon'], - 'polygon', - transformAddress, - ) - - await unwrapCrvLPs( - balances, - crvPositions, - chainBlocks['polygon'], - 'polygon', - transformAddress, - ) - - await getSinglePositions( - balances, - singlePositions, - chainBlocks['polygon'], - 'polygon', - transformAddress, - ) - - return balances -} - -const fantomTvl = async (timestamp, block, chainBlocks) => { - let balances = {} - - let vaults = (await getConfig('kogefarm/fantom', current_fantom_vaults_url)) - - const lp_addresses = ( - await sdk.api.abi.multiCall({ - chain: 'fantom', - block: chainBlocks['fantom'], - calls: vaults.map((vault) => ({ - target: vault.vault, - })), - abi: abi.token, - }) - ).output.map((val) => val.output) - - vaults = vaults.map((e, idx) => ({ ...e, lp_address: lp_addresses[idx] })) - - const vault_balances = ( - await sdk.api.abi.multiCall({ - chain: 'fantom', - block: chainBlocks['fantom'], - calls: vaults.map((vault) => ({ - target: vault.vault, - })), - abi: abi.balance, - }) - ).output.map((val) => val.output) - - vaults = vaults.map((e, idx) => ({ ...e, balance: vault_balances[idx] })) - - const uniV2Positions = [] - const balancerPositions = [] - const crvPositions = [] - - // We populate the positions by protocol - vaults.forEach((vault) => { - const pushElem = (array) => - array.push({ - vaultAddr: vault.vault, - balance: vault.balance, - token: vault.lp_address, - name: vault.__comment, - }) - // Balancer - if ( - ftm_BalancerForks - .map((e) => String(vault.__comment).toLowerCase().includes(e.name)) - .reduce((p, c) => p && c, true) - ) { - pushElem(balancerPositions) - } - // CRV - else if ((ftm_CrvVaultAddr.includes(vault.vault)) | (String(vault.__comment).toLowerCase().includes('curve '))) { - pushElem(crvPositions) - } - // Uni-V2 - else { - pushElem(uniV2Positions) - } - }) - - const transformAddress = transformAddressKF('fantom') - - await unwrapUniswapLPs( - balances, - uniV2Positions, - chainBlocks['fantom'], - 'fantom', - transformAddress, - ) - await unwrapCrvLPs( - balances, - crvPositions, - chainBlocks['fantom'], - 'fantom', - transformAddress, - ) - - await unwrapBalancerLPs( - beethovenX, - balances, - balancerPositions, - chainBlocks['fantom'], - 'fantom', - transformAddress, - ) - - // Convert wMEMO into Time by dividing by 10 ** 9 and multiplying by the wMemo to Memo ratio - const TIME = 'avax:0xb54f16fb19478766a268f172c9480f8da1a7c9c3'; - if (TIME in balances){ - // First, find the wMemo to Memo ratio by looking at the total supply of wMemo divided by the Memo locked - const wMemoSupply = ( - await sdk.api.abi.call({ - chain: 'avax', - block: chainBlocks['avax'], - target: "0x0da67235dD5787D67955420C84ca1cEcd4E5Bb3b", - abi: abi.totalSupply, - }) - ).output - const memoLocked = ( - await sdk.api.abi.call({ - chain: 'avax', - block: chainBlocks['avax'], - target: "0x136Acd46C134E8269052c62A67042D6bDeDde3C9", - params: ["0x0da67235dD5787D67955420C84ca1cEcd4E5Bb3b"], - abi: abi.balanceOf, - }) - ).output - const memoPerWMemo = memoLocked / wMemoSupply * 10 ** 9 - - // Then, multiply the wMEMO balance by memo per wMemo ratio, use price of Time as price of Memo since they are 1:1 - balances[TIME] = Math.floor(balances[TIME] * memoPerWMemo / 10 ** 9); - } - - // Convert sSpell into Spell by multiplying by the appropriate ratio - const sSpell = 'fantom:0xbb29d2a58d880af8aa5859e30470134deaf84f2b'; - if (sSpell in balances){ - // First, find the spell to staked spell ratio by looking at the total supply of staked spell divided by the spell locked - const sSpellSupply = ( - await sdk.api.abi.call({ - chain: 'ethereum', - block: chainBlocks['ethereum'], - target: "0x26FA3fFFB6EfE8c1E69103aCb4044C26B9A106a9", - abi: abi.totalSupply, - }) - ).output - const spellLocked = ( - await sdk.api.abi.call({ - chain: 'ethereum', - block: chainBlocks['ethereum'], - target: "0x090185f2135308BaD17527004364eBcC2D37e5F6", - params: ["0x26FA3fFFB6EfE8c1E69103aCb4044C26B9A106a9"], - abi: abi.balanceOf, - }) - ).output - const spellPersSpell = spellLocked / sSpellSupply - - // Then, multiply the staked spell balance by spell to staked spell ratio - balances[sSpell] = Math.floor(balances[sSpell] * spellPersSpell); - } - - // Convert sUSDT into USDT by multiplying by the appropriate ratio - const sUSDT = 'polygon:0x29e38769f23701A2e4A8Ef0492e19dA4604Be62c'; - if (sUSDT in balances){ - // First, find the USDT to staked USDT ratio by looking at the total supply of staked usdt divided by the s*usdt issued - const sUSDTSupply = ( - await sdk.api.abi.call({ - chain: 'polygon', - block: chainBlocks['polygon'], - target: "0x29e38769f23701A2e4A8Ef0492e19dA4604Be62c", - abi: abi.totalSupply, - }) - ).output - const sUSDTLiquidity = ( - await sdk.api.abi.call({ - chain: 'polygon', - block: chainBlocks['polygon'], - target: "0x29e38769f23701A2e4A8Ef0492e19dA4604Be62c", - abi: abi.totalLiquidity, - }) - ).output - const usdtPersUSDT = sUSDTLiquidity / sUSDTSupply - // Then, multiply the staked spell balance by spell to staked spell ratio - balances[sUSDT] = Math.floor(balances[sUSDT] * usdtPersUSDT); - } - - // Convert sUSDC into USDC by multiplying by the appropriate ratio - const sUSDC = 'polygon:0x1205f31718499dBf1fCa446663B532Ef87481fe1'; - if (sUSDC in balances){ - // First, find the USDC to staked USDC ratio by looking at the total supply of staked usdc divided by the s*usdc issued - const sUSDCSupply = ( - await sdk.api.abi.call({ - chain: 'polygon', - block: chainBlocks['polygon'], - target: "0x1205f31718499dBf1fCa446663B532Ef87481fe1", - abi: abi.totalSupply, - }) - ).output - const sUSDCLiquidity = ( - await sdk.api.abi.call({ - chain: 'polygon', - block: chainBlocks['polygon'], - target: "0x1205f31718499dBf1fCa446663B532Ef87481fe1", - abi: abi.totalLiquidity, - }) - ).output - const usdcPersUSDC = sUSDCLiquidity / sUSDCSupply - - // Then, multiply the staked spell balance by spell to staked spell ratio - balances[sUSDC] = Math.floor(balances[sUSDC] * usdcPersUSDC); - } - - return balances -} - -const moonriverTvl = async (timestamp, block, chainBlocks) => { - const balances = {} - - let vaults = (await getConfig('kogefarm/moonriver', current_moonriver_vaults_url)) - - const lp_addresses = ( - await sdk.api.abi.multiCall({ - chain: 'moonriver', - block: chainBlocks['moonriver'], - calls: vaults.map((vault) => ({ - target: vault.vault, - })), - abi: abi.token, - }) - ).output.map((val) => val.output) - - vaults = vaults.map((e, idx) => ({ ...e, lp_address: lp_addresses[idx] })) - - const vault_balances = ( - await sdk.api.abi.multiCall({ - chain: 'moonriver', - block: chainBlocks['moonriver'], - calls: vaults.map((vault) => ({ - target: vault.vault, - })), - abi: abi.balance, - }) - ).output.map((val) => val.output) - - vaults = vaults.map((e, idx) => ({ ...e, balance: vault_balances[idx] })) - - const uniV2Positions = [] - const balancerPositions = [] - const crvPositions = [] - - // We populate the positions by protocol - vaults.forEach((vault) => { - const pushElem = (array) => - array.push({ - vaultAddr: vault.vault, - balance: vault.balance, - token: vault.lp_address, - name: vault.__comment, - }) - // Balancer - if ( - movr_BalancerForks.length && - movr_BalancerForks - .map((e) => String(vault.__comment).toLowerCase().includes(e.name)) - .reduce((p, c) => p && c, true) - ) { - pushElem(balancerPositions) - } - // CRV - else if (movr_CrvVaultAddr.includes(vault.vault)) { - pushElem(crvPositions) - } - // Uni-V2 - else { - pushElem(uniV2Positions) - } - }) - - const transformAddress = transformAddressKF('moonriver') - - await unwrapUniswapLPs( - balances, - uniV2Positions, - chainBlocks['moonriver'], - 'moonriver', - transformAddress, - ) - - await unwrapCrvLPs( - balances, - crvPositions, - chainBlocks['moonriver'], - 'moonriver', - transformAddress, - ) - - await unwrapBalancerLPs( - beethovenX, - balances, - balancerPositions, - chainBlocks['moonriver'], - 'moonriver', - transformAddress, - ) - - return balances -} - -const kavaTvl = async (timestamp, block, chainBlocks) => { - - let balances = {}; - - let vaults = (await getConfig('kogefarm/kava', current_kava_vaults_url)) - if (typeof vaults === 'string') vaults = JSON.parse(vaults.replace(/,(\s*[}\]])/g, '$1')) - - const lp_addresses = ( - await sdk.api.abi.multiCall({ - chain: 'kava', - block: chainBlocks['kava'], - calls: vaults.map((vault) => ({ - target: vault.vault, - })), - abi: abi.token, - }) - ).output.map((val) => val.output) - - vaults = vaults.map((e, idx) => ({ ...e, lp_address: lp_addresses[idx] })) - - const vault_balances = ( - await sdk.api.abi.multiCall({ - chain: 'kava', - block: chainBlocks['kava'], - calls: vaults.map((vault) => ({ - target: vault.vault, - })), - abi: abi.balance, - }) - ).output.map((val) => val.output) - - vaults = vaults.map((e, idx) => ({ ...e, balance: vault_balances[idx] })) - - const lp_symbols = ( - await sdk.api.abi.multiCall({ - chain: 'kava', - block: chainBlocks['kava'], - calls: vaults.map((vault) => ({ - target: vault.lp_address, - })), - abi: abi.symbol, - }) - ).output.map((val) => val.output) - - vaults = vaults.map((e, idx) => ({ ...e, symbol: lp_symbols[idx] })) - - const singlePositions = [] - const uniV2Positions = [] - const balancerPositions = [] - const crvPositions = [] - - // We populate the positions by protocol - vaults.forEach((vault) => { - const pushElem = (array) => - array.push({ - vaultAddr: vault.vault, - balance: vault.balance, - token: vault.lp_address, - symbol: vault.symbol, - name: vault.__comment, - }) - // Balancer - if ( - kava_BalancerForks.length && - kava_BalancerForks - .map((e) => String(vault.__comment).toLowerCase().includes(e.name)) - .reduce((p, c) => p && c, true) - ) { - pushElem(balancerPositions) - } - // CRV - else if (kava_CrvVaultAddr.includes(vault.vault)) { - pushElem(crvPositions) - } - // Uni-V2 - else if (vault.symbol==="Uni-V2" || vault.symbol==="SLP" || vault.symbol==="JUPITER-LP"){ - pushElem(uniV2Positions) - } - else{ - pushElem(singlePositions) - } - }) - - const transformAddress = transformAddressKF('kava') - - await unwrapUniswapLPs( - balances, - uniV2Positions, - chainBlocks['kava'], - 'kava', - transformAddress, - ) - - await getSinglePositions( - balances, - singlePositions, - chainBlocks['kava'], - 'kava', - transformAddress, - ) - - await unwrapCrvLPs( - balances, - crvPositions, - chainBlocks['kava'], - 'kava', - transformAddress, - ) - - await unwrapBalancerLPs( - beethovenX, - balances, - balancerPositions, - chainBlocks['kava'], - 'kava', - transformAddress, - ) - - return balances -} - const kogeMasterChefAddr = '0x6275518a63e891b1bC54FEEBBb5333776E32fAbD' -// vKogeKoge -const _polygonStaking = polygonMasterChef(kogeMasterChefAddr, 1) - // Pool2 const kogecoinVaultAddr = '0x992Ae1912CE6b608E0c0d2BF66259ab1aE62A657' const kogecoinMaticVaultAddr = '0xb7D3e1C5cb26D088d619525c6fD5D8DDC1B543d1' @@ -666,7 +16,6 @@ const kogecoinAlphaVaultAddr = '0xD02064bEd4126ACCCe79431A52F206C558479648' const kogecoinTamagoVaultAddr = '0xA838F1e986b27d7AC5a977c7d0eCbADFFCDC7Bb5' const _kogePool2 = [ - kogecoinVaultAddr, kogecoinMaticVaultAddr, kogecoinSageVaultAddr, kogecoinIrisVaultAddr, @@ -676,36 +25,38 @@ const _kogePool2 = [ kogecoinAlphaVaultAddr, kogecoinTamagoVaultAddr ] -const _polygonPool2 = async (timestamp, block, chainBlocks) => { - return { - ...(await polygonTvl({ - include: _kogePool2.filter((p) => p !== kogecoinVaultAddr), - })(timestamp, block, chainBlocks)), - ...(await polygonMasterChef(kogeMasterChefAddr, 0)( - timestamp, - block, - chainBlocks, - )), - } + +const config = { + kava: { endpoint: 'https://raw.githubusercontent.com/kogecoin/vault-contracts/main/kava_vault_addresses.json', }, + moonriver: { endpoint: 'https://raw.githubusercontent.com/kogecoin/vault-contracts/main/movr_vault_addresses.json', }, + fantom: { endpoint: 'https://raw.githubusercontent.com/kogecoin/vault-contracts/main/ftm_vault_addresses.json', }, + polygon: { endpoint: 'https://raw.githubusercontent.com/kogecoin/vault-contracts/main/vaultaddresses', }, } -const _polygonTvl = polygonTvl({ - exclude: _kogePool2, + +Object.keys(config).forEach(chain => { + const { endpoint } = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + let info = (await getConfig('kogefarm/' + chain, endpoint)) + if (typeof info === 'string') info = JSON.parse(vaults.replace(/,(\s*[}\]])/g, '$1')) + let vaults = chain === 'polygon' ? info : info.map(v => v.vault) + if (chain === 'polygon') + vaults = vaults.filter(v => !_kogePool2.includes(v)) + const tokens = await api.multiCall({ abi: abi.token, calls: vaults }) + const bals = await api.multiCall({ abi: abi.balance, calls: vaults }) + api.addTokens(tokens, bals) + return sumUnknownTokens({ api, resolveLP: true, }) + } + } }) -module.exports = { - methodology: `The vaults are obtained through the following links: polygon:"${current_polygon_vaults_url}", fantom:"${current_fantom_vaults_url}, moonriver:"${current_moonriver_vaults_url}". By getting the vaults, we can then pull LP token deposit amounts. We then take the LP token deposits and unwrap them to count each token individually.`, - polygon: { - tvl: _polygonTvl, - staking: _polygonStaking, - pool2: _polygonPool2, - }, - fantom: { - tvl: fantomTvl, - }, - moonriver: { - tvl: moonriverTvl, - }, - kava: { - tvl: kavaTvl, - }, +module.exports.polygon.pool2 = async (_, _b, _cb, { api, }) => { + const tokens = await api.multiCall({ abi: abi.token, calls: _kogePool2 }) + const bals = await api.multiCall({ abi: abi.balance, calls: _kogePool2 }) + api.addTokens(tokens, bals) + return sumUnknownTokens({ api, resolveLP: true, tokens: ['0x3885503aef5e929fcb7035fbdca87239651c8154'], owner: kogeMasterChefAddr, }) } + +module.exports.polygon.staking = async (_, _b, _cb, { api, }) => { + return sumUnknownTokens({ api, tokens: ['0x13748d548D95D78a3c83fe3F32604B4796CFfa23'], owner: kogeMasterChefAddr, }) +} \ No newline at end of file diff --git a/projects/kokonut-swap/index.js b/projects/kokonut-swap/index.js index 7c6f58e6577..f7290c0dc85 100644 --- a/projects/kokonut-swap/index.js +++ b/projects/kokonut-swap/index.js @@ -1,6 +1,5 @@ const abi = require("./abi.json"); const sdk = require("@defillama/sdk"); -const { requery } = require('../helper/requery.js'); const { sumTokens2 } = require("../helper/unwrapLPs"); const { getUniTVL } = require("../helper/unknownTokens"); @@ -33,7 +32,7 @@ async function klaytn_tvl(timestamp, _, { klaytn: block }) { for (const data of info.output) { const { output: poolInfo, input: { params } } = data if (!poolInfo) { - console.log('pool info missing for ', params) + sdk.log('pool info missing for ', params) continue; } for (let token of poolInfo.tokens) { diff --git a/projects/kromatika/index.js b/projects/kromatika/index.js index e7d6fbb0d60..1afc239600a 100644 --- a/projects/kromatika/index.js +++ b/projects/kromatika/index.js @@ -48,7 +48,6 @@ Object.keys(contracts).forEach(chain => { if (chain === 'optimism') return opTvl(api, position) const orderIds = [] const monitors = await api.fetchList({ lengthAbi: 'uint256:monitorsLength', target: position, itemAbi: abi.monitors }) - console.log(monitors, chain) for (const monitor of monitors) { const _orderIds = await api.fetchList({ target: monitor, lengthAbi: 'uint256:getTokenIdsLength', itemAbi: abi.tokenIds, }) orderIds.push(..._orderIds) diff --git a/projects/maker/index.js b/projects/maker/index.js index 2dc14f6257a..206b8bc0cad 100644 --- a/projects/maker/index.js +++ b/projects/maker/index.js @@ -81,7 +81,7 @@ async function tvl(timestamp, block, _, { api }) { const failedCalls = dogRes.filter(i => !i.success) if (failedCalls.length) { - failedCalls.forEach(i => console.log('Failed both gem and dog calls', i.input.target)) + failedCalls.forEach(i => sdk.log('Failed both gem and dog calls', i.input.target)) throw new Error('Failed both gem and dog calls') } } diff --git a/projects/metf-finance/index.js b/projects/metf-finance/index.js index 7bf991b47a4..619cad7f487 100644 --- a/projects/metf-finance/index.js +++ b/projects/metf-finance/index.js @@ -103,7 +103,6 @@ async function staking(timestamp, block, chainBlocks) { const balances = { ["cronos:0xb8df27c687c6af9afe845a2afad2d01e199f4878"]: staked } - // console.log(balances) return balances } diff --git a/projects/muuu/tvl.js b/projects/muuu/tvl.js index 9955b135568..5a6d619f128 100644 --- a/projects/muuu/tvl.js +++ b/projects/muuu/tvl.js @@ -47,7 +47,6 @@ async function addTokensInPool(api, lpToken, tokenBal) { const { pool , tokenCount } = mappingPool bals = await api.multiCall({ abi: "function balances(uint256) view returns (uint256)", target: pool, calls: Array(tokenCount).fill(0).map((_, i) => i)}) tokens = await api.multiCall({ abi: ABI.coins, target: pool, calls: Array(tokenCount).fill(0).map((_, i) => i)}) - console.log(bals, tokens) } else { tokens = await api.call({ abi: ABI.get_coins, target: REGISTRY_ADDRESS, params: pool }) bals = await api.call({ abi: ABI.get_balances, target: REGISTRY_ADDRESS, params: pool }) diff --git a/projects/nested/index.js b/projects/nested/index.js index 89045bb4a20..b80b1429b98 100644 --- a/projects/nested/index.js +++ b/projects/nested/index.js @@ -54,7 +54,6 @@ function chainTvl_onchain(chain) { .map(t => t.substring(t.indexOf(':') + 1)) const reserveTokens = [...new Set(recordsTokens.flat())] - // console.log(`${chain}: All tokens from every nested records`, reserveTokens) const tokenBalances = await sdk.api.abi.multiCall({ calls: reserveTokens.map(t => ({ diff --git a/projects/nftx/index.js b/projects/nftx/index.js index 49cdb513664..552a08d5a17 100644 --- a/projects/nftx/index.js +++ b/projects/nftx/index.js @@ -64,8 +64,6 @@ function getTvl(chain) { print.push({ id: vault.token.id, balance, name: vault.token.name, val: total }) }) print.sort((a, b) => b.val - a.val) - // console.table(print) - // console.log(print.reduce((a, i) => a + i.val, 0)) updateBalances(balances) const transformedBalances = {} diff --git a/projects/ocean-protocol/index.js b/projects/ocean-protocol/index.js index c497e3e888f..5c60c99e435 100644 --- a/projects/ocean-protocol/index.js +++ b/projects/ocean-protocol/index.js @@ -113,7 +113,6 @@ function chainTvl(chain) { const OCEAN_balance_gt_0 = OCEAN_balances.output.map(b => b.output > 0) pools = pools.filter((p, i) => OCEAN_balance_gt_0[i]) OCEAN_balances.output = OCEAN_balances.output.filter((p, i) => OCEAN_balance_gt_0[i]) - // console.log('pools.length before filtering', query.poolFactories[0].poolCount, 'after isFinalized and balancesGt0 filters', pools.length) // Get Normalized weights to account for balance of data-tokens // At pool creation, the OCEAN collateral is used to mint data-tokens with a given ratio of OCEAN/datatoken like 50-50 70-30 or 90-10 diff --git a/projects/parallel-lending/api.js b/projects/parallel-lending/api.js index c0b44858ae4..913db0afaa0 100644 --- a/projects/parallel-lending/api.js +++ b/projects/parallel-lending/api.js @@ -60,16 +60,13 @@ async function getLendingData(api, chain) { const supply = totalSupplyMapping[token] const rate = exchangeRateMapping[token] / 1e18 const borrowed = totalBorrowMapping[token] || 0 - // console.log(token, supply, rate, borrowed, (supply * rate) - borrowed ) balances[token] = (supply * rate) - borrowed }) // underlyingIds.forEach((id, i) => { // const token = +id.toString() - // console.log(token, totalReserves[i]) // if (totalReserves[i] > 0) // balances[token] = totalReserves[token] * exchangeRateMapping[token] / 1e18 // }) - // console.log('lendo', balances) const { updateBalances } = await getTokenPrices({ api, chain }) return updateBalances(balances) } @@ -92,7 +89,6 @@ async function getBorrowedData(api, chain) { // if (totalBorrows[i] > 0) // balances[token] = totalBorrows[i] // }) - // console.log('brooro', balances) const { updateBalances } = await getTokenPrices({ api, chain }) return updateBalances(balances) } diff --git a/projects/piedao/pieDAO.js b/projects/piedao/pieDAO.js index 44349e54ee4..c2dba91205d 100644 --- a/projects/piedao/pieDAO.js +++ b/projects/piedao/pieDAO.js @@ -135,7 +135,6 @@ module.exports = class PieDAO { target: poolAddress, abi: IStakingBalancer.uni })).output; - //console.log("calculatePools", stakingPool.type, underlyingAddress); underlyingBalance = new BigNumber((await sdk.api.erc20.balanceOf({ target: underlyingAddress, owner: poolAddress })).output); underlyingSupply = new BigNumber((await sdk.api.erc20.totalSupply({ target: underlyingAddress })).output); diff --git a/projects/polymarket.js b/projects/polymarket.js index 39c70a6c4d6..4d1fecb6666 100644 --- a/projects/polymarket.js +++ b/projects/polymarket.js @@ -20,7 +20,7 @@ async function polygon(timestamp, block, chainBlocks) { // Total open interest: the conditional tokens are held at 0x4D97DCd97eC945f40cF65F87097ACe5EA0476045 and then each market has it's own contract, the address of which is the id of the FixedProductMarketMaker //const tvl = marketsLiquidity.plus(conditionalTokensUSDC).toFixed(0) - //console.log(`-----\n${marketsLiquidity.div(1e12).toFixed(8)}M of marketsLiquidity \n${conditionalTokensUSDC.div(1e12).toFixed(8)}M of conditionalTokensUSDC \nTVL: ${BigNumber(tvl).div(1e12).toFixed(2)}M\n`) + //sdk.log(`-----\n${marketsLiquidity.div(1e12).toFixed(8)}M of marketsLiquidity \n${conditionalTokensUSDC.div(1e12).toFixed(8)}M of conditionalTokensUSDC \nTVL: ${BigNumber(tvl).div(1e12).toFixed(2)}M\n`) return {['polygon:' + polygonUsdcContract]: conditionalTokensUSDC.output}; } diff --git a/projects/pwn/index.js b/projects/pwn/index.js index 9406d8b8a43..d10e013fa5c 100644 --- a/projects/pwn/index.js +++ b/projects/pwn/index.js @@ -43,7 +43,7 @@ module.exports = { }, cronos: { tvl: sumTokensExport({ - owners: [PWN_BUNDLER_CRONOS, PWN_V1_1_SIMPLE_LOAN_B], fetchCoValentTokens: true, + owners: [PWN_BUNDLER_CRONOS, PWN_V1_1_SIMPLE_LOAN_B], fetchCoValentTokens: true, tokenConfig: { useCovalent: true, }, }), }, base: { diff --git a/projects/quasar/index.js b/projects/quasar/index.js index 068a5a1689c..7e3e380e90a 100644 --- a/projects/quasar/index.js +++ b/projects/quasar/index.js @@ -36,21 +36,16 @@ async function tvl() { for (const poolID in lpStrategyContracts) { let lpContracts = lpStrategyContracts[poolID]; for (const contractAddress of lpContracts) { - try { - let ica_balances = await queryContract({ - contract: contractAddress, - chain: chain, - data: { 'ica_balance': {} } - }); + let ica_balances = await queryContract({ + contract: contractAddress, + chain: chain, + data: { 'ica_balance': {} } + }); - let denom = ica_balances.amount.denom; - let amount = Number(ica_balances.amount.amount); + let denom = ica_balances.amount.denom; + let amount = Number(ica_balances.amount.amount); - api.add(denom, amount) - } catch (e) { - console.log(e) - continue; - } + api.add(denom, amount) } } diff --git a/projects/rabbitfinance/index.js b/projects/rabbitfinance/index.js index 48b248c7937..79a107ea945 100644 --- a/projects/rabbitfinance/index.js +++ b/projects/rabbitfinance/index.js @@ -1,8 +1,7 @@ -const ADDRESSES = require('../helper/coreAssets.json') +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); const { staking } = require("../helper/staking"); -// const { covalentGetTokens } = require("../helper/http"); const { getChainTransform } = require("../helper/portedTokens"); const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); @@ -22,10 +21,6 @@ const bscTvl = async (timestamp, ethBlock, { [chain]: block }) => { const balances = {}; const transformAddress = await getChainTransform(chain) - /*** Rabbit Farm TVL Portion ***/ - // let poolsInfo = ( - // await covalentGetTokens(BANK_CONTRACT, chain) - // ).map((addr) => addr.contract_address); const poolsInfo = [ ADDRESSES.bsc.USDT, diff --git a/projects/railgun/index.js b/projects/railgun/index.js index abc8d449f93..3675bc7c2d5 100644 --- a/projects/railgun/index.js +++ b/projects/railgun/index.js @@ -1,4 +1,3 @@ -const { covalentGetTokens } = require('../helper/http'); const { sumTokens2 } = require('../helper/unwrapLPs') const { staking } = require('../helper/staking') @@ -31,9 +30,8 @@ const blacklistedTokens = [ function getTVLFunc(contractAddress, chain) { return async function (timestamp, _, { [chain]: block }, { api }) { - const tokens = await covalentGetTokens(contractAddress, chain); if (CONTRACTS[chain].RAIL) blacklistedTokens.push(CONTRACTS[chain].RAIL) - return sumTokens2({ owner: contractAddress, tokens, blacklistedTokens, api }) + return sumTokens2({ owner: contractAddress, fetchCoValentTokens: true, blacklistedTokens, api }) } } @@ -44,9 +42,6 @@ function getChainTVL(chain) { }; } -module.exports = { -}; - Object.keys(CONTRACTS).forEach(chain => { module.exports[chain] = getChainTVL(chain) }) diff --git a/projects/rari/index.js b/projects/rari/index.js index 5d8d5cfc694..b7972bdf00f 100644 --- a/projects/rari/index.js +++ b/projects/rari/index.js @@ -47,12 +47,6 @@ const tokenMapWithKeysAsSymbol = { const fusePoolData = {} async function getFusePoolData(pools, block) { - console.log({ - target: fusePoolLensAddress, - abi: abi['getPoolSummary'], - block, - calls: pools.map(i => i.comptroller) - }) const data = { output: [] } const chunks = sliceIntoChunks(pools.map(i => ({ params: i.comptroller })), 25) for (const chunk of chunks) { @@ -62,7 +56,6 @@ async function getFusePoolData(pools, block) { block, calls: chunk }) - console.log(items) data.output.push(...items.output) } return data @@ -81,7 +74,6 @@ async function getFusePools(timestamp, block, balances, borrowed) { fusePoolData[block] = getFusePoolData(fusePools, block) const poolSummaries = await fusePoolData[block] - console.log(poolSummaries) for (let summaryResult of poolSummaries.output) { if (summaryResult.success) { diff --git a/projects/rehold-v2/index.js b/projects/rehold-v2/index.js index d42de3b0345..47a1a9d6903 100644 --- a/projects/rehold-v2/index.js +++ b/projects/rehold-v2/index.js @@ -1,18 +1,8 @@ -const { sumTokens2 } = require('../helper/unwrapLPs') -const { covalentGetTokens } = require('../helper/http') +const { sumTokensExport } = require('../helper/unwrapLPs') const VAULT_V2 = '0xde6b4964c4384bcdfa150a4a8be9865c5b91e29c'; -async function tvl(_, _b, _cb, { api, }) { - const tokens = await covalentGetTokens(VAULT_V2, api.chain) - - return sumTokens2({ - api, - owner: VAULT_V2, - tokens, - blacklistedTokens: ['0x594f9274e08ba6c5760bacfba795b1879af17255'], - }); -} +const tvl = sumTokensExport({ owner: VAULT_V2, fetchCoValentTokens: true, blacklistedTokens: ['0x594f9274e08ba6c5760bacfba795b1879af17255'], }) module.exports = { ethereum: { tvl }, diff --git a/projects/rehold/index.js b/projects/rehold/index.js index 64f9047d4df..daef476289c 100644 --- a/projects/rehold/index.js +++ b/projects/rehold/index.js @@ -1,15 +1,7 @@ -const { sumTokens2 } = require('../helper/unwrapLPs') -const { covalentGetTokens } = require('../helper/http') +const { sumTokensExport } = require('../helper/unwrapLPs') const vault = '0xd476ce848c61650e3051f7571f3ae437fe9a32e0' -async function tvl(_, _b, _cb, { api, }) { - const tokens = await covalentGetTokens(vault, api.chain) - return sumTokens2({ - api, owner: vault, tokens, blacklistedTokens: [ - '0x594f9274e08ba6c5760bacfba795b1879af17255' - ] - }) -} +const tvl = sumTokensExport({ owner: vault, fetchCoValentTokens: true, }) module.exports = { bsc: { tvl }, diff --git a/projects/revest/index.js b/projects/revest/index.js index 78e3638a45e..26fab323137 100644 --- a/projects/revest/index.js +++ b/projects/revest/index.js @@ -1,7 +1,5 @@ const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens2, } = require("../helper/unwrapLPs") -const { covalentGetTokens, } = require("../helper/http") -const { getUniqueAddresses } = require('../helper/utils') const sdk = require("@defillama/sdk"); const CutoffABI = "function FNFT_CUTOFF() external view returns (uint256)" @@ -49,12 +47,12 @@ const config = { module.exports = { hallmarks: [ [1648339200, "Reentrancy attack"] -], + ], methodology: "We list all tokens in our vault and sum them together", }; Object.keys(config).forEach(chain => { - const { holder, revest, tokenVaultV2, fnftHandler} = config[chain] + const { holder, revest, tokenVaultV2, fnftHandler } = config[chain] module.exports[chain] = { tvl: async (_, _b, _1, { api }) => { let balances = {} @@ -68,16 +66,8 @@ Object.keys(config).forEach(chain => { if (tokenVaultV2 != null) { let info = await api.batchCall([ - { - target: tokenVaultV2, - abi: CutoffABI, - chain: chain - }, - { - target: fnftHandler, - abi: numFNFTSABI, - chain: chain - } + { target: tokenVaultV2, abi: CutoffABI, }, + { target: fnftHandler, abi: numFNFTSABI, } ]) let cutoff = Number(info[0]) @@ -85,7 +75,7 @@ Object.keys(config).forEach(chain => { //Build the Multicall to get the supply of each FNFT to check for ones that still exist let fnftSupplyCalls = [] - for(let x = cutoff; x < numFNFTS; x++) { + for (let x = cutoff; x < numFNFTS; x++) { fnftSupplyCalls.push({ target: fnftHandler, params: x, @@ -133,7 +123,7 @@ Object.keys(config).forEach(chain => { fnftConfigs.output.forEach(config => { if (!blacklist.includes(config.output[0].toLowerCase())) { tokenAddressesPerFNFT[config.input.params[0]] = config.output[0] - + walletCalls.push({ target: tokenVaultV2, params: [config.input.params[0]], @@ -177,23 +167,12 @@ Object.keys(config).forEach(chain => { balances[balance.input.target] = (Number(balances[balance.input.target]) + Number(balance.output)) }) - + } //Get values in tokenVaultV1 owners.push(holder); - let tokens = await covalentGetTokens(holder, api.chain) - tokens = getUniqueAddresses(tokens).filter(t => !blacklist.includes(t)) // filter out staking and LP tokens - let tokenVaultV1Balances = await sumTokens2({ api, owners: owners, tokens, }) - - //For each key in V1 Balances append to regular balances and return - Object.keys(balances).forEach(key => { - if (tokenVaultV1Balances[key] == undefined) { - tokenVaultV1Balances[`${chain}:${key}`] = 0 - } - tokenVaultV1Balances[`${chain}:${key}`] += balances[key] - }) - return tokenVaultV1Balances; + return sumTokens2({ balances, api, owners, fetchCoValentTokens: true, blacklistedTokens: blacklist, tokenConfig: { onlyWhitelisted: false, } }) }, } @@ -201,47 +180,46 @@ Object.keys(config).forEach(chain => { module.exports[chain].staking = async (_, _b, _1, { api }) => { //Get the number of FNFTS for the TokenVaultV2 let info = await api.batchCall([ - { - target: config[chain].tokenVaultV2, - abi: CutoffABI, - chain: chain - }, - { - target: config[chain].fnftHandler, - abi: numFNFTSABI, - chain: chain - } - ]) - - let cutoff = Number(info[0]) - let numFNFTS = Number(info[1]) - - //Build Multicall Data - let calls = [] - for(let x = cutoff; x < numFNFTS; x++) { - calls.push({ - target: config[chain].tokenVaultV2, - params: [x] - }) + { + target: config[chain].tokenVaultV2, + abi: CutoffABI, + chain: chain + }, + { + target: config[chain].fnftHandler, + abi: numFNFTSABI, + chain: chain } + ]) - //Get the wallet address for each FNFT via multicall - let walletMultiCallList = await sdk.api.abi.multiCall({ - abi: getWalletABI, - calls: calls, - chain: chain, - requery: true, - permitFailure: false - }) - let wallets = [] - walletMultiCallList.output.forEach(wallet => { - // console.log(`output: ${JSON.stringify(wallet)}`) - wallets.push(wallet.output) + let cutoff = Number(info[0]) + let numFNFTS = Number(info[1]) + + //Build Multicall Data + let calls = [] + for (let x = cutoff; x < numFNFTS; x++) { + calls.push({ + target: config[chain].tokenVaultV2, + params: [x] }) + } + + //Get the wallet address for each FNFT via multicall + let walletMultiCallList = await sdk.api.abi.multiCall({ + abi: getWalletABI, + calls: calls, + chain: chain, + requery: true, + permitFailure: false + }) + let wallets = [] + walletMultiCallList.output.forEach(wallet => { + wallets.push(wallet.output) + }) - wallets.push(holder); + wallets.push(holder); - //Return the balance of revest in every wallet. - return sumTokens2({ api, owners: wallets, tokens: [revest] }) + //Return the balance of revest in every wallet. + return sumTokens2({ api, owners: wallets, tokens: [revest] }) } }) \ No newline at end of file diff --git a/projects/rocketpool/index.js b/projects/rocketpool/index.js index fead07a1d65..b62bdf1b739 100644 --- a/projects/rocketpool/index.js +++ b/projects/rocketpool/index.js @@ -27,11 +27,9 @@ async function tvl(timestamp, ethBlock, chainBlocks) { }) const activeMinipoolCount_arr = [...Array(statusesCount).keys()].map(i => activeMinipoolCount[i.toString()]) minipool_count_per_status = minipool_count_per_status.map((sum, idx) => sum + parseInt(activeMinipoolCount[idx])) - // console.log('offset', offset, 'activeMinipoolCount', activeMinipoolCount, 'activeMinipoolCount_arr', activeMinipoolCount_arr) if (activeMinipoolCount_arr.reduce((a, b)=> a + parseInt(b), 0) < limit) { break; } offset += limit } - // console.log(`minipool_count_per_status / [unmatched*16, pending*32, staking*32, withdrawable*32] ${minipool_count_per_status}\n`) // Get ETH and RPL balance of multiple rocketpool contracts as well as RPL staked const [ @@ -100,7 +98,6 @@ async function tvl(timestamp, ethBlock, chainBlocks) { // rpl_tvl += solidity.to_float(rp.call("rocketVault.balanceOfToken", "rocketAuctionManager", rpl)) // slashed RPL that hasn't been auctioned off yet const RPL_tvl = parseFloat(totalRPLStake) + parseFloat(rocketDAONodeTrustedActions_rplBalance) + parseFloat(rocketAuctionManager_rplBalance) -// console.log(`staking_minipools: ${staking_minipools} // pending_minipools: ${pending_minipools} // unmatched_minipools: ${unmatched_minipools} // withdrawable_minipools: ${withdrawable_minipools} diff --git a/projects/sablier-v2/index.js b/projects/sablier-v2/index.js index 7f056a6c564..a81da1a9503 100644 --- a/projects/sablier-v2/index.js +++ b/projects/sablier-v2/index.js @@ -1,8 +1,5 @@ const ADDRESSES = require('../helper/coreAssets.json') -const { sumTokens2, sumTokensExport } = require('../helper/unwrapLPs') -const { covalentGetTokens } = require('../helper/http') const { isWhitelistedToken } = require('../helper/streamingHelper') -const { getUniqueAddresses } = require('../helper/utils') const { cachedGraphQuery } = require('../helper/cache') const blacklistedTokens = [ diff --git a/projects/sablier/index.js b/projects/sablier/index.js index c9bf052a0d1..934f0523827 100644 --- a/projects/sablier/index.js +++ b/projects/sablier/index.js @@ -1,6 +1,6 @@ const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens2, sumTokensExport } = require('../helper/unwrapLPs') -const { covalentGetTokens } = require('../helper/http') +const { covalentGetTokens } = require('../helper/token') const { isWhitelistedToken } = require('../helper/streamingHelper') const { getUniqueAddresses } = require('../helper/utils') @@ -12,7 +12,7 @@ const blacklistedTokens = [ ] async function getTokens(api, owners, isVesting) { - let tokens = (await Promise.all(owners.map(i => covalentGetTokens(i, api.chain)))).flat().filter(i => !blacklistedTokens.includes(i)) + let tokens = (await Promise.all(owners.map(i => covalentGetTokens(i, api, { onlyWhitelisted: false, })))).flat().filter(i => !blacklistedTokens.includes(i)) tokens = getUniqueAddresses(tokens) const symbols = await api.multiCall({ abi: 'erc20:symbol', calls: tokens }) return tokens.filter((v, i) => isWhitelistedToken(symbols[i], v, isVesting)) diff --git a/projects/stackswap/api.js b/projects/stackswap/api.js index 89c64945e2d..c599e65bf9f 100644 --- a/projects/stackswap/api.js +++ b/projects/stackswap/api.js @@ -17,7 +17,6 @@ async function tvl(_, _b, _cb, { api, }) { for (let i = cache.pairData.length +1; i <= pairCount; i++) { const pair = await call({ target: factory, abi: 'get-pair-contracts', inputArgs: [{ type: 'number', value: i }] }) cache.pairData.push(pair) - console.log('pair count: ', cache.pairData.length) } await setCache('stackswap', 'stacks-config', cache) @@ -32,7 +31,6 @@ async function tvl(_, _b, _cb, { api, }) { token0Bal: +pairData.value['balance-x'].value + +pairData.value['fee-balance-x'].value, token1Bal: +pairData.value['balance-y'].value + +pairData.value['fee-balance-y'].value, }) - console.log('pair data: ',++j) } return transformDexBalances({ chain: 'stacks', data}) } \ No newline at end of file diff --git a/projects/stakedao/index.js b/projects/stakedao/index.js index 9382c955e77..465c498b6dc 100644 --- a/projects/stakedao/index.js +++ b/projects/stakedao/index.js @@ -200,8 +200,6 @@ async function tvl(timestamp, block, _, { api }) { lockerMAVBal.push({ amount: balance, end: 0 }) } - console.log(lockerBals, lockerPendleBal, lockerMAVBal) - for (let i = 0; i < lockersInfos.length; ++i) { let amount; if (lockersInfos[i].veToken == vePendle) { diff --git a/projects/sudoswap/index.js b/projects/sudoswap/index.js index 5b1235cf79a..13a87f02d10 100644 --- a/projects/sudoswap/index.js +++ b/projects/sudoswap/index.js @@ -1,4 +1,4 @@ -const { graphFetchById, } = require('../helper/http') +const { graphFetchById, } = require('../helper/cache') const { ART_BLOCKS, sumArtBlocks } = require('../helper/nft') const sdk = require('@defillama/sdk') diff --git a/projects/superfluid.js b/projects/superfluid.js index d04b58f2300..6fa8ec27da9 100644 --- a/projects/superfluid.js +++ b/projects/superfluid.js @@ -75,7 +75,7 @@ async function getChainBalances(allTokens, chain, block, isVesting) { let underlyingTokenBalance = BigNumber(totalSupply * (10 ** (underlyingToken || { decimals: 18 }).decimals) / (10 ** decimals)).toFixed(0) // Accumulate to balances, the balance for tokens on mainnet or sidechain let prefixedUnderlyingAddress = underlyingAddress - // if (!underlyingToken && underlyingTokenBalance/1e24 > 1) console.log(name, symbol, chain, Math.floor(underlyingTokenBalance/1e24)) + // if (!underlyingToken && underlyingTokenBalance/1e24 > 1) sdk.log(name, symbol, chain, Math.floor(underlyingTokenBalance/1e24)) // if (isNativeAssetSuperToken) prefixedUnderlyingAddress = chain + ':' + underlyingAddress if (!underlyingToken || blacklist.has(underlyingAddress.toLowerCase())) return; sdk.util.sumSingleBalance(balances, prefixedUnderlyingAddress, underlyingTokenBalance) diff --git a/projects/tokenlon/index.js b/projects/tokenlon/index.js index d898b00d1ca..9d71d3c6390 100644 --- a/projects/tokenlon/index.js +++ b/projects/tokenlon/index.js @@ -1,7 +1,6 @@ const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); -const { covalentGetTokens } = require("../helper/http"); const { sumTokens2 } = require("../helper/unwrapLPs"); const { staking } = require("../helper/staking.js"); @@ -16,15 +15,15 @@ const PERMANENT_STORAGE_PROXY = "0x6D9Cc14a1d36E6fF13fc6efA9e9326FcD12E7903"; const STAGES_STAKING_CONTRACTS = [ //FIRST_STAGE - ["0x7924a818013f39cf800f5589ff1f1f0def54f31f", "0x929CF614C917944dD278BC2134714EaA4121BC6A",], + ["0x7924a818013f39cf800f5589ff1f1f0def54f31f", "0x929CF614C917944dD278BC2134714EaA4121BC6A",], //SECOND_STAGE_LON_ETH - ["0x7924a818013f39cf800f5589ff1f1f0def54f31f", "0xc348314f74b043ff79396e14116b6f19122d69f4",], + ["0x7924a818013f39cf800f5589ff1f1f0def54f31f", "0xc348314f74b043ff79396e14116b6f19122d69f4",], //SECOND_STAGE_LON_USDT - ["0x55d31f68975e446a40a2d02ffa4b0e1bfb233c2f", "0x11520d501e10e2e02a2715c4a9d3f8aeb1b72a7a",], + ["0x55d31f68975e446a40a2d02ffa4b0e1bfb233c2f", "0x11520d501e10e2e02a2715c4a9d3f8aeb1b72a7a",], //THIRD_STAGE_LON_ETH - ["0x7924a818013f39cf800f5589ff1f1f0def54f31f", "0x74379CEC6a2c9Fde0537e9D9346222a724A278e4",], + ["0x7924a818013f39cf800f5589ff1f1f0def54f31f", "0x74379CEC6a2c9Fde0537e9D9346222a724A278e4",], //THIRD_STAGE_LON_USDT - ["0x55d31f68975e446a40a2d02ffa4b0e1bfb233c2f", "0x539a67b6f9c3cad58f434cc12624b2d520bc03f8"], + ["0x55d31f68975e446a40a2d02ffa4b0e1bfb233c2f", "0x539a67b6f9c3cad58f434cc12624b2d520bc03f8"], ]; // Receives rewards/fee from AMM wrapper via reward distributor on WETH shape, some are sold for LON... @@ -32,30 +31,11 @@ const MULTISIG_ONE = "0x3557BD3d422300198719710Cc3f00194E1c20A46"; const WETH = ADDRESSES.ethereum.WETH; -const ethTvl = async (timestamp, block) => { - const amm_wrapper_addr = ( - await sdk.api.abi.call({ - abi: abi.ammWrapperAddr, - target: PERMANENT_STORAGE_PROXY, - block, - }) - ).output; +const ethTvl = async (timestamp, block, _, { api }) => { + const amm_wrapper_addr = await api.call({ abi: abi.ammWrapperAddr, target: PERMANENT_STORAGE_PROXY, }) + const pmm_addr = await api.call({ abi: abi.pmmAddr, target: PERMANENT_STORAGE_PROXY, }) - - const pmm_addr = ( - await sdk.api.abi.call({ - abi: abi.pmmAddr, - target: PERMANENT_STORAGE_PROXY, - block, - }) - ).output; - - const [ tokens_amm, tokens_pmm] = await Promise.all([covalentGetTokens(amm_wrapper_addr), covalentGetTokens(pmm_addr)]) - const toa = [] - tokens_amm.forEach(t => toa.push([t, amm_wrapper_addr])) - tokens_pmm.forEach(t => toa.push([t, pmm_addr])) - - return sumTokens2({ tokensAndOwners: toa, block, }); + return sumTokens2({ api, owners: [amm_wrapper_addr, pmm_addr], fetchCoValentTokens: true }); }; module.exports = { @@ -64,5 +44,5 @@ module.exports = { staking: staking(CONTRACT_FOR_STAKING, LON_TOKEN), pool2: (_, block) => sumTokens2({ tokensAndOwners: STAGES_STAKING_CONTRACTS, block, resolveLP: true }), }, - + }; diff --git a/projects/treasury/yearn.js b/projects/treasury/yearn.js index 7889fee6fbc..9c79c3fa320 100644 --- a/projects/treasury/yearn.js +++ b/projects/treasury/yearn.js @@ -22,7 +22,6 @@ module.exports = treasuryExports({ ], owners: [yearnTreasury,yearnTreasury1], ownTokens: [ADDRESSES.ethereum.YFI], - fetchTokens: true, }, arbitrum: { tokens: [ diff --git a/projects/vector/index.js b/projects/vector/index.js index 97308458c8d..86e13ff073e 100644 --- a/projects/vector/index.js +++ b/projects/vector/index.js @@ -41,7 +41,6 @@ async function tvl(timestamp, block, chainBlocks, { api }) { abi: "function getPoolId(address) view returns (uint256)", }) ); - //console.log("platypusPIDS:", platypusPIDs); const platypusBalancesOutputs = ( await api.multiCall({ calls: platypusPIDs.map((pool) => ({ @@ -51,13 +50,11 @@ async function tvl(timestamp, block, chainBlocks, { api }) { abi: "function userInfo(uint256,address) view returns (uint256,uint256,uint256,uint256)", }) ); - //console.log("platypusBalancesOutputs:", platypusBalancesOutputs); const platypusBalances = Object.values(platypusPoolsInfo).map((pool, i) => ({ balance: platypusBalancesOutputs[i][0], token: pool.token.address, isLP: false, })); - //console.log("platypusBalances:", platypusBalances); //GET JOE BALANCES const joeBalancesOutputs = ( await api.multiCall({ @@ -68,13 +65,11 @@ async function tvl(timestamp, block, chainBlocks, { api }) { abi: "function getPoolInfo(address) view returns (uint256,uint256,uint256,uint256)", }) ); - //console.log("joeBalancesOutputs:", joeBalancesOutputs); const joeBalances = Object.values(JoePoolsInfo).map((pool, i) => ({ balance: joeBalancesOutputs[i][2], //balance token: pool.token.address, //underlying lp token isLP: true, })); - //console.log("joeBalances:", joeBalances); //GET VECTOR CORE BALANCES const masterChefBalancesOutput = ( await api.multiCall({ @@ -85,7 +80,6 @@ async function tvl(timestamp, block, chainBlocks, { api }) { abi: "erc20:balanceOf", }) ); - //console.log("masterChefBalancesOutput:", masterChefBalancesOutput); const masterChefBalances = [...VectorStakingPools, ...VectorLPPools].map( (pool, i) => ({ balance: masterChefBalancesOutput[i], @@ -93,7 +87,6 @@ async function tvl(timestamp, block, chainBlocks, { api }) { isLP: pool.token.contract === "IJoePair", }) ); - //console.log("masterChefBalances:", masterChefBalances); //GET OLD LOCKER BALANCES const oldLockerBalancesOutput = ( await api.multiCall({ @@ -106,7 +99,6 @@ async function tvl(timestamp, block, chainBlocks, { api }) { abi: "function totalSupply() view returns (uint256)", }) ); - //console.log("oldLockerBalancesOutput:", oldLockerBalancesOutput); //GET NEW LOCKER BALANCES const newLockerBalancesOutput = ( await api.multiCall({ @@ -119,7 +111,6 @@ async function tvl(timestamp, block, chainBlocks, { api }) { abi: "function totalLocked() view returns (uint256)", }) ); - //console.log("newLockerBalancesOutput:", newLockerBalancesOutput); const lockerBalances = [ { balance: oldLockerBalancesOutput[0], @@ -132,7 +123,6 @@ async function tvl(timestamp, block, chainBlocks, { api }) { isLP: false, }, ]; - //console.log("lockerBalances:", lockerBalances); const AllBalances = [ ...platypusBalances, ...joeBalances, diff --git a/projects/vendor-finance-v2/index.js b/projects/vendor-finance-v2/index.js index 798c0dc417d..c085884ef9f 100644 --- a/projects/vendor-finance-v2/index.js +++ b/projects/vendor-finance-v2/index.js @@ -27,7 +27,6 @@ async function tvl(timestamp, block, chainBlocks, { api }) { // get col balances returned from the colBalance method const colOutput = await api.multiCall({ abi: abi.colBalance, calls: logs.map(i => i.poolAddress), }); - console.log(lendOutput, colOutput) lendOutput.forEach((res, i) => { // extract collateral and lend tokens const lendToken = logs[i][4].lendToken; diff --git a/projects/wing.js b/projects/wing.js index 04698e04252..df1b286b9dd 100644 --- a/projects/wing.js +++ b/projects/wing.js @@ -43,7 +43,6 @@ Object.keys(config).forEach(chain => { if (!result.totalSupply) result.totalSupply = result.TotalSupply if (chain == "ethereum") { const result_nft = await get(nft_url) - console.log("result_nft:", result_nft); if (result_nft.nftCollateralTVL !=undefined && !result_nft.nftCollateralTVL) result.totalSupply += result_nft.nftCollateralTVL } return { diff --git a/projects/wormhole.js b/projects/wormhole.js index 803081be60e..c46449b357b 100644 --- a/projects/wormhole.js +++ b/projects/wormhole.js @@ -2,6 +2,7 @@ const { get } = require('./helper/http') const BigNumber = require("bignumber.js"); const url = 'https://europe-west3-wormhole-message-db-mainnet.cloudfunctions.net/tvl' let _response +const sdk = require('@defillama/sdk') function fetch(chainId) { return async () => { @@ -11,7 +12,7 @@ function fetch(chainId) { const tvl = res.AllTime[chainId]["*"].Notional return new BigNumber(tvl).toFixed(2) } else { - console.log('Chain no longer supported: %s', chainId) + sdk.log('Chain no longer supported: %s', chainId) return BigNumber(0).toFixed(2) } } diff --git a/projects/xdai/index.js b/projects/xdai/index.js index a3cb007350d..37f1544a221 100644 --- a/projects/xdai/index.js +++ b/projects/xdai/index.js @@ -1,6 +1,5 @@ const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens2 } = require('../helper/unwrapLPs') -const { covalentGetTokens } = require('../helper/http'); const tokenAddresses = [ ADDRESSES.ethereum.SAI, @@ -17,11 +16,7 @@ async function eth(timestamp, block, _, { api }) { [tokenAddresses, xDaiBridge], [[owlToken], owlBridge], ] - if (!block || block > 10590093) { - const tokens = await covalentGetTokens(omniBridge, 'ethereum') - ownerTokens.push([tokens, omniBridge]) - } - return sumTokens2({ api, ownerTokens }); + return sumTokens2({ api, ownerTokens, owner: omniBridge, fetchCoValentTokens: true }); } module.exports = { diff --git a/projects/xdao/apiCache.js b/projects/xdao/apiCache.js index add2daa1eb3..448d3a8e67d 100644 --- a/projects/xdao/apiCache.js +++ b/projects/xdao/apiCache.js @@ -1,15 +1,3 @@ -const sdk = require("@defillama/sdk"); -const { covalentGetTokens } = require('../helper/http') -const { PromisePool } = require('@supercharge/promise-pool') -const { sumTokens2, } = require('../helper/unwrapLPs') -const { log, getUniqueAddresses } = require('../helper/utils') -const { getCache, setCache, } = require("../helper/cache"); - -const project = 'bulky/xdao' - -const factoryAddress = "0x72cc6E4DE47f673062c41C67505188144a0a3D84"; -const ONE_DAY = 24 * 60 * 60 * 1000 -const cacheDuration = 3 * ONE_DAY const config = { ethereum: { @@ -17,78 +5,13 @@ const config = { '0x71eeba415a523f5c952cc2f06361d5443545ad28', // XDAO ] }, - polygon: { - chainId: 137, blacklistedTokens: [ - '0x0b91b07beb67333225a5ba0259d55aee10e3a578', // MNEP - '0x29e3e6ad4eeadf767919099ee23c907946435a70', // TNDR - ] - }, - bsc: { chainId: 56, blacklistedTokens: [ - '0x000000ef379eE7F4C051f4B9aF901A9219d9ec5C', // INF - '0x7fa4cd8aeedcb8d36dbc5d856e3a1bee490d7b36', // WSN - ]}, - avax: { chainId: 43114, }, - fantom: { chainId: 250, }, - heco: { chainId: 128, }, - astar: { chainId: 592, }, } -module.exports = {}; Object.keys(config).forEach(chain => { - const { blacklistedTokens } = config[chain] module.exports[chain] = { tvl: async (_, _b, { [chain]: block }) => { - const cache = await getCache(project, chain) - if (!cache.daos) cache.daos = {} - const { output: numberOfDaos } = await sdk.api.abi.call({ - target: factoryAddress, - abi: abis.numberOfDaos, - chain, block, - }) - - const calls = [] - - for (let j = cache.totalDaos || 0; j < +numberOfDaos; j++) - calls.push({ params: j }) - cache.totalDaos = numberOfDaos - - let { output: daos } = await sdk.api.abi.multiCall({ - target: factoryAddress, - abi: abis.daoAt, calls, chain, block, - }) - if (daos.some(i => !i.success)) throw new Error('Error fetching dao address: ') - - daos = daos.map(i => i.output) - daos = [daos, Object.keys(cache.daos)].flat() - daos = getUniqueAddresses(daos) - const tokensAndOwners = [] - log(chain, 'dao count', daos.length) - await PromisePool - .withConcurrency(31) - .for(daos) - .process(addDao) - - await setCache(project, chain, cache) - log(chain, 'fetching balances count', tokensAndOwners.length) - - return sumTokens2({ tokensAndOwners, chain, block, blacklistedTokens, }) - - async function addDao(dao) { - let { time, tokens } = cache.daos[dao] || {} - const timeNow = +Date.now() - - if (!time || timeNow > (time + cacheDuration)) { - tokens = await covalentGetTokens(dao, chain) - cache.daos[dao] = { time: timeNow, tokens } - } - tokens.forEach(i => tokensAndOwners.push([i, dao])) - } + return {} } } }) - -const abis = { - daoAt: "function daoAt(uint256 _i) view returns (address)", - numberOfDaos: "uint256:numberOfDaos", -} diff --git a/utils/testInteractive.js b/utils/testInteractive.js index ba20144d5ce..bc1c0dc8ebd 100644 --- a/utils/testInteractive.js +++ b/utils/testInteractive.js @@ -2,8 +2,12 @@ const inquirer = require('inquirer') const childProcess = require('child_process') inquirer.registerPrompt('fuzzypath', require('inquirer-fuzzy-path')) console.log('Starting directory: ' + process.cwd()); +const args = process.argv.slice(2); // The first two elements are 'node' and the script filename + +const NEW_DIR = './projects/' + args[0] + try { - process.chdir('./projects/'); + process.chdir(NEW_DIR); console.log('New directory: ' + process.cwd()); } catch (err) { From 26abe3901b439e67f31a520db54cced79563d25f Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 29 Aug 2023 14:36:52 +0200 Subject: [PATCH 1018/1974] fix racoon --- projects/racoon/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/projects/racoon/index.js b/projects/racoon/index.js index 9b74fcd2531..76b80bd4532 100644 --- a/projects/racoon/index.js +++ b/projects/racoon/index.js @@ -14,7 +14,9 @@ module.exports = yieldHelper({ getReservesABI: 'function getReserves() view returns (uint112 _reserve0, uint112 _reserve1)', }, useDefaultCoreAssets: true, -}), +}) + +module.exports.base.tvl = () => ({}) module.exports.hallmarks = [ [1693180800, "Rug Pull"] ] \ No newline at end of file From 08d2e344632a96d2c4886e4cde4f1ed3777117ef Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 29 Aug 2023 14:40:53 +0200 Subject: [PATCH 1019/1974] stakehound: tvl lost due to unrevoerable keys --- projects/stakehound/index.js | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/projects/stakehound/index.js b/projects/stakehound/index.js index dfe1e698e96..ee1ebf75bbe 100644 --- a/projects/stakehound/index.js +++ b/projects/stakehound/index.js @@ -1,22 +1,5 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const sdk = require('@defillama/sdk'); - -const wethAddress = ADDRESSES.ethereum.WETH - -async function tvl(timestamp, block) { - const supply = await sdk.api.erc20.totalSupply({ - target: '0xDFe66B14D37C77F4E9b180cEb433d1b164f0281D', - block - }) - - return { - [wethAddress]: supply.output - } -} - module.exports = { - methodology: 'Counts staked ETH tokens', ethereum: { - tvl, + tvl: () => ({}), }, } From 7a78ae15a81e9807ef569903aac5deaf8324f24f Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 29 Aug 2023 15:43:09 +0200 Subject: [PATCH 1020/1974] fix broken adapters --- projects/deltaprime/index.js | 3 --- projects/elkfinance/index.js | 2 ++ projects/pactfi.js | 2 +- projects/puddingswap/index.js | 5 +++-- projects/waves-exchange/index.js | 5 +++-- utils/testInteractive.js | 2 +- 6 files changed, 10 insertions(+), 9 deletions(-) diff --git a/projects/deltaprime/index.js b/projects/deltaprime/index.js index b8a46e12d98..a2c4340a028 100644 --- a/projects/deltaprime/index.js +++ b/projects/deltaprime/index.js @@ -86,17 +86,14 @@ async function addVectorVaultBalancesAuto({ balances, accounts, api, token }) { const compounder = await api.call({ abi: 'function compounder() view returns(address)', target: helper.helper, - params: [] }) const totalDeposits = await api.call({ abi: 'function totalDeposits() view returns(uint256)', target: compounder, - params: [] }) const totalSupply = await api.call({ abi: 'function totalSupply() view returns(uint256)', target: compounder, - params: [] }) const shareRatio = totalDeposits / totalSupply; let bals = await api.multiCall({ abi: VFDepositTokenBalanceAutoAbi, calls: accounts, target: compounder }) diff --git a/projects/elkfinance/index.js b/projects/elkfinance/index.js index 3e1141c7258..c320098dc54 100644 --- a/projects/elkfinance/index.js +++ b/projects/elkfinance/index.js @@ -34,3 +34,5 @@ chainExports.misrepresentedTokens = true; chainExports.timetravel = true module.exports = chainExports + +module.exports.hoo.tvl = () => ({}) diff --git a/projects/pactfi.js b/projects/pactfi.js index 9f194b0b56a..13b62f285a7 100644 --- a/projects/pactfi.js +++ b/projects/pactfi.js @@ -3,7 +3,7 @@ const { get } = require('./helper/http') async function fetch() { const global_data = await get("https://api.pact.fi/api/global_stats") - return parseFloat(global_data.tvl) + return parseFloat(global_data.tvl_usd) } diff --git a/projects/puddingswap/index.js b/projects/puddingswap/index.js index b2ea0e18d03..5c94fcbf233 100644 --- a/projects/puddingswap/index.js +++ b/projects/puddingswap/index.js @@ -2,9 +2,10 @@ const { getUniTVL } = require('../helper/unknownTokens') module.exports = { hoo: { - tvl: getUniTVL({ + /* tvl: getUniTVL({ factory: '0x6168D508ad65D87f8F5916986B55d134Af7153bb', useDefaultCoreAssets: true, - }), + }), */ + tvl: () => ({}), } } diff --git a/projects/waves-exchange/index.js b/projects/waves-exchange/index.js index 754db289339..5b630efbe84 100644 --- a/projects/waves-exchange/index.js +++ b/projects/waves-exchange/index.js @@ -2,13 +2,14 @@ const { get } = require("../helper/http"); const { toUSDTBalances } = require("../helper/balances"); const endpoint = - "https://mainnet-dev.wvservices.exchange/api/v1/investments/tvl"; + "https://waves.exchange/api/v1/investments/tvl"; function tvl(isStaking) { + let key = isStaking ? "wx_staking" : "liquidity_pools" return async () => toUSDTBalances( (await get(endpoint)).products - .filter(p => p.product_id == "wx_staking" == isStaking) + .filter(p => p.product_id === key) .map(p => p.tvl) .reduce((p, c) => Number(p) + Number(c), 0), ); diff --git a/utils/testInteractive.js b/utils/testInteractive.js index bc1c0dc8ebd..20efa94ecaa 100644 --- a/utils/testInteractive.js +++ b/utils/testInteractive.js @@ -4,7 +4,7 @@ inquirer.registerPrompt('fuzzypath', require('inquirer-fuzzy-path')) console.log('Starting directory: ' + process.cwd()); const args = process.argv.slice(2); // The first two elements are 'node' and the script filename -const NEW_DIR = './projects/' + args[0] +const NEW_DIR = './projects/' + (args[0] ?? '') try { process.chdir(NEW_DIR); From c843d288827d0d7c56729e0db2ebc8cebeb25c18 Mon Sep 17 00:00:00 2001 From: 0xsnowman <101338249+0xsnowman@users.noreply.github.com> Date: Tue, 29 Aug 2023 20:47:10 +0700 Subject: [PATCH 1021/1974] Upstream/cygnusdao (#7271) * cygnus-dao-polygon-shuttles-tvl * tvl-calculation-model-fix * cygnalytics-function-fix * comment-added * update-deployed-shuttles-getter-dynamic * code refactor * lint fix * cygnusdao: track borrowed --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/cygnusdao/abi.json | 6 ++++ projects/cygnusdao/index.js | 57 +++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 projects/cygnusdao/abi.json create mode 100644 projects/cygnusdao/index.js diff --git a/projects/cygnusdao/abi.json b/projects/cygnusdao/abi.json new file mode 100644 index 00000000000..d3d0639ac89 --- /dev/null +++ b/projects/cygnusdao/abi.json @@ -0,0 +1,6 @@ +{ + "shuttleTvlUsd": "function shuttleTvlUsd(uint256) public view returns (uint256 totalUsd)", + "shuttlesDeployed": "function shuttlesDeployed() external view override returns (uint256)", + "borrowableTvlUsd": "function borrowableTvlUsd(uint256) public view returns (uint256 totalUsd)", + "collateralTvlUsd": "function collateralTvlUsd(uint256) public view returns (uint256 totalUsd)" +} \ No newline at end of file diff --git a/projects/cygnusdao/index.js b/projects/cygnusdao/index.js new file mode 100644 index 00000000000..21463883d55 --- /dev/null +++ b/projects/cygnusdao/index.js @@ -0,0 +1,57 @@ +const FACTORY_CONTRACT = "0x94faE55669327e71E9EC579067ad6C3C3b84e574"; +const vaultAbi = require('../charmfinance/vaultAbi.json') +const { getLogs } = require('../helper/cache/getLogs'); +const { getUniqueAddresses } = require("@defillama/sdk/build/generalUtil"); +const fromBlock = 46623778 +const ADDRESSES = require('../helper/coreAssets.json') + +function cygnalytics(category) { + // futuristic parameter + return async (timestamp, block, _, { api }) => { + const logs = await getLogs({ + api, + target: FACTORY_CONTRACT, + eventAbi: 'event NewShuttle (address indexed lpTokenPair, uint256 indexed shuttleId, uint256 orbiterId, address borrowable, address collateral)', + onlyArgs: true, + fromBlock, + }) + const pools = getUniqueAddresses(logs.map(i => [i.collateral, i.borrowable]).flat()) + const tokens = await api.multiCall({ abi: 'address:underlying', calls: pools }) + const bals = await api.multiCall({ abi: 'address:totalBalance', calls: pools }) + const isHypervisor = await api.multiCall({ abi: 'address:pool', calls: tokens, permitFailure: true }) + const hypervisorPools = { pools: [], bals: [] } + isHypervisor.forEach((i, idx) => { + if (i) { + hypervisorPools.pools.push(tokens[idx]) + hypervisorPools.bals.push(bals[idx]) + } else { + api.add(tokens[idx], bals[idx]) + } + }) + const hypervisorBals = await api.multiCall({ abi: vaultAbi.getTotalAmounts, calls: hypervisorPools.pools }) + const tokens0s = await api.multiCall({ abi: vaultAbi.token0, calls: hypervisorPools.pools }) + const tokens1s = await api.multiCall({ abi: vaultAbi.token1, calls: hypervisorPools.pools }) + const totalSupplies = await api.multiCall({ abi: 'erc20:totalSupply', calls: hypervisorPools.pools }) + hypervisorPools.pools.forEach((pool, idx) => { + const ratio = hypervisorPools.bals[idx] / totalSupplies[idx] + api.add(tokens0s[idx], hypervisorBals[idx][0] * ratio) + api.add(tokens1s[idx], hypervisorBals[idx][1] * ratio) + }) + // const tvls= await api.fetchList({ lengthAbi: abi.shuttlesDeployed, itemAbi: abi.shuttleTvlUsd, target: FACTORY_CONTRACT, startFrom: 2, }) + // tvls.forEach(i => api.add(ADDRESSES.polygon.USDC, i)) + }; +} + +async function borrowed(_, _b, _cb, { api, }) { + api.add(ADDRESSES.polygon.USDC, await api.call({ abi: 'uint256:totalBorrowsUsd', target: FACTORY_CONTRACT})) + return api.getBalances() +} + +module.exports = { + doublecounted: true, + methodology: "TVL of all shuttles (borrowable + collateral).", + polygon: { + tvl: cygnalytics(0), + borrowed, + }, +}; From fd961983c6c8d69b398e32f0df8977d19cb1aba7 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 29 Aug 2023 15:51:02 +0200 Subject: [PATCH 1022/1974] track racoon.bet treasury --- projects/treasury/racoon-bet.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 projects/treasury/racoon-bet.js diff --git a/projects/treasury/racoon-bet.js b/projects/treasury/racoon-bet.js new file mode 100644 index 00000000000..82cfe818165 --- /dev/null +++ b/projects/treasury/racoon-bet.js @@ -0,0 +1,16 @@ +const { sumTokensExport } = require('../helper/sumTokens') + +const config = { + juno: { owner: 'juno1puyjxrxkkwc9ms63a297vx2aln4kqsaeegnclknt99py59elandses9f3j', }, + migaloo: { owner: 'migaloo1q6vmqprwvay5p3l0d763v50ufunt7fwfnfwp85wne5xan4meeqpsdvzyvy', }, + chihuahua: { owner: 'chihuahua18s2dazpmva4t38rtnrlj3gjpsntmcdrk6v9220kt4yxckhqus3vssqsrgp', }, +} + +module.exports = { + timetravel: false, +} + +Object.keys(config).forEach(chain => { + const { owner } = config[chain] + module.exports[chain] = { tvl: sumTokensExport({ owner }) } +}) \ No newline at end of file From 048de9066bfaeb41b1e9ba1c079e7184ec305b97 Mon Sep 17 00:00:00 2001 From: 0xPowerRanger <127472302+0xPowerRanger@users.noreply.github.com> Date: Tue, 29 Aug 2023 22:09:49 +0800 Subject: [PATCH 1023/1974] Range protocol - add base and mantle support (#7314) * add base and mantle * update * add ignorelist --- projects/range/index.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/projects/range/index.js b/projects/range/index.js index c4254faff63..965df2d5255 100644 --- a/projects/range/index.js +++ b/projects/range/index.js @@ -5,7 +5,9 @@ const config = { ethereum: { factory: '0xf1e70677fb1f49471604c012e8B42BA11226336b', fromBlock: 17266660, }, arbitrum: { factory: '0xB9084c75D361D1d4cfC7663ef31591DeAB1086d6', fromBlock: 88503603, }, bsc: { factory: '0xad2b34a2245b5a7378964BC820e8F34D14adF312', fromBlock: 28026886, }, - polygon: { factory: '0xad2b34a2245b5a7378964BC820e8F34D14adF312', fromBlock: 42446548, } + polygon: { factory: '0xad2b34a2245b5a7378964BC820e8F34D14adF312', fromBlock: 42446548, }, + base: { factory: '0x4bF9CDcCE12924B559928623a5d23598ca19367B', fromBlock: 2733457, }, + mantle: { factory: '0x4bF9CDcCE12924B559928623a5d23598ca19367B', fromBlock: 1364977 , } } module.exports = { @@ -14,6 +16,8 @@ module.exports = { start: 1683965157, }; +// vaults that were deployed through factory but are uninitialized and unused +const ignoreList = {mantle : ["0xd1c0CB290BA214a79AC31B8B3FB3F3eD00B88612"]} Object.keys(config).forEach(chain => { const { factory, fromBlock } = config[chain] module.exports[chain] = { @@ -26,7 +30,8 @@ Object.keys(config).forEach(chain => { onlyArgs: true, fromBlock, }) - const vaults = logs.map(log => log.vault) + let vaults = logs.map(log => log.vault) + vaults = vaults.filter(vault => !ignoreList[chain] || !ignoreList[chain].includes(vault)) const token0s = await api.multiCall({ abi: "address:token0", calls: vaults, }) const token1s = await api.multiCall({ abi: "address:token1", calls: vaults, }) const bals = await api.multiCall({ abi: ABI.underlyingBalance, calls: vaults, }) From 642f53fa22f794aedf9871be17061b327ba8fbbd Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 29 Aug 2023 16:15:56 +0200 Subject: [PATCH 1024/1974] Xy-fin (#7315) * Add new supported chains for xy-finance * Add pools for xy-finance * remove duplicate code --------- Co-authored-by: phiz --- projects/xy-finance/index.js | 100 +++++++++++++++++++++++++++++++++-- 1 file changed, 95 insertions(+), 5 deletions(-) diff --git a/projects/xy-finance/index.js b/projects/xy-finance/index.js index 82d35b1847f..2d481a69f35 100644 --- a/projects/xy-finance/index.js +++ b/projects/xy-finance/index.js @@ -50,6 +50,12 @@ const config = { polygon_zkevm: { chainId: '1101', }, + linea: { + chainId: '59144', + }, + base: { + chainId: '8453', + }, } const ethAddress = '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE' @@ -75,6 +81,10 @@ const yPoolDepositContract = { "contractAddress": "0x64d17beaE666cC435B9d40a21f058b379b2a0194", "tokenAddress": "0x3496B523e5C00a4b4150D6721320CdDb234c3079" }, + "eYe": { + "contractAddress": "0xF0052C0B4F08078846aF48FE8C7bb365c9937c21", + "tokenAddress": "0x9A257C90Fa239fBA07771ef7da2d554D148c2E89" + } }, "25": { "ETH": { @@ -88,7 +98,35 @@ const yPoolDepositContract = { "USDC": { "contractAddress": "0x44a54941E572C526a599B0ebe27A14A5BF159333", "tokenAddress": ADDRESSES.cronos.USDC - } + }, + "BLU": { + "contractAddress": "0x184cE49FdE76D4394795C76A91935862B7c30102", + "tokenAddress": "0x1542bA4CA0fb6D1B4476a933B292002fd1959A52" + }, + "CANDY": { + "contractAddress": "0x85e363569531699EaEd1c1AC590d9f442A1299BA", + "tokenAddress": "0x06C04B0AD236e7Ca3B3189b1d049FE80109C7977" + }, + "DBF": { + "contractAddress": "0xEC8476DCC72b4AB6Cbc3C2bD7f50A15891485fDB", + "tokenAddress": "0xA2ae6273Dd65F9fA76C3d383eDe9c1261e025DAC" + }, + "DBX": { + "contractAddress": "0x812e9eE2437a3e4FE0A4A4A7f195536844301f07", + "tokenAddress": "0x061E31e7768b39a4282822b65569F8d814dC15f6" + }, + "DBC": { + "contractAddress": "0xD99995b63F44fc500B702251262B7d9f35adA0BC", + "tokenAddress": "0x730B05d100EeFb92f04016C6c0cF6f2bBB2C3A57" + }, + "SINGLE": { + "contractAddress": "0x9A4cC214782Fea5880394eFDE60187797a2FEF01", + "tokenAddress": "0x0804702a4E749d39A35FDe73d1DF0B1f1D6b8347" + }, + "AutoS": { + "contractAddress": "0x58F29F7d759aef5B8e34C8e4152d6117893017aB", + "tokenAddress": "0xae620DC4B9b6e44FBeb4a949F63AC957Cc43b5dD" + }, }, "56": { "ETH": { @@ -102,7 +140,11 @@ const yPoolDepositContract = { "USDC": { "contractAddress": "0x27C12BCb4538b12fdf29AcB968B71dF7867b3F64", "tokenAddress": ADDRESSES.bsc.USDC - } + }, + "eYe": { + "contractAddress": "0x5Bd40e579Cb7D37784689044E6C7c333E2E300e6", + "tokenAddress": "0x9A257C90Fa239fBA07771ef7da2d554D148c2E89" + }, }, "108": { "USDT": { @@ -126,7 +168,19 @@ const yPoolDepositContract = { "USDC": { "contractAddress": "0xf4137e5D07b476e5A30f907C3e31F9FAAB00716b", "tokenAddress": ADDRESSES.polygon.USDC - } + }, + "BLU": { + "contractAddress": "0x7C1C974367Ee28D3d7aBb088f5FCd748B3759EA4", + "tokenAddress": "0x759d34685468604c695De301ad11A9418e2f1038", + }, + "CANDY": { + "contractAddress": "0x5Bd40e579Cb7D37784689044E6C7c333E2E300e6", + "tokenAddress": "0x54E53ed24C12c1d3Df7D653587E2f27d3FbaE3d2", + }, + "AutoS": { + "contractAddress": "0xF98bfE69d069B40668D4F6aaeA22E73d1DC21A93", + "tokenAddress": "0x925FAdb35B73720238cc78777d02ED4dD3100816", + }, }, "250": { "ETH": { @@ -140,7 +194,11 @@ const yPoolDepositContract = { "USDC": { "contractAddress": "0x3A459695D49cD6B9637bC85B7ebbb04c5c3038c0", "tokenAddress": ADDRESSES.fantom.USDC - } + }, + "SINGLE": { + "contractAddress": "0xe1C01c84EAc760389b2A080cfd6f3e874725c62a", + "tokenAddress": "0xbDA9DF2cff1d36Ffc05E8e76Ec821B25dB8F3348" + }, }, "321": { "USDT": { @@ -164,7 +222,19 @@ const yPoolDepositContract = { "USDC": { "contractAddress": "0x680ab543ACd0e52035E9d409014dd57861FA1eDf", "tokenAddress": ADDRESSES.arbitrum.USDC - } + }, + "DBF": { + "contractAddress": "0xa1fB1F1E5382844Ee2D1BD69Ef07D5A6Abcbd388", + "tokenAddress": "0x38A896c29Eb54c566A3fD593f559174520Dc6F75" + }, + "DBX": { + "contractAddress": "0x156C04ca75f11817DdbF887692990F3E46e8982B", + "tokenAddress": "0x0b257fe969d8782fAcb4ec790682C1d4d3dF1551" + }, + "DBC": { + "contractAddress": "0x98b5067949e0821a52Ec2aC9A3BaaCc9b315ec21", + "tokenAddress": "0x745f63CA36E0cfDFAc4bf0AFe07120dC7e1E0042" + }, }, "43114": { "ETH": { @@ -254,6 +324,26 @@ const yPoolDepositContract = { "tokenAddress": ADDRESSES.polygon_zkevm.USDC } }, + "59144": { + "ETH": { + "contractAddress": "0xA5Cb30E5d30A9843B6481fFd8D8D35DDED3a3251", + "tokenAddress": ethAddress + }, + "USDC": { + "contractAddress": "0x9d90CFa17f3AFceE2505B3e9D75113e6f5c9E843", + "tokenAddress": ADDRESSES.linea.USDC + } + }, + "8453": { + "ETH": { + "contractAddress": "0xD195070107d853e55Dad9A2e6e7E970c400E67b8", + "tokenAddress": ethAddress + }, + "USDC": { + "contractAddress": "0xA5Cb30E5d30A9843B6481fFd8D8D35DDED3a3251", + "tokenAddress": ADDRESSES.base.USDbC + } + }, } module.exports={} From e695ee6c9e3d536a18a48070ded82dfbcc5acede Mon Sep 17 00:00:00 2001 From: Tran Viet Anh <142006359+anhtv-teko@users.noreply.github.com> Date: Tue, 29 Aug 2023 21:42:00 +0700 Subject: [PATCH 1025/1974] [CNIO-535] Create Danogo Total Value Locked on Defi Llama Adapter (#1) (#7312) * [CNIO-535] Create Danogo Total Value Locked on Defi Llama Adapter * [CNIO-535] Add timetravel: false --- projects/danogo/index.js | 62 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 projects/danogo/index.js diff --git a/projects/danogo/index.js b/projects/danogo/index.js new file mode 100644 index 00000000000..b7e165860d9 --- /dev/null +++ b/projects/danogo/index.js @@ -0,0 +1,62 @@ +const { fetchURL, postURL } = require('../helper/utils'); +const bech32 = require('bech32'); + +const DANOGO_GATEWAY_ENDPOINT = 'https://danogo-gateway.tekoapis.com/api/v1' +const KUPO_ENDPOINT = 'https://kupo.tekoapis.com/matches' +const DECODED_PREFIX_LENGTH = 2; +const ADA_TO_LOVELACE = 1000000; + +const bech32AddressToHexString = (address) => { + let decodeResult = bech32.decode(address); + const dataBytes = bech32.fromWords(decodeResult.words); + return Buffer.from(dataBytes).toString('hex').substring(DECODED_PREFIX_LENGTH); +} + +const fetchSmartContractAddresses = async () => { + const smartContractResponse = await fetchURL(`${DANOGO_GATEWAY_ENDPOINT}/smartcontract-addresses`); + return smartContractResponse.data.data.addresses.map((address) => bech32AddressToHexString(address)); +} + +const fetchSmartContractUTXOs = async (address) => { + const kupoResponse = await fetchURL(`${KUPO_ENDPOINT}/${address}/*?unspent`); + return kupoResponse.data; +} + +const fetchAssetValue = async (assetIds) => { + const gatewayResponse = await postURL(`${DANOGO_GATEWAY_ENDPOINT}/cardano-asset-value`, { assetIds: assetIds}); + return gatewayResponse.data.data.assetValues + .map((asset) => Number(BigInt(asset.adaValue) * BigInt(100) / BigInt(ADA_TO_LOVELACE)) / 100) + .reduce((accumulator, currentValue) => accumulator + currentValue, 0); +} + +const fetch = async () => { + const smartContracts = await fetchSmartContractAddresses(); + + const smartContractsUtxos = await Promise.all(smartContracts.map((address) => { + return fetchSmartContractUTXOs(address) + })); + + let assetIds = []; + let totalValueLocked = 0; + smartContractsUtxos.forEach(async (smUtxos) => { + smUtxos.forEach((utxo) => { + totalValueLocked += utxo.value.coins / ADA_TO_LOVELACE; + Object.keys(utxo.value.assets).forEach((assetId) => { + assetIds.push(assetId); + }) + }) + }); + + const totalAssetsValues = await fetchAssetValue(assetIds); + totalValueLocked += totalAssetsValues; + + return { cardano: totalValueLocked }; +} + +module.exports = { + timetravel: false, + cardano: { + tvl: fetch + }, +} + \ No newline at end of file From 95c4034ad708c77eb9dc25e5f4082d7653eb5375 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 29 Aug 2023 17:10:34 +0200 Subject: [PATCH 1026/1974] fix racoon --- projects/racoon/index.js | 28 ++++++---------------------- 1 file changed, 6 insertions(+), 22 deletions(-) diff --git a/projects/racoon/index.js b/projects/racoon/index.js index 76b80bd4532..e72eb0711e9 100644 --- a/projects/racoon/index.js +++ b/projects/racoon/index.js @@ -1,22 +1,6 @@ -const { yieldHelper, } = require("../helper/yieldHelper") - -const vault = '0xe798458bbE3282b38C8df1372a17E829927adACe' -const raccoon = '0x1299aA83ECa28D799349e9946D38C84D310b7450' - -module.exports = yieldHelper({ - project: 'raccoon-finance', - chain: 'base', - masterchef: vault, - nativeToken: raccoon, - abis: { - poolInfo: 'function poolInfo(uint256) view returns (address want, uint256 , uint256 , uint256 , uint256 , uint256 , uint256 , uint256 amount, uint256 , address strat)', - poolLength: 'function poolLength() view returns (uint256)', - getReservesABI: 'function getReserves() view returns (uint112 _reserve0, uint112 _reserve1)', - }, - useDefaultCoreAssets: true, -}) - -module.exports.base.tvl = () => ({}) -module.exports.hallmarks = [ - [1693180800, "Rug Pull"] -] \ No newline at end of file +module.exports = { + base: { tvl: () => ({}) }, + hallmarks: [ + [1693180800, "Rug Pull"] + ] +} \ No newline at end of file From b9b87e6637596d0907e901567f7dbbf389afdc84 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 29 Aug 2023 18:18:18 +0200 Subject: [PATCH 1027/1974] add support for shibarium --- package-lock.json | 12 ++++++------ projects/dogswap/index.js | 3 +++ projects/helper/chains.json | 1 + projects/helper/tokenMapping.js | 7 +++++++ projects/leetswap/index.js | 2 ++ projects/marswap/index.js | 3 +++ projects/shibbex/index.js | 3 +++ projects/woof/index.js | 3 +++ 8 files changed, 28 insertions(+), 6 deletions(-) create mode 100644 projects/dogswap/index.js create mode 100644 projects/marswap/index.js create mode 100644 projects/shibbex/index.js create mode 100644 projects/woof/index.js diff --git a/package-lock.json b/package-lock.json index 96836ba9f01..7f1b92cbe1e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -785,9 +785,9 @@ } }, "node_modules/@defillama/sdk": { - "version": "4.0.51", - "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.51.tgz", - "integrity": "sha512-Pd88pt2FXIgLLANWqKPtDlhdisQYntYBeUAv88BSdahWretvtqkKAv6Ecqz2gXRcTk4mwBpl6K7FU3j0rzY7TQ==", + "version": "4.0.52", + "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.52.tgz", + "integrity": "sha512-NDuUuzOACAIiWzEDDYdV3GeSgvxOL+LguDQVbZdfv0+XfUB3BB0xF2AUy5WV1BrE+yJpx5L3lqSZKceEv9jVXQ==", "dependencies": { "@aws-sdk/client-s3": "^3.400.0", "@supercharge/promise-pool": "^2.1.0", @@ -6181,9 +6181,9 @@ } }, "@defillama/sdk": { - "version": "4.0.51", - "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.51.tgz", - "integrity": "sha512-Pd88pt2FXIgLLANWqKPtDlhdisQYntYBeUAv88BSdahWretvtqkKAv6Ecqz2gXRcTk4mwBpl6K7FU3j0rzY7TQ==", + "version": "4.0.52", + "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.52.tgz", + "integrity": "sha512-NDuUuzOACAIiWzEDDYdV3GeSgvxOL+LguDQVbZdfv0+XfUB3BB0xF2AUy5WV1BrE+yJpx5L3lqSZKceEv9jVXQ==", "requires": { "@aws-sdk/client-s3": "^3.400.0", "@supercharge/promise-pool": "^2.1.0", diff --git a/projects/dogswap/index.js b/projects/dogswap/index.js new file mode 100644 index 00000000000..b7fcd411e6f --- /dev/null +++ b/projects/dogswap/index.js @@ -0,0 +1,3 @@ +const { uniTvlExport } = require('../helper/unknownTokens') + +module.exports = uniTvlExport('shibarium', '0xA780FcBFF7c5232FDbEF4fc67313bEcFfdf64172', { fetchBalances: true, }) \ No newline at end of file diff --git a/projects/helper/chains.json b/projects/helper/chains.json index 1447315a8bb..1afa397a1bf 100644 --- a/projects/helper/chains.json +++ b/projects/helper/chains.json @@ -180,6 +180,7 @@ "rpg", "secret", "sei", + "shibarium", "shiden", "sifchain", "smartbch", diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 9bdead0fb34..334f5a6b472 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -56,6 +56,13 @@ const fixBalancesTokens = { aura: { 'uaura': { coingeckoId: 'aura-network', decimals: 6 }, }, + shibarium: { + '0x8ed7d143ef452316ab1123d28ab302dc3b80d3ce': { coingeckoId: "ethereum", decimals: 18 }, + '0x213c25900f365f1be338df478cd82bef7fd43f85': { coingeckoId: "bone-shibaswap", decimals: 18 }, + '0x6c19a35875217b134e963ca9e61b005b855cad21': { coingeckoId: "bone-shibaswap", decimals: 18 }, + '0x1b2f364032f12bd8a4c89e672e6272de03ae2680': { coingeckoId: "bone-shibaswap", decimals: 18 }, + '0xa2899c776baaf9925d432f83c950d5054a6cf59c': { coingeckoId: "bone-shibaswap", decimals: 18 }, + }, arbitrum: { '0x1509706a6c66CA549ff0cB464de88231DDBe213B': { coingeckoId: 'aura-finance', decimals: 18 } }, diff --git a/projects/leetswap/index.js b/projects/leetswap/index.js index f4e9edb0e80..2c9e9eca118 100644 --- a/projects/leetswap/index.js +++ b/projects/leetswap/index.js @@ -5,5 +5,7 @@ module.exports = { polygon_zkevm: { tvl: getUniTVL({ factory: '0xcE87E0960f4e2702f4bFFE277655E993Ae720e84', useDefaultCoreAssets: true, }), }, canto: { tvl: getUniTVL({ factory: '0x116e8a41E8B0A5A87058AF110C0Ddd55a0ed82B7', useDefaultCoreAssets: true, }), }, linea: { tvl: getUniTVL({ factory: '0x4DDf0fa98B5f9Bd7Cb0645c25bA89A574fe9Be8c', useDefaultCoreAssets: true, }), }, + shibarium: { tvl: getUniTVL({ factory: '0xd3Ea3BC1F5A3F881bD6cE9761cbA5A0833a5d737', useDefaultCoreAssets: true, }), }, + op_bnb: { tvl: getUniTVL({ factory: '0xa2899c776bAAF9925d432F83C950D5054A6CF59C', useDefaultCoreAssets: true, }), }, base: { tvl: getUniTVL({ factory: '0x169C06b4cfB09bFD73A81e6f2Bb1eB514D75bB19', useDefaultCoreAssets: true, hasStablePools: true, stablePoolSymbol: 'sLS2', }), }, } diff --git a/projects/marswap/index.js b/projects/marswap/index.js new file mode 100644 index 00000000000..9a8944ff395 --- /dev/null +++ b/projects/marswap/index.js @@ -0,0 +1,3 @@ +const { uniTvlExport } = require('../helper/unknownTokens') + +module.exports = uniTvlExport('shibarium', '0xBe0223f65813C7c82E195B48F8AAaAcb304FbAe7', { fetchBalances: true, }) \ No newline at end of file diff --git a/projects/shibbex/index.js b/projects/shibbex/index.js new file mode 100644 index 00000000000..1550053513b --- /dev/null +++ b/projects/shibbex/index.js @@ -0,0 +1,3 @@ +const { uniTvlExport } = require('../helper/unknownTokens') + +module.exports = uniTvlExport('shibarium', '0x6369e8dFaD8DB8378179D74C187f1D5DEa47Fa9F', { fetchBalances: true, }) \ No newline at end of file diff --git a/projects/woof/index.js b/projects/woof/index.js new file mode 100644 index 00000000000..d97793eed6c --- /dev/null +++ b/projects/woof/index.js @@ -0,0 +1,3 @@ +const { uniTvlExport } = require('../helper/unknownTokens') + +module.exports = uniTvlExport('shibarium', '0x42D6041342021Bc317796C6A0F10Ce39346E9167', { fetchBalances: true, }) \ No newline at end of file From aa305335b52560ec0c7eb32df6ca2a10094e4f96 Mon Sep 17 00:00:00 2001 From: CookieCrispies <141340002+CookieCrispies@users.noreply.github.com> Date: Tue, 29 Aug 2023 18:37:57 +0200 Subject: [PATCH 1028/1974] add chocoInu shibarium network (#7316) * add chocoInu shibarium network * update add chocoInu --- projects/chocoInu/index.js | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 projects/chocoInu/index.js diff --git a/projects/chocoInu/index.js b/projects/chocoInu/index.js new file mode 100644 index 00000000000..26c09999559 --- /dev/null +++ b/projects/chocoInu/index.js @@ -0,0 +1,10 @@ +const { masterchefExports } = require("../helper/unknownTokens"); + +module.exports = masterchefExports({ + chain: "shibarium", + masterchef: "0x100A30e31aa03ed85F0854712a1Dff0880e960BE", + nativeTokens: ["0xC7cc176b2a098fF7cFd578C9eF0Cc8b1216C8ED1"], + useDefaultCoreAssets: true, + poolInfoABI: "function poolInfo(uint256) view returns (address)", + getToken: (i) => i, +}); \ No newline at end of file From 2547e5dfcfbd1ffafa1cee3a1a952f643b9f6e76 Mon Sep 17 00:00:00 2001 From: define Date: Tue, 29 Aug 2023 21:00:44 +0100 Subject: [PATCH 1029/1974] add xdai to gnosis dao treasury --- projects/treasury/gnosis-dao.js | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/projects/treasury/gnosis-dao.js b/projects/treasury/gnosis-dao.js index ff006686465..4507e5b9a48 100644 --- a/projects/treasury/gnosis-dao.js +++ b/projects/treasury/gnosis-dao.js @@ -9,6 +9,9 @@ const treasury2 = "0x849D52316331967b6fF1198e5E32A0eB168D039d"; const treasury3 = "0xBc79855178842FDBA0c353494895DEEf509E26bB"; const GNO = ADDRESSES.ethereum.GNO; +const treasurygnosis = "0x458cd345b4c05e8df39d0a07220feb4ec19f5e6f" +const gnognosis = "0x9C58BAcC331c9aa871AFD802DB6379a98e80CEdb" + async function tvl(_, _b, _cb, { api, }) { const treasury = '0x849d52316331967b6ff1198e5e32a0eb168d039d' await addAuraTvl() @@ -75,6 +78,32 @@ module.exports = treasuryExports({ ownTokens: [GNO], resolveUniV3: true, }, + xdai: { + tokens: [ + nullAddress, + "0x6A023CCd1ff6F2045C3309768eAd9E68F978f6e1", //eth + "0x6C76971f98945AE98dD7d4DFcA8711ebea946eA6", //wstETH + "0xEb30C85CC528537f5350CF5684Ce6a4538e13394", + "0xd4e420bBf00b0F409188b338c5D87Df761d6C894", + "0xBdF4488Dcf7165788D438b62B4C8A333879B7078", + "0x44932e3b1E662AdDE2F7bac6D5081C5adab908c6", + "0x291B5957c9CBe9Ca6f0b98281594b4eB495F4ec1", + "0x3a97704a1b25F08aa230ae53B352e2e72ef52843", + "0x8e5bBbb09Ed1ebdE8674Cda39A0c169401db4252", + "0xA26783eAd6C1f4744685c14079950622674ae8A8", + "0xa99FD9950B5D5dCeEaf4939E221dcA8cA9B938aB", + "0x21d4c792Ea7E38e0D0819c2011A2b1Cb7252Bd99", + "0x5519E2d8A0af0944EA639C6DBAD69A174DE3ECF8", + "0x4b1E2c2762667331Bc91648052F646d1b0d35984", + "0x388Cae2f7d3704C937313d990298Ba67D70a3709", + "0x1509706a6c66CA549ff0cB464de88231DDBe213B", + "0x712b3d230F3C1c19db860d80619288b1F0BDd0Bd", + "0x7eF541E2a22058048904fE5744f9c7E4C57AF717", + ], + owners: [treasurygnosis], + ownTokens: [gnognosis], + resolveUniV2: true, + }, }) module.exports = mergeExports([module.exports, { From 66747a2b5637ae7cd2028759d9848159156f2c94 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 29 Aug 2023 23:10:14 +0200 Subject: [PATCH 1030/1974] track https://www.woofswap.finance --- projects/helper/cache/uniswap.js | 1 + projects/woofswap/index.js | 3 +++ 2 files changed, 4 insertions(+) create mode 100644 projects/woofswap/index.js diff --git a/projects/helper/cache/uniswap.js b/projects/helper/cache/uniswap.js index 9af98486e41..181dac3f4cc 100644 --- a/projects/helper/cache/uniswap.js +++ b/projects/helper/cache/uniswap.js @@ -25,6 +25,7 @@ function getUniTVL({ coreAssets, blacklist = [], factory, blacklistedTokens, const abi = { ...uniswapAbi, ...abis } return async (_, _b, cb, { api, chain } = {}) => { + // console.log(await api.call({ abi: 'address:factory', target: factory })) if (!chain) chain = _chain diff --git a/projects/woofswap/index.js b/projects/woofswap/index.js new file mode 100644 index 00000000000..71eddfdab2c --- /dev/null +++ b/projects/woofswap/index.js @@ -0,0 +1,3 @@ +const { uniTvlExport } = require('../helper/unknownTokens') + +module.exports = uniTvlExport('shibarium', '0xB9fbdFA27B7ba8BB2d4bB4aB399e4c55F0F7F83a', { fetchBalances: true, hasStablePools: true, }) \ No newline at end of file From 15ba7e8b17e7763413dfa15d96d1ce83db146f13 Mon Sep 17 00:00:00 2001 From: define Date: Tue, 29 Aug 2023 22:50:50 +0100 Subject: [PATCH 1031/1974] add btc wallet by+ some chains + mnt to cex helper --- projects/bybit/index.js | 13 ++++++++++++- projects/helper/cex.js | 1 + 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/projects/bybit/index.js b/projects/bybit/index.js index b0b809ffc08..401232ace72 100644 --- a/projects/bybit/index.js +++ b/projects/bybit/index.js @@ -15,7 +15,8 @@ const config = { 'bc1q2qqqt87kh33s0er58akh7v9cwjgd83z5smh9rp', 'bc1q9w4g79ndel72lygvwtqzem67z6uqv4yncvqjz3yn8my9swnwflxsutg4cx', 'bc1qjysjfd9t9aspttpjqzv68k0ydpe7pvyd5vlyn37868473lell5tqkz456m', - '1GrwDkr33gT6LuumniYjKEGjTLhsL5kmqC' + '1GrwDkr33gT6LuumniYjKEGjTLhsL5kmqC', + 'bc1qs5vdqkusz4v7qac8ynx0vt9jrekwuupx2fl5udp9jql3sr03z3gsr2mf0f' ] }, bsc: { @@ -49,6 +50,7 @@ const config = { owners: [ 'rMvCasZ9cohYrSZRNYPTZfoaaSUQMfgQ8G', 'rwBHqnCgNRnk3Kyoc6zon6Wt4Wujj3HNGe', + 'raQxZLtqurEXvH5sgijrif7yXMNwvFRkJN' ] }, optimism: { @@ -57,6 +59,15 @@ const config = { era: { owners: ['0xf89d7b9c864f589bbF53a82105107622B35EaA40'] }, + solana: { + owners: [ + 'AC5RDfQFmDS1deWZos921JfqscXdByf8BKHs5ACWjtW2', + '42brAgAVNzMBP7aaktPvAmBSPEkehnFQejiZc53EpJFd' + ] + }, + cardano: { + owners: ['addr1v8mn6dmk7tf9u26kr09a05lmvc9j4k9d940a88ta3hdczqgyt7whl'] + } } module.exports = cexExports(config) \ No newline at end of file diff --git a/projects/helper/cex.js b/projects/helper/cex.js index f67e75673e7..3c3f3f0fbb3 100644 --- a/projects/helper/cex.js +++ b/projects/helper/cex.js @@ -91,6 +91,7 @@ const defaultTokens = { '0xcb84d72e61e383767c4dfeb2d8ff7f4fb89abc6e', //VEGA '0xcccd1ba9f7acd6117834e0d28f25645decb1736a', //ecox '0x25ec98773d7b4ced4cafab96a2a1c0945f145e10', // stUSDT + '0x3c3a81e81dc49A522A592e7622A7E711c06bf354', // MNT ], tron: [ nullAddress, From edb05d364463442bf51e85d9a6094540439ac548 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Wed, 30 Aug 2023 00:51:58 +0100 Subject: [PATCH 1032/1974] fix spikes --- projects/treasury/alchemix.js | 4 +++- projects/treasury/uwulend.js | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/projects/treasury/alchemix.js b/projects/treasury/alchemix.js index f8bfe2ca187..bc0f2b8cdba 100644 --- a/projects/treasury/alchemix.js +++ b/projects/treasury/alchemix.js @@ -35,6 +35,7 @@ module.exports = treasuryExports({ ], owners: [alchemixTreasury, operations_treasury, treasury2, treasury3, treasury4, treasury5], ownTokens: [ALCX], + blacklistedTokens: ["0xbc6da0fe9ad5f3b0d58160288917aa56653660e9", "0x0100546f2cd4c9d97f798ffc9755e47865ff7ee6"] }, optimism: { tokens: [ @@ -43,7 +44,8 @@ module.exports = treasuryExports({ ADDRESSES.optimism.OP, "0x3c8B650257cFb5f272f799F5e2b4e65093a11a05" ], - owners: [treasuryOP], + owners: [treasuryOP], + blacklistedTokens: ["0x3e29d3a9316dab217754d13b28646b76607c5f04"] }, fantom: { tokens: [ diff --git a/projects/treasury/uwulend.js b/projects/treasury/uwulend.js index a4c392cab22..7969a6d6c06 100644 --- a/projects/treasury/uwulend.js +++ b/projects/treasury/uwulend.js @@ -26,6 +26,6 @@ module.exports = treasuryExports({ "0x243387a7036bfcB09f9bF4EcEd1E60765D31aA70", // uSSPELL ], owners: [treasury], - ownToken: [uwu], + ownTokens: [uwu], }, }); From a11164b7f5567441d581bc82d1855dc665033314 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 30 Aug 2023 10:12:52 +0200 Subject: [PATCH 1033/1974] track https://www.basinfinance.com/ --- projects/basinfinance/index.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 projects/basinfinance/index.js diff --git a/projects/basinfinance/index.js b/projects/basinfinance/index.js new file mode 100644 index 00000000000..a5abc1cce87 --- /dev/null +++ b/projects/basinfinance/index.js @@ -0,0 +1,14 @@ +const { compoundExports2 } = require('../helper/compound') +const { mergeExports } = require('../helper/utils') +const { sumTokensExport } = require('../helper/unwrapLPs') +const ADDRESSES = require('../helper/coreAssets.json') + +module.exports = mergeExports([{ + base: compoundExports2({ comptroller: '0xbA47ccbE10B6addD8385748311a4a9478e74F38D', cether: '0x540EE31b264e8823e01795AA424fE89554672dc1', blacklistedTokens: ['0x5c185329bc7720aebd804357043121d26036d1b3'] }), +}, { + base: { + tvl: sumTokensExport({ owner: '0x594368C1A1A733581A546a4ac46bF1962547f427', tokens: [ADDRESSES.base.DAI],}), + pool2: sumTokensExport({ owner: '0x23014067c5bab5f89d3f97727c06afbffb4867c8', tokens: ['0x6eda0a4e05ff50594e53dbf179793cadd03689e5'], resolveLP: true, }), + staking: sumTokensExport({ owner: '0x0fb339fe0ad874758e2e9c9d679772c61bd6804b', tokens: ['0x4788de271F50EA6f5D5D2a5072B8D3C61d650326'],}), + } +}]) \ No newline at end of file From 65beb48320a92001ceb388a6970114928b509d0b Mon Sep 17 00:00:00 2001 From: Tran Viet Anh <142006359+anhtv-teko@users.noreply.github.com> Date: Wed, 30 Aug 2023 15:23:56 +0700 Subject: [PATCH 1034/1974] Fix Danogo TVL (#7323) * [CNIO-535] Multiply asset value with asset quantity * Fix overidden asset quantity (#2) * minor fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/danogo/index.js | 36 +++++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/projects/danogo/index.js b/projects/danogo/index.js index b7e165860d9..5c38641e4c3 100644 --- a/projects/danogo/index.js +++ b/projects/danogo/index.js @@ -22,11 +22,30 @@ const fetchSmartContractUTXOs = async (address) => { return kupoResponse.data; } -const fetchAssetValue = async (assetIds) => { +const fetchAssetValue = async (assetsInfo) => { + const assetIds = Object.keys(assetsInfo) + let totalAssetsValue = 0; const gatewayResponse = await postURL(`${DANOGO_GATEWAY_ENDPOINT}/cardano-asset-value`, { assetIds: assetIds}); - return gatewayResponse.data.data.assetValues - .map((asset) => Number(BigInt(asset.adaValue) * BigInt(100) / BigInt(ADA_TO_LOVELACE)) / 100) - .reduce((accumulator, currentValue) => accumulator + currentValue, 0); + gatewayResponse.data.data.assetValues.forEach((asset) => { + const assetValue = Number(BigInt(asset.adaValue) * BigInt(100) / BigInt(ADA_TO_LOVELACE)) / 100; + totalAssetsValue += assetValue * assetsInfo[asset.assetId]; + }); + return totalAssetsValue; +} + +function mergeObjectsWithSum(target, ...sources) { + for (const source of sources) { + for (const key in source) { + if (source.hasOwnProperty(key)) { + if (key in target) { + target[key] += source[key]; + } else { + target[key] = source[key]; + } + } + } + } + return target; } const fetch = async () => { @@ -36,24 +55,23 @@ const fetch = async () => { return fetchSmartContractUTXOs(address) })); - let assetIds = []; + let assetInfos = {}; let totalValueLocked = 0; smartContractsUtxos.forEach(async (smUtxos) => { smUtxos.forEach((utxo) => { totalValueLocked += utxo.value.coins / ADA_TO_LOVELACE; - Object.keys(utxo.value.assets).forEach((assetId) => { - assetIds.push(assetId); - }) + assetInfos = mergeObjectsWithSum(assetInfos, utxo.value.assets); }) }); - const totalAssetsValues = await fetchAssetValue(assetIds); + const totalAssetsValues = await fetchAssetValue(assetInfos); totalValueLocked += totalAssetsValues; return { cardano: totalValueLocked }; } module.exports = { + misrepresentedTokens: true, timetravel: false, cardano: { tvl: fetch From 68c83a8b92edfd36f0eb9751aad5a79b5b315d9e Mon Sep 17 00:00:00 2001 From: NotMePlease Date: Wed, 30 Aug 2023 15:35:21 +0700 Subject: [PATCH 1035/1974] add MVC chain and MVCSwap Protocol (#7321) * add MVC chain and MVCSwap Protocol * Fix ESLint --------- Co-authored-by: neonlabsorg --- projects/helper/chain/mvc.js | 10 ++++++++++ projects/helper/chains.json | 1 + projects/helper/coreAssets.json | 5 +++++ projects/helper/portedTokens.js | 2 +- projects/helper/tokenMapping.js | 5 ++++- projects/mvcswap/index.js | 27 +++++++++++++++++++++++++++ 6 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 projects/helper/chain/mvc.js create mode 100644 projects/mvcswap/index.js diff --git a/projects/helper/chain/mvc.js b/projects/helper/chain/mvc.js new file mode 100644 index 00000000000..3cfd3edf4ad --- /dev/null +++ b/projects/helper/chain/mvc.js @@ -0,0 +1,10 @@ +const { get } = require('../http') + +async function getMvcBalance(addr) { + const res = await get(`https://mainnet.mvcapi.com/address/${addr}/balance`) + return res.confirmed +} + +module.exports = { + getMvcBalance, +} \ No newline at end of file diff --git a/projects/helper/chains.json b/projects/helper/chains.json index 1afa397a1bf..9f8c097b58a 100644 --- a/projects/helper/chains.json +++ b/projects/helper/chains.json @@ -130,6 +130,7 @@ "moonriver", "multivac", "muuchain", + "mvc", "nahmii", "near", "neo", diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index bb855720992..1f7d962fa6a 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -1372,5 +1372,10 @@ }, "migaloo": { "WHALE": "uwhale" + }, + "mvc": { + "SPACE": "", + "USDT": "7d8706c7f657730201ff3334064f83deb2fdec8a", + "MSP": "b2d75931958114e48c9927160f80363eae78e2dc" } } diff --git a/projects/helper/portedTokens.js b/projects/helper/portedTokens.js index 33d03cbdfe7..a655929a656 100644 --- a/projects/helper/portedTokens.js +++ b/projects/helper/portedTokens.js @@ -103,7 +103,7 @@ async function getChainTransform(chain) { addr = normalizeAddress(addr, chain).replace(/\//g, ':') const chainStr = `${chain}:${addr}` - if ([...ibcChains, 'ton', 'defichain', 'waves'].includes(chain)) return chainStr + if ([...ibcChains, 'ton', 'mvc', 'defichain', 'waves'].includes(chain)) return chainStr if (chain === 'cardano' && addr === 'ADA') return 'coingecko:cardano' if (chain === 'near' && addr.endsWith('.near')) return chainStr if (chain === 'tron' && addr.startsWith('T')) return chainStr diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 334f5a6b472..ed2849af58c 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -17,7 +17,7 @@ coreAssets = JSON.parse(JSON.stringify(coreAssets)) // orbit brige: https://bridge.orbitchain.io/open/v1/api/monitor/rawTokenList const ibcChains = ['ibc', 'terra', 'terra2', 'crescent', 'osmosis', 'kujira', 'stargaze', 'juno', 'injective', 'cosmos', 'comdex', 'umee', 'orai', 'persistence', 'fxcore', 'neutron', 'quasar', 'chihuahua', 'sei', 'archway', 'migaloo', ] -const caseSensitiveChains = [...ibcChains, 'solana', 'tezos', 'ton', 'algorand', 'aptos', 'near', 'bitcoin', 'waves', 'tron', 'litecoin', 'polkadot', 'ripple', 'elrond', 'cardano', 'stacks', 'sui', 'ergo',] +const caseSensitiveChains = [...ibcChains, 'solana', 'tezos', 'ton', 'algorand', 'aptos', 'near', 'bitcoin', 'waves', 'tron', 'litecoin', 'polkadot', 'ripple', 'elrond', 'cardano', 'stacks', 'sui', 'ergo', 'mvc',] const distressedAssts = new Set(Object.values({ CRK: '0x065de42e28e42d90c2052a1b49e7f83806af0e1f', @@ -66,6 +66,9 @@ const fixBalancesTokens = { arbitrum: { '0x1509706a6c66CA549ff0cB464de88231DDBe213B': { coingeckoId: 'aura-finance', decimals: 18 } }, + mvc: { + [ADDRESSES.mvc.SPACE]: { coingeckoId: "microvisionchain", decimals: 8 }, + }, } ibcChains.forEach(chain => fixBalancesTokens[chain] = { ...ibcMappings, ...(fixBalancesTokens[chain] || {}) }) diff --git a/projects/mvcswap/index.js b/projects/mvcswap/index.js new file mode 100644 index 00000000000..020dde8aef2 --- /dev/null +++ b/projects/mvcswap/index.js @@ -0,0 +1,27 @@ +const axios = require("axios") +const { transformDexBalances } = require('../helper/portedTokens') +const sdk = require('@defillama/sdk') + +module.exports = { + misrepresentedTokens: true, + timetravel: false, + mvc: { + tvl: async () => { + const result = await axios.get('https://api.mvcswap.com/swap/allpairs', { + headers: { + 'Accept-Encoding': 'gzip' + } + }) + const data = result.data.data; + return transformDexBalances({ + chain: 'mvc', + data: Object.keys(data).map(i => ({ + token0: data[i].token1.tokenID, + token1: data[i].token2.tokenID, + token0Bal: data[i].token1Amount, + token1Bal: data[i].token2Amount, + })) + }) + } + } +} From a47119719bdd225ab84673a593b1794bdbd6e84c Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 30 Aug 2023 11:53:00 +0200 Subject: [PATCH 1036/1974] Tutellus (#7326) * feat: add Tutellus Contracts TVL * code refactor --------- Co-authored-by: victormer --- projects/tutellus/index.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 projects/tutellus/index.js diff --git a/projects/tutellus/index.js b/projects/tutellus/index.js new file mode 100644 index 00000000000..c73cad25bb0 --- /dev/null +++ b/projects/tutellus/index.js @@ -0,0 +1,16 @@ +const axios = require('axios') + +module.exports = { + polygon: { + tvl: () => ({}), + staking: tvl, + }, + timetravel: false, + methodology: "Counts the number of TUT tokens locked in Tutellus contracts.", +} + +async function tvl(_, _b, _cb, { api, }) { + const endpoint = 'https://backend.tutellus.io/api' + const { data } = await axios({ url: endpoint + `/tvl`, data: { id: 1, jsonrpc: "2.0", method: "invokefunction", }, }); + api.add('0x12a34A6759c871C4C1E8A0A42CFc97e4D7Aaf68d', data.bigNumber); +} \ No newline at end of file From bf9e29236e9391ef1930c018b58dd69359201b82 Mon Sep 17 00:00:00 2001 From: define Date: Wed, 30 Aug 2023 13:28:04 +0100 Subject: [PATCH 1037/1974] add sharegram adapter --- projects/sharesgram/index.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 projects/sharesgram/index.js diff --git a/projects/sharesgram/index.js b/projects/sharesgram/index.js new file mode 100644 index 00000000000..6887c751e8c --- /dev/null +++ b/projects/sharesgram/index.js @@ -0,0 +1,14 @@ +const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') + +const contract = "0xbe74a95d159e8e323b8c1a70f825efc85fed27c4" + +async function tvl(time, ethBlock, _b, {api}) { + return sumTokens2({ tokens: [nullAddress], owner: contract, api }) +} + +module.exports = { + methodology: `We count the ETH on ${contract}`, + base: { + tvl + } +} \ No newline at end of file From c49084964cd0192d1bf3563794f2b61db5bbf6c5 Mon Sep 17 00:00:00 2001 From: g1nt0ki Date: Wed, 30 Aug 2023 20:40:55 +0200 Subject: [PATCH 1038/1974] fix starknet adapters --- package-lock.json | 1 + package.json | 1 + projects/10kswap/abi.js | 16 ++-- projects/10kswap/api.js | 34 +------- projects/carmine-options/abi.js | 4 +- projects/carmine-options/api.js | 23 ++---- projects/helper/cache/uniswap.js | 4 +- projects/helper/chain/starknet.js | 127 +++++++++++++++++++++--------- projects/jediswap/abi.js | 6 +- projects/jediswap/api.js | 34 +++++--- projects/myswap/abi.js | 3 +- projects/nostra/abi.js | 3 +- projects/nostra/index.js | 5 +- projects/protoss-dex/abi.js | 87 -------------------- projects/protoss-dex/api.js | 35 +------- projects/sithswap/abi.js | 9 ++- projects/sithswap/api.js | 22 +++--- projects/starkex/api.js | 10 +-- projects/zklend/abi.js | 3 +- projects/zklend/index.js | 9 +-- 20 files changed, 172 insertions(+), 264 deletions(-) delete mode 100644 projects/protoss-dex/abi.js diff --git a/package-lock.json b/package-lock.json index 7f1b92cbe1e..d7d315498bf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -28,6 +28,7 @@ "hi-base32": "^0.5.1", "js-sha512": "^0.8.0", "limiter": "2.1.0", + "p-limit": "^3.1.0", "starknet": "^4.17.1", "tron-format-address": "^0.1.8", "typescript": "^4.7.4" diff --git a/package.json b/package.json index 20f3e822308..6303a82e39e 100644 --- a/package.json +++ b/package.json @@ -33,6 +33,7 @@ "hi-base32": "^0.5.1", "js-sha512": "^0.8.0", "limiter": "2.1.0", + "p-limit": "^3.1.0", "starknet": "^4.17.1", "tron-format-address": "^0.1.8", "typescript": "^4.7.4" diff --git a/projects/10kswap/abi.js b/projects/10kswap/abi.js index 07114bcb6be..4c59506a8a8 100644 --- a/projects/10kswap/abi.js +++ b/projects/10kswap/abi.js @@ -13,7 +13,8 @@ const fabis = [{ "type": "felt" } ], - "stateMutability": "view" + "stateMutability": "view", + "customType": "address" }, { "name": "allPairsLength", @@ -25,7 +26,8 @@ const fabis = [{ "type": "felt" } ], - "stateMutability": "view" + "stateMutability": "view", + "customType": "Uint256" } ] @@ -40,7 +42,8 @@ const pabis = [ "type": "felt" } ], - "stateMutability": "view" + "stateMutability": "view", + "customType": "address" }, { "name": "token1", @@ -52,7 +55,8 @@ const pabis = [ "type": "felt" } ], - "stateMutability": "view" + "stateMutability": "view", + "customType": "address" }, { "name": "getReserves", @@ -60,11 +64,11 @@ const pabis = [ "inputs": [], "outputs": [ { - "name": "reserve0", + "name": "_reserve0", "type": "felt" }, { - "name": "reserve1", + "name": "_reserve1", "type": "felt" }, { diff --git a/projects/10kswap/api.js b/projects/10kswap/api.js index 501664f1aaa..f8d1147dae5 100644 --- a/projects/10kswap/api.js +++ b/projects/10kswap/api.js @@ -1,38 +1,10 @@ -const { call, multiCall, parseAddress } = require('../helper/chain/starknet') -const abi = require('./abi') -const { transformDexBalances } = require('../helper/portedTokens') -const { getParamCalls } = require('../helper/utils') - -async function tvl() { - const factory = '0x1c0a36e26a8f822e0d81f20a5a562b16a8f8a3dfd99801367dd2aea8f1a87a2' - let pairLength = await call({ target: factory, abi: abi.factory.allPairsLength}) - let pairs = await multiCall({ abi: abi.factory.allPairs, target: factory, calls: getParamCalls(+pairLength)}) - - const calls = pairs.map(i => parseAddress(i)) - - const [ token0s, token1s, reserves ] = await Promise.all([ - multiCall({ abi: abi.pair.token0, calls }), - multiCall({ abi: abi.pair.token1, calls }), - multiCall({ abi: abi.pair.getReserves, calls }), - ]) - - const data = [] - reserves.forEach((reserve, i) => { - data.push({ - token0: parseAddress(token0s[i]), - token1: parseAddress(token1s[i]), - token0Bal: +reserve.reserve0, - token1Bal: +reserve.reserve1, - }) - }) - - return transformDexBalances({chain:'starknet', data}) -} +const { dexExport } = require('../helper/chain/starknet') +const factory = '0x1c0a36e26a8f822e0d81f20a5a562b16a8f8a3dfd99801367dd2aea8f1a87a2' module.exports = { timetravel: false, starknet: { - tvl, + tvl: dexExport({ factory, }), } } \ No newline at end of file diff --git a/projects/carmine-options/abi.js b/projects/carmine-options/abi.js index 20cb0e9142b..ef639793018 100644 --- a/projects/carmine-options/abi.js +++ b/projects/carmine-options/abi.js @@ -30,7 +30,9 @@ const abi = [ "type": "felt" } ], - "stateMutability": "view" + "stateMutability": "view", + "customInput": 'address', + "customType": 'address', }, ]; diff --git a/projects/carmine-options/api.js b/projects/carmine-options/api.js index 71a21d4a5ec..01a598808f4 100644 --- a/projects/carmine-options/api.js +++ b/projects/carmine-options/api.js @@ -1,26 +1,13 @@ -// https://www.starknetjs.com/docs/API/contract - -const { call, multiCall, parseAddress, number, sumTokens, } = require("../helper/chain/starknet"); +const { call, multiCall, number, sumTokens, } = require("../helper/chain/starknet"); const abi = require("./abi"); -const amm = - "0x076dbabc4293db346b0a56b29b6ea9fe18e93742c73f12348c8747ecfc1050aa"; +const amm = "0x076dbabc4293db346b0a56b29b6ea9fe18e93742c73f12348c8747ecfc1050aa"; async function tvl(_, _1, _2, { api }) { - - let lpTokens = await call({ - abi: abi.get_all_lptoken_addresses, - target: amm, - }) + let lpTokens = await call({ abi: abi.get_all_lptoken_addresses, target: amm, }) lpTokens = number.bigNumberishArrayToHexadecimalStringArray(lpTokens.array.toString().split(',')) - let underlyings = await multiCall({ - abi: abi.get_underlying_token_address, - target: amm, - calls: lpTokens.map((lpToken) => ({ - params: [parseAddress(lpToken)], - })), - }); - return sumTokens({ owner: amm, tokens: underlyings.map(parseAddress), api, }); + let underlyings = await multiCall({ abi: abi.get_underlying_token_address, target: amm, calls: lpTokens, }); + return sumTokens({ owner: amm, tokens: underlyings, api, }); } module.exports = { diff --git a/projects/helper/cache/uniswap.js b/projects/helper/cache/uniswap.js index 181dac3f4cc..c13b9129a05 100644 --- a/projects/helper/cache/uniswap.js +++ b/projects/helper/cache/uniswap.js @@ -27,6 +27,7 @@ function getUniTVL({ coreAssets, blacklist = [], factory, blacklistedTokens, return async (_, _b, cb, { api, chain } = {}) => { // console.log(await api.call({ abi: 'address:factory', target: factory })) + chain = chain ?? api?.chain if (!chain) chain = _chain factory = normalizeAddress(factory, chain) @@ -40,6 +41,7 @@ function getUniTVL({ coreAssets, blacklist = [], factory, blacklistedTokens, const _oldPairInfoLength = cache.pairs.length const length = await api.call({ abi: abi.allPairsLength, target: factory, }) + sdk.log(chain, ' No. of pairs: ', length) sdk.log('cached info', cache.pairs.length) const pairCalls = [] @@ -85,7 +87,7 @@ function getUniTVL({ coreAssets, blacklist = [], factory, blacklistedTokens, calls.push({ target: cache.token0s[i], params: owner }) calls.push({ target: cache.token1s[i], params: owner }) }) - const bals = await api.multiCall({ abi: 'erc20:balanceOf', calls, permitFailure, }) + const bals = await api.multiCall({ abi: abi.balanceOf ?? 'erc20:balanceOf', calls, permitFailure, }) for (let i = 0; i < bals.length; i++) { reserves.push({ _reserve0: bals[i] ?? 0, _reserve1: bals[i + 1] ?? 0 }) i++ diff --git a/projects/helper/chain/starknet.js b/projects/helper/chain/starknet.js index 80d16363e0b..ae372bc2a11 100644 --- a/projects/helper/chain/starknet.js +++ b/projects/helper/chain/starknet.js @@ -1,48 +1,78 @@ // https://www.starknetjs.com/docs/API/contract -const { getUniqueAddresses} = require('../tokenMapping') -const { Provider, Contract, validateAndParseAddress, number, } = require('starknet') -const { PromisePool } = require('@supercharge/promise-pool') - -let provider - -function getProvider() { - if (!provider) - provider = new Provider({ - sequencer: { - network: 'mainnet-alpha' - } - }) - return provider -} +const { getUniqueAddresses } = require('../tokenMapping') +const { Contract, validateAndParseAddress, number, hash, } = require('starknet') +const abi = require('../../10kswap/abi') +const axios = require('axios') +const plimit = require('p-limit') +const { sliceIntoChunks, sleep } = require('../utils') +const { getUniTVL } = require('../cache/uniswap') + +const _rateLimited = plimit(1) +const rateLimited = fn => (...args) => _rateLimited(() => fn(...args)) + +const STARKNET_RPC = 'https://starknet-mainnet.public.blastapi.io' -async function call({ abi, target, params = [], allAbi = [] }) { +function formCallBody({ abi, target, params = [], allAbi = [] }, id = 0) { if ((params || params === 0) && !Array.isArray(params)) params = [params] - const contract = new Contract([abi, ...allAbi, ], target, getProvider()) - const response = await contract[abi.name](...params) - if (abi.outputs.length === 1) return response[0] + const contract = new Contract([abi, ...allAbi,], target, null) + const requestData = contract.populate(abi.name, params) + requestData.entry_point_selector = hash.getSelectorFromName(requestData.entrypoint) + requestData.contract_address = requestData.contractAddress + delete requestData.entrypoint + if (abi.customInput === 'address') requestData.calldata = params.map(i => i.slice(2)) + return getCallBody(requestData, id) + + function getCallBody(i) { + return { jsonrpc: "2.0", id, method: "starknet_call", params: [i, "latest"] } + } +} + +function parseOutput(result, abi, allAbi) { + const contract = new Contract([abi,...allAbi], null, null) + let response = contract.parseResponse(abi.name, result) + if (abi.outputs.length === 1) { + response = response[0] + if (abi.outputs[0].type === 'Uint256') return +response + switch (abi.customType) { + case 'address': return validateAndParseAddress(response) + case 'Uint256': return +response + } + } return response } -async function multiCall({ abi: rootAbi, target: rootTarget, calls = [], allAbi = [] }) { +async function call({ abi, target, params = [], allAbi = [] } = {}, ...rest) { + const { data: { result } } = await axios.post(STARKNET_RPC, formCallBody({ abi, target, params, allAbi })) + return parseOutput(result, abi, allAbi) +} + +async function multiCall({ abi: rootAbi, target: rootTarget, calls = [], allAbi = [] }) { + if (!calls.length) return [] calls = calls.map((callArgs) => { if (typeof callArgs !== 'object') { - if (!rootTarget) return { target: callArgs, abi: rootAbi, allAbi, } + if (!rootTarget) return { target: callArgs, abi: rootAbi, allAbi, } return { target: rootTarget, params: callArgs, abi: rootAbi, allAbi, } } const { target, params, abi } = callArgs return { target: target || rootTarget, params, abi: abi || rootAbi } }) - - const { results, errors } = await PromisePool.withConcurrency(7) - .for(calls) - .process(async (args, i) => ([i, await call(args)])) - - if (errors && errors.length) - throw errors[0] + const callBodies = calls.map(formCallBody) + const allData = [] + const chunks = sliceIntoChunks(callBodies, 25) + for (const chunk of chunks) { + await sleep(2000) + const { data } = await axios.post(STARKNET_RPC, chunk) + allData.push(...data) + } - results.sort(([a], [b]) => a -b) // workaround for Promise Pool fucking up the order - return results.map(i => i[1]) + const response = [] + allData.forEach((i) => { + const { result, id } = i + const abi = calls[id].abi ?? rootAbi + response[id] = parseOutput(result, abi, allAbi) + }) + return response } const balanceOfABI = { @@ -60,7 +90,8 @@ const balanceOfABI = { "type": "Uint256" } ], - "stateMutability": "view" + "stateMutability": "view", + "customInput": 'address', } @@ -74,13 +105,13 @@ async function sumTokens({ owner, owners = [], tokens = [], tokensAndOwners = [] if (!tokensAndOwners.length) { if (!owners.length && owner) owners = [owner] - + tokensAndOwners = tokens.map(t => owners.map(o => ([t, o]))).flat() } tokensAndOwners = getUniqueToA(tokensAndOwners, 'starknet') tokensAndOwners = tokensAndOwners.filter(i => !blacklistedTokens.includes(i[0])) - const res = await multiCall({ abi: balanceOfABI, calls: tokensAndOwners.map(i => ({ target: i[0], params: i[1]}))}) + const res = await multiCall({ abi: balanceOfABI, calls: tokensAndOwners.map(i => ({ target: i[0], params: i[1] })) }) res.forEach((v, i) => api.add(tokensAndOwners[i][0], +v)) @@ -90,11 +121,31 @@ async function sumTokens({ owner, owners = [], tokens = [], tokensAndOwners = [] } } +const api = { + chain: 'starknet', +} + +const defaultAbis = { + allPairsLength: abi.factory.allPairsLength, + allPairs: abi.factory.allPairs, + token0: abi.pair.token0, + token1: abi.pair.token1, + getReserves: abi.pair.getReserves, + balanceOf: balanceOfABI, +} + +function dexExport({ factory, abis = {}, fetchBalances = false }) { + return () => getUniTVL({ factory, abis: { ...defaultAbis, ...abis}, fetchBalances })(undefined, undefined, undefined, { api, chain: 'starknet' }) +} + module.exports = { - getProvider, - call, - multiCall, + call: rateLimited(call), + multiCall: rateLimited(multiCall), parseAddress: validateAndParseAddress, - sumTokens, + sumTokens: rateLimited(sumTokens), number, -} \ No newline at end of file + dexExport, +} + +api.call = module.exports.call +api.multiCall = module.exports.multiCall \ No newline at end of file diff --git a/projects/jediswap/abi.js b/projects/jediswap/abi.js index f88d69b2971..a3ee514e816 100644 --- a/projects/jediswap/abi.js +++ b/projects/jediswap/abi.js @@ -28,7 +28,8 @@ const pabis = [ } ], "stateMutability": "view", - "type": "function" + "type": "function", + "customType": "address" }, { "inputs": [], @@ -40,7 +41,8 @@ const pabis = [ } ], "stateMutability": "view", - "type": "function" + "type": "function", + "customType": "address" }, { "inputs": [], diff --git a/projects/jediswap/api.js b/projects/jediswap/api.js index 0f77ccc4635..aba2cf70a6a 100644 --- a/projects/jediswap/api.js +++ b/projects/jediswap/api.js @@ -1,31 +1,43 @@ // https://www.starknetjs.com/docs/API/contract -const { call, multiCall, parseAddress } = require('../helper/chain/starknet') +const { call, multiCall, parseAddress, } = require('../helper/chain/starknet') +const { getCache, setCache, } = require('../helper/cache') const abi = require('./abi') const { transformDexBalances } = require('../helper/portedTokens') +const factory = '0xdad44c139a476c7a17fc8141e6db680e9abc9f56fe249a105094c44382c2fd' async function tvl() { - const factory = '0xdad44c139a476c7a17fc8141e6db680e9abc9f56fe249a105094c44382c2fd' - let { all_pairs } = await call({ target: factory, abi: abi.factory.get_all_pairs}) + let { all_pairs } = await call({ target: factory, abi: abi.factory.get_all_pairs }) const calls = all_pairs.map(i => parseAddress(i)) - const [ token0s, token1s, reserves ] = await Promise.all([ - multiCall({ abi: abi.pair.token0, calls }), - multiCall({ abi: abi.pair.token1, calls }), - multiCall({ abi: abi.pair.get_reserves, calls }), - ]) + const cache = await getCache('jediswap', 'starknet') ?? {} + if (!cache.token0s) { + cache.token0s = [] + cache.token1s = [] + } + const oldCacheLength = cache.token0s.length + const newCalls = calls.slice(oldCacheLength) + + const _token0s = await multiCall({ abi: abi.pair.token0, calls: newCalls }) + const _token1s = await multiCall({ abi: abi.pair.token1, calls: newCalls }) + const reserves = await multiCall({ abi: abi.pair.get_reserves, calls }) + + cache.token0s.push(..._token0s) + cache.token1s.push(..._token1s) + if (cache.token0s.length > oldCacheLength) await setCache('jediswap', 'starknet', cache) + const data = [] reserves.forEach((reserve, i) => { data.push({ - token0: parseAddress(token0s[i]), - token1: parseAddress(token1s[i]), + token0: cache.token0s[i], + token1: cache.token1s[i], token0Bal: +reserve.reserve0, token1Bal: +reserve.reserve1, }) }) - return transformDexBalances({chain:'starknet', data}) + return transformDexBalances({ chain: 'starknet', data }) } module.exports = { diff --git a/projects/myswap/abi.js b/projects/myswap/abi.js index 3d182dbdf0d..734adf1345c 100644 --- a/projects/myswap/abi.js +++ b/projects/myswap/abi.js @@ -73,7 +73,8 @@ const allAbi = [ "type": "felt" } ], - "stateMutability": "view" + "stateMutability": "view", + "customType": "Uint256" }, { "name": "get_pool", diff --git a/projects/nostra/abi.js b/projects/nostra/abi.js index 88aff8c79c4..176d94dc942 100644 --- a/projects/nostra/abi.js +++ b/projects/nostra/abi.js @@ -9,7 +9,8 @@ const assetToken = [ "type": "felt" } ], - "stateMutability": "view" + "stateMutability": "view", + "customType": "address" }, { "name": "totalSupply", diff --git a/projects/nostra/index.js b/projects/nostra/index.js index e303062bcfd..8d4c49655fa 100644 --- a/projects/nostra/index.js +++ b/projects/nostra/index.js @@ -1,4 +1,4 @@ -const { multiCall, parseAddress, sumTokens, } = require('../helper/chain/starknet') +const { multiCall, sumTokens, } = require('../helper/chain/starknet') const { assetTokenAbi } = require('./abi'); const vault = '0x03d39f7248fb2bfb960275746470f7fb470317350ad8656249ec66067559e892' @@ -12,15 +12,12 @@ const debtTokens = [ async function tvl(_, _1, _2, { api }) { let underlyings = await multiCall({ calls: debtTokens, abi: assetTokenAbi.underlyingAsset }) - underlyings = underlyings.map(parseAddress) return sumTokens({ api, owner: vault, tokens: underlyings}) } async function borrowed(_, _1, _2, { api }) { let data = await multiCall({ calls: debtTokens, abi: assetTokenAbi.totalSupply }); let underlyings = await multiCall({ calls: debtTokens, abi: assetTokenAbi.underlyingAsset }) - underlyings = underlyings.map(parseAddress) - data = data.map(i => +i) api.addTokens(underlyings, data) } diff --git a/projects/protoss-dex/abi.js b/projects/protoss-dex/abi.js deleted file mode 100644 index 07114bcb6be..00000000000 --- a/projects/protoss-dex/abi.js +++ /dev/null @@ -1,87 +0,0 @@ -const fabis = [{ - "name": "allPairs", - "type": "function", - "inputs": [ - { - "name": "index", - "type": "felt" - } - ], - "outputs": [ - { - "name": "pair", - "type": "felt" - } - ], - "stateMutability": "view" -}, -{ - "name": "allPairsLength", - "type": "function", - "inputs": [], - "outputs": [ - { - "name": "length", - "type": "felt" - } - ], - "stateMutability": "view" -} -] - -const pabis = [ - { - "name": "token0", - "type": "function", - "inputs": [], - "outputs": [ - { - "name": "token0", - "type": "felt" - } - ], - "stateMutability": "view" - }, - { - "name": "token1", - "type": "function", - "inputs": [], - "outputs": [ - { - "name": "token1", - "type": "felt" - } - ], - "stateMutability": "view" - }, - { - "name": "getReserves", - "type": "function", - "inputs": [], - "outputs": [ - { - "name": "reserve0", - "type": "felt" - }, - { - "name": "reserve1", - "type": "felt" - }, - { - "name": "blockTimestampLast", - "type": "felt" - } - ], - "stateMutability": "view" - }, -] - - -const factory = {} -const pair = {} -fabis.forEach(i => factory[i.name] = i) -pabis.forEach(i => pair[i.name] = i) - -module.exports = { - factory, pair, fabis, pabis, -} \ No newline at end of file diff --git a/projects/protoss-dex/api.js b/projects/protoss-dex/api.js index bcfbb200016..7066cf4bca7 100644 --- a/projects/protoss-dex/api.js +++ b/projects/protoss-dex/api.js @@ -1,38 +1,9 @@ - -const { call, multiCall, parseAddress } = require('../helper/chain/starknet') -const abi = require('./abi') -const { transformDexBalances } = require('../helper/portedTokens') -const { getParamCalls } = require('../helper/utils') - -async function tvl() { - const factory = '0x04bd9ec70e3ee64fe0adefe0ae4eff797fe07b6fe19d72438db0b6d336ee77c8' - let pairLength = await call({ target: factory, abi: abi.factory.allPairsLength}) - let pairs = await multiCall({ abi: abi.factory.allPairs, target: factory, calls: getParamCalls(+pairLength)}) - - const calls = pairs.map(i => parseAddress(i)) - - const [ token0s, token1s, reserves ] = await Promise.all([ - multiCall({ abi: abi.pair.token0, calls }), - multiCall({ abi: abi.pair.token1, calls }), - multiCall({ abi: abi.pair.getReserves, calls }), - ]) - - const data = [] - reserves.forEach((reserve, i) => { - data.push({ - token0: parseAddress(token0s[i]), - token1: parseAddress(token1s[i]), - token0Bal: +reserve.reserve0, - token1Bal: +reserve.reserve1, - }) - }) - - return transformDexBalances({chain:'starknet', data}) -} +const { dexExport } = require('../helper/chain/starknet') +const factory = '0x04bd9ec70e3ee64fe0adefe0ae4eff797fe07b6fe19d72438db0b6d336ee77c8' module.exports = { timetravel: false, starknet: { - tvl, + tvl: dexExport({ factory, }), } } diff --git a/projects/sithswap/abi.js b/projects/sithswap/abi.js index d69dc1543da..a15ec7105d1 100644 --- a/projects/sithswap/abi.js +++ b/projects/sithswap/abi.js @@ -13,7 +13,8 @@ const fabis = [{ "type": "felt" } ], - "stateMutability": "view" + "stateMutability": "view", + "customType": "address" }, { "name": "allPairsLength", @@ -40,7 +41,8 @@ const pabis = [ "type": "felt" } ], - "stateMutability": "view" + "stateMutability": "view", + "customType": "address" }, { "name": "getToken1", @@ -52,7 +54,8 @@ const pabis = [ "type": "felt" } ], - "stateMutability": "view" + "stateMutability": "view", + "customType": "address" }, { "inputs": [], diff --git a/projects/sithswap/api.js b/projects/sithswap/api.js index 587b71976cf..ed3da6c586b 100644 --- a/projects/sithswap/api.js +++ b/projects/sithswap/api.js @@ -1,6 +1,6 @@ // https://www.starknetjs.com/docs/API/contract -const { call, multiCall, parseAddress } = require('../helper/chain/starknet') +const { call, multiCall, } = require('../helper/chain/starknet') const abi = require('./abi') const { transformDexBalances } = require('../helper/portedTokens') const { getParamCalls } = require('../helper/utils') @@ -8,22 +8,18 @@ async function tvl() { const factory = '0xeaf728d8e09bfbe5f11881f848ca647ba41593502347ed2ec5881e46b57a32' let pairLength = await call({ target: factory, abi: abi.factory.allPairsLength}) let pairs = await multiCall({ abi: abi.factory.allPairs, target: factory, calls: getParamCalls(Number(pairLength) + 1)}) - if (pairs[0]== 0){ - pairs.shift() - } - const calls = pairs.map(i => parseAddress(i)) - const [ token0s, token1s ,reserves0,reserves1] = await Promise.all([ - multiCall({ abi: abi.pair.getToken0, calls }), - multiCall({ abi: abi.pair.getToken1, calls }), - multiCall({ abi: abi.pair.getReserve0, calls }), - multiCall({ abi: abi.pair.getReserve1, calls }), - ]) + pairs = pairs.filter(i => i !== '0x0000000000000000000000000000000000000000000000000000000000000000') + const calls = pairs + const token0s = await multiCall({ abi: abi.pair.getToken0, calls }) + const token1s = await multiCall({ abi: abi.pair.getToken1, calls }) + const reserves0 = await multiCall({ abi: abi.pair.getReserve0, calls }) + const reserves1 = await multiCall({ abi: abi.pair.getReserve1, calls }) const data = [] reserves0.forEach((reserve0, i) => { data.push({ - token0: parseAddress(token0s[i]), - token1: parseAddress(token1s[i]), + token0: token0s[i], + token1: token1s[i], token0Bal: +reserve0, token1Bal: +reserves1[i], }) diff --git a/projects/starkex/api.js b/projects/starkex/api.js index e0541fe5b2b..85ccc1c17f7 100644 --- a/projects/starkex/api.js +++ b/projects/starkex/api.js @@ -9,13 +9,11 @@ async function tvl() { let pairLength = await call({ target: factory, abi: abi.factory.allPairsLength}) let pairs = await multiCall({ abi: abi.factory.allPairs, target: factory, calls: getParamCalls(+pairLength)}) - const calls = pairs.map(i => parseAddress(i)) + const calls = pairs.map(i => parseAddress(i)).filter(i => i !== '0x0000000000000000000000000000000000000000000000000000000000000000') - const [ token0s, token1s, reserves ] = await Promise.all([ - multiCall({ abi: abi.pair.token0, calls }), - multiCall({ abi: abi.pair.token1, calls }), - multiCall({ abi: abi.pair.getReserves, calls }), - ]) + const token0s = await multiCall({ abi: abi.pair.token0, calls }) + const token1s = await multiCall({ abi: abi.pair.token1, calls }) + const reserves = await multiCall({ abi: abi.pair.getReserves, calls }) const data = [] reserves.forEach((reserve, i) => { diff --git a/projects/zklend/abi.js b/projects/zklend/abi.js index 9a3879ef628..586b6da1cb4 100644 --- a/projects/zklend/abi.js +++ b/projects/zklend/abi.js @@ -14,7 +14,8 @@ const market = [ "type": "felt" } ], - "stateMutability": "view" + "stateMutability": "view", + "customInput": "address" }, ] const marketAbi = {} diff --git a/projects/zklend/index.js b/projects/zklend/index.js index 2f62c986dcf..537c3178872 100644 --- a/projects/zklend/index.js +++ b/projects/zklend/index.js @@ -1,14 +1,7 @@ const ADDRESSES = require('../helper/coreAssets.json') -const { BigNumber } = require("bignumber.js"); const { multiCall, sumTokens } = require('../helper/chain/starknet') const { marketAbi } = require('./abi'); -const valueToBigNumber = (amount) => { - if (amount instanceof BigNumber) { - return amount; - } - return new BigNumber(amount); -} const market = '0x4c0a5193d58f74fbace4b74dcf65481e734ed1714121bdc571da345540efa05' const assets = [ @@ -25,7 +18,7 @@ async function tvl(_, _1, _2, { api }) { async function borrowed(_, _1, _2, { api }) { let data = await multiCall({ calls: assets, target: market, abi: marketAbi.get_total_debt_for_token }); - data = data.map(i => valueToBigNumber(i).toNumber()) + data = data.map(i => +i) api.addTokens(assets, data) } From 7a52f61927e9ef48f8b27f6e4212bb02946edb51 Mon Sep 17 00:00:00 2001 From: Phil <30321052+philipjames44@users.noreply.github.com> Date: Wed, 30 Aug 2023 12:42:10 -0600 Subject: [PATCH 1039/1974] Sommelier: Add RYBTC launch and remove Steady, Trend, & MOM vault launches (#7332) --- projects/sommelier/index.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/projects/sommelier/index.js b/projects/sommelier/index.js index 5a851a3c1f4..98299db27af 100644 --- a/projects/sommelier/index.js +++ b/projects/sommelier/index.js @@ -101,9 +101,8 @@ module.exports = { [chain]: { tvl }, hallmarks: [ [1658419200, "aave2 Cellar Launch"], - [1666886400, "ETH-BTC Trend & Momentum Cellars Launch"], - [1669741200, "Steady ETH & BTC Cellars Launch"], [1674671068, "Real Yield USD Cellar Launch"], [1681233049, "Real Yield ETH Cellar Launch"], + [1689271200, "Real Yield BTC Cellar Launch"], ], }; From 23710f9dd5fbab199c9e7bea67cbce4c50ef13af Mon Sep 17 00:00:00 2001 From: Robert Chu Date: Wed, 30 Aug 2023 11:42:45 -0700 Subject: [PATCH 1040/1974] Update subgraph url for term-finance (#7331) --- projects/term-finance/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/term-finance/index.js b/projects/term-finance/index.js index 89633d41637..1b77db2c750 100644 --- a/projects/term-finance/index.js +++ b/projects/term-finance/index.js @@ -2,7 +2,7 @@ const { cachedGraphQuery } = require('../helper/cache') const graphs = { ethereum: - "https://api.studio.thegraph.com/query/33765/term-finance-mainnet/version/latest", + "https://graph-node.mainnet.termfinance.io/subgraphs/name/term-finance-mainnet", }; const query = ` From 13b50c8ffaba80575417ec794f7819a13c40bebc Mon Sep 17 00:00:00 2001 From: Vojtch Date: Wed, 30 Aug 2023 20:43:22 +0200 Subject: [PATCH 1041/1974] update pwn (#7330) --- projects/pwn/index.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/projects/pwn/index.js b/projects/pwn/index.js index d10e013fa5c..220d8f97d02 100644 --- a/projects/pwn/index.js +++ b/projects/pwn/index.js @@ -8,13 +8,14 @@ const PWN_BUNDLER_MAINNET = "0x19e3293196aee99BB3080f28B9D3b4ea7F232b8d"; const PWN_BUNDLER_POLYGON = "0xe52405604bF644349f57b36Ca6E85cf095faB8dA"; const PWN_BUNDLER_CRONOS = "0x973E09e96E64E4bf17e383a8A497Fb566284c707"; const PWN_BUNDLER_BASE = "0x6fD3f5439aB1C103599385929d5f4c19acdBd264"; +const PWN_BUNDLER_MANTLE = "0x67c86D5900a6494a08EE48448e95781DcF33c804"; const PWN_V1_SIMPLE_LOAN = "0x50160ff9c19fbE2B5643449e1A321cAc15af2b2C"; const PWN_V1_1_SIMPLE_LOAN_A = "0x57c88D78f6D08b5c88b4A3b7BbB0C1AA34c3280A"; // Polygon and Mainnet -const PWN_V1_1_SIMPLE_LOAN_B = "0x4188C513fd94B0458715287570c832d9560bc08a"; // Cronos and Base +const PWN_V1_1_SIMPLE_LOAN_B = "0x4188C513fd94B0458715287570c832d9560bc08a"; // Cronos, Base, Mantle module.exports = { misrepresentedTokens: true, - methodology: `Sums up all the tokens deposited in the PWN Protocol. NFTs are resolved to their floor price using Chainlink price feeds.`, + methodology: `Sums up all the tokens deposited in the PWN Protocol. NFTs are resolved to their floor price using Chainlink price feeds. Note that NFTs are resolved only on Ethereum.`, ethereum: { tvl: sumTokensExport({ owners: [ @@ -28,7 +29,7 @@ module.exports = { resolveArtBlocks: true, }), }, - // resolveNFTs: true is currently unsupported on Polygon, Cronos and Base + // resolveNFTs: true is currently unsupported on Polygon, Cronos, Base and Mantle // https://discord.com/channels/823822164956151810/823885412425793587/1139362819012304956 polygon: { tvl: sumTokensExport({ @@ -51,4 +52,9 @@ module.exports = { owners: [PWN_BUNDLER_BASE, PWN_V1_1_SIMPLE_LOAN_B], fetchCoValentTokens: true, }), }, + mantle: { + tvl: sumTokensExport({ + owners: [PWN_BUNDLER_MANTLE, PWN_V1_1_SIMPLE_LOAN_B], fetchCoValentTokens: true, tokenConfig: { useCovalent: true, }, + }) + } }; From 6cbe693c497029bb483231bfd0b5d08c00fb5a27 Mon Sep 17 00:00:00 2001 From: g1nt0ki Date: Wed, 30 Aug 2023 20:47:42 +0200 Subject: [PATCH 1042/1974] track bonedex --- projects/bonedex/index.js | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 projects/bonedex/index.js diff --git a/projects/bonedex/index.js b/projects/bonedex/index.js new file mode 100644 index 00000000000..725585ed9de --- /dev/null +++ b/projects/bonedex/index.js @@ -0,0 +1,3 @@ +const { uniTvlExport } = require('../helper/unknownTokens') + +module.exports = uniTvlExport('shibarium', '0x907599886DeBF90CCB1e9B446b31D52bDD25926D', { fetchBalances: true, }) \ No newline at end of file From fc719dd96c2e766d9bc646f2743c97fb3b2d6061 Mon Sep 17 00:00:00 2001 From: ftm1337 <84405345+ftm1337@users.noreply.github.com> Date: Wed, 30 Aug 2023 19:23:11 +0000 Subject: [PATCH 1043/1974] add Polygon & Base to Guru & E3 (#7324) --- projects/E3/index.js | 5 +++-- projects/Guru/index.js | 7 ++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/projects/E3/index.js b/projects/E3/index.js index 473dc90087c..2d06fcabe1b 100644 --- a/projects/E3/index.js +++ b/projects/E3/index.js @@ -1,8 +1,9 @@ const { sumTokens2 } = require('../helper/unwrapLPs') const factories = { - fantom: '0x8597dB3ba8dE6BAAdEDa8cBa4dAC653E24a0e57B', - arbitrum: '0x8597dB3ba8dE6BAAdEDa8cBa4dAC653E24a0e57B' + fantom: '0x8597dB3ba8dE6BAAdEDa8cBa4dAC653E24a0e57B', + arbitrum: '0x8597dB3ba8dE6BAAdEDa8cBa4dAC653E24a0e57B', + base: '0x8597dB3ba8dE6BAAdEDa8cBa4dAC653E24a0e57B' ///zkevm: tbd } async function tvl(_, _b, _cb, { api, }) { diff --git a/projects/Guru/index.js b/projects/Guru/index.js index 3391dc8a2c3..f94151f65a2 100644 --- a/projects/Guru/index.js +++ b/projects/Guru/index.js @@ -5,7 +5,7 @@ const ITVL = { } // TvlGuru: On-Chain Universal TVL Finder -const tvlGuru = { +const tvlGuru = { "fantom": "0x0786c3a78f5133F08C1c70953B8B10376bC6dCad", "kcc": "0x426a4A4B73d4CD173C9aB78d18c0d79d1717eaA9", "multivac": "0xe345A50C33e5c9D0284D6fF0b891c4Fc99a9C117", @@ -13,12 +13,13 @@ const tvlGuru = { "metis": "0x50Dcc6cb1B2d6965c42d98a2b07629c57a6be895", "bsc": "0xD600Ec98cf6418c50EE051ACE53219D95AeAa134", "arbitrum": "0xFAB311FE3E3be4bB3fEd77257EE294Fb22Fa888b", - "avax": "0xFAB311FE3E3be4bB3fEd77257EE294Fb22Fa888b" + "avax": "0xFAB311FE3E3be4bB3fEd77257EE294Fb22Fa888b", + "polygon" : "0x18C7AD880A07D363f2d034a8523ae34b8068845a" } module.exports = { misrepresentedTokens: true, - methodology: "USD-denominated value aggregation of most Locked assets held across Guru Network's & Kompound Protocol's smart contracts across multiple chains, powered by direct on-chain storage of quantity, pools and prices using ftm.guru's Universal TVL Finder Tool (tvlGuru.sol). More detailed documentation of TVL is available at https://ftm.guru/rawdata/tvl", + methodology: "USD-denominated value aggregation of most Locked assets held across Guru Network's smart contracts across multiple chains, powered by direct on-chain storage of quantity, pools and prices using ftm.guru's Universal TVL Finder Tool (tvlGuru.sol). More detailed documentation of TVL is available at https://ftm.guru/rawdata/tvl and https://ftm.guru/docs.", } Object.entries(tvlGuru).forEach(([chain, target]) => { From f95849b7eeecc9c00d62d6ce3aeafe3cebcc2c8c Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 30 Aug 2023 21:28:33 +0200 Subject: [PATCH 1044/1974] Bloom (#7333) * init * api call fix * Remove unnecessary logs * Change token form USDT to USDC * refactor code * track backed.fi --------- Co-authored-by: Gornutz <90406700+Gornutz@users.noreply.github.com> Co-authored-by: baileyspraggins --- projects/backed/index.js | 20 ++++++++++++++++++++ projects/bloom/abi.json | 4 ++++ projects/bloom/index.js | 16 ++++++++++++++++ 3 files changed, 40 insertions(+) create mode 100644 projects/backed/index.js create mode 100644 projects/bloom/abi.json create mode 100644 projects/bloom/index.js diff --git a/projects/backed/index.js b/projects/backed/index.js new file mode 100644 index 00000000000..bd87e906ade --- /dev/null +++ b/projects/backed/index.js @@ -0,0 +1,20 @@ + +const contracts = [ + "0x2F123cF3F37CE3328CC9B5b8415f9EC5109b45e7", // bC3M + "0xCA30c93B02514f86d5C86a6e375E3A330B435Fb5", // b1B01 + "0x52d134c6DB5889FaD3542A09eAf7Aa90C0fdf9E4", // bIBTA + "0x1e2c4fb7ede391d116e6b41cd0608260e8801d59", // bCSPX + "0x20C64dEE8FdA5269A78f2D5BDBa861CA1d83DF7a", // bHIGH +] + +async function tvl(_, _b, _cb, { api, }) { + const supply = await api.multiCall({ abi: 'erc20:totalSupply', calls: contracts }) + api.addTokens(contracts, supply) + +} + +module.exports = { + ethereum: { + tvl + } +} \ No newline at end of file diff --git a/projects/bloom/abi.json b/projects/bloom/abi.json new file mode 100644 index 00000000000..f8680b1569d --- /dev/null +++ b/projects/bloom/abi.json @@ -0,0 +1,4 @@ +{ + "getActiveTokens": "address[]:getActiveTokens", + "getInactiveTokens": "address[]:getInactiveTokens" +} diff --git a/projects/bloom/index.js b/projects/bloom/index.js new file mode 100644 index 00000000000..72a1e727116 --- /dev/null +++ b/projects/bloom/index.js @@ -0,0 +1,16 @@ +const abi = require('./abi.json'); +const { sumTokens2 } = require('../helper/unwrapLPs'); + +const REGISTRY = '0xBbBe37FE58e9859b6943AC53bDf4d0827f7F0034'; + +async function tvl(timestamp, block, chainBlocks, { api }) { + const activePools = await api.call({ target: REGISTRY, abi: abi['getActiveTokens'] }); + const inactivePools = await api.call({ target: REGISTRY, abi: abi['getInactiveTokens'] }); + const allPools = [...activePools, ...inactivePools]; + return sumTokens2({ owners: allPools, tokens: ['0xCA30c93B02514f86d5C86a6e375E3A330B435Fb5'], api }) +} + +module.exports = { + methodology: 'Gets the active pools from the registry and adds the total supply of each pool', + ethereum: { tvl, }, +}; From c48f6005723b05acca5ea96f4307828fd1a7e0b6 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Wed, 30 Aug 2023 21:54:23 +0100 Subject: [PATCH 1045/1974] add new pools --- projects/proteo-farms/index.js | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/projects/proteo-farms/index.js b/projects/proteo-farms/index.js index b1d0f258286..000c3271ea1 100644 --- a/projects/proteo-farms/index.js +++ b/projects/proteo-farms/index.js @@ -9,10 +9,20 @@ async function tvl() { ['USDC-c76f1f', 'erd1qqqqqqqqqqqqqpgq25l7fgjdecaanxuuzxnquzs7k80q6mqaznyqzjclf5'], ['ZPAYWEGLD-34e5c1', 'erd1qqqqqqqqqqqqqpgqrpa6ezy0q4xuj6y9plgv85va43x7wy3dznyqr2rwcz'], ['ZPAYWEGLD-34e5c1', 'erd1qqqqqqqqqqqqqpgqpn4fnee2mwkqea6x65xdsgp2whfcl964znyqw67z9s'], + ['ZPAY-247875', 'erd1qqqqqqqqqqqqqpgq4szwc687pqfv3euah6ph0tx6a7n9xn7mznyqefetyg'], ['KROUSDC-7787ab', 'erd1qqqqqqqqqqqqqpgqu693lwsewjvs5f9mssk0fpfex00q77zfznyq4cd0rt'], ['KROUSDC-7787ab', 'erd1qqqqqqqqqqqqqpgqa6y0t72nglqdlqe7cv5cqjsam2ssm4w3znyqdrphza'], ['AEROWEGLD-81cc37', 'erd1qqqqqqqqqqqqqpgqapmdgehzl22pu6m5pkvy2fhzm49uxkxhznyqhwhcx5'], ['AEROWEGLD-81cc37', 'erd1qqqqqqqqqqqqqpgqnedra5da464rkcektgzyv0qxcgqgyh26znyq8q4phx'], + ['UTK-2f80e9', 'erd1qqqqqqqqqqqqqpgqhr56z8yg8e7254dd46ngd92lj95wp7pmznyq22sdtu'], + ['WBTC-5349b3', 'erd1qqqqqqqqqqqqqpgqthjr3qyjev246dut0f06dx8tw3p8njv7znyq408ttl'], + ['WETH-b4ca29', 'erd1qqqqqqqqqqqqqpgqh47rhd4zpwpe93j7nx625dykr6k7xtj4znyq36v5se'], + ['CYBERWEGLD-45a866', 'erd1qqqqqqqqqqqqqpgqvvn3s8ndrxqu6ndgnvsfp4sx9wgtv9z2znyqrfyhsf'], + ['CYBERWEGLD-45a866', 'erd1qqqqqqqqqqqqqpgqrgve6e0m6le5cn8lng9g2z3a9apq85ltznyqzc64ns'], + ['WAMWEGLD-cdfa74', 'erd1qqqqqqqqqqqqqpgqwjxup8jwlhwzuz032cx9w8qajqsyl0jjznyqvfp4e0'], + ['WAMWEGLD-cdfa74', 'erd1qqqqqqqqqqqqqpgqkm0aktstdnrq58n5ysyqqkq4qudnea98znyqz0a97d'], + ['OFEWEGLD-73840b', 'erd1qqqqqqqqqqqqqpgqq739cgj7nale069vy44kxmau7j4zt06sznyq4g692l'], + ['OFEWEGLD-73840b', 'erd1qqqqqqqqqqqqqpgqjrq0pez7fve20daceuc7xqy9den005d7znyqcqj8tk'], ] return sumTokens({tokensAndOwners}) } @@ -26,10 +36,21 @@ async function pool2() { return sumTokens({tokensAndOwners}) } +async function staking() { + const tokensAndOwners = [ + ['PROTEO-0c7311', 'erd1qqqqqqqqqqqqqpgqgypex2r0x5el8lsfk4hpdp0yhkuz79juznyqukp6qd'], + ] + + return sumTokens({tokensAndOwners}) +} + module.exports = { timetravel: false, elrond: { tvl, pool2, + staking }, -} \ No newline at end of file +} + + From c4676b812ca77bf2229e2abc28afc1ff4bc80e6b Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Wed, 30 Aug 2023 22:20:00 +0100 Subject: [PATCH 1046/1974] add base chain to hop --- projects/hop/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/hop/index.js b/projects/hop/index.js index cf62bfc65d9..fc24b995af4 100644 --- a/projects/hop/index.js +++ b/projects/hop/index.js @@ -46,4 +46,4 @@ function chainTvl(chain) { } } -module.exports = chainExports(chainTvl, ['ethereum', 'polygon', 'optimism', 'arbitrum', ...Object.keys(chainMapping)]) \ No newline at end of file +module.exports = chainExports(chainTvl, ['base', 'ethereum', 'polygon', 'optimism', 'arbitrum', ...Object.keys(chainMapping)]) \ No newline at end of file From 866abcc870ce14a170e2eb7d415d91088a8eac0e Mon Sep 17 00:00:00 2001 From: define Date: Wed, 30 Aug 2023 22:49:44 +0100 Subject: [PATCH 1047/1974] add lybra v2 adapter --- projects/lybra-v2/index.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 projects/lybra-v2/index.js diff --git a/projects/lybra-v2/index.js b/projects/lybra-v2/index.js new file mode 100644 index 00000000000..7849739f06c --- /dev/null +++ b/projects/lybra-v2/index.js @@ -0,0 +1,12 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require("../helper/unwrapLPs"); + +// Lybra holds total stake collateral (deposited ETH) +const LYBRA_CONTRACT = "0xed1167b6Dc64E8a366DB86F2E952A482D0981ebd"; + +module.exports = { + start: 17990519, + ethereum: { + tvl: sumTokensExport({ owner: LYBRA_CONTRACT, tokens: [ADDRESSES.ethereum.STETH, ADDRESSES.ethereum.sfrxETH, ADDRESSES.ethereum]}), + } +}; From 9b2f58c94e59cb22e96d1b39a37d8848c3945758 Mon Sep 17 00:00:00 2001 From: define Date: Wed, 30 Aug 2023 22:51:40 +0100 Subject: [PATCH 1048/1974] fix --- projects/lybra-v2/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/lybra-v2/index.js b/projects/lybra-v2/index.js index 7849739f06c..a51352990e1 100644 --- a/projects/lybra-v2/index.js +++ b/projects/lybra-v2/index.js @@ -7,6 +7,6 @@ const LYBRA_CONTRACT = "0xed1167b6Dc64E8a366DB86F2E952A482D0981ebd"; module.exports = { start: 17990519, ethereum: { - tvl: sumTokensExport({ owner: LYBRA_CONTRACT, tokens: [ADDRESSES.ethereum.STETH, ADDRESSES.ethereum.sfrxETH, ADDRESSES.ethereum]}), + tvl: sumTokensExport({ owner: LYBRA_CONTRACT, tokens: [ADDRESSES.ethereum.STETH, ADDRESSES.ethereum.sfrxETH]}), } }; From d16cce08aa694fc002de459ead322623bc316564 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Wed, 30 Aug 2023 22:56:13 +0100 Subject: [PATCH 1049/1974] add kinetix --- projects/kinetix/index.js | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 projects/kinetix/index.js diff --git a/projects/kinetix/index.js b/projects/kinetix/index.js new file mode 100644 index 00000000000..d6e0c167622 --- /dev/null +++ b/projects/kinetix/index.js @@ -0,0 +1,7 @@ +const { gmxExports } = require('../helper/gmx') + +module.exports = { + kava: { + tvl: gmxExports({ vault: "0xa721f9f61CECf902B2BCBDDbd83E71c191dEcd8b", }) + }, +}; \ No newline at end of file From 70c8b778a9cd6727a4ffe3cdbe47b928027a38ff Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Wed, 30 Aug 2023 23:10:40 +0100 Subject: [PATCH 1050/1974] add new vaults to qidao --- projects/qidao/index.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/projects/qidao/index.js b/projects/qidao/index.js index e1d8e0f58ed..561c77a7cfb 100644 --- a/projects/qidao/index.js +++ b/projects/qidao/index.js @@ -70,7 +70,7 @@ const config = { // "0xF8AC186555cbd5104c0e8C5BacF8bB779a3869f5", // "0xEa88eB237baE0AE26f4500146c251d25F409FA32", // "0x8Edc3fB6Fcdd5773216331f74AfDb6a2a2E16dc9", - "0x13a7fe3ab741ea6301db8b164290be711f546a73", + //"0x13a7fe3ab741ea6301db8b164290be711f546a73", "0x73a755378788a4542a780002a75a7bae7f558730", "0xa9122dacf3fccf1aae6b8ddd1f75b6267e5cbbb8", "0x1f8f7a1d38e41eaf0ed916def29bdd13f2a3f11a", @@ -99,6 +99,12 @@ const config = { "0x014a177e9642d1b4e970418f894985dc1b85657f", ] }, + base: { + vaults: [ + //"0x7333fd58d8d73a8e5fc1a16c8037ada4f580fa2b", + "0x8d6cebd76f18e1558d4db88138e2defb3909fad6" + ] + }, ethereum: { vaults: [ "0x60d133c666919B54a3254E0d3F14332cB783B733", @@ -108,7 +114,9 @@ const config = { "0xcc61Ee649A95F2E2f0830838681f839BDb7CB823", "0x82E90EB7034C1DF646bD06aFb9E67281AAb5ed28", "0xCA3EB45FB186Ed4e75B9B22A514fF1d4abAdD123", - "0x4ce4C542D96Ce1872fEA4fa3fbB2E7aE31862Bad" + "0x4ce4C542D96Ce1872fEA4fa3fbB2E7aE31862Bad", + //"0x5773e8953cf60f495eb3c2db45dd753b5c4b7473", + "0x954ac12c339c60eafbb32213b15af3f7c7a0dec2" ] }, bsc: { From 4c3e64b86938fac5267793d60b80f64d69e89ff4 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 31 Aug 2023 10:51:26 +0200 Subject: [PATCH 1051/1974] mark dead projects --- projects/LFIswap/index.js | 4 +- projects/acumen/index.js | 1 + projects/agarthadao/index.js | 3 +- projects/allinx.js | 1 + projects/almond.js | 1 + projects/amyfinance/index.js | 3 +- projects/anchor/index.js | 1 + projects/angel-protocol/index.js | 2 + projects/astral.js | 3 +- projects/bepswap.js | 3 +- projects/bitpif/index.js | 1 + projects/blizzfinance/index.js | 1 + projects/bond-appetit.js | 1 + projects/bubbleswap/index.js | 3 +- projects/cakedao/index.js | 2 + projects/candle/index.js | 2 + projects/cubo/index.js | 2 + projects/dexit-swap/index.js | 4 +- projects/eight/index.js | 1 + projects/elf-finance/index.js | 3 +- projects/empyrean/index.js | 3 + projects/everlend/index.js | 2 + projects/eversol.js | 17 ++- projects/fabric/index.js | 1 + projects/fegex/index.js | 2 +- projects/footballmanager/index.js | 3 +- projects/frfi/index.js | 2 + projects/galaxygoggle/index.js | 1 + projects/genshiro/index.js | 3 +- projects/goblin/index.js | 3 +- projects/hadesswap/index.js | 1 + projects/helper/utils/solana/layout.js | 3 +- .../utils/solana/layouts/layout-base.js | 40 +++++- .../utils/solana/layouts/mixed-layout.js | 45 ++++++- projects/ink-protocol/index.js | 2 + projects/junoswap/index.js | 2 + projects/kafefinance/index.js | 1 + projects/kperp-exchange/index.js | 2 + projects/lanternswap/index.js | 3 +- projects/loterra/index.js | 1 + projects/louverture/index.js | 2 + projects/luxor/api.js | 3 +- projects/manarium/index.js | 3 +- projects/mango-markets/index.js | 57 +------- projects/marginswap/index.js | 2 + projects/merlinlab/index.js | 107 +-------------- projects/metropolis/index.js | 1 + projects/midasdao.js | 51 +------- projects/minimax/index.js | 2 + projects/miniversefinance/index.js | 3 +- projects/mirror/index.js | 1 + projects/murica.js | 3 +- projects/nexus-protocol/index.js | 3 +- projects/nft360/index.js | 2 + projects/ogx/index.js | 3 +- projects/omicron/api.js | 3 +- projects/ondofinance-v1/index.js | 123 +----------------- projects/optifi/index.js | 2 + projects/optitude/index.js | 3 +- projects/phezzan/index.js | 1 + projects/piggy-finance/index.js | 2 + projects/pizza/index.js | 12 +- projects/pony/index.js | 23 +--- projects/projectx/index.js | 4 +- projects/puddingswap/index.js | 2 + projects/puli/index.js | 2 + projects/pylon/index.js | 1 + projects/qao/index.js | 3 +- projects/ringfi/index.js | 3 + projects/safeohm/index.js | 4 +- projects/securedao/index.js | 4 +- projects/smartpad/index.js | 2 + projects/solanax.js | 4 +- projects/squid-dao/index.js | 4 +- projects/starterra.js | 3 +- projects/steak/index.js | 3 + projects/strips/index.js | 4 +- projects/tangent/index.js | 3 + projects/terrafloki.js | 3 + projects/tlchain-decryption/index.js | 3 +- projects/totemfi/index.js | 3 +- projects/twtstake/index.js | 6 +- projects/unusdao/index.js | 1 + projects/valkyrie/index.js | 2 + projects/velaro/index.js | 2 + projects/vikings/index.js | 2 + projects/wault.js | 1 + projects/whaleloans/index.js | 3 +- projects/wisteriaswap/index.js | 3 +- projects/witswap/index.js | 14 +- projects/wrapped-ilcoin/index.js | 2 + projects/xWeowns/index.js | 3 +- projects/xensa/index.js | 1 + projects/yieldly/index.js | 50 +------ projects/yogi/index.js | 1 + projects/ysmart/index.js | 2 + projects/zai.js | 3 +- 97 files changed, 271 insertions(+), 471 deletions(-) diff --git a/projects/LFIswap/index.js b/projects/LFIswap/index.js index 9fc0d8f9ac0..4a406c70ccb 100644 --- a/projects/LFIswap/index.js +++ b/projects/LFIswap/index.js @@ -9,4 +9,6 @@ module.exports = { useDefaultCoreAssets: true, }), } -} \ No newline at end of file +} + +module.exports.deadFrom = '2023-04-09' \ No newline at end of file diff --git a/projects/acumen/index.js b/projects/acumen/index.js index ff69b2394e6..152887526cf 100644 --- a/projects/acumen/index.js +++ b/projects/acumen/index.js @@ -4,5 +4,6 @@ module.exports = { hallmarks: [ [Math.floor(new Date('2022-12-12')/1e3), 'Product is deprecated'], ], + deadFrom: '2022-12-12', methodology: `Product is deprecated. More information: https://acumenofficial.medium.com/acumen-stable-dapp-update-7e96333e9318`, } \ No newline at end of file diff --git a/projects/agarthadao/index.js b/projects/agarthadao/index.js index 011f7358221..d661835b181 100644 --- a/projects/agarthadao/index.js +++ b/projects/agarthadao/index.js @@ -14,4 +14,5 @@ const treasuryTokens = [ module.exports = { ...ohmTvl(treasury, treasuryTokens, "avax", stakingContract, clavis) -} \ No newline at end of file +} +module.exports.deadFrom = '2022-03-01' \ No newline at end of file diff --git a/projects/allinx.js b/projects/allinx.js index aa29395bdda..4b631b32f08 100644 --- a/projects/allinx.js +++ b/projects/allinx.js @@ -3,4 +3,5 @@ module.exports = { bsc: { tvl: () => 0 }, + deadFrom: 1680328420, } diff --git a/projects/almond.js b/projects/almond.js index a77414fa78c..425866a6a42 100644 --- a/projects/almond.js +++ b/projects/almond.js @@ -4,4 +4,5 @@ module.exports = { solana: { tvl: () => ({}), // project is dead }, + deadFrom: "2022-06-19", }; diff --git a/projects/amyfinance/index.js b/projects/amyfinance/index.js index 83f5b25bc10..a3d082e495c 100644 --- a/projects/amyfinance/index.js +++ b/projects/amyfinance/index.js @@ -34,5 +34,6 @@ async function tvl(timestamp, ethBlock, {arbitrum: block}) { } module.exports = { - arbitrum: { tvl, } + arbitrum: { tvl, }, + deadFrom: '2022-10-23' } diff --git a/projects/anchor/index.js b/projects/anchor/index.js index 2ac5d583497..9fd2ddc1bb6 100644 --- a/projects/anchor/index.js +++ b/projects/anchor/index.js @@ -8,6 +8,7 @@ module.exports = { avax: { tvl: () => ({}), }, + deadFrom: '2022-05-26', hallmarks: [ [1651881600, "UST depeg"], ] diff --git a/projects/angel-protocol/index.js b/projects/angel-protocol/index.js index 379e9a2c50c..f415232393c 100644 --- a/projects/angel-protocol/index.js +++ b/projects/angel-protocol/index.js @@ -8,3 +8,5 @@ module.exports = { [1651881600, "UST depeg"], ] } + +module.exports.deadFrom = '2022-05-09' \ No newline at end of file diff --git a/projects/astral.js b/projects/astral.js index 6c53d5835be..aa2ab8bda11 100644 --- a/projects/astral.js +++ b/projects/astral.js @@ -3,4 +3,5 @@ fantom: { tvl: () => 0, } - }; \ No newline at end of file + }; + module.exports.deadFrom = '2023-04-09' \ No newline at end of file diff --git a/projects/bepswap.js b/projects/bepswap.js index a8480d2f943..28fe67133f7 100644 --- a/projects/bepswap.js +++ b/projects/bepswap.js @@ -1,3 +1,4 @@ module.exports = { - fetch: () => 0 + fetch: () => 0, + deadFrom: 1630043620, } \ No newline at end of file diff --git a/projects/bitpif/index.js b/projects/bitpif/index.js index bcd511f2e31..a0aa28b424e 100644 --- a/projects/bitpif/index.js +++ b/projects/bitpif/index.js @@ -27,5 +27,6 @@ module.exports = { pool2: stakings(stakingContracts, [USDC_BPF_UNIV2]), tvl: (async) => ({}), }, + deadFrom: "2022-05-01", methodology: "Counts liquidty on the staking and pool2s only", }; diff --git a/projects/blizzfinance/index.js b/projects/blizzfinance/index.js index b1f55c60040..2f8a9e59043 100644 --- a/projects/blizzfinance/index.js +++ b/projects/blizzfinance/index.js @@ -7,6 +7,7 @@ module.exports={ tvl: aaveExports("avax", "0xfF50b540c9152F1841edF47b49dA69696Be59783").tvl, borrowed: ()=>({}) // hacked, it's all bad debt }, + deadFrom: 1652356800, hallmarks:[ [1652356800, "Outdated Oracle Exploit"], ], diff --git a/projects/bond-appetit.js b/projects/bond-appetit.js index ead5a60c507..a7a3869328b 100644 --- a/projects/bond-appetit.js +++ b/projects/bond-appetit.js @@ -2,4 +2,5 @@ module.exports = { ethereum: { tvl: () => ({}) }, + deadFrom: '2023-08-19', } diff --git a/projects/bubbleswap/index.js b/projects/bubbleswap/index.js index 1d90435596e..a6d839ac7c8 100644 --- a/projects/bubbleswap/index.js +++ b/projects/bubbleswap/index.js @@ -5,5 +5,6 @@ module.exports = { hallmarks: [ [1666569600, "Start V1 Rewards"], [1683813600, "V1 Deprecation"], - ] + ], + deadFrom: 1683813600, } \ No newline at end of file diff --git a/projects/cakedao/index.js b/projects/cakedao/index.js index f306220cc06..79e24bb2592 100644 --- a/projects/cakedao/index.js +++ b/projects/cakedao/index.js @@ -24,3 +24,5 @@ module.exports = { cake ), }; + +module.exports.deadFrom = '2022-02-01' \ No newline at end of file diff --git a/projects/candle/index.js b/projects/candle/index.js index 71ea1c97a8a..6c5dc5017de 100644 --- a/projects/candle/index.js +++ b/projects/candle/index.js @@ -26,3 +26,5 @@ module.exports = { methodology: "Counts liquidty on the staking and pool2s only", }; + +module.exports.deadFrom = '2022-05-25' \ No newline at end of file diff --git a/projects/cubo/index.js b/projects/cubo/index.js index be72a56dc38..635ae20dc8b 100644 --- a/projects/cubo/index.js +++ b/projects/cubo/index.js @@ -4,3 +4,5 @@ module.exports = { }, methodology: `TVL on polygon is sum of all collateralTokens (dai only atm) provided to mint nodes`, } + +module.exports.deadFrom = '2023-01-09' \ No newline at end of file diff --git a/projects/dexit-swap/index.js b/projects/dexit-swap/index.js index d67935e32bf..d6eaa139c2e 100644 --- a/projects/dexit-swap/index.js +++ b/projects/dexit-swap/index.js @@ -2,4 +2,6 @@ const { uniTvlExport } = require('../helper/unknownTokens') module.exports = uniTvlExport('dexit', '0xed7e00862c73eF3a53f33d785c62d312Cc8827d2') -module.exports.dexit.tvl = () => ({}) \ No newline at end of file +module.exports.dexit.tvl = () => ({}) + +module.exports.deadFrom = '2023-06-01' \ No newline at end of file diff --git a/projects/eight/index.js b/projects/eight/index.js index 266ac0779f9..5b5677b73ac 100644 --- a/projects/eight/index.js +++ b/projects/eight/index.js @@ -5,6 +5,7 @@ module.exports = { hallmarks: [ [1638748800, "protocol compromised keys"] ], + deadFrom: '2022-11-10', misrepresentedTokens: true, ...ohmTvl(treasury, [ ["0xef977d2f931c1978db5f6747666fa1eacb0d0339", false], diff --git a/projects/elf-finance/index.js b/projects/elf-finance/index.js index 2197152c3b3..f9f8dc0e516 100644 --- a/projects/elf-finance/index.js +++ b/projects/elf-finance/index.js @@ -11,4 +11,5 @@ const usdcLPs = [ module.exports = { ...tombTvl(elfTokenAddress, giftTokenAddress, giftRewardPoolAddress, boardroomAddress, usdcLPs, "fantom", undefined, false, usdcLPs[1]) -} \ No newline at end of file +} +module.exports.deadFrom = '2023-08-09' \ No newline at end of file diff --git a/projects/empyrean/index.js b/projects/empyrean/index.js index 9abb86fc6ce..c675feff74a 100644 --- a/projects/empyrean/index.js +++ b/projects/empyrean/index.js @@ -39,3 +39,6 @@ module.exports = { methodology: "Counts USDC and TLP (EMPYR-USDC) on the treasury", }; + + +module.exports.deadFrom = '2022-05-09' \ No newline at end of file diff --git a/projects/everlend/index.js b/projects/everlend/index.js index e941a1e3710..a31d5821909 100644 --- a/projects/everlend/index.js +++ b/projects/everlend/index.js @@ -7,3 +7,5 @@ module.exports = { [Math.floor(new Date('2023-02-01')/1e3), 'Product is winding down'], ], } + +module.exports.deadFrom = '2023-02-01' \ No newline at end of file diff --git a/projects/eversol.js b/projects/eversol.js index 2ceacc77cb9..92d12bc9159 100644 --- a/projects/eversol.js +++ b/projects/eversol.js @@ -1,17 +1,20 @@ -const {getTokenSupply} = require('./helper/solana') +const { PublicKey } = require('@solana/web3.js'); +const {getConnection, decodeAccount, } = require('./helper/solana') -async function tvl(){ - const supply = await getTokenSupply("Hg35Vd8K3BS2pLB3xwC2WqQV8pmpCm3oNRGYP1PEpmCM"); +const MAINNET_STAKEPOOL_PROGRAM_ID = 'GUAMR8ciiaijraJeLDEDrFVaueLm9YzWWY9R7CBPL9rA'; +async function tvl(){ + const connection = getConnection() + const poolInfoAccount = await connection.getAccountInfo(new PublicKey(MAINNET_STAKEPOOL_PROGRAM_ID)) + const decoded = decodeAccount('ESOLStakePool', poolInfoAccount) return { - 'Eversol-Staked-SOL': supply + 'solana': decoded.totalLamports.toNumber()/1e9 } } module.exports={ timetravel: false, - methodology: "ESOL total supply as it's equal to the SOL staked", solana:{ - tvl - } + tvl + }, } diff --git a/projects/fabric/index.js b/projects/fabric/index.js index 7472b6e13f2..e2359ffd71c 100644 --- a/projects/fabric/index.js +++ b/projects/fabric/index.js @@ -3,6 +3,7 @@ module.exports = { solana: { tvl: () => ({}), }, + deadFrom: "2022-06-19", methodology: "Project is shutdown: https://twitter.com/crypto_notte/status/1545387251143741441/photo/1", }; diff --git a/projects/fegex/index.js b/projects/fegex/index.js index ed6f63ce2f2..172bb6d37a4 100644 --- a/projects/fegex/index.js +++ b/projects/fegex/index.js @@ -13,7 +13,7 @@ module.exports = { staking: staking(stakingContractETH, FEG_ETH) }, bsc: { - staking: staking(stakingContractBSC, FEG_BSC, "bsc"), + staking: staking(stakingContractBSC, FEG_BSC), tvl: async ()=>({}), }, methodology: diff --git a/projects/footballmanager/index.js b/projects/footballmanager/index.js index 95baeb9c8f2..4b015697e44 100644 --- a/projects/footballmanager/index.js +++ b/projects/footballmanager/index.js @@ -12,4 +12,5 @@ module.exports = { arbitrum: { tvl: () => 0 } -} \ No newline at end of file +} +module.exports.deadFrom = '2023-02-09' \ No newline at end of file diff --git a/projects/frfi/index.js b/projects/frfi/index.js index 275930bd8b6..16ebeacb40a 100644 --- a/projects/frfi/index.js +++ b/projects/frfi/index.js @@ -20,3 +20,5 @@ module.exports = { ethereum: { tvl: tvl('1') }, kava: { tvl: tvl('2222') }, }; + +module.exports.deadFrom = '2023-05-09' \ No newline at end of file diff --git a/projects/galaxygoggle/index.js b/projects/galaxygoggle/index.js index 68016dc7c2b..cde55da1d80 100644 --- a/projects/galaxygoggle/index.js +++ b/projects/galaxygoggle/index.js @@ -15,6 +15,7 @@ module.exports = { tvl: () => 0, staking: staking(bscStaking, bscGG, "bsc", `avax:${gg}`) }, + deadFrom: "2022-01-11", methodology: "Counts tokens on the treasury for tvl and staked GG for staking", }; diff --git a/projects/genshiro/index.js b/projects/genshiro/index.js index e940d249d94..e220933f9c7 100644 --- a/projects/genshiro/index.js +++ b/projects/genshiro/index.js @@ -5,5 +5,6 @@ module.exports = { // ...getExports("genshiro", ['genshiro']), genshiro: { tvl: async () => ({}), - } + }, + deadFrom: '2023-05-26', } \ No newline at end of file diff --git a/projects/goblin/index.js b/projects/goblin/index.js index b9d935aeaba..b8bf460cc29 100644 --- a/projects/goblin/index.js +++ b/projects/goblin/index.js @@ -5,4 +5,5 @@ module.exports={ misrepresentedTokens: true, methodology: "Tokens in masterchef", ...masterChefExports("0x0a05f6022D6e051539b190Bff7E484068A7dd0a4", "fantom", GOBLIN) -} \ No newline at end of file +} +module.exports.deadFrom = '2022-05-09' \ No newline at end of file diff --git a/projects/hadesswap/index.js b/projects/hadesswap/index.js index 527578196e4..f4bd19263d4 100644 --- a/projects/hadesswap/index.js +++ b/projects/hadesswap/index.js @@ -4,6 +4,7 @@ module.exports = { hallmarks: [ [Math.floor(new Date('2023-06-01')/1e3), 'Chain is abandoned'], ], + deadFrom: '2023-06-01', polis: { tvl: () => 0 }, diff --git a/projects/helper/utils/solana/layout.js b/projects/helper/utils/solana/layout.js index 8f02e596508..4be8bd8a58e 100644 --- a/projects/helper/utils/solana/layout.js +++ b/projects/helper/utils/solana/layout.js @@ -5,7 +5,7 @@ const { parsePhoenix } = require('./layouts/phoenix-dex') const { RAYDIUM_LIQUIDITY_STATE_LAYOUT_CLMM, RAYDIUM_STABLE_STATE_LAYOUT_V1, } = require('./layouts/raydium-layout') const { INVESTIN_FUND_DATA, } = require('./layouts/investin-layout') const { MARKET_STATE_LAYOUT_V3, } = require('./layouts/openbook-layout') -const { ReserveLayout, ReserveLayoutLarix, MintLayout, AccountLayout, TokenSwapLayout, } = require('./layouts/mixed-layout') +const { ReserveLayout, ReserveLayoutLarix, MintLayout, AccountLayout, TokenSwapLayout, ESOLStakePoolLayout, } = require('./layouts/mixed-layout') const parseReserve = (info) => { const pubkey = PublicKey.default @@ -42,6 +42,7 @@ const customDecoders = { account: defaultParseLayout(AccountLayout), tokenSwap: defaultParseLayout(TokenSwapLayout), larixReserve: defaultParseLayout(ReserveLayoutLarix), + ESOLStakePool: defaultParseLayout(ESOLStakePoolLayout), investinFund: defaultParseLayout(INVESTIN_FUND_DATA), openbook: defaultParseLayout(MARKET_STATE_LAYOUT_V3), // raydiumLPv4: defaultParseLayout(RAYDIUM_LIQUIDITY_STATE_LAYOUT_V4), diff --git a/projects/helper/utils/solana/layouts/layout-base.js b/projects/helper/utils/solana/layouts/layout-base.js index cc1f069786b..0c3126aa77c 100644 --- a/projects/helper/utils/solana/layouts/layout-base.js +++ b/projects/helper/utils/solana/layouts/layout-base.js @@ -89,7 +89,45 @@ const uint128 = (property = "uint128") => { return layout; }; const u128 = uint128 +class OptionLayout extends BufferLayout.Layout { + constructor(layout, property) { + super(-1, property); + this.layout = layout; + this.discriminator = BufferLayout.u8(); + } + encode(src, b, offset = 0) { + if (src === null || src === undefined) { + return this.discriminator.encode(0, b, offset); + } + this.discriminator.encode(1, b, offset); + return this.layout.encode(src, b, offset + 1) + 1; + } + decode(b, offset = 0) { + const discriminator = this.discriminator.decode(b, offset); + if (discriminator === 0) { + return null; + } + else if (discriminator === 1) { + return this.layout.decode(b, offset + 1); + } + throw new Error('Invalid option ' + this.property); + } + getSpan(b, offset = 0) { + const discriminator = this.discriminator.decode(b, offset); + if (discriminator === 0) { + return 1; + } + else if (discriminator === 1) { + return this.layout.getSpan(b, offset + 1) + 1; + } + throw new Error('Invalid option ' + this.property); + } +} + +function option(layout, property) { + return new OptionLayout(layout, property); +} module.exports = { - struct, s32, u8, u16, seq, blob, Layout, bits, u32, publicKey, uint64, u64, uint128, u128, BufferLayout, + struct, s32, u8, u16, seq, blob, Layout, bits, u32, publicKey, uint64, u64, uint128, u128, BufferLayout, option, } \ No newline at end of file diff --git a/projects/helper/utils/solana/layouts/mixed-layout.js b/projects/helper/utils/solana/layouts/mixed-layout.js index 92b0b6f71cd..dda09247208 100644 --- a/projects/helper/utils/solana/layouts/mixed-layout.js +++ b/projects/helper/utils/solana/layouts/mixed-layout.js @@ -1,6 +1,6 @@ const { struct, s32, u8, u16, seq, blob, Layout, bits, u32, publicKey, uint64, u64, uint128, u128, BufferLayout, -} = require('./layout-base') + option, } = require('./layout-base') const LastUpdateLayout = BufferLayout.struct( [uint64("slot"), BufferLayout.u8("stale")], @@ -194,8 +194,49 @@ const TokenSwapLayout = BufferLayout.struct([ publicKey("curveParameters"), ]) +const eSOL_feeFields = [u64('denominator'), u64('numerator')]; +const eSOL_rateOfExchangeFields = [u64('denominator'), u64('numerator')]; + +const ESOLStakePoolLayout = BufferLayout.struct([ + // rustEnum(AccountTypeKind, 'accountType'), + u8('accountType'), + publicKey('manager'), + publicKey('staker'), + publicKey('stakeDepositAuthority'), + u8('stakeWithdrawBumpSeed'), + publicKey('validatorList'), + publicKey('reserveStake'), + publicKey('poolMint'), + publicKey('managerFeeAccount'), + publicKey('tokenProgramId'), + u64('totalLamports'), + u64('poolTokenSupply'), + u64('lastUpdateEpoch'), + struct([u64('unixTimestamp'), u64('epoch'), publicKey('custodian')], 'lockup'), + struct(eSOL_feeFields, 'epochFee'), + option(struct(eSOL_feeFields), 'nextEpochFee'), + option(publicKey(), 'preferredDepositValidatorVoteAddress'), + option(publicKey(), 'preferredWithdrawValidatorVoteAddress'), + struct(eSOL_feeFields, 'stakeDepositFee'), + struct(eSOL_feeFields, 'stakeWithdrawalFee'), + option(struct(eSOL_feeFields), 'nextWithdrawalFee'), + u8('stakeReferralFee'), + option(publicKey(), 'solDepositAuthority'), + struct(eSOL_feeFields, 'solDepositFee'), + u8('solReferralFee'), + option(publicKey(), 'solWithdrawAuthority'), + struct(eSOL_feeFields, 'solWithdrawalFee'), + option(struct(eSOL_feeFields), 'nextSolWithdrawalFee'), + u64('lastEpochPoolTokenSupply'), + u64('lastEpochTotalLamports'), + option(struct(eSOL_rateOfExchangeFields), 'rateOfExchange'), + publicKey('treasuryFeeAccount'), + struct(eSOL_feeFields, 'treasuryFee'), + u64('totalLamportsLiquidity'), + u32("maxValidatorYieldPerEpochNumerator") +]); module.exports = { - ReserveLayout, ReserveLayoutLarix, MintLayout, AccountLayout, TokenSwapLayout, + ReserveLayout, ReserveLayoutLarix, MintLayout, AccountLayout, TokenSwapLayout, ESOLStakePoolLayout, } diff --git a/projects/ink-protocol/index.js b/projects/ink-protocol/index.js index f81a89d0706..7b50bf0ef0c 100644 --- a/projects/ink-protocol/index.js +++ b/projects/ink-protocol/index.js @@ -22,3 +22,5 @@ module.exports = { ] } + +module.exports.deadFrom = '2022-05-26' \ No newline at end of file diff --git a/projects/junoswap/index.js b/projects/junoswap/index.js index f66a1e7d997..aecf7cbd984 100644 --- a/projects/junoswap/index.js +++ b/projects/junoswap/index.js @@ -11,3 +11,5 @@ module.exports = { } } } + +module.exports.deadFrom = '2023-02-03' \ No newline at end of file diff --git a/projects/kafefinance/index.js b/projects/kafefinance/index.js index 8cac57320e7..f441288c341 100644 --- a/projects/kafefinance/index.js +++ b/projects/kafefinance/index.js @@ -8,4 +8,5 @@ module.exports = { moonriver: { tvl: () => ({}), }, + deadFrom: '2022-10-01' } diff --git a/projects/kperp-exchange/index.js b/projects/kperp-exchange/index.js index 676c610d547..bd8d3782d8e 100644 --- a/projects/kperp-exchange/index.js +++ b/projects/kperp-exchange/index.js @@ -6,3 +6,5 @@ module.exports = { [Math.floor(new Date('2023-02-23')/1e3), 'Project decided to wind down.'], ], }; + +module.exports.deadFrom = '2023-04-13' \ No newline at end of file diff --git a/projects/lanternswap/index.js b/projects/lanternswap/index.js index 6b56c319391..b6a5a5859a6 100644 --- a/projects/lanternswap/index.js +++ b/projects/lanternswap/index.js @@ -50,4 +50,5 @@ module.exports = { }, methodology: "Counts as TVL all the Assets deposited on KAVA through different Pool Contracts", -}; \ No newline at end of file +}; +module.exports.deadFrom = '2023-08-09' \ No newline at end of file diff --git a/projects/loterra/index.js b/projects/loterra/index.js index 948783eb17e..2a7bd8e055a 100644 --- a/projects/loterra/index.js +++ b/projects/loterra/index.js @@ -4,6 +4,7 @@ module.exports = { terra: { tvl: () => ({}), }, + deadFrom: '2022-05-26', timetravel: false, hallmarks:[ [1651881600, "UST depeg"], diff --git a/projects/louverture/index.js b/projects/louverture/index.js index eb54a59bbae..5dd69741728 100644 --- a/projects/louverture/index.js +++ b/projects/louverture/index.js @@ -27,3 +27,5 @@ module.exports = { tvl: async()=>({}) } } + +module.exports.deadFrom = '2022-03-29' \ No newline at end of file diff --git a/projects/luxor/api.js b/projects/luxor/api.js index 1a05bc80e7a..decdbf5397e 100644 --- a/projects/luxor/api.js +++ b/projects/luxor/api.js @@ -4,5 +4,6 @@ module.exports = { fantom: { tvl: () => 0, staking: index.fantom.staking, - } + }, + deadFrom: '2023-05-01' } \ No newline at end of file diff --git a/projects/manarium/index.js b/projects/manarium/index.js index 279b6f556fe..e1563cbb720 100644 --- a/projects/manarium/index.js +++ b/projects/manarium/index.js @@ -23,4 +23,5 @@ module.exports = { tvl: () => ({}), staking: tvl } - }; \ No newline at end of file + }; + module.exports.deadFrom = '2023-03-09' \ No newline at end of file diff --git a/projects/mango-markets/index.js b/projects/mango-markets/index.js index 85a45f55eb5..c8b8236df7c 100644 --- a/projects/mango-markets/index.js +++ b/projects/mango-markets/index.js @@ -1,64 +1,9 @@ -const axios = require('axios') - -const endpoint = 'https://mango-transaction-log.herokuapp.com/v3/stats/spot_stats_hourly?mango-group=mainnet.1' - -// Very inefficient -function findClosestToDate(values, date) { - let min = values[0]; - for (const val of values) { - const valDate = new Date(val.time).getTime() - const minDate = new Date(min.time).getTime() - if (Math.abs(valDate - date) < Math.abs(minDate - date)) { - min = val - } - } - if(Math.abs(new Date(min.time).getTime()-date) > 24*3600*1000){ - return { - totalDeposits: 0, - totalBorrows: 0 - } - } - return min -} - -const coingeckoIds = { - 'ETH': 'ethereum', - 'BTC': 'bitcoin', - 'SOL': 'solana', - 'SRM': 'serum', - 'USDC': 'usd-coin', - 'USDT': 'tether', - 'MNGO': 'mango-markets', - 'RAY': 'raydium', - 'COPE': 'cope', - 'FTT': 'ftx-token', - 'MSOL': 'msol', - 'BNB': 'binancecoin', - 'AVAX': 'avalanche-wormhole', - 'LUNA': 'terra-luna', - 'GMT': 'stepn', -} - - -async function tvl(timestamp) { - const balances = {}; - const stats = await axios.get(endpoint) - const date = new Date(timestamp * 1000).getTime() - Object.entries(coingeckoIds).map(([mangoId, coingeckoId]) => { - const assetDeposits = stats.data.filter(s => s.name === mangoId) - if (assetDeposits.length > 0) { - const closestVal = findClosestToDate(assetDeposits, date) - balances[coingeckoId] = closestVal.totalDeposits - closestVal.totalBorrows - } - }) - return balances -} - module.exports = { timetravel: false, solana: { tvl: () => ({}), }, + deadFrom: '2022-10-19', hallmarks:[ [1665521360, "Oracle Price Manipulation"], ], diff --git a/projects/marginswap/index.js b/projects/marginswap/index.js index a576ab3b5a9..c0076dedf44 100644 --- a/projects/marginswap/index.js +++ b/projects/marginswap/index.js @@ -12,3 +12,5 @@ module.exports = { tvl: () => ({}), }, }; + +module.exports.deadFrom = '2023-08-09' \ No newline at end of file diff --git a/projects/merlinlab/index.js b/projects/merlinlab/index.js index 9ffdc4aad74..2f32e98252a 100644 --- a/projects/merlinlab/index.js +++ b/projects/merlinlab/index.js @@ -1,111 +1,6 @@ -const sdk = require("@defillama/sdk"); -const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); - -const stakingABI = require("./staking.json"); -const vaultABI = require("./vault.json"); - -const stakingContract = "0x73feaa1eE314F8c655E354234017bE2193C9E24E"; -const vaults = [ - "0x4E5f611A964806c5fb79Aa0dC8cf945cDFdaa7E2", - "0xBf3aa34aC3F6ea54DD0eC15e5011e0B5A09c17f1", - "0x925697B5E8F9b1277ca9d94769E10C4cBf1676f5", - "0x82089743e90562D001FECCE2EeF465a609829459", - "0x4675D999c1896ADD7D839F090703269b721eD411", - "0x92f8a3780D479DCaaeb85D84B9dB2296B96B8603", - "0x3a8db48D7f995D281D894e819C016E8c356757fE", - "0xDe5bA75b008e93B04Ef1b516f93D1D466e6Dd392", - "0x680A8a7E94d1EcA0cF651b174727ac5DF36E85c8", - "0xA37d23D2192a4A61949e3E8339E6B5453FDB2Ae1", - "0x360DE98FDC44357CED3D0CbD44387160A8f270D4", - "0xB6B4417552145C197B060e1CD617e8f1B016c84a", - "0x5bb11D23c94B13FbA6D22eAbb83bF3fd2458763E", - "0x8AFdA0Df3D9601B32B731f829060BC0C1C95270D", - "0x2090b0477E4852f929018c78ba9DD57e3B551d40", - "0xF02ef3DcD71F1881f7d1F6Fc6D6f95c021d874b1", - "0x414C51d5e837514Ac133cC9C8E14516ddBCc09c1", - "0x7E744494f57511CA6733C83F262b3f674e95F28E", - "0x158522242FD31385F2DdF6762c6d32b337274775", - "0xdc09704Bf547B6639D5911504bC3111Aec8e97Fc", - "0x4fcB41f71E31437419ce3Dee4e9c1092cA9cDE1F", - "0x758C6c9731Ee68aD278f8C2F2f27b84aCB092649", - "0x6c859c5f371DD107c423d4e065bFa09A8De421a9", - "0x3f6919f676d5C7d2A65984dbdf5ae35254be1683", -]; - -const bscTvl = async (timestamp, ethBlock, chainBlocks) => { - const balances = {}; - - const pids = ( - await sdk.api.abi.multiCall({ - abi: vaultABI.pid, - chain: "bsc", - calls: vaults.map((vault) => ({ - target: vault, - })), - block: chainBlocks["bsc"], - }) - ).output.map((pid) => pid.output); - - const stakingTokens = ( - await sdk.api.abi.multiCall({ - abi: vaultABI.stakingToken, - chain: "bsc", - calls: vaults.map((vault) => ({ - target: vault, - })), - block: chainBlocks["bsc"], - }) - ).output.map((stakingToken) => stakingToken.output); - - const userInfos = ( - await sdk.api.abi.multiCall({ - abi: stakingABI.userInfo, - chain: "bsc", - calls: pids.map((pid, idx) => ({ - target: stakingContract, - params: [pid, vaults[idx]], - })), - block: chainBlocks["bsc"], - }) - ).output.map((stakingToken) => stakingToken.output.amount); - - const lpPositions = userInfos.map((amount, idx) => ({ - token: stakingTokens[idx], - balance: amount, - })); - - const transformAdress = i => `bsc:${i}`; - - await unwrapUniswapLPs( - balances, - lpPositions, - chainBlocks["bsc"], - "bsc", - transformAdress - ); - - // --- One side staking asset "CAKE" --- - const infoCAKEVault = ( - await sdk.api.abi.call({ - abi: stakingABI.userInfo, - chain: "bsc", - target: stakingContract, - params: [0, "0xa69AC402a8Afe80C4Db293baF231242242A131Af"], - block: chainBlocks["bsc"], - }) - ).output.amount; - - sdk.util.sumSingleBalance( - balances, - "bsc:0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82", - infoCAKEVault - ); - - return balances; -}; - module.exports = { bsc: { tvl: () => ({}), //Project is dead }, + deadFrom: '2022-03-01' }; diff --git a/projects/metropolis/index.js b/projects/metropolis/index.js index 2abdc189cdc..0e3d1a9a400 100644 --- a/projects/metropolis/index.js +++ b/projects/metropolis/index.js @@ -33,4 +33,5 @@ module.exports = { fantom:{ tvl: () => 0 }, + deadFrom: 1680097334, }; \ No newline at end of file diff --git a/projects/midasdao.js b/projects/midasdao.js index b31982111b3..c402f96e836 100644 --- a/projects/midasdao.js +++ b/projects/midasdao.js @@ -1,54 +1,9 @@ -const ADDRESSES = require('./helper/coreAssets.json') -const { sumTokensAndLPsSharedOwners } = require("./helper/unwrapLPs"); -const sdk = require('@defillama/sdk'); - -const TimeStaking = "0x9619BC1306B94130FBC70CF07e311E69949f07D4"; -const CROWN = "0x39912d83acb4a373321387300f4fbe88aa5d6f14"; - -const JoePair = "0x089a9BF16453b519Fab02e40d143C0dcF9083778"; -const TREASURY = "0x6D9Cfb705C7b7A5ca1C4565A47Fa1b26FC1bE3d0"; -const MIM = "0x130966628846BFd36ff31a822705796e8cb8C18D"; -const WAVAX = ADDRESSES.avax.WAVAX - -const staking = async (timestamp, ethBlock, chainBlocks) => { - const balances = {}; - - const stakingBalance = await sdk.api.abi.call({ - abi: 'erc20:balanceOf', - target: CROWN, - params: TimeStaking, - block: chainBlocks.avax, - chain: 'avax' - }); - - sdk.util.sumSingleBalance(balances, 'avax:'+CROWN, stakingBalance.output); - - return balances; -}; - -async function tvl(timestamp, block, chainBlocks) { - const balances = {}; - - await sumTokensAndLPsSharedOwners( - balances, - [ - [MIM, false], - [WAVAX, false], - [JoePair, true], - ], - [TREASURY], - chainBlocks.avax, - 'avax', - addr=>`avax:${addr}` - ); - - return balances; -} module.exports = { avax:{ - tvl, - staking + tvl: () => ({}), + staking: () => ({}), }, + deadFrom: '2022-08-01', methodology: "Counts tokens on the treasury for tvl and staked CROWN for staking", }; diff --git a/projects/minimax/index.js b/projects/minimax/index.js index f738c9a4886..d441e4cf360 100644 --- a/projects/minimax/index.js +++ b/projects/minimax/index.js @@ -5,3 +5,5 @@ module.exports = { ], fetch: () => 0 } + +module.exports.deadFrom = '2023-01-09' \ No newline at end of file diff --git a/projects/miniversefinance/index.js b/projects/miniversefinance/index.js index 7ad3e0e70de..8d455c1b6dc 100644 --- a/projects/miniversefinance/index.js +++ b/projects/miniversefinance/index.js @@ -13,4 +13,5 @@ const lps = [ //node test.js projects/miniversefinance/index.js module.exports = { ...tombTvl(mvdollar, mshare, rewardPool, masonry, lps, "fantom") -} \ No newline at end of file +} +module.exports.deadFrom = '2023-08-09' \ No newline at end of file diff --git a/projects/mirror/index.js b/projects/mirror/index.js index a527b1cb2cb..fdda4fa2d3f 100644 --- a/projects/mirror/index.js +++ b/projects/mirror/index.js @@ -6,6 +6,7 @@ module.exports = { ], timetravel: false, misrepresentedTokens: true, + deadFrom: '2022-05-26', terra: { tvl: () => ({}), } diff --git a/projects/murica.js b/projects/murica.js index 068e7d62d0e..6d1a1621985 100644 --- a/projects/murica.js +++ b/projects/murica.js @@ -11,4 +11,5 @@ const pool2lps = [ module.exports = { ...tombTvl(bond, share, rewardPool, boardroom, pool2lps, "fantom", undefined, false, pool2lps[1]) -}; \ No newline at end of file +}; +module.exports.deadFrom = '2023-04-09' \ No newline at end of file diff --git a/projects/nexus-protocol/index.js b/projects/nexus-protocol/index.js index e49f4f3a7c2..7b6c10fd2bf 100644 --- a/projects/nexus-protocol/index.js +++ b/projects/nexus-protocol/index.js @@ -6,5 +6,6 @@ module.exports = { }, hallmarks:[ [1651881600, "UST depeg"], - ] + ], + deadFrom: 1651881600, } diff --git a/projects/nft360/index.js b/projects/nft360/index.js index 052fe969ec1..0c2fba61a8a 100644 --- a/projects/nft360/index.js +++ b/projects/nft360/index.js @@ -13,3 +13,5 @@ module.exports = { }) } } + +module.exports.deadFrom = '2023-06-09' \ No newline at end of file diff --git a/projects/ogx/index.js b/projects/ogx/index.js index 1aae6810eff..f56f868fc91 100644 --- a/projects/ogx/index.js +++ b/projects/ogx/index.js @@ -11,4 +11,5 @@ module.exports = { eos: { tvl: eos }, -} \ No newline at end of file +} +module.exports.deadFrom = '2023-05-31' \ No newline at end of file diff --git a/projects/omicron/api.js b/projects/omicron/api.js index 469bda32f63..65097b52e31 100644 --- a/projects/omicron/api.js +++ b/projects/omicron/api.js @@ -4,5 +4,6 @@ module.exports = { arbitrum: { tvl: () => 0, staking: index.arbitrum.staking, - } + }, + deadFrom: '20213-01-30' } \ No newline at end of file diff --git a/projects/ondofinance-v1/index.js b/projects/ondofinance-v1/index.js index 86e7796899f..41c26497b1c 100644 --- a/projects/ondofinance-v1/index.js +++ b/projects/ondofinance-v1/index.js @@ -1,128 +1,9 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const sdk = require("@defillama/sdk"); -const abi = require("./abi.json"); -const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); -const { default: BigNumber } = require("bignumber.js"); -const { getBlock } = require("../helper/http"); - -const NEAR_TOKEN = "0x85f17cf997934a597031b2e18a9ab6ebd4b9f6a4"; -const WETH = ADDRESSES.ethereum.WETH; - -async function addEthBalances(addresses, block, balances) { - await Promise.all( - addresses.map(async (target) => { - const ethBalance = ( - await sdk.api.eth.getBalance({ - target, - block, - }) - ).output; - - sdk.util.sumSingleBalance(balances, WETH, ethBalance); - }) - ); -} -const data = { - ondo_lps: [ - "0x9241943c29eb0B1Fc0f8E5B464fbc14915Da9A57", - "0x5d62134DBD7D56faE9Bc0b7DF3788f5f8DADE62d", - ], - ondo_all_pair_vaults: { - contracts: [ - "0xeF970A111dd6c281C40Eee6c40b43f24435833c2", - "0x2bb8de958134afd7543d4063cafad0b7c6de08bc", - ], - ignored_vault_ids: [ - "25353739650153436290862732054545997422315472318522956085559001114575751243902", - ], - }, - ondo_multisigs: [ - "0xBD9495E42ec4a2F5DF1370A6DA42Ec9a4656E963", - "0xb230B535D2cf009Bdc9D7579782DE160b795d5E8", - "0x7EBa8a9cAcb4bFbf7e1258b402A8e7aA004ED9FD", - "0x5A16e6dD9aB0bEa9a247f92c5aa0b349f2A4E4c6", - ], - supported_tokens: [ - "0x4Eb8b4C65D8430647586cf44af4Bf23dEd2Bb794", - "0x36784d3B5aa8A807698475b3437a13fA20B7E9e1", - ADDRESSES.ethereum.FRAX, - "0x3432B6A60D23Ca0dFCa7761B7ab56459D9C964D0", - "0x956F47F50A910163D8BF957Cf5846D573E7f87CA", - "0x0f2D719407FdBeFF09D87557AbB7232601FD9F29", - "0x3Ec8798B81485A254928B70CDA1cf0A2BB0B74D7", - "0x67B6D479c7bB412C54e03dCA8E1Bc6740ce6b99C", - "0x0cEC1A9154Ff802e7934Fc916Ed7Ca50bDE6844e", - "0x04Fa0d235C4abf4BcF4787aF4CF447DE572eF828", - ADDRESSES.ethereum.CVX, - "0xff20817765cb7f73d4bde2e66e067e58d11095c2", - "0xa3BeD4E1c75D00fa6f4E5E6922DB7261B5E9AcD2", - "0x470ebf5f030ed85fc1ed4c2d36b9dd02e77cf1b7", - "0x758b4684be769e92eefea93f60dda0181ea303ec", - "0xc770eefad204b5180df6a14ee197d99d808ee52d", - "0xc7283b66eb1eb5fb86327f08e1b5816b0720212b", - "0xa693B19d2931d498c5B318dF961919BB4aee87a5", - ADDRESSES.ethereum.WETH, - "0x85f17cf997934a597031b2e18a9ab6ebd4b9f6a4", - ], -}; - -async function tvl(timestamp, block, chainBlocks) { - const balances = {}; - const partner_tokens = data["supported_tokens"]; - let ondo_multisigs = data["ondo_multisigs"]; - block = await getBlock(timestamp, "ethereum", { ethereum: block }); - - if (block > 15258765) ondo_multisigs = []; - - const ondo_lps = data["ondo_lps"]; - - await addEthBalances(ondo_multisigs, block, balances); - - const tokens = [ - ...partner_tokens.map((i) => [i, false]), - ...ondo_lps.map((i) => [i, true]), - ]; - - await sumTokensAndLPsSharedOwners(balances, tokens, ondo_multisigs, block); - - if (balances[NEAR_TOKEN]) { - balances.near = BigNumber(balances[NEAR_TOKEN]) - .dividedBy(10 ** 24) - .toFixed(0); - delete balances[NEAR_TOKEN]; - } - - return balances; -} - -async function tvlForAllPairs(timestamp, block, chainBlocks) { - const ondoAllPairVaults = data["ondo_all_pair_vaults"]["contracts"]; - const ignoredVaultIds = data["ondo_all_pair_vaults"]["ignored_vault_ids"]; - let { output: vaults } = await sdk.api.abi.multiCall({ - calls: ondoAllPairVaults.map((i) => ({ target: i, params: [0, 9999] })), - block, - abi: abi.getVaults, - }); - vaults = vaults.map((i) => i.output).flat(); - const balances = {}; - for (const vault of vaults) { - if ( - !ignoredVaultIds.includes(vault.id) && - timestamp > Number(vault.startAt) && - timestamp < Number(vault.redeemAt) - ) { - vault.assets.forEach((asset) => { - sdk.util.sumSingleBalance(balances, asset.token, asset.deposited); - }); - } - } - return balances; -} module.exports = { methodology: "Counts all tokens in deployed vaults as well as Ondo's LaaS multi-sigs", ethereum: { - tvl: sdk.util.sumChainTvls([tvlForAllPairs, tvl]), + tvl: () => ({}), }, + deadFrom: '2022-08-19', }; diff --git a/projects/optifi/index.js b/projects/optifi/index.js index b203bea5571..1069c4fa78e 100644 --- a/projects/optifi/index.js +++ b/projects/optifi/index.js @@ -67,3 +67,5 @@ module.exports = { [Math.floor(new Date('2022-08-30')/1e3), 'OptiFi mainnet program was closed by mistake'], ], }; + +module.exports.deadFrom = '2022-09-02' diff --git a/projects/optitude/index.js b/projects/optitude/index.js index 67f5ac73255..04ebc5f3ccd 100644 --- a/projects/optitude/index.js +++ b/projects/optitude/index.js @@ -8,4 +8,5 @@ module.exports = yieldHelper({ chain: 'optimism', masterchef: contract, nativeToken: opt, -}) \ No newline at end of file +}) +module.exports.deadFrom = '2023-01-09' \ No newline at end of file diff --git a/projects/phezzan/index.js b/projects/phezzan/index.js index ae2fbc0a55a..eb764bfd1ba 100644 --- a/projects/phezzan/index.js +++ b/projects/phezzan/index.js @@ -42,4 +42,5 @@ module.exports = { hallmarks: [ [Math.floor(new Date('2023-04-23')/1e3), 'Protocol shutdown'], ], + deadFrom: '2023-04-23', }; diff --git a/projects/piggy-finance/index.js b/projects/piggy-finance/index.js index 9596977227a..0533f4eee06 100644 --- a/projects/piggy-finance/index.js +++ b/projects/piggy-finance/index.js @@ -55,3 +55,5 @@ module.exports = { }, }; + +module.exports.deadFrom = '2023-04-09' \ No newline at end of file diff --git a/projects/pizza/index.js b/projects/pizza/index.js index 8d1fd73befe..79b37ad8080 100644 --- a/projects/pizza/index.js +++ b/projects/pizza/index.js @@ -1,16 +1,5 @@ -const utils = require("../helper/utils"); const {lendingMarket} = require("../helper/methodologies") -async function eos() { - const lend = await utils.fetchURL("https://pizza-api-v2.bitzhihu.com/v1/lendv2/overview") - const tvl = lend.data.total_deposit; - return tvl -} - -async function fetch() { - return await eos() -} - module.exports = { methodology: `${lendingMarket}. Pizza TVL is achieved by making a call to its Pizza API V2.`, eos: { @@ -19,4 +8,5 @@ module.exports = { hallmarks: [ [Math.floor(new Date('2023-02-16')/1e3), 'Product is winding down'], ], + deadFrom: '2023-02-16', } diff --git a/projects/pony/index.js b/projects/pony/index.js index 91d16e22074..3cc0755445a 100644 --- a/projects/pony/index.js +++ b/projects/pony/index.js @@ -1,24 +1,9 @@ -const sdk = require("@defillama/sdk"); - -const ponyAddress = "0x0D97Fee619d955509e54B046c9992B6E9F5B0630"; -const tokens = [ponyAddress]; - -async function tvl(timestamp, block) { - const calls = tokens.map((token) => ({ - target: token, - })); - const totalSupplies = await sdk.api.abi.multiCall({ - block, - calls, - abi: "erc20:totalSupply", - }); - const balances = {}; - sdk.util.sumMultiBalanceOf(balances, totalSupplies); - return balances; -} +const { sumTokensExport } = require("../helper/unwrapLPs"); module.exports = { ethereum: { - tvl, + tvl: sumTokensExport({ owner: '0x0D97Fee619d955509e54B046c9992B6E9F5B0630', fetchCoValentTokens: true, tokenConfig: { onlyWhitelisted: false, }}), }, }; + +module.exports.deadFrom = '2023-07-09' \ No newline at end of file diff --git a/projects/projectx/index.js b/projects/projectx/index.js index ed51218a5ca..618353248ed 100644 --- a/projects/projectx/index.js +++ b/projects/projectx/index.js @@ -6,8 +6,10 @@ const WAVAX_PXT2_JPL = "0x326238CfAf10Fc6f536791b548441D03B80dacA8"; module.exports = { avax: { - pool2: pool2(stakingContract, WAVAX_PXT2_JPL, "avax"), + pool2: pool2(stakingContract, WAVAX_PXT2_JPL), tvl: (async) => ({}), }, methodology: "Counts liquidty on the Pool2 only", }; + +module.exports.deadFrom = '2022-04-09' diff --git a/projects/puddingswap/index.js b/projects/puddingswap/index.js index 5c94fcbf233..61428e4a06e 100644 --- a/projects/puddingswap/index.js +++ b/projects/puddingswap/index.js @@ -9,3 +9,5 @@ module.exports = { tvl: () => ({}), } } + +module.exports.deadFrom = '2023-04-09' \ No newline at end of file diff --git a/projects/puli/index.js b/projects/puli/index.js index 54790723102..5e2be912f92 100644 --- a/projects/puli/index.js +++ b/projects/puli/index.js @@ -4,3 +4,5 @@ module.exports = { tvl: () => 0 } } + +module.exports.deadFrom = '2022-05-09' diff --git a/projects/pylon/index.js b/projects/pylon/index.js index 2d76fbdb89a..feba20007d6 100644 --- a/projects/pylon/index.js +++ b/projects/pylon/index.js @@ -4,6 +4,7 @@ module.exports = { terra: { tvl: () => ({}), }, + deadFrom: '2022-05-26', hallmarks:[ [1651881600, "UST depeg"], ] diff --git a/projects/qao/index.js b/projects/qao/index.js index 16b356b5f8d..a60c2ae417a 100644 --- a/projects/qao/index.js +++ b/projects/qao/index.js @@ -23,4 +23,5 @@ ethereum:{ staking: stakingTvl, tvl: () => ({}) }, -} \ No newline at end of file +} +module.exports.deadFrom = '2023-04-09' \ No newline at end of file diff --git a/projects/ringfi/index.js b/projects/ringfi/index.js index 7814d10aed5..9a57a7b084a 100644 --- a/projects/ringfi/index.js +++ b/projects/ringfi/index.js @@ -22,3 +22,6 @@ module.exports = { }, methodology: "We count all RING deposited into wRING contract", }; + + +module.exports.deadFrom = '2023-05-09' \ No newline at end of file diff --git a/projects/safeohm/index.js b/projects/safeohm/index.js index a5eb06e187a..cb57734f5d2 100644 --- a/projects/safeohm/index.js +++ b/projects/safeohm/index.js @@ -5,4 +5,6 @@ const treasury = "0x16d657D5CfD6D7f894BFdB2F5481f8a23bDce269" module.exports = ohmTvl(treasury, [ [ADDRESSES.bsc.WBNB, false], ["0xb2e7793aad96e4e3048e0eb8d091e13a12087a52", true], - ], "bsc", "0x7C340D53252A5b921754A436Ce3211Ac6E0F267D", "0xBDaa094a95e452c6bA175cE9EdfeFBa04e6a51Ac") \ No newline at end of file + ], "bsc", "0x7C340D53252A5b921754A436Ce3211Ac6E0F267D", "0xBDaa094a95e452c6bA175cE9EdfeFBa04e6a51Ac") + +module.exports.deadFrom = '2022-06-01' \ No newline at end of file diff --git a/projects/securedao/index.js b/projects/securedao/index.js index 7d9391d5d8c..39406b06a9c 100644 --- a/projects/securedao/index.js +++ b/projects/securedao/index.js @@ -11,4 +11,6 @@ module.exports = { [ADDRESSES.fantom.MIM, false], // MIM ["0x468c174cc015d4a697586C0a99F95E045F7e6f91", true] // scrMim SPIRIT LP ], "fantom", stakingContract, scr, undefined, undefined, false) -} \ No newline at end of file +} + +module.exports.deadFrom = '2022-02-01' \ No newline at end of file diff --git a/projects/smartpad/index.js b/projects/smartpad/index.js index 64b8b9a66cb..17332a665b6 100644 --- a/projects/smartpad/index.js +++ b/projects/smartpad/index.js @@ -52,3 +52,5 @@ module.exports={ tvl: () => ({}) } } +module.exports.deadFrom = '2022-08-09' + diff --git a/projects/solanax.js b/projects/solanax.js index 59b5fa2a044..01b82ec3b0b 100644 --- a/projects/solanax.js +++ b/projects/solanax.js @@ -18,4 +18,6 @@ module.exports = { tvl: () => ({}), } -}; \ No newline at end of file +}; + +module.exports.deadFrom = '2023-02-09' \ No newline at end of file diff --git a/projects/squid-dao/index.js b/projects/squid-dao/index.js index 51679a4ca5e..84a6a5ec339 100644 --- a/projects/squid-dao/index.js +++ b/projects/squid-dao/index.js @@ -5,4 +5,6 @@ const treasury = "0x61d8a57b3919e9F4777C80b6CF1138962855d2Ca" module.exports = ohmTvl(treasury, [ [ADDRESSES.ethereum.WETH, false], ["0xfad704847967d9067df7a60910399155fca43fe8", true] -], "ethereum", "0x5895b13da9beb11e36136817cdcf3c4fcb16aaea", "0x21ad647b8f4fe333212e735bfc1f36b4941e6ad2") \ No newline at end of file +], "ethereum", "0x5895b13da9beb11e36136817cdcf3c4fcb16aaea", "0x21ad647b8f4fe333212e735bfc1f36b4941e6ad2") + +module.exports.deadFrom = '2022-08-01' \ No newline at end of file diff --git a/projects/starterra.js b/projects/starterra.js index 0195e27a029..f08723a6c90 100644 --- a/projects/starterra.js +++ b/projects/starterra.js @@ -6,5 +6,6 @@ module.exports = { }, hallmarks:[ [1651881600, "UST depeg"], - ] + ], + deadFrom: 1651881600, } diff --git a/projects/steak/index.js b/projects/steak/index.js index 7599ef1d89c..a1dfa79c298 100644 --- a/projects/steak/index.js +++ b/projects/steak/index.js @@ -8,3 +8,6 @@ module.exports = { [1651881600, "UST depeg"], ] }; + + +module.exports.deadFrom = '2022-05-09' \ No newline at end of file diff --git a/projects/strips/index.js b/projects/strips/index.js index 0068a5f02d7..6f9ff760c8b 100644 --- a/projects/strips/index.js +++ b/projects/strips/index.js @@ -39,4 +39,6 @@ module.exports = { pool2 }, methodology: 'Balance of USDC (fees) held by each market as core TVL as well as STRP/USDC SLP held by each market as pool2' -}; \ No newline at end of file +}; + +module.exports.deadFrom = 1658102400 \ No newline at end of file diff --git a/projects/tangent/index.js b/projects/tangent/index.js index caba1759064..0d5447be2ef 100644 --- a/projects/tangent/index.js +++ b/projects/tangent/index.js @@ -8,3 +8,6 @@ module.exports = { timetravel: false, fetch: () => 0 } + + +module.exports.deadFrom = '2023-07-09' \ No newline at end of file diff --git a/projects/terrafloki.js b/projects/terrafloki.js index ff78e182a7f..dd97e44ae82 100644 --- a/projects/terrafloki.js +++ b/projects/terrafloki.js @@ -24,3 +24,6 @@ module.exports = { [1651881600, "UST depeg"], ] }; + + +module.exports.deadFrom = '2022-05-26' \ No newline at end of file diff --git a/projects/tlchain-decryption/index.js b/projects/tlchain-decryption/index.js index 9db2ada9507..322fe58c1f7 100644 --- a/projects/tlchain-decryption/index.js +++ b/projects/tlchain-decryption/index.js @@ -1,4 +1,5 @@ const { uniTvlExport } = require('../helper/unknownTokens') module.exports = uniTvlExport('tlchain', '0x837e7cfe3a85d1419771ebBf975EC78cE9b62f5c') -module.exports.tlchain.tvl = () => ({}) \ No newline at end of file +module.exports.tlchain.tvl = () => ({}) +module.exports.deadFrom = '2023-05-19' \ No newline at end of file diff --git a/projects/totemfi/index.js b/projects/totemfi/index.js index 8243a5925e0..f75e3d6e10a 100644 --- a/projects/totemfi/index.js +++ b/projects/totemfi/index.js @@ -2,5 +2,6 @@ module.exports = { bsc: { tvl: () => ({}), methodology: 'Project is wound down: https://twitter.com/TotemFi/status/1601247760745140224', - } + }, + deadFrom: '2022-12-20' } \ No newline at end of file diff --git a/projects/twtstake/index.js b/projects/twtstake/index.js index f0bfae4ff69..f4402c56137 100644 --- a/projects/twtstake/index.js +++ b/projects/twtstake/index.js @@ -11,6 +11,8 @@ module.exports = { methodology: 'Counts the number of TWT tokens in the TWT Stake contract.', start: 1000235, bsc: { - tvl: staking(TWT_STAKE_CONTRACT,TWT_TOKEN_CONTRACT,"bsc") - } + tvl: () => 0, + staking: staking(TWT_STAKE_CONTRACT,TWT_TOKEN_CONTRACT) + }, + deadFrom: '2023-05-15' }; diff --git a/projects/unusdao/index.js b/projects/unusdao/index.js index 0b0855278cc..3ad561779bf 100644 --- a/projects/unusdao/index.js +++ b/projects/unusdao/index.js @@ -22,3 +22,4 @@ module.exports = { udo ), }; +module.exports.deadFrom = '2022-04-01' \ No newline at end of file diff --git a/projects/valkyrie/index.js b/projects/valkyrie/index.js index b9afd1299ce..cd8c9a973a7 100644 --- a/projects/valkyrie/index.js +++ b/projects/valkyrie/index.js @@ -6,3 +6,5 @@ module.exports = { module.exports.hallmarks = [ [1651881600, "UST depeg"], ] + + module.exports.deadFrom = '2023-04-09' \ No newline at end of file diff --git a/projects/velaro/index.js b/projects/velaro/index.js index 9c9bc2b6a7d..7c24d809765 100644 --- a/projects/velaro/index.js +++ b/projects/velaro/index.js @@ -21,3 +21,5 @@ module.exports = { }) } } + +module.exports.deadFrom = '2023-02-10' \ No newline at end of file diff --git a/projects/vikings/index.js b/projects/vikings/index.js index 00da7ca1e18..4351068c79a 100644 --- a/projects/vikings/index.js +++ b/projects/vikings/index.js @@ -5,3 +5,5 @@ module.exports = ohmTvl(treasuryAddress, [ ["0x130966628846bfd36ff31a822705796e8cb8c18d", false], ["0x1E2D68196AcF7EB9e345c531e476E726D60a5C4b", true], ], "avax", "0x743DE042c7be8C415effa75b960A2A7bB5fc0704", "0xe0474c15bc7f8213ee5bfb42f9e68b2d6be2e136") + +module.exports.deadFrom = '2022-06-30' \ No newline at end of file diff --git a/projects/wault.js b/projects/wault.js index b231c59703e..c71b784e7ab 100644 --- a/projects/wault.js +++ b/projects/wault.js @@ -6,4 +6,5 @@ module.exports = { polygon: { tvl: () => 0 }, + deadFrom: '2022-08-19', } diff --git a/projects/whaleloans/index.js b/projects/whaleloans/index.js index 4812fe0571e..fb2dd165dec 100644 --- a/projects/whaleloans/index.js +++ b/projects/whaleloans/index.js @@ -4,4 +4,5 @@ module.exports = { tvl: () => ({}), staking: () => ({}), } -} \ No newline at end of file +} +module.exports.deadFrom = '2022-07-09' \ No newline at end of file diff --git a/projects/wisteriaswap/index.js b/projects/wisteriaswap/index.js index 02def6003f6..93c774b66b8 100644 --- a/projects/wisteriaswap/index.js +++ b/projects/wisteriaswap/index.js @@ -5,4 +5,5 @@ const masterchef = "0x5865C60C05C28C597b3CEB6a84809251101E5204"; module.exports = { ...masterChefExports(masterchef, "bsc", wst), -}; \ No newline at end of file +}; +module.exports.deadFrom = '2023-02-13' \ No newline at end of file diff --git a/projects/witswap/index.js b/projects/witswap/index.js index 4190acfc322..088941a646b 100644 --- a/projects/witswap/index.js +++ b/projects/witswap/index.js @@ -1,19 +1,7 @@ -const sdk = require('@defillama/sdk') - -const ewit = "0x56ee175fe37cd461486ce3c3166e0cafccd9843f" - -async function tvl(_timestamp, ethBlock){ - const supply = await sdk.api.erc20.totalSupply({ - target: ewit, - block: ethBlock - }) - return { - [ewit]: supply.output - } -} module.exports = { ethereum:{ tvl: () => ({}), //Project is dead }, + deadFrom: '2023-03-19', } diff --git a/projects/wrapped-ilcoin/index.js b/projects/wrapped-ilcoin/index.js index d47315cd821..b3f7ba88303 100644 --- a/projects/wrapped-ilcoin/index.js +++ b/projects/wrapped-ilcoin/index.js @@ -17,3 +17,5 @@ module.exports = { tvl }, } + +module.exports.deadFrom = '2022-05-09' diff --git a/projects/xWeowns/index.js b/projects/xWeowns/index.js index a1a4736db23..fe07eb3c846 100644 --- a/projects/xWeowns/index.js +++ b/projects/xWeowns/index.js @@ -24,4 +24,5 @@ module.exports = { lachain: { tvl: () => 0, } -}; \ No newline at end of file +}; +module.exports.deadFrom = '2023-06-09' \ No newline at end of file diff --git a/projects/xensa/index.js b/projects/xensa/index.js index 177f675e992..85cd426457e 100644 --- a/projects/xensa/index.js +++ b/projects/xensa/index.js @@ -18,4 +18,5 @@ module.exports = { okexchain:{ tvl: () => 0 }, + deadFrom: '2022-05-05' }; diff --git a/projects/yieldly/index.js b/projects/yieldly/index.js index 82a8b77cd66..1ce5a3a1525 100644 --- a/projects/yieldly/index.js +++ b/projects/yieldly/index.js @@ -1,52 +1,3 @@ -const { toUSDTBalances } = require("../helper/balances") -const { get } = require('../helper/http') - -async function getPools() { - return get('https://app.yieldly.finance/staking/pools') -} - -async function getTVL(pool) { - return (await get('https://app.yieldly.finance/staking/pools/v3/'+ pool.Id)).tvlUSD -} - -function isLiquidityPool(pool) { - return pool.Type === 'LIQUIDITY' && pool.StakingToken.TokenTicker.includes('YLDY') -} - -function isStakingPool(pool) { - return pool.StakingToken.TokenTicker === 'YLDY' -} - -async function tvl() { - const pools = (await getPools()).filter(pool => !isStakingPool(pool) && !isLiquidityPool(pool)) - let total = 0 - for (const pool of pools) { - const tvlUSD= await getTVL(pool) - if (!isNaN(+tvlUSD)) total += tvlUSD - } - return toUSDTBalances(total) -} - -async function staking() { - const pools = (await getPools()).filter(pool => isStakingPool(pool)) - let total = 0 - for (const pool of pools) { - const tvlUSD= await getTVL(pool) - if (!isNaN(+tvlUSD)) total += tvlUSD - } - return toUSDTBalances(total) -} - -async function pool2() { - const pools = (await getPools()).filter(pool => isLiquidityPool(pool)) - let total = 0 - for (const pool of pools) { - const tvlUSD= await getTVL(pool) - if (!isNaN(+tvlUSD)) total += tvlUSD - } - return toUSDTBalances(total) -} - module.exports = { timetravel: false, algorand: { @@ -55,4 +6,5 @@ module.exports = { hallmarks: [ [Math.floor(new Date('2023-08-02')/1e3), 'Project pivoted to be being a NFT marketplace.'], ], + deadFrom: '2023-08-02', }; diff --git a/projects/yogi/index.js b/projects/yogi/index.js index 42e4bd530b5..65d3f7d8982 100644 --- a/projects/yogi/index.js +++ b/projects/yogi/index.js @@ -3,6 +3,7 @@ module.exports = { hallmarks: [ [Math.floor(new Date('2022-10-06')/1e3), 'Project abandoned. Website down, twitter down'], ], + deadFrom: '2022-10-06', misrepresentedTokens: true, bsc: { tvl: () => ({}), diff --git a/projects/ysmart/index.js b/projects/ysmart/index.js index e7b5ff08e8f..8f47982c4a1 100644 --- a/projects/ysmart/index.js +++ b/projects/ysmart/index.js @@ -13,3 +13,5 @@ module.exports = { }) } } + +module.exports.deadFrom = '2023-04-22' \ No newline at end of file diff --git a/projects/zai.js b/projects/zai.js index b2651dba07f..562d7cb1a15 100644 --- a/projects/zai.js +++ b/projects/zai.js @@ -7,5 +7,6 @@ module.exports = { tvl: () => 0, pool2: staking('0x326E906A28Cd7fF56cCe6A84a8043786B8762cDf', zaiLP), staking: staking('0xE2612091Ec3dBE6f40BbfD0f30e3b8E4eA896e53', zaiV2), - } + }, + deadFrom: '2022-11-11', }; \ No newline at end of file From 456c50766059172e094975177cf59582e62f6e62 Mon Sep 17 00:00:00 2001 From: define Date: Thu, 31 Aug 2023 11:02:12 +0100 Subject: [PATCH 1052/1974] add new vaults --- projects/lybra-v2/index.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/projects/lybra-v2/index.js b/projects/lybra-v2/index.js index a51352990e1..1aefc7066d4 100644 --- a/projects/lybra-v2/index.js +++ b/projects/lybra-v2/index.js @@ -1,12 +1,15 @@ const ADDRESSES = require('../helper/coreAssets.json') const { sumTokensExport } = require("../helper/unwrapLPs"); -// Lybra holds total stake collateral (deposited ETH) -const LYBRA_CONTRACT = "0xed1167b6Dc64E8a366DB86F2E952A482D0981ebd"; +// VAULTS +const stETHvault = "0xa980d4c0C2E48d305b582AA439a3575e3de06f0E"; +const wstETHvault = "0x5e28B5858DA2C6fb4E449D69EEb5B82e271c45Ce"; +const wbETHvault = "0xB72dA4A9866B0993b9a7d842E5060716F74BF262"; +const rETHvault = "0x090B2787D6798000710a8e821EC6111d254bb958" module.exports = { start: 17990519, ethereum: { - tvl: sumTokensExport({ owner: LYBRA_CONTRACT, tokens: [ADDRESSES.ethereum.STETH, ADDRESSES.ethereum.sfrxETH]}), + tvl: sumTokensExport({ owners: [stETHvault, wstETHvault, wbETHvault, rETHvault], tokens: [ADDRESSES.ethereum.STETH, "0x7f39c581f595b53c5cb19bd0b3f8da6c935e2ca0", "0xa2e3356610840701bdf5611a53974510ae27e2e1", "0xae78736cd615f374d3085123a210448e74fc6393"]}), } }; From 5376e6055e790b9226a67f5a5692e33c38973dc0 Mon Sep 17 00:00:00 2001 From: define Date: Thu, 31 Aug 2023 11:06:14 +0100 Subject: [PATCH 1053/1974] change start time lybra v2 --- projects/lybra-v2/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/lybra-v2/index.js b/projects/lybra-v2/index.js index 1aefc7066d4..158d19b37ba 100644 --- a/projects/lybra-v2/index.js +++ b/projects/lybra-v2/index.js @@ -8,7 +8,7 @@ const wbETHvault = "0xB72dA4A9866B0993b9a7d842E5060716F74BF262"; const rETHvault = "0x090B2787D6798000710a8e821EC6111d254bb958" module.exports = { - start: 17990519, + start: 17990141, ethereum: { tvl: sumTokensExport({ owners: [stETHvault, wstETHvault, wbETHvault, rETHvault], tokens: [ADDRESSES.ethereum.STETH, "0x7f39c581f595b53c5cb19bd0b3f8da6c935e2ca0", "0xa2e3356610840701bdf5611a53974510ae27e2e1", "0xae78736cd615f374d3085123a210448e74fc6393"]}), } From eca0a8ddbd390d16b650f12ed65659f2a3e018be Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 31 Aug 2023 12:46:06 +0200 Subject: [PATCH 1054/1974] minor fix --- projects/lybra-v2/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/lybra-v2/index.js b/projects/lybra-v2/index.js index 158d19b37ba..711e2981915 100644 --- a/projects/lybra-v2/index.js +++ b/projects/lybra-v2/index.js @@ -10,6 +10,6 @@ const rETHvault = "0x090B2787D6798000710a8e821EC6111d254bb958" module.exports = { start: 17990141, ethereum: { - tvl: sumTokensExport({ owners: [stETHvault, wstETHvault, wbETHvault, rETHvault], tokens: [ADDRESSES.ethereum.STETH, "0x7f39c581f595b53c5cb19bd0b3f8da6c935e2ca0", "0xa2e3356610840701bdf5611a53974510ae27e2e1", "0xae78736cd615f374d3085123a210448e74fc6393"]}), + tvl: sumTokensExport({ tokensAndOwners2: [[ADDRESSES.ethereum.STETH, "0x7f39c581f595b53c5cb19bd0b3f8da6c935e2ca0", "0xa2e3356610840701bdf5611a53974510ae27e2e1", "0xae78736cd615f374d3085123a210448e74fc6393"], [stETHvault, wstETHvault, wbETHvault, rETHvault]] }), } }; From 3f0a41eb3c775914fd10b897702c2366984a4ea0 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 31 Aug 2023 13:21:31 +0200 Subject: [PATCH 1055/1974] update aevo --- projects/aevo-xyz/index.js | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/projects/aevo-xyz/index.js b/projects/aevo-xyz/index.js index 8686b554a1b..1ab31bd73cc 100644 --- a/projects/aevo-xyz/index.js +++ b/projects/aevo-xyz/index.js @@ -3,14 +3,18 @@ const { sumTokensExport } = require("../helper/unwrapLPs"); module.exports = { ethereum: { - tvl: sumTokensExport({ owner: '0x4082C9647c098a6493fb499EaE63b5ce3259c574', tokens: [ - ADDRESSES.null, - ADDRESSES.ethereum.USDC, - ADDRESSES.ethereum.USDT, - ADDRESSES.ethereum.WBTC, - ADDRESSES.ethereum.DAI, - ADDRESSES.ethereum.WETH, - ADDRESSES.ethereum.STETH, - ]}) - } + tvl: sumTokensExport({ + owner: '0x4082C9647c098a6493fb499EaE63b5ce3259c574', tokens: [ + ADDRESSES.null, + ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.USDT, + ADDRESSES.ethereum.WBTC, + ADDRESSES.ethereum.DAI, + ADDRESSES.ethereum.WETH, + ADDRESSES.ethereum.STETH, + ] + }) + }, + arbitrum: { tvl: sumTokensExport({ owner: '0x80d40e32fad8be8da5c6a42b8af1e181984d137c', fetchCoValentTokens: true, }) }, + optimism: { tvl: sumTokensExport({ owner: '0xfff4a34925301d231ddf42b871c3b199c1e80584', fetchCoValentTokens: true, }) }, } \ No newline at end of file From 3dcf9bb1ff5d062bf9dcf34a5cbdfde01e0d5f6f Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 31 Aug 2023 13:28:02 +0200 Subject: [PATCH 1056/1974] fix raydium --- projects/helper/solana.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/helper/solana.js b/projects/helper/solana.js index c4452713c2f..1dc099951af 100644 --- a/projects/helper/solana.js +++ b/projects/helper/solana.js @@ -20,6 +20,7 @@ const blacklistedTokens_default = [ '2HeykdKjzHKGm2LKHw8pDYwjKPiFEoXAz74dirhUgQvq', // SAO 'EP2aYBDD4WvdhnwWLUMyqU69g1ePtEjgYK6qyEAFCHTx', //KRILL 'C5xtJBKm24WTt3JiXrvguv7vHCe7CknDB7PNabp4eYX6', //TINY + '5fTwKZP2AK39LtFN9Ayppu6hdCVKfMGVm79F2EgHCtsi', //WHEY ] let connection, provider From 54064058007133dcb07b80d6af7d0d11117c055b Mon Sep 17 00:00:00 2001 From: "Andromeda ve(3,3)" <143361735+andromedafi@users.noreply.github.com> Date: Thu, 31 Aug 2023 15:22:35 +0300 Subject: [PATCH 1057/1974] Added andromeada uni factory (#7337) * Added andromeada uni factory * code refactor --------- Co-authored-by: Andromeada Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/andromeada/index.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 projects/andromeada/index.js diff --git a/projects/andromeada/index.js b/projects/andromeada/index.js new file mode 100644 index 00000000000..c8aed831a75 --- /dev/null +++ b/projects/andromeada/index.js @@ -0,0 +1,14 @@ +const { uniTvlExport } = require("../helper/calculateUniTvl.js"); + +module.exports = { + misrepresentedTokens: true, + base: { + tvl: uniTvlExport( + "0xB9e611CaD79f350929C8E36cAbbe5D2Ce9502D51", + "base", + undefined, + undefined, + { useDefaultCoreAssets: true, hasStablePools: true, fetchBalances: true, } + ), + }, +}; From 37de55d3c8e911db55309279705d026551ad24da Mon Sep 17 00:00:00 2001 From: xiaodong <81516175+javaandfly@users.noreply.github.com> Date: Thu, 31 Aug 2023 20:22:47 +0800 Subject: [PATCH 1058/1974] add navi weth coin (#7338) Co-authored-by: xiaodong --- projects/navi/index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/projects/navi/index.js b/projects/navi/index.js index 229fba18c35..31713f4f4d9 100644 --- a/projects/navi/index.js +++ b/projects/navi/index.js @@ -5,11 +5,13 @@ const reserves = [ "0xab644b5fd11aa11e930d1c7bc903ef609a9feaf9ffe1b23532ad8441854fbfaf", // Reserve For SUI "0xeb3903f7748ace73429bd52a70fff278aac1725d3b58afa781f25ce3450ac203", // Reserve For USDC "0xb8c5eab02a0202f638958cc79a69a2d30055565caad1684b3c8bbca3bddcb322", // Reserve For USDT + "0xafecf4b57899d377cc8c9de75854c68925d9f512d0c47150ca52a0d3a442b735" // Reserve For WETH ] const decimalShift = { [ADDRESSES.sui.USDC]: -3, // USDC [ADDRESSES.sui.USDT]: -3, // USDT + [ADDRESSES.sui.WETH]: -1 // WETH } From b8009b6d769a2864093d0e4611878921cda8b589 Mon Sep 17 00:00:00 2001 From: fayrume <141622855+fayrume@users.noreply.github.com> Date: Thu, 31 Aug 2023 16:22:58 +0400 Subject: [PATCH 1059/1974] [stable-base]: adding stable base support (#7329) * [stable-base]: adding stable base support * code refactor --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/stablebase.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 projects/stablebase.js diff --git a/projects/stablebase.js b/projects/stablebase.js new file mode 100644 index 00000000000..d27a89f69f9 --- /dev/null +++ b/projects/stablebase.js @@ -0,0 +1,23 @@ +const { staking } = require('./helper/staking') + +const stableABI = { + getTokens: "address[]:getTokens", + getLpToken: "address:getLpToken", +} + +const registryABI = { + poolAddresses: "address[]:poolAddresses", +} + +async function stablePoolTVL(_, block, _cb, { api }) { + const pools= await api.call({ abi: registryABI.poolAddresses, target: '0x9595037e6d4a37e0659e66937ee6f7f88f4b0446'}) + const tokens = await api.multiCall({ abi: stableABI.getTokens, calls: pools,}) + return api.sumTokens({ ownerTokens: pools.map((v, i) => [tokens[i], v])}) +} + +module.exports = { + base: { + tvl: stablePoolTVL, + staking: staking('0xDB4ad0C533AeB2faC1B10fa60207BE039084C33F', '0x616F5b97C22Fa42C3cA7376F7a25F0d0F598b7Bb') + } +} \ No newline at end of file From 24038e7c77b227e5730085ec58598b5911446759 Mon Sep 17 00:00:00 2001 From: matthieuzola <143651482+matthieuzola@users.noreply.github.com> Date: Thu, 31 Aug 2023 19:23:29 +0700 Subject: [PATCH 1060/1974] Update TVL For ShibFi (#7334) * Update TVL For ShibFi * code refactor --------- Co-authored-by: matthieuzola Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/shibfi/index.js | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 projects/shibfi/index.js diff --git a/projects/shibfi/index.js b/projects/shibfi/index.js new file mode 100644 index 00000000000..ce0dcfb2063 --- /dev/null +++ b/projects/shibfi/index.js @@ -0,0 +1,10 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require("../helper/unwrapLPs"); + +const native_staking_contract = "0xF04d9E9CE754c9dA855Fd6A2b84efA9d4cD293F5"; + +module.exports = { + shibarium: { + tvl: sumTokensExport({ owner: native_staking_contract, tokens: [ADDRESSES.null] }), + }, +}; From c1ea4f6bdfc004b8c9d1c701f087d1d601cb6afe Mon Sep 17 00:00:00 2001 From: bryansniyve <134277602+bryansniyve@users.noreply.github.com> Date: Thu, 31 Aug 2023 20:25:10 +0800 Subject: [PATCH 1061/1974] feat: add v2 arbitrum tvl (#7339) Co-authored-by: bryan.y --- projects/apollox/index.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/projects/apollox/index.js b/projects/apollox/index.js index 158e5a0d414..21a8c113b36 100644 --- a/projects/apollox/index.js +++ b/projects/apollox/index.js @@ -50,9 +50,10 @@ const ALPTokens = [ TOKEN_BTC, TOKEN_BNB, TOKEN_HAY, + TOKEN_CAKE, ] -async function tvl(timestamp, _block, { bsc: block }) { +async function bscTVL(timestamp, _block, { bsc: block }) { const toa = [ ...TreasureTokens.map((t) => [t, treasureContract]), ...ALPTokens.map((t) => [t, ALPContract]), @@ -63,7 +64,7 @@ async function tvl(timestamp, _block, { bsc: block }) { module.exports = { start: 1640100600, // 12/21/2021 @ 15:30pm (UTC) bsc: { - tvl, + tvl: bscTVL, staking: stakings([stakingContract_APX, daoContract], TOKEN_APX, "bsc"), pool2: pool2s([stakingContract, stakingContractV2], [poolContract, poolContractV2], "bsc"), }, @@ -77,10 +78,17 @@ module.exports = { ]}) }, arbitrum: { - tvl: sumTokensExport({ owner: '0xbad4ccc91ef0dfffbcab1402c519601fbaf244ef', tokens: [ + tvl: sumTokensExport({ owners: + [ + '0xbad4ccc91ef0dfffbcab1402c519601fbaf244ef', + '0xb3879e95a4b8e3ee570c232b19d520821f540e48' + ], tokens: [ nullAddress, ADDRESSES.arbitrum.USDC, ADDRESSES.arbitrum.USDT, + ADDRESSES.arbitrum.DAI, + ADDRESSES.arbitrum.WBTC, + ADDRESSES.arbitrum.WETH, ]}) }, era: { From ae74c9739d7f336f0f2b5e2297eda6178e57ad11 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 31 Aug 2023 15:15:29 +0200 Subject: [PATCH 1062/1974] track prisma.fi --- projects/prisma/index.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 projects/prisma/index.js diff --git a/projects/prisma/index.js b/projects/prisma/index.js new file mode 100644 index 00000000000..20ffedf8dee --- /dev/null +++ b/projects/prisma/index.js @@ -0,0 +1,22 @@ +const { getLogs } = require('../helper/cache/getLogs') + +const config = { + ethereum: { factory: '0x70b66e20766b775b2e9ce5b718bbd285af59b7e1', fromBlock: 18029801, }, +} + +Object.keys(config).forEach(chain => { + const { factory, fromBlock, } = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + + const logs = await getLogs({ + api, + target: factory, + eventAbi: 'event NewDeployment (address collateral, address priceFeed, address troveManager, address sortedTroves)', + onlyArgs: true, + fromBlock, + }) + return api.sumTokens({ tokensAndOwners: logs.map(log => [log.collateral, log.troveManager])}) + } + } +}) From 20cd831ca50958959a297ce615eb7b7848088711 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 31 Aug 2023 16:52:57 +0200 Subject: [PATCH 1063/1974] fix broken adapters --- projects/adaxPro/index.js | 3 ++- projects/helper/tokenMapping.js | 9 ++++++++- projects/secretswap.js | 22 ++++++++++++++++++---- projects/stride/index.js | 1 + projects/treasury/aura.js | 2 +- 5 files changed, 30 insertions(+), 7 deletions(-) diff --git a/projects/adaxPro/index.js b/projects/adaxPro/index.js index b2c888e090d..2c88f222885 100644 --- a/projects/adaxPro/index.js +++ b/projects/adaxPro/index.js @@ -9,5 +9,6 @@ async function fetch(){ module.exports={ methodology: "Data is retrieved from the api at https://amm-api.adax.pro/", timetravel: false, // but there's historical data, this can be changed! - fetch + fetch, + deadFrom: "2023-08-29", } \ No newline at end of file diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index ed2849af58c..e04a9300998 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -16,7 +16,7 @@ coreAssets = JSON.parse(JSON.stringify(coreAssets)) // carbon: https://api-insights.carbon.network/info/denom_gecko_map // orbit brige: https://bridge.orbitchain.io/open/v1/api/monitor/rawTokenList -const ibcChains = ['ibc', 'terra', 'terra2', 'crescent', 'osmosis', 'kujira', 'stargaze', 'juno', 'injective', 'cosmos', 'comdex', 'umee', 'orai', 'persistence', 'fxcore', 'neutron', 'quasar', 'chihuahua', 'sei', 'archway', 'migaloo', ] +const ibcChains = ['ibc', 'terra', 'terra2', 'crescent', 'osmosis', 'kujira', 'stargaze', 'juno', 'injective', 'cosmos', 'comdex', 'umee', 'orai', 'persistence', 'fxcore', 'neutron', 'quasar', 'chihuahua', 'sei', 'archway', 'migaloo', 'secret', ] const caseSensitiveChains = [...ibcChains, 'solana', 'tezos', 'ton', 'algorand', 'aptos', 'near', 'bitcoin', 'waves', 'tron', 'litecoin', 'polkadot', 'ripple', 'elrond', 'cardano', 'stacks', 'sui', 'ergo', 'mvc',] const distressedAssts = new Set(Object.values({ @@ -69,6 +69,13 @@ const fixBalancesTokens = { mvc: { [ADDRESSES.mvc.SPACE]: { coingeckoId: "microvisionchain", decimals: 8 }, }, + secret: { + 'secret1k0jntykt7e4g3y88ltc60czgjuqdy4c9e8fzek': { coingeckoId: 'secret', decimals: 6 }, + 'secret14mzwd0ps5q277l20ly2q3aetqe3ev4m4260gf4': { coingeckoId: 'cosmos', decimals: 6 }, + 'secret1vnjck36ld45apf8u4fedxd5zy7f5l92y3w5qwq': { coingeckoId: 'dai', decimals: 18 }, + 'secret1h6z05y90gwm4sqxzhz4pkyp36cna9xtp7q0urv': { coingeckoId: 'usd-coin', decimals: 6 }, + 'secret18wpjn83dayu4meu6wnn29khfkwdxs7kyrz9c8f': { coingeckoId: 'tether', decimals: 6 }, + } } ibcChains.forEach(chain => fixBalancesTokens[chain] = { ...ibcMappings, ...(fixBalancesTokens[chain] || {}) }) diff --git a/projects/secretswap.js b/projects/secretswap.js index e670c160927..d310549c445 100644 --- a/projects/secretswap.js +++ b/projects/secretswap.js @@ -1,14 +1,28 @@ const { get } = require('./helper/http') +const { transformDexBalances } = require('./helper/portedTokens') -async function fetch() { - var response = await get('https://api.secretanalytics.xyz/secretswap/tvl') +async function tvl() { + var { pools } = await get('https://api-bridge-mainnet.azurewebsites.net/secretswap_pools/?page=0&size=1000') + pools.filter(i => +i.total_share > 0).map(i => i.address) + return transformDexBalances({ + chain: 'secret', + data: pools.filter(i => +i.total_share > 0).map(i => { + return { + token0: i.assets[0].info.token?.contract_addr ?? i.assets[0].info.native_token?.denom ?? i.assets[0].info.native_token?.base_denom, + token0Bal: i.assets[0].amount, + token1: i.assets[1].info.token?.contract_addr ?? i.assets[1].info.native_token?.denom ?? i.assets[1].info.native_token?.base_denom, + token1Bal: i.assets[1].amount, + } + }), + }) + return {} return response; } module.exports = { + misrepresentedTokens: true, secret: { - fetch + tvl }, - fetch } \ No newline at end of file diff --git a/projects/stride/index.js b/projects/stride/index.js index ad75c2740e5..71b0eff2ca1 100644 --- a/projects/stride/index.js +++ b/projects/stride/index.js @@ -11,6 +11,7 @@ const coinGeckoIds = { inj: "injective-protocol", uumee: "umee", ucmdx: "comdex", + usomm: "sommelier", }; function getCoinDenom(denom) { diff --git a/projects/treasury/aura.js b/projects/treasury/aura.js index 906185f16f8..65b9f18916d 100644 --- a/projects/treasury/aura.js +++ b/projects/treasury/aura.js @@ -5,7 +5,7 @@ const treasury = "0xfc78f8e1Af80A3bF5A1783BB59eD2d1b10f78cA9"; module.exports = treasuryExports({ ethereum: { - owner: [treasury], + owner: treasury, ownTokens: [ "0xC0c293ce456fF0ED870ADd98a0828Dd4d2903DBF", // AURA "0xc29562b045D80fD77c69Bec09541F5c16fe20d9d", // B-80AURA-20WETH From 6c3083c1292f47ced97f98409bc599dab4a7d68d Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 31 Aug 2023 17:16:52 +0200 Subject: [PATCH 1064/1974] curve: track base --- projects/curve/abi.json | 6 ++++-- projects/curve/contracts.json | 11 +++++++++++ projects/curve/index.js | 6 +++--- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/projects/curve/abi.json b/projects/curve/abi.json index acdf49cea85..e958e7023ac 100644 --- a/projects/curve/abi.json +++ b/projects/curve/abi.json @@ -7,12 +7,14 @@ "stableswap": "function get_n_coins(address _pool) view returns (uint256[2]) @1521", "stableFactory": "function get_n_coins(address _pool) view returns (uint256) @2699", "crypto": "function get_n_coins(address _pool) view returns (uint256) @2834", - "cryptoFactory": "function get_n_coins(address _pool) view returns (uint256) @2834" + "cryptoFactory": "function get_n_coins(address _pool) view returns (uint256) @2834", + "triCryptoFactory": "function get_coins(address _pool) view returns (address[3])" }, "get_coins": { "stableswap": "function get_coins(address _pool) view returns (address[8]) @12102", "stableFactory": "function get_coins(address _pool) view returns (address[4]) @9164", "crypto": "function get_coins(address _pool) view returns (address[8]) @22975", - "cryptoFactory": "function get_coins(address _pool) view returns (address[2])" + "cryptoFactory": "function get_coins(address _pool) view returns (address[2])", + "triCryptoFactory": "function get_coins(address _pool) view returns (address[3])" } } \ No newline at end of file diff --git a/projects/curve/contracts.json b/projects/curve/contracts.json index cd9d8028f1d..3af464c9a78 100644 --- a/projects/curve/contracts.json +++ b/projects/curve/contracts.json @@ -108,6 +108,17 @@ "stableFactory": "0x5277a0226d10392295e8d383e9724d6e416d6e6c" } }, + "base": { + "wrapped": "0x4200000000000000000000000000000000000006", + "registriesMapping": { + "triCryptoFactory": "0xa5961898870943c68037f6848d2d866ed2016bcb", + "stableFactory": "0x3093f9B57A428F3EB6285a589cb35bEA6e78c336", + "cryptoFactory": "0x5EF72230578b3e399E6C6F4F6360edF95e83BBfd" + }, + "blacklist": [ + "0x417Ac0e078398C154EdFadD9Ef675d30Be60Af93" + ] + }, "optimism": { "addressProvider": "0x0000000022D53366457F9d5E68Ec105046FC4383", "gasTokenDummy": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", diff --git a/projects/curve/index.js b/projects/curve/index.js index ac61aed4614..0020a593fb3 100644 --- a/projects/curve/index.js +++ b/projects/curve/index.js @@ -21,7 +21,8 @@ const chains = [ "xdai", //G "moonbeam", "celo", - "kava" + "kava", + "base" ]; // Object.keys(contracts); const registryIds = { stableswap: 0, @@ -152,7 +153,7 @@ async function unwrapPools({ poolList, registry, chain, block }) { const callParams = { target: registryAddress, calls: poolList.map(i => ({ params: i.output })), chain, block, } const { output: coins } = await sdk.api.abi.multiCall({ ...callParams, abi: abi.get_coins[registry] }) let nCoins = {} - if (registry !== 'cryptoFactory') + if (!['cryptoFactory', 'triCryptoFactory'].includes(registry) ) nCoins = (await sdk.api.abi.multiCall({ ...callParams, abi: abi.get_n_coins[registry] })).output let { wrapped = '', metapoolBases = {}, blacklist = [] } = contracts[chain] @@ -236,7 +237,6 @@ const chainTypeExports = chains => { module.exports = chainTypeExports(chains); - module.exports.ethereum["staking"] = staking( contracts.ethereum.veCRV, contracts.ethereum.CRV From 69b237652d3137c913cf7f0727129fa62f35e547 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Thu, 31 Aug 2023 17:36:48 +0100 Subject: [PATCH 1065/1974] lqty staking --- projects/liquity/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/projects/liquity/index.js b/projects/liquity/index.js index d0d923fb076..f0319bee5f7 100644 --- a/projects/liquity/index.js +++ b/projects/liquity/index.js @@ -1,9 +1,12 @@ const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); +const { staking } = require("../helper/staking.js"); const ETH_ADDRESS = ADDRESSES.null; // TroveManager holds total system collateral (deposited ETH) const TROVE_MANAGER_ADDRESS = "0xA39739EF8b0231DbFA0DcdA07d7e29faAbCf4bb2"; +const STAKING_ADDRESS = "0x4f9Fbb3f1E99B56e0Fe2892e623Ed36A76Fc605d"; +const LQTY_ADDRESS = "0x6DEA81C8171D0bA574754EF6F8b412F2Ed88c54D" async function tvl(_, block) { @@ -25,6 +28,7 @@ module.exports = { start: 1617607296, ethereum: { tvl, + staking: staking(STAKING_ADDRESS, LQTY_ADDRESS, "ethereum") } }; From ea6abf21d6f2885ad854ad744421aeafa72573fd Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Fri, 1 Sep 2023 01:37:15 +0100 Subject: [PATCH 1066/1974] update astaria --- projects/astaria/index.js | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/projects/astaria/index.js b/projects/astaria/index.js index 9d9fd4c051e..6e3539ff3b1 100644 --- a/projects/astaria/index.js +++ b/projects/astaria/index.js @@ -2,10 +2,9 @@ const { getLogs } = require('../helper/cache/getLogs'); const { sumTokens2 } = require('../helper/unwrapLPs'); const config = { - ethereum: { factory: '0x197Bb6Cd6cC9E9ABBFdaBff23DE7435c51d1B7BE', fromBlock: 16935232 , ACT: '0x455ad0f677628ed40e7397fb41818f474e0e5afe' }, + ethereum: { factory: '0x42CDc5D4B05E8dACc2FCD181cbe0Cc86Ee14c439', fromBlock: 16935232 , ACT: '0x6112d87127847202151b9fe48ea0e2704fa428a1' }, } -/* Object.keys(config).forEach(chain => { const { factory, fromBlock, ACT } = config[chain] module.exports[chain] = { @@ -28,12 +27,9 @@ Object.keys(config).forEach(chain => { }) const vaults = logs.map(l => l.vault) const nfts = actLogs.map(l => l.tokenContract) - const collIds = actLogs.map(l => l.collateralId) - const clearingHouses = await api.multiCall({ abi: "function getClearingHouse(uint256 collateralId) view returns (address)", calls: collIds.map(i => i.toString()), target:ACT}) - const tokensAndOwners = nfts.map((v, i) => [v, clearingHouses[i]]) + const tokensAndOwners = nfts.map((v, i) => [v, ACT]) const tokens = await api.multiCall({ abi: 'address:asset', calls: vaults}) - const bals = await api.multiCall({ abi: 'uint256:totalAssets', calls: vaults}) tokens.forEach((t, i) => tokensAndOwners.push([t, vaults[i]])) return sumTokens2({ api, tokensAndOwners }) }, @@ -54,14 +50,7 @@ Object.keys(config).forEach(chain => { }, } }) -*/ -module.exports={ - ethereum:{ - tvl: ()=>({}), - borrowed: ()=>({}), - }, - hallmarks:[ - [1687301106, "White hack"] - ] -} +module.exports.hallmarks = [ + [1687301106, "White hack"] +] From 0d7e18a31a93d6a862a94aa4990c4e5280e37dbe Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Fri, 1 Sep 2023 04:07:15 +0100 Subject: [PATCH 1067/1974] add steth and cbeth vaults --- projects/qidao/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/qidao/index.js b/projects/qidao/index.js index 561c77a7cfb..7f57440d675 100644 --- a/projects/qidao/index.js +++ b/projects/qidao/index.js @@ -101,7 +101,7 @@ const config = { }, base: { vaults: [ - //"0x7333fd58d8d73a8e5fc1a16c8037ada4f580fa2b", + "0x7333fd58d8d73a8e5fc1a16c8037ada4f580fa2b", "0x8d6cebd76f18e1558d4db88138e2defb3909fad6" ] }, @@ -115,7 +115,7 @@ const config = { "0x82E90EB7034C1DF646bD06aFb9E67281AAb5ed28", "0xCA3EB45FB186Ed4e75B9B22A514fF1d4abAdD123", "0x4ce4C542D96Ce1872fEA4fa3fbB2E7aE31862Bad", - //"0x5773e8953cf60f495eb3c2db45dd753b5c4b7473", + "0x5773e8953cf60f495eb3c2db45dd753b5c4b7473", "0x954ac12c339c60eafbb32213b15af3f7c7a0dec2" ] }, From 703c3e46f71d02b392a11316cd35525b2bf7757c Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 1 Sep 2023 10:05:45 +0200 Subject: [PATCH 1068/1974] liqwid: track usdc --- projects/liqwid/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/liqwid/index.js b/projects/liqwid/index.js index cb366728f25..b625accae95 100644 --- a/projects/liqwid/index.js +++ b/projects/liqwid/index.js @@ -79,6 +79,7 @@ const tokenMapping = { DJED: '8db269c3ec630e06ae29f74bc39edd1f87c819f1056206e879a1cd61446a65644d6963726f555344', SHEN: '8db269c3ec630e06ae29f74bc39edd1f87c819f1056206e879a1cd615368656e4d6963726f555344', IUSD: 'f66d78b4a3cb3d37afa0ec36461e51ecbde00f26c8f0a68f94b6988069555344', + USDC: '25c5de5f5b286073c593edfd77b48abc7a48e5a4f3d4cd9d428ff935', } const getToken = market => tokenMapping[market.marketId.toUpperCase()] From e62108e2bb274d28e6dc8eadf9ad535c2d12e952 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 1 Sep 2023 12:28:31 +0200 Subject: [PATCH 1069/1974] Onchain-trade (#7350) * feat:add base chain tvl and future * code refactor --------- Co-authored-by: haywael --- projects/OT/index.js | 41 ++++++++++++++++++++++++++++------------- 1 file changed, 28 insertions(+), 13 deletions(-) diff --git a/projects/OT/index.js b/projects/OT/index.js index 5cb37353519..f34567b5e2f 100644 --- a/projects/OT/index.js +++ b/projects/OT/index.js @@ -1,15 +1,30 @@ -const swapContractV1 = '0x84c18204c30da662562b7a2c79397C9E05f942f0'; -const swapContractV2 = '0x2a98158166BE71D21Dd97e248ba670211Df9a73C'; -const { sumTokens2 } = require('../helper/unwrapLPs') - -async function tvl(timestamp, ethBlock, chainBlocks, { api }) { - const v1tokens = await api.call({ target: swapContractV1, abi: 'function getPoolTokenList() external view returns (address[])', }); - const v2tokens = await api.call({ target: swapContractV2, abi: 'function getPoolTokenList() external view returns (address[])', }); - return sumTokens2({ api,tokens:[...v1tokens,...v2tokens],owners:[swapContractV1,swapContractV2]}) -} - -module.exports = { +const ADDRESSES = require('../helper/coreAssets.json') +const config = { era: { - tvl + OT: '0xD0eA21ba66B67bE636De1EC4bd9696EB8C61e9AA', + OSD: '0x2F96F4397AdDdF9C2eeB5233a29556BE26eb9450', + OETH: '0x9D8A2817eb7137021E2F1A86316a7E3A3351b4e0', + swapContracts: ['0x84c18204c30da662562b7a2c79397C9E05f942f0', '0x2a98158166BE71D21Dd97e248ba670211Df9a73C'], + futureContracts: ['0x57D28e11Cb2f72812A9f9DA72F2Ff868cd4B43F2'], }, -}; \ No newline at end of file + base: { + swapContracts: ['0xdDc8Bd03c1AB16a3E3dB0E89AA32C238FB9d63de'], + OSD: '0x139f18aC2a9FA34E0225FD2AAE983fc969b35540', + OETH: '0x2a86F14E762622Da8B7FB2A5BBdE50E16936279f', + futureContracts: [], + } +} + +Object.keys(config).forEach(chain => { + const { OSD, OETH, swapContracts, futureContracts } = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const tokens = (await api.multiCall({ abi: 'address[]:getPoolTokenList', calls: swapContracts })).flat() + return api.sumTokens({ + tokensAndOwners: [[ADDRESSES.null, OETH]], + tokens, owners: [swapContracts, futureContracts].flat(), + blacklistedTokens: [OSD, OETH], + }) + } + } +}) \ No newline at end of file From 0606b6b732544ef7c977a7e3fd46354621afd352 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 1 Sep 2023 12:52:41 +0200 Subject: [PATCH 1070/1974] lint fix --- projects/secretswap.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/projects/secretswap.js b/projects/secretswap.js index d310549c445..89d3ffec9cf 100644 --- a/projects/secretswap.js +++ b/projects/secretswap.js @@ -16,8 +16,6 @@ async function tvl() { } }), }) - return {} - return response; } module.exports = { From ac4dd1eaebb73544070f0060fcfb4b6e18bf2e20 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 1 Sep 2023 13:05:54 +0200 Subject: [PATCH 1071/1974] Levana (#7352) * Added TVL adapter for Levana Protocol * code refactor --------- Co-authored-by: lvn-savvy-dragon Co-authored-by: Levana Rusty Dragon --- projects/levana/index.js | 46 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 projects/levana/index.js diff --git a/projects/levana/index.js b/projects/levana/index.js new file mode 100644 index 00000000000..3452bdf900b --- /dev/null +++ b/projects/levana/index.js @@ -0,0 +1,46 @@ +const { queryContract, sumTokens } = require('../helper/chain/cosmos') + +async function tvl(_, _b, _cb, { api, }) { + const { chain } = api + const { factory } = config[chain] + // Get a list of marketIds from the factory contract + // Iterate over the markets and request the balance of each market's collateral token + const marketIds = await getMarketIds(chain, factory) + const _getMarketAddr = (marketId) => getMarketAddr(chain, factory, marketId) + return sumTokens({ chain, owners: await Promise.all(marketIds.map(_getMarketAddr)), }) +} + +async function getMarketIds(chain, factory) { + const markets = await queryContract({ + contract: factory, + chain: chain, + data: { 'markets': {} } + }); + + return markets.markets +} + +async function getMarketAddr(chain, factory, marketId) { + const marketInfo = await queryContract({ + contract: factory, + chain: chain, + data: { 'market_info': { 'market_id': marketId } } + }); + + return marketInfo.market_addr; +} + +module.exports = { + timetravel: false, + methodology: "TVL is the sum of deposits into the Liquidity pools combined with the sum of trader collateral for open and pending positions", +} + +const config = { + osmosis: { factory: 'osmo1ssw6x553kzqher0earlkwlxasfm2stnl3ms3ma2zz4tnajxyyaaqlucd45' }, + sei: { factory: 'sei18rdj3asllguwr6lnyu2sw8p8nut0shuj3sme27ndvvw4gakjnjqqper95h' }, +} + + +Object.keys(config).forEach(chain => { + module.exports[chain] = { tvl } +}) From f12d1108f72211a4b2939943b28b5b679c722fdc Mon Sep 17 00:00:00 2001 From: GaijinShacho <123333376+GaijinShacho@users.noreply.github.com> Date: Fri, 1 Sep 2023 20:06:54 +0900 Subject: [PATCH 1072/1974] Added Base3D adapter for DefiLlama (#7346) * Added Base3D adapter for DefiLlama * code refactor --------- Co-authored-by: GaijinShacho Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/base3d/index.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 projects/base3d/index.js diff --git a/projects/base3d/index.js b/projects/base3d/index.js new file mode 100644 index 00000000000..22d91dfb350 --- /dev/null +++ b/projects/base3d/index.js @@ -0,0 +1,14 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const BASE3D_MAIN_CONTRACT = '0xa73fab6e612aaf9125bf83a683aadcdd6511d3f0'; + +async function tvl(_, __, ___, { api }) { + return api.sumTokens({ owner: BASE3D_MAIN_CONTRACT, tokens: [ADDRESSES.null] }); +} + +module.exports = { + base: { + tvl, + }, + methodology: 'Calculates TVL by checking the ETH balance of the main contract via the totalEthereumBalance function.', + start: 3331748, +}; From 281aad5bf42f259cd9ceedb9cebd73a5bbb2e3cd Mon Sep 17 00:00:00 2001 From: ZkSwapFinance <126151208+ZkSwapFinance@users.noreply.github.com> Date: Fri, 1 Sep 2023 18:07:11 +0700 Subject: [PATCH 1073/1974] zkswap update ZF token TVL and staking pools (#7341) * zkswap DEX on zkSync Era * folder name * old folder * new name folder * minor fix * seprate TVL tokens * update TVL ZF token and staking pools * pair contract * code refactor --------- Co-authored-by: not found Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/helper/utils.js | 2 +- projects/zkSwap-finance/index.js | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/projects/helper/utils.js b/projects/helper/utils.js index 2408239b142..3dc42b5ba7b 100644 --- a/projects/helper/utils.js +++ b/projects/helper/utils.js @@ -71,7 +71,7 @@ function isLP(symbol, token, chain) { if (chain === 'harmony' && ['HLP'].includes(symbol)) return true if (chain === 'klaytn' && ['NLP'].includes(symbol)) return true if (chain === 'fantom' && ['HLP', 'WLP'].includes(symbol)) return true - if (chain === 'era' && /(cSLP|sSLP)$/.test(symbol)) return true // for syncswap + if (chain === 'era' && /(cSLP|sSLP|ZFLP)$/.test(symbol)) return true // for syncswap if (chain === 'songbird' && ['FLRX', 'OLP'].includes(symbol)) return true if (chain === 'arbitrum' && ['DXS', 'ZLP',].includes(symbol)) return true if (chain === 'metis' && ['NLP', 'ALP'].includes(symbol)) return true // Netswap/Agora LP Token diff --git a/projects/zkSwap-finance/index.js b/projects/zkSwap-finance/index.js index b115f0565d3..7cf1c19734b 100644 --- a/projects/zkSwap-finance/index.js +++ b/projects/zkSwap-finance/index.js @@ -1,11 +1,11 @@ -const { getUniTVL } = require('../helper/unknownTokens') +const { getUniTVL, sumTokensExport } = require('../helper/unknownTokens') module.exports = { + misrepresentedTokens: true, era: { - tvl: getUniTVL({ - factory: '0x3a76e377ED58c8731F9DF3A36155942438744Ce3', - fetchBalances: true, - }) + tvl: getUniTVL({ factory: '0x3a76e377ed58c8731f9df3a36155942438744ce3', fetchBalances: true, useDefaultCoreAssets: true, }), + staking: sumTokensExport({ owner: '0x9F9D043fB77A194b4216784Eb5985c471b979D67', tokens: ['0x31C2c031fDc9d33e974f327Ab0d9883Eae06cA4A'], lps: ['0xD33A17C883D5aA79470cd2522ABb213DC4017E01'], useDefaultCoreAssets: true }), }, methodology: "TVL is total liquidity of all liquidity pools." -}; +} + From e8c3699e3e5fe08b1e901732a6540af5edeb59e7 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 1 Sep 2023 14:25:46 +0200 Subject: [PATCH 1074/1974] Ampleswap (#7356) * Update index.js change my ample token contract and masterchef also add alveychain factory address * track https://elvesdex.com/ --------- Co-authored-by: AmpleSwap <88421012+ampleswap@users.noreply.github.com> --- projects/ampleswap/index.js | 9 +++++---- projects/elvesdex/index.js | 8 ++++++++ projects/helper/chains.json | 2 ++ projects/helper/tokenMapping.js | 6 ++++++ 4 files changed, 21 insertions(+), 4 deletions(-) create mode 100644 projects/elvesdex/index.js diff --git a/projects/ampleswap/index.js b/projects/ampleswap/index.js index da6763b1e4f..77bd25892b4 100644 --- a/projects/ampleswap/index.js +++ b/projects/ampleswap/index.js @@ -1,15 +1,16 @@ const { staking } = require("../helper/staking"); const { getUniTVL } = require('../helper/unknownTokens') -const MasterChefContract = "0xeb642d600bf593cb21e1551e9a15426ff6d42f82"; -const AMPLE = "0x335f6e0e804b70a96bf9eb8af31588942e9b2515"; +const MasterChefContract = "0xF5987603323AA99DDe0777a55E83C82D59cCA272"; +const AMPLE = "0x19857937848c02afbde8b526610f0f2f89e9960d"; module.exports = { methodology: `Uses factory(0x381fefadab5466bff0e8e96842e8e76a143e8f73) address and whitelisted tokens address to find and price Liquidity Pool pairs`, misrepresentedTokens: true, - incentivized: true, bsc: { tvl: getUniTVL({ factory: '0x381fefadab5466bff0e8e96842e8e76a143e8f73', useDefaultCoreAssets: true }), staking: staking(MasterChefContract, AMPLE), - } + }, + alv: { tvl: getUniTVL({ factory: '0x01dC97C89DF7d3C616a696dD53F600aB3FF12983', useDefaultCoreAssets: true }), }, + dsc: { tvl: getUniTVL({ factory: '0x232Ba9f3B3643ab28d28ED7ee18600708D60E5fe', useDefaultCoreAssets: true, }), }, }; diff --git a/projects/elvesdex/index.js b/projects/elvesdex/index.js new file mode 100644 index 00000000000..d1dc4eee764 --- /dev/null +++ b/projects/elvesdex/index.js @@ -0,0 +1,8 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports = { + misrepresentedTokens: true, + alv: { + tvl: getUniTVL({ factory: '0xcadB0365436cbdB05D71C355F209AdaB214D8Dab', useDefaultCoreAssets: true, }), + } +}; diff --git a/projects/helper/chains.json b/projects/helper/chains.json index 9f8c097b58a..74301c11c84 100644 --- a/projects/helper/chains.json +++ b/projects/helper/chains.json @@ -1,6 +1,7 @@ [ "acala", "algorand", + "alv", "aptos", "arbitrum", "arbitrum_nova", @@ -45,6 +46,7 @@ "csc", "cube", "curio", + "dsc", "defichain", "dexit", "dfk", diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index e04a9300998..0d8f6e07437 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -53,6 +53,12 @@ const fixBalancesTokens = { telos: { [ADDRESSES.telos.WTLOS_1]: { coingeckoId: "telos", decimals: 18 }, }, + alv: { + ['0xcb3e9919c56eff1004e54175a01e39163a352129']: { coingeckoId: "alvey-chain", decimals: 18 }, + }, + dsc: { + ['0x1c5d8992da64c8d56ea413dd6f723061c29a7c0b']: { coingeckoId: "decimal", decimals: 18 }, + }, aura: { 'uaura': { coingeckoId: 'aura-network', decimals: 6 }, }, From ffb277d292cbf1aaac194cbb7434c531490ff5e6 Mon Sep 17 00:00:00 2001 From: smolfork <101562437+smolfork@users.noreply.github.com> Date: Fri, 1 Sep 2023 16:50:15 +0400 Subject: [PATCH 1075/1974] add alternity protocol (#7348) * add alternity tvl and staking * code refactor --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/alternity/index.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 projects/alternity/index.js diff --git a/projects/alternity/index.js b/projects/alternity/index.js new file mode 100644 index 00000000000..ba60c03c92b --- /dev/null +++ b/projects/alternity/index.js @@ -0,0 +1,14 @@ +const { staking } = require("../helper/staking.js"); +const { getLiquityTvl } = require("../helper/liquity"); + +// TroveManager holds total system collateral (deposited ETH) +const STAKING_ADDRESS = "0x424891f1D6D4De5c07B6E3F74B3709D6BD9E77ea"; +const ALTR_ADDRESS = "0xD1ffCacFc630CE68d3cd3369F5db829a3ed01fE2" + +module.exports = { + start: 1692423851, + ethereum: { + tvl: getLiquityTvl('0x51c014510A5AdA43408b40D49eF52094014ef3A7'), + staking: staking(STAKING_ADDRESS, ALTR_ADDRESS, "ethereum") + } +}; From 02039eff4d5d5f78bb2f6c89eb5f370d5645c71d Mon Sep 17 00:00:00 2001 From: MIMIEYES Date: Fri, 1 Sep 2023 20:50:26 +0800 Subject: [PATCH 1076/1974] update nerve bridge (#7349) --- projects/nervenetworkbridge/index.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/projects/nervenetworkbridge/index.js b/projects/nervenetworkbridge/index.js index fbffad6ae68..f682ee0119a 100644 --- a/projects/nervenetworkbridge/index.js +++ b/projects/nervenetworkbridge/index.js @@ -25,7 +25,13 @@ const getBridgeContract = { 'kava': '0x3758AA66caD9F2606F1F501c9CB31b94b713A6d5', 'ethpow': '0x67b3757f20DBFa114b593dfdAc2b3097Aa42133E', 'rei': '0x3758AA66caD9F2606F1F501c9CB31b94b713A6d5', - 'era': '0x54C4A99Ee277eFF14b378405b6600405790d5045' + 'era': '0x54C4A99Ee277eFF14b378405b6600405790d5045', + 'eos_evm': '0x3758AA66caD9F2606F1F501c9CB31b94b713A6d5', + 'polygon_zkevm': '0x3758AA66caD9F2606F1F501c9CB31b94b713A6d5', + 'linea': '0x8CD6e29d3686d24d3C2018CEe54621eA0f89313B', + 'celo': '0x3758AA66caD9F2606F1F501c9CB31b94b713A6d5', + 'ethereumclassic': '0x3758AA66caD9F2606F1F501c9CB31b94b713A6d5', + 'base': '0x3758AA66caD9F2606F1F501c9CB31b94b713A6d5' } const tronBridgeContract = 'TXeFBRKUW2x8ZYKPD13RuZDTd9qHbaPGEN'; From a7ef0ad69216a9de089c7004ecfe2cb68821c853 Mon Sep 17 00:00:00 2001 From: halfdoctor Date: Fri, 1 Sep 2023 13:51:19 +0100 Subject: [PATCH 1077/1974] Update index.js to include Sonne Finance expansion to BASE (#7353) * Update index.js to include Sonne Finance expansion to BASE * Update index.js * Update index.js * Update index.js * Update index.js --- projects/sonne-finance/index.js | 42 ++++++++++++++++++++------------- 1 file changed, 26 insertions(+), 16 deletions(-) diff --git a/projects/sonne-finance/index.js b/projects/sonne-finance/index.js index 5189ffe4b28..79aad08afdb 100644 --- a/projects/sonne-finance/index.js +++ b/projects/sonne-finance/index.js @@ -1,19 +1,29 @@ -const { compoundExports } = require("../helper/compound"); -const { staking } = require("../helper/staking"); +const { compoundExports } = require('../helper/compound') +const { staking } = require('../helper/staking'); -const unitroller = "0x60CF091cD3f50420d50fD7f707414d0DF4751C58"; +const optimismConfig = { + unitroller: '0x60CF091cD3f50420d50fD7f707414d0DF4751C58', + chain: 'optimism' +} + +const baseConfig = { + unitroller: '0x1DB2466d9F5e10D7090E7152B68d62703a2245F0', + chain: 'base' +} + +// OPTIMISM CHAIN +const optimismTVL = compoundExports(optimismConfig.unitroller, optimismConfig.chain) + +// BASE CHAIN +const baseTVL = compoundExports(baseConfig.unitroller, baseConfig.chain) module.exports = { - methodology: - "Same as Compound Finance, we just count all the tokens supplied (not borrowed money) on the lending markets", - optimism: { - ...compoundExports(unitroller, "optimism"), - staking: staking( - [ - "0xdc05d85069dc4aba65954008ff99f2d73ff12618", - "0x41279e29586eb20f9a4f65e031af09fced171166", - ], - "0x1DB2466d9F5e10D7090E7152B68d62703a2245F0" - ), - }, -}; + optimism: { ...optimismTVL, + staking: staking( + ["0xdc05d85069dc4aba65954008ff99f2d73ff12618", + "0x41279e29586eb20f9a4f65e031af09fced171166"], + "0x1DB2466d9F5e10D7090E7152B68d62703a2245F0" + ), + }, + base: { ...baseTVL } +} From a76337343308b0b71215c2c30233c3cb5883ad39 Mon Sep 17 00:00:00 2001 From: define Date: Fri, 1 Sep 2023 14:01:32 +0100 Subject: [PATCH 1078/1974] fix levana spaces --- projects/levana/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/levana/index.js b/projects/levana/index.js index 3452bdf900b..bca6839a377 100644 --- a/projects/levana/index.js +++ b/projects/levana/index.js @@ -36,8 +36,8 @@ module.exports = { } const config = { - osmosis: { factory: 'osmo1ssw6x553kzqher0earlkwlxasfm2stnl3ms3ma2zz4tnajxyyaaqlucd45' }, - sei: { factory: 'sei18rdj3asllguwr6lnyu2sw8p8nut0shuj3sme27ndvvw4gakjnjqqper95h' }, + osmosis: {factory: 'osmo1ssw6x553kzqher0earlkwlxasfm2stnl3ms3ma2zz4tnajxyyaaqlucd45'}, + sei: {factory: 'sei18rdj3asllguwr6lnyu2sw8p8nut0shuj3sme27ndvvw4gakjnjqqper95h'}, } From 83914a5ad70fdde88b99748ac1a2aac162f435a6 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 1 Sep 2023 15:08:29 +0200 Subject: [PATCH 1079/1974] minor fix --- projects/levana/index.js | 4 ++-- projects/sonne-finance/index.js | 32 ++++++++------------------------ 2 files changed, 10 insertions(+), 26 deletions(-) diff --git a/projects/levana/index.js b/projects/levana/index.js index bca6839a377..ea6ac19780c 100644 --- a/projects/levana/index.js +++ b/projects/levana/index.js @@ -36,8 +36,8 @@ module.exports = { } const config = { - osmosis: {factory: 'osmo1ssw6x553kzqher0earlkwlxasfm2stnl3ms3ma2zz4tnajxyyaaqlucd45'}, - sei: {factory: 'sei18rdj3asllguwr6lnyu2sw8p8nut0shuj3sme27ndvvw4gakjnjqqper95h'}, + osmosis: { factory: 'osmo1ssw6x553kzqher0earlkwlxasfm2stnl3ms3ma2zz4tnajxyyaaqlucd45' }, + sei: { factory: 'sei18rdj3asllguwr6lnyu2sw8p8nut0shuj3sme27ndvvw4gakjnjqqper95h' }, } diff --git a/projects/sonne-finance/index.js b/projects/sonne-finance/index.js index 79aad08afdb..5528671d2c6 100644 --- a/projects/sonne-finance/index.js +++ b/projects/sonne-finance/index.js @@ -1,29 +1,13 @@ -const { compoundExports } = require('../helper/compound') +const { compoundExports2 } = require('../helper/compound') const { staking } = require('../helper/staking'); -const optimismConfig = { - unitroller: '0x60CF091cD3f50420d50fD7f707414d0DF4751C58', - chain: 'optimism' -} -const baseConfig = { - unitroller: '0x1DB2466d9F5e10D7090E7152B68d62703a2245F0', - chain: 'base' +const config = { + optimism: '0x60CF091cD3f50420d50fD7f707414d0DF4751C58', + base: '0x1DB2466d9F5e10D7090E7152B68d62703a2245F0' } -// OPTIMISM CHAIN -const optimismTVL = compoundExports(optimismConfig.unitroller, optimismConfig.chain) - -// BASE CHAIN -const baseTVL = compoundExports(baseConfig.unitroller, baseConfig.chain) - -module.exports = { - optimism: { ...optimismTVL, - staking: staking( - ["0xdc05d85069dc4aba65954008ff99f2d73ff12618", - "0x41279e29586eb20f9a4f65e031af09fced171166"], - "0x1DB2466d9F5e10D7090E7152B68d62703a2245F0" - ), - }, - base: { ...baseTVL } -} +Object.keys(config).forEach(chain => { + module.exports[chain] = compoundExports2({ comptroller: config[chain] }) +}) +module.exports.optimism.staking = staking(["0xdc05d85069dc4aba65954008ff99f2d73ff12618", "0x41279e29586eb20f9a4f65e031af09fced171166"], "0x1DB2466d9F5e10D7090E7152B68d62703a2245F0") \ No newline at end of file From 784e316438f70887b00fc2c1e63dc3a6c11153aa Mon Sep 17 00:00:00 2001 From: Mykola Bezruk Date: Fri, 1 Sep 2023 16:23:26 +0300 Subject: [PATCH 1080/1974] Add MYSO v2 adapter (#7355) * add myso v2 * add caching --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/myso-v2/index.js | 92 +++++++++++++++++++++++++++++++++++++++ projects/myso/index.js | 9 +++- 2 files changed, 100 insertions(+), 1 deletion(-) create mode 100644 projects/myso-v2/index.js diff --git a/projects/myso-v2/index.js b/projects/myso-v2/index.js new file mode 100644 index 00000000000..fb7aff9fa5b --- /dev/null +++ b/projects/myso-v2/index.js @@ -0,0 +1,92 @@ +const axios = require("axios"); +const zlib = require("zlib"); +const { getLogs, } = require("../helper/cache/getLogs"); +const { sumTokens2 } = require("../helper/unwrapLPs"); +const { getCache, setCache, } = require("../helper/cache"); + +const brotliDecode = (stream) => { + return new Promise((resolve, reject) => { + let responseBuffer = []; + + stream.on("data", function handleStreamData(chunk) { + responseBuffer.push(chunk); + }); + + stream.on("error", function handleStreamError(err) { + reject(err); + }); + + stream.on("end", function handleStreamEnd() { + let responseData = Buffer.concat(responseBuffer); + + responseData = responseData.toString("utf8"); + + resolve(JSON.parse(responseData)); + }); + }); +}; + +const getContracts = async (chainId) => { + const response = await axios.get( + `https://api.myso.finance/chainIds/${chainId}/contracts`, + { + decompress: false, + responseType: "stream", + transformResponse: (data) => { + return data.pipe(zlib.createBrotliDecompress()); + }, + } + ); + + const data = await brotliDecode(response.data); + + return data.contracts; +}; + +async function tvl(_, _b, _cb, { api }) { + const { fromBlock } = config[api.chain]; + let contracts + + try { + contracts = await getContracts(api.chainId) + await setCache('myso-v2', api.chain, contracts) + } catch (e) { + contracts = await getCache('myso-v2',api.chain) + } + + const vaultFactory = contracts?.find( + (contract) => contract.type === "vault_factory" + )?.contractAddr; + + const logs = await getLogs({ + api, + target: vaultFactory, + eventAbi: "event NewVaultCreated(address indexed newLenderVaultAddr, address vaultOwner, uint256 numRegisteredVaults)", + onlyArgs: true, + fromBlock, + }); + + let ownerTokens = logs.map((i) => { + return [ + contracts + .filter((contract) => contract.type === "token") + .map((contract) => contract.contractAddr), + i.newLenderVaultAddr, + ]; + }); + + return sumTokens2({ + api, + ownerTokens, + }); +} + +const config = { + mantle: { + fromBlock: 3471026, + }, +}; + +Object.keys(config).forEach((chain) => { + module.exports[chain] = { tvl }; +}); diff --git a/projects/myso/index.js b/projects/myso/index.js index 725745df819..f2968034bb3 100644 --- a/projects/myso/index.js +++ b/projects/myso/index.js @@ -1,6 +1,7 @@ const { sumTokens2 } = require("../helper/unwrapLPs"); const axios = require("axios"); const zlib = require("zlib"); +const { getCache, setCache, } = require("../helper/cache"); const mapChainToChainId = { ethereum: 1, @@ -48,7 +49,13 @@ const getPools = async (chainId) => { async function tvl(_, _b, _cb, { api, chain }) { const chainId = mapChainToChainId[chain]; - const pools = await getPools(chainId); + let pools + try { + pools = await getPools(chainId) + await setCache('myso', chainId, pools) + } catch (e) { + pools = await getCache('myso', chainId) + } const data = await api.multiCall({ abi: "function getPoolInfo() view returns (address _loanCcyToken, address _collCcyToken, uint256 _maxLoanPerColl, uint256 _minLoan, uint256 _loanTenor, uint256 _totalLiquidity, uint256 _totalLpShares, uint256 _baseAggrBucketSize, uint256 _loanIdx)", From 50d01633551c1a86b57ad3f5c00a6b2fdc8ec491 Mon Sep 17 00:00:00 2001 From: magicMax007 <118804823+magicMax007@users.noreply.github.com> Date: Fri, 1 Sep 2023 21:50:07 +0800 Subject: [PATCH 1081/1974] astarter add dex tvl (#7343) * astarter add dex tvl * fix calc error * fix error * track astarter dex --------- Co-authored-by: xubowenshizi Co-authored-by: magic Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/astarter-dex/index.js | 18 ++++++++++++++++++ projects/astarter/index.js | 10 +--------- projects/helper/utils.js | 2 +- 3 files changed, 20 insertions(+), 10 deletions(-) create mode 100644 projects/astarter-dex/index.js diff --git a/projects/astarter-dex/index.js b/projects/astarter-dex/index.js new file mode 100644 index 00000000000..67f3e8201ed --- /dev/null +++ b/projects/astarter-dex/index.js @@ -0,0 +1,18 @@ +const { sumTokens2 } = require("../helper/chain/cardano"); + +const DEX_BATHCER_SCRIPT = "addr1wxvf6xqa3jkq9cnyjnf7t4v6aku75rn3l3mlhe9udp4dnwcjscuah"; +const DEX_POOL_SCRIPT = "addr1wxe4dwl0jmmchjnd049t5ur7lc4jmhcjax8ht393evxcjsgeccdeu"; + +async function tvl() { + return sumTokens2({ scripts: [DEX_BATHCER_SCRIPT, DEX_POOL_SCRIPT], blacklistedTokens: [ + 'a221955d11877502db596bad11a549eb41cd56279092e45b7e4abfe94279726f6e', // Byron + 'a221955d11877502db596bad11a549eb41cd56279092e45b7e4abfe95368656c6c6579', // shelly + ] }) +} + +module.exports = { + timetravel: false, + cardano: { + tvl, + } +}; diff --git a/projects/astarter/index.js b/projects/astarter/index.js index 3d036211ec0..e90094da40e 100644 --- a/projects/astarter/index.js +++ b/projects/astarter/index.js @@ -1,17 +1,9 @@ const axios = require("axios"); const POOL_ID = "pool1drkls8s0zzjydyv3qpjsdj58w3sw02w9wg0pckrsnuazyef2hca"; -// TODO Waiting for dex to deploy the main network -// const DEX_BATHCER_SCRIPT = ""; -// const DEX_POOL_SCRIPT = ""; - async function tvl() { - // const batchOrderLocked = await getAdaInAddress(DEX_BATHCER_SCRIPT); - // const liquidityPoolLocked = await getAdaInAddress(DEX_POOL_SCRIPT); - const ISPOLocked = await getPoolStake(POOL_ID); return { - // cardano: ISPOLocked + (liquidityPoolLocked * 2) + batchOrderLocked, - cardano: ISPOLocked, + cardano: await getPoolStake(POOL_ID) }; } diff --git a/projects/helper/utils.js b/projects/helper/utils.js index 3dc42b5ba7b..2dc34fb1db5 100644 --- a/projects/helper/utils.js +++ b/projects/helper/utils.js @@ -178,7 +178,7 @@ async function diplayUnknownTable({ tvlResults = {}, tvlBalances = {}, storedKey storedKey = storedKey.split('-')[0] Object.entries(tvlResults.tokenBalances).forEach(([label, balance]) => { if (!label.startsWith('UNKNOWN')) return; - const token = label.split('(')[1].replace(')', '') + const token = label?.split('(')[1]?.replace(')', '') balances[token] = tvlBalances[token] if (balances[token] === '0') delete balances[token] }) From 550996080ede0050eb467e4b0c296d1b8a19afd1 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 1 Sep 2023 16:38:04 +0200 Subject: [PATCH 1082/1974] fix broken adapters --- projects/dextf/v1.js | 2 +- projects/glif/index.js | 2 +- projects/hashmix/index.js | 77 +++++++++++++++++------------------ projects/sharedstake/index.js | 47 ++++++--------------- projects/zeta/index.js | 2 +- 5 files changed, 53 insertions(+), 77 deletions(-) diff --git a/projects/dextf/v1.js b/projects/dextf/v1.js index 9be4c382fd2..5e12a9cbe89 100644 --- a/projects/dextf/v1.js +++ b/projects/dextf/v1.js @@ -2,4 +2,4 @@ const { sumTokensExport } = require('../helper/unwrapLPs') const vaultAddress = "0x86C077092018077Df34FF44D5D7d3f9A2DF03bEf" -module.exports = { ethereum: { tvl: sumTokensExport({ owner: vaultAddress, fetchCoValentTokens: true, }), } } +module.exports = sumTokensExport({ owner: vaultAddress, fetchCoValentTokens: true, }) diff --git a/projects/glif/index.js b/projects/glif/index.js index 195fead9a62..5e62a638aa3 100644 --- a/projects/glif/index.js +++ b/projects/glif/index.js @@ -17,7 +17,7 @@ module.exports = { // we wrapped the locked miners collateral in a server that derives the information directly on-chain // but serves it in a more efficient manner to not overload defillama frontend // github repo: https://github.com/glifio/pools-metrics - get("https://pools-metrics.vercel.app/api/v0/miner-collaterals"), + get("https://events.glif.link/metrics"), ]); const totalAssetsBN = BigNumber.from(totalAssets); diff --git a/projects/hashmix/index.js b/projects/hashmix/index.js index baadd361e7c..a5b12390c6e 100644 --- a/projects/hashmix/index.js +++ b/projects/hashmix/index.js @@ -2,52 +2,51 @@ const POOL = "0x587A7eaE9b461ad724391Aa7195210e0547eD11d"; const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') const { get } = require("../helper/http"); const BigNumber = require("bignumber.js"); -// const { sdk } = require("@defillama/sdk"); +const { sdk } = require("@defillama/sdk"); -// async function tvl(_, _1, _2, { api }) { -// const totalBorrows = await api.call({ target: POOL, abi: "uint256:totalBorrows", }); -// const totalReserves = await api.call({ target: POOL, abi: "uint256:totalReserves", }); -// api.add(nullAddress, totalBorrows) -// api.add(nullAddress, totalReserves * -1) +async function tvl(_, _1, _2, { api }) { + const totalBorrows = await api.call({ target: POOL, abi: "uint256:totalBorrows", }); + const totalReserves = await api.call({ target: POOL, abi: "uint256:totalReserves", }); + api.add(nullAddress, totalBorrows) + api.add(nullAddress, totalReserves * -1) -// return sumTokens2({ api, owner: POOL, tokens: [nullAddress]}); -// } + return sumTokens2({ api, owner: POOL, tokens: [nullAddress] }); +} -async function tvl(_, _1, _2, { api }) { +/* async function tvl1(_, _1, _2, { api }) { - let tvl = await get("https://fvm.hashmix.org/fevmapi/tvl"); - // let b = new BigNumber.BigNumber("337036288533616233281756"); + // let tvl = await get("https://fvm.hashmix.org/fevmapi/tvl"); - api.add(nullAddress, tvl.data) + // api.add(nullAddress, tvl.data) - return sumTokens2({ api, owner: POOL, tokens: [nullAddress] }); + // return sumTokens2({ api, owner: POOL, tokens: [nullAddress] }); - // const balances = {}; - // const bal = await sdk.api2.eth.getBalance({ target: POOL, chain: api.chain, decimals: api.decimals }); - // const totalBorrows = await sdk.api2.abi.call({ - // target: POOL, - // abi: "uint256:totalBorrows", - // chain: api.chain, - // }); - // const totalReserves = await sdk.api2.abi.call({ - // target: POOL, - // abi: "uint256:totalReserves", - // chain: api.chain, - // }); - - - // let b = new BigNumber.BigNumber(bal.output); - // b = b.plus(new BigNumber.BigNumber(totalBorrows)).minus(new BigNumber.BigNumber(totalReserves)); - - // sdk.util.sumSingleBalance( - // balances, - // nullAddress, - // b.toFixed(0), - // api.chain - // ); - - // return balances; -} + const balances = {}; + const bal = await sdk.api2.eth.getBalance({ target: POOL, chain: api.chain, decimals: api.decimals }); + const totalBorrows = await sdk.api2.abi.call({ + target: POOL, + abi: "uint256:totalBorrows", + chain: api.chain, + }); + const totalReserves = await sdk.api2.abi.call({ + target: POOL, + abi: "uint256:totalReserves", + chain: api.chain, + }); + + + let b = new BigNumber.BigNumber(bal.output); + b = b.plus(new BigNumber.BigNumber(totalBorrows)).minus(new BigNumber.BigNumber(totalReserves)); + + sdk.util.sumSingleBalance( + balances, + nullAddress, + b.toFixed(0), + api.chain + ); + + return balances; +} */ module.exports = { methodology: diff --git a/projects/sharedstake/index.js b/projects/sharedstake/index.js index 5dae9057b09..eaa95d7a2dc 100644 --- a/projects/sharedstake/index.js +++ b/projects/sharedstake/index.js @@ -1,48 +1,25 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const sdk = require('@defillama/sdk'); -const {unwrapUniswapLPs} = require('../helper/unwrapLPs') +const { staking } = require('../helper/staking') +const { pool2 } = require('../helper/pool2') -const wethAddress = ADDRESSES.ethereum.WETH const sgtStakingPool = "0xc637dB981e417869814B2Ea2F1bD115d2D993597" const sgt = "0x84810bcF08744d5862B8181f12d17bfd57d3b078" const pool2StakingPool = "0x64A1DB33f68695df773924682D2EFb1161B329e8" const sgtPool2Token = "0x3d07f6e1627DA96B8836190De64c1aED70e3FC55" -async function pool2(timestamp, block) { - const balances = {} - const sgtLPStaked = await sdk.api.erc20.balanceOf({ - block, - target:sgtPool2Token, - owner: pool2StakingPool - }) - await unwrapUniswapLPs(balances, [{ - token: sgtPool2Token, - balance: sgtLPStaked.output - }], block) - - return balances -} - -async function tvl(timestamp, block) { - const eth2Supply = await sdk.api.erc20.totalSupply({ - target: '0x898bad2774eb97cf6b94605677f43b41871410b1', - block - }) - const sgtStaked = await sdk.api.erc20.balanceOf({ - block, - target:sgt, - owner: sgtStakingPool - }) - - return { - [wethAddress]: eth2Supply.output, - [sgt]: sgtStaked.output - } +async function tvl(timestamp, block, _, { api }) { + const sgETH = '0x9e52db44d62a8c9762fa847bd2eba9d0585782d1' + const supply= await api.call({ abi: 'erc20:totalSupply', target: sgETH}) + api.add(sgETH, supply) + return api.getBalances() } module.exports = { ethereum: { tvl, - pool2 + pool2: pool2(pool2StakingPool, sgtPool2Token), + staking: staking(sgtStakingPool, sgt) }, + hallmarks: [ + [Math.floor(new Date('2023-09-01')/1e3), 'Protocol was hacked for 102 ETH'], + ], } \ No newline at end of file diff --git a/projects/zeta/index.js b/projects/zeta/index.js index 7985385ec40..1ff44e810da 100644 --- a/projects/zeta/index.js +++ b/projects/zeta/index.js @@ -13,6 +13,6 @@ module.exports = { methodology: "Snapshots of the TVL from Zeta (zeta.markets) are saved periodically into the statistics repo. This includes all tokens used as collateral and in the insurance fund", solana: { - tvl, + tvl: () => ({}), }, }; From 99fe3add1010dab3cde780d2f6ec400945f02f34 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 1 Sep 2023 17:30:22 +0200 Subject: [PATCH 1083/1974] fix broken adapters --- projects/aelin/index.js | 2 +- projects/gyroscope/index.js | 50 +++++++++++++-------------- projects/popcorn/stakingPools.js | 2 +- projects/steakHut/index.js | 59 ++++++-------------------------- projects/zircon-gamma/index.js | 7 +++- 5 files changed, 42 insertions(+), 78 deletions(-) diff --git a/projects/aelin/index.js b/projects/aelin/index.js index 1408b5cc819..a49424cc218 100644 --- a/projects/aelin/index.js +++ b/projects/aelin/index.js @@ -92,7 +92,7 @@ function pool2TVL(chain) { } ] // Unwrao Gelato pools - await unwrapUniswapLPs(balances, lpBalances, block, chain, transformAddress, [], false, 'gelato') + await unwrapUniswapLPs(balances, lpBalances, block, chain, transformAddress, [], 'gelato') return balances } } diff --git a/projects/gyroscope/index.js b/projects/gyroscope/index.js index 9f5847eca15..7cc620a205d 100644 --- a/projects/gyroscope/index.js +++ b/projects/gyroscope/index.js @@ -1,38 +1,36 @@ -const { transformBalances } = require('../helper/portedTokens') -const sdk = require('@defillama/sdk') -const { getConfig } = require('../helper/cache') +const { getLogs } = require('../helper/cache/getLogs') async function tvl(_, _b, _cb, { api, }) { - const balances = {} + const logs = await getLogs({ + api, + target: config[api.chain].factory, + eventAbi: 'event PoolCreated (address indexed pool)', + onlyArgs: true, + fromBlock: config[api.chain].fromBlock, + }) - const poolIds = (await getConfig(`gyroscope/${api.chain}`, `https://app.gyro.finance/whitelist/${api.chain}.json`)) + const pools = logs.map(i => i.pool) + const poolIds = await api.multiCall({ abi: 'function getPoolId() view returns (bytes32)', calls: pools }) + const vaults = await api.multiCall({ abi: 'address:getVault', calls: pools }) - const vault = await api.call({ - target: poolIds[0].slice(0, 42), - abi: 'address:getVault', - }) const data = await api.multiCall({ abi: 'function getPoolTokens(bytes32 poolId) view returns (address[] tokens, uint256[] balances, uint256 lastChangeBlock)', - calls: poolIds, - target: vault - }) - - data.forEach(i => { - i.tokens.forEach((t, j) => sdk.util.sumSingleBalance(balances, t, i.balances[j])) + calls: poolIds.map((v, i) => ({ target: vaults[i], params: v })), }) - return transformBalances(api.chain, balances) + data.forEach(i => api.addTokens(i.tokens, i.balances)) } module.exports = { methodology: 'sum of all the tokens locked in CLPs', - polygon: { - tvl - }, - optimism: { - tvl - }, - ethereum: { - tvl - } -} \ No newline at end of file +} + +const config = { + polygon: { factory: '0x5d8545a7330245150bE0Ce88F8afB0EDc41dFc34', fromBlock: 31556084 }, + optimism: { factory: '0x9b683cA24B0e013512E2566b68704dBe9677413c', fromBlock: 97253023 }, + ethereum: { factory: '0x412a5B2e7a678471985542757A6855847D4931D5', fromBlock: 17672894 }, +} + +Object.keys(config).forEach(chain => { + module.exports[chain] = { tvl } +}) \ No newline at end of file diff --git a/projects/popcorn/stakingPools.js b/projects/popcorn/stakingPools.js index 15ed46f1ee5..688ed2e6f5c 100644 --- a/projects/popcorn/stakingPools.js +++ b/projects/popcorn/stakingPools.js @@ -40,7 +40,7 @@ async function addStakingPoolsTVL(balances, timestamp, chainBlocks, chain = "eth })).output; const lpPositions = [{ token: pool.stakingToken, balance: stakingTokenBalance }] - await unwrapUniswapLPs(balances, lpPositions, block, chain, undefined, undefined, false, pool.isGelatoPoolToken ? 'gelato' : undefined,) + await unwrapUniswapLPs(balances, lpPositions, block, chain, undefined, undefined, pool.isGelatoPoolToken ? 'gelato' : undefined,) let tokens = Object.keys(balances); for (let i = 0; i < tokens.length; i++) { const token = tokens[i] diff --git a/projects/steakHut/index.js b/projects/steakHut/index.js index f24ebef54b7..771e45a35af 100644 --- a/projects/steakHut/index.js +++ b/projects/steakHut/index.js @@ -1,60 +1,21 @@ -const sdk = require('@defillama/sdk'); -const { unwrapUniswapLPs, } = require('../helper/unwrapLPs') const abi = require('./abi.json') const { staking } = require('../helper/staking'); const steakMasterChef = '0xddBfBd5dc3BA0FeB96Cb513B689966b2176d4c09'; -async function tvl(timestamp, block, chainBlocks) { - block = chainBlocks.avax - const balances = {}; - const lps = [] - - const transformAddress = addr => 'avax:'+addr - - const { output: poolLength } = await sdk.api.abi.call({ - target: steakMasterChef, - abi: abi.poolLength, - block: chainBlocks['avax'], - chain: 'avax', - }); - // const poolLength = 13 - - const calls = [] - - for (let i = 0;i < poolLength;i++) - calls.push({params: i}) - - const poolInfo = await - sdk.api.abi.multiCall({ - calls, - abi: abi.poolInfo, - chain: 'avax', - target: steakMasterChef, - block: chainBlocks['avax'], - }) - - poolInfo.output.map((pool, idx) => { - let balance = pool.output.totalLpSupply - let token = pool.output.lpToken - lps.push({ - token, - balance, - }) - }) - await unwrapUniswapLPs(balances, lps, block, 'avax', transformAddress, [], true) - return balances; +async function tvl(timestamp, block, chainBlocks, { api }) { + const poolInfos = await api.fetchList({ lengthAbi: abi.poolLength, itemAbi: abi.poolInfo, target: steakMasterChef}) + poolInfos.forEach(i => api.add(i.lpToken, i.totalLpSupply)) + return api.getBalances() } const steakToken = "0xb279f8DD152B99Ec1D84A489D32c35bC0C7F5674" module.exports = { - timetravel: true, - misrepresentedTokens: false, - start: 14003811, - methodology: 'Counts the value of JLP tokens staked into SteakMasterChef.', - avax:{ - tvl, - staking: staking(steakMasterChef, steakToken, "avax"), - } + start: 14003811, + methodology: 'Counts the value of JLP tokens staked into SteakMasterChef.', + avax: { + tvl, + staking: staking(steakMasterChef, steakToken), + } }; diff --git a/projects/zircon-gamma/index.js b/projects/zircon-gamma/index.js index 86eb8d368f5..af8f5beb6ec 100644 --- a/projects/zircon-gamma/index.js +++ b/projects/zircon-gamma/index.js @@ -12,6 +12,7 @@ async function tvl(_, _b, _cb, { api, }) { target: '0x09f8E0aeA93Bcb511276A166e6e57E02e5cc1E0a', topics: ['0xab83557b3a718996d408afe08287d09bafed3590c7ae61a430d518d3199d4590'], fromBlock: 3587214, + onlyUseExistingCache: true }) const tokens = logs.map(i => i.topics.slice(1).map(getAddress)) const pools = logs.map(i => '0x' + i.data.slice(154, 194)) @@ -26,6 +27,7 @@ async function bscTvl(_, _b, _cb, { api, }) { target: '0x05d5E46F9d17591f7eaCdfE43E3d6a8F789Df698', topics: ["0xab83557b3a718996d408afe08287d09bafed3590c7ae61a430d518d3199d4590"], fromBlock: 25836698, + onlyUseExistingCache: true }) const tokens = logs.map(i => i.topics.slice(1).map(getAddress)) @@ -35,7 +37,10 @@ async function bscTvl(_, _b, _cb, { api, }) { } module.exports = { - misrepresentedTokens: true, + hallmarks: [ + [Math.floor(new Date('2023-03-18')/1e3), 'Protocol was hacked for 350k'], + ], + deadFrom: '2023-03-26', moonriver: { tvl: sdk.util.sumChainTvls([tvl, movrUniTvl]), }, From 80fb30dff26e0fc5dff57c4dc465f23bb6cc0d9c Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 1 Sep 2023 18:08:39 +0200 Subject: [PATCH 1084/1974] stealla: track traderjoe positions --- projects/stellaxyz-io/index.js | 53 +++++++++++++++++++++++++++++----- 1 file changed, 45 insertions(+), 8 deletions(-) diff --git a/projects/stellaxyz-io/index.js b/projects/stellaxyz-io/index.js index 4bb1910d5e9..6775d0267a8 100644 --- a/projects/stellaxyz-io/index.js +++ b/projects/stellaxyz-io/index.js @@ -1,6 +1,8 @@ const { sumTokens2 } = require('../helper/unwrapLPs') const { getLogs, getAddress } = require('../helper/cache/getLogs'); const { cachedGraphQuery } = require('../helper/cache') +const { graphQuery } = require('../helper/http'); +const ADDRESSES = require('../helper/coreAssets.json') const config = { arbitrum: { @@ -10,6 +12,10 @@ const config = { } } +module.exports = { + misrepresentedTokens: true, +} + const query = `query GET_ALL_LENDING_POOLS{ pools: lending_pool_registry( where: {_or: [{is_launched: {_eq: true}}], chain_id: {_eq: 42161}, is_deprecated: {_eq: false}} ) { tokenName: lending_token_name poolAddress: pool_address }}` const strategyQuery = `query Strategy { strategy( where: {chain_id: {_eq: 42161 }, _or: [{is_launched: {_eq: true}}]} order_by: {display_priority: asc} ) { id name strategyAddress: strategy_address }}` @@ -17,17 +23,48 @@ Object.keys(config).forEach(chain => { const { endpoint, factory, fromBlock, } = config[chain] module.exports[chain] = { tvl: async (_, _b, _cb, { api, }) => { - const { pools } = await cachedGraphQuery('stellaxyz/lending-pool/'+api.chain, endpoint, query) - const { strategy } = await cachedGraphQuery('stellaxyz/strategy/'+api.chain, endpoint, strategyQuery) + await getStraegyTvl2() + const { pools } = await cachedGraphQuery('stellaxyz/lending-pool/' + api.chain, endpoint, query) const lendingContracts = pools.map(i => i.poolAddress) - const strategies = strategy.map(i => i.strategyAddress) - // const logs = await getLogs({ api, target: factory, topics: ['0x0803371633b57311f58d10924711080d2dae75ab17c5c0c262af3887cfca00bb'], fromBlock, }) - - const positionManagers = await api.multiCall({ abi: 'address:positionManager', calls: strategies }) - const tokens = await api.multiCall({ abi: 'address:depositToken', calls: lendingContracts }) await sumTokens2({ api, tokensAndOwners2: [tokens, lendingContracts] }) - return sumTokens2({ api, owners: positionManagers, resolveUniV3: true, }) + + async function getStraegyTvl2() { + let hasMore = false + let offset = 0 + do { + const { position } = await graphQuery(endpoint, `query GetPositionsDefillama($offset:Int!) { + position(order_by:{opened_at:asc},where: {status: {_eq: "Active"}}, limit: 1000, offset: $offset) { + id + position_value_usd + strategy{ + id + strategy_address + lp_address + pool_address + } + opened_at + closed_at + status + } + }`, {offset}) + hasMore = position.length === 1000 + position.forEach(i => { + api.add(ADDRESSES.arbitrum.USDC, i.position_value_usd * 1e6) + }) + } while (hasMore) + } + + async function getStategyTvl() { + const { strategy } = await cachedGraphQuery('stellaxyz/strategy/' + api.chain, endpoint, strategyQuery) + const strategies = strategy.map(i => i.strategyAddress) + // const logs = await getLogs({ api, target: factory, topics: ['0x0803371633b57311f58d10924711080d2dae75ab17c5c0c262af3887cfca00bb'], fromBlock, }) + + const positionManagers = await api.multiCall({ abi: 'address:positionManager', calls: strategies }) + return sumTokens2({ api, owners: positionManagers, resolveUniV3: true, }) + + + } } } }) \ No newline at end of file From 496ae6c9192fe12e9434e9f33bb517561f7208b3 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 1 Sep 2023 18:50:26 +0200 Subject: [PATCH 1085/1974] update liqwid --- projects/liqwid/index.js | 72 ++++++++++++++++------------------------ 1 file changed, 29 insertions(+), 43 deletions(-) diff --git a/projects/liqwid/index.js b/projects/liqwid/index.js index b625accae95..d6894583c31 100644 --- a/projects/liqwid/index.js +++ b/projects/liqwid/index.js @@ -1,40 +1,6 @@ const { sumTokensExport } = require('../helper/chain/cardano'); const { graphQuery } = require('../helper/http'); -const scriptAddresses = [ - // Ada Market - "addr1xxqqegnx4ref4q6derz2n0zs0jeanaxdq7ynfhwv3luhsg63z228hznt0rz2enxfzhtk2270gels0ht9uvf9wmyxs99qgwkkf2", - "addr1xxqqegnx4ref4q6derz2n0zs0jeanaxdq7ynfhwv3luhsglnschmu7dwefmhkd078735ucq2yh90ylkzxrenz9cy8uds3gzd0f", - "addr1xxqqegnx4ref4q6derz2n0zs0jeanaxdq7ynfhwv3luhsgcfpkhcpsthxpprf49lvfy2jhga5mygpfcj4qaypfzkmhnsw9rpx7", - "addr1xxqqegnx4ref4q6derz2n0zs0jeanaxdq7ynfhwv3luhsgl0sfgalgyvgedlnhfl7u2059dkyhp453hm86797rm5qhasyaak0d", - "addr1xxqqegnx4ref4q6derz2n0zs0jeanaxdq7ynfhwv3luhsga3q9zvxe5ehfytyye9m3dq3knvuz2fdnax7lhhjm4vvjgqlgr6ws", - "addr1xxqqegnx4ref4q6derz2n0zs0jeanaxdq7ynfhwv3luhsgmys5sq3xea3866499dczkshygljanhepcqjfwyhe3fpadsa5wd69", - "addr1xxqqegnx4ref4q6derz2n0zs0jeanaxdq7ynfhwv3luhsg6ypq27sagqxt4jwt57mdsef3zu65ng4zmzxaa246s97nxswjed26", - "addr1xxqqegnx4ref4q6derz2n0zs0jeanaxdq7ynfhwv3luhsgesaw6lwmnlk6z0aehzea9nwfvdvang9v42yylt83ym8zqqrjh90k", - "addr1xxqqegnx4ref4q6derz2n0zs0jeanaxdq7ynfhwv3luhsgelzwuv27k9keyjpag32pmx9mf63tn77feppvm7d0s5ndnsct59as", - "addr1xxqqegnx4ref4q6derz2n0zs0jeanaxdq7ynfhwv3luhsgmupshega3f5ym0freunp0p46rchpthvsyty398fh0msyws7wkxyx", - "addr1xxqqegnx4ref4q6derz2n0zs0jeanaxdq7ynfhwv3luhsg70l2wkhq0pr72jsdrv2kn8v3pqnrt0qykpq9fwr2wn0czswer98l", - "addr1xxqqegnx4ref4q6derz2n0zs0jeanaxdq7ynfhwv3luhsg6a0x7l0scsd0wvfm3ljugdpsu4kctwfjyud65xfeht5uyqr02la5", - "addr1xxqqegnx4ref4q6derz2n0zs0jeanaxdq7ynfhwv3luhsg78jkqyfeeuz5m6sfv27g9vav8w83lsaqewjqxnpnpjd9wsmng4ka", - "addr1xxqqegnx4ref4q6derz2n0zs0jeanaxdq7ynfhwv3luhsglwdw2g8sat0hr2pdt2ct27n33z0w6dzsfy684ut24gjfsqjxugry", - "addr1xxqqegnx4ref4q6derz2n0zs0jeanaxdq7ynfhwv3luhsg6s80extwffmz4yagvdxvr6cpd8nm3qne020739j706h3jqsd0vf2", - "addr1xxqqegnx4ref4q6derz2n0zs0jeanaxdq7ynfhwv3luhsglccartl0f44hvc4vq8n3042epqvqq8cd4g9znpl5kdeyps7frwge", - "addr1wypcayfxkqgnh8zfdsj9kft2hlpfvgtpmrkjlcge2e9rjvcelddkc", // batch - "addr1w9afj34vc68qdm7heuz7esmr8sj76wpa45t7dh3ag8xpplgml3zuk", // batchFinal - // DJED Market - "addr1w8dprfgfdxnlwu3948579jrwg0ferf5a63ln8xj0mqcdzegayxmqq", - "addr1w9wjz8tjt87gldh2usu8t5mfe4nkmlngp30a387h8s94fyg5uup5n", - "addr1w8f7k5z4casxhcvz3vf5hlnt7fhgt5209t5hm36pdpduv6qdwf8ny", - // SHEN Market - "addr1wyw3ap36lnepstpjadwg8cg73llvmju4y94kmfld23lkzjggq4hyj", - "addr1wxrxa3ucywn3lqpkzlyucak0a7aavkudh49fqt06yc05sws4l4zs2", - "addr1wy6e9jukn8fpx7kesrpmapsnmz0cgq6lnskuff0xc0junggv6gd8l", - // iUSD Market - "addr1wyslq7j0q9kq2ve28yzfgv5fdz4nzfay6cup2r634zr5zdqlhptgt", // action - "addr1wxwwjr76m4cgn6768p9ljg2jrg08evhrvh0wdq0q60327rqfenh4g", // batch - "addr1w9p7xj8wxvgpfjs532a8nmue69zj73k8644zes7vmg7c72s8symwu", // batchFinal -]; - module.exports = { cardano: { // tvl: sumTokensExport({ scripts: scriptAddresses, }), @@ -61,6 +27,14 @@ const query = `{ qTokenPolicyId utilization market { + params { + underlyingClass { + value0 { + symbol + name + } + } + } scripts { actionToken { script { @@ -73,30 +47,42 @@ const query = `{ } } }` - const tokenMapping = { ADA: 'lovelace', DJED: '8db269c3ec630e06ae29f74bc39edd1f87c819f1056206e879a1cd61446a65644d6963726f555344', - SHEN: '8db269c3ec630e06ae29f74bc39edd1f87c819f1056206e879a1cd615368656e4d6963726f555344', - IUSD: 'f66d78b4a3cb3d37afa0ec36461e51ecbde00f26c8f0a68f94b6988069555344', - USDC: '25c5de5f5b286073c593edfd77b48abc7a48e5a4f3d4cd9d428ff935', } -const getToken = market => tokenMapping[market.marketId.toUpperCase()] + +const getToken = market => tokenMapping[market.marketId.toUpperCase()] ?? base64ToHex(market.market.params.underlyingClass.value0.symbol) async function tvl(_, _b, _cb, { api, }) { - const {markets} = await graphQuery(endpoint, query) + const { markets } = await graphQuery(endpoint, query) - markets.filter(getToken).forEach(market => api.add(getToken(market) , market.totalSupply)) + markets.forEach(market => api.add(getToken(market), market.totalSupply)) } async function borrowed(_, _b, _cb, { api, }) { - const {markets} = await graphQuery(endpoint, query) + const { markets } = await graphQuery(endpoint, query) - markets.filter(getToken).forEach(market => { + markets.forEach(market => { const utilization = market.utilization const availability = 1 - utilization const totalBorrowed = market.totalSupply * utilization / availability api.add(getToken(market), totalBorrowed) }) } + +function base64ToHex(base64) { + // Step 1: Decode the Base64 string to a byte array + const binaryData = atob(base64); + + // Step 2: Convert each byte to its hexadecimal representation + const hexArray = []; + for (let i = 0; i < binaryData.length; i++) { + const byte = binaryData.charCodeAt(i).toString(16).padStart(2, '0'); + hexArray.push(byte); + } + + // Step 3: Concatenate the hexadecimal values to form the final hexadecimal string + return hexArray.join(''); +} From 41e553617dc9096fbed4b74ca32a625f5d51db9d Mon Sep 17 00:00:00 2001 From: getUnrekt <75529443+getunrekt@users.noreply.github.com> Date: Sat, 2 Sep 2023 17:59:43 +0800 Subject: [PATCH 1086/1974] add base chain to acryptos protocol (#7361) --- projects/acryptos/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/acryptos/index.js b/projects/acryptos/index.js index 12c7c9d576e..423c70623ff 100644 --- a/projects/acryptos/index.js +++ b/projects/acryptos/index.js @@ -64,6 +64,9 @@ module.exports = { avax:{ tvl: fetchallchain(43114), }, + base:{ + tvl: fetchallchain(8453), + }, harmony: { tvl: fetchallchain(1666600000), } From 407cae53ae80ba1ef02abcaa817b4710d5e24a7b Mon Sep 17 00:00:00 2001 From: ExtraFi <110192631+ExtraFi@users.noreply.github.com> Date: Sat, 2 Sep 2023 23:05:46 +0900 Subject: [PATCH 1087/1974] add extrafi on base (#7362) Co-authored-by: momo --- projects/extra/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/extra/index.js b/projects/extra/index.js index 8bef68cf25d..edabd63e72c 100644 --- a/projects/extra/index.js +++ b/projects/extra/index.js @@ -3,6 +3,7 @@ const { sumTokens2 } = require('../helper/unwrapLPs') const config = { optimism: { factory: '0xbb505c54d71e9e599cb8435b4f0ceec05fc71cbd', fromBlock: 96265067, vaultFactory: '0x155620a2e6a9392c754b73296d9655061525729b', positionViewer: '0xf9cfb8a62f50e10adde5aa888b44cf01c5957055' }, + base: {factory: '0xbb505c54d71e9e599cb8435b4f0ceec05fc71cbd', fromBlock: 1960257, vaultFactory: '0x155620a2e6a9392c754b73296d9655061525729b', positionViewer: '0xf9cfb8a62f50e10adde5aa888b44cf01c5957055' }, } module.exports = {}; From 9258b909e227c6ccfa1d309bd956fd3f9e1ec6a5 Mon Sep 17 00:00:00 2001 From: Tan Date: Sun, 3 Sep 2023 05:27:05 -0400 Subject: [PATCH 1088/1974] Update pool addresses (#7310) * Add duckpools * Fix duckpools implementation * fix imports * add nullAddress * fix import * erg pool * just erg * only sigusd * only sigrsv * only quacks * final fix * add collateral contracts * Update duckpools.js * Update duckpools.js --- projects/duckpools.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/projects/duckpools.js b/projects/duckpools.js index 67e09bfe3fa..ef494c33609 100644 --- a/projects/duckpools.js +++ b/projects/duckpools.js @@ -10,10 +10,10 @@ module.exports = { "6Q6fbqfbMAogw42DWDtKuKt9frSKdqW92cmiPbeF2SnuYCS9Ca43ZAiJvR7KjZoWJZZTvABJafgBobWJmGkqMNgFsnp9YQS3RjCagcJdgr6nisusAAuz2wEpxXazzQPYdstFxNiW9ewnL6usAry4nyaydtEUuCaBf3yvPsdGTh9w9x4PLcj9rd71JzNBx9yS8hVd4H61hKXZgE51UQqsrQp9o3qYp4b219R1x6Cvj3ejvBDYanjomykDi8KLv9doW4BgzSqvoTf5hiHK5rcbt4Kf97bZD5hEyWZidNW2R1hpJM67tG2uNt4XxstCptGvH1Kp3ehBm5v1N7CEcUdJQBqHTrZ4Bj7Fwkg1vK7NZQExqHEE9MnuRmHPYtn4SKegR31WTUgR9RcHZ9QgW1a4adT3eR679mjWSDYmRMAt6BjLGK66a1oaZfunFDRz8fDU3hzhoSphTzo2wDvFLWKqsCW7GWY4FPnvnGJBEyet8vd2VwLYoXtHjivhoZYubiHbWFewng7iNeYy1wHWETrLyK4L149yqVVgL3EK6p9e9TURurcKvxFurp6FGFsfEniMdc1z8n3qAXizxKEQLkqmLYd2KBVmF1uXwYhphPha8pcLx59zJfEtxww5Ch6JhTRxmDkfBqXP4Qcvz3b9rFWBsqGVDyKPm3BkjXrrxgv3H2Ryi8WJMKFBNDCZ4YxmeegAfAqgNPbaaLzvYygQRzZ12xxKuqAKcLTSEu5ETwi6BMGpgXArxDbs4utwZahsecVAcn7qBWwnF3ropdSTLBUzwW22udy2CXaXgcpRaQi5dufF93dnWZpHc5ApKUXdN7yorTELjh5yq1RauiQ48zWH3zA4WixyZMJ7raGA7HoNh1mewqfSLyFHGGUgfUTynj4xjVgLyQWZ1yBixjF8ByFeuqXK81ExDnFiqF4zVgZRWE2bKJyBViw7i9BvJL4kPRbKm5WLkAUv92QKuRuLSxnjY2KBG46unAVsAsKoDHKeqsaBTKAcka4kn37pwtefTadqt1zJiUEJLoNoH1wp2P93fWqCVN8gaRdcZRJ1kLoq2sGbznpGSK8ULBBqmpDXcdjC7tNAPMp87eYXsNxT5HFX38yjKFheyVPNSMxj784r1TuGe6MC7PPjHdXbVNFsh7aRKTdRPUiDdrZhqZ7zgfziQsZR3izSVgjDS4u5rjT5NjNQn8r3LzNfaXPtpoCCp3Y8f5zwF9kFpu61ZgwhiSuTRARth8su8kfibqZqmE99LcEMzRd3KvzUcLLcDA86Xmz2XbLaMRxJ72yZNd17a2KN5sYpjhUi7yb2XtKsDpfHA14wsDcFsefC1BzpQpjQ7sgrHxpQPNU2dFujjjF7pEySaVHiVfvvXxd2LcT4WfXcdksLfpxyZVuepWdNMFYkypzHV17Q7ca5h2SQY3DCjkShmqozZLACGkRUyTH16PPHtDAicofcAenoV34HECXcyy4kqdCLrFMSBsVs3gRGt2hY5j2d1Uo8MU6wo2iSkziWCJwGtP9TQ2saiY7kY4DYTYV6ZN3tpM1wrdhaxw1fcrLnqinQXL1U1WzHNDi9JTK1c5ESUct5dWf6tLdLWpDemX1NMP2RCDTe1TSYYWyHRCX3Akog3dEqZKTk6nofanV4Vw1MjJZWHaeXMVcvr8g3sN9vpwjyQ18WQ8ErtNzTzYiChd4gr7pwCc74kdCuD519s8zAa89XYnodqCiejgaxutY33TYSp9atpgXKUmtDaeV3UzQnx", "4z9dZrkxdYok1tkUF56Emr1XAzzi7VY8rTzxZ4qtv7VACufMJDQmbBVsgAjVhCwtjXtKAW4bhLMvZJ8NQwsMcHQXjEP9EN9TnNHL8P6bQjWy2oNLnTrigaCi58SQG5BQhEN1RG4akwss16eHTZw3nhhpNqrhe2y2TBvr3JukYdWJXWN1An7ZZ8pzV6ma9GkrXHoFui6eWqn8PYM87HMRDivdjt9wQQuRDSgvV4BXBxheCiWyL9bKtKs1EoLybK76UyVykiF2CZGZ192bPXrBGrNaucz5xBV67sp7zD1X7V3vnw9kZ86Ldwik57VKUMDHwUniSZaQ5yiVc1PxBXMuuTfgtvff1vFDhXhYaspeGCrvcDDC3QNPkKvXddpteqYCzvp83wk119wuPccYJ21hAz6QQj1Znz6d1L6LFSeoykXoR3SiAw9E69LYa5vocSTasVqqhQJhZnygtSA1zPxCKaFtJ7CpVyW62Fy81hfboVXfdAFJvM8LKag2aJHErEeWgT7wX5KtDK1cHwvNbqfGqDBr8zYgGQ6K7YG4n9e4B3R9knAb9qdouKpR7D2x5NMfuY6RxHzgnG2Kpzg2cA7gLJVWXeDK6KiN92ddcjTfgdR4K7kPVbwYvbXEtKmXAWVfx6ngizxmDg4R8ZAV4pTwWxb1wjgqpycErXXrSYUBy7WRkRMhkihnp3Ysfz1XpdHunQCYYAeUTvaGPnaebwJVaTKy9rv3DTmyCiS7qrfNxxPr3BrcrdzVxA49g3Rkevn4v2ECeLppgsyB2YeC38gCWES4GSebzRmgHZ2jqwTd3arCU1ZyZTv2inM26ey3csxDRzbvA9V31V9AWZreqryqsB76NX5iJnmzpfyBw9XqGXACfQanWydtPmWBok9bDvVS94B7LYdoCnJwFMeS4NvT3PouWMLWrBaHJ2xWgWxisVAbhEjxrKpc4SepkmndfkYdi6rUabaBVbPgFjb9eZttHpn6tY97SyeZqZ5cBeoRwL2ywMD6VFUijfw2bNGNKG384kEkqTEscgZ4zZYapvFgVh1mM7yKQJ6ZMbPpWfTtqzJfBsoewrfJCVnneeVNxPydR4yXeVGTUDUChuD29dxytjzA7ucXATq6hpdLzYgBou611fWLKdCMHsLptzCMo3FZ5qHyPGoTwx2N14iTqFTs4yMimhCSvUsRtWyh8ALh2GjRjCgRKW1aYMNUTcGAfgs63mTyENCatGofQocHYCPxThaAiMvHfxK6MhGH5uni16iwPsTLGzKtSa73X4jiA4mk1KbAn6HTTnz49SAy3SqJC41owi4NULGvHFz3J8hMdUgK9K1X9opJnW1Ma6oirQQU6NsR9FXjzMMBRsyRF4FRjjty6t17Mikn7irP6dMSfapigJwTdq63T6opUAswEVM7WYxVB74Co5G4nTGrAPBoZMHHkqF5LH9Yyw1r5BSRgvAqTTq5SHt7KsQMTD16MKcMFcwVVqMiPLVAa4YHjYpCFfG5MKG7vMsE9p62G3w5pdcPMD2AG2KsTqYc521DkmvknQe8CAojTS9Dd1zzKM9vWkj9ror77CaYi8TE1oZufpqsBUWw5syBmpXrMzWoBm1qT4bcYy6npTmfFfG2NVbdZYgCEGAnzCEykuMuNXtd5WAfML5MwWoXbRuwWo7gzXnHZCtur3yM67ZPQZqWrvz2PJ6QU841VN9bVV9T1YptceyTKWkrjpnd64VbUpiXbe1cCCA8GuKcJwq5d7sw6uYQjU9tsrHr1v9ZiVoN", "6Q6fbqfbMAogw42DWDtKuKt9frSKdqW92cmiPbeF2SnuYCS9Ca43ZAiJvR7Kjfp99STcigCqWYCTt7JzqeFASVd7q9nWZacKKe8bGKNN4o7y4Pzd6mZ9foAEXKzybfc2HDuvG2oCoxoAMC4dsnnvNwjAY8kYozoSdCfX6BrWj1NF6unYaMCo8es9sZJiUS6j26F8irUz4yNjPpLKgxxGxBUTGvgo2qRW59xHS6BQruPfPsJjvEYvSz2AeaVqxnw1jgtvBjX2ERB2pfNakZ3zC3B6aNSPFZNsA7QZBXUgvG9q1A8KXLMJXTYJ4RPYk7BcHoAvjdUj391nt1chC9g3P2vUZFo2DAzoDwbNtqr22ueNX8vhC743CAUVzvDSei3KXp4MFLeWuiAYEd7vvSMVPLMdy8Ak73McqJLH1hGPzTKsuDxeNmuxbpNGuuRzHSPNeo2mUcL7afg9z2mkZM6KLYQ4VTsRMXG9NT6Qx218xy4ok9qcBwaNnZzyoeHa28Hkm4urRwj1pDvUNj3pxodzvLVYQdGZ46TXf41MLsWL5oBRWXEKSpNZt3XLDeK1V3bvoSKxyHWUskVWKqtdYkdb1wc6pt9r5WH1Ndjk5RQ3whG4kW17rr63CuATNBRxtwt7wsCno8bRnLtnnLEyMK6KhBVRHKpPHRQELGecp7d8Ze8zoYo4Vz2VFQQ7uzaGDrRuyKgPhNhUh9rHk3CSounphWzc4CqGxqqyt6JST7YvBxDZDVDnDzJNGgVjXwJfTXmkz6PFwohCjZRr5JvBtQ7vJ7Y9kCRoq67uWrPUB2jzTYJ9NWTNpeN8z4rCU2h1i7m5KhKwuHEJheuLVpmFXYRQsFiVW3128jRidN52JqbPbSnvaDJ1UrXHd6yqzV8Xr6C9bKecv4s61maHp3t12WFovqSg5VzJAH2cwyyxDatLniGBuFb71jjumt6iNvvxBsE6zcLTr46ujspUXv7aNmsa2df8th8m1iHDDL4xnSKetRFgUN8DBUUSudyBZrS9PU58noS8gvH543YDVQLczvTaA6c6TDtCXvXeHUu3i1BEvbQAX7jcFJao4U1fTX7Cvb8DRehy9RLtsvZvjh9fWkGtmf6dmjgKWnzWTiZ8ibNheZ8wkMWUWafDRCr42kKmRzFNuirg8y9YaXfLBMYbvkQ3kwkVmC4kgyFF2MhaEzwVm5EXEZVX6QZYxKWnhrZbzVXuWGDu3Eb3uRLfPuhm7GhdeLbhK6dm6eYZb717KPwKpqBChZs4Mo6Jsi9HzxycPG1FzXDgruXaAt1esQDvoS2MYc5NPqkPSeuv5L2EHMEq2FwiwcJhPHABTTYEfH7SYmCsatXtkgRce6o8DVVT5Rd45xWoiNKxCeGU2apPHKv117fo4mQUhBNftKVNBytGGu1RRsrCknQVCFJzeWxCc2CFs1nPz6oxt1EueU7jmMu4qnaU8BBbzdgJ3DaKeVysVhNsuqPvqUcvYhnmVFK5RPJHxiLA5Vp65zWHvL69AmWKGxP9EsFY1tqLqSPGfgJ3Xvz16v1Kg2kbCda7ZGk6sn1e4ry8UkhQLkfFQxqFnHxgTn85Dfp9kWwVsRPKxM4EwQmPHNKpWg7rT2NdWz8D9Ggm5yV92YarSWQZGAWFuUV7pW4zZ3vmsn9Ay51mh2C4VFHWEGjnH91cNwpgNBVWt2AtVeW3uL78fDiYfG5iprTFyySLBc4rdHQZQofhdyz9p1hAJGC4iRFyi2RoNX8GsX9GrAAnt", - "U2qJxzZiTGZmLdq3KoUQQYgtqfd7qf7ijBRfVevSbwayZhthUkoGASnJWhTz557fLDhMBomwj3bz7m7FSn5m7mj7eJJd8yF6HZJSe6BLzMAa5L81zgPWHo3ree6atV8zjxNbaaKPpiRkkPJT3wuS15ue4jc12jCwjiwa2TtWgA7D5AamU6iytVu2HKTDgvYcQCkF3PhrYRMVmx5Z2zDDLhx1dbJuraLGyPv1CW5VMvzBKA5FhYD2EY85UUQ6wBDMnitksVsXC7XCo3MEENBQBFQLFcSN2BzYRXx7kUhigdo79SFyKBJdXtc2i51hvEvanAYVogkNFvW3XPDKbSvXg3CCo8T9nQgVqMEALfTNpu1AYvCWG7Z9m6Fd4evXQgr26oqfnkkXrrXtJz6qszucM1WEwYN1CGy6BTy9n5ssKEWabx1XwomuN9pYV5wpUjEDKLKJ4zLmutuaQKps3ji2bQBjSxtREFib9Az5h5jAPTFvLckWteMfQXrNFVzWSBqK1os2LM7PVVvS5BwoWupHzVsfc1ZFKAyjmJaEXZJUJ4cDmzZzamJcC3xFtEsf3F7aWmMJkgbjZSPB2gEQU2HDg8Vr1u4rMRHVEXYdXt8ZB2fvnDiMbZAb8SWJZnfD536NcEnRFqGnFuLG7UNVqgKGbkUfv8BGcaH6R9wfq8t2WyRyJm2eNVAu6No5Zrhuxar6XQHkSL16vnsXzbD3TFAoJiFZnAJzrga8hPf9jDnbLSpVa2GPPR5yMoQ2RdrdAQ3GkZqtTdbyYoSH77wJ8rvGRk9DFhFzGBPD5qcyrJ4yMugwHpQPQWHrYf2HpyAGRUornTt4uLn7PLiHBE5AfsKTsiqLrT675engFvGasaHTsnWoS7SEBsKvNvF1tHETbCd7Ehf58ZpmzRJ1FotubzLwRxzNHs9HZpfpPsSr2Gm5h6m7WZCAgHvoVvfRd646K2sSxJBc5mAWzxNMFJ9ZYRUnZsKuoGDgtxEX7cD27sJepL7RLPoofMuiFmnKBVgmpSeP58vMp1SDVerqz1WXumepYwoLaK5co9HuXfP9MS65KqHrDALE5kTRi97n5kC2JvvqzeruPVY8U1yNsn1wC1Q9meZxBjeB8jkX9SWNP5dFvqmJMiJ3Wt98QJQxkxKeubt8oC36Dzobb6FDncTBDgiTAQVUZ9tS3GQ6spx6PBBPLdEDixuZoNGAmKzCaffCQ6LPvMFHhawStFY19DmsMykLqP84ZnzsARpjV68RHGZzV9uwxHMhppnVNVWeNTdr4egkjFNVJ7qBLxjTbaoxn7EEgcTuRUbie5T7EFc2djNUxBqB6P2Wa1aWisXeP4Sd6z946mwqEKp3yZTFkQsFAM4v7BXv4WebGocWMVU49UzVsmdznPmoBBR1xqyGxjKk2va3WwCHTJxbmV7NVWtcpWbePxCKRFhvA16AcPHfeuuJejJVQuDwpqfRagt8DTNxNukyqtrMgk1xvZpVhtJWEsoeUoYa2gED5T4ywNZjCEgC89qc2gjbr2JgRcmQ1zQoCXj4Cii2D8wdh1CRAxjMbERj8fBmKwpseKWSYmsjohFFLyFRsKRb3mE36kPp8c4GULKJfDnVVh9SQKqKB9aT6wNW7LXTtMjtovJrjKQvxTytihvHCNeuJ43ds5Kvz5CcNudzGZTwUon7L41Y6djHZrvZ5YY1Yn4nKKeVNxbsvCtpm26Z35BNdRzf9Hk3iceBsBWFw8we4aLxzaK7YVZVFo7qnNWcYtEznJ4FqMq76jGYSfdKMaQQuUTuq6uYDKj7WW3FxJdLgqBTjYsJcNe4yaxyfNoBdCjtkXcEahuRBAZ7WxAmXCwkqAXKxoqrJbiCN9UBvheQTK16DzyjaursnfvJS196PFZnNZZgceYCvpQ6PGaz2fnPSChN5vXzC39an8mFXn5NPDgPG5WWPtJHj52G6bW5p9CqM5f6DMekz8APCxY195dAkytj7GFLh8GWqZo9GjTMdMELB9QLcFBzJgXWWPQGyLZ6HE5BGEAPatmMhq9VG2R1YzRSYf7h7naxycNazqeDdCUb3PnfxHzosz1JLmnNUt3kvgK8P3e1wfsqts7U3X3U9vFsxnkciRuaapm2evjtnKwPqPXhpXcodJ5UjVeaCfiV6xoatDyt8mmFo7VEP7D3KJxMRGnypVWzNh5QYQsF4xtLqBhm6PbK75DZfUNr3v7YNqLoPzYbxzvhtx8BRPHpC6GnqfegkFqgYLUZTfY1CDWDEdNeWVCEb1BNdWTm5vTHCS3GrpV7rW6UrNrTfJZV6HXFuLDRR74pVb2APgLGtEqxobpe9N9VKw2jq1kfGqCfjWAZLrHdZnWUbvUq16i4SsoRKFgaXiGMw3SMF3NkMn6z2xQL1PPs29d52", - "5Nr9d8S1RDp6crFDoBxSWJPv6MkK2kC1eGCs4KGePfmTADrKJG4USaojjLyj2yCC7iSpaB51hq4roGA5xkD4gQBN4cRgbAVKYYq3xhGjWwzAT9p5PhLz2LShXysuF3qTTN25pmpy11uZsrRjiYExhFbKJeih5mkEHAzTHCS9jWaCsodVzPSSbZeScqYtgERen1ZNruRun3kdU7jCiWQ3TXPUAs3CD7XK7VjzoVGbugTGErXdBVeEpubtDnQRv6VSNrCgAadw3xyXJfpwzZj3HwAUHzxcPqzXfLvGyjjDtx5dBWCgdKJfqoPNnW44SWxtWsHo5uNCC2EDeKxnyKvopx3tGhopCXMJnhSc4GYBpuKabYoRE6vn9R455acRhc6SJzYx7UwcfaipL73LNXig4oPEdoQvpAEu9SkF2GCXY5ReaBRjShou6eZW7HcTp5qbuEnxFhnpcshh892XQw73uFGQ4wALacAynQNTPHhzfgCN1sE2SgYfphtdLoHXDS2HXKMaydMmcV9SHac59DmLd7VWP2v5rWr89U4PBfTVw7exNzJCNfZfFWSrZ2V2SwB8U4MN8hS5xYX76dQbZQDUk6BrtpEW9xTZWHVjBR7bzBsEWJNovv6SWbfkDEiVMJfhWwWJJ7kG5xjPCa4QicQ1CuYeCS13ukd7t3DAqko9K41XmhxDzC5r8z89KQKSBK5FnVpWLHYqxdfE3NcGKcBFJhMYyZvkaaRaFazfkH3bhGFeyg6W2LJeroTo5NNiE8oPMkAwzdZDbfo1ZDmDbWV6uvSjVERsG1d1GL6ay5VJsCCgxTyaQnEMMxxiqcWFi8M5xdHRxTZaThf8SJ7NocAdwJsT5YRrcaefoZWm9ZkbWw4SRXUxM7x4BhR9i9PAMxg83j1MWQMj1qgC6gsZ6cZ7BsJKWNJzXojEwxfun7QHqZd2pLHDjb1bpWtqRcgfQWgGvSgWQQSjQTpmvxavPz8sDDGdhrReM1fWuxYQNLPmSxZ7ZJmackFGJTjnCgxyJkHv3iHQ5u3vPA4uiuRJPQLV8oRdhWci1YjcPCRRSamygAKnkt2rQyxwouhx87Z8KTmj8S5j2JReinzMZFenAfVkMGnPdGqPGrMbo9cpvf1YAFriKAAHeiUR63wjyLcozw1BvcGpyv3nNQZkUD34k447KDu9aQzPjTwxswAsdUMoxqSkn8UtwFBDWSMrXdDA99udFQbW3dpPeazGki1SDQ33t15JKKUiNwknPuLjRzHDKhq4uvqmEEQ9Uraz53UsbazJrGhRoVG1UyTJ8ZkJ6D4KVgDr29PQ65sA2PgbqDyWttezKXgoQ5Fy9pS9JUBopkqFGsqLzS4mC63GFbPxsq6isXcsngj6NNjBh3UAho7dXoCCX7bJujyvYJir4cG2nGroCug6poGP3djPMxW24n652Ct7ms3RvwZ821j4GSUQyrXeLz2urH2dUV7dq2MceABcrZ3o1BCQQUFFeMPV7AogMtk5bXRAZAs2oBTsN6qeC6RiRL2gMkYEMWy8eEFfGwqpaTtdy2Zejx3t2AbRw1dSPMn2T7K6PVoZrWtTy9VgV1udEMsSqtTkgZAmnKyxyvWL8TqVZufU7RSNTD74DBUktZCrKT5ef7icD5UvAKs2xJqN6n2omB1dcwPEQXwXS7ZbrWHUTbVFVpU1jNR6rwSaJRWsrdgoTqfacGKpe8q2PfH115iuVsYwvnRfyHWcdSWyff3Z3tH1dcHowpxCK4ZhDCAXNcvS9fsqvmnH2SKMqsNkW4cmqGFhAaHSNAdFhbW615sseaSCEmg6pusZuVRPNL6Kjd2tQnvgWtRivr5iEakiu8YM3mTrZFsPpwVmG25bFM8BcdUTAPcQebDX1wQ4e3RWuo5vTVQUSKDzpUMKRopPUhpDUpntgaxZWhL2dkj687wy2AbA7efC64BJvqaaU4SAXGUjetkkSCpF74hMLjsdKMXQh8ADZFY7wNbRZsFe3qtzL2zpWzdTGbFJtGdxVwCXArDJaRfTdYtnx1yzT7jnFMYHbMQXypH4vbc2wrgweFH8J933ut8xhn7qMDCTnnpweMmcPRX5ca6yr2hUTZVyRT7eD4Dr9z5pd3BRB9FF3uVh2kscCweqShEbGpRg2ND1yGBKLVhpeT7LZQmKn7quPG4bc5aYqaYXbhNQBbH8rXUR57GLTqPLDbYV2WZWUp9bQ5m4SnQDjeut2i3MD7Ph8Ysi2mha2YoTBVZHw4SYLpoDrmwbM94HFahn8eR8ntvyWWwERUauPzHXQUDrw7YgUF7qeJ64mycoyvBbHupiLDLqrLfnWbY73EBNon62obbp3ExmGwENB2GZeq1gRnYQHgCqwosVyPnt3yDc7pVoZDDWob4d5wdK36hJbezmLuiz4KKMEpPUETSfgLsrK96YwywT4C7mrEwS4JhXVNQV1S9E2iHjoMaWsWNfzLf83p8", - "5Nr9d8S1RDp6crFDoBxSWJPv6MkK2kC1eGCs4KGePfmTADrKJG4USaojjLyhLdCyeCTTsxY4Rya8nBa6VZnhW29cyzZ2t9A3kPbbnhvsr4XSeg1j3eVMaw4oVh98qW1erbeTEShFKHqJufRqCBaynweCPcPXRCr5kZWvw9REV4hUn84BdA6RpjKuRvSmNFHQTGidpqQx2YM8RBR49SFMdNgKuivJjMkFv32eAKtaRsUb4Gn764sgDMnCAoqX9HXn3N2zwDqwwutfbsTtUW35vF22NXVdeYbkqJwXAZ9CNjJifM9xA3EEjFwPBkDw9ZC6iaXGjmTGxzp8jqTdMAq5BswGB4mMS7ob4jq2ecnqywM6zZVU145Uizjf357jzoQgxkYPbXKcVoaj3btooCG5gHs9br9KArXr1FC7acVauEoLCsxbhF9ZuaKxuJJoCophcuPK3rKUjKDWePBPcDjAGi32Zgw8wDPP64FmSKUBjt6w8z9kqN3WmbP3LRHfcJTagFMeFFXsY8nCqh4txPstFf3sMfBXJgJdUek3wFJrd1oefR1CQhPvwJoLnE4bKZMCwuoCZ4Rja1ry58vL6q3ELptnisUVPo8pXYaFVW4n4NdcVmuudZQTxW9j1p8pHhbKvaHNNj96jbbQNJGrURZSa27YbTHTsamKobNi7A1FWUVC1DH8wgVUKT3ci6TUpKvCoUeTrbvvRPQoBg6okrRbpNqf4GjpPUUnku5SHoavR971t4PDnDT69CV6YHdtXqfuEk16F3CZm2qpeEeRDk2j57fkgiAMDQFQp2HgtC4SQUmstV7fQgkHzBL5FMzTw2iXGChcNDgmDkSKkG3RrybT73HTZKNu46DGxeMZ4yvYvoXRHGnHfTbbhKgRsjZSM86KW632zqfBR5mZxR5uNVs1XKcUK1ABj1bxWa9rNizpg9bY8tpY2166HaeNrtAebMjqnSws9NbpdV3ReAVnbLEd6EDiMkZMixCKd5UB1bcnvMdFWAhkpvsvC9x17hmM8qWRZxmV25RE3dQ9zmjEzbkoM5yd3e6DvVGExvw9Es3SJWaF3GSW2bvF7KTG4e8ZnXARufuhiFwFVNPoWdUFP3fPB5UuUsumcNJe61dLUfHHkkowaVebt43E15i8yKpA26zwAYqBTwbbFGBj8fdf3wXjHsv4tpRCAm3YZmYmzMMJTcefUAMiLaycPbjLKSteriBVwwVo3gMfaUBUYzaFtfoHuRiX5dCS5qTX3gXwvrfAVRMMo2BVNhxUjSNtDkVKB311c5U9Sc5p6LRQqB8uaaEXzZfeQh5CYUXUi3zPW1LtnzcUKurAmGtWzvfKDzZ69Nrq72MYSeYWBfeQH6ALMf6BDY9USMfMnHYeahGu1gzeWBWVcDnnCguhgSBTbd1MYR9BD8o2cMTB1WsgXhNnY6h64URmRbyYm6Xzat87LFoZeDhfA92Hk2L2Q1ksHCJPEWXFeuPjYDK4ZBzufC3mA4KjDjkLxk8n1cyCuptv7x2TCGVkdipDnQs9dN3o2wyrVaUS5wfiJJ3wpScEPYwPAe537mNXw6ETe2y4aBzoL86Uu2bzANSmmcocSdMzi5gjPpZekfbjnQDCgb96GTGc3vE8oDCy7Pcadk1sstrLYeLsVBWQAxBjJimqHt7NDsMaSvCqWk8BRq78CbrfDWmnRcJ6m5bBMG455RuWC4zVy6ALPiS3KSNLczA6Kpd3EhKd9aAXgU8oS6fAwUpXerFT5PnJdKCq5LjcyyiysR4kFbfCxK291XKrBKTSapMNSdxoMaTgdpAh6C4Rcbon5D5cfsStDYQCFxWpsNgd39AMe2yaktrgydDqR2Yc4sGtxirYM6PWNKPywgCjLMvTF7KLTY1CJTBVsKLS8KwJksKoYijeCFUbaXvbrAbGJiMo1Y1MDbUryT1pn3ZcnX9xPZV4rQbKDTzi2dPDHDUTbBCzMVExefkL4GVMSurKWaJhc1LdJFVwGN8BgfZsqFGNmEyqhgDnTtda6wyFLQyCHKT6io6JBsB8t95NysxqtGhvqGLtU4GB2GMVxXf1sSdJdUEZYw8pqjCc6KpE818RRPWAqMCuWNQtj12DNnqcpS9m8Yg5nBYaJggLyhdUnjMANHRFc8XuyjF2rkknhkRqy1zAvcDSB9r7RqDCJ7Qr7ra7K2TmPTa1shjjDes87rzhigdWWeSnwggKuafN3dE9MrkxsmThaHEEjHddEbBynxvAZMpmx5phKGMrarCgQXguXrMYuumjJjXaUZyDaM7VbV1R9g1oSyyHJ5DWiBrBezEkgRRCNQkwyqBDiFyggScfi9bvb8UQraKEJiHnXfqtwPA48tavGDFP5QSGRwyhT9LLhajzNXEhJi4ogohRCwnFDfVdipmoSUZVQ5Fs9t1uo6sonmxp7C797TqC9UZkppdCXtUe3r7WjYV2t92ZKYF9GyETqU7VKJ3", - "5Nr9d8S1RDp6crFDoBxSWJPv6MkK2kC1eGCs4KGePfmTADrKJG4USaojjLygAtDi6w13Ejgtt8RFgPLhTRaxyNx2VDinWjiySF4ZX7eRpNUT7YRBxuHQHGt6X19Seg1ViRtDmMNKB3CSNZNo2ADXR9TKcvRvm89h2MfZHPj8eYt5gvzmaLmJGiyCT5Wi5rscvpC43rgzZRWHAB4pNJnWh9b3uh3cLZJJFuxAeEegxRR1xwHSSXqfhEagLYmR4T6s6ngKajszeudm4D9orBfKbDH3RLw8ESvSyKLTHTBZk2cdqnQAP2oMCGcyd3WNfBEcoquFzTUFRC8zRTnPRVFax6gCmkgqApCPoovzrkQQdiVXcL5JgeoG2vK4qWWzL8mfsWeYKWmsFGjL23VkEhTc5RzqcVDVaani3UXn87pAfQfQdisa2uWxqoeJQQ3YKUy8tjzXcA4HKDtTDUPP985ekdo3i4CGFxH2q8kgLFzuRHLjXZTjuxWGxLUjYZMHWENp39Bx3yuE9dRaCXac7wo3WTDHcqVouhtNuJftWizkfPAVs5WyHuxBzFW68RhGmWTpm17cW7jpJ6HvhL2Fptms4jkVaGKL4TVFTN5R6P7b4XYuz1XhHFfRTL5Tfm5cJwo6HopZQJVYGd4QtkPdipwzMeFvyiVLTWqUmqk6q4W64XYuqDDhiaNtyFqRN8bfyMW31fvfWxvhoqjh4g3rBG692rMfiK5eg7c46oVfkVSDQ3NykeGPJjQ9DGDNYYhT8Hkt4XUDrHY3MnchP6gho39HX7ydkhZSKcwytwbNwTD7636qgjZ8vbZxx33341V6Uy6ics4HX5FJQ2TtzjJMLizG47EGzdkS7jXAr1jM1Z7npqmajKLNmTCeMshbneNhoEgJyMXcCkt5aieyefGxPuP9GFKRHitLocCU8z8wiX4wX9EZtX8kB9ZiYRoHyqnkVmJuJ1R4GpMmkX5ZeghopALXEfLL6zXnbVGiYnHhVonUcrHhbQzoQYoAiCL4M7crTVLhgrfSPip7xn7VGn7rH9Ft2bF6e2q1mCpi3FzJCtzWpHHZwqjdjbPPp7MkCfvzG1T8HZmEAab5ctzJVoUNG4xndShJmSiz58Hw6STgr7B62jwXvn1j1nEGWxoDSr9bp7Mn7e26b9qBrfPMtbnxuP92YgXGwuAMbs857FWpHpeBQu9qyXpNEs8wboCEovQ326qL8FHFRbCEfh6HyGJ9ECxxHfNFSntpD4utEDqECEqhAGc4CL2nxQqc5TBSoz7sGWjvUsFBTXd6pQAqc2tvsD644CoRGjCqqwaevnQLMP5xbZRsSGj6c3VnDGRS1Y7zFLHKBTtPdktDLN5e1Sun2n1cNxEcrffVNznotLzKkWUaPBf6P55GskkmezoG3ArtM5hHgePAWxz9hCzRp7PRHu7auzq7p6vcYuFjrEfEP3kWbjZmihw8vB8FEzNa39SJhJ54r4DXYc6MmBc7nihDg4UP95w895Tee6WzUfMDorq3KMZc4NtC9yiDnJiStVBSNCnpMLtKpdJv7tavLCwxrM3NaspYJYfJJ3xcdjoXRRjZNaaUGBWK8JBFDFimo2TCLtjoTeb4Hqx6Nc1LRnxxkPzZiDLQWua2KA9JVJFHEaiGWqXFAJSbazqpVwzRi7LCnudZZHPFNvUSxDacr8p5C6J9RhXi5jy27yszditKvTYyS55uUqVvt8oHbx6a3qWnBuSxC9J7WePtCBjQHZZrnSy3m1xghCiRMoRqwCs9Bzbbud5yTp2pB7SE57WTYdCCfYnD866ZwAMfkR1KfbC5FDYGCMCgTS2EPUUqQqzmhsooASnEQfhm7gWzup7kHHkqzPnsxxiceYKW5ViWFWUQX5NmFZr16KRVTBpjBx8kNtmGzsxaf7MgDpGDMo9zj4hDYPK47aY2zagCf8C2f1aWYpdZFkeA27sYR41dWZzNycvre9oyTVrDxgDQpmT4MUaRzaXD59tC1RSCNn77EzAR5zaNoxWoBQN1atyCXMR8KiB7y73CbJTms8obdqSNm3dZKMPDgksKReJ3ZHqjBBPQey2xEQFrpMAGjRXeYUz1BpHUttS9LC78jKurkP1voNChGspqk5rt6N1MZnFKWv91RYfUZG9bDmrj1itT8yaGthPLhcg6KJ4rLsxQYnWWPvC3bXZxEJ54MAaXKUaXZzJDRQe3cZCvJcx1cjmMdrCNnpqQhtuVW2g6dg3pudozJ3mmSj9gpUC75ijwS4zoWgyX7uG8tPjKeH4THV41EWJqK2hA7Tc42UusUS1DitGdCcCNjAVBaheVRMAjLTrbSrAanrH1qE8c3Mu3nScoUFzH8qx6HxAKNzVKSQN1YdbRwwMEFbw2AwjGsjEzoJbnhZgT7nqDR4V7Q65sHueZftoxm2WCzThrGthNXhHSpgzijvuphdAA6mXDpo4odf4Xg9QsL2deE4p", + "ZPBQ8yL1wGjPBFE7ZbLYxzGSrLZbeNGxodjoVsE8zTzmyEagNHXrufzveLZtmkQ38kZMcgyjhYKFLMAdABSh1XNiyd9XKNLBiyfMqgC36RPLcY6oMSCRVYNpq3UX1EjYCxBqueaZMMporh9vLoDMhE5e4E14ZL42FqNvpy3n72C3RwUTzaZwx3SeF8GjQwYK3sgt7Dkq9iKeX3tNAt9aVsnVTUumjMeF8G4pBeejRrRY8qWXBtMzHceMw38837vZJ3AcAwCUdVGQcaaG5fzPLt3PpyVnr6XFXLuoGbK9Ygs6x4vJNbAJteQxB6EFT9Hyi9HeWeQzh48GUmAVoEGBMMxrkU1ZKfApkwPbihfm5a3qPp7w22no9DP9WS3ybyQ3ttt9iFKtCchu8bGJPJuMhrDQySgSqcXJjnskmEpf31EuH86UFPYa75oLK2d2SvYpX2W6z4wmo828Lv3NaMz2Wm46oE9n96BPZng4z8n74ZTEPk8ydShLJ4GsJ9HtS8i1wUhbaeQ4pqFVV4qEJ45BQbLLyqPkmKJDHSLg6gWmve7wtfWrdv8XpsRFEkknJHXB1KatQBX1o7YTL2xSPgMbn6NmgNEiV6CiyscrMvwKj6Ms7GrKwjrQi2yN9t2GL5gL2DEfCsW2xtAr74B14bzzVp5MBZLjBUDE45YbJRdegMmH8eTmRY9Adp7Y5jifKZMyFdsYKK4KuGvv7oQReBnaLRPTYeFsEPidZ7EkigggyfMhqhYhB2osdRCX5454mzXcwE16auEXXxMyRRAdZkKGDQ68PWSmMjYiTBeroTyLYFjnvuaTeTDXz3fWVVVEYMtbFvMztsC6sraJtLTBr76R6Q5utzDoFRpgKuVSD3R3Me7CY8WhE823CSfMA82evcr3Cq4rJrKSZm4as3EHetXXW2AbJLmp6M5hU79DgEbsbSNgi7innpE4RGy9T8EUR7gvM8634kP9A7XfxkFRHU7QFyjxE9NnnLmQpG9C8AcC9NMtMycxiHs9y6wSgz5ZWqqzMexgmnq85AoKiwuknvuLgxjt9YctueZFvELeHbrL7Pr2Ywrn5Y2MDdv6Z7VNHAwMQ7KfEKxSYecgvNYDzNuvRdSRxdo5ST3s8KZwNL6JwJZ5jAc6TTL9txzbPQh9AdqkpNc2rsabyz6ChXAQkqXeEHmk4bDGfuc7tBH2BND6cVtj23dpfoCrrkb6fKUyxRz64mbxt3a15Qz7XMWCvN997GXHLpPMWCASRrtPJy9QhC1Mxxpmty9XuSXK54BDJUNdkMJ9CN8BhLT7igKnj23MA33oZkgiW93q4qJ8nZF2Bu57vYNN6Vozg3FCmFc2rTLm9zrVdgMT5McVvwefXDukVhF1Sc9g4DDgg825He5GnhdpqGtiRgmjeAVmeo8EXuJjPUWpNpSCzjy1oLaw1f6Y9kgm7CrD96Mzue8Fvijr9paRiKUqvDvx7KLkQbxDxYnJyGd2Mc6Ne9kBRXgriLeFTCTEnZewX41J1qcvGC5kTz2mRKsd3A3uusMXNDnghLpA18gXbMcNWiPBwQRPPJg9bzJS1CpiVekmhfDfQGzx3Ub5egEeUvpz451sWwWDd8YM1cxfTxRQs7xoGwKd8DLLcREfYuv8yBdz2y1N1HzndhL4ZHP62AZasnP8KEc5K3CCB5ksPDUWXDxYAHHu9YazkKGgL3SpXVAG1TouXQa3M5rSgR3FAr1b5g4WEhuC1H7EvCdy2UruQcuYEMFhFWYktowKdvZ5JAYLcpfs9ebCoXvFLbWGcZLp2vLnQnU8PbFvPMHNaFLnZTTJbm8PLrrtrACTnA2829QPiAYPJ468G4vraQHt1FetEqDNrfupMMpNwNPdFe6J5EUQMZA2cbsjJn7ctM2ToryKo9DwmuYDGTp3kgF3bqopS8CYmp7EcdftGuhztqoaDAXrDS4DDKfwSyfBQvhKDdp7WdmWNYvYrAgNa941peChW7jt9nerneiuVSrD6rFbLnbrtbvJ8AfHBwvzfKW8HRX3vo65rE17ZAnzb44ExYKmGzW6AncCiRZppv9fhttDVJu27hTV3hkLwsCaUvYxvCy8AFgyg1UYu1TSGt1UyveFp5ngD3KUDLEL9LuxVCqFNYuo3bUhhRqCJvb4imJ26u57XQvn8Cb9wPNe5WhoohhHcGzUzhNDKM9ta26FQMHbQHcQm1cfEPi4ZkEjWMyfx3iEtRKTEbEoUxKVhygTjy8uaQtWwLqiJUQwZYRayk74iUGvxWAnBELWBhED3iEvXUCpMyRreFeDYiui78h6Fbdmhu5vfQdhNbcPRnTZFLuyzXyztuTsK8z6gjda4YTengw7FMhJJeXZCCq4KJ3WZo2wLK5kxLQZeE36jmg5b2C4u9LRRVcxiLRt1yDvFhvrj1QFtYPTvkUKSBKGs8BAEcT", + "4EQTxw3MSn9fDbvzUN4qmbe6zFBp6MGrtmoeoVWU54Vv9hVr3kBhVd23e9tdtMLXb39gT4jtFtFejjj7Y8KUBrig9obUvh6n3Xp1BdYMGesCDwA517r7zWr7h8QkZZvtM9KQyYdrnEccgDDjE621ggJn1x5GA4eY3JC5MswfvzGpt2CJegvo1dwyy9VzmwmLFhyaD8LXypN3Y37qxKwmtz9LbHdphbjuCqG45pdn1WjPitdpyZmxNbgfkQRu9iiEmrp4bDx4FL2D6uLDbcGmES3p5rnnJsAkFma3kTBXbUapgdpftRyWfxT5GWGYSmPgLDC6GupfgXtnwrxZFxFdVrExULVGQe47iMija8iUVe6rKnW3maudjZDc87G7eJkn5AB6Kbae48N4QwUJhL1ehjoK6NW4DK2HFWbYhf9jXddnGHMwmp3eUKjzXREbsxmtcd8NQAYi6faZacRJiSGJ4pEMcnRPmgUrzkthTmz5MaSEvPU2qV8iss8JoE4huPkXUe36Jc2epBnPDrSpcoD9RnMwtogh7Zt9ZbwqJvRCvRBubrXR4R3JA62j46coMci7t2PnZNieCysUXFajpgEoBffZecK7m1gH7kKhxAzMUHMLGWncnXsbFPv95dwPramLr688uErR5tTp1Lg8YzkpwrZ6JyEYxR7MtiagBbxaABe69Pfi622kQZPpxCEa8Xth1VhUZM5arjVCfG51ayVD1GVL5hj1uxwowyAHqYPq1vvSoopk9cdUhXc2hzL63FdCV2bpg8pjdo6gavk9iokjafJbVq2sCrMoUmhYDL8gcNhbfu95AU4jdn8wDopEW8dkEk8qcv2uqBWGFpDmaSm1aArMiK4MFasjC8v2XfaDBVUtQbmjb4cFTHKHen43quXcx4N1xZVCZZdpuDi9oEd9M29vWtCHckShumUztHB6yeXneik5YhhM7zzwQZavJk6jvEUg9oy67x1skzWaXJUnaybu1WEi1UtfrZHPS4t56EvTLee1rR4gLMtS8qeBrFBbpWEKEFNdKrz7FgR57NxPkwcJuaTnktURL4Tan4xMysAuwcpCMrV4ritxiKdbxaVUk71WKihQdRQkdue1tBNqzLDxn42fxN9EeDu6bLBCq1pB61cfUm7ECxKPtbQVQXPKBLPtBuwbEH11h62DtGCQ31rn8iwk8k58bthMSHjcbHjZpNkDi3dz7sJ7iknQFQnEhLLpNvqGhK3pYccyemJfFtX13UJGR4pfM7TYznSEQGjdo5q3ACenebnuP8Y5wXDAoK2zc3Nqy2EtijrtY2QopiNpXRuJR5dtJiCQHw7ku5b6NC5WBi9dfnaoy92qaxVzCZf4Gag3rCeBWRhN5R85eg1WLqEDwZDzxwU8Dwh5bMSp82qWME6Ew84ezcEuHe2cfsxyXTk1pJ3dhLaQp7M3ZAts7rLRhLxznVgDi5KA4c2goh4CDpbbhpRG9fofkqQAZ4jkBdF46BKKG2T4vvRb1Y97eJE9N9Py8PoQkVJjbbgAhit7mFzoiUxz4W54c1KQbgkPTXGr1unfH8rjdA2JpbAJesrb2szbgr1GKSnjt2NsdMF76Uy1MqaVevkY935M82xshpw724Trd63Ph1N4PSrCcZ2gUcYWLtZfpY84ZUvU7EpxnePT79VRrzcAztXwYmFX2jBGThhmhSFLaVDA2b1iNbtwioaegkg5banQNVgJ46AfVFcM9gpekWJTksjjWwHeP7fdU9XGgyCu4oKk9Eung3YtKuVNosvJ5abWXrgLwVFJKhrNgE4fsmpsRuLcTeKmA7YxY6KtaddDgyf1MahcWioduzLu2RF1jg8fkehspokpW5pFLfVUTkkZXd68vrbAMy8gBLAzhtuzAC7Lk5dJdBVkr53JEtbgcoQRPDP6RaJoqKLxnWjc3bNZud9LzLanMD26h1WbiPkKRWFxkrh8iSm8hZGhYKQAuFPKKi7cifXHio4ZBrNdLGu2uLGbhArhkLTa7GCRDJJrhKSbT5oigPq5QguqXtmuYY2JPakYAuCjVgBQjQiNYmkAeSdNnEgeysHPp3VbxhpWLu3Ty15JiVdbSxD6xDPy1XQ3DNv4XoaN8UcPRT1fSRNLsvGDmR5Y4E1sZbfPQBVebzYzjsqFBnwLg9m6Ei13YS2avfwC8hBuMe5cVKWbCFrWJAPmhkd6HEoFhuF2WRMJGbMPaTG4ixuz8SLTttqpGDzFYAmytjsHq1xaFYF3gG8V2Wxq5ckV6fgu7C7koCHaaQdAiFghqeFBS7nn75yUr961gDeVkvTnYWmuE55nBZepxocynSLkLiPP8cyfRDEYK1siydfJHuUgoCm9DNgA5A8scBF4T6ubkBrZ1jX6GoNQVfWfjJeAH66oeqBDRyFcy2BLUkpp6FqUhFVPoXc2caqbxhGg1fdfgFwsaqctwoBGXs8A8XXdodbJ8JzisfTA5w4cE2RvQsmagAicbq", + "4EQTxw3MSn9fDbvzUN4qmbe6zFBp6MGrtmoeoVWU54Vv9hVr3kBhVd23e9tdtMLYutpx737TXvM2A9gBwAW3ByZTVCjyM3XHrNwER1RxU2By5gXMAtcTfuBTZuTyzBb4i3dqVcgeeJoKz6X8TcpYApx9u4qyzmYpzB3i2Aeor25SgpmKwcmpZWi9tVBXTLbQwKvaU7TtXoSWwD1QuX4SNX2koCjQWHYfoi4n6v4RwxzjqgxygQkUoxT2HmNtpkvBdybrc9t3t2DeKhsghwwcTve2NBeL2PeMauS6ayH5iCyX39waxUX4qMuceKz8MLWLdN4rrXVXpCreDsE4uU59eunFDHc6j2C3mPnoywhJAkbBMSqHBJR9pjfnLeGvFe56yGnGXHcrn9esBEFMnN9KA3gHWzAKw6U5oGDopaoPM7oHriMosUxUZzuugcHEqcUCfWnvZciuyqmXcNdRRuuprGWytTsaoECD7hXmhrc7F4ZEHA3kFnPZ5Q3rbtVpCV3yy2cjVG1FYc1woU3G5h3PMqoG1TMAQQPGzWa2YnyU5LmKvkp4M1YbEXn563AjpZeZy1DmdLUeKbbgzwG4Y4f8m3xTNVStzwZphT4YcNe3Nwa2D1Rvkw9jMAJ3qgrVCvpsQxGcwsDcATRqvCTyCN13E5A3UDx8uq9ro7R9eM5d28qrUS3AjaTLaHnthRn5VVyJPetekdPN3kwxxGuHoVL2HL1CXcFsBZNYFrimyXGHWFWoCZw5y2JQabKMGtT2iwHY3LaoDRrH68k64qQ4n3mkSQgndV8K7Gk7pHRAQ4vzhPATYdr4mtt9EYR7owJkzLAPYrq3xngsVrwjRP2SUwu8HhAgZsU9mJtq6f1gng597L4dshWrcYjyRofvZ3Xrf4YeFVHoPBfALpSwUQFLgVwFADUHdm1rKN2QzU5ddSzv4CkgW9bQUvHcxihJCRvtPezdbBoTiBrHFYQoSivjRDhZX4HWLe8Uz7W22ZgQ1iwQwEDxAKtN3WJKQ1fiynSLcafruHkmiszmqi3hf42itqvbtdHqQQuk3xxSQbWifxXvJyCNd9rv4ekQcDfCvdDswvf9T3cjCRsNn6QLCZMbgNU4TLwNv2qJFDyQDzNxzboBZ4uhVUUYFKcomYfkUep3mKN1Ay8Z4NeS2UZhPPMNfugCatNHMYzpo7wSciTUjeLFyiNQ7AyjWq9ZYkEKWWYvHEyne8ugoG43dxCCe5fLSXENh9aDoYvaK1NPkCr1m4i11A9K2Rpib26hspFwwPfPh7AvMeMn4KRhBXCMXpGXrVoeVKAYNDCwPxJz37Ampp2kB3b1EGK2A3TKjxG7qJJSb2pb5wKbCMeuQNYeX9qypQ6yHfat1yfszLZEdThRnCTMUnYX6wKF1T3TbAMgXHzUauXowjVegjo1MzrzDxQQaFSpuwrZ1o5tEryWYXj7Fi6d6juMU98RfZoxu1AxBqDAjVv6HBNJJzbx9sic9rCb7p9bnHGTqi2U7Hzj4zVFYyWFt8mPQqbSFyofekapEnKFBFvZhLS4q6s95f4rXKKPGPLxASc63hZfqScdFuuTMej5VM4DSYzyQEKXk2faZ4QcwdSE3cuTkHUQXH5wymK1LKiDd4Ysyvom2zaYmhAN7pCTWJC6iG8qVotNLGiN7JcwJy1n8oahjuQA6hFCRVQ2uNHghsjPZj1DtY9SLUgLtV4qzHpE64ufXD2J7F21TRKzYsS8LiwqaJD2ZPHfk5kQYrssWs7dnzzRqDNANk7UP91isuUTG7Yckp7XhRKiQLm3FgQMw54c1HSV7N8HrsLKYJBU7uGw4d48ys6R3T35h1tCAwUMfMynM5wKZFaZUp6dRgiwyUyGqnaQqCS953zsQkMtokXo8EQQKpPdjwx1UvNoWaLtBwZ4hoU5UzFN3USvSgiaUYg8xFXD4zDNhPTkvXMUBWWiFbqYhyVMYAhsXb29tYYuwGWZwYR77s4D4REe88LvvYe9k2ERkC5kZStTV3rVciiK437wUUBGUFmUB1ZAF6Cq4iNCxtUgxfqS8wRi4RXygBBUGAdDRhTeciGftohXuW5bmPQcnJ4QPThyuUgz6oxfYXocA1gcfbT28MFBU9idDm4vrDRbXfR1jrHT9TZtsiXERbfdzjnV4LdaEeMzeszmFnN5hzRhyz6yPFAThdVvnNbnMtb2cCWKbR7QjpSRYGRhkURYn4nE4qMLdXfZHuzFTUF61pFjphJV9ZDY5Ub1Ta6qiWqFAeBBR44HkWqBZvReQYRzZKLRgRm7j1GPzsX7m7wTyiTBerm4HwU9kx8daRcBybhXxpGiRbEjRmT7jstdGnhtWvxVYTRDfrmNFpL2WC1dBwMY9wEgoxstZK3JMNs7aQszAsTtuj8nhxKGpYPUL8WWBqfuz8oB2HtSH9794Kcm9NxEhSZebY898kYzd4NzYHqiyry2R8oeukJhEBDCqbuWD1FDuV", + "4EQTxw3MSn9fDbvzUN4qmbe6zFBp6MGrtmoeoVWU54Vv9hVr3kBhVd23e9tdtMLYgB7ioXsj9npXPgJcP5HTT7U6qSt9mtcpyxStDP5tz8D3pzzAFBNaEeG43x8i1gYSjpKs8jTxgS7uvrCNJri9pPUSzGXtyeBqCXikUZidprZUfepsvexajPrXQ3C13wXySNDvqVggHzfA1CT1pSafzKSPxfVy1y9NJoV6cyfQQawNRSZQwuEHedsMwZcRFDJ3LiEvGS4GiGwoHzVYgFmHjGvEHrRQss6XjzML5pL4ce1XPQX9Lyv4z2QCRWBm2J1k9KTVtCNGHaf9SfD89WpgnkeBNj4ezgePgfkdqKs92Yb3LBsv4TxnF1LJYKowZ6G3jMsWLeyfR7zKkboHQyP2d6Shq9nFBjU4fohr1N2RSkmDyUKBcx3JJwGUVXfUjqRkrWH8xSyJkZkGM5VLMXSThhHvhz6ZeHGrY2hQxBSo3UUxXuwadrCNgk5rd41muA2yVijwXk3uLb1HL2RjQHnJw9bt8Je4Jy1YWytEu4JPWBaEkjLgz12cHVsq7yCoucPcqijvAeMmhKtgpjAji53a9W5Rax4t3X4fEnoJH5X11XPsK2QWiNijTEJ57AmvaVjBTViYikmfRjtviCd8NzSwfWBBkPeCAYsh7wzNU8KE1Zscs4dHjpyzrSHJuiv4DM4ovhN77sBcWVcn5cTcWaoJp3dzXXmAZrLGtyyBnRKu7XThJVvdkQgyyL8HsVwjnWfZdGnFiAk9V8MSJBFAX3fgyuhzx9RbnE9WCzUut9ob8jASjCDsABkn8NwhgsN3ofUmzjKDanW2Xt28qr9v2wK2ZXrHkT8zK351Z4LeirZD2S7Uh9ZSEagkjNddXeKmdgYG2KH2DrCS3vuyeTFpYcPt8rAy3CFC2PRYaN3AgwR8Hk8maKPH8xFPG8uXTCWCtQARm2Kv49BMhzi4QoRaurAtYTmfyqnSkAumkRiKRyKiJ9oZRjaa9X7S2CM2iuiGo4hLehQAsfTTGbaLsjWNcsRKVxqwvJUU2uGjdywUGTgaVptBUd4epkFUQgegu4os4qo1fJQxXVmmrawuC1tHtndak9Cioz3Uyh7TWZwH8wBmTYrwLzSJygV1d83gfnrfpBbdimFdw8g6igVMeNruWqVwoiYCLPWyDtRzYpvEMopyiDqofLpPLYRg9FEJUyj1TRNXR8nKsH8ei3rELrx1zdFVomRWBAkaoiHp5YNzy1qavDoNMvj3fQeu3qAQhgR4fgpUZmsZd1qRueiVWAaUVfuvynPhupvAXN5AveGzP7nJsXhV43KNVNSgMk3bi9gznHzCSLsPoCkDrbzWDA7gLUpon2cXJ26wPXdtoC5BGbQxmwCskvukxQRmG2Btrn8LgauSYHqRgEnT5sY2fJg3wahwQWtNWgr92DUBfpdVdRfapu9UCnG1wx1wHgBNabhfWthT174w8RjdKdsxW48cQXsQvAzVom22eZKDTi7Zi3onf41NfFTdT37BikhUKnJpkpdA5k8XSdkBidKamZK8Udxkz4SKbQfqYC5u8VKotJHScGvPzwq5gkqTrKnj7rFkznicMBLUehpnCziygD6y9CJpHsUXkELeyFbodfi3VbfWMnQ84FKMDCAE2vjCvb59vGREqQdsGk1tQYbSn5E4aJd5qPEmNgxPRTJAHZCwuNMS1AXkEMfh9oa3jU3wdLHPapWLzBuunNQjdM8DHUNc4ZuJqXxn6DMR8pAXyo1nf5obuE4xg5X6b6EszwupvDi9LfV28WnFNBVFUFgvcQv2XYYeCuo8pP21iH8T4hkRcn6W6Eh2TSysMNxMBfNcqUfTNRhnw2j9K2kfybPTRmXaxd62NsuX9jXrgFe7MrmKVn39sMpWSc9QkyqHF9neHkjVnZJrz3S9xJJpLxMiTQUJVG8BHAxLAEYszW2HrTsHAT4Fe6Ua52BGMFNQFDAjYPdjdDcSHsG8JELZaiU6oczPMRyKdy8tco2hRrQpzNhuUzwtLh3Upir4kUH93iTS2fxHdaVoq6GMQKonSrfZxxrHpLE8cMiKhhjKSU55nc6Jh3HFE71xNoWx32joPi7XfwTBDU13WUS1g7bBBVeV1k5Hf5njBrTjSQ8rMDtZArMQNrHeP5UgWeUTk438rihGN1gj9QrCPQcdUvGTgfpmkY8gjvJQTsMekiKku5zsfmMFH3yMFgdzTXj1Mh1L35KCCXQEnNAgQjX2MW7v3QFQdohbjtLTaS44uWLKEwU5HLwDVXicpTMADPwv1AKFU5Wi3BrzUoyDPGQd4oVuCbz2BMdz6jxx8dGzFBUBH63HsjevsziZADWwEWia4jVCA7XCRpazRJSDEiLqiXWA6ZVw2y36sqD6e3oZjfkzmKB3i88zoc7eRSDpYa2KS6bM4EQm8AjgTSfQkpTKS64VpLtZqLKBzN52f13bo1jkRRqey7", ], tokens: [ nullAddress, From a1dacdd0023668ce67118f209a75074c9a32cf13 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 4 Sep 2023 15:10:43 +0200 Subject: [PATCH 1089/1974] fix liqwid --- package.json | 3 +++ projects/liqwid/index.js | 1 + utils/testInteractive.js | 8 -------- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 6303a82e39e..2375d0bd6ba 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,9 @@ "lint": "eslint .", "eslint:github-action": "eslint .", "test-interactive": "node utils/testInteractive", + "tvl": "cd utils;npm i; cd ..; node utils/testInteractive", + "treasury": "cd utils;npm i; cd ..; node utils/testInteractive treasury", + "entities": "cd utils;npm i; cd ..; node utils/testInteractive entities", "postinstall": "echo 'run \"npm update @defillama/sdk\" if you want lastest sdk changes' " }, "author": "", diff --git a/projects/liqwid/index.js b/projects/liqwid/index.js index d6894583c31..abcad1aef59 100644 --- a/projects/liqwid/index.js +++ b/projects/liqwid/index.js @@ -50,6 +50,7 @@ const query = `{ const tokenMapping = { ADA: 'lovelace', DJED: '8db269c3ec630e06ae29f74bc39edd1f87c819f1056206e879a1cd61446a65644d6963726f555344', + USDC: '25c5de5f5b286073c593edfd77b48abc7a48e5a4f3d4cd9d428ff93555534443', } const getToken = market => tokenMapping[market.marketId.toUpperCase()] ?? base64ToHex(market.market.params.underlyingClass.value0.symbol) diff --git a/utils/testInteractive.js b/utils/testInteractive.js index 20efa94ecaa..dae3e3723c6 100644 --- a/utils/testInteractive.js +++ b/utils/testInteractive.js @@ -26,18 +26,10 @@ const adapterPrompt = { suggestOnly: false, depthLimit: 0, } -const enableDebugPrompt = { - type: 'confirm', - name: 'debugMode', - message: 'Enable Debug Mode:', - default: false -} - async function run() { let adapterPath const { debugMode, ...response } = await inquirer.prompt([ - // enableDebugPrompt, adapterPrompt, ]) adapterPath = response.adapterPath From 5d2ed7d9851895ea44b51295baadc2a4d6d62262 Mon Sep 17 00:00:00 2001 From: Based Farm <143357914+BasedDotFarmDev@users.noreply.github.com> Date: Mon, 4 Sep 2023 08:10:31 -0700 Subject: [PATCH 1090/1974] Adds Based.Farm to DefiLlama (#7364) * Adds Genesis Reward Pool * Update index.js --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/basedfarm/index.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 projects/basedfarm/index.js diff --git a/projects/basedfarm/index.js b/projects/basedfarm/index.js new file mode 100644 index 00000000000..cd638171d81 --- /dev/null +++ b/projects/basedfarm/index.js @@ -0,0 +1,24 @@ +const GENESIS_REWARD_POOL = "0x4F4014EC1685699290A311E0A159E1E39914853F"; + +async function tvl(_, _b, _cb, { api, }) { + const tokens = [] + let gotError = false + let i = 0 + do { + try { + const poolInfo = await api.call({ abi: poolInfoAbi, target: GENESIS_REWARD_POOL, params: i }) + tokens.push(poolInfo.token) + } catch (e) { + gotError = true + } + i++ + } while (!gotError) + return api.sumTokens({ owner: GENESIS_REWARD_POOL, tokens }) +} + +const poolInfoAbi = "function poolInfo(uint256) view returns (address token, uint256 allocPoint, uint256 lastRewardTime, uint256 accBasedPerShare, bool isStarted)" + +module.exports = { + methodology: 'TVL is based on value of the single-sided staked tokens inside of the Genesis reward pool.', + base: { tvl }, +}; From 8cadcd5858aa5cfdfd23d068640473feaec1996d Mon Sep 17 00:00:00 2001 From: Brdd Mnk Date: Mon, 4 Sep 2023 18:20:52 +0300 Subject: [PATCH 1091/1974] new staking vaults added (#7368) * new strategy * add new Sushi strategy and combine MIM + Sushi in arbitrum and add new Aura strategy in ethereum * code refactor * remove old contracts * new staking vaults added * Update index.js --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/parallax/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/projects/parallax/index.js b/projects/parallax/index.js index 100250b8a7a..1dcd225f4be 100644 --- a/projects/parallax/index.js +++ b/projects/parallax/index.js @@ -1,6 +1,8 @@ const sdk = require("@defillama/sdk"); const { default: BigNumber } = require("bignumber.js"); +const { staking } = require('../helper/staking') +const { sumTokensExport } = require('../helper/unwrapLPs') const { getPriceMIM, getPriceAura, getPriceSushi } = require("./getPrice"); const prllxERC20 = require("./abis/prllxERC20.json"); @@ -150,6 +152,8 @@ module.exports = { methodology: "TVL comes from the Staking Vaults", arbitrum: { tvl: arbitrumTvl, + staking: staking(['0x82FD636D7A28a20635572EB8ec0603ee264B8651', '0xA3CE2c0d1cfB29F398f8f4800bA202Aba39dbbfe', '0xEb370470Afd74d8a9BBC4fF0C94371C310fF9D3e', ], '0xc8CCBd97b96834b976C995a67BF46e5754e2C48E'), + pool2: sumTokensExport({ owner: '0xEb370470Afd74d8a9BBC4fF0C94371C310fF9D3e', resolveUniV3: true, }) }, ethereum: { tvl: ethTvl, From 18065a44463db656666ef9a731df1c4efa35fdea Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 4 Sep 2023 17:26:30 +0200 Subject: [PATCH 1092/1974] track solidly v3; fix visor --- projects/solidly-v3/index.js | 5 + projects/visor/abis/getTotalAmounts.json | 18 -- projects/visor/abis/hypeRegistry.json | 4 - projects/visor/abis/tokens.json | 4 - projects/visor/config.js | 81 ++++++++ projects/visor/index.js | 241 +++++------------------ 6 files changed, 137 insertions(+), 216 deletions(-) create mode 100644 projects/solidly-v3/index.js delete mode 100644 projects/visor/abis/getTotalAmounts.json delete mode 100644 projects/visor/abis/hypeRegistry.json delete mode 100644 projects/visor/abis/tokens.json create mode 100644 projects/visor/config.js diff --git a/projects/solidly-v3/index.js b/projects/solidly-v3/index.js new file mode 100644 index 00000000000..e5dccb72f8d --- /dev/null +++ b/projects/solidly-v3/index.js @@ -0,0 +1,5 @@ +const { uniV3Export } = require("../helper/uniswapV3"); + +module.exports = uniV3Export({ + ethereum: { factory: "0x735bb16affe83a3dc4dc418abccf179617cf9ff2", fromBlock: 18044650, }, +}); \ No newline at end of file diff --git a/projects/visor/abis/getTotalAmounts.json b/projects/visor/abis/getTotalAmounts.json deleted file mode 100644 index b65e592a742..00000000000 --- a/projects/visor/abis/getTotalAmounts.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "inputs": [], - "name": "getTotalAmounts", - "outputs": [ - { - "internalType": "uint256", - "name": "total0", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "total1", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" -} diff --git a/projects/visor/abis/hypeRegistry.json b/projects/visor/abis/hypeRegistry.json deleted file mode 100644 index 9603089dad7..00000000000 --- a/projects/visor/abis/hypeRegistry.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "counter": "int256:counter", - "hypeByIndex": "function hypeByIndex(uint256 index) view returns (address, uint256)" -} \ No newline at end of file diff --git a/projects/visor/abis/tokens.json b/projects/visor/abis/tokens.json deleted file mode 100644 index 628463c86b5..00000000000 --- a/projects/visor/abis/tokens.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "token1": "address:token1", - "token0": "address:token0" -} \ No newline at end of file diff --git a/projects/visor/config.js b/projects/visor/config.js new file mode 100644 index 00000000000..d0ad9c2b744 --- /dev/null +++ b/projects/visor/config.js @@ -0,0 +1,81 @@ +const ADDRESSES = require('../helper/coreAssets.json') + +const config = { + polygon: { blacklistedHypes: ['0xa9782a2c9c3fb83937f14cdfac9a6d23946c9255'], }, + ethereum: { + blacklistedHypes: [ADDRESSES.ethereum.WBTC], + LIQUIDITY_MINING_POOLS: [ + "0x64fcdd0de44f4bd04c039b0664fb95ef033d4efb", // GAMMA/ETH UNI-V2 + "0x96c105e9e9eab36eb8e2f851a5dabfbbd397c085", // USDC + "0xebae3cb14ce6c2f26b40b747fd92ccaf03b98659", // USDT + "0xf178d88d2f6f97ca32f92b465987068e1cce41c5", // DAI + ] + }, +} + + +/* List of hypervisor registries by chain + One chain can have multiple registries for different underlying DEXes */ +const HYPE_REGISTRY = { + ethereum: [ + ["0x31ccdb5bd6322483bebd0787e1dabd1bf1f14946", 13659998], // Uniswap + ], + polygon: [ + ["0x0Ac4C7b794f3D7e7bF1093A4f179bA792CF15055", 25305922], // Uniswap + ["0xAeC731F69Fa39aD84c7749E913e3bC227427Adfd", 35447517], // Quickswap + ["0xcAC19d43C9558753d7535978A370055614Ce832E", 42562328], // Retro + ["0x97686103B3E7238Ca6c2C439146B30adBd84a593", 43578714], // Sushiswap + ["0x7b9c2f68f16c3618bb45616fb98d83f94fd7062e", 44933860], // Ascent + ], + polygon_zkevm: [ + ["0xD08B593eb3460B7aa5Ce76fFB0A3c5c938fd89b8", 152596,], // Quickswap + ], + optimism: [ + ["0xF5BFA20F4A77933fEE0C7bB7F39E7642A070d599", 6538026], // Uniswap + ], + arbitrum: [ + ["0x66CD859053c458688044d816117D5Bdf42A56813", 10617223], // Uniswap + ["0x37595FCaF29E4fBAc0f7C1863E3dF2Fe6e2247e9", 63562888], // Zyberswap + ["0x0f867F14b39a5892A39841a03bA573426DE4b1d0", 102240553], // Sushiswap + ["0x34Ffbd9Db6B9bD8b095A0d156de69a2AD2944666", 99952729], // Ramses + ["0xa216C2b6554A0293f69A1555dd22f4b7e60Fe907", 87343880], // Camelot + ], + bsc: [ + ["0x0b4645179C1b668464Df01362fC6219a7ab3234c", 26520492], // Uniswap + ["0xd4bcFC023736Db5617E5638748E127581d5929bd", 26097149], // Thena + ], + moonbeam: [ + ["0xB7dfC304D9cd88D98A262cE5B6a39Bb9d6611063", 3591244], // Beamswap + ["0x6002D7714e8038f2058e8162b0b86c0b19c31908", 3569487], // Stellaswap + ], + celo: [ + ["0x0F548d7AD1A0CB30D1872b8C18894484d76e1569", 14032548], // Uniswap + ], + avax: [ + ["0x3FE6F25DA67DC6AD2a5117a691f9951eA14d6f15", 29825241], // Glacier + ], + fantom: [ + ["0xf874d4957861e193aec9937223062679c14f9aca", 62144066], // Spiritswap + ], + mantle: [ + ["0x683292172E2175bd08e3927a5e72FC301b161300", 1000], // FusionX + ], + rollux: [ + ["0x683292172E2175bd08e3927a5e72FC301b161300", 1435083], // PegaSys + ], + linea: [ + ["0xc27ddd78fc49875fe6f844b72bbf31dfbb099881", 163300], // Lynex + ], + base: [ + ["0x1E86A593E55215957C4755f1BE19a229AF3286f6", 2798768], // SynthSwap + ], +}; + +Object.keys(HYPE_REGISTRY).forEach(chain => { + config[chain] = { + ...config[chain], + registries: HYPE_REGISTRY[chain].map(([factory, fromBlock]) => ({ factory, fromBlock, })), + } +}) + +module.exports = config \ No newline at end of file diff --git a/projects/visor/index.js b/projects/visor/index.js index 505dfbedd0a..b930a4b9397 100644 --- a/projects/visor/index.js +++ b/projects/visor/index.js @@ -1,200 +1,61 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const sdk = require("@defillama/sdk"); +const { getLogs } = require('../helper/cache/getLogs') const hypervisorAbi = require("./abis/hypervisor.json"); const { staking } = require("../helper/staking"); const getTotalAmounts = "function getTotalAmounts() view returns (uint256 total0, uint256 total1)"; -const hypeRegistry = require("./abis/hypeRegistry.json"); const { getUniqueAddresses } = require("../helper/utils"); - -/* Pools for initial LM program in 2021 */ -const LIQUIDITY_MINING_POOLS = [ - "0x64fcdd0de44f4bd04c039b0664fb95ef033d4efb", // GAMMA/ETH UNI-V2 - "0x96c105e9e9eab36eb8e2f851a5dabfbbd397c085", // USDC - "0xebae3cb14ce6c2f26b40b747fd92ccaf03b98659", // USDT - "0xf178d88d2f6f97ca32f92b465987068e1cce41c5", // DAI -]; - -/* List of hypervisor registries by chain - One chain can have multiple registries for different underlying DEXes */ -const HYPE_REGISTRY = { - ethereum: [ - "0x31ccdb5bd6322483bebd0787e1dabd1bf1f14946", // Uniswap - ], - polygon: [ - "0x0Ac4C7b794f3D7e7bF1093A4f179bA792CF15055", // Uniswap - "0xAeC731F69Fa39aD84c7749E913e3bC227427Adfd", // Quickswap - "0xcAC19d43C9558753d7535978A370055614Ce832E", // Retro - "0x97686103B3E7238Ca6c2C439146B30adBd84a593", // Sushiswap - "0x7b9c2f68f16c3618bb45616fb98d83f94fd7062e", // Ascent - ], - polygon_zkevm: [ - "0xD08B593eb3460B7aa5Ce76fFB0A3c5c938fd89b8", // Quickswap - ], - optimism: [ - "0xF5BFA20F4A77933fEE0C7bB7F39E7642A070d599", // Uniswap - ], - arbitrum: [ - "0x66CD859053c458688044d816117D5Bdf42A56813", // Uniswap - "0x37595FCaF29E4fBAc0f7C1863E3dF2Fe6e2247e9", // Zyberswap - "0x0f867F14b39a5892A39841a03bA573426DE4b1d0", // Sushiswap - "0x34Ffbd9Db6B9bD8b095A0d156de69a2AD2944666", // Ramses - "0xa216C2b6554A0293f69A1555dd22f4b7e60Fe907", // Camelot - ], - bsc: [ - "0x0b4645179C1b668464Df01362fC6219a7ab3234c", // Uniswap - "0xd4bcFC023736Db5617E5638748E127581d5929bd", // Thena - ], - moonbeam: [ - "0xB7dfC304D9cd88D98A262cE5B6a39Bb9d6611063", // Beamswap - "0x6002D7714e8038f2058e8162b0b86c0b19c31908", // Stellaswap - ], - celo: [ - "0x0F548d7AD1A0CB30D1872b8C18894484d76e1569", // Uniswap - ], - avax: [ - "0x3FE6F25DA67DC6AD2a5117a691f9951eA14d6f15", // Glacier - ], - fantom: [ - "0xf874d4957861e193aec9937223062679c14f9aca", // Spiritswap - ], - mantle: [ - "0x683292172E2175bd08e3927a5e72FC301b161300", // FusionX - ], - rollux: [ - "0x683292172E2175bd08e3927a5e72FC301b161300", // PegaSys - ], - linea: [ - "0xc27ddd78fc49875fe6f844b72bbf31dfbb099881", // Lynex - ], - base: [ - "0x1E86A593E55215957C4755f1BE19a229AF3286f6", // SynthSwap - ], -}; - -/* List of bad addresses added to registries that need to be excluded manually */ -const blacklist = { - ethereum: [ADDRESSES.ethereum.WBTC], - polygon: ["0xa9782a2c9c3fb83937f14cdfac9a6d23946c9255"], -}; - -/*Tokens staked in Visors*/ -async function tvlLiquidityMining(_timestamp, _block, _, { api }) { - const balances = {}; - - //get the staking pool contracts, and the respective token addresses - const bals = await api.multiCall({ - abi: hypervisorAbi.getHyperVisorData, - calls: LIQUIDITY_MINING_POOLS, - }); - bals.forEach(({ stakingToken, totalStake }, i) => - sdk.util.sumSingleBalance(balances, stakingToken, totalStake, api.chain) - ); - return balances; -} - -/*Tokens deposited in Uniswap V3-like LP positions managed by Gamma Strategies*/ -async function tvlUniV3(api) { - const targets = HYPE_REGISTRY[api.chain]; - - // Bulk fetch lists for all registries the chain and flatten into one array - let hypervisors = await Promise.all( - targets.map((target) => - api.fetchList({ - lengthAbi: hypeRegistry.counter, - itemAbi: hypeRegistry.hypeByIndex, - target, - }) - ) - ).then((data) => data.flat()); - - // Filter out invalid hypervisors, valid hypervisors have hypeIndex > 0 - hypervisors = hypervisors - .filter((hypervisor) => hypervisor[1] > 0) - .map((i) => i[0]); - - return getHypervisorBalances({ hypervisors, api }); -} - -async function tvlWrapper(_, _b, _cb, { api }) { - return tvlUniV3(api); -} - -async function getHypervisorBalances({ hypervisors, api, balances = {} }) { - hypervisors = getUniqueAddresses(hypervisors); - if (blacklist[api.chain]) { - const blacklistSet = new Set( - blacklist[api.chain].map((i) => i.toLowerCase()) - ); - hypervisors = hypervisors.filter((i) => !blacklistSet.has(i.toLowerCase())); - } - const supplies = await api.multiCall({ - abi: "erc20:totalSupply", - calls: hypervisors, - permitFailure: true, - }); - hypervisors = hypervisors.filter((_, i) => +supplies[i] > 0); - - const [token0s, token1s, bals] = await Promise.all([ - api.multiCall({ calls: hypervisors, abi: "address:token0" }), - api.multiCall({ calls: hypervisors, abi: "address:token1" }), - api.multiCall({ calls: hypervisors, abi: getTotalAmounts }), - ]); - bals.forEach(({ total0, total1 }, i) => { - sdk.util.sumSingleBalance(balances, token0s[i], total0, api.chain); - sdk.util.sumSingleBalance(balances, token1s[i], total1, api.chain); - }); - return balances; -} +const config = require("./config"); module.exports = { doublecounted: true, start: 1616679762, // (Mar-25-2021 01:42:42 PM +UTC) - ethereum: { - tvl: sdk.util.sumChainTvls([tvlLiquidityMining, tvlWrapper]), - staking: staking( - "0x26805021988f1a45dc708b5fb75fc75f21747d8c", - "0x6bea7cfef803d1e3d5f7c0103f7ded065644e197", - "ethereum" - ), - }, - polygon: { - tvl: tvlWrapper, - }, - polygon_zkevm: { - tvl: tvlWrapper, - }, - optimism: { - tvl: tvlWrapper, - }, - arbitrum: { - tvl: tvlWrapper, - }, - bsc: { - tvl: tvlWrapper, - }, - moonbeam: { - tvl: tvlWrapper, - }, - celo: { - tvl: tvlWrapper, - }, - avax: { - tvl: tvlWrapper, - }, - fantom: { - tvl: tvlWrapper, - }, - mantle: { - tvl: tvlWrapper, - }, - rollux: { - tvl: tvlWrapper, - }, - linea: { - tvl: tvlWrapper, - }, - base: { - tvl: tvlWrapper, - }, }; + +Object.keys(config).forEach(chain => { + let { blacklistedHypes = [], registries, LIQUIDITY_MINING_POOLS } = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + + if (LIQUIDITY_MINING_POOLS) { + const bals = await api.multiCall({ abi: hypervisorAbi.getHyperVisorData, calls: LIQUIDITY_MINING_POOLS, }); + bals.forEach(({ stakingToken, totalStake }) => api.add(stakingToken, totalStake)); + } + + let hypervisors = [] + for (const { factory, fromBlock } of registries) { + const logs = await getLogs({ + api, + target: factory, + eventAbi: 'event HypeAdded(address hype, uint256 index)', + onlyArgs: true, + fromBlock, + }) + hypervisors.push(...logs.map(i => i.hype)) + } + hypervisors = getUniqueAddresses(hypervisors); + if (blacklistedHypes.length) { + const blacklistSet = new Set(blacklistedHypes.map((i) => i.toLowerCase())); + hypervisors = hypervisors.filter((i) => !blacklistSet.has(i.toLowerCase())); + } + const supplies = await api.multiCall({ + abi: "erc20:totalSupply", + calls: hypervisors, + permitFailure: true, + }); + hypervisors = hypervisors.filter((_, i) => +supplies[i] > 0); + + const [token0s, token1s, bals] = await Promise.all([ + api.multiCall({ calls: hypervisors, abi: "address:token0" }), + api.multiCall({ calls: hypervisors, abi: "address:token1" }), + api.multiCall({ calls: hypervisors, abi: getTotalAmounts }), + ]); + bals.forEach(({ total0, total1 }, i) => { + api.add(token0s[i], total0); + api.add(token1s[i], total1); + }); + return api.getBalances() + } + } +}) + +module.exports.ethereum.staking = staking("0x26805021988f1a45dc708b5fb75fc75f21747d8c", "0x6bea7cfef803d1e3d5f7c0103f7ded065644e197",) From 233ce1119e969ead0b59e25b08bdfce50836f666 Mon Sep 17 00:00:00 2001 From: Tan Date: Mon, 4 Sep 2023 12:03:16 -0400 Subject: [PATCH 1093/1974] Update token pools (#7369) * Add duckpools * Fix duckpools implementation * fix imports * add nullAddress * fix import * erg pool * just erg * only sigusd * only sigrsv * only quacks * final fix * add collateral contracts * Update duckpools.js * Update duckpools.js * Update token pools * Update duckpools.js --- projects/duckpools.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/projects/duckpools.js b/projects/duckpools.js index ef494c33609..eb596ba1cf8 100644 --- a/projects/duckpools.js +++ b/projects/duckpools.js @@ -6,10 +6,10 @@ module.exports = { ergo: { tvl: sumTokensExport({ owners: [ - "3F9bBReNRNpy8HU2PNNRbCdHgzj6F5WgDmKSRAg7bkW3qaJ3VrjQkfqVX8BxikVHLUe7YeXhYSZ6AvwA2Wze8yBQJbK4rvfbsDnm2kdebdTfJUJgVQxyPmvwqwExyoP2TQHpQQLqqwsYgTXPKjnWySGbPtAxRgaoHiJiAmg8jp5AK2LHagDmM2XMyjYy8G8BLSA2t3XmvuWeEt5HPtDN53iigDNv3HZ9FGJXJVJRg3iF5Jnq7tk1xS18PJeSdadmQtZrfSYiET3ojE7SDstGPKB8gczd6b8SGgfc4sXyCg6jxPwXQQDHRNk7JHXeKs4LoSxnHy1WSLqfvHZ6hTef3NjCpLkewoSLEQVSMhWcZMZhcD2zFxeeN3SqT9UAg2n2yGKiXb2c7kDtneXNPgqJj2U2hCNQT6EKpBQphahQ3md7LdoixmcLVDGwkbe73SWQr43eusEooLtigYB9ySAoSTzgbxFbdtF7yXY6jX7hCDu34WyPpvw8e4JEt4fRz8NVtUS7V2BoM8qBoVV65EYfRvTcdP8g5aTRhbjig91aJpZYHu8W1xupGgZeHtRtFs6fw7Cks2zS4fvsxcP4TBL77TaNzzpAvd3HBfK2oW34Qk4eHPFyUukX322dn1nPnFYS6kWqMof2M4rMHT9N1xKCEKPG4HecKoomAnvMDhMQxictrp3FyFR5h3zUWNhULA9HTi9Aj9XXCEyDt5gSTNQdBSrM7uvbBMjeJWdkrpuFFMYNA9yoQZn4AZqvjLj3ZfTVBs5NGyZu997GhRCzGhTmrkxJwDXdCJ62EjE9b6ZJkCkqwxzMJgKtm9TyKyPpS2kqUjD2cCBPHakyVeo9WYdj5Y25FWq7VZBEzqBuECwpXuXWyM3tECRi52uQkBDnhRhfwpPkZJXqjB2ns4HcmVHYk14e9fLiFXPxGs4Q4db9D2igM4beGTdu4HiNAaeH1xMNyLEy4fPUFx41RH77nFqxaxHJiqMdSUioiCfQbxH2Pn7rSaMJNfB1HeXKzfobc4mmTRnu5yyzpSRHFTBc4yVbrdtoVZS86fty5rwUBHuhiiabpUyHdEWygKDdoiAFZ7Unio8uPsDEmG26eZc6kcrt2WmwV6xkGYKk374j6tLTPSJyC4DhjAdSKpQiLzEaRuJN1qdB8hZpBZhuFoziertayGN6sEARegJf67182CPZy6QXwcUyiZJ3GD2g9365o64ThDgvnU61jHeUrgMqYn3LDU6PRgwG2n7dGnqPLbTRAo6mxnPT1oPtDC5JZ7tCgvyj5BCN6HUB6wAxwdvSSDkJiSPkKbCTs7JSwfidpFBpEuaSKm5syBZshGmkpT3dRUgC9qFaVmQQCxfM4zBtRecYHwsnK6RvoMmdVLpFbe3WQED5NKC8ir6eGWumFYdKP82cYfuRy5vke9WVxYrcsec7a5BUj2uhcn7Taeej3k3rvUXDeGT12ht484s4PwtGr1LKxKtGszdJSBucWfwu667bZw2nQm8hd55uKEQJPscMk2KEcA7JfsoWGLWpcTG7mBRHnJw1qC5d339di3a4MoNbmax8HXG4hiPEVMrrt48aYWSoKS9uwCPZCbAkanxrY3DGr6SiSdvU6r9EVcLffVEpEWJaw6Yh45jPiZyMRGc9AVgLzUagw8qedrbxjR4KJUi9AGsH9ondzQGM9ds2NYPfAwpeDH1vLqwKbRYcKjdL6regdmXwdveJsKzUwDY4x1UmHe", - "6Q6fbqfbMAogw42DWDtKuKt9frSKdqW92cmiPbeF2SnuYCS9Ca43ZAiJvR7KjZoWJZZTvABJafgBobWJmGkqMNgFsnp9YQS3RjCagcJdgr6nisusAAuz2wEpxXazzQPYdstFxNiW9ewnL6usAry4nyaydtEUuCaBf3yvPsdGTh9w9x4PLcj9rd71JzNBx9yS8hVd4H61hKXZgE51UQqsrQp9o3qYp4b219R1x6Cvj3ejvBDYanjomykDi8KLv9doW4BgzSqvoTf5hiHK5rcbt4Kf97bZD5hEyWZidNW2R1hpJM67tG2uNt4XxstCptGvH1Kp3ehBm5v1N7CEcUdJQBqHTrZ4Bj7Fwkg1vK7NZQExqHEE9MnuRmHPYtn4SKegR31WTUgR9RcHZ9QgW1a4adT3eR679mjWSDYmRMAt6BjLGK66a1oaZfunFDRz8fDU3hzhoSphTzo2wDvFLWKqsCW7GWY4FPnvnGJBEyet8vd2VwLYoXtHjivhoZYubiHbWFewng7iNeYy1wHWETrLyK4L149yqVVgL3EK6p9e9TURurcKvxFurp6FGFsfEniMdc1z8n3qAXizxKEQLkqmLYd2KBVmF1uXwYhphPha8pcLx59zJfEtxww5Ch6JhTRxmDkfBqXP4Qcvz3b9rFWBsqGVDyKPm3BkjXrrxgv3H2Ryi8WJMKFBNDCZ4YxmeegAfAqgNPbaaLzvYygQRzZ12xxKuqAKcLTSEu5ETwi6BMGpgXArxDbs4utwZahsecVAcn7qBWwnF3ropdSTLBUzwW22udy2CXaXgcpRaQi5dufF93dnWZpHc5ApKUXdN7yorTELjh5yq1RauiQ48zWH3zA4WixyZMJ7raGA7HoNh1mewqfSLyFHGGUgfUTynj4xjVgLyQWZ1yBixjF8ByFeuqXK81ExDnFiqF4zVgZRWE2bKJyBViw7i9BvJL4kPRbKm5WLkAUv92QKuRuLSxnjY2KBG46unAVsAsKoDHKeqsaBTKAcka4kn37pwtefTadqt1zJiUEJLoNoH1wp2P93fWqCVN8gaRdcZRJ1kLoq2sGbznpGSK8ULBBqmpDXcdjC7tNAPMp87eYXsNxT5HFX38yjKFheyVPNSMxj784r1TuGe6MC7PPjHdXbVNFsh7aRKTdRPUiDdrZhqZ7zgfziQsZR3izSVgjDS4u5rjT5NjNQn8r3LzNfaXPtpoCCp3Y8f5zwF9kFpu61ZgwhiSuTRARth8su8kfibqZqmE99LcEMzRd3KvzUcLLcDA86Xmz2XbLaMRxJ72yZNd17a2KN5sYpjhUi7yb2XtKsDpfHA14wsDcFsefC1BzpQpjQ7sgrHxpQPNU2dFujjjF7pEySaVHiVfvvXxd2LcT4WfXcdksLfpxyZVuepWdNMFYkypzHV17Q7ca5h2SQY3DCjkShmqozZLACGkRUyTH16PPHtDAicofcAenoV34HECXcyy4kqdCLrFMSBsVs3gRGt2hY5j2d1Uo8MU6wo2iSkziWCJwGtP9TQ2saiY7kY4DYTYV6ZN3tpM1wrdhaxw1fcrLnqinQXL1U1WzHNDi9JTK1c5ESUct5dWf6tLdLWpDemX1NMP2RCDTe1TSYYWyHRCX3Akog3dEqZKTk6nofanV4Vw1MjJZWHaeXMVcvr8g3sN9vpwjyQ18WQ8ErtNzTzYiChd4gr7pwCc74kdCuD519s8zAa89XYnodqCiejgaxutY33TYSp9atpgXKUmtDaeV3UzQnx", - "4z9dZrkxdYok1tkUF56Emr1XAzzi7VY8rTzxZ4qtv7VACufMJDQmbBVsgAjVhCwtjXtKAW4bhLMvZJ8NQwsMcHQXjEP9EN9TnNHL8P6bQjWy2oNLnTrigaCi58SQG5BQhEN1RG4akwss16eHTZw3nhhpNqrhe2y2TBvr3JukYdWJXWN1An7ZZ8pzV6ma9GkrXHoFui6eWqn8PYM87HMRDivdjt9wQQuRDSgvV4BXBxheCiWyL9bKtKs1EoLybK76UyVykiF2CZGZ192bPXrBGrNaucz5xBV67sp7zD1X7V3vnw9kZ86Ldwik57VKUMDHwUniSZaQ5yiVc1PxBXMuuTfgtvff1vFDhXhYaspeGCrvcDDC3QNPkKvXddpteqYCzvp83wk119wuPccYJ21hAz6QQj1Znz6d1L6LFSeoykXoR3SiAw9E69LYa5vocSTasVqqhQJhZnygtSA1zPxCKaFtJ7CpVyW62Fy81hfboVXfdAFJvM8LKag2aJHErEeWgT7wX5KtDK1cHwvNbqfGqDBr8zYgGQ6K7YG4n9e4B3R9knAb9qdouKpR7D2x5NMfuY6RxHzgnG2Kpzg2cA7gLJVWXeDK6KiN92ddcjTfgdR4K7kPVbwYvbXEtKmXAWVfx6ngizxmDg4R8ZAV4pTwWxb1wjgqpycErXXrSYUBy7WRkRMhkihnp3Ysfz1XpdHunQCYYAeUTvaGPnaebwJVaTKy9rv3DTmyCiS7qrfNxxPr3BrcrdzVxA49g3Rkevn4v2ECeLppgsyB2YeC38gCWES4GSebzRmgHZ2jqwTd3arCU1ZyZTv2inM26ey3csxDRzbvA9V31V9AWZreqryqsB76NX5iJnmzpfyBw9XqGXACfQanWydtPmWBok9bDvVS94B7LYdoCnJwFMeS4NvT3PouWMLWrBaHJ2xWgWxisVAbhEjxrKpc4SepkmndfkYdi6rUabaBVbPgFjb9eZttHpn6tY97SyeZqZ5cBeoRwL2ywMD6VFUijfw2bNGNKG384kEkqTEscgZ4zZYapvFgVh1mM7yKQJ6ZMbPpWfTtqzJfBsoewrfJCVnneeVNxPydR4yXeVGTUDUChuD29dxytjzA7ucXATq6hpdLzYgBou611fWLKdCMHsLptzCMo3FZ5qHyPGoTwx2N14iTqFTs4yMimhCSvUsRtWyh8ALh2GjRjCgRKW1aYMNUTcGAfgs63mTyENCatGofQocHYCPxThaAiMvHfxK6MhGH5uni16iwPsTLGzKtSa73X4jiA4mk1KbAn6HTTnz49SAy3SqJC41owi4NULGvHFz3J8hMdUgK9K1X9opJnW1Ma6oirQQU6NsR9FXjzMMBRsyRF4FRjjty6t17Mikn7irP6dMSfapigJwTdq63T6opUAswEVM7WYxVB74Co5G4nTGrAPBoZMHHkqF5LH9Yyw1r5BSRgvAqTTq5SHt7KsQMTD16MKcMFcwVVqMiPLVAa4YHjYpCFfG5MKG7vMsE9p62G3w5pdcPMD2AG2KsTqYc521DkmvknQe8CAojTS9Dd1zzKM9vWkj9ror77CaYi8TE1oZufpqsBUWw5syBmpXrMzWoBm1qT4bcYy6npTmfFfG2NVbdZYgCEGAnzCEykuMuNXtd5WAfML5MwWoXbRuwWo7gzXnHZCtur3yM67ZPQZqWrvz2PJ6QU841VN9bVV9T1YptceyTKWkrjpnd64VbUpiXbe1cCCA8GuKcJwq5d7sw6uYQjU9tsrHr1v9ZiVoN", - "6Q6fbqfbMAogw42DWDtKuKt9frSKdqW92cmiPbeF2SnuYCS9Ca43ZAiJvR7Kjfp99STcigCqWYCTt7JzqeFASVd7q9nWZacKKe8bGKNN4o7y4Pzd6mZ9foAEXKzybfc2HDuvG2oCoxoAMC4dsnnvNwjAY8kYozoSdCfX6BrWj1NF6unYaMCo8es9sZJiUS6j26F8irUz4yNjPpLKgxxGxBUTGvgo2qRW59xHS6BQruPfPsJjvEYvSz2AeaVqxnw1jgtvBjX2ERB2pfNakZ3zC3B6aNSPFZNsA7QZBXUgvG9q1A8KXLMJXTYJ4RPYk7BcHoAvjdUj391nt1chC9g3P2vUZFo2DAzoDwbNtqr22ueNX8vhC743CAUVzvDSei3KXp4MFLeWuiAYEd7vvSMVPLMdy8Ak73McqJLH1hGPzTKsuDxeNmuxbpNGuuRzHSPNeo2mUcL7afg9z2mkZM6KLYQ4VTsRMXG9NT6Qx218xy4ok9qcBwaNnZzyoeHa28Hkm4urRwj1pDvUNj3pxodzvLVYQdGZ46TXf41MLsWL5oBRWXEKSpNZt3XLDeK1V3bvoSKxyHWUskVWKqtdYkdb1wc6pt9r5WH1Ndjk5RQ3whG4kW17rr63CuATNBRxtwt7wsCno8bRnLtnnLEyMK6KhBVRHKpPHRQELGecp7d8Ze8zoYo4Vz2VFQQ7uzaGDrRuyKgPhNhUh9rHk3CSounphWzc4CqGxqqyt6JST7YvBxDZDVDnDzJNGgVjXwJfTXmkz6PFwohCjZRr5JvBtQ7vJ7Y9kCRoq67uWrPUB2jzTYJ9NWTNpeN8z4rCU2h1i7m5KhKwuHEJheuLVpmFXYRQsFiVW3128jRidN52JqbPbSnvaDJ1UrXHd6yqzV8Xr6C9bKecv4s61maHp3t12WFovqSg5VzJAH2cwyyxDatLniGBuFb71jjumt6iNvvxBsE6zcLTr46ujspUXv7aNmsa2df8th8m1iHDDL4xnSKetRFgUN8DBUUSudyBZrS9PU58noS8gvH543YDVQLczvTaA6c6TDtCXvXeHUu3i1BEvbQAX7jcFJao4U1fTX7Cvb8DRehy9RLtsvZvjh9fWkGtmf6dmjgKWnzWTiZ8ibNheZ8wkMWUWafDRCr42kKmRzFNuirg8y9YaXfLBMYbvkQ3kwkVmC4kgyFF2MhaEzwVm5EXEZVX6QZYxKWnhrZbzVXuWGDu3Eb3uRLfPuhm7GhdeLbhK6dm6eYZb717KPwKpqBChZs4Mo6Jsi9HzxycPG1FzXDgruXaAt1esQDvoS2MYc5NPqkPSeuv5L2EHMEq2FwiwcJhPHABTTYEfH7SYmCsatXtkgRce6o8DVVT5Rd45xWoiNKxCeGU2apPHKv117fo4mQUhBNftKVNBytGGu1RRsrCknQVCFJzeWxCc2CFs1nPz6oxt1EueU7jmMu4qnaU8BBbzdgJ3DaKeVysVhNsuqPvqUcvYhnmVFK5RPJHxiLA5Vp65zWHvL69AmWKGxP9EsFY1tqLqSPGfgJ3Xvz16v1Kg2kbCda7ZGk6sn1e4ry8UkhQLkfFQxqFnHxgTn85Dfp9kWwVsRPKxM4EwQmPHNKpWg7rT2NdWz8D9Ggm5yV92YarSWQZGAWFuUV7pW4zZ3vmsn9Ay51mh2C4VFHWEGjnH91cNwpgNBVWt2AtVeW3uL78fDiYfG5iprTFyySLBc4rdHQZQofhdyz9p1hAJGC4iRFyi2RoNX8GsX9GrAAnt", + "3F9bBReNRNpy8HU2PNNRbCdHgzj6F5WgDmKSRAg7bkW3qaJ3VrjQkfqX5W8zDRuUTRJfpt56L1mpx1V7Pt5Bo9QtT7HVQBWqRoUvTVcTkTRsPHRR363M14WsjKXfqPLvauS7BvwtggxXA8S6TTW4gArraoqauhfvyCzjHPNmmfEDypY2wvvMsYNW3VRQYCK8eDNLmdsQwvtGbULeeMdKXCvyH68CpAayLhuVbALRkKCyvdQvAz3gr3yxqNcrScFPxYwE61521iVGwJjfNdXPnHmkespPtM9hhj2qh7HdsAmbQUAJenRpD6RCN2pSh7aQUUZiQENbTxVmiJkqENs99yTv8aHmGFWsw2WQcwVH394M1Sj5ue1CCJYHg6N6FyCXyptsVSqvBG1scmUPqbPneQDCvS2xHgBd1HCrUram8mgD9GewBehXJXa5TL8fe5G2XnGtLukkqfJfmRRmwvjCxEcYv65gAsGW6xxy6YgGm3VxzDUdTnHisGYf3qFnEKkiZf6stFRWPNRcJmRh5jKHqVHjEWMQgdqRjv44qT4zKG6ewUYjubGhHjVy7qedLUnDvM1X7P1CCankPJzDJuZJqnefRrbcuNcP5Fawx2E2NdihRbiAKbA6g3RuNuS2WEPEkQUs7rKGT1fgDw41hq8LaoSf35Xax6eopjzEGLRKYyXqWb7yQfPVNebnYVxbXbRg5aVqHLyiJ4h5sqAdSm2QUjD1oMKuYmbqbqCsYfp2oxJKcL5i7JLnvEKSP23YmsN9Va4SAmmWj4VwiqexH1DGR2pt78LPpWgK2EtHN2gLk9KFnGmK8ZVZG2yx2taH6JXoZXieXarGkBPJrHyB4ZzB1K2pftLwk6vyvSVmfqz2VSi2Lc6NPyLiJ7eKdpbMFaZYm39FkhgCy5Wc7Be7Yqvd7RRVDhx6K9jS4YwPN8aCn24jtKXMs8T6orwxS3tFQR2cCMwqkFuLthR9PUVwX6wiEZ7qNc2p9eCQ7hcqSSAEnqg4teua4GLWtqYFeG1uebJERSBbgjEptrKswnPhzvcdabrwsMopBvknjzjdawW96fqgraPBhbcKDo172x6rFtJnmYrLd9mfNww1twDy43Nz6xGyP31u15Vjqr17g7tdd8sKHPjHFZX37RXquKf5k1i2DdXtcjmAWmuACe1QtfBitqJNwRbMe4RxgLk5doDX1tNfQMQdS1i94RSRrmMaRZUSndJZGPXxVjX6YcjXmVFarb8S9EkkC4jSm6SsHu5aHYG351kTP2mv3fHohRwNrqKkKpvxw1qe9QgYHDufFMYZb88SmmsBLnLGy6rsdurvdqdqWJFbxYvxmRumeSY3H69C3R8pbdrWjSLwxJTy6F2yQ4SQTBuwGpRuD7hcnKt84ajhNsFc4Fmzp8Zn8j9Tg3FSXR4M68bf1ABwnkKPBLdHmEe1qD4qYhGWd73SJVnHarpfyK2Gc1rXTrwCw6kqJRoQesNWQrgxbdGmm1aawJ1Pasks2pBd5118zKPHi2Wi8mCRepWKzv6oJjbWBiZtzrC6kEPXS8S7g9XpiGSFCSfK8aiHHYdHn8iAyuZeA2Yne4DmHZdys85gAh5hjjaPPYuMTHmCr4WbrNfMegX7oDyh7yrhV2sPbgRq7d75eXwpNW9Q5fs4xBqDbeJA1o26yCx7fkQ6yKs8DaWcgv9cFoJB1GA4V3izUpejSw1wqRR3tpMHT1LfB5GpJGoSXGkFQ9Mybt", + "6Q6fbqfbMAogw42DWDtKuKt9frSKdqW92cmiPbeF2SnuYCS9Ca43ZAiJvR7Kj4ZW8yyTnsEY4Np82vF4BDrStxi7PkyGhvppdoWVV2Th3ALS38sWtvYqhso3fx9Ehwbodv36y7ytNZfJitGgx586NsXgZhn3hCVZdUq694vdDRWCyAJygAsu2hHaieTm1F7ZgGufrccYezPtDv3WjGiRZsENiPCheAJ8uEZVN6rnatXhvDhuZgd2ghhzxi4WxmTMSW2C8eZJukqxcqD9D8Jd21b4PYcPBMtqsWACPpKproeRiVZynvDsCKMx1HnZiY8JXSk3qvwtZmxSn5nw2GtKnfXGV4pjHHSr7mpKysayFxKxdWuFJ47S29SRqw8pL2bk4Us9haR6BbDR6uintCUVZ7Q2LAsMmkWwmKFw3fEhBKeq1hWgDAASSuUWXm6ZbYi4XLXchXjYEmWsZ6mYWnBW3QPK5iezrZiefP11GCohrbEtMLTQ1UvX2UchTr3mDqy7zQdJJLSC8Wnc7dEGYF59VJG3iT5aCFyBR1qxVdmyjUaEYDLmxuVS87HbmXoSBpi4jSHPGt2sLtNTKBpa7q7A7qvyGGAaxoPuPrtkuA8aV32vDfsvDSBWCVGN9zVpVBi95UV8G4mVHMKCAngRzNK93obXoWdZUe2y7QfZTHNY935zthiA2eWUiz8eRvGrbVTo2veXN3g1iYtBtmUez5CPDuFt4MdJeYyPY54idD6qPHVw8Kqnxs1QVK92qZCAGjjDqcLJwTC6kDhT3e6mJdrdmoCGuufj9KsNyzXwtwVo6wVVw8ZxJdRCf8c6cjEmSSS7SJWgwmgGMiPiQeo486mnzW4Pb9q3tdBAw78pttaFdvwp4iVFdWjkdgz8AxW8LLnjqjVY6aTrpFbVMk4nLbjR7zj7AtUNP75M55R2QKVtxyLvmw648ZmtgUAaXFxDCZEevVs2x7KotXtcY9zM74cGbgcM1ukwDVnzrQuGi3T6QBiFbWPxYjVKXVHhni5F1j8qK13XPCkwNRxD65xjKNcMekPyXDqTBLrx6avkSCodPvDPzVJJcmvzPuhdaTzEKy1pDy8h9khMDAW49VnAbzFpHv7o6WwSTyqMmipDcj8fdpL2wNkxCtuVUt4CQnthC8nusoCnyCxXboHdpMe4ebhcigSYbYPr3D3kkYoqFrBRqGs4aLuMsdYQ2xB7CeAf5EiNYurAFCtuUCy7Y8bFbdzs6XbG7wAoCGFZEd4Z1xsNNpSyWzy8TqE69yySKzNJ7FdmTbdVdUrKMjrv8DZt9sSuVL6RxnoV4DYsTeJRf3C2Z3ppsYuSqPaJwPtTqEzW4nRtHQ7v9yXFUAmHdGTsf5vnDcBa6dLHkhiQwpp8hU43qVj6CpftjsyJuqpWNfZ9QmHafy5PvyD6PmbPHey3knKuCoFKje8HbtB6e4Lt8wigxyThiRjyex93K1a9SixyfsXAH2sva7J5RCduZiwcrUPEKSU8eroSizXqAjpGm621AKidzMqVCYdgM1yvD6PhpbyYGLDqEBoMz6Y9hgpuDpK5skh1r3agNz23j5eVFxXoQ2ooEbNsxHGLgmmQcPHTA6YWs44Pdw9wGEqhZKBW79nqtfY97NxaVF6MFDx9WRcxiRsg63AWKRJfjVFLrZDyDzLJHxDKdEzwQFbdnB4pyfF2w7YD4bMTKqQFuegEwcgBWcziTctEeyMjtd8YB2dG2e6D5oJa38mnw5QyLLSugbFbyFV8a", + "4z9dZrkxdYok1tkUF56Emr1XAzzi7VY8rTzxZ4qtv7VACufMJDQmbBVsgAjVhJ16AmnaMHLwMFoPYKUG3zL1d5Z17AHK6oGL2vxjkLxoEACbfMBMCaaMSiiZeZ36dGLbX1PAL3Lv4u2A7XfuZzd73QRG65t3v32S1hjSeamo4JBkY5hE2tGEwR9DaFkMn32Vh4PYYHm4aMBw9kCSxmkBZDvVYgf8yMTqz8UGyRDYFMFovuZhY2KTvYNrbQyUtQkbJ2Crn7ZmXfWbGV2FNNEwEfVTeNLVBLNky8sreH9XKFv9iASZ1Avd6RNHuBuSBh9aHdvABZwuZhaDBjKwzvUKwV9GTdzgeLb36naha5AxNVXwB2HMtUpeuG8fQ8btcpyrSYoUJSFFvoqhf1EBAWas251Wng4QQ4TdmCJfZWzrTK1NbEWX1dMYCm1pR4mUqNiKDyE5Ec5ftcRxv2N8jA8dErpYdSdT9g1v1sYBYsBn35zsFaHryxkYLTsSpyrSRzvWJXBxZQdPvztTFSxuyH4WMttUPFNDW567wZfco9u51VV3TYAbxLdn9JfQwmAHCwsBeAyGPrRLhpsEabGcVQSNs8ZTiRq9g7SuVKFBHHuCUnGqWkvV4DVyKHkwG6qT5Un1UxT9WZpuz89fFFT4Htd5DptFUQw2MqrZTSTrv9BEqGCy1WF54KnP4HHjzHsh9b4N8Fwbt1BQc5oHMnXbiAWYWy6z1qqBPUnGXUwG1k5mpDo8GWjJQQnHT5M6zaQaCZLmbANKmPtNsX3u7niy2WV5d9yMphoS4vU73ii6P9FPURxarfJ2oN19Zj9YTHaMY3b9bgF5P1U8gUUjZQ5dv2DTs7qULbRSwYNVaBUiX22yxycZu9j8dXMnzz49M5sdjuM8RjHyUAYUGGmFNsUVJkd3rotRNQr7QWaSpdQsZoVhALmTeSenXXMiBvGZu5jBMCmuR6GNNEbsQyWyoYyvCVAvTaUcmbjMBykNxmxCU7qUiY7E41S7RraDcVwk9dHZn17QXbsFCoU2UDyXZ6oHNxW76fx9UqL8Xdh3YpiUemGuhwansbwroycsZcqfWhvEtDre3Xrbtav91tPdwsFTVqt9yBGEZPNygQ6EkutVM99L36Uuwxxx6r8wph9iNg5cWZpefegJttkwzFEy1MLSWjmnhbgxDpxPfDGCGCEqBwMa5iNePBsLS7fhFdcn9VBrccozBSnrbD44g1TzNkb5yGRHMUrJ5KEYu7QtgxpfCAbjwxadgF3iaHhzDLW9Y9DHpVQTTTFTToRGYF6JdeTJt1LQDHMxTy11DmS1m3Pvk4bWSrcirVgxtb7Q97dz9fz1UHFETEYVHiVTjQzBYPYKvuWp8EDfjpuEksAAUzJHkKTukLoQE7AKCc9K78UQPG8kf8pbUj2zpVMUgEDdTwfk8pVUdjYNxL4sj3QBibPGs7CkziwFPgrJU8HsaXMXdMUPwW2Z718YN3mxVHiu7qiRdqFrjcAbVUiQsrsXRoHQyXowUAQLyQsWDCLUKBu1WoTe76xh4GDHsVKrCa6DgLeZhrTFnMay81J6TGJL9awQFG1pbrM9hCPQY9rn8K4gXskzMGiEgb3wsFfGu4KbfKL1dHsFiRdBgur5H6ccKRezb2bscw3rZKhU36c3igZnEsAmtnYCNQBySgS11rFr4tQdq8sr3gcN43GjrAgiFMFEcEAQGnD5ksjVEdCcttXFgJFCWkqapQyvEt4vALU3xYM5BEaQmdEJpHv2gsCvfAjT", + "6Q6fbqfbMAogw42DWDtKuKt9frSKdqW92cmiPbeF2SnuYCS9Ca43ZAiJvR7KjbKursffXBwTuRfRyvZv7D9fr288gd6ctQSU55V7jg4xeGy77VHcxUAqQqMqMy7v9FspKJ3wUv5sBDfqXaL7iX6JvvjwcRmRNtkk7Es7zmVKVvcrizZoher8GdkGkt5oWeF4pzeDcUk7dLiQUPEVhYe6Qi3o2eqdba1xH5pbX1TXssdHnQNwV4qUDfQjq2xzQkCizu7ByHfsp3E8jZiQXzpNDbar6kdVc6kYUmYuVsMNR7qCQ3tHKi8wcKkamWUq7upVBxfYBcej76SyWFr3AVwYDykf8tY7qf1KeCUHP7eRtEnpDy2StzMQXVr6XQSJKXA7n6L75Xqgc8H2fua7XkhEwgYiFTQArRyq41y7eQ6Ra7kjMjtSBxLoAGXPdKoQQTJqrmxRrFnei3vMPZfXpjcMtYgw83epZj8WdCGxWU3kcadLG627HM8U7rpyS5gvxUUoAakM2AwANvPJ2aRKAVPBrvfGTgEXMYgJ2LQvmNoF8924nFjXgJc8dwgPwVLrbZioSbacixWsdAT1arPzF3JyYJNimfJFRyAXEqmpP9iDF5WfvdjCuUxnJqAQTwTGDu1L2hxXxhHgVfzoqTgxcqwJ1Rt1wbrHo55J2ZaNxMbh6urtSXEU5rvxL6uAW49H51KJ8Dn6Jg98WAcdvv5oww1QevXuqSyqmQdwkKE96MzZXZYsv4dXoJWHVfFS2FknRxqFbDMk4tz8LH7eXrse7s2ggyfxwX5AQA9ynbwUrSn4PpzCjXezva5sA9Dkjy5bVRRLViTpAkKjKQD7Xn2KqJ1MjThf8xr4m7yeMHnYBaPWxPVhQsQpNU2EW6ZuFbmz8mLtaadVXphfwEgxeezopehtA8T2CnaJbFgWxv1NmcMDFi9oE6SEEBNzQi2bQwvprqAGQuPCBAAezUPWZ2pnesG5TW7Xu5btujKCN3RzmtzBm6gDEEkt2a4Rxk8GBMoB2TysAgiGgJJxkEPiRpZNzbmMwn6ah8Z1z5iiRPY5TSEjHbdA1qgyNTbR91JUajZCafnkjCQtkzKf36r7h9nRx6PTJCM51tziffqhLu3wqhwHbu6wz97PtkA3FeC5bmpWEoDeEE4dSbZ836aigMiATYZmgyj4LEyGpqoiRxPT9R6cStdNN8MwUpVTCne72zbGSfnVChGuKXH5oGpoZHPwD7MdQRY8FGyNKzBfrjvxEnXczTm8J2WEA882ExDZQdDDAmUmhAkTkRLBQFcPb3NEk6B7AJyshAHN5ThvjqJnbKEiNoCFr3nXBN4YcV3QymB9soR7N2b5rRWdgPCdHT731AW8mMP3Gjra93chsyRMMAGtquveWYWZ7ESXFLTkZTYtCskWDEZzezyFtgQ1tSnAsqetspa9NKxXSy8cb88YvwPeJk191AdPRTAZLNjYwdC5NzRyxsC897HKjXzkkvrC72SZQtJSyifb3R1Lzd92y3ic1JxAimDy92EQDiHY1hZ5yKRiJJZfkPfjDgxqnMCHRXXu7nxwFRRCeEkeUs7VafTYfYQurhoBnxg7Pzi6NAdohtmaEVo1DeKFBec1axcDLPGs9jzQEBYR3nkxJEuCGwDEJEKCm2142vA6uXvJ91Y22A6bkBEdmcAsotitHk6EMcq4YkUAmko9GnDXdTgTtu3bjRrEwiqQxb6d3pFE2jXMwoMR35bntspPQMMi7pCJYtqM6x2NT", "ZPBQ8yL1wGjPBFE7ZbLYxzGSrLZbeNGxodjoVsE8zTzmyEagNHXrufzveLZtmkQ38kZMcgyjhYKFLMAdABSh1XNiyd9XKNLBiyfMqgC36RPLcY6oMSCRVYNpq3UX1EjYCxBqueaZMMporh9vLoDMhE5e4E14ZL42FqNvpy3n72C3RwUTzaZwx3SeF8GjQwYK3sgt7Dkq9iKeX3tNAt9aVsnVTUumjMeF8G4pBeejRrRY8qWXBtMzHceMw38837vZJ3AcAwCUdVGQcaaG5fzPLt3PpyVnr6XFXLuoGbK9Ygs6x4vJNbAJteQxB6EFT9Hyi9HeWeQzh48GUmAVoEGBMMxrkU1ZKfApkwPbihfm5a3qPp7w22no9DP9WS3ybyQ3ttt9iFKtCchu8bGJPJuMhrDQySgSqcXJjnskmEpf31EuH86UFPYa75oLK2d2SvYpX2W6z4wmo828Lv3NaMz2Wm46oE9n96BPZng4z8n74ZTEPk8ydShLJ4GsJ9HtS8i1wUhbaeQ4pqFVV4qEJ45BQbLLyqPkmKJDHSLg6gWmve7wtfWrdv8XpsRFEkknJHXB1KatQBX1o7YTL2xSPgMbn6NmgNEiV6CiyscrMvwKj6Ms7GrKwjrQi2yN9t2GL5gL2DEfCsW2xtAr74B14bzzVp5MBZLjBUDE45YbJRdegMmH8eTmRY9Adp7Y5jifKZMyFdsYKK4KuGvv7oQReBnaLRPTYeFsEPidZ7EkigggyfMhqhYhB2osdRCX5454mzXcwE16auEXXxMyRRAdZkKGDQ68PWSmMjYiTBeroTyLYFjnvuaTeTDXz3fWVVVEYMtbFvMztsC6sraJtLTBr76R6Q5utzDoFRpgKuVSD3R3Me7CY8WhE823CSfMA82evcr3Cq4rJrKSZm4as3EHetXXW2AbJLmp6M5hU79DgEbsbSNgi7innpE4RGy9T8EUR7gvM8634kP9A7XfxkFRHU7QFyjxE9NnnLmQpG9C8AcC9NMtMycxiHs9y6wSgz5ZWqqzMexgmnq85AoKiwuknvuLgxjt9YctueZFvELeHbrL7Pr2Ywrn5Y2MDdv6Z7VNHAwMQ7KfEKxSYecgvNYDzNuvRdSRxdo5ST3s8KZwNL6JwJZ5jAc6TTL9txzbPQh9AdqkpNc2rsabyz6ChXAQkqXeEHmk4bDGfuc7tBH2BND6cVtj23dpfoCrrkb6fKUyxRz64mbxt3a15Qz7XMWCvN997GXHLpPMWCASRrtPJy9QhC1Mxxpmty9XuSXK54BDJUNdkMJ9CN8BhLT7igKnj23MA33oZkgiW93q4qJ8nZF2Bu57vYNN6Vozg3FCmFc2rTLm9zrVdgMT5McVvwefXDukVhF1Sc9g4DDgg825He5GnhdpqGtiRgmjeAVmeo8EXuJjPUWpNpSCzjy1oLaw1f6Y9kgm7CrD96Mzue8Fvijr9paRiKUqvDvx7KLkQbxDxYnJyGd2Mc6Ne9kBRXgriLeFTCTEnZewX41J1qcvGC5kTz2mRKsd3A3uusMXNDnghLpA18gXbMcNWiPBwQRPPJg9bzJS1CpiVekmhfDfQGzx3Ub5egEeUvpz451sWwWDd8YM1cxfTxRQs7xoGwKd8DLLcREfYuv8yBdz2y1N1HzndhL4ZHP62AZasnP8KEc5K3CCB5ksPDUWXDxYAHHu9YazkKGgL3SpXVAG1TouXQa3M5rSgR3FAr1b5g4WEhuC1H7EvCdy2UruQcuYEMFhFWYktowKdvZ5JAYLcpfs9ebCoXvFLbWGcZLp2vLnQnU8PbFvPMHNaFLnZTTJbm8PLrrtrACTnA2829QPiAYPJ468G4vraQHt1FetEqDNrfupMMpNwNPdFe6J5EUQMZA2cbsjJn7ctM2ToryKo9DwmuYDGTp3kgF3bqopS8CYmp7EcdftGuhztqoaDAXrDS4DDKfwSyfBQvhKDdp7WdmWNYvYrAgNa941peChW7jt9nerneiuVSrD6rFbLnbrtbvJ8AfHBwvzfKW8HRX3vo65rE17ZAnzb44ExYKmGzW6AncCiRZppv9fhttDVJu27hTV3hkLwsCaUvYxvCy8AFgyg1UYu1TSGt1UyveFp5ngD3KUDLEL9LuxVCqFNYuo3bUhhRqCJvb4imJ26u57XQvn8Cb9wPNe5WhoohhHcGzUzhNDKM9ta26FQMHbQHcQm1cfEPi4ZkEjWMyfx3iEtRKTEbEoUxKVhygTjy8uaQtWwLqiJUQwZYRayk74iUGvxWAnBELWBhED3iEvXUCpMyRreFeDYiui78h6Fbdmhu5vfQdhNbcPRnTZFLuyzXyztuTsK8z6gjda4YTengw7FMhJJeXZCCq4KJ3WZo2wLK5kxLQZeE36jmg5b2C4u9LRRVcxiLRt1yDvFhvrj1QFtYPTvkUKSBKGs8BAEcT", "4EQTxw3MSn9fDbvzUN4qmbe6zFBp6MGrtmoeoVWU54Vv9hVr3kBhVd23e9tdtMLXb39gT4jtFtFejjj7Y8KUBrig9obUvh6n3Xp1BdYMGesCDwA517r7zWr7h8QkZZvtM9KQyYdrnEccgDDjE621ggJn1x5GA4eY3JC5MswfvzGpt2CJegvo1dwyy9VzmwmLFhyaD8LXypN3Y37qxKwmtz9LbHdphbjuCqG45pdn1WjPitdpyZmxNbgfkQRu9iiEmrp4bDx4FL2D6uLDbcGmES3p5rnnJsAkFma3kTBXbUapgdpftRyWfxT5GWGYSmPgLDC6GupfgXtnwrxZFxFdVrExULVGQe47iMija8iUVe6rKnW3maudjZDc87G7eJkn5AB6Kbae48N4QwUJhL1ehjoK6NW4DK2HFWbYhf9jXddnGHMwmp3eUKjzXREbsxmtcd8NQAYi6faZacRJiSGJ4pEMcnRPmgUrzkthTmz5MaSEvPU2qV8iss8JoE4huPkXUe36Jc2epBnPDrSpcoD9RnMwtogh7Zt9ZbwqJvRCvRBubrXR4R3JA62j46coMci7t2PnZNieCysUXFajpgEoBffZecK7m1gH7kKhxAzMUHMLGWncnXsbFPv95dwPramLr688uErR5tTp1Lg8YzkpwrZ6JyEYxR7MtiagBbxaABe69Pfi622kQZPpxCEa8Xth1VhUZM5arjVCfG51ayVD1GVL5hj1uxwowyAHqYPq1vvSoopk9cdUhXc2hzL63FdCV2bpg8pjdo6gavk9iokjafJbVq2sCrMoUmhYDL8gcNhbfu95AU4jdn8wDopEW8dkEk8qcv2uqBWGFpDmaSm1aArMiK4MFasjC8v2XfaDBVUtQbmjb4cFTHKHen43quXcx4N1xZVCZZdpuDi9oEd9M29vWtCHckShumUztHB6yeXneik5YhhM7zzwQZavJk6jvEUg9oy67x1skzWaXJUnaybu1WEi1UtfrZHPS4t56EvTLee1rR4gLMtS8qeBrFBbpWEKEFNdKrz7FgR57NxPkwcJuaTnktURL4Tan4xMysAuwcpCMrV4ritxiKdbxaVUk71WKihQdRQkdue1tBNqzLDxn42fxN9EeDu6bLBCq1pB61cfUm7ECxKPtbQVQXPKBLPtBuwbEH11h62DtGCQ31rn8iwk8k58bthMSHjcbHjZpNkDi3dz7sJ7iknQFQnEhLLpNvqGhK3pYccyemJfFtX13UJGR4pfM7TYznSEQGjdo5q3ACenebnuP8Y5wXDAoK2zc3Nqy2EtijrtY2QopiNpXRuJR5dtJiCQHw7ku5b6NC5WBi9dfnaoy92qaxVzCZf4Gag3rCeBWRhN5R85eg1WLqEDwZDzxwU8Dwh5bMSp82qWME6Ew84ezcEuHe2cfsxyXTk1pJ3dhLaQp7M3ZAts7rLRhLxznVgDi5KA4c2goh4CDpbbhpRG9fofkqQAZ4jkBdF46BKKG2T4vvRb1Y97eJE9N9Py8PoQkVJjbbgAhit7mFzoiUxz4W54c1KQbgkPTXGr1unfH8rjdA2JpbAJesrb2szbgr1GKSnjt2NsdMF76Uy1MqaVevkY935M82xshpw724Trd63Ph1N4PSrCcZ2gUcYWLtZfpY84ZUvU7EpxnePT79VRrzcAztXwYmFX2jBGThhmhSFLaVDA2b1iNbtwioaegkg5banQNVgJ46AfVFcM9gpekWJTksjjWwHeP7fdU9XGgyCu4oKk9Eung3YtKuVNosvJ5abWXrgLwVFJKhrNgE4fsmpsRuLcTeKmA7YxY6KtaddDgyf1MahcWioduzLu2RF1jg8fkehspokpW5pFLfVUTkkZXd68vrbAMy8gBLAzhtuzAC7Lk5dJdBVkr53JEtbgcoQRPDP6RaJoqKLxnWjc3bNZud9LzLanMD26h1WbiPkKRWFxkrh8iSm8hZGhYKQAuFPKKi7cifXHio4ZBrNdLGu2uLGbhArhkLTa7GCRDJJrhKSbT5oigPq5QguqXtmuYY2JPakYAuCjVgBQjQiNYmkAeSdNnEgeysHPp3VbxhpWLu3Ty15JiVdbSxD6xDPy1XQ3DNv4XoaN8UcPRT1fSRNLsvGDmR5Y4E1sZbfPQBVebzYzjsqFBnwLg9m6Ei13YS2avfwC8hBuMe5cVKWbCFrWJAPmhkd6HEoFhuF2WRMJGbMPaTG4ixuz8SLTttqpGDzFYAmytjsHq1xaFYF3gG8V2Wxq5ckV6fgu7C7koCHaaQdAiFghqeFBS7nn75yUr961gDeVkvTnYWmuE55nBZepxocynSLkLiPP8cyfRDEYK1siydfJHuUgoCm9DNgA5A8scBF4T6ubkBrZ1jX6GoNQVfWfjJeAH66oeqBDRyFcy2BLUkpp6FqUhFVPoXc2caqbxhGg1fdfgFwsaqctwoBGXs8A8XXdodbJ8JzisfTA5w4cE2RvQsmagAicbq", "4EQTxw3MSn9fDbvzUN4qmbe6zFBp6MGrtmoeoVWU54Vv9hVr3kBhVd23e9tdtMLYutpx737TXvM2A9gBwAW3ByZTVCjyM3XHrNwER1RxU2By5gXMAtcTfuBTZuTyzBb4i3dqVcgeeJoKz6X8TcpYApx9u4qyzmYpzB3i2Aeor25SgpmKwcmpZWi9tVBXTLbQwKvaU7TtXoSWwD1QuX4SNX2koCjQWHYfoi4n6v4RwxzjqgxygQkUoxT2HmNtpkvBdybrc9t3t2DeKhsghwwcTve2NBeL2PeMauS6ayH5iCyX39waxUX4qMuceKz8MLWLdN4rrXVXpCreDsE4uU59eunFDHc6j2C3mPnoywhJAkbBMSqHBJR9pjfnLeGvFe56yGnGXHcrn9esBEFMnN9KA3gHWzAKw6U5oGDopaoPM7oHriMosUxUZzuugcHEqcUCfWnvZciuyqmXcNdRRuuprGWytTsaoECD7hXmhrc7F4ZEHA3kFnPZ5Q3rbtVpCV3yy2cjVG1FYc1woU3G5h3PMqoG1TMAQQPGzWa2YnyU5LmKvkp4M1YbEXn563AjpZeZy1DmdLUeKbbgzwG4Y4f8m3xTNVStzwZphT4YcNe3Nwa2D1Rvkw9jMAJ3qgrVCvpsQxGcwsDcATRqvCTyCN13E5A3UDx8uq9ro7R9eM5d28qrUS3AjaTLaHnthRn5VVyJPetekdPN3kwxxGuHoVL2HL1CXcFsBZNYFrimyXGHWFWoCZw5y2JQabKMGtT2iwHY3LaoDRrH68k64qQ4n3mkSQgndV8K7Gk7pHRAQ4vzhPATYdr4mtt9EYR7owJkzLAPYrq3xngsVrwjRP2SUwu8HhAgZsU9mJtq6f1gng597L4dshWrcYjyRofvZ3Xrf4YeFVHoPBfALpSwUQFLgVwFADUHdm1rKN2QzU5ddSzv4CkgW9bQUvHcxihJCRvtPezdbBoTiBrHFYQoSivjRDhZX4HWLe8Uz7W22ZgQ1iwQwEDxAKtN3WJKQ1fiynSLcafruHkmiszmqi3hf42itqvbtdHqQQuk3xxSQbWifxXvJyCNd9rv4ekQcDfCvdDswvf9T3cjCRsNn6QLCZMbgNU4TLwNv2qJFDyQDzNxzboBZ4uhVUUYFKcomYfkUep3mKN1Ay8Z4NeS2UZhPPMNfugCatNHMYzpo7wSciTUjeLFyiNQ7AyjWq9ZYkEKWWYvHEyne8ugoG43dxCCe5fLSXENh9aDoYvaK1NPkCr1m4i11A9K2Rpib26hspFwwPfPh7AvMeMn4KRhBXCMXpGXrVoeVKAYNDCwPxJz37Ampp2kB3b1EGK2A3TKjxG7qJJSb2pb5wKbCMeuQNYeX9qypQ6yHfat1yfszLZEdThRnCTMUnYX6wKF1T3TbAMgXHzUauXowjVegjo1MzrzDxQQaFSpuwrZ1o5tEryWYXj7Fi6d6juMU98RfZoxu1AxBqDAjVv6HBNJJzbx9sic9rCb7p9bnHGTqi2U7Hzj4zVFYyWFt8mPQqbSFyofekapEnKFBFvZhLS4q6s95f4rXKKPGPLxASc63hZfqScdFuuTMej5VM4DSYzyQEKXk2faZ4QcwdSE3cuTkHUQXH5wymK1LKiDd4Ysyvom2zaYmhAN7pCTWJC6iG8qVotNLGiN7JcwJy1n8oahjuQA6hFCRVQ2uNHghsjPZj1DtY9SLUgLtV4qzHpE64ufXD2J7F21TRKzYsS8LiwqaJD2ZPHfk5kQYrssWs7dnzzRqDNANk7UP91isuUTG7Yckp7XhRKiQLm3FgQMw54c1HSV7N8HrsLKYJBU7uGw4d48ys6R3T35h1tCAwUMfMynM5wKZFaZUp6dRgiwyUyGqnaQqCS953zsQkMtokXo8EQQKpPdjwx1UvNoWaLtBwZ4hoU5UzFN3USvSgiaUYg8xFXD4zDNhPTkvXMUBWWiFbqYhyVMYAhsXb29tYYuwGWZwYR77s4D4REe88LvvYe9k2ERkC5kZStTV3rVciiK437wUUBGUFmUB1ZAF6Cq4iNCxtUgxfqS8wRi4RXygBBUGAdDRhTeciGftohXuW5bmPQcnJ4QPThyuUgz6oxfYXocA1gcfbT28MFBU9idDm4vrDRbXfR1jrHT9TZtsiXERbfdzjnV4LdaEeMzeszmFnN5hzRhyz6yPFAThdVvnNbnMtb2cCWKbR7QjpSRYGRhkURYn4nE4qMLdXfZHuzFTUF61pFjphJV9ZDY5Ub1Ta6qiWqFAeBBR44HkWqBZvReQYRzZKLRgRm7j1GPzsX7m7wTyiTBerm4HwU9kx8daRcBybhXxpGiRbEjRmT7jstdGnhtWvxVYTRDfrmNFpL2WC1dBwMY9wEgoxstZK3JMNs7aQszAsTtuj8nhxKGpYPUL8WWBqfuz8oB2HtSH9794Kcm9NxEhSZebY898kYzd4NzYHqiyry2R8oeukJhEBDCqbuWD1FDuV", From cc1aad86d8a4ff119b0e00ce8d97cf27e2046dfd Mon Sep 17 00:00:00 2001 From: LastChance <104254800+lastchancedegen@users.noreply.github.com> Date: Mon, 4 Sep 2023 17:09:00 +0100 Subject: [PATCH 1094/1974] Add ComfySwap to Shibarium (#7370) * Add ComfySwap * minor fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/comfyswap/index.js | 3 +++ projects/helper/tokenMapping.js | 1 + 2 files changed, 4 insertions(+) create mode 100644 projects/comfyswap/index.js diff --git a/projects/comfyswap/index.js b/projects/comfyswap/index.js new file mode 100644 index 00000000000..dd3204c5daf --- /dev/null +++ b/projects/comfyswap/index.js @@ -0,0 +1,3 @@ +const { uniTvlExport } = require('../helper/unknownTokens') + +module.exports = uniTvlExport('shibarium', '0x09aBAdE821e55d7944965688eA6699a9830BAE45', { fetchBalances: true, }) \ No newline at end of file diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 0d8f6e07437..1203e3be454 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -64,6 +64,7 @@ const fixBalancesTokens = { }, shibarium: { '0x8ed7d143ef452316ab1123d28ab302dc3b80d3ce': { coingeckoId: "ethereum", decimals: 18 }, + '0xc76f4c819d820369fb2d7c1531ab3bb18e6fe8d8': { coingeckoId: "bone-shibaswap", decimals: 18 }, '0x213c25900f365f1be338df478cd82bef7fd43f85': { coingeckoId: "bone-shibaswap", decimals: 18 }, '0x6c19a35875217b134e963ca9e61b005b855cad21': { coingeckoId: "bone-shibaswap", decimals: 18 }, '0x1b2f364032f12bd8a4c89e672e6272de03ae2680': { coingeckoId: "bone-shibaswap", decimals: 18 }, From 8768084b914d65dad5a7542fccf3877a1cf9a59b Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 4 Sep 2023 19:57:23 +0200 Subject: [PATCH 1095/1974] temp break sienna --- projects/algodex.js | 35 ++++++++----------------------- projects/helper/chain/algorand.js | 18 ++++++++++++---- projects/sienna/index.js | 1 + projects/wavelength/index.js | 13 ------------ 4 files changed, 24 insertions(+), 43 deletions(-) diff --git a/projects/algodex.js b/projects/algodex.js index 659b9eec8b6..a065d3cc294 100644 --- a/projects/algodex.js +++ b/projects/algodex.js @@ -1,32 +1,15 @@ -const { fetchURL } = require('./helper/utils') -const { toUSDTBalances } = require('./helper/balances') -const usdPriceUrl = "https://mainnet.analytics.tinyman.org/api/v1/current-asset-prices/" -const assetTVLURL = "https://app.algodex.com/api/v2/orders/tvl" +const { searchAccountsAll } = require("./helper/chain/algorand") -async function fetch() { - const tvlData = await fetchURL(assetTVLURL) - const usdPriceData = await fetchURL(usdPriceUrl) +const algoOrderbookId = 354073718 +const asaOrderbookId = 354073834 - const total_liquidity_in_usd = tvlData.data.reduce((sum, asset) => { - var assetPrice = 0 - if (usdPriceData.data[asset.assetId]) { - assetPrice = usdPriceData.data[asset.assetId].price - } else { - // price for some asset is not found on tinyman then - // set its price to zero - assetPrice = 0 - } - - sum += assetPrice * asset.asaAmountTotal - return sum - }, 0) - return total_liquidity_in_usd -} -// tvl in USD module.exports = { + timetravel: false, algorand: { - fetch + tvl: async (_, _1, _2, { api }) => { + await searchAccountsAll({appId: algoOrderbookId, api, sumTokens: true, }) + await searchAccountsAll({appId: asaOrderbookId, api, sumTokens: true, }) + }, }, - fetch -} +}; diff --git a/projects/helper/chain/algorand.js b/projects/helper/chain/algorand.js index 949dd5a9aec..c777f777fb7 100644 --- a/projects/helper/chain/algorand.js +++ b/projects/helper/chain/algorand.js @@ -40,7 +40,7 @@ async function searchAccounts({ appId, limit = 1000, nexttoken, searchParams, }) } -async function searchAccountsAll({ appId, limit = 1000, searchParams = {} }) { +async function searchAccountsAll({ appId, limit = 1000, searchParams = {}, sumTokens = false, api }) { const accounts = [] let nexttoken do { @@ -48,6 +48,15 @@ async function searchAccountsAll({ appId, limit = 1000, searchParams = {} }) { nexttoken = res['next-token'] accounts.push(...res.accounts) } while (nexttoken) + if (sumTokens && api) { + sdk.log('sumTokens', accounts.length) + for (const account of accounts) { + api.add('1', account.amount) + for (const asset of (account.assets ?? [])) { + api.add(asset['asset-id']+'', asset.amount) + } + } + } return accounts } @@ -91,7 +100,7 @@ async function getAssetInfo(assetId) { } async function resolveTinymanLp({ balances, lpId, unknownAsset, blacklistedTokens, }) { - const lpBalance = balances['algorand:'+lpId] + const lpBalance = balances['algorand:' + lpId] if (lpBalance && lpBalance !== '0') { const lpInfo = await getAssetInfo(lpId) let ratio = lpBalance / lpInfo.circulatingSupply @@ -110,7 +119,7 @@ async function resolveTinymanLp({ balances, lpId, unknownAsset, blacklistedToken } } delete balances[lpId] - delete balances['algorand:'+lpId] + delete balances['algorand:' + lpId] return balances } @@ -159,6 +168,7 @@ async function getAppGlobalState(marketId) { response.application.params["global-state"].forEach(x => { let decodedKey = Buffer.from(x.key, "base64").toString("binary") results[decodedKey] = x.value.uint + if (x.value.type === 1) results[decodedKey] = Buffer.from(x.value.bytes, "base64").toString("binary") }) return results @@ -175,7 +185,7 @@ async function getPriceFromAlgoFiLP(lpAssetId, unknownAssetId) { if (geckoMapping.includes(id)) { return { price: i.amount / unknownAssetQuantity, - geckoId: 'algorand:'+id, + geckoId: 'algorand:' + id, decimals: 0, } } diff --git a/projects/sienna/index.js b/projects/sienna/index.js index d7460b6548f..72e347762e6 100644 --- a/projects/sienna/index.js +++ b/projects/sienna/index.js @@ -23,6 +23,7 @@ async function getPoolLiquidity() { } async function tvl() { + throw new Error('tvlresponse is wrong') const [ lend, overview ] = await Promise.all([getLendData(), getOverviewData()]) return { tether: lend.data.underlying_balance_usd + (await getPoolLiquidity()) diff --git a/projects/wavelength/index.js b/projects/wavelength/index.js index ea5c8b6f637..ddb4703cec5 100644 --- a/projects/wavelength/index.js +++ b/projects/wavelength/index.js @@ -1,21 +1,8 @@ const { onChainTvl } = require('../helper/balancer') -const { graphQuery } = require('../helper/http') - -const endpoint = 'https://teste.testeborabora.cyou/graphql' -const query = '{ embrGetProtocolData { totalLiquidity } }' -let _response - -async function fetch() { - if (!_response) _response = graphQuery(endpoint, query) - const response = await _response - return { tether: +response.embrGetProtocolData.totalLiquidity } -} - module.exports = { velas:{ tvl: onChainTvl('0xa4a48dfcae6490afe9c779bf0f324b48683e488c', 56062385, { onlyUseExistingCache: true, }) - // tvl: fetch, }, } \ No newline at end of file From 779f475eca74fa11051094386f166f4a2d87247f Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Mon, 4 Sep 2023 19:34:42 +0100 Subject: [PATCH 1096/1974] update owner --- projects/djed-alliance/index.js | 27 ++------------------------- 1 file changed, 2 insertions(+), 25 deletions(-) diff --git a/projects/djed-alliance/index.js b/projects/djed-alliance/index.js index 523cd3d1fb1..705e632a15c 100644 --- a/projects/djed-alliance/index.js +++ b/projects/djed-alliance/index.js @@ -1,37 +1,14 @@ const sdk = require('@defillama/sdk'); const utils = require('../helper/utils'); const { sumTokensExport } = require("../helper/chain/cardano"); -const { transformBalances } = require('../helper/portedTokens'); -const abi = require('./abi.json'); -const config = require("./config.json"); -async function tvl(chain, chainBlocks) { - const balances = {}; - const reserve = (await sdk.api.abi.call({ - abi: abi.Djed.reserve, chain: chain, target: config.djedAddress[chain], params: [ 0 ], block: chainBlocks[chain], - })).output; - - sdk.util.sumSingleBalance(balances, config.reserveTokenAddress[chain], reserve); // Using WADA address instead of mADA - return transformBalances(chain, balances); -} - -async function ergotvl() { - const {data: { confirmed }} = await utils.fetchURL('https://api.ergoplatform.com/api/v1/addresses/MUbV38YgqHy7XbsoXWF5z7EZm524Ybdwe5p9WDrbhruZRtehkRPT92imXer2eTkjwPDfboa1pR3zb3deVKVq3H7Xt98qcTqLuSBSbHb7izzo5jphEpcnqyKJ2xhmpNPVvmtbdJNdvdopPrHHDBbAGGeW7XYTQwEeoRfosXzcDtiGgw97b2aqjTsNFmZk7khBEQywjYfmoDc9nUCJMZ3vbSspnYo3LarLe55mh2Np8MNJqUN9APA6XkhZCrTTDRZb1B4krgFY1sVMswg2ceqguZRvC9pqt3tUUxmSnB24N6dowfVJKhLXwHPbrkHViBv1AKAJTmEaQW2DN1fRmD9ypXxZk8GXmYtxTtrj3BiunQ4qzUCu1eGzxSREjpkFSi2ATLSSDqUwxtRz639sHM6Lav4axoJNPCHbY8pvuBKUxgnGRex8LEGM8DeEJwaJCaoy8dBw9Lz49nq5mSsXLeoC4xpTUmp47Bh7GAZtwkaNreCu74m9rcZ8Di4w1cmdsiK1NWuDh9pJ2Bv7u3EfcurHFVqCkT3P86JUbKnXeNxCypfrWsFuYNKYqmjsix82g9vWcGMmAcu5nagxD4iET86iE2tMMfZZ5vqZNvntQswJyQqv2Wc6MTh4jQx1q2qJZCQe4QdEK63meTGbZNNKMctHQbp3gRkZYNrBtxQyVtNLR8xEY8zGp85GeQKbb37vqLXxRpGiigAdMe3XZA4hhYPmAAU5hpSMYaRAjtvvMT3bNiHRACGrfjvSsEG9G2zY5in2YWz5X9zXQLGTYRsQ4uNFkYoQRCBdjNxGv6R58Xq74zCgt19TxYZ87gPWxkXpWwTaHogG1eps8WXt8QzwJ9rVx6Vu9a5GjtcGsQxHovWmYixgBU8X9fPNJ9UQhYyAWbjtRSuVBtDAmoV1gCBEPwnYVP5GCGhCocbwoYhZkZjFZy6ws4uxVLid3FxuvhWvQrVEDYp7WRvGXbNdCbcSXnbeTrPMey1WPaXX/balance/total'); - return { ergo: confirmed.nanoErgs / 1e9 }; -} module.exports = { methodology: 'The TVL of each Djed deployment is the reserve belonging to the deployment. The TVL within a given blockchain is the sum of the TVLs of all known Djed deployments within that blockchain. The total TVL is the sum of the Djed TVLs on all blockchains.', - /*ergo:{ //has its own listing under sigmaUSD - tvl: ergotvl - },*/ + cardano: { - tvl: sumTokensExport({ owner: 'addr1z9s3v9vyyctzr4xagvrayw87yvzre6qcq7qw2uvqfznf92qm5kjdmrpmng059yellupyvwgay2v0lz6663swmds7hp0q2jjlf4', tokens: ['lovelace']}), + tvl: sumTokensExport({ owner: 'addr1zxem3j9xw7gyqnry0mfdhku7grrzu0707dc9fs68zwkln5sm5kjdmrpmng059yellupyvwgay2v0lz6663swmds7hp0qul0eqc', tokens: ['lovelace']}), }, - /*milkomeda: { - start: 10440400, - tvl: (timestamp, block, chainBlocks) => tvl('milkomeda', chainBlocks) - },*/ }; From 5d9a3f6a19af350033a35c92d7fa81dce0e42cc2 Mon Sep 17 00:00:00 2001 From: g1nt0ki Date: Mon, 4 Sep 2023 22:33:41 +0200 Subject: [PATCH 1097/1974] fix zookeeper --- projects/zookeeper.js | 51 +++++++++++++++++++++++++------------------ 1 file changed, 30 insertions(+), 21 deletions(-) diff --git a/projects/zookeeper.js b/projects/zookeeper.js index af0af6d82fb..9a654e896cc 100644 --- a/projects/zookeeper.js +++ b/projects/zookeeper.js @@ -1,34 +1,43 @@ -const utils = require('./helper/utils'); +const { staking } = require('./helper/staking') +const { sumUnknownTokens } = require('./helper/unknownTokens') -/* * * * * * * * -* ==> Correct adapter needs to be created. -* -*****************/ -async function wan() { - var totalTvl = await utils.fetchURL('https://rpc.zookeeper.finance/api/v1/tvl'); - return totalTvl.data; +const abi = { + "poolInfo": "function poolInfo(uint256) view returns (address lpToken, uint256 allocPoint, uint256 lastRewardTimestamp, uint256 accZooPerShare, bool emergencyMode)", + "poolLength": "uint256:poolLength", } -async function avax() { - const totalTvl = await utils.fetchURL('https://farming-api.vercel.app/api/avalanche/tvl') - return totalTvl.data; +async function tvl(_, _b, _cb, { api, }) { + const masterchef = '0x1aC6332f1f1892B49Fb26aD1934F74F4Cd8C9dB9' + await addMasterchef(masterchef, api) } -async function fetch() { - return (await wan())+(await avax()) + +async function wanTvl(_, _b, _cb, { api, }) { + const masterchef = '0x4E4Cb1b0b4953EA657EAF29198eD79C22d1a74A2' + await addMasterchef(masterchef, api) + return sumUnknownTokens({ api, useDefaultCoreAssets: true, resolveLP: true }) +} + +async function addMasterchef(masterchef, api) { + const infos = await api.fetchList({ lengthAbi: abi.poolLength, itemAbi: abi.poolInfo, target: masterchef }) + const tokens = infos.map(i => i.lpToken) + const bals = await api.multiCall({ abi: 'erc20:balanceOf', calls: tokens.map(i => ({ target: i, params: masterchef })) }) + api.addTokens(tokens, bals) } + module.exports = { - methodology: `Zookeeper's TVL is achieved by making a call to it's API: https://rpc.zookeeper.finance/api/v1/tvl (Wanchain) and https://farming-api.vercel.app/api/avalanche/tvl (AVAX).`, misrepresentedTokens: true, - doublecounted: false, + doublecounted: true, timetravel: false, - incentivized: true, - avax:{ - fetch: avax + avax: { + tvl: () => ({}), + pool2: tvl, + staking: staking(['0xcf066a3b365791432c9ecfec6eded67c72fd69c6', '0x64E785488e99e2faDE189CdA585BAFE86248ad80'], '0x1B88D7aD51626044Ec62eF9803EA264DA4442F32') }, - wan:{ - fetch: wan + wan: { + tvl: () => ({}), + pool2: wanTvl, + staking: staking(['0x23A9f34aa1e45f9E191A6615d24A781607a1bcb1', '0xBCE166860F514b6134AbC6E9Aa0005CC489b6352', '0x180793667513140e223Df73650D8615C61f93368'], '0x6e11655d6aB3781C6613db8CB1Bc3deE9a7e111F') }, - fetch, } From 4a3a64884310a72e442981930b5711edc09cefb4 Mon Sep 17 00:00:00 2001 From: g1nt0ki Date: Tue, 5 Sep 2023 09:47:53 +0200 Subject: [PATCH 1098/1974] stop using fetch --- projects/bt-finance.js | 23 ++++++++++++----------- projects/helper/utils.js | 2 +- projects/hyfi.js | 36 +++++++++++++++++++++++++++--------- 3 files changed, 40 insertions(+), 21 deletions(-) diff --git a/projects/bt-finance.js b/projects/bt-finance.js index accbd875ef7..9f14d98b6f5 100644 --- a/projects/bt-finance.js +++ b/projects/bt-finance.js @@ -1,17 +1,18 @@ -const utils = require('./helper/utils'); +const { sumTokensExport } = require('./helper/unwrapLPs') -/* * * * * * * * -* ==> Correct adapter needs to be created. -* -*****************/ -async function fetch() { - let staked = await utils.fetchURL('https://api.bt.finance/api/stats') - return staked.data.data.totalLockedValue; -} +async function tvl(_, _b, _cb, { api, }) { + return api.sumTokens({ + tokensAndOwners: [ + ['0xd662908ada2ea1916b3318327a97eb18ad588b5d', '0xa7971b65d86020366e4b9a28e4089bc5b12481af'], + ['0xd662908ADA2Ea1916B3318327A97eB18aD588b5d', '0xa7971b65d86020366e4b9a28e4089bc5b12481af'], + ] + }) +} module.exports = { ethereum: { - fetch, + tvl: () => ({}), + // staking: sumTokensExport({ owner: '0x5ae55a3249817B77cc88159dA912015c6a2c49Ed', tokens: ['0x76c5449F4950f6338A393F53CdA8b53B0cd3Ca3a']}) }, - fetch + // deadFrom: '2022-01-01' } diff --git a/projects/helper/utils.js b/projects/helper/utils.js index 2dc34fb1db5..60a9abfdac9 100644 --- a/projects/helper/utils.js +++ b/projects/helper/utils.js @@ -53,7 +53,7 @@ function isLP(symbol, token, chain) { // sdk.log(symbol, chain, token) if (!symbol) return false if (token && blacklisted_LPS.includes(token.toLowerCase()) || symbol.includes('HOP-LP-')) return false - if (chain === 'bsc' && ['OLP', 'DLP', 'MLP', 'LP', 'Stable-LP'].includes(symbol)) return false + if (chain === 'bsc' && ['OLP', 'DLP', 'MLP', 'LP', 'Stable-LP', 'fCake-LP', 'fMDEX LP'].includes(symbol)) return false if (chain === 'bsc' && ['WLP', 'FstLP', 'BLP', 'DsgLP'].includes(symbol)) return true if (chain === 'pulse' && ['PLP', 'PLT'].includes(symbol)) return true if (chain === 'avax' && ['ELP', 'EPT', 'CRL', 'YSL', 'BGL', 'PLP'].includes(symbol)) return true diff --git a/projects/hyfi.js b/projects/hyfi.js index 3a837198e56..71e35e2e36c 100644 --- a/projects/hyfi.js +++ b/projects/hyfi.js @@ -1,13 +1,31 @@ -const axios = require('axios'); - -async function fetch() { - var response = await axios.get('http://api.hyfi.pro/stat') - return response.data.vault_tvl; -} +const { sumUnknownTokens } = require('./helper/unknownTokens') module.exports = { bsc: { - fetch - }, - fetch + tvl + } } + +const poolInfoABI = "function poolInfo(uint256) view returns (address lpToken, uint256 allocPoint, uint256 lastRewardBlock, uint256 accSushiPerShare)" + +async function tvl(_, _b, _cb, { api, }) { + const masterchef = '0x4b7a63837c8cf56e4dcf5140c12388c24030d7df' + const infos = await api.fetchList({ lengthAbi: 'uint256:poolLength', itemAbi: poolInfoABI, target:masterchef }) + const tokens = infos.map(i => i.lpToken) + const bals = await api.multiCall({ abi: 'erc20:balanceOf', calls: tokens.map(i => ({ target: i, params: masterchef})) }) + const symbols = await api.multiCall({ abi: 'string:symbol', calls: tokens}) + const fTokens = [] + const fBals = [] + symbols.forEach((v, i) => { + if (v.startsWith('f')) { + fTokens.push(tokens[i]) + fBals.push(bals[i]) + } else { + api.add(tokens[i], bals[i]) + } + }) + const fuTokens = await api.multiCall({ abi: 'address:token', calls: fTokens}) + const fuBals = await api.multiCall({ abi: 'uint256:balance', calls: fTokens}) + api.addTokens(fuTokens, fuBals) + return sumUnknownTokens({ api, useDefaultCoreAssets: true, resolveLP: true, }) +} \ No newline at end of file From 60c918233f400cd9f0d2f58fbfc699ff397dc65c Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 5 Sep 2023 10:50:59 +0200 Subject: [PATCH 1099/1974] war on fetch continues --- projects/helper/utils.js | 1 + projects/pactfi.js | 3 + projects/sentre.js | 137 +++++++++++++++++++++++++++++++++--- projects/sleepearn/index.js | 27 +++---- projects/solanax.js | 13 ---- projects/symmetry/index.js | 4 +- projects/tangent/index.js | 4 -- projects/xdefi/index.js | 113 +++++------------------------ 8 files changed, 165 insertions(+), 137 deletions(-) diff --git a/projects/helper/utils.js b/projects/helper/utils.js index 60a9abfdac9..1275569bad8 100644 --- a/projects/helper/utils.js +++ b/projects/helper/utils.js @@ -70,6 +70,7 @@ function isLP(symbol, token, chain) { if (chain === 'dogechain' && ['DST-V2'].includes(symbol)) return true if (chain === 'harmony' && ['HLP'].includes(symbol)) return true if (chain === 'klaytn' && ['NLP'].includes(symbol)) return true + if (chain === 'kardia' && ['KLP', 'KDXLP'].includes(symbol)) return true if (chain === 'fantom' && ['HLP', 'WLP'].includes(symbol)) return true if (chain === 'era' && /(cSLP|sSLP|ZFLP)$/.test(symbol)) return true // for syncswap if (chain === 'songbird' && ['FLRX', 'OLP'].includes(symbol)) return true diff --git a/projects/pactfi.js b/projects/pactfi.js index 13b62f285a7..34bf1411fae 100644 --- a/projects/pactfi.js +++ b/projects/pactfi.js @@ -1,7 +1,10 @@ const { get } = require('./helper/http') +const { getConfig } = require('./helper/cache') + async function fetch() { + await getConfig('pact-fi', 'https://api.pact.fi/api/internal/pools_details/all') const global_data = await get("https://api.pact.fi/api/global_stats") return parseFloat(global_data.tvl_usd) } diff --git a/projects/sentre.js b/projects/sentre.js index 0abe621fbf2..1d1b1311f98 100644 --- a/projects/sentre.js +++ b/projects/sentre.js @@ -1,14 +1,133 @@ -const { get } = require('./helper/http') +const { getProvider, sumTokens2, } = require('./helper/solana') +const { Program, } = require("@project-serum/anchor"); -async function fetch() { - const response = ( - await get("https://stat.sentre.io/public/api/v1/tvl") - ) - const tvl = response.tvl; - return tvl; +async function tvl() { + const provider = getProvider() + const programId = 'D3BBjqUdCYuP18fNvvMbPAZ8DpcRi4io2EsYHQawJDag' + const program = new Program(idl, programId, provider) + const data = await program.account.pool.all() + return sumTokens2({ tokenAccounts: data.map(i => i.account.treasuries).flat() }) } module.exports = { timetravel: false, - fetch, -}; + solana: { tvl, }, +} + +const idl = { + "version": "0.1.0", + "name": "balancer_amm", + "instructions": [], + "accounts": [ + { + "name": "pool", + "type": { + "kind": "struct", + "fields": [ + { + "name": "authority", + "type": "publicKey" + }, + { + "name": "fee", + "type": "u64" + }, + { + "name": "taxFee", + "type": "u64" + }, + { + "name": "state", + "type": { + "defined": "PoolState" + } + }, + { + "name": "mintLpt", + "type": "publicKey" + }, + { + "name": "taxMan", + "type": "publicKey" + }, + { + "name": "mints", + "type": { + "vec": "publicKey" + } + }, + { + "name": "actions", + "type": { + "vec": { + "defined": "MintActionState" + } + } + }, + { + "name": "treasuries", + "type": { + "vec": "publicKey" + } + }, + { + "name": "reserves", + "type": { + "vec": "u64" + } + }, + { + "name": "weights", + "type": { + "vec": "u64" + } + } + ] + } + } + ], + "types": [ + { + "name": "PoolState", + "type": { + "kind": "enum", + "variants": [ + { + "name": "Uninitialized" + }, + { + "name": "Initialized" + }, + { + "name": "Frozen" + }, + { + "name": "Deleted" + } + ] + } + }, + { + "name": "MintActionState", + "type": { + "kind": "enum", + "variants": [ + { + "name": "Active" + }, + { + "name": "BidOnly" + }, + { + "name": "AskOnly" + }, + { + "name": "Paused" + } + ] + } + } + ], + "events": [], + "errors": [] +} diff --git a/projects/sleepearn/index.js b/projects/sleepearn/index.js index 64805ba3d92..15c7d011a76 100644 --- a/projects/sleepearn/index.js +++ b/projects/sleepearn/index.js @@ -1,17 +1,20 @@ -const utils = require('../helper/utils'); -async function fetch() { - const response = await utils.fetchURL('https://api.sleepearn.finance/tvl'); - let tvl = 0; - for (const vault in response.data[0]) { - tvl += response.data[0][vault]; - } - return tvl; +const { getConfig } = require('../helper/cache') +const { sumUnknownTokens } = require('../helper/unknownTokens') + +async function tvl(_, _b, _cb, { api, }) { + let data = await getConfig('sleepearn', 'https://raw.githubusercontent.com/sleepearn/pools/main/kardia_pools.js') + data = JSON.parse(data.slice(data.indexOf('[')).replaceAll('\'', '"').replaceAll(/\n\s+(\w+)/g, '"$1"').split('\n').map(i => i.replaceAll(/\s+\/\/.*/g, '').trim()).join('').replaceAll(';', '').replaceAll(/,(\]|\})/g, '$1')) + const pools = data.map(i => i.earnContractAddress).filter(i => i.toLowerCase() !== '0x4EdB55Ab9aF276786468214c401c48751Da91e2a'.toLowerCase()) + const tokens = await api.multiCall({ abi: 'address:want', calls: pools}) + const bals = await api.multiCall({ abi: 'uint256:balance', calls: pools}) + api.addTokens(tokens, bals) + return sumUnknownTokens({ api, useDefaultCoreAssets: true, resolveLP: true, }) } module.exports = { - kardia:{ - fetch + misrepresentedTokens: true, + kardia: { + tvl }, - fetch -}; \ No newline at end of file +}; diff --git a/projects/solanax.js b/projects/solanax.js index 01b82ec3b0b..75cf556fa25 100644 --- a/projects/solanax.js +++ b/projects/solanax.js @@ -1,15 +1,3 @@ -const { get } = require('./helper/http') -const { toUSDTBalances } = require('./helper/balances'); - -async function fetch() { - const response = ( - await get("https://solanax.org/api/data/") - ) - - const tvl = response.total_locked; - - return toUSDTBalances(tvl); -} module.exports = { misrepresentedTokens: true, @@ -17,7 +5,6 @@ module.exports = { solana: { tvl: () => ({}), } - }; module.exports.deadFrom = '2023-02-09' \ No newline at end of file diff --git a/projects/symmetry/index.js b/projects/symmetry/index.js index c438680a719..2fe73c9b23f 100644 --- a/projects/symmetry/index.js +++ b/projects/symmetry/index.js @@ -3,7 +3,7 @@ const { PublicKey } = require('@solana/web3.js') const FUNDS_VAULT = 'BLBYiq48WcLQ5SxiftyKmPtmsZPUBEnDEjqEnKGAR4zx' const TOKEN_PROGRAM_ID = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; -async function fetch() { +async function tvl() { const connection = getConnection(); const filters = [ { @@ -36,6 +36,6 @@ async function fetch() { module.exports = { timetravel: false, solana: { - tvl: fetch + tvl }, }; \ No newline at end of file diff --git a/projects/tangent/index.js b/projects/tangent/index.js index 0d5447be2ef..e70006917f7 100644 --- a/projects/tangent/index.js +++ b/projects/tangent/index.js @@ -1,7 +1,3 @@ -const { default: axios } = require('axios'); -async function fetch() { - return (await axios.get('https://api.tangent.bar/api/v1/MainStatistics')).data.allTVL -} module.exports = { methodology: "Data is retrieved from the api at https://api.tangent.bar/", diff --git a/projects/xdefi/index.js b/projects/xdefi/index.js index 37708c2ce2d..a12cc2f2b41 100644 --- a/projects/xdefi/index.js +++ b/projects/xdefi/index.js @@ -1,101 +1,20 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const BigNumber = require('bignumber.js') -const { GraphQLClient, gql, request } = require('graphql-request') - - -async function fetch() { - var xdexApi = 'https://api.thegraph.com/subgraphs/name/xdefilab/xdefidex'; - var xdexGraphQLClient = new GraphQLClient(xdexApi) - var xdexQuery = gql` - { - xdefis(first: 1) { - id, - version, - totalLiquidity, - totalSwapVolume - } - } - `; - const { xdefis } = await xdexGraphQLClient.request(xdexQuery) - const xdexTotalLiquidity = new BigNumber(xdefis[0].totalLiquidity); - - var xhalflifeApi = 'https://api.thegraph.com/subgraphs/name/xdefilab/xhalflife'; - var xhalflifeGraphQLClient = new GraphQLClient(xhalflifeApi) - var xhalflifeQuery = gql` - { - streamTotalDatas(first: 100, orderBy: locked, orderDirection:desc) { - id - token - { - id - symbol - decimals - } - count - locked - withdrawed - } - } - `; - const { streamTotalDatas } = await xhalflifeGraphQLClient.request(xhalflifeQuery) - - const tokenDataWithLocked = streamTotalDatas.reduce((all, current) => { - return { - ...all, - [current.id]: { - id: current.id, - locked: current.locked, - symbol: current.token.symbol - } - } - }, {}) - - const tokenPriceQuery = gql` - query getTokenPrices($ids: [String!]){ - tokenPrices(first:100,where:{ - id_in: $ids - }){ - id - symbol - price - } - } - ` - const ethAddress = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"; - const wethAddress = ADDRESSES.ethereum.WETH; - const usdt = ADDRESSES.ethereum.USDT - const dai = ADDRESSES.ethereum.DAI - const usdc = ADDRESSES.ethereum.USDC - - const { tokenPrices } = await request(xdexApi, tokenPriceQuery, { ids: Object.keys(tokenDataWithLocked).concat(wethAddress) }) - - Object.keys(tokenDataWithLocked).forEach(token => { - const findToken = tokenPrices.find(tokenPrice => tokenPrice.id == token); - if (findToken) { - tokenDataWithLocked[token].price = findToken.price - } else { - if (token === ethAddress) { - tokenDataWithLocked[token].price = tokenPrices.find(tokenPrice => tokenPrice.id == wethAddress).price; - } else { - if (token === usdt || token === dai || token === usdc) { - tokenDataWithLocked[token].price = 1 - } else { - tokenDataWithLocked[token].price = 0 - } - } - } - }) - - const tokenTotalValue = Object.keys(tokenDataWithLocked).reduce((all, current) => { - return all.plus(new BigNumber(tokenDataWithLocked[current].price).times(tokenDataWithLocked[current].locked)); - }, new BigNumber(0)) - - return tokenTotalValue.plus(xdexTotalLiquidity).toString(); +const { getLogs } = require('../helper/cache/getLogs') + +async function tvl(_, _b, _cb, { api, }) { + const logs = await getLogs({ + api, + target: '0x23c088198347edb873946fcff77e42401a1a93d2', + eventAbi: 'event LOG_NEW_POOL(address indexed caller, address indexed pool)', + onlyArgs: true, + fromBlock: 12028810, + }) + const pools = logs.map(l => l.pool) + const tokens = await api.multiCall({ abi: 'address[]:getFinalTokens', calls: pools}) + return api.sumTokens({ ownerTokens: pools.map((v, i) => [tokens[i], v])}) } module.exports = { - ethereum: { - fetch - }, - fetch + ethereum: { + tvl + }, } From 04306d45dc802d4c54134c4488c40358f58cdf3f Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 5 Sep 2023 11:01:17 +0200 Subject: [PATCH 1100/1974] lint fix --- projects/sienna/index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/projects/sienna/index.js b/projects/sienna/index.js index 72e347762e6..c596100cc1d 100644 --- a/projects/sienna/index.js +++ b/projects/sienna/index.js @@ -24,10 +24,10 @@ async function getPoolLiquidity() { async function tvl() { throw new Error('tvlresponse is wrong') - const [ lend, overview ] = await Promise.all([getLendData(), getOverviewData()]) - return { - tether: lend.data.underlying_balance_usd + (await getPoolLiquidity()) - } + // const [ lend, overview ] = await Promise.all([getLendData(), getOverviewData()]) + // return { + // tether: lend.data.underlying_balance_usd + (await getPoolLiquidity()) + // } } async function staking() { From f58ed19e3b1bebcb77fd3e87349a0eb49889fa93 Mon Sep 17 00:00:00 2001 From: TeslaBuffer <130090709+Tesla1010@users.noreply.github.com> Date: Tue, 5 Sep 2023 14:41:12 +0530 Subject: [PATCH 1101/1974] Buffer v2.5 update (#7375) --- projects/buffer/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/buffer/index.js b/projects/buffer/index.js index f95bfa69d43..5015e69e625 100644 --- a/projects/buffer/index.js +++ b/projects/buffer/index.js @@ -48,5 +48,6 @@ module.exports = { [Math.floor(new Date("2023-02-22") / 1e3), "Added a USDC Pool on polygon"], [Math.floor(new Date("2023-03-22") / 1e3), "Added ARB Pool"], [Math.floor(new Date("2023-04-14") / 1e3), "Added USDC Protocol owned liquidity Pool"], + [Math.floor(new Date("2023-09-01") / 1e3), "Debuted Version 2.5"], ] }; From f9468a4510fafa9fc0c2d59b099fcc5e9676b06a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vuka=C5=A1in=20Manojlovi=C4=87?= Date: Tue, 5 Sep 2023 11:11:42 +0200 Subject: [PATCH 1102/1974] Update Raft's TVL with PSM's CHAI balance (#7376) --- projects/raft/index.js | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/projects/raft/index.js b/projects/raft/index.js index 3f05728ff5d..68b30b2c140 100644 --- a/projects/raft/index.js +++ b/projects/raft/index.js @@ -1,23 +1,28 @@ -const { sumTokensExport } = require("../helper/unwrapLPs"); const ADDRESSES = require("../helper/coreAssets.json"); const RAFT_POSITION_MANAGER = "0x5f59b322eb3e16a0c78846195af1f588b77403fc"; +const RAFT_PSM = "0xa03342feb2e1d4690b60ef556509ec3b76c97ee7"; const WRAPPED_RETH = "0xb69e35fb4a157028b92f42655090b984609ae598"; +const CHAI = "0x06af07097c9eeb7fd685c692751d5c66db49c215"; -function transformAddress(token) { - if (token === WRAPPED_RETH) { - return ADDRESSES.ethereum.RETH; - } +async function tvl(_, ethBlock, _1, { api }) { + const wstEthBalance = await api.call({ target: ADDRESSES.ethereum.WSTETH, params: RAFT_POSITION_MANAGER, abi: "erc20:balanceOf", }); + const rEthBalance = await api.call({ target: WRAPPED_RETH, abi: "erc20:balanceOf", params: RAFT_POSITION_MANAGER, }); - return token; + const chaiBalance = await api.call({ target: CHAI, abi: "erc20:balanceOf", params: RAFT_PSM, }); + const potAddress = await api.call({ target: CHAI, abi: "address:pot", }); + const chaiRate = await api.call({ target: potAddress, abi: "uint256:chi", }); + const daiBalance = chaiBalance * chaiRate / 1e27; + + return { + [ADDRESSES.ethereum.WSTETH]: wstEthBalance, + [ADDRESSES.ethereum.RETH]: rEthBalance, + [ADDRESSES.ethereum.DAI]: daiBalance, + }; } module.exports = { ethereum: { - tvl: sumTokensExport({ - owner: RAFT_POSITION_MANAGER, - tokens: [ADDRESSES.ethereum.WSTETH, WRAPPED_RETH], - transformAddress: transformAddress, - }), + tvl, }, }; From dbde37d928a719693bdf0cf642dbbd20082b92de Mon Sep 17 00:00:00 2001 From: PolyLend <144064665+polylendxyz@users.noreply.github.com> Date: Tue, 5 Sep 2023 12:12:56 +0300 Subject: [PATCH 1103/1974] Added polylend market (#7374) --- projects/polylend/index.js | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 projects/polylend/index.js diff --git a/projects/polylend/index.js b/projects/polylend/index.js new file mode 100644 index 00000000000..6b9a24a7f4e --- /dev/null +++ b/projects/polylend/index.js @@ -0,0 +1,7 @@ +const { aaveExports } = require("../helper/aave"); + +module.exports = { + polygon_zkevm: aaveExports("polygon_zkevm", undefined, undefined, [ + "0x2C21bA5b8795A1efeC48b34d2FD7787d7547b494", + ]), +}; From c827b50cfe6c725386c65a5512d2675a8632cf13 Mon Sep 17 00:00:00 2001 From: basetasmfinance <143909577+basetasmfinance@users.noreply.github.com> Date: Tue, 5 Sep 2023 05:15:34 -0400 Subject: [PATCH 1104/1974] add basetasm (#7373) --- projects/basetasm/abi.json | 8 ++++++++ projects/basetasm/index.js | 42 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 projects/basetasm/abi.json create mode 100644 projects/basetasm/index.js diff --git a/projects/basetasm/abi.json b/projects/basetasm/abi.json new file mode 100644 index 00000000000..1593bc9ad1a --- /dev/null +++ b/projects/basetasm/abi.json @@ -0,0 +1,8 @@ +{ + "bank": { + "usableEthBalance": "uint256:usableCollateralBalance" + }, + "multiFeeDistribution": { + "totalSupply": "uint256:totalSupply" + } +} \ No newline at end of file diff --git a/projects/basetasm/index.js b/projects/basetasm/index.js new file mode 100644 index 00000000000..87d9b745c80 --- /dev/null +++ b/projects/basetasm/index.js @@ -0,0 +1,42 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const Abis = require("./abi.json"); +const { sumTokensExport, sumUnknownTokens, } = require('../helper/unknownTokens') + +const Contracts = { + base: { + weth: ADDRESSES.base.WETH, + xeth: "0x076944DD8Fb44DDd68231Ad41F82A603a9F7dcB8", + elz: "0x1fBCCF8AfE9e58052F64E2E6790a65D2eb3f4765", + bank: "0x4b9253B45F90b1a6766312cC0A3560c065496a35", + multiFeeDistribution: "0xB89c125b433b854390Fddb22E8a1bDA4281e2946", + chef: "0x373B887bfeE09F5fA721D5b1e8abfaFe067f41BC", + lps: [ + "0x07641fd10Bf3Efcd88C346967b4A0274ed75Dadf", // ELZ_ETH_LP + "0x3602F60FFDE7A18C6C93F813492888F05DF7de7A", // XETH_ETH_LP + "0xA9D108B5B56AF60d72cA14bBc34a068e42c77ccB", // ELZ_XETH_LP + ], + }, +}; + +async function calcBaseStakingTvl(timestamp, ethBlock, chainBlocks, { api }) { + const baseStakingData = await api.call({ target: Contracts.base.multiFeeDistribution, abi: Abis.multiFeeDistribution.totalSupply, }); + api.add(Contracts.base.elz, baseStakingData) + return sumUnknownTokens({ api, useDefaultCoreAssets: true, lps: Contracts.base.lps, }) +} + +module.exports = { + base: { + tvl: + sumTokensExport({ + owner: Contracts.base.bank, + tokens: [Contracts.base.weth] + }), + pool2: + sumTokensExport({ + owner: Contracts.base.chef, + tokens: Contracts.base.lps, + useDefaultCoreAssets: true, + }), + staking: calcBaseStakingTvl, + }, +}; \ No newline at end of file From 0c66ab84795ee5081dd7ea33e2294aa4aa0e9e57 Mon Sep 17 00:00:00 2001 From: Rodrigo Gaona <43006704+Gaonuk@users.noreply.github.com> Date: Tue, 5 Sep 2023 06:17:31 -0300 Subject: [PATCH 1105/1974] =?UTF-8?q?=E2=9C=A8=20Update=20Arch=20TVL=20Met?= =?UTF-8?q?hodology=20(#7372)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- projects/arch-ethereum-web-3/index.js | 29 +++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/projects/arch-ethereum-web-3/index.js b/projects/arch-ethereum-web-3/index.js index 11e62c31a78..fd7f8a88366 100644 --- a/projects/arch-ethereum-web-3/index.js +++ b/projects/arch-ethereum-web-3/index.js @@ -1,14 +1,27 @@ -const sdk = require("@defillama/sdk"); -const { sumTokens } = require('../helper/unwrapLPs'); +const { sumTokens2 } = require('../helper/unwrapLPs') -const archEthereumWeb3AddressETH = "0xe8e8486228753E01Dbc222dA262Aa706Bd67e601"; +const sets = [ + '0xe8e8486228753E01Dbc222dA262Aa706Bd67e601', + '0x0d20e86abab680c038ac8bbdc1446585e67f8951', +] -const abi = 'address[]:getComponents' +const chambers = [ + '0xE15A66b7B8e385CAa6F69FD0d55984B96D7263CF', + '0x103bb3EBc6F61b3DB2d6e01e54eF7D9899A2E16B', +] -async function tvl(ts, block) { - const { output: tokens } = await sdk.api.abi.call({ target: archEthereumWeb3AddressETH, abi, block }) - const toa = tokens.map(t => [t, archEthereumWeb3AddressETH]) - return sumTokens({}, toa, block) +const setAbi = 'address[]:getComponents' + +const chamberAbi = 'address[]:getConstituentsAddresses' + +async function tvl(timestamp, block, _, { api }) { + const setsTokens = await api.multiCall({ abi: setAbi, calls: sets }) + const chambersTokens = await api.multiCall({ abi: chamberAbi, calls: chambers }) + const toa = [] + setsTokens.forEach((o, i) => toa.push([o, sets[i]])) + chambersTokens.forEach((o, i) => toa.push([o, chambers[i]])) + const balances = await sumTokens2({ api, ownerTokens: toa, blacklistedTokens: [...sets, ...chambers] }) + return balances } From 5cfe3b55101802c673a251efe045430f487d4396 Mon Sep 17 00:00:00 2001 From: Sunnight-wj <51916821+Sunnight-wj@users.noreply.github.com> Date: Tue, 5 Sep 2023 17:33:47 +0800 Subject: [PATCH 1106/1974] Add lending pool tvl for SFT Protocol (#7276) * sft v2 upgrade to new api url * add lending pool tvl for sft protocol * update the abi used to caculate lending pool tvl * add lending pool available FIL to sft protocol tvl * remove redundant code --------- Co-authored-by: gpt-dev --- projects/sft-protocol/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/projects/sft-protocol/index.js b/projects/sft-protocol/index.js index aa3b06591d1..62fb5182fdc 100644 --- a/projects/sft-protocol/index.js +++ b/projects/sft-protocol/index.js @@ -7,6 +7,8 @@ const tokens = [ ADDRESSES.null, // FIL ] +const LENDING_POOL_ADDRESS = "0x147122D1EBdA76E4910ccdC53aEb6a58605Eb58E"; + const getActiveMinersFromRPC = async () => { const resp = await getConfig('sft-protocol', 'https://ww8.sftproject.io/api/c/api/v1/public/dashboard/info') let nodes = [] @@ -40,7 +42,7 @@ module.exports = { filecoin: { tvl: async (_, _1, _2, { api }) => { - let balances = {}; + let balances = await sumTokens2({ owner: LENDING_POOL_ADDRESS, tokens, api }); let minerAddrs = await getActiveMinersFromRPC(); await sumTokens2({ balances, owners: minerAddrs, tokens, api, }); From 27cd4a1e50101a65e514fd1eb1b620d3825c7633 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 5 Sep 2023 11:36:42 +0200 Subject: [PATCH 1107/1974] fix pangolin --- projects/pangolin/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/pangolin/index.js b/projects/pangolin/index.js index 1f1f2c8d0e8..bee01ff67d2 100644 --- a/projects/pangolin/index.js +++ b/projects/pangolin/index.js @@ -47,7 +47,7 @@ module.exports = { hedera: { tvl: async () => { const block = await getCurrentBlock() - const data = await graphQuery('https://hedera-graph.pangolin.network/subgraphs/name/pangolin', `{ + const data = await graphQuery('https://graph-hedera-main.pangolin.network/subgraphs/name/pangolin', `{ pangolinFactory(id: "1" block: { number: ${block - 1000} }) { totalLiquidityUSD } From 03e6c907bb5459ade8b4064f45dadb3e4164f6ce Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 5 Sep 2023 18:51:52 +0200 Subject: [PATCH 1108/1974] war on fetch continues --- projects/alchemix/index.js | 9 +- projects/helper/utils.js | 1 + projects/pawnfi/index.js | 8 +- projects/scientixfinance/index.js | 283 +++--------------------------- projects/tokensfarm/index.js | 68 ++++--- projects/yieldhubfinance/index.js | 43 ++++- 6 files changed, 113 insertions(+), 299 deletions(-) diff --git a/projects/alchemix/index.js b/projects/alchemix/index.js index 7b4c35d9f71..f9dcbfd7102 100644 --- a/projects/alchemix/index.js +++ b/projects/alchemix/index.js @@ -4,16 +4,17 @@ const contracts = require("./contracts"); function tvl(chain) { return async (timestamp, block, chainBlocks, { api }) => { - const tokens = Object.values(contracts[chain].underlyingTokens).concat(Object.values(contracts[chain].yvTokens)) - await sumTokens2({ tokens, api, owners: Object.values(contracts[chain].tokenHolders) }) - if (api.chain !== 'ethereum') return + // const tokens = Object.values(contracts[chain].underlyingTokens).concat(Object.values(contracts[chain].yvTokens)) + // await sumTokens2({ tokens, api, owners: Object.values(contracts[chain].tokenHolders) }) + if (api.chain !== 'ethereum') return api.getBalances() await Promise.all( Object.values(contracts.cvxLPpools).map(async ({ poolAddress, holder, tokenAddress, alToken }) => { const lpTokenBalance = await api.call({ target: poolAddress, abi: "erc20:balanceOf", params: holder, }) const supply = await api.call({ target: tokenAddress, abi: "erc20:totalSupply", }) + // console.log({poolAddress, holder, tokenAddress, alToken, lpTokenBalance, supply, ratio: lpTokenBalance / supply}) + if (+supply === 0) return; const ratio = lpTokenBalance / supply - if (+ratio === 0) return; const tokenBalances = await api.multiCall({ target: tokenAddress, abi: 'function balances(uint256) view returns (uint256)', calls: [0, 1] }) const tokens = await api.multiCall({ target: tokenAddress, abi: 'function coins(uint256) view returns (address)', calls: [0, 1] }) alToken = alToken.toLowerCase() diff --git a/projects/helper/utils.js b/projects/helper/utils.js index 1275569bad8..35d4382d495 100644 --- a/projects/helper/utils.js +++ b/projects/helper/utils.js @@ -65,6 +65,7 @@ function isLP(symbol, token, chain) { if (chain === 'oasis' && ['LPT'].includes(symbol)) return true if (chain === 'base' && ['RCKT-V2'].includes(symbol)) return true if (chain === 'wan' && ['WSLP'].includes(symbol)) return true + if (chain === 'telos' && ['zLP'].includes(symbol)) return true if (chain === 'polygon' && ['MbtLP', 'GLP', ].includes(symbol)) return true if (chain === 'ethereum' && ['SUDO-LP'].includes(symbol)) return false if (chain === 'dogechain' && ['DST-V2'].includes(symbol)) return true diff --git a/projects/pawnfi/index.js b/projects/pawnfi/index.js index df9e6df9f55..c80ba6aab8d 100644 --- a/projects/pawnfi/index.js +++ b/projects/pawnfi/index.js @@ -1,12 +1,8 @@ const { get } = require('../helper/http.js') -async function fetch(arg) { - const data = await get('https://api-app.pawnfi.com/api/stat/queryplatstatinfo.do') - return data.info.f_total_tvl; -} - +// INFO: dont delete abi from here is used in other modules module.exports = { timetravel: false, methodology: "The Pawnfi API endpoint fetches on-chain data from Pawnfi NFT contracts, token balance for each lending liquidity pools, and any value generated within Pawnfi platform.", - fetch: fetch, + // fetch: fetch, }; \ No newline at end of file diff --git a/projects/scientixfinance/index.js b/projects/scientixfinance/index.js index 79d32727ba6..d00784655d9 100644 --- a/projects/scientixfinance/index.js +++ b/projects/scientixfinance/index.js @@ -1,14 +1,5 @@ -const ADDRESSES = require('../helper/coreAssets.json') -/*================================================== - Modules -==================================================*/ -const axios = require("axios"); -const BigNumber = require('bignumber.js'); -const sdk = require("@defillama/sdk") - -/*================================================== - Address -==================================================*/ +const { sumUnknownTokens } = require('../helper/unknownTokens') +const { staking } = require('../helper/staking') const Scientist = '0xEbB15456C0833033f0310f61748CD597554460Da'; const Transmute = '0x2dfE725eca8FFe13fe4E4a8E015cF857b3b72bcF'; @@ -17,254 +8,38 @@ const Farm = '0x68145F3319F819b8E01Dfa3c094fa8205E9EfB9a'; const VotingEscrow = '0xF92aBA2A79dC133278DE2CDDB38Db775A4b5B024'; // Token -const BUSD = ADDRESSES.bsc.BUSD; const ibALPACA = "0xf1be8ecc990cbcb90e166b71e368299f0116d421"; const scUSD = "0x0E5C2b15666EEE4b66788E45CF4Da0392C070fa7"; const SCIX = "0x2CFC48CdFea0678137854F010b5390c5144C0Aa5"; const ScixBusd = "0xe8Efb51E051B08614DF535EE192B0672627BDbF9"; const scUsdBusd = "0x53085B02955CFD2F884c58D19B8a35ef5095E8aE"; -const ibALPACAPoolId = 3; -const ScixBusdPoolId = 5; -const scUsdBusdPoolId = 6; - -/*================================================== - TVL -==================================================*/ - -async function getTokenBalance(token, account) { - const { output } = await sdk.api.abi.call({ - chain: 'bsc', - target: token, - params: [account], - abi: 'function balanceOf(address account) view returns (uint256)' - }) - return output -} - -async function getTokenTotalSupply(token) { - const { output } = await sdk.api.abi.call({ - chain: 'bsc', - target: token, - abi: "uint256:totalSupply" - }) - return output -} - -// vault -async function totalDepositBUSD(vault) { - const { output } = await sdk.api.abi.call({ - chain: 'bsc', - target: vault, - abi: "uint256:totalDeposited" - }) - return output -} - -// transmute -async function getTotalStakedScTokens(transmute) { - const { output } = await sdk.api.abi.call({ - chain: 'bsc', - target: transmute, - abi: "uint256:totalSupplyScTokens" - }) - return output -} - -async function getAdapterTotalValue(transmuteAdapter) { - const { output } = await sdk.api.abi.call({ - chain: 'bsc', - target: transmuteAdapter, - abi: "uint256:totalValue" - }) - return output -} - -// farm -async function getPoolTotalDeposited(contract, poolID) { - const { output } = await sdk.api.abi.call({ - chain: 'bsc', - params: [poolID], - target: contract, - abi: 'function getPoolTotalDeposited(uint256 _poolId) view returns (uint256)' - }) - return output -} - -async function getBUSDLpPrice(lpTokenAddress, BUSDAddress, scUSDAddress) { - try { - let [BUSDBalance, scUSDBalance, totalSupply] = await Promise.all([ - getTokenBalance(BUSDAddress, lpTokenAddress), - getTokenBalance(scUSDAddress, lpTokenAddress), - getTokenTotalSupply(lpTokenAddress) - ] - ); - return new BigNumber(BUSDBalance).plus(new BigNumber(scUSDBalance)) - .div(new BigNumber(totalSupply)); - } catch (e) { - sdk.log(e); - } - return 0; -} - -async function getAalpacaTotal(vault) { - const { output } = await sdk.api.abi.call({ - chain: 'bsc', - target: vault, - abi: "uint256:totalToken" - }) - return output -} - -async function getAalpacaTotalSupply(vault) { - const { output } = await sdk.api.abi.call({ - chain: 'bsc', - target: vault, - abi: "uint256:totalSupply" - }) - return output -} - -async function getAlpacePrice() { - const tokenId = 'alpaca-finance'; - // https://api.coingecko.com/api/v3/simple/price?ids=alpaca-finance&vs_currencies=usd - let result; - let price = 0; - try { - result = - await axios({ - method: "GET", - url: "https://api.coingecko.com/api/v3/simple/price", - params: { - ids: tokenId, - vs_currencies: "usd", - }, - }); - } catch (e) { - return price; - } - const data = result.data; - price = data[tokenId].usd; - return price; -} - -async function getIbAlpacaPrice(vault) { - try { - let [price, totalToken, totalSupply] = await Promise.all([ - getAlpacePrice(), - getAalpacaTotal(vault), - getAalpacaTotalSupply(vault) - ] - ); - return new BigNumber(price).times(new BigNumber(totalToken)) - .div(new BigNumber(totalSupply)); - } catch (e) { - return new BigNumber(await getAlpacePrice()); - } -} - -async function getSCIXTotalLocked(ve) { - const { output } = await sdk.api.abi.call({ - chain: 'bsc', - target: ve, - abi: "uint256:_totalLockedSCIX" - }) - return output -} - -async function getFarmBalance() { - let [ - ScixPoolBalance, scUSDPoolBalance, ibALPACAPoolBalance, - BUSDBalance, SCIXBalance, BusdScixLpSupply, - scUSDLPPrice, ibAlpacaPrice, - veScixBalance - ] = await Promise.all([ - // farm - getPoolTotalDeposited(Farm, ScixBusdPoolId), - getPoolTotalDeposited(Farm, scUsdBusdPoolId), - getPoolTotalDeposited(Farm, ibALPACAPoolId), - // farm price - getTokenBalance(BUSD, ScixBusd), - getTokenBalance(SCIX, ScixBusd), - getTokenTotalSupply(ScixBusd), - // farm price 2 - getBUSDLpPrice(scUsdBusd, BUSD, scUSD), - getIbAlpacaPrice(ibALPACA), - // veScix - getSCIXTotalLocked(VotingEscrow), - ] - ); - // price - const BusdScixLPPrice = new BigNumber(BUSDBalance).times(2).div(new BigNumber(BusdScixLpSupply)); - const scixPrice = new BigNumber(BUSDBalance).dividedBy(new BigNumber(SCIXBalance)); - - let balance = new BigNumber(0); - // farm BUSD/SICX - const BusdScix = new BigNumber(ScixPoolBalance).times(BusdScixLPPrice); - if (!BusdScix.isNaN()) { - balance = balance.plus(BusdScix); - } - // farm BUSD/scUSD - const BusdScUsd = new BigNumber(scUSDPoolBalance).times(scUSDLPPrice); - if (!BusdScUsd.isNaN()) { - balance = balance.plus(BusdScUsd); - } - // farm ibALPACA - const ibAlpacaValue = new BigNumber(ibALPACAPoolBalance).times(ibAlpacaPrice); - if (!ibAlpacaValue.isNaN()) { - balance = balance.plus(ibAlpacaValue); - } - // veScix - const veScixValue = new BigNumber(veScixBalance).times(scixPrice); - if (!veScixValue.isNaN()) { - balance = balance.plus(veScixValue); - } - - return balance; -} - -function getGWeiFromWei(wei, decimals = 18) { - return BigNumber(wei) - .dividedBy(BigNumber(10).pow(decimals)) - .toFixed(2); -} - -// total tvl -async function fetch() { - let balance = {} - let [ - vaultDepositBUSD, - stakedScUsd, transmuteBUSD, transmuteAdapterBUSD, - farmBalance - ] = await Promise.all([ - // vault - totalDepositBUSD(Scientist), - // transmute - getTotalStakedScTokens(Transmute), - getTokenBalance(BUSD, Transmute), - getAdapterTotalValue(TransmuteAdapter), - // farm - getFarmBalance() - ] - ); - - let tvl = new BigNumber(0); - // vault - tvl = tvl.plus(new BigNumber(vaultDepositBUSD)); - // transmute - tvl = tvl.plus(new BigNumber(stakedScUsd)).plus(new BigNumber(transmuteBUSD)).plus(new BigNumber(transmuteAdapterBUSD)); - // farm - tvl = tvl.plus(farmBalance); - - tvl = getGWeiFromWei(tvl); - return balance = parseFloat(tvl); -} - -/*================================================== - Exports - ==================================================*/ - module.exports = { - start: 10880500, // 09/16/2020 @ 12:00am (UTC+8) - fetch, + start: 10880500, // 09/16/2020 @ 12:00am (UTC+8) + bsc: { + tvl, + staking: staking(VotingEscrow, SCIX), + pool2, + }, }; + +async function tvl(_, _b, _cb, { api, }) { + const totalDeposited = await api.call({ abi: 'uint256:totalDeposited', target: Scientist}) + const token = await api.call({ abi: 'address:token', target: Scientist}) + const scSupply = await api.call({ abi: 'address:totalSupplyScTokens', target: Transmute}) + const transmuteValue = await api.call({ abi: 'address:totalValue', target: TransmuteAdapter}) + api.add(token, totalDeposited) + api.add(token, scSupply) + api.add(token, transmuteValue) + await api.sumTokens({ owner: Transmute, token}) +} + +async function pool2(_, _b, _cb, { api, }) { + const ibALPACABalance = await api.call({ abi: 'erc20:balanceOf', target: ibALPACA, params: [Farm]}) + const ibALPACASupply = await api.call({ abi: 'uint256:totalSupply', target: ibALPACA}) + const alpacaBal = await api.call({ abi: 'uint256:totalToken', target: ibALPACA}) + const alpacaToken = await api.call({ abi: 'address:token', target: ibALPACA}) + api.add(alpacaToken, alpacaBal * ibALPACABalance / ibALPACASupply) + + return sumUnknownTokens({ api, useDefaultCoreAssets: true, resolveLP: true, owner: Farm, tokens: ['0xe8Efb51E051B08614DF535EE192B0672627BDbF9', '0x53085B02955CFD2F884c58D19B8a35ef5095E8aE', ScixBusd,scUsdBusd ] }) +} \ No newline at end of file diff --git a/projects/tokensfarm/index.js b/projects/tokensfarm/index.js index 571d94fd02b..affae6e2b0e 100644 --- a/projects/tokensfarm/index.js +++ b/projects/tokensfarm/index.js @@ -1,29 +1,43 @@ -const { get } = require('../helper/http') -const { toUSDTBalances } = require('../helper/balances'); +const { getConfig } = require('../helper/cache') +const { sumUnknownTokens, nullAddress } = require('../helper/unknownTokens') -function fetch(chain) { - return async () => { - let response = await get('https://api.tokensfarm.com/totals') - return toUSDTBalances(response.totals.tvl[chain]); - }; -} +const chains = ['ethereum', 'polygon', 'bsc', 'fantom', 'optimism', 'arbitrum', 'avax'] -module.exports = { - timetravel: false, - misrepresentedTokens: true, - avax: { - tvl: fetch('avalanche') - }, - bsc: { - tvl: fetch('binance') - }, - ethereum: { - tvl: fetch('ethereum') - }, - fantom: { - tvl: fetch('fantom') - }, - polygon: { - tvl: fetch('polygon') - }, -}; \ No newline at end of file +chains.forEach(chain => { + module.exports[chain] = { + tvl: () => ({}), + pool2, + staking, + } + + async function pool2(_, _b, _cb, { api, }) { + const chainId = api.chainId + let { farms } = await getConfig('tokensfarm', 'https://api.tokensfarm.com/farm/list') + farms = farms.filter(i => i.type === 'LP' && i.network.networkId === chainId) + const tokensAndOwners = [] + + farms.forEach(farm => { + const token = farm.singleAssets.find(i => new RegExp(farm.stakingTokenSymbol).test(i.symbol) || i.symbol.includes('-LP') || i.symbol.includes('UNI-V2'))?.address + if (!token) { + return + } + tokensAndOwners.push([token, farm.farmProxyAddress]) + }) + return sumUnknownTokens({ api, tokensAndOwners, resolveLP: true, useDefaultCoreAssets: true }) + } + + async function staking(_, _b, _cb, { api, }) { + const chainId = api.chainId + let { farms } = await getConfig('tokensfarm', 'https://api.tokensfarm.com/farm/list') + farms = farms.filter(i => i.type !== 'LP' && i.network.networkId === chainId) + const tokensAndOwners = [] + + farms.forEach(farm => { + farm.singleAssets.forEach(i => { + let token = i.address === '0x0' ? nullAddress : i.address + tokensAndOwners.push([token, farm.farmProxyAddress]) + }) + }) + return sumUnknownTokens({ api, tokensAndOwners, resolveLP: true, useDefaultCoreAssets: true }) + } +}) diff --git a/projects/yieldhubfinance/index.js b/projects/yieldhubfinance/index.js index 6b4d49d713f..4ec3b6d9599 100644 --- a/projects/yieldhubfinance/index.js +++ b/projects/yieldhubfinance/index.js @@ -1,15 +1,42 @@ -const { get } = require('../helper/http') -const { toUSDTBalances } = require('../helper/balances'); +const { sumUnknownTokens } = require('../helper/unknownTokens'); -async function fetch() { - const response = await get('https://api.yieldhub.finance/tvl'); - let tvl = Object.values(response).map(i => Object.values(i)).flat().reduce((acc, i) => acc + i, 0) - return toUSDTBalances(tvl); -} +const vaults = [ + "0x49AC06648789d235BFc7D2108cD09594A51f584A", + "0xDEAa7fC91e3d81C2C382Db559C29F3eb742B7B74", + "0xC76eF284E616567d92802261d4193328f598C2d1", + "0xd5397b85f4677E973b992680deA429fE102CA43D", + "0xE95EB1DFcFe6E92763598A0270cE7BdadD7542C4", + "0x27519464F504ec385F7318849a6AB544111167b9", + "0x73a9a6F798f8664bA0F5AC2F5dD89e303fEcAa9b", + "0x54C8e46012F9D1DEa678a945b7a70e254e48455B", + "0x54A91965a9231e870cC0a601169d8b29b581440c", + "0x2EE0a0731399f0d4Af3FdDBEE303e86b84cB23f7", + "0x6d83a06194Ca237C9A157655492Cb3e6daa857c1", + "0x5e1a727377c4F4C24b4a5BaC331D26cF3C90CBc2", + "0x10DA15D3A4169E64b9EA51C5Ad174c03bd0625D6", + "0x10E9fbC3b3aFFf0C330dc19778474cA7Fe17B6e3", + "0x15cD93a074740Ee4c14a102C9e2A9D2D3F760D4F", + "0x856Ab6A84fdD0C35cDc6B3710DEC83203B470637", + "0x84027D689DaB82D0548FE1DA273fd68187a7C578", + "0xc8A34969306a26907B12fD44A51DCb10EB19D47E", + "0x161DDe5cB80564434a686311FD43e01b1B1ee5E5", + "0xa2Fc4Ba0D10438D8B63B369D00a3bAb29c319eEC", + "0x8C6b71B9967AfE4B633759f0714C593C2ac38e85", + "0x9a4743E8476B2e7bF5f6d314215523c8ca8f24C5", + "0x1226f2eBC27374aE0d66f3E91ED64c918BccEF9e", + "0x8bF553291D2810C772ea43bBA77eDFf92191b450" +] +async function tvl(_, _b, _cb, { api, }) { + const tokens = await api.multiCall({ abi: 'address:want', calls: vaults}) + const bals = await api.multiCall({ abi: 'uint256:balance', calls: vaults}) + api.addTokens(tokens, bals) + return sumUnknownTokens({ api, useDefaultCoreAssets: true, resolveLP: true, }) + +} module.exports = { timetravel: false, telos: { - tvl: fetch + tvl }, } From 15a7a779ab0cdefb3ecdd2ad40362113bee7e729 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 5 Sep 2023 18:59:19 +0200 Subject: [PATCH 1109/1974] Aeria (#7380) * Add Aeria * code refactor --------- Co-authored-by: Denis Medvedev --- projects/aeria/index.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 projects/aeria/index.js diff --git a/projects/aeria/index.js b/projects/aeria/index.js new file mode 100644 index 00000000000..7766d63b7ac --- /dev/null +++ b/projects/aeria/index.js @@ -0,0 +1,16 @@ +const { nullAddress } = require("../helper/tokenMapping"); + +const FACTORY = "0x649b80892ef773bd64cc3c663950dea3a604f660"; + +async function tvl(_, _1, _2, { api }) { + let vaults = await api.fetchList({ lengthAbi: 'uint256:vaultCount', itemAbi: 'function vaults(uint256) view returns (address)', target: FACTORY }) + vaults = vaults.filter(i => i !== nullAddress) + const tokens = await api.multiCall({ abi: 'address:depositToken', calls: vaults }) + return api.sumTokens({ tokensAndOwners2: [tokens, vaults] }) +} + +module.exports = { + base: { + tvl, + }, +} From e7c30a6c3241bb0a38444f773bc12e4a317a3be1 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 5 Sep 2023 19:02:30 +0200 Subject: [PATCH 1110/1974] minor fix --- projects/aeria/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/aeria/index.js b/projects/aeria/index.js index 7766d63b7ac..cae310a2dd2 100644 --- a/projects/aeria/index.js +++ b/projects/aeria/index.js @@ -3,7 +3,7 @@ const { nullAddress } = require("../helper/tokenMapping"); const FACTORY = "0x649b80892ef773bd64cc3c663950dea3a604f660"; async function tvl(_, _1, _2, { api }) { - let vaults = await api.fetchList({ lengthAbi: 'uint256:vaultCount', itemAbi: 'function vaults(uint256) view returns (address)', target: FACTORY }) + let vaults = await api.fetchList({ lengthAbi: 'uint256:vaultCount', itemAbi: 'function vaults(uint256) view returns (address)', target: FACTORY, startFromOne: true, }) vaults = vaults.filter(i => i !== nullAddress) const tokens = await api.multiCall({ abi: 'address:depositToken', calls: vaults }) return api.sumTokens({ tokensAndOwners2: [tokens, vaults] }) From a07ed8ce4f5a84572a87e06f27151817b4f8094f Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 5 Sep 2023 19:07:57 +0200 Subject: [PATCH 1111/1974] fix alchemix --- projects/alchemix/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/alchemix/index.js b/projects/alchemix/index.js index f9dcbfd7102..f2d1cc54418 100644 --- a/projects/alchemix/index.js +++ b/projects/alchemix/index.js @@ -4,8 +4,8 @@ const contracts = require("./contracts"); function tvl(chain) { return async (timestamp, block, chainBlocks, { api }) => { - // const tokens = Object.values(contracts[chain].underlyingTokens).concat(Object.values(contracts[chain].yvTokens)) - // await sumTokens2({ tokens, api, owners: Object.values(contracts[chain].tokenHolders) }) + const tokens = Object.values(contracts[chain].underlyingTokens).concat(Object.values(contracts[chain].yvTokens)) + await sumTokens2({ tokens, api, owners: Object.values(contracts[chain].tokenHolders) }) if (api.chain !== 'ethereum') return api.getBalances() await Promise.all( From 77ff4f847341adbf8d9737815ee5c09b780f7066 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 5 Sep 2023 21:19:57 +0200 Subject: [PATCH 1112/1974] fix alchemix --- projects/alchemix/contracts.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/alchemix/contracts.json b/projects/alchemix/contracts.json index 2ae2252739f..320372f36ee 100644 --- a/projects/alchemix/contracts.json +++ b/projects/alchemix/contracts.json @@ -71,9 +71,9 @@ } }, "cvxLPpools": { - "alUSD​+FRAXBP": { + "alUSD+FRAXBP": { "poolAddress": "0x26598e3E511ADFadefD70ab2C3475Ff741741104", - "holder": "0x06378717d86b8cd2dba58c87383da1eda92d3495", + "holder": "0xBE1C919cA137299715e9c929BC7126Af14f76091", "tokenAddress": "0xb30da2376f63de30b42dc055c93fa474f31330a5", "alToken": "0xBC6DA0FE9aD5f3b0d58160288917AA56653660E9" }, From 61b43ccd464e7759f0c0236264639aba5ee36c30 Mon Sep 17 00:00:00 2001 From: CryptoSnowPrince <88888344+CryptoSnowPrince@users.noreply.github.com> Date: Wed, 6 Sep 2023 04:52:14 +0900 Subject: [PATCH 1113/1974] add stealthpad (#7381) * add merlin methodology * update methodology * add stealthpad * code refactor --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/stealthpad/abi.js | 39 ++++++++++++++++++++++++++++++++++++ projects/stealthpad/index.js | 23 +++++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 projects/stealthpad/abi.js create mode 100644 projects/stealthpad/index.js diff --git a/projects/stealthpad/abi.js b/projects/stealthpad/abi.js new file mode 100644 index 00000000000..348549745ac --- /dev/null +++ b/projects/stealthpad/abi.js @@ -0,0 +1,39 @@ + +const lpLockerCount = 'function lpLockerCount() view returns (uint40)' +const tokenLockerCount = 'function tokenLockerCount() view returns (uint40)' + +const getLpLockData = `function getLpLockData(uint40 id_) view returns +( + bool isLpToken, + uint40 id, + address contractAddress, + address lockOwner, + address token, + address createdBy, + uint40 createdAt, + uint40 blockTime, + uint40 unlockTime, + uint256 balance, + uint256 totalSupply +)` +const getTokenLockData = `function getTokenLockData(uint40 id_) view returns +( + bool isLpToken, + uint40 id, + address contractAddress, + address lockOwner, + address token, + address createdBy, + uint40 createdAt, + uint40 blockTime, + uint40 unlockTime, + uint256 balance, + uint256 totalSupply +)` + +module.exports = { + lpLockerCount, + tokenLockerCount, + getLpLockData, + getTokenLockData, +} \ No newline at end of file diff --git a/projects/stealthpad/index.js b/projects/stealthpad/index.js new file mode 100644 index 00000000000..323985fea40 --- /dev/null +++ b/projects/stealthpad/index.js @@ -0,0 +1,23 @@ +const { sumUnknownTokens } = require('../helper/unknownTokens') +const abi = require('./abi.js') + +module.exports = { + start: 17996063, + methodology: `Counts liquidity in lp lock contracts`, +} + +const config = { + ethereum: { lockerManagerV1: '0x57136ec54ddafd1695479cae1140fbc6d5a916d1',}, +} + +Object.keys(config).forEach(chain => { + const { lockerManagerV1, } = config[chain] + module.exports[chain] = { tvl } + + async function tvl(_, _b, _cb, { api, }) { + // const tokenInfos = await api.fetchList({ lengthAbi: abi.tokenLockerCount, itemAbi: abi.getTokenLockData, target: lockerManagerV1, }) + const lpInfos = await api.fetchList({ lengthAbi: abi.lpLockerCount, itemAbi: abi.getLpLockData, target: lockerManagerV1, }) + const tokensAndOwners = [lpInfos].flat().filter(i => i.isLpToken).map(l => [l.token, l.contractAddress]) + return sumUnknownTokens({ api, tokensAndOwners, useDefaultCoreAssets: true, resolveLP: true, onlyLPs: true, }) + } +}) From e23067b861459815d669aa96aa1e13b2bfb2dcc2 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 5 Sep 2023 21:53:10 +0200 Subject: [PATCH 1114/1974] minor fix --- projects/stealthpad/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/stealthpad/index.js b/projects/stealthpad/index.js index 323985fea40..6c0d9f09573 100644 --- a/projects/stealthpad/index.js +++ b/projects/stealthpad/index.js @@ -2,6 +2,7 @@ const { sumUnknownTokens } = require('../helper/unknownTokens') const abi = require('./abi.js') module.exports = { + misrepresentedTokens: true, start: 17996063, methodology: `Counts liquidity in lp lock contracts`, } From da67ce6414fe5bfc485de941f0eaf06dd712ffee Mon Sep 17 00:00:00 2001 From: TJakubek <39831436+TJakubek@users.noreply.github.com> Date: Tue, 5 Sep 2023 22:05:20 +0200 Subject: [PATCH 1115/1974] enosys - adding flare mainnet dex and farms (#7382) * enosys - adding flare mainnet dex and farms * unwrap flare LP token --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/flarefarm/flare.js | 28 ++++++++++++++ projects/flarefarm/index.js | 67 ++++------------------------------ projects/flarefarm/songbird.js | 63 ++++++++++++++++++++++++++++++++ projects/flarex/index.js | 5 ++- projects/helper/utils.js | 1 + 5 files changed, 103 insertions(+), 61 deletions(-) create mode 100644 projects/flarefarm/flare.js create mode 100644 projects/flarefarm/songbird.js diff --git a/projects/flarefarm/flare.js b/projects/flarefarm/flare.js new file mode 100644 index 00000000000..26c0b2d1dd6 --- /dev/null +++ b/projects/flarefarm/flare.js @@ -0,0 +1,28 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumUnknownTokens } = require("../helper/unknownTokens"); + +const WFLR = ADDRESSES.flare.WFLR +const APS = '0xfF56Eb5b1a7FAa972291117E5E9565dA29bc808d' + +const chain = 'flare' + +// farms which reward APS +// [LP token address, farm address] +async function farmTvl(timestamp, ethblock, { [chain]: block }) { + const tokens = [ + ['0x7520005032F43229F606d3ACeae97045b9D6F7ea', "0x22beb4c7166DbAa0A33052A770C3b358cAbE9089"], + ]; + + return sumUnknownTokens({ tokensAndOwners: tokens, chain, block, useDefaultCoreAssets: true, }) +} + +// farms where APS is one part of the pair +async function pool2(timestamp, ethblock, { [chain]: block }) { + const tokens = [] + return sumUnknownTokens({ tokensAndOwners: tokens, chain, block, useDefaultCoreAssets: true, }) +} + +module.exports = { + tvl: farmTvl, + pool2, +}; \ No newline at end of file diff --git a/projects/flarefarm/index.js b/projects/flarefarm/index.js index cbda1c8ff9b..a083ac9f7a8 100644 --- a/projects/flarefarm/index.js +++ b/projects/flarefarm/index.js @@ -1,64 +1,11 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const { sumUnknownTokens } = require("../helper/unknownTokens"); -const { staking } = require('../helper/staking') -const WSGB = ADDRESSES.songbird.WSGB -const CANARY_DOLLAR = ADDRESSES.songbird.CAND - const EXFI = ADDRESSES.songbird.EXFI; - const SFIN = ADDRESSES.songbird.SFIN; +const songbird = require('./songbird.js') +const flare = require('./flare.js') -const chain = 'songbird' - -async function farmTvl(timestamp, ethblock, { [chain]: block }) { - const tokens = [ - [WSGB, "0x6BA0F675EB2f169D15764D5cf10C4EF0e9e059f2"], - [EXFI, "0xc9231AB30b2B39c1f7f79132D7a44bBF0F8144B0"], - [CANARY_DOLLAR, "0x32b36B0A8B74Ac9212946a99e0af727848D5A3A1"], - ["0xC6D2f9e21bcD963B42D85379581003be1146b3Aa", "0x02785B7CE6Eb9A5858561DDAB64cCBE5c478b730"], - ["0x07852D5C7fd1d630Dd79148A195aaAF72241680D", "0x50756c69CAC800a3fA03d130721CDa02Aa0fEF69"], - ["0xb5bf334b8cc30b8b13fc035d171d77a217aab091", "0x864201b2227Ee23f0875c5D3Fc49F4F0ec59aC19"], - ["0x47c830e141234d029d953df39b13d7728eb9f2d4", "0x921E8f58cF517d289c01BCBE800c2d31838c1a28"], - [EXFI, "0xad72C1483bBAB54B7f4e0024f6D4b437a69DA48b"], - [EXFI, "0xbEDfFd817383147616131ED38B7030277609d8B7"], - [EXFI, "0x6FD8A1a58645aaB92Aa6858b42a8dd985714fE15"], - [EXFI, "0x7e48Db2b486Cf90150421cBdcA401B86833F5333"], - ["0x47C830E141234d029D953dF39B13d7728eB9f2d4", "0xc387818C274a365D973AAb8287498350757D7b1f"], - ['0xB5BF334B8Cc30B8B13fc035d171D77A217aaB091','0x53Fb520ea993C58dB5035b3a00FABB0dc8fE3CA4'], - ['0x47C830E141234d029D953dF39B13d7728eB9f2d4','0xb4bD741343727EcBdACDE37124D869104b0AcAf8'], - ['0xC6D2f9e21bcD963B42D85379581003be1146b3Aa','0x1d1FAD6faAFc6a5Cd6652fFA7BA43F9E4fa75C0d'], - [EXFI, '0xD02C3e166223EE78F4d0ae99F5396142b48D97FE'], - [WSGB, '0x745d8896629842ef8E44D269f89A7A873086A6F2'], - [EXFI, "0x61128b44C299b0f7a752BF6278f44f1EcefD9109"], - ['0x3233642aCf7664a69c33e5a6FFAb321608d7A65f','0xF81B465C562ED3f54Aea772D8A56FAF93884ea2E'], - [EXFI, "0x3B346b0b091fA8813f60Cd6e81b95b63375e22f5"], - ['0xc41aA3ac0e6efcb780cd4696E7eC3B8193BB46E1', "0xa275DD75C1182055C7039b839cC0Da017c78933a"], - [EXFI,"0x74C09E58AB2fb74dF729000e36D338016396ee67"], - ['0xcD15C231b8A0Bae40bD7938AE5eA8e43f1e9a15F',"0x0E437e1c7371b2ac0f3040e2B5866c9cb2e6EA64"], - ]; - - return sumUnknownTokens({ tokensAndOwners: tokens, chain, block, useDefaultCoreAssets: true, }) -} - -async function pool2(timestamp, ethblock, { [chain]: block }) { - const tokens = [ - ["0xcd15c231b8a0bae40bd7938ae5ea8e43f1e9a15f", "0x0732f6B4aBE5dB2127E671E4B218d340b6af169c"], - ["0xcd15c231b8a0bae40bd7938ae5ea8e43f1e9a15f", "0x3b343A6FC05B699F48CBe6FF127C0af8e2aA9EEE"], - ["0xcd15c231b8a0bae40bd7938ae5ea8e43f1e9a15f", "0x782BdE5353FAcFab1eBeC1803f2a575346193B30"], - ["0x48195ca4d228ce487ae2ae1335b017a95493ade6", "0xc5478a1d5914cF9D0Ee20Da21459502eCb7E1646"], - ["0x48195ca4d228ce487ae2ae1335b017a95493ade6", "0x9185D70f17eC13897D780601708b1b1F36A75d32"], - ["0xcd15c231b8a0bae40bd7938ae5ea8e43f1e9a15f", "0xD262AFf2Bb76f05cf470a7D935E717eEbA8ef799"], - ["0x5D4e155CA27e8DAd4E4aceE48F83B6E0E4AFEec0", "0x2379FD47f100828382fFeaF26381Ba6608f7Bf73"], - ["0x5D4e155CA27e8DAd4E4aceE48F83B6E0E4AFEec0", "0xC1ecfEA1148f9506FF10E9Ecf76F40884b4987Cc"], - ["0xcd15c231b8a0bae40bd7938ae5ea8e43f1e9a15f", "0xDa78E41813Cc2468bAA74ad3E84b35b7FedF42bD"] - ] - return sumUnknownTokens({ tokensAndOwners: tokens, chain, block, useDefaultCoreAssets: true, }) -} +// node test projects/flarefarm/index.js module.exports = { - misrepresentedTokens: true, + misrepresentedTokens: true, methodology: `Gets token balance from the smart contract address holding the user deposits. These addresses are are labele "tokensAndOwners". SFIN staked to earn more SFIN is labeles as "staking" category`, - songbird: { - tvl: farmTvl, - pool2, - staking: staking(['0x554742076743b366504972F86609d64fd18BDC34', '0xd0dbAFF52224C0882cfaf1765f347Cb5e4364FA1'], SFIN), - } -}; \ No newline at end of file + songbird, + flare +} \ No newline at end of file diff --git a/projects/flarefarm/songbird.js b/projects/flarefarm/songbird.js new file mode 100644 index 00000000000..53c4689cfc2 --- /dev/null +++ b/projects/flarefarm/songbird.js @@ -0,0 +1,63 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumUnknownTokens } = require("../helper/unknownTokens"); +const { staking } = require('../helper/staking') +const WSGB = ADDRESSES.songbird.WSGB +const CANARY_DOLLAR = ADDRESSES.songbird.CAND + const EXFI = ADDRESSES.songbird.EXFI; + const SFIN = ADDRESSES.songbird.SFIN; + +const chain = 'songbird' + +// farms which reward SFIN +// [LP token address, farm address] +async function farmTvl(timestamp, ethblock, { [chain]: block }) { + const tokens = [ + [WSGB, "0x6BA0F675EB2f169D15764D5cf10C4EF0e9e059f2"], + [EXFI, "0xc9231AB30b2B39c1f7f79132D7a44bBF0F8144B0"], + [CANARY_DOLLAR, "0x32b36B0A8B74Ac9212946a99e0af727848D5A3A1"], + ["0xC6D2f9e21bcD963B42D85379581003be1146b3Aa", "0x02785B7CE6Eb9A5858561DDAB64cCBE5c478b730"], + ["0x07852D5C7fd1d630Dd79148A195aaAF72241680D", "0x50756c69CAC800a3fA03d130721CDa02Aa0fEF69"], + ["0xb5bf334b8cc30b8b13fc035d171d77a217aab091", "0x864201b2227Ee23f0875c5D3Fc49F4F0ec59aC19"], + ["0x47c830e141234d029d953df39b13d7728eb9f2d4", "0x921E8f58cF517d289c01BCBE800c2d31838c1a28"], + [EXFI, "0xad72C1483bBAB54B7f4e0024f6D4b437a69DA48b"], + [EXFI, "0xbEDfFd817383147616131ED38B7030277609d8B7"], + [EXFI, "0x6FD8A1a58645aaB92Aa6858b42a8dd985714fE15"], + [EXFI, "0x7e48Db2b486Cf90150421cBdcA401B86833F5333"], + ["0x47C830E141234d029D953dF39B13d7728eB9f2d4", "0xc387818C274a365D973AAb8287498350757D7b1f"], + ['0xB5BF334B8Cc30B8B13fc035d171D77A217aaB091','0x53Fb520ea993C58dB5035b3a00FABB0dc8fE3CA4'], + ['0x47C830E141234d029D953dF39B13d7728eB9f2d4','0xb4bD741343727EcBdACDE37124D869104b0AcAf8'], + ['0xC6D2f9e21bcD963B42D85379581003be1146b3Aa','0x1d1FAD6faAFc6a5Cd6652fFA7BA43F9E4fa75C0d'], + [EXFI, '0xD02C3e166223EE78F4d0ae99F5396142b48D97FE'], + [WSGB, '0x745d8896629842ef8E44D269f89A7A873086A6F2'], + [EXFI, "0x61128b44C299b0f7a752BF6278f44f1EcefD9109"], + ['0x3233642aCf7664a69c33e5a6FFAb321608d7A65f','0xF81B465C562ED3f54Aea772D8A56FAF93884ea2E'], + [EXFI, "0x3B346b0b091fA8813f60Cd6e81b95b63375e22f5"], + ['0xc41aA3ac0e6efcb780cd4696E7eC3B8193BB46E1', "0xa275DD75C1182055C7039b839cC0Da017c78933a"], + [EXFI,"0x74C09E58AB2fb74dF729000e36D338016396ee67"], + ['0xcD15C231b8A0Bae40bD7938AE5eA8e43f1e9a15F',"0x0E437e1c7371b2ac0f3040e2B5866c9cb2e6EA64"], + ]; + + return sumUnknownTokens({ tokensAndOwners: tokens, chain, block, useDefaultCoreAssets: true, }) +} + +// farms where SFIN is one part of the pair +async function pool2(timestamp, ethblock, { [chain]: block }) { + const tokens = [ + ["0xcd15c231b8a0bae40bd7938ae5ea8e43f1e9a15f", "0x0732f6B4aBE5dB2127E671E4B218d340b6af169c"], + ["0xcd15c231b8a0bae40bd7938ae5ea8e43f1e9a15f", "0x3b343A6FC05B699F48CBe6FF127C0af8e2aA9EEE"], + ["0xcd15c231b8a0bae40bd7938ae5ea8e43f1e9a15f", "0x782BdE5353FAcFab1eBeC1803f2a575346193B30"], + ["0x48195ca4d228ce487ae2ae1335b017a95493ade6", "0xc5478a1d5914cF9D0Ee20Da21459502eCb7E1646"], + ["0x48195ca4d228ce487ae2ae1335b017a95493ade6", "0x9185D70f17eC13897D780601708b1b1F36A75d32"], + ["0xcd15c231b8a0bae40bd7938ae5ea8e43f1e9a15f", "0xD262AFf2Bb76f05cf470a7D935E717eEbA8ef799"], + ["0x5D4e155CA27e8DAd4E4aceE48F83B6E0E4AFEec0", "0x2379FD47f100828382fFeaF26381Ba6608f7Bf73"], + ["0x5D4e155CA27e8DAd4E4aceE48F83B6E0E4AFEec0", "0xC1ecfEA1148f9506FF10E9Ecf76F40884b4987Cc"], + ["0xcd15c231b8a0bae40bd7938ae5ea8e43f1e9a15f", "0xDa78E41813Cc2468bAA74ad3E84b35b7FedF42bD"] + ] + return sumUnknownTokens({ tokensAndOwners: tokens, chain, block, useDefaultCoreAssets: true, }) +} + +module.exports = { + tvl: farmTvl, + pool2, + staking: staking(['0x554742076743b366504972F86609d64fd18BDC34', '0xd0dbAFF52224C0882cfaf1765f347Cb5e4364FA1'], SFIN), +}; \ No newline at end of file diff --git a/projects/flarex/index.js b/projects/flarex/index.js index 1872fac04d3..c0864d2da31 100644 --- a/projects/flarex/index.js +++ b/projects/flarex/index.js @@ -6,8 +6,11 @@ const v2 =getUniTVL({ factory: '0x7a39408809441814469A8Fb3F5CFea1aA2774fB6', cha module.exports={ misrepresentedTokens: true, - methodology: "Factory address (0x7a39408809441814469A8Fb3F5CFea1aA2774fB6) is used to find the LP pairs. TVL is equal to the liquidity on the AMM.", + methodology: "Factory address (0x7a39408809441814469A8Fb3F5CFea1aA2774fB6 - songbird, 0x28b70f6Ed97429E40FE9a9CD3EB8E86BCBA11dd4 - flare) is used to find the LP pairs. TVL is equal to the liquidity on the AMM.", songbird: { tvl:sdk.util.sumChainTvls([v1,v2]) + }, + flare:{ + tvl: getUniTVL({ useDefaultCoreAssets: true, factory: '0x28b70f6Ed97429E40FE9a9CD3EB8E86BCBA11dd4' }), } } \ No newline at end of file diff --git a/projects/helper/utils.js b/projects/helper/utils.js index 35d4382d495..772d5ddf514 100644 --- a/projects/helper/utils.js +++ b/projects/helper/utils.js @@ -74,6 +74,7 @@ function isLP(symbol, token, chain) { if (chain === 'kardia' && ['KLP', 'KDXLP'].includes(symbol)) return true if (chain === 'fantom' && ['HLP', 'WLP'].includes(symbol)) return true if (chain === 'era' && /(cSLP|sSLP|ZFLP)$/.test(symbol)) return true // for syncswap + if (chain === 'flare' && symbol.endsWith('_LP')) return true // for enosys dex if (chain === 'songbird' && ['FLRX', 'OLP'].includes(symbol)) return true if (chain === 'arbitrum' && ['DXS', 'ZLP',].includes(symbol)) return true if (chain === 'metis' && ['NLP', 'ALP'].includes(symbol)) return true // Netswap/Agora LP Token From 25f202b3ede3436f1fa9f71d9fc03bcc91dbaf10 Mon Sep 17 00:00:00 2001 From: "EMP.MONEY" <99704063+empm0ney@users.noreply.github.com> Date: Wed, 6 Sep 2023 03:22:52 -0400 Subject: [PATCH 1116/1974] Sparkswap Listing (#7387) * add sparkswap index.js * sparkswap listing * code refactor --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/sparkswap/index.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 projects/sparkswap/index.js diff --git a/projects/sparkswap/index.js b/projects/sparkswap/index.js new file mode 100644 index 00000000000..a54270dc04a --- /dev/null +++ b/projects/sparkswap/index.js @@ -0,0 +1,18 @@ +const { masterchefExports, sumTokensExport } = require('../helper/unknownTokens') +const { mergeExports } = require('../helper/utils') + +const MASTER_CHEF_CONTRACT = "0x2c8BBd2cecC77F2d18A04027Cc03CDB8Ab103214" +const NATIVE_TOKEN = "0x6386704cD6f7A584EA9D23cccA66aF7EBA5a727e" +const NATIVE_LP_TOKEN = "0x1B044593a78E374bD0E558Aa6633D2ff13fD5Bb7" +const SPARKLER_CONTRACT = "0x7b1C460d0Ad91c8A453B7b0DBc0Ae4F300423FFB" + +const chefExport = masterchefExports({ chain: 'pulse', masterchef: MASTER_CHEF_CONTRACT, nativeToken: NATIVE_TOKEN, lps: [NATIVE_LP_TOKEN], useDefaultCoreAssets: true, }) +delete chefExport.staking + +module.exports = mergeExports([chefExport, { + pulse: { + tvl: () => ({}), + pool2: sumTokensExport({ owner: SPARKLER_CONTRACT, tokens: [NATIVE_LP_TOKEN], useDefaultCoreAssets: true,}), + staking: sumTokensExport({ owners: [SPARKLER_CONTRACT, MASTER_CHEF_CONTRACT,], tokens: [NATIVE_TOKEN], useDefaultCoreAssets: true, lps: [NATIVE_LP_TOKEN]}), + } +}]) From 997152fcb6ee7efa7b684f216f43e40e676718fb Mon Sep 17 00:00:00 2001 From: thanh-wombat <139751487+thanh-wombat@users.noreply.github.com> Date: Wed, 6 Sep 2023 14:23:08 +0700 Subject: [PATCH 1117/1974] feat: add cross chain pool addresses (#8) (#7386) --- projects/wombat-exchange/config.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/wombat-exchange/config.js b/projects/wombat-exchange/config.js index 8ed95093fdf..437203c1c4c 100644 --- a/projects/wombat-exchange/config.js +++ b/projects/wombat-exchange/config.js @@ -27,6 +27,7 @@ module.exports = { rbnb: "0x0592083B285aa75B9c8BaD2485C6cCCF93cCC348", SnBNB: "0xF1e604e9A31c3b575f91CF008445B7ce06BF3fef", USDS: "0x0c735f84BD7EDA8F8176236091AF8068Bb6C41dE", + crossChainPool: "0x1ee15673e07105Bcf360139fa8CafeBDd7754BeF", }, }, arbitrum: { @@ -47,6 +48,7 @@ module.exports = { wstETH: "0xe14302040c0A1eb6fB5A4A79EfA46D60029358d9", pendle: "0xe7159f15e7b1d6045506B228A1ed2136dcc56F48", fUSD: "0x956454C7BE9318863297309183C79b793D370401", + crossChainPool: "0xe78876C360716f2225F55A6726B32324FE1B1145", }, }, ethereum: { @@ -58,6 +60,7 @@ module.exports = { frxETH: "0x3161f40EA6c0C4cC8b2433d6D530EF255816E854", wstETH: "0xF8E32cA46AC28799c8FB7DCe1Ac11A4541160734", ETHx: "0x647CC8816C2d60A5fF4d1ffeF27a5b3637d5ac81", + crossChainPool: "0xA45C0ABeef67C363364E0e73832df9986aBa3800", }, }, hallmarks: [ From 63c062389df1248cd44789bc504d5ecb40372a49 Mon Sep 17 00:00:00 2001 From: PolyLend <144064665+polylendxyz@users.noreply.github.com> Date: Wed, 6 Sep 2023 10:23:38 +0300 Subject: [PATCH 1118/1974] Update AddressProvider for PolyLend (#7385) * Update index.js * Added the right contract for polylend --- projects/polylend/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/polylend/index.js b/projects/polylend/index.js index 6b9a24a7f4e..9ba41447cc5 100644 --- a/projects/polylend/index.js +++ b/projects/polylend/index.js @@ -2,6 +2,6 @@ const { aaveExports } = require("../helper/aave"); module.exports = { polygon_zkevm: aaveExports("polygon_zkevm", undefined, undefined, [ - "0x2C21bA5b8795A1efeC48b34d2FD7787d7547b494", + "0x27268393Fb8CD0556A62C749C9E70aA537910acc", ]), }; From 5d51528128e076ded8d91492847d747df3a21893 Mon Sep 17 00:00:00 2001 From: Michael Otis <34221002+michaelotis@users.noreply.github.com> Date: Wed, 6 Sep 2023 02:36:42 -0500 Subject: [PATCH 1119/1974] Update Vela Exchange Adapter to include Base Chain metrics (#7383) * Update Vela TVL/Staking * Remove async-retry * Update index.js * Add Base launch to Vela Exchange --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/vela-exchange/index.js | 34 +++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/projects/vela-exchange/index.js b/projects/vela-exchange/index.js index 47facb09501..c544470b1f8 100644 --- a/projects/vela-exchange/index.js +++ b/projects/vela-exchange/index.js @@ -4,8 +4,9 @@ const { graphQuery } = require('../helper/http') const VELA = '0x088cd8f5eF3652623c22D48b1605DCfE860Cd704' -const endpoint = "https://api.thegraph.com/subgraphs/name/velaexchange/vela-exchange-official" -async function staking_() { +const arbitrumEndpoint = "https://api.thegraph.com/subgraphs/name/velaexchange/vela-exchange-official" +const baseEndpoint = "https://api.thegraph.com/subgraphs/name/velaexchange/vela-exchange-official-base" +async function staking_arbitrum_() { const { api } = arguments[3] const query = ` @@ -19,7 +20,26 @@ async function staking_() { } } `; - const graphRes = (await graphQuery(endpoint, query)).poolInfos.find(x => true); + const graphRes = (await graphQuery(arbitrumEndpoint, query)).poolInfos.find(x => true); + api.add(VELA, graphRes?.pid2) + api.add(VELA, graphRes?.pid3) +} + +async function staking_base_() { + const { api } = arguments[3] + + const query = ` + query { + poolInfos(where: { + id: "all" + }) { + pid1 + pid2 + pid3 + } + } + `; + const graphRes = (await graphQuery(baseEndpoint, query)).poolInfos.find(x => true); api.add(VELA, graphRes?.pid2) api.add(VELA, graphRes?.pid3) } @@ -28,9 +48,15 @@ module.exports = { methodology: "Counts USDC deposited to trade and to mint VLP. Staking counts VELA and esVELA deposited to earn esVELA", arbitrum: { tvl: staking('0xC4ABADE3a15064F9E3596943c699032748b13352', ADDRESSES.arbitrum.USDC), - staking: staking_ + staking: staking_arbitrum_ + }, + base: { + start: 3566528, + tvl: staking("0xC4ABADE3a15064F9E3596943c699032748b13352", ADDRESSES.base.USDbC), + staking: staking_base_ }, hallmarks: [ [Math.floor(new Date('2023-04-13') / 1e3), 'Refunded tokens to VLP holders & traders'], + [1693926000, 'Launched on Base Chain'] ], } From 2c2a5997449e9604b16215bf13cf653fc6b94af5 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 6 Sep 2023 09:55:50 +0200 Subject: [PATCH 1120/1974] Stealthpad (#7390) * add staking option * update methodology * minor fix --------- Co-authored-by: CryptoSnowPrince --- projects/stealthpad/index.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/projects/stealthpad/index.js b/projects/stealthpad/index.js index 6c0d9f09573..bd393a8f0fa 100644 --- a/projects/stealthpad/index.js +++ b/projects/stealthpad/index.js @@ -1,4 +1,4 @@ -const { sumUnknownTokens } = require('../helper/unknownTokens') +const { sumUnknownTokens, sumTokensExport } = require('../helper/unknownTokens') const abi = require('./abi.js') module.exports = { @@ -8,17 +8,20 @@ module.exports = { } const config = { - ethereum: { lockerManagerV1: '0x57136ec54ddafd1695479cae1140fbc6d5a916d1',}, + ethereum: { lockerManagerV1: '0x57136ec54ddafd1695479cae1140fbc6d5a916d1', stakingContract: '0x23dDCc4787bc8CC3b433782b7d9b876da467533F', stakingToken: '0xB18F98822C22492Bd6b77D19cae9367f3D60fcBf', lps: ['0x626BB5e02694372b5A919A5981659595C2FD3788'] }, } Object.keys(config).forEach(chain => { - const { lockerManagerV1, } = config[chain] - module.exports[chain] = { tvl } + const { lockerManagerV1, stakingContract, stakingToken, lps } = config[chain] + module.exports[chain] = { tvl, } async function tvl(_, _b, _cb, { api, }) { - // const tokenInfos = await api.fetchList({ lengthAbi: abi.tokenLockerCount, itemAbi: abi.getTokenLockData, target: lockerManagerV1, }) const lpInfos = await api.fetchList({ lengthAbi: abi.lpLockerCount, itemAbi: abi.getLpLockData, target: lockerManagerV1, }) const tokensAndOwners = [lpInfos].flat().filter(i => i.isLpToken).map(l => [l.token, l.contractAddress]) return sumUnknownTokens({ api, tokensAndOwners, useDefaultCoreAssets: true, resolveLP: true, onlyLPs: true, }) } + + if (stakingContract && stakingToken) { + module.exports[chain].staking = sumTokensExport({ tokens: [stakingToken], chain, owner: stakingContract, useDefaultCoreAssets: true, lps }) + } }) From 3c31555177e670657f95648efb3e18405707d789 Mon Sep 17 00:00:00 2001 From: Fixer Date: Wed, 6 Sep 2023 10:04:15 +0200 Subject: [PATCH 1121/1974] brokkr: arbitrum contracts added (#7391) Co-authored-by: Florian Dulzky --- projects/brokkr/index.js | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/projects/brokkr/index.js b/projects/brokkr/index.js index b1f3ef28116..3078c2b8a5f 100644 --- a/projects/brokkr/index.js +++ b/projects/brokkr/index.js @@ -1,6 +1,9 @@ const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens2 } = require('../helper/unwrapLPs') -const INDEX_TOKEN_CONTRACT = { 'avax': '0xB0E2880D4429d10eF1956062B260aDf09557A1da' } +const INDEX_TOKEN_CONTRACT = { + 'avax': ['0xB0E2880D4429d10eF1956062B260aDf09557A1da', '0x5C06f08807778fb84e25A00aEfafBF9C8d528267', '0xa02DDE8Ac54814c39A3Ab12EaC43B557EffFaF60'], + 'arbitrum': ['0x6b9F66564d92fed3643Cc9f86E2c21bd84171699', '0x916f7afBA53DB6A1f88e726Bc5E2278b10b9A33d'] +} const USDC_TOKEN_CONTRACT = ADDRESSES.avax.USDC const CALM_PORTFOLIO_CONTRACT = '0x2eAf73F8E6BCf606f56E5cf201756C1f0565C068' const AMBITIOUS_PORTFOLIO_CONTRACT = '0x0294D02e9Fee4872e72697e9514aD0be671DB498' @@ -12,16 +15,26 @@ const DCA_PORTFOLIO_CONTRACTS = { "0x53f14744F15365a0323B4FF0693E9190fFBE4B62", "0xBAff4c732634b929033917E5dF30A52EFee554ff", "0xf7df7AC55F06892f52Bfe62311434bC3B9647c89" + ], + 'arbitrum': [ + '0x4226e90a85df5C8F30b0b0C8D14388C1eCBb6E3B', + '0x9c09B8e7E3301D92706E046d8ED633D13A0804C8', + '0x5237efE4701b21e6A9001B58cf7fDa9D5bB6193b', + '0xEa110407c40fC89dcaEC5067fF34206f356d1EC6', + '0x8639444F8511a5e2d6F979bddb75BB4e88948942' ] } async function tvl(_, _1, _2, { api }) { - const indexToken = INDEX_TOKEN_CONTRACT[api.chain] + const indexTokens = INDEX_TOKEN_CONTRACT[api.chain] const dcas = DCA_PORTFOLIO_CONTRACTS[api.chain] const ownerTokens = [] - if (indexToken) { - const tokens = await api.call({ abi: "address[]:allComponents", target: indexToken }) - ownerTokens.push([tokens, indexToken]) + if (indexTokens) { + for (let i in indexTokens) { + let indexToken = indexTokens[i] + const tokens = await api.call({ abi: "address[]:allComponents", target: indexToken }) + ownerTokens.push([tokens, indexToken]) + } } if (dcas) { const depositTokens = await api.multiCall({ abi: 'address:depositToken', calls: dcas }) @@ -54,5 +67,8 @@ module.exports = { doublecounted: true, avax: { tvl, + }, + arbitrum: { + tvl, } }; \ No newline at end of file From 5c17bc02e76c8e78591c28f1ee4aa6ee137f21c9 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 6 Sep 2023 10:39:08 +0200 Subject: [PATCH 1122/1974] Haedal (#7393) * added the haedal tvl * minor fix * fix cesta --------- Co-authored-by: kevin Co-authored-by: kevinz678911 <137151142+kevinz678911@users.noreply.github.com> --- projects/cesta/index.js | 59 +--------------------------------------- projects/haedal/index.js | 20 ++++++++++++++ 2 files changed, 21 insertions(+), 58 deletions(-) create mode 100644 projects/haedal/index.js diff --git a/projects/cesta/index.js b/projects/cesta/index.js index 832e897b16c..c36f170140d 100644 --- a/projects/cesta/index.js +++ b/projects/cesta/index.js @@ -1,62 +1,5 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const sdk = require("@defillama/sdk"); -const abi = require("./abi.json"); - async function avax(timestamp, block) { - const CestaVault = { - DexAvax: "0xe4809ed214631017737a3d7fa3e78600ee96eb85", - DexStable: "0xcfDafB1E6310c1844EcC30C60A01D6E0D37368C5", - StableAvax: "0xfbE9613a6bd9d28ceF286b01357789b2b02E46f5", - StableStable: "0xB103F669E87f67376FB9458A67226f2774a0B4FD", - }; - let usd = ADDRESSES.ethereum.USDC; - - let [DexAvaxTVL, DexStableTVL, StableAvaxTVL, StableStableTVL] = - await Promise.all([ - sdk.api.abi.call({ - block, - target: CestaVault.DexAvax, - abi: abi["getAllPoolInUSD"], - chain: "avax", - }), - sdk.api.abi.call({ - block, - target: CestaVault.DexStable, // contract address - abi: abi["getAllPoolInUSD"], // erc20:methodName - chain: "avax", - }), - sdk.api.abi.call({ - block, - target: CestaVault.StableAvax, // contract address - abi: abi["getAllPoolInUSD"], // erc20:methodName - chain: "avax", - }), - sdk.api.abi.call({ - block, - target: CestaVault.StableStable, // contract address - abi: abi["getAllPoolInUSD"], // erc20:methodName - chain: "avax", - }), - ]); - - DexAvaxTVL = parseInt(DexAvaxTVL.output) / 10 ** 12; - DexStableTVL = parseInt(DexStableTVL.output) / 10 ** 12; - StableAvaxTVL = parseInt(StableAvaxTVL.output) / 10 ** 12; - StableStableTVL = parseInt(StableStableTVL.output) / 10 ** 12; - - const result = { - "Dex-Avax Vault": DexAvaxTVL, - "Dex-StableCoin Vault": DexStableTVL, - "StableCoin-Avax Vault": StableAvaxTVL, - "StableCoin Vault": StableStableTVL, - }; - - let balances = 0; - for (const prop in result) { - balances += result[prop]; - } - let tk = usd; - return { [tk]: balances }; + return { }; } module.exports = { diff --git a/projects/haedal/index.js b/projects/haedal/index.js new file mode 100644 index 00000000000..344712a953a --- /dev/null +++ b/projects/haedal/index.js @@ -0,0 +1,20 @@ +const sui = require('../helper/chain/sui') + +async function suiTVL() { + const stakingObjectID = '0x47b224762220393057ebf4f70501b6e657c3e56684737568439a04f80849b2ca' + const { fields: staking } = await sui.getObject(stakingObjectID) + console.log(staking) + + const suiAmount = +staking.total_staked + +staking.total_rewards - +staking.total_protocol_fees - + +staking.uncollected_protocol_fees - +staking.total_unstaked + +staking.unclaimed_sui_amount; + + return { + sui: suiAmount / 1e9, + } +} + +module.exports = { + sui: { + tvl: suiTVL, + } +} From 9210eb0eddc7ff7a5628cdf91a9a5896df2fafb8 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 6 Sep 2023 13:14:20 +0200 Subject: [PATCH 1123/1974] reduce reliance on fetch --- projects/adaxPro/index.js | 15 +++----- projects/amun/index.js | 67 +++++---------------------------- projects/bubbleswap-v2/index.js | 13 ------- projects/citrus/index.js | 16 -------- projects/ellipsis/onchain.js | 1 - projects/helper/chain/tezos.js | 1 + projects/helper/tokenMapping.js | 3 ++ projects/spicyswap/index.js | 47 +++++++++++++---------- projects/steak/terra.js | 6 --- projects/turbos/index.js | 9 ----- projects/zeta/index.js | 9 ----- 11 files changed, 47 insertions(+), 140 deletions(-) diff --git a/projects/adaxPro/index.js b/projects/adaxPro/index.js index 2c88f222885..d8edf47e0e3 100644 --- a/projects/adaxPro/index.js +++ b/projects/adaxPro/index.js @@ -1,14 +1,11 @@ -const { default: axios } = require("axios") - -async function fetch(){ - const tvl = (await axios.post("https://amm-api.adax.pro/", {category: 'tvl', endpoint: "getStatistics", type: "total"})).data - return tvl[tvl.length-1].amount_usd -} - module.exports={ methodology: "Data is retrieved from the api at https://amm-api.adax.pro/", timetravel: false, // but there's historical data, this can be changed! - fetch, - deadFrom: "2023-08-29", + cardano: { + tvl: () => ({}), + }, + hallmarks: [ + [Math.floor(new Date('2023-08-29')/1e3), 'Website offline! Rug pull?'], + ], } \ No newline at end of file diff --git a/projects/amun/index.js b/projects/amun/index.js index ab6750b0501..4928b94df7b 100644 --- a/projects/amun/index.js +++ b/projects/amun/index.js @@ -1,66 +1,17 @@ -const BigNumber = require('bignumber.js'); -const sdk = require('@defillama/sdk'); -const axios = require('axios'); -const abi = require('./abi.json'); const solana = require('../helper/solana'); -const PECO_ADDRESS = '0xA9536B9c75A9E0faE3B56a96AC8EdF76AbC91978'; -const DFI_ADDRESS = '0xA9536B9c75A9E0faE3B56a96AC8EdF76AbC91978'; -const SOLI_ADDRESS = '8JnNWJ46yfdq8sKgT1Lk4G7VWkAA8Rhh7LhqgJ6WY41G'; -const SOLI_COINGECKO_ID = 'solana-ecosystem-index'; - -function fetchSolanaTvl(tokens) { - return async () => { - const balances = {}; - for (const token of tokens) { - const tokenSupply = await solana.getTokenSupply(token.address); - balances[token.coingeckoID] = tokenSupply; - } - - return balances; - }; -} - -function chainTvl(chain, tokens) { - return async (timestamp, ethBlock, chainBlocks) => { - const block = chainBlocks[chain]; - const balances = {}; - for (const address of tokens) { - const underlyings = await sdk.api.abi.call({ - block, - target: address, - abi: abi.getTokens, - chain, - }); - for (const token of underlyings.output) { - const held = await sdk.api.erc20.balanceOf({ - block, - target: token, - owner: address, - chain, - }); - - sdk.util.sumSingleBalance(balances, `${chain}:${token}`, held.output); - } - } - - return balances; - }; +async function tvl(_, _b, _cb, { api, }) { + return solana.sumTokens2({ tokenAccounts: ['GprM9vgGpUbNU4N5SbDAigL1JYCvQiDop28cmEQ7Bw2w'] }) } module.exports = { timetravel: false, - ethereum: { - tvl: chainTvl('ethereum', [DFI_ADDRESS]), - }, - polygon: { - tvl: chainTvl('polygon', [PECO_ADDRESS]), - }, - solana: { - tvl: fetchSolanaTvl([{ - address: SOLI_ADDRESS, - coingeckoID: SOLI_COINGECKO_ID, - }]), - }, + ethereum: { tvl: () => ({}), }, + polygon: { tvl: () => ({}), }, + solana: { tvl, }, + hallmarks: [ + [Math.floor(new Date('2023-03-22') / 1e3), 'Project is sunset!'], + [Math.floor(new Date('2022-12-26') / 1e3), 'Hacked for 300k!'], + ], methodology: `Amun Tokens has three investment strategies available, which are the Defi Token Index(DFI), the Polygon Ecosystem Index (PECO) and Solana Ecosystem Index (SOLI). Each strategy has its own address where the underlying tokens are held. To get the TVL for the DFI and PECO, first of all, an on-chain call is made using the function 'tvl()', which first retrieves each token that is held within the strategy addresses and then calls 'balanceOf()' to get the balances of these tokens which are added and used as TVL. For SOLI, getTokenSupply helper method is called to get the total supply of the token, and then multiplied at the current market rate of the token, retrieved from our API endpoint.`, }; diff --git a/projects/bubbleswap-v2/index.js b/projects/bubbleswap-v2/index.js index 9c46e6795ff..2ec1923a3e8 100644 --- a/projects/bubbleswap-v2/index.js +++ b/projects/bubbleswap-v2/index.js @@ -1,16 +1,3 @@ -const { default: axios } = require('axios'); - -async function fetch(){ - - const response = await axios.get('https://api.bubbleswap.io/v2/backend/api/v1/tvl', { - headers: { - //I would prefer the user agengt to be set to something like axios, or DefiLlama, but our WAF only allows the bellow - 'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36' - } - }) - return response.data.data.sumTVL - -} module.exports = { hedera: { diff --git a/projects/citrus/index.js b/projects/citrus/index.js index 4f377e1272c..70276638b22 100644 --- a/projects/citrus/index.js +++ b/projects/citrus/index.js @@ -1,37 +1,21 @@ const ADDRESSES = require('../helper/coreAssets.json') const { getProvider, } = require('../helper/solana'); const { Program } = require("@project-serum/anchor"); -const { getConfig } = require('../helper/cache'); -const axios = require("axios"); - let stats async function getStats() { if (!stats) stats = fetchStats() return stats - async function getCollections() { - const collections = (await axios.get(`https://citrus.famousfoxes.com/citrus/allCollections`)).data; - const collectionsById = {}; - collections.map(c => { - collectionsById[c.id] = c; - }); - return collectionsById; - } - async function fetchStats() { const programId = 'JCFRaPv7852ESRwJJGRy2mysUMydXZgVVhrMLmExvmVp'; const provider = getProvider(); - // const collectionsById = await getCollections(); - // const idl = await getConfig('citrus-idl', 'https://gist.githubusercontent.com/FoxyDev42/5f23cd03eab33e0d73f6f6227912451e/raw/03e68f7543dc4dd399d7b61e15881c1a6792eb4a/citrus-account.json'); const program = new Program(idl, programId, provider) const loans = await program.account.loan.all() const activeLoans = loans.filter(loan => ['active', 'onSale'].includes(Object.keys(loan.account.status)[0])); const openOffers = loans.filter(loan => Object.keys(loan.account.status)[0] === 'waitingForBorrower'); const activeLoansTotal = activeLoans.map(loan => loan.account.loanTerms.principal).reduce((a, b) => a.add(b)); const openOffersTotal = openOffers.map(loan => loan.account.ltvTerms ? loan.account.ltvTerms.maxOffer : loan.account.loanTerms.principal).reduce((a, b) => a.add(b)); - // const activeLoansNFTs = activeLoans.map(loan => loan.account.collectionConfig.toBase58()).reduce((a, b) => a + parseFloat(collectionsById[b]?.floor), 0); - // const tvl = openOffersTotal.toNumber() + activeLoansNFTs * 1e9; const tvl = openOffersTotal.toNumber() const borrowed = activeLoansTotal.toNumber(); return { tvl, borrowed } diff --git a/projects/ellipsis/onchain.js b/projects/ellipsis/onchain.js index 871613c77eb..810f04eed6b 100644 --- a/projects/ellipsis/onchain.js +++ b/projects/ellipsis/onchain.js @@ -1,6 +1,5 @@ const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); -const axios = require('axios'); const { unwrapUniswapLPs } = require('../helper/unwrapLPs'); const abi = require('./abi.json'); const { getConfig } = require('../helper/cache') diff --git a/projects/helper/chain/tezos.js b/projects/helper/chain/tezos.js index 49718444976..e73557cecd0 100644 --- a/projects/helper/chain/tezos.js +++ b/projects/helper/chain/tezos.js @@ -56,6 +56,7 @@ async function getBigMapById(id, limit = 1000, offset = 0, key, value) { let map_entry; const mapping = {}; for (map_entry of response) { + if (typeof map_entry.key === 'object' && map_entry.hash) map_entry.key = map_entry.hash; mapping[map_entry.key] = map_entry.value; } return mapping; diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 1203e3be454..d801345096f 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -73,6 +73,9 @@ const fixBalancesTokens = { arbitrum: { '0x1509706a6c66CA549ff0cB464de88231DDBe213B': { coingeckoId: 'aura-finance', decimals: 18 } }, + tezos: { + 'KT1PnUZCp3u2KzWr93pn4DD7HAJnm3rWVrgn': { coingeckoId: 'tezos', decimals: 6 } + }, mvc: { [ADDRESSES.mvc.SPACE]: { coingeckoId: "microvisionchain", decimals: 8 }, }, diff --git a/projects/spicyswap/index.js b/projects/spicyswap/index.js index ea355ef0a4a..12bf26ac4e6 100644 --- a/projects/spicyswap/index.js +++ b/projects/spicyswap/index.js @@ -1,24 +1,33 @@ -const axios = require('axios'); -const dataUrl = 'https://spicya.sdaotools.xyz/api/rest/SpicyDailyMetrics'; +const { sumTokens2, getStorage, getBigMapById, } = require('../helper/chain/tezos') +const { transformDexBalances, } = require('../helper/portedTokens') -async function tvl() { - const data = (await axios(dataUrl)).data; - const totalLiquidity = data.spicy_day_data[0].totalliquidityxtz; - return { - "tezos": totalLiquidity - } +async function staking() { + return sumTokens2({ owners: ['KT1DUwNeGHVHVW3RqjdfrGgucZHTxy228c68'] }) } module.exports = { - methodology: `TVL counts the liquidity of SpicySwap farms. Data is pulled from:"${dataUrl}".`, - misrepresentedTokens: true, - timetravel: false, - tezos: { - tvl, - staking: async () => { - const data = (await axios(dataUrl)).data; - const tether = data.spicy_day_data[0].totalstakedfarmusdspi; - return { tether } - }, - } + tezos: { + tvl: async () => { + const balances = await sumTokens2({ owners: ['KT1Uq1nmWrnEuBtqMg3FP5nBxfhyHR62y2U3'] }) // limit order tvl + const data = await getStorage('KT1PwoZxyv4XkPEGnTqWYvjA1UYiPTgAGyqL') + const swaps = await getBigMapById(data.pairs); + const pairs = Object.values(swaps).map(i => i.contract) + const data1 = [] + for (const pair of pairs) { + const data = await getStorage(pair) + data1.push({ + token0: getToken(data.token0), + token1: getToken(data.token1), + token0Bal: data.reserve0, + token1Bal: data.reserve1 + }) + } + return transformDexBalances({ balances, chain: 'tezos', data: data1}) + }, + staking, + } } + +function getToken({ token_id, fa2_address }) { + return fa2_address + (token_id && token_id !== '0' ? `-${token_id}` : '') +} \ No newline at end of file diff --git a/projects/steak/terra.js b/projects/steak/terra.js index d7b4fdcea05..2e7d9dbb8cf 100644 --- a/projects/steak/terra.js +++ b/projects/steak/terra.js @@ -1,9 +1,3 @@ -const axios = require("axios"); - -const { encodeBase64 } = require("./helpers.js"); - -const GRPC_API_URL = "https://lcd.terra.dev"; -const STEAK_HUB = "terra15qr8ev2c0a0jswjtfrhfaj5ucgkhjd7la2shlg"; async function tvl() { return {} diff --git a/projects/turbos/index.js b/projects/turbos/index.js index a3bd84d7152..7f3c6c58dd5 100644 --- a/projects/turbos/index.js +++ b/projects/turbos/index.js @@ -1,15 +1,6 @@ const sui = require("../helper/chain/sui"); -const axios = require("axios"); - -async function getPoolFactoryConfig() { - const result = await axios.get( - "https://s3.amazonaws.com/app.turbos.finance/sdk/contract.json" - ); - return result.data.mainnet.contract.PoolConfig; -} async function tvl(_timestamp, _block, _chainBlocks, { api }) { - // const poolFactoryConfig = await getPoolFactoryConfig(); const poolFactoryConfig = '0xc294552b2765353bcafa7c359cd28fd6bc237662e5db8f09877558d81669170c'; const parent = await sui.getObject(poolFactoryConfig); const poolFields = await sui.getDynamicFieldObjects({ diff --git a/projects/zeta/index.js b/projects/zeta/index.js index 1ff44e810da..53a9ed7047b 100644 --- a/projects/zeta/index.js +++ b/projects/zeta/index.js @@ -1,12 +1,3 @@ -const axios = require("axios"); - -async function tvl() { - const tvlSnapshotResponse = await axios.get( - "https://raw.githubusercontent.com/zetamarkets/statistics/main/tvl.json" - ); - return tvlSnapshotResponse.data; -} - module.exports = { doublecounted: true, timetravel: false, From c4d03195c979d65cf1f4895d9eb26f792cedfd20 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 6 Sep 2023 16:39:15 +0200 Subject: [PATCH 1124/1974] track wise-lending --- projects/wise-lending/index.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 projects/wise-lending/index.js diff --git a/projects/wise-lending/index.js b/projects/wise-lending/index.js new file mode 100644 index 00000000000..27892c1696e --- /dev/null +++ b/projects/wise-lending/index.js @@ -0,0 +1,21 @@ +const lendingContract = '0x84524baa1951247b3a2617a843e6ece915bb9674' +const feeManager = '0x0bc24e61daad6293a1b3b53a7d01086bff0ea6e5' + +async function tvl(_, _b, _cb, { api, }) { + const pools = await api.fetchList({ lengthAbi: 'uint256:getPoolTokenAddressesLength', itemAbi: 'function getPoolTokenAdressesByIndex(uint256) view returns (address)', target: feeManager }) + const isATokens = await api.multiCall({ abi: 'function isAaveToken(address) view returns (bool)', calls: pools, target: feeManager }) + const aTokens = pools.filter((_, i) => isATokens[i]) + const otherTokens = pools.filter((_, i) => !isATokens[i]) + const uaTokens = await api.multiCall({ abi: 'function underlyingToken(address) view returns (address)', calls: aTokens, target: feeManager }) + const aBals = await api.multiCall({ abi: 'erc20:balanceOf', calls: aTokens.map(i => ({ target: i, params: lendingContract })) }) + api.addTokens(uaTokens, aBals) + return api.sumTokens({ owner: lendingContract, tokens: otherTokens }) +} + +module.exports = { + misrepresentedTokens: true, + doublecounted: true, + ethereum: { + tvl + } +} \ No newline at end of file From 0d2c222b11f5003bcda46d468eaf9afa9f575a54 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 6 Sep 2023 16:42:30 +0200 Subject: [PATCH 1125/1974] fix zeta #7394 --- projects/zeta/index.js | 76 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 72 insertions(+), 4 deletions(-) diff --git a/projects/zeta/index.js b/projects/zeta/index.js index 53a9ed7047b..6589fa72cd4 100644 --- a/projects/zeta/index.js +++ b/projects/zeta/index.js @@ -1,9 +1,77 @@ +const { PublicKey } = require("@solana/web3.js"); +const anchor = require("@project-serum/anchor"); +const { sumTokens2 } = require("../helper/solana"); +const ZETA_PROGRAM_ID = new PublicKey( + "ZETAxsqBRek56DhiGXrn75yj2NHU3aYUnxvHXpkf3aD" +); +const USDC_MINT = new PublicKey("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"); + module.exports = { - doublecounted: true, timetravel: false, - methodology: - "Snapshots of the TVL from Zeta (zeta.markets) are saved periodically into the statistics repo. This includes all tokens used as collateral and in the insurance fund", + methodology: "Fetches TVL from zeta's vaults and insurance fund", solana: { - tvl: () => ({}), + tvl, }, }; + +async function tvl(_, _b, _cb, { api }) { + const legacyZetaGroupAddrs = [ + new PublicKey("CoGhjFdyqzMFr5xVgznuBjULvoFbFtNN4bCdQzRArNK2"), + new PublicKey("5XC7JWvLGGds4tjaawgY8FwMdotUb5rrEUmxcmyp5ZiW"), + new PublicKey("HPnqfiRSVvuBjfHN9ah4Kecb6J9et2UTnNgUwtAJdV26"), + new PublicKey("D19K6rrppbWAFa4jE1DJUStPnr7cSrqKk5TruGqfc5Ns"), + new PublicKey("CU6pPA2E2yQFqMzZKrFCmfjrSBEc6GxfmFrSqpqazygu"), + ]; + + const legacyVaults = legacyZetaGroupAddrs + .map((addr) => { + return [insuranceVaultAddr(addr), vaultAddr(addr)]; + }) + .flat(); + + const vault = PublicKey.findProgramAddressSync( + [Buffer.from(anchor.utils.bytes.utf8.encode("combined-vault"))], + ZETA_PROGRAM_ID + )[0].toBase58(); + + const insuranceVault = PublicKey.findProgramAddressSync( + [ + Buffer.from( + anchor.utils.bytes.utf8.encode("zeta-combined-insurance-vault") + ), + ], + ZETA_PROGRAM_ID + )[0].toBase58(); + + const treasury = PublicKey.findProgramAddressSync( + [ + Buffer.from(anchor.utils.bytes.utf8.encode("zeta-treasury-wallet")), + USDC_MINT.toBuffer(), + ], + ZETA_PROGRAM_ID + )[0].toBase58(); + + const vaults = [...legacyVaults, vault, insuranceVault, treasury]; + + return sumTokens2({ tokenAccounts: vaults }); +} + +function vaultAddr(zetaGroup) { + return PublicKey.findProgramAddressSync( + [ + Buffer.from(anchor.utils.bytes.utf8.encode("vault")), + zetaGroup.toBuffer(), + ], + ZETA_PROGRAM_ID + )[0].toBase58(); +} + +function insuranceVaultAddr(zetaGroup) { + return anchor.web3.PublicKey.findProgramAddressSync( + [ + Buffer.from(anchor.utils.bytes.utf8.encode("zeta-insurance-vault")), + zetaGroup.toBuffer(), + ], + ZETA_PROGRAM_ID + )[0].toBase58(); +} \ No newline at end of file From bf56c86539649460576eaf5f8ad159308e8255a1 Mon Sep 17 00:00:00 2001 From: Aleksei Lushnikov Date: Wed, 6 Sep 2023 15:44:19 +0100 Subject: [PATCH 1126/1974] symbiosis adds usdt on ethereum and syUSDC on telos chain (#7366) --- projects/helper/coreAssets.json | 1 + projects/symbiosis-finance/config.js | 2 ++ 2 files changed, 3 insertions(+) diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index 1f7d962fa6a..e20724aebda 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -479,6 +479,7 @@ "ETH": "0xfa9343c3897324496a05fc75abed6bac29f8a40f", "WBTC": "0xf390830df829cf22c53c8840554b98eafc5dcbc2", "USDC": "0x818ec0a7fe18ff94269904fced6ae3dae6d6dc0b", + "syUSDC": "0xe6E5f3d264117E030C21920356641DbD5B3d660c", "USDT": "0xefaeee334f0fd1712f9a8cc375f427d9cdd40d73", "STLOS": "0xb4b01216a5bc8f1c8a33cd990a1239030e60c905", "sBUSD": "0x017043607270ecbb440e20b0f0bc5e760818b3d8" diff --git a/projects/symbiosis-finance/config.js b/projects/symbiosis-finance/config.js index 8f1935d5059..92f849a9d05 100644 --- a/projects/symbiosis-finance/config.js +++ b/projects/symbiosis-finance/config.js @@ -5,6 +5,7 @@ module.exports = { name: 'ethereum', tokens: [ ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.USDT, ADDRESSES.ethereum.WETH, ], holders: [ @@ -56,6 +57,7 @@ module.exports = { name: 'telos', tokens: [ ADDRESSES.telos.USDC, + ADDRESSES.telos.syUSDC, ], holders: [ '0x17A0E3234f00b9D7028e2c78dB2caa777F11490F', // portal v1 From c7d678c2621c1066bc2ea4590571a5ef4f68163d Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 6 Sep 2023 16:45:06 +0200 Subject: [PATCH 1127/1974] temp remove syUSDC --- projects/helper/coreAssets.json | 1 - projects/symbiosis-finance/config.js | 1 - 2 files changed, 2 deletions(-) diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index e20724aebda..1f7d962fa6a 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -479,7 +479,6 @@ "ETH": "0xfa9343c3897324496a05fc75abed6bac29f8a40f", "WBTC": "0xf390830df829cf22c53c8840554b98eafc5dcbc2", "USDC": "0x818ec0a7fe18ff94269904fced6ae3dae6d6dc0b", - "syUSDC": "0xe6E5f3d264117E030C21920356641DbD5B3d660c", "USDT": "0xefaeee334f0fd1712f9a8cc375f427d9cdd40d73", "STLOS": "0xb4b01216a5bc8f1c8a33cd990a1239030e60c905", "sBUSD": "0x017043607270ecbb440e20b0f0bc5e760818b3d8" diff --git a/projects/symbiosis-finance/config.js b/projects/symbiosis-finance/config.js index 92f849a9d05..2dcaf49ef56 100644 --- a/projects/symbiosis-finance/config.js +++ b/projects/symbiosis-finance/config.js @@ -57,7 +57,6 @@ module.exports = { name: 'telos', tokens: [ ADDRESSES.telos.USDC, - ADDRESSES.telos.syUSDC, ], holders: [ '0x17A0E3234f00b9D7028e2c78dB2caa777F11490F', // portal v1 From 16f2b6cb9be39a2bd44e8b544326716da8f76fd7 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 6 Sep 2023 17:19:29 +0200 Subject: [PATCH 1128/1974] fix sparkswap --- projects/sparkswap/index.js | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/projects/sparkswap/index.js b/projects/sparkswap/index.js index a54270dc04a..b7c21ace0aa 100644 --- a/projects/sparkswap/index.js +++ b/projects/sparkswap/index.js @@ -1,5 +1,9 @@ -const { masterchefExports, sumTokensExport } = require('../helper/unknownTokens') +const { masterchefExports, sumTokensExport, nullAddress, sumUnknownTokens } = require('../helper/unknownTokens') const { mergeExports } = require('../helper/utils') +const abi = require("../helper/abis/masterchef.json"); +const pendleAbi = require("../pendle/abi.json"); + + const MASTER_CHEF_CONTRACT = "0x2c8BBd2cecC77F2d18A04027Cc03CDB8Ab103214" const NATIVE_TOKEN = "0x6386704cD6f7A584EA9D23cccA66aF7EBA5a727e" @@ -9,10 +13,24 @@ const SPARKLER_CONTRACT = "0x7b1C460d0Ad91c8A453B7b0DBc0Ae4F300423FFB" const chefExport = masterchefExports({ chain: 'pulse', masterchef: MASTER_CHEF_CONTRACT, nativeToken: NATIVE_TOKEN, lps: [NATIVE_LP_TOKEN], useDefaultCoreAssets: true, }) delete chefExport.staking -module.exports = mergeExports([chefExport, { +module.exports = mergeExports([chefExport, { pulse: { - tvl: () => ({}), - pool2: sumTokensExport({ owner: SPARKLER_CONTRACT, tokens: [NATIVE_LP_TOKEN], useDefaultCoreAssets: true,}), - staking: sumTokensExport({ owners: [SPARKLER_CONTRACT, MASTER_CHEF_CONTRACT,], tokens: [NATIVE_TOKEN], useDefaultCoreAssets: true, lps: [NATIVE_LP_TOKEN]}), + tvl, + pool2: sumTokensExport({ owner: SPARKLER_CONTRACT, tokens: [NATIVE_LP_TOKEN], useDefaultCoreAssets: true, }), + staking: sumTokensExport({ owners: [SPARKLER_CONTRACT, MASTER_CHEF_CONTRACT,], tokens: [NATIVE_TOKEN], useDefaultCoreAssets: true, lps: [NATIVE_LP_TOKEN] }), } }]) + + +// add amount in pulsex farm +async function tvl(_, _b, _cb, { api, }) { + let rehypothecations = await api.fetchList({ lengthAbi: 'uint256:poolLength', itemAbi: 'function rehypothecations(uint256) view returns (address farm, uint256 pid)', target: MASTER_CHEF_CONTRACT }) + rehypothecations = rehypothecations.filter(i => i.farm !== nullAddress) + const bals = await api.multiCall({ abi: pendleAbi.userInfo, calls: rehypothecations.map(({ farm, pid }) => ({ target: farm, params: [pid, MASTER_CHEF_CONTRACT] })) }) + const pInfos = await api.multiCall({ abi: "function poolInfo(uint256) view returns (address lpToken, uint256 allocPoint, uint256 lastRewardBlock, uint256 accFishPerShare)", calls: rehypothecations.map(i => ({ target: i.farm, params: i.pid })), }) + pInfos.forEach((pInfo, i) => { + api.add(pInfo.lpToken, bals[i].amount) + api.add('0x2fa878ab3f87cc1c9737fc071108f904c0b0c95d', bals[i].rewardDebt) + }) + return sumUnknownTokens({ api, useDefaultCoreAssets: true, resolveLP: true, }) +} \ No newline at end of file From 283d1b56fff863e47f9ee93f8c2644836abdf32a Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 7 Sep 2023 10:14:31 +0200 Subject: [PATCH 1129/1974] premia: track blue (#7402) --- projects/premia-v3/index.js | 39 ++++++++ projects/premia/abi.json | 4 - projects/premia/index.js | 188 +++++++----------------------------- projects/premia/v1.js | 75 -------------- 4 files changed, 73 insertions(+), 233 deletions(-) create mode 100644 projects/premia-v3/index.js delete mode 100644 projects/premia/abi.json delete mode 100644 projects/premia/v1.js diff --git a/projects/premia-v3/index.js b/projects/premia-v3/index.js new file mode 100644 index 00000000000..5c7c88d9eab --- /dev/null +++ b/projects/premia-v3/index.js @@ -0,0 +1,39 @@ +const { getLogs } = require('../helper/cache/getLogs') +const { cachedGraphQuery } = require('../helper/cache') + +const getAddresses = ` + query PoolAddresses { + vaults(first: 1000, orderBy: totalValueLockedUSD, orderDirection: desc) { + address + asset { + address + } + } + } +` + +const config = { + arbitrum: { poolFactory: '0xae4fb6622f25f397587f11638da8ce88c27b5645', poolFromBlock: 119998935, vaultGraph: 'https://api.thegraph.com/subgraphs/name/premian-labs/premia-blue' }, +} + +Object.keys(config).forEach(chain => { + const { poolFactory, poolFromBlock, vaultGraph, } = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const logs = await getLogs({ + api, + target: poolFactory, + eventAbi: "event PoolDeployed(address indexed base, address indexed quote, address oracleAdapter, uint256 strike, uint256 maturity, bool isCallPool, address poolAddress)", + onlyArgs: true, + fromBlock: poolFromBlock, + }) + const ownerTokens = logs.map(log => [[log.base, log.quote], log.poolAddress]) + if (vaultGraph) { + const { vaults } = await cachedGraphQuery('premia/v3/vaults/'+api.chain, vaultGraph, getAddresses) + const vaultTokens = vaults.map(log => [[log.asset.address], log.address]) + ownerTokens.push(...vaultTokens) + } + return api.sumTokens({ ownerTokens }) + } + } +}) diff --git a/projects/premia/abi.json b/projects/premia/abi.json deleted file mode 100644 index 8f1380b83a4..00000000000 --- a/projects/premia/abi.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "tokens": "function tokens(uint256) view returns (address)", - "tokensLength": "uint256:tokensLength" -} \ No newline at end of file diff --git a/projects/premia/index.js b/projects/premia/index.js index 1af30cb2f19..62f79716723 100644 --- a/projects/premia/index.js +++ b/projects/premia/index.js @@ -1,160 +1,40 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const sdk = require("@defillama/sdk"); -const abi = require("./abi.json"); -const { sumTokens } = require("../helper/unwrapLPs"); -const { stakings } = require("../helper/staking"); -const { request, gql } = require("graphql-request"); -const { getBlock } = require("../helper/http"); -//const tvlV1 = require('./v1') - - -const PREMIA_OPTIONS_CONTRACT_ETH = - "0x5920cb60B1c62dC69467bf7c6EDFcFb3f98548c0"; -const PREMIA_OPTIONS_CONTRACT_BSC = - "0x8172aAC30046F74907a6b77ff7fC867A6aD214e4"; - -const erc20DAI = ADDRESSES.ethereum.DAI; -const erc20BUSD = ADDRESSES.bsc.BUSD; - -const calcTvl = async (balances, chain, block, premiaOptionsContract) => { - const erc20TokensLength = ( - await sdk.api.abi.call({ - abi: abi.tokensLength, - target: premiaOptionsContract, - block, - ...(chain == "bsc" && { chain }), - }) - ).output; - - for (let i = 0; i < erc20TokensLength; i++) { - const erc20Tokens = ( - await sdk.api.abi.call({ - abi: abi.tokens, - target: premiaOptionsContract, - params: i, - block, - ...(chain == "bsc" && { chain }), - }) - ).output; - - const erc20TokensBalance = ( - await sdk.api.erc20.balanceOf({ - target: erc20Tokens, - owner: premiaOptionsContract, - block, - ...(chain == "bsc" && { chain }), - }) - ).output; - - if (chain == "ethereum") { - sdk.util.sumSingleBalance(balances, `${erc20Tokens}`, erc20TokensBalance); - } else { - sdk.util.sumSingleBalance( - balances, - `bsc:${erc20Tokens}`, - erc20TokensBalance - ); - } - } -}; - -const ethTvl = async (timestamp, ethBlock, chainBlocks) => { - const balances = {}; - - await calcTvl(balances, "ethereum", ethBlock, PREMIA_OPTIONS_CONTRACT_ETH); - - const erc20DAIBalance = ( - await sdk.api.erc20.balanceOf({ - target: erc20DAI, - owner: PREMIA_OPTIONS_CONTRACT_ETH, - ethBlock, - }) - ).output; - sdk.util.sumSingleBalance(balances, erc20DAI, erc20DAIBalance); - - return balances; -}; - -const bscTvl = async (timestamp, ethBlock, chainBlocks) => { - const balances = {}; - - await calcTvl( - balances, - "bsc", - chainBlocks["bsc"], - PREMIA_OPTIONS_CONTRACT_BSC - ); - - const erc20BUSDBalance = ( - await sdk.api.erc20.balanceOf({ - target: erc20BUSD, - owner: PREMIA_OPTIONS_CONTRACT_BSC, - block: chainBlocks["bsc"], - chain: "bsc", - }) - ).output; - - sdk.util.sumSingleBalance(balances, `bsc:${erc20BUSD}`, erc20BUSDBalance); - - return balances; -}; +const { staking } = require('../helper/staking') +const { getLogs } = require('../helper/cache/getLogs') +const ADDRESSES = require('../helper/coreAssets.json') + +const config = { + ethereum: { factory: '0x4f273f4efa9ecf5dd245a338fad9fe0bab63b350', fromBlock: 13509301, optionsContract: '0x5920cb60B1c62dC69467bf7c6EDFcFb3f98548c0', optionsBaseToken: ADDRESSES.ethereum.DAI, }, + arbitrum: { factory: '0x89b36ce3491f2258793c7408bd46aac725973ba2', fromBlock: 3304690, }, + fantom: { factory: '0xD9e169e31394efccd78CC0b63a8B09B4D71b705E', fromBlock: 37104409, }, + optimism: { factory: '0x48D49466CB2EFbF05FaA5fa5E69f2984eDC8d1D7', fromBlock: 16597183, }, + bsc: { optionsContract: '0x8172aAC30046F74907a6b77ff7fC867A6aD214e4', optionsBaseToken: ADDRESSES.bsc.BUSD, }, +} -const getAddresses = gql` - query TokenPairs( - $block: Int - ) { - pools( - first: 100 - where: { optionType: CALL } - ) { - name - address - base { - address - symbol - } - underlying { - address - symbol +Object.keys(config).forEach(chain => { + const { factory, fromBlock, ownerTokens = [], optionsBaseToken, optionsContract, } = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + + if (factory) { + const logs = await getLogs({ + api, + target: factory, + eventAbi: 'event DeployPool (address indexed base, address indexed underlying, int128 indexed initialCLevel64x64, address baseOracle, address underlyingOracle, address pool)', + onlyArgs: true, + fromBlock, + }) + logs.forEach((v) => ownerTokens.push([[v.underlying, v.base], v.pool])) } - } - } -`; -const chainToSubgraph = { - ethereum: "https://api.thegraph.com/subgraphs/name/premiafinance/premiav2", - arbitrum: "https://api.thegraph.com/subgraphs/name/premiafinance/premia-arbitrum", - fantom: "https://api.thegraph.com/subgraphs/name/premiafinance/premia-fantom", - optimism: "https://api.thegraph.com/subgraphs/name/premiafinance/premia-optimism", -} + if (optionsContract) { + const tokens = await api.fetchList({ lengthAbi: "uint256:tokensLength", itemAbi: "function tokens(uint256) view returns (address)", target: optionsContract }) + if (optionsBaseToken) tokens.push(optionsBaseToken) + ownerTokens.push([tokens, optionsContract]) + } -function chainTvl(chain){ - return async (time, _ethBlock, chainBlocks)=>{ - const block = await getBlock(time, chain, chainBlocks, true) - const {pools} = await request(chainToSubgraph[chain], getAddresses, {block}) - const balances = {} - await sumTokens(balances, - pools.map(p=>[p.underlying.address, p.address]).concat(pools.map(p=>[p.base.address, p.address])), - block, chain, addr=>`${chain}:${addr}`) - return balances + return api.sumTokens({ ownerTokens }) + } } -} +}) -module.exports = { - ethereum: { - tvl: sdk.util.sumChainTvls([chainTvl("ethereum"), ethTvl]), - staking: stakings(["0x16f9d564df80376c61ac914205d3fdff7057d610", "0xF1bB87563A122211d40d393eBf1c633c330377F9"], "0x6399c842dd2be3de30bf99bc7d1bbf6fa3650e70") - }, - bsc: { - tvl: bscTvl, - }, - arbitrum:{ - tvl: chainTvl("arbitrum") - }, - fantom:{ - tvl: chainTvl("fantom") - }, - optimism: { - tvl: chainTvl("optimism") - } -}; +module.exports.ethereum.staking = staking(["0x16f9d564df80376c61ac914205d3fdff7057d610", "0xF1bB87563A122211d40d393eBf1c633c330377F9"], "0x6399c842dd2be3de30bf99bc7d1bbf6fa3650e70") \ No newline at end of file diff --git a/projects/premia/v1.js b/projects/premia/v1.js deleted file mode 100644 index d1d49afc5e3..00000000000 --- a/projects/premia/v1.js +++ /dev/null @@ -1,75 +0,0 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const { request, gql } = require("graphql-request"); -const sdk = require('@defillama/sdk') - -const Token = gql` - fragment Token on Token { - id - name - symbol - decimals - address - } -`; - -const TokenPair = gql` - ${Token} - fragment TokenPair on TokenPair { - id - name - token { - ...Token - } - denominator { - ...Token - } - strikePriceIncrement - openInterest - totalVolume - } -`; - -const getTokenPairs = gql` - ${TokenPair} - query TokenPairs( - $denominatorAddress: String! - $block: Int - $first: Int = 100 - $skip: Int = 0 - ) { - tokenPairs( - where: { denominator: $denominatorAddress } - block: { number: $block } - first: $first - skip: $skip - ) { - ...TokenPair - } - } -`; - -const graphUrls = { - ethereum: 'https://api.thegraph.com/subgraphs/name/premiafinance/premia', - bsc: 'https://api.thegraph.com/subgraphs/name/premiafinance/premia-bsc', -}; -const denominators = { - ethereum: ADDRESSES.ethereum.DAI, //DAI - bsc: ADDRESSES.bsc.BUSD, //BUSD -} - -module.exports = function v1Tvl(chain) { - return async function tvl(time, ethBlock, chainBlocks) { - const block = chainBlocks[chain] - const denominatorAddress = denominators[chain] - const { tokenPairs } = await request(graphUrls[chain], getTokenPairs, { - denominatorAddress, - block - }); - - const balances = {} - tokenPairs.forEach(pair => { - sdk.util.sumSingleBalance(balances, chain + ':' + denominatorAddress, pair.openInterest) - }) - return balances - } -} \ No newline at end of file From 05d359255adb7fec2e97cda647da46cc6f0d01dc Mon Sep 17 00:00:00 2001 From: Hodlify <137034650+hodlifyio@users.noreply.github.com> Date: Thu, 7 Sep 2023 16:15:25 +0800 Subject: [PATCH 1130/1974] Add Hodlify adapter (#7401) * add Hodlify adapter * code refactor --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/hodlify/abi.js | 19 ++++++++++++++ projects/hodlify/constants.js | 36 +++++++++++++++++++++++++++ projects/hodlify/helper.js | 47 +++++++++++++++++++++++++++++++++++ projects/hodlify/index.js | 37 +++++++++++++++++++++++++++ 4 files changed, 139 insertions(+) create mode 100644 projects/hodlify/abi.js create mode 100644 projects/hodlify/constants.js create mode 100644 projects/hodlify/helper.js create mode 100644 projects/hodlify/index.js diff --git a/projects/hodlify/abi.js b/projects/hodlify/abi.js new file mode 100644 index 00000000000..6fc4d4ee0fa --- /dev/null +++ b/projects/hodlify/abi.js @@ -0,0 +1,19 @@ +const erc4626Abi = { + 'asset': 'function asset() external view returns (address)', + 'totalAssets': 'function totalAssets() public view returns (uint256)' +} + +const stargateLpStakingAbi = { + 'userInfo': 'function userInfo( uint256 ,address ) external view returns (uint256 amount, uint256 rewardDebt)', +} + +const stargatePoolAbi = { + 'amountLPtoLD': 'function amountLPtoLD(uint256 _amountLP) external view returns (uint256)', + 'token': 'function token() external view returns (address)', +} + +module.exports = { + erc4626Abi, + stargateLpStakingAbi, + stargatePoolAbi, +} \ No newline at end of file diff --git a/projects/hodlify/constants.js b/projects/hodlify/constants.js new file mode 100644 index 00000000000..7aa31785c6d --- /dev/null +++ b/projects/hodlify/constants.js @@ -0,0 +1,36 @@ +const contracts = { + optimism: { + vaults: [ + '0x034A4072E63aB05aF057e4E9aFC961EA584fB886', // entry + '0xcf038417eac3bEa4be8f296B0Ed994e8410B6eBC', // polygon satellite + '0x81C3b05753A40f7dd93F154eDC4112AF2F3B5B3b', // arbitrum satellite + ], + strategies: [ + '0xe6ab63FbDFec016357da536201139cCf5b6c1059', + ], + }, + polygon: { + vaults: [ + '0xFABea2117d95b780077ca8dDf268BcC8c29589ED', // entry + '0x98266478600d4Cae5082d2A185cc6533684dA108', // arbitrum satellite + '0x4a307418cEd78A3f2348FD84e66453Efe0BDD16a', // optimisim satellite + ], + strategies: [ + '0x283D67CAAFc1AA4A2D54c62Be0A44EdFb8099099', + ], + }, + arbitrum: { + vaults: [ + '0x98fCBbfb97B61e2DA167A69345c58e4126A5167B', // entry + '0x801E78C94d5fffDD6F37684ad5ac68EF3b15E559', // polygon satellite + '0x680924B3B81d918B01D43E80C092CF75C6063681', // optimisim satellite + ], + strategies: [ + '0x0Dba32cFaE7C7edf59603f1BC450DC15E0f46Ddf', + ] + }, +} + +module.exports = { + contracts, +} \ No newline at end of file diff --git a/projects/hodlify/helper.js b/projects/hodlify/helper.js new file mode 100644 index 00000000000..e1d485ea4b4 --- /dev/null +++ b/projects/hodlify/helper.js @@ -0,0 +1,47 @@ +const { erc4626Abi, stargateLpStakingAbi, stargatePoolAbi } = require('./abi'); + +// convert stargate lp amount to underlying asset amount +const getStrategyVaultValues = async (api, vaultAddresses) => { + // find the lpStaking contract address for each vault + const lpStakingAddresses = await api.multiCall({ calls: vaultAddresses, abi: 'address:lpStaking', }); + // find the lpStaking poolId for each vault + const lpStakingPoolIds = await api.multiCall({ calls: vaultAddresses, abi: 'uint256:lpStakingPoolId', }); + // find the lp staking pool of each vault + const lpPools = await api.multiCall({ calls: vaultAddresses, abi: 'address:lp', }); + // find the lpAmount + const lpAmounts = (await api.multiCall({ + calls: vaultAddresses.map((vaultAddress, i) => ({ + target: lpStakingAddresses[i], + params: [lpStakingPoolIds[i], vaultAddress], + })), + abi: stargateLpStakingAbi.userInfo, + })).map(([amount]) => amount); + // find the amount of assets convert from lpAmount + const convertedAmounts = await api.multiCall({ + calls: lpPools.map((lpPool, i) => ({ + target: lpPool, + params: [lpAmounts[i]], + })), + abi: stargatePoolAbi.amountLPtoLD, + }); + // find the underlying asset of each lp pool + const assets = await api.multiCall({ calls: lpPools, abi: stargatePoolAbi.token, }); + + return [assets, convertedAmounts]; +} + +// get the underlying asset of each base vault +const getVaultToken = async (api, addresses) => { + return api.multiCall({ calls: addresses, abi: 'address:token', }); +} + +// get the underlying asset of each erc4626 vault +const get4626VaultToken = async (api, addresses) => { + return api.multiCall({ calls: addresses, abi: erc4626Abi.asset, }); +} + +module.exports = { + getVaultToken, + get4626VaultToken, + getStrategyVaultValues, +} \ No newline at end of file diff --git a/projects/hodlify/index.js b/projects/hodlify/index.js new file mode 100644 index 00000000000..9cd256977cc --- /dev/null +++ b/projects/hodlify/index.js @@ -0,0 +1,37 @@ +const { contracts } = require("./constants"); +const { get4626VaultToken, getStrategyVaultValues, getVaultToken } = require("./helper"); + +/** find balance of vault's underlying assets (excl. lp & positions) */ +const getUnderlyingTokenBalance = async (api, vaultAddresses) => { + const vaultTokens = await getVaultToken(api, vaultAddresses); + return api.sumTokens({ tokensAndOwners2: [vaultTokens, vaultAddresses]}) +} + +// find the strategy's vault's lp value +const getStrategyVaultsLpValue = async (api, vaultAddresses) => { + const vaultTokens = await get4626VaultToken(api, vaultAddresses); + await api.sumTokens({ tokensAndOwners2: [vaultTokens, vaultAddresses]}) + const [tokens, balances] = await getStrategyVaultValues(api, vaultAddresses); + api.addTokens(tokens, balances); +} + +const aggregateVaultTvl = async (api) => { + const { vaults, strategies } = contracts[api.chain]; + await getUnderlyingTokenBalance(api, vaults); + await getStrategyVaultsLpValue(api, strategies); +} + +const tvl = async (_, _1, _2, { api }) => { + await aggregateVaultTvl(api); + return api.getBalances(); +} + + +module.exports = { + doublecounted: true, + start: 1693929600, // Tue Sep 05 2023 16:00:00 GMT+0000 + methodology: 'Hodlify TVL including total values of assets deposited in other protocols, and the petty cash in our earning vaults.', + arbitrum: { tvl}, + optimism: { tvl}, + polygon: { tvl}, +} \ No newline at end of file From 70ca1f26bcfe06d77aa59cad371c8dc55f92f942 Mon Sep 17 00:00:00 2001 From: zackFR0820 <142714808+zackFR0820@users.noreply.github.com> Date: Thu, 7 Sep 2023 16:17:26 +0800 Subject: [PATCH 1131/1974] add friendroom projects (#7397) --- projects/friendroom/index.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 projects/friendroom/index.js diff --git a/projects/friendroom/index.js b/projects/friendroom/index.js new file mode 100644 index 00000000000..9b2dce9a616 --- /dev/null +++ b/projects/friendroom/index.js @@ -0,0 +1,14 @@ +const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') + +const contract = "0x9BD0474CC4F118efe56f9f781AA8f0F03D4e7A9c" + +async function tvl(time, ethBlock, _b, {api}) { + return sumTokens2({ tokens: [nullAddress], owner: contract, api }) +} + +module.exports = { + methodology: `We count the ETH on ${contract}`, + ethereum: { + tvl + } +} From ccdf4d75841f136ab83249cc49c550ec5af07df5 Mon Sep 17 00:00:00 2001 From: Chewyswap <142753298+ChewySwap@users.noreply.github.com> Date: Thu, 7 Sep 2023 04:22:21 -0400 Subject: [PATCH 1132/1974] Add ChewySwap (#7399) --- projects/ChewySwap/index.js | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 projects/ChewySwap/index.js diff --git a/projects/ChewySwap/index.js b/projects/ChewySwap/index.js new file mode 100644 index 00000000000..bd8f52cec89 --- /dev/null +++ b/projects/ChewySwap/index.js @@ -0,0 +1,3 @@ +const { uniTvlExport } = require('../helper/unknownTokens') + +module.exports = uniTvlExport('shibarium', '0xEDedDbde5ffA62545eDF97054edC11013ED72125', { fetchBalances: true, }) From ea110f61b53259d724ac11cf7c6b426696ac327d Mon Sep 17 00:00:00 2001 From: BroSwap <129387625+broswap@users.noreply.github.com> Date: Thu, 7 Sep 2023 01:23:50 -0700 Subject: [PATCH 1133/1974] Create index.js (#7396) --- projects/BroSwap/index.js | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 projects/BroSwap/index.js diff --git a/projects/BroSwap/index.js b/projects/BroSwap/index.js new file mode 100644 index 00000000000..d2d87c88ecd --- /dev/null +++ b/projects/BroSwap/index.js @@ -0,0 +1,8 @@ +const { getUniTVL, } = require('../helper/unknownTokens') + +module.exports = { + misrepresentedTokens: true, + core: { + tvl: getUniTVL({ factory: '0x8edF7B8411b2e5dB740dbbf949E011e59fc7980a', useDefaultCoreAssets: true, fetchBalances: true, }), + }, +}; From 360615cc0e5258a64fecd836fea9f3d79388c083 Mon Sep 17 00:00:00 2001 From: kavsky02 <95619352+kavsky02@users.noreply.github.com> Date: Thu, 7 Sep 2023 10:39:23 +0200 Subject: [PATCH 1134/1974] Add Arbitrum Pools (#7398) --- projects/deltaprime/index.js | 61 +++++++++++++++---- .../assetToAddressMappingArbitrum.json | 23 +++++++ ...on => assetToAddressMappingAvalanche.json} | 0 3 files changed, 73 insertions(+), 11 deletions(-) create mode 100644 projects/deltaprime/mappings/assetToAddressMappingArbitrum.json rename projects/deltaprime/mappings/{assetToAddressMapping.json => assetToAddressMappingAvalanche.json} (100%) diff --git a/projects/deltaprime/index.js b/projects/deltaprime/index.js index a2c4340a028..37bf010940a 100644 --- a/projects/deltaprime/index.js +++ b/projects/deltaprime/index.js @@ -10,32 +10,40 @@ const getAllOwnedAssetsAbi = require('./abis/getAllOwnedAssetsAbi.json'); const getPoolHelperAbi = "function getPoolInfo(address _address) view returns (tuple(uint256 pid, bool isActive, address token, address lp, uint256 sizeLp, address receipt, uint256 size, address rewards_addr, address helper))" const getStakingPositionsAbi = "function getStakedPositions() view returns (tuple(address asset, bytes32 symbol, bytes32 identifier, bytes4 balanceSelector, bytes4 unstakeSelector)[])" -const assetToAddressMapping = require('./mappings/assetToAddressMapping.json') +const assetToAddressMappingAvalanche = require('./mappings/assetToAddressMappingAvalanche.json') +const assetToAddressMappingArbitrum = require('./mappings/assetToAddressMappingArbitrum.json') +// Avalanche const USDC_POOL_TUP_CONTRACT = '0x2323dAC85C6Ab9bd6a8B5Fb75B0581E31232d12b'; const USDT_POOL_TUP_CONTRACT = '0xd222e10D7Fe6B7f9608F14A8B5Cf703c74eFBcA1'; const WAVAX_POOL_TUP_CONTRACT = '0xD26E504fc642B96751fD55D3E68AF295806542f5'; const BTC_POOL_TUP_CONTRACT = '0x475589b0Ed87591A893Df42EC6076d2499bB63d0'; const ETH_POOL_TUP_CONTRACT = '0xD7fEB276ba254cD9b34804A986CE9a8C3E359148'; -const SMART_LOANS_FACTORY_TUP = '0x3Ea9D480295A73fd2aF95b4D96c2afF88b21B03D'; +const SMART_LOANS_FACTORY_TUP_AVALANCHE = '0x3Ea9D480295A73fd2aF95b4D96c2afF88b21B03D'; const VF_MAINSTAKING_CONTRACT = "0x8B3d9F0017FA369cD8C164D0Cc078bf4cA588aE5"; -async function tvl(timestamp, block, chainBlocks, { api }) { +// Arbitrum +const USDC_POOL_TUP_ARBI_CONTRACT = '0x8FE3842e0B7472a57f2A2D56cF6bCe08517A1De0'; +const ETH_POOL_TUP_ARBI_CONTRACT = '0x0BeBEB5679115f143772CfD97359BBcc393d46b3'; + +const SMART_LOANS_FACTORY_TUP_ARBITRUM = '0xFf5e3dDaefF411a1dC6CcE00014e4Bca39265c20'; + +async function tvlAvalanche(timestamp, block, chainBlocks, { api }) { const logs = await getLogs({ api, - target: SMART_LOANS_FACTORY_TUP, + target: SMART_LOANS_FACTORY_TUP_AVALANCHE, topics: ['0x3c5330cb261eae74426865a348927ace59eae441485c71a110df598f825b6369'], fromBlock: 23431194, }) sdk.log('#accounts', logs.length) const tokensAndOwners = [ - [assetToAddressMapping.USDC, USDC_POOL_TUP_CONTRACT], - [assetToAddressMapping.USDT, USDT_POOL_TUP_CONTRACT], - [assetToAddressMapping.AVAX, WAVAX_POOL_TUP_CONTRACT], - [assetToAddressMapping.BTC, BTC_POOL_TUP_CONTRACT], - [assetToAddressMapping.ETH, ETH_POOL_TUP_CONTRACT], + [assetToAddressMappingAvalanche.USDC, USDC_POOL_TUP_CONTRACT], + [assetToAddressMappingAvalanche.USDT, USDT_POOL_TUP_CONTRACT], + [assetToAddressMappingAvalanche.AVAX, WAVAX_POOL_TUP_CONTRACT], + [assetToAddressMappingAvalanche.BTC, BTC_POOL_TUP_CONTRACT], + [assetToAddressMappingAvalanche.ETH, ETH_POOL_TUP_CONTRACT], ] const accounts = logs.map(i => `0x${i.topics[1].slice(26)}`) @@ -46,7 +54,7 @@ async function tvl(timestamp, block, chainBlocks, { api }) { accounts.forEach((o, i) => { ownedAssets[i].forEach(tokenStr => { tokenStr = ethers.utils.parseBytes32String(tokenStr) - const token = assetToAddressMapping[tokenStr] + const token = assetToAddressMappingAvalanche[tokenStr] if (!token) throw new Error('Missing asset mapping for: ' + tokenStr) tokensAndOwners.push([token, o]) }) @@ -68,6 +76,34 @@ async function tvl(timestamp, block, chainBlocks, { api }) { return balances; } +async function tvlArbitrum(timestamp, block, chainBlocks, { api }) { + const logs = await getLogs({ + api, + target: SMART_LOANS_FACTORY_TUP_ARBITRUM, + topics: ['0x3c5330cb261eae74426865a348927ace59eae441485c71a110df598f825b6369'], + fromBlock: 119102502, + }) + sdk.log('#accounts', logs.length) + + const tokensAndOwners = [ + [assetToAddressMappingArbitrum.USDC, USDC_POOL_TUP_ARBI_CONTRACT], + [assetToAddressMappingArbitrum.ETH, ETH_POOL_TUP_ARBI_CONTRACT], + ] + + const accounts = logs.map(i => `0x${i.topics[1].slice(26)}`) + const ownedAssets = await api.multiCall({ abi: getAllOwnedAssetsAbi, calls: accounts }) + accounts.forEach((o, i) => { + ownedAssets[i].forEach(tokenStr => { + tokenStr = ethers.utils.parseBytes32String(tokenStr) + const token = assetToAddressMappingArbitrum[tokenStr] + if (!token) throw new Error('Missing asset mapping for: ' + tokenStr) + tokensAndOwners.push([token, o]) + }) + }) + + return await sumTokens2({ api, tokensAndOwners: tokensAndOwners }); +} + function translatePlatypusLPToBaseToken(token){ // Platypus USDC Asset (LP-USDC) -> USDC if(token === "0x06f01502327de1c37076bea4689a7e44279155e9"){ @@ -124,6 +160,9 @@ module.exports = { start: 24753316, avax: { - tvl, + tvl: tvlAvalanche, + }, + arbitrum: { + tvl: tvlArbitrum, } } diff --git a/projects/deltaprime/mappings/assetToAddressMappingArbitrum.json b/projects/deltaprime/mappings/assetToAddressMappingArbitrum.json new file mode 100644 index 00000000000..f39cde36cf7 --- /dev/null +++ b/projects/deltaprime/mappings/assetToAddressMappingArbitrum.json @@ -0,0 +1,23 @@ +{ + "ETH": "0x82af49447d8a07e3bd95bd0d56f35241523fbab1", + "USDC": "0xaf88d065e77c8cc2239327c5edb3a432268e5831", + "USDC.e": "0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8", + "ARB": "0x912CE59144191C1204E64559FE8253a0e49E6548", + "USDT": "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9", + "DPX": "0x6C2C06790b3E3E3c38e12Ee22F8183b37a13EE55", + "GMX": "0xfc5A1A6EB076a2C7aD06eD22C90d7E710E35ad0a", + "BTC": "0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f", + "DAI": "0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1", + "LINK": "0xf97f4df75117a78c1A5a0DBb814Af92458539FB4", + "UNI": "0xFa7F8980b0f1E64A2062791cc3b0871572f1F7f0", + "FRAX": "0x17FC002b466eEc40DaE837Fc4bE5c67993ddBd6F", + "GLP": "0x5402B5F40310bDED796c7D0F3FF6683f5C0cFfdf", + "wstETH": "0x5979D7b546E38E414F7E9822514be443A4800529", + "YY_WOMBEX_USDT": "0x8Bc6968b7A9Eed1DD0A259eFa85dc2325B923dd2", + "YY_WOMBEX_USDC.e": "0x4649c7c3316B27C4A3DB5f3B47f87C687776Eb8C", + "YY_WOMBEX_GLP": "0x28f37fa106AA2159c91C769f7AE415952D28b6ac", + "YY_WOMBEX_DAI": "0x1817fE376740b53CAe73224B7F0a57F23DD4C9b5", + "SUSHI_DPX_ETH_LP": "0x0C1Cf6883efA1B496B01f654E247B9b419873054", + "MOO_SUSHI_DPX_ETH_LP": "0x4D323f77c32EDdC62BF8eAbA11E5C573FD0a2ccd", + "MOO_GMX": "0x5B904f19fb9ccf493b623e5c8cE91603665788b0" +} \ No newline at end of file diff --git a/projects/deltaprime/mappings/assetToAddressMapping.json b/projects/deltaprime/mappings/assetToAddressMappingAvalanche.json similarity index 100% rename from projects/deltaprime/mappings/assetToAddressMapping.json rename to projects/deltaprime/mappings/assetToAddressMappingAvalanche.json From 5f9a650574bae7e62577d25a28064a9e62f31925 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 7 Sep 2023 13:06:34 +0200 Subject: [PATCH 1135/1974] refactor axelar --- projects/alexar/index.js | 108 ++++++++++---------------------- projects/helper/chain/cosmos.js | 4 +- projects/helper/tokenMapping.js | 21 +++---- projects/ktx/index.js | 3 + 4 files changed, 48 insertions(+), 88 deletions(-) diff --git a/projects/alexar/index.js b/projects/alexar/index.js index f07123db2c6..df86225ecd8 100644 --- a/projects/alexar/index.js +++ b/projects/alexar/index.js @@ -1,86 +1,42 @@ -const { get } = require('../helper/http'); +const { getConfig } = require('../helper/cache') +const { sumTokens } = require('../helper/sumTokens') + const blacklistedAssets = ['uaxl']; const chainMapping = { - avax: 'avalanche', - cosmos: 'cosmoshub', - terra2: 'terra-2', - bsc: 'binance' - }; + avax: 'avalanche', + cosmos: 'cosmoshub', + terra2: 'terra-2', + bsc: 'binance' +}; - const assetChainMap = { - 'uusdc': 'ethereum', - 'weth-wei': 'ethereum', - 'wbtc-satoshi': 'ethereum', - 'dai-wei': 'ethereum', - 'uusdt': 'ethereum', - 'wbnb-wei': 'binance', - 'dot-planck': 'moonbeam', - 'wmatic-wei': 'polygon', - 'uluna': 'terra', - 'wavax-wei': 'avalanche', - 'uusd': 'terra', - 'wftm-wei': 'fantom', - 'busd-wei': 'ethereum', - 'uatom': 'cosmoshub', - 'link-wei': 'ethereum', - 'polygon-uusdc': 'polygon', - 'mkr-wei': 'ethereum', - 'frax-wei': 'ethereum', - 'eth-wei': 'ethereum', - 'shib-wei': 'ethereum', - 'wglmr-wei': 'moonbeam', - 'stuatom': 'stride', - 'steth-wei': 'ethereum', - 'aave-wei': 'ethereum', - 'uni-wei': 'ethereum', - 'ustrd': 'stride', - 'rai-wei': 'ethereum', - 'ape-wei': 'ethereum', - 'ujuno': 'juno' - } +const chainListSupply = ['juno', 'cosmos', 'comdex', 'carbon', 'crescent', 'injective', 'kujira', 'osmosis', 'persistence', 'stargaze', 'secret', 'stargaze', 'umee', 'evmos', 'terra2']; +const chainListTotal = ['avax', 'bsc', 'moonbeam', 'polygon', 'fantom', 'arbitrum', 'aurora', 'celo', 'kava', 'mantle', 'ethereum',]; -const chainListSupply = ['juno', 'cosmos', 'comdex', 'carbon', 'crescent', 'injective', 'kujira', 'osmosis', -'persistence', 'stargaze', 'secret', 'stargaze', 'umee', 'evmos', 'terra2']; -const chainListTotal = [ 'avax', 'bsc', 'moonbeam', 'polygon', 'fantom', 'arbitrum', 'aurora', 'celo', 'kava', -]; - async function getTVL(chain) { - const { data } = await get('https://api.axelarscan.io/cross-chain/tvl'); +chainListSupply.concat(chainListTotal).forEach(chain => { + module.exports[chain] = { tvl }; + async function tvl(_, _b, _cb, { api, }) { + const config = await getConfig('alexar', 'https://api.axelarscan.io/cross-chain/tvl') + const tokensAndOwners = [] + const owners = [] const mappedChain = chainMapping[chain] || chain; - - return data.reduce((tvl, asset) => { - // Skip the asset if it is on the blacklisted chain specified in the assetChainMap - if (assetChainMap[asset.asset] === mappedChain) return tvl; - if (blacklistedAssets.includes(asset.asset)) return tvl; - const chainData = asset.tvl[mappedChain]; - if (!chainData) return tvl; - - let assetAmount; - - if (chainListSupply.includes(chain)) { - assetAmount = chainData.supply; - } else if (chainListTotal.includes(chain)) { - assetAmount = chainData.total; + config.data.forEach(({ tvl: { [mappedChain]: assetTvl } = {} }) => { + if (!assetTvl) return; + + const isEVM = assetTvl.gateway_address?.startsWith('0x') + if (isEVM) { + if (assetTvl.contract_data.symbol.startsWith('axl')) return; + tokensAndOwners.push([assetTvl.contract_data.address, assetTvl.gateway_address]) } else { - return tvl; + if (assetTvl.denom_data.symbol.startsWith('axl')) return; + owners.push(...assetTvl.source_escrow_addresses) } - - const assetPrice = asset.price; - - // Check if both assetAmount and assetPrice are numbers - if (isNaN(assetAmount) || isNaN(assetPrice)) return tvl; - - return tvl + (assetAmount * assetPrice); - }, 0); + }) + if (tokensAndOwners.length > 0) + return api.sumTokens({ tokensAndOwners }) + return sumTokens({ chain, owners }) } - - const exportObj = {}; - - chainListSupply.concat(chainListTotal).forEach(chain => { - exportObj[chain] = { tvl: () => getTVL(chain).then(tether => ({ tether })) }; - }); - - module.exports = exportObj; - module.exports.misrepresentedTokens = true; - module.exports.timetravel = false; \ No newline at end of file +}); + +module.exports.timetravel = false; \ No newline at end of file diff --git a/projects/helper/chain/cosmos.js b/projects/helper/chain/cosmos.js index a521744dff5..16a8b1ac03b 100644 --- a/projects/helper/chain/cosmos.js +++ b/projects/helper/chain/cosmos.js @@ -24,6 +24,8 @@ const endPoints = { chihuahua: "https://rest.cosmos.directory/chihuahua", stargaze: "https://api-stargaze.ezstaking.dev", quicksilver: "https://rest.cosmos.directory/quicksilver", + persistence: "https://rest.cosmos.directory/persistence", + secret: "https://lcd.secret.express", // chihuahua: "https://api.chihuahua.wtf", injective: "https://lcd-injective.whispernode.com:443", migaloo: "https://migaloo-api.polkachu.com", @@ -131,7 +133,7 @@ async function getDenomBalance({ denom, owner, block, chain } = {}) { } async function getBalance2({ balances = {}, owner, block, chain, tokens, blacklistedTokens, } = {}) { - const subpath = chainSubpaths[chain] || "cosmos"; + const subpath = "cosmos"; let endpoint = `${getEndpoint( chain )}/${subpath}/bank/v1beta1/balances/${owner}?pagination.limit=1000`; diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index d801345096f..792cbc414b6 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -16,7 +16,7 @@ coreAssets = JSON.parse(JSON.stringify(coreAssets)) // carbon: https://api-insights.carbon.network/info/denom_gecko_map // orbit brige: https://bridge.orbitchain.io/open/v1/api/monitor/rawTokenList -const ibcChains = ['ibc', 'terra', 'terra2', 'crescent', 'osmosis', 'kujira', 'stargaze', 'juno', 'injective', 'cosmos', 'comdex', 'umee', 'orai', 'persistence', 'fxcore', 'neutron', 'quasar', 'chihuahua', 'sei', 'archway', 'migaloo', 'secret', ] +const ibcChains = ['ibc', 'terra', 'terra2', 'crescent', 'osmosis', 'kujira', 'stargaze', 'juno', 'injective', 'cosmos', 'comdex', 'umee', 'orai', 'persistence', 'fxcore', 'neutron', 'quasar', 'chihuahua', 'sei', 'archway', 'migaloo', 'secret',] const caseSensitiveChains = [...ibcChains, 'solana', 'tezos', 'ton', 'algorand', 'aptos', 'near', 'bitcoin', 'waves', 'tron', 'litecoin', 'polkadot', 'ripple', 'elrond', 'cardano', 'stacks', 'sui', 'ergo', 'mvc',] const distressedAssts = new Set(Object.values({ @@ -32,7 +32,7 @@ const transformTokens = { '0xe0b469cb3eda0ece9e425cfeda4df986a55ea9f8': ADDRESSES.ethereum.WETH, [ADDRESSES.ethereum.vlCVX]: ADDRESSES.ethereum.CVX, }, - + // Sample Code // cronos: { // "0x065de42e28e42d90c2052a1b49e7f83806af0e1f": "0x123", // CRK token is mispriced @@ -59,16 +59,15 @@ const fixBalancesTokens = { dsc: { ['0x1c5d8992da64c8d56ea413dd6f723061c29a7c0b']: { coingeckoId: "decimal", decimals: 18 }, }, - aura: { - 'uaura': { coingeckoId: 'aura-network', decimals: 6 }, - }, + aura: { 'uaura': { coingeckoId: 'aura-network', decimals: 6 }, }, + secret: { 'uscrt': { coingeckoId: 'secret', decimals: 6 }, }, shibarium: { - '0x8ed7d143ef452316ab1123d28ab302dc3b80d3ce': { coingeckoId: "ethereum", decimals: 18 }, - '0xc76f4c819d820369fb2d7c1531ab3bb18e6fe8d8': { coingeckoId: "bone-shibaswap", decimals: 18 }, - '0x213c25900f365f1be338df478cd82bef7fd43f85': { coingeckoId: "bone-shibaswap", decimals: 18 }, - '0x6c19a35875217b134e963ca9e61b005b855cad21': { coingeckoId: "bone-shibaswap", decimals: 18 }, - '0x1b2f364032f12bd8a4c89e672e6272de03ae2680': { coingeckoId: "bone-shibaswap", decimals: 18 }, - '0xa2899c776baaf9925d432f83c950d5054a6cf59c': { coingeckoId: "bone-shibaswap", decimals: 18 }, + '0x8ed7d143ef452316ab1123d28ab302dc3b80d3ce': { coingeckoId: "ethereum", decimals: 18 }, + '0xc76f4c819d820369fb2d7c1531ab3bb18e6fe8d8': { coingeckoId: "bone-shibaswap", decimals: 18 }, + '0x213c25900f365f1be338df478cd82bef7fd43f85': { coingeckoId: "bone-shibaswap", decimals: 18 }, + '0x6c19a35875217b134e963ca9e61b005b855cad21': { coingeckoId: "bone-shibaswap", decimals: 18 }, + '0x1b2f364032f12bd8a4c89e672e6272de03ae2680': { coingeckoId: "bone-shibaswap", decimals: 18 }, + '0xa2899c776baaf9925d432f83c950d5054a6cf59c': { coingeckoId: "bone-shibaswap", decimals: 18 }, }, arbitrum: { '0x1509706a6c66CA549ff0cB464de88231DDBe213B': { coingeckoId: 'aura-finance', decimals: 18 } diff --git a/projects/ktx/index.js b/projects/ktx/index.js index e145a2d40e8..aa819434979 100644 --- a/projects/ktx/index.js +++ b/projects/ktx/index.js @@ -10,4 +10,7 @@ module.exports = { staking: staking(bscStaking, bscKTC, "bsc"), tvl: gmxExports({ vault: bscVault }), }, + mantle: { + tvl: gmxExports({ vault: '0x2e488D7ED78171793FA91fAd5352Be423A50Dae1' }), + } }; From bd7f2f0cd423a2b19b970299c5da37472d71f35b Mon Sep 17 00:00:00 2001 From: define Date: Thu, 7 Sep 2023 12:21:47 +0100 Subject: [PATCH 1136/1974] refresh binance wallets --- projects/binance/config.js | 733 +++++++++++++++++++++---------------- 1 file changed, 419 insertions(+), 314 deletions(-) diff --git a/projects/binance/config.js b/projects/binance/config.js index c7a58a90adc..bb174546739 100644 --- a/projects/binance/config.js +++ b/projects/binance/config.js @@ -4,383 +4,488 @@ const { getUniqueAddresses } = require('../helper/utils') // taken from https://www.binance.com/en/blog/community/our-commitment-to-transparency-2895840147147652626 const assetList = [ - ["BTC", "BTC", "34xp4vRoCGJym3xR7yCVPFHoCNxv4Twseo"], - //["BTC", "BTC", "3LYJfcfHPXYJreMsASk2jkn69LWEYKzexb"], - ["BTC", "BTC", "3M219KR5vEneNb47ewrPfWyb5jQ2DjxRP6"], - ["BTC", "BTC", "3LcgLHzTvjLKBixBvkKGiadtiw2GBSKKqH"], - ["BTC", "BTC", "3JJmF63ifcamPLiAmLgG96RA599yNtY3EQ"], - ["BTC", "BTC", "3HdGoUTbcztBnS7UzY4vSPYhwr424CiWAA"], - ["BTC", "BTC", "395vnFScKQ1ay695C6v7gf89UzoFpx3WuJ"], - //["BTC", "BTC", "3FrmCRcGKiTATfreBDM9F17yAUDoDsnWeA"], - ["BTC", "BTC", "3FHNBLobJnbCTFTVakh5TXmEneyf5PT61B"], - ["BTC", "BTC", "3LQUu4v9z6KNch71j7kbj8GPeAGUo1FW6a"], - ["BTC", "BTC", "3AeUiDpPPUrUBS377584sFCpx8KLfpX9Ry"], - ["BTC", "BTC", "3JFJPpH8Chwo7CDbyYQ4XcfgcjEP1FGRMJ"], - ["BTC", "BTC", "34HpHYiyQwg69gFmCq2BGHjF1DZnZnBeBP"], - ["BTC", "BTC", "bc1qm34lsc65zpw79lxes69zkqmk6ee3ewf0j77s3h"], - ["BTC", "BTC", "38Xnrq8MZiKmYmwobbYdZQ5nnCbX1qvQfE"], // added again on 07/08/2023 - ["BTC", "BTC", "34GUzCVLbdkMQ2UdVTaA4nxPwoovVS7y2J"], // add on 07/08/2023 - ["BTC", "BTC", "3AtnehKDkFPC1bKvdrEVPSRGCtxQH8F1R8"], // add on 07/08/2023 - ["BTC", "BTC", "3CySuFKbBS29M7rE5iJakZRNqb3msMeFoN"], // add on 07/08/2023 - ["BTC", "BTC", "3Me9QACjioepv2L2oKTC9QQ87NH6vFe1Zj"], // add on 07/08/2023 - ["BTC", "BTC", "3NXCvmLGz9SxYi6TnjbBQfQMcwiZ1iQETa"], // add on 07/08/2023 - ["BTC", "BTC", "3EbJfpmFgufYtzW9UFvf1GAfm2ted1Rwnr"], - ["BTC", "BTC", "38DN2uFMZPiHLHJigfv4kWC9JWJrNnhLcn"], - ["BTC", "BTC", "3Qxak1CZhLyZ7GVckKphLURdLBCjMfz9bA"], - ["BTC", "BTC", "36zSLdRv1jyewjaC12fqK5fptn7PqewunL"], - ["ETH", "ETH", "0xbe0eb53f46cd790cd13851d5eff43d12404d33e8"], - ["ETH", "ETH", "0xf977814e90da44bfa03b6295a0616a897441acec"], - ["ETH", "ETH", "0x5a52e96bacdabb82fd05763e25335261b270efcb"], - ["ETH", "ETH", "0x28c6c06298d514db089934071355e5743bf21d60"], - ["ETH", "ETH", "0x9696f59e4d72e237be84ffd425dcad154bf96976"], - ["ETH", "ETH", "0x21a31ee1afc51d94c2efccaa2092ad1028285549"], - ["ETH", "ETH", "0xdfd5293d8e347dfe59e90efd55b2956a1343963d"], - ["ETH", "ETH", "0x56eddb7aa87536c09ccc2793473599fd21a8b17f"], - ["ETH", "ETH", "0x4976a4a02f38326660d17bf34b431dc6e2eb2327"], - // ["USDC", "ETH", "0xa344c7aDA83113B3B56941F6e85bf2Eb425949f3"], - ["USDC", "ETH", "0x28c6c06298d514db089934071355e5743bf21d60"], - ["USDC", "ETH", "0x21a31ee1afc51d94c2efccaa2092ad1028285549"], - ["USDC", "ETH", "0xdfd5293d8e347dfe59e90efd55b2956a1343963d"], - ["USDC", "TRX", "TV6MuMXfmLbBqPZvBHdwFsDnQeVfnmiuSi"], - // ["USDT", "ETH", "0x47ac0Fb4F2D84898e4D9E7b4DaB3C24507a6D503"], - ["USDT", "ETH", "0xf977814e90da44bfa03b6295a0616a897441acec"], - // ["USDT", "ETH", "0xa344c7aDA83113B3B56941F6e85bf2Eb425949f3"], - ["USDT", "ETH", "0x28c6c06298d514db089934071355e5743bf21d60"], - ["USDT", "ETH", "0x21a31ee1afc51d94c2efccaa2092ad1028285549"], - ["USDT", "ETH", "0x56eddb7aa87536c09ccc2793473599fd21a8b17f"], - ["USDT", "ETH", "0xdfd5293d8e347dfe59e90efd55b2956a1343963d"], - ["USDT", "ETH", "0x9696f59e4d72e237be84ffd425dcad154bf96976"], - ["USDT", "ETH", "0x4976a4a02f38326660d17bf34b431dc6e2eb2327"], - ["USDT", "ETH", "0xBE0eB53F46cd790Cd13851d5EFf43D12404d33E8"], // add on 07/08/2023 - ["USDT", "TRX", "TMuA6YqfCeX8EhbfYEg5y7S4DqzSJireY9"], - ["USDT", "TRX", "TWd4WrZ9wn84f5x1hZhL4DHvk738ns5jwb"], - ["USDC", "TRX", "TWd4WrZ9wn84f5x1hZhL4DHvk738ns5jwb"], - ["BUSD", "TRX", "TWd4WrZ9wn84f5x1hZhL4DHvk738ns5jwb"], - ["USDT", "TRX", "TJCo98saj6WND61g1uuKwJ9GMWMT9WkJFo"], - ["USDT", "TRX", "TV6MuMXfmLbBqPZvBHdwFsDnQeVfnmiuSi"], - ["BUSD", "TRX", "TV6MuMXfmLbBqPZvBHdwFsDnQeVfnmiuSi"], - ["USDT", "TRX", "TJDENsfBJs4RFETt1X1W8wMDc8M5XnJhCe"], - ["USDT", "TRX", "TAzsQ9Gx8eqFNFSKbeXrbi45CuVPHzA8wr"], - ["USDT", "TRX", "TQrY8tryqsYVCYS3MFbtffiPp2ccyn4STm"], - ["USDT", "TRX", "TNXoiAJ3dct8Fjg4M9fkLFh9S2v9TXc32G"], - ["USDC", "TRX", "TNXoiAJ3dct8Fjg4M9fkLFh9S2v9TXc32G"], - ["BUSD", "TRX", "TNXoiAJ3dct8Fjg4M9fkLFh9S2v9TXc32G"], - ["USDT", "TRX", "TYASr5UV6HEcXatwdFQfmLVUqQQQMUxHLS"], - ["BUSD", "ETH", "0xf977814e90da44bfa03b6295a0616a897441acec"], - // ["BUSD", "ETH", "0x47ac0Fb4F2D84898e4D9E7b4DaB3C24507a6D503"], - ["BUSD", "ETH", "0xbe0eb53f46cd790cd13851d5eff43d12404d33e8"], - ["BUSD", "ETH", "0x5a52e96bacdabb82fd05763e25335261b270efcb"], - // ["BUSD", "ETH", "0xa344c7aDA83113B3B56941F6e85bf2Eb425949f3"], - ["BUSD", "ETH", "0xdfd5293d8e347dfe59e90efd55b2956a1343963d"], - ["BUSD", "ETH", "0x28c6c06298d514db089934071355e5743bf21d60"], - ["BUSD", "ETH", "0x21a31ee1afc51d94c2efccaa2092ad1028285549"], - //["BNB", "BEP2", "bnb1edrs5cukhx060e02u98v9j8spum7vhuqg9ctxd"], + ["1INCH", "BEP20", "0x29bdfbf7d27462a2d115748ace2bd71a2646946c"], + ["1INCH", "BEP20", "0x5a52e96bacdabb82fd05763e25335261b270efcb"], + ["1INCH", "BEP20", "0x8894e0a0c962cb723c1976a4421c95949be2d4e3"], + ["1INCH", "BEP20", "0xe2fc31f816a9b94326492132018c3aecc4a93ae1"], + ["1INCH", "BEP20", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["1INCH", "ETH", "0x21a31ee1afc51d94c2efccaa2092ad1028285549"], + ["1INCH", "ETH", "0x28c6c06298d514db089934071355e5743bf21d60"], + ["1INCH", "ETH", "0x5a52e96bacdabb82fd05763e25335261b270efcb"], + ["1INCH", "ETH", "0xbe0eb53f46cd790cd13851d5eff43d12404d33e8"], + ["1INCH", "ETH", "0xdfd5293d8e347dfe59e90efd55b2956a1343963d"], + ["1INCH", "ETH", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["APT", "APT", "0x5bd7de5c56d5691f32ea86c973c73fec7b1445e59736c97158020018c080bb00"], + ["APT", "APT", "0x80174e0fe8cb2d32b038c6c888dd95c3e1560736f0d4a6e8bed6ae43b5c91f6f"], + ["APT", "APT", "0xae1a6f3d3daccaf77b55044cea133379934bba04a11b9d0bbd643eae5e6e9c70"], + ["APT", "APT", "0xd91c64b777e51395c6ea9dec562ed79a4afa0cd6dad5a87b187c37198a1f855a"], + ["APT", "APT", "0xed8c46bec9dbc2b23c60568f822b95b87ea395f7e3fdb5e3adc0a30c55c0a60e"], + ["ARB", "ARBITRUM", "0xb38e8c17e38363af6ebdcb3dae12e0243582891d"], + ["ARB", "ARBITRUM", "0xf92402bb795fd7cd08fb83839689db79099c8c9c"], + ["ARB", "ARBITRUM", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["ARB", "ETH", "0x28c6c06298d514db089934071355e5743bf21d60"], ["BNB", "BEP2", "bnb142q467df6jun6rt5u2ar58sp47hm5f9wvz2cvg"], - ["BNB", "BEP2", "bnb1u2agwjat20494fmc6jnuau0ls937cfjn4pjwtn"], - ["BNB", "BEP2", "bnb1lsmt5a8vqqus5fwslx8pyyemgjtg4y6ugj308t"], ["BNB", "BEP2", "bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz"], - //["BNB", "BEP2", "bnb1jxfh2g85q3v0tdq56fnevx6xcxtcnhtsmcu64m"], + ["BNB", "BEP2", "bnb1lsmt5a8vqqus5fwslx8pyyemgjtg4y6ugj308t"], ["BNB", "BEP2", "bnb1m5amny2gs3xdyta6pksmr43zu4727w24syyks7"], - // ["BNB", "BEP2", "bnb1panyupy43sazh4dka6fg3s08909ejhqz4k23eg"], - // ["BNB", "BEP2", "bnb1ymasdm96ld0v6s38ylvu0qsw0xmhdlhy47tpsg"], - // ["BNB", "BEP2", "bnb1tdcrvgjl580p2qv77y0cu2ezk3c80039psx6sh"], - // ["BNB", "BEP2", "bnb1e08c39tjpr5fvdh4cfhqmyclrh62ag45qmddud"], - // ["BNB", "BEP2", "bnb1lq4s05lgat8d0qh275q0elt4m9rs760m0ryced"], - // ["BNB", "BEP2", "bnb1t5fn9faqu5aanvexqu8dt9tah4jg20eun8gsee"], - // ["BNB", "BEP2", "bnb1dkckvfuqv7fjl902cvuqmde27skk94kjp09j99"], - // ["BNB", "BEP2", "bnb14u5qnp4peug4a6wlz327mx9xjd0xf6phe7ew8u"], - // ["BNB", "BEP2", "bnb19fk9hqqlp8xcwrt0w35weyufnglp43hlthev3l"], - // ["BNB", "BEP2", "bnb1uexf06gd94qsxdmqamk360d893dsrm8lvwyjsd"], - // ["BNB", "BEP2", "bnb1uwdm6vrfvx43wqj8cj3h362kad0g0nrk3gumg8"], - // ["BNB", "BEP2", "bnb1a5f0ghn3c2whfmz3z0wjggwcgsk2t26ynqn68x"], - // ["BNB", "BEP2", "bnb1s3czyqxaf4hyt3rueg9gss08nfnvxjzy5qfu2p"], - // ["BNB", "BEP2", "bnb1yud0r5kz3ctu07fwax3j753ueef6d0n0uxrx94"], - // ["BNB", "BEP2", "bnb1fxk3lmfu2h0qhywdump0hvggg6prlge88f42n9"], - // ["BNB", "BEP2", "bnb1erq4ykp99sm87tsrfg8mgjef350gqtzhsqwys6"], - // ["BNB", "BEP2", "bnb1u70jtt2umum4ag3vcpw2h8v8levm47t0mtjwmh"], + ["BNB", "BEP2", "bnb1u2agwjat20494fmc6jnuau0ls937cfjn4pjwtn"], ["BNB", "BEP2", "bnb1xrfwzlu9c5208lhtn7ywt0mjrhjh4nt4fjyqxy"], - ["BNB", "BEP20", "0xf977814e90da44bfa03b6295a0616a897441acec"], - ["BNB", "BEP20", "0xBE0eB53F46cd790Cd13851d5EFf43D12404d33E8"], // ADD BACK 07/08/2023 - ["BNB", "BEP20", "0x5a52e96bacdabb82fd05763e25335261b270efcb"], - ["ETH", "BEP20", "0x5a52E96BAcdaBb82fd05763E25335261B270Efcb"], //add on 07/08/2023 + ["BNB", "BEP20", "0x01c952174c24e1210d26961d456a77a39e1f0bb0"], + ["BNB", "BEP20", "0x161ba15a5f335c9f06bb5bbb0a9ce14076fbb645"], + ["BNB", "BEP20", "0x1fbe2acee135d991592f167ac371f3dd893a508b"], + ["BNB", "BEP20", "0x29bdfbf7d27462a2d115748ace2bd71a2646946c"], ["BNB", "BEP20", "0x3c783c21a0383057d128bae431894a5c19f9cf06"], - ["BNB", "BEP20", "0xdccf3b77da55107280bd850ea519df3705d1a75a"], - ["BNB", "BEP20", "0x8894e0a0c962cb723c1976a4421c95949be2d4e3"], ["BNB", "BEP20", "0x515b72ed8a97f42c568d6a143232775018f133c8"], + ["BNB", "BEP20", "0x5a52e96bacdabb82fd05763e25335261b270efcb"], + ["BNB", "BEP20", "0x73f5ebe90f27b46ea12e5795d16c4b408b19cc6f"], + ["BNB", "BEP20", "0x8894e0a0c962cb723c1976a4421c95949be2d4e3"], + ["BNB", "BEP20", "0xBE0eB53F46cd790Cd13851d5EFf43D12404d33E8"], + ["BNB", "BEP20", "0xa180fe01b906a1be37be6c534a3300785b20d947"], ["BNB", "BEP20", "0xbd612a3f30dca67bf60a39fd0d35e39b7ab80774"], - ["BNB", "BEP20", "0x01c952174c24e1210d26961d456a77a39e1f0bb0"], - ["BNB", "BEP20", "0x29bdfbf7d27462a2d115748ace2bd71a2646946c"], + ["BNB", "BEP20", "0xdccf3b77da55107280bd850ea519df3705d1a75a"], ["BNB", "BEP20", "0xe2fc31f816a9b94326492132018c3aecc4a93ae1"], - ["BNB", "BEP20", "0x73f5ebe90f27b46ea12e5795d16c4b408b19cc6f"], - ["BNB", "BEP20", "0x161ba15a5f335c9f06bb5bbb0a9ce14076fbb645"], - ["BNB", "BEP20", "0x1fbe2acee135d991592f167ac371f3dd893a508b"], ["BNB", "BEP20", "0xeb2d2f1b8c558a40207669291fda468e50c8a0bb"], - ["BNB", "BEP20", "0xa180fe01b906a1be37be6c534a3300785b20d947"], - ["BUSD", "BEP20", "0xa180fe01b906a1be37be6c534a3300785b20d947"], - ["1INCH", "BEP20", "0xf977814e90da44bfa03b6295a0616a897441acec"], - ["BNB", "ETH", "0xbe0eb53f46cd790cd13851d5eff43d12404d33e8"], - ["BNB", "ETH", "0xf977814e90da44bfa03b6295a0616a897441acec"], - ["ETH", "ARB", "0xb38e8c17e38363af6ebdcb3dae12e0243582891d"], - ["ETH", "ARB", "0xf977814e90da44bfa03b6295a0616a897441acec"], - ["USDT", "AVAX", "0x4aefa39caeadd662ae31ab0ce7c8c2c9c0a013e8"], - ["USDC", "AVAX", "0x9f8c163cba728e99993abe7495f06c0a3c8ac8b9"], - ["BUSD", "AVAX", "0x9f8c163cba728e99993abe7495f06c0a3c8ac8b9"], - ["BUSD", "AVAX", "0x4aefa39caeadd662ae31ab0ce7c8c2c9c0a013e8"], - ["USDT", "AVAX", "0x9f8c163cba728e99993abe7495f06c0a3c8ac8b9"], - ["XRP", "BEP2", "bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz"], - ["DOT", "BEP2", "bnb1lsmt5a8vqqus5fwslx8pyyemgjtg4y6ugj308t"], - ["BUSD", "BEP2", "bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz"], + ["BNB", "BEP20", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["BNB", "ETH", "0x28c6c06298d514db089934071355e5743bf21d60"], ["BTC", "BEP2", "bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz"], - ["XRP", "BEP2", "bnb1lsmt5a8vqqus5fwslx8pyyemgjtg4y6ugj308t"], - ["USDC", "BEP2", "bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz"], - ["BTC", "BEP2", "bnb1u2agwjat20494fmc6jnuau0ls937cfjn4pjwtn"], - ["CHZ", "BEP2", "bnb142q467df6jun6rt5u2ar58sp47hm5f9wvz2cvg"], - ["USDT", "BEP2", "bnb1u2agwjat20494fmc6jnuau0ls937cfjn4pjwtn"], - ["DOGE", "BEP2", "bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz"], - ["LTC", "BEP2", "bnb1u2agwjat20494fmc6jnuau0ls937cfjn4pjwtn"], - ["DOT", "BEP2", "bnb1u2agwjat20494fmc6jnuau0ls937cfjn4pjwtn"], - ["MATIC", "BEP2", "bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz"], - ["LINK", "BEP2", "bnb1u2agwjat20494fmc6jnuau0ls937cfjn4pjwtn"], - ["CHZ", "BEP2", "bnb1u2agwjat20494fmc6jnuau0ls937cfjn4pjwtn"], - ["XRP", "BEP2", "bnb1u2agwjat20494fmc6jnuau0ls937cfjn4pjwtn"], - ["ETH", "BEP2", "bnb1u2agwjat20494fmc6jnuau0ls937cfjn4pjwtn"], - ["ETH", "BEP2", "bnb1lsmt5a8vqqus5fwslx8pyyemgjtg4y6ugj308t"], - ["LINK", "BEP2", "bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz"], - ["CHZ", "BEP2", "bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz"], - ["WRX", "BEP2", "bnb1u2agwjat20494fmc6jnuau0ls937cfjn4pjwtn"], - ["WRX", "BEP2", "bnb142q467df6jun6rt5u2ar58sp47hm5f9wvz2cvg"], - ["WRX", "ETH", "0xBE0eB53F46cd790Cd13851d5EFf43D12404d33E8"], // add on 07/08/2023 ["BTC", "BEP2", "bnb1lsmt5a8vqqus5fwslx8pyyemgjtg4y6ugj308t"], - ["LTC", "BEP2", "bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz"], - ["USDT", "BEP2", "bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz"], - ["ETH", "BEP2", "bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz"], - ["DOT", "BEP20", "0x8894e0a0c962cb723c1976a4421c95949be2d4e3"], - ["BUSD", "BEP20", "0x8894e0a0c962cb723c1976a4421c95949be2d4e3"], + ["BTC", "BEP2", "bnb1u2agwjat20494fmc6jnuau0ls937cfjn4pjwtn"], + ["BTC", "BEP20", "0x5a52e96bacdabb82fd05763e25335261b270efcb"], + ["BTC", "BEP20", "0x8894e0a0c962cb723c1976a4421c95949be2d4e3"], + ["BTC", "BEP20", "0xe2fc31f816a9b94326492132018c3aecc4a93ae1"], ["BTC", "BEP20", "0xf977814e90da44bfa03b6295a0616a897441acec"], - ["LINK", "BEP20", "0x5a52e96bacdabb82fd05763e25335261b270efcb"], - ["BTC", "BEP20", "0x5a52E96BAcdaBb82fd05763E25335261B270Efcb"], //add on 07/08/2023 + ["BTC", "BTC", "search/1Pzaqw98PeRfyHypfqyEgg5yycJRsENrE7"], + ["BTC", "BTC", "search/34GUzCVLbdkMQ2UdVTaA4nxPwoovVS7y2J"], + ["BTC", "BTC", "search/34HpHYiyQwg69gFmCq2BGHjF1DZnZnBeBP"], + ["BTC", "BTC", "search/34xp4vRoCGJym3xR7yCVPFHoCNxv4Twseo"], + ["BTC", "BTC", "search/36zSLdRv1jyewjaC12fqK5fptn7PqewunL"], + ["BTC", "BTC", "search/38DN2uFMZPiHLHJigfv4kWC9JWJrNnhLcn"], + ["BTC", "BTC", "search/38Xnrq8MZiKmYmwobbYdZQ5nnCbX1qvQfE"], + ["BTC", "BTC", "search/395vnFScKQ1ay695C6v7gf89UzoFpx3WuJ"], + ["BTC", "BTC", "search/39884E3j6KZj82FK4vcCrkUvWYL5MQaS3v"], + ["BTC", "BTC", "search/3AeUiDpPPUrUBS377584sFCpx8KLfpX9Ry"], + ["BTC", "BTC", "search/3AtnehKDkFPC1bKvdrEVPSRGCtxQH8F1R8"], + ["BTC", "BTC", "search/3CySuFKbBS29M7rE5iJakZRNqb3msMeFoN"], + ["BTC", "BTC", "search/3EbJfpmFgufYtzW9UFvf1GAfm2ted1Rwnr"], + ["BTC", "BTC", "search/3FHNBLobJnbCTFTVakh5TXmEneyf5PT61B"], + ["BTC", "BTC", "search/3HdGoUTbcztBnS7UzY4vSPYhwr424CiWAA"], + ["BTC", "BTC", "search/3JFJPpH8Chwo7CDbyYQ4XcfgcjEP1FGRMJ"], + ["BTC", "BTC", "search/3JJmF63ifcamPLiAmLgG96RA599yNtY3EQ"], + ["BTC", "BTC", "search/3LQUu4v9z6KNch71j7kbj8GPeAGUo1FW6a"], + ["BTC", "BTC", "search/3LcgLHzTvjLKBixBvkKGiadtiw2GBSKKqH"], + ["BTC", "BTC", "search/3M219KR5vEneNb47ewrPfWyb5jQ2DjxRP6"], + ["BTC", "BTC", "search/3Me9QACjioepv2L2oKTC9QQ87NH6vFe1Zj"], + ["BTC", "BTC", "search/3NXCvmLGz9SxYi6TnjbBQfQMcwiZ1iQETa"], + ["BTC", "BTC", "search/3Qxak1CZhLyZ7GVckKphLURdLBCjMfz9bA"], + ["BTC", "BTC", "search/bc1qm34lsc65zpw79lxes69zkqmk6ee3ewf0j77s3h"], ["BTC", "ETH", "0x21a31ee1afc51d94c2efccaa2092ad1028285549"], - ["MASK", "BEP20", "0x5a52e96bacdabb82fd05763e25335261b270efcb"], - ["BTC", "ETH", "0xdfd5293d8e347dfe59e90efd55b2956a1343963d"], - ["MASK", "BEP20", "0x8894e0a0c962cb723c1976a4421c95949be2d4e3"], ["BTC", "ETH", "0x28c6c06298d514db089934071355e5743bf21d60"], - ["DOT", "BEP20", "0xf977814e90da44bfa03b6295a0616a897441acec"], - ["USDT", "BEP20", "0xa180fe01b906a1be37be6c534a3300785b20d947"], - ["BUSD", "BEP20", "0x3c783c21a0383057d128bae431894a5c19f9cf06"], - ["1INCH", "BEP20", "0xe2fc31f816a9b94326492132018c3aecc4a93ae1"], + ["BTC", "ETH", "0xdfd5293d8e347dfe59e90efd55b2956a1343963d"], + ["BTC", "ETH", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["BUSD", "AVAXC", "0x4aefa39caeadd662ae31ab0ce7c8c2c9c0a013e8"], + ["BUSD", "AVAXC", "0x9f8c163cba728e99993abe7495f06c0a3c8ac8b9"], + ["BUSD", "BEP2", "bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz"], + ["BUSD", "BEP2", "bnb1lsmt5a8vqqus5fwslx8pyyemgjtg4y6ugj308t"], + ["BUSD", "BEP2", "bnb1m5amny2gs3xdyta6pksmr43zu4727w24syyks7"], + ["BUSD", "BEP2", "bnb1u2agwjat20494fmc6jnuau0ls937cfjn4pjwtn"], + ["BUSD", "BEP2", "bnb1xrfwzlu9c5208lhtn7ywt0mjrhjh4nt4fjyqxy"], + ["BUSD", "BEP20", "0x01c952174c24e1210d26961d456a77a39e1f0bb0"], + ["BUSD", "BEP20", "0x161ba15a5f335c9f06bb5bbb0a9ce14076fbb645"], + ["BUSD", "BEP20", "0x1fbe2acee135d991592f167ac371f3dd893a508b"], ["BUSD", "BEP20", "0x29bdfbf7d27462a2d115748ace2bd71a2646946c"], - ["CVP", "BEP20", "0x8894e0a0c962cb723c1976a4421c95949be2d4e3"], - ["SHIB", "BEP20", "0x8894e0a0c962cb723c1976a4421c95949be2d4e3"], - ["BUSD", "BEP20", "0xe2fc31f816a9b94326492132018c3aecc4a93ae1"], + ["BUSD", "BEP20", "0x3c783c21a0383057d128bae431894a5c19f9cf06"], + ["BUSD", "BEP20", "0x515b72ed8a97f42c568d6a143232775018f133c8"], + ["BUSD", "BEP20", "0x5a52e96bacdabb82fd05763e25335261b270efcb"], + ["BUSD", "BEP20", "0x73f5ebe90f27b46ea12e5795d16c4b408b19cc6f"], + ["BUSD", "BEP20", "0x8894e0a0c962cb723c1976a4421c95949be2d4e3"], + ["BUSD", "BEP20", "0xa180fe01b906a1be37be6c534a3300785b20d947"], + ["BUSD", "BEP20", "0xbd612a3f30dca67bf60a39fd0d35e39b7ab80774"], ["BUSD", "BEP20", "0xdccf3b77da55107280bd850ea519df3705d1a75a"], + ["BUSD", "BEP20", "0xe2fc31f816a9b94326492132018c3aecc4a93ae1"], + ["BUSD", "BEP20", "0xeb2d2f1b8c558a40207669291fda468e50c8a0bb"], + ["BUSD", "BEP20", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["BUSD", "ETH", "0x21a31ee1afc51d94c2efccaa2092ad1028285549"], + ["BUSD", "ETH", "0x28c6c06298d514db089934071355e5743bf21d60"], + ["BUSD", "ETH", "0x5a52e96bacdabb82fd05763e25335261b270efcb"], ["BUSD", "ETH", "0x9696f59e4d72e237be84ffd425dcad154bf96976"], - ["LTC", "BEP20", "0x8894e0a0c962cb723c1976a4421c95949be2d4e3"], - ["LINK", "BEP20", "0xf977814e90da44bfa03b6295a0616a897441acec"], - ["HFT", "BEP20", "0xf977814e90da44bfa03b6295a0616a897441acec"], - ["SHIB", "BEP20", "0xa180fe01b906a1be37be6c534a3300785b20d947"], + ["BUSD", "ETH", "0xbe0eb53f46cd790cd13851d5eff43d12404d33e8"], + ["BUSD", "ETH", "0xdfd5293d8e347dfe59e90efd55b2956a1343963d"], + ["BUSD", "ETH", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["BUSD", "MATIC", "0x5a52E96BAcdaBb82fd05763E25335261B270Efcb"], + ["BUSD", "MATIC", "0xe7804c37c13166ff0b37f5ae0bb07a3aebb6e245"], + ["BUSD", "MATIC", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["BUSD", "OP", "0xF977814e90dA44bFA03b6295A0616a897441aceC"], + ["BUSD", "OP", "0xacd03d601e5bb1b275bb94076ff46ed9d753435a"], + ["BUSD", "TRX", "address/TJCo98saj6WND61g1uuKwJ9GMWMT9WkJFo"], + ["BUSD", "TRX", "address/TNXoiAJ3dct8Fjg4M9fkLFh9S2v9TXc32G"], + ["BUSD", "TRX", "address/TV6MuMXfmLbBqPZvBHdwFsDnQeVfnmiuSi"], + ["BUSD", "TRX", "address/TWd4WrZ9wn84f5x1hZhL4DHvk738ns5jwb"], + ["CHR", "BEP20", "0x5a52e96bacdabb82fd05763e25335261b270efcb"], + ["CHR", "BEP20", "0x8894e0a0c962cb723c1976a4421c95949be2d4e3"], ["CHR", "BEP20", "0xe2fc31f816a9b94326492132018c3aecc4a93ae1"], - ["CHR", "ETH", "0x28c6c06298d514db089934071355e5743bf21d60"], + ["CHR", "BEP20", "0xf977814e90da44bfa03b6295a0616a897441acec"], ["CHR", "ETH", "0x21a31ee1afc51d94c2efccaa2092ad1028285549"], + ["CHR", "ETH", "0x28c6c06298d514db089934071355e5743bf21d60"], + ["CHR", "ETH", "0x5a52e96bacdabb82fd05763e25335261b270efcb"], ["CHR", "ETH", "0xbe0eb53f46cd790cd13851d5eff43d12404d33e8"], ["CHR", "ETH", "0xdfd5293d8e347dfe59e90efd55b2956a1343963d"], - ["USDT", "BEP20", "0x8894e0a0c962cb723c1976a4421c95949be2d4e3"], - ["CHZ", "ETH", "0xdfd5293d8e347dfe59e90efd55b2956a1343963d"], - ["SHIB", "BEP20", "0xf977814e90da44bfa03b6295a0616a897441acec"], - ["CHZ", "ETH", "0xbe0eb53f46cd790cd13851d5eff43d12404d33e8"], - ["CHZ", "ETH", "0x28c6c06298d514db089934071355e5743bf21d60"], - ["ENJ", "ETH", "0xBE0eB53F46cd790Cd13851d5EFf43D12404d33E8"], // add on 07/08/2023 + ["CHR", "ETH", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["CHZ", "BEP2", "bnb142q467df6jun6rt5u2ar58sp47hm5f9wvz2cvg"], + ["CHZ", "BEP2", "bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz"], + ["CHZ", "BEP2", "bnb1m5amny2gs3xdyta6pksmr43zu4727w24syyks7"], + ["CHZ", "BEP2", "bnb1u2agwjat20494fmc6jnuau0ls937cfjn4pjwtn"], ["CHZ", "ETH", "0x21a31ee1afc51d94c2efccaa2092ad1028285549"], - ["1INCH", "BEP20", "0x8894e0a0c962cb723c1976a4421c95949be2d4e3"], + ["CHZ", "ETH", "0x28c6c06298d514db089934071355e5743bf21d60"], + ["CHZ", "ETH", "0x5a52e96bacdabb82fd05763e25335261b270efcb"], + ["CHZ", "ETH", "0xbe0eb53f46cd790cd13851d5eff43d12404d33e8"], + ["CHZ", "ETH", "0xdfd5293d8e347dfe59e90efd55b2956a1343963d"], + ["CHZ", "ETH", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["CRV", "ETH", "0x21a31ee1afc51d94c2efccaa2092ad1028285549"], ["CRV", "ETH", "0x28c6c06298d514db089934071355e5743bf21d60"], - ["CVP", "BEP20", "0xf977814e90da44bfa03b6295a0616a897441acec"], - ["MASK", "BEP20", "0xf977814e90da44bfa03b6295a0616a897441acec"], ["CRV", "ETH", "0xdfd5293d8e347dfe59e90efd55b2956a1343963d"], - ["CRV", "ETH", "0x21a31ee1afc51d94c2efccaa2092ad1028285549"], + ["CRV", "ETH", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["CVP", "BEP20", "0x8894e0a0c962cb723c1976a4421c95949be2d4e3"], ["CVP", "BEP20", "0xe2fc31f816a9b94326492132018c3aecc4a93ae1"], + ["CVP", "BEP20", "0xf977814e90da44bfa03b6295a0616a897441acec"], ["CVP", "ETH", "0x21a31ee1afc51d94c2efccaa2092ad1028285549"], - ["USDC", "BEP20", "0xf977814e90da44bfa03b6295a0616a897441acec"], - ["CVP", "ETH", "0xdfd5293d8e347dfe59e90efd55b2956a1343963d"], ["CVP", "ETH", "0x28c6c06298d514db089934071355e5743bf21d60"], - ["XRP", "BEP20", "0xf977814e90da44bfa03b6295a0616a897441acec"], - ["DOGE", "BEP20", "0xe2fc31f816a9b94326492132018c3aecc4a93ae1"], - ["USDT", "BEP20", "0xf977814e90da44bfa03b6295a0616a897441acec"], - ["CHR", "BEP20", "0x8894e0a0c962cb723c1976a4421c95949be2d4e3"], - ["MATIC", "BEP20", "0xf977814e90da44bfa03b6295a0616a897441acec"], - ["BTC", "BEP20", "0x8894e0a0c962cb723c1976a4421c95949be2d4e3"], - ["DOGE", "BEP20", "0xdccf3b77da55107280bd850ea519df3705d1a75a"], + ["CVP", "ETH", "0x5a52e96bacdabb82fd05763e25335261b270efcb"], + ["CVP", "ETH", "0xdfd5293d8e347dfe59e90efd55b2956a1343963d"], + ["CVP", "ETH", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["DOGE", "BEP2", "bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz"], + ["DOGE", "BEP20", "0x01c952174c24e1210d26961d456a77a39e1f0bb0"], + ["DOGE", "BEP20", "0x161ba15a5f335c9f06bb5bbb0a9ce14076fbb645"], + ["DOGE", "BEP20", "0x3c783c21a0383057d128bae431894a5c19f9cf06"], + ["DOGE", "BEP20", "0x515b72ed8a97f42c568d6a143232775018f133c8"], + ["DOGE", "BEP20", "0x5a52e96bacdabb82fd05763e25335261b270efcb"], + ["DOGE", "BEP20", "0x73f5ebe90f27b46ea12e5795d16c4b408b19cc6f"], ["DOGE", "BEP20", "0x8894e0a0c962cb723c1976a4421c95949be2d4e3"], + ["DOGE", "BEP20", "0xBE0eB53F46cd790Cd13851d5EFf43D12404d33E8"], + ["DOGE", "BEP20", "0xa180fe01b906a1be37be6c534a3300785b20d947"], + ["DOGE", "BEP20", "0xbd612a3f30dca67bf60a39fd0d35e39b7ab80774"], + ["DOGE", "BEP20", "0xdccf3b77da55107280bd850ea519df3705d1a75a"], + ["DOGE", "BEP20", "0xe2fc31f816a9b94326492132018c3aecc4a93ae1"], + ["DOGE", "BEP20", "0xeb2d2f1b8c558a40207669291fda468e50c8a0bb"], + ["DOGE", "BEP20", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["DOT", "BEP2", "bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz"], + ["DOT", "BEP2", "bnb1lsmt5a8vqqus5fwslx8pyyemgjtg4y6ugj308t"], + ["DOT", "BEP2", "bnb1u2agwjat20494fmc6jnuau0ls937cfjn4pjwtn"], + ["DOT", "BEP20", "0x5a52e96bacdabb82fd05763e25335261b270efcb"], + ["DOT", "BEP20", "0x8894e0a0c962cb723c1976a4421c95949be2d4e3"], + ["DOT", "BEP20", "0xbd612a3f30dca67bf60a39fd0d35e39b7ab80774"], ["DOT", "BEP20", "0xe2fc31f816a9b94326492132018c3aecc4a93ae1"], - ["SOL", "BEP20", "0xf977814e90da44bfa03b6295a0616a897441acec"], - ["WRX", "BEP20", "0x8894e0a0c962cb723c1976a4421c95949be2d4e3"], - ["XRP", "BEP20", "0x5a52e96bacdabb82fd05763e25335261b270efcb"], + ["DOT", "BEP20", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["DOT", "DOT", "16ZL8yLyXv3V3L3z9ofR1ovFLziyXaN1DPq4yffMAZ9czzBD"], + ["DOT", "DOT", "1743nDTMZisPgBCYSAgkUn1kVG7MePc9rvMEjoRNf4ipVkF"], + ["DOT", "DOT", "1qnJN7FViy3HZaxZK9tGAA71zxHSBeUweirKqCaox4t8GT7"], ["DOT", "ETH", "0x21a31ee1afc51d94c2efccaa2092ad1028285549"], - ["DOT", "ETH", "0xdfd5293d8e347dfe59e90efd55b2956a1343963d"], ["DOT", "ETH", "0x28c6c06298d514db089934071355e5743bf21d60"], + ["DOT", "ETH", "0xdfd5293d8e347dfe59e90efd55b2956a1343963d"], + ["DOT", "ETH", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["ENJ", "ETH", "0x21a31ee1afc51d94c2efccaa2092ad1028285549"], ["ENJ", "ETH", "0x28c6c06298d514db089934071355e5743bf21d60"], + ["ENJ", "ETH", "0x56eddb7aa87536c09ccc2793473599fd21a8b17f"], + ["ENJ", "ETH", "0x5a52e96bacdabb82fd05763e25335261b270efcb"], ["ENJ", "ETH", "0xbe0eb53f46cd790cd13851d5eff43d12404d33e8"], - ["HFT", "BEP20", "0x8894e0a0c962cb723c1976a4421c95949be2d4e3"], - ["ETH", "ETH", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["ENJ", "ETH", "0xdfd5293d8e347dfe59e90efd55b2956a1343963d"], + ["ENJ", "ETH", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["ETH", "ARBITRUM", "0xb38e8c17e38363af6ebdcb3dae12e0243582891d"], + ["ETH", "ARBITRUM", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["ETH", "BEP2", "bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz"], + ["ETH", "BEP2", "bnb1lsmt5a8vqqus5fwslx8pyyemgjtg4y6ugj308t"], + ["ETH", "BEP2", "bnb1m5amny2gs3xdyta6pksmr43zu4727w24syyks7"], + ["ETH", "BEP2", "bnb1xrfwzlu9c5208lhtn7ywt0mjrhjh4nt4fjyqxy"], + ["ETH", "BEP20", "0x01c952174c24e1210d26961d456a77a39e1f0bb0"], + ["ETH", "BEP20", "0x161ba15a5f335c9f06bb5bbb0a9ce14076fbb645"], + ["ETH", "BEP20", "0x1fbe2acee135d991592f167ac371f3dd893a508b"], + ["ETH", "BEP20", "0x29bdfbf7d27462a2d115748ace2bd71a2646946c"], + ["ETH", "BEP20", "0x3c783c21a0383057d128bae431894a5c19f9cf06"], + ["ETH", "BEP20", "0x515b72ed8a97f42c568d6a143232775018f133c8"], + ["ETH", "BEP20", "0x5a52e96bacdabb82fd05763e25335261b270efcb"], + ["ETH", "BEP20", "0x73f5ebe90f27b46ea12e5795d16c4b408b19cc6f"], ["ETH", "BEP20", "0x8894e0a0c962cb723c1976a4421c95949be2d4e3"], + ["ETH", "BEP20", "0x9696f59e4d72e237be84ffd425dcad154bf96976"], + ["ETH", "BEP20", "0xa180fe01b906a1be37be6c534a3300785b20d947"], + ["ETH", "BEP20", "0xbd612a3f30dca67bf60a39fd0d35e39b7ab80774"], + ["ETH", "BEP20", "0xdccf3b77da55107280bd850ea519df3705d1a75a"], ["ETH", "BEP20", "0xe2fc31f816a9b94326492132018c3aecc4a93ae1"], - ["XRP", "BEP20", "0x8894e0a0c962cb723c1976a4421c95949be2d4e3"], - ["MATIC", "BEP20", "0x8894e0a0c962cb723c1976a4421c95949be2d4e3"], - ["CVP", "BEP20", "0x5a52e96bacdabb82fd05763e25335261b270efcb"], - ["DOGE", "BEP20", "0xf977814e90da44bfa03b6295a0616a897441acec"], - ["SOL", "BEP20", "0x8894e0a0c962cb723c1976a4421c95949be2d4e3"], - ["LTC", "BEP20", "0xf977814e90da44bfa03b6295a0616a897441acec"], - ["USDC", "BEP20", "0x8894e0a0c962cb723c1976a4421c95949be2d4e3"], - ["LINK", "BEP20", "0x8894e0a0c962cb723c1976a4421c95949be2d4e3"], - ["WRX", "BEP20", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["ETH", "BEP20", "0xeb2d2f1b8c558a40207669291fda468e50c8a0bb"], + ["ETH", "BEP20", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["ETH", "ETH", "0x21a31ee1afc51d94c2efccaa2092ad1028285549"], + ["ETH", "ETH", "0x28c6c06298d514db089934071355e5743bf21d60"], + ["ETH", "ETH", "0x4976a4a02f38326660d17bf34b431dc6e2eb2327"], + ["ETH", "ETH", "0x56eddb7aa87536c09ccc2793473599fd21a8b17f"], + ["ETH", "ETH", "0x5a52e96bacdabb82fd05763e25335261b270efcb"], + ["ETH", "ETH", "0x9696f59e4d72e237be84ffd425dcad154bf96976"], + ["ETH", "ETH", "0xbe0eb53f46cd790cd13851d5eff43d12404d33e8"], + ["ETH", "ETH", "0xdfd5293d8e347dfe59e90efd55b2956a1343963d"], + ["ETH", "ETH", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["ETH", "OP", "0x21a31ee1afc51d94c2efccaa2092ad1028285549"], + ["ETH", "OP", "0xF977814e90dA44bFA03b6295A0616a897441aceC"], + ["ETH", "OP", "0xacd03d601e5bb1b275bb94076ff46ed9d753435a"], + ["FDUSD", "BEP20", "0x8894e0a0c962cb723c1976a4421c95949be2d4e3"], + ["FDUSD", "BEP20", "0xe2fc31f816a9b94326492132018c3aecc4a93ae1"], + ["FDUSD", "ETH", "0x21a31ee1afc51d94c2efccaa2092ad1028285549"], + ["FDUSD", "ETH", "0x28c6c06298d514db089934071355e5743bf21d60"], + ["FDUSD", "ETH", "0xdfd5293d8e347dfe59e90efd55b2956a1343963d"], + ["FDUSD", "ETH", "0xf977814e90da44bfa03b6295a0616a897441acec"], ["GRT", "ETH", "0x21a31ee1afc51d94c2efccaa2092ad1028285549"], - ["CHZ", "ETH", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["GRT", "ETH", "0x28c6c06298d514db089934071355e5743bf21d60"], + ["GRT", "ETH", "0x5a52e96bacdabb82fd05763e25335261b270efcb"], + ["GRT", "ETH", "0xdfd5293d8e347dfe59e90efd55b2956a1343963d"], + ["GRT", "ETH", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["HFT", "BEP20", "0x8894e0a0c962cb723c1976a4421c95949be2d4e3"], ["HFT", "BEP20", "0xe2fc31f816a9b94326492132018c3aecc4a93ae1"], + ["HFT", "BEP20", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["HFT", "ETH", "0x21a31ee1afc51d94c2efccaa2092ad1028285549"], ["HFT", "ETH", "0x28c6c06298d514db089934071355e5743bf21d60"], - ["1INCH", "ETH", "0xdfd5293d8e347dfe59e90efd55b2956a1343963d"], + ["HFT", "ETH", "0x5a52e96bacdabb82fd05763e25335261b270efcb"], ["HFT", "ETH", "0xdfd5293d8e347dfe59e90efd55b2956a1343963d"], - ["HFT", "ETH", "0x21a31ee1afc51d94c2efccaa2092ad1028285549"], + ["HFT", "ETH", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["LINK", "BEP2", "bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz"], + ["LINK", "BEP20", "0x5a52e96bacdabb82fd05763e25335261b270efcb"], + ["LINK", "BEP20", "0x8894e0a0c962cb723c1976a4421c95949be2d4e3"], ["LINK", "BEP20", "0xe2fc31f816a9b94326492132018c3aecc4a93ae1"], + ["LINK", "BEP20", "0xf977814e90da44bfa03b6295a0616a897441acec"], ["LINK", "ETH", "0x21a31ee1afc51d94c2efccaa2092ad1028285549"], - ["MATIC", "ETH", "0xf977814e90da44bfa03b6295a0616a897441acec"], ["LINK", "ETH", "0x28c6c06298d514db089934071355e5743bf21d60"], - ["LINK", "ETH", "0xdfd5293d8e347dfe59e90efd55b2956a1343963d"], + ["LINK", "ETH", "0x5a52e96bacdabb82fd05763e25335261b270efcb"], ["LINK", "ETH", "0xbe0eb53f46cd790cd13851d5eff43d12404d33e8"], - ["BTC", "ETH", "0xf977814e90da44bfa03b6295a0616a897441acec"], - ["MASK", "ETH", "0xdfd5293d8e347dfe59e90efd55b2956a1343963d"], + ["LINK", "ETH", "0xdfd5293d8e347dfe59e90efd55b2956a1343963d"], + ["LINK", "ETH", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["LTC", "BEP2", "bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz"], + ["LTC", "BEP20", "0x8894e0a0c962cb723c1976a4421c95949be2d4e3"], + ["LTC", "BEP20", "0xe2fc31f816a9b94326492132018c3aecc4a93ae1"], + ["LTC", "BEP20", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["LTC", "LTC", "address/LZEjckteAtWrugbsy9zU8VHEZ4iUiXo9Nm"], + ["LTC", "LTC", "address/LbmGksLBwtwRXyxeazCZqKiAHX6cWN2AzN"], + ["LTC", "LTC", "address/LhzEoDXHXASi4hSMxrKeVoSGrED9QsBpPq"], + ["LTC", "LTC", "address/M8T1B2Z97gVdvmfkQcAtYbEepune1tzGua"], + ["LTC", "LTC", "address/MB8nnFMvR5cgvpzQ1QXTDVfUM91BcsLH3k"], + ["LTC", "LTC", "address/MBjKmoDwkuUbtnVd4vjymxjJx7Crca2s1z"], + ["LTC", "LTC", "address/MDwD5wYdeuoisfoaWKgeHK4Gq3YkbaCypJ"], + ["LTC", "LTC", "address/MEhAHYijouCinmGKL6n1bRTXYznH1X24rD"], + ["LTC", "LTC", "address/MJto5wFLrE9t4TDXCgdSet8W6mxYqGijC3"], + ["LTC", "LTC", "address/MJwFHGandYUFJTTHHSXg3q6u7ge4af1n4N"], + ["LTC", "LTC", "address/MLkNzCps6cXou2DELVfxDuRC4uZGwr397o"], + ["LTC", "LTC", "address/MQd1fJwqBJvwLuyhr17PhEFx1swiqDbPQS"], + ["LTC", "LTC", "address/MSeDRiNoH5Afr9b9rNo837hYzpxBXXqMZf"], + ["LTC", "LTC", "address/MWGTiJBNEQSfxTCrdC2VKEa55Lck27wr67"], + ["LTC", "LTC", "address/MWkX1ZaFbrRPtcQvVpjvigxWU17JoinePy"], + ["MASK", "BEP20", "0x5a52e96bacdabb82fd05763e25335261b270efcb"], + ["MASK", "BEP20", "0x8894e0a0c962cb723c1976a4421c95949be2d4e3"], + ["MASK", "BEP20", "0xe2fc31f816a9b94326492132018c3aecc4a93ae1"], + ["MASK", "BEP20", "0xf977814e90da44bfa03b6295a0616a897441acec"], ["MASK", "ETH", "0x21a31ee1afc51d94c2efccaa2092ad1028285549"], ["MASK", "ETH", "0x28c6c06298d514db089934071355e5743bf21d60"], - ["1INCH", "ETH", "0x5a52e96bacdabb82fd05763e25335261b270efcb"], + ["MASK", "ETH", "0x5a52e96bacdabb82fd05763e25335261b270efcb"], + ["MASK", "ETH", "0xdfd5293d8e347dfe59e90efd55b2956a1343963d"], + ["MASK", "ETH", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["MATIC", "BEP2", "bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz"], + ["MATIC", "BEP2", "bnb1xrfwzlu9c5208lhtn7ywt0mjrhjh4nt4fjyqxy"], + ["MATIC", "BEP20", "0x29bdfbf7d27462a2d115748ace2bd71a2646946c"], + ["MATIC", "BEP20", "0x3c783c21a0383057d128bae431894a5c19f9cf06"], + ["MATIC", "BEP20", "0x5a52e96bacdabb82fd05763e25335261b270efcb"], + ["MATIC", "BEP20", "0x8894e0a0c962cb723c1976a4421c95949be2d4e3"], + ["MATIC", "BEP20", "0xe2fc31f816a9b94326492132018c3aecc4a93ae1"], + ["MATIC", "BEP20", "0xf977814e90da44bfa03b6295a0616a897441acec"], ["MATIC", "ETH", "0x21a31ee1afc51d94c2efccaa2092ad1028285549"], ["MATIC", "ETH", "0x28c6c06298d514db089934071355e5743bf21d60"], + ["MATIC", "ETH", "0x4976a4a02f38326660d17bf34b431dc6e2eb2327"], + ["MATIC", "ETH", "0x5a52e96bacdabb82fd05763e25335261b270efcb"], ["MATIC", "ETH", "0xdfd5293d8e347dfe59e90efd55b2956a1343963d"], - ["SHIB", "BEP20", "0x3c783c21a0383057d128bae431894a5c19f9cf06"], + ["MATIC", "ETH", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["MATIC", "MATIC", "0x082489a616ab4d46d1947ee3f912e080815b08da"], + ["MATIC", "MATIC", "0x5a52E96BAcdaBb82fd05763E25335261B270Efcb"], + ["MATIC", "MATIC", "0xdfd5293d8e347dfe59e90efd55b2956a1343963d"], + ["MATIC", "MATIC", "0xe7804c37c13166ff0b37f5ae0bb07a3aebb6e245"], + ["MATIC", "MATIC", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["OP", "OP", "0xF977814e90dA44bFA03b6295A0616a897441aceC"], + ["OP", "OP", "0xacd03d601e5bb1b275bb94076ff46ed9d753435a"], ["SHIB", "BEP20", "0x161ba15a5f335c9f06bb5bbb0a9ce14076fbb645"], - ["MASK", "ETH", "0xf977814e90da44bfa03b6295a0616a897441acec"], - ["SHIB", "BEP20", "0x515b72ed8a97f42c568d6a143232775018f133c8"], ["SHIB", "BEP20", "0x1fbe2acee135d991592f167ac371f3dd893a508b"], - ["SHIB", "BEP20", "0xe2fc31f816a9b94326492132018c3aecc4a93ae1"], - ["SHIB", "BEP20", "0xdccf3b77da55107280bd850ea519df3705d1a75a"], + ["SHIB", "BEP20", "0x3c783c21a0383057d128bae431894a5c19f9cf06"], + ["SHIB", "BEP20", "0x515b72ed8a97f42c568d6a143232775018f133c8"], + ["SHIB", "BEP20", "0x73f5ebe90f27b46ea12e5795d16c4b408b19cc6f"], + ["SHIB", "BEP20", "0x8894e0a0c962cb723c1976a4421c95949be2d4e3"], + ["SHIB", "BEP20", "0xa180fe01b906a1be37be6c534a3300785b20d947"], ["SHIB", "BEP20", "0xbd612a3f30dca67bf60a39fd0d35e39b7ab80774"], + ["SHIB", "BEP20", "0xdccf3b77da55107280bd850ea519df3705d1a75a"], + ["SHIB", "BEP20", "0xe2fc31f816a9b94326492132018c3aecc4a93ae1"], + ["SHIB", "BEP20", "0xeb2d2f1b8c558a40207669291fda468e50c8a0bb"], + ["SHIB", "ETH", "0x21a31ee1afc51d94c2efccaa2092ad1028285549"], + ["SHIB", "ETH", "0x28c6c06298d514db089934071355e5743bf21d60"], ["SHIB", "ETH", "0x4976a4a02f38326660d17bf34b431dc6e2eb2327"], - ["CVP", "ETH", "0x5a52e96bacdabb82fd05763e25335261b270efcb"], - ["SSV", "ETH", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["SHIB", "ETH", "0x56eddb7aa87536c09ccc2793473599fd21a8b17f"], + ["SHIB", "ETH", "0x5a52e96bacdabb82fd05763e25335261b270efcb"], + ["SHIB", "ETH", "0x9696f59e4d72e237be84ffd425dcad154bf96976"], + ["SHIB", "ETH", "0xdfd5293d8e347dfe59e90efd55b2956a1343963d"], + ["SHIB", "ETH", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["SOL", "BEP20", "0x01c952174c24e1210d26961d456a77a39e1f0bb0"], + ["SOL", "BEP20", "0x1fbe2acee135d991592f167ac371f3dd893a508b"], + ["SOL", "BEP20", "0x3c783c21a0383057d128bae431894a5c19f9cf06"], + ["SOL", "BEP20", "0x8894e0a0c962cb723c1976a4421c95949be2d4e3"], + ["SOL", "BEP20", "0xdccf3b77da55107280bd850ea519df3705d1a75a"], + ["SOL", "BEP20", "0xe2fc31f816a9b94326492132018c3aecc4a93ae1"], + ["SOL", "BEP20", "0xeb2d2f1b8c558a40207669291fda468e50c8a0bb"], + ["SOL", "BEP20", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["SOL", "SOL", "2ojv9BAiHUrvsm9gxDe7fJSzbNZSJcxZvf8dqmWGHG8S"], + ["SOL", "SOL", "3yFwqXBfZY4jBVUafQ1YEXw189y2dN3V5KQq9uzBDy1E"], + ["SOL", "SOL", "5tzFkiKscXHK5ZXCGbXZxdw7gTjjD1mBwuoFbhUvuAi9"], + ["SOL", "SOL", "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM"], ["SSV", "ETH", "0x21a31ee1afc51d94c2efccaa2092ad1028285549"], ["SSV", "ETH", "0x28c6c06298d514db089934071355e5743bf21d60"], + ["SSV", "ETH", "0x5a52e96bacdabb82fd05763e25335261b270efcb"], + ["SSV", "ETH", "0xdfd5293d8e347dfe59e90efd55b2956a1343963d"], + ["SSV", "ETH", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["TUSD", "BEP2", "bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz"], + ["TUSD", "BEP20", "0x8894e0a0c962cb723c1976a4421c95949be2d4e3"], + ["TUSD", "BEP20", "0xe2fc31f816a9b94326492132018c3aecc4a93ae1"], + ["TUSD", "BEP20", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["TUSD", "ETH", "0x21a31ee1afc51d94c2efccaa2092ad1028285549"], + ["TUSD", "ETH", "0x28c6c06298d514db089934071355e5743bf21d60"], + ["TUSD", "ETH", "0x5a52e96bacdabb82fd05763e25335261b270efcb"], + ["TUSD", "ETH", "0xdfd5293d8e347dfe59e90efd55b2956a1343963d"], + ["TUSD", "ETH", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["TUSD", "TRX", "address/TJCo98saj6WND61g1uuKwJ9GMWMT9WkJFo"], + ["TUSD", "TRX", "address/TNXoiAJ3dct8Fjg4M9fkLFh9S2v9TXc32G"], + ["TUSD", "TRX", "address/TV6MuMXfmLbBqPZvBHdwFsDnQeVfnmiuSi"], + ["TUSD", "TRX", "address/TWd4WrZ9wn84f5x1hZhL4DHvk738ns5jwb"], + ["UNI", "BEP2", "bnb142q467df6jun6rt5u2ar58sp47hm5f9wvz2cvg"], + ["UNI", "BEP2", "bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz"], + ["UNI", "BEP2", "bnb1lsmt5a8vqqus5fwslx8pyyemgjtg4y6ugj308t"], + ["UNI", "BEP2", "bnb1u2agwjat20494fmc6jnuau0ls937cfjn4pjwtn"], + ["UNI", "BEP20", "0x5a52e96bacdabb82fd05763e25335261b270efcb"], + ["UNI", "BEP20", "0x8894e0a0c962cb723c1976a4421c95949be2d4e3"], + ["UNI", "BEP20", "0xe2fc31f816a9b94326492132018c3aecc4a93ae1"], + ["UNI", "BEP20", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["UNI", "ETH", "0x21a31ee1afc51d94c2efccaa2092ad1028285549"], + ["UNI", "ETH", "0x28c6c06298d514db089934071355e5743bf21d60"], + ["UNI", "ETH", "0x5a52e96bacdabb82fd05763e25335261b270efcb"], + ["UNI", "ETH", "0x9696f59e4d72e237be84ffd425dcad154bf96976"], + ["UNI", "ETH", "0xbe0eb53f46cd790cd13851d5eff43d12404d33e8"], + ["UNI", "ETH", "0xdfd5293d8e347dfe59e90efd55b2956a1343963d"], + ["UNI", "ETH", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["USDC", "ALGO", "MTCEM5YJJSYGW2RCXYXGE4SXLSPUUEJKQAWG2GUX6CNN72KQ3XPJCM6NOI"], + ["USDC", "ALGO", "QYXDGS2XJJT7QNR6EJ2YHNZFONU6ROFM6BKTBNVT63ZXQ5OC6IYSPNDJ4U"], + ["USDC", "ARBITRUM", "0xb38e8c17e38363af6ebdcb3dae12e0243582891d"], + ["USDC", "AVAXC", "0x4aefa39caeadd662ae31ab0ce7c8c2c9c0a013e8"], + ["USDC", "AVAXC", "0x9f8c163cba728e99993abe7495f06c0a3c8ac8b9"], + ["USDC", "BEP2", "bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz"], + ["USDC", "BEP20", "0x1fbe2acee135d991592f167ac371f3dd893a508b"], + ["USDC", "BEP20", "0x29bdfbf7d27462a2d115748ace2bd71a2646946c"], + ["USDC", "BEP20", "0x3c783c21a0383057d128bae431894a5c19f9cf06"], + ["USDC", "BEP20", "0x515b72ed8a97f42c568d6a143232775018f133c8"], + ["USDC", "BEP20", "0x5a52e96bacdabb82fd05763e25335261b270efcb"], + ["USDC", "BEP20", "0x73f5ebe90f27b46ea12e5795d16c4b408b19cc6f"], + ["USDC", "BEP20", "0x8894e0a0c962cb723c1976a4421c95949be2d4e3"], ["USDC", "BEP20", "0xe2fc31f816a9b94326492132018c3aecc4a93ae1"], - ["MATIC", "ETH", "0x5a52e96bacdabb82fd05763e25335261b270efcb"], - ["GRT", "ETH", "0xf977814e90da44bfa03b6295a0616a897441acec"], - ["DOT", "ETH", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["USDC", "BEP20", "0xeb2d2f1b8c558a40207669291fda468e50c8a0bb"], + ["USDC", "ETH", "0x21a31ee1afc51d94c2efccaa2092ad1028285549"], ["USDC", "ETH", "0x28c6c06298d514db089934071355e5743bf21d60"], - ["LINK", "ETH", "0xf977814e90da44bfa03b6295a0616a897441acec"], - ["1INCH", "ETH", "0xf977814e90da44bfa03b6295a0616a897441acec"], - ["1INCH", "ETH", "0xbe0eb53f46cd790cd13851d5eff43d12404d33e8"], - ["CHR", "ETH", "0xf977814e90da44bfa03b6295a0616a897441acec"], - ["1INCH", "ETH", "0x21a31ee1afc51d94c2efccaa2092ad1028285549"], - ["XRP", "ETH", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["USDC", "ETH", "0x4976a4a02f38326660d17bf34b431dc6e2eb2327"], + ["USDC", "ETH", "0x56eddb7aa87536c09ccc2793473599fd21a8b17f"], + ["USDC", "ETH", "0x9696f59e4d72e237be84ffd425dcad154bf96976"], + ["USDC", "ETH", "0xdfd5293d8e347dfe59e90efd55b2956a1343963d"], + ["USDC", "MATIC", "0x082489a616ab4d46d1947ee3f912e080815b08da"], + ["USDC", "MATIC", "0x5a52E96BAcdaBb82fd05763E25335261B270Efcb"], + ["USDC", "MATIC", "0xe7804c37c13166ff0b37f5ae0bb07a3aebb6e245"], + ["USDC", "MATIC", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["USDC", "RON", "0x030e37ddd7df1b43db172b23916d523f1599c6cb"], + ["USDC", "RON", "0xb32e9a84ae0b55b8ab715e4ac793a61b277bafa3"], + ["USDC", "SOL", "2ojv9BAiHUrvsm9gxDe7fJSzbNZSJcxZvf8dqmWGHG8S"], + ["USDC", "SOL", "5tzFkiKscXHK5ZXCGbXZxdw7gTjjD1mBwuoFbhUvuAi9"], + ["USDC", "SOL", "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM"], + ["USDC", "TRX", "address/TJDENsfBJs4RFETt1X1W8wMDc8M5XnJhCe"], + ["USDC", "TRX", "address/TNXoiAJ3dct8Fjg4M9fkLFh9S2v9TXc32G"], + ["USDC", "TRX", "address/TV6MuMXfmLbBqPZvBHdwFsDnQeVfnmiuSi"], + ["USDC", "TRX", "address/TWd4WrZ9wn84f5x1hZhL4DHvk738ns5jwb"], + ["USDC", "XLM", "public/account/GBAIA5U6E3FSRUW55AXACIVGX2QR5JYAS74OWLED3S22EGXVYEHPLGPA"], + ["USDC", "XLM", "public/account/GC5LF63GRVIT5ZXXCXLPI3RX2YXKJQFZVBSAO6AUELN3YIMSWPD6Z6FH"], + ["USDT", "ARBITRUM", "0xb38e8c17e38363af6ebdcb3dae12e0243582891d"], + ["USDT", "AVAXC", "0x21a31ee1afc51d94c2efccaa2092ad1028285549"], + ["USDT", "AVAXC", "0x4aefa39caeadd662ae31ab0ce7c8c2c9c0a013e8"], + ["USDT", "AVAXC", "0x9f8c163cba728e99993abe7495f06c0a3c8ac8b9"], + ["USDT", "BEP2", "bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz"], + ["USDT", "BEP2", "bnb1lsmt5a8vqqus5fwslx8pyyemgjtg4y6ugj308t"], + ["USDT", "BEP2", "bnb1m5amny2gs3xdyta6pksmr43zu4727w24syyks7"], + ["USDT", "BEP2", "bnb1xrfwzlu9c5208lhtn7ywt0mjrhjh4nt4fjyqxy"], + ["USDT", "BEP20", "0x01c952174c24e1210d26961d456a77a39e1f0bb0"], + ["USDT", "BEP20", "0x161ba15a5f335c9f06bb5bbb0a9ce14076fbb645"], + ["USDT", "BEP20", "0x1fbe2acee135d991592f167ac371f3dd893a508b"], + ["USDT", "BEP20", "0x21a31ee1afc51d94c2efccaa2092ad1028285549"], + ["USDT", "BEP20", "0x29bdfbf7d27462a2d115748ace2bd71a2646946c"], + ["USDT", "BEP20", "0x3c783c21a0383057d128bae431894a5c19f9cf06"], + ["USDT", "BEP20", "0x515b72ed8a97f42c568d6a143232775018f133c8"], + ["USDT", "BEP20", "0x5a52e96bacdabb82fd05763e25335261b270efcb"], + ["USDT", "BEP20", "0x73f5ebe90f27b46ea12e5795d16c4b408b19cc6f"], + ["USDT", "BEP20", "0x8894e0a0c962cb723c1976a4421c95949be2d4e3"], + ["USDT", "BEP20", "0x9696f59e4d72e237be84ffd425dcad154bf96976"], + ["USDT", "BEP20", "0xBE0eB53F46cd790Cd13851d5EFf43D12404d33E8"], + ["USDT", "BEP20", "0xa180fe01b906a1be37be6c534a3300785b20d947"], + ["USDT", "BEP20", "0xbd612a3f30dca67bf60a39fd0d35e39b7ab80774"], + ["USDT", "BEP20", "0xdccf3b77da55107280bd850ea519df3705d1a75a"], ["USDT", "BEP20", "0xe2fc31f816a9b94326492132018c3aecc4a93ae1"], ["USDT", "BEP20", "0xeb2d2f1b8c558a40207669291fda468e50c8a0bb"], - ["CRV", "ETH", "0xf977814e90da44bfa03b6295a0616a897441acec"], - ["BNB", "ETH", "0x28c6c06298d514db089934071355e5743bf21d60"], - ["USDT", "ETH", "0x5a52e96bacdabb82fd05763e25335261b270efcb"], //add on 07/08/2023 - ["CHR", "ETH", "0x5a52e96bacdabb82fd05763e25335261b270efcb"], - ["CVP", "ETH", "0xf977814e90da44bfa03b6295a0616a897441acec"], - ["XRP", "BEP20", "0xe2fc31f816a9b94326492132018c3aecc4a93ae1"], - ["HFT", "ETH", "0xf977814e90da44bfa03b6295a0616a897441acec"], - ["ENJ", "ETH", "0xf977814e90da44bfa03b6295a0616a897441acec"], - ["LTC", "LTC", "MWGTiJBNEQSfxTCrdC2VKEa55Lck27wr67"], - ["LTC", "LTC", "MLkNzCps6cXou2DELVfxDuRC4uZGwr397o"], - //["LTC", "LTC", "MRwsBPhSteTreKQrNE6BXU1U33PMsn8jCS"], - ["LTC", "LTC", "MBjKmoDwkuUbtnVd4vjymxjJx7Crca2s1z"], - ["LTC", "LTC", "MJwFHGandYUFJTTHHSXg3q6u7ge4af1n4N"], - ["LTC", "LTC", "MQd1fJwqBJvwLuyhr17PhEFx1swiqDbPQS"], - ["LTC", "LTC", "MSeDRiNoH5Afr9b9rNo837hYzpxBXXqMZf"], - ["LTC", "LTC", "M8T1B2Z97gVdvmfkQcAtYbEepune1tzGua"], - ["LTC", "LTC", "LZEjckteAtWrugbsy9zU8VHEZ4iUiXo9Nm"], - ["LTC", "LTC", "MDwD5wYdeuoisfoaWKgeHK4Gq3YkbaCypJ"], //add on 07/08/2023 - ["LTC", "LTC", "MVfJZDUEnPniCTYgidV7qW9EaPJoDMjb6b"], //add on 07/08/2023 - ["MATIC", "MATIC", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["USDT", "BEP20", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["USDT", "ETH", "0x21a31ee1afc51d94c2efccaa2092ad1028285549"], + ["USDT", "ETH", "0x28c6c06298d514db089934071355e5743bf21d60"], + ["USDT", "ETH", "0x4976a4a02f38326660d17bf34b431dc6e2eb2327"], + ["USDT", "ETH", "0x56eddb7aa87536c09ccc2793473599fd21a8b17f"], + ["USDT", "ETH", "0x5a52e96bacdabb82fd05763e25335261b270efcb"], + ["USDT", "ETH", "0x9696f59e4d72e237be84ffd425dcad154bf96976"], + ["USDT", "ETH", "0xbe0eb53f46cd790cd13851d5eff43d12404d33e8"], + ["USDT", "ETH", "0xdfd5293d8e347dfe59e90efd55b2956a1343963d"], + ["USDT", "ETH", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["USDT", "MATIC", "0x082489a616ab4d46d1947ee3f912e080815b08da"], + ["USDT", "MATIC", "0x5a52E96BAcdaBb82fd05763E25335261B270Efcb"], ["USDT", "MATIC", "0xe7804c37c13166ff0b37f5ae0bb07a3aebb6e245"], - ["BUSD", "MATIC", "0xf977814e90da44bfa03b6295a0616a897441acec"], - ["MATIC", "MATIC", "0xe7804c37c13166ff0b37f5ae0bb07a3aebb6e245"], - ["USDC", "MATIC", "0xe7804c37c13166ff0b37f5ae0bb07a3aebb6e245"], - ["MATIC", "MATIC", "0x082489a616ab4d46d1947ee3f912e080815b08da"], - ["USDC", "MATIC", "0x082489a616ab4d46d1947ee3f912e080815b08da"], ["USDT", "MATIC", "0xf977814e90da44bfa03b6295a0616a897441acec"], - ["BUSD", "MATIC", "0xe7804c37c13166ff0b37f5ae0bb07a3aebb6e245"], - ["ETH", "OP", "0xF977814e90dA44bFA03b6295A0616a897441aceC"], - ["ETH", "OP", "0xacd03d601e5bb1b275bb94076ff46ed9d753435a"], - ["BUSD", "OP", "0xacd03d601e5bb1b275bb94076ff46ed9d753435a"], - ["OP", "OP", "0xF977814e90dA44bFA03b6295A0616a897441aceC"], - ["OP", "OP", "0xacd03d601e5bb1b275bb94076ff46ed9d753435a"], - ["USDT", "OP", "0xacd03d601e5bb1b275bb94076ff46ed9d753435a"], ["USDT", "OP", "0xF977814e90dA44bFA03b6295A0616a897441aceC"], - ["XRP", "XRP", "rNU4eAowPuixS5ZCWaRL72UUeKgxcKExpK"], - ["XRP", "XRP", "rs8ZPbYqgecRcDzQpJYAMhSxSi5htsjnza"], + ["USDT", "OP", "0xacd03d601e5bb1b275bb94076ff46ed9d753435a"], + ["USDT", "SOL", "2ojv9BAiHUrvsm9gxDe7fJSzbNZSJcxZvf8dqmWGHG8S"], + ["USDT", "SOL", "5tzFkiKscXHK5ZXCGbXZxdw7gTjjD1mBwuoFbhUvuAi9"], + ["USDT", "SOL", "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM"], + ["USDT", "TRX", "address/TAzsQ9Gx8eqFNFSKbeXrbi45CuVPHzA8wr"], + ["USDT", "TRX", "address/TJCo98saj6WND61g1uuKwJ9GMWMT9WkJFo"], + ["USDT", "TRX", "address/TJDENsfBJs4RFETt1X1W8wMDc8M5XnJhCe"], + ["USDT", "TRX", "address/TMuA6YqfCeX8EhbfYEg5y7S4DqzSJireY9"], + ["USDT", "TRX", "address/TNXoiAJ3dct8Fjg4M9fkLFh9S2v9TXc32G"], + ["USDT", "TRX", "address/TQrY8tryqsYVCYS3MFbtffiPp2ccyn4STm"], + ["USDT", "TRX", "address/TV6MuMXfmLbBqPZvBHdwFsDnQeVfnmiuSi"], + ["USDT", "TRX", "address/TWd4WrZ9wn84f5x1hZhL4DHvk738ns5jwb"], + ["USDT", "TRX", "address/TYASr5UV6HEcXatwdFQfmLVUqQQQMUxHLS"], + ["WRX", "BEP2", "bnb142q467df6jun6rt5u2ar58sp47hm5f9wvz2cvg"], + ["WRX", "BEP2", "bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz"], + ["WRX", "BEP2", "bnb1lsmt5a8vqqus5fwslx8pyyemgjtg4y6ugj308t"], + ["WRX", "BEP2", "bnb1u2agwjat20494fmc6jnuau0ls937cfjn4pjwtn"], + ["WRX", "BEP20", "0x8894e0a0c962cb723c1976a4421c95949be2d4e3"], + ["WRX", "BEP20", "0xe2fc31f816a9b94326492132018c3aecc4a93ae1"], + ["WRX", "BEP20", "0xeb2d2f1b8c558a40207669291fda468e50c8a0bb"], + ["WRX", "ETH", "0x21a31ee1afc51d94c2efccaa2092ad1028285549"], + ["WRX", "ETH", "0x28c6c06298d514db089934071355e5743bf21d60"], + ["WRX", "ETH", "0xbe0eb53f46cd790cd13851d5eff43d12404d33e8"], + ["WRX", "ETH", "0xdfd5293d8e347dfe59e90efd55b2956a1343963d"], + ["WRX", "ETH", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["XRP", "BEP2", "bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz"], + ["XRP", "BEP2", "bnb1lsmt5a8vqqus5fwslx8pyyemgjtg4y6ugj308t"], + ["XRP", "BEP2", "bnb1u2agwjat20494fmc6jnuau0ls937cfjn4pjwtn"], + ["XRP", "BEP20", "0x5a52e96bacdabb82fd05763e25335261b270efcb"], + ["XRP", "BEP20", "0x8894e0a0c962cb723c1976a4421c95949be2d4e3"], + ["XRP", "BEP20", "0xbd612a3f30dca67bf60a39fd0d35e39b7ab80774"], + ["XRP", "BEP20", "0xe2fc31f816a9b94326492132018c3aecc4a93ae1"], + ["XRP", "BEP20", "0xeb2d2f1b8c558a40207669291fda468e50c8a0bb"], + ["XRP", "BEP20", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["XRP", "ETH", "0x21a31ee1afc51d94c2efccaa2092ad1028285549"], + ["XRP", "ETH", "0x28c6c06298d514db089934071355e5743bf21d60"], + ["XRP", "ETH", "0x5a52e96bacdabb82fd05763e25335261b270efcb"], + ["XRP", "ETH", "0xdfd5293d8e347dfe59e90efd55b2956a1343963d"], + ["XRP", "ETH", "0xf977814e90da44bfa03b6295a0616a897441acec"], ["XRP", "XRP", "rBtttd61FExHC68vsZ8dqmS3DfjFEceA1A"], ["XRP", "XRP", "rDAE53VfMvftPB4ogpWGWvzkQxfht6JPxr"], ["XRP", "XRP", "rEy8TFcrAPvhpKrwyrscNYyqBGUkE9hKaJ"], - ["USDT", "SOL", "5tzFkiKscXHK5ZXCGbXZxdw7gTjjD1mBwuoFbhUvuAi9"], - ["SOL", "SOL", "3yFwqXBfZY4jBVUafQ1YEXw189y2dN3V5KQq9uzBDy1E"], - ["USDC", "SOL", "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM"], - ["USDT", "SOL", "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM"], - ["SOL", "SOL", "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM"], - ["SOL", "SOL", "2ojv9BAiHUrvsm9gxDe7fJSzbNZSJcxZvf8dqmWGHG8S"], - ["USDC", "SOL", "5tzFkiKscXHK5ZXCGbXZxdw7gTjjD1mBwuoFbhUvuAi9"], - ["SOL", "SOL", "5tzFkiKscXHK5ZXCGbXZxdw7gTjjD1mBwuoFbhUvuAi9"], - ["DOT", "DOT", "1743nDTMZisPgBCYSAgkUn1kVG7MePc9rvMEjoRNf4ipVkF"], - ["DOT", "DOT", "1qnJN7FViy3HZaxZK9tGAA71zxHSBeUweirKqCaox4t8GT7"], - ["DOT", "DOT", "16ZL8yLyXv3V3L3z9ofR1ovFLziyXaN1DPq4yffMAZ9czzBD"], - //new chains - ["USDC", "ALGO", "MTCEM5YJJSYGW2RCXYXGE4SXLSPUUEJKQAWG2GUX6CNN72KQ3XPJCM6NOI"], - ["ALGO", "ALGO", "MTCEM5YJJSYGW2RCXYXGE4SXLSPUUEJKQAWG2GUX6CNN72KQ3XPJCM6NOI"], - ["USDC", "ALGO", "QYXDGS2XJJT7QNR6EJ2YHNZFONU6ROFM6BKTBNVT63ZXQ5OC6IYSPNDJ4U"], - ["ALGO", "ALGO", "QYXDGS2XJJT7QNR6EJ2YHNZFONU6ROFM6BKTBNVT63ZXQ5OC6IYSPNDJ4U"], - ["APT", "APT", "0xed8c46bec9dbc2b23c60568f822b95b87ea395f7e3fdb5e3adc0a30c55c0a60e"], - ["APT", "APT", "0xae1a6f3d3daccaf77b55044cea133379934bba04a11b9d0bbd643eae5e6e9c70"], - ["APT", "APT", "0xd91c64b777e51395c6ea9dec562ed79a4afa0cd6dad5a87b187c37198a1f855a"], - ["APT", "APT", "0x80174e0fe8cb2d32b038c6c888dd95c3e1560736f0d4a6e8bed6ae43b5c91f6f"], - ["APT", "APT", "0x5bd7de5c56d5691f32ea86c973c73fec7b1445e59736c97158020018c080bb00"], - //new tokens UNI - ["UNI", "BEP2", "bnb142q467df6jun6rt5u2ar58sp47hm5f9wvz2cvg"], - ["UNI", "BEP2", "bnb1u2agwjat20494fmc6jnuau0ls937cfjn4pjwtn"], - ["UNI", "BEP2", "bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz"], - ["UNI", "BEP2", "bnb1lsmt5a8vqqus5fwslx8pyyemgjtg4y6ugj308t"], - ["UNI", "ETH", "0xf977814e90da44bfa03b6295a0616a897441acec"], - ["UNI", "ETH", "0x21a31ee1afc51d94c2efccaa2092ad1028285549"], - ["UNI", "ETH", "0x5a52e96bacdabb82fd05763e25335261b270efcb"], - ["UNI", "ETH", "0xbe0eb53f46cd790cd13851d5eff43d12404d33e8"], - ["UNI", "ETH", "0xdfd5293d8e347dfe59e90efd55b2956a1343963d"], - ["UNI", "ETH", "0x28c6c06298d514db089934071355e5743bf21d60"], - //new token ARB - ["ARB", "ARB", "0xf977814e90da44bfa03b6295a0616a897441acec"], - ["ARB", "ARB", "0xb38e8c17e38363af6ebdcb3dae12e0243582891d"], - ["ARB", "ETH", "0x28c6c06298d514db089934071355e5743bf21d60"], - ["ARB", "ARB", "0xf92402bb795fd7cd08fb83839689db79099c8c9c"], - // ["USDC", "ETH", "0xf8d3e5fe8bb885325d98a751a30a1573e887a953"], removed 06/07/2023 - // ["USDC", "ETH", "0xeae7380dd4cef6fbd1144f49e4d1e6964258a4f4"], removed 06/07/2023 - // ["USDC", "ETH", "0x95e63f78bd2fd5ea8a0d58182f3d998558881fda"], removed 06/07/2023 - // ["USDC", "ETH", "0x39e2d89f4b4708077a48d75c5cf2ab059a4b3e48"], removed 06/07/2023 - // ["USDC", "ETH", "0x558a87a7c8b79ffb66a3d10a4a2de8c73a46707d"], removed 06/07/2023 - // ["USDC", "ETH", "0xf033bce292bcaaf998ca13755104a4b23c04af5c"], removed 06/07/2023 - ["LTC", "LTC", "LbmGksLBwtwRXyxeazCZqKiAHX6cWN2AzN"], - ["LTC", "LTC", "LhzEoDXHXASi4hSMxrKeVoSGrED9QsBpPq"], - ["LTC", "LTC", "MB8nnFMvR5cgvpzQ1QXTDVfUM91BcsLH3k"], - // ["USDC", "TRX", "TDjPeMNaRxoNMwENrdtNYmZt1YAfVVjp59"], removed 06/07/2023 - // ["USDC", "TRX", "TL6VgVKo6natQb6hW5Hy2jcyX5EHgmwXLE"], removed 06/07/2023 - ["BTC", "BTC", "1Pzaqw98PeRfyHypfqyEgg5yycJRsENrE7"], // new wallet https://twitter.com/binance/status/1670723088802283520 - ["BTC", "BTC", "39884E3j6KZj82FK4vcCrkUvWYL5MQaS3v"], // new wallet that got 3.1b - ["TUSD", "BEP2", "bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz"], - ["TUSD", "BEP20", "0xf977814e90da44bfa03b6295a0616a897441acec"], - ["TUSD", "BEP20", "0x8894e0a0c962cb723c1976a4421c95949be2d4e3"], - ["TUSD", "BEP20", "0xe2fc31f816a9b94326492132018c3aecc4a93ae1"], - ["TUSD", "ETH", "0x21a31ee1afc51d94c2efccaa2092ad1028285549"], - ["TUSD", "ETH", "0x28c6c06298d514db089934071355e5743bf21d60"], - ["TUSD", "ETH", "0xdfd5293d8e347dfe59e90efd55b2956a1343963d"], - ["TUSD", "ETH", "0xf977814e90da44bfa03b6295a0616a897441acec"], - ["TUSD", "ETH", "0x5a52e96bacdabb82fd05763e25335261b270efcb"], - ["TUSD", "TRX", "TNXoiAJ3dct8Fjg4M9fkLFh9S2v9TXc32G"], - ["TUSD", "TRX", "TV6MuMXfmLbBqPZvBHdwFsDnQeVfnmiuSi"], - ["TUSD", "TRX", "TWd4WrZ9wn84f5x1hZhL4DHvk738ns5jwb"], - ["TUSD", "TRX", "TJCo98saj6WND61g1uuKwJ9GMWMT9WkJFo"], + ["XRP", "XRP", "rNU4eAowPuixS5ZCWaRL72UUeKgxcKExpK"], + ["XRP", "XRP", "rs8ZPbYqgecRcDzQpJYAMhSxSi5htsjnza"], ] function getAddresses(chain) { @@ -425,7 +530,7 @@ module.exports = { polygon: { owners: getOwners('MATIC') }, - optimism: { + OP: { owners: getOwners('OP') }, ripple: { From 5ebf5e09c72b9f8f329a1078de294af6b58dafdf Mon Sep 17 00:00:00 2001 From: define Date: Thu, 7 Sep 2023 12:31:50 +0100 Subject: [PATCH 1137/1974] test config --- projects/binance/config.js | 138 ++++++++++++++++++------------------- 1 file changed, 68 insertions(+), 70 deletions(-) diff --git a/projects/binance/config.js b/projects/binance/config.js index bb174546739..f562972e008 100644 --- a/projects/binance/config.js +++ b/projects/binance/config.js @@ -54,36 +54,36 @@ const assetList = [ ["BTC", "BEP20", "0x8894e0a0c962cb723c1976a4421c95949be2d4e3"], ["BTC", "BEP20", "0xe2fc31f816a9b94326492132018c3aecc4a93ae1"], ["BTC", "BEP20", "0xf977814e90da44bfa03b6295a0616a897441acec"], - ["BTC", "BTC", "search/1Pzaqw98PeRfyHypfqyEgg5yycJRsENrE7"], - ["BTC", "BTC", "search/34GUzCVLbdkMQ2UdVTaA4nxPwoovVS7y2J"], - ["BTC", "BTC", "search/34HpHYiyQwg69gFmCq2BGHjF1DZnZnBeBP"], - ["BTC", "BTC", "search/34xp4vRoCGJym3xR7yCVPFHoCNxv4Twseo"], - ["BTC", "BTC", "search/36zSLdRv1jyewjaC12fqK5fptn7PqewunL"], - ["BTC", "BTC", "search/38DN2uFMZPiHLHJigfv4kWC9JWJrNnhLcn"], - ["BTC", "BTC", "search/38Xnrq8MZiKmYmwobbYdZQ5nnCbX1qvQfE"], - ["BTC", "BTC", "search/395vnFScKQ1ay695C6v7gf89UzoFpx3WuJ"], - ["BTC", "BTC", "search/39884E3j6KZj82FK4vcCrkUvWYL5MQaS3v"], - ["BTC", "BTC", "search/3AeUiDpPPUrUBS377584sFCpx8KLfpX9Ry"], - ["BTC", "BTC", "search/3AtnehKDkFPC1bKvdrEVPSRGCtxQH8F1R8"], - ["BTC", "BTC", "search/3CySuFKbBS29M7rE5iJakZRNqb3msMeFoN"], - ["BTC", "BTC", "search/3EbJfpmFgufYtzW9UFvf1GAfm2ted1Rwnr"], - ["BTC", "BTC", "search/3FHNBLobJnbCTFTVakh5TXmEneyf5PT61B"], - ["BTC", "BTC", "search/3HdGoUTbcztBnS7UzY4vSPYhwr424CiWAA"], - ["BTC", "BTC", "search/3JFJPpH8Chwo7CDbyYQ4XcfgcjEP1FGRMJ"], - ["BTC", "BTC", "search/3JJmF63ifcamPLiAmLgG96RA599yNtY3EQ"], - ["BTC", "BTC", "search/3LQUu4v9z6KNch71j7kbj8GPeAGUo1FW6a"], - ["BTC", "BTC", "search/3LcgLHzTvjLKBixBvkKGiadtiw2GBSKKqH"], - ["BTC", "BTC", "search/3M219KR5vEneNb47ewrPfWyb5jQ2DjxRP6"], - ["BTC", "BTC", "search/3Me9QACjioepv2L2oKTC9QQ87NH6vFe1Zj"], - ["BTC", "BTC", "search/3NXCvmLGz9SxYi6TnjbBQfQMcwiZ1iQETa"], - ["BTC", "BTC", "search/3Qxak1CZhLyZ7GVckKphLURdLBCjMfz9bA"], - ["BTC", "BTC", "search/bc1qm34lsc65zpw79lxes69zkqmk6ee3ewf0j77s3h"], + ["BTC", "BTC", "1Pzaqw98PeRfyHypfqyEgg5yycJRsENrE7"], + ["BTC", "BTC", "34GUzCVLbdkMQ2UdVTaA4nxPwoovVS7y2J"], + ["BTC", "BTC", "34HpHYiyQwg69gFmCq2BGHjF1DZnZnBeBP"], + ["BTC", "BTC", "34xp4vRoCGJym3xR7yCVPFHoCNxv4Twseo"], + ["BTC", "BTC", "36zSLdRv1jyewjaC12fqK5fptn7PqewunL"], + ["BTC", "BTC", "38DN2uFMZPiHLHJigfv4kWC9JWJrNnhLcn"], + ["BTC", "BTC", "38Xnrq8MZiKmYmwobbYdZQ5nnCbX1qvQfE"], + ["BTC", "BTC", "395vnFScKQ1ay695C6v7gf89UzoFpx3WuJ"], + ["BTC", "BTC", "39884E3j6KZj82FK4vcCrkUvWYL5MQaS3v"], + ["BTC", "BTC", "3AeUiDpPPUrUBS377584sFCpx8KLfpX9Ry"], + ["BTC", "BTC", "3AtnehKDkFPC1bKvdrEVPSRGCtxQH8F1R8"], + ["BTC", "BTC", "3CySuFKbBS29M7rE5iJakZRNqb3msMeFoN"], + ["BTC", "BTC", "3EbJfpmFgufYtzW9UFvf1GAfm2ted1Rwnr"], + ["BTC", "BTC", "3FHNBLobJnbCTFTVakh5TXmEneyf5PT61B"], + ["BTC", "BTC", "3HdGoUTbcztBnS7UzY4vSPYhwr424CiWAA"], + ["BTC", "BTC", "3JFJPpH8Chwo7CDbyYQ4XcfgcjEP1FGRMJ"], + ["BTC", "BTC", "3JJmF63ifcamPLiAmLgG96RA599yNtY3EQ"], + ["BTC", "BTC", "LQUu4v9z6KNch71j7kbj8GPeAGUo1FW6a"], + ["BTC", "BTC", "3LcgLHzTvjLKBixBvkKGiadtiw2GBSKKqH"], + ["BTC", "BTC", "3M219KR5vEneNb47ewrPfWyb5jQ2DjxRP6"], + ["BTC", "BTC", "3Me9QACjioepv2L2oKTC9QQ87NH6vFe1Zj"], + ["BTC", "BTC", "3NXCvmLGz9SxYi6TnjbBQfQMcwiZ1iQETa"], + ["BTC", "BTC", "3Qxak1CZhLyZ7GVckKphLURdLBCjMfz9bA"], + ["BTC", "BTC", "bc1qm34lsc65zpw79lxes69zkqmk6ee3ewf0j77s3h"], ["BTC", "ETH", "0x21a31ee1afc51d94c2efccaa2092ad1028285549"], ["BTC", "ETH", "0x28c6c06298d514db089934071355e5743bf21d60"], ["BTC", "ETH", "0xdfd5293d8e347dfe59e90efd55b2956a1343963d"], ["BTC", "ETH", "0xf977814e90da44bfa03b6295a0616a897441acec"], - ["BUSD", "AVAXC", "0x4aefa39caeadd662ae31ab0ce7c8c2c9c0a013e8"], - ["BUSD", "AVAXC", "0x9f8c163cba728e99993abe7495f06c0a3c8ac8b9"], + ["BUSD", "AVAX", "0x4aefa39caeadd662ae31ab0ce7c8c2c9c0a013e8"], + ["BUSD", "AVAX", "0x9f8c163cba728e99993abe7495f06c0a3c8ac8b9"], ["BUSD", "BEP2", "bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz"], ["BUSD", "BEP2", "bnb1lsmt5a8vqqus5fwslx8pyyemgjtg4y6ugj308t"], ["BUSD", "BEP2", "bnb1m5amny2gs3xdyta6pksmr43zu4727w24syyks7"], @@ -116,10 +116,10 @@ const assetList = [ ["BUSD", "MATIC", "0xf977814e90da44bfa03b6295a0616a897441acec"], ["BUSD", "OP", "0xF977814e90dA44bFA03b6295A0616a897441aceC"], ["BUSD", "OP", "0xacd03d601e5bb1b275bb94076ff46ed9d753435a"], - ["BUSD", "TRX", "address/TJCo98saj6WND61g1uuKwJ9GMWMT9WkJFo"], - ["BUSD", "TRX", "address/TNXoiAJ3dct8Fjg4M9fkLFh9S2v9TXc32G"], - ["BUSD", "TRX", "address/TV6MuMXfmLbBqPZvBHdwFsDnQeVfnmiuSi"], - ["BUSD", "TRX", "address/TWd4WrZ9wn84f5x1hZhL4DHvk738ns5jwb"], + ["BUSD", "TRX", "TJCo98saj6WND61g1uuKwJ9GMWMT9WkJFo"], + ["BUSD", "TRX", "TNXoiAJ3dct8Fjg4M9fkLFh9S2v9TXc32G"], + ["BUSD", "TRX", "TV6MuMXfmLbBqPZvBHdwFsDnQeVfnmiuSi"], + ["BUSD", "TRX", "TWd4WrZ9wn84f5x1hZhL4DHvk738ns5jwb"], ["CHR", "BEP20", "0x5a52e96bacdabb82fd05763e25335261b270efcb"], ["CHR", "BEP20", "0x8894e0a0c962cb723c1976a4421c95949be2d4e3"], ["CHR", "BEP20", "0xe2fc31f816a9b94326492132018c3aecc4a93ae1"], @@ -257,21 +257,21 @@ const assetList = [ ["LTC", "BEP20", "0x8894e0a0c962cb723c1976a4421c95949be2d4e3"], ["LTC", "BEP20", "0xe2fc31f816a9b94326492132018c3aecc4a93ae1"], ["LTC", "BEP20", "0xf977814e90da44bfa03b6295a0616a897441acec"], - ["LTC", "LTC", "address/LZEjckteAtWrugbsy9zU8VHEZ4iUiXo9Nm"], - ["LTC", "LTC", "address/LbmGksLBwtwRXyxeazCZqKiAHX6cWN2AzN"], - ["LTC", "LTC", "address/LhzEoDXHXASi4hSMxrKeVoSGrED9QsBpPq"], - ["LTC", "LTC", "address/M8T1B2Z97gVdvmfkQcAtYbEepune1tzGua"], - ["LTC", "LTC", "address/MB8nnFMvR5cgvpzQ1QXTDVfUM91BcsLH3k"], - ["LTC", "LTC", "address/MBjKmoDwkuUbtnVd4vjymxjJx7Crca2s1z"], - ["LTC", "LTC", "address/MDwD5wYdeuoisfoaWKgeHK4Gq3YkbaCypJ"], - ["LTC", "LTC", "address/MEhAHYijouCinmGKL6n1bRTXYznH1X24rD"], - ["LTC", "LTC", "address/MJto5wFLrE9t4TDXCgdSet8W6mxYqGijC3"], - ["LTC", "LTC", "address/MJwFHGandYUFJTTHHSXg3q6u7ge4af1n4N"], - ["LTC", "LTC", "address/MLkNzCps6cXou2DELVfxDuRC4uZGwr397o"], - ["LTC", "LTC", "address/MQd1fJwqBJvwLuyhr17PhEFx1swiqDbPQS"], - ["LTC", "LTC", "address/MSeDRiNoH5Afr9b9rNo837hYzpxBXXqMZf"], - ["LTC", "LTC", "address/MWGTiJBNEQSfxTCrdC2VKEa55Lck27wr67"], - ["LTC", "LTC", "address/MWkX1ZaFbrRPtcQvVpjvigxWU17JoinePy"], + ["LTC", "LTC", "LZEjckteAtWrugbsy9zU8VHEZ4iUiXo9Nm"], + ["LTC", "LTC", "LbmGksLBwtwRXyxeazCZqKiAHX6cWN2AzN"], + ["LTC", "LTC", "LhzEoDXHXASi4hSMxrKeVoSGrED9QsBpPq"], + ["LTC", "LTC", "M8T1B2Z97gVdvmfkQcAtYbEepune1tzGua"], + ["LTC", "LTC", "MB8nnFMvR5cgvpzQ1QXTDVfUM91BcsLH3k"], + ["LTC", "LTC", "MBjKmoDwkuUbtnVd4vjymxjJx7Crca2s1z"], + ["LTC", "LTC", "MDwD5wYdeuoisfoaWKgeHK4Gq3YkbaCypJ"], + ["LTC", "LTC", "MEhAHYijouCinmGKL6n1bRTXYznH1X24rD"], + ["LTC", "LTC", "MJto5wFLrE9t4TDXCgdSet8W6mxYqGijC3"], + ["LTC", "LTC", "MJwFHGandYUFJTTHHSXg3q6u7ge4af1n4N"], + ["LTC", "LTC", "MLkNzCps6cXou2DELVfxDuRC4uZGwr397o"], + ["LTC", "LTC", "MQd1fJwqBJvwLuyhr17PhEFx1swiqDbPQS"], + ["LTC", "LTC", "MSeDRiNoH5Afr9b9rNo837hYzpxBXXqMZf"], + ["LTC", "LTC", "MWGTiJBNEQSfxTCrdC2VKEa55Lck27wr67"], + ["LTC", "LTC", "MWkX1ZaFbrRPtcQvVpjvigxWU17JoinePy"], ["MASK", "BEP20", "0x5a52e96bacdabb82fd05763e25335261b270efcb"], ["MASK", "BEP20", "0x8894e0a0c962cb723c1976a4421c95949be2d4e3"], ["MASK", "BEP20", "0xe2fc31f816a9b94326492132018c3aecc4a93ae1"], @@ -347,10 +347,10 @@ const assetList = [ ["TUSD", "ETH", "0x5a52e96bacdabb82fd05763e25335261b270efcb"], ["TUSD", "ETH", "0xdfd5293d8e347dfe59e90efd55b2956a1343963d"], ["TUSD", "ETH", "0xf977814e90da44bfa03b6295a0616a897441acec"], - ["TUSD", "TRX", "address/TJCo98saj6WND61g1uuKwJ9GMWMT9WkJFo"], - ["TUSD", "TRX", "address/TNXoiAJ3dct8Fjg4M9fkLFh9S2v9TXc32G"], - ["TUSD", "TRX", "address/TV6MuMXfmLbBqPZvBHdwFsDnQeVfnmiuSi"], - ["TUSD", "TRX", "address/TWd4WrZ9wn84f5x1hZhL4DHvk738ns5jwb"], + ["TUSD", "TRX", "TJCo98saj6WND61g1uuKwJ9GMWMT9WkJFo"], + ["TUSD", "TRX", "TNXoiAJ3dct8Fjg4M9fkLFh9S2v9TXc32G"], + ["TUSD", "TRX", "TV6MuMXfmLbBqPZvBHdwFsDnQeVfnmiuSi"], + ["TUSD", "TRX", "TWd4WrZ9wn84f5x1hZhL4DHvk738ns5jwb"], ["UNI", "BEP2", "bnb142q467df6jun6rt5u2ar58sp47hm5f9wvz2cvg"], ["UNI", "BEP2", "bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz"], ["UNI", "BEP2", "bnb1lsmt5a8vqqus5fwslx8pyyemgjtg4y6ugj308t"], @@ -369,8 +369,8 @@ const assetList = [ ["USDC", "ALGO", "MTCEM5YJJSYGW2RCXYXGE4SXLSPUUEJKQAWG2GUX6CNN72KQ3XPJCM6NOI"], ["USDC", "ALGO", "QYXDGS2XJJT7QNR6EJ2YHNZFONU6ROFM6BKTBNVT63ZXQ5OC6IYSPNDJ4U"], ["USDC", "ARBITRUM", "0xb38e8c17e38363af6ebdcb3dae12e0243582891d"], - ["USDC", "AVAXC", "0x4aefa39caeadd662ae31ab0ce7c8c2c9c0a013e8"], - ["USDC", "AVAXC", "0x9f8c163cba728e99993abe7495f06c0a3c8ac8b9"], + ["USDC", "AVAX", "0x4aefa39caeadd662ae31ab0ce7c8c2c9c0a013e8"], + ["USDC", "AVAX", "0x9f8c163cba728e99993abe7495f06c0a3c8ac8b9"], ["USDC", "BEP2", "bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz"], ["USDC", "BEP20", "0x1fbe2acee135d991592f167ac371f3dd893a508b"], ["USDC", "BEP20", "0x29bdfbf7d27462a2d115748ace2bd71a2646946c"], @@ -396,16 +396,14 @@ const assetList = [ ["USDC", "SOL", "2ojv9BAiHUrvsm9gxDe7fJSzbNZSJcxZvf8dqmWGHG8S"], ["USDC", "SOL", "5tzFkiKscXHK5ZXCGbXZxdw7gTjjD1mBwuoFbhUvuAi9"], ["USDC", "SOL", "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM"], - ["USDC", "TRX", "address/TJDENsfBJs4RFETt1X1W8wMDc8M5XnJhCe"], - ["USDC", "TRX", "address/TNXoiAJ3dct8Fjg4M9fkLFh9S2v9TXc32G"], - ["USDC", "TRX", "address/TV6MuMXfmLbBqPZvBHdwFsDnQeVfnmiuSi"], - ["USDC", "TRX", "address/TWd4WrZ9wn84f5x1hZhL4DHvk738ns5jwb"], - ["USDC", "XLM", "public/account/GBAIA5U6E3FSRUW55AXACIVGX2QR5JYAS74OWLED3S22EGXVYEHPLGPA"], - ["USDC", "XLM", "public/account/GC5LF63GRVIT5ZXXCXLPI3RX2YXKJQFZVBSAO6AUELN3YIMSWPD6Z6FH"], + ["USDC", "TRX", "TJDENsfBJs4RFETt1X1W8wMDc8M5XnJhCe"], + ["USDC", "TRX", "TNXoiAJ3dct8Fjg4M9fkLFh9S2v9TXc32G"], + ["USDC", "TRX", "TV6MuMXfmLbBqPZvBHdwFsDnQeVfnmiuSi"], + ["USDC", "TRX", "TWd4WrZ9wn84f5x1hZhL4DHvk738ns5jwb"], ["USDT", "ARBITRUM", "0xb38e8c17e38363af6ebdcb3dae12e0243582891d"], - ["USDT", "AVAXC", "0x21a31ee1afc51d94c2efccaa2092ad1028285549"], - ["USDT", "AVAXC", "0x4aefa39caeadd662ae31ab0ce7c8c2c9c0a013e8"], - ["USDT", "AVAXC", "0x9f8c163cba728e99993abe7495f06c0a3c8ac8b9"], + ["USDT", "AVAX", "0x21a31ee1afc51d94c2efccaa2092ad1028285549"], + ["USDT", "AVAX", "0x4aefa39caeadd662ae31ab0ce7c8c2c9c0a013e8"], + ["USDT", "AVAX", "0x9f8c163cba728e99993abe7495f06c0a3c8ac8b9"], ["USDT", "BEP2", "bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz"], ["USDT", "BEP2", "bnb1lsmt5a8vqqus5fwslx8pyyemgjtg4y6ugj308t"], ["USDT", "BEP2", "bnb1m5amny2gs3xdyta6pksmr43zu4727w24syyks7"], @@ -446,15 +444,15 @@ const assetList = [ ["USDT", "SOL", "2ojv9BAiHUrvsm9gxDe7fJSzbNZSJcxZvf8dqmWGHG8S"], ["USDT", "SOL", "5tzFkiKscXHK5ZXCGbXZxdw7gTjjD1mBwuoFbhUvuAi9"], ["USDT", "SOL", "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM"], - ["USDT", "TRX", "address/TAzsQ9Gx8eqFNFSKbeXrbi45CuVPHzA8wr"], - ["USDT", "TRX", "address/TJCo98saj6WND61g1uuKwJ9GMWMT9WkJFo"], - ["USDT", "TRX", "address/TJDENsfBJs4RFETt1X1W8wMDc8M5XnJhCe"], - ["USDT", "TRX", "address/TMuA6YqfCeX8EhbfYEg5y7S4DqzSJireY9"], - ["USDT", "TRX", "address/TNXoiAJ3dct8Fjg4M9fkLFh9S2v9TXc32G"], - ["USDT", "TRX", "address/TQrY8tryqsYVCYS3MFbtffiPp2ccyn4STm"], - ["USDT", "TRX", "address/TV6MuMXfmLbBqPZvBHdwFsDnQeVfnmiuSi"], - ["USDT", "TRX", "address/TWd4WrZ9wn84f5x1hZhL4DHvk738ns5jwb"], - ["USDT", "TRX", "address/TYASr5UV6HEcXatwdFQfmLVUqQQQMUxHLS"], + ["USDT", "TRX", "TAzsQ9Gx8eqFNFSKbeXrbi45CuVPHzA8wr"], + ["USDT", "TRX", "TJCo98saj6WND61g1uuKwJ9GMWMT9WkJFo"], + ["USDT", "TRX", "TJDENsfBJs4RFETt1X1W8wMDc8M5XnJhCe"], + ["USDT", "TRX", "TMuA6YqfCeX8EhbfYEg5y7S4DqzSJireY9"], + ["USDT", "TRX", "TNXoiAJ3dct8Fjg4M9fkLFh9S2v9TXc32G"], + ["USDT", "TRX", "TQrY8tryqsYVCYS3MFbtffiPp2ccyn4STm"], + ["USDT", "TRX", "TV6MuMXfmLbBqPZvBHdwFsDnQeVfnmiuSi"], + ["USDT", "TRX", "TWd4WrZ9wn84f5x1hZhL4DHvk738ns5jwb"], + ["USDT", "TRX", "TYASr5UV6HEcXatwdFQfmLVUqQQQMUxHLS"], ["WRX", "BEP2", "bnb142q467df6jun6rt5u2ar58sp47hm5f9wvz2cvg"], ["WRX", "BEP2", "bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz"], ["WRX", "BEP2", "bnb1lsmt5a8vqqus5fwslx8pyyemgjtg4y6ugj308t"], @@ -530,7 +528,7 @@ module.exports = { polygon: { owners: getOwners('MATIC') }, - OP: { + optimism: { owners: getOwners('OP') }, ripple: { From 352752cda6df443b78406bb33b5a302dfd272de8 Mon Sep 17 00:00:00 2001 From: define Date: Thu, 7 Sep 2023 13:01:40 +0100 Subject: [PATCH 1138/1974] configs fixed --- projects/binance/config.js | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/projects/binance/config.js b/projects/binance/config.js index f562972e008..b2533c22e42 100644 --- a/projects/binance/config.js +++ b/projects/binance/config.js @@ -20,9 +20,9 @@ const assetList = [ ["APT", "APT", "0xae1a6f3d3daccaf77b55044cea133379934bba04a11b9d0bbd643eae5e6e9c70"], ["APT", "APT", "0xd91c64b777e51395c6ea9dec562ed79a4afa0cd6dad5a87b187c37198a1f855a"], ["APT", "APT", "0xed8c46bec9dbc2b23c60568f822b95b87ea395f7e3fdb5e3adc0a30c55c0a60e"], - ["ARB", "ARBITRUM", "0xb38e8c17e38363af6ebdcb3dae12e0243582891d"], - ["ARB", "ARBITRUM", "0xf92402bb795fd7cd08fb83839689db79099c8c9c"], - ["ARB", "ARBITRUM", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["ARB", "ARB", "0xb38e8c17e38363af6ebdcb3dae12e0243582891d"], + ["ARB", "ARB", "0xf92402bb795fd7cd08fb83839689db79099c8c9c"], + ["ARB", "ARB", "0xf977814e90da44bfa03b6295a0616a897441acec"], ["ARB", "ETH", "0x28c6c06298d514db089934071355e5743bf21d60"], ["BNB", "BEP2", "bnb142q467df6jun6rt5u2ar58sp47hm5f9wvz2cvg"], ["BNB", "BEP2", "bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz"], @@ -53,7 +53,7 @@ const assetList = [ ["BTC", "BEP20", "0x5a52e96bacdabb82fd05763e25335261b270efcb"], ["BTC", "BEP20", "0x8894e0a0c962cb723c1976a4421c95949be2d4e3"], ["BTC", "BEP20", "0xe2fc31f816a9b94326492132018c3aecc4a93ae1"], - ["BTC", "BEP20", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["BTC", "BEP20", "0xf977814e90da44bfa03b6295a0616a897441acec"], ["BTC", "BTC", "1Pzaqw98PeRfyHypfqyEgg5yycJRsENrE7"], ["BTC", "BTC", "34GUzCVLbdkMQ2UdVTaA4nxPwoovVS7y2J"], ["BTC", "BTC", "34HpHYiyQwg69gFmCq2BGHjF1DZnZnBeBP"], @@ -71,13 +71,12 @@ const assetList = [ ["BTC", "BTC", "3HdGoUTbcztBnS7UzY4vSPYhwr424CiWAA"], ["BTC", "BTC", "3JFJPpH8Chwo7CDbyYQ4XcfgcjEP1FGRMJ"], ["BTC", "BTC", "3JJmF63ifcamPLiAmLgG96RA599yNtY3EQ"], - ["BTC", "BTC", "LQUu4v9z6KNch71j7kbj8GPeAGUo1FW6a"], ["BTC", "BTC", "3LcgLHzTvjLKBixBvkKGiadtiw2GBSKKqH"], ["BTC", "BTC", "3M219KR5vEneNb47ewrPfWyb5jQ2DjxRP6"], ["BTC", "BTC", "3Me9QACjioepv2L2oKTC9QQ87NH6vFe1Zj"], ["BTC", "BTC", "3NXCvmLGz9SxYi6TnjbBQfQMcwiZ1iQETa"], ["BTC", "BTC", "3Qxak1CZhLyZ7GVckKphLURdLBCjMfz9bA"], - ["BTC", "BTC", "bc1qm34lsc65zpw79lxes69zkqmk6ee3ewf0j77s3h"], + ["BTC", "BTC", "bc1qm34lsc65zpw79lxes69zkqmk6ee3ewf0j77s3h"], //--- ["BTC", "ETH", "0x21a31ee1afc51d94c2efccaa2092ad1028285549"], ["BTC", "ETH", "0x28c6c06298d514db089934071355e5743bf21d60"], ["BTC", "ETH", "0xdfd5293d8e347dfe59e90efd55b2956a1343963d"], @@ -189,8 +188,8 @@ const assetList = [ ["ENJ", "ETH", "0xbe0eb53f46cd790cd13851d5eff43d12404d33e8"], ["ENJ", "ETH", "0xdfd5293d8e347dfe59e90efd55b2956a1343963d"], ["ENJ", "ETH", "0xf977814e90da44bfa03b6295a0616a897441acec"], - ["ETH", "ARBITRUM", "0xb38e8c17e38363af6ebdcb3dae12e0243582891d"], - ["ETH", "ARBITRUM", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["ETH", "ARB", "0xb38e8c17e38363af6ebdcb3dae12e0243582891d"], + ["ETH", "ARB", "0xf977814e90da44bfa03b6295a0616a897441acec"], ["ETH", "BEP2", "bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz"], ["ETH", "BEP2", "bnb1lsmt5a8vqqus5fwslx8pyyemgjtg4y6ugj308t"], ["ETH", "BEP2", "bnb1m5amny2gs3xdyta6pksmr43zu4727w24syyks7"], @@ -368,7 +367,7 @@ const assetList = [ ["UNI", "ETH", "0xf977814e90da44bfa03b6295a0616a897441acec"], ["USDC", "ALGO", "MTCEM5YJJSYGW2RCXYXGE4SXLSPUUEJKQAWG2GUX6CNN72KQ3XPJCM6NOI"], ["USDC", "ALGO", "QYXDGS2XJJT7QNR6EJ2YHNZFONU6ROFM6BKTBNVT63ZXQ5OC6IYSPNDJ4U"], - ["USDC", "ARBITRUM", "0xb38e8c17e38363af6ebdcb3dae12e0243582891d"], + ["USDC", "ARB", "0xb38e8c17e38363af6ebdcb3dae12e0243582891d"], ["USDC", "AVAX", "0x4aefa39caeadd662ae31ab0ce7c8c2c9c0a013e8"], ["USDC", "AVAX", "0x9f8c163cba728e99993abe7495f06c0a3c8ac8b9"], ["USDC", "BEP2", "bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz"], @@ -400,7 +399,7 @@ const assetList = [ ["USDC", "TRX", "TNXoiAJ3dct8Fjg4M9fkLFh9S2v9TXc32G"], ["USDC", "TRX", "TV6MuMXfmLbBqPZvBHdwFsDnQeVfnmiuSi"], ["USDC", "TRX", "TWd4WrZ9wn84f5x1hZhL4DHvk738ns5jwb"], - ["USDT", "ARBITRUM", "0xb38e8c17e38363af6ebdcb3dae12e0243582891d"], + ["USDT", "ARB", "0xb38e8c17e38363af6ebdcb3dae12e0243582891d"], ["USDT", "AVAX", "0x21a31ee1afc51d94c2efccaa2092ad1028285549"], ["USDT", "AVAX", "0x4aefa39caeadd662ae31ab0ce7c8c2c9c0a013e8"], ["USDT", "AVAX", "0x9f8c163cba728e99993abe7495f06c0a3c8ac8b9"], From 1c2564c017ba5feb554d40ef7c71397578f91a99 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 7 Sep 2023 14:20:16 +0200 Subject: [PATCH 1139/1974] yield-yak: track arbi --- projects/yieldyak/index.js | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/projects/yieldyak/index.js b/projects/yieldyak/index.js index 5b9438a288f..26a39ac2ef6 100644 --- a/projects/yieldyak/index.js +++ b/projects/yieldyak/index.js @@ -1,13 +1,23 @@ const { staking } = require('../helper/staking'); -const { cachedGraphQuery } = require('../helper/cache') +const { cachedGraphQuery, getConfig } = require('../helper/cache') const graphUrl = 'https://api.thegraph.com/subgraphs/name/yieldyak/reinvest-tracker' const graphQuery = `{ farms(first: 1000) { id }}`; async function tvl(timestamp, ethBlock, chainBlocks, { api }) { - const { farms } = await cachedGraphQuery('yieldyak', graphUrl, graphQuery) - const tokens = await api.multiCall({ abi: 'address:depositToken', calls: farms.map(i => i.id), permitFailure: true, }) - const vals = await api.multiCall({ abi: 'uint256:totalDeposits', calls: farms.map(i => i.id), permitFailure: true, }) + const { farms } = await cachedGraphQuery('yieldyak/avax', graphUrl, graphQuery) + console.log(farms.length) + const tokens = await api.multiCall({ abi: 'address:depositToken', calls: farms.map(i => i.id), permitFailure: true, }) + const vals = await api.multiCall({ abi: 'uint256:totalDeposits', calls: farms.map(i => i.id), permitFailure: true, }) + tokens.forEach((token, i) => { + if (!token || !vals[i]) return; + api.add(token, vals[i]) + }) +} +async function arbiTvl(timestamp, ethBlock, chainBlocks, { api }) { + const farms = await getConfig('yieldyak/arbi', 'https://staging-api.yieldyak.com/42161/farms') + const tokens = await api.multiCall({ abi: 'address:depositToken', calls: farms.map(i => i.address), permitFailure: true, }) + const vals = await api.multiCall({ abi: 'uint256:totalDeposits', calls: farms.map(i => i.address), permitFailure: true, }) tokens.forEach((token, i) => { if (!token || !vals[i]) return; api.add(token, vals[i]) @@ -21,5 +31,6 @@ module.exports = { avax: { tvl, staking: staking(masterYak, yakToken), - } + }, + arbitrum: { tvl: arbiTvl }, } \ No newline at end of file From f1f31b5e0cb0f32ca2a6ce2e8af42acc2e6a62d1 Mon Sep 17 00:00:00 2001 From: define Date: Thu, 7 Sep 2023 13:42:53 +0100 Subject: [PATCH 1140/1974] config.js binance --- projects/binance/config.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/projects/binance/config.js b/projects/binance/config.js index b2533c22e42..b9460f9982e 100644 --- a/projects/binance/config.js +++ b/projects/binance/config.js @@ -60,6 +60,7 @@ const assetList = [ ["BTC", "BTC", "34xp4vRoCGJym3xR7yCVPFHoCNxv4Twseo"], ["BTC", "BTC", "36zSLdRv1jyewjaC12fqK5fptn7PqewunL"], ["BTC", "BTC", "38DN2uFMZPiHLHJigfv4kWC9JWJrNnhLcn"], + ["BTC", "BTC", "3LQUu4v9z6KNch71j7kbj8GPeAGUo1FW6a"], ["BTC", "BTC", "38Xnrq8MZiKmYmwobbYdZQ5nnCbX1qvQfE"], ["BTC", "BTC", "395vnFScKQ1ay695C6v7gf89UzoFpx3WuJ"], ["BTC", "BTC", "39884E3j6KZj82FK4vcCrkUvWYL5MQaS3v"], @@ -76,6 +77,7 @@ const assetList = [ ["BTC", "BTC", "3Me9QACjioepv2L2oKTC9QQ87NH6vFe1Zj"], ["BTC", "BTC", "3NXCvmLGz9SxYi6TnjbBQfQMcwiZ1iQETa"], ["BTC", "BTC", "3Qxak1CZhLyZ7GVckKphLURdLBCjMfz9bA"], + ["BTC", "ETH", "0x5a52e96bacdabb82fd05763e25335261b270efcb"], ["BTC", "BTC", "bc1qm34lsc65zpw79lxes69zkqmk6ee3ewf0j77s3h"], //--- ["BTC", "ETH", "0x21a31ee1afc51d94c2efccaa2092ad1028285549"], ["BTC", "ETH", "0x28c6c06298d514db089934071355e5743bf21d60"], From c7de0d350ddfe3075adedd776403e1588b7c88ba Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 7 Sep 2023 15:43:33 +0200 Subject: [PATCH 1141/1974] add coreTokens --- projects/helper/coreAssets.json | 33 ++++++++++++++++++++++++++--- projects/helper/tokenMapping.js | 37 --------------------------------- 2 files changed, 30 insertions(+), 40 deletions(-) diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index 1f7d962fa6a..463f4530956 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -851,6 +851,7 @@ "PAUL": "KT19DUSZw7mfeEATrbWVPHRrWNVbNnmfFAE6", "XTZ": "tezos", "XTZ_1": "KT1UpeXdK6AJbX58GJ92pLZVCucn2DR8Nu4b", + "XTZ_2": "KT1PnUZCp3u2KzWr93pn4DD7HAJnm3rWVrgn", "LINK": "KT18fp5rcTW7mbWDmzFwjLDUhs5MeJmagDSZ-10", "AAVE": "KT18fp5rcTW7mbWDmzFwjLDUhs5MeJmagDSZ", "WBTC": "KT1XRPEPXbZK25r3Htzp2o1x7xdMMmfocKNW-2", @@ -1375,7 +1376,33 @@ }, "mvc": { "SPACE": "", - "USDT": "7d8706c7f657730201ff3334064f83deb2fdec8a", - "MSP": "b2d75931958114e48c9927160f80363eae78e2dc" + "USDT": "7d8706c7f657730201ff3334064f83deb2fdec8a", + "MSP": "b2d75931958114e48c9927160f80363eae78e2dc" + }, + "alv": { + "WALV": "0xcb3e9919c56eff1004e54175a01e39163a352129" + }, + "dsc": { + "WDSC": "0x1c5d8992da64c8d56ea413dd6f723061c29a7c0b" + }, + "secret": { + "SECRET": "uscrt", + "WSCRT": "secret1k0jntykt7e4g3y88ltc60czgjuqdy4c9e8fzek", + "ATOM": "secret14mzwd0ps5q277l20ly2q3aetqe3ev4m4260gf4", + "DAI": "secret1vnjck36ld45apf8u4fedxd5zy7f5l92y3w5qwq", + "USDC": "secret1h6z05y90gwm4sqxzhz4pkyp36cna9xtp7q0urv", + "USDT": "secret18wpjn83dayu4meu6wnn29khfkwdxs7kyrz9c8f" + }, + "aura": { + "AURA": "uaura" + }, + "shibarium": { + "WETH": "0x8ed7d143ef452316ab1123d28ab302dc3b80d3ce", + "BONE_0": "0xc76f4c819d820369fb2d7c1531ab3bb18e6fe8d8", + "BONE_1": "0x213c25900f365f1be338df478cd82bef7fd43f85", + "BONE_2": "0x6c19a35875217b134e963ca9e61b005b855cad21", + "BONE_3": "0x1b2f364032f12bd8a4c89e672e6272de03ae2680", + "BONE_4": "0xa2899c776baaf9925d432f83c950d5054a6cf59c", + "DAI": "0x50c5725949a6f0c72e6c4a641f24049a917db0cb" } -} +} \ No newline at end of file diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 792cbc414b6..3a3b34ed414 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -28,11 +28,6 @@ const distressedAssts = new Set(Object.values({ }).map(i => i.toLowerCase())) const transformTokens = { - ethereum: { - '0xe0b469cb3eda0ece9e425cfeda4df986a55ea9f8': ADDRESSES.ethereum.WETH, - [ADDRESSES.ethereum.vlCVX]: ADDRESSES.ethereum.CVX, - }, - // Sample Code // cronos: { // "0x065de42e28e42d90c2052a1b49e7f83806af0e1f": "0x123", // CRK token is mispriced @@ -50,41 +45,9 @@ const fixBalancesTokens = { ozone: { // '0x83048f0bf34feed8ced419455a4320a735a92e9d': { coingeckoId: "ozonechain", decimals: 18 }, // was mapped to wrong chain }, - telos: { - [ADDRESSES.telos.WTLOS_1]: { coingeckoId: "telos", decimals: 18 }, - }, - alv: { - ['0xcb3e9919c56eff1004e54175a01e39163a352129']: { coingeckoId: "alvey-chain", decimals: 18 }, - }, - dsc: { - ['0x1c5d8992da64c8d56ea413dd6f723061c29a7c0b']: { coingeckoId: "decimal", decimals: 18 }, - }, - aura: { 'uaura': { coingeckoId: 'aura-network', decimals: 6 }, }, - secret: { 'uscrt': { coingeckoId: 'secret', decimals: 6 }, }, - shibarium: { - '0x8ed7d143ef452316ab1123d28ab302dc3b80d3ce': { coingeckoId: "ethereum", decimals: 18 }, - '0xc76f4c819d820369fb2d7c1531ab3bb18e6fe8d8': { coingeckoId: "bone-shibaswap", decimals: 18 }, - '0x213c25900f365f1be338df478cd82bef7fd43f85': { coingeckoId: "bone-shibaswap", decimals: 18 }, - '0x6c19a35875217b134e963ca9e61b005b855cad21': { coingeckoId: "bone-shibaswap", decimals: 18 }, - '0x1b2f364032f12bd8a4c89e672e6272de03ae2680': { coingeckoId: "bone-shibaswap", decimals: 18 }, - '0xa2899c776baaf9925d432f83c950d5054a6cf59c': { coingeckoId: "bone-shibaswap", decimals: 18 }, - }, - arbitrum: { - '0x1509706a6c66CA549ff0cB464de88231DDBe213B': { coingeckoId: 'aura-finance', decimals: 18 } - }, - tezos: { - 'KT1PnUZCp3u2KzWr93pn4DD7HAJnm3rWVrgn': { coingeckoId: 'tezos', decimals: 6 } - }, mvc: { [ADDRESSES.mvc.SPACE]: { coingeckoId: "microvisionchain", decimals: 8 }, }, - secret: { - 'secret1k0jntykt7e4g3y88ltc60czgjuqdy4c9e8fzek': { coingeckoId: 'secret', decimals: 6 }, - 'secret14mzwd0ps5q277l20ly2q3aetqe3ev4m4260gf4': { coingeckoId: 'cosmos', decimals: 6 }, - 'secret1vnjck36ld45apf8u4fedxd5zy7f5l92y3w5qwq': { coingeckoId: 'dai', decimals: 18 }, - 'secret1h6z05y90gwm4sqxzhz4pkyp36cna9xtp7q0urv': { coingeckoId: 'usd-coin', decimals: 6 }, - 'secret18wpjn83dayu4meu6wnn29khfkwdxs7kyrz9c8f': { coingeckoId: 'tether', decimals: 6 }, - } } ibcChains.forEach(chain => fixBalancesTokens[chain] = { ...ibcMappings, ...(fixBalancesTokens[chain] || {}) }) From ed12a132b49aac6552645048dd4807bb86e4ce34 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 7 Sep 2023 15:58:16 +0200 Subject: [PATCH 1142/1974] lint fix --- projects/flame-dex/index.js | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 projects/flame-dex/index.js diff --git a/projects/flame-dex/index.js b/projects/flame-dex/index.js new file mode 100644 index 00000000000..96b2fd50166 --- /dev/null +++ b/projects/flame-dex/index.js @@ -0,0 +1,30 @@ +const { sumTokens2, getStorage, getBigMapById, } = require('../helper/chain/tezos') +const { transformDexBalances, } = require('../helper/portedTokens') +const ADDRESSES = require('../helper/coreAssets.json') + +module.exports = { + tezos: { + tvl: async () => { + if (process.env) + throw new Error("disabled / break Intenitionally") + const data = await getStorage('KT1PRtrP7pKZ3PSLwgfTwt8hD39bxVojoKuX') + const pairs = await getBigMapById(data.buckets); + const data1 = [] + for (const pair of Object.values(pairs)) { + data1.push({ + token0: getToken(pair.token_a), + token1: getToken(pair.token_b), + token0Bal: pair.token_a_res / 1e12, + token1Bal: pair.token_b_res / 1e12 + }) + } + return transformDexBalances({ chain: 'tezos', data: data1 }) + }, + } +} + +function getToken({ fa2 }) { + if (fa2) + return fa2.address + (fa2.nat && fa2.nat !== '0' ? `-${fa2.nat}` : '') + return 'KT1PnUZCp3u2KzWr93pn4DD7HAJnm3rWVrgn' +} \ No newline at end of file From 220f042f8e94e9a2b9b618ce9ada83c19ccb3943 Mon Sep 17 00:00:00 2001 From: Aleksei Lushnikov Date: Thu, 7 Sep 2023 15:04:39 +0100 Subject: [PATCH 1143/1974] symbiosis adds new portal on Base chain (#7408) --- projects/symbiosis-finance/config.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/symbiosis-finance/config.js b/projects/symbiosis-finance/config.js index 2dcaf49ef56..637b059ee4c 100644 --- a/projects/symbiosis-finance/config.js +++ b/projects/symbiosis-finance/config.js @@ -194,6 +194,7 @@ module.exports = { ], holders: [ '0x5Aa5f7f84eD0E5db0a4a85C3947eA16B53352FD4', // portal v2 + '0xEE981B2459331AD268cc63CE6167b446AF4161f8', // portal v2 new ] }, ] From 1d72d774b71267ac93f24f6e42b0f1bd212f3c12 Mon Sep 17 00:00:00 2001 From: 0xtakano <74586952+erwinphanglius@users.noreply.github.com> Date: Thu, 7 Sep 2023 21:05:05 +0700 Subject: [PATCH 1144/1974] Esper Finance Integration (#7407) --- projects/esper-finance/index.js | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 projects/esper-finance/index.js diff --git a/projects/esper-finance/index.js b/projects/esper-finance/index.js new file mode 100644 index 00000000000..1d3e1c7e27a --- /dev/null +++ b/projects/esper-finance/index.js @@ -0,0 +1,9 @@ +const { getUniTVL } = require("../helper/unknownTokens"); + +module.exports = { + misrepresentedTokens: true, + start: 4781359, + mantle: { + tvl: getUniTVL({ factory: '0x69C4515C926ac3db7A547044145495240961a7B5', useDefaultCoreAssets: true,}), + }, +}; From fa73b9356844218581cbda9156fc211dc88697be Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 7 Sep 2023 16:06:40 +0200 Subject: [PATCH 1145/1974] minor fix --- projects/esper-finance/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/esper-finance/index.js b/projects/esper-finance/index.js index 1d3e1c7e27a..e7bf0db6028 100644 --- a/projects/esper-finance/index.js +++ b/projects/esper-finance/index.js @@ -4,6 +4,6 @@ module.exports = { misrepresentedTokens: true, start: 4781359, mantle: { - tvl: getUniTVL({ factory: '0x69C4515C926ac3db7A547044145495240961a7B5', useDefaultCoreAssets: true,}), + tvl: getUniTVL({ factory: '0x69C4515C926ac3db7A547044145495240961a7B5', useDefaultCoreAssets: true, fetchBalances: true, }), }, }; From 762e12870c6ec2822d711d0363e4d8a8c95e2dc3 Mon Sep 17 00:00:00 2001 From: Autoearn-Finance <129837237+Autoearn-Finance@users.noreply.github.com> Date: Thu, 7 Sep 2023 22:08:09 +0800 Subject: [PATCH 1146/1974] Add files via upload (#7405) --- projects/autoearn/index.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/projects/autoearn/index.js b/projects/autoearn/index.js index 2ee6b6969a8..10f0ac61abc 100644 --- a/projects/autoearn/index.js +++ b/projects/autoearn/index.js @@ -26,4 +26,15 @@ const zk_helper = yieldHelper({ abis, }) -module.exports = mergeExports([arbi_helper, zk_helper]) \ No newline at end of file +const farm_base = '0x04888AfAE97dC01e337582A2c8D3D232e27273fe' +const ate_base = '0xd5DA32Ad4C7510457C0e46Fa4332F75f6C4C4dC0' + +const base_helper = yieldHelper({ + project: 'autoearn-finance-base', + chain: 'base', + masterchef: farm_base, + nativeToken: ate_base, + abis, +}) + +module.exports = mergeExports([arbi_helper, zk_helper, base_helper]) From ca7713615396db3f9a000483581668b08f4ed749 Mon Sep 17 00:00:00 2001 From: hung <124560975+hung-native@users.noreply.github.com> Date: Thu, 7 Sep 2023 22:10:07 +0800 Subject: [PATCH 1147/1974] Native: project already listed before add new chains: polygon, arbitrum and avalanche (#7403) --- projects/native/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/native/index.js b/projects/native/index.js index f4b8191e088..7f64bcabb87 100644 --- a/projects/native/index.js +++ b/projects/native/index.js @@ -8,6 +8,9 @@ module.exports = { const config = { bsc: { factory: '0x85b0f66e83515ff4e825dfcaa58e040e08278ef9', fromBlock: 27103796, }, ethereum: { factory: '0x85b0f66e83515ff4e825dfcaa58e040e08278ef9', fromBlock: 16995923, }, + polygon: { factory: '0x6d2D10DC033751CA0485D1c2Bd463D5b87AfdE77', fromBlock: 44086415, }, + arbitrum: { factory: '0x85b0F66E83515ff4e825DfCAa58E040E08278EF9', fromBlock: 123408816, }, + avax: { factory: '0x85b0F66E83515ff4e825DfCAa58E040E08278EF9', fromBlock: 34309521, }, } Object.keys(config).forEach(chain => { From 65ac0ab77d21433a9372aac70e850acf1bc9cff4 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 7 Sep 2023 16:14:01 +0200 Subject: [PATCH 1148/1974] Gyro-2 (#7410) * Update Gyroscope adapter * Remove formatting changes * minor fix --------- Co-authored-by: Josh Guha --- projects/gyroscope/index.js | 87 ++++++++++++++++++++++++++++--------- 1 file changed, 66 insertions(+), 21 deletions(-) diff --git a/projects/gyroscope/index.js b/projects/gyroscope/index.js index 7cc620a205d..18850e0aec4 100644 --- a/projects/gyroscope/index.js +++ b/projects/gyroscope/index.js @@ -1,24 +1,36 @@ const { getLogs } = require('../helper/cache/getLogs') -async function tvl(_, _b, _cb, { api, }) { - const logs = await getLogs({ - api, - target: config[api.chain].factory, - eventAbi: 'event PoolCreated (address indexed pool)', - onlyArgs: true, - fromBlock: config[api.chain].fromBlock, - }) +async function tvl(_, _b, _cb, { api }) { + const pools = config[api.chain] - const pools = logs.map(i => i.pool) - const poolIds = await api.multiCall({ abi: 'function getPoolId() view returns (bytes32)', calls: pools }) - const vaults = await api.multiCall({ abi: 'address:getVault', calls: pools }) + const promises = pools.map(async ({ factory, fromBlock }) => { + const logs = await getLogs({ + api, + target: factory, + eventAbi: 'event PoolCreated (address indexed pool)', + onlyArgs: true, + fromBlock, + }) - const data = await api.multiCall({ - abi: 'function getPoolTokens(bytes32 poolId) view returns (address[] tokens, uint256[] balances, uint256 lastChangeBlock)', - calls: poolIds.map((v, i) => ({ target: vaults[i], params: v })), - }) + const pools = logs.map((i) => i.pool) + const poolIds = await api.multiCall({ + abi: 'function getPoolId() view returns (bytes32)', + calls: pools, + }) + const vaults = await api.multiCall({ + abi: 'address:getVault', + calls: pools, + }) - data.forEach(i => api.addTokens(i.tokens, i.balances)) + const data = await api.multiCall({ + abi: 'function getPoolTokens(bytes32 poolId) view returns (address[] tokens, uint256[] balances, uint256 lastChangeBlock)', + calls: poolIds.map((v, i) => ({ target: vaults[i], params: v })), + }) + + data.forEach((i) => api.addTokens(i.tokens, i.balances)) + }) + await Promise.all(promises) + return api.getBalances() } module.exports = { @@ -26,11 +38,44 @@ module.exports = { } const config = { - polygon: { factory: '0x5d8545a7330245150bE0Ce88F8afB0EDc41dFc34', fromBlock: 31556084 }, - optimism: { factory: '0x9b683cA24B0e013512E2566b68704dBe9677413c', fromBlock: 97253023 }, - ethereum: { factory: '0x412a5B2e7a678471985542757A6855847D4931D5', fromBlock: 17672894 }, + polygon: [ + { + name: 'Gyro 2-CLP Factory', + factory: '0x5d8545a7330245150bE0Ce88F8afB0EDc41dFc34', + fromBlock: 31556084, + }, + { + name: 'Gyro 3-CLP Factory', + factory: '0x90f08B3705208E41DbEEB37A42Fb628dD483AdDa', + fromBlock: 31556094, + }, + { + name: 'Gyro E-CLP Factory', + factory: '0xD4204551BC5397455f8897745d50Ac4F6beE0EF6', + fromBlock: 35414865, + }, + { + name: 'Gyro E-CLP V2 Factory', + factory: '0x1a79A24Db0F73e9087205287761fC9C5C305926b', + fromBlock: 41209677, + }, + ], + optimism: [ + { + name: 'Gyro E-CLP V2 Factory', + factory: '0x9b683ca24b0e013512e2566b68704dbe9677413c', + fromBlock: 97253023, + }, + ], + ethereum: [ + { + name: 'Gyro E-CLP V2 Factory', + factory: '0x412a5B2e7a678471985542757A6855847D4931D5', + fromBlock: 17672894, + }, + ], } -Object.keys(config).forEach(chain => { +Object.keys(config).forEach((chain) => { module.exports[chain] = { tvl } -}) \ No newline at end of file +}) From 5274fe91a7e4b4da1f1da1fe06ed5004c95f2ee6 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Thu, 7 Sep 2023 18:39:23 +0100 Subject: [PATCH 1149/1974] add zksync era to kyberswap classic --- projects/kyber-classic/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/kyber-classic/index.js b/projects/kyber-classic/index.js index b5cbdd9c6d9..fc6245a2aa3 100644 --- a/projects/kyber-classic/index.js +++ b/projects/kyber-classic/index.js @@ -39,6 +39,7 @@ const chains = { oasis: { factory: "0xD9bfE9979e9CA4b2fe84bA5d4Cf963bBcB376974" }, bittorrent: { factory: "0xD9bfE9979e9CA4b2fe84bA5d4Cf963bBcB376974" }, linea: { factory: "0x1c758af0688502e49140230f6b0ebd376d429be5" }, + era: { factory: "0x9017f5A42fbe5bCA3853400D2660a2Ee771b241e" }, }; function classic(chain) { From cf2d209ff0b038b811766c6424ba6a1a0b3d2b33 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Thu, 7 Sep 2023 19:00:30 +0100 Subject: [PATCH 1150/1974] add optimism chain --- projects/penpie/config.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/projects/penpie/config.js b/projects/penpie/config.js index 1d6d3ee2441..3a94761d71e 100644 --- a/projects/penpie/config.js +++ b/projects/penpie/config.js @@ -20,4 +20,11 @@ module.exports = { PENDLE: "0xb3Ed0A426155B79B898849803E3B36552f7ED507", pendleStaking: "0x782d9d67feaa4d1cdf8222d9053c8cba1c3b7982", }, + optimism: { + masterPenpie: "0x3CbFC97f87f534b42bb58276B7b5dCaD29E57EAc", + vePENDLE: "0xd5C47D2383Fddc19596489280C0A33AC42b2bB18", + mPENDLE: "0xa3B615667CBd33cfc69843Bf11Fbb2A1D926BD46", + PENDLE: "0xbc7b1ff1c6989f006a1185318ed4e7b5796e66e1", + pendleStaking: "0x509FD25EE2AC7833a017f17Ee8A6Fb4aAf947876", + }, }; From 3a81c0a32132c525f0e948204b0a89d0759df58f Mon Sep 17 00:00:00 2001 From: 0xtekgrinder <72015889+0xtekgrinder@users.noreply.github.com> Date: Thu, 7 Sep 2023 15:40:39 -0400 Subject: [PATCH 1151/1974] feat: liquis TVL (#7412) * feat: liquis TVL * fix: abi is now correct for liquis project * minor fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/liquis/abi.json | 8 ++++++ projects/liquis/index.js | 58 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+) create mode 100644 projects/liquis/abi.json create mode 100644 projects/liquis/index.js diff --git a/projects/liquis/abi.json b/projects/liquis/abi.json new file mode 100644 index 00000000000..9cbeb7cc01d --- /dev/null +++ b/projects/liquis/abi.json @@ -0,0 +1,8 @@ +{ + "poolLength": "uint256:poolLength", + "poolInfo": "function poolInfo(uint256) view returns (address lptoken, address token, address gauge, address crvRewards, address stash, bool shutdown)", + "pool": "function pool() view returns (address)", + "tickLower": "function tickLower() view returns (int24)", + "tickUpper": "function tickUpper() view returns (int24)", + "getReserves": "function getReserves(tuple(address pool, int24 tickLower, int24 tickUpper) key) view returns (uint112 reserve0, uint112 reserve1)" +} \ No newline at end of file diff --git a/projects/liquis/index.js b/projects/liquis/index.js new file mode 100644 index 00000000000..5029d3edd71 --- /dev/null +++ b/projects/liquis/index.js @@ -0,0 +1,58 @@ +const sdk = require("@defillama/sdk"); +const abi = require("./abi.json"); +const { staking } = require("../helper/staking"); +const { unwrapBalancerToken } = require('../helper/unwrapLPs') + +const LIQUIS_BOOSTER = "0x631e58246A88c3957763e1469cb52f93BC1dDCF2" +const addresses = { + liq: "0xD82fd4D6D62f89A1E50b1db69AD19932314aa408", + liqLocker: "0x748A0F458B9E71061ca0aC543B984473F203E1CB", + veLIT: "0xf17d23136B4FeAd139f54fB766c8795faae09660", + lit80weth20: "0x9232a548DD9E81BaC65500b5e0d918F8Ba93675C", + voterProxy: "0x37aeB332D6E57112f1BFE36923a7ee670Ee9278b", + lens: "0xb73f303472c4fd4ff3b9f59ce0f9b13e47fbfd19", +}; + +async function tvl(_, block, _1, { api }) { + // Compute TVL of lps + let pools = await api.fetchList({ target: LIQUIS_BOOSTER, itemAbi: abi.poolInfo, lengthAbi: abi.poolLength, }) + const liqPools = pools.map(pool => pool.token); + const poolInputs = pools.map(pool => pool.lptoken); + const poolUnis = await api.multiCall({ calls: poolInputs, abi: abi.pool, }); + const poolUpperTicks = await api.multiCall({ calls: poolInputs, abi: abi.tickUpper, }); + const poolLowerTicks = await api.multiCall({ calls: poolInputs, abi: abi.tickLower, }); + const liqBalances = await api.multiCall({ calls: liqPools, abi: 'erc20:totalSupply', }); + const bunniBalances = await api.multiCall({ calls: poolInputs, abi: 'erc20:totalSupply', }); + const calls = poolUnis.map((pool, i) => ({ params: [[pool, poolLowerTicks[i], poolUpperTicks[i]]] })) + const res = await api.multiCall({ abi: abi.getReserves, calls, target: addresses.lens }) + let tokenCalls = [] + let reserves = res.filter((val, i) => { + if (!(+val.reserve0 || +val.reserve1)) return; // ignore tokens without reserve + tokenCalls.push(poolUnis[i]) + return val + }) + let token0s = await api.multiCall({ abi: 'address:token0', calls: tokenCalls }) + let token1s = await api.multiCall({ abi: 'address:token1', calls: tokenCalls }) + reserves.forEach(({ reserve0, reserve1 }, i) => { + const ratio = liqBalances[i] / bunniBalances[i]; + api.add(token0s[i], reserve0 * ratio) + api.add(token1s[i], reserve1 * ratio) + }) + + // Compute veLIT locked value + const { output: veLitTotalSupply } = await sdk.api.erc20.totalSupply({ target: addresses.veLIT, block }) + const { output: veBalance } = await sdk.api.erc20.balanceOf({ target: addresses.veLIT, owner: addresses.voterProxy, block }) + const ratio = veBalance / veLitTotalSupply + const bal = await unwrapBalancerToken({ api, balancerToken: addresses.lit80weth20, owner: addresses.veLIT, }) + Object.entries(bal).forEach(([token, value]) => { + api.add(token, +value * ratio, { skipChain: true, }) + }) +} + +module.exports = { + methodology: "Adds up the total deposited LPs, the total veLIT owned, and the total LIT Locked.", + ethereum: { + tvl, + staking: staking(addresses.liqLocker, addresses.liq) + } +} \ No newline at end of file From 946be9ea0e4b46942b02875501f98c0d8ee6259f Mon Sep 17 00:00:00 2001 From: bfloresio <111913416+bfloresio@users.noreply.github.com> Date: Thu, 7 Sep 2023 15:41:55 -0400 Subject: [PATCH 1152/1974] Update index.js (#7413) Update index.js for stargate on Kava. --- projects/stargatefinance/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/stargatefinance/index.js b/projects/stargatefinance/index.js index c83ed2090e3..0264866d898 100644 --- a/projects/stargatefinance/index.js +++ b/projects/stargatefinance/index.js @@ -34,6 +34,9 @@ const CONFIG = { router: '0x45f1A95A4D3f3836523F5c83673c797f4d4d263B', etherToken: '0x224d8fd7ab6ad4c6eb4611ce56ef35dec2277f03', }, + kava:{ + router: '0x2F6F07CDcf3588944Bf4C42aC74ff24bF56e7590', + }, } module.exports = { From 091c900255a7e7e0446cf7c23bf75a7c091dd626 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Thu, 7 Sep 2023 21:06:22 +0100 Subject: [PATCH 1153/1974] add optimism treasury address --- projects/treasury/kromatika.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/projects/treasury/kromatika.js b/projects/treasury/kromatika.js index 4138998da87..2ef3ec26b0a 100644 --- a/projects/treasury/kromatika.js +++ b/projects/treasury/kromatika.js @@ -2,8 +2,10 @@ const ADDRESSES = require('../helper/coreAssets.json') const { nullAddress,treasuryExports } = require("../helper/treasury"); const Treasury = "0x8e35cc21fbcade0a5483ce430e0d5456086a36d3"; +const opTreasury = "0x05d235d8Ba95bfc457f9a11F64cf869f0f3f60F9"; const KROM = "0x55fF62567f09906A85183b866dF84bf599a4bf70"; +const opKROM = "0xF98dCd95217E15E05d8638da4c91125E59590B07"; module.exports = treasuryExports({ @@ -16,4 +18,12 @@ module.exports = treasuryExports({ owners: [Treasury], ownTokens: [KROM], }, + optimism: { + tokens: [ + nullAddress, + ADDRESSES.optimism.OP, + ], + owners: [opTreasury], + ownTokens: [opKROM], + }, }) \ No newline at end of file From 7d6b285bb0b5b61b6607172ed498952f51db49c9 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 7 Sep 2023 22:33:10 +0200 Subject: [PATCH 1154/1974] backed-fi: track more chains & tokens --- projects/backed/index.js | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/projects/backed/index.js b/projects/backed/index.js index bd87e906ade..7ea74bbcfdd 100644 --- a/projects/backed/index.js +++ b/projects/backed/index.js @@ -1,20 +1,28 @@ const contracts = [ "0x2F123cF3F37CE3328CC9B5b8415f9EC5109b45e7", // bC3M + "0x2f11eeee0bf21e7661a22dbbbb9068f4ad191b86", // bNIU + "0x0f76D32CDccDcbd602A55Af23EAF58FD1eE17245", // bERNA + "0xbbcb0356bB9e6B3Faa5CbF9E5F36185d53403Ac9", // bCOIN "0xCA30c93B02514f86d5C86a6e375E3A330B435Fb5", // b1B01 "0x52d134c6DB5889FaD3542A09eAf7Aa90C0fdf9E4", // bIBTA "0x1e2c4fb7ede391d116e6b41cd0608260e8801d59", // bCSPX "0x20C64dEE8FdA5269A78f2D5BDBa861CA1d83DF7a", // bHIGH -] - +].map(i => i.toLowerCase()) + async function tvl(_, _b, _cb, { api, }) { - const supply = await api.multiCall({ abi: 'erc20:totalSupply', calls: contracts }) - api.addTokens(contracts, supply) - + let tokens = [...contracts] + if (api.chain === 'base') { + tokens.push('0xC3cE78B037DDA1B966D31EC7979d3f3a38571A8E') + tokens = tokens.filter(i => i !== '0x1e2c4fb7ede391d116e6b41cd0608260e8801d59') + } + const supply = await api.multiCall({ abi: 'erc20:totalSupply', calls: tokens }) + api.addTokens(tokens, supply) + return api.getBalances() } -module.exports = { - ethereum: { - tvl - } -} \ No newline at end of file +const chains = ["ethereum", "polygon", 'xdai', 'bsc', "avax", "fantom", "base", "arbitrum"] + +chains.forEach(chain => { + module.exports[chain] = { tvl } +}) \ No newline at end of file From 83d470aa9750b16af00c35b2bb2efa759d398f48 Mon Sep 17 00:00:00 2001 From: define Date: Thu, 7 Sep 2023 22:24:27 +0100 Subject: [PATCH 1155/1974] last change binance config --- projects/binance/config.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/projects/binance/config.js b/projects/binance/config.js index b9460f9982e..35f9d7f5f32 100644 --- a/projects/binance/config.js +++ b/projects/binance/config.js @@ -47,13 +47,13 @@ const assetList = [ ["BNB", "BEP20", "0xeb2d2f1b8c558a40207669291fda468e50c8a0bb"], ["BNB", "BEP20", "0xf977814e90da44bfa03b6295a0616a897441acec"], ["BNB", "ETH", "0x28c6c06298d514db089934071355e5743bf21d60"], - ["BTC", "BEP2", "bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz"], - ["BTC", "BEP2", "bnb1lsmt5a8vqqus5fwslx8pyyemgjtg4y6ugj308t"], - ["BTC", "BEP2", "bnb1u2agwjat20494fmc6jnuau0ls937cfjn4pjwtn"], - ["BTC", "BEP20", "0x5a52e96bacdabb82fd05763e25335261b270efcb"], - ["BTC", "BEP20", "0x8894e0a0c962cb723c1976a4421c95949be2d4e3"], - ["BTC", "BEP20", "0xe2fc31f816a9b94326492132018c3aecc4a93ae1"], - ["BTC", "BEP20", "0xf977814e90da44bfa03b6295a0616a897441acec"], + // ["BTC", "BEP2", "bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz"], +// ["BTC", "BEP2", "bnb1lsmt5a8vqqus5fwslx8pyyemgjtg4y6ugj308t"], +// ["BTC", "BEP2", "bnb1u2agwjat20494fmc6jnuau0ls937cfjn4pjwtn"], +// ["BTC", "BEP20", "0x5a52e96bacdabb82fd05763e25335261b270efcb"], +// ["BTC", "BEP20", "0x8894e0a0c962cb723c1976a4421c95949be2d4e3"], +// ["BTC", "BEP20", "0xe2fc31f816a9b94326492132018c3aecc4a93ae1"], +// ["BTC", "BEP20", "0xf977814e90da44bfa03b6295a0616a897441acec"], ["BTC", "BTC", "1Pzaqw98PeRfyHypfqyEgg5yycJRsENrE7"], ["BTC", "BTC", "34GUzCVLbdkMQ2UdVTaA4nxPwoovVS7y2J"], ["BTC", "BTC", "34HpHYiyQwg69gFmCq2BGHjF1DZnZnBeBP"], From e51ac2d71dcb324a408b7e36a62d3508520d2a04 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Fri, 8 Sep 2023 00:14:22 +0100 Subject: [PATCH 1156/1974] add ekubo --- projects/ekubo/index.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 projects/ekubo/index.js diff --git a/projects/ekubo/index.js b/projects/ekubo/index.js new file mode 100644 index 00000000000..18c6cb96cdb --- /dev/null +++ b/projects/ekubo/index.js @@ -0,0 +1,23 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokens } = require('../helper/chain/starknet') + +const market = '0x00000005dd3d2f4429af886cd1a3b08289dbcea99a294197e9eb43b0e0325b4b' + +const assets = [ + ADDRESSES.starknet.WBTC, + ADDRESSES.starknet.ETH, + ADDRESSES.starknet.USDC, + ADDRESSES.starknet.DAI, + ADDRESSES.starknet.USDT, +] + +async function tvl(_, _1, _2, { api }) { + return sumTokens({ api, owner: market, tokens: assets }) +} + +module.exports = { + methodology: 'Value of LP in the DEX, includes LPs that are out of range and thus not providing active liquidity', + starknet: { + tvl + }, +} \ No newline at end of file From 105b39e76f1c7eebc7ce4cb601fa5a87347ebf1b Mon Sep 17 00:00:00 2001 From: 0xFissure <137065279+0xFissure@users.noreply.github.com> Date: Fri, 8 Sep 2023 01:50:22 -0400 Subject: [PATCH 1157/1974] Create index.js (#7414) --- projects/circuit/index.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 projects/circuit/index.js diff --git a/projects/circuit/index.js b/projects/circuit/index.js new file mode 100644 index 00000000000..1baea4f7079 --- /dev/null +++ b/projects/circuit/index.js @@ -0,0 +1,18 @@ +const { yieldHelper } = require("../helper/unknownTokens"); +const { getConfig } = require('../helper/cache') + +const chain = "mantle"; +const tokenAPI = "address:want" + +module.exports = { + [chain]: { + tvl: async (_, _b, { [chain]: block }) => { + const pools = await getConfig('circuit','https://raw.githubusercontent.com/Circuit-Finance-Org/circuit-frontend-public/main/src/config/vault/mantle.json'); + + // Extract earnedTokenAddress from each pool + const vaults = pools.map(pool => pool.earnedTokenAddress); + + return yieldHelper({ vaults, chain, block, tokenAPI, useDefaultCoreAssets: true }); + } + } + } \ No newline at end of file From 073312f41e80da51f5e59b0f62b6d998413972b8 Mon Sep 17 00:00:00 2001 From: neodaoist <3170590+neodaoist@users.noreply.github.com> Date: Fri, 8 Sep 2023 08:51:37 +0300 Subject: [PATCH 1158/1974] Add Valorem TVL Adapter (#7417) * feat/WIP: add valorem TVL adapter * chore: comment out goerli related as we won't need it soon * fix: launch * chore: cleanup Co-authored-by: Nick Adamson --- projects/valorem/index.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 projects/valorem/index.js diff --git a/projects/valorem/index.js b/projects/valorem/index.js new file mode 100644 index 00000000000..c5f0e1be89c --- /dev/null +++ b/projects/valorem/index.js @@ -0,0 +1,26 @@ +const { sumTokensExport } = require("../helper/unwrapLPs"); + +const CLEARINGHOUSE_ADDRESS = "0x402A401B1944EBb5A3030F36Aa70d6b5794190c9"; +const arbitrumOneDeployUnixTimestamp = 1693583626; + +const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000"; +const TOKENS_BY_CHAIN = { + ["arbitrum"]: { + ETH: ZERO_ADDRESS, + WETH: "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1", + USDC: "0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8", + }, +}; + +module.exports = { + methodology: + "TVL counts all of the tokens locked in the Clearinghouse for Option/Claim positions.", + arbitrum: { + tvl: sumTokensExport({ + chain: "arbitrum", + owner: CLEARINGHOUSE_ADDRESS, + tokens: [...Object.values(TOKENS_BY_CHAIN["arbitrum"])], + }), + }, + hallmarks: [[arbitrumOneDeployUnixTimestamp, "Valorem Launch"]], +}; From 73f5e60ad94c529d001addd27dcee4d329633692 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 8 Sep 2023 08:35:52 +0200 Subject: [PATCH 1159/1974] Seamless (#7419) --- projects/seamless/abis.json | 8 ++++++ projects/seamless/index.js | 49 +++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 projects/seamless/abis.json create mode 100644 projects/seamless/index.js diff --git a/projects/seamless/abis.json b/projects/seamless/abis.json new file mode 100644 index 00000000000..f64116b331d --- /dev/null +++ b/projects/seamless/abis.json @@ -0,0 +1,8 @@ +{ + "instanceCount": "function instanceCount() external view returns (uint256 count)", + "instanceAt": "function instanceAt(uint256 index) external view returns (address instance)", + "getGeyserData": "function getGeyserData() external view returns ((address stakingToken, address rewardToken, address rewardPool, (uint256 floor, uint256 ceiling, uint256 time) rewardScaling, uint256 rewardSharesOutstanding, uint256 totalStake, uint256 totalStakeUnits, uint256 lastUpdate, (uint256 duration, uint256 start, uint256 shares)[] rewardSchedules) geyser)", + "underlying": "function underlying() external view returns (address)", + "UNDERLYING_ASSET_ADDRESS": "function UNDERLYING_ASSET_ADDRESS() external view returns (address)", + "totalUnderlying": "function totalUnderlying() external view returns (uint256)" +} \ No newline at end of file diff --git a/projects/seamless/index.js b/projects/seamless/index.js new file mode 100644 index 00000000000..9d4a131e34b --- /dev/null +++ b/projects/seamless/index.js @@ -0,0 +1,49 @@ +const { aaveExports } = require("../helper/aave"); +const { sumTokens2 } = require("../helper/unwrapLPs"); +const abi = require("./abis.json"); +const { mergeExports } = require("../helper/utils"); + +const AAVE_ADDRESSES_PROVIDER_REGISTRY = "0x90C5055530C0465AbB077FA016a3699A3F53Ef99"; +const AAVE_POOL_DATA_PROVIDER = "0x2A0979257105834789bC6b9E1B00446DFbA8dFBa"; +const GEYSER_REGISTRY = "0xD5815fC3D736120d07a1fA92bA743c1167dA89d8"; + +async function geyserTvl(_, _1, _2, { api }) { + const aTokens = await api.call({ abi: "function getAllATokens() view returns (tuple(string symbol, address tokenAddress)[])", target: AAVE_POOL_DATA_PROVIDER }) + const aTokenSet = new Set(aTokens.map(t => t.tokenAddress.toLowerCase())) + const geysers = await api.fetchList({ lengthAbi: abi.instanceCount, itemAbi: abi.instanceAt, target: GEYSER_REGISTRY }) + const geysersData = await api.multiCall({ calls: geysers, abi: abi["getGeyserData"], }) + const stakingTokens = geysersData.map(d => d.stakingToken) + const wrappedUnderlying = await api.multiCall({ calls: stakingTokens, abi: abi["underlying"], permitFailure: true, }) + const uTokens = wrappedUnderlying.filter(i => i && !aTokenSet.has(i.toLowerCase())) + const uOwners = stakingTokens.filter((_, i) => wrappedUnderlying[i]&& !aTokenSet.has(wrappedUnderlying[i].toLowerCase())) + + const notWrappedTokensAndOwners = wrappedUnderlying.map((w, i) => { + if (w) return; + return [stakingTokens[i], geysers[i]]; + }).filter(i => i) + + const aTokenUnderlying = await api.multiCall({ calls: uTokens, abi: abi["UNDERLYING_ASSET_ADDRESS"], }) + + const notATokenTokensAndOwners = aTokenUnderlying.map((w, i) => { + if (w) return; + return [uTokens[i], uOwners[i]]; + }).filter(i => i) + + const underlyingBalance = await api.multiCall({ calls: uOwners, abi: abi["totalUnderlying"], permitFailure: true, }); + + await sumTokens2({ api, tokensAndOwners: [notATokenTokensAndOwners, notWrappedTokensAndOwners].flat(), }); + + underlyingBalance.forEach((bal, i) => { + if (!bal) return; + api.add(aTokenUnderlying[i], bal) + }); + + return api.getBalances() +} + +const baseAAVE = aaveExports("base", AAVE_ADDRESSES_PROVIDER_REGISTRY, undefined, [AAVE_POOL_DATA_PROVIDER], { v3: true }); + +module.exports = mergeExports([{ + methodology: `Counts the tokens locked in the contracts to be used as collateral to borrow or to earn yield. Borrowed coins are not counted towards the TVL, so only the coins actually locked in the contracts are counted. There's multiple reasons behind this but one of the main ones is to avoid inflating the TVL through cycled lending`, + base: baseAAVE, +}, { base: { tvl: geyserTvl } }]); From 3ff9f995f453df2eb9a25e2b46e973a04cb282f3 Mon Sep 17 00:00:00 2001 From: Ronan <73086339+clooneyr@users.noreply.github.com> Date: Fri, 8 Sep 2023 16:37:26 +1000 Subject: [PATCH 1160/1974] Algomint tvl update (#7418) * Update custody address's for new architecture * feat: new basket token --- projects/algomint/index.js | 14 ++++++++++++-- projects/helper/chain/algorand.js | 1 + 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/projects/algomint/index.js b/projects/algomint/index.js index ecf9f2f3508..aa208000286 100644 --- a/projects/algomint/index.js +++ b/projects/algomint/index.js @@ -7,6 +7,8 @@ const goUsdcBasketAddress = "S3VJZN4AXUP3IZKE4O7TUN6LRIEYNJCMXQSFP6DPGUKU6YYK2VLN2W7DXA"; const goUsdtBasketAddress = "CX7ICRT4HRKHZSSYYMW765AKSBDH3XJBQZ2DXN32DCWTD2732RVHR25Y5Q"; +const goXusdBasketAddress = + "ZFWCUIFTE5CKDEFBL3KBQA5OIVLFOG2D7MN7UUK7ZKIW2QVOLAYBR2L5WE"; const goBtcBasketAddress = "MGGJI6CKRMIEN7CGXY2SK3KTPRCXW4SNPDPN4G7RWON4DB4262G4IRFHXE"; const goEthBasketAddress = @@ -15,6 +17,7 @@ const goEthBasketAddress = //The following pool ID's are the PACT LP pool contracts const usdcPoolId = 885102197; const usdtPoolId = 1081978547; +const xusdPoolId = 1081974468; const wBtcPoolId = 1058934586; const wEthPoolId = 1058935016; @@ -32,6 +35,12 @@ async function tvl() { goUsdtBasketAddress ); + const xusdPosition = await lpTokenPostion( + tokens.xUsdGoUsdLp, + xusdPoolId, + goXusdBasketAddress + ); + const wBtcPosition = await lpTokenPostion( tokens.wBtcGoBtcLp, wBtcPoolId, @@ -48,8 +57,9 @@ async function tvl() { const usdcTvlvalue = usdcPostion.positionA / 10 ** 6; //positionA is USDT in the LP const usdtTvlValue = usdtPosition.positionA / 10 ** 6; + //positionB is XUSD in the LP + const xusdtTvlValue = xusdPosition.positionB / 10 ** 6; //positionB is wBTC in the LP - const wBtcTvlValue = wBtcPosition.positionB / 10 ** 8; //positionB is wEth in the LP const wEthTvlValue = wEthPosition.positionB / 10 ** 8; @@ -57,7 +67,7 @@ async function tvl() { bitcoin: wBtcTvlValue, ethereum: wEthTvlValue, tether: usdtTvlValue, - usd: usdcTvlvalue, + usd: usdcTvlvalue + xusdtTvlValue, }; } diff --git a/projects/helper/chain/algorand.js b/projects/helper/chain/algorand.js index c777f777fb7..118526a03fc 100644 --- a/projects/helper/chain/algorand.js +++ b/projects/helper/chain/algorand.js @@ -147,6 +147,7 @@ const tokens = { wEth: 887406851, wBtcGoBtcLp: 1058934626, wEthGoEthLp: 1058935051, + xUsdGoUsdLp: 1081974597, usdtGoUsdLp: 1081978679, goUsd: 672913181, usdcGoUsdLp: 885102318, From c8d3762c91f83d40aaf31bcf86c1b59ccc9bd0ac Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 8 Sep 2023 09:13:09 +0200 Subject: [PATCH 1161/1974] track https://www.circuit.farm --- projects/circuit-fi/index.js | 19 +++++++++ projects/clipper/index.js | 79 +++++++----------------------------- 2 files changed, 33 insertions(+), 65 deletions(-) create mode 100644 projects/circuit-fi/index.js diff --git a/projects/circuit-fi/index.js b/projects/circuit-fi/index.js new file mode 100644 index 00000000000..43997d39d77 --- /dev/null +++ b/projects/circuit-fi/index.js @@ -0,0 +1,19 @@ + +const { getConfig } = require('../helper/cache') +const { sumUnknownTokens } = require('../helper/unknownTokens') + +async function tvl(_, _b, _cb, { api, }) { + let data = await getConfig('circuit-fi', 'https://raw.githubusercontent.com/Circuit-Finance-Org/circuit-frontend-public/main/src/config/vault/mantle.json') + const pools = data.map(i => i.earnContractAddress) + const tokens = await api.multiCall({ abi: 'address:want', calls: pools}) + const bals = await api.multiCall({ abi: 'uint256:balance', calls: pools}) + api.addTokens(tokens, bals) + return sumUnknownTokens({ api, useDefaultCoreAssets: true, resolveLP: true, }) +} + +module.exports = { + misrepresentedTokens: true, + mantle: { + tvl + }, +}; diff --git a/projects/clipper/index.js b/projects/clipper/index.js index e16e47e7d26..2268de0bb18 100644 --- a/projects/clipper/index.js +++ b/projects/clipper/index.js @@ -1,70 +1,19 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const { sumTokensAndLPsSharedOwners } = require('../helper/unwrapLPs') -const { getChainTransform } = require('../helper/portedTokens') -const sdk = require('@defillama/sdk') const { getConfig } = require('../helper/cache') - -const BigNumber = require('bignumber.js') - -const oldPools = { - ethereum: ["0xe82906b6B1B04f631D126c974Af57a3A7B6a99d9",], +const { nullAddress } = require('../helper/tokenMapping') + +async function tvl(time, _block, chainBlocks, { api }) { + const { pool: { address: poolAddress }, assets } = await getConfig('clipper/' + api.chain, `https://api.clipper.exchange/rfq/pool?chain_id=${api.chainId}`) + const tokens = assets.map(({ address }) => address) + const owners = [poolAddress] + tokens.push(nullAddress) + if (api.chain === 'ethereum') owners.push('0xe82906b6B1B04f631D126c974Af57a3A7B6a99d9') + return api.sumTokens({ tokens, owners }) } -const chainConfig = { - ethereum: { chainId: 1, }, - polygon: { chainId: 137, }, - moonbeam: { chainId: 1284, }, - optimism: { chainId: 10, }, - arbitrum: { chainId: 42161, }, -} -const weth = ADDRESSES.ethereum.WETH -const moonbeamGLMR = "moonbeam:0x0000000000000000000000000000000000000802" - -async function getChainData(chain) { - const { chainId } = chainConfig[chain] - - const { - pool: { - address: poolAddress - }, - assets - } = await getConfig('clipper/'+chain,`https://api.clipper.exchange/rfq/pool?chain_id=${chainId}`) - return { - poolAddress, - assets: assets.map(({ address }) => address) - } -} - -function chainTVL(chain) { - return { - tvl: async (time, _block, chainBlocks) => { - const balances = {} - const block = chainBlocks[chain] - const transform = await getChainTransform(chain) - const { poolAddress, assets } = await getChainData(chain) - const pools = oldPools[chain] || [] - const poolAddresses = [poolAddress, ...pools,] - - await sumTokensAndLPsSharedOwners(balances, assets.map(t => [t, false]), poolAddresses, block, chain, transform) - - if (balances[moonbeamGLMR]) { - balances['moonbeam'] = BigNumber(balances[moonbeamGLMR]).dividedBy(10 ** 18).toFixed(0) - delete balances[moonbeamGLMR] - } - - if (chain === 'ethereum') - for(const pool of poolAddresses) - sdk.util.sumSingleBalance(balances, weth, (await sdk.api.eth.getBalance({ target: pool, block })).output) - - return balances - - } - } -} - -const chainTVLObject = Object.keys(chainConfig).reduce((agg, chain) => ({ ...agg, [chain]: chainTVL(chain) }), {}) - module.exports = { - ...chainTVLObject, methodology: `Counts the tokens in pool address in different chains` -} +}; + +['ethereum', 'polygon', 'moonbeam', 'arbitrum', 'optimism', 'mantle'].forEach(chain => { + module.exports[chain] = { tvl } +}) From 6e7d6f4f56048851f8335ea053a0d756f88ebe58 Mon Sep 17 00:00:00 2001 From: charq <73696209+buchaoqun@users.noreply.github.com> Date: Fri, 8 Sep 2023 15:37:39 +0800 Subject: [PATCH 1162/1974] update mantle network graphUrl (#7420) * add mantle network * update mantle network graphUrl --- projects/solv-protocol-v3/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/solv-protocol-v3/index.js b/projects/solv-protocol-v3/index.js index 8d803bec7a7..28aa2272c7f 100644 --- a/projects/solv-protocol-v3/index.js +++ b/projects/solv-protocol-v3/index.js @@ -7,7 +7,7 @@ const graphUrlList = { ethereum: 'https://api.studio.thegraph.com/query/40045/solv-payable-factory-prod/version/latest', bsc: 'https://api.thegraph.com/subgraphs/name/slov-payable/solv-v3-earn-factory', arbitrum: 'https://api.studio.thegraph.com/query/40045/solv-payable-factory-arbitrum/version/latest', - mantle: 'https://graph.fusionx.finance/subgraphs/id/QmfV5npZ5X2tZ4qR9DCLAhrFum6wANF7cnJDrZMpkNLfMo', + mantle: 'http://api.0xgraph.xyz/subgraphs/name/solv-payable-factory-mentle-0xgraph', } const filterSlot = [ From a85560fcf8243baa784ec98f52f1394e98d61c6f Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 8 Sep 2023 11:19:04 +0200 Subject: [PATCH 1163/1974] snowswap: track darwinia chain --- projects/helper/chains.json | 3 ++- projects/helper/env.js | 1 + projects/helper/tokenMapping.js | 3 +++ projects/snowswap-xyz/index.js | 8 ++------ 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/projects/helper/chains.json b/projects/helper/chains.json index 74301c11c84..c691d822b8b 100644 --- a/projects/helper/chains.json +++ b/projects/helper/chains.json @@ -46,12 +46,13 @@ "csc", "cube", "curio", - "dsc", + "darwinia", "defichain", "dexit", "dfk", "doge", "dogechain", + "dsc", "echelon", "elastos", "elrond", diff --git a/projects/helper/env.js b/projects/helper/env.js index 44eea928a6c..6ab31b7be3d 100644 --- a/projects/helper/env.js +++ b/projects/helper/env.js @@ -10,6 +10,7 @@ const DEFAULTS = { SUI_RPC: 'https://fullnode.mainnet.sui.io/', MULTIVERSX_RPC: 'https://api.multiversx.com', ETHEREUMCLASSIC_RPC: 'https://etc.etcdesktop.com,https://etc.rivet.link', + CRAB_RPC: 'https://darwiniacrab-rpc.dwellir.com', ANKR_API_KEY: '79258ce7f7ee046decc3b5292a24eb4bf7c910d7e39b691384c7ce0cfb839a01', } diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 3a3b34ed414..f1d7e0b90b6 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -48,6 +48,9 @@ const fixBalancesTokens = { mvc: { [ADDRESSES.mvc.SPACE]: { coingeckoId: "microvisionchain", decimals: 8 }, }, + darwinia: { + '0xe7578598aac020abfb918f33a20fad5b71d670b4': { coingeckoId: "darwinia-network-native-token", decimals: 18 }, + }, } ibcChains.forEach(chain => fixBalancesTokens[chain] = { ...ibcMappings, ...(fixBalancesTokens[chain] || {}) }) diff --git a/projects/snowswap-xyz/index.js b/projects/snowswap-xyz/index.js index d8c76420613..d36b3d7f9e4 100644 --- a/projects/snowswap-xyz/index.js +++ b/projects/snowswap-xyz/index.js @@ -2,10 +2,6 @@ const { getUniTVL } = require('../helper/unknownTokens') module.exports = { misrepresentedTokens: true, - crab: { - tvl: getUniTVL({ - useDefaultCoreAssets: true, - factory: '0x36ABF1A7851fBF9ae9D79dc3E39C1227068158B3', - }) - }, + crab: { tvl: getUniTVL({ useDefaultCoreAssets: true, factory: '0x36ABF1A7851fBF9ae9D79dc3E39C1227068158B3', }), }, + darwinia: { tvl: getUniTVL({ useDefaultCoreAssets: true, factory: '0x5669a449D892f03B4c541A321926f18e272c64A2', }), }, } \ No newline at end of file From 052d58a4e73abe9d036ce85effce218b65ce3ea1 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 8 Sep 2023 11:29:20 +0200 Subject: [PATCH 1164/1974] fix EM --- projects/elephantmoney/index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/projects/elephantmoney/index.js b/projects/elephantmoney/index.js index d4a7bc710f2..5d16c554510 100644 --- a/projects/elephantmoney/index.js +++ b/projects/elephantmoney/index.js @@ -1,6 +1,7 @@ -const ADDRESSES = require('../helper/coreAssets.json') +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const { stakings } = require("../helper/staking"); +const { pool2 } = require("../helper/pool2"); const contracts = { BUSD: ADDRESSES.bsc.BUSD, @@ -26,7 +27,7 @@ async function tvl(timestamp, block, chainBlocks) { module.exports = { bsc: { - pool2: stakings([contracts.TRUNK, contracts.ELEPHANT], LPs, "bsc"), + pool2: pool2([contracts.TRUNK, contracts.ELEPHANT], LPs, "bsc"), tvl: tvl, staking: stakings([contracts.staking], contracts.ELEPHANT, 'bsc') } From 378e9fafd80ec33e6fe76ac121f23d2a2dcf4af2 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 8 Sep 2023 11:41:23 +0200 Subject: [PATCH 1165/1974] fix badger treasury --- projects/treasury/badger-dao.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/treasury/badger-dao.js b/projects/treasury/badger-dao.js index c1a00ee5dd7..b2f905a1aac 100644 --- a/projects/treasury/badger-dao.js +++ b/projects/treasury/badger-dao.js @@ -47,6 +47,7 @@ module.exports = treasuryExports({ ], owners: [treasury_vault, treasury_ops, treasury_voter, treasury_dev, treasury_tech, treasury_pay, treasury_drip1, treasury_drip2, treasury_bfraxbp], ownTokens: [BADGER, DIGG], + blacklistedTokens: ['0x7491989cfbc6da74141bc8cd187e480c21ece169'], resolveUniV3: true, transformAddress, }, From e6748034efe43631b96b60bedea0ecafa29583fa Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 8 Sep 2023 11:58:11 +0200 Subject: [PATCH 1166/1974] backed ignore certain wallets --- projects/backed/index.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/projects/backed/index.js b/projects/backed/index.js index 7ea74bbcfdd..a4cbc55eadb 100644 --- a/projects/backed/index.js +++ b/projects/backed/index.js @@ -1,3 +1,4 @@ +const { sumTokens2 } = require("../helper/unwrapLPs") const contracts = [ "0x2F123cF3F37CE3328CC9B5b8415f9EC5109b45e7", // bC3M @@ -9,6 +10,11 @@ const contracts = [ "0x1e2c4fb7ede391d116e6b41cd0608260e8801d59", // bCSPX "0x20C64dEE8FdA5269A78f2D5BDBa861CA1d83DF7a", // bHIGH ].map(i => i.toLowerCase()) + +const blacklistedOwners = [ + '0x5F7A4c11bde4f218f0025Ef444c369d838ffa2aD', // working capital + '0x43624c744A4AF40754ab19b00b6f681Ca56F1E5b', // treasury/cold wallet +] async function tvl(_, _b, _cb, { api, }) { let tokens = [...contracts] @@ -17,6 +23,12 @@ async function tvl(_, _b, _cb, { api, }) { tokens = tokens.filter(i => i !== '0x1e2c4fb7ede391d116e6b41cd0608260e8801d59') } const supply = await api.multiCall({ abi: 'erc20:totalSupply', calls: tokens }) + const balances = {} + await sumTokens2({ api, tokens, owners: blacklistedOwners, balances, transformAddress: i => i}) + Object.entries(balances).forEach(([token, bal]) => { + api.add(token, bal * -1) + }) + api.addTokens(tokens, supply) return api.getBalances() } From 0565a99c61131b6aba3bfa6e6fcf1dec458ad7a1 Mon Sep 17 00:00:00 2001 From: Ewan Sheldon Date: Fri, 8 Sep 2023 12:14:24 +0200 Subject: [PATCH 1167/1974] Add The Standard Smart Vaults project (#7409) * add standard smart vault to projects * remove use of external api * change from block * use tokensAndOwners, rather than tokens and owners --- projects/standard-smart-vaults/index.js | 48 +++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 projects/standard-smart-vaults/index.js diff --git a/projects/standard-smart-vaults/index.js b/projects/standard-smart-vaults/index.js new file mode 100644 index 00000000000..20dc40fe52a --- /dev/null +++ b/projects/standard-smart-vaults/index.js @@ -0,0 +1,48 @@ +const { ethers } = require('ethers'); +const { getLogs } = require('../helper/cache/getLogs') +const SMART_VAULT_MANAGER_ADDRESS = '0xba169cceCCF7aC51dA223e04654Cf16ef41A68CC' +const { sumTokens2 } = require('../helper/unwrapLPs') +const START_TS = 1693206000; + +const tokens = [ + ethers.constants.AddressZero, + '0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f', + '0x912CE59144191C1204E64559FE8253a0e49E6548', + '0xf97f4df75117a78c1A5a0DBb814Af92458539FB4', + '0xfEb4DfC8C4Cf7Ed305bb08065D08eC6ee6728429' +] + +async function getOwners(api) { + const vaultEvents = await getLogs({ + target: SMART_VAULT_MANAGER_ADDRESS, + topic: 'VaultDeployed(address,address,address,uint256)', + eventAbi: 'event VaultDeployed(address indexed vaultAddress, address indexed owner, address vaultType, uint256 tokenId)', + fromBlock: 117059962, + api + }); + + return vaultEvents.map(event => event.args.vaultAddress); +} + +async function getTokensAndOwners(api) { + const tokensAndOwners = []; + const owners = await getOwners(api); + for (let i = 0; i < tokens.length; i++) { + for (let j = 0; j < owners.length; j++) { + tokensAndOwners.push([tokens[i], owners[j]]); + } + } + return tokensAndOwners; +} + +module.exports = { + timetravel: true, + misrepresentedTokens: false, + methodology: 'counts the aggregated assets locked in The Standard Smart Vaults.', + start: START_TS, + arbitrum: { + tvl: async (_, _1, _2, { api }) => { + return sumTokens2({ tokensAndOwners: await getTokensAndOwners(api), api}) + } + } +}; \ No newline at end of file From e12e4294a3fef4476ec5bb8f600c6db57ccbaa77 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 8 Sep 2023 12:15:11 +0200 Subject: [PATCH 1168/1974] revert change --- projects/standard-smart-vaults/index.js | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/projects/standard-smart-vaults/index.js b/projects/standard-smart-vaults/index.js index 20dc40fe52a..b12886613c7 100644 --- a/projects/standard-smart-vaults/index.js +++ b/projects/standard-smart-vaults/index.js @@ -24,25 +24,12 @@ async function getOwners(api) { return vaultEvents.map(event => event.args.vaultAddress); } -async function getTokensAndOwners(api) { - const tokensAndOwners = []; - const owners = await getOwners(api); - for (let i = 0; i < tokens.length; i++) { - for (let j = 0; j < owners.length; j++) { - tokensAndOwners.push([tokens[i], owners[j]]); - } - } - return tokensAndOwners; -} - module.exports = { - timetravel: true, - misrepresentedTokens: false, methodology: 'counts the aggregated assets locked in The Standard Smart Vaults.', start: START_TS, arbitrum: { tvl: async (_, _1, _2, { api }) => { - return sumTokens2({ tokensAndOwners: await getTokensAndOwners(api), api}) + return sumTokens2({ owners: await getOwners(api), tokens, api}) } } }; \ No newline at end of file From 8f4c6a7467c25e67633ce48d1b2028430505ef15 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 8 Sep 2023 14:07:40 +0200 Subject: [PATCH 1169/1974] track timeless --- projects/timeless/index.js | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/projects/timeless/index.js b/projects/timeless/index.js index 40e4ad90895..219fc8b128a 100644 --- a/projects/timeless/index.js +++ b/projects/timeless/index.js @@ -13,24 +13,22 @@ async function tvl(_, block, _1, { api }) { api, target: factory, fromBlock: 14916925, - topic: 'DeployYieldTokenPair(address,address,address,address)', + onlyArgs: true, + eventAbi: "event DeployYieldTokenPair(address indexed gate, address indexed vault, address nyt, address pyt)", }) ) - const toa = [] + const toa = logs.map(i => [i.vault, i.gate]) - logs.forEach(({ topics }) => { - const gate = `0x${topics[1].substring(26)}` - const vault = `0x${topics[2].substring(26)}` - toa.push([vault, gate]) - }) - const balances = await sumTokens2({ api, tokensAndOwners: toa, }) + await sumTokens2({ api, tokensAndOwners: toa, }) const wl_stETH = wl_stETH_token - const wl_stETH_balance = balances[wl_stETH] - delete balances[wl_stETH] - const unwrappedAsset = await api.call({ target: wl_stETH_token, abi: abi.asset, }) - const balance = await api.call({ target: wl_stETH_token, abi: abi.convertToAssets, params: wl_stETH_balance, }) - - sdk.util.sumSingleBalance(balances, unwrappedAsset, balance) + const balances = api.getBalances() + const wl_stETH_balance = balances['ethereum:'+wl_stETH] + if (wl_stETH_balance) { + delete balances['ethereum:'+wl_stETH] + const unwrappedAsset = await api.call({ target: wl_stETH_token, abi: abi.asset, }) + const balance = await api.call({ target: wl_stETH_token, abi: abi.convertToAssets, params: wl_stETH_balance, }) + api.add(unwrappedAsset, balance) + } return balances } From e39989cf492cde132759945e32dff9c630a66f45 Mon Sep 17 00:00:00 2001 From: define Date: Fri, 8 Sep 2023 13:13:46 +0100 Subject: [PATCH 1170/1974] add treasury the standard --- projects/treasury/the-standard.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 projects/treasury/the-standard.js diff --git a/projects/treasury/the-standard.js b/projects/treasury/the-standard.js new file mode 100644 index 00000000000..1d9725e9e44 --- /dev/null +++ b/projects/treasury/the-standard.js @@ -0,0 +1,28 @@ +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasuryARB = "0x99d5D7C8F40Deba9d0075E8Fff2fB13Da787996a"; +const treasuryETH = "0xf0A13763a2102A6EA036078C602F154A2a5eEc7A" +const TST = "0xf5A27E55C748bCDdBfeA5477CB9Ae924f0f7fd2e" +const TSTETH = "0xa0b93B9e90aB887E53F9FB8728c009746e989B53" + + +module.exports = treasuryExports({ + arbitrum: { + tokens: [ + nullAddress, + "0x643b34980E635719C15a2D4ce69571a258F940E9", + "0xaf88d065e77c8cC2239327C5EDb3A432268e5831" + ], + owners: [treasuryARB], + ownTokens: [TST], + }, + ethereum: { + tokens: [ + nullAddress, + "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", + "0xdAC17F958D2ee523a2206206994597C13D831ec7" + ], + owners: [treasuryETH], + ownTokens: [TSTETH], + }, +}) From d4db1e236d7105bce47c209c455caf4b71e19834 Mon Sep 17 00:00:00 2001 From: define Date: Fri, 8 Sep 2023 13:29:24 +0100 Subject: [PATCH 1171/1974] delete duplicated adapter circuit --- projects/circuit-fi/index.js | 19 ------------------- 1 file changed, 19 deletions(-) delete mode 100644 projects/circuit-fi/index.js diff --git a/projects/circuit-fi/index.js b/projects/circuit-fi/index.js deleted file mode 100644 index 43997d39d77..00000000000 --- a/projects/circuit-fi/index.js +++ /dev/null @@ -1,19 +0,0 @@ - -const { getConfig } = require('../helper/cache') -const { sumUnknownTokens } = require('../helper/unknownTokens') - -async function tvl(_, _b, _cb, { api, }) { - let data = await getConfig('circuit-fi', 'https://raw.githubusercontent.com/Circuit-Finance-Org/circuit-frontend-public/main/src/config/vault/mantle.json') - const pools = data.map(i => i.earnContractAddress) - const tokens = await api.multiCall({ abi: 'address:want', calls: pools}) - const bals = await api.multiCall({ abi: 'uint256:balance', calls: pools}) - api.addTokens(tokens, bals) - return sumUnknownTokens({ api, useDefaultCoreAssets: true, resolveLP: true, }) -} - -module.exports = { - misrepresentedTokens: true, - mantle: { - tvl - }, -}; From 4f33a5557240959e62506ad826c073cd3fd414c6 Mon Sep 17 00:00:00 2001 From: Rahul Pramod Jaguste Date: Fri, 8 Sep 2023 18:32:44 +0530 Subject: [PATCH 1172/1974] Feat/Added ETHx Node operator SD Collateral balance to TVL (#7422) * Add Node operator SD Collateral balance * removed comments and console logs --- projects/stader/index.js | 111 +++++++++++++++++++++++++-------------- 1 file changed, 71 insertions(+), 40 deletions(-) diff --git a/projects/stader/index.js b/projects/stader/index.js index 1906dc87982..9b97376d494 100644 --- a/projects/stader/index.js +++ b/projects/stader/index.js @@ -1,57 +1,66 @@ -const { nullAddress, sumTokens2 } = require('../helper/unwrapLPs') -const { get } = require("../helper/http") -let _res +const { nullAddress, sumTokens2 } = require("../helper/unwrapLPs"); +const { get } = require("../helper/http"); +const { ethers } = require("ethers"); +let _res; async function getData() { - if (!_res) _res = get("https://universe.staderlabs.com/common/tvl") - return _res + if (!_res) _res = get("https://universe.staderlabs.com/common/tvl"); + return _res; } async function hbarTvl(timestamp) { - const res = await get("https://universe.staderlabs.com/common/tvl") + const res = await get("https://universe.staderlabs.com/common/tvl"); return { - "hedera-hashgraph": res.hedera.native - } + "hedera-hashgraph": res.hedera.native, + }; } async function maticTvl() { - const res = await getData() + const res = await getData(); return { - "matic-network": res.polygon.native - } + "matic-network": res.polygon.native, + }; } async function ftmTvl() { - const res = await getData() + const res = await getData(); return { - "fantom": res.fantom.native - } + fantom: res.fantom.native, + }; } async function terra2Tvl() { - const res = await getData() + const res = await getData(); return { - "terra-luna-2": res.terra.native - } + "terra-luna-2": res.terra.native, + }; } async function bscTvl() { - const res = await getData() + const res = await getData(); return { - "binancecoin": res.bnb.native - } + binancecoin: res.bnb.native, + }; } async function nearTvl() { - const res = await getData() + const res = await getData(); return { - "near": res.near.native - } + near: res.near.native, + }; +} + +async function ethTvl(api) { + return await api.call({ + abi: "uint256:totalAssets", + target: "0xcf5ea1b38380f6af39068375516daf40ed70d299", + }); } module.exports = { timetravel: false, - methodology: 'We aggregated the assets staked across Stader staking protocols', + methodology: + "We aggregated the assets staked across Stader staking protocols", /*terra: { tvl, },*/ @@ -63,32 +72,54 @@ module.exports = { tvl: maticTvl }, */ fantom: { - tvl: ftmTvl + tvl: ftmTvl, }, terra2: { - tvl: terra2Tvl + tvl: terra2Tvl, }, bsc: { - tvl: bscTvl + tvl: bscTvl, }, near: { - tvl: nearTvl + tvl: nearTvl, }, ethereum: { tvl: async (_, _1, _2, { api }) => { + const res = await getData(); + const nodeOperatorRegistry = "0x4f4bfa0861f62309934a5551e0b2541ee82fdcf1"; + const nodeOperatorCount = await api.call({ + abi: "uint256:totalActiveValidatorCount", + target: nodeOperatorRegistry, + }); + + const SDCollateralPoolAddress = + "0x7Af4730cc8EbAd1a050dcad5c03c33D2793EE91f"; + const SDTokenAddress = "0x30D20208d987713f46DFD34EF128Bb16C404D10f"; + + const sdBalance = await api.call({ + abi: "erc20:balanceOf", + target: SDTokenAddress, + params: SDCollateralPoolAddress, + }); + + const SDToEth = await api.call({ + abi: "function convertSDToETH(uint256) view returns (uint256)", + target: SDCollateralPoolAddress, + params: [sdBalance], + }); - const res = await getData() - const nodeOperatorRegistry = '0x4f4bfa0861f62309934a5551e0b2541ee82fdcf1' - const nodeOperatorCount = await api.call({ abi: 'uint256:totalActiveValidatorCount', target: nodeOperatorRegistry }) const balances = { "matic-network": res.polygon.native, - [nullAddress]: +(await api.call({ abi: 'uint256:totalAssets', target: '0xcf5ea1b38380f6af39068375516daf40ed70d299' })) + +nodeOperatorCount * 4 * 1e18 // 4 ETH per node operator - } - return sumTokens2({ api, balances, owner: nodeOperatorRegistry, tokens: [nullAddress] }) - } + [nullAddress]: + +SDToEth + +(await ethTvl(api)) + +nodeOperatorCount * 4 * 1e18, // 4 ETH per node operator + }; + return sumTokens2({ + api, + balances, + owner: nodeOperatorRegistry, + tokens: [nullAddress], + }); + }, }, - hallmarks: [ - [1651881600, "UST depeg"], - ] -} - + hallmarks: [[1651881600, "UST depeg"]], +}; From 4d17281c7fc78d35c000f24163bffc7d8e4d5029 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Fri, 8 Sep 2023 16:08:58 +0100 Subject: [PATCH 1173/1974] add amphora --- projects/amphora/index.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 projects/amphora/index.js diff --git a/projects/amphora/index.js b/projects/amphora/index.js new file mode 100644 index 00000000000..8005385a870 --- /dev/null +++ b/projects/amphora/index.js @@ -0,0 +1,27 @@ +const { sumTokens2 } = require('../helper/unwrapLPs'); + +async function tvl(_, _1, _2, { api }) { + const balances = await sumTokens2({ api, tokensAndOwners:[ + ["0xb2f30a7c980f052f02563fb518dcc39e6bf38175", "0xD842D9651F69cEBc0b2Cffc291fC3D3Fe7b5D226"] + ]}) + const tokens = await api.call({ + target: "0xb688801cadb4ddb6980bb777d42972c24f920855", + abi: "address[]:getEnabledTokens" + }) + const deposited = await api.multiCall({ + abi: "function tokenTotalDeposited(address _tokenAddress) external view returns (uint256 _totalDeposited)", + calls: tokens.map(i => ({ target: "0xb688801cadb4ddb6980bb777d42972c24f920855", params: [i] })) + }) + tokens.forEach((element, i) => { + balances[element] = deposited[i] + }); + + return balances +} + +module.exports = { + methodology: 'Coins deposited as collateral and snxUSD', + ethereum: { + tvl + }, +} \ No newline at end of file From f3b1734ae128a0a6f33013a958ecbec4a2ba030d Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Fri, 8 Sep 2023 16:54:15 +0100 Subject: [PATCH 1174/1974] base on kyber --- projects/kyber/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/projects/kyber/index.js b/projects/kyber/index.js index 658e6b188e8..3046834fffd 100644 --- a/projects/kyber/index.js +++ b/projects/kyber/index.js @@ -28,6 +28,9 @@ const chains = { }, linea: { graphId: 'linea' + }, + base: { + graphId: 'base' } }; @@ -37,6 +40,7 @@ async function fetchPools(chain) { switch (chain) { case "linea": url = 'https://graph-query.linea.build/subgraphs/name/kybernetwork/kyberswap-elastic-linea'; break; case "cronos": url = 'https://cronos-graph.kyberengineering.io/subgraphs/name/kybernetwork/kyberswap-elastic-cronos'; break; + case "base": url = 'https://base-graph.kyberengineering.io/subgraphs/name/kybernetwork/kyberswap-elastic-base'; break; default: url = `https://api.thegraph.com/subgraphs/name/kybernetwork/kyberswap-elastic-${chain}`; } let length From e36758b9383f636e952c74b4d0bfaa41ed860006 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 8 Sep 2023 18:56:19 +0200 Subject: [PATCH 1175/1974] solv-v3: mark funds as borrowed --- projects/solv-protocol-v3/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/solv-protocol-v3/index.js b/projects/solv-protocol-v3/index.js index 28aa2272c7f..51b82293d4f 100644 --- a/projects/solv-protocol-v3/index.js +++ b/projects/solv-protocol-v3/index.js @@ -152,5 +152,5 @@ async function getGraphData(timestamp, chain) { } // node test.js projects/solv-protocol-v3 ['ethereum', 'bsc', 'arbitrum', 'mantle'].forEach(chain => { - module.exports[chain] = { tvl } + module.exports[chain] = { tvl: () => ({}), borrowed: tvl, } }) \ No newline at end of file From 96953d0bee00a02baccbf39fdf18fd922aa45904 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 8 Sep 2023 19:22:58 +0200 Subject: [PATCH 1176/1974] solv-v3: support timetravel --- projects/helper/cache.js | 6 +++++- projects/solv-protocol-v3/index.js | 12 ++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/projects/helper/cache.js b/projects/helper/cache.js index 3d91c7eb63c..a5c18c29752 100644 --- a/projects/helper/cache.js +++ b/projects/helper/cache.js @@ -100,7 +100,7 @@ async function configPost(project, endpoint, data) { } -async function cachedGraphQuery(project, endpoint, query, { variables = {}, fetchById, } = {}) { +async function cachedGraphQuery(project, endpoint, query, { api, useBlock = false, variables = {}, fetchById, } = {}) { if (!project || !endpoint) throw new Error('Missing parameters') const key = 'config-cache' const cacheKey = getKey(key, project) @@ -110,6 +110,10 @@ async function cachedGraphQuery(project, endpoint, query, { variables = {}, fetc async function _cachedGraphQuery() { try { let json + if (useBlock && !variables.block) { + if (!api) throw new Error('Missing parameters') + variables.block = await api.getBlock() + } if (!fetchById) json = await graphql.request(endpoint, query, { variables }) else diff --git a/projects/solv-protocol-v3/index.js b/projects/solv-protocol-v3/index.js index 51b82293d4f..b4dfe5099a0 100644 --- a/projects/solv-protocol-v3/index.js +++ b/projects/solv-protocol-v3/index.js @@ -20,7 +20,7 @@ const filterSlot = [ async function tvl() { const { api } = arguments[3]; const network = api.chain; - const graphData = await getGraphData(api.timestamp, network); + const graphData = await getGraphData(api.timestamp, network, api); if (graphData.slots.length > 0) { const slots = graphData.slots; const closeConcretes = await concrete(slots, api); @@ -116,13 +116,13 @@ async function concrete(slots, api) { } -async function getGraphData(timestamp, chain) { - const slotDataQuery = `query BondSlotInfos { - bondSlotInfos(first: 1000, where:{maturity_gt:${timestamp}}) { +async function getGraphData(timestamp, chain, api) { + const slotDataQuery = `query BondSlotInfos ($block: Int){ + bondSlotInfos(first: 1000, block: { number: $block } where:{maturity_gt:${timestamp}}) { contractAddress slot } - poolOrderInfos(first: 1000, where:{fundraisingEndTime_gt:${timestamp}}) { + poolOrderInfos(first: 1000, block: { number: $block } where:{fundraisingEndTime_gt:${timestamp}}) { marketContractAddress contractAddress navOracle @@ -130,7 +130,7 @@ async function getGraphData(timestamp, chain) { openFundShareSlot } }`; - const data = (await cachedGraphQuery(`solv-protocol/graph-data/${chain}`, graphUrlList[chain], slotDataQuery)); + const data = (await cachedGraphQuery(`solv-protocol/graph-data/${chain}`, graphUrlList[chain], slotDataQuery, { api, useBlock: true, })); let slotList = []; let poolList = []; From 6e686df670c13084913094a59381ccf428f4b571 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Fri, 8 Sep 2023 18:39:51 +0100 Subject: [PATCH 1177/1974] add cubiswap --- projects/cubiswap/index.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 projects/cubiswap/index.js diff --git a/projects/cubiswap/index.js b/projects/cubiswap/index.js new file mode 100644 index 00000000000..1426bdeb660 --- /dev/null +++ b/projects/cubiswap/index.js @@ -0,0 +1,13 @@ +const { getUniTVL } = require('../helper/unknownTokens') +const FACTORY = "0xE6c8488a3078f474D0B75E4ac06a369e3Fb39d76" // This factory is on opBNB Mainnet (Chain Id: 204) + +const dexTVL = getUniTVL({ factory: FACTORY, useDefaultCoreAssets: true, fetchBalances: true, permitFailure: true }) + + +module.exports = { + misrepresentedTokens: true, + methodology: `Uses factory(${FACTORY}) address to find and price Liquidity Pool pairs.`, + op_bnb: { + tvl: dexTVL, + } +}; \ No newline at end of file From fdb2aafb3811b392ca888b875d378dc470020a6e Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 8 Sep 2023 20:16:14 +0200 Subject: [PATCH 1178/1974] fix liqwid --- projects/liqwid/index.js | 67 +++++++++++++++++++++++----------------- 1 file changed, 38 insertions(+), 29 deletions(-) diff --git a/projects/liqwid/index.js b/projects/liqwid/index.js index abcad1aef59..02f0be22f09 100644 --- a/projects/liqwid/index.js +++ b/projects/liqwid/index.js @@ -14,61 +14,70 @@ module.exports = { const endpoint = 'https://api.liqwiddev.net/graphql' -const query = `{ - markets { - asset { - marketId - name +const query = `query ($page: Int) { + Page (page: $page) { + pageInfo { + currentPage + hasNextPage } - totalSupply - marketId - decimals - qTokenId - qTokenPolicyId - utilization market { - params { - underlyingClass { - value0 { - symbol - name - } - } + asset { + marketId + name + qTokenId + qTokenPolicyId } - scripts { - actionToken { - script { + state { + totalSupply + utilization + } + marketId + decimals + info { + params { + underlyingClass { value0 { - value0 + symbol + name + } + } + } + scripts { + actionToken { + script { + value0 { + value0 + } } } } } } } -}` +} +` const tokenMapping = { ADA: 'lovelace', DJED: '8db269c3ec630e06ae29f74bc39edd1f87c819f1056206e879a1cd61446a65644d6963726f555344', USDC: '25c5de5f5b286073c593edfd77b48abc7a48e5a4f3d4cd9d428ff93555534443', } -const getToken = market => tokenMapping[market.marketId.toUpperCase()] ?? base64ToHex(market.market.params.underlyingClass.value0.symbol) +const getToken = market => tokenMapping[market.marketId.toUpperCase()] ?? base64ToHex(market.info.params.underlyingClass.value0.symbol) async function tvl(_, _b, _cb, { api, }) { - const { markets } = await graphQuery(endpoint, query) + const { Page: { market: markets } } = await graphQuery(endpoint, query, { page: 0 }) - markets.forEach(market => api.add(getToken(market), market.totalSupply)) + markets.forEach(market => api.add(getToken(market), market.state.totalSupply)) } async function borrowed(_, _b, _cb, { api, }) { - const { markets } = await graphQuery(endpoint, query) + const { Page: { market: markets } } = await graphQuery(endpoint, query) markets.forEach(market => { - const utilization = market.utilization + const utilization = market.state.utilization const availability = 1 - utilization - const totalBorrowed = market.totalSupply * utilization / availability + const totalBorrowed = market.state.totalSupply * utilization / availability api.add(getToken(market), totalBorrowed) }) } From e5a0a691bc4abf7a8582e06e68011c4e2d5a0971 Mon Sep 17 00:00:00 2001 From: JasonMohanCryptobuild Date: Sat, 9 Sep 2023 12:40:49 +0700 Subject: [PATCH 1179/1974] update factory for PySwap --- projects/pyswap/index.js | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/projects/pyswap/index.js b/projects/pyswap/index.js index c60822ff312..71c04d4a14c 100644 --- a/projects/pyswap/index.js +++ b/projects/pyswap/index.js @@ -1,17 +1,24 @@ const { sumTokensExport } = require("../helper/unwrapLPs"); +const {getUniTVL} = require("../helper/unknownTokens"); -const native_staking_contract = "0xFFD687B05E7178647d4Bb7734e93748dF4A3341a"; +const native_staking_contract_pool1 = "0xFFD687B05E7178647d4Bb7734e93748dF4A3341a"; +const native_staking_contract_pool2 = "0x659ea4563841C59Ec284679d35EDc5ed7025b7a9"; const pys_staking_contract = "0x18E2fA8c010b56779285336D0920F1027f0bDBbb"; const assets = [ - "0x4200000000000000000000000000000000000006", + "0x9b5902C14B56eF2aa2cC1A2A0731a8F270Ee82f0", //WBNB "0x0000000000000000000000000000000000000000", // This is address of native token + "0x602aEe302B2703cD2BAC28e13192593228e0078C", // PYSWAP TOKEN ]; -const PY_SWAP = '0x2928CBA5b5e5B48113281263FC037c7a5d8E1EDf' + +let owners = [native_staking_contract_pool1, native_staking_contract_pool2, pys_staking_contract] + +let TVL_STAKING = sumTokensExport({ owners, tokens: assets }) +let TVL_AMM_DEX = getUniTVL({factory: "0x1434575AbB43103cFb40fd8147FB1e0B2ec3e2A1", useDefaultCoreAssets: true,}) module.exports = { op_bnb: { - tvl: sumTokensExport({ owner: native_staking_contract, tokens: assets }), - staking: sumTokensExport({ owner: pys_staking_contract, tokens: [PY_SWAP] }), + tvl: TVL_AMM_DEX, + staking: TVL_STAKING, }, -}; +}; \ No newline at end of file From ede17c19a02d8bc478164e47509fa4b5fd6b038c Mon Sep 17 00:00:00 2001 From: JasonMohanCryptobuild Date: Sat, 9 Sep 2023 14:06:01 +0700 Subject: [PATCH 1180/1974] update function Pyswap --- projects/pyswap/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/pyswap/index.js b/projects/pyswap/index.js index 71c04d4a14c..86c46d0f573 100644 --- a/projects/pyswap/index.js +++ b/projects/pyswap/index.js @@ -14,7 +14,7 @@ const assets = [ let owners = [native_staking_contract_pool1, native_staking_contract_pool2, pys_staking_contract] let TVL_STAKING = sumTokensExport({ owners, tokens: assets }) -let TVL_AMM_DEX = getUniTVL({factory: "0x1434575AbB43103cFb40fd8147FB1e0B2ec3e2A1", useDefaultCoreAssets: true,}) +let TVL_AMM_DEX = getUniTVL({factory: "0x1434575AbB43103cFb40fd8147FB1e0B2ec3e2A1", useDefaultCoreAssets: true, fetchBalances: true,}) module.exports = { op_bnb: { From b50697e4f460afffc3567625f9fc8987d00ffb9c Mon Sep 17 00:00:00 2001 From: Harleen <119888996+harleen-m@users.noreply.github.com> Date: Sat, 9 Sep 2023 09:50:39 +0200 Subject: [PATCH 1181/1974] Add BaseX (#7427) --- projects/basex/index.js | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 projects/basex/index.js diff --git a/projects/basex/index.js b/projects/basex/index.js new file mode 100644 index 00000000000..61a703d274a --- /dev/null +++ b/projects/basex/index.js @@ -0,0 +1,8 @@ +const { uniV3Export } = require('../helper/uniswapV3') + +module.exports = { + methodology: 'TVL accounts for the liquidity on all AMM pools taken from the factory contract', + ...uniV3Export({ + base: { factory: '0x38015d05f4fec8afe15d7cc0386a126574e8077b', fromBlock: 3152527 }, + }) +} From a1296da1ce96c2900dd616d913ca1d981e0b0451 Mon Sep 17 00:00:00 2001 From: define Date: Sat, 9 Sep 2023 10:45:07 +0100 Subject: [PATCH 1182/1974] add dalmatiandex --- projects/dalmatiandex/index.js | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 projects/dalmatiandex/index.js diff --git a/projects/dalmatiandex/index.js b/projects/dalmatiandex/index.js new file mode 100644 index 00000000000..ec70804526f --- /dev/null +++ b/projects/dalmatiandex/index.js @@ -0,0 +1,3 @@ +const { uniTvlExport } = require('../helper/unknownTokens') + +module.exports = uniTvlExport('shibarium', '0x80108b858e04d5a35EF7dA7A67Cf45eeD18abf27', { fetchBalances: true, }) \ No newline at end of file From e49bfbcf02626ef6b38666b681fcdc3836e10074 Mon Sep 17 00:00:00 2001 From: g1nt0ki Date: Sat, 9 Sep 2023 12:31:28 +0200 Subject: [PATCH 1183/1974] fix liqwid --- projects/liqwid/index.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/projects/liqwid/index.js b/projects/liqwid/index.js index 02f0be22f09..38a5d7fda60 100644 --- a/projects/liqwid/index.js +++ b/projects/liqwid/index.js @@ -59,16 +59,26 @@ const query = `query ($page: Int) { const tokenMapping = { ADA: 'lovelace', DJED: '8db269c3ec630e06ae29f74bc39edd1f87c819f1056206e879a1cd61446a65644d6963726f555344', - USDC: '25c5de5f5b286073c593edfd77b48abc7a48e5a4f3d4cd9d428ff93555534443', + SHEN: '8db269c3ec630e06ae29f74bc39edd1f87c819f1056206e879a1cd615368656e4d6963726f555344', + USDC: 'usd-coin', } const getToken = market => tokenMapping[market.marketId.toUpperCase()] ?? base64ToHex(market.info.params.underlyingClass.value0.symbol) async function tvl(_, _b, _cb, { api, }) { + const { Page: { market: markets } } = await graphQuery(endpoint, query, { page: 0 }) - markets.forEach(market => api.add(getToken(market), market.state.totalSupply)) + markets.forEach(market => add(api, market, market.state.totalSupply)) +} + +function add(api, market, bal) { + const token = getToken(market) + if (token === 'usd-coin') bal /= 1e8 + api.add(token, bal, { + skipChain: token === 'usd-coin' + }) } async function borrowed(_, _b, _cb, { api, }) { @@ -78,7 +88,7 @@ async function borrowed(_, _b, _cb, { api, }) { const utilization = market.state.utilization const availability = 1 - utilization const totalBorrowed = market.state.totalSupply * utilization / availability - api.add(getToken(market), totalBorrowed) + add(api, market, totalBorrowed) }) } From 6d6d152139cbf18ff708d1c16669c568f9c488df Mon Sep 17 00:00:00 2001 From: Strategic Reserve Date: Sun, 10 Sep 2023 12:08:55 -0700 Subject: [PATCH 1184/1974] Add Sushiswap - Base (#7440) --- projects/visor/config.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/projects/visor/config.js b/projects/visor/config.js index d0ad9c2b744..d86aa0c9685 100644 --- a/projects/visor/config.js +++ b/projects/visor/config.js @@ -22,9 +22,9 @@ const HYPE_REGISTRY = { ], polygon: [ ["0x0Ac4C7b794f3D7e7bF1093A4f179bA792CF15055", 25305922], // Uniswap + ["0x97686103B3E7238Ca6c2C439146B30adBd84a593", 43578714], // Sushiswap ["0xAeC731F69Fa39aD84c7749E913e3bC227427Adfd", 35447517], // Quickswap ["0xcAC19d43C9558753d7535978A370055614Ce832E", 42562328], // Retro - ["0x97686103B3E7238Ca6c2C439146B30adBd84a593", 43578714], // Sushiswap ["0x7b9c2f68f16c3618bb45616fb98d83f94fd7062e", 44933860], // Ascent ], polygon_zkevm: [ @@ -35,8 +35,8 @@ const HYPE_REGISTRY = { ], arbitrum: [ ["0x66CD859053c458688044d816117D5Bdf42A56813", 10617223], // Uniswap - ["0x37595FCaF29E4fBAc0f7C1863E3dF2Fe6e2247e9", 63562888], // Zyberswap ["0x0f867F14b39a5892A39841a03bA573426DE4b1d0", 102240553], // Sushiswap + ["0x37595FCaF29E4fBAc0f7C1863E3dF2Fe6e2247e9", 63562888], // Zyberswap ["0x34Ffbd9Db6B9bD8b095A0d156de69a2AD2944666", 99952729], // Ramses ["0xa216C2b6554A0293f69A1555dd22f4b7e60Fe907", 87343880], // Camelot ], @@ -68,6 +68,7 @@ const HYPE_REGISTRY = { ], base: [ ["0x1E86A593E55215957C4755f1BE19a229AF3286f6", 2798768], // SynthSwap + ["0x6d5c54F535b073B9C2206Baf721Af2856E5cD683", 3785552], // Sushiswap ], }; @@ -78,4 +79,4 @@ Object.keys(HYPE_REGISTRY).forEach(chain => { } }) -module.exports = config \ No newline at end of file +module.exports = config From d5a19414659a9ac92e796ef1c0ccccc98ae4ba5d Mon Sep 17 00:00:00 2001 From: Shell Yu Date: Mon, 11 Sep 2023 03:12:00 +0800 Subject: [PATCH 1185/1974] equilibria add chain bsc and optimism (#7435) Co-authored-by: xiaodongyu --- projects/equilibria/index.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/projects/equilibria/index.js b/projects/equilibria/index.js index eef4aa78494..b848170a21c 100644 --- a/projects/equilibria/index.js +++ b/projects/equilibria/index.js @@ -15,6 +15,18 @@ const contracts = { eqbRewardsAddress: "0x70f61901658aAFB7aE57dA0C30695cE4417e72b9", pendleAddress: "0x0c880f6761F1af8d9Aa9C466984b80DAb9a8c9e8", }, + bsc: { + boosterAddress: "0x4D32C8Ff2fACC771eC7Efc70d6A8468bC30C26bF", + staker: "0x64627901dAdb46eD7f275fD4FC87d086cfF1e6E3", + eqbRewardsAddress: "0x0140dE476f49B6B42f7b73612b6dc317aB91D3BC", + pendleAddress: "0xb3Ed0A426155B79B898849803E3B36552f7ED507", + }, + optimism: { + boosterAddress: "0x18C61629E6CBAdB85c29ba7993f251b3EbE2B356", + staker: "0x4D32C8Ff2fACC771eC7Efc70d6A8468bC30C26bF", + eqbRewardsAddress: "0x22Fc5A29bd3d6CCe19a06f844019fd506fCe4455", + pendleAddress: "0xBC7B1Ff1c6989f006a1185318eD4E7b5796e66E1", + } }; async function tvl(chain, block) { @@ -78,7 +90,7 @@ async function tvl(chain, block) { return balances; } -const chains = ["ethereum", "arbitrum"]; +const chains = ["ethereum", "arbitrum", 'bsc', 'optimism']; module.exports = { doublecounted: true, From 6218cfbb6e761b61d56bfaa30c1fc954b0d09af6 Mon Sep 17 00:00:00 2001 From: WafuDressing Dev <143034158+wafu-dressing@users.noreply.github.com> Date: Mon, 11 Sep 2023 02:14:53 +0700 Subject: [PATCH 1186/1974] Add PlantBaseSwap (#7434) --- projects/plantbaseswap/index.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 projects/plantbaseswap/index.js diff --git a/projects/plantbaseswap/index.js b/projects/plantbaseswap/index.js new file mode 100644 index 00000000000..86bf38a600d --- /dev/null +++ b/projects/plantbaseswap/index.js @@ -0,0 +1,19 @@ +const { getUniTVL, sumTokensExport } = require('../helper/unknownTokens') +const PLANT = "0x23082Dd85355b51BAe42248C961E7F83486e7694"; +const FACTORY = "0xA081Ce40F079A381b59893b4Dc0abf8B1817af70" + + +const dexTVL = getUniTVL({ factory: FACTORY, useDefaultCoreAssets: true, fetchBalances: true }) + + +module.exports = { + misrepresentedTokens: true, + methodology: `Uses factory(${FACTORY}) address and whitelisted tokens address to find and price Liquidity Pool pairs.`, + base: { + tvl: dexTVL, + staking: sumTokensExport({ + owners: ['0xECBb9E8fc8CAa4f01C7A44d4c8947143a470C352'], + tokens: [PLANT], + }) + } +}; \ No newline at end of file From 7e41bbb3332c5c0856dff027d96fe2a8021d6677 Mon Sep 17 00:00:00 2001 From: netherlabs-gh <143496268+netherlabs-gh@users.noreply.github.com> Date: Mon, 11 Sep 2023 05:32:07 +1000 Subject: [PATCH 1187/1974] add nether.fi on base (#7428) Co-authored-by: dlneti --- projects/nether-fi/index.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 projects/nether-fi/index.js diff --git a/projects/nether-fi/index.js b/projects/nether-fi/index.js new file mode 100644 index 00000000000..4e48eab5632 --- /dev/null +++ b/projects/nether-fi/index.js @@ -0,0 +1,13 @@ +const { staking } = require("../helper/staking"); +const { gmxExports } = require("../helper/gmx"); + +const vaultBase = "0xAd378C374f7996235E927e693eDea32605C0A61F"; +const stakingBase = "0x6ffC50886775D4A26AF1B0f88F9df61267e69aec"; +const NFI = "0x60359A0DD148B18d5cF1Ddf8Aa1916221ED0cbCd"; + +module.exports = { + base: { + staking: staking(stakingBase, NFI, "base"), + tvl: gmxExports({ vault: vaultBase }), + } +}; From 134aa902dec27acc75b89698ec2a8422d661b597 Mon Sep 17 00:00:00 2001 From: SimsalaCrypto <94809733+SimsalaCrypto@users.noreply.github.com> Date: Sun, 10 Sep 2023 21:42:13 +0200 Subject: [PATCH 1188/1974] new collateral types (#7425) * - added Polygon TVL * - added formatting * - added new collateral types --- projects/preon/index.js | 68 +++++++++++++++++++++++++++++++++-------- 1 file changed, 55 insertions(+), 13 deletions(-) diff --git a/projects/preon/index.js b/projects/preon/index.js index a2a8eb8f40e..07e9d6c36d8 100644 --- a/projects/preon/index.js +++ b/projects/preon/index.js @@ -1,16 +1,58 @@ -const {sumTokensExport} = require('../helper/unwrapLPs') -const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require("../helper/unwrapLPs"); +const ADDRESSES = require("../helper/coreAssets.json"); const config = { - arbitrum: { - ownerTokens: [[[ADDRESSES.null, '0x82aF49447D8a07e3bd95BD0d56f35241523fBab1', '0xe50fa9b3c56ffb159cb0fca61f5c9d750e8128c8'], '0xA2Ce28868A852f4B01903B5de07d4835feFe9086'], [['0x8ffdf2de812095b1d19cb146e4c004587c0a0692', '0x93b346b6bc2548da6a1e7d98e9a421b42541425b',], '0x8AD15574A87e30061f24977faaA2d99bC45A3169'],], - }, polygon: { - ownerTokens: [[[ADDRESSES.null, '0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270', '0x6d80113e533a2C0fe82EaBD35f1875DcEA89Ea97'], '0x82CD73E9cc96cC12569D412cC2480E4d5962AfF5'],], - } -} + arbitrum: { + ownerTokens: [ + [ + [ + ADDRESSES.null, + "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1", + "0xe50fa9b3c56ffb159cb0fca61f5c9d750e8128c8", + ], + "0xA2Ce28868A852f4B01903B5de07d4835feFe9086", + ], + [ + [ + "0x8ffdf2de812095b1d19cb146e4c004587c0a0692", + "0x93b346b6bc2548da6a1e7d98e9a421b42541425b", + ], + "0x8AD15574A87e30061f24977faaA2d99bC45A3169", + ], + ], + }, + polygon: { + ownerTokens: [ + [ + [ + ADDRESSES.null, + "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270", + "0x6d80113e533a2C0fe82EaBD35f1875DcEA89Ea97", + ], + "0x82CD73E9cc96cC12569D412cC2480E4d5962AfF5", + ], + [ + [ + ADDRESSES.null, + "0x3A58a54C066FdC0f2D55FC9C89F0415C92eBf3C4", + "0xEA1132120ddcDDA2F119e99Fa7A27a0d036F7Ac9", + ], + "0x8105Fc3487F117982Eb5A5456D8639b0353242d8", + ], + [ + [ + ADDRESSES.null, + "0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063", + "0x82E64f49Ed5EC1bC6e43DAD4FC8Af9bb3A2312EE", + ], + "0xdc4552609a3f673f0b72958f678d4a48d0e94ebd", + ], + ], + }, +}; -Object.keys(config).forEach(chain => { - module.exports[chain] = { - tvl: sumTokensExport(config[chain]) - } -}) \ No newline at end of file +Object.keys(config).forEach((chain) => { + module.exports[chain] = { + tvl: sumTokensExport(config[chain]), + }; +}); From a1821bb389081f9e33722b1f4322b8ea83e35a6c Mon Sep 17 00:00:00 2001 From: TJakubek <39831436+TJakubek@users.noreply.github.com> Date: Sun, 10 Sep 2023 22:02:52 +0200 Subject: [PATCH 1189/1974] enosys: adding FLR/APS farm (#7432) --- projects/flarefarm/flare.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/flarefarm/flare.js b/projects/flarefarm/flare.js index 26c0b2d1dd6..f9e0c5eb52c 100644 --- a/projects/flarefarm/flare.js +++ b/projects/flarefarm/flare.js @@ -11,6 +11,7 @@ const chain = 'flare' async function farmTvl(timestamp, ethblock, { [chain]: block }) { const tokens = [ ['0x7520005032F43229F606d3ACeae97045b9D6F7ea', "0x22beb4c7166DbAa0A33052A770C3b358cAbE9089"], + ['0xef24D5155818d4bD16AF0Cea1148A147eb620743', "0x3DA590b357Cf17a413ec8db70FeB02119AfE707f"], ]; return sumUnknownTokens({ tokensAndOwners: tokens, chain, block, useDefaultCoreAssets: true, }) From c603e9f6e6da2ae77bbf0319561bf6a82ba48302 Mon Sep 17 00:00:00 2001 From: 0xPowerRanger <127472302+0xPowerRanger@users.noreply.github.com> Date: Mon, 11 Sep 2023 15:12:43 +0800 Subject: [PATCH 1190/1974] [Range protocol] update mantle addresses (#7443) --- projects/range/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/range/index.js b/projects/range/index.js index 965df2d5255..ba6a5b7b890 100644 --- a/projects/range/index.js +++ b/projects/range/index.js @@ -7,7 +7,7 @@ const config = { bsc: { factory: '0xad2b34a2245b5a7378964BC820e8F34D14adF312', fromBlock: 28026886, }, polygon: { factory: '0xad2b34a2245b5a7378964BC820e8F34D14adF312', fromBlock: 42446548, }, base: { factory: '0x4bF9CDcCE12924B559928623a5d23598ca19367B', fromBlock: 2733457, }, - mantle: { factory: '0x4bF9CDcCE12924B559928623a5d23598ca19367B', fromBlock: 1364977 , } + mantle: { factory: '0x3E89E72026DA6093DD6E4FED767f1f5db2fc0Fb4', fromBlock: 5345161 , } } module.exports = { @@ -17,7 +17,7 @@ module.exports = { }; // vaults that were deployed through factory but are uninitialized and unused -const ignoreList = {mantle : ["0xd1c0CB290BA214a79AC31B8B3FB3F3eD00B88612"]} +const ignoreList = {mantle : ["0x3f7a9ea2403F27Ce54624CE505D01B2204eDa030"]} Object.keys(config).forEach(chain => { const { factory, fromBlock } = config[chain] module.exports[chain] = { From f9fca60b0cf127e50da5f0a92a6ca9fdc4c74da4 Mon Sep 17 00:00:00 2001 From: 0xSTONE Date: Mon, 11 Sep 2023 15:15:41 +0800 Subject: [PATCH 1191/1974] Add mantle chain to mufex (#7442) --- projects/mufex/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/mufex/index.js b/projects/mufex/index.js index 6cabb58fb75..54eb4431c03 100644 --- a/projects/mufex/index.js +++ b/projects/mufex/index.js @@ -10,4 +10,5 @@ module.exports = { arbitrum: { tvl: sumTokensExport({ owners, tokens: [ADDRESSES.arbitrum.USDT] }) }, polygon: { tvl: sumTokensExport({ owners, tokens: [ADDRESSES.polygon.USDT] }) }, bsc: { tvl: sumTokensExport({ owners, tokens: [ADDRESSES.bsc.USDT] }) }, + mantle: { tvl: sumTokensExport({ owners, tokens: [ADDRESSES.mantle.USDT] }) }, }; From 63088249504d3e6895b8930a8a1989a29772195c Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 11 Sep 2023 09:34:03 +0200 Subject: [PATCH 1192/1974] Abachi (#7444) * add Abachi project for treasury tvl * track under treasury metric --------- Co-authored-by: admin --- projects/treasury/abachi.js | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 projects/treasury/abachi.js diff --git a/projects/treasury/abachi.js b/projects/treasury/abachi.js new file mode 100644 index 00000000000..3862e085106 --- /dev/null +++ b/projects/treasury/abachi.js @@ -0,0 +1,8 @@ +const { treasuryExports } = require("../helper/treasury"); + +module.exports = treasuryExports({ + ethereum: { + owners: ['0x6fce4c6cdd8c4e6c7486553d09bdd9aee61cf095'], + ownTokens: ['0xBF0B8b7475EdB32D103001Efd19FdD2753d7B76D'], + }, +}) From 0c42ed807b31d877c58fcfe413d2ff09a00d49cd Mon Sep 17 00:00:00 2001 From: DackieSwap <132213730+DackieSwap@users.noreply.github.com> Date: Mon, 11 Sep 2023 14:47:56 +0700 Subject: [PATCH 1193/1974] Add DackieSwap V2 as an additional tabs on DackieSwap (#7439) --- projects/dackieswap-v2/index.js | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 projects/dackieswap-v2/index.js diff --git a/projects/dackieswap-v2/index.js b/projects/dackieswap-v2/index.js new file mode 100644 index 00000000000..15ce758297b --- /dev/null +++ b/projects/dackieswap-v2/index.js @@ -0,0 +1,6 @@ +const { getUniTVL, } = require('../helper/unknownTokens') + +module.exports = { + misrepresentedTokens: true, + base: { tvl: getUniTVL({ factory: '0x591f122D1df761E616c13d265006fcbf4c6d6551', useDefaultCoreAssets: true, fetchBalances: true }) } +}; \ No newline at end of file From 26dfae603cde56beb117eef72479e0f0fab5262c Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 11 Sep 2023 09:50:27 +0200 Subject: [PATCH 1194/1974] Leech-protocol (#7411) * add leech-protocol * update tvl calculation via sdk * code refactor * format * venus strategy calc as wantPool (#7438) --------- Co-authored-by: yarscript --- projects/leech-protocol/index.js | 99 ++++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 projects/leech-protocol/index.js diff --git a/projects/leech-protocol/index.js b/projects/leech-protocol/index.js new file mode 100644 index 00000000000..ecfa301458c --- /dev/null +++ b/projects/leech-protocol/index.js @@ -0,0 +1,99 @@ +const { sumTokens2 } = require('../helper/unwrapLPs') +const { getConfig } = require('../helper/cache') + +const poolsUrl = "https://pc.leechprotocol.com/pool-data/lama"; + +async function getPoolData(api) { + return getConfig('leech-protocol/' + api.chain, `${poolsUrl}/${api.chainId}`) +} + +async function tvl(_, _b, _cb, { api, }) { + const { items: pools } = await getPoolData(api); + const chain = api.chain + const wantPools = [] + const lpPools = [] + const sslpPools = [] + const biswapPools = [] + const thenaPools = [] + pools.forEach(({ address, name }) => { + switch (chain) { + case 'avax': + if (name === 'strategy-yak') { + wantPools.push(address) + } + break; + case 'optimism': + if (name === 'sushi-opt') { + sslpPools.push(address) + } else if (name === 'velo-opt') { + lpPools.push(address) + } + + break; + case 'bsc': + if (name === 'strategy-thena') { + thenaPools.push(address) + } else if (name === 'strategy-biswap-farm') { + biswapPools.push(address) + } else if (name === 'strategy-venus-supl') { + wantPools.push(address) + } + break; + } + }) + + if (wantPools.length > 0) { + const wTokens = await api.multiCall({ abi: 'address:want', calls: wantPools }) + const wBals = await api.multiCall({ abi: 'uint256:balanceOfUnderlying', calls: wantPools }) + api.addTokens(wTokens, wBals) + } + + if (lpPools.length > 0) { + const wTokens = await api.multiCall({ abi: 'address:lp', calls: lpPools }) + const wBals = await api.multiCall({ abi: 'uint256:balance', calls: lpPools }) + api.addTokens(wTokens, wBals) + await sumTokens2({ api, resolveLP: true, }) + } + + if (thenaPools.length > 0) { + const sslpTokens = await api.multiCall({ abi: 'address:want', calls: thenaPools }) + const sslpBals = await api.multiCall({ abi: 'uint256:balance', calls: thenaPools }) + const supplies = await api.multiCall({ abi: 'uint256:totalSupply', calls: sslpTokens }) + const token0s = await api.multiCall({ abi: 'address:token0', calls: sslpTokens }) + const token1s = await api.multiCall({ abi: 'address:token1', calls: sslpTokens }) + const reserves = await api.multiCall({ abi: 'function getTotalAmounts() public view returns (uint256, uint256)', calls: sslpTokens }) + reserves.forEach(([token0Bal, token1Bal], i) => { + const ratio = sslpBals[i] / supplies[i] + api.add(token0s[i], token0Bal * ratio) + api.add(token1s[i], token1Bal * ratio) + }) + } + + if (sslpPools.length > 0) { + const sslpTokens = await api.multiCall({ abi: 'address:lp', calls: sslpPools }) + const sslpBals = await api.multiCall({ abi: 'uint256:balance', calls: sslpPools }) + const supplies = await api.multiCall({ abi: 'uint256:totalSupply', calls: sslpTokens }) + const token0s = await api.multiCall({ abi: 'address:token0', calls: sslpTokens }) + const token1s = await api.multiCall({ abi: 'address:token1', calls: sslpTokens }) + const reserves = await api.multiCall({ abi: 'function getReserves() public view returns (uint256, uint256)', calls: sslpTokens }) + reserves.forEach(([token0Bal, token1Bal], i) => { + const ratio = sslpBals[i] / supplies[i] + api.add(token0s[i], token0Bal * ratio) + api.add(token1s[i], token1Bal * ratio) + }) + } + + if (biswapPools.length > 0) { + const wTokens = await api.multiCall({ abi: 'address:want', calls: biswapPools }) + const wBals = await api.multiCall({ abi: 'uint256:balance', calls: biswapPools }) + api.addTokens(wTokens, wBals) + await sumTokens2({ api, resolveLP: true, }) + } + return api.getBalances() +} + +module.exports = { + bsc: { tvl }, + avax: { tvl }, + optimism: { tvl }, +}; \ No newline at end of file From c2556846c812cac54c39fb78b70a1f8dad61f49d Mon Sep 17 00:00:00 2001 From: matthieuzola <143651482+matthieuzola@users.noreply.github.com> Date: Mon, 11 Sep 2023 14:54:32 +0700 Subject: [PATCH 1195/1974] update factory for Shibfi (#7433) --- projects/shibfi/index.js | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/projects/shibfi/index.js b/projects/shibfi/index.js index ce0dcfb2063..74d2d4966e6 100644 --- a/projects/shibfi/index.js +++ b/projects/shibfi/index.js @@ -1,10 +1,24 @@ -const ADDRESSES = require('../helper/coreAssets.json') const { sumTokensExport } = require("../helper/unwrapLPs"); +const {getUniTVL} = require("../helper/unknownTokens"); -const native_staking_contract = "0xF04d9E9CE754c9dA855Fd6A2b84efA9d4cD293F5"; +const native_staking_contract_pool1 = "0xF04d9E9CE754c9dA855Fd6A2b84efA9d4cD293F5"; +const native_staking_contract_pool2 = "0xDC8AE9ACC2ea98F7a3A40b3fFCA210435226566B"; +const shibfi_staking_contract = "0x1ae96F6E24Ca24Db5cA97797E528d63bfc9dD0Ef"; + +const assets = [ + "0x7915fE3be85D591cC0395D30AB76Ee7aA12a085D", //WBONE + "0x0000000000000000000000000000000000000000", // This is address of native token + "0xa98900F53fa3e5bFe6F2283F4C4E57ca3DF5387c", // SHIBFI TOKEN +]; + +let owners = [native_staking_contract_pool1, native_staking_contract_pool2, shibfi_staking_contract] + +let TVL_STAKING = sumTokensExport({ owners, tokens: assets }) +let TVL_AMM_DEX = getUniTVL({factory: "0x7956FdCe944ed2A0e2bDF25d2de6c6b34398B657", useDefaultCoreAssets: true,}) module.exports = { shibarium: { - tvl: sumTokensExport({ owner: native_staking_contract, tokens: [ADDRESSES.null] }), + tvl: TVL_AMM_DEX, + staking: TVL_STAKING, }, -}; +}; \ No newline at end of file From e08547e53fde349ae4f7c594728c0174d8398933 Mon Sep 17 00:00:00 2001 From: CairoFi <144523106+CairoFi@users.noreply.github.com> Date: Mon, 11 Sep 2023 16:02:11 +0800 Subject: [PATCH 1196/1974] Add CairoFi Swap (#7430) --- projects/cairofiswap/abi.js | 77 +++++++++++++++++++++++++++++++++++ projects/cairofiswap/api.js | 48 ++++++++++++++++++++++ projects/cairofiswap/index.js | 1 + 3 files changed, 126 insertions(+) create mode 100644 projects/cairofiswap/abi.js create mode 100644 projects/cairofiswap/api.js create mode 100644 projects/cairofiswap/index.js diff --git a/projects/cairofiswap/abi.js b/projects/cairofiswap/abi.js new file mode 100644 index 00000000000..a3ee514e816 --- /dev/null +++ b/projects/cairofiswap/abi.js @@ -0,0 +1,77 @@ +const fabis = [ + { + "inputs": [], + "name": "get_all_pairs", + "outputs": [ + { + "name": "all_pairs_len", + "type": "felt" + }, + { + "name": "all_pairs", + "type": "felt*" + } + ], + "stateMutability": "view", + "type": "function" + } +] + +const pabis = [ + { + "inputs": [], + "name": "token0", + "outputs": [ + { + "name": "address", + "type": "felt" + } + ], + "stateMutability": "view", + "type": "function", + "customType": "address" + }, + { + "inputs": [], + "name": "token1", + "outputs": [ + { + "name": "address", + "type": "felt" + } + ], + "stateMutability": "view", + "type": "function", + "customType": "address" + }, + { + "inputs": [], + "name": "get_reserves", + "outputs": [ + { + "name": "reserve0", + "type": "Uint256" + }, + { + "name": "block_timestamp_last", + "type": "felt" + }, + { + "name": "reserve1", + "type": "Uint256" + }, + ], + "stateMutability": "view", + "type": "function" + }, +] + + +const factory = {} +const pair = {} +fabis.forEach(i => factory[i.name] = i) +pabis.forEach(i => pair[i.name] = i) + +module.exports = { + factory, pair, fabis, pabis, +} \ No newline at end of file diff --git a/projects/cairofiswap/api.js b/projects/cairofiswap/api.js new file mode 100644 index 00000000000..b7890490d16 --- /dev/null +++ b/projects/cairofiswap/api.js @@ -0,0 +1,48 @@ +// https://www.starknetjs.com/docs/API/contract + +const { call, multiCall, parseAddress, } = require('../helper/chain/starknet') +const { getCache, setCache, } = require('../helper/cache') +const abi = require('./abi') +const { transformDexBalances } = require('../helper/portedTokens') +const factory = '0x75c43221d5da7fd4bf77e128083363fc42f8d89c810935e08a83d376fae2689' + +async function tvl() { + let { all_pairs } = await call({ target: factory, abi: abi.factory.get_all_pairs }) + + const calls = all_pairs.map(i => parseAddress(i)) + const cache = await getCache('cairofiswap', 'starknet') ?? {} + if (!cache.token0s) { + cache.token0s = [] + cache.token1s = [] + } + const oldCacheLength = cache.token0s.length + const newCalls = calls.slice(oldCacheLength) + + const _token0s = await multiCall({ abi: abi.pair.token0, calls: newCalls }) + const _token1s = await multiCall({ abi: abi.pair.token1, calls: newCalls }) + const reserves = await multiCall({ abi: abi.pair.get_reserves, calls }) + + cache.token0s.push(..._token0s) + cache.token1s.push(..._token1s) + if (cache.token0s.length > oldCacheLength) await setCache('cairofiswap', 'starknet', cache) + + + const data = [] + reserves.forEach((reserve, i) => { + data.push({ + token0: cache.token0s[i], + token1: cache.token1s[i], + token0Bal: +reserve.reserve0, + token1Bal: +reserve.reserve1, + }) + }) + + return transformDexBalances({ chain: 'starknet', data }) +} + +module.exports = { + timetravel: false, + starknet: { + tvl, + } +} \ No newline at end of file diff --git a/projects/cairofiswap/index.js b/projects/cairofiswap/index.js new file mode 100644 index 00000000000..674e8c995c1 --- /dev/null +++ b/projects/cairofiswap/index.js @@ -0,0 +1 @@ +module.exports = require('./api') \ No newline at end of file From 2636a2053d2f61ee42951a6146cb359e665a8c96 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 11 Sep 2023 10:17:24 +0200 Subject: [PATCH 1197/1974] track https://beta.caval.re/ --- projects/cavel-re/index.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 projects/cavel-re/index.js diff --git a/projects/cavel-re/index.js b/projects/cavel-re/index.js new file mode 100644 index 00000000000..6d31e108064 --- /dev/null +++ b/projects/cavel-re/index.js @@ -0,0 +1,18 @@ +const config = { + avax: { pools: ['0x5f1e8ed8468232bab71eda9f4598bda3161f48ea'], }, +} + + +Object.keys(config).forEach(chain => { + const { pools } = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const poolData = await api.multiCall({ abi: abi.assets, calls: pools}) + return api.sumTokens({ ownerTokens: poolData.map((v, i) => [v.map(j => j.token), pools[i]])}) + } + } +}) + +const abi = { + "assets": "function assets() view returns (tuple(address token, uint256 index, string name, string symbol, uint8 decimals, uint256 conversion, uint256 fee, uint256 balance, uint256 meanBalance, uint256 scale, uint256 meanScale, uint256 lastUpdated)[])", +} \ No newline at end of file From c59d8a92c1ad5359ee3d3f7680657e4682bf5912 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 11 Sep 2023 11:15:30 +0200 Subject: [PATCH 1198/1974] update bumper to include earn tvl --- projects/bumper/index.js | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/projects/bumper/index.js b/projects/bumper/index.js index 6c5b8024d70..d33b24ef414 100644 --- a/projects/bumper/index.js +++ b/projects/bumper/index.js @@ -1,22 +1,21 @@ const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require('../helper/unwrapLPs') const sdk = require('@defillama/sdk') -const USDC = ADDRESSES.ethereum.USDC const contract = "0xBabeE6d5F6EDD301B5Fae591a0D61AB702b359d0" -async function tvl(time, block) { - return { - [USDC]: (await sdk.api.abi.call({ - target: contract, - block, - abi: 'uint256:currentTVL' - })).output - } -} +const oldTvl = sumTokensExport({ owner: contract, tokens: [ADDRESSES.ethereum.USDC, '0x5f18c75abdae578b483e5f43f12a39cf75b973a9']}) + +const vaultTvl = sumTokensExport({ tokensAndOwners: [ + [ADDRESSES.ethereum.WETH, '0x277b016D7Df1D8fC96F2Dcc6CE7a3789BaC7a25a'], + [ADDRESSES.ethereum.USDC, '0x235A4998bD0ABa7CBDDc2E770ff79b3B49493fd5'], +]}) module.exports = { methodology: `Count the USDC that has been deposited on ${contract}`, ethereum: { - tvl, + tvl: sdk.util.sumChainTvls([oldTvl, vaultTvl]), + pool2: sumTokensExport({ owner: '0xD3122B06aD755f9b8F6fBA6dFb9c684c7A373e1c', tokens: ['0x11FA2Aac28F4E84b2e5B9907580Dbf44A1975912'], resolveLP: true, }), + staking: sumTokensExport({ owner: '0x967583939a2E660567345CFEe6BE66870075B3d1', tokens: ['0x785c34312dfA6B74F6f1829f79ADe39042222168'], }), }, hallmarks: [ [1626264000, "LP Program Starts"], From 9c4cc4e7f0b3c3756700a8ec70f2b3f033b053a1 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 11 Sep 2023 12:00:26 +0200 Subject: [PATCH 1199/1974] track vmex.fi --- projects/vmex-fi/index.js | 44 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 projects/vmex-fi/index.js diff --git a/projects/vmex-fi/index.js b/projects/vmex-fi/index.js new file mode 100644 index 00000000000..962aa359761 --- /dev/null +++ b/projects/vmex-fi/index.js @@ -0,0 +1,44 @@ +const config = { + optimism: { pool: '0x60F015F66F3647168831d31C7048ca95bb4FeaF9', }, +} + +Object.keys(config).forEach(chain => { + const { pool } = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const reserveData = await getReserveData(api) + return api.sumTokens({ tokensAndOwners: reserveData.map(i => [i.token, i.aTokenAddress])}) + }, + borrowed: async (_, _b, _cb, { api, }) => { + const reserveData = await getReserveData(api) + const borrows = await api.multiCall({ abi: 'erc20:totalSupply', calls: reserveData.map(i => i.variableDebtTokenAddress)}) + api.addTokens(reserveData.map(i => i.token), borrows) + return api.getBalances() + }, + } + + async function getReserveData(api) { + let trancheId = 0 + let hasMoreTranches = true + let data = [] + do { + let reserves + try { + reserves = await api.call({ target: pool, abi: abi.getReservesList, params: [trancheId] }) + } catch (e) { + hasMoreTranches = false + return data + } + if (!reserves.length) return data + const iData = await api.multiCall({ abi: abi.getReserveData, calls: reserves.map(i => ({ params: [i, trancheId] })), target: pool }) + reserves.forEach((reserve, i) => iData[i].token = reserve) + data.push(...iData) + trancheId++ + } while (hasMoreTranches) + } +}) + +const abi = { + "getReserveData": "function getReserveData(address asset, uint64 trancheId) view returns (tuple(tuple(uint256 data) configuration, uint128 liquidityIndex, uint128 variableBorrowIndex, uint128 currentLiquidityRate, uint128 currentVariableBorrowRate, uint40 lastUpdateTimestamp, address aTokenAddress, address variableDebtTokenAddress, uint8 id, address interestRateStrategyAddress, uint64 baseLTV, uint64 liquidationThreshold, uint64 liquidationBonus, uint64 borrowFactor))", + "getReservesList": "function getReservesList(uint64 trancheId) view returns (address[])", +} \ No newline at end of file From 1c084315e74099cbe49fc532e2007e2e7f65c2ab Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 11 Sep 2023 12:22:37 +0200 Subject: [PATCH 1200/1974] track arcade v3 --- projects/arcade-xyz-v3/index.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 projects/arcade-xyz-v3/index.js diff --git a/projects/arcade-xyz-v3/index.js b/projects/arcade-xyz-v3/index.js new file mode 100644 index 00000000000..c7e81fb6e3b --- /dev/null +++ b/projects/arcade-xyz-v3/index.js @@ -0,0 +1,22 @@ +const { sumTokens2 } = require('../helper/unwrapLPs') +const { getConfig } = require('../helper/cache') +const loanCoreAddress = '0x89bc08BA00f135d608bc335f6B33D7a9ABCC98aF' + +const endpoint = 'https://api.arcade.xyz/api/v2/loans?state=Active' + +async function tvl(_, _b, _cb, { api, }) { + const data = await getConfig('arcade-xyz/v3', endpoint) + const tokensAndOwners = data + .filter(i => i.protocolVersion === '3' && i.collateralKind === 'VAULT') + .map(({ collateral: i, vaultAddress }) => i.filter(i => i.kind === 'ERC721').map(i => [i.collectionAddress, vaultAddress])) + .flat() + + await sumTokens2({api, tokensAndOwners, blacklistedOwners: [loanCoreAddress], permitFailure: true, }) + return sumTokens2({ owner: loanCoreAddress, resolveNFTs: true, api}) + +} + + +module.exports = { + ethereum: { tvl, }, +} \ No newline at end of file From 5df1f7ec774768f1f9d513c05751d88006af3216 Mon Sep 17 00:00:00 2001 From: Kyli Date: Mon, 11 Sep 2023 18:28:39 +0800 Subject: [PATCH 1201/1974] fix: hashmix tvl api was down last week, now back online (#7445) --- projects/hashmix/index.js | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/projects/hashmix/index.js b/projects/hashmix/index.js index a5b12390c6e..0f109a556e2 100644 --- a/projects/hashmix/index.js +++ b/projects/hashmix/index.js @@ -1,26 +1,32 @@ const POOL = "0x587A7eaE9b461ad724391Aa7195210e0547eD11d"; -const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') +const { sumTokens2, nullAddress } = require("../helper/unwrapLPs"); const { get } = require("../helper/http"); const BigNumber = require("bignumber.js"); const { sdk } = require("@defillama/sdk"); -async function tvl(_, _1, _2, { api }) { - const totalBorrows = await api.call({ target: POOL, abi: "uint256:totalBorrows", }); - const totalReserves = await api.call({ target: POOL, abi: "uint256:totalReserves", }); - api.add(nullAddress, totalBorrows) - api.add(nullAddress, totalReserves * -1) +// async function tvl(_, _1, _2, { api }) { +// const totalBorrows = await api.call({ +// target: POOL, +// abi: "uint256:totalBorrows", +// }); +// const totalReserves = await api.call({ +// target: POOL, +// abi: "uint256:totalReserves", +// }); +// api.add(nullAddress, totalBorrows); +// api.add(nullAddress, totalReserves * -1); +// +// return sumTokens2({ api, owner: POOL, tokens: [nullAddress] }); +// } +async function tvl(_, _1, _2, { api }) { + let tvl = await get("https://fvm.hashmix.org/fevmapi/tvl"); + api.add(nullAddress, tvl.data); return sumTokens2({ api, owner: POOL, tokens: [nullAddress] }); } /* async function tvl1(_, _1, _2, { api }) { - // let tvl = await get("https://fvm.hashmix.org/fevmapi/tvl"); - - // api.add(nullAddress, tvl.data) - - // return sumTokens2({ api, owner: POOL, tokens: [nullAddress] }); - const balances = {}; const bal = await sdk.api2.eth.getBalance({ target: POOL, chain: api.chain, decimals: api.decimals }); const totalBorrows = await sdk.api2.abi.call({ From 5444062f3821726d9d4e9ae7b1c2156d83f2d991 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 11 Sep 2023 12:29:17 +0200 Subject: [PATCH 1202/1974] Revert "fix: hashmix tvl api was down last week, now back online (#7445)" (#7446) This reverts commit 5df1f7ec774768f1f9d513c05751d88006af3216. --- projects/hashmix/index.js | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/projects/hashmix/index.js b/projects/hashmix/index.js index 0f109a556e2..a5b12390c6e 100644 --- a/projects/hashmix/index.js +++ b/projects/hashmix/index.js @@ -1,32 +1,26 @@ const POOL = "0x587A7eaE9b461ad724391Aa7195210e0547eD11d"; -const { sumTokens2, nullAddress } = require("../helper/unwrapLPs"); +const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') const { get } = require("../helper/http"); const BigNumber = require("bignumber.js"); const { sdk } = require("@defillama/sdk"); -// async function tvl(_, _1, _2, { api }) { -// const totalBorrows = await api.call({ -// target: POOL, -// abi: "uint256:totalBorrows", -// }); -// const totalReserves = await api.call({ -// target: POOL, -// abi: "uint256:totalReserves", -// }); -// api.add(nullAddress, totalBorrows); -// api.add(nullAddress, totalReserves * -1); -// -// return sumTokens2({ api, owner: POOL, tokens: [nullAddress] }); -// } - async function tvl(_, _1, _2, { api }) { - let tvl = await get("https://fvm.hashmix.org/fevmapi/tvl"); - api.add(nullAddress, tvl.data); + const totalBorrows = await api.call({ target: POOL, abi: "uint256:totalBorrows", }); + const totalReserves = await api.call({ target: POOL, abi: "uint256:totalReserves", }); + api.add(nullAddress, totalBorrows) + api.add(nullAddress, totalReserves * -1) + return sumTokens2({ api, owner: POOL, tokens: [nullAddress] }); } /* async function tvl1(_, _1, _2, { api }) { + // let tvl = await get("https://fvm.hashmix.org/fevmapi/tvl"); + + // api.add(nullAddress, tvl.data) + + // return sumTokens2({ api, owner: POOL, tokens: [nullAddress] }); + const balances = {}; const bal = await sdk.api2.eth.getBalance({ target: POOL, chain: api.chain, decimals: api.decimals }); const totalBorrows = await sdk.api2.abi.call({ From 146d3b26aaf7ebde5f624d4ae47dea4ffa034641 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 11 Sep 2023 12:33:12 +0200 Subject: [PATCH 1203/1974] fix formatting bumper --- projects/bumper/index.js | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/projects/bumper/index.js b/projects/bumper/index.js index d33b24ef414..fafad5168a1 100644 --- a/projects/bumper/index.js +++ b/projects/bumper/index.js @@ -3,25 +3,27 @@ const { sumTokensExport } = require('../helper/unwrapLPs') const sdk = require('@defillama/sdk') const contract = "0xBabeE6d5F6EDD301B5Fae591a0D61AB702b359d0" -const oldTvl = sumTokensExport({ owner: contract, tokens: [ADDRESSES.ethereum.USDC, '0x5f18c75abdae578b483e5f43f12a39cf75b973a9']}) +const oldTvl = sumTokensExport({ owner: contract, tokens: [ADDRESSES.ethereum.USDC, '0x5f18c75abdae578b483e5f43f12a39cf75b973a9'] }) -const vaultTvl = sumTokensExport({ tokensAndOwners: [ +const vaultTvl = sumTokensExport({ + tokensAndOwners: [ [ADDRESSES.ethereum.WETH, '0x277b016D7Df1D8fC96F2Dcc6CE7a3789BaC7a25a'], [ADDRESSES.ethereum.USDC, '0x235A4998bD0ABa7CBDDc2E770ff79b3B49493fd5'], -]}) + ] +}) module.exports = { - methodology: `Count the USDC that has been deposited on ${contract}`, - ethereum: { - tvl: sdk.util.sumChainTvls([oldTvl, vaultTvl]), - pool2: sumTokensExport({ owner: '0xD3122B06aD755f9b8F6fBA6dFb9c684c7A373e1c', tokens: ['0x11FA2Aac28F4E84b2e5B9907580Dbf44A1975912'], resolveLP: true, }), - staking: sumTokensExport({ owner: '0x967583939a2E660567345CFEe6BE66870075B3d1', tokens: ['0x785c34312dfA6B74F6f1829f79ADe39042222168'], }), - }, - hallmarks: [ - [1626264000, "LP Program Starts"], - [1634212800, "LP Program Ended"], - [1639656000, "Uniswap V3 Listing and Staking v1 Program starts"], - [1658318400, "Alpha Testing"], - [1677672000, "Uniswap V2 Listing and Liquidity Mining Program"], - ] + methodology: `Count the USDC that has been deposited on ${contract}`, + ethereum: { + tvl: sdk.util.sumChainTvls([oldTvl, vaultTvl]), + pool2: sumTokensExport({ owner: '0xD3122B06aD755f9b8F6fBA6dFb9c684c7A373e1c', tokens: ['0x11FA2Aac28F4E84b2e5B9907580Dbf44A1975912'], resolveLP: true, }), + staking: sumTokensExport({ owner: '0x967583939a2E660567345CFEe6BE66870075B3d1', tokens: ['0x785c34312dfA6B74F6f1829f79ADe39042222168'], }), + }, + hallmarks: [ + [1626264000, "LP Program Starts"], + [1634212800, "LP Program Ended"], + [1639656000, "Uniswap V3 Listing and Staking v1 Program starts"], + [1658318400, "Alpha Testing"], + [1677672000, "Uniswap V2 Listing and Liquidity Mining Program"], + ] } From b5c70fe30a2ac0f8655e45c6fede65e11d78e427 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 11 Sep 2023 12:57:11 +0200 Subject: [PATCH 1204/1974] smardex get token breakdown --- projects/SmarDex/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/SmarDex/index.js b/projects/SmarDex/index.js index f654f4f6d53..c881996110f 100644 --- a/projects/SmarDex/index.js +++ b/projects/SmarDex/index.js @@ -12,7 +12,7 @@ const config = { Object.keys(config).forEach(chain => { const factory = config[chain] module.exports[chain] = { - tvl: getUniTVL({ factory, fetchBalances: true, }) + tvl: getUniTVL({ factory, fetchBalances: true, useDefaultCoreAssets: false }) } }) From 4b7cff9ec215f0482e6fac01d7bfd28069c24d52 Mon Sep 17 00:00:00 2001 From: AceOfbase <142683717+AceOfBase2023@users.noreply.github.com> Date: Mon, 11 Sep 2023 19:35:20 +0400 Subject: [PATCH 1205/1974] Added AceOfBase (#7450) * Add AceOfBase * minor fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/aceofbase/index.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 projects/aceofbase/index.js diff --git a/projects/aceofbase/index.js b/projects/aceofbase/index.js new file mode 100644 index 00000000000..8c856c1d589 --- /dev/null +++ b/projects/aceofbase/index.js @@ -0,0 +1,14 @@ +const { getUniTVL } = require('../helper/unknownTokens') +const ACE = "0xb1a45A38b88b2183f7523Db2E5E5CEa55b050958"; +const FACTORY = "0x46C6706E81CAD3173773c1ffb5D84C9eb652d570" + +const dexTVL = getUniTVL({ factory: FACTORY, useDefaultCoreAssets: true, fetchBalances: true }) + + +module.exports = { + misrepresentedTokens: true, + methodology: `Uses factory(${FACTORY}) address and whitelisted tokens address to find and price Liquidity Pool pairs. We also have our native token $ACE staking.`, + base: { + tvl: dexTVL, + } +}; From ba8acca6c568d1ff19eac7fcbdc57a6da8f3d618 Mon Sep 17 00:00:00 2001 From: cochilli <138674364+cochilli@users.noreply.github.com> Date: Mon, 11 Sep 2023 15:35:50 +0000 Subject: [PATCH 1206/1974] update contract address (#7449) --- projects/cochilli/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/cochilli/index.js b/projects/cochilli/index.js index d99135f7d7b..6130dee55ce 100644 --- a/projects/cochilli/index.js +++ b/projects/cochilli/index.js @@ -5,6 +5,6 @@ const tokens = [ADDRESSES.base.USDbC]; // USDC module.exports = { base: { // sum vault balances - tvl: sumTokensExport({ owners: ['0x8D5b64b8D8904E4aEc79F10468F347534D2A1b79', '0xcE42C112e617c9BB1Bd8238D6Bb83B89e112fDbc'], tokens }), + tvl: sumTokensExport({ owners: ['0xEA6CEC09e9C8E9a0EA9335aa11719E39fB0C3a5E'], tokens }), }, }; From 7a01f620078e7d9e609dd85cce984d76f6ddffed Mon Sep 17 00:00:00 2001 From: Charlie Kong <103051707+afcharliekong@users.noreply.github.com> Date: Mon, 11 Sep 2023 23:49:02 +0800 Subject: [PATCH 1207/1974] add adaptor for messinaone-ls (#7448) * add adaptor for messinaone-ls * update methodology * code refactor --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/algorai-finance/index.js | 6 ++-- projects/algorai-finance/utils.js | 51 ------------------------------- projects/messinaone-ls/index.js | 17 +++++++++++ 3 files changed, 20 insertions(+), 54 deletions(-) delete mode 100644 projects/algorai-finance/utils.js create mode 100644 projects/messinaone-ls/index.js diff --git a/projects/algorai-finance/index.js b/projects/algorai-finance/index.js index 7e9ee64588b..ad7db271b7a 100644 --- a/projects/algorai-finance/index.js +++ b/projects/algorai-finance/index.js @@ -3,7 +3,7 @@ const sdk = require('@defillama/sdk') const { vaults, } = require("./constants"); -const { readGlobalState } = require("./utils"); +const { getAppGlobalState } = require("../helper/chain/algorand"); /** * @desc Return tvl @@ -13,8 +13,8 @@ const { readGlobalState } = require("./utils"); async function tvl() { const balances = {} const promises = vaults.map(async (vault) => { - const state = await readGlobalState(vault.vaultID, ["vtv"]); - const totalTvl = state[0] ? state[0] / 10 ** vault.assetDecimals : 0; + const state = await getAppGlobalState(vault.vaultID); + const totalTvl = state.vtv ? state.vtv / 10 ** vault.assetDecimals : 0; sdk.util.sumSingleBalance(balances, vault.coingecko, totalTvl) }); await Promise.all(promises) diff --git a/projects/algorai-finance/utils.js b/projects/algorai-finance/utils.js deleted file mode 100644 index 0cfd7e875e1..00000000000 --- a/projects/algorai-finance/utils.js +++ /dev/null @@ -1,51 +0,0 @@ -const { lookupApplications } = require("../helper/chain/algorand"); - -/** - * @desc Read global state from algorand application - * - * @param appId - * @returns {Promise<*>} - */ -async function getAppState(appId) { - const res = await lookupApplications(appId); - return res.application.params["global-state"]; -} - -/** - * @desc Given an encoded string, return its decoded string. - * - * @param str - * @returns {*} - */ -const decodeString = (str) => { - return Buffer.from(str, "base64").toString("binary"); -}; - -/** - * Given an application ID, return the application information including creator, - * approval and clear programs, global and local schemas, and global state. - * @param appIndex - index - * @param keys - Asset keys to find. - */ -const readGlobalState = async (appIndex, keys) => { - const states = await getAppState(appIndex) - - const foundedState = []; - - for (let i = 0; i < states.length; i++) { - const state = states[i]; - const stateKey = decodeString(state.key); - - keys.forEach((key, index) => { - if (key === stateKey) { - foundedState[index] = state.value.uint; - } - }); - - } - return foundedState -}; - -module.exports = { - readGlobalState, -}; diff --git a/projects/messinaone-ls/index.js b/projects/messinaone-ls/index.js new file mode 100644 index 00000000000..ccca07451ec --- /dev/null +++ b/projects/messinaone-ls/index.js @@ -0,0 +1,17 @@ +const { getAppGlobalState } = require("../helper/chain/algorand"); + +const contractId = 1189577109 +const STATE_DEPOSIT_ALGOS = "deposit_algos" + +async function tvl() { + const state = await getAppGlobalState(contractId); + return { + algorand: state[STATE_DEPOSIT_ALGOS]/1e6 + } +} + +module.exports = { + timetravel: false, + methodology: "Fetches ALGOs deposited and the accumulated rewards in Messina.one's Liquid Staking Protocol", + algorand: { tvl }, +}; \ No newline at end of file From 0668bb1a9b5bc502e2f4b2b9025f48c59e651197 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 11 Sep 2023 21:45:22 +0200 Subject: [PATCH 1208/1974] update aeria (#7452) * update aeria * add funds in team wallet --- projects/aeria/index.js | 11 +++++++++-- projects/helper/coreAssets.json | 1 + 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/projects/aeria/index.js b/projects/aeria/index.js index cae310a2dd2..303a5afef2c 100644 --- a/projects/aeria/index.js +++ b/projects/aeria/index.js @@ -1,12 +1,19 @@ const { nullAddress } = require("../helper/tokenMapping"); +const ADDRESSES = require('../helper/coreAssets.json') const FACTORY = "0x649b80892ef773bd64cc3c663950dea3a604f660"; -async function tvl(_, _1, _2, { api }) { +async function tvl(timestamp, _1, _2, { api }) { let vaults = await api.fetchList({ lengthAbi: 'uint256:vaultCount', itemAbi: 'function vaults(uint256) view returns (address)', target: FACTORY, startFromOne: true, }) vaults = vaults.filter(i => i !== nullAddress) + const tokens = await api.multiCall({ abi: 'address:depositToken', calls: vaults }) - return api.sumTokens({ tokensAndOwners2: [tokens, vaults] }) + + // needs to move funds to Multisig in under a month + if (timestamp * 1e3 < +new Date('10-10-2023')) await api.sumTokens({ owner: '0x8C8bA29f177CDEC445F4B5451B57946268D044Fa', tokens: [ADDRESSES.base.USDC]}) + return api.sumTokens({ tokensAndOwners2: [tokens, vaults]}) + // const bals = await api.multiCall({ abi: 'uint256:totalSupply', calls: vaults }) + // api.addTokens(tokens, bals) } module.exports = { diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index 463f4530956..d626fdcc736 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -1353,6 +1353,7 @@ "base": { "WETH": "0x4200000000000000000000000000000000000006", "USDbC": "0xd9aAEc86B65D86f6A7B5B1b0c42FFA531710b6CA", + "USDC": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", "DAI": "0x50c5725949a6f0c72e6c4a641f24049a917db0cb" }, "sei": { From 0f0341c4a164eb5f039ff57dd75ac33f228a3e76 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Tue, 12 Sep 2023 05:30:59 +0100 Subject: [PATCH 1209/1974] add pool2 --- projects/basedfarm/index.js | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/projects/basedfarm/index.js b/projects/basedfarm/index.js index cd638171d81..60e4c1f2176 100644 --- a/projects/basedfarm/index.js +++ b/projects/basedfarm/index.js @@ -1,4 +1,8 @@ +const ADDRESSES = require('../helper/coreAssets.json'); +const { sumUnknownTokens } = require('../helper/unknownTokens'); + const GENESIS_REWARD_POOL = "0x4F4014EC1685699290A311E0A159E1E39914853F"; +const poolInfoAbi = "function poolInfo(uint256) view returns (address token, uint256 allocPoint, uint256 lastRewardTime, uint256 accBasedPerShare, bool isStarted)"; async function tvl(_, _b, _cb, { api, }) { const tokens = [] @@ -16,9 +20,20 @@ async function tvl(_, _b, _cb, { api, }) { return api.sumTokens({ owner: GENESIS_REWARD_POOL, tokens }) } -const poolInfoAbi = "function poolInfo(uint256) view returns (address token, uint256 allocPoint, uint256 lastRewardTime, uint256 accBasedPerShare, bool isStarted)" +async function pool2(timestamp, ethBlock, chainBlocks) { + const pools = [{ + 'pool2Address': '0x5F45e48F9C053286cE9Ca08Db897f8b7eb3f7992', + 'pairToken': ADDRESSES.base.WETH, + 'stakingContract': '0x8A75C6EdD19d9a72b31774F1EE2BC45663d30733' + }]; + + const tokensAndOwners = pools.map(i => ([i.pool2Address, i.stakingContract])); + const coreAssets = pools.map(i => i.pairToken); + + return sumUnknownTokens({ tokensAndOwners, coreAssets, chain: 'base', block: chainBlocks.base }); +} module.exports = { methodology: 'TVL is based on value of the single-sided staked tokens inside of the Genesis reward pool.', - base: { tvl }, + base: { tvl,pool2 }, }; From bbc57596381778ea365c8c2a769df3c3cb321c3f Mon Sep 17 00:00:00 2001 From: tstemko <57684389+tstemko@users.noreply.github.com> Date: Tue, 12 Sep 2023 02:03:03 -0400 Subject: [PATCH 1210/1974] Add ramses vaults (#7457) * Addition of Arbitrum vaults and Polygon Retro vaults to TVL calculation * ichifarm: code refactor * Add BNB chain vaults * Add Ramses vaults to TVL --------- Co-authored-by: Tatyana Stemkovski Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/ichifarm/index.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/projects/ichifarm/index.js b/projects/ichifarm/index.js index 9d491c42b5f..8f4ab49e8bb 100644 --- a/projects/ichifarm/index.js +++ b/projects/ichifarm/index.js @@ -38,6 +38,12 @@ const config = { arbitrum: { vaultConfigs: [ { factory: '0xfBf38920cCbCFF7268Ad714ae5F9Fad6dF607065', fromBlock: 102858581, }, + { factory: '0xAc93148e93d1C49D89b1166BFd74942E80F5D501', fromBlock: 130127537, }, // Ramses + ], + }, + bsc: { + vaultConfigs: [ + { factory: '0xbBB97d634460DACCA0d41E249510Bb741ef46ad3', fromBlock: 29702590, }, ], }, bsc: { From 74a8fa5335223994e6e2f10c210ba0b31e5d4a26 Mon Sep 17 00:00:00 2001 From: The Crow <16514232+0xTheCrow@users.noreply.github.com> Date: Tue, 12 Sep 2023 01:24:04 -0500 Subject: [PATCH 1211/1974] Updating to new Reaper.Farm api (#7458) * Updating to new reaper.farm api * code refactor --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/reaper.farm/index.js | 63 ++++++++++------------------------- 1 file changed, 18 insertions(+), 45 deletions(-) diff --git a/projects/reaper.farm/index.js b/projects/reaper.farm/index.js index c358a91df9d..ae767db575a 100644 --- a/projects/reaper.farm/index.js +++ b/projects/reaper.farm/index.js @@ -1,51 +1,24 @@ -const axios = require("axios"); -const REAPER_API = "http://api.reaper.farm/api"; - -const client = axios.create({ - baseURL: REAPER_API -}); - -function fetchTvl(chainName) { - return async () => { - let tvlMsg; - switch (chainName) { - case 'fantom': - tvlMsg = await client.get('/tvlTotal'); - break; - case 'optimism': - tvlMsg = await client.get('/optimism/tvlTotal'); - break; - case 'arbitrum': - tvlMsg = await client.get('/arbitrum/tvlTotal'); - break; - case 'bsc': - tvlMsg = await client.get('/bsc/tvlTotal'); - break; - default: - tvlMsg = await client.get('/tvlTotal'); - } - const tvl = tvlMsg.data.data.tvlTotal; - return { tether: +tvl }; - } -} +const REAPER_API = "https://2ch9hbg8hh.execute-api.us-east-1.amazonaws.com/dev/api/vaults/"; +const { getConfig } = require('../helper/cache'); +const { sumERC4626Vaults } = require('../helper/erc4626'); +const { sumTokens2 } = require('../helper/unwrapLPs'); module.exports = { - misrepresentedTokens: false, - methodology: `TVL is fetched from the Reaper API(http://api.reaper.farm/api)`, - timetravel: false, - fantom: { - tvl: fetchTvl('fantom') - }, - optimism: { - tvl: fetchTvl('optimism') - }, - arbitrum: { - tvl: fetchTvl('arbitrum') - }, - bsc: { - tvl: fetchTvl('bsc') - }, hallmarks:[ [1659441956, "$1.7m Exploit"], ] } + +const chains = ['optimism', 'arbitrum', 'fantom', 'bsc'] + +chains.forEach(chain => { + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const hexId = '0x'+ api.chainId.toString(16) + const {data} = await getConfig('reaper/'+api.chain, REAPER_API + hexId) + const vaults = Object.values(data).map(i => i.address).filter(i => !['0x85A21D07a3DeEfe58EcD841198D7f774e6444654'].includes(i)) + await sumERC4626Vaults({ api, vaults, abi: { asset: 'address:token', balance: 'uint256:balance' } }) + return sumTokens2({ api, resolveLP: true, }) + } + } +}) \ No newline at end of file From a7ddb895ad2478f339646efa6f5a0ebed089cc7f Mon Sep 17 00:00:00 2001 From: Hodlify <137034650+hodlifyio@users.noreply.github.com> Date: Tue, 12 Sep 2023 14:24:24 +0800 Subject: [PATCH 1212/1974] include stargate eth strategy in hodlify tvl (#7459) --- projects/hodlify/constants.js | 23 ++++++++++++++++++++--- projects/hodlify/helper.js | 14 +++++++++++++- projects/hodlify/index.js | 2 +- 3 files changed, 34 insertions(+), 5 deletions(-) diff --git a/projects/hodlify/constants.js b/projects/hodlify/constants.js index 7aa31785c6d..7346fc35e6a 100644 --- a/projects/hodlify/constants.js +++ b/projects/hodlify/constants.js @@ -1,12 +1,25 @@ const contracts = { + ethereum: { + vaults: [ + // eth + '0x62beB192eBF4790777a084ED482AE1A501b74D65', + ], + strategies: [ + '0xf1633e53140a6c9c898d2c82Dabf93D3289724cb', // stargate-eth + ], + }, optimism: { vaults: [ + // usdc '0x034A4072E63aB05aF057e4E9aFC961EA584fB886', // entry '0xcf038417eac3bEa4be8f296B0Ed994e8410B6eBC', // polygon satellite '0x81C3b05753A40f7dd93F154eDC4112AF2F3B5B3b', // arbitrum satellite + // eth + '0x38B2023e7fF7Fe9a33dFF14350d94F017e538768', ], strategies: [ - '0xe6ab63FbDFec016357da536201139cCf5b6c1059', + '0xe6ab63FbDFec016357da536201139cCf5b6c1059', // stargate-usdc + '0x45B29Ac9F509C6484457d80b66484FC5f2Acd888', // stargate-eth ], }, polygon: { @@ -16,17 +29,21 @@ const contracts = { '0x4a307418cEd78A3f2348FD84e66453Efe0BDD16a', // optimisim satellite ], strategies: [ - '0x283D67CAAFc1AA4A2D54c62Be0A44EdFb8099099', + '0x283D67CAAFc1AA4A2D54c62Be0A44EdFb8099099', // stargate-usdc ], }, arbitrum: { vaults: [ + // usdc '0x98fCBbfb97B61e2DA167A69345c58e4126A5167B', // entry '0x801E78C94d5fffDD6F37684ad5ac68EF3b15E559', // polygon satellite '0x680924B3B81d918B01D43E80C092CF75C6063681', // optimisim satellite + // eth + '0xD7Aac4989D82361b3b4917DA9D51266E66edBe0a', ], strategies: [ - '0x0Dba32cFaE7C7edf59603f1BC450DC15E0f46Ddf', + '0x0Dba32cFaE7C7edf59603f1BC450DC15E0f46Ddf', // stargate-usdc + '0x5efD42C28D86F2628CE0629F2e5B05037252070a' // stargate-eth ] }, } diff --git a/projects/hodlify/helper.js b/projects/hodlify/helper.js index e1d485ea4b4..2b203d69eff 100644 --- a/projects/hodlify/helper.js +++ b/projects/hodlify/helper.js @@ -1,5 +1,12 @@ +const { ethers } = require('ethers'); const { erc4626Abi, stargateLpStakingAbi, stargatePoolAbi } = require('./abi'); +const sgETHMapping = { + ethereum: '0x72E2F4830b9E45d52F80aC08CB2bEC0FeF72eD9c', + arbitrum: '0x82CbeCF39bEe528B5476FE6d1550af59a9dB6Fc0', + optimism: '0xb69c8CBCD90A39D8D3d3ccf0a3E968511C3856A0', +} + // convert stargate lp amount to underlying asset amount const getStrategyVaultValues = async (api, vaultAddresses) => { // find the lpStaking contract address for each vault @@ -25,7 +32,12 @@ const getStrategyVaultValues = async (api, vaultAddresses) => { abi: stargatePoolAbi.amountLPtoLD, }); // find the underlying asset of each lp pool - const assets = await api.multiCall({ calls: lpPools, abi: stargatePoolAbi.token, }); + let assets = await api.multiCall({ calls: lpPools, abi: stargatePoolAbi.token, }); + // map stETH to ETH + const stETH = sgETHMapping[api.chain]?.toLowerCase(); + assets = assets.map((asset) => { + return asset.toLowerCase() === stETH ? ethers.constants.AddressZero : asset; + }); return [assets, convertedAmounts]; } diff --git a/projects/hodlify/index.js b/projects/hodlify/index.js index 9cd256977cc..b17440042f2 100644 --- a/projects/hodlify/index.js +++ b/projects/hodlify/index.js @@ -26,11 +26,11 @@ const tvl = async (_, _1, _2, { api }) => { return api.getBalances(); } - module.exports = { doublecounted: true, start: 1693929600, // Tue Sep 05 2023 16:00:00 GMT+0000 methodology: 'Hodlify TVL including total values of assets deposited in other protocols, and the petty cash in our earning vaults.', + ethereum: { tvl}, arbitrum: { tvl}, optimism: { tvl}, polygon: { tvl}, From d5d4c43e1e49e5fab4ce58ae971bcdf1bea7e4a0 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 12 Sep 2023 08:51:45 +0200 Subject: [PATCH 1213/1974] remove unused dependency --- package-lock.json | 491 +-------------------------------------- package.json | 1 - projects/helper/cache.js | 1 - 3 files changed, 6 insertions(+), 487 deletions(-) diff --git a/package-lock.json b/package-lock.json index d7d315498bf..a64108cd1f1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,7 +15,6 @@ "@solana/web3.js": "^1.36.0", "@solendprotocol/solend-sdk": "^0.6.2", "@supercharge/promise-pool": "^2.1.0", - "aws-sdk": "^2.1268.0", "axios": "^0.27.2", "bignumber.js": "^9.0.1", "blakejs": "^1.2.1", @@ -2957,47 +2956,6 @@ "node": ">= 4.0.0" } }, - "node_modules/available-typed-arrays": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz", - "integrity": "sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/aws-sdk": { - "version": "2.1283.0", - "resolved": "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.1283.0.tgz", - "integrity": "sha512-YlxTF0T9X8AcNrOzFPVOPnX1jNtHZjYHRUCfpsVwqdajHDGGruVsVppgBYXEiCRuTQNUhcJTUx0J0uKBhKQZIA==", - "dependencies": { - "buffer": "4.9.2", - "events": "1.1.1", - "ieee754": "1.1.13", - "jmespath": "0.16.0", - "querystring": "0.2.0", - "sax": "1.2.1", - "url": "0.10.3", - "util": "^0.12.4", - "uuid": "8.0.0", - "xml2js": "0.4.19" - }, - "engines": { - "node": ">= 10.0.0" - } - }, - "node_modules/aws-sdk/node_modules/buffer": { - "version": "4.9.2", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-4.9.2.tgz", - "integrity": "sha512-xq+q3SRMOxGivLhBNaUdC64hDTQwejJ+H0T/NB1XMtTVEwNTrfFF3gAxiyW0Bu/xWEGhjVKgUcMhCrUy2+uCWg==", - "dependencies": { - "base64-js": "^1.0.2", - "ieee754": "^1.1.4", - "isarray": "^1.0.0" - } - }, "node_modules/axios": { "version": "0.27.2", "resolved": "https://registry.npmjs.org/axios/-/axios-0.27.2.tgz", @@ -3182,18 +3140,6 @@ "node": ">=6.14.2" } }, - "node_modules/call-bind": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", - "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", - "dependencies": { - "function-bind": "^1.1.1", - "get-intrinsic": "^1.0.2" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/callsites": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", @@ -3694,14 +3640,6 @@ "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==" }, - "node_modules/events": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/events/-/events-1.1.1.tgz", - "integrity": "sha512-kEcvvCBByWXGnZy6JUlgAp2gBIUjfCAV6P6TgT1/aaQKcmuAEC4OZTV1I4EWQLz2gxZw76atuVyvHhTxvi0Flw==", - "engines": { - "node": ">=0.4.x" - } - }, "node_modules/extract-files": { "version": "9.0.0", "resolved": "https://registry.npmjs.org/extract-files/-/extract-files-9.0.0.tgz", @@ -3853,14 +3791,6 @@ } } }, - "node_modules/for-each": { - "version": "0.3.3", - "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", - "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", - "dependencies": { - "is-callable": "^1.1.3" - } - }, "node_modules/form-data": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", @@ -3897,20 +3827,8 @@ "node_modules/function-bind": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" - }, - "node_modules/get-intrinsic": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.3.tgz", - "integrity": "sha512-QJVz1Tj7MS099PevUG5jvnt9tSkXN8K14dxQlikJuPt4uD9hHAHjLyLBiLR5zELelBdD9QNRAXZzsJx0WaDL9A==", - "dependencies": { - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.3" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "peer": true }, "node_modules/glob": { "version": "7.2.3", @@ -3958,17 +3876,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/gopd": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", - "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", - "dependencies": { - "get-intrinsic": "^1.1.3" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/graceful-fs": { "version": "4.2.10", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", @@ -4040,6 +3947,7 @@ "version": "1.0.3", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "peer": true, "dependencies": { "function-bind": "^1.1.1" }, @@ -4056,31 +3964,6 @@ "node": ">=8" } }, - "node_modules/has-symbols": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", - "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/has-tostringtag": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.0.tgz", - "integrity": "sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==", - "dependencies": { - "has-symbols": "^1.0.2" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/hash.js": { "version": "1.1.7", "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", @@ -4124,11 +4007,6 @@ "ms": "^2.0.0" } }, - "node_modules/ieee754": { - "version": "1.1.13", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.13.tgz", - "integrity": "sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg==" - }, "node_modules/ignore": { "version": "5.2.4", "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.4.tgz", @@ -4186,32 +4064,6 @@ "node": ">= 0.10" } }, - "node_modules/is-arguments": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.1.tgz", - "integrity": "sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA==", - "dependencies": { - "call-bind": "^1.0.2", - "has-tostringtag": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-callable": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", - "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/is-core-module": { "version": "2.11.0", "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.11.0.tgz", @@ -4233,20 +4085,6 @@ "node": ">=0.10.0" } }, - "node_modules/is-generator-function": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.10.tgz", - "integrity": "sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A==", - "dependencies": { - "has-tostringtag": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/is-glob": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", @@ -4268,29 +4106,6 @@ "node": ">=8" } }, - "node_modules/is-typed-array": { - "version": "1.1.10", - "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.10.tgz", - "integrity": "sha512-PJqgEHiWZvMpaFZ3uTc8kHPM4+4ADTlDniuQL7cU/UDA0Ql7F70yGfHph3cLNe+c9toaigv+DFzTJKhc2CtO6A==", - "dependencies": { - "available-typed-arrays": "^1.0.5", - "call-bind": "^1.0.2", - "for-each": "^0.3.3", - "gopd": "^1.0.1", - "has-tostringtag": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==" - }, "node_modules/isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", @@ -4353,14 +4168,6 @@ "uuid": "dist/bin/uuid" } }, - "node_modules/jmespath": { - "version": "0.16.0", - "resolved": "https://registry.npmjs.org/jmespath/-/jmespath-0.16.0.tgz", - "integrity": "sha512-9FzQjJ7MATs1tSpnco1K6ayiYE3figslrXA72G2HQ/n76RzvYlofyi5QM+iX4YRs/pu3yzxlVQSST23+dMDknw==", - "engines": { - "node": ">= 0.6.0" - } - }, "node_modules/js-sdsl": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/js-sdsl/-/js-sdsl-4.2.0.tgz", @@ -4785,20 +4592,6 @@ "node": ">=0.4.0" } }, - "node_modules/punycode": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz", - "integrity": "sha512-RofWgt/7fL5wP1Y7fxE7/EmTLzQVnB0ycyibJ0OOHIlJqTNzglYFxVwETOcIoJqJmpDXJ9xImDv+Fq34F/d4Dw==" - }, - "node_modules/querystring": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz", - "integrity": "sha512-X/xY82scca2tau62i9mDyU9K+I+djTMUsvwf7xnUX5GLvVzgJybOJf4Y6o9Zx3oJK/LSXg5tTZBjwzqVPaPO2g==", - "deprecated": "The querystring API is considered Legacy. new code should use the URLSearchParams API instead.", - "engines": { - "node": ">=0.4.x" - } - }, "node_modules/queue-microtask": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", @@ -4988,11 +4781,6 @@ } ] }, - "node_modules/sax": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.1.tgz", - "integrity": "sha512-8I2a3LovHTOpm7NV5yOyO8IHqgVsfK4+UuySrXU8YXkSRX7k6hCV9b3HrkKCr3nMpgj+0bmocaJJWpvp1oc7ZA==" - }, "node_modules/scrypt-js": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/scrypt-js/-/scrypt-js-3.0.1.tgz", @@ -5332,15 +5120,6 @@ "node": ">=6" } }, - "node_modules/url": { - "version": "0.10.3", - "resolved": "https://registry.npmjs.org/url/-/url-0.10.3.tgz", - "integrity": "sha512-hzSUW2q06EqL1gKM/a+obYHLIO6ct2hwPuviqTTOcfFVc61UbfJ2Q32+uGL/HCPxKqrdGB5QUwIe7UqlDgwsOQ==", - "dependencies": { - "punycode": "1.3.2", - "querystring": "0.2.0" - } - }, "node_modules/url-join": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/url-join/-/url-join-4.0.1.tgz", @@ -5359,26 +5138,6 @@ "node": ">=6.14.2" } }, - "node_modules/util": { - "version": "0.12.5", - "resolved": "https://registry.npmjs.org/util/-/util-0.12.5.tgz", - "integrity": "sha512-kZf/K6hEIrWHI6XqOFUiiMa+79wE/D8Q+NCNAWclkyg3b4d2k7s0QGepNjiABc+aR3N1PAyHL7p6UcLY6LmrnA==", - "dependencies": { - "inherits": "^2.0.3", - "is-arguments": "^1.0.4", - "is-generator-function": "^1.0.7", - "is-typed-array": "^1.1.3", - "which-typed-array": "^1.1.2" - } - }, - "node_modules/uuid": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.0.0.tgz", - "integrity": "sha512-jOXGuXZAWdsTH7eZLtyXMqUb9EcWMGZNbL9YcGBJl4MH4nrxHmZJhEHvyLFrkxo+28uLb/NYRcStH48fnD0Vzw==", - "bin": { - "uuid": "dist/bin/uuid" - } - }, "node_modules/v8-compile-cache-lib": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", @@ -5431,25 +5190,6 @@ "node": ">= 8" } }, - "node_modules/which-typed-array": { - "version": "1.1.9", - "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.9.tgz", - "integrity": "sha512-w9c4xkx6mPidwp7180ckYWfMmvxpjlZuIudNtDf4N/tTAUB8VJbX25qZoAsrtGuYNnGw3pa0AXgbGKRB8/EceA==", - "dependencies": { - "available-typed-arrays": "^1.0.5", - "call-bind": "^1.0.2", - "for-each": "^0.3.3", - "gopd": "^1.0.1", - "has-tostringtag": "^1.0.0", - "is-typed-array": "^1.1.10" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/word-wrap": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", @@ -5490,23 +5230,6 @@ } } }, - "node_modules/xml2js": { - "version": "0.4.19", - "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.19.tgz", - "integrity": "sha512-esZnJZJOiJR9wWKMyuvSE1y6Dq5LCuJanqhxslH2bxM6duahNZ+HMpCLhBQGZkbX6xRf8x1Y2eJlgt2q3qo49Q==", - "dependencies": { - "sax": ">=0.6.0", - "xmlbuilder": "~9.0.1" - } - }, - "node_modules/xmlbuilder": { - "version": "9.0.7", - "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-9.0.7.tgz", - "integrity": "sha512-7YXTQc3P2l9+0rjaUbLwMKRhtmwg1M1eDf6nag7urC7pIPYLD9W/jmzQ4ptRSUbodw5S0jfoGTflLemQibSpeQ==", - "engines": { - "node": ">=4.0" - } - }, "node_modules/yn": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", @@ -7713,40 +7436,6 @@ "integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==", "peer": true }, - "available-typed-arrays": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz", - "integrity": "sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==" - }, - "aws-sdk": { - "version": "2.1283.0", - "resolved": "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.1283.0.tgz", - "integrity": "sha512-YlxTF0T9X8AcNrOzFPVOPnX1jNtHZjYHRUCfpsVwqdajHDGGruVsVppgBYXEiCRuTQNUhcJTUx0J0uKBhKQZIA==", - "requires": { - "buffer": "4.9.2", - "events": "1.1.1", - "ieee754": "1.1.13", - "jmespath": "0.16.0", - "querystring": "0.2.0", - "sax": "1.2.1", - "url": "0.10.3", - "util": "^0.12.4", - "uuid": "8.0.0", - "xml2js": "0.4.19" - }, - "dependencies": { - "buffer": { - "version": "4.9.2", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-4.9.2.tgz", - "integrity": "sha512-xq+q3SRMOxGivLhBNaUdC64hDTQwejJ+H0T/NB1XMtTVEwNTrfFF3gAxiyW0Bu/xWEGhjVKgUcMhCrUy2+uCWg==", - "requires": { - "base64-js": "^1.0.2", - "ieee754": "^1.1.4", - "isarray": "^1.0.0" - } - } - } - }, "axios": { "version": "0.27.2", "resolved": "https://registry.npmjs.org/axios/-/axios-0.27.2.tgz", @@ -7877,15 +7566,6 @@ "node-gyp-build": "^4.3.0" } }, - "call-bind": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", - "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", - "requires": { - "function-bind": "^1.1.1", - "get-intrinsic": "^1.0.2" - } - }, "callsites": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", @@ -8260,11 +7940,6 @@ "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==" }, - "events": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/events/-/events-1.1.1.tgz", - "integrity": "sha512-kEcvvCBByWXGnZy6JUlgAp2gBIUjfCAV6P6TgT1/aaQKcmuAEC4OZTV1I4EWQLz2gxZw76atuVyvHhTxvi0Flw==" - }, "extract-files": { "version": "9.0.0", "resolved": "https://registry.npmjs.org/extract-files/-/extract-files-9.0.0.tgz", @@ -8368,14 +8043,6 @@ "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==" }, - "for-each": { - "version": "0.3.3", - "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", - "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", - "requires": { - "is-callable": "^1.1.3" - } - }, "form-data": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", @@ -8406,17 +8073,8 @@ "function-bind": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" - }, - "get-intrinsic": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.3.tgz", - "integrity": "sha512-QJVz1Tj7MS099PevUG5jvnt9tSkXN8K14dxQlikJuPt4uD9hHAHjLyLBiLR5zELelBdD9QNRAXZzsJx0WaDL9A==", - "requires": { - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.3" - } + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "peer": true }, "glob": { "version": "7.2.3", @@ -8449,14 +8107,6 @@ "type-fest": "^0.20.2" } }, - "gopd": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", - "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", - "requires": { - "get-intrinsic": "^1.1.3" - } - }, "graceful-fs": { "version": "4.2.10", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", @@ -8513,6 +8163,7 @@ "version": "1.0.3", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "peer": true, "requires": { "function-bind": "^1.1.1" } @@ -8523,19 +8174,6 @@ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true }, - "has-symbols": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", - "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==" - }, - "has-tostringtag": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.0.tgz", - "integrity": "sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==", - "requires": { - "has-symbols": "^1.0.2" - } - }, "hash.js": { "version": "1.1.7", "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", @@ -8576,11 +8214,6 @@ "ms": "^2.0.0" } }, - "ieee754": { - "version": "1.1.13", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.13.tgz", - "integrity": "sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg==" - }, "ignore": { "version": "5.2.4", "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.4.tgz", @@ -8623,20 +8256,6 @@ "integrity": "sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==", "peer": true }, - "is-arguments": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.1.tgz", - "integrity": "sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA==", - "requires": { - "call-bind": "^1.0.2", - "has-tostringtag": "^1.0.0" - } - }, - "is-callable": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", - "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==" - }, "is-core-module": { "version": "2.11.0", "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.11.0.tgz", @@ -8652,14 +8271,6 @@ "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", "dev": true }, - "is-generator-function": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.10.tgz", - "integrity": "sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A==", - "requires": { - "has-tostringtag": "^1.0.0" - } - }, "is-glob": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", @@ -8675,23 +8286,6 @@ "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", "dev": true }, - "is-typed-array": { - "version": "1.1.10", - "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.10.tgz", - "integrity": "sha512-PJqgEHiWZvMpaFZ3uTc8kHPM4+4ADTlDniuQL7cU/UDA0Ql7F70yGfHph3cLNe+c9toaigv+DFzTJKhc2CtO6A==", - "requires": { - "available-typed-arrays": "^1.0.5", - "call-bind": "^1.0.2", - "for-each": "^0.3.3", - "gopd": "^1.0.1", - "has-tostringtag": "^1.0.0" - } - }, - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==" - }, "isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", @@ -8745,11 +8339,6 @@ } } }, - "jmespath": { - "version": "0.16.0", - "resolved": "https://registry.npmjs.org/jmespath/-/jmespath-0.16.0.tgz", - "integrity": "sha512-9FzQjJ7MATs1tSpnco1K6ayiYE3figslrXA72G2HQ/n76RzvYlofyi5QM+iX4YRs/pu3yzxlVQSST23+dMDknw==" - }, "js-sdsl": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/js-sdsl/-/js-sdsl-4.2.0.tgz", @@ -9080,16 +8669,6 @@ "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", "peer": true }, - "punycode": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz", - "integrity": "sha512-RofWgt/7fL5wP1Y7fxE7/EmTLzQVnB0ycyibJ0OOHIlJqTNzglYFxVwETOcIoJqJmpDXJ9xImDv+Fq34F/d4Dw==" - }, - "querystring": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz", - "integrity": "sha512-X/xY82scca2tau62i9mDyU9K+I+djTMUsvwf7xnUX5GLvVzgJybOJf4Y6o9Zx3oJK/LSXg5tTZBjwzqVPaPO2g==" - }, "queue-microtask": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", @@ -9188,11 +8767,6 @@ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" }, - "sax": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.1.tgz", - "integrity": "sha512-8I2a3LovHTOpm7NV5yOyO8IHqgVsfK4+UuySrXU8YXkSRX7k6hCV9b3HrkKCr3nMpgj+0bmocaJJWpvp1oc7ZA==" - }, "scrypt-js": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/scrypt-js/-/scrypt-js-3.0.1.tgz", @@ -9441,15 +9015,6 @@ } } }, - "url": { - "version": "0.10.3", - "resolved": "https://registry.npmjs.org/url/-/url-0.10.3.tgz", - "integrity": "sha512-hzSUW2q06EqL1gKM/a+obYHLIO6ct2hwPuviqTTOcfFVc61UbfJ2Q32+uGL/HCPxKqrdGB5QUwIe7UqlDgwsOQ==", - "requires": { - "punycode": "1.3.2", - "querystring": "0.2.0" - } - }, "url-join": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/url-join/-/url-join-4.0.1.tgz", @@ -9464,23 +9029,6 @@ "node-gyp-build": "^4.3.0" } }, - "util": { - "version": "0.12.5", - "resolved": "https://registry.npmjs.org/util/-/util-0.12.5.tgz", - "integrity": "sha512-kZf/K6hEIrWHI6XqOFUiiMa+79wE/D8Q+NCNAWclkyg3b4d2k7s0QGepNjiABc+aR3N1PAyHL7p6UcLY6LmrnA==", - "requires": { - "inherits": "^2.0.3", - "is-arguments": "^1.0.4", - "is-generator-function": "^1.0.7", - "is-typed-array": "^1.1.3", - "which-typed-array": "^1.1.2" - } - }, - "uuid": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.0.0.tgz", - "integrity": "sha512-jOXGuXZAWdsTH7eZLtyXMqUb9EcWMGZNbL9YcGBJl4MH4nrxHmZJhEHvyLFrkxo+28uLb/NYRcStH48fnD0Vzw==" - }, "v8-compile-cache-lib": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", @@ -9527,19 +9075,6 @@ "isexe": "^2.0.0" } }, - "which-typed-array": { - "version": "1.1.9", - "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.9.tgz", - "integrity": "sha512-w9c4xkx6mPidwp7180ckYWfMmvxpjlZuIudNtDf4N/tTAUB8VJbX25qZoAsrtGuYNnGw3pa0AXgbGKRB8/EceA==", - "requires": { - "available-typed-arrays": "^1.0.5", - "call-bind": "^1.0.2", - "for-each": "^0.3.3", - "gopd": "^1.0.1", - "has-tostringtag": "^1.0.0", - "is-typed-array": "^1.1.10" - } - }, "word-wrap": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", @@ -9563,20 +9098,6 @@ "integrity": "sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A==", "requires": {} }, - "xml2js": { - "version": "0.4.19", - "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.19.tgz", - "integrity": "sha512-esZnJZJOiJR9wWKMyuvSE1y6Dq5LCuJanqhxslH2bxM6duahNZ+HMpCLhBQGZkbX6xRf8x1Y2eJlgt2q3qo49Q==", - "requires": { - "sax": ">=0.6.0", - "xmlbuilder": "~9.0.1" - } - }, - "xmlbuilder": { - "version": "9.0.7", - "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-9.0.7.tgz", - "integrity": "sha512-7YXTQc3P2l9+0rjaUbLwMKRhtmwg1M1eDf6nag7urC7pIPYLD9W/jmzQ4ptRSUbodw5S0jfoGTflLemQibSpeQ==" - }, "yn": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", diff --git a/package.json b/package.json index 2375d0bd6ba..d3d9dbc281f 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,6 @@ "@solana/web3.js": "^1.36.0", "@solendprotocol/solend-sdk": "^0.6.2", "@supercharge/promise-pool": "^2.1.0", - "aws-sdk": "^2.1268.0", "axios": "^0.27.2", "bignumber.js": "^9.0.1", "blakejs": "^1.2.1", diff --git a/projects/helper/cache.js b/projects/helper/cache.js index a5c18c29752..ab24f5c3b56 100644 --- a/projects/helper/cache.js +++ b/projects/helper/cache.js @@ -1,4 +1,3 @@ -const aws = require('aws-sdk') const sdk = require('@defillama/sdk') const Bucket = "tvl-adapter-cache"; const axios = require('axios') From 933fb684df1d500ca054f2624487f92ef1e74a42 Mon Sep 17 00:00:00 2001 From: "Bhagi.eth" <69668077+0xbhagi@users.noreply.github.com> Date: Tue, 12 Sep 2023 15:30:48 +0530 Subject: [PATCH 1214/1974] add governance tvl (#7453) --- projects/amphora/index.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/projects/amphora/index.js b/projects/amphora/index.js index 8005385a870..2d64760645e 100644 --- a/projects/amphora/index.js +++ b/projects/amphora/index.js @@ -1,9 +1,18 @@ const { sumTokens2 } = require('../helper/unwrapLPs'); async function tvl(_, _1, _2, { api }) { - const balances = await sumTokens2({ api, tokensAndOwners:[ - ["0xb2f30a7c980f052f02563fb518dcc39e6bf38175", "0xD842D9651F69cEBc0b2Cffc291fC3D3Fe7b5D226"] - ]}) + const ownerAddress = "0xA905f9f0b525420d4E5214E73d70dfFe8438D8C8"; + const tokensAndOwners = [ + ["0xb2f30a7c980f052f02563fb518dcc39e6bf38175", "0xD842D9651F69cEBc0b2Cffc291fC3D3Fe7b5D226"], + ["0xC011a73ee8576Fb46F5E1c5751cA3B9Fe0af2a6F", ownerAddress], + ["0xba100000625a3754423978a60c9317c58a424e3D", ownerAddress], + ["0xD533a949740bb3306d119CC777fa900bA034cd52", ownerAddress,], + ["0x4e3FBD56CD56c3e72c1403e103b45Db9da5B9D2B", ownerAddress,], + ["0xD842D9651F69cEBc0b2Cffc291fC3D3Fe7b5D226", ownerAddress,] + ]; + + const balances = await sumTokens2({ api, tokensAndOwners }) + const tokens = await api.call({ target: "0xb688801cadb4ddb6980bb777d42972c24f920855", abi: "address[]:getEnabledTokens" @@ -24,4 +33,4 @@ module.exports = { ethereum: { tvl }, -} \ No newline at end of file +} From bed3780657c1c7a14b2e5e7e53d5a6e7efc9f3b4 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Tue, 12 Sep 2023 19:40:44 +0100 Subject: [PATCH 1215/1974] remove duplicate entry --- projects/ichifarm/index.js | 5 ----- 1 file changed, 5 deletions(-) diff --git a/projects/ichifarm/index.js b/projects/ichifarm/index.js index 8f4ab49e8bb..97c9336fe54 100644 --- a/projects/ichifarm/index.js +++ b/projects/ichifarm/index.js @@ -46,11 +46,6 @@ const config = { { factory: '0xbBB97d634460DACCA0d41E249510Bb741ef46ad3', fromBlock: 29702590, }, ], }, - bsc: { - vaultConfigs: [ - { factory: '0xbBB97d634460DACCA0d41E249510Bb741ef46ad3', fromBlock: 29702590, }, - ], - }, polygon: { vaultConfigs: [ { factory: '0x2d2c72c4dc71aa32d64e5142e336741131a73fc0', fromBlock: 25697834, }, From ab05e8bf1f0aa04b909543a75e4ddf01471bc3e2 Mon Sep 17 00:00:00 2001 From: oneguyfinance <138209380+oneguyfinance@users.noreply.github.com> Date: Wed, 13 Sep 2023 02:03:13 +0700 Subject: [PATCH 1216/1974] add adaptor for oneguyfinance (#7460) * add adaptor for oneguyfinance * lint fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/oneguyfinance/index.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 projects/oneguyfinance/index.js diff --git a/projects/oneguyfinance/index.js b/projects/oneguyfinance/index.js new file mode 100644 index 00000000000..dc72b18258d --- /dev/null +++ b/projects/oneguyfinance/index.js @@ -0,0 +1,13 @@ +const { sumTokensExport, nullAddress } = require("../helper/unwrapLPs"); + +const config = { + polygon: { owners: ['0x4e9f8e71DBbd9aCca9b4c7ae1c647FC1B45065FD'], tokens: [nullAddress] } +} + +module.exports = { + methodology: `TVL is the total amount of MATIC held on smart-contracts.`, +} + +Object.keys(config).forEach(chain => { + module.exports[chain] = { tvl: sumTokensExport(config[chain]) } +}) \ No newline at end of file From a2688ca1c5d33ceaeaef9deca41b576fa628d1c0 Mon Sep 17 00:00:00 2001 From: Akshay Gupta Date: Tue, 12 Sep 2023 23:43:13 -0400 Subject: [PATCH 1217/1974] gmd --- projects/savvy/contracts.json | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/projects/savvy/contracts.json b/projects/savvy/contracts.json index 41cce45ab1c..c0aa91604a8 100644 --- a/projects/savvy/contracts.json +++ b/projects/savvy/contracts.json @@ -16,10 +16,14 @@ "SavvySageBTC": "0x2fcCd0f67d0722f5EB7c1A404DFF0224544155E3", "SavvySageETH": "0xCd5156Fdd53fD9A0f5bfc37B212DD9c989C10533", "SavvySageUSD": "0x78A370c3d5fFF93Da53a2B088a117244c52AF857", - "savvyAArbWBTC": "0xDD7e69c478288A9596DECc2230A39c7b922413Dd", - "savvyAArbWETH": "0xCaB3886D48bAd0F749ba7e7c7A255b636c64F937", - "savvyAArbUSDC": "0xCdFF8576683E22621f512fc2E6d347A9D241DAd3", - "JonesAdapterUSDC": "0x9394b6B85bEab8cba1e4aA35FbBB5C31c258224A" + "SavvyAArbWBTC": "0xDD7e69c478288A9596DECc2230A39c7b922413Dd", + "SavvyAArbWETH": "0xCaB3886D48bAd0F749ba7e7c7A255b636c64F937", + "SavvyAArbUSDC": "0xCdFF8576683E22621f512fc2E6d347A9D241DAd3", + "JonesAdapterUSDC": "0x32157bEE957411EDf2648ED2Bc184B15f2Fe8d1C", + "GmdUSDCAdapter": "0xbf8Aa25aD262AaA3D875034412ea080Ff1144cda", + "GmdETHAdapter": "0x7628B50765C9D407058b2262b04Cf5E69b5e59D3", + "GmdBTCAdapter": "0x43e6ecb5C17B069fdc61456Fb1E12B295Ab8591B" + }, "savvyTokens": { "SVY": "0x43aB8f7d2A8Dd4102cCEA6b438F6d747b1B9F034", @@ -31,6 +35,7 @@ "WETH": "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1", "WBTC": "0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f", "USDCe": "0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8", + "USDC": "0xaf88d065e77c8cC2239327C5EDb3A432268e5831", "USDT": "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9", "DAI": "0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1", "BTCb": "0x2297aEbD383787A160DD0d9F71508148769342E3" @@ -39,7 +44,10 @@ "aArbWBTC": "0x078f358208685046a11C85e8ad32895DED33A249", "aArbWETH": "0xe50fA9b3c56FfB159cB0FCA61F5c9D750e8128c8", "aArbUSDC": "0x625E7708f30cA75bfd92586e17077590C60eb4cD", - "jUSDC": "0xe66998533a1992ecE9eA99cDf47686F4fc8458E0" + "jUSDC": "0xe66998533a1992ecE9eA99cDf47686F4fc8458E0", + "gmdUSDC": "0x3DB4B7DA67dd5aF61Cb9b3C70501B1BdB24b2C22", + "gmdBTC": "0x147FF11D9B9Ae284c271B2fAaE7068f4CA9BB619", + "gmdETH": "0x1E95A37Be8A17328fbf4b25b9ce3cE81e271BeB3" } } From 341d261fe954803d17f57f6aebdb36403ee7544f Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Wed, 13 Sep 2023 06:39:53 +0100 Subject: [PATCH 1218/1974] update methodology --- projects/basedfarm/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/basedfarm/index.js b/projects/basedfarm/index.js index 60e4c1f2176..580345836df 100644 --- a/projects/basedfarm/index.js +++ b/projects/basedfarm/index.js @@ -34,6 +34,6 @@ async function pool2(timestamp, ethBlock, chainBlocks) { } module.exports = { - methodology: 'TVL is based on value of the single-sided staked tokens inside of the Genesis reward pool.', + methodology: 'TVL is based on value of the single-sided staked tokens inside of the Genesis reward pool. Pool2 TVL represents the value of specific LP tokens staked in designated pool2 staking contract(BasedRewardPool)', base: { tvl,pool2 }, }; From 5447c6efed51f152e80709037199133bcfbc68fa Mon Sep 17 00:00:00 2001 From: Phil <30321052+philipjames44@users.noreply.github.com> Date: Wed, 13 Sep 2023 00:50:27 -0600 Subject: [PATCH 1219/1974] Sommelier: Add Turbo GHO Vault (#7461) * Sommelier: Add RYBTC launch and remove Steady, Trend, & MOM vault launches * Sommelier: Add Turbo GHO vault * Update start block --- projects/sommelier/index.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/projects/sommelier/index.js b/projects/sommelier/index.js index 98299db27af..7149e0e361c 100644 --- a/projects/sommelier/index.js +++ b/projects/sommelier/index.js @@ -35,7 +35,6 @@ const REAL_YIELD_ENS = "0x18ea937aba6053bc232d9ae2c42abe7a8a2be440"; const REAL_YIELD_BTC = "0x0274a704a6d9129f90a62ddc6f6024b33ecdad36"; const FRAXIMAL = "0xdbe19d1c3f21b1bb250ca7bdae0687a97b5f77e6"; - const cellarsV2 = [ { id: DEFI_STARS, startBlock: 17181497 }, { id: REAL_YIELD_USD, startBlock: 16431804 }, @@ -51,7 +50,12 @@ const cellarsV2 = [ // v2.5 Cellars const TURBO_SWETH = "0xd33dad974b938744dac81fe00ac67cb5aa13958e"; -const cellarsV2p5 = [{ id: TURBO_SWETH, startBlock: 17910374 }]; +const TURBO_GHO = "0x0c190ded9be5f512bd72827bdad4003e9cc7975c"; + +const cellarsV2p5 = [ + { id: TURBO_SWETH, startBlock: 17910374 }, + { id: TURBO_GHO, startBlock: 18118614 }, +]; async function tvl(timestamp, block, chainBlocks, { api }) { const balances = {}; From b1cc11c63e862c0db99588e3508cda1321b3f30c Mon Sep 17 00:00:00 2001 From: Elliot Shiu Date: Tue, 12 Sep 2023 23:51:40 -0700 Subject: [PATCH 1220/1974] Arcade.xyz: configure updated subgraph that tracks v2 + v3 entities (#7455) * arcadexyz: configure updated subgraph that tracks v2 + v3 entities * arcadexyz: include interest in borrowed --- projects/arcade-xyz/constants.js | 16 +++++++++++++++- projects/arcade-xyz/index.js | 20 ++++++++++++++++++-- projects/arcade-xyz/queries.js | 1 + 3 files changed, 34 insertions(+), 3 deletions(-) diff --git a/projects/arcade-xyz/constants.js b/projects/arcade-xyz/constants.js index 4d76e73a0e1..d39f2bb8e7a 100644 --- a/projects/arcade-xyz/constants.js +++ b/projects/arcade-xyz/constants.js @@ -1,24 +1,38 @@ -const SUBGRAPH_URL = 'https://protocol-sg.arcade.xyz/subgraphs/name/arcade/protocol-v2'; +const SUBGRAPH_URL = 'https://protocol-sg.arcade.xyz/subgraphs/name/arcade/protocol'; const CHAIN = 'ethereum'; + +// V2 Protocol const LOAN_CORE = '0x81b2f8fc75bab64a6b144aa6d2faa127b4fa7fd9'; const VAULT_FACTORY_A = '0x6e9b4c2f6bd57b7b924d29b5dcfca1273ecc94a2'; const VAULT_FACTORY_APE_STAKING_A = '0x666faa632e5f7ba20a7fce36596a6736f87133be'; +const VAULT_FACTORY_SUPER_RARE = '0x7594916540e60fc8d6e9ba5c3c83632f7001cf53'; + +// V3 Protocol +const LOAN_CORE_V3 = '0x89bc08ba00f135d608bc335f6b33d7a9abcc98af'; +const VAULT_FACTORY_V3 = '0x269363665dbb1582b143099a3cb467e98a476d55'; const VAULT_FACTORIES = new Set(); VAULT_FACTORIES.add(VAULT_FACTORY_A); VAULT_FACTORIES.add(VAULT_FACTORY_APE_STAKING_A); +VAULT_FACTORIES.add(VAULT_FACTORY_SUPER_RARE); +VAULT_FACTORIES.add(VAULT_FACTORY_V3); const START_BLOCKS = new Map(); START_BLOCKS.set(VAULT_FACTORY_A, 15045028); START_BLOCKS.set(VAULT_FACTORY_APE_STAKING_A, 16128500); +START_BLOCKS.set(VAULT_FACTORY_SUPER_RARE, 17787255); +START_BLOCKS.set(VAULT_FACTORY_V3, 18032790); module.exports = { CHAIN, LOAN_CORE, + LOAN_CORE_V3, START_BLOCKS, SUBGRAPH_URL, VAULT_FACTORY_A, VAULT_FACTORY_APE_STAKING_A, + VAULT_FACTORY_SUPER_RARE, + VAULT_FACTORY_V3, VAULT_FACTORIES, } diff --git a/projects/arcade-xyz/index.js b/projects/arcade-xyz/index.js index 24e10661ecd..c1dd058047a 100644 --- a/projects/arcade-xyz/index.js +++ b/projects/arcade-xyz/index.js @@ -1,4 +1,5 @@ const sdk = require("@defillama/sdk"); +const { BigNumber } = require('ethers'); const { fetchVaults, fetchLoans } = require('./queries'); const { sumTokens2 } = require('../helper/unwrapLPs'); @@ -50,13 +51,28 @@ async function borrowed(_, block, _cb, { api }) { // Iterate over each loan to sum up principal by currency for (const loan of loans) { - const { payableCurrency, principal } = loan; - sdk.util.sumSingleBalance(balances,payableCurrency,principal, api.chain) + const { payableCurrency, principal, interestRate } = loan; + const fullRepayment = getRepayment(principal, interestRate) + + sdk.util.sumSingleBalance(balances, payableCurrency, fullRepayment, api.chain); } return balances; } +const decimals18 = BigNumber.from(10).pow(18); +function getRepayment(principalStr, interestRateStr) { + const principal = BigNumber.from(principalStr); + const interestRate = BigNumber.from(interestRateStr); + + const interest = principal + .mul(interestRate) + .div(decimals18) + .div(1000); + + return principal.add(interest); +} + module.exports = { methodology: `Sums up the floor value of all vaulted and escrowed NFTs with Chainlink price feeds. Borrowed coins are not counted towards the TVL`, start: START_BLOCKS[VAULT_FACTORY_A], diff --git a/projects/arcade-xyz/queries.js b/projects/arcade-xyz/queries.js index c4744d8b862..0fed2d7cd23 100644 --- a/projects/arcade-xyz/queries.js +++ b/projects/arcade-xyz/queries.js @@ -75,6 +75,7 @@ const fetchLoansQuery = gql` arcadeLoans(first: , block: { number: }, where :{ state: "Active", cursor_gte: }) { payableCurrency principal + interestRate } } ` From 284b1a607a09c5fa0a21a8036223cf97cc4343f7 Mon Sep 17 00:00:00 2001 From: Noah Bayindirli Date: Tue, 12 Sep 2023 23:53:57 -0700 Subject: [PATCH 1221/1974] Automate TVL calculation so only network name is added for future assets (#7462) --- projects/prime-protocol/index.js | 294 ++++++++++--------------------- 1 file changed, 97 insertions(+), 197 deletions(-) diff --git a/projects/prime-protocol/index.js b/projects/prime-protocol/index.js index 8b42aea6294..376d1087e4e 100644 --- a/projects/prime-protocol/index.js +++ b/projects/prime-protocol/index.js @@ -1,6 +1,29 @@ -const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk'); -const { sumTokens2, } = require('../helper/unwrapLPs') +const { sumTokens2, } = require('../helper/unwrapLPs'); +const { request, gql } = require('graphql-request'); + +const PRIME_MASTER_NETWORK = 'moonbeam'; + +const PRIME_SATELLITE_NETWORKS = { + moonbeam: 1284, + avax: 43114, + arbitrum: 42161, + ethereum: 1, + bsc: 56, + polygon: 137, +// base: 8453, + optimism: 10, +// filecoin: 314 +}; + +const primeSubgraphUrl = 'https://api.thegraph.com/subgraphs/name/prime-protocol/liquidity-incentives'; + +const primeMarketsQuery = gql`{ + markets { + address + chainId + } + }`; const MASTER_VIEW_CONTRACT = { v1_4_6: { @@ -11,221 +34,98 @@ const MASTER_VIEW_CONTRACT = { } }; -const MOONBEAM_MARKETS = { - xcDOT_v0_v1_2_0: { - pTokenMarketAddress: '0x156F5c70a157A381610F1DbaAE4f336a2DB70E7E', - pTokenUnderlyingAddress: '0xFfFFfFff1FcaCBd218EDc0EbA20Fc2308C778080' - }, - GLMR_v1_v1_4_6: { - pTokenMarketAddress: '0x53d5a47bb874eE688acb479676aD133d47CB9B25', - pTokenUnderlyingAddress: ADDRESSES.null, - }, - whUSDC_v1_v1_4_6: { - pTokenMarketAddress: '0x5f8d500ec32dB09aa3115a852f30e9C756867d5A', - pTokenUnderlyingAddress: '0x931715FEE2d06333043d11F658C8CE934aC61D0c', - }, - xcUSDT_v1_v1_4_6: { - pTokenMarketAddress: '0x1D5CC7840a05BA39Db0AAd21e14dF1ff09b599ED', - pTokenUnderlyingAddress: ADDRESSES.moonbeam.xcUSDT, - }, - xcDOT_v1_v1_4_6: { - pTokenMarketAddress: '0x8f7F208F38A4362e6Fe6112b720630f93bb608aA', - pTokenUnderlyingAddress: '0xFfFFfFff1FcaCBd218EDc0EbA20Fc2308C778080', - }, - GLMR_v2_v1_6_0: { - pTokenMarketAddress: '0xdC427cDB81E1532747BEDeB8077a4AEcDbfB585e', - pTokenUnderlyingAddress: ADDRESSES.null, - }, - whUSDC_v2_v1_6_0: { - pTokenMarketAddress: '0x227EEB717a3Ec78025bE51c87b3A7160192613D2', - pTokenUnderlyingAddress: '0x931715FEE2d06333043d11F658C8CE934aC61D0c', - }, - xcUSDT_v2_v1_6_0: { - pTokenMarketAddress: '0x8ef25FAC30DeD9A210151C1d27e58F71f2142e2f', - pTokenUnderlyingAddress: ADDRESSES.moonbeam.xcUSDT, - }, - xcDOT_v2_v1_6_0: { - pTokenMarketAddress: '0x525c6B3D27B6b1Fc28bca7dc04964247c1a942B1', - pTokenUnderlyingAddress: '0xFfFFfFff1FcaCBd218EDc0EbA20Fc2308C778080', - }, - whWBTC_v2_v1_10_2: { - pTokenMarketAddress: '0x2A104E502480b4e3C1D13EA2EC657C08f4578a7a', - pTokenUnderlyingAddress: ADDRESSES.moonbeam.WBTC, - } -}; - -const AVALANCHE_MARKETS = { - ETH_v1_v1_4_6: { - pTokenMarketAddress: '0x94ebF80b33120a1AbE370E56192db39f4944b6ca', - pTokenUnderlyingAddress: ADDRESSES.avax.WETH_e, - }, - USDC_v1_v1_4_6: { - pTokenMarketAddress: '0x6Cce9601CA44a9049A761C22b70D5849662c2C0a', - pTokenUnderlyingAddress: ADDRESSES.avax.USDC, - }, - USDT_v1_v1_4_6: { - pTokenMarketAddress: '0xe06F55FB6c6C62b74AAD7eb77f00b06920FB176e', - pTokenUnderlyingAddress: ADDRESSES.avax.USDt, - }, - ETH_v2_v1_6_0: { - pTokenMarketAddress: '0x4Ebba16380fEb2083938c008aEDD4b5EBeA80f72', - pTokenUnderlyingAddress: ADDRESSES.avax.WETH_e, - }, - USDC_v2_v1_6_0: { - pTokenMarketAddress: '0x73c5c93E78cB8CA4939307e0D95e032631fB9eEe', - pTokenUnderlyingAddress: ADDRESSES.avax.USDC, - }, - USDT_v2_v1_6_0: { - pTokenMarketAddress: '0x1BF6752282039ee82C06DE64D094C9E35578A1a0', - pTokenUnderlyingAddress: ADDRESSES.avax.USDt, - }, - DAI_v2_v1_10_2: { - pTokenMarketAddress: '0x05f2B8EAc42c9Cc771B8ECF6448481A3802e08c6', - pTokenUnderlyingAddress: ADDRESSES.avax.DAI, - }, - bBTC_v2_v1_10_2: { - pTokenMarketAddress: '0xA5c74A10B60f276F806468c6E2f83D490dCfA89A', - pTokenUnderlyingAddress: ADDRESSES.avax.BTC_b, - }, -}; - -const ARBITRUM_MARKETS = { - ETH_v1_v1_4_6: { - pTokenMarketAddress: '0x2E9F73aA3F16748C9c1E8243D204d60F87dEC872', - pTokenUnderlyingAddress: ADDRESSES.null, - }, - USDC_v1_v1_4_6: { - pTokenMarketAddress: '0x1b0509D8CC044805F54D132ccDa7b4A4ED88261A', - pTokenUnderlyingAddress: ADDRESSES.arbitrum.USDC, - }, - ETH_v2_v1_6_0: { - pTokenMarketAddress: '0xc01683398fFCc86264ba17bC36977f51A1d25e06', - pTokenUnderlyingAddress: ADDRESSES.null, - }, - USDC_v2_v1_6_0: { - pTokenMarketAddress: '0xddC6Df52F9749ED80966Fb6a9D4C87264cC1e6C1', - pTokenUnderlyingAddress: ADDRESSES.arbitrum.USDC, - }, - DAI_v2_v1_10_2: { - pTokenMarketAddress: '0x3e1C8203B8D36E8E427Ee181A65549fd86AE3907', - pTokenUnderlyingAddress: ADDRESSES.optimism.DAI, - }, - WBTC_v2_v1_10_2: { - pTokenMarketAddress: '0x51Ff97d92683992AD091E04470069bB942219D71', - pTokenUnderlyingAddress: ADDRESSES.arbitrum.WBTC, - }, - nativeUSDC_v1_v1_10_2: { - pTokenMarketAddress: '0xA44C28Bd4Fd4fc307f23B2E6e9cC07BC03571798', - pTokenUnderlyingAddress: ADDRESSES.arbitrum.USDC_CIRCLE, - }, -}; - -const ETHEREUM_MARKETS = { - ETH_v1_v1_4_6: { - pTokenMarketAddress: '0xD15a15C0b6d79D9E59F4fcC0D17912219f6b470C', - pTokenUnderlyingAddress: ADDRESSES.null, - }, - USDC_v1_v1_4_6: { - pTokenMarketAddress: '0x8F0Ba37DAC51a8102b1203C9D9ac26724DC684Ac', - pTokenUnderlyingAddress: ADDRESSES.ethereum.USDC, - }, - USDT_v1_v1_4_6: { - pTokenMarketAddress: '0x373bb8bE40Ee6f704576CDC815372ff71d6825c5', - pTokenUnderlyingAddress: ADDRESSES.ethereum.USDT, - }, - ETH_v2_v1_6_0: { - pTokenMarketAddress: '0xd833F882ca07F69C4C5a069675B6B65C235325C3', - pTokenUnderlyingAddress: ADDRESSES.null, - }, - USDC_v2_v1_6_0: { - pTokenMarketAddress: '0x67CeC45eB8d9f059D4c974a4BdEA357b68Ad80Ef', - pTokenUnderlyingAddress: ADDRESSES.ethereum.USDC, - }, - USDT_v2_v1_6_0: { - pTokenMarketAddress: '0xDC313B592949E8F4bB91A22c6DC9f7BE11b74Ea7', - pTokenUnderlyingAddress: ADDRESSES.ethereum.USDT, - }, -}; - -const BSC_MARKETS = { - USDC_v2_v1_10_2: { - pTokenMarketAddress: '0xc01683398fFCc86264ba17bC36977f51A1d25e06', - pTokenUnderlyingAddress: ADDRESSES.bsc.USDC, +const PRIME_CONTRACTS = { + MASTER_VIEW_v1_4_6: { + address: '0x47ecFB57deD0160d66103A6A201C5f30f7CC7d13', + abi: { + calculateAssetTVL: 'function calculateRawAssetTVL(uint256 chainId, address pToken) view returns (uint256)' + } }, - USDT_v2_v1_10_2: { - pTokenMarketAddress: '0xddC6Df52F9749ED80966Fb6a9D4C87264cC1e6C1', - pTokenUnderlyingAddress: ADDRESSES.bsc.USDT, + MASTER_VIEW_v1_10_2: { + address: '0x30095B6616eB637B72f86E9613cdAcF18C11ED8d', + abi: { + getCollateralFactors: 'function getCollateralFactors(address[] memory underlyings, uint256[] memory chainIds) view returns (uint256[] memory collateralFactors)', + } }, - BNB_v2_v1_10_2: { - pTokenMarketAddress: '0xaCD7a2991f3514E215034Ace732Bafe005185C94', - pTokenUnderlyingAddress: ADDRESSES.null, + IRM_ROUTER_v1_10_2: { + address: '0xd7af46089C5ED25871b770F18a2Ff1C07929abfa', + abi: { + borrowInterestRatePerBlock: 'function borrowInterestRatePerBlock(address loanAsset, uint256 loanAssetChainId) view returns (uint256)', + } }, - BTCB_v2_v1_10_2: { - pTokenMarketAddress: '0xA7BCF4433e044e454c43fe596C9eE8DDAF5776aC', - pTokenUnderlyingAddress: ADDRESSES.bsc.BTCB, + PTOKEN_v1_10_2: { + abi: { + underlying: 'function underlying() view returns (address)' + } }, - ETH_v2_v1_10_2: { - pTokenMarketAddress: '0xBdDc67911C63f63e6720A8EEfCAF08a573Fd9AE4', - pTokenUnderlyingAddress: ADDRESSES.bsc.ETH, + MASTER_VIEW_v1_10_3: { + address: '0x9Ee26206Bc1143668aD56498b8C7A621bFa27c00', + abi: { + supplierInterestRateWithoutTuple: 'function supplierInterestRateWithoutTuple(uint256 chainId, address loanAsset) view returns (uint256 rate, uint256 factor)' + } }, }; -const POLYGON_POS_MARKETS = { - USDC_v1_v1_10_2: { - pTokenMarketAddress: '0x45913B2088E2910C3Dd168c2f08eaf2274D7bf6c', - pTokenUnderlyingAddress: ADDRESSES.polygon.USDC, - }, - USDT_v1_v1_10_2: { - pTokenMarketAddress: '0x2ce0Ac2FD666a93b70fbE731C9Fe6581f410F73B', - pTokenUnderlyingAddress: ADDRESSES.polygon.USDT, - }, - WBTC_v1_v1_10_2: { - pTokenMarketAddress: '0x786D8B5d16171f441BC5F2047bDf0Ea54268a735', - pTokenUnderlyingAddress: ADDRESSES.polygon.WBTC, - }, -}; +async function getMarketsForCurrentNetwork(api) { + const primeMarketsData = (await request( + primeSubgraphUrl, + primeMarketsQuery + )).markets; -const PRIME_MARKETS = { - moonbeam: { - networkMarkets: MOONBEAM_MARKETS - }, - avax: { - networkMarkets: AVALANCHE_MARKETS - }, - arbitrum: { - networkMarkets: ARBITRUM_MARKETS - }, - ethereum: { - networkMarkets: ETHEREUM_MARKETS - }, - bsc: { - networkMarkets: BSC_MARKETS - }, - polygon: { - networkMarkets: POLYGON_POS_MARKETS - }, -}; + const markets = []; + + for (let m = 0; m < primeMarketsData.length; m++) { + const market = primeMarketsData[m]; + const marketAddress = market.address; + const marketChainId = market.chainId; + + if (PRIME_SATELLITE_NETWORKS[api.chain] == marketChainId) { + const underlyingAddress = ( + await api.multiCall({ + abi: PRIME_CONTRACTS.PTOKEN_v1_10_2.abi.underlying, + calls: [marketAddress].map((ma) => ({ + target: ma, + })), + permitFailure: true, + chain: api.chain, + }) + )[0]; + + markets.push({ + pTokenMarketAddress: marketAddress, + pTokenUnderlyingAddress: underlyingAddress + }); + } + } + + return markets; +} async function borrowed(_, _1, _2, { api }) { - const moonbeamApi = new sdk.ChainApi({ chain: 'moonbeam' }); + const moonbeamApi = new sdk.ChainApi({ chain: PRIME_MASTER_NETWORK }); + + const markets = await getMarketsForCurrentNetwork(api); - const markets = Object.values(PRIME_MARKETS[api.chain].networkMarkets) - let uDecimals = await api.multiCall({ abi: 'erc20:decimals', calls: markets.map(i => i.pTokenUnderlyingAddress), permitFailure: true, }) + let uDecimals = await api.multiCall({ abi: 'erc20:decimals', calls: markets.map(market => market.pTokenUnderlyingAddress), permitFailure: true, }) uDecimals = uDecimals.map(i => i ?? 18) + let rawTvls = await moonbeamApi.multiCall({ abi: MASTER_VIEW_CONTRACT.v1_4_6.abi.calculateAssetTVL, target: MASTER_VIEW_CONTRACT.v1_4_6.address, - calls: markets.map(i => ({ params: [api.getChainId(), i.pTokenMarketAddress] })), + calls: markets.map(i => ({ params: [PRIME_SATELLITE_NETWORKS[api.chain], i.pTokenMarketAddress] })), }) + rawTvls.forEach((v, i) => api.add(markets[i].pTokenUnderlyingAddress, v * (10 ** uDecimals[i] / 1e18))) - const tvlBal = await sumTokens2({ balances: {}, api, tokensAndOwners: markets.map(i => [i.pTokenUnderlyingAddress, i.pTokenMarketAddress]) }) + const tvlBal = await sumTokens2({ balances: {}, api, tokensAndOwners: markets.map(market => [market.pTokenUnderlyingAddress, market.pTokenMarketAddress]) }) Object.entries(tvlBal).forEach(([token, bal]) => { api.add(token, bal * -1, { skipChain: true }) }) } async function tvl(_, _b, _cb, { api, }) { - return sumTokens2({ api, tokensAndOwners: Object.values(PRIME_MARKETS[api.chain].networkMarkets).map(i => [i.pTokenUnderlyingAddress, i.pTokenMarketAddress]) }) + const markets = await getMarketsForCurrentNetwork(api); + + return sumTokens2({ api, tokensAndOwners: markets.map(market => [market.pTokenUnderlyingAddress, market.pTokenMarketAddress]) }) } module.exports = { @@ -233,6 +133,6 @@ module.exports = { methodology: 'Adds the deposits of each market to the borrows that were not redeposited into that market.', }; -Object.keys(PRIME_MARKETS).forEach(chain => { - module.exports[chain] = { tvl, borrowed, } -}) \ No newline at end of file +Object.keys(PRIME_SATELLITE_NETWORKS).forEach(primeSatelliteNetwork => { + module.exports[primeSatelliteNetwork] = { tvl, borrowed, } +}) From 2292003c6a2b0a4266b1c741464a22f11157a3ce Mon Sep 17 00:00:00 2001 From: Elliot Shiu Date: Wed, 13 Sep 2023 00:58:04 -0700 Subject: [PATCH 1222/1974] arcadexyz: remove separate v3 project --- projects/arcade-xyz-v3/index.js | 22 ---------------------- 1 file changed, 22 deletions(-) delete mode 100644 projects/arcade-xyz-v3/index.js diff --git a/projects/arcade-xyz-v3/index.js b/projects/arcade-xyz-v3/index.js deleted file mode 100644 index c7e81fb6e3b..00000000000 --- a/projects/arcade-xyz-v3/index.js +++ /dev/null @@ -1,22 +0,0 @@ -const { sumTokens2 } = require('../helper/unwrapLPs') -const { getConfig } = require('../helper/cache') -const loanCoreAddress = '0x89bc08BA00f135d608bc335f6B33D7a9ABCC98aF' - -const endpoint = 'https://api.arcade.xyz/api/v2/loans?state=Active' - -async function tvl(_, _b, _cb, { api, }) { - const data = await getConfig('arcade-xyz/v3', endpoint) - const tokensAndOwners = data - .filter(i => i.protocolVersion === '3' && i.collateralKind === 'VAULT') - .map(({ collateral: i, vaultAddress }) => i.filter(i => i.kind === 'ERC721').map(i => [i.collectionAddress, vaultAddress])) - .flat() - - await sumTokens2({api, tokensAndOwners, blacklistedOwners: [loanCoreAddress], permitFailure: true, }) - return sumTokens2({ owner: loanCoreAddress, resolveNFTs: true, api}) - -} - - -module.exports = { - ethereum: { tvl, }, -} \ No newline at end of file From aa23eb60b8a7314e2ef098ce71709a903c8a2de9 Mon Sep 17 00:00:00 2001 From: gaspare100 Date: Wed, 13 Sep 2023 14:09:36 +0100 Subject: [PATCH 1223/1974] Reenable scrub pool tracking after CG updates (#7466) --- projects/scrubinvest/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/scrubinvest/index.js b/projects/scrubinvest/index.js index 27e6a794bcf..eae68ef0d16 100644 --- a/projects/scrubinvest/index.js +++ b/projects/scrubinvest/index.js @@ -47,7 +47,7 @@ async function tvl(_, _b, _cb, { api, }) { [ADDRESSES.moonriver.USDC, '0x1504B9EDdD57Ed8252b3b3b407DdE27B72A80790'], [ADDRESSES.kava.WKAVA, '0xC05021F3b3601BF33aB59dc75577B85985ACaab7'], // New Scrub Pool - //['0x471F79616569343e8e84a66F342B7B433b958154', '0x67041094c4fc1492A1AB988Fb8De0ab4A0a4A080'], + ['0x471F79616569343e8e84a66F342B7B433b958154', '0x67041094c4fc1492A1AB988Fb8De0ab4A0a4A080'], // WETH From cefb91f4c5c45c0d7c0fe09819db5b262a9acece Mon Sep 17 00:00:00 2001 From: bhowedev Date: Wed, 13 Sep 2023 21:59:06 +0800 Subject: [PATCH 1224/1974] Track w3swap on pego-network and add new protocol w3bank (#7465) * add pg chain * track w3swap on pego-network * track w3bank on pego-network * change chain id pego to pg * code refactor --------- Co-authored-by: g1nt0ki --- projects/helper/chains.json | 1 + projects/helper/tokenMapping.js | 3 +++ projects/w3bank/index.js | 8 ++++++++ projects/w3swap/index.js | 9 +++++---- 4 files changed, 17 insertions(+), 4 deletions(-) create mode 100644 projects/w3bank/index.js diff --git a/projects/helper/chains.json b/projects/helper/chains.json index c691d822b8b..cb1fa4a0a77 100644 --- a/projects/helper/chains.json +++ b/projects/helper/chains.json @@ -160,6 +160,7 @@ "palm", "parallel", "persistence", + "pg", "pgn", "pokt", "polis", diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index f1d7e0b90b6..15b1a6f5020 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -51,6 +51,9 @@ const fixBalancesTokens = { darwinia: { '0xe7578598aac020abfb918f33a20fad5b71d670b4': { coingeckoId: "darwinia-network-native-token", decimals: 18 }, }, + pg: { + '0x0cf4071940782b640d0b595cb17bdf3e90869d70': { coingeckoId: 'pego-network-2', decimals: 18 }, + }, } ibcChains.forEach(chain => fixBalancesTokens[chain] = { ...ibcMappings, ...(fixBalancesTokens[chain] || {}) }) diff --git a/projects/w3bank/index.js b/projects/w3bank/index.js new file mode 100644 index 00000000000..90589db8218 --- /dev/null +++ b/projects/w3bank/index.js @@ -0,0 +1,8 @@ +const { lendingMarket } = require("../helper/methodologies"); +const { compoundExports2 } = require("../helper/compound"); + +module.exports = { + start: 1693843200, + pg: compoundExports2({ comptroller: '0x697bc9fd98ddafd1979c3e079033698ca93af451'}), + methodology: `${lendingMarket}`, +}; diff --git a/projects/w3swap/index.js b/projects/w3swap/index.js index 39bfb8281f3..168a3095b90 100644 --- a/projects/w3swap/index.js +++ b/projects/w3swap/index.js @@ -2,10 +2,11 @@ const { getUniTVL } = require('../helper/unknownTokens') module.exports = { misrepresentedTokens: true, + methodology: "Counts the tokens locked on AMM pools. Data is getting from the 'satoshirock/w3infov2' subgraph.", + pg: { + tvl: getUniTVL({ factory: '0x94274b1Ed6E1BDe55fa631f502Aa18512Aa3007b', useDefaultCoreAssets: true }) + }, bsc: { - tvl: getUniTVL({ - factory: '0xD04A80baeeF12fD7b1D1ee6b1f8ad354f81bc4d7', - useDefaultCoreAssets: true - }) + tvl: getUniTVL({ factory: '0xD04A80baeeF12fD7b1D1ee6b1f8ad354f81bc4d7', useDefaultCoreAssets: true }) }, }; \ No newline at end of file From 5b976383584ed46e6474e25788d20141087ecedd Mon Sep 17 00:00:00 2001 From: g1nt0ki Date: Wed, 13 Sep 2023 21:27:41 +0200 Subject: [PATCH 1225/1974] fix curve --- projects/helper/tokenMapping.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 15b1a6f5020..5e85eb1cf9b 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -24,6 +24,7 @@ const distressedAssts = new Set(Object.values({ aBNBc: ADDRESSES.bsc.ankrBNB, aBNBb: ADDRESSES.bsc.aBNBb, XRPC: '0xd4ca5c2aff1eefb0bea9e9eab16f88db2990c183', + FLEET: '0xfd56a3dcfc0690881a466ae432d71bb2db588083', YAKU: 'NGK3iHqqQkyRZUj4uhJDQqEyKKcZ7mdawWpqwMffM3s' }).map(i => i.toLowerCase())) From cd1936a76b00a8388dc840db360969a05d038cc8 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 14 Sep 2023 03:43:10 +0200 Subject: [PATCH 1226/1974] Elfi (#7470) * elysia: add abi * elysia: add borrowed amount by added defi pool * elysia: set flag timetravel to true * elysia: add klaytn money pool * code refactor --------- Co-authored-by: kyoungwan.chae Co-authored-by: g1nt0ki --- projects/elysia/index.js | 106 ++++++++++++++++++++++----------------- 1 file changed, 60 insertions(+), 46 deletions(-) diff --git a/projects/elysia/index.js b/projects/elysia/index.js index 155e55ff198..4fef637f11c 100644 --- a/projects/elysia/index.js +++ b/projects/elysia/index.js @@ -1,16 +1,15 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const sdk = require("@defillama/sdk"); -const { stakings } = require("../helper/staking"); -const { sumTokensExport, } = require('../helper/unwrapLPs') +const { sumTokensExport } = require("../helper/unwrapLPs"); + +const abi = { + loansValue: "uint256:loansValue", + v1Asset: "address:getUnderlyingAsset", + v2Asset: "address:asset", +} const addresses = { elfi: "0x4da34f8264cb33a5c9f17081b9ef5ff6091116f4", el: "0x2781246fe707bb15cee3e5ea354e2154a2877b16", elStaking: "0x3F0c3E32bB166901AcD0Abc9452a3f0c5b8B2C9D", - dai: ADDRESSES.ethereum.DAI, - usdt: ADDRESSES.ethereum.USDT, - busd: ADDRESSES.ethereum.BUSD, - usdc: ADDRESSES.ethereum.USDC, elfiStaking: [ "0xb41bcd480fbd986331eeed516c52e447b50dacb4", "0xCD668B44C7Cf3B63722D5cE5F655De68dD8f2750", @@ -23,48 +22,63 @@ const addresses = { ], }; -const moneyPools = { - ethereum: [ - [addresses.dai, '0x527c901e05228f54a9a63151a924a97622f9f173'], - [addresses.usdt, '0xe0bda8e3a27e889837ae37970fe97194453ee79c'], - [addresses.usdc, '0x3fea4cc5a03e372ac9cded96bd07795ac9034d71'], - ], - bsc: [[ADDRESSES.bsc.BUSD, '0x5bb4d02a0ba38fb8b916758f11d9b256967a1f7f']] -} - -function borrowed(chain) { - return async (_, _b, {[chain]: block}) => { - const pools = moneyPools[chain] - const { output: bals } = await sdk.api.abi.multiCall({ - abi: 'erc20:balanceOf', - calls: pools.map(i => ({ target: i[0], params: i[1]})), - chain, block, - }) - const { output: totalSupplies } = await sdk.api.abi.multiCall({ - abi: 'erc20:totalSupply', - calls: pools.map(i => ({ target: i[1]})), - chain, block, - }) - const balances = {} - bals.forEach(({ input: { target }, output }, i) => { - sdk.util.sumSingleBalance(balances,target,totalSupplies[i].output - output, chain) - }) - return balances - } -} -module.exports = { +const config = { ethereum: { - borrowed: borrowed('ethereum'), - tvl: sumTokensExport({ tokensAndOwners: moneyPools.ethereum}), - staking: sumTokensExport({ + v1Pools: ['0x527c901e05228f54a9a63151a924a97622f9f173', '0x3fea4cc5a03e372ac9cded96bd07795ac9034d71', '0xe0bda8e3a27e889837ae37970fe97194453ee79c'], + stakingConfig: { tokens: [addresses.el, addresses.elfi], owners: [addresses.elStaking, ...addresses.elfiStaking], - }), + }, }, bsc: { - borrowed: borrowed('bsc'), - tvl: sumTokensExport({ tokensAndOwners: moneyPools.bsc, chain: 'bsc'}), - staking: stakings(addresses.bscElfiStaking, addresses.bscElfi, "bsc"), + v1Pools: ['0x5bb4d02a0ba38fb8b916758f11d9b256967a1f7f'], + v2Pools: ['0x924B375Ea2E8f1F2E686E53823748C7C29ad6466', '0xB21a2a097FFC25A4B1C9baA50da482eA84687dcE', '0x836B9a6EF1B6a813136fe91803285383Ba94956C', '0x5a0154B76E8afe0ef3AA28fD6b4eA863458dB9EB'], + stakingConfig: { + tokens: [addresses.bscElfi], + owners: addresses.bscElfiStaking, + }, }, -}; // node test.js projects/elysia/index.js + klaytn: { + v2Pools: ['0x60961ca3A40BE41ddDEf708bf51ef2F8e9760A3b', '0x7F97f905A8d6fe4C493D339F094232E3577b4DBd'] + } +} + +Object.keys(config).forEach(chain => { + const { v1Pools, v2Pools, stakingConfig } = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + if (v1Pools) { + const v1Assets = await api.multiCall({ abi: abi.v1Asset, calls: v1Pools }) + await api.sumTokens({ tokensAndOwners2: [v1Assets, v1Pools] }) + } + + if (v2Pools) { + const v2Assets = await api.multiCall({ abi: abi.v2Asset, calls: v2Pools }) + await api.sumTokens({ tokensAndOwners2: [v2Assets, v2Pools] }) + } + return api.getBalances() + }, + borrowed: async (_, _b, _cb, { api, }) => { + if (v1Pools) { + const v1Assets = await api.multiCall({ abi: abi.v1Asset, calls: v1Pools }) + const bals = await api.multiCall({ abi: 'erc20:balanceOf', calls: v1Assets.map((v, i) => ({ target: v, params: v1Pools[i] })) }) + const supplies = await api.multiCall({ abi: 'uint256:totalSupply', calls: v1Pools }) + api.addTokens(v1Assets, supplies) + api.addTokens(v1Assets, bals.map(i => i * -1)) + } + + if (v2Pools) { + const v2Assets = await api.multiCall({ abi: abi.v2Asset, calls: v2Pools }) + const loansValues = await api.multiCall({ abi: abi.loansValue, calls: v2Pools }) + api.addTokens(v2Assets, loansValues) + } + return api.getBalances() + }, + } + + if (stakingConfig) { + module.exports[chain].staking = sumTokensExport(stakingConfig) + } + +}) \ No newline at end of file From 8d9502456f4b946accb75815a73e4463d6a58763 Mon Sep 17 00:00:00 2001 From: XBased Dev <141856935+xbased-xyz@users.noreply.github.com> Date: Thu, 14 Sep 2023 09:44:02 +0800 Subject: [PATCH 1227/1974] Added XBased (#7467) * Added XBased * minor fix --------- Co-authored-by: g1nt0ki --- projects/xbased/index.js | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 projects/xbased/index.js diff --git a/projects/xbased/index.js b/projects/xbased/index.js new file mode 100644 index 00000000000..e6adb121514 --- /dev/null +++ b/projects/xbased/index.js @@ -0,0 +1,8 @@ +const { uniTvlExport } = require('../helper/calculateUniTvl.js') + +module.exports = { + misrepresentedTokens: true, + base: { + tvl: uniTvlExport("0x7a9ACeB13bc00eEC11460A5D7122793461Da96E0", 'base', true, undefined, { fetchBalances: true, }), + }, +} \ No newline at end of file From bb9b950038bd6bb668fa1f09c84ad0e73a50a7f4 Mon Sep 17 00:00:00 2001 From: The Flash Date: Thu, 14 Sep 2023 04:40:09 +0200 Subject: [PATCH 1228/1974] Add flashPulse factory --- projects/flashpulse/index.js | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 projects/flashpulse/index.js diff --git a/projects/flashpulse/index.js b/projects/flashpulse/index.js new file mode 100644 index 00000000000..3b4834e09e4 --- /dev/null +++ b/projects/flashpulse/index.js @@ -0,0 +1,6 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports = { + misrepresentedTokens: true, + pulse: { tvl: getUniTVL({ factory: '0xD2871d0d39A9cb0cB0505309A5C1F521df25a987', useDefaultCoreAssets: true, fetchBalances: true, }), }, +} \ No newline at end of file From 7df95a81207f7cf76242b5a7a619a47a8e5df1d9 Mon Sep 17 00:00:00 2001 From: veljkoTNFT Date: Wed, 2 Aug 2023 12:57:52 +0200 Subject: [PATCH 1229/1974] update tangible liquidity fetch --- projects/tangible/index.js | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/projects/tangible/index.js b/projects/tangible/index.js index 2649a55e75d..9fe73a0b9f1 100644 --- a/projects/tangible/index.js +++ b/projects/tangible/index.js @@ -132,6 +132,43 @@ async function tangiblePOL(api) { }) } +async function tangiblePOL(_pearlPairApi, block) { + + const result = await axios.get("https://api.pearl.exchange/api/v15/pools"); + const pools = result.data.data.filter( + (pool) => + (["DAI", "USDC", "USDT"].includes(pool.token0.symbol) && + pool.token1.symbol === "USDR") || + (["DAI", "USDC", "USDT"].includes(pool.token1.symbol) && + pool.token0.symbol === "USDR"), + ); + const multisigAddress = "0x100fCC635acf0c22dCdceF49DD93cA94E55F0c71"; + + const liquidity = await Promise.all( + pools.map(async (pool) => { + const pair = (await sdk.api.abi.call({ + abi: getPair, + target: _pearlPairApi, + params: [pool.address, multisigAddress], + chain, block, + })).output + + const lpPrice = + pool.totalSupply === 0 + ? 0 + : Math.floor(pool.tvl / pool.totalSupply); + + return pair.account_gauge_balance * lpPrice; + }), + ).then((pools) => + pools.reduce( + (acc, poolLiquidity) => acc + poolLiquidity, + 0, + ), + ); + return liquidity; +} + module.exports = { misrepresentedTokens: true, polygon: { tvl, }, From ec7b98667a522b8cdd051f3c3db7c5ed3b9c2072 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 8 Aug 2023 02:20:38 +0200 Subject: [PATCH 1230/1974] tangible: code refactor --- projects/tangible/index.js | 62 ++++++++++++++++++++------------------ 1 file changed, 32 insertions(+), 30 deletions(-) diff --git a/projects/tangible/index.js b/projects/tangible/index.js index 9fe73a0b9f1..7e3f43b11ad 100644 --- a/projects/tangible/index.js +++ b/projects/tangible/index.js @@ -132,41 +132,43 @@ async function tangiblePOL(api) { }) } -async function tangiblePOL(_pearlPairApi, block) { - - const result = await axios.get("https://api.pearl.exchange/api/v15/pools"); - const pools = result.data.data.filter( +async function tangiblePOL(api) { + + //pearl pair api address + const pearlPairApi = await api.call({ + abi: apGetAddress, + target: ADDRESS_PROVIDER_ADDRESS, + params: ["0xd1e0c1a56a62f2e6553b45bde148c89c51a01f766c23f4bb2c612bd2c822f711"],//keccak of paerl api address + }) + + const { data } = await getConfig('tangible', "https://api.pearl.exchange/api/v15/pools"); + const pools = data.filter( (pool) => (["DAI", "USDC", "USDT"].includes(pool.token0.symbol) && pool.token1.symbol === "USDR") || (["DAI", "USDC", "USDT"].includes(pool.token1.symbol) && pool.token0.symbol === "USDR"), - ); - const multisigAddress = "0x100fCC635acf0c22dCdceF49DD93cA94E55F0c71"; - - const liquidity = await Promise.all( - pools.map(async (pool) => { - const pair = (await sdk.api.abi.call({ - abi: getPair, - target: _pearlPairApi, - params: [pool.address, multisigAddress], - chain, block, - })).output - - const lpPrice = - pool.totalSupply === 0 - ? 0 - : Math.floor(pool.tvl / pool.totalSupply); - - return pair.account_gauge_balance * lpPrice; - }), - ).then((pools) => - pools.reduce( - (acc, poolLiquidity) => acc + poolLiquidity, - 0, - ), - ); - return liquidity; + ).map(i => i.address) + + const multisigAddress = "0x100fCC635acf0c22dCdceF49DD93cA94E55F0c71" + const [lpBals, tokens0, tokens1, totalSupplies, reserves] = await Promise.all([ + api.multiCall({ abi: getPair, target: pearlPairApi, calls: pools.map(p => ({ params: [p, multisigAddress]})) }), + api.multiCall({ abi: 'address:token0', calls: pools }), + api.multiCall({ abi: 'address:token1', calls: pools }), + api.multiCall({ abi: 'uint256:totalSupply', calls: pools }), + api.multiCall({ abi: "function getReserves() view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast)", calls: pools }), + ]) + + const blacklist = [USDR, TNGBL] + lpBals.forEach((lpBal, i) => { + const ratio = lpBal.account_gauge_balance / totalSupplies[i] + if (!blacklist.includes(tokens0[i].toLowerCase())) + api.add(tokens0[i], reserves[i]._reserve0 * ratio) + + if (!blacklist.includes(tokens1[i].toLowerCase())) + api.add(tokens1[i], reserves[i]._reserve1 * ratio) + + }) } module.exports = { From b4f29af755733bd704966671f6514e16238fff62 Mon Sep 17 00:00:00 2001 From: veljkoTNFT Date: Fri, 1 Sep 2023 18:51:43 +0200 Subject: [PATCH 1231/1974] new tngbl TVL calculation --- projects/tangible/abi.js | 1 + projects/tangible/index.js | 42 ++++++++++++++++++++++++++++++-------- 2 files changed, 35 insertions(+), 8 deletions(-) diff --git a/projects/tangible/abi.js b/projects/tangible/abi.js index 01b3bb957b4..8aca0c590c0 100644 --- a/projects/tangible/abi.js +++ b/projects/tangible/abi.js @@ -8,4 +8,5 @@ module.exports = { getTnftCustody: "function tnftCustody(uint256) view returns (bool)", getItemPriceBatchTokenIds: "function itemPriceBatchTokenIds(address nft, address paymentUSDToken, uint256[] tokenIds) view returns (uint256[] weSellAt, uint256[] weSellAtStock, uint256[] weBuyAt, uint256[] weBuyAtStock, uint256[] lockedAmount)", getPair: "function getPair(address _pair, address _account) view returns (tuple(address pair_address, string symbol, string name, uint256 decimals, bool stable, uint256 total_supply, address token0, string token0_symbol, uint256 token0_decimals, uint256 reserve0, uint256 claimable0, address token1, string token1_symbol, uint256 token1_decimals, uint256 reserve1, uint256 claimable1, address gauge, uint256 gauge_total_supply, address fee, address bribe, uint256 emissions, address emissions_token, uint256 emissions_token_decimals, uint256 account_lp_balance, uint256 account_token0_balance, uint256 account_token1_balance, uint256 account_gauge_balance, uint256 account_gauge_earned) _pairInfo)", + getPearlBalanceCaviar: "function balanceOfVePearl() view returns (uint256)", } \ No newline at end of file diff --git a/projects/tangible/index.js b/projects/tangible/index.js index 7e3f43b11ad..16767a784a1 100644 --- a/projects/tangible/index.js +++ b/projects/tangible/index.js @@ -5,13 +5,15 @@ const { getConfig } = require('../helper/cache') // doc: https://docs.tangible.store/real-usd/real-usd-v3-contracts-and-addresses const TNGBL = '0x49e6A20f1BBdfEeC2a8222E052000BbB14EE6007'.toLowerCase() const USDR = '0x40379a439d4f6795b6fc9aa5687db461677a2dba'.toLowerCase() +const PEARL = '0x7238390d5f6F64e67c3211C343A410E2A3DEc142'.toLowerCase() const { apGetAddress, getPriceManager, getCategories, getTotalSupply, getTokenByIndex, getTnftCustody, - getItemPriceBatchTokenIds, getPair } = require("./abi.js"); + getItemPriceBatchTokenIds, getPair, getPearlBalanceCaviar } = require("./abi.js"); const ADDRESS_PROVIDER_ADDRESS = "0xE95BCf65478d6ba44C5F57740CfA50EA443619eA"; const FACTORY_ADDRESS = "0xB0E54b88BB0043A938563fe8A77F4ddE2eB0cFc0"; +const CAVIAR_STRATEGY = "0x4626E247390c82FA3b72A913d3d8fe079FFb84Ff"; const insuranceConfig = { ethereum: { @@ -20,7 +22,11 @@ const insuranceConfig = { }, polygon: { owner: '0xD1758fbABAE91c805BE76D56548A584EF68B81f0', - tokens: [ADDRESSES.polygon.DAI, ADDRESSES.polygon.USDC, ADDRESSES.polygon.USDT, ADDRESSES.null, ADDRESSES.polygon.WETH, ADDRESSES.polygon.WMATIC], + tokens: [ADDRESSES.polygon.DAI, ADDRESSES.polygon.USDC, ADDRESSES.polygon.USDT, ADDRESSES.null, ADDRESSES.polygon.WETH, ADDRESSES.polygon.WMATIC, PEARL, TNGBL], + }, + polygon1: { + owner: '0x632572cfAa39330c8F0211b5B33BC86135E48b5f', + tokens: [ADDRESSES.polygon.DAI, ADDRESSES.polygon.USDC, ADDRESSES.polygon.USDT, ADDRESSES.null, ADDRESSES.polygon.WETH, ADDRESSES.polygon.WMATIC, PEARL, TNGBL], }, optimism: { owner: '0x7f922242d919feF0da0e40e3Cb4B7f7D3c97a63e', @@ -33,7 +39,8 @@ async function tvl(_, _b, _cb, { api }) { treasuryTvl, insuranceTvl, rwaTVL, - tangiblePOL + tangiblePOL, + tangibleCaviar ].map(fn => fn(api))) } @@ -44,12 +51,13 @@ async function treasuryTvl(api) { target: ADDRESS_PROVIDER_ADDRESS, params: ["0xc83e4fd410f80be983b083c99898391186b0893751a26a9a1e5fdcb9d4129701"],//keccak of USDRTreasury }) - await api.sumTokens({ owner: usdrTreasuryAddress, tokens: [ADDRESSES.polygon.DAI] }) + await api.sumTokens({ owner: usdrTreasuryAddress, tokens: [ADDRESSES.polygon.DAI, TNGBL] }) // TNGBL should be part, same as for Tera/Luna, Synthetics/sUSD } async function insuranceTvl(api) { await unwrapBalancerToken(api) - return api.sumTokens(insuranceConfig.polygon) + await api.sumTokens(insuranceConfig.polygon) + return api.sumTokens(insuranceConfig.polygon1) } async function rwaTVL(api) { @@ -93,6 +101,18 @@ async function rwaTVL(api) { } +async function tangibleCaviar(api) { + // now fetch locked pearl in Caviar + const pearlAmountInCaviar = await api.call({ + abi: getPearlBalanceCaviar, + target: CAVIAR_STRATEGY, + params: [], + }) + + api.add(PEARL, pearlAmountInCaviar); + +} + async function tangiblePOL(api) { //pearl pair api address @@ -102,6 +122,13 @@ async function tangiblePOL(api) { params: ["0xd1e0c1a56a62f2e6553b45bde148c89c51a01f766c23f4bb2c612bd2c822f711"],//keccak of paerl api address }) + // liquidity manager + const liquidityManager = await api.call({ + abi: apGetAddress, + target: ADDRESS_PROVIDER_ADDRESS, + params: ["0x6878742ff510854cb02c186504af5267007c4a6d33f490fc28ec83e83e1458e1"],//keccak of liquidity manager + }) + const { data } = await getConfig('tangible', "https://api.pearl.exchange/api/v15/pools"); const pools = data.filter( (pool) => @@ -111,16 +138,15 @@ async function tangiblePOL(api) { pool.token0.symbol === "USDR"), ).map(i => i.address) - const multisigAddress = "0x100fCC635acf0c22dCdceF49DD93cA94E55F0c71" const [lpBals, tokens0, tokens1, totalSupplies, reserves] = await Promise.all([ - api.multiCall({ abi: getPair, target: pearlPairApi, calls: pools.map(p => ({ params: [p, multisigAddress]})) }), + api.multiCall({ abi: getPair, target: pearlPairApi, calls: pools.map(p => ({ params: [p, liquidityManager]})) }), api.multiCall({ abi: 'address:token0', calls: pools }), api.multiCall({ abi: 'address:token1', calls: pools }), api.multiCall({ abi: 'uint256:totalSupply', calls: pools }), api.multiCall({ abi: "function getReserves() view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast)", calls: pools }), ]) - const blacklist = [USDR, TNGBL] + const blacklist = [USDR] lpBals.forEach((lpBal, i) => { const ratio = lpBal.account_gauge_balance / totalSupplies[i] if (!blacklist.includes(tokens0[i].toLowerCase())) From 032268df2e746380ac2c3a8497c475c914f0cf50 Mon Sep 17 00:00:00 2001 From: Daniel Kuppitz Date: Tue, 12 Sep 2023 12:17:26 -0700 Subject: [PATCH 1232/1974] vanilla implementation for insurance fund value on polygon --- projects/tangible/abi/BalancerPool.json | 1 + projects/tangible/abi/CaviarChef.json | 1 + projects/tangible/abi/Multicall3.json | 1 + projects/tangible/abi/PairFactory.json | 1 + projects/tangible/abi/Vault.json | 1 + projects/tangible/abi/Voter.json | 1 + projects/tangible/abi/vePEARL.json | 1 + projects/tangible/abi/veTETU.json | 1 + projects/tangible/insurance-fund.js | 297 ++++++++++++++++++++++++ 9 files changed, 305 insertions(+) create mode 100644 projects/tangible/abi/BalancerPool.json create mode 100644 projects/tangible/abi/CaviarChef.json create mode 100644 projects/tangible/abi/Multicall3.json create mode 100644 projects/tangible/abi/PairFactory.json create mode 100644 projects/tangible/abi/Vault.json create mode 100644 projects/tangible/abi/Voter.json create mode 100644 projects/tangible/abi/vePEARL.json create mode 100644 projects/tangible/abi/veTETU.json create mode 100644 projects/tangible/insurance-fund.js diff --git a/projects/tangible/abi/BalancerPool.json b/projects/tangible/abi/BalancerPool.json new file mode 100644 index 00000000000..4dc5088dba4 --- /dev/null +++ b/projects/tangible/abi/BalancerPool.json @@ -0,0 +1 @@ +[{"inputs":[{"internalType":"contract IVault","name":"vault","type":"address"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"},{"internalType":"contract IERC20[]","name":"tokens","type":"address[]"},{"internalType":"uint256[]","name":"normalizedWeights","type":"uint256[]"},{"internalType":"uint256","name":"swapFeePercentage","type":"uint256"},{"internalType":"uint256","name":"pauseWindowDuration","type":"uint256"},{"internalType":"uint256","name":"bufferPeriodDuration","type":"uint256"},{"internalType":"address","name":"owner","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"paused","type":"bool"}],"name":"PausedStateChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"swapFeePercentage","type":"uint256"}],"name":"SwapFeePercentageChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"DOMAIN_SEPARATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"decreaseApproval","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"selector","type":"bytes4"}],"name":"getActionId","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAuthorizer","outputs":[{"internalType":"contract IAuthorizer","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getInvariant","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getLastInvariant","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getNormalizedWeights","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPausedState","outputs":[{"internalType":"bool","name":"paused","type":"bool"},{"internalType":"uint256","name":"pauseWindowEndTime","type":"uint256"},{"internalType":"uint256","name":"bufferPeriodEndTime","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPoolId","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getSwapFeePercentage","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getVault","outputs":[{"internalType":"contract IVault","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"increaseApproval","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"nonces","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"poolId","type":"bytes32"},{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256[]","name":"balances","type":"uint256[]"},{"internalType":"uint256","name":"lastChangeBlock","type":"uint256"},{"internalType":"uint256","name":"protocolSwapFeePercentage","type":"uint256"},{"internalType":"bytes","name":"userData","type":"bytes"}],"name":"onExitPool","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"poolId","type":"bytes32"},{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256[]","name":"balances","type":"uint256[]"},{"internalType":"uint256","name":"lastChangeBlock","type":"uint256"},{"internalType":"uint256","name":"protocolSwapFeePercentage","type":"uint256"},{"internalType":"bytes","name":"userData","type":"bytes"}],"name":"onJoinPool","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"enum IVault.SwapKind","name":"kind","type":"uint8"},{"internalType":"contract IERC20","name":"tokenIn","type":"address"},{"internalType":"contract IERC20","name":"tokenOut","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes32","name":"poolId","type":"bytes32"},{"internalType":"uint256","name":"lastChangeBlock","type":"uint256"},{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"bytes","name":"userData","type":"bytes"}],"internalType":"struct IPoolSwapStructs.SwapRequest","name":"request","type":"tuple"},{"internalType":"uint256","name":"balanceTokenIn","type":"uint256"},{"internalType":"uint256","name":"balanceTokenOut","type":"uint256"}],"name":"onSwap","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"permit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"poolId","type":"bytes32"},{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256[]","name":"balances","type":"uint256[]"},{"internalType":"uint256","name":"lastChangeBlock","type":"uint256"},{"internalType":"uint256","name":"protocolSwapFeePercentage","type":"uint256"},{"internalType":"bytes","name":"userData","type":"bytes"}],"name":"queryExit","outputs":[{"internalType":"uint256","name":"bptIn","type":"uint256"},{"internalType":"uint256[]","name":"amountsOut","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"poolId","type":"bytes32"},{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256[]","name":"balances","type":"uint256[]"},{"internalType":"uint256","name":"lastChangeBlock","type":"uint256"},{"internalType":"uint256","name":"protocolSwapFeePercentage","type":"uint256"},{"internalType":"bytes","name":"userData","type":"bytes"}],"name":"queryJoin","outputs":[{"internalType":"uint256","name":"bptOut","type":"uint256"},{"internalType":"uint256[]","name":"amountsIn","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"paused","type":"bool"}],"name":"setPaused","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"swapFeePercentage","type":"uint256"}],"name":"setSwapFeePercentage","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}] diff --git a/projects/tangible/abi/CaviarChef.json b/projects/tangible/abi/CaviarChef.json new file mode 100644 index 00000000000..8aaec5cc0a5 --- /dev/null +++ b/projects/tangible/abi/CaviarChef.json @@ -0,0 +1 @@ +[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Harvest","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"rewardPerSecond","type":"uint256"}],"name":"LogRewardPerSecond","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"lastRewardTime","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"underlyingSupply","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"accRewardPerShare","type":"uint256"}],"name":"LogUpdatePool","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"Withdraw","type":"event"},{"inputs":[],"name":"__NAME__","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"accRewardPerShare","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"to","type":"address"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"distributionPeriod","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"gaugeForLP","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"harvest","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"contract IERC20","name":"_rewardToken","type":"address"},{"internalType":"contract IERC20","name":"_underlying","type":"address"},{"internalType":"uint256","name":"_distributionPeriod","type":"uint256"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"lastDistributedTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastRewardTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"pendingReward","outputs":[{"internalType":"uint256","name":"pending","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rebaseChef","outputs":[{"internalType":"contract ICaviarChef","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rewardPerSecond","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"seedRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_distributionPeriod","type":"uint256"}],"name":"setDistributionPeriod","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_gaugeForLP","type":"address"}],"name":"setGaugeForLP","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_name","type":"string"}],"name":"setName","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_rebaseChef","type":"address"}],"name":"setRebaseChef","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_rewardPerSecond","type":"uint256"}],"name":"setRewardPerSecond","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_rewardToken","type":"address"}],"name":"setRewardToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_underlying","type":"address"}],"name":"setUnderlyingToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"smartWalletChecker","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"underlying","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"userInfo","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"int256","name":"rewardDebt","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"to","type":"address"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"to","type":"address"}],"name":"withdrawAndHarvest","outputs":[],"stateMutability":"nonpayable","type":"function"}] diff --git a/projects/tangible/abi/Multicall3.json b/projects/tangible/abi/Multicall3.json new file mode 100644 index 00000000000..e8b1c4862cf --- /dev/null +++ b/projects/tangible/abi/Multicall3.json @@ -0,0 +1 @@ +[{"inputs":[{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"bytes","name":"callData","type":"bytes"}],"internalType":"struct Multicall3.Call[]","name":"calls","type":"tuple[]"}],"name":"aggregate","outputs":[{"internalType":"uint256","name":"blockNumber","type":"uint256"},{"internalType":"bytes[]","name":"returnData","type":"bytes[]"}],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"bool","name":"allowFailure","type":"bool"},{"internalType":"bytes","name":"callData","type":"bytes"}],"internalType":"struct Multicall3.Call3[]","name":"calls","type":"tuple[]"}],"name":"aggregate3","outputs":[{"components":[{"internalType":"bool","name":"success","type":"bool"},{"internalType":"bytes","name":"returnData","type":"bytes"}],"internalType":"struct Multicall3.Result[]","name":"returnData","type":"tuple[]"}],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"bool","name":"allowFailure","type":"bool"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"callData","type":"bytes"}],"internalType":"struct Multicall3.Call3Value[]","name":"calls","type":"tuple[]"}],"name":"aggregate3Value","outputs":[{"components":[{"internalType":"bool","name":"success","type":"bool"},{"internalType":"bytes","name":"returnData","type":"bytes"}],"internalType":"struct Multicall3.Result[]","name":"returnData","type":"tuple[]"}],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"bytes","name":"callData","type":"bytes"}],"internalType":"struct Multicall3.Call[]","name":"calls","type":"tuple[]"}],"name":"blockAndAggregate","outputs":[{"internalType":"uint256","name":"blockNumber","type":"uint256"},{"internalType":"bytes32","name":"blockHash","type":"bytes32"},{"components":[{"internalType":"bool","name":"success","type":"bool"},{"internalType":"bytes","name":"returnData","type":"bytes"}],"internalType":"struct Multicall3.Result[]","name":"returnData","type":"tuple[]"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"getBasefee","outputs":[{"internalType":"uint256","name":"basefee","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"blockNumber","type":"uint256"}],"name":"getBlockHash","outputs":[{"internalType":"bytes32","name":"blockHash","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getBlockNumber","outputs":[{"internalType":"uint256","name":"blockNumber","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getChainId","outputs":[{"internalType":"uint256","name":"chainid","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCurrentBlockCoinbase","outputs":[{"internalType":"address","name":"coinbase","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCurrentBlockDifficulty","outputs":[{"internalType":"uint256","name":"difficulty","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCurrentBlockGasLimit","outputs":[{"internalType":"uint256","name":"gaslimit","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCurrentBlockTimestamp","outputs":[{"internalType":"uint256","name":"timestamp","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"getEthBalance","outputs":[{"internalType":"uint256","name":"balance","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getLastBlockHash","outputs":[{"internalType":"bytes32","name":"blockHash","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bool","name":"requireSuccess","type":"bool"},{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"bytes","name":"callData","type":"bytes"}],"internalType":"struct Multicall3.Call[]","name":"calls","type":"tuple[]"}],"name":"tryAggregate","outputs":[{"components":[{"internalType":"bool","name":"success","type":"bool"},{"internalType":"bytes","name":"returnData","type":"bytes"}],"internalType":"struct Multicall3.Result[]","name":"returnData","type":"tuple[]"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bool","name":"requireSuccess","type":"bool"},{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"bytes","name":"callData","type":"bytes"}],"internalType":"struct Multicall3.Call[]","name":"calls","type":"tuple[]"}],"name":"tryBlockAndAggregate","outputs":[{"internalType":"uint256","name":"blockNumber","type":"uint256"},{"internalType":"bytes32","name":"blockHash","type":"bytes32"},{"components":[{"internalType":"bool","name":"success","type":"bool"},{"internalType":"bytes","name":"returnData","type":"bytes"}],"internalType":"struct Multicall3.Result[]","name":"returnData","type":"tuple[]"}],"stateMutability":"payable","type":"function"}] diff --git a/projects/tangible/abi/PairFactory.json b/projects/tangible/abi/PairFactory.json new file mode 100644 index 00000000000..c643f75e60b --- /dev/null +++ b/projects/tangible/abi/PairFactory.json @@ -0,0 +1 @@ +[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token0","type":"address"},{"indexed":true,"internalType":"address","name":"token1","type":"address"},{"indexed":false,"internalType":"bool","name":"stable","type":"bool"},{"indexed":false,"internalType":"address","name":"pair","type":"address"},{"indexed":false,"internalType":"uint256","name":"","type":"uint256"}],"name":"PairCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"bool","name":"_added","type":"bool"}],"name":"PrivilegedAccountStatusUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"FEE_PRECISION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_FEE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"acceptFeeManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"allPairs","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"allPairsLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"tokenA","type":"address"},{"internalType":"address","name":"tokenB","type":"address"},{"internalType":"bool","name":"stable","type":"bool"}],"name":"createPair","outputs":[{"internalType":"address","name":"pair","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"feeManager","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bool","name":"_stable","type":"bool"}],"name":"getFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bool","name":"_stable","type":"bool"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"address","name":"_account","type":"address"}],"name":"getFeeAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"bool","name":"","type":"bool"}],"name":"getPair","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_pairImplementation","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isPair","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"isPrivileged","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pairImplementation","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pairManager","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pairs","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingFeeManager","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_stable","type":"bool"},{"internalType":"uint256","name":"_fee","type":"uint256"}],"name":"setFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_feeManager","type":"address"}],"name":"setFeeManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_pairImplementation","type":"address"}],"name":"setPairImplementationAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_pairManager","type":"address"}],"name":"setPairManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stableFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"updatePairFees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"pair","type":"address"}],"name":"updatePairFees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"},{"internalType":"bool","name":"_addToPrivileged","type":"bool"}],"name":"updatePrivilegedAccount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"volatileFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}] diff --git a/projects/tangible/abi/Vault.json b/projects/tangible/abi/Vault.json new file mode 100644 index 00000000000..c344ef434c9 --- /dev/null +++ b/projects/tangible/abi/Vault.json @@ -0,0 +1 @@ +[{"inputs":[{"internalType":"contract IAuthorizer","name":"authorizer","type":"address"},{"internalType":"contract IWETH","name":"weth","type":"address"},{"internalType":"uint256","name":"pauseWindowDuration","type":"uint256"},{"internalType":"uint256","name":"bufferPeriodDuration","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract IAuthorizer","name":"newAuthorizer","type":"address"}],"name":"AuthorizerChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract IERC20","name":"token","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"ExternalBalanceTransfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract IFlashLoanRecipient","name":"recipient","type":"address"},{"indexed":true,"internalType":"contract IERC20","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"feeAmount","type":"uint256"}],"name":"FlashLoan","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"contract IERC20","name":"token","type":"address"},{"indexed":false,"internalType":"int256","name":"delta","type":"int256"}],"name":"InternalBalanceChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"paused","type":"bool"}],"name":"PausedStateChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"poolId","type":"bytes32"},{"indexed":true,"internalType":"address","name":"liquidityProvider","type":"address"},{"indexed":false,"internalType":"contract IERC20[]","name":"tokens","type":"address[]"},{"indexed":false,"internalType":"int256[]","name":"deltas","type":"int256[]"},{"indexed":false,"internalType":"uint256[]","name":"protocolFeeAmounts","type":"uint256[]"}],"name":"PoolBalanceChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"poolId","type":"bytes32"},{"indexed":true,"internalType":"address","name":"assetManager","type":"address"},{"indexed":true,"internalType":"contract IERC20","name":"token","type":"address"},{"indexed":false,"internalType":"int256","name":"cashDelta","type":"int256"},{"indexed":false,"internalType":"int256","name":"managedDelta","type":"int256"}],"name":"PoolBalanceManaged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"poolId","type":"bytes32"},{"indexed":true,"internalType":"address","name":"poolAddress","type":"address"},{"indexed":false,"internalType":"enum IVault.PoolSpecialization","name":"specialization","type":"uint8"}],"name":"PoolRegistered","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"relayer","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"RelayerApprovalChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"poolId","type":"bytes32"},{"indexed":true,"internalType":"contract IERC20","name":"tokenIn","type":"address"},{"indexed":true,"internalType":"contract IERC20","name":"tokenOut","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountIn","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountOut","type":"uint256"}],"name":"Swap","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"poolId","type":"bytes32"},{"indexed":false,"internalType":"contract IERC20[]","name":"tokens","type":"address[]"}],"name":"TokensDeregistered","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"poolId","type":"bytes32"},{"indexed":false,"internalType":"contract IERC20[]","name":"tokens","type":"address[]"},{"indexed":false,"internalType":"address[]","name":"assetManagers","type":"address[]"}],"name":"TokensRegistered","type":"event"},{"inputs":[],"name":"WETH","outputs":[{"internalType":"contract IWETH","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"enum IVault.SwapKind","name":"kind","type":"uint8"},{"components":[{"internalType":"bytes32","name":"poolId","type":"bytes32"},{"internalType":"uint256","name":"assetInIndex","type":"uint256"},{"internalType":"uint256","name":"assetOutIndex","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"userData","type":"bytes"}],"internalType":"struct IVault.BatchSwapStep[]","name":"swaps","type":"tuple[]"},{"internalType":"contract IAsset[]","name":"assets","type":"address[]"},{"components":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"bool","name":"fromInternalBalance","type":"bool"},{"internalType":"address payable","name":"recipient","type":"address"},{"internalType":"bool","name":"toInternalBalance","type":"bool"}],"internalType":"struct IVault.FundManagement","name":"funds","type":"tuple"},{"internalType":"int256[]","name":"limits","type":"int256[]"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"batchSwap","outputs":[{"internalType":"int256[]","name":"assetDeltas","type":"int256[]"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"poolId","type":"bytes32"},{"internalType":"contract IERC20[]","name":"tokens","type":"address[]"}],"name":"deregisterTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"poolId","type":"bytes32"},{"internalType":"address","name":"sender","type":"address"},{"internalType":"address payable","name":"recipient","type":"address"},{"components":[{"internalType":"contract IAsset[]","name":"assets","type":"address[]"},{"internalType":"uint256[]","name":"minAmountsOut","type":"uint256[]"},{"internalType":"bytes","name":"userData","type":"bytes"},{"internalType":"bool","name":"toInternalBalance","type":"bool"}],"internalType":"struct IVault.ExitPoolRequest","name":"request","type":"tuple"}],"name":"exitPool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IFlashLoanRecipient","name":"recipient","type":"address"},{"internalType":"contract IERC20[]","name":"tokens","type":"address[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"internalType":"bytes","name":"userData","type":"bytes"}],"name":"flashLoan","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"selector","type":"bytes4"}],"name":"getActionId","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAuthorizer","outputs":[{"internalType":"contract IAuthorizer","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getDomainSeparator","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"contract IERC20[]","name":"tokens","type":"address[]"}],"name":"getInternalBalance","outputs":[{"internalType":"uint256[]","name":"balances","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"getNextNonce","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPausedState","outputs":[{"internalType":"bool","name":"paused","type":"bool"},{"internalType":"uint256","name":"pauseWindowEndTime","type":"uint256"},{"internalType":"uint256","name":"bufferPeriodEndTime","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"poolId","type":"bytes32"}],"name":"getPool","outputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"enum IVault.PoolSpecialization","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"poolId","type":"bytes32"},{"internalType":"contract IERC20","name":"token","type":"address"}],"name":"getPoolTokenInfo","outputs":[{"internalType":"uint256","name":"cash","type":"uint256"},{"internalType":"uint256","name":"managed","type":"uint256"},{"internalType":"uint256","name":"lastChangeBlock","type":"uint256"},{"internalType":"address","name":"assetManager","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"poolId","type":"bytes32"}],"name":"getPoolTokens","outputs":[{"internalType":"contract IERC20[]","name":"tokens","type":"address[]"},{"internalType":"uint256[]","name":"balances","type":"uint256[]"},{"internalType":"uint256","name":"lastChangeBlock","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getProtocolFeesCollector","outputs":[{"internalType":"contract ProtocolFeesCollector","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"address","name":"relayer","type":"address"}],"name":"hasApprovedRelayer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"poolId","type":"bytes32"},{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"components":[{"internalType":"contract IAsset[]","name":"assets","type":"address[]"},{"internalType":"uint256[]","name":"maxAmountsIn","type":"uint256[]"},{"internalType":"bytes","name":"userData","type":"bytes"},{"internalType":"bool","name":"fromInternalBalance","type":"bool"}],"internalType":"struct IVault.JoinPoolRequest","name":"request","type":"tuple"}],"name":"joinPool","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"enum IVault.PoolBalanceOpKind","name":"kind","type":"uint8"},{"internalType":"bytes32","name":"poolId","type":"bytes32"},{"internalType":"contract IERC20","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"internalType":"struct IVault.PoolBalanceOp[]","name":"ops","type":"tuple[]"}],"name":"managePoolBalance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"enum IVault.UserBalanceOpKind","name":"kind","type":"uint8"},{"internalType":"contract IAsset","name":"asset","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"sender","type":"address"},{"internalType":"address payable","name":"recipient","type":"address"}],"internalType":"struct IVault.UserBalanceOp[]","name":"ops","type":"tuple[]"}],"name":"manageUserBalance","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"enum IVault.SwapKind","name":"kind","type":"uint8"},{"components":[{"internalType":"bytes32","name":"poolId","type":"bytes32"},{"internalType":"uint256","name":"assetInIndex","type":"uint256"},{"internalType":"uint256","name":"assetOutIndex","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"userData","type":"bytes"}],"internalType":"struct IVault.BatchSwapStep[]","name":"swaps","type":"tuple[]"},{"internalType":"contract IAsset[]","name":"assets","type":"address[]"},{"components":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"bool","name":"fromInternalBalance","type":"bool"},{"internalType":"address payable","name":"recipient","type":"address"},{"internalType":"bool","name":"toInternalBalance","type":"bool"}],"internalType":"struct IVault.FundManagement","name":"funds","type":"tuple"}],"name":"queryBatchSwap","outputs":[{"internalType":"int256[]","name":"","type":"int256[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"enum IVault.PoolSpecialization","name":"specialization","type":"uint8"}],"name":"registerPool","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"poolId","type":"bytes32"},{"internalType":"contract IERC20[]","name":"tokens","type":"address[]"},{"internalType":"address[]","name":"assetManagers","type":"address[]"}],"name":"registerTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IAuthorizer","name":"newAuthorizer","type":"address"}],"name":"setAuthorizer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"paused","type":"bool"}],"name":"setPaused","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"relayer","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setRelayerApproval","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"bytes32","name":"poolId","type":"bytes32"},{"internalType":"enum IVault.SwapKind","name":"kind","type":"uint8"},{"internalType":"contract IAsset","name":"assetIn","type":"address"},{"internalType":"contract IAsset","name":"assetOut","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"userData","type":"bytes"}],"internalType":"struct IVault.SingleSwap","name":"singleSwap","type":"tuple"},{"components":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"bool","name":"fromInternalBalance","type":"bool"},{"internalType":"address payable","name":"recipient","type":"address"},{"internalType":"bool","name":"toInternalBalance","type":"bool"}],"internalType":"struct IVault.FundManagement","name":"funds","type":"tuple"},{"internalType":"uint256","name":"limit","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"swap","outputs":[{"internalType":"uint256","name":"amountCalculated","type":"uint256"}],"stateMutability":"payable","type":"function"},{"stateMutability":"payable","type":"receive"}] diff --git a/projects/tangible/abi/Voter.json b/projects/tangible/abi/Voter.json new file mode 100644 index 00000000000..f4c0077f25f --- /dev/null +++ b/projects/tangible/abi/Voter.json @@ -0,0 +1 @@ +[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"weight","type":"uint256"}],"name":"Abstained","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"lp","type":"address"},{"indexed":true,"internalType":"address","name":"gauge","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"gauge","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"DistributeReward","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"gauge","type":"address"},{"indexed":false,"internalType":"address","name":"creator","type":"address"},{"indexed":false,"internalType":"address","name":"internal_bribe","type":"address"},{"indexed":true,"internalType":"address","name":"external_bribe","type":"address"},{"indexed":true,"internalType":"address","name":"pool","type":"address"}],"name":"GaugeCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"gauge","type":"address"}],"name":"GaugeKilled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"gauge","type":"address"}],"name":"GaugeRevived","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"reward","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"NotifyReward","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"voter","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"weight","type":"uint256"}],"name":"Voted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"whitelister","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"}],"name":"Whitelisted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"lp","type":"address"},{"indexed":true,"internalType":"address","name":"gauge","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Withdraw","type":"event"},{"inputs":[{"internalType":"address[]","name":"_tokens","type":"address[]"},{"internalType":"address","name":"_minter","type":"address"}],"name":"_initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"_ve","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"bribefactory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_bribes","type":"address[]"},{"internalType":"address[][]","name":"_tokens","type":"address[][]"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"claimBribes","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_fees","type":"address[]"},{"internalType":"address[][]","name":"_tokens","type":"address[][]"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"claimFees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"claimable","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_pool","type":"address"}],"name":"createGauge","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_gauges","type":"address[]"}],"name":"distribute","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_gauge","type":"address"}],"name":"distribute","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"finish","type":"uint256"}],"name":"distribute","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"distributeAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_gauges","type":"address[]"}],"name":"distributeFees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"emergencyCouncil","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"emitDeposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"emitWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"external_bribes","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"factory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"gaugefactory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"gauges","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"gaugesDistributionTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getIncentivizedPools","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"governor","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_gauge","type":"address"}],"name":"increaseGaugeApprovals","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_gauges","type":"address[]"},{"internalType":"address[]","name":"_pools","type":"address[]"}],"name":"initGauges","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"__ve","type":"address"},{"internalType":"address","name":"_factory","type":"address"},{"internalType":"address","name":"_gauges","type":"address"},{"internalType":"address","name":"_bribes","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"internal_bribes","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isAlive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isBribe","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isGauge","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isWhitelisted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_gauge","type":"address"}],"name":"killGauge","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"lastVoted","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"length","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minter","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"notifyRewardAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"poke","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"poolForGauge","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"poolVote","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"poolVoteLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"pools","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"reinitialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"reset","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_gauge","type":"address"}],"name":"reviveGauge","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_bribeFactory","type":"address"}],"name":"setBribeFactory","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_council","type":"address"}],"name":"setEmergencyCouncil","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_gaugeFactory","type":"address"}],"name":"setGaugeFactory","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_governor","type":"address"}],"name":"setGovernor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_minter","type":"address"}],"name":"setMinter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_gauge","type":"address"},{"internalType":"address","name":"_internal","type":"address"},{"internalType":"address","name":"_external","type":"address"}],"name":"setNewBribe","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_factory","type":"address"}],"name":"setPairFactory","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_usdr","type":"address"}],"name":"setUSDR","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_votingEscrow","type":"address"}],"name":"setVotingEscrow","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"totalWeight","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"usdr","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"usedWeights","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"address[]","name":"_poolVote","type":"address[]"},{"internalType":"uint256[]","name":"_weights","type":"uint256[]"}],"name":"vote","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"votes","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"weights","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"whitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_token","type":"address[]"}],"name":"whitelist","outputs":[],"stateMutability":"nonpayable","type":"function"}] diff --git a/projects/tangible/abi/vePEARL.json b/projects/tangible/abi/vePEARL.json new file mode 100644 index 00000000000..b9e539aa0de --- /dev/null +++ b/projects/tangible/abi/vePEARL.json @@ -0,0 +1 @@ +[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"delegator","type":"address"},{"indexed":true,"internalType":"address","name":"fromDelegate","type":"address"},{"indexed":true,"internalType":"address","name":"toDelegate","type":"address"}],"name":"DelegateChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"delegate","type":"address"},{"indexed":false,"internalType":"uint256","name":"previousBalance","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newBalance","type":"uint256"}],"name":"DelegateVotesChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"provider","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"locktime","type":"uint256"},{"indexed":false,"internalType":"enum VotingEscrow.DepositType","name":"deposit_type","type":"uint8"},{"indexed":false,"internalType":"uint256","name":"ts","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"address","name":"migrator","type":"address"},{"indexed":false,"internalType":"address","name":"owner","type":"address"}],"name":"Migrate","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"prevSupply","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"supply","type":"uint256"}],"name":"Supply","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"provider","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"ts","type":"uint256"}],"name":"Withdraw","type":"event"},{"inputs":[],"name":"DELEGATION_TYPEHASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DOMAIN_TYPEHASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_DELEGATES","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PREVIOUS_IMPLEMENTATION","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"abstain","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"api","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_approved","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"artProxy","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_block","type":"uint256"}],"name":"balanceOfAtNFT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"balanceOfNFT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_t","type":"uint256"}],"name":"balanceOfNFTAt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"block_number","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"checkpoint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint32","name":"","type":"uint32"}],"name":"checkpoints","outputs":[{"internalType":"uint256","name":"timestamp","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_value","type":"uint256"},{"internalType":"uint256","name":"_lock_duration","type":"uint256"}],"name":"create_lock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_value","type":"uint256"},{"internalType":"uint256","name":"_lock_duration","type":"uint256"},{"internalType":"address","name":"_to","type":"address"}],"name":"create_lock_for","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"delegatee","type":"address"}],"name":"delegate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"delegatee","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"uint256","name":"expiry","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"delegateBySig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"delegator","type":"address"}],"name":"delegates","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"deposit_for","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"epoch","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"getPastTotalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"getPastVotes","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"getPastVotesIndex","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getVotes","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"get_last_user_slope","outputs":[{"internalType":"int128","name":"","type":"int128"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"increase_amount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_lock_duration","type":"uint256"}],"name":"increase_unlock_time","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token_addr","type":"address"},{"internalType":"address","name":"art_proxy","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"address","name":"_operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_spender","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"isApprovedOrOwner","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"locked","outputs":[{"components":[{"internalType":"int128","name":"amount","type":"int128"},{"internalType":"uint256","name":"end","type":"uint256"}],"internalType":"struct IVotingEscrow.LockedBalance","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"locked__end","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_from","type":"uint256"},{"internalType":"uint256","name":"_to","type":"uint256"}],"name":"merge","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"migrate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"nonces","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"numCheckpoints","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"ownership_change","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"loc","type":"uint256"}],"name":"point_history","outputs":[{"components":[{"internalType":"int128","name":"bias","type":"int128"},{"internalType":"int128","name":"slope","type":"int128"},{"internalType":"uint256","name":"ts","type":"uint256"},{"internalType":"uint256","name":"blk","type":"uint256"}],"internalType":"struct IVotingEscrow.Point","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_api","type":"address"}],"name":"setAPI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_operator","type":"address"},{"internalType":"bool","name":"_approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_proxy","type":"address"}],"name":"setArtProxy","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_team","type":"address"}],"name":"setTeam","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_voter","type":"address"}],"name":"setVoter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"slope_changes","outputs":[{"internalType":"int128","name":"","type":"int128"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"split","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"supply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"_interfaceID","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"team","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"uint256","name":"_tokenIndex","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_block","type":"uint256"}],"name":"totalSupplyAt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"t","type":"uint256"}],"name":"totalSupplyAtT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"user_point_epoch","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"loc","type":"uint256"}],"name":"user_point_history","outputs":[{"components":[{"internalType":"int128","name":"bias","type":"int128"},{"internalType":"int128","name":"slope","type":"int128"},{"internalType":"uint256","name":"ts","type":"uint256"},{"internalType":"uint256","name":"blk","type":"uint256"}],"internalType":"struct IVotingEscrow.Point","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_idx","type":"uint256"}],"name":"user_point_history__ts","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"version","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"voted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"voter","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"voting","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}] diff --git a/projects/tangible/abi/veTETU.json b/projects/tangible/abi/veTETU.json new file mode 100644 index 00000000000..6418cd93b22 --- /dev/null +++ b/projects/tangible/abi/veTETU.json @@ -0,0 +1 @@ +[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"controller","type":"address"},{"indexed":false,"internalType":"uint256","name":"ts","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"block","type":"uint256"}],"name":"ContractInitialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"stakingToken","type":"address"},{"indexed":true,"internalType":"address","name":"provider","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"locktime","type":"uint256"},{"indexed":false,"internalType":"enum IVeTetu.DepositType","name":"depositType","type":"uint8"},{"indexed":false,"internalType":"uint256","name":"ts","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_type","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timeToExecute","type":"uint256"}],"name":"GovActionAnnounced","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"stakingToken","type":"address"},{"indexed":true,"internalType":"address","name":"provider","type":"address"},{"indexed":false,"internalType":"uint256","name":"from","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"to","type":"uint256"}],"name":"Merged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"},{"indexed":false,"internalType":"address","name":"oldLogic","type":"address"}],"name":"RevisionIncreased","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"parentTokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newTokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"percent","type":"uint256"}],"name":"Split","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"value","type":"address"},{"indexed":false,"internalType":"uint256","name":"weight","type":"uint256"}],"name":"StakingTokenAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"value","type":"address"}],"name":"TransferWhitelisted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"stakingToken","type":"address"},{"indexed":true,"internalType":"address","name":"provider","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"ts","type":"uint256"}],"name":"Withdraw","type":"event"},{"inputs":[],"name":"CONTROLLABLE_VERSION","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"GOV_ACTION_TIME_LOCK","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_ATTACHMENTS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"VE_VERSION","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"_deprecated_voted","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"abstain","outputs":[],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"weight","type":"uint256"}],"name":"addToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"enum VeTetu.TimeLockType","name":"_type","type":"uint8"}],"name":"announceAction","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_approved","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"attachToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"attachments","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_block","type":"uint256"}],"name":"balanceOfAtNFT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"balanceOfNFT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_t","type":"uint256"}],"name":"balanceOfNFTAt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"blockTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"bool","name":"status","type":"bool"}],"name":"changeTokenFarmingAllowanceStatus","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"checkpoint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"controller","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"},{"internalType":"uint256","name":"_lockDuration","type":"uint256"}],"name":"createLock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"},{"internalType":"uint256","name":"_lockDuration","type":"uint256"},{"internalType":"address","name":"_to","type":"address"}],"name":"createLockFor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"created","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"createdBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"detachToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"emergencyWithdrawStakedTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"epoch","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"getLastUserSlope","outputs":[{"internalType":"int128","name":"","type":"int128"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"slot","type":"uint256"}],"name":"getSlot","outputs":[{"internalType":"bytes32","name":"result","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"enum VeTetu.TimeLockType","name":"","type":"uint8"}],"name":"govActionTimeLock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"increaseAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"oldLogic","type":"address"}],"name":"increaseRevision","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_lockDuration","type":"uint256"}],"name":"increaseUnlockTime","outputs":[{"internalType":"uint256","name":"power","type":"uint256"},{"internalType":"uint256","name":"unlockDate","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token_","type":"address"},{"internalType":"uint256","name":"weight","type":"uint256"},{"internalType":"address","name":"controller_","type":"address"}],"name":"init","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"address","name":"_operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_spender","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"isApprovedOrOwner","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_value","type":"address"}],"name":"isController","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_value","type":"address"}],"name":"isGovernance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isValidToken","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"isVoted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isWhitelistedTransfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"lockedAmounts","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"lockedDerivedAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"lockedEnd","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_from","type":"uint256"},{"internalType":"uint256","name":"_to","type":"uint256"}],"name":"merge","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"ownerToOperators","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"ownershipChange","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"platformVoter","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_loc","type":"uint256"}],"name":"pointHistory","outputs":[{"components":[{"internalType":"int128","name":"bias","type":"int128"},{"internalType":"int128","name":"slope","type":"int128"},{"internalType":"uint256","name":"ts","type":"uint256"},{"internalType":"uint256","name":"blk","type":"uint256"}],"internalType":"struct IVeTetu.Point","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"previousImplementation","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"revision","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_operator","type":"address"},{"internalType":"bool","name":"_approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"slopeChanges","outputs":[{"internalType":"int128","name":"","type":"int128"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"percent","type":"uint256"}],"name":"split","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"stakeAvailableTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"_interfaceID","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"uint256","name":"_tokenIndex","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tokenToOwnerIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"tokenWeights","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tokens","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokensLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_block","type":"uint256"}],"name":"totalSupplyAt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"t","type":"uint256"}],"name":"totalSupplyAtT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"userPointEpoch","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_loc","type":"uint256"}],"name":"userPointHistory","outputs":[{"components":[{"internalType":"int128","name":"bias","type":"int128"},{"internalType":"int128","name":"slope","type":"int128"},{"internalType":"uint256","name":"ts","type":"uint256"},{"internalType":"uint256","name":"blk","type":"uint256"}],"internalType":"struct IVeTetu.Point","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_idx","type":"uint256"}],"name":"userPointHistoryTs","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"voter","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"voting","outputs":[],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"value","type":"address"}],"name":"whitelistTransferFor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"stakingToken","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"withdrawAll","outputs":[],"stateMutability":"nonpayable","type":"function"}] diff --git a/projects/tangible/insurance-fund.js b/projects/tangible/insurance-fund.js new file mode 100644 index 00000000000..bcf5a190f54 --- /dev/null +++ b/projects/tangible/insurance-fund.js @@ -0,0 +1,297 @@ +const ethers = require('ethers'); + +const { default: axios } = require('axios'); + +const INSURANCE_FUND = '0xD1758fbABAE91c805BE76D56548A584EF68B81f0'; + +const BALANCER_POOL_ABI = require('./abi/BalancerPool.json'); +const CAVIAR_CHEF_ABI = require('./abi/CaviarChef.json'); +const MULTICALL_ABI = require('./abi/Multicall3.json'); +const PAIR_FACTORY_ABI = require('./abi/PairFactory.json'); +const VAULT_ABI = require('./abi/Vault.json'); +const VE_PEARL_ABI = require('./abi/vePEARL.json'); +const VE_TETU_ABI = require('./abi/veTETU.json'); +const VOTER_ABI = require('./abi/Voter.json'); + +const provider = new ethers.providers.JsonRpcProvider('https://polygon-rpc.com'); +const multicall = new ethers.Contract('0xcA11bde05977b3631167028862bE2a173976CA11', MULTICALL_ABI, provider); + +const ERC20_ABI = [ + 'function balanceOf(address) view returns (uint256)' +]; + +const PAIR_ABI = [ + 'function balanceOf(address) view returns (uint256)', + 'function getReserves() view returns (uint256, uint256, uint256)', + 'function tokens() view returns (address, address)', + 'function totalSupply() view returns (uint256)', +]; + +const erc20 = new ethers.utils.Interface(ERC20_ABI); + +const ERC20_TOKENS = { + CAVIAR: '0x6AE96Cc93331c19148541D4D2f31363684917092', + DAI: '0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063', + PEARL: '0x7238390d5f6F64e67c3211C343A410E2A3DEc142', + STAR: '0xC19669A405067927865B40Ea045a2baabbbe57f5', + STMATIC: '0x3A58a54C066FdC0f2D55FC9C89F0415C92eBf3C4', + TETU: '0x255707B70BF90aa112006E1b07B9AeA6De021424', + TNGBL: '0x49e6A20f1BBdfEeC2a8222E052000BbB14EE6007', + USDC: '0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174', + USDR: '0x40379a439D4F6795B6fc9aa5687dB461677A2dBa', + USDT: '0xc2132D05D31c914a87C6611C10748AEb04B58e8F', + WETH: '0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619', + WMATIC: '0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270', + WUSDR: '0x00e8c0E92eB3Ad88189E7125Ec8825eDc03Ab265', +} + +const UTILITY_TOKENS = { + TETU_BPT: '0xE2f706EF1f7240b803AAe877C9C762644bb808d8', + VE_PEARL: '0x017A26B18E4DA4FE1182723a39311e67463CF633', + VE_TETU: '0x6FB29DD17fa6E27BD112Bc3A2D0b8dae597AeDA4', +} + +const BALANCER_VAULT = '0xBA12222222228d8Ba445958a75a0704d566BF2C8'; +const CAVIAR_STAKING_CHEF = '0x83C5022745B2511Bd199687a42D27BEFd025A9A9'; +const CAVIAR_REBASE_CHEF = '0xf5374d452697d9A5fa2D97Ffd05155C853F6c1c6'; +const PEARL_PAIR_FACTORY = '0xEaF188cdd22fEEBCb345DCb529Aa18CA9FcB4FBd'; +const PEARL_VOTER = '0xa26C2A6BfeC5512c13Ae9EacF41Cb4319d30cCF0'; + +async function getInsuranceFundValue() { + const tokenAddresses = [...Object.values(ERC20_TOKENS), ...Object.values(UTILITY_TOKENS)]; + const tokenBalances = tokenAddresses.map(() => ethers.constants.Zero); + + let calls = []; + + for (let i = 0; i < tokenAddresses.length; i++) { + calls.push({ + target: tokenAddresses[i], + callData: erc20.encodeFunctionData('balanceOf', [INSURANCE_FUND]) + }) + } + + const { returnData: balanceData } = await multicall.callStatic.aggregate(calls); + + for (let i = 0; i < balanceData.length; i++) { + const [tokenBalance] = erc20.decodeFunctionResult('balanceOf', balanceData[i]); + tokenBalances[i] = tokenBalances[i].add(tokenBalance); + } + + const vePEARL = new ethers.utils.Interface(VE_PEARL_ABI); + const vePEARLBalance = tokenBalances[tokenAddresses.indexOf(UTILITY_TOKENS.VE_PEARL)].toNumber(); + + calls = []; + + for (let i = 0; i < vePEARLBalance; i++) { + calls.push({ + target: UTILITY_TOKENS.VE_PEARL, + callData: vePEARL.encodeFunctionData('tokenOfOwnerByIndex', [INSURANCE_FUND, i]) + }) + } + + const { returnData: pearlTokenIdData } = await multicall.callStatic.aggregate(calls); + + calls = []; + + for (let i = 0; i < pearlTokenIdData.length; i++) { + const [tokenId] = vePEARL.decodeFunctionResult('tokenOfOwnerByIndex', pearlTokenIdData[i]); + calls.push({ + target: UTILITY_TOKENS.VE_PEARL, + callData: vePEARL.encodeFunctionData('locked', [tokenId]) + }) + } + + const { returnData: lockedPearlData } = await multicall.callStatic.aggregate(calls); + + const pearlBalance = lockedPearlData + .map((data) => vePEARL.decodeFunctionResult('locked', data)) + .flat() + .map((t) => t.amount) + .reduce((a, b) => a.add(b), ethers.constants.Zero); + + const pearlTokenIndex = tokenAddresses.indexOf(ERC20_TOKENS.PEARL); + tokenBalances[pearlTokenIndex] = tokenBalances[pearlTokenIndex].add(pearlBalance); + + const veTETU = new ethers.utils.Interface(VE_TETU_ABI); + const veTETUBalance = tokenBalances[tokenAddresses.indexOf(UTILITY_TOKENS.VE_TETU)].toNumber(); + + calls = []; + + for (let i = 0; i < veTETUBalance; i++) { + calls.push({ + target: UTILITY_TOKENS.VE_TETU, + callData: veTETU.encodeFunctionData('tokenOfOwnerByIndex', [INSURANCE_FUND, i]) + }) + } + + const { returnData: tetuTokenIdData } = await multicall.callStatic.aggregate(calls); + + calls = []; + + for (let i = 0; i < tetuTokenIdData.length; i++) { + const [tokenId] = veTETU.decodeFunctionResult('tokenOfOwnerByIndex', tetuTokenIdData[i]); + calls.push({ + target: UTILITY_TOKENS.VE_TETU, + callData: veTETU.encodeFunctionData('lockedAmounts', [tokenId, UTILITY_TOKENS.TETU_BPT]) + }) + } + + const { returnData: lockedBptData } = await multicall.callStatic.aggregate(calls); + + const pool = new ethers.Contract(UTILITY_TOKENS.TETU_BPT, BALANCER_POOL_ABI, provider); + const bptBalance = lockedBptData + .map((data) => veTETU.decodeFunctionResult('lockedAmounts', data)) + .flat() + .reduce((a, b) => a.add(b), await pool.balanceOf(INSURANCE_FUND)); + + const bptSupply = await pool.totalSupply(); + + const vault = new ethers.Contract(BALANCER_VAULT, VAULT_ABI, provider); + const poolId = await pool.getPoolId(); + + const {tokens, balances} = await vault.getPoolTokens(poolId); + + for (let i = 0; i < tokens.length; i++) { + const tokenIndex = tokenAddresses.indexOf(tokens[i]); + const balance = balances[i].mul(bptBalance).div(bptSupply); + tokenBalances[tokenIndex] = tokenBalances[tokenIndex].add(balance); + } + + const caviarChef = new ethers.utils.Interface(CAVIAR_CHEF_ABI); + + calls = [ + { + target: CAVIAR_STAKING_CHEF, + callData: caviarChef.encodeFunctionData('userInfo', [INSURANCE_FUND]) + }, + { + target: CAVIAR_STAKING_CHEF, + callData: caviarChef.encodeFunctionData('pendingReward', [INSURANCE_FUND]) + }, + { + target: CAVIAR_STAKING_CHEF, + callData: caviarChef.encodeFunctionData('rewardToken') + }, + { + target: CAVIAR_REBASE_CHEF, + callData: caviarChef.encodeFunctionData('pendingReward', [INSURANCE_FUND]) + }, + { + target: CAVIAR_REBASE_CHEF, + callData: caviarChef.encodeFunctionData('rewardToken') + }, + ]; + + const { returnData: caviarData } = await multicall.callStatic.aggregate(calls); + + const [stakingAmount] = caviarChef.decodeFunctionResult('userInfo', caviarData[0]); + const [pendingStakingReward] = caviarChef.decodeFunctionResult('pendingReward', caviarData[1]); + const [stakingRewardToken] = caviarChef.decodeFunctionResult('rewardToken', caviarData[2]); + const [pendingRebaseReward] = caviarChef.decodeFunctionResult('pendingReward', caviarData[3]); + const [rebaseRewardToken] = caviarChef.decodeFunctionResult('rewardToken', caviarData[4]); + + const caviarTokenIndex = tokenAddresses.indexOf(ERC20_TOKENS.CAVIAR); + const stakingRewardTokenIndex = tokenAddresses.indexOf(stakingRewardToken); + const rebaseRewardTokenIndex = tokenAddresses.indexOf(rebaseRewardToken); + + tokenBalances[caviarTokenIndex] = tokenBalances[caviarTokenIndex].add(stakingAmount); + tokenBalances[stakingRewardTokenIndex] = tokenBalances[stakingRewardTokenIndex].add(pendingStakingReward); + tokenBalances[rebaseRewardTokenIndex] = tokenBalances[rebaseRewardTokenIndex].add(pendingRebaseReward); + + const coins = tokenAddresses.slice(0, Object.keys(ERC20_TOKENS).length).map((a) => `polygon:${a}`); + const prices = await axios.get(`https://coins.llama.fi/prices/current/${coins.join(',')}`).then((res) => res.data.coins); + + const pearlPairFactory = new ethers.Contract(PEARL_PAIR_FACTORY, PAIR_FACTORY_ABI, provider); + const numPairs = await pearlPairFactory.allPairsLength().then((n) => n.toNumber()); + + calls = [...Array(numPairs).keys()].map((i) => { + return { + target: PEARL_PAIR_FACTORY, + callData: pearlPairFactory.interface.encodeFunctionData('allPairs', [i]) + } + }); + + const { returnData: pairData } = await multicall.callStatic.aggregate(calls); + + const voter = new ethers.utils.Interface(VOTER_ABI); + + calls = pairData.map((data) => { + const [pair] = pearlPairFactory.interface.decodeFunctionResult('allPairs', data); + return { + target: PEARL_VOTER, + callData: voter.encodeFunctionData('gauges', [pair]) + }; + }); + + const { returnData: gaugeData } = await multicall.callStatic.aggregate(calls); + + calls = gaugeData.map((data) => { + const [gauge] = voter.decodeFunctionResult('gauges', data); + return { + target: gauge, + callData: erc20.encodeFunctionData('balanceOf', [INSURANCE_FUND]) + }; + }); + + const { returnData: gaugeBalanceData } = await multicall.callStatic.aggregate(calls); + + const pair = await new ethers.utils.Interface(PAIR_ABI); + + for (let i = 0; i < numPairs; i++) { + const [gaugeBalance] = erc20.decodeFunctionResult('balanceOf', gaugeBalanceData[i]); + if (gaugeBalance.gt(ethers.constants.Zero)) { + const [pairAddress] = pearlPairFactory.interface.decodeFunctionResult('allPairs', pairData[i]); + calls = [ + { + target: pairAddress, + callData: pair.encodeFunctionData('tokens') + }, + { + target: pairAddress, + callData: pair.encodeFunctionData('totalSupply') + }, + { + target: pairAddress, + callData: pair.encodeFunctionData('getReserves') + }, + ]; + + const { returnData: pairMetaData } = await multicall.callStatic.aggregate(calls); + + const [token0, token1] = pair.decodeFunctionResult('tokens', pairMetaData[0]); + const [totalSupply] = pair.decodeFunctionResult('totalSupply', pairMetaData[1]); + const [reserve0, reserve1] = pair.decodeFunctionResult('getReserves', pairMetaData[2]); + + const token0Balance = reserve0.mul(gaugeBalance).div(totalSupply); + const token1Balance = reserve1.mul(gaugeBalance).div(totalSupply); + const token0Index = tokenAddresses.indexOf(token0); + const token1Index = tokenAddresses.indexOf(token1); + + tokenBalances[token0Index] = tokenBalances[token0Index].add(token0Balance); + tokenBalances[token1Index] = tokenBalances[token1Index].add(token1Balance); + } + } + + if (prices[`polygon:${ERC20_TOKENS.CAVIAR}`] === undefined) { + prices[`polygon:${ERC20_TOKENS.CAVIAR}`] = prices[`polygon:${ERC20_TOKENS.PEARL}`]; + } + + const insuranceFundValue = tokenBalances.map((balance, i) => { + if (i >= Object.keys(ERC20_TOKENS).length) return 0; + const priceIndex = `polygon:${tokenAddresses[i]}`; + const formattedBalance = ethers.utils.formatUnits(balance, prices[priceIndex].decimals); + const price = prices[priceIndex].price; + console.log(`${Object.keys(ERC20_TOKENS)[i]}: ${+formattedBalance * price}`); + return +formattedBalance * price; + }).reduce((a, b) => a + b, 0); + + console.log(insuranceFundValue); + + return insuranceFundValue; +} + +module.exports = { + getInsuranceFundValue +} + +getInsuranceFundValue() \ No newline at end of file From e9e7752e1445ff22fe041228a1ceb9496d853753 Mon Sep 17 00:00:00 2001 From: veljkoTNFT Date: Thu, 14 Sep 2023 13:53:10 +0200 Subject: [PATCH 1233/1974] insurance funds --- projects/tangible/index.js | 6 ++++-- projects/tangible/insurance-fund.js | 27 +++++++++++++-------------- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/projects/tangible/index.js b/projects/tangible/index.js index 16767a784a1..b7a0e644ade 100644 --- a/projects/tangible/index.js +++ b/projects/tangible/index.js @@ -1,6 +1,7 @@ const ADDRESSES = require('../helper/coreAssets.json') const { sumTokensExport } = require('../helper/unwrapLPs') const { getConfig } = require('../helper/cache') +const { getInsuranceFundValue, insuranceTokens } = require("./insurance-fund"); // doc: https://docs.tangible.store/real-usd/real-usd-v3-contracts-and-addresses const TNGBL = '0x49e6A20f1BBdfEeC2a8222E052000BbB14EE6007'.toLowerCase() @@ -22,7 +23,7 @@ const insuranceConfig = { }, polygon: { owner: '0xD1758fbABAE91c805BE76D56548A584EF68B81f0', - tokens: [ADDRESSES.polygon.DAI, ADDRESSES.polygon.USDC, ADDRESSES.polygon.USDT, ADDRESSES.null, ADDRESSES.polygon.WETH, ADDRESSES.polygon.WMATIC, PEARL, TNGBL], + tokens: Object.values(insuranceTokens), }, polygon1: { owner: '0x632572cfAa39330c8F0211b5B33BC86135E48b5f', @@ -40,7 +41,8 @@ async function tvl(_, _b, _cb, { api }) { insuranceTvl, rwaTVL, tangiblePOL, - tangibleCaviar + tangibleCaviar, + getInsuranceFundValue ].map(fn => fn(api))) } diff --git a/projects/tangible/insurance-fund.js b/projects/tangible/insurance-fund.js index bcf5a190f54..93c43e94efc 100644 --- a/projects/tangible/insurance-fund.js +++ b/projects/tangible/insurance-fund.js @@ -29,7 +29,7 @@ const PAIR_ABI = [ const erc20 = new ethers.utils.Interface(ERC20_ABI); -const ERC20_TOKENS = { +const insuranceTokens = { CAVIAR: '0x6AE96Cc93331c19148541D4D2f31363684917092', DAI: '0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063', PEARL: '0x7238390d5f6F64e67c3211C343A410E2A3DEc142', @@ -57,8 +57,8 @@ const CAVIAR_REBASE_CHEF = '0xf5374d452697d9A5fa2D97Ffd05155C853F6c1c6'; const PEARL_PAIR_FACTORY = '0xEaF188cdd22fEEBCb345DCb529Aa18CA9FcB4FBd'; const PEARL_VOTER = '0xa26C2A6BfeC5512c13Ae9EacF41Cb4319d30cCF0'; -async function getInsuranceFundValue() { - const tokenAddresses = [...Object.values(ERC20_TOKENS), ...Object.values(UTILITY_TOKENS)]; +async function getInsuranceFundValue(api) { + const tokenAddresses = [...Object.values(insuranceTokens), ...Object.values(UTILITY_TOKENS)]; const tokenBalances = tokenAddresses.map(() => ethers.constants.Zero); let calls = []; @@ -109,7 +109,7 @@ async function getInsuranceFundValue() { .map((t) => t.amount) .reduce((a, b) => a.add(b), ethers.constants.Zero); - const pearlTokenIndex = tokenAddresses.indexOf(ERC20_TOKENS.PEARL); + const pearlTokenIndex = tokenAddresses.indexOf(insuranceTokens.PEARL); tokenBalances[pearlTokenIndex] = tokenBalances[pearlTokenIndex].add(pearlBalance); const veTETU = new ethers.utils.Interface(VE_TETU_ABI); @@ -190,7 +190,7 @@ async function getInsuranceFundValue() { const [pendingRebaseReward] = caviarChef.decodeFunctionResult('pendingReward', caviarData[3]); const [rebaseRewardToken] = caviarChef.decodeFunctionResult('rewardToken', caviarData[4]); - const caviarTokenIndex = tokenAddresses.indexOf(ERC20_TOKENS.CAVIAR); + const caviarTokenIndex = tokenAddresses.indexOf(insuranceTokens.CAVIAR); const stakingRewardTokenIndex = tokenAddresses.indexOf(stakingRewardToken); const rebaseRewardTokenIndex = tokenAddresses.indexOf(rebaseRewardToken); @@ -198,7 +198,7 @@ async function getInsuranceFundValue() { tokenBalances[stakingRewardTokenIndex] = tokenBalances[stakingRewardTokenIndex].add(pendingStakingReward); tokenBalances[rebaseRewardTokenIndex] = tokenBalances[rebaseRewardTokenIndex].add(pendingRebaseReward); - const coins = tokenAddresses.slice(0, Object.keys(ERC20_TOKENS).length).map((a) => `polygon:${a}`); + const coins = tokenAddresses.slice(0, Object.keys(insuranceTokens).length).map((a) => `polygon:${a}`); const prices = await axios.get(`https://coins.llama.fi/prices/current/${coins.join(',')}`).then((res) => res.data.coins); const pearlPairFactory = new ethers.Contract(PEARL_PAIR_FACTORY, PAIR_FACTORY_ABI, provider); @@ -272,26 +272,25 @@ async function getInsuranceFundValue() { } } - if (prices[`polygon:${ERC20_TOKENS.CAVIAR}`] === undefined) { - prices[`polygon:${ERC20_TOKENS.CAVIAR}`] = prices[`polygon:${ERC20_TOKENS.PEARL}`]; + if (prices[`polygon:${insuranceTokens.CAVIAR}`] === undefined) { + prices[`polygon:${insuranceTokens.CAVIAR}`] = prices[`polygon:${insuranceTokens.PEARL}`]; } const insuranceFundValue = tokenBalances.map((balance, i) => { - if (i >= Object.keys(ERC20_TOKENS).length) return 0; + if (i >= Object.keys(insuranceTokens).length) return 0; const priceIndex = `polygon:${tokenAddresses[i]}`; const formattedBalance = ethers.utils.formatUnits(balance, prices[priceIndex].decimals); const price = prices[priceIndex].price; - console.log(`${Object.keys(ERC20_TOKENS)[i]}: ${+formattedBalance * price}`); + console.log(`${Object.keys(insuranceTokens)[i]}: ${+formattedBalance * price}`); return +formattedBalance * price; }).reduce((a, b) => a + b, 0); console.log(insuranceFundValue); - return insuranceFundValue; + api.add(insuranceTokens.DAI,insuranceFundValue); } module.exports = { - getInsuranceFundValue + getInsuranceFundValue, + insuranceTokens } - -getInsuranceFundValue() \ No newline at end of file From a1cac0dfc005e52dbd4c22605ca67af947dd4c9f Mon Sep 17 00:00:00 2001 From: 0xngmi <80541789+0xngmi@users.noreply.github.com> Date: Thu, 14 Sep 2023 15:32:53 +0100 Subject: [PATCH 1234/1974] Update imbtc.js --- projects/imbtc.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/imbtc.js b/projects/imbtc.js index 49d05f474a4..e83d4b92af2 100644 --- a/projects/imbtc.js +++ b/projects/imbtc.js @@ -9,5 +9,5 @@ async function tvl(ts, block) { module.exports = { ethereum: { tvl }, - methodology: `TVL for WBTC consists of the BTC deposits in custody that were used to mint WBTC` + methodology: `TVL for imBTC consists of the BTC deposits in custody that were used to mint imBTC` } From 2cfe5005acf91a7ad23036c0b3b41f8ad98f9376 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Thu, 14 Sep 2023 15:48:15 +0100 Subject: [PATCH 1235/1974] fix starknet --- projects/helper/chain/starknet.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/helper/chain/starknet.js b/projects/helper/chain/starknet.js index ae372bc2a11..34008f6ac45 100644 --- a/projects/helper/chain/starknet.js +++ b/projects/helper/chain/starknet.js @@ -19,6 +19,7 @@ function formCallBody({ abi, target, params = [], allAbi = [] }, id = 0) { const requestData = contract.populate(abi.name, params) requestData.entry_point_selector = hash.getSelectorFromName(requestData.entrypoint) requestData.contract_address = requestData.contractAddress + delete requestData.contractAddress delete requestData.entrypoint if (abi.customInput === 'address') requestData.calldata = params.map(i => i.slice(2)) return getCallBody(requestData, id) From b7bcd2c476e3124f9854b08485e94f7057f33fec Mon Sep 17 00:00:00 2001 From: veljkoTNFT Date: Fri, 15 Sep 2023 00:40:56 +0200 Subject: [PATCH 1236/1974] Liquidity calc improvement --- projects/tangible/abi/VeChrNFT.json | 1525 +++++++++++ projects/tangible/abi/VeVeloNFT.json | 2296 +++++++++++++++++ projects/tangible/index.js | 111 +- projects/tangible/insurance-fund-arbitrum.js | 44 + projects/tangible/insurance-fund-base.js | 60 + projects/tangible/insurance-fund-optimism.js | 60 + ...ance-fund.js => insurance-fund-polygon.js} | 30 +- 7 files changed, 4061 insertions(+), 65 deletions(-) create mode 100644 projects/tangible/abi/VeChrNFT.json create mode 100644 projects/tangible/abi/VeVeloNFT.json create mode 100644 projects/tangible/insurance-fund-arbitrum.js create mode 100644 projects/tangible/insurance-fund-base.js create mode 100644 projects/tangible/insurance-fund-optimism.js rename projects/tangible/{insurance-fund.js => insurance-fund-polygon.js} (94%) diff --git a/projects/tangible/abi/VeChrNFT.json b/projects/tangible/abi/VeChrNFT.json new file mode 100644 index 00000000000..65437f55992 --- /dev/null +++ b/projects/tangible/abi/VeChrNFT.json @@ -0,0 +1,1525 @@ +[ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "approved", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "ApprovalForAll", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "provider", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "locktime", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "enum VotingEscrow.DepositType", + "name": "deposit_type", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "ts", + "type": "uint256" + } + ], + "name": "Deposit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "prevSupply", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "supply", + "type": "uint256" + } + ], + "name": "Supply", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "provider", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "ts", + "type": "uint256" + } + ], + "name": "Withdraw", + "type": "event" + }, + { + "inputs": [], + "name": "PRECISSION", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_tokenId", + "type": "uint256" + } + ], + "name": "abstain", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "airdropContract", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "airdropProtocol", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_approved", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_tokenId", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "artProxy", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_tokenId", + "type": "uint256" + } + ], + "name": "attach", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "attachments", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_owner", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_block", + "type": "uint256" + } + ], + "name": "balanceOfAtNFT", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_tokenId", + "type": "uint256" + } + ], + "name": "balanceOfNFT", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_t", + "type": "uint256" + } + ], + "name": "balanceOfNFTAt", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "block_number", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "boostAirdropAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "checkpoint", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "name": "checkpoints", + "outputs": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_value", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_lock_duration", + "type": "uint256" + } + ], + "name": "create_lock", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_value", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_lock_duration", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_to", + "type": "address" + } + ], + "name": "create_lock_for", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_value", + "type": "uint256" + } + ], + "name": "deposit_for", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_tokenId", + "type": "uint256" + } + ], + "name": "detach", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "epoch", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_tokenId", + "type": "uint256" + } + ], + "name": "getApproved", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_tokenId", + "type": "uint256" + } + ], + "name": "get_last_user_slope", + "outputs": [ + { + "internalType": "int128", + "name": "", + "type": "int128" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_value", + "type": "uint256" + } + ], + "name": "increase_amount", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_lock_duration", + "type": "uint256" + } + ], + "name": "increase_unlock_time", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token_addr", + "type": "address" + }, + { + "internalType": "address", + "name": "art_proxy", + "type": "address" + }, + { + "internalType": "address", + "name": "_boostAirdropAddress", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_owner", + "type": "address" + }, + { + "internalType": "address", + "name": "_operator", + "type": "address" + } + ], + "name": "isApprovedForAll", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_tokenId", + "type": "uint256" + } + ], + "name": "isApprovedOrOwner", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "locked", + "outputs": [ + { + "internalType": "int128", + "name": "amount", + "type": "int128" + }, + { + "internalType": "uint256", + "name": "end", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_tokenId", + "type": "uint256" + } + ], + "name": "locked__end", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_from", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_to", + "type": "uint256" + } + ], + "name": "merge", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "ms", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "nonces", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "numCheckpoints", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_tokenId", + "type": "uint256" + } + ], + "name": "ownerOf", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "ownership_change", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "point_history", + "outputs": [ + { + "internalType": "int128", + "name": "bias", + "type": "int128" + }, + { + "internalType": "int128", + "name": "slope", + "type": "int128" + }, + { + "internalType": "uint256", + "name": "ts", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "blk", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "reset", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_from", + "type": "address" + }, + { + "internalType": "address", + "name": "_to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_tokenId", + "type": "uint256" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_from", + "type": "address" + }, + { + "internalType": "address", + "name": "_to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_tokenId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_airdropContract", + "type": "address" + } + ], + "name": "setAirdropContract", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_operator", + "type": "address" + }, + { + "internalType": "bool", + "name": "_approved", + "type": "bool" + } + ], + "name": "setApprovalForAll", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_proxy", + "type": "address" + } + ], + "name": "setArtProxy", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_boostAirdropAddress", + "type": "address" + } + ], + "name": "setBoostAirdropAddress", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_minBonusTime", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_bonusPercent", + "type": "uint256" + } + ], + "name": "setBoostParams", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_tokenId", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "_airdrop", + "type": "bool" + } + ], + "name": "setProtocolAirdrop", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_team", + "type": "address" + } + ], + "name": "setTeam", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_voter", + "type": "address" + } + ], + "name": "setVoter", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bool", + "name": "_status", + "type": "bool" + } + ], + "name": "setlimitProtocol", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "slope_changes", + "outputs": [ + { + "internalType": "int128", + "name": "", + "type": "int128" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256[]", + "name": "amounts", + "type": "uint256[]" + }, + { + "internalType": "uint256", + "name": "_tokenId", + "type": "uint256" + } + ], + "name": "split", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "supply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_interfaceID", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "team", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "token", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_tokenIndex", + "type": "uint256" + } + ], + "name": "tokenOfOwnerByIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_tokenId", + "type": "uint256" + } + ], + "name": "tokenURI", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_usr", + "type": "address" + } + ], + "name": "tokensOfOwner", + "outputs": [ + { + "internalType": "uint256[]", + "name": "", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_block", + "type": "uint256" + } + ], + "name": "totalSupplyAt", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "t", + "type": "uint256" + } + ], + "name": "totalSupplyAtT", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalTokens", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalTokensBurned", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalTokensMinted", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_from", + "type": "address" + }, + { + "internalType": "address", + "name": "_to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_tokenId", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "user_point_epoch", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "user_point_history", + "outputs": [ + { + "internalType": "int128", + "name": "bias", + "type": "int128" + }, + { + "internalType": "int128", + "name": "slope", + "type": "int128" + }, + { + "internalType": "uint256", + "name": "ts", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "blk", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_idx", + "type": "uint256" + } + ], + "name": "user_point_history__ts", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "version", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "voted", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "voter", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_tokenId", + "type": "uint256" + } + ], + "name": "voting", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_tokenId", + "type": "uint256" + } + ], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } +] \ No newline at end of file diff --git a/projects/tangible/abi/VeVeloNFT.json b/projects/tangible/abi/VeVeloNFT.json new file mode 100644 index 00000000000..cbe1163138f --- /dev/null +++ b/projects/tangible/abi/VeVeloNFT.json @@ -0,0 +1,2296 @@ +[ + { + "inputs": [ + { + "internalType": "address", + "name": "_forwarder", + "type": "address" + }, + { + "internalType": "address", + "name": "_token", + "type": "address" + }, + { + "internalType": "address", + "name": "_factoryRegistry", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "AlreadyVoted", + "type": "error" + }, + { + "inputs": [], + "name": "AmountTooBig", + "type": "error" + }, + { + "inputs": [], + "name": "ERC721ReceiverRejectedTokens", + "type": "error" + }, + { + "inputs": [], + "name": "ERC721TransferToNonERC721ReceiverImplementer", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidManagedNFTId", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidNonce", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidSignature", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidSignatureS", + "type": "error" + }, + { + "inputs": [], + "name": "LockDurationNotInFuture", + "type": "error" + }, + { + "inputs": [], + "name": "LockDurationTooLong", + "type": "error" + }, + { + "inputs": [], + "name": "LockExpired", + "type": "error" + }, + { + "inputs": [], + "name": "LockNotExpired", + "type": "error" + }, + { + "inputs": [], + "name": "NoLockFound", + "type": "error" + }, + { + "inputs": [], + "name": "NonExistentToken", + "type": "error" + }, + { + "inputs": [], + "name": "NotApprovedOrOwner", + "type": "error" + }, + { + "inputs": [], + "name": "NotDistributor", + "type": "error" + }, + { + "inputs": [], + "name": "NotEmergencyCouncilOrGovernor", + "type": "error" + }, + { + "inputs": [], + "name": "NotGovernor", + "type": "error" + }, + { + "inputs": [], + "name": "NotGovernorOrManager", + "type": "error" + }, + { + "inputs": [], + "name": "NotLockedNFT", + "type": "error" + }, + { + "inputs": [], + "name": "NotManagedNFT", + "type": "error" + }, + { + "inputs": [], + "name": "NotManagedOrNormalNFT", + "type": "error" + }, + { + "inputs": [], + "name": "NotNormalNFT", + "type": "error" + }, + { + "inputs": [], + "name": "NotOwner", + "type": "error" + }, + { + "inputs": [], + "name": "NotPermanentLock", + "type": "error" + }, + { + "inputs": [], + "name": "NotTeam", + "type": "error" + }, + { + "inputs": [], + "name": "NotVoter", + "type": "error" + }, + { + "inputs": [], + "name": "OwnershipChange", + "type": "error" + }, + { + "inputs": [], + "name": "PermanentLock", + "type": "error" + }, + { + "inputs": [], + "name": "SameAddress", + "type": "error" + }, + { + "inputs": [], + "name": "SameNFT", + "type": "error" + }, + { + "inputs": [], + "name": "SameState", + "type": "error" + }, + { + "inputs": [], + "name": "SignatureExpired", + "type": "error" + }, + { + "inputs": [], + "name": "SplitNoOwner", + "type": "error" + }, + { + "inputs": [], + "name": "SplitNotAllowed", + "type": "error" + }, + { + "inputs": [], + "name": "TooManyTokenIDs", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroAddress", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroAmount", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroBalance", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "approved", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "ApprovalForAll", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "_fromTokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_toTokenId", + "type": "uint256" + } + ], + "name": "BatchMetadataUpdate", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_to", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "_mTokenId", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "_from", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "_lockedManagedReward", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "_freeManagedReward", + "type": "address" + } + ], + "name": "CreateManaged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "delegator", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "fromDelegate", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "toDelegate", + "type": "uint256" + } + ], + "name": "DelegateChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "delegate", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "previousBalance", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newBalance", + "type": "uint256" + } + ], + "name": "DelegateVotesChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "provider", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "enum IVotingEscrow.DepositType", + "name": "depositType", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "locktime", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "ts", + "type": "uint256" + } + ], + "name": "Deposit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "_tokenId", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "_mTokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_weight", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_ts", + "type": "uint256" + } + ], + "name": "DepositManaged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "_tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_ts", + "type": "uint256" + } + ], + "name": "LockPermanent", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_sender", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "_from", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "_to", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_amountFrom", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_amountTo", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_amountFinal", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_locktime", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_ts", + "type": "uint256" + } + ], + "name": "Merge", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "_tokenId", + "type": "uint256" + } + ], + "name": "MetadataUpdate", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_allowedManager", + "type": "address" + } + ], + "name": "SetAllowedManager", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "_from", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "_tokenId1", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "_tokenId2", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "_sender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_splitAmount1", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_splitAmount2", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_locktime", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_ts", + "type": "uint256" + } + ], + "name": "Split", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "prevSupply", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "supply", + "type": "uint256" + } + ], + "name": "Supply", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "_tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_ts", + "type": "uint256" + } + ], + "name": "UnlockPermanent", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "provider", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "ts", + "type": "uint256" + } + ], + "name": "Withdraw", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "_tokenId", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "_mTokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_weight", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_ts", + "type": "uint256" + } + ], + "name": "WithdrawManaged", + "type": "event" + }, + { + "inputs": [], + "name": "CLOCK_MODE", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "DELEGATION_TYPEHASH", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "DOMAIN_TYPEHASH", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "allowedManager", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_approved", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_tokenId", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "artProxy", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_owner", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_tokenId", + "type": "uint256" + } + ], + "name": "balanceOfNFT", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_t", + "type": "uint256" + } + ], + "name": "balanceOfNFTAt", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "canSplit", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "checkpoint", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_tokenId", + "type": "uint256" + }, + { + "internalType": "uint48", + "name": "_index", + "type": "uint48" + } + ], + "name": "checkpoints", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "fromTimestamp", + "type": "uint256" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "delegatedBalance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "delegatee", + "type": "uint256" + } + ], + "internalType": "struct IVotingEscrow.Checkpoint", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "clock", + "outputs": [ + { + "internalType": "uint48", + "name": "", + "type": "uint48" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_value", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_lockDuration", + "type": "uint256" + } + ], + "name": "createLock", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_value", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_lockDuration", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_to", + "type": "address" + } + ], + "name": "createLockFor", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_to", + "type": "address" + } + ], + "name": "createManagedLockFor", + "outputs": [ + { + "internalType": "uint256", + "name": "_mTokenId", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "deactivated", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "delegator", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "delegatee", + "type": "uint256" + } + ], + "name": "delegate", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "delegator", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "delegatee", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expiry", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "name": "delegateBySig", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "delegator", + "type": "uint256" + } + ], + "name": "delegates", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_value", + "type": "uint256" + } + ], + "name": "depositFor", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_mTokenId", + "type": "uint256" + } + ], + "name": "depositManaged", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "distributor", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "epoch", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "escrowType", + "outputs": [ + { + "internalType": "enum IVotingEscrow.EscrowType", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "factoryRegistry", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "forwarder", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_tokenId", + "type": "uint256" + } + ], + "name": "getApproved", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_timestamp", + "type": "uint256" + } + ], + "name": "getPastTotalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_timestamp", + "type": "uint256" + } + ], + "name": "getPastVotes", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "idToManaged", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_value", + "type": "uint256" + } + ], + "name": "increaseAmount", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_lockDuration", + "type": "uint256" + } + ], + "name": "increaseUnlockTime", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_owner", + "type": "address" + }, + { + "internalType": "address", + "name": "_operator", + "type": "address" + } + ], + "name": "isApprovedForAll", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_tokenId", + "type": "uint256" + } + ], + "name": "isApprovedOrOwner", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "forwarder", + "type": "address" + } + ], + "name": "isTrustedForwarder", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_tokenId", + "type": "uint256" + } + ], + "name": "lockPermanent", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_tokenId", + "type": "uint256" + } + ], + "name": "locked", + "outputs": [ + { + "components": [ + { + "internalType": "int128", + "name": "amount", + "type": "int128" + }, + { + "internalType": "uint256", + "name": "end", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "isPermanent", + "type": "bool" + } + ], + "internalType": "struct IVotingEscrow.LockedBalance", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "managedToFree", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "managedToLocked", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_from", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_to", + "type": "uint256" + } + ], + "name": "merge", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "nonces", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "numCheckpoints", + "outputs": [ + { + "internalType": "uint48", + "name": "", + "type": "uint48" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_tokenId", + "type": "uint256" + } + ], + "name": "ownerOf", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "ownerToNFTokenIdList", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "permanentLockBalance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_loc", + "type": "uint256" + } + ], + "name": "pointHistory", + "outputs": [ + { + "components": [ + { + "internalType": "int128", + "name": "bias", + "type": "int128" + }, + { + "internalType": "int128", + "name": "slope", + "type": "int128" + }, + { + "internalType": "uint256", + "name": "ts", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "blk", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "permanentLockBalance", + "type": "uint256" + } + ], + "internalType": "struct IVotingEscrow.GlobalPoint", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_from", + "type": "address" + }, + { + "internalType": "address", + "name": "_to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_tokenId", + "type": "uint256" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_from", + "type": "address" + }, + { + "internalType": "address", + "name": "_to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_tokenId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_allowedManager", + "type": "address" + } + ], + "name": "setAllowedManager", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_operator", + "type": "address" + }, + { + "internalType": "bool", + "name": "_approved", + "type": "bool" + } + ], + "name": "setApprovalForAll", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_proxy", + "type": "address" + } + ], + "name": "setArtProxy", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_mTokenId", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "_state", + "type": "bool" + } + ], + "name": "setManagedState", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_team", + "type": "address" + } + ], + "name": "setTeam", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_voter", + "type": "address" + }, + { + "internalType": "address", + "name": "_distributor", + "type": "address" + } + ], + "name": "setVoterAndDistributor", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "slopeChanges", + "outputs": [ + { + "internalType": "int128", + "name": "", + "type": "int128" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_from", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "split", + "outputs": [ + { + "internalType": "uint256", + "name": "_tokenId1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_tokenId2", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "supply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_interfaceID", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "team", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_account", + "type": "address" + }, + { + "internalType": "bool", + "name": "_bool", + "type": "bool" + } + ], + "name": "toggleSplit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "token", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "tokenId", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_tokenId", + "type": "uint256" + } + ], + "name": "tokenURI", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_timestamp", + "type": "uint256" + } + ], + "name": "totalSupplyAt", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_from", + "type": "address" + }, + { + "internalType": "address", + "name": "_to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_tokenId", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_tokenId", + "type": "uint256" + } + ], + "name": "unlockPermanent", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "userPointEpoch", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_loc", + "type": "uint256" + } + ], + "name": "userPointHistory", + "outputs": [ + { + "components": [ + { + "internalType": "int128", + "name": "bias", + "type": "int128" + }, + { + "internalType": "int128", + "name": "slope", + "type": "int128" + }, + { + "internalType": "uint256", + "name": "ts", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "blk", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "permanent", + "type": "uint256" + } + ], + "internalType": "struct IVotingEscrow.UserPoint", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "version", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "voted", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "voter", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_tokenId", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "_voted", + "type": "bool" + } + ], + "name": "voting", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "weights", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_tokenId", + "type": "uint256" + } + ], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_tokenId", + "type": "uint256" + } + ], + "name": "withdrawManaged", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } +] \ No newline at end of file diff --git a/projects/tangible/index.js b/projects/tangible/index.js index b7a0e644ade..e3b20deeb16 100644 --- a/projects/tangible/index.js +++ b/projects/tangible/index.js @@ -1,12 +1,17 @@ const ADDRESSES = require('../helper/coreAssets.json') const { sumTokensExport } = require('../helper/unwrapLPs') const { getConfig } = require('../helper/cache') -const { getInsuranceFundValue, insuranceTokens } = require("./insurance-fund"); +const { getInsuranceFundValue, insuranceTokens } = require("./insurance-fund-polygon"); +const { getInsuranceFundValueOp } = require("./insurance-fund-optimism"); +const { getInsuranceFundValueBase } = require("./insurance-fund-base"); +const { getInsuranceFundValueArb } = require("./insurance-fund-arbitrum"); // doc: https://docs.tangible.store/real-usd/real-usd-v3-contracts-and-addresses const TNGBL = '0x49e6A20f1BBdfEeC2a8222E052000BbB14EE6007'.toLowerCase() const USDR = '0x40379a439d4f6795b6fc9aa5687db461677a2dba'.toLowerCase() const PEARL = '0x7238390d5f6F64e67c3211C343A410E2A3DEc142'.toLowerCase() +const CVX_ETH = '0x4e3fbd56cd56c3e72c1403e103b45db9da5b9d2b'.toLowerCase() +const AERO = '0x940181a94a35a4569e4529a3cdfb74e38fd98631'.toLowerCase() const { apGetAddress, getPriceManager, getCategories, getTotalSupply, getTokenByIndex, getTnftCustody, @@ -19,7 +24,7 @@ const CAVIAR_STRATEGY = "0x4626E247390c82FA3b72A913d3d8fe079FFb84Ff"; const insuranceConfig = { ethereum: { owner: '0x5d35A37E5842F6b3072893A3f7Bf0e1d1FF80179', - tokens: [ADDRESSES.null], + tokens: [ADDRESSES.null, CVX_ETH], }, polygon: { owner: '0xD1758fbABAE91c805BE76D56548A584EF68B81f0', @@ -27,12 +32,20 @@ const insuranceConfig = { }, polygon1: { owner: '0x632572cfAa39330c8F0211b5B33BC86135E48b5f', - tokens: [ADDRESSES.polygon.DAI, ADDRESSES.polygon.USDC, ADDRESSES.polygon.USDT, ADDRESSES.null, ADDRESSES.polygon.WETH, ADDRESSES.polygon.WMATIC, PEARL, TNGBL], + tokens: [...Object.values(insuranceTokens), ADDRESSES.null], }, optimism: { owner: '0x7f922242d919feF0da0e40e3Cb4B7f7D3c97a63e', - tokens: [ADDRESSES.null, ADDRESSES.optimism.OP, ADDRESSES.optimism.USDC,], + tokens: [ADDRESSES.null, ADDRESSES.optimism.OP, ADDRESSES.optimism.USDC], }, + base: { + owner: "0x17ee1f11aa0654bd4ab1af4b6b309c7f137c925e", + tokens: [ADDRESSES.null,], + }, + arbitrum: { + owner: "0xe19848f158efd31d45a6975320365251c92040c1", + tokens: [ADDRESSES.null, ADDRESSES.arbitrum.USDT], + } } async function tvl(_, _b, _cb, { api }) { @@ -41,8 +54,25 @@ async function tvl(_, _b, _cb, { api }) { insuranceTvl, rwaTVL, tangiblePOL, - tangibleCaviar, - getInsuranceFundValue + tangibleCaviar + ].map(fn => fn(api))) +} + +async function tvlOp(_, _b, _cb, { api }) { + await Promise.all([ + insuranceTvlOp, + ].map(fn => fn(api))) +} + +async function tvlBase(_, _b, _cb, { api }) { + await Promise.all([ + insuranceTvlBase, + ].map(fn => fn(api))) +} + +async function tvlArb(_, _b, _cb, { api }) { + await Promise.all([ + insuranceTvlArb, ].map(fn => fn(api))) } @@ -57,9 +87,26 @@ async function treasuryTvl(api) { } async function insuranceTvl(api) { - await unwrapBalancerToken(api) - await api.sumTokens(insuranceConfig.polygon) - return api.sumTokens(insuranceConfig.polygon1) + await unwrapBalancerToken(api, insuranceConfig.polygon.owner); + await unwrapBalancerToken(api, insuranceConfig.polygon1.owner); + await getInsuranceFundValue(api, insuranceConfig.polygon.owner); + await getInsuranceFundValue(api, insuranceConfig.polygon1.owner); + +} + +async function insuranceTvlOp(api) { + await getInsuranceFundValueOp(api, insuranceConfig.optimism.owner); + await api.sumTokens({ owner: insuranceConfig.optimism.owner, tokens: insuranceConfig.optimism.tokens }) +} + +async function insuranceTvlBase(api) { + await getInsuranceFundValueBase(api, insuranceConfig.base.owner); + await api.sumTokens({ owner: insuranceConfig.base.owner, tokens: insuranceConfig.base.tokens }) +} + +async function insuranceTvlArb(api) { + await getInsuranceFundValueArb(api, insuranceConfig.arbitrum.owner); + await api.sumTokens({ owner: insuranceConfig.arbitrum.owner, tokens: insuranceConfig.arbitrum.tokens }) } async function rwaTVL(api) { @@ -160,54 +207,16 @@ async function tangiblePOL(api) { }) } -async function tangiblePOL(api) { - - //pearl pair api address - const pearlPairApi = await api.call({ - abi: apGetAddress, - target: ADDRESS_PROVIDER_ADDRESS, - params: ["0xd1e0c1a56a62f2e6553b45bde148c89c51a01f766c23f4bb2c612bd2c822f711"],//keccak of paerl api address - }) - - const { data } = await getConfig('tangible', "https://api.pearl.exchange/api/v15/pools"); - const pools = data.filter( - (pool) => - (["DAI", "USDC", "USDT"].includes(pool.token0.symbol) && - pool.token1.symbol === "USDR") || - (["DAI", "USDC", "USDT"].includes(pool.token1.symbol) && - pool.token0.symbol === "USDR"), - ).map(i => i.address) - - const multisigAddress = "0x100fCC635acf0c22dCdceF49DD93cA94E55F0c71" - const [lpBals, tokens0, tokens1, totalSupplies, reserves] = await Promise.all([ - api.multiCall({ abi: getPair, target: pearlPairApi, calls: pools.map(p => ({ params: [p, multisigAddress]})) }), - api.multiCall({ abi: 'address:token0', calls: pools }), - api.multiCall({ abi: 'address:token1', calls: pools }), - api.multiCall({ abi: 'uint256:totalSupply', calls: pools }), - api.multiCall({ abi: "function getReserves() view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast)", calls: pools }), - ]) - - const blacklist = [USDR, TNGBL] - lpBals.forEach((lpBal, i) => { - const ratio = lpBal.account_gauge_balance / totalSupplies[i] - if (!blacklist.includes(tokens0[i].toLowerCase())) - api.add(tokens0[i], reserves[i]._reserve0 * ratio) - - if (!blacklist.includes(tokens1[i].toLowerCase())) - api.add(tokens1[i], reserves[i]._reserve1 * ratio) - - }) -} - module.exports = { misrepresentedTokens: true, polygon: { tvl, }, ethereum: { tvl: sumTokensExport(insuranceConfig.ethereum) }, - optimism: { tvl: sumTokensExport(insuranceConfig.optimism) }, + optimism: { tvl: tvlOp }, + base: { tvl: tvlBase }, + arbitrum: { tvl: tvlArb }, } -async function unwrapBalancerToken(api) { - const owner = insuranceConfig.polygon.owner +async function unwrapBalancerToken(api, owner) { const gauge = '0x07222e30b751c1ab4a730745afe19810cfd762c0' const balancerToken = '0x9f9f548354b7c66dc9a9f3373077d86aaaccf8f2' const [lpSupply, lpTokens] = await api.batchCall([ diff --git a/projects/tangible/insurance-fund-arbitrum.js b/projects/tangible/insurance-fund-arbitrum.js new file mode 100644 index 00000000000..c8d8089c63e --- /dev/null +++ b/projects/tangible/insurance-fund-arbitrum.js @@ -0,0 +1,44 @@ +const ethers = require('ethers'); + +const VE_CHR_ABI = require('./abi/VeChrNFT.json'); +const MULTICALL_ABI = require('./abi/Multicall3.json'); + +const provider = new ethers.providers.JsonRpcProvider('https://arb1.arbitrum.io/rpc'); +const multicall = new ethers.Contract('0xcA11bde05977b3631167028862bE2a173976CA11', MULTICALL_ABI, provider); + +const insuranceTokensArb = { + CHR: '0x15b2fb8f08e4ac1ce019eadae02ee92aedf06851', +} + +const VE_CHR_NFT = "0x9A01857f33aa382b1d5bb96C3180347862432B0d"; + +async function getInsuranceFundValueArb(api, INSURANCE_FUND) { + const veChrContract = new ethers.Contract(VE_CHR_NFT, VE_CHR_ABI, provider); + const veChr = new ethers.utils.Interface(VE_CHR_ABI); + const tokenIds = await veChrContract.tokensOfOwner(INSURANCE_FUND) + + + let calls = []; + + for (let i = 0; i < tokenIds.length; i++) { + calls.push({ + target: VE_CHR_NFT, + callData: veChr.encodeFunctionData('locked', [tokenIds[i]]) + }) + } + + const { returnData: aeroAmounts } = await multicall.callStatic.aggregate(calls); + + let tokenAmountTotal = ethers.BigNumber.from(0); + for (let i = 0; i < aeroAmounts.length; i++) { + const [locked] = veChr.decodeFunctionResult('locked', aeroAmounts[i]); + tokenAmountTotal = tokenAmountTotal.add(locked); + } + + api.add(insuranceTokensArb.CHR, tokenAmountTotal.toString()) +} + +module.exports = { + getInsuranceFundValueArb, + insuranceTokensArb +} diff --git a/projects/tangible/insurance-fund-base.js b/projects/tangible/insurance-fund-base.js new file mode 100644 index 00000000000..86841faa599 --- /dev/null +++ b/projects/tangible/insurance-fund-base.js @@ -0,0 +1,60 @@ +const ethers = require('ethers'); + +const VE_AERO_ABI = require('./abi/VeVeloNFT.json'); +const MULTICALL_ABI = require('./abi/Multicall3.json'); + +const provider = new ethers.providers.JsonRpcProvider('https://developer-access-mainnet.base.org'); +const multicall = new ethers.Contract('0xcA11bde05977b3631167028862bE2a173976CA11', MULTICALL_ABI, provider); + +const insuranceTokensBase = { + AERO: '0x940181a94A35A4569E4529A3CDfB74e38FD98631', +} + +const VE_AERO_NFT = "0xeBf418Fe2512e7E6bd9b87a8F0f294aCDC67e6B4"; + +async function getInsuranceFundValueBase(api, INSURANCE_FUND) { + const veAeroContract = new ethers.Contract(VE_AERO_NFT, VE_AERO_ABI, provider); + const totalTokenAmount = await veAeroContract.balanceOf(INSURANCE_FUND) + const veAero = new ethers.utils.Interface(VE_AERO_ABI); + + let calls = []; + + for (let i = 0; i < totalTokenAmount; i++) { + calls.push({ + target: VE_AERO_NFT, + callData: veAero.encodeFunctionData('ownerToNFTokenIdList', [INSURANCE_FUND, i]) + }) + } + + const { returnData: veNftTokens } = await multicall.callStatic.aggregate(calls); + + const tokenIds = [] + for (let i = 0; i < veNftTokens.length; i++) { + const [tokenId] = veAero.decodeFunctionResult('ownerToNFTokenIdList', veNftTokens[i]); + tokenIds.push(tokenId); + } + + calls = []; + + for (let i = 0; i < tokenIds.length; i++) { + calls.push({ + target: VE_AERO_NFT, + callData: veAero.encodeFunctionData('locked', [tokenIds[i]]) + }) + } + + const { returnData: aeroAmounts } = await multicall.callStatic.aggregate(calls); + + let tokenAmountTotal = ethers.BigNumber.from(0); + for (let i = 0; i < aeroAmounts.length; i++) { + const [locked] = veAero.decodeFunctionResult('locked', aeroAmounts[i]); + tokenAmountTotal = tokenAmountTotal.add(locked.amount); + } + + api.add(insuranceTokensBase.AERO, tokenAmountTotal.toString()) +} + +module.exports = { + getInsuranceFundValueBase, + insuranceTokensBase +} diff --git a/projects/tangible/insurance-fund-optimism.js b/projects/tangible/insurance-fund-optimism.js new file mode 100644 index 00000000000..d3e9a050999 --- /dev/null +++ b/projects/tangible/insurance-fund-optimism.js @@ -0,0 +1,60 @@ +const ethers = require('ethers'); + +const VE_VELO_ABI = require('./abi/VeVeloNFT.json'); +const MULTICALL_ABI = require('./abi/Multicall3.json'); + +const provider = new ethers.providers.JsonRpcProvider('https://mainnet.optimism.io'); +const multicall = new ethers.Contract('0xcA11bde05977b3631167028862bE2a173976CA11', MULTICALL_ABI, provider); + +const insuranceTokensOp = { + VELO: '0x9560e827af36c94d2ac33a39bce1fe78631088db', +} + +const VE_VELO_NFT = "0xFAf8FD17D9840595845582fCB047DF13f006787d"; + +async function getInsuranceFundValueOp(api, INSURANCE_FUND) { + const veVeloContract = new ethers.Contract(VE_VELO_NFT, VE_VELO_ABI, provider); + const totalTokenAmount = await veVeloContract.balanceOf(INSURANCE_FUND) + const veVelo = new ethers.utils.Interface(VE_VELO_ABI); + + let calls = []; + + for (let i = 0; i < totalTokenAmount; i++) { + calls.push({ + target: VE_VELO_NFT, + callData: veVelo.encodeFunctionData('ownerToNFTokenIdList', [INSURANCE_FUND, i]) + }) + } + + const { returnData: veNftTokens } = await multicall.callStatic.aggregate(calls); + + const tokenIds = [] + for (let i = 0; i < veNftTokens.length; i++) { + const [tokenId] = veVelo.decodeFunctionResult('ownerToNFTokenIdList', veNftTokens[i]); + tokenIds.push(tokenId); + } + + calls = []; + + for (let i = 0; i < tokenIds.length; i++) { + calls.push({ + target: VE_VELO_NFT, + callData: veVelo.encodeFunctionData('locked', [tokenIds[i]]) + }) + } + + const { returnData: veloAmounts } = await multicall.callStatic.aggregate(calls); + + let tokenAmountTotal = ethers.BigNumber.from(0); + for (let i = 0; i < veloAmounts.length; i++) { + const [locked] = veVelo.decodeFunctionResult('locked', veloAmounts[i]); + tokenAmountTotal = tokenAmountTotal.add(locked.amount); + } + + api.add(insuranceTokensOp.VELO, tokenAmountTotal.toString()) +} + +module.exports = { + getInsuranceFundValueOp, + insuranceTokensOp +} diff --git a/projects/tangible/insurance-fund.js b/projects/tangible/insurance-fund-polygon.js similarity index 94% rename from projects/tangible/insurance-fund.js rename to projects/tangible/insurance-fund-polygon.js index 93c43e94efc..e094ffef180 100644 --- a/projects/tangible/insurance-fund.js +++ b/projects/tangible/insurance-fund-polygon.js @@ -1,8 +1,7 @@ const ethers = require('ethers'); const { default: axios } = require('axios'); - -const INSURANCE_FUND = '0xD1758fbABAE91c805BE76D56548A584EF68B81f0'; +const { unwrapUniswapV3NFTs } = require('../helper/unwrapLPs') const BALANCER_POOL_ABI = require('./abi/BalancerPool.json'); const CAVIAR_CHEF_ABI = require('./abi/CaviarChef.json'); @@ -51,13 +50,15 @@ const UTILITY_TOKENS = { VE_TETU: '0x6FB29DD17fa6E27BD112Bc3A2D0b8dae597AeDA4', } +const TNGBL_UNIV3_LIQUIDITY = "0xDC8a5c5975726235402cFac9B28268EEccd42813"; + const BALANCER_VAULT = '0xBA12222222228d8Ba445958a75a0704d566BF2C8'; const CAVIAR_STAKING_CHEF = '0x83C5022745B2511Bd199687a42D27BEFd025A9A9'; const CAVIAR_REBASE_CHEF = '0xf5374d452697d9A5fa2D97Ffd05155C853F6c1c6'; const PEARL_PAIR_FACTORY = '0xEaF188cdd22fEEBCb345DCb529Aa18CA9FcB4FBd'; const PEARL_VOTER = '0xa26C2A6BfeC5512c13Ae9EacF41Cb4319d30cCF0'; -async function getInsuranceFundValue(api) { +async function getInsuranceFundValue(api, INSURANCE_FUND) { const tokenAddresses = [...Object.values(insuranceTokens), ...Object.values(UTILITY_TOKENS)]; const tokenBalances = tokenAddresses.map(() => ethers.constants.Zero); @@ -276,18 +277,19 @@ async function getInsuranceFundValue(api) { prices[`polygon:${insuranceTokens.CAVIAR}`] = prices[`polygon:${insuranceTokens.PEARL}`]; } - const insuranceFundValue = tokenBalances.map((balance, i) => { - if (i >= Object.keys(insuranceTokens).length) return 0; - const priceIndex = `polygon:${tokenAddresses[i]}`; - const formattedBalance = ethers.utils.formatUnits(balance, prices[priceIndex].decimals); - const price = prices[priceIndex].price; - console.log(`${Object.keys(insuranceTokens)[i]}: ${+formattedBalance * price}`); - return +formattedBalance * price; - }).reduce((a, b) => a + b, 0); - - console.log(insuranceFundValue); + //uniswap lps + const uniBal = await unwrapUniswapV3NFTs({owner: INSURANCE_FUND, chain:"polygon"}); + if (Object.keys(uniBal).length != 0) { + const addresses = Object.keys(uniBal); + const values = Object.values(uniBal); + for(let i = 0; i < addresses.length; i++){ + api.add(addresses[i].slice("polygon:".length), values[i]); + } + } - api.add(insuranceTokens.DAI,insuranceFundValue); + for(let i = 0; i < Object.keys(insuranceTokens).length; i++){ + api.add(Object.values(insuranceTokens)[i],tokenBalances[i]); + } } module.exports = { From 73b66d5b27927fb72ec7656f40d0993439bba8d5 Mon Sep 17 00:00:00 2001 From: Pablo Veyrat <50438397+sogipec@users.noreply.github.com> Date: Fri, 15 Sep 2023 09:39:59 +0200 Subject: [PATCH 1237/1974] feat: add new chains for Merkl by Angle Labs (#7473) --- projects/merkl/index.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/projects/merkl/index.js b/projects/merkl/index.js index 31563736082..0b29666a751 100644 --- a/projects/merkl/index.js +++ b/projects/merkl/index.js @@ -13,7 +13,7 @@ async function tvl() { module.exports = { methodology: - "Merkl is a side product from Angle Labs used to better reward concentrated liquidity positions. It doesn't have any TVL. See the yield dashboard for a list of Merkl pools.", + "Merkl is a side product from Angle Labs used to reward concentrated liquidity positions. It doesn't have any TVL. See the yield dashboard for a list of Merkl pools.", ethereum: { tvl, }, @@ -26,4 +26,10 @@ module.exports = { arbitrum: { tvl, }, + base: { + tvl, + }, + polygon_zkevm: { + tvl, + }, }; From ef76abe3061c2f0bdd72fa406f75b0229857a44c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vuka=C5=A1in=20Manojlovi=C4=87?= Date: Fri, 15 Sep 2023 09:40:11 +0200 Subject: [PATCH 1238/1974] Add more collateral tokens for Raft (#7472) * Add more collateral tokens for Raft * code refactor --------- Co-authored-by: g1nt0ki --- projects/helper/coreAssets.json | 3 ++- projects/raft/index.js | 17 ++++++++++------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index d626fdcc736..5ac02e3f8e4 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -39,7 +39,8 @@ "LUSD": "0x5f98805A4E8be255a32880FDeC7F6728C6568bA0", "sUSD_OLD": "0x57ab1e02fee23774580c119740129eac7081e9d3", "sUSD": "0x57Ab1ec28D129707052df4dF418D58a2D46d5f51", - "SUSHI": "0x6b3595068778dd592e39a122f4f5a5cf09c90fe2" + "SUSHI": "0x6b3595068778dd592e39a122f4f5a5cf09c90fe2", + "cbETH": "0xBe9895146f7AF43049ca1c1AE358B0541Ea49704" }, "fantom": { "WFTM": "0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83", diff --git a/projects/raft/index.js b/projects/raft/index.js index 68b30b2c140..de8556d46a0 100644 --- a/projects/raft/index.js +++ b/projects/raft/index.js @@ -1,24 +1,27 @@ const ADDRESSES = require("../helper/coreAssets.json"); const RAFT_POSITION_MANAGER = "0x5f59b322eb3e16a0c78846195af1f588b77403fc"; +const INTEREST_RATE_POSITION_MANAGER_ADDRESS = '0x9AB6b21cDF116f611110b048987E58894786C244'; const RAFT_PSM = "0xa03342feb2e1d4690b60ef556509ec3b76c97ee7"; const WRAPPED_RETH = "0xb69e35fb4a157028b92f42655090b984609ae598"; const CHAI = "0x06af07097c9eeb7fd685c692751d5c66db49c215"; +const SWETH = '0xf951E335afb289353dc249e82926178EaC7DEd78' async function tvl(_, ethBlock, _1, { api }) { - const wstEthBalance = await api.call({ target: ADDRESSES.ethereum.WSTETH, params: RAFT_POSITION_MANAGER, abi: "erc20:balanceOf", }); - const rEthBalance = await api.call({ target: WRAPPED_RETH, abi: "erc20:balanceOf", params: RAFT_POSITION_MANAGER, }); + const rEthBalanceV1 = await api.call({ target: WRAPPED_RETH, abi: "erc20:balanceOf", params: RAFT_POSITION_MANAGER, }); const chaiBalance = await api.call({ target: CHAI, abi: "erc20:balanceOf", params: RAFT_PSM, }); const potAddress = await api.call({ target: CHAI, abi: "address:pot", }); const chaiRate = await api.call({ target: potAddress, abi: "uint256:chi", }); const daiBalance = chaiBalance * chaiRate / 1e27; - return { - [ADDRESSES.ethereum.WSTETH]: wstEthBalance, - [ADDRESSES.ethereum.RETH]: rEthBalance, - [ADDRESSES.ethereum.DAI]: daiBalance, - }; + api.add(ADDRESSES.ethereum.DAI, daiBalance) + api.add(ADDRESSES.ethereum.RETH, rEthBalanceV1) + + return api.sumTokens({ ownerTokens: [ + [[ADDRESSES.ethereum.RETH, ADDRESSES.ethereum.WETH, ADDRESSES.ethereum.WSTETH, ADDRESSES.ethereum.cbETH, SWETH], INTEREST_RATE_POSITION_MANAGER_ADDRESS], + [[ADDRESSES.ethereum.RETH, ADDRESSES.ethereum.WETH, ADDRESSES.ethereum.WSTETH, ], RAFT_POSITION_MANAGER], + ]}) } module.exports = { From 6e188ef1aa647ae3cdd496729858ba0af22acd53 Mon Sep 17 00:00:00 2001 From: Antoine <67124021+antoineborg@users.noreply.github.com> Date: Fri, 15 Sep 2023 09:40:26 +0200 Subject: [PATCH 1239/1974] Add GLMR Staking address (#7474) --- projects/swissborg/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/swissborg/index.js b/projects/swissborg/index.js index e58819ecf65..ef08a9119ee 100644 --- a/projects/swissborg/index.js +++ b/projects/swissborg/index.js @@ -90,6 +90,7 @@ const config = { moonbeam: { owners: [ '0x87cbc48075d7aa1760Ac71C41e8Bc289b6A31F56', + '0xFF4606bd3884554CDbDabd9B6e25E2faD4f6fc54', ] } } From 3c461d508309db575d669108dfb8bd2e2ee7081e Mon Sep 17 00:00:00 2001 From: shellvish <104537253+shellvish@users.noreply.github.com> Date: Fri, 15 Sep 2023 03:42:38 -0400 Subject: [PATCH 1240/1974] Fix Stride TVL (#7475) * fix stride tvl * Update index.js --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/stride/index.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/projects/stride/index.js b/projects/stride/index.js index 71b0eff2ca1..7405faa3905 100644 --- a/projects/stride/index.js +++ b/projects/stride/index.js @@ -32,18 +32,16 @@ async function tvl() { "https://stride-fleet.main.stridenet.co/api/Stride-Labs/stride/stakeibc/host_zone" ); - const { supply: assetBalances } = await get( - "https://stride-fleet.main.stridenet.co/api/cosmos/bank/v1beta1/supply" - ); - - hostZones.map((hostZone) => { - const assetBalance = assetBalances.find((asset) => { - return asset.denom === `st${hostZone.host_denom}`; - }); + const hostZonePromises = hostZones.map(async (hostZone) => { + const stDenom = "st".concat(hostZone.host_denom); + const { amount: assetBalances } = await get( + "https://stride-fleet.main.stridenet.co/api/cosmos/bank/v1beta1/supply/by_denom?denom=".concat(stDenom) + ); + const assetBalance = assetBalances['amount'] const coinDecimals = getCoinDenom(hostZone.host_denom); - const amount = assetBalance.amount / coinDecimals; + const amount = assetBalance / coinDecimals; const geckoId = coinGeckoIds[hostZone.host_denom]; @@ -58,6 +56,8 @@ async function tvl() { ); }); + await Promise.all(hostZonePromises); + return balances; } From e08d7801d9ad37284fc3bba6a29ba62a064f9115 Mon Sep 17 00:00:00 2001 From: backendultron <99990576+backendultron@users.noreply.github.com> Date: Fri, 15 Sep 2023 11:43:05 +0400 Subject: [PATCH 1241/1974] upd: UltronStakingHub (#7476) Co-authored-by: boncho --- projects/ultronStakingHub/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/ultronStakingHub/index.js b/projects/ultronStakingHub/index.js index 28d215e849f..d34f9b7950a 100644 --- a/projects/ultronStakingHub/index.js +++ b/projects/ultronStakingHub/index.js @@ -7,9 +7,9 @@ module.exports = { ultron: { tvl: () => ({}), staking: staking({ - owner: '0xd130811147bb87f313c555e5281b94b9e71b480a', + owner: '0x60768787077a8411d8f626ce35333fa3f02be602', tokens: [ADDRESSES.ultron.wULX], chain: 'ultron' }) } -}; \ No newline at end of file +}; From 0c9bcd3c71b4d0498e234465908467b359f8d630 Mon Sep 17 00:00:00 2001 From: Phil <30321052+philipjames44@users.noreply.github.com> Date: Fri, 15 Sep 2023 01:56:40 -0600 Subject: [PATCH 1242/1974] Sommelier: Dedupe vaults taking position in sister vaults from TVL (#7478) * Sommelier: Add RYBTC launch and remove Steady, Trend, & MOM vault launches * Sommelier: Add Turbo GHO vault * Update start block * Sommelier: Dedupe vaults taking position in ssister vaults from TVL --- projects/sommelier/cellar-constants.js | 60 ++++++++++++++++++++++++++ projects/sommelier/index.js | 54 +---------------------- projects/sommelier/v2.js | 50 ++++++++++++++++++++- 3 files changed, 110 insertions(+), 54 deletions(-) create mode 100644 projects/sommelier/cellar-constants.js diff --git a/projects/sommelier/cellar-constants.js b/projects/sommelier/cellar-constants.js new file mode 100644 index 00000000000..59c79358e11 --- /dev/null +++ b/projects/sommelier/cellar-constants.js @@ -0,0 +1,60 @@ +// v0.8.15 Cellars (Cellar 1.0) +const CELLAR_AAVE = "0x7bad5df5e11151dc5ee1a648800057c5c934c0d5"; +const cellarsV0815 = [{ id: CELLAR_AAVE, startBlock: 15057867 }]; + +// v0.8.16 Cellars (Cellar 1.5) +const ETH_BTC_TREND = "0x6b7f87279982d919bbf85182ddeab179b366d8f2"; +const ETH_BTC_MOM = "0x6e2dac3b9e9adc0cbbae2d0b9fd81952a8d33872"; +const STEADY_ETH = "0x3f07a84ecdf494310d397d24c1c78b041d2fa622"; +const STEADY_BTC = "0x4986fd36b6b16f49b43282ee2e24c5cf90ed166d"; +const STEADY_UNI = "0x6f069f711281618467dae7873541ecc082761b33"; +const STEADY_MATIC = "0x05641a27c82799aaf22b436f20a3110410f29652"; +const cellarsV0816 = [ + { id: ETH_BTC_TREND, startBlock: 15733768 }, + { id: ETH_BTC_MOM, startBlock: 15733768 }, + { id: STEADY_ETH, startBlock: 15991609 }, + { id: STEADY_BTC, startBlock: 15991609 }, + { id: STEADY_UNI, startBlock: 16192732 }, + { id: STEADY_MATIC, startBlock: 16192732 }, +]; + +// v2 Cellars +const DEFI_STARS = "0x03df2a53cbed19b824347d6a45d09016c2d1676a"; +const REAL_YIELD_USD = "0x97e6e0a40a3d02f12d1cec30ebfbae04e37c119e"; +const REAL_YIELD_ETH = "0xb5b29320d2dde5ba5bafa1ebcd270052070483ec"; +const REAL_YIELD_LINK = "0x4068bdd217a45f8f668ef19f1e3a1f043e4c4934"; +const REAL_YIELD_1INCH = "0xc7b69e15d86c5c1581dacce3cacaf5b68cd6596f"; +const REAL_YIELD_UNI = "0x6a6af5393dc23d7e3db28d28ef422db7c40932b6"; +const REAL_YIELD_SNX = "0xcbf2250f33c4161e18d4a2fa47464520af5216b5"; +const REAL_YIELD_ENS = "0x18ea937aba6053bc232d9ae2c42abe7a8a2be440"; +const REAL_YIELD_BTC = "0x0274a704a6d9129f90a62ddc6f6024b33ecdad36"; +const FRAXIMAL = "0xdbe19d1c3f21b1bb250ca7bdae0687a97b5f77e6"; + +const cellarsV2 = [ + { id: DEFI_STARS, startBlock: 17181497 }, + { id: REAL_YIELD_USD, startBlock: 16431804 }, + { id: REAL_YIELD_ETH, startBlock: 16986127 }, + { id: REAL_YIELD_LINK, startBlock: 17377190 }, + { id: REAL_YIELD_1INCH, startBlock: 17377190 }, + { id: REAL_YIELD_UNI, startBlock: 17377190 }, + { id: REAL_YIELD_SNX, startBlock: 17377190 }, + { id: REAL_YIELD_ENS, startBlock: 17377190 }, + { id: REAL_YIELD_BTC, startBlock: 17667535 }, + { id: FRAXIMAL, startBlock: 17589948 }, +]; + +// v2.5 Cellars +const TURBO_SWETH = "0xd33dad974b938744dac81fe00ac67cb5aa13958e"; +const TURBO_GHO = "0x0c190ded9be5f512bd72827bdad4003e9cc7975c"; + +const cellarsV2p5 = [ + { id: TURBO_SWETH, startBlock: 17910374 }, + { id: TURBO_GHO, startBlock: 18118614 }, +]; + +module.exports = { + cellarsV0815, + cellarsV0816, + cellarsV2, + cellarsV2p5 +} \ No newline at end of file diff --git a/projects/sommelier/index.js b/projects/sommelier/index.js index 7149e0e361c..6e70c7599d5 100644 --- a/projects/sommelier/index.js +++ b/projects/sommelier/index.js @@ -2,60 +2,8 @@ const v0815 = require("./v0-8-15"); const v0816 = require("./v0-8-16"); const v2 = require("./v2"); const chain = "ethereum"; +const { cellarsV0815, cellarsV0816, cellarsV2, cellarsV2p5 } = require("./cellar-constants"); -// v0.8.15 Cellars (Cellar 1.0) -const CELLAR_AAVE = "0x7bad5df5e11151dc5ee1a648800057c5c934c0d5"; -const cellarsV0815 = [{ id: CELLAR_AAVE, startBlock: 15057867 }]; - -// v0.8.16 Cellars (Cellar 1.5) -const ETH_BTC_TREND = "0x6b7f87279982d919bbf85182ddeab179b366d8f2"; -const ETH_BTC_MOM = "0x6e2dac3b9e9adc0cbbae2d0b9fd81952a8d33872"; -const STEADY_ETH = "0x3f07a84ecdf494310d397d24c1c78b041d2fa622"; -const STEADY_BTC = "0x4986fd36b6b16f49b43282ee2e24c5cf90ed166d"; -const STEADY_UNI = "0x6f069f711281618467dae7873541ecc082761b33"; -const STEADY_MATIC = "0x05641a27c82799aaf22b436f20a3110410f29652"; -const cellarsV0816 = [ - { id: ETH_BTC_TREND, startBlock: 15733768 }, - { id: ETH_BTC_MOM, startBlock: 15733768 }, - { id: STEADY_ETH, startBlock: 15991609 }, - { id: STEADY_BTC, startBlock: 15991609 }, - { id: STEADY_UNI, startBlock: 16192732 }, - { id: STEADY_MATIC, startBlock: 16192732 }, -]; - -// v2 Cellars -const DEFI_STARS = "0x03df2a53cbed19b824347d6a45d09016c2d1676a"; -const REAL_YIELD_USD = "0x97e6e0a40a3d02f12d1cec30ebfbae04e37c119e"; -const REAL_YIELD_ETH = "0xb5b29320d2dde5ba5bafa1ebcd270052070483ec"; -const REAL_YIELD_LINK = "0x4068bdd217a45f8f668ef19f1e3a1f043e4c4934"; -const REAL_YIELD_1INCH = "0xc7b69e15d86c5c1581dacce3cacaf5b68cd6596f"; -const REAL_YIELD_UNI = "0x6a6af5393dc23d7e3db28d28ef422db7c40932b6"; -const REAL_YIELD_SNX = "0xcbf2250f33c4161e18d4a2fa47464520af5216b5"; -const REAL_YIELD_ENS = "0x18ea937aba6053bc232d9ae2c42abe7a8a2be440"; -const REAL_YIELD_BTC = "0x0274a704a6d9129f90a62ddc6f6024b33ecdad36"; -const FRAXIMAL = "0xdbe19d1c3f21b1bb250ca7bdae0687a97b5f77e6"; - -const cellarsV2 = [ - { id: DEFI_STARS, startBlock: 17181497 }, - { id: REAL_YIELD_USD, startBlock: 16431804 }, - { id: REAL_YIELD_ETH, startBlock: 16986127 }, - { id: REAL_YIELD_LINK, startBlock: 17377190 }, - { id: REAL_YIELD_1INCH, startBlock: 17377190 }, - { id: REAL_YIELD_UNI, startBlock: 17377190 }, - { id: REAL_YIELD_SNX, startBlock: 17377190 }, - { id: REAL_YIELD_ENS, startBlock: 17377190 }, - { id: REAL_YIELD_BTC, startBlock: 17667535 }, - { id: FRAXIMAL, startBlock: 17589948 }, -]; - -// v2.5 Cellars -const TURBO_SWETH = "0xd33dad974b938744dac81fe00ac67cb5aa13958e"; -const TURBO_GHO = "0x0c190ded9be5f512bd72827bdad4003e9cc7975c"; - -const cellarsV2p5 = [ - { id: TURBO_SWETH, startBlock: 17910374 }, - { id: TURBO_GHO, startBlock: 18118614 }, -]; async function tvl(timestamp, block, chainBlocks, { api }) { const balances = {}; diff --git a/projects/sommelier/v2.js b/projects/sommelier/v2.js index 378edee614d..a712e2d4405 100644 --- a/projects/sommelier/v2.js +++ b/projects/sommelier/v2.js @@ -1,9 +1,57 @@ const sdk = require("@defillama/sdk"); +const { cellarsV2, cellarsV2p5 } = require("./cellar-constants"); async function sumTvl({ balances, cellars, api }) { const assets = await api.multiCall({ abi: "address:asset", calls: cellars}) const bals = await api.multiCall({ abi: "uint256:totalAssets", calls: cellars}) - assets.forEach((a, i) => sdk.util.sumSingleBalance(balances,a,bals[i], api.chain)) + + // Dedupe any potential TVL of cellars taking positions in other cellars by looking at balanceOf for each cellar + + // Concatenate cellar owners to dedupe (only need v2+, older veriosns dont take positions in other cellars) + const owners = cellarsV2.concat(cellarsV2p5) + + const sharesToIgnore = await Promise.all( + cellars.map(async (target) => { + // Iterate over all owners and sum up their shares for each cellar (target) + const shares = await sdk.api.abi.multiCall({ + calls: owners.map((owner) => ({ + target: target, // Base Cellar + params: owner.id, // Potential cellar holding shares in base cellar + })), + abi: "erc20:balanceOf", + }); + + // Sum up all shares for each cellar (target) + const totalShares = shares.output.reduce((sum, share) => sum + Number(share.output), 0); + + return totalShares; + }) + ); + + // Create a new map of total shares by using totalSupply + let totalShares = await sdk.api.abi.multiCall({ + calls: cellars.map((cellar) => ({ + target: cellar, // Base Cellar + })), + abi: "uint256:totalSupply", + }); + // Clean up to be list of outputs + totalShares = totalShares.output.map((share) => share.output); + + // Create a ratio of 1-(sharesToIgnore/totalShares) to multiply by the totalAssets + const ratios = totalShares.map((share, i) => { + const ratio = 1 - sharesToIgnore[i] / share; + return ratio; + }); + + assets.forEach((a, i) => + sdk.util.sumSingleBalance( + balances, + a, + bals[i] * ratios[i], + api.chain + ) + ); return balances } From 9f7281293c6c8c5a1376189b24ae2936b2ad295f Mon Sep 17 00:00:00 2001 From: Jake-Aldrich <31047312+Jake-Aldrich@users.noreply.github.com> Date: Fri, 15 Sep 2023 04:13:56 -0400 Subject: [PATCH 1243/1974] Add RexDex TVL Adapter (#7479) * Add RexDex TVL Adapter * minor fix --------- Co-authored-by: g1nt0ki Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/helper/coreAssets.json | 3 +++ projects/rexdex/index.js | 3 +++ 2 files changed, 6 insertions(+) create mode 100644 projects/rexdex/index.js diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index 5ac02e3f8e4..6d218589217 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -1381,6 +1381,9 @@ "USDT": "7d8706c7f657730201ff3334064f83deb2fdec8a", "MSP": "b2d75931958114e48c9927160f80363eae78e2dc" }, + "wan": { + "WWAN": "0xdabD997aE5E4799BE47d6E69D9431615CBa28f48" + }, "alv": { "WALV": "0xcb3e9919c56eff1004e54175a01e39163a352129" }, diff --git a/projects/rexdex/index.js b/projects/rexdex/index.js new file mode 100644 index 00000000000..9b4b039ec08 --- /dev/null +++ b/projects/rexdex/index.js @@ -0,0 +1,3 @@ +const { uniTvlExport } = require('../helper/unknownTokens') + +module.exports = uniTvlExport('wan', '0xCc2F30462ED1C47Dd7Fb75C81c7F4Cd721eB2A66') \ No newline at end of file From 4ac7f0ff347d6839555c25a6cb51f9280543a262 Mon Sep 17 00:00:00 2001 From: g1nt0ki Date: Fri, 15 Sep 2023 11:09:25 +0200 Subject: [PATCH 1244/1974] parallax: track era tvl --- projects/helper/cache/sumUnknownTokens.js | 8 +++++++- projects/parallax/abis/prllxERC20.json | 1 + projects/parallax/contracts.json | 8 ++++++++ projects/parallax/index.js | 23 ++++++++++++++++++++++- 4 files changed, 38 insertions(+), 2 deletions(-) diff --git a/projects/helper/cache/sumUnknownTokens.js b/projects/helper/cache/sumUnknownTokens.js index c7dae15a2fb..02cbfe1894b 100644 --- a/projects/helper/cache/sumUnknownTokens.js +++ b/projects/helper/cache/sumUnknownTokens.js @@ -54,6 +54,7 @@ async function getLPList({ lps, chain, block, lpFilter = isLP, cache = {}, }) { } async function getTokenPrices({ + api, block, chain = 'ethereum', abis = {}, // if some protocol uses custom abi instead of standard one @@ -74,7 +75,12 @@ async function getTokenPrices({ reservesCallFn, cache = {}, }) { - const api = new sdk.ChainApi({ block, chain, }) + if (!api) + api = new sdk.ChainApi({ block, chain, }) + else { + chain = api.chain + block = api.block + } if (!cache.pairData) cache.pairData = {} let counter = 0 if (!transformAddress) diff --git a/projects/parallax/abis/prllxERC20.json b/projects/parallax/abis/prllxERC20.json index ba0a575e0dc..217fe7ababe 100644 --- a/projects/parallax/abis/prllxERC20.json +++ b/projects/parallax/abis/prllxERC20.json @@ -1,4 +1,5 @@ { "strategyToId": "function strategyToId(address) view returns (uint256)", + "strategiesERA": "function strategies(uint256) view returns (uint256 fee, uint256 totalStaked, uint256 totalShares, uint256 lastCompoundTimestamp, uint256 cap, address strategy, address incentivization, uint32 timelock, bool isActive, uint256 usersCount)", "strategies": "function strategies(uint256) view returns (tuple fees, uint256 totalDeposited, uint256 totalStaked, uint256 lastCompoundTimestamp, uint256 cap, uint256 rewardPerBlock, uint256 rewardPerShare, uint256 lastUpdatedBlockNumber, address strategy, uint32 timelock, bool isActive, address rewardToken, uint256 usersCount)" } \ No newline at end of file diff --git a/projects/parallax/contracts.json b/projects/parallax/contracts.json index fe1e98e7e7f..a434c0065b4 100644 --- a/projects/parallax/contracts.json +++ b/projects/parallax/contracts.json @@ -22,5 +22,13 @@ "parallaxBackendAddr": "0x1724623a721a094f8Ba9d271c9BE8be83e64f74f", "usdc": "0xff970a61a04b1ca14834a43f5de4533ebddb5cc8" } + }, + "era": { + "parallaxAddress": "0xF3D6B2418395b7441B17f39EF79fF8Ead5C0E61C", + "strategyAddress": "0x4d737487C5A398F761A4D8bE53cEB8f42e84a094", + "lpAddress": "0x80115c708E12eDd42E504c1cD52Aea96C547c05c", + "poolAddress": "0x80115c708E12eDd42E504c1cD52Aea96C547c05c", + "zkss_weth": "0x5AEa5775959fBC2557Cc8789bC1bf90A239D9a91", + "usdc": "0x3355df6d4c9c3035724fd0e3914de96a5a83aaf4" } } \ No newline at end of file diff --git a/projects/parallax/index.js b/projects/parallax/index.js index 1dcd225f4be..4e3e9153082 100644 --- a/projects/parallax/index.js +++ b/projects/parallax/index.js @@ -148,9 +148,27 @@ async function arbitrumTvl(time, _ethBlock, { arbitrum: block }, { api }) { return balances; } +async function eraTvl(_, _b, _cb, { api, }) { + + const strategyId = await api.call({ target: contracts.era.parallaxAddress, params: contracts.era.strategyAddress, abi: prllxERC20["strategyToId"], }); + + const strategy = await api.call({ target: contracts.era.parallaxAddress, params: strategyId, abi: prllxERC20.strategiesERA, }); + const pair = contracts.era.lpAddress + const [token0, token1, reserves, totalSupply] = await Promise.all([ + api.call({ target: pair, abi: 'address:token0' }), + api.call({ target: pair, abi: 'address:token1' }), + api.call({ target: pair, abi: "function getReserves() view returns (uint256 _reserve0, uint256 _reserve1)" }), + api.call({ target: pair, abi: 'uint256:totalSupply' }), + ]) + const ratio = strategy.totalStaked / totalSupply + api.add(token0, reserves._reserve0 * ratio) + api.add(token1, reserves._reserve1 * ratio) + return api.getBalances() +} + module.exports = { methodology: "TVL comes from the Staking Vaults", - arbitrum: { + arbitrum: { tvl: arbitrumTvl, staking: staking(['0x82FD636D7A28a20635572EB8ec0603ee264B8651', '0xA3CE2c0d1cfB29F398f8f4800bA202Aba39dbbfe', '0xEb370470Afd74d8a9BBC4fF0C94371C310fF9D3e', ], '0xc8CCBd97b96834b976C995a67BF46e5754e2C48E'), pool2: sumTokensExport({ owner: '0xEb370470Afd74d8a9BBC4fF0C94371C310fF9D3e', resolveUniV3: true, }) @@ -158,4 +176,7 @@ module.exports = { ethereum: { tvl: ethTvl, }, + era: { + tvl: eraTvl, + }, }; From 6223f15948490ffa8ed1ac628ddb55e0b4c24b13 Mon Sep 17 00:00:00 2001 From: g1nt0ki Date: Fri, 15 Sep 2023 13:44:22 +0200 Subject: [PATCH 1245/1974] code refactor --- projects/tangible/abi/BalancerPool.json | 39 +- projects/tangible/abi/CaviarChef.json | 39 +- projects/tangible/abi/Multicall3.json | 19 +- projects/tangible/abi/PairFactory.json | 38 +- projects/tangible/abi/Vault.json | 41 +- projects/tangible/abi/VeChrNFT.json | 1529 +----------- projects/tangible/abi/VeVeloNFT.json | 2303 +----------------- projects/tangible/abi/Voter.json | 75 +- projects/tangible/abi/vePEARL.json | 83 +- projects/tangible/abi/veTETU.json | 94 +- projects/tangible/index.js | 40 +- projects/tangible/insurance-fund-arbitrum.js | 37 +- projects/tangible/insurance-fund-base.js | 57 +- projects/tangible/insurance-fund-optimism.js | 55 +- projects/tangible/insurance-fund-polygon.js | 330 +-- 15 files changed, 540 insertions(+), 4239 deletions(-) diff --git a/projects/tangible/abi/BalancerPool.json b/projects/tangible/abi/BalancerPool.json index 4dc5088dba4..5a102fcd73b 100644 --- a/projects/tangible/abi/BalancerPool.json +++ b/projects/tangible/abi/BalancerPool.json @@ -1 +1,38 @@ -[{"inputs":[{"internalType":"contract IVault","name":"vault","type":"address"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"},{"internalType":"contract IERC20[]","name":"tokens","type":"address[]"},{"internalType":"uint256[]","name":"normalizedWeights","type":"uint256[]"},{"internalType":"uint256","name":"swapFeePercentage","type":"uint256"},{"internalType":"uint256","name":"pauseWindowDuration","type":"uint256"},{"internalType":"uint256","name":"bufferPeriodDuration","type":"uint256"},{"internalType":"address","name":"owner","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"paused","type":"bool"}],"name":"PausedStateChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"swapFeePercentage","type":"uint256"}],"name":"SwapFeePercentageChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"DOMAIN_SEPARATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"decreaseApproval","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"selector","type":"bytes4"}],"name":"getActionId","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAuthorizer","outputs":[{"internalType":"contract IAuthorizer","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getInvariant","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getLastInvariant","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getNormalizedWeights","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPausedState","outputs":[{"internalType":"bool","name":"paused","type":"bool"},{"internalType":"uint256","name":"pauseWindowEndTime","type":"uint256"},{"internalType":"uint256","name":"bufferPeriodEndTime","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPoolId","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getSwapFeePercentage","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getVault","outputs":[{"internalType":"contract IVault","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"increaseApproval","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"nonces","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"poolId","type":"bytes32"},{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256[]","name":"balances","type":"uint256[]"},{"internalType":"uint256","name":"lastChangeBlock","type":"uint256"},{"internalType":"uint256","name":"protocolSwapFeePercentage","type":"uint256"},{"internalType":"bytes","name":"userData","type":"bytes"}],"name":"onExitPool","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"poolId","type":"bytes32"},{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256[]","name":"balances","type":"uint256[]"},{"internalType":"uint256","name":"lastChangeBlock","type":"uint256"},{"internalType":"uint256","name":"protocolSwapFeePercentage","type":"uint256"},{"internalType":"bytes","name":"userData","type":"bytes"}],"name":"onJoinPool","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"enum IVault.SwapKind","name":"kind","type":"uint8"},{"internalType":"contract IERC20","name":"tokenIn","type":"address"},{"internalType":"contract IERC20","name":"tokenOut","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes32","name":"poolId","type":"bytes32"},{"internalType":"uint256","name":"lastChangeBlock","type":"uint256"},{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"bytes","name":"userData","type":"bytes"}],"internalType":"struct IPoolSwapStructs.SwapRequest","name":"request","type":"tuple"},{"internalType":"uint256","name":"balanceTokenIn","type":"uint256"},{"internalType":"uint256","name":"balanceTokenOut","type":"uint256"}],"name":"onSwap","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"permit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"poolId","type":"bytes32"},{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256[]","name":"balances","type":"uint256[]"},{"internalType":"uint256","name":"lastChangeBlock","type":"uint256"},{"internalType":"uint256","name":"protocolSwapFeePercentage","type":"uint256"},{"internalType":"bytes","name":"userData","type":"bytes"}],"name":"queryExit","outputs":[{"internalType":"uint256","name":"bptIn","type":"uint256"},{"internalType":"uint256[]","name":"amountsOut","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"poolId","type":"bytes32"},{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256[]","name":"balances","type":"uint256[]"},{"internalType":"uint256","name":"lastChangeBlock","type":"uint256"},{"internalType":"uint256","name":"protocolSwapFeePercentage","type":"uint256"},{"internalType":"bytes","name":"userData","type":"bytes"}],"name":"queryJoin","outputs":[{"internalType":"uint256","name":"bptOut","type":"uint256"},{"internalType":"uint256[]","name":"amountsIn","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"paused","type":"bool"}],"name":"setPaused","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"swapFeePercentage","type":"uint256"}],"name":"setSwapFeePercentage","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}] +{ + "Approval": "event Approval(address indexed owner, address indexed spender, uint256 value)", + "PausedStateChanged": "event PausedStateChanged(bool paused)", + "SwapFeePercentageChanged": "event SwapFeePercentageChanged(uint256 swapFeePercentage)", + "Transfer": "event Transfer(address indexed from, address indexed to, uint256 value)", + "DOMAIN_SEPARATOR": "function DOMAIN_SEPARATOR() view returns (bytes32)", + "allowance": "function allowance(address owner, address spender) view returns (uint256)", + "approve": "function approve(address spender, uint256 amount) returns (bool)", + "balanceOf": "function balanceOf(address account) view returns (uint256)", + "decimals": "uint8:decimals", + "decreaseApproval": "function decreaseApproval(address spender, uint256 amount) returns (bool)", + "getActionId": "function getActionId(bytes4 selector) view returns (bytes32)", + "getAuthorizer": "address:getAuthorizer", + "getInvariant": "uint256:getInvariant", + "getLastInvariant": "uint256:getLastInvariant", + "getNormalizedWeights": "uint256[]:getNormalizedWeights", + "getOwner": "address:getOwner", + "getPausedState": "function getPausedState() view returns (bool paused, uint256 pauseWindowEndTime, uint256 bufferPeriodEndTime)", + "getPoolId": "function getPoolId() view returns (bytes32)", + "getRate": "uint256:getRate", + "getSwapFeePercentage": "uint256:getSwapFeePercentage", + "getVault": "address:getVault", + "increaseApproval": "function increaseApproval(address spender, uint256 amount) returns (bool)", + "name": "string:name", + "nonces": "function nonces(address owner) view returns (uint256)", + "onExitPool": "function onExitPool(bytes32 poolId, address sender, address recipient, uint256[] balances, uint256 lastChangeBlock, uint256 protocolSwapFeePercentage, bytes userData) returns (uint256[], uint256[])", + "onJoinPool": "function onJoinPool(bytes32 poolId, address sender, address recipient, uint256[] balances, uint256 lastChangeBlock, uint256 protocolSwapFeePercentage, bytes userData) returns (uint256[], uint256[])", + "onSwap": "function onSwap(tuple(uint8 kind, address tokenIn, address tokenOut, uint256 amount, bytes32 poolId, uint256 lastChangeBlock, address from, address to, bytes userData) request, uint256 balanceTokenIn, uint256 balanceTokenOut) view returns (uint256)", + "permit": "function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s)", + "queryExit": "function queryExit(bytes32 poolId, address sender, address recipient, uint256[] balances, uint256 lastChangeBlock, uint256 protocolSwapFeePercentage, bytes userData) returns (uint256 bptIn, uint256[] amountsOut)", + "queryJoin": "function queryJoin(bytes32 poolId, address sender, address recipient, uint256[] balances, uint256 lastChangeBlock, uint256 protocolSwapFeePercentage, bytes userData) returns (uint256 bptOut, uint256[] amountsIn)", + "setPaused": "function setPaused(bool paused)", + "setSwapFeePercentage": "function setSwapFeePercentage(uint256 swapFeePercentage)", + "symbol": "string:symbol", + "totalSupply": "uint256:totalSupply", + "transfer": "function transfer(address recipient, uint256 amount) returns (bool)", + "transferFrom": "function transferFrom(address sender, address recipient, uint256 amount) returns (bool)" +} \ No newline at end of file diff --git a/projects/tangible/abi/CaviarChef.json b/projects/tangible/abi/CaviarChef.json index 8aaec5cc0a5..75ecf453931 100644 --- a/projects/tangible/abi/CaviarChef.json +++ b/projects/tangible/abi/CaviarChef.json @@ -1 +1,38 @@ -[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Harvest","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"rewardPerSecond","type":"uint256"}],"name":"LogRewardPerSecond","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"lastRewardTime","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"underlyingSupply","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"accRewardPerShare","type":"uint256"}],"name":"LogUpdatePool","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"Withdraw","type":"event"},{"inputs":[],"name":"__NAME__","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"accRewardPerShare","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"to","type":"address"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"distributionPeriod","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"gaugeForLP","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"harvest","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"contract IERC20","name":"_rewardToken","type":"address"},{"internalType":"contract IERC20","name":"_underlying","type":"address"},{"internalType":"uint256","name":"_distributionPeriod","type":"uint256"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"lastDistributedTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastRewardTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"pendingReward","outputs":[{"internalType":"uint256","name":"pending","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rebaseChef","outputs":[{"internalType":"contract ICaviarChef","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rewardPerSecond","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"seedRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_distributionPeriod","type":"uint256"}],"name":"setDistributionPeriod","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_gaugeForLP","type":"address"}],"name":"setGaugeForLP","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_name","type":"string"}],"name":"setName","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_rebaseChef","type":"address"}],"name":"setRebaseChef","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_rewardPerSecond","type":"uint256"}],"name":"setRewardPerSecond","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_rewardToken","type":"address"}],"name":"setRewardToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_underlying","type":"address"}],"name":"setUnderlyingToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"smartWalletChecker","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"underlying","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"userInfo","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"int256","name":"rewardDebt","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"to","type":"address"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"to","type":"address"}],"name":"withdrawAndHarvest","outputs":[],"stateMutability":"nonpayable","type":"function"}] +{ + "Deposit": "event Deposit(address indexed user, uint256 amount, address indexed to)", + "Harvest": "event Harvest(address indexed user, uint256 amount)", + "Initialized": "event Initialized(uint8 version)", + "LogRewardPerSecond": "event LogRewardPerSecond(uint256 rewardPerSecond)", + "LogUpdatePool": "event LogUpdatePool(uint256 lastRewardTime, uint256 underlyingSupply, uint256 accRewardPerShare)", + "OwnershipTransferred": "event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)", + "Withdraw": "event Withdraw(address indexed user, uint256 amount, address indexed to)", + "__NAME__": "string:__NAME__", + "accRewardPerShare": "uint256:accRewardPerShare", + "deposit": "function deposit(uint256 amount, address to)", + "distributionPeriod": "uint256:distributionPeriod", + "gaugeForLP": "address:gaugeForLP", + "harvest": "function harvest(address to)", + "initialize": "function initialize(string _name, address _rewardToken, address _underlying, uint256 _distributionPeriod)", + "lastDistributedTime": "uint256:lastDistributedTime", + "lastRewardTime": "uint256:lastRewardTime", + "owner": "address:owner", + "pendingReward": "function pendingReward(address _user) view returns (uint256 pending)", + "rebaseChef": "address:rebaseChef", + "renounceOwnership": "function renounceOwnership()", + "rewardPerSecond": "uint256:rewardPerSecond", + "rewardToken": "address:rewardToken", + "seedRewards": "function seedRewards(uint256 _amount)", + "setDistributionPeriod": "function setDistributionPeriod(uint256 _distributionPeriod)", + "setGaugeForLP": "function setGaugeForLP(address _gaugeForLP)", + "setName": "function setName(string _name)", + "setRebaseChef": "function setRebaseChef(address _rebaseChef)", + "setRewardPerSecond": "function setRewardPerSecond(uint256 _rewardPerSecond)", + "setRewardToken": "function setRewardToken(address _rewardToken)", + "setUnderlyingToken": "function setUnderlyingToken(address _underlying)", + "smartWalletChecker": "address:smartWalletChecker", + "transferOwnership": "function transferOwnership(address newOwner)", + "underlying": "address:underlying", + "userInfo": "function userInfo(address) view returns (uint256 amount, int256 rewardDebt)", + "withdraw": "function withdraw(uint256 amount, address to)", + "withdrawAndHarvest": "function withdrawAndHarvest(uint256 amount, address to)" +} \ No newline at end of file diff --git a/projects/tangible/abi/Multicall3.json b/projects/tangible/abi/Multicall3.json index e8b1c4862cf..cbfe357858d 100644 --- a/projects/tangible/abi/Multicall3.json +++ b/projects/tangible/abi/Multicall3.json @@ -1 +1,18 @@ -[{"inputs":[{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"bytes","name":"callData","type":"bytes"}],"internalType":"struct Multicall3.Call[]","name":"calls","type":"tuple[]"}],"name":"aggregate","outputs":[{"internalType":"uint256","name":"blockNumber","type":"uint256"},{"internalType":"bytes[]","name":"returnData","type":"bytes[]"}],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"bool","name":"allowFailure","type":"bool"},{"internalType":"bytes","name":"callData","type":"bytes"}],"internalType":"struct Multicall3.Call3[]","name":"calls","type":"tuple[]"}],"name":"aggregate3","outputs":[{"components":[{"internalType":"bool","name":"success","type":"bool"},{"internalType":"bytes","name":"returnData","type":"bytes"}],"internalType":"struct Multicall3.Result[]","name":"returnData","type":"tuple[]"}],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"bool","name":"allowFailure","type":"bool"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"callData","type":"bytes"}],"internalType":"struct Multicall3.Call3Value[]","name":"calls","type":"tuple[]"}],"name":"aggregate3Value","outputs":[{"components":[{"internalType":"bool","name":"success","type":"bool"},{"internalType":"bytes","name":"returnData","type":"bytes"}],"internalType":"struct Multicall3.Result[]","name":"returnData","type":"tuple[]"}],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"bytes","name":"callData","type":"bytes"}],"internalType":"struct Multicall3.Call[]","name":"calls","type":"tuple[]"}],"name":"blockAndAggregate","outputs":[{"internalType":"uint256","name":"blockNumber","type":"uint256"},{"internalType":"bytes32","name":"blockHash","type":"bytes32"},{"components":[{"internalType":"bool","name":"success","type":"bool"},{"internalType":"bytes","name":"returnData","type":"bytes"}],"internalType":"struct Multicall3.Result[]","name":"returnData","type":"tuple[]"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"getBasefee","outputs":[{"internalType":"uint256","name":"basefee","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"blockNumber","type":"uint256"}],"name":"getBlockHash","outputs":[{"internalType":"bytes32","name":"blockHash","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getBlockNumber","outputs":[{"internalType":"uint256","name":"blockNumber","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getChainId","outputs":[{"internalType":"uint256","name":"chainid","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCurrentBlockCoinbase","outputs":[{"internalType":"address","name":"coinbase","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCurrentBlockDifficulty","outputs":[{"internalType":"uint256","name":"difficulty","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCurrentBlockGasLimit","outputs":[{"internalType":"uint256","name":"gaslimit","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCurrentBlockTimestamp","outputs":[{"internalType":"uint256","name":"timestamp","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"getEthBalance","outputs":[{"internalType":"uint256","name":"balance","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getLastBlockHash","outputs":[{"internalType":"bytes32","name":"blockHash","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bool","name":"requireSuccess","type":"bool"},{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"bytes","name":"callData","type":"bytes"}],"internalType":"struct Multicall3.Call[]","name":"calls","type":"tuple[]"}],"name":"tryAggregate","outputs":[{"components":[{"internalType":"bool","name":"success","type":"bool"},{"internalType":"bytes","name":"returnData","type":"bytes"}],"internalType":"struct Multicall3.Result[]","name":"returnData","type":"tuple[]"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bool","name":"requireSuccess","type":"bool"},{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"bytes","name":"callData","type":"bytes"}],"internalType":"struct Multicall3.Call[]","name":"calls","type":"tuple[]"}],"name":"tryBlockAndAggregate","outputs":[{"internalType":"uint256","name":"blockNumber","type":"uint256"},{"internalType":"bytes32","name":"blockHash","type":"bytes32"},{"components":[{"internalType":"bool","name":"success","type":"bool"},{"internalType":"bytes","name":"returnData","type":"bytes"}],"internalType":"struct Multicall3.Result[]","name":"returnData","type":"tuple[]"}],"stateMutability":"payable","type":"function"}] +{ + "aggregate": "function aggregate(tuple(address target, bytes callData)[] calls) payable returns (uint256 blockNumber, bytes[] returnData)", + "aggregate3": "function aggregate3(tuple(address target, bool allowFailure, bytes callData)[] calls) payable returns (tuple(bool success, bytes returnData)[] returnData)", + "aggregate3Value": "function aggregate3Value(tuple(address target, bool allowFailure, uint256 value, bytes callData)[] calls) payable returns (tuple(bool success, bytes returnData)[] returnData)", + "blockAndAggregate": "function blockAndAggregate(tuple(address target, bytes callData)[] calls) payable returns (uint256 blockNumber, bytes32 blockHash, tuple(bool success, bytes returnData)[] returnData)", + "getBasefee": "uint256:getBasefee", + "getBlockHash": "function getBlockHash(uint256 blockNumber) view returns (bytes32 blockHash)", + "getBlockNumber": "uint256:getBlockNumber", + "getChainId": "uint256:getChainId", + "getCurrentBlockCoinbase": "address:getCurrentBlockCoinbase", + "getCurrentBlockDifficulty": "uint256:getCurrentBlockDifficulty", + "getCurrentBlockGasLimit": "uint256:getCurrentBlockGasLimit", + "getCurrentBlockTimestamp": "uint256:getCurrentBlockTimestamp", + "getEthBalance": "function getEthBalance(address addr) view returns (uint256 balance)", + "getLastBlockHash": "function getLastBlockHash() view returns (bytes32 blockHash)", + "tryAggregate": "function tryAggregate(bool requireSuccess, tuple(address target, bytes callData)[] calls) payable returns (tuple(bool success, bytes returnData)[] returnData)", + "tryBlockAndAggregate": "function tryBlockAndAggregate(bool requireSuccess, tuple(address target, bytes callData)[] calls) payable returns (uint256 blockNumber, bytes32 blockHash, tuple(bool success, bytes returnData)[] returnData)" +} \ No newline at end of file diff --git a/projects/tangible/abi/PairFactory.json b/projects/tangible/abi/PairFactory.json index c643f75e60b..56936c9e639 100644 --- a/projects/tangible/abi/PairFactory.json +++ b/projects/tangible/abi/PairFactory.json @@ -1 +1,37 @@ -[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token0","type":"address"},{"indexed":true,"internalType":"address","name":"token1","type":"address"},{"indexed":false,"internalType":"bool","name":"stable","type":"bool"},{"indexed":false,"internalType":"address","name":"pair","type":"address"},{"indexed":false,"internalType":"uint256","name":"","type":"uint256"}],"name":"PairCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"bool","name":"_added","type":"bool"}],"name":"PrivilegedAccountStatusUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"FEE_PRECISION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_FEE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"acceptFeeManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"allPairs","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"allPairsLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"tokenA","type":"address"},{"internalType":"address","name":"tokenB","type":"address"},{"internalType":"bool","name":"stable","type":"bool"}],"name":"createPair","outputs":[{"internalType":"address","name":"pair","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"feeManager","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bool","name":"_stable","type":"bool"}],"name":"getFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bool","name":"_stable","type":"bool"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"address","name":"_account","type":"address"}],"name":"getFeeAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"bool","name":"","type":"bool"}],"name":"getPair","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_pairImplementation","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isPair","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"isPrivileged","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pairImplementation","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pairManager","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pairs","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingFeeManager","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_stable","type":"bool"},{"internalType":"uint256","name":"_fee","type":"uint256"}],"name":"setFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_feeManager","type":"address"}],"name":"setFeeManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_pairImplementation","type":"address"}],"name":"setPairImplementationAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_pairManager","type":"address"}],"name":"setPairManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stableFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"updatePairFees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"pair","type":"address"}],"name":"updatePairFees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"},{"internalType":"bool","name":"_addToPrivileged","type":"bool"}],"name":"updatePrivilegedAccount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"volatileFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}] +{ + "Initialized": "event Initialized(uint8 version)", + "OwnershipTransferred": "event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)", + "PairCreated": "event PairCreated(address indexed token0, address indexed token1, bool stable, address pair, uint256)", + "Paused": "event Paused(address account)", + "PrivilegedAccountStatusUpdated": "event PrivilegedAccountStatusUpdated(address indexed account, bool _added)", + "Unpaused": "event Unpaused(address account)", + "FEE_PRECISION": "uint256:FEE_PRECISION", + "MAX_FEE": "uint256:MAX_FEE", + "acceptFeeManager": "function acceptFeeManager()", + "createPair": "function createPair(address tokenA, address tokenB, bool stable) returns (address pair)", + "feeManager": "address:feeManager", + "getFee": "function getFee(bool _stable) view returns (uint256)", + "getFeeAmount": "function getFeeAmount(bool _stable, uint256 _amount, address _account) view returns (uint256)", + "getPair": "function getPair(address, address, bool) view returns (address)", + "initialize": "function initialize(address _pairImplementation)", + "isPair": "function isPair(address) view returns (bool)", + "isPrivileged": "function isPrivileged(address _account) view returns (bool)", + "owner": "address:owner", + "pairImplementation": "address:pairImplementation", + "pairManager": "address:pairManager", + "pairs": "address[]:pairs", + "pause": "function pause()", + "paused": "bool:paused", + "pendingFeeManager": "address:pendingFeeManager", + "renounceOwnership": "function renounceOwnership()", + "setFee": "function setFee(bool _stable, uint256 _fee)", + "setFeeManager": "function setFeeManager(address _feeManager)", + "setPairImplementationAddress": "function setPairImplementationAddress(address _pairImplementation)", + "setPairManager": "function setPairManager(address _pairManager)", + "stableFee": "uint256:stableFee", + "transferOwnership": "function transferOwnership(address newOwner)", + "unpause": "function unpause()", + "updatePairFees": "function updatePairFees(address pair)", + "updatePrivilegedAccount": "function updatePrivilegedAccount(address _account, bool _addToPrivileged)", + "volatileFee": "uint256:volatileFee" +} \ No newline at end of file diff --git a/projects/tangible/abi/Vault.json b/projects/tangible/abi/Vault.json index c344ef434c9..456ef4b43b0 100644 --- a/projects/tangible/abi/Vault.json +++ b/projects/tangible/abi/Vault.json @@ -1 +1,40 @@ -[{"inputs":[{"internalType":"contract IAuthorizer","name":"authorizer","type":"address"},{"internalType":"contract IWETH","name":"weth","type":"address"},{"internalType":"uint256","name":"pauseWindowDuration","type":"uint256"},{"internalType":"uint256","name":"bufferPeriodDuration","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract IAuthorizer","name":"newAuthorizer","type":"address"}],"name":"AuthorizerChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract IERC20","name":"token","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"ExternalBalanceTransfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract IFlashLoanRecipient","name":"recipient","type":"address"},{"indexed":true,"internalType":"contract IERC20","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"feeAmount","type":"uint256"}],"name":"FlashLoan","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"contract IERC20","name":"token","type":"address"},{"indexed":false,"internalType":"int256","name":"delta","type":"int256"}],"name":"InternalBalanceChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"paused","type":"bool"}],"name":"PausedStateChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"poolId","type":"bytes32"},{"indexed":true,"internalType":"address","name":"liquidityProvider","type":"address"},{"indexed":false,"internalType":"contract IERC20[]","name":"tokens","type":"address[]"},{"indexed":false,"internalType":"int256[]","name":"deltas","type":"int256[]"},{"indexed":false,"internalType":"uint256[]","name":"protocolFeeAmounts","type":"uint256[]"}],"name":"PoolBalanceChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"poolId","type":"bytes32"},{"indexed":true,"internalType":"address","name":"assetManager","type":"address"},{"indexed":true,"internalType":"contract IERC20","name":"token","type":"address"},{"indexed":false,"internalType":"int256","name":"cashDelta","type":"int256"},{"indexed":false,"internalType":"int256","name":"managedDelta","type":"int256"}],"name":"PoolBalanceManaged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"poolId","type":"bytes32"},{"indexed":true,"internalType":"address","name":"poolAddress","type":"address"},{"indexed":false,"internalType":"enum IVault.PoolSpecialization","name":"specialization","type":"uint8"}],"name":"PoolRegistered","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"relayer","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"RelayerApprovalChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"poolId","type":"bytes32"},{"indexed":true,"internalType":"contract IERC20","name":"tokenIn","type":"address"},{"indexed":true,"internalType":"contract IERC20","name":"tokenOut","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountIn","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountOut","type":"uint256"}],"name":"Swap","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"poolId","type":"bytes32"},{"indexed":false,"internalType":"contract IERC20[]","name":"tokens","type":"address[]"}],"name":"TokensDeregistered","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"poolId","type":"bytes32"},{"indexed":false,"internalType":"contract IERC20[]","name":"tokens","type":"address[]"},{"indexed":false,"internalType":"address[]","name":"assetManagers","type":"address[]"}],"name":"TokensRegistered","type":"event"},{"inputs":[],"name":"WETH","outputs":[{"internalType":"contract IWETH","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"enum IVault.SwapKind","name":"kind","type":"uint8"},{"components":[{"internalType":"bytes32","name":"poolId","type":"bytes32"},{"internalType":"uint256","name":"assetInIndex","type":"uint256"},{"internalType":"uint256","name":"assetOutIndex","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"userData","type":"bytes"}],"internalType":"struct IVault.BatchSwapStep[]","name":"swaps","type":"tuple[]"},{"internalType":"contract IAsset[]","name":"assets","type":"address[]"},{"components":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"bool","name":"fromInternalBalance","type":"bool"},{"internalType":"address payable","name":"recipient","type":"address"},{"internalType":"bool","name":"toInternalBalance","type":"bool"}],"internalType":"struct IVault.FundManagement","name":"funds","type":"tuple"},{"internalType":"int256[]","name":"limits","type":"int256[]"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"batchSwap","outputs":[{"internalType":"int256[]","name":"assetDeltas","type":"int256[]"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"poolId","type":"bytes32"},{"internalType":"contract IERC20[]","name":"tokens","type":"address[]"}],"name":"deregisterTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"poolId","type":"bytes32"},{"internalType":"address","name":"sender","type":"address"},{"internalType":"address payable","name":"recipient","type":"address"},{"components":[{"internalType":"contract IAsset[]","name":"assets","type":"address[]"},{"internalType":"uint256[]","name":"minAmountsOut","type":"uint256[]"},{"internalType":"bytes","name":"userData","type":"bytes"},{"internalType":"bool","name":"toInternalBalance","type":"bool"}],"internalType":"struct IVault.ExitPoolRequest","name":"request","type":"tuple"}],"name":"exitPool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IFlashLoanRecipient","name":"recipient","type":"address"},{"internalType":"contract IERC20[]","name":"tokens","type":"address[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"internalType":"bytes","name":"userData","type":"bytes"}],"name":"flashLoan","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"selector","type":"bytes4"}],"name":"getActionId","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAuthorizer","outputs":[{"internalType":"contract IAuthorizer","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getDomainSeparator","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"contract IERC20[]","name":"tokens","type":"address[]"}],"name":"getInternalBalance","outputs":[{"internalType":"uint256[]","name":"balances","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"getNextNonce","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPausedState","outputs":[{"internalType":"bool","name":"paused","type":"bool"},{"internalType":"uint256","name":"pauseWindowEndTime","type":"uint256"},{"internalType":"uint256","name":"bufferPeriodEndTime","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"poolId","type":"bytes32"}],"name":"getPool","outputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"enum IVault.PoolSpecialization","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"poolId","type":"bytes32"},{"internalType":"contract IERC20","name":"token","type":"address"}],"name":"getPoolTokenInfo","outputs":[{"internalType":"uint256","name":"cash","type":"uint256"},{"internalType":"uint256","name":"managed","type":"uint256"},{"internalType":"uint256","name":"lastChangeBlock","type":"uint256"},{"internalType":"address","name":"assetManager","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"poolId","type":"bytes32"}],"name":"getPoolTokens","outputs":[{"internalType":"contract IERC20[]","name":"tokens","type":"address[]"},{"internalType":"uint256[]","name":"balances","type":"uint256[]"},{"internalType":"uint256","name":"lastChangeBlock","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getProtocolFeesCollector","outputs":[{"internalType":"contract ProtocolFeesCollector","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"address","name":"relayer","type":"address"}],"name":"hasApprovedRelayer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"poolId","type":"bytes32"},{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"components":[{"internalType":"contract IAsset[]","name":"assets","type":"address[]"},{"internalType":"uint256[]","name":"maxAmountsIn","type":"uint256[]"},{"internalType":"bytes","name":"userData","type":"bytes"},{"internalType":"bool","name":"fromInternalBalance","type":"bool"}],"internalType":"struct IVault.JoinPoolRequest","name":"request","type":"tuple"}],"name":"joinPool","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"enum IVault.PoolBalanceOpKind","name":"kind","type":"uint8"},{"internalType":"bytes32","name":"poolId","type":"bytes32"},{"internalType":"contract IERC20","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"internalType":"struct IVault.PoolBalanceOp[]","name":"ops","type":"tuple[]"}],"name":"managePoolBalance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"enum IVault.UserBalanceOpKind","name":"kind","type":"uint8"},{"internalType":"contract IAsset","name":"asset","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"sender","type":"address"},{"internalType":"address payable","name":"recipient","type":"address"}],"internalType":"struct IVault.UserBalanceOp[]","name":"ops","type":"tuple[]"}],"name":"manageUserBalance","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"enum IVault.SwapKind","name":"kind","type":"uint8"},{"components":[{"internalType":"bytes32","name":"poolId","type":"bytes32"},{"internalType":"uint256","name":"assetInIndex","type":"uint256"},{"internalType":"uint256","name":"assetOutIndex","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"userData","type":"bytes"}],"internalType":"struct IVault.BatchSwapStep[]","name":"swaps","type":"tuple[]"},{"internalType":"contract IAsset[]","name":"assets","type":"address[]"},{"components":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"bool","name":"fromInternalBalance","type":"bool"},{"internalType":"address payable","name":"recipient","type":"address"},{"internalType":"bool","name":"toInternalBalance","type":"bool"}],"internalType":"struct IVault.FundManagement","name":"funds","type":"tuple"}],"name":"queryBatchSwap","outputs":[{"internalType":"int256[]","name":"","type":"int256[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"enum IVault.PoolSpecialization","name":"specialization","type":"uint8"}],"name":"registerPool","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"poolId","type":"bytes32"},{"internalType":"contract IERC20[]","name":"tokens","type":"address[]"},{"internalType":"address[]","name":"assetManagers","type":"address[]"}],"name":"registerTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IAuthorizer","name":"newAuthorizer","type":"address"}],"name":"setAuthorizer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"paused","type":"bool"}],"name":"setPaused","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"relayer","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setRelayerApproval","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"bytes32","name":"poolId","type":"bytes32"},{"internalType":"enum IVault.SwapKind","name":"kind","type":"uint8"},{"internalType":"contract IAsset","name":"assetIn","type":"address"},{"internalType":"contract IAsset","name":"assetOut","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"userData","type":"bytes"}],"internalType":"struct IVault.SingleSwap","name":"singleSwap","type":"tuple"},{"components":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"bool","name":"fromInternalBalance","type":"bool"},{"internalType":"address payable","name":"recipient","type":"address"},{"internalType":"bool","name":"toInternalBalance","type":"bool"}],"internalType":"struct IVault.FundManagement","name":"funds","type":"tuple"},{"internalType":"uint256","name":"limit","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"swap","outputs":[{"internalType":"uint256","name":"amountCalculated","type":"uint256"}],"stateMutability":"payable","type":"function"},{"stateMutability":"payable","type":"receive"}] +{ + "AuthorizerChanged": "event AuthorizerChanged(address indexed newAuthorizer)", + "ExternalBalanceTransfer": "event ExternalBalanceTransfer(address indexed token, address indexed sender, address recipient, uint256 amount)", + "FlashLoan": "event FlashLoan(address indexed recipient, address indexed token, uint256 amount, uint256 feeAmount)", + "InternalBalanceChanged": "event InternalBalanceChanged(address indexed user, address indexed token, int256 delta)", + "PausedStateChanged": "event PausedStateChanged(bool paused)", + "PoolBalanceChanged": "event PoolBalanceChanged(bytes32 indexed poolId, address indexed liquidityProvider, address[] tokens, int256[] deltas, uint256[] protocolFeeAmounts)", + "PoolBalanceManaged": "event PoolBalanceManaged(bytes32 indexed poolId, address indexed assetManager, address indexed token, int256 cashDelta, int256 managedDelta)", + "PoolRegistered": "event PoolRegistered(bytes32 indexed poolId, address indexed poolAddress, uint8 specialization)", + "RelayerApprovalChanged": "event RelayerApprovalChanged(address indexed relayer, address indexed sender, bool approved)", + "Swap": "event Swap(bytes32 indexed poolId, address indexed tokenIn, address indexed tokenOut, uint256 amountIn, uint256 amountOut)", + "TokensDeregistered": "event TokensDeregistered(bytes32 indexed poolId, address[] tokens)", + "TokensRegistered": "event TokensRegistered(bytes32 indexed poolId, address[] tokens, address[] assetManagers)", + "WETH": "address:WETH", + "batchSwap": "function batchSwap(uint8 kind, tuple(bytes32 poolId, uint256 assetInIndex, uint256 assetOutIndex, uint256 amount, bytes userData)[] swaps, address[] assets, tuple(address sender, bool fromInternalBalance, address recipient, bool toInternalBalance) funds, int256[] limits, uint256 deadline) payable returns (int256[] assetDeltas)", + "deregisterTokens": "function deregisterTokens(bytes32 poolId, address[] tokens)", + "exitPool": "function exitPool(bytes32 poolId, address sender, address recipient, tuple(address[] assets, uint256[] minAmountsOut, bytes userData, bool toInternalBalance) request)", + "flashLoan": "function flashLoan(address recipient, address[] tokens, uint256[] amounts, bytes userData)", + "getActionId": "function getActionId(bytes4 selector) view returns (bytes32)", + "getAuthorizer": "address:getAuthorizer", + "getDomainSeparator": "function getDomainSeparator() view returns (bytes32)", + "getInternalBalance": "function getInternalBalance(address user, address[] tokens) view returns (uint256[] balances)", + "getNextNonce": "function getNextNonce(address user) view returns (uint256)", + "getPausedState": "function getPausedState() view returns (bool paused, uint256 pauseWindowEndTime, uint256 bufferPeriodEndTime)", + "getPool": "function getPool(bytes32 poolId) view returns (address, uint8)", + "getPoolTokenInfo": "function getPoolTokenInfo(bytes32 poolId, address token) view returns (uint256 cash, uint256 managed, uint256 lastChangeBlock, address assetManager)", + "getPoolTokens": "function getPoolTokens(bytes32 poolId) view returns (address[] tokens, uint256[] balances, uint256 lastChangeBlock)", + "getProtocolFeesCollector": "address:getProtocolFeesCollector", + "hasApprovedRelayer": "function hasApprovedRelayer(address user, address relayer) view returns (bool)", + "joinPool": "function joinPool(bytes32 poolId, address sender, address recipient, tuple(address[] assets, uint256[] maxAmountsIn, bytes userData, bool fromInternalBalance) request) payable", + "managePoolBalance": "function managePoolBalance(tuple(uint8 kind, bytes32 poolId, address token, uint256 amount)[] ops)", + "manageUserBalance": "function manageUserBalance(tuple(uint8 kind, address asset, uint256 amount, address sender, address recipient)[] ops) payable", + "queryBatchSwap": "function queryBatchSwap(uint8 kind, tuple(bytes32 poolId, uint256 assetInIndex, uint256 assetOutIndex, uint256 amount, bytes userData)[] swaps, address[] assets, tuple(address sender, bool fromInternalBalance, address recipient, bool toInternalBalance) funds) returns (int256[])", + "registerPool": "function registerPool(uint8 specialization) returns (bytes32)", + "registerTokens": "function registerTokens(bytes32 poolId, address[] tokens, address[] assetManagers)", + "setAuthorizer": "function setAuthorizer(address newAuthorizer)", + "setPaused": "function setPaused(bool paused)", + "setRelayerApproval": "function setRelayerApproval(address sender, address relayer, bool approved)", + "swap": "function swap(tuple(bytes32 poolId, uint8 kind, address assetIn, address assetOut, uint256 amount, bytes userData) singleSwap, tuple(address sender, bool fromInternalBalance, address recipient, bool toInternalBalance) funds, uint256 limit, uint256 deadline) payable returns (uint256 amountCalculated)" +} \ No newline at end of file diff --git a/projects/tangible/abi/VeChrNFT.json b/projects/tangible/abi/VeChrNFT.json index 65437f55992..e9b93bde1f4 100644 --- a/projects/tangible/abi/VeChrNFT.json +++ b/projects/tangible/abi/VeChrNFT.json @@ -1,1525 +1,4 @@ -[ - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "approved", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "operator", - "type": "address" - }, - { - "indexed": false, - "internalType": "bool", - "name": "approved", - "type": "bool" - } - ], - "name": "ApprovalForAll", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "provider", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "locktime", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "enum VotingEscrow.DepositType", - "name": "deposit_type", - "type": "uint8" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "ts", - "type": "uint256" - } - ], - "name": "Deposit", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint8", - "name": "version", - "type": "uint8" - } - ], - "name": "Initialized", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "prevSupply", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "supply", - "type": "uint256" - } - ], - "name": "Supply", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "provider", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "ts", - "type": "uint256" - } - ], - "name": "Withdraw", - "type": "event" - }, - { - "inputs": [], - "name": "PRECISSION", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_tokenId", - "type": "uint256" - } - ], - "name": "abstain", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "airdropContract", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "airdropProtocol", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_approved", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_tokenId", - "type": "uint256" - } - ], - "name": "approve", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "artProxy", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_tokenId", - "type": "uint256" - } - ], - "name": "attach", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "attachments", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_owner", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_tokenId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_block", - "type": "uint256" - } - ], - "name": "balanceOfAtNFT", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_tokenId", - "type": "uint256" - } - ], - "name": "balanceOfNFT", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_tokenId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_t", - "type": "uint256" - } - ], - "name": "balanceOfNFTAt", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "block_number", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "boostAirdropAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "checkpoint", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "uint32", - "name": "", - "type": "uint32" - } - ], - "name": "checkpoints", - "outputs": [ - { - "internalType": "uint256", - "name": "timestamp", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_value", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_lock_duration", - "type": "uint256" - } - ], - "name": "create_lock", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_value", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_lock_duration", - "type": "uint256" - }, - { - "internalType": "address", - "name": "_to", - "type": "address" - } - ], - "name": "create_lock_for", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "decimals", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_tokenId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_value", - "type": "uint256" - } - ], - "name": "deposit_for", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_tokenId", - "type": "uint256" - } - ], - "name": "detach", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "epoch", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_tokenId", - "type": "uint256" - } - ], - "name": "getApproved", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_tokenId", - "type": "uint256" - } - ], - "name": "get_last_user_slope", - "outputs": [ - { - "internalType": "int128", - "name": "", - "type": "int128" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_tokenId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_value", - "type": "uint256" - } - ], - "name": "increase_amount", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_tokenId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_lock_duration", - "type": "uint256" - } - ], - "name": "increase_unlock_time", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token_addr", - "type": "address" - }, - { - "internalType": "address", - "name": "art_proxy", - "type": "address" - }, - { - "internalType": "address", - "name": "_boostAirdropAddress", - "type": "address" - } - ], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_owner", - "type": "address" - }, - { - "internalType": "address", - "name": "_operator", - "type": "address" - } - ], - "name": "isApprovedForAll", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_tokenId", - "type": "uint256" - } - ], - "name": "isApprovedOrOwner", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "locked", - "outputs": [ - { - "internalType": "int128", - "name": "amount", - "type": "int128" - }, - { - "internalType": "uint256", - "name": "end", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_tokenId", - "type": "uint256" - } - ], - "name": "locked__end", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_from", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_to", - "type": "uint256" - } - ], - "name": "merge", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "ms", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "name", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "nonces", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "numCheckpoints", - "outputs": [ - { - "internalType": "uint32", - "name": "", - "type": "uint32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_tokenId", - "type": "uint256" - } - ], - "name": "ownerOf", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "ownership_change", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "point_history", - "outputs": [ - { - "internalType": "int128", - "name": "bias", - "type": "int128" - }, - { - "internalType": "int128", - "name": "slope", - "type": "int128" - }, - { - "internalType": "uint256", - "name": "ts", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "blk", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "reset", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_from", - "type": "address" - }, - { - "internalType": "address", - "name": "_to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_tokenId", - "type": "uint256" - } - ], - "name": "safeTransferFrom", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_from", - "type": "address" - }, - { - "internalType": "address", - "name": "_to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_tokenId", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "_data", - "type": "bytes" - } - ], - "name": "safeTransferFrom", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_airdropContract", - "type": "address" - } - ], - "name": "setAirdropContract", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_operator", - "type": "address" - }, - { - "internalType": "bool", - "name": "_approved", - "type": "bool" - } - ], - "name": "setApprovalForAll", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_proxy", - "type": "address" - } - ], - "name": "setArtProxy", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_boostAirdropAddress", - "type": "address" - } - ], - "name": "setBoostAirdropAddress", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_minBonusTime", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_bonusPercent", - "type": "uint256" - } - ], - "name": "setBoostParams", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_tokenId", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "_airdrop", - "type": "bool" - } - ], - "name": "setProtocolAirdrop", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_team", - "type": "address" - } - ], - "name": "setTeam", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_voter", - "type": "address" - } - ], - "name": "setVoter", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bool", - "name": "_status", - "type": "bool" - } - ], - "name": "setlimitProtocol", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "slope_changes", - "outputs": [ - { - "internalType": "int128", - "name": "", - "type": "int128" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256[]", - "name": "amounts", - "type": "uint256[]" - }, - { - "internalType": "uint256", - "name": "_tokenId", - "type": "uint256" - } - ], - "name": "split", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "supply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_interfaceID", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "symbol", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "team", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "token", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_owner", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_tokenIndex", - "type": "uint256" - } - ], - "name": "tokenOfOwnerByIndex", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_tokenId", - "type": "uint256" - } - ], - "name": "tokenURI", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_usr", - "type": "address" - } - ], - "name": "tokensOfOwner", - "outputs": [ - { - "internalType": "uint256[]", - "name": "", - "type": "uint256[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_block", - "type": "uint256" - } - ], - "name": "totalSupplyAt", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "t", - "type": "uint256" - } - ], - "name": "totalSupplyAtT", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalTokens", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalTokensBurned", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalTokensMinted", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_from", - "type": "address" - }, - { - "internalType": "address", - "name": "_to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_tokenId", - "type": "uint256" - } - ], - "name": "transferFrom", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "user_point_epoch", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "user_point_history", - "outputs": [ - { - "internalType": "int128", - "name": "bias", - "type": "int128" - }, - { - "internalType": "int128", - "name": "slope", - "type": "int128" - }, - { - "internalType": "uint256", - "name": "ts", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "blk", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_tokenId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_idx", - "type": "uint256" - } - ], - "name": "user_point_history__ts", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "version", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "voted", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "voter", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_tokenId", - "type": "uint256" - } - ], - "name": "voting", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_tokenId", - "type": "uint256" - } - ], - "name": "withdraw", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } -] \ No newline at end of file +{ + "locked": "function locked(uint256) view returns (int128 amount, uint256 end)", + "tokensOfOwner": "function tokensOfOwner(address _usr) view returns (uint256[])" +} \ No newline at end of file diff --git a/projects/tangible/abi/VeVeloNFT.json b/projects/tangible/abi/VeVeloNFT.json index cbe1163138f..06f2943380c 100644 --- a/projects/tangible/abi/VeVeloNFT.json +++ b/projects/tangible/abi/VeVeloNFT.json @@ -1,2296 +1,7 @@ -[ - { - "inputs": [ - { - "internalType": "address", - "name": "_forwarder", - "type": "address" - }, - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "address", - "name": "_factoryRegistry", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [], - "name": "AlreadyVoted", - "type": "error" - }, - { - "inputs": [], - "name": "AmountTooBig", - "type": "error" - }, - { - "inputs": [], - "name": "ERC721ReceiverRejectedTokens", - "type": "error" - }, - { - "inputs": [], - "name": "ERC721TransferToNonERC721ReceiverImplementer", - "type": "error" - }, - { - "inputs": [], - "name": "InvalidManagedNFTId", - "type": "error" - }, - { - "inputs": [], - "name": "InvalidNonce", - "type": "error" - }, - { - "inputs": [], - "name": "InvalidSignature", - "type": "error" - }, - { - "inputs": [], - "name": "InvalidSignatureS", - "type": "error" - }, - { - "inputs": [], - "name": "LockDurationNotInFuture", - "type": "error" - }, - { - "inputs": [], - "name": "LockDurationTooLong", - "type": "error" - }, - { - "inputs": [], - "name": "LockExpired", - "type": "error" - }, - { - "inputs": [], - "name": "LockNotExpired", - "type": "error" - }, - { - "inputs": [], - "name": "NoLockFound", - "type": "error" - }, - { - "inputs": [], - "name": "NonExistentToken", - "type": "error" - }, - { - "inputs": [], - "name": "NotApprovedOrOwner", - "type": "error" - }, - { - "inputs": [], - "name": "NotDistributor", - "type": "error" - }, - { - "inputs": [], - "name": "NotEmergencyCouncilOrGovernor", - "type": "error" - }, - { - "inputs": [], - "name": "NotGovernor", - "type": "error" - }, - { - "inputs": [], - "name": "NotGovernorOrManager", - "type": "error" - }, - { - "inputs": [], - "name": "NotLockedNFT", - "type": "error" - }, - { - "inputs": [], - "name": "NotManagedNFT", - "type": "error" - }, - { - "inputs": [], - "name": "NotManagedOrNormalNFT", - "type": "error" - }, - { - "inputs": [], - "name": "NotNormalNFT", - "type": "error" - }, - { - "inputs": [], - "name": "NotOwner", - "type": "error" - }, - { - "inputs": [], - "name": "NotPermanentLock", - "type": "error" - }, - { - "inputs": [], - "name": "NotTeam", - "type": "error" - }, - { - "inputs": [], - "name": "NotVoter", - "type": "error" - }, - { - "inputs": [], - "name": "OwnershipChange", - "type": "error" - }, - { - "inputs": [], - "name": "PermanentLock", - "type": "error" - }, - { - "inputs": [], - "name": "SameAddress", - "type": "error" - }, - { - "inputs": [], - "name": "SameNFT", - "type": "error" - }, - { - "inputs": [], - "name": "SameState", - "type": "error" - }, - { - "inputs": [], - "name": "SignatureExpired", - "type": "error" - }, - { - "inputs": [], - "name": "SplitNoOwner", - "type": "error" - }, - { - "inputs": [], - "name": "SplitNotAllowed", - "type": "error" - }, - { - "inputs": [], - "name": "TooManyTokenIDs", - "type": "error" - }, - { - "inputs": [], - "name": "ZeroAddress", - "type": "error" - }, - { - "inputs": [], - "name": "ZeroAmount", - "type": "error" - }, - { - "inputs": [], - "name": "ZeroBalance", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "approved", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "operator", - "type": "address" - }, - { - "indexed": false, - "internalType": "bool", - "name": "approved", - "type": "bool" - } - ], - "name": "ApprovalForAll", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "_fromTokenId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_toTokenId", - "type": "uint256" - } - ], - "name": "BatchMetadataUpdate", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "_to", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "_mTokenId", - "type": "uint256" - }, - { - "indexed": true, - "internalType": "address", - "name": "_from", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "_lockedManagedReward", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "_freeManagedReward", - "type": "address" - } - ], - "name": "CreateManaged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "delegator", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "fromDelegate", - "type": "uint256" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "toDelegate", - "type": "uint256" - } - ], - "name": "DelegateChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "delegate", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "previousBalance", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "newBalance", - "type": "uint256" - } - ], - "name": "DelegateVotesChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "provider", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "indexed": true, - "internalType": "enum IVotingEscrow.DepositType", - "name": "depositType", - "type": "uint8" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "locktime", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "ts", - "type": "uint256" - } - ], - "name": "Deposit", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "_owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "_tokenId", - "type": "uint256" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "_mTokenId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_weight", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_ts", - "type": "uint256" - } - ], - "name": "DepositManaged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "_owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "_tokenId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_ts", - "type": "uint256" - } - ], - "name": "LockPermanent", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "_sender", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "_from", - "type": "uint256" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "_to", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_amountFrom", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_amountTo", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_amountFinal", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_locktime", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_ts", - "type": "uint256" - } - ], - "name": "Merge", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "_tokenId", - "type": "uint256" - } - ], - "name": "MetadataUpdate", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "_allowedManager", - "type": "address" - } - ], - "name": "SetAllowedManager", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "uint256", - "name": "_from", - "type": "uint256" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "_tokenId1", - "type": "uint256" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "_tokenId2", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "address", - "name": "_sender", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_splitAmount1", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_splitAmount2", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_locktime", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_ts", - "type": "uint256" - } - ], - "name": "Split", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "prevSupply", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "supply", - "type": "uint256" - } - ], - "name": "Supply", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "_owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "_tokenId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_ts", - "type": "uint256" - } - ], - "name": "UnlockPermanent", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "provider", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "ts", - "type": "uint256" - } - ], - "name": "Withdraw", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "_owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "_tokenId", - "type": "uint256" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "_mTokenId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_weight", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_ts", - "type": "uint256" - } - ], - "name": "WithdrawManaged", - "type": "event" - }, - { - "inputs": [], - "name": "CLOCK_MODE", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "DELEGATION_TYPEHASH", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "DOMAIN_TYPEHASH", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "allowedManager", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_approved", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_tokenId", - "type": "uint256" - } - ], - "name": "approve", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "artProxy", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_owner", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_tokenId", - "type": "uint256" - } - ], - "name": "balanceOfNFT", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_tokenId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_t", - "type": "uint256" - } - ], - "name": "balanceOfNFTAt", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "canSplit", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "checkpoint", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_tokenId", - "type": "uint256" - }, - { - "internalType": "uint48", - "name": "_index", - "type": "uint48" - } - ], - "name": "checkpoints", - "outputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "fromTimestamp", - "type": "uint256" - }, - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "uint256", - "name": "delegatedBalance", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "delegatee", - "type": "uint256" - } - ], - "internalType": "struct IVotingEscrow.Checkpoint", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "clock", - "outputs": [ - { - "internalType": "uint48", - "name": "", - "type": "uint48" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_value", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_lockDuration", - "type": "uint256" - } - ], - "name": "createLock", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_value", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_lockDuration", - "type": "uint256" - }, - { - "internalType": "address", - "name": "_to", - "type": "address" - } - ], - "name": "createLockFor", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_to", - "type": "address" - } - ], - "name": "createManagedLockFor", - "outputs": [ - { - "internalType": "uint256", - "name": "_mTokenId", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "deactivated", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "decimals", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "delegator", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "delegatee", - "type": "uint256" - } - ], - "name": "delegate", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "delegator", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "delegatee", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "nonce", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "expiry", - "type": "uint256" - }, - { - "internalType": "uint8", - "name": "v", - "type": "uint8" - }, - { - "internalType": "bytes32", - "name": "r", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "s", - "type": "bytes32" - } - ], - "name": "delegateBySig", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "delegator", - "type": "uint256" - } - ], - "name": "delegates", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_tokenId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_value", - "type": "uint256" - } - ], - "name": "depositFor", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_tokenId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_mTokenId", - "type": "uint256" - } - ], - "name": "depositManaged", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "distributor", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "epoch", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "escrowType", - "outputs": [ - { - "internalType": "enum IVotingEscrow.EscrowType", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "factoryRegistry", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "forwarder", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_tokenId", - "type": "uint256" - } - ], - "name": "getApproved", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_timestamp", - "type": "uint256" - } - ], - "name": "getPastTotalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_account", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_tokenId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_timestamp", - "type": "uint256" - } - ], - "name": "getPastVotes", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "idToManaged", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_tokenId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_value", - "type": "uint256" - } - ], - "name": "increaseAmount", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_tokenId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_lockDuration", - "type": "uint256" - } - ], - "name": "increaseUnlockTime", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_owner", - "type": "address" - }, - { - "internalType": "address", - "name": "_operator", - "type": "address" - } - ], - "name": "isApprovedForAll", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_tokenId", - "type": "uint256" - } - ], - "name": "isApprovedOrOwner", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "forwarder", - "type": "address" - } - ], - "name": "isTrustedForwarder", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_tokenId", - "type": "uint256" - } - ], - "name": "lockPermanent", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_tokenId", - "type": "uint256" - } - ], - "name": "locked", - "outputs": [ - { - "components": [ - { - "internalType": "int128", - "name": "amount", - "type": "int128" - }, - { - "internalType": "uint256", - "name": "end", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "isPermanent", - "type": "bool" - } - ], - "internalType": "struct IVotingEscrow.LockedBalance", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "managedToFree", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "managedToLocked", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_from", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_to", - "type": "uint256" - } - ], - "name": "merge", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "name", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "nonces", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "numCheckpoints", - "outputs": [ - { - "internalType": "uint48", - "name": "", - "type": "uint48" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_tokenId", - "type": "uint256" - } - ], - "name": "ownerOf", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "ownerToNFTokenIdList", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "permanentLockBalance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_loc", - "type": "uint256" - } - ], - "name": "pointHistory", - "outputs": [ - { - "components": [ - { - "internalType": "int128", - "name": "bias", - "type": "int128" - }, - { - "internalType": "int128", - "name": "slope", - "type": "int128" - }, - { - "internalType": "uint256", - "name": "ts", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "blk", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "permanentLockBalance", - "type": "uint256" - } - ], - "internalType": "struct IVotingEscrow.GlobalPoint", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_from", - "type": "address" - }, - { - "internalType": "address", - "name": "_to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_tokenId", - "type": "uint256" - } - ], - "name": "safeTransferFrom", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_from", - "type": "address" - }, - { - "internalType": "address", - "name": "_to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_tokenId", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "_data", - "type": "bytes" - } - ], - "name": "safeTransferFrom", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_allowedManager", - "type": "address" - } - ], - "name": "setAllowedManager", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_operator", - "type": "address" - }, - { - "internalType": "bool", - "name": "_approved", - "type": "bool" - } - ], - "name": "setApprovalForAll", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_proxy", - "type": "address" - } - ], - "name": "setArtProxy", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_mTokenId", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "_state", - "type": "bool" - } - ], - "name": "setManagedState", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_team", - "type": "address" - } - ], - "name": "setTeam", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_voter", - "type": "address" - }, - { - "internalType": "address", - "name": "_distributor", - "type": "address" - } - ], - "name": "setVoterAndDistributor", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "slopeChanges", - "outputs": [ - { - "internalType": "int128", - "name": "", - "type": "int128" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_from", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "split", - "outputs": [ - { - "internalType": "uint256", - "name": "_tokenId1", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_tokenId2", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "supply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_interfaceID", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "symbol", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "team", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_account", - "type": "address" - }, - { - "internalType": "bool", - "name": "_bool", - "type": "bool" - } - ], - "name": "toggleSplit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "token", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "tokenId", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_tokenId", - "type": "uint256" - } - ], - "name": "tokenURI", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_timestamp", - "type": "uint256" - } - ], - "name": "totalSupplyAt", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_from", - "type": "address" - }, - { - "internalType": "address", - "name": "_to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_tokenId", - "type": "uint256" - } - ], - "name": "transferFrom", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_tokenId", - "type": "uint256" - } - ], - "name": "unlockPermanent", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "userPointEpoch", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_tokenId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_loc", - "type": "uint256" - } - ], - "name": "userPointHistory", - "outputs": [ - { - "components": [ - { - "internalType": "int128", - "name": "bias", - "type": "int128" - }, - { - "internalType": "int128", - "name": "slope", - "type": "int128" - }, - { - "internalType": "uint256", - "name": "ts", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "blk", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "permanent", - "type": "uint256" - } - ], - "internalType": "struct IVotingEscrow.UserPoint", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "version", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "voted", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "voter", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_tokenId", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "_voted", - "type": "bool" - } - ], - "name": "voting", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "weights", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_tokenId", - "type": "uint256" - } - ], - "name": "withdraw", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_tokenId", - "type": "uint256" - } - ], - "name": "withdrawManaged", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } -] \ No newline at end of file +{ + "ownerToNFTokenIdList": "function ownerToNFTokenIdList(address, uint256) view returns (uint256)", + "tokenOfOwnerByIndex": "function tokenOfOwnerByIndex(address _owner, uint256 _tokenIndex) view returns (uint256)", + "lockedPearl": "function locked(uint256 _tokenId) view returns (tuple(int128 amount, uint256 end))", + "lockedAmounts": "function lockedAmounts(uint256, address) view returns (uint256)", + "locked": "function locked(uint256 _tokenId) view returns (tuple(int128 amount, uint256 end, bool isPermanent))" +} \ No newline at end of file diff --git a/projects/tangible/abi/Voter.json b/projects/tangible/abi/Voter.json index f4c0077f25f..7e90c2a3234 100644 --- a/projects/tangible/abi/Voter.json +++ b/projects/tangible/abi/Voter.json @@ -1 +1,74 @@ -[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"weight","type":"uint256"}],"name":"Abstained","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"lp","type":"address"},{"indexed":true,"internalType":"address","name":"gauge","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"gauge","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"DistributeReward","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"gauge","type":"address"},{"indexed":false,"internalType":"address","name":"creator","type":"address"},{"indexed":false,"internalType":"address","name":"internal_bribe","type":"address"},{"indexed":true,"internalType":"address","name":"external_bribe","type":"address"},{"indexed":true,"internalType":"address","name":"pool","type":"address"}],"name":"GaugeCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"gauge","type":"address"}],"name":"GaugeKilled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"gauge","type":"address"}],"name":"GaugeRevived","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"reward","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"NotifyReward","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"voter","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"weight","type":"uint256"}],"name":"Voted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"whitelister","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"}],"name":"Whitelisted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"lp","type":"address"},{"indexed":true,"internalType":"address","name":"gauge","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Withdraw","type":"event"},{"inputs":[{"internalType":"address[]","name":"_tokens","type":"address[]"},{"internalType":"address","name":"_minter","type":"address"}],"name":"_initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"_ve","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"bribefactory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_bribes","type":"address[]"},{"internalType":"address[][]","name":"_tokens","type":"address[][]"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"claimBribes","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_fees","type":"address[]"},{"internalType":"address[][]","name":"_tokens","type":"address[][]"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"claimFees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"claimable","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_pool","type":"address"}],"name":"createGauge","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_gauges","type":"address[]"}],"name":"distribute","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_gauge","type":"address"}],"name":"distribute","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"finish","type":"uint256"}],"name":"distribute","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"distributeAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_gauges","type":"address[]"}],"name":"distributeFees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"emergencyCouncil","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"emitDeposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"emitWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"external_bribes","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"factory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"gaugefactory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"gauges","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"gaugesDistributionTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getIncentivizedPools","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"governor","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_gauge","type":"address"}],"name":"increaseGaugeApprovals","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_gauges","type":"address[]"},{"internalType":"address[]","name":"_pools","type":"address[]"}],"name":"initGauges","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"__ve","type":"address"},{"internalType":"address","name":"_factory","type":"address"},{"internalType":"address","name":"_gauges","type":"address"},{"internalType":"address","name":"_bribes","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"internal_bribes","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isAlive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isBribe","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isGauge","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isWhitelisted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_gauge","type":"address"}],"name":"killGauge","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"lastVoted","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"length","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minter","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"notifyRewardAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"poke","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"poolForGauge","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"poolVote","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"poolVoteLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"pools","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"reinitialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"reset","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_gauge","type":"address"}],"name":"reviveGauge","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_bribeFactory","type":"address"}],"name":"setBribeFactory","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_council","type":"address"}],"name":"setEmergencyCouncil","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_gaugeFactory","type":"address"}],"name":"setGaugeFactory","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_governor","type":"address"}],"name":"setGovernor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_minter","type":"address"}],"name":"setMinter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_gauge","type":"address"},{"internalType":"address","name":"_internal","type":"address"},{"internalType":"address","name":"_external","type":"address"}],"name":"setNewBribe","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_factory","type":"address"}],"name":"setPairFactory","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_usdr","type":"address"}],"name":"setUSDR","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_votingEscrow","type":"address"}],"name":"setVotingEscrow","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"totalWeight","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"usdr","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"usedWeights","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"address[]","name":"_poolVote","type":"address[]"},{"internalType":"uint256[]","name":"_weights","type":"uint256[]"}],"name":"vote","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"votes","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"weights","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"whitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_token","type":"address[]"}],"name":"whitelist","outputs":[],"stateMutability":"nonpayable","type":"function"}] +{ + "Abstained": "event Abstained(uint256 tokenId, uint256 weight)", + "Deposit": "event Deposit(address indexed lp, address indexed gauge, uint256 tokenId, uint256 amount)", + "DistributeReward": "event DistributeReward(address indexed sender, address indexed gauge, uint256 amount)", + "GaugeCreated": "event GaugeCreated(address indexed gauge, address creator, address internal_bribe, address indexed external_bribe, address indexed pool)", + "GaugeKilled": "event GaugeKilled(address indexed gauge)", + "GaugeRevived": "event GaugeRevived(address indexed gauge)", + "Initialized": "event Initialized(uint8 version)", + "NotifyReward": "event NotifyReward(address indexed sender, address indexed reward, uint256 amount)", + "OwnershipTransferred": "event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)", + "Voted": "event Voted(address indexed voter, uint256 tokenId, uint256 weight)", + "Whitelisted": "event Whitelisted(address indexed whitelister, address indexed token)", + "Withdraw": "event Withdraw(address indexed lp, address indexed gauge, uint256 tokenId, uint256 amount)", + "_initialize": "function _initialize(address[] _tokens, address _minter)", + "_ve": "address:_ve", + "bribefactory": "address:bribefactory", + "claimBribes": "function claimBribes(address[] _bribes, address[][] _tokens, uint256 _tokenId)", + "claimFees": "function claimFees(address[] _fees, address[][] _tokens, uint256 _tokenId)", + "claimable": "function claimable(address) view returns (uint256)", + "createGauge": "function createGauge(address _pool) returns (address)", + "distribute": "function distribute(uint256 start, uint256 finish)", + "distributeAll": "function distributeAll()", + "distributeFees": "function distributeFees(address[] _gauges)", + "emergencyCouncil": "address:emergencyCouncil", + "emitDeposit": "function emitDeposit(uint256 tokenId, address account, uint256 amount)", + "emitWithdraw": "function emitWithdraw(uint256 tokenId, address account, uint256 amount)", + "external_bribes": "function external_bribes(address) view returns (address)", + "factory": "address:factory", + "gaugefactory": "address:gaugefactory", + "gauges": "function gauges(address) view returns (address)", + "gaugesDistributionTimestamp": "function gaugesDistributionTimestamp(address) view returns (uint256)", + "getIncentivizedPools": "address[]:getIncentivizedPools", + "governor": "address:governor", + "increaseGaugeApprovals": "function increaseGaugeApprovals(address _gauge)", + "initGauges": "function initGauges(address[] _gauges, address[] _pools)", + "initialize": "function initialize(address __ve, address _factory, address _gauges, address _bribes)", + "internal_bribes": "function internal_bribes(address) view returns (address)", + "isAlive": "function isAlive(address) view returns (bool)", + "isBribe": "function isBribe(address) view returns (bool)", + "isGauge": "function isGauge(address) view returns (bool)", + "isWhitelisted": "function isWhitelisted(address) view returns (bool)", + "killGauge": "function killGauge(address _gauge)", + "lastVoted": "function lastVoted(uint256) view returns (uint256)", + "length": "uint256:length", + "minter": "address:minter", + "notifyRewardAmount": "function notifyRewardAmount(uint256 amount)", + "owner": "address:owner", + "poke": "function poke(uint256 _tokenId)", + "poolForGauge": "function poolForGauge(address) view returns (address)", + "poolVote": "function poolVote(uint256, uint256) view returns (address)", + "poolVoteLength": "function poolVoteLength(uint256 tokenId) view returns (uint256)", + "pools": "function pools(uint256) view returns (address)", + "reinitialize": "function reinitialize()", + "renounceOwnership": "function renounceOwnership()", + "reset": "function reset(uint256 _tokenId)", + "reviveGauge": "function reviveGauge(address _gauge)", + "setBribeFactory": "function setBribeFactory(address _bribeFactory)", + "setEmergencyCouncil": "function setEmergencyCouncil(address _council)", + "setGaugeFactory": "function setGaugeFactory(address _gaugeFactory)", + "setGovernor": "function setGovernor(address _governor)", + "setMinter": "function setMinter(address _minter)", + "setNewBribe": "function setNewBribe(address _gauge, address _internal, address _external)", + "setPairFactory": "function setPairFactory(address _factory)", + "setUSDR": "function setUSDR(address _usdr)", + "setVotingEscrow": "function setVotingEscrow(address _votingEscrow)", + "totalWeight": "uint256:totalWeight", + "transferOwnership": "function transferOwnership(address newOwner)", + "usdr": "address:usdr", + "usedWeights": "function usedWeights(uint256) view returns (uint256)", + "vote": "function vote(uint256 _tokenId, address[] _poolVote, uint256[] _weights)", + "votes": "function votes(uint256, address) view returns (uint256)", + "weights": "function weights(address) view returns (uint256)", + "whitelist": "function whitelist(address[] _token)" +} \ No newline at end of file diff --git a/projects/tangible/abi/vePEARL.json b/projects/tangible/abi/vePEARL.json index b9e539aa0de..3f3bbbe5db0 100644 --- a/projects/tangible/abi/vePEARL.json +++ b/projects/tangible/abi/vePEARL.json @@ -1 +1,82 @@ -[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"delegator","type":"address"},{"indexed":true,"internalType":"address","name":"fromDelegate","type":"address"},{"indexed":true,"internalType":"address","name":"toDelegate","type":"address"}],"name":"DelegateChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"delegate","type":"address"},{"indexed":false,"internalType":"uint256","name":"previousBalance","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newBalance","type":"uint256"}],"name":"DelegateVotesChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"provider","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"locktime","type":"uint256"},{"indexed":false,"internalType":"enum VotingEscrow.DepositType","name":"deposit_type","type":"uint8"},{"indexed":false,"internalType":"uint256","name":"ts","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"address","name":"migrator","type":"address"},{"indexed":false,"internalType":"address","name":"owner","type":"address"}],"name":"Migrate","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"prevSupply","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"supply","type":"uint256"}],"name":"Supply","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"provider","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"ts","type":"uint256"}],"name":"Withdraw","type":"event"},{"inputs":[],"name":"DELEGATION_TYPEHASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DOMAIN_TYPEHASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_DELEGATES","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PREVIOUS_IMPLEMENTATION","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"abstain","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"api","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_approved","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"artProxy","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_block","type":"uint256"}],"name":"balanceOfAtNFT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"balanceOfNFT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_t","type":"uint256"}],"name":"balanceOfNFTAt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"block_number","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"checkpoint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint32","name":"","type":"uint32"}],"name":"checkpoints","outputs":[{"internalType":"uint256","name":"timestamp","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_value","type":"uint256"},{"internalType":"uint256","name":"_lock_duration","type":"uint256"}],"name":"create_lock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_value","type":"uint256"},{"internalType":"uint256","name":"_lock_duration","type":"uint256"},{"internalType":"address","name":"_to","type":"address"}],"name":"create_lock_for","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"delegatee","type":"address"}],"name":"delegate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"delegatee","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"uint256","name":"expiry","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"delegateBySig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"delegator","type":"address"}],"name":"delegates","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"deposit_for","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"epoch","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"getPastTotalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"getPastVotes","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"getPastVotesIndex","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getVotes","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"get_last_user_slope","outputs":[{"internalType":"int128","name":"","type":"int128"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"increase_amount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_lock_duration","type":"uint256"}],"name":"increase_unlock_time","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token_addr","type":"address"},{"internalType":"address","name":"art_proxy","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"address","name":"_operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_spender","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"isApprovedOrOwner","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"locked","outputs":[{"components":[{"internalType":"int128","name":"amount","type":"int128"},{"internalType":"uint256","name":"end","type":"uint256"}],"internalType":"struct IVotingEscrow.LockedBalance","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"locked__end","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_from","type":"uint256"},{"internalType":"uint256","name":"_to","type":"uint256"}],"name":"merge","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"migrate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"nonces","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"numCheckpoints","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"ownership_change","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"loc","type":"uint256"}],"name":"point_history","outputs":[{"components":[{"internalType":"int128","name":"bias","type":"int128"},{"internalType":"int128","name":"slope","type":"int128"},{"internalType":"uint256","name":"ts","type":"uint256"},{"internalType":"uint256","name":"blk","type":"uint256"}],"internalType":"struct IVotingEscrow.Point","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_api","type":"address"}],"name":"setAPI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_operator","type":"address"},{"internalType":"bool","name":"_approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_proxy","type":"address"}],"name":"setArtProxy","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_team","type":"address"}],"name":"setTeam","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_voter","type":"address"}],"name":"setVoter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"slope_changes","outputs":[{"internalType":"int128","name":"","type":"int128"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"split","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"supply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"_interfaceID","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"team","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"uint256","name":"_tokenIndex","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_block","type":"uint256"}],"name":"totalSupplyAt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"t","type":"uint256"}],"name":"totalSupplyAtT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"user_point_epoch","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"loc","type":"uint256"}],"name":"user_point_history","outputs":[{"components":[{"internalType":"int128","name":"bias","type":"int128"},{"internalType":"int128","name":"slope","type":"int128"},{"internalType":"uint256","name":"ts","type":"uint256"},{"internalType":"uint256","name":"blk","type":"uint256"}],"internalType":"struct IVotingEscrow.Point","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_idx","type":"uint256"}],"name":"user_point_history__ts","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"version","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"voted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"voter","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"voting","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}] +{ + "Approval": "event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId)", + "ApprovalForAll": "event ApprovalForAll(address indexed owner, address indexed operator, bool approved)", + "DelegateChanged": "event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate)", + "DelegateVotesChanged": "event DelegateVotesChanged(address indexed delegate, uint256 previousBalance, uint256 newBalance)", + "Deposit": "event Deposit(address indexed provider, uint256 tokenId, uint256 value, uint256 indexed locktime, uint8 deposit_type, uint256 ts)", + "Initialized": "event Initialized(uint8 version)", + "Migrate": "event Migrate(uint256 indexed tokenId, address migrator, address owner)", + "Supply": "event Supply(uint256 prevSupply, uint256 supply)", + "Transfer": "event Transfer(address indexed from, address indexed to, uint256 indexed tokenId)", + "Withdraw": "event Withdraw(address indexed provider, uint256 tokenId, uint256 value, uint256 ts)", + "DELEGATION_TYPEHASH": "function DELEGATION_TYPEHASH() view returns (bytes32)", + "DOMAIN_TYPEHASH": "function DOMAIN_TYPEHASH() view returns (bytes32)", + "MAX_DELEGATES": "uint256:MAX_DELEGATES", + "PREVIOUS_IMPLEMENTATION": "address:PREVIOUS_IMPLEMENTATION", + "abstain": "function abstain(uint256 _tokenId)", + "api": "address:api", + "approve": "function approve(address _approved, uint256 _tokenId)", + "artProxy": "address:artProxy", + "balanceOf": "function balanceOf(address _owner) view returns (uint256)", + "balanceOfAtNFT": "function balanceOfAtNFT(uint256 _tokenId, uint256 _block) view returns (uint256)", + "balanceOfNFT": "function balanceOfNFT(uint256 _tokenId) view returns (uint256)", + "balanceOfNFTAt": "function balanceOfNFTAt(uint256 _tokenId, uint256 _t) view returns (uint256)", + "block_number": "uint256:block_number", + "checkpoint": "function checkpoint()", + "checkpoints": "function checkpoints(address, uint32) view returns (uint256 timestamp)", + "create_lock": "function create_lock(uint256 _value, uint256 _lock_duration) returns (uint256)", + "create_lock_for": "function create_lock_for(uint256 _value, uint256 _lock_duration, address _to) returns (uint256)", + "decimals": "uint8:decimals", + "delegate": "function delegate(address delegatee)", + "delegateBySig": "function delegateBySig(address delegatee, uint256 nonce, uint256 expiry, uint8 v, bytes32 r, bytes32 s)", + "delegates": "function delegates(address delegator) view returns (address)", + "deposit_for": "function deposit_for(uint256 _tokenId, uint256 _value)", + "epoch": "uint256:epoch", + "getApproved": "function getApproved(uint256 _tokenId) view returns (address)", + "getPastTotalSupply": "function getPastTotalSupply(uint256 timestamp) view returns (uint256)", + "getPastVotes": "function getPastVotes(address account, uint256 timestamp) view returns (uint256)", + "getPastVotesIndex": "function getPastVotesIndex(address account, uint256 timestamp) view returns (uint32)", + "getVotes": "function getVotes(address account) view returns (uint256)", + "get_last_user_slope": "function get_last_user_slope(uint256 _tokenId) view returns (int128)", + "increase_amount": "function increase_amount(uint256 _tokenId, uint256 _value)", + "increase_unlock_time": "function increase_unlock_time(uint256 _tokenId, uint256 _lock_duration)", + "initialize": "function initialize(address token_addr, address art_proxy)", + "isApprovedForAll": "function isApprovedForAll(address _owner, address _operator) view returns (bool)", + "isApprovedOrOwner": "function isApprovedOrOwner(address _spender, uint256 _tokenId) view returns (bool)", + "locked__end": "function locked__end(uint256 _tokenId) view returns (uint256)", + "merge": "function merge(uint256 _from, uint256 _to)", + "migrate": "function migrate(uint256 _tokenId)", + "name": "string:name", + "nonces": "function nonces(address) view returns (uint256)", + "numCheckpoints": "function numCheckpoints(address) view returns (uint32)", + "ownerOf": "function ownerOf(uint256 _tokenId) view returns (address)", + "ownership_change": "function ownership_change(uint256) view returns (uint256)", + "point_history": "function point_history(uint256 loc) view returns (tuple(int128 bias, int128 slope, uint256 ts, uint256 blk))", + "safeTransferFrom": "function safeTransferFrom(address _from, address _to, uint256 _tokenId, bytes _data)", + "setAPI": "function setAPI(address _api)", + "setApprovalForAll": "function setApprovalForAll(address _operator, bool _approved)", + "setArtProxy": "function setArtProxy(address _proxy)", + "setTeam": "function setTeam(address _team)", + "setVoter": "function setVoter(address _voter)", + "slope_changes": "function slope_changes(uint256) view returns (int128)", + "split": "function split(uint256[] amounts, uint256 _tokenId)", + "supply": "uint256:supply", + "supportsInterface": "function supportsInterface(bytes4 _interfaceID) view returns (bool)", + "symbol": "string:symbol", + "team": "address:team", + "token": "address:token", + "tokenId": "uint256:tokenId", + "tokenURI": "function tokenURI(uint256 _tokenId) view returns (string)", + "totalSupply": "uint256:totalSupply", + "totalSupplyAt": "function totalSupplyAt(uint256 _block) view returns (uint256)", + "totalSupplyAtT": "function totalSupplyAtT(uint256 t) view returns (uint256)", + "transferFrom": "function transferFrom(address _from, address _to, uint256 _tokenId)", + "user_point_epoch": "function user_point_epoch(uint256) view returns (uint256)", + "user_point_history": "function user_point_history(uint256 _tokenId, uint256 loc) view returns (tuple(int128 bias, int128 slope, uint256 ts, uint256 blk))", + "user_point_history__ts": "function user_point_history__ts(uint256 _tokenId, uint256 _idx) view returns (uint256)", + "version": "string:version", + "voted": "function voted(uint256) view returns (bool)", + "voter": "address:voter", + "voting": "function voting(uint256 _tokenId)", + "withdraw": "function withdraw(uint256 _tokenId)" +} \ No newline at end of file diff --git a/projects/tangible/abi/veTETU.json b/projects/tangible/abi/veTETU.json index 6418cd93b22..e3d2cdaf1d7 100644 --- a/projects/tangible/abi/veTETU.json +++ b/projects/tangible/abi/veTETU.json @@ -1 +1,93 @@ -[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"controller","type":"address"},{"indexed":false,"internalType":"uint256","name":"ts","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"block","type":"uint256"}],"name":"ContractInitialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"stakingToken","type":"address"},{"indexed":true,"internalType":"address","name":"provider","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"locktime","type":"uint256"},{"indexed":false,"internalType":"enum IVeTetu.DepositType","name":"depositType","type":"uint8"},{"indexed":false,"internalType":"uint256","name":"ts","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_type","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timeToExecute","type":"uint256"}],"name":"GovActionAnnounced","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"stakingToken","type":"address"},{"indexed":true,"internalType":"address","name":"provider","type":"address"},{"indexed":false,"internalType":"uint256","name":"from","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"to","type":"uint256"}],"name":"Merged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"},{"indexed":false,"internalType":"address","name":"oldLogic","type":"address"}],"name":"RevisionIncreased","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"parentTokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newTokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"percent","type":"uint256"}],"name":"Split","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"value","type":"address"},{"indexed":false,"internalType":"uint256","name":"weight","type":"uint256"}],"name":"StakingTokenAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"value","type":"address"}],"name":"TransferWhitelisted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"stakingToken","type":"address"},{"indexed":true,"internalType":"address","name":"provider","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"ts","type":"uint256"}],"name":"Withdraw","type":"event"},{"inputs":[],"name":"CONTROLLABLE_VERSION","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"GOV_ACTION_TIME_LOCK","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_ATTACHMENTS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"VE_VERSION","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"_deprecated_voted","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"abstain","outputs":[],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"weight","type":"uint256"}],"name":"addToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"enum VeTetu.TimeLockType","name":"_type","type":"uint8"}],"name":"announceAction","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_approved","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"attachToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"attachments","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_block","type":"uint256"}],"name":"balanceOfAtNFT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"balanceOfNFT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_t","type":"uint256"}],"name":"balanceOfNFTAt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"blockTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"bool","name":"status","type":"bool"}],"name":"changeTokenFarmingAllowanceStatus","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"checkpoint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"controller","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"},{"internalType":"uint256","name":"_lockDuration","type":"uint256"}],"name":"createLock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"},{"internalType":"uint256","name":"_lockDuration","type":"uint256"},{"internalType":"address","name":"_to","type":"address"}],"name":"createLockFor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"created","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"createdBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"detachToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"emergencyWithdrawStakedTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"epoch","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"getLastUserSlope","outputs":[{"internalType":"int128","name":"","type":"int128"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"slot","type":"uint256"}],"name":"getSlot","outputs":[{"internalType":"bytes32","name":"result","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"enum VeTetu.TimeLockType","name":"","type":"uint8"}],"name":"govActionTimeLock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"increaseAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"oldLogic","type":"address"}],"name":"increaseRevision","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_lockDuration","type":"uint256"}],"name":"increaseUnlockTime","outputs":[{"internalType":"uint256","name":"power","type":"uint256"},{"internalType":"uint256","name":"unlockDate","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token_","type":"address"},{"internalType":"uint256","name":"weight","type":"uint256"},{"internalType":"address","name":"controller_","type":"address"}],"name":"init","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"address","name":"_operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_spender","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"isApprovedOrOwner","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_value","type":"address"}],"name":"isController","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_value","type":"address"}],"name":"isGovernance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isValidToken","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"isVoted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isWhitelistedTransfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"lockedAmounts","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"lockedDerivedAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"lockedEnd","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_from","type":"uint256"},{"internalType":"uint256","name":"_to","type":"uint256"}],"name":"merge","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"ownerToOperators","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"ownershipChange","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"platformVoter","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_loc","type":"uint256"}],"name":"pointHistory","outputs":[{"components":[{"internalType":"int128","name":"bias","type":"int128"},{"internalType":"int128","name":"slope","type":"int128"},{"internalType":"uint256","name":"ts","type":"uint256"},{"internalType":"uint256","name":"blk","type":"uint256"}],"internalType":"struct IVeTetu.Point","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"previousImplementation","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"revision","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_operator","type":"address"},{"internalType":"bool","name":"_approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"slopeChanges","outputs":[{"internalType":"int128","name":"","type":"int128"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"percent","type":"uint256"}],"name":"split","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"stakeAvailableTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"_interfaceID","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"uint256","name":"_tokenIndex","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tokenToOwnerIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"tokenWeights","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tokens","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokensLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_block","type":"uint256"}],"name":"totalSupplyAt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"t","type":"uint256"}],"name":"totalSupplyAtT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"userPointEpoch","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_loc","type":"uint256"}],"name":"userPointHistory","outputs":[{"components":[{"internalType":"int128","name":"bias","type":"int128"},{"internalType":"int128","name":"slope","type":"int128"},{"internalType":"uint256","name":"ts","type":"uint256"},{"internalType":"uint256","name":"blk","type":"uint256"}],"internalType":"struct IVeTetu.Point","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_idx","type":"uint256"}],"name":"userPointHistoryTs","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"voter","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"voting","outputs":[],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"value","type":"address"}],"name":"whitelistTransferFor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"stakingToken","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"withdrawAll","outputs":[],"stateMutability":"nonpayable","type":"function"}] +{ + "Approval": "event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId)", + "ApprovalForAll": "event ApprovalForAll(address indexed owner, address indexed operator, bool approved)", + "ContractInitialized": "event ContractInitialized(address controller, uint256 ts, uint256 block)", + "Deposit": "event Deposit(address indexed stakingToken, address indexed provider, uint256 tokenId, uint256 value, uint256 indexed locktime, uint8 depositType, uint256 ts)", + "GovActionAnnounced": "event GovActionAnnounced(uint256 _type, uint256 timeToExecute)", + "Initialized": "event Initialized(uint8 version)", + "Merged": "event Merged(address indexed stakingToken, address indexed provider, uint256 from, uint256 to)", + "RevisionIncreased": "event RevisionIncreased(uint256 value, address oldLogic)", + "Split": "event Split(uint256 parentTokenId, uint256 newTokenId, uint256 percent)", + "StakingTokenAdded": "event StakingTokenAdded(address value, uint256 weight)", + "Transfer": "event Transfer(address indexed from, address indexed to, uint256 indexed tokenId)", + "TransferWhitelisted": "event TransferWhitelisted(address value)", + "Withdraw": "event Withdraw(address indexed stakingToken, address indexed provider, uint256 tokenId, uint256 value, uint256 ts)", + "CONTROLLABLE_VERSION": "string:CONTROLLABLE_VERSION", + "GOV_ACTION_TIME_LOCK": "uint256:GOV_ACTION_TIME_LOCK", + "MAX_ATTACHMENTS": "uint256:MAX_ATTACHMENTS", + "VE_VERSION": "string:VE_VERSION", + "_deprecated_voted": "function _deprecated_voted(uint256) view returns (uint256)", + "abstain": "function abstain(uint256 _tokenId) pure", + "addToken": "function addToken(address token, uint256 weight)", + "announceAction": "function announceAction(uint8 _type)", + "approve": "function approve(address _approved, uint256 _tokenId)", + "attachToken": "function attachToken(uint256 _tokenId)", + "attachments": "function attachments(uint256) view returns (uint256)", + "balanceOf": "function balanceOf(address _owner) view returns (uint256)", + "balanceOfAtNFT": "function balanceOfAtNFT(uint256 _tokenId, uint256 _block) view returns (uint256)", + "balanceOfNFT": "function balanceOfNFT(uint256 _tokenId) view returns (uint256)", + "balanceOfNFTAt": "function balanceOfNFTAt(uint256 _tokenId, uint256 _t) view returns (uint256)", + "blockTimestamp": "uint256:blockTimestamp", + "changeTokenFarmingAllowanceStatus": "function changeTokenFarmingAllowanceStatus(address _token, bool status)", + "checkpoint": "function checkpoint()", + "controller": "address:controller", + "createLock": "function createLock(address _token, uint256 _value, uint256 _lockDuration) returns (uint256)", + "createLockFor": "function createLockFor(address _token, uint256 _value, uint256 _lockDuration, address _to) returns (uint256)", + "created": "uint256:created", + "createdBlock": "uint256:createdBlock", + "detachToken": "function detachToken(uint256 _tokenId)", + "emergencyWithdrawStakedTokens": "function emergencyWithdrawStakedTokens(address _token)", + "epoch": "uint256:epoch", + "getApproved": "function getApproved(uint256 _tokenId) view returns (address)", + "getLastUserSlope": "function getLastUserSlope(uint256 _tokenId) view returns (int128)", + "getSlot": "function getSlot(uint256 slot) view returns (bytes32 result)", + "govActionTimeLock": "function govActionTimeLock(uint8) view returns (uint256)", + "increaseAmount": "function increaseAmount(address _token, uint256 _tokenId, uint256 _value)", + "increaseRevision": "function increaseRevision(address oldLogic)", + "increaseUnlockTime": "function increaseUnlockTime(uint256 _tokenId, uint256 _lockDuration) returns (uint256 power, uint256 unlockDate)", + "init": "function init(address token_, uint256 weight, address controller_)", + "isApprovedForAll": "function isApprovedForAll(address _owner, address _operator) view returns (bool)", + "isApprovedOrOwner": "function isApprovedOrOwner(address _spender, uint256 _tokenId) view returns (bool)", + "isController": "function isController(address _value) view returns (bool)", + "isGovernance": "function isGovernance(address _value) view returns (bool)", + "isValidToken": "function isValidToken(address) view returns (bool)", + "isVoted": "function isVoted(uint256 _tokenId) view returns (bool)", + "isWhitelistedTransfer": "function isWhitelistedTransfer(address) view returns (bool)", + "lockedDerivedAmount": "function lockedDerivedAmount(uint256) view returns (uint256)", + "lockedEnd": "function lockedEnd(uint256) view returns (uint256)", + "merge": "function merge(uint256 _from, uint256 _to)", + "name": "string:name", + "ownerOf": "function ownerOf(uint256 _tokenId) view returns (address)", + "ownerToOperators": "function ownerToOperators(address, address) view returns (bool)", + "ownershipChange": "function ownershipChange(uint256) view returns (uint256)", + "platformVoter": "address:platformVoter", + "pointHistory": "function pointHistory(uint256 _loc) view returns (tuple(int128 bias, int128 slope, uint256 ts, uint256 blk))", + "previousImplementation": "address:previousImplementation", + "revision": "uint256:revision", + "safeTransferFrom": "function safeTransferFrom(address _from, address _to, uint256 _tokenId, bytes _data)", + "setApprovalForAll": "function setApprovalForAll(address _operator, bool _approved)", + "slopeChanges": "function slopeChanges(uint256) view returns (int128)", + "split": "function split(uint256 _tokenId, uint256 percent)", + "stakeAvailableTokens": "function stakeAvailableTokens(address _token)", + "supportsInterface": "function supportsInterface(bytes4 _interfaceID) view returns (bool)", + "symbol": "string:symbol", + "tokenId": "uint256:tokenId", + "tokenOfOwnerByIndex": "function tokenOfOwnerByIndex(address _owner, uint256 _tokenIndex) view returns (uint256)", + "tokenToOwnerIndex": "function tokenToOwnerIndex(uint256) view returns (uint256)", + "tokenURI": "function tokenURI(uint256 _tokenId) view returns (string)", + "tokenWeights": "function tokenWeights(address) view returns (uint256)", + "tokens": "function tokens(uint256) view returns (address)", + "tokensLength": "uint256:tokensLength", + "totalSupply": "uint256:totalSupply", + "totalSupplyAt": "function totalSupplyAt(uint256 _block) view returns (uint256)", + "totalSupplyAtT": "function totalSupplyAtT(uint256 t) view returns (uint256)", + "transferFrom": "function transferFrom(address, address, uint256) pure", + "userPointEpoch": "function userPointEpoch(uint256) view returns (uint256)", + "userPointHistory": "function userPointHistory(uint256 _tokenId, uint256 _loc) view returns (tuple(int128 bias, int128 slope, uint256 ts, uint256 blk))", + "userPointHistoryTs": "function userPointHistoryTs(uint256 _tokenId, uint256 _idx) view returns (uint256)", + "voter": "address:voter", + "voting": "function voting(uint256 _tokenId) pure", + "whitelistTransferFor": "function whitelistTransferFor(address value)", + "withdraw": "function withdraw(address stakingToken, uint256 _tokenId)", + "withdrawAll": "function withdrawAll(uint256 _tokenId)" +} \ No newline at end of file diff --git a/projects/tangible/index.js b/projects/tangible/index.js index e3b20deeb16..e8999a56ea0 100644 --- a/projects/tangible/index.js +++ b/projects/tangible/index.js @@ -1,5 +1,5 @@ const ADDRESSES = require('../helper/coreAssets.json') -const { sumTokensExport } = require('../helper/unwrapLPs') +const { sumTokensExport, sumTokens2, } = require('../helper/unwrapLPs') const { getConfig } = require('../helper/cache') const { getInsuranceFundValue, insuranceTokens } = require("./insurance-fund-polygon"); const { getInsuranceFundValueOp } = require("./insurance-fund-optimism"); @@ -27,13 +27,9 @@ const insuranceConfig = { tokens: [ADDRESSES.null, CVX_ETH], }, polygon: { - owner: '0xD1758fbABAE91c805BE76D56548A584EF68B81f0', + owners: ['0xD1758fbABAE91c805BE76D56548A584EF68B81f0', '0x632572cfAa39330c8F0211b5B33BC86135E48b5f'], tokens: Object.values(insuranceTokens), }, - polygon1: { - owner: '0x632572cfAa39330c8F0211b5B33BC86135E48b5f', - tokens: [...Object.values(insuranceTokens), ADDRESSES.null], - }, optimism: { owner: '0x7f922242d919feF0da0e40e3Cb4B7f7D3c97a63e', tokens: [ADDRESSES.null, ADDRESSES.optimism.OP, ADDRESSES.optimism.USDC], @@ -51,10 +47,10 @@ const insuranceConfig = { async function tvl(_, _b, _cb, { api }) { await Promise.all([ treasuryTvl, - insuranceTvl, rwaTVL, tangiblePOL, - tangibleCaviar + tangibleCaviar, + insuranceTvl, ].map(fn => fn(api))) } @@ -83,20 +79,19 @@ async function treasuryTvl(api) { target: ADDRESS_PROVIDER_ADDRESS, params: ["0xc83e4fd410f80be983b083c99898391186b0893751a26a9a1e5fdcb9d4129701"],//keccak of USDRTreasury }) - await api.sumTokens({ owner: usdrTreasuryAddress, tokens: [ADDRESSES.polygon.DAI, TNGBL] }) // TNGBL should be part, same as for Tera/Luna, Synthetics/sUSD + await api.sumTokens({ owner: usdrTreasuryAddress, tokens: [ADDRESSES.polygon.DAI,] }) } async function insuranceTvl(api) { - await unwrapBalancerToken(api, insuranceConfig.polygon.owner); - await unwrapBalancerToken(api, insuranceConfig.polygon1.owner); - await getInsuranceFundValue(api, insuranceConfig.polygon.owner); - await getInsuranceFundValue(api, insuranceConfig.polygon1.owner); - + await Promise.all(insuranceConfig.polygon.owners.map(i => (async () => { + await unwrapBalancerToken(api, i); + await getInsuranceFundValue(api, i); + })())) } async function insuranceTvlOp(api) { await getInsuranceFundValueOp(api, insuranceConfig.optimism.owner); - await api.sumTokens({ owner: insuranceConfig.optimism.owner, tokens: insuranceConfig.optimism.tokens }) + return sumTokens2({ api, ...insuranceConfig.optimism }) } async function insuranceTvlBase(api) { @@ -106,7 +101,7 @@ async function insuranceTvlBase(api) { async function insuranceTvlArb(api) { await getInsuranceFundValueArb(api, insuranceConfig.arbitrum.owner); - await api.sumTokens({ owner: insuranceConfig.arbitrum.owner, tokens: insuranceConfig.arbitrum.tokens }) + return sumTokens2({ api, ...insuranceConfig.arbitrum }) } async function rwaTVL(api) { @@ -152,14 +147,9 @@ async function rwaTVL(api) { async function tangibleCaviar(api) { // now fetch locked pearl in Caviar - const pearlAmountInCaviar = await api.call({ - abi: getPearlBalanceCaviar, - target: CAVIAR_STRATEGY, - params: [], - }) + const pearlAmountInCaviar = await api.call({ abi: getPearlBalanceCaviar, target: CAVIAR_STRATEGY, }) api.add(PEARL, pearlAmountInCaviar); - } async function tangiblePOL(api) { @@ -188,14 +178,14 @@ async function tangiblePOL(api) { ).map(i => i.address) const [lpBals, tokens0, tokens1, totalSupplies, reserves] = await Promise.all([ - api.multiCall({ abi: getPair, target: pearlPairApi, calls: pools.map(p => ({ params: [p, liquidityManager]})) }), + api.multiCall({ abi: getPair, target: pearlPairApi, calls: pools.map(p => ({ params: [p, liquidityManager] })) }), api.multiCall({ abi: 'address:token0', calls: pools }), api.multiCall({ abi: 'address:token1', calls: pools }), api.multiCall({ abi: 'uint256:totalSupply', calls: pools }), api.multiCall({ abi: "function getReserves() view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast)", calls: pools }), ]) - const blacklist = [USDR] + const blacklist = [USDR, TNGBL] lpBals.forEach((lpBal, i) => { const ratio = lpBal.account_gauge_balance / totalSupplies[i] if (!blacklist.includes(tokens0[i].toLowerCase())) @@ -211,9 +201,9 @@ module.exports = { misrepresentedTokens: true, polygon: { tvl, }, ethereum: { tvl: sumTokensExport(insuranceConfig.ethereum) }, - optimism: { tvl: tvlOp }, base: { tvl: tvlBase }, arbitrum: { tvl: tvlArb }, + optimism: { tvl: tvlOp }, } async function unwrapBalancerToken(api, owner) { diff --git a/projects/tangible/insurance-fund-arbitrum.js b/projects/tangible/insurance-fund-arbitrum.js index c8d8089c63e..ea2e3aca6d3 100644 --- a/projects/tangible/insurance-fund-arbitrum.js +++ b/projects/tangible/insurance-fund-arbitrum.js @@ -1,44 +1,17 @@ -const ethers = require('ethers'); - const VE_CHR_ABI = require('./abi/VeChrNFT.json'); -const MULTICALL_ABI = require('./abi/Multicall3.json'); - -const provider = new ethers.providers.JsonRpcProvider('https://arb1.arbitrum.io/rpc'); -const multicall = new ethers.Contract('0xcA11bde05977b3631167028862bE2a173976CA11', MULTICALL_ABI, provider); const insuranceTokensArb = { - CHR: '0x15b2fb8f08e4ac1ce019eadae02ee92aedf06851', + CHR: '0x15b2fb8f08e4ac1ce019eadae02ee92aedf06851', } const VE_CHR_NFT = "0x9A01857f33aa382b1d5bb96C3180347862432B0d"; async function getInsuranceFundValueArb(api, INSURANCE_FUND) { - const veChrContract = new ethers.Contract(VE_CHR_NFT, VE_CHR_ABI, provider); - const veChr = new ethers.utils.Interface(VE_CHR_ABI); - const tokenIds = await veChrContract.tokensOfOwner(INSURANCE_FUND) - - - let calls = []; - - for (let i = 0; i < tokenIds.length; i++) { - calls.push({ - target: VE_CHR_NFT, - callData: veChr.encodeFunctionData('locked', [tokenIds[i]]) - }) - } - - const { returnData: aeroAmounts } = await multicall.callStatic.aggregate(calls); - - let tokenAmountTotal = ethers.BigNumber.from(0); - for (let i = 0; i < aeroAmounts.length; i++) { - const [locked] = veChr.decodeFunctionResult('locked', aeroAmounts[i]); - tokenAmountTotal = tokenAmountTotal.add(locked); - } - - api.add(insuranceTokensArb.CHR, tokenAmountTotal.toString()) + const tokenIds = await api.call({ abi: VE_CHR_ABI.tokensOfOwner, target: VE_CHR_NFT, params: INSURANCE_FUND }) + const bals = await api.multiCall({ abi: VE_CHR_ABI.locked, calls: tokenIds, target: VE_CHR_NFT, }) + bals.forEach(i => api.add(insuranceTokensArb.CHR, i.amount)) } module.exports = { - getInsuranceFundValueArb, - insuranceTokensArb + getInsuranceFundValueArb, } diff --git a/projects/tangible/insurance-fund-base.js b/projects/tangible/insurance-fund-base.js index 86841faa599..ecda71f34ad 100644 --- a/projects/tangible/insurance-fund-base.js +++ b/projects/tangible/insurance-fund-base.js @@ -1,60 +1,19 @@ -const ethers = require('ethers'); - -const VE_AERO_ABI = require('./abi/VeVeloNFT.json'); -const MULTICALL_ABI = require('./abi/Multicall3.json'); - -const provider = new ethers.providers.JsonRpcProvider('https://developer-access-mainnet.base.org'); -const multicall = new ethers.Contract('0xcA11bde05977b3631167028862bE2a173976CA11', MULTICALL_ABI, provider); +const VE_VELO_ABI = require('./abi/VeVeloNFT.json'); +const { createIncrementArray } = require('../helper/utils'); const insuranceTokensBase = { - AERO: '0x940181a94A35A4569E4529A3CDfB74e38FD98631', + AERO: '0x940181a94A35A4569E4529A3CDfB74e38FD98631', } const VE_AERO_NFT = "0xeBf418Fe2512e7E6bd9b87a8F0f294aCDC67e6B4"; async function getInsuranceFundValueBase(api, INSURANCE_FUND) { - const veAeroContract = new ethers.Contract(VE_AERO_NFT, VE_AERO_ABI, provider); - const totalTokenAmount = await veAeroContract.balanceOf(INSURANCE_FUND) - const veAero = new ethers.utils.Interface(VE_AERO_ABI); - - let calls = []; - - for (let i = 0; i < totalTokenAmount; i++) { - calls.push({ - target: VE_AERO_NFT, - callData: veAero.encodeFunctionData('ownerToNFTokenIdList', [INSURANCE_FUND, i]) - }) - } - - const { returnData: veNftTokens } = await multicall.callStatic.aggregate(calls); - - const tokenIds = [] - for (let i = 0; i < veNftTokens.length; i++) { - const [tokenId] = veAero.decodeFunctionResult('ownerToNFTokenIdList', veNftTokens[i]); - tokenIds.push(tokenId); - } - - calls = []; - - for (let i = 0; i < tokenIds.length; i++) { - calls.push({ - target: VE_AERO_NFT, - callData: veAero.encodeFunctionData('locked', [tokenIds[i]]) - }) - } - - const { returnData: aeroAmounts } = await multicall.callStatic.aggregate(calls); - - let tokenAmountTotal = ethers.BigNumber.from(0); - for (let i = 0; i < aeroAmounts.length; i++) { - const [locked] = veAero.decodeFunctionResult('locked', aeroAmounts[i]); - tokenAmountTotal = tokenAmountTotal.add(locked.amount); - } - - api.add(insuranceTokensBase.AERO, tokenAmountTotal.toString()) + const count = await api.call({ abi: 'erc20:balanceOf', target: VE_AERO_NFT, params: INSURANCE_FUND }) + const tokenIds = await api.multiCall({ abi: VE_VELO_ABI.ownerToNFTokenIdList, calls: createIncrementArray(count).map(i => ({ params: [INSURANCE_FUND, i] })), target: VE_AERO_NFT }) + const bals = await api.multiCall({ abi: VE_VELO_ABI.locked, calls: tokenIds, target: VE_AERO_NFT }) + bals.forEach(i => api.add(insuranceTokensBase.AERO, i.amount)) } module.exports = { - getInsuranceFundValueBase, - insuranceTokensBase + getInsuranceFundValueBase, } diff --git a/projects/tangible/insurance-fund-optimism.js b/projects/tangible/insurance-fund-optimism.js index d3e9a050999..b71366c3bf4 100644 --- a/projects/tangible/insurance-fund-optimism.js +++ b/projects/tangible/insurance-fund-optimism.js @@ -1,60 +1,19 @@ -const ethers = require('ethers'); - const VE_VELO_ABI = require('./abi/VeVeloNFT.json'); -const MULTICALL_ABI = require('./abi/Multicall3.json'); - -const provider = new ethers.providers.JsonRpcProvider('https://mainnet.optimism.io'); -const multicall = new ethers.Contract('0xcA11bde05977b3631167028862bE2a173976CA11', MULTICALL_ABI, provider); +const { createIncrementArray } = require('../helper/utils'); const insuranceTokensOp = { - VELO: '0x9560e827af36c94d2ac33a39bce1fe78631088db', + VELO: '0x9560e827af36c94d2ac33a39bce1fe78631088db', } const VE_VELO_NFT = "0xFAf8FD17D9840595845582fCB047DF13f006787d"; async function getInsuranceFundValueOp(api, INSURANCE_FUND) { - const veVeloContract = new ethers.Contract(VE_VELO_NFT, VE_VELO_ABI, provider); - const totalTokenAmount = await veVeloContract.balanceOf(INSURANCE_FUND) - const veVelo = new ethers.utils.Interface(VE_VELO_ABI); - - let calls = []; - - for (let i = 0; i < totalTokenAmount; i++) { - calls.push({ - target: VE_VELO_NFT, - callData: veVelo.encodeFunctionData('ownerToNFTokenIdList', [INSURANCE_FUND, i]) - }) - } - - const { returnData: veNftTokens } = await multicall.callStatic.aggregate(calls); - - const tokenIds = [] - for (let i = 0; i < veNftTokens.length; i++) { - const [tokenId] = veVelo.decodeFunctionResult('ownerToNFTokenIdList', veNftTokens[i]); - tokenIds.push(tokenId); - } - - calls = []; - - for (let i = 0; i < tokenIds.length; i++) { - calls.push({ - target: VE_VELO_NFT, - callData: veVelo.encodeFunctionData('locked', [tokenIds[i]]) - }) - } - - const { returnData: veloAmounts } = await multicall.callStatic.aggregate(calls); - - let tokenAmountTotal = ethers.BigNumber.from(0); - for (let i = 0; i < veloAmounts.length; i++) { - const [locked] = veVelo.decodeFunctionResult('locked', veloAmounts[i]); - tokenAmountTotal = tokenAmountTotal.add(locked.amount); - } - - api.add(insuranceTokensOp.VELO, tokenAmountTotal.toString()) + const count = await api.call({ abi: 'erc20:balanceOf', target: VE_VELO_NFT, params: INSURANCE_FUND }) + const tokenIds = await api.multiCall({ abi: VE_VELO_ABI.ownerToNFTokenIdList, calls: createIncrementArray(count).map(i => ({ params: [INSURANCE_FUND, i]})), target: VE_VELO_NFT }) + const bals = await api.multiCall({ abi: VE_VELO_ABI.locked, calls: tokenIds, target: VE_VELO_NFT }) + bals.forEach(i => api.add(insuranceTokensOp.VELO, i.amount)) } module.exports = { - getInsuranceFundValueOp, - insuranceTokensOp + getInsuranceFundValueOp, } diff --git a/projects/tangible/insurance-fund-polygon.js b/projects/tangible/insurance-fund-polygon.js index e094ffef180..3bafdc8d30b 100644 --- a/projects/tangible/insurance-fund-polygon.js +++ b/projects/tangible/insurance-fund-polygon.js @@ -1,53 +1,50 @@ const ethers = require('ethers'); - -const { default: axios } = require('axios'); -const { unwrapUniswapV3NFTs } = require('../helper/unwrapLPs') +const VE_VELO_ABI = require('./abi/VeVeloNFT.json'); +const { createIncrementArray } = require('../helper/utils'); +const { sumTokens2 } = require('../helper/unwrapLPs') const BALANCER_POOL_ABI = require('./abi/BalancerPool.json'); const CAVIAR_CHEF_ABI = require('./abi/CaviarChef.json'); -const MULTICALL_ABI = require('./abi/Multicall3.json'); const PAIR_FACTORY_ABI = require('./abi/PairFactory.json'); const VAULT_ABI = require('./abi/Vault.json'); const VE_PEARL_ABI = require('./abi/vePEARL.json'); const VE_TETU_ABI = require('./abi/veTETU.json'); const VOTER_ABI = require('./abi/Voter.json'); -const provider = new ethers.providers.JsonRpcProvider('https://polygon-rpc.com'); -const multicall = new ethers.Contract('0xcA11bde05977b3631167028862bE2a173976CA11', MULTICALL_ABI, provider); const ERC20_ABI = [ - 'function balanceOf(address) view returns (uint256)' + 'function balanceOf(address) view returns (uint256)' ]; const PAIR_ABI = [ - 'function balanceOf(address) view returns (uint256)', - 'function getReserves() view returns (uint256, uint256, uint256)', - 'function tokens() view returns (address, address)', - 'function totalSupply() view returns (uint256)', + 'function balanceOf(address) view returns (uint256)', + 'function getReserves() view returns (uint256, uint256, uint256)', + 'function tokens() view returns (address, address)', + 'function totalSupply() view returns (uint256)', ]; const erc20 = new ethers.utils.Interface(ERC20_ABI); const insuranceTokens = { - CAVIAR: '0x6AE96Cc93331c19148541D4D2f31363684917092', - DAI: '0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063', - PEARL: '0x7238390d5f6F64e67c3211C343A410E2A3DEc142', - STAR: '0xC19669A405067927865B40Ea045a2baabbbe57f5', - STMATIC: '0x3A58a54C066FdC0f2D55FC9C89F0415C92eBf3C4', - TETU: '0x255707B70BF90aa112006E1b07B9AeA6De021424', - TNGBL: '0x49e6A20f1BBdfEeC2a8222E052000BbB14EE6007', - USDC: '0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174', - USDR: '0x40379a439D4F6795B6fc9aa5687dB461677A2dBa', - USDT: '0xc2132D05D31c914a87C6611C10748AEb04B58e8F', - WETH: '0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619', - WMATIC: '0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270', - WUSDR: '0x00e8c0E92eB3Ad88189E7125Ec8825eDc03Ab265', + CAVIAR: '0x6AE96Cc93331c19148541D4D2f31363684917092', + DAI: '0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063', + PEARL: '0x7238390d5f6F64e67c3211C343A410E2A3DEc142', + STAR: '0xC19669A405067927865B40Ea045a2baabbbe57f5', + STMATIC: '0x3A58a54C066FdC0f2D55FC9C89F0415C92eBf3C4', + TETU: '0x255707B70BF90aa112006E1b07B9AeA6De021424', + TNGBL: '0x49e6A20f1BBdfEeC2a8222E052000BbB14EE6007', + USDC: '0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174', + USDR: '0x40379a439D4F6795B6fc9aa5687dB461677A2dBa', + USDT: '0xc2132D05D31c914a87C6611C10748AEb04B58e8F', + WETH: '0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619', + WMATIC: '0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270', + WUSDR: '0x00e8c0E92eB3Ad88189E7125Ec8825eDc03Ab265', + TETU_BPT: '0xE2f706EF1f7240b803AAe877C9C762644bb808d8', } const UTILITY_TOKENS = { - TETU_BPT: '0xE2f706EF1f7240b803AAe877C9C762644bb808d8', - VE_PEARL: '0x017A26B18E4DA4FE1182723a39311e67463CF633', - VE_TETU: '0x6FB29DD17fa6E27BD112Bc3A2D0b8dae597AeDA4', + VE_PEARL: '0x017A26B18E4DA4FE1182723a39311e67463CF633', + VE_TETU: '0x6FB29DD17fa6E27BD112Bc3A2D0b8dae597AeDA4', } const TNGBL_UNIV3_LIQUIDITY = "0xDC8a5c5975726235402cFac9B28268EEccd42813"; @@ -59,240 +56,61 @@ const PEARL_PAIR_FACTORY = '0xEaF188cdd22fEEBCb345DCb529Aa18CA9FcB4FBd'; const PEARL_VOTER = '0xa26C2A6BfeC5512c13Ae9EacF41Cb4319d30cCF0'; async function getInsuranceFundValue(api, INSURANCE_FUND) { - const tokenAddresses = [...Object.values(insuranceTokens), ...Object.values(UTILITY_TOKENS)]; - const tokenBalances = tokenAddresses.map(() => ethers.constants.Zero); - - let calls = []; - - for (let i = 0; i < tokenAddresses.length; i++) { - calls.push({ - target: tokenAddresses[i], - callData: erc20.encodeFunctionData('balanceOf', [INSURANCE_FUND]) - }) - } - - const { returnData: balanceData } = await multicall.callStatic.aggregate(calls); - - for (let i = 0; i < balanceData.length; i++) { - const [tokenBalance] = erc20.decodeFunctionResult('balanceOf', balanceData[i]); - tokenBalances[i] = tokenBalances[i].add(tokenBalance); - } - - const vePEARL = new ethers.utils.Interface(VE_PEARL_ABI); - const vePEARLBalance = tokenBalances[tokenAddresses.indexOf(UTILITY_TOKENS.VE_PEARL)].toNumber(); - - calls = []; - - for (let i = 0; i < vePEARLBalance; i++) { - calls.push({ - target: UTILITY_TOKENS.VE_PEARL, - callData: vePEARL.encodeFunctionData('tokenOfOwnerByIndex', [INSURANCE_FUND, i]) - }) - } - - const { returnData: pearlTokenIdData } = await multicall.callStatic.aggregate(calls); - - calls = []; - - for (let i = 0; i < pearlTokenIdData.length; i++) { - const [tokenId] = vePEARL.decodeFunctionResult('tokenOfOwnerByIndex', pearlTokenIdData[i]); - calls.push({ - target: UTILITY_TOKENS.VE_PEARL, - callData: vePEARL.encodeFunctionData('locked', [tokenId]) - }) - } - - const { returnData: lockedPearlData } = await multicall.callStatic.aggregate(calls); - - const pearlBalance = lockedPearlData - .map((data) => vePEARL.decodeFunctionResult('locked', data)) - .flat() - .map((t) => t.amount) - .reduce((a, b) => a.add(b), ethers.constants.Zero); - - const pearlTokenIndex = tokenAddresses.indexOf(insuranceTokens.PEARL); - tokenBalances[pearlTokenIndex] = tokenBalances[pearlTokenIndex].add(pearlBalance); - - const veTETU = new ethers.utils.Interface(VE_TETU_ABI); - const veTETUBalance = tokenBalances[tokenAddresses.indexOf(UTILITY_TOKENS.VE_TETU)].toNumber(); - - calls = []; - - for (let i = 0; i < veTETUBalance; i++) { - calls.push({ - target: UTILITY_TOKENS.VE_TETU, - callData: veTETU.encodeFunctionData('tokenOfOwnerByIndex', [INSURANCE_FUND, i]) - }) - } - - const { returnData: tetuTokenIdData } = await multicall.callStatic.aggregate(calls); - - calls = []; - - for (let i = 0; i < tetuTokenIdData.length; i++) { - const [tokenId] = veTETU.decodeFunctionResult('tokenOfOwnerByIndex', tetuTokenIdData[i]); - calls.push({ - target: UTILITY_TOKENS.VE_TETU, - callData: veTETU.encodeFunctionData('lockedAmounts', [tokenId, UTILITY_TOKENS.TETU_BPT]) - }) - } - - const { returnData: lockedBptData } = await multicall.callStatic.aggregate(calls); - - const pool = new ethers.Contract(UTILITY_TOKENS.TETU_BPT, BALANCER_POOL_ABI, provider); - const bptBalance = lockedBptData - .map((data) => veTETU.decodeFunctionResult('lockedAmounts', data)) - .flat() - .reduce((a, b) => a.add(b), await pool.balanceOf(INSURANCE_FUND)); - - const bptSupply = await pool.totalSupply(); - - const vault = new ethers.Contract(BALANCER_VAULT, VAULT_ABI, provider); - const poolId = await pool.getPoolId(); - - const {tokens, balances} = await vault.getPoolTokens(poolId); - - for (let i = 0; i < tokens.length; i++) { - const tokenIndex = tokenAddresses.indexOf(tokens[i]); - const balance = balances[i].mul(bptBalance).div(bptSupply); - tokenBalances[tokenIndex] = tokenBalances[tokenIndex].add(balance); - } - - const caviarChef = new ethers.utils.Interface(CAVIAR_CHEF_ABI); - - calls = [ - { - target: CAVIAR_STAKING_CHEF, - callData: caviarChef.encodeFunctionData('userInfo', [INSURANCE_FUND]) - }, - { - target: CAVIAR_STAKING_CHEF, - callData: caviarChef.encodeFunctionData('pendingReward', [INSURANCE_FUND]) - }, - { - target: CAVIAR_STAKING_CHEF, - callData: caviarChef.encodeFunctionData('rewardToken') - }, - { - target: CAVIAR_REBASE_CHEF, - callData: caviarChef.encodeFunctionData('pendingReward', [INSURANCE_FUND]) - }, - { - target: CAVIAR_REBASE_CHEF, - callData: caviarChef.encodeFunctionData('rewardToken') - }, - ]; - - const { returnData: caviarData } = await multicall.callStatic.aggregate(calls); - - const [stakingAmount] = caviarChef.decodeFunctionResult('userInfo', caviarData[0]); - const [pendingStakingReward] = caviarChef.decodeFunctionResult('pendingReward', caviarData[1]); - const [stakingRewardToken] = caviarChef.decodeFunctionResult('rewardToken', caviarData[2]); - const [pendingRebaseReward] = caviarChef.decodeFunctionResult('pendingReward', caviarData[3]); - const [rebaseRewardToken] = caviarChef.decodeFunctionResult('rewardToken', caviarData[4]); - - const caviarTokenIndex = tokenAddresses.indexOf(insuranceTokens.CAVIAR); - const stakingRewardTokenIndex = tokenAddresses.indexOf(stakingRewardToken); - const rebaseRewardTokenIndex = tokenAddresses.indexOf(rebaseRewardToken); - - tokenBalances[caviarTokenIndex] = tokenBalances[caviarTokenIndex].add(stakingAmount); - tokenBalances[stakingRewardTokenIndex] = tokenBalances[stakingRewardTokenIndex].add(pendingStakingReward); - tokenBalances[rebaseRewardTokenIndex] = tokenBalances[rebaseRewardTokenIndex].add(pendingRebaseReward); - - const coins = tokenAddresses.slice(0, Object.keys(insuranceTokens).length).map((a) => `polygon:${a}`); - const prices = await axios.get(`https://coins.llama.fi/prices/current/${coins.join(',')}`).then((res) => res.data.coins); - - const pearlPairFactory = new ethers.Contract(PEARL_PAIR_FACTORY, PAIR_FACTORY_ABI, provider); - const numPairs = await pearlPairFactory.allPairsLength().then((n) => n.toNumber()); - - calls = [...Array(numPairs).keys()].map((i) => { - return { - target: PEARL_PAIR_FACTORY, - callData: pearlPairFactory.interface.encodeFunctionData('allPairs', [i]) - } - }); - - const { returnData: pairData } = await multicall.callStatic.aggregate(calls); - - const voter = new ethers.utils.Interface(VOTER_ABI); - - calls = pairData.map((data) => { - const [pair] = pearlPairFactory.interface.decodeFunctionResult('allPairs', data); - return { - target: PEARL_VOTER, - callData: voter.encodeFunctionData('gauges', [pair]) - }; - }); - - const { returnData: gaugeData } = await multicall.callStatic.aggregate(calls); - - calls = gaugeData.map((data) => { - const [gauge] = voter.decodeFunctionResult('gauges', data); - return { - target: gauge, - callData: erc20.encodeFunctionData('balanceOf', [INSURANCE_FUND]) - }; - }); - - const { returnData: gaugeBalanceData } = await multicall.callStatic.aggregate(calls); - - const pair = await new ethers.utils.Interface(PAIR_ABI); - - for (let i = 0; i < numPairs; i++) { - const [gaugeBalance] = erc20.decodeFunctionResult('balanceOf', gaugeBalanceData[i]); - if (gaugeBalance.gt(ethers.constants.Zero)) { - const [pairAddress] = pearlPairFactory.interface.decodeFunctionResult('allPairs', pairData[i]); - calls = [ - { - target: pairAddress, - callData: pair.encodeFunctionData('tokens') - }, - { - target: pairAddress, - callData: pair.encodeFunctionData('totalSupply') - }, - { - target: pairAddress, - callData: pair.encodeFunctionData('getReserves') - }, - ]; - - const { returnData: pairMetaData } = await multicall.callStatic.aggregate(calls); - - const [token0, token1] = pair.decodeFunctionResult('tokens', pairMetaData[0]); - const [totalSupply] = pair.decodeFunctionResult('totalSupply', pairMetaData[1]); - const [reserve0, reserve1] = pair.decodeFunctionResult('getReserves', pairMetaData[2]); - - const token0Balance = reserve0.mul(gaugeBalance).div(totalSupply); - const token1Balance = reserve1.mul(gaugeBalance).div(totalSupply); - const token0Index = tokenAddresses.indexOf(token0); - const token1Index = tokenAddresses.indexOf(token1); + await Promise.all([ + addVePearlBal(api, INSURANCE_FUND), + addVeTetuBal(api, INSURANCE_FUND), + caviarTvl(api, INSURANCE_FUND), + pearlFactoryTvl(api, INSURANCE_FUND), + ]) + return sumTokens2({ api, owner: INSURANCE_FUND, tokens: Object.values(insuranceTokens), resolveUniV3: true, resolveLP: true, blacklistedTokens: [ + insuranceTokens.USDR, + insuranceTokens.WUSDR, + insuranceTokens.TNGBL, + ] }) +} - tokenBalances[token0Index] = tokenBalances[token0Index].add(token0Balance); - tokenBalances[token1Index] = tokenBalances[token1Index].add(token1Balance); - } - } +async function caviarTvl(api, owner) { + const [ + stakingAmount, pendingStakingReward, stakingRewardToken, pendingRebaseReward, rebaseRewardToken + ] = await Promise.all([ + api.call({ target: CAVIAR_STAKING_CHEF, abi: CAVIAR_CHEF_ABI.userInfo, params: [owner] }), + api.call({ target: CAVIAR_STAKING_CHEF, abi: CAVIAR_CHEF_ABI.pendingReward, params: [owner] }), + api.call({ target: CAVIAR_STAKING_CHEF, abi: CAVIAR_CHEF_ABI.rewardToken, }), + api.call({ target: CAVIAR_REBASE_CHEF, abi: CAVIAR_CHEF_ABI.pendingReward, params: [owner] }), + api.call({ target: CAVIAR_REBASE_CHEF, abi: CAVIAR_CHEF_ABI.rewardToken, }), + ]) + + // api.add(stakingRewardToken, pendingStakingReward); // it is wUSDR + api.add(rebaseRewardToken, pendingRebaseReward); + api.add(insuranceTokens.CAVIAR, stakingAmount.amount); +} - if (prices[`polygon:${insuranceTokens.CAVIAR}`] === undefined) { - prices[`polygon:${insuranceTokens.CAVIAR}`] = prices[`polygon:${insuranceTokens.PEARL}`]; - } +async function pearlFactoryTvl(api, owner) { + const pairs = await api.fetchList({ lengthAbi: 'uint256:allPairsLength', itemAbi: "function allPairs(uint256) view returns (address)", target: PEARL_PAIR_FACTORY }) + const gauges = await api.multiCall({ abi: "function gauges(address) view returns (address)", calls: pairs, target: PEARL_VOTER }) + const bals = await api.multiCall({ abi: 'erc20:balanceOf', calls: gauges.map(g => ({ target: g, params: owner })) }) + bals.forEach((bal, i) => { + if (pairs[i].toLowerCase() !== '0x0edc235693c20943780b76d79dd763236e94c751') + api.add(pairs[i], bal) + }) +} - //uniswap lps - const uniBal = await unwrapUniswapV3NFTs({owner: INSURANCE_FUND, chain:"polygon"}); - if (Object.keys(uniBal).length != 0) { - const addresses = Object.keys(uniBal); - const values = Object.values(uniBal); - for(let i = 0; i < addresses.length; i++){ - api.add(addresses[i].slice("polygon:".length), values[i]); - } - } +async function addVePearlBal(api, INSURANCE_FUND) { + const count = await api.call({ abi: 'erc20:balanceOf', target: UTILITY_TOKENS.VE_PEARL, params: INSURANCE_FUND }) + const tokenIds = await api.multiCall({ abi: VE_VELO_ABI.tokenOfOwnerByIndex, calls: createIncrementArray(count).map(i => ({ params: [INSURANCE_FUND, i] })), target: UTILITY_TOKENS.VE_PEARL }) + const bals = await api.multiCall({ abi: VE_VELO_ABI.lockedPearl, calls: tokenIds, target: UTILITY_TOKENS.VE_PEARL }) + bals.forEach(i => api.add(insuranceTokens.PEARL, i.amount)) +} - for(let i = 0; i < Object.keys(insuranceTokens).length; i++){ - api.add(Object.values(insuranceTokens)[i],tokenBalances[i]); - } +async function addVeTetuBal(api, INSURANCE_FUND) { + const count = await api.call({ abi: 'erc20:balanceOf', target: UTILITY_TOKENS.VE_TETU, params: INSURANCE_FUND }) + const tokenIds = await api.multiCall({ abi: VE_VELO_ABI.tokenOfOwnerByIndex, calls: createIncrementArray(count).map(i => ({ params: [INSURANCE_FUND, i] })), target: UTILITY_TOKENS.VE_TETU }) + const bals = await api.multiCall({ abi: VE_VELO_ABI.lockedAmounts, calls: tokenIds.map(i => ({ params: [i, insuranceTokens.TETU_BPT] })), target: UTILITY_TOKENS.VE_TETU }) + bals.forEach(i => api.add(insuranceTokens.TETU_BPT, i)) } + module.exports = { - getInsuranceFundValue, - insuranceTokens + getInsuranceFundValue, + insuranceTokens } From 6e8b21ea08b26e2eafadd59f36f0c8d14150700f Mon Sep 17 00:00:00 2001 From: g1nt0ki Date: Fri, 15 Sep 2023 13:48:21 +0200 Subject: [PATCH 1246/1974] remove unused code --- projects/tangible/abi/BalancerPool.json | 38 --------- projects/tangible/abi/CaviarChef.json | 35 +------- projects/tangible/abi/Multicall3.json | 18 ---- projects/tangible/abi/PairFactory.json | 37 -------- projects/tangible/abi/Vault.json | 40 --------- projects/tangible/abi/Voter.json | 74 ---------------- projects/tangible/abi/vePEARL.json | 82 ------------------ projects/tangible/abi/veTETU.json | 93 --------------------- projects/tangible/index.js | 1 - projects/tangible/insurance-fund-polygon.js | 24 ------ 10 files changed, 1 insertion(+), 441 deletions(-) delete mode 100644 projects/tangible/abi/BalancerPool.json delete mode 100644 projects/tangible/abi/Multicall3.json delete mode 100644 projects/tangible/abi/PairFactory.json delete mode 100644 projects/tangible/abi/Vault.json delete mode 100644 projects/tangible/abi/Voter.json delete mode 100644 projects/tangible/abi/vePEARL.json delete mode 100644 projects/tangible/abi/veTETU.json diff --git a/projects/tangible/abi/BalancerPool.json b/projects/tangible/abi/BalancerPool.json deleted file mode 100644 index 5a102fcd73b..00000000000 --- a/projects/tangible/abi/BalancerPool.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "Approval": "event Approval(address indexed owner, address indexed spender, uint256 value)", - "PausedStateChanged": "event PausedStateChanged(bool paused)", - "SwapFeePercentageChanged": "event SwapFeePercentageChanged(uint256 swapFeePercentage)", - "Transfer": "event Transfer(address indexed from, address indexed to, uint256 value)", - "DOMAIN_SEPARATOR": "function DOMAIN_SEPARATOR() view returns (bytes32)", - "allowance": "function allowance(address owner, address spender) view returns (uint256)", - "approve": "function approve(address spender, uint256 amount) returns (bool)", - "balanceOf": "function balanceOf(address account) view returns (uint256)", - "decimals": "uint8:decimals", - "decreaseApproval": "function decreaseApproval(address spender, uint256 amount) returns (bool)", - "getActionId": "function getActionId(bytes4 selector) view returns (bytes32)", - "getAuthorizer": "address:getAuthorizer", - "getInvariant": "uint256:getInvariant", - "getLastInvariant": "uint256:getLastInvariant", - "getNormalizedWeights": "uint256[]:getNormalizedWeights", - "getOwner": "address:getOwner", - "getPausedState": "function getPausedState() view returns (bool paused, uint256 pauseWindowEndTime, uint256 bufferPeriodEndTime)", - "getPoolId": "function getPoolId() view returns (bytes32)", - "getRate": "uint256:getRate", - "getSwapFeePercentage": "uint256:getSwapFeePercentage", - "getVault": "address:getVault", - "increaseApproval": "function increaseApproval(address spender, uint256 amount) returns (bool)", - "name": "string:name", - "nonces": "function nonces(address owner) view returns (uint256)", - "onExitPool": "function onExitPool(bytes32 poolId, address sender, address recipient, uint256[] balances, uint256 lastChangeBlock, uint256 protocolSwapFeePercentage, bytes userData) returns (uint256[], uint256[])", - "onJoinPool": "function onJoinPool(bytes32 poolId, address sender, address recipient, uint256[] balances, uint256 lastChangeBlock, uint256 protocolSwapFeePercentage, bytes userData) returns (uint256[], uint256[])", - "onSwap": "function onSwap(tuple(uint8 kind, address tokenIn, address tokenOut, uint256 amount, bytes32 poolId, uint256 lastChangeBlock, address from, address to, bytes userData) request, uint256 balanceTokenIn, uint256 balanceTokenOut) view returns (uint256)", - "permit": "function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s)", - "queryExit": "function queryExit(bytes32 poolId, address sender, address recipient, uint256[] balances, uint256 lastChangeBlock, uint256 protocolSwapFeePercentage, bytes userData) returns (uint256 bptIn, uint256[] amountsOut)", - "queryJoin": "function queryJoin(bytes32 poolId, address sender, address recipient, uint256[] balances, uint256 lastChangeBlock, uint256 protocolSwapFeePercentage, bytes userData) returns (uint256 bptOut, uint256[] amountsIn)", - "setPaused": "function setPaused(bool paused)", - "setSwapFeePercentage": "function setSwapFeePercentage(uint256 swapFeePercentage)", - "symbol": "string:symbol", - "totalSupply": "uint256:totalSupply", - "transfer": "function transfer(address recipient, uint256 amount) returns (bool)", - "transferFrom": "function transferFrom(address sender, address recipient, uint256 amount) returns (bool)" -} \ No newline at end of file diff --git a/projects/tangible/abi/CaviarChef.json b/projects/tangible/abi/CaviarChef.json index 75ecf453931..266095bfd88 100644 --- a/projects/tangible/abi/CaviarChef.json +++ b/projects/tangible/abi/CaviarChef.json @@ -1,38 +1,5 @@ { - "Deposit": "event Deposit(address indexed user, uint256 amount, address indexed to)", - "Harvest": "event Harvest(address indexed user, uint256 amount)", - "Initialized": "event Initialized(uint8 version)", - "LogRewardPerSecond": "event LogRewardPerSecond(uint256 rewardPerSecond)", - "LogUpdatePool": "event LogUpdatePool(uint256 lastRewardTime, uint256 underlyingSupply, uint256 accRewardPerShare)", - "OwnershipTransferred": "event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)", - "Withdraw": "event Withdraw(address indexed user, uint256 amount, address indexed to)", - "__NAME__": "string:__NAME__", - "accRewardPerShare": "uint256:accRewardPerShare", - "deposit": "function deposit(uint256 amount, address to)", - "distributionPeriod": "uint256:distributionPeriod", - "gaugeForLP": "address:gaugeForLP", - "harvest": "function harvest(address to)", - "initialize": "function initialize(string _name, address _rewardToken, address _underlying, uint256 _distributionPeriod)", - "lastDistributedTime": "uint256:lastDistributedTime", - "lastRewardTime": "uint256:lastRewardTime", - "owner": "address:owner", "pendingReward": "function pendingReward(address _user) view returns (uint256 pending)", - "rebaseChef": "address:rebaseChef", - "renounceOwnership": "function renounceOwnership()", - "rewardPerSecond": "uint256:rewardPerSecond", "rewardToken": "address:rewardToken", - "seedRewards": "function seedRewards(uint256 _amount)", - "setDistributionPeriod": "function setDistributionPeriod(uint256 _distributionPeriod)", - "setGaugeForLP": "function setGaugeForLP(address _gaugeForLP)", - "setName": "function setName(string _name)", - "setRebaseChef": "function setRebaseChef(address _rebaseChef)", - "setRewardPerSecond": "function setRewardPerSecond(uint256 _rewardPerSecond)", - "setRewardToken": "function setRewardToken(address _rewardToken)", - "setUnderlyingToken": "function setUnderlyingToken(address _underlying)", - "smartWalletChecker": "address:smartWalletChecker", - "transferOwnership": "function transferOwnership(address newOwner)", - "underlying": "address:underlying", - "userInfo": "function userInfo(address) view returns (uint256 amount, int256 rewardDebt)", - "withdraw": "function withdraw(uint256 amount, address to)", - "withdrawAndHarvest": "function withdrawAndHarvest(uint256 amount, address to)" + "userInfo": "function userInfo(address) view returns (uint256 amount, int256 rewardDebt)" } \ No newline at end of file diff --git a/projects/tangible/abi/Multicall3.json b/projects/tangible/abi/Multicall3.json deleted file mode 100644 index cbfe357858d..00000000000 --- a/projects/tangible/abi/Multicall3.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "aggregate": "function aggregate(tuple(address target, bytes callData)[] calls) payable returns (uint256 blockNumber, bytes[] returnData)", - "aggregate3": "function aggregate3(tuple(address target, bool allowFailure, bytes callData)[] calls) payable returns (tuple(bool success, bytes returnData)[] returnData)", - "aggregate3Value": "function aggregate3Value(tuple(address target, bool allowFailure, uint256 value, bytes callData)[] calls) payable returns (tuple(bool success, bytes returnData)[] returnData)", - "blockAndAggregate": "function blockAndAggregate(tuple(address target, bytes callData)[] calls) payable returns (uint256 blockNumber, bytes32 blockHash, tuple(bool success, bytes returnData)[] returnData)", - "getBasefee": "uint256:getBasefee", - "getBlockHash": "function getBlockHash(uint256 blockNumber) view returns (bytes32 blockHash)", - "getBlockNumber": "uint256:getBlockNumber", - "getChainId": "uint256:getChainId", - "getCurrentBlockCoinbase": "address:getCurrentBlockCoinbase", - "getCurrentBlockDifficulty": "uint256:getCurrentBlockDifficulty", - "getCurrentBlockGasLimit": "uint256:getCurrentBlockGasLimit", - "getCurrentBlockTimestamp": "uint256:getCurrentBlockTimestamp", - "getEthBalance": "function getEthBalance(address addr) view returns (uint256 balance)", - "getLastBlockHash": "function getLastBlockHash() view returns (bytes32 blockHash)", - "tryAggregate": "function tryAggregate(bool requireSuccess, tuple(address target, bytes callData)[] calls) payable returns (tuple(bool success, bytes returnData)[] returnData)", - "tryBlockAndAggregate": "function tryBlockAndAggregate(bool requireSuccess, tuple(address target, bytes callData)[] calls) payable returns (uint256 blockNumber, bytes32 blockHash, tuple(bool success, bytes returnData)[] returnData)" -} \ No newline at end of file diff --git a/projects/tangible/abi/PairFactory.json b/projects/tangible/abi/PairFactory.json deleted file mode 100644 index 56936c9e639..00000000000 --- a/projects/tangible/abi/PairFactory.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "Initialized": "event Initialized(uint8 version)", - "OwnershipTransferred": "event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)", - "PairCreated": "event PairCreated(address indexed token0, address indexed token1, bool stable, address pair, uint256)", - "Paused": "event Paused(address account)", - "PrivilegedAccountStatusUpdated": "event PrivilegedAccountStatusUpdated(address indexed account, bool _added)", - "Unpaused": "event Unpaused(address account)", - "FEE_PRECISION": "uint256:FEE_PRECISION", - "MAX_FEE": "uint256:MAX_FEE", - "acceptFeeManager": "function acceptFeeManager()", - "createPair": "function createPair(address tokenA, address tokenB, bool stable) returns (address pair)", - "feeManager": "address:feeManager", - "getFee": "function getFee(bool _stable) view returns (uint256)", - "getFeeAmount": "function getFeeAmount(bool _stable, uint256 _amount, address _account) view returns (uint256)", - "getPair": "function getPair(address, address, bool) view returns (address)", - "initialize": "function initialize(address _pairImplementation)", - "isPair": "function isPair(address) view returns (bool)", - "isPrivileged": "function isPrivileged(address _account) view returns (bool)", - "owner": "address:owner", - "pairImplementation": "address:pairImplementation", - "pairManager": "address:pairManager", - "pairs": "address[]:pairs", - "pause": "function pause()", - "paused": "bool:paused", - "pendingFeeManager": "address:pendingFeeManager", - "renounceOwnership": "function renounceOwnership()", - "setFee": "function setFee(bool _stable, uint256 _fee)", - "setFeeManager": "function setFeeManager(address _feeManager)", - "setPairImplementationAddress": "function setPairImplementationAddress(address _pairImplementation)", - "setPairManager": "function setPairManager(address _pairManager)", - "stableFee": "uint256:stableFee", - "transferOwnership": "function transferOwnership(address newOwner)", - "unpause": "function unpause()", - "updatePairFees": "function updatePairFees(address pair)", - "updatePrivilegedAccount": "function updatePrivilegedAccount(address _account, bool _addToPrivileged)", - "volatileFee": "uint256:volatileFee" -} \ No newline at end of file diff --git a/projects/tangible/abi/Vault.json b/projects/tangible/abi/Vault.json deleted file mode 100644 index 456ef4b43b0..00000000000 --- a/projects/tangible/abi/Vault.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "AuthorizerChanged": "event AuthorizerChanged(address indexed newAuthorizer)", - "ExternalBalanceTransfer": "event ExternalBalanceTransfer(address indexed token, address indexed sender, address recipient, uint256 amount)", - "FlashLoan": "event FlashLoan(address indexed recipient, address indexed token, uint256 amount, uint256 feeAmount)", - "InternalBalanceChanged": "event InternalBalanceChanged(address indexed user, address indexed token, int256 delta)", - "PausedStateChanged": "event PausedStateChanged(bool paused)", - "PoolBalanceChanged": "event PoolBalanceChanged(bytes32 indexed poolId, address indexed liquidityProvider, address[] tokens, int256[] deltas, uint256[] protocolFeeAmounts)", - "PoolBalanceManaged": "event PoolBalanceManaged(bytes32 indexed poolId, address indexed assetManager, address indexed token, int256 cashDelta, int256 managedDelta)", - "PoolRegistered": "event PoolRegistered(bytes32 indexed poolId, address indexed poolAddress, uint8 specialization)", - "RelayerApprovalChanged": "event RelayerApprovalChanged(address indexed relayer, address indexed sender, bool approved)", - "Swap": "event Swap(bytes32 indexed poolId, address indexed tokenIn, address indexed tokenOut, uint256 amountIn, uint256 amountOut)", - "TokensDeregistered": "event TokensDeregistered(bytes32 indexed poolId, address[] tokens)", - "TokensRegistered": "event TokensRegistered(bytes32 indexed poolId, address[] tokens, address[] assetManagers)", - "WETH": "address:WETH", - "batchSwap": "function batchSwap(uint8 kind, tuple(bytes32 poolId, uint256 assetInIndex, uint256 assetOutIndex, uint256 amount, bytes userData)[] swaps, address[] assets, tuple(address sender, bool fromInternalBalance, address recipient, bool toInternalBalance) funds, int256[] limits, uint256 deadline) payable returns (int256[] assetDeltas)", - "deregisterTokens": "function deregisterTokens(bytes32 poolId, address[] tokens)", - "exitPool": "function exitPool(bytes32 poolId, address sender, address recipient, tuple(address[] assets, uint256[] minAmountsOut, bytes userData, bool toInternalBalance) request)", - "flashLoan": "function flashLoan(address recipient, address[] tokens, uint256[] amounts, bytes userData)", - "getActionId": "function getActionId(bytes4 selector) view returns (bytes32)", - "getAuthorizer": "address:getAuthorizer", - "getDomainSeparator": "function getDomainSeparator() view returns (bytes32)", - "getInternalBalance": "function getInternalBalance(address user, address[] tokens) view returns (uint256[] balances)", - "getNextNonce": "function getNextNonce(address user) view returns (uint256)", - "getPausedState": "function getPausedState() view returns (bool paused, uint256 pauseWindowEndTime, uint256 bufferPeriodEndTime)", - "getPool": "function getPool(bytes32 poolId) view returns (address, uint8)", - "getPoolTokenInfo": "function getPoolTokenInfo(bytes32 poolId, address token) view returns (uint256 cash, uint256 managed, uint256 lastChangeBlock, address assetManager)", - "getPoolTokens": "function getPoolTokens(bytes32 poolId) view returns (address[] tokens, uint256[] balances, uint256 lastChangeBlock)", - "getProtocolFeesCollector": "address:getProtocolFeesCollector", - "hasApprovedRelayer": "function hasApprovedRelayer(address user, address relayer) view returns (bool)", - "joinPool": "function joinPool(bytes32 poolId, address sender, address recipient, tuple(address[] assets, uint256[] maxAmountsIn, bytes userData, bool fromInternalBalance) request) payable", - "managePoolBalance": "function managePoolBalance(tuple(uint8 kind, bytes32 poolId, address token, uint256 amount)[] ops)", - "manageUserBalance": "function manageUserBalance(tuple(uint8 kind, address asset, uint256 amount, address sender, address recipient)[] ops) payable", - "queryBatchSwap": "function queryBatchSwap(uint8 kind, tuple(bytes32 poolId, uint256 assetInIndex, uint256 assetOutIndex, uint256 amount, bytes userData)[] swaps, address[] assets, tuple(address sender, bool fromInternalBalance, address recipient, bool toInternalBalance) funds) returns (int256[])", - "registerPool": "function registerPool(uint8 specialization) returns (bytes32)", - "registerTokens": "function registerTokens(bytes32 poolId, address[] tokens, address[] assetManagers)", - "setAuthorizer": "function setAuthorizer(address newAuthorizer)", - "setPaused": "function setPaused(bool paused)", - "setRelayerApproval": "function setRelayerApproval(address sender, address relayer, bool approved)", - "swap": "function swap(tuple(bytes32 poolId, uint8 kind, address assetIn, address assetOut, uint256 amount, bytes userData) singleSwap, tuple(address sender, bool fromInternalBalance, address recipient, bool toInternalBalance) funds, uint256 limit, uint256 deadline) payable returns (uint256 amountCalculated)" -} \ No newline at end of file diff --git a/projects/tangible/abi/Voter.json b/projects/tangible/abi/Voter.json deleted file mode 100644 index 7e90c2a3234..00000000000 --- a/projects/tangible/abi/Voter.json +++ /dev/null @@ -1,74 +0,0 @@ -{ - "Abstained": "event Abstained(uint256 tokenId, uint256 weight)", - "Deposit": "event Deposit(address indexed lp, address indexed gauge, uint256 tokenId, uint256 amount)", - "DistributeReward": "event DistributeReward(address indexed sender, address indexed gauge, uint256 amount)", - "GaugeCreated": "event GaugeCreated(address indexed gauge, address creator, address internal_bribe, address indexed external_bribe, address indexed pool)", - "GaugeKilled": "event GaugeKilled(address indexed gauge)", - "GaugeRevived": "event GaugeRevived(address indexed gauge)", - "Initialized": "event Initialized(uint8 version)", - "NotifyReward": "event NotifyReward(address indexed sender, address indexed reward, uint256 amount)", - "OwnershipTransferred": "event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)", - "Voted": "event Voted(address indexed voter, uint256 tokenId, uint256 weight)", - "Whitelisted": "event Whitelisted(address indexed whitelister, address indexed token)", - "Withdraw": "event Withdraw(address indexed lp, address indexed gauge, uint256 tokenId, uint256 amount)", - "_initialize": "function _initialize(address[] _tokens, address _minter)", - "_ve": "address:_ve", - "bribefactory": "address:bribefactory", - "claimBribes": "function claimBribes(address[] _bribes, address[][] _tokens, uint256 _tokenId)", - "claimFees": "function claimFees(address[] _fees, address[][] _tokens, uint256 _tokenId)", - "claimable": "function claimable(address) view returns (uint256)", - "createGauge": "function createGauge(address _pool) returns (address)", - "distribute": "function distribute(uint256 start, uint256 finish)", - "distributeAll": "function distributeAll()", - "distributeFees": "function distributeFees(address[] _gauges)", - "emergencyCouncil": "address:emergencyCouncil", - "emitDeposit": "function emitDeposit(uint256 tokenId, address account, uint256 amount)", - "emitWithdraw": "function emitWithdraw(uint256 tokenId, address account, uint256 amount)", - "external_bribes": "function external_bribes(address) view returns (address)", - "factory": "address:factory", - "gaugefactory": "address:gaugefactory", - "gauges": "function gauges(address) view returns (address)", - "gaugesDistributionTimestamp": "function gaugesDistributionTimestamp(address) view returns (uint256)", - "getIncentivizedPools": "address[]:getIncentivizedPools", - "governor": "address:governor", - "increaseGaugeApprovals": "function increaseGaugeApprovals(address _gauge)", - "initGauges": "function initGauges(address[] _gauges, address[] _pools)", - "initialize": "function initialize(address __ve, address _factory, address _gauges, address _bribes)", - "internal_bribes": "function internal_bribes(address) view returns (address)", - "isAlive": "function isAlive(address) view returns (bool)", - "isBribe": "function isBribe(address) view returns (bool)", - "isGauge": "function isGauge(address) view returns (bool)", - "isWhitelisted": "function isWhitelisted(address) view returns (bool)", - "killGauge": "function killGauge(address _gauge)", - "lastVoted": "function lastVoted(uint256) view returns (uint256)", - "length": "uint256:length", - "minter": "address:minter", - "notifyRewardAmount": "function notifyRewardAmount(uint256 amount)", - "owner": "address:owner", - "poke": "function poke(uint256 _tokenId)", - "poolForGauge": "function poolForGauge(address) view returns (address)", - "poolVote": "function poolVote(uint256, uint256) view returns (address)", - "poolVoteLength": "function poolVoteLength(uint256 tokenId) view returns (uint256)", - "pools": "function pools(uint256) view returns (address)", - "reinitialize": "function reinitialize()", - "renounceOwnership": "function renounceOwnership()", - "reset": "function reset(uint256 _tokenId)", - "reviveGauge": "function reviveGauge(address _gauge)", - "setBribeFactory": "function setBribeFactory(address _bribeFactory)", - "setEmergencyCouncil": "function setEmergencyCouncil(address _council)", - "setGaugeFactory": "function setGaugeFactory(address _gaugeFactory)", - "setGovernor": "function setGovernor(address _governor)", - "setMinter": "function setMinter(address _minter)", - "setNewBribe": "function setNewBribe(address _gauge, address _internal, address _external)", - "setPairFactory": "function setPairFactory(address _factory)", - "setUSDR": "function setUSDR(address _usdr)", - "setVotingEscrow": "function setVotingEscrow(address _votingEscrow)", - "totalWeight": "uint256:totalWeight", - "transferOwnership": "function transferOwnership(address newOwner)", - "usdr": "address:usdr", - "usedWeights": "function usedWeights(uint256) view returns (uint256)", - "vote": "function vote(uint256 _tokenId, address[] _poolVote, uint256[] _weights)", - "votes": "function votes(uint256, address) view returns (uint256)", - "weights": "function weights(address) view returns (uint256)", - "whitelist": "function whitelist(address[] _token)" -} \ No newline at end of file diff --git a/projects/tangible/abi/vePEARL.json b/projects/tangible/abi/vePEARL.json deleted file mode 100644 index 3f3bbbe5db0..00000000000 --- a/projects/tangible/abi/vePEARL.json +++ /dev/null @@ -1,82 +0,0 @@ -{ - "Approval": "event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId)", - "ApprovalForAll": "event ApprovalForAll(address indexed owner, address indexed operator, bool approved)", - "DelegateChanged": "event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate)", - "DelegateVotesChanged": "event DelegateVotesChanged(address indexed delegate, uint256 previousBalance, uint256 newBalance)", - "Deposit": "event Deposit(address indexed provider, uint256 tokenId, uint256 value, uint256 indexed locktime, uint8 deposit_type, uint256 ts)", - "Initialized": "event Initialized(uint8 version)", - "Migrate": "event Migrate(uint256 indexed tokenId, address migrator, address owner)", - "Supply": "event Supply(uint256 prevSupply, uint256 supply)", - "Transfer": "event Transfer(address indexed from, address indexed to, uint256 indexed tokenId)", - "Withdraw": "event Withdraw(address indexed provider, uint256 tokenId, uint256 value, uint256 ts)", - "DELEGATION_TYPEHASH": "function DELEGATION_TYPEHASH() view returns (bytes32)", - "DOMAIN_TYPEHASH": "function DOMAIN_TYPEHASH() view returns (bytes32)", - "MAX_DELEGATES": "uint256:MAX_DELEGATES", - "PREVIOUS_IMPLEMENTATION": "address:PREVIOUS_IMPLEMENTATION", - "abstain": "function abstain(uint256 _tokenId)", - "api": "address:api", - "approve": "function approve(address _approved, uint256 _tokenId)", - "artProxy": "address:artProxy", - "balanceOf": "function balanceOf(address _owner) view returns (uint256)", - "balanceOfAtNFT": "function balanceOfAtNFT(uint256 _tokenId, uint256 _block) view returns (uint256)", - "balanceOfNFT": "function balanceOfNFT(uint256 _tokenId) view returns (uint256)", - "balanceOfNFTAt": "function balanceOfNFTAt(uint256 _tokenId, uint256 _t) view returns (uint256)", - "block_number": "uint256:block_number", - "checkpoint": "function checkpoint()", - "checkpoints": "function checkpoints(address, uint32) view returns (uint256 timestamp)", - "create_lock": "function create_lock(uint256 _value, uint256 _lock_duration) returns (uint256)", - "create_lock_for": "function create_lock_for(uint256 _value, uint256 _lock_duration, address _to) returns (uint256)", - "decimals": "uint8:decimals", - "delegate": "function delegate(address delegatee)", - "delegateBySig": "function delegateBySig(address delegatee, uint256 nonce, uint256 expiry, uint8 v, bytes32 r, bytes32 s)", - "delegates": "function delegates(address delegator) view returns (address)", - "deposit_for": "function deposit_for(uint256 _tokenId, uint256 _value)", - "epoch": "uint256:epoch", - "getApproved": "function getApproved(uint256 _tokenId) view returns (address)", - "getPastTotalSupply": "function getPastTotalSupply(uint256 timestamp) view returns (uint256)", - "getPastVotes": "function getPastVotes(address account, uint256 timestamp) view returns (uint256)", - "getPastVotesIndex": "function getPastVotesIndex(address account, uint256 timestamp) view returns (uint32)", - "getVotes": "function getVotes(address account) view returns (uint256)", - "get_last_user_slope": "function get_last_user_slope(uint256 _tokenId) view returns (int128)", - "increase_amount": "function increase_amount(uint256 _tokenId, uint256 _value)", - "increase_unlock_time": "function increase_unlock_time(uint256 _tokenId, uint256 _lock_duration)", - "initialize": "function initialize(address token_addr, address art_proxy)", - "isApprovedForAll": "function isApprovedForAll(address _owner, address _operator) view returns (bool)", - "isApprovedOrOwner": "function isApprovedOrOwner(address _spender, uint256 _tokenId) view returns (bool)", - "locked__end": "function locked__end(uint256 _tokenId) view returns (uint256)", - "merge": "function merge(uint256 _from, uint256 _to)", - "migrate": "function migrate(uint256 _tokenId)", - "name": "string:name", - "nonces": "function nonces(address) view returns (uint256)", - "numCheckpoints": "function numCheckpoints(address) view returns (uint32)", - "ownerOf": "function ownerOf(uint256 _tokenId) view returns (address)", - "ownership_change": "function ownership_change(uint256) view returns (uint256)", - "point_history": "function point_history(uint256 loc) view returns (tuple(int128 bias, int128 slope, uint256 ts, uint256 blk))", - "safeTransferFrom": "function safeTransferFrom(address _from, address _to, uint256 _tokenId, bytes _data)", - "setAPI": "function setAPI(address _api)", - "setApprovalForAll": "function setApprovalForAll(address _operator, bool _approved)", - "setArtProxy": "function setArtProxy(address _proxy)", - "setTeam": "function setTeam(address _team)", - "setVoter": "function setVoter(address _voter)", - "slope_changes": "function slope_changes(uint256) view returns (int128)", - "split": "function split(uint256[] amounts, uint256 _tokenId)", - "supply": "uint256:supply", - "supportsInterface": "function supportsInterface(bytes4 _interfaceID) view returns (bool)", - "symbol": "string:symbol", - "team": "address:team", - "token": "address:token", - "tokenId": "uint256:tokenId", - "tokenURI": "function tokenURI(uint256 _tokenId) view returns (string)", - "totalSupply": "uint256:totalSupply", - "totalSupplyAt": "function totalSupplyAt(uint256 _block) view returns (uint256)", - "totalSupplyAtT": "function totalSupplyAtT(uint256 t) view returns (uint256)", - "transferFrom": "function transferFrom(address _from, address _to, uint256 _tokenId)", - "user_point_epoch": "function user_point_epoch(uint256) view returns (uint256)", - "user_point_history": "function user_point_history(uint256 _tokenId, uint256 loc) view returns (tuple(int128 bias, int128 slope, uint256 ts, uint256 blk))", - "user_point_history__ts": "function user_point_history__ts(uint256 _tokenId, uint256 _idx) view returns (uint256)", - "version": "string:version", - "voted": "function voted(uint256) view returns (bool)", - "voter": "address:voter", - "voting": "function voting(uint256 _tokenId)", - "withdraw": "function withdraw(uint256 _tokenId)" -} \ No newline at end of file diff --git a/projects/tangible/abi/veTETU.json b/projects/tangible/abi/veTETU.json deleted file mode 100644 index e3d2cdaf1d7..00000000000 --- a/projects/tangible/abi/veTETU.json +++ /dev/null @@ -1,93 +0,0 @@ -{ - "Approval": "event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId)", - "ApprovalForAll": "event ApprovalForAll(address indexed owner, address indexed operator, bool approved)", - "ContractInitialized": "event ContractInitialized(address controller, uint256 ts, uint256 block)", - "Deposit": "event Deposit(address indexed stakingToken, address indexed provider, uint256 tokenId, uint256 value, uint256 indexed locktime, uint8 depositType, uint256 ts)", - "GovActionAnnounced": "event GovActionAnnounced(uint256 _type, uint256 timeToExecute)", - "Initialized": "event Initialized(uint8 version)", - "Merged": "event Merged(address indexed stakingToken, address indexed provider, uint256 from, uint256 to)", - "RevisionIncreased": "event RevisionIncreased(uint256 value, address oldLogic)", - "Split": "event Split(uint256 parentTokenId, uint256 newTokenId, uint256 percent)", - "StakingTokenAdded": "event StakingTokenAdded(address value, uint256 weight)", - "Transfer": "event Transfer(address indexed from, address indexed to, uint256 indexed tokenId)", - "TransferWhitelisted": "event TransferWhitelisted(address value)", - "Withdraw": "event Withdraw(address indexed stakingToken, address indexed provider, uint256 tokenId, uint256 value, uint256 ts)", - "CONTROLLABLE_VERSION": "string:CONTROLLABLE_VERSION", - "GOV_ACTION_TIME_LOCK": "uint256:GOV_ACTION_TIME_LOCK", - "MAX_ATTACHMENTS": "uint256:MAX_ATTACHMENTS", - "VE_VERSION": "string:VE_VERSION", - "_deprecated_voted": "function _deprecated_voted(uint256) view returns (uint256)", - "abstain": "function abstain(uint256 _tokenId) pure", - "addToken": "function addToken(address token, uint256 weight)", - "announceAction": "function announceAction(uint8 _type)", - "approve": "function approve(address _approved, uint256 _tokenId)", - "attachToken": "function attachToken(uint256 _tokenId)", - "attachments": "function attachments(uint256) view returns (uint256)", - "balanceOf": "function balanceOf(address _owner) view returns (uint256)", - "balanceOfAtNFT": "function balanceOfAtNFT(uint256 _tokenId, uint256 _block) view returns (uint256)", - "balanceOfNFT": "function balanceOfNFT(uint256 _tokenId) view returns (uint256)", - "balanceOfNFTAt": "function balanceOfNFTAt(uint256 _tokenId, uint256 _t) view returns (uint256)", - "blockTimestamp": "uint256:blockTimestamp", - "changeTokenFarmingAllowanceStatus": "function changeTokenFarmingAllowanceStatus(address _token, bool status)", - "checkpoint": "function checkpoint()", - "controller": "address:controller", - "createLock": "function createLock(address _token, uint256 _value, uint256 _lockDuration) returns (uint256)", - "createLockFor": "function createLockFor(address _token, uint256 _value, uint256 _lockDuration, address _to) returns (uint256)", - "created": "uint256:created", - "createdBlock": "uint256:createdBlock", - "detachToken": "function detachToken(uint256 _tokenId)", - "emergencyWithdrawStakedTokens": "function emergencyWithdrawStakedTokens(address _token)", - "epoch": "uint256:epoch", - "getApproved": "function getApproved(uint256 _tokenId) view returns (address)", - "getLastUserSlope": "function getLastUserSlope(uint256 _tokenId) view returns (int128)", - "getSlot": "function getSlot(uint256 slot) view returns (bytes32 result)", - "govActionTimeLock": "function govActionTimeLock(uint8) view returns (uint256)", - "increaseAmount": "function increaseAmount(address _token, uint256 _tokenId, uint256 _value)", - "increaseRevision": "function increaseRevision(address oldLogic)", - "increaseUnlockTime": "function increaseUnlockTime(uint256 _tokenId, uint256 _lockDuration) returns (uint256 power, uint256 unlockDate)", - "init": "function init(address token_, uint256 weight, address controller_)", - "isApprovedForAll": "function isApprovedForAll(address _owner, address _operator) view returns (bool)", - "isApprovedOrOwner": "function isApprovedOrOwner(address _spender, uint256 _tokenId) view returns (bool)", - "isController": "function isController(address _value) view returns (bool)", - "isGovernance": "function isGovernance(address _value) view returns (bool)", - "isValidToken": "function isValidToken(address) view returns (bool)", - "isVoted": "function isVoted(uint256 _tokenId) view returns (bool)", - "isWhitelistedTransfer": "function isWhitelistedTransfer(address) view returns (bool)", - "lockedDerivedAmount": "function lockedDerivedAmount(uint256) view returns (uint256)", - "lockedEnd": "function lockedEnd(uint256) view returns (uint256)", - "merge": "function merge(uint256 _from, uint256 _to)", - "name": "string:name", - "ownerOf": "function ownerOf(uint256 _tokenId) view returns (address)", - "ownerToOperators": "function ownerToOperators(address, address) view returns (bool)", - "ownershipChange": "function ownershipChange(uint256) view returns (uint256)", - "platformVoter": "address:platformVoter", - "pointHistory": "function pointHistory(uint256 _loc) view returns (tuple(int128 bias, int128 slope, uint256 ts, uint256 blk))", - "previousImplementation": "address:previousImplementation", - "revision": "uint256:revision", - "safeTransferFrom": "function safeTransferFrom(address _from, address _to, uint256 _tokenId, bytes _data)", - "setApprovalForAll": "function setApprovalForAll(address _operator, bool _approved)", - "slopeChanges": "function slopeChanges(uint256) view returns (int128)", - "split": "function split(uint256 _tokenId, uint256 percent)", - "stakeAvailableTokens": "function stakeAvailableTokens(address _token)", - "supportsInterface": "function supportsInterface(bytes4 _interfaceID) view returns (bool)", - "symbol": "string:symbol", - "tokenId": "uint256:tokenId", - "tokenOfOwnerByIndex": "function tokenOfOwnerByIndex(address _owner, uint256 _tokenIndex) view returns (uint256)", - "tokenToOwnerIndex": "function tokenToOwnerIndex(uint256) view returns (uint256)", - "tokenURI": "function tokenURI(uint256 _tokenId) view returns (string)", - "tokenWeights": "function tokenWeights(address) view returns (uint256)", - "tokens": "function tokens(uint256) view returns (address)", - "tokensLength": "uint256:tokensLength", - "totalSupply": "uint256:totalSupply", - "totalSupplyAt": "function totalSupplyAt(uint256 _block) view returns (uint256)", - "totalSupplyAtT": "function totalSupplyAtT(uint256 t) view returns (uint256)", - "transferFrom": "function transferFrom(address, address, uint256) pure", - "userPointEpoch": "function userPointEpoch(uint256) view returns (uint256)", - "userPointHistory": "function userPointHistory(uint256 _tokenId, uint256 _loc) view returns (tuple(int128 bias, int128 slope, uint256 ts, uint256 blk))", - "userPointHistoryTs": "function userPointHistoryTs(uint256 _tokenId, uint256 _idx) view returns (uint256)", - "voter": "address:voter", - "voting": "function voting(uint256 _tokenId) pure", - "whitelistTransferFor": "function whitelistTransferFor(address value)", - "withdraw": "function withdraw(address stakingToken, uint256 _tokenId)", - "withdrawAll": "function withdrawAll(uint256 _tokenId)" -} \ No newline at end of file diff --git a/projects/tangible/index.js b/projects/tangible/index.js index e8999a56ea0..ab7ed324b03 100644 --- a/projects/tangible/index.js +++ b/projects/tangible/index.js @@ -11,7 +11,6 @@ const TNGBL = '0x49e6A20f1BBdfEeC2a8222E052000BbB14EE6007'.toLowerCase() const USDR = '0x40379a439d4f6795b6fc9aa5687db461677a2dba'.toLowerCase() const PEARL = '0x7238390d5f6F64e67c3211C343A410E2A3DEc142'.toLowerCase() const CVX_ETH = '0x4e3fbd56cd56c3e72c1403e103b45db9da5b9d2b'.toLowerCase() -const AERO = '0x940181a94a35a4569e4529a3cdfb74e38fd98631'.toLowerCase() const { apGetAddress, getPriceManager, getCategories, getTotalSupply, getTokenByIndex, getTnftCustody, diff --git a/projects/tangible/insurance-fund-polygon.js b/projects/tangible/insurance-fund-polygon.js index 3bafdc8d30b..c764a8257b3 100644 --- a/projects/tangible/insurance-fund-polygon.js +++ b/projects/tangible/insurance-fund-polygon.js @@ -1,29 +1,8 @@ -const ethers = require('ethers'); const VE_VELO_ABI = require('./abi/VeVeloNFT.json'); const { createIncrementArray } = require('../helper/utils'); const { sumTokens2 } = require('../helper/unwrapLPs') -const BALANCER_POOL_ABI = require('./abi/BalancerPool.json'); const CAVIAR_CHEF_ABI = require('./abi/CaviarChef.json'); -const PAIR_FACTORY_ABI = require('./abi/PairFactory.json'); -const VAULT_ABI = require('./abi/Vault.json'); -const VE_PEARL_ABI = require('./abi/vePEARL.json'); -const VE_TETU_ABI = require('./abi/veTETU.json'); -const VOTER_ABI = require('./abi/Voter.json'); - - -const ERC20_ABI = [ - 'function balanceOf(address) view returns (uint256)' -]; - -const PAIR_ABI = [ - 'function balanceOf(address) view returns (uint256)', - 'function getReserves() view returns (uint256, uint256, uint256)', - 'function tokens() view returns (address, address)', - 'function totalSupply() view returns (uint256)', -]; - -const erc20 = new ethers.utils.Interface(ERC20_ABI); const insuranceTokens = { CAVIAR: '0x6AE96Cc93331c19148541D4D2f31363684917092', @@ -47,9 +26,6 @@ const UTILITY_TOKENS = { VE_TETU: '0x6FB29DD17fa6E27BD112Bc3A2D0b8dae597AeDA4', } -const TNGBL_UNIV3_LIQUIDITY = "0xDC8a5c5975726235402cFac9B28268EEccd42813"; - -const BALANCER_VAULT = '0xBA12222222228d8Ba445958a75a0704d566BF2C8'; const CAVIAR_STAKING_CHEF = '0x83C5022745B2511Bd199687a42D27BEFd025A9A9'; const CAVIAR_REBASE_CHEF = '0xf5374d452697d9A5fa2D97Ffd05155C853F6c1c6'; const PEARL_PAIR_FACTORY = '0xEaF188cdd22fEEBCb345DCb529Aa18CA9FcB4FBd'; From f74f42ecc48b38ec5e2f05a304a64532c1d37a4b Mon Sep 17 00:00:00 2001 From: g1nt0ki Date: Fri, 15 Sep 2023 14:04:21 +0200 Subject: [PATCH 1247/1974] split caviar to be it's own listing it is not RWA --- projects/tangible-caviar/index.js | 17 +++++++++++++++++ projects/tangible/index.js | 12 +----------- 2 files changed, 18 insertions(+), 11 deletions(-) create mode 100644 projects/tangible-caviar/index.js diff --git a/projects/tangible-caviar/index.js b/projects/tangible-caviar/index.js new file mode 100644 index 00000000000..65597681697 --- /dev/null +++ b/projects/tangible-caviar/index.js @@ -0,0 +1,17 @@ +const PEARL = '0x7238390d5f6F64e67c3211C343A410E2A3DEc142'.toLowerCase() + +const { getPearlBalanceCaviar } = require("../tangible/abi.js"); + +const CAVIAR_STRATEGY = "0x4626E247390c82FA3b72A913d3d8fe079FFb84Ff"; + +async function tvl(_, _1, _2, { api }) { + // now fetch locked pearl in Caviar + const pearlAmountInCaviar = await api.call({ abi: getPearlBalanceCaviar, target: CAVIAR_STRATEGY, }) + + api.add(PEARL, pearlAmountInCaviar); +} + + +module.exports = { + polygon: { tvl, }, +} diff --git a/projects/tangible/index.js b/projects/tangible/index.js index ab7ed324b03..9bc02db082d 100644 --- a/projects/tangible/index.js +++ b/projects/tangible/index.js @@ -9,16 +9,14 @@ const { getInsuranceFundValueArb } = require("./insurance-fund-arbitrum"); // doc: https://docs.tangible.store/real-usd/real-usd-v3-contracts-and-addresses const TNGBL = '0x49e6A20f1BBdfEeC2a8222E052000BbB14EE6007'.toLowerCase() const USDR = '0x40379a439d4f6795b6fc9aa5687db461677a2dba'.toLowerCase() -const PEARL = '0x7238390d5f6F64e67c3211C343A410E2A3DEc142'.toLowerCase() const CVX_ETH = '0x4e3fbd56cd56c3e72c1403e103b45db9da5b9d2b'.toLowerCase() const { apGetAddress, getPriceManager, getCategories, getTotalSupply, getTokenByIndex, getTnftCustody, - getItemPriceBatchTokenIds, getPair, getPearlBalanceCaviar } = require("./abi.js"); + getItemPriceBatchTokenIds, getPair, } = require("./abi.js"); const ADDRESS_PROVIDER_ADDRESS = "0xE95BCf65478d6ba44C5F57740CfA50EA443619eA"; const FACTORY_ADDRESS = "0xB0E54b88BB0043A938563fe8A77F4ddE2eB0cFc0"; -const CAVIAR_STRATEGY = "0x4626E247390c82FA3b72A913d3d8fe079FFb84Ff"; const insuranceConfig = { ethereum: { @@ -48,7 +46,6 @@ async function tvl(_, _b, _cb, { api }) { treasuryTvl, rwaTVL, tangiblePOL, - tangibleCaviar, insuranceTvl, ].map(fn => fn(api))) } @@ -144,13 +141,6 @@ async function rwaTVL(api) { } -async function tangibleCaviar(api) { - // now fetch locked pearl in Caviar - const pearlAmountInCaviar = await api.call({ abi: getPearlBalanceCaviar, target: CAVIAR_STRATEGY, }) - - api.add(PEARL, pearlAmountInCaviar); -} - async function tangiblePOL(api) { //pearl pair api address From fcad2df45c1b674727e7d858abd58cf20bc9dc76 Mon Sep 17 00:00:00 2001 From: veljkoTNFT <92369096+veljkoTNFT@users.noreply.github.com> Date: Fri, 15 Sep 2023 14:05:42 +0200 Subject: [PATCH 1248/1974] Improvements to calculating Tangible protocol TVL (#7480) * update tangible liquidity fetch * tangible: code refactor * new tngbl TVL calculation * vanilla implementation for insurance fund value on polygon * insurance funds * Liquidity calc improvement * code refactor * remove unused code * split caviar to be it's own listing it is not RWA --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Co-authored-by: Daniel Kuppitz Co-authored-by: g1nt0ki --- projects/tangible-caviar/index.js | 17 ++++ projects/tangible/abi.js | 1 + projects/tangible/abi/CaviarChef.json | 5 ++ projects/tangible/abi/VeChrNFT.json | 4 + projects/tangible/abi/VeVeloNFT.json | 7 ++ projects/tangible/index.js | 87 ++++++++++++++---- projects/tangible/insurance-fund-arbitrum.js | 17 ++++ projects/tangible/insurance-fund-base.js | 19 ++++ projects/tangible/insurance-fund-optimism.js | 19 ++++ projects/tangible/insurance-fund-polygon.js | 92 ++++++++++++++++++++ 10 files changed, 252 insertions(+), 16 deletions(-) create mode 100644 projects/tangible-caviar/index.js create mode 100644 projects/tangible/abi/CaviarChef.json create mode 100644 projects/tangible/abi/VeChrNFT.json create mode 100644 projects/tangible/abi/VeVeloNFT.json create mode 100644 projects/tangible/insurance-fund-arbitrum.js create mode 100644 projects/tangible/insurance-fund-base.js create mode 100644 projects/tangible/insurance-fund-optimism.js create mode 100644 projects/tangible/insurance-fund-polygon.js diff --git a/projects/tangible-caviar/index.js b/projects/tangible-caviar/index.js new file mode 100644 index 00000000000..65597681697 --- /dev/null +++ b/projects/tangible-caviar/index.js @@ -0,0 +1,17 @@ +const PEARL = '0x7238390d5f6F64e67c3211C343A410E2A3DEc142'.toLowerCase() + +const { getPearlBalanceCaviar } = require("../tangible/abi.js"); + +const CAVIAR_STRATEGY = "0x4626E247390c82FA3b72A913d3d8fe079FFb84Ff"; + +async function tvl(_, _1, _2, { api }) { + // now fetch locked pearl in Caviar + const pearlAmountInCaviar = await api.call({ abi: getPearlBalanceCaviar, target: CAVIAR_STRATEGY, }) + + api.add(PEARL, pearlAmountInCaviar); +} + + +module.exports = { + polygon: { tvl, }, +} diff --git a/projects/tangible/abi.js b/projects/tangible/abi.js index 01b3bb957b4..8aca0c590c0 100644 --- a/projects/tangible/abi.js +++ b/projects/tangible/abi.js @@ -8,4 +8,5 @@ module.exports = { getTnftCustody: "function tnftCustody(uint256) view returns (bool)", getItemPriceBatchTokenIds: "function itemPriceBatchTokenIds(address nft, address paymentUSDToken, uint256[] tokenIds) view returns (uint256[] weSellAt, uint256[] weSellAtStock, uint256[] weBuyAt, uint256[] weBuyAtStock, uint256[] lockedAmount)", getPair: "function getPair(address _pair, address _account) view returns (tuple(address pair_address, string symbol, string name, uint256 decimals, bool stable, uint256 total_supply, address token0, string token0_symbol, uint256 token0_decimals, uint256 reserve0, uint256 claimable0, address token1, string token1_symbol, uint256 token1_decimals, uint256 reserve1, uint256 claimable1, address gauge, uint256 gauge_total_supply, address fee, address bribe, uint256 emissions, address emissions_token, uint256 emissions_token_decimals, uint256 account_lp_balance, uint256 account_token0_balance, uint256 account_token1_balance, uint256 account_gauge_balance, uint256 account_gauge_earned) _pairInfo)", + getPearlBalanceCaviar: "function balanceOfVePearl() view returns (uint256)", } \ No newline at end of file diff --git a/projects/tangible/abi/CaviarChef.json b/projects/tangible/abi/CaviarChef.json new file mode 100644 index 00000000000..266095bfd88 --- /dev/null +++ b/projects/tangible/abi/CaviarChef.json @@ -0,0 +1,5 @@ +{ + "pendingReward": "function pendingReward(address _user) view returns (uint256 pending)", + "rewardToken": "address:rewardToken", + "userInfo": "function userInfo(address) view returns (uint256 amount, int256 rewardDebt)" +} \ No newline at end of file diff --git a/projects/tangible/abi/VeChrNFT.json b/projects/tangible/abi/VeChrNFT.json new file mode 100644 index 00000000000..e9b93bde1f4 --- /dev/null +++ b/projects/tangible/abi/VeChrNFT.json @@ -0,0 +1,4 @@ +{ + "locked": "function locked(uint256) view returns (int128 amount, uint256 end)", + "tokensOfOwner": "function tokensOfOwner(address _usr) view returns (uint256[])" +} \ No newline at end of file diff --git a/projects/tangible/abi/VeVeloNFT.json b/projects/tangible/abi/VeVeloNFT.json new file mode 100644 index 00000000000..06f2943380c --- /dev/null +++ b/projects/tangible/abi/VeVeloNFT.json @@ -0,0 +1,7 @@ +{ + "ownerToNFTokenIdList": "function ownerToNFTokenIdList(address, uint256) view returns (uint256)", + "tokenOfOwnerByIndex": "function tokenOfOwnerByIndex(address _owner, uint256 _tokenIndex) view returns (uint256)", + "lockedPearl": "function locked(uint256 _tokenId) view returns (tuple(int128 amount, uint256 end))", + "lockedAmounts": "function lockedAmounts(uint256, address) view returns (uint256)", + "locked": "function locked(uint256 _tokenId) view returns (tuple(int128 amount, uint256 end, bool isPermanent))" +} \ No newline at end of file diff --git a/projects/tangible/index.js b/projects/tangible/index.js index 2649a55e75d..9bc02db082d 100644 --- a/projects/tangible/index.js +++ b/projects/tangible/index.js @@ -1,14 +1,19 @@ const ADDRESSES = require('../helper/coreAssets.json') -const { sumTokensExport } = require('../helper/unwrapLPs') +const { sumTokensExport, sumTokens2, } = require('../helper/unwrapLPs') const { getConfig } = require('../helper/cache') +const { getInsuranceFundValue, insuranceTokens } = require("./insurance-fund-polygon"); +const { getInsuranceFundValueOp } = require("./insurance-fund-optimism"); +const { getInsuranceFundValueBase } = require("./insurance-fund-base"); +const { getInsuranceFundValueArb } = require("./insurance-fund-arbitrum"); // doc: https://docs.tangible.store/real-usd/real-usd-v3-contracts-and-addresses const TNGBL = '0x49e6A20f1BBdfEeC2a8222E052000BbB14EE6007'.toLowerCase() const USDR = '0x40379a439d4f6795b6fc9aa5687db461677a2dba'.toLowerCase() +const CVX_ETH = '0x4e3fbd56cd56c3e72c1403e103b45db9da5b9d2b'.toLowerCase() const { apGetAddress, getPriceManager, getCategories, getTotalSupply, getTokenByIndex, getTnftCustody, - getItemPriceBatchTokenIds, getPair } = require("./abi.js"); + getItemPriceBatchTokenIds, getPair, } = require("./abi.js"); const ADDRESS_PROVIDER_ADDRESS = "0xE95BCf65478d6ba44C5F57740CfA50EA443619eA"; const FACTORY_ADDRESS = "0xB0E54b88BB0043A938563fe8A77F4ddE2eB0cFc0"; @@ -16,24 +21,50 @@ const FACTORY_ADDRESS = "0xB0E54b88BB0043A938563fe8A77F4ddE2eB0cFc0"; const insuranceConfig = { ethereum: { owner: '0x5d35A37E5842F6b3072893A3f7Bf0e1d1FF80179', - tokens: [ADDRESSES.null], + tokens: [ADDRESSES.null, CVX_ETH], }, polygon: { - owner: '0xD1758fbABAE91c805BE76D56548A584EF68B81f0', - tokens: [ADDRESSES.polygon.DAI, ADDRESSES.polygon.USDC, ADDRESSES.polygon.USDT, ADDRESSES.null, ADDRESSES.polygon.WETH, ADDRESSES.polygon.WMATIC], + owners: ['0xD1758fbABAE91c805BE76D56548A584EF68B81f0', '0x632572cfAa39330c8F0211b5B33BC86135E48b5f'], + tokens: Object.values(insuranceTokens), }, optimism: { owner: '0x7f922242d919feF0da0e40e3Cb4B7f7D3c97a63e', - tokens: [ADDRESSES.null, ADDRESSES.optimism.OP, ADDRESSES.optimism.USDC,], + tokens: [ADDRESSES.null, ADDRESSES.optimism.OP, ADDRESSES.optimism.USDC], }, + base: { + owner: "0x17ee1f11aa0654bd4ab1af4b6b309c7f137c925e", + tokens: [ADDRESSES.null,], + }, + arbitrum: { + owner: "0xe19848f158efd31d45a6975320365251c92040c1", + tokens: [ADDRESSES.null, ADDRESSES.arbitrum.USDT], + } } async function tvl(_, _b, _cb, { api }) { await Promise.all([ treasuryTvl, - insuranceTvl, rwaTVL, - tangiblePOL + tangiblePOL, + insuranceTvl, + ].map(fn => fn(api))) +} + +async function tvlOp(_, _b, _cb, { api }) { + await Promise.all([ + insuranceTvlOp, + ].map(fn => fn(api))) +} + +async function tvlBase(_, _b, _cb, { api }) { + await Promise.all([ + insuranceTvlBase, + ].map(fn => fn(api))) +} + +async function tvlArb(_, _b, _cb, { api }) { + await Promise.all([ + insuranceTvlArb, ].map(fn => fn(api))) } @@ -44,12 +75,29 @@ async function treasuryTvl(api) { target: ADDRESS_PROVIDER_ADDRESS, params: ["0xc83e4fd410f80be983b083c99898391186b0893751a26a9a1e5fdcb9d4129701"],//keccak of USDRTreasury }) - await api.sumTokens({ owner: usdrTreasuryAddress, tokens: [ADDRESSES.polygon.DAI] }) + await api.sumTokens({ owner: usdrTreasuryAddress, tokens: [ADDRESSES.polygon.DAI,] }) } async function insuranceTvl(api) { - await unwrapBalancerToken(api) - return api.sumTokens(insuranceConfig.polygon) + await Promise.all(insuranceConfig.polygon.owners.map(i => (async () => { + await unwrapBalancerToken(api, i); + await getInsuranceFundValue(api, i); + })())) +} + +async function insuranceTvlOp(api) { + await getInsuranceFundValueOp(api, insuranceConfig.optimism.owner); + return sumTokens2({ api, ...insuranceConfig.optimism }) +} + +async function insuranceTvlBase(api) { + await getInsuranceFundValueBase(api, insuranceConfig.base.owner); + await api.sumTokens({ owner: insuranceConfig.base.owner, tokens: insuranceConfig.base.tokens }) +} + +async function insuranceTvlArb(api) { + await getInsuranceFundValueArb(api, insuranceConfig.arbitrum.owner); + return sumTokens2({ api, ...insuranceConfig.arbitrum }) } async function rwaTVL(api) { @@ -102,6 +150,13 @@ async function tangiblePOL(api) { params: ["0xd1e0c1a56a62f2e6553b45bde148c89c51a01f766c23f4bb2c612bd2c822f711"],//keccak of paerl api address }) + // liquidity manager + const liquidityManager = await api.call({ + abi: apGetAddress, + target: ADDRESS_PROVIDER_ADDRESS, + params: ["0x6878742ff510854cb02c186504af5267007c4a6d33f490fc28ec83e83e1458e1"],//keccak of liquidity manager + }) + const { data } = await getConfig('tangible', "https://api.pearl.exchange/api/v15/pools"); const pools = data.filter( (pool) => @@ -111,9 +166,8 @@ async function tangiblePOL(api) { pool.token0.symbol === "USDR"), ).map(i => i.address) - const multisigAddress = "0x100fCC635acf0c22dCdceF49DD93cA94E55F0c71" const [lpBals, tokens0, tokens1, totalSupplies, reserves] = await Promise.all([ - api.multiCall({ abi: getPair, target: pearlPairApi, calls: pools.map(p => ({ params: [p, multisigAddress]})) }), + api.multiCall({ abi: getPair, target: pearlPairApi, calls: pools.map(p => ({ params: [p, liquidityManager] })) }), api.multiCall({ abi: 'address:token0', calls: pools }), api.multiCall({ abi: 'address:token1', calls: pools }), api.multiCall({ abi: 'uint256:totalSupply', calls: pools }), @@ -136,11 +190,12 @@ module.exports = { misrepresentedTokens: true, polygon: { tvl, }, ethereum: { tvl: sumTokensExport(insuranceConfig.ethereum) }, - optimism: { tvl: sumTokensExport(insuranceConfig.optimism) }, + base: { tvl: tvlBase }, + arbitrum: { tvl: tvlArb }, + optimism: { tvl: tvlOp }, } -async function unwrapBalancerToken(api) { - const owner = insuranceConfig.polygon.owner +async function unwrapBalancerToken(api, owner) { const gauge = '0x07222e30b751c1ab4a730745afe19810cfd762c0' const balancerToken = '0x9f9f548354b7c66dc9a9f3373077d86aaaccf8f2' const [lpSupply, lpTokens] = await api.batchCall([ diff --git a/projects/tangible/insurance-fund-arbitrum.js b/projects/tangible/insurance-fund-arbitrum.js new file mode 100644 index 00000000000..ea2e3aca6d3 --- /dev/null +++ b/projects/tangible/insurance-fund-arbitrum.js @@ -0,0 +1,17 @@ +const VE_CHR_ABI = require('./abi/VeChrNFT.json'); + +const insuranceTokensArb = { + CHR: '0x15b2fb8f08e4ac1ce019eadae02ee92aedf06851', +} + +const VE_CHR_NFT = "0x9A01857f33aa382b1d5bb96C3180347862432B0d"; + +async function getInsuranceFundValueArb(api, INSURANCE_FUND) { + const tokenIds = await api.call({ abi: VE_CHR_ABI.tokensOfOwner, target: VE_CHR_NFT, params: INSURANCE_FUND }) + const bals = await api.multiCall({ abi: VE_CHR_ABI.locked, calls: tokenIds, target: VE_CHR_NFT, }) + bals.forEach(i => api.add(insuranceTokensArb.CHR, i.amount)) +} + +module.exports = { + getInsuranceFundValueArb, +} diff --git a/projects/tangible/insurance-fund-base.js b/projects/tangible/insurance-fund-base.js new file mode 100644 index 00000000000..ecda71f34ad --- /dev/null +++ b/projects/tangible/insurance-fund-base.js @@ -0,0 +1,19 @@ +const VE_VELO_ABI = require('./abi/VeVeloNFT.json'); +const { createIncrementArray } = require('../helper/utils'); + +const insuranceTokensBase = { + AERO: '0x940181a94A35A4569E4529A3CDfB74e38FD98631', +} + +const VE_AERO_NFT = "0xeBf418Fe2512e7E6bd9b87a8F0f294aCDC67e6B4"; + +async function getInsuranceFundValueBase(api, INSURANCE_FUND) { + const count = await api.call({ abi: 'erc20:balanceOf', target: VE_AERO_NFT, params: INSURANCE_FUND }) + const tokenIds = await api.multiCall({ abi: VE_VELO_ABI.ownerToNFTokenIdList, calls: createIncrementArray(count).map(i => ({ params: [INSURANCE_FUND, i] })), target: VE_AERO_NFT }) + const bals = await api.multiCall({ abi: VE_VELO_ABI.locked, calls: tokenIds, target: VE_AERO_NFT }) + bals.forEach(i => api.add(insuranceTokensBase.AERO, i.amount)) +} + +module.exports = { + getInsuranceFundValueBase, +} diff --git a/projects/tangible/insurance-fund-optimism.js b/projects/tangible/insurance-fund-optimism.js new file mode 100644 index 00000000000..b71366c3bf4 --- /dev/null +++ b/projects/tangible/insurance-fund-optimism.js @@ -0,0 +1,19 @@ +const VE_VELO_ABI = require('./abi/VeVeloNFT.json'); +const { createIncrementArray } = require('../helper/utils'); + +const insuranceTokensOp = { + VELO: '0x9560e827af36c94d2ac33a39bce1fe78631088db', +} + +const VE_VELO_NFT = "0xFAf8FD17D9840595845582fCB047DF13f006787d"; + +async function getInsuranceFundValueOp(api, INSURANCE_FUND) { + const count = await api.call({ abi: 'erc20:balanceOf', target: VE_VELO_NFT, params: INSURANCE_FUND }) + const tokenIds = await api.multiCall({ abi: VE_VELO_ABI.ownerToNFTokenIdList, calls: createIncrementArray(count).map(i => ({ params: [INSURANCE_FUND, i]})), target: VE_VELO_NFT }) + const bals = await api.multiCall({ abi: VE_VELO_ABI.locked, calls: tokenIds, target: VE_VELO_NFT }) + bals.forEach(i => api.add(insuranceTokensOp.VELO, i.amount)) +} + +module.exports = { + getInsuranceFundValueOp, +} diff --git a/projects/tangible/insurance-fund-polygon.js b/projects/tangible/insurance-fund-polygon.js new file mode 100644 index 00000000000..c764a8257b3 --- /dev/null +++ b/projects/tangible/insurance-fund-polygon.js @@ -0,0 +1,92 @@ +const VE_VELO_ABI = require('./abi/VeVeloNFT.json'); +const { createIncrementArray } = require('../helper/utils'); +const { sumTokens2 } = require('../helper/unwrapLPs') + +const CAVIAR_CHEF_ABI = require('./abi/CaviarChef.json'); + +const insuranceTokens = { + CAVIAR: '0x6AE96Cc93331c19148541D4D2f31363684917092', + DAI: '0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063', + PEARL: '0x7238390d5f6F64e67c3211C343A410E2A3DEc142', + STAR: '0xC19669A405067927865B40Ea045a2baabbbe57f5', + STMATIC: '0x3A58a54C066FdC0f2D55FC9C89F0415C92eBf3C4', + TETU: '0x255707B70BF90aa112006E1b07B9AeA6De021424', + TNGBL: '0x49e6A20f1BBdfEeC2a8222E052000BbB14EE6007', + USDC: '0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174', + USDR: '0x40379a439D4F6795B6fc9aa5687dB461677A2dBa', + USDT: '0xc2132D05D31c914a87C6611C10748AEb04B58e8F', + WETH: '0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619', + WMATIC: '0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270', + WUSDR: '0x00e8c0E92eB3Ad88189E7125Ec8825eDc03Ab265', + TETU_BPT: '0xE2f706EF1f7240b803AAe877C9C762644bb808d8', +} + +const UTILITY_TOKENS = { + VE_PEARL: '0x017A26B18E4DA4FE1182723a39311e67463CF633', + VE_TETU: '0x6FB29DD17fa6E27BD112Bc3A2D0b8dae597AeDA4', +} + +const CAVIAR_STAKING_CHEF = '0x83C5022745B2511Bd199687a42D27BEFd025A9A9'; +const CAVIAR_REBASE_CHEF = '0xf5374d452697d9A5fa2D97Ffd05155C853F6c1c6'; +const PEARL_PAIR_FACTORY = '0xEaF188cdd22fEEBCb345DCb529Aa18CA9FcB4FBd'; +const PEARL_VOTER = '0xa26C2A6BfeC5512c13Ae9EacF41Cb4319d30cCF0'; + +async function getInsuranceFundValue(api, INSURANCE_FUND) { + await Promise.all([ + addVePearlBal(api, INSURANCE_FUND), + addVeTetuBal(api, INSURANCE_FUND), + caviarTvl(api, INSURANCE_FUND), + pearlFactoryTvl(api, INSURANCE_FUND), + ]) + return sumTokens2({ api, owner: INSURANCE_FUND, tokens: Object.values(insuranceTokens), resolveUniV3: true, resolveLP: true, blacklistedTokens: [ + insuranceTokens.USDR, + insuranceTokens.WUSDR, + insuranceTokens.TNGBL, + ] }) +} + +async function caviarTvl(api, owner) { + const [ + stakingAmount, pendingStakingReward, stakingRewardToken, pendingRebaseReward, rebaseRewardToken + ] = await Promise.all([ + api.call({ target: CAVIAR_STAKING_CHEF, abi: CAVIAR_CHEF_ABI.userInfo, params: [owner] }), + api.call({ target: CAVIAR_STAKING_CHEF, abi: CAVIAR_CHEF_ABI.pendingReward, params: [owner] }), + api.call({ target: CAVIAR_STAKING_CHEF, abi: CAVIAR_CHEF_ABI.rewardToken, }), + api.call({ target: CAVIAR_REBASE_CHEF, abi: CAVIAR_CHEF_ABI.pendingReward, params: [owner] }), + api.call({ target: CAVIAR_REBASE_CHEF, abi: CAVIAR_CHEF_ABI.rewardToken, }), + ]) + + // api.add(stakingRewardToken, pendingStakingReward); // it is wUSDR + api.add(rebaseRewardToken, pendingRebaseReward); + api.add(insuranceTokens.CAVIAR, stakingAmount.amount); +} + +async function pearlFactoryTvl(api, owner) { + const pairs = await api.fetchList({ lengthAbi: 'uint256:allPairsLength', itemAbi: "function allPairs(uint256) view returns (address)", target: PEARL_PAIR_FACTORY }) + const gauges = await api.multiCall({ abi: "function gauges(address) view returns (address)", calls: pairs, target: PEARL_VOTER }) + const bals = await api.multiCall({ abi: 'erc20:balanceOf', calls: gauges.map(g => ({ target: g, params: owner })) }) + bals.forEach((bal, i) => { + if (pairs[i].toLowerCase() !== '0x0edc235693c20943780b76d79dd763236e94c751') + api.add(pairs[i], bal) + }) +} + +async function addVePearlBal(api, INSURANCE_FUND) { + const count = await api.call({ abi: 'erc20:balanceOf', target: UTILITY_TOKENS.VE_PEARL, params: INSURANCE_FUND }) + const tokenIds = await api.multiCall({ abi: VE_VELO_ABI.tokenOfOwnerByIndex, calls: createIncrementArray(count).map(i => ({ params: [INSURANCE_FUND, i] })), target: UTILITY_TOKENS.VE_PEARL }) + const bals = await api.multiCall({ abi: VE_VELO_ABI.lockedPearl, calls: tokenIds, target: UTILITY_TOKENS.VE_PEARL }) + bals.forEach(i => api.add(insuranceTokens.PEARL, i.amount)) +} + +async function addVeTetuBal(api, INSURANCE_FUND) { + const count = await api.call({ abi: 'erc20:balanceOf', target: UTILITY_TOKENS.VE_TETU, params: INSURANCE_FUND }) + const tokenIds = await api.multiCall({ abi: VE_VELO_ABI.tokenOfOwnerByIndex, calls: createIncrementArray(count).map(i => ({ params: [INSURANCE_FUND, i] })), target: UTILITY_TOKENS.VE_TETU }) + const bals = await api.multiCall({ abi: VE_VELO_ABI.lockedAmounts, calls: tokenIds.map(i => ({ params: [i, insuranceTokens.TETU_BPT] })), target: UTILITY_TOKENS.VE_TETU }) + bals.forEach(i => api.add(insuranceTokens.TETU_BPT, i)) +} + + +module.exports = { + getInsuranceFundValue, + insuranceTokens +} From 167ce00f713bfbf1c164196785c1bfe4ce5cb20d Mon Sep 17 00:00:00 2001 From: Leez <94301129+0xleez@users.noreply.github.com> Date: Fri, 15 Sep 2023 15:37:30 +0300 Subject: [PATCH 1249/1974] New JPEGd pETH addresses (#7482) * remove wallet bakc staked tvl * hallmarks * ape tvl * new peth-weth addresses + hallmarks --- projects/jpeg-d/helper/abis.js | 3 ++- projects/jpeg-d/helper/addresses.js | 8 ++------ projects/jpeg-d/helper/index.js | 4 ++-- projects/jpeg-d/index.js | 10 ++++++++++ 4 files changed, 16 insertions(+), 9 deletions(-) diff --git a/projects/jpeg-d/helper/abis.js b/projects/jpeg-d/helper/abis.js index 1eb21f53066..2cb49ae718c 100644 --- a/projects/jpeg-d/helper/abis.js +++ b/projects/jpeg-d/helper/abis.js @@ -19,7 +19,8 @@ const APE_STAKING = { const P2P_APE_STAKING_ABI = { nextNonce: "function nextNonce() external view returns (uint256)", - offers: "function offers(uint24) view returns (uint8 offerType, tuple(uint8 collection, uint16 tokenId) mainNft, uint16 bakcTokenId, uint80 apeAmount, uint16 apeRewardShareBps, uint16 bakcRewardShareBps, bool isPaired, uint80 lastSingleStakingRewardPerShare)" + offers: + "function offers(uint24) view returns (uint8 offerType, tuple(uint8 collection, uint16 tokenId) mainNft, uint16 bakcTokenId, uint80 apeAmount, uint16 apeRewardShareBps, uint16 bakcRewardShareBps, bool isPaired, uint80 lastSingleStakingRewardPerShare)", }; const ERC721 = { diff --git a/projects/jpeg-d/helper/addresses.js b/projects/jpeg-d/helper/addresses.js index 282b30da451..bc2beb5c870 100644 --- a/projects/jpeg-d/helper/addresses.js +++ b/projects/jpeg-d/helper/addresses.js @@ -87,8 +87,6 @@ const MAYC_APE_STAKING_STRATEGY = "0x6b2e47560CC810C2Dce3bf2C0Da4310eC0af8831"; const APE_STAKING = "0x5954aB967Bc958940b7EB73ee84797Dc8a2AFbb9"; const APE = "0x4d224452801aced8b2f0aebe155379bb5d594381"; -const PETH_ETH_PAIR = "0x9848482da3Ee3076165ce6497eDA906E66bB85C5"; -const PETH_ETH_VAULT = "0x56D1b6Ac326e152C9fAad749F1F4f9737a049d46"; const LP_STAKING = "0xb271d2c9e693dde033d97f8a3c9911781329e4ca"; const JPEG = "0xE80C0cd204D654CEbe8dd64A4857cAb6Be8345a3"; const JPEG_WETH_SLP = "0xdb06a76733528761eda47d356647297bc35a98bd"; @@ -128,11 +126,9 @@ module.exports = { JPEG, STAKING_CONTRACT, JPEG_WETH_SLP, - PETH_ETH_PAIR, - PETH_ETH_VAULT, LP_STAKING, - PETH_ETH_F: "0x56D1b6Ac326e152C9fAad749F1F4f9737a049d46", - PETH_POOL: "0x9848482da3ee3076165ce6497eda906e66bb85c5", + PETH_WETH_F: "0x374434df400c4b68aad8598e79840d109b6ca40c", + PETH_POOL: "0x1c5f80b6b68a9e1ef25926eee00b5255791b996b", PUSD_USD_F: "0xF6Cbf5e56a8575797069c7A7FBED218aDF17e3b2", USD_POOL: "0x8ee017541375f6bcd802ba119bddc94dad6911a1", helperToNftMapping, diff --git a/projects/jpeg-d/helper/index.js b/projects/jpeg-d/helper/index.js index 2ca5ed7c02b..6d2aacabe00 100644 --- a/projects/jpeg-d/helper/index.js +++ b/projects/jpeg-d/helper/index.js @@ -13,7 +13,7 @@ const { JPEG, PETH_POOL, USD_POOL, - PETH_ETH_F, + PETH_WETH_F, PUSD_USD_F, artBlockOwners, LP_STAKING, @@ -157,7 +157,7 @@ async function autocompoundingTvl(api) { ] = await api.batchCall([ { target: PETH_POOL, abi: curveBalApi, params: [0] }, { target: PETH_POOL, abi: "erc20:totalSupply" }, - { target: PETH_ETH_F, abi: "erc20:balanceOf", params: [LP_STAKING] }, + { target: PETH_WETH_F, abi: "erc20:balanceOf", params: [LP_STAKING] }, { target: USD_POOL, abi: curveBalApi, params: [1] }, { target: USD_POOL, abi: "erc20:totalSupply" }, { target: PUSD_USD_F, abi: "erc20:balanceOf", params: [LP_STAKING] }, diff --git a/projects/jpeg-d/index.js b/projects/jpeg-d/index.js index 0637c369239..7e4e67ed842 100644 --- a/projects/jpeg-d/index.js +++ b/projects/jpeg-d/index.js @@ -12,7 +12,17 @@ module.exports = { hallmarks: [ [1666003500, "pETH borrows"], [1669551000, "JPEG LTV boost"], + [1670518800, "APE staking"], + [1674669600, "Autoglyphs & Fidenza support"], + [1675166400, "Ringers & Chromie Squiggle support"], + [1675598400, "70% LTV for CryptoPunks & BAYC"], + [1678665600, "Otherdeeds support"], + [1678665600, "Meebits support"], + [1679529600, "BAKC support"], [1683662400, "P2P Ape Staking"], + [1684108800, "Milady support"], [1690730000, "pETH-ETH Curve pool drained"], + [1692651600, "pETH-WETH relaunch"], + [1694680200, "pETH Citadel relaunch"], ], }; From 6730a2b25890969a0ba4530307744dee9769b86d Mon Sep 17 00:00:00 2001 From: define Date: Fri, 15 Sep 2023 14:11:57 +0100 Subject: [PATCH 1250/1974] add kroma chain --- projects/helper/chains.json | 1 + projects/izumi-iziswap/index.js | 1 + 2 files changed, 2 insertions(+) diff --git a/projects/helper/chains.json b/projects/helper/chains.json index cb1fa4a0a77..933724d4acc 100644 --- a/projects/helper/chains.json +++ b/projects/helper/chains.json @@ -109,6 +109,7 @@ "kintsugi", "klaytn", "kujira", + "kroma", "kusama", "lachain", "lamden", diff --git a/projects/izumi-iziswap/index.js b/projects/izumi-iziswap/index.js index 538de53bfd7..5c78c8cb5bb 100644 --- a/projects/izumi-iziswap/index.js +++ b/projects/izumi-iziswap/index.js @@ -22,6 +22,7 @@ const poolHelpers = { 'ontology_evm': ['0x110dE362cc436D7f54210f96b8C7652C2617887D'], 'ultron' : ['0xcA7e21764CD8f7c1Ec40e651E25Da68AeD096037'], 'linea': ['0x1CB60033F61e4fc171c963f0d2d3F63Ece24319c'], + 'kroma': ['0x8c7d3063579BdB0b90997e18A770eaE32E1eBb08'] } const blacklistedTokens = [ From a68fb2653e4b43a270116ce0cf437960ba10640a Mon Sep 17 00:00:00 2001 From: Dozer Date: Fri, 15 Sep 2023 19:04:13 +0300 Subject: [PATCH 1251/1974] added new chains --- projects/interport-finance/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/interport-finance/index.js b/projects/interport-finance/index.js index bf57456783e..34e0cdd502f 100644 --- a/projects/interport-finance/index.js +++ b/projects/interport-finance/index.js @@ -13,7 +13,7 @@ module.exports = { methodology: 'Interport TVL is calculated by summing the USDT and USDC balance of the vaults contracts, ITP token balance in the ITP Revenue Share contract and LP token balance in the LP Revenue Share contract.', }; -['ethereum', 'avax', 'bsc', 'fantom', 'arbitrum', 'polygon', 'polygon_zkevm', 'base', 'era'].forEach(chain => { +['ethereum', 'avax', 'bsc', 'fantom', 'arbitrum', 'polygon', 'polygon_zkevm', 'base', 'era', 'optimism', 'linea'].forEach(chain => { module.exports[chain] = { tvl: async (_, _1, _2, { api }) => { const vaults = config[chain]?.vaults || defaultVaults From 52be8ee2bc277a114c42f4a712313e1a4341eb6a Mon Sep 17 00:00:00 2001 From: Dozer Date: Fri, 15 Sep 2023 19:23:51 +0300 Subject: [PATCH 1252/1974] updated pool2 addresses --- projects/interport-finance/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/interport-finance/index.js b/projects/interport-finance/index.js index 34e0cdd502f..df85a8b8f24 100644 --- a/projects/interport-finance/index.js +++ b/projects/interport-finance/index.js @@ -24,4 +24,4 @@ module.exports = { }); module.exports.ethereum.staking = staking('0x5DC6796Adc2420BD0f48e05f70f34B30F2AaD313', '0x2b1D36f5B61AdDAf7DA7ebbd11B35FD8cfb0DE31') -module.exports.ethereum.pool2 = staking('0x5F51A04c271C395994F156172cDe451a0188Ca75', '0x152E2502c22F73a7493df8B856836efBc69E3718') +module.exports.ethereum.pool2 = staking('0x646De66c9A08abF0976869DE259E4B12D06F66ac', '0x4db2C7dd361379134140ffb9D85248e8498008E4') From 74f893ff70ce250e26935ec9e118f34c32cb90a8 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Fri, 15 Sep 2023 19:52:30 +0100 Subject: [PATCH 1253/1974] add bsharerewardpool --- projects/basedfarm/index.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/projects/basedfarm/index.js b/projects/basedfarm/index.js index 580345836df..d81afc43378 100644 --- a/projects/basedfarm/index.js +++ b/projects/basedfarm/index.js @@ -21,11 +21,18 @@ async function tvl(_, _b, _cb, { api, }) { } async function pool2(timestamp, ethBlock, chainBlocks) { - const pools = [{ + const pools = [ + { // BasedRewardPool 'pool2Address': '0x5F45e48F9C053286cE9Ca08Db897f8b7eb3f7992', 'pairToken': ADDRESSES.base.WETH, 'stakingContract': '0x8A75C6EdD19d9a72b31774F1EE2BC45663d30733' - }]; + }, + { // bShareRewardPool + 'pool2Address': '0xbE23ce31C665225E27521D3d7DB9Bb7E5A76aeb8', + 'pairToken': ADDRESSES.base.WETH, + 'stakingContract': '0x227F33775f1320959bAA17280310Fab9ACc4Aa6C' + } +]; const tokensAndOwners = pools.map(i => ([i.pool2Address, i.stakingContract])); const coreAssets = pools.map(i => i.pairToken); @@ -34,6 +41,6 @@ async function pool2(timestamp, ethBlock, chainBlocks) { } module.exports = { - methodology: 'TVL is based on value of the single-sided staked tokens inside of the Genesis reward pool. Pool2 TVL represents the value of specific LP tokens staked in designated pool2 staking contract(BasedRewardPool)', + methodology: 'TVL is based on value of the single-sided staked tokens inside of the Genesis reward pool. Pool2 TVL represents the value of specific LP tokens staked in designated pool2 staking contracts(BasedRewardPool & bShareRewardPool)', base: { tvl,pool2 }, }; From 2d0116c8ef190dda2f47bef303855abae010bff4 Mon Sep 17 00:00:00 2001 From: LastChance <104254800+lastchancedegen@users.noreply.github.com> Date: Fri, 15 Sep 2023 19:55:24 +0100 Subject: [PATCH 1254/1974] ComfySwap: add op_bnb (#7485) --- projects/comfyswap/index.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/projects/comfyswap/index.js b/projects/comfyswap/index.js index dd3204c5daf..462bcdea4bb 100644 --- a/projects/comfyswap/index.js +++ b/projects/comfyswap/index.js @@ -1,3 +1,7 @@ -const { uniTvlExport } = require('../helper/unknownTokens') +const { getUniTVL } = require('../helper/unknownTokens') -module.exports = uniTvlExport('shibarium', '0x09aBAdE821e55d7944965688eA6699a9830BAE45', { fetchBalances: true, }) \ No newline at end of file +module.exports = { + misrepresentedTokens: true, + shibarium: { tvl: getUniTVL({ factory: '0x09aBAdE821e55d7944965688eA6699a9830BAE45', useDefaultCoreAssets: true, }), }, + op_bnb: { tvl: getUniTVL({ factory: '0x9946468d90DE3fD885b7FEE9BF73a956Dc363349', useDefaultCoreAssets: true, }), }, +} From 690552f5ec6d230909cc87f0dee38994b367aeaa Mon Sep 17 00:00:00 2001 From: 0xdip Date: Sun, 17 Sep 2023 00:44:34 +0800 Subject: [PATCH 1255/1974] add dip-exchange tvl --- projects/dip-exchange/index.js | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 projects/dip-exchange/index.js diff --git a/projects/dip-exchange/index.js b/projects/dip-exchange/index.js new file mode 100644 index 00000000000..568b53bc430 --- /dev/null +++ b/projects/dip-exchange/index.js @@ -0,0 +1,29 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokens2 } = require("../helper/unwrapLPs"); +const { pool2 } = require("../helper/pool2"); + +const Contracts = { + Pool: "0xd91bBA888c1F80BeD01b66830D006c26a7e8625c", + Chef: "0xFc81F6cd9F99A00D42aF4a97767B84Cd456Aa909", + DIP_ETH_LBP: "0xF2DDfFEd949EEA23F838C8518A48E4D09Cac9b18", + Tokens: { + axlBTC: "0x1a35EE4640b0A3B87705B0A4B45D227Ba60Ca2ad", + ETH: ADDRESSES.base.WETH, + USDbC: ADDRESSES.base.USDbC, + }, + DIP_ETH_LP: "0x0BE2EF4a1CC597dDd2a354505E08d7934802029d" +} + +async function tvl(_, _b, _cb, { api, }) { + return sumTokens2({ api, owner: Contracts.Pool, tokens: Object.values(Contracts.Tokens) }) +} + +module.exports = { + base: { + tvl, + pool2: pool2(Contracts.DIP_ETH_LBP, Contracts.DIP_ETH_LP), + }, + hallmarks: [ + [Math.floor(new Date('2023-08-14') / 1e3), 'Referral contract exploited'], + ], +}; From c43b80c6e3a4ba64196222494f6d98cd767500f6 Mon Sep 17 00:00:00 2001 From: define Date: Sat, 16 Sep 2023 21:10:32 +0100 Subject: [PATCH 1256/1974] add op and linea chain to interport --- projects/interport-finance/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/interport-finance/index.js b/projects/interport-finance/index.js index bf57456783e..34e0cdd502f 100644 --- a/projects/interport-finance/index.js +++ b/projects/interport-finance/index.js @@ -13,7 +13,7 @@ module.exports = { methodology: 'Interport TVL is calculated by summing the USDT and USDC balance of the vaults contracts, ITP token balance in the ITP Revenue Share contract and LP token balance in the LP Revenue Share contract.', }; -['ethereum', 'avax', 'bsc', 'fantom', 'arbitrum', 'polygon', 'polygon_zkevm', 'base', 'era'].forEach(chain => { +['ethereum', 'avax', 'bsc', 'fantom', 'arbitrum', 'polygon', 'polygon_zkevm', 'base', 'era', 'optimism', 'linea'].forEach(chain => { module.exports[chain] = { tvl: async (_, _1, _2, { api }) => { const vaults = config[chain]?.vaults || defaultVaults From ac56ac0fb6087f59cf73b4b0f0cfd4b94b7283bb Mon Sep 17 00:00:00 2001 From: daedboi <87483308+daedboi@users.noreply.github.com> Date: Sun, 17 Sep 2023 07:53:20 +0300 Subject: [PATCH 1257/1974] Add BMX TVL --- projects/bmx/index.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 projects/bmx/index.js diff --git a/projects/bmx/index.js b/projects/bmx/index.js new file mode 100644 index 00000000000..3be3d0e8366 --- /dev/null +++ b/projects/bmx/index.js @@ -0,0 +1,12 @@ +const { staking } = require("../helper/staking"); +const { gmxExports } = require("../helper/gmx"); +const sdk = require('@defillama/sdk') + +const vaultAddress = "0xec8d8D4b215727f3476FF0ab41c406FA99b4272C"; + +module.exports = { + methodology: "BMX liquidity is calculated by the value of tokens in the BLT pool.", + base: { + tvl: gmxExports({ vault: vaultAddress }) + }, +}; From 695edcadb44e1589dee7f388e28589e1a108b4fc Mon Sep 17 00:00:00 2001 From: Jonathan Silverblood Date: Sun, 17 Sep 2023 23:33:35 +0300 Subject: [PATCH 1258/1974] Update hallmarks (#7491) Adds more hallmarks to provide a richer history --- projects/anyhedge/index.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/projects/anyhedge/index.js b/projects/anyhedge/index.js index a0fac108d3e..533f19b7462 100644 --- a/projects/anyhedge/index.js +++ b/projects/anyhedge/index.js @@ -61,6 +61,11 @@ module.exports = { [1663106400, "AnyHedge Alpha is live and available"], [1666585080, "The BCH Bull (Beta) goes live"], [1666785960, "Paytaca wallet's product live"], + [1680356040, "BCH Bull trials P2P contracts"], + [1681725240, "BCH Bull is released"], + [1683634380, "BCH Bull adds Achievements"], + [1686651480, "BCH Bull raise max contract to $100k"], + [1687330080, "BCH Bull raise max leverage to 7.77x"], ] }; From 35bc35e5e8a07d16c77434df57510748e8c421de Mon Sep 17 00:00:00 2001 From: Haruka Date: Mon, 18 Sep 2023 13:24:37 +0900 Subject: [PATCH 1259/1974] add velocore v2 zksync era --- projects/velocore-v2/index.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/projects/velocore-v2/index.js b/projects/velocore-v2/index.js index f311990613d..2239253fba5 100644 --- a/projects/velocore-v2/index.js +++ b/projects/velocore-v2/index.js @@ -22,5 +22,26 @@ module.exports = { }) }, }, + era: { + tvl: async (_, _1, _2, { api }) => { + const a = await api.call({ + abi: "function canonicalPools(address user, uint256 begin, uint256 maxLength) returns (tuple(address gauge, tuple(address pool, string poolType, bytes32[] lpTokens, uint256[] mintedLPTokens, bytes32[] listedTokens, uint256[] reserves, bytes poolParams) poolData, bool killed, uint256 totalVotes, uint256 userVotes, uint256 userClaimable, uint256 emissionRate, uint256 userEmissionRate, uint256 stakedValueInHubToken, uint256 userStakedValueInHubToken, uint256 averageInterestRatePerSecond, uint256 userInterestRatePerSecond, bytes32[] stakeableTokens, uint256[] stakedAmounts, uint256[] userStakedAmounts, bytes32[] underlyingTokens, uint256[] stakedUnderlying, uint256[] userUnderlying, tuple(bytes32[] tokens, uint256[] rates, uint256[] userClaimable, uint256[] userRates)[] bribes)[] gaugeDataArray)", + target: "0xf55150000aac457eCC88b34dA9291e3F6E7DB165", + params: ["0xf55150000aac457eCC88b34dA9291e3F6E7DB165", 0, 1000] + }); + const b = await api.call({ + abi: "function wombatGauges(address user) returns (tuple(address gauge, tuple(address pool, string poolType, bytes32[] lpTokens, uint256[] mintedLPTokens, bytes32[] listedTokens, uint256[] reserves, bytes poolParams) poolData, bool killed, uint256 totalVotes, uint256 userVotes, uint256 userClaimable, uint256 emissionRate, uint256 userEmissionRate, uint256 stakedValueInHubToken, uint256 userStakedValueInHubToken, uint256 averageInterestRatePerSecond, uint256 userInterestRatePerSecond, bytes32[] stakeableTokens, uint256[] stakedAmounts, uint256[] userStakedAmounts, bytes32[] underlyingTokens, uint256[] stakedUnderlying, uint256[] userUnderlying, tuple(bytes32[] tokens, uint256[] rates, uint256[] userClaimable, uint256[] userRates)[] bribes)[] gaugeDataArray)", + target: "0xf55150000aac457eCC88b34dA9291e3F6E7DB165", + params: ["0xf55150000aac457eCC88b34dA9291e3F6E7DB165"] + }); + let tokens = a.concat(b).map(g => g.poolData.listedTokens).flat().map(i => '0x' + i.slice(2 + 24)) + return sumTokens2({ + owner: "0xf5E67261CB357eDb6C7719fEFAFaaB280cB5E2A6", tokens, blacklistedTokens: [ + '0x99bBE51be7cCe6C8b84883148fD3D12aCe5787F2', + '0x3cD3e41fF4B95a8DdC915F3c7615AB6f2B478c33', + ], api, + }) + }, + }, methodology: "counts tokens in the vault.", }; From 711aee0db5fcd9febc67c57de3c973ee47f6ac09 Mon Sep 17 00:00:00 2001 From: LpcAries <291482574@qq.com> Date: Mon, 18 Sep 2023 12:42:09 +0800 Subject: [PATCH 1260/1974] fix wrong contract config in poolHelpers --- projects/izumi-iziswap/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/izumi-iziswap/index.js b/projects/izumi-iziswap/index.js index 5c78c8cb5bb..62dddbb443d 100644 --- a/projects/izumi-iziswap/index.js +++ b/projects/izumi-iziswap/index.js @@ -22,8 +22,8 @@ const poolHelpers = { 'ontology_evm': ['0x110dE362cc436D7f54210f96b8C7652C2617887D'], 'ultron' : ['0xcA7e21764CD8f7c1Ec40e651E25Da68AeD096037'], 'linea': ['0x1CB60033F61e4fc171c963f0d2d3F63Ece24319c'], - 'kroma': ['0x8c7d3063579BdB0b90997e18A770eaE32E1eBb08'] -} + 'kroma': ['0x110dE362cc436D7f54210f96b8C7652C2617887D'] +} // iziswap liquidityManager contracts const blacklistedTokens = [ ADDRESSES.bsc.iUSD, From 1c98437eb3e5252b50af27dd0fa19bd1ad9525e8 Mon Sep 17 00:00:00 2001 From: define Date: Mon, 18 Sep 2023 12:14:27 +0100 Subject: [PATCH 1261/1974] remove harmony chain from sushiswap --- projects/sushiswap/api.js | 2 +- projects/sushiswap/historical.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/sushiswap/api.js b/projects/sushiswap/api.js index 977473cc2f4..14fc5cf0be0 100644 --- a/projects/sushiswap/api.js +++ b/projects/sushiswap/api.js @@ -59,7 +59,7 @@ module.exports = { okexchain: { tvl, }, arbitrum: { tvl, }, xdai: { tvl, }, - harmony: { tvl, }, + //harmony: { tvl, }, ethereum: { tvl: eth, }, polygon: { tvl, }, fantom: { tvl, }, diff --git a/projects/sushiswap/historical.js b/projects/sushiswap/historical.js index 97278060cf0..a458e2f86a6 100644 --- a/projects/sushiswap/historical.js +++ b/projects/sushiswap/historical.js @@ -9,7 +9,7 @@ const subgraphs = { 'polygon': 'sushiswap/matic-exchange', 'fantom': 'sushiswap/fantom-exchange', 'bsc': 'sushiswap/bsc-exchange', - 'harmony': 'https://sushi.graph.t.hmny.io/subgraphs/name/sushiswap/harmony-exchange', + //'harmony': 'https://sushi.graph.t.hmny.io/subgraphs/name/sushiswap/harmony-exchange', //'okexchain': 'https://q.hg.network/subgraphs/name/sushiswap/okex-exchange', 'avax': 'sushiswap/avalanche-exchange', 'celo': 'sushiswap/celo-exchange', From 67b1fa8eb105e390c6601ec61bf7a758abac5e55 Mon Sep 17 00:00:00 2001 From: Andrey Borzenkov Date: Mon, 18 Sep 2023 16:31:36 +0400 Subject: [PATCH 1262/1974] base chain for MellowProtocol --- projects/MellowProtocol/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/projects/MellowProtocol/index.js b/projects/MellowProtocol/index.js index f4b1007c85e..0debd336b04 100644 --- a/projects/MellowProtocol/index.js +++ b/projects/MellowProtocol/index.js @@ -13,6 +13,10 @@ const config = { polygon_zkevm: { registry: '0xc02a7B4658861108f9837007b2DF2007d6977116', fromBlock: 2665891, + }, + base: { + registry: '0xc02a7B4658861108f9837007b2DF2007d6977116', + fromBlock: 2785683, } } From 2646327227d21d29b099389e616194526bb0f739 Mon Sep 17 00:00:00 2001 From: w-oz Date: Mon, 18 Sep 2023 15:59:25 +0300 Subject: [PATCH 1263/1974] Biswap-v3 - The address of the factory has been changed in reason with redeployment of contracts --- projects/biswap-v3/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/biswap-v3/index.js b/projects/biswap-v3/index.js index bed655ce7b6..21c99a28924 100644 --- a/projects/biswap-v3/index.js +++ b/projects/biswap-v3/index.js @@ -2,7 +2,7 @@ const { sumTokens2 } = require('../helper/unwrapLPs') const { getLogs } = require('../helper/cache/getLogs') const config = { - bsc: { factory: '0x7c3d53606f9c03e7f54abddffc3868e1c5466863', fromBlock: 29462097 }, + bsc: { factory: '0x4d175f2cfe3e2215c1b55865b07787b751cedd36', fromBlock: 31041441 }, } Object.keys(config).forEach(chain => { From 920d321e78151f9e2a6fdfdf29e6b2859ab7249b Mon Sep 17 00:00:00 2001 From: define Date: Mon, 18 Sep 2023 19:01:43 +0100 Subject: [PATCH 1264/1974] test iziswap --- projects/izumi-iziswap/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/izumi-iziswap/index.js b/projects/izumi-iziswap/index.js index 62dddbb443d..9d97a9e507c 100644 --- a/projects/izumi-iziswap/index.js +++ b/projects/izumi-iziswap/index.js @@ -22,7 +22,7 @@ const poolHelpers = { 'ontology_evm': ['0x110dE362cc436D7f54210f96b8C7652C2617887D'], 'ultron' : ['0xcA7e21764CD8f7c1Ec40e651E25Da68AeD096037'], 'linea': ['0x1CB60033F61e4fc171c963f0d2d3F63Ece24319c'], - 'kroma': ['0x110dE362cc436D7f54210f96b8C7652C2617887D'] + 'kroma': ['0x110dE362cc436D7f54210f96b8C7652C2617887D'] //test } // iziswap liquidityManager contracts const blacklistedTokens = [ From 5fa70ca84eaf83470777dcc104a1d7f030c68f80 Mon Sep 17 00:00:00 2001 From: define Date: Mon, 18 Sep 2023 19:07:17 +0100 Subject: [PATCH 1265/1974] comment out kroma chain izi (testing) --- projects/izumi-iziswap/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/izumi-iziswap/index.js b/projects/izumi-iziswap/index.js index 9d97a9e507c..9fa973df146 100644 --- a/projects/izumi-iziswap/index.js +++ b/projects/izumi-iziswap/index.js @@ -22,7 +22,7 @@ const poolHelpers = { 'ontology_evm': ['0x110dE362cc436D7f54210f96b8C7652C2617887D'], 'ultron' : ['0xcA7e21764CD8f7c1Ec40e651E25Da68AeD096037'], 'linea': ['0x1CB60033F61e4fc171c963f0d2d3F63Ece24319c'], - 'kroma': ['0x110dE362cc436D7f54210f96b8C7652C2617887D'] //test + //'kroma': ['0x110dE362cc436D7f54210f96b8C7652C2617887D'] //test } // iziswap liquidityManager contracts const blacklistedTokens = [ From bc206a726f964abd8256b5ca41690febaf25680e Mon Sep 17 00:00:00 2001 From: define Date: Mon, 18 Sep 2023 20:28:47 +0100 Subject: [PATCH 1266/1974] test ondofinance (copy from #7500) --- projects/ondofinance/index.js | 45 +++++++++++++++++++++++++---------- 1 file changed, 32 insertions(+), 13 deletions(-) diff --git a/projects/ondofinance/index.js b/projects/ondofinance/index.js index 4c91c46b45d..4edf493e34e 100644 --- a/projects/ondofinance/index.js +++ b/projects/ondofinance/index.js @@ -1,4 +1,3 @@ - const sdk = require('@defillama/sdk') module.exports = { @@ -10,22 +9,42 @@ module.exports = { const config = { ethereum: { OUSG: '0x1B19C19393e2d034D8Ff31ff34c81252FcBbee92', + USDYc: '0xe86845788d6e3e5c2393ade1a051ae617d974c09', }, polygon: { OUSG: '0xbA11C5effA33c4D6F8f593CFA394241CfE925811', } } -Object.keys(config).forEach(chain => { - let funds = config[chain] - funds = Object.values(funds) +Object.keys(config).forEach((chain) => { + let funds = config[chain]; + const fundKeys = Object.keys(funds); // Capture the keys (OUSG, USDYc, etc.) + funds = Object.values(funds); module.exports[chain] = { - tvl: async (_, _b, _cb, { api, }) => { - const ethApi = new sdk.ChainApi({ chain: 'ethereum', block: _b}) - const supplies = await api.multiCall({ abi: 'erc20:totalSupply', calls: funds }) - const tokenPrice = (await ethApi.call({ abi: 'uint256:rwaPrice', target: '0xc53e6824480d976180A65415c19A6931D17265BA'})) / 1e18 - const totalTvl = (supplies.reduce((a, i) => a +i/1e18, 0) * tokenPrice) - return {'usd-coin':totalTvl} - } - } -}) \ No newline at end of file + tvl: async (_, _b, _cb, { api }) => { + const ethApi = new sdk.ChainApi({ chain: 'ethereum', block: _b }); + const supplies = await api.multiCall({ abi: 'erc20:totalSupply', calls: funds }); + + const tokenPrice = (await ethApi.call({ + abi: 'uint256:rwaPrice', + target: '0xc53e6824480d976180A65415c19A6931D17265BA', + })) / 1e18; + + let totalTvl = 0; + + supplies.forEach((supply, index) => { + const key = fundKeys[index]; + + if (key === 'USDYc') { + // Use the specific price for USDYc + totalTvl += (supply / 1e18) * 1.006437; + } else { + // Use the general token price + totalTvl += (supply / 1e18) * tokenPrice; + } + }); + + return { 'usd-coin': totalTvl }; + }, + }; +}); \ No newline at end of file From d7ee1c166a48769087100bc5f20e0fdd8e97e617 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Mon, 18 Sep 2023 22:58:47 +0100 Subject: [PATCH 1267/1974] add adapter for monarchpay --- projects/monarchpay/index.js | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 projects/monarchpay/index.js diff --git a/projects/monarchpay/index.js b/projects/monarchpay/index.js new file mode 100644 index 00000000000..3124fe1a2ef --- /dev/null +++ b/projects/monarchpay/index.js @@ -0,0 +1,8 @@ + + + +module.exports = { + kava: { + tvl: () => ({}) + } +} \ No newline at end of file From 6f0ea8599f9f0b2dad54814c2c20c4ec0f5e0923 Mon Sep 17 00:00:00 2001 From: Phil <30321052+philipjames44@users.noreply.github.com> Date: Mon, 18 Sep 2023 17:33:55 -0600 Subject: [PATCH 1268/1974] Sommelier: Add new ETH Growth vault (#7504) --- projects/sommelier/cellar-constants.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/projects/sommelier/cellar-constants.js b/projects/sommelier/cellar-constants.js index 59c79358e11..031845174fb 100644 --- a/projects/sommelier/cellar-constants.js +++ b/projects/sommelier/cellar-constants.js @@ -46,10 +46,12 @@ const cellarsV2 = [ // v2.5 Cellars const TURBO_SWETH = "0xd33dad974b938744dac81fe00ac67cb5aa13958e"; const TURBO_GHO = "0x0c190ded9be5f512bd72827bdad4003e9cc7975c"; +const ETH_GROWTH = "0x6c51041a91c91c86f3f08a72cb4d3f67f1208897"; const cellarsV2p5 = [ { id: TURBO_SWETH, startBlock: 17910374 }, { id: TURBO_GHO, startBlock: 18118614 }, + { id: ETH_GROWTH, startBlock: 18144591 }, ]; module.exports = { From 69d525ff70f8af5c29b72a11596d24e3def2417b Mon Sep 17 00:00:00 2001 From: Smile1017 <131600830+Smile1017@users.noreply.github.com> Date: Mon, 18 Sep 2023 19:42:30 -0400 Subject: [PATCH 1269/1974] Add Mozaic Adapter (#7499) * Add Mozaic Adapter * refactor --------- Co-authored-by: g1nt0ki --- projects/mozaic/index.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 projects/mozaic/index.js diff --git a/projects/mozaic/index.js b/projects/mozaic/index.js new file mode 100644 index 00000000000..27c9dcdb2a3 --- /dev/null +++ b/projects/mozaic/index.js @@ -0,0 +1,24 @@ +const vaults = { + arbitrum: "0x8BfED25d58d4c38a3A9BCa1aC45bcFD866A3a88c", + bsc: "0x5712ab97A299a8A4544BCc728B7f3E9663965443", + avax: "0x5712ab97A299a8A4544BCc728B7f3E9663965443", + polygon: "0x5712ab97A299a8A4544BCc728B7f3E9663965443", + fantom: "0x139b227B7Fc46CE6AB2efE7cE6463DD97E6b0A7A", + kava: "0x5712ab97A299a8A4544BCc728B7f3E9663965443", +} + +async function tvl(_, _1, _2, { api }) { + const vault = vaults[api.chain]; + const tokens = await api.call({ abi: 'function getAcceptingTokens () view returns (address[])', target: vault, }); + const bals = await api.multiCall({ abi: 'function getStakedAmountPerToken(address token) view returns (uint256)', calls: tokens, target: vault }) + api.addTokens(tokens, bals) + return api.sumTokens({ owner: vault, tokens }) +} + +module.exports = { + methodology: 'TVL of the mozaic', +}; + +Object.keys(vaults).forEach(chain => { + module.exports[chain] = { tvl } +}) \ No newline at end of file From be7ab0a3e058d24fe39e278decb0ce1d4840db4e Mon Sep 17 00:00:00 2001 From: Staking Agency Date: Tue, 19 Sep 2023 02:44:37 +0300 Subject: [PATCH 1270/1974] add egldReserve (#7496) * add egldReserve * fix egldReserve decimals * fix decimals * Update index.js --- projects/salsa/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/salsa/index.js b/projects/salsa/index.js index 2f689343e74..6d7e381a5c8 100644 --- a/projects/salsa/index.js +++ b/projects/salsa/index.js @@ -6,6 +6,9 @@ const tvl = async (_, _1, _2, { api }) => { const tokenPrice = await call({ target: 'erd1qqqqqqqqqqqqqpgqaqxztq0y764dnet95jwtse5u5zkg92sfacts6h9su3', abi: 'getTokenPrice', responseTypes: ['number'] }); const lsTokenSupply = await call({ target: 'erd1qqqqqqqqqqqqqpgqaqxztq0y764dnet95jwtse5u5zkg92sfacts6h9su3', abi: 'getLiquidTokenSupply', responseTypes: ['number'] }); api.add(ADDRESSES.null, tokenPrice * lsTokenSupply / 1e18) + + const egldReserve = await call({ target: 'erd1qqqqqqqqqqqqqpgqaqxztq0y764dnet95jwtse5u5zkg92sfacts6h9su3', abi: 'getEgldReserve', responseTypes: ['number'] }); + api.add(ADDRESSES.null, egldReserve) }; module.exports = { From e745c7015b2cb444995af2b65c4ac74fbf94a984 Mon Sep 17 00:00:00 2001 From: nuoanunu Date: Tue, 19 Sep 2023 07:02:48 +0700 Subject: [PATCH 1271/1974] Create index.js (#7492) --- projects/Hono/index.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 projects/Hono/index.js diff --git a/projects/Hono/index.js b/projects/Hono/index.js new file mode 100644 index 00000000000..4d4a135aded --- /dev/null +++ b/projects/Hono/index.js @@ -0,0 +1,17 @@ + +const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') + +const HONO = '0x8F5ac7F3cfeFfB6EB638A8aDd2d32661F82C03FD' +const uniV3LP = '0xc4824156785be733d9b98ac4813da0c7bc1b7a44' + +async function tvl(timestamp, block, _, { api }) { + await api.sumTokens({ owner: HONO, tokens: [nullAddress]}) + return sumTokens2({ api, owner: uniV3LP, resolveUniV3: true, blacklistedTokens: [HONO]}) + +} +module.exports = { + methodology: 'TVL will be the sum of 1- total value ofETH backing HONO price and 2- Amount of LP managing by our LP Manager contract minus HONO in LP', + ethereum: { + tvl, + }, +}; From a5077507eb9c9dcdb7721cc0f5e2e8d4450faa23 Mon Sep 17 00:00:00 2001 From: Sagar Chaurasia Date: Tue, 19 Sep 2023 05:37:47 +0530 Subject: [PATCH 1272/1974] Claystack : TVL calculation updated (#7490) * added csETH tvl support * minor fix --- projects/claystack/index.js | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/projects/claystack/index.js b/projects/claystack/index.js index eb89a2fac4f..f03ccace93e 100644 --- a/projects/claystack/index.js +++ b/projects/claystack/index.js @@ -4,14 +4,16 @@ const abi = require('./clayABIs/clayMain.json'); const clayAddresses = { clayMatic: "0x91730940DCE63a7C0501cEDfc31D9C28bcF5F905", + clayEth: "0x331312DAbaf3d69138c047AaC278c9f9e0E8FFf8" }; const coinAddresses = { + ethereum: ADDRESSES.null, matic: ADDRESSES.ethereum.MATIC, }; -async function getClayMaticTvl(_,block) { - const deposits = ( +async function getTvlOnEthereum(_, block) { + const maticDeposits = ( await sdk.api.abi.call({ target: clayAddresses.clayMatic, abi: abi.funds, @@ -19,13 +21,26 @@ async function getClayMaticTvl(_,block) { block }) ).output; - return { [coinAddresses.matic]: deposits.currentDeposit }; + + const ethDeposits = ( + await sdk.api.abi.call({ + target: clayAddresses.clayEth, + abi: abi.funds, + chain: "ethereum", + block + }) + ).output; + + return { + [coinAddresses.ethereum]: ethDeposits.currentDeposit, + [coinAddresses.matic]: maticDeposits.currentDeposit + }; } module.exports = { ethereum: { - tvl: getClayMaticTvl, + tvl: getTvlOnEthereum, }, methodology: `We get the total token deposited in clay contracts and convert it to USD.` } \ No newline at end of file From e5601686292cd09b6293804f18c41dba4b70ad3e Mon Sep 17 00:00:00 2001 From: g1nt0ki Date: Tue, 19 Sep 2023 02:08:27 +0200 Subject: [PATCH 1273/1974] code refactor --- projects/claystack/index.js | 34 +++++----------------------------- 1 file changed, 5 insertions(+), 29 deletions(-) diff --git a/projects/claystack/index.js b/projects/claystack/index.js index f03ccace93e..4e72b669c1e 100644 --- a/projects/claystack/index.js +++ b/projects/claystack/index.js @@ -1,5 +1,4 @@ const ADDRESSES = require('../helper/coreAssets.json') -const sdk = require('@defillama/sdk'); const abi = require('./clayABIs/clayMain.json'); const clayAddresses = { @@ -7,38 +6,15 @@ const clayAddresses = { clayEth: "0x331312DAbaf3d69138c047AaC278c9f9e0E8FFf8" }; -const coinAddresses = { - ethereum: ADDRESSES.null, - matic: ADDRESSES.ethereum.MATIC, -}; - -async function getTvlOnEthereum(_, block) { - const maticDeposits = ( - await sdk.api.abi.call({ - target: clayAddresses.clayMatic, - abi: abi.funds, - chain: "ethereum", - block - }) - ).output; +async function getTvlOnEthereum(_, block, _1, { api }) { + const maticDeposits = await api.call({ target: clayAddresses.clayMatic, abi: abi.funds, }) + const ethDeposits = await api.call({ target: clayAddresses.clayEth, abi: abi.funds, }) - const ethDeposits = ( - await sdk.api.abi.call({ - target: clayAddresses.clayEth, - abi: abi.funds, - chain: "ethereum", - block - }) - ).output; - - return { - [coinAddresses.ethereum]: ethDeposits.currentDeposit, - [coinAddresses.matic]: maticDeposits.currentDeposit - }; + api.add(ADDRESSES.null, ethDeposits.currentDeposit) + api.add(ADDRESSES.ethereum.MATIC, maticDeposits.currentDeposit) } module.exports = { - ethereum: { tvl: getTvlOnEthereum, }, From 5e613cb9505c1cd3e7365d7d8c46ddcc3eefcdc7 Mon Sep 17 00:00:00 2001 From: g1nt0ki Date: Tue, 19 Sep 2023 02:22:00 +0200 Subject: [PATCH 1274/1974] fix iziswap --- package-lock.json | 12 ++++++------ projects/helper/coreAssets.json | 5 +++++ projects/izumi-iziswap/index.js | 2 +- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/package-lock.json b/package-lock.json index a64108cd1f1..ec43ee73587 100644 --- a/package-lock.json +++ b/package-lock.json @@ -785,9 +785,9 @@ } }, "node_modules/@defillama/sdk": { - "version": "4.0.52", - "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.52.tgz", - "integrity": "sha512-NDuUuzOACAIiWzEDDYdV3GeSgvxOL+LguDQVbZdfv0+XfUB3BB0xF2AUy5WV1BrE+yJpx5L3lqSZKceEv9jVXQ==", + "version": "4.0.56", + "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.56.tgz", + "integrity": "sha512-QmiWblExpSsCLxzXKs2NeFMMW3Obya18W8H0gLRowLSpHtmjJeqqmbB7kbcXQc+6NITZ6+MlgLTkQJTQexRZAg==", "dependencies": { "@aws-sdk/client-s3": "^3.400.0", "@supercharge/promise-pool": "^2.1.0", @@ -5905,9 +5905,9 @@ } }, "@defillama/sdk": { - "version": "4.0.52", - "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.52.tgz", - "integrity": "sha512-NDuUuzOACAIiWzEDDYdV3GeSgvxOL+LguDQVbZdfv0+XfUB3BB0xF2AUy5WV1BrE+yJpx5L3lqSZKceEv9jVXQ==", + "version": "4.0.56", + "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.56.tgz", + "integrity": "sha512-QmiWblExpSsCLxzXKs2NeFMMW3Obya18W8H0gLRowLSpHtmjJeqqmbB7kbcXQc+6NITZ6+MlgLTkQJTQexRZAg==", "requires": { "@aws-sdk/client-s3": "^3.400.0", "@supercharge/promise-pool": "^2.1.0", diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index 6d218589217..401dc898610 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -1409,5 +1409,10 @@ "BONE_3": "0x1b2f364032f12bd8a4c89e672e6272de03ae2680", "BONE_4": "0xa2899c776baaf9925d432f83c950d5054a6cf59c", "DAI": "0x50c5725949a6f0c72e6c4a641f24049a917db0cb" + }, + "kroma": { + "WETH": "0x4200000000000000000000000000000000000001", + "USDC": "0x49A5010110a358d9069282873F3e7eCf6B41DC10", + "USDT": "0x0Cf7c2A584988871b654Bd79f96899e4cd6C41C0" } } \ No newline at end of file diff --git a/projects/izumi-iziswap/index.js b/projects/izumi-iziswap/index.js index 9fa973df146..9d97a9e507c 100644 --- a/projects/izumi-iziswap/index.js +++ b/projects/izumi-iziswap/index.js @@ -22,7 +22,7 @@ const poolHelpers = { 'ontology_evm': ['0x110dE362cc436D7f54210f96b8C7652C2617887D'], 'ultron' : ['0xcA7e21764CD8f7c1Ec40e651E25Da68AeD096037'], 'linea': ['0x1CB60033F61e4fc171c963f0d2d3F63Ece24319c'], - //'kroma': ['0x110dE362cc436D7f54210f96b8C7652C2617887D'] //test + 'kroma': ['0x110dE362cc436D7f54210f96b8C7652C2617887D'] //test } // iziswap liquidityManager contracts const blacklistedTokens = [ From 8e217032b280eea2c864b91f64fa8f91d117178e Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Tue, 19 Sep 2023 03:54:38 +0100 Subject: [PATCH 1275/1974] update methodology --- projects/mozaic/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/mozaic/index.js b/projects/mozaic/index.js index 27c9dcdb2a3..57b76e86100 100644 --- a/projects/mozaic/index.js +++ b/projects/mozaic/index.js @@ -16,7 +16,7 @@ async function tvl(_, _1, _2, { api }) { } module.exports = { - methodology: 'TVL of the mozaic', + methodology: 'To calculate the TVL for the Mozaic project, we first identify the vault addresses for each supported chain (Arbitrum, BSC, AVAX, Polygon, Fantom, Kava). For each vault, we retrieve the list of accepted tokens using the `getAcceptingTokens` function. We then determine the staked amount for each token using the `getStakedAmountPerToken` function. The TVL is the sum of all these staked amounts across all tokens and chains.', }; Object.keys(vaults).forEach(chain => { From c31b402be465f36628acdf7cff3bb0a230e02968 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Tue, 19 Sep 2023 06:24:11 +0100 Subject: [PATCH 1276/1974] add kinetix v2 --- projects/kinetix-v2/index.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 projects/kinetix-v2/index.js diff --git a/projects/kinetix-v2/index.js b/projects/kinetix-v2/index.js new file mode 100644 index 00000000000..db85f569e49 --- /dev/null +++ b/projects/kinetix-v2/index.js @@ -0,0 +1,12 @@ +const { getUniTVL } = require("../helper/unknownTokens"); + +module.exports = { + misrepresentedTokens: true, + kava: { + tvl: getUniTVL({ + factory: "0xE8E917BC80A26CDacc9aA42C0F4965d2E1Fa52da", + useDefaultCoreAssets: true, + fetchBalances: true, + }), + }, +}; From 9847aa8b2fe0a0546a6b6ddcad97ce9f42556ef9 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Tue, 19 Sep 2023 07:38:26 +0100 Subject: [PATCH 1277/1974] add kinetix v3 adapter --- projects/kinetix-v3/index.js | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 projects/kinetix-v3/index.js diff --git a/projects/kinetix-v3/index.js b/projects/kinetix-v3/index.js new file mode 100644 index 00000000000..9dab1927951 --- /dev/null +++ b/projects/kinetix-v3/index.js @@ -0,0 +1,8 @@ +const { uniV3Export } = require('../helper/uniswapV3') + +module.exports = uniV3Export({ + kava: { + factory: '0x2dBB6254231C5569B6A4313c6C1F5Fe1340b35C2', + fromBlock: 6069472 + }, +}) From a15aa935ece60439898e8bdfa4448ba72559657b Mon Sep 17 00:00:00 2001 From: define Date: Tue, 19 Sep 2023 13:09:32 +0100 Subject: [PATCH 1278/1974] hallmark to vooi + add tokens to cex.js --- projects/entities/dwf-labs.js | 38 +++++++++++++++++++++++++++++++++++ projects/helper/cex.js | 16 ++++++++++++++- projects/vooi/index.js | 3 +++ 3 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 projects/entities/dwf-labs.js diff --git a/projects/entities/dwf-labs.js b/projects/entities/dwf-labs.js new file mode 100644 index 00000000000..2ed2d1a2e06 --- /dev/null +++ b/projects/entities/dwf-labs.js @@ -0,0 +1,38 @@ +const { treasuryExports } = require("../helper/treasury") + +const config = { + ethereum: { + owners: [ + "0xddAcAd3B1edee8E2F5b2e84f658202534fcb0374", + "0xD4B69e8D62C880E9DD55d419d5E07435C3538342" + ], + }, + linea: { + owners: [ + "0xD4B69e8D62C880E9DD55d419d5E07435C3538342" + ], + }, + polygon: { + owners: [ + "0xD4B69e8D62C880E9DD55d419d5E07435C3538342", + "0xddacad3b1edee8e2f5b2e84f658202534fcb0374" + ], + }, + flare: { + owners: [ + "0xD4B69e8D62C880E9DD55d419d5E07435C3538342" + ], + }, + celo: { + owners: [ + "0xddacad3b1edee8e2f5b2e84f658202534fcb0374" + ], + }, + bsc: { + owners: [ + "0xddacad3b1edee8e2f5b2e84f658202534fcb0374" + ], + }, +} + +module.exports = treasuryExports(config) \ No newline at end of file diff --git a/projects/helper/cex.js b/projects/helper/cex.js index 3c3f3f0fbb3..f729da1b126 100644 --- a/projects/helper/cex.js +++ b/projects/helper/cex.js @@ -151,7 +151,7 @@ const defaultTokens = { nullAddress, ADDRESSES.arbitrum.USDC, // USDC ADDRESSES.arbitrum.USDT, // USDT - ADDRESSES.optimism.DAI, // DAI + ADDRESSES.arbitrum.DAI, // DAI '0x09e18590e8f76b6cf471b3cd75fe1a1a9d2b2c2b' //aidoge ], @@ -173,6 +173,20 @@ const defaultTokens = { ADDRESSES.optimism.USDC, //USDC ADDRESSES.optimism.DAI // DAI ], + linea: [ + nullAddress, + "0xa219439258ca9da29e9cc4ce5596924745e12b93", //bridge usdt + "0x176211869ca2b568f2a7d4ee941e073a821ee1ff", //usdc bridge + "0x4af15ec2a0bd43db75dd04e62faa3b8ef36b00d5" //dai bridge + ], + flare: [ + nullAddress, + ADDRESSES.flare.WFLR, + ], + celo: [ + nullAddress, + "0x471ece3750da237f93b8e339c536989b8978a438" //celo + ], } function cexExports(config) { diff --git a/projects/vooi/index.js b/projects/vooi/index.js index b48bd8f7d12..b723d7769da 100644 --- a/projects/vooi/index.js +++ b/projects/vooi/index.js @@ -3,6 +3,9 @@ const { sumTokensExport } = require('../helper/unwrapLPs') module.exports = { methodology: 'Counts the amount of assets locked in VOOI pools', + hallmarks: [ + [1692921600,"DWF Labs Depo 1.5m$"] + ], }; config.chains.forEach(chainInfo => { From 943b0bbac8eeb8aa3bdf29782abdbf50d646e5e3 Mon Sep 17 00:00:00 2001 From: ZkSwapFinance <126151208+ZkSwapFinance@users.noreply.github.com> Date: Tue, 19 Sep 2023 20:47:35 +0700 Subject: [PATCH 1279/1974] zkswap add tvl tab (#7486) * zkswap DEX on zkSync Era * folder name * old folder * new name folder * minor fix * seprate TVL tokens * update TVL ZF token and staking pools * pair contract * code refactor * add tvl tab * token breakdown --------- Co-authored-by: not found Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/zkSwap-finance/index.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/projects/zkSwap-finance/index.js b/projects/zkSwap-finance/index.js index 7cf1c19734b..d1aef8adec3 100644 --- a/projects/zkSwap-finance/index.js +++ b/projects/zkSwap-finance/index.js @@ -1,11 +1,13 @@ const { getUniTVL, sumTokensExport } = require('../helper/unknownTokens') +const { getLogs } = require('../helper/cache/getLogs') +const { sumTokens2 } = require('../helper/unwrapLPs') + +const FACTORY = '0x3a76e377ed58c8731f9df3a36155942438744ce3' module.exports = { - misrepresentedTokens: true, era: { - tvl: getUniTVL({ factory: '0x3a76e377ed58c8731f9df3a36155942438744ce3', fetchBalances: true, useDefaultCoreAssets: true, }), - staking: sumTokensExport({ owner: '0x9F9D043fB77A194b4216784Eb5985c471b979D67', tokens: ['0x31C2c031fDc9d33e974f327Ab0d9883Eae06cA4A'], lps: ['0xD33A17C883D5aA79470cd2522ABb213DC4017E01'], useDefaultCoreAssets: true }), + tvl: getUniTVL({ factory: FACTORY, fetchBalances: true, useDefaultCoreAssets: false, }), + staking: sumTokensExport({ owner: '0x9F9D043fB77A194b4216784Eb5985c471b979D67', tokens: ['0x31C2c031fDc9d33e974f327Ab0d9883Eae06cA4A'], lps: ['0xD33A17C883D5aA79470cd2522ABb213DC4017E01'], useDefaultCoreAssets: false }), }, methodology: "TVL is total liquidity of all liquidity pools." } - From fe1effadeaf2b0af032d1b70074edd205e7b7906 Mon Sep 17 00:00:00 2001 From: PostTechSoFi <145417396+PostTechSoFi@users.noreply.github.com> Date: Tue, 19 Sep 2023 20:53:06 +0700 Subject: [PATCH 1280/1974] add posttech project (#7505) --- projects/posttech/index.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 projects/posttech/index.js diff --git a/projects/posttech/index.js b/projects/posttech/index.js new file mode 100644 index 00000000000..94113b5207f --- /dev/null +++ b/projects/posttech/index.js @@ -0,0 +1,14 @@ +const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') + +const contract = "0x87da6930626fe0c7db8bc15587ec0e410937e5dc" + +async function tvl(time, ethBlock, _b, {api}) { + return sumTokens2({ tokens: [nullAddress], owner: contract, api }) +} + +module.exports = { + methodology: `We count the ETH on ${contract}`, + arbitrum: { + tvl + } +} \ No newline at end of file From 601b383d8462533e4d36b34ee68102174b228a92 Mon Sep 17 00:00:00 2001 From: ShibaPunkArmy <35100816+ShibaPunkArmy@users.noreply.github.com> Date: Tue, 19 Sep 2023 15:56:34 +0200 Subject: [PATCH 1281/1974] Added PunkSwap Factory (#7507) * Added PunkSwap Factory Added PunkSwap Factory and Masterchef on Shibarium opBNB has only Factory for now and was also added into the index.js file * edited Punkswap Index.js deleted syntax error * update index.js PunkSwap updated index.js for Punkswap DEX --- projects/punkswap/index.js | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 projects/punkswap/index.js diff --git a/projects/punkswap/index.js b/projects/punkswap/index.js new file mode 100644 index 00000000000..a0026345de2 --- /dev/null +++ b/projects/punkswap/index.js @@ -0,0 +1,10 @@ +const {getUniTVL} = require("../helper/unknownTokens"); + +module.exports = { + op_bnb: { + tvl: getUniTVL({ factory: "0x5640113EA7F369E6DAFbe54cBb1406E5BF153E90", useDefaultCoreAssets: true,}) + }, + shibarium: { + tvl: getUniTVL({ factory: "0x5640113EA7F369E6DAFbe54cBb1406E5BF153E90", useDefaultCoreAssets: true,}) + }, +}; \ No newline at end of file From 35623c9497df06c7ff35a6b60875bfdad77ca6c6 Mon Sep 17 00:00:00 2001 From: Dan Date: Tue, 19 Sep 2023 16:00:22 +0200 Subject: [PATCH 1282/1974] added reactors for tvl calculation (#7509) * added reactors for tvl calculation * changed usdc to label --- projects/rysk/index.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/projects/rysk/index.js b/projects/rysk/index.js index ddf047b693f..a0649800cad 100644 --- a/projects/rysk/index.js +++ b/projects/rysk/index.js @@ -6,11 +6,15 @@ async function tvl(_, _b, _cb, { api, }) { const balances = {} const reactorTvl = await api.multiCall({ abi: 'uint256:getPoolDenominatedValue', calls: [ - '0x933589C46233Efa8cCDe8287E077cA6CC51Bec17', - '0xDd418b4Ec8396191D08957bD42F549e215B8e89a', + '0x933589C46233Efa8cCDe8287E077cA6CC51Bec17', // uniswapV3HedgingReactor alpha + '0xDd418b4Ec8396191D08957bD42F549e215B8e89a', // perpHedgingReactor + '0x0053849115783b9678DBB173BB852f06e950Fe05', // uniswapV3HedgingReactor beyond + '0x5250F9ab6a6a7CB447dc96cb218cE9E796905852', // uniswapV3RangeOrderReactor + '0xf013767D55954EcCCacb4914d52D2ef8f95d82C5', // perpHedgingReactor + '0x575e7766F22DBE82b6DD31B915B7D429B9409F16' // gmxHedgingReactor ] }) - reactorTvl.forEach(i => sdk.util.sumSingleBalance(balances, 'tether', i/1e18)) + reactorTvl.forEach(i => sdk.util.sumSingleBalance(balances, 'tether', i / 1e18)) return sumTokens2({ api, balances, tokensAndOwners: [ From f04a1663405eb0e4deea531df5a2564858d71ee6 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Tue, 19 Sep 2023 20:32:06 +0100 Subject: [PATCH 1283/1974] add base --- projects/yearn/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/yearn/index.js b/projects/yearn/index.js index 9d0f130bb01..1bfb23effac 100644 --- a/projects/yearn/index.js +++ b/projects/yearn/index.js @@ -64,6 +64,7 @@ module.exports = { ethereum: { tvl }, arbitrum: { tvl }, optimism: { tvl }, + base: { tvl }, hallmarks: [ [1594944000, "YFI token Launch"], ] From 9ad031ce37555e85d38b35709c885b60397f806b Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Wed, 20 Sep 2023 02:45:08 +0100 Subject: [PATCH 1284/1974] fix ifswap --- projects/ifswap/index.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/projects/ifswap/index.js b/projects/ifswap/index.js index d2a709b916d..fd68f914220 100644 --- a/projects/ifswap/index.js +++ b/projects/ifswap/index.js @@ -1,5 +1,5 @@ const { getUniTVL } = require('../helper/unknownTokens') -const { stakingPricedLP } = require("../helper/staking"); +const { staking } = require("../helper/staking"); const IFS = "0x6925435f9D1CB710abeb680Ec7EF3f8C5E1B2639"; const FACTORY = "0x44b7864D360BFf7879402E3B860aF47e6e371208"; @@ -16,12 +16,10 @@ module.exports = { "We count liquidity of all paris through Factory Contract and Pools (single tokens) seccions through MasterChef Contract.", csc: { tvl: ifswapDexTvl, - staking: stakingPricedLP( + staking: staking( MASTERCHEF, IFS, - "csc", - IFS_USDT_LP, - COREASSETNAME + "csc" ), }, }; From fa14e93ef8315bf2b0108e1d53bc0ec42fc9fa93 Mon Sep 17 00:00:00 2001 From: Hiyorimi Date: Wed, 20 Sep 2023 13:37:26 +0400 Subject: [PATCH 1285/1974] feat: add Tonstakers Liquid Staking protocol on TON --- projects/tonstakers/index.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 projects/tonstakers/index.js diff --git a/projects/tonstakers/index.js b/projects/tonstakers/index.js new file mode 100644 index 00000000000..e92d8245f3b --- /dev/null +++ b/projects/tonstakers/index.js @@ -0,0 +1,23 @@ +const BigNumber = require("bignumber.js"); +const { post } = require('../helper/http') + +module.exports = { + timetravel: false, + methodology: "tsTON", + ton: { + tvl: async () => { + const requestBody = { + "address": "EQCkWxfyhAkim3g2DjKQQg8T5P4g-Q1-K_jErGcDJZ4i-vqR", + "method": "get_pool_full_data", + "stack": [] + } + const response = await post('https://tonapi.com/api/v2/runGetMethod', requestBody) + if (! response.ok) { + throw new Error("Unknown"); + } + const result = response.result + const tonTotalSupply = parseInt(result.stack[2][1], 16) + return {"coingecko:the-open-network": BigNumber(tonTotalSupply).div(1e9).toFixed(0)}; + } + } +} From c32eed462dd2277cb713064d49b83f6a5ea64ebd Mon Sep 17 00:00:00 2001 From: define Date: Wed, 20 Sep 2023 11:05:10 +0100 Subject: [PATCH 1286/1974] testing ifswap --- projects/ifswap/index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/projects/ifswap/index.js b/projects/ifswap/index.js index fd68f914220..dc8d6301f68 100644 --- a/projects/ifswap/index.js +++ b/projects/ifswap/index.js @@ -23,3 +23,5 @@ module.exports = { ), }, }; + +//test adapter From 9dee65c11024c32b2892ad1505877a6f24811cdf Mon Sep 17 00:00:00 2001 From: g1nt0ki Date: Wed, 20 Sep 2023 12:28:04 +0200 Subject: [PATCH 1287/1974] update gains network --- projects/gainsNetwork.js | 2 ++ projects/ifswap/index.js | 15 ++------------- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/projects/gainsNetwork.js b/projects/gainsNetwork.js index d031fe7b9d6..8b8fd4fb1fd 100644 --- a/projects/gainsNetwork.js +++ b/projects/gainsNetwork.js @@ -20,12 +20,14 @@ async function polyTvl(_, _b, _cb, { api }) { [tokens.polygon.DAI, "0xaee4d11a16B2bc65EDD6416Fb626EB404a6D65BD"], [tokens.polygon.DAI, "0xd7052EC0Fe1fe25b20B7D65F6f3d490fCE58804f"], [tokens.polygon.DAI, "0x91993f2101cc758D0dEB7279d41e880F7dEFe827"], + [tokens.polygon.DAI, "0xaee4d11a16B2bc65EDD6416Fb626EB404a6D65BD"], ]; return sumTokens2({ api, tokensAndOwners }); } async function arbiTvl(_, _b, cb, { api}) { const tokensAndOwners = [ [tokens.arbitrum.DAI, "0xd85E038593d7A098614721EaE955EC2022B9B91B"], + [tokens.arbitrum.DAI, "0xcFa6ebD475d89dB04cAd5A756fff1cb2BC5bE33c"], ]; return sumTokens2({ api, tokensAndOwners }); } diff --git a/projects/ifswap/index.js b/projects/ifswap/index.js index dc8d6301f68..4d5193d234f 100644 --- a/projects/ifswap/index.js +++ b/projects/ifswap/index.js @@ -4,24 +4,13 @@ const { staking } = require("../helper/staking"); const IFS = "0x6925435f9D1CB710abeb680Ec7EF3f8C5E1B2639"; const FACTORY = "0x44b7864D360BFf7879402E3B860aF47e6e371208"; const MASTERCHEF = "0xB9C8c5Bf667310a33D4CB675e2f20c7542d8B3B3"; -const IFS_USDT_LP = "0x72083c2de1b53a09ea9ed4a99c63749102ba9aaf"; -const COREASSETNAME = "tether"; -const CHAIN = "csc"; - -const ifswapDexTvl = getUniTVL({ factory: FACTORY, chain: CHAIN, useDefaultCoreAssets: true, }) module.exports = { misrepresentedTokens: true, methodology: "We count liquidity of all paris through Factory Contract and Pools (single tokens) seccions through MasterChef Contract.", csc: { - tvl: ifswapDexTvl, - staking: staking( - MASTERCHEF, - IFS, - "csc" - ), + tvl: getUniTVL({ factory: FACTORY, useDefaultCoreAssets: true, }), + staking: staking(MASTERCHEF, IFS,), }, }; - -//test adapter From 4888b347284f77b37e68dc4bfc3e081ea730b347 Mon Sep 17 00:00:00 2001 From: g1nt0ki Date: Wed, 20 Sep 2023 12:31:29 +0200 Subject: [PATCH 1288/1974] ifswap: disable staking --- projects/ifswap/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/ifswap/index.js b/projects/ifswap/index.js index 4d5193d234f..2a04cfdf12d 100644 --- a/projects/ifswap/index.js +++ b/projects/ifswap/index.js @@ -11,6 +11,6 @@ module.exports = { "We count liquidity of all paris through Factory Contract and Pools (single tokens) seccions through MasterChef Contract.", csc: { tvl: getUniTVL({ factory: FACTORY, useDefaultCoreAssets: true, }), - staking: staking(MASTERCHEF, IFS,), + // staking: staking(MASTERCHEF, IFS,), }, }; From 88672bbae67392b74aad58a1e8f8ba9a4966faed Mon Sep 17 00:00:00 2001 From: TJakubek <39831436+TJakubek@users.noreply.github.com> Date: Wed, 20 Sep 2023 13:39:21 +0300 Subject: [PATCH 1289/1974] adding HLN-WFLR farm (#7514) --- projects/flarefarm/flare.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/flarefarm/flare.js b/projects/flarefarm/flare.js index f9e0c5eb52c..21a1087a14a 100644 --- a/projects/flarefarm/flare.js +++ b/projects/flarefarm/flare.js @@ -12,6 +12,7 @@ async function farmTvl(timestamp, ethblock, { [chain]: block }) { const tokens = [ ['0x7520005032F43229F606d3ACeae97045b9D6F7ea', "0x22beb4c7166DbAa0A33052A770C3b358cAbE9089"], ['0xef24D5155818d4bD16AF0Cea1148A147eb620743', "0x3DA590b357Cf17a413ec8db70FeB02119AfE707f"], + ['0x02C6b5B1fbE01Da872E21f9Dab1B980933B0EF27', "0xd3a273329bab3e263015C1C2ab79C3731769a5b0"], ]; return sumUnknownTokens({ tokensAndOwners: tokens, chain, block, useDefaultCoreAssets: true, }) From 93d732cec2840860f86c5376a677c45c19e2db67 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 20 Sep 2023 16:18:43 +0530 Subject: [PATCH 1290/1974] Ajira-2 (#7515) --- projects/ajira-pay-finance/assets.json | 20 ++++++++ projects/ajira-pay-finance/index.js | 71 ++++++++++++++++---------- 2 files changed, 63 insertions(+), 28 deletions(-) create mode 100644 projects/ajira-pay-finance/assets.json diff --git a/projects/ajira-pay-finance/assets.json b/projects/ajira-pay-finance/assets.json new file mode 100644 index 00000000000..7280625aa56 --- /dev/null +++ b/projects/ajira-pay-finance/assets.json @@ -0,0 +1,20 @@ +{ + "kava": { + "VARA": "0xE1da44C0dA55B075aE8E2e4b6986AdC76Ac77d73", + "MIM": "0x471EE749bA270eb4c1165B5AD95E614947f6fCeb", + "PINKAV": "0xE5274E38E91b615D8822e8512a29A16FF1B9C4Af", + "ATOM": "0x15932E26f5BD4923d46a2b205191C4b5d5f43FE3", + "axlWBTC": "0x1a35EE4640b0A3B87705B0A4B45D227Ba60Ca2ad", + "axlATOM": "0x06beE9E7238a331B68D83Df3B5B9B16d5DBa83ff", + "axlWETH": "0xb829b68f57CC546dA7E5806A929e53bE32a4625D", + "BNB": "0xABd380327Fe66724FFDa91A87c772FB8D00bE488", + "MARE": "0xd86C8d4279CCaFbec840c782BcC50D201f277419", + "TAROT": "0x165DBb08de0476271714952C3C1F068693bd60D7", + "YFX": "0x5E237e61469d1A5b85fA8fba63EB4D4498Ea8dEF", + "GMD": "0xEffaE8eB4cA7db99e954adc060B736Db78928467", + "acsVARA": "0x53a5dD07127739e5038cE81eff24ec503A6CC479", + "QI": "0xC09c73F7B32573d178138E76C0e286BA21085c20", + "CHAM": "0x0Fb3E4E84FB78C93E466a2117Be7bc8BC063E430", + "LION": "0x990e157fC8a492c28F5B50022F000183131b9026" + } +} \ No newline at end of file diff --git a/projects/ajira-pay-finance/index.js b/projects/ajira-pay-finance/index.js index 6d7674cb810..22cb8482f98 100644 --- a/projects/ajira-pay-finance/index.js +++ b/projects/ajira-pay-finance/index.js @@ -1,35 +1,50 @@ -const { staking } = require("../helper/staking"); +const { sumTokensExport, nullAddress } = require('../helper/unwrapLPs') +const ADDRESSES = require('../helper/coreAssets.json') +const ASSETS = require('./assets.json') -const AJP_CONTRACT_ADDRESS = "0x9DBC0Ad09184226313FbDe094E7c3DD75c94f997" -const KAVA_STAKING_CONTRACT = "0xD1cAf204721A02016993796663EDb00E6Ad9dac4" -const BSC_STAKING_CONTRACT = '0xEbD5a0bAED48747ea10feEB61a09a93550Fddcef' +const KAVA_STREAM_VAULT = '0xd8FDE1F90895AB64E74efD376129Ae3e79F1B9f9' -const ammLpData = { - arbitrum: { - poolAddress: '0x0C36cB133CFF5D36313eFF3FF1761F9d391DF8Fc', - }, - bsc: { - poolAddress: '0x808A234665c7684A5e0Ed5e6BB551dBA1cc9d3e4', - }, - polygon: { - poolAddress: '0x2aDA82d11f6bC2bd357E7F3A6674983C372a50A3', - } -} +const KAVA_ASSETS = [ + ADDRESSES.kava.SUSHI, + ASSETS.kava.VARA, + ASSETS.kava.PINKAV, + ASSETS.kava.MARE, + ASSETS.kava.TAROT, + ASSETS.kava.YFX, + ASSETS.kava.GMD, + ASSETS.kava.acsVARA, + ASSETS.kava.QI, + ASSETS.kava.CHAM, + ASSETS.kava.LION +] + +const KAVA_ASSETS_STABLE = [ + nullAddress, + ADDRESSES.kava.WKAVA, + ADDRESSES.kava.DAI, + ADDRESSES.kava.USDT, + ADDRESSES.kava.USDt, + ADDRESSES.kava.BUSD, + ADDRESSES.kava.USDC, + ADDRESSES.kava.ETH, + ADDRESSES.kava.axlUSDC, + ADDRESSES.kava.axlUSDT, + ADDRESSES.kava.axlDAI, + ASSETS.kava.axlWBTC, + ASSETS.kava.axlWETH, + ASSETS.kava.axlATOM, + ADDRESSES.kava.WETH, + ADDRESSES.kava.WBTC, + ADDRESSES.kava.USX, + ASSETS.kava.ATOM, + ASSETS.kava.MIM, + ASSETS.kava.BNB, +] module.exports = { - methodology: "Ajira Pay Finance TVL Calculations are based on AJP Staking pool and Liquidity pool balances respectively on the AMMs", + methodology: "TVL is based on the active balances of assets deposited at the stream vault for token streaming.", kava: { - staking: staking(KAVA_STAKING_CONTRACT, AJP_CONTRACT_ADDRESS), - tvl: () => ({}) - }, - bsc: { - staking: staking(BSC_STAKING_CONTRACT, AJP_CONTRACT_ADDRESS), - tvl: () => ({}) - }, - polygon: { - tvl: () => ({}), - }, - arbitrum: { - tvl: () => ({}), + tvl: sumTokensExport({ owners: [KAVA_STREAM_VAULT], tokens: KAVA_ASSETS_STABLE}), + vesting: sumTokensExport({ owners: [KAVA_STREAM_VAULT], tokens: KAVA_ASSETS}), } }; From d7fe7d5edd4449b0308cadc11db564a44bfedaa4 Mon Sep 17 00:00:00 2001 From: Hodlify <137034650+hodlifyio@users.noreply.github.com> Date: Wed, 20 Sep 2023 18:50:29 +0800 Subject: [PATCH 1291/1974] fix hodlify tvl getting strategy addr on chain (#7512) * fix hodlify tvl getting strategy addr on chain * minor refactor --------- Co-authored-by: g1nt0ki --- projects/hodlify/constants.js | 14 -------------- projects/hodlify/index.js | 25 ++++++++++++++++++------- 2 files changed, 18 insertions(+), 21 deletions(-) diff --git a/projects/hodlify/constants.js b/projects/hodlify/constants.js index 7346fc35e6a..34dd156b69f 100644 --- a/projects/hodlify/constants.js +++ b/projects/hodlify/constants.js @@ -4,9 +4,6 @@ const contracts = { // eth '0x62beB192eBF4790777a084ED482AE1A501b74D65', ], - strategies: [ - '0xf1633e53140a6c9c898d2c82Dabf93D3289724cb', // stargate-eth - ], }, optimism: { vaults: [ @@ -17,10 +14,6 @@ const contracts = { // eth '0x38B2023e7fF7Fe9a33dFF14350d94F017e538768', ], - strategies: [ - '0xe6ab63FbDFec016357da536201139cCf5b6c1059', // stargate-usdc - '0x45B29Ac9F509C6484457d80b66484FC5f2Acd888', // stargate-eth - ], }, polygon: { vaults: [ @@ -28,9 +21,6 @@ const contracts = { '0x98266478600d4Cae5082d2A185cc6533684dA108', // arbitrum satellite '0x4a307418cEd78A3f2348FD84e66453Efe0BDD16a', // optimisim satellite ], - strategies: [ - '0x283D67CAAFc1AA4A2D54c62Be0A44EdFb8099099', // stargate-usdc - ], }, arbitrum: { vaults: [ @@ -41,10 +31,6 @@ const contracts = { // eth '0xD7Aac4989D82361b3b4917DA9D51266E66edBe0a', ], - strategies: [ - '0x0Dba32cFaE7C7edf59603f1BC450DC15E0f46Ddf', // stargate-usdc - '0x5efD42C28D86F2628CE0629F2e5B05037252070a' // stargate-eth - ] }, } diff --git a/projects/hodlify/index.js b/projects/hodlify/index.js index b17440042f2..62311c8f669 100644 --- a/projects/hodlify/index.js +++ b/projects/hodlify/index.js @@ -1,22 +1,33 @@ +const { getUniqueAddresses } = require("../helper/tokenMapping"); const { contracts } = require("./constants"); const { get4626VaultToken, getStrategyVaultValues, getVaultToken } = require("./helper"); /** find balance of vault's underlying assets (excl. lp & positions) */ const getUnderlyingTokenBalance = async (api, vaultAddresses) => { const vaultTokens = await getVaultToken(api, vaultAddresses); - return api.sumTokens({ tokensAndOwners2: [vaultTokens, vaultAddresses]}) + return api.sumTokens({ tokensAndOwners2: [vaultTokens, vaultAddresses] }) } // find the strategy's vault's lp value const getStrategyVaultsLpValue = async (api, vaultAddresses) => { const vaultTokens = await get4626VaultToken(api, vaultAddresses); - await api.sumTokens({ tokensAndOwners2: [vaultTokens, vaultAddresses]}) + await api.sumTokens({ tokensAndOwners2: [vaultTokens, vaultAddresses] }) const [tokens, balances] = await getStrategyVaultValues(api, vaultAddresses); api.addTokens(tokens, balances); } +const fetchStrategyAddresses = async (api, vaultAddresses) => { + const addresses = await api.multiCall({ + calls: vaultAddresses, + abi: 'address:strategy', + }); + + return getUniqueAddresses(addresses); +} + const aggregateVaultTvl = async (api) => { - const { vaults, strategies } = contracts[api.chain]; + const { vaults, } = contracts[api.chain]; + const strategies = await fetchStrategyAddresses(api, vaults); await getUnderlyingTokenBalance(api, vaults); await getStrategyVaultsLpValue(api, strategies); } @@ -30,8 +41,8 @@ module.exports = { doublecounted: true, start: 1693929600, // Tue Sep 05 2023 16:00:00 GMT+0000 methodology: 'Hodlify TVL including total values of assets deposited in other protocols, and the petty cash in our earning vaults.', - ethereum: { tvl}, - arbitrum: { tvl}, - optimism: { tvl}, - polygon: { tvl}, + ethereum: { tvl }, + arbitrum: { tvl }, + optimism: { tvl }, + polygon: { tvl }, } \ No newline at end of file From 49ec68b22e3b68f602a98d60082bc95934796758 Mon Sep 17 00:00:00 2001 From: Winson Cheng <83229800+0xKMG@users.noreply.github.com> Date: Wed, 20 Sep 2023 18:53:47 +0800 Subject: [PATCH 1292/1974] add Vaultka's new Vaults (#7510) --- projects/vaultka/index.js | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/projects/vaultka/index.js b/projects/vaultka/index.js index c8d752c106f..b5ac88dc230 100644 --- a/projects/vaultka/index.js +++ b/projects/vaultka/index.js @@ -19,6 +19,9 @@ module.exports = { sakeWater: "0x6b367F9EB22B2E6074E9548689cddaF9224FC0Ab", sakeV2: "0xc53A53552191BeE184557A15f114a87a757e5b6F", sakeWaterV2: "0x806e8538FC05774Ea83d9428F778E423F6492475", + vodkaV1_Water: "0xC99C6427cB0B824207606dC2745A512C6b066E7C", + VodkaV1: "0x88D7500aF99f11fF52E9f185C7aAFBdF9acabD93", + fsGlp: "0x1aDDD80E6039594eE970E5872D247bf0414C8903", }; const contractAbis = { @@ -29,7 +32,9 @@ module.exports = { stakedVlpBalance: "function getStakedVlpBalance() public view returns (uint256)", vlpPrice: "function getVLPPrice() public view returns (uint256)", + glpPrice: "function getGLPPrice(bool) public view returns (uint256)", waterUSDCBal: "function balanceOfUSDC() public view returns (uint256)", + balanceOf: "function balanceOf(address) view returns (uint256)", }; const whiskeyGainsBalance = await api.call({ @@ -82,6 +87,23 @@ module.exports = { target: addresses.sakeV2, }); + const vodkaWaterUSDCBalV1 = await api.call({ + abi: contractAbis.waterUSDCBal, + target: addresses.vodkaV1_Water, + }); + + const vodkaGLPPrice = await api.call({ + abi: contractAbis.glpPrice, + target: addresses.VodkaV1, + params: [true], + }); + + const vodkaGLPBalV1 = await api.call({ + abi: contractAbis.balanceOf, + target: addresses.fsGlp, + params: [addresses.VodkaV1], + }); + return { tether: bals.reduce((a, i) => a + i / 1e6, 0), dai: @@ -91,7 +113,9 @@ module.exports = { ((vlpBal + StakedVLPBal) * sakeVLPPrice) / 1e18 / 1e5 + sakeWaterUSDCBal / 1e6 + ((vlpBalV2 + StakedVLPBalV2) * sakeVLPPrice) / 1e18 / 1e5 + - sakeWaterUSDCBalV2 / 1e6, + sakeWaterUSDCBalV2 / 1e6 + + vodkaWaterUSDCBalV1 / 1e6 + + (vodkaGLPBalV1 * vodkaGLPPrice) / 1e18 / 1e18, }; }, }, From 425eeb2009da56115b9ff42e2d963c23466626e7 Mon Sep 17 00:00:00 2001 From: g1nt0ki Date: Wed, 20 Sep 2023 13:06:47 +0200 Subject: [PATCH 1293/1974] pick default tokens to look for from cex --- projects/helper/cex.js | 1 + projects/helper/treasury.js | 15 ++++++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/projects/helper/cex.js b/projects/helper/cex.js index f729da1b126..49ff19b074a 100644 --- a/projects/helper/cex.js +++ b/projects/helper/cex.js @@ -220,4 +220,5 @@ function cexExports(config) { module.exports = { cexExports, + defaultTokens, } \ No newline at end of file diff --git a/projects/helper/treasury.js b/projects/helper/treasury.js index 4cf1052fbff..213761232aa 100644 --- a/projects/helper/treasury.js +++ b/projects/helper/treasury.js @@ -1,6 +1,7 @@ const ADDRESSES = require('./coreAssets.json') const { sumTokensExport, nullAddress, } = require('./sumTokens') const { ankrChainMapping } = require('./token') +const { defaultTokens } = require('./cex') const ARB = ADDRESSES.arbitrum.ARB; @@ -12,11 +13,15 @@ function treasuryExports(config) { if (chain === 'solana') config[chain].solOwners = owners if (chain === 'solana') config[chain].solOwners = owners const tvlConfig = { ...config[chain], } - if (config[chain].fetchCoValentTokens !== false && ankrChainMapping[chain]) { - tvlConfig.fetchCoValentTokens = true - const { tokenConfig } = config[chain] - if (!tokenConfig) { - tvlConfig.tokenConfig = { onlyWhitelisted: false, } + if (config[chain].fetchCoValentTokens !== false) { + if (ankrChainMapping[chain]) { + tvlConfig.fetchCoValentTokens = true + const { tokenConfig } = config[chain] + if (!tokenConfig) { + tvlConfig.tokenConfig = { onlyWhitelisted: false, } + } + } else if (defaultTokens[chain]) { + tvlConfig.tokens = [tokens, defaultTokens[chain]].flat() } } From b76abe04c73411505afd48e7eec730e94b755465 Mon Sep 17 00:00:00 2001 From: g1nt0ki Date: Wed, 20 Sep 2023 13:25:52 +0200 Subject: [PATCH 1294/1974] liqwid: track USDT --- projects/liqwid/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/projects/liqwid/index.js b/projects/liqwid/index.js index 38a5d7fda60..c5c269d0793 100644 --- a/projects/liqwid/index.js +++ b/projects/liqwid/index.js @@ -61,6 +61,7 @@ const tokenMapping = { DJED: '8db269c3ec630e06ae29f74bc39edd1f87c819f1056206e879a1cd61446a65644d6963726f555344', SHEN: '8db269c3ec630e06ae29f74bc39edd1f87c819f1056206e879a1cd615368656e4d6963726f555344', USDC: 'usd-coin', + USDT: 'tether', } const getToken = market => tokenMapping[market.marketId.toUpperCase()] ?? base64ToHex(market.info.params.underlyingClass.value0.symbol) @@ -76,8 +77,9 @@ async function tvl(_, _b, _cb, { api, }) { function add(api, market, bal) { const token = getToken(market) if (token === 'usd-coin') bal /= 1e8 + if (token === 'tether') bal /= 1e8 api.add(token, bal, { - skipChain: token === 'usd-coin' + skipChain: token === 'usd-coin' || token === 'tether' }) } From 279ec4c17c7940e47c3aa7719ce563636cce91f0 Mon Sep 17 00:00:00 2001 From: Akshay Gupta Date: Wed, 20 Sep 2023 10:33:58 -0400 Subject: [PATCH 1295/1974] clean up --- projects/savvy/contracts.json | 13 ++++++------- projects/savvy/index.js | 2 +- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/projects/savvy/contracts.json b/projects/savvy/contracts.json index c0aa91604a8..3b874ce1afb 100644 --- a/projects/savvy/contracts.json +++ b/projects/savvy/contracts.json @@ -16,10 +16,10 @@ "SavvySageBTC": "0x2fcCd0f67d0722f5EB7c1A404DFF0224544155E3", "SavvySageETH": "0xCd5156Fdd53fD9A0f5bfc37B212DD9c989C10533", "SavvySageUSD": "0x78A370c3d5fFF93Da53a2B088a117244c52AF857", - "SavvyAArbWBTC": "0xDD7e69c478288A9596DECc2230A39c7b922413Dd", - "SavvyAArbWETH": "0xCaB3886D48bAd0F749ba7e7c7A255b636c64F937", - "SavvyAArbUSDC": "0xCdFF8576683E22621f512fc2E6d347A9D241DAd3", - "JonesAdapterUSDC": "0x32157bEE957411EDf2648ED2Bc184B15f2Fe8d1C", + "AaveUSDCAdapter": "0xCdFF8576683E22621f512fc2E6d347A9D241DAd3", + "AaveWETHAdapter": "0xCaB3886D48bAd0F749ba7e7c7A255b636c64F937", + "AaveWBTCAdapter": "0xDD7e69c478288A9596DECc2230A39c7b922413Dd", + "JonesUSDCAdapter": "0x32157bEE957411EDf2648ED2Bc184B15f2Fe8d1C", "GmdUSDCAdapter": "0xbf8Aa25aD262AaA3D875034412ea080Ff1144cda", "GmdETHAdapter": "0x7628B50765C9D407058b2262b04Cf5E69b5e59D3", "GmdBTCAdapter": "0x43e6ecb5C17B069fdc61456Fb1E12B295Ab8591B" @@ -27,9 +27,9 @@ }, "savvyTokens": { "SVY": "0x43aB8f7d2A8Dd4102cCEA6b438F6d747b1B9F034", + "svUSD": "0xF202Ab403Cd7E90197ec0f010ee897E283037706", "svBTC": "0xeEE18334c414A47FB886a7317E1885b2Bfb8c2A6", - "svETH": "0xf7728582002ef82908c8242CF552E969BA863Ffa", - "svUSD": "0xF202Ab403Cd7E90197ec0f010ee897E283037706" + "svETH": "0xf7728582002ef82908c8242CF552E969BA863Ffa" }, "baseTokens": { "WETH": "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1", @@ -49,6 +49,5 @@ "gmdBTC": "0x147FF11D9B9Ae284c271B2fAaE7068f4CA9BB619", "gmdETH": "0x1E95A37Be8A17328fbf4b25b9ce3cE81e271BeB3" } - } diff --git a/projects/savvy/index.js b/projects/savvy/index.js index ded3a7bd75d..72d6b843be4 100644 --- a/projects/savvy/index.js +++ b/projects/savvy/index.js @@ -5,7 +5,7 @@ function tvl(chain) { return async (timestamp, block, chainBlocks, { api }) => { const tokens = Object.values(contracts.baseTokens).concat(Object.values(contracts.yieldTokens)); await sumTokens2({ tokens, api, owners: Object.values(contracts.tokenHolders) }) - };g + }; } module.exports = { From c29b886b632a975722dfdbff0b7218661d76c29c Mon Sep 17 00:00:00 2001 From: Akshay Gupta Date: Wed, 20 Sep 2023 10:46:36 -0400 Subject: [PATCH 1296/1974] lbp hallmark --- projects/savvy/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/projects/savvy/index.js b/projects/savvy/index.js index 72d6b843be4..91dd32d5dd0 100644 --- a/projects/savvy/index.js +++ b/projects/savvy/index.js @@ -12,5 +12,8 @@ module.exports = { methodology: 'The calculated TVL is the current sum of all base tokens and yield tokens in our contracts.', arbitrum: { tvl: tvl("arbitrum") - } + }, + hallmarks: [ + [1691473498, "LBP Launch"] + ] } \ No newline at end of file From 472b314d609d9bde3f75d5f527fd62640257cad3 Mon Sep 17 00:00:00 2001 From: Kir Malev Date: Wed, 20 Sep 2023 19:56:47 +0400 Subject: [PATCH 1297/1974] Update proper domain update --- projects/tonstakers/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/tonstakers/index.js b/projects/tonstakers/index.js index e92d8245f3b..fdbfd39a5c9 100644 --- a/projects/tonstakers/index.js +++ b/projects/tonstakers/index.js @@ -11,7 +11,7 @@ module.exports = { "method": "get_pool_full_data", "stack": [] } - const response = await post('https://tonapi.com/api/v2/runGetMethod', requestBody) + const response = await post('https://toncenter.com/api/v2/runGetMethod', requestBody) if (! response.ok) { throw new Error("Unknown"); } From 595f1e9304ba0a11e816b5ddbee3719fc3eb7c48 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Wed, 20 Sep 2023 22:28:47 +0100 Subject: [PATCH 1298/1974] polyfriendtech --- projects/polyfriendtech/index.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 projects/polyfriendtech/index.js diff --git a/projects/polyfriendtech/index.js b/projects/polyfriendtech/index.js new file mode 100644 index 00000000000..614f380a361 --- /dev/null +++ b/projects/polyfriendtech/index.js @@ -0,0 +1,14 @@ +const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') + +const contract = "0x25d1bf639a350c58b03bca310ecca955fb13fad0" + +async function tvl(time, ethBlock, _b, {api}) { + return sumTokens2({ tokens: [nullAddress], owner: contract, api }) +} + +module.exports = { + methodology: `We count the ETH on ${contract}`, + polygon: { + tvl + } +} \ No newline at end of file From d16382b4cea3bc12519c953d6c24b4743bbcac0a Mon Sep 17 00:00:00 2001 From: moonbasefi <143190385+moonbasefi@users.noreply.github.com> Date: Thu, 21 Sep 2023 01:21:48 +0200 Subject: [PATCH 1299/1974] Adding MoonBase adapter (#7522) * Create index.js * Update index.js * Update index.js * Update index.js --- projects/moonbase/index.js | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 projects/moonbase/index.js diff --git a/projects/moonbase/index.js b/projects/moonbase/index.js new file mode 100644 index 00000000000..6ab3af028b5 --- /dev/null +++ b/projects/moonbase/index.js @@ -0,0 +1,10 @@ +const { getUniTVL } = require("../helper/unknownTokens"); +module.exports = { + methodology: + "Uses Uniswap-style factory address to find and price liquidity pairs.", + base: { + tvl: getUniTVL({ + factory: "0xe396465A85deDB00FA8774162B106833dE51Ea41", + }), + }, +}; From 5aa19d9d8901ac4c5979f7588882a6a54af02d99 Mon Sep 17 00:00:00 2001 From: Sandy Swap <145192144+sandyswapdex@users.noreply.github.com> Date: Thu, 21 Sep 2023 03:24:32 +0400 Subject: [PATCH 1300/1974] Add sandyswap (#7517) Co-authored-by: SandySwap --- projects/sandyswap/index.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 projects/sandyswap/index.js diff --git a/projects/sandyswap/index.js b/projects/sandyswap/index.js new file mode 100644 index 00000000000..4e1d585dc0d --- /dev/null +++ b/projects/sandyswap/index.js @@ -0,0 +1,14 @@ +const { uniTvlExport } = require("../helper/calculateUniTvl.js"); + +module.exports = { + misrepresentedTokens: true, + polygon_zkevm: { + tvl: uniTvlExport( + "0xdb9908b6e0b87338194ae8627583194994bd992d", + "polygon_zkevm", + undefined, + undefined, + { useDefaultCoreAssets: true, hasStablePools: true, fetchBalances: true } + ), + }, +}; From ce98b744ac507c331c68b07be0c318e445bd5c1a Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Thu, 21 Sep 2023 00:25:57 +0100 Subject: [PATCH 1301/1974] use getUnitTVL code --- projects/sandyswap/index.js | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/projects/sandyswap/index.js b/projects/sandyswap/index.js index 4e1d585dc0d..b2931fe85b4 100644 --- a/projects/sandyswap/index.js +++ b/projects/sandyswap/index.js @@ -1,14 +1,11 @@ -const { uniTvlExport } = require("../helper/calculateUniTvl.js"); +const { getUniTVL } = require('../helper/unknownTokens.js') module.exports = { - misrepresentedTokens: true, - polygon_zkevm: { - tvl: uniTvlExport( - "0xdb9908b6e0b87338194ae8627583194994bd992d", - "polygon_zkevm", - undefined, - undefined, - { useDefaultCoreAssets: true, hasStablePools: true, fetchBalances: true } - ), + polygon_zkevm:{ + tvl: getUniTVL({ + useDefaultCoreAssets: true, + hasStablePools: true, + factory: '0xdb9908b6e0b87338194ae8627583194994bd992d', + }), }, -}; +} From 789061af4c7d2479fa20900415e602681f39252d Mon Sep 17 00:00:00 2001 From: Brandon Date: Wed, 20 Sep 2023 19:13:15 -0700 Subject: [PATCH 1302/1974] add kava --- projects/steer/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/projects/steer/index.js b/projects/steer/index.js index a936ba4eedb..973e487bfb2 100644 --- a/projects/steer/index.js +++ b/projects/steer/index.js @@ -10,6 +10,7 @@ const config = { polygon_zkevm: { registry: '0x9f5b097AD23e2CF4F34e502A3E41D941678877Dc', fromBlock: 1022413, }, celo: { registry: '0x116Dba5DcE9CcDA828218b7eB46406810632014C', fromBlock: 19813127, }, thundercore: { registry: '0xa1Dd21fbd9e1F0BF28d41F18bDC22326e50C02e9', fromBlock: 135181847, }, + kava: {registry: '0xe240B9a2936f6Fb8860219bC059349e50F03492e', fromBlock: 5915232, }, } module.exports = {}; @@ -22,6 +23,7 @@ Object.keys(config).forEach(chain => { api, target: registry, topic: "VaultCreated(address,address,string,uint256,address)", + // topics: ["0x3910bed511b4ecc0d6ae24498d585722a54c6ce9ab5e65b4be534cec981f7f6f"], eventAbi: 'event VaultCreated(address deployer, address vault, string beaconName, uint256 indexed tokenId, address vaultManager)', onlyArgs: true, fromBlock, @@ -39,4 +41,4 @@ Object.keys(config).forEach(chain => { }) } } -}) \ No newline at end of file +}) From dc2c90c001acb3b448e07c6e6993953fda3578b8 Mon Sep 17 00:00:00 2001 From: define Date: Thu, 21 Sep 2023 11:57:40 +0100 Subject: [PATCH 1303/1974] bitstamp and coinw cex adapter --- projects/bitstamp/index.js | 110 +++++++++++++++++++++++++++++++++++++ projects/coinw/index.js | 31 +++++++++++ 2 files changed, 141 insertions(+) create mode 100644 projects/bitstamp/index.js create mode 100644 projects/coinw/index.js diff --git a/projects/bitstamp/index.js b/projects/bitstamp/index.js new file mode 100644 index 00000000000..9263d63d09b --- /dev/null +++ b/projects/bitstamp/index.js @@ -0,0 +1,110 @@ +const { cexExports } = require('../helper/cex') + +const config = { + ethereum: { + owners: [ + '0x896dfee1afeb6336e86911bd5a341c1264e5611a', + '0x48ec5560bfd59b95859965cce48cc244cfdf6b0c', + '0x16a798dbd8fa626143bb4f06fa4724d4145d4e6e', + '0x379825f8da776b573a63404a5c499c8a379a131f', + '0x6130611f7a65deb930bd0c0825af88078fcced43', + '0xcddf488f1c826160ee832d4f1492f00cf8557ff6', + '0x593aebee9117eea447279e5973f64c68d8e977a0', + '0x6778c14331251bbbee71414eda389dcef4bd81b8', + '0x772396dd44ce3d347838bfec437cb32f534963f2', + '0xab09b0c5c112999bee4f45e323c4ad2b59638603', + '0xd4fcc07a8da7d55599167991d4ab47f976d0a306', + '0xd46914c273443505563d346f98d41f6a40dff36c', + '0x182e1259ef6ee45dc811132ef4ba5871f1536822', + '0x6dca94b6173c28a4900ea257121e6002c0b96968', + '0xfbb23038fe6cfa16aa898d7dbca7c3269bdaf258', + '0x518b82370bc31ebb96922ec257d92517d7387615', + '0x4c0907f7ad337635a7fd414a0c7a938e0d64bf4d', + '0xab7bb7959332888e44d795c6f28ee876a8469eaa', + '0x858c83a0c97a3a710fd3b9167a0248d76d3b036f', + '0xee7c0bf91f9ac8117b490c8e028714acbcb41364', + '0x31c84a968736fcfe02a9ba274e0fa515a4a6659c', + '0xee9fb7a615cb76b46d26be6ebc9114a627a81c5b', + '0x1522900b6dafac587d499a862861c0869be6e428', + '0xb8e73ba7c6c0b50a0cd94fe9f6622762b0401c02', + '0x4c766def136f59f6494f0969b1355882080cf8e0', + '0xb66410ae75317faf13dba869b6df7b30892d1e46', + '0xde0f7df88678e2aee576a2f3d9b18d4dfad0155c', + '0x964771f6df31eea2d927fa71d7bd78e81bcdce05', + '0xa3fb85c3a2c50d8c0e1dd7fa7746f97c9e1d9591', + '0x333c100ae1a2743a1e55d73913cac6d95deb7f62', + '0xc0ac2f4a3cf22fd504d8835b07f5acccfa9b27f9', + '0x3f3e23249f38d35a4cdaf44edfd99eeb4325b401', + '0x88a4df73aac310484c60c4c0ac4904cab938c20b', + '0xc5b611f502a0dcf6c3188fd494061ae29b2baa4f', + '0x9fec89e34efaa4fc9f19c02f474c71373e6effe7', + '0x7e677cacaae0d465cfd336869f1f575a48bf012a', + '0xe1576685451986e3f93c2fb87cca3aec5b5d45d0', + '0xc20b79cff9d2c89ba8aeb9abf4bfef0314ca7bd2', + '0x059799f2261d37b829c2850cee67b5b975432271', + '0x8366dcab4cc14c826fc9d51bd4c16567bd07b02a', + '0x9a9bed3eb03e386d66f8a29dc67dc29bbb1ccb72', + '0xbcddeba6a9672c1f76a8b8edd3190bdfe6d4ef11', + ], + }, + bitcoin: { + owners: [ + "3312eBSkTsjjmKs5sYXdt7mE8H7dHxPEVH", + "3GUWpWqvaovudjG635LUzNXk3Ss1mjcm9M", + "38gEk7LkqdM8xm66i6Wz5TU6cbrhoboQFK", + "3HM4BJM3WGVbG59xp2v276LjEAAkms7EPG", + "3En4rmQMjEaCeCUXWAFNPJh9vFAYDdLTQc", + "3CqawYdjUh59Qj7WGvna5rAGn7ApuSKUgG", + "3HVHcuRXWhrn2dG8r6gPjxTKcjMmaCrNRg", + "3EwyjNGDXeK9tQ2mTS5Xz9Wh7ajyGmunMV", + "39PxrQEhMgDcsvsPhCJ5CBfrXeW9BECxg1", + "3QVD5HvPJLbQhDsDdoDZtW9cwZG3mEFzRN", + "3MF4BwuPuasoK6v4a3iarDgSFVjmXxLG6j", + "39emsnF1cY5djp3kmrdR5H9ghdjDwVwjiP", + "3Ee3Cft7X4DbRzMoBdaKWrCZ4AqriA5sbF", + "338A5vHMB2CMCQfMqYgY8awH5Ho5YbNShs", + "35MynuEPTZJd8Y7QhEsUiKKt18TrF9UgJQ", + "33t9PxtMC3yUpT5gvjVaA4PDwaMT8xCbpu", + "bc1q532e9kept2a8sgdkj3p2xy9l5pdlrv76skpphadq3xr2lk9wrllqgxqygw", + "bc1qajtynuexync79hveple9s7r83rsk49gq858ktdchjaze4853dtksy38uux", + "bc1q2wx2hpjn036mu6qg2zwsqrm0g8h9gtm4egj4cymjtvyaapsz09usep66v9", + "bc1qgc446er7nn9t92hnk5untxg2ad4hvxaanpvwmrexy8caykjzj7ws9hqjmr", + "3JuPfeK7N4hTgXp3ULx6a4zr5fFwoBmdFU", + "32jWyMp8CfoFfQ6QRfXGi7hQJ6d1YfPykB", + "bc1qhex599hljc4zx67zuh0yqk9r7npkqhwld0af6urx7mv58ykx2vgq0z5sta", + "bc1qyfcls8kletachlsg54zvqujvnvvr76lkezqe43kf63p5yc0hnx5sq42q6k", + "3Hi5VHVgmYZYfAPc9aNvQoNXyEv5rYvJQN", + "bc1q3lgd3ggp2fvr27aat6kat00yawhqley5wpl4fytc3f6cyfyz98nsave8sw", + "bc1qkg6x25h8w0060k2dkzq57ltyfm4yahm9uwz6rda8efep9fe38h2qekh58h", + "bc1qwj7zwn3p4y8grutk9zxxn09vm0cs9g0mledte5kqxsm43w08u6pqp8p82q", + "bc1q3anumarec8zlzs7nt4waljuhg2ueel6m0z5s3v7vg6cnfu66m83spupgm6", + "bc1qckj933afq7ultlp4nrqhqk3shkaxt6j8y39htyn0umglr233m6wqfv7ay8", + "bc1qhusm86yqagqczep0dfmge53q3rehn0rzw5qeqwr0gtyw5p2sdkyspgu2me", + "bc1qzdyl7pr0nuqka4lzgkj58ukk0crp8qflgjseumj55nm8c0027v7q99jmhv", + "bc1qrl2cxsmm4aqgtkyxs25thvcc0p0wvujp8gkjuw228g43w7ccz26q7a37ys", + "bc1qaj2ew0aerhf9ggd3rw3xjn79f49w0dadxk4vg083adzzvpmuhp4scadxsu", + "bc1qqrgs3laxzxrkpzvqgmca6njpmxsjjta3vlvlngz8kdz78g8d9e4sa8l3l8", + "bc1qejhwz50y9fnrqfu8dmy9jtv4k3k4yphpnegv06utvqek6u4jfv3qhr9ts5", + "3Jowo3hYr1oqv7J7osUu4eW88owPZScgFk", + "bc1qjzwquwh3psueazgs43u4m2s56gernmuxl95964vl20nee2fn27cq5r4fhg", + "bc1qa9v2dxhxsj75mcczwlssparhhnzcmkudg3tswtdcfrr0eussva9qxwzpdl", + "bc1qdvzxxwmcc2th8f9x0vj6jw8xz7sqkjp994z6vd6mapy48uce0xfsu2qdxz", + "3Jc5hrY64F1C9rfrXJrrKR73bhGj3Um3Eq", + "3KDH9yEKVksjSTj13PpnrhrfSpqwFWzNVB", + "367TJA4M2DE37ZLuv48ujTxVa7ESqa2pUF", + "3CC4qT3fTW9deeTQqXBQH273YMcRWrHBje", + "36NSBe6tr6rAYnKrj5tHnTGNLUdJ7wFd7q", + "3L5TXDJvpn8ZuVMxRNqsxXod68eLgnQcJv", + "3MiAhu93R5PNLbsSDDa8Mx9bzJ1p5h8mJV", + "3Q4Boc44ZzUVeDSv7Kst4iADM6jETrk7RV", + "33fyemB54JUv9DGXzFCdGM37vDJ3eXnrce", + "bc1q926pgy6v9l9fqck759js2k557fxn8xxpj8rz070m70c0q5g8nqcqx70wjp", + "3F4ceyGSFiN2pep4pjqXEHnZNHcvzh3W9y", + "bc1qrxtqv6ym455etlvx86c98qk7ujherxgcycpwxjqyxacalztalslqhtd8hw", + "bc1qlyvp6l3t47qqszngk8kyele2up4rf8t9g4jsmy8g9y48xhhuxvrs0eflt6", + "bc1qgrzeldvkp9n6yrq9ess9rxv7kcczdh9ta93llnh7tgxr5542seus2q36jy" + ] + }, +} + +module.exports = cexExports(config) \ No newline at end of file diff --git a/projects/coinw/index.js b/projects/coinw/index.js new file mode 100644 index 00000000000..56de3cda348 --- /dev/null +++ b/projects/coinw/index.js @@ -0,0 +1,31 @@ +const { cexExports } = require('../helper/cex') + +const config = { + ethereum: { + owners: [ + '0xa20f10289248717374e9b7776dc368aa526cb6f2', + '0x611f32e5d7f6640ecaf3e66759318abb9cbece64', + '0x2d6323cc438b96f0ae942280762cc507b5398563', + '0xbf2d58698a8a215f868cf24baba360c77266b466', + '0x3864d8f360ba98212a2eddf05a357599f25196c1', + '0xb840fe2b3fd8f75275240c671d6ec659e4c9a500', + '0xe48a4e20be4ea888748c56bdcb632d960cbfb011' + ], + }, + bitcoin: { + owners: [ + '14Z9KSmCo1UjvBiXj2j9er35GmGmaFxsmE', + '1KYBKqRjGbRynSiyoiHndULssXrEeWhvU8', + ] + }, + tron: { + owners: [ + 'TEdzoWmVaKnSjvbY33FNjkGogo5xKUkSRD', + 'TXWmdMZkLA45WPiKqTMeLvcHPeZSj1npdp', + 'TRg92o9H1T7m5beDvTzqGYJ1CLoyEnjUpB', + 'TTvYfJhC45kLriLTEAbVawBrBQhAW8shh3' + ] + }, +} + +module.exports = cexExports(config) \ No newline at end of file From 9929469066af73258816587d48ae184eec58459c Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 21 Sep 2023 16:37:01 +0530 Subject: [PATCH 1304/1974] Revert "Revert "fix: hashmix tvl api was down last week, now back online (#7445)" (#7446)" (#7447) This reverts commit 5444062f3821726d9d4e9ae7b1c2156d83f2d991. --- projects/hashmix/index.js | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/projects/hashmix/index.js b/projects/hashmix/index.js index a5b12390c6e..0f109a556e2 100644 --- a/projects/hashmix/index.js +++ b/projects/hashmix/index.js @@ -1,26 +1,32 @@ const POOL = "0x587A7eaE9b461ad724391Aa7195210e0547eD11d"; -const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') +const { sumTokens2, nullAddress } = require("../helper/unwrapLPs"); const { get } = require("../helper/http"); const BigNumber = require("bignumber.js"); const { sdk } = require("@defillama/sdk"); -async function tvl(_, _1, _2, { api }) { - const totalBorrows = await api.call({ target: POOL, abi: "uint256:totalBorrows", }); - const totalReserves = await api.call({ target: POOL, abi: "uint256:totalReserves", }); - api.add(nullAddress, totalBorrows) - api.add(nullAddress, totalReserves * -1) +// async function tvl(_, _1, _2, { api }) { +// const totalBorrows = await api.call({ +// target: POOL, +// abi: "uint256:totalBorrows", +// }); +// const totalReserves = await api.call({ +// target: POOL, +// abi: "uint256:totalReserves", +// }); +// api.add(nullAddress, totalBorrows); +// api.add(nullAddress, totalReserves * -1); +// +// return sumTokens2({ api, owner: POOL, tokens: [nullAddress] }); +// } +async function tvl(_, _1, _2, { api }) { + let tvl = await get("https://fvm.hashmix.org/fevmapi/tvl"); + api.add(nullAddress, tvl.data); return sumTokens2({ api, owner: POOL, tokens: [nullAddress] }); } /* async function tvl1(_, _1, _2, { api }) { - // let tvl = await get("https://fvm.hashmix.org/fevmapi/tvl"); - - // api.add(nullAddress, tvl.data) - - // return sumTokens2({ api, owner: POOL, tokens: [nullAddress] }); - const balances = {}; const bal = await sdk.api2.eth.getBalance({ target: POOL, chain: api.chain, decimals: api.decimals }); const totalBorrows = await sdk.api2.abi.call({ From 8cbe00437a8ecd260f211e4c0b73f71e47ecaf9a Mon Sep 17 00:00:00 2001 From: define Date: Thu, 21 Sep 2023 12:14:44 +0100 Subject: [PATCH 1305/1974] coinex + fastex exchanges --- projects/coinex/index.js | 46 ++++++++++++++++++++++++++++++++++++++++ projects/fastex/index.js | 22 +++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 projects/coinex/index.js create mode 100644 projects/fastex/index.js diff --git a/projects/coinex/index.js b/projects/coinex/index.js new file mode 100644 index 00000000000..93d7b69dd29 --- /dev/null +++ b/projects/coinex/index.js @@ -0,0 +1,46 @@ +const { cexExports } = require('../helper/cex') + +const config = { + ethereum: { + owners: [ + '0x187e3534f461d7c59a7d6899a983a5305b48f93f', + '0x33ddd548fe3a082d753e5fe721a26e1ab43e3598', + '0x90f86774e792e91cf81b2ff9f341efca649343a6', + '0x85cf05f35b6d542ac1d777d3f8cfde57578696fc', + '0xda07f1603a1c514b2f4362f3eae7224a9cdefaf9', + '0x601a63c50448477310fedb826ed0295499baf623', + '0x53eb3ea47643e87e8f25dd997a37b3b5260e7336', + '0xd782e53a49d564f5fce4ba99555dd25d16d02a75', + '0x5ad4d300fa795e9c2fe4221f0e64a983acdbcac9', + ], + }, + bitcoin: { + owners: [ + '189myj1KAbiCWfqWhT6Td4noANKBuag3QN', + '1C2Pxf3ghtKyM4mKC3xSLKrN33YcKnKF2a', + '1JZw5HYSoAEfvGGVQ4U2JihZaQkjcXrr2i', + '16M3n9p6CLATDnpsJNTjCn22AaxzErxg5V', + '15cYMF4jcRwpcbjENMdMizCzAmd7Pc51So', + '18JQXgQ4GjZAuYCy1fNAFGHVEAWUui2q9h', + '1LGbUy11yMaNC9s73q7vEad8JTZyczCima', + '1DGXwH2gzBYM6UrVE57DaaQ3hJJm3s32YK', + '152GodsXfK5kYMdH4spzYD3Ttm1u2oNipN', + '18oxoXCq5mah3GjLjGCS3BRTQxxN7738rL', + '1H21g458T25SnAzvFDJiBrcyhfwHiCH5YF', + '14BhR6aE8Fkt2c8E1m2ydx76fBz5kpt62K', + '1Ef59jZsv87uAcwBZdDhNxiSbCceQ6bFTA', + '14ukjw4r3UFC5A8yvG7yt2GdvLUHEWtskS', + '141TDnaiLEW1vE5xd42Dw8HEhDCA2qrZTr', + '1Ew9SPwBHY8GjHd3uBxhtGcvVmyBN7PHcw', + '1LYrQCjUf54vf9G4qwFpJQ9RCyL2DprPqQ', + ] + }, + tron: { + owners: [ + 'TTMWTPp1vonsdYBuLey3x8k6PsAvZcdR1J', + 'TFp4V3S9JqJyQAMMCewyn4aAaLueJwzS7H', + ] + }, +} + +module.exports = cexExports(config) \ No newline at end of file diff --git a/projects/fastex/index.js b/projects/fastex/index.js new file mode 100644 index 00000000000..f86b57f0527 --- /dev/null +++ b/projects/fastex/index.js @@ -0,0 +1,22 @@ +const { cexExports } = require('../helper/cex') + +const config = { + ethereum: { + owners: [ + '0xc21a1d213f64fedea3415737cce2be37eb59be81', + '0x85e1de87a7575c6581f7930f857a3813b66a14d8', + ], + }, + bitcoin: { + owners: [ + 'bc1qs7yen7ljpvyw7vn58ql6zfaddqf4rcjalsgmt5' + ] + }, + tron: { + owners: [ + 'TPj7TCJ9rxdd243yQ3tc7iJzqcEYtupB4v' + ] + }, +} + +module.exports = cexExports(config) \ No newline at end of file From 0b90e55737040715920ac75b90d1908d415dbe61 Mon Sep 17 00:00:00 2001 From: g1nt0ki Date: Thu, 21 Sep 2023 14:10:42 +0200 Subject: [PATCH 1306/1974] update affine --- projects/affine-defi/index.js | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/projects/affine-defi/index.js b/projects/affine-defi/index.js index 605963845c7..89e0a356ed7 100644 --- a/projects/affine-defi/index.js +++ b/projects/affine-defi/index.js @@ -1,23 +1,25 @@ const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens2 } = require('../helper/unwrapLPs') +const { getConfig } = require('../helper/cache') +const BTC_ETH_VAULT = '0x1F9b1057cd93fb2d07d18810903B791b56acc2E1'.toLowerCase() async function tvl(_, _b, _cb, { api, }) { - const vaults = ['0x829363736a5A9080e05549Db6d1271f070a7e224'] - const tokens = await api.multiCall({ abi: 'address:asset', calls: vaults }) - const bals = await api.multiCall({ abi: 'uint256:totalAssets', calls: vaults }) - api.addTokens(tokens, bals) + await getBasketTvl(api) const ownerTokens = [ - [[ADDRESSES.polygon.WETH_1, ADDRESSES.polygon.WBTC], '0x1F9b1057cd93fb2d07d18810903B791b56acc2E1'] + [[ADDRESSES.polygon.WETH_1, ADDRESSES.polygon.WBTC], BTC_ETH_VAULT] ] return sumTokens2({ api, ownerTokens }) } async function ethTvl(_, _b, _cb, { api, }) { - const ethBaskets = [ - '0x61A18EE9d6d51F838c7e50dFD750629Fd141E944', '0x78Bb94Feab383ccEd39766a7d6CF31dED177Ad0c', '0x72D51B2233c5feA8a702FDd0E51B0adE95638f2c' - ] - const tokens = await api.multiCall({ abi: 'address:asset', calls: ethBaskets }) - const bals = await api.multiCall({ abi: 'uint256:totalAssets', calls: ethBaskets }) + return getBasketTvl(api) +} + +async function getBasketTvl(api) { + const data = await getConfig('affine-defi', 'https://api.affinedefi.com/v2/getBasketMetadata') + const baskets = Object.values(data).filter(i => i.chainId === api.chainId && i.basketAddress.toLowerCase() !== BTC_ETH_VAULT).map(i => i.basketAddress) + const tokens = await api.multiCall({ abi: 'address:asset', calls: baskets }) + const bals = await api.multiCall({ abi: 'uint256:totalAssets', calls: baskets }) api.addTokens(tokens, bals) } From c94d529f50830c5ac439ea53d7cdc92c5cd90dd5 Mon Sep 17 00:00:00 2001 From: allush Date: Thu, 21 Sep 2023 13:34:53 +0100 Subject: [PATCH 1307/1974] symbiosis adds BaaS portals --- projects/helper/coreAssets.json | 9 ++++++--- projects/symbiosis-finance/config.js | 6 ++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index 401dc898610..c73c93ba5d7 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -40,7 +40,8 @@ "sUSD_OLD": "0x57ab1e02fee23774580c119740129eac7081e9d3", "sUSD": "0x57Ab1ec28D129707052df4dF418D58a2D46d5f51", "SUSHI": "0x6b3595068778dd592e39a122f4f5a5cf09c90fe2", - "cbETH": "0xBe9895146f7AF43049ca1c1AE358B0541Ea49704" + "cbETH": "0xBe9895146f7AF43049ca1c1AE358B0541Ea49704", + "XDAO": "0x71eebA415A523F5C952Cc2f06361D5443545Ad28" }, "fantom": { "WFTM": "0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83", @@ -112,7 +113,8 @@ "IVN": "0x6a46d878401f46b4c7f665f065e0667580e031ec", "ankrBNB": "0xe85afccdafbe7f2b096f268e31cce3da8da2990a", "aBNBb": "0xbb1aa6e59e5163d8722a122cd66eba614b59df0d", - "TUSD": "0x40af3827f39d0eacbf4a168f8d4ee67c121d11c9" + "TUSD": "0x40af3827f39d0eacbf4a168f8d4ee67c121d11c9", + "XDAO": "0x71eebA415A523F5C952Cc2f06361D5443545Ad28" }, "polygon": { "WMATIC": "0xfd28c7cea3c50a060cb4c0059e453c6d4dd9829d", @@ -134,7 +136,8 @@ "YIN": "0x794baab6b878467f93ef17e2f2851ce04e3e34c8", "BNB": "0x5c4b7ccbf908e64f32e12c6650ec0c96d717f03f", "BUSD": "0x9c9e5fd8bbc25984b178fdce6117defa39d2db39", - "WORK": "0x6002410dda2fb88b4d0dc3c1d562f7761191ea80" + "WORK": "0x6002410dda2fb88b4d0dc3c1d562f7761191ea80", + "XDAO": "0x71eebA415A523F5C952Cc2f06361D5443545Ad28" }, "xdai": { "WXDAI": "0xe91d153e0b41518a2ce8dd3d7944fa863463a97d", diff --git a/projects/symbiosis-finance/config.js b/projects/symbiosis-finance/config.js index 637b059ee4c..4d28490f073 100644 --- a/projects/symbiosis-finance/config.js +++ b/projects/symbiosis-finance/config.js @@ -7,10 +7,12 @@ module.exports = { ADDRESSES.ethereum.USDC, ADDRESSES.ethereum.USDT, ADDRESSES.ethereum.WETH, + ADDRESSES.ethereum.XDAO, ], holders: [ '0xb80fDAA74dDA763a8A158ba85798d373A5E84d84', // portal v1 '0xb8f275fBf7A959F4BCE59999A2EF122A099e81A8', // portal v2 + '0x42Cd64f48496dDdfEfF8F3704df9175dbe20d325', // portal v2 BaaS ] }, { @@ -19,10 +21,12 @@ module.exports = { ADDRESSES.bsc.BUSD, ADDRESSES.bsc.USDC, ADDRESSES.bsc.ETH, + ADDRESSES.bsc.XDAO, ], holders: [ '0xD7F9989bE0d15319d13d6FA5d468211C89F0b147', // portal v1 '0x5Aa5f7f84eD0E5db0a4a85C3947eA16B53352FD4', // portal v2 + '0xb91d3060C90aac7c4c706aef2B37997b3b2a1DcF', // portal v2 BaaS '0xab0738320A21741f12797Ee921461C691673E276', // v1 pool with Ethereum ] }, @@ -44,10 +48,12 @@ module.exports = { tokens: [ ADDRESSES.polygon.USDC, ADDRESSES.polygon.WETH_1, + ADDRESSES.polygon.XDAO, ], holders: [ '0xD7F9989bE0d15319d13d6FA5d468211C89F0b147', // portal v1 '0xb8f275fBf7A959F4BCE59999A2EF122A099e81A8', // portal v2 + '0x3338BE49A5f60e2593337919F9aD7098e9a7Dd7E', // portal v2 BaaS '0xab0738320A21741f12797Ee921461C691673E276', // v1 pool with Ethereum '0xF4BFF06E02cdF55918e0ec98082bDE1DA85d33Db', // v1 pool with BNB chain '0x3F1bfa6FA3B6D03202538Bf0cdE92BbE551104ac', // v1 pool with Avalanche From 648330835569542e526f258658625d52d7aa6680 Mon Sep 17 00:00:00 2001 From: g1nt0ki Date: Thu, 21 Sep 2023 17:19:28 +0200 Subject: [PATCH 1308/1974] track shoebill v2 --- projects/shoebillFinance-v2/index.js | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 projects/shoebillFinance-v2/index.js diff --git a/projects/shoebillFinance-v2/index.js b/projects/shoebillFinance-v2/index.js new file mode 100644 index 00000000000..5101a98c8d7 --- /dev/null +++ b/projects/shoebillFinance-v2/index.js @@ -0,0 +1,5 @@ +const { compoundExports2 } = require('../helper/compound') + +module.exports = { + klaytn: compoundExports2({ comptroller: '0xEE3Db1711ef46C04c448Cb9F5A03E64e7aa22814', cether: '0xac6a4566d390a0da085c3d952fb031ab46715bcf'}) +} \ No newline at end of file From 6e7f9306b85c2e6419e35bc1f38d448ea4ccfee9 Mon Sep 17 00:00:00 2001 From: define Date: Thu, 21 Sep 2023 16:40:30 +0100 Subject: [PATCH 1309/1974] vvs v3 --- projects/vvs-v3/index.js | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 projects/vvs-v3/index.js diff --git a/projects/vvs-v3/index.js b/projects/vvs-v3/index.js new file mode 100644 index 00000000000..fff949c3fda --- /dev/null +++ b/projects/vvs-v3/index.js @@ -0,0 +1,8 @@ +const { uniV3Export } = require("../helper/uniswapV3"); + +module.exports = uniV3Export({ + cronos: { + factory: "0x40aB11c64E9fF5368F09343Ac860dAfA34e14C35", + fromBlock: 10292950, + }, +}); \ No newline at end of file From fc47cc619652e57c3e4a524ef98231b11fc41c11 Mon Sep 17 00:00:00 2001 From: g1nt0ki Date: Thu, 21 Sep 2023 17:58:39 +0200 Subject: [PATCH 1310/1974] minor fix --- projects/helper/coreAssets.json | 9 +++------ projects/symbiosis-finance/config.js | 8 +++++--- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index c73c93ba5d7..401dc898610 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -40,8 +40,7 @@ "sUSD_OLD": "0x57ab1e02fee23774580c119740129eac7081e9d3", "sUSD": "0x57Ab1ec28D129707052df4dF418D58a2D46d5f51", "SUSHI": "0x6b3595068778dd592e39a122f4f5a5cf09c90fe2", - "cbETH": "0xBe9895146f7AF43049ca1c1AE358B0541Ea49704", - "XDAO": "0x71eebA415A523F5C952Cc2f06361D5443545Ad28" + "cbETH": "0xBe9895146f7AF43049ca1c1AE358B0541Ea49704" }, "fantom": { "WFTM": "0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83", @@ -113,8 +112,7 @@ "IVN": "0x6a46d878401f46b4c7f665f065e0667580e031ec", "ankrBNB": "0xe85afccdafbe7f2b096f268e31cce3da8da2990a", "aBNBb": "0xbb1aa6e59e5163d8722a122cd66eba614b59df0d", - "TUSD": "0x40af3827f39d0eacbf4a168f8d4ee67c121d11c9", - "XDAO": "0x71eebA415A523F5C952Cc2f06361D5443545Ad28" + "TUSD": "0x40af3827f39d0eacbf4a168f8d4ee67c121d11c9" }, "polygon": { "WMATIC": "0xfd28c7cea3c50a060cb4c0059e453c6d4dd9829d", @@ -136,8 +134,7 @@ "YIN": "0x794baab6b878467f93ef17e2f2851ce04e3e34c8", "BNB": "0x5c4b7ccbf908e64f32e12c6650ec0c96d717f03f", "BUSD": "0x9c9e5fd8bbc25984b178fdce6117defa39d2db39", - "WORK": "0x6002410dda2fb88b4d0dc3c1d562f7761191ea80", - "XDAO": "0x71eebA415A523F5C952Cc2f06361D5443545Ad28" + "WORK": "0x6002410dda2fb88b4d0dc3c1d562f7761191ea80" }, "xdai": { "WXDAI": "0xe91d153e0b41518a2ce8dd3d7944fa863463a97d", diff --git a/projects/symbiosis-finance/config.js b/projects/symbiosis-finance/config.js index 4d28490f073..60ec9da9df4 100644 --- a/projects/symbiosis-finance/config.js +++ b/projects/symbiosis-finance/config.js @@ -1,4 +1,6 @@ const ADDRESSES = require('../helper/coreAssets.json') +const XDAO = '0x71eebA415A523F5C952Cc2f06361D5443545Ad28' + module.exports = { chains: [ { @@ -7,7 +9,7 @@ module.exports = { ADDRESSES.ethereum.USDC, ADDRESSES.ethereum.USDT, ADDRESSES.ethereum.WETH, - ADDRESSES.ethereum.XDAO, + XDAO, ], holders: [ '0xb80fDAA74dDA763a8A158ba85798d373A5E84d84', // portal v1 @@ -21,7 +23,7 @@ module.exports = { ADDRESSES.bsc.BUSD, ADDRESSES.bsc.USDC, ADDRESSES.bsc.ETH, - ADDRESSES.bsc.XDAO, + XDAO, ], holders: [ '0xD7F9989bE0d15319d13d6FA5d468211C89F0b147', // portal v1 @@ -48,7 +50,7 @@ module.exports = { tokens: [ ADDRESSES.polygon.USDC, ADDRESSES.polygon.WETH_1, - ADDRESSES.polygon.XDAO, + XDAO, ], holders: [ '0xD7F9989bE0d15319d13d6FA5d468211C89F0b147', // portal v1 From 8d1eac85e4c5e0127a972e189dd1c150445ddd07 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 21 Sep 2023 21:31:57 +0530 Subject: [PATCH 1311/1974] Symbiosis-2 (#7530) --- projects/symbiosis-finance/config.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/projects/symbiosis-finance/config.js b/projects/symbiosis-finance/config.js index 637b059ee4c..60ec9da9df4 100644 --- a/projects/symbiosis-finance/config.js +++ b/projects/symbiosis-finance/config.js @@ -1,4 +1,6 @@ const ADDRESSES = require('../helper/coreAssets.json') +const XDAO = '0x71eebA415A523F5C952Cc2f06361D5443545Ad28' + module.exports = { chains: [ { @@ -7,10 +9,12 @@ module.exports = { ADDRESSES.ethereum.USDC, ADDRESSES.ethereum.USDT, ADDRESSES.ethereum.WETH, + XDAO, ], holders: [ '0xb80fDAA74dDA763a8A158ba85798d373A5E84d84', // portal v1 '0xb8f275fBf7A959F4BCE59999A2EF122A099e81A8', // portal v2 + '0x42Cd64f48496dDdfEfF8F3704df9175dbe20d325', // portal v2 BaaS ] }, { @@ -19,10 +23,12 @@ module.exports = { ADDRESSES.bsc.BUSD, ADDRESSES.bsc.USDC, ADDRESSES.bsc.ETH, + XDAO, ], holders: [ '0xD7F9989bE0d15319d13d6FA5d468211C89F0b147', // portal v1 '0x5Aa5f7f84eD0E5db0a4a85C3947eA16B53352FD4', // portal v2 + '0xb91d3060C90aac7c4c706aef2B37997b3b2a1DcF', // portal v2 BaaS '0xab0738320A21741f12797Ee921461C691673E276', // v1 pool with Ethereum ] }, @@ -44,10 +50,12 @@ module.exports = { tokens: [ ADDRESSES.polygon.USDC, ADDRESSES.polygon.WETH_1, + XDAO, ], holders: [ '0xD7F9989bE0d15319d13d6FA5d468211C89F0b147', // portal v1 '0xb8f275fBf7A959F4BCE59999A2EF122A099e81A8', // portal v2 + '0x3338BE49A5f60e2593337919F9aD7098e9a7Dd7E', // portal v2 BaaS '0xab0738320A21741f12797Ee921461C691673E276', // v1 pool with Ethereum '0xF4BFF06E02cdF55918e0ec98082bDE1DA85d33Db', // v1 pool with BNB chain '0x3F1bfa6FA3B6D03202538Bf0cdE92BbE551104ac', // v1 pool with Avalanche From b6608c32e68a5a8a33abfe857ac00c9f4cd4fbe1 Mon Sep 17 00:00:00 2001 From: g1nt0ki Date: Thu, 21 Sep 2023 18:55:54 +0200 Subject: [PATCH 1312/1974] fix linear --- projects/linear/abis.json | 5 ---- projects/linear/index.js | 53 ++++++--------------------------------- 2 files changed, 8 insertions(+), 50 deletions(-) delete mode 100644 projects/linear/abis.json diff --git a/projects/linear/abis.json b/projects/linear/abis.json deleted file mode 100644 index f4e247bd574..00000000000 --- a/projects/linear/abis.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "totalLockedAmount": "uint256:totalLockedAmount", - "totalStakeAmount": "uint256:totalStakeAmount", - "totalSubscribedAmount": "uint256:totalSubscribedAmount" -} \ No newline at end of file diff --git a/projects/linear/index.js b/projects/linear/index.js index b3ddc8b1863..8b3146ede74 100644 --- a/projects/linear/index.js +++ b/projects/linear/index.js @@ -1,12 +1,7 @@ const ADDRESSES = require('../helper/coreAssets.json') -const sdk = require("@defillama/sdk"); -const BigNumber = require("bignumber.js"); - -const abis = require("./abis.json"); const { pool2 } = require("../helper/pool2"); const LnCollateralSystemAddress = "0xcE2c94d40e289915d4401c3802D75f6cA5FEf57E"; -const LnRewardLockerAddress = "0x66D60EDc3876b8aFefD324d4edf105fd5c4aBeDc"; const tokens = { lUSD: "0x23e8a70534308a4aaf76fb8c32ec13d17a3bd89e", @@ -19,55 +14,23 @@ const vaultpools = { bUSD: "0x072F11c46146Ce636691d387BFbF8fD28e818EE8", lUSD: "0xD36b669491ADFB5cDE87C281dF417148674f88B4", LP: "0x12efdFF85f717ac1738CF50Be5f4Cdc916b0B8B1", -}; - -function getBSCAddress(address) { - if(address.toLowerCase() === tokens.lUSD){ - return "bsc:"+tokens.bUSD - } - return `bsc:${address}`; } -async function tvl(timestamp, blockETH, chainBlocks) { - const block = chainBlocks["bsc"]; - const balances = {}; - - const stakedLina = await sdk.api.abi.call({ - block, - chain: "bsc", - target: tokens["LINA"], - params: LnCollateralSystemAddress, - abi: "erc20:balanceOf", - }); - sdk.util.sumSingleBalance(balances, getBSCAddress(tokens["LINA"]), stakedLina.output) - const bUSDPoolLockedlUSD = await sdk.api.abi.call({ - block, - chain: "bsc", - target: tokens["lUSD"], - params: vaultpools["lUSD"], - abi: "erc20:balanceOf", +async function tvl(timestamp, blockETH, chainBlocks, { api }) { + return api.sumTokens({ + tokensAndOwners: [ + [[tokens.LINA], LnCollateralSystemAddress], + [[tokens.bUSD], vaultpools["bUSD"]], + ] }); - - const lUSDPoolLockedlUSD = await sdk.api.abi.call({ - block, - chain: "bsc", - target: tokens["lUSD"], - params: vaultpools["bUSD"], - abi: "erc20:balanceOf", - }); - - balances[getBSCAddress(tokens["bUSD"])] = BigNumber(bUSDPoolLockedlUSD.output) - .plus(lUSDPoolLockedlUSD.output).toFixed(0); - - return balances; } module.exports = { timetravel: true, - methodology: "Counts LINA used to collateralize lUSD and lUSD locked in the vaults. lUSD is replaced with BUSD.", + methodology: "Counts LINA used to collateralize lUSD", bsc: { tvl, - pool2: pool2(vaultpools["LP"], "0x392f351fc02a3b74f7900de81a9aaac13ec28e95", "bsc", getBSCAddress), + pool2: pool2(vaultpools["LP"], "0x392f351fc02a3b74f7900de81a9aaac13ec28e95"), }, }; From 156f10aa7c861d016236d29812e65376f6340d00 Mon Sep 17 00:00:00 2001 From: Alexander Ponomarev Date: Thu, 21 Sep 2023 20:59:55 +0400 Subject: [PATCH 1313/1974] support LINE project (#7527) * feat: support LINE project * fix * typo * fix --- projects/counterstake/index.js | 36 +++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/projects/counterstake/index.js b/projects/counterstake/index.js index 3905909706c..f8ae48b5621 100644 --- a/projects/counterstake/index.js +++ b/projects/counterstake/index.js @@ -15,6 +15,7 @@ const utils = require('../helper/utils'); const sdk = require('@defillama/sdk') const { sumTokens2 } = require('../helper/unwrapLPs') const { getConfig } = require('../helper/cache') +const { formatUnits } = require('ethers/lib/utils') async function bridgeTvl(timestamp, assetMetadata, exchangeRates) { const baseAABalances = await Promise.all([ @@ -124,7 +125,40 @@ const totalTVLByEVMNetwork = async (_, _1, _2, { api }) => { tokensAndOwners.push([voteTokenAddress, governanceAddress ]) }); - return sumTokens2({ api, tokensAndOwners}) + const sum = await sumTokens2({ api, tokensAndOwners }); + + return tryToGetUSDPriceOfUnknownTokens(sum, api); +}; + +const tryToGetUSDPriceOfUnknownTokens = async (sum, api) => { + const LINE_CONTRACT = '0x31f8d38df6514b6cc3c360ace3a2efa7496214f6'; + const LINE_TOKEN_KEY = `kava:${LINE_CONTRACT}`; + + const transformedSumObject = { ...sum }; + + if (LINE_TOKEN_KEY in sum) { // support LINE token on Kava Network + + const ORACLE_CONTRACT_ADDRESS = await api.call({ + abi: "address:oracle", + target: LINE_CONTRACT, + }); + + const totalLocked = BigInt(transformedSumObject[LINE_TOKEN_KEY]); + + const linePriceInCollateral = await api.call({ + abi: "uint256:getPrice", + target: ORACLE_CONTRACT_ADDRESS, + }); + + const priceInCollateral = formatUnits(totalLocked * BigInt(linePriceInCollateral), 36); + const exchangeRates = await fetchOswapExchangeRates(); + + transformedSumObject['usd'] = exchangeRates['GBYTE_USD'] * priceInCollateral; + + delete transformedSumObject[LINE_TOKEN_KEY]; + } + + return transformedSumObject; } module.exports = { From 1631976a1dc9824eeb346b2038841bc2b3424227 Mon Sep 17 00:00:00 2001 From: define Date: Thu, 21 Sep 2023 22:04:50 +0100 Subject: [PATCH 1314/1974] test vvs v3 --- projects/vvs-v3/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/vvs-v3/index.js b/projects/vvs-v3/index.js index fff949c3fda..ca7b5a19a1b 100644 --- a/projects/vvs-v3/index.js +++ b/projects/vvs-v3/index.js @@ -5,4 +5,4 @@ module.exports = uniV3Export({ factory: "0x40aB11c64E9fF5368F09343Ac860dAfA34e14C35", fromBlock: 10292950, }, -}); \ No newline at end of file +}); //test \ No newline at end of file From f889399bd189f997540d2f245dc228548771c560 Mon Sep 17 00:00:00 2001 From: Strategic Reserve Date: Thu, 21 Sep 2023 17:01:29 -0700 Subject: [PATCH 1315/1974] Add BaseX-Base and Uni-Moonbeam --- projects/visor/config.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/projects/visor/config.js b/projects/visor/config.js index d86aa0c9685..a85dee0392c 100644 --- a/projects/visor/config.js +++ b/projects/visor/config.js @@ -28,7 +28,7 @@ const HYPE_REGISTRY = { ["0x7b9c2f68f16c3618bb45616fb98d83f94fd7062e", 44933860], // Ascent ], polygon_zkevm: [ - ["0xD08B593eb3460B7aa5Ce76fFB0A3c5c938fd89b8", 152596,], // Quickswap + ["0xD08B593eb3460B7aa5Ce76fFB0A3c5c938fd89b8", 152596], // Quickswap ], optimism: [ ["0xF5BFA20F4A77933fEE0C7bB7F39E7642A070d599", 6538026], // Uniswap @@ -45,6 +45,7 @@ const HYPE_REGISTRY = { ["0xd4bcFC023736Db5617E5638748E127581d5929bd", 26097149], // Thena ], moonbeam: [ + ["0x688cb9492bd2C72016f1765d813B2D713aa1F4C7", 4485966], // Uniswap ["0xB7dfC304D9cd88D98A262cE5B6a39Bb9d6611063", 3591244], // Beamswap ["0x6002D7714e8038f2058e8162b0b86c0b19c31908", 3569487], // Stellaswap ], @@ -67,8 +68,9 @@ const HYPE_REGISTRY = { ["0xc27ddd78fc49875fe6f844b72bbf31dfbb099881", 163300], // Lynex ], base: [ - ["0x1E86A593E55215957C4755f1BE19a229AF3286f6", 2798768], // SynthSwap + ["0xB24DC81f8Be7284C76C7cF865b803807B3C2EF55", 4249062], // SynthSwap ["0x6d5c54F535b073B9C2206Baf721Af2856E5cD683", 3785552], // Sushiswap + ["0x6d5c54F535b073B9C2206Baf721Af2856E5cD683", 3785552], // BaseX ], }; From 48a4f35454f546bc491e0420179758a1bb10ce16 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Fri, 22 Sep 2023 19:28:39 +0100 Subject: [PATCH 1316/1974] add wton address --- projects/helper/tokenMapping.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 5e85eb1cf9b..32eea68fd76 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -55,6 +55,9 @@ const fixBalancesTokens = { pg: { '0x0cf4071940782b640d0b595cb17bdf3e90869d70': { coingeckoId: 'pego-network-2', decimals: 18 }, }, + ton: { + 'EQCajaUU1XXSAjTD-xOV7pE49fGtg4q8kF3ELCOJtGvQFQ2C': { coingeckoId: 'the-open-network', decimals: 9 } + } } ibcChains.forEach(chain => fixBalancesTokens[chain] = { ...ibcMappings, ...(fixBalancesTokens[chain] || {}) }) From b1f1d062fd416ec84d703bf2e1366879f4ca877a Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Fri, 22 Sep 2023 19:30:03 +0100 Subject: [PATCH 1317/1974] add more addresses --- projects/helper/tokenMapping.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 32eea68fd76..94f8f7962a8 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -56,6 +56,9 @@ const fixBalancesTokens = { '0x0cf4071940782b640d0b595cb17bdf3e90869d70': { coingeckoId: 'pego-network-2', decimals: 18 }, }, ton: { + 'EQBq4d4GPyBoh-Pjnf3wxUyQSS28WY2Yt-7cPAG8FHpWpNRX': { coingeckoId: 'matic-network', decimals: 18 }, + 'EQDCIEo0HUUYsAV-lTMviOd-GkSXfVPsNZMGjRaNOA_6--FD': { coingeckoId: 'orbit-chain', decimals: 18 }, + 'EQBf6-YoR9xylol_NwjHrLkrTFAZJCX-bsd-Xx_902OaPaBf': { coingeckoId: 'megaton-finance', decimals: 9 }, 'EQCajaUU1XXSAjTD-xOV7pE49fGtg4q8kF3ELCOJtGvQFQ2C': { coingeckoId: 'the-open-network', decimals: 9 } } } From ad37d665cc2642ba285cce40fd4087e415f912ef Mon Sep 17 00:00:00 2001 From: The Flash Date: Sat, 23 Sep 2023 04:09:51 +0200 Subject: [PATCH 1318/1974] add OpBanana --- projects/opbanana/index.js | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 projects/opbanana/index.js diff --git a/projects/opbanana/index.js b/projects/opbanana/index.js new file mode 100644 index 00000000000..a6cadaa2b9a --- /dev/null +++ b/projects/opbanana/index.js @@ -0,0 +1,6 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports = { + misrepresentedTokens: true, + op_bnb: { tvl: getUniTVL({ factory: '0xdF9161aa1D60f129E185D43e2862BD4826E88Aa8', useDefaultCoreAssets: true, fetchBalances: true, }), }, +} \ No newline at end of file From 617410bd2e48988e86600f6cd93277b8a0174318 Mon Sep 17 00:00:00 2001 From: FlashFinancePulse <144820191+FlashFinancePulse@users.noreply.github.com> Date: Sat, 23 Sep 2023 12:56:58 +0200 Subject: [PATCH 1319/1974] add OpBanana (#7541) --- projects/opbanana/index.js | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 projects/opbanana/index.js diff --git a/projects/opbanana/index.js b/projects/opbanana/index.js new file mode 100644 index 00000000000..a6cadaa2b9a --- /dev/null +++ b/projects/opbanana/index.js @@ -0,0 +1,6 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports = { + misrepresentedTokens: true, + op_bnb: { tvl: getUniTVL({ factory: '0xdF9161aa1D60f129E185D43e2862BD4826E88Aa8', useDefaultCoreAssets: true, fetchBalances: true, }), }, +} \ No newline at end of file From e1c09fdbe61870351864eae8ec9e417e679134ce Mon Sep 17 00:00:00 2001 From: Brandon Date: Sat, 23 Sep 2023 04:03:45 -0700 Subject: [PATCH 1320/1974] Update/steer chains (#7535) * feat: :zap: Include all deployed chains to Steer adapter Added: avax, bnb, metis, evmos, p_zkevm, celo, thundercore binance historical node failing * add kava --- projects/steer/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/projects/steer/index.js b/projects/steer/index.js index 968135991bb..2afa18179c5 100644 --- a/projects/steer/index.js +++ b/projects/steer/index.js @@ -10,6 +10,8 @@ const config = { polygon_zkevm: { registry: '0x9f5b097AD23e2CF4F34e502A3E41D941678877Dc', fromBlock: 1022413, }, celo: { registry: '0x116Dba5DcE9CcDA828218b7eB46406810632014C', fromBlock: 19813127, }, thundercore: { registry: '0xa1Dd21fbd9e1F0BF28d41F18bDC22326e50C02e9', fromBlock: 135181847, }, + kava: {registry: '0xe240B9a2936f6Fb8860219bC059349e50F03492e', fromBlock: 5915232, }, + } module.exports = {}; @@ -22,6 +24,7 @@ Object.keys(config).forEach(chain => { api, target: registry, topic: "VaultCreated(address,address,string,uint256,address)", + // topics: ["0x3910bed511b4ecc0d6ae24498d585722a54c6ce9ab5e65b4be534cec981f7f6f"], eventAbi: 'event VaultCreated(address deployer, address vault, string beaconName, uint256 indexed tokenId, address vaultManager)', onlyArgs: true, fromBlock, @@ -40,4 +43,4 @@ Object.keys(config).forEach(chain => { return api.getBalances() } } -}) \ No newline at end of file +}) From 7d7760912f6498e1a054c06183cbf7184b0d6fa2 Mon Sep 17 00:00:00 2001 From: 0xtekgrinder <72015889+0xtekgrinder@users.noreply.github.com> Date: Sat, 23 Sep 2023 13:05:12 +0200 Subject: [PATCH 1321/1974] feat: tholgar TVL (#7534) * feat: tholgar TVL * doc: update methodology of tholgar --- projects/tholgar/abi.json | 7 ++++++ projects/tholgar/index.js | 51 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 projects/tholgar/abi.json create mode 100644 projects/tholgar/index.js diff --git a/projects/tholgar/abi.json b/projects/tholgar/abi.json new file mode 100644 index 00000000000..741f421b42d --- /dev/null +++ b/projects/tholgar/abi.json @@ -0,0 +1,7 @@ +{ + "token": "address:token", + "getCurrentLockedTokens": "uint256:getCurrentLockedTokens", + "lockers": "function lockers(uint256) view returns (address)", + "totalAssets": "uint256:totalAssets", + "totalSupply": "erc20:totalSupply" +} \ No newline at end of file diff --git a/projects/tholgar/index.js b/projects/tholgar/index.js new file mode 100644 index 00000000000..16f07734bf3 --- /dev/null +++ b/projects/tholgar/index.js @@ -0,0 +1,51 @@ +const sdk = require("@defillama/sdk"); +const abi = require("./abi.json"); +const { BigNumber } = require("ethers"); + +const WAR_CONTROLLER = "0xFDeac9F9e4a5A7340Ac57B47C67d383fb4f13DBb"; +const VAULT = '0x188cA46Aa2c7ae10C14A931512B62991D5901453'; +const WAR = '0xa8258deE2a677874a48F5320670A869D74f0cbC1'; + +async function getLockers(api) { + let lockers = []; + + for (let i = 0; i != -1; ++i) { + try { + const output = await api.call({ + target: WAR_CONTROLLER, + abi: abi["lockers"], + params: [BigNumber.from(i)] + }) + lockers.push(output); + } catch(e) { + break; + } + } + + return lockers; +} + +async function ethTvl(timestamp, block, _, { api },) { + const balances = {}; + + const lockers = await getLockers(api); + + const bals = await api.multiCall({ abi: abi["getCurrentLockedTokens"], calls: lockers.map(i => ({ target: i})) }) + const tokens = await api.multiCall({ abi: abi["token"], calls: lockers.map(i => ({ target: i})) }) + + const totalSupply = await api.call({target: WAR, abi: abi['totalSupply']}); + const vaultBalance = await api.call({ target: VAULT, abi: abi['totalAssets']}); + const ratio = vaultBalance / totalSupply; + + bals.forEach((v, i) => sdk.util.sumSingleBalance(balances, tokens[i], v * ratio)) + + return balances; +} + +module.exports = { + methodology: "Counts the total number of cvx and aura Locked inside Warlord and compare it to the balance of Tholgar Vault", + ethereum: { + tvl: ethTvl, + }, + start: 17368026 +}; From a435f0252f3c2fffe859ff8e54a9cbdbbceb1295 Mon Sep 17 00:00:00 2001 From: g1nt0ki Date: Sat, 23 Sep 2023 14:58:59 +0200 Subject: [PATCH 1322/1974] leetswap: track manta --- package-lock.json | 12 ++++++------ projects/helper/chains.json | 1 + projects/helper/tokenMapping.js | 3 +++ projects/leetswap/index.js | 1 + 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index ec43ee73587..2cdb4979b7c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -785,9 +785,9 @@ } }, "node_modules/@defillama/sdk": { - "version": "4.0.56", - "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.56.tgz", - "integrity": "sha512-QmiWblExpSsCLxzXKs2NeFMMW3Obya18W8H0gLRowLSpHtmjJeqqmbB7kbcXQc+6NITZ6+MlgLTkQJTQexRZAg==", + "version": "4.0.57", + "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.57.tgz", + "integrity": "sha512-20jdEUFqFCp/DJljUJczuTYVYjdq7xo+9B/FhAiEkkPI4t5fh1+dVKmLM765kEOYitlPGKZrnvFmQRLlTNW6sQ==", "dependencies": { "@aws-sdk/client-s3": "^3.400.0", "@supercharge/promise-pool": "^2.1.0", @@ -5905,9 +5905,9 @@ } }, "@defillama/sdk": { - "version": "4.0.56", - "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.56.tgz", - "integrity": "sha512-QmiWblExpSsCLxzXKs2NeFMMW3Obya18W8H0gLRowLSpHtmjJeqqmbB7kbcXQc+6NITZ6+MlgLTkQJTQexRZAg==", + "version": "4.0.57", + "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.57.tgz", + "integrity": "sha512-20jdEUFqFCp/DJljUJczuTYVYjdq7xo+9B/FhAiEkkPI4t5fh1+dVKmLM765kEOYitlPGKZrnvFmQRLlTNW6sQ==", "requires": { "@aws-sdk/client-s3": "^3.400.0", "@supercharge/promise-pool": "^2.1.0", diff --git a/projects/helper/chains.json b/projects/helper/chains.json index 933724d4acc..98618fab157 100644 --- a/projects/helper/chains.json +++ b/projects/helper/chains.json @@ -121,6 +121,7 @@ "loop", "lukso", "lung", + "manta", "mantle", "map", "meta", diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 94f8f7962a8..7cb10ca81ce 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -55,6 +55,9 @@ const fixBalancesTokens = { pg: { '0x0cf4071940782b640d0b595cb17bdf3e90869d70': { coingeckoId: 'pego-network-2', decimals: 18 }, }, + manta: { + '0x0Dc808adcE2099A9F62AA87D9670745AbA741746': { coingeckoId: 'ethereum', decimals: 18 }, + }, ton: { 'EQBq4d4GPyBoh-Pjnf3wxUyQSS28WY2Yt-7cPAG8FHpWpNRX': { coingeckoId: 'matic-network', decimals: 18 }, 'EQDCIEo0HUUYsAV-lTMviOd-GkSXfVPsNZMGjRaNOA_6--FD': { coingeckoId: 'orbit-chain', decimals: 18 }, diff --git a/projects/leetswap/index.js b/projects/leetswap/index.js index 2c9e9eca118..32536a5740a 100644 --- a/projects/leetswap/index.js +++ b/projects/leetswap/index.js @@ -8,4 +8,5 @@ module.exports = { shibarium: { tvl: getUniTVL({ factory: '0xd3Ea3BC1F5A3F881bD6cE9761cbA5A0833a5d737', useDefaultCoreAssets: true, }), }, op_bnb: { tvl: getUniTVL({ factory: '0xa2899c776bAAF9925d432F83C950D5054A6CF59C', useDefaultCoreAssets: true, }), }, base: { tvl: getUniTVL({ factory: '0x169C06b4cfB09bFD73A81e6f2Bb1eB514D75bB19', useDefaultCoreAssets: true, hasStablePools: true, stablePoolSymbol: 'sLS2', }), }, + manta: { tvl: getUniTVL({ factory: '0xa2899c776bAAF9925d432F83C950D5054A6CF59C', useDefaultCoreAssets: true, }), }, } From 552dcae6eccea69169c64bfccabe5515c7937f24 Mon Sep 17 00:00:00 2001 From: g1nt0ki Date: Sun, 24 Sep 2023 02:48:48 +0200 Subject: [PATCH 1323/1974] track mantaswap.io --- projects/mantaswap/index.js | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 projects/mantaswap/index.js diff --git a/projects/mantaswap/index.js b/projects/mantaswap/index.js new file mode 100644 index 00000000000..9cd75176a51 --- /dev/null +++ b/projects/mantaswap/index.js @@ -0,0 +1,6 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports = { + misrepresentedTokens: true, + manta: { tvl: getUniTVL({ factory: '0x60Ad4aB0659C3b83320f3D43d3797553b55D52c6', useDefaultCoreAssets: true, }), }, +} From 5a917f79d098ee78d484b38d331e641631080fa5 Mon Sep 17 00:00:00 2001 From: g1nt0ki Date: Sun, 24 Sep 2023 03:33:10 +0200 Subject: [PATCH 1324/1974] track apertuneswap --- projects/apertureSwap/index.js | 5 +++++ projects/helper/tokenMapping.js | 2 ++ projects/izumi-iziswap/index.js | 3 ++- 3 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 projects/apertureSwap/index.js diff --git a/projects/apertureSwap/index.js b/projects/apertureSwap/index.js new file mode 100644 index 00000000000..b4a13c5c66e --- /dev/null +++ b/projects/apertureSwap/index.js @@ -0,0 +1,5 @@ +const { uniV3Export } = require("../helper/uniswapV3"); + +module.exports = uniV3Export({ + manta: { factory: "0x4Eee19e0856D23fAc3D0bDD867bEb4E1B8c78344", fromBlock: 48723, }, +}); \ No newline at end of file diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 7cb10ca81ce..d2f0a8d3c26 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -57,6 +57,8 @@ const fixBalancesTokens = { }, manta: { '0x0Dc808adcE2099A9F62AA87D9670745AbA741746': { coingeckoId: 'ethereum', decimals: 18 }, + '0xb73603c5d87fa094b7314c74ace2e64d165016fb': { coingeckoId: 'usd-coin', decimals: 6 }, + '0xf417f5a458ec102b90352f697d6e2ac3a3d2851f': { coingeckoId: 'tether', decimals: 6 }, }, ton: { 'EQBq4d4GPyBoh-Pjnf3wxUyQSS28WY2Yt-7cPAG8FHpWpNRX': { coingeckoId: 'matic-network', decimals: 18 }, diff --git a/projects/izumi-iziswap/index.js b/projects/izumi-iziswap/index.js index 9d97a9e507c..903754311bd 100644 --- a/projects/izumi-iziswap/index.js +++ b/projects/izumi-iziswap/index.js @@ -22,7 +22,8 @@ const poolHelpers = { 'ontology_evm': ['0x110dE362cc436D7f54210f96b8C7652C2617887D'], 'ultron' : ['0xcA7e21764CD8f7c1Ec40e651E25Da68AeD096037'], 'linea': ['0x1CB60033F61e4fc171c963f0d2d3F63Ece24319c'], - 'kroma': ['0x110dE362cc436D7f54210f96b8C7652C2617887D'] //test + 'kroma': ['0x110dE362cc436D7f54210f96b8C7652C2617887D'], + 'manta': ['0x19b683A2F45012318d9B2aE1280d68d3eC54D663'], } // iziswap liquidityManager contracts const blacklistedTokens = [ From 61233887c3d3fe815b3e7ea03ca4894bb93e9f0e Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Sun, 24 Sep 2023 07:20:19 +0530 Subject: [PATCH 1325/1974] Reservoir (#7547) * Create index.js * fix: replace graphql url * feat: tvl works now * fix: missing identifier * code refactor --------- Co-authored-by: Kenneth Ashley Co-authored-by: A.L Co-authored-by: g1nt0ki --- projects/reservoir/index.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 projects/reservoir/index.js diff --git a/projects/reservoir/index.js b/projects/reservoir/index.js new file mode 100644 index 00000000000..39cae867c3d --- /dev/null +++ b/projects/reservoir/index.js @@ -0,0 +1,22 @@ +const { getLogs } = require('../helper/cache/getLogs') + +const config = { + avax: { factory: '0xdd723d9273642d82c5761a4467fd5265d94a22da', fromBlock: 31563526 }, +} + +Object.keys(config).forEach(chain => { + const { factory, fromBlock } = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const logs = await getLogs({ + api, + target: factory, + eventAbi: 'event Pair (address indexed token0, address indexed token1, uint256 curveId, address pair)', + onlyArgs: true, + fromBlock, + }) + const ownerTokens = logs.map(i => [[i.token0, i.token1,], i.pair]) + return api.sumTokens({ ownerTokens }) + } + } +}) \ No newline at end of file From 23327e304570549d6e9d08aad17c06a17ca9534a Mon Sep 17 00:00:00 2001 From: define Date: Sun, 24 Sep 2023 10:17:41 +0100 Subject: [PATCH 1326/1974] test --- projects/entities/framework-ventures.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/projects/entities/framework-ventures.js b/projects/entities/framework-ventures.js index c9ee2e14b40..da2c8e12a13 100644 --- a/projects/entities/framework-ventures.js +++ b/projects/entities/framework-ventures.js @@ -4,6 +4,19 @@ const config = { ethereum: { owners: [ "0x681148725731F213b0187A3CBeF215C291D85a3E", + "0x20017a30d3156d4005bda08c40acda0a6ae209b1", //staked crv + "0x3b08AA814bEA604917418A9F0907E7fC430e742C", //dao votes + ], + }, + optimism: { + owners: [ + "0xa5f7a39e55d7878bc5bd754ee5d6bd7a7662355b", + "0x3b08aa814bea604917418a9f0907e7fc430e742c" + ], + }, + arbitrum: { + owners: [ + "0x3b08aa814bea604917418a9f0907e7fc430e742c" ], }, } From d5464e3eb5ea2d903e575193086bd9d021d050fd Mon Sep 17 00:00:00 2001 From: g1nt0ki Date: Sun, 24 Sep 2023 18:39:08 +0200 Subject: [PATCH 1327/1974] track radpie tvl --- projects/radpie/index.js | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 projects/radpie/index.js diff --git a/projects/radpie/index.js b/projects/radpie/index.js new file mode 100644 index 00000000000..d4c4a429805 --- /dev/null +++ b/projects/radpie/index.js @@ -0,0 +1,30 @@ +const { sumTokens2 } = require('../helper/unwrapLPs') + +const config = { + arbitrum: { + stakingContract: '0x18a192dFe0BE1E5E9AA424738FdAd800646283b2', + }, + bsc: { + stakingContract: '0xe05157aA8D14b8ED1d816D505b3D5DEEB83ca131', + } +} + +Object.keys(config).forEach(chain => { + const { stakingContract, DLP, LP } = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const poolHelper = await api.call({ abi: 'address:assetLoopHelper', target: stakingContract }) + const mfd = await api.call({ abi: 'address:multiFeeDistributor', target: stakingContract }) + const LP = await api.call({ abi: 'address:rdntWethLp', target: stakingContract }) + const tokens = await api.fetchList({ lengthAbi: 'uint256:poolLength', itemAbi: 'function poolTokenList(uint256) view returns (address)', target: stakingContract}) + const bals = await api.multiCall({ abi: 'function totalStaked(address) view returns (uint256)', calls:tokens, target: poolHelper }) + const lpBal = await api.call({ abi: 'function totalBalance(address) view returns (uint256)', target:mfd, params: stakingContract }) + + api.addTokens(tokens, bals) + api.add(LP, lpBal) + + await api.sumTokens({ owner: stakingContract, tokens: [LP]}) + return sumTokens2({ api, resolveLP: true, }) + } + } +}) \ No newline at end of file From 890006372b0fa158f074e1e33e3f8c28373c3ddb Mon Sep 17 00:00:00 2001 From: Shoebill Finance <118880028+ShoebillFinance@users.noreply.github.com> Date: Mon, 25 Sep 2023 02:32:28 +0900 Subject: [PATCH 1328/1974] add wemixChain (#7548) --- projects/shoebillFinance-v2/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/shoebillFinance-v2/index.js b/projects/shoebillFinance-v2/index.js index 5101a98c8d7..4c1b1905193 100644 --- a/projects/shoebillFinance-v2/index.js +++ b/projects/shoebillFinance-v2/index.js @@ -1,5 +1,6 @@ const { compoundExports2 } = require('../helper/compound') module.exports = { - klaytn: compoundExports2({ comptroller: '0xEE3Db1711ef46C04c448Cb9F5A03E64e7aa22814', cether: '0xac6a4566d390a0da085c3d952fb031ab46715bcf'}) + klaytn: compoundExports2({ comptroller: '0xEE3Db1711ef46C04c448Cb9F5A03E64e7aa22814', cether: '0xac6a4566d390a0da085c3d952fb031ab46715bcf'}), + wemix: compoundExports2({ comptroller: '0xBA5E3f89f57342D94333C682e159e68Ee1Fc64De', cether: '0xD42ad8346d14853EB3D30568B7415cF90C579D83'}) } \ No newline at end of file From 7a05c88ff11fa76d351068117074d263c6b81779 Mon Sep 17 00:00:00 2001 From: Andrew Clark Date: Mon, 25 Sep 2023 01:36:04 +0800 Subject: [PATCH 1329/1974] Add asdCRV pools Tvl (#7542) * Add asdCRV pools Tvl * Update revert lint changes * Update revert lint changes --------- Co-authored-by: Andrew --- projects/concentrator/abis/AladdinConvexVault.json | 5 +++-- projects/concentrator/index.js | 10 ++++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/projects/concentrator/abis/AladdinConvexVault.json b/projects/concentrator/abis/AladdinConvexVault.json index 07948508c12..723ed7c6abd 100644 --- a/projects/concentrator/abis/AladdinConvexVault.json +++ b/projects/concentrator/abis/AladdinConvexVault.json @@ -1,4 +1,5 @@ { "poolInfo": "function poolInfo(uint256) view returns (uint128 totalUnderlying, uint128 totalShare, uint256 accRewardPerShare, uint256 convexPoolId, address lpToken, address crvRewards, uint256 withdrawFeePercentage, uint256 platformFeePercentage, uint256 harvestBountyPercentage, bool pauseDeposit, bool pauseWithdraw)", - "afraxETHPoolInfo": "function poolInfo(uint256) view returns (tuple(uint128 totalUnderlying, uint128 totalShare) supply, tuple(address token, address strategy, bool pauseDeposit, bool pauseWithdraw) strategy, tuple(uint128 rate, uint32 periodLength, uint48 lastUpdate, uint48 finishAt, uint256 accRewardPerShare) reward, tuple(uint32 withdrawFeeRatio, uint32 platformFeeRatio, uint32 harvestBountyRatio, uint160 reserved) fee)" -} \ No newline at end of file + "afraxETHPoolInfo": "function poolInfo(uint256) view returns (tuple(uint128 totalUnderlying, uint128 totalShare) supply, tuple(address token, address strategy, bool pauseDeposit, bool pauseWithdraw) strategy, tuple(uint128 rate, uint32 periodLength, uint48 lastUpdate, uint48 finishAt, uint256 accRewardPerShare) reward, tuple(uint32 withdrawFeeRatio, uint32 platformFeeRatio, uint32 harvestBountyRatio, uint160 reserved) fee)", + "asdCRVPoolInfo": "function poolInfo(uint256) view returns (tuple(uint128 totalUnderlying, uint128 totalShare) supply, tuple(address token, address strategy, bool pauseDeposit, bool pauseWithdraw) strategy, tuple(uint128 rate, uint32 periodLength, uint48 lastUpdate, uint48 finishAt, uint256 accRewardPerShare) reward, tuple(uint32 withdrawFeeRatio, uint32 platformFeeRatio, uint32 harvestBountyRatio, uint160 reserved) fee)" +} diff --git a/projects/concentrator/index.js b/projects/concentrator/index.js index 0397ffeee74..e285c6e033a 100644 --- a/projects/concentrator/index.js +++ b/projects/concentrator/index.js @@ -22,6 +22,7 @@ const concentratorAsdCRVAddress = "0x43E54C2E7b3e294De3A155785F52AB49d87B9922" const concentratorNewVault = '0x3Cf54F3A1969be9916DAD548f3C084331C4450b5'; const concentratorAfxsVault = '0xD6E3BB7b1D6Fa75A71d48CFB10096d59ABbf99E1'; const concentratorAfrxETHVault = '0x50B47c4A642231dbe0B411a0B2FBC1EBD129346D'; +const concentratorAsdCRVVault = "0x59866EC5650e9BA00c51f6D681762b48b0AdA3de"; const usdtAddress = ADDRESSES.ethereum.USDT; const aladdinBalancerLPGauge = '0x33e411ebE366D72d058F3eF22F1D0Cf8077fDaB0'; const clevCVXAddress = "0xf05e58fCeA29ab4dA01A495140B349F8410Ba904" @@ -63,6 +64,7 @@ async function tvl(timestamp, block, _, { api }) { getVaultInfo('New', balances, block), getVaultInfo('afxs', balances, block), getVaultInfo('afrxETH', balances, block), + getVaultInfo("asdCRV", balances, block), addACRVbalance(balances, api), ]) return balances @@ -94,10 +96,14 @@ async function getVaultInfo(type, balances, block) { _target = concentratorAfrxETHVault; _abi = AladdinConvexVaultABI.afraxETHPoolInfo; break; + case "asdCRV": + _target = concentratorAsdCRVVault; + _abi = AladdinConvexVaultABI.asdCRVPoolInfo; + break; } let poolInfo = await sdk.api2.abi.fetchList({ chain, block, lengthAbi: abi.poolLength, itemAbi: _abi, target: _target }) poolInfo.forEach((item) => { - if (type == 'afrxETH') { + if (type == 'afrxETH' || type == 'asdCRV') { sdk.util.sumSingleBalance(balances, item.strategy.token, item.supply.totalUnderlying, chain) } else { sdk.util.sumSingleBalance(balances, item.lpToken, item.totalUnderlying, chain) @@ -159,4 +165,4 @@ module.exports = { ethereum: { tvl } -} +} \ No newline at end of file From d409dbf0f57c10a960b280e010a6fbf7a11f8896 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Mon, 25 Sep 2023 02:12:19 +0100 Subject: [PATCH 1330/1974] update dopex --- projects/dopex/index.js | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/projects/dopex/index.js b/projects/dopex/index.js index 4a8c4550cac..cf87dfb433f 100644 --- a/projects/dopex/index.js +++ b/projects/dopex/index.js @@ -4,6 +4,7 @@ const abi = require("./abi.json"); const { staking } = require("../helper/staking"); const { pool2 } = require("../helper/pool2"); const { default: BigNumber } = require("bignumber.js"); +const { sumTokens } = require('../helper/unwrapLPs'); // ETH Addresses const dpx = "0xeec2be5c91ae7f8a338e1e5f3b5de49d07afdc81"; @@ -65,6 +66,16 @@ async function ssovTvl(balances, ssov, block, chain) { chain })).output; + const isExpired = (await sdk.api.abi.multiCall({ + chain, + block, + abi: "function isEpochExpired(uint256) view returns (bool)", + calls: currentEpochs.map(p => ({ + target: p.input.target, + params: p.output + })), + })).output + const totalEpochDeposits = (await sdk.api.abi.multiCall({ calls: currentEpochs.map(p => ({ target: p.input.target, @@ -77,7 +88,7 @@ async function ssovTvl(balances, ssov, block, chain) { for (let i = 0; i < ssov.length; i++) { const token = `${chain}:${ssov[i][1]}`; - const balance = totalEpochDeposits[i].output; + const balance = isExpired[i].output?"1":totalEpochDeposits[i].output; sdk.util.sumSingleBalance(balances, token, balance); } } @@ -121,6 +132,11 @@ async function arbTvl(timestamp, block, chainBlocks) { await ssovTvl(balances, ssovs, chainBlocks.arbitrum, "arbitrum"); await crvTvls(balances, crvPools, chainBlocks.arbitrum, "arbitrum"); + await sumTokens(balances, [ + ["0x912ce59144191c1204e64559fe8253a0e49e6548", "0xDF3d96299275E2Fb40124b8Ad9d270acFDcc6148"], + ["0x6c2c06790b3e3e3c38e12ee22f8183b37a13ee55", "0x05E7ACeD3b7727f9129E6d302B488cd8a1e0C817"], + ["0x32eb7902d4134bf98a28b963d26de779af92a212", "0xd74c61ca8917Be73377D74A007E6f002c25Efb4e"] + ], chainBlocks.arbitrum, "arbitrum") return balances; } From f3ff9c85990c7bc57d4f233b66406fbca72ceed1 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Mon, 25 Sep 2023 05:21:36 +0100 Subject: [PATCH 1331/1974] add wemix --- projects/helper/tokenMapping.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index d2f0a8d3c26..649c21fe6d1 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -64,7 +64,8 @@ const fixBalancesTokens = { 'EQBq4d4GPyBoh-Pjnf3wxUyQSS28WY2Yt-7cPAG8FHpWpNRX': { coingeckoId: 'matic-network', decimals: 18 }, 'EQDCIEo0HUUYsAV-lTMviOd-GkSXfVPsNZMGjRaNOA_6--FD': { coingeckoId: 'orbit-chain', decimals: 18 }, 'EQBf6-YoR9xylol_NwjHrLkrTFAZJCX-bsd-Xx_902OaPaBf': { coingeckoId: 'megaton-finance', decimals: 9 }, - 'EQCajaUU1XXSAjTD-xOV7pE49fGtg4q8kF3ELCOJtGvQFQ2C': { coingeckoId: 'the-open-network', decimals: 9 } + 'EQCajaUU1XXSAjTD-xOV7pE49fGtg4q8kF3ELCOJtGvQFQ2C': { coingeckoId: 'the-open-network', decimals: 9 }, + 'EQCf7Nb341dxOE3N0jimngRxGEV8T3zo-eU2EZVs_nchNhhZ': { coingeckoId: 'wemix-token', decimals: 18 } } } From b85b64c35fb5de732f2270ee7b97aef8ac6f389f Mon Sep 17 00:00:00 2001 From: X Developer Date: Mon, 25 Sep 2023 16:25:43 +0700 Subject: [PATCH 1332/1974] Add AllinXSwap Dex --- projects/allinxswap/index.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 projects/allinxswap/index.js diff --git a/projects/allinxswap/index.js b/projects/allinxswap/index.js new file mode 100644 index 00000000000..b06279b7cc5 --- /dev/null +++ b/projects/allinxswap/index.js @@ -0,0 +1,17 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports = { + misrepresentedTokens: true, + op_bnb: { + tvl: getUniTVL({ + useDefaultCoreAssets: true, + factory: "0xAFcA85A70Bd1C2Bf98DB7F24b2380134F76Af7f1", + }), + }, + bsc: { + tvl: getUniTVL({ + useDefaultCoreAssets: true, + factory: "0xB755953681f0b54f59336294f6758aE9e2E3aB5e", + }), + }, +}; From 0c0e8d468c4315bfeeab02c02b49a3fd06e159f1 Mon Sep 17 00:00:00 2001 From: StarkSport <138509968+starksport-project@users.noreply.github.com> Date: Mon, 25 Sep 2023 21:28:07 +0700 Subject: [PATCH 1333/1974] add starkspot tvl (#7551) Co-authored-by: noobmdev --- projects/starkspot/abi.js | 77 +++++++++++++++++++++++++++++++++++++ projects/starkspot/api.js | 52 +++++++++++++++++++++++++ projects/starkspot/index.js | 1 + 3 files changed, 130 insertions(+) create mode 100644 projects/starkspot/abi.js create mode 100644 projects/starkspot/api.js create mode 100644 projects/starkspot/index.js diff --git a/projects/starkspot/abi.js b/projects/starkspot/abi.js new file mode 100644 index 00000000000..a3ee514e816 --- /dev/null +++ b/projects/starkspot/abi.js @@ -0,0 +1,77 @@ +const fabis = [ + { + "inputs": [], + "name": "get_all_pairs", + "outputs": [ + { + "name": "all_pairs_len", + "type": "felt" + }, + { + "name": "all_pairs", + "type": "felt*" + } + ], + "stateMutability": "view", + "type": "function" + } +] + +const pabis = [ + { + "inputs": [], + "name": "token0", + "outputs": [ + { + "name": "address", + "type": "felt" + } + ], + "stateMutability": "view", + "type": "function", + "customType": "address" + }, + { + "inputs": [], + "name": "token1", + "outputs": [ + { + "name": "address", + "type": "felt" + } + ], + "stateMutability": "view", + "type": "function", + "customType": "address" + }, + { + "inputs": [], + "name": "get_reserves", + "outputs": [ + { + "name": "reserve0", + "type": "Uint256" + }, + { + "name": "block_timestamp_last", + "type": "felt" + }, + { + "name": "reserve1", + "type": "Uint256" + }, + ], + "stateMutability": "view", + "type": "function" + }, +] + + +const factory = {} +const pair = {} +fabis.forEach(i => factory[i.name] = i) +pabis.forEach(i => pair[i.name] = i) + +module.exports = { + factory, pair, fabis, pabis, +} \ No newline at end of file diff --git a/projects/starkspot/api.js b/projects/starkspot/api.js new file mode 100644 index 00000000000..4faad12df7a --- /dev/null +++ b/projects/starkspot/api.js @@ -0,0 +1,52 @@ +// https://www.starknetjs.com/docs/API/contract + +const { call, multiCall, parseAddress } = require("../helper/chain/starknet"); +const { getCache, setCache } = require("../helper/cache"); +const abi = require("./abi"); +const { transformDexBalances } = require("../helper/portedTokens"); +const factory = + "0x594074315e98393351438011f5a558466f1733fde666f73f41738a39804c27"; + +async function tvl() { + let { all_pairs } = await call({ + target: factory, + abi: abi.factory.get_all_pairs, + }); + + const calls = all_pairs.map((i) => parseAddress(i)); + const cache = (await getCache("starkspot", "starknet")) ?? {}; + if (!cache.token0s) { + cache.token0s = []; + cache.token1s = []; + } + const oldCacheLength = cache.token0s.length; + const newCalls = calls.slice(oldCacheLength); + + const _token0s = await multiCall({ abi: abi.pair.token0, calls: newCalls }); + const _token1s = await multiCall({ abi: abi.pair.token1, calls: newCalls }); + const reserves = await multiCall({ abi: abi.pair.get_reserves, calls }); + + cache.token0s.push(..._token0s); + cache.token1s.push(..._token1s); + if (cache.token0s.length > oldCacheLength) + await setCache("starkspot", "starknet", cache); + + const data = []; + reserves.forEach((reserve, i) => { + data.push({ + token0: cache.token0s[i], + token1: cache.token1s[i], + token0Bal: +reserve.reserve0, + token1Bal: +reserve.reserve1, + }); + }); + + return transformDexBalances({ chain: "starknet", data }); +} + +module.exports = { + timetravel: false, + starknet: { + tvl, + }, +}; diff --git a/projects/starkspot/index.js b/projects/starkspot/index.js new file mode 100644 index 00000000000..674e8c995c1 --- /dev/null +++ b/projects/starkspot/index.js @@ -0,0 +1 @@ +module.exports = require('./api') \ No newline at end of file From 7608c390144ccfedcf5a8774471da291cb6547ad Mon Sep 17 00:00:00 2001 From: Yuanhang Luo Date: Mon, 25 Sep 2023 22:35:35 +0800 Subject: [PATCH 1334/1974] Add StakeStone TVL (#7553) * add stakestone tvl * code refactor --------- Co-authored-by: g1nt0ki --- projects/stakestone/index.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 projects/stakestone/index.js diff --git a/projects/stakestone/index.js b/projects/stakestone/index.js new file mode 100644 index 00000000000..3c59f74143c --- /dev/null +++ b/projects/stakestone/index.js @@ -0,0 +1,17 @@ +const ADDRESSES = require('../helper/coreAssets.json') + +const AssetVault = '0x9485711f11B17f73f2CCc8561bcae05BDc7E9ad9'; +const VaultStrategy = '0x396aBF9fF46E21694F4eF01ca77C6d7893A017B2'; + +const ethTvl = async (timestamp, block, _, { api }) => { + const strategyBal = await api.call({ abi: 'uint256:getAllStrategiesValue', target: VaultStrategy }) + api.add(ADDRESSES.null, strategyBal) + return api.sumTokens({ owner: AssetVault, tokens: [ADDRESSES.null]}) +} + +module.exports = { + start: 18182242, + ethereum: { + tvl: ethTvl + }, +} From e2a764fdf533b6f1cb30e1a5fbb3719de110f33a Mon Sep 17 00:00:00 2001 From: Strategic Reserve Date: Mon, 25 Sep 2023 09:09:06 -0700 Subject: [PATCH 1335/1974] Fix Base Addresses --- projects/visor/config.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/visor/config.js b/projects/visor/config.js index a85dee0392c..33a5ea8aa3f 100644 --- a/projects/visor/config.js +++ b/projects/visor/config.js @@ -68,9 +68,9 @@ const HYPE_REGISTRY = { ["0xc27ddd78fc49875fe6f844b72bbf31dfbb099881", 163300], // Lynex ], base: [ - ["0xB24DC81f8Be7284C76C7cF865b803807B3C2EF55", 4249062], // SynthSwap + ["0x1E86A593E55215957C4755f1BE19a229AF3286f6", 2798768], // SynthSwap ["0x6d5c54F535b073B9C2206Baf721Af2856E5cD683", 3785552], // Sushiswap - ["0x6d5c54F535b073B9C2206Baf721Af2856E5cD683", 3785552], // BaseX + ["0xB24DC81f8Be7284C76C7cF865b803807B3C2EF55", 4249062], // BaseX ], }; From d3342aedecd2542fcc38f459dae44cf0a2718710 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Mon, 25 Sep 2023 17:16:16 +0100 Subject: [PATCH 1336/1974] new sandclock vault --- projects/sandclock/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/sandclock/index.js b/projects/sandclock/index.js index d1e20d72102..c40cdebc28a 100644 --- a/projects/sandclock/index.js +++ b/projects/sandclock/index.js @@ -11,7 +11,7 @@ const WETH_VAULT = '0x1Fc623b96c8024067142Ec9c15D669E5c99c5e9D'; const USDC_VAULT = '0x1038Ff057b7092f17807358c6f68b42661d15caB'; const v1Vaults = [YEARN_VAULT, LIQUITY_VAULT]; -const v2Vaults = [WETH_VAULT, USDC_VAULT]; +const v2Vaults = [WETH_VAULT, USDC_VAULT, "0x4c406C068106375724275Cbff028770C544a1333"]; async function tvl(_, _b, _cb, { api, chain, block, }) { const balances = {} @@ -26,6 +26,7 @@ async function tvl(_, _b, _cb, { api, chain, block, }) { }) sdk.util.sumSingleBalance(balances, WETH, v2VaultBalances[0], chain) sdk.util.sumSingleBalance(balances, USDC, v2VaultBalances[1], chain) + sdk.util.sumSingleBalance(balances, WETH, v2VaultBalances[2], chain) return sumTokens2({ balances, chain, block, }) } From f4342c5129dc5e14eea44e8a873dfcf7df53446c Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Mon, 25 Sep 2023 17:26:40 +0100 Subject: [PATCH 1337/1974] add huobi addresses --- projects/huobi/index.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/projects/huobi/index.js b/projects/huobi/index.js index 603ba73d4a6..bb1f4a76e7c 100644 --- a/projects/huobi/index.js +++ b/projects/huobi/index.js @@ -13,6 +13,7 @@ const config = { '1L15W6b9vkxV81xW5HDtmMBycrdiettHEL', // add on 08/08/2023 (we defillama) '14o5ywJJmLPJe8egNo7a5fSdtEgarkus33', // add on 08/08/2023 (we defillama) '1BuiWj9wPbQwNY97xU53LRPhzqNQccSquM', // add on 08/08/2023 (we defillama) + '1ENWYLQZJRAZGtwBmoWrhmTtDUtJ5LseVj', ], }, ethereum: { @@ -46,7 +47,8 @@ const config = { '0xadb2b42f6bd96f5c65920b9ac88619dce4166f94', // add on 08/08/2023 (we defillama) '0x42dc966b7ecc3c6cc73e7bc04862859d5bddce65', // add on 08/08/2023 (we defillama) '0xe8d8a02601f54acb6fb69537be1f1d7cc76ccd8c', // add on 08/08/2023 (we defillama) - '0xf881bcb3705926cea9c598ab05a837cf41a833a9', // add on 08/08/2023 (we defillama) + '0xf881bcb3705926cea9c598ab05a837cf41a833a9', // add on 08/08/2023 (we defillama) + '0xb9F775179bcC7FcF4534700a48F09C590E390eAd', ], blacklistedTokens: [ '0x0316eb71485b0ab14103307bf65a021042c6d380', // HBTC , we already track their backed BTC (1btc wallet on the list) @@ -76,7 +78,8 @@ const config = { 'TZ1SsapyhKNWaVLca6P2qgVzkHTdk6nkXa', 'TDvf1dSBhR7dEskJs17HxGHheJrjXhiFyM', 'TUJGLHo3rq4EAUY1LHRhNkHPX8qmrv9WFs', // add on 08/08/2023 (we defillama) - 'TRSXRWudzfzY4jH7AaMowdMNUXDkHisbcd' // add on 08/08/2023 (we defillama) + 'TRSXRWudzfzY4jH7AaMowdMNUXDkHisbcd', // add on 08/08/2023 (we defillama) + 'TU1ZA8T2g8PvLK8BfM7N94xpmSSpyfxZoK', ] }, algorand: { @@ -89,7 +92,7 @@ const config = { owners: ['vuniyuoxoeub'], }, ripple: { - owners: ['rKUDvXFJMFu65LqPTH3Yfpii4rbKT9bSQT'], + owners: ['rKUDvXFJMFu65LqPTH3Yfpii4rbKT9bSQT', 'raC4udvEeeni6aLPHbz9RKjHTQiWxKPfom'], }, arbitrum: { owners: ['0xf2dbc42875e7764edbd89732a15214a9a0deb085'], From f0d9aaa60e3310626dbcecd717395c24b935a963 Mon Sep 17 00:00:00 2001 From: 0xtekgrinder <72015889+0xtekgrinder@users.noreply.github.com> Date: Mon, 25 Sep 2023 18:34:10 +0000 Subject: [PATCH 1338/1974] fix: tholgar TVL now counts redeemed AURA/CVX --- projects/tholgar/abi.json | 3 ++- projects/tholgar/index.js | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/projects/tholgar/abi.json b/projects/tholgar/abi.json index 741f421b42d..b11e8ea061a 100644 --- a/projects/tholgar/abi.json +++ b/projects/tholgar/abi.json @@ -3,5 +3,6 @@ "getCurrentLockedTokens": "uint256:getCurrentLockedTokens", "lockers": "function lockers(uint256) view returns (address)", "totalAssets": "uint256:totalAssets", - "totalSupply": "erc20:totalSupply" + "totalSupply": "erc20:totalSupply", + "queuedForWithdrawal": "function queuedForWithdrawal(address) view returns (uint256)" } \ No newline at end of file diff --git a/projects/tholgar/index.js b/projects/tholgar/index.js index 16f07734bf3..39f80f5eb0c 100644 --- a/projects/tholgar/index.js +++ b/projects/tholgar/index.js @@ -3,6 +3,7 @@ const abi = require("./abi.json"); const { BigNumber } = require("ethers"); const WAR_CONTROLLER = "0xFDeac9F9e4a5A7340Ac57B47C67d383fb4f13DBb"; +const WAR_REDEEMER = "0x4787Ef084c1d57ED87D58a716d991F8A9CD3828C"; const VAULT = '0x188cA46Aa2c7ae10C14A931512B62991D5901453'; const WAR = '0xa8258deE2a677874a48F5320670A869D74f0cbC1'; @@ -32,12 +33,13 @@ async function ethTvl(timestamp, block, _, { api },) { const bals = await api.multiCall({ abi: abi["getCurrentLockedTokens"], calls: lockers.map(i => ({ target: i})) }) const tokens = await api.multiCall({ abi: abi["token"], calls: lockers.map(i => ({ target: i})) }) + const tokensQueued = await api.multiCall({ abi: abi["queuedForWithdrawal"], calls: tokens.map(i => ({ target: WAR_REDEEMER, params: [i] })) }) const totalSupply = await api.call({target: WAR, abi: abi['totalSupply']}); const vaultBalance = await api.call({ target: VAULT, abi: abi['totalAssets']}); const ratio = vaultBalance / totalSupply; - bals.forEach((v, i) => sdk.util.sumSingleBalance(balances, tokens[i], v * ratio)) + bals.forEach((v, i) => sdk.util.sumSingleBalance(balances, tokens[i], (v - tokensQueued[i]) * ratio)) return balances; } From 401f5d1640dcd265db88c02743f53ae15fdad668 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Mon, 25 Sep 2023 20:12:14 +0100 Subject: [PATCH 1339/1974] fix bwatch --- projects/bwatch/index.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/projects/bwatch/index.js b/projects/bwatch/index.js index d9762ae3ba2..84a2c1e0475 100644 --- a/projects/bwatch/index.js +++ b/projects/bwatch/index.js @@ -6,12 +6,11 @@ const API = 'https://mtg-api.b.watch/api/etfs' async function fetchBwatch() { const resp = await get(API) const etfs = resp.data.etfs; - let sum = new BigNumber(0); + let sum = 0; for (let ix = 0; ix < etfs.length; ix++) { - const etf = etfs[ix]; - sum = sum.plus(new BigNumber(etf.circulating_supply).times(etf.price)) + sum += etfs[ix].gems.reduce((acc, i)=>acc+i.price*i.balance, 0); } - return sum.toFixed(2); + return sum; } async function fetch() { From fe6854cfd3f54537605378c7f62ec403fa40bbf5 Mon Sep 17 00:00:00 2001 From: Yash Patil Date: Mon, 25 Sep 2023 16:42:01 -0400 Subject: [PATCH 1340/1974] update --- projects/ondofinance/index.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/projects/ondofinance/index.js b/projects/ondofinance/index.js index 4edf493e34e..e699a96548a 100644 --- a/projects/ondofinance/index.js +++ b/projects/ondofinance/index.js @@ -9,6 +9,7 @@ module.exports = { const config = { ethereum: { OUSG: '0x1B19C19393e2d034D8Ff31ff34c81252FcBbee92', + USDY: '0x96F6eF951840721AdBF46Ac996b59E0235CB985C', USDYc: '0xe86845788d6e3e5c2393ade1a051ae617d974c09', }, polygon: { @@ -25,22 +26,27 @@ Object.keys(config).forEach((chain) => { const ethApi = new sdk.ChainApi({ chain: 'ethereum', block: _b }); const supplies = await api.multiCall({ abi: 'erc20:totalSupply', calls: funds }); - const tokenPrice = (await ethApi.call({ + const ousgTokenPrice = (await ethApi.call({ abi: 'uint256:rwaPrice', target: '0xc53e6824480d976180A65415c19A6931D17265BA', })) / 1e18; + const usdyTokenPrice = (await ethApi.call({ + abi: 'uint256:getLatestPrice', + target: '0x7fb0228c6338da4EC948Df7b6a8E22aD2Bb2bfB5', + })) / 1e18; + let totalTvl = 0; supplies.forEach((supply, index) => { const key = fundKeys[index]; - if (key === 'USDYc') { + if (key === 'USDYc' || key === 'USDY') { // Use the specific price for USDYc - totalTvl += (supply / 1e18) * 1.006437; + totalTvl += (supply / 1e18) * usdyTokenPrice; } else { // Use the general token price - totalTvl += (supply / 1e18) * tokenPrice; + totalTvl += (supply / 1e18) * ousgTokenPrice; } }); From 31f26574cc4873d0e8e0fbbd1252475dd03f18ba Mon Sep 17 00:00:00 2001 From: pingu1 Date: Mon, 25 Sep 2023 21:33:12 -0400 Subject: [PATCH 1341/1974] Update Impermax app for TVL and borrowed amounts (#7540) * Update Impermax app to match Tarot structure for TVL * fixign EHT and Fantom failures --- projects/impermax/abi.js | 8 ++ projects/impermax/impermaxHelper.js | 127 +++++++++++++++++++ projects/impermax/index.js | 182 +++++++++++++--------------- 3 files changed, 222 insertions(+), 95 deletions(-) create mode 100644 projects/impermax/abi.js create mode 100644 projects/impermax/impermaxHelper.js diff --git a/projects/impermax/abi.js b/projects/impermax/abi.js new file mode 100644 index 00000000000..f1ec86b2fc7 --- /dev/null +++ b/projects/impermax/abi.js @@ -0,0 +1,8 @@ +module.exports = { + allLendingPools: "function allLendingPools(uint256) view returns (address)", + allLendingPoolsLength: "uint256:allLendingPoolsLength", + getLendingPool: "function getLendingPool(address) view returns (bool initialized, uint24 lendingPoolId, address collateral, address borrowable0, address borrowable1)", + underlying: "address:underlying", + totalBorrows: "function totalBorrows() view returns (uint112)", + } + \ No newline at end of file diff --git a/projects/impermax/impermaxHelper.js b/projects/impermax/impermaxHelper.js new file mode 100644 index 00000000000..0f8f4eec215 --- /dev/null +++ b/projects/impermax/impermaxHelper.js @@ -0,0 +1,127 @@ +const abi = require('./abi') +const { sumTokens2 } = require('../helper/unwrapLPs') +const sdk = require('@defillama/sdk') +const { nullAddress } = require('../helper/tokenMapping') + +function impermaxHelper(exportsObj, config, blacklistedPools) { + async function tvl(_, _b, _cb, { api, }) { + const { factories } = config[api.chain] + const blacklist = blacklistedPools[api.chain] + const pools = [] + await Promise.all(factories.map(async (factory) => { + const lendingPools = await api.fetchList({ lengthAbi: abi.allLendingPoolsLength, itemAbi: abi.allLendingPools, target: factory }) + const filteredPools = lendingPools.filter(pool => !blacklist.includes(pool.toLowerCase())) + + const poolData = await api.multiCall({ + chain: api.chain, + target: factory, + abi: abi.getLendingPool, + calls: filteredPools, + permitFailure: true, + }) + + const initialiazedPools = poolData.filter(pool => pool.initialized) + initialiazedPools.forEach(i => { + pools.push(i.collateral, i.borrowable0, i.borrowable1) + }) + })) + + const underlyings = await api.multiCall({ + abi: abi.underlying, + calls: pools, + permitFailure: true, + }) + + const filteredUnderlyings = underlyings.filter(i => i !== nullAddress) + const uSymbols = await api.multiCall({ abi: 'erc20:symbol', calls: filteredUnderlyings }) + + const uvTokens = await getUVTokens(pools, filteredUnderlyings, uSymbols, api) + + const [uToken, totalBalance] = await getUnderlyingPoolsInfo(uvTokens, api) + + const toa = pools.map((v, i) => [underlyings[i], v]) + api.addTokens(uToken, totalBalance) + + return sumTokens2({ + api, tokensAndOwners: toa, resolveLP: true, blacklistedTokens: uvTokens, permitFailure: true, + }) + } + + async function borrowed(_, _b, _cb, { api, }) { + const { factories } = config[api.chain] + const blacklist = blacklistedPools[api.chain] + const balances = {} + const borrowables = [] + await Promise.all(factories.map(async (factory) => { + const lendingPools = await api.fetchList({ lengthAbi: abi.allLendingPoolsLength, itemAbi: abi.allLendingPools, target: factory }) + + // filter out blacklisted pools for the chain + const filteredPoolData = lendingPools.filter(pool => { + return !blacklist.includes(pool.toLowerCase()) + }) + + const poolData = await api.multiCall({ + target: factory, + abi: abi.getLendingPool, + calls: filteredPoolData, + permitFailure: true, + }) + + poolData.forEach(i => { + borrowables.push(i.borrowable0, i.borrowable1) + }) + })) + + const underlyings = await api.multiCall({ + abi: abi.underlying, + calls: borrowables, + permitFailure: true, + }) + + const borrowed = await api.multiCall({ + abi: abi.totalBorrows, + calls: borrowables, + permitFailure: true, + }) + + underlyings.forEach((v, i) => { + sdk.util.sumSingleBalance(balances, v, borrowed[i], api.chain) + }) + return balances + } + + async function getUVTokens(rawPools, underlyings, uSymbols, api) { + var impermaxSymbol; + switch (api.chain) { + case 'ethereum': + impermaxSymbol = 'UNI-V2' + return rawPools.filter((_, i) => uSymbols[i] === impermaxSymbol) + + case 'polygon': + case 'arbitrum': + case 'avax': + case 'moonriver': + case 'canto': + case 'era': + case 'fantom': + default: + impermaxSymbol = 'STKD-UNI-V2' + return underlyings.filter((_, i) => uSymbols[i] === impermaxSymbol) + } + } + + async function getUnderlyingPoolsInfo(uvTokens, api) { + return Promise.all([ + api.multiCall({ abi: 'address:underlying', calls: uvTokens, permitFailure: true }), + api.multiCall({ abi: 'uint256:totalBalance', calls: uvTokens, permitFailure: true }), + ]) + } + + Object.keys(config).forEach(chain => { + exportsObj[chain] = { borrowed, tvl, } + }) +} + +module.exports = { + impermaxHelper +} \ No newline at end of file diff --git a/projects/impermax/index.js b/projects/impermax/index.js index 4adaba8650f..a0a9335bc99 100644 --- a/projects/impermax/index.js +++ b/projects/impermax/index.js @@ -1,104 +1,96 @@ -const { staking } = require('../helper/staking') -const { request, gql } = require("graphql-request"); -const { toUSDTBalances } = require('../helper/balances'); -const { getBlock } = require('../helper/http'); -const xIMX = "0x363b2deac84f0100d63c7427335f8350f596bf59"; -const IMX = "0x7b35ce522cb72e4077baeb96cb923a5529764a00"; +const { impermaxHelper } = require('./impermaxHelper.js') -function offset(chain) { - switch (chain) { - case 'ethereum': - return 100 - case 'polygon': - return 1000 - case 'arbitrum': - return 2000 - case 'moonriver': - return 60 - case 'avax': - return 800 - case 'fantom': - return 1500 - } -} - -function getChainTvl(graphUrls, factoriesName = "uniswapFactories", tvlName = "totalLiquidityUSD") { - const graphQuery = gql` - query get_tvl($block: Int) { - ${factoriesName}( - block: { number: $block } - ) { - ${tvlName} - } - } - `; - - return (chain) => { - return async (timestamp, ethBlock, chainBlocks) => { - const block = (await getBlock(timestamp, chain, chainBlocks)) - offset(chain); - let tvl = 0 - for (const url of graphUrls[chain]) { - const uniswapFactories = (await request( - url, - graphQuery, - { - block, - } - ))[factoriesName]; - const usdTvl = Number(uniswapFactories[0][tvlName]); - tvl += usdTvl - } - - return toUSDTBalances(tvl); - }; - }; -} - - -const subgraphs = { - 'ethereum': ['impermax-finance/impermax-x-uniswap1'], - 'polygon': [ - 'impermax-finance/impermax-x-uniswap-v2-polygon', - 'impermax-finance/impermax-x-uniswap-v2-polygon-v2', - ], - 'arbitrum': [ - 'impermax-finance/impermax-x-uniswap-v2-arbitrum', - 'impermax-finance/impermax-arbitrum-v2', - 'impermax-finance/impermax-arbitrum-solv2', - ], - 'moonriver': ['impermax-finance/impermax-x-uniswap-v2-moonriver'], - 'avax': [ - 'impermax-finance/impermax-x-uniswap-v2-avalanche', - 'impermax-finance/impermax-avalanche-v2', - ], - 'fantom': ['impermax-finance/impermax-x-uniswap-v2-fantom'], -} - -const chainTvl = getChainTvl( - Object.fromEntries(Object.entries(subgraphs).map( - s => [s[0], s[1].map(i => i.startsWith("http") ? i : "https://api.thegraph.com/subgraphs/name/" + i)])), - "impermaxFactories", - "totalBalanceUSD" -); - -module.exports = { - arbitrum: { - tvl: chainTvl('arbitrum') - }, +const config = { ethereum: { - tvl: chainTvl('ethereum'), - //staking: staking(xIMX, IMX, 'ethereum') - }, - avax: { - tvl: chainTvl('avax') + factories: [ + '0x8C3736e2FE63cc2cD89Ee228D9dBcAb6CE5B767B' + ] }, polygon: { - tvl: chainTvl('polygon') + factories: [ + '0xBB92270716C8c424849F17cCc12F4F24AD4064D6', + '0x7F7AD5b16c97Aa9C2B0447C2676ce7D5CEFEbCd3', + '0x7ED6eF7419cD9C00693d7A4F81c2a151F49c7aC2', + ] + }, + arbitrum: { + factories: [ + '0x8C3736e2FE63cc2cD89Ee228D9dBcAb6CE5B767B', + '0x8C3736e2FE63cc2cD89Ee228D9dBcAb6CE5B767B', + '0x97bc7fefb84a4654d4d3938751b5fe401e8771c2', + ] + }, + avax: { + factories: [ + '0x8C3736e2FE63cc2cD89Ee228D9dBcAb6CE5B767B', + '0x9708e0b216a88d38d469b255ce78c1369ad898e6', + '0xc7f24fd6329738320883ba429C6C8133e6492739', + ] }, moonriver: { - tvl: chainTvl('moonriver') + factories: [ + '0x8C3736e2FE63cc2cD89Ee228D9dBcAb6CE5B767B', + ] + }, + canto: { + factories: [ + '0x9708E0B216a88D38d469B255cE78c1369ad898e6', + ] + }, + era: { + factories: [ + '0x6ce1a2C079871e4d4b91Ff29E7D2acbD42b46E36', + ] }, fantom: { - tvl: chainTvl('fantom') + factories: [ + '0x60aE5F446AE1575534A5F234D6EC743215624556', + '0x9b4ae930255CB8695a9F525dA414F80C4C7a945B', + ] }, -}; +} + +const blacklistedPools = { + ethereum: [ + '0xa00d47b4b304792eb07b09233467b690db847c91', // IMX-WETH + '0x46af8ac1b82f73db6aacc1645d40c56191ab787b', // NDX-ETH + '0x8dcba0b75c1038c4babbdc0ff3bd9a8f6979dd13', // DEFI5-ETH + '0x08650bb9dc722c9c8c62e79c2bafa2d3fc5b3293', // AMP-ETH + '0xdf5096804705d135656b50b62f9ee13041253d97', // YPIE-ETH + ], + polygon: [ + '0x76483d4ba1177f69fa1448db58d2f1dbe0fb65fa', // IMX-WETH + '0x8ce3bf56767dd87e87487f3fae63e557b821ea32', // IMX-WETH + '0xd4f5f9643a4368324ac920414781b1c5655baed1', // IMX-WETH + '0x5f819f510ca9b1469e6a3ffe4ecd7f0c1126f8f5', // IMX-WETH + '0x23312fceadb118381c33b34343a61c7812f7a6a3', // IMX-WETH + '0x5ed3147f07708a269f744b43c489e6cf3b60aec4', // USDT-DAI + '0xb957d5a232eebd7c4c4b0a1af9f2043430304e65', // USDC-rUSD + '0x87B94444d0f2c1e4610A2De8504D5d7b81898221', // QUICK-POLYDOGE + ], + arbitrum: [ + '0xb7e5e74b52b9ada1042594cfd8abbdee506cc6c5', // IMX-WETH + '0xcc5c1540683aff992201d8922df44898e1cc9806', // IMX-WETH + '0x8884cc766b43ca10ea41b30192324c77efdd04cd', // NYAN-ETH + '0x4062f4775bc001595838fbaae38908b250ee07cf', // SWPR-ETH + ], + avax: [ + '0xde0037afbe805c00d3cec67093a40882880779b7', // IMX-WETH + '0xe9439f67201894c30f1c1c6b362f0e9195fb8e2c', // IMX-WETH + '0xa34862a7de51a0e1aee6d3912c3767594390586d', // IMX-WETH + '0x69c1c44e8742b66d892294a7eeb9aac51891b0eb', // USDC-UST + ], + moonriver: [ + '0x6ed3bc66dfcc5ac05daec840a75836da935fac97', // IMX-WETH + ], + canto: [], + era: [], + fantom: [ + '0x877a330af63094d88792b9ca28ac36c71673eb1c', // IMX-FTM + '0xb97b6ed451480fe6466a558e9c54eaac32e6c696', // OXD-FTM + ], +} + +module.exports = {} + +impermaxHelper(module.exports, config, blacklistedPools) From f02ce305043be797fea723e1aa095eaed3c62bda Mon Sep 17 00:00:00 2001 From: Tommy Johnson <32071703+tomjohn1028@users.noreply.github.com> Date: Mon, 25 Sep 2023 18:38:22 -0700 Subject: [PATCH 1342/1974] Add armada (#7557) * WIP retrieve reserve amounts properly * retrieve positions * adapter is working properly * clean up comments and IDL --- projects/armada/idl.js | 552 +++++++++++++++++++++++++++++++++++++++ projects/armada/index.js | 357 +++++++++++++++++++++++++ 2 files changed, 909 insertions(+) create mode 100644 projects/armada/idl.js create mode 100644 projects/armada/index.js diff --git a/projects/armada/idl.js b/projects/armada/idl.js new file mode 100644 index 00000000000..d99f4502c79 --- /dev/null +++ b/projects/armada/idl.js @@ -0,0 +1,552 @@ +const ArmadaIDL = { + "version": "0.1.1", + "name": "clp_vault", + "instructions": [], + "accounts": [ + { + "name": "clpVault", + "type": { + "kind": "struct", + "fields": [ + { + "name": "bumpSeed", + "type": "u8" + }, + { + "name": "padding0", + "type": { + "array": [ + "u8", + 15 + ] + } + }, + { + "name": "nonce", + "type": "u16" + }, + { + "name": "padding1", + "type": { + "array": [ + "u8", + 14 + ] + } + }, + { + "name": "clp", + "type": "publicKey" + }, + { + "name": "lpMint", + "type": "publicKey" + }, + { + "name": "lpMintBump", + "type": "u8" + }, + { + "name": "padding2", + "type": { + "array": [ + "u8", + 15 + ] + } + }, + { + "name": "tokenMintA", + "type": "publicKey" + }, + { + "name": "tokenVaultA", + "type": "publicKey" + }, + { + "name": "tokenMintB", + "type": "publicKey" + }, + { + "name": "tokenVaultB", + "type": "publicKey" + }, + { + "name": "performanceFee", + "type": "u32" + }, + { + "name": "padding3", + "type": { + "array": [ + "u8", + 12 + ] + } + }, + { + "name": "withdrawalFee", + "type": "u32" + }, + { + "name": "padding4", + "type": { + "array": [ + "u8", + 12 + ] + } + }, + { + "name": "marketMakingFee", + "type": "u32" + }, + { + "name": "padding5", + "type": { + "array": [ + "u8", + 12 + ] + } + }, + { + "name": "strategy", + "type": { + "defined": "StrategyType" + } + }, + { + "name": "padding6", + "type": { + "array": [ + "u8", + 15 + ] + } + }, + { + "name": "marketMakingKey", + "type": "publicKey" + }, + { + "name": "adminKey", + "type": "publicKey" + }, + { + "name": "feeOwner", + "type": "publicKey" + }, + { + "name": "numActivePositions", + "type": "u8" + }, + { + "name": "padding7", + "type": { + "array": [ + "u8", + 15 + ] + } + }, + { + "name": "positionBundleTokenAccount", + "type": "publicKey" + }, + { + "name": "positionBundleMint", + "type": "publicKey" + }, + { + "name": "positionBundle", + "type": "publicKey" + }, + { + "name": "positions", + "type": { + "array": [ + { + "defined": "VaultPosition" + }, + 5 + ] + } + }, + { + "name": "initialTokenRatio", + "type": { + "defined": "TokenRatio" + } + }, + { + "name": "stakePool", + "type": "publicKey" + }, + { + "name": "ratioCache", + "type": { + "defined": "VaultRatioCache" + } + }, + { + "name": "reserved0", + "type": { + "array": [ + "u8", + 448 + ] + } + }, + { + "name": "reserved1", + "type": { + "array": [ + "u128", + 32 + ] + } + } + ] + } + } + ], + "types": [ + { + "name": "VaultRatioCache", + "type": { + "kind": "struct", + "fields": [ + { + "name": "totalTokenA", + "type": "u64" + }, + { + "name": "totalTokenB", + "type": "u64" + }, + { + "name": "lpSupply", + "type": "u64" + }, + { + "name": "cachedAt", + "type": "i64" + } + ] + } + }, + { + "name": "TokenRatio", + "type": { + "kind": "struct", + "fields": [ + { + "name": "tokenA", + "type": "u64" + }, + { + "name": "tokenB", + "type": "u64" + } + ] + } + }, + { + "name": "VaultPosition", + "type": { + "kind": "struct", + "fields": [ + { + "name": "positionKey", + "type": "publicKey" + }, + { + "name": "lowerTick", + "type": "i32" + }, + { + "name": "padding0", + "type": { + "array": [ + "u8", + 12 + ] + } + }, + { + "name": "upperTick", + "type": "i32" + }, + { + "name": "padding1", + "type": { + "array": [ + "u8", + 12 + ] + } + }, + { + "name": "reserve", + "type": { + "array": [ + "u128", + 16 + ] + } + } + ] + } + }, + { + "name": "ClpProvider", + "type": { + "kind": "enum", + "variants": [ + { + "name": "ORCA" + } + ] + } + }, + { + "name": "StrategyType", + "type": { + "kind": "enum", + "variants": [ + { + "name": "PriceDiscovery" + }, + { + "name": "VolatilePair" + }, + { + "name": "StablePair" + }, + { + "name": "StableSlowlyDiverging" + } + ] + } + } + ], + "events": [], + "errors": [] +}; + +const WhirpoolIDL = { + "version": "0.2.0", + "name": "whirlpool", + "instructions": [], + "accounts": [ + { + "name": "position", + "type": { + "kind": "struct", + "fields": [ + { + "name": "whirlpool", + "type": "publicKey" + }, + { + "name": "positionMint", + "type": "publicKey" + }, + { + "name": "liquidity", + "type": "u128" + }, + { + "name": "tickLowerIndex", + "type": "i32" + }, + { + "name": "tickUpperIndex", + "type": "i32" + }, + { + "name": "feeGrowthCheckpointA", + "type": "u128" + }, + { + "name": "feeOwedA", + "type": "u64" + }, + { + "name": "feeGrowthCheckpointB", + "type": "u128" + }, + { + "name": "feeOwedB", + "type": "u64" + }, + { + "name": "rewardInfos", + "type": { + "array": [ + { + "defined": "PositionRewardInfo" + }, + 3 + ] + } + } + ] + } + }, + { + "name": "whirlpool", + "type": { + "kind": "struct", + "fields": [ + { + "name": "whirlpoolsConfig", + "type": "publicKey" + }, + { + "name": "whirlpoolBump", + "type": { + "array": [ + "u8", + 1 + ] + } + }, + { + "name": "tickSpacing", + "type": "u16" + }, + { + "name": "tickSpacingSeed", + "type": { + "array": [ + "u8", + 2 + ] + } + }, + { + "name": "feeRate", + "type": "u16" + }, + { + "name": "protocolFeeRate", + "type": "u16" + }, + { + "name": "liquidity", + "type": "u128" + }, + { + "name": "sqrtPrice", + "type": "u128" + }, + { + "name": "tickCurrentIndex", + "type": "i32" + }, + { + "name": "protocolFeeOwedA", + "type": "u64" + }, + { + "name": "protocolFeeOwedB", + "type": "u64" + }, + { + "name": "tokenMintA", + "type": "publicKey" + }, + { + "name": "tokenVaultA", + "type": "publicKey" + }, + { + "name": "feeGrowthGlobalA", + "type": "u128" + }, + { + "name": "tokenMintB", + "type": "publicKey" + }, + { + "name": "tokenVaultB", + "type": "publicKey" + }, + { + "name": "feeGrowthGlobalB", + "type": "u128" + }, + { + "name": "rewardLastUpdatedTimestamp", + "type": "u64" + }, + { + "name": "rewardInfos", + "type": { + "array": [ + { + "defined": "WhirlpoolRewardInfo" + }, + 3 + ] + } + } + ] + } + } + ], + "types": [ + { + "name": "PositionRewardInfo", + "type": { + "kind": "struct", + "fields": [ + { + "name": "growthInsideCheckpoint", + "type": "u128" + }, + { + "name": "amountOwed", + "type": "u64" + } + ] + } + }, + { + "name": "WhirlpoolRewardInfo", + "type": { + "kind": "struct", + "fields": [ + { + "name": "mint", + "type": "publicKey" + }, + { + "name": "vault", + "type": "publicKey" + }, + { + "name": "authority", + "type": "publicKey" + }, + { + "name": "emissionsPerSecondX64", + "type": "u128" + }, + { + "name": "growthGlobalX64", + "type": "u128" + } + ] + } + }, + ], + "errors": [] +}; + +module.exports = { + ArmadaIDL, + WhirpoolIDL +} \ No newline at end of file diff --git a/projects/armada/index.js b/projects/armada/index.js new file mode 100644 index 00000000000..f27dbd7bee1 --- /dev/null +++ b/projects/armada/index.js @@ -0,0 +1,357 @@ +const BN = require("bn.js"); +const BigNumber = require("bignumber.js"); +const { ArmadaIDL, WhirpoolIDL } = require("./idl"); +const { getProvider, sumTokens2 } = require("../helper/solana"); +const { Program } = require("@project-serum/anchor"); +const { PublicKey } = require("@solana/web3.js"); + +async function tvl() { + const anchorProvider = getProvider(); + const programId = new PublicKey( + "ArmN3Av2boBg8pkkeCK9UuCN9zSUVc2UQg1qR2sKwm8d" + ); + const armadaProgram = new Program(ArmadaIDL, programId, anchorProvider); + + const whirlpoolProgram = new Program( + WhirpoolIDL, + new PublicKey("whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc"), + anchorProvider + ); + + // Load all the vaults in the program + const vaults = await armadaProgram.account.clpVault.all(); + // Load all the TokenAccounts for the vaults + const vaultTokenAccounts = []; + const vaultMap = {}; + const whirlpoolKeys = []; + const positionKeys = []; + vaults.forEach((vault) => { + vaultTokenAccounts.push(vault.account.tokenVaultA); + vaultTokenAccounts.push(vault.account.tokenVaultB); + whirlpoolKeys.push(vault.account.clp); + vault.account.positions.forEach((position) => { + if (position.positionKey.toString() !== PublicKey.default.toString()) { + positionKeys.push(position.positionKey); + } + }); + vaultMap[vault.publicKey.toString()] = vault; + }); + // Load all the Positions for the vaults + const [positions, whirlpools] = await Promise.all([ + whirlpoolProgram.account.position.fetchMultiple(positionKeys), + whirlpoolProgram.account.whirlpool.fetchMultiple(whirlpoolKeys), + ]); + const whirlpoolMap = whirlpools.reduce((agg, cur, index) => { + agg[whirlpoolKeys[index].toString()] = cur; + return agg; + }, {}); + // Convert Positions to token amounts + const balances = {}; + positions.forEach((position) => { + const whirlpool = whirlpoolMap[position.whirlpool.toString()]; + const sqrtPriceLowerX64 = tickIndexToSqrtPriceX64(position.tickLowerIndex); + const sqrtPriceUpperX64 = tickIndexToSqrtPriceX64(position.tickUpperIndex); + const { tokenA, tokenB } = getTokenAmountsFromLiquidity( + position.liquidity, + whirlpool.sqrtPrice, + sqrtPriceLowerX64, + sqrtPriceUpperX64, + true + ); + const balanceKeyA = `solana:${whirlpool.tokenMintA.toString()}`; + const balanceKeyB = `solana:${whirlpool.tokenMintB.toString()}`; + const prevBalanceA = balances[balanceKeyA]; + const prevBalanceB = balances[balanceKeyB]; + balances[balanceKeyA] = prevBalanceA ? prevBalanceA.add(tokenA) : tokenA; + balances[balanceKeyB] = prevBalanceB ? prevBalanceB.add(tokenB) : tokenB; + }); + Object.keys(balances).forEach((key) => { + balances[key] = balances[key].toString() + }) + return sumTokens2({ + tokenAccounts: vaultTokenAccounts, + balances, + }); +} + +const tickIndexToSqrtPriceX64 = (tickIndex) => { + if (tickIndex > 0) { + return new BN(tickIndexToSqrtPricePositive(tickIndex)); + } else { + return new BN(tickIndexToSqrtPriceNegative(tickIndex)); + } +}; + +function tickIndexToSqrtPricePositive(tick) { + let ratio; + + if ((tick & 1) != 0) { + ratio = new BN("79232123823359799118286999567"); + } else { + ratio = new BN("79228162514264337593543950336"); + } + + if ((tick & 2) != 0) { + ratio = signedShiftRight( + ratio.mul(new BN("79236085330515764027303304731")), + 96, + 256 + ); + } + if ((tick & 4) != 0) { + ratio = signedShiftRight( + ratio.mul(new BN("79244008939048815603706035061")), + 96, + 256 + ); + } + if ((tick & 8) != 0) { + ratio = signedShiftRight( + ratio.mul(new BN("79259858533276714757314932305")), + 96, + 256 + ); + } + if ((tick & 16) != 0) { + ratio = signedShiftRight( + ratio.mul(new BN("79291567232598584799939703904")), + 96, + 256 + ); + } + if ((tick & 32) != 0) { + ratio = signedShiftRight( + ratio.mul(new BN("79355022692464371645785046466")), + 96, + 256 + ); + } + if ((tick & 64) != 0) { + ratio = signedShiftRight( + ratio.mul(new BN("79482085999252804386437311141")), + 96, + 256 + ); + } + if ((tick & 128) != 0) { + ratio = signedShiftRight( + ratio.mul(new BN("79736823300114093921829183326")), + 96, + 256 + ); + } + if ((tick & 256) != 0) { + ratio = signedShiftRight( + ratio.mul(new BN("80248749790819932309965073892")), + 96, + 256 + ); + } + if ((tick & 512) != 0) { + ratio = signedShiftRight( + ratio.mul(new BN("81282483887344747381513967011")), + 96, + 256 + ); + } + if ((tick & 1024) != 0) { + ratio = signedShiftRight( + ratio.mul(new BN("83390072131320151908154831281")), + 96, + 256 + ); + } + if ((tick & 2048) != 0) { + ratio = signedShiftRight( + ratio.mul(new BN("87770609709833776024991924138")), + 96, + 256 + ); + } + if ((tick & 4096) != 0) { + ratio = signedShiftRight( + ratio.mul(new BN("97234110755111693312479820773")), + 96, + 256 + ); + } + if ((tick & 8192) != 0) { + ratio = signedShiftRight( + ratio.mul(new BN("119332217159966728226237229890")), + 96, + 256 + ); + } + if ((tick & 16384) != 0) { + ratio = signedShiftRight( + ratio.mul(new BN("179736315981702064433883588727")), + 96, + 256 + ); + } + if ((tick & 32768) != 0) { + ratio = signedShiftRight( + ratio.mul(new BN("407748233172238350107850275304")), + 96, + 256 + ); + } + if ((tick & 65536) != 0) { + ratio = signedShiftRight( + ratio.mul(new BN("2098478828474011932436660412517")), + 96, + 256 + ); + } + if ((tick & 131072) != 0) { + ratio = signedShiftRight( + ratio.mul(new BN("55581415166113811149459800483533")), + 96, + 256 + ); + } + if ((tick & 262144) != 0) { + ratio = signedShiftRight( + ratio.mul(new BN("38992368544603139932233054999993551")), + 96, + 256 + ); + } + + return signedShiftRight(ratio, 32, 256); +} + +function tickIndexToSqrtPriceNegative(tickIndex) { + let tick = Math.abs(tickIndex); + let ratio; + + if ((tick & 1) != 0) { + ratio = new BN("18445821805675392311"); + } else { + ratio = new BN("18446744073709551616"); + } + + if ((tick & 2) != 0) { + ratio = signedShiftRight(ratio.mul(new BN("18444899583751176498")), 64, 256); + } + if ((tick & 4) != 0) { + ratio = signedShiftRight(ratio.mul(new BN("18443055278223354162")), 64, 256); + } + if ((tick & 8) != 0) { + ratio = signedShiftRight(ratio.mul(new BN("18439367220385604838")), 64, 256); + } + if ((tick & 16) != 0) { + ratio = signedShiftRight(ratio.mul(new BN("18431993317065449817")), 64, 256); + } + if ((tick & 32) != 0) { + ratio = signedShiftRight(ratio.mul(new BN("18417254355718160513")), 64, 256); + } + if ((tick & 64) != 0) { + ratio = signedShiftRight(ratio.mul(new BN("18387811781193591352")), 64, 256); + } + if ((tick & 128) != 0) { + ratio = signedShiftRight(ratio.mul(new BN("18329067761203520168")), 64, 256); + } + if ((tick & 256) != 0) { + ratio = signedShiftRight(ratio.mul(new BN("18212142134806087854")), 64, 256); + } + if ((tick & 512) != 0) { + ratio = signedShiftRight(ratio.mul(new BN("17980523815641551639")), 64, 256); + } + if ((tick & 1024) != 0) { + ratio = signedShiftRight(ratio.mul(new BN("17526086738831147013")), 64, 256); + } + if ((tick & 2048) != 0) { + ratio = signedShiftRight(ratio.mul(new BN("16651378430235024244")), 64, 256); + } + if ((tick & 4096) != 0) { + ratio = signedShiftRight(ratio.mul(new BN("15030750278693429944")), 64, 256); + } + if ((tick & 8192) != 0) { + ratio = signedShiftRight(ratio.mul(new BN("12247334978882834399")), 64, 256); + } + if ((tick & 16384) != 0) { + ratio = signedShiftRight(ratio.mul(new BN("8131365268884726200")), 64, 256); + } + if ((tick & 32768) != 0) { + ratio = signedShiftRight(ratio.mul(new BN("3584323654723342297")), 64, 256); + } + if ((tick & 65536) != 0) { + ratio = signedShiftRight(ratio.mul(new BN("696457651847595233")), 64, 256); + } + if ((tick & 131072) != 0) { + ratio = signedShiftRight(ratio.mul(new BN("26294789957452057")), 64, 256); + } + if ((tick & 262144) != 0) { + ratio = signedShiftRight(ratio.mul(new BN("37481735321082")), 64, 256); + } + + return ratio; +} + +function signedShiftRight(n0, shiftBy, bitWidth) { + let twoN0 = n0.toTwos(bitWidth).shrn(shiftBy); + twoN0.imaskn(bitWidth - shiftBy + 1); + return twoN0.fromTwos(bitWidth - shiftBy); +} + +const getTokenAmountsFromLiquidity = ( + liquidity, + currentSqrtPrice, + lowerSqrtPrice, + upperSqrtPrice, + round_up +) => { + const _liquidity = new BigNumber(liquidity.toString()); + const _currentPrice = new BigNumber(currentSqrtPrice.toString()); + const _lowerPrice = new BigNumber(lowerSqrtPrice.toString()); + const _upperPrice = new BigNumber(upperSqrtPrice.toString()); + let tokenA, tokenB; + if (currentSqrtPrice.lt(lowerSqrtPrice)) { + // x = L * (pb - pa) / (pa * pb) + tokenA = toX64_Decimal(_liquidity) + .times(_upperPrice.minus(_lowerPrice)) + .div(_lowerPrice.times(_upperPrice)); + tokenB = new BigNumber(0); + } else if (currentSqrtPrice.lt(upperSqrtPrice)) { + // x = L * (pb - p) / (p * pb) + // y = L * (p - pa) + tokenA = toX64_Decimal(_liquidity) + .times(_upperPrice.minus(_currentPrice)) + .div(_currentPrice.times(_upperPrice)); + tokenB = fromX64_Decimal(_liquidity.times(_currentPrice.minus(_lowerPrice))); + } else { + // y = L * (pb - pa) + tokenA = new BigNumber(0); + tokenB = fromX64_Decimal(_liquidity.times(_upperPrice.minus(_lowerPrice))); + } + + if (round_up) { + return { + tokenA: new BN(tokenA.integerValue(BigNumber.ROUND_CEIL).toString()), + tokenB: new BN(tokenB.integerValue(BigNumber.ROUND_CEIL).toString()), + }; + } else { + return { + tokenA: new BN(tokenA.integerValue(BigNumber.ROUND_FLOOR).toString()), + tokenB: new BN(tokenB.integerValue(BigNumber.ROUND_FLOOR).toString()), + }; + } +}; + +const toX64_Decimal = (num) => { + return num.times(new BigNumber(2).pow(64)); +}; + +const fromX64_Decimal = (num) => { + return num.times(new BigNumber(2).pow(-64)); +}; + +module.exports = { + doublecounted: true, + misrepresentedTokens: true, + timetravel: false, + solana: { + tvl, + }, +}; From ffbbc07b96987840de84530b52ac7cb143366d1a Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 26 Sep 2023 07:43:14 +0530 Subject: [PATCH 1343/1974] track t-protocol v2 (#7560) Co-authored-by: g1nt0ki --- projects/t-protocol-v2/index.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 projects/t-protocol-v2/index.js diff --git a/projects/t-protocol-v2/index.js b/projects/t-protocol-v2/index.js new file mode 100644 index 00000000000..e6a8cb4ea6d --- /dev/null +++ b/projects/t-protocol-v2/index.js @@ -0,0 +1,21 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokens2 } = require("../helper/unwrapLPs"); + +const RUST_POOL = "0x38a1753AEd353e58c64a55a3f3c750E919915537"; +const UNI_V3_MANAGER = "0x9C27F7BB05dDF33F3e1004eDC16f14d1402838Cc"; +const STBT = '0x530824DA86689C9C17CdC2871Ff29B058345b44a' +const USTP = '0xed4d84225273c867d269f967cc696e0877068f8a' + +module.exports = { + methodology: "counts value of assets in the Treasury", + start: 1677913260, + ethereum: { + tvl, + }, +}; + +async function tvl(_, _b, _cb, { api, }) { + await api.sumTokens({ owner: RUST_POOL, tokens: [ADDRESSES.ethereum.USDC, STBT]}) + return sumTokens2({ owner: UNI_V3_MANAGER, resolveUniV3: true, blacklistedTokens: [USTP], api, }) + +} \ No newline at end of file From e8ebca1ee86150281218b59978617269e81425e8 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Tue, 26 Sep 2023 06:35:52 +0100 Subject: [PATCH 1344/1974] add treasury --- projects/treasury/tprotocol.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 projects/treasury/tprotocol.js diff --git a/projects/treasury/tprotocol.js b/projects/treasury/tprotocol.js new file mode 100644 index 00000000000..77656a8e758 --- /dev/null +++ b/projects/treasury/tprotocol.js @@ -0,0 +1,16 @@ +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0xa01D9bc8343016C7DDD39852e49890a8361B2884"; + + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + '0x530824DA86689C9C17CdC2871Ff29B058345b44a', //stbt + '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', //usdc + ], + owners: [treasury], + ownTokens: [], + }, +}) \ No newline at end of file From 005acf3b205d69565f8e63d4b49379038a9c667d Mon Sep 17 00:00:00 2001 From: define Date: Tue, 26 Sep 2023 11:13:36 +0100 Subject: [PATCH 1345/1974] add correct address --- projects/pancake-swap/index.js | 3 +++ projects/pancakeswap-v3/index.js | 1 + 2 files changed, 4 insertions(+) diff --git a/projects/pancake-swap/index.js b/projects/pancake-swap/index.js index 64ef85fea41..8d19fd7a5c0 100644 --- a/projects/pancake-swap/index.js +++ b/projects/pancake-swap/index.js @@ -97,6 +97,9 @@ module.exports = { era: { tvl: getUniTVL({ factory: '0xd03D8D566183F0086d8D09A84E1e30b58Dd5619d', useDefaultCoreAssets: true, }) }, + op_bnb: { + tvl: getUniTVL({ factory: '0x02a84c1b3BBD7401a5f7fa98a384EBC70bB5749E', useDefaultCoreAssets: true, }) + }, arbitrum: defaultExport, base: defaultExport, } diff --git a/projects/pancakeswap-v3/index.js b/projects/pancakeswap-v3/index.js index b4d8f73c3c2..32dd8f502c5 100644 --- a/projects/pancakeswap-v3/index.js +++ b/projects/pancakeswap-v3/index.js @@ -18,4 +18,5 @@ module.exports = uniV3Export({ era: { factory: '0x1BB72E0CbbEA93c08f535fc7856E0338D7F7a8aB', fromBlock: 9413438, }, arbitrum: { factory, fromBlock: 101028949, }, base: { factory, fromBlock: 2912007, }, + op_bnb: { factory, fromBlock: 1721753, }, }) From 726dc8b3089d0963b1e8790261ceccd48a215c4f Mon Sep 17 00:00:00 2001 From: define Date: Tue, 26 Sep 2023 11:31:45 +0100 Subject: [PATCH 1346/1974] test rollup --- projects/rollup-fi/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/rollup-fi/index.js b/projects/rollup-fi/index.js index 7217c03e839..06f7f359bd5 100644 --- a/projects/rollup-fi/index.js +++ b/projects/rollup-fi/index.js @@ -2,6 +2,6 @@ const { gmxExports } = require('../helper/gmx') module.exports = { era:{ - tvl: gmxExports({ vault: '0xefdE2AeFE307A7362C7E0E3BE019D1491Dc7E163', }) + tvl: gmxExports({ vault: ['0xefdE2AeFE307A7362C7E0E3BE019D1491Dc7E163', '0x4992eb45172868f0d8cceb91190e159bdf571461'] }) }, }; From eaa50bd045f8d3685ae7778de8f4d67f4bd017ae Mon Sep 17 00:00:00 2001 From: define Date: Tue, 26 Sep 2023 11:34:16 +0100 Subject: [PATCH 1347/1974] remove --- projects/rollup-fi/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/rollup-fi/index.js b/projects/rollup-fi/index.js index 06f7f359bd5..13eef7c9a0c 100644 --- a/projects/rollup-fi/index.js +++ b/projects/rollup-fi/index.js @@ -2,6 +2,6 @@ const { gmxExports } = require('../helper/gmx') module.exports = { era:{ - tvl: gmxExports({ vault: ['0xefdE2AeFE307A7362C7E0E3BE019D1491Dc7E163', '0x4992eb45172868f0d8cceb91190e159bdf571461'] }) + tvl: gmxExports({ vault: ['0xefdE2AeFE307A7362C7E0E3BE019D1491Dc7E163'] }) }, }; From 8dab780440df847bc6c27a97a1ca056e12f8d88a Mon Sep 17 00:00:00 2001 From: g1nt0ki Date: Tue, 26 Sep 2023 13:10:38 +0200 Subject: [PATCH 1348/1974] minor fix --- projects/rollup-fi/index.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/projects/rollup-fi/index.js b/projects/rollup-fi/index.js index 13eef7c9a0c..3fd9f3ca823 100644 --- a/projects/rollup-fi/index.js +++ b/projects/rollup-fi/index.js @@ -1,7 +1,14 @@ + const { gmxExports } = require('../helper/gmx') +const ADDRESSES = require('../helper/coreAssets.json') +const sdk = require('@defillama/sdk') +const { sumTokens2, sumTokensExport } = require('../helper/unwrapLPs') module.exports = { era:{ - tvl: gmxExports({ vault: ['0xefdE2AeFE307A7362C7E0E3BE019D1491Dc7E163'] }) + tvl: sdk.util.sumChainTvls([ + gmxExports({ vault: '0xefdE2AeFE307A7362C7E0E3BE019D1491Dc7E163' }), + sumTokensExport({ owner: '0x4992eb45172868f0d8cceb91190e159bdf571461', tokens: [ADDRESSES.era.USDC]}) + ]) }, }; From b1fbf09a5002272eeb47a963da93f4fab61415d0 Mon Sep 17 00:00:00 2001 From: g1nt0ki Date: Tue, 26 Sep 2023 13:11:14 +0200 Subject: [PATCH 1349/1974] minor fix --- projects/rollup-fi/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/rollup-fi/index.js b/projects/rollup-fi/index.js index 3fd9f3ca823..81d75f2dbb1 100644 --- a/projects/rollup-fi/index.js +++ b/projects/rollup-fi/index.js @@ -2,7 +2,7 @@ const { gmxExports } = require('../helper/gmx') const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk') -const { sumTokens2, sumTokensExport } = require('../helper/unwrapLPs') +const { sumTokensExport } = require('../helper/unwrapLPs') module.exports = { era:{ From 7aefbadc3f0c6949ed9871727ee4ae2edd0db938 Mon Sep 17 00:00:00 2001 From: Define101 <93603962+Define101@users.noreply.github.com> Date: Tue, 26 Sep 2023 12:11:41 +0100 Subject: [PATCH 1350/1974] test rollup (#7564) * test rollup * remove * minor fix --------- Co-authored-by: g1nt0ki --- projects/rollup-fi/index.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/projects/rollup-fi/index.js b/projects/rollup-fi/index.js index 7217c03e839..81d75f2dbb1 100644 --- a/projects/rollup-fi/index.js +++ b/projects/rollup-fi/index.js @@ -1,7 +1,14 @@ + const { gmxExports } = require('../helper/gmx') +const ADDRESSES = require('../helper/coreAssets.json') +const sdk = require('@defillama/sdk') +const { sumTokensExport } = require('../helper/unwrapLPs') module.exports = { era:{ - tvl: gmxExports({ vault: '0xefdE2AeFE307A7362C7E0E3BE019D1491Dc7E163', }) + tvl: sdk.util.sumChainTvls([ + gmxExports({ vault: '0xefdE2AeFE307A7362C7E0E3BE019D1491Dc7E163' }), + sumTokensExport({ owner: '0x4992eb45172868f0d8cceb91190e159bdf571461', tokens: [ADDRESSES.era.USDC]}) + ]) }, }; From 1c07ff751cdd529f0a10c93fad6afdae78c36dfb Mon Sep 17 00:00:00 2001 From: Winson Cheng <83229800+0xKMG@users.noreply.github.com> Date: Tue, 26 Sep 2023 19:40:26 +0800 Subject: [PATCH 1351/1974] include new vaults into the calculation of TVL (#7543) * add tvl for new pool sake and whiskey * include GMXV2 lending and leverage vault into the TVL * add hallmark for deployment of major vaults * test: re run the test * update gm price to use chainlink oracle * vaultka: code refactor - skip fetching token prices * remove unused code --------- Co-authored-by: g1nt0ki --- projects/vaultka/index.js | 132 ++++++++++++-------------------------- 1 file changed, 40 insertions(+), 92 deletions(-) diff --git a/projects/vaultka/index.js b/projects/vaultka/index.js index b5ac88dc230..d031271040e 100644 --- a/projects/vaultka/index.js +++ b/projects/vaultka/index.js @@ -1,16 +1,24 @@ +//import utils +const ADDRESSES = require("../helper/coreAssets.json"); + module.exports = { misrepresentedTokens: true, - hallmarks: [[1688342964, "Launch Sake Vault"]], + hallmarks: [ + [1688342964, "VLP Leverage Vault"], + [1692164391, "GLP Leverage Vault"], + [1695274791, "GMXV2 Leverage Vault "], + [1682314791, "GLP Delta Natural Vault"], + [1683178791, "GDAI Leverage Vault"], + ], + arbitrum: { tvl: async (_, _b, _cb, { api }) => { const vaults = [ "0x0081772FD29E4838372CbcCdD020f53954f5ECDE", // VodkaVault "0x6df0018b0449bB4468BfAE8507E13021a7aa0583", // WaterVault ]; - const bals = await api.multiCall({ - abi: "int256:getVaultMarketValue", - calls: vaults, - }); + const bals = await api.multiCall({ abi: "int256:getVaultMarketValue", calls: vaults, }); + bals.forEach(i => api.add(ADDRESSES.arbitrum.USDC, i)) const addresses = { whiskey: "0x6532eFCC1d617e094957247d188Ae6d54093718A", @@ -22,101 +30,41 @@ module.exports = { vodkaV1_Water: "0xC99C6427cB0B824207606dC2745A512C6b066E7C", VodkaV1: "0x88D7500aF99f11fF52E9f185C7aAFBdF9acabD93", fsGlp: "0x1aDDD80E6039594eE970E5872D247bf0414C8903", + vodkaV2: "0x9198989a85E35adeC46309E06684dCA444c9cF27", + vodkaV2_Water: "0x9045ae36f963b7184861BDce205ea8B08913B48c", + gmWeth: "0x70d95587d40A2caf56bd97485aB3Eec10Bee6336", // weth/usdc.e + gmArb: "0xC25cEf6061Cf5dE5eb761b50E4743c1F5D7E5407", // arb/usdc.e + VLP: "0xc5b2d9fda8a82e8dcecd5e9e6e99b78a9188eb05", + gDAI: "0xd85e038593d7a098614721eae955ec2022b9b91b", }; + await api.sumTokens({ + tokensAndOwners: [ + [ADDRESSES.arbitrum.USDC, addresses.vodkaV1_Water], + [ADDRESSES.arbitrum.USDC_CIRCLE, addresses.vodkaV2_Water], + [ADDRESSES.arbitrum.USDC, addresses.sakeWater], + [ADDRESSES.arbitrum.USDC, addresses.sakeWaterV2], + [ADDRESSES.arbitrum.DAI, addresses.whiskeyWater], + [addresses.gDAI, addresses.whiskey], + [addresses.VLP, addresses.sake], + [addresses.VLP, addresses.sakeV2], + [addresses.fsGlp, addresses.VodkaV1], + [addresses.gmArb, addresses.vodkaV2], + [addresses.gmWeth, addresses.vodkaV2], + ] + }) + + const contractAbis = { - gainsBalance: "function getGainsBalance() view returns (uint256)", - gTokenPrice: "function gTokenPrice() view returns (uint256)", - wWaterBalance: "function balanceOfDAI() public view returns (uint256)", - vlpBalance: "function getVlpBalance() public view returns (uint256)", stakedVlpBalance: "function getStakedVlpBalance() public view returns (uint256)", - vlpPrice: "function getVLPPrice() public view returns (uint256)", - glpPrice: "function getGLPPrice(bool) public view returns (uint256)", - waterUSDCBal: "function balanceOfUSDC() public view returns (uint256)", - balanceOf: "function balanceOf(address) view returns (uint256)", }; - const whiskeyGainsBalance = await api.call({ - abi: contractAbis.gainsBalance, - target: addresses.whiskey, - }); - - const whiskeyGTokenPrice = await api.call({ - abi: contractAbis.gTokenPrice, - target: addresses.whiskey, - }); - - const whiskeyWaterDaiBal = await api.call({ - abi: contractAbis.wWaterBalance, - target: addresses.whiskeyWater, - }); - - const sakeWaterUSDCBal = await api.call({ - abi: contractAbis.waterUSDCBal, - target: addresses.sakeWater, - }); - - const vlpBal = await api.call({ - abi: contractAbis.vlpBalance, - target: addresses.sake, - }); - - const StakedVLPBal = await api.call({ - abi: contractAbis.stakedVlpBalance, - target: addresses.sake, - }); - const sakeVLPPrice = await api.call({ - abi: contractAbis.vlpPrice, - target: addresses.sake, - }); - - const sakeWaterUSDCBalV2 = await api.call({ - abi: contractAbis.waterUSDCBal, - target: addresses.sakeWaterV2, - }); - - const vlpBalV2 = await api.call({ - abi: contractAbis.vlpBalance, - target: addresses.sakeV2, - }); - - const StakedVLPBalV2 = await api.call({ - abi: contractAbis.stakedVlpBalance, - target: addresses.sakeV2, - }); - - const vodkaWaterUSDCBalV1 = await api.call({ - abi: contractAbis.waterUSDCBal, - target: addresses.vodkaV1_Water, - }); - - const vodkaGLPPrice = await api.call({ - abi: contractAbis.glpPrice, - target: addresses.VodkaV1, - params: [true], - }); - - const vodkaGLPBalV1 = await api.call({ - abi: contractAbis.balanceOf, - target: addresses.fsGlp, - params: [addresses.VodkaV1], - }); - - return { - tether: bals.reduce((a, i) => a + i / 1e6, 0), - dai: - (whiskeyGainsBalance * whiskeyGTokenPrice) / 1e36 + - whiskeyWaterDaiBal / 1e18, - "usd-coin": - ((vlpBal + StakedVLPBal) * sakeVLPPrice) / 1e18 / 1e5 + - sakeWaterUSDCBal / 1e6 + - ((vlpBalV2 + StakedVLPBalV2) * sakeVLPPrice) / 1e18 / 1e5 + - sakeWaterUSDCBalV2 / 1e6 + - vodkaWaterUSDCBalV1 / 1e6 + - (vodkaGLPBalV1 * vodkaGLPPrice) / 1e18 / 1e18, - }; + const StakedVLPBal = await api.call({ abi: contractAbis.stakedVlpBalance, target: addresses.sake, }); + const StakedVLPBalV2 = await api.call({ abi: contractAbis.stakedVlpBalance, target: addresses.sakeV2, }); + api.add(addresses.VLP, StakedVLPBal) + api.add(addresses.VLP, StakedVLPBalV2) }, }, }; From 7cc557d8e48e5330256c341ecc410b5905157138 Mon Sep 17 00:00:00 2001 From: define Date: Tue, 26 Sep 2023 12:58:04 +0100 Subject: [PATCH 1352/1974] test vv3 --- projects/vvs-v3/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/vvs-v3/index.js b/projects/vvs-v3/index.js index ca7b5a19a1b..85b3b2652dc 100644 --- a/projects/vvs-v3/index.js +++ b/projects/vvs-v3/index.js @@ -5,4 +5,4 @@ module.exports = uniV3Export({ factory: "0x40aB11c64E9fF5368F09343Ac860dAfA34e14C35", fromBlock: 10292950, }, -}); //test \ No newline at end of file +}); //testpain \ No newline at end of file From eb3af179d1227f26f7c3f5d389f4731456a7714c Mon Sep 17 00:00:00 2001 From: Brandon Date: Tue, 26 Sep 2023 06:36:14 -0700 Subject: [PATCH 1353/1974] Vault fetching refactor --- projects/steer/index.js | 128 +++++++++++++++++++++++++++------------- 1 file changed, 88 insertions(+), 40 deletions(-) diff --git a/projects/steer/index.js b/projects/steer/index.js index 973e487bfb2..716d495abc7 100644 --- a/projects/steer/index.js +++ b/projects/steer/index.js @@ -1,44 +1,92 @@ -const { getLogs } = require('../helper/cache/getLogs') -const config = { - polygon: { registry: '0x24825b3c44742600d3995d1d3760ccee999a7f0b', fromBlock: 41535540, }, - arbitrum: { registry: '0x9f5b097AD23e2CF4F34e502A3E41D941678877Dc', fromBlock: 88698956, }, - optimism: { registry: '0xC1Ecd10398A6D7036CceE1f50551ff169715081c', fromBlock: 96971465, }, - avax: { registry: '0x9f5b097AD23e2CF4F34e502A3E41D941678877Dc', fromBlock: 30434642, }, - binance: { registry: '0x31e4ee367d4f2685BAfcAb9566e9C87E60D48983', fromBlock: 28461459, }, - evmos: { registry: '0xD90c8970708FfdFC403bdb56636621e3E9CCe921', fromBlock: 13671900, }, - metis: { registry: '0x116Dba5DcE9CcDA828218b7eB46406810632014C', fromBlock: 6067741, }, - polygon_zkevm: { registry: '0x9f5b097AD23e2CF4F34e502A3E41D941678877Dc', fromBlock: 1022413, }, - celo: { registry: '0x116Dba5DcE9CcDA828218b7eB46406810632014C', fromBlock: 19813127, }, - thundercore: { registry: '0xa1Dd21fbd9e1F0BF28d41F18bDC22326e50C02e9', fromBlock: 135181847, }, - kava: {registry: '0xe240B9a2936f6Fb8860219bC059349e50F03492e', fromBlock: 5915232, }, -} +const { GraphQLClient } = require("graphql-request"); -module.exports = {}; +const supportedChains = [ + { + name: 'Polygon', + subgraphEndpoint: 'https://api.thegraph.com/subgraphs/name/steerprotocol/steer-protocol-polygon', + chainId: 137, + merkl: true, + identifier: 'polygon' + }, + { + name: 'Arbitrum', + subgraphEndpoint: 'https://api.thegraph.com/subgraphs/name/steerprotocol/steer-protocol-arbitrum', + chainId: 42161, + merkl: true, + identifier: 'arbitrum' + }, + { + name: 'Optimism', + subgraphEndpoint: 'https://api.thegraph.com/subgraphs/name/steerprotocol/steer-protocol-optimism', + chainId: 10, + merkl: true, + identifier: 'optimism' + }, + { + name: 'Binance', + subgraphEndpoint: 'https://api.thegraph.com/subgraphs/name/steerprotocol/steer-protocol-bsc', + chainId: 56, + merkl: false, + identifier: 'bsc' + }, + { + name: 'Evmos', + subgraphEndpoint: 'https://subgraph.satsuma-prod.com/769a117cc018/steer/steer-protocol-evmos/api', + chainId: 9001, + merkl: false, + identifier: 'evmos' + }, + { + name: 'Avalanche', + subgraphEndpoint: 'https://api.thegraph.com/subgraphs/name/rakeshbhatt10/avalance-test-subgraph', + chainId: 43114, + merkl: false, + identifier: 'avax' + }, + { + name: 'Thundercore', + subgraphEndpoint: 'http://52.77.49.1:8000/subgraphs/name/steerprotocol/steer-thundercore', + chainId: 108, + merkl: false, + identifier: 'thundercore' + }, + { + name: 'Kava', + subgraphEndpoint: 'https://subgraph.steer.finance/kava/subgraphs/name/steerprotocol/steer-kava-evm', + chainId: 2222, + merkle: false, + identifier: 'kava' + } +] -Object.keys(config).forEach(chain => { - const { registry, fromBlock, } = config[chain] - module.exports[chain] = { - tvl: async (_, _b, _cb, { api, }) => { - const logs = await getLogs({ - api, - target: registry, - topic: "VaultCreated(address,address,string,uint256,address)", - // topics: ["0x3910bed511b4ecc0d6ae24498d585722a54c6ce9ab5e65b4be534cec981f7f6f"], - eventAbi: 'event VaultCreated(address deployer, address vault, string beaconName, uint256 indexed tokenId, address vaultManager)', - onlyArgs: true, - fromBlock, - }) - const vaults = logs.map(log => log.vault) - const bals = await api.multiCall({ abi: "function getTotalAmounts() view returns (uint256 total0, uint256 total1)", calls: vaults, permitFailure: true, }) - const token0s = await api.multiCall({ abi: "address:token0", calls: vaults, permitFailure: true, }) - const token1s = await api.multiCall({ abi: "address:token1", calls: vaults, permitFailure: true, }) - bals.forEach((bal, i) => { - const token0 = token0s[i] - const token1 = token1s[i] - if (!bal || !token0 || !token1) return // skip failures - api.add(token0, bal.total0) - api.add(token1, bal.total1) - }) +// Fetch active vaults and associated data @todo limited to 1000 per chain +const query = ` +{ + vaults(first: 1000, where: {totalLPTokensIssued_not: "0", lastSnapshot_not: "0"}) { + id } + }` + +module.exports = {}; + +supportedChains.forEach(chain => { +module.exports[chain.identifier] = { + tvl: async (_, _b, _cb, { api, }) => { + const graphQLClient = new GraphQLClient(chain.subgraphEndpoint); + const data = await graphQLClient.request(query); + + const vaults = data.vaults.map((vault) => vault.id) + const bals = await api.multiCall({ abi: "function getTotalAmounts() view returns (uint256 total0, uint256 total1)", calls: vaults, permitFailure: true, }) + const token0s = await api.multiCall({ abi: "address:token0", calls: vaults, permitFailure: true, }) + const token1s = await api.multiCall({ abi: "address:token1", calls: vaults, permitFailure: true, }) + bals.forEach((bal, i) => { + const token0 = token0s[i] + const token1 = token1s[i] + if (!bal || !token0 || !token1) return // skip failures + api.add(token0, bal.total0) + api.add(token1, bal.total1) + }) + return api.getBalances() } -}) +} +}) \ No newline at end of file From 972d32a4b8fc4862f5865695ac88bef931667936 Mon Sep 17 00:00:00 2001 From: Jay Welsh Date: Tue, 26 Sep 2023 16:16:16 +0200 Subject: [PATCH 1354/1974] feat(silo-finance): treasury update --- projects/treasury/silo-finance.js | 64 ++++++++++++++++++++++++------- 1 file changed, 51 insertions(+), 13 deletions(-) diff --git a/projects/treasury/silo-finance.js b/projects/treasury/silo-finance.js index 61f3cabaa3f..3e1fce0a8ce 100644 --- a/projects/treasury/silo-finance.js +++ b/projects/treasury/silo-finance.js @@ -2,24 +2,62 @@ const ADDRESSES = require('../helper/coreAssets.json') const { simulateTransaction } = require("@project-serum/anchor/dist/cjs/utils/rpc"); const { nullAddress,treasuryExports } = require("../helper/treasury"); -const treasury = "0xdff2aea378e41632e45306a6de26a7e0fd93ab07"; -const treasury2 = "0xe1f03b7b0ebf84e9b9f62a1db40f1efb8faa7d22" +const ETHEREUM_MAINNET_TREASURIES = [ + "0xE8e8041cB5E3158A0829A19E014CA1cf91098554", + "0xdaC29737b5FB121F11EE7f17dB0212F82b4AB009", + "0xe1F03b7B0eBf84e9B9f62a1dB40f1Efb8FaA7d22", + "0xDfF2aeA378e41632E45306A6dE26A7E0Fd93AB07", + "0xC04f84A02cC65f14f4e8C982a7a467EE88c5311e", + "0x9b85bc68fec59E0209189b475e0cF636c8264e02", + "0xcFEedb0219A99bE73dFE04B2A9905a109Cf87823", +]; -const SILO = "0x6f80310CA7F2C654691D1383149Fa1A57d8AB1f8" +const SILO_ETHEREUM_MAINNET = "0x6f80310CA7F2C654691D1383149Fa1A57d8AB1f8"; +const XAI_ETHEREUM_MAINNET = "0xd7C9F0e536dC865Ae858b0C0453Fe76D13c3bEAc"; +const ARBITRUM_MAINNET_TREASURIES = [ + "0x865a1da42d512d8854c7b0599c962f67f5a5a9d9", + "0x80071b39aA896aa12240c5194E42661D671bDFB2", +] + +const SILO_ARBITRUM_MAINNET = "0x0341C0C0ec423328621788d4854119B97f44E391"; module.exports = treasuryExports({ ethereum: { tokens: [ - nullAddress, - ADDRESSES.ethereum.USDC,//USDC - ADDRESSES.ethereum.DAI,//DAI - ADDRESSES.ethereum.LUSD,//LUSD - ADDRESSES.ethereum.WETH,//WETH - ADDRESSES.ethereum.USDT,//USDT - ADDRESSES.ethereum.TOKE,//TOKE - ], - owners: [treasury, treasury2], - ownTokens: [SILO], + nullAddress, + ADDRESSES.ethereum.USDC,//USDC + ADDRESSES.ethereum.DAI,//DAI + ADDRESSES.ethereum.LUSD,//LUSD + ADDRESSES.ethereum.WETH,//WETH + ADDRESSES.ethereum.USDT,//USDT + ADDRESSES.ethereum.TOKE,//TOKE + ADDRESSES.ethereum.CVX, // CVX + ADDRESSES.ethereum.YFI, // YFI + ADDRESSES.ethereum.CRV, // CRV + "0xf939E0A03FB07F59A73314E73794Be0E57ac1b4E", // crvUSD + "0xc944E90C64B2c07662A292be6244BDf05Cda44a7", // GRT + "0x3432B6A60D23Ca0dFCa7761B7ab56459D9C964D0" // FXS + ], + owners: ETHEREUM_MAINNET_TREASURIES, + ownTokens: [SILO_ETHEREUM_MAINNET, XAI_ETHEREUM_MAINNET], }, + arbitrum: { + tokens: [ + nullAddress, + ADDRESSES.arbitrum.ARB, // ARB + ADDRESSES.arbitrum.GMX, // GMX + "0xaf88d065e77c8cC2239327C5EDb3A432268e5831", // USDC Native + "0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8", // USDC.e (Bridged) + "0x6C2C06790b3E3E3c38e12Ee22F8183b37a13EE55", // DPX + "0x18c11FD286C5EC11c3b683Caa813B77f5163A122", // GNS + "0x51fC0f6660482Ea73330E414eFd7808811a57Fa2", // PREMIA + "0xd4d42F0b6DEF4CE0383636770eF773390d85c61A", // SUSHI + "0x1622bF67e6e5747b81866fE0b85178a93C7F86e3", // UMAMI + "0x539bdE0d7Dbd336b79148AA742883198BBF60342", // MAGIC + "0xFa7F8980b0f1E64A2062791cc3b0871572f1F7f0", // UNI + ], + owners: ARBITRUM_MAINNET_TREASURIES, + ownTokens: [SILO_ARBITRUM_MAINNET], + } }) \ No newline at end of file From e89450bbcb1031afaad49ac5bbd0ee1698697739 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20K=C3=B6nekamp?= Date: Tue, 26 Sep 2023 20:25:21 +0100 Subject: [PATCH 1355/1974] add Linea chain --- projects/altitude/index.js | 53 +++++++++++++++++++++++++------------- 1 file changed, 35 insertions(+), 18 deletions(-) diff --git a/projects/altitude/index.js b/projects/altitude/index.js index e2e7a7ab5f5..c184c0b756a 100644 --- a/projects/altitude/index.js +++ b/projects/altitude/index.js @@ -1,25 +1,42 @@ -const contract = '0xF80E51AFb613D764FA61751Affd3313C190A86BB' +const contract = "0xF80E51AFb613D764FA61751Affd3313C190A86BB"; -const CHAINS = ["ethereum", "bsc", "polygon", "arbitrum", "avax", "optimism", "fantom"] -const chainPathsAbi = "function chainPaths(uint256) view returns (bool ready, address srcToken, uint16 dstChainId, address dstToken, uint256 remoteLiquidity, uint256 localLiquidity, uint256 rewardPoolSize, address lpToken, bool stopSwap)" +const CHAINS = [ + "ethereum", + "bsc", + "polygon", + "arbitrum", + "avax", + "optimism", + "fantom", + "linea" +]; +const chainPathsAbi = + "function chainPaths(uint256) view returns (bool ready, address srcToken, uint16 dstChainId, address dstToken, uint256 remoteLiquidity, uint256 localLiquidity, uint256 rewardPoolSize, address lpToken, bool stopSwap)"; CHAINS.forEach(chain => { module.exports[chain] = { - tvl: async (_, _b, _cb, { api, }) => { - const tokens = [] - let hasMoreTokens = false - let currentStart = 0 - const fetchSize = 5 + tvl: async (_, _b, _cb, { api }) => { + const tokens = []; + let hasMoreTokens = false; + let currentStart = 0; + const fetchSize = 5; do { - let res = await api.fetchList({ itemAbi: chainPathsAbi, target: contract, itemCount: fetchSize + currentStart, start: currentStart, permitFailure: true}) - res = res.filter(i => i).map(i => i.srcToken) - tokens.push(...res) - currentStart += fetchSize - hasMoreTokens = res.length === fetchSize - } while (hasMoreTokens) - return api.sumTokens({ owner: contract, tokens }) + let res = await api.fetchList({ + itemAbi: chainPathsAbi, + target: contract, + itemCount: fetchSize + currentStart, + start: currentStart, + permitFailure: true + }); + res = res.filter(i => i).map(i => i.srcToken); + tokens.push(...res); + currentStart += fetchSize; + hasMoreTokens = res.length === fetchSize; + } while (hasMoreTokens); + return api.sumTokens({ owner: contract, tokens }); } - } -}) + }; +}); -module.exports.methodology = "Fetches the localLiquidity of each token in the Altitude contract across multiple chains and computes the TVL." +module.exports.methodology = + "Fetches the localLiquidity of each token in the Altitude contract across multiple chains and computes the TVL."; From 3dab163d98c8685a727fc874d6b52ba1e15a51a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20K=C3=B6nekamp?= Date: Tue, 26 Sep 2023 20:28:00 +0100 Subject: [PATCH 1356/1974] fix format --- projects/altitude/index.js | 53 +++++++++++++------------------------- 1 file changed, 18 insertions(+), 35 deletions(-) diff --git a/projects/altitude/index.js b/projects/altitude/index.js index c184c0b756a..0e54e8b0b19 100644 --- a/projects/altitude/index.js +++ b/projects/altitude/index.js @@ -1,42 +1,25 @@ -const contract = "0xF80E51AFb613D764FA61751Affd3313C190A86BB"; +const contract = '0xF80E51AFb613D764FA61751Affd3313C190A86BB' -const CHAINS = [ - "ethereum", - "bsc", - "polygon", - "arbitrum", - "avax", - "optimism", - "fantom", - "linea" -]; -const chainPathsAbi = - "function chainPaths(uint256) view returns (bool ready, address srcToken, uint16 dstChainId, address dstToken, uint256 remoteLiquidity, uint256 localLiquidity, uint256 rewardPoolSize, address lpToken, bool stopSwap)"; +const CHAINS = ["ethereum", "bsc", "polygon", "arbitrum", "avax", "optimism", "fantom", "linea"] +const chainPathsAbi = "function chainPaths(uint256) view returns (bool ready, address srcToken, uint16 dstChainId, address dstToken, uint256 remoteLiquidity, uint256 localLiquidity, uint256 rewardPoolSize, address lpToken, bool stopSwap)" CHAINS.forEach(chain => { module.exports[chain] = { - tvl: async (_, _b, _cb, { api }) => { - const tokens = []; - let hasMoreTokens = false; - let currentStart = 0; - const fetchSize = 5; + tvl: async (_, _b, _cb, { api, }) => { + const tokens = [] + let hasMoreTokens = false + let currentStart = 0 + const fetchSize = 5 do { - let res = await api.fetchList({ - itemAbi: chainPathsAbi, - target: contract, - itemCount: fetchSize + currentStart, - start: currentStart, - permitFailure: true - }); - res = res.filter(i => i).map(i => i.srcToken); - tokens.push(...res); - currentStart += fetchSize; - hasMoreTokens = res.length === fetchSize; - } while (hasMoreTokens); - return api.sumTokens({ owner: contract, tokens }); + let res = await api.fetchList({ itemAbi: chainPathsAbi, target: contract, itemCount: fetchSize + currentStart, start: currentStart, permitFailure: true}) + res = res.filter(i => i).map(i => i.srcToken) + tokens.push(...res) + currentStart += fetchSize + hasMoreTokens = res.length === fetchSize + } while (hasMoreTokens) + return api.sumTokens({ owner: contract, tokens }) } - }; -}); + } +}) -module.exports.methodology = - "Fetches the localLiquidity of each token in the Altitude contract across multiple chains and computes the TVL."; +module.exports.methodology = "Fetches the localLiquidity of each token in the Altitude contract across multiple chains and computes the TVL." From 3adce49d4c43045f611bb050a9e8d28d8452719f Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Tue, 26 Sep 2023 22:47:08 +0100 Subject: [PATCH 1357/1974] add cipher.rip --- projects/cipher/index.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 projects/cipher/index.js diff --git a/projects/cipher/index.js b/projects/cipher/index.js new file mode 100644 index 00000000000..19403cea46e --- /dev/null +++ b/projects/cipher/index.js @@ -0,0 +1,14 @@ +const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') + +const contract = "0x2544a6412bc5aec279ea0f8d017fb4a9b6673dca" + +async function tvl(time, ethBlock, _b, {api}) { + return sumTokens2({ tokens: [nullAddress], owner: contract, api }) +} + +module.exports = { + methodology: `We count the ETH on ${contract}`, + arbitrum: { + tvl + } +} \ No newline at end of file From cc468a35b7d24702e8499c5a51d69688d50afa23 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Tue, 26 Sep 2023 23:36:28 +0100 Subject: [PATCH 1358/1974] add starshares --- projects/starshares/index.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 projects/starshares/index.js diff --git a/projects/starshares/index.js b/projects/starshares/index.js new file mode 100644 index 00000000000..ed55d31c5ae --- /dev/null +++ b/projects/starshares/index.js @@ -0,0 +1,14 @@ +const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') + +const contract = "0xa481b139a1a654ca19d2074f174f17d7534e8cec" + +async function tvl(time, ethBlock, _b, {api}) { + return sumTokens2({ tokens: [nullAddress], owner: contract, api }) +} + +module.exports = { + methodology: `We count the AVAX on ${contract}`, + avax: { + tvl + } +} \ No newline at end of file From 52cc14b6d1d834b00ade47edc4763ea4644c1a77 Mon Sep 17 00:00:00 2001 From: Ball Exchange DEX <129707229+ballExchange@users.noreply.github.com> Date: Wed, 27 Sep 2023 09:10:56 +0700 Subject: [PATCH 1359/1974] Create index.js Add New DEX on Shibarium --- projects/BallExchange/index.js | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 projects/BallExchange/index.js diff --git a/projects/BallExchange/index.js b/projects/BallExchange/index.js new file mode 100644 index 00000000000..bad7dcf118d --- /dev/null +++ b/projects/BallExchange/index.js @@ -0,0 +1,3 @@ +const { uniTvlExport } = require('../helper/unknownTokens') + +module.exports = uniTvlExport('shibarium', '0x6d17c4d4524de46e33a09deb37ad6e7e87780137', { fetchBalances: true, }) From 7a3ecabe77e2189d613aaf603754af26fadbdebc Mon Sep 17 00:00:00 2001 From: Steve0day <143409435+Steve0day@users.noreply.github.com> Date: Wed, 27 Sep 2023 10:41:01 +0800 Subject: [PATCH 1360/1974] Create Friend3 tvl --- projects/friend3/index.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 projects/friend3/index.js diff --git a/projects/friend3/index.js b/projects/friend3/index.js new file mode 100644 index 00000000000..c2ebd1b49d0 --- /dev/null +++ b/projects/friend3/index.js @@ -0,0 +1,14 @@ +const { sumTokens2, nullAddress } = require("../helper/unwrapLPs"); + +const contract = "0x1e70972EC6c8a3FAe3aC34C9F3818eC46Eb3BD5D"; + +async function tvl(time, ethBlock, _b, { api }) { + return sumTokens2({ tokens: [nullAddress], owner: contract, api }); +} + +module.exports = { + methodology: `We count the ETH on ${contract}`, + bsc: { + tvl, + }, +}; From c629503daf47bfd583327a3c3aabd5b52b9efbae Mon Sep 17 00:00:00 2001 From: bassexchange <143582485+bassexchange@users.noreply.github.com> Date: Wed, 27 Sep 2023 11:04:34 +0800 Subject: [PATCH 1361/1974] Add files via upload --- projects/index.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 projects/index.js diff --git a/projects/index.js b/projects/index.js new file mode 100644 index 00000000000..a4eafd430d1 --- /dev/null +++ b/projects/index.js @@ -0,0 +1,18 @@ +const { staking } = require("../helper/staking"); +const { sumTokens2 } = require('../helper/unwrapLPs') + +const asssets = "0xb11f5E642EF4cF963e45A83E55A8fedCd58F9A9c" + +async function tvl(timestamp, ethereumBlock, chainBlocks, { api }) { + const tokensAndOwners = await api.call({ + target: asssets, + abi: "function getAssets() view returns (address[][])", + }) + return sumTokens2({ api, tokensAndOwners, }) +} + +module.exports = { + base: { + tvl, + }, +}; From 4ed9e1cd3c80cac94d5f6f4be8b447ec1e3b828c Mon Sep 17 00:00:00 2001 From: Winson Cheng <83229800+0xKMG@users.noreply.github.com> Date: Wed, 27 Sep 2023 16:51:43 +0800 Subject: [PATCH 1362/1974] Update index.js --- projects/vaultka/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/vaultka/index.js b/projects/vaultka/index.js index d031271040e..0a2f8f22578 100644 --- a/projects/vaultka/index.js +++ b/projects/vaultka/index.js @@ -7,7 +7,7 @@ module.exports = { [1688342964, "VLP Leverage Vault"], [1692164391, "GLP Leverage Vault"], [1695274791, "GMXV2 Leverage Vault "], - [1682314791, "GLP Delta Natural Vault"], + [1682314791, "GLP Delta Neutral Vault"], [1683178791, "GDAI Leverage Vault"], ], From 7554befceb6de5981619359242fab25584ac654b Mon Sep 17 00:00:00 2001 From: define Date: Wed, 27 Sep 2023 09:52:15 +0100 Subject: [PATCH 1363/1974] final vv3 --- projects/vvs-v3/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/vvs-v3/index.js b/projects/vvs-v3/index.js index 85b3b2652dc..4483dfd6f2e 100644 --- a/projects/vvs-v3/index.js +++ b/projects/vvs-v3/index.js @@ -5,4 +5,4 @@ module.exports = uniV3Export({ factory: "0x40aB11c64E9fF5368F09343Ac860dAfA34e14C35", fromBlock: 10292950, }, -}); //testpain \ No newline at end of file +}); //testisgood \ No newline at end of file From 112fb4a9daf23644451bccb13115712a91265720 Mon Sep 17 00:00:00 2001 From: define Date: Wed, 27 Sep 2023 10:11:54 +0100 Subject: [PATCH 1364/1974] add mantle chain to starmaker --- projects/starmaker/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/starmaker/index.js b/projects/starmaker/index.js index c40d3eaddea..f7f266f31d2 100644 --- a/projects/starmaker/index.js +++ b/projects/starmaker/index.js @@ -5,5 +5,8 @@ module.exports = { era: { tvl: getUniTVL({ factory: '0x7096Cebc52012e2611a1E88c45bC54ee2A88dcB4', useDefaultCoreAssets: true, fetchBalances: true, }), }, + mantle: { + tvl: getUniTVL({ factory: '0x2a34936cd9441B7E7FB152c9C4e304be58e14830', useDefaultCoreAssets: true, fetchBalances: true, }), + }, methodology: "Counts liquidity in pools", }; \ No newline at end of file From ca3e371072424793c522cee7ac4661115166814c Mon Sep 17 00:00:00 2001 From: bassexchange <143582485+bassexchange@users.noreply.github.com> Date: Wed, 27 Sep 2023 17:39:16 +0800 Subject: [PATCH 1365/1974] Added tvl calculating file. --- projects/bassexhcnage/index.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 projects/bassexhcnage/index.js diff --git a/projects/bassexhcnage/index.js b/projects/bassexhcnage/index.js new file mode 100644 index 00000000000..a4eafd430d1 --- /dev/null +++ b/projects/bassexhcnage/index.js @@ -0,0 +1,18 @@ +const { staking } = require("../helper/staking"); +const { sumTokens2 } = require('../helper/unwrapLPs') + +const asssets = "0xb11f5E642EF4cF963e45A83E55A8fedCd58F9A9c" + +async function tvl(timestamp, ethereumBlock, chainBlocks, { api }) { + const tokensAndOwners = await api.call({ + target: asssets, + abi: "function getAssets() view returns (address[][])", + }) + return sumTokens2({ api, tokensAndOwners, }) +} + +module.exports = { + base: { + tvl, + }, +}; From c733214fd59dcbd5a76d3f8caf6f3516f297e9d8 Mon Sep 17 00:00:00 2001 From: J Date: Wed, 27 Sep 2023 12:54:23 +0200 Subject: [PATCH 1366/1974] Update index.js --- projects/marginfi/index.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/projects/marginfi/index.js b/projects/marginfi/index.js index 075e5bc5933..2a7cd8f154b 100644 --- a/projects/marginfi/index.js +++ b/projects/marginfi/index.js @@ -3,10 +3,25 @@ const { getProvider, sumTokens2, } = require("../helper/solana"); const idl = require('./idl') async function tvl() { + // mrgnlend const provider = getProvider() const program = new Program(idl, 'MFv2hWf31Z9kbCa1snEPYctwafyhdvnV7FZnsebVacA', provider) const banks = await program.account.bank.all() - return sumTokens2({ tokenAccounts: banks.map(i => i.account.liquidityVault.toString()) }) + + const tvl = sumTokens2({ tokenAccounts: banks.map(i => i.account.liquidityVault.toString()) }); + + // LST + const connection = getConnection(); + const account = await connection.getAccountInfo(new PublicKey('DqhH94PjkZsjAqEze2BEkWhFQJ6EyU6MdtMphMgnXqeK')); + const lstTvlSolana = Number(account.data.readBigUint64LE(258))/1e9; + + if (!tvl.solana) { + tvl.solana = 0; + } + + tvl.solana += lstTvlSolana; + + return } module.exports = { From 66812a8b87dafb9f304da35695497f2100161747 Mon Sep 17 00:00:00 2001 From: J Date: Wed, 27 Sep 2023 12:59:19 +0200 Subject: [PATCH 1367/1974] Update index.js --- projects/marginfi/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/projects/marginfi/index.js b/projects/marginfi/index.js index 2a7cd8f154b..d70b92b53ac 100644 --- a/projects/marginfi/index.js +++ b/projects/marginfi/index.js @@ -1,5 +1,7 @@ const { Program } = require("@project-serum/anchor"); -const { getProvider, sumTokens2, } = require("../helper/solana"); +const { getProvider, sumTokens2, getConnection, } = require("../helper/solana"); +const { PublicKey } = require("@solana/web3.js"); + const idl = require('./idl') async function tvl() { From 7a4e4f7377042f15db196bf92c21c756085ba293 Mon Sep 17 00:00:00 2001 From: J Date: Wed, 27 Sep 2023 13:06:56 +0200 Subject: [PATCH 1368/1974] Update index.js --- projects/marginfi/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/marginfi/index.js b/projects/marginfi/index.js index d70b92b53ac..48b5172e801 100644 --- a/projects/marginfi/index.js +++ b/projects/marginfi/index.js @@ -23,7 +23,7 @@ async function tvl() { tvl.solana += lstTvlSolana; - return + return tvl } module.exports = { From 3f823d58f2d5e0cd51e5527f27ade863c11a028e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20K=C3=B6nekamp?= Date: Wed, 27 Sep 2023 13:00:07 +0100 Subject: [PATCH 1369/1974] add staking I have attempted to add to the Total Value Locked (TVL) of our ALTD-USDC Uniswap V2 pool, as discussed with Bentura and WayneBruce in the project-update channel on Discord, to contribute towards increasing our project's TVL on the Ethereum blockchain, but without success. Any assistance you could provide would be greatly appreciated. --- projects/altitude/index.js | 54 ++++++++++++++++++++++++++------------ 1 file changed, 37 insertions(+), 17 deletions(-) diff --git a/projects/altitude/index.js b/projects/altitude/index.js index 0e54e8b0b19..bcdc8282f91 100644 --- a/projects/altitude/index.js +++ b/projects/altitude/index.js @@ -1,25 +1,45 @@ +const { stakings } = require("../helper/staking"); +const { pool2 } = require("../helper/pool2"); + +const stakingContracts = [ + "0xbc2B1262C90ab34757dC7eb2CB7CE595660Ff44e", +]; + +const ALTD_USDC_UNIV2 = "0xC180869eeff55eE737e4B4f10D93B27B10bF976b"; +const ALTD = "0x8929e9DbD2785e3BA16175E596CDD61520feE0D1"; + const contract = '0xF80E51AFb613D764FA61751Affd3313C190A86BB' -const CHAINS = ["ethereum", "bsc", "polygon", "arbitrum", "avax", "optimism", "fantom", "linea"] -const chainPathsAbi = "function chainPaths(uint256) view returns (bool ready, address srcToken, uint16 dstChainId, address dstToken, uint256 remoteLiquidity, uint256 localLiquidity, uint256 rewardPoolSize, address lpToken, bool stopSwap)" +const CHAINS = ["ethereum", "bsc", "polygon", "arbitrum", "avax", "optimism", "fantom", "linea"]; +const chainPathsAbi = "function chainPaths(uint256) view returns (bool ready, address srcToken, uint16 dstChainId, address dstToken, uint256 remoteLiquidity, uint256 localLiquidity, uint256 rewardPoolSize, address lpToken, bool stopSwap)"; + +let output = {}; CHAINS.forEach(chain => { - module.exports[chain] = { + output[chain] = { tvl: async (_, _b, _cb, { api, }) => { - const tokens = [] - let hasMoreTokens = false - let currentStart = 0 - const fetchSize = 5 + const tokens = []; + let hasMoreTokens = false; + let currentStart = 0; + const fetchSize = 5; do { - let res = await api.fetchList({ itemAbi: chainPathsAbi, target: contract, itemCount: fetchSize + currentStart, start: currentStart, permitFailure: true}) - res = res.filter(i => i).map(i => i.srcToken) - tokens.push(...res) - currentStart += fetchSize - hasMoreTokens = res.length === fetchSize - } while (hasMoreTokens) - return api.sumTokens({ owner: contract, tokens }) + let res = await api.fetchList({ itemAbi: chainPathsAbi, target: contract, itemCount: fetchSize + currentStart, start: currentStart, permitFailure: true }); + res = res.filter(i => i).map(i => i.srcToken); + tokens.push(...res); + currentStart += fetchSize; + hasMoreTokens = res.length === fetchSize; + } while (hasMoreTokens); + return api.sumTokens({ owner: contract, tokens }); } - } -}) + }; +}); + +output.ethereum.staking = stakings(stakingContracts, ALTD); +// output.ethereum.pool2 = pool2( +// null, // No staking contract +// ALTD_USDC_UNIV2 // Address of the LP token +// ); + +output.methodology = "Fetches the localLiquidity of each token in the Altitude contract across multiple chains and computes the TVL."; -module.exports.methodology = "Fetches the localLiquidity of each token in the Altitude contract across multiple chains and computes the TVL." +module.exports = output; From a50c544b56f03a89f2cf1ccc2d2448033b318ed1 Mon Sep 17 00:00:00 2001 From: define Date: Wed, 27 Sep 2023 13:40:47 +0100 Subject: [PATCH 1370/1974] dodo update --- projects/dodo/index.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/projects/dodo/index.js b/projects/dodo/index.js index a5652b9d099..f4af850760d 100644 --- a/projects/dodo/index.js +++ b/projects/dodo/index.js @@ -5,10 +5,14 @@ const sdk = require('@defillama/sdk') const graphEndpoints = { 'ethereum': "https://api.thegraph.com/subgraphs/name/dodoex/dodoex-v2", "bsc": "https://api.thegraph.com/subgraphs/name/dodoex/dodoex-v2-bsc", - // "heco": "https://q.hg.network/subgraphs/name/dodoex/heco", + "heco": "https://q.hg.network/subgraphs/name/dodoex/heco", "polygon": "https://api.thegraph.com/subgraphs/name/dodoex/dodoex-v2-polygon", "arbitrum": "https://api.thegraph.com/subgraphs/name/dodoex/dodoex-v2-arbitrum", - "aurora": "https://api.thegraph.com/subgraphs/name/dodoex/dodoex-v2-aurora" + "aurora": "https://api.thegraph.com/subgraphs/name/dodoex/dodoex-v2-aurora", + "avax": "https://api.thegraph.com/subgraphs/name/dodoex/dodoex-v2-avax", + "optimism": "https://api.thegraph.com/subgraphs/name/dodoex/dodoex-v2-optimism", + // "base": "https://api.dodoex.io/frontend-graphql?chainId=84531&schemaName=dodoex", //different query + // "linea": "https://api.dodoex.io/frontend-graphql?chainId=534351&schemaName=dodoex" //different query } const graphQuery = gql` query get_pairs($lastId: String, $block: Int) { From d30bc30cf5634e8b5e5c5585b36483cd1e96fd88 Mon Sep 17 00:00:00 2001 From: define Date: Wed, 27 Sep 2023 13:41:25 +0100 Subject: [PATCH 1371/1974] remove heco --- projects/dodo/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/dodo/index.js b/projects/dodo/index.js index f4af850760d..9b127a465cf 100644 --- a/projects/dodo/index.js +++ b/projects/dodo/index.js @@ -5,7 +5,7 @@ const sdk = require('@defillama/sdk') const graphEndpoints = { 'ethereum': "https://api.thegraph.com/subgraphs/name/dodoex/dodoex-v2", "bsc": "https://api.thegraph.com/subgraphs/name/dodoex/dodoex-v2-bsc", - "heco": "https://q.hg.network/subgraphs/name/dodoex/heco", + //"heco": "https://q.hg.network/subgraphs/name/dodoex/heco", "polygon": "https://api.thegraph.com/subgraphs/name/dodoex/dodoex-v2-polygon", "arbitrum": "https://api.thegraph.com/subgraphs/name/dodoex/dodoex-v2-arbitrum", "aurora": "https://api.thegraph.com/subgraphs/name/dodoex/dodoex-v2-aurora", From d20e312829a07109c7375861ba3f2b2628dcd979 Mon Sep 17 00:00:00 2001 From: define Date: Wed, 27 Sep 2023 13:54:03 +0100 Subject: [PATCH 1372/1974] adapter bluemeteor --- projects/bluemeteor/index.js | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 projects/bluemeteor/index.js diff --git a/projects/bluemeteor/index.js b/projects/bluemeteor/index.js new file mode 100644 index 00000000000..caec2d3a8f6 --- /dev/null +++ b/projects/bluemeteor/index.js @@ -0,0 +1,6 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports = { + misrepresentedTokens: true, + pulse: { tvl: getUniTVL({ factory: '0x2c68d8942fD4B5eC45a671fA230fb3dEBF224176', useDefaultCoreAssets: true, fetchBalances: true, }), }, +} \ No newline at end of file From 558eadb9c85f074b5135e0dc56da44ef823ee5b2 Mon Sep 17 00:00:00 2001 From: leoton <15011116466@163.com> Date: Wed, 27 Sep 2023 22:50:57 +0800 Subject: [PATCH 1373/1974] update contract for letsfil project --- projects/letsfil/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/letsfil/index.js b/projects/letsfil/index.js index dc1bcf22a3e..408c93d1fa5 100644 --- a/projects/letsfil/index.js +++ b/projects/letsfil/index.js @@ -1,6 +1,6 @@ const sdk = require('@defillama/sdk'); const ADDRESSES = require('../helper/coreAssets.json') -const LETSFIL_CONTRACT = "0x74a37AC5f124d25284ffEc0107cB93a6f9A2E433"; +const LETSFIL_CONTRACT = "0x02F0C30Eb92e89912371242Ee86Fe98050D040A5"; async function tvl(_, _1, _2, { api }) { From 54be8e20119b2e27b3431093887fe2de903f5d5e Mon Sep 17 00:00:00 2001 From: 0xngmi <80541789+0xngmi@users.noreply.github.com> Date: Wed, 27 Sep 2023 15:55:40 +0100 Subject: [PATCH 1374/1974] add rule on npm packages --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index a4b9dc7340b..42e8964c884 100644 --- a/README.md +++ b/README.md @@ -38,3 +38,6 @@ POLYGON_RPC="..." ``` The name of each rpc is `{CHAIN-NAME}_RPC`, and the name we use for each chain can be found [here](https://github.com/DefiLlama/defillama-sdk/blob/master/src/providers.json) + +## Adapter rules +- Never add extra npm packages, if you need a chain-level package for your chain, ask us and we'll consider it, but we can't accept any npm package that is project-specific From d8bf03170a820a1334e71dcd4ec4195ec19dfb83 Mon Sep 17 00:00:00 2001 From: midaseth Date: Wed, 27 Sep 2023 08:04:06 -0700 Subject: [PATCH 1375/1974] Update palmswap contract addresses --- projects/palmswap/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/palmswap/index.js b/projects/palmswap/index.js index 6c61b803a9b..d3218c990ae 100644 --- a/projects/palmswap/index.js +++ b/projects/palmswap/index.js @@ -1,9 +1,9 @@ const { gmxExports } = require("../helper/gmx"); const { staking } = require("../helper/staking"); -const palmswapVault = "0x806f709558CDBBa39699FBf323C8fDA4e364Ac7A"; //Vault +const palmswapVault = "0x0cD6709ba5972eDc64414fd2aeC7F8a891718dDa"; //Vault -const palmTokenStakingContract = "0x95fc6f7df412040a815494cf27fbc82be6c7585c"; //RewardTracker +const palmTokenStakingContract = "0x53ce47f3a148Fcb1F96E1Bf6F0a47D041D8d3788"; //RewardTracker const palmToken = "0x29745314B4D294B7C77cDB411B8AAa95923aae38"; //PALM token address module.exports = { From aaf1494876c3bfb54e9c5d4a93121e1055e0c5dc Mon Sep 17 00:00:00 2001 From: phiatFinance <107194334+phiatDev2@users.noreply.github.com> Date: Thu, 28 Sep 2023 13:07:16 +1000 Subject: [PATCH 1376/1974] add phame protocol --- projects/phame/index.js | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 projects/phame/index.js diff --git a/projects/phame/index.js b/projects/phame/index.js new file mode 100644 index 00000000000..8e867919d3f --- /dev/null +++ b/projects/phame/index.js @@ -0,0 +1,7 @@ +const { gmxExports } = require('../helper/gmx') + +module.exports = { + pulse:{ + tvl: gmxExports({ vault: '0x3dC4033fF5c04FdE3369937434961ca47AC7cA26', }) + } +}; From f8a8f4b968ffb28aacb3d27aee6952f8fd2cb279 Mon Sep 17 00:00:00 2001 From: bassexchange <143582485+bassexchange@users.noreply.github.com> Date: Thu, 28 Sep 2023 16:31:24 +0800 Subject: [PATCH 1377/1974] Delete projects/index.js --- projects/index.js | 18 ------------------ 1 file changed, 18 deletions(-) delete mode 100644 projects/index.js diff --git a/projects/index.js b/projects/index.js deleted file mode 100644 index a4eafd430d1..00000000000 --- a/projects/index.js +++ /dev/null @@ -1,18 +0,0 @@ -const { staking } = require("../helper/staking"); -const { sumTokens2 } = require('../helper/unwrapLPs') - -const asssets = "0xb11f5E642EF4cF963e45A83E55A8fedCd58F9A9c" - -async function tvl(timestamp, ethereumBlock, chainBlocks, { api }) { - const tokensAndOwners = await api.call({ - target: asssets, - abi: "function getAssets() view returns (address[][])", - }) - return sumTokens2({ api, tokensAndOwners, }) -} - -module.exports = { - base: { - tvl, - }, -}; From a699f5de7f4bebf347acaefe55d182877c20c022 Mon Sep 17 00:00:00 2001 From: kolima Date: Thu, 28 Sep 2023 14:38:34 +0300 Subject: [PATCH 1378/1974] add ethereum to myso v2 --- projects/myso-v2/index.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/projects/myso-v2/index.js b/projects/myso-v2/index.js index fb7aff9fa5b..3a47194d698 100644 --- a/projects/myso-v2/index.js +++ b/projects/myso-v2/index.js @@ -1,8 +1,8 @@ const axios = require("axios"); const zlib = require("zlib"); -const { getLogs, } = require("../helper/cache/getLogs"); +const { getLogs } = require("../helper/cache/getLogs"); const { sumTokens2 } = require("../helper/unwrapLPs"); -const { getCache, setCache, } = require("../helper/cache"); +const { getCache, setCache } = require("../helper/cache"); const brotliDecode = (stream) => { return new Promise((resolve, reject) => { @@ -45,13 +45,13 @@ const getContracts = async (chainId) => { async function tvl(_, _b, _cb, { api }) { const { fromBlock } = config[api.chain]; - let contracts + let contracts; try { - contracts = await getContracts(api.chainId) - await setCache('myso-v2', api.chain, contracts) + contracts = await getContracts(api.chainId); + await setCache("myso-v2", api.chain, contracts); } catch (e) { - contracts = await getCache('myso-v2',api.chain) + contracts = await getCache("myso-v2", api.chain); } const vaultFactory = contracts?.find( @@ -61,7 +61,8 @@ async function tvl(_, _b, _cb, { api }) { const logs = await getLogs({ api, target: vaultFactory, - eventAbi: "event NewVaultCreated(address indexed newLenderVaultAddr, address vaultOwner, uint256 numRegisteredVaults)", + eventAbi: + "event NewVaultCreated(address indexed newLenderVaultAddr, address vaultOwner, uint256 numRegisteredVaults)", onlyArgs: true, fromBlock, }); @@ -85,6 +86,9 @@ const config = { mantle: { fromBlock: 3471026, }, + ethereum: { + fromBlock: 18213104, + }, }; Object.keys(config).forEach((chain) => { From 680c26b2be506a0a3474b88d42e98fa63dc93aeb Mon Sep 17 00:00:00 2001 From: g1nt0ki Date: Thu, 28 Sep 2023 16:45:25 +0200 Subject: [PATCH 1379/1974] split margin fi --- projects/marginfi-lst/index.js | 17 +++++++++++++++++ projects/marginfi/index.js | 19 ++----------------- 2 files changed, 19 insertions(+), 17 deletions(-) create mode 100644 projects/marginfi-lst/index.js diff --git a/projects/marginfi-lst/index.js b/projects/marginfi-lst/index.js new file mode 100644 index 00000000000..6806973a8e6 --- /dev/null +++ b/projects/marginfi-lst/index.js @@ -0,0 +1,17 @@ +const { getConnection, } = require("../helper/solana"); +const { PublicKey } = require("@solana/web3.js"); + +async function tvl() { + const connection = getConnection(); + const account = await connection.getAccountInfo(new PublicKey('DqhH94PjkZsjAqEze2BEkWhFQJ6EyU6MdtMphMgnXqeK')); + const lstTvlSolana = Number(account.data.readBigUint64LE(258))/1e9; + + return { + solana: lstTvlSolana + } +} + +module.exports = { + timetravel: false, + solana: { tvl, }, +} diff --git a/projects/marginfi/index.js b/projects/marginfi/index.js index 48b5172e801..45d71da3b9d 100644 --- a/projects/marginfi/index.js +++ b/projects/marginfi/index.js @@ -1,29 +1,14 @@ const { Program } = require("@project-serum/anchor"); -const { getProvider, sumTokens2, getConnection, } = require("../helper/solana"); -const { PublicKey } = require("@solana/web3.js"); +const { getProvider, sumTokens2, } = require("../helper/solana"); const idl = require('./idl') async function tvl() { - // mrgnlend const provider = getProvider() const program = new Program(idl, 'MFv2hWf31Z9kbCa1snEPYctwafyhdvnV7FZnsebVacA', provider) const banks = await program.account.bank.all() - const tvl = sumTokens2({ tokenAccounts: banks.map(i => i.account.liquidityVault.toString()) }); - - // LST - const connection = getConnection(); - const account = await connection.getAccountInfo(new PublicKey('DqhH94PjkZsjAqEze2BEkWhFQJ6EyU6MdtMphMgnXqeK')); - const lstTvlSolana = Number(account.data.readBigUint64LE(258))/1e9; - - if (!tvl.solana) { - tvl.solana = 0; - } - - tvl.solana += lstTvlSolana; - - return tvl + return sumTokens2({ tokenAccounts: banks.map(i => i.account.liquidityVault.toString()) }); } module.exports = { From 26494e184b99981c61fba9e27e4149ad662282ad Mon Sep 17 00:00:00 2001 From: g1nt0ki Date: Thu, 28 Sep 2023 18:11:52 +0200 Subject: [PATCH 1380/1974] huobi track staked eth balance --- projects/huobi/index.js | 111 +++++++++++++++++++++++++++------------- 1 file changed, 75 insertions(+), 36 deletions(-) diff --git a/projects/huobi/index.js b/projects/huobi/index.js index bb1f4a76e7c..fd4183e9d27 100644 --- a/projects/huobi/index.js +++ b/projects/huobi/index.js @@ -1,4 +1,7 @@ const { cexExports } = require('../helper/cex') +const { mergeExports, sliceIntoChunks, sleep } = require('../helper/utils') +const { post, get } = require('../helper/http') +const sdk = require('@defillama/sdk') const config = { bitcoin: { @@ -18,38 +21,38 @@ const config = { }, ethereum: { owners: [ - '0xa929022c9107643515f5c777ce9a910f0d1e490c', - '0x18709e89bd403f470088abdacebe86cc60dda12e', - '0xcac725bef4f114f728cbcfd744a731c2a463c3fc', - '0x0511509A39377F1C6c78DB4330FBfcC16D8A602f', - '0x1205E4f0D2f02262E667fd72f95a68913b4F7462', - '0xE4818f8fDe0C977A01DA4Fa467365B8bF22b071E', - '0x5C985E89DDe482eFE97ea9f1950aD149Eb73829B', - '0xc589b275e60dda57ad7e117c6dd837ab524a5666', - '0x6b2286fc3a9265bab3f064808022aca54de4b6ce', // add on 08/08/2023 (we defillama) - '0x3d655889d197125fb90dcb72e4a287a8410ed1b9', // add on 08/08/2023 (we defillama) - '0x2abc22eb9a09ebbe7b41737ccde147f586efeb6a', // add on 08/08/2023 (we defillama) - '0xa5d7f0f7027fa8f4d1be8042e1e43bbdec36951e', // add on 08/08/2023 (we defillama) - '0xeee28d484628d41a82d01e21d12e2e78d69920da', // add on 08/08/2023 (we defillama) - '0x6748f50f686bfbca6fe8ad62b22228b87f31ff2b', // add on 08/08/2023 (we defillama) - '0x34189c75cbb13bdb4f5953cda6c3045cfca84a9e', // add on 08/08/2023 (we defillama) - '0x1062a747393198f70f71ec65a582423dba7e5ab3', // add on 08/08/2023 (we defillama) - '0xab5c66752a9e8167967685f1450532fb96d5d24f', // add on 08/08/2023 (we defillama) - '0xdb0e89a9b003a28a4055ef772e345e8089987bfd', // add on 08/08/2023 (we defillama) - '0xfdb16996831753d5331ff813c29a93c76834a0ad', // add on 08/08/2023 (we defillama) - '0x46705dfff24256421a05d056c29e81bdc09723b8', // add on 08/08/2023 (we defillama) - '0xfd54078badd5653571726c3370afb127351a6f26', // add on 08/08/2023 (we defillama) - '0x07ef60deca209ea0f3f3f08c1ad21a6db5ef9d33', // add on 08/08/2023 (we defillama) - '0x18916e1a2933cb349145a280473a5de8eb6630cb', // add on 08/08/2023 (we defillama) - '0xfa4b5be3f2f84f56703c42eb22142744e95a2c58', // add on 08/08/2023 (we defillama) - '0x0a98fb70939162725ae66e626fe4b52cff62c2e5', // add on 08/08/2023 (we defillama) - '0x918800e018a0eeea672740f88a60091c7d327a79', // add on 08/08/2023 (we defillama) - '0xadb2b42f6bd96f5c65920b9ac88619dce4166f94', // add on 08/08/2023 (we defillama) - '0x42dc966b7ecc3c6cc73e7bc04862859d5bddce65', // add on 08/08/2023 (we defillama) - '0xe8d8a02601f54acb6fb69537be1f1d7cc76ccd8c', // add on 08/08/2023 (we defillama) - '0xf881bcb3705926cea9c598ab05a837cf41a833a9', // add on 08/08/2023 (we defillama) - '0xb9F775179bcC7FcF4534700a48F09C590E390eAd', - ], + '0xa929022c9107643515f5c777ce9a910f0d1e490c', + '0x18709e89bd403f470088abdacebe86cc60dda12e', + '0xcac725bef4f114f728cbcfd744a731c2a463c3fc', + '0x0511509A39377F1C6c78DB4330FBfcC16D8A602f', + '0x1205E4f0D2f02262E667fd72f95a68913b4F7462', + '0xE4818f8fDe0C977A01DA4Fa467365B8bF22b071E', + '0x5C985E89DDe482eFE97ea9f1950aD149Eb73829B', + '0xc589b275e60dda57ad7e117c6dd837ab524a5666', + '0x6b2286fc3a9265bab3f064808022aca54de4b6ce', // add on 08/08/2023 (we defillama) + '0x3d655889d197125fb90dcb72e4a287a8410ed1b9', // add on 08/08/2023 (we defillama) + '0x2abc22eb9a09ebbe7b41737ccde147f586efeb6a', // add on 08/08/2023 (we defillama) + '0xa5d7f0f7027fa8f4d1be8042e1e43bbdec36951e', // add on 08/08/2023 (we defillama) + '0xeee28d484628d41a82d01e21d12e2e78d69920da', // add on 08/08/2023 (we defillama) + '0x6748f50f686bfbca6fe8ad62b22228b87f31ff2b', // add on 08/08/2023 (we defillama) + '0x34189c75cbb13bdb4f5953cda6c3045cfca84a9e', // add on 08/08/2023 (we defillama) + '0x1062a747393198f70f71ec65a582423dba7e5ab3', // add on 08/08/2023 (we defillama) + '0xab5c66752a9e8167967685f1450532fb96d5d24f', // add on 08/08/2023 (we defillama) + '0xdb0e89a9b003a28a4055ef772e345e8089987bfd', // add on 08/08/2023 (we defillama) + '0xfdb16996831753d5331ff813c29a93c76834a0ad', // add on 08/08/2023 (we defillama) + '0x46705dfff24256421a05d056c29e81bdc09723b8', // add on 08/08/2023 (we defillama) + '0xfd54078badd5653571726c3370afb127351a6f26', // add on 08/08/2023 (we defillama) + '0x07ef60deca209ea0f3f3f08c1ad21a6db5ef9d33', // add on 08/08/2023 (we defillama) + '0x18916e1a2933cb349145a280473a5de8eb6630cb', // add on 08/08/2023 (we defillama) + '0xfa4b5be3f2f84f56703c42eb22142744e95a2c58', // add on 08/08/2023 (we defillama) + '0x0a98fb70939162725ae66e626fe4b52cff62c2e5', // add on 08/08/2023 (we defillama) + '0x918800e018a0eeea672740f88a60091c7d327a79', // add on 08/08/2023 (we defillama) + '0xadb2b42f6bd96f5c65920b9ac88619dce4166f94', // add on 08/08/2023 (we defillama) + '0x42dc966b7ecc3c6cc73e7bc04862859d5bddce65', // add on 08/08/2023 (we defillama) + '0xe8d8a02601f54acb6fb69537be1f1d7cc76ccd8c', // add on 08/08/2023 (we defillama) + '0xf881bcb3705926cea9c598ab05a837cf41a833a9', // add on 08/08/2023 (we defillama) + '0xb9F775179bcC7FcF4534700a48F09C590E390eAd', + ], blacklistedTokens: [ '0x0316eb71485b0ab14103307bf65a021042c6d380', // HBTC , we already track their backed BTC (1btc wallet on the list) ] @@ -83,8 +86,8 @@ const config = { ] }, algorand: { - owners: ['J4AEINCSSLDA7LNBNWM4ZXFCTLTOZT5LG3F5BLMFPJYGFWVCMU37EZI2AM'] -}, + owners: ['J4AEINCSSLDA7LNBNWM4ZXFCTLTOZT5LG3F5BLMFPJYGFWVCMU37EZI2AM'] + }, avax: { owners: ['0xe195b82df6a797551eb1acd506e892531824af27'] }, @@ -102,5 +105,41 @@ const config = { }, } -module.exports = cexExports(config) -module.exports.methodology = 'We added the wallets from here https://github.com/huobiapi/Tool-Node.js-VerifyAddress/blob/main/snapshot/huobi_por_20230701.csv . We are not tracking 3 wallets, 2 on Heco Chain, 1 on BTTC chain. We also count stUSDT.' +module.exports = mergeExports([ + cexExports(config), + { ethereum: { tvl: stakingTVL, } } +]) +module.exports.methodology = 'We added the wallets from here https://github.com/huobiapi/Tool-Node.js-VerifyAddress/blob/main/snapshot/huobi_por_20230701.csv . We are not tracking 3 wallets, 2 on Heco Chain, 1 on BTTC chain. We also count stUSDT.' + + +async function stakingTVL() { + const withdrawalAddress = '0x08DeB6278D671E2a1aDc7b00839b402B9cF3375d' + let fetchedValidators = 2400 + let size = 200 + let ethBalance = (await sdk.api2.eth.getBalance({ target: '0x08DeB6278D671E2a1aDc7b00839b402B9cF3375d'})).output/1e18 + do { + const validators = (await get(`https://beaconcha.in/api/v1/validator/withdrawalCredentials/${withdrawalAddress}?limit=${size}&offset=${fetchedValidators}`)).data.map(i => i.publickey) + fetchedValidators += validators.length + await addValidatorBalance(validators) + await sleep(10000) + } while (fetchedValidators % size === 0) + + return { + ethereum: ethBalance + } + + async function addValidatorBalance(validators) { + if (validators.length > 100) { + const chunks = sliceIntoChunks(validators, 100) + for (const chunk of chunks) await addValidatorBalance(chunk) + return; + } + + const { data } = await post('https://beaconcha.in/api/v1/validator', { + indicesOrPubkey: validators.join(',') + }) + + + data.forEach((i) => ethBalance += i.balance/1e9) + } +} \ No newline at end of file From 9409aef0ccebbd571b998cd6804b874f4b68206f Mon Sep 17 00:00:00 2001 From: tanglenaut87 <90203390+tanglenaut87@users.noreply.github.com> Date: Thu, 28 Sep 2023 18:40:55 +0200 Subject: [PATCH 1381/1974] added shimmersea adapter (#7577) * added shimmersea adapter * code refactor --------- Co-authored-by: AS <> Co-authored-by: g1nt0ki --- projects/helper/chains.json | 1 + projects/helper/tokenMapping.js | 3 +++ projects/shimmersea/index.js | 3 +++ 3 files changed, 7 insertions(+) create mode 100644 projects/shimmersea/index.js diff --git a/projects/helper/chains.json b/projects/helper/chains.json index 98618fab157..5f00b4e7cc7 100644 --- a/projects/helper/chains.json +++ b/projects/helper/chains.json @@ -189,6 +189,7 @@ "sei", "shibarium", "shiden", + "shimmer_evm", "sifchain", "smartbch", "solana", diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 649c21fe6d1..2fa14c13e02 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -55,6 +55,9 @@ const fixBalancesTokens = { pg: { '0x0cf4071940782b640d0b595cb17bdf3e90869d70': { coingeckoId: 'pego-network-2', decimals: 18 }, }, + shimmer_evm: { + '0x1074010000000000000000000000000000000000': { coingeckoId: 'shimmer', decimals: 6 }, + }, manta: { '0x0Dc808adcE2099A9F62AA87D9670745AbA741746': { coingeckoId: 'ethereum', decimals: 18 }, '0xb73603c5d87fa094b7314c74ace2e64d165016fb': { coingeckoId: 'usd-coin', decimals: 6 }, diff --git a/projects/shimmersea/index.js b/projects/shimmersea/index.js new file mode 100644 index 00000000000..235b4b878ee --- /dev/null +++ b/projects/shimmersea/index.js @@ -0,0 +1,3 @@ +const { uniTvlExport } = require('../helper/unknownTokens'); + +module.exports = uniTvlExport('shimmer_evm', '0x4fb5d3a06f5de2e88ce490e2e11d22b840d5ac47') From a8b5af174b423ca8184b521213804313e939eb89 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Fri, 29 Sep 2023 00:48:28 +0100 Subject: [PATCH 1382/1974] add moonbeam --- projects/uniswap/index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/projects/uniswap/index.js b/projects/uniswap/index.js index 03dad7c5fb2..841523a5c0c 100644 --- a/projects/uniswap/index.js +++ b/projects/uniswap/index.js @@ -13,7 +13,7 @@ const graphs = { } const blacklists = { - ethereum: ['0xa850478adaace4c08fc61de44d8cf3b64f359bec', '0x055284a4ca6532ecc219ac06b577d540c686669d', '0x8c0411f2ad5470a66cb2e9c64536cfb8dcd54d51', '0x277667eb3e34f134adf870be9550e9f323d0dc24', '0x4c83a7f819a5c37d64b4c5a2f8238ea082fa1f4e', '0x290a6a7460b308ee3f19023d2d00de604bcf5b42', '0x4b5ab61593a2401b1075b90c04cbcdd3f87ce011', '0x582d23c7ec6b59afd041a522ff64ff081e8c0d2d', '0x1f98431c8ad98523631ae4a59f267346ea31f984', '0xaf44e10ed87d90f28bff2d1fbef1f64b090f5ebb',], + ethereum: ['0xa850478adaace4c08fc61de44d8cf3b64f359bec', '0x055284a4ca6532ecc219ac06b577d540c686669d', '0x8c0411f2ad5470a66cb2e9c64536cfb8dcd54d51', '0x277667eb3e34f134adf870be9550e9f323d0dc24', '0x4c83a7f819a5c37d64b4c5a2f8238ea082fa1f4e', '0x290a6a7460b308ee3f19023d2d00de604bcf5b42', '0x4b5ab61593a2401b1075b90c04cbcdd3f87ce011', '0x582d23c7ec6b59afd041a522ff64ff081e8c0d2d', '0x1f98431c8ad98523631ae4a59f267346ea31f984', '0xaf44e10ed87d90f28bff2d1fbef1f64b090f5ebb', '0xdfef6416ea3e6ce587ed42aa7cb2e586362cbbfa'], arbitrum: ['0xd4d2f4110878a33ea5b97f0665e518253446161a', '0xB50721BCf8d664c30412Cfbc6cf7a15145234ad1',], polygon: ['0x8d52c2d70a7c28a9daac2ff12ad9bfbf041cd318', '0x1f98431c8ad98523631ae4a59f267346ea31f984', '0xd5302a8ead77b85ea3326b45f4714e0b3432b233', '0xc951ab482ff11d8df636742e1f1c3fc8037427a9',], } @@ -67,10 +67,11 @@ module.exports = { ...uniV3Export({ base: { factory: '0x33128a8fc17869897dce68ed026d694621f6fdfd', fromBlock: 1371680, }, celo: { factory: '0xAfE208a311B21f13EF87E33A90049fC17A7acDEc', fromBlock: 13916355, }, + moonbeam: { factory: '0x28f1158795a3585caaa3cd6469cd65382b89bb70', fromBlock: 3340452 } }) } -const chains = ['ethereum', 'arbitrum', 'optimism', 'polygon', 'bsc', 'avax',] +const chains = ['ethereum', 'arbitrum', 'optimism', 'polygon', 'bsc', 'avax'] chains.forEach(chain => { module.exports[chain] = { From 8f452e569e81c2a33a248773808038f8d68cdd49 Mon Sep 17 00:00:00 2001 From: bbjansen <56940439+bbjansen@users.noreply.github.com> Date: Fri, 29 Sep 2023 03:24:00 +0200 Subject: [PATCH 1383/1974] florence-finance: migrating to arbitrum (#7589) * arbitrum migration * comment out arbitrum * bridge implementation * rewrite --- projects/florence-finance/index.js | 49 ++++++++++++++++++++---------- 1 file changed, 33 insertions(+), 16 deletions(-) diff --git a/projects/florence-finance/index.js b/projects/florence-finance/index.js index 87bfbd4f88d..145603558e0 100644 --- a/projects/florence-finance/index.js +++ b/projects/florence-finance/index.js @@ -1,21 +1,38 @@ +const ETH_ARB_BRIDGE = "0xcee284f754e854890e311e3280b767f80797180d"; +const ETH_FLR = "0x5e5d9aeec4a6b775a175b883dca61e4297c14ecb"; +const ETH_EURS = "0xdb25f211ab05b1c97d595516f45794528a807ad8"; -const FACTORY_CONTRACT_ETH = "0xD6348E8EacE62Eb3Eb77fBbA8D8c363e375fC455"; -const EURS_CONTRACT_ETH= "0xdb25f211ab05b1c97d595516f45794528a807ad8"; +const ARB_FLR = "0x9b6226dd0191a77d032f56a6d383044ee99944c3"; +const ARB_AGEUR = "0xfa5ed56a203466cbbc2430a43c66b9d8723528e7"; -async function borrowed(_, _1, _2, { api }) { - // Get all vaults - const vaultIds = await api.call({ - abi: "function getLoanVaultIds() external view returns (string[])", - target: FACTORY_CONTRACT_ETH - }) - const vaultContracts = await api.multiCall({ abi: "function getLoanVault (string loanVaultId) external view returns (address)", target: FACTORY_CONTRACT_ETH, calls: vaultIds }) - const loans = await api.multiCall({ abi: "function loansOutstanding() external view returns (uint256)", calls: vaultContracts}) - // Take the sum of all vault tokens in terms of EURS (1 Loan Vault Token = 1 EURS Statis) on the platform | 18-2 = 16 atomic units (LV-EURS - loans.forEach((val, i) => api.add(EURS_CONTRACT_ETH, val / 1e16)) +async function getTotalSupply(token, { api }) { + const totalSupply = await api.call({ + abi: "function totalSupply() external view returns (uint256)", + target: token, + }); + return totalSupply; } -module.exports = { - start: 16077400, - methodology: "Data is retrieved on-chain by taking the total sum of all loans outstanding (dominated in EURS Statis) from all platform vaults.", - ethereum: { borrowed, tvl: () => ({}) } +async function getBorrowedOnEthereum(_, _1, _2, { api }) { + const [flrSupply, flrInBridgeCustody] = await Promise.all([getTotalSupply(ETH_FLR, { api }), await api.call({ + abi: "function balanceOf(address account) view returns (uint256)", + target: ETH_FLR, + params: [ETH_ARB_BRIDGE], + })]); + + const borrowed = flrSupply - flrInBridgeCustody; //Subtract FLR in bridge custody to avoid double counting accross chains + + api.add(ETH_EURS, borrowed / 1e16); //18 decimals (FLR) -> 2 decimals (EURS) } + +async function getBorrowedOnArbitrum(_, _1, _2, { api }) { + const borrowed = await getTotalSupply(ARB_FLR, { api }); //FLR that are bridged to Ethereum are burned by the Arbitrum bridge. So there is no need to subtract here. + api.add(ARB_AGEUR, borrowed); //Decimals of FLR and agEUR are both 18. No conversion needed. +} + +module.exports = { + methodology: + "The Florin token (FLR) is minted whenever a new loan is funded and burned when a loan matures and is repaid. Since the Florin token is 1:1 redeemable for EUR the borrowed amount is denominated in the protocols treasuries EUR stablecoin of the respective chain. Consequently the total supply of Florin equals the amount borrowed through the protocol. To avoid double counting, the amount of FLR held in the bridge contract is subtracted from the total supply. ", + ethereum: { start: 16077400, borrowed: getBorrowedOnEthereum, tvl: () => ({}) }, + arbitrum: { start: 126183369, borrowed: getBorrowedOnArbitrum, tvl: () => ({}) }, +}; \ No newline at end of file From 7d7060c42f816bd840c329e06028b8205e1ff6a3 Mon Sep 17 00:00:00 2001 From: g1nt0ki Date: Fri, 29 Sep 2023 03:35:00 +0200 Subject: [PATCH 1384/1974] penpie: track staking --- projects/penpie/config.js | 8 ++++++++ projects/penpie/index.js | 9 +++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/projects/penpie/config.js b/projects/penpie/config.js index 3a94761d71e..4ddd3c0dc00 100644 --- a/projects/penpie/config.js +++ b/projects/penpie/config.js @@ -5,6 +5,8 @@ module.exports = { mPENDLE: "0x83e817E1574e2201a005EC0f7e700ED5606F555E", PENDLE: "0x808507121b80c02388fad14726482e061b8da827", pendleStaking: "0x6E799758CEE75DAe3d84e09D40dc416eCf713652", + vlPNP: "0x4405C0b330Db66dFFc40c8bcC616E447505AF0F8", + PNP: "0x7DEdBce5a2E31E4c75f87FeA60bF796C17718715", }, arbitrum: { masterPenpie: "0x0776C06907CE6Ff3d9Dbf84bA9B3422d7225942D", @@ -12,6 +14,8 @@ module.exports = { mPENDLE: "0xB688BA096b7Bb75d7841e47163Cd12D18B36A5bF", PENDLE: "0x0c880f6761F1af8d9Aa9C466984b80DAb9a8c9e8", pendleStaking: "0x6DB96BBEB081d2a85E0954C252f2c1dC108b3f81", + vlPNP: "0xc61d3c70cfc9dedaa090fdd0760eb9291253feff", + PNP: "0x2Ac2B254Bc18cD4999f64773a966E4f4869c34Ee", }, bsc: { masterPenpie: "0xb35b3d118c0394e750b4b59d2a2f9307393cd5db", @@ -19,6 +23,8 @@ module.exports = { mPENDLE: "0x0465aad9da170798433f4ab7fa7ec8b9b9bf0bb1", PENDLE: "0xb3Ed0A426155B79B898849803E3B36552f7ED507", pendleStaking: "0x782d9d67feaa4d1cdf8222d9053c8cba1c3b7982", + vlPNP: "0x9246583Cb1bBFE52003bbDE0D9b82DB50024c6B1", + PNP: "0x5012c90F14d190607662CA8344120812Aaa2639D", }, optimism: { masterPenpie: "0x3CbFC97f87f534b42bb58276B7b5dCaD29E57EAc", @@ -26,5 +32,7 @@ module.exports = { mPENDLE: "0xa3B615667CBd33cfc69843Bf11Fbb2A1D926BD46", PENDLE: "0xbc7b1ff1c6989f006a1185318ed4e7b5796e66e1", pendleStaking: "0x509FD25EE2AC7833a017f17Ee8A6Fb4aAf947876", + vlPNP: "0x0Af3EC6F9592C193196bEf220BC0Ce4D9311527D", + PNP: "0xC4a65A93dD6CD9717551ebE827E8baEe025d1d7E", }, }; diff --git a/projects/penpie/index.js b/projects/penpie/index.js index cb783d1deda..e396fa0c7c4 100644 --- a/projects/penpie/index.js +++ b/projects/penpie/index.js @@ -1,5 +1,6 @@ const MasterMagpieAbi = require("../magpiexyz/abis/masterMagpie.json"); const config = require("./config"); +const { staking } = require('../helper/staking') async function tvl(timestamp, block, chainBlocks, { api }) { const { masterPenpie, pendleStaking, vePENDLE, PENDLE, mPENDLE, } = config[api.chain]; @@ -20,8 +21,12 @@ async function tvl(timestamp, block, chainBlocks, { api }) { } Object.keys(config).forEach((chain) => { + const { PNP, vlPNP, } = config[chain]; + module.exports[chain] = { - doublecounted: true, - tvl: tvl, + tvl, }; + if (PNP && vlPNP) module.exports[chain].staking = staking(vlPNP, PNP) }); + +module.exports.doublecounted = true \ No newline at end of file From 0feba7ac20806f845b8b0f88407232a477fe01a9 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 29 Sep 2023 07:12:44 +0530 Subject: [PATCH 1385/1974] Arcanum (#7595) * Arcanum TVL adapter * code refactor --------- Co-authored-by: Artemiy Artamonov Co-authored-by: g1nt0ki --- projects/arcanum/index.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 projects/arcanum/index.js diff --git a/projects/arcanum/index.js b/projects/arcanum/index.js new file mode 100644 index 00000000000..fd519d04b18 --- /dev/null +++ b/projects/arcanum/index.js @@ -0,0 +1,18 @@ +const { sumTokensExport } = require('../helper/unwrapLPs') +const ARBI_CONTRACT = '0xfc2f1678f7c0d78c3911090c92b86bca7cc3a8b7'; +const ASSETS_CONTRACTS = [ + '0xfc5a1a6eb076a2c7ad06ed22c90d7e710e35ad0a', + '0x11cdb42b0eb46d95f990bedd4695a6e3fa034978', + '0x18c11fd286c5ec11c3b683caa813b77f5163a122', + '0xb64e280e9d1b5dbec4accedb2257a87b400db149', + '0x4e352cf164e64adcbad318c3a1e222e9eba4ce42', +]; + + +module.exports = { + methodology: 'counts the quantities of all tokens in multipool contracts.', + start: 1000235, + arbitrum: { + tvl: sumTokensExport({ owner: ARBI_CONTRACT, tokens: ASSETS_CONTRACTS}), + } +}; From e2d0d8df38cd368e8033986c34787f5480c01d4c Mon Sep 17 00:00:00 2001 From: ftm1337 <84405345+ftm1337@users.noreply.github.com> Date: Fri, 29 Sep 2023 01:46:17 +0000 Subject: [PATCH 1386/1974] Add Equalizer Scale (#7594) * Add Equalizer Scale * minor fix --------- Co-authored-by: g1nt0ki --- projects/Scale/index.js | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 projects/Scale/index.js diff --git a/projects/Scale/index.js b/projects/Scale/index.js new file mode 100644 index 00000000000..cdeb69eaf34 --- /dev/null +++ b/projects/Scale/index.js @@ -0,0 +1,10 @@ +const {uniTvlExport} = require('../helper/calculateUniTvl.js') +const { staking } = require('../helper/staking') + +module.exports = { + misrepresentedTokens: true, + base:{ + tvl: uniTvlExport("0xEd8db60aCc29e14bC867a497D94ca6e3CeB5eC04", "base", undefined, undefined, { hasStablePools: true, useDefaultCoreAssets: true, fetchBalances: true, }), + staking: staking("0x28c9c71c776a1203000b56c0cca48bef1cd51c53", "0x54016a4848a38f257b6e96331f7404073fd9c32c","base"), + }, +} From d9fad3e2bc1ed581e68e0fdad3c493f2b095f49a Mon Sep 17 00:00:00 2001 From: TJakubek <39831436+TJakubek@users.noreply.github.com> Date: Fri, 29 Sep 2023 04:48:06 +0300 Subject: [PATCH 1387/1974] enosys - HLN farms (#7593) --- projects/flarefarm/flare.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/projects/flarefarm/flare.js b/projects/flarefarm/flare.js index 21a1087a14a..e39f61ccea5 100644 --- a/projects/flarefarm/flare.js +++ b/projects/flarefarm/flare.js @@ -3,6 +3,7 @@ const { sumUnknownTokens } = require("../helper/unknownTokens"); const WFLR = ADDRESSES.flare.WFLR const APS = '0xfF56Eb5b1a7FAa972291117E5E9565dA29bc808d' +const HLN = '0x140D8d3649Ec605CF69018C627fB44cCC76eC89f' const chain = 'flare' @@ -13,6 +14,9 @@ async function farmTvl(timestamp, ethblock, { [chain]: block }) { ['0x7520005032F43229F606d3ACeae97045b9D6F7ea', "0x22beb4c7166DbAa0A33052A770C3b358cAbE9089"], ['0xef24D5155818d4bD16AF0Cea1148A147eb620743', "0x3DA590b357Cf17a413ec8db70FeB02119AfE707f"], ['0x02C6b5B1fbE01Da872E21f9Dab1B980933B0EF27', "0xd3a273329bab3e263015C1C2ab79C3731769a5b0"], + [HLN, "0x660cc88B7924a0c727cA6a1a9F0B81D239966928"], + ['0x87E0E33558c8e8EAE3c1E9EB276e05574190b48a', "0x2de4bC38f012DC90478f570083d3Da45B05659A9"], + ]; return sumUnknownTokens({ tokensAndOwners: tokens, chain, block, useDefaultCoreAssets: true, }) From 26cce9e38c16f061f6cdab29f8ae9f21bf5e33a7 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 29 Sep 2023 07:25:56 +0530 Subject: [PATCH 1388/1974] Gammaswap (#7596) * tvl for gammaswap * code refactor --------- Co-authored-by: Kalesberg Co-authored-by: g1nt0ki --- projects/gammaswap/index.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 projects/gammaswap/index.js diff --git a/projects/gammaswap/index.js b/projects/gammaswap/index.js new file mode 100644 index 00000000000..56a062109d3 --- /dev/null +++ b/projects/gammaswap/index.js @@ -0,0 +1,23 @@ +const { getLogs } = require('../helper/cache/getLogs') +const { sumTokens2 } = require('../helper/unwrapLPs') + +const config = { + arbitrum: { factory: '0xe048ccE443E787c5b6FA886236De2981D54E244f', fromBlock: 132429931 }, +} + +Object.keys(config).forEach(chain => { + const { factory, fromBlock } = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const logs = await getLogs({ + api, + target: factory, + eventAbi: 'event PoolCreated (address indexed pool, address indexed cfmm, uint16 indexed protocolId, address implementation, address[] tokens, uint256 count)', + onlyArgs: true, + fromBlock, + }) + const ownerTokens = logs.map(i => [[...i.tokens, i.cfmm], i.pool]) + return sumTokens2({ ownerTokens, api, resolveLP: true, }) + } + } +}) \ No newline at end of file From 712f634862d8cbdeef78a483150f90a18cad55b8 Mon Sep 17 00:00:00 2001 From: charq <73696209+buchaoqun@users.noreply.github.com> Date: Fri, 29 Sep 2023 12:07:56 +0800 Subject: [PATCH 1389/1974] separate from Solv Protocol V3 strategies (#7555) * add mantle network * update mantle network graphUrl * update solv-protocol-v3 to solv-protocol-funds add solv-protocol-rwa * update * del close-fund * fix block issue leading to reading data from cache --------- Co-authored-by: g1nt0ki --- .../abi.json | 0 .../index.js | 71 +++----------- projects/solv-protocol-rwa/abi.json | 8 ++ projects/solv-protocol-rwa/index.js | 95 +++++++++++++++++++ 4 files changed, 116 insertions(+), 58 deletions(-) rename projects/{solv-protocol-v3 => solv-protocol-funds}/abi.json (100%) rename projects/{solv-protocol-v3 => solv-protocol-funds}/index.js (55%) create mode 100644 projects/solv-protocol-rwa/abi.json create mode 100644 projects/solv-protocol-rwa/index.js diff --git a/projects/solv-protocol-v3/abi.json b/projects/solv-protocol-funds/abi.json similarity index 100% rename from projects/solv-protocol-v3/abi.json rename to projects/solv-protocol-funds/abi.json diff --git a/projects/solv-protocol-v3/index.js b/projects/solv-protocol-funds/index.js similarity index 55% rename from projects/solv-protocol-v3/index.js rename to projects/solv-protocol-funds/index.js index b4dfe5099a0..9dc06a6b798 100644 --- a/projects/solv-protocol-v3/index.js +++ b/projects/solv-protocol-funds/index.js @@ -10,47 +10,14 @@ const graphUrlList = { mantle: 'http://api.0xgraph.xyz/subgraphs/name/solv-payable-factory-mentle-0xgraph', } -const filterSlot = [ - "24463698369598535545979799361840946803505909684060624549876546521811809090281", - "35721610559268442584760110830641808857798079704888818123868248602816498531758", - "71384167217207433357665203528199852676074195415546219658272700694805764131696", - "94855382073997775269187449187472275689000980913702165029893305070390069014119" -]; - -async function tvl() { +const rwaSlot = [ + "77406646563329984090609229456139833989531434162860778120489803664660566620495" +] + +async function tvl(ts) { const { api } = arguments[3]; const network = api.chain; - const graphData = await getGraphData(api.timestamp, network, api); - if (graphData.slots.length > 0) { - const slots = graphData.slots; - const closeConcretes = await concrete(slots, api); - const closeTotalValues = await api.multiCall({ - abi: abi.slotTotalValue, - calls: slots.map((index) => ({ - target: closeConcretes[index.contractAddress], - params: [index.slot] - })), - }) - - const closeBaseInfos = await api.multiCall({ - abi: abi.slotBaseInfo, - calls: slots.map((index) => ({ - target: closeConcretes[index.contractAddress], - params: [index.slot] - })), - }) - - const closeDecimalList = await api.multiCall({ - abi: abi.decimals, - calls: closeBaseInfos.map(i => i[1]), - }) - - for (let i = 0; i < closeTotalValues.length; i++) { - const decimals = closeDecimalList[i]; - const balance = BigNumber(closeTotalValues[i]).div(BigNumber(10).pow(18 - decimals)).toNumber(); - api.add(closeBaseInfos[i][1], balance) - } - } + const graphData = await getGraphData(ts, network, api); if (graphData.pools.length > 0) { const pools = graphData.pools; @@ -59,7 +26,7 @@ async function tvl() { abi: abi.getSubscribeNav, calls: pools.map((index) => ({ target: index.navOracle, - params: [index.poolId, api.timestamp] + params: [index.poolId, ts] })), }) @@ -90,6 +57,7 @@ async function tvl() { api.add(poolBaseInfos[i][1], balance) } } + return api.getBalances() } async function concrete(slots, api) { @@ -117,12 +85,8 @@ async function concrete(slots, api) { async function getGraphData(timestamp, chain, api) { - const slotDataQuery = `query BondSlotInfos ($block: Int){ - bondSlotInfos(first: 1000, block: { number: $block } where:{maturity_gt:${timestamp}}) { - contractAddress - slot - } - poolOrderInfos(first: 1000, block: { number: $block } where:{fundraisingEndTime_gt:${timestamp}}) { + const slotDataQuery = `query BondSlotInfos { + poolOrderInfos(first: 1000 where:{fundraisingEndTime_gt:${timestamp}, openFundShareSlot_not_in: ${JSON.stringify(rwaSlot)}}) { marketContractAddress contractAddress navOracle @@ -130,27 +94,18 @@ async function getGraphData(timestamp, chain, api) { openFundShareSlot } }`; - const data = (await cachedGraphQuery(`solv-protocol/graph-data/${chain}`, graphUrlList[chain], slotDataQuery, { api, useBlock: true, })); + const data = (await cachedGraphQuery(`solv-protocol/funds-graph-data/${chain}`, graphUrlList[chain], slotDataQuery, { api, })); - let slotList = []; let poolList = []; - if (data != undefined && data.bondSlotInfos != undefined) { - for (let i = 0; i < data.bondSlotInfos.length; i++) { - const bondSlotInfo = data.bondSlotInfos[i]; - if (filterSlot.indexOf(bondSlotInfo.slot) == -1) { - slotList.push(bondSlotInfo) - } - } - } if (data != undefined && data.poolOrderInfos != undefined) { poolList = data.poolOrderInfos; } + return { - slots: slotList, pools: poolList }; } -// node test.js projects/solv-protocol-v3 +// node test.js projects/solv-protocol-funds ['ethereum', 'bsc', 'arbitrum', 'mantle'].forEach(chain => { module.exports[chain] = { tvl: () => ({}), borrowed: tvl, } }) \ No newline at end of file diff --git a/projects/solv-protocol-rwa/abi.json b/projects/solv-protocol-rwa/abi.json new file mode 100644 index 00000000000..c2ad7222359 --- /dev/null +++ b/projects/solv-protocol-rwa/abi.json @@ -0,0 +1,8 @@ +{ + "concrete": "address:concrete", + "slotTotalValue": "function slotTotalValue(uint256 slot_) view returns (uint256)", + "slotBaseInfo": "function slotBaseInfo(uint256 slot_) view returns (tuple(address issuer, address currency, uint64 valueDate, uint64 maturity, uint64 createTime, bool transferable, bool isValid))", + "decimals": "uint8:decimals", + "balanceOf": "function balanceOf(address _owner) view returns (uint256 balance)", + "getSubscribeNav": "function getSubscribeNav(bytes32 poolId_, uint256 time_) view returns (uint256 nav_, uint256 navTime_)" +} \ No newline at end of file diff --git a/projects/solv-protocol-rwa/index.js b/projects/solv-protocol-rwa/index.js new file mode 100644 index 00000000000..cbbc865040c --- /dev/null +++ b/projects/solv-protocol-rwa/index.js @@ -0,0 +1,95 @@ +const { default: BigNumber } = require("bignumber.js"); +const abi = require("./abi.json"); +const { cachedGraphQuery } = require("../helper/cache"); + +// The Graph +const graphUrlList = { + mantle: 'http://api.0xgraph.xyz/subgraphs/name/solv-payable-factory-mentle-0xgraph', +} + +const rwaSlot = [ + "77406646563329984090609229456139833989531434162860778120489803664660566620495" +] + +async function tvl(ts, _, _1, { api }) { + const network = api.chain; + const pools = await getGraphData(ts, network, api); + if (pools == undefined || pools.length === 0) return {} + const poolConcretes = await concrete(pools, api); + const nav = await api.multiCall({ + abi: abi.getSubscribeNav, + calls: pools.map((index) => ({ + target: index.navOracle, + params: [index.poolId, ts] + })), + }) + + const poolTotalValues = await api.multiCall({ + abi: abi.slotTotalValue, + calls: pools.map((index) => ({ + target: poolConcretes[index.contractAddress], + params: [index.openFundShareSlot] + })), + }) + + const poolBaseInfos = await api.multiCall({ + abi: abi.slotBaseInfo, + calls: pools.map((index) => ({ + target: poolConcretes[index.contractAddress], + params: [index.openFundShareSlot] + })), + }) + + const poolDecimalList = await api.multiCall({ + abi: abi.decimals, + calls: poolBaseInfos.map(i => i[1]), + }) + + for (let i = 0; i < poolTotalValues.length; i++) { + const decimals = poolDecimalList[i]; + const balance = BigNumber(poolTotalValues[i]).div(BigNumber(10).pow(18 - decimals)).times(BigNumber(nav[i].nav_).div(BigNumber(10).pow(decimals))).toNumber(); + api.add(poolBaseInfos[i][1], balance) + } + return api.getBalances() +} + +async function concrete(slots, api) { + var slotsList = []; + var only = {}; + for (var i = 0; i < slots.length; i++) { + if (!only[slots[i].contractAddress]) { + slotsList.push(slots[i]); + only[slots[i].contractAddress] = true; + } + } + + const concreteLists = await api.multiCall({ + calls: slotsList.map((index) => index.contractAddress), + abi: abi.concrete, + }) + + let concretes = {}; + for (var k = 0; k < concreteLists.length; k++) { + concretes[slotsList[k].contractAddress] = concreteLists[k]; + } + + return concretes; +} + +async function getGraphData(timestamp, chain, api) { + const slotDataQuery = `query BondSlotInfos { + poolOrderInfos(first: 1000, where:{fundraisingEndTime_gt:${timestamp}, openFundShareSlot_in:${JSON.stringify(rwaSlot)}}) { + marketContractAddress + contractAddress + navOracle + poolId + openFundShareSlot + } + }`; + const data = (await cachedGraphQuery(`solv-protocol/rwa-graph-data/${chain}`, graphUrlList[chain], slotDataQuery, { api, })); + return data.poolOrderInfos; +} +// node test.js projects/solv-protocol-rwa +['mantle'].forEach(chain => { + module.exports[chain] = { tvl } +}) \ No newline at end of file From f914caa6c3acab0ac89c78841bde123446642c9f Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Fri, 29 Sep 2023 05:48:41 +0100 Subject: [PATCH 1390/1974] update factory address --- projects/apertureSwap/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/apertureSwap/index.js b/projects/apertureSwap/index.js index b4a13c5c66e..6f1da7d09f7 100644 --- a/projects/apertureSwap/index.js +++ b/projects/apertureSwap/index.js @@ -1,5 +1,5 @@ const { uniV3Export } = require("../helper/uniswapV3"); module.exports = uniV3Export({ - manta: { factory: "0x4Eee19e0856D23fAc3D0bDD867bEb4E1B8c78344", fromBlock: 48723, }, + manta: { factory: "0x5bd1F6735B80e58aAC88B8A94836854d3068a13a", fromBlock: 41427, }, }); \ No newline at end of file From c5d87ffbe62c4ebb2e49e645c2477caffe61bb3f Mon Sep 17 00:00:00 2001 From: gnarlycow Date: Thu, 28 Sep 2023 21:50:51 -0700 Subject: [PATCH 1391/1974] Fix ApertureSwap factory address. (#7597) From 14980ef967530d0f1b8f18d3e46df96edc547f6a Mon Sep 17 00:00:00 2001 From: Antoine Bellanger Date: Fri, 29 Sep 2023 10:08:42 +0200 Subject: [PATCH 1392/1974] Add new Solana wallet --- projects/swissborg/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/swissborg/index.js b/projects/swissborg/index.js index ef08a9119ee..1e258da97e1 100644 --- a/projects/swissborg/index.js +++ b/projects/swissborg/index.js @@ -44,6 +44,7 @@ const config = { '2E1UKoiiZPwsp4vn6tUh5k61kG2UqYpT7oBrFaJUJXXd', '2XxP4kS2vfkiMvpLpGNxry3fPUYimsuAmSbqL1KnuwZ8', 'Cet3t77x2BBVSmiEFm8ZPoDSngbpso2RuWPL79Ky7SpA', + '9qoUcyhKSWMbk6tqGUYQUpeosPcdUnJszG4eQKwfe4gL', ], }, polkadot: { From 60e0c4d198ced04e2e6c147ba5689632a14b102a Mon Sep 17 00:00:00 2001 From: define Date: Fri, 29 Sep 2023 11:00:28 +0100 Subject: [PATCH 1393/1974] add more exchanges --- projects/bitmark/index.js | 12 ++++++++++++ projects/btse/index.js | 9 +++++++++ projects/klever-exchange/index.js | 30 ++++++++++++++++++++++++++++++ 3 files changed, 51 insertions(+) create mode 100644 projects/bitmark/index.js create mode 100644 projects/btse/index.js create mode 100644 projects/klever-exchange/index.js diff --git a/projects/bitmark/index.js b/projects/bitmark/index.js new file mode 100644 index 00000000000..16d4885a90c --- /dev/null +++ b/projects/bitmark/index.js @@ -0,0 +1,12 @@ +const { cexExports } = require('../helper/cex') + +const config = { + ethereum: { + owners: ['0x328130164d0f2b9d7a52edc73b3632e713ff0ec6', + '0xeacb50a28630a4c44a884158ee85cbc10d2b3f10', + '0x3ab28ecedea6cdb6feed398e93ae8c7b316b1182', + '0x7563758243a262e96880f178aee7817dcf47ab0f'] + }, +} + +module.exports = cexExports(config) diff --git a/projects/btse/index.js b/projects/btse/index.js new file mode 100644 index 00000000000..08ded778d94 --- /dev/null +++ b/projects/btse/index.js @@ -0,0 +1,9 @@ +const { cexExports } = require('../helper/cex') + +const config = { + bitcoin: { + owners: ['bc1qaxyju6n2x2tednv8e7hgnhnz44vrfcmuhjxpfk'] + }, +} + +module.exports = cexExports(config) diff --git a/projects/klever-exchange/index.js b/projects/klever-exchange/index.js new file mode 100644 index 00000000000..75626130cf1 --- /dev/null +++ b/projects/klever-exchange/index.js @@ -0,0 +1,30 @@ +const { cexExports } = require('../helper/cex') + +const config = { + ethereum: { + owners: [ + '0x5a57cfafe8b9e94419cc7d0cb1f4a95c73f40110', + '0x4a5f98e2c2784d359fc0decc8533ae27af0e5974', + '0x5af8da2675dd31beffa2619145957b15e8013f37', + '0x91af50adb57283283c8b442622e95c26d46d911c', + '0x96c38eeed002d3df2e369deffe6cc84688eadb01' + ] + }, + tron: { + owners: [ + 'TKM9AYxWxRe7hESuWmKFXwcDjnb5cQK92E', + 'TMp2qThJSRZbmvFQwuRjyoL8ygykqMZDEo', + 'TPYcvyecPr5TAXRUSjKu2iNJuG6dNHxri3' + ] + }, + bitcoin: { + owners: [ + 'bc1qze8pn5vywzk8enqdr9ve28lyas23kurzd37027', + 'bc1qgy5zyuvsw5wnt5lrx3m62tt2pmdl69avd5vw6n', + 'bc1qk4l4u3lh7rrufsw0z6vmkln5kesf0a9q0srnkr' + ] + }, + +} + +module.exports = cexExports(config) From 10289de8718729370a2dddcd7d20d8898e3a461a Mon Sep 17 00:00:00 2001 From: nemo Date: Fri, 29 Sep 2023 19:16:10 +0800 Subject: [PATCH 1394/1974] sumbit project DigiFT- RWA DEX (#7567) * sumbit project DigiFT- RWA DEX * code refactor --------- Co-authored-by: Fisher Fu Co-authored-by: g1nt0ki --- projects/DigiFT/index.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 projects/DigiFT/index.js diff --git a/projects/DigiFT/index.js b/projects/DigiFT/index.js new file mode 100644 index 00000000000..ea8b17b6af5 --- /dev/null +++ b/projects/DigiFT/index.js @@ -0,0 +1,24 @@ +const sdk = require('@defillama/sdk'); +//Polygon FeedPrice contract address +const DFeedPriceAddress = "0x7d4d68f18d1be3410ab8d827fb7ebc690f938d2d" +const tokenListAbi = "function getAllTokenRecords() view returns (tuple(uint256 chainId, address tokenAddress, uint64 tokenType)[])" + +async function getTokenList(tokenAPI, chainId) { + return (await tokenAPI.call({ + target: DFeedPriceAddress, + abi: tokenListAbi + })).filter(item => item[0] == chainId && item[2] == '1').map(item => item[1]); +} + +module.exports = { + ethereum: { + tvl: async (...args) => { + const tokenAPI = new sdk.ChainApi({ chain: 'polygon' }); + const { api } = args[3]; + const tokens = await getTokenList(tokenAPI, api.chainId) + const tokenSupplies = await api.multiCall({ abi: 'uint256:totalSupply', calls: tokens}) + api.addTokens(tokens, tokenSupplies) + return api.getBalances() + } + } +}; From e24b63c297d2667723faa18f6d740ebaa7a3e9aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20K=C3=B6nekamp?= <55452146+thekoenekamp@users.noreply.github.com> Date: Fri, 29 Sep 2023 14:36:20 +0200 Subject: [PATCH 1395/1974] add STG staking contracts + linea chain (#7600) * add STG staking contracts + linea chain * Update index.js * bugfix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Co-authored-by: llama --- projects/stargatefinance/index.js | 68 +++++++++++++++++++++---------- 1 file changed, 46 insertions(+), 22 deletions(-) diff --git a/projects/stargatefinance/index.js b/projects/stargatefinance/index.js index 0264866d898..4add1243d8c 100644 --- a/projects/stargatefinance/index.js +++ b/projects/stargatefinance/index.js @@ -1,17 +1,24 @@ const ADDRESSES = require('../helper/coreAssets.json') -const abi = require("./abi.json") -const { nullAddress, sumTokens2, } = require('../helper/unwrapLPs') +const abi = require('./abi.json') +const { nullAddress, sumTokens2 } = require('../helper/unwrapLPs') +const { staking } = require('../helper/staking') const CONFIG = { ethereum: { router: '0x8731d54E9D02c286767d56ac03e8037C07e01e98', etherToken: '0x72E2F4830b9E45d52F80aC08CB2bEC0FeF72eD9c', + stakingContract: '0xB0D502E938ed5f4df2E681fE6E419ff29631d62b', + stg: '0xAf5191B0De278C7286d6C7CC6ab6BB8A73bA2Cd6', }, bsc: { router: '0x4a364f8c717cAAD9A442737Eb7b8A55cc6cf18D8', + stakingContract: '0x3052A0F6ab15b4AE1df39962d5DdEFacA86DaB47', + stg: '0xB0D502E938ed5f4df2E681fE6E419ff29631d62b', }, polygon: { router: '0x45A01E4e04F14f7A4a6702c74187c5F6222033cd', + stakingContract: '0x8731d54E9D02c286767d56ac03e8037C07e01e98', + stg: '0x2F6F07CDcf3588944Bf4C42aC74ff24bF56e7590', }, arbitrum: { router: '0x53Bf833A5d6c4ddA888F69c22C88C9f356a41614', @@ -23,47 +30,64 @@ const CONFIG = { }, fantom: { router: '0xAf5191B0De278C7286d6C7CC6ab6BB8A73bA2Cd6', + stakingContract: '0x224D8Fd7aB6AD4c6eb4611Ce56EF35Dec2277F03', + stg: '0x2F6F07CDcf3588944Bf4C42aC74ff24bF56e7590', }, - avax:{ + avax: { router: '0x45A01E4e04F14f7A4a6702c74187c5F6222033cd', + stakingContract: '0x8731d54E9D02c286767d56ac03e8037C07e01e98', + stg: '0x2F6F07CDcf3588944Bf4C42aC74ff24bF56e7590', }, - metis:{ + metis: { router: '0x2F6F07CDcf3588944Bf4C42aC74ff24bF56e7590', }, - base:{ + base: { router: '0x45f1A95A4D3f3836523F5c83673c797f4d4d263B', etherToken: '0x224d8fd7ab6ad4c6eb4611ce56ef35dec2277f03', + stakingContract: '0x06Eb48763f117c7Be887296CDcdfad2E4092739C', + stg: '0xE3B53AF74a4BF62Ae5511055290838050bf764Df', }, - kava:{ + linea: { + router: '0x2F6F07CDcf3588944Bf4C42aC74ff24bF56e7590', + etherToken: '0x224d8fd7ab6ad4c6eb4611ce56ef35dec2277f03', + stakingContract: '0x4a364f8c717cAAD9A442737Eb7b8A55cc6cf18D8', + stg: '0x808d7c71ad2ba3FA531b068a2417C63106BC0949', + }, + kava: { router: '0x2F6F07CDcf3588944Bf4C42aC74ff24bF56e7590', }, } module.exports = { - goerli:{ - tvl: async (_, _b, _cb, { api, })=>{ + goerli: { + tvl: async (_, _b, _cb, { api }) => { return { - [ADDRESSES.ethereum.WETH]: await api.call({ abi: 'erc20:balanceOf', target: "0xdD69DB25F6D620A7baD3023c5d32761D353D3De9", params:["0x88124ef4a9ec47e691f254f2e8e348fd1e341e9b"] }) + [ADDRESSES.ethereum.WETH]: await api.call({ abi: 'erc20:balanceOf', target: '0xdD69DB25F6D620A7baD3023c5d32761D353D3De9', params: ['0x88124ef4a9ec47e691f254f2e8e348fd1e341e9b'], }), } - } - } -}; + }, + }, +} + +Object.keys(CONFIG).forEach((chain) => { + let { router, etherToken = '', stakingContract, stg } = CONFIG[chain] + etherToken = etherToken ? etherToken.toLowerCase() : '' + -Object.keys(CONFIG).forEach(chain => { - let { router, etherToken = '', } = CONFIG[chain] - etherToken = etherToken.toLowerCase() module.exports[chain] = { - tvl: async (_, _b, _cb, { api, }) => { - const factory = await api.call({ abi: abi.factory, target: router }) - const pools = await api.fetchList({ lengthAbi: abi.allPoolsLength, itemAbi: abi.allPools, target: factory}) - const tokens = await api.multiCall({ abi: abi.token, calls: pools}) + tvl: async (_, _b, _cb, { api }) => { + const factory = await api.call({ abi: abi.factory, target: router }) + const pools = await api.fetchList({ lengthAbi: abi.allPoolsLength, itemAbi: abi.allPools, target: factory, }) + const tokens = await api.multiCall({ abi: abi.token, calls: pools }) const toa = [] tokens.forEach((t, i) => { t = t.toLowerCase() if (t === etherToken) toa.push([nullAddress, t]) else toa.push([t, pools[i]]) - }) + }) return sumTokens2({ api, tokensAndOwners: toa }) - } + }, } -}) \ No newline at end of file + + if (stakingContract && stg) + module.exports[chain].staking = staking(stakingContract, stg) +}) From 91e2f2c117dd99e61e5ff96df08896b3f986ee04 Mon Sep 17 00:00:00 2001 From: llama Date: Fri, 29 Sep 2023 16:27:09 +0200 Subject: [PATCH 1396/1974] fix broken adapters --- projects/helper/chain/cosmos.js | 2 +- projects/steer/index.js | 156 ++++++++++++++++---------------- projects/uniswap/index.js | 13 +-- 3 files changed, 78 insertions(+), 93 deletions(-) diff --git a/projects/helper/chain/cosmos.js b/projects/helper/chain/cosmos.js index 16a8b1ac03b..10f6f827cf2 100644 --- a/projects/helper/chain/cosmos.js +++ b/projects/helper/chain/cosmos.js @@ -22,7 +22,7 @@ const endPoints = { juno: "https://lcd-juno.cosmostation.io", cronos: "https://lcd-crypto-org.cosmostation.io", chihuahua: "https://rest.cosmos.directory/chihuahua", - stargaze: "https://api-stargaze.ezstaking.dev", + stargaze: "https://rest.stargaze-apis.com", quicksilver: "https://rest.cosmos.directory/quicksilver", persistence: "https://rest.cosmos.directory/persistence", secret: "https://lcd.secret.express", diff --git a/projects/steer/index.js b/projects/steer/index.js index 616dcec8ac3..a3c8efb2cbb 100644 --- a/projects/steer/index.js +++ b/projects/steer/index.js @@ -1,62 +1,62 @@ -const { GraphQLClient } = require("graphql-request"); +const { cachedGraphQuery } = require('../helper/cache') const supportedChains = [ - { - name: 'Polygon', - subgraphEndpoint: 'https://api.thegraph.com/subgraphs/name/steerprotocol/steer-protocol-polygon', - chainId: 137, - merkl: true, - identifier: 'polygon' - }, - { - name: 'Arbitrum', - subgraphEndpoint: 'https://api.thegraph.com/subgraphs/name/steerprotocol/steer-protocol-arbitrum', - chainId: 42161, - merkl: true, - identifier: 'arbitrum' - }, - { - name: 'Optimism', - subgraphEndpoint: 'https://api.thegraph.com/subgraphs/name/steerprotocol/steer-protocol-optimism', - chainId: 10, - merkl: true, - identifier: 'optimism' - }, - { - name: 'Binance', - subgraphEndpoint: 'https://api.thegraph.com/subgraphs/name/steerprotocol/steer-protocol-bsc', - chainId: 56, - merkl: false, - identifier: 'bsc' - }, - { - name: 'Evmos', - subgraphEndpoint: 'https://subgraph.satsuma-prod.com/769a117cc018/steer/steer-protocol-evmos/api', - chainId: 9001, - merkl: false, - identifier: 'evmos' - }, - { - name: 'Avalanche', - subgraphEndpoint: 'https://api.thegraph.com/subgraphs/name/rakeshbhatt10/avalance-test-subgraph', - chainId: 43114, - merkl: false, - identifier: 'avax' - }, - { - name: 'Thundercore', - subgraphEndpoint: 'http://52.77.49.1:8000/subgraphs/name/steerprotocol/steer-thundercore', - chainId: 108, - merkl: false, - identifier: 'thundercore' - }, - { - name: 'Kava', - subgraphEndpoint: 'https://subgraph.steer.finance/kava/subgraphs/name/steerprotocol/steer-kava-evm', - chainId: 2222, - merkle: false, - identifier: 'kava' - } + { + name: 'Polygon', + subgraphEndpoint: 'https://api.thegraph.com/subgraphs/name/steerprotocol/steer-protocol-polygon', + chainId: 137, + merkl: true, + identifier: 'polygon' + }, + { + name: 'Arbitrum', + subgraphEndpoint: 'https://api.thegraph.com/subgraphs/name/steerprotocol/steer-protocol-arbitrum', + chainId: 42161, + merkl: true, + identifier: 'arbitrum' + }, + { + name: 'Optimism', + subgraphEndpoint: 'https://api.thegraph.com/subgraphs/name/steerprotocol/steer-protocol-optimism', + chainId: 10, + merkl: true, + identifier: 'optimism' + }, + { + name: 'Binance', + subgraphEndpoint: 'https://api.thegraph.com/subgraphs/name/steerprotocol/steer-protocol-bsc', + chainId: 56, + merkl: false, + identifier: 'bsc' + }, + { + name: 'Evmos', + subgraphEndpoint: 'https://subgraph.satsuma-prod.com/769a117cc018/steer/steer-protocol-evmos/api', + chainId: 9001, + merkl: false, + identifier: 'evmos' + }, + { + name: 'Avalanche', + subgraphEndpoint: 'https://api.thegraph.com/subgraphs/name/rakeshbhatt10/avalance-test-subgraph', + chainId: 43114, + merkl: false, + identifier: 'avax' + }, + { + name: 'Thundercore', + subgraphEndpoint: 'http://52.77.49.1:8000/subgraphs/name/steerprotocol/steer-thundercore', + chainId: 108, + merkl: false, + identifier: 'thundercore' + }, + { + name: 'Kava', + subgraphEndpoint: 'https://subgraph.steer.finance/kava/subgraphs/name/steerprotocol/steer-kava-evm', + chainId: 2222, + merkle: false, + identifier: 'kava' + } ] @@ -67,28 +67,24 @@ const query = ` id } }` - -module.exports = {}; - + supportedChains.forEach(chain => { -module.exports[chain.identifier] = { - tvl: async (_, _b, _cb, { api, }) => { - const graphQLClient = new GraphQLClient(chain.subgraphEndpoint); - const data = await graphQLClient.request(query); - - const vaults = data.vaults.map((vault) => vault.id) - const bals = await api.multiCall({ abi: "function getTotalAmounts() view returns (uint256 total0, uint256 total1)", calls: vaults, permitFailure: true, }) - const token0s = await api.multiCall({ abi: "address:token0", calls: vaults, permitFailure: true, }) - const token1s = await api.multiCall({ abi: "address:token1", calls: vaults, permitFailure: true, }) - bals.forEach((bal, i) => { - const token0 = token0s[i] - const token1 = token1s[i] - if (!bal || !token0 || !token1) return // skip failures - api.add(token0, bal.total0) - api.add(token1, bal.total1) - }) - return api.getBalances() - } -} -}) + module.exports[chain.identifier] = { + tvl: async (_, _b, _cb, { api, }) => { + const data = await cachedGraphQuery('steer/' + chain.identifier, chain.subgraphEndpoint, query,) + const vaults = data.vaults.map((vault) => vault.id) + const bals = await api.multiCall({ abi: "function getTotalAmounts() view returns (uint256 total0, uint256 total1)", calls: vaults, permitFailure: true, }) + const token0s = await api.multiCall({ abi: "address:token0", calls: vaults, permitFailure: true, }) + const token1s = await api.multiCall({ abi: "address:token1", calls: vaults, permitFailure: true, }) + bals.forEach((bal, i) => { + const token0 = token0s[i] + const token1 = token1s[i] + if (!bal || !token0 || !token1) return // skip failures + api.add(token0, bal.total0) + api.add(token1, bal.total1) + }) + return api.getBalances() + } + } +}) \ No newline at end of file diff --git a/projects/uniswap/index.js b/projects/uniswap/index.js index 841523a5c0c..2452c40e29f 100644 --- a/projects/uniswap/index.js +++ b/projects/uniswap/index.js @@ -32,17 +32,6 @@ function v3TvlPaged(chain) { } ` - if (chain === 'celo') // we dont care about block - graphQueryPaged = ` - query poolQuery($lastId: String) { - pools(first:1000 where: {id_gt: $lastId totalValueLockedUSD_gt: 100}) { - id - token0 { id } - token1 { id } - } - } - ` - const pools = await cachedGraphQuery('uniswap-v3/' + api.chain, graphs[chain], graphQueryPaged, { variables: { block: block - 500 }, fetchById: true }) const blacklisted = blacklists[chain] || [] @@ -67,7 +56,7 @@ module.exports = { ...uniV3Export({ base: { factory: '0x33128a8fc17869897dce68ed026d694621f6fdfd', fromBlock: 1371680, }, celo: { factory: '0xAfE208a311B21f13EF87E33A90049fC17A7acDEc', fromBlock: 13916355, }, - moonbeam: { factory: '0x28f1158795a3585caaa3cd6469cd65382b89bb70', fromBlock: 3340452 } + moonbeam: { factory: '0x28f1158795a3585caaa3cd6469cd65382b89bb70', fromBlock: 4313505 } }) } From a399056ffc0d9e908f3b84e409c8b55153d56885 Mon Sep 17 00:00:00 2001 From: llama Date: Fri, 29 Sep 2023 17:22:46 +0200 Subject: [PATCH 1397/1974] fix broken adapters --- projects/boneriumtech/index.js | 8 ++--- projects/ecodefi/index.js | 64 +++------------------------------ projects/helper/chain/cosmos.js | 6 ++-- projects/sifchain.js | 2 +- 4 files changed, 12 insertions(+), 68 deletions(-) diff --git a/projects/boneriumtech/index.js b/projects/boneriumtech/index.js index 7523e99128f..ce4a6360802 100644 --- a/projects/boneriumtech/index.js +++ b/projects/boneriumtech/index.js @@ -1,7 +1,7 @@ -const { getUniTVL } = require('../helper/unknownTokens') - module.exports = { bone: { - tvl: getUniTVL({ factory: '0x9e98c46825da5f6622eBFA0bc8d278c61b763802', useDefaultCoreAssets: true, }) - } + // tvl: getUniTVL({ factory: '0x9e98c46825da5f6622eBFA0bc8d278c61b763802', useDefaultCoreAssets: true, }) + tvl: () => ({}), + }, + // deadFrom: "2023-09-10", } \ No newline at end of file diff --git a/projects/ecodefi/index.js b/projects/ecodefi/index.js index 8d4487abc80..90170d58142 100644 --- a/projects/ecodefi/index.js +++ b/projects/ecodefi/index.js @@ -1,67 +1,11 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const sdk = require('@defillama/sdk'); -const BigNumber = require('bignumber.js'); -const stakingAbi = require('./stakingAbi.json'); -const babyRouterAbi = require('./babyRouterAbi.json'); -const { toUSDTBalances } = require('../helper/balances'); -const { compoundExports } = require('../helper/compound'); -const BASE = BigNumber(10 ** 18); -const Double = BASE * BASE; - -let EsgStaking = { - "bsc": "0x55839fe60742c7789DaBcA85Fd693f1cAbaeDd69", // ESG staking contract -} - -let EsgToken = { - "bsc": "0x0985205D53D575CB07Dd4Fba216034dc614eab55", // ESG Token -} - -let BabySwapRouter = { - "bsc": "0x325E343f1dE602396E256B67eFd1F61C3A6B38Bd", // Router -} - -let USDT = { - "bsc": ADDRESSES.bsc.USDT, // USDT in BSC -} -/*================================================== - TVL - ==================================================*/ - -async function getESGStakingValue(chain, block) { - const { output: totalStaked } = await sdk.api.abi.call({ - block, - target: EsgStaking[chain], - abi: stakingAbi['total_deposited'], - chain: chain - }); - - const { output: esgPrice } = await sdk.api.abi.call({ - block, - target: BabySwapRouter[chain], - abi: babyRouterAbi['getAmountsOut'], - params: [BASE.toString(), [EsgToken[chain], USDT[chain]]], - chain: chain - }); - - let stakedValue = BigNumber(totalStaked.toString()).times(BigNumber(esgPrice[1].toString())).div(Double); - - return stakedValue; -} - - - -async function staking(timestamp, ethBlock, chainBlocks) { - let staked = await getESGStakingValue('bsc', chainBlocks['bsc']); - return toUSDTBalances(staked); -} +const { staking } = require('../helper/staking') +const { compoundExports2 } = require('../helper/compound') module.exports = { - timetravel: true, - misrepresentedTokens: false, methodology: 'counts the number of Total value locked in ESG protocol.', bsc: { - ...compoundExports('0xfd1f241ba25b8966a14865cb22a4ea3d24c92451', 'bsc'), - staking, + ...compoundExports2({ comptroller: '0xfd1f241ba25b8966a14865cb22a4ea3d24c92451'}), + staking: staking('0x55839fe60742c7789DaBcA85Fd693f1cAbaeDd69', '0x0985205D53D575CB07Dd4Fba216034dc614eab55'), }, start: 15307794, // Feb-16-2022 01:49:31 PM +UTC } diff --git a/projects/helper/chain/cosmos.js b/projects/helper/chain/cosmos.js index 10f6f827cf2..dba6b972186 100644 --- a/projects/helper/chain/cosmos.js +++ b/projects/helper/chain/cosmos.js @@ -15,7 +15,7 @@ const endPoints = { cosmos: "https://cosmoshub-lcd.stakely.io", kujira: "https://kuji-api.kleomedes.network", comdex: "https://rest.comdex.one", - terra: "https://rest.cosmos.directory/terra", + terra: "https://terra-classic-lcd.publicnode.com", terra2: "https://terra-lcd.publicnode.com", umee: "https://umee-api.polkachu.com", orai: "https://lcd.orai.io", @@ -126,8 +126,8 @@ async function getDenomBalance({ denom, owner, block, chain } = {}) { if (block !== undefined) { endpoint += `?height=${block - (block % 100)}`; } - const data = (await axios.get(endpoint)).data.result; - + let { data } = await axios.get(endpoint) + data = chain === 'terra' ? data.balances : data.result const balance = data.find((balance) => balance.denom === denom); return balance ? Number(balance.amount) : 0; } diff --git a/projects/sifchain.js b/projects/sifchain.js index 8676406083f..f915b4c8e95 100644 --- a/projects/sifchain.js +++ b/projects/sifchain.js @@ -2,7 +2,7 @@ const { get } = require('./helper/http') async function tvl() { // const getPoolsRes = await get('https://api.sifchain.finance/clp/getPools') - const getPoolsRes = await get('https://lcd-sifchain.cosmostation.io/clp/getPools') + const getPoolsRes = await get('https://sifchain-api.polkachu.com/clp/getPools') const total = getPoolsRes.result.pools .map(pool => +pool.native_asset_balance) From a06eba11b80959043aad2528493b71cff585a95b Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Fri, 29 Sep 2023 21:32:07 +0100 Subject: [PATCH 1398/1974] add algebra v2 --- projects/algebra-v2/index.js | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 projects/algebra-v2/index.js diff --git a/projects/algebra-v2/index.js b/projects/algebra-v2/index.js new file mode 100644 index 00000000000..8c5672a865d --- /dev/null +++ b/projects/algebra-v2/index.js @@ -0,0 +1,31 @@ +const { getLogs } = require('../helper/cache/getLogs') +const { sumTokens2 } = require('../helper/unwrapLPs') + +const FACTORY = '0xa2A92Bb449CCa49b810C84c0efC36a88431655f2'; + +const startBlocks = { + avax: 31662680 +} + +function chainTvl(chain) { + return async (timestamp, ethBlock, chainBlocks, { api }) => { + const START_BLOCK = startBlocks[chain] + const logs = await getLogs({ + api, + target: FACTORY, + fromBlock: START_BLOCK, + topic: 'Pool(address,address,address)', + eventAbi: 'event Pool(address indexed token0, address indexed token1, address pool)', + onlyArgs: true, + }) + const toa = [] + logs.forEach(({ token0, token1, pool}) => toa.push([token0, pool], [token1, pool])) + return sumTokens2({ api, tokensAndOwners: toa }) + } +} + +module.exports = { + avax: { + tvl: chainTvl('avax'), + } +} \ No newline at end of file From 94e592f6f9abd3b5a6bea5881527759b154e702f Mon Sep 17 00:00:00 2001 From: define Date: Sat, 30 Sep 2023 12:56:31 +0100 Subject: [PATCH 1399/1974] chaingpt --- projects/chaingpt/index.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 projects/chaingpt/index.js diff --git a/projects/chaingpt/index.js b/projects/chaingpt/index.js new file mode 100644 index 00000000000..57aa718c0e8 --- /dev/null +++ b/projects/chaingpt/index.js @@ -0,0 +1,17 @@ +const { pool2s } = require("../helper/pool2"); +const { stakings } = require("../helper/staking"); + +const cgpt = "0x9840652DC04fb9db2C43853633f0F62BE6f00f98"; +const stakingpool1 = "0x765a6ee976137801F2661c3644E1fde369A8ED18"; +const stakingpool2 = "0x62A402DEf6Ca37E9CA7a544bE34954748088CCEE"; +const mcLPPool = "0x44c01e5e4216f3162538914d9c7f5E6A0d87820e"; +const mcLPPoolV2 = "0xebE3CA21e37723E0bE0F519724798fe8EEfF83D1"; +const mcWETHUNILP = "0xcCb63225a7B19dcF66717e4d40C9A72B39331d61"; + +module.exports = { + bsc: { + tvl: async () => ({}), + // pool2: pool2s([mcLPPool, mcLPPoolV2], [mcWETHUNILP]), + staking: stakings([stakingpool1, stakingpool2], cgpt), + }, +}; \ No newline at end of file From 16a70c8221db6fe2ca4dc900282a82a2e70464b0 Mon Sep 17 00:00:00 2001 From: define Date: Sat, 30 Sep 2023 12:57:41 +0100 Subject: [PATCH 1400/1974] remove --- projects/chaingpt/index.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/projects/chaingpt/index.js b/projects/chaingpt/index.js index 57aa718c0e8..aabb36851e8 100644 --- a/projects/chaingpt/index.js +++ b/projects/chaingpt/index.js @@ -4,14 +4,11 @@ const { stakings } = require("../helper/staking"); const cgpt = "0x9840652DC04fb9db2C43853633f0F62BE6f00f98"; const stakingpool1 = "0x765a6ee976137801F2661c3644E1fde369A8ED18"; const stakingpool2 = "0x62A402DEf6Ca37E9CA7a544bE34954748088CCEE"; -const mcLPPool = "0x44c01e5e4216f3162538914d9c7f5E6A0d87820e"; -const mcLPPoolV2 = "0xebE3CA21e37723E0bE0F519724798fe8EEfF83D1"; -const mcWETHUNILP = "0xcCb63225a7B19dcF66717e4d40C9A72B39331d61"; + module.exports = { bsc: { tvl: async () => ({}), - // pool2: pool2s([mcLPPool, mcLPPoolV2], [mcWETHUNILP]), staking: stakings([stakingpool1, stakingpool2], cgpt), }, }; \ No newline at end of file From c663b0f72a44dce22aee718ebacc29c6b7eb30a5 Mon Sep 17 00:00:00 2001 From: define Date: Sat, 30 Sep 2023 13:01:38 +0100 Subject: [PATCH 1401/1974] icecreamswap --- projects/icecreamswap/index.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/projects/icecreamswap/index.js b/projects/icecreamswap/index.js index 17f13c17f26..8300ab89e94 100644 --- a/projects/icecreamswap/index.js +++ b/projects/icecreamswap/index.js @@ -38,4 +38,16 @@ module.exports = { useDefaultCoreAssets: true, }) }, + shimmer_evm: { + tvl: getUniTVL({ + factory: '0x24cb308a4e2F3a4352F513681Bd0c31a0bd3BA31', + useDefaultCoreAssets: true, + }) + }, + base: { + tvl: getUniTVL({ + factory: '0x9e6d21e759a7a288b80eef94e4737d313d31c13f', + useDefaultCoreAssets: true, + }) + }, }; From 1cd6dd366100d48770076f99f9617f9fd0d75714 Mon Sep 17 00:00:00 2001 From: define Date: Sat, 30 Sep 2023 16:14:13 +0100 Subject: [PATCH 1402/1974] ancora --- projects/ancora/index.js | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 projects/ancora/index.js diff --git a/projects/ancora/index.js b/projects/ancora/index.js new file mode 100644 index 00000000000..f421738c288 --- /dev/null +++ b/projects/ancora/index.js @@ -0,0 +1,7 @@ +const { getUniTVL } = require("../helper/unknownTokens") +module.exports={ + misrepresentedTokens: true, + linea:{ + tvl: getUniTVL({ useDefaultCoreAssets: true, factory: '0xE7aC188E018f954A83c157ac686De7F66e819a51' }), + }, +} \ No newline at end of file From cc48f0fd51ec8bb94cdcf612a446809612020e53 Mon Sep 17 00:00:00 2001 From: phiatFinance <107194334+phiatDev2@users.noreply.github.com> Date: Sun, 1 Oct 2023 01:39:53 +0800 Subject: [PATCH 1403/1974] add phiat protocol (#7602) --- projects/phiat/index.js | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 projects/phiat/index.js diff --git a/projects/phiat/index.js b/projects/phiat/index.js new file mode 100644 index 00000000000..9c22cb0db66 --- /dev/null +++ b/projects/phiat/index.js @@ -0,0 +1,32 @@ +const { staking } = require("../helper/staking"); +const { aaveChainTvl } = require("../helper/aave"); + + +const stakingContract = "0xeAa92F835757a8B3fA4cbCA3Db9D2Ea342651D44"; +const PHIAT = "0x96e035ae0905efac8f733f133462f971cfa45db1"; + + +function lending(borrowed) { + return async (timestamp, ethBlock, chainBlocks) => { + const transform = (i) => `pulse:${i}`; + return aaveChainTvl( + "pulse", + "0x9B979a359410544236343Dfa11b8e1401e4DdCd6", + transform, + undefined, + borrowed + )(timestamp, ethBlock, chainBlocks); + }; +} + + +module.exports = { + timetravel: true, + methodology: + "Counts the tokens locked in the contracts to be used as collateral to borrow or to earn yield. Borrowed coins are not counted towards the TVL, so only the coins actually locked in the contracts are counted. There's multiple reasons behind this but one of the main ones is to avoid inflating the TVL through cycled lending", + pulse: { + tvl: lending(false), + borrowed: lending(true), + staking: staking(stakingContract, PHIAT, "pulse"), + }, +}; From a724e59c50d12a16f5c5b828808bf434ff5668ad Mon Sep 17 00:00:00 2001 From: TJakubek <39831436+TJakubek@users.noreply.github.com> Date: Sat, 30 Sep 2023 20:44:22 +0300 Subject: [PATCH 1404/1974] enosys adding locked HLN farm (#7603) --- projects/flarefarm/flare.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/flarefarm/flare.js b/projects/flarefarm/flare.js index e39f61ccea5..4416f79421d 100644 --- a/projects/flarefarm/flare.js +++ b/projects/flarefarm/flare.js @@ -16,6 +16,7 @@ async function farmTvl(timestamp, ethblock, { [chain]: block }) { ['0x02C6b5B1fbE01Da872E21f9Dab1B980933B0EF27', "0xd3a273329bab3e263015C1C2ab79C3731769a5b0"], [HLN, "0x660cc88B7924a0c727cA6a1a9F0B81D239966928"], ['0x87E0E33558c8e8EAE3c1E9EB276e05574190b48a', "0x2de4bC38f012DC90478f570083d3Da45B05659A9"], + [HLN, "0xC296d1D1E3396bCCDeD32143ca715bAB0A9998cC"], ]; From e91a509da80b9912e92d246eb223fbdf0b1a11d1 Mon Sep 17 00:00:00 2001 From: box25 Date: Sat, 30 Sep 2023 20:46:31 +0300 Subject: [PATCH 1405/1974] added Shimmer and base chains for IceCreamSwap DEX (#7605) * added Shimmer and base chains * Changed shimmer to shimmer_evm From c9b30ef8857989734160dc16c28db9db29f4dbda Mon Sep 17 00:00:00 2001 From: sevane Date: Sat, 30 Sep 2023 19:56:16 +0200 Subject: [PATCH 1406/1974] add tangleswap SDK adapter (#7608) --- projects/tangleswap/index.js | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 projects/tangleswap/index.js diff --git a/projects/tangleswap/index.js b/projects/tangleswap/index.js new file mode 100644 index 00000000000..f4822deea71 --- /dev/null +++ b/projects/tangleswap/index.js @@ -0,0 +1,8 @@ +const { uniV3Export } = require("../helper/uniswapV3"); + +module.exports = uniV3Export({ + shimmer_evm: { + factory: "0xdf7bA717FB0D5ce579252f05167cD96d0fA77bCb", + fromBlock: 32598, + }, +}); From 6031950f013a17e0f301730c930f1bf06427992f Mon Sep 17 00:00:00 2001 From: Michalis Kargakis Date: Sun, 1 Oct 2023 12:04:10 +0200 Subject: [PATCH 1407/1974] Update Zharta adapter (#7604) --- projects/zharta/index.js | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/projects/zharta/index.js b/projects/zharta/index.js index 995b2d646c4..d3b91239afc 100644 --- a/projects/zharta/index.js +++ b/projects/zharta/index.js @@ -1,18 +1,13 @@ -const ADDRESSES = require('../helper/coreAssets.json') const { sumTokensExport, } = require('../helper/unwrapLPs') // Vaults -const collateralVault = "0xA79da8c90Aa480B3716C23145154CA6eF5Fc29C1"; -const punkVault = "0x94925030F48aDfc3e4A65a2E0A7444733406c144"; -const LP_CORE = "0xe3c959bc97b92973d5367dbf4ce1b7b9660ee271"; -const appraisalVault = "0xA79da8c90Aa480B3716C23145154CA6eF5Fc29C1"; +const lpCoreEthPool = "0x7CA34cF45a119bEBEf4D106318402964a331DfeD"; module.exports = { methodology: `Counts the floor value of all deposited NFTs with Chainlink price feeds. Borrowed coins are not counted towards the TVL`, ethereum: { tvl: sumTokensExport({ - owners: [collateralVault, punkVault, appraisalVault, LP_CORE], - tokens: [ADDRESSES.ethereum.WETH], + owners: [lpCoreEthPool], resolveNFTs: true, }), } From 4dfa8a2c6810129fc19ea66a333971f6aa0950af Mon Sep 17 00:00:00 2001 From: Laari Finance <146558511+LaariFinance@users.noreply.github.com> Date: Sun, 1 Oct 2023 18:08:19 +0800 Subject: [PATCH 1408/1974] Listing Laari onto DefiLlama (#7609) * Listing Laari onto DefiLlama * minor fix --------- Co-authored-by: llama --- projects/laari-fi/index.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 projects/laari-fi/index.js diff --git a/projects/laari-fi/index.js b/projects/laari-fi/index.js new file mode 100644 index 00000000000..1a0060310bb --- /dev/null +++ b/projects/laari-fi/index.js @@ -0,0 +1,15 @@ +const { yieldHelper, } = require("../helper/yieldHelper") + +const AutoFarmV2 = '0x421fcb1f6dBa9E01C70d4A342D9590547fBf9997' +const Laari = '0x236f9ebE3A40F3b24CEa63a880704c712d5EC760' + +module.exports = yieldHelper({ + project: 'laari-finance', + chain: 'base', + masterchef: AutoFarmV2, + nativeToken: Laari, + useDefaultCoreAssets: true, + abis: { + poolInfo: 'function poolInfo(uint256) view returns (address want, uint256, uint256, uint256, uint256, uint256, uint256, uint256 amount, uint256, address strat)', + }, +}) \ No newline at end of file From 35b14ef78d66284057b3794a459c6a6d09a6fa73 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 2 Oct 2023 09:25:30 +0530 Subject: [PATCH 1409/1974] Ice-2 (#7614) * added core assets for shimmer_evm * added wrapped shimmer to tokenMapping.js * Removed ICE from shimmer core assets. * minor fix --------- Co-authored-by: simon Co-authored-by: llama --- projects/boneriumtech/index.js | 2 +- projects/helper/coreAssets.json | 6 +++- projects/helper/tokenMapping.js | 2 ++ projects/icecreamswap/index.js | 63 +++++++-------------------------- 4 files changed, 20 insertions(+), 53 deletions(-) diff --git a/projects/boneriumtech/index.js b/projects/boneriumtech/index.js index ce4a6360802..5b7b87e1f4f 100644 --- a/projects/boneriumtech/index.js +++ b/projects/boneriumtech/index.js @@ -3,5 +3,5 @@ module.exports = { // tvl: getUniTVL({ factory: '0x9e98c46825da5f6622eBFA0bc8d278c61b763802', useDefaultCoreAssets: true, }) tvl: () => ({}), }, - // deadFrom: "2023-09-10", + deadFrom: "2023-09-10", } \ No newline at end of file diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index 401dc898610..3376ff027d6 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -1414,5 +1414,9 @@ "WETH": "0x4200000000000000000000000000000000000001", "USDC": "0x49A5010110a358d9069282873F3e7eCf6B41DC10", "USDT": "0x0Cf7c2A584988871b654Bd79f96899e4cd6C41C0" + }, + "shimmer_evm": { + "WSMR": "0xBEb654A116aeEf764988DF0C6B4bf67CC869D01b", + "USDT": "0xc0E49f8C615d3d4c245970F6Dc528E4A47d69a44" } -} \ No newline at end of file +} diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 2fa14c13e02..3776df1b49c 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -57,6 +57,8 @@ const fixBalancesTokens = { }, shimmer_evm: { '0x1074010000000000000000000000000000000000': { coingeckoId: 'shimmer', decimals: 6 }, + '0xBEb654A116aeEf764988DF0C6B4bf67CC869D01b': { coingeckoId: 'shimmer', decimals: 18 }, + '0xc0e49f8c615d3d4c245970f6dc528e4a47d69a44': { coingeckoId: 'tether', decimals: 18 }, }, manta: { '0x0Dc808adcE2099A9F62AA87D9670745AbA741746': { coingeckoId: 'ethereum', decimals: 18 }, diff --git a/projects/icecreamswap/index.js b/projects/icecreamswap/index.js index 8300ab89e94..f5ba6d5ffde 100644 --- a/projects/icecreamswap/index.js +++ b/projects/icecreamswap/index.js @@ -1,53 +1,14 @@ const { getUniTVL, } = require('../helper/unknownTokens') -module.exports = { - misrepresentedTokens: true, - bitgert: { - tvl: getUniTVL({ - factory: '0x9E6d21E759A7A288b80eef94E4737D313D31c13f', - useDefaultCoreAssets: true, - }), - }, - xdc: { - tvl: getUniTVL({ - factory: '0x9E6d21E759A7A288b80eef94E4737D313D31c13f', - useDefaultCoreAssets: true, - }) - }, - fuse: { - tvl: getUniTVL({ - factory: '0x9E6d21E759A7A288b80eef94E4737D313D31c13f', - useDefaultCoreAssets: true, - }) - }, - dogechain: { - tvl: getUniTVL({ - factory: '0x9E6d21E759A7A288b80eef94E4737D313D31c13f', - useDefaultCoreAssets: true, - }) - }, - core: { - tvl: getUniTVL({ - factory: '0x9E6d21E759A7A288b80eef94E4737D313D31c13f', - useDefaultCoreAssets: true, - }) - }, - telos: { - tvl: getUniTVL({ - factory: '0x9E6d21E759A7A288b80eef94E4737D313D31c13f', - useDefaultCoreAssets: true, - }) - }, - shimmer_evm: { - tvl: getUniTVL({ - factory: '0x24cb308a4e2F3a4352F513681Bd0c31a0bd3BA31', - useDefaultCoreAssets: true, - }) - }, - base: { - tvl: getUniTVL({ - factory: '0x9e6d21e759a7a288b80eef94e4737d313d31c13f', - useDefaultCoreAssets: true, - }) - }, -}; +const config = { + shimmer_evm: '0x24cb308a4e2F3a4352F513681Bd0c31a0bd3BA31', +} + +const chains = [...Object.keys(config), 'base', 'telos', 'core', 'dogechain', 'fuse', 'xdc', 'bitgert' ] + +chains.forEach(chain => { + const factory = config[chain] + module.exports[chain] = { + tvl: getUniTVL({ factory: factory ?? '0x9E6d21E759A7A288b80eef94E4737D313D31c13f', useDefaultCoreAssets: true,}) + } +}) \ No newline at end of file From 348e836e214adebc435f04b9bb4e94faf1f38e7e Mon Sep 17 00:00:00 2001 From: define Date: Mon, 2 Oct 2023 10:15:10 +0100 Subject: [PATCH 1410/1974] add fan tech --- projects/fan-tech/index.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 projects/fan-tech/index.js diff --git a/projects/fan-tech/index.js b/projects/fan-tech/index.js new file mode 100644 index 00000000000..a855ce88c20 --- /dev/null +++ b/projects/fan-tech/index.js @@ -0,0 +1,14 @@ +const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') + +const contract = "0x53167401aeebFf5677C31E1DDA945628422D7Ed2" + +async function tvl(time, ethBlock, _b, {api}) { + return sumTokens2({ tokens: [nullAddress], owner: contract, api }) +} + +module.exports = { + methodology: `We count the MNT on ${contract}`, + mantle: { + tvl + } +} \ No newline at end of file From 194930381bb1fa0977ac960ffa7b945538977a39 Mon Sep 17 00:00:00 2001 From: llama Date: Mon, 2 Oct 2023 15:05:18 +0200 Subject: [PATCH 1411/1974] fix broken adapters --- package-lock.json | 12 +++--- projects/chaingpt/index.js | 39 +++++++++++++++++- projects/dexter/index.js | 67 +++++++++++++------------------ projects/glacier-finance/index.js | 4 +- projects/helper/chain/cosmos.js | 1 + projects/sifchain.js | 9 +++-- 6 files changed, 79 insertions(+), 53 deletions(-) diff --git a/package-lock.json b/package-lock.json index 2cdb4979b7c..544328a487c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -785,9 +785,9 @@ } }, "node_modules/@defillama/sdk": { - "version": "4.0.57", - "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.57.tgz", - "integrity": "sha512-20jdEUFqFCp/DJljUJczuTYVYjdq7xo+9B/FhAiEkkPI4t5fh1+dVKmLM765kEOYitlPGKZrnvFmQRLlTNW6sQ==", + "version": "4.0.60", + "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.60.tgz", + "integrity": "sha512-aAgn5yUZ27B8yOrS6cqv10y3mcySKD/fdvOGNBnAC++sLBcAvNQbPfDf4ArvZwQhcyqLpoPtOD2Qk6VfF4LYFw==", "dependencies": { "@aws-sdk/client-s3": "^3.400.0", "@supercharge/promise-pool": "^2.1.0", @@ -5905,9 +5905,9 @@ } }, "@defillama/sdk": { - "version": "4.0.57", - "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.57.tgz", - "integrity": "sha512-20jdEUFqFCp/DJljUJczuTYVYjdq7xo+9B/FhAiEkkPI4t5fh1+dVKmLM765kEOYitlPGKZrnvFmQRLlTNW6sQ==", + "version": "4.0.60", + "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.60.tgz", + "integrity": "sha512-aAgn5yUZ27B8yOrS6cqv10y3mcySKD/fdvOGNBnAC++sLBcAvNQbPfDf4ArvZwQhcyqLpoPtOD2Qk6VfF4LYFw==", "requires": { "@aws-sdk/client-s3": "^3.400.0", "@supercharge/promise-pool": "^2.1.0", diff --git a/projects/chaingpt/index.js b/projects/chaingpt/index.js index aabb36851e8..c69ac1b74bc 100644 --- a/projects/chaingpt/index.js +++ b/projects/chaingpt/index.js @@ -1,14 +1,51 @@ const { pool2s } = require("../helper/pool2"); const { stakings } = require("../helper/staking"); +const { getLogs } = require('../helper/cache/getLogs') const cgpt = "0x9840652DC04fb9db2C43853633f0F62BE6f00f98"; const stakingpool1 = "0x765a6ee976137801F2661c3644E1fde369A8ED18"; const stakingpool2 = "0x62A402DEf6Ca37E9CA7a544bE34954748088CCEE"; +async function tvl(_, _b, _cb, { api, }) { + const factory0 = '0xfb8c571f7152d2e092b0e650731c4d599cd514e1' + const factory = '0xc263365D628568C23d61BDDa24C8EB27CEF4E917' + const logs = await getLogs({ + api, + target: factory0, + eventAbi: 'event PresalePoolCreated (address token, uint256 openTime, uint256 closeTime, address offeredCurrency, uint256 offeredCurrencyDecimals, uint256 offeredCurrencyRate, address wallet, address owner)', + fromBlock: 30004999, + }) + + const logs2 = await getLogs({ + api, + target: factory, + eventAbi: 'event PresalePoolCreated (address registedBy, address indexed token, address indexed pool, uint256 poolId)', + fromBlock: 30004999, + }) + const ownerTokens = [] + const poolTokenMapping = {} + console.log(logs.length, logs2.length) + logs.forEach(({ args: i}) => { + const key = i.token+'-'+i.owner + console.log(key, i.offeredCurrency) + if (!poolTokenMapping[key]) poolTokenMapping[key] = [] + poolTokenMapping[key].push(i.offeredCurrency) + }) + console.log(poolTokenMapping) + logs2.forEach(({ args: i}) => { + const key = i.token+'-'+i.registedBy + if (!poolTokenMapping[key]) { + console.log('missing mapping for ', key) + return; + } + ownerTokens.push([poolTokenMapping[key], i.pool]) + }) + return api.sumTokens({ ownerTokens }) +} module.exports = { bsc: { - tvl: async () => ({}), + tvl, staking: stakings([stakingpool1, stakingpool2], cgpt), }, }; \ No newline at end of file diff --git a/projects/dexter/index.js b/projects/dexter/index.js index 8a2a774e92d..b9a8ad8224a 100644 --- a/projects/dexter/index.js +++ b/projects/dexter/index.js @@ -1,49 +1,36 @@ -const {GraphQLClient, gql} = require('graphql-request'); -const {toUSDTBalances} = require("../helper/balances"); +const { queryContract } = require("../helper/chain/cosmos"); +const { transformDexBalances } = require("../helper/portedTokens"); + +async function tvl(_, _b, _cb, { api, }) { + const contract = 'persistence1k8re7jwz6rnnwrktnejdwkwnncte7ek7gt29gvnl3sdrg9mtnqkstujtpg' + const chain = api.chain + const config = await queryContract({ chain, contract, data: { config: {} }, }); + let poolId = 1 + const data = [] + do { + const { assets, pool_type } = await queryContract({ chain, contract, data: { get_pool_by_id: { pool_id: '' + poolId } }, }) + // if (pool_type.stable_swap) { + assets.forEach(({ info: { native_token: { denom }}, amount }) => api.add(denom, amount)) + // } else { + // data.push({ + // token0: assets[0].info.native_token.denom, + // token0Bal: assets[0].amount, + // token1: assets[1].info.native_token.denom, + // token1Bal: assets[1].amount, + // }) + // } + poolId++ + } while (poolId < +config.next_pool_id) + return transformDexBalances({ chain, data, balances: api.getBalances()}) -const dexterSubgraphEndpoint = "https://api.core-1.dexter.zone/v1/graphql"; -const dexterVaultAddr = "persistence1k8re7jwz6rnnwrktnejdwkwnncte7ek7gt29gvnl3sdrg9mtnqkstujtpg"; - -const currentTvlOp = gql` - query defillama_current_tvl($vault: String, $date: date) { - tvl: pool_daily_closing_data_aggregate(where: {vault_address: {_eq: $vault}, date: {_eq: $date}}) { - aggregate { - sum { - liquidity - } - } - } - } -`; - -async function getTvlAtTime(timestamp) { - const date = new Date(timestamp * 1000); - const dateStr = `${date.getUTCFullYear()}-${date.getUTCMonth() + 1}-${date.getUTCDate()}`; - - const graphQLClient = new GraphQLClient(dexterSubgraphEndpoint); - const results = await graphQLClient.request(currentTvlOp, { - "vault": dexterVaultAddr, - "date": dateStr - }); - - return results.tvl.aggregate.sum.liquidity; -} - -async function tvl(timestamp) { - const currentTVL = await getTvlAtTime(timestamp); - - // return the liquidity for prev day, if none exists for current day - const liquidity = currentTVL ? currentTVL : await getTvlAtTime(timestamp - 86400); - - return toUSDTBalances(liquidity); } module.exports = { - timetravel: true, - misrepresentedTokens: true, + timetravel: false, + // misrepresentedTokens: true, methodology: `Counts the liquidity on all AMM pools`, start: 1679788800, // "2023-03-26" UTC persistence: { tvl } -}; // node test.js projects/dexter/index.js +} diff --git a/projects/glacier-finance/index.js b/projects/glacier-finance/index.js index 0eef46a93db..650f8d04e85 100644 --- a/projects/glacier-finance/index.js +++ b/projects/glacier-finance/index.js @@ -1,10 +1,10 @@ const { getUniTVL } = require("../helper/unknownTokens"); -const { staking, stakingPricedLP } = require('../helper/staking'); +const { staking } = require('../helper/staking'); module.exports = { misrepresentedTokens: true, avax: { tvl: getUniTVL({ factory: '0xaC7B7EaC8310170109301034b8FdB75eCa4CC491', useDefaultCoreAssets: true, hasStablePools: true }), - staking: stakingPricedLP("0xed1eE3f892fe8a13A9BE02F92E8FB7410AA84739", "0x3712871408a829C5cd4e86DA1f4CE727eFCD28F6", "avax", "0x2071a39da7450d68e4f4902774203df208860da2", "avalanche-2"), + staking: staking("0xed1eE3f892fe8a13A9BE02F92E8FB7410AA84739", "0x3712871408a829C5cd4e86DA1f4CE727eFCD28F6"), }, }; diff --git a/projects/helper/chain/cosmos.js b/projects/helper/chain/cosmos.js index dba6b972186..4507196b5f2 100644 --- a/projects/helper/chain/cosmos.js +++ b/projects/helper/chain/cosmos.js @@ -38,6 +38,7 @@ const endPoints = { sei: "https://sei-api.polkachu.com", aura: "https://lcd.aura.network", archway: "https://api.mainnet.archway.io", + sifchain: "https://sifchain-api.polkachu.com", }; const chainSubpaths = { diff --git a/projects/sifchain.js b/projects/sifchain.js index f915b4c8e95..9119047cf0d 100644 --- a/projects/sifchain.js +++ b/projects/sifchain.js @@ -1,16 +1,17 @@ const { get } = require('./helper/http') +const { endPoints } = require('./helper/chain/cosmos') async function tvl() { // const getPoolsRes = await get('https://api.sifchain.finance/clp/getPools') - const getPoolsRes = await get('https://sifchain-api.polkachu.com/clp/getPools') + const getPoolsRes = await get(endPoints.sifchain + '/clp/getPools') const total = getPoolsRes.result.pools .map(pool => +pool.native_asset_balance) .reduce((sum, current) => sum + current, 0) - return { - sifchain: total * 2 / 1e18 - } + return { + sifchain: total * 2 / 1e18 + } } module.exports = { From 40cdd9973f48c740c2863e73d85e341ef3036f8d Mon Sep 17 00:00:00 2001 From: llama Date: Mon, 2 Oct 2023 15:55:54 +0200 Subject: [PATCH 1412/1974] update tangleswap --- projects/helper/tokenMapping.js | 2 ++ projects/tangleswap/index.js | 40 ++++++++++++++++++++++++++------- 2 files changed, 34 insertions(+), 8 deletions(-) diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 3776df1b49c..530e5762155 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -59,6 +59,8 @@ const fixBalancesTokens = { '0x1074010000000000000000000000000000000000': { coingeckoId: 'shimmer', decimals: 6 }, '0xBEb654A116aeEf764988DF0C6B4bf67CC869D01b': { coingeckoId: 'shimmer', decimals: 18 }, '0xc0e49f8c615d3d4c245970f6dc528e4a47d69a44': { coingeckoId: 'tether', decimals: 18 }, + '0xa158a39d00c79019a01a6e86c56e96c461334eb0': { coingeckoId: 'ethereum', decimals: 18 }, + '0x1cdf3f46dbf8cf099d218cf96a769cea82f75316': { coingeckoId: 'wrapped-bitcoin', decimals: 8 }, }, manta: { '0x0Dc808adcE2099A9F62AA87D9670745AbA741746': { coingeckoId: 'ethereum', decimals: 18 }, diff --git a/projects/tangleswap/index.js b/projects/tangleswap/index.js index f4822deea71..832b5f3c515 100644 --- a/projects/tangleswap/index.js +++ b/projects/tangleswap/index.js @@ -1,8 +1,32 @@ -const { uniV3Export } = require("../helper/uniswapV3"); - -module.exports = uniV3Export({ - shimmer_evm: { - factory: "0xdf7bA717FB0D5ce579252f05167cD96d0fA77bCb", - fromBlock: 32598, - }, -}); +const { cachedGraphQuery } = require('../helper/cache') +const { sumTokens2 } = require('../helper/unwrapLPs') + +const config = { + shimmer_evm: { endpoint: 'https://shimmer.subgraph.tangleswap.space/subgraphs/name/tangleswap/shimmer' }, +} +const query = `query getPools($lastId: String!) { + pools( + first: 1000 + where: {id_gt: $lastId} + ) { + id + token0 { id } + token1 { id } + } +}` + +async function tvl(ts, block, _, { api }) { + const { endpoint } = config[api.chain] + const pools = await cachedGraphQuery('tangleswap/' + api.chain, endpoint, query, { fetchById: true, }) + return sumTokens2({ + api, + ownerTokens: pools.map(i => { + return [[i.token0.id, i.token1.id], i.id] + }) + }) +} + + +Object.keys(config).forEach(chain => { + module.exports[chain] = { tvl } +}) \ No newline at end of file From b50f4a6f3a53100491b11f550d093a00591cf66a Mon Sep 17 00:00:00 2001 From: Michael Semin Date: Mon, 2 Oct 2023 22:35:39 +0800 Subject: [PATCH 1413/1974] Add Base for ReHold V2 (#7616) * added ethereum to rehold-v2 * added `hallmarks` for rehold * added base chain + events --- projects/rehold-v2/index.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/projects/rehold-v2/index.js b/projects/rehold-v2/index.js index 47a1a9d6903..8522d8e9ccd 100644 --- a/projects/rehold-v2/index.js +++ b/projects/rehold-v2/index.js @@ -11,4 +11,11 @@ module.exports = { avax: { tvl }, arbitrum: { tvl }, optimism: { tvl }, + base: { tvl }, + + hallmarks: [ + [1688688480, "ReHold V2 Launch"], + [1689743327, "Ethereum Deployment"], + [1690898169, "Limit Orders Launch"], + ], }; From f5a40c7b9a46c05bef0490f8d13983058890b936 Mon Sep 17 00:00:00 2001 From: geckocoding <133345507+geckocoding@users.noreply.github.com> Date: Mon, 2 Oct 2023 22:35:57 +0800 Subject: [PATCH 1414/1974] Added opBNB chain to DerpDEX adapter (#7617) * Added Base chain to DerpDEX adapter * Update index.js --------- Co-authored-by: techyderp <138676931+techyderp@users.noreply.github.com> --- projects/DerpDEX/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/projects/DerpDEX/index.js b/projects/DerpDEX/index.js index 2ea1f9eee1a..3d68d4fe60d 100644 --- a/projects/DerpDEX/index.js +++ b/projects/DerpDEX/index.js @@ -8,5 +8,9 @@ module.exports = uniV3Export({ base: { factory: "0xeddef4273518b137cdbcb3a7fa1c6a688303dfe2", fromBlock: 2753388 + }, + op_bnb: { + factory: "0xb91331Ea9539ee881e3A45191076c454E482dAc7", + fromBlock: 3521514 } }); From 14b8c988d8d96f4377738fec95dad9565cde7d91 Mon Sep 17 00:00:00 2001 From: Javier NFT Date: Mon, 2 Oct 2023 16:36:31 +0200 Subject: [PATCH 1415/1974] jexchange: use new `/pools/v3` endpoint (#7618) --- projects/jexchange/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/jexchange/index.js b/projects/jexchange/index.js index fad040c25ca..39c2e66bfcd 100644 --- a/projects/jexchange/index.js +++ b/projects/jexchange/index.js @@ -2,7 +2,7 @@ const { sumTokens } = require("../helper/chain/elrond"); const { getConfig } = require('../helper/cache') async function tvl() { - const pools = await getConfig('jexchange', 'https://api.jexchange.io/pools') + const pools = await getConfig('jexchange', 'https://api.jexchange.io/pools/v3') const owners = [ ...pools.map(pool => pool.sc_address), "erd1qqqqqqqqqqqqqpgqmmxzmktd09gq0hldtczerlv444ykt3pz6avsnys6m9", From 7f6707f148751f7372d073c97a3d949513df3a07 Mon Sep 17 00:00:00 2001 From: OhMyCrypt <126069127+OhMyCrypt@users.noreply.github.com> Date: Mon, 2 Oct 2023 17:00:00 +0200 Subject: [PATCH 1416/1974] add ohmycrypt on Base (#7561) * ohmycrypt * code refactor --------- Co-authored-by: g1nt0ki --- projects/OhMyCrypt/index.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 projects/OhMyCrypt/index.js diff --git a/projects/OhMyCrypt/index.js b/projects/OhMyCrypt/index.js new file mode 100644 index 00000000000..b6dd35f050d --- /dev/null +++ b/projects/OhMyCrypt/index.js @@ -0,0 +1,26 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require('../helper/unwrapLPs') + +const cbethBase = "0x2ae3f1ec7f1f5012cfeab0185bfc7aa3cf0dec22"; +const agEURbase = "0xA61BeB4A3d02decb01039e378237032B351125B4"; +const tbtcbase = "0x236aa50979D5f3De3Bd1Eeb40E81137F22ab794b" + +const cbETHUSDCMarket = "0xc94f0d769b508406c9824d12527371CEc9d03A92"; +const WETHUSDCMarket = "0x9cdf2b3e2A048C04E828A35eAC51C8D05031cB8c"; +const BTCUSDCMarket = "0x5cD8298E6C862D429c51D44bED134bD0A40c3004"; +const agEURUSDCMarket = "0x4684C320C8768F4E49b52718f1247172f8Cb49A3"; +const USDCDAIMarket = "0xa7E34A5c1B06D2eBD9BdE7227b59119c46CaEdeF"; + +module.exports = { + base: { + tvl: sumTokensExport({ + ownerTokens: [ + [[ADDRESSES.base.USDC, cbethBase], cbETHUSDCMarket], + [[ADDRESSES.base.USDC, ADDRESSES.base.WETH], WETHUSDCMarket], + [[ADDRESSES.base.USDC, tbtcbase], BTCUSDCMarket], + [[ADDRESSES.base.USDC, agEURbase], agEURUSDCMarket], + [[ADDRESSES.base.USDC, ADDRESSES.base.DAI], USDCDAIMarket], + ] + }), + }, +}; \ No newline at end of file From 206acfc54203ca3df7a513788192fb763440a135 Mon Sep 17 00:00:00 2001 From: llama Date: Mon, 2 Oct 2023 17:08:50 +0200 Subject: [PATCH 1417/1974] glaciar v2: get token breakdown --- projects/glacier-finance/index.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/projects/glacier-finance/index.js b/projects/glacier-finance/index.js index 650f8d04e85..757ae7df902 100644 --- a/projects/glacier-finance/index.js +++ b/projects/glacier-finance/index.js @@ -2,9 +2,8 @@ const { getUniTVL } = require("../helper/unknownTokens"); const { staking } = require('../helper/staking'); module.exports = { - misrepresentedTokens: true, avax: { - tvl: getUniTVL({ factory: '0xaC7B7EaC8310170109301034b8FdB75eCa4CC491', useDefaultCoreAssets: true, hasStablePools: true }), + tvl: getUniTVL({ factory: '0xaC7B7EaC8310170109301034b8FdB75eCa4CC491', useDefaultCoreAssets: false, hasStablePools: true }), staking: staking("0xed1eE3f892fe8a13A9BE02F92E8FB7410AA84739", "0x3712871408a829C5cd4e86DA1f4CE727eFCD28F6"), }, }; From 61d5c66834b2aa22fb52d561c603d0fec10926cd Mon Sep 17 00:00:00 2001 From: llama Date: Mon, 2 Oct 2023 17:31:13 +0200 Subject: [PATCH 1418/1974] add friendtech33 --- projects/algebra-v2/index.js | 34 ++++--------------------------- projects/friendtech33/index.js | 8 ++++++++ projects/treasury/friendtech33.js | 11 ++++++++++ 3 files changed, 23 insertions(+), 30 deletions(-) create mode 100644 projects/friendtech33/index.js create mode 100644 projects/treasury/friendtech33.js diff --git a/projects/algebra-v2/index.js b/projects/algebra-v2/index.js index 8c5672a865d..74740ee0ef8 100644 --- a/projects/algebra-v2/index.js +++ b/projects/algebra-v2/index.js @@ -1,31 +1,5 @@ -const { getLogs } = require('../helper/cache/getLogs') -const { sumTokens2 } = require('../helper/unwrapLPs') +const { uniV3Export } = require("../helper/uniswapV3"); -const FACTORY = '0xa2A92Bb449CCa49b810C84c0efC36a88431655f2'; - -const startBlocks = { - avax: 31662680 -} - -function chainTvl(chain) { - return async (timestamp, ethBlock, chainBlocks, { api }) => { - const START_BLOCK = startBlocks[chain] - const logs = await getLogs({ - api, - target: FACTORY, - fromBlock: START_BLOCK, - topic: 'Pool(address,address,address)', - eventAbi: 'event Pool(address indexed token0, address indexed token1, address pool)', - onlyArgs: true, - }) - const toa = [] - logs.forEach(({ token0, token1, pool}) => toa.push([token0, pool], [token1, pool])) - return sumTokens2({ api, tokensAndOwners: toa }) - } -} - -module.exports = { - avax: { - tvl: chainTvl('avax'), - } -} \ No newline at end of file +module.exports = uniV3Export({ + avax: { factory: "0xa2A92Bb449CCa49b810C84c0efC36a88431655f2", fromBlock: 31662680, isAlgebra: true, }, +}); diff --git a/projects/friendtech33/index.js b/projects/friendtech33/index.js new file mode 100644 index 00000000000..e8ec288b5ba --- /dev/null +++ b/projects/friendtech33/index.js @@ -0,0 +1,8 @@ +const { staking } = require('../helper/staking') + +module.exports = { + base: { + tvl: () => ({}), + staking: staking('0x6F82D82e6FEcB6d0dAF08b8fFD9772d596582F4A', '0x3347453Ced85bd288D783d85cDEC9b01Ab90f9D8') + } +} \ No newline at end of file diff --git a/projects/treasury/friendtech33.js b/projects/treasury/friendtech33.js new file mode 100644 index 00000000000..f180a16c285 --- /dev/null +++ b/projects/treasury/friendtech33.js @@ -0,0 +1,11 @@ +const { treasuryExports } = require("../helper/treasury"); + +const treasury = "0x68d91Bb4b1760Bc131555D23a438585D937A8e6d"; + +module.exports = treasuryExports({ + base: { + owners: [treasury,], + ownTokens: ['0x3347453Ced85bd288D783d85cDEC9b01Ab90f9D8'], + resolveLP: true, + }, +}) \ No newline at end of file From 0e945f797f44ce76ecad5310cedf7a64ea6212a9 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Tue, 3 Oct 2023 01:12:06 +0100 Subject: [PATCH 1419/1974] add missing market --- projects/compound-v3/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/projects/compound-v3/index.js b/projects/compound-v3/index.js index a6451d72173..5ce6dc42387 100644 --- a/projects/compound-v3/index.js +++ b/projects/compound-v3/index.js @@ -8,7 +8,10 @@ module.exports = compoundV3Exports({ ], }, arbitrum: { - markets: ['0xA5EDBDD9646f8dFF606d7448e414884C7d905dCA'], + markets: [ + '0xA5EDBDD9646f8dFF606d7448e414884C7d905dCA', + '0x9c4ec768c28520B50860ea7a15bd7213a9fF58bf' + ], }, polygon: { markets: ['0xF25212E676D1F7F89Cd72fFEe66158f541246445'], From 0f6164ada293b9ea742e0cc107519d2b8de6ef45 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Tue, 3 Oct 2023 02:09:29 +0100 Subject: [PATCH 1420/1974] tvl breakdown by token --- projects/ondofinance/index.js | 39 ++++++++++------------------------- 1 file changed, 11 insertions(+), 28 deletions(-) diff --git a/projects/ondofinance/index.js b/projects/ondofinance/index.js index e699a96548a..4457f378a4e 100644 --- a/projects/ondofinance/index.js +++ b/projects/ondofinance/index.js @@ -1,4 +1,4 @@ -const sdk = require('@defillama/sdk') +const sdk = require('@defillama/sdk'); module.exports = { methodology: "Sums Ondo's fund supplies.", @@ -18,39 +18,22 @@ const config = { } Object.keys(config).forEach((chain) => { - let funds = config[chain]; - const fundKeys = Object.keys(funds); // Capture the keys (OUSG, USDYc, etc.) - funds = Object.values(funds); + let fundsMap = config[chain]; + const fundAddresses = Object.values(fundsMap); + const fundKeys = Object.keys(fundsMap); + module.exports[chain] = { tvl: async (_, _b, _cb, { api }) => { - const ethApi = new sdk.ChainApi({ chain: 'ethereum', block: _b }); - const supplies = await api.multiCall({ abi: 'erc20:totalSupply', calls: funds }); - - const ousgTokenPrice = (await ethApi.call({ - abi: 'uint256:rwaPrice', - target: '0xc53e6824480d976180A65415c19A6931D17265BA', - })) / 1e18; - - const usdyTokenPrice = (await ethApi.call({ - abi: 'uint256:getLatestPrice', - target: '0x7fb0228c6338da4EC948Df7b6a8E22aD2Bb2bfB5', - })) / 1e18; - - let totalTvl = 0; + const balances = {}; + const supplies = await api.multiCall({ abi: 'erc20:totalSupply', calls: fundAddresses }); supplies.forEach((supply, index) => { - const key = fundKeys[index]; - - if (key === 'USDYc' || key === 'USDY') { - // Use the specific price for USDYc - totalTvl += (supply / 1e18) * usdyTokenPrice; - } else { - // Use the general token price - totalTvl += (supply / 1e18) * ousgTokenPrice; - } + const tokenName = fundKeys[index]; + const adjustedSupply = supply / 10**18; + balances[tokenName] = adjustedSupply; }); - return { 'usd-coin': totalTvl }; + return balances; }, }; }); \ No newline at end of file From 8867d1f15f15f096c25604fbaa4cbdf521220a2f Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Tue, 3 Oct 2023 02:31:22 +0100 Subject: [PATCH 1421/1974] update to use addresses --- projects/ondofinance/index.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/projects/ondofinance/index.js b/projects/ondofinance/index.js index 4457f378a4e..74aa33372f4 100644 --- a/projects/ondofinance/index.js +++ b/projects/ondofinance/index.js @@ -19,8 +19,7 @@ const config = { Object.keys(config).forEach((chain) => { let fundsMap = config[chain]; - const fundAddresses = Object.values(fundsMap); - const fundKeys = Object.keys(fundsMap); + const fundAddresses = Object.values(fundsMap); module.exports[chain] = { tvl: async (_, _b, _cb, { api }) => { @@ -28,12 +27,12 @@ Object.keys(config).forEach((chain) => { const supplies = await api.multiCall({ abi: 'erc20:totalSupply', calls: fundAddresses }); supplies.forEach((supply, index) => { - const tokenName = fundKeys[index]; - const adjustedSupply = supply / 10**18; - balances[tokenName] = adjustedSupply; + const tokenAddress = fundAddresses[index]; + const key = `${chain}:${tokenAddress}`; + balances[key] = supply; }); return balances; }, }; -}); \ No newline at end of file +}); From c84f2062f7fa52d200772bb8e85b1cf6512da464 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Tue, 3 Oct 2023 03:34:28 +0100 Subject: [PATCH 1422/1974] add merit circle eth and bsc treasuries --- projects/treasury/merit-circle.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 projects/treasury/merit-circle.js diff --git a/projects/treasury/merit-circle.js b/projects/treasury/merit-circle.js new file mode 100644 index 00000000000..0bf3a1c471d --- /dev/null +++ b/projects/treasury/merit-circle.js @@ -0,0 +1,18 @@ +const { treasuryExports } = require("../helper/treasury"); + + +module.exports = treasuryExports({ + ethereum: { + owners: [ + '0x7e9e4c0876B2102F33A1d82117Cc73B7FddD0032', '0x73F7261cF493105202F8dcbB11C126a65703dA55', '0xC4218226A5406Aa721EAEBc2D9dA9564AEdd7777', + '0xc040340bDD2F40374e9751Db0342D0AC668ef7C8', '0x3cB580c041Cce953adfc2148e5BE6c1c893CCa9E' + ], + ownTokens: ['0x949D48EcA67b17269629c7194F4b727d4Ef9E5d6'], + }, + bsc: { + owners: [ + '0xf92Bc9ee240B82A888c398e6965A7edcBF9399CF', '0xC4218226A5406Aa721EAEBc2D9dA9564AEdd7777' + ], + ownTokens: ['0x949D48EcA67b17269629c7194F4b727d4Ef9E5d6'], +}, +}) \ No newline at end of file From 23553b26f0c05b0cd19e7353003de10362ca576e Mon Sep 17 00:00:00 2001 From: llama Date: Tue, 3 Oct 2023 06:16:20 +0200 Subject: [PATCH 1423/1974] track mauve.org --- projects/mauve/index.js | 5 +++++ projects/vmex-fi/index.js | 1 + 2 files changed, 6 insertions(+) create mode 100644 projects/mauve/index.js diff --git a/projects/mauve/index.js b/projects/mauve/index.js new file mode 100644 index 00000000000..909b0070717 --- /dev/null +++ b/projects/mauve/index.js @@ -0,0 +1,5 @@ +const { uniV3Export } = require('../helper/uniswapV3') + +module.exports = uniV3Export({ + ethereum: { factory: '0x0569168709a869e7f4Ba142c49BFF7faA14f76C8', fromBlock: 18047375, }, +}) diff --git a/projects/vmex-fi/index.js b/projects/vmex-fi/index.js index 962aa359761..104db83b7a2 100644 --- a/projects/vmex-fi/index.js +++ b/projects/vmex-fi/index.js @@ -1,5 +1,6 @@ const config = { optimism: { pool: '0x60F015F66F3647168831d31C7048ca95bb4FeaF9', }, + base: { pool: '0x60F015F66F3647168831d31C7048ca95bb4FeaF9', }, } Object.keys(config).forEach(chain => { From 71ade8f53d233e2b0f4799c76b02bdfca946f13a Mon Sep 17 00:00:00 2001 From: charq <73696209+buchaoqun@users.noreply.github.com> Date: Tue, 3 Oct 2023 13:11:20 +0800 Subject: [PATCH 1424/1974] Get slotRwa from github (#7620) * add mantle network * update mantle network graphUrl * update solv-protocol-v3 to solv-protocol-funds add solv-protocol-rwa * update * del close-fund * fix block issue leading to reading data from cache * Get slotRwa from github --------- Co-authored-by: g1nt0ki --- projects/solv-protocol-rwa/index.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/projects/solv-protocol-rwa/index.js b/projects/solv-protocol-rwa/index.js index cbbc865040c..c892c909b84 100644 --- a/projects/solv-protocol-rwa/index.js +++ b/projects/solv-protocol-rwa/index.js @@ -1,4 +1,5 @@ const { default: BigNumber } = require("bignumber.js"); +const { getConfig } = require("../helper/cache"); const abi = require("./abi.json"); const { cachedGraphQuery } = require("../helper/cache"); @@ -7,9 +8,8 @@ const graphUrlList = { mantle: 'http://api.0xgraph.xyz/subgraphs/name/solv-payable-factory-mentle-0xgraph', } -const rwaSlot = [ - "77406646563329984090609229456139833989531434162860778120489803664660566620495" -] +const slotListUrl = 'https://cdn.jsdelivr.net/gh/solv-finance-dev/solv-protocol-rwa-slot/slot.json'; + async function tvl(ts, _, _1, { api }) { const network = api.chain; @@ -77,6 +77,8 @@ async function concrete(slots, api) { } async function getGraphData(timestamp, chain, api) { + let rwaSlot = (await getConfig('solv-protocol', slotListUrl)); + const slotDataQuery = `query BondSlotInfos { poolOrderInfos(first: 1000, where:{fundraisingEndTime_gt:${timestamp}, openFundShareSlot_in:${JSON.stringify(rwaSlot)}}) { marketContractAddress From e4ae39702fbaccf988b33911a457a3f2616a7fe2 Mon Sep 17 00:00:00 2001 From: llama Date: Tue, 3 Oct 2023 10:22:22 +0200 Subject: [PATCH 1425/1974] track ton locker --- projects/ton-locker/index.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 projects/ton-locker/index.js diff --git a/projects/ton-locker/index.js b/projects/ton-locker/index.js new file mode 100644 index 00000000000..cf43be5a418 --- /dev/null +++ b/projects/ton-locker/index.js @@ -0,0 +1,14 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { get } = require('../helper/http') +const { transformBalances } = require('../helper/portedTokens') + +module.exports = { + ton: { + tvl: () => ({}), + staking: async () => { + let ton_vault = "EQDtFpEwcFAEcRe5mLVh2N6C0x-_hJEM7W61_JLnSF74p4q2" + const res = await get(`https://tonapi.io/v1/account/getInfo?account=${ton_vault}`) + return await transformBalances('ton', {[ADDRESSES.null]: res.balance}) + } + }, +} \ No newline at end of file From 5d33fde7c6368deac54a476a72e0f352505ddb16 Mon Sep 17 00:00:00 2001 From: llama Date: Tue, 3 Oct 2023 11:59:00 +0200 Subject: [PATCH 1426/1974] update aeria --- projects/aeria/index.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/projects/aeria/index.js b/projects/aeria/index.js index 303a5afef2c..5303a68d2f8 100644 --- a/projects/aeria/index.js +++ b/projects/aeria/index.js @@ -9,8 +9,7 @@ async function tvl(timestamp, _1, _2, { api }) { const tokens = await api.multiCall({ abi: 'address:depositToken', calls: vaults }) - // needs to move funds to Multisig in under a month - if (timestamp * 1e3 < +new Date('10-10-2023')) await api.sumTokens({ owner: '0x8C8bA29f177CDEC445F4B5451B57946268D044Fa', tokens: [ADDRESSES.base.USDC]}) + await api.sumTokens({ owner: '0xe7C5e2D6E99f91Ec161B128702011D6E8f91570F', tokens: [ADDRESSES.base.USDC]}) return api.sumTokens({ tokensAndOwners2: [tokens, vaults]}) // const bals = await api.multiCall({ abi: 'uint256:totalSupply', calls: vaults }) // api.addTokens(tokens, bals) From df5a2c2465090a7b1fa6215c78145178e6de807d Mon Sep 17 00:00:00 2001 From: Michalis Kargakis Date: Tue, 3 Oct 2023 12:00:35 +0200 Subject: [PATCH 1427/1974] Track Solid World's CRISP-C pool (#7621) --- projects/solid-world/config.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/projects/solid-world/config.js b/projects/solid-world/config.js index 62aebe23f23..1b645e0272b 100644 --- a/projects/solid-world/config.js +++ b/projects/solid-world/config.js @@ -7,6 +7,11 @@ const config = { crispToken: "0xEF6Ab48ef8dFe984FAB0d5c4cD6AFF2E54dfdA14", hypervisor: "0x4a39cBb8198376AB08c24e596fF5E668c3ca269E", stakingContract: "0xaD7Ce5Cf8E594e1EFC6922Ab2c9F81d7a0E14337" + }, + { + crispToken: "0x672688C6Ee3E750dfaA4874743Ef693A6f2538ED", + hypervisor: "0x27420e641CE96a6C0191dbFA0A9500eaCe33531d", + stakingContract: "0xaD7Ce5Cf8E594e1EFC6922Ab2c9F81d7a0E14337" } ] } From ac4479741ffa14e916fe821419d9c57ad4acde3a Mon Sep 17 00:00:00 2001 From: llama Date: Tue, 3 Oct 2023 12:11:33 +0200 Subject: [PATCH 1428/1974] update aeria --- projects/aeria/index.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/projects/aeria/index.js b/projects/aeria/index.js index 5303a68d2f8..51c47e0404b 100644 --- a/projects/aeria/index.js +++ b/projects/aeria/index.js @@ -1,18 +1,16 @@ const { nullAddress } = require("../helper/tokenMapping"); -const ADDRESSES = require('../helper/coreAssets.json') const FACTORY = "0x649b80892ef773bd64cc3c663950dea3a604f660"; async function tvl(timestamp, _1, _2, { api }) { let vaults = await api.fetchList({ lengthAbi: 'uint256:vaultCount', itemAbi: 'function vaults(uint256) view returns (address)', target: FACTORY, startFromOne: true, }) vaults = vaults.filter(i => i !== nullAddress) - - const tokens = await api.multiCall({ abi: 'address:depositToken', calls: vaults }) + const isPaused = await api.multiCall({ abi: 'bool:paused', calls: vaults }) + vaults = vaults.filter((_, i) => !isPaused[i]) + const tokens = await api.multiCall({ abi: 'address:depositToken', calls: vaults }) - await api.sumTokens({ owner: '0xe7C5e2D6E99f91Ec161B128702011D6E8f91570F', tokens: [ADDRESSES.base.USDC]}) - return api.sumTokens({ tokensAndOwners2: [tokens, vaults]}) - // const bals = await api.multiCall({ abi: 'uint256:totalSupply', calls: vaults }) - // api.addTokens(tokens, bals) + await api.sumTokens({ owner: '0xe7C5e2D6E99f91Ec161B128702011D6E8f91570F', tokens }) + return api.sumTokens({ tokensAndOwners2: [tokens, vaults] }) } module.exports = { From e816eef7042ed041dc815df5bb7dbe8a51465ca4 Mon Sep 17 00:00:00 2001 From: define Date: Tue, 3 Oct 2023 14:48:00 +0100 Subject: [PATCH 1429/1974] add new staking pool --- projects/gainsNetwork.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/gainsNetwork.js b/projects/gainsNetwork.js index 8b8fd4fb1fd..11c16a24d28 100644 --- a/projects/gainsNetwork.js +++ b/projects/gainsNetwork.js @@ -47,6 +47,6 @@ module.exports = { }, arbitrum: { tvl: arbiTvl, - staking: staking('0x6b8d3c08072a020ac065c467ce922e3a36d3f9d6', '0x18c11fd286c5ec11c3b683caa813b77f5163a122'), + staking: staking(['0x6b8d3c08072a020ac065c467ce922e3a36d3f9d6', '0x7edDE7e5900633F698EaB0Dbc97DE640fC5dC015'], '0x18c11fd286c5ec11c3b683caa813b77f5163a122'), }, }; From 1d8fa4d058307ac41fa1f05c09fea9676a8a8d9e Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Tue, 3 Oct 2023 16:42:12 +0100 Subject: [PATCH 1430/1974] remove misrepresentedTokens flag --- projects/ondofinance/index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/projects/ondofinance/index.js b/projects/ondofinance/index.js index 74aa33372f4..699e1b2cbe2 100644 --- a/projects/ondofinance/index.js +++ b/projects/ondofinance/index.js @@ -2,7 +2,6 @@ const sdk = require('@defillama/sdk'); module.exports = { methodology: "Sums Ondo's fund supplies.", - misrepresentedTokens: true, doublecounted: true, }; From 491b23ec2a84a300e942be2208f2c49f1645eab0 Mon Sep 17 00:00:00 2001 From: llama Date: Tue, 3 Oct 2023 17:52:55 +0200 Subject: [PATCH 1431/1974] update aeria --- projects/aeria/index.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/projects/aeria/index.js b/projects/aeria/index.js index 51c47e0404b..a531de18e9f 100644 --- a/projects/aeria/index.js +++ b/projects/aeria/index.js @@ -7,13 +7,22 @@ async function tvl(timestamp, _1, _2, { api }) { vaults = vaults.filter(i => i !== nullAddress) const isPaused = await api.multiCall({ abi: 'bool:paused', calls: vaults }) vaults = vaults.filter((_, i) => !isPaused[i]) - const tokens = await api.multiCall({ abi: 'address:depositToken', calls: vaults }) + const tokens = await api.multiCall({ abi: 'address:depositToken', calls: vaults }) - await api.sumTokens({ owner: '0xe7C5e2D6E99f91Ec161B128702011D6E8f91570F', tokens }) - return api.sumTokens({ tokensAndOwners2: [tokens, vaults] }) + const last_epochs = await api.multiCall({ abi: 'uint:currentEpochNumber', calls: vaults }) + const epochs = await api.multiCall({ + abi: 'function epochs(uint) public view returns ( (uint8, uint256, uint256, uint256, uint256, uint256, uint256, uint256) )', + calls: vaults.map((vault, index) => { return { target: vault, params: [last_epochs[index] - 1 || 1] } }) + }) + + epochs.forEach((epoch, index) => { + api.add(tokens[index], parseInt(epoch[4]) || parseInt(epoch[2])) + }) + return api.getBalances() } module.exports = { + doublecouted: true, base: { tvl, }, From 9063c059a77648b0907d107c97d9edeaf6e86b72 Mon Sep 17 00:00:00 2001 From: daiwanwei <93238466+daiwanwei@users.noreply.github.com> Date: Wed, 4 Oct 2023 11:39:12 +0800 Subject: [PATCH 1432/1974] feat: add the boba chain for teahouse (#7624) Co-authored-by: Wade --- projects/teahouse-v3/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/teahouse-v3/index.js b/projects/teahouse-v3/index.js index 92ef625a682..9a0d15f3c31 100644 --- a/projects/teahouse-v3/index.js +++ b/projects/teahouse-v3/index.js @@ -17,7 +17,7 @@ async function getVaultContractsAddress(chain) { return plAddress; } -const chains = ["ethereum", "optimism", "arbitrum", 'polygon']; +const chains = ["ethereum", "optimism", "arbitrum", 'polygon', 'boba']; chains.forEach((chain) => { module.exports[chain] = { @@ -37,4 +37,4 @@ chains.forEach((chain) => { }; }); -module.exports.misrepresentedTokens = true \ No newline at end of file +module.exports.misrepresentedTokens = true From f4cac1b77f602f0d1efeda1389d1cb03b33a04f5 Mon Sep 17 00:00:00 2001 From: llama Date: Wed, 4 Oct 2023 05:43:01 +0200 Subject: [PATCH 1433/1974] fix thales treasury --- projects/treasury/thales.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/treasury/thales.js b/projects/treasury/thales.js index bf0446e5e29..2903175a761 100644 --- a/projects/treasury/thales.js +++ b/projects/treasury/thales.js @@ -19,7 +19,7 @@ module.exports = treasuryExports({ ADDRESSES.ethereum.USDC ], owners: [Treasury_ETH, Treasury_MULTICHAIN], - ownTokens: [THALES_ETH], + ownTokens: [THALES_ETH, '0x03e173ad8d1581a4802d3b532ace27a62c5b81dc'], }, optimism: { tokens: [ @@ -30,6 +30,7 @@ module.exports = treasuryExports({ ], owners: [Treasury_OP, Treasury_MULTICHAIN], ownTokens: [THALES_OP], + permitFailure: true, }, arbitrum: { tokens: [ From c30795c6fe291b348d0ca9dce6573abae9762b0e Mon Sep 17 00:00:00 2001 From: Oleksii Bereza <95891690+bircher044@users.noreply.github.com> Date: Wed, 4 Oct 2023 11:07:41 +0300 Subject: [PATCH 1434/1974] feat: added promethium adapter (#7623) * feat: added promethium adapter * code refactor --------- Co-authored-by: llama --- projects/promethium/index.js | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 projects/promethium/index.js diff --git a/projects/promethium/index.js b/projects/promethium/index.js new file mode 100644 index 00000000000..62a23e3c848 --- /dev/null +++ b/projects/promethium/index.js @@ -0,0 +1,29 @@ +const pools = [ + '0x7D7bf8B7FfC364CA7dDA1Bb66C88108F00086551', + '0x775AFb156D7bCa10bE12DC40E06e9E0EBFEb5E15', + '0x8648F1cd46B103F091a7a0f2EDD78Af492Aae788', + '0x0eeD421F88b0818Cba38aF96e33d1f42C988c726', + '0x32bD19a79DC462b9d18f2Db2593C78aB9ea630BC', +] + +const abi = { + "asset": "address:asset", + "totalAssets": "uint256:totalAssets" +} + +async function tvl(timestamp, block, chainBlocks, { api }) { + const tokens = await api.multiCall({ abi: abi.asset, calls: pools, permitFailure: true, }) + const bals = await api.multiCall({ abi: abi.totalAssets, calls: pools, permitFailure: true, }) + tokens.forEach((v, i) => { + if (v && bals[i]) api.add(v, bals[i]) + }) + return api.getBalances() +} + +module.exports = { + methodology: + "TVL displays the total amount of assets stored in the Promethium contracts, excluding not claimed fees.", + start: 1696164866, + arbitrum: { tvl }, + hallmarks: [[1696164866, "Profitable pools deployment"]], +}; From 8d34e7d90bbe0e68dd90bc330ca41020226ad803 Mon Sep 17 00:00:00 2001 From: cy-phiz <77606371+cy-phiz@users.noreply.github.com> Date: Wed, 4 Oct 2023 16:08:52 +0800 Subject: [PATCH 1435/1974] Add mantle (#7626) --- projects/xy-finance/index.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/projects/xy-finance/index.js b/projects/xy-finance/index.js index 2d481a69f35..38ddafe5a52 100644 --- a/projects/xy-finance/index.js +++ b/projects/xy-finance/index.js @@ -56,6 +56,9 @@ const config = { base: { chainId: '8453', }, + mantle: { + chainId: '5000', + }, } const ethAddress = '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE' @@ -344,6 +347,20 @@ const yPoolDepositContract = { "tokenAddress": ADDRESSES.base.USDbC } }, + "5000": { + "ETH": { + "contractAddress": "0xdD8B0995Cc92c7377c7bce2A097EC70f45A192D5", + "tokenAddress": ADDRESSES.mantle.WETH + }, + "USDC": { + "contractAddress": "0xA5Cb30E5d30A9843B6481fFd8D8D35DDED3a3251", + "tokenAddress": ADDRESSES.mantle.USDC + }, + "USDT": { + "contractAddress": "0x0241fb446d6793866245b936F2C3418F818bDcD3", + "tokenAddress": ADDRESSES.mantle.USDT + } + }, } module.exports={} From aef637c6413b5101667e567a0422769b1ca99564 Mon Sep 17 00:00:00 2001 From: ItsMeTazz <104685150+ItsMeTazz@users.noreply.github.com> Date: Wed, 4 Oct 2023 01:24:39 -0700 Subject: [PATCH 1436/1974] NewThrone - Game on Base chain (#7625) * Adding NewThrone * minor fix * minor fix --------- Co-authored-by: llama --- projects/newthrone/index.js | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 projects/newthrone/index.js diff --git a/projects/newthrone/index.js b/projects/newthrone/index.js new file mode 100644 index 00000000000..0e5f03ddd64 --- /dev/null +++ b/projects/newthrone/index.js @@ -0,0 +1,11 @@ +const { sumTokensExport } = require("../helper/unwrapLPs"); +const ADDRESSES= require("../helper/coreAssets.json"); + +const GAME_CONTRACT = '0x61C3A357bc3ca51b80eCD36CB1Ae37e5465C6701' + +module.exports = { + methodology: 'WETH tokens in the Game contract, which represents the current balance of the game (total spent - total claimed).', + base: { + tvl: sumTokensExport({ owner: GAME_CONTRACT, tokens: [ADDRESSES.base.WETH]}), + } +}; \ No newline at end of file From 71791d0967d252d2202752d9061acfb64723a82c Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Wed, 4 Oct 2023 17:32:35 +0100 Subject: [PATCH 1437/1974] fix cbeth --- projects/cbETH/index.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/projects/cbETH/index.js b/projects/cbETH/index.js index f6f07ba3b11..e0beb046705 100644 --- a/projects/cbETH/index.js +++ b/projects/cbETH/index.js @@ -1,10 +1,16 @@ -const sdk = require("@defillama/sdk") +const { default: axios } = require("axios") const token = '0xbe9895146f7af43049ca1c1ae358b0541ea49704' module.exports = { ethereum: { - tvl: async (_, block) => ({ - [token]: (await sdk.api.erc20.totalSupply({ target: token, block})).output - }) + tvl: async (timestamp, block) => { + if(timestamp < Date.now()/1e3 - 3600){ + throw new Error("Only works for current info") + } + const data = await axios.get("https://api.exchange.coinbase.com/wrapped-assets/CBETH") + return { + [token]: data.data.circulating_supply * 1e18 + } + } } } \ No newline at end of file From 4f1d60aa356c4e0bfcf643a6dd62d6ba349c42c2 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 5 Oct 2023 09:30:55 +0530 Subject: [PATCH 1438/1974] Iotabee (#7632) * Add project: Iotabee * code refactor --------- Co-authored-by: Qi Xi Co-authored-by: llama --- projects/helper/tokenMapping.js | 2 ++ projects/iotabee/index.js | 13 +++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 projects/iotabee/index.js diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 530e5762155..a34e7c6d671 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -58,6 +58,8 @@ const fixBalancesTokens = { shimmer_evm: { '0x1074010000000000000000000000000000000000': { coingeckoId: 'shimmer', decimals: 6 }, '0xBEb654A116aeEf764988DF0C6B4bf67CC869D01b': { coingeckoId: 'shimmer', decimals: 18 }, + '0x6c890075406c5df08b427609e3a2ead1851ad68d': { coingeckoId: 'shimmer', decimals: 18 }, + '0x3C844FB5AD27A078d945dDDA8076A4084A76E513': { coingeckoId: 'soonaverse', decimals: 6 }, '0xc0e49f8c615d3d4c245970f6dc528e4a47d69a44': { coingeckoId: 'tether', decimals: 18 }, '0xa158a39d00c79019a01a6e86c56e96c461334eb0': { coingeckoId: 'ethereum', decimals: 18 }, '0x1cdf3f46dbf8cf099d218cf96a769cea82f75316': { coingeckoId: 'wrapped-bitcoin', decimals: 8 }, diff --git a/projects/iotabee/index.js b/projects/iotabee/index.js new file mode 100644 index 00000000000..cd89332cb89 --- /dev/null +++ b/projects/iotabee/index.js @@ -0,0 +1,13 @@ +const { getConfig } = require('../helper/cache') +const { sumTokens2 } = require('../helper/unwrapLPs') + +const tvl = async (timestamp, ethBlock, chainBlocks, { api }) => { + const contracts = await getConfig('iotabee', 'https://dex.iotabee.com/v3/pools/overview') + return sumTokens2({ api, ownerTokens: contracts.map(({ token0, token1, contract }) => [[token0, token1,], contract]) }) +} + +module.exports = { + shimmer_evm: { + tvl + } +} From 3e1ef10887b614ded7767ad4d5737a2f8ac887bf Mon Sep 17 00:00:00 2001 From: 0xYFLOW <139814596+0xYFLOW@users.noreply.github.com> Date: Thu, 5 Oct 2023 08:01:37 +0400 Subject: [PATCH 1439/1974] Add Yieldflow TVL (#7627) * init * update adapter * Update index.js * code refactor --------- Co-authored-by: llama --- projects/yieldflow/index.js | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 projects/yieldflow/index.js diff --git a/projects/yieldflow/index.js b/projects/yieldflow/index.js new file mode 100644 index 00000000000..d20ea694e89 --- /dev/null +++ b/projects/yieldflow/index.js @@ -0,0 +1,37 @@ +const abi = { + "getCurrentTokenId": "function currentTokenId() view returns (uint)", + "getPositions": "function positions(uint256 tokenId) view returns (uint96 nonce,address operator,address token0,address token1,uint24 fee,int24 tickLower,int24 tickUpper,uint128 liquidity,uint256 feeGrowthInside0LastX128,uint256 feeGrowthInside1LastX128,uint128 tokensOwed0,uint128 tokensOwed1)", + "getAmountsForTicks": "function getAmountsForTicks(int24,int24,uint128) view returns (uint256,uint256)" +} + +const managers = [ + '0x69a3e2f167B35c88C9778F59Ce8C1fFc546c8078', + '0xe3f50A03525EF520818B111beC1F8c5D67fe307E', + '0x0F7E99716625FF6E47A4382CB177039ddc6c6Ef4', + '0x4878Acd29D8eFdF8D3E36f90D00fe242CAD792E5', + '0xbdf672C6895013c41F134F6b9B1fc51c74Fef9Ee', + '0xF33e335981F42fe4d93b8C23E3517E33Bd61C7e2', + '0x385D32300C3D500FC9Ab28010a98b039E0FF2c26', + '0x9000F4E184Aa2e0bDD1657d78c325c67508555D3', + '0x1A0E998eF8611142906230050ed3E75882313DAe', + '0x6EeFc6ceF687783F9eD767637Ae3cf06693c0A82', + '0x6205A335C76F3dE01f5D75a27E9C90b49A5C69dc' +] + +async function tvl(_, _1, _2, { api }) { + const positionManagers = await api.multiCall({ abi: 'address:positionManager', calls: managers}) + const tokenIds = await api.multiCall({ abi: abi.getCurrentTokenId, calls: managers}) + const liquidities = await api.multiCall({ abi: abi.getPositions, calls: positionManagers.map((v, i) => ({ target: v, params: tokenIds[i]})) }) + const tokenAmounts = await api.multiCall({ abi: abi.getAmountsForTicks, calls: liquidities.map((v, i) => ({ target: managers[i], params: [v.tickLower, v.tickUpper, v.liquidity]})) }) + + liquidities.forEach((v, i) => { + api.add(v.token0, tokenAmounts[i][0]) + api.add(v.token1, tokenAmounts[i][1]) + }) + return api.getBalances() +} + +module.exports = { + doublecounted: true, + arbitrum: { tvl }, +}; From 97fbe1dd57148832e92bce756d419e7866e0b774 Mon Sep 17 00:00:00 2001 From: Winson Cheng <83229800+0xKMG@users.noreply.github.com> Date: Thu, 5 Oct 2023 15:01:09 +0800 Subject: [PATCH 1440/1974] update TVL info for vaultka new vault - rum --- projects/vaultka/index.js | 38 +++++++++++++++++++++++++++++--------- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/projects/vaultka/index.js b/projects/vaultka/index.js index 0a2f8f22578..c84cd196d9f 100644 --- a/projects/vaultka/index.js +++ b/projects/vaultka/index.js @@ -17,8 +17,11 @@ module.exports = { "0x0081772FD29E4838372CbcCdD020f53954f5ECDE", // VodkaVault "0x6df0018b0449bB4468BfAE8507E13021a7aa0583", // WaterVault ]; - const bals = await api.multiCall({ abi: "int256:getVaultMarketValue", calls: vaults, }); - bals.forEach(i => api.add(ADDRESSES.arbitrum.USDC, i)) + const bals = await api.multiCall({ + abi: "int256:getVaultMarketValue", + calls: vaults, + }); + bals.forEach((i) => api.add(ADDRESSES.arbitrum.USDC, i)); const addresses = { whiskey: "0x6532eFCC1d617e094957247d188Ae6d54093718A", @@ -36,6 +39,9 @@ module.exports = { gmArb: "0xC25cEf6061Cf5dE5eb761b50E4743c1F5D7E5407", // arb/usdc.e VLP: "0xc5b2d9fda8a82e8dcecd5e9e6e99b78a9188eb05", gDAI: "0xd85e038593d7a098614721eae955ec2022b9b91b", + rum: "0x3CC5d01F9191e72082E00A4E8002b718B4C4218a", + hlpStaking: "0xbE8f8AF5953869222eA8D39F1Be9d03766010B1C", + hlp: "0x4307fbDCD9Ec7AEA5a1c2958deCaa6f316952bAb", }; await api.sumTokens({ @@ -51,20 +57,34 @@ module.exports = { [addresses.fsGlp, addresses.VodkaV1], [addresses.gmArb, addresses.vodkaV2], [addresses.gmWeth, addresses.vodkaV2], - ] - }) - + [addresses.hlp, addresses.rum], + ], + }); const contractAbis = { stakedVlpBalance: "function getStakedVlpBalance() public view returns (uint256)", + stakedHlpBalance: + "function userTokenAmount(address user) public view returns (uint256)", }; + const StakedVLPBal = await api.call({ + abi: contractAbis.stakedVlpBalance, + target: addresses.sake, + }); + const StakedVLPBalV2 = await api.call({ + abi: contractAbis.stakedVlpBalance, + target: addresses.sakeV2, + }); + const StakedHLPBal = await api.call({ + abi: contractAbis.stakedHlpBalance, + target: addresses.hlpStaking, + params: addresses.rum, + }); - const StakedVLPBal = await api.call({ abi: contractAbis.stakedVlpBalance, target: addresses.sake, }); - const StakedVLPBalV2 = await api.call({ abi: contractAbis.stakedVlpBalance, target: addresses.sakeV2, }); - api.add(addresses.VLP, StakedVLPBal) - api.add(addresses.VLP, StakedVLPBalV2) + api.add(addresses.VLP, StakedVLPBal); + api.add(addresses.VLP, StakedVLPBalV2); + api.add(addresses.hlp, StakedHLPBal); }, }, }; From 943a7c810f2aef358c79f2881bd37f0a371477d4 Mon Sep 17 00:00:00 2001 From: Barroso <128030542+barrosozeroliquid@users.noreply.github.com> Date: Thu, 5 Oct 2023 16:46:30 +0500 Subject: [PATCH 1441/1974] TVL and Staking amount added to the adapter (#7635) --- projects/helper/utils.js | 2 +- projects/treasury/silo-finance.js | 8 ++++---- projects/zeroliquid/index.js | 15 +++++++++++++++ 3 files changed, 20 insertions(+), 5 deletions(-) create mode 100644 projects/zeroliquid/index.js diff --git a/projects/helper/utils.js b/projects/helper/utils.js index 772d5ddf514..d53fdc428b2 100644 --- a/projects/helper/utils.js +++ b/projects/helper/utils.js @@ -286,7 +286,7 @@ async function debugBalances({ balances = {}, chain, log = false, tableLabel = ' }) sdk.log('Balance table for [%s] %s', chain, tableLabel) - console.table(logObj) + console.table(logObj.filter(i => !/\.(com|net|org|xyz)\s/.test(i.symbol))) } function once(func) { diff --git a/projects/treasury/silo-finance.js b/projects/treasury/silo-finance.js index 3e1fce0a8ce..abd27aba7f6 100644 --- a/projects/treasury/silo-finance.js +++ b/projects/treasury/silo-finance.js @@ -1,6 +1,5 @@ const ADDRESSES = require('../helper/coreAssets.json') -const { simulateTransaction } = require("@project-serum/anchor/dist/cjs/utils/rpc"); -const { nullAddress,treasuryExports } = require("../helper/treasury"); +const { nullAddress, treasuryExports } = require("../helper/treasury"); const ETHEREUM_MAINNET_TREASURIES = [ "0xE8e8041cB5E3158A0829A19E014CA1cf91098554", @@ -24,7 +23,7 @@ const SILO_ARBITRUM_MAINNET = "0x0341C0C0ec423328621788d4854119B97f44E391"; module.exports = treasuryExports({ ethereum: { - tokens: [ + tokens: [ nullAddress, ADDRESSES.ethereum.USDC,//USDC ADDRESSES.ethereum.DAI,//DAI @@ -41,9 +40,10 @@ module.exports = treasuryExports({ ], owners: ETHEREUM_MAINNET_TREASURIES, ownTokens: [SILO_ETHEREUM_MAINNET, XAI_ETHEREUM_MAINNET], + resolveUniV3: true, }, arbitrum: { - tokens: [ + tokens: [ nullAddress, ADDRESSES.arbitrum.ARB, // ARB ADDRESSES.arbitrum.GMX, // GMX diff --git a/projects/zeroliquid/index.js b/projects/zeroliquid/index.js new file mode 100644 index 00000000000..4a852f87fed --- /dev/null +++ b/projects/zeroliquid/index.js @@ -0,0 +1,15 @@ +const { staking } = require('../helper/staking') +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require('../helper/unwrapLPs') + +module.exports = { + methodology: 'Value of LSD tokens in the vault', + ethereum: { + tvl: sumTokensExport({ + owner: '0x0246e28C6B161764492E54CBF852e28A4DA2D672', + tokens: [ADDRESSES.ethereum.WSTETH, ADDRESSES.ethereum.RETH, ADDRESSES.ethereum.sfrxETH], + }), + staking: staking("0xb9b2d7a712402acb37a97f0ea6356ff271e065e2", '0xb0ed33f79d89541dfdcb04a8f04bc2c6be025ecc') + } +}; + From 36e11bbdfe15cb078becfa2d16d0756553ea6b19 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 5 Oct 2023 17:37:07 +0530 Subject: [PATCH 1442/1974] Insurace (#7636) * add dao tvl and bridge tvl * code refactor --------- Co-authored-by: yym-mtrlabs Co-authored-by: llama --- projects/insurace/abi.json | 3 - projects/insurace/avalanchePools.json | 34 ----- projects/insurace/index.js | 197 ++++++-------------------- projects/insurace/polygonPools.json | 34 ----- 4 files changed, 43 insertions(+), 225 deletions(-) delete mode 100644 projects/insurace/abi.json delete mode 100644 projects/insurace/avalanchePools.json delete mode 100644 projects/insurace/polygonPools.json diff --git a/projects/insurace/abi.json b/projects/insurace/abi.json deleted file mode 100644 index 9839e0f456c..00000000000 --- a/projects/insurace/abi.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "getStakedAmountPT": "function getStakedAmountPT(address _token) view returns (uint256)" -} \ No newline at end of file diff --git a/projects/insurace/avalanchePools.json b/projects/insurace/avalanchePools.json deleted file mode 100644 index c1f6c6c45f7..00000000000 --- a/projects/insurace/avalanchePools.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "pools": [ - { - "StakersPool": "0xF851cBB9940F8bAebd1D0EaF259335c108E9E893", - "PoolToken": "0x544c42fBB96B39B21DF61cf322b5EDC285EE7429", - "TokenTicker": "INSUR" - }, - { - "StakersPool": "0xF851cBB9940F8bAebd1D0EaF259335c108E9E893", - "PoolToken": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", - "TokenTicker": "AVAX" - }, - { - "StakersPool": "0xF851cBB9940F8bAebd1D0EaF259335c108E9E893", - "PoolToken": "0xA7D7079b0FEaD91F3e65f86E8915Cb59c1a4C664", - "TokenTicker": "USDC" - }, - { - "StakersPool": "0xF851cBB9940F8bAebd1D0EaF259335c108E9E893", - "PoolToken": "0xc7198437980c041c805A1EDcbA50c1Ce5db95118", - "TokenTicker": "USDT" - }, - { - "StakersPool": "0xF851cBB9940F8bAebd1D0EaF259335c108E9E893", - "PoolToken": "0xd586E7F844cEa2F87f50152665BCbc2C279D8d70", - "TokenTicker": "DAI" - }, - { - "StakersPool": "0xF851cBB9940F8bAebd1D0EaF259335c108E9E893", - "PoolToken": "0x49D5c2BdFfac6CE2BFdB6640F4F80f226bc10bAB", - "TokenTicker": "WETH" - } - ] -} \ No newline at end of file diff --git a/projects/insurace/index.js b/projects/insurace/index.js index cbd0b055ded..1237e0a9e3c 100644 --- a/projects/insurace/index.js +++ b/projects/insurace/index.js @@ -1,161 +1,50 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const sdk = require('@defillama/sdk'); -const abi = require('./abi.json'); +const { staking } = require('../helper/staking') +const { pool2 } = require('../helper/pool2') +const { sumTokens2 } = require('../helper/unwrapLPs') -const BigNumber = require('bignumber.js'); -const axios = require("axios"); -const polygonPools = require('./polygonPools.json') -const avalanchePools = require('./avalanchePools.json') const { getConfig } = require('../helper/cache') - -async function eth(timestamp, ethBlock) { - // ETH - // start timestamp: 1619248141 - // start ethBlock: 12301500 - // Stakers Pool creation time, Saturday, 24 April 2021 07:09:01 AM - if (ethBlock < 12301500) { - throw new Error("Not yet deployed") - } - const data = await getConfig('insurace/ethereum', "https://files.insurace.io/public/defipulse/pools.json"); - const pools = data.pools; - - const { output: _tvlList } = await sdk.api.abi.multiCall({ - calls: pools.map((pool) => ({ - target: pool.StakersPool, - params: pool.PoolToken, - })), - abi: abi["getStakedAmountPT"], - ethBlock, - } - ); - - const balances = {}; - _tvlList.forEach((element) => { - let address = element.input.params[0].toLowerCase(); - if (address == "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee") { - address = ADDRESSES.null; - } - let balance = element.output; - if (BigNumber(balance).toNumber() <= 0) { - return; - } - balances[address] = BigNumber(balances[address] || 0).plus(balance).toFixed(); - }) - const uniLPINSUR2USDC = "0x169bf778a5eadab0209c0524ea5ce8e7a616e33b"; - /* - await unwrapUniswapLPs(balances, [{ - token: uniLPINSUR2USDC, - balance: balances[uniLPINSuniLPINSUR2USDCUR2USDC] - }], ethBlock); - */ - delete balances[uniLPINSUR2USDC]; - return balances; +const config = { + ethereum: { + endpoint: "https://files.insurace.io/public/defipulse/ethPools.json", + INSUR: '0x544c42fBB96B39B21DF61cf322b5EDC285EE7429', + stakingPool: ['0x136D841d4beCe3Fc0E4dEbb94356D8b6B4b93209', '0xaFc3A52BF951c3540883e7156EaBA030E444328b', '0x7b768385022c4b8e0E2C1aC651793Ddf323eaa2A'], + pool2Pool: '0x136D841d4beCe3Fc0E4dEbb94356D8b6B4b93209', + pool2Token: '0x169BF778A5eADAB0209C0524EA5Ce8e7a616E33b', + }, + bsc: { + endpoint: "https://files.insurace.io/public/defipulse/bscPools.json", + INSUR: '0x3192CCDdf1CDcE4Ff055EbC80f3F0231b86A7E30', + stakingPool: ['0xd50E8Ce9D5c1f5228BCC77E318907bB4960578eF', '0x8937f826526076c74401edDCd19a41DE3d09D76d', '0x7b768385022c4b8e0E2C1aC651793Ddf323eaa2A'], + }, + polygon: { + endpoint: "https://files.insurace.io/public/defipulse/polygonPools.json", + INSUR: '0x8a0e8b4b0903929f47C3ea30973940D4a9702067', + stakingPool: ['0xD2171aBb60D2994CF9aCB767F2116Cf47BBF596F', '0xE8DBB5F68DE0aC5d4015737a27977db809cAC27D', '0x3FafFD846ba6d438d3346C92461C8B999D65024D'], + }, + avax: { + endpoint: "https://files.insurace.io/public/defipulse/avalanchePools.json", + INSUR: '0x544c42fBB96B39B21DF61cf322b5EDC285EE7429', + stakingPool: ['0xF851cBB9940F8bAebd1D0EaF259335c108E9E893', '0x645844f595309deB4637e184B366360807a2D986', '0x7b768385022c4b8e0E2C1aC651793Ddf323eaa2A'], + }, } -async function bsc(timestamp, ethBlock, chainBlocks){ - // BSC - // start bscBlock: 8312474 - // Stakers Pool creation time, Jun-15-2021 07:33:48 AM +UTC - const bscBlock = chainBlocks["bsc"] - if (bscBlock < 8312474) { - throw new Error("Not yet deployed") - } - const data = await getConfig('insurace/bsc', "https://files.insurace.io/public/defipulse/bscPools.json"); - const pools = data.pools; - const { output: _tvlList } = await sdk.api.abi.multiCall({ - calls: pools.map((pool) => ({ - target: pool.StakersPool, - params: pool.PoolToken, - })), - abi: abi["getStakedAmountPT"], - bscBlock, - chain: "bsc" +Object.keys(config).forEach(chain => { + const { endpoint, INSUR, stakingPool, pool2Pool, pool2Token, } = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + let blacklistedTokens = [] + if (INSUR) blacklistedTokens.push(INSUR) + if (pool2Token) blacklistedTokens.push(pool2Token) + blacklistedTokens = blacklistedTokens.flat() + const { pools } = await getConfig('insurace/'+api.chain, endpoint); + return sumTokens2({ api, blacklistedTokens, tokensAndOwners: pools.map(pool => [pool.PoolToken, pool.StakersPool])}) } - ); - - const balances = {}; - _tvlList.forEach((element) => { - let address = element.input.params[0].toLowerCase(); - if (address == "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee") { - address = "bsc:" + ADDRESSES.bsc.WBNB; - }else if (address == "0x3192ccddf1cdce4ff055ebc80f3f0231b86a7e30") { - address = "0x544c42fbb96b39b21df61cf322b5edc285ee7429"; - }else{ - address = `bsc:${address}`; - } - let balance = element.output; - if (BigNumber(balance).toNumber() <= 0) { - return; - } - balances[address] = BigNumber(balances[address] || 0).plus(balance).toFixed(); - }) - return balances; -} - -async function polygon(timestamp, ethBlock, chainBlocks) { - const pools = polygonPools.pools; - - const { output: _tvlList } = await sdk.api.abi.multiCall({ - calls: pools.map((pool) => ({ - target: pool.StakersPool, - params: pool.PoolToken, - })), - abi: abi["getStakedAmountPT"], - block: chainBlocks.polygon, - chain: 'polygon' - }); - - const balances = {}; - _tvlList.forEach((element) => { - let address = element.input.params[0].toLowerCase(); - if(address === "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"){ - address = ADDRESSES.polygon.WMATIC_2 - } - let balance = element.output; - sdk.util.sumSingleBalance(balances, 'polygon:'+address, balance) - }) - return balances; -} - -const INSUR = "0x544c42fbb96b39b21df61cf322b5edc285ee7429" -async function avax(timestamp, ethBlock, chainBlocks) { - const pools = avalanchePools.pools; - - const { output: _tvlList } = await sdk.api.abi.multiCall({ - calls: pools.map((pool) => ({ - target: pool.StakersPool, - params: pool.PoolToken, - })), - abi: abi["getStakedAmountPT"], - block: chainBlocks.avax, - chain: 'avax' - }); - - const balances = {}; - _tvlList.forEach((element) => { - let address = element.input.params[0].toLowerCase(); - if(address === "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"){ - address = ADDRESSES.avax.WAVAX - } - let balance = element.output; - sdk.util.sumSingleBalance(balances, address===INSUR?INSUR:'avax:'+address, balance) - }) - return balances; -} - -module.exports = { - ethereum: { - tvl: eth, - }, - bsc:{ - tvl: bsc - }, - polygon:{ - tvl: polygon - }, - avax:{ - tvl: avax - }, -} + } + if (INSUR && stakingPool) + module.exports[chain].staking = staking(stakingPool, INSUR) + + if (pool2Pool && pool2Token) + module.exports[chain].pool2 = pool2(pool2Pool, pool2Token) +}) diff --git a/projects/insurace/polygonPools.json b/projects/insurace/polygonPools.json deleted file mode 100644 index 0e9066f5592..00000000000 --- a/projects/insurace/polygonPools.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "pools": [ - { - "StakersPool": "0xD2171aBb60D2994CF9aCB767F2116Cf47BBF596F", - "PoolToken": "0x8a0e8b4b0903929f47C3ea30973940D4a9702067", - "TokenTicker": "INSUR" - }, - { - "StakersPool": "0xD2171aBb60D2994CF9aCB767F2116Cf47BBF596F", - "PoolToken": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", - "TokenTicker": "MATIC" - }, - { - "StakersPool": "0xD2171aBb60D2994CF9aCB767F2116Cf47BBF596F", - "PoolToken": "0x2791bca1f2de4661ed88a30c99a7a9449aa84174", - "TokenTicker": "USDC" - }, - { - "StakersPool": "0xD2171aBb60D2994CF9aCB767F2116Cf47BBF596F", - "PoolToken": "0xc2132d05d31c914a87c6611c10748aeb04b58e8f", - "TokenTicker": "USDT" - }, - { - "StakersPool": "0xD2171aBb60D2994CF9aCB767F2116Cf47BBF596F", - "PoolToken": "0x8f3cf7ad23cd3cadbd9735aff958023239c6a063", - "TokenTicker": "DAI" - }, - { - "StakersPool": "0xD2171aBb60D2994CF9aCB767F2116Cf47BBF596F", - "PoolToken": "0x7ceb23fd6bc0add59e62ac25578270cff1b9f619", - "TokenTicker": "WETH" - } - ] -} \ No newline at end of file From 42a73e11e798ebe660579b4cf8ba00f2516ac97f Mon Sep 17 00:00:00 2001 From: llama Date: Thu, 5 Oct 2023 15:35:27 +0200 Subject: [PATCH 1443/1974] track perennial v2 --- projects/perennial-v2/index.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 projects/perennial-v2/index.js diff --git a/projects/perennial-v2/index.js b/projects/perennial-v2/index.js new file mode 100644 index 00000000000..39ae25c53a4 --- /dev/null +++ b/projects/perennial-v2/index.js @@ -0,0 +1,21 @@ +const { getLogs } = require('../helper/cache/getLogs') + +const config = { + arbitrum: { factory: '0xad3565680aecee27a39249d8c2d55dac79be5ad0', fromBlock: 135921947 }, +} + +Object.keys(config).forEach(chain => { + const { factory, fromBlock, } = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const logs = await getLogs({ + api, + target: factory, + eventAbi: 'event VaultCreated (address indexed vault, address indexed asset, address initialMarket)', + onlyArgs: true, + fromBlock, + }) + return api.sumTokens({ tokensAndOwners: logs.map(log => [log.asset, log.initialMarket])}) + } + } +}) \ No newline at end of file From 8f99e94ca5349d37ba56e4749c4249129ba78864 Mon Sep 17 00:00:00 2001 From: define Date: Thu, 5 Oct 2023 16:16:47 +0100 Subject: [PATCH 1444/1974] binance cex new ltc wallet --- projects/binance/config.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/binance/config.js b/projects/binance/config.js index 35f9d7f5f32..79ae9c6e23b 100644 --- a/projects/binance/config.js +++ b/projects/binance/config.js @@ -273,6 +273,7 @@ const assetList = [ ["LTC", "LTC", "MSeDRiNoH5Afr9b9rNo837hYzpxBXXqMZf"], ["LTC", "LTC", "MWGTiJBNEQSfxTCrdC2VKEa55Lck27wr67"], ["LTC", "LTC", "MWkX1ZaFbrRPtcQvVpjvigxWU17JoinePy"], + ["LTC", "LTC", "MGvUTN1PuWgBxuoFgTfkk4eJDzYgRivR8F"], ["MASK", "BEP20", "0x5a52e96bacdabb82fd05763e25335261b270efcb"], ["MASK", "BEP20", "0x8894e0a0c962cb723c1976a4421c95949be2d4e3"], ["MASK", "BEP20", "0xe2fc31f816a9b94326492132018c3aecc4a93ae1"], From 2cb2edfa1dd7347a207d7dbb48f5cd0429b1b4d8 Mon Sep 17 00:00:00 2001 From: Guido Peirano Date: Thu, 5 Oct 2023 13:38:33 -0300 Subject: [PATCH 1445/1974] Adding Mountain Token TVL (#7629) --- projects/mountain-protocol/index.js | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 projects/mountain-protocol/index.js diff --git a/projects/mountain-protocol/index.js b/projects/mountain-protocol/index.js new file mode 100644 index 00000000000..9a9d10bbdae --- /dev/null +++ b/projects/mountain-protocol/index.js @@ -0,0 +1,29 @@ +const sdk = require("@defillama/sdk"); +const MOUNTAIN_PROTOCOL_CONTRACT = "0x59d9356e565ab3a36dd77763fc0d87feaf85508c"; +const TBILL_VAULT_CLUB_BOND_CONTRACT = + "0xd86FFB404147163e19E010a0e9d4995E0e36F335"; + +async function tvl(_, _1, _2, { api }) { + const totalSupply = await api.call({ + abi: "erc20:totalSupply", + target: MOUNTAIN_PROTOCOL_CONTRACT, + }); + + const decimals = await api.call({ + abi: "erc20:decimals", + target: MOUNTAIN_PROTOCOL_CONTRACT, + }); + + return { + "usd-coin": totalSupply / 10 ** decimals, + }; +} + +module.exports = { + misrepresentedTokens: true, + methodology: "Calculates the total USDM Supply", + start: 16685700, + ethereum: { + tvl, + }, +}; From 4cd8b8b8cb25e01c7e003adfc1313bcd989a6b99 Mon Sep 17 00:00:00 2001 From: Winson Cheng <83229800+0xKMG@users.noreply.github.com> Date: Fri, 6 Oct 2023 10:07:07 +0800 Subject: [PATCH 1446/1974] add hlp price --- projects/vaultka/index.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/projects/vaultka/index.js b/projects/vaultka/index.js index c84cd196d9f..31b3517348b 100644 --- a/projects/vaultka/index.js +++ b/projects/vaultka/index.js @@ -39,7 +39,7 @@ module.exports = { gmArb: "0xC25cEf6061Cf5dE5eb761b50E4743c1F5D7E5407", // arb/usdc.e VLP: "0xc5b2d9fda8a82e8dcecd5e9e6e99b78a9188eb05", gDAI: "0xd85e038593d7a098614721eae955ec2022b9b91b", - rum: "0x3CC5d01F9191e72082E00A4E8002b718B4C4218a", + rum: "0x739fe1BE8CbBeaeA96fEA55c4052Cd87796c0a89", hlpStaking: "0xbE8f8AF5953869222eA8D39F1Be9d03766010B1C", hlp: "0x4307fbDCD9Ec7AEA5a1c2958deCaa6f316952bAb", }; @@ -66,6 +66,8 @@ module.exports = { "function getStakedVlpBalance() public view returns (uint256)", stakedHlpBalance: "function userTokenAmount(address user) public view returns (uint256)", + hlpPrice: + "function getHLPPrice(bool maximize) public view returns (uint256)", }; const StakedVLPBal = await api.call({ @@ -82,9 +84,17 @@ module.exports = { params: addresses.rum, }); + //12 decimals + const hlpPrice = await api.call({ + abi: contractAbis.hlpPrice, + target: addresses.rum, + params: true, + }); + console.log(StakedHLPBal); + api.add(addresses.VLP, StakedVLPBal); api.add(addresses.VLP, StakedVLPBalV2); - api.add(addresses.hlp, StakedHLPBal); + api.add(ADDRESSES.arbitrum.USDC, (StakedHLPBal * hlpPrice) / 1e12 / 1e18 * 1e6); }, }, }; From 0f03eca1725a5ac832102ef3957b571917c3b486 Mon Sep 17 00:00:00 2001 From: Winson Cheng <83229800+0xKMG@users.noreply.github.com> Date: Fri, 6 Oct 2023 10:15:03 +0800 Subject: [PATCH 1447/1974] chore: add comments for unused code --- projects/vaultka/index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/projects/vaultka/index.js b/projects/vaultka/index.js index 31b3517348b..d71b8fbcc70 100644 --- a/projects/vaultka/index.js +++ b/projects/vaultka/index.js @@ -94,7 +94,9 @@ module.exports = { api.add(addresses.VLP, StakedVLPBal); api.add(addresses.VLP, StakedVLPBalV2); + //calculation before the update api.add(ADDRESSES.arbitrum.USDC, (StakedHLPBal * hlpPrice) / 1e12 / 1e18 * 1e6); + // api.add(addresses.hlp, StakedHLPBal); }, }, }; From bdd189654fa059821cc5a893bda1e687125632d4 Mon Sep 17 00:00:00 2001 From: llama Date: Fri, 6 Oct 2023 05:31:25 +0200 Subject: [PATCH 1448/1974] move price computation to server: https://github.com/DefiLlama/defillama-server/commit/b5b2226abaae03dc7ffc95a41ba2f6d754cb57b9 --- projects/vaultka/index.js | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/projects/vaultka/index.js b/projects/vaultka/index.js index d71b8fbcc70..1c6578ef759 100644 --- a/projects/vaultka/index.js +++ b/projects/vaultka/index.js @@ -66,7 +66,6 @@ module.exports = { "function getStakedVlpBalance() public view returns (uint256)", stakedHlpBalance: "function userTokenAmount(address user) public view returns (uint256)", - hlpPrice: "function getHLPPrice(bool maximize) public view returns (uint256)", }; @@ -84,19 +83,10 @@ module.exports = { params: addresses.rum, }); - //12 decimals - const hlpPrice = await api.call({ - abi: contractAbis.hlpPrice, - target: addresses.rum, - params: true, - }); - console.log(StakedHLPBal); api.add(addresses.VLP, StakedVLPBal); api.add(addresses.VLP, StakedVLPBalV2); - //calculation before the update - api.add(ADDRESSES.arbitrum.USDC, (StakedHLPBal * hlpPrice) / 1e12 / 1e18 * 1e6); - // api.add(addresses.hlp, StakedHLPBal); + api.add(addresses.hlp, StakedHLPBal); }, }, }; From 07dd145ba756aa332631486e621e8ccbb590991e Mon Sep 17 00:00:00 2001 From: Cock Fights Game <92815666+CockFightsGame@users.noreply.github.com> Date: Fri, 6 Oct 2023 08:35:38 +0500 Subject: [PATCH 1449/1974] add cockfightsgame (#7637) Co-authored-by: Gallaam --- projects/cockfightsgame/constants.js | 3 +++ projects/cockfightsgame/index.js | 10 ++++++++++ projects/cockfightsgame/tvl.js | 17 +++++++++++++++++ 3 files changed, 30 insertions(+) create mode 100644 projects/cockfightsgame/constants.js create mode 100644 projects/cockfightsgame/index.js create mode 100644 projects/cockfightsgame/tvl.js diff --git a/projects/cockfightsgame/constants.js b/projects/cockfightsgame/constants.js new file mode 100644 index 00000000000..773173b71ee --- /dev/null +++ b/projects/cockfightsgame/constants.js @@ -0,0 +1,3 @@ +module.exports = { + POOL_ADDRESS: 'EQAgpXksmpJdcItdKvn97G0zD844iztZuKJa_3JnRr0XkCdD' +} diff --git a/projects/cockfightsgame/index.js b/projects/cockfightsgame/index.js new file mode 100644 index 00000000000..4f6ca9bb6d9 --- /dev/null +++ b/projects/cockfightsgame/index.js @@ -0,0 +1,10 @@ +const { tvl } = require('./tvl'); + +module.exports = { + methodology: 'Counts the pool size as the TVL.', + timetravel: false, + misrepresentedTokens: true, + ton: { + tvl, + } +} diff --git a/projects/cockfightsgame/tvl.js b/projects/cockfightsgame/tvl.js new file mode 100644 index 00000000000..ad7f92ebd7c --- /dev/null +++ b/projects/cockfightsgame/tvl.js @@ -0,0 +1,17 @@ +const sdk = require("@defillama/sdk"); +const { get } = require("../helper/http"); +const { transformBalances } = require("../helper/portedTokens"); +const ADDRESSES = require("../helper/coreAssets.json"); +const { POOL_ADDRESS } = require("./constants"); +const nullAddress = ADDRESSES.null; + +async function tvl(chain, timestamp, chainBlocks, { api }) { + const balances = {}; + const balance = await get(`https://toncenter.com/api/v2/getAddressBalance?address=${encodeURIComponent(POOL_ADDRESS)}`) + sdk.util.sumSingleBalance(balances, nullAddress, balance.result, api.chain); + return transformBalances(api.chain, balances); +} + +module.exports = { + tvl, +} From 457751b081596bf499bd5f90dea740bd18bd61ee Mon Sep 17 00:00:00 2001 From: helloescrow <146586055+helloescrow@users.noreply.github.com> Date: Thu, 5 Oct 2023 23:00:47 -0500 Subject: [PATCH 1450/1974] adding escrows metrics (#7639) * adding escrows metrics adding the metrics, for volume and TVL for the platform escrow contract * removed TVL and updated comment message not sure on methodology need assistance here * minor fix --------- Co-authored-by: peanutjarvis139 Co-authored-by: llama --- projects/escrow/index.js | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 projects/escrow/index.js diff --git a/projects/escrow/index.js b/projects/escrow/index.js new file mode 100644 index 00000000000..4705a709a13 --- /dev/null +++ b/projects/escrow/index.js @@ -0,0 +1,10 @@ +const { sumTokensExport, nullAddress } = require("../helper/unwrapLPs"); + +const contract = "0x2a412Df7e18B847e953c2Bc6ae90581dEe8571e3"; + +module.exports = { + methodology: `We count the eth escrowed in ${contract}`, + ethereum: { + tvl: sumTokensExport({ owner: contract, tokens: [nullAddress]}), + }, +}; From 7dd41c4933da55a08380827e2451f00ab4baf290 Mon Sep 17 00:00:00 2001 From: llama Date: Fri, 6 Oct 2023 06:02:06 +0200 Subject: [PATCH 1451/1974] lint fix --- projects/vaultka/index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/projects/vaultka/index.js b/projects/vaultka/index.js index 1c6578ef759..113c5e047c6 100644 --- a/projects/vaultka/index.js +++ b/projects/vaultka/index.js @@ -66,7 +66,6 @@ module.exports = { "function getStakedVlpBalance() public view returns (uint256)", stakedHlpBalance: "function userTokenAmount(address user) public view returns (uint256)", - "function getHLPPrice(bool maximize) public view returns (uint256)", }; const StakedVLPBal = await api.call({ From b255142c094b324f20b2ef36cf15f067e11c4a6a Mon Sep 17 00:00:00 2001 From: Elliot Shiu Date: Thu, 5 Oct 2023 23:48:13 -0700 Subject: [PATCH 1452/1974] arcadexyz: track nfts held by v3 loan core (#7640) --- projects/arcade-xyz/index.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/projects/arcade-xyz/index.js b/projects/arcade-xyz/index.js index c1dd058047a..ae5a91161d5 100644 --- a/projects/arcade-xyz/index.js +++ b/projects/arcade-xyz/index.js @@ -7,6 +7,7 @@ const { sumArtBlocks, isArtBlocks, } = require('../helper/nft'); const { LOAN_CORE, + LOAN_CORE_V3, START_BLOCKS, VAULT_FACTORY_A, } = require('./constants'); @@ -38,7 +39,7 @@ async function tvl(_, block, _cb, { api }) { // Initialize balances with tokens held by the escrow contract, Loan Core return sumTokens2({ balances, - owners: [LOAN_CORE], + owners: [LOAN_CORE, LOAN_CORE_V3], resolveNFTs: true, api, }); @@ -77,4 +78,8 @@ module.exports = { methodology: `Sums up the floor value of all vaulted and escrowed NFTs with Chainlink price feeds. Borrowed coins are not counted towards the TVL`, start: START_BLOCKS[VAULT_FACTORY_A], ethereum: { tvl, borrowed }, + hallmarks: [ + [1660762840, 'V2 Protocol Launch'], + [1694026811, 'V3 Protocol Launch'], + ], } From dbf9c2fb1f88de6651efdf83c0daf3fc3297a1b3 Mon Sep 17 00:00:00 2001 From: llama Date: Fri, 6 Oct 2023 11:21:45 +0200 Subject: [PATCH 1453/1974] track sdai --- projects/sdai/index.js | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 projects/sdai/index.js diff --git a/projects/sdai/index.js b/projects/sdai/index.js new file mode 100644 index 00000000000..52c0e13b2e0 --- /dev/null +++ b/projects/sdai/index.js @@ -0,0 +1,8 @@ +const { sumTokensExport } = require('../helper/unwrapLPs') +const ADDRESSES = require('../helper/coreAssets.json') + +module.exports = { + xdai: { + tvl: sumTokensExport({ owner: '0xaf204776c7245bF4147c2612BF6e5972Ee483701', tokens: [ADDRESSES.xdai.WXDAI] }) + } +} \ No newline at end of file From e3885af0554c482dc884ade4503f5127415921de Mon Sep 17 00:00:00 2001 From: llama Date: Fri, 6 Oct 2023 11:46:57 +0200 Subject: [PATCH 1454/1974] fix silo treasury --- projects/helper/unwrapLPs.js | 7 +++ projects/treasury/silo-finance.js | 93 ++++++++++++++++++------------- 2 files changed, 61 insertions(+), 39 deletions(-) diff --git a/projects/helper/unwrapLPs.js b/projects/helper/unwrapLPs.js index 273aefb5007..290ed8b2191 100644 --- a/projects/helper/unwrapLPs.js +++ b/projects/helper/unwrapLPs.js @@ -672,6 +672,7 @@ async function sumTokens2({ uniV3nftsAndOwners = [], resolveArtBlocks = false, resolveNFTs = false, + resolveVlCVX = false, permitFailure = false, fetchCoValentTokens = false, tokenConfig = {}, @@ -682,6 +683,7 @@ async function sumTokens2({ if (!balances) balances = api.getBalances() } else if (!balances) { balances = {} + api = new sdk.ChainApi({ chain, block }) } if (owner) owners.push(owner) @@ -694,6 +696,11 @@ async function sumTokens2({ await sumArtBlocks({ balances, api, owner, owners, }) } + if (resolveVlCVX && owners.length && chain === 'ethereum') { + const vlCVXBals = await api.multiCall({ abi: 'erc20:balanceOf', calls: owners, target: ADDRESSES.ethereum.vlCVX }) + vlCVXBals.forEach((v) => sdk.util.sumSingleBalance(balances, ADDRESSES.ethereum.vlCVX, v, chain)) + } + if (fetchCoValentTokens) { const cTokens = (await Promise.all(owners.map(i => covalentGetTokens(i, api, tokenConfig)))) cTokens.forEach((tokens, i) => ownerTokens.push([tokens, owners[i]])) diff --git a/projects/treasury/silo-finance.js b/projects/treasury/silo-finance.js index abd27aba7f6..32550309097 100644 --- a/projects/treasury/silo-finance.js +++ b/projects/treasury/silo-finance.js @@ -1,5 +1,6 @@ const ADDRESSES = require('../helper/coreAssets.json') const { nullAddress, treasuryExports } = require("../helper/treasury"); +const { mergeExports } = require('../helper/utils'); const ETHEREUM_MAINNET_TREASURIES = [ "0xE8e8041cB5E3158A0829A19E014CA1cf91098554", @@ -21,43 +22,57 @@ const ARBITRUM_MAINNET_TREASURIES = [ const SILO_ARBITRUM_MAINNET = "0x0341C0C0ec423328621788d4854119B97f44E391"; -module.exports = treasuryExports({ - ethereum: { - tokens: [ - nullAddress, - ADDRESSES.ethereum.USDC,//USDC - ADDRESSES.ethereum.DAI,//DAI - ADDRESSES.ethereum.LUSD,//LUSD - ADDRESSES.ethereum.WETH,//WETH - ADDRESSES.ethereum.USDT,//USDT - ADDRESSES.ethereum.TOKE,//TOKE - ADDRESSES.ethereum.CVX, // CVX - ADDRESSES.ethereum.YFI, // YFI - ADDRESSES.ethereum.CRV, // CRV - "0xf939E0A03FB07F59A73314E73794Be0E57ac1b4E", // crvUSD - "0xc944E90C64B2c07662A292be6244BDf05Cda44a7", // GRT - "0x3432B6A60D23Ca0dFCa7761B7ab56459D9C964D0" // FXS - ], - owners: ETHEREUM_MAINNET_TREASURIES, - ownTokens: [SILO_ETHEREUM_MAINNET, XAI_ETHEREUM_MAINNET], - resolveUniV3: true, - }, - arbitrum: { - tokens: [ - nullAddress, - ADDRESSES.arbitrum.ARB, // ARB - ADDRESSES.arbitrum.GMX, // GMX - "0xaf88d065e77c8cC2239327C5EDb3A432268e5831", // USDC Native - "0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8", // USDC.e (Bridged) - "0x6C2C06790b3E3E3c38e12Ee22F8183b37a13EE55", // DPX - "0x18c11FD286C5EC11c3b683Caa813B77f5163A122", // GNS - "0x51fC0f6660482Ea73330E414eFd7808811a57Fa2", // PREMIA - "0xd4d42F0b6DEF4CE0383636770eF773390d85c61A", // SUSHI - "0x1622bF67e6e5747b81866fE0b85178a93C7F86e3", // UMAMI - "0x539bdE0d7Dbd336b79148AA742883198BBF60342", // MAGIC - "0xFa7F8980b0f1E64A2062791cc3b0871572f1F7f0", // UNI - ], - owners: ARBITRUM_MAINNET_TREASURIES, - ownTokens: [SILO_ARBITRUM_MAINNET], +module.exports = mergeExports([ + treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.USDC,//USDC + ADDRESSES.ethereum.DAI,//DAI + ADDRESSES.ethereum.LUSD,//LUSD + ADDRESSES.ethereum.WETH,//WETH + ADDRESSES.ethereum.USDT,//USDT + ADDRESSES.ethereum.TOKE,//TOKE + ADDRESSES.ethereum.CVX, // CVX + ADDRESSES.ethereum.YFI, // YFI + ADDRESSES.ethereum.CRV, // CRV + "0xf939E0A03FB07F59A73314E73794Be0E57ac1b4E", // crvUSD + "0xc944E90C64B2c07662A292be6244BDf05Cda44a7", // GRT + "0x3432B6A60D23Ca0dFCa7761B7ab56459D9C964D0" // FXS + ], + owners: ETHEREUM_MAINNET_TREASURIES, + ownTokens: [SILO_ETHEREUM_MAINNET, XAI_ETHEREUM_MAINNET], + resolveUniV3: true, + resolveVlCVX: true, + }, + arbitrum: { + tokens: [ + nullAddress, + ADDRESSES.arbitrum.ARB, // ARB + ADDRESSES.arbitrum.GMX, // GMX + "0xaf88d065e77c8cC2239327C5EDb3A432268e5831", // USDC Native + "0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8", // USDC.e (Bridged) + "0x6C2C06790b3E3E3c38e12Ee22F8183b37a13EE55", // DPX + "0x18c11FD286C5EC11c3b683Caa813B77f5163A122", // GNS + "0x51fC0f6660482Ea73330E414eFd7808811a57Fa2", // PREMIA + "0xd4d42F0b6DEF4CE0383636770eF773390d85c61A", // SUSHI + "0x1622bF67e6e5747b81866fE0b85178a93C7F86e3", // UMAMI + "0x539bdE0d7Dbd336b79148AA742883198BBF60342", // MAGIC + "0xFa7F8980b0f1E64A2062791cc3b0871572f1F7f0", // UNI + ], + owners: ARBITRUM_MAINNET_TREASURIES, + ownTokens: [SILO_ARBITRUM_MAINNET], + } + }), + { + ethereum: { tvl } } -}) \ No newline at end of file +]) + +async function tvl(_, _b, _cb, { api, }) { + const convexStakingProxy = '0x5754B88287A88dfA3d02cfb87747E340A840c70A' + const fraxFarm = '0x4edF7C64dAD8c256f6843AcFe56876024b54A1b6' + const liquidity = await api.call({ abi: 'function lockedLiquidityOf(address) view returns (uint256)', target: fraxFarm, params: convexStakingProxy }) + api.add('0x326290A1B0004eeE78fa6ED4F1d8f4b2523ab669', liquidity) + return api.getBalances() +} \ No newline at end of file From d9a5cd8ea20d9fe55a7ac91a16fb7ab583fad77c Mon Sep 17 00:00:00 2001 From: llama Date: Fri, 6 Oct 2023 12:51:23 +0200 Subject: [PATCH 1455/1974] track contango v2 --- projects/contango-v2/index.js | 26 ++++++++++++++++++++++++++ projects/contango/index.js | 3 --- projects/helper/utils.js | 2 +- projects/treasury/contango.js | 12 ++++++++++++ 4 files changed, 39 insertions(+), 4 deletions(-) create mode 100644 projects/contango-v2/index.js create mode 100644 projects/treasury/contango.js diff --git a/projects/contango-v2/index.js b/projects/contango-v2/index.js new file mode 100644 index 00000000000..09112de0b02 --- /dev/null +++ b/projects/contango-v2/index.js @@ -0,0 +1,26 @@ +const { getLogs } = require("../helper/cache/getLogs") + +const config = { + arbitrum: { + contango: '0x6Cae28b3D09D8f8Fc74ccD496AC986FC84C0C24E', + fromBlock: 120103720, + }, +} + +Object.keys(config).forEach(chain => { + const { contango, fromBlock } = config[chain] + module.exports[chain] = { + tvl: async (timestamp, _b, chainBlocks, { api }) => { + const logs = await getLogs({ + api, + target: contango, + eventAbi: "event InstrumentCreated(bytes16 indexed symbol, address base, address quote)", + onlyArgs: true, + fromBlock, + }) + const vault = await api.call({ abi: 'address:vault', target: contango}) + return api.sumTokens({ owner: vault, tokens: logs.map(log => [log.base, log.quote]).flat()}) + + } + } +}) diff --git a/projects/contango/index.js b/projects/contango/index.js index 8119e60516d..76f24a1a036 100644 --- a/projects/contango/index.js +++ b/projects/contango/index.js @@ -13,9 +13,6 @@ const config = { }, } -module.exports = { -}; - Object.keys(config).forEach(chain => { const { ladle, fromBlock } = config[chain] module.exports[chain] = { diff --git a/projects/helper/utils.js b/projects/helper/utils.js index d53fdc428b2..8f50b47f92d 100644 --- a/projects/helper/utils.js +++ b/projects/helper/utils.js @@ -286,7 +286,7 @@ async function debugBalances({ balances = {}, chain, log = false, tableLabel = ' }) sdk.log('Balance table for [%s] %s', chain, tableLabel) - console.table(logObj.filter(i => !/\.(com|net|org|xyz)\s/.test(i.symbol))) + console.table(logObj.filter(i => !/\.(com|net|org|xyz|site)\s/.test(i.symbol))) } function once(func) { diff --git a/projects/treasury/contango.js b/projects/treasury/contango.js new file mode 100644 index 00000000000..860f2d1665e --- /dev/null +++ b/projects/treasury/contango.js @@ -0,0 +1,12 @@ +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasuryARB = "0x643178CF8AEc063962654CAc256FD1f7fe06ac28" + +module.exports = treasuryExports({ + arbitrum: { + tokens: [ + nullAddress, + ], + owners: [treasuryARB], + }, +}); From bc575943be85a43e32d54804d6b0fe32131b3c5a Mon Sep 17 00:00:00 2001 From: yym-MetaRisk <95009952+yym-MetaRisk@users.noreply.github.com> Date: Fri, 6 Oct 2023 20:00:21 +0800 Subject: [PATCH 1456/1974] remove staking pool (#7642) --- projects/insurace/index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/projects/insurace/index.js b/projects/insurace/index.js index 1237e0a9e3c..d43c9ef77d6 100644 --- a/projects/insurace/index.js +++ b/projects/insurace/index.js @@ -8,24 +8,24 @@ const config = { ethereum: { endpoint: "https://files.insurace.io/public/defipulse/ethPools.json", INSUR: '0x544c42fBB96B39B21DF61cf322b5EDC285EE7429', - stakingPool: ['0x136D841d4beCe3Fc0E4dEbb94356D8b6B4b93209', '0xaFc3A52BF951c3540883e7156EaBA030E444328b', '0x7b768385022c4b8e0E2C1aC651793Ddf323eaa2A'], + stakingPool: ['0x136D841d4beCe3Fc0E4dEbb94356D8b6B4b93209', '0xaFc3A52BF951c3540883e7156EaBA030E444328b'], pool2Pool: '0x136D841d4beCe3Fc0E4dEbb94356D8b6B4b93209', pool2Token: '0x169BF778A5eADAB0209C0524EA5Ce8e7a616E33b', }, bsc: { endpoint: "https://files.insurace.io/public/defipulse/bscPools.json", INSUR: '0x3192CCDdf1CDcE4Ff055EbC80f3F0231b86A7E30', - stakingPool: ['0xd50E8Ce9D5c1f5228BCC77E318907bB4960578eF', '0x8937f826526076c74401edDCd19a41DE3d09D76d', '0x7b768385022c4b8e0E2C1aC651793Ddf323eaa2A'], + stakingPool: ['0xd50E8Ce9D5c1f5228BCC77E318907bB4960578eF', '0x8937f826526076c74401edDCd19a41DE3d09D76d'], }, polygon: { endpoint: "https://files.insurace.io/public/defipulse/polygonPools.json", INSUR: '0x8a0e8b4b0903929f47C3ea30973940D4a9702067', - stakingPool: ['0xD2171aBb60D2994CF9aCB767F2116Cf47BBF596F', '0xE8DBB5F68DE0aC5d4015737a27977db809cAC27D', '0x3FafFD846ba6d438d3346C92461C8B999D65024D'], + stakingPool: ['0xD2171aBb60D2994CF9aCB767F2116Cf47BBF596F', '0xE8DBB5F68DE0aC5d4015737a27977db809cAC27D'], }, avax: { endpoint: "https://files.insurace.io/public/defipulse/avalanchePools.json", INSUR: '0x544c42fBB96B39B21DF61cf322b5EDC285EE7429', - stakingPool: ['0xF851cBB9940F8bAebd1D0EaF259335c108E9E893', '0x645844f595309deB4637e184B366360807a2D986', '0x7b768385022c4b8e0E2C1aC651793Ddf323eaa2A'], + stakingPool: ['0xF851cBB9940F8bAebd1D0EaF259335c108E9E893', '0x645844f595309deB4637e184B366360807a2D986'], }, } From 1ff1c0dc6b4e34507099a8fb9e953dafa4d2c0fc Mon Sep 17 00:00:00 2001 From: Winson Cheng <83229800+0xKMG@users.noreply.github.com> Date: Fri, 6 Oct 2023 20:01:33 +0800 Subject: [PATCH 1457/1974] add hallmarks for vault launch (#7644) * add hallmarks for vault launch * Update index.js --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/vaultka/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/vaultka/index.js b/projects/vaultka/index.js index 113c5e047c6..db61306a358 100644 --- a/projects/vaultka/index.js +++ b/projects/vaultka/index.js @@ -6,9 +6,10 @@ module.exports = { hallmarks: [ [1688342964, "VLP Leverage Vault"], [1692164391, "GLP Leverage Vault"], - [1695274791, "GMXV2 Leverage Vault "], + [1695274791, "GMXV2 Leverage Vault"], [1682314791, "GLP Delta Neutral Vault"], [1683178791, "GDAI Leverage Vault"], + [1696389409, "HLP Leverage Vault"], ], arbitrum: { @@ -82,7 +83,6 @@ module.exports = { params: addresses.rum, }); - api.add(addresses.VLP, StakedVLPBal); api.add(addresses.VLP, StakedVLPBalV2); api.add(addresses.hlp, StakedHLPBal); From f7dd97857ff7c82e334fe8c709e3f5a79f384026 Mon Sep 17 00:00:00 2001 From: ZenDEXFinance <144941754+ZenDEXFinance@users.noreply.github.com> Date: Fri, 6 Oct 2023 17:49:16 +0400 Subject: [PATCH 1458/1974] Add ZenDex (#7645) * add zendex * code refactor --------- Co-authored-by: llama --- projects/zendex/index.js | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 projects/zendex/index.js diff --git a/projects/zendex/index.js b/projects/zendex/index.js new file mode 100644 index 00000000000..3533541ef78 --- /dev/null +++ b/projects/zendex/index.js @@ -0,0 +1,5 @@ +const { uniV3Export } = require('../helper/uniswapV3') + +module.exports = uniV3Export({ + manta: { factory: "0x4Eee19e0856D23fAc3D0bDD867bEb4E1B8c78344", fromBlock: 39246, } +}) From a3211f8883d97719e26178d4b2151895a824b8ff Mon Sep 17 00:00:00 2001 From: TJakubek <39831436+TJakubek@users.noreply.github.com> Date: Fri, 6 Oct 2023 18:42:30 +0300 Subject: [PATCH 1459/1974] enosys moving reward token lps to pool2 farm (#7646) --- projects/flarefarm/flare.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/projects/flarefarm/flare.js b/projects/flarefarm/flare.js index 4416f79421d..404df86ff15 100644 --- a/projects/flarefarm/flare.js +++ b/projects/flarefarm/flare.js @@ -12,12 +12,9 @@ const chain = 'flare' async function farmTvl(timestamp, ethblock, { [chain]: block }) { const tokens = [ ['0x7520005032F43229F606d3ACeae97045b9D6F7ea', "0x22beb4c7166DbAa0A33052A770C3b358cAbE9089"], - ['0xef24D5155818d4bD16AF0Cea1148A147eb620743', "0x3DA590b357Cf17a413ec8db70FeB02119AfE707f"], ['0x02C6b5B1fbE01Da872E21f9Dab1B980933B0EF27', "0xd3a273329bab3e263015C1C2ab79C3731769a5b0"], [HLN, "0x660cc88B7924a0c727cA6a1a9F0B81D239966928"], - ['0x87E0E33558c8e8EAE3c1E9EB276e05574190b48a', "0x2de4bC38f012DC90478f570083d3Da45B05659A9"], [HLN, "0xC296d1D1E3396bCCDeD32143ca715bAB0A9998cC"], - ]; return sumUnknownTokens({ tokensAndOwners: tokens, chain, block, useDefaultCoreAssets: true, }) @@ -25,7 +22,10 @@ async function farmTvl(timestamp, ethblock, { [chain]: block }) { // farms where APS is one part of the pair async function pool2(timestamp, ethblock, { [chain]: block }) { - const tokens = [] + const tokens = [ + ['0xef24D5155818d4bD16AF0Cea1148A147eb620743', "0x3DA590b357Cf17a413ec8db70FeB02119AfE707f"], + ['0x87E0E33558c8e8EAE3c1E9EB276e05574190b48a', "0x2de4bC38f012DC90478f570083d3Da45B05659A9"], + ] return sumUnknownTokens({ tokensAndOwners: tokens, chain, block, useDefaultCoreAssets: true, }) } From 34c5a50523e22fd791deb34894fce8a05578960b Mon Sep 17 00:00:00 2001 From: define Date: Fri, 6 Oct 2023 20:53:40 +0100 Subject: [PATCH 1460/1974] add zk era chain to uniswap v3 --- projects/uniswap/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/uniswap/index.js b/projects/uniswap/index.js index 2452c40e29f..596a45e37a1 100644 --- a/projects/uniswap/index.js +++ b/projects/uniswap/index.js @@ -56,7 +56,8 @@ module.exports = { ...uniV3Export({ base: { factory: '0x33128a8fc17869897dce68ed026d694621f6fdfd', fromBlock: 1371680, }, celo: { factory: '0xAfE208a311B21f13EF87E33A90049fC17A7acDEc', fromBlock: 13916355, }, - moonbeam: { factory: '0x28f1158795a3585caaa3cd6469cd65382b89bb70', fromBlock: 4313505 } + moonbeam: { factory: '0x28f1158795a3585caaa3cd6469cd65382b89bb70', fromBlock: 4313505 }, + era: { factory: '0x8FdA5a7a8dCA67BBcDd10F02Fa0649A937215422', fromBlock: 12637080 } }) } From 82eb1c9a7243d515e1a6de73b7cc87ab09aeb885 Mon Sep 17 00:00:00 2001 From: define Date: Sat, 7 Oct 2023 09:22:54 +0100 Subject: [PATCH 1461/1974] add hallmark startsarena --- projects/starshares/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/starshares/index.js b/projects/starshares/index.js index ed55d31c5ae..f1ed3ae3997 100644 --- a/projects/starshares/index.js +++ b/projects/starshares/index.js @@ -7,6 +7,9 @@ async function tvl(time, ethBlock, _b, {api}) { } module.exports = { + hallmarks: [ + [1696654800,"Reentrancy Attack"] + ], methodology: `We count the AVAX on ${contract}`, avax: { tvl From 4cb5dbd16af23094aee01bec1b31f968de533e99 Mon Sep 17 00:00:00 2001 From: singhalhemant <133655287+singhalhemant@users.noreply.github.com> Date: Sun, 8 Oct 2023 04:53:52 +0100 Subject: [PATCH 1462/1974] Adding Bluefin TVL For SUI (#7648) * Adding Bluefin TVL For SUI * Fixing the base precision for SUI --- projects/bluefin/index.js | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/projects/bluefin/index.js b/projects/bluefin/index.js index e79a019b13d..cb8932f461a 100644 --- a/projects/bluefin/index.js +++ b/projects/bluefin/index.js @@ -1,9 +1,31 @@ const ADDRESSES = require('../helper/coreAssets.json') const { sumTokensExport } = require('../helper/unwrapLPs') +const sui = require("../helper/chain/sui"); + +const SUI_BANK_ID = + "0x5843d63df15cb98b1e1da7951d49bc6cb7fd1728317dc16b54f05b7e43faf912"; + +const Arbitrum_Config = { + "endpoint": "0x52b5471d04487fb85B39e3Ae47307f115fe8733F", +} + +async function suiTvl() { + const { api } = arguments[3]; + const object = await sui.getObject(SUI_BANK_ID); + + // div by 1e6 as usdc coin has 6 precision + const tvl = object.fields.coinBalance; + api.add(ADDRESSES.sui.USDC, tvl); +} -// https://dapi.api.arbitrum-prod.firefly.exchange/marketData/contractAddresses module.exports = { arbitrum: { - tvl: sumTokensExport({ tokens: [ADDRESSES.arbitrum.USDC], owner: '0x52b5471d04487fb85B39e3Ae47307f115fe8733F'}) - } + tvl: sumTokensExport({ + owners: [Arbitrum_Config.endpoint], + tokens: [ADDRESSES.arbitrum.USDC], + }) + }, + sui: { + tvl: suiTvl + }, } \ No newline at end of file From 98dfb0008788dcb12ec3c0c2c1ae6d97090de942 Mon Sep 17 00:00:00 2001 From: charq <73696209+buchaoqun@users.noreply.github.com> Date: Sun, 8 Oct 2023 12:23:27 +0800 Subject: [PATCH 1463/1974] Filter out rwaSlot data (#7651) * add mantle network * update mantle network graphUrl * update solv-protocol-v3 to solv-protocol-funds add solv-protocol-rwa * update * del close-fund * fix block issue leading to reading data from cache * Get slotRwa from github * Filter out rwaSlot data --------- Co-authored-by: g1nt0ki --- projects/solv-protocol-funds/index.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/projects/solv-protocol-funds/index.js b/projects/solv-protocol-funds/index.js index 9dc06a6b798..6ff4d5e3fd2 100644 --- a/projects/solv-protocol-funds/index.js +++ b/projects/solv-protocol-funds/index.js @@ -1,4 +1,5 @@ const { default: BigNumber } = require("bignumber.js"); +const { getConfig } = require("../helper/cache"); const abi = require("./abi.json"); const { cachedGraphQuery } = require("../helper/cache"); @@ -10,9 +11,7 @@ const graphUrlList = { mantle: 'http://api.0xgraph.xyz/subgraphs/name/solv-payable-factory-mentle-0xgraph', } -const rwaSlot = [ - "77406646563329984090609229456139833989531434162860778120489803664660566620495" -] +const slotListUrl = 'https://cdn.jsdelivr.net/gh/solv-finance-dev/solv-protocol-rwa-slot/slot.json'; async function tvl(ts) { const { api } = arguments[3]; @@ -85,6 +84,8 @@ async function concrete(slots, api) { async function getGraphData(timestamp, chain, api) { + let rwaSlot = (await getConfig('solv-protocol', slotListUrl)); + const slotDataQuery = `query BondSlotInfos { poolOrderInfos(first: 1000 where:{fundraisingEndTime_gt:${timestamp}, openFundShareSlot_not_in: ${JSON.stringify(rwaSlot)}}) { marketContractAddress From 4d8aa06ef1ea8f9a86d9499bd1967cb1a8fe5035 Mon Sep 17 00:00:00 2001 From: define Date: Sun, 8 Oct 2023 19:35:33 +0100 Subject: [PATCH 1464/1974] add missing chains apex --- projects/apex/index.js | 53 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 46 insertions(+), 7 deletions(-) diff --git a/projects/apex/index.js b/projects/apex/index.js index b07ea7615c1..dbb469d3b98 100644 --- a/projects/apex/index.js +++ b/projects/apex/index.js @@ -1,14 +1,53 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const { sumTokensExport } = require('../helper/unwrapLPs') +const ADDRESSES = require('../helper/coreAssets.json'); +const { sumTokensExport } = require('../helper/unwrapLPs'); + const tokens = [ ADDRESSES.ethereum.USDC, ]; const owners = [ - '0xA1D5443F2FB80A5A55ac804C948B45ce4C52DCbb' -] + '0xA1D5443F2FB80A5A55ac804C948B45ce4C52DCbb', + '0xe95b3Dc78c0881dEa17A69BaFC6cFeB8d891e9DE', +]; + +const walletAddresses = { + bsc: '0xe29304Af265641a49F55294F7E5BA5010ebA4497', + polygon: '0x10434755CFdCd34539dB91c81AB0e07F96D44AA7', + arbitrum: '0x7B55800de02e4799F7b00a2C9963575464053F6A', + avax: '0x2fd7d4A45f80b1d22d1eBb7B3b2961D131eB0A22', + optimism: '0x89cBccEdDF07A14aFf90eF5D3A7D5BEf9e33Cb6b', + mantle: '0x3a4d747D381D401E598CAFE65D4a70a704988c50', +}; + +const tokenAddress = { + bsc: '0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d', + polygon: '0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174', + arbitrum: '0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8', + avax: '0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E', + optimism: '0x7F5c764cBc14f9669B88837ca1490cCa17c31607', + mantle: '0x09Bc4E0D864854c6aFB6eB9A9cdF58aC190D0dF9', +} + module.exports = { - start: 15402867, - ethereum: { tvl: sumTokensExport({ owners, tokens, }) }, - arbitrum: { tvl: () => 0 } + ethereum: { + tvl: sumTokensExport({ owners, tokens }), + }, + bsc: { + tvl: sumTokensExport({ owners: [walletAddresses.bsc], tokens: [tokenAddress.bsc] }), + }, + polygon: { + tvl: sumTokensExport({ owners: [walletAddresses.polygon], tokens: [tokenAddress.polygon] }), + }, + arbitrum: { + tvl: sumTokensExport({ owners: [walletAddresses.arbitrum], tokens: [tokenAddress.arbitrum] }), + }, + avax: { + tvl: sumTokensExport({ owners: [walletAddresses.avax], tokens: [tokenAddress.avax] }), + }, + optimism: { + tvl: sumTokensExport({ owners: [walletAddresses.optimism], tokens: [tokenAddress.optimism] }), + }, + mantle: { + tvl: sumTokensExport({ owners: [walletAddresses.mantle], tokens: [tokenAddress.mantle] }), + }, }; From 4706288ce42e55e2962d153c04956a29162cab02 Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Sun, 8 Oct 2023 23:42:48 +0100 Subject: [PATCH 1465/1974] blacklist --- projects/1inch/config.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/1inch/config.js b/projects/1inch/config.js index 119b5b3a29f..d82d8768ca2 100644 --- a/projects/1inch/config.js +++ b/projects/1inch/config.js @@ -42,6 +42,7 @@ module.exports = { '0x3fa729b4548becbad4eab6ef18413470e6d5324c', '0xcd62b1c403fa761baadfc74c525ce2b51780b184', '0x30dcf96a8a0c742aa1f534fac79e99d320c97901', + '0xfbc4f3f645c4003a2e4f4e9b51077d2daa9a9341' ] }, } \ No newline at end of file From a91cfcfd21e42fbe3e7747c74b69465dd48e568f Mon Sep 17 00:00:00 2001 From: magicMax007 <118804823+magicMax007@users.noreply.github.com> Date: Mon, 9 Oct 2023 11:47:44 +0800 Subject: [PATCH 1466/1974] add astarter pool (#7652) Co-authored-by: magic --- projects/astarter/index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/projects/astarter/index.js b/projects/astarter/index.js index e90094da40e..c1629d936fc 100644 --- a/projects/astarter/index.js +++ b/projects/astarter/index.js @@ -1,17 +1,17 @@ const axios = require("axios"); -const POOL_ID = "pool1drkls8s0zzjydyv3qpjsdj58w3sw02w9wg0pckrsnuazyef2hca"; +const POOL_ID = ["pool1drkls8s0zzjydyv3qpjsdj58w3sw02w9wg0pckrsnuazyef2hca","pool1yemdr25t4g3ev038yn433dt58d8p52nee7kmcykjlhye6hshu9m"]; async function tvl() { return { cardano: await getPoolStake(POOL_ID) }; } -async function getPoolStake(poolId) { +async function getPoolStake(poolIds) { const response = await axios.post('https://api.koios.rest/api/v0/pool_info', { - "_pool_bech32_ids": [poolId] + "_pool_bech32_ids": poolIds }); - return response.data[0].live_stake / 1e6; + return response.data.reduce((a, b) => a + b.live_stake / 1e6, 0); } module.exports = { From 8f09dc5f22a52286df827a95d156445a04599320 Mon Sep 17 00:00:00 2001 From: Lance Lan Meng <36537676+freeelancer@users.noreply.github.com> Date: Mon, 9 Oct 2023 12:00:37 +0800 Subject: [PATCH 1467/1974] added erc4626 vaults for functionx that locks LP tokens (#7655) * added erc4626 vaults for functionx * minor fix --------- Co-authored-by: llama --- projects/baklava-space/index.js | 42 ++++++++++++++++++++++----------- projects/helper/utils.js | 1 + 2 files changed, 29 insertions(+), 14 deletions(-) diff --git a/projects/baklava-space/index.js b/projects/baklava-space/index.js index 9063790606b..815680c13ba 100644 --- a/projects/baklava-space/index.js +++ b/projects/baklava-space/index.js @@ -1,6 +1,6 @@ const { staking } = require('../helper/staking'); -const { sumERC4626VaultsExport } = require('../helper/erc4626'); -const { pool2 } = require('../helper/pool2') +const { pool2 } = require('../helper/pool2'); +const { sumTokens2 } = require('../helper/unwrapLPs'); const config = { avax: { @@ -26,6 +26,14 @@ const config = { '0x5cBD2724A4398748615a2ad62ff80607dAC233fC', ], }, + functionx: [ + '0x1c1e54d8bffb02f261814ca8f06f03efed25ab8d', + '0x76f2f94429155e4e6e4c126ac9b7165ed347c9d6', + '0x610629af1cc8543c0e0348f62559801dc4099a76', + '0xefb5a32735390d01e37b620407892e35acc998c3', + '0x0fe1ead49b97fbd65875ad8a9da0b869552d0caa' + ] + } const bavaStakingRewards = "0x2F445C4cC8E114893279fa515C291A3d02160b02" @@ -34,21 +42,27 @@ const bavaToken = "0xe19A1684873faB5Fb694CfD06607100A632fF21c" module.exports = { doublecounted: true, methodology: `Counts liquidty on the bava staking and lptoken staking on Avalanche and fx token staking on FunctionX`, - functionx: { tvl: sumERC4626VaultsExport({ vaults: ['0x5c24B402b4b4550CF94227813f3547B94774c1CB'] }) } + // we have added the other functionx erc4626 vaults, but the token is an LP token and this function is unable to get the price + functionx: { tvl: fxTvl } }; -Object.keys(config).forEach(chain => { - const { vaults, pgVaults, tjVaults, } = config[chain] - module.exports[chain] = { - tvl: async (_, _b, _cb, { api, }) => { - const vInfo = await api.multiCall({ abi: 'function vaultInfo() view returns (address token, uint256 bal)', calls: vaults }) - vInfo.forEach(i => api.add(i.token, i.bal)) - const pgInfos = await api.multiCall({ abi: 'function vaultInfo() view returns (address token, address, uint256 bal, uint256, bool, bool)', calls: [pgVaults, tjVaults].flat() }) - pgInfos.forEach(i => api.add(i.token, i.bal)) - } - } -}) +async function fxTvl(_, _1, _2, { api }) { + const vaults = ['0x5c24B402b4b4550CF94227813f3547B94774c1CB', ...config.functionx] + const tokens = await api.multiCall({ abi: 'address:asset', calls: vaults }) + const bals = await api.multiCall({ abi: 'uint256:totalAssets', calls: vaults }) + api.addTokens(tokens, bals) + return sumTokens2({ api, resolveLP: true, }) +} +const { vaults, pgVaults, tjVaults, } = config.avax +module.exports.avax = { + tvl: async (_, _b, _cb, { api, }) => { + const vInfo = await api.multiCall({ abi: 'function vaultInfo() view returns (address token, uint256 bal)', calls: vaults }) + vInfo.forEach(i => api.add(i.token, i.bal)) + const pgInfos = await api.multiCall({ abi: 'function vaultInfo() view returns (address token, address, uint256 bal, uint256, bool, bool)', calls: [pgVaults, tjVaults].flat() }) + pgInfos.forEach(i => api.add(i.token, i.bal)) + } +} module.exports.avax.staking = staking(bavaStakingRewards, bavaToken) module.exports.avax.pool2 = pool2('0xdcedb18047945de1f05f649569b3d2b0e648d9c8', '0x2c3601fe09c23df8beb8216298d1502c985e376f') diff --git a/projects/helper/utils.js b/projects/helper/utils.js index 8f50b47f92d..665415a6464 100644 --- a/projects/helper/utils.js +++ b/projects/helper/utils.js @@ -73,6 +73,7 @@ function isLP(symbol, token, chain) { if (chain === 'klaytn' && ['NLP'].includes(symbol)) return true if (chain === 'kardia' && ['KLP', 'KDXLP'].includes(symbol)) return true if (chain === 'fantom' && ['HLP', 'WLP'].includes(symbol)) return true + if (chain === 'functionx' && ['FX-V2'].includes(symbol)) return true if (chain === 'era' && /(cSLP|sSLP|ZFLP)$/.test(symbol)) return true // for syncswap if (chain === 'flare' && symbol.endsWith('_LP')) return true // for enosys dex if (chain === 'songbird' && ['FLRX', 'OLP'].includes(symbol)) return true From e1624593178f300d88b4f34fae7d51fc8fad0730 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 9 Oct 2023 10:26:45 +0530 Subject: [PATCH 1468/1974] Injective-2 (#7656) * chore: update injective tvl calcs * revert changes to injective bridge tvl --------- Co-authored-by: llama --- projects/helper/chain/injective.js | 10 ++++--- projects/injective-orderbook/api.js | 6 ++--- projects/injective/apiCache.js | 42 ----------------------------- projects/injective/index.js | 32 +++------------------- 4 files changed, 13 insertions(+), 77 deletions(-) delete mode 100644 projects/injective/apiCache.js diff --git a/projects/helper/chain/injective.js b/projects/helper/chain/injective.js index e0a674aea84..433525f4f99 100644 --- a/projects/helper/chain/injective.js +++ b/projects/helper/chain/injective.js @@ -1,9 +1,11 @@ const { getNetworkInfo, Network } = require('@injectivelabs/networks') -const { protoObjectToJson, IndexerGrpcSpotApi, IndexerGrpcDerivativesApi, } = require('@injectivelabs/sdk-ts') +const { protoObjectToJson, IndexerGrpcSpotApi, IndexerGrpcDerivativesApi, ChainGrpcBankApi } = require('@injectivelabs/sdk-ts') + const { sliceIntoChunks } = require('../utils') let clients = {} const TYPES = { + BANK: 'BANK', SPOT: 'SPOT', DERIVATIVES: 'DERIVATIVES', } @@ -14,9 +16,11 @@ function getClient(type = TYPES.SPOT) { if (!clients[type]) { const network = getNetworkInfo(Network.Mainnet) if (type === TYPES.SPOT) - clients[type] = new IndexerGrpcSpotApi(network.indexerApi); + clients[type] = new IndexerGrpcSpotApi(network.indexer); else if (type === TYPES.DERIVATIVES) - clients[type] = new IndexerGrpcDerivativesApi(network.indexerApi) + clients[type] = new IndexerGrpcDerivativesApi(network.indexer) + else if(type === TYPES.BANK) + clients[type] = new ChainGrpcBankApi(network.grpc) else throw new Error('Unknown type') } diff --git a/projects/injective-orderbook/api.js b/projects/injective-orderbook/api.js index 313a21eb90f..68a083f2d35 100644 --- a/projects/injective-orderbook/api.js +++ b/projects/injective-orderbook/api.js @@ -1,4 +1,4 @@ -const { getMarkets, getOrders, TYPES } = require('../helper/chain/injective') +const { getMarkets, getOrders, TYPES } = require('../helper/chain/injectve') const { transformBalances } = require('../helper/portedTokens') const sdk = require('@defillama/sdk') const { default: BigNumber } = require('bignumber.js') @@ -36,7 +36,7 @@ module.exports = { injective: { tvl: sdk.util.sumChainTvls([ getOrderBookTvl(TYPES.SPOT), - getOrderBookTvl(TYPES.DERIVATIVES) + getOrderBookTvl(TYPES.DERIVATIVES), ]) } -} \ No newline at end of file +} diff --git a/projects/injective/apiCache.js b/projects/injective/apiCache.js deleted file mode 100644 index b3eafc5596d..00000000000 --- a/projects/injective/apiCache.js +++ /dev/null @@ -1,42 +0,0 @@ -const { getMarkets, getOrders, TYPES } = require('../helper/chain/injectve') -const { transformBalances } = require('../helper/portedTokens') -const sdk = require('@defillama/sdk') -const { default: BigNumber } = require('bignumber.js') - -function getOrderBookTvl(typeStr) { - return async () => { - const balances = {} - const markets = await getMarkets({ type: typeStr }) - const orders = await getOrders({ type: typeStr, marketIds: markets.map(i => i.marketId) }) - const marketObj = {} - for (const market of markets) - marketObj[market.marketId] = market - - for (const order of orders) marketObj[order.marketId].orderbook = order.orderbook - for (const { quoteDenom, baseDenom, orderbook: { buys, sells, } } of markets) { - for (const { price, quantity } of buys) - sdk.util.sumSingleBalance(balances, quoteDenom, BigNumber(quantity * price).toFixed(0)) - - for (const { quantity } of sells) { - - if (typeStr === TYPES.SPOT) { - sdk.util.sumSingleBalance(balances, baseDenom, BigNumber(quantity).toFixed(0)) - } else if (typeStr === TYPES.DERIVATIVES) { - const price = buys.length ? buys[0].price : 0 - sdk.util.sumSingleBalance(balances, quoteDenom, BigNumber(quantity * price).toFixed(0)) - } - } - } - return transformBalances('injective', balances) - } -} - -module.exports = { - timetravel: false, - injective: { - tvl: sdk.util.sumChainTvls([ - getOrderBookTvl(TYPES.SPOT), - getOrderBookTvl(TYPES.DERIVATIVES) - ]) - } -} \ No newline at end of file diff --git a/projects/injective/index.js b/projects/injective/index.js index b3a9626f82b..af930c66faa 100644 --- a/projects/injective/index.js +++ b/projects/injective/index.js @@ -1,32 +1,6 @@ -const ADDRESSES = require('../helper/coreAssets.json') const { sumTokensExport } = require('../helper/unwrapLPs') -const newHolder = '0xf955c57f9ea9dc8781965feae0b6a2ace2bad6f3' module.exports = { - ethereum: { - tvl: sumTokensExport({ - owner: newHolder, tokens: [ - ADDRESSES.ethereum.WETH, - ADDRESSES.ethereum.DAI, - ADDRESSES.ethereum.USDC, - ADDRESSES.ethereum.USDT, - ADDRESSES.ethereum.LINK, - ADDRESSES.ethereum.WBTC, - '0xaaef88cea01475125522e117bfe45cf32044e238', - '0x4a220e6096b25eadb88358cb44068a3248254675', - '0xde4c5a791913838027a2185709e98c5c6027ea63', - '0x92d6c1e31e14520e676a687f0a93788b716beff5', - ADDRESSES.ethereum.UNI, - '0xBB0E17EF65F82Ab018d8EDd776e8DD940327B28b', - ADDRESSES.ethereum.STETH, - '0x4d224452801ACEd8B2F0aebE155379bb5D594381', - ADDRESSES.ethereum.MATIC, - ADDRESSES.ethereum.AAVE, - ADDRESSES.ethereum.SNX, - '0x45804880De22913dAFE09f4980848ECE6EcbAf78', - ADDRESSES.ethereum.SUSHI, - '0xc944E90C64B2c07662A292be6244BDf05Cda44a7' - ] - }) - } -} + methodology: 'TVL accounts for all liquidity on the Injective chain, using the chain\'s bank module as the source.', + ethereum: { tvl: sumTokensExport({ owner: '0xf955c57f9ea9dc8781965feae0b6a2ace2bad6f3', fetchCoValentTokens: true, blacklistedTokens: ['0xe28b3B32B6c345A34Ff64674606124Dd5Aceca30'] }) }, +}; From 66019446da90bb4e019b99e49f1021badd210d30 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 9 Oct 2023 15:44:53 +0530 Subject: [PATCH 1469/1974] Blex (#7658) --- projects/blex/index.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 projects/blex/index.js diff --git a/projects/blex/index.js b/projects/blex/index.js new file mode 100644 index 00000000000..c7024505f75 --- /dev/null +++ b/projects/blex/index.js @@ -0,0 +1,17 @@ +const ADDRESSES = require("../helper/coreAssets.json"); +const { sumTokensExport } = require('../helper/unwrapLPs') + +const contracts = [ + "0x4d377340a2875b875e1C104B9905F74FD716F59e", //CoreVault + "0xbEd96a81f8694947159eD0556B077b35Fa8379a7", //FeeVault + "0x7B173a3A8d562B7Fb99743a3707deF1236935ac5", //ETH market + "0x1e9cbaaa0a7c1F72a8769EA0e3A03e7fB5458925", //BTC market + "0x54c14Fa76eeD09897F09d06580b3add70793CF19", //RewardDistributor +]; + +const tokens = [ADDRESSES.arbitrum.USDT]; + +module.exports = { + start: 118461883, + arbitrum: { tvl: sumTokensExport({ tokens, owners: contracts, }) }, +}; From eb521cf24c668108ab78121990f16d73a4950f26 Mon Sep 17 00:00:00 2001 From: define Date: Mon, 9 Oct 2023 12:21:56 +0100 Subject: [PATCH 1470/1974] hegic new treasury wallet --- projects/treasury/hegic.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/treasury/hegic.js b/projects/treasury/hegic.js index 6f8d6337f95..212b5fc1a5a 100644 --- a/projects/treasury/hegic.js +++ b/projects/treasury/hegic.js @@ -3,6 +3,7 @@ const ADDRESSES = require('../helper/coreAssets.json') const treasuryARB = "0xf15968a096fc8f47650001585d23bee819b5affb"; const treasuryETH = "0xd884aca1897ac45515cee6d5fd48f341b4023ace" +const treasuryETH2 = "0x117f55bf3c2e3bcdc7f308504480ee53f754a7ca" const hegic = "0x584bC13c7D411c00c01A62e8019472dE68768430" module.exports = treasuryExports({ @@ -19,7 +20,7 @@ module.exports = treasuryExports({ ADDRESSES.ethereum.WETH, ADDRESSES.ethereum.USDC ], - owners: [treasuryETH], + owners: [treasuryETH, treasuryETH2], ownTokens: [hegic], }, }) \ No newline at end of file From 1a4b1a83cb3abfc7a8ae72751e642056bd6d2e84 Mon Sep 17 00:00:00 2001 From: dave Date: Mon, 9 Oct 2023 13:21:31 +0100 Subject: [PATCH 1471/1974] add Gnosis to Spark Protocol Adapter (#7661) * add Spark Gnosis deployment to DefiLlama * update Spark Gnosis PoolAddressProvider * add latest Gnosis addresses for PoolAddress and Data Provider --- projects/spark-fi/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/spark-fi/index.js b/projects/spark-fi/index.js index 424ee872961..62f00985121 100644 --- a/projects/spark-fi/index.js +++ b/projects/spark-fi/index.js @@ -3,5 +3,6 @@ const ADDRESSES = require('../helper/coreAssets.json') const { aaveExports } = require('../helper/aave'); module.exports = { - ethereum: aaveExports('ethereum', '0x03cFa0C4622FF84E50E75062683F44c9587e6Cc1', undefined, ["0xFc21d6d146E6086B8359705C8b28512a983db0cb"], { v3: true, blacklistedTokens: [ADDRESSES.ethereum.DAI]}) + ethereum: aaveExports('ethereum', '0x03cFa0C4622FF84E50E75062683F44c9587e6Cc1', undefined, ["0xFc21d6d146E6086B8359705C8b28512a983db0cb"], { v3: true, blacklistedTokens: [ADDRESSES.ethereum.DAI]}), + xdai: aaveExports('xdai', '0xA98DaCB3fC964A6A0d2ce3B77294241585EAbA6d', undefined, ["0x2a002054A06546bB5a264D57A81347e23Af91D18"], { v3: true}) }; \ No newline at end of file From 1f1d76e5b2d8853433144076aaa1b900864b8d45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vuka=C5=A1in=20Manojlovi=C4=87?= Date: Mon, 9 Oct 2023 15:06:56 +0200 Subject: [PATCH 1472/1974] Add Raft Treasury (#7659) --- projects/treasury/raft.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 projects/treasury/raft.js diff --git a/projects/treasury/raft.js b/projects/treasury/raft.js new file mode 100644 index 00000000000..44c0ff81a1d --- /dev/null +++ b/projects/treasury/raft.js @@ -0,0 +1,13 @@ +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0x1046BE559A736dca32C55026165902916e406343"; +const R = "0x183015a9bA6fF60230fdEaDc3F43b3D788b13e21"; +const RAFT = "0x4C5Cb5D87709387f8821709f7a6664f00DcF0C93"; + +module.exports = treasuryExports({ + ethereum: { + tokens: [nullAddress, R], + owners: [treasury], + ownTokens: [RAFT], + }, +}); From 00f3bddaff06db0aebf9e0fd0e1277a2769a65d4 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Mon, 9 Oct 2023 17:09:05 +0100 Subject: [PATCH 1473/1974] add diva --- projects/diva/index.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 projects/diva/index.js diff --git a/projects/diva/index.js b/projects/diva/index.js new file mode 100644 index 00000000000..98d418748cf --- /dev/null +++ b/projects/diva/index.js @@ -0,0 +1,14 @@ +const { sumTokensExport } = require('../helper/unwrapLPs') + +module.exports = { + methodology: 'ETH and stETH in vaults', + ethereum: { + tvl: sumTokensExport({ owners: [ + "0x1ce8aafb51e79f6bdc0ef2ebd6fd34b00620f6db", + "0x16770d642e882e1769ce4ac8612b8bc0601506fc" + ], tokens: [ + "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", + "0xae7ab96520de3a18e5e111b5eaab095312d7fe84" + ]}), + } +}; \ No newline at end of file From b809a150aa7aeb48b916889f00815b24f12c04f3 Mon Sep 17 00:00:00 2001 From: 0x0sub <73170332+0x0sub@users.noreply.github.com> Date: Mon, 9 Oct 2023 23:57:15 -0400 Subject: [PATCH 1474/1974] add Beam Swap adapter (#7662) * add beam swap adapter * add beam coreAssets and tokenMappings * add beam swap adapter --- projects/beam-swap/index.js | 3 +++ projects/helper/chains.json | 1 + projects/helper/coreAssets.json | 6 ++++++ projects/helper/tokenMapping.js | 5 +++++ 4 files changed, 15 insertions(+) create mode 100644 projects/beam-swap/index.js diff --git a/projects/beam-swap/index.js b/projects/beam-swap/index.js new file mode 100644 index 00000000000..d1f3decd275 --- /dev/null +++ b/projects/beam-swap/index.js @@ -0,0 +1,3 @@ +const { uniTvlExport } = require('../helper/unknownTokens'); + +module.exports = uniTvlExport('beam', '0x662b526FB70EBB508962f3f61c9F735f687C8fA5') \ No newline at end of file diff --git a/projects/helper/chains.json b/projects/helper/chains.json index 5f00b4e7cc7..99656af654b 100644 --- a/projects/helper/chains.json +++ b/projects/helper/chains.json @@ -11,6 +11,7 @@ "aurora", "avax", "base", + "beam", "bifrost", "binance", "bitcoin", diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index 3376ff027d6..f6df60e3ff4 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -1419,4 +1419,10 @@ "WSMR": "0xBEb654A116aeEf764988DF0C6B4bf67CC869D01b", "USDT": "0xc0E49f8C615d3d4c245970F6Dc528E4A47d69a44" } + , + "beam": { + "WMC": "0xD51BFa777609213A653a2CD067c9A0132a2D316A", + "USDC": "0x76BF5E7d2Bcb06b1444C0a2742780051D8D0E304", + "USDT": "0x999f90f25a2922ae1b21A06066F7EDEbedad42a9" + } } diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index a34e7c6d671..c02770e58b9 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -75,6 +75,11 @@ const fixBalancesTokens = { 'EQBf6-YoR9xylol_NwjHrLkrTFAZJCX-bsd-Xx_902OaPaBf': { coingeckoId: 'megaton-finance', decimals: 9 }, 'EQCajaUU1XXSAjTD-xOV7pE49fGtg4q8kF3ELCOJtGvQFQ2C': { coingeckoId: 'the-open-network', decimals: 9 }, 'EQCf7Nb341dxOE3N0jimngRxGEV8T3zo-eU2EZVs_nchNhhZ': { coingeckoId: 'wemix-token', decimals: 18 } + }, + beam: { + '0xd51bfa777609213a653a2cd067c9a0132a2d316a': { coingeckoId: 'merit-circle', decimals: 18 }, + '0x76bf5e7d2bcb06b1444c0a2742780051d8d0e304': { coingeckoId: 'usd-coin', decimals: 6 }, + '0x999f90f25a2922ae1b21A06066F7EDEbedad42a9': { coingeckoId: 'tether', decimals: 18 }, } } From 615abcd34a26e63ba8006cb8c279bf5941d33e1b Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Tue, 10 Oct 2023 07:09:40 +0100 Subject: [PATCH 1475/1974] add option to blacklist a token --- projects/spiritswap/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/spiritswap/index.js b/projects/spiritswap/index.js index f66c6b4671d..7dc803ab577 100644 --- a/projects/spiritswap/index.js +++ b/projects/spiritswap/index.js @@ -6,8 +6,8 @@ const sdk = require('@defillama/sdk'); const factory = '0xEF45d134b73241eDa7703fa787148D9C9F4950b0' const factory2 = '0x9d3591719038752db0c8bEEe2040FfcC3B2c6B9c' const chain = 'fantom' -const ammTvl = getUniTVL({ chain, factory, useDefaultCoreAssets: false, }) -const ammTvl2 = getUniTVL({ chain, factory: factory2, useDefaultCoreAssets: false, }) +const ammTvl = getUniTVL({ chain, factory, useDefaultCoreAssets: false, }) +const ammTvl2 = getUniTVL({ chain, factory: factory2, useDefaultCoreAssets: false, blacklist: ["0x5b2af7fd27e2ea14945c82dd254c79d3ed34685e"] }) module.exports = { From 39abb40f9a3bd94110c71fd13c13ad2be440d11c Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Tue, 10 Oct 2023 07:14:56 +0100 Subject: [PATCH 1476/1974] add distressed asset --- projects/helper/tokenMapping.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index c02770e58b9..81391fa0d5b 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -25,7 +25,8 @@ const distressedAssts = new Set(Object.values({ aBNBb: ADDRESSES.bsc.aBNBb, XRPC: '0xd4ca5c2aff1eefb0bea9e9eab16f88db2990c183', FLEET: '0xfd56a3dcfc0690881a466ae432d71bb2db588083', - YAKU: 'NGK3iHqqQkyRZUj4uhJDQqEyKKcZ7mdawWpqwMffM3s' + YAKU: 'NGK3iHqqQkyRZUj4uhJDQqEyKKcZ7mdawWpqwMffM3s', + JEFI: '0x80fa6d5384bdde296a28a321f73ab70977575129' }).map(i => i.toLowerCase())) const transformTokens = { From bd6e1cba750544813cd668c8121b883d861c72f1 Mon Sep 17 00:00:00 2001 From: llama Date: Tue, 10 Oct 2023 09:35:08 +0200 Subject: [PATCH 1477/1974] delist broken chains --- package-lock.json | 12 ++++++------ projects/barnswap/index.js | 7 +++---- projects/bridgekek/index.js | 3 ++- projects/empiredex/index.js | 3 ++- projects/frogswap-kekchain/index.js | 6 +++++- projects/kekswap/index.js | 6 +++++- 6 files changed, 23 insertions(+), 14 deletions(-) diff --git a/package-lock.json b/package-lock.json index 544328a487c..9e9a683a053 100644 --- a/package-lock.json +++ b/package-lock.json @@ -785,9 +785,9 @@ } }, "node_modules/@defillama/sdk": { - "version": "4.0.60", - "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.60.tgz", - "integrity": "sha512-aAgn5yUZ27B8yOrS6cqv10y3mcySKD/fdvOGNBnAC++sLBcAvNQbPfDf4ArvZwQhcyqLpoPtOD2Qk6VfF4LYFw==", + "version": "4.0.62", + "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.62.tgz", + "integrity": "sha512-Qh1I7EHlb/HIp2rQDrP96PQYMYNakLdakA4r3C7xYvbReyyyF5YdGzU8gEr8EiAesF2jmtR1Wtwa1r9FV0tcIQ==", "dependencies": { "@aws-sdk/client-s3": "^3.400.0", "@supercharge/promise-pool": "^2.1.0", @@ -5905,9 +5905,9 @@ } }, "@defillama/sdk": { - "version": "4.0.60", - "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.60.tgz", - "integrity": "sha512-aAgn5yUZ27B8yOrS6cqv10y3mcySKD/fdvOGNBnAC++sLBcAvNQbPfDf4ArvZwQhcyqLpoPtOD2Qk6VfF4LYFw==", + "version": "4.0.62", + "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.62.tgz", + "integrity": "sha512-Qh1I7EHlb/HIp2rQDrP96PQYMYNakLdakA4r3C7xYvbReyyyF5YdGzU8gEr8EiAesF2jmtR1Wtwa1r9FV0tcIQ==", "requires": { "@aws-sdk/client-s3": "^3.400.0", "@supercharge/promise-pool": "^2.1.0", diff --git a/projects/barnswap/index.js b/projects/barnswap/index.js index ad0e957ae47..80eb0ed8701 100644 --- a/projects/barnswap/index.js +++ b/projects/barnswap/index.js @@ -1,12 +1,11 @@ const { getUniTVL } = require('../helper/unknownTokens') module.exports = { + // deadFrom: '30-09-2023', misrepresentedTokens: true, muuchain: { - tvl: getUniTVL({ - factory: '0x058f3f7857d47326021451b6b67c3e92838a6edc', - useDefaultCoreAssets: true, - }) + // tvl: getUniTVL({ factory: '0x058f3f7857d47326021451b6b67c3e92838a6edc', useDefaultCoreAssets: true, }) + tvl: () => ({}) }, }; diff --git a/projects/bridgekek/index.js b/projects/bridgekek/index.js index a342d93108d..aa4940836e4 100644 --- a/projects/bridgekek/index.js +++ b/projects/bridgekek/index.js @@ -5,6 +5,7 @@ module.exports = { tvl: sumTokensExport({ tokens: ['0x67954768E721FAD0f0f21E33e874497C73ED6a82'], owner: '0x53423b7bf445997e76ad94f820f0559e451a98e2', chain: 'ethereum',}), }, kekchain: { - tvl: sumTokensExport({ tokens: [nullAddress ], owner: '0x0c851a31F484A7b462B82E138A2fa591ae8Fadc9', chain: 'kekchain',}), + tvl: () => ({}), + // tvl: sumTokensExport({ tokens: [nullAddress ], owner: '0x0c851a31F484A7b462B82E138A2fa591ae8Fadc9', chain: 'kekchain',}), }, } \ No newline at end of file diff --git a/projects/empiredex/index.js b/projects/empiredex/index.js index 26b6e2254eb..85d8f1e74cc 100644 --- a/projects/empiredex/index.js +++ b/projects/empiredex/index.js @@ -27,7 +27,8 @@ module.exports = { tvl: getUniTVL({ factory: '0x06530550A48F990360DFD642d2132354A144F31d', useDefaultCoreAssets: true, }), }, empire: { - tvl: getUniTVL({ factory: '0x06530550A48F990360DFD642d2132354A144F31d', useDefaultCoreAssets: true, }), + // tvl: getUniTVL({ factory: '0x06530550A48F990360DFD642d2132354A144F31d', useDefaultCoreAssets: true, }), + tvl: () => ({}), }, methodology: "Factory address(0x06530550A48F990360DFD642d2132354A144F31d) is used to find the LP pairs. TVL is equal to the liquidity on the AMM.", diff --git a/projects/frogswap-kekchain/index.js b/projects/frogswap-kekchain/index.js index c8233a5b8e6..d40aeea626b 100644 --- a/projects/frogswap-kekchain/index.js +++ b/projects/frogswap-kekchain/index.js @@ -1,3 +1,7 @@ const { uniTvlExport } = require('../helper/unknownTokens') -module.exports = uniTvlExport('kekchain', '0xfe0139503a1B97F7f6c2b72f4020df7A6c1EE399') \ No newline at end of file +module.exports = uniTvlExport('kekchain', '0xfe0139503a1B97F7f6c2b72f4020df7A6c1EE399') +module.exports = { + kekchain: { tvl: () => ({}), }, + // deadFrom: '30-09-2023', +} \ No newline at end of file diff --git a/projects/kekswap/index.js b/projects/kekswap/index.js index b9b71d8dc39..47feac3aa22 100644 --- a/projects/kekswap/index.js +++ b/projects/kekswap/index.js @@ -1,3 +1,7 @@ const { uniTvlExport } = require('../helper/unknownTokens') -module.exports = uniTvlExport('kekchain', '0x558e20804CDFff6d98945b12CE47FeB46D6a4Dc4') \ No newline at end of file +module.exports = uniTvlExport('kekchain', '0x558e20804CDFff6d98945b12CE47FeB46D6a4Dc4') +module.exports = { + kekchain: { tvl: () => ({}), }, + // deadFrom: '30-09-2023', +} \ No newline at end of file From 00cf3e5264981e672eb24425aea119084063ac59 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 10 Oct 2023 13:24:25 +0530 Subject: [PATCH 1478/1974] Newbitcoincity (#7666) * add New Bitcoin TVL * fetch tvl on chain --------- Co-authored-by: elykct Co-authored-by: llama --- projects/helper/chains.json | 1 + projects/helper/coreAssets.json | 3 +++ projects/helper/tokenMapping.js | 3 +++ projects/newbitcoin/index.js | 8 ++++++++ 4 files changed, 15 insertions(+) create mode 100644 projects/newbitcoin/index.js diff --git a/projects/helper/chains.json b/projects/helper/chains.json index 99656af654b..10e231279e3 100644 --- a/projects/helper/chains.json +++ b/projects/helper/chains.json @@ -143,6 +143,7 @@ "neo3", "neon_evm", "neutron", + "nos", "nova", "nuls", "oasis", diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index f6df60e3ff4..399d06917ca 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -1410,6 +1410,9 @@ "BONE_4": "0xa2899c776baaf9925d432f83c950d5054a6cf59c", "DAI": "0x50c5725949a6f0c72e6c4a641f24049a917db0cb" }, + "nos": { + "BTC": "0x111808AbE352c8003e0eFfcc04998EaB26Cebe3c" + }, "kroma": { "WETH": "0x4200000000000000000000000000000000000001", "USDC": "0x49A5010110a358d9069282873F3e7eCf6B41DC10", diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 81391fa0d5b..3e07a889fec 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -70,6 +70,9 @@ const fixBalancesTokens = { '0xb73603c5d87fa094b7314c74ace2e64d165016fb': { coingeckoId: 'usd-coin', decimals: 6 }, '0xf417f5a458ec102b90352f697d6e2ac3a3d2851f': { coingeckoId: 'tether', decimals: 6 }, }, + nos: { + '0x111808AbE352c8003e0eFfcc04998EaB26Cebe3c': { coingeckoId: 'bitcoin', decimals: 18 }, + }, ton: { 'EQBq4d4GPyBoh-Pjnf3wxUyQSS28WY2Yt-7cPAG8FHpWpNRX': { coingeckoId: 'matic-network', decimals: 18 }, 'EQDCIEo0HUUYsAV-lTMviOd-GkSXfVPsNZMGjRaNOA_6--FD': { coingeckoId: 'orbit-chain', decimals: 18 }, diff --git a/projects/newbitcoin/index.js b/projects/newbitcoin/index.js new file mode 100644 index 00000000000..5e4156762e6 --- /dev/null +++ b/projects/newbitcoin/index.js @@ -0,0 +1,8 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require('../helper/unwrapLPs') + +module.exports = { + nos: { + tvl: sumTokensExport({ owner: '0xea21fbBB923E553d7b98D14106A104665BA57eCd', tokens: [ADDRESSES.nos.BTC] }) + } +} \ No newline at end of file From 72870b23137c33127786cf00ae86503a3f7a0446 Mon Sep 17 00:00:00 2001 From: tstemko <57684389+tstemko@users.noreply.github.com> Date: Tue, 10 Oct 2023 04:06:23 -0400 Subject: [PATCH 1479/1974] Change Ramses factory (#7664) Co-authored-by: Tatyana Stemkovski --- projects/ichifarm/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/ichifarm/index.js b/projects/ichifarm/index.js index 97c9336fe54..0df842897f7 100644 --- a/projects/ichifarm/index.js +++ b/projects/ichifarm/index.js @@ -38,7 +38,7 @@ const config = { arbitrum: { vaultConfigs: [ { factory: '0xfBf38920cCbCFF7268Ad714ae5F9Fad6dF607065', fromBlock: 102858581, }, - { factory: '0xAc93148e93d1C49D89b1166BFd74942E80F5D501', fromBlock: 130127537, }, // Ramses + { factory: '0x7984d3ad2DE4Dd54D1FD6b4D89112eBF7c0DF151', fromBlock: 137087766, }, // Ramses ], }, bsc: { From 78fdc1cd198ec25baaef9f8798ce91973b1223f0 Mon Sep 17 00:00:00 2001 From: legend524 <54629888+legend524@users.noreply.github.com> Date: Tue, 10 Oct 2023 17:24:51 +0900 Subject: [PATCH 1480/1974] add wildbase (#7663) * add wildbase * updated tvl calculation function in wildbase * fixed tvl func in wildbase * fixed tvl export * fix base tvl export * code refactor --------- Co-authored-by: llama --- projects/wildbase/index.js | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 projects/wildbase/index.js diff --git a/projects/wildbase/index.js b/projects/wildbase/index.js new file mode 100644 index 00000000000..4ad1872eb37 --- /dev/null +++ b/projects/wildbase/index.js @@ -0,0 +1,8 @@ +const { masterchefExports } = require("../helper/unknownTokens"); + +module.exports = masterchefExports({ + chain: 'base', + masterchef: '0x3eAB0C9716b0aA98CdC4c3ae317d69dE301ef247', + useDefaultCoreAssets: true, + nativeToken: '0xbCDa0bD6Cd83558DFb0EeC9153eD9C9cfa87782E' +}) \ No newline at end of file From 0af0d7a6aff57bbbe74dfc91eb2ab0a24ae6f8b6 Mon Sep 17 00:00:00 2001 From: CronosLabsDev <106642922+CronosLabsDev@users.noreply.github.com> Date: Tue, 10 Oct 2023 17:39:44 +0800 Subject: [PATCH 1481/1974] feat: add era tvl for fulcrom (#7667) --- projects/fulcrom/index.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/projects/fulcrom/index.js b/projects/fulcrom/index.js index 1a891cae558..c86a5d1f9a8 100644 --- a/projects/fulcrom/index.js +++ b/projects/fulcrom/index.js @@ -1,6 +1,7 @@ const { sumTokens2 } = require('../helper/unwrapLPs') -const VAULT_ADDR = '0x8C7Ef34aa54210c76D6d5E475f43e0c11f876098'; +const CRO_VAULT_ADDR = '0x8C7Ef34aa54210c76D6d5E475f43e0c11f876098'; +const ZKSYNC_VAULT_ADDR = '0x7d5b0215EF203D0660BC37d5D09d964fd6b55a1E'; function fulExports({ vault, }) { return async (ts, _block, _, { api }) => { @@ -21,6 +22,9 @@ const abis = { module.exports = { cronos: { - tvl: fulExports({ vault: VAULT_ADDR, }), - } + tvl: fulExports({ vault: CRO_VAULT_ADDR, }), + }, + era: { + tvl: fulExports({ vault: ZKSYNC_VAULT_ADDR, }), + }, } From 5ce27616bca39f309cc12726ab30bfb94ab6de54 Mon Sep 17 00:00:00 2001 From: llama Date: Tue, 10 Oct 2023 15:06:35 +0200 Subject: [PATCH 1482/1974] track sofi projects on solana --- projects/friendzy-gg/index.js | 18 ++++++++ projects/hub3-ee/index.js | 79 +++++++++++++++++++++++++++++++++++ 2 files changed, 97 insertions(+) create mode 100644 projects/friendzy-gg/index.js create mode 100644 projects/hub3-ee/index.js diff --git a/projects/friendzy-gg/index.js b/projects/friendzy-gg/index.js new file mode 100644 index 00000000000..6ab013d2cb9 --- /dev/null +++ b/projects/friendzy-gg/index.js @@ -0,0 +1,18 @@ +const { PublicKey } = require("@solana/web3.js"); +const { sumTokens2, } = require("../helper/solana"); + +async function tvl() { + const textEncoder = new TextEncoder(); + const [bank] = PublicKey.findProgramAddressSync( + [textEncoder.encode("bank")], + new PublicKey('FrenAezyygcqNKaCkYNzBAxTCo717wh1bgnKLqnxP8Cq') + ); + return sumTokens2({ solOwners: [bank.toBase58()] }) +} + +module.exports = { + timetravel: false, + solana: { + tvl, + }, +}; diff --git a/projects/hub3-ee/index.js b/projects/hub3-ee/index.js new file mode 100644 index 00000000000..15f42039572 --- /dev/null +++ b/projects/hub3-ee/index.js @@ -0,0 +1,79 @@ +const { PublicKey } = require("@solana/web3.js"); +const { sumTokens2, getProvider, } = require("../helper/solana"); +const { Program } = require("@project-serum/anchor"); +const sdk = require('@defillama/sdk') + +async function tvl() { + const provider = getProvider(); + const programId = new PublicKey("2pi53pUUC5S4zyUU6Wrbe6EfYXS9LNcpikpwPFahtQQw"); + const program = new Program(sharesIDL, programId, provider); + let accounts = await program.account.issuer.all(); + accounts = accounts.filter(i => +i.account.holders > 0) + accounts.sort((a, b) => +b.account.holders - a.account.holders) + sdk.log(accounts.length) + return sumTokens2({ solOwners: accounts.map(i => i.publicKey) }) +} + +module.exports = { + timetravel: false, + solana: { + tvl, + }, +}; + +const sharesIDL = { + version: '0.1.0', + name: 'shares', + instructions: [], + accounts: [ + { + name: 'issuer', + type: { + kind: 'struct', + fields: [ + { + name: 'issuerKey', + type: 'publicKey' + }, + { + name: 'price', + type: 'u64' + }, + { + name: 'totalShares', + type: 'u64' + }, + { + name: 'totalFees', + type: 'u64' + }, + { + name: 'bump', + type: 'u8' + }, + { + name: 'holders', + type: 'u32' + }, + { + name: 'migration', + type: 'bool' + }, + { + name: 'a', + type: 'u64' + }, + { + name: 'b', + type: 'u64' + }, + { + name: 'd', + type: 'u64' + } + ] + } + }, + ], + errors: [] +} From 22e8ddd993198ee1d504ac96e3cedd9af2fa9bfa Mon Sep 17 00:00:00 2001 From: llama Date: Tue, 10 Oct 2023 17:49:33 +0200 Subject: [PATCH 1483/1974] add polygon USDC --- projects/helper/coreAssets.json | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index 399d06917ca..13cfba72608 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -120,6 +120,7 @@ "WMATIC_2": "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270", "MATICX": "0xfa68FB4628DFF1028CFEc22b4162FCcd0d45efb6", "USDC": "0x2791bca1f2de4661ed88a30c99a7a9449aa84174", + "USDC_CIRCLE": "0x3c499c542cef5e3811e1192ce70d8cc03d5c3359", "QUICK": "0xb5c064f955d8e7f38fe0460c556a72987494ee17", "WBTC": "0x1bfd67037b42cf73acf2047067bd4f2c47d9bfd6", "USDT": "0xc2132d05d31c914a87c6611c10748aeb04b58e8f", From ab8a5006385587a8cee0fc09d59f20fb22e9ab7c Mon Sep 17 00:00:00 2001 From: define Date: Tue, 10 Oct 2023 18:21:24 +0100 Subject: [PATCH 1484/1974] test hub3 --- projects/hub3-ee/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/hub3-ee/index.js b/projects/hub3-ee/index.js index 15f42039572..af821cde561 100644 --- a/projects/hub3-ee/index.js +++ b/projects/hub3-ee/index.js @@ -77,3 +77,4 @@ const sharesIDL = { ], errors: [] } +//test it From c3d8074732bdaa506580bc67111512377e8c5eef Mon Sep 17 00:00:00 2001 From: define Date: Tue, 10 Oct 2023 18:50:29 +0100 Subject: [PATCH 1485/1974] remove op chain from leech while fixing --- projects/leech-protocol/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/leech-protocol/index.js b/projects/leech-protocol/index.js index ecfa301458c..6a918e9dad1 100644 --- a/projects/leech-protocol/index.js +++ b/projects/leech-protocol/index.js @@ -95,5 +95,5 @@ async function tvl(_, _b, _cb, { api, }) { module.exports = { bsc: { tvl }, avax: { tvl }, - optimism: { tvl }, + // optimism: { tvl }, }; \ No newline at end of file From 2c6eb20aa39eb7cb88db4503c46c00800f107018 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Tue, 10 Oct 2023 23:28:47 +0100 Subject: [PATCH 1486/1974] add hallmark --- projects/mantaswap/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/mantaswap/index.js b/projects/mantaswap/index.js index 9cd75176a51..002d768bdb4 100644 --- a/projects/mantaswap/index.js +++ b/projects/mantaswap/index.js @@ -1,6 +1,9 @@ const { getUniTVL } = require('../helper/unknownTokens') module.exports = { + hallmarks: [ + [1696809600, "Rug Pull"] + ], misrepresentedTokens: true, manta: { tvl: getUniTVL({ factory: '0x60Ad4aB0659C3b83320f3D43d3797553b55D52c6', useDefaultCoreAssets: true, }), }, } From 77da05fbdf2932eb7e75cd54651c1485521fe266 Mon Sep 17 00:00:00 2001 From: llama Date: Wed, 11 Oct 2023 07:37:52 +0200 Subject: [PATCH 1487/1974] injective bugfix --- projects/injective-orderbook/api.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/injective-orderbook/api.js b/projects/injective-orderbook/api.js index 68a083f2d35..c520af30902 100644 --- a/projects/injective-orderbook/api.js +++ b/projects/injective-orderbook/api.js @@ -1,4 +1,4 @@ -const { getMarkets, getOrders, TYPES } = require('../helper/chain/injectve') +const { getMarkets, getOrders, TYPES } = require('../helper/chain/injective') const { transformBalances } = require('../helper/portedTokens') const sdk = require('@defillama/sdk') const { default: BigNumber } = require('bignumber.js') From 029e0ed80779b483e7b80c082ed5b5296b80b342 Mon Sep 17 00:00:00 2001 From: llama Date: Wed, 11 Oct 2023 07:46:43 +0200 Subject: [PATCH 1488/1974] satori: track linea --- projects/satori/index.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/projects/satori/index.js b/projects/satori/index.js index ac5666b2249..2b912740f09 100644 --- a/projects/satori/index.js +++ b/projects/satori/index.js @@ -1,4 +1,4 @@ -const ADDRESSES = require('../helper/coreAssets.json') +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokensExport } = require("../helper/unwrapLPs"); const USDT_TOKEN_CONTRACT = "0x1E4a5963aBFD975d8c9021ce480b42188849D41d"; @@ -21,4 +21,13 @@ module.exports = { tokens: [ADDRESSES.era.USDC], }), }, + linea: { + tvl: sumTokensExport({ + owners: [ + "0xfb371E70eEB32f4054F40514924e77213ca18425", + "0xF96116e124eB3F62Ddc6a9cfbdc58d7F8A37c50A", + ], + tokens: [ADDRESSES.linea.USDC], + }), + } }; From 623f65089e716ca6b8b76ba01f5319e6be28c14b Mon Sep 17 00:00:00 2001 From: RedemptionFi <145705771+RedemptionFi@users.noreply.github.com> Date: Wed, 11 Oct 2023 14:49:20 +0800 Subject: [PATCH 1489/1974] Add Redemption Finance on base to Defillama (#7674) * Add Redemption Finance on base to Defillama * code refactor --------- Co-authored-by: llama --- projects/redemptionfi/index.js | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 projects/redemptionfi/index.js diff --git a/projects/redemptionfi/index.js b/projects/redemptionfi/index.js new file mode 100644 index 00000000000..6fa63f07aba --- /dev/null +++ b/projects/redemptionfi/index.js @@ -0,0 +1,6 @@ +const { masterchefExports } = require("../helper/unknownTokens"); + +const masterchef = "0x5c6c79Ff5a58bBC3D7903f439b3A75415685eca3" +const nativeToken = "0x41E99e0F73a88947C52070FF67C19B7aBc171A54" + +module.exports = masterchefExports({ chain: 'base', masterchef, nativeToken, useDefaultCoreAssets: true,}) \ No newline at end of file From 2e8edd61dba3c7deb79abac62654e6154864344e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Federico=20Rodr=C3=ADguez?= Date: Wed, 11 Oct 2023 03:49:50 -0300 Subject: [PATCH 1490/1974] [Mars Protocol] - Update computations for marsv2 on Osmosis and add recent hallmarks (#7673) * Adapt vault queries to marsv2 * Add credit manager deposit balances to osmosis tvl * Add neutron and mars v2 hallmarks * Update tvl methodology description --- projects/mars/index.js | 48 +++++++++++++++++++++++++++--------------- 1 file changed, 31 insertions(+), 17 deletions(-) diff --git a/projects/mars/index.js b/projects/mars/index.js index a9b9d4b2bfb..3d882bf89a1 100644 --- a/projects/mars/index.js +++ b/projects/mars/index.js @@ -1,13 +1,14 @@ const sdk = require('@defillama/sdk'); const axios = require('axios'); -const { endPoints, queryContract, sumTokens } = require('../helper/chain/cosmos'); +const { endPoints, queryContract, sumTokens} = require('../helper/chain/cosmos'); const { getChainTransform } = require('../helper/portedTokens'); const addresses = { osmosis: { redBank: 'osmo1c3ljch9dfw5kf52nfwpxd2zmj2ese7agnx0p9tenkrryasrle5sqf3ftpg', creditManager: 'osmo1f2m24wktq0sw3c0lexlg7fv4kngwyttvzws3a3r3al9ld2s2pvds87jqvf', + params: 'osmo1nlmdxt9ctql2jr47qd4fpgzg84cjswxyw6q99u4y4u4q6c2f5ksq7ysent' }, neutron: { redBank: 'neutron1n97wnm7q6d2hrcna3rqlnyqw2we6k0l8uqvmyqq6gsml92epdu7quugyph', @@ -20,6 +21,7 @@ const addresses = { async function osmosisTVL() { let balances = {}; await addRedBankTvl(balances, 'osmosis'); + await addCreditManagerTvl(balances, 'osmosis'); await osmosisSumVaultsTVL(balances); return balances; } @@ -32,20 +34,20 @@ async function osmosisSumVaultsTVL(balances) { const osmosisDenomTransform = await getChainTransform('osmosis'); while (vaultPagesRemaining) { - const fieldsVaultsInfo = await queryContract({ - contract: addresses.osmosis.creditManager, + const roverVaultConfigs = await queryContract({ + contract: addresses.osmosis.params, chain: 'osmosis', - data: { 'vaults_info': { limit: pageLimit, 'start_after': startAfter } } + data: { 'all_vault_configs': { limit: pageLimit, 'start_after': startAfter } } }); - if(fieldsVaultsInfo.length === pageLimit) { - startAfter = fieldsVaultsInfo[fieldsVaultsInfo.length - 1].vault; + if(roverVaultConfigs.length === pageLimit) { + startAfter = roverVaultConfigs[roverVaultConfigs.length - 1].vault; vaultPagesRemaining = true } else { vaultPagesRemaining = false; } - await osmosisAddCoinsForVaultsInfoPage(coins, fieldsVaultsInfo); + await osmosisAddCoinsForVaultsInfoPage(coins, roverVaultConfigs); } coins.forEach(coin => { @@ -53,14 +55,14 @@ async function osmosisSumVaultsTVL(balances) { }) } -async function osmosisAddCoinsForVaultsInfoPage(coins, fieldsVaultsInfoPage) { - let vaultsMetadata = fieldsVaultsInfoPage.map(rvi => ({ fieldsVaultInfo: rvi })); +async function osmosisAddCoinsForVaultsInfoPage(coins, roverVaultConfigsPage) { + let vaultsMetadata = roverVaultConfigsPage.map(rvi => ({ fieldsVaultInfo: rvi })); // query the vault info for the vault contract itself to get the vault's // base token await Promise.all(vaultsMetadata.map(async vm => { let vaultInfo = await queryContract({ - contract: vm.fieldsVaultInfo.vault.address, + contract: vm.fieldsVaultInfo.addr, chain: 'osmosis', data: { 'info': {} } }); @@ -69,18 +71,18 @@ async function osmosisAddCoinsForVaultsInfoPage(coins, fieldsVaultsInfoPage) { // get total vault shares owned by fields for each vault await Promise.all(vaultsMetadata.map(async vm => { - let vaultShares = await queryContract({ - contract: addresses.osmosis.creditManager, - chain: 'osmosis', - data: { 'total_vault_coin_balance': { vault: vm.fieldsVaultInfo.vault } } - }); + let vaultShares = await cosmosDenomBalanceStr( + 'osmosis', + vm.vaultInfo.vault_token, + addresses.osmosis.creditManager + ); vm.vaultShares = vaultShares; })); // convert vault shares to vault base asset await Promise.all(vaultsMetadata.map( async vm => { let query = { - contract: vm.fieldsVaultInfo.vault.address, + contract: vm.fieldsVaultInfo.addr, chain: 'osmosis', data: { 'convert_to_assets': { amount: vm.vaultShares } } }; @@ -123,6 +125,10 @@ async function addRedBankTvl(balances, chain) { await sumTokens({balances, owners: [addresses[chain].redBank], chain}); } +async function addCreditManagerTvl(balances, chain) { + await sumTokens({balances, owners: [addresses[chain].creditManager], chain}); +} + function getEndpoint(chain) { if (!endPoints[chain]) throw new Error('Chain not found: ' + chain); return endPoints[chain]; @@ -134,9 +140,15 @@ async function cosmosLCDQuery(url, chain) { return request.data; } +async function cosmosDenomBalanceStr(chain, denom, owner) { + let url = `cosmos/bank/v1beta1/balances/${owner}/by_denom?denom=${denom}`; + let balance = await cosmosLCDQuery(url, chain); + return balance.balance.amount; +} + module.exports = { timetravel: false, - methodology: 'For each chain, sum up token balances in Red Bank smart contracts and vault underlying assets in Fields smart contracts', + methodology: 'For each chain, sum token balances in Red Bank/Credit Manager smart contracts to approximate net deposits, plus vault underlying assets held in Rover', osmosis: { tvl: osmosisTVL, }, @@ -149,5 +161,7 @@ module.exports = { hallmarks:[ [1651881600, 'UST depeg'], [1675774800, 'Relaunch on Osmosis'], + [1690945200, 'Red Bank launch on Neutron'], + [1696906800, 'Mars V2 launch on Osmosis'], ] }; From 24d7f8135db1d8451cce5e81ab5ef6bbe096e416 Mon Sep 17 00:00:00 2001 From: stupid-boar <6961601+stupid-boar@users.noreply.github.com> Date: Wed, 11 Oct 2023 12:20:16 +0300 Subject: [PATCH 1491/1974] add MKR + UNI for Ethereum network (#7676) --- projects/pepe-bridge/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/projects/pepe-bridge/index.js b/projects/pepe-bridge/index.js index 50c84d34b80..e65f17e676d 100644 --- a/projects/pepe-bridge/index.js +++ b/projects/pepe-bridge/index.js @@ -8,7 +8,7 @@ const wavesCoinBridgeContract = '3PFPuctNkdbwGKKUNymWw816jGPexHzGXW5'; async function wavesTVL() { const balances = {}; const contractTVLInWAVES = await data(wavesCoinBridgeContract, "BALANCE"); - sdk.util.sumSingleBalance(balances, 'waves', contractTVLInWAVES.value/1e8) + sdk.util.sumSingleBalance(balances, 'waves', contractTVLInWAVES.value / 1e8) return balances; } @@ -21,6 +21,8 @@ const config = { ADDRESSES.ethereum.USDC, ADDRESSES.ethereum.WBTC, ADDRESSES.ethereum.CRV, + ADDRESSES.ethereum.UNI, + ADDRESSES.ethereum.MKR, ], '0x0de7b091A21BD439bdB2DfbB63146D9cEa21Ea83' ] From 7ac0695efff404607f038ac7380bc7ce79796e08 Mon Sep 17 00:00:00 2001 From: llama Date: Wed, 11 Oct 2023 11:44:06 +0200 Subject: [PATCH 1492/1974] use token labels --- package-lock.json | 12 ++++++------ projects/amphora/index.js | 7 ++++--- projects/apex/index.js | 12 ++++++------ projects/arcanum/index.js | 3 ++- projects/cbETH/index.js | 3 ++- projects/celerbridge/index.js | 2 +- projects/diva/index.js | 5 +++-- projects/dopex/index.js | 2 +- projects/helper/cex.js | 8 ++++---- projects/helper/tokenMapping.js | 12 ++++++------ projects/ip/index.js | 2 +- projects/leetswap/index.js | 5 +++-- projects/lybra-v2/index.js | 2 +- projects/meanfinance/addresses.js | 2 +- projects/omnibtc/index.js | 2 +- projects/overnight-daiPlus/index.js | 2 +- projects/preon/index.js | 6 +++--- projects/pyswap/index.js | 3 ++- projects/shibfi/index.js | 3 ++- projects/sithswap/api.js | 1 + .../solid-world/forward-contract-batch-supply.js | 1 + projects/standard-smart-vaults/index.js | 7 ++++--- projects/starkex/api.js | 1 + projects/tangible/index.js | 2 +- projects/tangible/insurance-fund-polygon.js | 11 ++++++----- projects/treasury/baseswap.js | 3 ++- projects/treasury/brewlabs.js | 6 +++--- projects/treasury/gnosis-dao.js | 6 +++--- projects/treasury/loot-dao.js | 2 +- projects/treasury/lyra.js | 2 +- projects/treasury/nouns.js | 2 +- projects/treasury/paladin-finance.js | 2 +- projects/treasury/silo-finance.js | 4 ++-- projects/treasury/the-standard.js | 7 ++++--- projects/treasury/tprotocol.js | 3 ++- projects/valorem/index.js | 7 ++++--- projects/vaultka/index.js | 2 +- projects/wanlend/index.js | 3 ++- projects/zeta/index.js | 3 ++- projects/zkevmswap/index.js | 3 ++- utils/scripts/useTokenLabels.js | 1 + 41 files changed, 96 insertions(+), 76 deletions(-) diff --git a/package-lock.json b/package-lock.json index 9e9a683a053..fa16f36d457 100644 --- a/package-lock.json +++ b/package-lock.json @@ -785,9 +785,9 @@ } }, "node_modules/@defillama/sdk": { - "version": "4.0.62", - "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.62.tgz", - "integrity": "sha512-Qh1I7EHlb/HIp2rQDrP96PQYMYNakLdakA4r3C7xYvbReyyyF5YdGzU8gEr8EiAesF2jmtR1Wtwa1r9FV0tcIQ==", + "version": "4.0.64", + "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.64.tgz", + "integrity": "sha512-wqM4enhx11vN5OuRNpK9QMoOEQbbQFKu7tT0rM6ddYA4w1tvuayWAn8mjfV8TN5wd88aHV4+zNY0Sps+mrVN9w==", "dependencies": { "@aws-sdk/client-s3": "^3.400.0", "@supercharge/promise-pool": "^2.1.0", @@ -5905,9 +5905,9 @@ } }, "@defillama/sdk": { - "version": "4.0.62", - "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.62.tgz", - "integrity": "sha512-Qh1I7EHlb/HIp2rQDrP96PQYMYNakLdakA4r3C7xYvbReyyyF5YdGzU8gEr8EiAesF2jmtR1Wtwa1r9FV0tcIQ==", + "version": "4.0.64", + "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.64.tgz", + "integrity": "sha512-wqM4enhx11vN5OuRNpK9QMoOEQbbQFKu7tT0rM6ddYA4w1tvuayWAn8mjfV8TN5wd88aHV4+zNY0Sps+mrVN9w==", "requires": { "@aws-sdk/client-s3": "^3.400.0", "@supercharge/promise-pool": "^2.1.0", diff --git a/projects/amphora/index.js b/projects/amphora/index.js index 2d64760645e..e817aed611b 100644 --- a/projects/amphora/index.js +++ b/projects/amphora/index.js @@ -1,13 +1,14 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens2 } = require('../helper/unwrapLPs'); async function tvl(_, _1, _2, { api }) { const ownerAddress = "0xA905f9f0b525420d4E5214E73d70dfFe8438D8C8"; const tokensAndOwners = [ ["0xb2f30a7c980f052f02563fb518dcc39e6bf38175", "0xD842D9651F69cEBc0b2Cffc291fC3D3Fe7b5D226"], - ["0xC011a73ee8576Fb46F5E1c5751cA3B9Fe0af2a6F", ownerAddress], + [ADDRESSES.ethereum.SNX, ownerAddress], ["0xba100000625a3754423978a60c9317c58a424e3D", ownerAddress], - ["0xD533a949740bb3306d119CC777fa900bA034cd52", ownerAddress,], - ["0x4e3FBD56CD56c3e72c1403e103b45Db9da5B9D2B", ownerAddress,], + [ADDRESSES.ethereum.CRV, ownerAddress,], + [ADDRESSES.ethereum.CVX, ownerAddress,], ["0xD842D9651F69cEBc0b2Cffc291fC3D3Fe7b5D226", ownerAddress,] ]; diff --git a/projects/apex/index.js b/projects/apex/index.js index dbb469d3b98..92c21095c6f 100644 --- a/projects/apex/index.js +++ b/projects/apex/index.js @@ -20,12 +20,12 @@ const walletAddresses = { }; const tokenAddress = { - bsc: '0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d', - polygon: '0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174', - arbitrum: '0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8', - avax: '0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E', - optimism: '0x7F5c764cBc14f9669B88837ca1490cCa17c31607', - mantle: '0x09Bc4E0D864854c6aFB6eB9A9cdF58aC190D0dF9', + bsc: ADDRESSES.bsc.USDC, + polygon: ADDRESSES.polygon.USDC, + arbitrum: ADDRESSES.arbitrum.USDC, + avax: ADDRESSES.avax.USDC, + optimism: ADDRESSES.optimism.USDC, + mantle: ADDRESSES.mantle.USDC, } module.exports = { diff --git a/projects/arcanum/index.js b/projects/arcanum/index.js index fd519d04b18..086434782b5 100644 --- a/projects/arcanum/index.js +++ b/projects/arcanum/index.js @@ -1,7 +1,8 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokensExport } = require('../helper/unwrapLPs') const ARBI_CONTRACT = '0xfc2f1678f7c0d78c3911090c92b86bca7cc3a8b7'; const ASSETS_CONTRACTS = [ - '0xfc5a1a6eb076a2c7ad06ed22c90d7e710e35ad0a', + ADDRESSES.arbitrum.GMX, '0x11cdb42b0eb46d95f990bedd4695a6e3fa034978', '0x18c11fd286c5ec11c3b683caa813b77f5163a122', '0xb64e280e9d1b5dbec4accedb2257a87b400db149', diff --git a/projects/cbETH/index.js b/projects/cbETH/index.js index e0beb046705..7370441aacb 100644 --- a/projects/cbETH/index.js +++ b/projects/cbETH/index.js @@ -1,5 +1,6 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { default: axios } = require("axios") -const token = '0xbe9895146f7af43049ca1c1ae358b0541ea49704' +const token = ADDRESSES.ethereum.cbETH module.exports = { ethereum: { diff --git a/projects/celerbridge/index.js b/projects/celerbridge/index.js index d65334b8025..ea538f461d0 100644 --- a/projects/celerbridge/index.js +++ b/projects/celerbridge/index.js @@ -170,7 +170,7 @@ const liquidityBridgeTokens = [ { // LYRA ethereum: "0x01ba67aac7f75f647d94220cc98fb30fcc5105bf", - optimism: "0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb", + optimism: ADDRESSES.base.DAI, }, { // IMX diff --git a/projects/diva/index.js b/projects/diva/index.js index 98d418748cf..31d7d6eb969 100644 --- a/projects/diva/index.js +++ b/projects/diva/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokensExport } = require('../helper/unwrapLPs') module.exports = { @@ -7,8 +8,8 @@ module.exports = { "0x1ce8aafb51e79f6bdc0ef2ebd6fd34b00620f6db", "0x16770d642e882e1769ce4ac8612b8bc0601506fc" ], tokens: [ - "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", - "0xae7ab96520de3a18e5e111b5eaab095312d7fe84" + ADDRESSES.ethereum.WETH, + ADDRESSES.ethereum.STETH ]}), } }; \ No newline at end of file diff --git a/projects/dopex/index.js b/projects/dopex/index.js index cf87dfb433f..69776bad046 100644 --- a/projects/dopex/index.js +++ b/projects/dopex/index.js @@ -133,7 +133,7 @@ async function arbTvl(timestamp, block, chainBlocks) { await ssovTvl(balances, ssovs, chainBlocks.arbitrum, "arbitrum"); await crvTvls(balances, crvPools, chainBlocks.arbitrum, "arbitrum"); await sumTokens(balances, [ - ["0x912ce59144191c1204e64559fe8253a0e49e6548", "0xDF3d96299275E2Fb40124b8Ad9d270acFDcc6148"], + [ADDRESSES.arbitrum.ARB, "0xDF3d96299275E2Fb40124b8Ad9d270acFDcc6148"], ["0x6c2c06790b3e3e3c38e12ee22f8183b37a13ee55", "0x05E7ACeD3b7727f9129E6d302B488cd8a1e0C817"], ["0x32eb7902d4134bf98a28b963d26de779af92a212", "0xd74c61ca8917Be73377D74A007E6f002c25Efb4e"] ], chainBlocks.arbitrum, "arbitrum") diff --git a/projects/helper/cex.js b/projects/helper/cex.js index 49ff19b074a..fa2c6d1ad6a 100644 --- a/projects/helper/cex.js +++ b/projects/helper/cex.js @@ -175,9 +175,9 @@ const defaultTokens = { ], linea: [ nullAddress, - "0xa219439258ca9da29e9cc4ce5596924745e12b93", //bridge usdt - "0x176211869ca2b568f2a7d4ee941e073a821ee1ff", //usdc bridge - "0x4af15ec2a0bd43db75dd04e62faa3b8ef36b00d5" //dai bridge + ADDRESSES.linea.USDT, //bridge usdt + ADDRESSES.linea.USDC, //usdc bridge + ADDRESSES.linea.DAI //dai bridge ], flare: [ nullAddress, @@ -185,7 +185,7 @@ const defaultTokens = { ], celo: [ nullAddress, - "0x471ece3750da237f93b8e339c536989b8978a438" //celo + ADDRESSES.celo.CELO //celo ], } diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 3e07a889fec..89bd047ef44 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -58,10 +58,10 @@ const fixBalancesTokens = { }, shimmer_evm: { '0x1074010000000000000000000000000000000000': { coingeckoId: 'shimmer', decimals: 6 }, - '0xBEb654A116aeEf764988DF0C6B4bf67CC869D01b': { coingeckoId: 'shimmer', decimals: 18 }, + [ADDRESSES.shimmer_evm.WSMR]: { coingeckoId: 'shimmer', decimals: 18 }, '0x6c890075406c5df08b427609e3a2ead1851ad68d': { coingeckoId: 'shimmer', decimals: 18 }, '0x3C844FB5AD27A078d945dDDA8076A4084A76E513': { coingeckoId: 'soonaverse', decimals: 6 }, - '0xc0e49f8c615d3d4c245970f6dc528e4a47d69a44': { coingeckoId: 'tether', decimals: 18 }, + [ADDRESSES.shimmer_evm.USDT]: { coingeckoId: 'tether', decimals: 18 }, '0xa158a39d00c79019a01a6e86c56e96c461334eb0': { coingeckoId: 'ethereum', decimals: 18 }, '0x1cdf3f46dbf8cf099d218cf96a769cea82f75316': { coingeckoId: 'wrapped-bitcoin', decimals: 8 }, }, @@ -71,7 +71,7 @@ const fixBalancesTokens = { '0xf417f5a458ec102b90352f697d6e2ac3a3d2851f': { coingeckoId: 'tether', decimals: 6 }, }, nos: { - '0x111808AbE352c8003e0eFfcc04998EaB26Cebe3c': { coingeckoId: 'bitcoin', decimals: 18 }, + [ADDRESSES.nos.BTC]: { coingeckoId: 'bitcoin', decimals: 18 }, }, ton: { 'EQBq4d4GPyBoh-Pjnf3wxUyQSS28WY2Yt-7cPAG8FHpWpNRX': { coingeckoId: 'matic-network', decimals: 18 }, @@ -81,9 +81,9 @@ const fixBalancesTokens = { 'EQCf7Nb341dxOE3N0jimngRxGEV8T3zo-eU2EZVs_nchNhhZ': { coingeckoId: 'wemix-token', decimals: 18 } }, beam: { - '0xd51bfa777609213a653a2cd067c9a0132a2d316a': { coingeckoId: 'merit-circle', decimals: 18 }, - '0x76bf5e7d2bcb06b1444c0a2742780051d8d0e304': { coingeckoId: 'usd-coin', decimals: 6 }, - '0x999f90f25a2922ae1b21A06066F7EDEbedad42a9': { coingeckoId: 'tether', decimals: 18 }, + [ADDRESSES.beam.WMC]: { coingeckoId: 'merit-circle', decimals: 18 }, + [ADDRESSES.beam.USDC]: { coingeckoId: 'usd-coin', decimals: 6 }, + [ADDRESSES.beam.USDT]: { coingeckoId: 'tether', decimals: 18 }, } } diff --git a/projects/ip/index.js b/projects/ip/index.js index 2921426354e..953d6e5da00 100644 --- a/projects/ip/index.js +++ b/projects/ip/index.js @@ -41,7 +41,7 @@ const cappedTokens = { symbol: 'rETH', }, "0x99bd1f28a5A7feCbE39a53463a916794Be798FC3": { - address: '0xBe9895146f7AF43049ca1c1AE358B0541Ea49704', + address: ADDRESSES.ethereum.cbETH, symbol: 'cbETH', }, } diff --git a/projects/leetswap/index.js b/projects/leetswap/index.js index 32536a5740a..dc74195aa24 100644 --- a/projects/leetswap/index.js +++ b/projects/leetswap/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { getUniTVL } = require('../helper/unknownTokens') module.exports = { @@ -6,7 +7,7 @@ module.exports = { canto: { tvl: getUniTVL({ factory: '0x116e8a41E8B0A5A87058AF110C0Ddd55a0ed82B7', useDefaultCoreAssets: true, }), }, linea: { tvl: getUniTVL({ factory: '0x4DDf0fa98B5f9Bd7Cb0645c25bA89A574fe9Be8c', useDefaultCoreAssets: true, }), }, shibarium: { tvl: getUniTVL({ factory: '0xd3Ea3BC1F5A3F881bD6cE9761cbA5A0833a5d737', useDefaultCoreAssets: true, }), }, - op_bnb: { tvl: getUniTVL({ factory: '0xa2899c776bAAF9925d432F83C950D5054A6CF59C', useDefaultCoreAssets: true, }), }, + op_bnb: { tvl: getUniTVL({ factory: ADDRESSES.shibarium.BONE_4, useDefaultCoreAssets: true, }), }, base: { tvl: getUniTVL({ factory: '0x169C06b4cfB09bFD73A81e6f2Bb1eB514D75bB19', useDefaultCoreAssets: true, hasStablePools: true, stablePoolSymbol: 'sLS2', }), }, - manta: { tvl: getUniTVL({ factory: '0xa2899c776bAAF9925d432F83C950D5054A6CF59C', useDefaultCoreAssets: true, }), }, + manta: { tvl: getUniTVL({ factory: ADDRESSES.shibarium.BONE_4, useDefaultCoreAssets: true, }), }, } diff --git a/projects/lybra-v2/index.js b/projects/lybra-v2/index.js index 711e2981915..c8acd6af6f9 100644 --- a/projects/lybra-v2/index.js +++ b/projects/lybra-v2/index.js @@ -10,6 +10,6 @@ const rETHvault = "0x090B2787D6798000710a8e821EC6111d254bb958" module.exports = { start: 17990141, ethereum: { - tvl: sumTokensExport({ tokensAndOwners2: [[ADDRESSES.ethereum.STETH, "0x7f39c581f595b53c5cb19bd0b3f8da6c935e2ca0", "0xa2e3356610840701bdf5611a53974510ae27e2e1", "0xae78736cd615f374d3085123a210448e74fc6393"], [stETHvault, wstETHvault, wbETHvault, rETHvault]] }), + tvl: sumTokensExport({ tokensAndOwners2: [[ADDRESSES.ethereum.STETH, ADDRESSES.ethereum.WSTETH, "0xa2e3356610840701bdf5611a53974510ae27e2e1", ADDRESSES.ethereum.RETH], [stETHvault, wstETHvault, wbETHvault, rETHvault]] }), } }; diff --git a/projects/meanfinance/addresses.js b/projects/meanfinance/addresses.js index a0992c91f89..0e16b822a8b 100644 --- a/projects/meanfinance/addresses.js +++ b/projects/meanfinance/addresses.js @@ -19,7 +19,7 @@ const TOKENS_IN_LEGACY_VERSIONS = { ADDRESSES.tombchain.FTM, // WETH ADDRESSES.optimism.OP, // OP ADDRESSES.optimism.BitANT, // BitANT - '0x50c5725949a6f0c72e6c4a641f24049a917db0cb', // LYRA + ADDRESSES.base.DAI, // LYRA '0x65559aa14915a70190438ef90104769e5e890a00', // ENS '0x68f180fcce6836688e9084f035309e29bf0a2095', // WBTC '0x6fd9d7ad17242c41f7131d257212c54a0e816691', // UNI diff --git a/projects/omnibtc/index.js b/projects/omnibtc/index.js index 78444de6f40..f86ef26f47e 100644 --- a/projects/omnibtc/index.js +++ b/projects/omnibtc/index.js @@ -11,7 +11,7 @@ const POOLS = { optimism: "0x233DDEce6a96c49ecE6Ad9ae820690fE62a28975", polygon: "0xC3Eb696184b8927D677D8AB390A26563De4798c3", }; -const DEFAULT_TOKEN = "0x0000000000000000000000000000000000000000"; +const DEFAULT_TOKEN = ADDRESSES.null; const DECIMAL_SHIFTS = { [ADDRESSES.sui.USDC]: -2, diff --git a/projects/overnight-daiPlus/index.js b/projects/overnight-daiPlus/index.js index 8e6cabc3654..91086a1d1f8 100644 --- a/projects/overnight-daiPlus/index.js +++ b/projects/overnight-daiPlus/index.js @@ -10,7 +10,7 @@ const m2m = { const assets = { optimism: ADDRESSES.optimism.DAI, //DAI arbitrum: ADDRESSES.optimism.DAI, //DAI - base: "0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb" //DAI + base: ADDRESSES.base.DAI //DAI } const abi = "uint256:totalNetAssets" diff --git a/projects/preon/index.js b/projects/preon/index.js index 07e9d6c36d8..3e15aa73aed 100644 --- a/projects/preon/index.js +++ b/projects/preon/index.js @@ -7,7 +7,7 @@ const config = { [ [ ADDRESSES.null, - "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1", + ADDRESSES.arbitrum.WETH, "0xe50fa9b3c56ffb159cb0fca61f5c9d750e8128c8", ], "0xA2Ce28868A852f4B01903B5de07d4835feFe9086", @@ -26,7 +26,7 @@ const config = { [ [ ADDRESSES.null, - "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270", + ADDRESSES.polygon.WMATIC_2, "0x6d80113e533a2C0fe82EaBD35f1875DcEA89Ea97", ], "0x82CD73E9cc96cC12569D412cC2480E4d5962AfF5", @@ -42,7 +42,7 @@ const config = { [ [ ADDRESSES.null, - "0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063", + ADDRESSES.polygon.DAI, "0x82E64f49Ed5EC1bC6e43DAD4FC8Af9bb3A2312EE", ], "0xdc4552609a3f673f0b72958f678d4a48d0e94ebd", diff --git a/projects/pyswap/index.js b/projects/pyswap/index.js index 86c46d0f573..3f98df12835 100644 --- a/projects/pyswap/index.js +++ b/projects/pyswap/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokensExport } = require("../helper/unwrapLPs"); const {getUniTVL} = require("../helper/unknownTokens"); @@ -7,7 +8,7 @@ const pys_staking_contract = "0x18E2fA8c010b56779285336D0920F1027f0bDBbb"; const assets = [ "0x9b5902C14B56eF2aa2cC1A2A0731a8F270Ee82f0", //WBNB - "0x0000000000000000000000000000000000000000", // This is address of native token + ADDRESSES.null, // This is address of native token "0x602aEe302B2703cD2BAC28e13192593228e0078C", // PYSWAP TOKEN ]; diff --git a/projects/shibfi/index.js b/projects/shibfi/index.js index 74d2d4966e6..b7e699085c6 100644 --- a/projects/shibfi/index.js +++ b/projects/shibfi/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokensExport } = require("../helper/unwrapLPs"); const {getUniTVL} = require("../helper/unknownTokens"); @@ -7,7 +8,7 @@ const shibfi_staking_contract = "0x1ae96F6E24Ca24Db5cA97797E528d63bfc9dD0Ef"; const assets = [ "0x7915fE3be85D591cC0395D30AB76Ee7aA12a085D", //WBONE - "0x0000000000000000000000000000000000000000", // This is address of native token + ADDRESSES.null, // This is address of native token "0xa98900F53fa3e5bFe6F2283F4C4E57ca3DF5387c", // SHIBFI TOKEN ]; diff --git a/projects/sithswap/api.js b/projects/sithswap/api.js index ed3da6c586b..074def47b92 100644 --- a/projects/sithswap/api.js +++ b/projects/sithswap/api.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') // https://www.starknetjs.com/docs/API/contract const { call, multiCall, } = require('../helper/chain/starknet') diff --git a/projects/solid-world/forward-contract-batch-supply.js b/projects/solid-world/forward-contract-batch-supply.js index 20f4fb7a45b..88a75913f33 100644 --- a/projects/solid-world/forward-contract-batch-supply.js +++ b/projects/solid-world/forward-contract-batch-supply.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { getLogs } = require("../helper/cache/getLogs"); const { config } = require("./config"); const BigNumber = require("bignumber.js"); diff --git a/projects/standard-smart-vaults/index.js b/projects/standard-smart-vaults/index.js index b12886613c7..549acbeb86c 100644 --- a/projects/standard-smart-vaults/index.js +++ b/projects/standard-smart-vaults/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { ethers } = require('ethers'); const { getLogs } = require('../helper/cache/getLogs') const SMART_VAULT_MANAGER_ADDRESS = '0xba169cceCCF7aC51dA223e04654Cf16ef41A68CC' @@ -6,9 +7,9 @@ const START_TS = 1693206000; const tokens = [ ethers.constants.AddressZero, - '0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f', - '0x912CE59144191C1204E64559FE8253a0e49E6548', - '0xf97f4df75117a78c1A5a0DBb814Af92458539FB4', + ADDRESSES.arbitrum.WBTC, + ADDRESSES.arbitrum.ARB, + ADDRESSES.arbitrum.LINK, '0xfEb4DfC8C4Cf7Ed305bb08065D08eC6ee6728429' ] diff --git a/projects/starkex/api.js b/projects/starkex/api.js index 85ccc1c17f7..1b7d1e5c14d 100644 --- a/projects/starkex/api.js +++ b/projects/starkex/api.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { call, multiCall, parseAddress } = require('../helper/chain/starknet') const abi = require('./abi') diff --git a/projects/tangible/index.js b/projects/tangible/index.js index 9bc02db082d..36d8e6e443b 100644 --- a/projects/tangible/index.js +++ b/projects/tangible/index.js @@ -9,7 +9,7 @@ const { getInsuranceFundValueArb } = require("./insurance-fund-arbitrum"); // doc: https://docs.tangible.store/real-usd/real-usd-v3-contracts-and-addresses const TNGBL = '0x49e6A20f1BBdfEeC2a8222E052000BbB14EE6007'.toLowerCase() const USDR = '0x40379a439d4f6795b6fc9aa5687db461677a2dba'.toLowerCase() -const CVX_ETH = '0x4e3fbd56cd56c3e72c1403e103b45db9da5b9d2b'.toLowerCase() +const CVX_ETH = ADDRESSES.ethereum.CVX.toLowerCase() const { apGetAddress, getPriceManager, getCategories, getTotalSupply, getTokenByIndex, getTnftCustody, diff --git a/projects/tangible/insurance-fund-polygon.js b/projects/tangible/insurance-fund-polygon.js index c764a8257b3..826322d8cb5 100644 --- a/projects/tangible/insurance-fund-polygon.js +++ b/projects/tangible/insurance-fund-polygon.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const VE_VELO_ABI = require('./abi/VeVeloNFT.json'); const { createIncrementArray } = require('../helper/utils'); const { sumTokens2 } = require('../helper/unwrapLPs') @@ -6,17 +7,17 @@ const CAVIAR_CHEF_ABI = require('./abi/CaviarChef.json'); const insuranceTokens = { CAVIAR: '0x6AE96Cc93331c19148541D4D2f31363684917092', - DAI: '0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063', + DAI: ADDRESSES.polygon.DAI, PEARL: '0x7238390d5f6F64e67c3211C343A410E2A3DEc142', STAR: '0xC19669A405067927865B40Ea045a2baabbbe57f5', STMATIC: '0x3A58a54C066FdC0f2D55FC9C89F0415C92eBf3C4', TETU: '0x255707B70BF90aa112006E1b07B9AeA6De021424', TNGBL: '0x49e6A20f1BBdfEeC2a8222E052000BbB14EE6007', - USDC: '0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174', + USDC: ADDRESSES.polygon.USDC, USDR: '0x40379a439D4F6795B6fc9aa5687dB461677A2dBa', - USDT: '0xc2132D05D31c914a87C6611C10748AEb04B58e8F', - WETH: '0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619', - WMATIC: '0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270', + USDT: ADDRESSES.polygon.USDT, + WETH: ADDRESSES.polygon.WETH_1, + WMATIC: ADDRESSES.polygon.WMATIC_2, WUSDR: '0x00e8c0E92eB3Ad88189E7125Ec8825eDc03Ab265', TETU_BPT: '0xE2f706EF1f7240b803AAe877C9C762644bb808d8', } diff --git a/projects/treasury/baseswap.js b/projects/treasury/baseswap.js index bf51ef7f989..7009dd14b84 100644 --- a/projects/treasury/baseswap.js +++ b/projects/treasury/baseswap.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { nullAddress, treasuryExports } = require("../helper/treasury"); const treasury = "0xAF1823bACd8EDDA3b815180a61F8741fA4aBc6Dd"; @@ -6,7 +7,7 @@ module.exports = treasuryExports({ base: { tokens: [ nullAddress, - "0xd9aAEc86B65D86f6A7B5B1b0c42FFA531710b6CA", //USDbC + ADDRESSES.base.USDbC, //USDbC ], owners: [treasury,], }, diff --git a/projects/treasury/brewlabs.js b/projects/treasury/brewlabs.js index f2c681e28ef..0de60cd15c4 100644 --- a/projects/treasury/brewlabs.js +++ b/projects/treasury/brewlabs.js @@ -12,9 +12,9 @@ module.exports = treasuryExports({ bsc: { tokens: [ nullAddress, - '0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56',//busd - '0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c',//wbnb - '0x55d398326f99059fF775485246999027B3197955',//bsc-usd + ADDRESSES.bsc.BUSD,//busd + ADDRESSES.bsc.WBNB,//wbnb + ADDRESSES.bsc.USDT,//bsc-usd '0x9d7107c8E30617CAdc11f9692A19C82ae8bbA938',//roo '0xF14D3692B0055Db9Ca4c04065165d59B87E763f1',//mbc '0xe91a8D2c584Ca93C7405F15c22CdFE53C29896E3',//dext diff --git a/projects/treasury/gnosis-dao.js b/projects/treasury/gnosis-dao.js index 4507e5b9a48..0db4c4e5790 100644 --- a/projects/treasury/gnosis-dao.js +++ b/projects/treasury/gnosis-dao.js @@ -10,7 +10,7 @@ const treasury3 = "0xBc79855178842FDBA0c353494895DEEf509E26bB"; const GNO = ADDRESSES.ethereum.GNO; const treasurygnosis = "0x458cd345b4c05e8df39d0a07220feb4ec19f5e6f" -const gnognosis = "0x9C58BAcC331c9aa871AFD802DB6379a98e80CEdb" +const gnognosis = ADDRESSES.xdai.GNO async function tvl(_, _b, _cb, { api, }) { const treasury = '0x849d52316331967b6ff1198e5e32a0eb168d039d' @@ -81,7 +81,7 @@ module.exports = treasuryExports({ xdai: { tokens: [ nullAddress, - "0x6A023CCd1ff6F2045C3309768eAd9E68F978f6e1", //eth + ADDRESSES.xdai.WETH, //eth "0x6C76971f98945AE98dD7d4DFcA8711ebea946eA6", //wstETH "0xEb30C85CC528537f5350CF5684Ce6a4538e13394", "0xd4e420bBf00b0F409188b338c5D87Df761d6C894", @@ -89,7 +89,7 @@ module.exports = treasuryExports({ "0x44932e3b1E662AdDE2F7bac6D5081C5adab908c6", "0x291B5957c9CBe9Ca6f0b98281594b4eB495F4ec1", "0x3a97704a1b25F08aa230ae53B352e2e72ef52843", - "0x8e5bBbb09Ed1ebdE8674Cda39A0c169401db4252", + ADDRESSES.xdai.WBTC, "0xA26783eAd6C1f4744685c14079950622674ae8A8", "0xa99FD9950B5D5dCeEaf4939E221dcA8cA9B938aB", "0x21d4c792Ea7E38e0D0819c2011A2b1Cb7252Bd99", diff --git a/projects/treasury/loot-dao.js b/projects/treasury/loot-dao.js index 14c83c4308b..2a42bd7895b 100644 --- a/projects/treasury/loot-dao.js +++ b/projects/treasury/loot-dao.js @@ -12,7 +12,7 @@ module.exports = treasuryExports({ ownTokens: [loot] // loot }, polygon: { - tokens: [nullAddress, "0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619"], //weth + tokens: [nullAddress, ADDRESSES.polygon.WETH_1], //weth owners: [treasury], }, }); \ No newline at end of file diff --git a/projects/treasury/lyra.js b/projects/treasury/lyra.js index 8602d08414c..fa4a987c54a 100644 --- a/projects/treasury/lyra.js +++ b/projects/treasury/lyra.js @@ -7,7 +7,7 @@ const treasury_op = "0xD4C00FE7657791C2A43025dE483F05E49A5f76A6"; const lyra_eth = "0x01BA67AAC7f75f647D94220Cc98FB30FCc5105Bf"; const lyra_arb = "0x079504b86d38119F859c4194765029F692b7B7aa"; -const lyra_op = "0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb"; +const lyra_op = ADDRESSES.base.DAI; module.exports = treasuryExports({ arbitrum: { diff --git a/projects/treasury/nouns.js b/projects/treasury/nouns.js index abf32559b5e..4bb68ac8186 100644 --- a/projects/treasury/nouns.js +++ b/projects/treasury/nouns.js @@ -11,7 +11,7 @@ module.exports = treasuryExports({ ADDRESSES.ethereum.USDC, //USDC ADDRESSES.ethereum.STETH,//stETH ADDRESSES.ethereum.RETH, - "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0" //wstETH + ADDRESSES.ethereum.WSTETH //wstETH ], owners: [treasury, treasury1], }, diff --git a/projects/treasury/paladin-finance.js b/projects/treasury/paladin-finance.js index b2c1cf2cee4..bb7eeb930b1 100644 --- a/projects/treasury/paladin-finance.js +++ b/projects/treasury/paladin-finance.js @@ -43,7 +43,7 @@ module.exports = treasuryExports({ '0x1509706a6c66CA549ff0cB464de88231DDBe213B',//AURA '0x040d1EdC9569d4Bab2D15287Dc5A4F10F56a56B8',//BAL '0xf0cb2dc0db5e6c66B9a70Ac27B06b878da017028',//OHM - '0x912CE59144191C1204E64559FE8253a0e49E6548',//ARB + ADDRESSES.arbitrum.ARB,//ARB ], owners: [treasuryarb] } diff --git a/projects/treasury/silo-finance.js b/projects/treasury/silo-finance.js index 32550309097..385145c988a 100644 --- a/projects/treasury/silo-finance.js +++ b/projects/treasury/silo-finance.js @@ -50,8 +50,8 @@ module.exports = mergeExports([ nullAddress, ADDRESSES.arbitrum.ARB, // ARB ADDRESSES.arbitrum.GMX, // GMX - "0xaf88d065e77c8cC2239327C5EDb3A432268e5831", // USDC Native - "0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8", // USDC.e (Bridged) + ADDRESSES.arbitrum.USDC_CIRCLE, // USDC Native + ADDRESSES.arbitrum.USDC, // USDC.e (Bridged) "0x6C2C06790b3E3E3c38e12Ee22F8183b37a13EE55", // DPX "0x18c11FD286C5EC11c3b683Caa813B77f5163A122", // GNS "0x51fC0f6660482Ea73330E414eFd7808811a57Fa2", // PREMIA diff --git a/projects/treasury/the-standard.js b/projects/treasury/the-standard.js index 1d9725e9e44..328e1ff7f51 100644 --- a/projects/treasury/the-standard.js +++ b/projects/treasury/the-standard.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { nullAddress, treasuryExports } = require("../helper/treasury"); const treasuryARB = "0x99d5D7C8F40Deba9d0075E8Fff2fB13Da787996a"; @@ -11,7 +12,7 @@ module.exports = treasuryExports({ tokens: [ nullAddress, "0x643b34980E635719C15a2D4ce69571a258F940E9", - "0xaf88d065e77c8cC2239327C5EDb3A432268e5831" + ADDRESSES.arbitrum.USDC_CIRCLE ], owners: [treasuryARB], ownTokens: [TST], @@ -19,8 +20,8 @@ module.exports = treasuryExports({ ethereum: { tokens: [ nullAddress, - "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", - "0xdAC17F958D2ee523a2206206994597C13D831ec7" + ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.USDT ], owners: [treasuryETH], ownTokens: [TSTETH], diff --git a/projects/treasury/tprotocol.js b/projects/treasury/tprotocol.js index 77656a8e758..cf651fa972f 100644 --- a/projects/treasury/tprotocol.js +++ b/projects/treasury/tprotocol.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { nullAddress, treasuryExports } = require("../helper/treasury"); const treasury = "0xa01D9bc8343016C7DDD39852e49890a8361B2884"; @@ -8,7 +9,7 @@ module.exports = treasuryExports({ tokens: [ nullAddress, '0x530824DA86689C9C17CdC2871Ff29B058345b44a', //stbt - '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', //usdc + ADDRESSES.ethereum.USDC, //usdc ], owners: [treasury], ownTokens: [], diff --git a/projects/valorem/index.js b/projects/valorem/index.js index c5f0e1be89c..b08fe2dbcb1 100644 --- a/projects/valorem/index.js +++ b/projects/valorem/index.js @@ -1,14 +1,15 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokensExport } = require("../helper/unwrapLPs"); const CLEARINGHOUSE_ADDRESS = "0x402A401B1944EBb5A3030F36Aa70d6b5794190c9"; const arbitrumOneDeployUnixTimestamp = 1693583626; -const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000"; +const ZERO_ADDRESS = ADDRESSES.null; const TOKENS_BY_CHAIN = { ["arbitrum"]: { ETH: ZERO_ADDRESS, - WETH: "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1", - USDC: "0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8", + WETH: ADDRESSES.arbitrum.WETH, + USDC: ADDRESSES.arbitrum.USDC, }, }; diff --git a/projects/vaultka/index.js b/projects/vaultka/index.js index db61306a358..450ee1c4b0d 100644 --- a/projects/vaultka/index.js +++ b/projects/vaultka/index.js @@ -33,7 +33,7 @@ module.exports = { sakeWaterV2: "0x806e8538FC05774Ea83d9428F778E423F6492475", vodkaV1_Water: "0xC99C6427cB0B824207606dC2745A512C6b066E7C", VodkaV1: "0x88D7500aF99f11fF52E9f185C7aAFBdF9acabD93", - fsGlp: "0x1aDDD80E6039594eE970E5872D247bf0414C8903", + fsGlp: ADDRESSES.arbitrum.fsGLP, vodkaV2: "0x9198989a85E35adeC46309E06684dCA444c9cF27", vodkaV2_Water: "0x9045ae36f963b7184861BDce205ea8B08913B48c", gmWeth: "0x70d95587d40A2caf56bd97485aB3Eec10Bee6336", // weth/usdc.e diff --git a/projects/wanlend/index.js b/projects/wanlend/index.js index c8d704e8fb9..ae7445b7ee7 100644 --- a/projects/wanlend/index.js +++ b/projects/wanlend/index.js @@ -1,7 +1,8 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { compoundExports2 } = require("../helper/compound"); const { mergeExports } = require("../helper/utils"); -const cetheEquivalent='0xdabd997ae5e4799be47d6e69d9431615cba28f48' +const cetheEquivalent=ADDRESSES.wan.WWAN const tvlV1 = compoundExports2( { comptroller: '0x21c72522005ccf570f40acaa04b448918aecc2ad', cether: '0xE8548014f731194764AF27C8edc9bbAA7d2f4C46', cetheEquivalent}) const tvlV2 = compoundExports2( { comptroller: '0xd6980C52C20Fb106e54cC6c8AE04c089C3F6B9d6', cether: '0x48c42529c4c8e3d10060e04240e9ec6cd0eb1218', cetheEquivalent}) delete tvlV1.borrowed diff --git a/projects/zeta/index.js b/projects/zeta/index.js index 6589fa72cd4..244ba7caf4e 100644 --- a/projects/zeta/index.js +++ b/projects/zeta/index.js @@ -1,10 +1,11 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { PublicKey } = require("@solana/web3.js"); const anchor = require("@project-serum/anchor"); const { sumTokens2 } = require("../helper/solana"); const ZETA_PROGRAM_ID = new PublicKey( "ZETAxsqBRek56DhiGXrn75yj2NHU3aYUnxvHXpkf3aD" ); -const USDC_MINT = new PublicKey("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"); +const USDC_MINT = new PublicKey(ADDRESSES.solana.USDC); module.exports = { timetravel: false, diff --git a/projects/zkevmswap/index.js b/projects/zkevmswap/index.js index 95b0648319a..0b8dd276e8e 100644 --- a/projects/zkevmswap/index.js +++ b/projects/zkevmswap/index.js @@ -1,10 +1,11 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { getUniTVL } = require('../helper/unknownTokens') module.exports = { misrepresentedTokens: true, polygon_zkevm: { tvl: getUniTVL({ - factory: '0x213c25900f365F1BE338Df478CD82beF7Fd43F85', + factory: ADDRESSES.shibarium.BONE_1, useDefaultCoreAssets: true, }) }, diff --git a/utils/scripts/useTokenLabels.js b/utils/scripts/useTokenLabels.js index e065d2b3f1e..36a87306397 100644 --- a/utils/scripts/useTokenLabels.js +++ b/utils/scripts/useTokenLabels.js @@ -51,6 +51,7 @@ function updateFile(file) { fs.writeFileSync(file, fileStr, { encoding: 'utf-8' }) function updateFileStr(label, address, file) { + if (!address || !address.length) return; if (!updateFile) { updateFile = (new RegExp(address, 'i')).test(fileStr) // if (updateFile) From 9c8b4aa65d12f6e06c13aa9ad7ac6feba231dea1 Mon Sep 17 00:00:00 2001 From: llama Date: Wed, 11 Oct 2023 11:53:48 +0200 Subject: [PATCH 1493/1974] track scrollswap --- projects/helper/chains.json | 1 + projects/helper/tokenMapping.js | 4 ++++ projects/scrollswap/index.js | 3 +++ 3 files changed, 8 insertions(+) create mode 100644 projects/scrollswap/index.js diff --git a/projects/helper/chains.json b/projects/helper/chains.json index 10e231279e3..0e7cf467c88 100644 --- a/projects/helper/chains.json +++ b/projects/helper/chains.json @@ -187,6 +187,7 @@ "rsk", "rvn", "rpg", + "scroll", "secret", "sei", "shibarium", diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 89bd047ef44..37b68cfbaca 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -70,6 +70,10 @@ const fixBalancesTokens = { '0xb73603c5d87fa094b7314c74ace2e64d165016fb': { coingeckoId: 'usd-coin', decimals: 6 }, '0xf417f5a458ec102b90352f697d6e2ac3a3d2851f': { coingeckoId: 'tether', decimals: 6 }, }, + scroll: { + '0x5300000000000000000000000000000000000004': { coingeckoId: 'ethereum', decimals: 18 }, + [ADDRESSES.null]: { coingeckoId: 'ethereum', decimals: 18 }, + }, nos: { [ADDRESSES.nos.BTC]: { coingeckoId: 'bitcoin', decimals: 18 }, }, diff --git a/projects/scrollswap/index.js b/projects/scrollswap/index.js new file mode 100644 index 00000000000..976592b8d92 --- /dev/null +++ b/projects/scrollswap/index.js @@ -0,0 +1,3 @@ +const { uniTvlExport } = require('../helper/unknownTokens') + +module.exports = uniTvlExport('scroll', '0x0082123Cf29a85f48Cd977D3000aec145A3B452F', true) \ No newline at end of file From 8c68ea6a16808e5b41f49380f0804e10fff5cc98 Mon Sep 17 00:00:00 2001 From: llama Date: Wed, 11 Oct 2023 12:39:09 +0200 Subject: [PATCH 1494/1974] bugfix --- projects/helper/tokenMapping.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 37b68cfbaca..be010ce1708 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -16,7 +16,7 @@ coreAssets = JSON.parse(JSON.stringify(coreAssets)) // carbon: https://api-insights.carbon.network/info/denom_gecko_map // orbit brige: https://bridge.orbitchain.io/open/v1/api/monitor/rawTokenList -const ibcChains = ['ibc', 'terra', 'terra2', 'crescent', 'osmosis', 'kujira', 'stargaze', 'juno', 'injective', 'cosmos', 'comdex', 'umee', 'orai', 'persistence', 'fxcore', 'neutron', 'quasar', 'chihuahua', 'sei', 'archway', 'migaloo', 'secret',] +const ibcChains = ['ibc', 'terra', 'terra2', 'crescent', 'osmosis', 'kujira', 'stargaze', 'juno', 'injective', 'cosmos', 'comdex', 'umee', 'orai', 'persistence', 'fxcore', 'neutron', 'quasar', 'chihuahua', 'sei', 'archway', 'migaloo', 'secret', 'aura'] const caseSensitiveChains = [...ibcChains, 'solana', 'tezos', 'ton', 'algorand', 'aptos', 'near', 'bitcoin', 'waves', 'tron', 'litecoin', 'polkadot', 'ripple', 'elrond', 'cardano', 'stacks', 'sui', 'ergo', 'mvc',] const distressedAssts = new Set(Object.values({ From a7ce6d84820c7ae48657719755b29b0f691a777e Mon Sep 17 00:00:00 2001 From: MercuryPunk <147511934+MercuryPunk@users.noreply.github.com> Date: Wed, 11 Oct 2023 15:33:20 +0200 Subject: [PATCH 1495/1974] Deepp Volume adapter creation. (#7680) * Initial Deepp LP adapter added. * code refactor --------- Co-authored-by: llama --- projects/deepp/index.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 projects/deepp/index.js diff --git a/projects/deepp/index.js b/projects/deepp/index.js new file mode 100644 index 00000000000..51b4fc9c100 --- /dev/null +++ b/projects/deepp/index.js @@ -0,0 +1,12 @@ +const { sumTokensExport } = require("../helper/unwrapLPs"); +const ADDRESSES = require("../helper/coreAssets.json"); + +const BET_LP_CONTRACT = '0x84a512E120294C2017a88a8f1af2219Ec250CBaa'; + +module.exports = { + methodology: 'Lists the number of owned USDC tokens in the Deepp LP and BetLock contracts.', + start: 1696118400, + arbitrum: { + tvl: sumTokensExport({ owners: [BET_LP_CONTRACT], tokens: [ADDRESSES.arbitrum.USDC_CIRCLE] }), + } +}; // node test.js projects/deepp/index.js \ No newline at end of file From 1526ddafac35a7cc80adc07067677f7275e54200 Mon Sep 17 00:00:00 2001 From: llama Date: Wed, 11 Oct 2023 15:35:13 +0200 Subject: [PATCH 1496/1974] scrollswap: upate factory address --- projects/scrollswap/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/scrollswap/index.js b/projects/scrollswap/index.js index 976592b8d92..379f5351cd0 100644 --- a/projects/scrollswap/index.js +++ b/projects/scrollswap/index.js @@ -1,3 +1,3 @@ const { uniTvlExport } = require('../helper/unknownTokens') -module.exports = uniTvlExport('scroll', '0x0082123Cf29a85f48Cd977D3000aec145A3B452F', true) \ No newline at end of file +module.exports = uniTvlExport('scroll', '0xaA4b3b63B0A828dc28b2De7Be6115198B080De09', true) \ No newline at end of file From 0f8a8bf11ba1caa4ccfe38cc15f3cf4a2f899b77 Mon Sep 17 00:00:00 2001 From: llama Date: Wed, 11 Oct 2023 15:36:55 +0200 Subject: [PATCH 1497/1974] revert change --- projects/scrollswap/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/scrollswap/index.js b/projects/scrollswap/index.js index 379f5351cd0..976592b8d92 100644 --- a/projects/scrollswap/index.js +++ b/projects/scrollswap/index.js @@ -1,3 +1,3 @@ const { uniTvlExport } = require('../helper/unknownTokens') -module.exports = uniTvlExport('scroll', '0xaA4b3b63B0A828dc28b2De7Be6115198B080De09', true) \ No newline at end of file +module.exports = uniTvlExport('scroll', '0x0082123Cf29a85f48Cd977D3000aec145A3B452F', true) \ No newline at end of file From e62141ce50ff68c773009cac73198115c9c45dd8 Mon Sep 17 00:00:00 2001 From: ScrollSwapFinance <147618047+ScrollSwapFinance@users.noreply.github.com> Date: Wed, 11 Oct 2023 20:37:52 +0700 Subject: [PATCH 1498/1974] scrollSwapFinance (#7681) --- projects/scrollswapfinance/index.js | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 projects/scrollswapfinance/index.js diff --git a/projects/scrollswapfinance/index.js b/projects/scrollswapfinance/index.js new file mode 100644 index 00000000000..379f5351cd0 --- /dev/null +++ b/projects/scrollswapfinance/index.js @@ -0,0 +1,3 @@ +const { uniTvlExport } = require('../helper/unknownTokens') + +module.exports = uniTvlExport('scroll', '0xaA4b3b63B0A828dc28b2De7Be6115198B080De09', true) \ No newline at end of file From 337f14957d63bd5943b2d0fce05c591dc9d90327 Mon Sep 17 00:00:00 2001 From: llama Date: Wed, 11 Oct 2023 15:39:58 +0200 Subject: [PATCH 1499/1974] minor fix --- projects/scrollswap/index.js | 2 +- projects/scrollswapfinance/index.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/scrollswap/index.js b/projects/scrollswap/index.js index 976592b8d92..524ceeeb697 100644 --- a/projects/scrollswap/index.js +++ b/projects/scrollswap/index.js @@ -1,3 +1,3 @@ const { uniTvlExport } = require('../helper/unknownTokens') -module.exports = uniTvlExport('scroll', '0x0082123Cf29a85f48Cd977D3000aec145A3B452F', true) \ No newline at end of file +module.exports = uniTvlExport('scroll', '0x0082123Cf29a85f48Cd977D3000aec145A3B452F', { fetchBalances: true, }) \ No newline at end of file diff --git a/projects/scrollswapfinance/index.js b/projects/scrollswapfinance/index.js index 379f5351cd0..ad28d8a552d 100644 --- a/projects/scrollswapfinance/index.js +++ b/projects/scrollswapfinance/index.js @@ -1,3 +1,3 @@ const { uniTvlExport } = require('../helper/unknownTokens') -module.exports = uniTvlExport('scroll', '0xaA4b3b63B0A828dc28b2De7Be6115198B080De09', true) \ No newline at end of file +module.exports = uniTvlExport('scroll', '0xaA4b3b63B0A828dc28b2De7Be6115198B080De09', { fetchBalances: true, }) \ No newline at end of file From a745a4ccb345145f9dde37c4efd31c381cd156f1 Mon Sep 17 00:00:00 2001 From: llama Date: Wed, 11 Oct 2023 17:37:58 +0200 Subject: [PATCH 1500/1974] update deepp --- projects/deepp/index.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/projects/deepp/index.js b/projects/deepp/index.js index 51b4fc9c100..2499155bdc1 100644 --- a/projects/deepp/index.js +++ b/projects/deepp/index.js @@ -1,12 +1,19 @@ const { sumTokensExport } = require("../helper/unwrapLPs"); const ADDRESSES = require("../helper/coreAssets.json"); -const BET_LP_CONTRACT = '0x84a512E120294C2017a88a8f1af2219Ec250CBaa'; - module.exports = { methodology: 'Lists the number of owned USDC tokens in the Deepp LP and BetLock contracts.', start: 1696118400, arbitrum: { - tvl: sumTokensExport({ owners: [BET_LP_CONTRACT], tokens: [ADDRESSES.arbitrum.USDC_CIRCLE] }), + tvl: sumTokensExport({ + owners: Object.values({ + BET_LP_CONTRACT: '0x84a512E120294C2017a88a8f1af2219Ec250CBaa', + BET_BOX_ADDRESS: '0x05E1F51067a3Af2f9d0994a97779a78a2E26f921', + BET_FEE_HANDLER_1_ADDRESS: '0x42e27a7D424C22ED3658970CAB01260f8C0EC5Bc', + BET_FEE_HANDLER_2_ADDRESS: '0xD5750d44D9F2ed117FB3441D80B423acD7634Cf5', + LP_FEE_HANDLER_1_ADDRESS: '0x80e674e6277A7e9073A6Dff5C98e08816c0D73f5', + LP_FEE_HANDLER_2_ADDRESS: '0xAb5e18D29C20709954eA380e998FFFeaeB4FF691', + }), tokens: [ADDRESSES.arbitrum.USDC_CIRCLE] + }), } }; // node test.js projects/deepp/index.js \ No newline at end of file From 430b9c49b56c731e3cc0a8341748a3ac4e38d6a4 Mon Sep 17 00:00:00 2001 From: llama Date: Wed, 11 Oct 2023 21:04:15 +0200 Subject: [PATCH 1501/1974] hotfix: summer.fi --- projects/summer-fi/handlers/dpm-positions.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/summer-fi/handlers/dpm-positions.js b/projects/summer-fi/handlers/dpm-positions.js index 48b06e9370f..51722e3ad30 100644 --- a/projects/summer-fi/handlers/dpm-positions.js +++ b/projects/summer-fi/handlers/dpm-positions.js @@ -44,8 +44,8 @@ query { }`; const dpmPositions = async ({ api, }) => { - const aave = await blockQuery(endpoints.aave(), aaveQuery(api.block), { api }); - const ajna = await blockQuery(endpoints.ajna(), ajnaQuery(api.block), { api }); + const aave = await blockQuery(endpoints.aave(), aaveQuery(api.block - 500), { api, }); + const ajna = await blockQuery(endpoints.ajna(), ajnaQuery(16854527), { api, }); const supportedAjnaPools = [ ...new Set(ajna.accounts.map(({ pool: { address } }) => address)), From 42f9e5c95278eff7039d3b28e2d63104d4aee175 Mon Sep 17 00:00:00 2001 From: theapesociety <98607857+theapesociety@users.noreply.github.com> Date: Wed, 11 Oct 2023 12:14:42 -0700 Subject: [PATCH 1502/1974] levvy.fi token lending (#7649) --- projects/levvy-fi-tokens/index.js | 36 +++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 projects/levvy-fi-tokens/index.js diff --git a/projects/levvy-fi-tokens/index.js b/projects/levvy-fi-tokens/index.js new file mode 100644 index 00000000000..7dd10eb21e2 --- /dev/null +++ b/projects/levvy-fi-tokens/index.js @@ -0,0 +1,36 @@ +const { post } = require("../helper/http"); + +module.exports = { + methodology: + "Counts ADA locked in token lending offer pools, and tokens locked as collateral in loans", + misrepresentedTokens: true, + cardano: { + tvl: async () => { + const data = await post( + "https://citizens.theapesociety.io/api/getLevvyData", + {} + ); + return { + cardano: data.tokens.tvl, + }; + }, + staking: async () => { + const data = await post( + "https://citizens.theapesociety.io/api/getLevvyData", + {} + ); + return { + cardano: data.tokens.staked, + }; + }, + borrowed: async () => { + const data = await post( + "https://citizens.theapesociety.io/api/getLevvyData", + {} + ); + return { + cardano: data.tokens.borrowed, + }; + }, + }, +}; From a2fbbb375e0bca83694106e25f0acd157d117176 Mon Sep 17 00:00:00 2001 From: SkyDromeFinance <146191819+SkyDromeFinance@users.noreply.github.com> Date: Wed, 11 Oct 2023 23:16:52 +0400 Subject: [PATCH 1503/1974] add skydrome (#7683) * add skydrome * minor fix --------- Co-authored-by: llama --- projects/skydrome/index.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 projects/skydrome/index.js diff --git a/projects/skydrome/index.js b/projects/skydrome/index.js new file mode 100644 index 00000000000..3fae613319b --- /dev/null +++ b/projects/skydrome/index.js @@ -0,0 +1,13 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports = { + misrepresentedTokens: true, + scroll: { + tvl: getUniTVL({ + factory: '0x2516212168034b18a0155FfbE59f2f0063fFfBD9', + useDefaultCoreAssets: true, + hasStablePools: true, + fetchBalances: true, + }) + }, +} From 7ddb18f273d1b22c61123a9a7e9336d3f1e179dd Mon Sep 17 00:00:00 2001 From: kientt6034 <125954722+kientt6034@users.noreply.github.com> Date: Thu, 12 Oct 2023 02:33:27 +0700 Subject: [PATCH 1504/1974] NemoSwap (Renec Chain) adapter (#7682) * feat: get all token accounts of nemoswap whirlpool * feat: add token info to get renec and reusd price * code refactor * minor fix --------- Co-authored-by: llama --- projects/helper/chains.json | 1 + projects/helper/coreAssets.json | 4 ++++ projects/helper/env.js | 1 + projects/helper/solana.js | 23 +++++++++++++--------- projects/helper/tokenMapping.js | 4 ++++ projects/nemoswap/index.js | 34 +++++++++++++++++++++++++++++++++ 6 files changed, 58 insertions(+), 9 deletions(-) create mode 100644 projects/nemoswap/index.js diff --git a/projects/helper/chains.json b/projects/helper/chains.json index 0e7cf467c88..3770e648dd3 100644 --- a/projects/helper/chains.json +++ b/projects/helper/chains.json @@ -181,6 +181,7 @@ "regen", "rei", "reichain", + "renec", "ripple", "rollux", "ronin", diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index 13cfba72608..9c54058d24f 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -1422,6 +1422,10 @@ "shimmer_evm": { "WSMR": "0xBEb654A116aeEf764988DF0C6B4bf67CC869D01b", "USDT": "0xc0E49f8C615d3d4c245970F6Dc528E4A47d69a44" + }, + "renec": { + "RENEC": "So11111111111111111111111111111111111111112", + "REUSD": "4Q89182juiadeFgGw3fupnrwnnDmBhf7e7fHWxnUP3S3" } , "beam": { diff --git a/projects/helper/env.js b/projects/helper/env.js index 6ab31b7be3d..4168b6f5377 100644 --- a/projects/helper/env.js +++ b/projects/helper/env.js @@ -12,6 +12,7 @@ const DEFAULTS = { ETHEREUMCLASSIC_RPC: 'https://etc.etcdesktop.com,https://etc.rivet.link', CRAB_RPC: 'https://darwiniacrab-rpc.dwellir.com', ANKR_API_KEY: '79258ce7f7ee046decc3b5292a24eb4bf7c910d7e39b691384c7ce0cfb839a01', + RENEC_RPC: "https://api-mainnet-beta.renec.foundation:8899/" } const ENV_KEYS = [ diff --git a/projects/helper/solana.js b/projects/helper/solana.js index 1dc099951af..3e83c4d5dc6 100644 --- a/projects/helper/solana.js +++ b/projects/helper/solana.js @@ -26,9 +26,14 @@ const blacklistedTokens_default = [ let connection, provider const endpoint = () => getEnv('SOLANA_RPC') +const renecEndpoint = () => getEnv('RENEC_RPC') +const endpointMap = { + solana: endpoint, + renec: renecEndpoint, +} -function getConnection() { - if (!connection) connection = new Connection(endpoint()) +function getConnection(chain = 'solana') { + if (!connection) connection = new Connection(endpointMap[chain]()) return connection } @@ -157,7 +162,7 @@ async function getTokenBalances(tokensAndAccounts) { return balances } -async function getTokenAccountBalances(tokenAccounts, { individual = false, chunkSize = 99, allowError = false, } = {}) { +async function getTokenAccountBalances(tokenAccounts, { individual = false, chunkSize = 99, allowError = false, chain = 'solana' } = {}) { log('total token accounts: ', tokenAccounts.length) const formBody = account => ({ method: "getAccountInfo", jsonrpc: "2.0", params: [account, { encoding: "jsonParsed", commitment: "confirmed" }], id: account }) const balancesIndividual = [] @@ -165,7 +170,7 @@ async function getTokenAccountBalances(tokenAccounts, { individual = false, chun const chunks = sliceIntoChunks(tokenAccounts, chunkSize) for (const chunk of chunks) { const body = chunk.map(formBody) - const data = await axios.post(endpoint(), body); + const data = await axios.post(endpointMap[chain](), body); data.data.forEach(({ result: { value } }, i) => { if (!value || !value.data.parsed) { if (tokenAccounts[i].toString() === '11111111111111111111111111111111') { @@ -296,16 +301,16 @@ async function sumOrcaLPs(tokensAndAccounts) { return totalUsdValue; } -function exportDexTVL(DEX_PROGRAM_ID, getTokenAccounts) { +function exportDexTVL(DEX_PROGRAM_ID, getTokenAccounts, chain = 'solana') { return async () => { if (!getTokenAccounts) getTokenAccounts = _getTokenAccounts - const tokenAccounts = await getTokenAccounts() + const tokenAccounts = await getTokenAccounts(chain) const chunks = sliceIntoChunks(tokenAccounts, 99) const results = [] for (const chunk of chunks) - results.push(...await getTokenAccountBalances(chunk, { individual: true })) + results.push(...await getTokenAccountBalances(chunk, { individual: true, chain, })) const data = [] for (let i = 0; i < results.length; i = i + 2) { @@ -314,8 +319,8 @@ function exportDexTVL(DEX_PROGRAM_ID, getTokenAccounts) { data.push({ token0: tokenA.mint, token0Bal: tokenA.amount, token1: tokenB.mint, token1Bal: tokenB.amount, }) } - const coreTokens = await getGeckoSolTokens() - return transformDexBalances({ chain: 'solana', data, blacklistedTokens: blacklistedTokens_default, coreTokens, }) + const coreTokens = chain === 'solana' ? await getGeckoSolTokens() : null + return transformDexBalances({ chain, data, blacklistedTokens: blacklistedTokens_default, coreTokens, }) } async function _getTokenAccounts() { diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index be010ce1708..9f8e0e2d70f 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -88,6 +88,10 @@ const fixBalancesTokens = { [ADDRESSES.beam.WMC]: { coingeckoId: 'merit-circle', decimals: 18 }, [ADDRESSES.beam.USDC]: { coingeckoId: 'usd-coin', decimals: 6 }, [ADDRESSES.beam.USDT]: { coingeckoId: 'tether', decimals: 18 }, + }, + renec: { + [ADDRESSES.renec.RENEC] : { coingeckoId: "renec", decimals: 9 }, + [ADDRESSES.renec.REUSD] : {coingeckoId: "tether", decimals: 9 }, // reUSD pegged USDT || bridge: https://remitano.com/swap/vn/usdt_reusd } } diff --git a/projects/nemoswap/index.js b/projects/nemoswap/index.js new file mode 100644 index 00000000000..e33952c0b09 --- /dev/null +++ b/projects/nemoswap/index.js @@ -0,0 +1,34 @@ +const { getConnection, exportDexTVL } = require("../helper/solana"); +const { PublicKey } = require('@solana/web3.js') + +// State: https://github.com/renec-chain/nemo-swap/blob/master/programs/whirlpool/src/state/whirlpool.rs +const NEMOSWAP_PROGRAM_ID = "7rh7ZtPzHqdY82RWjHf1Q8NaQiWnyNqkC48vSixcBvad"; +const WHIRLPOOL_DATA_SIZE = 654; +const TOKEN_ACCOUNT_A_OFFSET = 8 + 1 + 32 + 1 + 2 * 4 + 16 * 2 + 4 + 8 * 2 + 32; +const TOKEN_ACCOUNT_B_OFFSET = TOKEN_ACCOUNT_A_OFFSET + 32 + 16 + 32; +const PUBKEY_LENGTH=32; + +async function getTokenAccounts(chain) { + const programId = new PublicKey(NEMOSWAP_PROGRAM_ID); + const connection = getConnection(chain); + const accounts = await connection.getProgramAccounts(programId, { + filters: [{ + dataSize: WHIRLPOOL_DATA_SIZE + }] + }); + + const tokenAccounts = [] + accounts.forEach(({ account: { data }}) => { + const tokenAccountA = new PublicKey(data.subarray(TOKEN_ACCOUNT_A_OFFSET, TOKEN_ACCOUNT_A_OFFSET + PUBKEY_LENGTH)).toString() + const tokenAccountB= new PublicKey(data.subarray(TOKEN_ACCOUNT_B_OFFSET, TOKEN_ACCOUNT_B_OFFSET + PUBKEY_LENGTH)).toString() + tokenAccounts.push(tokenAccountA, tokenAccountB) + }) + return tokenAccounts +} + + +module.exports = { + renec: { + tvl: exportDexTVL(NEMOSWAP_PROGRAM_ID, getTokenAccounts, 'renec') + }, +}; \ No newline at end of file From 368ffe6650d4b14d74085b949699686e3a48be5b Mon Sep 17 00:00:00 2001 From: iamchmp <125301437+iamchmp@users.noreply.github.com> Date: Wed, 11 Oct 2023 21:40:51 +0200 Subject: [PATCH 1505/1974] add mantle chain (#7684) --- projects/altitude/index.js | 62 ++++++++++++++++++++++++++------------ 1 file changed, 42 insertions(+), 20 deletions(-) diff --git a/projects/altitude/index.js b/projects/altitude/index.js index bcdc8282f91..4c762b3f587 100644 --- a/projects/altitude/index.js +++ b/projects/altitude/index.js @@ -1,16 +1,18 @@ const { stakings } = require("../helper/staking"); -const { pool2 } = require("../helper/pool2"); const stakingContracts = [ "0xbc2B1262C90ab34757dC7eb2CB7CE595660Ff44e", ]; -const ALTD_USDC_UNIV2 = "0xC180869eeff55eE737e4B4f10D93B27B10bF976b"; const ALTD = "0x8929e9DbD2785e3BA16175E596CDD61520feE0D1"; -const contract = '0xF80E51AFb613D764FA61751Affd3313C190A86BB' +const GENERAL_CONTRACT = '0xF80E51AFb613D764FA61751Affd3313C190A86BB'; +const EXTRA_CONTRACTS = { + arbitrum: ['0xd6e501F92CE58623EE5D36f6BAdBcd35d87Ea522'], + mantle: ['0xf0dbc067D21319068e1C2617e13FC28db83C18FE'], +}; -const CHAINS = ["ethereum", "bsc", "polygon", "arbitrum", "avax", "optimism", "fantom", "linea"]; +const CHAINS = ["ethereum", "bsc", "polygon", "arbitrum", "avax", "optimism", "fantom", "linea", "mantle"]; const chainPathsAbi = "function chainPaths(uint256) view returns (bool ready, address srcToken, uint16 dstChainId, address dstToken, uint256 remoteLiquidity, uint256 localLiquidity, uint256 rewardPoolSize, address lpToken, bool stopSwap)"; let output = {}; @@ -18,27 +20,47 @@ let output = {}; CHAINS.forEach(chain => { output[chain] = { tvl: async (_, _b, _cb, { api, }) => { - const tokens = []; - let hasMoreTokens = false; - let currentStart = 0; - const fetchSize = 5; - do { - let res = await api.fetchList({ itemAbi: chainPathsAbi, target: contract, itemCount: fetchSize + currentStart, start: currentStart, permitFailure: true }); - res = res.filter(i => i).map(i => i.srcToken); - tokens.push(...res); - currentStart += fetchSize; - hasMoreTokens = res.length === fetchSize; - } while (hasMoreTokens); - return api.sumTokens({ owner: contract, tokens }); + // Define a function to fetch tokens given a contract address + const fetchTokens = async (contract) => { + const tokens = []; + let hasMoreTokens = false; + let currentStart = 0; + const fetchSize = 5; + do { + let res = await api.fetchList({ + itemAbi: chainPathsAbi, + target: contract, + itemCount: fetchSize + currentStart, + start: currentStart, + permitFailure: true + }); + res = res.filter(i => i).map(i => i.srcToken); + tokens.push(...res); + currentStart += fetchSize; + hasMoreTokens = res.length === fetchSize; + } while (hasMoreTokens); + return tokens; + }; + + // Fetch tokens from the general contract + let tokens = await fetchTokens(GENERAL_CONTRACT); + + // If there are extra contracts for this chain, fetch those tokens too + if(EXTRA_CONTRACTS[chain]) { + for(const extraContract of EXTRA_CONTRACTS[chain]) { + const extraTokens = await fetchTokens(extraContract); + tokens = [...tokens, ...extraTokens]; + } + } + + // Sum tokens for TVL + return api.sumTokens({ owner: GENERAL_CONTRACT, tokens }); } }; }); + output.ethereum.staking = stakings(stakingContracts, ALTD); -// output.ethereum.pool2 = pool2( -// null, // No staking contract -// ALTD_USDC_UNIV2 // Address of the LP token -// ); output.methodology = "Fetches the localLiquidity of each token in the Altitude contract across multiple chains and computes the TVL."; From 1b14b08632cfd029af036f794493e7a5a466f1ab Mon Sep 17 00:00:00 2001 From: Art <40150854+BadConfig@users.noreply.github.com> Date: Thu, 12 Oct 2023 04:00:53 +0300 Subject: [PATCH 1506/1974] update address (#7686) --- projects/arcanum/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/arcanum/index.js b/projects/arcanum/index.js index 086434782b5..de56fbeae9c 100644 --- a/projects/arcanum/index.js +++ b/projects/arcanum/index.js @@ -1,6 +1,6 @@ const ADDRESSES = require('../helper/coreAssets.json') const { sumTokensExport } = require('../helper/unwrapLPs') -const ARBI_CONTRACT = '0xfc2f1678f7c0d78c3911090c92b86bca7cc3a8b7'; +const ARBI_CONTRACT = '0xB1947d7596840D0a14D30cCA91be69ddC24ab75d'; const ASSETS_CONTRACTS = [ ADDRESSES.arbitrum.GMX, '0x11cdb42b0eb46d95f990bedd4695a6e3fa034978', @@ -14,6 +14,6 @@ module.exports = { methodology: 'counts the quantities of all tokens in multipool contracts.', start: 1000235, arbitrum: { - tvl: sumTokensExport({ owner: ARBI_CONTRACT, tokens: ASSETS_CONTRACTS}), + tvl: sumTokensExport({ owner: ARBI_CONTRACT, tokens: ASSETS_CONTRACTS }), } }; From f457eb72d9ae3ab3b920d6dbdb0cc61b02cccd71 Mon Sep 17 00:00:00 2001 From: ShibaPunkArmy <35100816+ShibaPunkArmy@users.noreply.github.com> Date: Thu, 12 Oct 2023 03:02:05 +0200 Subject: [PATCH 1507/1974] Updated the index.ts of PunkSwap and added the factory address on Scroll Mainnet (#7685) * Added PunkSwap Factory Added PunkSwap Factory and Masterchef on Shibarium opBNB has only Factory for now and was also added into the index.js file * edited Punkswap Index.js deleted syntax error * update index.js PunkSwap updated index.js for Punkswap DEX * added scroll Factory of PunkSwap added Factory of PunkSwap on Scroll Mainnet --- projects/punkswap/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/punkswap/index.js b/projects/punkswap/index.js index a0026345de2..a8572a73248 100644 --- a/projects/punkswap/index.js +++ b/projects/punkswap/index.js @@ -7,4 +7,7 @@ module.exports = { shibarium: { tvl: getUniTVL({ factory: "0x5640113EA7F369E6DAFbe54cBb1406E5BF153E90", useDefaultCoreAssets: true,}) }, + scroll: { + tvl: getUniTVL({ factory: "0x5640113EA7F369E6DAFbe54cBb1406E5BF153E90", useDefaultCoreAssets: true,}) + } }; \ No newline at end of file From 412ab4eab578067c2e5ce9858ece5050e135d7d7 Mon Sep 17 00:00:00 2001 From: llama Date: Thu, 12 Oct 2023 03:37:26 +0200 Subject: [PATCH 1508/1974] update gambit --- projects/gambit/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/gambit/index.js b/projects/gambit/index.js index 29c47248412..9b1b101678a 100644 --- a/projects/gambit/index.js +++ b/projects/gambit/index.js @@ -2,11 +2,12 @@ const ADDRESSES = require('../helper/coreAssets.json') const { sumTokensExport } = require("../helper/unwrapLPs"); const SimpleGToken = "0x0729e806f57CE71dA4464c6B2d313E517f41560b"; // SimpleGToken +const Treasury = "0x1fb8611064a09469F808263C398623A86e7Aa883"; // Treasury module.exports = { methodology: `Count the USDC that has been deposited on Gambit`, era: { - tvl: sumTokensExport({ owner: SimpleGToken, tokens: [ADDRESSES.era.USDC], }), + tvl: sumTokensExport({ owners: [SimpleGToken, Treasury], tokens: [ADDRESSES.era.USDC], }), }, }; From 0bfe45d7867177bd39e2eadabc4758ea88dff739 Mon Sep 17 00:00:00 2001 From: dalveytech-zero <133740461+dalveytech-zero@users.noreply.github.com> Date: Thu, 12 Oct 2023 11:53:24 +0800 Subject: [PATCH 1509/1974] Update Blex Protocol (#7688) * blex protocol * update blex protocol * update blex protocol * Update index.js --- projects/blex/index.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/projects/blex/index.js b/projects/blex/index.js index c7024505f75..69934de5d58 100644 --- a/projects/blex/index.js +++ b/projects/blex/index.js @@ -1,5 +1,5 @@ const ADDRESSES = require("../helper/coreAssets.json"); -const { sumTokensExport } = require('../helper/unwrapLPs') +const { sumTokensExport } = require("../helper/unwrapLPs"); const contracts = [ "0x4d377340a2875b875e1C104B9905F74FD716F59e", //CoreVault @@ -12,6 +12,7 @@ const contracts = [ const tokens = [ADDRESSES.arbitrum.USDT]; module.exports = { - start: 118461883, - arbitrum: { tvl: sumTokensExport({ tokens, owners: contracts, }) }, + start: 1691240820, + arbitrum: { tvl: sumTokensExport({ tokens, owners: contracts }) }, + hallmarks: [[1691240820, "Blex Protocol Deployed on Arbitrum"]], }; From ea372993055009b34e4755af26c0f0da124100ef Mon Sep 17 00:00:00 2001 From: kay Date: Thu, 12 Oct 2023 12:01:04 +0800 Subject: [PATCH 1510/1974] add liquidations/navi on sui --- liquidations/navi/index.ts | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 liquidations/navi/index.ts diff --git a/liquidations/navi/index.ts b/liquidations/navi/index.ts new file mode 100644 index 00000000000..634a114256d --- /dev/null +++ b/liquidations/navi/index.ts @@ -0,0 +1,22 @@ +import { Liq } from "../utils/types"; +import axios from "axios"; + +const liquidations = async () => { + const info = await axios.get("https://api-defi.naviprotocol.io/estimateLiquidateUser"); + + return info.data.map( + ({ owner, liqPrice, collateral, collateralAmount }) => + ({ + owner, + liqPrice, + collateral, + collateralAmount, + } as Liq) + ); +}; + +module.exports = { + sui: { + liquidations, + }, +}; From 701ed355e9a6032064441f85a00952e9aad80341 Mon Sep 17 00:00:00 2001 From: rune-xena <147580356+rune-xena@users.noreply.github.com> Date: Thu, 12 Oct 2023 07:31:26 +0000 Subject: [PATCH 1511/1974] Add adapter for Xena Finance (#7689) * add adapter for xena finance * minor fix --------- Co-authored-by: llama --- projects/xena/index.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 projects/xena/index.js diff --git a/projects/xena/index.js b/projects/xena/index.js new file mode 100644 index 00000000000..df152b4406a --- /dev/null +++ b/projects/xena/index.js @@ -0,0 +1,20 @@ +const { pool2 } = require("../helper/pool2"); + +const Contracts = { + Pool: "0x22787c26Bb0Ab0d331Eb840ff010855a70A0DcA6", + Chef: "0xB6a34b9C6CeeE0D821BDBD98Bc337639fdD5663b", + XEN_ETH_LP: "0xf32fdB63d0A976Cc6ceC939f2824FCF7F9819F68", + LOCKED_XEN_ETH_LP: "0x57A480007DFbce2803147DCcBeAFAEb50BDe64Fb", +}; + +async function tvl(_, _b, _cb, { api }) { + const { tokens }= await api.call({ abi: 'function getAllAssets() view returns (address[] tokens, bool[])', target: Contracts.Pool}) + return api.sumTokens({ owner: Contracts.Pool, tokens }) +} + +module.exports = { + base: { + tvl, + pool2: pool2([Contracts.Chef, Contracts.LOCKED_XEN_ETH_LP], Contracts.XEN_ETH_LP), + }, +}; From 54598e4ce2ae9b830647b6a3a47a0264e2e5dbbc Mon Sep 17 00:00:00 2001 From: qinghuan <1245816264@qq.com> Date: Thu, 12 Oct 2023 15:31:48 +0800 Subject: [PATCH 1512/1974] Support ethereum && bsc && avax (#7679) * feat: update multi chain * feat: fix tvl export * feat: fix tvl export * feat: export multi chain contract token balance * feat: refactor export code * feat: add default token * feat: support avax && bsc && ethereum * feat: add more tokens * feat: fix typo --- projects/omnibtc/index.js | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/projects/omnibtc/index.js b/projects/omnibtc/index.js index f86ef26f47e..ace92a7acca 100644 --- a/projects/omnibtc/index.js +++ b/projects/omnibtc/index.js @@ -10,6 +10,9 @@ const POOLS = { base: "0x68953027738216A63B39D55B18C02FeD5c329Dfa", optimism: "0x233DDEce6a96c49ecE6Ad9ae820690fE62a28975", polygon: "0xC3Eb696184b8927D677D8AB390A26563De4798c3", + ethereum: "0xAA8b23B45cb51ce8f49D7757fF27BA397D05B6fC", + avax: "0xc44C290e66e79aE208D998635F6Fc24837F3C554", + bsc: "0x0519147E1A604F764C0Dca833671F5283C618f23", }; const DEFAULT_TOKEN = ADDRESSES.null; @@ -76,6 +79,7 @@ module.exports = { ADDRESSES.arbitrum.ARB, ADDRESSES.arbitrum.USDC, ADDRESSES.arbitrum.USDT, + ADDRESSES.arbitrum.WBTC, ], }), }, @@ -93,13 +97,42 @@ module.exports = { ADDRESSES.optimism.OP, ADDRESSES.optimism.USDC, ADDRESSES.optimism.USDT, + //ADDRESSES.optimism.WBTC, ], }), }, polygon: { tvl: sumTokensExport({ owner: POOLS.polygon, - tokens: [DEFAULT_TOKEN, ADDRESSES.polygon.USDC, ADDRESSES.polygon.USDT], + tokens: [ + DEFAULT_TOKEN, + ADDRESSES.polygon.USDC, + ADDRESSES.polygon.USDT, + ADDRESSES.polygon.WBTC, + ], + }), + }, + bsc: { + tvl: sumTokensExport({ + owner: POOLS.bsc, + tokens: [DEFAULT_TOKEN], + }), + }, + avax: { + tvl: sumTokensExport({ + owner: POOLS.avax, + tokens: [DEFAULT_TOKEN, ADDRESSES.avax.USDC], + }), + }, + ethereum: { + tvl: sumTokensExport({ + owner: POOLS.ethereum, + tokens: [ + DEFAULT_TOKEN, + ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.USDT, + ADDRESSES.ethereum.WBTC, + ], }), }, sui: { From d1db03026eee704dd5cf12ec739357993c6c1e28 Mon Sep 17 00:00:00 2001 From: abdulrafay-contrax <122004952+abdulrafay-contrax@users.noreply.github.com> Date: Thu, 12 Oct 2023 13:35:22 +0500 Subject: [PATCH 1513/1974] feat: contrax-finance tvl adapter (#7665) * feat: contrax-finance tvl adapter * chore: multicall contrax adapter --------- Co-authored-by: Saqlain --- projects/contrax-finance/index.js | 71 +++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 projects/contrax-finance/index.js diff --git a/projects/contrax-finance/index.js b/projects/contrax-finance/index.js new file mode 100644 index 00000000000..7d6439c6e13 --- /dev/null +++ b/projects/contrax-finance/index.js @@ -0,0 +1,71 @@ +const { sumTokens2 } = require("../helper/unwrapLPs"); +const Vaults = [ + "0x5cc3543656EfA30144965C6c538F4d8379F83138", + "0x3C0c76ceb491Cb0Bacb31F8e7dc6407A25FD87C0", + "0x286d24B99b5CB6fE081f0e6Bd44EcbfCC1171A56", + "0x8f2CC9FC5ecf3D30aC83c96189cdd6EC2810E2f8", + "0x3F9012f9bF3172c26B1B7246B8bc62148842B013", + "0xeb952db71c594299cEEe7c03C3AA26FE0fDBC8eb", + "0xdf9d86bC4765a9C64e85323A9408dbee0115d22E", + "0xb58004E106409B00b854aBBF8CCB8618673d9346", + "0xf8bDcf1Cf4134b2864cdbE685A8128F90ED0E16e", + "0x46910A4AbA500b71F213150A0E99201Fd5c8FCec", + "0xfd3573bebDc8bF323c65Edf2408Fd9a8412a8694", + "0x8ca3f11485Bd85Dd0E952C6b21981DEe8CD1E901", + "0x1dda3B8A728a62a30f79d1E2a10e3d6B85ef4C5d", + "0x6C416e46424aF2676E9603F9D707f8d4808Bb5d8", +]; +const HOP_MAGIC_VAULT = "0x2d79B76841191c9c22238535a93Ee8169096A5Cc"; +const GMX_VAULT = "0x8CdF8d10ea6Cd3492e67C4250481A695c2a75C4a"; +const GMX = "0xfc5A1A6EB076a2C7aD06eD22C90d7E710E35ad0a"; + +async function getHopMagicData(api) { + const tokenAddress = await api.call({ + abi: "function token() view returns (address token)", + target: HOP_MAGIC_VAULT, + params: [], + }); + const balance = await api.call({ + abi: "erc20:balanceOf", + target: tokenAddress, + params: [HOP_MAGIC_VAULT], + }); + api.add(tokenAddress, balance); +} + +async function getGMXData(api) { + const balance = await api.call({ + abi: "erc20:balanceOf", + target: GMX, + params: [GMX_VAULT], + }); + api.add(GMX, balance); +} + +async function tvl(_, _1, _2, { api }) { + let tokens = await api.multiCall({ abi: "address:token", calls: Vaults }); + // Controllers + let targets = await api.multiCall({ + abi: "address:controller", + calls: Vaults, + }); + + const bals = await api.multiCall({ + abi: "erc20:balanceOf", + calls: tokens.map((t, i) => ({ target: targets[i], params: [t] })), + }); + await getHopMagicData(api); + await getGMXData(api); + + api.addTokens(tokens, bals); + return sumTokens2({ api, resolveLP: true }); +} + +module.exports = { + timetravel: true, + misrepresentedTokens: false, + methodology: "gets the lp balance of all vaults/controller/treasuries", + arbitrum: { + tvl, + }, +}; From 6f6c3a9d0a62092a64c34d3bb30abca87a881743 Mon Sep 17 00:00:00 2001 From: llama Date: Thu, 12 Oct 2023 11:09:37 +0200 Subject: [PATCH 1514/1974] break waves --- projects/waves-exchange/index.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/projects/waves-exchange/index.js b/projects/waves-exchange/index.js index 5b630efbe84..900dc1a1697 100644 --- a/projects/waves-exchange/index.js +++ b/projects/waves-exchange/index.js @@ -6,13 +6,15 @@ const endpoint = function tvl(isStaking) { let key = isStaking ? "wx_staking" : "liquidity_pools" - return async () => - toUSDTBalances( + return async () => { + throw new Error('Getting wrong tvl from api') + /* return toUSDTBalances( (await get(endpoint)).products .filter(p => p.product_id === key) .map(p => p.tvl) .reduce((p, c) => Number(p) + Number(c), 0), - ); + ); */ + } } module.exports = { From 6af3ecfee6f1b63e76e9ea14b8da0d6363c0e1ae Mon Sep 17 00:00:00 2001 From: define Date: Thu, 12 Oct 2023 14:47:40 +0100 Subject: [PATCH 1515/1974] add tokens to cex helper --- projects/entities/gsr.js | 51 ++++++++++++++++++++++++++++++++++++++++ projects/helper/cex.js | 23 ++++++++++++++---- 2 files changed, 69 insertions(+), 5 deletions(-) create mode 100644 projects/entities/gsr.js diff --git a/projects/entities/gsr.js b/projects/entities/gsr.js new file mode 100644 index 00000000000..af48e20b5fd --- /dev/null +++ b/projects/entities/gsr.js @@ -0,0 +1,51 @@ +const { treasuryExports } = require("../helper/treasury") + +const config = { + ethereum: { + owners: [ + "0xD8D6fFE342210057BF4DCc31DA28D006f253cEF0", + ], + }, + bsc: { + owners: [ + "0xEaf3B28A87D498530cDC7f0700E70502CF896D3f", + ], + }, + arbitrum: { + owners: [ + "0xEaf3B28A87D498530cDC7f0700E70502CF896D3f", + ], + }, + celo: { + owners: [ + "0xEaf3B28A87D498530cDC7f0700E70502CF896D3f", + ], + }, + optimism: { + owners: [ + "0xEaf3B28A87D498530cDC7f0700E70502CF896D3f", + ], + }, + polygon: { + owners: [ + "0xEaf3B28A87D498530cDC7f0700E70502CF896D3f", + ], + }, + avax: { + owners: [ + "0xEaf3B28A87D498530cDC7f0700E70502CF896D3f", + ], + }, + moonriver: { + owners: [ + "0xEaf3B28A87D498530cDC7f0700E70502CF896D3f", + ], + }, + aurora: { + owners: [ + "0xEaf3B28A87D498530cDC7f0700E70502CF896D3f", + ], + }, +} + +module.exports = treasuryExports(config) \ No newline at end of file diff --git a/projects/helper/cex.js b/projects/helper/cex.js index 49ff19b074a..465e125c2da 100644 --- a/projects/helper/cex.js +++ b/projects/helper/cex.js @@ -112,6 +112,7 @@ const defaultTokens = { ADDRESSES.polygon.DAI, //DAI '0x2AB0e9e4eE70FFf1fB9D67031E44F6410170d00e', //xen '0x0169ec1f8f639b32eec6d923e24c2a2ff45b9dd6', //ALGB + '0xd0258a3fd00f38aa8090dfee343f10a9d4d30d3f', //voxel ], algorand: [], solana: [ @@ -141,7 +142,11 @@ const defaultTokens = { '0x352Cb5E19b12FC216548a2677bD0fce83BaE434B', // BTT '0xAD29AbB318791D579433D831ed122aFeAf29dcfe', // FTM '0x02ff5065692783374947393723dba9599e59f591',// yoshi - ADDRESSES.bsc.TUSD, //TUSD + ADDRESSES.bsc.TUSD, //TUSD + '0x965f527d9159dce6288a2219db51fc6eef120dd1', //BSW + '0xa2120b9e674d3fc3875f415a7df52e382f141225', //ata + '0x44ec807ce2f4a6f2737a92e985f318d035883e47', //HFT + ], eos: [ ["eosio.token", "EOS", "eos"], @@ -152,8 +157,11 @@ const defaultTokens = { ADDRESSES.arbitrum.USDC, // USDC ADDRESSES.arbitrum.USDT, // USDT ADDRESSES.arbitrum.DAI, // DAI - '0x09e18590e8f76b6cf471b3cd75fe1a1a9d2b2c2b' //aidoge - + '0x09e18590e8f76b6cf471b3cd75fe1a1a9d2b2c2b', //aidoge + '0x3082cc23568ea640225c2467653db90e9250aaa0', //rdnt + '0x088cd8f5ef3652623c22d48b1605dcfe860cd704', //vela + '0x289ba1701c2f088cf0faf8b3705246331cb8a839', //lpt + '0x51fc0f6660482ea73330e414efd7808811a57fa2', //premia ], avax: [ nullAddress, @@ -171,7 +179,8 @@ const defaultTokens = { ADDRESSES.optimism.OP, //OP ADDRESSES.optimism.USDT, //USDT ADDRESSES.optimism.USDC, //USDC - ADDRESSES.optimism.DAI // DAI + ADDRESSES.optimism.DAI, // DAI + '0x217d47011b23bb961eb6d93ca9945b7501a5bb11' //thales ], linea: [ nullAddress, @@ -185,7 +194,11 @@ const defaultTokens = { ], celo: [ nullAddress, - "0x471ece3750da237f93b8e339c536989b8978a438" //celo + "0x471ece3750da237f93b8e339c536989b8978a438", //celo + "0x765de816845861e75a25fca122bb6898b8b1282a", //cUSD + ], + aurora: [ + nullAddress, ], } From 319b5117e77a66e23a38eb51c9f7a0c13ccf8a26 Mon Sep 17 00:00:00 2001 From: define Date: Thu, 12 Oct 2023 14:50:17 +0100 Subject: [PATCH 1516/1974] undo cex commit --- projects/helper/cex.js | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/projects/helper/cex.js b/projects/helper/cex.js index 465e125c2da..b6fa0e90e3f 100644 --- a/projects/helper/cex.js +++ b/projects/helper/cex.js @@ -112,7 +112,6 @@ const defaultTokens = { ADDRESSES.polygon.DAI, //DAI '0x2AB0e9e4eE70FFf1fB9D67031E44F6410170d00e', //xen '0x0169ec1f8f639b32eec6d923e24c2a2ff45b9dd6', //ALGB - '0xd0258a3fd00f38aa8090dfee343f10a9d4d30d3f', //voxel ], algorand: [], solana: [ @@ -143,9 +142,6 @@ const defaultTokens = { '0xAD29AbB318791D579433D831ed122aFeAf29dcfe', // FTM '0x02ff5065692783374947393723dba9599e59f591',// yoshi ADDRESSES.bsc.TUSD, //TUSD - '0x965f527d9159dce6288a2219db51fc6eef120dd1', //BSW - '0xa2120b9e674d3fc3875f415a7df52e382f141225', //ata - '0x44ec807ce2f4a6f2737a92e985f318d035883e47', //HFT ], eos: [ @@ -158,10 +154,6 @@ const defaultTokens = { ADDRESSES.arbitrum.USDT, // USDT ADDRESSES.arbitrum.DAI, // DAI '0x09e18590e8f76b6cf471b3cd75fe1a1a9d2b2c2b', //aidoge - '0x3082cc23568ea640225c2467653db90e9250aaa0', //rdnt - '0x088cd8f5ef3652623c22d48b1605dcfe860cd704', //vela - '0x289ba1701c2f088cf0faf8b3705246331cb8a839', //lpt - '0x51fc0f6660482ea73330e414efd7808811a57fa2', //premia ], avax: [ nullAddress, @@ -180,7 +172,6 @@ const defaultTokens = { ADDRESSES.optimism.USDT, //USDT ADDRESSES.optimism.USDC, //USDC ADDRESSES.optimism.DAI, // DAI - '0x217d47011b23bb961eb6d93ca9945b7501a5bb11' //thales ], linea: [ nullAddress, @@ -195,10 +186,6 @@ const defaultTokens = { celo: [ nullAddress, "0x471ece3750da237f93b8e339c536989b8978a438", //celo - "0x765de816845861e75a25fca122bb6898b8b1282a", //cUSD - ], - aurora: [ - nullAddress, ], } From 6066434dc9b44cb8433e6a43ff8c6afb62c6ed74 Mon Sep 17 00:00:00 2001 From: define Date: Thu, 12 Oct 2023 14:51:50 +0100 Subject: [PATCH 1517/1974] see --- projects/helper/cex.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/helper/cex.js b/projects/helper/cex.js index b6fa0e90e3f..3908c4fd847 100644 --- a/projects/helper/cex.js +++ b/projects/helper/cex.js @@ -185,7 +185,7 @@ const defaultTokens = { ], celo: [ nullAddress, - "0x471ece3750da237f93b8e339c536989b8978a438", //celo + ADDRESSES.celo.CELO //celo ], } From 18f9098e0526f328941c178512dbf59f2c3066af Mon Sep 17 00:00:00 2001 From: define Date: Thu, 12 Oct 2023 14:54:18 +0100 Subject: [PATCH 1518/1974] add token cex --- projects/helper/cex.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/projects/helper/cex.js b/projects/helper/cex.js index 0b6bb6417b2..cba56ef2e8c 100644 --- a/projects/helper/cex.js +++ b/projects/helper/cex.js @@ -112,6 +112,7 @@ const defaultTokens = { ADDRESSES.polygon.DAI, //DAI '0x2AB0e9e4eE70FFf1fB9D67031E44F6410170d00e', //xen '0x0169ec1f8f639b32eec6d923e24c2a2ff45b9dd6', //ALGB + '0xd0258a3fd00f38aa8090dfee343f10a9d4d30d3f', //voxel ], algorand: [], solana: [ @@ -142,6 +143,9 @@ const defaultTokens = { '0xAD29AbB318791D579433D831ed122aFeAf29dcfe', // FTM '0x02ff5065692783374947393723dba9599e59f591',// yoshi ADDRESSES.bsc.TUSD, //TUSD + '0x965f527d9159dce6288a2219db51fc6eef120dd1', //BSW + '0xa2120b9e674d3fc3875f415a7df52e382f141225', //ata + '0x44ec807ce2f4a6f2737a92e985f318d035883e47', //HFT ], eos: [ @@ -154,6 +158,10 @@ const defaultTokens = { ADDRESSES.arbitrum.USDT, // USDT ADDRESSES.arbitrum.DAI, // DAI '0x09e18590e8f76b6cf471b3cd75fe1a1a9d2b2c2b', //aidoge + '0x3082cc23568ea640225c2467653db90e9250aaa0', //rdnt + '0x088cd8f5ef3652623c22d48b1605dcfe860cd704', //vela + '0x289ba1701c2f088cf0faf8b3705246331cb8a839', //lpt + '0x51fc0f6660482ea73330e414efd7808811a57fa2', //premia ], avax: [ nullAddress, @@ -172,6 +180,7 @@ const defaultTokens = { ADDRESSES.optimism.USDT, //USDT ADDRESSES.optimism.USDC, //USDC ADDRESSES.optimism.DAI, // DAI + '0x217d47011b23bb961eb6d93ca9945b7501a5bb11' //thales ], linea: [ nullAddress, @@ -185,7 +194,8 @@ const defaultTokens = { ], celo: [ nullAddress, - ADDRESSES.celo.CELO //celo + ADDRESSES.celo.CELO, //celo + "0x765de816845861e75a25fca122bb6898b8b1282a", //cUSD ], } From 12a660305585fbd568ce28cec63b839c0fbe5813 Mon Sep 17 00:00:00 2001 From: define Date: Thu, 12 Oct 2023 15:38:29 +0100 Subject: [PATCH 1519/1974] fix correct wallet --- projects/entities/gsr.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/projects/entities/gsr.js b/projects/entities/gsr.js index af48e20b5fd..2f2fe470375 100644 --- a/projects/entities/gsr.js +++ b/projects/entities/gsr.js @@ -8,42 +8,42 @@ const config = { }, bsc: { owners: [ - "0xEaf3B28A87D498530cDC7f0700E70502CF896D3f", + "0xD8D6fFE342210057BF4DCc31DA28D006f253cEF0", ], }, arbitrum: { owners: [ - "0xEaf3B28A87D498530cDC7f0700E70502CF896D3f", + "0xD8D6fFE342210057BF4DCc31DA28D006f253cEF0", ], }, celo: { owners: [ - "0xEaf3B28A87D498530cDC7f0700E70502CF896D3f", + "0xD8D6fFE342210057BF4DCc31DA28D006f253cEF0", ], }, optimism: { owners: [ - "0xEaf3B28A87D498530cDC7f0700E70502CF896D3f", + "0xD8D6fFE342210057BF4DCc31DA28D006f253cEF0", ], }, polygon: { owners: [ - "0xEaf3B28A87D498530cDC7f0700E70502CF896D3f", + "0xD8D6fFE342210057BF4DCc31DA28D006f253cEF0", ], }, avax: { owners: [ - "0xEaf3B28A87D498530cDC7f0700E70502CF896D3f", + "0xD8D6fFE342210057BF4DCc31DA28D006f253cEF0", ], }, moonriver: { owners: [ - "0xEaf3B28A87D498530cDC7f0700E70502CF896D3f", + "0xD8D6fFE342210057BF4DCc31DA28D006f253cEF0", ], }, aurora: { owners: [ - "0xEaf3B28A87D498530cDC7f0700E70502CF896D3f", + "0xD8D6fFE342210057BF4DCc31DA28D006f253cEF0", ], }, } From 95205d01268c90cee6f928da89eac471dfc0e3b3 Mon Sep 17 00:00:00 2001 From: llama Date: Thu, 12 Oct 2023 20:32:41 +0200 Subject: [PATCH 1520/1974] leetswap: track scroll --- projects/leetswap/index.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/projects/leetswap/index.js b/projects/leetswap/index.js index dc74195aa24..fd62f571866 100644 --- a/projects/leetswap/index.js +++ b/projects/leetswap/index.js @@ -1,13 +1,16 @@ const ADDRESSES = require('../helper/coreAssets.json') const { getUniTVL } = require('../helper/unknownTokens') +const defaultTvl = { tvl: getUniTVL({ factory: ADDRESSES.shibarium.BONE_4, useDefaultCoreAssets: true, }), } + module.exports = { misrepresentedTokens: true, - polygon_zkevm: { tvl: getUniTVL({ factory: '0xcE87E0960f4e2702f4bFFE277655E993Ae720e84', useDefaultCoreAssets: true, }), }, - canto: { tvl: getUniTVL({ factory: '0x116e8a41E8B0A5A87058AF110C0Ddd55a0ed82B7', useDefaultCoreAssets: true, }), }, - linea: { tvl: getUniTVL({ factory: '0x4DDf0fa98B5f9Bd7Cb0645c25bA89A574fe9Be8c', useDefaultCoreAssets: true, }), }, - shibarium: { tvl: getUniTVL({ factory: '0xd3Ea3BC1F5A3F881bD6cE9761cbA5A0833a5d737', useDefaultCoreAssets: true, }), }, - op_bnb: { tvl: getUniTVL({ factory: ADDRESSES.shibarium.BONE_4, useDefaultCoreAssets: true, }), }, + polygon_zkevm: { tvl: getUniTVL({ factory: '0xcE87E0960f4e2702f4bFFE277655E993Ae720e84', useDefaultCoreAssets: true, }), }, + canto: { tvl: getUniTVL({ factory: '0x116e8a41E8B0A5A87058AF110C0Ddd55a0ed82B7', useDefaultCoreAssets: true, }), }, + linea: { tvl: getUniTVL({ factory: '0x4DDf0fa98B5f9Bd7Cb0645c25bA89A574fe9Be8c', useDefaultCoreAssets: true, }), }, + shibarium: { tvl: getUniTVL({ factory: '0xd3Ea3BC1F5A3F881bD6cE9761cbA5A0833a5d737', useDefaultCoreAssets: true, }), }, + op_bnb: defaultTvl, base: { tvl: getUniTVL({ factory: '0x169C06b4cfB09bFD73A81e6f2Bb1eB514D75bB19', useDefaultCoreAssets: true, hasStablePools: true, stablePoolSymbol: 'sLS2', }), }, - manta: { tvl: getUniTVL({ factory: ADDRESSES.shibarium.BONE_4, useDefaultCoreAssets: true, }), }, + manta: defaultTvl, + scroll: defaultTvl, } From e85907744a63d4eaa19ab42934a1b5b949cc3cd2 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 13 Oct 2023 00:28:01 +0530 Subject: [PATCH 1521/1974] Ipor (#7696) * Update adapter for IPOR Protocol V2 * Update adapter for IPOR Protocol V2 - reformat * refactor code to use api v2 --------- Co-authored-by: adam Co-authored-by: llama --- projects/contrax-finance/index.js | 5 +-- projects/ipor/abi.js | 1 + projects/ipor/index.js | 74 +++++++++++++++++++------------ 3 files changed, 49 insertions(+), 31 deletions(-) diff --git a/projects/contrax-finance/index.js b/projects/contrax-finance/index.js index 7d6439c6e13..4c86ca8c3cf 100644 --- a/projects/contrax-finance/index.js +++ b/projects/contrax-finance/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens2 } = require("../helper/unwrapLPs"); const Vaults = [ "0x5cc3543656EfA30144965C6c538F4d8379F83138", @@ -17,7 +18,7 @@ const Vaults = [ ]; const HOP_MAGIC_VAULT = "0x2d79B76841191c9c22238535a93Ee8169096A5Cc"; const GMX_VAULT = "0x8CdF8d10ea6Cd3492e67C4250481A695c2a75C4a"; -const GMX = "0xfc5A1A6EB076a2C7aD06eD22C90d7E710E35ad0a"; +const GMX = ADDRESSES.arbitrum.GMX; async function getHopMagicData(api) { const tokenAddress = await api.call({ @@ -62,8 +63,6 @@ async function tvl(_, _1, _2, { api }) { } module.exports = { - timetravel: true, - misrepresentedTokens: false, methodology: "gets the lp balance of all vaults/controller/treasuries", arbitrum: { tvl, diff --git a/projects/ipor/abi.js b/projects/ipor/abi.js index 4a46808e427..ec952bd711b 100644 --- a/projects/ipor/abi.js +++ b/projects/ipor/abi.js @@ -1,6 +1,7 @@ module.exports = { abi: { getAccruedBalance: "function getAccruedBalance() view returns (uint256 totalCollateralPayFixed, uint256 totalCollateralReceiveFixed, uint256 liquidityPool, uint256 vault)", + getAmmBalance: "function getAmmBalance(address asset) view returns (uint256 totalCollateralPayFixed, uint256 totalCollateralReceiveFixed, uint256 liquidityPool, uint256 vault)", getAsset: "address:getAsset", } }; diff --git a/projects/ipor/index.js b/projects/ipor/index.js index 3114eaaa370..9b03ce067b8 100644 --- a/projects/ipor/index.js +++ b/projects/ipor/index.js @@ -1,40 +1,58 @@ -const sdk = require('@defillama/sdk'); -const { default: BigNumber } = require('bignumber.js'); +const ADDRESSES = require('../helper/coreAssets.json') const { abi } = require("./abi"); -const miltonAddresses = [ - '0x28BC58e600eF718B9E97d294098abecb8c96b687', // USDT - '0x137000352B4ed784e8fa8815d225c713AB2e7Dc9', // USDC - '0xEd7d74AA7eB1f12F83dA36DFaC1de2257b4e7523', // DAI -] - -async function tvl(_, block) { - const balances = {}; - const calls = miltonAddresses.map(i => ({ target: i })) - const { output } = await sdk.api.abi.multiCall({ - abi: abi.getAccruedBalance, - calls, block, - }) - const { output: underlyings } = await sdk.api.abi.multiCall({ - abi: abi.getAsset, - calls, block, - }) - const tokens = underlyings.map(i => i.output) - const { output: decimals } = await sdk.api.abi.multiCall({ - abi: 'erc20:decimals', - calls: tokens.map(i => ({ target: i })), block, + +const V2DeploymentBlockNumber = 18333744 + +async function tvl(_, block, _1, { api }) { + if (block >= V2DeploymentBlockNumber) { + return await calculateTvlForV2(api); + } else { + return await calculateTvlForV1(api); + } +} + +async function calculateTvlForV2(api) { + const assets = [ + ADDRESSES.ethereum.USDT, // USDT + ADDRESSES.ethereum.USDC, // USDC + ADDRESSES.ethereum.DAI, // DAI + ] + + const iporRouter = '0x16d104009964e694761C0bf09d7Be49B7E3C26fd' + const ammTreasuryEth = '0x63395EDAF74a80aa1155dB7Cd9BBA976a88DeE4E' + + const output = await api.multiCall({ abi: abi.getAmmBalance, calls: assets, target: iporRouter, }) + const decimals = await api.multiCall({ abi: 'erc20:decimals', calls: assets }) + + output.forEach(({ totalCollateralPayFixed, totalCollateralReceiveFixed, liquidityPool, vault }, i) => { + const balance = +totalCollateralPayFixed + +totalCollateralReceiveFixed + +liquidityPool + const decimal = 18 - decimals[i] + api.add(assets[i], balance / (10 ** decimal)) }) - output.forEach(({ output: { totalCollateralPayFixed, totalCollateralReceiveFixed, liquidityPool }}, i) => { + return api.sumTokens({ owner: ammTreasuryEth, tokens: [ADDRESSES.ethereum.STETH] }) +} + +async function calculateTvlForV1(api) { + const miltonAddresses = [ + '0x28BC58e600eF718B9E97d294098abecb8c96b687', // USDT + '0x137000352B4ed784e8fa8815d225c713AB2e7Dc9', // USDC + '0xEd7d74AA7eB1f12F83dA36DFaC1de2257b4e7523', // DAI + ] + const output = await api.multiCall({ abi: abi.getAccruedBalance, calls: miltonAddresses, }) + const tokens = await api.multiCall({ abi: abi.getAsset, calls: miltonAddresses, }) + const decimals = await api.multiCall({ abi: 'erc20:decimals', calls: tokens }) + + output.forEach(({ totalCollateralPayFixed, totalCollateralReceiveFixed, liquidityPool }, i) => { const balance = +totalCollateralPayFixed + +totalCollateralReceiveFixed + +liquidityPool - const decimal = 18 - decimals[i].output - sdk.util.sumSingleBalance(balances, tokens[i], BigNumber(balance / (10 ** decimal)).toFixed(0)) + const decimal = 18 - decimals[i] + api.add(tokens[i], balance / (10 ** decimal)) }); - return balances; + return api.getBalances(); } module.exports = { - timetravel: true, methodology: `Counts the tokens locked in the AMM contracts to be used as collateral to Interest Rate Swaps derivatives, counts tokens provided as a liquidity to Liquidity Pool, counts interest gathered via Asset Manager in external protocols.`, ethereum: { tvl From d25b136b3d8beccb263a90ac82484bbda037fb42 Mon Sep 17 00:00:00 2001 From: pullstacker <128349344+pullstacker@users.noreply.github.com> Date: Fri, 13 Oct 2023 12:29:12 +0700 Subject: [PATCH 1522/1974] add monocerus swap volume (#7698) * adding monocerus swap we need to list Monocerus Swap to Defillama so our Uniswap-V3 based TVL can be monitored by users kindly help, thanks * edit the network --- projects/monocerus/index.js | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 projects/monocerus/index.js diff --git a/projects/monocerus/index.js b/projects/monocerus/index.js new file mode 100644 index 00000000000..e5562315328 --- /dev/null +++ b/projects/monocerus/index.js @@ -0,0 +1,5 @@ +const { uniV3Export } = require("../helper/uniswapV3"); + +module.exports = uniV3Export({ + avax: { factory: "0x8d312c2B300239B84c304B5af5A3D00cBF0803F6", fromBlock: 31524862, }, +}); \ No newline at end of file From af9e6dbc14eb2d64a1ab3a033b90fa4acb0780a8 Mon Sep 17 00:00:00 2001 From: Phil <30321052+philipjames44@users.noreply.github.com> Date: Thu, 12 Oct 2023 23:29:40 -0600 Subject: [PATCH 1523/1974] Sommelier: Add new Turbo stETH vault (#7697) * Sommelier: Add RYBTC launch and remove Steady, Trend, & MOM vault launches * Sommelier: Add Turbo GHO vault * Update start block * Sommelier: Dedupe vaults taking position in ssister vaults from TVL * Add ETH Growth vault * Add turbo steth cellar --- projects/sommelier/cellar-constants.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/projects/sommelier/cellar-constants.js b/projects/sommelier/cellar-constants.js index 031845174fb..8843998e3a4 100644 --- a/projects/sommelier/cellar-constants.js +++ b/projects/sommelier/cellar-constants.js @@ -47,11 +47,13 @@ const cellarsV2 = [ const TURBO_SWETH = "0xd33dad974b938744dac81fe00ac67cb5aa13958e"; const TURBO_GHO = "0x0c190ded9be5f512bd72827bdad4003e9cc7975c"; const ETH_GROWTH = "0x6c51041a91c91c86f3f08a72cb4d3f67f1208897"; +const TURBO_STETH = "0xfd6db5011b171b05e1ea3b92f9eacaeeb055e971"; const cellarsV2p5 = [ { id: TURBO_SWETH, startBlock: 17910374 }, { id: TURBO_GHO, startBlock: 18118614 }, { id: ETH_GROWTH, startBlock: 18144591 }, + { id: TURBO_STETH, startBlock: 18330620 }, ]; module.exports = { From 6d96f53cf627839b3cd42dcbe67bc19783266a42 Mon Sep 17 00:00:00 2001 From: llama Date: Fri, 13 Oct 2023 08:29:43 +0200 Subject: [PATCH 1524/1974] fix broken adapters --- projects/forlend/index.js | 5 ++--- projects/helper/compound.js | 4 ---- projects/summer-fi/handlers/dpm-positions.js | 2 +- projects/traderjoe/index.js | 12 ++---------- 4 files changed, 5 insertions(+), 18 deletions(-) diff --git a/projects/forlend/index.js b/projects/forlend/index.js index aa96f3f4145..987c129486a 100644 --- a/projects/forlend/index.js +++ b/projects/forlend/index.js @@ -1,6 +1,5 @@ -const { compoundExports } = require('../helper/compound') - +const { compoundExports2 } = require('../helper/compound') module.exports = { - findora: compoundExports("0x3b056De20d662B09f73bDb28Ea6fa7b7aC82259C", "findora",), + findora: compoundExports2({ comptroller: '0x3b056De20d662B09f73bDb28Ea6fa7b7aC82259C', cether: '0xbd4eeda5062605f3c3b86039c5f2c5880f9ecd95'}), } diff --git a/projects/helper/compound.js b/projects/helper/compound.js index d819e42f83d..453ca478faa 100644 --- a/projects/helper/compound.js +++ b/projects/helper/compound.js @@ -161,10 +161,6 @@ function getCompoundV2Tvl(comptroller, chain, transformAdress, sdk.util.sumSingleBalance(balances, transformAdress(underlying), getCash.output) } }); - if (["harmony", 'oasis', 'bsc', 'findora', 'dogechain', 'godwoken_v1', 'ethpow', 'cronos', 'kcc'].includes(chain)) { - const fixBalances = await getFixBalances(chain) - fixBalances(balances); - } if (comptroller == "0x92DcecEaF4c0fDA373899FEea00032E8E8Da58Da") { await unwrapPuffTokens(balances, lpPositions, block) diff --git a/projects/summer-fi/handlers/dpm-positions.js b/projects/summer-fi/handlers/dpm-positions.js index 51722e3ad30..e8acaae0e38 100644 --- a/projects/summer-fi/handlers/dpm-positions.js +++ b/projects/summer-fi/handlers/dpm-positions.js @@ -45,7 +45,7 @@ query { const dpmPositions = async ({ api, }) => { const aave = await blockQuery(endpoints.aave(), aaveQuery(api.block - 500), { api, }); - const ajna = await blockQuery(endpoints.ajna(), ajnaQuery(16854527), { api, }); + const ajna = await blockQuery(endpoints.ajna(), ajnaQuery(api.block - 500), { api, }); const supportedAjnaPools = [ ...new Set(ajna.accounts.map(({ pool: { address } }) => address)), diff --git a/projects/traderjoe/index.js b/projects/traderjoe/index.js index fccffafee04..842da6bcc0b 100644 --- a/projects/traderjoe/index.js +++ b/projects/traderjoe/index.js @@ -2,22 +2,14 @@ const ADDRESSES = require('../helper/coreAssets.json') const { staking } = require('../helper/staking'); const joeBar = ADDRESSES.avax.xJOE; const joeToken = ADDRESSES.avax.JOE; -const { getChainTvl } = require('../helper/getUniSubgraphTvl'); const { getUniTVL } = require('../helper/unknownTokens'); -const graphUrls = { - avax: 'https://api.thegraph.com/subgraphs/name/traderjoe-xyz/exchange', -}; module.exports = { misrepresentedTokens: true, methodology: 'We count liquidity on the pairs and we get that information from the "traderjoe-xyz/exchange" subgraph. The staking portion of TVL includes the JoeTokens within the JoeBar contract.', avax:{ - tvl: getChainTvl( - graphUrls, - "factories", - "liquidityUSD" - )('avax'), - staking: staking(joeBar, joeToken, "avax"), + tvl: getUniTVL({ factory: '0x9ad6c38be94206ca50bb0d90783181662f0cfa10', useDefaultCoreAssets: true, }), + staking: staking(joeBar, joeToken), }, bsc: { tvl: getUniTVL({ factory: '0x4f8bdc85e3eec5b9de67097c3f59b6db025d9986', useDefaultCoreAssets: true, }) From 1c3833f034642562e0314829ea7f58db469d17c4 Mon Sep 17 00:00:00 2001 From: define Date: Fri, 13 Oct 2023 10:00:46 +0100 Subject: [PATCH 1525/1974] add wallet --- projects/entities/polychain-capital.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/projects/entities/polychain-capital.js b/projects/entities/polychain-capital.js index ee4cd1560f5..effc5a381ca 100644 --- a/projects/entities/polychain-capital.js +++ b/projects/entities/polychain-capital.js @@ -4,10 +4,20 @@ const config = { ethereum: { owners: [ "0xBcd5000F5c522856E710c5d274bb672B2f2EefBf", - "0x53c286E0AbE87c9e6d4d95ebE62ceaFa4aFCE849" + "0x53c286E0AbE87c9e6d4d95ebE62ceaFa4aFCE849", + "0xfA9b5f7fDc8AB34AAf3099889475d47febF830D7", + "0xf286BB612e219916F8e9bA7200bF09Ed218890cb", + "0xb283391C4B4B5C5FA20FDA38bc0178EA264682b1", + "0xA1F5269738a227b568D1EEC42F29d71c19afeeE5", + ], + }, + optimism: { + owners: [ + "0xb0e90f9Dd83aBc67268672361B4f6d54f0d7Ea2C", + "0xea6C3Db2e7FCA00Ea9d7211a03e83f568Fc13BF7" ], }, } -module.exports = treasuryExports(config) \ No newline at end of file +module.exports = treasuryExports(config) From 91bfc282d804d1f5c3547365ecdb07b3c99ac4bd Mon Sep 17 00:00:00 2001 From: llama Date: Fri, 13 Oct 2023 11:16:13 +0200 Subject: [PATCH 1526/1974] fix broken adapters --- projects/ergodex.js | 7 +++++-- projects/helper/env.js | 4 +++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/projects/ergodex.js b/projects/ergodex.js index 46776b2495b..4d70c19c1ea 100644 --- a/projects/ergodex.js +++ b/projects/ergodex.js @@ -1,8 +1,9 @@ const { sumTokensExport } = require('./helper/chain/ergo') +const { sumTokensExport: steCardano } = require('./helper/chain/cardano') const utils = require('./helper/utils'); async function cardanoTVL() { - let response = await utils.fetchURL('https://analytics.spectrum.fi/cardano/pools/overview?after=0') + let response = await utils.fetchURL('https://analytics-balanced.spectrum.fi/cardano/pools/overview?after=0') let data = response.data; let totalTvl = 0; @@ -15,10 +16,12 @@ async function cardanoTVL() { module.exports = { timetravel: false, + misrepresentedTokens: true, ergo: { tvl: sumTokensExport({ owner: '5vSUZRZbdVbnk4sJWjg2uhL94VZWRg4iatK9VgMChufzUgdihgvhR8yWSUEJKszzV7Vmi6K8hCyKTNhUaiP8p5ko6YEU9yfHpjVuXdQ4i5p4cRCzch6ZiqWrNukYjv7Vs5jvBwqg5hcEJ8u1eerr537YLWUoxxi1M4vQxuaCihzPKMt8NDXP4WcbN6mfNxxLZeGBvsHVvVmina5THaECosCWozKJFBnscjhpr3AJsdaL8evXAvPfEjGhVMoTKXAb2ZGGRmR8g1eZshaHmgTg2imSiaoXU5eiF3HvBnDuawaCtt674ikZ3oZdekqswcVPGMwqqUKVsGY4QuFeQoGwRkMqEYTdV2UDMMsfrjrBYQYKUBFMwsQGMNBL1VoY78aotXzdeqJCBVKbQdD3ZZWvukhSe4xrz8tcF3PoxpysDLt89boMqZJtGEHTV9UBTBEac6sDyQP693qT3nKaErN8TCXrJBUmHPqKozAg9bwxTqMYkpmb9iVKLSoJxG7MjAj72SRbcqQfNCVTztSwN3cRxSrVtz4p87jNFbVtFzhPg7UqDwNFTaasySCqM', }) }, cardano: { - tvl: cardanoTVL + tvl: cardanoTVL, + // tvl: steCardano({ owner: 'addr1x94ec3t25egvhqy2n265xfhq882jxhkknurfe9ny4rl9k6dj764lvrxdayh2ux30fl0ktuh27csgmpevdu89jlxppvrst84slu'}) } } diff --git a/projects/helper/env.js b/projects/helper/env.js index 4168b6f5377..9586ea3c0d7 100644 --- a/projects/helper/env.js +++ b/projects/helper/env.js @@ -12,7 +12,9 @@ const DEFAULTS = { ETHEREUMCLASSIC_RPC: 'https://etc.etcdesktop.com,https://etc.rivet.link', CRAB_RPC: 'https://darwiniacrab-rpc.dwellir.com', ANKR_API_KEY: '79258ce7f7ee046decc3b5292a24eb4bf7c910d7e39b691384c7ce0cfb839a01', - RENEC_RPC: "https://api-mainnet-beta.renec.foundation:8899/" + RENEC_RPC: "https://api-mainnet-beta.renec.foundation:8899/", + EVMOS_RPC: "https://evmos-evm.publicnode.com", + NOVA_RPC: "https://connect.novanetwork.io", } const ENV_KEYS = [ From 89cbb8de754fbc33702e5a39c21c74b4b460e76a Mon Sep 17 00:00:00 2001 From: llama Date: Fri, 13 Oct 2023 12:17:56 +0200 Subject: [PATCH 1527/1974] bass: add staking --- projects/bassexhcnage/index.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/projects/bassexhcnage/index.js b/projects/bassexhcnage/index.js index a4eafd430d1..4cb5b34d371 100644 --- a/projects/bassexhcnage/index.js +++ b/projects/bassexhcnage/index.js @@ -1,8 +1,14 @@ -const { staking } = require("../helper/staking"); +const { stakings } = require("../helper/staking"); const { sumTokens2 } = require('../helper/unwrapLPs') const asssets = "0xb11f5E642EF4cF963e45A83E55A8fedCd58F9A9c" +const stakingContracts = [ + '0xa5895B5fF267041B968aA82d37A141F08f344333', + '0xB6D7406F2e4B2680fFCCA3Ad3c3FAB5eE07f2832', +] +const bass = '0x1F23B787053802108fED5B67CF703f0778AEBaD8' + async function tvl(timestamp, ethereumBlock, chainBlocks, { api }) { const tokensAndOwners = await api.call({ target: asssets, @@ -14,5 +20,6 @@ async function tvl(timestamp, ethereumBlock, chainBlocks, { api }) { module.exports = { base: { tvl, + staking: stakings(stakingContracts, bass), }, }; From e6c8a6dd0986ae75c2ab792ce464660fe18d0d2d Mon Sep 17 00:00:00 2001 From: mul53 Date: Fri, 13 Oct 2023 12:31:45 +0200 Subject: [PATCH 1528/1974] add updated voltage tvl information (#7694) * add updated voltage tvl information * split into sub-protocols --------- Co-authored-by: llama --- projects/fusefi/index.js | 17 ++++------------- projects/helper/coreAssets.json | 1 + projects/voltage-liquidstaking/index.js | 13 +++++++++++++ projects/voltage-stableswap/index.js | 13 +++++++++++++ 4 files changed, 31 insertions(+), 13 deletions(-) create mode 100644 projects/voltage-liquidstaking/index.js create mode 100644 projects/voltage-stableswap/index.js diff --git a/projects/fusefi/index.js b/projects/fusefi/index.js index 6486ac227f7..9ce7141e402 100644 --- a/projects/fusefi/index.js +++ b/projects/fusefi/index.js @@ -1,27 +1,18 @@ const sdk = require("@defillama/sdk"); const swap = require("./swap"); const olalending = require("./olalending"); -const { stakingPricedLP } = require("../helper/staking"); +const { stakings } = require("../helper/staking"); const VOLT_TOKEN = "0x34Ef2Cc892a88415e9f02b91BfA9c91fC0bE6bD4".toLowerCase(); const VOLT_BAR = "0x97a6e78c9208c21afaDa67e7E61d7ad27688eFd1".toLowerCase(); -const WFUSE_VOLT_LP = - "0xa670b12f8485aa379e99cf097017785b6aca5968".toLowerCase(); +const VOLT_VOTE_ESCROW = "0xB0a05314Bd77808269e2E1E3D280Bff57Ba85672".toLowerCase() module.exports = { - timetravel: true, fuse: { tvl: sdk.util.sumChainTvls([swap.tvl, olalending.tvl]), - borrowed: olalending.borrowed, - staking: stakingPricedLP( - VOLT_BAR, - VOLT_TOKEN, - "fuse", - WFUSE_VOLT_LP, - "fuse-network-token" - ), + staking: stakings([VOLT_BAR, VOLT_VOTE_ESCROW], VOLT_TOKEN), }, hallmarks: [ [1648684800, "Ola Finance exploit"] -] + ] }; diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index 9c54058d24f..559ee2d733f 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -254,6 +254,7 @@ "DAI": "0x94ba7a27c7a95863d1bdc7645ac2951e0cca06ba", "USDT": "0xfadbbf8ce7d5b7041be672561bba99f79c532e10", "KNC": "0x43b17749b246fd2a96de25d9e4184e27e09765b0", + "BUSD": "0x6a5f6a8121592becd6747a38d67451b310f7f156", "null": "0x0000000000000000000000000000000000000000" }, "evmos": { diff --git a/projects/voltage-liquidstaking/index.js b/projects/voltage-liquidstaking/index.js new file mode 100644 index 00000000000..1fee43f4e83 --- /dev/null +++ b/projects/voltage-liquidstaking/index.js @@ -0,0 +1,13 @@ +const ADDRESSES = require('../helper/coreAssets.json') + +const FUSE_STAKING_ADDRESS = "0xa3dc222eC847Aac61FB6910496295bF344Ea46be".toLowerCase() + +async function tvl(timestamp, block, chainBlocks, { api }) { + const bal = await api.call({ abi: 'uint256:systemTotalStaked', target: FUSE_STAKING_ADDRESS }) + api.add(ADDRESSES.fuse.WFUSE, bal) + return api.getBalances() +} + +module.exports = { + fuse: { tvl } +} \ No newline at end of file diff --git a/projects/voltage-stableswap/index.js b/projects/voltage-stableswap/index.js new file mode 100644 index 00000000000..f6b1af3c59a --- /dev/null +++ b/projects/voltage-stableswap/index.js @@ -0,0 +1,13 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require('../helper/unwrapLPs') + +const FUSD_ADDRESS = '0xd0ce1b4a349c35e61af02f5971e71ac502441e49'.toLowerCase() +const STABLESWAP_ADDRESS = '0x2a68D7C6Ea986fA06B2665d08b4D08F5e7aF960c'.toLowerCase() + +const STABLES = [ADDRESSES.fuse.USDC, ADDRESSES.fuse.USDT, ADDRESSES.fuse.BUSD] + +module.exports = { + fuse: { + tvl: sumTokensExport({ owners: [STABLESWAP_ADDRESS, FUSD_ADDRESS], tokens: STABLES, }) + } +} From 3abd649e4bc495a7f76b6f69d984e69c4e2e5dc4 Mon Sep 17 00:00:00 2001 From: llama Date: Fri, 13 Oct 2023 12:33:13 +0200 Subject: [PATCH 1529/1974] minor fix --- projects/fusefi/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/fusefi/index.js b/projects/fusefi/index.js index 9ce7141e402..92b203e1f87 100644 --- a/projects/fusefi/index.js +++ b/projects/fusefi/index.js @@ -8,6 +8,7 @@ const VOLT_BAR = "0x97a6e78c9208c21afaDa67e7E61d7ad27688eFd1".toLowerCase(); const VOLT_VOTE_ESCROW = "0xB0a05314Bd77808269e2E1E3D280Bff57Ba85672".toLowerCase() module.exports = { + misrepresentedTokens: true, fuse: { tvl: sdk.util.sumChainTvls([swap.tvl, olalending.tvl]), staking: stakings([VOLT_BAR, VOLT_VOTE_ESCROW], VOLT_TOKEN), From aa01847f4a04915ed4c2be3c9fd7fb910f3c71e3 Mon Sep 17 00:00:00 2001 From: define Date: Fri, 13 Oct 2023 11:33:23 +0100 Subject: [PATCH 1530/1974] add kava chain wagmi --- projects/wagmi-com/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/wagmi-com/index.js b/projects/wagmi-com/index.js index 3a6fa572d74..e3b0cbcacfd 100644 --- a/projects/wagmi-com/index.js +++ b/projects/wagmi-com/index.js @@ -3,4 +3,5 @@ const { uniV3Export } = require("../helper/uniswapV3"); module.exports = uniV3Export({ era: { factory: '0x31be61CE896e8770B21e7A1CAFA28402Dd701995', fromBlock: 1351075, }, fantom: { factory: '0xaf20f5f19698f1D19351028cd7103B63D30DE7d7', fromBlock: 60063058, }, + kava: { factory: '0x53dca7E0015B8c445881A9BC2baC1D8648d7f800', fromBlock: 6037137, } }) \ No newline at end of file From 015f9bcd74de38c0c68c879f58ac2c493ad75b92 Mon Sep 17 00:00:00 2001 From: define Date: Fri, 13 Oct 2023 11:50:40 +0100 Subject: [PATCH 1531/1974] remove kava while fix --- projects/wagmi-com/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/wagmi-com/index.js b/projects/wagmi-com/index.js index e3b0cbcacfd..7bf913f2c67 100644 --- a/projects/wagmi-com/index.js +++ b/projects/wagmi-com/index.js @@ -3,5 +3,5 @@ const { uniV3Export } = require("../helper/uniswapV3"); module.exports = uniV3Export({ era: { factory: '0x31be61CE896e8770B21e7A1CAFA28402Dd701995', fromBlock: 1351075, }, fantom: { factory: '0xaf20f5f19698f1D19351028cd7103B63D30DE7d7', fromBlock: 60063058, }, - kava: { factory: '0x53dca7E0015B8c445881A9BC2baC1D8648d7f800', fromBlock: 6037137, } + // kava: { factory: '0x53dca7E0015B8c445881A9BC2baC1D8648d7f800', fromBlock: 6037137, } }) \ No newline at end of file From 6cd82d43692ffe8277e6eb0309fe059891b44f2b Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Fri, 13 Oct 2023 13:49:02 +0100 Subject: [PATCH 1532/1974] coins2 --- projects/defichain-dex.js | 34 +++++++++++++++--------- projects/shipyard-finance/index.js | 2 +- test.js | 2 +- utils/scripts/changeCoreAssetsFormat2.js | 4 +-- utils/scripts/testTokenMapping.js | 2 +- 5 files changed, 27 insertions(+), 17 deletions(-) diff --git a/projects/defichain-dex.js b/projects/defichain-dex.js index 8d2144ce1f3..9f99deb3a55 100644 --- a/projects/defichain-dex.js +++ b/projects/defichain-dex.js @@ -1,20 +1,30 @@ -const { transformDexBalances } = require('./helper/portedTokens'); -const { get } = require('./helper/http') +const { transformDexBalances } = require("./helper/portedTokens"); +const { get } = require("./helper/http"); async function tvl() { - const data = [] - const { data: info } = await get('https://ocean.defichain.com/v0/mainnet/poolpairs?size=200') - info.forEach(i => data.push({ token0: i.tokenA.symbol, token0Bal: i.tokenA.reserve, token1: i.tokenB.symbol, token1Bal: i.tokenB.reserve,})) - const balances = await transformDexBalances({data, chain: 'defichain'}) - balances['defichain:dusd'] = balances['defichain:dusd'] * 0.7 - return balances + const data = []; + const { data: info } = await get( + "https://ocean.defichain.com/v0/mainnet/poolpairs?size=200" + ); + info.forEach((i) => + data.push({ + token0: i.tokenA.symbol, + token0Bal: i.tokenA.reserve, + token1: i.tokenB.symbol, + token1Bal: i.tokenB.reserve, + }) + ); + const balances = await transformDexBalances({ data, chain: "defichain" }); + balances["defichain:dusd"] = balances["defichain:dusd"] * 0.7; + return balances; } module.exports = { - methodology: "Liquidity on the DEX, DUSD price is reduced by 30% because of the dex stabilty tax", + methodology: + "Liquidity on the DEX, DUSD price is reduced by 30% because of the dex stabilty tax", timetravel: false, misrepresentedTokens: true, defichain: { - tvl - } -} \ No newline at end of file + tvl, + }, +}; // node test.js projects/stfil/index.js diff --git a/projects/shipyard-finance/index.js b/projects/shipyard-finance/index.js index f54788b5a78..b116d50ab22 100644 --- a/projects/shipyard-finance/index.js +++ b/projects/shipyard-finance/index.js @@ -37,7 +37,7 @@ function chainTvl(chain, config) { coins.push(`${chain}:${want}`.toLowerCase()); } - const getCoins = get(`https://coins.llama.fi/prices/current/${coins.join(',')}`) + const getCoins = get(`https://coins2.llama.fi/prices/current/${coins.join(',')}`) const coinsData = (await getCoins).coins; diff --git a/test.js b/test.js index c2c793a6d88..88e05e0f462 100644 --- a/test.js +++ b/test.js @@ -361,7 +361,7 @@ async function computeTVL(balances, timestamp) { const { errors } = await PromisePool.withConcurrency(5) .for(sliceIntoChunks(readKeys, 100)) .process(async (keys) => { - tokenData.push((await axios.get(`https://coins.llama.fi/prices/current/${keys.join(',')}`)).data.coins) + tokenData.push((await axios.get(`https://coins2.llama.fi/prices/current/${keys.join(',')}`)).data.coins) }) if (errors && errors.length) diff --git a/utils/scripts/changeCoreAssetsFormat2.js b/utils/scripts/changeCoreAssetsFormat2.js index a9d5c7dbe4c..c1edd65b18d 100644 --- a/utils/scripts/changeCoreAssetsFormat2.js +++ b/utils/scripts/changeCoreAssetsFormat2.js @@ -26,7 +26,7 @@ async function getSymbols([chain, mapping]) { return key2 }).filter(i => i) if (!tokens.length) return; - const { data: { coins } } = await axios.get('https://coins.llama.fi/prices/current/' + tokens.join(',')) + const { data: { coins } } = await axios.get('https://coins2.llama.fi/prices/current/' + tokens.join(',')) const symbolSet = new Set() Object.entries(coins).forEach(([key, { symbol }]) => { const key2 = reverseMapping[key] @@ -55,7 +55,7 @@ async function checkSymbols([chain, mapping]) { return chain + ':' + value }) if (!tokens.length) return; - const { data: { coins } } = await axios.get('https://coins.llama.fi/prices/current/' + tokens.join(',')) + const { data: { coins } } = await axios.get('https://coins2.llama.fi/prices/current/' + tokens.join(',')) Object.entries(coins).forEach(([key, { symbol }]) => { tokens = tokens.filter(i => i !== key) }) diff --git a/utils/scripts/testTokenMapping.js b/utils/scripts/testTokenMapping.js index ceaf04b3c8d..e9fab0b929d 100644 --- a/utils/scripts/testTokenMapping.js +++ b/utils/scripts/testTokenMapping.js @@ -18,7 +18,7 @@ async function main() { .for(chunks) .process(async chunk => { const str = chunk.join(',') - const { data } = await axios.get('https://coins.llama.fi/prices/current/'+str) + const { data } = await axios.get('https://coins2.llama.fi/prices/current/'+str) missing.push(...chunk.filter(i => !data.coins[i])) }) From c52fbc72f18a021e42233cae9c07184912a5aab5 Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Fri, 13 Oct 2023 13:52:41 +0100 Subject: [PATCH 1533/1974] remove changes to adapter --- projects/defichain-dex.js | 34 ++++++++++++---------------------- 1 file changed, 12 insertions(+), 22 deletions(-) diff --git a/projects/defichain-dex.js b/projects/defichain-dex.js index 9f99deb3a55..8d2144ce1f3 100644 --- a/projects/defichain-dex.js +++ b/projects/defichain-dex.js @@ -1,30 +1,20 @@ -const { transformDexBalances } = require("./helper/portedTokens"); -const { get } = require("./helper/http"); +const { transformDexBalances } = require('./helper/portedTokens'); +const { get } = require('./helper/http') async function tvl() { - const data = []; - const { data: info } = await get( - "https://ocean.defichain.com/v0/mainnet/poolpairs?size=200" - ); - info.forEach((i) => - data.push({ - token0: i.tokenA.symbol, - token0Bal: i.tokenA.reserve, - token1: i.tokenB.symbol, - token1Bal: i.tokenB.reserve, - }) - ); - const balances = await transformDexBalances({ data, chain: "defichain" }); - balances["defichain:dusd"] = balances["defichain:dusd"] * 0.7; - return balances; + const data = [] + const { data: info } = await get('https://ocean.defichain.com/v0/mainnet/poolpairs?size=200') + info.forEach(i => data.push({ token0: i.tokenA.symbol, token0Bal: i.tokenA.reserve, token1: i.tokenB.symbol, token1Bal: i.tokenB.reserve,})) + const balances = await transformDexBalances({data, chain: 'defichain'}) + balances['defichain:dusd'] = balances['defichain:dusd'] * 0.7 + return balances } module.exports = { - methodology: - "Liquidity on the DEX, DUSD price is reduced by 30% because of the dex stabilty tax", + methodology: "Liquidity on the DEX, DUSD price is reduced by 30% because of the dex stabilty tax", timetravel: false, misrepresentedTokens: true, defichain: { - tvl, - }, -}; // node test.js projects/stfil/index.js + tvl + } +} \ No newline at end of file From 9a2fee649f775be96822a99be16199333e942a90 Mon Sep 17 00:00:00 2001 From: define Date: Fri, 13 Oct 2023 14:34:14 +0100 Subject: [PATCH 1534/1974] add kava chain --- projects/wagmi-com/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/wagmi-com/index.js b/projects/wagmi-com/index.js index 7bf913f2c67..6d680a53dbf 100644 --- a/projects/wagmi-com/index.js +++ b/projects/wagmi-com/index.js @@ -3,5 +3,5 @@ const { uniV3Export } = require("../helper/uniswapV3"); module.exports = uniV3Export({ era: { factory: '0x31be61CE896e8770B21e7A1CAFA28402Dd701995', fromBlock: 1351075, }, fantom: { factory: '0xaf20f5f19698f1D19351028cd7103B63D30DE7d7', fromBlock: 60063058, }, - // kava: { factory: '0x53dca7E0015B8c445881A9BC2baC1D8648d7f800', fromBlock: 6037137, } + kava: { factory: '0x53dca7E0015B8c445881A9BC2baC1D8648d7f800', fromBlock: 6037137, } }) \ No newline at end of file From 3ef7c4e1121785760636063d2802709f7bc7769a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vuka=C5=A1in=20Manojlovi=C4=87?= Date: Fri, 13 Oct 2023 16:36:43 +0200 Subject: [PATCH 1535/1974] Add Raft staking (#7703) --- projects/raft/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/projects/raft/index.js b/projects/raft/index.js index de8556d46a0..3f1c4cd33ec 100644 --- a/projects/raft/index.js +++ b/projects/raft/index.js @@ -1,5 +1,8 @@ const ADDRESSES = require("../helper/coreAssets.json"); +const { staking } = require("../helper/staking.js"); +const RAFT_BPT = "0xe91888a1D08E37598867d213a4ACB5692071BB3a"; +const VERAFT = "0x45D117011da1D49bA86aF6CEd94126488084186f"; const RAFT_POSITION_MANAGER = "0x5f59b322eb3e16a0c78846195af1f588b77403fc"; const INTEREST_RATE_POSITION_MANAGER_ADDRESS = '0x9AB6b21cDF116f611110b048987E58894786C244'; const RAFT_PSM = "0xa03342feb2e1d4690b60ef556509ec3b76c97ee7"; @@ -17,7 +20,7 @@ async function tvl(_, ethBlock, _1, { api }) { api.add(ADDRESSES.ethereum.DAI, daiBalance) api.add(ADDRESSES.ethereum.RETH, rEthBalanceV1) - + return api.sumTokens({ ownerTokens: [ [[ADDRESSES.ethereum.RETH, ADDRESSES.ethereum.WETH, ADDRESSES.ethereum.WSTETH, ADDRESSES.ethereum.cbETH, SWETH], INTEREST_RATE_POSITION_MANAGER_ADDRESS], [[ADDRESSES.ethereum.RETH, ADDRESSES.ethereum.WETH, ADDRESSES.ethereum.WSTETH, ], RAFT_POSITION_MANAGER], @@ -27,5 +30,6 @@ async function tvl(_, ethBlock, _1, { api }) { module.exports = { ethereum: { tvl, + staking: staking(VERAFT, RAFT_BPT) }, }; From f6bdf4f659b0aa82231cdae312dac7808ca5dfa0 Mon Sep 17 00:00:00 2001 From: Aleksei Lushnikov Date: Fri, 13 Oct 2023 15:37:06 +0100 Subject: [PATCH 1536/1974] symbiosis adds tron portal (#7702) --- projects/symbiosis-finance/config.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/projects/symbiosis-finance/config.js b/projects/symbiosis-finance/config.js index 60ec9da9df4..b5846f78fc0 100644 --- a/projects/symbiosis-finance/config.js +++ b/projects/symbiosis-finance/config.js @@ -194,7 +194,7 @@ module.exports = { '0x292fC50e4eB66C3f6514b9E402dBc25961824D62', // portal v2 ] }, - { + { name: 'base', tokens: [ ADDRESSES.base.WETH, @@ -205,5 +205,14 @@ module.exports = { '0xEE981B2459331AD268cc63CE6167b446AF4161f8', // portal v2 new ] }, + { + name: 'tron', + tokens: [ + ADDRESSES.tron.USDT, + ], + holders: [ + 'TGsN2VVJRXLbNe33QbWeaMtpb6xxC7SUeq', // portal v2 + ] + }, ] } \ No newline at end of file From 65552bc6dd812c5c87e5b6f5182ec1697261d5f8 Mon Sep 17 00:00:00 2001 From: llama Date: Fri, 13 Oct 2023 20:24:27 +0200 Subject: [PATCH 1537/1974] fix wagmi --- projects/helper/utils.js | 2 +- projects/wagmi-com/index.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/helper/utils.js b/projects/helper/utils.js index 665415a6464..46a087cf9a9 100644 --- a/projects/helper/utils.js +++ b/projects/helper/utils.js @@ -67,7 +67,7 @@ function isLP(symbol, token, chain) { if (chain === 'wan' && ['WSLP'].includes(symbol)) return true if (chain === 'telos' && ['zLP'].includes(symbol)) return true if (chain === 'polygon' && ['MbtLP', 'GLP', ].includes(symbol)) return true - if (chain === 'ethereum' && ['SUDO-LP'].includes(symbol)) return false + if (chain === 'ethereum' && (['SUDO-LP'].includes(symbol) || symbol.endsWith('LP-f'))) return false if (chain === 'dogechain' && ['DST-V2'].includes(symbol)) return true if (chain === 'harmony' && ['HLP'].includes(symbol)) return true if (chain === 'klaytn' && ['NLP'].includes(symbol)) return true diff --git a/projects/wagmi-com/index.js b/projects/wagmi-com/index.js index 6d680a53dbf..18f2e45cd62 100644 --- a/projects/wagmi-com/index.js +++ b/projects/wagmi-com/index.js @@ -3,5 +3,5 @@ const { uniV3Export } = require("../helper/uniswapV3"); module.exports = uniV3Export({ era: { factory: '0x31be61CE896e8770B21e7A1CAFA28402Dd701995', fromBlock: 1351075, }, fantom: { factory: '0xaf20f5f19698f1D19351028cd7103B63D30DE7d7', fromBlock: 60063058, }, - kava: { factory: '0x53dca7E0015B8c445881A9BC2baC1D8648d7f800', fromBlock: 6037137, } + kava: { factory: '0x0e0Ce4D450c705F8a0B6Dd9d5123e3df2787D16B', fromBlock: 6037137, } }) \ No newline at end of file From e5943b39478d518b1cecca96fe8672b2ad6daebc Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Fri, 13 Oct 2023 22:26:28 +0100 Subject: [PATCH 1538/1974] flag for rug pull --- projects/laari-fi/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/laari-fi/index.js b/projects/laari-fi/index.js index 1a0060310bb..d36349d111c 100644 --- a/projects/laari-fi/index.js +++ b/projects/laari-fi/index.js @@ -12,4 +12,5 @@ module.exports = yieldHelper({ abis: { poolInfo: 'function poolInfo(uint256) view returns (address want, uint256, uint256, uint256, uint256, uint256, uint256, uint256 amount, uint256, address strat)', }, -}) \ No newline at end of file +}) +module.exports.hallmarks=[[1697068800, "Rug Pull"]] \ No newline at end of file From cd1dbafe12543c66530e5ca1b92486afaa68baea Mon Sep 17 00:00:00 2001 From: llama Date: Sat, 14 Oct 2023 11:48:47 +0200 Subject: [PATCH 1539/1974] update space fi --- projects/spacefi/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/spacefi/index.js b/projects/spacefi/index.js index 4e0c7a437a6..3d09b51da5e 100644 --- a/projects/spacefi/index.js +++ b/projects/spacefi/index.js @@ -8,4 +8,7 @@ module.exports = { useDefaultCoreAssets: true, }) }, + scroll: { + tvl: getUniTVL({ factory: '0x6cC370Ed99f1C11e7AC439F845d0BA6aed55cf50', useDefaultCoreAssets: true, }) + } }; From 2258f6abfc7ab852630d55df71781004af8a7798 Mon Sep 17 00:00:00 2001 From: nanoswapbase <147869325+nanoswapbase@users.noreply.github.com> Date: Sat, 14 Oct 2023 16:49:20 +0700 Subject: [PATCH 1540/1974] nanoswap (#7708) --- projects/nanoswap/index.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 projects/nanoswap/index.js diff --git a/projects/nanoswap/index.js b/projects/nanoswap/index.js new file mode 100644 index 00000000000..71ed6df848f --- /dev/null +++ b/projects/nanoswap/index.js @@ -0,0 +1,19 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +const NANO = "0x28f45eA79c50d3ED9e1FA8A41dC8595F636eC34D"; +const FACTORY = "0x41726eb94341fD27D5103DF3Cd6C387560c75B70" + +const dexTVL = getUniTVL({ + factory: FACTORY, + useDefaultCoreAssets: true, + fetchBalances: true, +}) + + +module.exports = { + misrepresentedTokens: true, + methodology: `Uses Uniswap-style factory address to find and price liquidity pairs.`, + base: { + tvl: dexTVL, + } +}; \ No newline at end of file From 46226a24308557a8d88d3d5b401fd80398bd4c0f Mon Sep 17 00:00:00 2001 From: llama Date: Sat, 14 Oct 2023 19:06:00 +0200 Subject: [PATCH 1541/1974] refactor piedao --- projects/config/piedao/abi/IBCP.json | 3 - projects/config/piedao/abi/IStakedToken.json | 3 - .../config/piedao/abi/IStakingBalancer.json | 3 - projects/piedao/index.js | 18 +- projects/piedao/pieDAO.js | 251 ++---------------- projects/piedao/pools.json | 43 --- 6 files changed, 30 insertions(+), 291 deletions(-) delete mode 100644 projects/config/piedao/abi/IBCP.json delete mode 100644 projects/config/piedao/abi/IStakedToken.json delete mode 100644 projects/config/piedao/abi/IStakingBalancer.json delete mode 100644 projects/piedao/pools.json diff --git a/projects/config/piedao/abi/IBCP.json b/projects/config/piedao/abi/IBCP.json deleted file mode 100644 index 19e467e295d..00000000000 --- a/projects/config/piedao/abi/IBCP.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "getTokens": "address[]:getTokens" -} \ No newline at end of file diff --git a/projects/config/piedao/abi/IStakedToken.json b/projects/config/piedao/abi/IStakedToken.json deleted file mode 100644 index 3e6c8e5d739..00000000000 --- a/projects/config/piedao/abi/IStakedToken.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "getFinalTokens": "address[]:getFinalTokens" -} \ No newline at end of file diff --git a/projects/config/piedao/abi/IStakingBalancer.json b/projects/config/piedao/abi/IStakingBalancer.json deleted file mode 100644 index e108fc2d5c1..00000000000 --- a/projects/config/piedao/abi/IStakingBalancer.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "uni": "address:uni" -} \ No newline at end of file diff --git a/projects/piedao/index.js b/projects/piedao/index.js index 9aa7154f83d..ae710f224ce 100644 --- a/projects/piedao/index.js +++ b/projects/piedao/index.js @@ -1,21 +1,11 @@ -const PieDAO = require("./pieDAO.js"); +const { addPools, calculatePies, } = require("./pieDAO.js"); const { staking } = require('../helper/staking') -async function tvl(timestamp, ethBlock) { - // creating the PieDAO helper... - let pieDAO = new PieDAO(ethBlock); - +async function tvl(timestamp, ethBlock, _, { api }) { await Promise.all([ - // calculating the total for Ovens... - await pieDAO.calculateOvens(), - // calculating the total for Pies... - await pieDAO.calculatePies(), - // calculating the total for Pools... - await pieDAO.calculatePools(), + addPools(api), + calculatePies(api), ]) - - // finally, returning the total NAV... - return pieDAO.calculateNAV(); } module.exports = { diff --git a/projects/piedao/pieDAO.js b/projects/piedao/pieDAO.js index c2dba91205d..70636d9d6db 100644 --- a/projects/piedao/pieDAO.js +++ b/projects/piedao/pieDAO.js @@ -1,231 +1,32 @@ -const BigNumber = require("bignumber.js"); -const sdk = require('@defillama/sdk') -const { sumTokens } = require('../helper/unwrapLPs'); +const { sumTokens2, nullAddress } = require('../helper/unwrapLPs'); const pies_config = require("./pies.json"); -const ovens_config = require("./ovens.json"); -const pools_config = require("./pools.json"); +const ovens = require("./ovens.json"); +const tokensAndOwners = Object.values(ovens).map(i => [nullAddress, i]) +tokensAndOwners.push( + ['0xdF5096804705D135656B50b62f9ee13041253D97', '0x3A05D2394F7241e00F4ae90A1f14D9c9c48A1E9B'], + ['0xFAE2809935233d4BfE8a56c2355c4A2e7d1fFf1A', '0xB9a4Bca06F14A982fcD14907D31DFACaDC8ff88E'], + ['0xFAE2809935233d4BfE8a56c2355c4A2e7d1fFf1A', '0x8314337d2b13e1A61EadF0FD1686b2134D43762F'], +) const pieABI = require("../config/piedao/abi/IPie.json"); const pieStakingAll = require("../config/piedao/abi/IStakingAll.json"); -const IStakingBalancer = require("../config/piedao/abi/IStakingBalancer.json"); -const IStakedToken = require("../config/piedao/abi/IStakedToken.json"); -const IBPT = IStakedToken; -const IBCP = require("../config/piedao/abi/IBCP.json"); -const IStakedPieDAO = IStakingBalancer; -const IStakingUniswap = IStakingBalancer; -module.exports = class PieDAO { - constructor(block) { - this.pies = pies_config; - this.ovens = ovens_config; - this.pools = pools_config; - this.tokenAmounts = {}; - this.ovenAmounts = {}; - } - - async calculatePies() { - const pieCalls = Object.values(this.pies).map(pie => ({ target: pie })) - const { output: supplies } = await sdk.api.abi.multiCall({ - calls: pieCalls, - abi: pieABI.totalSupply - }) - const calls = supplies.map(({ input, output }) => ({ - target: input.target, - params: [output], - })) - const { output: tokensAndAmountsAll } = await sdk.api.abi.multiCall({ - calls, - abi: pieABI.calcTokensForAmount - }) - for (let j = 0; j < tokensAndAmountsAll.length; j++) { - const tokensAndAmounts = tokensAndAmountsAll[j].output - for (let i = 0; i < tokensAndAmounts.tokens.length; i++) { - const token = tokensAndAmounts.tokens[i]; - const amount = tokensAndAmounts.amounts[i]; - this.pushTokenAmount(token, amount); - } - } - } - - async calculateOvens() { - const output = await sdk.api.eth.getBalances({ - targets: Object.values(this.ovens) - }) - - output.output.forEach(({ target, balance }) => { - this.ovenAmounts[target] = (balance / 1e18) - }) - } - - async calculatePools() { - const balances = {} - const hangingPromises = [] - for (const pool of Object.keys(this.pools)) { - const stakingPool = this.pools[pool]; - const poolAddress = this.pools[pool].address; - let underlyingBalance, underlyingSupply, underlyingAddress, underlyings, response, symbol = null; - - switch (stakingPool.type) { - case "all": - const { output: poolCount } = await sdk.api.abi.call({ - target: poolAddress, - abi: pieStakingAll.poolCount - }) - const poolCalls = [] - for (let i=0;i i.output) - const tokenCalls = tokens.map(t => ({ target: t })) - const balanceCalls = tokens.map(t => ({ target: t, params: [poolAddress] })) - let [{ output: symbols }, {output: underLyingBalances }, {output: totalSupplies }] = await Promise.all([ - sdk.api.abi.multiCall({ - calls: tokenCalls, - abi: 'erc20:symbol' - }),sdk.api.abi.multiCall({ - calls: balanceCalls, - abi: 'erc20:balanceOf' - }),sdk.api.abi.multiCall({ - calls: tokenCalls, - abi: 'erc20:totalSupply' - }), - ]) - symbols = symbols.map(i => i.output) - underLyingBalances = underLyingBalances.map(i => i.output) - totalSupplies = totalSupplies.map(i => i.output) - - - for (let i = 0; i < poolCount; i++) { - underlyingAddress = tokens[i]; - underlyingBalance = underLyingBalances[i]; - underlyingSupply = new BigNumber(totalSupplies[i]); - symbol = symbols[i] - - switch (symbol) { - case "SLP": - hangingPromises.push(sumTokens(balances, [[underlyingAddress, poolAddress]])) - break; - case "BPT": - response = await sdk.api.abi.call({ - target: underlyingAddress, - abi: IBPT.getFinalTokens - }) - underlyings = response.output - hangingPromises.push(this.calculateUnderLyings(underlyings, underlyingAddress, underlyingBalance, underlyingSupply)) - - break; - case "BCP": - response = await sdk.api.abi.call({ - target: underlyingAddress, - abi: IBCP.getTokens - }) - underlyings = response.output - hangingPromises.push(this.calculateUnderLyings(underlyings, underlyingAddress, underlyingBalance, underlyingSupply)) - break; - } - } - break; - - case "balancer": - underlyingAddress = stakingPool.lp ? stakingPool.lp : (await sdk.api.abi.call({ - target: poolAddress, - abi: IStakingBalancer.uni - })).output; - - underlyingBalance = new BigNumber((await sdk.api.erc20.balanceOf({ target: underlyingAddress, owner: poolAddress })).output); - underlyingSupply = new BigNumber((await sdk.api.erc20.totalSupply({ target: underlyingAddress })).output); - - response = await sdk.api.abi.call({ - target: underlyingAddress, - abi: IStakedToken.getFinalTokens - }) - underlyings = response.output - hangingPromises.push(this.calculateUnderLyings(underlyings, underlyingAddress, underlyingBalance, underlyingSupply)) - break; - - case "piedao": - response = await sdk.api.abi.call({ - target: poolAddress, - abi: IStakedPieDAO.uni - }) - underlyingAddress = response.output - underlyingBalance = new BigNumber((await sdk.api.erc20.balanceOf({ target: underlyingAddress, owner: poolAddress })).output); - underlyingSupply = new BigNumber((await sdk.api.erc20.totalSupply({ target: underlyingAddress })).output); - - response = await sdk.api.abi.call({ - target: underlyingAddress, - abi: IBCP.getTokens - }) - underlyings = response.output - hangingPromises.push(this.calculateUnderLyings(underlyings, underlyingAddress, underlyingBalance, underlyingSupply)) - break; - - case "uniswap": - response = await sdk.api.abi.call({ - target: poolAddress, - abi: IStakingUniswap.uni - }) - underlyingAddress = response.output - hangingPromises.push(sumTokens(balances, [[underlyingAddress, poolAddress]], )) - break; - } - } - - await Promise.all(hangingPromises) - Object.keys(balances).forEach(token => this.pushTokenAmount(token, BigNumber(balances[token]))) - } - - async calculateUnderLyings(underlyings, underlyingAddress, underlyingBalance, underlyingSupply) { - const { output: balances } = await sdk.api.abi.multiCall({ - calls: underlyings.map(token => ({ target: token, params: [underlyingAddress] })), - abi: 'erc20:balanceOf' - }) - - for (let i = 0;i this.pies[x].toLowerCase() == token.toLowerCase())) { - return; - } - */ - - if (this.tokenAmounts[token] == undefined) { - - //create empty object - this.tokenAmounts[token] = { - decimals: 0, - amount: BigNumber(0), - price: 0 - }; - } - - this.tokenAmounts[token].amount = this.tokenAmounts[token].amount.plus(amount) - } -} \ No newline at end of file +async function addPools(api) { + const stakingC = '0x6de77A304609472A4811a0BFD47d8682Aebc29df' + const poolTokens = await api.fetchList({ lengthAbi: pieStakingAll.poolCount, itemAbi: pieStakingAll.getPoolToken, target: stakingC}) + poolTokens.forEach(v => tokensAndOwners.push([v, stakingC])) + return sumTokens2({ api, tokensAndOwners, resolveLP: true, }) +} + +async function calculatePies(api) { + const pies = Object.values(pies_config) + const supplies = await api.multiCall({ abi: pieABI.totalSupply, calls: pies }) + const res = await api.multiCall({ abi: pieABI.calcTokensForAmount, calls: pies.map((v, i) => ({ target: v, params: supplies[i] })) }) + res.map(({ tokens, amounts }) => api.addTokens(tokens, amounts)) +} + +module.exports = { + addPools, + calculatePies, +} diff --git a/projects/piedao/pools.json b/projects/piedao/pools.json deleted file mode 100644 index e8e8dafc024..00000000000 --- a/projects/piedao/pools.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "Staked BCP": { - "type": "piedao", - "address": "0x9EFD60f40e35B3cA7294cC268A35d3e35101BE42" - }, - "Staked DEFI++": { - "type": "piedao", - "address": "0x59706D38F1452F387563f06b632af7302456fE66" - }, - "Staked YPIE/ETH": { - "type": "uniswap", - "address": "0x3A05D2394F7241e00F4ae90A1f14D9c9c48A1E9B" - }, - "ALL": { - "type": "all", - "address": "0x6de77A304609472A4811a0BFD47d8682Aebc29df" - }, - "DOUGH/ETH": { - "type": "balancer", - "address": "0xB9a4Bca06F14A982fcD14907D31DFACaDC8ff88E" - }, - "DOUGH/ETH (OLD)": { - "type": "balancer", - "address": "0x8314337d2b13e1A61EadF0FD1686b2134D43762F" - }, - "DEFI+S/ETH": { - "type": "balancer", - "address": "0xFcBB61bcd4909bf4AF708F15AAaa905E0978cAfc" - }, - "DEFI+S/ETH (OLD)": { - "type": "balancer", - "address": "0x220f25C2105a65425913FE0CF38e7699E3992B97" - }, - "DEFI+L/ETH": { - "type": "balancer", - "address": "0xb8E59ce1359d80E4834228eDd6a3F560e7534438" - }, - "DEFI+L/ETH (OLD)": { - "type": "balancer", - "address": "0xc1a116cb2d354503f9ec5cb436a3b213f377631d", - "lp": "0xa795600590a7da0057469049ab8f1284baed977e" - } -} \ No newline at end of file From b632bad51a57deb96450a325e96a04b082f35eef Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Sat, 14 Oct 2023 18:09:51 +0100 Subject: [PATCH 1542/1974] add hallmark --- projects/swim/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/swim/index.js b/projects/swim/index.js index cbadf75e753..de5fa972a0d 100644 --- a/projects/swim/index.js +++ b/projects/swim/index.js @@ -24,6 +24,9 @@ async function tvl() { } module.exports = { + hallmarks: [ + [1667779200, "Sunsetting announced"] + ], timetravel: false, solana: { tvl From b9e1e788dbd753fea4cd7cb6286f735b95492422 Mon Sep 17 00:00:00 2001 From: llama Date: Sat, 14 Oct 2023 19:12:47 +0200 Subject: [PATCH 1543/1974] astra dao is hacked --- projects/astra-dao/index.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/projects/astra-dao/index.js b/projects/astra-dao/index.js index e22a9a49d57..2724c38716f 100644 --- a/projects/astra-dao/index.js +++ b/projects/astra-dao/index.js @@ -25,7 +25,10 @@ module.exports = { start: 17243078, ethereum: { tvl, - pool2: sumTokensExport({ owner: ASTRA_STAKING_CONTRACT, resolveUniV3: true, }), - staking: sumTokensExport({ owner: ASTRA_STAKING_CONTRACT, tokens: [ASTRA_TOKEN_CONTRACT], }) - } + // pool2: sumTokensExport({ owner: ASTRA_STAKING_CONTRACT, resolveUniV3: true, }), + // staking: sumTokensExport({ owner: ASTRA_STAKING_CONTRACT, tokens: [ASTRA_TOKEN_CONTRACT], }) + }, + hallmarks: [ + [Math.floor(new Date('2023-09-14')/1e3), 'Security Incident'], + ], }; \ No newline at end of file From 70b10cd1eb6568c748e8ed3555c7590fa8a45fff Mon Sep 17 00:00:00 2001 From: llama Date: Sat, 14 Oct 2023 19:32:42 +0200 Subject: [PATCH 1544/1974] fix uniswap --- projects/uniswap/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/uniswap/index.js b/projects/uniswap/index.js index 596a45e37a1..3ad50757f6c 100644 --- a/projects/uniswap/index.js +++ b/projects/uniswap/index.js @@ -13,7 +13,7 @@ const graphs = { } const blacklists = { - ethereum: ['0xa850478adaace4c08fc61de44d8cf3b64f359bec', '0x055284a4ca6532ecc219ac06b577d540c686669d', '0x8c0411f2ad5470a66cb2e9c64536cfb8dcd54d51', '0x277667eb3e34f134adf870be9550e9f323d0dc24', '0x4c83a7f819a5c37d64b4c5a2f8238ea082fa1f4e', '0x290a6a7460b308ee3f19023d2d00de604bcf5b42', '0x4b5ab61593a2401b1075b90c04cbcdd3f87ce011', '0x582d23c7ec6b59afd041a522ff64ff081e8c0d2d', '0x1f98431c8ad98523631ae4a59f267346ea31f984', '0xaf44e10ed87d90f28bff2d1fbef1f64b090f5ebb', '0xdfef6416ea3e6ce587ed42aa7cb2e586362cbbfa'], + ethereum: ['0xa850478adaace4c08fc61de44d8cf3b64f359bec', '0x055284a4ca6532ecc219ac06b577d540c686669d', '0x8c0411f2ad5470a66cb2e9c64536cfb8dcd54d51', '0x277667eb3e34f134adf870be9550e9f323d0dc24', '0x4c83a7f819a5c37d64b4c5a2f8238ea082fa1f4e', '0x290a6a7460b308ee3f19023d2d00de604bcf5b42', '0x4b5ab61593a2401b1075b90c04cbcdd3f87ce011', '0x582d23c7ec6b59afd041a522ff64ff081e8c0d2d', '0x1f98431c8ad98523631ae4a59f267346ea31f984', '0xaf44e10ed87d90f28bff2d1fbef1f64b090f5ebb', '0xdfef6416ea3e6ce587ed42aa7cb2e586362cbbfa', '0x7e9c15c43f0d6c4a12e6bdff7c7d55d0f80e3e23'], arbitrum: ['0xd4d2f4110878a33ea5b97f0665e518253446161a', '0xB50721BCf8d664c30412Cfbc6cf7a15145234ad1',], polygon: ['0x8d52c2d70a7c28a9daac2ff12ad9bfbf041cd318', '0x1f98431c8ad98523631ae4a59f267346ea31f984', '0xd5302a8ead77b85ea3326b45f4714e0b3432b233', '0xc951ab482ff11d8df636742e1f1c3fc8037427a9',], } From 43eaa0dc18e5a971d688248228567e11c3bf8178 Mon Sep 17 00:00:00 2001 From: llama Date: Sat, 14 Oct 2023 19:37:27 +0200 Subject: [PATCH 1545/1974] fix more money --- projects/moremoney/StrategyMetadata.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/projects/moremoney/StrategyMetadata.js b/projects/moremoney/StrategyMetadata.js index db7aabaf937..23fc0404589 100644 --- a/projects/moremoney/StrategyMetadata.js +++ b/projects/moremoney/StrategyMetadata.js @@ -28,12 +28,12 @@ async function useStrategyMetadata(block) { strats.push(curAddresses.AltYieldYakAVAXStrategy2); tokens.push(ADDRESSES.avax.WAVAX); strats.push(curAddresses.OldYieldYakAVAXStrategy2); - tokens.push(ADDRESSES.avax.BTC_b); - strats.push(curAddresses.AltYieldYakStrategy2); + // tokens.push(ADDRESSES.avax.BTC_b); + // strats.push(curAddresses.AltYieldYakStrategy2); tokens.push("0x2b2C81e08f1Af8835a78Bb2A90AE924ACE0eA4bE"); strats.push(curAddresses.AltYieldYakStrategy2); - tokens.push("0xF7D9281e8e363584973F946201b82ba72C965D27"); - strats.push(curAddresses.YieldYakStrategy2); + // tokens.push("0xF7D9281e8e363584973F946201b82ba72C965D27"); + // strats.push(curAddresses.YieldYakStrategy2); const stratViewer = await sdk.api.abi.call({ target: curAddresses.StrategyViewer, From 6c85620cdf63c0f924653b3fb5203c0e6d8dd2c2 Mon Sep 17 00:00:00 2001 From: llama Date: Sat, 14 Oct 2023 21:05:59 +0200 Subject: [PATCH 1546/1974] fix katana tvl --- projects/katana/index.js | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/projects/katana/index.js b/projects/katana/index.js index 45281228116..19ec9bab38b 100644 --- a/projects/katana/index.js +++ b/projects/katana/index.js @@ -1,14 +1,21 @@ -const axios = require("axios"); +const { sumTokens2 } = require('../helper/solana') async function tvl() { - let tvlSnapshotResponse = await axios.get( - "https://raw.githubusercontent.com/Katana-Labs/statistics/master/tvl/tvl.json" - ); - - delete tvlSnapshotResponse.data[undefined] - return tvlSnapshotResponse.data; + return sumTokens2({ tokenAccounts: [ + '8vyTqVVPmJfqFexRcMBGDAHoSCyZ52RC5sRVhYzbfU4j', + '7zJVLbx3DjjwkoD6eUGk4cgoBv2JR3RW67c3ff8URXYh', + '2CD9R7K7AjAswjTJDmdf9HyUZQztfck1B22h9WUJeTeh', + '377U1dX3mRd96BeoRkpmsJC67wnVDqTpi1u6dALkR9V5', + 'DUrVECpx5EkVW12eWvpjR8Xk2AgNS3epqEQ6p63SujQb', + '6F5XPaeEiAwfmD5Rv9TAt4x7VhVaEU7qV9q6MSrvbozC', + '6sSZcCfPaeKfGnTRXX3Ybd97eqVnYg1TLfytwArfUVz', + 'E2VKdRPvfMXBj3ePMbuZPRz1fwT7z7Gd9pnh8R3n25eW', + 'AV3pjicfiJQoR96mGT9byQLbUAXL2Zi1a74wis9Ezh5S', + '5aJ5NzNmLfVLbqcbvYsW1e1GdEccrkFkLZwLWVLrmm4A', + '2sKjWWYcdBmUQbdHBJXKbJBwHB2G9JB7mRnLYuEtgRcp', + ]}) + } - module.exports = { timetravel: false, methodology: "Snapshots of the TVL from app.katana.so are saved periodically into the statistics repo", From d4e1a9a83e7b5708fe2f81c38192cf09a2b16e41 Mon Sep 17 00:00:00 2001 From: llama Date: Sat, 14 Oct 2023 21:54:47 +0200 Subject: [PATCH 1547/1974] fix platypus --- projects/platypus-finance/index.js | 38 ++++++++++-------------------- 1 file changed, 12 insertions(+), 26 deletions(-) diff --git a/projects/platypus-finance/index.js b/projects/platypus-finance/index.js index 62638cab708..df7080f815c 100644 --- a/projects/platypus-finance/index.js +++ b/projects/platypus-finance/index.js @@ -1,36 +1,21 @@ const { staking } = require("../helper/staking"); const { sumTokens2 } = require("../helper/unwrapLPs"); - -const pools = [ - "0xbe52548488992Cc76fFA1B42f3A58F646864df45", - "0x66357dcace80431aee0a7507e2e361b7e2402370", - "0x39dE4e02F76Dbd4352Ec2c926D8d64Db8aBdf5b2", - "0xB8E567fc23c39C94a1f6359509D7b43D1Fbed824", - "0x30C30d826be87Cd0A4b90855C2F38f7FcfE4eaA7", - "0x4658EA7e9960D6158a261104aAA160cC953bb6ba", - "0xC828D995C686AaBA78A4aC89dfc8eC0Ff4C5be83", - "0x81E63d0EEBA2D85609A6b206737e98e39B888F4C", - "0x91BB10D68C72d64a7cE10482b453153eEa03322C", - "0x27912AE6Ba9a54219d8287C3540A8969FF35500B", - "0x233Ba46B01d2FbF1A31bDBc500702E286d6de218", - "0x89E9EFD9614621309aDA948a761D364F0236eDEA", - "0x8b4a45da5b0705ae4f47ebefc180c099345cf57e", - "0xDeD29DF6b2193B885F45B5F5027ed405291A96C1", - "0xb3393f4e609c504da770ebc968540784cc4e016c", -]; +const { cachedGraphQuery } = require('../helper/cache') const blacklistedTokens = [] +const query = `{ + pools { + id + name + assetsList { id token { id } } + } +}` async function tvl(timestamp, ethereumBlock, chainBlocks, { api }) { if (timestamp > +new Date("2023-02-17") / 1e3) blacklistedTokens.push("0xdaCDe03d7Ab4D81fEDdc3a20fAA89aBAc9072CE2") // USP was hacked - const tokensArray = await api.multiCall({ abi: "function getTokenAddresses() view returns (address[])", calls: pools}) - const tokens = tokensArray.flat() - const calls = tokensArray.map((t, i)=> t.map((token) => ({ target: pools[i], params: token }))).flat() - - const owners = await api.multiCall({ abi:"function assetOf(address) view returns (address)", calls}) - tokens.push('0xb599c3590f42f8f995ecfa0f85d2980b76862fc1') - owners.push('0xc7388d98fa86b6639d71a0a6d410d5cdfc63a1d0') - return sumTokens2({ api, tokensAndOwners2: [tokens, owners], blacklistedTokens }); + const { pools } = await cachedGraphQuery("platypus-finance", "https://api.thegraph.com/subgraphs/name/platypus-finance/platypus-dashboard", query) + const tokensAndOwners = pools.map(i => i.assetsList.map(v => [v.token.id, v.id])).flat() + return sumTokens2({ api, tokensAndOwners, blacklistedTokens }); } module.exports = { @@ -43,5 +28,6 @@ module.exports = { }, hallmarks: [ [Math.floor(new Date('2023-02-17') / 1e3), 'Protocol was hacked for $8.5m'], + [Math.floor(new Date('2023-10-12') / 1e3), 'Protocol was hacked for $2m'], ], }; From 814c3f7a177a3ab15c8c248349fb82acc94584a6 Mon Sep 17 00:00:00 2001 From: llama Date: Sat, 14 Oct 2023 21:56:20 +0200 Subject: [PATCH 1548/1974] fix wasabi --- projects/wasabi/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/wasabi/index.js b/projects/wasabi/index.js index 44cc6d902e4..c707425e49c 100644 --- a/projects/wasabi/index.js +++ b/projects/wasabi/index.js @@ -11,7 +11,7 @@ async function tvl(_, _b, _cb, { api, }) { fromBlock: 17082136, }) const ownerTokens = logs.map(i => [[i.nftAddress, nullAddress], i.poolAddress]) - return sumTokens2({ api, ownerTokens, }) + return sumTokens2({ api, ownerTokens, blacklistedTokens: ['0xedb61f74b0d09b2558f1eeb79b247c1f363ae452'] }) } module.exports = { From 88a4f693b0048340dfc248f8c1c3467ed7ff7d80 Mon Sep 17 00:00:00 2001 From: Strategic Reserve Date: Sat, 14 Oct 2023 21:40:46 -0700 Subject: [PATCH 1549/1974] Add Kava, swapbased, PCS and more (#7711) --- projects/visor/config.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/projects/visor/config.js b/projects/visor/config.js index 33a5ea8aa3f..5dd72b99207 100644 --- a/projects/visor/config.js +++ b/projects/visor/config.js @@ -19,6 +19,7 @@ const config = { const HYPE_REGISTRY = { ethereum: [ ["0x31ccdb5bd6322483bebd0787e1dabd1bf1f14946", 13659998], // Uniswap + ["0x2E18B825b049c4994370b0DB6C35d0100295b96C", 18319961], // Pancakeswap ], polygon: [ ["0x0Ac4C7b794f3D7e7bF1093A4f179bA792CF15055", 25305922], // Uniswap @@ -42,6 +43,7 @@ const HYPE_REGISTRY = { ], bsc: [ ["0x0b4645179C1b668464Df01362fC6219a7ab3234c", 26520492], // Uniswap + ["0x8d7884666C056555fDD423Cd37846968040651b3", 32490558], // Pancakeswap ["0xd4bcFC023736Db5617E5638748E127581d5929bd", 26097149], // Thena ], moonbeam: [ @@ -68,9 +70,16 @@ const HYPE_REGISTRY = { ["0xc27ddd78fc49875fe6f844b72bbf31dfbb099881", 163300], // Lynex ], base: [ - ["0x1E86A593E55215957C4755f1BE19a229AF3286f6", 2798768], // SynthSwap ["0x6d5c54F535b073B9C2206Baf721Af2856E5cD683", 3785552], // Sushiswap + ["0x1E86A593E55215957C4755f1BE19a229AF3286f6", 2798768], // SynthSwap ["0xB24DC81f8Be7284C76C7cF865b803807B3C2EF55", 4249062], // BaseX + ["0x62F88FB208Df717B035325D065C6919D7913B937", 4470111], // Swapbased + ], + kava: [ + ["0x683292172E2175bd08e3927a5e72FC301b161300", 6384272], // Kinetix + ], + op_bnb: [ + ["0x683292172E2175bd08e3927a5e72FC301b161300", 5150910], // Pancakeswap ], }; From 781f929d6f4893308b6b0bd02f66260501373cc5 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Sun, 15 Oct 2023 05:55:45 +0100 Subject: [PATCH 1550/1974] add adapter --- projects/spacefi-scroll/index.js | 8 ++++++++ projects/spacefi/index.js | 5 +---- 2 files changed, 9 insertions(+), 4 deletions(-) create mode 100644 projects/spacefi-scroll/index.js diff --git a/projects/spacefi-scroll/index.js b/projects/spacefi-scroll/index.js new file mode 100644 index 00000000000..614717673e9 --- /dev/null +++ b/projects/spacefi-scroll/index.js @@ -0,0 +1,8 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports = { + misrepresentedTokens: true, + scroll: { + tvl: getUniTVL({ factory: '0x6cC370Ed99f1C11e7AC439F845d0BA6aed55cf50', useDefaultCoreAssets: true, }) + } +}; \ No newline at end of file diff --git a/projects/spacefi/index.js b/projects/spacefi/index.js index 3d09b51da5e..510e02b22e7 100644 --- a/projects/spacefi/index.js +++ b/projects/spacefi/index.js @@ -7,8 +7,5 @@ module.exports = { factory: '0x868A71EbfC46B86a676768C7b7aD65055CC293eE', useDefaultCoreAssets: true, }) - }, - scroll: { - tvl: getUniTVL({ factory: '0x6cC370Ed99f1C11e7AC439F845d0BA6aed55cf50', useDefaultCoreAssets: true, }) } -}; +}; From 8d2667c90208b72ed80a99edd6feb93293d92c4b Mon Sep 17 00:00:00 2001 From: llama Date: Sun, 15 Oct 2023 09:46:02 +0200 Subject: [PATCH 1551/1974] fix magik farm --- projects/magik-farm/config/index.js | 24 - .../magik-farm/config/vault/arbitrum_pools.js | 2 - .../magik-farm/config/vault/aurora_pools.js | 39 - .../config/vault/avalanche_pools.js | 572 --------- projects/magik-farm/config/vault/bsc_pools.js | 721 ----------- .../magik-farm/config/vault/celo_pools.js | 2 - .../magik-farm/config/vault/cronos_pools.js | 179 --- .../magik-farm/config/vault/fantom_pools.js | 1120 ----------------- .../magik-farm/config/vault/harmony_pools.js | 2 - .../magik-farm/config/vault/heco_pools.js | 2 - .../config/vault/moonriver_pools.js | 2 - .../magik-farm/config/vault/polygon_pools.js | 2 - projects/magik-farm/index.js | 243 +--- 13 files changed, 29 insertions(+), 2881 deletions(-) delete mode 100644 projects/magik-farm/config/index.js delete mode 100644 projects/magik-farm/config/vault/arbitrum_pools.js delete mode 100644 projects/magik-farm/config/vault/aurora_pools.js delete mode 100644 projects/magik-farm/config/vault/avalanche_pools.js delete mode 100644 projects/magik-farm/config/vault/bsc_pools.js delete mode 100644 projects/magik-farm/config/vault/celo_pools.js delete mode 100644 projects/magik-farm/config/vault/cronos_pools.js delete mode 100644 projects/magik-farm/config/vault/fantom_pools.js delete mode 100644 projects/magik-farm/config/vault/harmony_pools.js delete mode 100644 projects/magik-farm/config/vault/heco_pools.js delete mode 100644 projects/magik-farm/config/vault/moonriver_pools.js delete mode 100644 projects/magik-farm/config/vault/polygon_pools.js diff --git a/projects/magik-farm/config/index.js b/projects/magik-farm/config/index.js deleted file mode 100644 index b8207e273a4..00000000000 --- a/projects/magik-farm/config/index.js +++ /dev/null @@ -1,24 +0,0 @@ -const bscPools = require('./vault/bsc_pools'); -const hecoPools = require('./vault/heco_pools'); -const avalanchePools = require('./vault/avalanche_pools'); -const celoPools = require('./vault/celo_pools'); -const moonriverPools = require('./vault/moonriver_pools'); -const polygonPools = require('./vault/polygon_pools'); -const fantomPools = require('./vault/fantom_pools'); -const auroraPools = require('./vault/aurora_pools'); -const harmonyPools = require('./vault/harmony_pools'); -const arbitrumPools = require('./vault/arbitrum_pools'); -const cronosPools = require('./vault/cronos_pools'); -module.exports = { - bscPools, - hecoPools, - avalanchePools, - celoPools, - moonriverPools, - polygonPools, - fantomPools, - auroraPools, - harmonyPools, - arbitrumPools, - cronosPools, -}; diff --git a/projects/magik-farm/config/vault/arbitrum_pools.js b/projects/magik-farm/config/vault/arbitrum_pools.js deleted file mode 100644 index fec48aca957..00000000000 --- a/projects/magik-farm/config/vault/arbitrum_pools.js +++ /dev/null @@ -1,2 +0,0 @@ -const arbitrumPools = []; -module.exports = arbitrumPools; diff --git a/projects/magik-farm/config/vault/aurora_pools.js b/projects/magik-farm/config/vault/aurora_pools.js deleted file mode 100644 index 317e52b7b0c..00000000000 --- a/projects/magik-farm/config/vault/aurora_pools.js +++ /dev/null @@ -1,39 +0,0 @@ -const ADDRESSES = require('../../../helper/coreAssets.json') -const auroraPools = [ - { - id: 'carbon-carbon-near', - name: 'CARBON-NEAR LP 🔥', - token: 'CARBON-NEAR LP 🔥', - tokenDescription: 'carbon-fi.net - CARBON-NEAR LP AC Auto Burn Vault 🔥', - tokenAddress: '0x98Cf148cdC3E6d546D30717cE034C365ba204A4F', - tokenDecimals: 18, - tokenDescriptionUrl: '#', - earnedToken: 'MagikFarm - CARBON-NEAR LP', - earnedTokenAddress: '0xf81176796308D1154bb6Ed3D0Ca8e07a1E283600', - earnContractAddress: '0xf81176796308D1154bb6Ed3D0Ca8e07a1E283600', - pricePerFullShare: 1, - tvl: 0, - oracle: 'lps', - oracleId: 'carbon-carbon-near', - oraclePrice: 0, - depositsPaused: false, - status: 'active', - platform: 'Carbon', - assets: ['CARBON', 'NEAR'], - risks: [ - 'COMPLEXITY_LOW', - 'BATTLE_TESTED', - 'IL_HIGH', - 'MCAP_MEDIUM', - 'AUDIT', - 'CONTRACTS_VERIFIED', - ], - stratType: 'StratLP', - buyTokenUrl: - 'https://www.trisolaris.io/#/swap?inputCurrency=0xC42C30aC6Cc15faC9bD938618BcaA1a1FaE8501d&outputCurrency=0x33ADf08ae486bf89ABc9634f6623A997FFDB66e7', - addLiquidityUrl: - 'https://www.trisolaris.io/#/add/0xC42C30aC6Cc15faC9bD938618BcaA1a1FaE8501d/0x33ADf08ae486bf89ABc9634f6623A997FFDB66e7', - }, -]; - -module.exports = auroraPools; diff --git a/projects/magik-farm/config/vault/avalanche_pools.js b/projects/magik-farm/config/vault/avalanche_pools.js deleted file mode 100644 index 2da1cbbbd8f..00000000000 --- a/projects/magik-farm/config/vault/avalanche_pools.js +++ /dev/null @@ -1,572 +0,0 @@ -const ADDRESSES = require('../../../helper/coreAssets.json') -const avalanchePools = [ - { - id: "cham-avic-usdc", - name: "AVIC - USDC 🔥", - token: "AVIC - USDC", - tokenDescription: - "Championfinance.io - AVIC-USDC LP AC Auto Fee Share Vault 🔥", - tokenAddress: "0x7748456409D4Eee3FaCE6aD0c492DD9853A1CC3d", - tokenDecimals: 18, - tokenDescriptionUrl: "#", - earnedToken: "MagikFarm - AVIC-USDC LP", - earnedTokenAddress: "0x720Ee1f99eAB68ffB5182510EBC66c365BfD442b", - earnContractAddress: "0x720Ee1f99eAB68ffB5182510EBC66c365BfD442b", - pricePerFullShare: 1, - tvl: 0, - oracle: "lps", - oracleId: "cham-avic-usdc", - oraclePrice: 0, - depositsPaused: false, - partnership: true, - isMooStaked: true, - status: "active", - platform: "Championfinance", - assets: ["AVIC", "USDC"], - risks: [ - "COMPLEXITY_LOW", - "BATTLE_TESTED", - "IL_LOW", - "5AUDIT", - "CONTRACTS_VERIFIED", - ], - stratType: "StratLP", - addLiquidityUrl: - "https://traderjoexyz.com/pool/0x59B18817CA9f4ad2dEE6FBf30132dF6AEb9D763d/0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e#/", - buyTokenUrl: - "https://traderjoexyz.com/trade?inputCurrency=0x59B18817CA9f4ad2dEE6FBf30132dF6AEb9D763d&outputCurrency=0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e#/", - }, - { - id: "cham-cham-usdc", - name: "CHAM - USDC 🔥", - token: "CHAM - USDC", - tokenDescription: - "Championfinance.io - CHAM-USDC LP AC Auto Fee Share Vault 🔥", - tokenAddress: "0xd6F18CDe9A52A9D815dd3C03C2325D453E32BDef", - tokenDecimals: 18, - tokenDescriptionUrl: "#", - earnedToken: "MagikFarm - CHAM-USDC LP", - earnedTokenAddress: "0x24dDB3c0F3B51D832cf43c3b121987b8698e32aD", - earnContractAddress: "0x24dDB3c0F3B51D832cf43c3b121987b8698e32aD", - pricePerFullShare: 1, - tvl: 0, - oracle: "lps", - oracleId: "cham-cham-usdc", - oraclePrice: 0, - depositsPaused: false, - partnership: true, - isMooStaked: true, - status: "active", - platform: "Championfinance", - assets: ["CHAM", "USDC"], - risks: [ - "COMPLEXITY_LOW", - "BATTLE_TESTED", - "IL_LOW", - "5AUDIT", - "CONTRACTS_VERIFIED", - ], - stratType: "StratLP", - addLiquidityUrl: - "https://traderjoexyz.com/pool/0xc65bC1E906771e105fBAcBD8dfE3862Ee7BE378E/0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e#/", - buyTokenUrl: - "https://traderjoexyz.com/trade?inputCurrency=0xc65bC1E906771e105fBAcBD8dfE3862Ee7BE378E&outputCurrency=0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e#/", - }, - { - id: "cham-avic-cham", - name: "AVIC - CHAM 🔥", - token: "AVIC - CHAM", - tokenDescription: - "Championfinance.io - AVIC-CHAM LP AC Auto Fee Share Vault 🔥", - tokenAddress: "0x17f2F59331de85e0b9dCE25EAB48aEBF71C63e46", - tokenDecimals: 18, - tokenDescriptionUrl: "#", - earnedToken: "MagikFarm - AVIC-CHAM LP", - earnedTokenAddress: "0x2a426A878BB768473AD898aC7f8ee41b0894ee56", - earnContractAddress: "0x2a426A878BB768473AD898aC7f8ee41b0894ee56", - pricePerFullShare: 1, - tvl: 0, - oracle: "lps", - oracleId: "cham-avic-cham", - oraclePrice: 0, - depositsPaused: false, - partnership: true, - isMooStaked: true, - status: "active", - platform: "Championfinance", - assets: ["CHAM", "AVIC"], - risks: [ - "COMPLEXITY_LOW", - "BATTLE_TESTED", - "IL_LOW", - "5AUDIT", - "CONTRACTS_VERIFIED", - ], - stratType: "StratLP", - addLiquidityUrl: - "https://traderjoexyz.com/pool/0x59B18817CA9f4ad2dEE6FBf30132dF6AEb9D763d/0xc65bC1E906771e105fBAcBD8dfE3862Ee7BE378E#/", - buyTokenUrl: - "https://traderjoexyz.com/trade?inputCurrency=0xc65bC1E906771e105fBAcBD8dfE3862Ee7BE378E&outputCurrency=0x59B18817CA9f4ad2dEE6FBf30132dF6AEb9D763d#/", - }, - { - id: "grape-grapesp-mim", - name: "SL GRAPE - MIM 🔥", - token: "SL GRAPE - MIM", - tokenDescription: - "(WINE FARM) - Swapsicle GRAPE - MIM LP AC Auto Burn Vault 🔥", - tokenAddress: "0x9076C15D7b2297723ecEAC17419D506AE320CbF1", - tokenDecimals: 18, - tokenDescriptionUrl: "#", - earnedToken: "MagikFarm - Sl - Grape - MIM LP", - earnedTokenAddress: "0x0dA1DC567D81925cFf22Df74C6b9e294E9E1c3A5", - earnContractAddress: "0x0dA1DC567D81925cFf22Df74C6b9e294E9E1c3A5", - pricePerFullShare: 1, - tvl: 0, - oracle: "lps", - oracleId: "grape-grapesp-mim", - oraclePrice: 0, - depositsPaused: false, - partnership: true, - isMooStaked: true, - status: "active", - platform: "Grape", - assets: ["GRAPE", "MIM"], - risks: [ - "COMPLEXITY_LOW", - "BATTLE_TESTED", - "IL_LOW", - "5AUDIT", - "CONTRACTS_VERIFIED", - ], - stratType: "StratLP", - addLiquidityUrl: - "https://www.swapsicle.io/add/0x130966628846BFd36ff31a822705796e8cb8C18D/0x5541D83EFaD1f281571B343977648B75d95cdAC2", - buyTokenUrl: - "https://www.swapsicle.io/swap/0x130966628846bfd36ff31a822705796e8cb8c18d/0x5541d83efad1f281571b343977648b75d95cdac2", - }, - { - id: "swapsicle-grape-mim", - name: "Swapsicle GRAPE - MIM 🔥", - token: "Swapsicle GRAPE - MIM", - tokenDescription: - "swapsicle.io - Swapsicle GRAPE - MIM LP AC Auto Burn Vault 🔥", - tokenAddress: "0x9076C15D7b2297723ecEAC17419D506AE320CbF1", - tokenDecimals: 18, - tokenDescriptionUrl: "#", - earnedToken: "MagikFarm - Swapsicle - Grape - MIM LP", - earnedTokenAddress: "0x7c9EeC0e542DF35280224bECf9AF76d2E4cD910f", - earnContractAddress: "0x7c9EeC0e542DF35280224bECf9AF76d2E4cD910f", - pricePerFullShare: 1, - tvl: 0, - oracle: "lps", - oracleId: "swapsicle-grape-mim", - oraclePrice: 0, - depositsPaused: true, - partnership: true, - isMooStaked: true, - status: "active", - platform: "Swapsicle", - assets: ["GRAPE", "MIM"], - risks: [ - "COMPLEXITY_LOW", - "BATTLE_TESTED", - "IL_LOW", - "5AUDIT", - "CONTRACTS_VERIFIED", - ], - stratType: "StratLP", - addLiquidityUrl: - "https://www.swapsicle.io/add/0x130966628846BFd36ff31a822705796e8cb8C18D/0x5541D83EFaD1f281571B343977648B75d95cdAC2", - buyTokenUrl: - "https://www.swapsicle.io/swap/0x130966628846bfd36ff31a822705796e8cb8c18d/0x5541d83efad1f281571b343977648b75d95cdac2", - }, - { - id: "grape-grape", - logo: "single-assets/GRAPE.png", - name: "GRAPE 🔥", - token: "GRAPE", - tokenDescription: - "grapefinance.app - GRAPE Single Stake AC Auto Burn Vault", - tokenAddress: "0x5541D83EFaD1f281571B343977648B75d95cdAC2", - tokenDecimals: 18, - tokenDescriptionUrl: "#", - earnedToken: "MagikFarm - GRAPE Single Stake", - earnedTokenAddress: "0xDFc0Cc5c036c52131fb351e50ba322b4D00Ce60B", - earnContractAddress: "0xDFc0Cc5c036c52131fb351e50ba322b4D00Ce60B", - pricePerFullShare: 1, - tvl: 0, - oracle: "tokens", - oracleId: "GRAPE", - oraclePrice: 0, - depositsPaused: false, - status: "active", - platform: "Grape", - assets: ["GRAPE"], - risks: [ - "COMPLEXITY_LOW", - "BATTLE_TESTED", - "IL_NONE", - "MCAP_MICRO", - "AUDIT", - "CONTRACTS_VERIFIED", - ], - stratType: "SingleStake", - buyTokenUrl: - "https://traderjoexyz.com/trade?inputCurrency=0x130966628846bfd36ff31a822705796e8cb8c18d&outputCurrency=0xc55036b5348cfb45a932481744645985010d3a44#/", - }, - { - id: "grape-grape-mim", - name: "GRAPE - MIM 🔥", - token: "GRAPE - MIM", - tokenDescription: "grapefinance.app - GRAPE - MIM LP AC Auto Burn Vault 🔥", - tokenAddress: "0xb382247667fe8CA5327cA1Fa4835AE77A9907Bc8", - tokenDecimals: 18, - tokenDescriptionUrl: "#", - earnedToken: "MagikFarm - Grape - MIM LP", - earnedTokenAddress: "0xe8cE63e37bB4B662837144058c298C4e7Fd0b93C", - earnContractAddress: "0xe8cE63e37bB4B662837144058c298C4e7Fd0b93C", - pricePerFullShare: 1, - tvl: 0, - oracle: "lps", - oracleId: "grape-grape-mim", - oraclePrice: 0, - depositsPaused: false, - partnership: true, - isMooStaked: true, - status: "active", - platform: "Grape", - assets: ["GRAPE", "MIM"], - risks: [ - "COMPLEXITY_LOW", - "BATTLE_TESTED", - "IL_LOW", - "5AUDIT", - "CONTRACTS_VERIFIED", - ], - stratType: "StratLP", - addLiquidityUrl: - "https://traderjoexyz.com/pool/0x130966628846bfd36ff31a822705796e8cb8c18d/0x5541d83efad1f281571b343977648b75d95cdac2#/", - buyTokenUrl: - "https://traderjoexyz.com/trade?inputCurrency=0x130966628846bfd36ff31a822705796e8cb8c18d&outputCurrency=0x5541d83efad1f281571b343977648b75d95cdac2#/", - }, - { - id: "grape-wine-mim", - name: "WINE - MIM ", - token: "WINE - MIM", - tokenDescription: "grapefinance.app - WINE - MIM LP AC Vault ", - tokenAddress: "0x00cB5b42684DA62909665d8151fF80D1567722c3", - tokenDecimals: 18, - tokenDescriptionUrl: "#", - earnedToken: "MagikFarm - WINE-MIM LP", - earnedTokenAddress: "0x0B2a90132fC171B37c6999845703C90479B7124F", - earnContractAddress: "0x0B2a90132fC171B37c6999845703C90479B7124F", - pricePerFullShare: 1, - tvl: 0, - oracle: "lps", - oracleId: "grape-wine-mim", - oraclePrice: 0, - depositsPaused: false, - partnership: true, - isMooStaked: true, - status: "active", - platform: "Grape", - assets: ["WINE", "MIM"], - risks: [ - "COMPLEXITY_LOW", - "BATTLE_TESTED", - "IL_LOW", - "5AUDIT", - "CONTRACTS_VERIFIED", - ], - stratType: "StratLP", - addLiquidityUrl: - "https://traderjoexyz.com/pool/0x130966628846bfd36ff31a822705796e8cb8c18d/0xc55036b5348cfb45a932481744645985010d3a44#/", - buyTokenUrl: - "https://traderjoexyz.com/trade?inputCurrency=0x130966628846bfd36ff31a822705796e8cb8c18d&outputCurrency=0xc55036b5348cfb45a932481744645985010d3a44#/", - }, - { - id: "grape-grape-wine", - name: "GRAPE - WINE ", - token: "GRAPE - WINE", - tokenDescription: "grapefinance.app - GRAPE - WINE LP AC Vault ", - tokenAddress: "0xd3d477Df7f63A2623464Ff5Be6746981FdeD026F", - tokenDecimals: 18, - tokenDescriptionUrl: "#", - earnedToken: "MagikFarm - GRAPE-WINE LP", - earnedTokenAddress: "0x03bC623B17f6D34Fc861d7C4C17D927B50994D7c", - earnContractAddress: "0x03bC623B17f6D34Fc861d7C4C17D927B50994D7c", - pricePerFullShare: 1, - tvl: 0, - oracle: "lps", - oracleId: "grape-wine-mim", - oraclePrice: 0, - depositsPaused: false, - partnership: true, - isMooStaked: true, - status: "active", - platform: "Grape", - assets: ["GRAPE", "WINE"], - risks: [ - "COMPLEXITY_LOW", - "BATTLE_TESTED", - "IL_LOW", - "5AUDIT", - "CONTRACTS_VERIFIED", - ], - stratType: "StratLP", - addLiquidityUrl: - "https://traderjoexyz.com/pool/0x5541d83efad1f281571b343977648b75d95cdac2/0xc55036b5348cfb45a932481744645985010d3a44#/", - buyTokenUrl: - "https://traderjoexyz.com/trade?inputCurrency=0x5541d83efad1f281571b343977648b75d95cdac2&outputCurrency=0xc55036b5348cfb45a932481744645985010d3a44#/", - }, - { - id: "joe-wlrs-usdibs", - name: "WLRS - USDibs 🔥", - token: "WLRS - USDibs 🔥", - tokenDescription: - "frozenwalrus.finance - WLRS - USDibs LP AC Auto Burn Vault 🔥", - tokenAddress: "0x26E6E2CbE80A7408573BE67578ee5c10F2984f99", - tokenDecimals: 18, - tokenDescriptionUrl: "#", - earnedToken: "MagikFarm - WLRS - USDIBS", - earnedTokenAddress: "0xda77b161A9aBc0a22406D1B618DcC68D5737Cb9A", - earnContractAddress: "0xda77b161A9aBc0a22406D1B618DcC68D5737Cb9A", - pricePerFullShare: 1, - tvl: 0, - oracle: "lps", - oracleId: "joe-wlrs-usdibs", - oraclePrice: 0, - depositsPaused: false, - partnership: true, - isMooStaked: true, - status: "active", - platform: "JOE", - assets: ["WLRS", "USDIBS"], - risks: [ - "COMPLEXITY_LOW", - "BATTLE_TESTED", - "IL_LOW", - "5AUDIT", - "CONTRACTS_VERIFIED", - ], - stratType: "StratLP", - addLiquidityUrl: - "https://traderjoexyz.com/pool/0x0EfA5328FEfCe96C8d10661bd97403764D477853/0x395908aeb53d33A9B8ac35e148E9805D34A555D3#/", - buyTokenUrl: - "https://traderjoexyz.com/trade?inputCurrency=0x0EfA5328FEfCe96C8d10661bd97403764D477853&outputCurrency=0x395908aeb53d33A9B8ac35e148E9805D34A555D3#/", - }, - { - id: "joe-nrwl-yusd", - name: "NRWL - YUSD 🔥", - token: "NRWL - YUSD 🔥", - tokenDescription: - "frozenwalrus.finance - NRWL - YUSD LP AC Auto Burn Vault 🔥", - tokenAddress: "0xE4f4f9DD9cD45bC44FD517f4AE490591030274F6", - tokenDecimals: 18, - tokenDescriptionUrl: "#", - earnedToken: "MagikFarm - NRWL-YUSD", - earnedTokenAddress: "0xCa887Ed67D7031cdEcd93b6670909EE00ccEBB68", - earnContractAddress: "0xCa887Ed67D7031cdEcd93b6670909EE00ccEBB68", - pricePerFullShare: 1, - tvl: 0, - oracle: "lps", - oracleId: "joe-nrwl-yusd", - oraclePrice: 0, - depositsPaused: false, - partnership: true, - isMooStaked: true, - status: "active", - platform: "JOE", - assets: ["NRWL", "YUSD"], - risks: [ - "COMPLEXITY_LOW", - "BATTLE_TESTED", - "IL_LOW", - "5AUDIT", - "CONTRACTS_VERIFIED", - ], - stratType: "StratLP", - addLiquidityUrl: - "https://www.swapsicle.io/add/0x501012893eE88976AB8B5289B7a78E307d5d9DCb/0x111111111111ed1D73f860F57b2798b683f2d325", - buyTokenUrl: - "https://www.swapsicle.io/swap/0x501012893eE88976AB8B5289B7a78E307d5d9DCb/0x111111111111ed1D73f860F57b2798b683f2d325", - }, - { - id: "joe-wlrs-usdc", - name: "WLRS - USDC.e 🔥", - token: "WLRS - USDC.e 🔥", - tokenDescription: - "frozenwalrus.finance - WLRS - USDC.e LP AC Auto Burn Vault 🔥", - tokenAddress: "0x82845B52b53c80595bbF78129126bD3E6Fc2C1DF", - tokenDecimals: 18, - tokenDescriptionUrl: "#", - earnedToken: "MagikFarm - WLRS - USDC", - earnedTokenAddress: "0x92B1B91237388c2611Aa5df29A8059c9C8BE2366", - earnContractAddress: "0x92B1B91237388c2611Aa5df29A8059c9C8BE2366", - pricePerFullShare: 1, - tvl: 0, - oracle: "lps", - oracleId: "joe-wlrs-usdc", - oraclePrice: 0, - depositsPaused: false, - partnership: true, - isMooStaked: true, - status: "active", - platform: "JOE", - assets: ["WLRS", "USDC"], - risks: [ - "COMPLEXITY_LOW", - "BATTLE_TESTED", - "IL_LOW", - "5AUDIT", - "CONTRACTS_VERIFIED", - ], - stratType: "StratLP", - addLiquidityUrl: - "https://traderjoexyz.com/pool/0xA7D7079b0FEaD91F3e65f86E8915Cb59c1a4C664/0x395908aeb53d33A9B8ac35e148E9805D34A555D3#/", - buyTokenUrl: - "https://traderjoexyz.com/trade?inputCurrency=0xA7D7079b0FEaD91F3e65f86E8915Cb59c1a4C664&outputCurrency=0x395908aeb53d33A9B8ac35e148E9805D34A555D3#/", - }, - { - id: "joe-wshare-usdc", - name: "WSHARE - USDC.e 🔥", - token: "WSHARE - USDC.e 🔥", - tokenDescription: "frozenwalrus.finance - WSHARE - USDC.e LP AC Vault 🔥", - tokenAddress: "0x03d15E0451e54Eec95ac5AcB5B0a7ce69638c62A", - tokenDecimals: 18, - tokenDescriptionUrl: "#", - earnedToken: "MagikFarm - WSHARE - USDC", - earnedTokenAddress: "0xFD368aCD61dAFDceB544309a3F793Dab5c615fAe", - earnContractAddress: "0xFD368aCD61dAFDceB544309a3F793Dab5c615fAe", - pricePerFullShare: 1, - tvl: 0, - oracle: "lps", - oracleId: "joe-wshare-usdc", - oraclePrice: 0, - depositsPaused: false, - partnership: true, - isMooStaked: true, - status: "active", - platform: "JOE", - assets: ["WSHARE", "USDC"], - risks: [ - "COMPLEXITY_LOW", - "BATTLE_TESTED", - "IL_LOW", - "5AUDIT", - "CONTRACTS_VERIFIED", - ], - stratType: "StratLP", - addLiquidityUrl: - "https://traderjoexyz.com/pool/0xA7D7079b0FEaD91F3e65f86E8915Cb59c1a4C664/0xe6d1aFea0B76C8f51024683DD27FA446dDAF34B6#/", - buyTokenUrl: - "https://traderjoexyz.com/trade?inputCurrency=0xA7D7079b0FEaD91F3e65f86E8915Cb59c1a4C664&outputCurrency=0xe6d1aFea0B76C8f51024683DD27FA446dDAF34B6#/", - }, - { - id: "piggy-piggy-avax", - name: "PIGGY - AVAX 🔥", - token: "PIGGY - AVAX 🔥", - tokenDescription: "piggyfinance.io - PIGGY - AVAX LP AC Auto Burn Vault 🔥", - tokenAddress: "0x2440885843d8e9f16a4b64933354d1CfBCf7F180", - tokenDecimals: 18, - tokenDescriptionUrl: "#", - earnedToken: "MagikFarm - PIGGY - AVAX", - earnedTokenAddress: "0xe74131997f5e61a06384a70F2a924fCBDb102035", - earnContractAddress: "0xe74131997f5e61a06384a70F2a924fCBDb102035", - pricePerFullShare: 1, - tvl: 0, - oracle: "lps", - oracleId: "piggy-piggy-avax", - oraclePrice: 0, - depositsPaused: false, - partnership: true, - isMooStaked: true, - status: "active", - platform: "JOE", - assets: ["PIGGY", "AVAX"], - risks: [ - "COMPLEXITY_LOW", - "BATTLE_TESTED", - "IL_LOW", - "5AUDIT", - "CONTRACTS_VERIFIED", - ], - stratType: "StratLP", - addLiquidityUrl: - "https://traderjoexyz.com/pool/AVAX/0x1a877B68bdA77d78EEa607443CcDE667B31B0CdF#/", - buyTokenUrl: - "https://traderjoexyz.com/trade?outputCurrency=0x1a877B68bdA77d78EEa607443CcDE667B31B0CdF", - }, - { - id: "bam-bam-usdc", - name: "BAM - USDC 🔥", - token: "BAM - USDC 🔥", - tokenDescription: "bamboofinance.app - BAM - USDC LP AC Auto Burn Vault 🔥", - tokenAddress: "0xbe7C737FCC2D6EBA0e4e73A073a0120171287769", - tokenDecimals: 18, - tokenDescriptionUrl: "#", - earnedToken: "MagikFarm - BAM - USDC", - earnedTokenAddress: "0x12AefAa0c1961d450D5772a5e94D721A9eBAF72c", - earnContractAddress: "0x12AefAa0c1961d450D5772a5e94D721A9eBAF72c", - pricePerFullShare: 1, - tvl: 0, - oracle: "lps", - oracleId: "bam-bam-usdc", - oraclePrice: 0, - depositsPaused: true, - partnership: true, - isMooStaked: true, - status: "active", - platform: "JOE", - assets: ["BAM", "USDC"], - risks: [ - "COMPLEXITY_LOW", - "BATTLE_TESTED", - "IL_LOW", - "5AUDIT", - "CONTRACTS_VERIFIED", - ], - stratType: "StratLP", - addLiquidityUrl: - "https://traderjoexyz.com/pool/0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E/0x5cc339Aa2A582D857F38B85F662Ea3513706a1E7#/", - buyTokenUrl: - "https://traderjoexyz.com/trade?inputCurrency=0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E&outputCurrency=0x5cc339Aa2A582D857F38B85F662Ea3513706a1E7#/", - }, - { - id: "bam-bdao-usdc", - name: "BDAO - USDC 🔥", - token: "BDAO - USDC 🔥", - tokenDescription: "bamboofinance.app - BDAO - USDC LP AC Vault", - tokenAddress: "0x0774F0acC4DD1CA84BC8521FEe6dC2f7D22f133f", - tokenDecimals: 18, - tokenDescriptionUrl: "#", - earnedToken: "MagikFarm - BDAO - USDC", - earnedTokenAddress: "0xB5E8BB16a8cc347d3671Cb7d855a7776e34c9E35", - earnContractAddress: "0xB5E8BB16a8cc347d3671Cb7d855a7776e34c9E35", - pricePerFullShare: 1, - tvl: 0, - oracle: "lps", - oracleId: "bam-bdao-usdc", - oraclePrice: 0, - depositsPaused: true, - partnership: true, - isMooStaked: true, - status: "active", - platform: "JOE", - assets: ["BDAO", "USDC"], - risks: [ - "COMPLEXITY_LOW", - "BATTLE_TESTED", - "IL_LOW", - "5AUDIT", - "CONTRACTS_VERIFIED", - ], - stratType: "StratLP", - addLiquidityUrl: - "https://traderjoexyz.com/pool/0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E/0x83c7412931398502922a35911E5Fab221822f4B6#/", - buyTokenUrl: - "https://traderjoexyz.com/trade?inputCurrency=0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E&outputCurrency=0x83c7412931398502922a35911E5Fab221822f4B6#/", - }, -]; - -module.exports = avalanchePools; diff --git a/projects/magik-farm/config/vault/bsc_pools.js b/projects/magik-farm/config/vault/bsc_pools.js deleted file mode 100644 index 4be092cda16..00000000000 --- a/projects/magik-farm/config/vault/bsc_pools.js +++ /dev/null @@ -1,721 +0,0 @@ -const ADDRESSES = require('../../../helper/coreAssets.json') -const bscPools = [ - { - id: 'orb-orb-magik', - name: 'MAGIK-WBNB LP 🔥', - token: 'MAGIK-WBNB LP 🔥', - tokenDescription: - 'orbitalswap.com - MAGIK - WBNB LP - AC Auto Fee Share Vault 🔥', - tokenAddress: '0x3Cd3E322f0112a296192E3Dc2742E96D5107DcF8', - tokenDecimals: 18, - tokenDescriptionUrl: '#', - earnedToken: 'MagikFarm-Orb-MAGIK-WBNB', - earnedTokenAddress: '0x929070d727F802aa6b78BDD3E8B06108FE7A20d5', - earnContractAddress: '0x929070d727F802aa6b78BDD3E8B06108FE7A20d5', - pricePerFullShare: 1, - tvl: 0, - oracle: 'lps', - oracleId: 'orb-orb-magik', - oraclePrice: 0, - depositsPaused: false, - status: 'active', - platform: 'OrbitalSwap', - assets: ['MAGIK', 'WBNB'], - risks: [ - 'COMPLEXITY_LOW', - 'BATTLE_TESTED', - 'IL_LOW', - 'MCAP_MICRO', - 'AUDIT', - 'CONTRACTS_VERIFIED', - ], - stratType: 'StratLP', - addLiquidityUrl: - 'https://orbitalswap.com/add/BNB/0xD68F75b3aa54bee23e6Ac3AD4b3C28D3E6319725', - buyTokenUrl: - 'https://orbitalswap.com/swap?outputCurrency=0xD68F75b3aa54bee23e6Ac3AD4b3C28D3E6319725', - createdAt: 1648773316, - }, - { - id: 'dibs-usdibs-busd', - name: 'usDIBS-BUSD LP 🔥', - token: 'usDIBS-BUSD LP 🔥', - tokenDescription: - 'Dibs.Money - usDIBS - BUSD LP - AC Auto Fee Share Vault 🔥', - tokenAddress: '0xADB3C33d435cEFd6A43e802cae917D9f9EE15A0b', - tokenDecimals: 18, - tokenDescriptionUrl: '#', - earnedToken: 'MagikFarm-usDibs-BUSD', - earnedTokenAddress: '0xa097CE648CaB3a4238a22A826B453f4F173b64a0', - earnContractAddress: '0xa097CE648CaB3a4238a22A826B453f4F173b64a0', - pricePerFullShare: 1, - tvl: 0, - oracle: 'lps', - oracleId: 'dibs-usdibs-busd', - oraclePrice: 0, - depositsPaused: false, - status: 'active', - platform: 'DIBS.MONEY', - assets: ['USDIBS', 'BUSD'], - risks: [ - 'COMPLEXITY_LOW', - 'BATTLE_TESTED', - 'IL_LOW', - 'MCAP_MICRO', - 'AUDIT', - 'CONTRACTS_VERIFIED', - ], - stratType: 'StratLP', - addLiquidityUrl: - 'https://orbitalswap.com/add/0x8d2aa7b23aBE16E7eCa845F64C65A314d4ABa35A/0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56', - buyTokenUrl: - 'https://orbitalswap.com/swap?inputCurrency=0x8d2aa7b23aBE16E7eCa845F64C65A314d4ABa35A&outputCurrency=0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56', - createdAt: 1648773316, - }, - { - id: 'orb-wtytan-busd', - name: 'wTYTAN-BUSD LP 🔥', - token: 'wTYTAN-BUSD LP 🔥', - tokenDescription: - 'orbitalswap.com - wTYTAN - BUSD LP - AC Auto Fee Share Vault 🔥', - tokenAddress: '0x2f60eFd93B1E1dFA93AEd5899d116d0ddeF6A75F', - tokenDecimals: 18, - tokenDescriptionUrl: '#', - earnedToken: 'MagikFarm-Orb-wTYTAN-BUSD', - earnedTokenAddress: '0xE51f32aF3796633dAB6299feAdaF50930c1Fe838', - earnContractAddress: '0xE51f32aF3796633dAB6299feAdaF50930c1Fe838', - pricePerFullShare: 1, - tvl: 0, - oracle: 'lps', - oracleId: 'orb-wtytan-busd', - oraclePrice: 0, - depositsPaused: false, - status: 'active', - platform: 'OrbitalSwap', - assets: ['WTYTAN', 'BUSD'], - risks: [ - 'COMPLEXITY_LOW', - 'BATTLE_TESTED', - 'IL_LOW', - 'MCAP_MICRO', - 'AUDIT', - 'CONTRACTS_VERIFIED', - ], - stratType: 'StratLP', - addLiquidityUrl: - 'https://orbitalswap.com/add/0x3593d409484e36aAd862101054FbDBe1C9a4fC9b/0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56', - buyTokenUrl: - 'https://orbitalswap.com/swap?inputCurrency=0x3593d409484e36aAd862101054FbDBe1C9a4fC9b&outputCurrency=0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56', - createdAt: 1648773316, - }, - { - id: 'orb-orb-usdc', - name: 'ORB-USDC LP 🔥', - token: 'ORB-USDC LP 🔥', - tokenDescription: - 'orbitalswap.com - ORB - USDC LP - AC Auto Fee Share Vault 🔥', - tokenAddress: '0xaB5d13feE7B4eCC6B2D019BB16793D18ab8c9982', - tokenDecimals: 18, - tokenDescriptionUrl: '#', - earnedToken: 'MagikFarm-ORB-USDC', - earnedTokenAddress: '0xb9aC31D4AdA868EE8AF3b755D6b3c0d9DdFf2Ab9', - earnContractAddress: '0xb9aC31D4AdA868EE8AF3b755D6b3c0d9DdFf2Ab9', - pricePerFullShare: 1, - tvl: 0, - oracle: 'lps', - oracleId: 'orb-orb-usdc', - oraclePrice: 0, - depositsPaused: false, - status: 'active', - platform: 'OrbitalSwap', - assets: ['ORB', 'USDC'], - risks: [ - 'COMPLEXITY_LOW', - 'BATTLE_TESTED', - 'IL_LOW', - 'MCAP_MICRO', - 'AUDIT', - 'CONTRACTS_VERIFIED', - ], - stratType: 'StratLP', - addLiquidityUrl: - 'https://orbitalswap.com/add/0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d/0x42b98A2f73a282D731b0B8F4ACfB6cAF3565496B', - buyTokenUrl: - 'https://orbitalswap.com/swap?inputCurrency=0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d&outputCurrency=0x42b98A2f73a282D731b0B8F4ACfB6cAF3565496B', - createdAt: 1648773316, - }, - { - id: 'orb-eth-usdc', - name: 'ETH-USDC LP 🔥', - token: 'ETH-USDC LP 🔥', - tokenDescription: - 'orbitalswap.com - ETH - USDC LP - AC Auto Fee Share Vault 🔥', - tokenAddress: '0x80fBD8Daa1516ac96c26b02798df6CC4919ef354', - tokenDecimals: 18, - tokenDescriptionUrl: '#', - earnedToken: 'MagikFarm-ETH-USDC', - earnedTokenAddress: '0x1118d8bA31bb4a69498c80DF2274a440fd756139', - earnContractAddress: '0x1118d8bA31bb4a69498c80DF2274a440fd756139', - pricePerFullShare: 1, - tvl: 0, - oracle: 'lps', - oracleId: 'orb-eth-usdc', - oraclePrice: 0, - depositsPaused: false, - status: 'active', - platform: 'OrbitalSwap', - assets: ['ETH', 'USDC'], - risks: [ - 'COMPLEXITY_LOW', - 'BATTLE_TESTED', - 'IL_LOW', - 'MCAP_MICRO', - 'AUDIT', - 'CONTRACTS_VERIFIED', - ], - stratType: 'StratLP', - addLiquidityUrl: - 'https://orbitalswap.com/add/0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d/0x2170Ed0880ac9A755fd29B2688956BD959F933F8', - buyTokenUrl: - 'https://orbitalswap.com/swap?inputCurrency=0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d&outputCurrency=0x2170Ed0880ac9A755fd29B2688956BD959F933F8', - createdAt: 1648773316, - }, - { - id: 'orb-piggy-avax', - name: 'PIGGY-AVAX LP 🔥', - token: 'PIGGY-AVAX LP 🔥', - tokenDescription: - 'orbitalswap.com - PIGGY - AVAX LP - AC Auto Fee Share Vault 🔥', - tokenAddress: '0xE5FcBAad5c0a22375A3Ee2EC7A85707807eDFd29', - tokenDecimals: 18, - tokenDescriptionUrl: '#', - earnedToken: 'MagikFarm-PIGGY-AVAX', - earnedTokenAddress: '0x506937C41B5dc4C01ED303b304F256493272f498', - earnContractAddress: '0x506937C41B5dc4C01ED303b304F256493272f498', - pricePerFullShare: 1, - tvl: 0, - oracle: 'lps', - oracleId: 'orb-piggy-avax', - oraclePrice: 0, - depositsPaused: false, - status: 'active', - platform: 'OrbitalSwap', - assets: ['PIGGY', 'AVAX'], - risks: [ - 'COMPLEXITY_LOW', - 'BATTLE_TESTED', - 'IL_LOW', - 'MCAP_MICRO', - 'AUDIT', - 'CONTRACTS_VERIFIED', - ], - stratType: 'StratLP', - addLiquidityUrl: - 'https://orbitalswap.com/add/0x31CdD9F5a6a1E39a38A6b073Fc3FaBE6CbfeAc76/0x1CE0c2827e2eF14D5C4f29a091d735A204794041', - buyTokenUrl: - 'https://orbitalswap.com/swap?inputCurrency=0x1CE0c2827e2eF14D5C4f29a091d735A204794041&outputCurrency=0x31CdD9F5a6a1E39a38A6b073Fc3FaBE6CbfeAc76', - createdAt: 1648773316, - }, - { - id: 'orb-drip-busd', - name: 'DRIP-BUSD LP 🔥', - token: 'DRIP-BUSD LP 🔥', - tokenDescription: - 'orbitalswap.com - DRIP - BUSD LP - AC Auto Fee Share Vault 🔥', - tokenAddress: '0x48ED1d5C8A428c191B94D99bEe674020e8956127', - tokenDecimals: 18, - tokenDescriptionUrl: '#', - earnedToken: 'MagikFarm-DRIP-BUSD', - earnedTokenAddress: '0x4d9CEe6980f2C12bacbf9F1be9dde8281586b5Ee', - earnContractAddress: '0x4d9CEe6980f2C12bacbf9F1be9dde8281586b5Ee', - pricePerFullShare: 1, - tvl: 0, - oracle: 'lps', - oracleId: 'orb-drip-busd', - oraclePrice: 0, - depositsPaused: false, - status: 'active', - platform: 'OrbitalSwap', - assets: ['DRIP', 'BUSD'], - risks: [ - 'COMPLEXITY_LOW', - 'BATTLE_TESTED', - 'IL_LOW', - 'MCAP_MICRO', - 'AUDIT', - 'CONTRACTS_VERIFIED', - ], - stratType: 'StratLP', - addLiquidityUrl: - 'https://orbitalswap.com/add/0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56/0x20f663CEa80FaCE82ACDFA3aAE6862d246cE0333', - buyTokenUrl: - 'https://orbitalswap.com/swap?inputCurrency=0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56&outputCurrency=0x20f663CEa80FaCE82ACDFA3aAE6862d246cE0333', - createdAt: 1648773316, - }, - { - id: 'orb-orb-wbnb', - name: 'ORB-WBNB LP 🔥', - token: 'ORB-WBNB LP 🔥', - tokenDescription: - 'orbitalswap.com - ORB - WBNB LP - AC Auto Fee Share Vault 🔥', - tokenAddress: '0x451a503b59A4DEA428b8eb88D6df27DE8A7fcfe1', - tokenDecimals: 18, - tokenDescriptionUrl: '#', - earnedToken: 'MagikFarm-ORB-WBNB', - earnedTokenAddress: '0x00e6EAF4Fc20a0574864D2BAea731DB57DCe6c59', - earnContractAddress: '0x00e6EAF4Fc20a0574864D2BAea731DB57DCe6c59', - pricePerFullShare: 1, - tvl: 0, - oracle: 'lps', - oracleId: 'orb-orb-wbnb', - oraclePrice: 0, - depositsPaused: false, - status: 'active', - platform: 'OrbitalSwap', - assets: ['ORB', 'WBNB'], - risks: [ - 'COMPLEXITY_LOW', - 'BATTLE_TESTED', - 'IL_LOW', - 'MCAP_MICRO', - 'AUDIT', - 'CONTRACTS_VERIFIED', - ], - stratType: 'StratLP', - addLiquidityUrl: - 'https://orbitalswap.com/add/BNB/0x42b98A2f73a282D731b0B8F4ACfB6cAF3565496B', - buyTokenUrl: - 'https://orbitalswap.com/swap?outputCurrency=0x42b98A2f73a282D731b0B8F4ACfB6cAF3565496B', - createdAt: 1648773316, - }, - { - id: 'orb-orb-busd', - name: 'ORB-BUSD LP 🔥', - token: 'ORB-BUSD LP 🔥', - tokenDescription: - 'orbitalswap.com - ORB - BUSD LP - AC Auto Fee Share Vault 🔥', - tokenAddress: '0xE1a104f204c6063B06577d8A7E6C796058494e82', - tokenDecimals: 18, - tokenDescriptionUrl: '#', - earnedToken: 'MagikFarm-ORB-BUSD', - earnedTokenAddress: '0xDb2D2dc94A50584FcbE36C279041DAf7B1362570', - earnContractAddress: '0xDb2D2dc94A50584FcbE36C279041DAf7B1362570', - pricePerFullShare: 1, - tvl: 0, - oracle: 'lps', - oracleId: 'orb-orb-busd', - oraclePrice: 0, - depositsPaused: false, - status: 'active', - platform: 'OrbitalSwap', - assets: ['ORB', 'BUSD'], - risks: [ - 'COMPLEXITY_LOW', - 'BATTLE_TESTED', - 'IL_LOW', - 'MCAP_MICRO', - 'AUDIT', - 'CONTRACTS_VERIFIED', - ], - stratType: 'StratLP', - addLiquidityUrl: - 'https://orbitalswap.com/add/0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56/0x42b98A2f73a282D731b0B8F4ACfB6cAF3565496B', - buyTokenUrl: - 'https://orbitalswap.com/swap?inputCurrency=0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56&outputCurrency=0x42b98A2f73a282D731b0B8F4ACfB6cAF3565496B', - createdAt: 1648773316, - }, - { - id: 'orb-weth-btcb', - name: 'WETH-BTCB LP 🔥', - token: 'WETH-BTCB LP 🔥', - tokenDescription: - 'orbitalswap.com - WETH - BTCB LP - AC Auto Fee Share Vault 🔥', - tokenAddress: '0x9fb8c330d0804C6Af7cC3E044cE8717021AaEBCE', - tokenDecimals: 18, - tokenDescriptionUrl: '#', - earnedToken: 'MagikFarm-Orb-WETH-BTCB', - earnedTokenAddress: '0x01A534dd47e6545d6AAeDbeEB10f70dbf0F4e981', - earnContractAddress: '0x01A534dd47e6545d6AAeDbeEB10f70dbf0F4e981', - pricePerFullShare: 1, - tvl: 0, - oracle: 'lps', - oracleId: 'orb-weth-btcb', - oraclePrice: 0, - depositsPaused: false, - status: 'active', - platform: 'OrbitalSwap', - assets: ['WETH', 'BTCB'], - risks: [ - 'COMPLEXITY_LOW', - 'BATTLE_TESTED', - 'IL_LOW', - 'MCAP_MICRO', - 'AUDIT', - 'CONTRACTS_VERIFIED', - ], - stratType: 'StratLP', - addLiquidityUrl: - 'https://orbitalswap.com/add/0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56/0x55d398326f99059fF775485246999027B3197955', - buyTokenUrl: - 'https://orbitalswap.com/swap?inputCurrency=0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56&outputCurrency=0x55d398326f99059fF775485246999027B3197955', - createdAt: 1648773316, - }, - { - id: 'orb-busd-usdt', - name: 'BUSD-USDT LP 🔥', - token: 'BUSD-USDT LP 🔥', - tokenDescription: - 'orbitalswap.com - BUSD - USDT LP - AC Auto Fee Share Vault 🔥', - tokenAddress: '0x5cd108dFa59B8a2713FeCf0e3BeaDA5C58BC9f89', - tokenDecimals: 18, - tokenDescriptionUrl: '#', - earnedToken: 'MagikFarm-Orb-BUSD-USDT', - earnedTokenAddress: '0x680607930F1071B332Ad5De1f551B027C0Fb7B20', - earnContractAddress: '0x680607930F1071B332Ad5De1f551B027C0Fb7B20', - pricePerFullShare: 1, - tvl: 0, - oracle: 'lps', - oracleId: 'orb-busd-usdt', - oraclePrice: 0, - depositsPaused: false, - status: 'active', - platform: 'OrbitalSwap', - assets: ['BUSD', 'USDT'], - risks: [ - 'COMPLEXITY_LOW', - 'BATTLE_TESTED', - 'IL_LOW', - 'MCAP_MICRO', - 'AUDIT', - 'CONTRACTS_VERIFIED', - ], - stratType: 'StratLP', - addLiquidityUrl: - 'https://orbitalswap.com/add/0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56/0x55d398326f99059fF775485246999027B3197955', - buyTokenUrl: - 'https://orbitalswap.com/swap?inputCurrency=0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56&outputCurrency=0x55d398326f99059fF775485246999027B3197955', - createdAt: 1648773316, - }, - { - id: 'orb-avax-wbnb', - name: 'AVAX-WBNB LP 🔥', - token: 'AVAX-WBNB LP 🔥', - tokenDescription: - 'orbitalswap.com - AVAX - WBNB LP - AC Auto Fee Share Vault 🔥', - tokenAddress: '0x2111849199aA24C83CB462e86b3BF5E44Cf72cc2', - tokenDecimals: 18, - tokenDescriptionUrl: '#', - earnedToken: 'MagikFarm-Orb-AVAX-WBNB', - earnedTokenAddress: '0x64839E8CF15587a6A2425e366C0596d625e403F8', - earnContractAddress: '0x64839E8CF15587a6A2425e366C0596d625e403F8', - pricePerFullShare: 1, - tvl: 0, - oracle: 'lps', - oracleId: 'orb-avax-wbnb', - oraclePrice: 0, - depositsPaused: false, - status: 'active', - platform: 'OrbitalSwap', - assets: ['AVAX', 'WBNB'], - risks: [ - 'COMPLEXITY_LOW', - 'BATTLE_TESTED', - 'IL_LOW', - 'MCAP_MICRO', - 'AUDIT', - 'CONTRACTS_VERIFIED', - ], - stratType: 'StratLP', - addLiquidityUrl: - 'https://orbitalswap.com/add/0x1CE0c2827e2eF14D5C4f29a091d735A204794041/BNB', - buyTokenUrl: - 'https://orbitalswap.com/swap?outputCurrency=0x1CE0c2827e2eF14D5C4f29a091d735A204794041', - createdAt: 1648773316, - }, - { - id: 'orb-weth-wbnb', - name: 'WETH-WBNB LP 🔥', - token: 'WETH-WBNB LP 🔥', - tokenDescription: - 'orbitalswap.com - WETH - WBNB LP - AC Auto Fee Share Vault 🔥', - tokenAddress: '0xc9b39b94a09a1F772CD98fB9DBfC66696C921ab9', - tokenDecimals: 18, - tokenDescriptionUrl: '#', - earnedToken: 'MagikFarm-ORB-WETH-WBNB', - earnedTokenAddress: '0x10458bc9d0896294C2BAdecC738D50C884D0f2f2', - earnContractAddress: '0x10458bc9d0896294C2BAdecC738D50C884D0f2f2', - pricePerFullShare: 1, - tvl: 0, - oracle: 'lps', - oracleId: 'orb-weth-wbnb', - oraclePrice: 0, - depositsPaused: false, - status: 'active', - platform: 'OrbitalSwap', - assets: ['WETH', 'WBNB'], - risks: [ - 'COMPLEXITY_LOW', - 'BATTLE_TESTED', - 'IL_LOW', - 'MCAP_MICRO', - 'AUDIT', - 'CONTRACTS_VERIFIED', - ], - stratType: 'StratLP', - addLiquidityUrl: - 'https://orbitalswap.com/add/BNB/0x2170Ed0880ac9A755fd29B2688956BD959F933F8', - buyTokenUrl: - 'https://orbitalswap.com/swap?outputCurrency=0x2170Ed0880ac9A755fd29B2688956BD959F933F8', - createdAt: 1648773316, - }, - { - id: 'orb-wbnb-busd', - name: 'WBNB-BUSD LP 🔥', - token: 'WBNB-BUSDLP 🔥', - tokenDescription: - 'orbitalswap.com - WBNB-BUSD - AC Auto Fee Share Vault 🔥', - tokenAddress: '0x57423151Ad2AAFA5378afbA274D30f5fab0d69Df', - tokenDecimals: 18, - tokenDescriptionUrl: '#', - earnedToken: 'MagikFarm-ORB-WBNB-BUSD', - earnedTokenAddress: '0xe577DEF19D5D5cfdA3f15194Ab41A3240558736C', - earnContractAddress: '0xe577DEF19D5D5cfdA3f15194Ab41A3240558736C', - pricePerFullShare: 1, - tvl: 0, - oracle: 'lps', - oracleId: 'orb-wbnb-busd', - oraclePrice: 0, - depositsPaused: false, - status: 'active', - platform: 'OrbitalSwap', - assets: ['BUSD', 'BNB'], - risks: [ - 'COMPLEXITY_LOW', - 'BATTLE_TESTED', - 'IL_LOW', - 'MCAP_MICRO', - 'AUDIT', - 'CONTRACTS_VERIFIED', - ], - stratType: 'StratLP', - addLiquidityUrl: - 'https://orbitalswap.com/add/0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c/0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56', - buyTokenUrl: - 'https://orbitalswap.com/swap?outputCurrency=0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56', - createdAt: 1648773316, - }, - { - id: 'orb-wbnb-usdt', - name: 'WBNB-USDT LP 🔥', - token: 'WBNB-USDT LP 🔥', - tokenDescription: - 'orbitalswap.com - WBNB-USDT - AC Auto Fee Share Vault 🔥', - tokenAddress: '0x6D8163E9dB6c949e92e49C9B3cdB36C69395b680', - tokenDecimals: 18, - tokenDescriptionUrl: '#', - earnedToken: 'MagikFarm-ORB-WBNB-USDT', - earnedTokenAddress: '0x58Eb15BB09848E5928132f897Fe2A5FFF0A06953', - earnContractAddress: '0x58Eb15BB09848E5928132f897Fe2A5FFF0A06953', - pricePerFullShare: 1, - tvl: 0, - oracle: 'lps', - oracleId: 'orb-wbnb-usdt', - oraclePrice: 0, - depositsPaused: false, - status: 'active', - platform: 'OrbitalSwap', - assets: ['USDT', 'BNB'], - risks: [ - 'COMPLEXITY_LOW', - 'BATTLE_TESTED', - 'IL_LOW', - 'MCAP_MICRO', - 'AUDIT', - 'CONTRACTS_VERIFIED', - ], - stratType: 'StratLP', - addLiquidityUrl: - 'https://orbitalswap.com/add/0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c/0x55d398326f99059fF775485246999027B3197955', - buyTokenUrl: - 'https://orbitalswap.com/swap?outputCurrency=0x55d398326f99059fF775485246999027B3197955', - createdAt: 1648773316, - }, - { - id: 'orb-wbnb-btcb', - name: 'WBNB-BTCB LP 🔥', - token: 'WBNB-BTCB LP 🔥', - tokenDescription: - 'orbitalswap.com - WBNB-BTCB - AC Auto Fee Share Vault 🔥', - tokenAddress: '0xfeC8Ee2fd97CF04FA7a2013299496E3EdF497EbC', - tokenDecimals: 18, - tokenDescriptionUrl: '#', - earnedToken: 'MagikFarm-ORB-WBNB-BTCB', - earnedTokenAddress: '0x5684Eb64B6f3133B522200B661149f4C670ABb19', - earnContractAddress: '0x5684Eb64B6f3133B522200B661149f4C670ABb19', - pricePerFullShare: 1, - tvl: 0, - oracle: 'lps', - oracleId: 'orb-wbnb-btcb', - oraclePrice: 0, - depositsPaused: false, - status: 'active', - platform: 'OrbitalSwap', - assets: ['BTCB', 'BNB'], - risks: [ - 'COMPLEXITY_LOW', - 'BATTLE_TESTED', - 'IL_LOW', - 'MCAP_MICRO', - 'AUDIT', - 'CONTRACTS_VERIFIED', - ], - stratType: 'StratLP', - addLiquidityUrl: - 'https://orbitalswap.com/add/0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c/0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c', - buyTokenUrl: - 'https://orbitalswap.com/swap?outputCurrency=0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c', - createdAt: 1648773316, - }, - { - id: 'orb-btcb-busd', - name: 'BTCB-BUSD LP 🔥', - token: 'BTCB-BUSD LP 🔥', - tokenDescription: - 'orbitalswap.com - BTCB-BUSD - AC Auto Fee Share Vault 🔥', - tokenAddress: '0x3ec9B8e424486FCf4923d5e1424B838feee628E8', - tokenDecimals: 18, - tokenDescriptionUrl: '#', - earnedToken: 'MagikFarm-ORB-BTCB-BUSD', - earnedTokenAddress: '0xC829fD908228996dB938755b30f1A9440803b8Df', - earnContractAddress: '0xC829fD908228996dB938755b30f1A9440803b8Df', - pricePerFullShare: 1, - tvl: 0, - oracle: 'lps', - oracleId: 'orb-btcb-busd', - oraclePrice: 0, - depositsPaused: false, - status: 'active', - platform: 'OrbitalSwap', - assets: ['BTCB', 'BUSD'], - risks: [ - 'COMPLEXITY_LOW', - 'BATTLE_TESTED', - 'IL_LOW', - 'MCAP_MICRO', - 'AUDIT', - 'CONTRACTS_VERIFIED', - ], - stratType: 'StratLP', - addLiquidityUrl: - 'https://orbitalswap.com/add/0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56/0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c', - buyTokenUrl: - 'https://orbitalswap.com/swap?inputCurrency=0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56&outputCurrency=0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c', - createdAt: 1648773316, - }, - { - id: 'emp-emp-eth', - name: 'EMP-ETH LP 🔥', - token: 'EMP-ETH LP 🔥', - tokenDescription: 'EMP.Money - EMP - ETH LP - AC Auto Burn Vault 🔥', - tokenAddress: '0x84821bb588f049913Dc579Dc511E5e31EB22d5E4', - tokenDecimals: 18, - tokenDescriptionUrl: '#', - earnedToken: 'MagikFarm-EMP-ETH', - earnedTokenAddress: '0x13eb43c8289CC8D7945462FF4fAfe686d4Bf53F6', - earnContractAddress: '0x13eb43c8289CC8D7945462FF4fAfe686d4Bf53F6', - pricePerFullShare: 1, - tvl: 0, - oracle: 'lps', - oracleId: 'emp-emp-eth', - oraclePrice: 0, - depositsPaused: false, - status: 'active', - platform: 'EMP.Money', - assets: ['EMP', 'ETH'], - risks: [ - 'COMPLEXITY_LOW', - 'BATTLE_TESTED', - 'IL_LOW', - 'MCAP_MICRO', - 'AUDIT', - 'CONTRACTS_VERIFIED', - ], - stratType: 'StratLP', - addLiquidityUrl: - 'https://pancakeswap.finance/add/0x3b248CEfA87F836a4e6f6d6c9b42991b88Dc1d58/0x2170Ed0880ac9A755fd29B2688956BD959F933F8', - buyTokenUrl: - 'https://pancakeswap.finance/swap?inputCurrency=0x2170Ed0880ac9A755fd29B2688956BD959F933F8&outputCurrency=0x3b248CEfA87F836a4e6f6d6c9b42991b88Dc1d58', - createdAt: 1648773316, - }, - { - id: 'emp-eshare-mdb+', - name: 'ESHARE-MDB+ LP', - token: 'ESHARE-MDB+ LP', - tokenDescription: 'EMP.Money - ESHARE - MDB+ LP - AC Fee Share Vault', - tokenAddress: '0x51586182A2031f3e384D080f78C8836D48eBBfFC', - tokenDecimals: 18, - tokenDescriptionUrl: '#', - earnedToken: 'MagikFarm-ESHARE-MDB+', - earnedTokenAddress: '0xA8530643faD58BB82378Fd804e10530D39d5d560', - earnContractAddress: '0xA8530643faD58BB82378Fd804e10530D39d5d560', - pricePerFullShare: 1, - tvl: 0, - oracle: 'lps', - oracleId: 'emp-eshare-mdb+', - oraclePrice: 0, - depositsPaused: false, - status: 'active', - platform: 'EMP.Money', - assets: ['ESHARE', 'MDB'], - risks: [ - 'COMPLEXITY_LOW', - 'BATTLE_TESTED', - 'IL_HIGH', - 'MCAP_MICRO', - 'AUDIT', - 'CONTRACTS_VERIFIED', - ], - stratType: 'StratLP', - addLiquidityUrl: - 'https://pancakeswap.finance/add/0xDB20F6A8665432CE895D724b417f77EcAC956550/0x9f8BB16f49393eeA4331A39B69071759e54e16ea', - buyTokenUrl: - 'https://pancakeswap.finance/swap?inputCurrency=0x9f8BB16f49393eeA4331A39B69071759e54e16ea&outputCurrency=0xDB20F6A8665432CE895D724b417f77EcAC956550', - createdAt: 1648773315, - }, - { - id: 'emp-eshare-wbnb', - name: 'ESHARE-BNB LP', - token: 'ESHARE-BNB LP', - tokenDescription: 'EMP.Money - ESHARE - BNB LP - AC Fee Share Vault', - tokenAddress: '0x1747AF98EBF0B22d500014c7dd52985d736337d2', - tokenDecimals: 18, - tokenDescriptionUrl: '#', - earnedToken: 'MagikFarm-ESHARE-BNB', - earnedTokenAddress: '0xc822dE2843cf3a8a0642908F13d9f57E7A6D9011', - earnContractAddress: '0xc822dE2843cf3a8a0642908F13d9f57E7A6D9011', - pricePerFullShare: 1, - tvl: 0, - oracle: 'lps', - oracleId: 'emp-eshare-wbnb', - oraclePrice: 0, - depositsPaused: false, - status: 'active', - platform: 'EMP.Money', - assets: ['ESHARE', 'BNB'], - risks: [ - 'COMPLEXITY_LOW', - 'BATTLE_TESTED', - 'IL_HIGH', - 'MCAP_MICRO', - 'AUDIT', - 'CONTRACTS_VERIFIED', - ], - stratType: 'StratLP', - addLiquidityUrl: - 'https://pancakeswap.finance/add/0xDB20F6A8665432CE895D724b417f77EcAC956550/0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c', - buyTokenUrl: - 'https://pancakeswap.finance/swap?outputCurrency=0xDB20F6A8665432CE895D724b417f77EcAC956550', - createdAt: 1648773315, - }, -]; -module.exports = bscPools; diff --git a/projects/magik-farm/config/vault/celo_pools.js b/projects/magik-farm/config/vault/celo_pools.js deleted file mode 100644 index 3f5c13aff39..00000000000 --- a/projects/magik-farm/config/vault/celo_pools.js +++ /dev/null @@ -1,2 +0,0 @@ -const celoPools = []; -module.exports = celoPools; diff --git a/projects/magik-farm/config/vault/cronos_pools.js b/projects/magik-farm/config/vault/cronos_pools.js deleted file mode 100644 index 6646eff319f..00000000000 --- a/projects/magik-farm/config/vault/cronos_pools.js +++ /dev/null @@ -1,179 +0,0 @@ -const cronosPools = [ - { - id: 'gaur-gaur', - logo: 'single-assets/GAUR.png', - name: 'GAUR 🔥', - token: 'GAUR 🔥', - tokenDescription: 'gaur.money - Single Stake AC Auto Burn Vault🔥', - tokenAddress: '0x046cb616d7a52173e4Da9efF1BFd590550aa3228', - tokenDecimals: 18, - tokenDescriptionUrl: '#', - earnedToken: 'MagikFarm - GAUR Single Stake', - earnedTokenAddress: '0xaEF7684b1d5aF45F922dC5AAe937c3a708BF4dbA', - earnContractAddress: '0xaEF7684b1d5aF45F922dC5AAe937c3a708BF4dbA', - pricePerFullShare: 1, - tvl: 0, - oracle: 'tokens', - oracleId: 'GAUR', - oraclePrice: 0, - depositsPaused: false, - status: 'active', - platform: 'gaur.money', - assets: ['GAUR'], - risks: [ - 'COMPLEXITY_LOW', - 'BATTLE_TESTED', - 'IL_NONE', - 'MCAP_MICRO', - 'AUDIT', - 'CONTRACTS_VERIFIED', - ], - stratType: 'SingleStake', - buyTokenUrl: - 'https://www.smxswap.com/#/swap?inputCurrency=0xe44Fd7fCb2b1581822D0c862B68222998a0c299a&outputCurrency=0x046cb616d7a52173e4da9eff1bfd590550aa3228', - }, - { - id: 'gaur-gaur-eth', - name: 'GAUR-WETH LP', - token: 'GAUR-WETH LP ', - tokenDescription: 'gaur.money - GAUR-WETH LP AC Auto Fee Share Vault', - tokenAddress: '0xC92837a46B76c5E79d1c228c15d41334b5fEAA97', - tokenDecimals: 18, - tokenDescriptionUrl: '#', - earnedToken: 'Magikfarm - GAUR-WETH LP', - earnedTokenAddress: '0xfD04602cB488b05B1a3A6C092B22a96f870Fbb6a', - earnContractAddress: '0xfD04602cB488b05B1a3A6C092B22a96f870Fbb6a', - pricePerFullShare: 1, - tvl: 0, - oracle: 'lps', - oracleId: 'gaur-gaur-eth', - oraclePrice: 0, - depositsPaused: false, - partnership: true, - isMooStaked: true, - status: 'active', - platform: 'GAUR.MONEY', - assets: ['GAUR', 'WETH'], - risks: [ - 'COMPLEXITY_LOW', - 'BATTLE_TESTED', - 'IL_LOW', - 'AUDIT', - 'CONTRACTS_VERIFIED', - ], - stratType: 'StratLP', - addLiquidityUrl: - 'https://www.smxswap.com/#/add/0xe44Fd7fCb2b1581822D0c862B68222998a0c299a/0x046cb616d7a52173e4da9eff1bfd590550aa3228', - buyTokenUrl: - 'https://www.smxswap.com/#/swap?inputCurrency=0xe44Fd7fCb2b1581822D0c862B68222998a0c299a&outputCurrency=0x046cb616d7a52173e4da9eff1bfd590550aa3228', - }, - { - id: 'darkcrystl-darkcrystl-wcro', - name: 'DARKCRYSTL-WCRO LP🔥', - token: 'DARKCRYSTL-WCRO LP', - tokenDescription: - 'cronos.darkcrystl.com - DARKCRYSTL-WCRO LP AC Auto Burn Vault 🔥', - tokenAddress: '0x59505978Dcdb0c820ECf6486AFEB9b2Baa58Ff49', - tokenDecimals: 18, - tokenDescriptionUrl: '#', - earnedToken: 'Magikfarm - DARKCRYSTL-WCRO LP', - earnedTokenAddress: '0x0344Eff412334A1Cd978507CF3CF9EB667E8Df1b', - earnContractAddress: '0x0344Eff412334A1Cd978507CF3CF9EB667E8Df1b', - pricePerFullShare: 1, - tvl: 0, - oracle: 'lps', - oracleId: 'darkcrystl-darkcrystl-wcro', - oraclePrice: 0, - depositsPaused: false, - partnership: true, - isMooStaked: true, - status: 'active', - platform: 'Darkcrystl', - assets: ['DARKCRYSTL', 'CRO'], - risks: [ - 'COMPLEXITY_LOW', - 'BATTLE_TESTED', - 'IL_LOW', - 'AUDIT', - 'CONTRACTS_VERIFIED', - ], - stratType: 'StratLP', - addLiquidityUrl: - 'https://mm.finance/add/0x5C7F8A570d578ED84E63fdFA7b1eE72dEae1AE23/0xEfA1FABC2AB6219174aD1c912F56f7de53cDc1E1', - buyTokenUrl: - 'https://mm.finance/swap?outputCurrency=0xEfA1FABC2AB6219174aD1c912F56f7de53cDc1E1', - }, - { - id: 'darkcrystl-mine-wcro', - name: 'MINE-WCRO LP🔥', - token: 'MINE-WCRO LP', - tokenDescription: - 'cronos.darkcrystl.com - MINE-WCRO LP AC Auto Fee Share Vault 🔥', - tokenAddress: '0x1AA703ecBb80271A0d719E4405D030F0fc46c30E', - tokenDecimals: 18, - tokenDescriptionUrl: '#', - earnedToken: 'Magikfarm - MINE-WCRO LP', - earnedTokenAddress: '0x0ba923bf767D09817EBcD17d599A4759d79F1966', - earnContractAddress: '0x0ba923bf767D09817EBcD17d599A4759d79F1966', - pricePerFullShare: 1, - tvl: 0, - oracle: 'lps', - oracleId: 'darkcrystl-mine-wcro', - oraclePrice: 0, - depositsPaused: false, - partnership: true, - isMooStaked: true, - status: 'active', - platform: 'Darkcrystl', - assets: ['MINE', 'CRO'], - risks: [ - 'COMPLEXITY_LOW', - 'BATTLE_TESTED', - 'IL_LOW', - 'AUDIT', - 'CONTRACTS_VERIFIED', - ], - stratType: 'StratLP', - addLiquidityUrl: - 'https://mm.finance/add/0x5C7F8A570d578ED84E63fdFA7b1eE72dEae1AE23/0x0944d9a8Dea16af1170c51E8DD3921C727A06cBd', - buyTokenUrl: - 'https://mm.finance/swap?outputCurrency=0x0944d9a8Dea16af1170c51E8DD3921C727A06cBd', - }, - { - id: 'darkcrystl-darkcrystl-mine', - name: 'DARKCRYSTL-MINE LP🔥', - token: 'DARKCRYSTL-MINE LP', - tokenDescription: - 'cronos.darkcrystl.com - DARKCRYSTL-MINE LP AC Auto Fee Share Vault 🔥', - tokenAddress: '0xbe4C7893e79028f4956307d2efD2cf8230360c70', - tokenDecimals: 18, - tokenDescriptionUrl: '#', - earnedToken: 'Magikfarm -DARKCRYSTL-MINE LP', - earnedTokenAddress: '0x515bAF9CbB69A7E9188C526c809f504d87C6C085', - earnContractAddress: '0x515bAF9CbB69A7E9188C526c809f504d87C6C085', - pricePerFullShare: 1, - tvl: 0, - oracle: 'lps', - oracleId: 'darkcrystl-darkcrystl-mine', - oraclePrice: 0, - depositsPaused: false, - partnership: true, - isMooStaked: true, - status: 'active', - platform: 'Darkcrystl', - assets: ['DARKCRYSTL', 'MINE'], - risks: [ - 'COMPLEXITY_LOW', - 'BATTLE_TESTED', - 'IL_LOW', - 'AUDIT', - 'CONTRACTS_VERIFIED', - ], - stratType: 'StratLP', - addLiquidityUrl: - 'https://mm.finance/add/0xEfA1FABC2AB6219174aD1c912F56f7de53cDc1E1/0x0944d9a8Dea16af1170c51E8DD3921C727A06cBd', - buyTokenUrl: - 'https://spookyswap.finance/swap?outputCurrency=0xEfA1FABC2AB6219174aD1c912F56f7de53cDc1E1&inputCurrency=0x0944d9a8Dea16af1170c51E8DD3921C727A06cBd', - }, -]; -module.exports = cronosPools; diff --git a/projects/magik-farm/config/vault/fantom_pools.js b/projects/magik-farm/config/vault/fantom_pools.js deleted file mode 100644 index 50529ecaf0a..00000000000 --- a/projects/magik-farm/config/vault/fantom_pools.js +++ /dev/null @@ -1,1120 +0,0 @@ -const ADDRESSES = require('../../../helper/coreAssets.json') -const fantomPools = [ - { - id: 'lif3-tomb', - name: 'TOMB LIF3 GP', - logo: 'single-assets/TOMB.png', - token: 'TOMB', - tokenDescription: - ' 1% Deposit Fee Tomb.Finance - Single Stake TOMB LIF3 GP Pool 🔥', - tokenAddress: '0x6c021Ae822BEa943b2E66552bDe1D2696a53fbB7', - tokenDecimals: 18, - tokenDescriptionUrl: '#', - earnedToken: 'MagikFarm TOMB', - earnedTokenAddress: '0xe1198C30021dD700A37C098b2e6a22cdF38A70e4', - earnContractAddress: '0xe1198C30021dD700A37C098b2e6a22cdF38A70e4', - pricePerFullShare: 1, - tvl: 0, - oracle: 'tokens', - oracleId: 'TOMB', - oraclePrice: 0, - depositsPaused: false, - status: 'active', - platform: 'TombSwap', - assets: ['TOMB'], - risks: [ - 'COMPLEXITY_LOW', - 'BATTLE_TESTED', - 'IL_NONE', - 'MCAP_MICRO', - 'AUDIT', - 'CONTRACTS_VERIFIED', - ], - stratType: 'SingleStake', - buyTokenUrl: - 'https://swap.tomb.com/#/swap?outputCurrency=0x6c021Ae822BEa943b2E66552bDe1D2696a53fbB7', - }, - { - id: 'spirit-ftm-magik', - name: 'MAGIK-FTM LP🔥', - token: 'MAGIK-FTM LP', - tokenDescription: 'Magik Finance - AC Auto Burn Vault 🔥', - tokenAddress: '0xDc71A6160322ad78DaB0abb47C7A581cFE9709Ee', - tokenDecimals: 18, - tokenDescriptionUrl: '#', - earnedToken: 'MAGIKfarm MAGIK-FTM', - earnedTokenAddress: '0xe8cE63e37bB4B662837144058c298C4e7Fd0b93C', - earnContractAddress: '0xe8cE63e37bB4B662837144058c298C4e7Fd0b93C', - pricePerFullShare: 1, - tvl: 0, - oracle: 'lps', - oracleId: 'spirit-ftm-magik', - oraclePrice: 0, - depositsPaused: false, - partnership: true, - isMooStaked: true, - status: 'active', - platform: 'SpiritSwap', - assets: ['MAGIK', 'FTM'], - risks: [ - 'COMPLEXITY_LOW', - 'BATTLE_TESTED', - 'IL_LOW', - 'AUDIT', - 'CONTRACTS_VERIFIED', - ], - stratType: 'StratLP', - addLiquidityUrl: - 'https://swap.spiritswap.finance/#/add/FTM/0x87a5C9B60A3aaf1064006FE64285018e50e0d020', - buyTokenUrl: - 'https://swap.spiritswap.finance/#/exchange/swap/FTM/0x87a5c9b60a3aaf1064006fe64285018e50e0d020', - }, - { - id: 'spirit-magik', - logo: 'single-assets/MAGIK.png', - name: 'MAGIK🔥', - token: 'MAGIK🔥', - tokenDescription: 'Magik.Finance - Single Stake AC Auto Burn Vault🔥', - tokenAddress: '0x87a5c9b60a3aaf1064006fe64285018e50e0d020', - tokenDecimals: 18, - tokenDescriptionUrl: '#', - earnedToken: 'magikfarmMAGIK', - earnedTokenAddress: '0x0365b8Aa14D5Eecea962C28e4531D1bc2a22D612', - earnContractAddress: '0x0365b8Aa14D5Eecea962C28e4531D1bc2a22D612', - pricePerFullShare: 1, - tvl: 0, - oracle: 'tokens', - oracleId: 'MAGIK', - oraclePrice: 0, - depositsPaused: false, - status: 'active', - platform: 'SpiritSwap', - assets: ['MAGIK'], - risks: [ - 'COMPLEXITY_LOW', - 'BATTLE_TESTED', - 'IL_NONE', - 'MCAP_MICRO', - 'AUDIT', - 'CONTRACTS_VERIFIED', - ], - stratType: 'SingleStake', - buyTokenUrl: - 'https://swap.spiritswap.finance/#/exchange/swap/0x87a5c9b60a3aaf1064006fe64285018e50e0d020', - }, - { - id: 'spirit-ftm-mshare', - name: 'MSHARE-FTM LP', - token: 'MSHARE-FTM LP', - tokenDescription: 'Magik.Finance - MSHARE - FTM LP', - tokenAddress: '0x392C85cECcf9855986b0044a365A5532aeC6Fa31', - tokenDecimals: 18, - tokenDescriptionUrl: '#', - earnedToken: 'magikfarmMSHARE-FTM', - earnedTokenAddress: '0x0421D1E6F9728Da90a39c579F4b151198Df43DfB', - earnContractAddress: '0x0421D1E6F9728Da90a39c579F4b151198Df43DfB', - pricePerFullShare: 1, - tvl: 0, - oracle: 'lps', - oracleId: 'spirit-ftm-mshare', - oraclePrice: 0, - depositsPaused: false, - partnership: true, - isMooStaked: true, - status: 'active', - platform: 'SpiritSwap', - assets: ['MSHARE', 'FTM'], - risks: [ - 'COMPLEXITY_LOW', - 'BATTLE_TESTED', - 'IL_LOW', - 'AUDIT', - 'CONTRACTS_VERIFIED', - ], - stratType: 'StratLP', - addLiquidityUrl: - 'https://swap.spiritswap.finance/#/add/FTM/0xC8Ca9026Ad0882133Ef126824F6852567c571A4E', - buyTokenUrl: - 'https://swap.spiritswap.finance/#/exchange/swap/FTM/0xc8ca9026ad0882133ef126824f6852567c571a4e', - }, - { - id: 'spirit-mshare-magik', - name: 'MSHARE-MAGIK LP', - token: 'MSHARE-MAGIK LP', - tokenDescription: 'Magik.Finance - MSHARE-MAGIK LP', - tokenAddress: '0x4d6b28441c8B293A603243431E6E31F3C2632ddD', - tokenDecimals: 18, - tokenDescriptionUrl: '#', - earnedToken: 'magikfarmMSHARE-MAGIK', - earnedTokenAddress: '0xc948Da8Eae9F65D7B6fD03658f1488a619DBB757', - earnContractAddress: '0xc948Da8Eae9F65D7B6fD03658f1488a619DBB757', - pricePerFullShare: 1, - tvl: 0, - oracle: 'lps', - oracleId: 'spirit-mshare-magik', - oraclePrice: 0, - depositsPaused: false, - partnership: true, - isMooStaked: true, - status: 'active', - platform: 'SpiritSwap', - assets: ['MSHARE', 'MAGIK'], - risks: [ - 'COMPLEXITY_LOW', - 'BATTLE_TESTED', - 'IL_LOW', - 'AUDIT', - 'CONTRACTS_VERIFIED', - ], - stratType: 'StratLP', - addLiquidityUrl: - 'https://swap.spiritswap.finance/#/add/0x87a5C9B60A3aaf1064006FE64285018e50e0d020/0xC8Ca9026Ad0882133Ef126824F6852567c571A4E', - buyTokenUrl: - 'https://swap.spiritswap.finance/#/exchange/swap/MAGIK/0xC8Ca9026Ad0882133Ef126824F6852567c571A4E', - }, - { - id: 'wigo-wigo-ftm', - name: 'WIGO - FTM LP🔥', - token: 'WIGO - FTM LP🔥', - tokenDescription: 'wigoswap.io - WIGO-FTM AC Auto Burn Vault 🔥', - tokenAddress: '0xB66E5c89EbA830B31B3dDcc468dD50b3256737c5', - tokenDecimals: 18, - tokenDescriptionUrl: '#', - earnedToken: 'MagikFarm - WIGO - FTM', - earnedTokenAddress: '0x2A1c568D0735a18b562CF2a1bfF06f228f960662', - earnContractAddress: '0x2A1c568D0735a18b562CF2a1bfF06f228f960662', - pricePerFullShare: 1, - tvl: 0, - oracle: 'lps', - oracleId: 'wigo-wigo-ftm', - oraclePrice: 0, - depositsPaused: false, - partnership: true, - isMooStaked: true, - status: 'active', - platform: 'WigoSwap', - assets: ['WIGO', 'FTM'], - risks: [ - 'COMPLEXITY_LOW', - 'BATTLE_TESTED', - 'IL_LOW', - 'AUDIT', - 'CONTRACTS_VERIFIED', - ], - stratType: 'StratLP', - addLiquidityUrl: - 'https://wigoswap.io/add/FTM/0xE992bEAb6659BFF447893641A378FbbF031C5bD6', - buyTokenUrl: - 'https://wigoswap.io/swap?outputCurrency=0xE992bEAb6659BFF447893641A378FbbF031C5bD6', - }, - { - id: 'wigo-usdc-wigo', - name: 'WIGO - USDC LP🔥', - token: 'WIGO - USDC LP🔥', - tokenDescription: 'wigoswap.io - WIGO-USDC AC Auto Burn Vault 🔥', - tokenAddress: '0x96bDF4d9fb8dB9FcD1E0CA146faBD891f2F1A96d', - tokenDecimals: 18, - tokenDescriptionUrl: '#', - earnedToken: 'MagikFarm - WIGO-USDC LP', - earnedTokenAddress: '0x4926395f7E6F965B2c2e935A2B8bF17f42f45E4c', - earnContractAddress: '0x4926395f7E6F965B2c2e935A2B8bF17f42f45E4c', - pricePerFullShare: 1, - tvl: 0, - oracle: 'lps', - oracleId: 'wigo-usdc-wigo', - oraclePrice: 0, - depositsPaused: false, - partnership: true, - isMooStaked: true, - status: 'active', - platform: 'WigoSwap', - assets: ['WIGO', 'USDC'], - risks: [ - 'COMPLEXITY_LOW', - 'BATTLE_TESTED', - 'IL_LOW', - 'AUDIT', - 'CONTRACTS_VERIFIED', - ], - stratType: 'StratLP', - addLiquidityUrl: - 'https://wigoswap.io/add/0x04068DA6C83AFCFA0e13ba15A6696662335D5B75/0xE992bEAb6659BFF447893641A378FbbF031C5bD6', - buyTokenUrl: - 'https://wigoswap.io/swap?inputCurrency=0x04068DA6C83AFCFA0e13ba15A6696662335D5B75&outputCurrency=0xE992bEAb6659BFF447893641A378FbbF031C5bD6', - }, - // { - // id: 'spooky-wftm-bshare', - // name: 'BSHARE - FTM LP', - // token: 'BSHARE - FTM LP', - // tokenDescription: 'Basedfinance.io - BSHARE - FTM LP AC Vault', - // tokenAddress: '0x6F607443DC307DCBe570D0ecFf79d65838630B56', - // tokenDecimals: 18, - // tokenDescriptionUrl: '#', - // earnedToken: 'MAGIKfarm MAGIK-FTM', - // earnedTokenAddress: '0xe8cE63e37bB4B662837144058c298C4e7Fd0b93C', - // earnContractAddress: '0xe8cE63e37bB4B662837144058c298C4e7Fd0b93C', - // pricePerFullShare: 1, - // tvl: 0, - // oracle: 'lps', - // oracleId: 'spooky-wftm-bshare', - // oraclePrice: 0, - // depositsPaused: false, - // partnership: true, - // isMooStaked: true, - // status: 'active', - // platform: 'SpookySwap', - // assets: ['BASED', 'TOMB'], - // risks: ['COMPLEXITY_LOW', 'BATTLE_TESTED', 'IL_LOW', 'AUDIT', 'CONTRACTS_VERIFIED'], - // stratType: 'StratLP', - // addLiquidityUrl: - // 'https://swap.spiritswap.finance/#/add/FTM/0x87a5C9B60A3aaf1064006FE64285018e50e0d020', - // buyTokenUrl: - // 'https://swap.spiritswap.finance/#/exchange/swap/FTM/0x87a5c9b60a3aaf1064006fe64285018e50e0d020', - // }, - { - id: 'spooky-eth-serene', - name: 'Spooky - SRNv2-ETH LP', - token: 'SRNv2-ETH LP', - tokenDescription: - '1% WITHDRAWAL FEE - app.serenitycapital.io - SERENE-ETH LP - AC Vault', - tokenAddress: '0x25A5dd853220e5AF4407843f073a7a0A0e825b23', - tokenDecimals: 18, - tokenDescriptionUrl: '#', - earnedToken: 'MagikFarm-SP-SERENEV2-wETH', - earnedTokenAddress: '0x087D8b7196CF8C136BcceEF5AD17202f685174F5', - earnContractAddress: '0x087D8b7196CF8C136BcceEF5AD17202f685174F5', - pricePerFullShare: 1, - tvl: 0, - oracle: 'lps', - oracleId: 'spooky-eth-serene', - oraclePrice: 0, - depositsPaused: false, - partnership: true, - isMooStaked: true, - status: 'active', - platform: 'Spooky', - assets: ['SRN', 'WETH'], - risks: [ - 'COMPLEXITY_LOW', - 'BATTLE_TESTED', - 'IL_LOW', - 'AUDIT', - 'CONTRACTS_VERIFIED', - ], - stratType: 'StratLP', - addLiquidityUrl: - 'https://spooky.fi/#/add/0x74b23882a30290451A17c44f4F05243b6b58C76d/0x60d8D17D6b824E19f77eACcAf16ED7BA6FB209C2', - buyTokenUrl: - 'https://spooky.fi/#/swap?inputCurrency=0x74b23882a30290451A17c44f4F05243b6b58C76d&outputCurrency=0x60d8D17D6b824E19f77eACcAf16ED7BA6FB209C2', - }, - { - id: 'spooky-eth-pebble', - name: 'Spooky PEBBLE-ETH LP', - token: 'PEBBLE-ETH LP', - tokenDescription: - '1% WITHDRAWAL FEE - app.serenitycapital.io - PEBBLE-ETH LP - AC Vault', - tokenAddress: '0xc064a5d9Acba5741cFF44016B1fAA6207B21AEF6', - tokenDecimals: 18, - tokenDescriptionUrl: '#', - earnedToken: 'MagikFarm-SP-PBL-ETH', - earnedTokenAddress: '0x099Afa97546750Cb1e163EF6CEbD51657246722a', - earnContractAddress: '0x099Afa97546750Cb1e163EF6CEbD51657246722a', - pricePerFullShare: 1, - tvl: 0, - oracle: 'lps', - oracleId: 'spooky-eth-pebble', - oraclePrice: 0, - depositsPaused: false, - partnership: true, - isMooStaked: true, - status: 'active', - platform: 'Spooky', - assets: ['PBL', 'WETH'], - risks: [ - 'COMPLEXITY_LOW', - 'BATTLE_TESTED', - 'IL_LOW', - 'AUDIT', - 'CONTRACTS_VERIFIED', - ], - stratType: 'StratLP', - addLiquidityUrl: - 'https://spooky.fi/#/add/0x74b23882a30290451A17c44f4F05243b6b58C76d/0x9a2d0935E6CC558aaBa4EbD280F03A74b4752ADd', - buyTokenUrl: - 'https://spooky.fi/#/swap?inputCurrency=0x74b23882a30290451A17c44f4F05243b6b58C76d&outputCurrency=0x9a2d0935E6CC558aaBa4EbD280F03A74b4752ADd', - }, - { - id: 'spooky-degen', - logo: 'single-assets/DEGEN.png', - name: 'DEGEN🔥', - token: 'DEGEN🔥', - tokenDescription: 'degenfinance.us - Single Stake AC Auto Burn Vault🔥', - tokenAddress: '0xF61d81d623d9c4a45ff5766EDa5AF224c3dde1A5', - tokenDecimals: 18, - tokenDescriptionUrl: '#', - earnedToken: 'MagikFarm-DEGEN Single Stake', - earnedTokenAddress: '0x5EB2d9f494098e8B470d045AF3bbE0c7F6ec8f41', - earnContractAddress: '0x5EB2d9f494098e8B470d045AF3bbE0c7F6ec8f41', - pricePerFullShare: 1, - tvl: 0, - oracle: 'tokens', - oracleId: 'DEGEN', - oraclePrice: 0, - depositsPaused: false, - status: 'active', - platform: 'SpookySwap', - assets: ['DEGEN'], - risks: [ - 'COMPLEXITY_LOW', - 'BATTLE_TESTED', - 'IL_NONE', - 'MCAP_MICRO', - 'AUDIT', - 'CONTRACTS_VERIFIED', - ], - stratType: 'SingleStake', - buyTokenUrl: - 'https://spookyswap.finance/swap?outputCurrency=0xF61d81d623d9c4a45ff5766EDa5AF224c3dde1A5&inputCurrency=0x6c021Ae822BEa943b2E66552bDe1D2696a53fbB7', - }, - { - id: 'spooky-tomb-degen', - name: 'DEGEN - TOMB LP 🔥', - token: 'DEGEN - TOMB LP 🔥', - tokenDescription: 'degenfinance.us - DEGEN-TOMB LP - AC Auto Burn Vault', - tokenAddress: '0xF6b99c9B6E6bDbFd1B2De21F908189b49F43B9E3', - tokenDecimals: 18, - tokenDescriptionUrl: '#', - earnedToken: 'MagikFarm-DEGEN-TOMB', - earnedTokenAddress: '0xFF33a6d82436ACe973c2636822CeCd27e846b4C9', - earnContractAddress: '0xFF33a6d82436ACe973c2636822CeCd27e846b4C9', - pricePerFullShare: 1, - tvl: 0, - oracle: 'lps', - oracleId: 'spooky-tomb-degen', - oraclePrice: 0, - depositsPaused: false, - partnership: true, - isMooStaked: true, - status: 'active', - platform: 'SpookySwap', - assets: ['DEGEN', 'TOMB'], - risks: [ - 'COMPLEXITY_LOW', - 'BATTLE_TESTED', - 'IL_LOW', - '5AUDIT', - 'CONTRACTS_VERIFIED', - ], - stratType: 'StratLP', - addLiquidityUrl: - 'https://spookyswap.finance/add/0x6c021ae822bea943b2e66552bde1d2696a53fbb7/0xF61d81d623d9c4a45ff5766EDa5AF224c3dde1A5', - buyTokenUrl: - 'https://spookyswap.finance/swap?outputCurrency=0xF61d81d623d9c4a45ff5766EDa5AF224c3dde1A5&inputCurrency=0x6c021Ae822BEa943b2E66552bDe1D2696a53fbB7', - }, - { - id: 'spooky-tomb-dshare', - name: 'DSHARE - USDC LP', - token: 'DSHARE - USDC LP', - tokenDescription: 'degenfinance.us - DSHARE - USDC LP - AC Vault', - tokenAddress: '0x1b622bB79d25f67e90BD189B5d116e0923Eb4ECB', - tokenDecimals: 18, - tokenDescriptionUrl: '#', - earnedToken: 'MagikFarm-DSHARE-USDC', - earnedTokenAddress: '0xB7C08E0Ca354657B50E923A1408fD2b7635CA638', - earnContractAddress: '0xB7C08E0Ca354657B50E923A1408fD2b7635CA638', - pricePerFullShare: 1, - tvl: 0, - oracle: 'lps', - oracleId: 'spooky-tomb-dshare', - oraclePrice: 0, - depositsPaused: false, - partnership: true, - isMooStaked: true, - status: 'active', - platform: 'SpookySwap', - assets: ['DSHARE', 'USDC'], - risks: [ - 'COMPLEXITY_LOW', - 'BATTLE_TESTED', - 'IL_LOW', - '5AUDIT', - 'CONTRACTS_VERIFIED', - ], - stratType: 'StratLP', - addLiquidityUrl: - 'https://spookyswap.finance/add/0x04068DA6C83AFCFA0e13ba15A6696662335D5B75/0x6E209329A33a63C463dbb65AE2d6655Fe5C98411', - buyTokenUrl: - 'https://spookyswap.finance/swap?outputCurrency=0x6E209329A33a63C463dbb65AE2d6655Fe5C98411&inputCurrency=0x04068DA6C83AFCFA0e13ba15A6696662335D5B75', - }, - { - id: 'spooky-usdc-mshare', - name: 'MSHARE - USDC LP 🔥', - token: 'MSHARE - USDC LP 🔥', - tokenDescription: - 'app.mvfinance.club - MSHARE - USDC LP - AC Fee Share Vault 50%', - tokenAddress: '0x92A7b2A9ca7D70573E3a0B0BF9e5232c70db8a89', - tokenDecimals: 18, - tokenDescriptionUrl: '#', - earnedToken: 'MagikFarm-MVMSHARE-USDC', - earnedTokenAddress: '0xb9aC31D4AdA868EE8AF3b755D6b3c0d9DdFf2Ab9', - earnContractAddress: '0xb9aC31D4AdA868EE8AF3b755D6b3c0d9DdFf2Ab9', - pricePerFullShare: 1, - tvl: 0, - oracle: 'lps', - oracleId: 'spooky-usdc-mshare', - oraclePrice: 0, - depositsPaused: false, - partnership: true, - isMooStaked: true, - status: 'active', - platform: 'SpookySwap', - assets: ['MSHAREMV', 'USDC'], - risks: [ - 'COMPLEXITY_LOW', - 'BATTLE_TESTED', - 'IL_LOW', - '5AUDIT', - 'CONTRACTS_VERIFIED', - ], - stratType: 'StratLP', - addLiquidityUrl: - 'https://spookyswap.finance/add/0x04068da6c83afcfa0e13ba15a6696662335d5b75/0xb011EC534d9175cD7a69aFBfc1bcc9990862c462', - buyTokenUrl: - 'https://spookyswap.finance/swap?outputCurrency=0x04068da6c83afcfa0e13ba15a6696662335d5b75&inputCurrency=0xb011EC534d9175cD7a69aFBfc1bcc9990862c462', - }, - { - id: 'spooky-usdc-mvdollar', - name: 'MVDOLLAR-USDC🔥', - token: 'MVDOLLAR-USDC 🔥', - tokenDescription: - 'app.mvfinance.club - MVDOLLAR-USDC - AC Fee Share Vault 50%', - tokenAddress: '0x35bED1E2f3033395a05CD0b1b5900209ECe42774', - tokenDecimals: 18, - tokenDescriptionUrl: - '50% of performance rewards are sent back to the Miniverse Team', - earnedToken: 'MagikFarm-MVDOLLAR-USDC', - earnedTokenAddress: '0x8aA7cE2451D8ab2Ea4B090620ccb1fF67681d676', - earnContractAddress: '0x8aA7cE2451D8ab2Ea4B090620ccb1fF67681d676', - pricePerFullShare: 1, - tvl: 0, - oracle: 'lps', - oracleId: 'spooky-usdc-mvdollar', - oraclePrice: 0, - depositsPaused: false, - partnership: true, - isMooStaked: true, - status: 'active', - platform: 'SpookySwap', - assets: ['MVDOLLAR', 'USDC'], - risks: [ - 'COMPLEXITY_LOW', - 'BATTLE_TESTED', - 'IL_LOW', - '5AUDIT', - 'CONTRACTS_VERIFIED', - ], - stratType: 'StratLP', - addLiquidityUrl: - 'https://spookyswap.finance/add/0x04068da6c83afcfa0e13ba15a6696662335d5b75/0x57976c467608983513c9355238dc6de1B1aBbcCA', - buyTokenUrl: - 'https://spookyswap.finance/swap?outputCurrency=0x57976c467608983513c9355238dc6de1B1aBbcCA&inputCurrency=0x04068da6c83afcfa0e13ba15a6696662335d5b75', - }, - { - id: 'spooky-mvdollar', - logo: 'single-assets/MVDOLLAR.png', - name: 'MVDOLLAR', - token: 'MVDOLLAR', - tokenDescription: 'app.mvfinance.club - MVDOLLAR Single Stake - AC Vault', - tokenAddress: '0x57976c467608983513c9355238dc6de1B1aBbcCA', - tokenDecimals: 18, - tokenDescriptionUrl: '#', - earnedToken: 'MagikFarm-MVDOLLAR-Single Stake', - earnedTokenAddress: '0x5fa6B2c4A999331484a16C865BCA1aBdeD4CF922', - earnContractAddress: '0x5fa6B2c4A999331484a16C865BCA1aBdeD4CF922', - pricePerFullShare: 1, - tvl: 0, - oracle: 'tokens', - oracleId: 'MVDOLLAR', - oraclePrice: 0, - depositsPaused: false, - status: 'active', - platform: 'SpookySwap', - assets: ['MVDOLLAR'], - risks: [ - 'COMPLEXITY_LOW', - 'BATTLE_TESTED', - 'IL_NONE', - 'MCAP_MICRO', - 'AUDIT', - 'CONTRACTS_VERIFIED', - ], - stratType: 'SingleStake', - buyTokenUrl: - 'https://spookyswap.finance/swap?outputCurrency=0x57976c467608983513c9355238dc6de1B1aBbcCA&inputCurrency=0x04068da6c83afcfa0e13ba15a6696662335d5b75', - }, - { - id: 'spooky-ham', - logo: 'single-assets/HAM.png', - name: 'HAM', - token: 'HAM', - tokenDescription: 'Hamster.Money - HAM Single Stake', - tokenAddress: '0x20AC818b34A60117E12ffF5bE6AbbEF68BF32F6d', - tokenDecimals: 18, - tokenDescriptionUrl: '#', - earnedToken: 'MagikFarm-Ham-SingleStake', - earnedTokenAddress: '0xcF43b157D0B5654915B48F218bE2ee04e0b6a480', - earnContractAddress: '0xcF43b157D0B5654915B48F218bE2ee04e0b6a480', - pricePerFullShare: 1, - tvl: 0, - oracle: 'tokens', - oracleId: 'HAM', - oraclePrice: 0, - depositsPaused: false, - status: 'active', - platform: 'SpookySwap', - assets: ['HAM'], - risks: [ - 'COMPLEXITY_LOW', - 'BATTLE_TESTED', - 'IL_NONE', - 'MCAP_MICRO', - 'AUDIT', - 'CONTRACTS_VERIFIED', - ], - stratType: 'SingleStake', - buyTokenUrl: - 'https://spookyswap.finance/swap?outputCurrency=0x20ac818b34a60117e12fff5be6abbef68bf32f6d', - }, - { - id: 'red2omb-2omb-ftm', - name: 'RED 2OMB-FTM🔥', - token: 'RED 2OMB-FTM🔥', - tokenDescription: '2omb.finance Redemption.fi LP - AC Auto Burn Vault', - tokenAddress: '0x3B602C7Ed7F9318926Ffbf767E5dc838cA210085', - tokenDecimals: 18, - tokenDescriptionUrl: '#', - earnedToken: 'MagikFarm-Redemption-2omb-FTM ', - earnedTokenAddress: '0xe9f7F029dd4107f481A424552A4A8e04676D86A1', - earnContractAddress: '0xe9f7F029dd4107f481A424552A4A8e04676D86A1', - pricePerFullShare: 1, - tvl: 0, - oracle: 'lps', - oracleId: 'red2omb-2omb-ftm', - oraclePrice: 0, - retired: true, - depositsPaused: false, - partnership: true, - isMooStaked: true, - status: 'active', - platform: 'SpookySwap', - assets: ['2OMB', 'FTM'], - risks: [ - 'COMPLEXITY_LOW', - 'BATTLE_TESTED', - 'IL_LOW', - '5AUDIT', - 'CONTRACTS_VERIFIED', - ], - stratType: 'StratLP', - addLiquidityUrl: - 'https://app.redemption.fi/liquidity/forge/0x7a6e4E3CC2ac9924605DCa4bA31d1831c84b44aE/ETH', - buyTokenUrl: - 'https://app.redemption.fi/swap?outputCurrency=0x9b7F7E44904Bb61a9710685c938eA5f867Cb36b2', - }, - - { - id: '2omb-2omb-ftm', - name: 'Spooky 2OMB-FTM🔥', - token: 'Spooky 2OMB-FTM🔥', - tokenDescription: '2omb.finance Spooky LP - AC Auto Burn Vault', - tokenAddress: '0xbdC7DFb7B88183e87f003ca6B5a2F81202343478', - tokenDecimals: 18, - tokenDescriptionUrl: '#', - earnedToken: 'MagikFarm-Spooky-2omb-FTM', - earnedTokenAddress: '0xa64aBA2Ed2E6dDb861f901329420e04F6493DED4', - earnContractAddress: '0xa64aBA2Ed2E6dDb861f901329420e04F6493DED4', - pricePerFullShare: 1, - tvl: 0, - oracle: 'lps', - oracleId: '2omb-2omb-ftm', - oraclePrice: 0, - depositsPaused: true, - retireReason: 'rewards', - partnership: true, - isMooStaked: true, - status: 'eol', - platform: 'SpookySwap', - assets: ['2OMB', 'FTM'], - risks: [ - 'COMPLEXITY_LOW', - 'BATTLE_TESTED', - 'IL_LOW', - '5AUDIT', - 'CONTRACTS_VERIFIED', - ], - stratType: 'StratLP', - addLiquidityUrl: - 'https://spookyswap.finance/add/0x7a6e4E3CC2ac9924605DCa4bA31d1831c84b44aE/FTM', - buyTokenUrl: - 'https://spookyswap.finance/swap?outputCurrency=0x9b7F7E44904Bb61a9710685c938eA5f867Cb36b2', - }, - { - id: '3omb-3omb-ftm', - name: 'Spooky 3OMB-FTM🔥', - token: 'Spooky 3OMB-FTM🔥', - tokenDescription: '3omb.finance Spooky LP - AC Auto Burn Vault', - tokenAddress: '0x83A52eff2E9D112E9B022399A9fD22a9DB7d33Ae', - tokenDecimals: 18, - tokenDescriptionUrl: '#', - earnedToken: 'MagikFarm-Spooky-3omb-FTM', - earnedTokenAddress: '0xc16688FFB997a48cf1A1610213C8ADC698c7507E', - earnContractAddress: '0xc16688FFB997a48cf1A1610213C8ADC698c7507E', - pricePerFullShare: 1, - tvl: 0, - oracle: 'lps', - oracleId: '3omb-3omb-ftm', - oraclePrice: 0, - depositsPaused: true, - retireReason: 'rewards', - partnership: true, - isMooStaked: true, - status: 'eol', - platform: 'SpookySwap', - assets: ['3OMB', 'FTM'], - risks: [ - 'COMPLEXITY_LOW', - 'BATTLE_TESTED', - 'IL_LOW', - '5AUDIT', - 'CONTRACTS_VERIFIED', - ], - stratType: 'StratLP', - addLiquidityUrl: - 'https://spookyswap.finance/add/FTM/0x14DEf7584A6c52f470Ca4F4b9671056b22f4FfDE', - buyTokenUrl: - 'https://spookyswap.finance/swap?outputCurrency=0x14DEf7584A6c52f470Ca4F4b9671056b22f4FfDE', - }, - { - id: 'spooky-ftm-rubik', - name: 'RUBIK - FTM LP 🔥', - token: 'RUBIK - FTM LP 🔥', - tokenDescription: 'www.rubik.finance - Rubik-FTM LP - AC Auto Burn Vault', - tokenAddress: '0x9f4cbfa5B43252f3eD06f35C3f1A1D14C36bCeF0', - tokenDecimals: 18, - tokenDescriptionUrl: '#', - earnedToken: 'MagikFarm-Rubik-FTM', - earnedTokenAddress: '0x161e9639Ee21e04fd11f50EeC78B638CFfD521d0', - earnContractAddress: '0x161e9639Ee21e04fd11f50EeC78B638CFfD521d0', - pricePerFullShare: 1, - tvl: 0, - oracle: 'lps', - oracleId: 'spooky-ftm-rubik', - oraclePrice: 0, - depositsPaused: true, - retireReason: 'rewards', - partnership: true, - isMooStaked: true, - status: 'eol', - platform: 'SpookySwap', - assets: ['RUBIK', 'FTM'], - risks: [ - 'COMPLEXITY_LOW', - 'BATTLE_TESTED', - 'IL_LOW', - '5AUDIT', - 'CONTRACTS_VERIFIED', - ], - stratType: 'StratLP', - addLiquidityUrl: - 'https://spookyswap.finance/add/FTM/0xA4Db7f3b07c7Bf1b5E8283Bf9e8aA889569fc2e7', - buyTokenUrl: - 'https://spookyswap.finance/swap?outputCurrency=0xA4Db7f3b07c7Bf1b5E8283Bf9e8aA889569fc2e7', - }, - { - id: 'spooky-usdc-rebel', - name: 'REBEL - USDC 🔥', - token: 'REBEL - USDC 🔥', - tokenDescription: 'Ukrainefinance.app - AC Auto Burn Vault', - tokenAddress: '0x1B9a7855Ddf35cc6F5920D3fe6f4A4CA144Ce750', - tokenDecimals: 18, - tokenDescriptionUrl: '#', - earnedToken: 'MagikFarm-Spooky-Rebel-USDC ', - earnedTokenAddress: '0xe577DEF19D5D5cfdA3f15194Ab41A3240558736C', - earnContractAddress: '0xe577DEF19D5D5cfdA3f15194Ab41A3240558736C', - pricePerFullShare: 1, - tvl: 0, - oracle: 'lps', - oracleId: 'spooky-usdc-rebel', - oraclePrice: 0, - depositsPaused: true, - partnership: true, - isMooStaked: true, - status: 'active', - platform: 'SpookySwap', - assets: ['REBEL', 'USDC'], - risks: [ - 'COMPLEXITY_LOW', - 'BATTLE_TESTED', - 'IL_LOW', - '5AUDIT', - 'CONTRACTS_VERIFIED', - ], - stratType: 'StratLP', - addLiquidityUrl: - 'https://spookyswap.finance/add/0x04068DA6C83AFCFA0e13ba15A6696662335D5B75/0x13E2a52dbC151439B05D774F21e58c4D7E4cF3d7', - buyTokenUrl: - 'https://spookyswap.finance/swap?outputCurrency=0x13E2a52dbC151439B05D774F21e58c4D7E4cF3d7&inputCurrency=0x04068DA6C83AFCFA0e13ba15A6696662335D5B75', - }, - { - id: 'spooky-usdc-victory', - name: 'VICTORY - USDC', - token: 'VICTORY - USDC', - tokenDescription: 'Ukrainefinance.app - Victory - USDC LP', - tokenAddress: '0x5F7Dd4453cE143F8fB78494aC38aa07E41944204', - tokenDecimals: 18, - tokenDescriptionUrl: '#', - earnedToken: 'MagikFarm-Spooky-Victory-USDC ', - earnedTokenAddress: '0x6f93A9045499043A35c9707673772EAe1D611203', - earnContractAddress: '0x6f93A9045499043A35c9707673772EAe1D611203', - pricePerFullShare: 1, - tvl: 0, - oracle: 'lps', - oracleId: 'spooky-usdc-victory', - oraclePrice: 0, - depositsPaused: true, - partnership: true, - isMooStaked: true, - status: 'active', - platform: 'SpookySwap', - assets: ['VICTORY', 'USDC'], - risks: [ - 'COMPLEXITY_LOW', - 'BATTLE_TESTED', - 'IL_LOW', - '5AUDIT', - 'CONTRACTS_VERIFIED', - ], - stratType: 'StratLP', - addLiquidityUrl: - 'https://spookyswap.finance/swap?outputCurrency=0xaA50aD0cD648c64D195c84e3ca0c70124F091995&inputCurrency=0x04068DA6C83AFCFA0e13ba15A6696662335D5B75', - buyTokenUrl: - 'https://spookyswap.finance/add/0x04068DA6C83AFCFA0e13ba15A6696662335D5B75/0xaA50aD0cD648c64D195c84e3ca0c70124F091995', - }, - { - id: 'spooky-tomb-based', - name: 'BASED - TOMB LP🔥', - token: 'BASED - TOMB LP🔥', - tokenDescription: 'Basedfinance.io - BASED - TOMB LP AC Auto Burn Vault 🔥', - tokenAddress: '0xaB2ddCBB346327bBDF97120b0dD5eE172a9c8f9E', - tokenDecimals: 18, - tokenDescriptionUrl: '#', - earnedToken: 'MAGIKfarm BASED-TOMB', - earnedTokenAddress: '0xb9ed35590c0A7eb94C32241884ebf2FbBdd48A00', - earnContractAddress: '0xb9ed35590c0A7eb94C32241884ebf2FbBdd48A00', - pricePerFullShare: 1, - tvl: 0, - oracle: 'lps', - oracleId: 'spooky-tomb-based', - oraclePrice: 0, - depositsPaused: true, - partnership: true, - isMooStaked: true, - status: 'active', - platform: 'SpookySwap', - assets: ['BASED', 'TOMB'], - risks: [ - 'COMPLEXITY_LOW', - 'BATTLE_TESTED', - 'IL_LOW', - 'AUDIT', - 'CONTRACTS_VERIFIED', - ], - stratType: 'StratLP', - addLiquidityUrl: - 'https://spooky.fi/#/add/0x8D7d3409881b51466B483B11Ea1B8A03cdEd89ae/0x6c021Ae822BEa943b2E66552bDe1D2696a53fbB7', - buyTokenUrl: - 'https://spooky.fi/#/swap?outputCurrency=0x8D7d3409881b51466B483B11Ea1B8A03cdEd89ae&inputCurrency=0x6c021Ae822BEa943b2E66552bDe1D2696a53fbB7', - }, - { - id: 'spooky-ftm-ham', - name: 'HAM-FTM-LP', - token: 'HAM-FTM-LP', - tokenDescription: 'Hamster.Money - Burn AC Vault', - tokenAddress: '0x8D1963111AA50a9ae9F8ab5006C204cc46bbF4eD', - tokenDecimals: 18, - tokenDescriptionUrl: '#', - earnedToken: 'MagikFarm-HAM-FTM-LP', - earnedTokenAddress: '0x6C3F19d7148a8d56134FBEa1E5F61fbE23FD46Ac', - earnContractAddress: '0x6C3F19d7148a8d56134FBEa1E5F61fbE23FD46Ac', - pricePerFullShare: 1, - tvl: 0, - oracle: 'lps', - oracleId: 'spooky-ftm-ham', - oraclePrice: 0, - depositsPaused: true, - partnership: true, - isMooStaked: true, - status: 'active', - platform: 'SpookySwap', - assets: ['HAM', 'FTM'], - risks: [ - 'COMPLEXITY_LOW', - 'BATTLE_TESTED', - 'IL_LOW', - '5AUDIT', - 'CONTRACTS_VERIFIED', - ], - stratType: 'StratLP', - addLiquidityUrl: - 'https://spookyswap.finance/add/FTM/0x20AC818b34A60117E12ffF5bE6AbbEF68BF32F6d', - buyTokenUrl: - 'https://spookyswap.finance/swap?outputCurrency=0x20ac818b34a60117e12fff5be6abbef68bf32f6d', - }, - { - id: 'spooky-eagle-freedom', - name: 'FREEDOM - EAGLE LP', - token: 'FREEDOM - EAGLE LP', - tokenDescription: 'murica-money.com - FREEDOM-EAGLE LP - AC Vault', - tokenAddress: '0x695f878265da7D730C9df80Ee55131229A39AbBD', - tokenDecimals: 18, - tokenDescriptionUrl: '#', - earnedToken: 'MagikFarm-FREEDOM-EAGLE-LP', - earnedTokenAddress: '0x8931d9C8Ef9E9a414F11a6a0b69f08ADE5E1Ae7a', - earnContractAddress: '0x8931d9C8Ef9E9a414F11a6a0b69f08ADE5E1Ae7a', - pricePerFullShare: 1, - tvl: 0, - oracle: 'lps', - oracleId: 'spooky-eagle-freedom', - oraclePrice: 0, - depositsPaused: true, - partnership: true, - isMooStaked: true, - status: 'active', - platform: 'SpookySwap', - assets: ['EAGLE', 'FREEDOM'], - risks: [ - 'COMPLEXITY_LOW', - 'BATTLE_TESTED', - 'IL_LOW', - '5AUDIT', - 'CONTRACTS_VERIFIED', - ], - stratType: 'StratLP', - addLiquidityUrl: - 'https://spookyswap.finance/add/0xeb3bA75334A58cB80C45dfBb551f03A5FdE452E6/0x19F72Ffe6f5388523FDc30d785eF79E8132cfFF8', - buyTokenUrl: - 'https://spookyswap.finance/swap?outputCurrency=0xeb3bA75334A58cB80C45dfBb551f03A5FdE452E6&inputCurrency=0x19F72Ffe6f5388523FDc30d785eF79E8132cfFF8', - }, - { - id: 'spooky-usdc-eagle', - name: 'EAGLE - USDC LP', - token: 'EAGLE - USDC LP', - tokenDescription: - 'murica-money.com - EAGLE-USDC LP - AC Fee Share Vault 50%', - tokenAddress: '0x38c1aff09b3d759eddac307cc1f74b55ed54177d', - tokenDecimals: 18, - tokenDescriptionUrl: '#', - earnedToken: 'MagikFarm-EAGLE-USDC', - earnedTokenAddress: '0x0A592A4847Ad0a0d23051cBc5cbd4624483a735d', - earnContractAddress: '0x0A592A4847Ad0a0d23051cBc5cbd4624483a735d', - pricePerFullShare: 1, - tvl: 0, - oracle: 'lps', - oracleId: 'spooky-usdc-eagle', - oraclePrice: 0, - depositsPaused: true, - partnership: true, - isMooStaked: true, - status: 'active', - platform: 'SpookySwap', - assets: ['EAGLE', 'USDC'], - risks: [ - 'COMPLEXITY_LOW', - 'BATTLE_TESTED', - 'IL_LOW', - '5AUDIT', - 'CONTRACTS_VERIFIED', - ], - stratType: 'StratLP', - addLiquidityUrl: - 'https://spookyswap.finance/add/0x04068DA6C83AFCFA0e13ba15A6696662335D5B75/0xeb3bA75334A58cB80C45dfBb551f03A5FdE452E6', - buyTokenUrl: - 'https://spookyswap.finance/swap?outputCurrency=0xeb3bA75334A58cB80C45dfBb551f03A5FdE452E6&inputCurrency=0x04068DA6C83AFCFA0e13ba15A6696662335D5B75', - }, - { - id: 'spooky-ftm-honey', - name: 'HONEY - FTM LP 🔥', - token: 'HONEY - FTM LP 🔥', - tokenDescription: 'thehive.finance - Honey-FTM LP - AC Auto Burn Vault', - tokenAddress: '0x9aF30D7EFBbFC4cd46d6cf973FC1456d8BF6FBC7', - tokenDecimals: 18, - tokenDescriptionUrl: '#', - earnedToken: 'MagikFarm-Honey-FTM', - earnedTokenAddress: '0x86db64E1f16D1263302D552454E065B5F26BF557', - earnContractAddress: '0x86db64E1f16D1263302D552454E065B5F26BF557', - pricePerFullShare: 1, - tvl: 0, - oracle: 'lps', - oracleId: 'spooky-ftm-honey', - oraclePrice: 0, - depositsPaused: true, - partnership: true, - isMooStaked: true, - status: 'active', - platform: 'SpookySwap', - assets: ['HONEY', 'FTM'], - risks: [ - 'COMPLEXITY_LOW', - 'BATTLE_TESTED', - 'IL_LOW', - '5AUDIT', - 'CONTRACTS_VERIFIED', - ], - stratType: 'StratLP', - addLiquidityUrl: - 'https://spookyswap.finance/add/FTM/0x6E3c6B9f44A788026F83B8613B04FDa704C2b9A6', - buyTokenUrl: - 'https://spookyswap.finance/swap?outputCurrency=0x6E3c6B9f44A788026F83B8613B04FDa704C2b9A6', - }, - { - id: 'spooky-usdc-rarer', - name: 'RARER-USDC LP', - logo: 'single-assets/rare.png', - token: 'RARER-USDC LP', - tokenDescription: 'RARER-USDC', - tokenAddress: '0x1fe1b2c679Dcc7b4520b8F8A2E4716896523bc72', - tokenDecimals: 18, - tokenDescriptionUrl: '#', - earnedToken: 'magikfarmRARER-USDC', - earnedTokenAddress: '0x5263a8dB2b242350007B5E3319532186e052A91C', - earnContractAddress: '0x5263a8dB2b242350007B5E3319532186e052A91C', - pricePerFullShare: 1, - tvl: 0, - oracle: 'lps', - oracleId: 'spooky-usdc-rarer', - oraclePrice: 0, - depositsPaused: true, - partnership: true, - isMooStaked: true, - status: 'active', - platform: 'SpookySwap', - assets: ['USDC', 'RARER'], - risks: [ - 'COMPLEXITY_LOW', - 'BATTLE_TESTED', - 'IL_LOW', - 'AUDIT', - 'CONTRACTS_VERIFIED', - ], - stratType: 'StratLP', - addLiquidityUrl: - 'https://spookyswap.finance/add/0x1078864a3B0E5843995dE00517d871d0A686380b/0x04068DA6C83AFCFA0e13ba15A6696662335D5B75', - buyTokenUrl: - 'https://spookyswap.finance/swap?outputCurrency=0x1078864a3B0E5843995dE00517d871d0A686380b', - }, - { - id: 'spooky-rarer', - logo: 'single-assets/Rarer.png', - name: 'RARER', - token: 'RARER', - tokenDescription: 'RARER Single Stake - 0.5% DEPOSIT FEE', - tokenAddress: '0x1078864a3B0E5843995dE00517d871d0A686380b', - tokenDecimals: 18, - tokenDescriptionUrl: '#', - earnedToken: 'magikfarmRARER', - earnedTokenAddress: '0xcfc76902271A319370519715Fa485Afcac24AA28', - earnContractAddress: '0xcfc76902271A319370519715Fa485Afcac24AA28', - pricePerFullShare: 1, - tvl: 0, - oracle: 'tokens', - oracleId: 'RARER', - oraclePrice: 0, - depositsPaused: true, - status: 'active', - platform: 'SpookySwap', - assets: ['RARER'], - risks: [ - 'COMPLEXITY_LOW', - 'BATTLE_TESTED', - 'IL_NONE', - 'MCAP_MICRO', - 'AUDIT', - 'CONTRACTS_VERIFIED', - ], - stratType: 'SingleStake', - buyTokenUrl: - 'https://spookyswap.finance/swap?outputCurrency=0x1078864a3B0E5843995dE00517d871d0A686380b', - }, - // duplicate - // { - // id: 'spooky-ftm-ham', - // name: 'HAM-FTM-LP', - // token: 'HAM-FTM-LP', - // tokenDescription: 'Hamster.Money - Burn AC Vault', - // tokenAddress: '0x8D1963111AA50a9ae9F8ab5006C204cc46bbF4eD', - // tokenDecimals: 18, - // tokenDescriptionUrl: '#', - // earnedToken: 'MagikFarm-HAM-FTM-LP', - // earnedTokenAddress: '0x6C3F19d7148a8d56134FBEa1E5F61fbE23FD46Ac', - // earnContractAddress: '0x6C3F19d7148a8d56134FBEa1E5F61fbE23FD46Ac', - // pricePerFullShare: 1, - // tvl: 0, - // oracle: 'lps', - // oracleId: 'spooky-ftm-ham', - // oraclePrice: 0, - // depositsPaused: true, - // partnership: true, - // isMooStaked: true, - // status: 'active', - // platform: 'SpookySwap', - // assets: ['HAM', 'FTM'], - // risks: [ - // 'COMPLEXITY_LOW', - // 'BATTLE_TESTED', - // 'IL_LOW', - // '5AUDIT', - // 'CONTRACTS_VERIFIED', - // ], - // stratType: 'StratLP', - // addLiquidityUrl: - // 'https://spookyswap.finance/add/FTM/0x20AC818b34A60117E12ffF5bE6AbbEF68BF32F6d', - // buyTokenUrl: - // 'https://spookyswap.finance/swap?outputCurrency=0x20ac818b34a60117e12fff5be6abbef68bf32f6d', - // }, - { - id: 'tomb-tomb-ftm', - name: 'Spooky TOMB-FTM LP🔥', - token: 'Spooky TOMB-FTM LP🔥', - tokenDescription: 'Tomb.Finance - TOMB-FTM LP - AC Auto Burn Vault', - tokenAddress: '0x2A651563C9d3Af67aE0388a5c8F89b867038089e', - tokenDecimals: 18, - tokenDescriptionUrl: '#', - earnedToken: 'MagikFarm-Spooky-TOMB-FTM', - earnedTokenAddress: '0x0dA1DC567D81925cFf22Df74C6b9e294E9E1c3A5', - earnContractAddress: '0x0dA1DC567D81925cFf22Df74C6b9e294E9E1c3A5', - pricePerFullShare: 1, - tvl: 0, - oracle: 'lps', - oracleId: 'tomb-tomb-ftm', - oraclePrice: 0, - depositsPaused: true, - partnership: true, - isMooStaked: true, - status: 'active', - platform: 'Spookyswap', - assets: ['TOMB', 'FTM'], - risks: [ - 'COMPLEXITY_LOW', - 'BATTLE_TESTED', - 'IL_LOW', - 'AUDIT', - 'CONTRACTS_VERIFIED', - ], - stratType: 'StratLP', - addLiquidityUrl: - 'https://spookyswap.finance/add/FTM/0x6c021Ae822BEa943b2E66552bDe1D2696a53fbB7', - buyTokenUrl: - 'https://spookyswap.finance/swap?outputCurrency=0x6c021Ae822BEa943b2E66552bDe1D2696a53fbB7', - }, -]; -module.exports = fantomPools; diff --git a/projects/magik-farm/config/vault/harmony_pools.js b/projects/magik-farm/config/vault/harmony_pools.js deleted file mode 100644 index 2af9271c279..00000000000 --- a/projects/magik-farm/config/vault/harmony_pools.js +++ /dev/null @@ -1,2 +0,0 @@ -const harmonyPools = []; -module.exports = harmonyPools; diff --git a/projects/magik-farm/config/vault/heco_pools.js b/projects/magik-farm/config/vault/heco_pools.js deleted file mode 100644 index e1e1240fa7b..00000000000 --- a/projects/magik-farm/config/vault/heco_pools.js +++ /dev/null @@ -1,2 +0,0 @@ -const hecoPools = []; -module.exports = hecoPools; diff --git a/projects/magik-farm/config/vault/moonriver_pools.js b/projects/magik-farm/config/vault/moonriver_pools.js deleted file mode 100644 index d92a8288a21..00000000000 --- a/projects/magik-farm/config/vault/moonriver_pools.js +++ /dev/null @@ -1,2 +0,0 @@ -const moonriverPools = []; -module.exports = moonriverPools; diff --git a/projects/magik-farm/config/vault/polygon_pools.js b/projects/magik-farm/config/vault/polygon_pools.js deleted file mode 100644 index a58c980cc46..00000000000 --- a/projects/magik-farm/config/vault/polygon_pools.js +++ /dev/null @@ -1,2 +0,0 @@ -const polygonPools = []; -module.exports = polygonPools; diff --git a/projects/magik-farm/index.js b/projects/magik-farm/index.js index bdc808c440c..1b5ce7af9b0 100644 --- a/projects/magik-farm/index.js +++ b/projects/magik-farm/index.js @@ -1,217 +1,32 @@ -// Adding TVL from magik.farm -// 1. Loop through the pools in ./config/vault -// 1a. *_pools.js files need to be updated when new pools are created -// 2. Exclude staking and pool2 vaults from the tvl (in fantom) -// 3. Aggregate the tvl by each chain (defined in the networkMapping variable) -// calcaulte tvl for staking -// 1. Use getStakingPools() to get only the staking LPs -// 2. Aggregate the tvl for each chain (only fantom for now) -// calcaulte tvl for pool2 -// 1. Use getPool2() to get only the pool2 Lps -// 2. Aggregate the tvl for each chain (only fantom for now) - -const utils = require("../helper/utils"); -const sdk = require("@defillama/sdk"); -const { toUSDTBalances } = require("../helper/balances"); - -const magik = "0x87a5c9b60a3aaf1064006fe64285018e50e0d020"; -const mshare = "0xc8ca9026ad0882133ef126824f6852567c571a4e"; -const pool2LPs = [ - "0xDc71A6160322ad78DaB0abb47C7A581cFE9709Ee", //magik-ftm spirit LP - "0x392C85cECcf9855986b0044a365A5532aeC6Fa31", //mshare-ftm spirit LP - "0x4d6b28441c8B293A603243431E6E31F3C2632ddD", //mshare-ftm spirit LP -]; -const magikConfig = require("./config"); -const networkMapping = { - 10: { - name: "optimism", - multiCallChainName: "optimism", - pools: magikConfig.arbitrumPools, - }, - 43114: { - name: "avalanche", - multiCallChainName: "avax", - pools: magikConfig.avalanchePools, - }, - 1666600000: { - name: "harmony", - multiCallChainName: "harmony", - pools: magikConfig.harmonyPools, - }, - 42220: { - name: "celo", - multiCallChainName: "celo", - pools: magikConfig.celoPools, - }, - 42161: { - name: "arbitrum", - multiCallChainName: "arbitrum", - pools: magikConfig.arbitrumPools, - }, - 1285: { - name: "moonriver", - multiCallChainName: "moonriver", - pools: magikConfig.moonriverPools, - }, - 1088: { - name: "metis", - multiCallChainName: "metis", - pools: [], - }, - 250: { - name: "fantom", - multiCallChainName: "fantom", - pools: magikConfig.fantomPools, - }, - 137: { - name: "polygon", - multiCallChainName: "polygon", - pools: magikConfig.polygonPools, - }, - 128: { - name: "heco", - multiCallChainName: "heco", - pools: magikConfig.hecoPools, - }, - 122: { - name: "fuse", - multiCallChainName: "fuse", - pools: [], - }, - 56: { - name: "binance", - multiCallChainName: "bsc", - pools: magikConfig.bscPools, - }, - 25: { - name: "cronos", - multiCallChainName: "cronos", - pools: magikConfig.cronosPools, - }, - 1313161554: { - name: "aurora", - multiCallChainName: "aurora", - pools: magikConfig.auroraPools, - }, -}; -const balanceAbi = "uint256:balance" - -// Time-based cache buster -const getApiCacheBuster = () => { - return Math.trunc(Date.now() / (1000 * 60)); -}; -const urlLpPrices = "https://magikfarm.herokuapp.com/lps"; -const urlTokenPrices = "https://magikfarm.herokuapp.com/prices"; - -function removeStakingPools(pools) { - return pools.filter((pool) => { - return pool.tokenAddress.toLowerCase() != magik.toLowerCase(); - }); -} - -function getStakingPools(pools) { - return pools.filter((pool) => { - return pool.tokenAddress.toLowerCase() == magik.toLowerCase(); - }); -} - -function removePool2(pools) { - // normalize address to lowercase for comparison - const pool2LpLower = pool2LPs.map((pool) => { - return pool.toLowerCase(); - }); - return pools.filter((pool) => { - return pool2LpLower.indexOf(pool.tokenAddress.toLowerCase()) === -1; - }); -} - -function getPool2(pools) { - // normalize address to lowercase for comparison - const pool2LpLower = pool2LPs.map((pool) => { - return pool.toLowerCase(); - }); - return pools.filter((pool) => { - return pool2LpLower.indexOf(pool.tokenAddress.toLowerCase()) > -1; - }); +const { getConfig } = require('../helper/cache') + +const { sumTokens2 } = require("../helper/unwrapLPs"); + +const config = { + aurora: 'aurora', + arbitrum: 'arbitrum', + avax: 'avalanche', + bsc: 'bsc', + celo: 'celo', + cronos: 'cronos', + dogechain: 'doge', + fantom: 'fantom', + polygon: 'polygon', + harmony: 'harmony', + heco: 'heco', + moonriver: 'moonriver', } -function removeStakingAndPool2(pools) { - pools = removeStakingPools(pools); - pools = removePool2(pools); - return pools; -} - -function fetchChain(chain, pools) { - return async () => { - let chainTvl = 0; - const queryParams = `_=${getApiCacheBuster()}`; - const lpUrl = `${urlLpPrices}?${queryParams}`; - const tokenPriceUrl = `${urlTokenPrices}?${queryParams}`; - const lpPriceResults = await utils.fetchURL(lpUrl); - const tokenPriceResults = await utils.fetchURL(tokenPriceUrl); - const lpPriceData = lpPriceResults.data; - const tokenPriceData = tokenPriceResults.data; - if (pools.length > 0) { - const vaultCalls = pools.map((pool) => { - return { - target: pool.earnedTokenAddress, - }; - }); - const vaultResult = await sdk.api.abi.multiCall({ - abi: balanceAbi, - calls: vaultCalls, - chain: chain.multiCallChainName.toLowerCase(), - }); - for (let i = 0; i < pools.length; i++) { - const pool = pools[i]; - let price = null; - switch (pool.stratType) { - case "StratLP": - price = lpPriceData[pool.oracleId]; - break; - case "SingleStake": - price = tokenPriceData[pool.oracleId]; - } - const tokenDecimals = pool.tokenDecimals; - const balance = Number(vaultResult.output[i].output); - if (!isNaN(price) && !isNaN(tokenDecimals) && !isNaN(balance)) { - chainTvl += (balance / Math.pow(10, tokenDecimals)) * price; - } - } +Object.keys(config).forEach(chain => { + const key = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const data = await getConfig('magik-farm/'+chain, `https://raw.githubusercontent.com/magikfinance/magik-farm-fe-master/main/src/features/configure/vault/${key}_pools.js`) + const vaults = data.split('\n').filter(line => line.includes('earnedTokenAddress')).map(line => line.split(':')[1].trim().replace(/['",]/g, '')) + const tokens = await api.multiCall({ calls: vaults, abi: 'address:want'}) + const bals = await api.multiCall({ calls: vaults, abi: 'uint256:balance'}) + api.addTokens(tokens, bals) + return sumTokens2({ api, resolveLP: true, }) } - return toUSDTBalances(chainTvl); - }; -} - -module.exports = { - misrepresentedTokens: true, - ...Object.fromEntries( - Object.keys(networkMapping) - .filter((chainId) => { - const chain = networkMapping[chainId]; - const pools = chain.pools && chain.pools.length > 0 ? chain.pools : 0; - return pools.length > 0; - }) - .map((chainId) => { - const chain = networkMapping[chainId]; - let pools = chain.pools && chain.pools.length > 0 ? chain.pools : 0; - const stakingPools = getStakingPools(pools); - const pool2 = getPool2(pools); - // if current chain has staking or pool2 pools separate them out - if (stakingPools.length > 0 || pool2.length > 0) { - // remove pool2 and staking pools - const removedPools = removeStakingAndPool2(pools); - return [ - chain.multiCallChainName, - { - tvl: fetchChain(chain, removedPools), - staking: fetchChain(chain, stakingPools), - pool2: fetchChain(chain, pool2), - }, - ]; - } else { - return [chain.multiCallChainName, { tvl: fetchChain(chain, pools) }]; - } - }) - ), -}; + } +}) From d6624397112e74eed41c785c14487915888fdf1d Mon Sep 17 00:00:00 2001 From: define Date: Sun, 15 Oct 2023 10:00:02 +0100 Subject: [PATCH 1552/1974] add tomo adapter --- projects/tomo/index.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 projects/tomo/index.js diff --git a/projects/tomo/index.js b/projects/tomo/index.js new file mode 100644 index 00000000000..1de9ad231c2 --- /dev/null +++ b/projects/tomo/index.js @@ -0,0 +1,14 @@ +const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') + +const contract = "0x9e813d7661d7b56cbcd3f73e958039b208925ef8" + +async function tvl(time, ethBlock, _b, {api}) { + return sumTokens2({ tokens: [nullAddress], owner: contract, api }) +} + +module.exports = { + methodology: `We count the ETH on ${contract}`, + linea: { + tvl + } +} From 6871af0f868183688b7e5962412b7984605d36e7 Mon Sep 17 00:00:00 2001 From: define Date: Sun, 15 Oct 2023 10:14:49 +0100 Subject: [PATCH 1553/1974] add hallmark to tangible rwa --- projects/tangible/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/tangible/index.js b/projects/tangible/index.js index 36d8e6e443b..fda475bbc4e 100644 --- a/projects/tangible/index.js +++ b/projects/tangible/index.js @@ -187,6 +187,9 @@ async function tangiblePOL(api) { } module.exports = { + hallmarks: [ + [1697032800,"USDR Depeg"] + ], misrepresentedTokens: true, polygon: { tvl, }, ethereum: { tvl: sumTokensExport(insuranceConfig.ethereum) }, From ed963ce63143e8ab96f9a8f840e4cd30f1a7b53d Mon Sep 17 00:00:00 2001 From: Doc Weird <56837920+realdocweird@users.noreply.github.com> Date: Mon, 16 Oct 2023 02:21:38 +0200 Subject: [PATCH 1554/1974] KeySea TVL (#7715) * KeySea TVL * error fix --- projects/keysea/index.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 projects/keysea/index.js diff --git a/projects/keysea/index.js b/projects/keysea/index.js new file mode 100644 index 00000000000..0ae342c591a --- /dev/null +++ b/projects/keysea/index.js @@ -0,0 +1,14 @@ +const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') + +const KEYSEA_V1_CONTRACT = "0x28C0C1b47021C9d7BBD26c83eEa448F377F9600a" + +async function tvl(time, ethBlock, _b, { api }) { + return sumTokens2({ tokens: [nullAddress], owner: KEYSEA_V1_CONTRACT, api }) +} + +module.exports = { + methodology: `We count the ETH on ${KEYSEA_V1_CONTRACT}`, + linea: { + tvl + } +} \ No newline at end of file From 5b7ea84499be13b3112f5b24b4e8da62c0f63d5c Mon Sep 17 00:00:00 2001 From: llama Date: Mon, 16 Oct 2023 08:09:29 +0200 Subject: [PATCH 1555/1974] track metalend.tech --- projects/helper/tokenMapping.js | 3 +++ projects/metalend/index.js | 5 +++++ 2 files changed, 8 insertions(+) create mode 100644 projects/metalend/index.js diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 9f8e0e2d70f..f4664b9a76b 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -35,6 +35,9 @@ const transformTokens = { // "0x065de42e28e42d90c2052a1b49e7f83806af0e1f": "0x123", // CRK token is mispriced // [ADDRESSES.cronos.TUSD]: ADDRESSES.ethereum.TUSD, // }, + ronin: { + [ADDRESSES.null]: 'ronin:'+ADDRESSES.ronin.WRON, + } } const ibcMappings = { // Sample Code diff --git a/projects/metalend/index.js b/projects/metalend/index.js new file mode 100644 index 00000000000..2bdb8f0f78c --- /dev/null +++ b/projects/metalend/index.js @@ -0,0 +1,5 @@ +const { compoundExports2 } = require("../helper/compound"); + +module.exports = { + ronin: compoundExports2({ comptroller: '0x9E8FD99Fc64Cd2fF4B5846361a7eC457f2b3808e',}) +}; From 3bdc60300fc85bfb800bf9960f4d59d6160eb8b2 Mon Sep 17 00:00:00 2001 From: Dimas Date: Mon, 16 Oct 2023 15:13:23 +0700 Subject: [PATCH 1556/1974] Factor leverage vault (#7716) * feat(projects/factorDAO): add vault-genesis * feat(projects/factorDAO): single vault * feat(projects/factorDAO): add leverage vault * chore(projects/factorDAO): tidying up * docs(projects/factorDAO): add methodology * update leverage vault comment * move factor leverage vault to new project * delete factorDAO * fix tvl * remove line * add eslint disable * code refactor --------- Co-authored-by: llama --- projects/factor-leverage-vault/index.js | 27 +++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 projects/factor-leverage-vault/index.js diff --git a/projects/factor-leverage-vault/index.js b/projects/factor-leverage-vault/index.js new file mode 100644 index 00000000000..bab720decad --- /dev/null +++ b/projects/factor-leverage-vault/index.js @@ -0,0 +1,27 @@ +const { blockQuery } = require('../helper/http') + +const queryBlock = `query data($block: Int){ + leverageVaultPoolTokenStates(where: { balanceRaw_gt: 0} block: { number: $block }) { + id type underlyingAssetAddress balanceRaw + } +}` + +const SUBGRAPH_URL = + "https://api.thegraph.com/subgraphs/name/dimasriat/factor-leverage-vault"; + +async function tvl(timestamp, ethBlock, chainBlocks, { api }) { + const { leverageVaultPoolTokenStates } = await blockQuery(SUBGRAPH_URL, queryBlock, { api }) + + for (let poolTokenState of leverageVaultPoolTokenStates) { + let { underlyingAssetAddress, balanceRaw } = poolTokenState; + if (poolTokenState.type === 'debt') balanceRaw *= -1 + api.add(underlyingAssetAddress, balanceRaw) + } + + return api.getBalances() +} + +module.exports = { + doublecounted: true, + arbitrum: { tvl } +}; From c6779330c8f7f242d98eeb835be5932a87cd5270 Mon Sep 17 00:00:00 2001 From: LpcAries <101619245+LpcAries@users.noreply.github.com> Date: Mon, 16 Oct 2023 16:13:45 +0800 Subject: [PATCH 1557/1974] add scroll config (#7718) --- projects/izumi-iziswap/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/izumi-iziswap/index.js b/projects/izumi-iziswap/index.js index 903754311bd..b9409b11a85 100644 --- a/projects/izumi-iziswap/index.js +++ b/projects/izumi-iziswap/index.js @@ -24,6 +24,7 @@ const poolHelpers = { 'linea': ['0x1CB60033F61e4fc171c963f0d2d3F63Ece24319c'], 'kroma': ['0x110dE362cc436D7f54210f96b8C7652C2617887D'], 'manta': ['0x19b683A2F45012318d9B2aE1280d68d3eC54D663'], + 'scroll': ['0x1502d025BfA624469892289D45C0352997251728'], } // iziswap liquidityManager contracts const blacklistedTokens = [ From 3ef069b30215c2cc861af65a28c82a7905d93e47 Mon Sep 17 00:00:00 2001 From: define Date: Mon, 16 Oct 2023 13:42:21 +0100 Subject: [PATCH 1558/1974] add token support for moonbeam and moonriver --- projects/entities/arrington-xrp-capital.js | 21 ++++++++++ projects/entities/consensys.js | 38 ++++++++++++++++++ projects/entities/hashkey-capital.js | 46 ++++++++++++++++++++++ projects/entities/sequoia-capital.js | 10 +++++ projects/helper/cex.js | 10 +++++ 5 files changed, 125 insertions(+) create mode 100644 projects/entities/arrington-xrp-capital.js create mode 100644 projects/entities/consensys.js create mode 100644 projects/entities/hashkey-capital.js create mode 100644 projects/entities/sequoia-capital.js diff --git a/projects/entities/arrington-xrp-capital.js b/projects/entities/arrington-xrp-capital.js new file mode 100644 index 00000000000..0678269f95b --- /dev/null +++ b/projects/entities/arrington-xrp-capital.js @@ -0,0 +1,21 @@ +const { treasuryExports } = require("../helper/treasury") + +const config = { + ethereum: { + owners: [ + "0x8767d65677cabad2050b764aef40610f2f9796f5", + "0xfa12342e6Dd367CC3884ca68EDfcC5e015bd68D1", + "0xaea97b739dcd6f5b586586cb7a538d60ba96a757", + "0x1f9e17D8C21b00d2BbdfE637C33db21c3B1F4E4e" + ], + tokens: ["0x29C827Ce49aCCF68A1a278C67C9D30c52fBbC348", "0xC36442b4a4522E871399CD717aBDD847Ab11FE88"], //sushi lp , univ3 position + resolveLP: true + }, + avax: { + owners: [ + "0x8767d65677cabad2050b764aef40610f2f9796f5", + "0x1f9e17D8C21b00d2BbdfE637C33db21c3B1F4E4e" + ], + }, +} +module.exports = treasuryExports(config) \ No newline at end of file diff --git a/projects/entities/consensys.js b/projects/entities/consensys.js new file mode 100644 index 00000000000..de3d260c6f0 --- /dev/null +++ b/projects/entities/consensys.js @@ -0,0 +1,38 @@ +const { treasuryExports } = require("../helper/treasury") + +const config = { + ethereum: { + owners: [ + "0xA8C6F6e2dFbDeDEDD157a5363D38d7d074d83985", + "0x5Bc5ec5130f66f13d5C21ac6811A7e624ED3C7c6", + "0x8962285fAac45a7CBc75380c484523Bb7c32d429" + ], + }, + avax: { + owners: [ + "0xA8C6F6e2dFbDeDEDD157a5363D38d7d074d83985", + ], + }, + optimism: { + owners: [ + "0xA8C6F6e2dFbDeDEDD157a5363D38d7d074d83985", + ], + }, + linea: { + owners: [ + "0x8962285fAac45a7CBc75380c484523Bb7c32d429", + ], + }, + era: { + owners: [ + "0x8962285fAac45a7CBc75380c484523Bb7c32d429", + ], + }, + polygon: { + owners: [ + "0x8962285fAac45a7CBc75380c484523Bb7c32d429", + ], + }, +} + +module.exports = treasuryExports(config) \ No newline at end of file diff --git a/projects/entities/hashkey-capital.js b/projects/entities/hashkey-capital.js new file mode 100644 index 00000000000..6acf543cb35 --- /dev/null +++ b/projects/entities/hashkey-capital.js @@ -0,0 +1,46 @@ +const { treasuryExports } = require("../helper/treasury") + +const config = { + ethereum: { + owners: [ + "0x760484042a7856E62B627318796Ebb609C8131a1", + ], + }, + moonbeam: { + owners: [ + "0x760484042a7856E62B627318796Ebb609C8131a1", + ], + }, + avax: { + owners: [ + "0x760484042a7856E62B627318796Ebb609C8131a1", + ], + }, + bsc: { + owners: [ + "0x760484042a7856E62B627318796Ebb609C8131a1", + ], + }, + polygon: { + owners: [ + "0x760484042a7856E62B627318796Ebb609C8131a1", + ], + }, + moonriver: { + owners: [ + "0x760484042a7856E62B627318796Ebb609C8131a1", + ], + }, + optimism: { + owners: [ + "0x760484042a7856E62B627318796Ebb609C8131a1", + ], + }, + arbitrum: { + owners: [ + "0x760484042a7856E62B627318796Ebb609C8131a1", + ], + }, +} + +module.exports = treasuryExports(config) \ No newline at end of file diff --git a/projects/entities/sequoia-capital.js b/projects/entities/sequoia-capital.js new file mode 100644 index 00000000000..b2d0748f0b6 --- /dev/null +++ b/projects/entities/sequoia-capital.js @@ -0,0 +1,10 @@ +const { treasuryExports } = require("../helper/treasury") + +const config = { + ethereum: { + owners: [ + "0xb8a9a55c04e88c4a2ece06d794bcb6574706f1c4" + ], + }, +} +module.exports = treasuryExports(config) \ No newline at end of file diff --git a/projects/helper/cex.js b/projects/helper/cex.js index cba56ef2e8c..6449cd670ec 100644 --- a/projects/helper/cex.js +++ b/projects/helper/cex.js @@ -92,6 +92,7 @@ const defaultTokens = { '0xcccd1ba9f7acd6117834e0d28f25645decb1736a', //ecox '0x25ec98773d7b4ced4cafab96a2a1c0945f145e10', // stUSDT '0x3c3a81e81dc49A522A592e7622A7E711c06bf354', // MNT + '0x61e90a50137e1f645c9ef4a0d3a4f01477738406', // LOKA ], tron: [ nullAddress, @@ -197,6 +198,15 @@ const defaultTokens = { ADDRESSES.celo.CELO, //celo "0x765de816845861e75a25fca122bb6898b8b1282a", //cUSD ], + moonbeam: [ + nullAddress, + "0xefaeee334f0fd1712f9a8cc375f427d9cdd40d73", //usdt + "0x8f552a71efe5eefc207bf75485b356a0b3f01ec9", //usdc + ], + moonriver: [ + nullAddress, + "0xb44a9b6905af7c801311e8f4e76932ee959c663c", //usdt + ], } function cexExports(config) { From e8c7be4f8709a3cf685df8ace2176a67b83989e8 Mon Sep 17 00:00:00 2001 From: rrr-source <84952562+rrr-source@users.noreply.github.com> Date: Mon, 16 Oct 2023 18:12:39 +0500 Subject: [PATCH 1559/1974] added overnight ETH+ on arbitrum (#7719) and updated USDT+ --- projects/overnight-ethPlus/index.js | 26 ++++++++++++++++++++++++++ projects/overnight-usdtPlus/index.js | 6 ++++-- 2 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 projects/overnight-ethPlus/index.js diff --git a/projects/overnight-ethPlus/index.js b/projects/overnight-ethPlus/index.js new file mode 100644 index 00000000000..cc07f511e29 --- /dev/null +++ b/projects/overnight-ethPlus/index.js @@ -0,0 +1,26 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const sdk = require("@defillama/sdk"); + +const m2m = { + arbitrum: "0x672F0f9ECF78406E4E31cd531b0CefE32f0A84B5", +} + +const assets = { + arbitrum: ADDRESSES.arbitrum.WETH, //WETH +} + +const abi = "uint256:totalNetAssets" + +module.exports = {}; + +Object.keys(m2m).forEach(chain => { + module.exports[chain] = { + tvl: async (_, _b, cb) => { + const block = cb[chain] + const { output } = await sdk.api.abi.call({ chain, block, abi, target: m2m[chain]}) + return { + [`${chain}:${assets[chain]}`]: output + } + } + } +}) \ No newline at end of file diff --git a/projects/overnight-usdtPlus/index.js b/projects/overnight-usdtPlus/index.js index 4a8586ff9b7..c250aaed132 100644 --- a/projects/overnight-usdtPlus/index.js +++ b/projects/overnight-usdtPlus/index.js @@ -3,12 +3,14 @@ const sdk = require("@defillama/sdk"); const m2m = { bsc: "0xF3434f6a11AA950150AF3e4962E39E6281496EF9", - linea: "0x3d67655A49Adb0F44530233Cbf8375D33FfAde41" + linea: "0x3d67655A49Adb0F44530233Cbf8375D33FfAde41", + arbitrum: "0xf3607bB88738c3388b543d390a90B6ABF4046E3b", } const assets = { bsc: ADDRESSES.bsc.USDT, //USDT - linea: ADDRESSES.linea.USDT //USDT + linea: ADDRESSES.linea.USDT, //USDT + arbitrum: ADDRESSES.arbitrum.USDT //USDT } const abi = "uint256:totalNetAssets" From 6606b36236294bcd68578f84ce6511079060ac15 Mon Sep 17 00:00:00 2001 From: QuillSwap <148058674+QuillSwap@users.noreply.github.com> Date: Mon, 16 Oct 2023 20:23:22 +0700 Subject: [PATCH 1560/1974] quillSwap (#7721) Co-authored-by: tinh225 --- projects/quillswap/index.js | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 projects/quillswap/index.js diff --git a/projects/quillswap/index.js b/projects/quillswap/index.js new file mode 100644 index 00000000000..0651e479c08 --- /dev/null +++ b/projects/quillswap/index.js @@ -0,0 +1,3 @@ +const { uniTvlExport } = require('../helper/unknownTokens') + +module.exports = uniTvlExport('scroll', '0xab8aEfe85faD683A6bDE16EeD04C3420C713324b', { fetchBalances: true, }) \ No newline at end of file From 628539035f330fdcea8f6239bfa50151f8311ba1 Mon Sep 17 00:00:00 2001 From: llama Date: Mon, 16 Oct 2023 15:49:43 +0200 Subject: [PATCH 1561/1974] minor fix --- projects/entities/arrington-xrp-capital.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/entities/arrington-xrp-capital.js b/projects/entities/arrington-xrp-capital.js index 0678269f95b..1fe4b284054 100644 --- a/projects/entities/arrington-xrp-capital.js +++ b/projects/entities/arrington-xrp-capital.js @@ -8,8 +8,8 @@ const config = { "0xaea97b739dcd6f5b586586cb7a538d60ba96a757", "0x1f9e17D8C21b00d2BbdfE637C33db21c3B1F4E4e" ], - tokens: ["0x29C827Ce49aCCF68A1a278C67C9D30c52fBbC348", "0xC36442b4a4522E871399CD717aBDD847Ab11FE88"], //sushi lp , univ3 position - resolveLP: true + tokens: ["0x29C827Ce49aCCF68A1a278C67C9D30c52fBbC348"], //sushi lp + resolveUniV3: true, }, avax: { owners: [ From 74b47512f5c0e63ca79b06a0922c5aa77729a1bf Mon Sep 17 00:00:00 2001 From: llama Date: Mon, 16 Oct 2023 18:51:56 +0200 Subject: [PATCH 1562/1974] wonky fix: stargate --- projects/stargatefinance/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/projects/stargatefinance/index.js b/projects/stargatefinance/index.js index 4add1243d8c..03a645abf56 100644 --- a/projects/stargatefinance/index.js +++ b/projects/stargatefinance/index.js @@ -75,6 +75,7 @@ Object.keys(CONFIG).forEach((chain) => { module.exports[chain] = { tvl: async (_, _b, _cb, { api }) => { + if (api.chain === 'kava') api.block = undefined const factory = await api.call({ abi: abi.factory, target: router }) const pools = await api.fetchList({ lengthAbi: abi.allPoolsLength, itemAbi: abi.allPools, target: factory, }) const tokens = await api.multiCall({ abi: abi.token, calls: pools }) @@ -91,3 +92,6 @@ Object.keys(CONFIG).forEach((chain) => { if (stakingContract && stg) module.exports[chain].staking = staking(stakingContract, stg) }) + +// kava has some issues with archival node +module.exports.timetravel = false \ No newline at end of file From a490bdcc2c4a81bf8b9e3eda79c0ee8e5fa74652 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 16 Oct 2023 22:40:04 +0530 Subject: [PATCH 1563/1974] liqwid: no more transformation (#7725) Co-authored-by: llama --- projects/liqwid/index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/projects/liqwid/index.js b/projects/liqwid/index.js index c5c269d0793..43b60aaaa07 100644 --- a/projects/liqwid/index.js +++ b/projects/liqwid/index.js @@ -95,7 +95,8 @@ async function borrowed(_, _b, _cb, { api, }) { } function base64ToHex(base64) { - // Step 1: Decode the Base64 string to a byte array + return base64 + /* // Step 1: Decode the Base64 string to a byte array const binaryData = atob(base64); // Step 2: Convert each byte to its hexadecimal representation @@ -106,5 +107,5 @@ function base64ToHex(base64) { } // Step 3: Concatenate the hexadecimal values to form the final hexadecimal string - return hexArray.join(''); + return hexArray.join(''); */ } From d65c20c6701a5007530cf34398387a7edfdcd06a Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 16 Oct 2023 22:44:07 +0530 Subject: [PATCH 1564/1974] Pacificswap (#7726) * Added Pacificswap * minor fix --------- Co-authored-by: triton-pacificswap Co-authored-by: llama --- projects/pacificswap-v3/index.js | 8 ++++++++ projects/pacificswap/index.js | 2 ++ 2 files changed, 10 insertions(+) create mode 100644 projects/pacificswap-v3/index.js create mode 100644 projects/pacificswap/index.js diff --git a/projects/pacificswap-v3/index.js b/projects/pacificswap-v3/index.js new file mode 100644 index 00000000000..a81a4ce5a79 --- /dev/null +++ b/projects/pacificswap-v3/index.js @@ -0,0 +1,8 @@ +const { uniV3Export } = require('../helper/uniswapV3') + +module.exports = uniV3Export({ + manta: { + factory: "0x0420ec530da3becaac33b0e8702756195cd847fe", + fromBlock: 247429, + }, +}); diff --git a/projects/pacificswap/index.js b/projects/pacificswap/index.js new file mode 100644 index 00000000000..9b74964f6da --- /dev/null +++ b/projects/pacificswap/index.js @@ -0,0 +1,2 @@ +const { uniTvlExport } = require("../helper/unknownTokens"); +module.exports = uniTvlExport('manta', '0x19405689008954ccddbc8c7ef2b64dd88b4a674a') From fa99c60b45add5366404d1e67d540dd819143b86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vuka=C5=A1in=20Manojlovi=C4=87?= Date: Mon, 16 Oct 2023 19:18:33 +0200 Subject: [PATCH 1565/1974] Remove TVL of Tempus and add TEMP staking (#7717) * Remove TVL of Tempus and add TEMP staking * minor fix --------- Co-authored-by: llama --- projects/tempus.js | 101 +++------------------------------------------ 1 file changed, 6 insertions(+), 95 deletions(-) diff --git a/projects/tempus.js b/projects/tempus.js index 3e62811b4bf..59206756dd5 100644 --- a/projects/tempus.js +++ b/projects/tempus.js @@ -1,101 +1,12 @@ -const ADDRESSES = require('./helper/coreAssets.json') -const sdk = require("@defillama/sdk"); +const { staking } = require("./helper/staking.js"); -const USDT = ADDRESSES.ethereum.USDT; -const USDC = ADDRESSES.ethereum.USDC -const DAI = ADDRESSES.ethereum.DAI; -const YFI = ADDRESSES.ethereum.YFI; -const WETH = ADDRESSES.ethereum.WETH; - -const CHAIN_DATA = { - ethereum: { - stats: "0xe552369a1b109b1eeebf060fcb6618f70f9131f7", - pools: [ - { - address: "0x6320E6844EEEa57343d5Ca47D3166822Ec78b116", - token: WETH - }, - { - address: "0x0697B0a2cBb1F947f51a9845b715E9eAb3f89B4F", - token: WETH - }, - { - address: "0xc58b8DD0075f7ae7B1CF54a56F899D8b25a7712E", - token: USDC - }, - { - address: "0x443297DE16C074fDeE19d2C9eCF40fdE2f5F62C2", - token: USDC - }, - { - address: "0x7e0fc07280f47bac3D55815954e0f904c86f642E", - token: DAI - } - ] - }, - fantom: { - stats: "0x7008d1f94088c8AA012B4F370A4fe672ad592Ee3", - pools: [ - { - address: "0x9c0273E4abB665ce156422a75F5a81db3c264A23", - token: DAI - }, - { - address: "0x943B73d3B7373de3e5Dd68f64dbf85E6F4f56c9E", - token: USDC - }, - { - address: "0xE9b557f9766Fb20651E3685374cd1DF6f977d36B", - token: USDT - }, - { - address: "0xA9C549aeFa21ee6e79bEFCe91fa0E16a9C7d585a", - token: WETH - }, - { - address: "0xAE7E5242eb52e8a592605eE408268091cC8794b8", - token: YFI - } - ] - } -} - - -function tvl(chain) { - return async (_, _b, {[chain]: block}) => { - - const { stats, pools } = CHAIN_DATA[chain]; - let balances = {}; - const lockedBalances = ( - await sdk.api.abi.multiCall({ - abi: 'function totalValueLockedInBackingTokens(address pool) view returns (uint256)', - calls: pools.map((p) => ({ - target: stats, - params: [p.address], - })), - block, - chain - }) - ).output; - - for (let i = 0; i < pools.length; i++) { - sdk.util.sumSingleBalance( - balances, - pools[i].token, - lockedBalances[i].output - ); - } - - return balances; - } -} +const STAKING = "0x6C6D4753a1107585121599746c2E398cCbEa5119"; +const TEMP = "0xA36FDBBAE3c9d55a1d67EE5821d53B50B63A1aB9"; module.exports = { - methodology: `All assets that were deposited into our active pools.`, ethereum: { - tvl: tvl("ethereum"), + tvl: () => 0, + staking: staking(STAKING, TEMP), }, - fantom: { - tvl: tvl("fantom") - } + fantom: { tvl: () => 0, } }; From a5c178c1fdd4fd9327af315e40e5b2f3a1b583c1 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Mon, 16 Oct 2023 20:07:07 +0100 Subject: [PATCH 1566/1974] add usdc --- projects/helper/tokenMapping.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index f4664b9a76b..f031726bfb5 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -76,6 +76,7 @@ const fixBalancesTokens = { scroll: { '0x5300000000000000000000000000000000000004': { coingeckoId: 'ethereum', decimals: 18 }, [ADDRESSES.null]: { coingeckoId: 'ethereum', decimals: 18 }, + '0x06eFdBFf2a14a7c8E15944D1F4A48F9F95F663A4': { coingeckoId: 'usd-coin', decimals: 6 } }, nos: { [ADDRESSES.nos.BTC]: { coingeckoId: 'bitcoin', decimals: 18 }, From 118b276c157278c99f47a2d0b8e901c0d86cc70c Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Tue, 17 Oct 2023 01:22:58 +0100 Subject: [PATCH 1567/1974] add new assest --- projects/aark/index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/projects/aark/index.js b/projects/aark/index.js index 2804e27bc51..9437b07f12a 100644 --- a/projects/aark/index.js +++ b/projects/aark/index.js @@ -5,6 +5,8 @@ async function tvl(_, _b, _cb, { api, }) { return api.sumTokens({ owner: VAULT_CONTRACT_ADDRESS, tokens: [ ADDRESSES.arbitrum.WETH, ADDRESSES.arbitrum.USDC, + '0x17FC002b466eEc40DaE837Fc4bE5c67993ddBd6F', + '0xaf88d065e77c8cC2239327C5EDb3A432268e5831' ] }) } From eba3bd334c958a8561f373ec6957c81e120325ed Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Tue, 17 Oct 2023 04:31:31 +0100 Subject: [PATCH 1568/1974] add moneymates --- projects/moneymates/index.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 projects/moneymates/index.js diff --git a/projects/moneymates/index.js b/projects/moneymates/index.js new file mode 100644 index 00000000000..4ad667a8c42 --- /dev/null +++ b/projects/moneymates/index.js @@ -0,0 +1,14 @@ +const { sumTokens2, nullAddress } = require("../helper/unwrapLPs"); + +const contract = "0xFD2023a463Ff177dA35e3C8128bf7E51a6e439DB"; + +async function tvl(time, ethBlock, _b, { api }) { + return sumTokens2({ tokens: [nullAddress], owner: contract, api }); +} + +module.exports = { + methodology: `We count the ETH on ${contract}`, + era: { + tvl, + }, +}; From a357fc0f4ca7d777857395b8af81874ed3bcd82e Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Tue, 17 Oct 2023 05:01:11 +0100 Subject: [PATCH 1569/1974] add superrare --- projects/superrare/index.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 projects/superrare/index.js diff --git a/projects/superrare/index.js b/projects/superrare/index.js new file mode 100644 index 00000000000..6d7a16498b6 --- /dev/null +++ b/projects/superrare/index.js @@ -0,0 +1,22 @@ +const { request, gql } = require("graphql-request"); + +async function staking(_time, block){ + const query = gql`query AllRareLocked ($block: Int) { + pools(first: 1000, block: { number: $block }) { + totalRareLocked + } + }` + const result = await request("https://gateway-arbitrum.network.thegraph.com/api/5fba66cce34542163f90501c363f99e8/subgraphs/id/Cc4fyxiBkZYdzATQDhTv3zLzfEwRupygp7HB2WWQciw5", query, { + block, + }); + return { + "0xba5BDe662c17e2aDFF1075610382B9B691296350": result.pools.reduce((sum, a)=>sum+Number(a.totalRareLocked), 0) + } +} + +module.exports={ + ethereum:{ + staking, + tvl: async()=>({}) + } +} \ No newline at end of file From 25dcae0fd6d7a9ff5eca9d3bd3584e959dfb1eb5 Mon Sep 17 00:00:00 2001 From: admin-aftermath <117692172+admin-aftermath@users.noreply.github.com> Date: Mon, 16 Oct 2023 22:39:26 -0700 Subject: [PATCH 1570/1974] feat: added adapter for `afSUI` (#7727) --- projects/aftermath-fi-afsui/index.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 projects/aftermath-fi-afsui/index.js diff --git a/projects/aftermath-fi-afsui/index.js b/projects/aftermath-fi-afsui/index.js new file mode 100644 index 00000000000..2c8858f0f38 --- /dev/null +++ b/projects/aftermath-fi-afsui/index.js @@ -0,0 +1,23 @@ +const sui = require('../helper/chain/sui') + +async function suiTVL() { + const stakedSuiVaultStateV1ObjectID = '0x55486449e41d89cfbdb20e005c1c5c1007858ad5b4d5d7c047d2b3b592fe8791' + const { fields: stakedSuiVaultState } = await sui.getObject(stakedSuiVaultStateV1ObjectID) + + const suiAmount = +stakedSuiVaultState.total_sui_amount + + +stakedSuiVaultState.atomic_unstake_sui_reserves + + +stakedSuiVaultState.crank_incentive_reward_pool; + + return { + sui: suiAmount / 1e9, + } +} + +module.exports = { + timetravel: true, + misrepresentedTokens: false, + methodology: "Counts the total number of SUI tokens held in Aftermath's afSUI contract.", + sui: { + tvl: suiTVL, + } +} From 5ccb3c574e16d9de1ec1ecdf4c17cd6a8a0a72ee Mon Sep 17 00:00:00 2001 From: llama Date: Tue, 17 Oct 2023 09:54:21 +0200 Subject: [PATCH 1571/1974] fix broken adapters --- projects/bluefin/index.js | 1 + projects/stargatefinance/index.js | 4 ---- projects/waves-exchange/index.js | 5 ++--- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/projects/bluefin/index.js b/projects/bluefin/index.js index cb8932f461a..f8962dc6dcf 100644 --- a/projects/bluefin/index.js +++ b/projects/bluefin/index.js @@ -16,6 +16,7 @@ async function suiTvl() { // div by 1e6 as usdc coin has 6 precision const tvl = object.fields.coinBalance; api.add(ADDRESSES.sui.USDC, tvl); + return api.getBalances() } module.exports = { diff --git a/projects/stargatefinance/index.js b/projects/stargatefinance/index.js index 03a645abf56..4add1243d8c 100644 --- a/projects/stargatefinance/index.js +++ b/projects/stargatefinance/index.js @@ -75,7 +75,6 @@ Object.keys(CONFIG).forEach((chain) => { module.exports[chain] = { tvl: async (_, _b, _cb, { api }) => { - if (api.chain === 'kava') api.block = undefined const factory = await api.call({ abi: abi.factory, target: router }) const pools = await api.fetchList({ lengthAbi: abi.allPoolsLength, itemAbi: abi.allPools, target: factory, }) const tokens = await api.multiCall({ abi: abi.token, calls: pools }) @@ -92,6 +91,3 @@ Object.keys(CONFIG).forEach((chain) => { if (stakingContract && stg) module.exports[chain].staking = staking(stakingContract, stg) }) - -// kava has some issues with archival node -module.exports.timetravel = false \ No newline at end of file diff --git a/projects/waves-exchange/index.js b/projects/waves-exchange/index.js index 900dc1a1697..5099b26b4c4 100644 --- a/projects/waves-exchange/index.js +++ b/projects/waves-exchange/index.js @@ -7,13 +7,12 @@ const endpoint = function tvl(isStaking) { let key = isStaking ? "wx_staking" : "liquidity_pools" return async () => { - throw new Error('Getting wrong tvl from api') - /* return toUSDTBalances( + return toUSDTBalances( (await get(endpoint)).products .filter(p => p.product_id === key) .map(p => p.tvl) .reduce((p, c) => Number(p) + Number(c), 0), - ); */ + ); } } From 230659d4a579071547cf15eb89b7b54cb921c018 Mon Sep 17 00:00:00 2001 From: llama Date: Tue, 17 Oct 2023 11:27:09 +0200 Subject: [PATCH 1572/1974] add hope products --- projects/hope-lend/index.js | 9 +++++++++ projects/hope-money/index.js | 24 ++++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 projects/hope-lend/index.js create mode 100644 projects/hope-money/index.js diff --git a/projects/hope-lend/index.js b/projects/hope-lend/index.js new file mode 100644 index 00000000000..11c69085c24 --- /dev/null +++ b/projects/hope-lend/index.js @@ -0,0 +1,9 @@ +const { aaveExports } = require('../helper/aave'); + +module.exports = { + ethereum: aaveExports("ethereum", "0x53FbcADa1201A465740F2d64eCdF6FAC425f9030", id=>id, ['0x17b5896703b36879A037Aa94F08622ab113C0AD4'], { + abis: { + getAllATokens: 'function getAllHTokens() view returns (tuple(string symbol, address tokenAddress)[])', + } + }), +}; \ No newline at end of file diff --git a/projects/hope-money/index.js b/projects/hope-money/index.js new file mode 100644 index 00000000000..54a3726033e --- /dev/null +++ b/projects/hope-money/index.js @@ -0,0 +1,24 @@ +const { sumTokensExport } = require('../helper/sumTokens') +const ADDRESSES = require('../helper/coreAssets.json') + +module.exports = { + methodology: 'Tokens held in coinbase custody. Reserve info taken from: https://hope.money/gomboc.html', + doublecounted: true, + bitcoin: { + tvl: sumTokensExport({ owners: [ + '15PYHP5ZW29B3o19jFNKz6RyRdHCtzJj5H', + '16BLcAyJR8unm8RpQT9PGTwh5uPpZEf2ut', + '3JoCB8ifwhL4YKo9rCYMgVGbqxBqnpQpdS', + ]}) + }, + ethereum: { + tvl: sumTokensExport({ + tokensAndOwners: [ + [ADDRESSES.null, '0x088117eD2b7ac7aE1801Fac4f359E1aeD95ca866'], + [ADDRESSES.null, '0x86Edc8da69261F4d6623B3a2494BA262Dc454B7f'], + [ADDRESSES.null, '0xDaC46e85f075512e9b4EF0cab58B6F21434eB253'], + [ADDRESSES.ethereum.STETH, '0x088117eD2b7ac7aE1801Fac4f359E1aeD95ca866'], + ] + }) + } +} \ No newline at end of file From 4f5bbc245251cb9bb3c3e5cb59021f8d24530cc5 Mon Sep 17 00:00:00 2001 From: Ayoola Olaoye <90112964+Eminivince@users.noreply.github.com> Date: Tue, 17 Oct 2023 12:10:50 +0100 Subject: [PATCH 1573/1974] Created index js with uniTvl (#7728) --- projects/VoltageSwap/index.js | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 projects/VoltageSwap/index.js diff --git a/projects/VoltageSwap/index.js b/projects/VoltageSwap/index.js new file mode 100644 index 00000000000..daea9058d41 --- /dev/null +++ b/projects/VoltageSwap/index.js @@ -0,0 +1,5 @@ +const { uniTvlExport } = require('../helper/unknownTokens') +const chain = 'scroll' +const factory = '0x7328d0dcbCcDA2F5bBA6Ce866cC9478cc8c0F938' // v2 factory address + +module.exports = uniTvlExport(chain, factory) \ No newline at end of file From b27e21ac923801b2c8143347618a45c9e45ae2ab Mon Sep 17 00:00:00 2001 From: Rosie0510 <88817990+Rosie0510@users.noreply.github.com> Date: Tue, 17 Oct 2023 18:29:25 +0700 Subject: [PATCH 1574/1974] Add RoseonX (#7737) --- projects/roseonx/index.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 projects/roseonx/index.js diff --git a/projects/roseonx/index.js b/projects/roseonx/index.js new file mode 100644 index 00000000000..d1af40bdd96 --- /dev/null +++ b/projects/roseonx/index.js @@ -0,0 +1,25 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const {staking} = require('../helper/staking') + +//Arbitrum +const ARB_VAULT = '0x832f80e93c77966dd343810c254f10ad58d9876d'; +const ARB_DUAL_STAKING = '0x42fa477A24d5471A24b798d5B4d9eC3a2C3dD49a'; +const ARB_ROSX = "0xDC8184ba488e949815d4AAfb35B3c56ad03B4179"; + +module.exports = { + arbitrum: { + staking: staking( + ARB_DUAL_STAKING, + [ + ARB_ROSX + ] + ), + tvl: staking( + ARB_VAULT, + ADDRESSES.arbitrum.USDC + ) + }, + hallmarks:[ + [1697439600, "RoseonX Launch"] + ], +}; \ No newline at end of file From f470812469f29a79973b3c36c459ec7a2e8c5ca6 Mon Sep 17 00:00:00 2001 From: 0xPowerRanger <127472302+0xPowerRanger@users.noreply.github.com> Date: Tue, 17 Oct 2023 19:35:56 +0800 Subject: [PATCH 1575/1974] [Range Protocol] Add more factories (#7736) --- projects/range/index.js | 74 +++++++++++++++++++++++++++++------------ 1 file changed, 52 insertions(+), 22 deletions(-) diff --git a/projects/range/index.js b/projects/range/index.js index ba6a5b7b890..fefa21d34c5 100644 --- a/projects/range/index.js +++ b/projects/range/index.js @@ -1,15 +1,33 @@ const { getLogs } = require('../helper/cache/getLogs') const ABI = require('./abi.json'); -const config = { - ethereum: { factory: '0xf1e70677fb1f49471604c012e8B42BA11226336b', fromBlock: 17266660, }, - arbitrum: { factory: '0xB9084c75D361D1d4cfC7663ef31591DeAB1086d6', fromBlock: 88503603, }, - bsc: { factory: '0xad2b34a2245b5a7378964BC820e8F34D14adF312', fromBlock: 28026886, }, - polygon: { factory: '0xad2b34a2245b5a7378964BC820e8F34D14adF312', fromBlock: 42446548, }, - base: { factory: '0x4bF9CDcCE12924B559928623a5d23598ca19367B', fromBlock: 2733457, }, - mantle: { factory: '0x3E89E72026DA6093DD6E4FED767f1f5db2fc0Fb4', fromBlock: 5345161 , } +const config ={ + ethereum: [ + { factory: '0xf1e70677fb1f49471604c012e8B42BA11226336b', fromBlock: 17266660 }, // uniswap + ], + arbitrum: [ + { factory: '0xB9084c75D361D1d4cfC7663ef31591DeAB1086d6', fromBlock: 88503603 }, // uniswap + { factory: '0x42f2dBb72964ac2854bF1C781E525C5CE1e19d52', fromBlock: 136696158 }, // sushiswap + { factory: '0x2274AC83290eB9355f851b447D3046b32A5B4f52', fromBlock: 138961230 }, // camelot + ], + bsc: [ + { factory: '0xad2b34a2245b5a7378964BC820e8F34D14adF312', fromBlock: 28026886 }, // pancakeswap + ], + polygon: [ + { factory: '0xad2b34a2245b5a7378964BC820e8F34D14adF312', fromBlock: 42446548 }, // quickswap + {factory: '0x9eD6C646b4A57e48DFE7AE04FBA4c857AD71d162', fromBlock: 45889702} // retro + ], + base: [ + { factory: '0x4bF9CDcCE12924B559928623a5d23598ca19367B', fromBlock: 2733457 }, // uniswap + ], + mantle: [ + { factory: '0x3E89E72026DA6093DD6E4FED767f1f5db2fc0Fb4', fromBlock: 5345161 }, // agni + { factory: '0xCCA961F89a03997F834eB5a0104efd9ba1f5800E', fromBlock: 14374189 }, // izumi + { factory: '0xD22D1271d108Cd09C38b8E5Be8536E0E366DCd23', fromBlock: 14063599 }, // fusionX + ] } + module.exports = { methodology: 'assets deployed on DEX as LP + asset balance of vaults', doublecounted: true, @@ -19,26 +37,38 @@ module.exports = { // vaults that were deployed through factory but are uninitialized and unused const ignoreList = {mantle : ["0x3f7a9ea2403F27Ce54624CE505D01B2204eDa030"]} Object.keys(config).forEach(chain => { - const { factory, fromBlock } = config[chain] module.exports[chain] = { tvl: async (_, _b, _cb, { api, }) => { - const logs = await getLogs({ - api, - target: factory, - topic: 'VaultCreated(address,address)', - eventAbi: 'event VaultCreated(address indexed uniPool, address indexed vault)', - onlyArgs: true, - fromBlock, - }) - let vaults = logs.map(log => log.vault) - vaults = vaults.filter(vault => !ignoreList[chain] || !ignoreList[chain].includes(vault)) - const token0s = await api.multiCall({ abi: "address:token0", calls: vaults, }) - const token1s = await api.multiCall({ abi: "address:token1", calls: vaults, }) - const bals = await api.multiCall({ abi: ABI.underlyingBalance, calls: vaults, }) + const factories = config[chain]; + const allLogs = []; + for (const { factory, fromBlock } of factories) { + const logs = await getLogs({ + api, + target: factory, + topic: 'VaultCreated(address,address)', + eventAbi: 'event VaultCreated(address indexed uniPool, address indexed vault)', + onlyArgs: true, + fromBlock, + }) + logs.forEach((log) => allLogs.push({ factory, log })); + } + const izumiFactory = '0xCCA961F89a03997F834eB5a0104efd9ba1f5800E'; + let vaults = allLogs.filter(({ factory }) => factory !== izumiFactory).map(({ log }) => log.vault); + vaults = vaults.filter(vault => !ignoreList[chain] || !ignoreList[chain].includes(vault)); + + let izumiVaults = allLogs.filter(({ factory }) => factory === izumiFactory).map(({ log }) => log.vault); + izumiVaults = izumiVaults.filter(vault => !ignoreList[chain] || !ignoreList[chain].includes(vault)); + + let token0s = await api.multiCall({ abi: "address:token0", calls: vaults }) + let token1s = await api.multiCall({ abi: "address:token1", calls: vaults }) + token0s.push(...(await api.multiCall({ abi: "address:tokenX", calls: izumiVaults }))) + token1s.push(...(await api.multiCall({ abi: "address:tokenY", calls: izumiVaults }))) + + const bals = await api.multiCall({ abi: ABI.underlyingBalance, calls: vaults }) bals.forEach(({ amount0Current, amount1Current }, i) => { api.add(token0s[i], amount0Current) api.add(token1s[i], amount1Current) }) } } -}) \ No newline at end of file +}) From db94b1992f0f4ac094c48ce5bfc5f23a738066b0 Mon Sep 17 00:00:00 2001 From: LpcAries <101619245+LpcAries@users.noreply.github.com> Date: Tue, 17 Oct 2023 19:36:55 +0800 Subject: [PATCH 1576/1974] [izumi-iziswap] add base config (#7731) --- projects/izumi-iziswap/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/izumi-iziswap/index.js b/projects/izumi-iziswap/index.js index b9409b11a85..43656b9962d 100644 --- a/projects/izumi-iziswap/index.js +++ b/projects/izumi-iziswap/index.js @@ -25,6 +25,7 @@ const poolHelpers = { 'kroma': ['0x110dE362cc436D7f54210f96b8C7652C2617887D'], 'manta': ['0x19b683A2F45012318d9B2aE1280d68d3eC54D663'], 'scroll': ['0x1502d025BfA624469892289D45C0352997251728'], + 'base': ['0x110dE362cc436D7f54210f96b8C7652C2617887D'], } // iziswap liquidityManager contracts const blacklistedTokens = [ From b5c0562dab56cd1296740d6f67fbcd57e2343ea5 Mon Sep 17 00:00:00 2001 From: richard-luigiswap <142534010+richard-luigiswap@users.noreply.github.com> Date: Tue, 17 Oct 2023 18:37:54 +0700 Subject: [PATCH 1577/1974] [luigiswap] track scroll (#7734) --- projects/LuigiSwap/index.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/projects/LuigiSwap/index.js b/projects/LuigiSwap/index.js index c21035cc955..e510d698461 100644 --- a/projects/LuigiSwap/index.js +++ b/projects/LuigiSwap/index.js @@ -9,4 +9,11 @@ module.exports = { fetchBalances: true, }), }, -}; \ No newline at end of file + scroll: { + tvl: getUniTVL({ + factory: "0x0dAe6d22182c20AB9150a4DCB3160591Dc41027a", + useDefaultCoreAssets: true, + fetchBalances: true, + }), + }, +}; From 901ea7e7ecac046bfda932f136dd160143a458f3 Mon Sep 17 00:00:00 2001 From: Brdd Mnk Date: Tue, 17 Oct 2023 14:39:36 +0300 Subject: [PATCH 1578/1974] new zkSync Era strategies (#7732) --- projects/parallax/contracts.json | 34 ++++++++++++---- projects/parallax/index.js | 67 ++++++++++++++++++++++---------- 2 files changed, 72 insertions(+), 29 deletions(-) diff --git a/projects/parallax/contracts.json b/projects/parallax/contracts.json index a434c0065b4..f79d31cbbfe 100644 --- a/projects/parallax/contracts.json +++ b/projects/parallax/contracts.json @@ -23,12 +23,30 @@ "usdc": "0xff970a61a04b1ca14834a43f5de4533ebddb5cc8" } }, - "era": { - "parallaxAddress": "0xF3D6B2418395b7441B17f39EF79fF8Ead5C0E61C", - "strategyAddress": "0x4d737487C5A398F761A4D8bE53cEB8f42e84a094", - "lpAddress": "0x80115c708E12eDd42E504c1cD52Aea96C547c05c", - "poolAddress": "0x80115c708E12eDd42E504c1cD52Aea96C547c05c", - "zkss_weth": "0x5AEa5775959fBC2557Cc8789bC1bf90A239D9a91", - "usdc": "0x3355df6d4c9c3035724fd0e3914de96a5a83aaf4" - } + "era": [ + { + "parallaxAddress": "0xF3D6B2418395b7441B17f39EF79fF8Ead5C0E61C", + "strategyAddress": "0x4d737487C5A398F761A4D8bE53cEB8f42e84a094", + "lpAddress": "0x80115c708E12eDd42E504c1cD52Aea96C547c05c", + "poolAddress": "0x80115c708E12eDd42E504c1cD52Aea96C547c05c", + "zkss_weth": "0x5AEa5775959fBC2557Cc8789bC1bf90A239D9a91", + "usdc": "0x3355df6d4c9c3035724fd0e3914de96a5a83aaf4" + }, + { + "parallaxAddress": "0xF3D6B2418395b7441B17f39EF79fF8Ead5C0E61C", + "strategyAddress": "0x94CA8B763ea7De772f0B2102A8E4738e25EdCDA2", + "lpAddress": "0xd3D91634Cf4C04aD1B76cE2c06F7385A897F54D3", + "poolAddress": "0xd3D91634Cf4C04aD1B76cE2c06F7385A897F54D3", + "zkss_weth": "0x5AEa5775959fBC2557Cc8789bC1bf90A239D9a91", + "usdc": "0x3355df6d4c9c3035724fd0e3914de96a5a83aaf4" + }, + { + "parallaxAddress": "0xF3D6B2418395b7441B17f39EF79fF8Ead5C0E61C", + "strategyAddress": "0x53e27f89658a9Da5Fc585d2fF3f657D6Cb1E22d5", + "lpAddress": "0x0E595bfcAfb552F83E25d24e8a383F88c1Ab48A4", + "poolAddress": "0x0E595bfcAfb552F83E25d24e8a383F88c1Ab48A4", + "zkss_weth": "0x5AEa5775959fBC2557Cc8789bC1bf90A239D9a91", + "usdc": "0x3355df6d4c9c3035724fd0e3914de96a5a83aaf4" + } + ] } \ No newline at end of file diff --git a/projects/parallax/index.js b/projects/parallax/index.js index 4e3e9153082..e4a98ac5c44 100644 --- a/projects/parallax/index.js +++ b/projects/parallax/index.js @@ -1,8 +1,8 @@ const sdk = require("@defillama/sdk"); const { default: BigNumber } = require("bignumber.js"); -const { staking } = require('../helper/staking') -const { sumTokensExport } = require('../helper/unwrapLPs') +const { staking } = require("../helper/staking"); +const { sumTokensExport } = require("../helper/unwrapLPs"); const { getPriceMIM, getPriceAura, getPriceSushi } = require("./getPrice"); const prllxERC20 = require("./abis/prllxERC20.json"); @@ -148,30 +148,55 @@ async function arbitrumTvl(time, _ethBlock, { arbitrum: block }, { api }) { return balances; } -async function eraTvl(_, _b, _cb, { api, }) { - - const strategyId = await api.call({ target: contracts.era.parallaxAddress, params: contracts.era.strategyAddress, abi: prllxERC20["strategyToId"], }); - - const strategy = await api.call({ target: contracts.era.parallaxAddress, params: strategyId, abi: prllxERC20.strategiesERA, }); - const pair = contracts.era.lpAddress - const [token0, token1, reserves, totalSupply] = await Promise.all([ - api.call({ target: pair, abi: 'address:token0' }), - api.call({ target: pair, abi: 'address:token1' }), - api.call({ target: pair, abi: "function getReserves() view returns (uint256 _reserve0, uint256 _reserve1)" }), - api.call({ target: pair, abi: 'uint256:totalSupply' }), - ]) - const ratio = strategy.totalStaked / totalSupply - api.add(token0, reserves._reserve0 * ratio) - api.add(token1, reserves._reserve1 * ratio) - return api.getBalances() +async function eraTvl(_, _b, _cb, { api }) { + if (contracts.era.length > 0) { + for (let i = 0; i < contracts.era.length; i++) { + const strItem = contracts.era[i]; + const strategyId = await api.call({ + target: strItem.parallaxAddress, + params: strItem.strategyAddress, + abi: prllxERC20["strategyToId"], + }); + + const strategy = await api.call({ + target: strItem.parallaxAddress, + params: strategyId, + abi: prllxERC20.strategiesERA, + }); + const pair = strItem.lpAddress; + const [token0, token1, reserves, totalSupply] = await Promise.all([ + api.call({ target: pair, abi: "address:token0" }), + api.call({ target: pair, abi: "address:token1" }), + api.call({ + target: pair, + abi: "function getReserves() view returns (uint256 _reserve0, uint256 _reserve1)", + }), + api.call({ target: pair, abi: "uint256:totalSupply" }), + ]); + const ratio = strategy.totalStaked / totalSupply; + api.add(token0, reserves._reserve0 * ratio); + api.add(token1, reserves._reserve1 * ratio); + } + return api.getBalances(); + } } module.exports = { methodology: "TVL comes from the Staking Vaults", - arbitrum: { + arbitrum: { tvl: arbitrumTvl, - staking: staking(['0x82FD636D7A28a20635572EB8ec0603ee264B8651', '0xA3CE2c0d1cfB29F398f8f4800bA202Aba39dbbfe', '0xEb370470Afd74d8a9BBC4fF0C94371C310fF9D3e', ], '0xc8CCBd97b96834b976C995a67BF46e5754e2C48E'), - pool2: sumTokensExport({ owner: '0xEb370470Afd74d8a9BBC4fF0C94371C310fF9D3e', resolveUniV3: true, }) + staking: staking( + [ + "0x82FD636D7A28a20635572EB8ec0603ee264B8651", + "0xA3CE2c0d1cfB29F398f8f4800bA202Aba39dbbfe", + "0xEb370470Afd74d8a9BBC4fF0C94371C310fF9D3e", + ], + "0xc8CCBd97b96834b976C995a67BF46e5754e2C48E" + ), + pool2: sumTokensExport({ + owner: "0xEb370470Afd74d8a9BBC4fF0C94371C310fF9D3e", + resolveUniV3: true, + }), }, ethereum: { tvl: ethTvl, From 736d1b2cf8210e9209c6334c90506a9bcd0dff2a Mon Sep 17 00:00:00 2001 From: LyveFinance <140053171+LyveFinance@users.noreply.github.com> Date: Tue, 17 Oct 2023 19:40:23 +0800 Subject: [PATCH 1579/1974] Add lyve TVL to DefiLlama (#7730) --- projects/lyve/index.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 projects/lyve/index.js diff --git a/projects/lyve/index.js b/projects/lyve/index.js new file mode 100644 index 00000000000..11b3ba70ca9 --- /dev/null +++ b/projects/lyve/index.js @@ -0,0 +1,13 @@ +const { getUniTVL } = require('../helper/unknownTokens.js') + +module.exports = { + misrepresentedTokens: true, + linea: { + tvl: getUniTVL({ + factory: '0xA75436A74a9F5C7a8892F907ff37e15c558d41b0', + useDefaultCoreAssets: true, + hasStablePools: true, + fetchBalances: true, + }) + } +} \ No newline at end of file From a2b11e864f2c652e5ec7c1b58fe8a9b7bbc995e0 Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Tue, 17 Oct 2023 13:17:19 +0100 Subject: [PATCH 1580/1974] tezos --- projects/helper/chain/tezos.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/helper/chain/tezos.js b/projects/helper/chain/tezos.js index e73557cecd0..727c51d1c69 100644 --- a/projects/helper/chain/tezos.js +++ b/projects/helper/chain/tezos.js @@ -6,7 +6,7 @@ const { PromisePool } = require('@supercharge/promise-pool') const RPC_ENDPOINT = 'https://api.tzkt.io' const usdtAddressTezos = ADDRESSES.tezos.USDt -const transformAddressDefault = t => 'tezos:' + t +const transformAddressDefault = t == "tezos" ? "coingecko:tezos" : 'tezos:' + t const tokenBlacklist = [ 'KT18quSVkqhbJS38d5sbRAEkXd5GoNqmAoro', From 004fb5af303d534ce5903536b18b95d5bd4fd898 Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Tue, 17 Oct 2023 13:19:17 +0100 Subject: [PATCH 1581/1974] patch --- projects/helper/chain/tezos.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/helper/chain/tezos.js b/projects/helper/chain/tezos.js index 727c51d1c69..ffc822135ed 100644 --- a/projects/helper/chain/tezos.js +++ b/projects/helper/chain/tezos.js @@ -6,7 +6,7 @@ const { PromisePool } = require('@supercharge/promise-pool') const RPC_ENDPOINT = 'https://api.tzkt.io' const usdtAddressTezos = ADDRESSES.tezos.USDt -const transformAddressDefault = t == "tezos" ? "coingecko:tezos" : 'tezos:' + t +const transformAddressDefault = t => t == "tezos" ? "coingecko:tezos" : 'tezos:' + t const tokenBlacklist = [ 'KT18quSVkqhbJS38d5sbRAEkXd5GoNqmAoro', From 044437b4e1ef5b55fa14c351a795fe197b212d46 Mon Sep 17 00:00:00 2001 From: Stefano Faieta <9802152+stefanofa@users.noreply.github.com> Date: Tue, 17 Oct 2023 14:21:18 +0200 Subject: [PATCH 1582/1974] Add folks finance ultraswap (#7735) * Remove assignment to non defined variable * Calculate folks finance ultraswap tvl * minor fix --------- Co-authored-by: llama --- projects/folks-ultraswap/constants.js | 15 ++ projects/folks-ultraswap/index.js | 86 +++++++++++ projects/folks-ultraswap/loan-info.js | 149 +++++++++++++++++++ projects/folks-ultraswap/loan-local-state.js | 48 ++++++ projects/folks-ultraswap/pool-manager.js | 75 ++++++++++ projects/folks-ultraswap/prices.js | 92 ++++++++++++ projects/folks-ultraswap/utils.js | 130 ++++++++++++++++ 7 files changed, 595 insertions(+) create mode 100644 projects/folks-ultraswap/constants.js create mode 100644 projects/folks-ultraswap/index.js create mode 100644 projects/folks-ultraswap/loan-info.js create mode 100644 projects/folks-ultraswap/loan-local-state.js create mode 100644 projects/folks-ultraswap/pool-manager.js create mode 100644 projects/folks-ultraswap/prices.js create mode 100644 projects/folks-ultraswap/utils.js diff --git a/projects/folks-ultraswap/constants.js b/projects/folks-ultraswap/constants.js new file mode 100644 index 00000000000..22e6468fe4e --- /dev/null +++ b/projects/folks-ultraswap/constants.js @@ -0,0 +1,15 @@ +const POOL_MANAGER_APP_ID = 971350278; + +const ULTRASWAP_UP_LOAN_APP_ID = 1202382736; +const ULTRASWAP_DOWN_LOAN_APP_ID = 1202382829; + +const ORACLE_APP_ID = 1040271396; +const ORACLE_DECIMALS = 14; + +module.exports = { + POOL_MANAGER_APP_ID, + ULTRASWAP_UP_LOAN_APP_ID, + ULTRASWAP_DOWN_LOAN_APP_ID, + ORACLE_APP_ID, + ORACLE_DECIMALS, +}; diff --git a/projects/folks-ultraswap/index.js b/projects/folks-ultraswap/index.js new file mode 100644 index 00000000000..74b4dcc1a7e --- /dev/null +++ b/projects/folks-ultraswap/index.js @@ -0,0 +1,86 @@ +const { toUSDTBalances } = require("../helper/balances"); +const { searchAccountsAll } = require("../helper/chain/algorand"); +const { + ULTRASWAP_UP_LOAN_APP_ID, + ULTRASWAP_DOWN_LOAN_APP_ID, +} = require("./constants"); +const { userLoanInfo, retrieveLoanInfo } = require("./loan-info"); +const { loanLocalState } = require("./loan-local-state"); +const { retrievePoolManagerInfo } = require("./pool-manager"); +const { getCachedPrices } = require("./prices"); + +async function calculateTvlOnUltraswapLoan(loanAppId, poolManagerInfo, prices) { + const accountsWithLoans = await searchAccountsAll({ + appId: loanAppId, + searchParams: { exclude: "assets,created-assets,created-apps" }, + }); + + const loanInfo = await retrieveLoanInfo(loanAppId); + + let totalCollateralUsd = 0; + let totalBorrowUsd = 0; + + for (const accountWithLoans of accountsWithLoans) { + const state = accountWithLoans["apps-local-state"]?.find( + ({ id }) => id === loanAppId + )?.["key-value"]; + const localState = loanLocalState(state); + + const loan = userLoanInfo(localState, poolManagerInfo, loanInfo, prices); + totalCollateralUsd += loan.totalCollateralBalanceValue; + totalBorrowUsd += loan.totalBorrowBalanceValue; + } + + return { totalCollateralUsd, totalBorrowUsd }; +} + +let data + +async function getUltraswapData() { + if (!data) { + data = _getUltraswapData(); + } + return data; +} + +async function _getUltraswapData() { + const prices = await getCachedPrices(); + const poolManagerInfo = await retrievePoolManagerInfo(); + + const ultraswapUpTvl = await calculateTvlOnUltraswapLoan( + ULTRASWAP_UP_LOAN_APP_ID, + poolManagerInfo, + prices + ); + const ultraswapDownTvl = await calculateTvlOnUltraswapLoan( + ULTRASWAP_DOWN_LOAN_APP_ID, + poolManagerInfo, + prices + ); + + const totalBorrowUsd = + ultraswapUpTvl.totalBorrowUsd + ultraswapDownTvl.totalBorrowUsd; + const totalCollateralUsd = + ultraswapUpTvl.totalCollateralUsd + ultraswapDownTvl.totalCollateralUsd; + + return { totalBorrowUsd, totalCollateralUsd }; +} + +async function tvl() { + const { totalBorrowUsd, totalCollateralUsd } = await getUltraswapData(); + + return toUSDTBalances(totalCollateralUsd + totalBorrowUsd); +} + +async function borrowed() { + const { totalBorrowUsd } = await getUltraswapData(); + + return toUSDTBalances(totalBorrowUsd); +} + +module.exports = { + timetravel: false, + doublecounted: true, + misrepresentedTokens: true, + algorand: { tvl, borrowed }, +}; diff --git a/projects/folks-ultraswap/loan-info.js b/projects/folks-ultraswap/loan-info.js new file mode 100644 index 00000000000..20e97402753 --- /dev/null +++ b/projects/folks-ultraswap/loan-info.js @@ -0,0 +1,149 @@ +const { + getParsedValueFromState, + getAppState, + mulScale, + unixTime, + ONE_16_DP, + SECONDS_IN_YEAR, + expBySquaring, + mulScaleRoundUp, + divScaleRoundUp, + ONE_14_DP, + fromIntToByteHex, +} = require("./utils"); + +function calcBorrowInterestIndex(birt1, biit1, latestUpdate) { + const dt = BigInt(unixTime()) - latestUpdate; + return mulScale( + biit1, + expBySquaring(ONE_16_DP + birt1 / SECONDS_IN_YEAR, dt, ONE_16_DP), + ONE_16_DP + ); +} + +function calcBorrowBalance(bbtn1, biit, biitn1) { + return mulScaleRoundUp( + bbtn1, + divScaleRoundUp(biit, biitn1, ONE_14_DP), + ONE_14_DP + ); +} + +async function retrieveLoanInfo(loanAppId) { + const state = await getAppState(loanAppId); + if (state === undefined) throw Error("Could not find Loan"); + + const paramsBase64Value = String(getParsedValueFromState(state, "pa")); + const paramsValue = Buffer.from(paramsBase64Value, "base64").toString("hex"); + const canSwapCollateral = Boolean(BigInt("0x" + paramsValue.slice(96, 98))); + + const pools = {}; + for (let i = 0; i < 63; i++) { + const poolBase64Value = String( + getParsedValueFromState(state, fromIntToByteHex(i), "hex") + ); + const poolValue = Buffer.from(poolBase64Value, "base64").toString("hex"); + + for (let j = 0; j < 3; j++) { + const basePos = j * 84; + const poolAppId = Number("0x" + poolValue.slice(basePos, basePos + 16)); + // add pool + if (poolAppId > 0) { + pools[poolAppId] = { + poolAppId, + assetId: Number("0x" + poolValue.slice(basePos + 16, basePos + 32)), + }; + } + } + } + + // combine + return { canSwapCollateral, pools }; +} + +function userLoanInfo(localState, poolManagerInfo, loanInfo, prices) { + const { pools: poolManagerPools } = poolManagerInfo; + const { pools: loanPools } = loanInfo; + + // collaterals + let totalCollateralBalanceValue = 0; + + localState.collaterals.forEach(({ poolAppId, fAssetBalance }) => { + const isColPresent = poolAppId > 0; + if (!isColPresent) return; + + const poolInfo = poolManagerPools[poolAppId]; + const poolLoanInfo = loanPools[poolAppId]; + if (poolInfo === undefined || poolLoanInfo === undefined) + throw Error("Could not find collateral pool " + poolAppId); + + const { depositInterestIndex } = poolInfo; + const { assetId } = poolLoanInfo; + const assetPrice = prices[assetId]; + if (assetPrice === undefined) + throw Error("Could not find asset price " + assetId); + + const assetBalance = mulScale( + fAssetBalance, + depositInterestIndex, + ONE_14_DP + ); + const balanceValue = Number(assetBalance) * assetPrice; + + totalCollateralBalanceValue += balanceValue; + }); + + // borrows + let totalBorrowBalanceValue = 0; + + localState.borrows.forEach( + ({ + poolAppId, + borrowBalance: oldBorrowBalance, + latestBorrowInterestIndex, + stableBorrowInterestRate, + latestStableChange, + }) => { + const isBorPresent = oldBorrowBalance > BigInt(0); + if (!isBorPresent) return; + + const poolInfo = poolManagerPools[poolAppId]; + const poolLoanInfo = loanPools[poolAppId]; + if (poolInfo === undefined || poolLoanInfo === undefined) + throw Error("Could not find borrow pool " + poolAppId); + + const { assetId } = poolLoanInfo; + const assetPrice = prices[assetId]; + if (assetPrice === undefined) + throw Error("Could not find asset price " + assetId); + + const isStable = latestStableChange > BigInt(0); + const borrowInterestIndex = isStable + ? calcBorrowInterestIndex( + stableBorrowInterestRate, + latestBorrowInterestIndex, + latestStableChange + ) + : poolInfo.variableBorrowInterestIndex; + const borrowBalance = calcBorrowBalance( + oldBorrowBalance, + borrowInterestIndex, + latestBorrowInterestIndex + ); + + const borrowBalanceValue = Number(borrowBalance) * assetPrice; + + totalBorrowBalanceValue += borrowBalanceValue; + } + ); + + return { + totalCollateralBalanceValue, + totalBorrowBalanceValue, + }; +} + +module.exports = { + retrieveLoanInfo, + userLoanInfo, +}; diff --git a/projects/folks-ultraswap/loan-local-state.js b/projects/folks-ultraswap/loan-local-state.js new file mode 100644 index 00000000000..9dd470276a6 --- /dev/null +++ b/projects/folks-ultraswap/loan-local-state.js @@ -0,0 +1,48 @@ +const { encodeAddress } = require("../helper/chain/algorandUtils/address"); +const { parseUint64s, getParsedValueFromState } = require("./utils"); + +function loanLocalState(state) { + // standard + const userAddress = encodeAddress( + Buffer.from(String(getParsedValueFromState(state, "u")), "base64") + ); + const colPls = parseUint64s(String(getParsedValueFromState(state, "c"))); + const borPls = parseUint64s(String(getParsedValueFromState(state, "b"))); + const colBals = parseUint64s(String(getParsedValueFromState(state, "cb"))); + const borAms = parseUint64s(String(getParsedValueFromState(state, "ba"))); + const borBals = parseUint64s(String(getParsedValueFromState(state, "bb"))); + const lbii = parseUint64s(String(getParsedValueFromState(state, "l"))); + const sbir = parseUint64s(String(getParsedValueFromState(state, "r"))); + const lsc = parseUint64s(String(getParsedValueFromState(state, "t"))); + + // custom + const collaterals = []; + const borrows = []; + for (let i = 0; i < 15; i++) { + // add collateral + collaterals.push({ + poolAppId: Number(colPls[i]), + fAssetBalance: colBals[i], + }); + + // add borrow + borrows.push({ + poolAppId: Number(borPls[i]), + borrowedAmount: borAms[i], + borrowBalance: borBals[i], + latestBorrowInterestIndex: lbii[i], + stableBorrowInterestRate: sbir[i], + latestStableChange: lsc[i], + }); + } + + return { + userAddress, + collaterals, + borrows, + }; +} + +module.exports = { + loanLocalState, +}; diff --git a/projects/folks-ultraswap/pool-manager.js b/projects/folks-ultraswap/pool-manager.js new file mode 100644 index 00000000000..ceaa7fabaf5 --- /dev/null +++ b/projects/folks-ultraswap/pool-manager.js @@ -0,0 +1,75 @@ +const { POOL_MANAGER_APP_ID } = require("./constants"); +const { + getAppState, + getParsedValueFromState, + unixTime, + mulScale, + ONE_16_DP, + SECONDS_IN_YEAR, + expBySquaring, + fromIntToByteHex, +} = require("./utils"); + +function calcBorrowInterestIndex(birt1, biit1, latestUpdate) { + const dt = BigInt(unixTime()) - latestUpdate; + return mulScale( + biit1, + expBySquaring(ONE_16_DP + birt1 / SECONDS_IN_YEAR, dt, ONE_16_DP), + ONE_16_DP + ); +} + +function calcDepositInterestIndex(dirt1, diit1, latestUpdate) { + const dt = BigInt(unixTime()) - latestUpdate; + return mulScale(diit1, ONE_16_DP + (dirt1 * dt) / SECONDS_IN_YEAR, ONE_16_DP); +} + +async function retrievePoolManagerInfo() { + const state = await getAppState(POOL_MANAGER_APP_ID); + if (state === undefined) throw Error("Could not find Pool Manager"); + + const pools = {}; + for (let i = 0; i < 63; i++) { + const poolBase64Value = String( + getParsedValueFromState(state, fromIntToByteHex(i), "hex") + ); + + const poolValue = Buffer.from(poolBase64Value, "base64").toString("hex"); + + for (let j = 0; j < 3; j++) { + const basePos = j * 84; + const poolAppId = Number("0x" + poolValue.slice(basePos, basePos + 12)); + + // add pool + if (poolAppId > 0) { + const vbir = BigInt("0x" + poolValue.slice(basePos + 12, basePos + 28)); + const vbiit1 = BigInt( + "0x" + poolValue.slice(basePos + 28, basePos + 44) + ); + const dir = BigInt("0x" + poolValue.slice(basePos + 44, basePos + 60)); + const diit1 = BigInt( + "0x" + poolValue.slice(basePos + 60, basePos + 76) + ); + const lu = BigInt("0x" + poolValue.slice(basePos + 76, basePos + 84)); + + const depositInterestIndex = calcDepositInterestIndex(dir, diit1, lu); + const variableBorrowInterestIndex = calcBorrowInterestIndex( + vbir, + vbiit1, + lu + ); + + pools[poolAppId] = { + depositInterestIndex, + variableBorrowInterestIndex, + }; + } + } + } + + return { pools }; +} + +module.exports = { + retrievePoolManagerInfo, +}; diff --git a/projects/folks-ultraswap/prices.js b/projects/folks-ultraswap/prices.js new file mode 100644 index 00000000000..1ba60599efa --- /dev/null +++ b/projects/folks-ultraswap/prices.js @@ -0,0 +1,92 @@ +const { ORACLE_APP_ID, ORACLE_DECIMALS } = require("./constants"); +const { + getAppState, + getParsedValueFromState, + fromIntToBytes8Hex, + parseOracleValue, +} = require("./utils"); + +function decodeUint64(data, decodingMode = "safe") { + if ( + decodingMode !== "safe" && + decodingMode !== "mixed" && + decodingMode !== "bigint" + ) { + throw new Error(`Unknown decodingMode option: ${decodingMode}`); + } + + if (data.byteLength === 0 || data.byteLength > 8) { + throw new Error( + `Data has unacceptable length. Expected length is between 1 and 8, got ${data.byteLength}` + ); + } + + // insert 0s at the beginning if data is smaller than 8 bytes + const padding = Buffer.allocUnsafe(8 - data.byteLength); + padding.fill(0); + + const buf = Buffer.concat([padding, Buffer.from(data)]); + + const num = buf.readBigUInt64BE(); + const isBig = num > Number.MAX_SAFE_INTEGER; + + if (decodingMode === "safe") { + if (isBig) { + throw new Error( + `Integer exceeds maximum safe integer: ${num.toString()}. Try decoding with "mixed" or "safe" decodingMode.` + ); + } + return Number(num); + } + + if (decodingMode === "mixed" && !isBig) { + return Number(num); + } + + return num; +} + +let pricesCache; + +async function getCachedPrices() { + if (!pricesCache) pricesCache = getPrices(); + return pricesCache; +} + +/* Get prices from oracle */ +async function getPrices() { + const oracleState = await getAppState(ORACLE_APP_ID); + + const prices = {}; + + // get the assets for which we need to retrieve their prices + const assets = oracleState + .filter(({ key }) => { + // remove non asset ids global state + key = Buffer.from(key, "base64").toString("utf8"); + return ( + key !== "updater_addr" && + key !== "admin" && + key !== "tinyman_validator_app_id" + ); + }) + .map(({ key }) => { + // convert key to asset id + return decodeUint64(Buffer.from(key, "base64"), "safe"); + }); + + // retrieve asset prices + assets.forEach((assetId) => { + const assetPrice = parseOracleValue( + String( + getParsedValueFromState(oracleState, fromIntToBytes8Hex(assetId), "hex") + ) + ); + + prices[assetId] = Number(assetPrice) / 10 ** ORACLE_DECIMALS; + }); + + return prices; +} + +module.exports = { getCachedPrices }; diff --git a/projects/folks-ultraswap/utils.js b/projects/folks-ultraswap/utils.js new file mode 100644 index 00000000000..420420d2fed --- /dev/null +++ b/projects/folks-ultraswap/utils.js @@ -0,0 +1,130 @@ +const { lookupApplications } = require("../helper/chain/algorand"); +const { encodeAddress } = require("../helper/chain/algorandUtils/address"); + +const ONE_4_DP = BigInt(1e4); +const ONE_14_DP = BigInt(1e14); +const ONE_16_DP = BigInt(1e16); +const SECONDS_IN_YEAR = BigInt(365 * 24 * 60 * 60); + +function fromIntToBytes8Hex(num) { + return num.toString(16).padStart(16, "0"); +} + +function fromIntToByteHex(num) { + return num.toString(16).padStart(2, "0"); +} + +function encodeToBase64(str, encoding = "utf8") { + return Buffer.from(str, encoding).toString("base64"); +} + +function parseUint64s(base64Value) { + const value = Buffer.from(base64Value, "base64").toString("hex"); + + // uint64s are 8 bytes each + const uint64s = []; + for (let i = 0; i < value.length; i += 16) { + uint64s.push(BigInt("0x" + value.slice(i, i + 16))); + } + return uint64s; +} + +function parseOracleValue(base64Value) { + const value = Buffer.from(base64Value, "base64").toString("hex"); + // first 8 bytes are the price + const price = BigInt("0x" + value.slice(0, 16)); + + return price; +} + +function parseOracleAdapterValue(base64Value) { + const value = Buffer.from(base64Value, "base64").toString("hex"); + // first 8 bytes are if Tinyman + const isTinyman = Number(`0x${value.slice(0, 16)}`); + // next 16 bytes are asset ids + const asset0Id = Number(`0x${value.slice(16, 32)}`); + const asset1Id = Number(`0x${value.slice(32, 48)}`); + + // check if LP token is Tinyman or Pact + if (isTinyman) { + // next 32 bytes are tinyman pool address + const poolAddress = encodeAddress(Buffer.from(value.slice(48, 112), "hex")); + return { provider: "Tinyman", asset0Id, asset1Id, poolAddress }; + } else { + // next 8 bytes are pact pool app id + const poolAppId = Number(`0x${value.slice(48, 64)}`); + return { provider: "Pact", asset0Id, asset1Id, poolAppId }; + } +} + +function getParsedValueFromState(state, key, encoding = "utf8") { + const encodedKey = encoding ? encodeToBase64(key, encoding) : key; + const keyValue = state.find((entry) => entry.key === encodedKey); + if (keyValue === undefined) return; + const { value } = keyValue; + if (value.type === 1) return value.bytes; + if (value.type === 2) return BigInt(value.uint); + return; +} + +async function getAppState(appId) { + const res = await lookupApplications(appId); + return res.application.params["global-state"]; +} + +function unixTime() { + return Math.floor(Date.now() / 1000); +} + +function mulScale(n1, n2, scale) { + return (n1 * n2) / scale; +} + +function mulScaleRoundUp(n1, n2, scale) { + return mulScale(n1, n2, scale) + BigInt(1); +} + +function divScale(n1, n2, scale) { + return (n1 * scale) / n2; +} + +function divScaleRoundUp(n1, n2, scale) { + return divScale(n1, n2, scale) + BigInt(1); +} + +function expBySquaring(x, n, scale) { + if (n === BigInt(0)) return scale; + + let y = scale; + while (n > BigInt(1)) { + if (n % BigInt(2)) { + y = mulScale(x, y, scale); + n = (n - BigInt(1)) / BigInt(2); + } else { + n = n / BigInt(2); + } + x = mulScale(x, x, scale); + } + return mulScale(x, y, scale); +} + +module.exports = { + ONE_4_DP, + ONE_14_DP, + ONE_16_DP, + SECONDS_IN_YEAR, + fromIntToByteHex, + fromIntToBytes8Hex, + encodeToBase64, + parseUint64s, + parseOracleValue, + parseOracleAdapterValue, + getParsedValueFromState, + getAppState, + unixTime, + mulScale, + mulScaleRoundUp, + divScale, + divScaleRoundUp, + expBySquaring, +}; From 85f0daf8bfce721baf57f57cd7727f6a8484eceb Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 17 Oct 2023 18:52:03 +0530 Subject: [PATCH 1583/1974] Bfc (#7740) * add bifrost_mainnet, update bifi project * code refactor --------- Co-authored-by: Ss5h Co-authored-by: llama --- projects/bifi/index.js | 225 ++++++++++---------------------- projects/helper/chains.json | 1 + projects/helper/coreAssets.json | 8 ++ projects/helper/tokenMapping.js | 18 ++- 4 files changed, 94 insertions(+), 158 deletions(-) diff --git a/projects/bifi/index.js b/projects/bifi/index.js index 79096df0902..f3efae10a71 100644 --- a/projects/bifi/index.js +++ b/projects/bifi/index.js @@ -1,171 +1,86 @@ const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const { stakings } = require("../helper/staking"); -const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') +const { sumTokens2, } = require('../helper/unwrapLPs') const stakingPool = ['0x488933457E89656D7eF7E69C10F2f80C7acA19b5', '0x4b1791422dE4807B2999Eeb65359F3E13fa9d11d']; const bfcAddr = '0x0c7D5ae016f806603CB1782bEa29AC69471CAb9c'; -const ethPool = '0x13000c4a215efe7e414bb329b2f11c39bcf92d78'; -const ethTokenPools = { - 'usdt': { - 'pool': '0x808c3ba97268dbf9695b1ec10729e09c7e67a9e3', - 'token': ADDRESSES.ethereum.USDT - }, - 'dai': { - 'pool': '0xd76b7060f1b646fa14740ff6ac670a4f0a6fc5e3', - 'token': ADDRESSES.ethereum.DAI - }, - 'link': { - 'pool': '0x25567603eb61a4a49f27e433652b5b8940d10682', - 'token': ADDRESSES.ethereum.LINK - }, - 'usdc': { - 'pool': '0x128647690C7733593aA3Dd149EeBC5e256E79217', - 'token': ADDRESSES.ethereum.USDC - }, - 'wbtc': { - 'pool': '0x93948Aa8488F522d5b079AF84fe411FBCE476e9f', - 'token': ADDRESSES.ethereum.WBTC - } +const chainPools = { + ethereum: { + null: { pool: '0x13000c4a215efe7e414bb329b2f11c39bcf92d78', token: ADDRESSES.null, }, + usdt: { pool: '0x808c3ba97268dbf9695b1ec10729e09c7e67a9e3', token: ADDRESSES.ethereum.USDT }, + dai: { pool: '0xd76b7060f1b646fa14740ff6ac670a4f0a6fc5e3', token: ADDRESSES.ethereum.DAI }, + link: { pool: '0x25567603eb61a4a49f27e433652b5b8940d10682', token: ADDRESSES.ethereum.LINK }, + usdc: { pool: '0x128647690C7733593aA3Dd149EeBC5e256E79217', token: ADDRESSES.ethereum.USDC }, + wbtc: { pool: '0x93948Aa8488F522d5b079AF84fe411FBCE476e9f', token: ADDRESSES.ethereum.WBTC } + }, + bsc: { + null: { pool: '0x170b6AA872166eC2F8515c2B855C34B6C7563c18', token: ADDRESSES.null, }, + usdt: { pool: '0x2A29598cbc17BA112C8Fd0E07Fbf5402eF57E6b8', token: ADDRESSES.bsc.USDT }, + dai: { pool: '0xB67C5433d234d656002f12664d15ab4b40666D9B', token: '0x1af3f329e8be154074d8769d1ffa4ee058b1dbc3' }, + eth: { pool: '0xf86d8218BCC15874f5D25c191FdDd43F2334c3EB', token: ADDRESSES.bsc.ETH }, + usdc: { pool: '0xBA9De5a8FD91408826616f2d6d7470A11E34c9F0', token: ADDRESSES.bsc.USDC }, + btcb: { pool: '0x26d0E4707af1c1DAAd8e9BA21b99cDa7Fd24c40B', token: ADDRESSES.bsc.BTCB }, + busd: { pool: '0x829ED2a2BeF8b72e648f92CBF01587C7E12e8c1e', token: ADDRESSES.bsc.BUSD } + }, + avax: { + null: { pool: '0x446881360d6d39779D292662fca9BC85C5789dB3', token: ADDRESSES.null, }, + eth: { pool: '0x8AbA88E8A4AB28319b782199cB17f0001EE67984', token: ADDRESSES.avax.WETH_e }, + usdt: { pool: '0xE893233515b7D02dD4e3D888162d4C87Dc837943', token: ADDRESSES.avax.USDT_e }, + usdc: { pool: '0x8385Ea36dD4BDC84B3F2ac718C332E18C1E42d36', token: ADDRESSES.avax.USDC_e }, + dai: { pool: '0x34DA42143b0c6E321CEb76931c637c12Bd865f7e', token: ADDRESSES.avax.DAI }, + wbtc: { pool: '0xc4D1e935F02A44D44985E6b1C0eE1ee616fC146a', token: '0x50b7545627a5162F82A992c33b87aDc75187B218' }, + }, + klaytn: { + null: { pool: '0x829fCFb6A6EeA9d14eb4C14FaC5B29874BdBaD13', token: ADDRESSES.null, }, + keth: { pool: '0x07970F9D979D8594B394fE12345211C376aDfF89', token: ADDRESSES.klaytn.oETH }, + kusdt: { pool: '0xe0e67b991d6b5CF73d8A17A10c3DE74616C1ec11', token: ADDRESSES.klaytn.oUSDT }, + kdai: { pool: '0xE03487927e137526a2dB796A9B3b4048ab615043', token: ADDRESSES.klaytn.KDAI }, + usdc: { pool: '0x808c707c53c3D30d0247e4b8D78AA0D8b75CAAE1', token: ADDRESSES.klaytn.oUSDC }, + kwbtc: { pool: '0xa6aDE2e6c6F50a2d9b9C4b819e84b367F88C1598', token: ADDRESSES.klaytn.oWBTC }, + kxrp: { pool: '0x4800577A71F68eD7ef4C09cFBe7fd6E066D5F0dA', token: ADDRESSES.klaytn.oXRP }, + }, + bfc: { + null: { pool: '0x4bAE7ba39E4e71660307dcE780f1Ec9b7B7666Ee', token: ADDRESSES.null, }, + UnifiedETH: { pool: '0xCbf6065954fC17d07b28102c84902F20FFaC0A33', token: ADDRESSES.bfc.UnifiedETH }, + UnifiedBNB: { pool: '0x942A9bF629d1E17D87294B0f20898eEb8316cDd6', token: ADDRESSES.bfc.UnifiedBNB }, + UnifiedUSDC: { pool: '0x168b2D7dd6b9812392f99bA01A14db03ED06dedc', token: ADDRESSES.bfc.UnifiedUSDC }, + UnifiedMATIC: { pool: '0xA1Bd1d501aF7d0B146951fDFF49BD4C0bD25e220', token: ADDRESSES.bfc.UnifiedMATIC }, + UnifiedUSDT: { pool: '0xeD7B0974dC5d98B9e7C83695C415d68b8781B0F8', token: ADDRESSES.bfc.UnifiedUSDT }, + UnifiedDAI: { pool: '0x2168dAb12A6A93181bbAD9C9dc769307C36fB45C', token: ADDRESSES.bfc.UnifiedDAI } + }, } +module.exports = { + bitcoin: { + tvl: bitcoin + }, +}; -const bscPool = '0x170b6AA872166eC2F8515c2B855C34B6C7563c18' -const bscTokenPools = { - 'usdt': { - 'pool': '0x2A29598cbc17BA112C8Fd0E07Fbf5402eF57E6b8', - 'token': ADDRESSES.bsc.USDT - }, - 'dai': { - 'pool': '0xB67C5433d234d656002f12664d15ab4b40666D9B', - 'token': '0x1af3f329e8be154074d8769d1ffa4ee058b1dbc3' - }, - 'eth': { - 'pool': '0xf86d8218BCC15874f5D25c191FdDd43F2334c3EB', - 'token': ADDRESSES.bsc.ETH - }, - 'usdc': { - 'pool': '0xBA9De5a8FD91408826616f2d6d7470A11E34c9F0', - 'token': ADDRESSES.bsc.USDC - }, - 'btcb': { - 'pool': '0x26d0E4707af1c1DAAd8e9BA21b99cDa7Fd24c40B', - 'token': ADDRESSES.bsc.BTCB - }, - 'busd': { - 'pool': '0x829ED2a2BeF8b72e648f92CBF01587C7E12e8c1e', - 'token': ADDRESSES.bsc.BUSD +Object.keys(chainPools).forEach(chain => { + const pools = chainPools[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + return sumTokens2({ api, tokensAndOwners: Object.values(pools).map(({ pool, token }) => ([token, pool,])) }) } -} - -const avaxPool = '0x446881360d6d39779D292662fca9BC85C5789dB3' -const avaxTokenPools = { - 'eth': { - 'pool': '0x8AbA88E8A4AB28319b782199cB17f0001EE67984', - 'token': ADDRESSES.avax.WETH_e - }, - 'usdt': { - 'pool': '0xE893233515b7D02dD4e3D888162d4C87Dc837943', - 'token': ADDRESSES.avax.USDT_e - }, - 'usdc': { - 'pool': '0x8385Ea36dD4BDC84B3F2ac718C332E18C1E42d36', - 'token': ADDRESSES.avax.USDC_e - }, - 'dai': { - 'pool': '0x34DA42143b0c6E321CEb76931c637c12Bd865f7e', - 'token': ADDRESSES.avax.DAI - }, - 'wbtc': { - 'pool': '0xc4D1e935F02A44D44985E6b1C0eE1ee616fC146a', - 'token': '0x50b7545627a5162F82A992c33b87aDc75187B218' - }, -} - -const klayPool = '0x829fCFb6A6EeA9d14eb4C14FaC5B29874BdBaD13'; -const klaytnTokenPools = { - 'keth': { - 'pool': '0x07970F9D979D8594B394fE12345211C376aDfF89', - 'token': ADDRESSES.klaytn.oETH - }, - 'kusdt': { - 'pool': '0xe0e67b991d6b5CF73d8A17A10c3DE74616C1ec11', - 'token': ADDRESSES.klaytn.oUSDT - }, - 'kdai': { - 'pool': '0xE03487927e137526a2dB796A9B3b4048ab615043', - 'token': ADDRESSES.klaytn.KDAI - }, - 'usdc': { - 'pool': '0x808c707c53c3D30d0247e4b8D78AA0D8b75CAAE1', - 'token': ADDRESSES.klaytn.oUSDC - }, - 'kwbtc': { - 'pool': '0xa6aDE2e6c6F50a2d9b9C4b819e84b367F88C1598', - 'token': ADDRESSES.klaytn.oWBTC - }, - 'kxrp': { - 'pool': '0x4800577A71F68eD7ef4C09cFBe7fd6E066D5F0dA', - 'token': ADDRESSES.klaytn.oXRP - }, -} - -async function eth(timestamp, block) { - const toa = Object.values(ethTokenPools).map(({ pool, token}) => ([ token, pool, ])) - toa.push([nullAddress, ethPool]) - return sumTokens2({ block, tokensAndOwners: toa }) -} + } +}) const wbtc = ADDRESSES.ethereum.WBTC async function bitcoin(timestamp, ethBlock) { - const tokenPool = { - 'pool': '0x986Eb51E67e154901ff9B482835788B8f3054076', - 'token': '0x4ca7a5Fb41660A9c5c31683B832A17f7f7457344' - } - let tokenLocked = await sdk.api.erc20.balanceOf({ - owner: tokenPool.pool, - target: tokenPool.token, - block: ethBlock - }); - return { - [wbtc]: tokenLocked.output - } -} - -async function bsc(_, _b, { bsc: block}) { - const toa = Object.values(bscTokenPools).map(({ pool, token}) => ([ token, pool, ])) - toa.push([nullAddress, bscPool]) - return sumTokens2({ block, tokensAndOwners: toa, chain: 'bsc' }) -} - -async function avax(_, _b, { avax: block}) { - const toa = Object.values(avaxTokenPools).map(({ pool, token}) => ([ token, pool, ])) - toa.push([nullAddress, avaxPool]) - return sumTokens2({ block, tokensAndOwners: toa, chain: 'avax' }) + const tokenPool = { + pool: '0x986Eb51E67e154901ff9B482835788B8f3054076', + token: '0x4ca7a5Fb41660A9c5c31683B832A17f7f7457344' + } + let tokenLocked = await sdk.api.erc20.balanceOf({ + owner: tokenPool.pool, + target: tokenPool.token, + block: ethBlock + }); + return { + [wbtc]: tokenLocked.output + } } -async function klaytn(_, _b, { klaytn: block}) { - const toa = Object.values(klaytnTokenPools).map(({ pool, token}) => ([ token, pool, ])) - toa.push([nullAddress, klayPool]) - return sumTokens2({ block, tokensAndOwners: toa, chain: 'klaytn' }) -} - -module.exports = { - ethereum: { - tvl: eth, - staking: stakings(stakingPool, bfcAddr) - }, - bsc: { - tvl: bsc - }, - bitcoin:{ - tvl: bitcoin - }, - avax: { - tvl: avax - }, - klaytn: { - tvl: klaytn - } -} +module.exports.ethereum.staking = stakings(stakingPool, bfcAddr) diff --git a/projects/helper/chains.json b/projects/helper/chains.json index 3770e648dd3..38f3e4e0a7b 100644 --- a/projects/helper/chains.json +++ b/projects/helper/chains.json @@ -12,6 +12,7 @@ "avax", "base", "beam", + "bfc", "bifrost", "binance", "bitcoin", diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index 559ee2d733f..9abc4f76f3f 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -1433,5 +1433,13 @@ "WMC": "0xD51BFa777609213A653a2CD067c9A0132a2D316A", "USDC": "0x76BF5E7d2Bcb06b1444C0a2742780051D8D0E304", "USDT": "0x999f90f25a2922ae1b21A06066F7EDEbedad42a9" + }, + "bfc": { + "UnifiedETH": "0x6c9944674C1D2cF6c4c4999FC7290Ba105dcd70e", + "UnifiedBNB": "0xB800EaF843F962DFe5e145A8c9D07A3e70b11d7F", + "UnifiedUSDC": "0x640952E7984f2ECedeAd8Fd97aA618Ab1210A21C", + "UnifiedMATIC": "0x21ad243b81eff53482F6F6E7C76539f2CfC0B734", + "UnifiedUSDT": "0x3eA8654d5755e673599473ab37d92788B5bA12aE", + "UnifiedDAI": "0xcDB9579Db96EB5C8298dF889D915D0FF668AfF2a" } } diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index f031726bfb5..e61c3bd3278 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -36,7 +36,16 @@ const transformTokens = { // [ADDRESSES.cronos.TUSD]: ADDRESSES.ethereum.TUSD, // }, ronin: { - [ADDRESSES.null]: 'ronin:'+ADDRESSES.ronin.WRON, + [ADDRESSES.null]: 'ronin:' + ADDRESSES.ronin.WRON, + }, + + bfc: { + "0x6c9944674C1D2cF6c4c4999FC7290Ba105dcd70e": ADDRESSES.null, + "0xB800EaF843F962DFe5e145A8c9D07A3e70b11d7F": 'bsc:' + ADDRESSES.null, + "0x640952E7984f2ECedeAd8Fd97aA618Ab1210A21C": ADDRESSES.ethereum.USDC, + "0x21ad243b81eff53482F6F6E7C76539f2CfC0B734": 'polygon:' + ADDRESSES.null, + "0x3eA8654d5755e673599473ab37d92788B5bA12aE": ADDRESSES.ethereum.USDT, + "0xcDB9579Db96EB5C8298dF889D915D0FF668AfF2a": ADDRESSES.ethereum.DAI, } } const ibcMappings = { @@ -93,9 +102,12 @@ const fixBalancesTokens = { [ADDRESSES.beam.USDC]: { coingeckoId: 'usd-coin', decimals: 6 }, [ADDRESSES.beam.USDT]: { coingeckoId: 'tether', decimals: 18 }, }, + bfc: { + [ADDRESSES.null]: { coingeckoId: 'bifrost', decimals: 18 }, + }, renec: { - [ADDRESSES.renec.RENEC] : { coingeckoId: "renec", decimals: 9 }, - [ADDRESSES.renec.REUSD] : {coingeckoId: "tether", decimals: 9 }, // reUSD pegged USDT || bridge: https://remitano.com/swap/vn/usdt_reusd + [ADDRESSES.renec.RENEC]: { coingeckoId: "renec", decimals: 9 }, + [ADDRESSES.renec.REUSD]: { coingeckoId: "tether", decimals: 9 }, // reUSD pegged USDT || bridge: https://remitano.com/swap/vn/usdt_reusd } } From ef66bfd018e5d1a03fbb49a8b836cc2ee28212ae Mon Sep 17 00:00:00 2001 From: Alfred Gaillard Date: Tue, 17 Oct 2023 16:37:06 +0200 Subject: [PATCH 1584/1974] Added TVL (#7741) --- projects/amphor/index.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 projects/amphor/index.js diff --git a/projects/amphor/index.js b/projects/amphor/index.js new file mode 100644 index 00000000000..c0569672916 --- /dev/null +++ b/projects/amphor/index.js @@ -0,0 +1,16 @@ +const { sumERC4626VaultsExport } = require('../helper/erc4626') + +const config = { + ethereum: { + lvTokens: { + "ampr-LP-USD": "0x3b022EdECD65b63288704a6fa33A8B9185b5096b", + } + } +} + +Object.keys(config).forEach(chain => { + const { lvTokens } = config[chain] + module.exports[chain] = { + tvl: sumERC4626VaultsExport({ vaults: Object.values(lvTokens)}) + } +}) From 8dc7415488dc9a8b46b90bb9aa099377a94e967e Mon Sep 17 00:00:00 2001 From: singhalhemant <133655287+singhalhemant@users.noreply.github.com> Date: Tue, 17 Oct 2023 17:10:39 +0100 Subject: [PATCH 1585/1974] Updating the contract address for SUI Bank ID to latest one after the last release (#7742) * Adding Bluefin TVL For SUI * Fixing the base precision for SUI * Updating SUI Bank ID --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/bluefin/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/bluefin/index.js b/projects/bluefin/index.js index f8962dc6dcf..ca17297df9b 100644 --- a/projects/bluefin/index.js +++ b/projects/bluefin/index.js @@ -3,7 +3,7 @@ const { sumTokensExport } = require('../helper/unwrapLPs') const sui = require("../helper/chain/sui"); const SUI_BANK_ID = - "0x5843d63df15cb98b1e1da7951d49bc6cb7fd1728317dc16b54f05b7e43faf912"; + "0x39c65abefaee0a18ffa0e059a0074fcc9910216fa1a3550aa32c2e0ec1c03043"; const Arbitrum_Config = { "endpoint": "0x52b5471d04487fb85B39e3Ae47307f115fe8733F", From 1cf5901f38d34acf907029b0861c9016cd56447e Mon Sep 17 00:00:00 2001 From: llama Date: Tue, 17 Oct 2023 19:49:03 +0200 Subject: [PATCH 1586/1974] track flooring.io --- projects/flooring-io/index.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 projects/flooring-io/index.js diff --git a/projects/flooring-io/index.js b/projects/flooring-io/index.js new file mode 100644 index 00000000000..efb0052f0cf --- /dev/null +++ b/projects/flooring-io/index.js @@ -0,0 +1,12 @@ +const { sumTokensExport } = require('../helper/unwrapLPs') + +module.exports = { + ethereum: { + tvl: sumTokensExport({ + owner: '0x3eb879cc9a0Ef4C6f1d870A40ae187768c278Da2', + tokens: ['0xb6a37b5d14d502c3ab0ae6f3a0e058bc9517786e', '0xfd1b0b0dfa524e1fd42e7d51155a663c581bbd50', '0xbd3531da5cf5857e7cfaa92426877b022e612cf8'], + fetchCoValentTokens: true, + blacklistedTokens: ['0x102c776DDB30C754dEd4fDcC77A19230A60D4e4f', '0x9b947Cc819b00AF2e377C025C3f386fbf3C0055c'], + }) + } +} \ No newline at end of file From 013dfef94762d3a8b6f8ef812373217c03b4920c Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 18 Oct 2023 03:09:48 +0530 Subject: [PATCH 1587/1974] Caviarnine (#7744) * add a radixdlt adapter * removing logs and converting amounts to the right type * fixing the way we iterate over the resources * update the plugin to support multiple components * add docstring * addresing the comments from the reviews * removing not needed logs * pointing to mainnet * pointing to the mainnet * track caviarnine tvl --------- Co-authored-by: Santiago Baldassin Co-authored-by: llama --- projects/caviarnine/index.js | 14 +++++++++++ projects/helper/chain/radixdlt.js | 40 +++++++++++++++++++++++++++++++ projects/helper/chains.json | 1 + projects/helper/coreAssets.json | 7 ++++-- projects/helper/tokenMapping.js | 4 ++++ test.js | 2 +- 6 files changed, 65 insertions(+), 3 deletions(-) create mode 100644 projects/caviarnine/index.js create mode 100644 projects/helper/chain/radixdlt.js diff --git a/projects/caviarnine/index.js b/projects/caviarnine/index.js new file mode 100644 index 00000000000..78fce0480fd --- /dev/null +++ b/projects/caviarnine/index.js @@ -0,0 +1,14 @@ +const { sumTokens } = require('../helper/chain/radixdlt'); +const { getConfig } = require('../helper/cache') +module.exports = { + radixdlt: { + tvl: async (_, _1, _2, { api }) => { + const { shapeliquidity } = await getConfig('caviarnine', 'https://api-core.caviarnine.com/v1.0/shapeliquidity/get_components') + const owners = shapeliquidity.map(i => i.component_address) + return sumTokens({ + owners, api, + }) + }, + }, + timetravel: false +} diff --git a/projects/helper/chain/radixdlt.js b/projects/helper/chain/radixdlt.js new file mode 100644 index 00000000000..51df74f1076 --- /dev/null +++ b/projects/helper/chain/radixdlt.js @@ -0,0 +1,40 @@ +const { post } = require('../http') +const { getUniqueAddresses, } = require('../tokenMapping') +const { getFixBalancesSync } = require('../portedTokens') +const { sliceIntoChunks } = require('../utils') +const chain = 'radixdlt' + +const ENTITY_DETAILS_URL = `https://mainnet.radixdlt.com/state/entity/details` + +async function sumTokens({ owner, owners = [], api, }) { + const fixBalances = getFixBalancesSync(chain) + + if (owner) owners.push(owner) + owners = getUniqueAddresses(owners) + if (!owners.length) return api.getBalances() + let items = [] + const chunks = sliceIntoChunks(owners, 20) + for (const chunk of chunks) { + const body = { + "addresses": chunk, + "opt_ins": { "explicit_metadata": ["name"] } + } + let data = await post(ENTITY_DETAILS_URL, body) + items.push(...data.items) + } + items.forEach((item) => { + item.fungible_resources.items.forEach(({ resource_address, amount }) => { + api.add(resource_address, +amount) + }); + }); + fixBalances(api.getBalances()) +} + +function sumTokensExport(...args) { + return async (_, _1, _2, { api }) => sumTokens({ ...args, api, }) +} + +module.exports = { + sumTokens, + sumTokensExport, +} diff --git a/projects/helper/chains.json b/projects/helper/chains.json index 38f3e4e0a7b..cc26659b725 100644 --- a/projects/helper/chains.json +++ b/projects/helper/chains.json @@ -178,6 +178,7 @@ "pulse", "quicksilver", "quasar", + "radixdlt", "reef", "regen", "rei", diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index 9abc4f76f3f..4610191db5e 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -1420,6 +1420,10 @@ "USDC": "0x49A5010110a358d9069282873F3e7eCf6B41DC10", "USDT": "0x0Cf7c2A584988871b654Bd79f96899e4cd6C41C0" }, + "radixdlt": { + "XRD": "resource_rdx1tknxxxxxxxxxradxrdxxxxxxxxx009923554798xxxxxxxxxradxrd", + "WETH": "resource_rdx1th88qcj5syl9ghka2g9l7tw497vy5x6zaatyvgfkwcfe8n9jt2npww" + }, "shimmer_evm": { "WSMR": "0xBEb654A116aeEf764988DF0C6B4bf67CC869D01b", "USDT": "0xc0E49f8C615d3d4c245970F6Dc528E4A47d69a44" @@ -1427,8 +1431,7 @@ "renec": { "RENEC": "So11111111111111111111111111111111111111112", "REUSD": "4Q89182juiadeFgGw3fupnrwnnDmBhf7e7fHWxnUP3S3" - } - , + }, "beam": { "WMC": "0xD51BFa777609213A653a2CD067c9A0132a2D316A", "USDC": "0x76BF5E7d2Bcb06b1444C0a2742780051D8D0E304", diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index e61c3bd3278..125b21ba9f6 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -59,6 +59,10 @@ const fixBalancesTokens = { ozone: { // '0x83048f0bf34feed8ced419455a4320a735a92e9d': { coingeckoId: "ozonechain", decimals: 18 }, // was mapped to wrong chain }, + radixdlt: { + [ADDRESSES.radixdlt.XRD]: { coingeckoId: 'radix', decimals: 0}, + [ADDRESSES.radixdlt.WETH]: { coingeckoId: 'ethereum', decimals: 0}, + }, mvc: { [ADDRESSES.mvc.SPACE]: { coingeckoId: "microvisionchain", decimals: 8 }, }, diff --git a/test.js b/test.js index 88e05e0f462..7d2ccfb910a 100644 --- a/test.js +++ b/test.js @@ -308,8 +308,8 @@ const axios = require("axios"); const ethereumAddress = "0x0000000000000000000000000000000000000000"; const weth = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"; - function fixBalances(balances) { + Object.entries(balances).forEach(([token, value]) => { let newKey if (token.startsWith("0x")) newKey = `ethereum:${token}` From c7ae0802414b1a26b799f82cf8d0279538dd8bb8 Mon Sep 17 00:00:00 2001 From: llama Date: Wed, 18 Oct 2023 00:15:30 +0200 Subject: [PATCH 1588/1974] track ociswap: https://ociswap.com/ --- projects/caviarnine/index.js | 4 +--- projects/helper/cache.js | 11 ++++++++--- projects/helper/chain/radixdlt.js | 22 +++++++++++++++------- projects/ociswap/index.js | 29 +++++++++++++++++++++++++++++ 4 files changed, 53 insertions(+), 13 deletions(-) create mode 100644 projects/ociswap/index.js diff --git a/projects/caviarnine/index.js b/projects/caviarnine/index.js index 78fce0480fd..b612f403efa 100644 --- a/projects/caviarnine/index.js +++ b/projects/caviarnine/index.js @@ -5,9 +5,7 @@ module.exports = { tvl: async (_, _1, _2, { api }) => { const { shapeliquidity } = await getConfig('caviarnine', 'https://api-core.caviarnine.com/v1.0/shapeliquidity/get_components') const owners = shapeliquidity.map(i => i.component_address) - return sumTokens({ - owners, api, - }) + return sumTokens({ owners, api, }) }, }, timetravel: false diff --git a/projects/helper/cache.js b/projects/helper/cache.js index ab24f5c3b56..89b00ca3f18 100644 --- a/projects/helper/cache.js +++ b/projects/helper/cache.js @@ -57,8 +57,8 @@ async function _setCache(project, chain, json) { await setCache(project, chain, json) } -async function getConfig(project, endpoint) { - if (!project || !endpoint) throw new Error('Missing parameters') +async function getConfig(project, endpoint, { fetcher } = {}) { + if (!project || (!endpoint && !fetcher)) throw new Error('Missing parameters') const key = 'config-cache' const cacheKey = getKey(key, project) if (!configCache[cacheKey]) configCache[cacheKey] = _getConfig() @@ -66,7 +66,12 @@ async function getConfig(project, endpoint) { async function _getConfig() { try { - const { data: json } = await axios.get(endpoint) + let json + if (endpoint) { + json = (await axios.get(endpoint)).data + } else { + json = await fetcher() + } if (!json) throw new Error('Invalid data') await _setCache(key, project, json) return json diff --git a/projects/helper/chain/radixdlt.js b/projects/helper/chain/radixdlt.js index 51df74f1076..ecb03135849 100644 --- a/projects/helper/chain/radixdlt.js +++ b/projects/helper/chain/radixdlt.js @@ -12,8 +12,20 @@ async function sumTokens({ owner, owners = [], api, }) { if (owner) owners.push(owner) owners = getUniqueAddresses(owners) if (!owners.length) return api.getBalances() + console.log('fetching tokens for ', owners.length, 'addresses') + + let items = await queryAddresses({ addresses: owners }) + items.forEach((item) => { + item.fungible_resources.items.forEach(({ resource_address, amount }) => { + api.add(resource_address, +amount) + }); + }); + return fixBalances(api.getBalances()) +} + +async function queryAddresses({ addresses = [], }) { let items = [] - const chunks = sliceIntoChunks(owners, 20) + const chunks = sliceIntoChunks(addresses, 20) for (const chunk of chunks) { const body = { "addresses": chunk, @@ -22,12 +34,7 @@ async function sumTokens({ owner, owners = [], api, }) { let data = await post(ENTITY_DETAILS_URL, body) items.push(...data.items) } - items.forEach((item) => { - item.fungible_resources.items.forEach(({ resource_address, amount }) => { - api.add(resource_address, +amount) - }); - }); - fixBalances(api.getBalances()) + return items } function sumTokensExport(...args) { @@ -35,6 +42,7 @@ function sumTokensExport(...args) { } module.exports = { + queryAddresses, sumTokens, sumTokensExport, } diff --git a/projects/ociswap/index.js b/projects/ociswap/index.js new file mode 100644 index 00000000000..098a8bfdc4e --- /dev/null +++ b/projects/ociswap/index.js @@ -0,0 +1,29 @@ +const { sumTokens, queryAddresses } = require('../helper/chain/radixdlt'); +const { getConfig } = require('../helper/cache') +const { get } = require('../helper/http') +const sdk = require('@defillama/sdk') + +module.exports = { + radixdlt: { + tvl: async (_, _1, _2, { api }) => { + const pools = await getConfig('ociswap', null, { + fetcher: async () => { + let items = [] + let cursor = 0 + do { + const { data, next_cursor } = await get(`https://api.ociswap.com/pools?cursor=${cursor}&limit=100`) + items.push(...data) + sdk.log(`Fetched ${items.length} pools`, data.length, next_cursor) + cursor = next_cursor + + } while (items.length % 100 === 0) + return items + } + }) + const data = await queryAddresses({ addresses: pools.map(i => i.address) }) + const owners = data.map(i => i.metadata.items.find(i => i.key === 'liquidity_pool').value.typed.value) + return sumTokens({ owners, api, }) + }, + }, + timetravel: false +} From 364fc0036f6b23b3c77623c7ae47092ef868acb8 Mon Sep 17 00:00:00 2001 From: PixelSwap - Built on Multi-Chain <142522818+PixelSwapDex@users.noreply.github.com> Date: Wed, 18 Oct 2023 12:48:04 +0700 Subject: [PATCH 1589/1974] List our DEX on Scroll Mainnet (#7746) * abc * Abc * Adding scroll mainnet --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/pixelswap/index.js | 36 ++++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/projects/pixelswap/index.js b/projects/pixelswap/index.js index 6635b2c73d6..c193fcdc756 100644 --- a/projects/pixelswap/index.js +++ b/projects/pixelswap/index.js @@ -4,13 +4,29 @@ const ZKSYNC_FACTORY = "0x8435bd22e705DCeFCf6EF8b921E6dB534a4E9902" const dexTVL = getUniTVL({ factory: FACTORY, useDefaultCoreAssets: true, fetchBalances: true, }) module.exports = { - misrepresentedTokens: true, - methodology: `Uses Uniswap-style factory address to find and price liquidity pairs.`, - base: { tvl: dexTVL, }, - op_bnb: { tvl: dexTVL, }, - linea: { tvl: dexTVL, }, - arbitrum: { tvl: dexTVL, }, - era: { - tvl: getUniTVL({ factory: ZKSYNC_FACTORY, useDefaultCoreAssets: true, fetchBalances: true, }) - } -} \ No newline at end of file + misrepresentedTokens: true, + methodology: `Uses Uniswap-style factory address to find and price liquidity pairs.`, + base: { + tvl: dexTVL, + }, + op_bnb: { + tvl: dexTVL, + }, + linea: { + tvl: dexTVL, + }, + arbitrum: { + tvl: dexTVL, + }, + era: { + tvl: getUniTVL({ + factory: ZKSYNC_FACTORY, + useDefaultCoreAssets: true, + fetchBalances: true, + }) + }, + scroll: { + tvl: dexTVL, + } +}; + From b79078fce639c30db6aa119a859f0e616ea60603 Mon Sep 17 00:00:00 2001 From: syncyieldFinance <148304812+syncyieldFinance@users.noreply.github.com> Date: Wed, 18 Oct 2023 13:50:44 +0800 Subject: [PATCH 1590/1974] List our project on zkSync Era (#7747) --- projects/syncyield/index.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 projects/syncyield/index.js diff --git a/projects/syncyield/index.js b/projects/syncyield/index.js new file mode 100644 index 00000000000..6e3345a832e --- /dev/null +++ b/projects/syncyield/index.js @@ -0,0 +1,18 @@ +const { yieldHelper, } = require("../helper/yieldHelper") +const { mergeExports } = require("../helper/utils") +const vault = '0x0fe9dB37CDB07cda112567EC9a6ba792dF9e3015' +const syn = '0xD0D07097c67fEAB7B79c79959AeEC30766515f10' +const abis ={ + poolInfo: 'function poolInfo(uint256) view returns (address want, uint256, uint256, uint256, uint256, uint256, uint256, uint256 amount, uint256, address strat)', + poolLength: 'function poolLength() view returns (uint256)', + getReservesABI: 'function getReserves() view returns (uint112 _reserve0, uint112 _reserve1)', +} +const syncyield = yieldHelper({ + project: 'syncyield-finance', + chain: 'era', + masterchef: vault, + nativeToken: syn, + abis, + }) +module.exports = mergeExports([syncyield]) + From 1d34b83e47382bb7fd29622d87cd3a7eab24a07d Mon Sep 17 00:00:00 2001 From: llama Date: Wed, 18 Oct 2023 09:47:27 +0200 Subject: [PATCH 1591/1974] thales: track bsc and base --- projects/thales/index.js | 43 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/projects/thales/index.js b/projects/thales/index.js index 01b3cb6a2e3..33750b3ba39 100644 --- a/projects/thales/index.js +++ b/projects/thales/index.js @@ -35,6 +35,19 @@ const arbSportsVault = ["0xfF7AEA98740fA1e2a9eB81680583e62aaFf1e3Ad", "0xE26374c const arbAmmVault = ["0x640c34D9595AD5351Da8c5C833Bbd1AfD20519ea", "0x0A29CddbdAAf56342507574820864dAc967D2683", "0x008A4e30A8b41781F5cb017b197aA9Aa4Cd53b46"] const arbThalesToken = "0xE85B662Fe97e8562f4099d8A1d5A92D4B453bF30" + +const baseMarketManager = "0xc62E56E756a3D14ffF838e820F38d845a16D49dE" +const baseSportsMarketManager = "0xB0EE5C967F209f24f7eF30c2C6Da38346a87E089" +const baseParlayAMM = "0x5625c3233b52206a5f23c5fC1Ce16F6A7e3874dd" +const baseSportsAMM = "0xAFD339acf24813e8038bfdF19A8d87Eb94B4605d" +const baseRangedAMM = "0xB8109ac56EE572990e6d2C6b4648042bB1C33317" +const baseThalesAMM = "0xe41cD3A25CBdeDA0BC46D48C380393D953bD2034" + + +const bscMarketManager = "0xc62E56E756a3D14ffF838e820F38d845a16D49dE" +const bscRangedAMM = "0xda5Bd4aBAFbE249bdC5684eAD594B0ac379687fd" +const bscThalesAMM = "0x465B66A3e33088F0666dB1836652fBcF037c7319" + async function guniPool2(_timestamp, _ethBlock, chainBlocks, { api }) { const [lp, token0, token1] = await api.batchCall([ { target: opThalesLpToken, abi: abi.getUnderlyingBalance, }, @@ -53,6 +66,14 @@ async function addSportsLPTvl(api, contract, token) { api.add(token, await api.call({ target: contract, abi: abi.totalDeposited, })) } +const speedMarkets = { + arbitrum: ['0x02D0123a89Ae6ef27419d5EBb158d1ED4Cf24FA3'], + polygon: ['0x4B1aED25f1877E1E9fBECBd77EeE95BB1679c361'], + optimism: ['0xE16B8a01490835EC1e76bAbbB3Cadd8921b32001'], + base: ['0x85b827d133FEDC36B844b20f4a198dA583B25BAA'], + bsc: ['0x72ca0765d4bE0529377d656c9645600606214610'], +} + module.exports = { methodology: "sUSD/USDC locked on markets", ethereum: { @@ -65,6 +86,7 @@ module.exports = { tvl: async (_, _1, _2, { api }) => { const markets = await getMarkets(api, polygonMarketsManager) markets.push(polygonThalesAmm, polygonRangedAMM) + if (speedMarkets[api.chain]) markets.push(...speedMarkets[api.chain]) return sumTokens2({ api, owners: markets, tokens: [polygon_USDC] }) }, }, @@ -73,6 +95,7 @@ module.exports = { await addSportsLPTvl(api, opSportsLp, OP_SUSD) const markets = (await Promise.all([opMarketsManager, opSportsMarketsManager,].map(i => getMarkets(api, i)))).flat() markets.push(opThalesAmm, opParlayAmm, opRangedAmm, ...opSportsVault, ...opAmmVault) + if (speedMarkets[api.chain]) markets.push(...speedMarkets[api.chain]) return sumTokens2({ api, tokens: [OP_SUSD], owners: markets }) }, staking: staking(opThalesStaking, opThalesToken), @@ -83,8 +106,26 @@ module.exports = { await addSportsLPTvl(api, arbSportsLp, arbitrum_USDC) const markets = (await Promise.all([arbitrumMarketsManager, arbSportsMarketsManager,].map(i => getMarkets(api, i)))).flat() markets.push(arbitrumThalesAMM, arbParlayAmm, ...arbSportsVault, ...arbAmmVault) + if (speedMarkets[api.chain]) markets.push(...speedMarkets[api.chain]) return sumTokens2({ api, tokens: [arbitrum_USDC], owners: markets }) }, staking: staking(arbThalesStaking, arbThalesToken), }, -} \ No newline at end of file + base: { + tvl: async (_, _1, _2, { api }) => { + const markets = (await Promise.all([baseMarketManager, baseSportsMarketManager,].map(i => getMarkets(api, i)))).flat() + markets.push(baseParlayAMM, baseRangedAMM, baseSportsAMM, baseThalesAMM) + if (speedMarkets[api.chain]) markets.push(...speedMarkets[api.chain]) + return sumTokens2({ api, tokens: [ADDRESSES.base.USDbC], owners: markets }) + }, + staking: staking('0x84aB38e42D8Da33b480762cCa543eEcA6135E040', '0xf34e0cff046e154cafcae502c7541b9e5fd8c249'), + }, + bsc: { + tvl: async (_, _1, _2, { api }) => { + const markets = (await Promise.all([bscMarketManager,].map(i => getMarkets(api, i)))).flat() + markets.push( bscRangedAMM, bscThalesAMM) + if (speedMarkets[api.chain]) markets.push(...speedMarkets[api.chain]) + return sumTokens2({ api, tokens: [ADDRESSES.bsc.BUSD], owners: markets }) + }, + }, +} From 1063c7869b7d5e39bedbe282a6fc1a9b48bcddee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vuka=C5=A1in=20Manojlovi=C4=87?= Date: Wed, 18 Oct 2023 11:28:55 +0200 Subject: [PATCH 1592/1974] Add WBTC collateral for Raft (#7751) --- projects/raft/index.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/projects/raft/index.js b/projects/raft/index.js index 3f1c4cd33ec..effd23617e6 100644 --- a/projects/raft/index.js +++ b/projects/raft/index.js @@ -11,7 +11,6 @@ const CHAI = "0x06af07097c9eeb7fd685c692751d5c66db49c215"; const SWETH = '0xf951E335afb289353dc249e82926178EaC7DEd78' async function tvl(_, ethBlock, _1, { api }) { - const rEthBalanceV1 = await api.call({ target: WRAPPED_RETH, abi: "erc20:balanceOf", params: RAFT_POSITION_MANAGER, }); const chaiBalance = await api.call({ target: CHAI, abi: "erc20:balanceOf", params: RAFT_PSM, }); const potAddress = await api.call({ target: CHAI, abi: "address:pot", }); @@ -22,8 +21,18 @@ async function tvl(_, ethBlock, _1, { api }) { api.add(ADDRESSES.ethereum.RETH, rEthBalanceV1) return api.sumTokens({ ownerTokens: [ - [[ADDRESSES.ethereum.RETH, ADDRESSES.ethereum.WETH, ADDRESSES.ethereum.WSTETH, ADDRESSES.ethereum.cbETH, SWETH], INTEREST_RATE_POSITION_MANAGER_ADDRESS], - [[ADDRESSES.ethereum.RETH, ADDRESSES.ethereum.WETH, ADDRESSES.ethereum.WSTETH, ], RAFT_POSITION_MANAGER], + [ + [ + ADDRESSES.ethereum.RETH, + ADDRESSES.ethereum.WETH, + ADDRESSES.ethereum.WSTETH, + ADDRESSES.ethereum.cbETH, + ADDRESSES.ethereum.WBTC, + SWETH, + ], + INTEREST_RATE_POSITION_MANAGER_ADDRESS, + ], + [[ADDRESSES.ethereum.WSTETH], RAFT_POSITION_MANAGER], ]}) } From 2c450e16a3e234fea654dd1b69e2a63898f0d034 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 18 Oct 2023 15:02:52 +0530 Subject: [PATCH 1593/1974] Baryon (#7753) --- projects/baryon/index.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/projects/baryon/index.js b/projects/baryon/index.js index 326fd473442..9b6e4fe7172 100644 --- a/projects/baryon/index.js +++ b/projects/baryon/index.js @@ -7,5 +7,12 @@ module.exports = { factory: '0x03879e2a3944fd601e7638dfcbc9253fb793b599', useDefaultCoreAssets: true, }) + }, + tomochain: { + misrepresentedTokens: true, + tvl: getUniTVL({ + factory: '0xFe48A2E66EE2f90334d3565E56E0c9d0081447e8', + useDefaultCoreAssets: true, + }) } } \ No newline at end of file From 3bf6b8d2d1845c5222f83a579f424271668bfcfc Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 18 Oct 2023 15:08:25 +0530 Subject: [PATCH 1594/1974] Paradex (#7754) --- projects/paradex/index.js | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 projects/paradex/index.js diff --git a/projects/paradex/index.js b/projects/paradex/index.js new file mode 100644 index 00000000000..574acd512e4 --- /dev/null +++ b/projects/paradex/index.js @@ -0,0 +1,10 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require('../helper/unwrapLPs'); + +const contracts = [ + '0xE3cbE3A636AB6A754e9e41B12b09d09Ce9E53Db3' +]; + +module.exports = { + ethereum: { tvl: sumTokensExport({ owners: contracts, tokens: [ADDRESSES.ethereum.USDC] }) } +}; From 9eaa72946333132f6de871a4f35791e9677d160c Mon Sep 17 00:00:00 2001 From: JoscelynFarr <130961775+JoscelynFarr@users.noreply.github.com> Date: Wed, 18 Oct 2023 17:42:33 +0800 Subject: [PATCH 1595/1974] update jojo TVL (#7749) * update jojo TVL * fix jojo --------- Co-authored-by: llama --- projects/helper/coreAssets.json | 1 + projects/jojo/index.js | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index 4610191db5e..fe2f01ac63d 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -245,6 +245,7 @@ "fsGLP": "0x1addd80e6039594ee970e5872d247bf0414c8903", "fGLP": "0x4e971a87900b931ff39d1aad67697f49835400b6", "GMX": "0xfc5A1A6EB076a2C7aD06eD22C90d7E710E35ad0a", + "WSTETH": "0x5979D7b546E38E414F7E9822514be443A4800529", "plvGLP": "0x5326e71ff593ecc2cf7acae5fe57582d6e74cff1" }, "fuse": { diff --git a/projects/jojo/index.js b/projects/jojo/index.js index 5fb852df6a9..ca266d0c788 100644 --- a/projects/jojo/index.js +++ b/projects/jojo/index.js @@ -4,5 +4,9 @@ const { sumTokensExport } = require('../helper/unwrapLPs') module.exports = { era: { tvl: sumTokensExport({ tokens: [ADDRESSES.era.USDC], owners: ['0x47eAD228547db8397398C1D3aAfd0847CBEbddeC'], }) }, bsc: { tvl: sumTokensExport({ tokens: [ADDRESSES.bsc.USDC], owners: ['0x25173BB47CB712cFCDFc13ECBebDAd753090801E'], }) }, - arbitrum: { tvl: sumTokensExport({ tokens: [ADDRESSES.arbitrum.USDC], owners: ['0xcDf9eED57Fe8dFaaCeCf40699E5861517143bcC7'], }) }, + arbitrum: { tvl: sumTokensExport( + {tokens: [ADDRESSES.arbitrum.USDC, ADDRESSES.arbitrum.WETH, ADDRESSES.arbitrum.WBTC, + ADDRESSES.arbitrum.ARB, ADDRESSES.arbitrum.GMX, ADDRESSES.arbitrum.WSTETH, '0x539bde0d7dbd336b79148aa742883198bbf60342'], + owners: ['0xcDf9eED57Fe8dFaaCeCf40699E5861517143bcC7','0x747282eadcd331e3a8725DcD9e358514D723b3a3']} + ) }, }; From 9c5edf08be659a54bb67868c485aca8ab1195f28 Mon Sep 17 00:00:00 2001 From: denge jbam Date: Wed, 18 Oct 2023 18:42:59 +0900 Subject: [PATCH 1596/1974] fix: add xpla to ibcChains (#7748) --- projects/helper/tokenMapping.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 125b21ba9f6..b01bc01dda0 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -16,7 +16,7 @@ coreAssets = JSON.parse(JSON.stringify(coreAssets)) // carbon: https://api-insights.carbon.network/info/denom_gecko_map // orbit brige: https://bridge.orbitchain.io/open/v1/api/monitor/rawTokenList -const ibcChains = ['ibc', 'terra', 'terra2', 'crescent', 'osmosis', 'kujira', 'stargaze', 'juno', 'injective', 'cosmos', 'comdex', 'umee', 'orai', 'persistence', 'fxcore', 'neutron', 'quasar', 'chihuahua', 'sei', 'archway', 'migaloo', 'secret', 'aura'] +const ibcChains = ['ibc', 'terra', 'terra2', 'crescent', 'osmosis', 'kujira', 'stargaze', 'juno', 'injective', 'cosmos', 'comdex', 'umee', 'orai', 'persistence', 'fxcore', 'neutron', 'quasar', 'chihuahua', 'sei', 'archway', 'migaloo', 'secret', 'aura', 'xpla'] const caseSensitiveChains = [...ibcChains, 'solana', 'tezos', 'ton', 'algorand', 'aptos', 'near', 'bitcoin', 'waves', 'tron', 'litecoin', 'polkadot', 'ripple', 'elrond', 'cardano', 'stacks', 'sui', 'ergo', 'mvc',] const distressedAssts = new Set(Object.values({ From a7882ce5a0c6ad6c13a307cbf6e85f5296b718dd Mon Sep 17 00:00:00 2001 From: Aleksei Lushnikov Date: Wed, 18 Oct 2023 11:41:48 +0100 Subject: [PATCH 1597/1974] symbiosis adds Scroll chain (#7755) --- projects/helper/coreAssets.json | 3 +++ projects/symbiosis-finance/config.js | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index fe2f01ac63d..5f6da57fb66 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -1445,5 +1445,8 @@ "UnifiedMATIC": "0x21ad243b81eff53482F6F6E7C76539f2CfC0B734", "UnifiedUSDT": "0x3eA8654d5755e673599473ab37d92788B5bA12aE", "UnifiedDAI": "0xcDB9579Db96EB5C8298dF889D915D0FF668AfF2a" + }, + "scroll": { + "WETH": "0x5300000000000000000000000000000000000004" } } diff --git a/projects/symbiosis-finance/config.js b/projects/symbiosis-finance/config.js index b5846f78fc0..4b57d7d686f 100644 --- a/projects/symbiosis-finance/config.js +++ b/projects/symbiosis-finance/config.js @@ -214,5 +214,14 @@ module.exports = { 'TGsN2VVJRXLbNe33QbWeaMtpb6xxC7SUeq', // portal v2 ] }, + { + name: 'scroll', + tokens: [ + ADDRESSES.scroll.WETH, + ], + holders: [ + '0x5Aa5f7f84eD0E5db0a4a85C3947eA16B53352FD4', // portal v2 + ] + }, ] } \ No newline at end of file From ed3d96da24cb9c0070e28d3433d4b2345db387ad Mon Sep 17 00:00:00 2001 From: suipearl <148339852+suipearl@users.noreply.github.com> Date: Wed, 18 Oct 2023 18:14:24 +0700 Subject: [PATCH 1598/1974] Add Suipearl Adapter (#7757) --- projects/sui-pearl/index.js | 157 ++++++++++++++++++++++++++++++++++++ 1 file changed, 157 insertions(+) create mode 100644 projects/sui-pearl/index.js diff --git a/projects/sui-pearl/index.js b/projects/sui-pearl/index.js new file mode 100644 index 00000000000..3208368cb64 --- /dev/null +++ b/projects/sui-pearl/index.js @@ -0,0 +1,157 @@ +const { default: BigNumber } = require("bignumber.js"); +const flowxFinance = require("../flowx-finance"); +const sui = require("../helper/chain/sui"); + +async function suiTVL() { + const { api } = arguments[3]; + + //get list pool flowx + const listPoolFlowX = ( + await sui.getDynamicFieldObjects({ + parent: + "0xd15e209f5a250d6055c264975fee57ec09bf9d6acdda3b5f866f76023d1563e6", + }) + ).map((i) => i.fields.value.fields); + + //get list pool after match + const afterMathPools = await sui.queryEvents({ + eventType: + "0xefe170ec0be4d762196bedecd7a065816576198a6527c99282a2551aaa7da38c::events::CreatedPoolEvent", + transform: (i) => i.pool_id, + }); + const afterMathData = await sui.getObjects(afterMathPools); + + //get list pool suipearl + const poolDynamicField = await sui.getDynamicFieldObjects({ + parent: + "0xa58b809407a212793628a0aa2603611a12454d766ff47c1d76487ceec74204db", + }); + const listPoolObjectId = poolDynamicField.map((i) => i.fields.id.id); + const listPoolStaked = poolDynamicField.map( + (i) => i.fields.value.fields.total_token_staked + ); + + const poolDynamicType = (await sui.getObjects(listPoolObjectId)).map( + (i) => i.fields.value.fields.id.id + ); + + const listType = []; + for (const poolIndex in poolDynamicType) { + let poolInfo = await sui.getDynamicFieldObjects({ + parent: poolDynamicType[poolIndex], + }); + listType.push({ + type: poolInfo.find((item) => item.type.includes("CustodianDfKey")).fields + .value.type, + staked: listPoolStaked[poolIndex], + }); + } + + let totalResult = {}; + for (const suiPearlLpType of listType) { + if (suiPearlLpType.type.includes("::af_lp::AF_LP")) { + let result = afterMathTVL( + afterMathData, + suiPearlLpType.type, + suiPearlLpType.staked + ); + for (const property in result) { + if (totalResult[property]) { + totalResult[property] = totalResult[property].plus(result[property]); + } else { + totalResult[property] = result[property]; + } + } + } else if ( + suiPearlLpType.type.includes( + "0xba153169476e8c3114962261d1edc70de5ad9781b83cc617ecc8c1923191cae0::pair::LP" + ) + ) { + let result = flowxTVL( + listPoolFlowX, + suiPearlLpType.type, + suiPearlLpType.staked + ); + + for (const property in result) { + if (totalResult[property]) { + totalResult[property] = totalResult[property].plus(result[property]); + } else { + totalResult[property] = result[property]; + } + } + } + } + + for (const property in totalResult) { + api.add(property, totalResult[property].toFixed(0)); + } +} + +const afterMathTVL = (listPoolAftermath, suiPearlLpType, staked) => { + const coinMap = {}; + + const afterMathPoolInfo = listPoolAftermath.find((item) => + item.fields.lp_supply.type.includes( + suiPearlLpType + .replace( + "0xf794e590fb6a42aee87837631e6ff9c006397503d64a1d3f69bfb3938a118b9e::custodian::Custodian<", + "" + ) + .replace(">", "") + ) + ); + + const lpRate = new BigNumber(staked).div( + afterMathPoolInfo.fields.lp_supply.fields.value + ); + + for (const tokenTypeIndex in afterMathPoolInfo.fields.type_names) { + coinMap["0x" + afterMathPoolInfo.fields.type_names[tokenTypeIndex]] = lpRate + .multipliedBy( + afterMathPoolInfo.fields.normalized_balances[tokenTypeIndex] + ) + .dividedBy(afterMathPoolInfo.fields.decimal_scalars[tokenTypeIndex]); + } + + return coinMap; +}; + +const flowxTVL = (listPoolFlowX, suiPearlLpType, staked) => { + const flowxPoolInfo = listPoolFlowX.find((item) => + item.lp_supply.type.includes( + suiPearlLpType + .replace( + "0xf794e590fb6a42aee87837631e6ff9c006397503d64a1d3f69bfb3938a118b9e::custodian::Custodian<", + "" + ) + .replace(">>", "") + ) + ); + + const lpRate = new BigNumber(staked).div( + flowxPoolInfo.lp_supply.fields.value + ); + const amountX = lpRate.multipliedBy(flowxPoolInfo.reserve_x.fields.balance); + + const amountY = lpRate.multipliedBy(flowxPoolInfo.reserve_y.fields.balance); + + const coinX = flowxPoolInfo.reserve_x.type + .replace("0x2::coin::Coin<", "") + .replace(">", ""); + + const coinY = flowxPoolInfo.reserve_y.type + .replace("0x2::coin::Coin<", "") + .replace(">", ""); + + const coinMap = {}; + coinMap[coinX] = amountX; + coinMap[coinY] = amountY; + return coinMap; +}; + +module.exports = { + sui: { + tvl: suiTVL, + }, +}; From fe3f8e12ee3006310143dcfbb91238c1f2be864c Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 18 Oct 2023 18:30:03 +0530 Subject: [PATCH 1599/1974] Dx25 (#7759) --- projects/dx25/index.js | 8 ++++++++ projects/helper/chain/elrond.js | 2 ++ 2 files changed, 10 insertions(+) create mode 100644 projects/dx25/index.js diff --git a/projects/dx25/index.js b/projects/dx25/index.js new file mode 100644 index 00000000000..48c8e9141d5 --- /dev/null +++ b/projects/dx25/index.js @@ -0,0 +1,8 @@ +const { sumTokensExport } = require('../helper/sumTokens') + +module.exports = { + timetravel: false, + elrond: { + tvl: sumTokensExport({ owner: 'erd1qqqqqqqqqqqqqpgqqc6w62sshakjk38lunc8w6f5m7rujkdgaehsdszqrg',}), + }, +}; \ No newline at end of file diff --git a/projects/helper/chain/elrond.js b/projects/helper/chain/elrond.js index af22209a263..8b7314a538c 100644 --- a/projects/helper/chain/elrond.js +++ b/projects/helper/chain/elrond.js @@ -4,6 +4,7 @@ const { transformBalances } = require('../portedTokens') const sdk = require('@defillama/sdk') const { post } = require('../http') const { getEnv } = require('../env') +const { getUniqueAddresses } = require('../utils') const call = async ({ target, abi, params = [], responseTypes = [] }) => { const data = await post(getEnv('MULTIVERSX_RPC') + '/query', { scAddress: target, funcName: abi, args: params, }) @@ -57,6 +58,7 @@ async function getTokens({ address, balances = {}, tokens = [], blacklistedToken async function sumTokens({ owner, owners = [], tokens = [], balances = {}, blacklistedTokens = [], tokensAndOwners = [], whitelistedTokens = [] }) { if (owner) owners.push(owner) + owners = getUniqueAddresses(owners, true) if (tokensAndOwners.length) { await Promise.all(tokensAndOwners.map(([token, owner]) => sumTokens({ owners: [owner], tokens: [token], balances, blacklistedTokens, whitelistedTokens, }))) return balances From 049c42494adbb0c29fb620eefc62cf5dd8b858dc Mon Sep 17 00:00:00 2001 From: llama Date: Wed, 18 Oct 2023 17:26:02 +0200 Subject: [PATCH 1600/1974] add hallmark --- projects/hope-lend/index.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/projects/hope-lend/index.js b/projects/hope-lend/index.js index 11c69085c24..f40f2632f11 100644 --- a/projects/hope-lend/index.js +++ b/projects/hope-lend/index.js @@ -1,9 +1,14 @@ const { aaveExports } = require('../helper/aave'); module.exports = { - ethereum: aaveExports("ethereum", "0x53FbcADa1201A465740F2d64eCdF6FAC425f9030", id=>id, ['0x17b5896703b36879A037Aa94F08622ab113C0AD4'], { - abis: { - getAllATokens: 'function getAllHTokens() view returns (tuple(string symbol, address tokenAddress)[])', - } - }), -}; \ No newline at end of file + ethereum: aaveExports("ethereum", "0x53FbcADa1201A465740F2d64eCdF6FAC425f9030", id => id, ['0x17b5896703b36879A037Aa94F08622ab113C0AD4'], { + abis: { + getAllATokens: 'function getAllHTokens() view returns (tuple(string symbol, address tokenAddress)[])', + } + }), + hallmarks: [ + [Math.floor(new Date('2023-10-18')/1e3), 'Protocol was hacked!'], + ], +}; + +delete module.exports.ethereum.borrowed \ No newline at end of file From 6537e45b785dd9463137d7d36bbe761c3117591f Mon Sep 17 00:00:00 2001 From: llama Date: Wed, 18 Oct 2023 18:22:57 +0200 Subject: [PATCH 1601/1974] update starsarena --- projects/maker/index.js | 12 ++++++++++-- projects/starshares/index.js | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/projects/maker/index.js b/projects/maker/index.js index 206b8bc0cad..d749aea909e 100644 --- a/projects/maker/index.js +++ b/projects/maker/index.js @@ -91,8 +91,16 @@ async function tvl(timestamp, block, _, { api }) { const gUNIToa = toa.filter((_, i) => symbols[i] === 'G-UNI') toa = toa.filter((_, i) => symbols[i] !== 'G-UNI') - const balances = await sumTokens2({ api, tokensAndOwners: toa, }) - return unwrapGunis({ api, toa: gUNIToa, balances, }) + const balances = await sumTokens2({ api, tokensAndOwners: toa, resolveLP: true, }) + await unwrapGunis({ api, toa: gUNIToa, balances, }) + + // remove RWAs + const tokens = Object.keys(balances).filter(i => i.startsWith('ethereum:')).map(i => i.split(':')[1]) + const tSymbols = await api.multiCall({ abi: 'string:symbol', calls: tokens, permitFailure: true, }) + tSymbols.forEach((v, i) => { + if (v && v.startsWith('RWA')) sdk.util.removeTokenBalance(balances, tokens[i]) + }) + return balances } async function unwrapGunis({ api, toa, balances = {} }) { diff --git a/projects/starshares/index.js b/projects/starshares/index.js index f1ed3ae3997..0586a88ccb4 100644 --- a/projects/starshares/index.js +++ b/projects/starshares/index.js @@ -3,7 +3,7 @@ const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') const contract = "0xa481b139a1a654ca19d2074f174f17d7534e8cec" async function tvl(time, ethBlock, _b, {api}) { - return sumTokens2({ tokens: [nullAddress], owner: contract, api }) + return sumTokens2({ tokens: [nullAddress], owners: [contract, '0x563395A2a04a7aE0421d34d62ae67623cAF67D03'], api }) } module.exports = { From 0e5cf9bf9edf4adfe7a610d1bcd7a4ebc4a1625a Mon Sep 17 00:00:00 2001 From: Timan Rebel Date: Wed, 18 Oct 2023 18:26:30 +0200 Subject: [PATCH 1602/1974] Update DefiPlaza to add `radixdlt` and updated Logo (#7761) * feat: add radixdlt to defiplaza * fix: add defiplaza caching --- projects/defiplaza.js | 45 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 37 insertions(+), 8 deletions(-) diff --git a/projects/defiplaza.js b/projects/defiplaza.js index e58f93cf19a..747004157d2 100644 --- a/projects/defiplaza.js +++ b/projects/defiplaza.js @@ -1,15 +1,44 @@ -const { cachedGraphQuery } = require('./helper/cache') +const { cachedGraphQuery } = require('./helper/cache'); -const graphUrl = 'https://api.thegraph.com/subgraphs/name/omegasyndicate/defiplaza'; +const { sumTokens, queryAddresses } = require('./helper/chain/radixdlt'); +const { getConfig } = require('./helper/cache'); +const { get } = require('./helper/http'); +const sdk = require('@defillama/sdk'); -async function tvl(timestamp, block, _, { api }) { - const { pools } = await cachedGraphQuery('defiplaza', graphUrl, '{ pools { id tokens { id } }}'); - const ownerTokens = pools.map(pool => [pool.tokens.map(token => token.id), pool.id]); - return api.sumTokens({ ownerTokens}) -} +const graphUrl = 'https://api.thegraph.com/subgraphs/name/omegasyndicate/defiplaza'; module.exports = { ethereum: { - tvl, + tvl: async (timestamp, block, _, { api }) => { + const { pools } = await cachedGraphQuery('defiplaza-ethereum', graphUrl, '{ pools { id tokens { id } }}'); + const ownerTokens = pools.map((pool) => [pool.tokens.map((token) => token.id), pool.id]); + return api.sumTokens({ ownerTokens }); + }, + }, + radixdlt: { + tvl: async (_, _1, _2, { api }) => { + const pools = await getConfig('defiplaza-radixdlt', null, { + fetcher: async () => { + let items = []; + let cursor = 0; + do { + const { data, next_cursor } = await get(`https://radix.defiplaza.net/api/pairs?cursor=${cursor}&limit=100`); + items.push(...data); + sdk.log(`Fetched ${items.length} pools`, data.length, next_cursor); + cursor = next_cursor; + } while (items.length % 100 === 0); + + return items; + } + }); + const data = await queryAddresses({ addresses: pools.map((i) => i.address) }); + const owners = []; + data.forEach((c) => { + owners.push(c.details.state.fields.find((i) => i.field_name === 'base_pool').value); + owners.push(c.details.state.fields.find((i) => i.field_name === 'quote_pool').value); + }); + return sumTokens({ owners, api }); + }, }, + timetravel: false, }; From f77a28ebbd6bb032581e4c44a32e78986df4c83b Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 18 Oct 2023 22:05:52 +0530 Subject: [PATCH 1603/1974] Loanshark (#7763) * Loanshark Protocol Adapter * code refactor * mior fix --------- Co-authored-by: Jay Cheung Chun Man Co-authored-by: llama --- projects/helper/compound.js | 6 +++--- projects/loanshark/index.js | 7 +++++++ 2 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 projects/loanshark/index.js diff --git a/projects/helper/compound.js b/projects/helper/compound.js index 453ca478faa..a9532505824 100644 --- a/projects/helper/compound.js +++ b/projects/helper/compound.js @@ -4,7 +4,7 @@ const sdk = require('@defillama/sdk'); const abi = require('./abis/compound.json'); const { unwrapUniswapLPs } = require('./unwrapLPs'); const { requery } = require("./requery"); -const { getChainTransform, getFixBalances, } = require('./portedTokens'); +const { getChainTransform, transformBalances } = require('./portedTokens'); const { usdtAddress } = require('./balances'); const agoraAbi = require("./../agora/abi.json"); const { sumTokens2, nullAddress, unwrapLPsAuto, } = require('./unwrapLPs') @@ -168,9 +168,9 @@ function getCompoundV2Tvl(comptroller, chain, transformAdress, await unwrapUniswapLPs(balances, lpPositions, block, chain, transformAdress) } - if (resolveLPs) return unwrapLPsAuto({ balances, block, chain, abis}) + if (resolveLPs) await unwrapLPsAuto({ balances, block, chain, abis}) - return balances; + return transformBalances(chain, balances); } } diff --git a/projects/loanshark/index.js b/projects/loanshark/index.js new file mode 100644 index 00000000000..a9c6afdea99 --- /dev/null +++ b/projects/loanshark/index.js @@ -0,0 +1,7 @@ +const { compoundExports2 } = require('../helper/compound') +const comptroller = '0xEFB0697700E5c489073a9BDF7EF94a2B2bc884a5' +const cether = '0xF017f9CF11558d143E603d56Ec81E4E3B6d39D7F' + +module.exports = { + scroll: compoundExports2({ comptroller, cether, }) +}; From 156a0f0b76946d9626599e7100e068803cbb0735 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vuka=C5=A1in=20Manojlovi=C4=87?= Date: Wed, 18 Oct 2023 18:49:40 +0200 Subject: [PATCH 1604/1974] Add two versions of Nostra (production and alpha) (#7762) --- projects/nostra-alpha/abi.js | 34 +++++++++++++ projects/nostra-alpha/index.js | 84 ++++++++++++++++++++++++++++++++ projects/nostra/index.js | 89 +++++++++++++++++++++++++++------- 3 files changed, 190 insertions(+), 17 deletions(-) create mode 100644 projects/nostra-alpha/abi.js create mode 100644 projects/nostra-alpha/index.js diff --git a/projects/nostra-alpha/abi.js b/projects/nostra-alpha/abi.js new file mode 100644 index 00000000000..176d94dc942 --- /dev/null +++ b/projects/nostra-alpha/abi.js @@ -0,0 +1,34 @@ +const assetToken = [ + { + "name": "underlyingAsset", + "type": "function", + "inputs": [], + "outputs": [ + { + "name": "_underlyingAsset", + "type": "felt" + } + ], + "stateMutability": "view", + "customType": "address" + }, + { + "name": "totalSupply", + "type": "function", + "inputs": [], + "outputs": [ + { + "name": "totalSupply", + "type": "Uint256" + } + ], + "stateMutability": "view" + } +] + +const assetTokenAbi = {} +assetToken.forEach(i => assetTokenAbi[i.name] = i) + +module.exports = { + assetTokenAbi +} \ No newline at end of file diff --git a/projects/nostra-alpha/index.js b/projects/nostra-alpha/index.js new file mode 100644 index 00000000000..29f411ebddc --- /dev/null +++ b/projects/nostra-alpha/index.js @@ -0,0 +1,84 @@ +const { multiCall } = require("../helper/chain/starknet"); +const { assetTokenAbi } = require("./abi"); + +const supplyTokens = [ + // WBTC + "0x0061d892cccf43daf73407194da9f0ea6dbece950bb24c50be2356444313a707", + "0x00687b5d9e591844169bc6ad7d7256c4867a10cee6599625b9d78ea17a7caef9", + "0x07788bc687f203b6451f2a82e842b27f39c7cae697dace12edfb86c9b1c12f3d", + "0x06b59e2a746e141f90ec8b6e88e695265567ab3bdcf27059b4a15c89b0b7bd53", + // ETH + "0x002f8deaebb9da2cb53771b9e2c6d67265d11a4e745ebd74a726b8859c9337b9", + "0x070f8a4fcd75190661ca09a7300b7c93fab93971b67ea712c664d7948a8a54c6", + "0x04f89253e37ca0ab7190b2e9565808f105585c9cacca6b2fa6145553fa061a41", + "0x0553cea5d1dc0e0157ffcd36a51a0ced717efdadd5ef1b4644352bb45bd35453", + // USDC + "0x06af9a313434c0987f5952277f1ac8c61dc4d50b8b009539891ed8aaee5d041d", + "0x029959a546dda754dc823a7b8aa65862c5825faeaaf7938741d8ca6bfdc69e4e", + "0x05327df4c669cb9be5c1e2cf79e121edef43c1416fac884559cd94fcb7e6e232", + "0x047e794d7c49c49fd2104a724cfa69a92c5a4b50a5753163802617394e973833", + // DAI + "0x00b9b1a4373de5b1458e598df53195ea3204aa926f46198b50b32ed843ce508b", + "0x01ac55cabf2b79cf39b17ba0b43540a64205781c4b7850e881014aea6f89be58", + "0x02ea39ba7a05f0c936b7468d8bc8d0e1f2116916064e7e163e7c1044d95bd135", + "0x04403e420521e7a4ca0dc5192af81ca0bb36de343564a9495e11c8d9ba6e9d17", + // USDT + "0x06404c8e886fea27590710bb0e0e8c7a3e7d74afccc60663beb82707495f8609", + "0x055ba2baf189b98c59f6951a584a3a7d7d6ff2c4ef88639794e739557e1876f0", + "0x040375d0720245bc0d123aa35dc1c93d14a78f64456eff75f63757d99a0e6a83", + "0x003cd2066f3c8b4677741b39db13acebba843bbbaa73d657412102ab4fd98601", +]; +const debtTokens = [ + "0x075b0d87aca8dee25df35cdc39a82b406168fa23a76fc3f03abbfdc6620bb6d7", + "0x040b091cb020d91f4a4b34396946b4d4e2a450dbd9410432ebdbfe10e55ee5e5", + "0x03b6058a9f6029b519bc72b2cc31bcb93ca704d0ab79fec2ae5d43f79ac07f7a", + "0x0362b4455f5f4cc108a5a1ab1fd2cc6c4f0c70597abb541a99cf2734435ec9cb", + "0x065c6c7119b738247583286021ea05acc6417aa86d391dcdda21843c1fc6e9c6", +]; + +function* chunks(arr, n) { + for (let i = 0; i < arr.length; i += n) { + yield arr.slice(i, i + n); + } +} + +async function tvl(_, _1, _2, { api }) { + const supplied = await multiCall({ + calls: supplyTokens, + abi: assetTokenAbi.totalSupply, + }); + const borrowed = await multiCall({ + calls: debtTokens, + abi: assetTokenAbi.totalSupply, + }); + const underlyings = await multiCall({ + calls: debtTokens, + abi: assetTokenAbi.underlyingAsset, + }); + const data = [...chunks(supplied, 4)].map((chunk, i) => { + const totalSupply = chunk.reduce((acc, cur) => acc + cur, 0); + return totalSupply - borrowed[i]; + }); + api.addTokens(underlyings, data); +} + +async function borrowed(_, _1, _2, { api }) { + const borrowed = await multiCall({ + calls: debtTokens, + abi: assetTokenAbi.totalSupply, + }); + const underlyings = await multiCall({ + calls: debtTokens, + abi: assetTokenAbi.underlyingAsset, + }); + api.addTokens(underlyings, borrowed); +} + +module.exports = { + methodology: + "The TVL is calculated as a difference between supplied and borrowed assets.", + starknet: { + tvl, + borrowed, + }, +}; diff --git a/projects/nostra/index.js b/projects/nostra/index.js index 8d4c49655fa..ceed96ca7ab 100644 --- a/projects/nostra/index.js +++ b/projects/nostra/index.js @@ -1,29 +1,84 @@ -const { multiCall, sumTokens, } = require('../helper/chain/starknet') -const { assetTokenAbi } = require('./abi'); +const { multiCall } = require("../helper/chain/starknet"); +const { assetTokenAbi } = require("./abi"); -const vault = '0x03d39f7248fb2bfb960275746470f7fb470317350ad8656249ec66067559e892' +const supplyTokens = [ + // WBTC + "0x0735d0f09a4e8bf8a17005fa35061b5957dcaa56889fc75df9e94530ff6991ea", + "0x05b7d301fa769274f20e89222169c0fad4d846c366440afc160aafadd6f88f0c", + "0x073132577e25b06937c64787089600886ede6202d085e6340242a5a32902e23e", + "0x036b68238f3a90639d062669fdec08c4d0bdd09826b1b6d24ef49de6d8141eaa", + // ETH + "0x01fecadfe7cda2487c66291f2970a629be8eecdcb006ba4e71d1428c2b7605c7", + "0x057146f6409deb4c9fa12866915dd952aa07c1eb2752e451d7f3b042086bdeb8", + "0x07170f54dd61ae85377f75131359e3f4a12677589bb7ec5d61f362915a5c0982", + "0x044debfe17e4d9a5a1e226dabaf286e72c9cc36abbe71c5b847e669da4503893", + // USDC + "0x002fc2d4b41cc1f03d185e6681cbd40cced61915d4891517a042658d61cba3b1", + "0x05dcd26c25d9d8fd9fc860038dcb6e4d835e524eb8a85213a8cda5b7fff845f6", + "0x06eda767a143da12f70947192cd13ee0ccc077829002412570a88cd6539c1d85", + "0x05f296e1b9f4cf1ab452c218e72e02a8713cee98921dad2d3b5706235e128ee4", + // DAI + "0x022ccca3a16c9ef0df7d56cbdccd8c4a6f98356dfd11abc61a112483b242db90", + "0x04f18ffc850cdfa223a530d7246d3c6fc12a5969e0aa5d4a88f470f5fe6c46e9", + "0x02b5fd690bb9b126e3517f7abfb9db038e6a69a068303d06cf500c49c1388e20", + "0x005c4676bcb21454659479b3cd0129884d914df9c9b922c1c649696d2e058d70", + // USDT + "0x0360f9786a6595137f84f2d6931aaec09ceec476a94a98dcad2bb092c6c06701", + "0x0453c4c996f1047d9370f824d68145bd5e7ce12d00437140ad02181e1d11dc83", + "0x06669cb476aa7e6a29c18b59b54f30b8bfcfbb8444f09e7bbb06c10895bf5d7b", + "0x0514bd7ee8c97d4286bd481c54aa0793e43edbfb7e1ab9784c4b30469dcf9313", +]; const debtTokens = [ - '0x075b0d87aca8dee25df35cdc39a82b406168fa23a76fc3f03abbfdc6620bb6d7', - '0x040b091cb020d91f4a4b34396946b4d4e2a450dbd9410432ebdbfe10e55ee5e5', - '0x03b6058a9f6029b519bc72b2cc31bcb93ca704d0ab79fec2ae5d43f79ac07f7a', - '0x0362b4455f5f4cc108a5a1ab1fd2cc6c4f0c70597abb541a99cf2734435ec9cb', - '0x065c6c7119b738247583286021ea05acc6417aa86d391dcdda21843c1fc6e9c6', -] + "0x0491480f21299223b9ce770f23a2c383437f9fbf57abc2ac952e9af8cdb12c97", + "0x00ba3037d968790ac486f70acaa9a1cab10cf5843bb85c986624b4d0e5a82e74", + "0x063d69ae657bd2f40337c39bf35a870ac27ddf91e6623c2f52529db4c1619a51", + "0x066037c083c33330a8460a65e4748ceec275bbf5f28aa71b686cbc0010e12597", + "0x024e9b0d6bc79e111e6872bb1ada2a874c25712cf08dfc5bcf0de008a7cca55f", +]; + +function* chunks(arr, n) { + for (let i = 0; i < arr.length; i += n) { + yield arr.slice(i, i + n); + } +} async function tvl(_, _1, _2, { api }) { - let underlyings = await multiCall({ calls: debtTokens, abi: assetTokenAbi.underlyingAsset }) - return sumTokens({ api, owner: vault, tokens: underlyings}) + const supplied = await multiCall({ + calls: supplyTokens, + abi: assetTokenAbi.totalSupply, + }); + const borrowed = await multiCall({ + calls: debtTokens, + abi: assetTokenAbi.totalSupply, + }); + const underlyings = await multiCall({ + calls: debtTokens, + abi: assetTokenAbi.underlyingAsset, + }); + const data = [...chunks(supplied, 4)].map((chunk, i) => { + const totalSupply = chunk.reduce((acc, cur) => acc + cur, 0); + return totalSupply - borrowed[i]; + }); + api.addTokens(underlyings, data); } async function borrowed(_, _1, _2, { api }) { - let data = await multiCall({ calls: debtTokens, abi: assetTokenAbi.totalSupply }); - let underlyings = await multiCall({ calls: debtTokens, abi: assetTokenAbi.underlyingAsset }) - api.addTokens(underlyings, data) + const borrowed = await multiCall({ + calls: debtTokens, + abi: assetTokenAbi.totalSupply, + }); + const underlyings = await multiCall({ + calls: debtTokens, + abi: assetTokenAbi.underlyingAsset, + }); + api.addTokens(underlyings, borrowed); } module.exports = { - methodology: 'Sums the circulating supply of each Nostra Asset Token.', + methodology: + "The TVL is calculated as a difference between supplied and borrowed assets.", starknet: { - tvl, borrowed, - } + tvl, + borrowed, + }, }; From a3c5269b59c1148b955158ff88fc8c0078ac3959 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Wed, 18 Oct 2023 19:48:53 +0100 Subject: [PATCH 1605/1974] add usdt --- projects/helper/tokenMapping.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index b01bc01dda0..611c93017c0 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -112,6 +112,9 @@ const fixBalancesTokens = { renec: { [ADDRESSES.renec.RENEC]: { coingeckoId: "renec", decimals: 9 }, [ADDRESSES.renec.REUSD]: { coingeckoId: "tether", decimals: 9 }, // reUSD pegged USDT || bridge: https://remitano.com/swap/vn/usdt_reusd + }, + op_bnb: { + '0x9e5aac1ba1a2e6aed6b32689dfcf62a509ca96f3': { coingeckoId: 'tether', decimals: 18 } } } From efe932cd91b2249ed9a93c63858c3fb7c8a9634a Mon Sep 17 00:00:00 2001 From: llama Date: Wed, 18 Oct 2023 21:10:45 +0200 Subject: [PATCH 1606/1974] aura: track base --- projects/aura-finance/index.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/projects/aura-finance/index.js b/projects/aura-finance/index.js index dc2de2ee841..3b1f8d89fbc 100644 --- a/projects/aura-finance/index.js +++ b/projects/aura-finance/index.js @@ -61,10 +61,11 @@ async function tvl(_, block, _1, { api }) { } const config = { - arbitrum: { factory: '0x6817149cb753bf529565b4d023d7507ed2ff4bc0', fromBlock: 72942741, voterProxy: '0xc181edc719480bd089b94647c2dc504e2700a2b0'}, - optimism: { factory: '0xa523f47A933D5020b23629dDf689695AA94612Dc', fromBlock: 83239534, voterProxy: '0xc181edc719480bd089b94647c2dc504e2700a2b0'}, - polygon: { factory: '0x22625eedd92c81a219a83e1dc48f88d54786b017', fromBlock: 40687417, voterProxy: '0xC181Edc719480bd089b94647c2Dc504e2700a2B0'}, - xdai: { factory: '0x83E443EF4f9963C77bd860f94500075556668cb8', fromBlock: 27088527, voterProxy: '0xC181Edc719480bd089b94647c2Dc504e2700a2B0'}, + base: { factory: '0xb1a4fe1c6d25a0ddab47431a92a723dd71d9021f', fromBlock: 2555348, voterProxy: '0xC181Edc719480bd089b94647c2Dc504e2700a2B0' }, + arbitrum: { factory: '0x6817149cb753bf529565b4d023d7507ed2ff4bc0', fromBlock: 72942741, voterProxy: '0xc181edc719480bd089b94647c2dc504e2700a2b0' }, + optimism: { factory: '0xa523f47A933D5020b23629dDf689695AA94612Dc', fromBlock: 83239534, voterProxy: '0xc181edc719480bd089b94647c2dc504e2700a2b0' }, + polygon: { factory: '0x22625eedd92c81a219a83e1dc48f88d54786b017', fromBlock: 40687417, voterProxy: '0xC181Edc719480bd089b94647c2Dc504e2700a2B0' }, + xdai: { factory: '0x83E443EF4f9963C77bd860f94500075556668cb8', fromBlock: 27088527, voterProxy: '0xC181Edc719480bd089b94647c2Dc504e2700a2B0' }, } module.exports = { From 154750dca3f3739a6a5da70c19a6a565a91735ad Mon Sep 17 00:00:00 2001 From: 0xDontBlink <79304106+0xDontBlink@users.noreply.github.com> Date: Wed, 18 Oct 2023 20:26:24 +0100 Subject: [PATCH 1607/1974] Add Mellow (#7766) --- projects/mellow/index.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 projects/mellow/index.js diff --git a/projects/mellow/index.js b/projects/mellow/index.js new file mode 100644 index 00000000000..6847f77ac7c --- /dev/null +++ b/projects/mellow/index.js @@ -0,0 +1,14 @@ +const { sumTokens2, nullAddress } = require("../helper/unwrapLPs"); + +const contract = "0x0c884b56fa7dd33a1f4e8b05e7105217c2456219"; + +async function tvl(time, ethBlock, _b, { api }) { + return sumTokens2({ tokens: [nullAddress], owner: contract, api }); +} + +module.exports = { + methodology: `We count the ETH on ${contract}`, + base: { + tvl, + }, +}; From ac8d476f7ccc401d5f4181ec3522c7d69f0380f0 Mon Sep 17 00:00:00 2001 From: Philipp Date: Wed, 18 Oct 2023 21:28:01 +0200 Subject: [PATCH 1608/1974] ERIS protocol, add more trackings (#7764) * add support for tassets * add support for additional networks and new farms --- projects/eris-protocol/index.js | 85 +++++++++++++++++++++++++++++++-- 1 file changed, 80 insertions(+), 5 deletions(-) diff --git a/projects/eris-protocol/index.js b/projects/eris-protocol/index.js index 568be2d54eb..f4dbfe69038 100644 --- a/projects/eris-protocol/index.js +++ b/projects/eris-protocol/index.js @@ -3,7 +3,7 @@ const { getBalance, getBalance2, } = require("../helper/chain/cosmos"); -const sdk = require('@defillama/sdk') +const sdk = require("@defillama/sdk"); // For testing run // node test.js projects/eris-protocol/index.js @@ -31,6 +31,9 @@ const config = { "terra1v4gh6nrps2yjdzqct5m7mwqkfusxgghjvd7sy5dsndsyy86pfyasum2qh5", "terra1g0g5ehu2lvdrta9m62yggaa6x375lz5t5zas3xnzmna7kx74szlsw20es6", "terra1l4phwrfqyg9l0vzlqcxn0vmnjd45rp5gx620zc2updpc9peazteqfk3y2p", + "terra1zsm7cgu3vg2kwwzzehl38ft7z2ffksql9d6twh3pugvf0yl0u5vs74xx55", + "terra1yfmpzj79n8g356kp6xz0rkjehegwqw7zhus8jzreqvec5ay9a7kqs7a6hc", + "terra10wsuv79k03gplmcx22j4lxauca4t2a0p4q83fyuv54w88e7ccm0qxkme4l", ], coinGeckoMap: { "ibc/B3504E092456BA618CC28AC671A71FB08C6CA0FD0BE7C8A5B5A3E2DD933CC9E4": @@ -42,7 +45,27 @@ const config = { uluna: "terra-luna-2", terra1ecgazyd0waaj3g7l9cmy5gulhxkps2gmxu9ghducvuypjq68mq2s5lvsct: "eris-amplified-luna", + terra1t4p3u8khpd7f8qzurwyafxt648dya6mp6vur3vaapswt6m24gkuqrfdhar: + "capapult", + terra1lxx40s29qvkrcj8fsa3yzyehy7w50umdvvnls2r830rys6lu2zns63eelv: + "lion-dao", }, + tassets: [ + { + contract: + "terra1j35ta0llaxcf55auv2cjqau5a7aee6g8fz7md7my7005cvh23jfsaw83dy", + exchangeRate: + "migaloo1436kxs0w2es6xlqpp9rd35e3d0cjnw4sv8j3a7483sgks29jqwgshqdky4", + origChain: "migaloo", + }, + { + contract: + "terra10j3zrymfrkta2pxe0gklc79gu06tqyuy8c3kh6tqdsrrprsjqkrqzfl4df", + exchangeRate: + "migaloo1mf6ptkssddfmxvhdx0ech0k03ktp6kf9yk59renau2gvht3nq2gqdhts4u", + origChain: "migaloo", + }, + ], }, terra: { coinGeckoId: "terra-luna", @@ -92,6 +115,7 @@ const config = { "neutron1sfmpf84xacu2la88zzsgende2jjlczswdmhzn7jh6tuhn43jl86q6d0vhj", "neutron1smam4j5cypw2vp7un3q8w68sg97zq9s2c95ukwsmpsl2jh4xwzdskxm6az", "neutron188xz8cg4uqk4ssg9tcf3q2764ar8ev0jr8qpx2qspchul98ykzuqx58r50", + "neutron1kery9q2uhfu874aqrtx2u7peh7ljfsqjq3ka2lfqmdj5lmhx6fwqx9dw5d", ], coinGeckoMap: { "ibc/F082B65C88E4B6D5EF1DB243CDA1D331D002759E938A0F5CD3FFDC5D53B3E349": @@ -103,14 +127,32 @@ const config = { untrn: "neutron-3", "ibc/C4CFF46FD6DE35CA4CF4CE031E643C8FDC9BA4B99AE598E9B0ED98FE3A2319F9": "cosmos", + "factory/neutron1ug740qrkquxzrk2hh29qrlx3sktkfml3je7juusc2te7xmvsscns0n2wry/wstETH": + "wrapped-steth", + "ibc/A585C2D15DCD3B010849B453A2CFCB5E213208A5AB665691792684C26274304D": + "ethereum", }, }, + archway: { + coinGeckoId: "archway", + hub: "archway1yg4eq68xyll74tdrrcxkr4qpam4j9grknunmp74zzc6km988dadqy0utmj", + decimals: 18, + }, + sei: { + coinGeckoId: "sei-network", + hub: "sei1x2fgaaqecvk8kwuqkjqcj27clw5p5g99uawdzy9sc4rku8avumcq3cky4k", + }, chihuahua: { coinGeckoId: "chihuahua-token", hub: "chihuahua1nktfhalzvtx82kyn4dh6l8htcl0prfpnu380a39zj52nzu3j467qqg23ry", }, }; +let assetDecimals = { + "factory/neutron1ug740qrkquxzrk2hh29qrlx3sktkfml3je7juusc2te7xmvsscns0n2wry/wstETH": 18, + "ibc/A585C2D15DCD3B010849B453A2CFCB5E213208A5AB665691792684C26274304D": 18, +}; + async function getState(chain, contract) { if (!contract) { return {}; @@ -135,11 +177,38 @@ async function tvlHub(chain, state) { }; } +async function tasset2Tvl(chain, tasset) { + let otherChain = tasset.origChain; + let otherConfig = config[otherChain]; + let otherCoinGeckoId = otherConfig.coinGeckoId; + + let state = await getState(chain, tasset.contract); + let stateOther = await getState(otherChain, tasset.exchangeRate); + + let chainConfig = config[chain]; + + // Example + // tvl_utoken (amount deposited of ampWHALE on Terra) * exchange_rate of ampWHALE (queried on Migaloo chain) = TVL of WHALE + + let tvl = + (+(state.tvl_utoken ?? 0) * +stateOther.exchange_rate) / + getDecimalFactor(chainConfig); + + return { + [otherCoinGeckoId]: tvl, + }; +} + function getDecimalFactor(chainConfig) { let decimals = chainConfig.decimals ?? 6; return Math.pow(10, decimals); } +function getDecimalFactorAsset(asset) { + let decimals = assetDecimals[asset] ?? 6; + return Math.pow(10, decimals); +} + async function tvlArbVault(chain) { let chainConfig = config[chain]; let coinGeckoId = chainConfig.coinGeckoId; @@ -221,19 +290,22 @@ async function farm2Tvl(chain, farm) { token1.coinGeckoId = getCoinGeckoId(chain, token1.denom); token2.coinGeckoId = getCoinGeckoId(chain, token2.denom); + let assetDecimals1 = getDecimalFactorAsset(token1.denom); + let assetDecimals2 = getDecimalFactorAsset(token2.denom); + let results = []; if (token1.coinGeckoId) { - results.push({ [token1.coinGeckoId]: token1.amount / 1e6 }); + results.push({ [token1.coinGeckoId]: token1.amount / assetDecimals1 }); if (!token2.coinGeckoId) { // if second is not set, use the same value as AMM has 50:50 weight - results.push({ [token1.coinGeckoId]: token1.amount / 1e6 }); + results.push({ [token1.coinGeckoId]: token1.amount / assetDecimals1 }); } } if (token2.coinGeckoId) { - results.push({ [token2.coinGeckoId]: token2.amount / 1e6 }); + results.push({ [token2.coinGeckoId]: token2.amount / assetDecimals2 }); if (!token1.coinGeckoId) { // if first is not set, use the same value as AMM has 50:50 weight - results.push({ [token2.coinGeckoId]: token2.amount / 1e6 }); + results.push({ [token2.coinGeckoId]: token2.amount / assetDecimals2 }); } } @@ -271,6 +343,7 @@ async function productsTvl(chain) { tvlHub(chain, state), tvlAmpGovernance(chain, state), tvlArbVault(chain).catch((a) => ({})), + ...(chainConfig.tassets ?? []).map((tasset) => tasset2Tvl(chain, tasset)), ...(chainConfig.farms ?? []).map((farm) => farm2Tvl(chain, farm)), ]); } catch (error) { @@ -295,4 +368,6 @@ module.exports = { osmosis: { tvl: () => productsTvl("osmosis") }, neutron: { tvl: () => productsTvl("neutron") }, chihuahua: { tvl: () => productsTvl("chihuahua") }, + archway: { tvl: () => productsTvl("archway") }, + sei: { tvl: () => productsTvl("sei") }, }; From 997e5dfd2d49ca6a56797b2d12151d3e2ec8da65 Mon Sep 17 00:00:00 2001 From: Roy <42067944+royvardhan@users.noreply.github.com> Date: Thu, 19 Oct 2023 00:59:23 +0530 Subject: [PATCH 1609/1974] Add Vapordex-V2 Support (#7765) * feat: add v2 support * feat: add vapordex-v2 support --- projects/vapordex-v2/index.js | 8 ++++++++ projects/vapordex/index.js | 8 +++++--- 2 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 projects/vapordex-v2/index.js diff --git a/projects/vapordex-v2/index.js b/projects/vapordex-v2/index.js new file mode 100644 index 00000000000..1b065e65a3d --- /dev/null +++ b/projects/vapordex-v2/index.js @@ -0,0 +1,8 @@ +const { uniV3Export } = require("../helper/uniswapV3"); +const factory = "0x62B672E531f8c11391019F6fba0b8B6143504169"; +module.exports = uniV3Export({ + avax: { + factory, + fromBlock: 36560289, + }, +}); diff --git a/projects/vapordex/index.js b/projects/vapordex/index.js index f63294655e7..787d39053bb 100644 --- a/projects/vapordex/index.js +++ b/projects/vapordex/index.js @@ -1,3 +1,5 @@ - -const { uniTvlExport } = require('../helper/unknownTokens') -module.exports = uniTvlExport('avax', '0xc009a670e2b02e21e7e75ae98e254f467f7ae257') \ No newline at end of file +const { uniTvlExport } = require("../helper/unknownTokens"); +module.exports = uniTvlExport( + "avax", + "0xc009a670e2b02e21e7e75ae98e254f467f7ae257" +); From 86b11b1a489b0833882d00fd5bd6b8a560f769f4 Mon Sep 17 00:00:00 2001 From: greg Date: Thu, 19 Oct 2023 04:46:34 +0800 Subject: [PATCH 1610/1974] projects/metastreet-v2: fix queries for tvl (#7768) Co-authored-by: wegory --- projects/metastreet-v2/index.js | 59 +++++++++++++++++++++++---------- 1 file changed, 42 insertions(+), 17 deletions(-) diff --git a/projects/metastreet-v2/index.js b/projects/metastreet-v2/index.js index d4e1283bb26..cf7df8ee70b 100644 --- a/projects/metastreet-v2/index.js +++ b/projects/metastreet-v2/index.js @@ -1,11 +1,11 @@ const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); -const { sumTokens2 } = require('../helper/unwrapLPs') -const { blockQuery } = require('../helper/http') +const { sumTokens2 } = require("../helper/unwrapLPs"); +const { blockQuery } = require("../helper/http"); -const query = ` +const query = (skip) => ` query nfts($block: Int) { - loans(where: { or: [{ status: "Active" }, { status: "Liquidated" }] } block: { number: $block }) { + loans(first: 1000, skip: ${skip}, where: { or: [{ status: "Active" }, { status: "Liquidated" }] } block: { number: $block }) { collateralTokenIds collateralToken { id @@ -15,12 +15,14 @@ query nfts($block: Int) { } } } -` -const endpoint = 'https://api.studio.thegraph.com/query/49216/metastreet-v2-mainnet-devel/version/latest' +`; + +const endpoint = + "https://api.studio.thegraph.com/query/49216/metastreet-v2-mainnet-devel/version/latest"; // Constants const METASTREET_POOL_FACTORY = "0x1c91c822F6C5e117A2abe2B33B0E64b850e67095"; -const MAX_UINT_128 = "0xffffffffffffffffffffffffffffffff" +const MAX_UINT_128 = "0xffffffffffffffffffffffffffffffff"; // Gets all MetaStreet V2 pools created by PoolFactory and their // corresponding currency token @@ -87,16 +89,39 @@ module.exports = { tvl, borrowed: getMetaStreetBorrowedValue(), }, - methodology: "TVL is calculated by summing the value of token balances and NFTs across all MetaStreet pools. Total borrowed is calculated by subtracting the tokens available from the total value of all liquidity nodes across all pools.", + methodology: + "TVL is calculated by summing the value of token balances and NFTs across all MetaStreet pools. Total borrowed is calculated by subtracting the tokens available from the total value of all liquidity nodes across all pools.", start: 17497132, // Block number of PoolFactory creation }; -async function tvl(_, _b, _cb, { api, }) { - const pools = await api.call({ target: METASTREET_POOL_FACTORY, abi: abi.getPools, }) - const tokens = await api.multiCall({ abi: abi.currencyToken, calls: pools }) - // const collateralTokens = await api.multiCall({ abi: abi.collateralToken, calls: pools }) - const ownerTokens = pools.map((pool, i) => [[tokens[i]], pool,]) - const { loans } = await blockQuery(endpoint, query, { api, blockCatchupLimit: 600, }) - loans.forEach(loan => api.add(loan.collateralToken.id, loan.collateralTokenIds.length)) - return sumTokens2({ api, ownerTokens, }) -} \ No newline at end of file +async function tvl(_, _b, _cb, { api }) { + const pools = await api.call({ + target: METASTREET_POOL_FACTORY, + abi: abi.getPools, + }); + const tokens = await api.multiCall({ abi: abi.currencyToken, calls: pools }); + const ownerTokens = pools.map((pool, i) => [[tokens[i]], pool]); + + let skip = 0; + let allLoans = []; + + /* Maximum subgraph queries: 100000 / 1000 = 100 */ + while (skip <= 100000) { + const { loans } = await blockQuery(endpoint, query(skip), { + api, + blockCatchupLimit: 600, + }); + if (loans.length === 0) { + break; + } + + allLoans = allLoans.concat(loans); + skip += 1000; + } + + allLoans.forEach(async (loan) => + api.add(loan.collateralToken.id, loan.collateralTokenIds.length) + ); + + return sumTokens2({ api, ownerTokens }); +} From 0797ac81eeb444e86026c1a191f6921b3ffd4236 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Wed, 18 Oct 2023 22:07:40 +0100 Subject: [PATCH 1611/1974] add more sofi --- projects/simps/index.js | 14 ++++++++++++++ projects/words/index.js | 14 ++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 projects/simps/index.js create mode 100644 projects/words/index.js diff --git a/projects/simps/index.js b/projects/simps/index.js new file mode 100644 index 00000000000..48f33de417e --- /dev/null +++ b/projects/simps/index.js @@ -0,0 +1,14 @@ +const { sumTokens2, nullAddress } = require("../helper/unwrapLPs"); + +const contract = "0x2a7868fd6f3501841d6dab7f4be8a3f8d463b842"; + +async function tvl(time, ethBlock, _b, { api }) { + return sumTokens2({ tokens: [nullAddress], owner: contract, api }); +} + +module.exports = { + methodology: `We count the ETH on ${contract}`, + base: { + tvl, + }, +}; diff --git a/projects/words/index.js b/projects/words/index.js new file mode 100644 index 00000000000..2267350bf92 --- /dev/null +++ b/projects/words/index.js @@ -0,0 +1,14 @@ +const { sumTokens2, nullAddress } = require("../helper/unwrapLPs"); + +const contract = "0xeFb73Ae2247d8a5A87D1EF5e9FD0b815BAb262ef"; + +async function tvl(time, ethBlock, _b, { api }) { + return sumTokens2({ tokens: [nullAddress], owner: contract, api }); +} + +module.exports = { + methodology: `We count the ETH on ${contract}`, + base: { + tvl, + }, +}; From 1e78fe080f543c1562319e77e861fd6c47c21c58 Mon Sep 17 00:00:00 2001 From: 0xFantomMenace <93462858+0xFantomMenace@users.noreply.github.com> Date: Wed, 18 Oct 2023 14:08:54 -0700 Subject: [PATCH 1612/1974] Adds Fantom LZ deployment, replaces legacy (#7769) --- projects/the-granary/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/the-granary/index.js b/projects/the-granary/index.js index 6678a9db972..67ade02c4bc 100644 --- a/projects/the-granary/index.js +++ b/projects/the-granary/index.js @@ -12,7 +12,7 @@ function v2(chain, v2Registry){ } module.exports = { - fantom: v2("fantom", "0x6D77F7a0e9F8EBE1C0FF2d757FC5a411640309ac"), + fantom: v2("fantom", "0x773E0277667F0c38d3Ca2Cf771b416bfd065da83"), avax: v2("avax", "0xC043BA54F34C9fb3a0B45d22e2Ef1f171272Bc9D"), optimism: v2("optimism", "0x872B9e8aea5D65Fbf29b8B05bfA4AA3fE94cC11f"), ethereum: v2("ethereum", "0x5C93B799D31d3d6a7C977f75FDB88d069565A55b"), From 7052ef425281ca79fdd7f5194787b1027b627438 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Thu, 19 Oct 2023 00:56:23 +0100 Subject: [PATCH 1613/1974] add arbitrum --- projects/gyroscope/index.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/projects/gyroscope/index.js b/projects/gyroscope/index.js index 18850e0aec4..f2890e07d76 100644 --- a/projects/gyroscope/index.js +++ b/projects/gyroscope/index.js @@ -74,6 +74,13 @@ const config = { fromBlock: 17672894, }, ], + arbitrum: [ + { + name: 'Gyro E-CLP V2 Factory', + factory: '0xdca5f1f0d7994a32bc511e7dba0259946653eaf6', + fromBlock: 124858976, + }, + ] } Object.keys(config).forEach((chain) => { From 2cc1d998ad0e646a9bb16f8751eddfd2d22d869c Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Thu, 19 Oct 2023 01:47:22 +0100 Subject: [PATCH 1614/1974] add kyber on scroll --- projects/kyber-classic/index.js | 1 + projects/kyber/index.js | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/projects/kyber-classic/index.js b/projects/kyber-classic/index.js index fc6245a2aa3..ee1d82f7807 100644 --- a/projects/kyber-classic/index.js +++ b/projects/kyber-classic/index.js @@ -40,6 +40,7 @@ const chains = { bittorrent: { factory: "0xD9bfE9979e9CA4b2fe84bA5d4Cf963bBcB376974" }, linea: { factory: "0x1c758af0688502e49140230f6b0ebd376d429be5" }, era: { factory: "0x9017f5A42fbe5bCA3853400D2660a2Ee771b241e" }, + scroll: {factory: "0x1c758aF0688502e49140230F6b0EBd376d429be5"} }; function classic(chain) { diff --git a/projects/kyber/index.js b/projects/kyber/index.js index 3046834fffd..91c318ed865 100644 --- a/projects/kyber/index.js +++ b/projects/kyber/index.js @@ -31,6 +31,9 @@ const chains = { }, base: { graphId: 'base' + }, + scroll: { + graphId: 'scroll' } }; @@ -41,6 +44,7 @@ async function fetchPools(chain) { case "linea": url = 'https://graph-query.linea.build/subgraphs/name/kybernetwork/kyberswap-elastic-linea'; break; case "cronos": url = 'https://cronos-graph.kyberengineering.io/subgraphs/name/kybernetwork/kyberswap-elastic-cronos'; break; case "base": url = 'https://base-graph.kyberengineering.io/subgraphs/name/kybernetwork/kyberswap-elastic-base'; break; + case "scroll": url = 'https://scroll-graph.kyberengineering.io/subgraphs/name/kybernetwork/kyberswap-elastic-scroll'; break; default: url = `https://api.thegraph.com/subgraphs/name/kybernetwork/kyberswap-elastic-${chain}`; } let length From 7c65a4b40a726269a5b0f1d2bc2c9b1154301ea6 Mon Sep 17 00:00:00 2001 From: Sociogram <148441116+sociogramSoFi@users.noreply.github.com> Date: Thu, 19 Oct 2023 13:36:24 +0300 Subject: [PATCH 1615/1974] sociogram adapter (#7777) --- projects/sociogram/index.js | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 projects/sociogram/index.js diff --git a/projects/sociogram/index.js b/projects/sociogram/index.js new file mode 100644 index 00000000000..8162df71e37 --- /dev/null +++ b/projects/sociogram/index.js @@ -0,0 +1,10 @@ +const { sumTokensExport } = require("../helper/unwrapLPs"); + +module.exports = { + arbitrum: { + tvl: sumTokensExport({ + owner: '0x25f5967B0FB3182d7fcacef3b53E1B2517a31dAf', + tokens: [ '0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9' ], + }), + } +}; From bf75410ede1ac5f56f277d52393d14fc1e073825 Mon Sep 17 00:00:00 2001 From: llama Date: Thu, 19 Oct 2023 12:38:45 +0200 Subject: [PATCH 1616/1974] add dao stalking --- projects/zkSwap-finance/index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/projects/zkSwap-finance/index.js b/projects/zkSwap-finance/index.js index d1aef8adec3..e4b8290e1b2 100644 --- a/projects/zkSwap-finance/index.js +++ b/projects/zkSwap-finance/index.js @@ -1,13 +1,13 @@ -const { getUniTVL, sumTokensExport } = require('../helper/unknownTokens') -const { getLogs } = require('../helper/cache/getLogs') -const { sumTokens2 } = require('../helper/unwrapLPs') +const { getUniTVL, } = require('../helper/unknownTokens') +const { sumTokensExport } = require('../helper/unwrapLPs') const FACTORY = '0x3a76e377ed58c8731f9df3a36155942438744ce3' +const DAO_CONTRACT = '0x4Ca2aC3513739ceBF053B66a1d59C88d925f1987' module.exports = { era: { tvl: getUniTVL({ factory: FACTORY, fetchBalances: true, useDefaultCoreAssets: false, }), - staking: sumTokensExport({ owner: '0x9F9D043fB77A194b4216784Eb5985c471b979D67', tokens: ['0x31C2c031fDc9d33e974f327Ab0d9883Eae06cA4A'], lps: ['0xD33A17C883D5aA79470cd2522ABb213DC4017E01'], useDefaultCoreAssets: false }), + staking: sumTokensExport({ owners: ['0x9F9D043fB77A194b4216784Eb5985c471b979D67', DAO_CONTRACT], tokens: ['0x31C2c031fDc9d33e974f327Ab0d9883Eae06cA4A'], }), }, methodology: "TVL is total liquidity of all liquidity pools." } From a46274327773e005dbeb882ab157d370c460812e Mon Sep 17 00:00:00 2001 From: Blockchaindevdefi <147879007+Blockchaindevdefi@users.noreply.github.com> Date: Thu, 19 Oct 2023 18:47:08 +0800 Subject: [PATCH 1617/1974] update (#7775) Co-authored-by: Blockchaindefidev --- projects/Solidpulse/index.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 projects/Solidpulse/index.js diff --git a/projects/Solidpulse/index.js b/projects/Solidpulse/index.js new file mode 100644 index 00000000000..71e2b63374f --- /dev/null +++ b/projects/Solidpulse/index.js @@ -0,0 +1,12 @@ +const { getUniTVL } = require('../helper/unknownTokens.js') + +module.exports = { + misrepresentedTokens: true, + pulse:{ + tvl: getUniTVL({ + useDefaultCoreAssets: true, + hasStablePools: true, + factory: '0xEb60163cb688e4d605407025f761AA66B293d82D', + }), + }, +} From fc24334a6e8d9373abc8553c65ad90cd8472261f Mon Sep 17 00:00:00 2001 From: sanctuaryzkp <148395621+sanctuaryzkp@users.noreply.github.com> Date: Thu, 19 Oct 2023 10:50:36 +0000 Subject: [PATCH 1618/1974] Create index.js (#7776) --- projects/sanctuary/index.js | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 projects/sanctuary/index.js diff --git a/projects/sanctuary/index.js b/projects/sanctuary/index.js new file mode 100644 index 00000000000..b65ad97b15e --- /dev/null +++ b/projects/sanctuary/index.js @@ -0,0 +1,3 @@ +const { uniTvlExport } = require('../helper/unknownTokens') + +module.exports = uniTvlExport('scroll', '0xAD71e466d6E9c5CbAC804dBF60dE2543d58B4b5B', { fetchBalances: true, }) From 506129fee661fc21e681ee596cbbb7940046c3b7 Mon Sep 17 00:00:00 2001 From: llama Date: Thu, 19 Oct 2023 12:56:19 +0200 Subject: [PATCH 1619/1974] minor fix --- projects/maker/index.js | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/projects/maker/index.js b/projects/maker/index.js index d749aea909e..8d2312f27ba 100644 --- a/projects/maker/index.js +++ b/projects/maker/index.js @@ -89,17 +89,10 @@ async function tvl(timestamp, block, _, { api }) { toa = toa.filter(i => i[0].toLowerCase() !== ADDRESSES.ethereum.SAI.toLowerCase()) const symbols = await api.multiCall({ abi: 'erc20:symbol', calls: toa.map(t => t[0]) }) const gUNIToa = toa.filter((_, i) => symbols[i] === 'G-UNI') - toa = toa.filter((_, i) => symbols[i] !== 'G-UNI') + toa = toa.filter((_, i) => symbols[i] !== 'G-UNI' && !symbols[i].startsWith('RWA')) const balances = await sumTokens2({ api, tokensAndOwners: toa, resolveLP: true, }) await unwrapGunis({ api, toa: gUNIToa, balances, }) - - // remove RWAs - const tokens = Object.keys(balances).filter(i => i.startsWith('ethereum:')).map(i => i.split(':')[1]) - const tSymbols = await api.multiCall({ abi: 'string:symbol', calls: tokens, permitFailure: true, }) - tSymbols.forEach((v, i) => { - if (v && v.startsWith('RWA')) sdk.util.removeTokenBalance(balances, tokens[i]) - }) return balances } From 2b61a7e0a2b860cda0f453891067ec6a62ceb098 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 19 Oct 2023 16:53:22 +0530 Subject: [PATCH 1620/1974] Poolside (#7780) * feat(poolside): adding poolside sdk-adapter * code refactor --------- Co-authored-by: SocksNFlops Co-authored-by: llama --- projects/poolside/index.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 projects/poolside/index.js diff --git a/projects/poolside/index.js b/projects/poolside/index.js new file mode 100644 index 00000000000..523c3edfc85 --- /dev/null +++ b/projects/poolside/index.js @@ -0,0 +1,25 @@ +const { getLogs } = require('../helper/cache/getLogs') +const { sumTokens2 } = require('../helper/unwrapLPs') + +const config = { + ethereum: { factory: '0xb8de4ab6c65e274630f5279f74eb69b66327ce50', fromBlock: 17877905 }, + base: { factory: '0x75a92DfB38C3506dcE3Bbb5EB32A10852f9ba64a', fromBlock: 3674737 }, + avax: { factory: '0x19470c5e0199B7157822Ca627860B08750eCe375', fromBlock: 35711675 }, +} + +Object.keys(config).forEach(chain => { + const { factory, fromBlock } = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const logs = await getLogs({ + api, + target: factory, + eventAbi: 'event PairCreated (address indexed token0, address indexed token1, address pair, uint256 count)', + onlyArgs: true, + fromBlock, + }) + const ownerTokens = logs.map(i => [[i.token0, i.token1], i.pair]) + return sumTokens2({ api, ownerTokens, }) + } + } +}) \ No newline at end of file From a952afa76d6679611c49e7562d8a9cdbe1324242 Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Thu, 19 Oct 2023 13:12:47 +0100 Subject: [PATCH 1621/1974] edit liqwid --- projects/liqwid/index.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/projects/liqwid/index.js b/projects/liqwid/index.js index 43b60aaaa07..a275d938c2e 100644 --- a/projects/liqwid/index.js +++ b/projects/liqwid/index.js @@ -76,8 +76,11 @@ async function tvl(_, _b, _cb, { api, }) { function add(api, market, bal) { const token = getToken(market) - if (token === 'usd-coin') bal /= 1e8 - if (token === 'tether') bal /= 1e8 + if ([ + "f66d78b4a3cb3d37afa0ec36461e51ecbde00f26c8f0a68f94b69880", + "usd-coin", + "tether", + ].includes(token)) bal /= 1e8 api.add(token, bal, { skipChain: token === 'usd-coin' || token === 'tether' }) From a4449a9d562585b334675d30abb1e6323e40b0b2 Mon Sep 17 00:00:00 2001 From: Ivan <3238603+ivivanov@users.noreply.github.com> Date: Thu, 19 Oct 2023 15:32:12 +0300 Subject: [PATCH 1622/1974] feat: list nolus chain (#7668) * feat: list nolus chain * fix: wrong way of pagination key usage --- projects/helper/chain/cosmos.js | 13 +++++++++---- projects/helper/chains.json | 3 ++- projects/nolus/index.js | 27 +++++++++++++++++++++++++++ 3 files changed, 38 insertions(+), 5 deletions(-) create mode 100644 projects/nolus/index.js diff --git a/projects/helper/chain/cosmos.js b/projects/helper/chain/cosmos.js index 4507196b5f2..2bc37e86516 100644 --- a/projects/helper/chain/cosmos.js +++ b/projects/helper/chain/cosmos.js @@ -182,14 +182,19 @@ async function queryContract({ contract, chain, data }) { } async function queryContracts({ chain, codeId, }) { - let paginationKey = undefined const res = [] + const limit = 1000 + let offset = 0 + let paginationKey = undefined + do { - let endpoint = `${getEndpoint(chain)}/cosmwasm/wasm/v1/code/${codeId}/contracts?${paginationKey ? `pagination.key=${paginationKey}` : ""}` + let endpoint = `${getEndpoint(chain)}/cosmwasm/wasm/v1/code/${codeId}/contracts?pagination.limit=${limit}&pagination.offset=${offset}` const { data: { contracts, pagination } } = await axios.get(endpoint) - paginationKey = pagination.next_key - res.push(...contracts) + paginationKey = pagination.next_key + res.push(...contracts) + offset += limit } while (paginationKey) + return res } diff --git a/projects/helper/chains.json b/projects/helper/chains.json index cc26659b725..0832f6bd281 100644 --- a/projects/helper/chains.json +++ b/projects/helper/chains.json @@ -245,5 +245,6 @@ "zeniq", "zilliqa", "zksync", - "zyx" + "zyx", + "nolus" ] diff --git a/projects/nolus/index.js b/projects/nolus/index.js new file mode 100644 index 00000000000..a4961cb68df --- /dev/null +++ b/projects/nolus/index.js @@ -0,0 +1,27 @@ +const utils = require('../helper/utils') +const { getApiTvl } = require('../helper/historicalApi') +const api = 'https://etl-cl.nolus.network:8080/api' + +function tvl(timestamp) { + return getApiTvl(timestamp, + async () => { + const resp = await utils.fetchURL(`${api}/total-value-locked`) + return resp.data.total_value_locked + }, + async () => { + const resp = await utils.fetchURL(`${api}/total-value-locked-series`) + return resp.data.map(v => ({ + date: new Date(v.timestamp).getTime(), + totalLiquidityUSD: v.tvl + })) + }) +} + +module.exports = { + methodology: "The combined total of lending pool assets and the current market value of active leases", + nolus: { + tvl + } +} + +// node test.js projects/nolus/index.js From b6c330cb6f8758b3435f0a449ffcb79076daa241 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 19 Oct 2023 18:37:03 +0530 Subject: [PATCH 1623/1974] Zksynth (#7783) * Added zksynth * TVL fix * code refactor * minor fix --------- Co-authored-by: prasad-kumkar Co-authored-by: llama --- projects/helper/tokenMapping.js | 2 +- projects/zksynth/index.js | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 projects/zksynth/index.js diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 611c93017c0..63cb0954e3c 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -87,7 +87,7 @@ const fixBalancesTokens = { '0xf417f5a458ec102b90352f697d6e2ac3a3d2851f': { coingeckoId: 'tether', decimals: 6 }, }, scroll: { - '0x5300000000000000000000000000000000000004': { coingeckoId: 'ethereum', decimals: 18 }, + '0x5300000000000000000000000000000000000004': { coingeckoId: 'coingecko:ethereum', decimals: 18 }, [ADDRESSES.null]: { coingeckoId: 'ethereum', decimals: 18 }, '0x06eFdBFf2a14a7c8E15944D1F4A48F9F95F663A4': { coingeckoId: 'usd-coin', decimals: 6 } }, diff --git a/projects/zksynth/index.js b/projects/zksynth/index.js new file mode 100644 index 00000000000..626d0995d20 --- /dev/null +++ b/projects/zksynth/index.js @@ -0,0 +1,23 @@ +const { cachedGraphQuery } = require('../helper/cache') +const { sumTokens2 } = require('../helper/unwrapLPs') + +const query = `{ + pools(first: 1000) { + collaterals{ + pool { id } + token { id } + } + } +}` + +async function tvl(_, _b, _cb, { api, }) { + const { pools } = await cachedGraphQuery('zksynth', 'https://api.thegraph.com/subgraphs/name/prasad-kumkar/zksynth-mainnet', query) + const tokensAndOwners = pools.map(i => i.collaterals).flat().map(i => [i.token.id, i.pool.id]) + return sumTokens2({ api, tokensAndOwners }) +} + +module.exports = { + scroll: { + tvl + } +} \ No newline at end of file From 7ecd727c593fffec8aeeb4f3d86dc66a8fad4085 Mon Sep 17 00:00:00 2001 From: Santiago Baldassin <140439001+balda-rdx@users.noreply.github.com> Date: Thu, 19 Oct 2023 10:07:54 -0300 Subject: [PATCH 1624/1974] adding CVR (#7784) * add a radixdlt adapter * removing logs and converting amounts to the right type * fixing the way we iterate over the resources * update the plugin to support multiple components * add docstring * addresing the comments from the reviews * removing not needed logs * pointing to mainnet * pointing to the mainnet * add a radixdlt adapter * fixing the way we iterate over the resources * update the plugin to support multiple components * add docstring * pointing to mainnet * pointing to the mainnet * adding CVR * add a radixdlt adapter * fixing the way we iterate over the resources * update the plugin to support multiple components * add docstring * pointing to mainnet * pointing to the mainnet * add a radixdlt adapter * removing logs and converting amounts to the right type * adding CVR * removing not needed file --- projects/helper/chain/radixdlt.js | 2 +- projects/helper/coreAssets.json | 3 ++- projects/helper/tokenMapping.js | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/projects/helper/chain/radixdlt.js b/projects/helper/chain/radixdlt.js index ecb03135849..2d971db65fb 100644 --- a/projects/helper/chain/radixdlt.js +++ b/projects/helper/chain/radixdlt.js @@ -45,4 +45,4 @@ module.exports = { queryAddresses, sumTokens, sumTokensExport, -} +} \ No newline at end of file diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index 5f6da57fb66..aa10b08a501 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -1423,7 +1423,8 @@ }, "radixdlt": { "XRD": "resource_rdx1tknxxxxxxxxxradxrdxxxxxxxxx009923554798xxxxxxxxxradxrd", - "WETH": "resource_rdx1th88qcj5syl9ghka2g9l7tw497vy5x6zaatyvgfkwcfe8n9jt2npww" + "WETH": "resource_rdx1th88qcj5syl9ghka2g9l7tw497vy5x6zaatyvgfkwcfe8n9jt2npww", + "CVR": "resource_rdx1t4km4k306ul40s3zr8zwwrm25xfmx7w8ytjvdwqh0u3kkch0eph9rn" }, "shimmer_evm": { "WSMR": "0xBEb654A116aeEf764988DF0C6B4bf67CC869D01b", diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 63cb0954e3c..0b004edaaaf 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -62,6 +62,7 @@ const fixBalancesTokens = { radixdlt: { [ADDRESSES.radixdlt.XRD]: { coingeckoId: 'radix', decimals: 0}, [ADDRESSES.radixdlt.WETH]: { coingeckoId: 'ethereum', decimals: 0}, + [ADDRESSES.radixdlt.CVR]: { coingeckoId: 'caviar', decimals: 0}, }, mvc: { [ADDRESSES.mvc.SPACE]: { coingeckoId: "microvisionchain", decimals: 8 }, From cb19f83577ec335e6e6eb85bd729f8c42e4a5d72 Mon Sep 17 00:00:00 2001 From: define Date: Thu, 19 Oct 2023 14:52:06 +0100 Subject: [PATCH 1625/1974] add scroll chain to sync --- projects/syncswap/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/syncswap/index.js b/projects/syncswap/index.js index 8b76cdcb786..a457b06bb83 100644 --- a/projects/syncswap/index.js +++ b/projects/syncswap/index.js @@ -34,6 +34,7 @@ async function tvl(timestamp, ethBlock, chainBlocks, { api }) { const config = { era: { fromBlock: 9775, stableFactory: '0x5b9f21d407F35b10CbfDDca17D5D84b129356ea3', classicFactory: '0xf2DAd89f2788a8CD54625C60b55cD3d2D0ACa7Cb', }, linea: { fromBlock: 716, stableFactory: '0xE4CF807E351b56720B17A59094179e7Ed9dD3727', classicFactory: '0x37BAc764494c8db4e54BDE72f6965beA9fa0AC2d', }, + scroll: { fromBlock: 80875, stableFactory: '0xE4CF807E351b56720B17A59094179e7Ed9dD3727', classicFactory: '0x37BAc764494c8db4e54BDE72f6965beA9fa0AC2d', }, } module.exports = { From f03f8e954c663579b3109bdd23d249af9deeaf90 Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Thu, 19 Oct 2023 15:28:53 +0100 Subject: [PATCH 1626/1974] test --- test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test.js b/test.js index 7d2ccfb910a..775e6c51d85 100644 --- a/test.js +++ b/test.js @@ -316,7 +316,7 @@ function fixBalances(balances) { else if (!token.includes(':')) newKey = `coingecko:${token}` if (newKey) { delete balances[token] - sdk.util.sumSingleBalance(balances, newKey, BigNumber(value).toFixed(0)) + sdk.util.sumSingleBalance(balances, newKey, value.includes('e') ? BigNumber(value).toFixed(0) : value) } }) } From 139515c1e94d1fe547f19f34d487ce61b02b474b Mon Sep 17 00:00:00 2001 From: fantechxyz <148453754+fantechxyz@users.noreply.github.com> Date: Thu, 19 Oct 2023 21:31:05 +0700 Subject: [PATCH 1627/1974] Update tvl include new contract Gift (#7781) --- projects/fan-tech/index.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/projects/fan-tech/index.js b/projects/fan-tech/index.js index a855ce88c20..c73197dd577 100644 --- a/projects/fan-tech/index.js +++ b/projects/fan-tech/index.js @@ -1,9 +1,10 @@ const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') -const contract = "0x53167401aeebFf5677C31E1DDA945628422D7Ed2" +const ftContract = "0x53167401aeebFf5677C31E1DDA945628422D7Ed2" +const giftContract = "0xD42A821E584513e18cFB77e56Bf635C551dE5D63" async function tvl(time, ethBlock, _b, {api}) { - return sumTokens2({ tokens: [nullAddress], owner: contract, api }) + return sumTokens2({ tokens: [nullAddress], owners: [ftContract, giftContract], api }) } module.exports = { @@ -11,4 +12,4 @@ module.exports = { mantle: { tvl } -} \ No newline at end of file +} From ad6c9dfa5eddb89adc95f7831d0f3f711c54a438 Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Thu, 19 Oct 2023 15:35:10 +0100 Subject: [PATCH 1628/1974] test edit --- test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test.js b/test.js index 775e6c51d85..055111769eb 100644 --- a/test.js +++ b/test.js @@ -316,7 +316,7 @@ function fixBalances(balances) { else if (!token.includes(':')) newKey = `coingecko:${token}` if (newKey) { delete balances[token] - sdk.util.sumSingleBalance(balances, newKey, value.includes('e') ? BigNumber(value).toFixed(0) : value) + sdk.util.sumSingleBalance(balances, newKey, typeof a == "string" && value.includes('e') ? BigNumber(value).toFixed(0) : value) } }) } From 044c97710a0cef5ba721c92f95a686b2d3b3ddca Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Thu, 19 Oct 2023 15:35:43 +0100 Subject: [PATCH 1629/1974] test --- test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test.js b/test.js index 055111769eb..39c58ef7e0f 100644 --- a/test.js +++ b/test.js @@ -316,7 +316,7 @@ function fixBalances(balances) { else if (!token.includes(':')) newKey = `coingecko:${token}` if (newKey) { delete balances[token] - sdk.util.sumSingleBalance(balances, newKey, typeof a == "string" && value.includes('e') ? BigNumber(value).toFixed(0) : value) + sdk.util.sumSingleBalance(balances, newKey, typeof value == "string" && value.includes('e') ? BigNumber(value).toFixed(0) : value) } }) } From 9bf34d7f017e875ee661266085a2df833aee942f Mon Sep 17 00:00:00 2001 From: Eugene Mormul Date: Thu, 19 Oct 2023 17:39:39 +0300 Subject: [PATCH 1630/1974] feat: primex finance adapter (#7779) --- projects/primex-finance/abi.js | 6 +++++ projects/primex-finance/index.js | 41 ++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 projects/primex-finance/abi.js create mode 100644 projects/primex-finance/index.js diff --git a/projects/primex-finance/abi.js b/projects/primex-finance/abi.js new file mode 100644 index 00000000000..99f2abea91b --- /dev/null +++ b/projects/primex-finance/abi.js @@ -0,0 +1,6 @@ +const abi = { + allBuckets: 'function allBuckets() external view returns (address[])', + borrowedAsset: 'address:borrowedAsset', +} + +module.exports = { abi } \ No newline at end of file diff --git a/projects/primex-finance/index.js b/projects/primex-finance/index.js new file mode 100644 index 00000000000..53ead64f2d0 --- /dev/null +++ b/projects/primex-finance/index.js @@ -0,0 +1,41 @@ +const { sumTokens2 } = require('../helper/unwrapLPs') +const ADDRESSES = require('../helper/coreAssets.json') +const { abi } = require('./abi') + +const config = { + polygon: { + bucketsFactory: '0x7E6915D307F434E4171cCee90e180f5021c60089', + positionManager: '0x02bcaA4633E466d151b34112608f60A82a4F6035', + traderBalanceVault: '0x0801896C67CF024606BcC92bd788d6Eb077CC74F', + defaultTokens: { + WETH: ADDRESSES.polygon.WETH_1, + WBTC: ADDRESSES.polygon.WBTC, + WMATIC: ADDRESSES.polygon.WMATIC_2, + USDC: ADDRESSES.polygon.USDC, + USDT: ADDRESSES.polygon.USDT, + EPMX: "0xDc6D1bd104E1efa4A1bf0BBCf6E0BD093614E31A" + }, + }, +} + +module.exports = {} + +Object.keys(config).forEach(chain => { + const { bucketsFactory, positionManager, traderBalanceVault, defaultTokens } = config[chain] + + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const buckets = await api.call({ target: bucketsFactory, abi: abi.allBuckets }) + const borrowedTokensAddresses = await api.multiCall({ abi: abi.borrowedAsset, calls: buckets }) + + const tokensAndOwnersBuckets = buckets.map((b, i) => [borrowedTokensAddresses[i], b]) + const tokensAndOwnersPM = Object.values(defaultTokens).map(t => [t, positionManager]) + const tokensAndOwnersTBV = Object.values(defaultTokens).map(t => [t, traderBalanceVault]) + + const tokensAndOwners = tokensAndOwnersBuckets.concat(tokensAndOwnersPM, tokensAndOwnersTBV) + + return sumTokens2({ api, tokensAndOwners }) + } + } +}) + From b792bc9e42a2ae2d183f818dfa33bf165f52e694 Mon Sep 17 00:00:00 2001 From: llama Date: Thu, 19 Oct 2023 16:43:07 +0200 Subject: [PATCH 1631/1974] lint fix --- projects/fan-tech/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/fan-tech/index.js b/projects/fan-tech/index.js index c73197dd577..264b20a061b 100644 --- a/projects/fan-tech/index.js +++ b/projects/fan-tech/index.js @@ -8,7 +8,7 @@ async function tvl(time, ethBlock, _b, {api}) { } module.exports = { - methodology: `We count the MNT on ${contract}`, + methodology: `We count the MNT on the contracts`, mantle: { tvl } From a989377baf9ad63a117d274bc52afa0fde068dcd Mon Sep 17 00:00:00 2001 From: llama Date: Thu, 19 Oct 2023 18:06:06 +0200 Subject: [PATCH 1632/1974] track maker rwa --- projects/maker-rwa/index.js | 186 ++++++++++++++++++++++++++++++++++++ 1 file changed, 186 insertions(+) create mode 100644 projects/maker-rwa/index.js diff --git a/projects/maker-rwa/index.js b/projects/maker-rwa/index.js new file mode 100644 index 00000000000..5cbb6d0e558 --- /dev/null +++ b/projects/maker-rwa/index.js @@ -0,0 +1,186 @@ +const ADDRESSES = require('../helper/coreAssets.json') +// const utils = require('web3-utils'); +const sdk = require('@defillama/sdk'); +const MakerSCDConstants = require("../maker/abis/makerdao.js"); +const MakerMCDConstants = require("../maker/abis/maker-mcd.js"); +const { sumTokens2 } = require('../helper/unwrapLPs') +const { getLogs } = require('../helper/cache/getLogs') + +async function getJoins(block, api) { + // let rely = utils.sha3("rely(address)").substr(0, 10); + // let relyTopic = utils.padRight(rely, 64); + let relyTopic = '0x65fae35e00000000000000000000000000000000000000000000000000000000' + + let joins = []; + let failed = []; + const failedSet = new Set(failedJoins) + + // get list of auths + const auths = ( + await getLogs({ + api, + target: MakerMCDConstants.VAT, + fromBlock: MakerMCDConstants.STARTBLOCK, + topics: [relyTopic], + }) + ).map(i => `0x${i.topics[1].substr(26)}`).filter(i => !failedSet.has(i)) + + const ilks = await api.multiCall({ + abi: MakerMCDConstants.ilk, + calls: auths, + permitFailure: true, + }); + + ilks.forEach((_, i) => { + const token = auths[i].toLowerCase() + if (_) joins.push(token) + else failed.push(token) + }) + + if (failed.length) sdk.log('failed', failed) + + return joins; +} + +async function tvl(timestamp, block, _, { api }) { + let toa = [] + + const blacklistedJoins = [ + '0x7b3799b30f268ba55f926d7f714a3001af89d359', + '0x41ca7a7aa2be78cf7cb80c0f4a9bdfbc96e81815', + ] + if (block > MakerMCDConstants.STARTBLOCK) { + let joins = await getJoins(block, api); + const dogSet = new Set(dogs) + joins = joins.filter(i => !blacklistedJoins.includes(i) && !dogSet.has(i)) + + const { output: gems } = await sdk.api.abi.multiCall({ + abi: MakerMCDConstants.gem, + block, calls: joins.map(i => ({ target: i })), + permitFailure: true, + }) + const dogCalls = dogs.map(i => ({ target: i })) + + gems.forEach(({ success, output, input: { target } }) => { + target = target.toLowerCase() + if (!success) { + dogCalls.push({ target }) + return; + } + + toa.push([output, target]) + }) + + const { output: dogRes } = await sdk.api.abi.multiCall({ + abi: MakerMCDConstants.dog, + calls: dogCalls, block, + permitFailure: true, + }) + + const failedCalls = dogRes.filter(i => !i.success) + if (failedCalls.length) { + failedCalls.forEach(i => sdk.log('Failed both gem and dog calls', i.input.target)) + throw new Error('Failed both gem and dog calls') + } + } + + toa = toa.filter(i => i[0].toLowerCase() !== ADDRESSES.ethereum.SAI.toLowerCase()) + const symbols = await api.multiCall({ abi: 'erc20:symbol', calls: toa.map(t => t[0]) }) + + const owners = [] + toa.map((_, i) => { + if (!symbols[i].startsWith('RWA')) return; + // console.log(symbols[i], toa[i]) + owners.push(toa[i][1]) + }) + const ilks = await api.multiCall({ abi: 'function ilk() view returns (bytes32)', calls: owners }) + const res = await api.multiCall({ abi: 'function ilks (bytes32) view returns (uint256 art, uint256 rate, uint256 spot, uint256 line,uint256 dust)', calls:ilks, target:'0x35D1b3F3D7966A1DFe207aa4514C12a259A0492B' }) + res.forEach(i => api.add(ADDRESSES.ethereum.DAI, i.art)) + + return api.getBalances() +} + +module.exports = { + timetravel: true, + methodology: `Counts all the tokens being used as collateral of CDPs. + + On the technical level, we get all the collateral tokens by fetching events, get the amounts locked by calling balanceOf() directly, unwrap any uniswap LP tokens and then get the price of each token from coingecko`, + start: 1513566671, // 12/18/2017 @ 12:00am (UTC) + ethereum: { + tvl + }, +}; + +const dogs = [ + '0x832dd5f17b30078a5e46fdb8130a68cbc4a74dc0', + '0x9dacc11dcd0aa13386d295eaeebbd38130897e6f', + '0xc67963a226eddd77b91ad8c421630a1b0adff270', + '0x71eb894330e8a4b96b8d6056962e7f116f50e06f', + '0xc2b12567523e3f3cbd9931492b91fe65b240bc47', + '0x0227b54adbfaeec5f1ed1dfa11f54dcff9076e2c', + '0x3d22e6f643e2f4c563fd9db22b229cbb0cd570fb', + '0xdc90d461e148552387f3ab3ebee0bdc58aa16375', + '0x006aa3eb5e666d8e006aa647d4afab212555ddea', + '0xf5c8176e1eb0915359e46ded16e52c071bb435c0', + '0x2bb690931407dca7ece84753ea931ffd304f0f38', + '0x81c5cdf4817dbf75c7f08b8a1cdab05c9b3f70f7', + '0x6aac067bb903e633a422de7be9355e62b3ce0378', + '0x3713f83ee6d138ce191294c131148176015bc29a', + '0x834719bea8da68c46484e001143bdde29370a6a3', + '0x8723b74f598de2ea49747de5896f9034cc09349e', + '0x9f6981ba5c77211a34b76c6385c0f6fa10414035', + '0x93ae03815baf1f19d7f18d9116e4b637cc32a131', + '0x2ac4c9b49051275acb4c43ec973082388d015d48', + '0x4fc53a57262b87abda61d6d0db2be7e9be68f6b8', + '0xb15afab996904170f87a64fe42db0b64a6f75d24', + '0x6aa0520354d1b84e1c6abfe64a708939529b619e', + '0xb0ece6f5542a4577e2f1be491a937ccbbec8479e', + '0x854b252ba15eafa4d1609d3b98e00cc10084ec55', + '0xe4b82be84391b9e7c56a1fc821f47569b364dd4a', + '0x046b1a5718da6a226d912cfd306ba19980772908', + '0x5590f23358fe17361d7e4e4f91219145d8ccfcb3', + '0x0f6f88f8a4b918584e3539182793a0c276097f44', + '0xfc9d6dd08bee324a5a8b557d2854b9c36c2aec5d', + '0xbcb396cd139d1116bd89562b49b9d1d6c25378b0', + '0xa47d68b9db0a0361284fa04ba40623fcbd1a263e', + '0x66609b4799fd7ce12ba799ad01094abd13d5014d', + '0x9b3310708af333f6f379fa42a5d09cbaa10ab309', + '0x5322a3551bc6a1b39d5d142e5e38dc5b4bc5b3d2', + '0x29342f530ed6120bdb219d602dafd584676293d1', + '0x5048c5cd3102026472f8914557a1fd35c8dc6c9e', + '0x49a33a28c4c7d9576ab28898f4c9ac7e52ea457a', + '0xa93b98e57dde14a3e301f20933d59dc19bf8212e', + '0xe30663c6f83a06edee6273d72274ae24f1084a22', + '0x39f29773dcb94a32529d0612c6706c49622161d1', + '0xf93cc3a50f450ed245e003bfecc8a6ec1732b0b2', + '0xb55da3d3100c4ebf9de755b6ddc24bf209f6cc06', + '0x1926862f899410bfc19fefb8a3c69c7aed22463a', + '0x3ea60191b7d5990a3544b6ef79983fd67e85494a', + '0x27ca5e525ea473ed52ea9423cd08ccc081d96a98', + '0xd9e758bd239e5d568f44d0a748633f6a8d52cbbb', +] + +const failedJoins = [ + '0xbaa65281c2fa2baacb2cb550ba051525a480d3f4', + '0x65c79fcb50ca1594b025960e539ed7a9a6d434a3', + '0x19c0976f590d67707e62397c87829d896dc0f1f1', + '0x197e90f9fad81970ba7976f33cbd77088e5d7cf7', + '0x78f2c2af65126834c51822f56be0d7469d7a523e', + '0xab14d3ce3f733cacb76ec2abe7d2fcb00c99f3d5', + '0xbe8e3e3618f7474f8cb1d074a26affef007e98fb', + '0x4d95a049d5b0b7d32058cd3f2163015747522e99', + '0xa41b6ef151e06da0e34b009b86e828308986736d', + '0xa5679c04fc3d9d8b0aab1f0ab83555b301ca70ea', + '0xc7bdd1f2b16447dcf3de045c4a039a60ec2f0ba3', + '0x88f88bb9e66241b73b84f3a6e197fbba487b1e30', + '0xbb856d1742fd182a90239d7ae85706c2fe4e5922', + '0x29cfbd381043d00a98fd9904a431015fef07af2f', + '0x135954d155898d42c90d2a57824c690e0c7bef1b', + '0x1eb4cf3a948e7d72a198fe073ccb8c7a948cd853', + '0x2cc583c0aacdac9e23cb601fda8f1a0c56cdcb71', + '0x09e05ff6142f2f9de8b6b65855a1d56b6cfe4c58', + '0xa4c22f0e25c6630b2017979acf1f865e94695c4b', + '0x0e2e8f1d1326a4b9633d96222ce399c708b19c28', + '0x60744434d6339a6b27d73d9eda62b6f66a0a04fa', + '0x12f36cdea3a28c35ac8c6cc71d9265c17c74a27f', +] From ac2cfcc6dd47df7208903483cbae658c9d59b9b8 Mon Sep 17 00:00:00 2001 From: llama Date: Thu, 19 Oct 2023 18:53:07 +0200 Subject: [PATCH 1633/1974] fix liqwid --- projects/liqwid/index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/projects/liqwid/index.js b/projects/liqwid/index.js index a275d938c2e..8400c0c08a1 100644 --- a/projects/liqwid/index.js +++ b/projects/liqwid/index.js @@ -77,7 +77,6 @@ async function tvl(_, _b, _cb, { api, }) { function add(api, market, bal) { const token = getToken(market) if ([ - "f66d78b4a3cb3d37afa0ec36461e51ecbde00f26c8f0a68f94b69880", "usd-coin", "tether", ].includes(token)) bal /= 1e8 From a45156c7987212245ada64d20dfeb9e005f5eb09 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Thu, 19 Oct 2023 20:14:37 +0100 Subject: [PATCH 1634/1974] add cronos --- projects/thetanuts/index.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/projects/thetanuts/index.js b/projects/thetanuts/index.js index 6e70fb30a1e..b83c66c7ee3 100644 --- a/projects/thetanuts/index.js +++ b/projects/thetanuts/index.js @@ -73,6 +73,9 @@ const arbCallVault = '0x0833EC3262Dcc417D88f85Ed5E1EBAf768080f41' //zkEVM vaults const stMaticCallVault = '0x7bF3c7C23501EA3E09B237D6F8AdcB7Ea3CeF41C' +//cronos vaults +const cronosCallVault = '0x99F05418967d3596CAfd260913b682Fd9b0CBB40' + // Ethereum Assets const weth = ADDRESSES.ethereum.WETH const usdc = ADDRESSES.ethereum.USDC @@ -116,6 +119,9 @@ let arb = ADDRESSES.arbitrum.ARB // zkEVM assets const stMatic = '0x83b874c1e09D316059d929da402dcB1A98e92082'; +// cronos assets +const wcro = '0x5C7F8A570d578ED84E63fdFA7b1eE72dEae1AE23' + module.exports = { methodology: `Only the funds deposited by the users into our vaults are calculated as TVL.`, hallmarks: [ @@ -209,6 +215,11 @@ const config = { tokensAndOwners: [ [stMatic, stMaticCallVault,], ] + }, + cronos: { + tokensAndOwners: [ + [wcro, cronosCallVault] + ] } } From 4742b0577165118d4c07d446238729916680b20c Mon Sep 17 00:00:00 2001 From: llama Date: Thu, 19 Oct 2023 21:46:28 +0200 Subject: [PATCH 1635/1974] icecreamswap: track scroll --- projects/helper/env.js | 1 + projects/icecreamswap/index.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/helper/env.js b/projects/helper/env.js index 9586ea3c0d7..652e933fe51 100644 --- a/projects/helper/env.js +++ b/projects/helper/env.js @@ -15,6 +15,7 @@ const DEFAULTS = { RENEC_RPC: "https://api-mainnet-beta.renec.foundation:8899/", EVMOS_RPC: "https://evmos-evm.publicnode.com", NOVA_RPC: "https://connect.novanetwork.io", + SCROLL_RPC: "https://rpc-scroll.icecreamswap.com", } const ENV_KEYS = [ diff --git a/projects/icecreamswap/index.js b/projects/icecreamswap/index.js index f5ba6d5ffde..311200ad802 100644 --- a/projects/icecreamswap/index.js +++ b/projects/icecreamswap/index.js @@ -4,7 +4,7 @@ const config = { shimmer_evm: '0x24cb308a4e2F3a4352F513681Bd0c31a0bd3BA31', } -const chains = [...Object.keys(config), 'base', 'telos', 'core', 'dogechain', 'fuse', 'xdc', 'bitgert' ] +const chains = [...Object.keys(config), 'base', 'telos', 'core', 'dogechain', 'fuse', 'xdc', 'bitgert', 'scroll' ] chains.forEach(chain => { const factory = config[chain] From b8f539a98725a74c2bbd620211976db9abf95f1a Mon Sep 17 00:00:00 2001 From: llama Date: Thu, 19 Oct 2023 22:47:06 +0200 Subject: [PATCH 1636/1974] track caviarnine-lsu --- projects/caviarnine-lsu/index.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 projects/caviarnine-lsu/index.js diff --git a/projects/caviarnine-lsu/index.js b/projects/caviarnine-lsu/index.js new file mode 100644 index 00000000000..673a1f6691b --- /dev/null +++ b/projects/caviarnine-lsu/index.js @@ -0,0 +1,13 @@ +const { get } = require('../helper/http') + +async function tvl(_, _b, _cb, { api, }) { + const { composition } = await get('https://api-core.caviarnine.com/v1.0/lsupool/get_details') + return { + 'radix': composition.reduce((acc, i) => acc + i.amount_in_lsu/1e18 * +i.price_lsu_to_xrd, 0) + } +} + +module.exports = { + timetravel: false, + radixdlt: { tvl } +} \ No newline at end of file From 6ab3de64151b1f69b4365399f3a6c1de4b1f0add Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Thu, 19 Oct 2023 22:35:24 +0100 Subject: [PATCH 1637/1974] add canto ambient --- projects/ambient-finance/index.js | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/projects/ambient-finance/index.js b/projects/ambient-finance/index.js index 54dabd9607c..9c52b8ecd40 100644 --- a/projects/ambient-finance/index.js +++ b/projects/ambient-finance/index.js @@ -1,17 +1,27 @@ const { sumTokens2 } = require('../helper/unwrapLPs'); const { cachedGraphQuery } = require("../helper/cache"); -const vault = "0xAaAaAAAaA24eEeb8d57D431224f73832bC34f688" +const vault = { + ethereum: "0xAaAaAAAaA24eEeb8d57D431224f73832bC34f688", + canto: "0x9290c893ce949fe13ef3355660d07de0fb793618" +} -async function tvl(_, _b, _cb, { api, }) { +const subgraphs = { + canto: "https://canto-subgraph.plexnode.wtf/subgraphs/name/ambient-graph", + ethereum: `https://api.thegraph.com/subgraphs/name/crocswap/croc-mainnet` +} - const { pools } = await cachedGraphQuery(`ambient-finance/${api.chain}`, `https://api.thegraph.com/subgraphs/name/crocswap/croc-mainnet`, "{ pools { base quote }}") +async function tvl(_, _b, _cb, { api, }) { + const { pools } = await cachedGraphQuery(`ambient-finance/${api.chain}`, subgraphs[api.chain], "{ pools { base quote }}") const tokens = pools.map(i => [i.base, i.quote]).flat() - return sumTokens2({ api, owner: vault, tokens, }) + return sumTokens2({ api, owner: vault[api.chain], tokens, }) } module.exports = { ethereum: { tvl, + }, + canto: { + tvl, } -} \ No newline at end of file +} From 5ce6d84662b4a83dbb98b4f862b7afba3dda773c Mon Sep 17 00:00:00 2001 From: Canary Dev <84072229+canarydeveloper@users.noreply.github.com> Date: Fri, 20 Oct 2023 07:13:46 +0300 Subject: [PATCH 1638/1974] Added Scroll Mainnet index.js (#7787) --- projects/canary/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/projects/canary/index.js b/projects/canary/index.js index 2fa9d5191ee..b0fb08bc6e4 100644 --- a/projects/canary/index.js +++ b/projects/canary/index.js @@ -4,4 +4,7 @@ module.exports = { avax:{ tvl: getUniTVL({ chain: 'avax', useDefaultCoreAssets: true, factory: '0xCFBA329d49C24b70F3a8b9CC0853493d4645436b', }), }, -} \ No newline at end of file + scroll:{ + tvl: getUniTVL({ chain: 'scroll', useDefaultCoreAssets: true, factory: '0x8D88e48465F30Acfb8daC0b3E35c9D6D7d36abaf', }), + }, +} From 58aeec31c6b3f82d851b70d08a38ff4b13f5c141 Mon Sep 17 00:00:00 2001 From: Eugene Mormul Date: Fri, 20 Oct 2023 09:23:33 +0300 Subject: [PATCH 1639/1974] feat: atokens for tvl (#7789) --- projects/primex-finance/index.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/projects/primex-finance/index.js b/projects/primex-finance/index.js index 53ead64f2d0..4157a909919 100644 --- a/projects/primex-finance/index.js +++ b/projects/primex-finance/index.js @@ -15,13 +15,20 @@ const config = { USDT: ADDRESSES.polygon.USDT, EPMX: "0xDc6D1bd104E1efa4A1bf0BBCf6E0BD093614E31A" }, + aaveTokens: { + [ADDRESSES.polygon.WETH_1]: "0xe50fA9b3c56FfB159cB0FCA61F5c9D750e8128c8", + [ADDRESSES.polygon.WBTC]: "0x078f358208685046a11C85e8ad32895DED33A249", + [ADDRESSES.polygon.WMATIC_2]: "0x6d80113e533a2C0fe82EaBD35f1875DcEA89Ea97", + [ADDRESSES.polygon.USDC]: "0x625E7708f30cA75bfd92586e17077590C60eb4cD", + [ADDRESSES.polygon.USDT]: "0x6ab707Aca953eDAeFBc4fD23bA73294241490620", + }, }, } module.exports = {} Object.keys(config).forEach(chain => { - const { bucketsFactory, positionManager, traderBalanceVault, defaultTokens } = config[chain] + const { bucketsFactory, positionManager, traderBalanceVault, defaultTokens, aaveTokens } = config[chain] module.exports[chain] = { tvl: async (_, _b, _cb, { api, }) => { @@ -29,13 +36,13 @@ Object.keys(config).forEach(chain => { const borrowedTokensAddresses = await api.multiCall({ abi: abi.borrowedAsset, calls: buckets }) const tokensAndOwnersBuckets = buckets.map((b, i) => [borrowedTokensAddresses[i], b]) + const aTokensAndOwnersBuckets = buckets.map((b, i) => [aaveTokens[borrowedTokensAddresses[i].toLowerCase()], b]).filter((p) => p[0]) const tokensAndOwnersPM = Object.values(defaultTokens).map(t => [t, positionManager]) const tokensAndOwnersTBV = Object.values(defaultTokens).map(t => [t, traderBalanceVault]) - const tokensAndOwners = tokensAndOwnersBuckets.concat(tokensAndOwnersPM, tokensAndOwnersTBV) + const tokensAndOwners = tokensAndOwnersBuckets.concat(aTokensAndOwnersBuckets, tokensAndOwnersPM, tokensAndOwnersTBV) return sumTokens2({ api, tokensAndOwners }) } } }) - From f807911f6139c99a759e4a8a9a69f1f43b7f002a Mon Sep 17 00:00:00 2001 From: 0xPowerRanger <127472302+0xPowerRanger@users.noreply.github.com> Date: Fri, 20 Oct 2023 14:24:00 +0800 Subject: [PATCH 1640/1974] bug-fix (#7792) --- projects/range/index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/projects/range/index.js b/projects/range/index.js index fefa21d34c5..0d1f14c426c 100644 --- a/projects/range/index.js +++ b/projects/range/index.js @@ -65,6 +65,8 @@ Object.keys(config).forEach(chain => { token1s.push(...(await api.multiCall({ abi: "address:tokenY", calls: izumiVaults }))) const bals = await api.multiCall({ abi: ABI.underlyingBalance, calls: vaults }) + bals.push(...(await api.multiCall({ abi: ABI.underlyingBalance, calls: izumiVaults }))) + bals.forEach(({ amount0Current, amount1Current }, i) => { api.add(token0s[i], amount0Current) api.add(token1s[i], amount1Current) From 416b9592e5918e323c4b3b38e733ea2b4dd7f9e4 Mon Sep 17 00:00:00 2001 From: qinghuan <1245816264@qq.com> Date: Fri, 20 Oct 2023 14:25:22 +0800 Subject: [PATCH 1641/1974] feat: add tokens (#7791) --- projects/omnibtc/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/projects/omnibtc/index.js b/projects/omnibtc/index.js index ace92a7acca..064d8fcd897 100644 --- a/projects/omnibtc/index.js +++ b/projects/omnibtc/index.js @@ -80,6 +80,7 @@ module.exports = { ADDRESSES.arbitrum.USDC, ADDRESSES.arbitrum.USDT, ADDRESSES.arbitrum.WBTC, + "0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8", //Bridge USDC ], }), }, @@ -97,7 +98,8 @@ module.exports = { ADDRESSES.optimism.OP, ADDRESSES.optimism.USDC, ADDRESSES.optimism.USDT, - //ADDRESSES.optimism.WBTC, + "0x7F5c764cBc14f9669B88837ca1490cCa17c31607", // Bridge USDC + "0x68f180fcCe6836688e9084f035309E29Bf0A2095", // WBTC ], }), }, From f6163db3966de80526daff2f03df7ca8dcbedaa8 Mon Sep 17 00:00:00 2001 From: nuoanunu Date: Fri, 20 Oct 2023 13:30:11 +0700 Subject: [PATCH 1642/1974] Update index.js (#7794) Co-authored-by: Nhat --- projects/Hono/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/Hono/index.js b/projects/Hono/index.js index 4d4a135aded..e56c9d4eac8 100644 --- a/projects/Hono/index.js +++ b/projects/Hono/index.js @@ -10,7 +10,7 @@ async function tvl(timestamp, block, _, { api }) { } module.exports = { - methodology: 'TVL will be the sum of 1- total value ofETH backing HONO price and 2- Amount of LP managing by our LP Manager contract minus HONO in LP', + methodology: 'The combined value of two components: the total value of ETH supporting the HONO price and the amount of liquidity being managed by our income strategies.', ethereum: { tvl, }, From 8b2cb54838eba17b3238577b179b187748b26abe Mon Sep 17 00:00:00 2001 From: define Date: Fri, 20 Oct 2023 09:41:52 +0100 Subject: [PATCH 1643/1974] add factor dao treasury --- projects/treasury/factor-dao.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 projects/treasury/factor-dao.js diff --git a/projects/treasury/factor-dao.js b/projects/treasury/factor-dao.js new file mode 100644 index 00000000000..4bcab13f4c7 --- /dev/null +++ b/projects/treasury/factor-dao.js @@ -0,0 +1,14 @@ +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0x0c415efd785b8308e42c75532d1231a6281ebee2"; +const FCTR = "0x6dd963c510c2d2f09d5eddb48ede45fed063eb36" + +module.exports = treasuryExports({ + arbitrum: { + tokens: [ + nullAddress, + ], + owners: [treasury], + ownTokens: [FCTR], + }, +}) \ No newline at end of file From 89773b6feed2d3684312bfc14640f77c63ac58a2 Mon Sep 17 00:00:00 2001 From: Paul Razvan Berg Date: Fri, 20 Oct 2023 13:21:55 +0100 Subject: [PATCH 1644/1974] feat: add Base deployment for Sablier (#7797) --- projects/sablier-v2/index.js | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/projects/sablier-v2/index.js b/projects/sablier-v2/index.js index a81da1a9503..edb288168f6 100644 --- a/projects/sablier-v2/index.js +++ b/projects/sablier-v2/index.js @@ -1,14 +1,6 @@ -const ADDRESSES = require('../helper/coreAssets.json') const { isWhitelistedToken } = require('../helper/streamingHelper') const { cachedGraphQuery } = require('../helper/cache') -const blacklistedTokens = [ - ADDRESSES.ethereum.sUSD_OLD, - // TODO: We shouldn't need to lowercase here - ADDRESSES.ethereum.SAI.toLowerCase(), - ADDRESSES.ethereum.MKR, -] - async function getTokensConfig(api, isVesting) { const ownerTokens = [] const { endpoints } = config[api.chain] @@ -47,6 +39,7 @@ const config = { optimism: { endpoints: ['https://api.thegraph.com/subgraphs/name/sablier-labs/sablier-v2-optimism'], }, polygon: { endpoints: ['https://api.thegraph.com/subgraphs/name/sablier-labs/sablier-v2-polygon'], }, avax: { endpoints: ['https://api.thegraph.com/subgraphs/name/sablier-labs/sablier-v2-avalanche'], }, + base: { endpoints: ['https://api.thegraph.com/subgraphs/name/sablier-labs/sablier-v2-base'], }, } Object.keys(config).forEach(chain => { From 3a758bedaa17fd572056074e11fc97788a56356f Mon Sep 17 00:00:00 2001 From: layerbank <135123153+layerbank@users.noreply.github.com> Date: Fri, 20 Oct 2023 21:22:28 +0900 Subject: [PATCH 1645/1974] Add layerbank scroll chain (#7796) --- projects/lineabank/index.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/projects/lineabank/index.js b/projects/lineabank/index.js index 90636a7dda7..9958d91cc99 100644 --- a/projects/lineabank/index.js +++ b/projects/lineabank/index.js @@ -9,4 +9,12 @@ module.exports = { totalBorrows: "uint256:totalBorrow", }, }), + scroll: compoundExports2({ + comptroller: "0xEC53c830f4444a8A56455c6836b5D2aA794289Aa", + fetchBalances: true, + abis: { + getAllMarkets: "address[]:allMarkets", + totalBorrows: "uint256:totalBorrow", + }, + }), }; From 72ae426c387ce0e986a3a69e11fea84f7f66571d Mon Sep 17 00:00:00 2001 From: define Date: Fri, 20 Oct 2023 14:24:02 +0100 Subject: [PATCH 1646/1974] add adapters --- projects/entities/brevan-howard-digital.js | 11 +++++++++++ projects/entities/digital-currency-group.js | 14 ++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 projects/entities/brevan-howard-digital.js create mode 100644 projects/entities/digital-currency-group.js diff --git a/projects/entities/brevan-howard-digital.js b/projects/entities/brevan-howard-digital.js new file mode 100644 index 00000000000..1c35bd902a2 --- /dev/null +++ b/projects/entities/brevan-howard-digital.js @@ -0,0 +1,11 @@ +const { treasuryExports } = require("../helper/treasury") + +const config = { + ethereum: { + owners: [ + "0x7D68a49754c55f1fB410F535f2b82a16f64481b6" + ], + }, +} + +module.exports = treasuryExports(config) \ No newline at end of file diff --git a/projects/entities/digital-currency-group.js b/projects/entities/digital-currency-group.js new file mode 100644 index 00000000000..3eff2bdb320 --- /dev/null +++ b/projects/entities/digital-currency-group.js @@ -0,0 +1,14 @@ +const { treasuryExports } = require("../helper/treasury") + +const config = { + ethereum: { + owners: [ + "0xA401f994975E1F82170A9040e0a42D9B4256eDaf", + "0x723B6706e3bDa84289F16b047A8b0e0936DBa59b", + "0xFb7327DB0528cf09375081Bb2f9d9Dbd2B23FF4A", + "0x09b2Dd967305ce5A7209243Ae865193401A985e7" + ], + }, +} + +module.exports = treasuryExports(config) \ No newline at end of file From 20d65f3d005f94ec7eea32e5fdfc8989a7920cd9 Mon Sep 17 00:00:00 2001 From: ammarsjw Date: Fri, 20 Oct 2023 18:49:43 +0500 Subject: [PATCH 1647/1974] add hydt tvl adapter --- projects/hydt/index.js | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 projects/hydt/index.js diff --git a/projects/hydt/index.js b/projects/hydt/index.js new file mode 100644 index 00000000000..b5de25cf290 --- /dev/null +++ b/projects/hydt/index.js @@ -0,0 +1,31 @@ +const { GraphQLClient } = require('graphql-request') + +const graphURL = "https://api.thegraph.com/subgraphs/name/waleed-shafiq/hydt-protocol"; + +const stakedQuery = '{ volumes( orderBy: blockTimestamp orderDirection: desc first: 1 where: { type: "Earn" } ) { amount }}'; +const priceQuery = '{ volumes( orderBy: blockTimestamp orderDirection: desc first: 1 where: { type: "Price" } ) { amount }}'; + +async function tvl(timestamp, block, _, { api }) { + var graphQLClient = new GraphQLClient(graphURL); + + const staked = await graphQLClient.request(stakedQuery); + const stakedAmount = staked.volumes[0].amount; + + const price = await graphQLClient.request(priceQuery); + const priceHYDT = price.volumes[0].amount; + + const totalValueLockedUSD = (stakedAmount * priceHYDT) / 1e36; + + return { + tether: totalValueLockedUSD + } +} + +module.exports = { + misrepresentedTokens: true, + methodology: "We get amounts from the HYDT staking (earn) contract via the subgraph", + start: 1693763345, + bsc: { + tvl, + }, +}; From 7313a19b811e6883a92d1f904909583fcb72936d Mon Sep 17 00:00:00 2001 From: ammarsjw Date: Fri, 20 Oct 2023 18:50:16 +0500 Subject: [PATCH 1648/1974] add hydt tvl adapter --- projects/hydt/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/hydt/index.js b/projects/hydt/index.js index b5de25cf290..2b4966e1a22 100644 --- a/projects/hydt/index.js +++ b/projects/hydt/index.js @@ -1,4 +1,4 @@ -const { GraphQLClient } = require('graphql-request') +const { GraphQLClient } = require('graphql-request'); const graphURL = "https://api.thegraph.com/subgraphs/name/waleed-shafiq/hydt-protocol"; From bd1ff75ddde2551af24a713419d859f19ce8ae74 Mon Sep 17 00:00:00 2001 From: John Amnis <143375741+john2798@users.noreply.github.com> Date: Fri, 20 Oct 2023 21:04:45 +0700 Subject: [PATCH 1649/1974] Adding adapter for Amnis Finance (#7793) --- projects/amnis-finance/index.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 projects/amnis-finance/index.js diff --git a/projects/amnis-finance/index.js b/projects/amnis-finance/index.js new file mode 100644 index 00000000000..a2e8f3cdd8b --- /dev/null +++ b/projects/amnis-finance/index.js @@ -0,0 +1,14 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { aQuery } = require('../helper/chain/aptos') + +module.exports = { + timetravel: false, + aptos: { + tvl: async () => { + const { data: { supply } } = await aQuery('/v1/accounts/0x111ae3e5bc816a5e63c2da97d0aa3886519e0cd5e4b046659fa35796bd11542a/resource/0x1::coin::CoinInfo%3C0x111ae3e5bc816a5e63c2da97d0aa3886519e0cd5e4b046659fa35796bd11542a::amapt_token::AmnisApt%3E') + return { + aptos: supply.vec[0].integer.vec[0].value/1e8 + } + } + } +} \ No newline at end of file From e1642ddffc3a3879712624207f28ac6d504ef191 Mon Sep 17 00:00:00 2001 From: Wayne Kuo <95527849+WayneAl@users.noreply.github.com> Date: Fri, 20 Oct 2023 23:01:48 +0800 Subject: [PATCH 1650/1974] Update typus-finance v2 (#7798) --- projects/typus-finance/index.js | 38 +++++++++------------------------ 1 file changed, 10 insertions(+), 28 deletions(-) diff --git a/projects/typus-finance/index.js b/projects/typus-finance/index.js index 35b1a2c78a5..4852ccf55f8 100644 --- a/projects/typus-finance/index.js +++ b/projects/typus-finance/index.js @@ -1,42 +1,24 @@ const sui = require("../helper/chain/sui"); -// const TYPUS_DOV_SINGLE_REGISTRY = -// "0xb44c0fa1ab40f7699be3dce02475965a636ed850348435abb3b797b273f6c551"; const SINGLE_DEPOSIT_VAULT_REGISTRY = - "0x4ae62c4d67f9f5d7077626fcc6d450535c4df710da455a0a2bd2226558832629"; -const SINGLE_BID_VAULT_REGISTRY = - "0x2c8cdd00ced47e717420cd2fc54990b3b38e115e34a9209271063a59ddeeb059"; + "0xd67cf93a0df61b4b3bbf6170511e0b28b21578d9b87a8f4adafec96322dd284d"; -async function tvl(_, _1, _2, { api }) { +async function tvl(timestamp, block, chainBlocks, { api }) { const depositVaultFields = await sui.getDynamicFieldObjects({ parent: SINGLE_DEPOSIT_VAULT_REGISTRY, }); const depositVaultIds = depositVaultFields.map((item) => item.fields.id.id); - const depositVaults = await sui.getObjects(depositVaultIds); - depositVaults.forEach(({ type, fields: { value: { fields }} }) => { - const coin = type.replace(">>", "").split(", ")[2]; - api.add(coin, fields.active_sub_vault.fields.balance) - api.add(coin, fields.deactivating_sub_vault.fields.balance) - api.add(coin, fields.inactive_sub_vault.fields.balance) - api.add(coin, fields.warmup_sub_vault.fields.balance) - }); - - const bidVaultFields = await sui.getDynamicFieldObjects({ - parent: SINGLE_BID_VAULT_REGISTRY, - }); - - const bidVaultIds = bidVaultFields.map((item) => item.fields.id.id); - - const bidVaults = await sui.getObjects(bidVaultIds); - - bidVaults.forEach(({ type, fields: { value: { fields }} }) => { - const coin = type.replace(">>", "").split(", ")[2]; - api.add(coin, fields.bidder_sub_vault.fields.balance) - api.add(coin, fields.premium_sub_vault.fields.balance) - api.add(coin, fields.performance_fee_sub_vault.fields.balance) + depositVaults.forEach(({ fields }) => { + const deposit_token = "0x" + fields.deposit_token.fields.name; + const bid_token = "0x" + fields.bid_token.fields.name; + api.add(deposit_token, fields.active_share_supply); + api.add(deposit_token, fields.deactivating_share_supply); + api.add(deposit_token, fields.inactive_share_supply); + api.add(deposit_token, fields.warmup_share_supply); + api.add(bid_token, fields.premium_share_supply); }); } From fda5f724c2265e1bb5aae30c61ccea058bb4ad37 Mon Sep 17 00:00:00 2001 From: "zebra.xyz" <147795949+zebra-xyz@users.noreply.github.com> Date: Fri, 20 Oct 2023 23:03:30 +0800 Subject: [PATCH 1651/1974] add Zebra project (#7801) Co-authored-by: zhihua --- projects/Zebra/index.js | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 projects/Zebra/index.js diff --git a/projects/Zebra/index.js b/projects/Zebra/index.js new file mode 100644 index 00000000000..458cb36a03a --- /dev/null +++ b/projects/Zebra/index.js @@ -0,0 +1,8 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports = { + misrepresentedTokens: false, + scroll: { + tvl: getUniTVL({ factory: '0xa63eb44c67813cad20A9aE654641ddc918412941', useDefaultCoreAssets: true, }) + } +}; \ No newline at end of file From 75261e80ac5c951c8727f567d7f61f8ac5b78d00 Mon Sep 17 00:00:00 2001 From: llama Date: Fri, 20 Oct 2023 19:07:51 +0200 Subject: [PATCH 1652/1974] track cog finance --- projects/cog-finance/index.js | 39 +++++++++++++++++++ projects/helper/coreAssets.json | 33 +++++++++++++--- projects/helper/portedTokens.js | 2 +- projects/helper/tokenMapping.js | 68 +-------------------------------- projects/mvcswap/index.js | 6 +-- 5 files changed, 71 insertions(+), 77 deletions(-) create mode 100644 projects/cog-finance/index.js diff --git a/projects/cog-finance/index.js b/projects/cog-finance/index.js new file mode 100644 index 00000000000..6d89488025b --- /dev/null +++ b/projects/cog-finance/index.js @@ -0,0 +1,39 @@ +const { getLogs } = require('../helper/cache/getLogs') +const { sumTokens2 } = require('../helper/unwrapLPs') + +const config = { + scroll: { factory: '0xbabd55549c266c6755b99173fe7604238d04117d', fromBlock: 85518} +} + +Object.keys(config).forEach(chain => { + const { factory, fromBlock, } = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const logs = await getLogs({ + api, + target: factory, + eventAbi: 'event MediumPairCreated (address indexed asset, address indexed collateral, address indexed pair)', + onlyArgs: true, + fromBlock, + }) + const ownerTokens = logs.map(i => [[i.asset, i.collateral], i.pair]) + return sumTokens2({ api, ownerTokens, }) + }, + borrowed: async (_, _b, _cb, { api, }) => { + const logs = await getLogs({ + api, + target: factory, + eventAbi: 'event MediumPairCreated (address indexed asset, address indexed collateral, address indexed pair)', + onlyArgs: true, + fromBlock, + }) + const pairs = logs.map(i => i.pair) + const borrows = await api.multiCall({ abi: 'function total_borrow() view returns (tuple(uint128 elastic, uint128 base))', calls: pairs}) + borrows.map((v, i) => { + api.add(logs[i].asset, v.elastic) + api.add(logs[i].asset, v.base) + }) + return api.getBalances() + } + } +}) \ No newline at end of file diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index aa10b08a501..b7a923e7eaf 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -1211,9 +1211,14 @@ "TON_1": "EQDQoc5M3Bh8eWFephi9bClhevelbZZvWhkqdo80XuY_0qXv", "TON_2": "Ef8zMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzM0vF", "TON_3": "EQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAM9c", + "TON_4": "EQCajaUU1XXSAjTD-xOV7pE49fGtg4q8kF3ELCOJtGvQFQ2C", "USDC": "EQC61IQRl0_la95t27xhIpjxZt32vl1QQVF2UgTNuvD18W-4", "USDT": "EQC_1YoM8RBixN95lz7odcF3Vrkc_N8Ne7gQi7Abtlet_Efi", - "ETH": "EQAW42HutyDem98Be1f27PoXobghh81umTQ-cGgaKVmRLS7-" + "ETH": "EQAW42HutyDem98Be1f27PoXobghh81umTQ-cGgaKVmRLS7-", + "MATIC": "EQBq4d4GPyBoh-Pjnf3wxUyQSS28WY2Yt-7cPAG8FHpWpNRX", + "ORC": "EQDCIEo0HUUYsAV-lTMviOd-GkSXfVPsNZMGjRaNOA_6--FD", + "MEGA": "EQBf6-YoR9xylol_NwjHrLkrTFAZJCX-bsd-Xx_902OaPaBf", + "WEMIX": "EQCf7Nb341dxOE3N0jimngRxGEV8T3zo-eU2EZVs_nchNhhZ" }, "defichain": { "DFI": "DFI", @@ -1342,6 +1347,11 @@ "tenet": { "WTENET": "0xd6cb8a253e12893b0cf39ca78f7d858652cca1fe" }, + "manta": { + "WETH": "0x0Dc808adcE2099A9F62AA87D9670745AbA741746", + "USDC": "0xb73603c5d87fa094b7314c74ace2e64d165016fb", + "USDT": "0xf417f5a458ec102b90352f697d6e2ac3a3d2851f" + }, "mantle": { "WMNT": "0x78c1b0c915c4faa5fffa6cabf0219da63d7f4cb8", "WETH": "0xdeaddeaddeaddeaddeaddeaddeaddeaddead1111", @@ -1371,7 +1381,8 @@ "WBTC": "factory/sei189adguawugk3e55zn63z8r9ll29xrjwca636ra7v7gxuzn98sxyqwzt47l/7omXa4gryZ5NiBmLep7JsTtTtANCVKXwT9vbN91aS1br" }, "op_bnb": { - "WBNB": "0x4200000000000000000000000000000000000006" + "WBNB": "0x4200000000000000000000000000000000000006", + "USDC": "0x9e5aac1ba1a2e6aed6b32689dfcf62a509ca96f3" }, "archway": { "ARCH": "aarch" @@ -1380,7 +1391,7 @@ "WHALE": "uwhale" }, "mvc": { - "SPACE": "", + "SPACE": "0x0000000000000000000000000000000000000000", "USDT": "7d8706c7f657730201ff3334064f83deb2fdec8a", "MSP": "b2d75931958114e48c9927160f80363eae78e2dc" }, @@ -1423,11 +1434,14 @@ }, "radixdlt": { "XRD": "resource_rdx1tknxxxxxxxxxradxrdxxxxxxxxx009923554798xxxxxxxxxradxrd", - "WETH": "resource_rdx1th88qcj5syl9ghka2g9l7tw497vy5x6zaatyvgfkwcfe8n9jt2npww", - "CVR": "resource_rdx1t4km4k306ul40s3zr8zwwrm25xfmx7w8ytjvdwqh0u3kkch0eph9rn" + "WETH": "resource_rdx1th88qcj5syl9ghka2g9l7tw497vy5x6zaatyvgfkwcfe8n9jt2npww" }, "shimmer_evm": { "WSMR": "0xBEb654A116aeEf764988DF0C6B4bf67CC869D01b", + "WSMR1": "0x1074010000000000000000000000000000000000", + "WSMR2": "0x6c890075406c5df08b427609e3a2ead1851ad68d", + "ETH": "0xa158a39d00c79019a01a6e86c56e96c461334eb0", + "WBTC": "0x1cdf3f46dbf8cf099d218cf96a769cea82f75316", "USDT": "0xc0E49f8C615d3d4c245970F6Dc528E4A47d69a44" }, "renec": { @@ -1448,6 +1462,13 @@ "UnifiedDAI": "0xcDB9579Db96EB5C8298dF889D915D0FF668AfF2a" }, "scroll": { - "WETH": "0x5300000000000000000000000000000000000004" + "WETH": "0x5300000000000000000000000000000000000004", + "USDC": "0x06eFdBFf2a14a7c8E15944D1F4A48F9F95F663A4" + }, + "darwinia": { + "RING": "0xe7578598aac020abfb918f33a20fad5b71d670b4" + }, + "pg": { + "WPG": "0x0cf4071940782b640d0b595cb17bdf3e90869d70" } } diff --git a/projects/helper/portedTokens.js b/projects/helper/portedTokens.js index a655929a656..5a1984d4854 100644 --- a/projects/helper/portedTokens.js +++ b/projects/helper/portedTokens.js @@ -112,7 +112,7 @@ async function getChainTransform(chain) { if (chain === 'terra2' && addr.startsWith('terra1')) return chainStr if (chain === 'aura' && addr.startsWith('aura')) return chainStr if (chain === 'algorand' && /^\d+$/.test(addr)) return chainStr - if (addr.startsWith('0x') || ['solana', 'kava'].includes(chain)) return chainStr + if (addr.startsWith('0x') || ['solana', 'kava', 'renec'].includes(chain)) return chainStr return addr }; } diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 0b004edaaaf..47bd2e9f157 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -17,7 +17,7 @@ coreAssets = JSON.parse(JSON.stringify(coreAssets)) // orbit brige: https://bridge.orbitchain.io/open/v1/api/monitor/rawTokenList const ibcChains = ['ibc', 'terra', 'terra2', 'crescent', 'osmosis', 'kujira', 'stargaze', 'juno', 'injective', 'cosmos', 'comdex', 'umee', 'orai', 'persistence', 'fxcore', 'neutron', 'quasar', 'chihuahua', 'sei', 'archway', 'migaloo', 'secret', 'aura', 'xpla'] -const caseSensitiveChains = [...ibcChains, 'solana', 'tezos', 'ton', 'algorand', 'aptos', 'near', 'bitcoin', 'waves', 'tron', 'litecoin', 'polkadot', 'ripple', 'elrond', 'cardano', 'stacks', 'sui', 'ergo', 'mvc',] +const caseSensitiveChains = [...ibcChains, 'solana', 'tezos', 'ton', 'algorand', 'aptos', 'near', 'bitcoin', 'waves', 'tron', 'litecoin', 'polkadot', 'ripple', 'elrond', 'cardano', 'stacks', 'sui', 'ergo', 'mvc', 'renec',] const distressedAssts = new Set(Object.values({ CRK: '0x065de42e28e42d90c2052a1b49e7f83806af0e1f', @@ -35,18 +35,6 @@ const transformTokens = { // "0x065de42e28e42d90c2052a1b49e7f83806af0e1f": "0x123", // CRK token is mispriced // [ADDRESSES.cronos.TUSD]: ADDRESSES.ethereum.TUSD, // }, - ronin: { - [ADDRESSES.null]: 'ronin:' + ADDRESSES.ronin.WRON, - }, - - bfc: { - "0x6c9944674C1D2cF6c4c4999FC7290Ba105dcd70e": ADDRESSES.null, - "0xB800EaF843F962DFe5e145A8c9D07A3e70b11d7F": 'bsc:' + ADDRESSES.null, - "0x640952E7984f2ECedeAd8Fd97aA618Ab1210A21C": ADDRESSES.ethereum.USDC, - "0x21ad243b81eff53482F6F6E7C76539f2CfC0B734": 'polygon:' + ADDRESSES.null, - "0x3eA8654d5755e673599473ab37d92788B5bA12aE": ADDRESSES.ethereum.USDT, - "0xcDB9579Db96EB5C8298dF889D915D0FF668AfF2a": ADDRESSES.ethereum.DAI, - } } const ibcMappings = { // Sample Code @@ -62,61 +50,7 @@ const fixBalancesTokens = { radixdlt: { [ADDRESSES.radixdlt.XRD]: { coingeckoId: 'radix', decimals: 0}, [ADDRESSES.radixdlt.WETH]: { coingeckoId: 'ethereum', decimals: 0}, - [ADDRESSES.radixdlt.CVR]: { coingeckoId: 'caviar', decimals: 0}, - }, - mvc: { - [ADDRESSES.mvc.SPACE]: { coingeckoId: "microvisionchain", decimals: 8 }, - }, - darwinia: { - '0xe7578598aac020abfb918f33a20fad5b71d670b4': { coingeckoId: "darwinia-network-native-token", decimals: 18 }, - }, - pg: { - '0x0cf4071940782b640d0b595cb17bdf3e90869d70': { coingeckoId: 'pego-network-2', decimals: 18 }, - }, - shimmer_evm: { - '0x1074010000000000000000000000000000000000': { coingeckoId: 'shimmer', decimals: 6 }, - [ADDRESSES.shimmer_evm.WSMR]: { coingeckoId: 'shimmer', decimals: 18 }, - '0x6c890075406c5df08b427609e3a2ead1851ad68d': { coingeckoId: 'shimmer', decimals: 18 }, - '0x3C844FB5AD27A078d945dDDA8076A4084A76E513': { coingeckoId: 'soonaverse', decimals: 6 }, - [ADDRESSES.shimmer_evm.USDT]: { coingeckoId: 'tether', decimals: 18 }, - '0xa158a39d00c79019a01a6e86c56e96c461334eb0': { coingeckoId: 'ethereum', decimals: 18 }, - '0x1cdf3f46dbf8cf099d218cf96a769cea82f75316': { coingeckoId: 'wrapped-bitcoin', decimals: 8 }, - }, - manta: { - '0x0Dc808adcE2099A9F62AA87D9670745AbA741746': { coingeckoId: 'ethereum', decimals: 18 }, - '0xb73603c5d87fa094b7314c74ace2e64d165016fb': { coingeckoId: 'usd-coin', decimals: 6 }, - '0xf417f5a458ec102b90352f697d6e2ac3a3d2851f': { coingeckoId: 'tether', decimals: 6 }, - }, - scroll: { - '0x5300000000000000000000000000000000000004': { coingeckoId: 'coingecko:ethereum', decimals: 18 }, - [ADDRESSES.null]: { coingeckoId: 'ethereum', decimals: 18 }, - '0x06eFdBFf2a14a7c8E15944D1F4A48F9F95F663A4': { coingeckoId: 'usd-coin', decimals: 6 } - }, - nos: { - [ADDRESSES.nos.BTC]: { coingeckoId: 'bitcoin', decimals: 18 }, - }, - ton: { - 'EQBq4d4GPyBoh-Pjnf3wxUyQSS28WY2Yt-7cPAG8FHpWpNRX': { coingeckoId: 'matic-network', decimals: 18 }, - 'EQDCIEo0HUUYsAV-lTMviOd-GkSXfVPsNZMGjRaNOA_6--FD': { coingeckoId: 'orbit-chain', decimals: 18 }, - 'EQBf6-YoR9xylol_NwjHrLkrTFAZJCX-bsd-Xx_902OaPaBf': { coingeckoId: 'megaton-finance', decimals: 9 }, - 'EQCajaUU1XXSAjTD-xOV7pE49fGtg4q8kF3ELCOJtGvQFQ2C': { coingeckoId: 'the-open-network', decimals: 9 }, - 'EQCf7Nb341dxOE3N0jimngRxGEV8T3zo-eU2EZVs_nchNhhZ': { coingeckoId: 'wemix-token', decimals: 18 } - }, - beam: { - [ADDRESSES.beam.WMC]: { coingeckoId: 'merit-circle', decimals: 18 }, - [ADDRESSES.beam.USDC]: { coingeckoId: 'usd-coin', decimals: 6 }, - [ADDRESSES.beam.USDT]: { coingeckoId: 'tether', decimals: 18 }, - }, - bfc: { - [ADDRESSES.null]: { coingeckoId: 'bifrost', decimals: 18 }, - }, - renec: { - [ADDRESSES.renec.RENEC]: { coingeckoId: "renec", decimals: 9 }, - [ADDRESSES.renec.REUSD]: { coingeckoId: "tether", decimals: 9 }, // reUSD pegged USDT || bridge: https://remitano.com/swap/vn/usdt_reusd }, - op_bnb: { - '0x9e5aac1ba1a2e6aed6b32689dfcf62a509ca96f3': { coingeckoId: 'tether', decimals: 18 } - } } ibcChains.forEach(chain => fixBalancesTokens[chain] = { ...ibcMappings, ...(fixBalancesTokens[chain] || {}) }) diff --git a/projects/mvcswap/index.js b/projects/mvcswap/index.js index 020dde8aef2..c2d1e293fb1 100644 --- a/projects/mvcswap/index.js +++ b/projects/mvcswap/index.js @@ -1,6 +1,6 @@ const axios = require("axios") const { transformDexBalances } = require('../helper/portedTokens') -const sdk = require('@defillama/sdk') +const ADDRESSES = require('../helper/coreAssets.json') module.exports = { misrepresentedTokens: true, @@ -16,8 +16,8 @@ module.exports = { return transformDexBalances({ chain: 'mvc', data: Object.keys(data).map(i => ({ - token0: data[i].token1.tokenID, - token1: data[i].token2.tokenID, + token0: data[i].token1.tokenID || ADDRESSES.null, + token1: data[i].token2.tokenID || ADDRESSES.null, token0Bal: data[i].token1Amount, token1Bal: data[i].token2Amount, })) From 9cadf081454e1c782d000ebe8b5ca937c60307e6 Mon Sep 17 00:00:00 2001 From: guacamolem9 <102904399+guacamolem9@users.noreply.github.com> Date: Sat, 21 Oct 2023 03:20:49 +1000 Subject: [PATCH 1653/1974] PlutusDAO update: Add latest farms and PLS V2 stakers to PlutusDAO (#7802) --- projects/plutusDAO/index.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/projects/plutusDAO/index.js b/projects/plutusDAO/index.js index 05c2097e748..1ba63c511e1 100644 --- a/projects/plutusDAO/index.js +++ b/projects/plutusDAO/index.js @@ -14,6 +14,12 @@ const plsJones = "0xe7f6C3c1F0018E4C08aCC52965e5cbfF99e34A44"; const plsJonesFarm = "0x23B87748b615096d1A0F48870daee203A720723D"; const plsSpa = "0x0D111e482146fE9aC9cA3A65D92E65610BBC1Ba6"; const plsSpaFarm = "0x73e7c78E8a85C074733920f185d1c78163b555C8"; +const plsRdnt = "0x1605bbDAB3b38d10fA23A7Ed0d0e8F4FEa5bFF59"; +const plsRdntFarm = "0xaE3f67589Acb90bd2cbccD8285b37fe4F8F29042" +const plsArb = "0x7a5D193fE4ED9098F7EAdC99797087C96b002907" +const plsARbFarm = "0xCfc273D86333bF453b847d4D8cb7958307D85196" + + const plvGlpToken = ADDRESSES.arbitrum.plvGLP; const plgGlpPlutusChef = "0x4E5Cf54FdE5E1237e80E87fcbA555d829e1307CE"; @@ -23,6 +29,8 @@ const dpxPlsDpxLp = "0x16e818e279d7a12ff897e257b397172dcaab323b"; const plsEthMasterChef = "0x5593473e318F0314Eb2518239c474e183c4cBED5"; const plsEthLp = "0x6CC0D643C7b8709F468f58F363d73Af6e4971515"; +const plsV2Staker = "0xE9645988a5E6D5EfCc939bed1F3040Dba94C6CbB" + const lps = [ '0x16e818e279d7a12ff897e257b397172dcaab323b', // DPX-plsDPX-LP '0x69fdf3b2e3784a315e2885a19d3565c4398d49a5', // plxJONES JONES-WETH SLP @@ -46,12 +54,20 @@ async function tvl(ts, _block, {[chain]: block}) { sdk.util.sumSingleBalance(balances, 'arbitrum:0x4277f8F2c384827B5273592FF7CeBd9f2C1ac258', plvGlpSupply) // sum as GLP as well + const {output: totalStakedPlsV2} = await sdk.api.erc20.totalSupply({ + target: plsV2Staker, + chain, + block, + }) + sdk.util.sumSingleBalance(balances, `arbitrum:${plutusToken}`, totalStakedPlsV2) const tokensAndOwners = [ [plsDpx, plsDpxFarmV1], [plsDpx, plsDpxFarm], [plsJones, plsJonesFarm], [plsSpa, plsSpaFarm], + [plsRdnt, plsRdntFarm], + [plsArb, plsARbFarm], ] return sumUnknownTokens({ balances, tokensAndOwners, lps, coreAssets, chain, block, From 7c6d01e2596846531e979a0fd0d657d729973cdf Mon Sep 17 00:00:00 2001 From: ik3ee <148565799+ik3ee@users.noreply.github.com> Date: Fri, 20 Oct 2023 19:26:43 +0200 Subject: [PATCH 1654/1974] Add AnonSocial --- projects/AnonSocial/index.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 projects/AnonSocial/index.js diff --git a/projects/AnonSocial/index.js b/projects/AnonSocial/index.js new file mode 100644 index 00000000000..81a044b0fef --- /dev/null +++ b/projects/AnonSocial/index.js @@ -0,0 +1,14 @@ +const { sumTokens2, nullAddress } = require("../helper/unwrapLPs"); + +const contract = "0x76192E7cD69bb6F7992E4d996790942653b9F704"; + +async function tvl(time, ethBlock, _b, { api }) { + return sumTokens2({ tokens: [nullAddress], owner: contract, api }); +} + +module.exports = { + methodology: `We count the ETH on ${contract}`, + base: { + tvl, + }, +}; From 0c03edae33a67b821625eb8034d4dc048927d874 Mon Sep 17 00:00:00 2001 From: Larry the Cucumber <71284258+larrythecucumber321@users.noreply.github.com> Date: Fri, 20 Oct 2023 13:10:19 -0700 Subject: [PATCH 1655/1974] Track Base Assets for Reserve Protocol (#7770) * update Reserve to track Base * update Reserve methodology * refactor code --------- Co-authored-by: llama --- projects/reserve/helper.js | 110 ++++++++++++++++++++ projects/reserve/index.js | 206 +++++++++++++++++++++++-------------- 2 files changed, 239 insertions(+), 77 deletions(-) create mode 100644 projects/reserve/helper.js diff --git a/projects/reserve/helper.js b/projects/reserve/helper.js new file mode 100644 index 00000000000..56f67c78a24 --- /dev/null +++ b/projects/reserve/helper.js @@ -0,0 +1,110 @@ +const { getLogs } = require("../helper/cache/getLogs"); + +const stargateLpStakingAbi = { + userInfo: + "function userInfo( uint256 ,address ) external view returns (uint256 amount, uint256 rewardDebt)", +}; + +const stargatePoolAbi = { + amountLPtoLD: + "function amountLPtoLD(uint256 _amountLP) external view returns (uint256)", + token: "function token() external view returns (address)", +}; + +const getStargateLpValues = async (api, stargateLpWrappers, processedWrappers) => { + const stargateLpPools = await api.multiCall({ + abi: "address:underlying", + calls: stargateLpWrappers, + }); + + const stargateStakingContracts = await api.multiCall({ + abi: "address:stakingContract", + calls: stargateLpWrappers, + }); + + const stargatePoolIds = await api.multiCall({ + abi: "uint256:poolId", + calls: stargateLpWrappers, + }); + + const stargateLpAmounts = ( + await api.multiCall({ + calls: stargateLpWrappers.map((wrapperAddress, i) => ({ + target: stargateStakingContracts[i], + params: [stargatePoolIds[i], wrapperAddress], + })), + abi: stargateLpStakingAbi.userInfo, + }) + ).map(([amount]) => amount); + + // find the amount of assets convert from lpAmount + const convertedAmounts = await api.multiCall({ + calls: stargateLpPools.map((lpPool, i) => ({ + target: lpPool, + params: [stargateLpAmounts[i]], + })), + abi: stargatePoolAbi.amountLPtoLD, + }); + + let baseStargateAssets = await api.multiCall({ + calls: stargateLpPools, + abi: stargatePoolAbi.token, + }); + + baseStargateAssets.forEach((asset, i) => { + if (processedWrappers.has(stargateLpWrappers[i])) return; + api.add(asset, convertedAmounts[i]) + // Mark this wrapper as processed + processedWrappers.add(stargateLpWrappers[i]); + }); +}; + +const getCompoundUsdcValues = async (api, cUsdcV3Wrapper, processedWrappers) => { + const cUsdcV3 = await api.call({ + abi: "address:underlyingComet", + target: cUsdcV3Wrapper, + }); + + const baseToken = ( + await api.multiCall({ + abi: "address:baseToken", + calls: [cUsdcV3], + }) + )[0]; + + const wrapperBalance = await api.call({ + abi: "erc20:balanceOf", + target: cUsdcV3, + params: [cUsdcV3Wrapper], + }); + + if (!processedWrappers.has(cUsdcV3Wrapper)) { + api.add(baseToken, wrapperBalance) + processedWrappers.add(cUsdcV3Wrapper); + } +}; + +const _getLogs = async (api, config) => { + const resLog = ( + await Promise.all( + config.deployerAddresses.map((deployerAddress) => + getLogs({ + api, + target: deployerAddress, + topic: "RTokenCreated(address,address,address,address,string)", + fromBlock: config.fromBlock, + eventAbi: + "event RTokenCreated(address indexed main, address indexed rToken, address stRSR, address indexed owner, string version)", + onlyArgs: true, + }) + ) + ) + ).flat(); + return resLog; +}; + +module.exports = { + getStargateLpValues, + getCompoundUsdcValues, + _getLogs, +}; diff --git a/projects/reserve/index.js b/projects/reserve/index.js index b5fea0f3d36..0e092f801cd 100644 --- a/projects/reserve/index.js +++ b/projects/reserve/index.js @@ -1,84 +1,136 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const { getLogs } = require('../helper/cache/getLogs') -const { sumTokens2, genericUnwrapCvxDeposit, unwrapCreamTokens } = require("../helper/unwrapLPs.js"); - -const vault = "0xaedcfcdd80573c2a312d15d6bb9d921a01e4fb0f"; -const deployerAddresses = ["0xFd6CC4F251eaE6d02f9F7B41D1e80464D3d2F377", "0x5c46b718Cd79F2BBA6869A3BeC13401b9a4B69bB"]; -const rsr = "0x320623b8E4fF03373931769A31Fc52A4E78B5d70"; - -async function tvl(_time, block, _, { api }) { - // First section is for RSV which will soon be deprecated - const ownerTokens = [[[ - ADDRESSES.ethereum.USDC, //usdc - "0x8e870d67f660d95d5be530380d0ec0bd388289e1", //pax - ADDRESSES.ethereum.TUSD, //tusd - ADDRESSES.ethereum.BUSD, //busd - ], vault]] - const blacklistedTokens = [rsr] - const fluxListWithOwner = [] - const creationLogs = await _getLogs(api) - - const mains = creationLogs.map(i => i.main) - const rTokens = creationLogs.map(i => i.rToken) - - const backingManagers = await api.multiCall({ abi: 'address:backingManager', calls: mains }) - const basketHandlers = await api.multiCall({ abi: 'address:basketHandler', calls: mains }) - const basketRes = await api.multiCall({ abi: "function quote(uint192, uint8) view returns (address[], uint256[])", calls: basketHandlers.map(i => ({ target: i, params: [0, 0] })) }) - await Promise.all(basketRes.map(async ([tokens], idx) => { - const rToken = rTokens[idx] - const manager = backingManagers[idx] - const names = await api.multiCall({ abi: 'string:name', calls: tokens, }) - - // handle Atokens - const aTokenBases = tokens.filter((_, i) => names[i].startsWith('Static ')) - tokens = tokens.filter((_, i) => !names[i].startsWith('Static ')) - const aTokens = await api.multiCall({ abi: 'address:ATOKEN', calls: aTokenBases}) - blacklistedTokens.push(...aTokenBases) - aTokens.forEach((v, i) => ownerTokens.push([[v], aTokenBases[i]])) - - // handle flux and convex deposit tokens - const baseTokens = tokens.filter((_, i) => names[i].endsWith('Convex Deposit')) - const fluxTokens = tokens.filter((_, i) => names[i].startsWith('Flux ')) - blacklistedTokens.push(...baseTokens) - blacklistedTokens.push(...fluxTokens) - tokens = tokens.filter((_, i) => !names[i].endsWith('Convex Deposit')) - tokens = tokens.filter((_, i) => !names[i].startsWith('Flux ')) - fluxTokens.forEach(token => { - fluxListWithOwner.push([token, rToken]) - fluxListWithOwner.push([token, manager]) - }) - // Update lpBalances for Curve tokens - await Promise.all(baseTokens.map((token) => genericUnwrapCvxDeposit({ api, token, owner: rToken }))) - await Promise.all(baseTokens.map((token) => genericUnwrapCvxDeposit({ api, token, owner: manager }))) - - ownerTokens.push([tokens, rToken]) - ownerTokens.push([tokens, manager]) - })) - await unwrapCreamTokens(api.getBalances(), fluxListWithOwner, block) - - await sumTokens2({ api, ownerTokens, blacklistedTokens }) -} +const { + sumTokens2, + genericUnwrapCvxDeposit, + unwrapCreamTokens, +} = require("../helper/unwrapLPs.js"); +const { + getStargateLpValues, + getCompoundUsdcValues, + _getLogs, +} = require("./helper"); + +const chainConfigs = { + ethereum: { + deployerAddresses: [ + "0xFd6CC4F251eaE6d02f9F7B41D1e80464D3d2F377", + "0x5c46b718Cd79F2BBA6869A3BeC13401b9a4B69bB", + ], + rsr: "0x320623b8E4fF03373931769A31Fc52A4E78B5d70", + vault: "0xaedcfcdd80573c2a312d15d6bb9d921a01e4fb0f", + fromBlock: 16680995, + }, + base: { + deployerAddresses: [ + "0xf1B06c2305445E34CF0147466352249724c2EAC1", + "0x9C75314AFD011F22648ca9C655b61674e27bA4AC", + ], + rsr: "0xab36452dbac151be02b16ca17d8919826072f64a", + fromBlock: 5000000, + }, +}; + +async function tvl(_time, block, _, { api, chain }) { + const config = chainConfigs[chain]; + + // Common logic for calculating TVL (only mainnet has vault) + const ownerTokens = config.vault + ? [ + [ + [ + "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", //usdc + "0x8e870d67f660d95d5be530380d0ec0bd388289e1", //pax + "0x0000000000085d4780B73119b644AE5ecd22b376", //tusd + "0x4Fabb145d64652a948d72533023f6E7A623C7C53", //busd + ], + config.vault, + ], + ] + : []; + const blacklistedTokens = [config.rsr]; + const fluxListWithOwner = []; + const creationLogs = await _getLogs(api, config); + + const mains = creationLogs.map((i) => i.main); + const rTokens = creationLogs.map((i) => i.rToken); + + const backingManagers = await api.multiCall({ + abi: "address:backingManager", + calls: mains, + }); + const basketHandlers = await api.multiCall({ + abi: "address:basketHandler", + calls: mains, + }); + const basketRes = await api.multiCall({ + abi: "function quote(uint192, uint8) view returns (address[], uint256[])", + calls: basketHandlers.map((i) => ({ target: i, params: [0, 0] })), + }); + + let processedWrappers = new Set(); + let wrapperBalances = {}; + const allTokens = basketRes.flatMap(([tokens], i) => { + ownerTokens.push([tokens, rTokens[i]]); + ownerTokens.push([tokens, backingManagers[i]]); + return tokens + }); + const allRTokens = basketRes.flatMap(([tokens], i) => tokens.map(() => rTokens[i])) + const allManagers = basketRes.flatMap(([tokens], i) => tokens.map(() => backingManagers[i])) + const allNames = await api.multiCall({ abi: "string:name", calls: allTokens }); + + const aTokenWrappers = allTokens.filter((_, i) => allNames[i].startsWith("Static Aave")); + const cUsdcV3Wrapper = allTokens.find((_, i) => allNames[i].startsWith("Wrapped cUSDCv3")); + const stargateLpWrappers = allTokens.filter((_, i) => allNames[i].startsWith("Wrapped Stargate")); + const convexTokensAndOwners = [] + + allTokens.forEach((token, i) => { + if (!allNames[i].startsWith("Flux ")) return; + fluxListWithOwner.push([token, allRTokens[i]]); + fluxListWithOwner.push([token, allManagers[i]]); + blacklistedTokens.push(token); + return true; + }); + + allTokens.forEach((token, i) => { + if (!allNames[i].endsWith("Convex Deposit")) return; + blacklistedTokens.push(token); + convexTokensAndOwners.push([token, allRTokens[i]]); + convexTokensAndOwners.push([token, allManagers[i]]); + }); + + let aTokens = await api.multiCall({ abi: api.chain === 'base' ? "address:aToken" : "address:ATOKEN", calls: aTokenWrappers, }); + blacklistedTokens.push(...aTokenWrappers, ...stargateLpWrappers); + aTokens.forEach((v, i) => ownerTokens.push([[v], aTokenWrappers[i]])); + + + if (stargateLpWrappers.length) + await getStargateLpValues(api, stargateLpWrappers, processedWrappers, wrapperBalances); + + if (cUsdcV3Wrapper) { + blacklistedTokens.push(cUsdcV3Wrapper); + await getCompoundUsdcValues(api, cUsdcV3Wrapper, processedWrappers, wrapperBalances); + } + + + await Promise.all(convexTokensAndOwners.map(([token, owner]) => genericUnwrapCvxDeposit({ api, token, owner, }))); + + await unwrapCreamTokens(api.getBalances(), fluxListWithOwner, api.block); -async function staking(_time, block, _, { api }) { - const creationLogs = await _getLogs(api) - const stRsrs = creationLogs.map(i => i.stRSR) - return sumTokens2({ api, owners: stRsrs, tokens: [rsr] }) + await sumTokens2({ api, ownerTokens, blacklistedTokens }); } -async function _getLogs(api) { - const resLog = (await Promise.all(deployerAddresses.map(deployerAddress => - getLogs({ - api, - target: deployerAddress, - topic: 'RTokenCreated(address,address,address,address,string)', - fromBlock: 16680995, - eventAbi: 'event RTokenCreated(address indexed main, address indexed rToken, address stRSR, address indexed owner, string version)', - onlyArgs: true, - })))).flat() - return resLog +async function staking(_time, block, _, { api, chain }) { + const config = chainConfigs[chain]; // Load the config for the specified chain + const creationLogs = await _getLogs(api, config); + const stRsrs = creationLogs.map((i) => i.stRSR); + return sumTokens2({ api, owners: stRsrs, tokens: [config.rsr] }); } module.exports = { - ethereum: { tvl, staking, }, - methodology: `Gets the tokens on ${vault}`, + ethereum: { + tvl, staking, + }, + base: { + tvl, staking, + }, + methodology: `TVL accounts for the underlying ERC20 collateral which back RTokens.`, }; From b3ca58db65682d48452f08123f8579b531245d9f Mon Sep 17 00:00:00 2001 From: llama Date: Fri, 20 Oct 2023 22:16:03 +0200 Subject: [PATCH 1656/1974] track https://papyrusswap.com/ --- projects/papyrusswap/index.js | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 projects/papyrusswap/index.js diff --git a/projects/papyrusswap/index.js b/projects/papyrusswap/index.js new file mode 100644 index 00000000000..6edf5fb367a --- /dev/null +++ b/projects/papyrusswap/index.js @@ -0,0 +1,3 @@ +const { uniTvlExport } = require('../helper/unknownTokens') + +module.exports = uniTvlExport('scroll', '0xD5f3D3fb72210bfe71a59c05e0b8D72973baa2a6', { fetchBalances: true, }) \ No newline at end of file From bc1b8ac7f99f3f41b7a2052770c64cdfaa6b35bb Mon Sep 17 00:00:00 2001 From: llama Date: Fri, 20 Oct 2023 22:31:22 +0200 Subject: [PATCH 1657/1974] track marinade native --- projects/marinade-native/index.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 projects/marinade-native/index.js diff --git a/projects/marinade-native/index.js b/projects/marinade-native/index.js new file mode 100644 index 00000000000..6dc91fe50ed --- /dev/null +++ b/projects/marinade-native/index.js @@ -0,0 +1,25 @@ +const { StakeProgram } = require("@solana/web3.js") +const { getConnection } = require('../helper/solana') + +async function tvl(_, _b, _cb, { api, }) { + const stakeAccounts = await getConnection().getProgramAccounts(StakeProgram.programId, { + filters: [{ + memcmp: { + bytes: 'stWirqFCf2Uts1JBL1Jsd3r6VBWhgnpdPxCTe1MFjrq', + offset: 4 + 8 + } + }] + }) + + const nativeTvl = stakeAccounts.reduce((tvl, { account }) => { + return tvl + account.lamports/1e9 + }, 0) + + return { + solana: nativeTvl + } +} + +module.exports = { + solana: { tvl } +} \ No newline at end of file From da8750aa87cba4cf475c389c794e4cf459fc0a86 Mon Sep 17 00:00:00 2001 From: llama Date: Fri, 20 Oct 2023 23:37:23 +0200 Subject: [PATCH 1658/1974] update cog.fi --- projects/cog-finance/index.js | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/projects/cog-finance/index.js b/projects/cog-finance/index.js index 6d89488025b..211fff104dd 100644 --- a/projects/cog-finance/index.js +++ b/projects/cog-finance/index.js @@ -2,33 +2,34 @@ const { getLogs } = require('../helper/cache/getLogs') const { sumTokens2 } = require('../helper/unwrapLPs') const config = { - scroll: { factory: '0xbabd55549c266c6755b99173fe7604238d04117d', fromBlock: 85518} + scroll: { factory: '0xbabd55549c266c6755b99173fe7604238d04117d', fromBlock: 85518 } +} + +async function _getLogs(api, factory, fromBlock,) { + const events = ['StablePairCreated', 'LowPairCreated', 'MediumPairCreated', 'HighPairCreated'] + const logs = (await Promise.all(events.map(event => getLogs({ + api, + target: factory, + eventAbi: `event ${event} (address indexed asset, address indexed collateral, address indexed pair)`, + onlyArgs: true, + extraKey: event, + fromBlock, + })))).flat() + return logs } Object.keys(config).forEach(chain => { const { factory, fromBlock, } = config[chain] module.exports[chain] = { tvl: async (_, _b, _cb, { api, }) => { - const logs = await getLogs({ - api, - target: factory, - eventAbi: 'event MediumPairCreated (address indexed asset, address indexed collateral, address indexed pair)', - onlyArgs: true, - fromBlock, - }) + const logs = await _getLogs(api, factory, fromBlock,) const ownerTokens = logs.map(i => [[i.asset, i.collateral], i.pair]) return sumTokens2({ api, ownerTokens, }) }, borrowed: async (_, _b, _cb, { api, }) => { - const logs = await getLogs({ - api, - target: factory, - eventAbi: 'event MediumPairCreated (address indexed asset, address indexed collateral, address indexed pair)', - onlyArgs: true, - fromBlock, - }) + const logs = await _getLogs(api, factory, fromBlock,) const pairs = logs.map(i => i.pair) - const borrows = await api.multiCall({ abi: 'function total_borrow() view returns (tuple(uint128 elastic, uint128 base))', calls: pairs}) + const borrows = await api.multiCall({ abi: 'function total_borrow() view returns (tuple(uint128 elastic, uint128 base))', calls: pairs }) borrows.map((v, i) => { api.add(logs[i].asset, v.elastic) api.add(logs[i].asset, v.base) From 42c511901f489f8655125cc7addb607294f7f8b3 Mon Sep 17 00:00:00 2001 From: llama Date: Sat, 21 Oct 2023 08:38:51 +0200 Subject: [PATCH 1659/1974] fix broken adapters --- projects/helper/chain/cosmos.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/projects/helper/chain/cosmos.js b/projects/helper/chain/cosmos.js index 2bc37e86516..d579e0bc8e7 100644 --- a/projects/helper/chain/cosmos.js +++ b/projects/helper/chain/cosmos.js @@ -13,14 +13,14 @@ const endPoints = { crescent: "https://mainnet.crescent.network:1317", osmosis: "https://osmosis-api.polkachu.com", cosmos: "https://cosmoshub-lcd.stakely.io", - kujira: "https://kuji-api.kleomedes.network", + kujira: "https://lcd-kujira.whispernode.com:443", comdex: "https://rest.comdex.one", terra: "https://terra-classic-lcd.publicnode.com", terra2: "https://terra-lcd.publicnode.com", umee: "https://umee-api.polkachu.com", orai: "https://lcd.orai.io", - juno: "https://lcd-juno.cosmostation.io", - cronos: "https://lcd-crypto-org.cosmostation.io", + juno: "https://juno.api.m.stavr.tech", + cronos: "https://rest.mainnet.crypto.org", chihuahua: "https://rest.cosmos.directory/chihuahua", stargaze: "https://rest.stargaze-apis.com", quicksilver: "https://rest.cosmos.directory/quicksilver", From 624f2687aa83572004fa04b5ae340f23ae7e383c Mon Sep 17 00:00:00 2001 From: llama Date: Sat, 21 Oct 2023 08:54:57 +0200 Subject: [PATCH 1660/1974] near: track native usdc --- projects/helper/chain/near.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/helper/chain/near.js b/projects/helper/chain/near.js index 4076476ac80..958ad675dc8 100644 --- a/projects/helper/chain/near.js +++ b/projects/helper/chain/near.js @@ -42,6 +42,7 @@ const tokenMapping = { [ADDRESSES.near.PEMBROCK]: { name: 'pembrock', decimals: 18 }, 'token.sweat': { name: 'sweatcoin', decimals: 18 }, 'v2-nearx.stader-labs.near': { name: 'stader-nearx', decimals: 24 }, + '17208628f84f5d6ad33f0da3bbbeb27ffcb398eac501a31bd6ad2011e36133a1': { name: 'usd-coin', decimals: 6 }, } async function view_account(account_id) { From 175132599f2a4f8be0cc89c9410145891baa657d Mon Sep 17 00:00:00 2001 From: llama Date: Sat, 21 Oct 2023 13:27:35 +0200 Subject: [PATCH 1661/1974] fix Heco rpc issue --- projects/helper/env.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/helper/env.js b/projects/helper/env.js index 652e933fe51..07493d496f8 100644 --- a/projects/helper/env.js +++ b/projects/helper/env.js @@ -16,6 +16,7 @@ const DEFAULTS = { EVMOS_RPC: "https://evmos-evm.publicnode.com", NOVA_RPC: "https://connect.novanetwork.io", SCROLL_RPC: "https://rpc-scroll.icecreamswap.com", + HECO_RPC: "https://http-mainnet-node.huobichain.com", } const ENV_KEYS = [ From b7e8e6f1d101d196d5e4a5b9c281da4a4880e407 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Sun, 22 Oct 2023 04:16:02 +0100 Subject: [PATCH 1662/1974] simple fix for sol drops --- projects/helper/solana.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/projects/helper/solana.js b/projects/helper/solana.js index 3e83c4d5dc6..150161ef6b2 100644 --- a/projects/helper/solana.js +++ b/projects/helper/solana.js @@ -396,6 +396,10 @@ async function sumTokens2({ blacklistedTokens.forEach(i => delete balances['solana:'+i]) + if(Object.keys(balances).length == 0){ + throw new Error("0 tvl") + } + return balances async function _sumTokens(tokensAndAccounts) { From 921a10a1bec1957a2aac7be54b73696cb437907f Mon Sep 17 00:00:00 2001 From: Shichiro Nakahara <127815112+shichiro-nakahara@users.noreply.github.com> Date: Sat, 21 Oct 2023 22:07:59 -0700 Subject: [PATCH 1663/1974] Add Nata Network TVL (#7804) * Add Nata Network TVL * minor fix --------- Co-authored-by: llama --- projects/aark/index.js | 2 +- projects/celerbridge/index.js | 2 +- projects/helper/cex.js | 8 ++++---- projects/nata/index.js | 19 +++++++++++++++++++ projects/omnibtc/index.js | 4 ++-- projects/reserve/index.js | 7 ++++--- projects/shell/index.js | 2 +- projects/sociogram/index.js | 3 ++- projects/unidex/index.js | 4 ++-- 9 files changed, 36 insertions(+), 15 deletions(-) create mode 100644 projects/nata/index.js diff --git a/projects/aark/index.js b/projects/aark/index.js index 9437b07f12a..7763a5e0496 100644 --- a/projects/aark/index.js +++ b/projects/aark/index.js @@ -6,7 +6,7 @@ async function tvl(_, _b, _cb, { api, }) { ADDRESSES.arbitrum.WETH, ADDRESSES.arbitrum.USDC, '0x17FC002b466eEc40DaE837Fc4bE5c67993ddBd6F', - '0xaf88d065e77c8cC2239327C5EDb3A432268e5831' + ADDRESSES.arbitrum.USDC_CIRCLE ] }) } diff --git a/projects/celerbridge/index.js b/projects/celerbridge/index.js index ea538f461d0..dbcf85e0ccb 100644 --- a/projects/celerbridge/index.js +++ b/projects/celerbridge/index.js @@ -234,7 +234,7 @@ const liquidityBridgeTokens = [ arbitrum: "0xaE6aab43C4f3E0cea4Ab83752C278f8dEbabA689", bsc: "0x4a9a2b2b04549c3927dd2c9668a5ef3fca473623", ethereum: "0x431ad2ff6a9c365805ebad47ee021148d6f7dbe0", - optimism: "0x9e5AAC1Ba1a2e6aEd6b32689DFcF62A509Ca96f3", + optimism: ADDRESSES.op_bnb.USDC, polygon: "0x08C15FA26E519A78a666D19CE5C646D55047e0a3", }, { diff --git a/projects/helper/cex.js b/projects/helper/cex.js index 6449cd670ec..ef2d6ecc94d 100644 --- a/projects/helper/cex.js +++ b/projects/helper/cex.js @@ -161,7 +161,7 @@ const defaultTokens = { '0x09e18590e8f76b6cf471b3cd75fe1a1a9d2b2c2b', //aidoge '0x3082cc23568ea640225c2467653db90e9250aaa0', //rdnt '0x088cd8f5ef3652623c22d48b1605dcfe860cd704', //vela - '0x289ba1701c2f088cf0faf8b3705246331cb8a839', //lpt + ADDRESSES.arbitrum.LPT, //lpt '0x51fc0f6660482ea73330e414efd7808811a57fa2', //premia ], avax: [ @@ -196,16 +196,16 @@ const defaultTokens = { celo: [ nullAddress, ADDRESSES.celo.CELO, //celo - "0x765de816845861e75a25fca122bb6898b8b1282a", //cUSD + ADDRESSES.celo.cUSD, //cUSD ], moonbeam: [ nullAddress, - "0xefaeee334f0fd1712f9a8cc375f427d9cdd40d73", //usdt + ADDRESSES.telos.USDT, //usdt "0x8f552a71efe5eefc207bf75485b356a0b3f01ec9", //usdc ], moonriver: [ nullAddress, - "0xb44a9b6905af7c801311e8f4e76932ee959c663c", //usdt + ADDRESSES.moonriver.USDT, //usdt ], } diff --git a/projects/nata/index.js b/projects/nata/index.js new file mode 100644 index 00000000000..99071b1550c --- /dev/null +++ b/projects/nata/index.js @@ -0,0 +1,19 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require('../helper/unwrapLPs') + +module.exports = { + polygon: { + tvl: sumTokensExport({ + tokens: [ + ADDRESSES.polygon.WETH_1, // WETH + ADDRESSES.polygon.DAI, // DAI + '0xe50fA9b3c56FfB159cB0FCA61F5c9D750e8128c8', // aWETH + '0x82E64f49Ed5EC1bC6e43DAD4FC8Af9bb3A2312EE', // aDAI + '0x6d80113e533a2C0fe82EaBD35f1875DcEA89Ea97', // aMATIC + ], + resolveUniV3: true, + fetchCoValentTokens: true, + owner: '0x03ebC6d159C41419747354bc819dF274Da9948B5' + }), + }, +} \ No newline at end of file diff --git a/projects/omnibtc/index.js b/projects/omnibtc/index.js index 064d8fcd897..9bc760025f2 100644 --- a/projects/omnibtc/index.js +++ b/projects/omnibtc/index.js @@ -80,7 +80,7 @@ module.exports = { ADDRESSES.arbitrum.USDC, ADDRESSES.arbitrum.USDT, ADDRESSES.arbitrum.WBTC, - "0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8", //Bridge USDC + ADDRESSES.arbitrum.USDC, //Bridge USDC ], }), }, @@ -98,7 +98,7 @@ module.exports = { ADDRESSES.optimism.OP, ADDRESSES.optimism.USDC, ADDRESSES.optimism.USDT, - "0x7F5c764cBc14f9669B88837ca1490cCa17c31607", // Bridge USDC + ADDRESSES.optimism.USDC, // Bridge USDC "0x68f180fcCe6836688e9084f035309E29Bf0A2095", // WBTC ], }), diff --git a/projects/reserve/index.js b/projects/reserve/index.js index 0e092f801cd..493ad9cd34c 100644 --- a/projects/reserve/index.js +++ b/projects/reserve/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens2, genericUnwrapCvxDeposit, @@ -37,10 +38,10 @@ async function tvl(_time, block, _, { api, chain }) { ? [ [ [ - "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", //usdc + ADDRESSES.ethereum.USDC, //usdc "0x8e870d67f660d95d5be530380d0ec0bd388289e1", //pax - "0x0000000000085d4780B73119b644AE5ecd22b376", //tusd - "0x4Fabb145d64652a948d72533023f6E7A623C7C53", //busd + ADDRESSES.ethereum.TUSD, //tusd + ADDRESSES.ethereum.BUSD, //busd ], config.vault, ], diff --git a/projects/shell/index.js b/projects/shell/index.js index 76706ae431a..acfc263df7e 100644 --- a/projects/shell/index.js +++ b/projects/shell/index.js @@ -6,7 +6,7 @@ const DAI_CONTRACT = ADDRESSES.optimism.DAI; const USDC_CONTRACT = ADDRESSES.arbitrum.USDC; const USDT_CONTRACT = ADDRESSES.arbitrum.USDT; const WBTC_CONTRACT = ADDRESSES.arbitrum.WBTC; -const WSTETH_CONTRACT = '0x5979D7b546E38E414F7E9822514be443A4800529'; +const WSTETH_CONTRACT = ADDRESSES.arbitrum.WSTETH; const ARB_CONTRACT = ADDRESSES.arbitrum.ARB; const TOKEN_CONTRACTS = [ diff --git a/projects/sociogram/index.js b/projects/sociogram/index.js index 8162df71e37..4bc1010be0b 100644 --- a/projects/sociogram/index.js +++ b/projects/sociogram/index.js @@ -1,10 +1,11 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokensExport } = require("../helper/unwrapLPs"); module.exports = { arbitrum: { tvl: sumTokensExport({ owner: '0x25f5967B0FB3182d7fcacef3b53E1B2517a31dAf', - tokens: [ '0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9' ], + tokens: [ ADDRESSES.arbitrum.USDT ], }), } }; diff --git a/projects/unidex/index.js b/projects/unidex/index.js index 1df2fa0db35..d72c77dc458 100644 --- a/projects/unidex/index.js +++ b/projects/unidex/index.js @@ -41,9 +41,9 @@ async function ArbitrumTvl(_time, _ethBlock, { arbitrum: block }) { const mim = ADDRESSES.arbitrum.MIM; const gdai = "0xd85e038593d7a098614721eae955ec2022b9b91b"; const ram = "0xaaa6c1e32c55a7bfa8066a6fae9b42650f262418"; - const mai = "0x5979D7b546E38E414F7E9822514be443A4800529"; + const mai = ADDRESSES.arbitrum.WSTETH; const gmx = ADDRESSES.arbitrum.GMX; - const wsteth = "0x5979D7b546E38E414F7E9822514be443A4800529"; + const wsteth = ADDRESSES.arbitrum.WSTETH; const gns = "0x18c11FD286C5EC11c3b683Caa813B77f5163A122"; const cap = "0x031d35296154279dc1984dcd93e392b1f946737b"; const unsheth = "0x0Ae38f7E10A43B5b2fB064B42a2f4514cbA909ef"; From 56007b749d442736398d6ed4b5fc1ebe756068bd Mon Sep 17 00:00:00 2001 From: MrNjordy <145882008+MrNjordy@users.noreply.github.com> Date: Sun, 22 Oct 2023 18:08:15 +1300 Subject: [PATCH 1664/1974] Create index.js (#7805) * Create index.js * fix adapter --------- Co-authored-by: llama --- projects/Atrofarm/index.js | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 projects/Atrofarm/index.js diff --git a/projects/Atrofarm/index.js b/projects/Atrofarm/index.js new file mode 100644 index 00000000000..253ff20e299 --- /dev/null +++ b/projects/Atrofarm/index.js @@ -0,0 +1,8 @@ +const { masterchefExports } = require("../helper/unknownTokens"); + +module.exports = masterchefExports({ + chain: 'pulse', + masterchef: '0x86dd9C95E9d504648d40732c925438C6984Fac4A', + nativeTokens: ['0x303f764A9c9511c12837cD2D1ECF13d4a6F99E17'], + useDefaultCoreAssets: true, +}) \ No newline at end of file From 3ba53ee8066f5926c8056e0429e3733ed4e11e41 Mon Sep 17 00:00:00 2001 From: llama Date: Sun, 22 Oct 2023 07:37:47 +0200 Subject: [PATCH 1665/1974] skip unbacked tokens from tvl --- projects/helper/coreAssets.json | 5 +---- projects/selfex/index.js | 6 +++++- projects/weldfinance/index.js | 11 ++++++++--- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index b7a923e7eaf..6065db8e60c 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -987,13 +987,10 @@ "BUSD": "0x332730a4f6e03d9c55829435f10360e13cfa41ff", "BNB": "0x65e66a61d0a8f1e686c2d6083ad611a10d84d97a", "WETH": "0xc13791da84f43525189456cfe2026c60d3b7f706", - "USDk": "0x472402d47da0587c1cf515dafbafc7bce6223106", "axlUSDC": "0xeb466342c4d449bc9f53a865d5cb90586f405215", "axlUSDT": "0x7f5373ae26c3e8ffc4c77b7255df7ec1a9af52a6", "axlDAI": "0x5c7e299cf531eb66f2a1df637d37abb78e6200c7", - "KFT": "0xa0eeda2e3075092d66384fe8c91a1da4bca21788", - "USX": "0xdb0e1e86b01c4ad25241b1843e407efc4d615248", - "kBRISE": "0xea616011e5ac9a5b91e22cac59b4ec6f562b83f9" + "USX": "0xdb0e1e86b01c4ad25241b1843e407efc4d615248" }, "sx": { "WSX": "0xaa99be3356a11ee92c3f099bd7a038399633566f", diff --git a/projects/selfex/index.js b/projects/selfex/index.js index 78a9d22d469..d07b54fd4da 100644 --- a/projects/selfex/index.js +++ b/projects/selfex/index.js @@ -1,11 +1,15 @@ const { getUniTVL } = require('../helper/unknownTokens') const chains = ['kava'] +const USDk = '0x472402d47da0587c1cf515dafbafc7bce6223106' +const KFT = "0xa0eeda2e3075092d66384fe8c91a1da4bca21788" +const kBRISE = '0xea616011e5ac9a5b91e22cac59b4ec6f562b83f9' + module.exports = { misrepresentedTokens: true, methodology: "Using DefiLlama's SDK for making on-chain calls to Selfex Factory Contract to iterate over Liquidity Pools & count token balances therein.", }; chains.forEach(chain => { - module.exports[chain] = { tvl: getUniTVL({ factory: '0x98a3567692Eb055fA1F05D616cad494DE9B05512', useDefaultCoreAssets: true, }) } + module.exports[chain] = { tvl: getUniTVL({ factory: '0x98a3567692Eb055fA1F05D616cad494DE9B05512', useDefaultCoreAssets: false, blacklistedTokens: [KFT, USDk, kBRISE] }) } }) diff --git a/projects/weldfinance/index.js b/projects/weldfinance/index.js index 92063288183..7d2d347e4db 100644 --- a/projects/weldfinance/index.js +++ b/projects/weldfinance/index.js @@ -2,13 +2,17 @@ const ADDRESSES = require('../helper/coreAssets.json') const { masterchefExports, } = require("../helper/unknownTokens") const sdk = require('@defillama/sdk') +const USDk = '0x472402d47da0587c1cf515dafbafc7bce6223106' +const kBRISE = '0xea616011e5ac9a5b91e22cac59b4ec6f562b83f9' +const KFT = "0xa0eeda2e3075092d66384fe8c91a1da4bca21788" + async function verifyTvl() { let [ usdkSupply, briseSupply, ] = await sdk.api2.abi.multiCall({ abi: 'erc20:totalSupply', chain: 'kava', - calls: [ADDRESSES.kava.USDk, ADDRESSES.kava.kBRISE,] + calls: [USDk, kBRISE,] }) usdkSupply /= 1e18 briseSupply /= 1e18 @@ -42,7 +46,7 @@ async function verifyTvl() { sdk.log('usdk supply: ', usdkSupply, 'usdk backing: ', backing, 'diff', backing - usdkSupply) sdk.log('BRISE supply: ', briseSupply, 'BRISE backing: ', (+briseBacking + +briseBacking2) , 'diff', (+briseBacking + +briseBacking2) - briseSupply) - if (usdkSupply > backing) throw new Error('USDk supply is higher than backing') + if (usdkSupply > backing * 1.2) throw new Error('USDk supply is higher than backing') if ((briseSupply > (+briseBacking + +briseBacking2))) throw new Error('BRISE supply is higher than backing') return {} } @@ -51,7 +55,8 @@ module.exports = masterchefExports({ chain: 'kava', useDefaultCoreAssets: true, masterchef: '0xAbF3edbDf79dAfBBd9AaDBe2efEC078E557762D7', - nativeToken: ADDRESSES.kava.KFT + nativeToken: KFT, + blacklistedTokens: [USDk, kBRISE], }) module.exports.kava.tvl = sdk.util.sumChainTvls([module.exports.kava.tvl, verifyTvl]) \ No newline at end of file From 4630266cec9190545b71afca5c82d56344457cbe Mon Sep 17 00:00:00 2001 From: llama Date: Sun, 22 Oct 2023 07:40:27 +0200 Subject: [PATCH 1666/1974] skip unbacked tokens from tvl --- projects/weldfinance/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/weldfinance/index.js b/projects/weldfinance/index.js index 7d2d347e4db..e22a0e7735e 100644 --- a/projects/weldfinance/index.js +++ b/projects/weldfinance/index.js @@ -59,4 +59,4 @@ module.exports = masterchefExports({ blacklistedTokens: [USDk, kBRISE], }) -module.exports.kava.tvl = sdk.util.sumChainTvls([module.exports.kava.tvl, verifyTvl]) \ No newline at end of file +// module.exports.kava.tvl = sdk.util.sumChainTvls([module.exports.kava.tvl, verifyTvl]) \ No newline at end of file From b543f49ea2def73a219217ba1a465941c5fdfcb9 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Sun, 22 Oct 2023 06:51:27 +0100 Subject: [PATCH 1667/1974] Revert "simple fix for sol drops" This reverts commit b7e8e6f1d101d196d5e4a5b9c281da4a4880e407. --- projects/helper/solana.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/projects/helper/solana.js b/projects/helper/solana.js index 150161ef6b2..3e83c4d5dc6 100644 --- a/projects/helper/solana.js +++ b/projects/helper/solana.js @@ -396,10 +396,6 @@ async function sumTokens2({ blacklistedTokens.forEach(i => delete balances['solana:'+i]) - if(Object.keys(balances).length == 0){ - throw new Error("0 tvl") - } - return balances async function _sumTokens(tokensAndAccounts) { From d344295f560b2752fd37e53646ef54770282d883 Mon Sep 17 00:00:00 2001 From: llama Date: Sun, 22 Oct 2023 10:34:17 +0200 Subject: [PATCH 1668/1974] fix broken adapters --- projects/capricorn/index.js | 5 +++-- projects/sushiswap-bentobox/bentobox.js | 1 + projects/sushiswap-bentobox/index.js | 2 +- projects/tokensfarm/index.js | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/projects/capricorn/index.js b/projects/capricorn/index.js index c74813e23b0..65dfd139ef1 100644 --- a/projects/capricorn/index.js +++ b/projects/capricorn/index.js @@ -3,9 +3,10 @@ const { getUniTVL } = require('../helper/unknownTokens') module.exports = { misrepresentedTokens: true, cube: { - tvl: getUniTVL({ + /* tvl: getUniTVL({ useDefaultCoreAssets: true, factory: '0x33CB4150f3ADFCD92fbFA3309823A2a242bF280f', - }) + }) */ + tvl: () => ({}) } }; \ No newline at end of file diff --git a/projects/sushiswap-bentobox/bentobox.js b/projects/sushiswap-bentobox/bentobox.js index 86a1e23b197..9ecff522a63 100644 --- a/projects/sushiswap-bentobox/bentobox.js +++ b/projects/sushiswap-bentobox/bentobox.js @@ -12,6 +12,7 @@ const { function bentobox(chain) { return async (timestamp, ethBlock, chainBlocks) => { const balances = {}; + if (chain === 'moonriver') return {} const transform = await getChainTransform(chain); let block = await getBlock(timestamp, chain, chainBlocks) block = block - 1000; diff --git a/projects/sushiswap-bentobox/index.js b/projects/sushiswap-bentobox/index.js index 4b78fe9aaa1..4ac5ab7add8 100644 --- a/projects/sushiswap-bentobox/index.js +++ b/projects/sushiswap-bentobox/index.js @@ -11,7 +11,7 @@ const bentobox_chains = [ "xdai", // "harmony", "moonbeam", - "moonriver", + "moonriver", //"kava", //"metis", "celo", diff --git a/projects/tokensfarm/index.js b/projects/tokensfarm/index.js index affae6e2b0e..7923ec59a55 100644 --- a/projects/tokensfarm/index.js +++ b/projects/tokensfarm/index.js @@ -29,7 +29,7 @@ chains.forEach(chain => { async function staking(_, _b, _cb, { api, }) { const chainId = api.chainId let { farms } = await getConfig('tokensfarm', 'https://api.tokensfarm.com/farm/list') - farms = farms.filter(i => i.type !== 'LP' && i.network.networkId === chainId) + farms = farms.filter(i => i.type !== 'LP' && i.network.networkId === chainId && i.type !== 'UNIV3') const tokensAndOwners = [] farms.forEach(farm => { From 0d26706ffff3ac4b1e28f6a814d43a52bbfb144c Mon Sep 17 00:00:00 2001 From: filonuse111 <114653606+filonuse111@users.noreply.github.com> Date: Mon, 23 Oct 2023 07:46:09 +0300 Subject: [PATCH 1669/1974] leech-protocol/index.js (#7807) - fix optimism TVL Co-authored-by: filonuse --- projects/leech-protocol/index.js | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/projects/leech-protocol/index.js b/projects/leech-protocol/index.js index 6a918e9dad1..8916c817335 100644 --- a/projects/leech-protocol/index.js +++ b/projects/leech-protocol/index.js @@ -15,6 +15,7 @@ async function tvl(_, _b, _cb, { api, }) { const sslpPools = [] const biswapPools = [] const thenaPools = [] + const veloPools = [] pools.forEach(({ address, name }) => { switch (chain) { case 'avax': @@ -26,7 +27,7 @@ async function tvl(_, _b, _cb, { api, }) { if (name === 'sushi-opt') { sslpPools.push(address) } else if (name === 'velo-opt') { - lpPools.push(address) + veloPools.push(address) } break; @@ -83,17 +84,32 @@ async function tvl(_, _b, _cb, { api, }) { }) } + if (veloPools.length > 0) { + const sslpTokens = await api.multiCall({ abi: 'address:LP', calls: veloPools }) + const sslpBals = await api.multiCall({ abi: 'uint256:balance', calls: veloPools }) + const supplies = await api.multiCall({ abi: 'uint256:totalSupply', calls: sslpTokens }) + const token0s = await api.multiCall({ abi: 'address:token0', calls: sslpTokens }) + const token1s = await api.multiCall({ abi: 'address:token1', calls: sslpTokens }) + const reserves = await api.multiCall({ abi: 'function getReserves() public view returns (uint256, uint256)', calls: sslpTokens }) + reserves.forEach(([token0Bal, token1Bal], i) => { + const ratio = sslpBals[i] / supplies[i] + api.add(token0s[i], token0Bal * ratio) + api.add(token1s[i], token1Bal * ratio) + }) + } + if (biswapPools.length > 0) { const wTokens = await api.multiCall({ abi: 'address:want', calls: biswapPools }) const wBals = await api.multiCall({ abi: 'uint256:balance', calls: biswapPools }) api.addTokens(wTokens, wBals) await sumTokens2({ api, resolveLP: true, }) } + return api.getBalances() } module.exports = { bsc: { tvl }, avax: { tvl }, - // optimism: { tvl }, + optimism: { tvl }, }; \ No newline at end of file From 41a4afc859b302014ec5be8289f71978a2f3d8bf Mon Sep 17 00:00:00 2001 From: Blockchaindevdefi <147879007+Blockchaindevdefi@users.noreply.github.com> Date: Mon, 23 Oct 2023 12:46:36 +0800 Subject: [PATCH 1670/1974] add scribeswap (#7808) Co-authored-by: Blockchaindefidev --- projects/scribeswap/index.js | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 projects/scribeswap/index.js diff --git a/projects/scribeswap/index.js b/projects/scribeswap/index.js new file mode 100644 index 00000000000..8310f4499a1 --- /dev/null +++ b/projects/scribeswap/index.js @@ -0,0 +1,6 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports = { + misrepresentedTokens: true, + scroll: { tvl: getUniTVL({ factory: '0xb11826635f9253Bae9C426862b0f100950a71f8f', useDefaultCoreAssets: true, fetchBalances: true, }), }, +} \ No newline at end of file From c773931cfc5cb151126ecaefd81106fcb5f7ba0c Mon Sep 17 00:00:00 2001 From: llama Date: Mon, 23 Oct 2023 07:14:19 +0200 Subject: [PATCH 1671/1974] update flooring.io tvl --- projects/flooring-io/index.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/projects/flooring-io/index.js b/projects/flooring-io/index.js index efb0052f0cf..fb49f1e5dd8 100644 --- a/projects/flooring-io/index.js +++ b/projects/flooring-io/index.js @@ -4,9 +4,13 @@ module.exports = { ethereum: { tvl: sumTokensExport({ owner: '0x3eb879cc9a0Ef4C6f1d870A40ae187768c278Da2', - tokens: ['0xb6a37b5d14d502c3ab0ae6f3a0e058bc9517786e', '0xfd1b0b0dfa524e1fd42e7d51155a663c581bbd50', '0xbd3531da5cf5857e7cfaa92426877b022e612cf8'], + tokens: ['0xb6a37b5d14d502c3ab0ae6f3a0e058bc9517786e', '0xfd1b0b0dfa524e1fd42e7d51155a663c581bbd50', '0xbd3531da5cf5857e7cfaa92426877b022e612cf8', '0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d'], fetchCoValentTokens: true, + resolveNFTs: true, blacklistedTokens: ['0x102c776DDB30C754dEd4fDcC77A19230A60D4e4f', '0x9b947Cc819b00AF2e377C025C3f386fbf3C0055c'], - }) + }), + + staking: sumTokensExport({ owner: '0x3eb879cc9a0Ef4C6f1d870A40ae187768c278Da2', tokens: ['0x102c776DDB30C754dEd4fDcC77A19230A60D4e4f'], }), + // pool2: sumTokensExport({ owner: '0xe34139463ba50bd61336e0c446bd8c0867c6fe65', resolveUniV3: true,}), } } \ No newline at end of file From 6bf0f9ace7ad799a0fef238b06233e638ac9bf19 Mon Sep 17 00:00:00 2001 From: liu941125 <84958447+liu941125@users.noreply.github.com> Date: Mon, 23 Oct 2023 14:27:56 +0800 Subject: [PATCH 1672/1974] Add sdex on ethf chain (#7810) * index.js * Update index.js * minor fix --------- Co-authored-by: llama Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/helper/chains.json | 1 + projects/helper/coreAssets.json | 3 +++ projects/helper/env.js | 1 + projects/helper/tokenMapping.js | 4 ++++ projects/sdex/index.js | 8 ++++++++ 5 files changed, 17 insertions(+) create mode 100644 projects/sdex/index.js diff --git a/projects/helper/chains.json b/projects/helper/chains.json index 0832f6bd281..25fdab36e9a 100644 --- a/projects/helper/chains.json +++ b/projects/helper/chains.json @@ -69,6 +69,7 @@ "ergo", "ethereum", "ethereumclassic", + "ethf", "ethpow", "everscale", "evmos", diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index 6065db8e60c..2d16dbdf4e0 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -1467,5 +1467,8 @@ }, "pg": { "WPG": "0x0cf4071940782b640d0b595cb17bdf3e90869d70" + }, + "ethf": { + "WETH": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2" } } diff --git a/projects/helper/env.js b/projects/helper/env.js index 07493d496f8..da565cb23d0 100644 --- a/projects/helper/env.js +++ b/projects/helper/env.js @@ -15,6 +15,7 @@ const DEFAULTS = { RENEC_RPC: "https://api-mainnet-beta.renec.foundation:8899/", EVMOS_RPC: "https://evmos-evm.publicnode.com", NOVA_RPC: "https://connect.novanetwork.io", + ETHF_RPC: "https://rpc.etherfair.org", SCROLL_RPC: "https://rpc-scroll.icecreamswap.com", HECO_RPC: "https://http-mainnet-node.huobichain.com", } diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 47bd2e9f157..3f9c64fe122 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -43,6 +43,10 @@ const ibcMappings = { } const fixBalancesTokens = { + ethf: { + [ADDRESSES.ethf.WETH]: { coingeckoId: 'ethereumfair', decimals: 18 }, + [ADDRESSES.null]: { coingeckoId: 'ethereumfair', decimals: 18 }, + }, // Sample Code ozone: { // '0x83048f0bf34feed8ced419455a4320a735a92e9d': { coingeckoId: "ozonechain", decimals: 18 }, // was mapped to wrong chain diff --git a/projects/sdex/index.js b/projects/sdex/index.js new file mode 100644 index 00000000000..a1bec55bc0b --- /dev/null +++ b/projects/sdex/index.js @@ -0,0 +1,8 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports = { + misrepresentedTokens: true, + ethf: { + tvl: getUniTVL({ factory: '0x425D988a209125C58d16A9376f997D24009f569b', useDefaultCoreAssets: true, }), + } +} From 07f56f92472b39dfd21e13aa4ad679967c8bfb04 Mon Sep 17 00:00:00 2001 From: Pekaz Date: Mon, 23 Oct 2023 15:46:48 +0900 Subject: [PATCH 1673/1974] Add merkle-trade. (#7811) --- projects/merkle-trade/index.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 projects/merkle-trade/index.js diff --git a/projects/merkle-trade/index.js b/projects/merkle-trade/index.js new file mode 100644 index 00000000000..2b6cb045bc4 --- /dev/null +++ b/projects/merkle-trade/index.js @@ -0,0 +1,21 @@ +const { getResource } = require("../helper/chain/aptos"); + +const MERKEL_TRADE = + "0x5ae6789dd2fec1a9ec9cccfb3acaf12e93d432f0a3a42c92fe1a9d490b7bbc06"; +const lzUSDC = + "0xf22bede237a07e121b56d91a491eb7bcdfd1f5907926a9e58338f964a01b17fa::asset::USDC"; + +async function tvl(_, _b, _cb, { api }) { + const { + coin_store: { value }, + } = await getResource( + MERKEL_TRADE, + `${MERKEL_TRADE}::vault::Vault<${MERKEL_TRADE}::vault_type::HouseLPVault,${lzUSDC}>` + ); + api.add(lzUSDC, value); +} + +module.exports = { + timetravel: false, + aptos: { tvl }, +}; From 1e4d05522c87cf405281f9b13103373beaec2f46 Mon Sep 17 00:00:00 2001 From: ammarsjw Date: Mon, 23 Oct 2023 13:14:25 +0500 Subject: [PATCH 1674/1974] add hydt tvl adapter --- projects/hydt/index.js | 54 +++++++++++++++++++++++++++++------------- 1 file changed, 37 insertions(+), 17 deletions(-) diff --git a/projects/hydt/index.js b/projects/hydt/index.js index 2b4966e1a22..8292e1c1fab 100644 --- a/projects/hydt/index.js +++ b/projects/hydt/index.js @@ -1,20 +1,40 @@ -const { GraphQLClient } = require('graphql-request'); +const sdk = require("@defillama/sdk"); +const { utils, BigNumber } = require("ethers"); + +const chain = "bsc"; + +const shydtAddress = "0xab4f1Bb558E564ae294D45a025111277c36C89c0"; +const earnAddress = "0x8e48d5b2Ac80d9861d07127F06BbF02F73520Ced"; +const coinPairAddress = "0x16b9a82891338f9bA80E2D6970FddA79D1eb0daE"; +const controlPairAddress = "0xBB8ae522F812E9E65239A0e5db87a9D738ce957a"; + +const tokenABI = { balanceOf: "erc20:balanceOf" }; +const pairABI = "function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast)"; + +async function tvl(_, _b, { [chain]: block }) { + const { output: coinPairReserves } = await sdk.api.abi.call({ + abi: pairABI, + target: coinPairAddress, + chain, block, + }); + const { output: controlPairReserves } = await sdk.api.abi.call({ + abi: pairABI, + target: controlPairAddress, + chain, block, + }); + const controlPrice = + (controlPairReserves.reserve1 * coinPairReserves.reserve0) / + (controlPairReserves.reserve0 * coinPairReserves.reserve1); + + + const { output: stakeBalance } = await sdk.api.abi.call({ + abi: tokenABI.balanceOf, + target: shydtAddress, + params: earnAddress, + chain, block, + }); + const totalValueLockedUSD = utils.formatUnits(stakeBalance) * controlPrice; -const graphURL = "https://api.thegraph.com/subgraphs/name/waleed-shafiq/hydt-protocol"; - -const stakedQuery = '{ volumes( orderBy: blockTimestamp orderDirection: desc first: 1 where: { type: "Earn" } ) { amount }}'; -const priceQuery = '{ volumes( orderBy: blockTimestamp orderDirection: desc first: 1 where: { type: "Price" } ) { amount }}'; - -async function tvl(timestamp, block, _, { api }) { - var graphQLClient = new GraphQLClient(graphURL); - - const staked = await graphQLClient.request(stakedQuery); - const stakedAmount = staked.volumes[0].amount; - - const price = await graphQLClient.request(priceQuery); - const priceHYDT = price.volumes[0].amount; - - const totalValueLockedUSD = (stakedAmount * priceHYDT) / 1e36; return { tether: totalValueLockedUSD @@ -23,7 +43,7 @@ async function tvl(timestamp, block, _, { api }) { module.exports = { misrepresentedTokens: true, - methodology: "We get amounts from the HYDT staking (earn) contract via the subgraph", + methodology: "We get staked amounts from the HYDT staking (earn) contract via contract calls", start: 1693763345, bsc: { tvl, From 97a1c926324e13c752416f0ad774a8deb8981adb Mon Sep 17 00:00:00 2001 From: MuesliSwap Team <91151317+MuesliSwapTeam@users.noreply.github.com> Date: Mon, 23 Oct 2023 11:03:52 +0200 Subject: [PATCH 1675/1974] Migrated to new price ep, as we are deprecating the old one (#7813) Co-authored-by: MuesliSwapTeam --- projects/muesliswap/index.js | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/projects/muesliswap/index.js b/projects/muesliswap/index.js index de09fe0b67d..fd4d9029040 100644 --- a/projects/muesliswap/index.js +++ b/projects/muesliswap/index.js @@ -33,13 +33,7 @@ async function adaTvl() { let totalAda = 0 // fetch the prices of each traded token first - const tokenlistV2 = (await fetchURL("https://api.muesliswap.com/list?base-policy-id=&base-tokenname=")).data - const adaPrices = new Map(tokenlistV2.map(d => { - const ident = d.info.address.policyId + '.' + d.info.address.name - const bidPrice = parseFloat(d.price.bidPrice) - const price = parseFloat(d.price.price) - return [ident, { bidPrice, price }] - })) + const adaPrices = new Map(Object.entries((await fetchURL("https://api.muesliswap.com/defillama/prices")).data)) // then first accumulate over the legacy orderbook const orderbookV1 = (await fetchURL("https://orders.muesliswap.com/all-orderbooks")).data From 440eb2d97f9f8035ee883c852d29fe94577d08f2 Mon Sep 17 00:00:00 2001 From: 0xPhase <116054565+0xPhase@users.noreply.github.com> Date: Mon, 23 Oct 2023 12:05:35 +0300 Subject: [PATCH 1676/1974] Add Phase protocol (#7809) * Add Phase protocol * code refactor --------- Co-authored-by: llama --- projects/phase/config.js | 8 +++++++ projects/phase/index.js | 45 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 projects/phase/config.js create mode 100644 projects/phase/index.js diff --git a/projects/phase/config.js b/projects/phase/config.js new file mode 100644 index 00000000000..4bbc1303bb1 --- /dev/null +++ b/projects/phase/config.js @@ -0,0 +1,8 @@ +module.exports = { + base: { + cash: "0xbe92452bb46485AF3308e6d77786bFBE3557808d", + bond: "0x443f102Ea65613d91365E1F5c37C21Ed2144023A", + factory: '0xd3382599f6fe88bac72dfe23590644314146aa88', + fromBlock: 4925577, + }, +}; diff --git a/projects/phase/index.js b/projects/phase/index.js new file mode 100644 index 00000000000..6bcd0e8bf80 --- /dev/null +++ b/projects/phase/index.js @@ -0,0 +1,45 @@ +const config = require("./config"); +const { staking } = require('../helper/staking') +const { getLogs } = require('../helper/cache/getLogs') + +async function getVaults(api) { + const { factory, fromBlock } = config[api.chain] + const logs = await getLogs({ + api, + target: factory, + eventAbi: 'event ContractCreated (address indexed creator, address created)', + onlyArgs: true, + fromBlock, + }) + return logs.map(i => i.created) +} + +async function tvl(timestamp, block, chainBlocks, { api }) { + const vaults = await getVaults(api) + const assets = await api.multiCall({ abi: 'address:asset', calls: vaults }) + const bals = await api.multiCall({ abi: 'uint256:collectiveCollateral', calls: vaults }) + api.addTokens(assets, bals) + return api.getBalances() +} + +async function borrowed(timestamp, block, chainBlocks, { api }) { + const vaults = await getVaults(api) + const assets = vaults.map(_ => config[api.chain].cash) + const bals = await api.multiCall({ abi: 'uint256:collectiveDebt', calls: vaults }) + api.addTokens(assets, bals) + return api.getBalances() +} + +module.exports = { + methodology: + "Counts the TVL of the Phase vaults. Counts total borrows. Counts $CASH in the bond.", +}; + +Object.keys(config).forEach((chain) => { + const { cash, bond } = config[chain]; + module.exports[chain] = { + tvl, + // borrowed, + staking: staking(bond, cash), + }; +}); From e0eb91abbc3ece1c5ffbc9fbce8086ecf4ddef3c Mon Sep 17 00:00:00 2001 From: statixfarm <148451579+statixfarm@users.noreply.github.com> Date: Mon, 23 Oct 2023 16:08:49 +0700 Subject: [PATCH 1677/1974] Add Statix Farm on base to Defillama (#7812) --- projects/statixfarm/index.js | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 projects/statixfarm/index.js diff --git a/projects/statixfarm/index.js b/projects/statixfarm/index.js new file mode 100644 index 00000000000..16561f0a7fd --- /dev/null +++ b/projects/statixfarm/index.js @@ -0,0 +1,6 @@ +const { masterchefExports } = require("../helper/unknownTokens"); + +const masterchef = "0x32EeEd558c72Da99524E3b0176BCcbEd528cDFB2" +const nativeToken = "0xA28BAc0427e4a722246Ce4E9aD89Ec95FF8B87A3" + +module.exports = masterchefExports({ chain: 'base', masterchef, nativeToken, useDefaultCoreAssets: true,}) From a98373556f9ac46b835a4d6386a2d7f846f8372b Mon Sep 17 00:00:00 2001 From: llama Date: Mon, 23 Oct 2023 11:35:24 +0200 Subject: [PATCH 1678/1974] refactor matrix.farm --- projects/helper/utils.js | 1 + projects/matrix-farm/index.js | 28 ++++++++++++++++++++++++++++ projects/matrix.farm/index.js | 33 --------------------------------- 3 files changed, 29 insertions(+), 33 deletions(-) create mode 100644 projects/matrix-farm/index.js delete mode 100644 projects/matrix.farm/index.js diff --git a/projects/helper/utils.js b/projects/helper/utils.js index 46a087cf9a9..83ec22e679e 100644 --- a/projects/helper/utils.js +++ b/projects/helper/utils.js @@ -81,6 +81,7 @@ function isLP(symbol, token, chain) { if (chain === 'metis' && ['NLP', 'ALP'].includes(symbol)) return true // Netswap/Agora LP Token if (chain === 'optimism' && /(-ZS)/.test(symbol)) return true if (chain === 'arbitrum' && /^(crAMM|vrAMM)-/.test(symbol)) return true // ramses LP + if (chain === 'base' && /^(v|s)-/.test(symbol)) return true // Equalizer LP if (chain === 'bsc' && /(-APE-LP-S)/.test(symbol)) return false if (['fantom', 'nova',].includes(chain) && ['NLT'].includes(symbol)) return true let label diff --git a/projects/matrix-farm/index.js b/projects/matrix-farm/index.js new file mode 100644 index 00000000000..808e7a4bd32 --- /dev/null +++ b/projects/matrix-farm/index.js @@ -0,0 +1,28 @@ +const { getConfig } = require('../helper/cache') +const { sumTokens2 } = require('../helper/unwrapLPs') +const MATRIX_API = "https://api-v2.matrix.farm/statistics/latest"; + +const chains = ['bsc', "fantom", "arbitrum", "optimism", "dogechain", 'base'] + +module.exports = { + doublecounted: true, + timetravel: false, + misrepresentedTokens: true, + methodology: "The TVL is calculated using a google cloud function that runs every minute, it checks the value of all the LPs staked in our vaults and returns the total", +} + +chains.forEach(chain => { + module.exports[chain] = { tvl } +}) + +async function tvl(_, _b, _cb, { api, }) { + let { tvl: { vaults } } = await getConfig('matri-farm', MATRIX_API) + vaults = vaults.filter(vault => vault.chain === api.chain).map(i => i.address) + console.log(vaults.length, api.chain) + let wants = await api.multiCall({ abi: 'address:want', calls: vaults, permitFailure: true }) + const wantVaults = vaults.filter((vault, i) => wants[i]) + wants = wants.filter(want => want) + const wantBals = await api.multiCall({ calls: wantVaults, abi: 'uint256:balance' }) + api.addTokens(wants, wantBals) + return sumTokens2({ api, resolveLP: true }) +} \ No newline at end of file diff --git a/projects/matrix.farm/index.js b/projects/matrix.farm/index.js deleted file mode 100644 index 45efee2d097..00000000000 --- a/projects/matrix.farm/index.js +++ /dev/null @@ -1,33 +0,0 @@ -const { get } = require('../helper/http') -const MATRIX_API = "https://api.matrix.farm/statistics/tvl"; -let _response - -function fetch(key) { - return async () => { - if (!_response) _response = get(MATRIX_API) - return (await _response)[key] - } -} - -module.exports = { - doublecounted: true, - timetravel: false, - misrepresentedTokens: true, - methodology: "The TVL is calculated using a google cloud function that runs every minute, it checks the value of all the LPs staked in our vaults and returns the total", - fantom: { - fetch: fetch('fantom'), - }, - optimism: { - fetch: fetch('optimism'), - }, - dogechain: { - fetch: fetch('dogechain'), - }, - arbitrum: { - fetch: fetch('arbitrum'), - }, - bsc: { - fetch: fetch('binance'), - }, - fetch: fetch('tvl') -} From 264de9b432199fcc4a5d8ad97c6fdda3ba2002dd Mon Sep 17 00:00:00 2001 From: llama Date: Mon, 23 Oct 2023 13:14:16 +0200 Subject: [PATCH 1679/1974] fix broken adapters --- projects/helper/solana.js | 2 +- projects/sentre.js | 2 +- projects/sigmafi/index.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/projects/helper/solana.js b/projects/helper/solana.js index 3e83c4d5dc6..09502af4046 100644 --- a/projects/helper/solana.js +++ b/projects/helper/solana.js @@ -172,7 +172,7 @@ async function getTokenAccountBalances(tokenAccounts, { individual = false, chun const body = chunk.map(formBody) const data = await axios.post(endpointMap[chain](), body); data.data.forEach(({ result: { value } }, i) => { - if (!value || !value.data.parsed) { + if (!value || !value.data?.parsed) { if (tokenAccounts[i].toString() === '11111111111111111111111111111111') { log('Null account: skipping it') return; diff --git a/projects/sentre.js b/projects/sentre.js index 1d1b1311f98..2d380208eb7 100644 --- a/projects/sentre.js +++ b/projects/sentre.js @@ -6,7 +6,7 @@ async function tvl() { const programId = 'D3BBjqUdCYuP18fNvvMbPAZ8DpcRi4io2EsYHQawJDag' const program = new Program(idl, programId, provider) const data = await program.account.pool.all() - return sumTokens2({ tokenAccounts: data.map(i => i.account.treasuries).flat() }) + return sumTokens2({ tokenAccounts: data.map(i => i.account.treasuries).flat(), allowError: true, }) } module.exports = { diff --git a/projects/sigmafi/index.js b/projects/sigmafi/index.js index 0845f58e595..f9f1286eefe 100644 --- a/projects/sigmafi/index.js +++ b/projects/sigmafi/index.js @@ -21,6 +21,6 @@ module.exports = { '3FdyuY8fqeBRBVN7uhPo71JiPcmugpqdCjG5gakgXSPR7DKEGbXWkwm4dfer46kn8nCbAK1Ycw8svJGj2fMLM2kiA7GsZZdVEqDeR9K3RcVHRUCATB9qo9pf9FmekGVfG6pbzRMNrPp3TaWimHFhZCLUyqukuSaf4h9JuDqJE29hHCtdb8W7AeXTV2kfB18jUpDhCKxET3EnoBTHC1buAg3SdhPiBhVAYJFw5NVfph6kfV37nHn6hdawVrdtLbnC47xgQ7KzeMG9spHbEbn73Mz9bhCdPeqnS75jAQSjokrDLDeQSgKU8aN3Cb4i5oE5MUT9p55ignJnjzJ335UfAiEGve4tbr489sCcZ5sCNeXZEGK1WYWp39RbwdpdsfhyrVNKCpXn9xHsjSPwZVGduc5fanzGDGHEESEJCV1JYzzJ32ai274q1aQMgJuPB3CSvcy4pqcJe2XNKVSMrrwou9VXNrpeNv4DTDcnVSjB8kc6omgSYKaWBjGwaSVs6vuHK9gLfvQrDa3G1EMhfpuM3Vqs2TaHqxjc4XQyGRjJnhhqKwN4td5bo54MXEa8kojxXrXSFbi2DwcVzMQemjzxs1m5VqLv3wjCSzP9wXDEhyFMCsRbfNPTju5j7HVsRf4YBgViG6vXbAvbUcE7bA3nHMpB9SKyuGQZRVabo5899yfJpWyUM1DEwAnPDjoK4v1UYsSvUBHfs6adrHWu6oVDhZBFZZXYMVvmo56jhSXhGYTrecnhPY25a2UV5cN64bPcE3vFnW7Lpvo1nvh8XYGT9bJuP9fn1ohgnKqBwpgnwMEZxoCWHqvSsbyp4SV6nMcA416YCBYrNmwfiwFqmhYYFfAYCFdutEx52xa8E2r', '3FdyuY8fqvU21gvgv1A5Vo8XkkR4ba8RzyqwDv6ig7466wTwax4fbJc5bJMeGnYrRsvS5uiAisS7gykBJsxYgE4LRuRuKr9KzZn4BtcNeT3Hsw3zncjE7yhzSPKoW7FkbijxtTUoKYXuby5W8TEk9L1kBaDzgKRpG1YahyHVghtJYgMcy3utVjRZXxBqZbij3cZtqSNqk3UZJmTBZKufYT17C5Mae62DckHwk6ZSZi9GVSTvw2xiENo5koKya67JcX4n23WPQ4dCVsEKcQ2cGjETJhSCi4fsvFUteGkayZW9Q4jqkuum3hz3imhdSAyPvhHnRTMEPG7PKvnn4E7hbiPsbTRAd5L8DruVosvQkcyFPXJ8qhaKDrzmcqy4baHzWHN5GRqY1CrFMnSMJTmznHXzdPwm4MfdjHXppvxBsmDTFxoRdGtriafByVmvYtkKmH9pS3agL142ByqKo79yFSWucVQnE6ojfY8gmVb7uwHqxq1Lez2Nxjbupu2tC9hHdYeM3kX3VBYrjTnXP72sv3Gr3eocm383ZGC5Ppa3pB4DSYmtiJ9LdxU85WBA36KzfrLLEsnHj9gRFWwqEfA6akTNgtboo4wQH9HTCSyHRFnu4HZh4fHaLZe6Wg1LrbbTrcEWUaMFaTEaGhKR32KG2Pd75BxVbYeF6LTQ5yfVeSyhvLWBgKD49X6Y2AemNdV2JE62cS42WDFNH7NwJL7Zqrf465mWhJ137rcrzUpm4sGqv3fnVuxcT2bY2AD8UKindPGjSzP9cg8Pey8EqG4c5jZ44D4rbmNSGaVBzm47tvNyEZRNAmhRPhkuvqsMDoNNjAGwUDxQ2XCShQHhdQAMSdTfKiPMGxmqv7n25js', ] }), - borrowed, + // borrowed, }, } From f6e061f1f54167cb183760d465966aa498dbd7eb Mon Sep 17 00:00:00 2001 From: define Date: Mon, 23 Oct 2023 15:18:41 +0100 Subject: [PATCH 1680/1974] add binance new wallet --- projects/binance/config.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/projects/binance/config.js b/projects/binance/config.js index 79ae9c6e23b..b6045b055a1 100644 --- a/projects/binance/config.js +++ b/projects/binance/config.js @@ -353,6 +353,10 @@ const assetList = [ ["TUSD", "TRX", "TNXoiAJ3dct8Fjg4M9fkLFh9S2v9TXc32G"], ["TUSD", "TRX", "TV6MuMXfmLbBqPZvBHdwFsDnQeVfnmiuSi"], ["TUSD", "TRX", "TWd4WrZ9wn84f5x1hZhL4DHvk738ns5jwb"], + ["TUSD", "TRX", "TDqSquXBgUCLYvYC4XZgrprLK589dkhSCf"], + ["TRX", "TRX", "TDqSquXBgUCLYvYC4XZgrprLK589dkhSCf"], + ["USDC", "TRX", "TDqSquXBgUCLYvYC4XZgrprLK589dkhSCf"], + ["USDT", "TRX", "TDqSquXBgUCLYvYC4XZgrprLK589dkhSCf"], ["UNI", "BEP2", "bnb142q467df6jun6rt5u2ar58sp47hm5f9wvz2cvg"], ["UNI", "BEP2", "bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz"], ["UNI", "BEP2", "bnb1lsmt5a8vqqus5fwslx8pyyemgjtg4y6ugj308t"], From 8570285123f37bd5ee350b974e69a6a833c5f595 Mon Sep 17 00:00:00 2001 From: llama Date: Mon, 23 Oct 2023 19:44:42 +0200 Subject: [PATCH 1681/1974] track https://candyswap.exchange --- projects/candyswap/index.js | 3 +++ projects/helper/chains.json | 3 +++ projects/helper/tokenMapping.js | 9 +++++++++ 3 files changed, 15 insertions(+) create mode 100644 projects/candyswap/index.js diff --git a/projects/candyswap/index.js b/projects/candyswap/index.js new file mode 100644 index 00000000000..e0cbe2bb915 --- /dev/null +++ b/projects/candyswap/index.js @@ -0,0 +1,3 @@ +const { uniTvlExport } = require('../helper/unknownTokens') + +module.exports = uniTvlExport('meer', '0x2484E167b61c819a167D1219C187C3eE364A4F64') \ No newline at end of file diff --git a/projects/helper/chains.json b/projects/helper/chains.json index 25fdab36e9a..67ac7f131dc 100644 --- a/projects/helper/chains.json +++ b/projects/helper/chains.json @@ -56,6 +56,7 @@ "dogechain", "dsc", "echelon", + "edg", "elastos", "elrond", "empire", @@ -127,6 +128,7 @@ "manta", "mantle", "map", + "meer", "meta", "meter", "metis", @@ -177,6 +179,7 @@ "posi", "proton", "pulse", + "q", "quicksilver", "quasar", "radixdlt", diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 3f9c64fe122..90849b92650 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -55,6 +55,15 @@ const fixBalancesTokens = { [ADDRESSES.radixdlt.XRD]: { coingeckoId: 'radix', decimals: 0}, [ADDRESSES.radixdlt.WETH]: { coingeckoId: 'ethereum', decimals: 0}, }, + meer: { + [ADDRESSES.null]: { coingeckoId: 'qitmeer-network', decimals: 18 }, + '0x470cBFB236860eb5257bBF78715FB5bd77119C2F': { coingeckoId: 'qitmeer-network', decimals: 18 }, + '0x457dE4e275A6b3C0D3750519221dD1dF19d54f01': { coingeckoId: 'qitmeer-network', decimals: 18 }, + }, + edg: { + [ADDRESSES.null]: { coingeckoId: 'edgeware', decimals: 18 }, + '0x457dE4e275A6b3C0D3750519221dD1dF19d54f01': { coingeckoId: 'edgeware', decimals: 18 }, + } } ibcChains.forEach(chain => fixBalancesTokens[chain] = { ...ibcMappings, ...(fixBalancesTokens[chain] || {}) }) From 4dddcbfa9cfa768e12fd785b544ca7b086443841 Mon Sep 17 00:00:00 2001 From: stupid-boar <6961601+stupid-boar@users.noreply.github.com> Date: Mon, 23 Oct 2023 22:32:47 +0300 Subject: [PATCH 1682/1974] Add LINK ERC20 for PepeTeam Bridge (#7820) * add MKR + UNI for Ethereum network * PepeTeam Bridge add LINK --- projects/pepe-bridge/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/pepe-bridge/index.js b/projects/pepe-bridge/index.js index e65f17e676d..f2e3bcf6d0e 100644 --- a/projects/pepe-bridge/index.js +++ b/projects/pepe-bridge/index.js @@ -23,6 +23,7 @@ const config = { ADDRESSES.ethereum.CRV, ADDRESSES.ethereum.UNI, ADDRESSES.ethereum.MKR, + ADDRESSES.ethereum.LINK, ], '0x0de7b091A21BD439bdB2DfbB63146D9cEa21Ea83' ] From 45be82ad96f8c0c5d85f5cad1967c9704112e553 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 24 Oct 2023 01:03:08 +0530 Subject: [PATCH 1683/1974] WIP: Siennaswap on chain (#7451) * WIP * refactor sienna --------- Co-authored-by: llama --- package-lock.json | 34 +++++++++--- package.json | 2 + projects/helper/CosmWasm.js | 60 --------------------- projects/helper/chain/secret.js | 72 +++++++++++++++++++++++++ projects/helper/utils/enigma.js | 3 +- projects/sienna-lend/index.js | 94 +++++++++++++++++++++++++++++++++ projects/sienna/index.js | 91 ++++++++++++++++--------------- projects/sienna/utils.js | 72 ------------------------- 8 files changed, 243 insertions(+), 185 deletions(-) delete mode 100644 projects/helper/CosmWasm.js create mode 100644 projects/helper/chain/secret.js create mode 100644 projects/sienna-lend/index.js delete mode 100644 projects/sienna/utils.js diff --git a/package-lock.json b/package-lock.json index fa16f36d457..d311bd829cd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20,6 +20,7 @@ "blakejs": "^1.2.1", "bn.js": "^5.2.1", "borsh": "^0.7.0", + "curve25519-js": "^0.0.4", "dotenv": "^8.6.0", "ethers": "^5.6.5", "graphql": "^16.6.0", @@ -27,6 +28,7 @@ "hi-base32": "^0.5.1", "js-sha512": "^0.8.0", "limiter": "2.1.0", + "miscreant": "^0.3.2", "p-limit": "^3.1.0", "starknet": "^4.17.1", "tron-format-address": "^0.1.8", @@ -785,9 +787,9 @@ } }, "node_modules/@defillama/sdk": { - "version": "4.0.64", - "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.64.tgz", - "integrity": "sha512-wqM4enhx11vN5OuRNpK9QMoOEQbbQFKu7tT0rM6ddYA4w1tvuayWAn8mjfV8TN5wd88aHV4+zNY0Sps+mrVN9w==", + "version": "4.0.65", + "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.65.tgz", + "integrity": "sha512-+KCjkA+Ytqhre8PoFHhdUmzTYUtimJUmeYwnpnLR9xs3CcgeqyTxEt91Ab8aIjcXf2AvAUPcqBEEcp/MEczNzQ==", "dependencies": { "@aws-sdk/client-s3": "^3.400.0", "@supercharge/promise-pool": "^2.1.0", @@ -3260,6 +3262,11 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/curve25519-js": { + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/curve25519-js/-/curve25519-js-0.0.4.tgz", + "integrity": "sha512-axn2UMEnkhyDUPWOwVKBMVIzSQy2ejH2xRGy1wq81dqRwApXfIzfbE3hIX0ZRFBIihf/KDqK158DLwESu4AK1w==" + }, "node_modules/debug": { "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", @@ -4409,6 +4416,11 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/miscreant": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/miscreant/-/miscreant-0.3.2.tgz", + "integrity": "sha512-fL9KxsQz9BJB2KGPMHFrReioywkiomBiuaLk6EuChijK0BsJsIKJXdVomR+/bPj5mvbFD6wM0CM3bZio9g7OHA==" + }, "node_modules/ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", @@ -5905,9 +5917,9 @@ } }, "@defillama/sdk": { - "version": "4.0.64", - "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.64.tgz", - "integrity": "sha512-wqM4enhx11vN5OuRNpK9QMoOEQbbQFKu7tT0rM6ddYA4w1tvuayWAn8mjfV8TN5wd88aHV4+zNY0Sps+mrVN9w==", + "version": "4.0.65", + "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.65.tgz", + "integrity": "sha512-+KCjkA+Ytqhre8PoFHhdUmzTYUtimJUmeYwnpnLR9xs3CcgeqyTxEt91Ab8aIjcXf2AvAUPcqBEEcp/MEczNzQ==", "requires": { "@aws-sdk/client-s3": "^3.400.0", "@supercharge/promise-pool": "^2.1.0", @@ -7656,6 +7668,11 @@ "resolved": "https://registry.npmjs.org/crypto-hash/-/crypto-hash-1.3.0.tgz", "integrity": "sha512-lyAZ0EMyjDkVvz8WOeVnuCPvKVBXcMv1l5SVqO1yC7PzTwrD/pPje/BIRbWhMoPe436U+Y2nD7f5bFx0kt+Sbg==" }, + "curve25519-js": { + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/curve25519-js/-/curve25519-js-0.0.4.tgz", + "integrity": "sha512-axn2UMEnkhyDUPWOwVKBMVIzSQy2ejH2xRGy1wq81dqRwApXfIzfbE3hIX0ZRFBIihf/KDqK158DLwESu4AK1w==" + }, "debug": { "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", @@ -8535,6 +8552,11 @@ "integrity": "sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g==", "peer": true }, + "miscreant": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/miscreant/-/miscreant-0.3.2.tgz", + "integrity": "sha512-fL9KxsQz9BJB2KGPMHFrReioywkiomBiuaLk6EuChijK0BsJsIKJXdVomR+/bPj5mvbFD6wM0CM3bZio9g7OHA==" + }, "ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", diff --git a/package.json b/package.json index d3d9dbc281f..7ddf6017932 100644 --- a/package.json +++ b/package.json @@ -28,6 +28,7 @@ "blakejs": "^1.2.1", "bn.js": "^5.2.1", "borsh": "^0.7.0", + "curve25519-js": "^0.0.4", "dotenv": "^8.6.0", "ethers": "^5.6.5", "graphql": "^16.6.0", @@ -35,6 +36,7 @@ "hi-base32": "^0.5.1", "js-sha512": "^0.8.0", "limiter": "2.1.0", + "miscreant": "^0.3.2", "p-limit": "^3.1.0", "starknet": "^4.17.1", "tron-format-address": "^0.1.8", diff --git a/projects/helper/CosmWasm.js b/projects/helper/CosmWasm.js deleted file mode 100644 index 6d069d6d508..00000000000 --- a/projects/helper/CosmWasm.js +++ /dev/null @@ -1,60 +0,0 @@ -const { get } = require('./http') -const EnigmaUtils = require('./utils/enigma') -const { toBase64, fromBase64, toUtf8, fromUtf8, toHex, } = EnigmaUtils - -class CosmWasmClient { - constructor(nodeURL) { - this.nodeURL = nodeURL - this.codeHashCache = {} - this.enigmautils = new EnigmaUtils(nodeURL) - } - - async getHeight() { - const latest = await this.get('/blocks/latest') - return parseInt(latest.block.header.height, 10) - } - - async queryContractSmart(contractAddress, query, addedParams) { - const contractCodeHash = await this.getCodeHashByContractAddr(contractAddress); - const encrypted = await this.enigmautils.encrypt(contractCodeHash, query); - const nonce = encrypted.slice(0, 32); - const encoded = toHex(toUtf8(toBase64(encrypted))); - // @ts-ignore - const paramString = new URLSearchParams(addedParams).toString(); - const path = `/wasm/contract/${contractAddress}/query/${encoded}?encoding=hex&${paramString}`; - let responseData = (await this.get(path)) - // By convention, smart queries must return a valid JSON document (see https://github.com/CosmWasm/cosmwasm/issues/144) - return JSON.parse(fromUtf8(fromBase64(fromUtf8(await this.enigmautils.decrypt(fromBase64(responseData.result.smart), nonce))))); - - } - - async get(api) { - return get(this.nodeURL + api) - } - - async getContracts(codeId) { - const path = `/wasm/code/${codeId}/contracts`; - const responseData = (await this.get(path)); - const result = responseData.result || []; - return result.map((entry) => ({ - address: entry.address, - codeId: entry.code_id, - creator: entry.creator, - label: entry.label, - })); - } - - async getCodeHashByContractAddr(addr) { - const codeHashFromCache = this.codeHashCache[addr]; - if (typeof codeHashFromCache === "string") - return codeHashFromCache; - - const path = `/wasm/contract/${addr}/code-hash`; - const responseData = await this.get(path); - this.codeHashCache[addr] = responseData.result - return responseData.result; - } - -} - -module.exports = CosmWasmClient \ No newline at end of file diff --git a/projects/helper/chain/secret.js b/projects/helper/chain/secret.js new file mode 100644 index 00000000000..80ff672c96f --- /dev/null +++ b/projects/helper/chain/secret.js @@ -0,0 +1,72 @@ +const { endPoints } = require('./cosmos'); +const EnigmaUtils = require('../utils/enigma') +const host = endPoints.secret +const { toBase64, fromBase64, fromUtf8, } = EnigmaUtils +const axios = require('axios') +let client + +function getClient() { + if (!client) client = new SecretClient(host) + return client +} + +async function queryContract({ contract, data, } = {}) { + return getClient().queryContractSmart({contract, data,}) +} +async function getContracts(codeId) { + return getClient().getContracts(codeId) +} + + +module.exports = { + queryContract, + getContracts, +} + +class SecretClient { + constructor(nodeURL) { + this.nodeURL = nodeURL + this.codeHashes = {} + this.enigmautils = new EnigmaUtils(nodeURL) + } + + async getContracts(codeId) { + console.log('getContracts', codeId) + const path = `/compute/v1beta1/contracts/${codeId}`; + const { contract_infos } = (await this.get(path)); + return contract_infos.map(({ contract_address, ContractInfo: { code_id, creator, label } }) => ({ + address: contract_address, + code_id, creator, label, + })); + } + + async queryContractSmart({ contract, data }) { + const contractCodeHash = await this.getCodeHashByContractAddr(contract); + const encrypted = await this.enigmautils.encrypt(contractCodeHash, data); + const nonce = encrypted.slice(0, 32); + const encoded = toBase64(encrypted); + const path = `/compute/v1beta1/query/${contract}`; + let responseData = (await this.get(path, { query: encoded })).data + // By convention, smart queries must return a valid JSON document (see https://github.com/CosmWasm/cosmwasm/issues/144) + return JSON.parse(fromUtf8(fromBase64(fromUtf8(await this.enigmautils.decrypt(fromBase64(responseData), nonce))))); + + } + + async get(api, queryParams = {}) { + const { data } = await axios.get(this.nodeURL + api, { params: queryParams }) + return data + } + + async getCodeHashByContractAddr(contract) { + if (!this.codeHashes[contract]) + this.codeHashes[contract] = fetchCodeHash(this) + + return this.codeHashes[contract] + + async function fetchCodeHash(obj) { + const { code_hash } = await obj.get(`/compute/v1beta1/code_hash/by_contract_address/${contract}`) + return code_hash + } + } + +} \ No newline at end of file diff --git a/projects/helper/utils/enigma.js b/projects/helper/utils/enigma.js index 4a1d1d8c22c..aa50b5e0530 100644 --- a/projects/helper/utils/enigma.js +++ b/projects/helper/utils/enigma.js @@ -46,6 +46,7 @@ class EnigmaUtils { // const txEncryptionIkm = curve25519.sharedKey(this.privkey, consensusIoPubKey); // const txEncryptionKey = crypto.hkdfSync("sha256", Uint8Array.from([...txEncryptionIkm, ...nonce]), hkdfSalt, '', 32) // const { key: txEncryptionKey } = await hkdf.compute(Uint8Array.from([...txEncryptionIkm, ...nonce]), "SHA-256", 32, "", hkdfSalt) + // console.log(txEncryptionKey, 'txEncryptionKey', new Uint8Array(txEncryptionKey)) const txEncryptionKey = fakeKey return new Uint8Array(txEncryptionKey) } @@ -115,4 +116,4 @@ EnigmaUtils.toBase64 = toBase64 module.exports = EnigmaUtils -const fakeKey = new Uint8Array([104, 52, 184, 163, 49, 137, 219, 71, 54, 99, 223, 160, 48, 83, 58, 92, 175, 118, 60, 103, 134, 11, 44, 191, 210, 206, 164, 120, 48, 100, 9, 130]).buffer \ No newline at end of file +const fakeKey = new Uint8Array([248, 24, 153, 160, 20, 71, 22, 226, 185, 239, 57, 17, 11, 65, 67, 231, 36, 199, 102, 223, 164, 45, 133, 137, 223, 33, 119, 169, 155, 169, 194, 224]).buffer \ No newline at end of file diff --git a/projects/sienna-lend/index.js b/projects/sienna-lend/index.js new file mode 100644 index 00000000000..4df3aec406d --- /dev/null +++ b/projects/sienna-lend/index.js @@ -0,0 +1,94 @@ +const { queryContract, } = require('../helper/chain/secret') +const { PromisePool } = require('@supercharge/promise-pool') + +const LEND_OVERSEER_CONTRACT = "secret1pf88n9hm64mn58aw48jxfs2fsvzr07svnrrdlv"; + +let lendingMarkets = null + +async function getLendMarkets() { + if (!lendingMarkets) lendingMarkets = _get() + return lendingMarkets + + async function _get() { + let markets = [], hasMore = true, start = 0, limit = 30 + + while (hasMore) { + const { entries, total } = await queryContract({ + contract: LEND_OVERSEER_CONTRACT, data: { + markets: { + pagination: { + limit: 30, + start + } + } + } + }); + start += limit + hasMore = total > start + markets = markets.concat(entries.map(i => i.contract.address)); + } + + const data = [] + + const { errors } = await PromisePool.withConcurrency(5) + .for(markets) + .process(async (addr) => { + + let { total_borrows, total_supply, } = await queryContract({ contract: addr, data: { state: {} } }) + let exchange_rate = await queryContract({ contract: addr, data: { exchange_rate: {} } }) + const { address } = await queryContract({ contract: addr, data: { underlying_asset: {} } }) + // const { token_info: { decimals }} = await queryContract({ contract: address, data: { token_info: {} } }) + const scale = exchange_rate + data.push({ address, total_borrows: total_borrows * scale, total_supply: total_supply * scale }) + }) + + if (errors && errors.length) + throw errors[0] + + return data + } + +} + +async function tvl(_, _b, _cb, { api, }) { + const data = await getLendMarkets() + data.forEach(i => { + api.add(i.address, i.total_supply - i.total_borrows) + }) + + return api.getBalances() +} + +async function borrowed(_, _b, _cb, { api, }) { + const data = await getLendMarkets() + data.forEach(i => { + api.add(i.address, i.total_borrows) + }) + + + return api.getBalances() +} + +async function staking(_, _b, _cb, { api, }) { + const SIENNA_SINGLE_SIDED_POOLS = [ + { address: "secret1ja57vrpqusx99rgvxacvej3vhzhh4rhlkdkd7w", version: 1 }, + { address: "secret109g22wm3q3nfys0v6uh7lqg68cn6244n2he4t6", version: 2 }, + { address: "secret1uta9zf3prn7lvc6whp8sqv7ynxmtz3jz9xkyu7", version: 3 } + ]; + + const SIENNA_TOKEN_ADDRESS = "secret1rgm2m5t530tdzyd99775n6vzumxa5luxcllml4"; + await Promise.all(SIENNA_SINGLE_SIDED_POOLS.map(async ({ address, version }) => { + if (version === 3) { + const fetchedPool = await queryContract({ contract: address, data: { rewards: { pool_info: { at: new Date().getTime() } } } }); + api.add('sienna', fetchedPool.rewards.pool_info.staked / 1e18, { skipChain: true }) + } else { + const fetchedPool = await queryContract({ contract: address, data: { pool_info: { at: new Date().getTime() } } }); + api.add('sienna', fetchedPool.pool_info.pool_locked / 1e18, { skipChain: true }) + } + })); + return api.getBalances() +} + +module.exports = { + secret: { tvl, borrowed, staking, } +} \ No newline at end of file diff --git a/projects/sienna/index.js b/projects/sienna/index.js index c596100cc1d..b40c3f16b5f 100644 --- a/projects/sienna/index.js +++ b/projects/sienna/index.js @@ -1,56 +1,55 @@ -const { get } = require('../helper/http') - -let lendData -let overviewData - -async function getLendData() { - if (!lendData) - lendData = get('https://ethereumbridgebackend.azurewebsites.net/sienna_lend_latest_data') - return lendData -} - -async function getOverviewData() { - if (!overviewData) - overviewData = get('https://ethereumbridgebackend.azurewebsites.net/sienna_token_statistics') - return overviewData -} - -async function getPoolLiquidity() { - let pool_liquidity - const { data } = await get('https://ethereumbridgebackend.azurewebsites.net/sienna_token_historical_data?type=hourly&period=1+days') - data.filter(i => i.pool_liquidity).forEach(i => pool_liquidity = i.pool_liquidity) - return pool_liquidity +const { queryContract, } = require('../helper/chain/secret') +const { transformDexBalances } = require('../helper/portedTokens') +const { PromisePool } = require('@supercharge/promise-pool') +const sdk = require('@defillama/sdk') + +async function tvl(_, _b, _cb, { api, }) { + const factiories = ["secret18sq0ux28kt2z7dlze2mu57d3ua0u5ayzwp6v2r", "secret1zvk7pvhtme6j8yw3ryv0jdtgg937w0g0ggu8yy"] + const data = [] + await Promise.all(factiories.map(i => getExchanges(i, data))) + return transformDexBalances({ data, chain: api.chain }) } -async function tvl() { - throw new Error('tvlresponse is wrong') - // const [ lend, overview ] = await Promise.all([getLendData(), getOverviewData()]) - // return { - // tether: lend.data.underlying_balance_usd + (await getPoolLiquidity()) - // } +async function getExchanges(factory, data) { + const pools = [] + const limit = 30 + let hasMore = true + do { + const { list_exchanges: { exchanges } } = await queryContract({ contract: factory, data: { list_exchanges: { pagination: { start: pools.length, limit } } } }) + hasMore = exchanges.length === limit + + sdk.log(factory, exchanges.length, pools.length, hasMore) + pools.push(...exchanges) + const { errors } = await PromisePool.withConcurrency(3) + .for(exchanges) + .process(async (i) => { + let { address, contract } = i + if (!address) address = contract.address + const { pair_info } = await queryContract({ contract: address, data: "pair_info" }) + data.push({ + token0: transformToken(pair_info.pair.token_0, pair_info), + token0Bal: pair_info.amount_0, + token1: transformToken(pair_info.pair.token_1, pair_info), + token1Bal: pair_info.amount_1, + }) + }) + + if (errors && errors.length) + throw errors[0] + + } while (hasMore) } -async function staking() { - const overview = await getOverviewData() - return { - tether: overview.staked - } -} - -async function borrowed() { - const lend = await getLendData() - return { - tether: lend.data.total_borrows_usd +function transformToken(addr, poolData) { + if (!addr?.custom_token) { + console.log(JSON.stringify(addr, null, 2)) + console.log(JSON.stringify(poolData, null, 2)) + throw new Error("No custom token") } + return addr.custom_token.contract_addr } module.exports = { - misrepresentedTokens: true, timetravel: false, - methodology: 'All tokens locked in SIENNA Network pairs + All the supplied tokens to Sienna Lend Markets + Staked Sienna;', - secret: { - tvl, - staking, - borrowed, - } + secret: { tvl } } \ No newline at end of file diff --git a/projects/sienna/utils.js b/projects/sienna/utils.js deleted file mode 100644 index 5f9b59f92d6..00000000000 --- a/projects/sienna/utils.js +++ /dev/null @@ -1,72 +0,0 @@ -module.exports = { - symbolsMap: { - "ALPHA": "alpha-finance", - "ALTER": "alter", - "BAT": "basic-attention-token", - "BUTT": "buttcoin-2", - "ENJ": "enjincoin", - "MANA": "decentraland", - "MATIC": "matic-network", - "RUNE": "thorchain-erc20", - "SAAVE": "aave", - "SADA(BSC)": "cardano", - "SATOM": "cosmos", - "SBAC": "basis-cash", - "SBAKE": "bakerytoken", - "SBAND": "band-protocol", - "SBCH(BSC)": "bitcoin-cash", - "SBNB(BSC)": "binancecoin", - "SBUNNY": "pancake-bunny", - "SBUSD(BSC)": "binance-usd", - "SCAKE": "pancakeswap-token", - "SCOMP": "compound-governance-token", - "SDAI": "dai", - "SDOGE(BSC)": "dogecoin", - "SDOT(BSC)": "polkadot", - "SDOT": "polkadot", - "SDPI": "defipulse-index", - "SDVPN": "sentinel", - "SEFI": "secret-finance", - "SETH(BSC)": "ethereum", - "SETH": "ethereum", - "SFINE": "refinable", - "SHD": "shade-protocol", - "SHUAHUA": "shuahua", - "SIENNA": "sienna", - "SJUNO": "juno-network", - "SKNC": "kyber-network", - "SLINA": "linear", - "SLINK(BSC)": "chainlink", - "SLINK": "chainlink", - "SLTC(BSC)": "litecoin", - "SLTC": "litecoin", - "SLUNA": "terra-luna", - "SMKR": "maker", - "SOCEAN": "ocean-protocol", - "SOSMO": "osmosis", - "SREN": "republic-protocol", - "SRNBTC": "renbtc", - "SRSR": "reserve-rights-token", - "SSCRT(BSC)": "secret", - "SSCRT": "secret", - "SSNX": "havven", - "SSUSHI": "sushi", - "STRX(BSC)": "tron", - "STUSD": "true-usd", - "SUNI": "uniswap", - "SUSDC(BSC)": "usd-coin", - "SUSDC": "usd-coin", - "SUSDT(BSC)": "tether", - "SUSDT": "tether", - "SUST": "terrausd", - "SWBTC": "wrapped-bitcoin", - "SXMR": "monero", - "SXRP(BSC)": "ripple", - "SXVS": "venus", - "SYFI": "yearn-finance", - "TORN": "tornado-cash", - "YFL": "yflink", - "ZRX": "0x", - "stkd-SCRT": "stkd-scrt" - } -} \ No newline at end of file From 16e16303c0d3fa1551bff54f3d2d429412a210c9 Mon Sep 17 00:00:00 2001 From: Andrew Clark Date: Tue, 24 Oct 2023 03:33:42 +0800 Subject: [PATCH 1684/1974] Add aladdinCVX TVL (#7819) * Add asdCRV pools Tvl * Update revert lint changes * Update revert lint changes * Add aladdinCVX TVL --------- Co-authored-by: Andrew --- projects/concentrator/index.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/projects/concentrator/index.js b/projects/concentrator/index.js index e285c6e033a..afd4b5a321a 100644 --- a/projects/concentrator/index.js +++ b/projects/concentrator/index.js @@ -18,6 +18,7 @@ const concentratorAFrxETH = "0xb15Ad6113264094Fd9BF2238729410A07EBE5ABa"; const cvxcrvAddress = ADDRESSES.ethereum.cvxCRV; const concentratorAbcCVXAddress = '0xDEC800C2b17c9673570FDF54450dc1bd79c8E359'; const concentratorAsdCRVAddress = "0x43E54C2E7b3e294De3A155785F52AB49d87B9922" +const aladdinCVXAddress = "0xb0903Ab70a7467eE5756074b31ac88aEBb8fB777"; const concentratorNewVault = '0x3Cf54F3A1969be9916DAD548f3C084331C4450b5'; const concentratorAfxsVault = '0xD6E3BB7b1D6Fa75A71d48CFB10096d59ABbf99E1'; @@ -28,6 +29,7 @@ const aladdinBalancerLPGauge = '0x33e411ebE366D72d058F3eF22F1D0Cf8077fDaB0'; const clevCVXAddress = "0xf05e58fCeA29ab4dA01A495140B349F8410Ba904" const clevCVXCVXAddress = "0xF9078Fb962A7D13F55d40d49C8AA6472aBD1A5a6" const sdCRVAddress = '0xD1b5651E55D4CeeD36251c61c50C889B36F6abB5' +const cvxAddress = "0x4e3FBD56CD56c3e72c1403e103b45Db9da5B9D2B"; const chain = 'ethereum'; async function getBalancerLpTvl(balances, block) { @@ -60,6 +62,7 @@ async function tvl(timestamp, block, _, { api }) { getAfrxETHInfo(balances, block), getAbcCVXInfo(balances, block), getAsdCRVInfo(balances, block), + getAladdinCVXInfo(balances, block), getVaultInfo('old', balances, block), getVaultInfo('New', balances, block), getVaultInfo('afxs', balances, block), @@ -160,6 +163,22 @@ async function getAsdCRVInfo(balances, block) { sdk.util.sumSingleBalance(balances, sdCRVAddress, asdCRVTotalUnderlying, chain) } +async function getAladdinCVXInfo(balances, block) { + const aladdinCVXTotalUnderlying = ( + await sdk.api.abi.call({ + target: aladdinCVXAddress, + block, + abi: AladdinAFXSABI.totalAssets, + }) + ).output; + sdk.util.sumSingleBalance( + balances, + cvxAddress, + aladdinCVXTotalUnderlying, + chain + ); +} + module.exports = { doublecounted: true, ethereum: { From dbefcb524d105d9530d5012c13e76b09d6eb2eee Mon Sep 17 00:00:00 2001 From: Nelson Rodrigues Marreiros Date: Mon, 23 Oct 2023 21:34:16 +0200 Subject: [PATCH 1685/1974] add jamfrens tvl (#7818) --- projects/jamfrens/index.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 projects/jamfrens/index.js diff --git a/projects/jamfrens/index.js b/projects/jamfrens/index.js new file mode 100644 index 00000000000..137e39c6f4f --- /dev/null +++ b/projects/jamfrens/index.js @@ -0,0 +1,14 @@ +const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') + +const contract = "0x3dbea36ced3cd155605b725faf7e3f66dc5d6b2b" + +async function tvl(time, ethBlock, _b, {api}) { + return sumTokens2({ tokens: [nullAddress], owner: contract, api }) +} + +module.exports = { + methodology: `We count the Matic on the ${contract}`, + polygon: { + tvl + } +} \ No newline at end of file From c0dd07516a88f8c3a3fd7a091dc89d26d553d843 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Mon, 23 Oct 2023 20:44:40 +0100 Subject: [PATCH 1686/1974] update poolIds --- projects/opulous/index.js | 45 ++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/projects/opulous/index.js b/projects/opulous/index.js index 93a3ea2470b..33c11ad4103 100644 --- a/projects/opulous/index.js +++ b/projects/opulous/index.js @@ -1,34 +1,35 @@ -const { lookupApplications, } = require("../helper/chain/algorand"); +const { lookupApplications } = require("../helper/chain/algorand"); async function staking() { + + const poolIds = [843061415, 1127413236, 1020347200]; + let totalPoolAmount = 0; - //OPUL Staking Pool, expires on timestamp 1668988799 (November 20th) - const poolId = 843061415 - let response = await lookupApplications(poolId) - var poolAmount + for (const poolId of poolIds) { + let response = await lookupApplications(poolId); - for (const y of response.application.params["global-state"]) { - let decodedKey = Buffer.from(y.key, 'base64').toString('binary') - if (decodedKey === "pool_size") { - //OPUL has 10 digits - poolAmount = y.value.uint / 1e10 + for (const y of response.application.params["global-state"]) { + let decodedKey = Buffer.from(y.key, 'base64').toString('binary'); + if (decodedKey === "pool_size") { + // OPUL has 10 digits + totalPoolAmount += y.value.uint / 1e10; + } } - } - - return { - 'opulous': poolAmount } + return { + 'opulous': totalPoolAmount + }; } module.exports = { - //timetravel: true, - //start: 1660827158, - methodology: `Counts the number of OPUL tokens locked in the staking pool.`, - algorand: { - tvl: () => ({}), - staking: staking - } -} + // timetravel: true, + // start: 1660827158, + methodology: `Counts the number of OPUL tokens locked in the staking pool.`, + algorand: { + tvl: () => ({}), + staking: staking + } +}; // node test.js projects/opulous/index.js From 9ac5ef360c4a96be27d6802f913dae096bfc74fb Mon Sep 17 00:00:00 2001 From: llama Date: Mon, 23 Oct 2023 22:06:33 +0200 Subject: [PATCH 1687/1974] track elysiumswap --- projects/elysiumswap/index.js | 10 ++++++++++ projects/helper/chains.json | 1 + projects/helper/tokenMapping.js | 7 +++++-- 3 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 projects/elysiumswap/index.js diff --git a/projects/elysiumswap/index.js b/projects/elysiumswap/index.js new file mode 100644 index 00000000000..60a9291557a --- /dev/null +++ b/projects/elysiumswap/index.js @@ -0,0 +1,10 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports = { + misrepresentedTokens: true, + methodology: + "Factory address (0x5bec5d65fAba8E90e4a74f3da787362c60F22DaE) is used to find the LP pairs. TVL is equal to the liquidity on the AMM.", + elsm: { + tvl: getUniTVL({ factory: '0x5bec5d65fAba8E90e4a74f3da787362c60F22DaE', useDefaultCoreAssets: true }), + }, +}; diff --git a/projects/helper/chains.json b/projects/helper/chains.json index 67ac7f131dc..cf8c48444a1 100644 --- a/projects/helper/chains.json +++ b/projects/helper/chains.json @@ -59,6 +59,7 @@ "edg", "elastos", "elrond", + "elsm", "empire", "energi", "energyweb", diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 90849b92650..bea1ae7636b 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -52,8 +52,8 @@ const fixBalancesTokens = { // '0x83048f0bf34feed8ced419455a4320a735a92e9d': { coingeckoId: "ozonechain", decimals: 18 }, // was mapped to wrong chain }, radixdlt: { - [ADDRESSES.radixdlt.XRD]: { coingeckoId: 'radix', decimals: 0}, - [ADDRESSES.radixdlt.WETH]: { coingeckoId: 'ethereum', decimals: 0}, + [ADDRESSES.radixdlt.XRD]: { coingeckoId: 'radix', decimals: 0 }, + [ADDRESSES.radixdlt.WETH]: { coingeckoId: 'ethereum', decimals: 0 }, }, meer: { [ADDRESSES.null]: { coingeckoId: 'qitmeer-network', decimals: 18 }, @@ -63,6 +63,9 @@ const fixBalancesTokens = { edg: { [ADDRESSES.null]: { coingeckoId: 'edgeware', decimals: 18 }, '0x457dE4e275A6b3C0D3750519221dD1dF19d54f01': { coingeckoId: 'edgeware', decimals: 18 }, + }, + elsm: { + '0xa801b1a7846156d4c81bd188f96bfcb621517611': { coingeckoId: 'vulcan-forged', decimals: 18 }, } } From 30652606c99128795a7b477d67d2df17b718e330 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Tue, 24 Oct 2023 01:00:34 +0100 Subject: [PATCH 1688/1974] solana check --- projects/helper/solana.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/projects/helper/solana.js b/projects/helper/solana.js index 09502af4046..5733964352c 100644 --- a/projects/helper/solana.js +++ b/projects/helper/solana.js @@ -171,6 +171,10 @@ async function getTokenAccountBalances(tokenAccounts, { individual = false, chun for (const chunk of chunks) { const body = chunk.map(formBody) const data = await axios.post(endpointMap[chain](), body); + if(data.data.length !== chunk.length){ + console.log(tokenAccounts, data) + throw new Error(`Mismatched returned for getTokenAccountBalances()`) + } data.data.forEach(({ result: { value } }, i) => { if (!value || !value.data?.parsed) { if (tokenAccounts[i].toString() === '11111111111111111111111111111111') { From 7475696f45b46192d6f6cb874e044aaf75fc10ef Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Tue, 24 Oct 2023 04:18:39 +0100 Subject: [PATCH 1689/1974] solidly update --- projects/solidly-v3/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/solidly-v3/index.js b/projects/solidly-v3/index.js index e5dccb72f8d..cdf5170a4a2 100644 --- a/projects/solidly-v3/index.js +++ b/projects/solidly-v3/index.js @@ -1,5 +1,5 @@ const { uniV3Export } = require("../helper/uniswapV3"); module.exports = uniV3Export({ - ethereum: { factory: "0x735bb16affe83a3dc4dc418abccf179617cf9ff2", fromBlock: 18044650, }, + ethereum: { factory: "0x70fe4a44ea505cfa3a57b95cf2862d4fd5f0f687", fromBlock: 18044650, }, }); \ No newline at end of file From 748562573b7dea3f593997d9a7a08594ab3ad5f3 Mon Sep 17 00:00:00 2001 From: frog Date: Tue, 24 Oct 2023 00:12:54 -0400 Subject: [PATCH 1690/1974] Added Tvl support for v2 of Lifinity --- projects/lifinity/index.js | 645 ++++++++++++++++++++++++++++++++++++- 1 file changed, 639 insertions(+), 6 deletions(-) diff --git a/projects/lifinity/index.js b/projects/lifinity/index.js index 292a19019fa..a319ff1b5e9 100644 --- a/projects/lifinity/index.js +++ b/projects/lifinity/index.js @@ -1,12 +1,19 @@ const { getProvider, sumTokens2, } = require('../helper/solana') -const { Program, } = require("@project-serum/anchor"); +const { Program } = require("@project-serum/anchor"); -async function tvl() { +async function getTokenAccounts(programId, idl) { const provider = getProvider() - const programId = 'EewxydAPCCVuNEyrVN68PuSYdQ7wKn27V9Gjeoi8dy3S' const program = new Program(idl, programId, provider) const data = await program.account.amm.all() - const tokenAccounts = data.map(({ account: { tokenAAccount, tokenBAccount }}) => ([tokenAAccount, tokenBAccount,])).flat() + return data.map(({ account: { tokenAAccount, tokenBAccount }}) => ([tokenAAccount, tokenBAccount,])).flat() +} + +async function tvl() { + const v1TokenAccounts = await getTokenAccounts('EewxydAPCCVuNEyrVN68PuSYdQ7wKn27V9Gjeoi8dy3S', v1Idl) + const v2TokenAccounts = await getTokenAccounts('2wT8Yq49kHgDzXuPxZSaeLaH1qbmGXtEyPy64bL7aD3c', v2Idl) + + const tokenAccounts = [...v1TokenAccounts, ...v2TokenAccounts] + return sumTokens2({ tokenAccounts, }) } @@ -15,7 +22,7 @@ module.exports = { solana: { tvl, }, } -const idl = { +const v1Idl = { version: '0.1.0', name: 'lifinity_amm', instructions: [], @@ -196,4 +203,630 @@ const idl = { } ], errors: [] -} \ No newline at end of file +} + +const v2Idl = { + version: "0.1.1", + name: "lifinity_amm_v2", + instructions: [ + { + name: "swap", + accounts: [ + { + name: "authority", + isMut: false, + isSigner: false + }, + { + name: "amm", + isMut: true, + isSigner: false + }, + { + name: "userTransferAuthority", + isMut: false, + isSigner: true + }, + { + name: "sourceInfo", + isMut: true, + isSigner: false + }, + { + name: "destinationInfo", + isMut: true, + isSigner: false + }, + { + name: "swapSource", + isMut: true, + isSigner: false + }, + { + name: "swapDestination", + isMut: true, + isSigner: false + }, + { + name: "poolMint", + isMut: true, + isSigner: false + }, + { + name: "feeAccount", + isMut: true, + isSigner: false + }, + { + name: "tokenProgram", + isMut: false, + isSigner: false + }, + { + name: "oracleMainAccount", + isMut: false, + isSigner: false + }, + { + name: "oracleSubAccount", + isMut: false, + isSigner: false + }, + { + name: "oraclePcAccount", + isMut: false, + isSigner: false + } + ], + args: [ + { + name: "amountIn", + type: "u64" + }, + { + name: "minimumAmountOut", + type: "u64" + } + ] + } + ], + accounts: [ + { + name: "Amm", + type: { + kind: "struct", + fields: [ + { + name: "initializerKey", + type: "publicKey" + }, + { + name: "initializerDepositTokenAccount", + type: "publicKey" + }, + { + name: "initializerReceiveTokenAccount", + type: "publicKey" + }, + { + name: "initializerAmount", + type: "u64" + }, + { + name: "takerAmount", + type: "u64" + }, + { + name: "isInitialized", + type: "bool" + }, + { + name: "bumpSeed", + type: "u8" + }, + { + name: "freezeTrade", + type: "u8" + }, + { + name: "freezeDeposit", + type: "u8" + }, + { + name: "freezeWithdraw", + type: "u8" + }, + { + name: "baseDecimals", + type: "u8" + }, + { + name: "tokenProgramId", + type: "publicKey" + }, + { + name: "tokenAAccount", + type: "publicKey" + }, + { + name: "tokenBAccount", + type: "publicKey" + }, + { + name: "poolMint", + type: "publicKey" + }, + { + name: "tokenAMint", + type: "publicKey" + }, + { + name: "tokenBMint", + type: "publicKey" + }, + { + name: "feeAccount", + type: "publicKey" + }, + { + name: "oracleMainAccount", + type: "publicKey" + }, + { + name: "oracleSubAccount", + type: "publicKey" + }, + { + name: "oraclePcAccount", + type: "publicKey" + }, + { + name: "fees", + type: { + defined: "AmmFees" + } + }, + { + name: "curve", + type: { + defined: "AmmCurve" + } + }, + { + name: "config", + type: { + defined: "AmmConfig" + } + }, + { + name: "ammPTemp1", + type: "publicKey" + }, + { + name: "ammPTemp2", + type: "publicKey" + }, + { + name: "ammPTemp3", + type: "publicKey" + }, + { + name: "ammPTemp4", + type: "publicKey" + }, + { + name: "ammPTemp5", + type: "publicKey" + } + ] + } + } + ], + types: [ + { + name: "AmmFees", + docs: [ + "Encapsulates all fee information and calculations for swap operations" + ], + type: { + kind: "struct", + fields: [ + { + name: "tradeFeeNumerator", + type: "u64" + }, + { + name: "tradeFeeDenominator", + type: "u64" + }, + { + name: "ownerTradeFeeNumerator", + type: "u64" + }, + { + name: "ownerTradeFeeDenominator", + type: "u64" + }, + { + name: "ownerWithdrawFeeNumerator", + type: "u64" + }, + { + name: "ownerWithdrawFeeDenominator", + type: "u64" + }, + { + name: "hostFeeNumerator", + type: "u64" + }, + { + name: "hostFeeDenominator", + type: "u64" + } + ] + } + }, + { + name: "AmmCurve", + type: { + kind: "struct", + fields: [ + { + name: "curveType", + type: "u8" + }, + { + name: "curveParameters", + type: "u64" + } + ] + } + }, + { + name: "AmmConfig", + type: { + kind: "struct", + fields: [ + { + name: "lastPrice", + type: "u64" + }, + { + name: "lastBalancedPrice", + type: "u64" + }, + { + name: "configDenominator", + type: "u64" + }, + { + name: "volumeX", + type: "u64" + }, + { + name: "volumeY", + type: "u64" + }, + { + name: "volumeXInY", + type: "u64" + }, + { + name: "depositCap", + type: "u64" + }, + { + name: "regressionTarget", + type: "u64" + }, + { + name: "oracleType", + type: "u64" + }, + { + name: "oracleStatus", + type: "u64" + }, + { + name: "oracleMainSlotLimit", + type: "u64" + }, + { + name: "oracleSubConfidenceLimit", + type: "u64" + }, + { + name: "oracleSubSlotLimit", + type: "u64" + }, + { + name: "oraclePcConfidenceLimit", + type: "u64" + }, + { + name: "oraclePcSlotLimit", + type: "u64" + }, + { + name: "stdSpread", + type: "u64" + }, + { + name: "stdSpreadBuffer", + type: "u64" + }, + { + name: "spreadCoefficient", + type: "u64" + }, + { + name: "priceBufferCoin", + type: "i64" + }, + { + name: "priceBufferPc", + type: "i64" + }, + { + name: "rebalanceRatio", + type: "u64" + }, + { + name: "feeTrade", + type: "u64" + }, + { + name: "feePlatform", + type: "u64" + }, + { + name: "oracleMainSlotBuffer", + type: "u64" + }, + { + name: "configTemp4", + type: "u64" + }, + { + name: "configTemp5", + type: "u64" + }, + { + name: "configTemp6", + type: "u64" + }, + { + name: "configTemp7", + type: "u64" + }, + { + name: "configTemp8", + type: "u64" + } + ] + } + }, + { + name: "CurveType", + docs: [ + "Curve types supported by the token-swap program." + ], + type: { + kind: "enum", + variants: [ + { + name: "Standard" + }, + { + name: "ConstantProduct" + } + ] + } + } + ], + errors: [ + { + code: 6000, + name: "AlreadyInUse", + msg: "Swap account already in use" + }, + { + code: 6001, + name: "InvalidProgramAddress", + msg: "Invalid program address generated from bump seed and key" + }, + { + code: 6002, + name: "InvalidOwner", + msg: "Input account owner is not the program address" + }, + { + code: 6003, + name: "InvalidOutputOwner", + msg: "Output pool account owner cannot be the program address" + }, + { + code: 6004, + name: "ExpectedMint", + msg: "Deserialized account is not an SPL Token mint" + }, + { + code: 6005, + name: "ExpectedAccount", + msg: "Deserialized account is not an SPL Token account" + }, + { + code: 6006, + name: "EmptySupply", + msg: "Input token account empty" + }, + { + code: 6007, + name: "InvalidSupply", + msg: "Pool token mint has a non-zero supply" + }, + { + code: 6008, + name: "InvalidDelegate", + msg: "Token account has a delegate" + }, + { + code: 6009, + name: "InvalidInput", + msg: "InvalidInput" + }, + { + code: 6010, + name: "IncorrectSwapAccount", + msg: "Address of the provided swap token account is incorrect" + }, + { + code: 6011, + name: "IncorrectPoolMint", + msg: "Address of the provided pool token mint is incorrect" + }, + { + code: 6012, + name: "InvalidOutput", + msg: "InvalidOutput" + }, + { + code: 6013, + name: "CalculationFailure", + msg: "General calculation failure due to overflow or underflow" + }, + { + code: 6014, + name: "InvalidInstruction", + msg: "Invalid instruction" + }, + { + code: 6015, + name: "RepeatedMint", + msg: "Swap input token accounts have the same mint" + }, + { + code: 6016, + name: "ExceededSlippage", + msg: "Swap instruction exceeds desired slippage limit" + }, + { + code: 6017, + name: "InvalidCloseAuthority", + msg: "Token account has a close authority" + }, + { + code: 6018, + name: "InvalidFreezeAuthority", + msg: "Pool token mint has a freeze authority" + }, + { + code: 6019, + name: "IncorrectFeeAccount", + msg: "Pool fee token account incorrect" + }, + { + code: 6020, + name: "ZeroTradingTokens", + msg: "Given pool token amount results in zero trading tokens" + }, + { + code: 6021, + name: "FeeCalculationFailure", + msg: "Fee calculation failed due to overflow, underflow, or unexpected 0" + }, + { + code: 6022, + name: "ConversionFailure", + msg: "Conversion to u64 failed with an overflow or underflow" + }, + { + code: 6023, + name: "InvalidFee", + msg: "The provided fee does not match the program owner's constraints" + }, + { + code: 6024, + name: "IncorrectTokenProgramId", + msg: "The provided token program does not match the token program expected by the swap" + }, + { + code: 6025, + name: "IncorrectOracleAccount", + msg: "Address of the provided oracle account is incorrect" + }, + { + code: 6026, + name: "IncorrectConfigAccount", + msg: "Address of the provided config account is incorrect" + }, + { + code: 6027, + name: "UnsupportedCurveType", + msg: "The provided curve type is not supported by the program owner" + }, + { + code: 6028, + name: "InvalidCurve", + msg: "The provided curve parameters are invalid" + }, + { + code: 6029, + name: "UnsupportedCurveOperation", + msg: "The operation cannot be performed on the given curve" + }, + { + code: 6030, + name: "InvalidPythStatus", + msg: "Pyth oracle status is not 'trading'" + }, + { + code: 6031, + name: "InvalidPythPrice", + msg: "Could not retrieve updated price feed from the Pyth oracle" + }, + { + code: 6032, + name: "IncorrectSigner", + msg: "Address of the provided signer account is incorrect" + }, + { + code: 6033, + name: "ExceedPoolBalance", + msg: "Swap amount exceeds pool balance" + }, + { + code: 6034, + name: "ProgramIsFrozen", + msg: "Program is frozen" + }, + { + code: 6035, + name: "OracleConfidence", + msg: "Oracle confidence is too high" + }, + { + code: 6036, + name: "OverCapAmount", + msg: "Over Pool Cap Amount" + }, + { + code: 6037, + name: "InvalidUpdateAccount", + msg: "Invalid update wallet address" + }, + { + code: 6038, + name: "InvalidUpdateParam", + msg: "Invalid update param" + }, + { + code: 6039, + name: "InvalidInnerSwapAccount", + msg: "Invalid inner swap account" + } + ], + metadata: { + address: "2wT8Yq49kHgDzXuPxZSaeLaH1qbmGXtEyPy64bL7aD3c" + } +} From f0623d7ab72bc592150f3e09da928363c40c77ff Mon Sep 17 00:00:00 2001 From: Winson Cheng <83229800+0xKMG@users.noreply.github.com> Date: Tue, 24 Oct 2023 13:24:25 +0800 Subject: [PATCH 1691/1974] add hallmark for VKA TGE (#7821) --- projects/vaultka/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/vaultka/index.js b/projects/vaultka/index.js index 450ee1c4b0d..7c76b824879 100644 --- a/projects/vaultka/index.js +++ b/projects/vaultka/index.js @@ -10,6 +10,7 @@ module.exports = { [1682314791, "GLP Delta Neutral Vault"], [1683178791, "GDAI Leverage Vault"], [1696389409, "HLP Leverage Vault"], + [1697716800, "VKA TGE"], ], arbitrum: { From 712fbee289d1d9e4bec9f0e1af850978b2bd17a4 Mon Sep 17 00:00:00 2001 From: llama Date: Tue, 24 Oct 2023 07:47:19 +0200 Subject: [PATCH 1692/1974] lifinity: split into v1 & v2 --- projects/lifinity-v2/index.js | 360 +++++++++++++++++++ projects/lifinity/index.js | 645 +--------------------------------- 2 files changed, 366 insertions(+), 639 deletions(-) create mode 100644 projects/lifinity-v2/index.js diff --git a/projects/lifinity-v2/index.js b/projects/lifinity-v2/index.js new file mode 100644 index 00000000000..db5e782803a --- /dev/null +++ b/projects/lifinity-v2/index.js @@ -0,0 +1,360 @@ +const { getProvider, sumTokens2, } = require('../helper/solana') +const { Program } = require("@project-serum/anchor"); + +async function getTokenAccounts(programId, idl) { + const provider = getProvider() + const program = new Program(idl, programId, provider) + const data = await program.account.amm.all() + return data.map(({ account: { tokenAAccount, tokenBAccount }}) => ([tokenAAccount, tokenBAccount,])).flat() +} + +async function tvl() { + const tokenAccounts = await getTokenAccounts('2wT8Yq49kHgDzXuPxZSaeLaH1qbmGXtEyPy64bL7aD3c', v2Idl) + return sumTokens2({ tokenAccounts, }) +} + +module.exports = { + timetravel: false, + solana: { tvl, }, +} + +const v2Idl = { + version: "0.1.1", + name: "lifinity_amm_v2", + instructions: [], + accounts: [ + { + name: "Amm", + type: { + kind: "struct", + fields: [ + { + name: "initializerKey", + type: "publicKey" + }, + { + name: "initializerDepositTokenAccount", + type: "publicKey" + }, + { + name: "initializerReceiveTokenAccount", + type: "publicKey" + }, + { + name: "initializerAmount", + type: "u64" + }, + { + name: "takerAmount", + type: "u64" + }, + { + name: "isInitialized", + type: "bool" + }, + { + name: "bumpSeed", + type: "u8" + }, + { + name: "freezeTrade", + type: "u8" + }, + { + name: "freezeDeposit", + type: "u8" + }, + { + name: "freezeWithdraw", + type: "u8" + }, + { + name: "baseDecimals", + type: "u8" + }, + { + name: "tokenProgramId", + type: "publicKey" + }, + { + name: "tokenAAccount", + type: "publicKey" + }, + { + name: "tokenBAccount", + type: "publicKey" + }, + { + name: "poolMint", + type: "publicKey" + }, + { + name: "tokenAMint", + type: "publicKey" + }, + { + name: "tokenBMint", + type: "publicKey" + }, + { + name: "feeAccount", + type: "publicKey" + }, + { + name: "oracleMainAccount", + type: "publicKey" + }, + { + name: "oracleSubAccount", + type: "publicKey" + }, + { + name: "oraclePcAccount", + type: "publicKey" + }, + { + name: "fees", + type: { + defined: "AmmFees" + } + }, + { + name: "curve", + type: { + defined: "AmmCurve" + } + }, + { + name: "config", + type: { + defined: "AmmConfig" + } + }, + { + name: "ammPTemp1", + type: "publicKey" + }, + { + name: "ammPTemp2", + type: "publicKey" + }, + { + name: "ammPTemp3", + type: "publicKey" + }, + { + name: "ammPTemp4", + type: "publicKey" + }, + { + name: "ammPTemp5", + type: "publicKey" + } + ] + } + } + ], + types: [ + { + name: "AmmFees", + docs: [ + "Encapsulates all fee information and calculations for swap operations" + ], + type: { + kind: "struct", + fields: [ + { + name: "tradeFeeNumerator", + type: "u64" + }, + { + name: "tradeFeeDenominator", + type: "u64" + }, + { + name: "ownerTradeFeeNumerator", + type: "u64" + }, + { + name: "ownerTradeFeeDenominator", + type: "u64" + }, + { + name: "ownerWithdrawFeeNumerator", + type: "u64" + }, + { + name: "ownerWithdrawFeeDenominator", + type: "u64" + }, + { + name: "hostFeeNumerator", + type: "u64" + }, + { + name: "hostFeeDenominator", + type: "u64" + } + ] + } + }, + { + name: "AmmCurve", + type: { + kind: "struct", + fields: [ + { + name: "curveType", + type: "u8" + }, + { + name: "curveParameters", + type: "u64" + } + ] + } + }, + { + name: "AmmConfig", + type: { + kind: "struct", + fields: [ + { + name: "lastPrice", + type: "u64" + }, + { + name: "lastBalancedPrice", + type: "u64" + }, + { + name: "configDenominator", + type: "u64" + }, + { + name: "volumeX", + type: "u64" + }, + { + name: "volumeY", + type: "u64" + }, + { + name: "volumeXInY", + type: "u64" + }, + { + name: "depositCap", + type: "u64" + }, + { + name: "regressionTarget", + type: "u64" + }, + { + name: "oracleType", + type: "u64" + }, + { + name: "oracleStatus", + type: "u64" + }, + { + name: "oracleMainSlotLimit", + type: "u64" + }, + { + name: "oracleSubConfidenceLimit", + type: "u64" + }, + { + name: "oracleSubSlotLimit", + type: "u64" + }, + { + name: "oraclePcConfidenceLimit", + type: "u64" + }, + { + name: "oraclePcSlotLimit", + type: "u64" + }, + { + name: "stdSpread", + type: "u64" + }, + { + name: "stdSpreadBuffer", + type: "u64" + }, + { + name: "spreadCoefficient", + type: "u64" + }, + { + name: "priceBufferCoin", + type: "i64" + }, + { + name: "priceBufferPc", + type: "i64" + }, + { + name: "rebalanceRatio", + type: "u64" + }, + { + name: "feeTrade", + type: "u64" + }, + { + name: "feePlatform", + type: "u64" + }, + { + name: "oracleMainSlotBuffer", + type: "u64" + }, + { + name: "configTemp4", + type: "u64" + }, + { + name: "configTemp5", + type: "u64" + }, + { + name: "configTemp6", + type: "u64" + }, + { + name: "configTemp7", + type: "u64" + }, + { + name: "configTemp8", + type: "u64" + } + ] + } + }, + { + name: "CurveType", + docs: [ + "Curve types supported by the token-swap program." + ], + type: { + kind: "enum", + variants: [ + { + name: "Standard" + }, + { + name: "ConstantProduct" + } + ] + } + } + ], + errors: [] +} diff --git a/projects/lifinity/index.js b/projects/lifinity/index.js index a319ff1b5e9..292a19019fa 100644 --- a/projects/lifinity/index.js +++ b/projects/lifinity/index.js @@ -1,19 +1,12 @@ const { getProvider, sumTokens2, } = require('../helper/solana') -const { Program } = require("@project-serum/anchor"); +const { Program, } = require("@project-serum/anchor"); -async function getTokenAccounts(programId, idl) { +async function tvl() { const provider = getProvider() + const programId = 'EewxydAPCCVuNEyrVN68PuSYdQ7wKn27V9Gjeoi8dy3S' const program = new Program(idl, programId, provider) const data = await program.account.amm.all() - return data.map(({ account: { tokenAAccount, tokenBAccount }}) => ([tokenAAccount, tokenBAccount,])).flat() -} - -async function tvl() { - const v1TokenAccounts = await getTokenAccounts('EewxydAPCCVuNEyrVN68PuSYdQ7wKn27V9Gjeoi8dy3S', v1Idl) - const v2TokenAccounts = await getTokenAccounts('2wT8Yq49kHgDzXuPxZSaeLaH1qbmGXtEyPy64bL7aD3c', v2Idl) - - const tokenAccounts = [...v1TokenAccounts, ...v2TokenAccounts] - + const tokenAccounts = data.map(({ account: { tokenAAccount, tokenBAccount }}) => ([tokenAAccount, tokenBAccount,])).flat() return sumTokens2({ tokenAccounts, }) } @@ -22,7 +15,7 @@ module.exports = { solana: { tvl, }, } -const v1Idl = { +const idl = { version: '0.1.0', name: 'lifinity_amm', instructions: [], @@ -203,630 +196,4 @@ const v1Idl = { } ], errors: [] -} - -const v2Idl = { - version: "0.1.1", - name: "lifinity_amm_v2", - instructions: [ - { - name: "swap", - accounts: [ - { - name: "authority", - isMut: false, - isSigner: false - }, - { - name: "amm", - isMut: true, - isSigner: false - }, - { - name: "userTransferAuthority", - isMut: false, - isSigner: true - }, - { - name: "sourceInfo", - isMut: true, - isSigner: false - }, - { - name: "destinationInfo", - isMut: true, - isSigner: false - }, - { - name: "swapSource", - isMut: true, - isSigner: false - }, - { - name: "swapDestination", - isMut: true, - isSigner: false - }, - { - name: "poolMint", - isMut: true, - isSigner: false - }, - { - name: "feeAccount", - isMut: true, - isSigner: false - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false - }, - { - name: "oracleMainAccount", - isMut: false, - isSigner: false - }, - { - name: "oracleSubAccount", - isMut: false, - isSigner: false - }, - { - name: "oraclePcAccount", - isMut: false, - isSigner: false - } - ], - args: [ - { - name: "amountIn", - type: "u64" - }, - { - name: "minimumAmountOut", - type: "u64" - } - ] - } - ], - accounts: [ - { - name: "Amm", - type: { - kind: "struct", - fields: [ - { - name: "initializerKey", - type: "publicKey" - }, - { - name: "initializerDepositTokenAccount", - type: "publicKey" - }, - { - name: "initializerReceiveTokenAccount", - type: "publicKey" - }, - { - name: "initializerAmount", - type: "u64" - }, - { - name: "takerAmount", - type: "u64" - }, - { - name: "isInitialized", - type: "bool" - }, - { - name: "bumpSeed", - type: "u8" - }, - { - name: "freezeTrade", - type: "u8" - }, - { - name: "freezeDeposit", - type: "u8" - }, - { - name: "freezeWithdraw", - type: "u8" - }, - { - name: "baseDecimals", - type: "u8" - }, - { - name: "tokenProgramId", - type: "publicKey" - }, - { - name: "tokenAAccount", - type: "publicKey" - }, - { - name: "tokenBAccount", - type: "publicKey" - }, - { - name: "poolMint", - type: "publicKey" - }, - { - name: "tokenAMint", - type: "publicKey" - }, - { - name: "tokenBMint", - type: "publicKey" - }, - { - name: "feeAccount", - type: "publicKey" - }, - { - name: "oracleMainAccount", - type: "publicKey" - }, - { - name: "oracleSubAccount", - type: "publicKey" - }, - { - name: "oraclePcAccount", - type: "publicKey" - }, - { - name: "fees", - type: { - defined: "AmmFees" - } - }, - { - name: "curve", - type: { - defined: "AmmCurve" - } - }, - { - name: "config", - type: { - defined: "AmmConfig" - } - }, - { - name: "ammPTemp1", - type: "publicKey" - }, - { - name: "ammPTemp2", - type: "publicKey" - }, - { - name: "ammPTemp3", - type: "publicKey" - }, - { - name: "ammPTemp4", - type: "publicKey" - }, - { - name: "ammPTemp5", - type: "publicKey" - } - ] - } - } - ], - types: [ - { - name: "AmmFees", - docs: [ - "Encapsulates all fee information and calculations for swap operations" - ], - type: { - kind: "struct", - fields: [ - { - name: "tradeFeeNumerator", - type: "u64" - }, - { - name: "tradeFeeDenominator", - type: "u64" - }, - { - name: "ownerTradeFeeNumerator", - type: "u64" - }, - { - name: "ownerTradeFeeDenominator", - type: "u64" - }, - { - name: "ownerWithdrawFeeNumerator", - type: "u64" - }, - { - name: "ownerWithdrawFeeDenominator", - type: "u64" - }, - { - name: "hostFeeNumerator", - type: "u64" - }, - { - name: "hostFeeDenominator", - type: "u64" - } - ] - } - }, - { - name: "AmmCurve", - type: { - kind: "struct", - fields: [ - { - name: "curveType", - type: "u8" - }, - { - name: "curveParameters", - type: "u64" - } - ] - } - }, - { - name: "AmmConfig", - type: { - kind: "struct", - fields: [ - { - name: "lastPrice", - type: "u64" - }, - { - name: "lastBalancedPrice", - type: "u64" - }, - { - name: "configDenominator", - type: "u64" - }, - { - name: "volumeX", - type: "u64" - }, - { - name: "volumeY", - type: "u64" - }, - { - name: "volumeXInY", - type: "u64" - }, - { - name: "depositCap", - type: "u64" - }, - { - name: "regressionTarget", - type: "u64" - }, - { - name: "oracleType", - type: "u64" - }, - { - name: "oracleStatus", - type: "u64" - }, - { - name: "oracleMainSlotLimit", - type: "u64" - }, - { - name: "oracleSubConfidenceLimit", - type: "u64" - }, - { - name: "oracleSubSlotLimit", - type: "u64" - }, - { - name: "oraclePcConfidenceLimit", - type: "u64" - }, - { - name: "oraclePcSlotLimit", - type: "u64" - }, - { - name: "stdSpread", - type: "u64" - }, - { - name: "stdSpreadBuffer", - type: "u64" - }, - { - name: "spreadCoefficient", - type: "u64" - }, - { - name: "priceBufferCoin", - type: "i64" - }, - { - name: "priceBufferPc", - type: "i64" - }, - { - name: "rebalanceRatio", - type: "u64" - }, - { - name: "feeTrade", - type: "u64" - }, - { - name: "feePlatform", - type: "u64" - }, - { - name: "oracleMainSlotBuffer", - type: "u64" - }, - { - name: "configTemp4", - type: "u64" - }, - { - name: "configTemp5", - type: "u64" - }, - { - name: "configTemp6", - type: "u64" - }, - { - name: "configTemp7", - type: "u64" - }, - { - name: "configTemp8", - type: "u64" - } - ] - } - }, - { - name: "CurveType", - docs: [ - "Curve types supported by the token-swap program." - ], - type: { - kind: "enum", - variants: [ - { - name: "Standard" - }, - { - name: "ConstantProduct" - } - ] - } - } - ], - errors: [ - { - code: 6000, - name: "AlreadyInUse", - msg: "Swap account already in use" - }, - { - code: 6001, - name: "InvalidProgramAddress", - msg: "Invalid program address generated from bump seed and key" - }, - { - code: 6002, - name: "InvalidOwner", - msg: "Input account owner is not the program address" - }, - { - code: 6003, - name: "InvalidOutputOwner", - msg: "Output pool account owner cannot be the program address" - }, - { - code: 6004, - name: "ExpectedMint", - msg: "Deserialized account is not an SPL Token mint" - }, - { - code: 6005, - name: "ExpectedAccount", - msg: "Deserialized account is not an SPL Token account" - }, - { - code: 6006, - name: "EmptySupply", - msg: "Input token account empty" - }, - { - code: 6007, - name: "InvalidSupply", - msg: "Pool token mint has a non-zero supply" - }, - { - code: 6008, - name: "InvalidDelegate", - msg: "Token account has a delegate" - }, - { - code: 6009, - name: "InvalidInput", - msg: "InvalidInput" - }, - { - code: 6010, - name: "IncorrectSwapAccount", - msg: "Address of the provided swap token account is incorrect" - }, - { - code: 6011, - name: "IncorrectPoolMint", - msg: "Address of the provided pool token mint is incorrect" - }, - { - code: 6012, - name: "InvalidOutput", - msg: "InvalidOutput" - }, - { - code: 6013, - name: "CalculationFailure", - msg: "General calculation failure due to overflow or underflow" - }, - { - code: 6014, - name: "InvalidInstruction", - msg: "Invalid instruction" - }, - { - code: 6015, - name: "RepeatedMint", - msg: "Swap input token accounts have the same mint" - }, - { - code: 6016, - name: "ExceededSlippage", - msg: "Swap instruction exceeds desired slippage limit" - }, - { - code: 6017, - name: "InvalidCloseAuthority", - msg: "Token account has a close authority" - }, - { - code: 6018, - name: "InvalidFreezeAuthority", - msg: "Pool token mint has a freeze authority" - }, - { - code: 6019, - name: "IncorrectFeeAccount", - msg: "Pool fee token account incorrect" - }, - { - code: 6020, - name: "ZeroTradingTokens", - msg: "Given pool token amount results in zero trading tokens" - }, - { - code: 6021, - name: "FeeCalculationFailure", - msg: "Fee calculation failed due to overflow, underflow, or unexpected 0" - }, - { - code: 6022, - name: "ConversionFailure", - msg: "Conversion to u64 failed with an overflow or underflow" - }, - { - code: 6023, - name: "InvalidFee", - msg: "The provided fee does not match the program owner's constraints" - }, - { - code: 6024, - name: "IncorrectTokenProgramId", - msg: "The provided token program does not match the token program expected by the swap" - }, - { - code: 6025, - name: "IncorrectOracleAccount", - msg: "Address of the provided oracle account is incorrect" - }, - { - code: 6026, - name: "IncorrectConfigAccount", - msg: "Address of the provided config account is incorrect" - }, - { - code: 6027, - name: "UnsupportedCurveType", - msg: "The provided curve type is not supported by the program owner" - }, - { - code: 6028, - name: "InvalidCurve", - msg: "The provided curve parameters are invalid" - }, - { - code: 6029, - name: "UnsupportedCurveOperation", - msg: "The operation cannot be performed on the given curve" - }, - { - code: 6030, - name: "InvalidPythStatus", - msg: "Pyth oracle status is not 'trading'" - }, - { - code: 6031, - name: "InvalidPythPrice", - msg: "Could not retrieve updated price feed from the Pyth oracle" - }, - { - code: 6032, - name: "IncorrectSigner", - msg: "Address of the provided signer account is incorrect" - }, - { - code: 6033, - name: "ExceedPoolBalance", - msg: "Swap amount exceeds pool balance" - }, - { - code: 6034, - name: "ProgramIsFrozen", - msg: "Program is frozen" - }, - { - code: 6035, - name: "OracleConfidence", - msg: "Oracle confidence is too high" - }, - { - code: 6036, - name: "OverCapAmount", - msg: "Over Pool Cap Amount" - }, - { - code: 6037, - name: "InvalidUpdateAccount", - msg: "Invalid update wallet address" - }, - { - code: 6038, - name: "InvalidUpdateParam", - msg: "Invalid update param" - }, - { - code: 6039, - name: "InvalidInnerSwapAccount", - msg: "Invalid inner swap account" - } - ], - metadata: { - address: "2wT8Yq49kHgDzXuPxZSaeLaH1qbmGXtEyPy64bL7aD3c" - } -} +} \ No newline at end of file From 37e7475049acf39eacff4c0e8567705df85458a1 Mon Sep 17 00:00:00 2001 From: llama Date: Tue, 24 Oct 2023 08:53:42 +0200 Subject: [PATCH 1693/1974] turn moonpot on chain --- projects/fortube/index.js | 3 --- projects/moonpot/index.js | 42 ++++++++++++++++++++------------------- projects/valuedefi.js | 1 + 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/projects/fortube/index.js b/projects/fortube/index.js index c148c435f9f..418150eaa6a 100644 --- a/projects/fortube/index.js +++ b/projects/fortube/index.js @@ -12,9 +12,6 @@ const config = { polygon: '0x4Ac2735652944FE5C3dD95807287643502e5dE51', } -module.exports = { -}; - Object.keys(config).forEach(chain => { const owner = config[chain] module.exports[chain] = { diff --git a/projects/moonpot/index.js b/projects/moonpot/index.js index 3597fe23671..4ad77c54f65 100644 --- a/projects/moonpot/index.js +++ b/projects/moonpot/index.js @@ -1,23 +1,25 @@ -const utils = require('../helper/utils'); +const { getConfig } = require('../helper/cache'); +const { sumTokens2 } = require('../helper/unwrapLPs'); -function fetchForNetwork(network) { - return async () => { - const response = await utils.fetchURL('https://api.moonpot.com/v2/tvl/' + network); - return response.data.total; - } -} - -async function fetch() { - const response = await utils.fetchURL('https://api.moonpot.com/v2/tvl'); - return response.data.total; +const config = { + bsc: 'https://raw.githubusercontent.com/moonpotdev/moonpot-app/dev/src/config/vault/bsc.json', + fantom: 'https://raw.githubusercontent.com/moonpotdev/moonpot-app/dev/src/config/vault/fantom.json', + // polygon: 'https://raw.githubusercontent.com/moonpotdev/moonpot-app/dev/src/config/vault/polygon.json', } - module.exports = { - bsc: { - fetch: fetchForNetwork('bsc') - }, - fantom:{ - fetch: fetchForNetwork('fantom') - }, - fetch -} \ No newline at end of file + doublecounted: true, +}; + +Object.keys(config).forEach(chain => { + const endpoint = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const data = await getConfig('moonpot/' + api.chain, endpoint) + const pools = data.map(i => i.prizePoolAddress).filter(i => i) + const tokens = await api.multiCall({ abi: 'address:token', calls: pools }) + const bals = await api.multiCall({ abi: 'uint256:accountedBalance', calls: pools }) + api.addTokens(tokens, bals) + return sumTokens2({ api, resolveLP: true, }) + } + } +}) \ No newline at end of file diff --git a/projects/valuedefi.js b/projects/valuedefi.js index e218764de75..71df0f56026 100644 --- a/projects/valuedefi.js +++ b/projects/valuedefi.js @@ -57,6 +57,7 @@ async function bscStableSwapTvl(_, _b, { bsc: block }) { } module.exports = { + misrepresentedTokens: true, bsc: { tvl: sdk.util.sumChainTvls([bscDexTVL, bscStableSwapTvl]), } From 2afdeaf8fec9d53c07a25d1ec462af03a44912be Mon Sep 17 00:00:00 2001 From: Define101 Date: Tue, 24 Oct 2023 12:13:48 +0100 Subject: [PATCH 1694/1974] add quillswap hallmark --- projects/quillswap/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/projects/quillswap/index.js b/projects/quillswap/index.js index 0651e479c08..60b6253d838 100644 --- a/projects/quillswap/index.js +++ b/projects/quillswap/index.js @@ -1,3 +1,6 @@ const { uniTvlExport } = require('../helper/unknownTokens') -module.exports = uniTvlExport('scroll', '0xab8aEfe85faD683A6bDE16EeD04C3420C713324b', { fetchBalances: true, }) \ No newline at end of file +module.exports = uniTvlExport('scroll', '0xab8aEfe85faD683A6bDE16EeD04C3420C713324b', { fetchBalances: true, }) +module.exports.hallmarks = [ + [1698144638,"Rug Pull"], + ] \ No newline at end of file From 23b5ca7654fc45a9733523b236687f47625b7477 Mon Sep 17 00:00:00 2001 From: llama Date: Tue, 24 Oct 2023 14:10:04 +0200 Subject: [PATCH 1695/1974] refactor code --- projects/hydt/index.js | 55 ++++++++++-------------------------------- 1 file changed, 13 insertions(+), 42 deletions(-) diff --git a/projects/hydt/index.js b/projects/hydt/index.js index 8292e1c1fab..b75e9000c60 100644 --- a/projects/hydt/index.js +++ b/projects/hydt/index.js @@ -1,51 +1,22 @@ -const sdk = require("@defillama/sdk"); -const { utils, BigNumber } = require("ethers"); - -const chain = "bsc"; +const { sumUnknownTokens } = require('../helper/unknownTokens') +const hydtAddress = "0x9810512be701801954449408966c630595d0cd51"; const shydtAddress = "0xab4f1Bb558E564ae294D45a025111277c36C89c0"; const earnAddress = "0x8e48d5b2Ac80d9861d07127F06BbF02F73520Ced"; -const coinPairAddress = "0x16b9a82891338f9bA80E2D6970FddA79D1eb0daE"; const controlPairAddress = "0xBB8ae522F812E9E65239A0e5db87a9D738ce957a"; -const tokenABI = { balanceOf: "erc20:balanceOf" }; -const pairABI = "function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast)"; - -async function tvl(_, _b, { [chain]: block }) { - const { output: coinPairReserves } = await sdk.api.abi.call({ - abi: pairABI, - target: coinPairAddress, - chain, block, - }); - const { output: controlPairReserves } = await sdk.api.abi.call({ - abi: pairABI, - target: controlPairAddress, - chain, block, - }); - const controlPrice = - (controlPairReserves.reserve1 * coinPairReserves.reserve0) / - (controlPairReserves.reserve0 * coinPairReserves.reserve1); - - - const { output: stakeBalance } = await sdk.api.abi.call({ - abi: tokenABI.balanceOf, - target: shydtAddress, - params: earnAddress, - chain, block, - }); - const totalValueLockedUSD = utils.formatUnits(stakeBalance) * controlPrice; - - - return { - tether: totalValueLockedUSD - } +async function tvl(_, _b, _cb, { api, }) { + const hydtBal = await api.call({ abi: 'erc20:balanceOf', target: shydtAddress, params: earnAddress}) + api.add(hydtAddress, hydtBal) + return sumUnknownTokens({ api, lps: [controlPairAddress], useDefaultCoreAssets: true, }) } module.exports = { - misrepresentedTokens: true, - methodology: "We get staked amounts from the HYDT staking (earn) contract via contract calls", - start: 1693763345, - bsc: { - tvl, - }, + misrepresentedTokens: true, + methodology: "We get staked amounts from the HYDT staking (earn) contract via contract calls", + start: 1693763345, + bsc: { + tvl: () => ({}), + staking: tvl, + }, }; From bc80ef44d64aa94f275ed2fabe11f69d7f6e40d5 Mon Sep 17 00:00:00 2001 From: llama Date: Tue, 24 Oct 2023 14:11:57 +0200 Subject: [PATCH 1696/1974] bugfix --- projects/hydt/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/hydt/index.js b/projects/hydt/index.js index b75e9000c60..79f3979fb09 100644 --- a/projects/hydt/index.js +++ b/projects/hydt/index.js @@ -6,9 +6,9 @@ const earnAddress = "0x8e48d5b2Ac80d9861d07127F06BbF02F73520Ced"; const controlPairAddress = "0xBB8ae522F812E9E65239A0e5db87a9D738ce957a"; async function tvl(_, _b, _cb, { api, }) { - const hydtBal = await api.call({ abi: 'erc20:balanceOf', target: shydtAddress, params: earnAddress}) + const hydtBal = await api.call({ abi: 'erc20:balanceOf', target: shydtAddress, params: earnAddress }) api.add(hydtAddress, hydtBal) - return sumUnknownTokens({ api, lps: [controlPairAddress], useDefaultCoreAssets: true, }) + return sumUnknownTokens({ api, lps: [controlPairAddress], useDefaultCoreAssets: true, }) } module.exports = { From 7d78afc2e3417f2b35889a0e30997d8173927860 Mon Sep 17 00:00:00 2001 From: llama Date: Tue, 24 Oct 2023 14:58:27 +0200 Subject: [PATCH 1697/1974] delist acala dollar --- projects/bifrost-dex/api.js | 2 +- projects/helper/acala/api.js | 6 +++--- projects/taiga/api.js | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/projects/bifrost-dex/api.js b/projects/bifrost-dex/api.js index db808b56fdf..245a16378f6 100644 --- a/projects/bifrost-dex/api.js +++ b/projects/bifrost-dex/api.js @@ -81,7 +81,7 @@ const tokenToCoingecko = { KSM: "kusama", MOVR: "moonriver", GLMR: "moonbeam", - KUSD: "acala-dollar", + // KUSD: "acala-dollar", ZLK: "zenlink-network-token", USDT: "tether", FIL: "filecoin", diff --git a/projects/helper/acala/api.js b/projects/helper/acala/api.js index bf05f501c56..3fb3f416345 100644 --- a/projects/helper/acala/api.js +++ b/projects/helper/acala/api.js @@ -76,13 +76,13 @@ const fixMapping = { parallel: { 101: { geckoId: 'polkadot', decimals: 10, }, 108: { geckoId: 'acala', decimals: 12, }, - 104: { geckoId: 'acala-dollar', decimals: 12, }, + // 104: { geckoId: 'acala-dollar', decimals: 12, }, 114: { geckoId: 'moonbeam', decimals: 18, }, }, heiko: { 113: { geckoId: 'moonriver', decimals: 18, }, 100: { geckoId: 'kusama', decimals: 12, }, - 103: { geckoId: 'acala-dollar', decimals: 12, }, + // 103: { geckoId: 'acala-dollar', decimals: 12, }, 102: { geckoId: 'tether', decimals: 6, }, 107: { geckoId: 'karura', decimals: 12, }, 119: { geckoId: 'kintsugi', decimals: 12, }, @@ -203,7 +203,7 @@ const geckoMappings = { token: { ACA: 'acala', DOT: 'polkadot', - AUSD: 'acala-dollar', + // AUSD: 'acala-dollar', // LDOT: 'liquid-staking-dot', // coingecko delisted it }, liquidCrowdloan: { diff --git a/projects/taiga/api.js b/projects/taiga/api.js index 28453b13529..b81c9410b12 100644 --- a/projects/taiga/api.js +++ b/projects/taiga/api.js @@ -20,7 +20,7 @@ module.exports = { return { kusama: (await balanceOf(api, account, 'KSM')) / 1e12, 'liquid-ksm': (await balanceOf(api, account, 'LKSM')) / 1e12, - 'acala-dollar': (await balanceOf(api, account_3USD, 'KUSD')) / 1e12, + // 'acala-dollar': (await balanceOf(api, account_3USD, 'KUSD')) / 1e12, // 'usd-coin': (await balanceOf(api, account_3USD, 'erc20://0x1f3a10587a20114ea25ba1b388ee2dd4a337ce27')) / 1e6, 'usd-coin': usdcBalance, tether: (await balanceOf(api, account_3USD, 'fa://7')) / 1e6, From d6c5cf192adc46c1fe2136b983f4741f657f7c72 Mon Sep 17 00:00:00 2001 From: Define101 Date: Tue, 24 Oct 2023 13:59:01 +0100 Subject: [PATCH 1698/1974] change hallmark name --- projects/quillswap/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/quillswap/index.js b/projects/quillswap/index.js index 60b6253d838..53b450e1c0c 100644 --- a/projects/quillswap/index.js +++ b/projects/quillswap/index.js @@ -2,5 +2,5 @@ const { uniTvlExport } = require('../helper/unknownTokens') module.exports = uniTvlExport('scroll', '0xab8aEfe85faD683A6bDE16EeD04C3420C713324b', { fetchBalances: true, }) module.exports.hallmarks = [ - [1698144638,"Rug Pull"], + [1698144638,"Liquidity Removed"], ] \ No newline at end of file From f30b3bfe04629b457458f236b427530308228f5c Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Wed, 25 Oct 2023 01:27:51 +0100 Subject: [PATCH 1699/1974] update treasury --- projects/treasury/benqi.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/treasury/benqi.js b/projects/treasury/benqi.js index 47823d966fa..f8100ae64a7 100644 --- a/projects/treasury/benqi.js +++ b/projects/treasury/benqi.js @@ -1,12 +1,13 @@ const { nullAddress, treasuryExports } = require("../helper/treasury"); const treasury = "0x142eB2ed775e6d497aa8D03A2151D016bbfE7Fc2"; +const treasury2 = "0x9d6ef2445fcc41b0d08865f0a7839490cc58a7b7"; const qi = "0x8729438EB15e2C8B576fCc6AeCdA6A148776C0F5"; module.exports = treasuryExports({ avax: { tokens: [nullAddress], - owners: [treasury], + owners: [treasury, treasury2], ownTokens: [qi], }, }); From 1f73209e92525ea913e3fd1abe0a83d1862b3739 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Wed, 25 Oct 2023 01:30:39 +0100 Subject: [PATCH 1700/1974] add songtech --- projects/songtech/index.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 projects/songtech/index.js diff --git a/projects/songtech/index.js b/projects/songtech/index.js new file mode 100644 index 00000000000..d1ebf83eeef --- /dev/null +++ b/projects/songtech/index.js @@ -0,0 +1,14 @@ +const { sumTokens2, nullAddress } = require("../helper/unwrapLPs"); + +const contract = "0xDe67d94C349960cF80625Bfe762aAe9428844763"; + +async function tvl(time, ethBlock, _b, { api }) { + return sumTokens2({ tokens: [nullAddress], owner: contract, api }); +} + +module.exports = { + methodology: `We count the ETH on ${contract}`, + base: { + tvl, + }, +}; From a652b6e59ac7c212803ecffe0b1ce4cccb6b6381 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Wed, 25 Oct 2023 03:48:33 +0100 Subject: [PATCH 1701/1974] add swell vault --- projects/swell-vault/index.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 projects/swell-vault/index.js diff --git a/projects/swell-vault/index.js b/projects/swell-vault/index.js new file mode 100644 index 00000000000..c5a38972ae8 --- /dev/null +++ b/projects/swell-vault/index.js @@ -0,0 +1,14 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require('../helper/unwrapLPs') + +module.exports = { + methodology: 'ETH and stETH in vaults', + ethereum: { + tvl: sumTokensExport({ owners: [ + "0x325a0e5c84b4d961b19161956f57ae8ba5bb3c26", + ], tokens: [ + ADDRESSES.ethereum.WETH, + ADDRESSES.ethereum.STETH + ]}), + } +}; \ No newline at end of file From 7b6ac0ff226a4148a0f1dc900fad0ef0e03f2423 Mon Sep 17 00:00:00 2001 From: llama Date: Wed, 25 Oct 2023 08:07:17 +0200 Subject: [PATCH 1702/1974] update chewyswap --- projects/ChewySwap/index.js | 11 +++++++++-- projects/DogeShrek/index.js | 12 ++++++++---- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/projects/ChewySwap/index.js b/projects/ChewySwap/index.js index bd8f52cec89..a9fd234b1ab 100644 --- a/projects/ChewySwap/index.js +++ b/projects/ChewySwap/index.js @@ -1,3 +1,10 @@ -const { uniTvlExport } = require('../helper/unknownTokens') +const { getUniTVL } = require('../helper/unknownTokens') -module.exports = uniTvlExport('shibarium', '0xEDedDbde5ffA62545eDF97054edC11013ED72125', { fetchBalances: true, }) +module.exports = { + shibarium: { + tvl: getUniTVL({ factory: "0xEDedDbde5ffA62545eDF97054edC11013ED72125", useDefaultCoreAssets: true,}) + }, + dogechain: { + tvl: getUniTVL({ factory: "0x7C10a3b7EcD42dd7D79C0b9d58dDB812f92B574A", useDefaultCoreAssets: true,}) + } +} \ No newline at end of file diff --git a/projects/DogeShrek/index.js b/projects/DogeShrek/index.js index bf265e609d0..14e2b9c5796 100644 --- a/projects/DogeShrek/index.js +++ b/projects/DogeShrek/index.js @@ -1,11 +1,15 @@ -const { getUniTVL } = require('../helper/unknownTokens') +// const { getUniTVL } = require('../helper/unknownTokens') module.exports = { misrepresentedTokens: true, dogechain: { - tvl: getUniTVL({ + /* tvl: getUniTVL({ useDefaultCoreAssets: true, factory: '0x7C10a3b7EcD42dd7D79C0b9d58dDB812f92B574A', - }) - } + }) */ + tvl: () => ({}), + }, + hallmarks: [ + [Math.floor(new Date('2023-10-25')/1e3), 'Rebranded as Chewyswap'], + ], } \ No newline at end of file From 1926437d46abfb67a280bb94a38beef37a0c2cc8 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 25 Oct 2023 12:20:27 +0530 Subject: [PATCH 1703/1974] Indigo (#7831) * Add staked INDY to TVL * code refactor --------- Co-authored-by: Cody Butz Co-authored-by: llama --- projects/indigo/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/projects/indigo/index.js b/projects/indigo/index.js index 3061b47086f..07d952bc2b0 100644 --- a/projects/indigo/index.js +++ b/projects/indigo/index.js @@ -1,4 +1,5 @@ const { get } = require('../helper/http') +const { sumTokensExport } = require('../helper/chain/cardano') module.exports = { timetravel: false, @@ -8,6 +9,7 @@ module.exports = { return { cardano: data.reduce((a, i) => a + (i.collateralAmount/1e6), 0) } - } + }, + staking: sumTokensExport({ owner: 'addr1w92w34pys9h4h02zxdfsp8lhcvdd5t9aaln9z96szsgh73scty4aj', tokens: ['533bb94a8850ee3ccbe483106489399112b74c905342cb1792a797a0494e4459']}) }, } \ No newline at end of file From 876b8aaa2d15564aaf3d9d5a8ace7039d5f1b037 Mon Sep 17 00:00:00 2001 From: BaseYield <145256279+BAyield@users.noreply.github.com> Date: Wed, 25 Oct 2023 15:15:14 +0800 Subject: [PATCH 1704/1974] Add baseyield TVL to DefiLlama --- projects/baseyield/index.js | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 projects/baseyield/index.js diff --git a/projects/baseyield/index.js b/projects/baseyield/index.js new file mode 100644 index 00000000000..3c1585d3b81 --- /dev/null +++ b/projects/baseyield/index.js @@ -0,0 +1,31 @@ +const { yieldHelper } = require("../helper/unknownTokens"); + +const chain = "base"; +const tokenAPI = "address:want" + +const vaults = [ + "0xd08d16B94A52157fdf43E339D2C895307B11df7A", + "0x283f716a69ecaE4Ee54A3b13C2bDF6eDE1533F1E", + "0x07B95C056683E917AE0Bd7b5BEEf0b6eF344ddc4", + "0x8f43543b224f8E3561bDCDcCAe9724a1be750215", + "0x9300b216bB1168B6C41EC9D68cE61AE9665276f7", + "0xF88C14d209A1b6eeA3BA32e4aC2792Cb6F99cf2C", + "0x7DbB6C880561e722843E9Fd76B8a1b78E70DB6f1", + "0x53CC8dC2113826232CBABCBC700046Aa4086a889", + "0x4e7346170c5a501Ecf6D62eD4f08Ad03685F6Fae", + "0x98712E37C8755f827BBF06A4E6f2d2B66716dE86", + "0xd3b0EE65EA90F8a897A087516EAE123cc65157B2", + "0xcAC4aeEc40abBA8B9E0F063532a52f6a22490FE9", + "0x1A00A13f1Fae8990d0264bd65139B0b5f07F8c3E", + "0xb801A1f9E00fFE8ab838d943884D29a196c9687d", + +] + +module.exports = { + [chain]: { + tvl: async (_, _b, { [chain]: block }) => { + return yieldHelper({ vaults, chain, block, tokenAPI}); + } + } +} + From 6dea64e45f519b3e0265ebd73d3884c57b33d7f8 Mon Sep 17 00:00:00 2001 From: Define101 Date: Wed, 25 Oct 2023 11:08:23 +0100 Subject: [PATCH 1705/1974] add new query pnetwork + add xdai chain --- projects/pnetwork.js | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/projects/pnetwork.js b/projects/pnetwork.js index 84515246066..f65b3a85046 100644 --- a/projects/pnetwork.js +++ b/projects/pnetwork.js @@ -11,25 +11,28 @@ function getTvl(timestamp) { return data[tsStr] async function _getTvl() { - timestamp = timestamp * 1e3 - const query = ` FROM "tvl_v2" WHERE time >= ${timestamp - HOURS_12}ms AND time <= ${timestamp + HOURS_12}ms GROUP BY time(1d)` + timestamp = timestamp * 1e3; + const query = ` FROM "tvl_dist" WHERE time >= ${timestamp - HOURS_12}ms AND time <= ${timestamp + HOURS_12}ms GROUP BY time(1d), "host_blockchain"`; const queryObj = { - q: `SELECT sum("tvl_number")${query}, "host_blockchain";SELECT sum("tvl_number")${query} fill(null)`, + q: `SELECT sum("tvl_number")${query};SELECT sum("tvl_number")${query} fill(null)`, epoch: 'ms', db: 'pnetwork-volumes-1', - } - - const { data: res } = await axios.get('https://pnetwork.watch/api/datasources/proxy/1/query', { params: queryObj }) - - const { results: [{ series }, sumTvl] } = res - const response = {} - - response.tvlTotal = getTvl(sumTvl.series[0].values) - series.forEach(({ tags: { host_blockchain }, values }) => response[chainMapping[host_blockchain]] = getTvl(values)) - if (!response.tvlTotal) throw new Error('Incorrect tvl') - - return response + }; + + const queryURL = `https://pnetwork.watch/api/datasources/proxy/1/query?${new URLSearchParams(queryObj).toString()}`; + + const { data: res } = await axios.get(queryURL); + + const { results: [{ series }, sumTvl] } = res; + const response = {}; + + response.tvlTotal = getTvl(sumTvl.series[0].values); + series.forEach(({ tags: { host_blockchain }, values }) => (response[chainMapping[host_blockchain]] = getTvl(values))); + if (!response.tvlTotal) throw new Error('Incorrect tvl'); + + return response; } + function getTvl(values) { return values.reduce((a, i) => a ? a : i[1], 0) @@ -46,11 +49,12 @@ const chainMapping = { polygon: 'polygon', telos: 'telos', ultra: 'ultra', + xdai: 'xdai' } module.exports = { misrepresentedTokens: true, - methodology: 'Queries the pNetwork database, using the same API endpoint as their own UI. TVL is based on the amount of assets “locked” in the system and that therefore has a 1:1 tokenisation on a host blockchain, including all of the assets and all of the blockchains supported by pNetwork.' + methodology: 'Queries the pNetwork database, using the same API endpoint as their own UI. TVL is based on the amount of assets “locked” in the system and that therefore has a 1:1 tokenization on a host blockchain, including all of the assets and all of the blockchains supported by pNetwork.' }; Object.values(chainMapping).forEach(chain => { @@ -60,4 +64,4 @@ Object.values(chainMapping).forEach(chain => { return toUSDTBalances(response[chain] || 0) } } -}) \ No newline at end of file +}) From 9b247852e47290f76978a23776c9a2d8cc215851 Mon Sep 17 00:00:00 2001 From: Define101 Date: Wed, 25 Oct 2023 11:53:35 +0100 Subject: [PATCH 1706/1974] fix treasury p network --- projects/treasury/p-network.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/treasury/p-network.js b/projects/treasury/p-network.js index ee1d1c2a4b5..02818f233e9 100644 --- a/projects/treasury/p-network.js +++ b/projects/treasury/p-network.js @@ -5,6 +5,7 @@ const treasury2 = "0xabfd88db78d2503af372cb9c21cdc2f181232b4f" const treasury3 = "0xdd92eb1478d3189707ab7f4a5ace3a615cdd0476" const PNT = "0x89ab32156e46f46d02ade3fecbe5fc4243b9aaed" +const ethPNT = "0xf4eA6B892853413bD9d9f1a5D3a620A0ba39c5b2" // 1 ethPNT = 1 PNT module.exports = treasuryExports({ ethereum: { @@ -12,6 +13,6 @@ module.exports = treasuryExports({ nullAddress, ], owners: [treasury, treasury2, treasury3], - ownTokens: [PNT], + ownTokens: [PNT, ethPNT], }, }) \ No newline at end of file From 4f1562334db52f27b491ea6bfd2a14cc47d7e3fa Mon Sep 17 00:00:00 2001 From: TusharTapadia Date: Wed, 25 Oct 2023 16:49:51 +0530 Subject: [PATCH 1707/1974] added tvl logic for v2 --- projects/velvet-capital-v2/index.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 projects/velvet-capital-v2/index.js diff --git a/projects/velvet-capital-v2/index.js b/projects/velvet-capital-v2/index.js new file mode 100644 index 00000000000..afefc7cb1f1 --- /dev/null +++ b/projects/velvet-capital-v2/index.js @@ -0,0 +1,20 @@ +const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') +const axios = require("axios"); + +async function tvl(_, _b, _cb, { api, }){ + const response = await axios.get('https://defivas.org/api/v2/portfolio/all'); + const data = response.data.data; + const indexes = data.map(items=> items.indexSwap); + const [tokens,vaults] = await Promise.all([ + api.multiCall({ abi: 'address[]:getTokens', calls: indexes}), + api.multiCall({ abi: 'address:vault', calls: indexes }), + ]) + + const ownerTokens = tokens.map((tokens,i)=> [tokens,vaults[i]]); + return sumTokens2({api,ownerTokens,resolveLP:true}); +} + +module.exports = { + methodology: 'calculates overall value deposited across different protocol portfolios', + bsc: { tvl } +} From 9b7280c166ae386ab815eba29392cdec1167569d Mon Sep 17 00:00:00 2001 From: Define101 Date: Wed, 25 Oct 2023 12:56:30 +0100 Subject: [PATCH 1708/1974] test wemix --- projects/wemix-fi/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/wemix-fi/index.js b/projects/wemix-fi/index.js index b81e72be37f..ef0272c7fa6 100644 --- a/projects/wemix-fi/index.js +++ b/projects/wemix-fi/index.js @@ -1,3 +1,3 @@ const { uniTvlExport } = require('../helper/unknownTokens') -module.exports = uniTvlExport('wemix', '0xe1F36C7B919c9f893E2Cd30b471434Aa2494664A') \ No newline at end of file +module.exports = uniTvlExport('wemix', '0xe1F36C7B919c9f893E2Cd30b471434Aa2494664A') //test \ No newline at end of file From 13ab4ea3329ba8c527626671329b93979a028be1 Mon Sep 17 00:00:00 2001 From: 0xngmi <80541789+0xngmi@users.noreply.github.com> Date: Wed, 25 Oct 2023 15:00:37 +0100 Subject: [PATCH 1709/1974] Update index.js --- projects/silo/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/silo/index.js b/projects/silo/index.js index eb25a23488a..5ada193e5d3 100644 --- a/projects/silo/index.js +++ b/projects/silo/index.js @@ -83,6 +83,6 @@ module.exports = { ethereum: { tvl, borrowed, }, arbitrum: { tvl, borrowed, }, hallmarks: [ - [1668816000, "XAI Genesis"] + [1692968400, "Launch CRV market"] ] -} \ No newline at end of file +} From decd07a6fa1d3f913b5d43d95c5732e34c689f7b Mon Sep 17 00:00:00 2001 From: Ncookie Date: Wed, 25 Oct 2023 13:10:24 -0400 Subject: [PATCH 1710/1974] feat: Added PoolTogether V5 TVL (#7828) * Cleaned up gitignore (why was this here?) * Refactored PT V3 and V4 * Added V5 TVL * code refactor --------- Co-authored-by: llama --- .gitignore | 1 - projects/pooltogether/abi.json | 8 +- projects/pooltogether/index.js | 164 ++++----------------------------- projects/pooltogether/v3.js | 36 ++++++++ projects/pooltogether/v4.js | 24 +++++ projects/pooltogether/v5.js | 19 ++++ 6 files changed, 101 insertions(+), 151 deletions(-) create mode 100644 projects/pooltogether/v3.js create mode 100644 projects/pooltogether/v4.js create mode 100644 projects/pooltogether/v5.js diff --git a/.gitignore b/.gitignore index c2d649fddf0..a2f2ca539d2 100644 --- a/.gitignore +++ b/.gitignore @@ -7,5 +7,4 @@ historical-data.js /.idea yarn.lock .DS_Store -projects/pooltogether/index.js .vscode \ No newline at end of file diff --git a/projects/pooltogether/abi.json b/projects/pooltogether/abi.json index 8ff2b38d43b..e2e2054abcc 100644 --- a/projects/pooltogether/abi.json +++ b/projects/pooltogether/abi.json @@ -1,3 +1,7 @@ { - "accountedBalance": "uint256:accountedBalance" -} \ No newline at end of file + "accountedBalance": "uint256:accountedBalance", + "totalVaults": "uint256:totalVaults", + "allVaults": "function allVaults(uint256) view returns (address)", + "asset": "address:asset", + "totalAssets": "uint256:totalAssets" +} diff --git a/projects/pooltogether/index.js b/projects/pooltogether/index.js index 1392e6e813b..3f97c5afbf2 100644 --- a/projects/pooltogether/index.js +++ b/projects/pooltogether/index.js @@ -1,153 +1,21 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const sdk = require("@defillama/sdk"); -const { request, gql } = require("graphql-request"); -const abi = require('./abi.json') -const { getChainTransform } = require("../helper/portedTokens"); -const { getBlock } = require("../helper/http"); -const { sumTokens } = require("../helper/unwrapLPs"); -const { default: BigNumber } = require("bignumber.js"); - -const graphUrls = ['https://api.thegraph.com/subgraphs/name/pooltogether/pooltogether-v3_1_0', - 'https://api.thegraph.com/subgraphs/name/pooltogether/pooltogether-v3_3_2', - 'https://api.thegraph.com/subgraphs/name/pooltogether/pooltogether-v3_3_8', - 'https://api.thegraph.com/subgraphs/name/pooltogether/pooltogether-v3_4_3'] -const celoGraphUrl = 'https://api.thegraph.com/subgraphs/name/pooltogether/celo-v3_4_5' -const bscGraphUrl = 'https://api.thegraph.com/subgraphs/name/pooltogether/bsc-v3_4_3' - -const graphQuery = gql` -query GET_POOLS($block: Int) { - prizePools{ - id - underlyingCollateralSymbol - underlyingCollateralToken - compoundPrizePool{ - cToken - } - } -} -`; - -const v4pools={ - ethereum:[ - ["0xbcca60bb61934080951369a648fb03df4f96263c", "0x32e8d4c9d1b711bc958d0ce8d14b41f77bb03a64"] - ], - polygon:[ - ["0x1a13f4ca1d028320a707d99520abfefca3998b7f", "0xD4F6d570133401079D213EcF4A14FA0B4bfB5b9C"] - ], - avax:[ - ['0x46a51127c3ce23fb7ab1de06226147f446e4a857', '0x7437db21A0dEB844Fa64223e2d6Db569De9648Ff'] - ], - optimism:[ - ['0x625E7708f30cA75bfd92586e17077590C60eb4cD', '0x4ecB5300D9ec6BCA09d66bfd8Dcb532e3192dDA1'] - ] -} - -async function getChainBalances(allPrizePools, chain, block, transform) { - const balances = {}; - transform = transform || (addr=>`${chain}:${addr}`); - const lockedTokens = await sdk.api.abi.multiCall({ - abi: abi['accountedBalance'], - calls: allPrizePools.map(pool => ({ - target: pool.id - })), - block, - chain - }) - lockedTokens.output.forEach(call => { - const underlyingToken = transform(allPrizePools.find(pool => - pool.id === call.input.target).underlyingCollateralToken); - const underlyingTokenBalance = ((underlyingToken.includes('0x')) ? - call.output : call.output / 10 ** 18) - sdk.util.sumSingleBalance(balances, underlyingToken, BigNumber(underlyingTokenBalance).toFixed(0)) - }) - if(v4pools[chain]!== undefined){ - await sumTokens(balances, v4pools[chain], block, chain, transform) - } - return balances -} - -async function eth(timestamp, block) { - let allPrizePools = [] - let combinedPrizePools = [] - for (const graphUrl of graphUrls) { - const { prizePools } = await request( - graphUrl, - graphQuery, - { - block, - } - ); - allPrizePools = allPrizePools.concat(prizePools) - } - combinedPrizePools = allPrizePools.flat() - allPrizePools = [...new Set(combinedPrizePools.map(a => JSON.stringify(a)))].map(a => JSON.parse(a)) - return getChainBalances(allPrizePools, 'ethereum', block, addr=>{ - if(addr === "0x04f2694c8fcee23e8fd0dfea1d4f5bb8c352111f") return "0x383518188c0c6d7730d91b2c03a03c837814a899" // OHM - return addr - }) -} - -async function polygon(timestamp, block, chainBlocks) { - return getChainBalances([{ - id: "0x887E17D791Dcb44BfdDa3023D26F7a04Ca9C7EF4", - underlyingCollateralToken: ADDRESSES.ethereum.USDT - }, - { - id: "0xee06abe9e2af61cabcb13170e01266af2defa946", - underlyingCollateralToken: ADDRESSES.ethereum.USDC - }], 'polygon', chainBlocks.polygon) -} - -async function avax(timestamp, block, chainBlocks) { - return getChainBalances([], 'avax', chainBlocks.avax, ()=>`avax:0xa7d7079b0fead91f3e65f86e8915cb59c1a4c664`) -} - -async function optimism(timestamp, block, chainBlocks) { - return getChainBalances([], 'optimism', chainBlocks.optimism, ()=>`optimism:0x7F5c764cBc14f9669B88837ca1490cCa17c31607`) -} - -async function celo(timestamp, block, chainBlocks) { - const transform = await getChainTransform('celo') - let allPrizePools = [] - block = chainBlocks.celo - const { prizePools } = await request( - celoGraphUrl, graphQuery, { block }) - allPrizePools = allPrizePools.concat(prizePools) - return getChainBalances(allPrizePools, 'celo', block, transform) -} - -async function bsc(timestamp, _, chainBlocks) { - const transform = await getChainTransform('bsc') - let allPrizePools = [] - const blockG = await getBlock(timestamp, 'bsc', chainBlocks) - 1000 - const { prizePools } = await request(bscGraphUrl, graphQuery, { block: blockG }) - allPrizePools = allPrizePools.concat(prizePools) - return getChainBalances(allPrizePools, 'bsc', chainBlocks.bsc, transform) -} +const v3 = require('./v3.js').tvl +const v4 = require('./v4.js').tvl +const v5 = require('./v5.js').tvl +const sdk = require('@defillama/sdk') module.exports = { doublecounted: true, - ethereum: { - tvl: eth - }, - polygon: { - tvl: polygon - }, - avax:{ - tvl: avax - }, - optimism:{ - tvl: optimism - }, - celo: { - tvl: celo - }, - bsc: { - tvl: bsc, - }, - hallmarks:[ - [1658872800, "OP Rewards Start"], - [1669615200, "OP Rewards Start"], + ethereum: { tvl: sdk.util.sumChainTvls([v3, v4]) }, + avax: { tvl: sdk.util.sumChainTvls([ v4]) }, + polygon: { tvl: sdk.util.sumChainTvls([v3, v4]) }, + optimism: { tvl: sdk.util.sumChainTvls([v4, v5]) }, + bsc: { tvl: sdk.util.sumChainTvls([v3]) }, + celo: { tvl: sdk.util.sumChainTvls([v3]) }, + hallmarks: [ + [1_634_320_800, 'V4 Launch'], + [1_658_872_800, 'V4 OP Rewards Begin'], + [1_669_615_200, 'V4 OP Rewards Extended'], + [1_697_738_400, 'V5 Launch'] ], - methodology: `TVL is the total quantity of tokens locked in PoolTogether pools on Ethereum, Polygon, Avalanche, Optimism, Celo, and BSC` + methodology: `TVL is the total tokens deposited in PoolTogether amongst V3, V4 and V5 on Ethereum, Polygon, Avalanche, Optimism, Celo and BSC` } diff --git a/projects/pooltogether/v3.js b/projects/pooltogether/v3.js new file mode 100644 index 00000000000..f3383d80350 --- /dev/null +++ b/projects/pooltogether/v3.js @@ -0,0 +1,36 @@ +const { cachedGraphQuery } = require('../helper/cache') +const abi = require('./abi.json') + +const GRAPH_URLS = { + ethereum: [ + 'https://api.thegraph.com/subgraphs/name/pooltogether/pooltogether-v3_1_0', + 'https://api.thegraph.com/subgraphs/name/pooltogether/pooltogether-v3_3_2', + 'https://api.thegraph.com/subgraphs/name/pooltogether/pooltogether-v3_3_8', + 'https://api.thegraph.com/subgraphs/name/pooltogether/pooltogether-v3_4_3' + ], + celo: ['https://api.thegraph.com/subgraphs/name/pooltogether/celo-v3_4_5'], + bsc: ['https://api.thegraph.com/subgraphs/name/pooltogether/bsc-v3_4_3'] +} +const GRAPH_QUERY = ` + query GET_POOLS { + prizePools { id } + } +` +async function tvl(_, _b, _cb, { api, }) { + const graphUrls = GRAPH_URLS[api.chain] ?? [] + const pools = [] + if (api.chain === 'polygon') pools.push('0x887E17D791Dcb44BfdDa3023D26F7a04Ca9C7EF4', '0xee06abe9e2af61cabcb13170e01266af2defa946') + for (const endpoint of graphUrls) { + const key = `pooltogether/${api.chain}/${endpoint.split('pooltogether/')[1]}` + const { prizePools } = await cachedGraphQuery(key, endpoint, GRAPH_QUERY,) + pools.push(...prizePools.map(i => i.id)) + } + const tokens = await api.multiCall({ abi: 'address:token', calls: pools}) + const bals = await api.multiCall({ abi: abi.accountedBalance, calls: pools}) + api.addTokens(tokens, bals) + return api.getBalances() +} + +module.exports = { + tvl, +} diff --git a/projects/pooltogether/v4.js b/projects/pooltogether/v4.js new file mode 100644 index 00000000000..72cfdbaa3bb --- /dev/null +++ b/projects/pooltogether/v4.js @@ -0,0 +1,24 @@ +const { sumTokens2 } = require('../helper/unwrapLPs') + +const V4_POOLS = { + ethereum: [ + ['0xbcca60bb61934080951369a648fb03df4f96263c', '0x32e8d4c9d1b711bc958d0ce8d14b41f77bb03a64'] + ], + polygon: [ + ['0x1a13f4ca1d028320a707d99520abfefca3998b7f', '0xD4F6d570133401079D213EcF4A14FA0B4bfB5b9C'] + ], + avax: [ + ['0x46a51127c3ce23fb7ab1de06226147f446e4a857', '0x7437db21A0dEB844Fa64223e2d6Db569De9648Ff'] + ], + optimism: [ + ['0x625E7708f30cA75bfd92586e17077590C60eb4cD', '0x4ecB5300D9ec6BCA09d66bfd8Dcb532e3192dDA1'] + ] +} + +async function tvl(_, _b, _cb, { api, }) { + return sumTokens2({ api, tokensAndOwners: V4_POOLS[api.chain] }) +} + +module.exports = { + tvl +} diff --git a/projects/pooltogether/v5.js b/projects/pooltogether/v5.js new file mode 100644 index 00000000000..77d90b5fd16 --- /dev/null +++ b/projects/pooltogether/v5.js @@ -0,0 +1,19 @@ +const abi = require('./abi.json') + +const V5_VAULT_FACTORIES = { + optimism: '0xF65FA202907D6046D1eF33C521889B54BdE08081' +} + +async function tvl(_, _b, _cb, { api, }) { + const factory = V5_VAULT_FACTORIES[api.chain] + if (!factory) return {} + const vaults = await api.fetchList({ lengthAbi: abi.totalVaults, itemAbi: abi.allVaults, target: factory }) + const tokens = await api.multiCall({ abi: abi.asset, calls: vaults }) + const bals = await api.multiCall({ abi: abi.totalAssets, calls: vaults }) + api.addTokens(tokens, bals) + return api.getBalances() +} + +module.exports = { + tvl +} From 7bf19528959161c9f5c03dbb214d0db9ca0e42ac Mon Sep 17 00:00:00 2001 From: thomassb1625 <84809971+thomassb1625@users.noreply.github.com> Date: Wed, 25 Oct 2023 13:12:34 -0400 Subject: [PATCH 1711/1974] Uncomment base (#7840) --- projects/prime-protocol/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/prime-protocol/index.js b/projects/prime-protocol/index.js index 376d1087e4e..dc3afaf5878 100644 --- a/projects/prime-protocol/index.js +++ b/projects/prime-protocol/index.js @@ -11,7 +11,7 @@ const PRIME_SATELLITE_NETWORKS = { ethereum: 1, bsc: 56, polygon: 137, -// base: 8453, + base: 8453, optimism: 10, // filecoin: 314 }; From b7c93e6651967dea2c4e45c1f72c182624c5bdb6 Mon Sep 17 00:00:00 2001 From: Antoine <67124021+antoineborg@users.noreply.github.com> Date: Wed, 25 Oct 2023 19:16:13 +0200 Subject: [PATCH 1712/1974] SwissBorg: Add Cosmos wallet (#7837) --- projects/swissborg/index.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/projects/swissborg/index.js b/projects/swissborg/index.js index 1e258da97e1..f46e5ae023b 100644 --- a/projects/swissborg/index.js +++ b/projects/swissborg/index.js @@ -93,6 +93,11 @@ const config = { '0x87cbc48075d7aa1760Ac71C41e8Bc289b6A31F56', '0xFF4606bd3884554CDbDabd9B6e25E2faD4f6fc54', ] + }, + cosmos: { + owners: [ + 'cosmos10dfzd2wpnpeuy2lgan35ah8dg5p4l298v0n8e8', + ] } } From 1bd26417fb41f8115a4d49584213f05623e1176b Mon Sep 17 00:00:00 2001 From: Ss5h Date: Thu, 26 Oct 2023 02:25:18 +0900 Subject: [PATCH 1713/1974] Add Everdex (#7833) * add everdex project, update bfc core Asset * add chain in getUniTVL --- projects/everdex/index.js | 29 +++++++++++++++++++++++++++++ projects/helper/coreAssets.json | 4 +++- projects/helper/tokenMapping.js | 6 ++++++ 3 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 projects/everdex/index.js diff --git a/projects/everdex/index.js b/projects/everdex/index.js new file mode 100644 index 00000000000..c412a4a9f8f --- /dev/null +++ b/projects/everdex/index.js @@ -0,0 +1,29 @@ +const ADDRESSES = require('../helper/coreAssets.json'); +const { getUniTVL } = require("../helper/unknownTokens"); +const { sumTokens2, } = require('../helper/unwrapLPs'); +const sdk = require('@defillama/sdk'); + +const chain = 'bfc' + +// 3-pools +const tokensAndOwners = [ + // stablePoolDaiUsdcUsdt + [ADDRESSES.bfc.UnifiedDAI, '0xa455434802d8B530C77d2B7547eF93C798896581'], + [ADDRESSES.bfc.UnifiedUSDC, '0xa455434802d8B530C77d2B7547eF93C798896581'], + [ADDRESSES.bfc.UnifiedUSDT, '0xa455434802d8B530C77d2B7547eF93C798896581'], +] + +async function tvl() { + return sumTokens2({ tokensAndOwners, chain }); +} + +const uniTVL = getUniTVL({ factory: '0x19f21b0AB98EC10d734E314356Ad562ae349177d', useDefaultCoreAssets: true, chain}); + + +module.exports = { + misrepresentedTokens: true, + start: 1674864000, + bfc: { + tvl: sdk.util.sumChainTvls([tvl, uniTVL]) + }, +}; \ No newline at end of file diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index 2d16dbdf4e0..82c584acdda 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -1451,12 +1451,14 @@ "USDT": "0x999f90f25a2922ae1b21A06066F7EDEbedad42a9" }, "bfc": { + "WBFC": "0x1c1b06405058AbE02e4748753aeD1458BEFEE3B9", "UnifiedETH": "0x6c9944674C1D2cF6c4c4999FC7290Ba105dcd70e", "UnifiedBNB": "0xB800EaF843F962DFe5e145A8c9D07A3e70b11d7F", "UnifiedUSDC": "0x640952E7984f2ECedeAd8Fd97aA618Ab1210A21C", "UnifiedMATIC": "0x21ad243b81eff53482F6F6E7C76539f2CfC0B734", "UnifiedUSDT": "0x3eA8654d5755e673599473ab37d92788B5bA12aE", - "UnifiedDAI": "0xcDB9579Db96EB5C8298dF889D915D0FF668AfF2a" + "UnifiedDAI": "0xcDB9579Db96EB5C8298dF889D915D0FF668AfF2a", + "BIFI": "0x047938C3aD13c1eB821C8e310B2B6F889b6d0003" }, "scroll": { "WETH": "0x5300000000000000000000000000000000000004", diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index bea1ae7636b..dc8211fe011 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -66,6 +66,12 @@ const fixBalancesTokens = { }, elsm: { '0xa801b1a7846156d4c81bd188f96bfcb621517611': { coingeckoId: 'vulcan-forged', decimals: 18 }, + }, + bfc: { + [ADDRESSES.bfc.WBFC]: { coingeckoId: 'bifrost', decimals: 18}, + [ADDRESSES.bfc.BIFI]: { coingeckoId: 'bifi', decimals: 18}, + '0xB1f3A83597Bce2AD842c29bD750AE17afc474137': {coingeckoId: 'witch-token', decimals: 18}, + '0x17102AC78a02a98fC78B0c29B7b0506f035A99E5': {coingeckoId: 'super-athletes-token', decimals: 18} } } From 9c00e61a489a098d1b577b6e55d9353f596ebfd6 Mon Sep 17 00:00:00 2001 From: llama Date: Wed, 25 Oct 2023 19:31:56 +0200 Subject: [PATCH 1714/1974] split pooltogether based on versions --- projects/pooltogether-v4/index.js | 11 +++++++++++ projects/pooltogether-v5/index.js | 11 +++++++++++ projects/pooltogether/index.js | 19 ++++++++----------- 3 files changed, 30 insertions(+), 11 deletions(-) create mode 100644 projects/pooltogether-v4/index.js create mode 100644 projects/pooltogether-v5/index.js diff --git a/projects/pooltogether-v4/index.js b/projects/pooltogether-v4/index.js new file mode 100644 index 00000000000..c20d70c16a6 --- /dev/null +++ b/projects/pooltogether-v4/index.js @@ -0,0 +1,11 @@ +const { tvl } = require('../pooltogether/v4.js') + +const chains = ['ethereum', 'avax', 'polygon', 'optimism',] + +module.exports = { + doublecounted: true, +} + +chains.forEach(chain => { + module.exports[chain] = { tvl } +}) diff --git a/projects/pooltogether-v5/index.js b/projects/pooltogether-v5/index.js new file mode 100644 index 00000000000..7c02208969c --- /dev/null +++ b/projects/pooltogether-v5/index.js @@ -0,0 +1,11 @@ +const { tvl } = require('../pooltogether/v5.js') + +const chains = ['optimism'] + +module.exports = { + doublecounted: true, +} + +chains.forEach(chain => { + module.exports[chain] = { tvl } +}) diff --git a/projects/pooltogether/index.js b/projects/pooltogether/index.js index 3f97c5afbf2..a85f1188684 100644 --- a/projects/pooltogether/index.js +++ b/projects/pooltogether/index.js @@ -1,21 +1,18 @@ -const v3 = require('./v3.js').tvl -const v4 = require('./v4.js').tvl -const v5 = require('./v5.js').tvl -const sdk = require('@defillama/sdk') +const { tvl } = require('./v3.js') + +const chains = ['ethereum', 'polygon', 'bsc', 'celo'] module.exports = { doublecounted: true, - ethereum: { tvl: sdk.util.sumChainTvls([v3, v4]) }, - avax: { tvl: sdk.util.sumChainTvls([ v4]) }, - polygon: { tvl: sdk.util.sumChainTvls([v3, v4]) }, - optimism: { tvl: sdk.util.sumChainTvls([v4, v5]) }, - bsc: { tvl: sdk.util.sumChainTvls([v3]) }, - celo: { tvl: sdk.util.sumChainTvls([v3]) }, hallmarks: [ [1_634_320_800, 'V4 Launch'], [1_658_872_800, 'V4 OP Rewards Begin'], [1_669_615_200, 'V4 OP Rewards Extended'], [1_697_738_400, 'V5 Launch'] ], - methodology: `TVL is the total tokens deposited in PoolTogether amongst V3, V4 and V5 on Ethereum, Polygon, Avalanche, Optimism, Celo and BSC` + methodology: `TVL is the total tokens deposited in PoolTogether` } + +chains.forEach(chain => { + module.exports[chain] = { tvl } +}) From a2499466c84ceec669773f64889a51363bce9624 Mon Sep 17 00:00:00 2001 From: Xenomorph <41480689+darkalienlord@users.noreply.github.com> Date: Wed, 25 Oct 2023 22:24:01 +0200 Subject: [PATCH 1715/1974] Add USD Coin to Alien Base, Add Area51 to Alienbase (#7841) --- projects/alienbase-area51/index.js | 12 ++++++++++++ projects/alienbase-stableswap/index.js | 1 + 2 files changed, 13 insertions(+) create mode 100644 projects/alienbase-area51/index.js diff --git a/projects/alienbase-area51/index.js b/projects/alienbase-area51/index.js new file mode 100644 index 00000000000..4f0b7185343 --- /dev/null +++ b/projects/alienbase-area51/index.js @@ -0,0 +1,12 @@ +const { getUniTVL } = require('../helper/unknownTokens') +const ALB = "0x1dd2d631c92b1aCdFCDd51A0F7145A50130050C4"; +const FACTORY = "0x2d5dd5fa7B8a1BFBDbB0916B42280208Ee6DE51e" + + +module.exports = { + misrepresentedTokens: true, + methodology: `Uses Uniswap-style factory address to find and price liquidity pairs.`, + base: { + tvl: getUniTVL({ factory: FACTORY, useDefaultCoreAssets: true, fetchBalances: true, }), + } +}; \ No newline at end of file diff --git a/projects/alienbase-stableswap/index.js b/projects/alienbase-stableswap/index.js index f9761d2a15e..1dd439f910d 100644 --- a/projects/alienbase-stableswap/index.js +++ b/projects/alienbase-stableswap/index.js @@ -1,5 +1,6 @@ const pools = Object.values({ 'aUsdc-Dai': '0x927860797d07b1C46fbBe7f6f73D45C7E1BFBb27', + 'USDC-Dai': '0x410d28fbcd00c677bae1cce2261546c8db4f6a2d', }) async function tvl(_, _b, _cb, { api, }) { From e9d9ae51dfbb36cf380a76346d8d490deb6d39f9 Mon Sep 17 00:00:00 2001 From: coffeefifinance <148778764+coffeefifinance@users.noreply.github.com> Date: Thu, 26 Oct 2023 04:25:30 +0800 Subject: [PATCH 1716/1974] Add coffeefi TVL to DefiLlama (#7816) --- projects/coffeefi/index.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 projects/coffeefi/index.js diff --git a/projects/coffeefi/index.js b/projects/coffeefi/index.js new file mode 100644 index 00000000000..eeff48cc336 --- /dev/null +++ b/projects/coffeefi/index.js @@ -0,0 +1,13 @@ +const { getUniTVL } = require('../helper/unknownTokens.js') + +module.exports = { + misrepresentedTokens: true, + scroll: { + tvl: getUniTVL({ + factory: '0x23537BCe0533e53609A49dffdd400e54A825cb81', + useDefaultCoreAssets: true, + hasStablePools: true, + fetchBalances: true, + }) + } +} \ No newline at end of file From 9cf8205a54c95803476a6d7329db0867aafc3b68 Mon Sep 17 00:00:00 2001 From: BaseYield <145256279+BAyield@users.noreply.github.com> Date: Thu, 26 Oct 2023 04:32:33 +0800 Subject: [PATCH 1717/1974] Add baseyield TVL to DefiLlama (#7832) --- projects/baseyield/index.js | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 projects/baseyield/index.js diff --git a/projects/baseyield/index.js b/projects/baseyield/index.js new file mode 100644 index 00000000000..3c1585d3b81 --- /dev/null +++ b/projects/baseyield/index.js @@ -0,0 +1,31 @@ +const { yieldHelper } = require("../helper/unknownTokens"); + +const chain = "base"; +const tokenAPI = "address:want" + +const vaults = [ + "0xd08d16B94A52157fdf43E339D2C895307B11df7A", + "0x283f716a69ecaE4Ee54A3b13C2bDF6eDE1533F1E", + "0x07B95C056683E917AE0Bd7b5BEEf0b6eF344ddc4", + "0x8f43543b224f8E3561bDCDcCAe9724a1be750215", + "0x9300b216bB1168B6C41EC9D68cE61AE9665276f7", + "0xF88C14d209A1b6eeA3BA32e4aC2792Cb6F99cf2C", + "0x7DbB6C880561e722843E9Fd76B8a1b78E70DB6f1", + "0x53CC8dC2113826232CBABCBC700046Aa4086a889", + "0x4e7346170c5a501Ecf6D62eD4f08Ad03685F6Fae", + "0x98712E37C8755f827BBF06A4E6f2d2B66716dE86", + "0xd3b0EE65EA90F8a897A087516EAE123cc65157B2", + "0xcAC4aeEc40abBA8B9E0F063532a52f6a22490FE9", + "0x1A00A13f1Fae8990d0264bd65139B0b5f07F8c3E", + "0xb801A1f9E00fFE8ab838d943884D29a196c9687d", + +] + +module.exports = { + [chain]: { + tvl: async (_, _b, { [chain]: block }) => { + return yieldHelper({ vaults, chain, block, tokenAPI}); + } + } +} + From 8e70d7ea0318ad3d63a604f5b0ff7b68990e87ce Mon Sep 17 00:00:00 2001 From: llama Date: Wed, 25 Oct 2023 22:36:23 +0200 Subject: [PATCH 1718/1974] update flokifi --- projects/flokifi-locker/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/projects/flokifi-locker/index.js b/projects/flokifi-locker/index.js index 14f1b7407b4..1b35467c965 100644 --- a/projects/flokifi-locker/index.js +++ b/projects/flokifi-locker/index.js @@ -16,7 +16,9 @@ const chains = { 'kcc': 321, 'cronos': 25, 'evmos': 9001, - 'dogechain': 2000 + 'op_bnb': 204, + 'base': 8453, + 'dogechain': 2000, } async function fetch(chainId) { From 915fb14dc4ff46b4bfe59d1c819f700f198d6efd Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Wed, 25 Oct 2023 23:54:30 +0100 Subject: [PATCH 1719/1974] add hashnote --- projects/hashnote/index.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 projects/hashnote/index.js diff --git a/projects/hashnote/index.js b/projects/hashnote/index.js new file mode 100644 index 00000000000..920d0be4d60 --- /dev/null +++ b/projects/hashnote/index.js @@ -0,0 +1,12 @@ +module.exports = { + canto: { + tvl: async (_, _1, _2, { api }) => { + const totalSupply = await api.call({ target: '0xfb8255f0de21acebf490f1df6f0bdd48cc1df03b', abi: 'uint256:totalSupply'}); + const rate = await api.call({ target: '0x1d18c02bc80b1921255e71cf2939c03258d75470', abi: 'function latestRoundData() external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound)'}); + + return { + "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48": (totalSupply * rate.answer)/1e8 + }; + } + } +}; From 170759e6d1516f1deeb5bbaacb765d22ae9a5efe Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Thu, 26 Oct 2023 03:20:28 +0100 Subject: [PATCH 1720/1974] missing address for sushi treasury --- projects/treasury/sushiswap.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/projects/treasury/sushiswap.js b/projects/treasury/sushiswap.js index ee1e6fcbe82..44c42582a16 100644 --- a/projects/treasury/sushiswap.js +++ b/projects/treasury/sushiswap.js @@ -1,8 +1,8 @@ const ADDRESSES = require('../helper/coreAssets.json') const { nullAddress, treasuryExports } = require("../helper/treasury"); -const sushiSwapTreasury = "0xe94B5EEC1fA96CEecbD33EF5Baa8d00E4493F4f3"; const SUSHI = ADDRESSES.ethereum.SUSHI; +const xSUSHI = "0x8798249c2E607446EfB7Ad49eC89dD1865Ff4272" module.exports = treasuryExports({ @@ -11,7 +11,13 @@ module.exports = treasuryExports({ nullAddress, ADDRESSES.ethereum.USDC,//USDC ], - owners: [sushiSwapTreasury], - ownTokens: [SUSHI], + owners: [ + "0xe94B5EEC1fA96CEecbD33EF5Baa8d00E4493F4f3", + "0xf73B31c07e3f8Ea8f7c59Ac58ED1F878708c8A76" + ], + ownTokens: [ + SUSHI, + xSUSHI + ], }, }) From 12ec84ce08a3777204907c661c6888a7ff40b514 Mon Sep 17 00:00:00 2001 From: brightiron <95196612+brightiron@users.noreply.github.com> Date: Wed, 25 Oct 2023 21:35:53 -0500 Subject: [PATCH 1721/1974] update subgraph endpoint. remove problematic pool (#7842) --- projects/olympus/index.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/projects/olympus/index.js b/projects/olympus/index.js index 157d96f2edb..59220a6865e 100644 --- a/projects/olympus/index.js +++ b/projects/olympus/index.js @@ -90,7 +90,7 @@ function sumBalancesByTokenAddress(arr) { ***/ async function tvl(timestamp, block, _, { api }, isOwnTokensMode = false) { const subgraphUrls = { - ethereum: `https://gateway.thegraph.com/api/${getEnv('OLYMPUS_GRAPH_API_KEY')}/subgraphs/id/DTcDcUSBRJjz9NeoK5VbXCVzYbRTyuBwdPUqMi8x32pY`, + ethereum: `https://gateway-arbitrum.network.thegraph.com/api/${getEnv("OLYMPUS_GRAPH_API_KEY")}/subgraphs/id/7jeChfyUTWRyp2JxPGuuzxvGt3fDKMkC9rLjm7sfLcNp`, arbitrum: "https://api.thegraph.com/subgraphs/name/olympusdao/protocol-metrics-arbitrum", fantom: @@ -98,6 +98,10 @@ const subgraphUrls = { polygon: "https://api.thegraph.com/subgraphs/name/olympusdao/protocol-metrics-polygon", }; + + //filter out problematic pools that dont have a decimals function. + const poolsWithoutDecimals = ["0x88051b0eea095007d3bef21ab287be961f3d8598"]; + const indexedBlockForEndpoint = await blockQuery( subgraphUrls[api.chain], getLatestBlockIndexed, @@ -110,6 +114,10 @@ const subgraphUrls = { { api } ); + const filteredTokenRecords = tokenRecords.filter( + (t) => !poolsWithoutDecimals.includes(t.tokenAddress) + ); + const aDay = 24 * 3600; const now = Date.now() / 1e3; if (now - blockNum[0].timestamp > 3 * aDay) { @@ -124,7 +132,7 @@ const subgraphUrls = { * that need to be normalized for pricing . * See addressMap above **/ - const normalizedFilteredTokenRecords = tokenRecords.map((token) => { + const normalizedFilteredTokenRecords = filteredTokenRecords.map((token) => { const normalizedAddress = addressMap[token.tokenAddress] ? addressMap[token.tokenAddress] : token.tokenAddress; From b9a85c7483a175aa2373037676d6bb76b0fcdc56 Mon Sep 17 00:00:00 2001 From: Landon Gingerich Date: Thu, 26 Oct 2023 05:47:56 -0500 Subject: [PATCH 1722/1974] Add zkSync Era to OKX (#7839) --- projects/okex/index.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/projects/okex/index.js b/projects/okex/index.js index 58439471f57..72583a75bd6 100644 --- a/projects/okex/index.js +++ b/projects/okex/index.js @@ -96,6 +96,21 @@ const config = { owners:[ "0xebe80f029b1c02862b9e8a70a7e5317c06f62cae", ] + }, + era:{ + owners: [ + "0xebe80f029b1c02862b9e8a70a7e5317c06f62cae", + "0x539c92186f7c6cc4cbf443f26ef84c595babbca1", + "0xbfbbfaccd1126a11b8f84c60b09859f80f3bd10f", + "0x461249076b88189f8ac9418de28b365859e46bfd", + "0x4e7b110335511f662fdbb01bf958a7844118c0d4", + "0x65a0947ba5175359bb457d3b34491edf4cbf7997", + "0x868dab0b8e21ec0a48b726a1ccf25826c78c6d7f", + "0xa7efae728d2936e78bda97dc267687568dd593f3", + "0xc708a1c712ba26dc618f972ad7a187f76c8596fd", + "0xf59869753f41db720127ceb8dbb8afaf89030de4", + "0xf7858da8a6617f7c6d0ff2bcafdb6d2eedf64840", + ] } } From 5dcccb2bd83edd4dfa622742771e1bc2df266240 Mon Sep 17 00:00:00 2001 From: aqeelVaival <123551683+aqeelVaival@users.noreply.github.com> Date: Thu, 26 Oct 2023 17:25:36 +0500 Subject: [PATCH 1723/1974] Bridge tvl added for ElysiumBridge (#7847) --- projects/elysiumBridge/index.js | 44 +++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 projects/elysiumBridge/index.js diff --git a/projects/elysiumBridge/index.js b/projects/elysiumBridge/index.js new file mode 100644 index 00000000000..34a123df9d9 --- /dev/null +++ b/projects/elysiumBridge/index.js @@ -0,0 +1,44 @@ +const { sumTokens2 } = require('../helper/unwrapLPs') + +const config = { + + polygon: { + bridges: [ + '0xa801b1A7846156d4C81bD188F96bfcb621517611', + ], + tokens: { + PYR: '0x430ef9263e76dae63c84292c3409d61c598e9682', + CCO2: '0x82B37070e43C1BA0EA9e2283285b674eF7f1D4E2', + WMATIC: '0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270', + WETH: '0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619', + USDT: '0xc2132D05D31c914a87C6611C10748AEb04B58e8F', + MV: '0xA3c322Ad15218fBFAEd26bA7f616249f7705D945', + } + }, + ethereum: { + bridges: [ + '0x0AD6741312Fc2a9FdB21D3Ce8AFaA08ad0C8c996', + ], + tokens: { + PYR: '0x430ef9263e76dae63c84292c3409d61c598e9682', + // CCO2: '0x82B37070e43C1BA0EA9e2283285b674eF7f1D4E2', + // WMATIC: '0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270', + // WETH: '0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619', + // USDT: '0xc2132D05D31c914a87C6611C10748AEb04B58e8F', + // MV: '0xA3c322Ad15218fBFAEd26bA7f616249f7705D945', + } + }, +} + +module.exports = { +}; + +Object.keys(config).forEach(chain => { + module.exports[chain] = { + tvl: (_, _b, {[chain]: block}) => { + const { bridges: owners, tokens } = config[chain] + return sumTokens2({ tokens: Object.values(tokens), owners, chain, block, }) + } + } +}) + From b0fd9224697e10ce13a7d0ee3486a5f3bbc34498 Mon Sep 17 00:00:00 2001 From: cy-phiz <77606371+cy-phiz@users.noreply.github.com> Date: Thu, 26 Oct 2023 20:26:54 +0800 Subject: [PATCH 1724/1974] Support scroll (#7845) --- projects/xy-finance/index.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/projects/xy-finance/index.js b/projects/xy-finance/index.js index 38ddafe5a52..b57d8fa567e 100644 --- a/projects/xy-finance/index.js +++ b/projects/xy-finance/index.js @@ -59,6 +59,9 @@ const config = { mantle: { chainId: '5000', }, + scroll: { + chainId: '534352', + }, } const ethAddress = '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE' @@ -361,6 +364,16 @@ const yPoolDepositContract = { "tokenAddress": ADDRESSES.mantle.USDT } }, + "534352": { + "ETH": { + "contractAddress": "0x0241fb446d6793866245b936F2C3418F818bDcD3", + "tokenAddress": ethAddress + }, + "USDC": { + "contractAddress": "0xF526EFc174b512e66243Cb52524C1BE720144e8d", + "tokenAddress": ADDRESSES.scroll.USDC + } + }, } module.exports={} From d363ff513e31f81aea71c5880fc4759b35a65922 Mon Sep 17 00:00:00 2001 From: Frank Date: Thu, 26 Oct 2023 20:27:34 +0800 Subject: [PATCH 1725/1974] Add cswap dex (#7844) * add cswap-dex * Implemented on-chain TVL source --------- Co-authored-by: Cardano Shield --- projects/cswap-dex/index.js | 46 +++++++++++++++++++++ projects/helper/chain/cardano/blockfrost.js | 6 +++ 2 files changed, 52 insertions(+) create mode 100644 projects/cswap-dex/index.js diff --git a/projects/cswap-dex/index.js b/projects/cswap-dex/index.js new file mode 100644 index 00000000000..29f58a804da --- /dev/null +++ b/projects/cswap-dex/index.js @@ -0,0 +1,46 @@ +const { getAdaInAddress } = require("../helper/chain/cardano"); +const { getScriptsDatum, getAddressesUTXOs } = require('../helper/chain/cardano/blockfrost') + +const MARKETPLACE_POOL_ADDR = "addr1zxjd0cp5dj4u8cyygey8tt7kqrmu90fyca39ds45h4rpygyhsxtnvg5qyn2rl7y6qz6qc6fns87y808anxwzt0pmc8es2g4kc8"; +const MARKETPLACE_ORDERBOOK_ADDR = "addr1z9jgk6l4fcus943znsfxj7hrsew5ju8rgru74wlvus400j5hsxtnvg5qyn2rl7y6qz6qc6fns87y808anxwzt0pmc8es5nqza5"; + +async function tvl() { + const liquidityPoolLocked = await getAdaInAddress(MARKETPLACE_POOL_ADDR) + const batchOrderLocked = await getAdaInAddress(MARKETPLACE_ORDERBOOK_ADDR) + var assetLocked = 0; + + // get no. of assets locked in each UTXO * buy price in the datum + const utxos = await getAddressesUTXOs(MARKETPLACE_POOL_ADDR); + for (const utxo of utxos) { + if (utxo.data_hash) { + // extract policy id and buy price from the datum + const datum = await getScriptsDatum(utxo.data_hash); + + const policy_id = datum.json_value?.fields[0]?.fields[0]?.fields[2].bytes; + const buy_price = datum.json_value?.fields[0]?.fields[1]?.fields[7].int; + + // make sure we got the policy id and buy price + var num_assets = 0; + if (policy_id && buy_price) { + for (const amount of utxo.amount) { + if (amount.unit.startsWith(policy_id)) { + num_assets++; + } + } + } + + assetLocked += (num_assets * buy_price / 1_000_000); + } + } + + return { + cardano: liquidityPoolLocked + batchOrderLocked + assetLocked, + }; +} + +module.exports = { + timetravel: false, + cardano: { + tvl, + }, +} diff --git a/projects/helper/chain/cardano/blockfrost.js b/projects/helper/chain/cardano/blockfrost.js index ba36f3b59e3..242c6b48886 100644 --- a/projects/helper/chain/cardano/blockfrost.js +++ b/projects/helper/chain/cardano/blockfrost.js @@ -70,6 +70,11 @@ async function getTxsMetadata(utxo) { return data } +async function getScriptsDatum(datumHash) { + const { data } = await axiosObj.get(`scripts/datum/${datumHash}`) + return data +} + async function getTokensMinted(tokenId){ const {data} = await axiosObj.get(`assets/${tokenId}`) return Number(data.quantity) @@ -83,4 +88,5 @@ module.exports = { assetsAddresses, addressesUtxosAssetAll, getTokensMinted, + getScriptsDatum, } From 12bcd7134ebbb5cd826ec301b5e3b4b755f80c8e Mon Sep 17 00:00:00 2001 From: allis <135569190+allisweb3@users.noreply.github.com> Date: Thu, 26 Oct 2023 07:29:34 -0500 Subject: [PATCH 1726/1974] add chiliswap (#7843) --- projects/chiliswap/index.js | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 projects/chiliswap/index.js diff --git a/projects/chiliswap/index.js b/projects/chiliswap/index.js new file mode 100644 index 00000000000..f8496e15d1e --- /dev/null +++ b/projects/chiliswap/index.js @@ -0,0 +1,9 @@ +const {getUniTVL} = require("../helper/unknownTokens"); + +module.exports = { + misrepresentedTokens: true, + methodology: 'TVL accounts for the liquidity on all AMM pools', + scroll: { + tvl: getUniTVL({chain: 'scroll', factory: "0x2627161e60fFa589f8bD3798F0947d572A7EdF68", useDefaultCoreAssets: true}) + } +}; \ No newline at end of file From 1531478a136df3a49ef0d08d73633cdf31601d3a Mon Sep 17 00:00:00 2001 From: llama Date: Thu, 26 Oct 2023 14:51:01 +0200 Subject: [PATCH 1727/1974] update jamfrens --- projects/chiliswap/index.js | 14 +++++++------- projects/jamfrens/index.js | 3 ++- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/projects/chiliswap/index.js b/projects/chiliswap/index.js index f8496e15d1e..cde14c6c62d 100644 --- a/projects/chiliswap/index.js +++ b/projects/chiliswap/index.js @@ -1,9 +1,9 @@ -const {getUniTVL} = require("../helper/unknownTokens"); +const { getUniTVL } = require("../helper/unknownTokens"); module.exports = { - misrepresentedTokens: true, - methodology: 'TVL accounts for the liquidity on all AMM pools', - scroll: { - tvl: getUniTVL({chain: 'scroll', factory: "0x2627161e60fFa589f8bD3798F0947d572A7EdF68", useDefaultCoreAssets: true}) - } -}; \ No newline at end of file + misrepresentedTokens: true, + methodology: 'TVL accounts for the liquidity on all AMM pools', + scroll: { + tvl: getUniTVL({ fetchBalances: true, factory: "0x2627161e60fFa589f8bD3798F0947d572A7EdF68", useDefaultCoreAssets: true }) + } +} \ No newline at end of file diff --git a/projects/jamfrens/index.js b/projects/jamfrens/index.js index 137e39c6f4f..9b14fcb6bd8 100644 --- a/projects/jamfrens/index.js +++ b/projects/jamfrens/index.js @@ -1,9 +1,10 @@ const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') const contract = "0x3dbea36ced3cd155605b725faf7e3f66dc5d6b2b" +const contract2 = "0xda78c03A7e4C44e570FDB7c6046D3e6387d5fDDC" async function tvl(time, ethBlock, _b, {api}) { - return sumTokens2({ tokens: [nullAddress], owner: contract, api }) + return sumTokens2({ tokens: [nullAddress], owners: [contract, contract2,], api }) } module.exports = { From ce81955577216348811948b90cc26299bb2b5f15 Mon Sep 17 00:00:00 2001 From: Define101 Date: Thu, 26 Oct 2023 17:02:03 +0100 Subject: [PATCH 1728/1974] remove bsc from bentobox --- projects/sushiswap-bentobox/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/sushiswap-bentobox/index.js b/projects/sushiswap-bentobox/index.js index 4ac5ab7add8..b5ccfbdd8ae 100644 --- a/projects/sushiswap-bentobox/index.js +++ b/projects/sushiswap-bentobox/index.js @@ -4,7 +4,7 @@ const bentobox_chains = [ "ethereum", "polygon", "fantom", - "bsc", +// "bsc", "avax", "arbitrum", "optimism", From 0d5c524cd256ea88b1ba7fc5d5d803ada5b35d5e Mon Sep 17 00:00:00 2001 From: Define101 Date: Thu, 26 Oct 2023 19:12:00 +0100 Subject: [PATCH 1729/1974] remove wallets p network --- projects/treasury/p-network.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/projects/treasury/p-network.js b/projects/treasury/p-network.js index 02818f233e9..f0da2e290fd 100644 --- a/projects/treasury/p-network.js +++ b/projects/treasury/p-network.js @@ -1,7 +1,6 @@ const { nullAddress, treasuryExports } = require("../helper/treasury"); -const treasury = "0x015ed76723aaf0ef9960dd66631d2ecac77e4156"; -const treasury2 = "0xabfd88db78d2503af372cb9c21cdc2f181232b4f" + const treasury3 = "0xdd92eb1478d3189707ab7f4a5ace3a615cdd0476" const PNT = "0x89ab32156e46f46d02ade3fecbe5fc4243b9aaed" @@ -12,7 +11,7 @@ module.exports = treasuryExports({ tokens: [ nullAddress, ], - owners: [treasury, treasury2, treasury3], + owners: [treasury3], ownTokens: [PNT, ethPNT], }, }) \ No newline at end of file From a2b636dd701d7e954f8b75a732bf53cd601b4025 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Thu, 26 Oct 2023 19:12:20 +0100 Subject: [PATCH 1730/1974] add zapper channels --- projects/zapper-channels/index.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 projects/zapper-channels/index.js diff --git a/projects/zapper-channels/index.js b/projects/zapper-channels/index.js new file mode 100644 index 00000000000..a8a96248e33 --- /dev/null +++ b/projects/zapper-channels/index.js @@ -0,0 +1,14 @@ +const { sumTokens2, nullAddress } = require("../helper/unwrapLPs"); + +const contract = "0xbC98176DC471CB67Dc19fA4558104f034D8965Fa"; + +async function tvl(time, ethBlock, _b, { api }) { + return sumTokens2({ tokens: [nullAddress], owner: contract, api }); +} + +module.exports = { + methodology: `We count the ETH on ${contract}`, + base: { + tvl, + }, +}; From ee2324bbf98242fd41474ea2ac00addf0496642f Mon Sep 17 00:00:00 2001 From: LidoKing <55234791+LidoKing@users.noreply.github.com> Date: Fri, 27 Oct 2023 02:13:28 +0800 Subject: [PATCH 1731/1974] add match finance (#7848) * add match finance with stETH & dLP tvl * code refactor --------- Co-authored-by: llama --- projects/Match-Finance/index.js | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 projects/Match-Finance/index.js diff --git a/projects/Match-Finance/index.js b/projects/Match-Finance/index.js new file mode 100644 index 00000000000..3384a6bb481 --- /dev/null +++ b/projects/Match-Finance/index.js @@ -0,0 +1,31 @@ +const ADDRESSES = require('../helper/coreAssets.json') + +const ETH_LBR_LP = '0x3a0ef60e803aae8e94f741e7f61c7cbe9501e569'; +const LYBRA_STETH_VAULT = '0xa980d4c0C2E48d305b582AA439a3575e3de06f0E'; +const LYBRA_REWARD_VAULT = '0xec7c6cd15d9bd98fc9805e0509e3bb2033c5956d'; +const MATCH_FINANCE_CONTRACT = '0x04b9ce11da7323aEf03f6e6c16C0b93cFB44C55c'; + +const totalSuppliedAbi = 'function depositedAsset(address) external view returns (uint256)' + +async function tvl(_, _1, _2, { api }) { + const [ + totalSTETHSupplied, + lpStaked, + ] = await Promise.all([ + api.call({ abi: totalSuppliedAbi, params: MATCH_FINANCE_CONTRACT, target: LYBRA_STETH_VAULT }), + api.call({ abi: 'erc20:balanceOf', params: MATCH_FINANCE_CONTRACT, target: LYBRA_REWARD_VAULT }), + ]); + + api.add(ADDRESSES.ethereum.STETH, totalSTETHSupplied) + api.add(ETH_LBR_LP, lpStaked) + + return api.getBalances() +} + +module.exports = { + doublecounted: true, + methodology: 'Get total amount of stETH supplied and ETH-LBR LP staked to Match Finance', + ethereum: { + tvl, + } +}; From 61d8364cb24b2488de626bdbafb28ef4955efb78 Mon Sep 17 00:00:00 2001 From: Ivan <3238603+ivivanov@users.noreply.github.com> Date: Fri, 27 Oct 2023 06:54:38 +0300 Subject: [PATCH 1732/1974] feat: fetch nolus tvl onchain (#7851) --- projects/helper/chain/cosmos.js | 15 ++++ projects/helper/chains.json | 4 +- projects/nolus/index.js | 152 +++++++++++++++++++++++++++----- 3 files changed, 148 insertions(+), 23 deletions(-) diff --git a/projects/helper/chain/cosmos.js b/projects/helper/chain/cosmos.js index d579e0bc8e7..e8312daa787 100644 --- a/projects/helper/chain/cosmos.js +++ b/projects/helper/chain/cosmos.js @@ -39,6 +39,7 @@ const endPoints = { aura: "https://lcd.aura.network", archway: "https://api.mainnet.archway.io", sifchain: "https://sifchain-api.polkachu.com", + nolus: "https://pirin-cl.nolus.network:1317" }; const chainSubpaths = { @@ -181,6 +182,19 @@ async function queryContract({ contract, chain, data }) { ).data.data; } +async function queryManyContracts({ contracts = [], chain, data }) { + const parallelLimit = 25 + const { results, errors } = await PromisePool + .withConcurrency(parallelLimit) + .for(contracts) + .process(async (contract) => queryContract({ contract, chain, data })) + + if (errors && errors.length) throw errors[0] + + return results +} + + async function queryContracts({ chain, codeId, }) { const res = [] const limit = 1000 @@ -255,6 +269,7 @@ module.exports = { queryV1Beta1, queryContractStore, queryContract, + queryManyContracts, queryContracts, sumTokens, getTokenBalance, diff --git a/projects/helper/chains.json b/projects/helper/chains.json index cf8c48444a1..5616496776c 100644 --- a/projects/helper/chains.json +++ b/projects/helper/chains.json @@ -150,6 +150,7 @@ "neutron", "nos", "nova", + "nolus", "nuls", "oasis", "oas", @@ -250,6 +251,5 @@ "zeniq", "zilliqa", "zksync", - "zyx", - "nolus" + "zyx" ] diff --git a/projects/nolus/index.js b/projects/nolus/index.js index a4961cb68df..69cbb9f8770 100644 --- a/projects/nolus/index.js +++ b/projects/nolus/index.js @@ -1,27 +1,137 @@ -const utils = require('../helper/utils') -const { getApiTvl } = require('../helper/historicalApi') -const api = 'https://etl-cl.nolus.network:8080/api' - -function tvl(timestamp) { - return getApiTvl(timestamp, - async () => { - const resp = await utils.fetchURL(`${api}/total-value-locked`) - return resp.data.total_value_locked - }, - async () => { - const resp = await utils.fetchURL(`${api}/total-value-locked-series`) - return resp.data.map(v => ({ - date: new Date(v.timestamp).getTime(), - totalLiquidityUSD: v.tvl - })) - }) +const { queryContract, queryManyContracts, queryContracts } = require('../helper/chain/cosmos') + +const leaserAddress = 'nolus1wn625s4jcmvk0szpl85rj5azkfc6suyvf75q6vrddscjdphtve8s5gg42f' +const oracleAddress = 'nolus1436kxs0w2es6xlqpp9rd35e3d0cjnw4sv8j3a7483sgks29jqwgsv3wzl4' +const lppAddress = 'nolus1qg5ega6dykkxc307y25pecuufrjkxkaggkkxh7nad0vhyhtuhw3sqaa3c5' +const chain = 'nolus' + +async function getLeaseCodeId() { + const leaserContract = await queryContract({ + contract: leaserAddress, + chain: chain, + data: { config: {} } + }) + + const leaseCodeId = leaserContract?.config?.lease_code_id + if (!leaseCodeId) { + return 0 + } + + return leaseCodeId +} + +async function getLeaseContracts(leaseCodeId) { + return await queryContracts({ + chain: chain, + codeId: leaseCodeId, + }) +} + +async function getLeases(leaseContracts) { + return await queryManyContracts({ + contracts: leaseContracts, + chain: chain, + data: {} + }) +} + +async function getPrices() { + const oracle = await queryContract({ + contract: oracleAddress, + chain: chain, + data: { prices: {} } + }) + + const prices = {} + oracle.prices.forEach(p => { + let price = 0 + switch (p.amount.ticker) { + case "WBTC": + price = (p.amount_quote.amount / (p.amount.amount / 100000000)) / 1000000 + break + case "WETH": + case "EVMOS": + price = (p.amount_quote.amount / (p.amount.amount / 1000000000000000000)) / 1000000 + break + default: + price = p.amount_quote.amount / p.amount.amount + break + } + prices[p.amount.ticker] = price + }) + + return prices +} + +async function getLppTvl() { + const lpp = await queryContract({ + contract: lppAddress, + chain: chain, + data: { "lpp_balance": [] } + }) + + return Number(lpp.balance.amount) / 1000000 +} + +function sumAssests(leases) { + let assets = {} + leases.forEach(v => { + if (v.opened) { + const ticker = v.opened.amount.ticker + const amount = BigInt(v.opened.amount.amount) + + if (ticker in assets) { + assets[ticker] += amount + } else { + assets[ticker] = amount + } + } + }) + return assets +} + +function getAssetsTvl(assets, prices) { + let totalTvl = 0 + for (const ticker in assets) { + if (Object.hasOwnProperty.call(assets, ticker)) { + let amount = 0 + switch (ticker) { + case "WBTC": + amount = Number(assets[ticker]) / 100000000 + break + case "WETH": + case "EVMOS": + amount = Number(assets[ticker]) / 1000000000000000000 + break + default: + amount = Number(assets[ticker]) / 1000000 + break + } + totalTvl += amount * prices[ticker] + } + } + return totalTvl +} + +async function tvl() { + const leaseCodeId = await getLeaseCodeId() + const leaseContracts = await getLeaseContracts(leaseCodeId) + const leases = await getLeases(leaseContracts) + const assets = sumAssests(leases) + + const prices = await getPrices() + const assetsTvl = getAssetsTvl(assets, prices) + const lppTvl = await getLppTvl() + return { + 'axlusdc': assetsTvl + lppTvl + } } module.exports = { - methodology: "The combined total of lending pool assets and the current market value of active leases", - nolus: { - tvl - } + methodology: "The combined total of lending pool assets and the current market value of active leases", + nolus: { + tvl + } } // node test.js projects/nolus/index.js From c5340e912739dc9f55e60a44d93794d8da36ce14 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 27 Oct 2023 10:12:12 +0530 Subject: [PATCH 1733/1974] Term-fi (#7855) * Adds calculation of total borrowed for term-finance. * Update index.js * Make event emitter addresses chain-specific. * minor code refactor --------- Co-authored-by: Robert Chu Co-authored-by: Robert Chu Co-authored-by: llama --- projects/term-finance/index.js | 44 ++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/projects/term-finance/index.js b/projects/term-finance/index.js index 1b77db2c750..0d87de33f72 100644 --- a/projects/term-finance/index.js +++ b/projects/term-finance/index.js @@ -1,4 +1,5 @@ const { cachedGraphQuery } = require('../helper/cache') +const { getLogs } = require('../helper/cache/getLogs') const graphs = { ethereum: @@ -19,6 +20,30 @@ query poolQuery($lastId: ID) { } }` +const borrowedQuery = ` +query auctionsQuery($lastId: ID) { + termAuctions( + first: 1000, + where: { + id_gt: $lastId, + } + ) { + id + auction + term { + purchaseToken + } + } +}` + +const startBlock = 16380765; +const emitters = { + "ethereum": [ + "0x9D6a563cf79d47f32cE46CD7b1fb926eCd0f6160", // 0.2.4 + "0xf268E547BC77719734e83d0649ffbC25a8Ff4DB3", // 0.4.1 + ], +}; + module.exports = { methodology: `Counts the collateral tokens locked in Term Finance's term repos.`, // hallmarks: [[1588610042, "TermFinance Launch"]], @@ -30,6 +55,25 @@ Object.keys(graphs).forEach(chain => { tvl: async (_, _b, _cb, { api, }) => { const data = await cachedGraphQuery(`term-finance-${chain}`, host, query, { fetchById: true }) return api.sumTokens( { tokensAndOwners: data.map(i => [i.collateralToken, i.term.termRepoLocker])}) + }, + borrowed: async (_, _b, _cb, { api, }) => { + const data = await cachedGraphQuery(`term-finance-borrowed-${chain}`, host, borrowedQuery, { fetchById: true }) + + for (const eventEmitter of emitters[chain] ?? []) { + const logs = await getLogs({ + api, + target: eventEmitter, + eventAbi: 'event BidAssigned(bytes32 termAuctionId, bytes32 id, uint256 amount)', + onlyArgs: true, + fromBlock: startBlock, + }) + for (const { termAuctionId, amount } of logs) { + const { term: { purchaseToken } } = data.find(i => i.id === termAuctionId) + api.add(purchaseToken, amount) + } + } + + return api.getBalances() } } }) From 416430ad507c8d3f26802976163bcb0b39b36185 Mon Sep 17 00:00:00 2001 From: superbunny-7 Date: Fri, 27 Oct 2023 12:45:18 +0800 Subject: [PATCH 1734/1974] add aptin finance v2 (#7854) --- projects/aptin-finance-v2/index.js | 49 ++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 projects/aptin-finance-v2/index.js diff --git a/projects/aptin-finance-v2/index.js b/projects/aptin-finance-v2/index.js new file mode 100644 index 00000000000..ee4839736a7 --- /dev/null +++ b/projects/aptin-finance-v2/index.js @@ -0,0 +1,49 @@ +const sdk = require("@defillama/sdk"); +const { getResource, getTableData, } = require("../helper/chain/aptos"); +const { transformBalances } = require("../helper/portedTokens"); + +let data + +async function getData() { + if (!data) data = _getData() + return data + + async function _getData() { + const lendPool = await getResource('0x719b1538162dae27f6d818b384dcf82f198b5c5a90b605d3c9aec1189013a73c', '0x3c1d4a86594d681ff7e5d5a233965daeabdc6a15fe5672ceeda5260038857183::pool::LendProtocol') + const coins = lendPool.coins + const table = lendPool.pools.handle + + const params = { + key_type: '0x1::string::String', + value_type: '0x3c1d4a86594d681ff7e5d5a233965daeabdc6a15fe5672ceeda5260038857183::pool::Pool', + } + const coinInfos = await Promise.all(coins.map(i => getTableData({ table, data: { ...params, key: i } }))) + const balances = { + tvl: {}, + borrowed: {}, + } + coinInfos.forEach((data, i) => { + sdk.util.sumSingleBalance(balances.tvl, coins[i], data.supply_pool.total_value - data.borrow_pool.total_value) + sdk.util.sumSingleBalance(balances.borrowed, coins[i], data.borrow_pool.total_value) + }) + + return balances + } +} + + +module.exports = { + timetravel: false, + methodology: + "TVL contains the sum of the supply of all markets in the Aptin protocol contract, borrowed tokens are not counted.", + aptos: { + tvl: async () => { + const data = await getData() + return transformBalances('aptos', data.tvl) + }, + borrowed: async () => { + const data = await getData() + return transformBalances('aptos', data.borrowed) + }, + }, +}; From c14a9a6aed1d0cd8e07cbb27fb7f8bbc0e20be94 Mon Sep 17 00:00:00 2001 From: llama Date: Fri, 27 Oct 2023 08:57:23 +0200 Subject: [PATCH 1735/1974] track y2k v2.1 --- projects/y2k-v2/index.js | 36 ++++++++---------------------------- 1 file changed, 8 insertions(+), 28 deletions(-) diff --git a/projects/y2k-v2/index.js b/projects/y2k-v2/index.js index da3dc9bf377..8eb721bdd31 100644 --- a/projects/y2k-v2/index.js +++ b/projects/y2k-v2/index.js @@ -1,48 +1,28 @@ -const { sumTokens2, sumTokensExport } = require('../helper/unwrapLPs') +const { sumTokens2, } = require('../helper/unwrapLPs') const { getLogs } = require('../helper/cache/getLogs') -const chain = 'arbitrum' - -async function tvl(timestamp, _b, chainBlocks, { api }) { - const logs = await getLogs({ - api, - fromBlock: 33934273, - eventAbi: 'event MarketCreated(uint256 indexed mIndex, address hedge, address risk, address token, string name, int256 strikePrice)', - topics: ['0xf38f00404415af51ddd0dd57ce975d015de2f40ba8a087ac48cd7552b7580f32'], - target: '0x984e0eb8fb687afa53fc8b33e12e04967560e092', - }) - - const vaults = logs.map(({ args }) => ([args.hedge, args.risk])).flat() - const tokens = await api.multiCall({ - abi: 'address:asset', - calls: vaults, - }) - const tokensAndOwners = tokens.map((token, i) => ([token, vaults[i]])) - - return sumTokens2({ api, tokensAndOwners }) -} - const config = { - arbitrum: { factory: '0xC3179AC01b7D68aeD4f27a19510ffe2bfb78Ab3e', fromBlock: 96059531 , }, + arbitrum: [{ factory: '0xC3179AC01b7D68aeD4f27a19510ffe2bfb78Ab3e', fromBlock: 96059531, }, { factory: '0x442Fd67F2CcF92eD73E7B7E4ff435835EcA890C9', fromBlock: 141345832, },], } Object.keys(config).forEach(chain => { - const { factory, fromBlock} = config[chain] + const _config = config[chain] module.exports[chain] = { tvl: async (_, _b, _cb, { api, }) => { - const logs = await getLogs({ + const logs = (await Promise.all(_config.map(({ factory, fromBlock, }) => getLogs({ api, target: factory, topics: ['0xe8066e93c2c1e100c0c76002a546075b7c6b53025db53708875180c81afda250'], eventAbi: 'event MarketCreated (uint256 indexed marketId, address premium, address collateral, address underlyingAsset, address token, string name, uint256 strike, address controller)', onlyArgs: true, fromBlock, - }) + })))).flat() + const premiums = logs.map(i => i.premium) const collaterals = logs.map(i => i.collateral) - const pTokens = await api.multiCall({ abi: 'address:asset', calls: premiums }) - const cTokens = await api.multiCall({ abi: 'address:asset', calls: collaterals }) + const pTokens = await api.multiCall({ abi: 'address:asset', calls: premiums }) + const cTokens = await api.multiCall({ abi: 'address:asset', calls: collaterals }) return sumTokens2({ api, tokensAndOwners2: [[...pTokens, ...cTokens], [...premiums, ...collaterals]] }) } } From 517ce3d56ffb95e281b6788051d5100deda3e267 Mon Sep 17 00:00:00 2001 From: Define101 Date: Fri, 27 Oct 2023 10:31:54 +0100 Subject: [PATCH 1736/1974] add primex treasury --- projects/treasury/primex-finance.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 projects/treasury/primex-finance.js diff --git a/projects/treasury/primex-finance.js b/projects/treasury/primex-finance.js new file mode 100644 index 00000000000..b0b11c96b76 --- /dev/null +++ b/projects/treasury/primex-finance.js @@ -0,0 +1,12 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { treasuryExports } = require("../helper/treasury"); + +const treasury = "0x3c0d3f52e9aa1c9645a05452f45c064a0f9569bf"; +const ePMX = "0xdc6d1bd104e1efa4a1bf0bbcf6e0bd093614e31a" + +module.exports = treasuryExports({ + polygon: { + owners: [treasury], + ownTokens: [ePMX], + }, +}); \ No newline at end of file From 00429c5842eb612abaad2abcc9147d0ee19c7446 Mon Sep 17 00:00:00 2001 From: Define101 Date: Fri, 27 Oct 2023 14:03:01 +0100 Subject: [PATCH 1737/1974] add op chain to clearpool --- projects/clearpool/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/clearpool/index.js b/projects/clearpool/index.js index c0b251746c3..ba907582d00 100644 --- a/projects/clearpool/index.js +++ b/projects/clearpool/index.js @@ -17,6 +17,7 @@ const config = { ethereum: { factory: '0xde204e5a060ba5d3b63c7a4099712959114c2d48', fromBlock: 14443222 }, polygon_zkevm: { factory: '0xCE3Fec90A05992dF1357651FEF6D143FeeC7Ca16', fromBlock: 302970 }, polygon: { factory: '0x215CCa938dF02c9814BE2D39A285B941FbdA79bA', fromBlock: 31128013 }, + optimism: { factory: '0x99C10A7aBd93b2db6d1a2271e69F268a2c356b80', fromBlock: 107128813 }, } Object.keys(config).forEach(chain => { From 72894cfb3b345f74fa5bd3f6c9c72dfa8eebce74 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 27 Oct 2023 20:05:18 +0530 Subject: [PATCH 1738/1974] Vivaleva-2 (#7864) * vivaleva * Update index.js * Update index.js * Update index.js * Update index.js * Update index.js * Update index.js * Update index.js * Update index.js * Update index.js * Update index.js * Update index.js * Update index.js * Update index.js * Update index.js * Update index.js * Update index.js * refactor using multicall * code refactor * minor fix --------- Co-authored-by: Sooyoung Lee Co-authored-by: Geunwoo Baek (Richard) <39114544+geunwoobaek@users.noreply.github.com> Co-authored-by: llama --- projects/vivaleva/index.js | 60 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 58 insertions(+), 2 deletions(-) diff --git a/projects/vivaleva/index.js b/projects/vivaleva/index.js index 639952f994b..c189b17cbfc 100644 --- a/projects/vivaleva/index.js +++ b/projects/vivaleva/index.js @@ -1,18 +1,74 @@ const { getConfig } = require('../helper/cache') +const getAllPositionsByIdsABI = "function getAllPositionsByIds(address vaultAddress, uint256[] positionIds) view returns (tuple(address worker, uint256 positionId, uint256 positionDebtAmount, uint256 positionHealth, uint256[] positionIngredients, uint16 positionKillFactorBps)[] positionInfos)" module.exports = { timetravel: false, era: { async tvl(_, _1, _2, { api }) { - const data = await getConfig('vivaleva', "https://sbb.sooho.io/api/v1/external/vivaleva/defiLlama") + const _data = await getConfig('vivaleva', "https://sbb.sooho.io/api/v1/external/vivaleva/defiLlama") + + const data = { + ..._data, + pancakeSwapV3Worker: [ + { + name: "USDC-WETH PancakeSwapV3 Farm Worker", + address: "0x9ac1CD6f35934bAeD9986711b9D983260C8F38C4", + lpTokenAddress: "0x291d9F9764c72C9BA6fF47b451a9f7885Ebf9977", + farmingTokenAddress: "0x3355df6D4c9C3035724Fd0e3914dE96A5a83aaf4", + baseTokenAddress: "0x5aea5775959fbc2557cc8789bc1bf90a239d9a91", + }, + { + name: "ETH-USDC PancakeswapV3 Farm", + address: "0x9ca8aD7290079BF5dbE42CCB917474379Aa167e5", + farmingTokenAddress: "0x5aea5775959fbc2557cc8789bc1bf90a239d9a91", + baseTokenAddress: "0x3355df6D4c9C3035724Fd0e3914dE96A5a83aaf4", + lpToken: "0x291d9F9764c72C9BA6fF47b451a9f7885Ebf9977", + }, + { + name: "USDT-USDC PancakeswapV3 Farm", + address: "0xDa3518E5F2972e0Edc1401336b94E257c58eeb18", + farmingTokenAddress: "0x493257fd37edb34451f62edf8d2a0c418852ba4c", + baseTokenAddress: "0x3355df6D4c9C3035724Fd0e3914dE96A5a83aaf4", + lpToken: "0x3832fB996C49792e71018f948f5bDdd987778424", + } + ], + commonCalculator: "0x4Ca7a070b0e62F71C46AB8B2fB4bd21e5B2B9Ac6", + } const vaults = data.vaults; const syncswapWorkers = data.syncSwapWorkers; const vaultBalances = await api.multiCall({ abi: "uint256:vaultBalance", calls: vaults.map((v) => v.address), }); - + const positionLengths = await api.multiCall({ abi: "uint256:positionsLength", calls: vaults.map((v) => v.address), }); vaults.forEach((v, i) => { api.add(v.baseTokenAddress, vaultBalances[i]); }); + // from pancakeSwapV3Worker + const pancakeSwapV3Workers = data.pancakeSwapV3Worker; + const commonCalculator = data.commonCalculator; + const calls = [] + for (const [i, v] of vaults.entries()) { + const positionLength = positionLengths[i]; + const positions = Array.from(Array(Number(positionLength)).keys()); + calls.push({ params: [v.address, positions] }) + } + + const pancakeRes = await api.multiCall({ abi: getAllPositionsByIdsABI, calls, target: commonCalculator }); + + for (const [i, v] of vaults.entries()) { + const positionIngredients = pancakeRes[i] + for (const cur of positionIngredients) { + const poolAddress = cur.worker.toLowerCase(); + const baseAmount = cur.positionIngredients[0]; + const farmAmount = cur.positionIngredients[1]; + const pancakeSwapV3Worker = pancakeSwapV3Workers.find((v) => v.address.toLowerCase() === poolAddress); + if (!pancakeSwapV3Worker) { + continue; + } + api.add(pancakeSwapV3Worker.baseTokenAddress, baseAmount); + api.add(pancakeSwapV3Worker.farmingTokenAddress, farmAmount); + } + } + const [ syncswapWorkerBalances, syncswapReserves, From d9679c655db227569bdf1a556af943e26439f0aa Mon Sep 17 00:00:00 2001 From: suipearl <148339852+suipearl@users.noreply.github.com> Date: Fri, 27 Oct 2023 21:38:42 +0700 Subject: [PATCH 1739/1974] Feat: Update TVL for offshore feature (#7860) --- projects/sui-pearl/index.js | 87 ++++++++++++++++++++++++++++++++----- 1 file changed, 76 insertions(+), 11 deletions(-) diff --git a/projects/sui-pearl/index.js b/projects/sui-pearl/index.js index 3208368cb64..dce7df8b6e2 100644 --- a/projects/sui-pearl/index.js +++ b/projects/sui-pearl/index.js @@ -1,5 +1,4 @@ const { default: BigNumber } = require("bignumber.js"); -const flowxFinance = require("../flowx-finance"); const sui = require("../helper/chain/sui"); async function suiTVL() { @@ -56,11 +55,7 @@ async function suiTVL() { suiPearlLpType.staked ); for (const property in result) { - if (totalResult[property]) { - totalResult[property] = totalResult[property].plus(result[property]); - } else { - totalResult[property] = result[property]; - } + setPropertyPriceMap(totalResult, property, result[property]); } } else if ( suiPearlLpType.type.includes( @@ -74,15 +69,50 @@ async function suiTVL() { ); for (const property in result) { - if (totalResult[property]) { - totalResult[property] = totalResult[property].plus(result[property]); - } else { - totalResult[property] = result[property]; - } + setPropertyPriceMap(totalResult, property, result[property]); } } } + //get faas flowx lock + const strategyDynamicFields = await sui.getDynamicFieldObjects({ + parent: + "0x25e1b7b9fc1b72d4911516574e720bea5920bed2973df5eabdb4af0af8d09c8e", + }); + + const lpMapSupply = {}; + for (const strategy of strategyDynamicFields) { + const lpDataType = strategy.fields.value.type + .split("<")[1] + .split(",") + .slice(0, 2); + lpMapSupply[lpDataType.join(",")] = + strategy.fields.value.fields.vault.fields.position.fields.amount; + } + + for (const flowxFaaSType in lpMapSupply) { + let result = flowxFaaSTVL( + listPoolFlowX, + flowxFaaSType, + lpMapSupply[flowxFaaSType] + ); + for (const property in result) { + setPropertyPriceMap(totalResult, property, result[property]); + } + } + + //get scallop lock + + let scallopPool = await sui.getObject( + "0xfe07bedaf312f86ed1fd38ca9eef213c6bb1236282bd2c7c72720231b0a676ca" + ); + + setPropertyPriceMap( + totalResult, + "0x2::sui::SUI", + new BigNumber(scallopPool.fields.total_tvl) + ); + for (const property in totalResult) { api.add(property, totalResult[property].toFixed(0)); } @@ -150,6 +180,41 @@ const flowxTVL = (listPoolFlowX, suiPearlLpType, staked) => { return coinMap; }; +const flowxFaaSTVL = (listPoolFlowX, flowFaaSType, staked) => { + const flowxPoolInfo = listPoolFlowX.find((item) => + item.lp_supply.type.includes(flowFaaSType) + ); + + const lpRate = new BigNumber(staked).div( + flowxPoolInfo.lp_supply.fields.value + ); + const amountX = lpRate.multipliedBy(flowxPoolInfo.reserve_x.fields.balance); + + const amountY = lpRate.multipliedBy(flowxPoolInfo.reserve_y.fields.balance); + + const coinX = flowxPoolInfo.reserve_x.type + .replace("0x2::coin::Coin<", "") + .replace(">", ""); + + const coinY = flowxPoolInfo.reserve_y.type + .replace("0x2::coin::Coin<", "") + .replace(">", ""); + + const coinMap = {}; + coinMap[coinX] = amountX; + coinMap[coinY] = amountY; + + return coinMap; +}; + +const setPropertyPriceMap = (totalResult, property, value) => { + if (totalResult[property]) { + totalResult[property] = totalResult[property].plus(value); + } else { + totalResult[property] = value; + } +}; + module.exports = { sui: { tvl: suiTVL, From 424f62f0c5aea022585569794e0c4f9e96d0a2e0 Mon Sep 17 00:00:00 2001 From: anna-pelith <132339610+anna-pelith@users.noreply.github.com> Date: Fri, 27 Oct 2023 22:39:52 +0800 Subject: [PATCH 1740/1974] add dyson (#7856) * add dyson * code refactor --------- Co-authored-by: llama --- projects/dyson/index.js | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 projects/dyson/index.js diff --git a/projects/dyson/index.js b/projects/dyson/index.js new file mode 100644 index 00000000000..a7c7fe08640 --- /dev/null +++ b/projects/dyson/index.js @@ -0,0 +1,3 @@ +const { uniTvlExport } = require('../helper/unknownTokens') + +module.exports = uniTvlExport('linea', '0xecD30C099c222AbffDaf3E2A3d2455FC8e8c739E', { fetchBalances: true, }) From 557603bd490a3aca55af58d78aeecc5253285d4a Mon Sep 17 00:00:00 2001 From: layerbank <135123153+layerbank@users.noreply.github.com> Date: Fri, 27 Oct 2023 23:47:11 +0900 Subject: [PATCH 1741/1974] Update LayerBank adapter (#7857) * Update LayerBank * code refactor --------- Co-authored-by: llama --- projects/lineabank/index.js | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/projects/lineabank/index.js b/projects/lineabank/index.js index 9958d91cc99..8d3421766c4 100644 --- a/projects/lineabank/index.js +++ b/projects/lineabank/index.js @@ -1,20 +1,16 @@ const { compoundExports2 } = require("../helper/compound"); +const config = { + linea: '0x009a0b7C38B542208936F1179151CD08E2943833', + scroll: '0xEC53c830f4444a8A56455c6836b5D2aA794289Aa', + manta: '0xB7A23Fc0b066051dE58B922dC1a08f33DF748bbf', +} -module.exports = { - linea: compoundExports2({ - comptroller: "0x009a0b7C38B542208936F1179151CD08E2943833", - fetchBalances: true, - abis: { +Object.keys(config).forEach(chain => { + const comptroller = config[chain] + module.exports[chain] = compoundExports2({ + comptroller, fetchBalances: true, abis: { getAllMarkets: "address[]:allMarkets", totalBorrows: "uint256:totalBorrow", }, - }), - scroll: compoundExports2({ - comptroller: "0xEC53c830f4444a8A56455c6836b5D2aA794289Aa", - fetchBalances: true, - abis: { - getAllMarkets: "address[]:allMarkets", - totalBorrows: "uint256:totalBorrow", - }, - }), -}; + }) +}) \ No newline at end of file From ce6d4043a32f7a0781d95bb307b4a52d5aedd5b4 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Fri, 27 Oct 2023 23:22:06 +0100 Subject: [PATCH 1742/1974] add new contract address --- projects/jamfrens/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/jamfrens/index.js b/projects/jamfrens/index.js index 9b14fcb6bd8..be6a91530cc 100644 --- a/projects/jamfrens/index.js +++ b/projects/jamfrens/index.js @@ -2,9 +2,10 @@ const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') const contract = "0x3dbea36ced3cd155605b725faf7e3f66dc5d6b2b" const contract2 = "0xda78c03A7e4C44e570FDB7c6046D3e6387d5fDDC" +const contract3 = "0xF06B6dF2e5aabE6E53Cf496E7063bECbbFb50ABf" async function tvl(time, ethBlock, _b, {api}) { - return sumTokens2({ tokens: [nullAddress], owners: [contract, contract2,], api }) + return sumTokens2({ tokens: [nullAddress], owners: [contract, contract2, contract3], api }) } module.exports = { From d20f5f741f02124bcc895c276cd9e1d7db8b7eb7 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Sat, 28 Oct 2023 03:47:47 +0100 Subject: [PATCH 1743/1974] add tokenfi --- projects/tokenfi/index.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 projects/tokenfi/index.js diff --git a/projects/tokenfi/index.js b/projects/tokenfi/index.js new file mode 100644 index 00000000000..107748c46db --- /dev/null +++ b/projects/tokenfi/index.js @@ -0,0 +1,23 @@ +const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') + +const contract = "0xb8D2471E35eE033Db509e0456c8eFc4135f4EE43" +const flokiToken = "0xfb5B838b6cfEEdC2873aB27866079AC55363D37E" +const ethFlokiToken = "0xcf0C122c6b73ff809C693DB761e7BaeBe62b6a2E" + +async function ethtvl(time, ethBlock, _b, {api}) { + return sumTokens2({ tokens: [ethFlokiToken], owner: contract, api }) +} + +async function bsctvl(time, ethBlock, _b, {api}) { + return sumTokens2({ tokens: [flokiToken], owner: contract, api }) + } + +module.exports = { + methodology: `We count the ETH on ${contract}`, + ethereum: { + tvl: ethtvl + }, + bsc: { + tvl: bsctvl + } +} \ No newline at end of file From 1973c9e26c28a92a97ebf922405abe07db4e5190 Mon Sep 17 00:00:00 2001 From: Patrick Aljord Date: Sat, 28 Oct 2023 06:24:20 +0200 Subject: [PATCH 1744/1974] add mevETH (#7865) * add mevETH * code refactor --------- Co-authored-by: llama --- projects/meveth/index.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 projects/meveth/index.js diff --git a/projects/meveth/index.js b/projects/meveth/index.js new file mode 100644 index 00000000000..d5ba62d99d1 --- /dev/null +++ b/projects/meveth/index.js @@ -0,0 +1,18 @@ +const ADDRESSES = require("../helper/coreAssets.json"); + +const getFraction = "function fraction() view returns (uint128 base, uint128 elastic)"; + +async function tvl(_, _b, _cb, { api, }) { + const { elastic } = await api.call({ abi: getFraction, target: '0x24ae2da0f361aa4be46b48eb19c91e02c5e4f27e' }) + api.add(ADDRESSES.null, elastic) + return api.getBalances() +} + +module.exports = { + methodology: + "Staked tokens are counted as TVL based on the chain that they are staked on and where the liquidity tokens are issued", + doublecounted: true, + ethereum: { + tvl, + }, +}; From 1ecb95a175dd4e92202945cf682ff6fe36504616 Mon Sep 17 00:00:00 2001 From: llama Date: Sat, 28 Oct 2023 12:25:42 +0200 Subject: [PATCH 1745/1974] hydradx: track stablepool --- projects/hydradx/api.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/projects/hydradx/api.js b/projects/hydradx/api.js index c1b629e9c05..2852212bc1f 100644 --- a/projects/hydradx/api.js +++ b/projects/hydradx/api.js @@ -2,6 +2,7 @@ const { ApiPromise, WsProvider } = require("@polkadot/api"); const sdk = require('@defillama/sdk') const omnipoolAccountId = "7L53bUTBbfuj14UpdCNPwmgzzHSsrsTWBHX5pys32mVWM3C1" +const stablepoolAccountId = "7JP6TvcH5x31TsbC6qVJHEhsW7UNmpREMZuLBpK2bG1goJRS" async function tvl() { const { api: _api } = arguments[3] @@ -34,8 +35,9 @@ async function tvl() { for (const { decimals, assetId, symbol } of assetMetadata) { const cgId = cgMapping[symbol] if (cgId) { - const bal = await api.query.tokens.accounts(omnipoolAccountId, assetId) + const [bal, bal2] = await Promise.all([omnipoolAccountId, stablepoolAccountId].map(accountId => api.query.tokens.accounts(accountId, assetId))) add(cgId, bal.free / (10 ** decimals)) + add(cgId, bal2.free / (10 ** decimals)) } else { sdk.log(`No mapping for ${symbol}, skipping it`) } From 5f20568abe7516eaf4e12640ce73236dd5e12247 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Sat, 28 Oct 2023 17:40:57 +0100 Subject: [PATCH 1746/1974] update to tvl to staking --- projects/tokenfi/index.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/projects/tokenfi/index.js b/projects/tokenfi/index.js index 107748c46db..2c4c38b3f71 100644 --- a/projects/tokenfi/index.js +++ b/projects/tokenfi/index.js @@ -13,11 +13,13 @@ async function bsctvl(time, ethBlock, _b, {api}) { } module.exports = { - methodology: `We count the ETH on ${contract}`, + methodology: `We count the FLOKI on ${contract}`, ethereum: { - tvl: ethtvl + tvl: ()=>({}) , + staking: ethtvl }, bsc: { - tvl: bsctvl + tvl: ()=>({}) , + staking: bsctvl } } \ No newline at end of file From 7b074390482048ec8fdcc36328be56784cf2481c Mon Sep 17 00:00:00 2001 From: mswafer335 <116162389+mswafer335@users.noreply.github.com> Date: Sat, 28 Oct 2023 22:24:14 +0400 Subject: [PATCH 1747/1974] add frensly (#7866) --- projects/frensly/index.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 projects/frensly/index.js diff --git a/projects/frensly/index.js b/projects/frensly/index.js new file mode 100644 index 00000000000..40fce56b5f3 --- /dev/null +++ b/projects/frensly/index.js @@ -0,0 +1,14 @@ +const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') + +const contract = "0x66fA4044757Fb7812EF5b8149649d45d607624E0" + +async function tvl(time, ethBlock, _b, {api}) { + return sumTokens2({ tokens: [nullAddress], owner: contract, api }) +} + +module.exports = { + methodology: `We count the ETH on ${contract}`, + base: { + tvl + } +} \ No newline at end of file From abc5dee2645ef9675a0f6cad28d015f79d1b64da Mon Sep 17 00:00:00 2001 From: Richard Nguyen Date: Sun, 29 Oct 2023 01:34:13 +0700 Subject: [PATCH 1748/1974] update Minswap Staking data (#7869) --- projects/minswap/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/projects/minswap/index.js b/projects/minswap/index.js index 7861b2340b5..bd24af267ed 100644 --- a/projects/minswap/index.js +++ b/projects/minswap/index.js @@ -1,4 +1,4 @@ -const { getAdaInAddress } = require("../helper/chain/cardano"); +const { getAdaInAddress, sumTokensExport } = require("../helper/chain/cardano"); const POOL_SCRIPT_HASH = "script1uychk9f04tqngfhx4qlqdlug5ntzen3uzc62kzj7cyesjk0d9me" const ORDER_SCRIPT_HASH = "script15ew2tzjwn364l2pszu7j5h9w63v2crrnl97m074w9elrkxhah0e" @@ -15,6 +15,10 @@ module.exports = { timetravel: false, cardano: { tvl, + staking: sumTokensExport({ + owner: 'addr1wy3fscaws62d59k6qqhg3xsarx7vstzczgjmdhx2jh7knksj7w3y7', + tokens: ['29d222ce763455e3d7a09a665ce554f00ac89d2e99a1a83d267170c64d494e'] + }) }, hallmarks:[ [1647949370, "Vulnerability Found"], From 16e2dd0e9d0f686075c8b9ec7c42b17513ad64c6 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Sat, 28 Oct 2023 21:52:28 +0100 Subject: [PATCH 1749/1974] update contracts and descriptions --- projects/jamfrens/index.js | 2 +- projects/songtech/index.js | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/projects/jamfrens/index.js b/projects/jamfrens/index.js index be6a91530cc..fb9cb490893 100644 --- a/projects/jamfrens/index.js +++ b/projects/jamfrens/index.js @@ -9,7 +9,7 @@ async function tvl(time, ethBlock, _b, {api}) { } module.exports = { - methodology: `We count the Matic on the ${contract}`, + methodology: `We count the Matic on the ${contract}, ${contract2}, and ${contract3}`, polygon: { tvl } diff --git a/projects/songtech/index.js b/projects/songtech/index.js index d1ebf83eeef..6d3dbe160a6 100644 --- a/projects/songtech/index.js +++ b/projects/songtech/index.js @@ -1,13 +1,14 @@ const { sumTokens2, nullAddress } = require("../helper/unwrapLPs"); const contract = "0xDe67d94C349960cF80625Bfe762aAe9428844763"; +const contract2 = "0x3713c98b942B80178985bBbAA61Fc916B4D4D39A" async function tvl(time, ethBlock, _b, { api }) { - return sumTokens2({ tokens: [nullAddress], owner: contract, api }); + return sumTokens2({ tokens: [nullAddress], owners: [contract,contract2], api }); } module.exports = { - methodology: `We count the ETH on ${contract}`, + methodology: `We count the ETH on ${contract} & ${contract2}`, base: { tvl, }, From 806f2f010bb36d322e788a6d916d49044487093a Mon Sep 17 00:00:00 2001 From: ilyavolo <144221634+ilyavolo@users.noreply.github.com> Date: Sun, 29 Oct 2023 22:10:11 +0400 Subject: [PATCH 1750/1974] TVL for volo.fi (#7873) --- projects/volo-vsui/index.js | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 projects/volo-vsui/index.js diff --git a/projects/volo-vsui/index.js b/projects/volo-vsui/index.js new file mode 100644 index 00000000000..e467f9f4212 --- /dev/null +++ b/projects/volo-vsui/index.js @@ -0,0 +1,30 @@ +const sui = require('../helper/chain/sui') + +async function tvl() { + const nativePoolObj = await sui.getObject('0x7fa2faa111b8c65bea48a23049bfd81ca8f971a262d981dcd9a17c3825cb5baf'); + + const totalStakedValue = +(await sui.getDynamicFieldObject( + nativePoolObj.fields.total_staked.fields.id.id, + nativePoolObj.fields.staked_update_epoch, + { + idType: 'u64' + })).fields.value + +nativePoolObj.fields.pending.fields.balance; + + const totalPendingRewards = +nativePoolObj.fields.total_rewards - nativePoolObj.fields.collected_rewards; + const unstakeTicketsSupply = +nativePoolObj.fields.ticket_metadata.fields.total_supply; + + const totalStakedSui = totalStakedValue + totalPendingRewards - unstakeTicketsSupply; + + return { + sui: totalStakedSui / 1e9, + } +} + +module.exports = { + timetravel: true, + misrepresentedTokens: false, + methodology: "Calculates the amount of SUI staked in Volo liquid staking contracts.", + sui: { + tvl, + } +} From 34f69024f1cb3939a745fdd28b20a4f1bdcc955a Mon Sep 17 00:00:00 2001 From: SharkyDevy <143438656+SharkyDevy@users.noreply.github.com> Date: Sun, 29 Oct 2023 20:44:14 +0100 Subject: [PATCH 1751/1974] Add Spirit Farm on Base Chain --- projects/spiritfarm/index.js | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 projects/spiritfarm/index.js diff --git a/projects/spiritfarm/index.js b/projects/spiritfarm/index.js new file mode 100644 index 00000000000..4a0d5103513 --- /dev/null +++ b/projects/spiritfarm/index.js @@ -0,0 +1,8 @@ +const { masterchefExports } = require("../helper/unknownTokens"); + +module.exports = masterchefExports({ + chain: 'base', + masterchef: '0x26d7700c33e7d73BA0f135Ba901A1796d5474b85', + useDefaultCoreAssets: true, + nativeToken: '0xC7A148Ad554826b5308E100a05Fdb037DDa0bDe4' +}) \ No newline at end of file From 8a9aa0b2422de048ae356846175862f0fa6bae51 Mon Sep 17 00:00:00 2001 From: Define101 Date: Sun, 29 Oct 2023 20:47:15 +0000 Subject: [PATCH 1752/1974] remove 0 tvl broke dyson --- projects/dyson-money/index.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/projects/dyson-money/index.js b/projects/dyson-money/index.js index 69ae31abaf6..6c8151e58ca 100644 --- a/projects/dyson-money/index.js +++ b/projects/dyson-money/index.js @@ -38,7 +38,7 @@ let _response function fetchChain(chainId) { return async () => { - if (!_response) _response = utils.fetchURL('https://api.dyson.money/tvl') + if (!_response) _response = utils.fetchURL('https://api.dyson.money/tvl'); const response = await _response; let tvl = 0; @@ -46,13 +46,12 @@ function fetchChain(chainId) { for (const vault in chain) { tvl += Number(chain[vault]); } - if (tvl === 0) { - throw new Error(`chain ${chainId} tvl is 0`) + return {}; } return toUSDTBalances(tvl); - } + }; } module.exports = { From 69ed0751be731449b66bf96f1ab029be859048df Mon Sep 17 00:00:00 2001 From: yashvik <39464729+waverune@users.noreply.github.com> Date: Mon, 30 Oct 2023 07:49:23 +0530 Subject: [PATCH 1753/1974] timeswap: adds option factory on mantle (#7868) --- projects/timeswap-v2/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/timeswap-v2/index.js b/projects/timeswap-v2/index.js index 9c0a5609661..a00eb29ca79 100644 --- a/projects/timeswap-v2/index.js +++ b/projects/timeswap-v2/index.js @@ -79,6 +79,7 @@ const config = { }, mantle: { factory: "0xf8F5e4B7825d484FBDFDC36fc915E79f30b02f9E", + newFactory: "0x406d3Dfcbe20b642c2262b29b960822975371502", fromBlock: 3563, }, polygon_zkevm: { From d1539fcbe82e29f6bad4d6dded70cabab4602821 Mon Sep 17 00:00:00 2001 From: llama Date: Mon, 30 Oct 2023 03:28:26 +0100 Subject: [PATCH 1754/1974] fix omaxswap --- projects/omaxswap/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/omaxswap/index.js b/projects/omaxswap/index.js index 4a9dfd6f38b..3876b95432c 100644 --- a/projects/omaxswap/index.js +++ b/projects/omaxswap/index.js @@ -1,3 +1,3 @@ const { uniTvlExport } = require('../helper/unknownTokens') -module.exports = uniTvlExport('omax', '0x0e149Ff38Cd5B5c0F1004D08A14C9653485ad5fA') \ No newline at end of file +module.exports = uniTvlExport('omax', '0xEbB321f840c1F1d63a62b01F464D6921bfC3dD08') \ No newline at end of file From 325ef183e8976b208ae4c23f349af94c3be2635a Mon Sep 17 00:00:00 2001 From: llama Date: Mon, 30 Oct 2023 10:23:03 +0100 Subject: [PATCH 1755/1974] fix zyxswap --- projects/helper/env.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/helper/env.js b/projects/helper/env.js index da565cb23d0..88126123fc3 100644 --- a/projects/helper/env.js +++ b/projects/helper/env.js @@ -13,6 +13,7 @@ const DEFAULTS = { CRAB_RPC: 'https://darwiniacrab-rpc.dwellir.com', ANKR_API_KEY: '79258ce7f7ee046decc3b5292a24eb4bf7c910d7e39b691384c7ce0cfb839a01', RENEC_RPC: "https://api-mainnet-beta.renec.foundation:8899/", + ZYX_RPC: "https://rpc-1.zyx.network", EVMOS_RPC: "https://evmos-evm.publicnode.com", NOVA_RPC: "https://connect.novanetwork.io", ETHF_RPC: "https://rpc.etherfair.org", From bd92819cb887d88e91733fe37134520875332e56 Mon Sep 17 00:00:00 2001 From: TouchFan <139216489+TouchFan@users.noreply.github.com> Date: Mon, 30 Oct 2023 18:03:20 +0800 Subject: [PATCH 1756/1974] touch fan tvl (#7881) Co-authored-by: lwaisyj --- projects/touch.fan/index.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 projects/touch.fan/index.js diff --git a/projects/touch.fan/index.js b/projects/touch.fan/index.js new file mode 100644 index 00000000000..709896b3d73 --- /dev/null +++ b/projects/touch.fan/index.js @@ -0,0 +1,16 @@ +const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') + +const fan_contract = "0x9842114F1d9c5286A6b8e23cF0D8142DAb2B3E9b" +const touch_contract = "0xC612eD7a1FC5ED084C967bD71F1e0F0a338Cf816" + +async function tvl(time, ethBlock, _b, { api }) { + return sumTokens2({ tokens: [nullAddress], owners: [fan_contract,touch_contract], api }) + +} + +module.exports = { + methodology: `We count the ETH on ${fan_contract} and ${touch_contract}`, + era: { + tvl + } +} \ No newline at end of file From 2b71d280d5b27daefee87eb8f432f1839a8c58e8 Mon Sep 17 00:00:00 2001 From: Nhan Cao Date: Mon, 30 Oct 2023 17:03:35 +0700 Subject: [PATCH 1757/1974] feat: add sharkswap.finance (#7876) * feat: add sharkswap.finance * minor fix --------- Co-authored-by: llama --- projects/sharkswap-finance/index.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 projects/sharkswap-finance/index.js diff --git a/projects/sharkswap-finance/index.js b/projects/sharkswap-finance/index.js new file mode 100644 index 00000000000..50caca03576 --- /dev/null +++ b/projects/sharkswap-finance/index.js @@ -0,0 +1,12 @@ +const { getUniTVL } = require('../helper/unknownTokens') +const FACTORY = "0x57592D44eb60011500961EF177BFf8D8691D5a8B" + +const dexTVL = getUniTVL({ factory: FACTORY, useDefaultCoreAssets: true, fetchBalances: true }) + +module.exports = { + misrepresentedTokens: true, + methodology: `Uses factory(${FACTORY}) address and whitelisted tokens address to find and price Liquidity Pool pairs.`, + base: { + tvl: dexTVL, + } +}; From 73af299d2b89eea6764852c44c2265415f1bae2a Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 30 Oct 2023 15:36:45 +0530 Subject: [PATCH 1758/1974] Realprep (#7884) --- projects/helper/coreAssets.json | 3 ++- projects/realperp/index.js | 13 +++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 projects/realperp/index.js diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index 82c584acdda..7b3a1df3c72 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -1347,7 +1347,8 @@ "manta": { "WETH": "0x0Dc808adcE2099A9F62AA87D9670745AbA741746", "USDC": "0xb73603c5d87fa094b7314c74ace2e64d165016fb", - "USDT": "0xf417f5a458ec102b90352f697d6e2ac3a3d2851f" + "USDT": "0xf417f5a458ec102b90352f697d6e2ac3a3d2851f", + "WBTC": "0x305E88d809c9DC03179554BFbf85Ac05Ce8F18d6" }, "mantle": { "WMNT": "0x78c1b0c915c4faa5fffa6cabf0219da63d7f4cb8", diff --git a/projects/realperp/index.js b/projects/realperp/index.js new file mode 100644 index 00000000000..e05a410705e --- /dev/null +++ b/projects/realperp/index.js @@ -0,0 +1,13 @@ +const { staking } = require("../helper/staking"); +const { gmxExports } = require("../helper/gmx"); + +const Vault = "0xEA5C751039e38e1d2C0b8983D4F024e3bc928bc4"; +const Staking = "0x10e878aDbCbD35e4356F5272Ae9537814d17A76c"; +const RAP = "0x9576ca6D15E7CcCe184fA7523085d21A554B1b52"; + +module.exports = { + manta: { + staking: staking(Staking, RAP, "manta"), + tvl: gmxExports({ vault: Vault }), + }, +}; From 0ce8db32f26922e0d125dabb1db2c3f8428a29c0 Mon Sep 17 00:00:00 2001 From: rozzaswap Date: Mon, 30 Oct 2023 11:08:00 +0000 Subject: [PATCH 1759/1974] Added adapter for swapsicle v2 liquidity --- projects/swapsicle-v2/index.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 projects/swapsicle-v2/index.js diff --git a/projects/swapsicle-v2/index.js b/projects/swapsicle-v2/index.js new file mode 100644 index 00000000000..2310fdcf851 --- /dev/null +++ b/projects/swapsicle-v2/index.js @@ -0,0 +1,14 @@ +const { uniV3Export } = require("../helper/uniswapV3"); + +module.exports = uniV3Export({ + mantle: { + factory: "0xC848bc597903B4200b9427a3d7F61e3FF0553913", + fromBlock: 9796947, + isAlgebra: true, + }, + telos: { + factory: "0xA09BAbf9A48003ae9b9333966a8Bda94d820D0d9", + fromBlock: 301362984, + isAlgebra: true, + }, +}); From fa21537a45d54f5d8c1ec23e24683bf37e15c153 Mon Sep 17 00:00:00 2001 From: prajwalghate Date: Mon, 30 Oct 2023 18:47:45 +0530 Subject: [PATCH 1760/1974] Tvl of Rivera Money --- projects/rivera_money/index.js | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 projects/rivera_money/index.js diff --git a/projects/rivera_money/index.js b/projects/rivera_money/index.js new file mode 100644 index 00000000000..dd3d124598a --- /dev/null +++ b/projects/rivera_money/index.js @@ -0,0 +1,32 @@ +const { sumERC4626VaultsExport } = require("../helper/erc4626"); + +const vaultsMantle = [ + "0xfa944c1996efBF9FbFF1a378903F4AD82C172D72", + "0x945438ef559EFf400429DFb101e57a6299B5ceE2", + "0xA25d1843eedE1E1D0631b979da605606412e64f7", + "0xAa81F912D09Fd313Bbc1d5638632aB6bf59aB495", + "0x0DB2BA00bCcf4F5e20b950bF954CAdF768D158Aa", + "0x713C1300f82009162cC908dC9D82304A51F05A3E", + "0xDc63179CC57783493DD8a4Ffd7367DF489Ae93BF", + "0x5f247B216E46fD86A09dfAB377d9DBe62E9dECDA", +]; + +const vaultsManta = [ + "0x713C1300f82009162cC908dC9D82304A51F05A3E", + "0x0DB2BA00bCcf4F5e20b950bF954CAdF768D158Aa", + "0xDc63179CC57783493DD8a4Ffd7367DF489Ae93BF", + "0x5f247B216E46fD86A09dfAB377d9DBe62E9dECDA", +]; + +module.exports = { + mantle: { + tvl: sumERC4626VaultsExport({ + vaults: vaultsMantle, + }), + }, + manta: { + tvl: sumERC4626VaultsExport({ + vaults: vaultsManta, + }), + }, +}; From 189428929ef833e572b177b0c28d94703466e8a2 Mon Sep 17 00:00:00 2001 From: Define101 Date: Mon, 30 Oct 2023 13:27:17 +0000 Subject: [PATCH 1761/1974] add MNT to owntokens treasury mantledao --- projects/treasury/bitdao.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/treasury/bitdao.js b/projects/treasury/bitdao.js index 6577112ff5a..11fa85c1c2f 100644 --- a/projects/treasury/bitdao.js +++ b/projects/treasury/bitdao.js @@ -4,6 +4,7 @@ const { nullAddress,treasuryExports } = require("../helper/treasury"); const bitdaoTreasury1 = "0x78605Df79524164911C144801f41e9811B7DB73D"; const BIT = "0x1A4b46696b2bB4794Eb3D4c26f1c55F9170fa4C5"; +const MNT = "0x3c3a81e81dc49a522a592e7622a7e711c06bf354" const LP = "0xC36442b4a4522E871399CD717aBDD847Ab11FE88" @@ -21,7 +22,7 @@ module.exports = treasuryExports({ "0x52A8845DF664D76C69d2EEa607CD793565aF42B8", ], owners: [bitdaoTreasury1], - ownTokens: [BIT, LP], + ownTokens: [BIT, LP, MNT], resolveLP: true, resolveUniV3: true, }, From f4ea9b74e5d1bf04f5083c94974212eff6a045d8 Mon Sep 17 00:00:00 2001 From: Define101 Date: Mon, 30 Oct 2023 13:34:25 +0000 Subject: [PATCH 1762/1974] add double count to rivera --- projects/rivera_money/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/rivera_money/index.js b/projects/rivera_money/index.js index dd3d124598a..97cbf8d9f38 100644 --- a/projects/rivera_money/index.js +++ b/projects/rivera_money/index.js @@ -19,6 +19,7 @@ const vaultsManta = [ ]; module.exports = { + doublecounted: true, mantle: { tvl: sumERC4626VaultsExport({ vaults: vaultsMantle, From 0a5991b3acacb13e3e3191b2a8f705c7df03773b Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Mon, 30 Oct 2023 18:10:12 +0000 Subject: [PATCH 1763/1974] add reserves to benqi treasury --- projects/treasury/benqi.js | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/projects/treasury/benqi.js b/projects/treasury/benqi.js index f8100ae64a7..3790ddc33fa 100644 --- a/projects/treasury/benqi.js +++ b/projects/treasury/benqi.js @@ -1,13 +1,30 @@ -const { nullAddress, treasuryExports } = require("../helper/treasury"); +const { getCompoundV2Tvl } = require("../helper/compound"); +const { stakings } = require("../helper/staking"); +const { sumTokens } = require("../helper/sumTokens"); +const { nullAddress } = require("../helper/treasury"); const treasury = "0x142eB2ed775e6d497aa8D03A2151D016bbfE7Fc2"; const treasury2 = "0x9d6ef2445fcc41b0d08865f0a7839490cc58a7b7"; +const owners = [treasury, treasury2] const qi = "0x8729438EB15e2C8B576fCc6AeCdA6A148776C0F5"; -module.exports = treasuryExports({ - avax: { - tokens: [nullAddress], - owners: [treasury, treasury2], - ownTokens: [qi], - }, -}); +async function tvl(_timestamp, _block, chainBlocks, { api }){ + const balances = await getCompoundV2Tvl("0x486af39519b4dc9a7fccd318217352830e8ad9b4", "avax", undefined, undefined, undefined, false, undefined, { + abis:{ + getCash: {"constant":true,"inputs":[],"name":"totalReserves","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"} + } + })() + return sumTokens({ + balances, + api, + owners, + tokens: [nullAddress] + }) +} + +module.exports = { + avax:{ + ownTokens: stakings(owners, qi, "avax"), + tvl + } +} From c3da47b6735880108771d11de319abb1f6a82cf1 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Mon, 30 Oct 2023 21:17:08 +0000 Subject: [PATCH 1764/1974] hashnote on eth --- projects/hashnote/index.js | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/projects/hashnote/index.js b/projects/hashnote/index.js index 920d0be4d60..8dc78be9aec 100644 --- a/projects/hashnote/index.js +++ b/projects/hashnote/index.js @@ -1,12 +1,28 @@ + + +const contracts = { + canto:{ + token: '0xfb8255f0de21acebf490f1df6f0bdd48cc1df03b', + oracle: '0x1d18c02bc80b1921255e71cf2939c03258d75470' + }, + ethereum:{ + token: '0x136471a34f6ef19fE571EFFC1CA711fdb8E49f2b', + oracle: '0x4c48bcb2160F8e0aDbf9D4F3B034f1e36d1f8b3e' + } +} + +const tvl = async (_, _1, _2, { api }) => { + const totalSupply = await api.call({ target: contracts[api.chain].token, abi: 'uint256:totalSupply'}); + const rate = await api.call({ target: contracts[api.chain].oracle, abi: 'function latestRoundData() external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound)'}); + + return { + "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48": (totalSupply * rate.answer)/1e8 + }; +} + module.exports = { canto: { - tvl: async (_, _1, _2, { api }) => { - const totalSupply = await api.call({ target: '0xfb8255f0de21acebf490f1df6f0bdd48cc1df03b', abi: 'uint256:totalSupply'}); - const rate = await api.call({ target: '0x1d18c02bc80b1921255e71cf2939c03258d75470', abi: 'function latestRoundData() external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound)'}); - - return { - "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48": (totalSupply * rate.answer)/1e8 - }; - } - } + tvl + }, + ethereum:{tvl} }; From d7ffec4d8bb94377e0efdd735ab410b5a8334d01 Mon Sep 17 00:00:00 2001 From: Strategic Reserve Date: Mon, 30 Oct 2023 16:12:23 -0700 Subject: [PATCH 1765/1974] Update Manta / PCS --- projects/visor/config.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/projects/visor/config.js b/projects/visor/config.js index 5dd72b99207..16f166230c8 100644 --- a/projects/visor/config.js +++ b/projects/visor/config.js @@ -36,6 +36,7 @@ const HYPE_REGISTRY = { ], arbitrum: [ ["0x66CD859053c458688044d816117D5Bdf42A56813", 10617223], // Uniswap + ["0x166cD995F9301590e381c488FFD4f18C3ca38A27", 144400180], // Pancakeswap ["0x0f867F14b39a5892A39841a03bA573426DE4b1d0", 102240553], // Sushiswap ["0x37595FCaF29E4fBAc0f7C1863E3dF2Fe6e2247e9", 63562888], // Zyberswap ["0x34Ffbd9Db6B9bD8b095A0d156de69a2AD2944666", 99952729], // Ramses @@ -81,6 +82,9 @@ const HYPE_REGISTRY = { op_bnb: [ ["0x683292172E2175bd08e3927a5e72FC301b161300", 5150910], // Pancakeswap ], + manta: [ + ["0x683292172E2175bd08e3927a5e72FC301b161300", 394949], // Apertureswap + ], }; Object.keys(HYPE_REGISTRY).forEach(chain => { From 6f9ab850e71e3e208a52d9312a471c0df45a5d59 Mon Sep 17 00:00:00 2001 From: tony Date: Tue, 31 Oct 2023 15:48:54 +0800 Subject: [PATCH 1766/1974] add mante chain (#7877) * add mante chain * code refactor * add manta chain and fixed bug --------- Co-authored-by: llama --- projects/openocean.js | 51 +++++++++++++++---------------------------- 1 file changed, 17 insertions(+), 34 deletions(-) diff --git a/projects/openocean.js b/projects/openocean.js index 6a497757672..7232c740744 100644 --- a/projects/openocean.js +++ b/projects/openocean.js @@ -1,38 +1,21 @@ const { getUniTVL } = require('./helper/unknownTokens') const { staking } = require('./helper/staking') -module.exports = { - bsc: { - tvl: getUniTVL({ - factory: '0xd76d8c2a7ca0a1609aea0b9b5017b3f7782891bf', - useDefaultCoreAssets: true, - }), - staking: staking('0x44eB0f1ce777394564070f9E50dD8784FCDB7e6a', '0x9029fdfae9a03135846381c7ce16595c3554e10a') - }, - ethereum: { - tvl: getUniTVL({ - factory: '0x1f8c25f8da3990ecd3632ee4f02c2ea37755c3c6', - useDefaultCoreAssets: true, - }), - staking: staking('0xb99d38eb69214e493b1183ffa3d561fc9f75d519', '0x7778360f035c589fce2f4ea5786cbd8b36e5396b',) - }, - avax: { - tvl: getUniTVL({ - factory: '0x042AF448582d0a3cE3CFa5b65c2675e88610B18d', - useDefaultCoreAssets: true, - }), - staking: staking('0x4C431b568e8baAB20F004BB16E44570e8E0cD6D7', '0x0ebd9537a25f56713e34c45b38f421a1e7191469') - }, - polygon: { - tvl: getUniTVL({ - factory: '0xd76d8C2A7CA0a1609Aea0b9b5017B3F7782891bf', - useDefaultCoreAssets: true, - }), - }, - kava: { - tvl: getUniTVL({ - factory: '0x6dd434082EAB5Cd134B33719ec1FF05fE985B97b', - useDefaultCoreAssets: true, - }) - } +const config = { + bsc: { factory: '0xd76d8c2a7ca0a1609aea0b9b5017b3f7782891bf', s: ['0x44eB0f1ce777394564070f9E50dD8784FCDB7e6a', '0x9029fdfae9a03135846381c7ce16595c3554e10a'], }, + polygon: { factory: '0xd76d8C2A7CA0a1609Aea0b9b5017B3F7782891bf', }, + kava: { factory: '0x6dd434082EAB5Cd134B33719ec1FF05fE985B97b', }, + arbitrum: { factory: '0x01Ec93c289cB003e741f621cDD4FE837243f8905', }, + manta: { factory: '0x8D2B7e5501Eb6D92F8e349f2FEbe785DD070bE74', }, + avax: { factory: '0x042AF448582d0a3cE3CFa5b65c2675e88610B18d', s: ['0x4C431b568e8baAB20F004BB16E44570e8E0cD6D7', '0x0ebd9537a25f56713e34c45b38f421a1e7191469'], }, + ethereum: { factory: '0x1f8c25f8da3990ecd3632ee4f02c2ea37755c3c6', s: ['0xb99d38eb69214e493b1183ffa3d561fc9f75d519', '0x7778360f035c589fce2f4ea5786cbd8b36e5396b'], }, } + +module.exports = { misrepresentedTokens: true } + +Object.keys(config).forEach(chain => { + const { factory, s } = config[chain] + module.exports[chain] = { tvl: getUniTVL({ factory, useDefaultCoreAssets: true, }), } + if (s) + module.exports[chain].staking = staking(...s) +}) From 9bc04e391f4dd32f5b70cbcfb29111deee80e443 Mon Sep 17 00:00:00 2001 From: Potluck Protocol <89051993+PotluckProtocol@users.noreply.github.com> Date: Tue, 31 Oct 2023 03:56:43 -0400 Subject: [PATCH 1767/1974] Add Accumulator TVL (#7867) * Add Accumulator TVL * fix chain name * code refactor --------- Co-authored-by: llama --- projects/accumulator/index.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 projects/accumulator/index.js diff --git a/projects/accumulator/index.js b/projects/accumulator/index.js new file mode 100644 index 00000000000..8d352398bdc --- /dev/null +++ b/projects/accumulator/index.js @@ -0,0 +1,24 @@ +const { getConfig } = require('../helper/cache') +const { sumUnknownTokens } = require('../helper/unknownTokens') + +const config = { + shimmer_evm: 'shimmer' +} + +module.exports = { + misrepresentedTokens: true, +}; + +Object.keys(config).forEach(chain => { + const chainKey = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const data = await getConfig('potluck-protocol', 'https://newapi.potluckprotocol.com/vaults') + const vaults = data.filter(i => i.chain === chainKey).map(i => i.earnedTokenAddress) + const tokens = await api.multiCall({ calls: vaults, abi: 'address:want'}) + const bals = await api.multiCall({ calls: vaults, abi: 'uint256:balance'}) + api.addTokens(tokens, bals) + return sumUnknownTokens({ api, resolveLP: true, useDefaultCoreAssets: true, lps: tokens, }) + } + } +}) \ No newline at end of file From ef6ce494e37e2d401c7604453935b7467c98e382 Mon Sep 17 00:00:00 2001 From: Jay <81908549+mj-dcb@users.noreply.github.com> Date: Tue, 31 Oct 2023 09:08:03 +0100 Subject: [PATCH 1768/1974] added AITECHs adapter (#7885) * added AITECHs adapter * fixed staking position * added chain * followed the adapter pattern * updated code * used staking as tvl * code refactor --------- Co-authored-by: Jay Maree Co-authored-by: llama --- projects/aitech/index.js | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 projects/aitech/index.js diff --git a/projects/aitech/index.js b/projects/aitech/index.js new file mode 100644 index 00000000000..100ae1b9cd5 --- /dev/null +++ b/projects/aitech/index.js @@ -0,0 +1,11 @@ +const { staking } = require('../helper/staking') + +const aitechStakingContract = '0x2C4dD7db5Ce6A9A2FB362F64fF189AF772C31184'; +const aitechTokenContract = '0x2D060Ef4d6BF7f9e5edDe373Ab735513c0e4F944'; + +module.exports = { + bsc: { + tvl: () => ({}), + staking: staking(aitechStakingContract, aitechTokenContract,) + }, +} From bcae31c9ca1959fffef7517a463b813e01c2b9c7 Mon Sep 17 00:00:00 2001 From: SpookyBase <149433879+SpookyBase@users.noreply.github.com> Date: Tue, 31 Oct 2023 09:12:24 +0100 Subject: [PATCH 1769/1974] Add SpookyBase (#7894) * Add SpookyBase * minor fix --------- Co-authored-by: llama --- projects/spookybase/index.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 projects/spookybase/index.js diff --git a/projects/spookybase/index.js b/projects/spookybase/index.js new file mode 100644 index 00000000000..ce271c4a36f --- /dev/null +++ b/projects/spookybase/index.js @@ -0,0 +1,21 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { getUniTVL, staking } = require('../helper/unknownTokens') +const sdk = require('@defillama/sdk') +const uniTvl = getUniTVL({ factory: '0x9EB4C1e84A4ccCbe154B485b9314EF0F9B5b78f8', useDefaultCoreAssets: true, fetchBalances: true }) +const masterchef = '0x895678a139605AE183Fc753888EcfEb6896267Aa' +const spooky = '0xd63EBbE933f422Bf8BC6F909FA27E467b537ca81' +const weth = ADDRESSES.base.WETH + +module.exports = { + misrepresentedTokens: true, + base: { + tvl: sdk.util.sumChainTvls([uniTvl, staking({ + owners: [masterchef], + tokens: [weth], + })]), + staking: staking({ + owners: [masterchef], + tokens: [spooky], + }) + } +}; \ No newline at end of file From 23694390194ba9c166249db1e90c087a1a22d399 Mon Sep 17 00:00:00 2001 From: Samster91 <37342443+samster91@users.noreply.github.com> Date: Tue, 31 Oct 2023 09:15:32 +0100 Subject: [PATCH 1770/1974] NEW: optimism & zkEVM for Idle (#7895) Co-authored-by: Samster91 --- projects/idle/index.js | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/projects/idle/index.js b/projects/idle/index.js index 4f336a5c540..02cb817707f 100644 --- a/projects/idle/index.js +++ b/projects/idle/index.js @@ -37,6 +37,9 @@ const contracts = { cdos: [ "0xF87ec7e1Ee467d7d78862089B92dd40497cBa5B8", // MATIC "0xDcE26B2c78609b983cF91cCcD43E238353653b0E", // IdleCDO_clearpool_DAI + // "0xd0DbcD556cA22d3f3c142e9a3220053FD7a247BC", + // "0x1f5A97fB665e295303D2F7215bA2160cc5313c8E", // + "0x8E0A8A5c1e5B3ac0670Ea5a613bB15724D51Fc37" // Instadapp stETH ] }, polygon: { @@ -45,16 +48,40 @@ const contracts = { "0x1ee6470CD75D5686d0b2b90C0305Fa46fb0C89A1", // idleUSDCYield "0xfdA25D931258Df948ffecb66b5518299Df6527C4" // idleWETHYield ] + }, + polygon_zkevm: { + cdos: [ + "0x6b8A1e78Ac707F9b0b5eB4f34B02D9af84D2b689" // IdleCDO_clearpool_portofino_USDT + ] + }, + optimism: { + } } +const underlyingMapping = { + '0x94b008aA00579c1307B0EF2c499aD98a8ce58e58': '0xdac17f958d2ee523a2206206994597c13d831ec7', // USDT Optimism + '0x7F5c764cBc14f9669B88837ca1490cCa17c31607': '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', // USDC Optimism + '0x1E4a5963aBFD975d8c9021ce480b42188849D41d': '0xdac17f958d2ee523a2206206994597c13d831ec7', // USDT zkEVM + '0xA8CE8aee21bC2A48a5EF670afCc9274C7bbbC035': '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48' // USDC zkEVM +} + const trancheConfig = { ethereum: { factory: '0x3c9916bb9498f637e2fa86c2028e26275dc9a631', fromBlock: 13244388, }, + polygon_zkevm: { + factory: '0xba43DE746840eD16eE53D26af0675d8E6c24FE38', + fromBlock: 2812767, + }, + optimism: { + factory: '0x8aA1379e46A8C1e9B7BB2160254813316b5F35B8', + fromBlock: 110449062, + } } const getCurrentAllocationsABI = 'function getCurrentAllocations() returns (address[] tokenAddresses, uint256[] amounts, uint256 total)' + async function tvl(time, ethBlock, chainBlocks, { api }) { const { v1 = [], v3 = [], safe = [], cdos = [] } = contracts[api.chain] const balances = {} @@ -117,8 +144,10 @@ async function tvl(time, ethBlock, chainBlocks, { api }) { decimals: tokenDecimals, price: BigNumber(bbprices[i]).div(`1e${tokenDecimals}`).toFixed() } + // Get CDOs underlying tokens balances - balances[token[i]] = BigNumber(balances[token[i]] || 0).plus(BigNumber(contractValue[i] || 0)) + const mappedToken = underlyingMapping[token[i]] || token[i] + balances[mappedToken] = BigNumber(balances[mappedToken] || 0).plus(BigNumber(contractValue[i] || 0)) }) } From 53c46dd5e6d6bfce89211ae3fe4c8f4098363adc Mon Sep 17 00:00:00 2001 From: tstemko <57684389+tstemko@users.noreply.github.com> Date: Tue, 31 Oct 2023 04:17:21 -0400 Subject: [PATCH 1771/1974] New factory for bsc chain (#7896) * Change Ramses factory * Change factory for BSC chain * Version 3 for Ramses vaults factory --------- Co-authored-by: Tatyana Stemkovski --- projects/ichifarm/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/ichifarm/index.js b/projects/ichifarm/index.js index 0df842897f7..fb0f4e719cd 100644 --- a/projects/ichifarm/index.js +++ b/projects/ichifarm/index.js @@ -38,12 +38,12 @@ const config = { arbitrum: { vaultConfigs: [ { factory: '0xfBf38920cCbCFF7268Ad714ae5F9Fad6dF607065', fromBlock: 102858581, }, - { factory: '0x7984d3ad2DE4Dd54D1FD6b4D89112eBF7c0DF151', fromBlock: 137087766, }, // Ramses + { factory: '0xedAc86bc526557c422AB1F6BF848bF0da9fB44A6', fromBlock: 137087766, }, // Ramses ], }, bsc: { vaultConfigs: [ - { factory: '0xbBB97d634460DACCA0d41E249510Bb741ef46ad3', fromBlock: 29702590, }, + { factory: '0x131c03ca881B7cC66d7a5120A9273ebf675C241D', fromBlock: 29702590, }, ], }, polygon: { From fdd808d2a364b03cf1109f6c353a9a11db8a42c0 Mon Sep 17 00:00:00 2001 From: Kirill Madorin Date: Tue, 31 Oct 2023 09:21:15 +0100 Subject: [PATCH 1772/1974] CollectifDAO: methodology updated, liquid FIL collateral from miners was included into TVL (#7899) * add CollectifDAO * CollectifDAO: methodology updated, liquid FIL collateral from miners was included into TVL * lint errors fixed, try catch block added for data fetching --- projects/CollectifDAO/index.js | 44 +++++++++++++++++++++++++++++----- 1 file changed, 38 insertions(+), 6 deletions(-) diff --git a/projects/CollectifDAO/index.js b/projects/CollectifDAO/index.js index c54761837ef..034da8c76ac 100644 --- a/projects/CollectifDAO/index.js +++ b/projects/CollectifDAO/index.js @@ -1,16 +1,48 @@ -const { nullAddress } = require("../helper/tokenMapping"); +const {BigNumber} = require("@ethersproject/bignumber"); +const {nullAddress} = require("../helper/tokenMapping"); +const {get} = require("../helper/http"); const COLLECTIF_LIQUID_STAKING_POOL_CONTRACT = "0xd0437765D1Dc0e2fA14E97d290F135eFdf1a8a9A"; // pool address +const COLLECTIF_SPS_COLLATERAL_CONTRACT = "0x3D52874772C66466c93E36cc3782946fd0FA7666"; + const totalAssetsABI = "function totalAssets() public view returns (uint256)"; +const getCollateralABI = "function getCollateral(uint64 _ownerId) public view returns (uint256, uint256)"; + +const getMinersOwners = async () => { + try { + const data = await get('https://app.collectif.finance/data/owners.json'); + return data.owners; + } catch (e) { + return []; + } +} + module.exports = { methodology: - "Collectif DAO is a non-custodial liquid staking protocol on Filecoin. It allows users stake FIL tokens to the pool and get back clFIL token, which is a native yield bearing liquid staking asset on Filecoin. This TVL calculation returns total amount of assets backing clFIL, that includes buffered capital in the pool and pledged capital to the Filecoin Storage Providers (miners)", + "Collectif DAO is a non-custodial liquid staking protocol on Filecoin. It allows users stake FIL tokens to the pool and get back clFIL token, which is a native yield bearing liquid staking asset on Filecoin. This TVL calculation returns total amount of assets backing clFIL, that includes buffered capital in the pool, pledged capital to the Filecoin Storage Providers (miners) and liquid FIL collateral provided by Storage Providers to cover potential slashing risks", filecoin: { - tvl: async (_, _1, _2, { api }) => { - const totalAssets = await api.call({ abi: totalAssetsABI, target: COLLECTIF_LIQUID_STAKING_POOL_CONTRACT }); - - const tvl = totalAssets.toString(); + tvl: async (_, _1, _2, {api}) => { + const fetchCollateral = async (owner) => api.call({ + abi: getCollateralABI, + target: COLLECTIF_SPS_COLLATERAL_CONTRACT, + params: [owner.slice(2)] + }); + + const minersOwners = await getMinersOwners(); + const totalStaked = await api.call({abi: totalAssetsABI, target: COLLECTIF_LIQUID_STAKING_POOL_CONTRACT}); + + let totalCollateral = BigNumber.from(0); + + if (minersOwners && minersOwners.length > 0) { + const collaterals = await Promise.all(minersOwners.map(fetchCollateral)); + totalCollateral = collaterals.reduce((acc, cur) => { + const [available, locked] = cur; + return acc.add(available).add(locked); + }, BigNumber.from(0)); + } + + const tvl = BigNumber.from(totalStaked).add(totalCollateral).toString(); api.add(nullAddress, tvl) }, From 76fddf2a3db0f02a5586067f932e74807d40c181 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 31 Oct 2023 15:02:03 +0530 Subject: [PATCH 1773/1974] Persied-fi (#7904) * add perseid-finance * add perseid-finance * code refactor --------- Co-authored-by: Silence Co-authored-by: llama --- projects/helper/cache/sumUnknownTokens.js | 10 ++++- projects/helper/coreAssets.json | 1 + projects/helper/utils.js | 1 + projects/perseid-finance/index.js | 47 +++++++++++++++++++++++ 4 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 projects/perseid-finance/index.js diff --git a/projects/helper/cache/sumUnknownTokens.js b/projects/helper/cache/sumUnknownTokens.js index 02cbfe1894b..40c8f5aaee6 100644 --- a/projects/helper/cache/sumUnknownTokens.js +++ b/projects/helper/cache/sumUnknownTokens.js @@ -382,7 +382,7 @@ async function sumUnknownTokens({ api, tokensAndOwners = [], balances, else if (owner) tokensAndOwners = tokens.map(t => [t, owner]) tokensAndOwners = tokensAndOwners.filter(t => !blacklist.includes(t[0])) - await sumTokens2({ api, balances, chain, block, tokensAndOwners, skipFixBalances: true, resolveLP, }) + await sumTokens2({ api, balances, chain, block, tokensAndOwners, skipFixBalances: true, resolveLP, abis }) const { updateBalances, } = await getTokenPrices({ cache, coreAssets, lps: [...tokensAndOwners.map(t => t[0]), ...lps,], chain, block, restrictTokenRatio, blacklist, log_coreAssetPrices, log_minTokenValue, minLPRatio, abis, }) await updateBalances(balances, { skipConversion, onlyLPs }) const fixBalances = await getFixBalances(chain) @@ -400,6 +400,14 @@ const customLPHandlers = { token1ABI: kslpABI.tokenB, }, } + }, + scroll: { + syncswap: { + lpFilter: (symbol, addr, chain) => chain === 'scroll' && /(sCLP|sSLP)$/.test(symbol), + abis: { + getReservesABI: "function getReserves() external view returns (uint _reserve0, uint _reserve1)", + }, + } } } diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index 7b3a1df3c72..955b9466851 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -1463,6 +1463,7 @@ }, "scroll": { "WETH": "0x5300000000000000000000000000000000000004", + "USDT": "0xf55bec9cafdbe8730f096aa55dad6d22d44099df", "USDC": "0x06eFdBFf2a14a7c8E15944D1F4A48F9F95F663A4" }, "darwinia": { diff --git a/projects/helper/utils.js b/projects/helper/utils.js index 83ec22e679e..af7c53a2955 100644 --- a/projects/helper/utils.js +++ b/projects/helper/utils.js @@ -83,6 +83,7 @@ function isLP(symbol, token, chain) { if (chain === 'arbitrum' && /^(crAMM|vrAMM)-/.test(symbol)) return true // ramses LP if (chain === 'base' && /^(v|s)-/.test(symbol)) return true // Equalizer LP if (chain === 'bsc' && /(-APE-LP-S)/.test(symbol)) return false + if (chain === 'scroll' && /(cSLP|sSLP)$/.test(symbol)) return true //syncswap LP if (['fantom', 'nova',].includes(chain) && ['NLT'].includes(symbol)) return true let label diff --git a/projects/perseid-finance/index.js b/projects/perseid-finance/index.js new file mode 100644 index 00000000000..04cd2a907ca --- /dev/null +++ b/projects/perseid-finance/index.js @@ -0,0 +1,47 @@ +const { sumUnknownTokens } = require('../helper/unknownTokens') +const ADDRESSES = require('../helper/coreAssets.json') + +const NATIVE_ADDRES = "0xfec65bfb6e5bbcc9ab8ae98f62a8aab2ea51c495"; +const NATIVE_LP_ADDRESS = "0x47ED4E0a52716e91a4F37914b04B2252B5B5fcDF"; // iziswap LP +const FARM_ADDRES = "0xC692CA3066C84012C616989Bc7fD9659f16DDCFd"; + + +const getTvl = isStaking => async (_, _1, _2, { api }) => { + let pools = await api.call({ abi: abi.getPoolTotalTvl, target: FARM_ADDRES, }); + if (isStaking) + pools = pools.find(i => i[1].toLowerCase() === NATIVE_ADDRES) + else + pools = pools.filter(i => i[1].toLowerCase() !== NATIVE_ADDRES) + + if (!isStaking) { + pools.forEach(([_, token, bal]) => api.add(token, bal)) + return sumUnknownTokens({ + api, useDefaultCoreAssets: true, resolveLP: true, abis: { + getReservesABI: !isStaking ? abi.getReserves : null, + } + }) + } + + if (!pools) return {} + const pedBal = pools[2] + const [usdtLPBal, pedLPBal] = await api.multiCall({ abi: 'erc20:balanceOf', calls: [ + { target: ADDRESSES.scroll.USDT, params: NATIVE_LP_ADDRESS }, + { target: NATIVE_ADDRES, params: NATIVE_LP_ADDRESS }, + ]}) + + api.add(ADDRESSES.scroll.USDT, pedBal * usdtLPBal / pedLPBal) + return api.getBalances() +} + +module.exports = { + misrepresentedTokens: true, + scroll: { + tvl: getTvl(false), + staking: getTvl(true), + }, +}; + +const abi = { + "getPoolTotalTvl": "function getPoolTotalTvl() view returns (tuple(uint256 pid, address assets, uint256 tvl)[])", + "getReserves": "function getReserves() external view returns (uint _reserve0, uint _reserve1)" +} \ No newline at end of file From 0cb8cdbf954151cf0260619ef586cc8e8b1a33e3 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 31 Oct 2023 15:02:25 +0530 Subject: [PATCH 1774/1974] Persied-fi (#7904) * add perseid-finance * add perseid-finance * code refactor --------- Co-authored-by: Silence Co-authored-by: llama From 8d3f75be7a9ef07a927848406f52271667199bb4 Mon Sep 17 00:00:00 2001 From: Ivan Borisov <2622610@gmail.com> Date: Tue, 31 Oct 2023 15:35:16 +0600 Subject: [PATCH 1775/1974] updated vault addresses (#7902) --- projects/locus/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/projects/locus/index.js b/projects/locus/index.js index c5dc06ff5c7..409a1ecff4e 100644 --- a/projects/locus/index.js +++ b/projects/locus/index.js @@ -7,13 +7,13 @@ module.exports = { const config = { ethereum: { lvTokens: { - lvETH: "0x3edbE670D03C4A71367dedA78E73EA4f8d68F2E4", - lvDCI: "0xf62A24EbE766d0dA04C9e2aeeCd5E86Fac049B7B" + lvETH: "0x0e86f93145d097090acbbb8ee44c716dacff04d7", + lvDCI: "0x65b08FFA1C0E1679228936c0c85180871789E1d7" } }, arbitrum: { lvTokens: { - lvAYI: "0xBE55f53aD3B48B3ca785299f763d39e8a12B1f98" + lvAYI: "0x0f094f6deb056af1fa1299168188fd8c78542a07" }, } } From 0e64400923871c4cd17bf98c05d95a558139426b Mon Sep 17 00:00:00 2001 From: Behrang Norouzinia Date: Tue, 31 Oct 2023 13:08:21 +0330 Subject: [PATCH 1776/1974] Add Hipo Liquid Staking protocol on TON (#7901) --- projects/hipo/index.js | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 projects/hipo/index.js diff --git a/projects/hipo/index.js b/projects/hipo/index.js new file mode 100644 index 00000000000..74f670ace39 --- /dev/null +++ b/projects/hipo/index.js @@ -0,0 +1,31 @@ +const { post } = require('../helper/http') + +module.exports = { + timetravel: false, + methodology: 'Actual amount of TON staked on Hipo', + hallmarks: [ + [1698685200, 'Hipo Launch'], + ], + ton: { + tvl: async () => { + const requestBody = { + 'address': 'EQBNo5qAG8I8J6IxGaz15SfQVB-kX98YhKV_mT36Xo5vYxUa', + 'method': 'get_treasury_state', + 'stack': [] + } + const response = await post('https://toncenter.com/api/v2/runGetMethod', requestBody) + if (! response.ok) { + throw new Error('Error in calling toncenter.com/api/v2/runGetMethod') + } + const result = response.result + if (result.exit_code !== 0) { + throw new Error('Expected a zero exit code, but got ' + result.exit_code) + } + const currentlyStakedNano = BigInt(result.stack[0][1]) + const currentlyStakedTon = currentlyStakedNano / 1000000000n + return { + 'coingecko:the-open-network': currentlyStakedTon.toString(), + } + }, + }, +} From e197c83cfdf39f3e6223e1b627dd8f8d287d48f9 Mon Sep 17 00:00:00 2001 From: Define101 Date: Tue, 31 Oct 2023 14:41:41 +0000 Subject: [PATCH 1777/1974] add chain to protocol --- projects/radiant-v2/index.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/projects/radiant-v2/index.js b/projects/radiant-v2/index.js index 7d2ed422967..67dbf84bda7 100644 --- a/projects/radiant-v2/index.js +++ b/projects/radiant-v2/index.js @@ -15,4 +15,9 @@ module.exports = { // balancer pool is not unwrapped properly, so we use staking and rely on price api instead pool2: sumTokensExport({ owner: '0x4fd9f7c5ca0829a656561486bada018505dfcb5e', tokens: ['0x346575fc7f07e6994d76199e41d13dc1575322e1'], useDefaultCoreAssets: true, }) }, + ethereum: { + ...aaveExports('ethereum', '0xe969066F2cCcE3145f62f669F151c6D566068BA2'), + // balancer pool is not unwrapped properly, so we use staking and rely on price api instead + pool2: staking("0x28e395a54a64284dba39652921cd99924f4e3797", "0xcF7b51ce5755513d4bE016b0e28D6EDEffa1d52a") + }, }; From 4949c6c5e1ae7b8eab0d9d4161565d39f6cbc82e Mon Sep 17 00:00:00 2001 From: Rubydex <118339704+Rubydex@users.noreply.github.com> Date: Wed, 1 Nov 2023 00:52:42 +0800 Subject: [PATCH 1778/1974] add chains(Arbitrum, BSC, zkSync, Ethereum, Optimism, Polygon, Mantle, Avanlanche, Linea, Manta) (#7893) * add bsc chain * add 2 chains * update chains * update chains * update avax * fix * fix avax usdt --------- Co-authored-by: robert Co-authored-by: DaFei --- projects/rubydex/index.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/projects/rubydex/index.js b/projects/rubydex/index.js index 59164aa6d8b..3eab958b8e4 100644 --- a/projects/rubydex/index.js +++ b/projects/rubydex/index.js @@ -4,6 +4,12 @@ const VAULT_ARBITRUM = '0x4a7c10780afdba628332e31c9e7d1675cfad594c'; const VAULT_BSC = '0xedB6CD4fdd2F465d2234f978276F9Ed2EE02102c'; const VAULT_ZKSYNC_ERA = '0x211ac72f3ee4a35523B41aA8D67644E1eF860059'; const VAULT_ETHEREUM = '0x1DE35eB48f92Fb38dee51041AAE86FFf18029E90'; +const VAULT_OPTIMISM = '0xedB6CD4fdd2F465d2234f978276F9Ed2EE02102c'; +const VAULT_POLYGON = '0xedB6CD4fdd2F465d2234f978276F9Ed2EE02102c'; +const VAULT_MANTLE = '0xedB6CD4fdd2F465d2234f978276F9Ed2EE02102c'; +const VAULT_AVALANCHE = '0xedB6CD4fdd2F465d2234f978276F9Ed2EE02102c'; +const VAULT_LINEA = '0xedB6CD4fdd2F465d2234f978276F9Ed2EE02102c'; +const VAULT_MANTA = '0xedB6CD4fdd2F465d2234f978276F9Ed2EE02102c'; module.exports = { methodology: 'USDT tokens held by the RubyDex Vault contract.', @@ -19,4 +25,22 @@ module.exports = { ethereum: { tvl: sumTokensExport({ owner: VAULT_ETHEREUM, tokens: [ADDRESSES.ethereum.USDT] }), }, + optimism: { + tvl: sumTokensExport({ owner: VAULT_OPTIMISM, tokens: [ADDRESSES.optimism.USDT] }), + }, + polygon: { + tvl: sumTokensExport({ owner: VAULT_POLYGON, tokens: [ADDRESSES.polygon.USDT] }), + }, + mantle: { + tvl: sumTokensExport({ owner: VAULT_MANTLE, tokens: [ADDRESSES.mantle.USDT] }), + }, + avax: { + tvl: sumTokensExport({ owner: VAULT_AVALANCHE, tokens: [ADDRESSES.avax.USDt] }), + }, + linea: { + tvl: sumTokensExport({ owner: VAULT_LINEA, tokens: [ADDRESSES.linea.USDT] }), + }, + manta: { + tvl: sumTokensExport({ owner: VAULT_MANTA, tokens: [ADDRESSES.manta.USDT] }), + } }; From ff50bac0800289618f9456258f9b0dcd0a3da7b7 Mon Sep 17 00:00:00 2001 From: Strategic Reserve Date: Tue, 31 Oct 2023 10:02:54 -0700 Subject: [PATCH 1779/1974] Add Metis (#7912) --- projects/visor/config.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/visor/config.js b/projects/visor/config.js index 16f166230c8..32346a931e9 100644 --- a/projects/visor/config.js +++ b/projects/visor/config.js @@ -85,6 +85,9 @@ const HYPE_REGISTRY = { manta: [ ["0x683292172E2175bd08e3927a5e72FC301b161300", 394949], // Apertureswap ], + metis: [ + ["0xFc13Ebe7FEB9595D70195E9168aA7F3acE153621", 9080358], // Hercules + ], }; Object.keys(HYPE_REGISTRY).forEach(chain => { From e73a3f030ebf19c9de4f7674d6ffc641e367c3a4 Mon Sep 17 00:00:00 2001 From: Ivan Borisov <2622610@gmail.com> Date: Tue, 31 Oct 2023 20:04:08 +0300 Subject: [PATCH 1780/1974] added old addresses (#7911) --- projects/locus/index.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/projects/locus/index.js b/projects/locus/index.js index 409a1ecff4e..21ec3677e16 100644 --- a/projects/locus/index.js +++ b/projects/locus/index.js @@ -8,12 +8,16 @@ const config = { ethereum: { lvTokens: { lvETH: "0x0e86f93145d097090acbbb8ee44c716dacff04d7", - lvDCI: "0x65b08FFA1C0E1679228936c0c85180871789E1d7" + lvDCI: "0x65b08FFA1C0E1679228936c0c85180871789E1d7", + lvETH_v1: "0x3edbE670D03C4A71367dedA78E73EA4f8d68F2E4", + lvDCI_v1: "0xf62A24EbE766d0dA04C9e2aeeCd5E86Fac049B7B", + } }, arbitrum: { lvTokens: { - lvAYI: "0x0f094f6deb056af1fa1299168188fd8c78542a07" + lvAYI: "0x0f094f6deb056af1fa1299168188fd8c78542a07", + lvAYI_v1: "0xBE55f53aD3B48B3ca785299f763d39e8a12B1f98" }, } } From 17abb2063c4571dbc5295cff03dd342e5807314e Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 31 Oct 2023 22:49:26 +0530 Subject: [PATCH 1781/1974] Jumpdefi (#7913) * add JumpDefi * jumpdefi * code refactor --------- Co-authored-by: ymc182 Co-authored-by: llama --- projects/jumpdefi/index.js | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 projects/jumpdefi/index.js diff --git a/projects/jumpdefi/index.js b/projects/jumpdefi/index.js new file mode 100644 index 00000000000..b75f250f770 --- /dev/null +++ b/projects/jumpdefi/index.js @@ -0,0 +1,3 @@ +const { uniTvlExport } = require("../helper/unknownTokens"); + +module.exports = uniTvlExport("telos", "0xff59EBFf3e3F72E8162eA2aB0a0d1C9258692dF5", { fetchBalances: true }); From af410930c5a405f8ea9542fb1c2ba6cc02581211 Mon Sep 17 00:00:00 2001 From: chainupk <121842069+chainupk@users.noreply.github.com> Date: Wed, 1 Nov 2023 14:18:19 +0800 Subject: [PATCH 1782/1974] removed v0 validators (#7914) --- projects/node-dao/index.js | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/projects/node-dao/index.js b/projects/node-dao/index.js index e19286cb848..a13117a9887 100644 --- a/projects/node-dao/index.js +++ b/projects/node-dao/index.js @@ -3,31 +3,24 @@ const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') module.exports = { ethereum: { tvl: async (_, _1, _2, { api }) => { - // nodeDAO v0 validator nft - const nodeDaoV0ValidatorNFT = '0x40Cd77D9aa9e0b2D485259415eA05486B201c514' - const v0VdalitorsNumber = await api.call({ abi: 'uint256:totalSupply', target: nodeDaoV0ValidatorNFT }) - - // nodeDAO liquidStaking + // nodeDAO liquidStaking neth tvl const nodeDaoLiquidStaking = '0x8103151E2377e78C04a3d2564e20542680ed3096' const nethTVL = await api.call({ abi: 'uint256:getTotalEthValue', target: nodeDaoLiquidStaking }) - // nodeDAO v1 validator nft - const nodeDaoV1ValidatorNFT = '0x58553F5c5a6AEE89EaBFd42c231A18aB0872700d' - const v1Vdalitors = await api.call({ abi: 'uint256[]:activeNftsOfUser', target: nodeDaoV1ValidatorNFT }) - - // nodeDAO totalEth = nethTVL + (v1ValidatorNumber + v0VdalitorsNumber)* 32 eth - let totalEth = parseInt(nethTVL) + (v1Vdalitors.length + parseInt(v0VdalitorsNumber)) * 32_000_000_000_000_000_000 - - // nodeDAO largeStaking + // nodeDAO largeStaking tvl + let largeStakingTVL = 0 const nodeDaoLargeStaking = '0xBBd19e8F766Dcc94D50e47502b79C81cdaD484B8' const nodeOperatorRegistry = '0x8742178Ac172eC7235E54808d5F327C30A51c492' const operatorNumbers = await api.call({ abi: 'uint256:getNodeOperatorsCount', target: nodeOperatorRegistry }) for (let i = 1; i <= operatorNumbers; i++) { const validatorNumbers = await api.call({ abi: 'function getOperatorValidatorCounts(uint256 _operatorId) external view returns (uint256)', target: nodeDaoLargeStaking, params: [i] }) - totalEth += parseInt(validatorNumbers) * 32_000_000_000_000_000_000 + largeStakingTVL += parseInt(validatorNumbers) * 32_000_000_000_000_000_000 } + // nodeDAO totalEth = nethTVL + largeStakingTVL + const totalEth = parseInt(nethTVL) + largeStakingTVL + api.add(nullAddress, totalEth) } } -} +} \ No newline at end of file From 1c45dad2a3678742ece44ffbde2638057c342c57 Mon Sep 17 00:00:00 2001 From: DEXXX001 <141214540+DEXXX001@users.noreply.github.com> Date: Wed, 1 Nov 2023 14:27:12 +0800 Subject: [PATCH 1783/1974] Add BwSwap (#7907) * bwswap Create index.js * minor fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/bwswap/index.js | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 projects/bwswap/index.js diff --git a/projects/bwswap/index.js b/projects/bwswap/index.js new file mode 100644 index 00000000000..c3e0bd3f48e --- /dev/null +++ b/projects/bwswap/index.js @@ -0,0 +1,3 @@ +const { uniTvlExport } = require('../helper/unknownTokens') + +module.exports = uniTvlExport('base', '0x67233C258BAeE28b2a7d42ec19fBD0b750a77Cd1', { fetchBalances: true }) \ No newline at end of file From 860dc15c79b720396f8131536a488e36a02da11d Mon Sep 17 00:00:00 2001 From: Diego Brando <135213311+DIO1009@users.noreply.github.com> Date: Wed, 1 Nov 2023 14:27:26 +0800 Subject: [PATCH 1784/1974] Add Equation Protocol (#7906) * Add Equation Protocol * remove pool2 * add v3 pools * resolve UniV3 * remove V3 pool * minor fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/equation/index.js | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 projects/equation/index.js diff --git a/projects/equation/index.js b/projects/equation/index.js new file mode 100644 index 00000000000..22c941a4d86 --- /dev/null +++ b/projects/equation/index.js @@ -0,0 +1,31 @@ +const { sumTokens2, sumTokensExport } = require("../helper/unwrapLPs"); +const { getLogs } = require('../helper/cache/getLogs') + + +const config = { + arbitrum: { factory: '0xA91680161fBCeA942e164B42445aD6130D01541F', stakingContract: '0x3C77EEB8eC4716a6389a522eD590FbbD261ABE8e', EQU: '0x87AAfFdF26c6885f6010219208D5B161ec7609c0' }, +} + +module.exports = { + methodology: "Count the tokens in different pools in the equation.", +} + +Object.keys(config).forEach(chain => { + const { factory, EQU, stakingContract, } = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const logs = await getLogs({ + api, + target: factory, + eventAbi: 'event PoolCreated(address indexed pool, address indexed token, address indexed usd)', + onlyArgs: true, + fromBlock: 142245092, + }) + const ownerTokens = logs.map(i => [[i.usd], i.pool]) + return sumTokens2({ api, ownerTokens, }) + }, + pool2: sumTokensExport({ resolveUniV3: true, owner: stakingContract }), + staking: sumTokensExport({ owner: stakingContract, tokens: [EQU] }), + } +}) + From 271376b3ab7eff2f42e34cb78d53a9d21d9ac49d Mon Sep 17 00:00:00 2001 From: BkChoy Date: Wed, 1 Nov 2023 02:27:38 -0400 Subject: [PATCH 1785/1974] updated stakedotlink tvl adapter (#7909) --- projects/stakedotlink/index.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/projects/stakedotlink/index.js b/projects/stakedotlink/index.js index c345f9cb134..e0e1ea453f2 100644 --- a/projects/stakedotlink/index.js +++ b/projects/stakedotlink/index.js @@ -2,9 +2,11 @@ const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const sdlToken = "0xA95C5ebB86E0dE73B4fB8c47A45B792CFeA28C23"; -const sdlStakingPool = "0xAEF186611EC96427d161107fFE14bba8aA1C2284"; +const sdlStakingPool = "0x0B2eF910ad0b34bf575Eb09d37fd7DA6c148CA4d"; const linkToken = ADDRESSES.ethereum.LINK; const linkStakingPool = "0xb8b295df2cd735b15BE5Eb419517Aa626fc43cD5"; +const linkPriorityPool = "0xDdC796a66E8b83d0BcCD97dF33A6CcFBA8fd60eA"; + async function tvl(timestamp, ethBlock, chainBlocks) { const stakedLINK = await sdk.api.abi.call({ @@ -12,9 +14,14 @@ async function tvl(timestamp, ethBlock, chainBlocks) { target: linkStakingPool, abi: "uint256:totalStaked", }); + const ppLINK = await sdk.api.abi.call({ + block: ethBlock, + target: linkPriorityPool, + abi: "uint256:totalQueued", + }); return { - [linkToken]: stakedLINK.output, + [linkToken]: BigInt(stakedLINK.output) + BigInt(ppLINK.output), }; } @@ -34,7 +41,7 @@ module.exports = { timetravel: true, misrepresentedTokens: false, methodology: - "Queries LINK and SDL staking pools for the total amount of tokens staked", + "Queries LINK staking/priority pools and SDL staking pool for the total amount of tokens staked", start: 1670337984, ethereum: { tvl, From 26c59a2ceb3d55c54b997f46ba860741c175c61f Mon Sep 17 00:00:00 2001 From: devZooOzys <97731267+devZooOzys@users.noreply.github.com> Date: Wed, 1 Nov 2023 15:39:48 +0900 Subject: [PATCH 1786/1974] megaton_staking (#7915) --- projects/megatonfi/index.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/projects/megatonfi/index.js b/projects/megatonfi/index.js index c4941228a29..f2653252cc5 100644 --- a/projects/megatonfi/index.js +++ b/projects/megatonfi/index.js @@ -1,7 +1,8 @@ const ADDRESSES = require('../helper/coreAssets.json') const { get } = require('../helper/http') -const { transformDexBalances } = require('../helper/portedTokens') +const { transformDexBalances, transformBalances } = require('../helper/portedTokens') const nullAddress = ADDRESSES.null +const megaAddress = '0:5febe62847dc7296897f3708c7acb92b4c50192425fe6ec77e5f1ffdd3639a3d' module.exports = { misrepresentedTokens: true, @@ -20,6 +21,14 @@ module.exports = { token1Bal: pool.amount1, })) }) + }, + staking: async () => { + let mega_vault = "EQD9Z7L2oLpWvW-NZFB9njBGg2JqIE2rpJ_Fcocg9IEQ-EGF" + + const res = await get(`https://tonapi.io/v2/accounts/${mega_vault}/jettons?currencies=mega`); + const vaultMegaWallet = res.balances.find((data)=> data.jetton.address==megaAddress) + + return await transformBalances('ton', {[ADDRESSES.ton.MEGA]: vaultMegaWallet.balance}) } } } From 0803a5556a5ae279d679f1190cef1cc8cebcae50 Mon Sep 17 00:00:00 2001 From: Quantum Unit <148651164+QuantumUnit@users.noreply.github.com> Date: Wed, 1 Nov 2023 01:40:28 -0500 Subject: [PATCH 1787/1974] Add Quantum Unit (#7910) --- projects/quantum-unit/index.js | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 projects/quantum-unit/index.js diff --git a/projects/quantum-unit/index.js b/projects/quantum-unit/index.js new file mode 100644 index 00000000000..a21f109aef4 --- /dev/null +++ b/projects/quantum-unit/index.js @@ -0,0 +1,10 @@ +const { sumTokensExport } = require("../helper/unwrapLPs"); +const ADDRESSES = require('../helper/coreAssets.json') +const QUANTUM_UNIT_CONTRACT = "0x81889aec6fdc400ec9786516c3adc14d59fc361e"; + +module.exports = { + methodology: 'count all contract balance', + bsc: { + tvl: sumTokensExport({ owner: QUANTUM_UNIT_CONTRACT, tokens: [ADDRESSES.null] }), + } +}; From ca1cabf14acbbd6bca34a8e812331e1816951357 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 1 Nov 2023 08:02:22 +0100 Subject: [PATCH 1788/1974] cockswap: track scroll --- projects/ambient-finance/index.js | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/projects/ambient-finance/index.js b/projects/ambient-finance/index.js index 9c52b8ecd40..485811dfb80 100644 --- a/projects/ambient-finance/index.js +++ b/projects/ambient-finance/index.js @@ -1,27 +1,32 @@ const { sumTokens2 } = require('../helper/unwrapLPs'); -const { cachedGraphQuery } = require("../helper/cache"); +const { cachedGraphQuery, getConfig } = require("../helper/cache"); +// https://docs.ambient.finance/developers/deployed-contracts const vault = { + scroll: "0xaaaaAAAACB71BF2C8CaE522EA5fa455571A74106", ethereum: "0xAaAaAAAaA24eEeb8d57D431224f73832bC34f688", canto: "0x9290c893ce949fe13ef3355660d07de0fb793618" } const subgraphs = { + scroll: 'https://ambindexer.net/scroll-gcgo/pool_list?chainId=0x82750', canto: "https://canto-subgraph.plexnode.wtf/subgraphs/name/ambient-graph", ethereum: `https://api.thegraph.com/subgraphs/name/crocswap/croc-mainnet` } async function tvl(_, _b, _cb, { api, }) { - const { pools } = await cachedGraphQuery(`ambient-finance/${api.chain}`, subgraphs[api.chain], "{ pools { base quote }}") + let pools + if (api.chain === "scroll") { + const data = await getConfig(`ambient-finance/${api.chain}`, subgraphs[api.chain]) + pools = data.data + } else { + const data = await cachedGraphQuery(`ambient-finance/${api.chain}`, subgraphs[api.chain], "{ pools { base quote }}") + pools = data.pools + } const tokens = pools.map(i => [i.base, i.quote]).flat() return sumTokens2({ api, owner: vault[api.chain], tokens, }) } -module.exports = { - ethereum: { - tvl, - }, - canto: { - tvl, - } -} +Object.keys(subgraphs).forEach(chain => { + module.exports[chain] = { tvl } +}) From 48bd9374d0a65da9281fc06dc7c0554d6f9c8a87 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 1 Nov 2023 13:01:08 +0100 Subject: [PATCH 1789/1974] onyx was hacked --- projects/onyx/index.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/projects/onyx/index.js b/projects/onyx/index.js index d40204bbb72..d98e1d97def 100644 --- a/projects/onyx/index.js +++ b/projects/onyx/index.js @@ -13,4 +13,9 @@ module.exports = { ...compoundExports2({ comptroller: tokensAddress.unitroller, cether: tokensAddress.oEth}), staking: staking(tokensAddress.stakingPool, tokensAddress.onyx), }, + hallmarks: [ + [Math.floor(new Date('2023-11-01')/1e3), 'Protocol was hacked'], + ], }; + +delete module.exports.ethereum; From dade54c317f7bf5c84fc2fd8118f0f686667776d Mon Sep 17 00:00:00 2001 From: Define101 Date: Wed, 1 Nov 2023 14:01:13 +0000 Subject: [PATCH 1790/1974] add --- projects/entities/abraxas-capital.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 projects/entities/abraxas-capital.js diff --git a/projects/entities/abraxas-capital.js b/projects/entities/abraxas-capital.js new file mode 100644 index 00000000000..66d38b3a063 --- /dev/null +++ b/projects/entities/abraxas-capital.js @@ -0,0 +1,16 @@ +const { treasuryExports } = require("../helper/treasury") +const ADDRESSES = require('../helper/coreAssets.json') + + +const config = { + ethereum: { + resolveLP: true, + resolveUniV3: true, + owners: [ + "0xD275E5cb559D6Dc236a5f8002A5f0b4c8e610701", + "0xac44F2d75876ead509a2ceB099BC14f9547b5Db6" + ], + }, +} + +module.exports = treasuryExports(config) \ No newline at end of file From 24c14cfb28ebeeef507b98085eec9080032c3770 Mon Sep 17 00:00:00 2001 From: Define101 Date: Wed, 1 Nov 2023 15:05:02 +0000 Subject: [PATCH 1791/1974] add missing wallets --- projects/entities/abraxas-capital.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/projects/entities/abraxas-capital.js b/projects/entities/abraxas-capital.js index 66d38b3a063..ac7154ae870 100644 --- a/projects/entities/abraxas-capital.js +++ b/projects/entities/abraxas-capital.js @@ -1,5 +1,4 @@ const { treasuryExports } = require("../helper/treasury") -const ADDRESSES = require('../helper/coreAssets.json') const config = { @@ -8,7 +7,9 @@ const config = { resolveUniV3: true, owners: [ "0xD275E5cb559D6Dc236a5f8002A5f0b4c8e610701", - "0xac44F2d75876ead509a2ceB099BC14f9547b5Db6" + "0xac44F2d75876ead509a2ceB099BC14f9547b5Db6", + "0x09fa0d3154363036ea406f254808c53f5f975518", //makerproxy + "0xDdE0d6e90bfB74f1dC8ea070cFd0c0180C03Ad16" ], }, } From 1d19baae1fc484f7d96f2e5d03c2359f0a6c556b Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 2 Nov 2023 07:29:23 +0100 Subject: [PATCH 1792/1974] onyx was hacked --- projects/onyx/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/onyx/index.js b/projects/onyx/index.js index d98e1d97def..caf44d82db2 100644 --- a/projects/onyx/index.js +++ b/projects/onyx/index.js @@ -18,4 +18,4 @@ module.exports = { ], }; -delete module.exports.ethereum; +delete module.exports.ethereum.borrowed From f372dfd21e9243e0dc07786a627e616cd34b3260 Mon Sep 17 00:00:00 2001 From: Michalis Kargakis Date: Thu, 2 Nov 2023 07:50:18 +0100 Subject: [PATCH 1793/1974] Add Gondi adapter (#7922) --- projects/gondi/index.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 projects/gondi/index.js diff --git a/projects/gondi/index.js b/projects/gondi/index.js new file mode 100644 index 00000000000..d3114aa8e91 --- /dev/null +++ b/projects/gondi/index.js @@ -0,0 +1,12 @@ +const { sumTokensExport, } = require('../helper/unwrapLPs'); + +// Vaults +const multiSourceLoan = "0xCa5a494Ca20483e21ec1E41FE1D9461Da77595Bd"; + +module.exports = { + misrepresentedTokens: true, + methodology: `Counts the floor value of all deposited NFTs with Chainlink price feeds.`, + ethereum: { + tvl: sumTokensExport({ owners: [multiSourceLoan], resolveNFTs: true, }), + } +} From 28f4b7815fb01466eb11688df49b189910d1c391 Mon Sep 17 00:00:00 2001 From: B2B Money <148764962+b2b-money-org@users.noreply.github.com> Date: Thu, 2 Nov 2023 14:53:23 +0800 Subject: [PATCH 1794/1974] add back-to-bitcoin project (#7916) * feat: add back-to-bitcoin project * minor refactor --------- Co-authored-by: b2bmoney Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/back-to-bitcoin/index.js | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 projects/back-to-bitcoin/index.js diff --git a/projects/back-to-bitcoin/index.js b/projects/back-to-bitcoin/index.js new file mode 100644 index 00000000000..97a8b3a6157 --- /dev/null +++ b/projects/back-to-bitcoin/index.js @@ -0,0 +1,11 @@ +const { sumTokensExport } = require('../helper/unwrapLPs') +const ADDRESSES = require('../helper/coreAssets.json') + +const contract = "0x1EE28d16C380B2137E63EBf92a9F5B42e63E9500" + +module.exports = { + methodology: `We count the BTCB on ${contract}`, + bsc: { + tvl: sumTokensExport({ owner: contract, tokens: [ADDRESSES.bsc.BTCB]}), + } +} From fc1f123409d40a16dc917c9e142845573b88d268 Mon Sep 17 00:00:00 2001 From: doomsower Date: Thu, 2 Nov 2023 09:58:21 +0300 Subject: [PATCH 1795/1974] feat: support v3 and intermediate deployment (#7917) --- projects/gearbox/abi.json | 10 ++- projects/gearbox/index.js | 167 ++++++++++++++++++++++++++++++++------ 2 files changed, 148 insertions(+), 29 deletions(-) diff --git a/projects/gearbox/abi.json b/projects/gearbox/abi.json index 56d8f3d468c..cd3520393dd 100644 --- a/projects/gearbox/abi.json +++ b/projects/gearbox/abi.json @@ -5,9 +5,14 @@ "availableLiquidity": "uint256:availableLiquidity", "totalBorrowed": "uint256:totalBorrowed", "underlyingToken": "address:underlyingToken", + "creditAccounts": "address[]:creditAccounts", "getDataCompressor": "address:getDataCompressor", - "getCreditManagersList": "function getCreditManagersList() view returns (tuple(address addr, address underlying, address pool, bool isWETH, bool canBorrow, uint256 borrowRate, uint256 minAmount, uint256 maxAmount, uint256 maxLeverageFactor, uint256 availableLiquidity, address[] collateralTokens, tuple(address allowedContract, address adapter)[] adapters, uint256[] liquidationThresholds, uint8 version, address creditFacade, address creditConfigurator, bool isDegenMode, address degenNFT, bool isIncreaseDebtForbidden, uint256 forbiddenTokenMask, uint8 maxEnabledTokensLength, uint16 feeInterest, uint16 feeLiquidation, uint16 liquidationDiscount, uint16 feeLiquidationExpired, uint16 liquidationDiscountExpired)[] result)", + "getAddressOrRevert": "function getAddressOrRevert(bytes32 key, uint256 _version) view returns (address result)", + "getCreditManagers": "address[]:getCreditManagers", + "getCreditManagersV2List": "function getCreditManagersV2List() view returns (tuple(address addr, string name, uint256 cfVersion, address creditFacade, address creditConfigurator, address underlying, address pool, uint256 totalDebt, uint256 totalDebtLimit, uint256 baseBorrowRate, uint256 minDebt, uint256 maxDebt, uint256 availableToBorrow, address[] collateralTokens, tuple(address targetContract, address adapter)[] adapters, uint256[] liquidationThresholds, bool isDegenMode, address degenNFT, uint256 forbiddenTokenMask, uint8 maxEnabledTokensLength, uint16 feeInterest, uint16 feeLiquidation, uint16 liquidationDiscount, uint16 feeLiquidationExpired, uint16 liquidationDiscountExpired, tuple(address token, uint16 rate, uint16 quotaIncreaseFee, uint96 totalQuoted, uint96 limit, bool isActive)[] quotas, tuple(address interestModel, uint256 version, uint16 U_1, uint16 U_2, uint16 R_base, uint16 R_slope1, uint16 R_slope2, uint16 R_slope3, bool isBorrowingMoreU2Forbidden) lirm, bool isPaused)[])", + "getCreditManagersV3List": "function getCreditManagersV3List() view returns (tuple(address addr, string name, uint256 cfVersion, address creditFacade, address creditConfigurator, address underlying, address pool, uint256 totalDebt, uint256 totalDebtLimit, uint256 baseBorrowRate, uint256 minDebt, uint256 maxDebt, uint256 availableToBorrow, address[] collateralTokens, tuple(address targetContract, address adapter)[] adapters, uint256[] liquidationThresholds, bool isDegenMode, address degenNFT, uint256 forbiddenTokenMask, uint8 maxEnabledTokensLength, uint16 feeInterest, uint16 feeLiquidation, uint16 liquidationDiscount, uint16 feeLiquidationExpired, uint16 liquidationDiscountExpired, tuple(address token, uint16 rate, uint16 quotaIncreaseFee, uint96 totalQuoted, uint96 limit, bool isActive)[] quotas, tuple(address interestModel, uint256 version, uint16 U_1, uint16 U_2, uint16 R_base, uint16 R_slope1, uint16 R_slope2, uint16 R_slope3, bool isBorrowingMoreU2Forbidden) lirm, bool isPaused)[])", "calcTotalValue": "function calcTotalValue(address creditAccount) view returns (uint256 total)", + "calcDebtAndCollateral": "function calcDebtAndCollateral(address creditAccount, uint8 task) view returns (tuple(uint256 debt, uint256 cumulativeIndexNow, uint256 cumulativeIndexLastUpdate, uint128 cumulativeQuotaInterest, uint256 accruedInterest, uint256 accruedFees, uint256 totalDebtUSD, uint256 totalValue, uint256 totalValueUSD, uint256 twvUSD, uint256 enabledTokensMask, uint256 quotedTokensMask, address[] quotedTokens, address _poolQuotaKeeper) cdd)", "filtersV1": [ "function creditFilter() view returns (address addr)", "event CloseCreditAccount(address indexed owner, address indexed to, uint256 remainingFunds)", @@ -29,5 +34,6 @@ ], "creditConfiguratorV2": [ "event CreditFacadeUpgraded(address indexed newCreditFacade)" - ] + ], + "version": "uint256:version" } \ No newline at end of file diff --git a/projects/gearbox/index.js b/projects/gearbox/index.js index 11e8fd95bb5..f03db6d6de5 100644 --- a/projects/gearbox/index.js +++ b/projects/gearbox/index.js @@ -3,18 +3,19 @@ const { sumTokens2 } = require("../helper/unwrapLPs.js"); const abi = require("./abi.json"); const { getV2CAs, getV1CAs } = require("./events"); +const { BigNumber } = require("ethers"); -const addressProvider = "0xcf64698aff7e5f27a11dff868af228653ba53be0"; +const addressProviderV3 = "0x9ea7b04da02a5373317d745c1571c84aad03321d"; //// Gearbox TVL /// Sum of 2 Sources: -/// 1. Pool TVL - Derived using availableLiquidity() -/// 2. Credit Account v1 & v2 - Derived by getting balances on all open Credit Accounts +/// 1. Pool TVL - Derived using availableLiquidity() +/// 2. Credit Account v1/v2/v3 - Derived by getting balances on all open Credit Accounts const getPoolAddrs = async (block) => { - // Get contractsRegister from Gearbox addressProvider + // Get contractsRegister from Gearbox addressProvider. This is backwards compatible v3->v2 const { output: contractsRegister } = await sdk.api.abi.call({ abi: abi["getContractsRegister"], - target: addressProvider, + target: addressProviderV3, block, }); @@ -41,17 +42,77 @@ const getPoolAddrs = async (block) => { return { tokensAndOwners, poolBalances }; }; -const getCreditManagers = async (block) => { +const getCreditManagersV1 = async (block) => { + const { output: contractsRegister } = await sdk.api.abi.call({ + abi: abi["getContractsRegister"], + target: addressProviderV3, + block, + }); + // Modern data compressors do not return v1 managers + const { output: creditManagers } = await sdk.api.abi.call({ + abi: abi["getCreditManagers"], + target: contractsRegister, + block, + }); + const { output: versions } = await sdk.api.abi.multiCall({ + abi: abi["version"], + calls: creditManagers.map((target) => ({ target })), + block, + }); + const v1Managers = []; + for (let i = 0; i < creditManagers.length; i++) { + const addr = creditManagers[i]; + const version = versions[i].output; + if (version === "1") { + v1Managers.push({ addr }); + } + } + const { output: underlyings } = await sdk.api.abi.multiCall({ + abi: abi["underlyingToken"], + calls: v1Managers.map(({ addr }) => ({ target: addr })), + block, + }); + for (let i = 0; i < underlyings.length; i++) { + v1Managers[i].underlying = underlyings[i].output; + } + return v1Managers; +}; + +const getV1TVL = async (block) => { + const creditManagers = await getCreditManagersV1(block); + + // Silently throw if no V2 CAs available + if (!creditManagers[0]) return []; + + // Get all CA Balances + const caValues = await Promise.all( + creditManagers.map((cm) => getV1CAs(cm.addr, block)) + ); + + return creditManagers.map((cm, i) => ({ + addr: cm.addr, + token: cm.underlying, + bal: caValues[i], + })); +}; + +const getCreditManagersV210 = async (block) => { // Get DataCompressor from Gearbox addressProvider - const { output: DataCompressor } = await sdk.api.abi.call({ - abi: abi["getDataCompressor"], - target: addressProvider, + const { output: DataCompressor210 } = await sdk.api.abi.call({ + abi: abi["getAddressOrRevert"], + target: addressProviderV3, + params: [ + // cast format-bytes32-string "DATA_COMPRESSOR" + "0x444154415f434f4d50524553534f520000000000000000000000000000000000", + 210, + ], block, }); // Get gearbox pools from the contractsRegister, and underlyingToken for each pool const { output: creditManagers } = await sdk.api.abi.call({ - abi: abi["getCreditManagersList"], - target: DataCompressor, + // IDataCompressorV2_10__factory.createInterface().getFunction("getCreditManagersV2List").format(ethers.utils.FormatTypes.full) + abi: abi["getCreditManagersV2List"], + target: DataCompressor210, block, }); @@ -60,9 +121,7 @@ const getCreditManagers = async (block) => { const getV2TVL = async (block) => { // Get Current CMs - const creditManagers = (await getCreditManagers(block)).filter( - (cm) => cm.version != 1 - ); + const creditManagers = await getCreditManagersV210(block); // Silently throw if no V2 CAs available if (!creditManagers[0]) return []; @@ -78,18 +137,72 @@ const getV2TVL = async (block) => { })); }; -const getV1TVL = async (block) => { - // Get Current CMs - const creditManagers = (await getCreditManagers(block)).filter( - (cm) => cm.version != 2 - ); +const getCreditManagersV3 = async (block) => { + try { + // Get DataCompressor V3 from Gearbox addressProvider + // Currently reverts, because DC V3 is not deployed + const { output: DataCompressor300 } = await sdk.api.abi.call({ + abi: abi["getAddressOrRevert"], + target: addressProviderV3, + params: [ + // cast format-bytes32-string "DATA_COMPRESSOR" + "0x444154415f434f4d50524553534f520000000000000000000000000000000000", + 300, + ], + block, + }); + // Get gearbox pools from the contractsRegister, and underlyingToken for each pool + const { output: creditManagers } = await sdk.api.abi.call({ + // IDataCompressorV3_00__factory.createInterface().getFunction("getCreditManagersV3List").format(ethers.utils.FormatTypes.full) + abi: abi["getCreditManagersV3List"], + target: DataCompressor300, + block, + }); + + return creditManagers; + } catch (e) { + // console.warn(e); + return []; + } +}; - // Silently throw if no V2 CAs available +const getV3CAs = async (creditManager, block) => { + const { output: caAddrs } = await sdk.api.abi.call({ + abi: abi["creditAccounts"], + target: creditManager, + block, + }); + + const { output: totalValue } = await sdk.api.abi.multiCall({ + // ICreditManagerV3__factory.createInterface().getFunction("calcDebtAndCollateral").format(ethers.utils.FormatTypes.full) + abi: abi["calcDebtAndCollateral"], + calls: caAddrs.map((addr) => ({ + target: creditManager, + params: [addr, 2], // DEBT_COLLATERAL_WITHOUT_WITHDRAWALS + })), + block, + }); + + return totalValue[0] + ? totalValue + .map((t) => t.output) + .reduce( + (a, c) => a.add(BigNumber.from(c.totalValue)), + BigNumber.from("0") + ) + .toString() + : "0"; +}; + +const getV3TVL = async (block) => { + // Get Current CMs + const creditManagers = await getCreditManagersV3(block); + // Silently throw if no CAs available if (!creditManagers[0]) return []; // Get all CA Balances const caValues = await Promise.all( - creditManagers.map((cm) => getV1CAs(cm.addr, block)) + creditManagers.map((cm) => getV3CAs(cm.addr, block)) ); return creditManagers.map((cm, i) => ({ @@ -102,14 +215,14 @@ const getV1TVL = async (block) => { const tvl = async (timestamp, block) => { // Pool TVL (Current token balances) const { poolBalances, tokensAndOwners } = await getPoolAddrs(block); - // V1 CreditAccounts TVL - const v1Balances = await getV1TVL(block); - // V2 CreditAccounts TVL in USD + // CreditAccounts TVL + const v1Balances = await getV1TVL(block); const v2Balances = await getV2TVL(block); + const v3Balances = await getV3TVL(block); // Merge all balances for each token - [...v1Balances, ...v2Balances].forEach((i) => { + [...v1Balances, ...v2Balances, ...v3Balances].forEach((i) => { sdk.util.sumSingleBalance(poolBalances, i.token, i.bal); tokensAndOwners.push([i.token, i.addr]); }); @@ -126,6 +239,6 @@ module.exports = { ethereum: { tvl, }, - methodology: `Retrieves the tokens in each Gearbox pool (WETH/DAI/WBTC/USDC/wstETH) & value of all Credit Accounts (V1 & V2) denominated in the underlying token.`, + methodology: `Retrieves the tokens in each Gearbox pool (WETH/DAI/WBTC/USDC/wstETH) & value of all Credit Accounts (V1/V2/V3) denominated in the underlying token.`, misrepresentedTokens: true, -}; \ No newline at end of file +}; From a5d9cf663b0c526403210dcad387f992d3076557 Mon Sep 17 00:00:00 2001 From: Ryu Date: Thu, 2 Nov 2023 08:59:51 +0200 Subject: [PATCH 1796/1974] Levana / Injective (#7921) * Added TVL adapter for Levana Protocol * add injective --------- Co-authored-by: lvn-savvy-dragon Co-authored-by: Levana Rusty Dragon --- projects/levana/index.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/projects/levana/index.js b/projects/levana/index.js index ea6ac19780c..34666af56c2 100644 --- a/projects/levana/index.js +++ b/projects/levana/index.js @@ -14,7 +14,7 @@ async function getMarketIds(chain, factory) { const markets = await queryContract({ contract: factory, chain: chain, - data: { 'markets': {} } + data: { markets: {} } }); return markets.markets @@ -24,7 +24,7 @@ async function getMarketAddr(chain, factory, marketId) { const marketInfo = await queryContract({ contract: factory, chain: chain, - data: { 'market_info': { 'market_id': marketId } } + data: { market_info: { market_id: marketId } } }); return marketInfo.market_addr; @@ -38,9 +38,10 @@ module.exports = { const config = { osmosis: { factory: 'osmo1ssw6x553kzqher0earlkwlxasfm2stnl3ms3ma2zz4tnajxyyaaqlucd45' }, sei: { factory: 'sei18rdj3asllguwr6lnyu2sw8p8nut0shuj3sme27ndvvw4gakjnjqqper95h' }, + injective: { factory: 'inj1vdu3s39dl8t5l88tyqwuhzklsx9587adv8cnn9' }, } -Object.keys(config).forEach(chain => { +for(const chain of Object.keys(config)) { module.exports[chain] = { tvl } -}) +} From ceb62c19e112f6a62813880cce02dd9682a81615 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 2 Nov 2023 09:08:50 +0100 Subject: [PATCH 1797/1974] onyx: minor fix --- projects/onyx/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/onyx/index.js b/projects/onyx/index.js index caf44d82db2..b59777aaa4d 100644 --- a/projects/onyx/index.js +++ b/projects/onyx/index.js @@ -18,4 +18,4 @@ module.exports = { ], }; -delete module.exports.ethereum.borrowed +module.exports.ethereum.borrowed = () => ({}) From 7eaf0ef42057a73366a1152d43b39d68ea0dc851 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 2 Nov 2023 11:47:09 +0100 Subject: [PATCH 1798/1974] fix broken adapters --- projects/ghost/index.js | 2 ++ projects/helper/chain/cosmos.js | 2 +- projects/inbuilt-finance/index.js | 5 ++--- projects/jarvis/index.js | 2 ++ projects/mayfair/index.js | 2 +- projects/palmswap/index.js | 2 +- projects/treasury/beefy.js | 14 ++++---------- 7 files changed, 13 insertions(+), 16 deletions(-) diff --git a/projects/ghost/index.js b/projects/ghost/index.js index e1cd7484fcd..b67d2f53f30 100644 --- a/projects/ghost/index.js +++ b/projects/ghost/index.js @@ -20,6 +20,7 @@ async function tvl(_, _1, _2, { api }) { const { collateral_denom } = await queryContract({ contract, chain, data: { config: {} } }) api.add(collateral_denom, deposited) } + return api.getBalances() } async function borrowed(_, _1, _2, { api }) { @@ -30,6 +31,7 @@ async function borrowed(_, _1, _2, { api }) { const { denom } = await queryContract({ contract, chain, data: { config: {} } }) api.add(denom, borrowed) } + return api.getBalances() } module.exports = { diff --git a/projects/helper/chain/cosmos.js b/projects/helper/chain/cosmos.js index e8312daa787..f2865562f20 100644 --- a/projects/helper/chain/cosmos.js +++ b/projects/helper/chain/cosmos.js @@ -13,7 +13,7 @@ const endPoints = { crescent: "https://mainnet.crescent.network:1317", osmosis: "https://osmosis-api.polkachu.com", cosmos: "https://cosmoshub-lcd.stakely.io", - kujira: "https://lcd-kujira.whispernode.com:443", + kujira: "https://kuji-api.kleomedes.network", comdex: "https://rest.comdex.one", terra: "https://terra-classic-lcd.publicnode.com", terra2: "https://terra-lcd.publicnode.com", diff --git a/projects/inbuilt-finance/index.js b/projects/inbuilt-finance/index.js index c50b8bac679..bcd7649f0bb 100644 --- a/projects/inbuilt-finance/index.js +++ b/projects/inbuilt-finance/index.js @@ -1,9 +1,8 @@ -const ADDRESSES = require('../helper/coreAssets.json') +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokensExport } = require("../helper/unwrapLPs"); const token_USDC = ADDRESSES.telos.ETH; const token_USDT = ADDRESSES.moonriver.USDT; -const token_Knit_KFT = ADDRESSES.kava.KFT; const masterchef = "0x68DB81eAB568174D54F3fd0d9e035eDe9AAEd3e2"; module.exports = { @@ -14,7 +13,7 @@ module.exports = { }), staking: sumTokensExport({ owner: masterchef, - tokens: [token_Knit_KFT] + tokens: ['0xa0eeda2e3075092d66384fe8c91a1da4bca21788'] }) } } diff --git a/projects/jarvis/index.js b/projects/jarvis/index.js index 236a7b7767a..3332083b703 100644 --- a/projects/jarvis/index.js +++ b/projects/jarvis/index.js @@ -100,6 +100,8 @@ async function tvl(timestamp, ethBlock, chainBlocks, { api, }) { const blacklistedPools = [ '0x63B5891895A57C31d5Ec2a8A5521b6EE67700f9F', '0x1493607042C5725cEf277A83CFC94caA4fc6278F', + '0xBC988A0146178825C26c255989cfd5083Bae672C', + '0x8FEceC5629EED60D18Fd3438aae4a8E69723D190', ].map(i => i.toLowerCase()) const calls = liquidityPools.filter(i => !blacklistedPools.includes(i.toLowerCase())).map(a => ({ target: a })) const collateralTokens = await api.multiCall({ diff --git a/projects/mayfair/index.js b/projects/mayfair/index.js index 191602a0f1e..e5bac1b6dfa 100644 --- a/projects/mayfair/index.js +++ b/projects/mayfair/index.js @@ -3,7 +3,7 @@ const { cachedGraphQuery } = require('../helper/cache') const { toUSDTBalances } = require("../helper/balances") -const url = "https://squid.subsquid.io/mayfair-indexer/graphql" +const url = "https://squid.subsquid.io/mayfairfund-api/v/v1/graphql" async function getStakingData() { return await request(url, `query StakingAnalytics { diff --git a/projects/palmswap/index.js b/projects/palmswap/index.js index d3218c990ae..dad8a7a9dc4 100644 --- a/projects/palmswap/index.js +++ b/projects/palmswap/index.js @@ -8,7 +8,7 @@ const palmToken = "0x29745314B4D294B7C77cDB411B8AAa95923aae38"; //PALM token add module.exports = { bsc: { - tvl: gmxExports({ vault: palmswapVault }), + tvl: gmxExports({ vault: palmswapVault, blacklistedTokens: ['0xaeeff2e9388a578c02754cd08699652fb76035c7'] }), staking: staking(palmTokenStakingContract, palmToken), }, }; diff --git a/projects/treasury/beefy.js b/projects/treasury/beefy.js index fd0004accf5..2db6a335874 100644 --- a/projects/treasury/beefy.js +++ b/projects/treasury/beefy.js @@ -1,6 +1,5 @@ const { getConfig } = require('../helper/cache') const { sumTokens2, nullAddress, } = require('../helper/unwrapLPs') -const sdk = require('@defillama/sdk') const chains = [ "fuse", @@ -40,9 +39,6 @@ async function _getConfig() { return config } -module.exports = { -}; - chains.forEach(chain => { module.exports[chain] = { tvl: async (_, _b, _cb, { api, }) => { @@ -51,15 +47,13 @@ chains.forEach(chain => { const uniV3Owners = [] const ownerTokens = Object.entries(data) .filter(i => { - if (i[0] !== 'validator') return true - api.add(nullAddress, i[1].balances.validator.balance) + if (!i[0] || !i[0].includes('validator') ) return true + api.add(nullAddress, i[1].balances[i[0]].balance) }) .map(([owner, { balances }]) => { - const tokens = Object.entries(balances).filter(([_, info]) => info.name !== 'BIFI').map(i => i[0] === 'native' ? nullAddress : i[0]) - if (Object.keys(balances).some(i => i.toLowerCase() === '0x8e295789c9465487074a65b1ae9ce0351172393f')) - uniV3Owners.push(owner) - + const tokens = Object.entries(balances).filter(([_, info]) => info.name !== 'BIFI' && info.assetType !== 'concLiquidity').map(i => i[0] === 'native' ? nullAddress : i[0]) + Object.values(balances).filter(info => info.assetType === 'concLiquidity').map(i=> uniV3Owners.push(i.address)) return [tokens, owner] }) if (uniV3Owners.length) await sumTokens2({ api, owners: uniV3Owners, resolveUniV3: true, }) From 3a58426982ce4f82990c91647585a6c8da52d19b Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 2 Nov 2023 12:00:42 +0100 Subject: [PATCH 1799/1974] update zeroliquid --- projects/zeroliquid/index.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/projects/zeroliquid/index.js b/projects/zeroliquid/index.js index 4a852f87fed..7eb505f0176 100644 --- a/projects/zeroliquid/index.js +++ b/projects/zeroliquid/index.js @@ -1,15 +1,16 @@ const { staking } = require('../helper/staking') -const ADDRESSES = require('../helper/coreAssets.json') -const { sumTokensExport } = require('../helper/unwrapLPs') + +async function tvl(_, _b, _cb, { api, }) { + const vault = '0x0246e28C6B161764492E54CBF852e28A4DA2D672' + const tokens = await api.call({ abi: 'address[]:getSupportedYieldTokens', target: vault }) + return api.sumTokens({ owner: vault, tokens, }) +} module.exports = { methodology: 'Value of LSD tokens in the vault', ethereum: { - tvl: sumTokensExport({ - owner: '0x0246e28C6B161764492E54CBF852e28A4DA2D672', - tokens: [ADDRESSES.ethereum.WSTETH, ADDRESSES.ethereum.RETH, ADDRESSES.ethereum.sfrxETH], - }), + tvl, staking: staking("0xb9b2d7a712402acb37a97f0ea6356ff271e065e2", '0xb0ed33f79d89541dfdcb04a8f04bc2c6be025ecc') } -}; +}; From 1506eff190d6166be923d75e834ba31b3d86968a Mon Sep 17 00:00:00 2001 From: Define101 Date: Thu, 2 Nov 2023 11:48:46 +0000 Subject: [PATCH 1800/1974] add hallmark prisma --- projects/prisma/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/prisma/index.js b/projects/prisma/index.js index 20ffedf8dee..8a4247cc355 100644 --- a/projects/prisma/index.js +++ b/projects/prisma/index.js @@ -4,6 +4,9 @@ const config = { ethereum: { factory: '0x70b66e20766b775b2e9ce5b718bbd285af59b7e1', fromBlock: 18029801, }, } +module.exports.hallmarks = [ + [1698922200,"Justin Sun Deposited"] +], Object.keys(config).forEach(chain => { const { factory, fromBlock, } = config[chain] module.exports[chain] = { From dc7610912cc38ddda988b6d1f25c57fb01ca524d Mon Sep 17 00:00:00 2001 From: Philipp Date: Thu, 2 Nov 2023 12:54:09 +0100 Subject: [PATCH 1801/1974] ERIS: add new farms, ampmnta and amproar (#7926) * add new farms, ampmnta and amproar * Update index.js --- projects/eris-protocol/index.js | 39 ++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/projects/eris-protocol/index.js b/projects/eris-protocol/index.js index f4dbfe69038..dc9d20d7a90 100644 --- a/projects/eris-protocol/index.js +++ b/projects/eris-protocol/index.js @@ -34,6 +34,10 @@ const config = { "terra1zsm7cgu3vg2kwwzzehl38ft7z2ffksql9d6twh3pugvf0yl0u5vs74xx55", "terra1yfmpzj79n8g356kp6xz0rkjehegwqw7zhus8jzreqvec5ay9a7kqs7a6hc", "terra10wsuv79k03gplmcx22j4lxauca4t2a0p4q83fyuv54w88e7ccm0qxkme4l", + "terra176e78qnvvclrlrmuyjaqxsy72zp2m3szshljdxakdsmr33zulumqa3hr9d", + "terra1pvn5up4n4ttmdatvpxa8t2klpcy2u5t5nmyclv30yz8xmphjxlrqgqwxv6", + "terra1a3k77cgja875f6ffdsflxtaft570em82te4suw9nfhx77u6dqh8qykuq6f", + "terra1m64fmenadmpy7afp0675jrkz9vs0cq97mgzzpzg0klgc4ahgylms7gvnt5", ], coinGeckoMap: { "ibc/B3504E092456BA618CC28AC671A71FB08C6CA0FD0BE7C8A5B5A3E2DD933CC9E4": @@ -66,6 +70,13 @@ const config = { origChain: "migaloo", }, ], + daos: [ + { + contract: + "terra1vklefn7n6cchn0u962w3gaszr4vf52wjvd4y95t2sydwpmpdtszsqvk9wy", + coinGeckoId: "lion-dao", + }, + ], }, terra: { coinGeckoId: "terra-luna", @@ -78,6 +89,17 @@ const config = { "kujira1mxzfcxpn6cjx4u9zln6ttxuc6fuw6g0cettd6nes74vrt2f22h4q3j5cdz", ampToken: "factory/kujira1n3fr5f56r2ce0s37wdvwrk98yhhq3unnxgcqus8nzsfxvllk0yxquurqty/ampKUJI", + coinGeckoMap: { + "factory/kujira175yatpvkpgw07w0chhzuks3zrrae9z9g2y6r7u5pzqesyau4x9eqqyv0rr/ampMNTA": + "mantadao", + }, + daos: [ + { + contract: + "kujira175yatpvkpgw07w0chhzuks3zrrae9z9g2y6r7u5pzqesyau4x9eqqyv0rr", + coinGeckoId: "mantadao", + }, + ], }, juno: { coinGeckoId: "juno-network", @@ -90,7 +112,6 @@ const config = { "migaloo1hntfu45etpkdf8prq6p6la9tsnk3u3muf5378kds73c7xd4qdzysuv567q", ampToken: "factory/migaloo1436kxs0w2es6xlqpp9rd35e3d0cjnw4sv8j3a7483sgks29jqwgshqdky4/ampWHALE", - // currently not running due to node simulation gas issues arbVault: "migaloo1ey4sn2mkmhew4pdrzk90l9acluvas25qlhuvsfgssw42ugz8yjlqx92j9l", }, @@ -199,6 +220,21 @@ async function tasset2Tvl(chain, tasset) { }; } +async function dao2Tvl(chain, dao) { + let contract = dao.contract; + let coinGeckoId = dao.coinGeckoId; + + let state = await getState(chain, contract); + + let chainConfig = config[chain]; + + let tvl = +(state.tvl_utoken ?? 0) / getDecimalFactor(chainConfig); + + return { + [coinGeckoId]: tvl, + }; +} + function getDecimalFactor(chainConfig) { let decimals = chainConfig.decimals ?? 6; return Math.pow(10, decimals); @@ -344,6 +380,7 @@ async function productsTvl(chain) { tvlAmpGovernance(chain, state), tvlArbVault(chain).catch((a) => ({})), ...(chainConfig.tassets ?? []).map((tasset) => tasset2Tvl(chain, tasset)), + ...(chainConfig.daos ?? []).map((dao) => dao2Tvl(chain, dao)), ...(chainConfig.farms ?? []).map((farm) => farm2Tvl(chain, farm)), ]); } catch (error) { From 610c494782d8131c0636e8dd257a2a7cb8640231 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vuka=C5=A1in=20Manojlovi=C4=87?= Date: Thu, 2 Nov 2023 12:54:26 +0100 Subject: [PATCH 1802/1974] Add Nostra Mainnet launch hallmark (#7925) --- projects/nostra/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/nostra/index.js b/projects/nostra/index.js index ceed96ca7ab..95bcd803474 100644 --- a/projects/nostra/index.js +++ b/projects/nostra/index.js @@ -81,4 +81,7 @@ module.exports = { tvl, borrowed, }, + hallmarks: [ + [1697634000, "Nostra Mainnet launch"], + ] }; From 2189b2375f9f32132c947ae6bb6bf7e6e90e5d84 Mon Sep 17 00:00:00 2001 From: magicMax007 <118804823+magicMax007@users.noreply.github.com> Date: Thu, 2 Nov 2023 19:54:48 +0800 Subject: [PATCH 1803/1974] update astarter dex contract (#7924) Co-authored-by: magic --- projects/astarter-dex/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/astarter-dex/index.js b/projects/astarter-dex/index.js index 67f3e8201ed..6e8153dae11 100644 --- a/projects/astarter-dex/index.js +++ b/projects/astarter-dex/index.js @@ -1,7 +1,7 @@ const { sumTokens2 } = require("../helper/chain/cardano"); -const DEX_BATHCER_SCRIPT = "addr1wxvf6xqa3jkq9cnyjnf7t4v6aku75rn3l3mlhe9udp4dnwcjscuah"; -const DEX_POOL_SCRIPT = "addr1wxe4dwl0jmmchjnd049t5ur7lc4jmhcjax8ht393evxcjsgeccdeu"; +const DEX_BATHCER_SCRIPT = "addr1wxz9n9rwqfld9ahctdjl3ldhsck22vsuuwmmv8mpsll74lgue5r6h"; +const DEX_POOL_SCRIPT = "addr1w896t3nhplnmxr4ur73j7qvn3s2s2yepzdsda536cahrdvcq37n5x"; async function tvl() { return sumTokens2({ scripts: [DEX_BATHCER_SCRIPT, DEX_POOL_SCRIPT], blacklistedTokens: [ From 31c2592963db471fbdd006c7033d99cfe4f11774 Mon Sep 17 00:00:00 2001 From: Define101 Date: Thu, 2 Nov 2023 12:36:18 +0000 Subject: [PATCH 1804/1974] add robinhood cex --- projects/robinhood/index.js | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 projects/robinhood/index.js diff --git a/projects/robinhood/index.js b/projects/robinhood/index.js new file mode 100644 index 00000000000..4f5d002ceb3 --- /dev/null +++ b/projects/robinhood/index.js @@ -0,0 +1,30 @@ +const { cexExports } = require('../helper/cex') + +const config = { + ethereum: { + owners: [ + "0x6081258689a75d253d87cE902A8de3887239Fe80", + "0x40b38765696e3d5d8d9d834d8aad4bb6e418e489", + ], + }, + bitcoin: { + owners: [ + "bc1qprdf80adfz7aekh5nejjfrp3jksc8r929svpxk", + "bc1qmxcagqze2n4hr5rwflyfu35q90y22raxdgcp4p", + "bc1ql49ydapnjafl5t2cp9zqpjwe6pdgmxy98859v2" + ], + }, + polygon: { + owners: [ + "0x6081258689a75d253d87cE902A8de3887239Fe80", + ], + }, + avax: { + owners: [ + "0x6081258689a75d253d87cE902A8de3887239Fe80", + "0x40b38765696e3d5d8d9d834d8aad4bb6e418e489", + ], + }, +} + +module.exports = cexExports(config) From 18bba5d9c563ea39030c183975abecf138a76b02 Mon Sep 17 00:00:00 2001 From: HiMarketSoFi <149686716+HiMarketSoFi@users.noreply.github.com> Date: Thu, 2 Nov 2023 17:46:21 +0300 Subject: [PATCH 1805/1974] Add hi.market (#7931) * Create index.js Hi.market SoFi * refactor code --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/hi-market/index.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 projects/hi-market/index.js diff --git a/projects/hi-market/index.js b/projects/hi-market/index.js new file mode 100644 index 00000000000..d1f85192631 --- /dev/null +++ b/projects/hi-market/index.js @@ -0,0 +1,20 @@ +const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') + +const contract = "0xf76550821b62702e95e181aeb77284ce70d4fe90" +const contract_era = "0x4Abb1bFcFb2af3d897B891DA265d94fb6C02B005" + +async function tvl(time, ethBlock, _b, { api }) { + return sumTokens2({ tokens: [nullAddress], owner: contract, api }) +} + +async function tvl_era(time, ethBlock, _b, { api }) { + return sumTokens2({ tokens: [nullAddress], owner: contract_era, api }) +} + +module.exports = { + methodology: `We count the ETH locked in the contracts`, + ethereum: { tvl }, + base: { tvl }, + arbitrum: { tvl }, + era: { tvl: tvl_era }, +} From 63f39260631ffe2edb693890aa97064963e54686 Mon Sep 17 00:00:00 2001 From: Aleksei Lushnikov Date: Thu, 2 Nov 2023 14:53:02 +0000 Subject: [PATCH 1806/1974] symbiosis adds Manta chain support (#7933) --- projects/symbiosis-finance/config.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/projects/symbiosis-finance/config.js b/projects/symbiosis-finance/config.js index 4b57d7d686f..7ca2975fb76 100644 --- a/projects/symbiosis-finance/config.js +++ b/projects/symbiosis-finance/config.js @@ -223,5 +223,14 @@ module.exports = { '0x5Aa5f7f84eD0E5db0a4a85C3947eA16B53352FD4', // portal v2 ] }, + { + name: 'manta', + tokens: [ + ADDRESSES.manta.WETH, + ], + holders: [ + '0x5Aa5f7f84eD0E5db0a4a85C3947eA16B53352FD4', // portal v2 + ] + }, ] } \ No newline at end of file From 443545ef60e1f7d05336d9a0ba15c835874b932e Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 2 Nov 2023 16:20:28 +0100 Subject: [PATCH 1807/1974] update steer --- projects/steer/index.js | 56 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 54 insertions(+), 2 deletions(-) diff --git a/projects/steer/index.js b/projects/steer/index.js index a3c8efb2cbb..b80b60ef81a 100644 --- a/projects/steer/index.js +++ b/projects/steer/index.js @@ -1,4 +1,5 @@ const { cachedGraphQuery } = require('../helper/cache') +const { staking } = require("../helper/staking"); const supportedChains = [ { @@ -56,7 +57,56 @@ const supportedChains = [ chainId: 2222, merkle: false, identifier: 'kava' - } + }, + { + name: 'Base', + subgraphEndpoint: 'https://subgraph.satsuma-prod.com/769a117cc018/steer/steer-protocol-base/api', + chainId: 8453, + merkle: false, + identifier: 'base' + }, + // { + // name: 'Linea', + // subgraphEndpoint: 'https://subgraph.steer.finance/linea/subgraphs/name/steerprotocol/steer-linea/graphql', + // chainId: 59144, + // merkle: false, + // identifier: 'linea' + // }, + { + name: 'Metis', + subgraphEndpoint: 'https://subgraph.satsuma-prod.com/769a117cc018/steer/steer-protocol-metis/api', + chainId: 1088, + merkle: false, + identifier: 'metis' + }, + // { + // name: 'Manta', + // subgraphEndpoint: 'https://subgraph.steer.finance/manta/subgraphs/name/steerprotocol/steer-manta/graphql', + // chainId: 169, + // merkle: false, + // identifier: 'manta' + // }, + // { + // name: 'PolygonZKEVM', + // subgraphEndpoint: 'https://subgraph.steer.finance/zkevm/subgraphs/name/steerprotocol/steer-zkevm', + // chainId: 1101, + // merkle: false, + // identifier: 'polyzkevm' + // }, + // { + // name: 'Scroll', + // subgraphEndpoint: 'https://subgraph.steer.finance/scroll/subgraphs/name/steerprotocol/steer-scroll/graphql', + // chainId: 534352, + // merkle: false, + // identifier: 'scroll' + // }, + // { + // name: 'Celo', + // subgraphEndpoint: 'https://api.thegraph.com/subgraphs/name/rakeshbhatt10/steer-test-celo', + // chainId: 42220, + // merkle: false, + // identifier: 'celo' + // }, ] @@ -87,4 +137,6 @@ supportedChains.forEach(chain => { return api.getBalances() } } -}) \ No newline at end of file +}) + +module.exports.arbitrum.staking = staking("0xB10aB1a1C0E3E9697928F05dA842a292310b37f1", "0x1C43D05be7E5b54D506e3DdB6f0305e8A66CD04e", "arbitrum") \ No newline at end of file From 7c5cf7b10d6e52512c4d2382590fd895c997afa8 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 2 Nov 2023 16:41:44 +0100 Subject: [PATCH 1808/1974] Xave (#7934) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: add xave-finance to projects * minor fix --------- Co-authored-by: José Ribeiro --- projects/xave-finance/index.js | 67 ++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 projects/xave-finance/index.js diff --git a/projects/xave-finance/index.js b/projects/xave-finance/index.js new file mode 100644 index 00000000000..e839c98533d --- /dev/null +++ b/projects/xave-finance/index.js @@ -0,0 +1,67 @@ +const { getLogs } = require('../helper/cache/getLogs') + +async function tvl(_, _b, _cb, { api }) { + const factories = config[api.chain] + + const promises = factories.map(async ({ factory, fromBlock }) => { + const logs = await getLogs({ + api, + target: factory, + eventAbi: 'event NewFXPool(address indexed caller, bytes32 indexed id, address indexed fxpool)', + onlyArgs: true, + fromBlock, + }) + + const pools = logs.map((i) => i.fxpool) + const poolIds = await api.multiCall({ + abi: 'function getPoolId() view returns (bytes32)', + calls: pools, + }) + const vaults = await api.multiCall({ + abi: 'address:getVault', + calls: pools, + }) + + const data = await api.multiCall({ + abi: 'function getPoolTokens(bytes32 poolId) view returns (address[] tokens, uint256[] balances, uint256 lastChangeBlock)', + calls: poolIds.map((v, i) => ({ target: vaults[i], params: v })), + }) + + data.forEach((i) => api.addTokens(i.tokens, i.balances)) + }) + await Promise.all(promises) + return api.getBalances() +} + +module.exports = { + methodology: 'sum of all the tokens locked in FX Pools', + doublecounted: true, // tokens are stored in balancer vaults +} + +const config = { + polygon: [ + { + name: 'FX Pool Factory', + factory: '0x627D759314D5c4007b461A74eBaFA7EBC5dFeD71', + fromBlock: 32054794, + } + ], + ethereum: [ + { + name: 'FX Pool Factory', + factory: '0x81fE9e5B28dA92aE949b705DfDB225f7a7cc5134', + fromBlock: 15981805, + }, + ], + avax: [ + { + name: 'FX Pool Factory', + factory: '0x81fE9e5B28dA92aE949b705DfDB225f7a7cc5134', + fromBlock: 32585313, + }, + ] +} + +Object.keys(config).forEach((chain) => { + module.exports[chain] = { tvl } +}) From 8db543d3df25645881066ebc9717478ef8dd1902 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 2 Nov 2023 17:26:10 +0100 Subject: [PATCH 1809/1974] update gyro --- projects/gyroscope/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/gyroscope/index.js b/projects/gyroscope/index.js index f2890e07d76..ea88d45ec87 100644 --- a/projects/gyroscope/index.js +++ b/projects/gyroscope/index.js @@ -1,4 +1,5 @@ const { getLogs } = require('../helper/cache/getLogs') +module.exports.doublecounted = true async function tvl(_, _b, _cb, { api }) { const pools = config[api.chain] From 45680962205fefca426bd2e6d7a2e21710a91709 Mon Sep 17 00:00:00 2001 From: Thomas Clement Date: Thu, 2 Nov 2023 13:51:25 -0400 Subject: [PATCH 1810/1974] Update index.js --- projects/ondofinance/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/ondofinance/index.js b/projects/ondofinance/index.js index 699e1b2cbe2..7301562ba97 100644 --- a/projects/ondofinance/index.js +++ b/projects/ondofinance/index.js @@ -13,6 +13,9 @@ const config = { }, polygon: { OUSG: '0xbA11C5effA33c4D6F8f593CFA394241CfE925811', + }, + mantle: { + USDY: "0x5bE26527e817998A7206475496fDE1E68957c5A6", } } From 6a45228477caffa08dc5b39b2bdf8ff7a27fa722 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 2 Nov 2023 20:04:34 +0100 Subject: [PATCH 1811/1974] Baki (#7524) * added file * created the baki adapter * created the baki adapter * created the baki adapter * code refactor * minor fix --------- Co-authored-by: Sir Deon Co-authored-by: g1nt0ki --- projects/baki/index.js | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 projects/baki/index.js diff --git a/projects/baki/index.js b/projects/baki/index.js new file mode 100644 index 00000000000..ff6c4e1db4a --- /dev/null +++ b/projects/baki/index.js @@ -0,0 +1,10 @@ +const bakiAddress = "0x98e76679064d50a45647c452a0b2c4cb1137f28c"; +const { sumTokensExport } = require('../helper/unwrapLPs') +const ADDRESSES = require('../helper/coreAssets.json') + +module.exports = { + methodology: "The baki protocol keeps track of the total collateral locked in the vault", + avax: { + tvl: sumTokensExport({ owner: bakiAddress, tokens: [ADDRESSES.avax.USDC] }) + }, +}; From 04bf133b49adc45e885309db76963c0af62d9b50 Mon Sep 17 00:00:00 2001 From: Define101 Date: Thu, 2 Nov 2023 19:34:25 +0000 Subject: [PATCH 1812/1974] add turnup and chat3 --- projects/chat3/index.js | 14 ++++++++++++++ projects/turnup/index.js | 14 ++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 projects/chat3/index.js create mode 100644 projects/turnup/index.js diff --git a/projects/chat3/index.js b/projects/chat3/index.js new file mode 100644 index 00000000000..790cf0b7d70 --- /dev/null +++ b/projects/chat3/index.js @@ -0,0 +1,14 @@ +const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') + +const contract = "0xAd3dbD09835CF15c543Bc59d31865D659b71060e" + +async function tvl(time, ethBlock, _b, {api}) { + return sumTokens2({ tokens: [nullAddress], owner: contract, api }) +} + +module.exports = { + methodology: `We count the MNT on ${contract}`, + mantle: { + tvl + } +} \ No newline at end of file diff --git a/projects/turnup/index.js b/projects/turnup/index.js new file mode 100644 index 00000000000..51a7eb64c87 --- /dev/null +++ b/projects/turnup/index.js @@ -0,0 +1,14 @@ +const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') + +const contract = "0x5d9388a4ea9ebfc4af8c71c0b4aa3b372fefe12b" + +async function tvl(time, ethBlock, _b, {api}) { + return sumTokens2({ tokens: [nullAddress], owner: contract, api }) +} + +module.exports = { + methodology: `We count the ETH on ${contract}`, + bsc: { + tvl + } +} \ No newline at end of file From eb00fb73e0a544f17c2077bf79bb7947a959b1b0 Mon Sep 17 00:00:00 2001 From: Define101 Date: Thu, 2 Nov 2023 19:35:08 +0000 Subject: [PATCH 1813/1974] typo --- projects/turnup/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/turnup/index.js b/projects/turnup/index.js index 51a7eb64c87..2a74870e54a 100644 --- a/projects/turnup/index.js +++ b/projects/turnup/index.js @@ -7,7 +7,7 @@ async function tvl(time, ethBlock, _b, {api}) { } module.exports = { - methodology: `We count the ETH on ${contract}`, + methodology: `We count the BNB on ${contract}`, bsc: { tvl } From d63128f63af36fe02ab95fac404e7b537d59cdaa Mon Sep 17 00:00:00 2001 From: bryansniyve <134277602+bryansniyve@users.noreply.github.com> Date: Fri, 3 Nov 2023 14:19:16 +0800 Subject: [PATCH 1814/1974] feat: add manta network support (#7937) Co-authored-by: bryan.y --- projects/apollox/index.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/projects/apollox/index.js b/projects/apollox/index.js index 21a8c113b36..0211edd5b5b 100644 --- a/projects/apollox/index.js +++ b/projects/apollox/index.js @@ -97,4 +97,11 @@ module.exports = { ADDRESSES.era.USDC, ]}) }, + manta: { + tvl: sumTokensExport({ owner: '0xbad4ccc91ef0dfffbcab1402c519601fbaf244ef', tokens: [ + nullAddress, + ADDRESSES.manta.USDC, + ADDRESSES.manta.USDC, + ]}) + }, }; From 460234bee11edb6ad0c6937ddbff98dad91cc912 Mon Sep 17 00:00:00 2001 From: miler012 <124125686+miler012@users.noreply.github.com> Date: Fri, 3 Nov 2023 14:24:58 +0800 Subject: [PATCH 1815/1974] satori add new chain (#7938) * add zksync satori adapter * add zksync * add linea * add scroll --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/satori/index.js | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/projects/satori/index.js b/projects/satori/index.js index 2b912740f09..0de30e774f9 100644 --- a/projects/satori/index.js +++ b/projects/satori/index.js @@ -1,4 +1,5 @@ -const ADDRESSES = require('../helper/coreAssets.json') + +const ADDRESSES = require("../helper/coreAssets.json"); const { sumTokensExport } = require("../helper/unwrapLPs"); const USDT_TOKEN_CONTRACT = "0x1E4a5963aBFD975d8c9021ce480b42188849D41d"; @@ -10,7 +11,10 @@ module.exports = { methodology: "TVL includes the total token value inside the protocol's liquidity pools.", polygon_zkevm: { - tvl: sumTokensExport({ owners: WALLET_ADDR, tokens: [USDT_TOKEN_CONTRACT]}), + tvl: sumTokensExport({ + owners: WALLET_ADDR, + tokens: [USDT_TOKEN_CONTRACT], + }), }, era: { tvl: sumTokensExport({ @@ -29,5 +33,14 @@ module.exports = { ], tokens: [ADDRESSES.linea.USDC], }), - } + }, + scroll: { + tvl: sumTokensExport({ + owners: [ + "0xfb371E70eEB32f4054F40514924e77213ca18425", + "0xF96116e124eB3F62Ddc6a9cfbdc58d7F8A37c50A", + ], + tokens: [ADDRESSES.scroll.USDC], + }), + }, }; From 4c153d40294f9d0bc0bf4cabcf174d5be262a27e Mon Sep 17 00:00:00 2001 From: shengwenzheng Date: Fri, 3 Nov 2023 14:25:30 +0800 Subject: [PATCH 1816/1974] add staking of rangers (#7939) --- projects/ponytaswap/index.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/projects/ponytaswap/index.js b/projects/ponytaswap/index.js index ce038e7f9dc..2ca6532f5f9 100644 --- a/projects/ponytaswap/index.js +++ b/projects/ponytaswap/index.js @@ -1,11 +1,19 @@ const { getUniTVL } = require('../helper/unknownTokens') +const {staking} = require("../helper/staking"); +const pool = [ + '0x5E51E0a62121f3edDe63a45DaA178C1107EA8ee1', + '0xE32C24CA6AddEb28F28e6361c88Ca41FB24a62Bc', + '0x177b396560cDDB3876a32BEDA1887476566C1f1a' +]; +const contractAddr = '0x71d9cfd1b7adb1e8eb4c193ce6ffbe19b4aee0db'; module.exports = { misrepresentedTokens: true, rpg: { tvl: getUniTVL({ useDefaultCoreAssets: true, factory: '0x1589DD24f11e1e49566fE99744E7487CbcAb2d43', - }) + }), + staking: staking(pool,contractAddr,"rpg") } } \ No newline at end of file From 069a1dda6000056a4d0e08646b7c0cfb5ebe7a20 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 3 Nov 2023 08:19:53 +0100 Subject: [PATCH 1817/1974] Mirakle (#7942) * add mirakle project * add chain * minor fix --------- Co-authored-by: Huy Hoang --- projects/helper/coreAssets.json | 1 + projects/mirakle/index.js | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 projects/mirakle/index.js diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index 955b9466851..dc23a3a8189 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -252,6 +252,7 @@ "WFUSE": "0x0be9e53fd7edac9f859882afdda116645287c629", "USDC": "0x620fd5fa44be6af63715ef4e65ddfa0387ad13f5", "WETH": "0xa722c13135930332eb3d749b2f0906559d2c5b99", + "WBTC": "0x33284f95ccb7B948d9D352e1439561CF83d8d00d", "DAI": "0x94ba7a27c7a95863d1bdc7645ac2951e0cca06ba", "USDT": "0xfadbbf8ce7d5b7041be672561bba99f79c532e10", "KNC": "0x43b17749b246fd2a96de25d9e4184e27e09765b0", diff --git a/projects/mirakle/index.js b/projects/mirakle/index.js new file mode 100644 index 00000000000..ce492780b13 --- /dev/null +++ b/projects/mirakle/index.js @@ -0,0 +1,16 @@ +const { staking } = require('../helper/staking') +const { gmxExports } = require('../helper/gmx'); + +const fuseVault = '0x2EB12e4B1057ef2d0C300C41493B599B028dB00f'; +const fuseStaking = '0x8F7bCecC354037Bcf63DB11A336dA5d49b1316d8'; +const qiji = '0x4b9aE621E54BF1ecFe39366BCA0018d97A2D510b'; + +module.exports = { + fuse: { + staking: staking(fuseStaking, qiji), + tvl: gmxExports({ vault: fuseVault }) + }, + hallmarks: [ + [1691036559, "Mirakle Launch"] + ], +}; From ef4fe5d887280c764c6b1458b6b0a3ad4c5a8e15 Mon Sep 17 00:00:00 2001 From: kilo-dev1 <135103843+kilo-dev1@users.noreply.github.com> Date: Fri, 3 Nov 2023 15:20:28 +0800 Subject: [PATCH 1818/1974] kiloex add opbnb , manta (#7940) * fix * fix * Kiloex add opbnb,manta * minor fix --------- Co-authored-by: hao.yue Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/kiloex/index.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/projects/kiloex/index.js b/projects/kiloex/index.js index 056ed53416a..1663f5e0678 100644 --- a/projects/kiloex/index.js +++ b/projects/kiloex/index.js @@ -2,8 +2,16 @@ const ADDRESSES = require("../helper/coreAssets.json"); const { sumTokensExport } = require("../helper/unwrapLPs"); const owners = ["0x1c3f35F7883fc4Ea8C4BCA1507144DC6087ad0fb", "0xfE03be1b0504031e92eDA810374222c944351356"]; +const opbnb_owners = ["0xA2E2F3726DF754C1848C8fd1CbeA6aAFF84FC5B2", "0x1EbEd4024308afcb05E6938eF8Ebd1ec5d6E8C46"]; +const manta_owners = ["0xA2E2F3726DF754C1848C8fd1CbeA6aAFF84FC5B2", "0x1EbEd4024308afcb05E6938eF8Ebd1ec5d6E8C46"]; module.exports = { start: 1690971144, bsc: { tvl: sumTokensExport({ owners, tokens: [ADDRESSES.bsc.USDT], }) }, + op_bnb: { + tvl: sumTokensExport({ owners: opbnb_owners, tokens: [ADDRESSES.op_bnb.USDC] }) + }, + manta: { + tvl: sumTokensExport({ owners: manta_owners, tokens: [ADDRESSES.manta.USDT] }) + }, }; \ No newline at end of file From 340dbb7a8c06005b662d892a2be413b76501de3c Mon Sep 17 00:00:00 2001 From: o <5397279+0skgc@users.noreply.github.com> Date: Fri, 3 Nov 2023 17:17:58 +0900 Subject: [PATCH 1819/1974] Add LOCKON project tvl adapter (#7943) * add lockon * code refactor --------- Co-authored-by: Osamu Sekiguchi Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/lockon/index.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 projects/lockon/index.js diff --git a/projects/lockon/index.js b/projects/lockon/index.js new file mode 100644 index 00000000000..f7fd651a4c7 --- /dev/null +++ b/projects/lockon/index.js @@ -0,0 +1,14 @@ +const START_TIMESTAMP = 1690340140; // 2023-07-26T02:55:40Z +const CONTROLLER_ADDRESS = "0x153e739B8823B277844Ad885A30AC5bD9DfB6E83" + +async function tvl(timestamp, _1, _2, { api, }) { + const sets = await api.call({ abi: "address[]:getSets", target: CONTROLLER_ADDRESS, }) + const tokens = await api.multiCall({ abi: 'address[]:getComponents', calls: sets}) + const ownerTokens = sets.map((set, i) => [tokens[i], set]) + return api.sumTokens({ ownerTokens }) +} + +module.exports = { + start: START_TIMESTAMP, + polygon: { tvl } +} From 90b6cb67cbf7fc7e9e4d66ef6f700c04753754a4 Mon Sep 17 00:00:00 2001 From: Sir-Deon Date: Fri, 3 Nov 2023 09:33:00 +0100 Subject: [PATCH 1820/1974] made updates --- projects/baki/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/baki/index.js b/projects/baki/index.js index ff6c4e1db4a..d2ee2c3ea1b 100644 --- a/projects/baki/index.js +++ b/projects/baki/index.js @@ -3,7 +3,7 @@ const { sumTokensExport } = require('../helper/unwrapLPs') const ADDRESSES = require('../helper/coreAssets.json') module.exports = { - methodology: "The baki protocol keeps track of the total collateral locked in the vault", + methodology: "TVL: Total collateral deposited on Baki", avax: { tvl: sumTokensExport({ owner: bakiAddress, tokens: [ADDRESSES.avax.USDC] }) }, From 5ece3e5fc7fec1ba053b96c432a20847e812779d Mon Sep 17 00:00:00 2001 From: Sir-Deon Date: Fri, 3 Nov 2023 09:33:27 +0100 Subject: [PATCH 1821/1974] Updated project methodology --- projects/baki/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/baki/index.js b/projects/baki/index.js index d2ee2c3ea1b..3ca45f1bd13 100644 --- a/projects/baki/index.js +++ b/projects/baki/index.js @@ -3,7 +3,7 @@ const { sumTokensExport } = require('../helper/unwrapLPs') const ADDRESSES = require('../helper/coreAssets.json') module.exports = { - methodology: "TVL: Total collateral deposited on Baki", + methodology: "TVL: Total collateral deposited on Baki ", avax: { tvl: sumTokensExport({ owner: bakiAddress, tokens: [ADDRESSES.avax.USDC] }) }, From ed3ff892d3a4bd925cdba5c1c0f6cbfaae62d969 Mon Sep 17 00:00:00 2001 From: Deon Achuo <57288805+Sir-Deon@users.noreply.github.com> Date: Fri, 3 Nov 2023 10:05:38 +0100 Subject: [PATCH 1822/1974] Update Baki methodology (#7944) * made updates * Updated project methodology --- projects/baki/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/baki/index.js b/projects/baki/index.js index ff6c4e1db4a..3ca45f1bd13 100644 --- a/projects/baki/index.js +++ b/projects/baki/index.js @@ -3,7 +3,7 @@ const { sumTokensExport } = require('../helper/unwrapLPs') const ADDRESSES = require('../helper/coreAssets.json') module.exports = { - methodology: "The baki protocol keeps track of the total collateral locked in the vault", + methodology: "TVL: Total collateral deposited on Baki ", avax: { tvl: sumTokensExport({ owner: bakiAddress, tokens: [ADDRESSES.avax.USDC] }) }, From 0dd4b5c8297e7a10a85148c6220e7486a2062b15 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 3 Nov 2023 10:21:07 +0100 Subject: [PATCH 1823/1974] fix floki treasury --- projects/treasury/flokifi-locker.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/treasury/flokifi-locker.js b/projects/treasury/flokifi-locker.js index 775541a1d2d..4cbad977ca7 100644 --- a/projects/treasury/flokifi-locker.js +++ b/projects/treasury/flokifi-locker.js @@ -18,13 +18,13 @@ module.exports = treasuryExports({ "0x1BD708E01E96d426652b0D50b8c896eaeefee36d" ], owners: [treasuryETH, treasuryETH2], - ownTokens: [flokiETH], + ownTokens: [flokiETH, '0x4507cef57c46789ef8d1a19ea45f4216bae2b528'], }, bsc: { tokens: [ nullAddress, ], owners: [treasuryBSC], - ownTokens: [flokiBSC], + ownTokens: [flokiBSC, '0x4507cef57c46789ef8d1a19ea45f4216bae2b528'], }, }) \ No newline at end of file From ea67ab1701029cec56ef7df6f4aa44204f2e55ec Mon Sep 17 00:00:00 2001 From: aloksGithub <87710508+aloksGithub@users.noreply.github.com> Date: Fri, 3 Nov 2023 18:11:52 +0800 Subject: [PATCH 1824/1974] Rumi tvl adapter (#7945) * Rumi tvl adapter * code refactor: slip borrowed tokens from tvl * update orderly --------- Co-authored-by: Alok Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/orderly-network/index.js | 10 ++++++++++ projects/rumi/index.js | 21 +++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 projects/rumi/index.js diff --git a/projects/orderly-network/index.js b/projects/orderly-network/index.js index 5c1a5b8d829..6a551fc44ab 100644 --- a/projects/orderly-network/index.js +++ b/projects/orderly-network/index.js @@ -17,11 +17,21 @@ async function tvl() { return balances; } +async function arbi_tvl(_, _b, _cb, { api, }) { + const contract = '0x816f722424B49Cf1275cc86DA9840Fbd5a6167e9' + const hashes = await api.call({ abi: 'function getAllAllowedToken() view returns (bytes32[])', target: contract }) + const tokens = await api.multiCall({ abi: 'function getAllowedToken(bytes32) view returns (address)', calls: hashes, target: contract }) + return api.sumTokens({ owner: contract, tokens }) +} + module.exports = { timetravel: false, near: { tvl, }, + arbitrum: { + tvl: arbi_tvl, + }, methodology: 'Summed up all the tokens deposited into Orderly Network' } diff --git a/projects/rumi/index.js b/projects/rumi/index.js new file mode 100644 index 00000000000..79ce6b4cb0c --- /dev/null +++ b/projects/rumi/index.js @@ -0,0 +1,21 @@ +const addressProvider = "0xFf6c50B43382f2531FEF7d6382cCe1263B0585f1" + +async function tvl(_, _1, _2, { api }) { + const lendVaultAddress = await api.call({ abi: 'address:lendVault', target: addressProvider, }); + const tokens = await api.call({ abi: "address[]:getSupportedTokens", target: lendVaultAddress, }); + + const vaults = await api.call({ abi: "address[]:getVaults", target: addressProvider, }); + const vTokens = await api.multiCall({ abi: "address:depositToken", calls: vaults, }); + const vBals = await api.multiCall({ abi: "uint256:balance", calls: vaults, }); + api.addTokens(vTokens, vBals) + + return api.sumTokens({ owner: lendVaultAddress, tokens }) +} + +module.exports = { + methodology: 'Total asset value held in the Rumi lend vault and Rumi strategies', + start: 143884813, + arbitrum: { + tvl, + } +}; \ No newline at end of file From b0addb4d0db42ab9de298363f76789564582b291 Mon Sep 17 00:00:00 2001 From: bryansniyve <134277602+bryansniyve@users.noreply.github.com> Date: Fri, 3 Nov 2023 18:12:13 +0800 Subject: [PATCH 1825/1974] fix: bug of Manta tvl (#7946) Co-authored-by: bryan.y --- projects/apollox/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/apollox/index.js b/projects/apollox/index.js index 0211edd5b5b..2e14a7c9d93 100644 --- a/projects/apollox/index.js +++ b/projects/apollox/index.js @@ -101,7 +101,7 @@ module.exports = { tvl: sumTokensExport({ owner: '0xbad4ccc91ef0dfffbcab1402c519601fbaf244ef', tokens: [ nullAddress, ADDRESSES.manta.USDC, - ADDRESSES.manta.USDC, + ADDRESSES.manta.USDT, ]}) }, }; From 423fde4518dd205e5fc49f62f53395692211c99b Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 3 Nov 2023 11:24:09 +0100 Subject: [PATCH 1826/1974] minor fix --- projects/stakedotlink/index.js | 38 ++++++++++------------------------ 1 file changed, 11 insertions(+), 27 deletions(-) diff --git a/projects/stakedotlink/index.js b/projects/stakedotlink/index.js index e0e1ea453f2..0a75af05b98 100644 --- a/projects/stakedotlink/index.js +++ b/projects/stakedotlink/index.js @@ -1,5 +1,4 @@ const ADDRESSES = require('../helper/coreAssets.json') -const sdk = require("@defillama/sdk"); const sdlToken = "0xA95C5ebB86E0dE73B4fB8c47A45B792CFeA28C23"; const sdlStakingPool = "0x0B2eF910ad0b34bf575Eb09d37fd7DA6c148CA4d"; @@ -7,34 +6,19 @@ const linkToken = ADDRESSES.ethereum.LINK; const linkStakingPool = "0xb8b295df2cd735b15BE5Eb419517Aa626fc43cD5"; const linkPriorityPool = "0xDdC796a66E8b83d0BcCD97dF33A6CcFBA8fd60eA"; - -async function tvl(timestamp, ethBlock, chainBlocks) { - const stakedLINK = await sdk.api.abi.call({ - block: ethBlock, - target: linkStakingPool, - abi: "uint256:totalStaked", - }); - const ppLINK = await sdk.api.abi.call({ - block: ethBlock, - target: linkPriorityPool, - abi: "uint256:totalQueued", - }); - - return { - [linkToken]: BigInt(stakedLINK.output) + BigInt(ppLINK.output), - }; +async function tvl(timestamp, ethBlock, chainBlocks, { api}) { + const bals = await Promise.all([ + api.call({ target: linkStakingPool, abi: 'uint256:totalStaked', }), + api.call({ target: linkPriorityPool, abi: 'uint256:totalQueued', }), + ]) + bals.forEach(i => api.add(linkToken, i)) + return api.getBalances() } -async function staking(timestamp, ethBlock, chainBlocks) { - const stakedSDL = await sdk.api.abi.call({ - block: ethBlock, - target: sdlStakingPool, - abi: "uint256:totalStaked", - }); - - return { - [sdlToken]: stakedSDL.output, - }; +async function staking(timestamp, ethBlock, chainBlocks, { api}) { + const bal = await api.call({ abi: 'uint256:totalStaked', target: sdlStakingPool}) + api.add(sdlToken, bal) + return api.getBalances() } module.exports = { From eb7546256adb9d7ebd4f7be449f04816dcd1460e Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 3 Nov 2023 11:41:53 +0100 Subject: [PATCH 1827/1974] fix ip --- projects/ip/index.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/projects/ip/index.js b/projects/ip/index.js index 953d6e5da00..ca78cc1afed 100644 --- a/projects/ip/index.js +++ b/projects/ip/index.js @@ -49,13 +49,19 @@ const cappedTokens = { async function tvl(_, _b, _cb, { api, }) { const balances = {} const count = await api.call({ abi: " function vaultsMinted() view returns (uint96)", target: VaultController }) - const vaults = await api.call({ abi: vaultSummaryAbi, target: VaultController, params: [1, count]}) + const calls = [] + for (let i = 1; i <= count; i++) + calls.push({ params: [i, i]}) + + const vaults = (await api.multiCall({ abi: vaultSummaryAbi, target: VaultController, calls, permitFailure: true })).filter(i => i).flat() + vaults.map(vault => { vault.tokenAddresses.map((token, i) => { token = cappedTokens[token]?.address || token sdk.util.sumSingleBalance(balances,token,vault.tokenBalances[i]) }) }) + return sumTokens2({ api, balances, owner: '0x2A54bA2964C8Cd459Dc568853F79813a60761B58', tokens: [ADDRESSES.ethereum.USDC]}) } From d2574cc2cb3cef7a409b2cb7a72477c6c5e59bdc Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 3 Nov 2023 13:33:11 +0100 Subject: [PATCH 1828/1974] revert orderly change --- projects/orderly-network/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/orderly-network/index.js b/projects/orderly-network/index.js index 6a551fc44ab..7c3a1ec0c41 100644 --- a/projects/orderly-network/index.js +++ b/projects/orderly-network/index.js @@ -30,8 +30,8 @@ module.exports = { near: { tvl, }, - arbitrum: { + /* arbitrum: { tvl: arbi_tvl, - }, + }, */ methodology: 'Summed up all the tokens deposited into Orderly Network' } From 34ec12a86a78477bfb2987104c645662d7e26b4a Mon Sep 17 00:00:00 2001 From: hydtdev <148316976+hydtdev@users.noreply.github.com> Date: Fri, 3 Nov 2023 19:01:06 +0500 Subject: [PATCH 1829/1974] add tvl and farm staking (#7947) Co-authored-by: ammarsjw --- projects/hydt/index.js | 60 +++++++++++++++++++++++++++++++----------- 1 file changed, 44 insertions(+), 16 deletions(-) diff --git a/projects/hydt/index.js b/projects/hydt/index.js index 79f3979fb09..bb391226c65 100644 --- a/projects/hydt/index.js +++ b/projects/hydt/index.js @@ -1,22 +1,50 @@ -const { sumUnknownTokens } = require('../helper/unknownTokens') +const { sumUnknownTokens, nullAddress, } = require('../helper/unknownTokens'); +const { sumTokens2 } = require('../helper/unwrapLPs'); -const hydtAddress = "0x9810512be701801954449408966c630595d0cd51"; -const shydtAddress = "0xab4f1Bb558E564ae294D45a025111277c36C89c0"; -const earnAddress = "0x8e48d5b2Ac80d9861d07127F06BbF02F73520Ced"; -const controlPairAddress = "0xBB8ae522F812E9E65239A0e5db87a9D738ce957a"; +const chain = "bsc"; -async function tvl(_, _b, _cb, { api, }) { - const hydtBal = await api.call({ abi: 'erc20:balanceOf', target: shydtAddress, params: earnAddress }) - api.add(hydtAddress, hydtBal) - return sumUnknownTokens({ api, lps: [controlPairAddress], useDefaultCoreAssets: true, }) +const earn = "0x8e48d5b2Ac80d9861d07127F06BbF02F73520Ced"; +const farm = "0x4590BaD61aE62ACFF33032e3Bf64b52b7264A779"; +const hydt = "0x9810512be701801954449408966c630595d0cd51"; +const reserve = "0xc5161aE3437C08036B98bDb58cfE6bBfF876c177"; +const shydt = "0xab4f1Bb558E564ae294D45a025111277c36C89c0"; + +const bnb = nullAddress; +const controlPair = "0xBB8ae522F812E9E65239A0e5db87a9D738ce957a"; + +async function tvl(_, _b, _cb) { + return sumTokens2({ chain, owner: reserve, tokens: [bnb] }); +} + +async function staking(_, _b, _cb, { api, }) { + // earn + const shydtBal = await api.call({ abi: 'erc20:balanceOf', target: shydt, params: earn, }); + api.add(hydt, shydtBal); + + // farm + const pools = await api.fetchList({ + lengthAbi: 'uint256:poolLength', + itemAbi: 'function poolInfo(uint256) external view returns (address lpToken, uint256 allocPoint, uint256, uint256)', + target: farm, + }); + const lpTokens = []; + pools.forEach(i => { if (i.allocPoint > 0) lpTokens.push(i.lpToken) }); + const calls = lpTokens.map(i => ({ + target: i, + params: farm + })); + const lpBals = await api.multiCall({ abi: 'erc20:balanceOf', calls, }); + lpTokens.forEach((i, index) => api.add(i, lpBals[index])); + + return sumUnknownTokens({ api, lps: [controlPair], resolveLP: true, useDefaultCoreAssets: true, }); } module.exports = { - misrepresentedTokens: true, - methodology: "We get staked amounts from the HYDT staking (earn) contract via contract calls", - start: 1693763345, - bsc: { - tvl: () => ({}), - staking: tvl, - }, + misrepresentedTokens: true, + methodology: "Retrieving the reserve BNB balance for TVL. Retrieving the staked amounts for HYDT from the earn (HYDT staking) contract and the LP Tokens from the farm contract for staking.", + start: 1693763345, + bsc: { + tvl, + staking, + }, }; From ff723dcc48c52257c0cc10774619f8575a432bc7 Mon Sep 17 00:00:00 2001 From: Sir-Deon Date: Fri, 3 Nov 2023 15:31:15 +0100 Subject: [PATCH 1830/1974] Made updates --- projects/baki/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/baki/index.js b/projects/baki/index.js index 3ca45f1bd13..ff38c62eb2f 100644 --- a/projects/baki/index.js +++ b/projects/baki/index.js @@ -3,7 +3,7 @@ const { sumTokensExport } = require('../helper/unwrapLPs') const ADDRESSES = require('../helper/coreAssets.json') module.exports = { - methodology: "TVL: Total collateral deposited on Baki ", + methodology: "Total collateral deposited on Baki ", avax: { tvl: sumTokensExport({ owner: bakiAddress, tokens: [ADDRESSES.avax.USDC] }) }, From d15facf45bb84449cb35ef8e561cfdc4a65154b6 Mon Sep 17 00:00:00 2001 From: Sir-Deon Date: Fri, 3 Nov 2023 15:31:33 +0100 Subject: [PATCH 1831/1974] Updated project methodology --- projects/baki/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/baki/index.js b/projects/baki/index.js index ff38c62eb2f..550e60f1219 100644 --- a/projects/baki/index.js +++ b/projects/baki/index.js @@ -3,7 +3,7 @@ const { sumTokensExport } = require('../helper/unwrapLPs') const ADDRESSES = require('../helper/coreAssets.json') module.exports = { - methodology: "Total collateral deposited on Baki ", + methodology: "Total collateral deposited on Baki", avax: { tvl: sumTokensExport({ owner: bakiAddress, tokens: [ADDRESSES.avax.USDC] }) }, From b22a48d649e290bea9930b6ed31c940ba8e0efca Mon Sep 17 00:00:00 2001 From: kavsky02 <95619352+kavsky02@users.noreply.github.com> Date: Fri, 3 Nov 2023 18:20:28 +0100 Subject: [PATCH 1832/1974] Add Arbitrum Pools BTC and ARB (#7949) --- projects/deltaprime/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/projects/deltaprime/index.js b/projects/deltaprime/index.js index 37bf010940a..ab9d544da8a 100644 --- a/projects/deltaprime/index.js +++ b/projects/deltaprime/index.js @@ -26,6 +26,8 @@ const VF_MAINSTAKING_CONTRACT = "0x8B3d9F0017FA369cD8C164D0Cc078bf4cA588aE5"; // Arbitrum const USDC_POOL_TUP_ARBI_CONTRACT = '0x8FE3842e0B7472a57f2A2D56cF6bCe08517A1De0'; const ETH_POOL_TUP_ARBI_CONTRACT = '0x0BeBEB5679115f143772CfD97359BBcc393d46b3'; +const BTC_POOL_TUP_ARBI_CONTRACT = '0x5CdE36c23f0909960BA4D6E8713257C6191f8C35'; +const ARB_POOL_TUP_ARBI_CONTRACT = '0x2B8C610F3fC6F883817637d15514293565C3d08A'; const SMART_LOANS_FACTORY_TUP_ARBITRUM = '0xFf5e3dDaefF411a1dC6CcE00014e4Bca39265c20'; @@ -88,6 +90,8 @@ async function tvlArbitrum(timestamp, block, chainBlocks, { api }) { const tokensAndOwners = [ [assetToAddressMappingArbitrum.USDC, USDC_POOL_TUP_ARBI_CONTRACT], [assetToAddressMappingArbitrum.ETH, ETH_POOL_TUP_ARBI_CONTRACT], + [assetToAddressMappingArbitrum.BTC, BTC_POOL_TUP_ARBI_CONTRACT], + [assetToAddressMappingArbitrum.ARB, ARB_POOL_TUP_ARBI_CONTRACT], ] const accounts = logs.map(i => `0x${i.topics[1].slice(26)}`) @@ -165,4 +169,4 @@ module.exports = { arbitrum: { tvl: tvlArbitrum, } -} +} \ No newline at end of file From f5e5489df44f033b779fbbc0daa9a629584c5d7d Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 3 Nov 2023 20:48:42 +0100 Subject: [PATCH 1833/1974] rumi: revert change as strategies excludes borrowed amount --- projects/rumi/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/projects/rumi/index.js b/projects/rumi/index.js index 79ce6b4cb0c..d85843d0a48 100644 --- a/projects/rumi/index.js +++ b/projects/rumi/index.js @@ -3,13 +3,15 @@ const addressProvider = "0xFf6c50B43382f2531FEF7d6382cCe1263B0585f1" async function tvl(_, _1, _2, { api }) { const lendVaultAddress = await api.call({ abi: 'address:lendVault', target: addressProvider, }); const tokens = await api.call({ abi: "address[]:getSupportedTokens", target: lendVaultAddress, }); + const bals = await api.multiCall({ abi: "function totalAssets(address) view returns (uint256)", target: lendVaultAddress, calls: tokens, }) + api.addTokens(tokens, bals) const vaults = await api.call({ abi: "address[]:getVaults", target: addressProvider, }); const vTokens = await api.multiCall({ abi: "address:depositToken", calls: vaults, }); const vBals = await api.multiCall({ abi: "uint256:balance", calls: vaults, }); api.addTokens(vTokens, vBals) - return api.sumTokens({ owner: lendVaultAddress, tokens }) + return api.getBalances() } module.exports = { From 2ecff173234a3101bd9a78231b866e35ca9acd6d Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Sat, 4 Nov 2023 11:15:49 +0100 Subject: [PATCH 1834/1974] summer-fi: disable ajna tvl --- projects/summer-fi/handlers/dpm-positions.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/projects/summer-fi/handlers/dpm-positions.js b/projects/summer-fi/handlers/dpm-positions.js index e8acaae0e38..a884896d0a3 100644 --- a/projects/summer-fi/handlers/dpm-positions.js +++ b/projects/summer-fi/handlers/dpm-positions.js @@ -45,10 +45,10 @@ query { const dpmPositions = async ({ api, }) => { const aave = await blockQuery(endpoints.aave(), aaveQuery(api.block - 500), { api, }); - const ajna = await blockQuery(endpoints.ajna(), ajnaQuery(api.block - 500), { api, }); + // const ajna = await blockQuery(endpoints.ajna(), ajnaQuery(api.block - 500), { api, }); const supportedAjnaPools = [ - ...new Set(ajna.accounts.map(({ pool: { address } }) => address)), + // ...new Set(ajna.accounts.map(({ pool: { address } }) => address)), ]; const aaveBorrowishPositions = aave.positions.map( @@ -57,7 +57,7 @@ const dpmPositions = async ({ api, }) => { collateralAddress, }) ); - const ajnaBorrowishPositions = ajna.accounts + /* const ajnaBorrowishPositions = ajna.accounts .filter(({ borrowPositions }) => borrowPositions.length) .map(({ borrowPositions: [{ collateral }], collateralToken }) => ({ collateral: new BigNumber(collateral).shiftedBy(NEGATIVE_WAD_PRECISION), @@ -71,11 +71,11 @@ const dpmPositions = async ({ api, }) => { .shiftedBy(NEGATIVE_WAD_PRECISION), collateralAddress: quoteTokenAddress, })); - + */ const tokensWithAmounts = [ ...aaveBorrowishPositions, - ...ajnaBorrowishPositions, - ...ajnaEarnPositions, + // ...ajnaBorrowishPositions, + // ...ajnaEarnPositions, ].reduce( (total, { collateral, collateralAddress }) => ({ ...total, From a64080cd54758032cc58b7070c78a5d64203e9ce Mon Sep 17 00:00:00 2001 From: Atharvasama <129745983+Atharvasama@users.noreply.github.com> Date: Sun, 5 Nov 2023 02:13:57 +0530 Subject: [PATCH 1835/1974] Add LST Optimizer adapter (#7919) * Added adaptor for lst-optimizer * code refactor --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/lst-optimizer/index.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 projects/lst-optimizer/index.js diff --git a/projects/lst-optimizer/index.js b/projects/lst-optimizer/index.js new file mode 100644 index 00000000000..3ff20d4ceb1 --- /dev/null +++ b/projects/lst-optimizer/index.js @@ -0,0 +1,19 @@ +const ADDRESSES = require('../helper/coreAssets.json') + +async function tvl(_, _1, _2, { api }) { + const abi = "function totalAssets() view returns (uint256)" + const kETHStrategyAddress = "0xa060a5F83Db8bf08b45Cf56Db370c9383b7B895C"; + const dETHVaultAddress = "0x4c7aF9BdDac5bD3bee9cd2Aa2FeEeeE7610f5a6B"; + + let kETHTvl = await api.call({ abi: abi, target: kETHStrategyAddress }) + let dETHTvl = await api.call({ abi: abi, target: dETHVaultAddress }) + api.add(ADDRESSES.null, kETHTvl) + api.add(ADDRESSES.null, dETHTvl) + return api.getBalances() +} + +module.exports = { + ethereum: { + tvl + } +}; \ No newline at end of file From 34fbbcfd5d4bb4fd0c2d6772677aca4a349117b6 Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Sun, 5 Nov 2023 14:31:25 +0000 Subject: [PATCH 1836/1974] token owner logs test --- projects/helper/unwrapLPs.js | 22 +++++++++++++--------- projects/polygon/index.js | 4 ++-- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/projects/helper/unwrapLPs.js b/projects/helper/unwrapLPs.js index 290ed8b2191..2f01f361f7d 100644 --- a/projects/helper/unwrapLPs.js +++ b/projects/helper/unwrapLPs.js @@ -384,7 +384,7 @@ tokensAndOwners [ [token, owner] - eg ["0xaaa", "0xbbb"] ] */ -async function sumTokens(balances = {}, tokensAndOwners, block, chain = "ethereum", transformAddress, { resolveLP = false, unwrapAll = false, blacklistedLPs = [], skipFixBalances = false, abis = {}, permitFailure = false } = {}) { +async function sumTokens(balances = {}, tokensAndOwners, block, chain = "ethereum", transformAddress, { resolveLP = false, unwrapAll = false, blacklistedLPs = [], skipFixBalances = false, abis = {}, permitFailure = false, logArray } = {}) { if (!transformAddress) transformAddress = await getChainTransform(chain) @@ -405,7 +405,7 @@ async function sumTokens(balances = {}, tokensAndOwners, block, chain = "ethereu // const ethBalances = await Promise.all(ethBalanceInputs.map(getTrxBalance)) // ethBalances.forEach(balance => sdk.util.sumSingleBalance(balances, transformAddress(nullAddress), balance)) // } else { - const { output: ethBalances } = await sdk.api.eth.getBalances({ targets: ethBalanceInputs, chain, block }) + const { output: ethBalances } = await sdk.api.eth.getBalances({ targets: ethBalanceInputs, chain, block, logArray }) ethBalances.forEach(({ balance }) => sdk.util.sumSingleBalance(balances, transformAddress(nullAddress), balance)) // } } @@ -418,7 +418,8 @@ async function sumTokens(balances = {}, tokensAndOwners, block, chain = "ethereu permitFailure, abi: 'erc20:balanceOf', block, - chain + chain, + logArray }) balanceOfTokens.output.forEach((result) => { const token = transformAddress(result.input.target) @@ -436,7 +437,7 @@ async function sumTokens(balances = {}, tokensAndOwners, block, chain = "ethereu }) if (resolveLP || unwrapAll) - await unwrapLPsAuto({ balances, block, chain, transformAddress, blacklistedLPs, abis, }) + await unwrapLPsAuto({ balances, block, chain, transformAddress, blacklistedLPs, abis, logArray }) if (!skipFixBalances && ['astar', 'harmony', 'kava', 'thundercore', 'klaytn', 'evmos'].includes(chain)) { const fixBalances = await getFixBalances(chain) @@ -542,7 +543,7 @@ async function genericUnwrapCvxRewardPool({ api, owner, pool, balances }) { return balances } -async function unwrapLPsAuto({ api, balances, block, chain = "ethereum", transformAddress, excludePool2 = false, onlyPool2 = false, pool2Tokens = [], blacklistedLPs = [], abis = {}, }) { +async function unwrapLPsAuto({ api, balances, block, chain = "ethereum", transformAddress, excludePool2 = false, onlyPool2 = false, pool2Tokens = [], blacklistedLPs = [], abis = {}, logArray }) { if (api) { chain = api.chain ?? chain block = api.block ?? block @@ -580,7 +581,7 @@ async function unwrapLPsAuto({ api, balances, block, chain = "ethereum", transfo async function _addTokensAndLPs(balances, tokens, amounts) { const symbols = (await sdk.api.abi.multiCall({ - calls: tokens.map(t => ({ target: t.output })), abi: symbol, block, chain, permitFailure: true, + calls: tokens.map(t => ({ target: t.output })), abi: symbol, block, chain, permitFailure: true, logArray })).output const lpBalances = [] symbols.forEach(({ output }, idx) => { @@ -591,11 +592,11 @@ async function unwrapLPsAuto({ api, balances, block, chain = "ethereum", transfo else sdk.util.sumSingleBalance(balances, transformAddress(token), balance); }) - await _unwrapUniswapLPs(balances, lpBalances) + await _unwrapUniswapLPs(balances, lpBalances, logArray) return balances } - async function _unwrapUniswapLPs(balances, lpPositions) { + async function _unwrapUniswapLPs(balances, lpPositions, logArray) { const lpTokenCalls = lpPositions.map(lpPosition => ({ target: lpPosition.token })) const { output: lpReserves } = await sdk.api.abi.multiCall({ block, abi: abis.getReservesABI || lpReservesAbi, calls: lpTokenCalls, chain, }) const { output: lpSupplies } = await sdk.api.abi.multiCall({ block, abi: lpSuppliesAbi, calls: lpTokenCalls, chain, }) @@ -609,6 +610,7 @@ async function unwrapLPsAuto({ api, balances, block, chain = "ethereum", transfo const token0_ = tokens0.find(call => call.input.target === lpToken) const token1_ = tokens1.find(call => call.input.target === lpToken) const supply_ = lpSupplies.find(call => call.input.target === lpToken) + logArray.push(...[{ token: token0_, holder: lpToken}, {token: token1_, holder: lpToken}]) try { token0 = token0_.output.toLowerCase() token1 = token1_.output.toLowerCase() @@ -676,6 +678,7 @@ async function sumTokens2({ permitFailure = false, fetchCoValentTokens = false, tokenConfig = {}, + logArray }) { if (api) { chain = api.chain ?? chain @@ -697,6 +700,7 @@ async function sumTokens2({ } if (resolveVlCVX && owners.length && chain === 'ethereum') { + if (logArray) logArray.push(...owners.map(owner => ({ token: ADDRESSES.ethereum.vlCVX, owner}))) const vlCVXBals = await api.multiCall({ abi: 'erc20:balanceOf', calls: owners, target: ADDRESSES.ethereum.vlCVX }) vlCVXBals.forEach((v) => sdk.util.sumSingleBalance(balances, ADDRESSES.ethereum.vlCVX, v, chain)) } @@ -734,7 +738,7 @@ async function sumTokens2({ tokensAndOwners = getUniqueToA(tokensAndOwners) log(chain, 'summing tokens', tokensAndOwners.length) - await sumTokens(balances, tokensAndOwners, block, chain, transformAddress, { resolveLP, unwrapAll, blacklistedLPs, skipFixBalances: true, abis, permitFailure, }) + await sumTokens(balances, tokensAndOwners, block, chain, transformAddress, { resolveLP, unwrapAll, blacklistedLPs, skipFixBalances: true, abis, permitFailure, logArray }) if (!skipFixBalances) { diff --git a/projects/polygon/index.js b/projects/polygon/index.js index d8c647dba2e..69588a3d1fd 100644 --- a/projects/polygon/index.js +++ b/projects/polygon/index.js @@ -1,7 +1,7 @@ const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens2 } = require('../helper/unwrapLPs') -async function tvl(_, block) { +async function tvl(_, block, _c, { api }) { const etherAddress = ADDRESSES.null const posEtherPredicate = '0x8484Ef722627bf18ca5Ae6BcF031c23E6e922B30' @@ -86,7 +86,7 @@ async function tvl(_, block) { }) toa.push([maticToken, plasmaDepositManager]) toa.push([maticToken, stakeManager]) - return sumTokens2({ block, tokensAndOwners: toa, }) + return sumTokens2({ block, tokensAndOwners: toa, logArray: api.logArray }) } module.exports = { From 39e5d8b7faf3af50e09360423ca2254802341480 Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Sun, 5 Nov 2023 14:32:40 +0000 Subject: [PATCH 1837/1974] revert test edit --- test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test.js b/test.js index 39c58ef7e0f..7d2ccfb910a 100644 --- a/test.js +++ b/test.js @@ -316,7 +316,7 @@ function fixBalances(balances) { else if (!token.includes(':')) newKey = `coingecko:${token}` if (newKey) { delete balances[token] - sdk.util.sumSingleBalance(balances, newKey, typeof value == "string" && value.includes('e') ? BigNumber(value).toFixed(0) : value) + sdk.util.sumSingleBalance(balances, newKey, BigNumber(value).toFixed(0)) } }) } From 536ae41c5e1fed0ad51ca6290e8d8a41e16e868e Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Mon, 6 Nov 2023 01:58:41 +0000 Subject: [PATCH 1838/1974] fix broken adapters --- projects/helper/unwrapLPs.js | 1 - 1 file changed, 1 deletion(-) diff --git a/projects/helper/unwrapLPs.js b/projects/helper/unwrapLPs.js index 2f01f361f7d..f5164156256 100644 --- a/projects/helper/unwrapLPs.js +++ b/projects/helper/unwrapLPs.js @@ -610,7 +610,6 @@ async function unwrapLPsAuto({ api, balances, block, chain = "ethereum", transfo const token0_ = tokens0.find(call => call.input.target === lpToken) const token1_ = tokens1.find(call => call.input.target === lpToken) const supply_ = lpSupplies.find(call => call.input.target === lpToken) - logArray.push(...[{ token: token0_, holder: lpToken}, {token: token1_, holder: lpToken}]) try { token0 = token0_.output.toLowerCase() token1 = token1_.output.toLowerCase() From 63a6d25b10b0b5681c461477cea38193dcae84e2 Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Mon, 6 Nov 2023 10:54:49 +0000 Subject: [PATCH 1839/1974] log array patch --- projects/helper/unwrapLPs.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/helper/unwrapLPs.js b/projects/helper/unwrapLPs.js index f5164156256..7200cf7480a 100644 --- a/projects/helper/unwrapLPs.js +++ b/projects/helper/unwrapLPs.js @@ -610,6 +610,7 @@ async function unwrapLPsAuto({ api, balances, block, chain = "ethereum", transfo const token0_ = tokens0.find(call => call.input.target === lpToken) const token1_ = tokens1.find(call => call.input.target === lpToken) const supply_ = lpSupplies.find(call => call.input.target === lpToken) + if (logArray) logArray.push(...[{ token: token0_, holder: lpToken}, {token: token1_, holder: lpToken}]) try { token0 = token0_.output.toLowerCase() token1 = token1_.output.toLowerCase() From 818703ea7416bb5ddcc478ae81f830de971e090b Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Mon, 6 Nov 2023 10:55:32 +0000 Subject: [PATCH 1840/1974] trigger CI to test --- projects/accumulator/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/accumulator/index.js b/projects/accumulator/index.js index 8d352398bdc..6aad32c9da6 100644 --- a/projects/accumulator/index.js +++ b/projects/accumulator/index.js @@ -21,4 +21,4 @@ Object.keys(config).forEach(chain => { return sumUnknownTokens({ api, resolveLP: true, useDefaultCoreAssets: true, lps: tokens, }) } } -}) \ No newline at end of file +}) From 4ecbeadd9994a1f0afb07f1d2d5f932e1aee7a32 Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Mon, 6 Nov 2023 11:00:33 +0000 Subject: [PATCH 1841/1974] logArray for polygon adapter --- projects/polygon/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/polygon/index.js b/projects/polygon/index.js index 69588a3d1fd..55f99a9e275 100644 --- a/projects/polygon/index.js +++ b/projects/polygon/index.js @@ -1,7 +1,7 @@ const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens2 } = require('../helper/unwrapLPs') -async function tvl(_, block, _c, { api }) { +async function tvl(_, block, _c, { logArray }) { const etherAddress = ADDRESSES.null const posEtherPredicate = '0x8484Ef722627bf18ca5Ae6BcF031c23E6e922B30' @@ -86,7 +86,7 @@ async function tvl(_, block, _c, { api }) { }) toa.push([maticToken, plasmaDepositManager]) toa.push([maticToken, stakeManager]) - return sumTokens2({ block, tokensAndOwners: toa, logArray: api.logArray }) + return sumTokens2({ block, tokensAndOwners: toa, logArray }) } module.exports = { From b1907e0719170939a7cccf2e0bf75037f4c1c5ad Mon Sep 17 00:00:00 2001 From: Antoine Bellanger Date: Mon, 6 Nov 2023 13:27:47 +0100 Subject: [PATCH 1842/1974] Add BORG token to CEX default tokens --- projects/helper/cex.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/helper/cex.js b/projects/helper/cex.js index ef2d6ecc94d..83384f25f20 100644 --- a/projects/helper/cex.js +++ b/projects/helper/cex.js @@ -93,6 +93,7 @@ const defaultTokens = { '0x25ec98773d7b4ced4cafab96a2a1c0945f145e10', // stUSDT '0x3c3a81e81dc49A522A592e7622A7E711c06bf354', // MNT '0x61e90a50137e1f645c9ef4a0d3a4f01477738406', // LOKA + '0x64d0f55Cd8C7133a9D7102b13987235F486F2224', // BORG ], tron: [ nullAddress, From 74f912b32ccf6ac4283b023affe6808b4d7d8021 Mon Sep 17 00:00:00 2001 From: Steve0day <143409435+Steve0day@users.noreply.github.com> Date: Tue, 7 Nov 2023 01:09:08 +0800 Subject: [PATCH 1843/1974] Update index.js, add opBNB chain (#7954) * Update index.js, add opBNB chain * minor fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- package-lock.json | 12 ++++++------ projects/friend3/index.js | 20 +++++++++----------- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/package-lock.json b/package-lock.json index d311bd829cd..d3e0e106039 100644 --- a/package-lock.json +++ b/package-lock.json @@ -787,9 +787,9 @@ } }, "node_modules/@defillama/sdk": { - "version": "4.0.65", - "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.65.tgz", - "integrity": "sha512-+KCjkA+Ytqhre8PoFHhdUmzTYUtimJUmeYwnpnLR9xs3CcgeqyTxEt91Ab8aIjcXf2AvAUPcqBEEcp/MEczNzQ==", + "version": "4.0.67", + "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.67.tgz", + "integrity": "sha512-grcgUk0+ccHvxlUXcNPCBUGqjnqhqSCkxEjfCOoLPDEgYcoZytmbOJ98XJB17Un3cu4zV9Bf5hTfprjUX8lnOQ==", "dependencies": { "@aws-sdk/client-s3": "^3.400.0", "@supercharge/promise-pool": "^2.1.0", @@ -5917,9 +5917,9 @@ } }, "@defillama/sdk": { - "version": "4.0.65", - "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.65.tgz", - "integrity": "sha512-+KCjkA+Ytqhre8PoFHhdUmzTYUtimJUmeYwnpnLR9xs3CcgeqyTxEt91Ab8aIjcXf2AvAUPcqBEEcp/MEczNzQ==", + "version": "4.0.67", + "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.67.tgz", + "integrity": "sha512-grcgUk0+ccHvxlUXcNPCBUGqjnqhqSCkxEjfCOoLPDEgYcoZytmbOJ98XJB17Un3cu4zV9Bf5hTfprjUX8lnOQ==", "requires": { "@aws-sdk/client-s3": "^3.400.0", "@supercharge/promise-pool": "^2.1.0", diff --git a/projects/friend3/index.js b/projects/friend3/index.js index c2ebd1b49d0..2d7a00eceeb 100644 --- a/projects/friend3/index.js +++ b/projects/friend3/index.js @@ -1,14 +1,12 @@ -const { sumTokens2, nullAddress } = require("../helper/unwrapLPs"); +const { nullAddress, sumTokensExport } = require("../helper/unwrapLPs"); -const contract = "0x1e70972EC6c8a3FAe3aC34C9F3818eC46Eb3BD5D"; - -async function tvl(time, ethBlock, _b, { api }) { - return sumTokens2({ tokens: [nullAddress], owner: contract, api }); +const config = { + bsc: '0x1e70972EC6c8a3FAe3aC34C9F3818eC46Eb3BD5D', + op_bnb: '0x2C5bF6f0953ffcDE678A35AB7d6CaEBC8B6b29F0', } -module.exports = { - methodology: `We count the ETH on ${contract}`, - bsc: { - tvl, - }, -}; +Object.keys(config).forEach(chain => { + module.exports[chain] = { + tvl: sumTokensExport({ tokens: [nullAddress], owner: config[chain] }) + } +}) \ No newline at end of file From 9e1093c9b245b0170b5f8563de43c780e886e343 Mon Sep 17 00:00:00 2001 From: Define101 Date: Mon, 6 Nov 2023 17:09:44 +0000 Subject: [PATCH 1844/1974] add eon chain to spookyswap --- projects/helper/chains.json | 1 + projects/spookyswap/index.js | 3 +++ 2 files changed, 4 insertions(+) diff --git a/projects/helper/chains.json b/projects/helper/chains.json index 5616496776c..ea2f3a1d9e6 100644 --- a/projects/helper/chains.json +++ b/projects/helper/chains.json @@ -66,6 +66,7 @@ "enuls", "eos", "eos_evm", + "eon", "equilibrium", "era", "ergo", diff --git a/projects/spookyswap/index.js b/projects/spookyswap/index.js index 9416f18f215..d678e8b467d 100644 --- a/projects/spookyswap/index.js +++ b/projects/spookyswap/index.js @@ -4,4 +4,7 @@ module.exports={ fantom:{ tvl: getUniTVL({ useDefaultCoreAssets: true, factory: '0x152eE697f2E276fA89E96742e9bB9aB1F2E61bE3' }), }, + eon:{ + tvl: getUniTVL({ useDefaultCoreAssets: true, factory: '0xa6AD18C2aC47803E193F75c3677b14BF19B94883' }), +}, } \ No newline at end of file From 7feeb9585a1493330af16b84679d4574d0264b38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kre=C5=A1imir=20Klas?= Date: Mon, 6 Nov 2023 18:16:06 +0100 Subject: [PATCH 1845/1974] Track Kai https://kai.finance (#7955) --- projects/kai/index.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 projects/kai/index.js diff --git a/projects/kai/index.js b/projects/kai/index.js new file mode 100644 index 00000000000..636470b3694 --- /dev/null +++ b/projects/kai/index.js @@ -0,0 +1,25 @@ +const sui = require("../helper/chain/sui"); + +const WHUSDCE_VAULT_ID = + "0x7a2f75a3e50fd5f72dfc2f8c9910da5eaa3a1486e4eb1e54a825c09d82214526"; +const WHUSDCE_TYPE_ARG = '0x5d4b302506645c37ff133b98c4b50a5ae14841659738d6d733d59d0d217a93bf::coin::COIN' + +async function tvl(_, _1, _2, { api }) { + const res = await sui.getObject(WHUSDCE_VAULT_ID) + + let tvl = BigInt(res.fields.free_balance) + for (const strategy of res.fields.strategies.fields.contents) { + tvl += BigInt(strategy.fields.value.fields.borrowed) + } + tvl += BigInt(res.fields.free_balance) + + api.add(WHUSDCE_TYPE_ARG, Number(tvl)) +} + +module.exports = { + timetravel: false, + sui: { + tvl, + }, +}; + From 20c383f4db0aac9643a530d7f47b2c94f89e3483 Mon Sep 17 00:00:00 2001 From: Torus <146208517+torusfarm@users.noreply.github.com> Date: Mon, 6 Nov 2023 18:17:37 +0100 Subject: [PATCH 1846/1974] Add Torus Farm (#7956) --- projects/torusfarm/index.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 projects/torusfarm/index.js diff --git a/projects/torusfarm/index.js b/projects/torusfarm/index.js new file mode 100644 index 00000000000..fd4fedaebe1 --- /dev/null +++ b/projects/torusfarm/index.js @@ -0,0 +1,13 @@ +const { getUniTVL } = require('../helper/unknownTokens') +const TORUS = "0x736063A68A99a8E2943DA3952A676384154Ac0B6"; +const FACTORY = "0x259b3217A01878ea9d64b45eE48231e660863ee7" + +const dexTVL = getUniTVL({ factory: FACTORY, useDefaultCoreAssets: true, fetchBalances: true, permitFailure: true }) + +module.exports = { + misrepresentedTokens: true, + methodology: `Uses factory(${FACTORY}) address and whitelisted tokens address to find and price Liquidity Pool pairs`, + base: { + tvl: dexTVL, + } +}; From 601f1c8e17617335c81b4a448cc7bfc1e75dc527 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 6 Nov 2023 18:30:53 +0100 Subject: [PATCH 1847/1974] Gambit (#7965) * Update gambit arbitrum * Add CNG staking * code refactor --------- Co-authored-by: ALPHADA <48852104+ALPHADA@users.noreply.github.com> --- projects/gambit/index.js | 34 ++++++++++++++++++++++++++------- projects/helper/tokenMapping.js | 3 +++ 2 files changed, 30 insertions(+), 7 deletions(-) diff --git a/projects/gambit/index.js b/projects/gambit/index.js index 9b1b101678a..aae63622c57 100644 --- a/projects/gambit/index.js +++ b/projects/gambit/index.js @@ -1,13 +1,33 @@ const ADDRESSES = require('../helper/coreAssets.json') const { sumTokensExport } = require("../helper/unwrapLPs"); -const SimpleGToken = "0x0729e806f57CE71dA4464c6B2d313E517f41560b"; // SimpleGToken -const Treasury = "0x1fb8611064a09469F808263C398623A86e7Aa883"; // Treasury +const SimpleGToken = { + era: "0x0729e806f57CE71dA4464c6B2d313E517f41560b", + arbitrum: "0xAC29F414FB40BA4e29Ab8504a55cBfFD315D2430" +} +const Treasury = { + era: "0x1fb8611064a09469F808263C398623A86e7Aa883", + arbitrum: "0x15c80BbC0D05656002BD922BFbf46e185BCa5A9e" +} +const Staking = { + arbitrum: "0x05027E21F6cEfb38970f4e0c04cD6DacA15aCBcE", +} + +const CNG_ADDRESS = { + ethereum: "0x5C1d9aA868a30795F92fAe903eDc9eFF269044bf", + arbitrum: "0x4e7e5023656863E26f50E2E6E59489A852C212c1", +} module.exports = { - methodology: `Count the USDC that has been deposited on Gambit`, - era: { - tvl: sumTokensExport({ owners: [SimpleGToken, Treasury], tokens: [ADDRESSES.era.USDC], }), - }, + methodology: `Count the USDC that has been deposited on Gambit`, + era: { + tvl: sumTokensExport({ owners: [SimpleGToken.era, Treasury.era], tokens: [ADDRESSES.era.USDC], }), + }, + arbitrum: { + tvl: sumTokensExport({ + owners: [SimpleGToken.arbitrum, Treasury.arbitrum], + tokens: [ADDRESSES.arbitrum.USDC_CIRCLE], + }), + staking: sumTokensExport({ owners: [Staking.arbitrum], tokens: [CNG_ADDRESS.arbitrum], }), + }, }; - diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index dc8211fe011..2fb73a7b0dc 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -67,6 +67,9 @@ const fixBalancesTokens = { elsm: { '0xa801b1a7846156d4c81bd188f96bfcb621517611': { coingeckoId: 'vulcan-forged', decimals: 18 }, }, + arbitrum: { + '0x4e7e5023656863E26f50E2E6E59489A852C212c1': { coingeckoId: 'changer', decimals: 18 }, + }, bfc: { [ADDRESSES.bfc.WBFC]: { coingeckoId: 'bifrost', decimals: 18}, [ADDRESSES.bfc.BIFI]: { coingeckoId: 'bifi', decimals: 18}, From eef8f0530018629c44c32e46a6ccb0f38c296ac3 Mon Sep 17 00:00:00 2001 From: Atharvasama <129745983+Atharvasama@users.noreply.github.com> Date: Mon, 6 Nov 2023 23:03:04 +0530 Subject: [PATCH 1848/1974] Swapped subgraphs URLs for Stakehouse Protocol with proxies (#7963) * Added adaptor for lst-optimizer * Added subgraph proxy URLs * code refactor --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/blockswap/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/blockswap/index.js b/projects/blockswap/index.js index 2f1529fb82a..f821deda7b1 100644 --- a/projects/blockswap/index.js +++ b/projects/blockswap/index.js @@ -5,9 +5,9 @@ const { GraphQLClient, gql } = require('graphql-request'); const ethAddress = ADDRESSES.null -const lsd_subgraph = 'https://api.thegraph.com/subgraphs/name/stakehouse-dev/lsd' +const lsd_subgraph = 'https://lsd-subgraph.joinstakehouse.com' -const stakehouse_subgraph = 'https://api.thegraph.com/subgraphs/name/stakehouse-dev/stakehouse-protocol' +const stakehouse_subgraph = 'https://stakehouse-subgraph.joinstakehouse.com' async function tvl(_, _1, _2, { api }) { let balances = {}; From 43de325d876d0256023cc9f9ce3d8ed04c1a030c Mon Sep 17 00:00:00 2001 From: Mykola Bezruk Date: Mon, 6 Nov 2023 19:33:51 +0200 Subject: [PATCH 1849/1974] add base and arbitrum chains to myso v2 (#7961) --- projects/myso-v2/index.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/projects/myso-v2/index.js b/projects/myso-v2/index.js index 3a47194d698..78a22b7327f 100644 --- a/projects/myso-v2/index.js +++ b/projects/myso-v2/index.js @@ -89,6 +89,12 @@ const config = { ethereum: { fromBlock: 18213104, }, + arbitrum: { + fromBlock: 143181867, + }, + base: { + fromBlock: 6239916, + }, }; Object.keys(config).forEach((chain) => { From 5f78ff4b8d5824c657a058c97e247cef3f326b0a Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Mon, 6 Nov 2023 17:37:20 +0000 Subject: [PATCH 1850/1974] log patch (#7960) * log array patch * trigger CI to test * logArray for polygon adapter --- projects/accumulator/index.js | 2 +- projects/helper/unwrapLPs.js | 1 + projects/polygon/index.js | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/projects/accumulator/index.js b/projects/accumulator/index.js index 8d352398bdc..6aad32c9da6 100644 --- a/projects/accumulator/index.js +++ b/projects/accumulator/index.js @@ -21,4 +21,4 @@ Object.keys(config).forEach(chain => { return sumUnknownTokens({ api, resolveLP: true, useDefaultCoreAssets: true, lps: tokens, }) } } -}) \ No newline at end of file +}) diff --git a/projects/helper/unwrapLPs.js b/projects/helper/unwrapLPs.js index f5164156256..7200cf7480a 100644 --- a/projects/helper/unwrapLPs.js +++ b/projects/helper/unwrapLPs.js @@ -610,6 +610,7 @@ async function unwrapLPsAuto({ api, balances, block, chain = "ethereum", transfo const token0_ = tokens0.find(call => call.input.target === lpToken) const token1_ = tokens1.find(call => call.input.target === lpToken) const supply_ = lpSupplies.find(call => call.input.target === lpToken) + if (logArray) logArray.push(...[{ token: token0_, holder: lpToken}, {token: token1_, holder: lpToken}]) try { token0 = token0_.output.toLowerCase() token1 = token1_.output.toLowerCase() diff --git a/projects/polygon/index.js b/projects/polygon/index.js index 69588a3d1fd..55f99a9e275 100644 --- a/projects/polygon/index.js +++ b/projects/polygon/index.js @@ -1,7 +1,7 @@ const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens2 } = require('../helper/unwrapLPs') -async function tvl(_, block, _c, { api }) { +async function tvl(_, block, _c, { logArray }) { const etherAddress = ADDRESSES.null const posEtherPredicate = '0x8484Ef722627bf18ca5Ae6BcF031c23E6e922B30' @@ -86,7 +86,7 @@ async function tvl(_, block, _c, { api }) { }) toa.push([maticToken, plasmaDepositManager]) toa.push([maticToken, stakeManager]) - return sumTokens2({ block, tokensAndOwners: toa, logArray: api.logArray }) + return sumTokens2({ block, tokensAndOwners: toa, logArray }) } module.exports = { From 54ec8a9a67531cec5e0056d293c82adc8da8869b Mon Sep 17 00:00:00 2001 From: Define101 Date: Mon, 6 Nov 2023 17:46:48 +0000 Subject: [PATCH 1851/1974] loreum treasury --- projects/treasury/loreum.js | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 projects/treasury/loreum.js diff --git a/projects/treasury/loreum.js b/projects/treasury/loreum.js new file mode 100644 index 00000000000..1b0a1aa6c73 --- /dev/null +++ b/projects/treasury/loreum.js @@ -0,0 +1,9 @@ +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0x5d45A213B2B6259F0b3c116a8907B56AB5E22095"; + +module.exports = treasuryExports({ + ethereum: { + owners: [treasury], + }, +}) \ No newline at end of file From 69c5e60c3e47acee5be768f90b4f74c81473d3b8 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 6 Nov 2023 18:55:43 +0100 Subject: [PATCH 1852/1974] track starsleague --- projects/helper/chains.json | 1 + projects/helper/env.js | 9 +-------- projects/helper/tokenMapping.js | 3 +++ projects/stars-league/index.js | 7 +++++++ 4 files changed, 12 insertions(+), 8 deletions(-) create mode 100644 projects/stars-league/index.js diff --git a/projects/helper/chains.json b/projects/helper/chains.json index ea2f3a1d9e6..9c9a90aecbc 100644 --- a/projects/helper/chains.json +++ b/projects/helper/chains.json @@ -33,6 +33,7 @@ "carbon", "cardano", "celo", + "chz", "chihuahua", "clover", "clv", diff --git a/projects/helper/env.js b/projects/helper/env.js index 88126123fc3..779d339cf7c 100644 --- a/projects/helper/env.js +++ b/projects/helper/env.js @@ -9,16 +9,9 @@ const DEFAULTS = { APTOS_RPC: 'https://aptos-mainnet.pontem.network', SUI_RPC: 'https://fullnode.mainnet.sui.io/', MULTIVERSX_RPC: 'https://api.multiversx.com', - ETHEREUMCLASSIC_RPC: 'https://etc.etcdesktop.com,https://etc.rivet.link', - CRAB_RPC: 'https://darwiniacrab-rpc.dwellir.com', ANKR_API_KEY: '79258ce7f7ee046decc3b5292a24eb4bf7c910d7e39b691384c7ce0cfb839a01', RENEC_RPC: "https://api-mainnet-beta.renec.foundation:8899/", - ZYX_RPC: "https://rpc-1.zyx.network", - EVMOS_RPC: "https://evmos-evm.publicnode.com", - NOVA_RPC: "https://connect.novanetwork.io", - ETHF_RPC: "https://rpc.etherfair.org", - SCROLL_RPC: "https://rpc-scroll.icecreamswap.com", - HECO_RPC: "https://http-mainnet-node.huobichain.com", + CHZ_RPC: "https://chiliz.publicnode.com,https://rpc.ankr.com/chiliz", } const ENV_KEYS = [ diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 2fb73a7b0dc..e8caf5f7d49 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -47,6 +47,9 @@ const fixBalancesTokens = { [ADDRESSES.ethf.WETH]: { coingeckoId: 'ethereumfair', decimals: 18 }, [ADDRESSES.null]: { coingeckoId: 'ethereumfair', decimals: 18 }, }, + chz: { + [ADDRESSES.null]: { coingeckoId: 'chiliz', decimals: 18 }, + }, // Sample Code ozone: { // '0x83048f0bf34feed8ced419455a4320a735a92e9d': { coingeckoId: "ozonechain", decimals: 18 }, // was mapped to wrong chain diff --git a/projects/stars-league/index.js b/projects/stars-league/index.js new file mode 100644 index 00000000000..1bf70103b12 --- /dev/null +++ b/projects/stars-league/index.js @@ -0,0 +1,7 @@ +const { nullAddress, sumTokensExport, } = require('../helper/unwrapLPs') + +module.exports = { + chz: { + tvl: sumTokensExport({ tokens: [nullAddress], owner: '0x46d6Ac52852462687379EE3e4642155A849e203F' }) + } +} \ No newline at end of file From eea367f734fa32e0db431d773fc7b763cce1848a Mon Sep 17 00:00:00 2001 From: 0xFantomMenace <93462858+0xFantomMenace@users.noreply.github.com> Date: Mon, 6 Nov 2023 16:24:41 -0600 Subject: [PATCH 1853/1974] Adds Linea deployment (#7968) --- projects/the-granary/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/the-granary/index.js b/projects/the-granary/index.js index 67ade02c4bc..5c5f93589c5 100644 --- a/projects/the-granary/index.js +++ b/projects/the-granary/index.js @@ -20,4 +20,5 @@ module.exports = { arbitrum: v2("arbitrum", "0x512f582fFCCF3C14bD872152EeAe60866dCB2A1e"), bsc: v2("bsc", "0x7c8E7536c5044E1B3693eB564C6dE3a3CE58bbDa"), base: v2("base", "0x5C93B799D31d3d6a7C977f75FDB88d069565A55b"), + linea: v2("linea", "0xd539294830EaF5C22467CE6e085Ae4E02861845A"), } From a7935d9987d603dc0128a3dcfa7b8d562818ae28 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Tue, 7 Nov 2023 00:37:51 +0000 Subject: [PATCH 1854/1974] add eon tokens --- projects/helper/tokenMapping.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index e8caf5f7d49..1fcb82c91f8 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -78,6 +78,10 @@ const fixBalancesTokens = { [ADDRESSES.bfc.BIFI]: { coingeckoId: 'bifi', decimals: 18}, '0xB1f3A83597Bce2AD842c29bD750AE17afc474137': {coingeckoId: 'witch-token', decimals: 18}, '0x17102AC78a02a98fC78B0c29B7b0506f035A99E5': {coingeckoId: 'super-athletes-token', decimals: 18} + }, + eon: { + '0xF5cB8652a84329A2016A386206761f455bCEDab6': {coingeckoId: 'zencash', decimals: 18}, + '0x1d7fb99AED3C365B4DEf061B7978CE5055Dfc1e7': {coingeckoId: 'wrapped-bitcoin', decimals: 8}, } } From 31410aebf99b0319bba85775cd24c33442e3d05e Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Tue, 7 Nov 2023 03:23:07 +0000 Subject: [PATCH 1855/1974] dont use coins2 --- test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test.js b/test.js index 7d2ccfb910a..34bb0f1774e 100644 --- a/test.js +++ b/test.js @@ -361,7 +361,7 @@ async function computeTVL(balances, timestamp) { const { errors } = await PromisePool.withConcurrency(5) .for(sliceIntoChunks(readKeys, 100)) .process(async (keys) => { - tokenData.push((await axios.get(`https://coins2.llama.fi/prices/current/${keys.join(',')}`)).data.coins) + tokenData.push((await axios.get(`https://coins.llama.fi/prices/current/${keys.join(',')}`)).data.coins) }) if (errors && errors.length) From 68be53ba0af670b01af1470e565863328f824142 Mon Sep 17 00:00:00 2001 From: Sameep Singhania Date: Tue, 7 Nov 2023 14:11:29 +0530 Subject: [PATCH 1856/1974] Added MANTA chain to QuickSwap (#7973) --- projects/quickswap-v3/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/quickswap-v3/index.js b/projects/quickswap-v3/index.js index be6da30c086..1adf75e416d 100644 --- a/projects/quickswap-v3/index.js +++ b/projects/quickswap-v3/index.js @@ -4,6 +4,7 @@ module.exports = uniV3Export({ polygon: { factory: '0x411b0facc3489691f28ad58c47006af5e3ab3a28', fromBlock: 32610688, isAlgebra: true, permitFailure: true, }, dogechain: { factory: '0xd2480162aa7f02ead7bf4c127465446150d58452', fromBlock: 837574, isAlgebra: true, }, polygon_zkevm: { factory: '0x4B9f4d2435Ef65559567e5DbFC1BbB37abC43B57', fromBlock: 300, isAlgebra: true, }, + manta: { factory: '0x56c2162254b0E4417288786eE402c2B41d4e181e', fromBlock: 357492, }, }) async function tvl(_, _b, _cb, { api, }) { From e4b76f95d9880b9aa38f9b07297091093159ae13 Mon Sep 17 00:00:00 2001 From: Philipp Date: Tue, 7 Nov 2023 09:49:31 +0100 Subject: [PATCH 1857/1974] add ampCAPA (#7967) --- projects/eris-protocol/index.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/projects/eris-protocol/index.js b/projects/eris-protocol/index.js index dc9d20d7a90..ace818456f4 100644 --- a/projects/eris-protocol/index.js +++ b/projects/eris-protocol/index.js @@ -76,6 +76,11 @@ const config = { "terra1vklefn7n6cchn0u962w3gaszr4vf52wjvd4y95t2sydwpmpdtszsqvk9wy", coinGeckoId: "lion-dao", }, + { + contract: + "terra186rpfczl7l2kugdsqqedegl4es4hp624phfc7ddy8my02a4e8lgq5rlx7y", + coinGeckoId: "capapult", + }, ], }, terra: { From f081bcdf3b4ab46899190cb9a2b9e3497deba351 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 7 Nov 2023 09:58:04 +0100 Subject: [PATCH 1858/1974] Coffercity (#7974) * Create abi.json * Create config.js * Create index.js * code refactor --------- Co-authored-by: EVMlord <85406816+EVMlord@users.noreply.github.com> --- projects/CofferCity/index.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 projects/CofferCity/index.js diff --git a/projects/CofferCity/index.js b/projects/CofferCity/index.js new file mode 100644 index 00000000000..f811c52b127 --- /dev/null +++ b/projects/CofferCity/index.js @@ -0,0 +1,24 @@ +const abi = { + "getSupportedTokens": "function getSupportedTokens() view returns (address[] supportedTokens)" +} + +const config = { + kava: { + CofferCityKAVA: '0x860880862Ee1B74D00E2F94B1C81A67C2c58117E' + } +} + +module.exports = { + methodology: 'Counts TVL of all the assets supported by the Coffer City smart contracts' +}; + +Object.keys(config).forEach(chain => { + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const vaults = Object.values(config[chain]) + const tokens = await api.multiCall({ abi: abi.getSupportedTokens, calls: vaults }) + const ownerTokens = vaults.map((v, i) => [tokens[i], v]) + return api.sumTokens({ ownerTokens }) + } + } +}) From ca9c7ab215fa491fe8cb890a0e02aac523809491 Mon Sep 17 00:00:00 2001 From: Lou-Kamades <128186011+Lou-Kamades@users.noreply.github.com> Date: Tue, 7 Nov 2023 10:12:54 +0100 Subject: [PATCH 1859/1974] Mango v4 update (#7970) * add openbook OpenOrders layout * mango: add open orders to TVL * minor fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/helper/utils/solana/layout.js | 3 +- .../utils/solana/layouts/openbook-layout.js | 25 ++++++ projects/mango-markets-v4/deposits.js | 35 +++++++++ projects/mango-markets-v4/index.js | 26 ++----- projects/mango-markets-v4/orders.js | 77 +++++++++++++++++++ 5 files changed, 144 insertions(+), 22 deletions(-) create mode 100644 projects/mango-markets-v4/deposits.js create mode 100644 projects/mango-markets-v4/orders.js diff --git a/projects/helper/utils/solana/layout.js b/projects/helper/utils/solana/layout.js index 4be8bd8a58e..3a32d432aa0 100644 --- a/projects/helper/utils/solana/layout.js +++ b/projects/helper/utils/solana/layout.js @@ -4,7 +4,7 @@ const { parseLido, parseLidoValidatorList } = require('./layouts/lido') const { parsePhoenix } = require('./layouts/phoenix-dex') const { RAYDIUM_LIQUIDITY_STATE_LAYOUT_CLMM, RAYDIUM_STABLE_STATE_LAYOUT_V1, } = require('./layouts/raydium-layout') const { INVESTIN_FUND_DATA, } = require('./layouts/investin-layout') -const { MARKET_STATE_LAYOUT_V3, } = require('./layouts/openbook-layout') +const { MARKET_STATE_LAYOUT_V3, OPEN_ORDERS_LAYOUT_V2 } = require('./layouts/openbook-layout') const { ReserveLayout, ReserveLayoutLarix, MintLayout, AccountLayout, TokenSwapLayout, ESOLStakePoolLayout, } = require('./layouts/mixed-layout') const parseReserve = (info) => { @@ -45,6 +45,7 @@ const customDecoders = { ESOLStakePool: defaultParseLayout(ESOLStakePoolLayout), investinFund: defaultParseLayout(INVESTIN_FUND_DATA), openbook: defaultParseLayout(MARKET_STATE_LAYOUT_V3), + openbookOpenOrders: defaultParseLayout(OPEN_ORDERS_LAYOUT_V2), // raydiumLPv4: defaultParseLayout(RAYDIUM_LIQUIDITY_STATE_LAYOUT_V4), raydiumCLMM: defaultParseLayout(RAYDIUM_LIQUIDITY_STATE_LAYOUT_CLMM), raydiumLPStable: defaultParseLayout(RAYDIUM_STABLE_STATE_LAYOUT_V1), diff --git a/projects/helper/utils/solana/layouts/openbook-layout.js b/projects/helper/utils/solana/layouts/openbook-layout.js index 13295c6a4ee..9be674694c7 100644 --- a/projects/helper/utils/solana/layouts/openbook-layout.js +++ b/projects/helper/utils/solana/layouts/openbook-layout.js @@ -89,8 +89,33 @@ const MARKET_STATE_LAYOUT_V3 = struct([ blob(7), ]); +const OPEN_ORDERS_LAYOUT_V2 = struct([ + blob(5), + + accountFlagsLayout('accountFlags'), + + publicKey('market'), + publicKey('owner'), + + u64('baseTokenFree'), + u64('baseTokenTotal'), + u64('quoteTokenFree'), + u64('quoteTokenTotal'), + + u128('freeSlotBits'), + u128('isBidBits'), + + seq(u128(), 128, 'orders'), + seq(u64(), 128, 'clientIds'), + + u64('referrerRebatesAccrued'), + + blob(7), +]); + module.exports = { MARKET_STATE_LAYOUT_V3, + OPEN_ORDERS_LAYOUT_V2 } diff --git a/projects/mango-markets-v4/deposits.js b/projects/mango-markets-v4/deposits.js new file mode 100644 index 00000000000..5294bff5313 --- /dev/null +++ b/projects/mango-markets-v4/deposits.js @@ -0,0 +1,35 @@ +const { Program } = require("@project-serum/anchor"); +const { getProvider, sumTokens2 } = require("../helper/solana"); +const idl = require("./idl.json"); + +async function depositsTvl() { + const provider = getProvider(); + const program = new Program( + idl, + "4MangoMjqJ2firMokCjjGgoK8d4MXcrgL7XJaL3w6fVg", + provider, + ); + const banks = await program.account.bank.all(); + return sumTokens2({ tokenAccounts: banks.map((i) => i.account.vault) }); +} +async function borrowed() { + const { api } = arguments[3]; + const provider = getProvider(); + const program = new Program( + idl, + "4MangoMjqJ2firMokCjjGgoK8d4MXcrgL7XJaL3w6fVg", + provider, + ); + const banks = await program.account.bank.all(); + banks.forEach(({ account: i }) => { + api.add( + i.mint.toString(), + i.indexedBorrows.val.mul(i.borrowIndex.val).toString() / 2 ** (48 * 2), + ); + }); +} + +module.exports = { + depositsTvl, + borrowed, +}; diff --git a/projects/mango-markets-v4/index.js b/projects/mango-markets-v4/index.js index 6a4ecfd061d..bc6b60b162d 100644 --- a/projects/mango-markets-v4/index.js +++ b/projects/mango-markets-v4/index.js @@ -1,24 +1,8 @@ -const { Program } = require("@project-serum/anchor"); -const { getProvider, sumTokens2, } = require("../helper/solana"); -const idl = require('./idl.json') - -async function tvl() { - const provider = getProvider() - const program = new Program(idl, '4MangoMjqJ2firMokCjjGgoK8d4MXcrgL7XJaL3w6fVg', provider) - const banks = await program.account.bank.all() - return sumTokens2({ tokenAccounts: banks.map(i => i.account.vault) }) -} -async function borrowed() { - const { api } = arguments[3] - const provider = getProvider() - const program = new Program(idl, '4MangoMjqJ2firMokCjjGgoK8d4MXcrgL7XJaL3w6fVg', provider) - const banks = await program.account.bank.all() - banks.forEach(({ account: i }) => { - api.add(i.mint.toString(), i.indexedBorrows.val.mul(i.borrowIndex.val).toString() / (2**(48 * 2))) - }) -} +const { ordersTvl } = require("./orders"); +const { depositsTvl, borrowed } = require("./deposits"); +const sdk = require("@defillama/sdk"); module.exports = { timetravel: false, - solana: { tvl, borrowed }, -} + solana: { tvl: sdk.util.sumChainTvls([ordersTvl, depositsTvl ]), borrowed }, +}; diff --git a/projects/mango-markets-v4/orders.js b/projects/mango-markets-v4/orders.js new file mode 100644 index 00000000000..06eae17f131 --- /dev/null +++ b/projects/mango-markets-v4/orders.js @@ -0,0 +1,77 @@ +const { getProvider, decodeAccount } = require("../helper/solana"); +const { PublicKey } = require("@solana/web3.js"); +const { transformBalances } = require("../helper/portedTokens"); +const sdk = require("@defillama/sdk"); +const axios = require("axios"); + +const endpoint = "https://api.mngo.cloud/data/v4/group-metadata"; +const OPENBOOK_ID = new PublicKey( + "srmqPvymJeFKQ4zGQed1GFppgkRHL9kaELCbyksJtPX", +); +const MANGO_GROUP = "78b8f4cGCwmZ9ysPFMWLaLTkkaYnUjwMJYStWe5RTSSX"; + +async function ordersTvl() { + const provider = getProvider(); + + const [stats, openOrdersAccounts] = await Promise.all([ + axios.get(endpoint), + provider.connection.getProgramAccounts(OPENBOOK_ID, { + filters: [ + { + dataSize: 3228, + }, + { + memcmp: { + offset: 45, + bytes: MANGO_GROUP, + }, + }, + ], + }), + ]); + const group = stats.data.groups.find((g) => g.publicKey == MANGO_GROUP); + + const markets = await provider.connection.getMultipleAccountsInfo( + group.serum3Markets.map((m) => new PublicKey(m.serumMarketExternal)), + ); + const decodedMarkets = markets.map((acc) => decodeAccount("openbook", acc)); + + const balances = {}; + + openOrdersAccounts.forEach((account) => { + const oo = decodeAccount("openbookOpenOrders", account.account); + const market = group.serum3Markets.find( + (m) => m.serumMarketExternal === oo.market.toBase58(), + ); + const decodedMarket = decodedMarkets.find( + (m) => m.ownAddress.toBase58() === market.serumMarketExternal, + ); + + const baseToken = group.tokens.find( + (t) => t.tokenIndex === market.baseTokenIndex, + ); + const baseLots = decodedMarket.baseLotSize.toNumber(); + const baseAmount = + (oo.baseTokenTotal.toNumber() * baseLots) / 10 ** baseToken.decimals; + + const quoteToken = group.tokens.find( + (t) => t.tokenIndex === market.quoteTokenIndex, + ); + const quoteLots = decodedMarket.quoteLotSize.toNumber(); + const quoteAmount = + (oo.quoteTokenTotal.toNumber() * quoteLots) / 10 ** quoteToken.decimals; + + sdk.util.sumSingleBalance(balances, baseToken.mint.toString(), baseAmount); + sdk.util.sumSingleBalance( + balances, + quoteToken.mint.toString(), + quoteAmount, + ); + }); + + return transformBalances("solana", balances); +} + +module.exports = { + ordersTvl, +}; From b5fe960ed2b13f967f19cb797696fa4cfcef7ab5 Mon Sep 17 00:00:00 2001 From: LendoraProtocol <147694762+LendoraProtocol@users.noreply.github.com> Date: Tue, 7 Nov 2023 17:17:02 +0800 Subject: [PATCH 1860/1974] Add files via upload (#7971) --- projects/lendoraprotocol/index.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 projects/lendoraprotocol/index.js diff --git a/projects/lendoraprotocol/index.js b/projects/lendoraprotocol/index.js new file mode 100644 index 00000000000..0f1065f74cc --- /dev/null +++ b/projects/lendoraprotocol/index.js @@ -0,0 +1,16 @@ +const { compoundExports2 } = require("../helper/compound"); +const { staking } = require('../helper/staking') + +module.exports = { + scroll: compoundExports2({ + comptroller: '0xA27CDE1F3dcaaF653624049Fc3b1a720eC1D4e91', + fetchBalances: true, + cether: '0xBC7fA7C2dF265d073Be6D1c88468AEB5c06ba07c', + }), +}; + +module.exports.scroll.staking = staking( + ['0xca4fb5541D0f2899549e5f454155E1B34acc9379', '0x578E4f84663260e5C5c64d5310Dd76aA3CEC633c'], + '0x3e6c99915803631D200441CdF6D84786912b0871', + 'scroll' +) From c4a668ca9c0c985a6db09ec960587d8a44e19473 Mon Sep 17 00:00:00 2001 From: dave Date: Tue, 7 Nov 2023 09:39:49 +0000 Subject: [PATCH 1861/1974] adds Gnosis V3 deployment to Adapter (#7975) --- projects/aave/v3.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/projects/aave/v3.js b/projects/aave/v3.js index 5261e5e4701..d961bb7358c 100644 --- a/projects/aave/v3.js +++ b/projects/aave/v3.js @@ -10,6 +10,8 @@ function v3(chain) { params = ['0x9E7B73ffD9D2026F3ff4212c29E209E09C8A91F5', undefined, ['0x99411FC17Ad1B56f49719E3850B2CDcc0f9bBFd8']] else if (chain === 'base') params = ['0x2f6571d3Eb9a4e350C68C36bCD2afe39530078E2', undefined, ['0x2d8A3C5677189723C4cB8873CfC9C8976FDF38Ac']] + else if (chain === 'xdai') + params = ['0x36616cf17557639614c1cdDb356b1B83fc0B2132', undefined, ['0x501B4c19dd9C2e06E94dA7b6D5Ed4ddA013EC741']] const section = borrowed => aaveChainTvl(chain, ...params, borrowed, true); return { tvl: section(false), @@ -20,7 +22,7 @@ function v3(chain) { module.exports = { methodology: `Counts the tokens locked in the contracts to be used as collateral to borrow or to earn yield. Borrowed coins are not counted towards the TVL, so only the coins actually locked in the contracts are counted. There's multiple reasons behind this but one of the main ones is to avoid inflating the TVL through cycled lending`, avax: v3("avax"), - ...["optimism", "fantom", "harmony", "arbitrum", "polygon", "ethereum", "metis", "base"].reduce((t, c) => ({ ...t, [c]: v3(c) }), {}), + ...["optimism", "fantom", "harmony", "arbitrum", "polygon", "ethereum", "metis", "base", "xdai"].reduce((t, c) => ({ ...t, [c]: v3(c) }), {}), hallmarks: [ [1659630089, "Start OP Rewards"], [1650471689, "Start AVAX Rewards"] From 9b24264bca50bd27376dce73bec602a5d9b2423f Mon Sep 17 00:00:00 2001 From: psychoter <124125484+psychoter@users.noreply.github.com> Date: Tue, 7 Nov 2023 13:41:54 +0330 Subject: [PATCH 1862/1974] Add DavinciGraph TVL Adaptor (#7972) * Add DavinciGraph TVL Adaptor * Filter TVL to include only locked LPs --- projects/davincigraph/index.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 projects/davincigraph/index.js diff --git a/projects/davincigraph/index.js b/projects/davincigraph/index.js new file mode 100644 index 00000000000..0ff7c741120 --- /dev/null +++ b/projects/davincigraph/index.js @@ -0,0 +1,14 @@ +const { fetchURL } = require("../helper/utils"); + +module.exports = { + timetravel: false, + methodology: + "The displayed value represents the Total Value Locked (TVL) in USD of all assets secured within the davincigraph token locker smart contracts, accessible at https://davincigraph.io/devs/locks/contracts", + fetch: async () => { + const response = await fetchURL( + "https://davincigraph.network/api/v1/locks/statistics" + ); + + return response.data.tvl.locked.liquidity; + }, +}; From fc03a2ed2f5863350c345c8ac9bf750ef26c9651 Mon Sep 17 00:00:00 2001 From: Define101 Date: Tue, 7 Nov 2023 11:35:04 +0000 Subject: [PATCH 1863/1974] adapter wemix v3 --- projects/wemix-v3/index.js | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 projects/wemix-v3/index.js diff --git a/projects/wemix-v3/index.js b/projects/wemix-v3/index.js new file mode 100644 index 00000000000..7d7fb928820 --- /dev/null +++ b/projects/wemix-v3/index.js @@ -0,0 +1,8 @@ +const { uniV3Export } = require("../helper/uniswapV3"); + +module.exports = uniV3Export({ + wemix: { + factory: "0x8EFf28B531B731814e4E4fFfa0F7Bd0FC50f370F", + fromBlock: 33104424, + }, +}); \ No newline at end of file From 9e50d6b867ec895f1816f9393e019092bcfe1086 Mon Sep 17 00:00:00 2001 From: Winson Cheng <83229800+0xKMG@users.noreply.github.com> Date: Tue, 7 Nov 2023 20:42:11 +0900 Subject: [PATCH 1864/1974] add upcoming vault agedVaultka for tvl (#7977) --- projects/vaultka/index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/projects/vaultka/index.js b/projects/vaultka/index.js index 7c76b824879..aa8ea6909df 100644 --- a/projects/vaultka/index.js +++ b/projects/vaultka/index.js @@ -44,6 +44,7 @@ module.exports = { rum: "0x739fe1BE8CbBeaeA96fEA55c4052Cd87796c0a89", hlpStaking: "0xbE8f8AF5953869222eA8D39F1Be9d03766010B1C", hlp: "0x4307fbDCD9Ec7AEA5a1c2958deCaa6f316952bAb", + agedVodka: "0x9566db22DC32E54234d2D0Ae7B72f44e05158239", }; await api.sumTokens({ @@ -60,6 +61,7 @@ module.exports = { [addresses.gmArb, addresses.vodkaV2], [addresses.gmWeth, addresses.vodkaV2], [addresses.hlp, addresses.rum], + [addresses.fsGlp, addresses.agedVodka], ], }); From 7ee6325eaf6e7a67bace3c09b7ec944fedf572ac Mon Sep 17 00:00:00 2001 From: kappayield-range <131840920+kappayield-range@users.noreply.github.com> Date: Tue, 7 Nov 2023 19:43:12 +0800 Subject: [PATCH 1865/1974] Add pancakeswap(ethereum) & swapsicle(mantle) factories (#7976) --- projects/range/index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/projects/range/index.js b/projects/range/index.js index 0d1f14c426c..eea8a4430f3 100644 --- a/projects/range/index.js +++ b/projects/range/index.js @@ -4,6 +4,7 @@ const ABI = require('./abi.json'); const config ={ ethereum: [ { factory: '0xf1e70677fb1f49471604c012e8B42BA11226336b', fromBlock: 17266660 }, // uniswap + { factory: '0x3edeA0E6E94F75F86c62E1170a66f4e3bD7d77fE', fromBlock: 18460401 } // pancakeswap ], arbitrum: [ { factory: '0xB9084c75D361D1d4cfC7663ef31591DeAB1086d6', fromBlock: 88503603 }, // uniswap @@ -24,6 +25,7 @@ const config ={ { factory: '0x3E89E72026DA6093DD6E4FED767f1f5db2fc0Fb4', fromBlock: 5345161 }, // agni { factory: '0xCCA961F89a03997F834eB5a0104efd9ba1f5800E', fromBlock: 14374189 }, // izumi { factory: '0xD22D1271d108Cd09C38b8E5Be8536E0E366DCd23', fromBlock: 14063599 }, // fusionX + { factory: '0xbf3CC27B036C01A4482d07De191F18F1d8e7B00c', fromBlock: 18309127 } // swapsicle ] } From 04f6b828875fa82fa78a668b2acd43c94d983d6c Mon Sep 17 00:00:00 2001 From: rudewalt Date: Tue, 7 Nov 2023 17:06:03 +0300 Subject: [PATCH 1866/1974] added Marginly adapter (#7979) Co-authored-by: Ivan Sanin --- projects/marginly/config.js | 10 ++++++++++ projects/marginly/index.js | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 projects/marginly/config.js create mode 100644 projects/marginly/index.js diff --git a/projects/marginly/config.js b/projects/marginly/config.js new file mode 100644 index 00000000000..259e58129c5 --- /dev/null +++ b/projects/marginly/config.js @@ -0,0 +1,10 @@ +module.exports = { + arbitrum: { + factories: [ + { + factory: "0x1e36749E00229759dca262cB25Ad8d9B21bEB3F5", + fromBlock: 144171029, + }, + ], + }, +}; diff --git a/projects/marginly/index.js b/projects/marginly/index.js new file mode 100644 index 00000000000..c9dfa7a55dc --- /dev/null +++ b/projects/marginly/index.js @@ -0,0 +1,33 @@ +const { getLogs } = require("../helper/cache/getLogs"); +const { sumTokens2 } = require("../helper/unwrapLPs"); +const config = require("./config"); + +module.exports = { + methodology: + "Counts the number of base and quote tokens in every marginly pool", + timetravel: true, +}; + +Object.keys(config).forEach((chain) => { + const { factories } = config[chain]; + module.exports[chain] = { + tvl: async (_, _b, _2, { api }) => { + const ownerTokens = []; + for (const { factory, fromBlock } of factories) { + const logs = await getLogs({ + api, + target: factory, + topic: "PoolCreated(address,address)", + eventAbi: + "event PoolCreated(address indexed quoteToken, address indexed baseToken, address uniswapPool, bool quoteTokenIsToken0, address pool)", + onlyArgs: true, + fromBlock, + }); + logs.forEach((i) => + ownerTokens.push([[i.quoteToken, i.baseToken], i.pool]) + ); + } + return sumTokens2({ api, ownerTokens }); + }, + }; +}); From bddfecdbc2c9b73390dbbd1dcd5d70f7673ea84c Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Tue, 7 Nov 2023 16:27:33 +0000 Subject: [PATCH 1867/1974] export as hedera tvl --- projects/davincigraph/index.js | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/projects/davincigraph/index.js b/projects/davincigraph/index.js index 0ff7c741120..73f37bce1ac 100644 --- a/projects/davincigraph/index.js +++ b/projects/davincigraph/index.js @@ -1,14 +1,22 @@ const { fetchURL } = require("../helper/utils"); +async function hedera() { + const response = await fetchURL( + "https://davincigraph.network/api/v1/locks/statistics" + ); + + return response.data.tvl.locked.liquidity; +}; +async function fetch() { + return await hedera() +}; + module.exports = { timetravel: false, methodology: "The displayed value represents the Total Value Locked (TVL) in USD of all assets secured within the davincigraph token locker smart contracts, accessible at https://davincigraph.io/devs/locks/contracts", - fetch: async () => { - const response = await fetchURL( - "https://davincigraph.network/api/v1/locks/statistics" - ); - - return response.data.tvl.locked.liquidity; - }, + hedera: { + fetch: hedera + }, + fetch }; From b3537d093e9c4a5c765bce3ff9baf71889bbd2b0 Mon Sep 17 00:00:00 2001 From: GrokSwap <150107773+grokswapfinance@users.noreply.github.com> Date: Wed, 8 Nov 2023 01:52:31 +0700 Subject: [PATCH 1868/1974] Add GrokSwap Dex (#7983) Co-authored-by: Grok Swap --- projects/grokswap/index.js | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 projects/grokswap/index.js diff --git a/projects/grokswap/index.js b/projects/grokswap/index.js new file mode 100644 index 00000000000..996f30a929d --- /dev/null +++ b/projects/grokswap/index.js @@ -0,0 +1,11 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports = { + misrepresentedTokens: true, + op_bnb: { + tvl: getUniTVL({ + useDefaultCoreAssets: true, + factory: "0x01D434704aFf3edDb37eFB49f4bFE697e67b3BD0", + }), + }, +}; From bb04c4ebd9ff6a3f7303bab633b8ca4d87a53c62 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 7 Nov 2023 20:07:45 +0100 Subject: [PATCH 1869/1974] Metava (#7985) * Add Metavault V3 AMM tvl adapter * code refactor --------- Co-authored-by: 0xR <0xr@metavault.org> --- projects/davincigraph/index.js | 2 +- projects/metavault-v3/index.js | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 projects/metavault-v3/index.js diff --git a/projects/davincigraph/index.js b/projects/davincigraph/index.js index 73f37bce1ac..199aeeaab6e 100644 --- a/projects/davincigraph/index.js +++ b/projects/davincigraph/index.js @@ -1,4 +1,4 @@ -const { fetchURL } = require("../helper/utils"); +const { fetchURL } = require("../helper/utils") async function hedera() { const response = await fetchURL( diff --git a/projects/metavault-v3/index.js b/projects/metavault-v3/index.js new file mode 100644 index 00000000000..c78ab36597b --- /dev/null +++ b/projects/metavault-v3/index.js @@ -0,0 +1,8 @@ +const { uniV3Export } = require("../helper/uniswapV3") + +const factory = "0x9367c561915f9D062aFE3b57B18e30dEC62b8488" // same on all chains + +module.exports = uniV3Export({ + linea: { factory, fromBlock: 652486, }, + scroll: { factory, fromBlock: 77008, }, +}) \ No newline at end of file From 6a7fe574315d4a5edf011bf41ddadfc61241542b Mon Sep 17 00:00:00 2001 From: Yotam Katznelson Date: Tue, 7 Nov 2023 20:21:28 +0000 Subject: [PATCH 1870/1974] feat: Add two new Backed Finance tokens (#7981) --- projects/backed/index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/projects/backed/index.js b/projects/backed/index.js index a4cbc55eadb..e75e61a0e92 100644 --- a/projects/backed/index.js +++ b/projects/backed/index.js @@ -9,6 +9,8 @@ const contracts = [ "0x52d134c6DB5889FaD3542A09eAf7Aa90C0fdf9E4", // bIBTA "0x1e2c4fb7ede391d116e6b41cd0608260e8801d59", // bCSPX "0x20C64dEE8FdA5269A78f2D5BDBa861CA1d83DF7a", // bHIGH + "0x3f95AA88dDbB7D9D484aa3D482bf0a80009c52c9", // bERNX + "0xAde6057FcAfa57d6d51FFa341C64ce4814995995", // bZPR1 ].map(i => i.toLowerCase()) const blacklistedOwners = [ From 3bf61e374da240dd7dcda50f5b6d2a52ec16ba21 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Tue, 7 Nov 2023 22:08:03 +0000 Subject: [PATCH 1871/1974] add bonk to distressed --- projects/helper/tokenMapping.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 1fcb82c91f8..ad2fc41538b 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -26,7 +26,8 @@ const distressedAssts = new Set(Object.values({ XRPC: '0xd4ca5c2aff1eefb0bea9e9eab16f88db2990c183', FLEET: '0xfd56a3dcfc0690881a466ae432d71bb2db588083', YAKU: 'NGK3iHqqQkyRZUj4uhJDQqEyKKcZ7mdawWpqwMffM3s', - JEFI: '0x80fa6d5384bdde296a28a321f73ab70977575129' + JEFE: '0x80fa6d5384bdde296a28a321f73ab70977575129', + BONK: 'DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263' }).map(i => i.toLowerCase())) const transformTokens = { From 75c1e033c3d5d5d7b70e904f3621e26a3f3d123a Mon Sep 17 00:00:00 2001 From: charq <73696209+buchaoqun@users.noreply.github.com> Date: Wed, 8 Nov 2023 06:53:38 +0800 Subject: [PATCH 1872/1974] add arbitrum tvl (#7959) --- projects/solv-protocol-funds/index.js | 50 +++++++++++++++++++++++---- 1 file changed, 44 insertions(+), 6 deletions(-) diff --git a/projects/solv-protocol-funds/index.js b/projects/solv-protocol-funds/index.js index 6ff4d5e3fd2..dda37b5cbae 100644 --- a/projects/solv-protocol-funds/index.js +++ b/projects/solv-protocol-funds/index.js @@ -2,6 +2,7 @@ const { default: BigNumber } = require("bignumber.js"); const { getConfig } = require("../helper/cache"); const abi = require("./abi.json"); const { cachedGraphQuery } = require("../helper/cache"); +const { sumTokens2 } = require("../helper/unwrapLPs"); // The Graph const graphUrlList = { @@ -13,13 +14,30 @@ const graphUrlList = { const slotListUrl = 'https://cdn.jsdelivr.net/gh/solv-finance-dev/solv-protocol-rwa-slot/slot.json'; -async function tvl(ts) { +const depositAddress = [ + "0x9f6478a876d7765f44bda712573820eb3ae389fb", + "0xcac14cd2f18dcf54032bd51d0a116fe18770b87c" +] + +const gmTokens = [ + "0x70d95587d40a2caf56bd97485ab3eec10bee6336", + "0x47c031236e19d024b42f8AE6780E44A573170703", + "0xC25cEf6061Cf5dE5eb761b50E4743c1F5D7E5407", + "0x7f1fa204bb700853D36994DA19F830b6Ad18455C", + "0x09400D9DB990D5ed3f35D7be61DfAEB900Af03C9", + "0xc7Abb2C5f3BF3CEB389dF0Eecd6120D451170B50", +] + +async function borrowed(ts) { const { api } = arguments[3]; const network = api.chain; const graphData = await getGraphData(ts, network, api); - if (graphData.pools.length > 0) { - const pools = graphData.pools; + const poolLists = graphData.pools; + var pools = poolLists.filter((value) => { + return depositAddress.indexOf(value.vault) == -1; + }); + const poolConcretes = await concrete(pools, api); const nav = await api.multiCall({ abi: abi.getSubscribeNav, @@ -59,6 +77,19 @@ async function tvl(ts) { return api.getBalances() } +async function tvl() { + const { api } = arguments[3]; + + let tokens = [] + for (const pool of depositAddress) { + for (const address of gmTokens) { + tokens.push({ address, pool }) + } + } + + await sumTokens2({ api, tokensAndOwners: tokens.map(i => [i.address, i.pool]), permitFailure: true }) +} + async function concrete(slots, api) { var slotsList = []; var only = {}; @@ -92,6 +123,7 @@ async function getGraphData(timestamp, chain, api) { contractAddress navOracle poolId + vault openFundShareSlot } }`; @@ -107,6 +139,12 @@ async function getGraphData(timestamp, chain, api) { }; } // node test.js projects/solv-protocol-funds -['ethereum', 'bsc', 'arbitrum', 'mantle'].forEach(chain => { - module.exports[chain] = { tvl: () => ({}), borrowed: tvl, } -}) \ No newline at end of file +module.exports = { + arbitrum: { + tvl, + borrowed: borrowed, + }, + mantle: { + borrowed: borrowed, + } +}; \ No newline at end of file From ca0d4c76f903b709b5fc33c7bde8b2db9811a4f4 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 8 Nov 2023 00:32:15 +0100 Subject: [PATCH 1873/1974] fix visor --- projects/helper/env.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/helper/env.js b/projects/helper/env.js index 779d339cf7c..1413b2b01d8 100644 --- a/projects/helper/env.js +++ b/projects/helper/env.js @@ -12,6 +12,7 @@ const DEFAULTS = { ANKR_API_KEY: '79258ce7f7ee046decc3b5292a24eb4bf7c910d7e39b691384c7ce0cfb839a01', RENEC_RPC: "https://api-mainnet-beta.renec.foundation:8899/", CHZ_RPC: "https://chiliz.publicnode.com,https://rpc.ankr.com/chiliz", + MANTLE_RPC:"https://mantle.publicnode.com,https://rpc.ankr.com/mantle,https://mantle.drpc.org,https://1rpc.io/mantle,https://mantle-mainnet.public.blastapi.io", } const ENV_KEYS = [ From 495e3b7a86620e1af58173ff2f8808e7135889d3 Mon Sep 17 00:00:00 2001 From: Shunji Zhan Date: Wed, 8 Nov 2023 18:10:49 +0800 Subject: [PATCH 1874/1974] added acala euphrates adapter (#7861) * added acala euphrates adapter * update * use chain data for euphrates tvl * code refactor --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/acala-euphrates/index.js | 24 ++++++++++++++++++++++++ projects/helper/env.js | 1 + 2 files changed, 25 insertions(+) create mode 100644 projects/acala-euphrates/index.js diff --git a/projects/acala-euphrates/index.js b/projects/acala-euphrates/index.js new file mode 100644 index 00000000000..65d9ed1f106 --- /dev/null +++ b/projects/acala-euphrates/index.js @@ -0,0 +1,24 @@ +const euphrates = '0x7Fe92EC600F15cD25253b421bc151c51b0276b7D'; +const ldotAddr = '0x0000000000000000000100000000000000000003'; +const wtdotAddr = '0xe1bD4306A178f86a9214c39ABCD53D021bEDb0f9'; + +async function tvl(timestamp) { + const { api } = arguments[3] + const [rate, wdotBal, ldotBal] = await Promise.all([ + api.call({ abi: 'uint256:withdrawRate', target: wtdotAddr }), + api.call({ abi: 'erc20:balanceOf', target: wtdotAddr, params: euphrates }), + api.call({ abi: 'erc20:balanceOf', target: ldotAddr, params: euphrates }), + ]) + api.add('liquid-staking-dot', ldotBal / 1e10, { skipChain: true }) + api.add('polkadot', wdotBal * rate / 1e28, { skipChain: true }) + return api.getBalances() +} + +module.exports = { + misrepresentedTokens: true, + start: 1695657600, + methodology: 'total ldot and tdot locked in the euphrates contract', + acala: { + tvl, + } +} \ No newline at end of file diff --git a/projects/helper/env.js b/projects/helper/env.js index 1413b2b01d8..d39c51699b6 100644 --- a/projects/helper/env.js +++ b/projects/helper/env.js @@ -10,6 +10,7 @@ const DEFAULTS = { SUI_RPC: 'https://fullnode.mainnet.sui.io/', MULTIVERSX_RPC: 'https://api.multiversx.com', ANKR_API_KEY: '79258ce7f7ee046decc3b5292a24eb4bf7c910d7e39b691384c7ce0cfb839a01', + ACALA_RPC: "https://eth-rpc-acala.aca-api.network", RENEC_RPC: "https://api-mainnet-beta.renec.foundation:8899/", CHZ_RPC: "https://chiliz.publicnode.com,https://rpc.ankr.com/chiliz", MANTLE_RPC:"https://mantle.publicnode.com,https://rpc.ankr.com/mantle,https://mantle.drpc.org,https://1rpc.io/mantle,https://mantle-mainnet.public.blastapi.io", From 7b4999af8b6c37bfe67a214b8aa09892748a61e8 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 8 Nov 2023 11:13:23 +0100 Subject: [PATCH 1875/1974] lint fix --- projects/davincigraph/index.js | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/projects/davincigraph/index.js b/projects/davincigraph/index.js index 199aeeaab6e..e147e17be32 100644 --- a/projects/davincigraph/index.js +++ b/projects/davincigraph/index.js @@ -1,22 +1,17 @@ const { fetchURL } = require("../helper/utils") -async function hedera() { - const response = await fetchURL( - "https://davincigraph.network/api/v1/locks/statistics" - ); - - return response.data.tvl.locked.liquidity; -}; async function fetch() { - return await hedera() -}; + const response = await fetchURL("https://davincigraph.network/api/v1/locks/statistics") + + return response.data.tvl.locked.liquidity +} module.exports = { timetravel: false, methodology: "The displayed value represents the Total Value Locked (TVL) in USD of all assets secured within the davincigraph token locker smart contracts, accessible at https://davincigraph.io/devs/locks/contracts", hedera: { - fetch: hedera - }, fetch + }, + fetch }; From f226fde9a3dcff6e2d3979b62deb467737447f9a Mon Sep 17 00:00:00 2001 From: Define101 Date: Wed, 8 Nov 2023 11:15:35 +0000 Subject: [PATCH 1876/1974] add FDUSD coreassets --- projects/helper/coreAssets.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index dc23a3a8189..456b55eb161 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -40,7 +40,8 @@ "sUSD_OLD": "0x57ab1e02fee23774580c119740129eac7081e9d3", "sUSD": "0x57Ab1ec28D129707052df4dF418D58a2D46d5f51", "SUSHI": "0x6b3595068778dd592e39a122f4f5a5cf09c90fe2", - "cbETH": "0xBe9895146f7AF43049ca1c1AE358B0541Ea49704" + "cbETH": "0xBe9895146f7AF43049ca1c1AE358B0541Ea49704", + "FDUSD": "0xc5f0f7b66764f6ec8c8dff7ba683102295e16409" }, "fantom": { "WFTM": "0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83", @@ -1475,5 +1476,8 @@ }, "ethf": { "WETH": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2" + }, + "eon": { + "WETH": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2" } } From 1e3ea312cefba3b9083b17ba1d639f84498b87d9 Mon Sep 17 00:00:00 2001 From: Define101 Date: Wed, 8 Nov 2023 11:17:15 +0000 Subject: [PATCH 1877/1974] add new wallets binance --- projects/binance/config.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/projects/binance/config.js b/projects/binance/config.js index b6045b055a1..2abbde61049 100644 --- a/projects/binance/config.js +++ b/projects/binance/config.js @@ -89,6 +89,7 @@ const assetList = [ ["BUSD", "BEP2", "bnb1lsmt5a8vqqus5fwslx8pyyemgjtg4y6ugj308t"], ["BUSD", "BEP2", "bnb1m5amny2gs3xdyta6pksmr43zu4727w24syyks7"], ["BUSD", "BEP2", "bnb1u2agwjat20494fmc6jnuau0ls937cfjn4pjwtn"], + ["USDT", "BEP2", "bnb1u2agwjat20494fmc6jnuau0ls937cfjn4pjwtn"], ["BUSD", "BEP2", "bnb1xrfwzlu9c5208lhtn7ywt0mjrhjh4nt4fjyqxy"], ["BUSD", "BEP20", "0x01c952174c24e1210d26961d456a77a39e1f0bb0"], ["BUSD", "BEP20", "0x161ba15a5f335c9f06bb5bbb0a9ce14076fbb645"], @@ -304,6 +305,9 @@ const assetList = [ ["MATIC", "MATIC", "0xf977814e90da44bfa03b6295a0616a897441acec"], ["OP", "OP", "0xF977814e90dA44bFA03b6295A0616a897441aceC"], ["OP", "OP", "0xacd03d601e5bb1b275bb94076ff46ed9d753435a"], + ["FDUSD", "ETH", "0x5a52E96BAcdaBb82fd05763E25335261B270Efcb"], + ["ETH", "OP", "0x5a52E96BAcdaBb82fd05763E25335261B270Efcb"], + ["ETH", "ARB", "0x5a52E96BAcdaBb82fd05763E25335261B270Efcb"], ["SHIB", "BEP20", "0x161ba15a5f335c9f06bb5bbb0a9ce14076fbb645"], ["SHIB", "BEP20", "0x1fbe2acee135d991592f167ac371f3dd893a508b"], ["SHIB", "BEP20", "0x3c783c21a0383057d128bae431894a5c19f9cf06"], @@ -357,6 +361,7 @@ const assetList = [ ["TRX", "TRX", "TDqSquXBgUCLYvYC4XZgrprLK589dkhSCf"], ["USDC", "TRX", "TDqSquXBgUCLYvYC4XZgrprLK589dkhSCf"], ["USDT", "TRX", "TDqSquXBgUCLYvYC4XZgrprLK589dkhSCf"], + ["BUSD", "TRX", "TDqSquXBgUCLYvYC4XZgrprLK589dkhSCf"], ["UNI", "BEP2", "bnb142q467df6jun6rt5u2ar58sp47hm5f9wvz2cvg"], ["UNI", "BEP2", "bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz"], ["UNI", "BEP2", "bnb1lsmt5a8vqqus5fwslx8pyyemgjtg4y6ugj308t"], From 674df94d6895aec7280f523b2cf2753082af8210 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 8 Nov 2023 12:30:03 +0100 Subject: [PATCH 1878/1974] fix broken adapters --- projects/moremoney/StrategyMetadata.js | 6 +++--- projects/steakHut-lb/index.js | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/projects/moremoney/StrategyMetadata.js b/projects/moremoney/StrategyMetadata.js index 23fc0404589..fc54552b84a 100644 --- a/projects/moremoney/StrategyMetadata.js +++ b/projects/moremoney/StrategyMetadata.js @@ -65,12 +65,12 @@ async function useLegacyIsolatedStrategyMetadata(block) { curAddresses.YieldYakStrategy, ["0xeD8CBD9F0cE3C6986b22002F03c6475CEb7a6256"]: curAddresses.YieldYakStrategy, - ["0x454E67025631C065d3cFAD6d71E6892f74487a15"]: - curAddresses.TraderJoeMasterChefStrategy, ["0x2148D1B21Faa7eb251789a51B404fc063cA6AAd6"]: curAddresses.SimpleHoldingStrategy, + /*["0x454E67025631C065d3cFAD6d71E6892f74487a15"]: + curAddresses.TraderJoeMasterChefStrategy, ["0xCDFD91eEa657cc2701117fe9711C9a4F61FEED23"]: - curAddresses.MultiTraderJoeMasterChef3Strategy, + curAddresses.MultiTraderJoeMasterChef3Strategy, */ }; // const masterChef2Tokens = [ // ADDRESSES.avax.xJOE, diff --git a/projects/steakHut-lb/index.js b/projects/steakHut-lb/index.js index ae265b2a490..e4434a83b91 100644 --- a/projects/steakHut-lb/index.js +++ b/projects/steakHut-lb/index.js @@ -15,7 +15,7 @@ const _vaults = { '0x9cc15d1204d768380cec8d35bc1d8e1945083397', //BTC.b/USDC_B '0x536d7e7423e8fb799549caf574cfa12aae95ffcd', //BTC.b/AVAX_B '0x9bdda0c0cd56d98a8165fddabdeb7f9aee2d993e', //GMX/AVAX - '0xFFE588AC8d94c758AFaC5c50A4b4bF4BC1887fFD', //CAI/AVAX + // '0xFFE588AC8d94c758AFaC5c50A4b4bF4BC1887fFD', //CAI/AVAX ], arbitrum: [ '0x862f459c3c1f8949b3f5b624d39134d61697946e', //GMX/ETH From 5b96958cba54cf56d9090cd2129efccbf60cb669 Mon Sep 17 00:00:00 2001 From: Define101 Date: Wed, 8 Nov 2023 12:18:58 +0000 Subject: [PATCH 1879/1974] add correct address to beamswap stableswap --- projects/beamswap-stableswap/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/beamswap-stableswap/index.js b/projects/beamswap-stableswap/index.js index 76c6918a2b6..1fe47629944 100644 --- a/projects/beamswap-stableswap/index.js +++ b/projects/beamswap-stableswap/index.js @@ -6,7 +6,7 @@ const abi = { async function tvl(_, _b, _2, { api }) { const pools = [ - '0x8273De7090C7067f3aE1b6602EeDbd2dbC02C48f', // multichain 3 pool + '0xE3f59aB3c37c33b6368CDF4f8AC79644011E402C', // multichain 3 pool '0x09A793cCa9D98b14350F2a767Eb5736AA6B6F921', // nomad 3 pool ] From b3a6112563e6444b2b404a8caea8765bdb9d312a Mon Sep 17 00:00:00 2001 From: llama Date: Wed, 8 Nov 2023 15:09:47 +0100 Subject: [PATCH 1880/1974] track lava --- projects/helper/tokenMapping.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index ad2fc41538b..a955e67aa5e 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -69,6 +69,8 @@ const fixBalancesTokens = { '0x457dE4e275A6b3C0D3750519221dD1dF19d54f01': { coingeckoId: 'edgeware', decimals: 18 }, }, elsm: { + [ADDRESSES.null]: { coingeckoId: 'lava', decimals: 18 }, + '0xd80Ef77B0289732e13D1769850B5A70eCC196777': { coingeckoId: 'lava', decimals: 18 }, '0xa801b1a7846156d4c81bd188f96bfcb621517611': { coingeckoId: 'vulcan-forged', decimals: 18 }, }, arbitrum: { From 3502dfa0bef2f7666f16354b51dfd3782f023478 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Wed, 8 Nov 2023 15:52:17 +0000 Subject: [PATCH 1881/1974] update address --- projects/stars-league/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/stars-league/index.js b/projects/stars-league/index.js index 1bf70103b12..c8aab9e3bea 100644 --- a/projects/stars-league/index.js +++ b/projects/stars-league/index.js @@ -2,6 +2,6 @@ const { nullAddress, sumTokensExport, } = require('../helper/unwrapLPs') module.exports = { chz: { - tvl: sumTokensExport({ tokens: [nullAddress], owner: '0x46d6Ac52852462687379EE3e4642155A849e203F' }) + tvl: sumTokensExport({ tokens: [nullAddress], owner: '0xFaD9Fb76EE13aBFe08F8B17d3898a19902b6f9FB' }) } } \ No newline at end of file From a3325cb49b1eee71b247c0caba82e4debcc7c0d0 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 9 Nov 2023 10:31:14 +0100 Subject: [PATCH 1882/1974] Goku (#8001) * feat: add Goku Monery adapter * code refactor --------- Co-authored-by: Jack --- projects/goku-money/index.js | 50 ++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 projects/goku-money/index.js diff --git a/projects/goku-money/index.js b/projects/goku-money/index.js new file mode 100644 index 00000000000..ba5680818fb --- /dev/null +++ b/projects/goku-money/index.js @@ -0,0 +1,50 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokens2, sumTokensExport } = require('../helper/unwrapLPs') + +const COLLATERALS = { + [ADDRESSES.manta.USDC]: { + activePool: "0x50ef8B64c02B7913f15CbCDF0E7F44CC261195D6", + defaultPool: "0xac84B99F253F05b00bff36a06fA1CA5f5754E80F", + }, + [ADDRESSES.manta.USDT]: { + activePool: "0x74242b001869037594c8b59b191DF7284c6A3801", + defaultPool: "0xF42cE1F6F90Ea3B6254E2390B7E9467Fb1584AAA", + }, + "0x6Fae4D9935E2fcb11fC79a64e917fb2BF14DaFaa": { + activePool: "0x00A14CF3A66De2D4585F399Ed4240d0F2730fFCB", + defaultPool: "0x6851255D2CEc9D66502282D3C6F11f552186eDA7", + }, + [ADDRESSES.manta.WETH]: { + activePool: "0xd58300481551F2bB81343abB5C6288fEaCC72Be4", + defaultPool: "0x2C903a6858374925f5020B8EA2D88E545515eD4D", + } +} + +const GAI_TOKEN_ADDRESS = "0xcd91716ef98798A85E79048B78287B13ae6b99b2" +const GOK_TOKEN_ADDRESS = "0x387660bc95682587efc12c543c987abf0fb9778f" + +const GOK_STAKES = { + USDC: "0x60e47C06E3999c1Ef8bC5A424FCd665925CB0FB1", + USDT: "0x1343804D5936EA6E98988F27870b913b1c93081e", + TIA: "0xD2fBB34Bd69EC810AF2D243eA2192e7c89a696dA", + WETH: "0x4CF0Ac5Ac97E8d58e798eBc4EaB9afF17481c5F5", +} + +async function tvl(ts, _block, chainBlocks, { api }) { + const tokensAndOwners = [] + for (const [collateral, collateralInfo] of Object.entries(COLLATERALS)) { + const { activePool, defaultPool } = collateralInfo + tokensAndOwners.push([collateral, activePool]) + tokensAndOwners.push([collateral, defaultPool]) + } + return sumTokens2({ api, tokensAndOwners, }) +} + +module.exports = { + start: 1698768000, // 01 Nov 2023 + methodology: "Total locked collateral assets (in ERC-20 form) in ActivePool and DefaultPool, plus total staked GAI in StabilityPool", + manta: { + tvl, + staking: sumTokensExport({ owners: Object.values(GOK_STAKES), tokens: [GOK_TOKEN_ADDRESS], }), + }, +}; From 75dcd2df5b990f7be0699bbfdb0559f116429612 Mon Sep 17 00:00:00 2001 From: PerseidFinance <148605098+PerseidFinance@users.noreply.github.com> Date: Thu, 9 Nov 2023 17:39:20 +0800 Subject: [PATCH 1883/1974] $PED token price calculation motification (#7997) --- projects/perseid-finance/index.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/projects/perseid-finance/index.js b/projects/perseid-finance/index.js index 04cd2a907ca..505ae7c7423 100644 --- a/projects/perseid-finance/index.js +++ b/projects/perseid-finance/index.js @@ -24,12 +24,12 @@ const getTvl = isStaking => async (_, _1, _2, { api }) => { if (!pools) return {} const pedBal = pools[2] - const [usdtLPBal, pedLPBal] = await api.multiCall({ abi: 'erc20:balanceOf', calls: [ - { target: ADDRESSES.scroll.USDT, params: NATIVE_LP_ADDRESS }, - { target: NATIVE_ADDRES, params: NATIVE_LP_ADDRESS }, - ]}) + const {sqrtPrice_96} = await api.call({abi:abi.state,target:NATIVE_LP_ADDRESS}) + let price = (sqrtPrice_96/2**96)**2 + let pedPrice = 1/price*10**12 + let pedAmount = pedPrice*(pedBal/10**18) - api.add(ADDRESSES.scroll.USDT, pedBal * usdtLPBal / pedLPBal) + api.add(ADDRESSES.scroll.USDT, pedAmount*10**6) return api.getBalances() } @@ -43,5 +43,6 @@ module.exports = { const abi = { "getPoolTotalTvl": "function getPoolTotalTvl() view returns (tuple(uint256 pid, address assets, uint256 tvl)[])", - "getReserves": "function getReserves() external view returns (uint _reserve0, uint _reserve1)" + "getReserves": "function getReserves() external view returns (uint _reserve0, uint _reserve1)", + "state":'function state() external view returns(uint160 sqrtPrice_96,int24 currentPoint,uint16 observationCurrentIndex,uint16 observationQueueLen,uint16 observationNextQueueLen,bool locked,uint128 liquidity,uint128 liquidityX)' } \ No newline at end of file From a83ab2b05f80cd5240c4798583eb858974ee40ba Mon Sep 17 00:00:00 2001 From: zimrain <112904630+zimrain@users.noreply.github.com> Date: Thu, 9 Nov 2023 17:42:16 +0800 Subject: [PATCH 1884/1974] Add Derivio TVL adapter (#7996) --- projects/derivio/index.js | 20 ++++++++++++++++++++ projects/helper/coreAssets.json | 3 ++- 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 projects/derivio/index.js diff --git a/projects/derivio/index.js b/projects/derivio/index.js new file mode 100644 index 00000000000..f1b02f9bfd9 --- /dev/null +++ b/projects/derivio/index.js @@ -0,0 +1,20 @@ +const { sumTokens2 } = require("../helper/unwrapLPs"); + +function tvl({ pool }) { + return async (ts, _block, _, { api }) => { + const tokenAddresses = await api.call({ + target: pool, + abi: 'function getAssetWhitelist() view returns (address[] memory)', + }) + return sumTokens2({ api, owner: pool, tokens: tokenAddresses }) + } +} + +// era +const DLPM = '0xfc00dAC251711508D4dD7b0C310e913575988838' + +module.exports = { + era: { + tvl: tvl({ pool: DLPM, }) + }, +}; diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index 456b55eb161..a2d788dc063 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -1267,7 +1267,8 @@ "USDC": "0x3355df6d4c9c3035724fd0e3914de96a5a83aaf4", "WBTC": "0xBBeB516fb02a01611cBBE0453Fe3c580D7281011", "USDT": "0x493257fD37EDB34451f62EDf8D2a0C418852bA4C", - "BUSD": "0x2039bb4116B4EFc145Ec4f0e2eA75012D6C0f181" + "BUSD": "0x2039bb4116B4EFc145Ec4f0e2eA75012D6C0f181", + "DAI": "0x4B9eb6c0b6ea15176BBF62841C6B2A8a398cb656" }, "polygon_zkevm": { "WETH": "0x4F9A0e7FD2Bf6067db6994CF12E4495Df938E6e9", From 58e913e97d6cb75fa7357830bdc10e7370de2533 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 9 Nov 2023 10:53:20 +0100 Subject: [PATCH 1885/1974] Voodoo (#8002) * feat: Migrate Voodoo to Base * code refactor: retain fantom part --------- Co-authored-by: chicken-juju --- projects/voodoo-trade/index.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/projects/voodoo-trade/index.js b/projects/voodoo-trade/index.js index 241542fd87f..657759f56ae 100644 --- a/projects/voodoo-trade/index.js +++ b/projects/voodoo-trade/index.js @@ -1,13 +1,15 @@ const { gmxExports } = require("../helper/gmx"); const { pool2 } = require("../helper/pool2"); -const vault = "0x40cbDDAED8b0d7Ee3cF347aAb09Bf4a8cFa15F01"; -const lpToken = "0xC42437A6da389D88799A9e706da3EA6628342295"; -const stakedLpTokenTracker = "0xBf47b011C36F29e7C65b6cf34c1d838EA1b67069"; +const config = { + fantom: { vault: '0x40cbDDAED8b0d7Ee3cF347aAb09Bf4a8cFa15F01', lpToken: '0xC42437A6da389D88799A9e706da3EA6628342295', stakedLpTokenTracker: '0xBf47b011C36F29e7C65b6cf34c1d838EA1b67069' }, + base: { vault: '0x4F188Afdc40e6D2Ddddf5fd1b2DF7AEF7Da52f50', lpToken: '0xbF65A2775F0a091a8e667a1c1345c427C9D86761', stakedLpTokenTracker: '0x1DD46Dd21F152f97848b32D504de491E696bA1C5' }, +} -module.exports = { - fantom: { +Object.keys(config).forEach(chain => { + const { vault, lpToken, stakedLpTokenTracker, } = config[chain] + module.exports[chain] = { tvl: gmxExports({ vault }), pool2: pool2(stakedLpTokenTracker, lpToken,), - }, -}; \ No newline at end of file + } +}) From b4e3c79c85a44f51db8e97221007fdd41a3dbfec Mon Sep 17 00:00:00 2001 From: Phil <30321052+philipjames44@users.noreply.github.com> Date: Thu, 9 Nov 2023 03:01:33 -0700 Subject: [PATCH 1886/1974] Sommelier: Add Turbo SOMM Vault (#7993) * Sommelier: Add RYBTC launch and remove Steady, Trend, & MOM vault launches * Sommelier: Add Turbo GHO vault * Update start block * Sommelier: Dedupe vaults taking position in ssister vaults from TVL * Add ETH Growth vault * Add turbo steth cellar * Add Turbo SOMM --- projects/sommelier/cellar-constants.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/projects/sommelier/cellar-constants.js b/projects/sommelier/cellar-constants.js index 8843998e3a4..9348e9d6b46 100644 --- a/projects/sommelier/cellar-constants.js +++ b/projects/sommelier/cellar-constants.js @@ -48,12 +48,14 @@ const TURBO_SWETH = "0xd33dad974b938744dac81fe00ac67cb5aa13958e"; const TURBO_GHO = "0x0c190ded9be5f512bd72827bdad4003e9cc7975c"; const ETH_GROWTH = "0x6c51041a91c91c86f3f08a72cb4d3f67f1208897"; const TURBO_STETH = "0xfd6db5011b171b05e1ea3b92f9eacaeeb055e971"; +const TURBO_SOMM = "0x5195222f69c5821f8095ec565e71e18ab6a2298f"; const cellarsV2p5 = [ { id: TURBO_SWETH, startBlock: 17910374 }, { id: TURBO_GHO, startBlock: 18118614 }, { id: ETH_GROWTH, startBlock: 18144591 }, { id: TURBO_STETH, startBlock: 18330620 }, + { id: TURBO_SOMM, startBlock: 18516369 }, ]; module.exports = { From f1ed92f45aebf1793141e553230a278568ec89d0 Mon Sep 17 00:00:00 2001 From: Antoine <67124021+antoineborg@users.noreply.github.com> Date: Thu, 9 Nov 2023 11:04:50 +0100 Subject: [PATCH 1887/1974] Add Solana wallet (#7990) --- projects/swissborg/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/swissborg/index.js b/projects/swissborg/index.js index f46e5ae023b..aa88c6836e8 100644 --- a/projects/swissborg/index.js +++ b/projects/swissborg/index.js @@ -45,6 +45,7 @@ const config = { '2XxP4kS2vfkiMvpLpGNxry3fPUYimsuAmSbqL1KnuwZ8', 'Cet3t77x2BBVSmiEFm8ZPoDSngbpso2RuWPL79Ky7SpA', '9qoUcyhKSWMbk6tqGUYQUpeosPcdUnJszG4eQKwfe4gL', + 'Fe7SEekiKygziaEGKxsDsgLVzrCfNvVBvAYsaJBwFA8s', ], }, polkadot: { From ccf5c9095ae08443c220a620e847c865eb416170 Mon Sep 17 00:00:00 2001 From: Define101 Date: Thu, 9 Nov 2023 11:19:36 +0000 Subject: [PATCH 1888/1974] add btc wallets binance --- projects/binance/config.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/projects/binance/config.js b/projects/binance/config.js index 2abbde61049..f10f738a1b3 100644 --- a/projects/binance/config.js +++ b/projects/binance/config.js @@ -47,13 +47,13 @@ const assetList = [ ["BNB", "BEP20", "0xeb2d2f1b8c558a40207669291fda468e50c8a0bb"], ["BNB", "BEP20", "0xf977814e90da44bfa03b6295a0616a897441acec"], ["BNB", "ETH", "0x28c6c06298d514db089934071355e5743bf21d60"], - // ["BTC", "BEP2", "bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz"], -// ["BTC", "BEP2", "bnb1lsmt5a8vqqus5fwslx8pyyemgjtg4y6ugj308t"], -// ["BTC", "BEP2", "bnb1u2agwjat20494fmc6jnuau0ls937cfjn4pjwtn"], -// ["BTC", "BEP20", "0x5a52e96bacdabb82fd05763e25335261b270efcb"], -// ["BTC", "BEP20", "0x8894e0a0c962cb723c1976a4421c95949be2d4e3"], -// ["BTC", "BEP20", "0xe2fc31f816a9b94326492132018c3aecc4a93ae1"], -// ["BTC", "BEP20", "0xf977814e90da44bfa03b6295a0616a897441acec"], + ["BTC", "BEP2", "bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz"], + ["BTC", "BEP2", "bnb1lsmt5a8vqqus5fwslx8pyyemgjtg4y6ugj308t"], + ["BTC", "BEP2", "bnb1u2agwjat20494fmc6jnuau0ls937cfjn4pjwtn"], + ["BTC", "BEP20", "0x5a52e96bacdabb82fd05763e25335261b270efcb"], + ["BTC", "BEP20", "0x8894e0a0c962cb723c1976a4421c95949be2d4e3"], + ["BTC", "BEP20", "0xe2fc31f816a9b94326492132018c3aecc4a93ae1"], + ["BTC", "BEP20", "0xf977814e90da44bfa03b6295a0616a897441acec"], ["BTC", "BTC", "1Pzaqw98PeRfyHypfqyEgg5yycJRsENrE7"], ["BTC", "BTC", "34GUzCVLbdkMQ2UdVTaA4nxPwoovVS7y2J"], ["BTC", "BTC", "34HpHYiyQwg69gFmCq2BGHjF1DZnZnBeBP"], From 9f75d5be748e23892aedd10724c79da8b7c9390c Mon Sep 17 00:00:00 2001 From: Define101 Date: Thu, 9 Nov 2023 11:28:44 +0000 Subject: [PATCH 1889/1974] sofi projects --- projects/hot-takes/index.js | 14 ++++++++++++++ projects/sanko-gamecorp/index.js | 14 ++++++++++++++ projects/tagdottech/index.js | 14 ++++++++++++++ 3 files changed, 42 insertions(+) create mode 100644 projects/hot-takes/index.js create mode 100644 projects/sanko-gamecorp/index.js create mode 100644 projects/tagdottech/index.js diff --git a/projects/hot-takes/index.js b/projects/hot-takes/index.js new file mode 100644 index 00000000000..e98411a6156 --- /dev/null +++ b/projects/hot-takes/index.js @@ -0,0 +1,14 @@ +const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') + +const contract = "0xfedA2BAE8F800E990fF3f0848eBd7Eb24b4f6408" + +async function tvl(time, ethBlock, _b, {api}) { + return sumTokens2({ tokens: [nullAddress], owner: contract, api }) +} + +module.exports = { + methodology: `We count the AVAX on ${contract}`, + avax: { + tvl + } +} \ No newline at end of file diff --git a/projects/sanko-gamecorp/index.js b/projects/sanko-gamecorp/index.js new file mode 100644 index 00000000000..63021d6c585 --- /dev/null +++ b/projects/sanko-gamecorp/index.js @@ -0,0 +1,14 @@ +const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') + +const contract = "0x06f1afa00990A69cA03F82D4c1A3a64A45F45fCb" + +async function tvl(time, ethBlock, _b, {api}) { + return sumTokens2({ tokens: [nullAddress], owner: contract, api }) +} + +module.exports = { + methodology: `We count the ETH on ${contract}`, + arbitrum: { + tvl + } +} \ No newline at end of file diff --git a/projects/tagdottech/index.js b/projects/tagdottech/index.js new file mode 100644 index 00000000000..1293bf770aa --- /dev/null +++ b/projects/tagdottech/index.js @@ -0,0 +1,14 @@ +const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') + +const contract = "0x597774837debe9f074453c04cea46b532759b28a" + +async function tvl(time, ethBlock, _b, {api}) { + return sumTokens2({ tokens: [nullAddress], owner: contract, api }) +} + +module.exports = { + methodology: `We count the ETH on ${contract}`, + base: { + tvl + } +} \ No newline at end of file From e0fad33b883e0c147eec0fbe550b743d2b435563 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 9 Nov 2023 13:25:08 +0100 Subject: [PATCH 1890/1974] sushiswap: add more chains --- projects/sushiswap-v3/index.js | 42 ++++++++++++++++++++++++++-------- projects/sushiswap/api.js | 24 ++++++++++++++++--- 2 files changed, 54 insertions(+), 12 deletions(-) diff --git a/projects/sushiswap-v3/index.js b/projects/sushiswap-v3/index.js index e2d1c1a371d..c53922404fb 100644 --- a/projects/sushiswap-v3/index.js +++ b/projects/sushiswap-v3/index.js @@ -1,4 +1,6 @@ const { uniV3Export } = require("../helper/uniswapV3"); +const { cachedGraphQuery } = require('../helper/cache') +const factory = "0xc35dadb65012ec5796536bd9864ed8773abc74c4" module.exports = uniV3Export({ ethereum: { @@ -54,20 +56,42 @@ module.exports = uniV3Export({ factory: "0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506", fromBlock: 80860, }, - thundercore: { - factory: "0xc35dadb65012ec5796536bd9864ed8773abc74c4", - fromBlock: 132536332, - }, + thundercore: { factory, fromBlock: 132536332, }, base: { - factory: "0xc35DADB65012eC5796536bD9864eD8773aBc74C4", + factory, fromBlock: 1759510, blacklistedTokens: [ '0xcfca86136af5611e4bd8f82d83c7800ca65d875b', '0x0b0fd8317735dd9fe611fbc7e1d138149f8ebcea', ] }, - core: { - factory: "0xc35DADB65012eC5796536bD9864eD8773aBc74C4", - fromBlock: 5211850, - }, + core: { factory, fromBlock: 5211850, }, + linea: { factory, fromBlock: 53256, }, + scroll: { factory: '0x46B3fDF7b5CDe91Ac049936bF0bDb12c5d22202e', fromBlock: 82522, }, + kava: { factory: '0x1e9B24073183d5c6B7aE5FB4b8f0b1dd83FDC77a', fromBlock: 7251753, }, + metis: { factory: '0x145d82bCa93cCa2AE057D1c6f26245d1b9522E6F', fromBlock: 9077930, }, + bittorrent: { factory: '0xBBDe1d67297329148Fe1ED5e6B00114842728e65', fromBlock: 29265724, }, }); + +const config = { + filecoin: { endpoint: 'https://sushi.laconic.com/subgraphs/name/sushiswap/v3-filecoin' }, +} + +const query = `{ + pools { + id + token0 { id } + token1 { id } + } +}` + +Object.keys(config).forEach(chain => { + const { endpoint } = config[chain] + module.exports[chain] = { + tvl: async (_, _b, _cb, { api, }) => { + const { pools } = await cachedGraphQuery('sushiswap-v3/' + chain, endpoint, query, { api, }) + const ownerTokens = pools.map(i => [[i.token0.id, i.token1.id], i.id]) + return api.sumTokens({ ownerTokens }) + } + } +}) diff --git a/projects/sushiswap/api.js b/projects/sushiswap/api.js index 14fc5cf0be0..a78a68adf1a 100644 --- a/projects/sushiswap/api.js +++ b/projects/sushiswap/api.js @@ -52,6 +52,8 @@ const tvl = getUniTVL({ }) module.exports = { + ethereum: { tvl: eth, }, + polygon: { tvl, }, telos: { tvl, }, palm: { tvl, }, moonriver: { tvl, }, @@ -59,9 +61,7 @@ module.exports = { okexchain: { tvl, }, arbitrum: { tvl, }, xdai: { tvl, }, - //harmony: { tvl, }, - ethereum: { tvl: eth, }, - polygon: { tvl, }, + harmony: { tvl: getUniTVL({ factory, useDefaultCoreAssets: true, queryBatched: 200}), }, fantom: { tvl, }, bsc: { tvl, }, heco: { tvl, }, @@ -75,6 +75,24 @@ module.exports = { arbitrum_nova: { tvl, }, //moved kava to trident adapter //kava: { // tvl: kavaTridentTvl, //}, + base: { + tvl: getUniTVL({ factory: '0x71524B4f93c58fcbF659783284E38825f0622859', useDefaultCoreAssets: true, }), + }, + scroll: { + tvl: getUniTVL({ factory: '0xB45e53277a7e0F1D35f2a77160e91e25507f1763', useDefaultCoreAssets: true, }), + }, + kava: { + tvl: getUniTVL({ factory: '0xD408a20f1213286fB3158a2bfBf5bFfAca8bF269', useDefaultCoreAssets: true, }), + }, + metis: { + tvl: getUniTVL({ factory: '0x580ED43F3BBa06555785C81c2957efCCa71f7483', useDefaultCoreAssets: true, }), + }, + bittorrent: { + tvl: getUniTVL({ factory: '0xB45e53277a7e0F1D35f2a77160e91e25507f1763', useDefaultCoreAssets: true, }), + }, + filecoin: { + tvl: getUniTVL({ factory: '0x9B3336186a38E1b6c21955d112dbb0343Ee061eE', useDefaultCoreAssets: true, }), + }, } module.exports.polygon.tvl = getChainTVL('polygon') From ee53ce8a9787c791be1a4c1cf29f57dec7df0bd0 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 9 Nov 2023 13:44:29 +0100 Subject: [PATCH 1891/1974] perp88: autofetch tokens --- projects/perp88/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/perp88/index.js b/projects/perp88/index.js index 9eacb8aabd3..3302b84737d 100644 --- a/projects/perp88/index.js +++ b/projects/perp88/index.js @@ -28,7 +28,8 @@ module.exports = { ADDRESSES.arbitrum.WBTC, ADDRESSES.arbitrum.USDT, ADDRESSES.arbitrum.fsGLP, - ] + ], + fetchCoValentTokens: true, }) } } From 086d13cfe9da0a1e1d2369cfdd9e2d34249c87b1 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 9 Nov 2023 13:45:26 +0100 Subject: [PATCH 1892/1974] perp88: minor fix --- projects/perp88/index.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/projects/perp88/index.js b/projects/perp88/index.js index 3302b84737d..471da9e7689 100644 --- a/projects/perp88/index.js +++ b/projects/perp88/index.js @@ -23,11 +23,8 @@ module.exports = { tvl: sumTokensExport({ owner: '0x56CC5A9c0788e674f17F7555dC8D3e2F1C0313C0', tokens: [ - ADDRESSES.arbitrum.USDC, - ADDRESSES.arbitrum.WETH, - ADDRESSES.arbitrum.WBTC, - ADDRESSES.arbitrum.USDT, - ADDRESSES.arbitrum.fsGLP, + "0x70d95587d40A2caf56bd97485aB3Eec10Bee6336", + "0x47c031236e19d024b42f8AE6780E44A573170703", ], fetchCoValentTokens: true, }) From 331d57f2b2131d27f7121a1d801f2334edaf3c32 Mon Sep 17 00:00:00 2001 From: Define101 Date: Thu, 9 Nov 2023 13:14:03 +0000 Subject: [PATCH 1893/1974] add --- projects/draw-tech/index.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 projects/draw-tech/index.js diff --git a/projects/draw-tech/index.js b/projects/draw-tech/index.js new file mode 100644 index 00000000000..72c9f602dda --- /dev/null +++ b/projects/draw-tech/index.js @@ -0,0 +1,14 @@ +const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') + +const contract = "0xE233198863b75Acc6e1AF43DAfF3f5918e35875E" + +async function tvl(time, ethBlock, _b, {api}) { + return sumTokens2({ tokens: [nullAddress], owner: contract, api }) +} + +module.exports = { + methodology: `We count the ETH on ${contract}`, + base: { + tvl + } +} \ No newline at end of file From 8fbe9240bc3ff009388c857022998daeffa738f2 Mon Sep 17 00:00:00 2001 From: Josh Guha <62802949+joshguha@users.noreply.github.com> Date: Thu, 9 Nov 2023 13:25:07 +0000 Subject: [PATCH 1894/1974] Add Polygon ZK evm pools TVL (#8011) * Update Gyroscope adapter * Remove formatting changes * Add polygon zk evm pool factory * Revert formatting changes * Update polygon zk evm chain name --- projects/gyroscope/index.js | 79 ++++++++++++++++++++----------------- 1 file changed, 43 insertions(+), 36 deletions(-) diff --git a/projects/gyroscope/index.js b/projects/gyroscope/index.js index ea88d45ec87..90f1bcd6b9b 100644 --- a/projects/gyroscope/index.js +++ b/projects/gyroscope/index.js @@ -1,89 +1,96 @@ -const { getLogs } = require('../helper/cache/getLogs') -module.exports.doublecounted = true +const { getLogs } = require("../helper/cache/getLogs"); +module.exports.doublecounted = true; async function tvl(_, _b, _cb, { api }) { - const pools = config[api.chain] + const pools = config[api.chain]; const promises = pools.map(async ({ factory, fromBlock }) => { const logs = await getLogs({ api, target: factory, - eventAbi: 'event PoolCreated (address indexed pool)', + eventAbi: "event PoolCreated (address indexed pool)", onlyArgs: true, fromBlock, - }) + }); - const pools = logs.map((i) => i.pool) + const pools = logs.map((i) => i.pool); const poolIds = await api.multiCall({ - abi: 'function getPoolId() view returns (bytes32)', + abi: "function getPoolId() view returns (bytes32)", calls: pools, - }) + }); const vaults = await api.multiCall({ - abi: 'address:getVault', + abi: "address:getVault", calls: pools, - }) + }); const data = await api.multiCall({ - abi: 'function getPoolTokens(bytes32 poolId) view returns (address[] tokens, uint256[] balances, uint256 lastChangeBlock)', + abi: "function getPoolTokens(bytes32 poolId) view returns (address[] tokens, uint256[] balances, uint256 lastChangeBlock)", calls: poolIds.map((v, i) => ({ target: vaults[i], params: v })), - }) + }); - data.forEach((i) => api.addTokens(i.tokens, i.balances)) - }) - await Promise.all(promises) - return api.getBalances() + data.forEach((i) => api.addTokens(i.tokens, i.balances)); + }); + await Promise.all(promises); + return api.getBalances(); } module.exports = { - methodology: 'sum of all the tokens locked in CLPs', -} + methodology: "sum of all the tokens locked in CLPs", +}; const config = { polygon: [ { - name: 'Gyro 2-CLP Factory', - factory: '0x5d8545a7330245150bE0Ce88F8afB0EDc41dFc34', + name: "Gyro 2-CLP Factory", + factory: "0x5d8545a7330245150bE0Ce88F8afB0EDc41dFc34", fromBlock: 31556084, }, { - name: 'Gyro 3-CLP Factory', - factory: '0x90f08B3705208E41DbEEB37A42Fb628dD483AdDa', + name: "Gyro 3-CLP Factory", + factory: "0x90f08B3705208E41DbEEB37A42Fb628dD483AdDa", fromBlock: 31556094, }, { - name: 'Gyro E-CLP Factory', - factory: '0xD4204551BC5397455f8897745d50Ac4F6beE0EF6', + name: "Gyro E-CLP Factory", + factory: "0xD4204551BC5397455f8897745d50Ac4F6beE0EF6", fromBlock: 35414865, }, { - name: 'Gyro E-CLP V2 Factory', - factory: '0x1a79A24Db0F73e9087205287761fC9C5C305926b', + name: "Gyro E-CLP V2 Factory", + factory: "0x1a79A24Db0F73e9087205287761fC9C5C305926b", fromBlock: 41209677, }, ], optimism: [ { - name: 'Gyro E-CLP V2 Factory', - factory: '0x9b683ca24b0e013512e2566b68704dbe9677413c', + name: "Gyro E-CLP V2 Factory", + factory: "0x9b683ca24b0e013512e2566b68704dbe9677413c", fromBlock: 97253023, }, ], ethereum: [ { - name: 'Gyro E-CLP V2 Factory', - factory: '0x412a5B2e7a678471985542757A6855847D4931D5', + name: "Gyro E-CLP V2 Factory", + factory: "0x412a5B2e7a678471985542757A6855847D4931D5", fromBlock: 17672894, }, ], arbitrum: [ { - name: 'Gyro E-CLP V2 Factory', - factory: '0xdca5f1f0d7994a32bc511e7dba0259946653eaf6', + name: "Gyro E-CLP V2 Factory", + factory: "0xdca5f1f0d7994a32bc511e7dba0259946653eaf6", fromBlock: 124858976, }, - ] -} + ], + polygon_zkevm: [ + { + name: "Gyro E-CLP V2 Factory", + factory: "0x5D56EA1B2595d2dbe4f5014b967c78ce75324f0c", + fromBlock: 5147666, + }, + ], +}; Object.keys(config).forEach((chain) => { - module.exports[chain] = { tvl } -}) + module.exports[chain] = { tvl }; +}); From ccffc80cff5de6ee9060c81427e43dd7d1e9f522 Mon Sep 17 00:00:00 2001 From: Define101 Date: Thu, 9 Nov 2023 13:35:30 +0000 Subject: [PATCH 1895/1974] two new btc wallets binance --- projects/binance/config.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/projects/binance/config.js b/projects/binance/config.js index f10f738a1b3..83ffa6421c3 100644 --- a/projects/binance/config.js +++ b/projects/binance/config.js @@ -60,7 +60,9 @@ const assetList = [ ["BTC", "BTC", "34xp4vRoCGJym3xR7yCVPFHoCNxv4Twseo"], ["BTC", "BTC", "36zSLdRv1jyewjaC12fqK5fptn7PqewunL"], ["BTC", "BTC", "38DN2uFMZPiHLHJigfv4kWC9JWJrNnhLcn"], + ["BTC", "BTC", "3F9CGMu7JSJnMHA8jFM2KgxuH6hhxtvENP"], ["BTC", "BTC", "3LQUu4v9z6KNch71j7kbj8GPeAGUo1FW6a"], + ["BTC", "BTC", "3EVVc8e2rxwUuERtdJCduWig8DnpsUqyA6"], ["BTC", "BTC", "38Xnrq8MZiKmYmwobbYdZQ5nnCbX1qvQfE"], ["BTC", "BTC", "395vnFScKQ1ay695C6v7gf89UzoFpx3WuJ"], ["BTC", "BTC", "39884E3j6KZj82FK4vcCrkUvWYL5MQaS3v"], From 2ff8d9c6cf16aef34cdb98a090b4f15068f03f1b Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 9 Nov 2023 14:44:53 +0100 Subject: [PATCH 1896/1974] Hopr (#8013) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * hopr * HOPR TVL * code refactor --------- Co-authored-by: Michał Jadach Co-authored-by: mjadach-iv <104129084+mjadach-iv@users.noreply.github.com> --- projects/helper/tokenMapping.js | 3 +++ projects/hopr/README.md | 3 +++ projects/hopr/index.js | 28 ++++++++++++++++++++++++++++ 3 files changed, 34 insertions(+) create mode 100644 projects/hopr/README.md create mode 100644 projects/hopr/index.js diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index a955e67aa5e..6dcd9aa1f26 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -76,6 +76,9 @@ const fixBalancesTokens = { arbitrum: { '0x4e7e5023656863E26f50E2E6E59489A852C212c1': { coingeckoId: 'changer', decimals: 18 }, }, + xdai: { + '0xD4fdec44DB9D44B8f2b6d529620f9C0C7066A2c1': { coingeckoId: 'xdai:0xD057604A14982FE8D88c5fC25Aac3267eA142a08', decimals: 0 }, + }, bfc: { [ADDRESSES.bfc.WBFC]: { coingeckoId: 'bifrost', decimals: 18}, [ADDRESSES.bfc.BIFI]: { coingeckoId: 'bifi', decimals: 18}, diff --git a/projects/hopr/README.md b/projects/hopr/README.md new file mode 100644 index 00000000000..e249f607f81 --- /dev/null +++ b/projects/hopr/README.md @@ -0,0 +1,3 @@ +### HOPR Adapter + +HOPR TVL consists total amount of wxHOPR (wrapped xHOPR) that all users have in their HOPR Safes staked to receive a share of the revenue, and also the total amount of wxHOPR locked in the channels contract. \ No newline at end of file diff --git a/projects/hopr/index.js b/projects/hopr/index.js new file mode 100644 index 00000000000..bb598596992 --- /dev/null +++ b/projects/hopr/index.js @@ -0,0 +1,28 @@ +const { getLogs } = require('../helper/cache/getLogs') +const { sumTokens2 } = require('../helper/unwrapLPs') + +const wxHOPR_TOKEN_SMART_CONTRACT_ADDRESS = '0xD4fdec44DB9D44B8f2b6d529620f9C0C7066A2c1'; +const SAFE_FACTORY = '0x098B275485c406573D042848D66eb9d63fca311C'; +const HOPR_CHANNELS = '0x693Bac5ce61c720dDC68533991Ceb41199D8F8ae'; + +async function tvl(timestamp, ethBlock, chainBlocks, { api }) { + const logs = await getLogs({ + api, + target: SAFE_FACTORY, + fromBlock: 29706820, + eventAbi: 'event NewHoprNodeStakeSafe(address instance)' + }); + + const safes = logs.map(log => log.args[0]); + + const owners = [...safes, HOPR_CHANNELS] + return sumTokens2({ api, tokens: [wxHOPR_TOKEN_SMART_CONTRACT_ADDRESS], owners, }) +} + +module.exports = { + xdai: { + tvl: () => ({}), + staking: tvl, + }, + methodology: 'HOPR TVL consists total amount of wxHOPR (wrapped xHOPR) that all users have in their HOPR Safes staked to receive a share of the revenue, and also the total amount of wxHOPR locked in the channels contract.', +}; \ No newline at end of file From a64fdca9e8da21e611184f158bcac1302abb7e6a Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 9 Nov 2023 14:46:43 +0100 Subject: [PATCH 1897/1974] minor fix --- projects/hopr/README.md | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 projects/hopr/README.md diff --git a/projects/hopr/README.md b/projects/hopr/README.md deleted file mode 100644 index e249f607f81..00000000000 --- a/projects/hopr/README.md +++ /dev/null @@ -1,3 +0,0 @@ -### HOPR Adapter - -HOPR TVL consists total amount of wxHOPR (wrapped xHOPR) that all users have in their HOPR Safes staked to receive a share of the revenue, and also the total amount of wxHOPR locked in the channels contract. \ No newline at end of file From 7be35dbfffee49b9a5d4a0600ffb4555d0b0a614 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 9 Nov 2023 15:14:27 +0100 Subject: [PATCH 1898/1974] Bella-2 (#8014) * feat: Add Bella-LP-Farm tvl * minor fix --------- Co-authored-by: shjie047 --- projects/bella.js | 45 +++++++++++++ projects/config/bella/abis/izi.js | 6 ++ projects/config/bella/izi.js | 101 ++++++++++++++++++++++++++++++ projects/config/bella/util.js | 82 ++++++++++++++++++++++++ 4 files changed, 234 insertions(+) create mode 100644 projects/config/bella/abis/izi.js create mode 100644 projects/config/bella/izi.js create mode 100644 projects/config/bella/util.js diff --git a/projects/bella.js b/projects/bella.js index fb5e74d9e52..3066c3ee171 100644 --- a/projects/bella.js +++ b/projects/bella.js @@ -2,6 +2,9 @@ const sdk = require('@defillama/sdk') const { sumTokens } = require('./helper/unwrapLPs') const bVaultAbi = require('./config/bella/abis/bVault') +const ADDRESSES = require('./helper/coreAssets.json'); +const { getPoolLiquidityAmount } = require('./config/bella/izi'); +const iziABI = require('./config/bella/abis/izi'); const bVaults = { bUsdt: { address: '0x2c23276107b45E64c8c59482f4a24f4f2E568ea6', }, @@ -47,6 +50,48 @@ module.exports = { tvl, pool2, }, + mantle: { + pool2: async (_, _1, _2, { api }) => { + const swapPool = '0xC865dd3421a6DD706688955fe727C802A98c1df9'; + const miningPool = '0xBF2b951Ae6af066A03Dbfa52b1329704D923980c'; + + const { rewardUpperTick_, rewardLowerTick_, totalVLiquidity_ } = + await api.call({ + abi: iziABI.mantleMiningABI, + target: miningPool, + chain: 'mantle', + }); + + const totalNizi = await api.call({ + abi: iziABI.mantleTotalNiZiABI, + target: miningPool, + chain: 'mantle', + }); + + const { liquidity, liquidityX, currentPoint } = await api.call({ + abi: iziABI.mantlePoolABI, + target: swapPool, + chain: 'mantle', + }); + + const { amountX, amountY } = getPoolLiquidityAmount( + { + rewardUpperTick_, + rewardLowerTick_, + totalVLiquidity_, + }, + currentPoint, + liquidity, + liquidityX + ); + + return { + [`ethereum:${ADDRESSES.ethereum.USDC}`]: amountX, + [`ethereum:${ADDRESSES.ethereum.USDT}`]: amountY, + [`bsc:${ADDRESSES.bsc.iZi}`]: totalNizi, + }; + }, + }, era: { pool2: async (_, _1, _2, { api }) => { const pool2s = [ diff --git a/projects/config/bella/abis/izi.js b/projects/config/bella/abis/izi.js new file mode 100644 index 00000000000..ff8a058c981 --- /dev/null +++ b/projects/config/bella/abis/izi.js @@ -0,0 +1,6 @@ + +module.exports = { + mantlePoolABI: "function state() view returns (uint160 sqrtPrice_96, int24 currentPoint, uint16 observationCurrentIndex, uint16 observationQueueLen, uint16 observationNextQueueLen, bool locked, uint128 liquidity, uint128 liquidityX)", + mantleMiningABI: "function getMiningContractInfo() view returns (address tokenX_, address tokenY_, uint24 fee_, tuple(address rewardToken, address provider, uint256 accRewardPerShare, uint256 rewardPerSecond)[] rewardInfos_, address iziTokenAddr_, int24 rewardUpperTick_, int24 rewardLowerTick_, uint256 lastTouchTime_, uint256 totalVLiquidity_, uint256 startTime_, uint256 endTime_)", + mantleTotalNiZiABI: "uint256:totalNIZI", +}; diff --git a/projects/config/bella/izi.js b/projects/config/bella/izi.js new file mode 100644 index 00000000000..12977c36a6d --- /dev/null +++ b/projects/config/bella/izi.js @@ -0,0 +1,101 @@ +const { BigNumber } = require("bignumber.js"); + +const { + _getAmountX, + _getAmountY, + _liquidity2AmountXAtPoint, + _liquidity2AmountYAtPoint, + point2PoolPriceUndecimalSqrt, +} = require("./util"); + +const getLiquidityValue = ( + liquidity, + leftPoint, + rightPoint, + currentPoint, + currentLiqudity, + currentLiqudityX +) => { + let amountX = new BigNumber(0); + let amountY = new BigNumber(0); + const liquid = liquidity; + const sqrtRate = Math.sqrt(1.0001); + const leftPtNum = Number(leftPoint); + const rightPtNum = Number(rightPoint); + // compute amountY without currentPt + if (leftPtNum < currentPoint) { + const rightPt = Math.min(currentPoint, rightPtNum); + const sqrtPriceR = point2PoolPriceUndecimalSqrt(rightPt); + const sqrtPriceL = point2PoolPriceUndecimalSqrt(leftPtNum); + amountY = _getAmountY( + new BigNumber(liquid), + sqrtPriceL, + sqrtPriceR, + sqrtRate, + false + ); + } + + // compute amountX without currentPt + if (rightPtNum > currentPoint + 1) { + const leftPt = Math.max(currentPoint + 1, leftPtNum); + const sqrtPriceR = point2PoolPriceUndecimalSqrt(rightPtNum); + amountX = _getAmountX( + new BigNumber(liquid), + leftPt, + rightPtNum, + sqrtPriceR, + sqrtRate, + false + ); + } + + // compute amountX and amountY on currentPt + if (leftPtNum <= currentPoint && rightPtNum > currentPoint) { + const liquidityValue = new BigNumber(liquidity); + const maxLiquidityYAtCurrentPt = new BigNumber(currentLiqudity).minus( + currentLiqudityX + ); + const liquidityYAtCurrentPt = liquidityValue.gt(maxLiquidityYAtCurrentPt) + ? maxLiquidityYAtCurrentPt + : liquidityValue; + const liquidityXAtCurrentPt = liquidityValue.minus(liquidityYAtCurrentPt); + const currentSqrtPrice = point2PoolPriceUndecimalSqrt(currentPoint); + amountX = amountX.plus( + _liquidity2AmountXAtPoint(liquidityXAtCurrentPt, currentSqrtPrice, false) + ); + amountY = amountY.plus( + _liquidity2AmountYAtPoint(liquidityYAtCurrentPt, currentSqrtPrice, false) + ); + } + return { + amountX: amountX.toFixed(0), + amountY: amountY.toFixed(0), + }; +}; + +const getPoolLiquidityAmount = ( + miningInfo, + currentPoint, + currentLiquidity, + currentLiquidityX +) => { + const rangeLen = + Number(miningInfo.rewardUpperTick_) - Number(miningInfo.rewardLowerTick_); + + const liquidity = new BigNumber(miningInfo.totalVLiquidity_) + .div(rangeLen) + .div(rangeLen) + .times(1e6); + + return getLiquidityValue( + liquidity.toFixed(0), + Number(miningInfo.rewardLowerTick_), + Number(miningInfo.rewardUpperTick_), + Number(currentPoint), + currentLiquidity, + currentLiquidityX + ); +}; + +module.exports.getPoolLiquidityAmount = getPoolLiquidityAmount; diff --git a/projects/config/bella/util.js b/projects/config/bella/util.js new file mode 100644 index 00000000000..91f4f3c758e --- /dev/null +++ b/projects/config/bella/util.js @@ -0,0 +1,82 @@ +const { BigNumber } = require("bignumber.js"); + +const BIG_TEN = new BigNumber(10); + +const point2PoolPriceUndecimalSqrt = (point) => { + return (1.0001 ** point) ** 0.5; +}; + +const _getAmountX = ( + liquidity, + leftPt, + rightPt, + sqrtPriceR, + sqrtRate, + upper +) => { + const sqrtPricePrPc = Math.pow(sqrtRate, rightPt - leftPt + 1); + const sqrtPricePrPd = Math.pow(sqrtRate, rightPt + 1); + + const numerator = sqrtPricePrPc - sqrtRate; + const denominator = sqrtPricePrPd - sqrtPriceR; + + if (!upper) { + const amount = new BigNumber( + liquidity.times(numerator).div(denominator).toFixed(0, 3) + ); + return amount; + } else { + const amount = new BigNumber( + liquidity.times(numerator).div(denominator).toFixed(0, 2) + ); + return amount; + } +}; + +const _getAmountY = (liquidity, sqrtPriceL, sqrtPriceR, sqrtRate, upper) => { + const numerator = sqrtPriceR - sqrtPriceL; + const denominator = sqrtRate - 1; + if (!upper) { + const amount = new BigNumber( + liquidity.times(numerator).div(denominator).toFixed(0, 3) + ); + return amount; + } else { + const amount = new BigNumber( + liquidity.times(numerator).div(denominator).toFixed(0, 2) + ); + return amount; + } +}; + +const _liquidity2AmountXAtPoint = (liquidity, sqrtPrice, upper) => { + const amountX = liquidity.div(sqrtPrice); + if (!upper) { + return new BigNumber(amountX.toFixed(0, 3)); + } else { + return new BigNumber(amountX.toFixed(0, 2)); + } +}; + +const _liquidity2AmountYAtPoint = (liquidity, sqrtPrice, upper) => { + const amountY = liquidity.times(sqrtPrice); + if (!upper) { + return new BigNumber(amountY.toFixed(0, 3)); + } else { + return new BigNumber(amountY.toFixed(0, 2)); + } +}; + +const amount2Decimal = (amount, tokenDecimal) => { + return new BigNumber(amount).dividedBy(BIG_TEN.pow(tokenDecimal)).toNumber(); +}; + +module.exports = { + BIG_TEN, + amount2Decimal, + _liquidity2AmountXAtPoint, + _liquidity2AmountYAtPoint, + _getAmountY, + _getAmountX, + point2PoolPriceUndecimalSqrt, +}; From eba08d2d32d9f85e06e12135aaeaba6816b067e2 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 9 Nov 2023 15:49:02 +0100 Subject: [PATCH 1899/1974] fix inverse treasury --- projects/treasury/inverse.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/treasury/inverse.js b/projects/treasury/inverse.js index 7c00b230190..b9f50b99eb4 100644 --- a/projects/treasury/inverse.js +++ b/projects/treasury/inverse.js @@ -46,6 +46,9 @@ module.exports = treasuryExports({ ], resolveUniV3: true, resolveLP: true, + blacklistedTokens: [ + '0x21e83dbfd8f11d885eba9f9ba126da11ae0671b7' + ] }, optimism: { tokens: [ From 3b26c8cd504b8013d6fceb4e686321bdbc023d70 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 9 Nov 2023 16:43:21 +0100 Subject: [PATCH 1900/1974] trach xfamtech tvl --- projects/helper/sumTokens.js | 1 + projects/xfamtech/index.js | 11 +++++++++++ 2 files changed, 12 insertions(+) create mode 100644 projects/xfamtech/index.js diff --git a/projects/helper/sumTokens.js b/projects/helper/sumTokens.js index 79e40ad52c8..ff3a9011663 100644 --- a/projects/helper/sumTokens.js +++ b/projects/helper/sumTokens.js @@ -20,6 +20,7 @@ const helpers = { "polkadot":require("./chain/polkadot"), "hedera":require("./chain/hbar"), "stacks":require("./chain/stacks"), + "starknet":require("./chain/starknet"), } const geckoMapping = { diff --git a/projects/xfamtech/index.js b/projects/xfamtech/index.js new file mode 100644 index 00000000000..6fc25a52bd8 --- /dev/null +++ b/projects/xfamtech/index.js @@ -0,0 +1,11 @@ + +const { sumTokensExport } = require('../helper/sumTokens') +const factory = '0x1c0a36e26a8f822e0d81f20a5a562b16a8f8a3dfd99801367dd2aea8f1a87a2' +const ADDRESSES = require('../helper/coreAssets.json') + +module.exports = { + timetravel: false, + starknet: { + tvl: sumTokensExport({ owner: '0x0568c49d2ac0f614b69f675250df807c7baa62ef2ab77c4dd101be194f79c314', tokens: [ADDRESSES.starknet.ETH]}), + } +} \ No newline at end of file From 7bf3bb31f6eb62216c68c5a2b0d17e0eea3cafed Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 9 Nov 2023 17:42:48 +0100 Subject: [PATCH 1901/1974] track https://www.mu.exchange/ --- projects/concentrator/index.js | 2 +- projects/elysiumBridge/index.js | 13 +++++++------ projects/hashnote/index.js | 3 ++- projects/helper/coreAssets.json | 1 + projects/helper/tokenMapping.js | 2 +- projects/idle/index.js | 9 +++++---- projects/kai/index.js | 3 ++- projects/merkle-trade/index.js | 3 ++- projects/mu-exchange/index.js | 8 ++++++++ projects/ponytaswap/index.js | 3 ++- projects/sdai/index.js | 2 +- projects/sui-pearl/index.js | 3 ++- projects/vivaleva/index.js | 13 +++++++------ 13 files changed, 41 insertions(+), 24 deletions(-) create mode 100644 projects/mu-exchange/index.js diff --git a/projects/concentrator/index.js b/projects/concentrator/index.js index afd4b5a321a..dc7ef51a1c9 100644 --- a/projects/concentrator/index.js +++ b/projects/concentrator/index.js @@ -29,7 +29,7 @@ const aladdinBalancerLPGauge = '0x33e411ebE366D72d058F3eF22F1D0Cf8077fDaB0'; const clevCVXAddress = "0xf05e58fCeA29ab4dA01A495140B349F8410Ba904" const clevCVXCVXAddress = "0xF9078Fb962A7D13F55d40d49C8AA6472aBD1A5a6" const sdCRVAddress = '0xD1b5651E55D4CeeD36251c61c50C889B36F6abB5' -const cvxAddress = "0x4e3FBD56CD56c3e72c1403e103b45Db9da5B9D2B"; +const cvxAddress = ADDRESSES.ethereum.CVX; const chain = 'ethereum'; async function getBalancerLpTvl(balances, block) { diff --git a/projects/elysiumBridge/index.js b/projects/elysiumBridge/index.js index 34a123df9d9..242aef22e11 100644 --- a/projects/elysiumBridge/index.js +++ b/projects/elysiumBridge/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens2 } = require('../helper/unwrapLPs') const config = { @@ -9,9 +10,9 @@ const config = { tokens: { PYR: '0x430ef9263e76dae63c84292c3409d61c598e9682', CCO2: '0x82B37070e43C1BA0EA9e2283285b674eF7f1D4E2', - WMATIC: '0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270', - WETH: '0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619', - USDT: '0xc2132D05D31c914a87C6611C10748AEb04B58e8F', + WMATIC: ADDRESSES.polygon.WMATIC_2, + WETH: ADDRESSES.polygon.WETH_1, + USDT: ADDRESSES.polygon.USDT, MV: '0xA3c322Ad15218fBFAEd26bA7f616249f7705D945', } }, @@ -22,9 +23,9 @@ const config = { tokens: { PYR: '0x430ef9263e76dae63c84292c3409d61c598e9682', // CCO2: '0x82B37070e43C1BA0EA9e2283285b674eF7f1D4E2', - // WMATIC: '0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270', - // WETH: '0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619', - // USDT: '0xc2132D05D31c914a87C6611C10748AEb04B58e8F', + // WMATIC: ADDRESSES.polygon.WMATIC_2, + // WETH: ADDRESSES.polygon.WETH_1, + // USDT: ADDRESSES.polygon.USDT, // MV: '0xA3c322Ad15218fBFAEd26bA7f616249f7705D945', } }, diff --git a/projects/hashnote/index.js b/projects/hashnote/index.js index 8dc78be9aec..b33a42faee2 100644 --- a/projects/hashnote/index.js +++ b/projects/hashnote/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const contracts = { @@ -16,7 +17,7 @@ const tvl = async (_, _1, _2, { api }) => { const rate = await api.call({ target: contracts[api.chain].oracle, abi: 'function latestRoundData() external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound)'}); return { - "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48": (totalSupply * rate.answer)/1e8 + [ADDRESSES.ethereum.USDC]: (totalSupply * rate.answer)/1e8 }; } diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index a2d788dc063..01aa0d49140 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -149,6 +149,7 @@ "MATIC": "0x7122d7661c4564b7c6cd4878b06766489a6028a2", "WBTC": "0x8e5bbbb09ed1ebde8674cda39a0c169401db4252", "ETHIX": "0xec3f3e6d7907acda3a7431abd230196cda3fbb19", + "SDAI": "0xaf204776c7245bF4147c2612BF6e5972Ee483701", "DAI_1": "0x678df3415fc31947da4324ec63212874be5a82f8" }, "okexchain": { diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 6dcd9aa1f26..2bdf327cd7e 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -27,7 +27,7 @@ const distressedAssts = new Set(Object.values({ FLEET: '0xfd56a3dcfc0690881a466ae432d71bb2db588083', YAKU: 'NGK3iHqqQkyRZUj4uhJDQqEyKKcZ7mdawWpqwMffM3s', JEFE: '0x80fa6d5384bdde296a28a321f73ab70977575129', - BONK: 'DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263' + BONK: ADDRESSES.solana.BONK }).map(i => i.toLowerCase())) const transformTokens = { diff --git a/projects/idle/index.js b/projects/idle/index.js index 02cb817707f..20f381d9541 100644 --- a/projects/idle/index.js +++ b/projects/idle/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens2 } = require('../helper/unwrapLPs') const { eulerTokens } = require('../helper/tokenMapping') const { getLogs } = require('../helper/cache/getLogs') @@ -60,10 +61,10 @@ const contracts = { } const underlyingMapping = { - '0x94b008aA00579c1307B0EF2c499aD98a8ce58e58': '0xdac17f958d2ee523a2206206994597c13d831ec7', // USDT Optimism - '0x7F5c764cBc14f9669B88837ca1490cCa17c31607': '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', // USDC Optimism - '0x1E4a5963aBFD975d8c9021ce480b42188849D41d': '0xdac17f958d2ee523a2206206994597c13d831ec7', // USDT zkEVM - '0xA8CE8aee21bC2A48a5EF670afCc9274C7bbbC035': '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48' // USDC zkEVM + [ADDRESSES.optimism.USDT]: ADDRESSES.ethereum.USDT, // USDT Optimism + [ADDRESSES.optimism.USDC]: ADDRESSES.ethereum.USDC, // USDC Optimism + '0x1E4a5963aBFD975d8c9021ce480b42188849D41d': ADDRESSES.ethereum.USDT, // USDT zkEVM + [ADDRESSES.polygon_zkevm.USDC]: ADDRESSES.ethereum.USDC // USDC zkEVM } const trancheConfig = { diff --git a/projects/kai/index.js b/projects/kai/index.js index 636470b3694..6460b1d8739 100644 --- a/projects/kai/index.js +++ b/projects/kai/index.js @@ -1,8 +1,9 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sui = require("../helper/chain/sui"); const WHUSDCE_VAULT_ID = "0x7a2f75a3e50fd5f72dfc2f8c9910da5eaa3a1486e4eb1e54a825c09d82214526"; -const WHUSDCE_TYPE_ARG = '0x5d4b302506645c37ff133b98c4b50a5ae14841659738d6d733d59d0d217a93bf::coin::COIN' +const WHUSDCE_TYPE_ARG = ADDRESSES.sui.USDC async function tvl(_, _1, _2, { api }) { const res = await sui.getObject(WHUSDCE_VAULT_ID) diff --git a/projects/merkle-trade/index.js b/projects/merkle-trade/index.js index 2b6cb045bc4..43e287c9477 100644 --- a/projects/merkle-trade/index.js +++ b/projects/merkle-trade/index.js @@ -1,9 +1,10 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { getResource } = require("../helper/chain/aptos"); const MERKEL_TRADE = "0x5ae6789dd2fec1a9ec9cccfb3acaf12e93d432f0a3a42c92fe1a9d490b7bbc06"; const lzUSDC = - "0xf22bede237a07e121b56d91a491eb7bcdfd1f5907926a9e58338f964a01b17fa::asset::USDC"; + ADDRESSES.aptos.USDC_2; async function tvl(_, _b, _cb, { api }) { const { diff --git a/projects/mu-exchange/index.js b/projects/mu-exchange/index.js new file mode 100644 index 00000000000..2ed3c82bd0c --- /dev/null +++ b/projects/mu-exchange/index.js @@ -0,0 +1,8 @@ +const { sumTokensExport } = require('../helper/unwrapLPs') +const ADDRESSES = require('../helper/coreAssets.json') + +module.exports = { + xdai: { + tvl: sumTokensExport({ owners: ['0x0d80d7f7719407523a09ee2ef7ed573e0ea3487a', '0x1946740274E0DC06649EE2bD0d545eB288C84604'], tokens: [ADDRESSES.xdai.SDAI] }), + } +} diff --git a/projects/ponytaswap/index.js b/projects/ponytaswap/index.js index 2ca6532f5f9..7a6770b4c0a 100644 --- a/projects/ponytaswap/index.js +++ b/projects/ponytaswap/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { getUniTVL } = require('../helper/unknownTokens') const {staking} = require("../helper/staking"); @@ -6,7 +7,7 @@ const pool = [ '0xE32C24CA6AddEb28F28e6361c88Ca41FB24a62Bc', '0x177b396560cDDB3876a32BEDA1887476566C1f1a' ]; -const contractAddr = '0x71d9cfd1b7adb1e8eb4c193ce6ffbe19b4aee0db'; +const contractAddr = ADDRESSES.rpg.WRPG; module.exports = { misrepresentedTokens: true, rpg: { diff --git a/projects/sdai/index.js b/projects/sdai/index.js index 52c0e13b2e0..515dde933ff 100644 --- a/projects/sdai/index.js +++ b/projects/sdai/index.js @@ -3,6 +3,6 @@ const ADDRESSES = require('../helper/coreAssets.json') module.exports = { xdai: { - tvl: sumTokensExport({ owner: '0xaf204776c7245bF4147c2612BF6e5972Ee483701', tokens: [ADDRESSES.xdai.WXDAI] }) + tvl: sumTokensExport({ owner: ADDRESSES.xdai.SDAI, tokens: [ADDRESSES.xdai.WXDAI] }) } } \ No newline at end of file diff --git a/projects/sui-pearl/index.js b/projects/sui-pearl/index.js index dce7df8b6e2..4bc01f2dc26 100644 --- a/projects/sui-pearl/index.js +++ b/projects/sui-pearl/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { default: BigNumber } = require("bignumber.js"); const sui = require("../helper/chain/sui"); @@ -109,7 +110,7 @@ async function suiTVL() { setPropertyPriceMap( totalResult, - "0x2::sui::SUI", + ADDRESSES.sui.SUI, new BigNumber(scallopPool.fields.total_tvl) ); diff --git a/projects/vivaleva/index.js b/projects/vivaleva/index.js index c189b17cbfc..59058254b89 100644 --- a/projects/vivaleva/index.js +++ b/projects/vivaleva/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { getConfig } = require('../helper/cache') const getAllPositionsByIdsABI = "function getAllPositionsByIds(address vaultAddress, uint256[] positionIds) view returns (tuple(address worker, uint256 positionId, uint256 positionDebtAmount, uint256 positionHealth, uint256[] positionIngredients, uint16 positionKillFactorBps)[] positionInfos)" @@ -14,21 +15,21 @@ module.exports = { name: "USDC-WETH PancakeSwapV3 Farm Worker", address: "0x9ac1CD6f35934bAeD9986711b9D983260C8F38C4", lpTokenAddress: "0x291d9F9764c72C9BA6fF47b451a9f7885Ebf9977", - farmingTokenAddress: "0x3355df6D4c9C3035724Fd0e3914dE96A5a83aaf4", - baseTokenAddress: "0x5aea5775959fbc2557cc8789bc1bf90a239d9a91", + farmingTokenAddress: ADDRESSES.era.USDC, + baseTokenAddress: ADDRESSES.era.WETH, }, { name: "ETH-USDC PancakeswapV3 Farm", address: "0x9ca8aD7290079BF5dbE42CCB917474379Aa167e5", - farmingTokenAddress: "0x5aea5775959fbc2557cc8789bc1bf90a239d9a91", - baseTokenAddress: "0x3355df6D4c9C3035724Fd0e3914dE96A5a83aaf4", + farmingTokenAddress: ADDRESSES.era.WETH, + baseTokenAddress: ADDRESSES.era.USDC, lpToken: "0x291d9F9764c72C9BA6fF47b451a9f7885Ebf9977", }, { name: "USDT-USDC PancakeswapV3 Farm", address: "0xDa3518E5F2972e0Edc1401336b94E257c58eeb18", - farmingTokenAddress: "0x493257fd37edb34451f62edf8d2a0c418852ba4c", - baseTokenAddress: "0x3355df6D4c9C3035724Fd0e3914dE96A5a83aaf4", + farmingTokenAddress: ADDRESSES.era.USDT, + baseTokenAddress: ADDRESSES.era.USDC, lpToken: "0x3832fB996C49792e71018f948f5bDdd987778424", } ], From a7848323fdf00acd5e7fe0f5482b5fbdc544094d Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 9 Nov 2023 18:36:23 +0100 Subject: [PATCH 1902/1974] update quasar --- projects/quasar/index.js | 68 +++++++++------------------------------- 1 file changed, 14 insertions(+), 54 deletions(-) diff --git a/projects/quasar/index.js b/projects/quasar/index.js index 7e3e380e90a..c59bed2bbc1 100644 --- a/projects/quasar/index.js +++ b/projects/quasar/index.js @@ -1,61 +1,21 @@ const { queryContract } = require('../helper/chain/cosmos') -const sdk = require('@defillama/sdk') - -const chain = 'quasar' - -const lpStrategyContracts = { - 1: [ - "quasar14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9sy9numu", - "quasar1l468h9metf7m8duvay5t4fk2gp0xl94h94f3e02mfz4353de2ykqh6rcts", - "quasar1cp8cy5kvaury53frlsaml7ru0es2reln66nfj4v7j3kcfxl4datqsw0aw4", - "quasar1kj8q8g2pmhnagmfepp9jh9g2mda7gzd0m5zdq0s08ulvac8ck4dq9ykfps", - ], - 678: [ - "quasar1suhgf5svhu4usrurvxzlgn54ksxmn8gljarjtxqnapv8kjnp4nrsmslfn4", - "quasar1ma0g752dl0yujasnfs9yrk6uew7d0a2zrgvg62cfnlfftu2y0egqx8e7fv", - ], - 803: [ - "quasar1jgn70d6pf7fqtjke0q63luc6tf7kcavdty67gvfpqhwwsx52xmjq7kd34f", - "quasar1t9adyk9g2q0efn3xndunzy4wvdrnegjkpvp382vm2uc7hnvash5qpzmxe4", - ], - 833: [ - "quasar1ery8l6jquynn9a4cz2pff6khg8c68f7urt33l5n9dng2cwzz4c4qxhm6a2", - ], - 904: [ - "quasar1ch4s3kkpsgvykx5vtz2hsca4gz70yks5v55nqcfaj7mgsxjsqypsxqtx2a", - ], - 944: [ - "quasar1xkakethwh43dds3ccmsjals9jt7qsfmedgm9dvm9tpqq8watpv9q0458u6", - "quasar1ch4s3kkpsgvykx5vtz2hsca4gz70yks5v55nqcfaj7mgsxjsqypsxqtx2a", - ], -} +const { getConfig } = require('../helper/cache') async function tvl() { - const api = new sdk.ChainApi({ chain: 'osmosis' }) - - for (const poolID in lpStrategyContracts) { - let lpContracts = lpStrategyContracts[poolID]; - for (const contractAddress of lpContracts) { - let ica_balances = await queryContract({ - contract: contractAddress, - chain: chain, - data: { 'ica_balance': {} } - }); - - let denom = ica_balances.amount.denom; - let amount = Number(ica_balances.amount.amount); - - api.add(denom, amount) - } - } - - return api.getBalances() + const { api } = arguments[3] + const data = await getConfig('quasar-vaults', 'https://api.quasar.fi/vaults') + const vaults = data.filter(i => i.chainId === 'osmosis-1').map(i => i.address) + for (const vault of vaults) { + const total_assets = await queryContract({ chain: 'osmosis', contract: vault, data: { total_assets: {} }, }) + Object.values(total_assets).forEach(({ denom, amount }) => api.add(denom, amount)) + } + return api.getBalances() } module.exports = { - timetravel: false, - methodology: "Total TVL on vaults", - osmosis: { - tvl, - }, + timetravel: false, + methodology: 'Total TVL on vaults', + osmosis: { + tvl, + }, } \ No newline at end of file From fb375cc7fb344fa9d8ace7dbb4392f165f778036 Mon Sep 17 00:00:00 2001 From: boompolygon <150367438+boompolygon@users.noreply.github.com> Date: Thu, 9 Nov 2023 17:55:16 +0000 Subject: [PATCH 1903/1974] Add BOOM adapter (#8015) Added adapter for BOOM, boom.trading Co-authored-by: Josh <31908788+truemiller@users.noreply.github.com> --- projects/boom/index.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 projects/boom/index.js diff --git a/projects/boom/index.js b/projects/boom/index.js new file mode 100644 index 00000000000..6d618b0afc9 --- /dev/null +++ b/projects/boom/index.js @@ -0,0 +1,12 @@ +const { masterchefExports } = require("../helper/unknownTokens"); + +const boomTokenAddress = "0xe88Ac56C4dedc973a0a26C062F0F07568dfb23FA" +const boomChefAddress = "0x153b536dB217fD92685833466C51DB91fE4Cd9ab" + +module.exports = masterchefExports({ + chain: 'polygon', + masterchef: boomChefAddress, + nativeToken: boomTokenAddress, + useDefaultCoreAssets: true, + poolInfoABI: 'function poolInfo(uint256) view returns (address lpToken, uint256 allocPoint, uint256 lastRewardBlock, uint256 accBoomPerShare)', +}) \ No newline at end of file From f951ae742f68f4365ff78c292acc08014c985bbe Mon Sep 17 00:00:00 2001 From: cryptootech <150287060+cryptootech@users.noreply.github.com> Date: Thu, 9 Nov 2023 23:44:15 +0530 Subject: [PATCH 1904/1974] Add CryptooTech project (#7994) * Add CryptooTech project * Update index.js --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/CryptooTech/index.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 projects/CryptooTech/index.js diff --git a/projects/CryptooTech/index.js b/projects/CryptooTech/index.js new file mode 100644 index 00000000000..b1e00681f6f --- /dev/null +++ b/projects/CryptooTech/index.js @@ -0,0 +1,14 @@ +const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') + +const contract = "0x4a3720A09a90A82170779c972832eD04542deeAC" + +async function tvl(time, ethBlock, _b, {api}) { + return sumTokens2({ tokens: [nullAddress], owner: contract, api }) +} + +module.exports = { + methodology: `We count the ETH on ${contract}`, + arbitrum: { + tvl + } +} From 808cb1b635a6fdd00d6c024c108096d13931d32e Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Fri, 10 Nov 2023 02:43:04 +0000 Subject: [PATCH 1905/1974] add methodology --- projects/silo/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/silo/index.js b/projects/silo/index.js index 5ada193e5d3..b87d4f08528 100644 --- a/projects/silo/index.js +++ b/projects/silo/index.js @@ -80,6 +80,7 @@ async function getSilos(api) { module.exports = { + methodology: `We calculate TVL by interacting with Silo Factory smart contracts on Ethereum and Arbitrum. For Ethereum, it queries Silo(Original)(0x4D919CEcfD4793c0D47866C8d0a02a0950737589), (Convex Factory)(0x6d4A256695586F61b77B09bc3D28333A91114d5a), and (LLAMA Edition)(0x2c0fA05281730EFd3ef71172d8992500B36b56eA). On Arbitrum, we query the Silo Arbitrum factory(0x4166487056A922D784b073d4d928a516B074b719) to obtain the addresses of Silos, retrieve the assets of each Silo, and then calculates the sum of the deposited tokens, borrowed amount are exported separately`, ethereum: { tvl, borrowed, }, arbitrum: { tvl, borrowed, }, hallmarks: [ From 429b0424e9b33ebfa53916cf8543fe5f7a04900c Mon Sep 17 00:00:00 2001 From: Holly-S33 <56821487+Holly-S33@users.noreply.github.com> Date: Fri, 10 Nov 2023 14:48:31 +0800 Subject: [PATCH 1906/1974] T2T2 project SDK adapter (#7998) * T2T2 project SDK adapter * Update T2T2/index.js remove the wrong address --- projects/T2T2/index.js | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 projects/T2T2/index.js diff --git a/projects/T2T2/index.js b/projects/T2T2/index.js new file mode 100644 index 00000000000..565e0431306 --- /dev/null +++ b/projects/T2T2/index.js @@ -0,0 +1,11 @@ +const { nullAddress, sumTokensExport } = require("../helper/unwrapLPs"); + +const config = { + base: '0xE173A25C522385BB117b3044C79F534cD0a895EC' +} + +Object.keys(config).forEach(chain => { + module.exports[chain] = { + tvl: sumTokensExport({ tokens: [nullAddress], owner: config[chain] }) + } +}) From af3740b7793d02cf0b15ae3f6aa29e79da04bc8f Mon Sep 17 00:00:00 2001 From: Hodlify <137034650+hodlifyio@users.noreply.github.com> Date: Fri, 10 Nov 2023 17:12:44 +0800 Subject: [PATCH 1907/1974] update vaults list for Hodlify (#8018) --- projects/hodlify/constants.js | 19 +++++++++---------- projects/hodlify/index.js | 17 ++++++++++++++--- 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/projects/hodlify/constants.js b/projects/hodlify/constants.js index 34dd156b69f..834bd5d21b9 100644 --- a/projects/hodlify/constants.js +++ b/projects/hodlify/constants.js @@ -1,18 +1,13 @@ const contracts = { - ethereum: { - vaults: [ - // eth - '0x62beB192eBF4790777a084ED482AE1A501b74D65', - ], - }, optimism: { vaults: [ // usdc '0x034A4072E63aB05aF057e4E9aFC961EA584fB886', // entry '0xcf038417eac3bEa4be8f296B0Ed994e8410B6eBC', // polygon satellite '0x81C3b05753A40f7dd93F154eDC4112AF2F3B5B3b', // arbitrum satellite - // eth - '0x38B2023e7fF7Fe9a33dFF14350d94F017e538768', + '0x5135Bd97b41871fC2745FEf24F941D9527B0b450', + '0xD2FBB4Ee4b446766318A1766EA5bF38cAd4E3eEe', + '0xA3c965A249855bff48925E4414A4b7f0920fbfe4', ], }, polygon: { @@ -20,6 +15,9 @@ const contracts = { '0xFABea2117d95b780077ca8dDf268BcC8c29589ED', // entry '0x98266478600d4Cae5082d2A185cc6533684dA108', // arbitrum satellite '0x4a307418cEd78A3f2348FD84e66453Efe0BDD16a', // optimisim satellite + '0x3829d380bc9de2d1d421551f2D45FD81b3e82453', + '0x9212728C3602A811927eFCa7a7628e88458D6525', + '0x976d4B0368aB11b1c2677Dc7e71DA3640206a28d', ], }, arbitrum: { @@ -28,8 +26,9 @@ const contracts = { '0x98fCBbfb97B61e2DA167A69345c58e4126A5167B', // entry '0x801E78C94d5fffDD6F37684ad5ac68EF3b15E559', // polygon satellite '0x680924B3B81d918B01D43E80C092CF75C6063681', // optimisim satellite - // eth - '0xD7Aac4989D82361b3b4917DA9D51266E66edBe0a', + '0xe45011d955C17c00880300b20cF83Ca297aC8BC9', + '0x691E1f8d698b6156EcdD0064B2e61d4a87aa041b', + '0x867Ca248B3AB3dDF968304046b6346E3dD7aC5d2', ], }, } diff --git a/projects/hodlify/index.js b/projects/hodlify/index.js index 62311c8f669..c4d8aa040e6 100644 --- a/projects/hodlify/index.js +++ b/projects/hodlify/index.js @@ -25,10 +25,22 @@ const fetchStrategyAddresses = async (api, vaultAddresses) => { return getUniqueAddresses(addresses); } +const filterAvailableVault = async (api, vaultAddresses) => { + const available = await api.multiCall({ + calls: vaultAddresses, + abi: 'address:token', + permitFailure: true, + }); + + return vaultAddresses.filter((_, i) => available[i] != null) +} + const aggregateVaultTvl = async (api) => { const { vaults, } = contracts[api.chain]; - const strategies = await fetchStrategyAddresses(api, vaults); - await getUnderlyingTokenBalance(api, vaults); + // check is available + const availableVaults = await filterAvailableVault(api, vaults); + const strategies = await fetchStrategyAddresses(api, availableVaults); + await getUnderlyingTokenBalance(api, availableVaults); await getStrategyVaultsLpValue(api, strategies); } @@ -41,7 +53,6 @@ module.exports = { doublecounted: true, start: 1693929600, // Tue Sep 05 2023 16:00:00 GMT+0000 methodology: 'Hodlify TVL including total values of assets deposited in other protocols, and the petty cash in our earning vaults.', - ethereum: { tvl }, arbitrum: { tvl }, optimism: { tvl }, polygon: { tvl }, From 3b1358631ccbea3ccf4046ebe1652d642dcb128d Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 10 Nov 2023 10:25:18 +0100 Subject: [PATCH 1908/1974] update atrofarm --- projects/Atrofarm/index.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/projects/Atrofarm/index.js b/projects/Atrofarm/index.js index 253ff20e299..4b2da8823eb 100644 --- a/projects/Atrofarm/index.js +++ b/projects/Atrofarm/index.js @@ -1,8 +1,17 @@ const { masterchefExports } = require("../helper/unknownTokens"); +const sdk = require('@defillama/sdk') +const { sumTokensExport } = require('../helper/unwrapLPs') -module.exports = masterchefExports({ - chain: 'pulse', +module.exports = masterchefExports({ + chain: 'pulse', masterchef: '0x86dd9C95E9d504648d40732c925438C6984Fac4A', nativeTokens: ['0x303f764A9c9511c12837cD2D1ECF13d4a6F99E17'], useDefaultCoreAssets: true, -}) \ No newline at end of file +}) + +module.exports.pulse.tvl = sdk.util.sumChainTvls([module.exports.pulse.tvl, sumTokensExport({ + tokensAndOwners: [['0xefD766cCb38EaF1dfd701853BFCe31359239F305', '0x5726f36e62cf761332F5c655b68bc2E5D55ED083'], + ['0xA1077a294dDE1B09bB078844df40758a5D0f9a27', '0xc4d4fb6cAD2931e65C0BF44b2A3fA9C598ADd37B'], + ['0x95B303987A60C71504D99Aa1b13B4DA07b0790ab', '0x8615545328F1F6c8cefe8b48ad48c231731433ea']], +})]) + From ed716e0c27266d8e7305d2a65a725b21f73fa585 Mon Sep 17 00:00:00 2001 From: kissjingalex Date: Fri, 10 Nov 2023 17:27:21 +0800 Subject: [PATCH 1909/1974] create new project named defo (#8020) Co-authored-by: lhh --- projects/defo/index.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 projects/defo/index.js diff --git a/projects/defo/index.js b/projects/defo/index.js new file mode 100644 index 00000000000..e373e205297 --- /dev/null +++ b/projects/defo/index.js @@ -0,0 +1,14 @@ +const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') + +const contract = "0x51810698D18a7ba9e73a3D63a4Fe9200C384157A" + +async function tvl(time, ethBlock, _b, {api}) { + return sumTokens2({ tokens: [nullAddress], owner: contract, api }) +} + +module.exports = { + methodology: `We count the ETH on ${contract}`, + base: { + tvl + } +} \ No newline at end of file From 2cd29a81e43acfc1250971288ea88fe2a3a9b435 Mon Sep 17 00:00:00 2001 From: Dexland <150405696+dexlanddao@users.noreply.github.com> Date: Fri, 10 Nov 2023 01:27:57 -0800 Subject: [PATCH 1910/1974] Create index.js (#8016) --- projects/Dexland/index.js | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 projects/Dexland/index.js diff --git a/projects/Dexland/index.js b/projects/Dexland/index.js new file mode 100644 index 00000000000..0446297126f --- /dev/null +++ b/projects/Dexland/index.js @@ -0,0 +1,8 @@ +const { getUniTVL, } = require('../helper/unknownTokens') + +module.exports = { + misrepresentedTokens: true, + core: { + tvl: getUniTVL({ factory: '0x3D6Cb82318f8c5DAAA9498a379D047a369c1E4aA', useDefaultCoreAssets: true, fetchBalances: true, }), + }, +}; From d406b8a2cb73e2de08a234a15d3aa79386c5caf6 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 10 Nov 2023 11:12:22 +0100 Subject: [PATCH 1911/1974] Reyield (#8022) * reyield finance * code refactor --------- Co-authored-by: Kyle Wnag --- projects/reyield-finance/abi.json | 8 +++++ projects/reyield-finance/index.js | 53 +++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 projects/reyield-finance/abi.json create mode 100644 projects/reyield-finance/index.js diff --git a/projects/reyield-finance/abi.json b/projects/reyield-finance/abi.json new file mode 100644 index 00000000000..d75ec4441a4 --- /dev/null +++ b/projects/reyield-finance/abi.json @@ -0,0 +1,8 @@ +{ + "getPositionManagers": "function getPositionManagers(uint256 cursor, uint256 howMany) view returns (address[] managers, uint256 newCursor)", + "getOwner": "function getOwner() view returns (address)", + "positionIdCounter": "function positionIdCounter() view returns (uint256)", + "isPositionRunning": "function isPositionRunning(uint256 positionId) view returns (bool)", + "getAmounts": "function getAmounts(address userAddress, uint256 positionId) view returns (tuple(address token0, address token1, uint256 amount0, uint256 amount1, uint256 amount0UsdValue, uint256 amount1UsdValue))", + "getUncollectedFees": "function getUncollectedFees(address userAddress, uint256 positionId) view returns (tuple(address token0, address token1, uint128 amount0, uint128 amount1, uint256 amount0UsdValue, uint256 amount1UsdValue))" +} diff --git a/projects/reyield-finance/index.js b/projects/reyield-finance/index.js new file mode 100644 index 00000000000..fbe2b957e6b --- /dev/null +++ b/projects/reyield-finance/index.js @@ -0,0 +1,53 @@ +const ABI = require('./abi.json') + +const positionManagerFactory = "0x3332Ae0fC25eF24352ca75c01A1fCfd9fc33EAca" +const positionHelper = "0x76136A56963740b4992C5E9dA5bB58ECffC92ce3" + +async function tvl() { + const { api } = arguments[3] + + const { managers } = await api.call({ + target: positionManagerFactory, + abi: ABI.getPositionManagers, + params: [0, 1000000], + }) + + const owners = await api.multiCall({ abi: ABI.getOwner, calls: managers, }) + const counters = await api.multiCall({ abi: ABI.positionIdCounter, calls: managers, }) + + await Promise.all(managers.map(async (manager, i) => { + const owner = owners[i] + const calls = [] + for (let pid = 1; pid <= counters[i]; pid++) { + calls.push({ params: [owner, pid] }) + } + if (!calls.length) return; + + const liquidity = await api.multiCall({ abi: ABI.getAmounts, calls, target: positionHelper }) + const fees = await api.multiCall({ abi: ABI.getUncollectedFees, calls, target: positionHelper }) + liquidity.forEach(addValue) + fees.forEach(addValue) + })) + + return api.getBalances() + + function addValue(i) { + api.add(i.token0, i.amount0) + api.add(i.token1, i.amount1) + } +} + +const chains = [ + 'optimism', + 'polygon', +] + +module.exports = { + start: 1695873578, // Sep-28-2023 03:59:38 AM +UTC + doublecounted: true, + methodology: "TVL is equal to users' running positions' liquidity value plus uncollected fees.", +}; + +chains.forEach(chain => { + module.exports[chain] = { tvl } +}) From e42f64a74ff17c0392695ecb12e401ef56d2dbc0 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 10 Nov 2023 16:33:44 +0100 Subject: [PATCH 1912/1974] Kamino-lending (#8026) * Add kamino lending * Add kamino lending * Add kamino lending * code refactor * minor fix * minor fix --------- Co-authored-by: peroxy --- projects/kamino-lending/index.js | 70 ++ .../kamino-lending/kamino-lending-idl.json | 875 ++++++++++++++++++ 2 files changed, 945 insertions(+) create mode 100644 projects/kamino-lending/index.js create mode 100644 projects/kamino-lending/kamino-lending-idl.json diff --git a/projects/kamino-lending/index.js b/projects/kamino-lending/index.js new file mode 100644 index 00000000000..bd3ae5a3cef --- /dev/null +++ b/projects/kamino-lending/index.js @@ -0,0 +1,70 @@ +const { PublicKey, Keypair } = require('@solana/web3.js'); +const { getConnection, sumTokens } = require('../helper/solana'); +const { Program } = require('@project-serum/anchor'); +const kaminoIdl = require('./kamino-lending-idl.json'); +const { MintLayout } = require("../helper/utils/solana/layouts/mixed-layout"); + +async function tvl() { + const connection = getConnection(); + const programId = new PublicKey('KLend2g3cP87fffoy8q1mQqGKjrxjC8boSyAYavgmjD'); + const markets = ['7u3HeHxYDLhnCoErrtycNokbQYbWGzLs6JSDqGAv5PfF']; + const lendingMarketAuthSeed = 'lma'; + // const scope = new Scope('mainnet-beta', connection); + // const oraclePrices = await scope.getOraclePrices(); + const tokensAndOwners = []; + const ktokens = {}; + + const kaminoLendProgram = new Program(kaminoIdl, programId, { connection, publicKey: PublicKey.unique() }); + let tvl = 0; + for (const market of markets) { + const reserves = await kaminoLendProgram.account.reserve.all([ + { dataSize: 8624 }, + { memcmp: { offset: 32, bytes: market } }, + ]); + + for (const reserveData of reserves) { + const reserve = reserveData.account; + if ( + ktokens[reserve.liquidity.mintPubkey] || + (await isKToken(new PublicKey(reserve.liquidity.mintPubkey), connection)) + ) { + /* ktokens[reserve.liquidity.mintPubkey] = true; + const liq = Number(reserve.liquidity.availableAmount.toString()) / 10 ** Number(reserve.liquidity.mintDecimals); + const oracle = reserve.config.tokenInfo.scopeConfiguration.priceFeed; + const chain = reserve.config.tokenInfo.scopeConfiguration.priceChain; + if (oracle && chain && Scope.isScopeChainValid(chain)) { + const price = await scope.getPriceFromChain(chain, oraclePrices); + tvl += liq * price.toNumber(); + } */ + } else { + ktokens[reserve.liquidity.mintPubkey] = false; + const [authority] = PublicKey.findProgramAddressSync( + [Buffer.from(lendingMarketAuthSeed), new PublicKey(market).toBuffer()], + programId + ); + tokensAndOwners.push([reserve.liquidity.mintPubkey, authority]); + } + } + } + // return { tether: tvl, ...(await sumTokens(tokensAndOwners)) }; + return sumTokens(tokensAndOwners) +} + +async function isKToken(mint, connection) { + const mintInfo = await connection.getAccountInfo(new PublicKey(mint.toString())); + const rawMint = MintLayout.decode(mintInfo.data.slice(0, MintLayout.span)); + const KAMINO_PROGRAM_ID = new PublicKey('6LtLpnUFNByNXLyCoK9wA2MykKAmQNZKBdY8s47dehDc'); + const [expectedMintAuthority] = PublicKey.findProgramAddressSync( + [Buffer.from('authority'), mint.toBuffer()], + KAMINO_PROGRAM_ID + ); + return rawMint.mintAuthority !== null && rawMint.mintAuthority.equals(expectedMintAuthority); +} + +module.exports = { + timetravel: false, + solana: { + tvl, + }, + methodology: 'TVL consists of deposits made to the protocol, borrowed tokens are not counted.', +}; diff --git a/projects/kamino-lending/kamino-lending-idl.json b/projects/kamino-lending/kamino-lending-idl.json new file mode 100644 index 00000000000..d8c1d17e9ce --- /dev/null +++ b/projects/kamino-lending/kamino-lending-idl.json @@ -0,0 +1,875 @@ +{ + "version": "0.1.0", + "name": "kamino_lending", + "instructions": [], + "accounts": [ + { + "name": "Reserve", + "type": { + "kind": "struct", + "fields": [ + { + "name": "version", + "docs": [ + "Version of the reserve" + ], + "type": "u64" + }, + { + "name": "lastUpdate", + "docs": [ + "Last slot when supply and rates updated" + ], + "type": { + "defined": "LastUpdate" + } + }, + { + "name": "lendingMarket", + "docs": [ + "Lending market address" + ], + "type": "publicKey" + }, + { + "name": "farmCollateral", + "type": "publicKey" + }, + { + "name": "farmDebt", + "type": "publicKey" + }, + { + "name": "liquidity", + "docs": [ + "Reserve liquidity" + ], + "type": { + "defined": "ReserveLiquidity" + } + }, + { + "name": "reserveLiquidityPadding", + "type": { + "array": [ + "u64", + 150 + ] + } + }, + { + "name": "collateral", + "docs": [ + "Reserve collateral" + ], + "type": { + "defined": "ReserveCollateral" + } + }, + { + "name": "reserveCollateralPadding", + "type": { + "array": [ + "u64", + 150 + ] + } + }, + { + "name": "config", + "docs": [ + "Reserve configuration values" + ], + "type": { + "defined": "ReserveConfig" + } + }, + { + "name": "configPadding", + "type": { + "array": [ + "u64", + 150 + ] + } + }, + { + "name": "padding", + "type": { + "array": [ + "u64", + 240 + ] + } + } + ] + } + } + ], + "types": [ + { + "name": "LastUpdate", + "docs": [ + "Last update state" + ], + "type": { + "kind": "struct", + "fields": [ + { + "name": "slot", + "docs": [ + "Last slot when updated" + ], + "type": "u64" + }, + { + "name": "stale", + "docs": [ + "True when marked stale, false when slot updated" + ], + "type": "u8" + }, + { + "name": "placeholder", + "type": { + "array": [ + "u8", + 7 + ] + } + } + ] + } + }, + { + "name": "BigFractionBytes", + "type": { + "kind": "struct", + "fields": [ + { + "name": "value", + "type": { + "array": [ + "u64", + 4 + ] + } + }, + { + "name": "padding", + "type": { + "array": [ + "u64", + 2 + ] + } + } + ] + } + }, + { + "name": "ReserveLiquidity", + "docs": [ + "Reserve liquidity" + ], + "type": { + "kind": "struct", + "fields": [ + { + "name": "mintPubkey", + "docs": [ + "Reserve liquidity mint address" + ], + "type": "publicKey" + }, + { + "name": "supplyVault", + "docs": [ + "Reserve liquidity supply address" + ], + "type": "publicKey" + }, + { + "name": "feeVault", + "docs": [ + "Reserve liquidity fee collection address" + ], + "type": "publicKey" + }, + { + "name": "availableAmount", + "docs": [ + "Reserve liquidity available" + ], + "type": "u64" + }, + { + "name": "borrowedAmountSf", + "docs": [ + "Reserve liquidity borrowed (scaled fraction)" + ], + "type": "u128" + }, + { + "name": "marketPriceSf", + "docs": [ + "Reserve liquidity market price in quote currency (scaled fraction)" + ], + "type": "u128" + }, + { + "name": "marketPriceLastUpdatedTs", + "docs": [ + "Unix timestamp of the market price (from the oracle)" + ], + "type": "u64" + }, + { + "name": "mintDecimals", + "docs": [ + "Reserve liquidity mint decimals" + ], + "type": "u64" + }, + { + "name": "depositLimitCrossedSlot", + "docs": [ + "Timestamp in slots when the last refresh reserve detected that the liquidity amount is above the deposit cap. When this threshold is crossed, then redemptions (auto-deleverage) are enabled.", + "If the threshold is not crossed, then the timestamp is set to 0" + ], + "type": "u64" + }, + { + "name": "borrowLimitCrossedSlot", + "docs": [ + "Timestamp in slots when the last refresh reserve detected that the borrowed amount is above the borrow cap. When this threshold is crossed, then redemptions (auto-deleverage) are enabled.", + "If the threshold is not crossed, then the timestamp is set to 0" + ], + "type": "u64" + }, + { + "name": "cumulativeBorrowRateBsf", + "docs": [ + "Reserve liquidity cumulative borrow rate (scaled fraction)" + ], + "type": { + "defined": "BigFractionBytes" + } + }, + { + "name": "accumulatedProtocolFeesSf", + "docs": [ + "Reserve cumulative protocol fees (scaled fraction)" + ], + "type": "u128" + }, + { + "name": "accumulatedReferrerFeesSf", + "docs": [ + "Reserve cumulative referrer fees (scaled fraction)" + ], + "type": "u128" + }, + { + "name": "pendingReferrerFeesSf", + "docs": [ + "Reserve pending referrer fees, to be claimed in refresh_obligation by referrer or protocol (scaled fraction)" + ], + "type": "u128" + }, + { + "name": "absoluteReferralRateSf", + "docs": [ + "Reserve referrer fee absolute rate calculated at each refresh_reserve operation (scaled fraction)" + ], + "type": "u128" + }, + { + "name": "padding2", + "type": { + "array": [ + "u64", + 55 + ] + } + }, + { + "name": "padding3", + "type": { + "array": [ + "u128", + 32 + ] + } + } + ] + } + }, + { + "name": "ReserveCollateral", + "docs": [ + "Reserve collateral" + ], + "type": { + "kind": "struct", + "fields": [ + { + "name": "mintPubkey", + "docs": [ + "Reserve collateral mint address" + ], + "type": "publicKey" + }, + { + "name": "mintTotalSupply", + "docs": [ + "Reserve collateral mint supply, used for exchange rate" + ], + "type": "u64" + }, + { + "name": "supplyVault", + "docs": [ + "Reserve collateral supply address" + ], + "type": "publicKey" + }, + { + "name": "padding1", + "type": { + "array": [ + "u128", + 32 + ] + } + }, + { + "name": "padding2", + "type": { + "array": [ + "u128", + 32 + ] + } + } + ] + } + }, + { + "name": "ReserveConfig", + "docs": [ + "Reserve configuration values" + ], + "type": { + "kind": "struct", + "fields": [ + { + "name": "status", + "docs": [ + "Status of the reserve Active/Obsolete/Hidden" + ], + "type": "u8" + }, + { + "name": "assetTier", + "docs": [ + "Asset tier -> 0 - regular (collateral & debt), 1 - isolated collateral, 2 - isolated debt" + ], + "type": "u8" + }, + { + "name": "reserved0", + "type": { + "array": [ + "u8", + 2 + ] + } + }, + { + "name": "multiplierSideBoost", + "docs": [ + "Boost for side (debt or collateral)" + ], + "type": { + "array": [ + "u8", + 2 + ] + } + }, + { + "name": "multiplierTagBoost", + "docs": [ + "Reward points multiplier per obligation type" + ], + "type": { + "array": [ + "u8", + 8 + ] + } + }, + { + "name": "protocolTakeRatePct", + "docs": [ + "Protocol take rate is the amount borrowed interest protocol receives, as a percentage" + ], + "type": "u8" + }, + { + "name": "protocolLiquidationFeePct", + "docs": [ + "Cut of the liquidation bonus that the protocol receives, as a percentage" + ], + "type": "u8" + }, + { + "name": "loanToValuePct", + "docs": [ + "Target ratio of the value of borrows to deposits, as a percentage", + "0 if use as collateral is disabled" + ], + "type": "u8" + }, + { + "name": "liquidationThresholdPct", + "docs": [ + "Loan to value ratio at which an obligation can be liquidated, as percentage" + ], + "type": "u8" + }, + { + "name": "minLiquidationBonusBps", + "docs": [ + "Minimum bonus a liquidator receives when repaying part of an unhealthy obligation, as bps" + ], + "type": "u16" + }, + { + "name": "maxLiquidationBonusBps", + "docs": [ + "Maximum bonus a liquidator receives when repaying part of an unhealthy obligation, as bps" + ], + "type": "u16" + }, + { + "name": "badDebtLiquidationBonusBps", + "docs": [ + "Bad debt liquidation bonus for an undercollateralized obligation, as bps" + ], + "type": "u16" + }, + { + "name": "deleveragingMarginCallPeriodSecs", + "docs": [ + "Time in seconds that must pass before redemptions are enabled after the deposit limit is crossed" + ], + "type": "u64" + }, + { + "name": "deleveragingThresholdSlotsPerBps", + "docs": [ + "The rate at which the deleveraging threshold decreases in slots per bps", + "e.g. 1 bps per hour would be 7200 slots per bps (assuming 2 slots per second)" + ], + "type": "u64" + }, + { + "name": "fees", + "docs": [ + "Program owner fees assessed, separate from gains due to interest accrual" + ], + "type": { + "defined": "ReserveFees" + } + }, + { + "name": "borrowRateCurve", + "docs": [ + "Borrow rate curve based on utilization" + ], + "type": { + "defined": "BorrowRateCurve" + } + }, + { + "name": "borrowFactorPct", + "docs": [ + "Borrow factor in percentage - used for risk adjustment" + ], + "type": "u64" + }, + { + "name": "depositLimit", + "docs": [ + "Maximum deposit limit of liquidity in native units, u64::MAX for inf" + ], + "type": "u64" + }, + { + "name": "borrowLimit", + "docs": [ + "Maximum amount borrowed, u64::MAX for inf, 0 to disable borrows (protected deposits)" + ], + "type": "u64" + }, + { + "name": "tokenInfo", + "docs": [ + "Token id from TokenInfos struct" + ], + "type": { + "defined": "TokenInfo" + } + }, + { + "name": "depositWithdrawalCap", + "docs": [ + "Deposit withdrawl caps - deposit & redeem" + ], + "type": { + "defined": "WithdrawalCaps" + } + }, + { + "name": "debtWithdrawalCap", + "docs": [ + "Debt withdrawl caps - borrow & repay" + ], + "type": { + "defined": "WithdrawalCaps" + } + }, + { + "name": "elevationGroups", + "type": { + "array": [ + "u8", + 20 + ] + } + }, + { + "name": "reserved1", + "type": { + "array": [ + "u8", + 4 + ] + } + } + ] + } + }, + { + "name": "WithdrawalCaps", + "docs": [ + "Reserve Withdrawal Caps State" + ], + "type": { + "kind": "struct", + "fields": [ + { + "name": "configCapacity", + "type": "i64" + }, + { + "name": "currentTotal", + "type": "i64" + }, + { + "name": "lastIntervalStartTimestamp", + "type": "u64" + }, + { + "name": "configIntervalLengthSeconds", + "type": "u64" + } + ] + } + }, + { + "name": "ReserveFees", + "docs": [ + "Additional fee information on a reserve", + "", + "These exist separately from interest accrual fees, and are specifically for the program owner", + "and referral fee. The fees are paid out as a percentage of liquidity token amounts during", + "repayments and liquidations." + ], + "type": { + "kind": "struct", + "fields": [ + { + "name": "borrowFeeSf", + "docs": [ + "Fee assessed on `BorrowObligationLiquidity`, as scaled fraction (60 bits fractional part)", + "Must be between `0` and `2^60`, such that `2^60 = 1`. A few examples for", + "clarity:", + "1% = (1 << 60) / 100 = 11529215046068470", + "0.01% (1 basis point) = 115292150460685", + "0.00001% (Aave borrow fee) = 115292150461" + ], + "type": "u64" + }, + { + "name": "flashLoanFeeSf", + "docs": [ + "Fee for flash loan, expressed as scaled fraction.", + "0.3% (Aave flash loan fee) = 0.003 * 2^60 = 3458764513820541" + ], + "type": "u64" + }, + { + "name": "padding", + "docs": [ + "Used for allignment" + ], + "type": { + "array": [ + "u8", + 8 + ] + } + } + ] + } + }, + { + "name": "TokenInfo", + "type": { + "kind": "struct", + "fields": [ + { + "name": "name", + "docs": [ + "UTF-8 encoded name of the token (null-terminated)" + ], + "type": { + "array": [ + "u8", + 32 + ] + } + }, + { + "name": "heuristic", + "docs": [ + "Heuristics limits of acceptable price" + ], + "type": { + "defined": "PriceHeuristic" + } + }, + { + "name": "maxTwapDivergenceBps", + "docs": [ + "Max divergence between twap and price in bps" + ], + "type": "u64" + }, + { + "name": "maxAgePriceSeconds", + "type": "u64" + }, + { + "name": "maxAgeTwapSeconds", + "type": "u64" + }, + { + "name": "scopeConfiguration", + "docs": [ + "Scope price configuration" + ], + "type": { + "defined": "ScopeConfiguration" + } + }, + { + "name": "switchboardConfiguration", + "docs": [ + "Switchboard configuration" + ], + "type": { + "defined": "SwitchboardConfiguration" + } + }, + { + "name": "pythConfiguration", + "docs": [ + "Pyth configuration" + ], + "type": { + "defined": "PythConfiguration" + } + }, + { + "name": "padding", + "type": { + "array": [ + "u64", + 20 + ] + } + } + ] + } + }, + { + "name": "PriceHeuristic", + "type": { + "kind": "struct", + "fields": [ + { + "name": "lower", + "docs": [ + "Lower value of acceptable price" + ], + "type": "u64" + }, + { + "name": "upper", + "docs": [ + "Upper value of acceptable price" + ], + "type": "u64" + }, + { + "name": "exp", + "docs": [ + "Number of decimals of the previously defined values" + ], + "type": "u64" + } + ] + } + }, + { + "name": "ScopeConfiguration", + "type": { + "kind": "struct", + "fields": [ + { + "name": "priceFeed", + "docs": [ + "Pubkey of the scope price feed (disabled if `null` or `default`)" + ], + "type": "publicKey" + }, + { + "name": "priceChain", + "docs": [ + "This is the scope_id price chain that results in a price for the token" + ], + "type": { + "array": [ + "u16", + 4 + ] + } + }, + { + "name": "twapChain", + "docs": [ + "This is the scope_id price chain for the twap" + ], + "type": { + "array": [ + "u16", + 4 + ] + } + } + ] + } + }, + { + "name": "SwitchboardConfiguration", + "type": { + "kind": "struct", + "fields": [ + { + "name": "priceAggregator", + "docs": [ + "Pubkey of the base price feed (disabled if `null` or `default`)" + ], + "type": "publicKey" + }, + { + "name": "twapAggregator", + "type": "publicKey" + } + ] + } + }, + { + "name": "PythConfiguration", + "type": { + "kind": "struct", + "fields": [ + { + "name": "price", + "docs": [ + "Pubkey of the base price feed (disabled if `null` or `default`)" + ], + "type": "publicKey" + } + ] + } + }, + { + "name": "BorrowRateCurve", + "type": { + "kind": "struct", + "fields": [ + { + "name": "points", + "type": { + "array": [ + { + "defined": "CurvePoint" + }, + 11 + ] + } + } + ] + } + }, + { + "name": "CurvePoint", + "type": { + "kind": "struct", + "fields": [ + { + "name": "utilizationRateBps", + "type": "u32" + }, + { + "name": "borrowRateBps", + "type": "u32" + } + ] + } + }, + { + "name": "AssetTier", + "type": { + "kind": "enum", + "variants": [ + { + "name": "Regular" + }, + { + "name": "IsolatedCollateral" + }, + { + "name": "IsolatedDebt" + } + ] + } + } + ], + "errors": [] +} \ No newline at end of file From 640e536032178a0d39ac3d4a39cf2f2513abc599 Mon Sep 17 00:00:00 2001 From: peroxy Date: Fri, 10 Nov 2023 16:55:28 +0100 Subject: [PATCH 1913/1974] Cleanup kamino lending (#8027) --- projects/kamino-lending/index.js | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/projects/kamino-lending/index.js b/projects/kamino-lending/index.js index bd3ae5a3cef..bbe0077ee62 100644 --- a/projects/kamino-lending/index.js +++ b/projects/kamino-lending/index.js @@ -1,4 +1,4 @@ -const { PublicKey, Keypair } = require('@solana/web3.js'); +const { PublicKey } = require('@solana/web3.js'); const { getConnection, sumTokens } = require('../helper/solana'); const { Program } = require('@project-serum/anchor'); const kaminoIdl = require('./kamino-lending-idl.json'); @@ -9,13 +9,10 @@ async function tvl() { const programId = new PublicKey('KLend2g3cP87fffoy8q1mQqGKjrxjC8boSyAYavgmjD'); const markets = ['7u3HeHxYDLhnCoErrtycNokbQYbWGzLs6JSDqGAv5PfF']; const lendingMarketAuthSeed = 'lma'; - // const scope = new Scope('mainnet-beta', connection); - // const oraclePrices = await scope.getOraclePrices(); const tokensAndOwners = []; const ktokens = {}; const kaminoLendProgram = new Program(kaminoIdl, programId, { connection, publicKey: PublicKey.unique() }); - let tvl = 0; for (const market of markets) { const reserves = await kaminoLendProgram.account.reserve.all([ { dataSize: 8624 }, @@ -28,14 +25,7 @@ async function tvl() { ktokens[reserve.liquidity.mintPubkey] || (await isKToken(new PublicKey(reserve.liquidity.mintPubkey), connection)) ) { - /* ktokens[reserve.liquidity.mintPubkey] = true; - const liq = Number(reserve.liquidity.availableAmount.toString()) / 10 ** Number(reserve.liquidity.mintDecimals); - const oracle = reserve.config.tokenInfo.scopeConfiguration.priceFeed; - const chain = reserve.config.tokenInfo.scopeConfiguration.priceChain; - if (oracle && chain && Scope.isScopeChainValid(chain)) { - const price = await scope.getPriceFromChain(chain, oraclePrices); - tvl += liq * price.toNumber(); - } */ + ktokens[reserve.liquidity.mintPubkey] = true; } else { ktokens[reserve.liquidity.mintPubkey] = false; const [authority] = PublicKey.findProgramAddressSync( @@ -46,7 +36,6 @@ async function tvl() { } } } - // return { tether: tvl, ...(await sumTokens(tokensAndOwners)) }; return sumTokens(tokensAndOwners) } @@ -66,5 +55,5 @@ module.exports = { solana: { tvl, }, - methodology: 'TVL consists of deposits made to the protocol, borrowed tokens are not counted.', + methodology: 'TVL consists of deposits made to the protocol, borrowed tokens and kTokens are not counted.', }; From 827c1dc26e71fbd4de4c7a9fa786c71b0c44f2af Mon Sep 17 00:00:00 2001 From: kavsky02 <95619352+kavsky02@users.noreply.github.com> Date: Fri, 10 Nov 2023 16:55:49 +0100 Subject: [PATCH 1914/1974] Add new Arbitrum assets to the mapping (#8024) Add new Arbitrum assets to the mapping Add Arbitrum Pools BTC and ARB --- .../deltaprime/mappings/assetToAddressMappingArbitrum.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/projects/deltaprime/mappings/assetToAddressMappingArbitrum.json b/projects/deltaprime/mappings/assetToAddressMappingArbitrum.json index f39cde36cf7..3d46f574516 100644 --- a/projects/deltaprime/mappings/assetToAddressMappingArbitrum.json +++ b/projects/deltaprime/mappings/assetToAddressMappingArbitrum.json @@ -10,6 +10,10 @@ "DAI": "0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1", "LINK": "0xf97f4df75117a78c1A5a0DBb814Af92458539FB4", "UNI": "0xFa7F8980b0f1E64A2062791cc3b0871572f1F7f0", + "LVL": "0xB64E280e9D1B5DbEc4AcceDb2257A87b400DB149", + "JOE": "0x371c7ec6D8039ff7933a2AA28EB827Ffe1F52f07", + "WOO": "0xcafcd85d8ca7ad1e1c6f82f651fa15e33aefd07b", + "GRAIL": "0x3d9907f9a368ad0a51be60f7da3b97cf940982d8", "FRAX": "0x17FC002b466eEc40DaE837Fc4bE5c67993ddBd6F", "GLP": "0x5402B5F40310bDED796c7D0F3FF6683f5C0cFfdf", "wstETH": "0x5979D7b546E38E414F7E9822514be443A4800529", From 9e389af3082d4c95c57adecb1f6b5cafa0911cce Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 10 Nov 2023 17:10:15 +0100 Subject: [PATCH 1915/1974] update delta prime --- projects/deltaprime/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/deltaprime/index.js b/projects/deltaprime/index.js index ab9d544da8a..66e77e1c594 100644 --- a/projects/deltaprime/index.js +++ b/projects/deltaprime/index.js @@ -123,6 +123,8 @@ async function addVectorVaultBalancesAuto({ balances, accounts, api, token }) { target: VF_MAINSTAKING_CONTRACT, params: [token], }) + if (helper.helper.toLowerCase() === '0xDacb0d2c73c47CaEc4FA8DfD58a7d6d25aB071cE'.toLowerCase()) return balances; + if (helper.helper.toLowerCase() === '0x6D6E858c6103D63123780fa9Ca92EEEAce21414C'.toLowerCase()) return balances; const compounder = await api.call({ abi: 'function compounder() view returns(address)', target: helper.helper, @@ -153,6 +155,7 @@ async function addVectorVaultBalances({ balances, accounts, api, token }) { params: [token], }) if (helper.helper.toLowerCase() === '0x9AB2B763798124F81E95419aC9b77a4fB480742D'.toLowerCase()) return balances; + if (helper.helper.toLowerCase() === '0x6D6E858c6103D63123780fa9Ca92EEEAce21414C'.toLowerCase()) return balances; const bals = await api.multiCall({ abi: VFDepositTokenBalanceAbi, calls: accounts, target: helper.helper }) bals.forEach(i => sdk.util.sumSingleBalance(balances, token, i, api.chain)) From 3262028244371d7897e6f3c08fbcc5b3e9175495 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 10 Nov 2023 17:53:48 +0100 Subject: [PATCH 1916/1974] fix broken adapters --- projects/bright-union/abi.json | 3 --- projects/bright-union/index.js | 18 +++--------------- projects/globiancedex/index.js | 18 ++++++++---------- projects/kassandra/index.js | 2 +- 4 files changed, 12 insertions(+), 29 deletions(-) delete mode 100644 projects/bright-union/abi.json diff --git a/projects/bright-union/abi.json b/projects/bright-union/abi.json deleted file mode 100644 index 11f18e61dd4..00000000000 --- a/projects/bright-union/abi.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "totalTVL": "uint256:totalTVL" -} \ No newline at end of file diff --git a/projects/bright-union/index.js b/projects/bright-union/index.js index 854af6f884c..fa44c23eca4 100644 --- a/projects/bright-union/index.js +++ b/projects/bright-union/index.js @@ -1,7 +1,6 @@ const ADDRESSES = require('../helper/coreAssets.json') -const sdk = require("@defillama/sdk"); -const abi = require("./abi.json"); -const {staking} = require('../helper/staking') +const {staking} = require('../helper/staking'); +const { sumTokensExport } = require('../helper/unwrapLPs'); // BRI const BrightRiskIndex = "0xa4b032895BcB6B11ec7d21380f557919D448FD04"; @@ -12,21 +11,10 @@ const BrightLPStaking = ["0x160c43821004Cb76C7e9727159dD64ab8468f61C"]; //UNIV2 const ETH_BRIGHT_UNIV2 = "0xf4835af5387fab6bbc59f496cbcfa92998469b7b"; -const DAI = ADDRESSES.ethereum.DAI - -async function tvl (timestamp, block) { - return { - [DAI]: (await sdk.api.abi.call({ - target: BrightRiskIndex, - block, - abi: abi["totalTVL"] - })).output - } -} module.exports = { ethereum: { - tvl: tvl, + tvl: sumTokensExport({ owner: BrightRiskIndex, tokens: [ADDRESSES.ethereum.DAI] }), pool2: staking(BrightLPStaking, [ETH_BRIGHT_UNIV2]), staking: staking(BrightStaking, BRIGHT), }, diff --git a/projects/globiancedex/index.js b/projects/globiancedex/index.js index d384750d4cc..34b1d2fdc5f 100644 --- a/projects/globiancedex/index.js +++ b/projects/globiancedex/index.js @@ -1,13 +1,11 @@ -const { post } = require('../helper/http') - -async function fetch() { - const response = await post("https://dexapi.globiance.com/get-stats") - const tvl = response.data.tvl; - return tvl; -} +const { getUniTVL } = require('../helper/unknownTokens') module.exports = { misrepresentedTokens: true, - methodology: `GlobianceDEX TVL is a sum of all the crypto assets locked in various liquidity pools & staking pools available on the DEX.`, - fetch, -}; + xdc: { + tvl: getUniTVL({ + factory: '0xA8334Aae58e5bDee692B26679c1817F9c42f8f51', + useDefaultCoreAssets: true, + }) + }, +} \ No newline at end of file diff --git a/projects/kassandra/index.js b/projects/kassandra/index.js index a9d8d4acb87..9ec8e0a21c3 100644 --- a/projects/kassandra/index.js +++ b/projects/kassandra/index.js @@ -29,7 +29,7 @@ Object.keys(config).forEach(chain => { await sumTokens2({ api, ownerTokens: pools.map((pool, i) => [tokens[i], pool]) }) if (chain === 'avax') { const balances = api.getBalances() - const allTokens = tokens.flat().map(i => i.toLowerCase()) + const allTokens = tokens.flat().map(i => i.toLowerCase()).filter(i => i !== '0xd0f41b1c9338eb9d374c83cc76b684ba3bb71557') const symbols = await api.multiCall({ abi: 'string:symbol', calls: allTokens, }) const yrtTokens = allTokens.filter((token, i) => symbols[i] === 'YRT') const depositTokens = await api.multiCall({ abi: 'address:depositToken', calls: yrtTokens}) From fdbd099c2089acc7db196e3c5644e5a3dfb2cc6c Mon Sep 17 00:00:00 2001 From: Philipp Date: Sat, 11 Nov 2023 09:06:33 +0100 Subject: [PATCH 1917/1974] fixes injective endpoint (#8028) --- projects/helper/chain/cosmos.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/helper/chain/cosmos.js b/projects/helper/chain/cosmos.js index f2865562f20..92906e4fb64 100644 --- a/projects/helper/chain/cosmos.js +++ b/projects/helper/chain/cosmos.js @@ -27,7 +27,7 @@ const endPoints = { persistence: "https://rest.cosmos.directory/persistence", secret: "https://lcd.secret.express", // chihuahua: "https://api.chihuahua.wtf", - injective: "https://lcd-injective.whispernode.com:443", + injective: "https://sentry.lcd.injective.network:443", migaloo: "https://migaloo-api.polkachu.com", fxcore: "https://fx-rest.functionx.io", xpla: "https://dimension-lcd.xpla.dev", From c660811895f55e9aee8f3505a67bea2ec8389180 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Sat, 11 Nov 2023 12:09:36 +0100 Subject: [PATCH 1918/1974] Dual: disable own token from tvl --- projects/davincigraph/index.js | 1 + projects/dual/index.js | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/projects/davincigraph/index.js b/projects/davincigraph/index.js index e147e17be32..b049cae4242 100644 --- a/projects/davincigraph/index.js +++ b/projects/davincigraph/index.js @@ -8,6 +8,7 @@ async function fetch() { module.exports = { timetravel: false, + doublecounted: true, methodology: "The displayed value represents the Total Value Locked (TVL) in USD of all assets secured within the davincigraph token locker smart contracts, accessible at https://davincigraph.io/devs/locks/contracts", hedera: { diff --git a/projects/dual/index.js b/projects/dual/index.js index 5d9e03c50be..c8fcd8526ab 100644 --- a/projects/dual/index.js +++ b/projects/dual/index.js @@ -40,7 +40,8 @@ async function tvl() { const tokenAccounts = dipTokenAccounts.concat(soTokenAccounts).concat(gsoTokenAccounts); - return sumTokens2({ tokenAccounts, allowError: true, }) + const DUAL = 'DUALa4FC2yREwZ59PHeu1un4wis36vHRv5hWVBmzykCJ' + return sumTokens2({ tokenAccounts, allowError: true, blacklistedTokens: [DUAL]}) } function parseDipState(buf) { From f6b9369c1d92e637dce1aa5d0566c9f6cb0abdd8 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Sat, 11 Nov 2023 12:13:50 +0100 Subject: [PATCH 1919/1974] minor fix --- projects/dual/index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/projects/dual/index.js b/projects/dual/index.js index c8fcd8526ab..6135f2a7435 100644 --- a/projects/dual/index.js +++ b/projects/dual/index.js @@ -119,7 +119,6 @@ function gsoVault(pubkey) { } module.exports = { - misrepresentedTokens: true, timetravel: false, solana: { tvl, From b98ecc9c37d9504e48701da6de07b83f41d4cb7a Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Sun, 12 Nov 2023 06:05:17 +0000 Subject: [PATCH 1920/1974] add hallmark --- projects/bassexhcnage/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/bassexhcnage/index.js b/projects/bassexhcnage/index.js index 4cb5b34d371..4f5519878c7 100644 --- a/projects/bassexhcnage/index.js +++ b/projects/bassexhcnage/index.js @@ -18,6 +18,9 @@ async function tvl(timestamp, ethereumBlock, chainBlocks, { api }) { } module.exports = { + hallmarks: [ + [1698969600,"Rug Pull"] + ], base: { tvl, staking: stakings(stakingContracts, bass), From aa1a2ee51ef305f2868efa15616dd1163b6284fb Mon Sep 17 00:00:00 2001 From: Pattieswap <148374586+Pattieswap@users.noreply.github.com> Date: Mon, 13 Nov 2023 02:30:43 +0700 Subject: [PATCH 1921/1974] Add TVL PattieSwap (#8035) * Create index.js * Add TVL PattieSwap --- projects/PattieSwap/index.js | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 projects/PattieSwap/index.js diff --git a/projects/PattieSwap/index.js b/projects/PattieSwap/index.js new file mode 100644 index 00000000000..c5c5a6d69eb --- /dev/null +++ b/projects/PattieSwap/index.js @@ -0,0 +1,6 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports = { + misrepresentedTokens: true, + bsc: { tvl: getUniTVL({ factory: '0x71f6a913b317d2BF0Bf51Fd48d90e4cC6e62C4Dd', useDefaultCoreAssets: true, fetchBalances: true, }), }, +} From 28cdc303ab0e95c1537d5e90a9887974eff214ba Mon Sep 17 00:00:00 2001 From: MirthFutures <69535002+MirthFutures@users.noreply.github.com> Date: Sun, 12 Nov 2023 14:31:19 -0500 Subject: [PATCH 1922/1974] Add Beefy Gnosis (#8033) * Add Beefy Gnosis * Update index.js --------- Co-authored-by: Real Shaman <85087525+realdealshaman@users.noreply.github.com> --- projects/beefy/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/beefy/index.js b/projects/beefy/index.js index a3ec1b779c4..4a2bacb4e4b 100644 --- a/projects/beefy/index.js +++ b/projects/beefy/index.js @@ -35,6 +35,7 @@ const chains = { optimism: 10, cronos: 25, bsc: 56, + xdai: 100, fuse: 122, heco: 128, polygon: 137, From 1a7d8a4298e759687ec2dfd1c551b9c79566c112 Mon Sep 17 00:00:00 2001 From: Alfred Gaillard Date: Sun, 12 Nov 2023 20:32:56 +0100 Subject: [PATCH 1923/1974] Amphor - adding a WSTETH vault (#8031) * Added TVL * Added wstETH vault --- projects/amphor/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/amphor/index.js b/projects/amphor/index.js index c0569672916..a42e5d376d0 100644 --- a/projects/amphor/index.js +++ b/projects/amphor/index.js @@ -4,6 +4,7 @@ const config = { ethereum: { lvTokens: { "ampr-LP-USD": "0x3b022EdECD65b63288704a6fa33A8B9185b5096b", + "ampr-LP-ETH": "0x2791EB5807D69Fe10C02eED6B4DC12baC0701744" } } } From e1a608ac8bec3b36770242d65f6560f42f360fd1 Mon Sep 17 00:00:00 2001 From: daiwanwei <93238466+daiwanwei@users.noreply.github.com> Date: Mon, 13 Nov 2023 16:07:36 +0800 Subject: [PATCH 1924/1974] feat: add the bsc chain for teahouse (#8037) * feat: add the bsc chain for teahouse * test --------- Co-authored-by: Wade --- projects/teahouse/index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/projects/teahouse/index.js b/projects/teahouse/index.js index 518812cd3a6..6f44f4969e6 100644 --- a/projects/teahouse/index.js +++ b/projects/teahouse/index.js @@ -4,6 +4,7 @@ const { getConfig } = require("../helper/cache"); // teahouse public api for vault const teahouseVaultAPI = "https://vault-content-api.teahouse.finance/vaults"; + // get vault contract addresses from teahouse api async function getVaultContractsAddress(chain) { let htAddress = []; @@ -18,7 +19,7 @@ async function getVaultContractsAddress(chain) { } -const chains = ["ethereum", "optimism", "arbitrum", 'polygon']; +const chains = ["ethereum", "optimism", "arbitrum", 'polygon','bsc']; chains.forEach((chain) => { module.exports[chain] = { @@ -46,4 +47,4 @@ chains.forEach((chain) => { }; }); -module.exports.misrepresentedTokens = true \ No newline at end of file +module.exports.misrepresentedTokens = true From 05d6068a76a25faa3ab683ac7a22bca2aa8f781f Mon Sep 17 00:00:00 2001 From: belbix <72255836+belbix@users.noreply.github.com> Date: Mon, 13 Nov 2023 11:15:18 +0300 Subject: [PATCH 1925/1974] Tetu V2 on Base (#8029) * add tetu pawnshop * add tetu v2 on base * remove pawnshop from tetu project * remove unused vars * remove unused vars2 * sorting out code --- projects/tetu/index.js | 44 ++++++++++++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 15 deletions(-) diff --git a/projects/tetu/index.js b/projects/tetu/index.js index 3fddd121871..8c3fdcbbfe5 100644 --- a/projects/tetu/index.js +++ b/projects/tetu/index.js @@ -1,11 +1,12 @@ -const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); -const { getParamCalls } = require("../helper/utils"); +// exclude V1 platforms for avoid double counting const EXCLUDED_PLATFORMS = { "12": true, // TETU_SWAP "29": true // TETU self farm } + +// exclude V1 vaults for avoid double counting const EXCLUDED_VAULTS = { "ethereum": { "0xfe700d523094cc6c673d78f1446ae0743c89586e": true, // tetuBAL ethereum @@ -39,34 +40,45 @@ const config = { bookkeeper: '0xb8bA82F19A9Be6CbF6DAF9BF4FBCC5bDfCF8bEe6', contract_Reader: '0x6E4D8CAc827B52E7E67Ae8f68531fafa36eaEf0B', }, + base: { + contract_Reader: '0xC80807F075Cb76139678De3954D4F7f159829Bf9', + controllerV2: '0x255707B70BF90aa112006E1b07B9AeA6De021424', + veTETU: '0xb8bA82F19A9Be6CbF6DAF9BF4FBCC5bDfCF8bEe6', + }, } Object.keys(config).forEach(chain => { const { bookkeeper, contract_Reader, controllerV2, veTETU } = config[chain] module.exports[chain] = { tvl: async (_, _b, { [chain]: block }, { api }) => { - const vaultAddresses = await api.fetchList({ lengthAbi: abi.vaultsLength, itemAbi: abi.vaults, target: bookkeeper }) - const strategies = await api.multiCall({ abi: abi.strategy, calls: vaultAddresses, }) - const platforms = await api.multiCall({ abi: abi.platform, calls: strategies, }) - const vaultsCall = [] - for (let i = 0; i < vaultAddresses.length; i++) { - if (EXCLUDED_PLATFORMS[platforms[i]] === true) - continue; - // exclude duplication count or broken vaults - if (EXCLUDED_VAULTS[chain] && EXCLUDED_VAULTS[chain][vaultAddresses[i].toLowerCase()] === true) - continue; - vaultsCall.push(vaultAddresses[i]) + // * ############### Tetu V1 vaults + const vaultsCall = []; + if (bookkeeper) { + const vaultAddresses = await api.fetchList({ lengthAbi: abi.vaultsLength, itemAbi: abi.vaults, target: bookkeeper }) + const strategies = await api.multiCall({ abi: abi.strategy, calls: vaultAddresses, }) + const platforms = await api.multiCall({ abi: abi.platform, calls: strategies, }) + + for (let i = 0; i < vaultAddresses.length; i++) { + if (EXCLUDED_PLATFORMS[platforms[i]] === true) { + continue; + } + // exclude duplication count or broken vaults + if (EXCLUDED_VAULTS[chain] && EXCLUDED_VAULTS[chain][vaultAddresses[i].toLowerCase()] === true) { + continue; + } + vaultsCall.push(vaultAddresses[i]) + } } - // TetuV2 vaults + // * ############### Tetu V2 vaults let usdcsV2 = []; if (controllerV2) { const vaultsV2 = (await api.call({ abi: abi.vaultsList, target: controllerV2, })); usdcsV2 = await api.multiCall({ target: contract_Reader, abi: abi.vaultERC4626TvlUsdc, calls: vaultsV2, permitFailure: true, }) } - // veTETU + // * ############### veTETU let veTETU_USDC = 0; if (veTETU) { for (let i = 0; i < 100; i++) { @@ -88,6 +100,8 @@ Object.keys(config).forEach(chain => { } } + // * ############### TOTALS + let total = veTETU_USDC for (const vault of vaultsCall) { const usdcs = await api.call({ target: contract_Reader, abi: abi.totalTvlUsdc, params: [[vault]], }) From 7656152b8543727e7f8160dc17c24be0b1207f32 Mon Sep 17 00:00:00 2001 From: 1up8192 <1up8192@gmail.com> Date: Mon, 13 Nov 2023 09:16:41 +0100 Subject: [PATCH 1926/1974] Added addresses for new contract versions (#8036) --- projects/nftfi/index.js | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/projects/nftfi/index.js b/projects/nftfi/index.js index 503072f83de..e288ead1b7f 100644 --- a/projects/nftfi/index.js +++ b/projects/nftfi/index.js @@ -1,15 +1,31 @@ const { sumTokensExport, } = require('../helper/unwrapLPs'); // Vaults -const v2 = "0xf896527c49b44aAb3Cf22aE356Fa3AF8E331F280"; -const v2_1 = "0x8252Df1d8b29057d1Afe3062bf5a64D503152BC8"; -const offers_ADDR = "0xe52cec0e90115abeb3304baa36bc2655731f7934"; -const bundles = "0x16c583748faed1c5a5bcd744b4892ee6b6290094"; +const loan_offer_v2 = "0xf896527c49b44aAb3Cf22aE356Fa3AF8E331F280"; +const loan_offer_v2_1 = "0x8252Df1d8b29057d1Afe3062bf5a64D503152BC8"; +const loan_offer_v2_2 = "0xD0C6e59B50C32530C627107F50Acc71958C4341F"; + +const loan_collection_offer_v2_1 = "0xe52cec0e90115abeb3304baa36bc2655731f7934"; +const loan_collection_offer_v2_2 = "0xD0C6e59B50C32530C627107F50Acc71958C4341F"; + +const bundles_v1 = "0x16c583748faed1c5a5bcd744b4892ee6b6290094"; +const bundles_v1_1 = "0x0259119359Bf053ebF42C9807752de6bbb4925f3"; module.exports = { misrepresentedTokens: true, methodology: `Counts the floor value of all deposited NFTs with Chainlink price feeds. Borrowed coins are not counted towards the TVL`, ethereum: { - tvl: sumTokensExport({ owners: [v2, v2_1, offers_ADDR, bundles], resolveNFTs: true, }), - } -} + tvl: sumTokensExport({ + owners: [ + loan_offer_v2, + loan_offer_v2_1, + loan_offer_v2_2, + loan_collection_offer_v2_1, + loan_collection_offer_v2_2, + bundles_v1, + bundles_v1_1, + ], + resolveNFTs: true, + }), + }, +}; From 35b68e74845bacfab977aaafd33061d13a1c73ca Mon Sep 17 00:00:00 2001 From: mantasfam <45658645+mantasfam@users.noreply.github.com> Date: Mon, 13 Nov 2023 10:23:09 +0200 Subject: [PATCH 1927/1974] Get protocol integration (#8034) * Create index.js * Update index.js * Update index.js * minor fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/get-protocol/index.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 projects/get-protocol/index.js diff --git a/projects/get-protocol/index.js b/projects/get-protocol/index.js new file mode 100644 index 00000000000..1c1249b487d --- /dev/null +++ b/projects/get-protocol/index.js @@ -0,0 +1,17 @@ +const { staking } = require("../helper/staking"); + +const stakingContractEthereum = "0x3e49e9c890cd5b015a18ed76e7a4093f569f1a04"; +const getTokenAddressEthereum = "0x8a854288a5976036a725879164ca3e91d30c6a1b"; +const stakingContractPolygon = "0x3e49e9c890cd5b015a18ed76e7a4093f569f1a04"; +const getTokenAddressPolygon = "0xdb725f82818De83e99F1dAc22A9b5B51d3d04DD4"; + +module.exports = { + ethereum: { + tvl: () => ({}), + staking: staking(stakingContractEthereum, getTokenAddressEthereum), + }, + polygon: { + tvl: () => ({}), + staking: staking(stakingContractPolygon, getTokenAddressPolygon), + }, +}; From ca629811fabef58316192534716f6d71decdba85 Mon Sep 17 00:00:00 2001 From: 1up8192 <1up8192@gmail.com> Date: Mon, 13 Nov 2023 14:00:11 +0100 Subject: [PATCH 1928/1974] Fixed "Loan Offer v2.2" address (#8038) --- projects/nftfi/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/nftfi/index.js b/projects/nftfi/index.js index e288ead1b7f..89f4783e17e 100644 --- a/projects/nftfi/index.js +++ b/projects/nftfi/index.js @@ -3,7 +3,7 @@ const { sumTokensExport, } = require('../helper/unwrapLPs'); // Vaults const loan_offer_v2 = "0xf896527c49b44aAb3Cf22aE356Fa3AF8E331F280"; const loan_offer_v2_1 = "0x8252Df1d8b29057d1Afe3062bf5a64D503152BC8"; -const loan_offer_v2_2 = "0xD0C6e59B50C32530C627107F50Acc71958C4341F"; +const loan_offer_v2_2 = "0xd0a40eB7FD94eE97102BA8e9342243A2b2E22207"; const loan_collection_offer_v2_1 = "0xe52cec0e90115abeb3304baa36bc2655731f7934"; const loan_collection_offer_v2_2 = "0xD0C6e59B50C32530C627107F50Acc71958C4341F"; From d2dca92cfa1553326ecaa2e4335767faacb77c74 Mon Sep 17 00:00:00 2001 From: codehans <94654388+codehans@users.noreply.github.com> Date: Mon, 13 Nov 2023 13:02:22 +0000 Subject: [PATCH 1929/1974] Fix borrowed & optimise queries (#8043) --- projects/ghost/index.js | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/projects/ghost/index.js b/projects/ghost/index.js index b67d2f53f30..c0a777b067f 100644 --- a/projects/ghost/index.js +++ b/projects/ghost/index.js @@ -1,35 +1,30 @@ -const { - queryContracts, - queryContract, -} = require("../helper/chain/cosmos"); +const { queryContract } = require("../helper/chain/cosmos"); const { getConfig } = require("../helper/cache"); async function tvl(_, _1, _2, { api }) { const chain = api.chain const contracts = await getConfig("kujira/contracts", "https://raw.githubusercontent.com/Team-Kujira/kujira.js/master/src/resources/contracts.json"); - const vaultContracts = contracts["kaiyo-1"].ghostVault.map(x => x.address) - const marketContracts = contracts["kaiyo-1"].ghostMarket.map(x => x.address) + const vaultContracts = contracts["kaiyo-1"].ghostVault; + const marketContracts = contracts["kaiyo-1"].ghostMarket; for (const contract of vaultContracts) { - const { deposited, borrowed } = await queryContract({ contract, chain, data: { status: {} } }) - const { denom } = await queryContract({ contract, chain, data: { config: {} } }) - api.add(denom, deposited - borrowed) + const { deposited, borrowed } = await queryContract({ contract: contract.address, chain, data: { status: {} } }) + api.add(contract.config.denom, deposited - borrowed) } for (const contract of marketContracts) { - const { deposited } = await queryContract({ contract, chain, data: { status: {} } }) - const { collateral_denom } = await queryContract({ contract, chain, data: { config: {} } }) - api.add(collateral_denom, deposited) + const { deposited } = await queryContract({ contract: contract.address, chain, data: { status: {} } }) + api.add(contract.config.collateral_denom, deposited) } return api.getBalances() } async function borrowed(_, _1, _2, { api }) { + const contracts = await getConfig("kujira/contracts", "https://raw.githubusercontent.com/Team-Kujira/kujira.js/master/src/resources/contracts.json"); + const vaultContracts = contracts["kaiyo-1"].ghostVault; const chain = api.chain - const vaultContracts = await queryContracts({ chain, codeId: 106 }); for (const contract of vaultContracts) { - const { borrowed } = await queryContract({ contract, chain, data: { status: {} } }) - const { denom } = await queryContract({ contract, chain, data: { config: {} } }) - api.add(denom, borrowed) + const { borrowed } = await queryContract({ contract: contract.address, chain, data: { status: {} } }) + api.add(contract.config.denom, borrowed) } return api.getBalances() } From 671da51b0a35eb10df4e825844ac519737693258 Mon Sep 17 00:00:00 2001 From: Michael Semin Date: Mon, 13 Nov 2023 21:08:33 +0800 Subject: [PATCH 1930/1974] Update hallmarks for ReHold (#8040) --- projects/rehold-v2/index.js | 1 + projects/rehold/index.js | 1 + 2 files changed, 2 insertions(+) diff --git a/projects/rehold-v2/index.js b/projects/rehold-v2/index.js index 8522d8e9ccd..4564272eae4 100644 --- a/projects/rehold-v2/index.js +++ b/projects/rehold-v2/index.js @@ -17,5 +17,6 @@ module.exports = { [1688688480, "ReHold V2 Launch"], [1689743327, "Ethereum Deployment"], [1690898169, "Limit Orders Launch"], + [1698624000, "ReHold Swaps Launch"], ], }; diff --git a/projects/rehold/index.js b/projects/rehold/index.js index daef476289c..7d022de74bd 100644 --- a/projects/rehold/index.js +++ b/projects/rehold/index.js @@ -15,5 +15,6 @@ module.exports = { [1688688480, "ReHold V2 Launch"], [1689743327, "Ethereum Deployment"], [1690898169, "Limit Orders Launch"], + [1698624000, "ReHold Swaps Launch"], ], } From a37e2a72cd7d6e5ff6f25a79c36618d8559ab901 Mon Sep 17 00:00:00 2001 From: Samster91 <37342443+samster91@users.noreply.github.com> Date: Mon, 13 Nov 2023 14:09:02 +0100 Subject: [PATCH 1931/1974] Match lower case underlying mapping addresses (#8042) --- projects/idle/index.js | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/projects/idle/index.js b/projects/idle/index.js index 20f381d9541..6c07a27df2f 100644 --- a/projects/idle/index.js +++ b/projects/idle/index.js @@ -1,4 +1,4 @@ -const ADDRESSES = require('../helper/coreAssets.json') +const sdk = require('@defillama/sdk') const { sumTokens2 } = require('../helper/unwrapLPs') const { eulerTokens } = require('../helper/tokenMapping') const { getLogs } = require('../helper/cache/getLogs') @@ -60,13 +60,6 @@ const contracts = { } } -const underlyingMapping = { - [ADDRESSES.optimism.USDT]: ADDRESSES.ethereum.USDT, // USDT Optimism - [ADDRESSES.optimism.USDC]: ADDRESSES.ethereum.USDC, // USDC Optimism - '0x1E4a5963aBFD975d8c9021ce480b42188849D41d': ADDRESSES.ethereum.USDT, // USDT zkEVM - [ADDRESSES.polygon_zkevm.USDC]: ADDRESSES.ethereum.USDC // USDC zkEVM -} - const trancheConfig = { ethereum: { factory: '0x3c9916bb9498f637e2fa86c2028e26275dc9a631', @@ -147,8 +140,7 @@ async function tvl(time, ethBlock, chainBlocks, { api }) { } // Get CDOs underlying tokens balances - const mappedToken = underlyingMapping[token[i]] || token[i] - balances[mappedToken] = BigNumber(balances[mappedToken] || 0).plus(BigNumber(contractValue[i] || 0)) + sdk.util.sumSingleBalance(balances, token[i], contractValue[i], api.chain) }) } From 861fcd1e00f8015336d0842c06ba268ff90d45c9 Mon Sep 17 00:00:00 2001 From: 0xmDreamy <124707942+0xmDreamy@users.noreply.github.com> Date: Mon, 13 Nov 2023 15:21:49 +0100 Subject: [PATCH 1932/1974] fix(abracadabra): Update cauldrons and bentoboxes for various chains (#8039) --- projects/abracadabra/index.js | 43 ++++++++++++++++---------------- projects/abracadabra/market.json | 20 ++++++++++----- 2 files changed, 35 insertions(+), 28 deletions(-) diff --git a/projects/abracadabra/index.js b/projects/abracadabra/index.js index a00d9754f50..21886b1a5bb 100644 --- a/projects/abracadabra/index.js +++ b/projects/abracadabra/index.js @@ -8,27 +8,20 @@ const abi = require('./abi.json'); // on eth (~$169M tvl) // -------------------------- const bentoBoxAddresses = { - "ethereum": ["0xF5BCE5077908a1b7370B9ae04AdC565EBd643966", "0xd96f48665a1410C0cd669A88898ecA36B9Fc2cce"], "arbitrum": ["0x74c764D41B77DBbb4fe771daB1939B00b146894A", "0x7c8fef8ea9b1fe46a7689bfb8149341c90431d38"], "avax": ["0xf4F46382C2bE1603Dc817551Ff9A7b333Ed1D18f", "0x1fC83f75499b7620d53757f0b01E2ae626aAE530"], + "bsc": ["0x090185f2135308BaD17527004364eBcC2D37e5F6"], + "ethereum": ["0xF5BCE5077908a1b7370B9ae04AdC565EBd643966", "0xd96f48665a1410C0cd669A88898ecA36B9Fc2cce"], "fantom": ["0xF5BCE5077908a1b7370B9ae04AdC565EBd643966", "0x74A0BcA2eeEdf8883cb91E37e9ff49430f20a616"], + "kava": ["0x630fc1758de85c566bdec1d75a894794e1819d7e"], "optimism": ["0xa93c81f564579381116ee3e007c9fcfd2eba1723"], }; -async function ethTvl(timestamp, ethBlock, chainBlocks) { - return tvl(timestamp, chainBlocks, 'ethereum', addr => 'ethereum:'+addr); -} -async function ftmTvl(timestamp, ethBlock, chainBlocks) { - return tvl(timestamp, chainBlocks, 'fantom', addr => 'fantom:'+addr); -} -async function arbiTvl(timestamp, ethBlock, chainBlocks) { - return tvl(timestamp, chainBlocks, 'arbitrum', addr => 'arbitrum:'+addr); -} -async function avaxTvl(timestamp, ethBlock, chainBlocks) { - return tvl(timestamp, chainBlocks, 'avax', addr => 'avax:'+addr); -} -async function opTvl(timestamp, ethBlock, chainBlocks) { - return tvl(timestamp, chainBlocks, 'optimism', addr => 'optimism:'+addr); + +function chainTvl(chain, chainAddressIdentifier = chain) { + return (timestamp, ethBlock, chainBlocks) => + tvl(timestamp, chainBlocks, chain, addr => `${chainAddressIdentifier}:${addr}`); } + async function tvl(timestamp, chainBlocks, chain, transformAddress=addr=>addr) { let marketsArray = []; let balances = {}; @@ -61,19 +54,25 @@ async function tvl(timestamp, chainBlocks, chain, transformAddress=addr=>addr) { return balances; } module.exports = { - ethereum: { - tvl: ethTvl - }, arbitrum: { - tvl: arbiTvl + tvl: chainTvl('arbitrum') }, avax: { - tvl: avaxTvl + tvl: chainTvl('avax') + }, + bsc: { + tvl: chainTvl('bsc') + }, + ethereum: { + tvl: chainTvl('ethereum') }, fantom: { - tvl: ftmTvl + tvl: chainTvl('fantom') + }, + kava: { + tvl: chainTvl('kava') }, optimism:{ - tvl: opTvl + tvl: chainTvl('optimism') } } \ No newline at end of file diff --git a/projects/abracadabra/market.json b/projects/abracadabra/market.json index 38291438f1d..1d2921a761e 100644 --- a/projects/abracadabra/market.json +++ b/projects/abracadabra/market.json @@ -1,4 +1,9 @@ { + "arbitrum": { + "0x5698135CA439f21a57bDdbe8b582C62f090406D5": "0x3477Df28ce70Cecf61fFfa7a95be4BEC3B3c7e75", + "0x726413d7402fF180609d0EBc79506df8633701B1": "0x85667409a723684Fe1e57Dd1ABDe8D88C2f54214", + "0xC89958B03A55B5de2221aCB25B58B89A000215E6": "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1" + }, "avax": { "0x35fA7A723B3B39f15623Ff1Eb26D8701E7D6bB21": "0x0da67235dD5787D67955420C84ca1cEcd4E5Bb3b", "0x3b63f81Ad1fc724E44330b4cf5b5B6e355AD964B": "0x57319d41F71E81F3c65F2a47CA4e001EbAFd4F33", @@ -26,7 +31,6 @@ "0xc1879bf24917ebE531FbAA20b0D05Da027B592ce": "0x32353A6C91143bfd6C7d363B546e62a9A2489A20", "0x252dCf1B621Cc53bc22C256255d2bE5C8c32EaE4": "0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE", "0x05500e2ee779329698df35760bedcaac046e7c27": "0x4E15361FD6b4BB609Fa63C81A2be19d873717870", - "0x35a0Dd182E4bCa59d5931eae13D0A2332fA30321": "0xB65eDE134521F0EFD4E943c835F450137dC6E83e", "0x0bca8ebcb26502b013493bf8fe53aa2b1ed401c1": "0xdCD90C7f6324cfa40d7169ef80b12031770B4325", "0x390Db10e65b5ab920C19149C919D970ad9d18A41": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", "0x7Ce7D9ED62B9A6c5aCe1c6Ec9aeb115FA3064757": "0xdA816459F1AB5631232FE5e97a05BBBb94970c95", @@ -49,7 +53,12 @@ "0x59E9082E068Ddb27FC5eF1690F9a9f22B32e573f": "0xa47c8bf37f92aBed4A126BDA807A7b7498661acD", "0x806e16ec797c69afa8590a55723ce4cc1b54050e": "0xd92494CB921E5C0d3A39eA88d0147bbd82E51008", "0x3410297D89dCDAf4072B805EFc1ef701Bb3dd9BF": "0x26FA3fFFB6EfE8c1E69103aCb4044C26B9A106a9", - "0x6cbAFEE1FaB76cA5B5e144c43B3B50d42b7C8c8f": "0x5f18C75AbDAe578b483E5F43f12a39cF75b973a9" + "0x6cbAFEE1FaB76cA5B5e144c43B3B50d42b7C8c8f": "0x5f18C75AbDAe578b483E5F43f12a39cF75b973a9", + "0x7d8dF3E4D06B0e19960c19Ee673c0823BEB90815": "0xD533a949740bb3306d119CC777fa900bA034cd52", + "0x1062eb452f8c7a94276437ec1f4aaca9b1495b72": "0x38EA452219524Bb87e18dE1C24D3bB59510BD783", + "0x692887E8877C6Dd31593cda44c382DB5b289B684": "0xf35b31B941D94B249EaDED041DB1b05b7097fEb6", + "0x406b89138782851d3a8C04C743b010CEb0374352": "0xdCD90C7f6324cfa40d7169ef80b12031770B4325", + "0x85f60D3ea4E86Af43c9D4E9CC9095281fC25c405": "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599" }, "fantom": { "0xed745b045f9495b8bfc7b58eea8e0d0597884e12": "0x0DEC85e74A92c52b7F708c4B10207D9560CEFaf0", @@ -59,10 +68,9 @@ "0x8E45Af6743422e488aFAcDad842cE75A09eaEd34": "0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83", "0x7208d9F9398D7b02C5C22c334c2a7A3A98c0A45d": "0xB32b31DfAfbD53E310390F641C7119b5B9Ea0488" }, - "arbitrum": { - "0x5698135CA439f21a57bDdbe8b582C62f090406D5": "0x3477Df28ce70Cecf61fFfa7a95be4BEC3B3c7e75", - "0x726413d7402fF180609d0EBc79506df8633701B1": "0x85667409a723684Fe1e57Dd1ABDe8D88C2f54214", - "0xC89958B03A55B5de2221aCB25B58B89A000215E6": "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1" + "kava": { + "0x895731a0C3836a5534561268F15EBA377218651D": "0xaad094f6a75a14417d39f04e690fc216f080a41a", + "0x3CFf6F628Ebc88e167640966E67314Cf6466E6A8": "0x729d8855a1d21ab5f84db80e00759e7149936e30" }, "optimism": { "0x68f498C230015254AFF0E1EB6F85Da558dFf2362": "0x6eb1709e0b562097bf1cc48bc6a378446c297c04" From f26ae4775c3f4fed74a8b585dcd56f6887c86022 Mon Sep 17 00:00:00 2001 From: Santiago Baldassin <140439001+balda-rdx@users.noreply.github.com> Date: Mon, 13 Nov 2023 11:29:55 -0300 Subject: [PATCH 1933/1974] adding caviarnine products tvl (#8032) * Revert "adding CVR (#7784)" This reverts commit 7ecd727c593fffec8aeeb4f3d86dc66a8fad4085. * add caviarnine projects * update the url for the aggregator * remove the aggregator from tvl --- projects/caviarnine-lsu/index.js | 4 ++-- projects/caviarnine-orderbook/index.js | 13 +++++++++++++ projects/caviarnine-shapeliquidity/index.js | 13 +++++++++++++ projects/helper/chain/radixdlt.js | 2 +- 4 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 projects/caviarnine-orderbook/index.js create mode 100644 projects/caviarnine-shapeliquidity/index.js diff --git a/projects/caviarnine-lsu/index.js b/projects/caviarnine-lsu/index.js index 673a1f6691b..603ab6d06f5 100644 --- a/projects/caviarnine-lsu/index.js +++ b/projects/caviarnine-lsu/index.js @@ -1,9 +1,9 @@ const { get } = require('../helper/http') async function tvl(_, _b, _cb, { api, }) { - const { composition } = await get('https://api-core.caviarnine.com/v1.0/lsupool/get_details') + const { summary } = await get('https://api-core.caviarnine.com/v1.0/stats/product/lsupool') return { - 'radix': composition.reduce((acc, i) => acc + i.amount_in_lsu/1e18 * +i.price_lsu_to_xrd, 0) + 'radix': summary.total_value_locked.xrd } } diff --git a/projects/caviarnine-orderbook/index.js b/projects/caviarnine-orderbook/index.js new file mode 100644 index 00000000000..309452ead68 --- /dev/null +++ b/projects/caviarnine-orderbook/index.js @@ -0,0 +1,13 @@ +const { get } = require('../helper/http') + +async function tvl(_, _b, _cb, { api, }) { + const { summary } = await get('https://api-core.caviarnine.com/v1.0/stats/product/orderbook') + return { + 'radix': summary.total_value_locked.xrd + } +} + +module.exports = { + timetravel: false, + radixdlt: { tvl } +} \ No newline at end of file diff --git a/projects/caviarnine-shapeliquidity/index.js b/projects/caviarnine-shapeliquidity/index.js new file mode 100644 index 00000000000..7eeaa011035 --- /dev/null +++ b/projects/caviarnine-shapeliquidity/index.js @@ -0,0 +1,13 @@ +const { get } = require('../helper/http') + +async function tvl(_, _b, _cb, { api, }) { + const { summary } = await get('https://api-core.caviarnine.com/v1.0/stats/product/shapeliquidity') + return { + 'radix': summary.total_value_locked.xrd + } +} + +module.exports = { + timetravel: false, + radixdlt: { tvl } +} \ No newline at end of file diff --git a/projects/helper/chain/radixdlt.js b/projects/helper/chain/radixdlt.js index 2d971db65fb..ecb03135849 100644 --- a/projects/helper/chain/radixdlt.js +++ b/projects/helper/chain/radixdlt.js @@ -45,4 +45,4 @@ module.exports = { queryAddresses, sumTokens, sumTokensExport, -} \ No newline at end of file +} From bf6fb2fddf7aa7d085c17ca91d05e33f0f08b595 Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Mon, 13 Nov 2023 15:02:21 +0000 Subject: [PATCH 1934/1974] arbitrum bridge --- projects/arbitrum/index.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 projects/arbitrum/index.js diff --git a/projects/arbitrum/index.js b/projects/arbitrum/index.js new file mode 100644 index 00000000000..59d87c418e5 --- /dev/null +++ b/projects/arbitrum/index.js @@ -0,0 +1,16 @@ +const { sumTokens2 } = require("../helper/unwrapLPs"); + +module.exports = { + ethereum: { + tvl: (_, _b, _c, { api, logArray }) => + sumTokens2({ + api, + owners: [ + "0xa3A7B6F88361F48403514059F1F16C8E78d60EeC", + "0x8315177aB297bA92A06054cE80a67Ed4DBd7ed3a", + "0xcEe284F754E854890e311e3280b767F80797180d", + ], + fetchCoValentTokens: true, + }), + }, +}; From d749f4ca7f9e1b05d0d6b0440e6645227f9f17c8 Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Mon, 13 Nov 2023 15:08:25 +0000 Subject: [PATCH 1935/1974] zksync --- projects/txBridge/index.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 projects/txBridge/index.js diff --git a/projects/txBridge/index.js b/projects/txBridge/index.js new file mode 100644 index 00000000000..c66f27e3ee1 --- /dev/null +++ b/projects/txBridge/index.js @@ -0,0 +1,15 @@ +const { sumTokens2 } = require("../helper/unwrapLPs"); + +module.exports = { + ethereum: { + tvl: (_, _b, _c, { api, logArray }) => + sumTokens2({ + api, + owners: [ + "0x32400084C286CF3E17e7B677ea9583e60a000324", + "0x57891966931Eb4Bb6FB81430E6cE0A03AAbDe063", + ], + fetchCoValentTokens: true, + }), + }, +}; From 84669e931ecbb8675a473724ab6bceb09a207817 Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Mon, 13 Nov 2023 15:08:31 +0000 Subject: [PATCH 1936/1974] avax --- projects/avax/index.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 projects/avax/index.js diff --git a/projects/avax/index.js b/projects/avax/index.js new file mode 100644 index 00000000000..4c5f69ed4db --- /dev/null +++ b/projects/avax/index.js @@ -0,0 +1,12 @@ +const { sumTokens2 } = require("../helper/unwrapLPs"); + +module.exports = { + ethereum: { + tvl: (_, _b, _c, { api, logArray }) => + sumTokens2({ + api, + owner: "0x8EB8a3b98659Cce290402893d0123abb75E3ab28", + fetchCoValentTokens: true, + }), + }, +}; // node test.js projects/avax/index.js From 1590a4b8039c1c99932619b4335b8f5260f6059e Mon Sep 17 00:00:00 2001 From: DonDuala <107803907+DonDuala@users.noreply.github.com> Date: Mon, 13 Nov 2023 10:24:46 -0500 Subject: [PATCH 1937/1974] Add DUAL as Staking (#8044) * Add DUAL as Staking * Include within Solana * async staking --- projects/dual/index.js | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/projects/dual/index.js b/projects/dual/index.js index 6135f2a7435..f57d5a11cd2 100644 --- a/projects/dual/index.js +++ b/projects/dual/index.js @@ -44,6 +44,46 @@ async function tvl() { return sumTokens2({ tokenAccounts, allowError: true, blacklistedTokens: [DUAL]}) } +async function staking() { + const connection = getConnection(); + const dualProgramID = new PublicKey("DiPbvUUJkDhV9jFtQsDFnMEMRJyjW5iS6NMwoySiW8ki"); + let programAccounts = await connection.getProgramAccounts(dualProgramID, { + filters: [{ + dataSize: 260 + }] + }); + + const dipTokenAccounts = programAccounts + .map(i => parseDipState(i.account.data)) + .map(i => [i.vaultSpl, i.vaultUsdc]) + .flat() + + const stakingOptionsProgramID = new PublicKey("4yx1NJ4Vqf2zT1oVLk4SySBhhDJXmXFt88ncm4gPxtL7"); + let stakingOptionsAccounts = await connection.getProgramAccounts(stakingOptionsProgramID, { + filters: [{ + dataSize: 1150 + }] + }); + + const soTokenAccounts = stakingOptionsAccounts + .map(i => parseSoState(i.account.data)) + .map(i => [i.vault, i.reverseVault]) + .flat() + + const gsoProgramID = new PublicKey("DuALd6fooWzVDkaTsQzDAxPGYCnLrnWamdNNTNxicdX8"); + let gsoAccounts = await connection.getProgramAccounts(gsoProgramID, { + filters: [{ + dataSize: 1000 + }] + }); + const gsoTokenAccounts = gsoAccounts + .map(i => gsoVault(i.pubkey)) + + const tokenAccounts = dipTokenAccounts.concat(soTokenAccounts).concat(gsoTokenAccounts); + + return sumTokens2({ tokenAccounts, allowError: true, }) +} + function parseDipState(buf) { const strike = Number(readBigUInt64LE(buf, 8)); const expiration = Number(readBigUInt64LE(buf, 16)); @@ -122,5 +162,6 @@ module.exports = { timetravel: false, solana: { tvl, + staking, }, }; From d98f36fb0131d5a3a1f7a1b0d08a1d03109b2b4a Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Mon, 13 Nov 2023 16:07:25 +0000 Subject: [PATCH 1938/1974] nova --- projects/arbitrumNova/index.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 projects/arbitrumNova/index.js diff --git a/projects/arbitrumNova/index.js b/projects/arbitrumNova/index.js new file mode 100644 index 00000000000..3ab80d1388c --- /dev/null +++ b/projects/arbitrumNova/index.js @@ -0,0 +1,16 @@ +const { sumTokens2 } = require("../helper/unwrapLPs"); + +module.exports = { + ethereum: { + tvl: (_, _b, _c, { api, logArray }) => + sumTokens2({ + api, + owners: [ + "0xC1Ebd02f738644983b6C4B2d440b8e77DdE276Bd", + "0x23122da8C581AA7E0d07A36Ff1f16F799650232f", + "0xB2535b988dcE19f9D71dfB22dB6da744aCac21bf", + ], + fetchCoValentTokens: true, + }), + }, +}; From 30acd19c5794645bad2c43c24e14b5d2da444cfb Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Mon, 13 Nov 2023 16:07:35 +0000 Subject: [PATCH 1939/1974] base --- projects/avax/index.js | 2 +- projects/base/index.js | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 projects/base/index.js diff --git a/projects/avax/index.js b/projects/avax/index.js index 4c5f69ed4db..06503fb0917 100644 --- a/projects/avax/index.js +++ b/projects/avax/index.js @@ -9,4 +9,4 @@ module.exports = { fetchCoValentTokens: true, }), }, -}; // node test.js projects/avax/index.js +}; diff --git a/projects/base/index.js b/projects/base/index.js new file mode 100644 index 00000000000..9c5cd450873 --- /dev/null +++ b/projects/base/index.js @@ -0,0 +1,15 @@ +const { sumTokens2 } = require("../helper/unwrapLPs"); + +module.exports = { + ethereum: { + tvl: (_, _b, _c, { api, logArray }) => + sumTokens2({ + api, + owners: [ + "0x3154Cf16ccdb4C6d922629664174b904d80F2C35", + "0x49048044D57e1C92A77f79988d21Fa8fAF74E97e", + ], + fetchCoValentTokens: true, + }), + }, +}; From b955c37fc35552542676f2c5e9adc72ddf8cce9a Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Mon, 13 Nov 2023 16:07:45 +0000 Subject: [PATCH 1940/1974] linea --- projects/linea/index.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 projects/linea/index.js diff --git a/projects/linea/index.js b/projects/linea/index.js new file mode 100644 index 00000000000..ffa8289201f --- /dev/null +++ b/projects/linea/index.js @@ -0,0 +1,15 @@ +const { sumTokens2 } = require("../helper/unwrapLPs"); + +module.exports = { + ethereum: { + tvl: (_, _b, _c, { api, logArray }) => + sumTokens2({ + api, + owners: [ + "0xd19d4B5d358258f05D7B411E21A1460D11B0876F", + "0x051F1D88f0aF5763fB888eC4378b4D8B29ea3319", + ], + fetchCoValentTokens: true, + }), + }, +}; From 490c4e89e77c7578ebc48ae45b9a41f232c251b9 Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Mon, 13 Nov 2023 16:07:51 +0000 Subject: [PATCH 1941/1974] metis --- projects/metis/index.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 projects/metis/index.js diff --git a/projects/metis/index.js b/projects/metis/index.js new file mode 100644 index 00000000000..9e43dd432ce --- /dev/null +++ b/projects/metis/index.js @@ -0,0 +1,12 @@ +const { sumTokens2 } = require("../helper/unwrapLPs"); + +module.exports = { + ethereum: { + tvl: (_, _b, _c, { api, logArray }) => + sumTokens2({ + api, + owner: "0x3980c9ed79d2c191A89E02Fa3529C60eD6e9c04b", + fetchCoValentTokens: true, + }), + }, +}; From 1cc05869ce8c22ca134c1a885771339d4f28dbe8 Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Mon, 13 Nov 2023 16:07:58 +0000 Subject: [PATCH 1942/1974] scroll --- projects/scroll/index.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 projects/scroll/index.js diff --git a/projects/scroll/index.js b/projects/scroll/index.js new file mode 100644 index 00000000000..8604f8b3a5f --- /dev/null +++ b/projects/scroll/index.js @@ -0,0 +1,19 @@ +const { sumTokens2 } = require("../helper/unwrapLPs"); + +module.exports = { + ethereum: { + tvl: (_, _b, _c, { api, logArray }) => + sumTokens2({ + api, + owners: [ + "0xD8A791fE2bE73eb6E6cF1eb0cb3F36adC9B3F8f9", + "0xb2b10a289A229415a124EFDeF310C10cb004B6ff", + "0x7F2b8C31F88B6006c382775eea88297Ec1e3E905", + "0x6774Bcbd5ceCeF1336b5300fb5186a12DDD8b367", + "0xb94f7F6ABcb811c5Ac709dE14E37590fcCd975B6", + "0x6260aF48e8948617b8FA17F4e5CEa2d21D21554B", + ], + fetchCoValentTokens: true, + }), + }, +}; From 09065433249922461c1efda3863a90b985e5e967 Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Mon, 13 Nov 2023 16:20:13 +0000 Subject: [PATCH 1943/1974] starknet --- projects/starknet/index.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 projects/starknet/index.js diff --git a/projects/starknet/index.js b/projects/starknet/index.js new file mode 100644 index 00000000000..385fecb8b1e --- /dev/null +++ b/projects/starknet/index.js @@ -0,0 +1,24 @@ +const { sumTokens2 } = require("../helper/unwrapLPs"); +const axios = require("axios"); + +async function tvl(_, _b, _c, { api, logArray }) { + const mapping = await axios.get( + `https://raw.githubusercontent.com/starknet-io/starknet-addresses/master/bridged_tokens/mainnet.json` + ); + const tokensAndOwners = mapping.data.map((t) => [ + t.l1_token_address == "0x0000000000000000000000000000000000455448" + ? "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee" + : t.l1_token_address, + t.l1_bridge_address, + ]); + return sumTokens2({ + api, + tokensAndOwners, + }); +} + +module.exports = { + ethereum: { + tvl, + }, +}; From 6be1ae9a27049d11b6bd1abead7c030fc55130d7 Mon Sep 17 00:00:00 2001 From: B2B Money <148764962+b2b-money-org@users.noreply.github.com> Date: Mon, 13 Nov 2023 10:29:23 -0600 Subject: [PATCH 1944/1974] update B2B TVL func and category (#8030) * feat: add back-to-bitcoin project * minor refactor * feat: update project info * feat: update back-to-bitcoin tvl func * code refactor * staking -> pool2 --------- Co-authored-by: b2bmoney Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/back-to-bitcoin/index.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/projects/back-to-bitcoin/index.js b/projects/back-to-bitcoin/index.js index 97a8b3a6157..6fe282c4f27 100644 --- a/projects/back-to-bitcoin/index.js +++ b/projects/back-to-bitcoin/index.js @@ -1,11 +1,15 @@ -const { sumTokensExport } = require('../helper/unwrapLPs') + const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require("../helper/unwrapLPs"); -const contract = "0x1EE28d16C380B2137E63EBf92a9F5B42e63E9500" +const btcbStakingContract1 = "0x1EE28d16C380B2137E63EBf92a9F5B42e63E9500" +const btcbStakingContract2 = "0xa253D8BB6Ed85CE1F8FA646794E5681F30542aC9" +const b2bLpStakingContract = "0xB9922b10F86f92208ff7E6c4708D4f7C20CbFEb0" +const b2bLpAddress = "0xfa9B1a0a0851b951eA1D6a2DA2CB6E4025db643b" module.exports = { - methodology: `We count the BTCB on ${contract}`, bsc: { - tvl: sumTokensExport({ owner: contract, tokens: [ADDRESSES.bsc.BTCB]}), + tvl: sumTokensExport({ owners: [btcbStakingContract1, btcbStakingContract2,], tokens: [ADDRESSES.bsc.BTCB,] }), + pool2: sumTokensExport({ owners: [b2bLpStakingContract,], tokens: [b2bLpAddress], resolveLP: true, }), } } From 8b3a7bf8e1b8cbc75a88a04eaeb1c8fd6661f5cb Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Mon, 13 Nov 2023 17:10:00 +0000 Subject: [PATCH 1945/1974] optimism --- projects/optimism/index.js | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 projects/optimism/index.js diff --git a/projects/optimism/index.js b/projects/optimism/index.js new file mode 100644 index 00000000000..960fa277297 --- /dev/null +++ b/projects/optimism/index.js @@ -0,0 +1,35 @@ +const { sumTokens2 } = require("../helper/unwrapLPs"); +const axios = require("axios"); + +const chains = { + ethereum: 1, + // optimism: 10, + base: 8453, + pgn: 424, +}; +let output = {}; +let res = axios.get("https://static.optimism.io/optimism.tokenlist.json"); + +Object.keys(chains).map((chain) => { + output[chain] = { + tvl: async (_, _b, _cb, { api }) => { + if (!res.data || !res.data.tokens) res = await res; + const tokenData = res.data.tokens.filter( + (t) => t.chainId == chains[chain] + ); + + const tokens = tokenData.map((t) => t.address); + const owners = [ + ...new Set(tokenData.map((t) => t.extensions.optimismBridgeAddress)), + ].filter((o) => o); + + return sumTokens2({ + api, + tokens, + owners, + }); + }, + }; +}); + +module.exports = output; From 9a02667c62cb1d889bdc677402d7e710fb5110f1 Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Mon, 13 Nov 2023 17:22:30 +0000 Subject: [PATCH 1946/1974] mantle --- projects/mantle/index.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 projects/mantle/index.js diff --git a/projects/mantle/index.js b/projects/mantle/index.js new file mode 100644 index 00000000000..4c7239ecf67 --- /dev/null +++ b/projects/mantle/index.js @@ -0,0 +1,12 @@ +const { sumTokens2 } = require("../helper/unwrapLPs"); + +module.exports = { + ethereum: { + tvl: (_, _b, _c, { api, logArray }) => + sumTokens2({ + api, + owner: "0x95fC37A27a2f68e3A647CDc081F0A89bb47c3012", + fetchCoValentTokens: true, + }), + }, +}; From a9b1d06e8849b5145916e9dd966373e5a37ab1dd Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Mon, 13 Nov 2023 17:23:36 +0000 Subject: [PATCH 1947/1974] polygon zkevm --- projects/polygonZk/index.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 projects/polygonZk/index.js diff --git a/projects/polygonZk/index.js b/projects/polygonZk/index.js new file mode 100644 index 00000000000..d85cc4d4bfc --- /dev/null +++ b/projects/polygonZk/index.js @@ -0,0 +1,12 @@ +const { sumTokens2 } = require("../helper/unwrapLPs"); + +module.exports = { + ethereum: { + tvl: (_, _b, _c, { api, logArray }) => + sumTokens2({ + api, + owner: "0x2a3DD3EB832aF982ec71669E178424b10Dca2EDe", + fetchCoValentTokens: true, + }), + }, +}; From 5e5da7509ee478ebb0c5d10c233a0267523a736d Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Mon, 13 Nov 2023 17:35:18 +0000 Subject: [PATCH 1948/1974] optimism fetch covalent --- projects/optimism/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/optimism/index.js b/projects/optimism/index.js index 960fa277297..097a963ede4 100644 --- a/projects/optimism/index.js +++ b/projects/optimism/index.js @@ -27,6 +27,7 @@ Object.keys(chains).map((chain) => { api, tokens, owners, + fetchCoValentTokens: true, }); }, }; From b2a83f4c9c99686b9fcc586d9f32c6a104b89409 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 13 Nov 2023 18:53:58 +0100 Subject: [PATCH 1949/1974] fix uniswap --- projects/uniswap/index.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/projects/uniswap/index.js b/projects/uniswap/index.js index 3ad50757f6c..6855879a491 100644 --- a/projects/uniswap/index.js +++ b/projects/uniswap/index.js @@ -1,5 +1,6 @@ const { uniV3Export } = require('../helper/uniswapV3') const { cachedGraphQuery } = require('../helper/cache') +const { sumTokens2 } = require('../helper/unwrapLPs') const graphs = { ethereum: "https://api.thegraph.com/subgraphs/name/uniswap/uniswap-v3", @@ -13,6 +14,7 @@ const graphs = { } const blacklists = { + base: ['0xb17d69c91135516b0256c67e8bd32cd238b56161'], ethereum: ['0xa850478adaace4c08fc61de44d8cf3b64f359bec', '0x055284a4ca6532ecc219ac06b577d540c686669d', '0x8c0411f2ad5470a66cb2e9c64536cfb8dcd54d51', '0x277667eb3e34f134adf870be9550e9f323d0dc24', '0x4c83a7f819a5c37d64b4c5a2f8238ea082fa1f4e', '0x290a6a7460b308ee3f19023d2d00de604bcf5b42', '0x4b5ab61593a2401b1075b90c04cbcdd3f87ce011', '0x582d23c7ec6b59afd041a522ff64ff081e8c0d2d', '0x1f98431c8ad98523631ae4a59f267346ea31f984', '0xaf44e10ed87d90f28bff2d1fbef1f64b090f5ebb', '0xdfef6416ea3e6ce587ed42aa7cb2e586362cbbfa', '0x7e9c15c43f0d6c4a12e6bdff7c7d55d0f80e3e23'], arbitrum: ['0xd4d2f4110878a33ea5b97f0665e518253446161a', '0xB50721BCf8d664c30412Cfbc6cf7a15145234ad1',], polygon: ['0x8d52c2d70a7c28a9daac2ff12ad9bfbf041cd318', '0x1f98431c8ad98523631ae4a59f267346ea31f984', '0xd5302a8ead77b85ea3326b45f4714e0b3432b233', '0xc951ab482ff11d8df636742e1f1c3fc8037427a9',], @@ -33,11 +35,10 @@ function v3TvlPaged(chain) { ` const pools = await cachedGraphQuery('uniswap-v3/' + api.chain, graphs[chain], graphQueryPaged, { variables: { block: block - 500 }, fetchById: true }) - const blacklisted = blacklists[chain] || [] + const blacklistedTokens = blacklists[chain] || [] const tokensAndOwners = pools.map(i => ([[i.token0.id, i.id], [i.token1.id, i.id]])).flat() - return api.sumTokens({ tokensAndOwners, blacklistedTokens: blacklisted }) - + return sumTokens2({ api, tokensAndOwners, blacklistedTokens }) } } @@ -54,7 +55,7 @@ module.exports = { [1620156420, "UNI V3 Launch"] ], ...uniV3Export({ - base: { factory: '0x33128a8fc17869897dce68ed026d694621f6fdfd', fromBlock: 1371680, }, + base: { factory: '0x33128a8fc17869897dce68ed026d694621f6fdfd', fromBlock: 1371680, blacklistedTokens: blacklists.base }, celo: { factory: '0xAfE208a311B21f13EF87E33A90049fC17A7acDEc', fromBlock: 13916355, }, moonbeam: { factory: '0x28f1158795a3585caaa3cd6469cd65382b89bb70', fromBlock: 4313505 }, era: { factory: '0x8FdA5a7a8dCA67BBcDd10F02Fa0649A937215422', fromBlock: 12637080 } From a0978141eb0dbaeed952ca33c8f48027e2b4816e Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Mon, 13 Nov 2023 18:27:53 +0000 Subject: [PATCH 1950/1974] more contracts --- projects/arbitrum/index.js | 1 + projects/avax/index.js | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/projects/arbitrum/index.js b/projects/arbitrum/index.js index 59d87c418e5..84429fd0535 100644 --- a/projects/arbitrum/index.js +++ b/projects/arbitrum/index.js @@ -9,6 +9,7 @@ module.exports = { "0xa3A7B6F88361F48403514059F1F16C8E78d60EeC", "0x8315177aB297bA92A06054cE80a67Ed4DBd7ed3a", "0xcEe284F754E854890e311e3280b767F80797180d", + "0xA10c7CE4b876998858b1a9E12b10092229539400", ], fetchCoValentTokens: true, }), diff --git a/projects/avax/index.js b/projects/avax/index.js index 06503fb0917..d7defb06993 100644 --- a/projects/avax/index.js +++ b/projects/avax/index.js @@ -1,3 +1,4 @@ +const { call } = require("@defillama/sdk/build/abi/abi2"); const { sumTokens2 } = require("../helper/unwrapLPs"); module.exports = { @@ -9,4 +10,16 @@ module.exports = { fetchCoValentTokens: true, }), }, + bitcoin: { + tvl: async (_, _b, chainBlocks, { logArray }) => ({ + bitcoin: + (await call({ + chain: "avax", + abi: "erc20:totalSupply", + target: "0x152b9d0FdC40C096757F570A51E494bd4b943E50", + block: chainBlocks.avax, + })) / + 10 ** 8, + }), + }, }; From e357b87c47698e16f799a2eb39f606151877a070 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 13 Nov 2023 19:28:16 +0100 Subject: [PATCH 1951/1974] hotfix: deltaprime --- projects/deltaprime/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/deltaprime/index.js b/projects/deltaprime/index.js index 66e77e1c594..1e0bcecb71e 100644 --- a/projects/deltaprime/index.js +++ b/projects/deltaprime/index.js @@ -100,6 +100,7 @@ async function tvlArbitrum(timestamp, block, chainBlocks, { api }) { ownedAssets[i].forEach(tokenStr => { tokenStr = ethers.utils.parseBytes32String(tokenStr) const token = assetToAddressMappingArbitrum[tokenStr] + if (!token) return; if (!token) throw new Error('Missing asset mapping for: ' + tokenStr) tokensAndOwners.push([token, o]) }) From cefc2e5d8959a04607cd5e5a2cc1caef586ac48c Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 13 Nov 2023 19:32:32 +0100 Subject: [PATCH 1952/1974] track elektrik.network --- package-lock.json | 12 ++++++------ projects/elektrik/index.js | 21 +++++++++++++++++++++ projects/helper/chains.json | 1 + projects/helper/coreAssets.json | 6 ++++++ projects/helper/tokenMapping.js | 7 +++++++ 5 files changed, 41 insertions(+), 6 deletions(-) create mode 100644 projects/elektrik/index.js diff --git a/package-lock.json b/package-lock.json index d3e0e106039..c8352ef1372 100644 --- a/package-lock.json +++ b/package-lock.json @@ -787,9 +787,9 @@ } }, "node_modules/@defillama/sdk": { - "version": "4.0.67", - "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.67.tgz", - "integrity": "sha512-grcgUk0+ccHvxlUXcNPCBUGqjnqhqSCkxEjfCOoLPDEgYcoZytmbOJ98XJB17Un3cu4zV9Bf5hTfprjUX8lnOQ==", + "version": "4.0.68", + "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.68.tgz", + "integrity": "sha512-jRxZxpLJVMdxjA3VRBy1+ATn6rXQDB8QKsXsgZyXtpKoUFR3SOBUaEiLh6QdqmSrb6KtCtDJ043MHxYx3EXHDg==", "dependencies": { "@aws-sdk/client-s3": "^3.400.0", "@supercharge/promise-pool": "^2.1.0", @@ -5917,9 +5917,9 @@ } }, "@defillama/sdk": { - "version": "4.0.67", - "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.67.tgz", - "integrity": "sha512-grcgUk0+ccHvxlUXcNPCBUGqjnqhqSCkxEjfCOoLPDEgYcoZytmbOJ98XJB17Un3cu4zV9Bf5hTfprjUX8lnOQ==", + "version": "4.0.68", + "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-4.0.68.tgz", + "integrity": "sha512-jRxZxpLJVMdxjA3VRBy1+ATn6rXQDB8QKsXsgZyXtpKoUFR3SOBUaEiLh6QdqmSrb6KtCtDJ043MHxYx3EXHDg==", "requires": { "@aws-sdk/client-s3": "^3.400.0", "@supercharge/promise-pool": "^2.1.0", diff --git a/projects/elektrik/index.js b/projects/elektrik/index.js new file mode 100644 index 00000000000..3a92a6946f3 --- /dev/null +++ b/projects/elektrik/index.js @@ -0,0 +1,21 @@ +const { sumTokens2 } = require('../helper/unwrapLPs') +const { cachedGraphQuery } = require('../helper/cache') + +const query = `{ + pools { + id + token0 { id } + token1 { id } + } +}` + +async function tvl(_, _b, _cb, { api, }) { + const { pools } = await cachedGraphQuery('elektrik', 'https://subgraph.elektrik.network/subgraphs/name/ELEKTRIK-GRAPH', query) + const ownerTokens = pools.map(i => [[i.token0.id, i.token1.id], i.id]) + return sumTokens2({ api, ownerTokens, }) +} + + +module.exports = { + lightlink_phoenix: { tvl } +} diff --git a/projects/helper/chains.json b/projects/helper/chains.json index 9c9a90aecbc..cccbaa8300c 100644 --- a/projects/helper/chains.json +++ b/projects/helper/chains.json @@ -122,6 +122,7 @@ "lamden", "lbry", "libre", + "lightlink_phoenix", "linea", "liquidchain", "litecoin", diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index 01aa0d49140..7f326e6d950 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -1481,5 +1481,11 @@ }, "eon": { "WETH": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2" + }, + "lightlink_phoenix": { + "WETH": "0x7ebef2a4b1b09381ec5b9df8c5c6f2dbeca59c73", + "USDC": "0x18fb38404dadee1727be4b805c5b242b5413fa40", + "USDT": "0x6308fa9545126237158778e74ae1b6b89022c5c0", + "WBTC": "0x46a5e3fa4a02b9ae43d9df9408c86ed643144a67" } } diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 2bdf327cd7e..dbaf24209e0 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -36,6 +36,13 @@ const transformTokens = { // "0x065de42e28e42d90c2052a1b49e7f83806af0e1f": "0x123", // CRK token is mispriced // [ADDRESSES.cronos.TUSD]: ADDRESSES.ethereum.TUSD, // }, + + lightlink_phoenix: { + [ADDRESSES.lightlink_phoenix.USDC]: ADDRESSES.ethereum.USDC, + [ADDRESSES.lightlink_phoenix.USDT]: ADDRESSES.ethereum.USDT, + [ADDRESSES.lightlink_phoenix.WBTC]: ADDRESSES.ethereum.WBTC, + [ADDRESSES.lightlink_phoenix.WETH]: ADDRESSES.ethereum.WETH, + } } const ibcMappings = { // Sample Code From 0381f1eda73b62e5b8adee78484eaee7239d43e2 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 13 Nov 2023 19:47:30 +0100 Subject: [PATCH 1953/1974] liquid: add custom logic for DAI --- projects/liqwid/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/projects/liqwid/index.js b/projects/liqwid/index.js index 8400c0c08a1..7ace150baf6 100644 --- a/projects/liqwid/index.js +++ b/projects/liqwid/index.js @@ -61,6 +61,7 @@ const tokenMapping = { DJED: '8db269c3ec630e06ae29f74bc39edd1f87c819f1056206e879a1cd61446a65644d6963726f555344', SHEN: '8db269c3ec630e06ae29f74bc39edd1f87c819f1056206e879a1cd615368656e4d6963726f555344', USDC: 'usd-coin', + DAI: 'dai', USDT: 'tether', } @@ -80,8 +81,11 @@ function add(api, market, bal) { "usd-coin", "tether", ].includes(token)) bal /= 1e8 + if ([ + "dai", + ].includes(token)) bal /= 1e6 api.add(token, bal, { - skipChain: token === 'usd-coin' || token === 'tether' + skipChain: ['usd-coin', 'tether', 'dai'].includes(token) }) } From 3015f9b81c7db47c17bb3f6f4acc16d674327f44 Mon Sep 17 00:00:00 2001 From: chimeradex <149467334+chimeradex@users.noreply.github.com> Date: Tue, 14 Nov 2023 03:53:31 +0800 Subject: [PATCH 1954/1974] Add Chimeradex (#8046) * Create index.js * Create index.js * minor fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/chimeradex-lend/index.js | 10 ++++++++++ projects/chimeradex/index.js | 12 ++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 projects/chimeradex-lend/index.js create mode 100644 projects/chimeradex/index.js diff --git a/projects/chimeradex-lend/index.js b/projects/chimeradex-lend/index.js new file mode 100644 index 00000000000..b2415bc1cd6 --- /dev/null +++ b/projects/chimeradex-lend/index.js @@ -0,0 +1,10 @@ +const { compoundExports2 } = require('../helper/compound') + +const config = { + scroll: '0x05C7A68321a43C9FB3eaC6D8E852831a48C4B273', + arbitrum: '0xBDa8C17aa00854f401057ec7d796577a8ae96aDE' +} + +Object.keys(config).forEach(chain => { + module.exports[chain] = compoundExports2({ comptroller: config[chain]}) +}) diff --git a/projects/chimeradex/index.js b/projects/chimeradex/index.js new file mode 100644 index 00000000000..63181160ec6 --- /dev/null +++ b/projects/chimeradex/index.js @@ -0,0 +1,12 @@ +const { getUniTVL } = require('../helper/unknownTokens'); +const tvl = getUniTVL({ + fetchBalances: true, + useDefaultCoreAssets: true, + factory: '0x661B92cc18a8d73209dBa1394aE56fca2F9DDb4D', +}) + +module.exports = { + misrepresentedTokens: true, + scroll: { tvl, }, + arbitrum: { tvl, }, +}; From 5c5651fd5f354ca3419075a61a3e192c224e83d9 Mon Sep 17 00:00:00 2001 From: 0xmDreamy <124707942+0xmDreamy@users.noreply.github.com> Date: Mon, 13 Nov 2023 20:54:07 +0100 Subject: [PATCH 1955/1974] fix(abracadabra): Fix TVL on chains with multiple bentoboxes (#8045) * fix(abracadabra): Fix TVL on chains with multiple bentoboxes * minor refactor --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/abracadabra/index.js | 86 ++++++++++------------------------- 1 file changed, 23 insertions(+), 63 deletions(-) diff --git a/projects/abracadabra/index.js b/projects/abracadabra/index.js index 21886b1a5bb..fea513940af 100644 --- a/projects/abracadabra/index.js +++ b/projects/abracadabra/index.js @@ -1,4 +1,3 @@ -const sdk = require('@defillama/sdk'); const marketsJSON = require('./market.json'); const abi = require('./abi.json'); @@ -8,71 +7,32 @@ const abi = require('./abi.json'); // on eth (~$169M tvl) // -------------------------- const bentoBoxAddresses = { - "arbitrum": ["0x74c764D41B77DBbb4fe771daB1939B00b146894A", "0x7c8fef8ea9b1fe46a7689bfb8149341c90431d38"], - "avax": ["0xf4F46382C2bE1603Dc817551Ff9A7b333Ed1D18f", "0x1fC83f75499b7620d53757f0b01E2ae626aAE530"], - "bsc": ["0x090185f2135308BaD17527004364eBcC2D37e5F6"], - "ethereum": ["0xF5BCE5077908a1b7370B9ae04AdC565EBd643966", "0xd96f48665a1410C0cd669A88898ecA36B9Fc2cce"], - "fantom": ["0xF5BCE5077908a1b7370B9ae04AdC565EBd643966", "0x74A0BcA2eeEdf8883cb91E37e9ff49430f20a616"], - "kava": ["0x630fc1758de85c566bdec1d75a894794e1819d7e"], - "optimism": ["0xa93c81f564579381116ee3e007c9fcfd2eba1723"], + "arbitrum": ["0x74c764D41B77DBbb4fe771daB1939B00b146894A", "0x7c8fef8ea9b1fe46a7689bfb8149341c90431d38"], + "avax": ["0xf4F46382C2bE1603Dc817551Ff9A7b333Ed1D18f", "0x1fC83f75499b7620d53757f0b01E2ae626aAE530"], + "bsc": ["0x090185f2135308BaD17527004364eBcC2D37e5F6"], + "ethereum": ["0xF5BCE5077908a1b7370B9ae04AdC565EBd643966", "0xd96f48665a1410C0cd669A88898ecA36B9Fc2cce"], + "fantom": ["0xF5BCE5077908a1b7370B9ae04AdC565EBd643966", "0x74A0BcA2eeEdf8883cb91E37e9ff49430f20a616"], + "kava": ["0x630fc1758de85c566bdec1d75a894794e1819d7e"], + "optimism": ["0xa93c81f564579381116ee3e007c9fcfd2eba1723"], }; -function chainTvl(chain, chainAddressIdentifier = chain) { - return (timestamp, ethBlock, chainBlocks) => - tvl(timestamp, chainBlocks, chain, addr => `${chainAddressIdentifier}:${addr}`); -} - -async function tvl(timestamp, chainBlocks, chain, transformAddress=addr=>addr) { - let marketsArray = []; - let balances = {}; - let block; +async function tvl(_, _1, _2, { api }) { + const { chain } = api + let marketsArray = []; - for (const [marketContract, lockedToken] of Object.entries(marketsJSON[chain])) { - marketsArray.push([lockedToken, marketContract]); - } + for (const [marketContract, lockedToken] of Object.entries(marketsJSON[chain])) + marketsArray.push([lockedToken, marketContract]); - block = chainBlocks[chain]; - let tokenBalances = (await sdk.api.abi.multiCall({ - block: block, - calls: bentoBoxAddresses[chain].map(bentoBoxAddress=> marketsArray.map((market) => ({ - target: bentoBoxAddress, - params: market - }))).flat(), - abi: abi.balanceOf, - chain: chain - })).output.map(t => t.output); - - for (let index = 0; index < marketsArray.length; index++) { - sdk.util.sumSingleBalance( - balances, - transformAddress(marketsArray[index][0]), - tokenBalances[index] - ); - } - - return balances; + const calls = bentoBoxAddresses[chain].map(bentoBoxAddress => marketsArray.map((market) => ({ + target: bentoBoxAddress, + params: market + }))).flat() + const tokens = bentoBoxAddresses[chain].map(_ => marketsArray.map(market => market[0])).flat() + let bals = await api.multiCall({ calls, abi: abi.balanceOf, }) + api.addTokens(tokens, bals) + return api.getBalances() } -module.exports = { - arbitrum: { - tvl: chainTvl('arbitrum') - }, - avax: { - tvl: chainTvl('avax') - }, - bsc: { - tvl: chainTvl('bsc') - }, - ethereum: { - tvl: chainTvl('ethereum') - }, - fantom: { - tvl: chainTvl('fantom') - }, - kava: { - tvl: chainTvl('kava') - }, - optimism:{ - tvl: chainTvl('optimism') - } -} \ No newline at end of file + +const chains = ['arbitrum', 'avax', 'bsc', 'ethereum', 'fantom', 'kava', 'optimism']; +chains.forEach(chain => module.exports[chain] = { tvl }) From 87595be6a4f98ea352f25e20ac1b323cdc44fea4 Mon Sep 17 00:00:00 2001 From: Ducky City <149130849+duckycity@users.noreply.github.com> Date: Tue, 14 Nov 2023 11:27:02 +0700 Subject: [PATCH 1956/1974] Add files via upload (#8052) * Add files via upload * Update index.js fix syntax * Update index.js fix syntax --------- Co-authored-by: Real Shaman <85087525+realdealshaman@users.noreply.github.com> --- projects/Ducky City/index.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 projects/Ducky City/index.js diff --git a/projects/Ducky City/index.js b/projects/Ducky City/index.js new file mode 100644 index 00000000000..1c3b7f13827 --- /dev/null +++ b/projects/Ducky City/index.js @@ -0,0 +1,14 @@ +const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') + +const contract = "0xe276437b808741f5c73b867fde8f3fed8c326876" + +async function tvl(time, ethBlock, _b, {api}) { + return sumTokens2({ tokens: [nullAddress], owner: contract, api }) +} + +module.exports = { + methodology: `We count the ETH on ${contract}`, + base: { + tvl + } +} From a1aedcbf959edd02c4405eba089312bfda315a43 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Tue, 14 Nov 2023 04:30:52 +0000 Subject: [PATCH 1957/1974] rename adapter --- projects/{Ducky City => ducky-city-sofi}/index.js | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename projects/{Ducky City => ducky-city-sofi}/index.js (100%) diff --git a/projects/Ducky City/index.js b/projects/ducky-city-sofi/index.js similarity index 100% rename from projects/Ducky City/index.js rename to projects/ducky-city-sofi/index.js From eac29123c474abb6f4d5af20e83eafd5a8bdd18e Mon Sep 17 00:00:00 2001 From: Holly-S33 <56821487+Holly-S33@users.noreply.github.com> Date: Tue, 14 Nov 2023 20:34:27 +0800 Subject: [PATCH 1958/1974] T2T2 update adapter (#8062) * T2T2 project SDK adapter * Update T2T2/index.js remove the wrong address * Update T2T2 adapter. add ethereum contracr address --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/T2T2/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/T2T2/index.js b/projects/T2T2/index.js index 565e0431306..40ef23eed27 100644 --- a/projects/T2T2/index.js +++ b/projects/T2T2/index.js @@ -1,6 +1,7 @@ const { nullAddress, sumTokensExport } = require("../helper/unwrapLPs"); const config = { + ethereum: '0xA875755b23a38E06B669219AFf9bb79845F43EFd', base: '0xE173A25C522385BB117b3044C79F534cD0a895EC' } From 455beb7e8e6f132782fd5dd5883fe9b1fb50e196 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 14 Nov 2023 13:57:15 +0100 Subject: [PATCH 1959/1974] Hummus (#8063) * Add Balancer Pools * split hummus --------- Co-authored-by: OdysseusTheKing --- projects/hummus-weighted/index.js | 7 +++ projects/hummus/constants.js | 74 ------------------------------- projects/hummus/index.js | 61 +++++++++---------------- 3 files changed, 27 insertions(+), 115 deletions(-) create mode 100644 projects/hummus-weighted/index.js delete mode 100644 projects/hummus/constants.js diff --git a/projects/hummus-weighted/index.js b/projects/hummus-weighted/index.js new file mode 100644 index 00000000000..09151f93e68 --- /dev/null +++ b/projects/hummus-weighted/index.js @@ -0,0 +1,7 @@ +const { onChainTvl } = require('../helper/balancer') + +module.exports = { + metis: { + tvl: onChainTvl('0x95B4F64c2a96F770C1b4216e18ED692C01506437', 7066703), + } +} diff --git a/projects/hummus/constants.js b/projects/hummus/constants.js deleted file mode 100644 index 6b780dd5b46..00000000000 --- a/projects/hummus/constants.js +++ /dev/null @@ -1,74 +0,0 @@ -const ADDRESSES = require('../helper/coreAssets.json') -/** - * lp token addresses - */ -// USD1 -const USD1_mUSDC_LP = "0x9E3F3Be65fEc3731197AFF816489eB1Eb6E6b830"; -const USD1_mUSDT_LP = "0x9F51f0D7F500343E969D28010C7Eb0Db1bCaAEf9"; -const USD1_mDAI_LP = "0x0CAd02c4c6fB7c0d403aF74Ba9adA3bf40df6478"; -const USD1_mBUSD_LP = "0x919395161Dd538aa0fB065A8EaC878B18D07FbCd" -const USD1_DAI_LP = "0xd5A0760D55ad46B6A1C46D28725e4C117312a7aD"; // deprecated -// USD2 - MAI -const USD2_mUSDC_LP = "0x8a19e755610aECB3c55BdE4eCfb9185ef0267400"; -const USD2_MAI_LP = "0x3Eaa426861a283F0E46b6411aeB3C3608B090E0e"; - -/** - * token addresses - */ -const mUSDC = ADDRESSES.metis.m_USDC; -const mUSDT = ADDRESSES.metis.m_USDT; -const mDAI = "0x4c078361FC9BbB78DF910800A991C7c3DD2F6ce0"; -const mBUSD = "0xb809cda0c2f79f43248C32b5DcB09d5cD26BbF10" -const DAI = ADDRESSES.metis.DAI; // deprecated -const MAI = ADDRESSES.moonbeam.MAI - -module.exports = { - mBUSD: { - id: "binance-usd", - addresses: [ - { - token: mBUSD, - lpTokens: [USD1_mBUSD_LP], - }, - ], - }, - mDAI: { - id: "dai", - addresses: [ - { - token: mDAI, - lpTokens: [USD1_mDAI_LP], - }, - ], - }, - mUSDC: { - id: "usd-coin", - addresses: [ - { - token: mUSDC, - lpTokens: [ - USD1_mUSDC_LP, - USD2_mUSDC_LP - ], - }, - ], - }, - mUSDT: { - id: "tether", - addresses: [ - { - token: mUSDT, - lpTokens: [USD1_mUSDT_LP], - }, - ], - }, - MAI: { - id: "mimatic", - addresses: [ - { - token: MAI, - lpTokens: [USD2_MAI_LP] - } - ] - } -}; diff --git a/projects/hummus/index.js b/projects/hummus/index.js index 19f126bd839..92dc08d3828 100644 --- a/projects/hummus/index.js +++ b/projects/hummus/index.js @@ -1,46 +1,25 @@ -const sdk = require("@defillama/sdk"); -const { staking } = require("../helper/staking"); -const constants = require("./constants"); +const { sumTokens2 } = require("../helper/unwrapLPs"); -async function balanceOf(owner, target, block) { - const chain = "metis"; - let decimals = (await sdk.api.erc20.decimals(target, chain)).output; - let balance = ( - await sdk.api.erc20.balanceOf({ - owner, - target, - block, - chain, - }) - ).output; - return Number(balance) / 10 ** decimals; +const config = { + metis: { + pools: [ + "0x248fD66e6ED1E0B325d7b80F5A7e7d8AA2b2528b", // main + "0x5b7e71F6364DA1716c44a5278098bc46711b9516", // mai + "0x9D73ae2Cc55EC84e0005Bd35Fd5ff68ef4fB8aC5", // busd + "0x7AA7E41871B06f15Bccd212098DeE98d944786ab", // old + ] + }, } -async function tvl(timestamp, ethereumBlock, chainBlocks) { - const block = chainBlocks["metis"]; - let balances = {}; - - for (const key in constants) { - const { id, addresses } = constants[key]; - let totalBalance = 0; - for (const { token, lpTokens } of addresses) { - for (const lpToken of lpTokens) { - totalBalance += await balanceOf(lpToken, token, block); - } - } - balances[id] = totalBalance; - } - - return balances; +async function tvl(timestamp, ethereumBlock, chainBlocks, { api }) { + const { pools } = config[api.chain] + const tokensArray = await api.multiCall({ abi: "address[]:getTokenAddresses", calls: pools }) + const tokens = tokensArray.flat() + const calls = tokensArray.map((t, i) => t.map((token) => ({ target: pools[i], params: token }))).flat() + const owners = await api.multiCall({ abi: "function assetOf(address) view returns (address)", calls }) + return sumTokens2({ api, tokensAndOwners2: [tokens, owners], }); } -module.exports = { - metis: { - tvl, - staking: staking( - "0x89351BEAA4AbbA563710864051a8C253E7b3E16d", // veHUM - "0x4aAC94985cD83be30164DfE7e9AF7C054D7d2121", // HUM - "metis" - ), - }, -}; +Object.keys(config).forEach(chain => { + module.exports[chain] = { tvl } +}) \ No newline at end of file From 71cb9e6590ac87a61ab079fa38ab2ff1e07667cb Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 14 Nov 2023 14:07:28 +0100 Subject: [PATCH 1960/1974] Wombat (#8064) * feat: add cross chain pool addresses (#8) * update to include scroll and avax * update to include scroll and avax * minor fix --------- Co-authored-by: thanh-wombat <139751487+thanh-wombat@users.noreply.github.com> Co-authored-by: arthur-rollie Co-authored-by: alex-wombat Co-authored-by: alex-wombat <90595868+alex-wombat@users.noreply.github.com> --- projects/wombat-exchange/config.js | 15 +++++++++++++++ projects/wombat-exchange/index.js | 6 +++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/projects/wombat-exchange/config.js b/projects/wombat-exchange/config.js index 437203c1c4c..36527270be4 100644 --- a/projects/wombat-exchange/config.js +++ b/projects/wombat-exchange/config.js @@ -28,6 +28,8 @@ module.exports = { SnBNB: "0xF1e604e9A31c3b575f91CF008445B7ce06BF3fef", USDS: "0x0c735f84BD7EDA8F8176236091AF8068Bb6C41dE", crossChainPool: "0x1ee15673e07105Bcf360139fa8CafeBDd7754BeF", + zBNB: "0x9a39f4AB3f52026432835dEe6D3DB721D95f3D28", + zUSD: "0xC26b7Cbe7e695a0d11a8cB96140D1Cd502945A2C", }, }, arbitrum: { @@ -63,6 +65,19 @@ module.exports = { crossChainPool: "0xA45C0ABeef67C363364E0e73832df9986aBa3800", }, }, + // does not have wom yet + scroll: { + pools: { + crossChainPool: "0x80f088ae72DB6d1AC337340cd6Aa0EB1F67337CE", + }, + }, + avax: { + wom: "0xa15E4544D141aa98C4581a1EA10Eb9048c3b3382", + pools: { + crossChainPool: "0xC9bFC3eFeFe4CF96877009F75a61F5c1937e5d1a", + sAVAX: "0xE3Abc29B035874a9f6dCDB06f8F20d9975069D87", + }, + }, hallmarks: [ [1662417125, "Liquidity Mining Start"], [1680674400, "Arbitrum Launching"], diff --git a/projects/wombat-exchange/index.js b/projects/wombat-exchange/index.js index ab4f03a3f8f..9b395ca1f08 100644 --- a/projects/wombat-exchange/index.js +++ b/projects/wombat-exchange/index.js @@ -3,10 +3,10 @@ const { staking } = require("../helper/staking"); const { sumTokens2 } = require("../helper/unwrapLPs"); Object.keys(config).forEach((chain) => { - const arg = config[chain]; + let { pools, wom, veWom } = config[chain]; module.exports[chain] = { tvl: async (_, _b, { [chain]: block }, { api }) => { - const pools = Object.values(arg["pools"]); + pools = Object.values(pools); let allUnderlying = await api.multiCall({ abi: "address[]:getTokens", calls: pools, }); @@ -21,7 +21,7 @@ Object.keys(config).forEach((chain) => { const wTokens = await api.multiCall({ abi: "function addressOfAsset(address) view returns (address)", calls, }); return sumTokens2({ api, tokensAndOwners2: [tokens, wTokens], }); }, - staking: staking(arg["veWom"], arg["wom"],), + staking: (wom && veWom) ? staking(veWom, wom) : undefined, }; }); From d79eec74c111d213338312b906262bcd86980e2d Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 14 Nov 2023 14:19:52 +0100 Subject: [PATCH 1961/1974] Frankencoin (#8065) * feat: track FrankenCoin * cache graph response --------- Co-authored-by: holy-pengy --- projects/frankencoin/index.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 projects/frankencoin/index.js diff --git a/projects/frankencoin/index.js b/projects/frankencoin/index.js new file mode 100644 index 00000000000..e3bc610dc6c --- /dev/null +++ b/projects/frankencoin/index.js @@ -0,0 +1,19 @@ +const { sumTokens2 } = require('../helper/unwrapLPs') +const { cachedGraphQuery } = require('../helper/cache') + +const MintingHub = "0x7bbe8F18040aF0032f4C2435E7a76db6F1E346DF"; +const Collaterals = ["0xb4272071ecadd69d933adcd19ca99fe80664fc08"]; // XCHF + +async function tvl(_, _b, _cb, { api, }) { + const tokensAndOwners = Collaterals.map(i => [i, MintingHub]) + const { positions } = await cachedGraphQuery('frankencoin', 'https://api.thegraph.com/subgraphs/name/frankencoin-zchf/frankencoin-subgraph', '{ positions { position collateral } }') + positions.forEach(i => tokensAndOwners.push([i.collateral, i.position])) + return sumTokens2({ api, tokensAndOwners, }) +} + +module.exports = { + ethereum: { + tvl, + }, + start: 1698487043, +}; From ed58ba79c6ef40c4c6ff9adecc1710bba896b721 Mon Sep 17 00:00:00 2001 From: Antoine <67124021+antoineborg@users.noreply.github.com> Date: Tue, 14 Nov 2023 14:21:55 +0100 Subject: [PATCH 1962/1974] SwissBorg: Add Cardano and Avalanche wallets (#8056) --- projects/swissborg/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/swissborg/index.js b/projects/swissborg/index.js index aa88c6836e8..2422bd9bff6 100644 --- a/projects/swissborg/index.js +++ b/projects/swissborg/index.js @@ -58,6 +58,8 @@ const config = { owners: [ 'addr1qxqut96hxv5zxmhcgspmnq9tuaf6xglvq6tdv8jm5zltatv5hnm8tps2jw73pherd4l9yuuetxlp6gkeufq5p6ftjswssk33fx', 'addr1q9vrcmu4sr7yrspknu8gwrzgrs6wuh0e6pkk9tyz2clg9llt77jyl7422xv72h9mc9kmsgvajssj4a4cpsv07n4e5lpqkfe9ft', + 'addr1qy9ffv7zmqtmenskcnvsxszhv6zsls8gkl339tc5d2c5davhg2p4nekj924whmlmczq3jkf22yt5wh3ml7f8g3mxud4ss6mwyd', + 'addr1qx2tzwkx4fjg8cg0htw27cje4029cmf2plsm3nws5qyky45njhmrzd25840eesfu6q33tzaqxtrqarfuqe9wpsc9ks0qea4lcq', ], }, hedera: { @@ -81,6 +83,7 @@ const config = { '0x87cbc48075d7aa1760Ac71C41e8Bc289b6A31F56', '0xcDE4c1b984F3F02f997ECfF9980B06316de2577d', '0x7153D2ef9F14a6b1Bb2Ed822745f65E58d836C3F', + '0xFF4606bd3884554CDbDabd9B6e25E2faD4f6fc54', ] }, polygon: { From dfcdf9bfa2e5a0c72adf6c2c9aa4b5ee9e6f0436 Mon Sep 17 00:00:00 2001 From: Andy Date: Tue, 14 Nov 2023 21:27:12 +0800 Subject: [PATCH 1963/1974] feat: remove unibotV2 polygon and add bsc (#8053) --- projects/diamond-unibot-v2/index.js | 39 ++++++++++++++--------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/projects/diamond-unibot-v2/index.js b/projects/diamond-unibot-v2/index.js index d4fd33284e8..4680f5ec6e0 100644 --- a/projects/diamond-unibot-v2/index.js +++ b/projects/diamond-unibot-v2/index.js @@ -3,6 +3,7 @@ const { getLogs, getAddress } = require("../helper/cache/getLogs"); const { sumTokens2 } = require("../helper/unwrapLPs"); const config = { arbitrum: { + proxyDeployer: "0x8a908ec03e2610fa8dcaec93bb010560780ec860", lendingPools: [ [ ADDRESSES.arbitrum.WETH, @@ -17,7 +18,7 @@ const config = { "0x4d5043d90f13ac2E6318B3aF9C3423A5224b920C", ], // ARB ], - vaults: [ + balanceVault: [ [ [ ADDRESSES.arbitrum.USDC, // USDC @@ -29,51 +30,49 @@ const config = { ], fromBlock: 49135720, }, - polygon: { + bsc: { + proxyDeployer: "0xD8006420c1b2901849505eb3517cc36a169AE0A7", lendingPools: [ [ - ADDRESSES.polygon.WETH_1, + "0x0e09fabb73bd3ade0a17ecc321fd13a19e81ce82", "0x8610D60f5329B0560c8F0CEb80175F342fe943F3", - ], // WETH - [ - ADDRESSES.polygon.WMATIC_2, - "0xEdD1efA76fe59e9106067D824b89B59157C5223C", - ], // WMATIC + ], // CAKE ], - vaults: [ + balanceVault: [ [ [ - ADDRESSES.polygon.USDC, // USDC - ADDRESSES.polygon.WETH_1, // WETH + ADDRESSES.bsc.USDT, // USDT + ADDRESSES.bsc.BUSD, // BUSD + ADDRESSES.bsc.WBNB, // WBNB + "0x0e09fabb73bd3ade0a17ecc321fd13a19e81ce82", // CAKE ], "0xD576bE0d3CC1c0184d1ea3F1778A4A9Dec523859", // vault ], ], - fromBlock: 49135720, + fromBlock: 28688279, } } async function tvl(_, _b, _cb, { api }) { - const { vaults, lendingPools, fromBlock, } = config[api.chain] - + const { balanceVault, lendingPools, fromBlock, proxyDeployer } = config[api.chain] const logs = await getLogs({ api, fromBlock, - target: "0x8a908ec03e2610fa8dcaec93bb010560780ec860", + target: proxyDeployer, topics: ["0x647c6c21d1279361153a5cf7618a50b9573a9729986f26d91c8a7e6501750f6f",], }); - const pools = logs.map((i) => getAddress(i.topics[1])); + const factories = logs.map((i) => getAddress(i.topics[1])); const wantTokens = logs.map((i) => getAddress(i.data)); - await sumTokens2({ api, owners: pools, resolveUniV3: true }); - const tokensAndOwners = wantTokens.map((i, idx) => [i, pools[idx]]); + await sumTokens2({ api, owners: factories, resolveUniV3: true }); + const tokensAndOwners = wantTokens.map((i, idx) => [i, factories[idx]]); tokensAndOwners.push(...lendingPools) - vaults.forEach(([tokens, vault]) => tokens.forEach(i => tokensAndOwners.push([i, vault]))) + balanceVault.forEach(([tokens, vault]) => tokens.forEach(i => tokensAndOwners.push([i, vault]))) return sumTokens2({ api, tokensAndOwners }); } module.exports = { doublecounted: true, arbitrum: { tvl }, - polygon: { tvl }, + bsc: { tvl } } From 0ba9f9bd5cd91c40b4fe42c1c99c317b4969039b Mon Sep 17 00:00:00 2001 From: zilayo <84344709+zilayo@users.noreply.github.com> Date: Tue, 14 Nov 2023 13:31:16 +0000 Subject: [PATCH 1964/1974] feat: add mayachain (#8051) --- projects/helper/chains.json | 2 + projects/mayachain/index.js | 117 ++++++++++++++++++++++++++++++++++++ 2 files changed, 119 insertions(+) create mode 100644 projects/mayachain/index.js diff --git a/projects/helper/chains.json b/projects/helper/chains.json index cccbaa8300c..ca1d208fc2b 100644 --- a/projects/helper/chains.json +++ b/projects/helper/chains.json @@ -50,6 +50,7 @@ "cube", "curio", "darwinia", + "dash", "defichain", "dexit", "dfk", @@ -132,6 +133,7 @@ "manta", "mantle", "map", + "mayachain", "meer", "meta", "meter", diff --git a/projects/mayachain/index.js b/projects/mayachain/index.js new file mode 100644 index 00000000000..cccbcb6b0e3 --- /dev/null +++ b/projects/mayachain/index.js @@ -0,0 +1,117 @@ +const { getCache, get } = require("../helper/http"); +const sdk = require("@defillama/sdk"); +const { nullAddress } = require("../helper/tokenMapping"); +const { ethers } = require("ethers"); + +const chainMapping = { + ETH: "ethereum", + KUJI: "kujira", + BTC: "bitcoin", + THOR: "thorchain", + DASH: "dash", +}; + +const tokenGeckoMapping = { + "ETH.USDT": "tether", + "ETH.WSTETH": "wrapped-steth", + "ETH.ETH": "ethereum", + "ETH.USDC": "usd-coin", + "KUJI.USK": "usk", + "KUJI.KUJI": "kujira", + "THOR.RUNE": "thorchain", + "DASH.DASH": "dash", + "BTC.BTC": "bitcoin", +}; + +const tokenToDecimalMapping = { + "ETH.USDT": 6, + "ETH.WSTETH": 18, + "ETH.ETH": 18, + "ETH.USDC": 6, + "KUJI.USK": 8, + "KUJI.KUJI": 8, + "THOR.RUNE": 8, + "DASH.DASH": 8, +}; + +async function tvl(_, _1, _2, { api }) { + const pools = await getCache("https://midgard.mayachain.info/v2/pools"); + const aChain = api.chain; + + const balances = {}; + await Promise.all(pools.map(addPool)); + return balances; + + async function addPool({ asset: pool, assetDepth, runeDepth }) { + if (aChain === "mayachain") { + sdk.util.sumSingleBalance(balances, "cacao", runeDepth / 1e10); + return; + } + + if (+assetDepth < 1) return; + + let [chainStr, token] = pool.split("."); + let chain = chainMapping[chainStr]; + if (chain !== aChain) return; + + let [baseToken, address] = token.split("-"); + if (chain === "ethereum") { + assetDepth = + assetDepth * + 10 ** (+tokenToDecimalMapping[chainStr + "." + baseToken] - 8); + + // e.g. ETH.USDC-0XA0B86991C6218B36C1D19D4A2E9EB0CE3606EB48 + if (address && ethers.utils.isAddress(address.toLowerCase())) { + address = address.toLowerCase(); + sdk.util.sumSingleBalance(balances, address, assetDepth, chain); + + // eg ETH.ETH + } else if (chainStr === baseToken) { + sdk.util.sumSingleBalance(balances, nullAddress, assetDepth, chain); + } else if (tokenGeckoMapping[pool]) { + sdk.util.sumSingleBalance( + balances, + tokenGeckoMapping[pool], + assetDepth / 1e8 + ); + } else { + sdk.log("skipped", pool, Number(assetDepth).toFixed(2)); + } + } else { + // e.g KUJI.KUJI + if (chainStr === baseToken) { + sdk.util.sumSingleBalance(balances, chain, assetDepth / 1e8); + } else if (tokenGeckoMapping[pool]) { + sdk.util.sumSingleBalance( + balances, + tokenGeckoMapping[pool], + assetDepth / 1e8 + ); + } else { + sdk.log("skipped", pool, assetDepth); + } + } + } +} + +async function staking() { + var res = await get("https://midgard.mayachain.info/v2/network"); + const { totalActiveBond, totalStandbyBond } = res.bondMetrics; + return { + cacao: (Number(totalActiveBond) + Number(totalStandbyBond)) / 1e10, + }; +} + +module.exports = { + timetravel: false, + methodology: + "Counts bonded CACAO on Mayachain + assets locked in Asgard vaults on other chains + CACAO in LPs on Mayachain", + mayachain: { + tvl, + staking, + }, +}; + +Object.values(chainMapping).forEach((chain) => { + module.exports[chain] = { tvl }; +}); From d4a3dedc42ce615f2d4b2c72135f33933d370528 Mon Sep 17 00:00:00 2001 From: 0xmDreamy <124707942+0xmDreamy@users.noreply.github.com> Date: Tue, 14 Nov 2023 14:31:37 +0100 Subject: [PATCH 1965/1974] fix(abracadabra): Add overrides for the underlying token of wrapped tokens (#8050) --- projects/abracadabra/index.js | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/projects/abracadabra/index.js b/projects/abracadabra/index.js index fea513940af..071d50e655e 100644 --- a/projects/abracadabra/index.js +++ b/projects/abracadabra/index.js @@ -16,9 +16,25 @@ const bentoBoxAddresses = { "optimism": ["0xa93c81f564579381116ee3e007c9fcfd2eba1723"], }; +const underlyingTokens = { + arbitrum: { + "0x3477Df28ce70Cecf61fFfa7a95be4BEC3B3c7e75": "0x5402B5F40310bDED796c7D0F3FF6683f5C0cFfdf", + }, + avax: {}, + bsc: {}, + ethereum: { + "0x5958A8DB7dfE0CC49382209069b00F54e17929C2": "0x903C9974aAA431A765e60bC07aF45f0A1B3b61fb", + "0x3Ba207c25A278524e1cC7FaAea950753049072A4": "0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490", + "0xd92494CB921E5C0d3A39eA88d0147bbd82E51008": "0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490", + }, + fantom: {}, + kava: {}, + optimism: {}, +}; + async function tvl(_, _1, _2, { api }) { const { chain } = api - let marketsArray = []; + const marketsArray = []; for (const [marketContract, lockedToken] of Object.entries(marketsJSON[chain])) marketsArray.push([lockedToken, marketContract]); @@ -28,8 +44,10 @@ async function tvl(_, _1, _2, { api }) { target: bentoBoxAddress, params: market }))).flat() - const tokens = bentoBoxAddresses[chain].map(_ => marketsArray.map(market => market[0])).flat() - let bals = await api.multiCall({ calls, abi: abi.balanceOf, }) + const tokens = bentoBoxAddresses[chain].map(_ => + marketsArray.map(([lockedToken]) => underlyingTokens[chain][lockedToken] ?? lockedToken) + ).flat() + const bals = await api.multiCall({ calls, abi: abi.balanceOf, }) api.addTokens(tokens, bals) return api.getBalances() } From c93a1c6f334d34deb4b2be855132c633ec80b77e Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 14 Nov 2023 16:56:38 +0100 Subject: [PATCH 1966/1974] deltaprime: track Joe LP tvl --- projects/deltaprime/index.js | 50 +++++++++++++++++++++++++++++++----- 1 file changed, 44 insertions(+), 6 deletions(-) diff --git a/projects/deltaprime/index.js b/projects/deltaprime/index.js index 1e0bcecb71e..3556c72af8b 100644 --- a/projects/deltaprime/index.js +++ b/projects/deltaprime/index.js @@ -49,6 +49,7 @@ async function tvlAvalanche(timestamp, block, chainBlocks, { api }) { ] const accounts = logs.map(i => `0x${i.topics[1].slice(26)}`) + await addTraderJoeLPs({ api, accounts }) const positions = await api.multiCall({ abi: getStakingPositionsAbi, calls: accounts }) const ownedAssets = await api.multiCall({ abi: getAllOwnedAssetsAbi, calls: accounts }) const vectorTokens = {} @@ -62,10 +63,10 @@ async function tvlAvalanche(timestamp, block, chainBlocks, { api }) { }) positions[i].forEach(({ asset, identifier }) => { asset = asset.toLowerCase() - if(ethers.utils.parseBytes32String(identifier).toLowerCase().includes("auto")){ + if (ethers.utils.parseBytes32String(identifier).toLowerCase().includes("auto")) { if (!vectorAutoTokens[asset]) vectorAutoTokens[asset] = [] vectorAutoTokens[asset].push(o) - }else{ + } else { if (!vectorTokens[asset]) vectorTokens[asset] = [] vectorTokens[asset].push(o) } @@ -73,6 +74,7 @@ async function tvlAvalanche(timestamp, block, chainBlocks, { api }) { }) const balances = await sumTokens2({ api, tokensAndOwners: tokensAndOwners }) + console.log(Object.entries(vectorAutoTokens).length, Object.entries(vectorTokens).length) await Promise.all(Object.entries(vectorTokens).map(([token, accounts]) => addVectorVaultBalances({ api, balances, accounts, token }))) await Promise.all(Object.entries(vectorAutoTokens).map(([token, accounts]) => addVectorVaultBalancesAuto({ api, balances, accounts, token }))) return balances; @@ -95,7 +97,9 @@ async function tvlArbitrum(timestamp, block, chainBlocks, { api }) { ] const accounts = logs.map(i => `0x${i.topics[1].slice(26)}`) - const ownedAssets = await api.multiCall({ abi: getAllOwnedAssetsAbi, calls: accounts }) + const ownedAssets = await api.multiCall({ abi: getAllOwnedAssetsAbi, calls: accounts, }) + await addTraderJoeLPs({ api, accounts }) + accounts.forEach((o, i) => { ownedAssets[i].forEach(tokenStr => { tokenStr = ethers.utils.parseBytes32String(tokenStr) @@ -106,12 +110,46 @@ async function tvlArbitrum(timestamp, block, chainBlocks, { api }) { }) }) - return await sumTokens2({ api, tokensAndOwners: tokensAndOwners }); + return sumTokens2({ api, tokensAndOwners: tokensAndOwners }); +} + +async function addTraderJoeLPs({ api, accounts }) { + const pairSet = new Set() + const bins = await api.multiCall({ abi: 'function getOwnedTraderJoeV2Bins() public view returns (tuple(address pair, uint24 bin)[])', calls: accounts }) + const calls = [] + bins.forEach((res, i) => { + const account = accounts[i] + res.forEach(({ pair, bin }) => { + pair = pair.toLowerCase() + pairSet.add(pair) + calls.push({ target: pair, bin, account }) + }) + }) + const pairs = [...pairSet] + const tokenXs = await api.multiCall({ abi: 'function getTokenX() view returns (address)', calls: pairs }) + const tokenYs = await api.multiCall({ abi: 'function getTokenY() view returns (address)', calls: pairs }) + const pairInfos = {} + pairs.forEach((pair, i) => { + pairInfos[pair] = { + tokenX: tokenXs[i], + tokenY: tokenYs[i], + } + }) + const bals = await api.multiCall({ abi: 'function balanceOf(address, uint256) view returns (uint256)', calls: calls.map(({ target, account, bin }) => ({ target, params: [account, bin] })) }) + const binBals = await api.multiCall({ abi: 'function getBin(uint24) view returns (uint128 tokenXbal,uint128 tokenYBal)', calls: calls.map(({ target, account, bin }) => ({ target, params: [bin] })) }) + const binSupplies = await api.multiCall({ abi: 'function totalSupply(uint256) view returns (uint256)', calls: calls.map(({ target, account, bin }) => ({ target, params: [bin] })) }) + binBals.forEach(({tokenXbal, tokenYBal}, i) => { + const { tokenX, tokenY } = pairInfos[calls[i].target] + const ratio = bals[i] / binSupplies[i] + api.add(tokenX, tokenXbal * ratio) + api.add(tokenY, tokenYBal * ratio) + }) + } -function translatePlatypusLPToBaseToken(token){ +function translatePlatypusLPToBaseToken(token) { // Platypus USDC Asset (LP-USDC) -> USDC - if(token === "0x06f01502327de1c37076bea4689a7e44279155e9"){ + if (token === "0x06f01502327de1c37076bea4689a7e44279155e9") { token = ADDRESSES.avax.USDC; } return token; From 8820e3464f2770ffc0a3db1f06da116dc44602fd Mon Sep 17 00:00:00 2001 From: Santiago Baldassin <140439001+balda-rdx@users.noreply.github.com> Date: Tue, 14 Nov 2023 13:05:40 -0300 Subject: [PATCH 1967/1974] deprecating c9 project (#8067) * Revert "adding CVR (#7784)" This reverts commit 7ecd727c593fffec8aeeb4f3d86dc66a8fad4085. * add caviarnine projects * update the url for the aggregator * remove the aggregator from tvl * removing deprecated project --- projects/caviarnine/index.js | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 projects/caviarnine/index.js diff --git a/projects/caviarnine/index.js b/projects/caviarnine/index.js deleted file mode 100644 index b612f403efa..00000000000 --- a/projects/caviarnine/index.js +++ /dev/null @@ -1,12 +0,0 @@ -const { sumTokens } = require('../helper/chain/radixdlt'); -const { getConfig } = require('../helper/cache') -module.exports = { - radixdlt: { - tvl: async (_, _1, _2, { api }) => { - const { shapeliquidity } = await getConfig('caviarnine', 'https://api-core.caviarnine.com/v1.0/shapeliquidity/get_components') - const owners = shapeliquidity.map(i => i.component_address) - return sumTokens({ owners, api, }) - }, - }, - timetravel: false -} From ecbd9a29ca84a9a5c6f15e582ada83e36def8e44 Mon Sep 17 00:00:00 2001 From: Define101 Date: Tue, 14 Nov 2023 16:09:36 +0000 Subject: [PATCH 1968/1974] divide voodoo into two --- projects/voodoo-trade-base/index.js | 14 ++++++++++++++ projects/voodoo-trade/index.js | 1 - 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 projects/voodoo-trade-base/index.js diff --git a/projects/voodoo-trade-base/index.js b/projects/voodoo-trade-base/index.js new file mode 100644 index 00000000000..e854d075ef1 --- /dev/null +++ b/projects/voodoo-trade-base/index.js @@ -0,0 +1,14 @@ +const { gmxExports } = require("../helper/gmx"); +const { pool2 } = require("../helper/pool2"); + +const config = { + base: { vault: '0x4F188Afdc40e6D2Ddddf5fd1b2DF7AEF7Da52f50', lpToken: '0xbF65A2775F0a091a8e667a1c1345c427C9D86761', stakedLpTokenTracker: '0x1DD46Dd21F152f97848b32D504de491E696bA1C5' }, +} + +Object.keys(config).forEach(chain => { + const { vault, lpToken, stakedLpTokenTracker, } = config[chain] + module.exports[chain] = { + tvl: gmxExports({ vault }), + pool2: pool2(stakedLpTokenTracker, lpToken,), + } +}) \ No newline at end of file diff --git a/projects/voodoo-trade/index.js b/projects/voodoo-trade/index.js index 657759f56ae..e6fb5bf8e2c 100644 --- a/projects/voodoo-trade/index.js +++ b/projects/voodoo-trade/index.js @@ -3,7 +3,6 @@ const { pool2 } = require("../helper/pool2"); const config = { fantom: { vault: '0x40cbDDAED8b0d7Ee3cF347aAb09Bf4a8cFa15F01', lpToken: '0xC42437A6da389D88799A9e706da3EA6628342295', stakedLpTokenTracker: '0xBf47b011C36F29e7C65b6cf34c1d838EA1b67069' }, - base: { vault: '0x4F188Afdc40e6D2Ddddf5fd1b2DF7AEF7Da52f50', lpToken: '0xbF65A2775F0a091a8e667a1c1345c427C9D86761', stakedLpTokenTracker: '0x1DD46Dd21F152f97848b32D504de491E696bA1C5' }, } Object.keys(config).forEach(chain => { From f19e16bfd4208ed92282cec688a6ea904f59822f Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 14 Nov 2023 17:12:21 +0100 Subject: [PATCH 1969/1974] Notional (#8069) * fix: adding v3 tvl * split notional --------- Co-authored-by: Jeff Wu --- projects/notional-v3/index.js | 16 ++++++++++++++++ projects/notional/abi.json | 3 ++- 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 projects/notional-v3/index.js diff --git a/projects/notional-v3/index.js b/projects/notional-v3/index.js new file mode 100644 index 00000000000..39eca0f25dc --- /dev/null +++ b/projects/notional-v3/index.js @@ -0,0 +1,16 @@ +const { sumTokens2 } = require('../helper/unwrapLPs'); +const abi = require('../notional/abi'); + +const contract = "0x1344A36A1B56144C3Bc62E7757377D288fDE0369" + +async function tvl(timestamp, block, _, { api }) { + let oracles = await api.fetchList({ lengthAbi: abi.getMaxCurrencyId, itemAbi: abi.getPrimeCashHoldingsOracle, target: contract, startFromOne: true, }) + let underlying = await api.multiCall({ abi: 'address:underlying', calls: oracles.map((o) => ({ target: o})) }) + let holdings = await api.multiCall({ abi: 'address[]:holdings', calls: oracles.map((o) => ({ target: o})) }) + let tokens = underlying.concat(holdings.flatMap((_) => _)) + return sumTokens2({ tokens, owner: contract, api }) +} + +module.exports = { + arbitrum: { tvl } +}; \ No newline at end of file diff --git a/projects/notional/abi.json b/projects/notional/abi.json index 4c5e817c6b9..0ff67647c62 100644 --- a/projects/notional/abi.json +++ b/projects/notional/abi.json @@ -1,4 +1,5 @@ { "getMaxCurrencyId": "function getMaxCurrencyId() view returns (uint16)", - "getCurrency": "function getCurrency(uint16) view returns ((address,bool,int256,uint8,uint256),(address,bool,int256,uint8,uint256))" + "getCurrency": "function getCurrency(uint16) view returns ((address,bool,int256,uint8,uint256),(address,bool,int256,uint8,uint256))", + "getPrimeCashHoldingsOracle": "function getPrimeCashHoldingsOracle(uint16) view returns (address)" } \ No newline at end of file From 146573384d7bec53b80573513ff3834b93f3a59d Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 14 Nov 2023 17:35:29 +0100 Subject: [PATCH 1970/1974] track 9inch.io --- projects/9inch-io/index.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 projects/9inch-io/index.js diff --git a/projects/9inch-io/index.js b/projects/9inch-io/index.js new file mode 100644 index 00000000000..9efa763195a --- /dev/null +++ b/projects/9inch-io/index.js @@ -0,0 +1,16 @@ +const { getUniTVL } = require('../helper/unknownTokens') +const config = { + ethereum: '0xcBAE5C3f8259181EB7E2309BC4c72fDF02dD56D8', + pulse: '0x5b9f077a77db37f3be0a5b5d31baeff4bc5c0bd7', +} + +module.exports = { + misrepresentedTokens: true +} + +Object.keys(config).forEach(chain => { + const factory = config[chain] + module.exports[chain] = { + tvl: getUniTVL({ factory, useDefaultCoreAssets: true, fetchBalances: true }) + } +}) \ No newline at end of file From 56fa20f25270a7f8562ca8ef4c2078a45a6dbf56 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 14 Nov 2023 17:49:26 +0100 Subject: [PATCH 1971/1974] 9inch: track staking --- projects/9inch-io/index.js | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/projects/9inch-io/index.js b/projects/9inch-io/index.js index 9efa763195a..545601d264e 100644 --- a/projects/9inch-io/index.js +++ b/projects/9inch-io/index.js @@ -1,16 +1,48 @@ const { getUniTVL } = require('../helper/unknownTokens') +const { sumTokensExport } = require('../helper/unwrapLPs') const config = { ethereum: '0xcBAE5C3f8259181EB7E2309BC4c72fDF02dD56D8', pulse: '0x5b9f077a77db37f3be0a5b5d31baeff4bc5c0bd7', } +const staking = { + pulse: { + tokensAndOwners: [ + ['0x3ca80d83277e721171284667829c686527B8b3c5', '0x8878f27fD90922F4DeBb91dcf5B6E6301C23fE33'], + ['0x8b4cfb020aF9AcAd95AD80020cE8f67FBB2C700E', '0x0e173B11523feB064FD483209d0eD534831A2a86'], + ['0x9565c2036963697786705120Fc59310F747bCfD0', '0xFEF11BfA82A66e845Cb7EF815B83B2d22C324131'], + ['0x52Ada28F70BC8EBe5dd4381120d3CD76863919A8', '0x8A402a93469D5820079529CA093595e0d9AF62Ac'], + ['0x95B303987A60C71504D99Aa1b13B4DA07b0790ab', '0x0Ea7f06D7694058B82d46Fb5c9281e1843Aa8702'], + ['0xDe0220b69CE3e855a0124433A8E8D093f53A6bE4', '0xa1EAee97ee29e2C80ee9F1321E0132f19b45A26A'], + ] + }, + ethereum: { + tokensAndOwners: [ + ['0x9565c2036963697786705120Fc59310F747bCfD0', '0x3eFC853438e9c06130D104088d73647517617887'], + ['0x9565c2036963697786705120Fc59310F747bCfD0', '0xa1EAee97ee29e2C80ee9F1321E0132f19b45A26A'], + ['0xFD8b9Ba4845fB38c779317eC134b298C064937a2', '0x9b2B253D75DC61FC9ae512e04850e258bEbEf8C6'], + ['0x015628ce9150db1bce2fbb717a09e846f8a32436', '0x0e173B11523feB064FD483209d0eD534831A2a86'], + ['0x015628ce9150db1bce2fbb717a09e846f8a32436', '0x91c58Cf141ABBEB6aB8D83976103Bca70b69C24e'], + ['0x015628ce9150db1bce2fbb717a09e846f8a32436', '0xdf598bfe7b8eB5ABd217871317E31a48d9E4432F'], + ['0x52ada28f70bc8ebe5dd4381120d3cd76863919a8', '0xdBD90Fc90101Bdd5EE0e8b2C26A32c9E59047415'], + ['0x52ada28f70bc8ebe5dd4381120d3cd76863919a8', '0x0022E0C25BbA451b08942367b98e4B4a617538f2'], + ['0xDe0220b69CE3e855a0124433A8E8D093f53A6bE4', '0x664e78C17d64234440A26CA72a6946A270251059'], + ['0xDe0220b69CE3e855a0124433A8E8D093f53A6bE4', '0x211F7596Db264469c4114db5C41b86E173B0A29a'], + ['0x2de509bf0014ddf697b220be628213034d320ece', '0xB9BB00965AC5c8e8b261243C3C442E3F00B82C1F'], + ['0x2de509bf0014ddf697b220be628213034d320ece', '0xEA01a51a675170d4939C1439d558Eb3B896C29Ec'], + ] + } +} + module.exports = { misrepresentedTokens: true } Object.keys(config).forEach(chain => { const factory = config[chain] + const sConfig = staking[chain] module.exports[chain] = { - tvl: getUniTVL({ factory, useDefaultCoreAssets: true, fetchBalances: true }) + tvl: getUniTVL({ factory, useDefaultCoreAssets: true, fetchBalances: true }), + staking: sConfig ? sumTokensExport(sConfig) : undefined } }) \ No newline at end of file From 5741ba79a057a3e98bebaa1e75a9dfcb6f24b989 Mon Sep 17 00:00:00 2001 From: Tan Date: Tue, 14 Nov 2023 12:15:54 -0500 Subject: [PATCH 1972/1974] Updating duckpools TVL (#8070) * Add duckpools * Fix duckpools implementation * fix imports * add nullAddress * fix import * erg pool * just erg * only sigusd * only sigrsv * only quacks * final fix * add collateral contracts * Update duckpools.js * Update duckpools.js * Update token pools * Update duckpools.js * Add RSN pool to duckpools --- projects/duckpools.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/duckpools.js b/projects/duckpools.js index eb596ba1cf8..875f5c37aa5 100644 --- a/projects/duckpools.js +++ b/projects/duckpools.js @@ -14,12 +14,15 @@ module.exports = { "4EQTxw3MSn9fDbvzUN4qmbe6zFBp6MGrtmoeoVWU54Vv9hVr3kBhVd23e9tdtMLXb39gT4jtFtFejjj7Y8KUBrig9obUvh6n3Xp1BdYMGesCDwA517r7zWr7h8QkZZvtM9KQyYdrnEccgDDjE621ggJn1x5GA4eY3JC5MswfvzGpt2CJegvo1dwyy9VzmwmLFhyaD8LXypN3Y37qxKwmtz9LbHdphbjuCqG45pdn1WjPitdpyZmxNbgfkQRu9iiEmrp4bDx4FL2D6uLDbcGmES3p5rnnJsAkFma3kTBXbUapgdpftRyWfxT5GWGYSmPgLDC6GupfgXtnwrxZFxFdVrExULVGQe47iMija8iUVe6rKnW3maudjZDc87G7eJkn5AB6Kbae48N4QwUJhL1ehjoK6NW4DK2HFWbYhf9jXddnGHMwmp3eUKjzXREbsxmtcd8NQAYi6faZacRJiSGJ4pEMcnRPmgUrzkthTmz5MaSEvPU2qV8iss8JoE4huPkXUe36Jc2epBnPDrSpcoD9RnMwtogh7Zt9ZbwqJvRCvRBubrXR4R3JA62j46coMci7t2PnZNieCysUXFajpgEoBffZecK7m1gH7kKhxAzMUHMLGWncnXsbFPv95dwPramLr688uErR5tTp1Lg8YzkpwrZ6JyEYxR7MtiagBbxaABe69Pfi622kQZPpxCEa8Xth1VhUZM5arjVCfG51ayVD1GVL5hj1uxwowyAHqYPq1vvSoopk9cdUhXc2hzL63FdCV2bpg8pjdo6gavk9iokjafJbVq2sCrMoUmhYDL8gcNhbfu95AU4jdn8wDopEW8dkEk8qcv2uqBWGFpDmaSm1aArMiK4MFasjC8v2XfaDBVUtQbmjb4cFTHKHen43quXcx4N1xZVCZZdpuDi9oEd9M29vWtCHckShumUztHB6yeXneik5YhhM7zzwQZavJk6jvEUg9oy67x1skzWaXJUnaybu1WEi1UtfrZHPS4t56EvTLee1rR4gLMtS8qeBrFBbpWEKEFNdKrz7FgR57NxPkwcJuaTnktURL4Tan4xMysAuwcpCMrV4ritxiKdbxaVUk71WKihQdRQkdue1tBNqzLDxn42fxN9EeDu6bLBCq1pB61cfUm7ECxKPtbQVQXPKBLPtBuwbEH11h62DtGCQ31rn8iwk8k58bthMSHjcbHjZpNkDi3dz7sJ7iknQFQnEhLLpNvqGhK3pYccyemJfFtX13UJGR4pfM7TYznSEQGjdo5q3ACenebnuP8Y5wXDAoK2zc3Nqy2EtijrtY2QopiNpXRuJR5dtJiCQHw7ku5b6NC5WBi9dfnaoy92qaxVzCZf4Gag3rCeBWRhN5R85eg1WLqEDwZDzxwU8Dwh5bMSp82qWME6Ew84ezcEuHe2cfsxyXTk1pJ3dhLaQp7M3ZAts7rLRhLxznVgDi5KA4c2goh4CDpbbhpRG9fofkqQAZ4jkBdF46BKKG2T4vvRb1Y97eJE9N9Py8PoQkVJjbbgAhit7mFzoiUxz4W54c1KQbgkPTXGr1unfH8rjdA2JpbAJesrb2szbgr1GKSnjt2NsdMF76Uy1MqaVevkY935M82xshpw724Trd63Ph1N4PSrCcZ2gUcYWLtZfpY84ZUvU7EpxnePT79VRrzcAztXwYmFX2jBGThhmhSFLaVDA2b1iNbtwioaegkg5banQNVgJ46AfVFcM9gpekWJTksjjWwHeP7fdU9XGgyCu4oKk9Eung3YtKuVNosvJ5abWXrgLwVFJKhrNgE4fsmpsRuLcTeKmA7YxY6KtaddDgyf1MahcWioduzLu2RF1jg8fkehspokpW5pFLfVUTkkZXd68vrbAMy8gBLAzhtuzAC7Lk5dJdBVkr53JEtbgcoQRPDP6RaJoqKLxnWjc3bNZud9LzLanMD26h1WbiPkKRWFxkrh8iSm8hZGhYKQAuFPKKi7cifXHio4ZBrNdLGu2uLGbhArhkLTa7GCRDJJrhKSbT5oigPq5QguqXtmuYY2JPakYAuCjVgBQjQiNYmkAeSdNnEgeysHPp3VbxhpWLu3Ty15JiVdbSxD6xDPy1XQ3DNv4XoaN8UcPRT1fSRNLsvGDmR5Y4E1sZbfPQBVebzYzjsqFBnwLg9m6Ei13YS2avfwC8hBuMe5cVKWbCFrWJAPmhkd6HEoFhuF2WRMJGbMPaTG4ixuz8SLTttqpGDzFYAmytjsHq1xaFYF3gG8V2Wxq5ckV6fgu7C7koCHaaQdAiFghqeFBS7nn75yUr961gDeVkvTnYWmuE55nBZepxocynSLkLiPP8cyfRDEYK1siydfJHuUgoCm9DNgA5A8scBF4T6ubkBrZ1jX6GoNQVfWfjJeAH66oeqBDRyFcy2BLUkpp6FqUhFVPoXc2caqbxhGg1fdfgFwsaqctwoBGXs8A8XXdodbJ8JzisfTA5w4cE2RvQsmagAicbq", "4EQTxw3MSn9fDbvzUN4qmbe6zFBp6MGrtmoeoVWU54Vv9hVr3kBhVd23e9tdtMLYutpx737TXvM2A9gBwAW3ByZTVCjyM3XHrNwER1RxU2By5gXMAtcTfuBTZuTyzBb4i3dqVcgeeJoKz6X8TcpYApx9u4qyzmYpzB3i2Aeor25SgpmKwcmpZWi9tVBXTLbQwKvaU7TtXoSWwD1QuX4SNX2koCjQWHYfoi4n6v4RwxzjqgxygQkUoxT2HmNtpkvBdybrc9t3t2DeKhsghwwcTve2NBeL2PeMauS6ayH5iCyX39waxUX4qMuceKz8MLWLdN4rrXVXpCreDsE4uU59eunFDHc6j2C3mPnoywhJAkbBMSqHBJR9pjfnLeGvFe56yGnGXHcrn9esBEFMnN9KA3gHWzAKw6U5oGDopaoPM7oHriMosUxUZzuugcHEqcUCfWnvZciuyqmXcNdRRuuprGWytTsaoECD7hXmhrc7F4ZEHA3kFnPZ5Q3rbtVpCV3yy2cjVG1FYc1woU3G5h3PMqoG1TMAQQPGzWa2YnyU5LmKvkp4M1YbEXn563AjpZeZy1DmdLUeKbbgzwG4Y4f8m3xTNVStzwZphT4YcNe3Nwa2D1Rvkw9jMAJ3qgrVCvpsQxGcwsDcATRqvCTyCN13E5A3UDx8uq9ro7R9eM5d28qrUS3AjaTLaHnthRn5VVyJPetekdPN3kwxxGuHoVL2HL1CXcFsBZNYFrimyXGHWFWoCZw5y2JQabKMGtT2iwHY3LaoDRrH68k64qQ4n3mkSQgndV8K7Gk7pHRAQ4vzhPATYdr4mtt9EYR7owJkzLAPYrq3xngsVrwjRP2SUwu8HhAgZsU9mJtq6f1gng597L4dshWrcYjyRofvZ3Xrf4YeFVHoPBfALpSwUQFLgVwFADUHdm1rKN2QzU5ddSzv4CkgW9bQUvHcxihJCRvtPezdbBoTiBrHFYQoSivjRDhZX4HWLe8Uz7W22ZgQ1iwQwEDxAKtN3WJKQ1fiynSLcafruHkmiszmqi3hf42itqvbtdHqQQuk3xxSQbWifxXvJyCNd9rv4ekQcDfCvdDswvf9T3cjCRsNn6QLCZMbgNU4TLwNv2qJFDyQDzNxzboBZ4uhVUUYFKcomYfkUep3mKN1Ay8Z4NeS2UZhPPMNfugCatNHMYzpo7wSciTUjeLFyiNQ7AyjWq9ZYkEKWWYvHEyne8ugoG43dxCCe5fLSXENh9aDoYvaK1NPkCr1m4i11A9K2Rpib26hspFwwPfPh7AvMeMn4KRhBXCMXpGXrVoeVKAYNDCwPxJz37Ampp2kB3b1EGK2A3TKjxG7qJJSb2pb5wKbCMeuQNYeX9qypQ6yHfat1yfszLZEdThRnCTMUnYX6wKF1T3TbAMgXHzUauXowjVegjo1MzrzDxQQaFSpuwrZ1o5tEryWYXj7Fi6d6juMU98RfZoxu1AxBqDAjVv6HBNJJzbx9sic9rCb7p9bnHGTqi2U7Hzj4zVFYyWFt8mPQqbSFyofekapEnKFBFvZhLS4q6s95f4rXKKPGPLxASc63hZfqScdFuuTMej5VM4DSYzyQEKXk2faZ4QcwdSE3cuTkHUQXH5wymK1LKiDd4Ysyvom2zaYmhAN7pCTWJC6iG8qVotNLGiN7JcwJy1n8oahjuQA6hFCRVQ2uNHghsjPZj1DtY9SLUgLtV4qzHpE64ufXD2J7F21TRKzYsS8LiwqaJD2ZPHfk5kQYrssWs7dnzzRqDNANk7UP91isuUTG7Yckp7XhRKiQLm3FgQMw54c1HSV7N8HrsLKYJBU7uGw4d48ys6R3T35h1tCAwUMfMynM5wKZFaZUp6dRgiwyUyGqnaQqCS953zsQkMtokXo8EQQKpPdjwx1UvNoWaLtBwZ4hoU5UzFN3USvSgiaUYg8xFXD4zDNhPTkvXMUBWWiFbqYhyVMYAhsXb29tYYuwGWZwYR77s4D4REe88LvvYe9k2ERkC5kZStTV3rVciiK437wUUBGUFmUB1ZAF6Cq4iNCxtUgxfqS8wRi4RXygBBUGAdDRhTeciGftohXuW5bmPQcnJ4QPThyuUgz6oxfYXocA1gcfbT28MFBU9idDm4vrDRbXfR1jrHT9TZtsiXERbfdzjnV4LdaEeMzeszmFnN5hzRhyz6yPFAThdVvnNbnMtb2cCWKbR7QjpSRYGRhkURYn4nE4qMLdXfZHuzFTUF61pFjphJV9ZDY5Ub1Ta6qiWqFAeBBR44HkWqBZvReQYRzZKLRgRm7j1GPzsX7m7wTyiTBerm4HwU9kx8daRcBybhXxpGiRbEjRmT7jstdGnhtWvxVYTRDfrmNFpL2WC1dBwMY9wEgoxstZK3JMNs7aQszAsTtuj8nhxKGpYPUL8WWBqfuz8oB2HtSH9794Kcm9NxEhSZebY898kYzd4NzYHqiyry2R8oeukJhEBDCqbuWD1FDuV", "4EQTxw3MSn9fDbvzUN4qmbe6zFBp6MGrtmoeoVWU54Vv9hVr3kBhVd23e9tdtMLYgB7ioXsj9npXPgJcP5HTT7U6qSt9mtcpyxStDP5tz8D3pzzAFBNaEeG43x8i1gYSjpKs8jTxgS7uvrCNJri9pPUSzGXtyeBqCXikUZidprZUfepsvexajPrXQ3C13wXySNDvqVggHzfA1CT1pSafzKSPxfVy1y9NJoV6cyfQQawNRSZQwuEHedsMwZcRFDJ3LiEvGS4GiGwoHzVYgFmHjGvEHrRQss6XjzML5pL4ce1XPQX9Lyv4z2QCRWBm2J1k9KTVtCNGHaf9SfD89WpgnkeBNj4ezgePgfkdqKs92Yb3LBsv4TxnF1LJYKowZ6G3jMsWLeyfR7zKkboHQyP2d6Shq9nFBjU4fohr1N2RSkmDyUKBcx3JJwGUVXfUjqRkrWH8xSyJkZkGM5VLMXSThhHvhz6ZeHGrY2hQxBSo3UUxXuwadrCNgk5rd41muA2yVijwXk3uLb1HL2RjQHnJw9bt8Je4Jy1YWytEu4JPWBaEkjLgz12cHVsq7yCoucPcqijvAeMmhKtgpjAji53a9W5Rax4t3X4fEnoJH5X11XPsK2QWiNijTEJ57AmvaVjBTViYikmfRjtviCd8NzSwfWBBkPeCAYsh7wzNU8KE1Zscs4dHjpyzrSHJuiv4DM4ovhN77sBcWVcn5cTcWaoJp3dzXXmAZrLGtyyBnRKu7XThJVvdkQgyyL8HsVwjnWfZdGnFiAk9V8MSJBFAX3fgyuhzx9RbnE9WCzUut9ob8jASjCDsABkn8NwhgsN3ofUmzjKDanW2Xt28qr9v2wK2ZXrHkT8zK351Z4LeirZD2S7Uh9ZSEagkjNddXeKmdgYG2KH2DrCS3vuyeTFpYcPt8rAy3CFC2PRYaN3AgwR8Hk8maKPH8xFPG8uXTCWCtQARm2Kv49BMhzi4QoRaurAtYTmfyqnSkAumkRiKRyKiJ9oZRjaa9X7S2CM2iuiGo4hLehQAsfTTGbaLsjWNcsRKVxqwvJUU2uGjdywUGTgaVptBUd4epkFUQgegu4os4qo1fJQxXVmmrawuC1tHtndak9Cioz3Uyh7TWZwH8wBmTYrwLzSJygV1d83gfnrfpBbdimFdw8g6igVMeNruWqVwoiYCLPWyDtRzYpvEMopyiDqofLpPLYRg9FEJUyj1TRNXR8nKsH8ei3rELrx1zdFVomRWBAkaoiHp5YNzy1qavDoNMvj3fQeu3qAQhgR4fgpUZmsZd1qRueiVWAaUVfuvynPhupvAXN5AveGzP7nJsXhV43KNVNSgMk3bi9gznHzCSLsPoCkDrbzWDA7gLUpon2cXJ26wPXdtoC5BGbQxmwCskvukxQRmG2Btrn8LgauSYHqRgEnT5sY2fJg3wahwQWtNWgr92DUBfpdVdRfapu9UCnG1wx1wHgBNabhfWthT174w8RjdKdsxW48cQXsQvAzVom22eZKDTi7Zi3onf41NfFTdT37BikhUKnJpkpdA5k8XSdkBidKamZK8Udxkz4SKbQfqYC5u8VKotJHScGvPzwq5gkqTrKnj7rFkznicMBLUehpnCziygD6y9CJpHsUXkELeyFbodfi3VbfWMnQ84FKMDCAE2vjCvb59vGREqQdsGk1tQYbSn5E4aJd5qPEmNgxPRTJAHZCwuNMS1AXkEMfh9oa3jU3wdLHPapWLzBuunNQjdM8DHUNc4ZuJqXxn6DMR8pAXyo1nf5obuE4xg5X6b6EszwupvDi9LfV28WnFNBVFUFgvcQv2XYYeCuo8pP21iH8T4hkRcn6W6Eh2TSysMNxMBfNcqUfTNRhnw2j9K2kfybPTRmXaxd62NsuX9jXrgFe7MrmKVn39sMpWSc9QkyqHF9neHkjVnZJrz3S9xJJpLxMiTQUJVG8BHAxLAEYszW2HrTsHAT4Fe6Ua52BGMFNQFDAjYPdjdDcSHsG8JELZaiU6oczPMRyKdy8tco2hRrQpzNhuUzwtLh3Upir4kUH93iTS2fxHdaVoq6GMQKonSrfZxxrHpLE8cMiKhhjKSU55nc6Jh3HFE71xNoWx32joPi7XfwTBDU13WUS1g7bBBVeV1k5Hf5njBrTjSQ8rMDtZArMQNrHeP5UgWeUTk438rihGN1gj9QrCPQcdUvGTgfpmkY8gjvJQTsMekiKku5zsfmMFH3yMFgdzTXj1Mh1L35KCCXQEnNAgQjX2MW7v3QFQdohbjtLTaS44uWLKEwU5HLwDVXicpTMADPwv1AKFU5Wi3BrzUoyDPGQd4oVuCbz2BMdz6jxx8dGzFBUBH63HsjevsziZADWwEWia4jVCA7XCRpazRJSDEiLqiXWA6ZVw2y36sqD6e3oZjfkzmKB3i88zoc7eRSDpYa2KS6bM4EQm8AjgTSfQkpTKS64VpLtZqLKBzN52f13bo1jkRRqey7", + "uNSWCGrJoB8w8CD4eBFT28pcoDd3q9sGHYFrQXZc9GSeb8nP2TEGuDtMf17W4J9BogDHNYFYrXdskbbbhxMxYM3Yp4sK6b6qhqPS4DNb4vB73Jy8NCMcbaoUcFfQLcKm4nPkCpFdwdo9n7GzKEECFFXe6FiDFbnoEtqkTsseg88zDcZmVdanXvMa7fL6yJoYppQBBH1XPtjHzSqpg7m8iThpfjjp1Wi1yGbewpFsvZ5roq3TzU8Jk928fgUBWa8MnHConNXAai7FJTo5w9EXuEhXoLhmgoCbJSMrgR5diTNYHm17FGd6mU1dTnRpk1dvx7TjpCz9cadJQw6DHfGjprdiLjkkdjcjnpUrpMdBjBrCf5CgjdH7VkC3RtudksekKNGAHaV46nx4yChvPXJSDmRjY8zPrXruzPqfJgXnajRcKJ2PW6uA7bx8yXVEAwhCFhyAxfGkab2FycXhSi4hQWJoQRETDpj5SvNRxE86aL5GdXYzQs9zbd1rqWAr9sqQ7tGTwh9TLmSMsLDmU7z9RoqpYEacLJvPYdMRD2EJYJVGN9XFHcnUcAGQNxDx7bks4opAtFvTQpX5SUHog6WNMsbwP5sRJGMN4Tm4yszqVvQAiPATDBmtQLVwqG13aan5bp87noNVr9vBZraLoEtuEuLqD1foBgN5NF5yTUJgoA5RSQhiquCr98tpZWivCeFoFVLTYknBfejLULv4faTUTPAp4KztNdeMqkYcDhjqTRFko7Lbf2XsUxeaYDvotcLn3hmgeJsr45SwbrUyDtsFtVuwPjis1vJiWwyNwF4WJiP4XrgEVJpNNXGMZJjpYZ7cNZx5Eary3LCKegMwDus4j1WUhxEW7q5BowgGuFwsncWpFBXPpbJeuBu3tbsXfyrDxQFHYVoLyGRDb2bJjazAWVY3eVNMNsxLk4aBiNMstfAynGngbw8r7hw5vhMWLL7S2CaBrz5ELbVZRowvBgDXc7Xxx6XiMN1x6KZhSU8gFHjAuzggHNo5WEfg9bE4G5qUsdpbsF29iorGCxyKFNiWfVriELMGBo4vgmvEwoPft2yREQjay4U5se4GWT7SBmYN7cWmM9c5qQzzQtVP78Xht13wH93QmVh6NDXb8hCC8p3vgR34ejXuCuXiLd1h52EVxcn7zUUHLmvEo4JaivGuPZgWHeeu6r7kg5nhBrzWkmvVXpiTbdEvMFvsh6vgMamytw6EtJuDBpKuk3xHrdBEHaoWLDBqxNL7TeewnK4qipPiJsszNtbuwkHpkYSMzaC9Yjs6AoKEPL2cpg28dJkXmA7gsC8g8fxxZL3GkhraLGpKPKotbEQNWaNo7AuZyGYEwaFdfkrGXLY5BBTNaYpyEYk6qaUk3oemvaA9TPZnijqbcU5W1YenQkHsh1Qbw2V36SX3qLrzwNVqvurDysRs9MjymKG1SgWfdi5Ti9dFcCW7DU3xtkrKdzXnsJoDbAfcZkqn3iczDVx119Y8QVDMrubAJFPqTCvKYNsZtQTe5Qw33D7YYb6Q6CW6SuVCXS9VAV9LwmYdbdRzU2bVQ1yuxby6NAhN4WX2evNv4PLowM3DfURPKVDV6js7zJ2b1SDFg445mLkhDac4RWTmCtPmze5wAtV2y3hoS9mTQtiHHftmNhroSJZW4eKpFZvm2jzT5QCttvxnoxZGSNfy6dmQbprDNYZfGkEJoCASooctFH1MEr8gP8P1XnC8Q183XUveQsXyad7Pfbew1t5TseXWuDrb9gcusmVVaH", + "4EQTxw3MSn9fDbvzUN4qmbe6zFBp6MGrtmoeoVWU54Vv9hVr3kBhVd23e9tdtMLYiY59w1zNEqVuQu4Xb187pY4giJogDig2ejkgwSmsusia3YCnEPps5wMd3UTfaX2JSSynw6i4k8i7g6dnKkNVSsdH71wLDbFGrbicPwKLBWuBuAtS1Mu71utFqMiJmaJS5tghrjm1hy7jCpz9oavqMTMtq3C9pUUSfchiE8YYpkfH2HvEADtvDpJuyMY2ZfcV26ZoKieriMDMB3iSowGm5DzDfzFYQ6u3h9wvsQ2B581X8hgxmUDBv4BG2oX7596bycYt7z8H5NwcATVsMbAgigvWw6ANPrGNm3sYo2A3EUg9f37ib8xHmwa6odmscxMhTxWZdztK6h1BrkyfEV7vYoY3t1ordZyJN4YeS51v44VkFZDvSkaGizM4KshCDsfASy6J5ceFGE3rZA77DH8qNmD3nAUcBzcKWTt9Kzsc41PnguKAq5e9P1q6AeXYNZEsHiyvXiGwBTMioxmkpAey5LNYFRNqSndMY8ncGLUPAfQ956L9YzoHaGNNuwwbiqFRcHC9yTYQLRph8uvSdpWRtepCuuY7hRuVqQbBQixT9iABfQVBqteCyhQayDFGVLwW9XJ7aKdGktsGvHbq7UfW2gyYbwd7mYN4ieqRrKHgLLUD5RSHVuU8JMgwk4Wqzfjjob7XGpJv4YkwiDTePrPpUwZzfPsh5jUQvpJo8L6C9QRddZhEe4wtaK557NVeewh6NBHe5f72HjN9UABtFtesxQPQyKX68KUEVUzDuzrmsCZ8ryB8qDd4tXeFeqNGp4UHsN2Czed7cB3mMTX3jKVQTMxxaTCHpN8qPeiGT9iPURnzYGLR68UqEivh7JRs9PcSGXHupxUxzQTDUoYMxbKxtiT8jyUtbrzWGPKLQhXHG7RmJbh7g2yE3hyA7Ucou5ukPh2xF5Ke9hsY3c6rTnXMiouSnpBarpzAN3yeErDLFX71EWhEXmQmrUE8DYFc8Yd2gvoX31cgEsFBu4qSXeqQymiBtAZYBzbVySmxJb3mxRhKbNLygtoxugiJSHmt3aXMTn7SoqxjnahdZVsddoy1vMRZqMDn5XuycYus8zg6GGiJVZZQNzrEft3J4hhkQTzeQoEYmzbFpzWaSSwudXCS8ggP4tpVKd8ETd31T17SJk4Mt1EdZTDogZVm8mR66d38nxHWMXq8DQeb7iQWUNtgwLXwerG2p8rCPMbLxrgw3JDvh2haCmZtAcu4cN8DYAbDXjoTs71ZhY8HVpRr6CvXwKZYE6gqeEtByzifeeyZcAuSkrfeBgEncubApkookzGbjfnDdXdFMdavDYzGLx6BPsaYskKg7gzN6EMmnrbASvoHCVQA6qWqYoQ8UYY7qgik8pj5wzVVrc4PfCz1fmDKAm4sN4VBvZCGEfupx6afYbPLkWBDmySTB7B1cu4GWWPirpAZtkyEFk4kQYqt3yTb8nutSNbzvZyerEt36fm5358FPtJQ6ZP7zL5jCyMqWXN7Lvx2wfyK7CVXX39tU2WNvxcMs7PidSAEe4pn3MTxmraS1GBbKCwLYC8rJGzyX8EWamVSXKWgi4R8mXH49gBsNJ1yG22fAdHnShRAtSBxJDEnPUwVTT2jZ3W9PVMooeD8EfVMcsNKsv6SxM68ZRmyTD7hiEADmHPpFfSBxz6JTJPduWyhmjbnjdvDE2o7mS8KQaFCWnq8WV5PzWzK5m4X8GE9KdnLwbFXbYcr21ho6CmdRpLN4KayZqsnGxHnSKTG4YJC3sshyZMuh78S46LV7BGjCdjzBsCkH3DLczPFyaSwGU55Hy3o9RkYULsgpffzsGzZBswC8WMSG6WYxLsL2cyuaXuwjzgZuh4npnNVDoos3yuSio3TWWxqzFKb7BcR4vJC3jyn8DKQyy2WuweoyhA1LN5CBD79xSP9L7iMzmhB4X1EneMWZQdhWPNb5vmVMgZ6TWywkbiAYKexXtRYMkZytudaZutrAojHu8StFpvjcqVJszfvwGnFKBuZr1x36NzUHz6SCAWHtt4WdLrFGDBDm3VayfKDUBvDgWTtNN1YizXmfpjiMiTMaaTP17n9RSaTTxzmVnp3iqj4cryy5vyWPxpCgK9gc6q7TrepJQQqtxBYVSNZJHdFp6ENDk24ypN6JGjyN1pLKKdG9fb2Na64kvULXqnjsriAScytY4JCaX7cBqcr1DfNLACwq8h3L2bzz1N1nzUVWtzuYKEh2rzsLjndj6XndfycDnedAnLs2pz3sY6GSnWySwhkmHaWfQQFk9kUW8buUwp3bax5aP4ccWvaMAcoCJ6GeEMcDsz26BXvZgYFdgn3BUQuyvgUa4c3G4CyDEahbZs8BK7uPtZns7bPraP9pmhgwbdCUynno1M4iMmsKs2wNMwLRw77eXNzoCPv4eKZHor4KvPBwTfWkkvoXu8m3a", ], tokens: [ nullAddress, "03faf2cb329f2e90d6d23b58d91bbb6c046aa143261cc21f52fbe2824bfcbf04", "003bd19d0187117f130b62e1bcab0939929ff5c7709f843c5c4dd158949285d0", "089990451bb430f05a85f4ef3bcb6ebf852b3d6ee68d86d78658b9ccef20074f", + "8b08cdd5449a9592a9e79711d7d79249d7a03c535d17efaee83e216e80a44c4b", ], }), }, From fbdcddc514c77dac3eae574a51c16a058aa196eb Mon Sep 17 00:00:00 2001 From: Larry the Cucumber <71284258+larrythecucumber321@users.noreply.github.com> Date: Tue, 14 Nov 2023 17:40:52 -0300 Subject: [PATCH 1973/1974] Update Reserve (#8048) * update Reserve assets for wrapped Compound * resolve morpho token --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/reserve/index.js | 102 ++++++++++++++++++++++++++++++-------- 1 file changed, 82 insertions(+), 20 deletions(-) diff --git a/projects/reserve/index.js b/projects/reserve/index.js index 493ad9cd34c..a6730bd52f4 100644 --- a/projects/reserve/index.js +++ b/projects/reserve/index.js @@ -1,4 +1,4 @@ -const ADDRESSES = require('../helper/coreAssets.json') +const ADDRESSES = require("../helper/coreAssets.json"); const { sumTokens2, genericUnwrapCvxDeposit, @@ -19,6 +19,9 @@ const chainConfigs = { rsr: "0x320623b8E4fF03373931769A31Fc52A4E78B5d70", vault: "0xaedcfcdd80573c2a312d15d6bb9d921a01e4fb0f", fromBlock: 16680995, + erc4626Wrapped: [ + '0xaa91d24c2f7dbb6487f61869cd8cd8afd5c5cab2', + ] }, base: { deployerAddresses: [ @@ -32,7 +35,8 @@ const chainConfigs = { async function tvl(_time, block, _, { api, chain }) { const config = chainConfigs[chain]; - + let { erc4626Wrapped = [] } = config; + erc4626Wrapped = erc4626Wrapped.map(i => i.toLowerCase()) // Common logic for calculating TVL (only mainnet has vault) const ownerTokens = config.vault ? [ @@ -68,20 +72,36 @@ async function tvl(_time, block, _, { api, chain }) { }); let processedWrappers = new Set(); - let wrapperBalances = {}; const allTokens = basketRes.flatMap(([tokens], i) => { ownerTokens.push([tokens, rTokens[i]]); ownerTokens.push([tokens, backingManagers[i]]); - return tokens + return tokens; + }); + const allRTokens = basketRes.flatMap(([tokens], i) => + tokens.map(() => rTokens[i]) + ); + const allManagers = basketRes.flatMap(([tokens], i) => + tokens.map(() => backingManagers[i]) + ); + const allNames = await api.multiCall({ + abi: "string:name", + calls: allTokens, }); - const allRTokens = basketRes.flatMap(([tokens], i) => tokens.map(() => rTokens[i])) - const allManagers = basketRes.flatMap(([tokens], i) => tokens.map(() => backingManagers[i])) - const allNames = await api.multiCall({ abi: "string:name", calls: allTokens }); - const aTokenWrappers = allTokens.filter((_, i) => allNames[i].startsWith("Static Aave")); - const cUsdcV3Wrapper = allTokens.find((_, i) => allNames[i].startsWith("Wrapped cUSDCv3")); - const stargateLpWrappers = allTokens.filter((_, i) => allNames[i].startsWith("Wrapped Stargate")); - const convexTokensAndOwners = [] + const aTokenWrappers = allTokens.filter((_, i) => + allNames[i].startsWith("Static Aave") + ); + const cUsdcV3Wrapper = allTokens.find((_, i) => + allNames[i].startsWith("Wrapped cUSDCv3") + ); + const stargateLpWrappers = allTokens.filter((_, i) => + allNames[i].startsWith("Wrapped Stargate") + ); + const cTokenWrappers = allTokens.filter( + (_, i) => /^Compound.*Vault$/.test(allNames[i]) // Starts with Compound, ends with Vault + ); + const convexTokensAndOwners = []; + const erc4626TokensAndOwners = [] allTokens.forEach((token, i) => { if (!allNames[i].startsWith("Flux ")) return; @@ -98,24 +118,64 @@ async function tvl(_time, block, _, { api, chain }) { convexTokensAndOwners.push([token, allManagers[i]]); }); - let aTokens = await api.multiCall({ abi: api.chain === 'base' ? "address:aToken" : "address:ATOKEN", calls: aTokenWrappers, }); - blacklistedTokens.push(...aTokenWrappers, ...stargateLpWrappers); - aTokens.forEach((v, i) => ownerTokens.push([[v], aTokenWrappers[i]])); + allTokens.forEach((token, i) => { + token = token.toLowerCase() + if (!erc4626Wrapped.includes(token)) return; + blacklistedTokens.push(token); + erc4626TokensAndOwners.push([token, allRTokens[i]]); + erc4626TokensAndOwners.push([token, allManagers[i]]); + }); + let cTokens = await api.multiCall({ + abi: "address:underlying", + calls: cTokenWrappers, + }); + + let aTokens = await api.multiCall({ + abi: api.chain === "base" ? "address:aToken" : "address:ATOKEN", + calls: aTokenWrappers, + }); + blacklistedTokens.push( + ...aTokenWrappers, + ...stargateLpWrappers, + ...cTokenWrappers + ); + cTokens.forEach((v, i) => ownerTokens.push([[v], cTokenWrappers[i]])); + aTokens.forEach((v, i) => ownerTokens.push([[v], aTokenWrappers[i]])); if (stargateLpWrappers.length) - await getStargateLpValues(api, stargateLpWrappers, processedWrappers, wrapperBalances); + await getStargateLpValues( + api, + stargateLpWrappers, + processedWrappers + ); if (cUsdcV3Wrapper) { blacklistedTokens.push(cUsdcV3Wrapper); - await getCompoundUsdcValues(api, cUsdcV3Wrapper, processedWrappers, wrapperBalances); + await getCompoundUsdcValues( + api, + cUsdcV3Wrapper, + processedWrappers + ); } - - await Promise.all(convexTokensAndOwners.map(([token, owner]) => genericUnwrapCvxDeposit({ api, token, owner, }))); + await Promise.all( + convexTokensAndOwners.map(([token, owner]) => + genericUnwrapCvxDeposit({ api, token, owner }) + ) + ); await unwrapCreamTokens(api.getBalances(), fluxListWithOwner, api.block); + if (erc4626TokensAndOwners.length) { + const erc4626Tokens = erc4626TokensAndOwners.map(([token]) => token) + const assets = await api.multiCall({ abi: "address:asset", calls: erc4626Tokens }) + const bals = await api.multiCall({ abi: 'uint256:totalAssets', calls: erc4626Tokens }) + const totalSupplies = await api.multiCall({ abi: 'uint256:totalSupply', calls: erc4626Tokens }) + const balances = await api.multiCall({ abi: 'erc20:balanceOf', calls: erc4626TokensAndOwners.map(i => ({ target: i[0], params: i[1] })) }) + balances.forEach((bal, i) => api.add(assets[i], bal * bals[i] / totalSupplies[i])) + } + await sumTokens2({ api, ownerTokens, blacklistedTokens }); } @@ -128,10 +188,12 @@ async function staking(_time, block, _, { api, chain }) { module.exports = { ethereum: { - tvl, staking, + tvl, + staking, }, base: { - tvl, staking, + tvl, + staking, }, methodology: `TVL accounts for the underlying ERC20 collateral which back RTokens.`, }; From e9636ff58304a01deff6167ac5ed933cc848a824 Mon Sep 17 00:00:00 2001 From: zilayo <84344709+zilayo@users.noreply.github.com> Date: Tue, 14 Nov 2023 20:41:49 +0000 Subject: [PATCH 1974/1974] fix: remove bonded CACAO from MAYAChain staking tvl (#8073) --- projects/mayachain/index.js | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/projects/mayachain/index.js b/projects/mayachain/index.js index cccbcb6b0e3..6423ca0d7c4 100644 --- a/projects/mayachain/index.js +++ b/projects/mayachain/index.js @@ -94,21 +94,12 @@ async function tvl(_, _1, _2, { api }) { } } -async function staking() { - var res = await get("https://midgard.mayachain.info/v2/network"); - const { totalActiveBond, totalStandbyBond } = res.bondMetrics; - return { - cacao: (Number(totalActiveBond) + Number(totalStandbyBond)) / 1e10, - }; -} - module.exports = { timetravel: false, methodology: - "Counts bonded CACAO on Mayachain + assets locked in Asgard vaults on other chains + CACAO in LPs on Mayachain", + "Counts assets locked in Asgard vaults on other chains + CACAO in LPs on Mayachain", mayachain: { tvl, - staking, }, };